From b0eb74aa182cc2f71906f93b7c2b6c640c3ee1e4 Mon Sep 17 00:00:00 2001 From: myang Date: Wed, 3 Feb 2010 19:28:34 +0000 Subject: [PATCH] speed up bind function for Variant Summary: The bind function for Variant is frequently called. For instance, every rvalAt returns a Variant and therefore involves a call to bind(). I did some manual inline to speed up bind especially when the type is primitive. For the following test case, the speed up is about 12.6%. 986 bytes .../php-5.2.5/Zend/tests/cast_to_bool.phpt | 53 + .../php-5.2.5/Zend/tests/cast_to_double.phpt | 57 + .../php-5.2.5/Zend/tests/cast_to_int.phpt | 55 + .../php-5.2.5/Zend/tests/cast_to_object.phpt | Bin 0 -> 1106 bytes .../php-5.2.5/Zend/tests/cast_to_string.phpt | Bin 0 -> 621 bytes phpt/tests/php-5.2.5/Zend/tests/catch.phpt | 23 + .../tests/php-5.2.5/Zend/tests/catch_002.phpt | 33 + .../tests/php-5.2.5/Zend/tests/catch_003.phpt | 38 + .../tests/php-5.2.5/Zend/tests/catch_004.phpt | 43 + .../Zend/tests/class_constants_001.phpt | 22 + .../Zend/tests/class_constants_002.phpt | 31 + .../Zend/tests/class_constants_003.phpt | 33 + .../php-5.2.5/Zend/tests/compare_001.phpt | 389 + .../Zend/tests/compare_001_64bit.phpt | 389 + .../php-5.2.5/Zend/tests/compare_002.phpt | 341 + .../Zend/tests/compare_002_64bit.phpt | 341 + .../php-5.2.5/Zend/tests/compare_003.phpt | 389 + .../Zend/tests/compare_003_64bit.phpt | 389 + .../php-5.2.5/Zend/tests/compare_004.phpt | 389 + .../Zend/tests/compare_004_64bit.phpt | 389 + .../php-5.2.5/Zend/tests/compare_005.phpt | 389 + .../Zend/tests/compare_005_64bit.phpt | 389 + .../php-5.2.5/Zend/tests/compare_006.phpt | 389 + .../Zend/tests/compare_006_64bit.phpt | 389 + .../php-5.2.5/Zend/tests/concat_001.phpt | 78 + .../php-5.2.5/Zend/tests/decrement_001.phpt | 60 + .../Zend/tests/decrement_001_64bit.phpt | 60 + phpt/tests/php-5.2.5/Zend/tests/div_001.phpt | 32 + phpt/tests/php-5.2.5/Zend/tests/div_002.phpt | 15 + .../Zend/tests/double_to_string.phpt | 52 + .../Zend/tests/double_to_string_64bit.phpt | 58 + .../php-5.2.5/Zend/tests/dtor_scope.phpt | 32 + .../php-5.2.5/Zend/tests/errmsg_001.phpt | 16 + .../php-5.2.5/Zend/tests/errmsg_002.phpt | 14 + .../php-5.2.5/Zend/tests/errmsg_003.phpt | 19 + .../php-5.2.5/Zend/tests/errmsg_004.phpt | 15 + .../php-5.2.5/Zend/tests/errmsg_005.phpt | 18 + .../php-5.2.5/Zend/tests/errmsg_006.phpt | 12 + .../php-5.2.5/Zend/tests/errmsg_007.phpt | 12 + .../php-5.2.5/Zend/tests/errmsg_008.phpt | 12 + .../php-5.2.5/Zend/tests/errmsg_009.phpt | 13 + .../php-5.2.5/Zend/tests/errmsg_010.phpt | 13 + .../php-5.2.5/Zend/tests/errmsg_011.phpt | 16 + .../php-5.2.5/Zend/tests/errmsg_012.phpt | 11 + .../php-5.2.5/Zend/tests/errmsg_013.phpt | 14 + .../php-5.2.5/Zend/tests/errmsg_014.phpt | 17 + .../php-5.2.5/Zend/tests/errmsg_015.phpt | 14 + .../php-5.2.5/Zend/tests/errmsg_016.phpt | 14 + .../php-5.2.5/Zend/tests/errmsg_017.phpt | 14 + .../php-5.2.5/Zend/tests/errmsg_018.phpt | 15 + .../php-5.2.5/Zend/tests/errmsg_019.phpt | 14 + .../php-5.2.5/Zend/tests/errmsg_020.phpt | 14 + .../php-5.2.5/Zend/tests/errmsg_021.phpt | 17 + .../php-5.2.5/Zend/tests/errmsg_022.phpt | 14 + .../php-5.2.5/Zend/tests/errmsg_023.phpt | 17 + .../php-5.2.5/Zend/tests/errmsg_024.phpt | 17 + .../php-5.2.5/Zend/tests/errmsg_025.phpt | 20 + .../php-5.2.5/Zend/tests/errmsg_026.phpt | 12 + .../php-5.2.5/Zend/tests/errmsg_027.phpt | 16 + .../php-5.2.5/Zend/tests/errmsg_028.phpt | 12 + .../php-5.2.5/Zend/tests/errmsg_029.phpt | 12 + .../php-5.2.5/Zend/tests/errmsg_030.phpt | 12 + .../php-5.2.5/Zend/tests/errmsg_031.phpt | 12 + .../php-5.2.5/Zend/tests/errmsg_032.phpt | 15 + .../php-5.2.5/Zend/tests/errmsg_033.phpt | 15 + .../php-5.2.5/Zend/tests/errmsg_034.phpt | 15 + .../php-5.2.5/Zend/tests/errmsg_035.phpt | 12 + .../php-5.2.5/Zend/tests/errmsg_036.phpt | 12 + .../php-5.2.5/Zend/tests/errmsg_037.phpt | 13 + .../php-5.2.5/Zend/tests/errmsg_038.phpt | 13 + .../php-5.2.5/Zend/tests/errmsg_039.phpt | 14 + .../php-5.2.5/Zend/tests/errmsg_040.phpt | 13 + .../php-5.2.5/Zend/tests/errmsg_041.phpt | 11 + .../php-5.2.5/Zend/tests/errmsg_042.phpt | 13 + .../php-5.2.5/Zend/tests/errmsg_043.phpt | 12 + .../Zend/tests/error_reporting01.phpt | 26 + .../Zend/tests/error_reporting02.phpt | 27 + .../Zend/tests/error_reporting03.phpt | 35 + .../Zend/tests/error_reporting04.phpt | 23 + .../Zend/tests/error_reporting05.phpt | 34 + .../Zend/tests/error_reporting06.phpt | 30 + .../Zend/tests/error_reporting07.phpt | 30 + .../Zend/tests/error_reporting08.phpt | 32 + .../Zend/tests/error_reporting09.phpt | 31 + .../Zend/tests/error_reporting10.phpt | 35 + .../Zend/tests/exception_handler_001.phpt | 20 + .../Zend/tests/exception_handler_002.phpt | 23 + .../Zend/tests/exception_handler_003.phpt | 24 + .../Zend/tests/exception_handler_004.phpt | 21 + .../Zend/tests/exception_handler_005.phpt | 23 + .../Zend/tests/exception_handler_006.phpt | 25 + phpt/tests/php-5.2.5/Zend/tests/foreach.phpt | 25 + .../Zend/tests/foreach_undefined.phpt | 14 + .../Zend/tests/get_defined_vars.phpt | 128 + phpt/tests/php-5.2.5/Zend/tests/globals.inc | 15 + .../php-5.2.5/Zend/tests/globals_001.phpt | 34 + .../php-5.2.5/Zend/tests/globals_002.phpt | 37 + .../php-5.2.5/Zend/tests/globals_003.phpt | 43 + .../php-5.2.5/Zend/tests/globals_004.phpt | 28 + phpt/tests/php-5.2.5/Zend/tests/halt01.phpt | 12 + phpt/tests/php-5.2.5/Zend/tests/halt02.phpt | 13 + phpt/tests/php-5.2.5/Zend/tests/halt03.phpt | 10 + .../php-5.2.5/Zend/tests/halt_compiler1.phpt | 8 + .../php-5.2.5/Zend/tests/halt_compiler2.phpt | 23 + .../php-5.2.5/Zend/tests/halt_compiler3.phpt | 10 + .../php-5.2.5/Zend/tests/halt_compiler4.phpt | 10 + .../Zend/tests/hex_overflow_32bit.phpt | 29 + .../php-5.2.5/Zend/tests/increment_001.phpt | 60 + .../php-5.2.5/Zend/tests/instanceof.phpt | 18 + .../Zend/tests/int_overflow_32bit.phpt | 29 + .../Zend/tests/int_overflow_64bit.phpt | 29 + .../Zend/tests/int_underflow_32bit.phpt | 29 + .../Zend/tests/int_underflow_64bit.phpt | 29 + phpt/tests/php-5.2.5/Zend/tests/is_a.phpt | 50 + .../Zend/tests/magic_by_ref_001.phpt | 17 + .../Zend/tests/magic_by_ref_002.phpt | 16 + .../Zend/tests/magic_by_ref_003.phpt | 17 + .../Zend/tests/magic_by_ref_004.phpt | 18 + .../Zend/tests/magic_by_ref_005.phpt | 18 + .../Zend/tests/magic_by_ref_006.phpt | 18 + .../Zend/tests/magic_by_ref_007.phpt | 19 + .../Zend/tests/magic_by_ref_010.phpt | 30 + .../php-5.2.5/Zend/tests/method_exists.phpt | 11 + phpt/tests/php-5.2.5/Zend/tests/mod_001.phpt | 17 + phpt/tests/php-5.2.5/Zend/tests/mul_001.phpt | 15 + phpt/tests/php-5.2.5/Zend/tests/not_001.phpt | 22 + phpt/tests/php-5.2.5/Zend/tests/not_002.phpt | 15 + .../php-5.2.5/Zend/tests/object-null.phpt | 21 + .../php-5.2.5/Zend/tests/object_handlers.phpt | 171 + .../php-5.2.5/Zend/tests/objects_001.phpt | 60 + .../php-5.2.5/Zend/tests/objects_002.phpt | 24 + .../php-5.2.5/Zend/tests/objects_003.phpt | 24 + .../php-5.2.5/Zend/tests/objects_004.phpt | 24 + .../php-5.2.5/Zend/tests/objects_005.phpt | 24 + .../php-5.2.5/Zend/tests/objects_006.phpt | 24 + .../php-5.2.5/Zend/tests/objects_007.phpt | 24 + .../php-5.2.5/Zend/tests/objects_008.phpt | 24 + .../php-5.2.5/Zend/tests/objects_009.phpt | 24 + .../php-5.2.5/Zend/tests/objects_010.phpt | 19 + .../php-5.2.5/Zend/tests/objects_011.phpt | 19 + .../php-5.2.5/Zend/tests/objects_012.phpt | 15 + .../php-5.2.5/Zend/tests/objects_013.phpt | 15 + .../php-5.2.5/Zend/tests/objects_014.phpt | 15 + .../php-5.2.5/Zend/tests/objects_015.phpt | 26 + .../Zend/tests/oct_overflow_32bit.phpt | 31 + .../php-5.2.5/Zend/tests/offset_array.phpt | 47 + .../php-5.2.5/Zend/tests/offset_assign.phpt | 11 + .../php-5.2.5/Zend/tests/offset_bool.phpt | 37 + .../php-5.2.5/Zend/tests/offset_long.phpt | 37 + .../php-5.2.5/Zend/tests/offset_null.phpt | 37 + .../php-5.2.5/Zend/tests/offset_object.phpt | 11 + .../php-5.2.5/Zend/tests/offset_string.phpt | 45 + phpt/tests/php-5.2.5/Zend/tests/or_001.phpt | 29 + .../php-5.2.5/Zend/tests/selfParent_001.phpt | 27 + .../php-5.2.5/Zend/tests/selfParent_002.phpt | 27 + .../php-5.2.5/Zend/tests/settype_array.phpt | Bin 0 -> 1006 bytes .../php-5.2.5/Zend/tests/settype_bool.phpt | 53 + .../php-5.2.5/Zend/tests/settype_double.phpt | 57 + .../php-5.2.5/Zend/tests/settype_int.phpt | 55 + .../php-5.2.5/Zend/tests/settype_null.phpt | 53 + .../php-5.2.5/Zend/tests/settype_object.phpt | Bin 0 -> 1126 bytes .../Zend/tests/settype_resource.phpt | Bin 0 -> 1581 bytes .../php-5.2.5/Zend/tests/settype_string.phpt | Bin 0 -> 747 bytes .../tests/php-5.2.5/Zend/tests/shift_001.phpt | 25 + .../tests/php-5.2.5/Zend/tests/shift_002.phpt | 25 + .../php-5.2.5/Zend/tests/strict_001.phpt | 19 + .../php-5.2.5/Zend/tests/strict_002.phpt | 27 + phpt/tests/php-5.2.5/Zend/tests/sub_001.phpt | 15 + phpt/tests/php-5.2.5/Zend/tests/unset.inc | 3 + .../php-5.2.5/Zend/tests/unset_cv01.phpt | 13 + .../php-5.2.5/Zend/tests/unset_cv02.phpt | 13 + .../php-5.2.5/Zend/tests/unset_cv03.phpt | 13 + .../php-5.2.5/Zend/tests/unset_cv04.phpt | 16 + .../php-5.2.5/Zend/tests/unset_cv05.phpt | 28 + .../php-5.2.5/Zend/tests/unset_cv06.phpt | 26 + .../php-5.2.5/Zend/tests/unset_cv07.phpt | 18 + .../php-5.2.5/Zend/tests/unset_cv08.phpt | 15 + .../php-5.2.5/Zend/tests/unset_cv09.phpt | 14 + .../php-5.2.5/Zend/tests/unset_cv10.phpt | 18 + .../php-5.2.5/Zend/tests/unset_cv11.phpt | 21 + .../php-5.2.5/Zend/tests/unset_cv12.phpt | 11 + phpt/tests/php-5.2.5/Zend/tests/xor_001.phpt | 16 + phpt/tests/php-5.2.5/Zend/tests/xor_002.phpt | 39 + phpt/tests/php-5.2.5/Zend/tests/xor_003.phpt | 19 + phpt/tests/php-5.2.5/Zend/tests/zend2.php.txt | 275 + .../php-5.2.5/Zend/tests/zend_operators.phpt | 12 + .../php-5.2.5/Zend/tests/zend_strtod.phpt | 19 + .../php-5.2.5/ext/bcmath/tests/bcadd.phpt | 16 + .../php-5.2.5/ext/bcmath/tests/bccomp.phpt | 18 + .../php-5.2.5/ext/bcmath/tests/bcdiv.phpt | 18 + .../php-5.2.5/ext/bcmath/tests/bcmod.phpt | 16 + .../php-5.2.5/ext/bcmath/tests/bcmul.phpt | 18 + .../php-5.2.5/ext/bcmath/tests/bcpow.phpt | 16 + .../php-5.2.5/ext/bcmath/tests/bcscale.phpt | 21 + .../php-5.2.5/ext/bcmath/tests/bcsqrt.phpt | 14 + .../php-5.2.5/ext/bcmath/tests/bcsub.phpt | 16 + phpt/tests/php-5.2.5/ext/bz2/tests/001.phpt | 43 + phpt/tests/php-5.2.5/ext/bz2/tests/002.phpt | 129 + phpt/tests/php-5.2.5/ext/bz2/tests/003.phpt | 40 + .../tests/php-5.2.5/ext/bz2/tests/003.txt.bz2 | Bin 0 -> 126 bytes phpt/tests/php-5.2.5/ext/bz2/tests/004.phpt | 111 + .../php-5.2.5/ext/bz2/tests/004_1.txt.bz2 | Bin 0 -> 125 bytes .../php-5.2.5/ext/bz2/tests/004_2.txt.bz2 | Bin 0 -> 123 bytes phpt/tests/php-5.2.5/ext/bz2/tests/005.phpt | 71 + .../ext/bz2/tests/bz2_filter_compress.phpt | 17 + .../ext/bz2/tests/bz2_filter_decompress.phpt | 17 + .../php-5.2.5/ext/bz2/tests/with_files.phpt | 23 + .../php-5.2.5/ext/bz2/tests/with_strings.phpt | 27 + .../ext/calendar/tests/cal_days_in_month.phpt | 20 + .../ext/calendar/tests/cal_from_jd.phpt | 60 + .../ext/calendar/tests/cal_info.phpt | 216 + .../ext/calendar/tests/cal_to_jd.phpt | 16 + .../ext/calendar/tests/easter_date.phpt | 20 + .../ext/calendar/tests/easter_days.phpt | 14 + .../ext/calendar/tests/frenchtojd.phpt | 16 + .../ext/calendar/tests/gregoriantojd.phpt | 18 + .../ext/calendar/tests/jddayofweek.phpt | 130 + .../ext/calendar/tests/jdmonthname.phpt | 314 + .../ext/calendar/tests/jdtofrench.phpt | 20 + .../ext/calendar/tests/jdtogregorian.phpt | 18 + .../ext/calendar/tests/jdtojewish.phpt | 30 + .../ext/calendar/tests/jdtojulian.phpt | 18 + .../ext/calendar/tests/jdtomonthname.phpt | 71 + .../ext/calendar/tests/jdtounix.phpt | 16 + .../ext/calendar/tests/jewishtojd.phpt | 16 + .../ext/calendar/tests/juliantojd.phpt | 18 + .../php-5.2.5/ext/calendar/tests/skipif.inc | 4 + .../ext/calendar/tests/unixtojd.phpt | 14 + .../php-5.2.5/ext/com_dotnet/tests/27974.phpt | 43 + .../ext/com_dotnet/tests/bug33386.phpt | 40 + .../ext/com_dotnet/tests/bug34272.phpt | 22 + .../ext/com_dotnet/tests/bug39596.phpt | 23 + .../ext/com_dotnet/tests/bug39606.phpt | 22 + .../ext/com_dotnet/tests/variants.phpt | 637 + phpt/tests/php-5.2.5/ext/ctype/tests/001.phpt | 39 + phpt/tests/php-5.2.5/ext/ctype/tests/002.phpt | 48 + .../php-5.2.5/ext/ctype/tests/bug25745.phpt | 26 + .../php-5.2.5/ext/ctype/tests/bug34645.phpt | 13 + phpt/tests/php-5.2.5/ext/date/tests/002.phpt | 40 + phpt/tests/php-5.2.5/ext/date/tests/003.phpt | 47 + phpt/tests/php-5.2.5/ext/date/tests/004.phpt | 73 + phpt/tests/php-5.2.5/ext/date/tests/005.phpt | 45 + phpt/tests/php-5.2.5/ext/date/tests/006.phpt | 33 + phpt/tests/php-5.2.5/ext/date/tests/007.phpt | 11 + phpt/tests/php-5.2.5/ext/date/tests/008.phpt | 67 + phpt/tests/php-5.2.5/ext/date/tests/009.phpt | 21 + phpt/tests/php-5.2.5/ext/date/tests/010.phpt | 4 + phpt/tests/php-5.2.5/ext/date/tests/011.phpt | 23 + phpt/tests/php-5.2.5/ext/date/tests/012.phpt | 32 + phpt/tests/php-5.2.5/ext/date/tests/013.phpt | 38 + phpt/tests/php-5.2.5/ext/date/tests/014.phpt | 33 + .../php-5.2.5/ext/date/tests/bug13142.phpt | 11 + .../php-5.2.5/ext/date/tests/bug14561.phpt | 11 + .../php-5.2.5/ext/date/tests/bug17988.phpt | 33 + .../php-5.2.5/ext/date/tests/bug20382-1.phpt | 16 + .../php-5.2.5/ext/date/tests/bug20382-2.phpt | 170 + .../php-5.2.5/ext/date/tests/bug21399.phpt | 9 + .../php-5.2.5/ext/date/tests/bug21966.phpt | 19 + .../php-5.2.5/ext/date/tests/bug26090.phpt | 14 + .../php-5.2.5/ext/date/tests/bug26198.phpt | 11 + .../php-5.2.5/ext/date/tests/bug26317.phpt | 13 + .../php-5.2.5/ext/date/tests/bug26320.phpt | 11 + .../php-5.2.5/ext/date/tests/bug26694.phpt | 9 + .../php-5.2.5/ext/date/tests/bug27719.phpt | 67 + .../php-5.2.5/ext/date/tests/bug27780.phpt | 113 + .../php-5.2.5/ext/date/tests/bug28024.phpt | 11 + .../php-5.2.5/ext/date/tests/bug28088.phpt | 17 + .../php-5.2.5/ext/date/tests/bug28599.phpt | 9 + .../php-5.2.5/ext/date/tests/bug29150.phpt | 9 + .../php-5.2.5/ext/date/tests/bug29585.phpt | 9 + .../php-5.2.5/ext/date/tests/bug29595.phpt | 11 + .../php-5.2.5/ext/date/tests/bug30096.phpt | 48 + .../php-5.2.5/ext/date/tests/bug30532.phpt | 23 + .../php-5.2.5/ext/date/tests/bug32086.phpt | 49 + .../php-5.2.5/ext/date/tests/bug32270.phpt | 25 + .../php-5.2.5/ext/date/tests/bug32555.phpt | 17 + .../php-5.2.5/ext/date/tests/bug32588.phpt | 9 + .../php-5.2.5/ext/date/tests/bug33056.phpt | 13 + .../php-5.2.5/ext/date/tests/bug33414-1.phpt | 320 + .../php-5.2.5/ext/date/tests/bug33414-2.phpt | 121 + .../php-5.2.5/ext/date/tests/bug33415-1.phpt | 33 + .../php-5.2.5/ext/date/tests/bug33415-2.phpt | 342 + .../php-5.2.5/ext/date/tests/bug33452.phpt | 11 + .../php-5.2.5/ext/date/tests/bug33532.phpt | 38 + .../php-5.2.5/ext/date/tests/bug33536.phpt | 13 + .../php-5.2.5/ext/date/tests/bug33562.phpt | 11 + .../php-5.2.5/ext/date/tests/bug33563.phpt | 12 + .../php-5.2.5/ext/date/tests/bug33578.phpt | 21 + .../php-5.2.5/ext/date/tests/bug33869.phpt | 26 + .../php-5.2.5/ext/date/tests/bug33957.phpt | 103 + .../php-5.2.5/ext/date/tests/bug34087.phpt | 20 + .../php-5.2.5/ext/date/tests/bug34304.phpt | 11 + .../php-5.2.5/ext/date/tests/bug34676.phpt | 19 + .../php-5.2.5/ext/date/tests/bug34771.phpt | 32 + .../php-5.2.5/ext/date/tests/bug35143.phpt | 21 + .../php-5.2.5/ext/date/tests/bug35218.phpt | 14 + .../php-5.2.5/ext/date/tests/bug35414.phpt | 16 + .../php-5.2.5/ext/date/tests/bug35422.phpt | 12 + .../php-5.2.5/ext/date/tests/bug35425.phpt | 30 + .../php-5.2.5/ext/date/tests/bug35456.phpt | 16 + .../php-5.2.5/ext/date/tests/bug35499.phpt | 78 + .../php-5.2.5/ext/date/tests/bug35624.phpt | 29 + .../php-5.2.5/ext/date/tests/bug35630.phpt | 11 + .../php-5.2.5/ext/date/tests/bug35699.phpt | 14 + .../php-5.2.5/ext/date/tests/bug35705.phpt | 11 + .../php-5.2.5/ext/date/tests/bug35885.phpt | 21 + .../php-5.2.5/ext/date/tests/bug35887.phpt | 11 + .../php-5.2.5/ext/date/tests/bug36224.phpt | 13 + .../php-5.2.5/ext/date/tests/bug36510.phpt | 14 + .../php-5.2.5/ext/date/tests/bug36599.phpt | 12 + .../php-5.2.5/ext/date/tests/bug36988.phpt | 12 + .../php-5.2.5/ext/date/tests/bug37017.phpt | 16 + .../php-5.2.5/ext/date/tests/bug37368.phpt | 10 + .../php-5.2.5/ext/date/tests/bug37514.phpt | 20 + .../php-5.2.5/ext/date/tests/bug37616.phpt | 9 + .../php-5.2.5/ext/date/tests/bug37747.phpt | 11 + .../php-5.2.5/ext/date/tests/bug38229.phpt | 13 + .../php-5.2.5/ext/date/tests/bug39782.phpt | 19 + .../php-5.2.5/ext/date/tests/bug40861.phpt | 33 + .../php-5.2.5/ext/date/tests/bug41523.phpt | 45 + .../php-5.2.5/ext/date/tests/bug41709.phpt | 33 + .../php-5.2.5/ext/date/tests/bug41842.phpt | 11 + .../php-5.2.5/ext/date/tests/bug41844.phpt | 17 + .../php-5.2.5/ext/date/tests/bug41964.phpt | 59 + phpt/tests/php-5.2.5/ext/date/tests/date.phpt | 22 + .../ext/date/tests/date_constants.phpt | 75 + .../ext/date/tests/date_create-1.phpt | 48 + .../ext/date/tests/date_create-2.phpt | 12 + .../tests/date_default_timezone_get-1.phpt | 16 + .../tests/date_default_timezone_get-2.phpt | 12 + .../tests/date_default_timezone_get-3.phpt | 15 + .../tests/date_default_timezone_set-1.phpt | 28 + .../ext/date/tests/date_modify-1.phpt | 30 + .../ext/date/tests/date_modify-2.phpt | 15 + .../ext/date/tests/date_parse_001.phpt | 303 + .../ext/date/tests/date_sun_info_001.phpt | 32 + .../ext/date/tests/date_sun_info_002.phpt | 24 + .../ext/date/tests/default-timezone-1.phpt | 11 + .../ext/date/tests/default-timezone-2.phpt | 11 + .../date/tests/format-negative-timestamp.phpt | 24 + .../php-5.2.5/ext/date/tests/mktime-1.phpt | 44 + .../php-5.2.5/ext/date/tests/mktime-2.phpt | 51 + .../php-5.2.5/ext/date/tests/mktime-3.phpt | 54 + .../php-5.2.5/ext/date/tests/oo_001.phpt | 53 + .../php-5.2.5/ext/date/tests/oo_002.phpt | 28 + .../ext/date/tests/strtotime-mysql.phpt | 25 + .../php-5.2.5/ext/date/tests/strtotime.phpt | 16 + .../php-5.2.5/ext/date/tests/strtotime2.phpt | 40 + .../php-5.2.5/ext/date/tests/strtotime3.phpt | 69 + .../date/tests/timezone-configuration.phpt | 19 + .../php-5.2.5/ext/date/tests/timezones.phpt | 26 + .../php-5.2.5/ext/dba/tests/bug36436.phpt | 34 + .../tests/php-5.2.5/ext/dba/tests/dba001.phpt | 21 + .../tests/php-5.2.5/ext/dba/tests/dba002.phpt | 22 + .../tests/php-5.2.5/ext/dba/tests/dba003.phpt | 24 + .../tests/php-5.2.5/ext/dba/tests/dba004.phpt | 28 + .../tests/php-5.2.5/ext/dba/tests/dba005.phpt | 35 + .../tests/php-5.2.5/ext/dba/tests/dba006.phpt | 37 + .../tests/php-5.2.5/ext/dba/tests/dba007.phpt | 45 + .../tests/php-5.2.5/ext/dba/tests/dba008.phpt | 32 + .../tests/php-5.2.5/ext/dba/tests/dba009.phpt | 33 + .../php-5.2.5/ext/dba/tests/dba_cdb.phpt | 47 + .../php-5.2.5/ext/dba/tests/dba_cdb_make.phpt | 38 + .../php-5.2.5/ext/dba/tests/dba_cdb_read.phpt | 65 + .../php-5.2.5/ext/dba/tests/dba_db1.phpt | 46 + .../php-5.2.5/ext/dba/tests/dba_db2.phpt | 46 + .../php-5.2.5/ext/dba/tests/dba_db3.phpt | 46 + .../php-5.2.5/ext/dba/tests/dba_db4.phpt | 32 + .../php-5.2.5/ext/dba/tests/dba_dbm.phpt | 46 + .../php-5.2.5/ext/dba/tests/dba_flatfile.phpt | 46 + .../php-5.2.5/ext/dba/tests/dba_gdbm.phpt | 34 + .../php-5.2.5/ext/dba/tests/dba_handler.inc | 90 + .../php-5.2.5/ext/dba/tests/dba_inifile.phpt | 46 + .../php-5.2.5/ext/dba/tests/dba_ndbm.phpt | 46 + .../php-5.2.5/ext/dba/tests/dba_qdbm.phpt | 34 + phpt/tests/php-5.2.5/ext/dba/tests/skipif.inc | 23 + phpt/tests/php-5.2.5/ext/dba/tests/test.cdb | Bin 0 -> 2230 bytes phpt/tests/php-5.2.5/ext/dba/tests/test.inc | 7 + phpt/tests/php-5.2.5/ext/dbase/tests/001.phpt | 63 + phpt/tests/php-5.2.5/ext/dbase/tests/002.phpt | 54 + .../php-5.2.5/ext/dbase/tests/bug31754.phpt | 26 + phpt/tests/php-5.2.5/ext/dom/tests/book.xml | 11 + .../tests/php-5.2.5/ext/dom/tests/book.xml.gz | Bin 0 -> 119 bytes .../php-5.2.5/ext/dom/tests/bug28721.phpt | 485 + .../php-5.2.5/ext/dom/tests/bug28817.phpt | 38 + .../php-5.2.5/ext/dom/tests/bug32615.phpt | 84 + .../php-5.2.5/ext/dom/tests/bug34276.phpt | 43 + .../php-5.2.5/ext/dom/tests/bug35342.phpt | 20 + .../php-5.2.5/ext/dom/tests/bug36756.phpt | 35 + .../php-5.2.5/ext/dom/tests/bug37277.phpt | 25 + .../php-5.2.5/ext/dom/tests/bug37456.phpt | 22 + .../php-5.2.5/ext/dom/tests/bug38438.phpt | 13 + .../php-5.2.5/ext/dom/tests/bug38474.phpt | 41 + .../php-5.2.5/ext/dom/tests/bug38850.phpt | 22 + .../php-5.2.5/ext/dom/tests/bug38949.phpt | 27 + .../php-5.2.5/ext/dom/tests/bug40836.phpt | 29 + .../php-5.2.5/ext/dom/tests/bug41257.phpt | 31 + .../php-5.2.5/ext/dom/tests/bug41374.phpt | 32 + .../php-5.2.5/ext/dom/tests/bug42082.phpt | 27 + .../ext/dom/tests/canonicalization.phpt | 102 + phpt/tests/php-5.2.5/ext/dom/tests/dom.ent | 8 + phpt/tests/php-5.2.5/ext/dom/tests/dom.xml | 8 + .../tests/php-5.2.5/ext/dom/tests/dom001.phpt | 275 + .../tests/php-5.2.5/ext/dom/tests/dom002.phpt | 57 + .../tests/php-5.2.5/ext/dom/tests/dom003.phpt | 64 + .../tests/php-5.2.5/ext/dom/tests/dom004.phpt | 25 + .../tests/php-5.2.5/ext/dom/tests/dom005.phpt | 36 + .../tests/php-5.2.5/ext/dom/tests/dom006.phpt | 40 + .../tests/php-5.2.5/ext/dom/tests/dom007.phpt | 99 + .../ext/dom/tests/dom_create_element.phpt | 394 + .../ext/dom/tests/dom_import_simplexml.phpt | 27 + .../ext/dom/tests/dom_set_attr_node.phpt | 67 + .../php-5.2.5/ext/dom/tests/dom_test.inc | 47 + .../php-5.2.5/ext/dom/tests/dom_xinclude.phpt | 38 + .../ext/dom/tests/domattributes.phpt | 43 + .../php-5.2.5/ext/dom/tests/domchardata.phpt | 76 + .../php-5.2.5/ext/dom/tests/domelement.phpt | 114 + phpt/tests/php-5.2.5/ext/dom/tests/nsdoc.xml | 4 + .../ext/dom/tests/regsiter_node_class.phpt | 43 + phpt/tests/php-5.2.5/ext/dom/tests/skipif.inc | 1 + phpt/tests/php-5.2.5/ext/dom/tests/test.html | 9 + .../php-5.2.5/ext/dom/tests/xinclude.xml | 4 + .../php-5.2.5/ext/exif/tests/bug34704.jpg | Bin 0 -> 9976 bytes .../php-5.2.5/ext/exif/tests/bug34704.phpt | 43 + .../php-5.2.5/ext/exif/tests/exif000.phpt | 57 + .../php-5.2.5/ext/exif/tests/exif001.phpt | 84 + .../php-5.2.5/ext/exif/tests/exif002.phpt | 24 + .../php-5.2.5/ext/exif/tests/exif003.phpt | 91 + .../php-5.2.5/ext/exif/tests/exif004.phpt | 38 + .../php-5.2.5/ext/exif/tests/exif005.phpt | 22 + .../php-5.2.5/ext/exif/tests/exif006.phpt | 89 + phpt/tests/php-5.2.5/ext/exif/tests/test1.jpg | Bin 0 -> 523 bytes phpt/tests/php-5.2.5/ext/exif/tests/test2.jpg | Bin 0 -> 1240 bytes phpt/tests/php-5.2.5/ext/exif/tests/test3.jpg | Bin 0 -> 1240 bytes phpt/tests/php-5.2.5/ext/exif/tests/test4.jpg | Bin 0 -> 713 bytes phpt/tests/php-5.2.5/ext/exif/tests/test5.jpg | Bin 0 -> 603 bytes phpt/tests/php-5.2.5/ext/exif/tests/test6.jpg | Bin 0 -> 1240 bytes .../php-5.2.5/ext/fdf/tests/01-general.phpt | 10 + .../php-5.2.5/ext/fdf/tests/02-values.phpt | 19 + .../php-5.2.5/ext/fdf/tests/03-read-file.phpt | 15 + .../php-5.2.5/ext/fdf/tests/04-POST.phpt | 40 + phpt/tests/php-5.2.5/ext/fdf/tests/simple.fdf | 18 + .../tests/php-5.2.5/ext/filter/tests/001.phpt | 8 + .../tests/php-5.2.5/ext/filter/tests/002.phpt | 11 + .../tests/php-5.2.5/ext/filter/tests/003.phpt | 22 + .../tests/php-5.2.5/ext/filter/tests/004.phpt | 26 + .../tests/php-5.2.5/ext/filter/tests/005.phpt | 21 + .../tests/php-5.2.5/ext/filter/tests/006.phpt | 12 + .../tests/php-5.2.5/ext/filter/tests/007.phpt | 64 + .../tests/php-5.2.5/ext/filter/tests/008.phpt | 55 + .../tests/php-5.2.5/ext/filter/tests/009.phpt | 32 + .../tests/php-5.2.5/ext/filter/tests/010.phpt | 64 + .../tests/php-5.2.5/ext/filter/tests/011.phpt | 54 + .../tests/php-5.2.5/ext/filter/tests/012.phpt | 18 + .../tests/php-5.2.5/ext/filter/tests/013.phpt | 74 + .../tests/php-5.2.5/ext/filter/tests/014.phpt | 70 + .../tests/php-5.2.5/ext/filter/tests/015.phpt | 81 + .../tests/php-5.2.5/ext/filter/tests/016.phpt | 34 + .../tests/php-5.2.5/ext/filter/tests/017.phpt | 26 + .../tests/php-5.2.5/ext/filter/tests/018.phpt | 52 + .../tests/php-5.2.5/ext/filter/tests/019.phpt | 22 + .../tests/php-5.2.5/ext/filter/tests/020.phpt | 20 + .../tests/php-5.2.5/ext/filter/tests/021.phpt | 46 + .../tests/php-5.2.5/ext/filter/tests/022.phpt | 22 + .../tests/php-5.2.5/ext/filter/tests/023.phpt | 22 + .../tests/php-5.2.5/ext/filter/tests/024.phpt | 20 + .../tests/php-5.2.5/ext/filter/tests/025.phpt | 26 + .../tests/php-5.2.5/ext/filter/tests/026.phpt | 32 + .../tests/php-5.2.5/ext/filter/tests/027.phpt | 32 + .../tests/php-5.2.5/ext/filter/tests/028.phpt | 37 + .../tests/php-5.2.5/ext/filter/tests/029.phpt | 105 + .../tests/php-5.2.5/ext/filter/tests/030.phpt | 43 + .../tests/php-5.2.5/ext/filter/tests/031.phpt | 58 + .../tests/php-5.2.5/ext/filter/tests/032.phpt | 57 + .../tests/php-5.2.5/ext/filter/tests/033.phpt | 29 + .../php-5.2.5/ext/filter/tests/033_run.inc | 40 + .../tests/php-5.2.5/ext/filter/tests/034.phpt | 33 + .../tests/php-5.2.5/ext/filter/tests/035.phpt | 38 + .../tests/php-5.2.5/ext/filter/tests/036.phpt | 39 + .../tests/php-5.2.5/ext/filter/tests/037.phpt | 41 + .../tests/php-5.2.5/ext/filter/tests/038.phpt | 58 + .../tests/php-5.2.5/ext/filter/tests/039.phpt | 117 + .../tests/php-5.2.5/ext/filter/tests/040.phpt | 45 + .../tests/php-5.2.5/ext/filter/tests/041.phpt | 34 + .../tests/php-5.2.5/ext/filter/tests/042.phpt | 19 + .../tests/php-5.2.5/ext/filter/tests/043.phpt | 269 + .../tests/php-5.2.5/ext/filter/tests/044.phpt | 25 + .../tests/php-5.2.5/ext/filter/tests/045.phpt | 30 + .../tests/php-5.2.5/ext/filter/tests/046.phpt | 23 + .../tests/php-5.2.5/ext/filter/tests/047.phpt | 37 + .../tests/php-5.2.5/ext/filter/tests/048.phpt | 41 + .../tests/php-5.2.5/ext/filter/tests/049.phpt | 34 + .../tests/php-5.2.5/ext/filter/tests/050.phpt | 29 + .../tests/php-5.2.5/ext/filter/tests/051.phpt | 11 + .../php-5.2.5/ext/filter/tests/PMOPB45.phpt | 11 + .../php-5.2.5/ext/filter/tests/bug39763.phpt | 16 + .../php-5.2.5/ext/filter/tests/bug39846.phpt | 12 + .../php-5.2.5/ext/filter/tests/bug7586.phpt | 55 + .../php-5.2.5/ext/filter/tests/bug7715.phpt | 33 + .../php-5.2.5/ext/filter/tests/bug7733.phpt | 29 + .../php-5.2.5/ext/filter/tests/bug8315.phpt | 15 + .../tests/callback_non_modified_var.phpt | 14 + .../ext/filter/tests/filter_data.phpt | 75 + phpt/tests/php-5.2.5/ext/ftp/tests/001.phpt | 36 + phpt/tests/php-5.2.5/ext/ftp/tests/002.phpt | 38 + phpt/tests/php-5.2.5/ext/ftp/tests/003.phpt | 43 + phpt/tests/php-5.2.5/ext/ftp/tests/004.phpt | 79 + phpt/tests/php-5.2.5/ext/ftp/tests/005.phpt | 86 + phpt/tests/php-5.2.5/ext/ftp/tests/006.phpt | 100 + .../php-5.2.5/ext/ftp/tests/bug27809.phpt | 21 + .../php-5.2.5/ext/ftp/tests/bug37799.phpt | 22 + .../php-5.2.5/ext/ftp/tests/bug39458-2.phpt | 36 + .../php-5.2.5/ext/ftp/tests/bug39458.phpt | 35 + .../php-5.2.5/ext/ftp/tests/bug39583-2.phpt | 34 + .../php-5.2.5/ext/ftp/tests/bug39583.phpt | 35 + .../php-5.2.5/ext/ftp/tests/bug7216-2.phpt | 21 + .../php-5.2.5/ext/ftp/tests/bug7216.phpt | 21 + phpt/tests/php-5.2.5/ext/ftp/tests/cert.pem | 48 + phpt/tests/php-5.2.5/ext/ftp/tests/server.inc | 258 + phpt/tests/php-5.2.5/ext/ftp/tests/skipif.inc | 5 + phpt/tests/php-5.2.5/ext/gd/tests/001.phpt | 25 + .../php-5.2.5/ext/gd/tests/bug19366.phpt | 52 + .../php-5.2.5/ext/gd/tests/bug22544.phpt | 23 + .../php-5.2.5/ext/gd/tests/bug24155.phpt | 30 + .../php-5.2.5/ext/gd/tests/bug24594.phpt | 82 + .../php-5.2.5/ext/gd/tests/bug27582_1.phpt | 27 + .../php-5.2.5/ext/gd/tests/bug28147.phpt | 27 + .../php-5.2.5/ext/gd/tests/bug36697.phpt | 28 + .../tests/php-5.2.5/ext/gd/tests/bug37346.gif | 4 + .../php-5.2.5/ext/gd/tests/bug37346.phpt | 12 + .../tests/php-5.2.5/ext/gd/tests/bug37360.gif | Bin 0 -> 65646 bytes .../php-5.2.5/ext/gd/tests/bug37360.phpt | 14 + .../tests/php-5.2.5/ext/gd/tests/bug38112.gif | Bin 0 -> 18276 bytes .../php-5.2.5/ext/gd/tests/bug38112.phpt | 14 + .../php-5.2.5/ext/gd/tests/bug38179.phpt | 28 + .../php-5.2.5/ext/gd/tests/bug38212.phpt | 18 + .../php-5.2.5/ext/gd/tests/bug39082.phpt | 15 + .../php-5.2.5/ext/gd/tests/bug39273.phpt | 31 + .../php-5.2.5/ext/gd/tests/bug39286.phpt | 13 + .../php-5.2.5/ext/gd/tests/bug39366.phpt | 21 + .../php-5.2.5/ext/gd/tests/bug39508.phpt | 15 + .../php-5.2.5/ext/gd/tests/bug39780.phpt | 21 + .../tests/php-5.2.5/ext/gd/tests/bug39780.png | Bin 0 -> 393216 bytes .../ext/gd/tests/bug39780_extern.phpt | 18 + .../php-5.2.5/ext/gd/tests/bug40764.phpt | 31 + .../php-5.2.5/ext/gd/tests/bug41442.phpt | 37 + .../tests/php-5.2.5/ext/gd/tests/bug43121.gif | Bin 0 -> 347 bytes .../php-5.2.5/ext/gd/tests/bug43121.phpt | 21 + .../tests/php-5.2.5/ext/gd/tests/colorat.phpt | 42 + .../php-5.2.5/ext/gd/tests/colorclosest.phpt | 127 + .../php-5.2.5/ext/gd/tests/colorexact.phpt | 40 + .../php-5.2.5/ext/gd/tests/colormatch.phpt | 21 + .../php-5.2.5/ext/gd/tests/colorresolve.phpt | 113 + .../php-5.2.5/ext/gd/tests/conv_test.gif | Bin 0 -> 4998 bytes .../php-5.2.5/ext/gd/tests/conv_test.jpeg | Bin 0 -> 2317 bytes .../php-5.2.5/ext/gd/tests/conv_test.png | Bin 0 -> 4053 bytes .../php-5.2.5/ext/gd/tests/conv_test.xbm | 4 + .../php-5.2.5/ext/gd/tests/conv_test.xpm | 1588 + phpt/tests/php-5.2.5/ext/gd/tests/copy.phpt | 109 + .../php-5.2.5/ext/gd/tests/copypalette.phpt | 44 + .../php-5.2.5/ext/gd/tests/copyresized.phpt | 91 + .../php-5.2.5/ext/gd/tests/createfromgd2.phpt | 23 + .../ext/gd/tests/createfromstring.phpt | 64 + .../ext/gd/tests/createfromwbmp.phpt | 17 + .../ext/gd/tests/createfromwbmp2.phpt | 48 + .../ext/gd/tests/createfromwbmp2_extern.phpt | 47 + .../php-5.2.5/ext/gd/tests/dashedlines.phpt | 78 + phpt/tests/php-5.2.5/ext/gd/tests/gif.phpt | 146 + phpt/tests/php-5.2.5/ext/gd/tests/gif2gd.phpt | 30 + .../tests/php-5.2.5/ext/gd/tests/gif2jpg.phpt | 27 + .../tests/php-5.2.5/ext/gd/tests/gif2png.phpt | 27 + .../php-5.2.5/ext/gd/tests/imagefill_1.phpt | 25 + .../php-5.2.5/ext/gd/tests/imagefilter.phpt | 87 + .../php-5.2.5/ext/gd/tests/imagefttext.phpt | 52 + .../php-5.2.5/ext/gd/tests/imagewbmp.phpt | 30 + .../php-5.2.5/ext/gd/tests/jpeg2png.phpt | 45 + phpt/tests/php-5.2.5/ext/gd/tests/jpg2gd.phpt | 42 + .../php-5.2.5/ext/gd/tests/libgd00086.phpt | 21 + .../php-5.2.5/ext/gd/tests/libgd00086.png | Bin 0 -> 93 bytes .../ext/gd/tests/libgd00086_extern.phpt | 19 + .../php-5.2.5/ext/gd/tests/libgd00094.phpt | 19 + .../php-5.2.5/ext/gd/tests/libgd00094.xbm | 3 + .../php-5.2.5/ext/gd/tests/libgd00101.gd | 1 + .../php-5.2.5/ext/gd/tests/libgd00101.phpt | 18 + .../php-5.2.5/ext/gd/tests/libgd00106.phpt | 22 + phpt/tests/php-5.2.5/ext/gd/tests/lines.phpt | 114 + phpt/tests/php-5.2.5/ext/gd/tests/png2gd.phpt | 42 + .../tests/php-5.2.5/ext/gd/tests/pngcomp.phpt | 32 + phpt/tests/php-5.2.5/ext/gd/tests/src.gd2 | Bin 0 -> 423 bytes phpt/tests/php-5.2.5/ext/gd/tests/src.png | Bin 0 -> 9 bytes phpt/tests/php-5.2.5/ext/gd/tests/src.wbmp | Bin 0 -> 9 bytes phpt/tests/php-5.2.5/ext/gd/tests/test.png | Bin 0 -> 2711 bytes .../tests/php-5.2.5/ext/gd/tests/test8859.ttf | Bin 0 -> 10576 bytes .../php-5.2.5/ext/gd/tests/truecolor.phpt | 19 + phpt/tests/php-5.2.5/ext/gd/tests/types.phpt | 33 + .../tests/php-5.2.5/ext/gd/tests/xbm2png.phpt | 26 + phpt/tests/php-5.2.5/ext/gd/tests/xpm2gd.phpt | 30 + .../tests/php-5.2.5/ext/gd/tests/xpm2jpg.phpt | 27 + .../tests/php-5.2.5/ext/gd/tests/xpm2png.phpt | 27 + .../ext/gettext/tests/dcngettext.phpt | 30 + .../ext/gettext/tests/gettext_basic.phpt | 25 + .../tests/locale/fi/LC_MESSAGES/messages.mo | Bin 0 -> 199 bytes .../tests/locale/fi/LC_MESSAGES/messages.po | 15 + phpt/tests/php-5.2.5/ext/gmp/tests/001.phpt | 21 + phpt/tests/php-5.2.5/ext/gmp/tests/002.phpt | 17 + phpt/tests/php-5.2.5/ext/gmp/tests/003.phpt | 47 + phpt/tests/php-5.2.5/ext/gmp/tests/004.phpt | 45 + phpt/tests/php-5.2.5/ext/gmp/tests/005.phpt | 68 + phpt/tests/php-5.2.5/ext/gmp/tests/006.phpt | 50 + phpt/tests/php-5.2.5/ext/gmp/tests/007.phpt | 133 + phpt/tests/php-5.2.5/ext/gmp/tests/008.phpt | 73 + phpt/tests/php-5.2.5/ext/gmp/tests/009.phpt | 73 + phpt/tests/php-5.2.5/ext/gmp/tests/010.phpt | 40 + phpt/tests/php-5.2.5/ext/gmp/tests/011.phpt | 56 + phpt/tests/php-5.2.5/ext/gmp/tests/012.phpt | 44 + phpt/tests/php-5.2.5/ext/gmp/tests/013.phpt | 45 + phpt/tests/php-5.2.5/ext/gmp/tests/014.phpt | 58 + phpt/tests/php-5.2.5/ext/gmp/tests/015.phpt | 66 + phpt/tests/php-5.2.5/ext/gmp/tests/016.phpt | 73 + phpt/tests/php-5.2.5/ext/gmp/tests/017.phpt | 50 + phpt/tests/php-5.2.5/ext/gmp/tests/018.phpt | 100 + phpt/tests/php-5.2.5/ext/gmp/tests/019.phpt | 47 + phpt/tests/php-5.2.5/ext/gmp/tests/020.phpt | 81 + phpt/tests/php-5.2.5/ext/gmp/tests/021.phpt | 51 + phpt/tests/php-5.2.5/ext/gmp/tests/022.phpt | 85 + phpt/tests/php-5.2.5/ext/gmp/tests/023.phpt | 55 + phpt/tests/php-5.2.5/ext/gmp/tests/024.phpt | 67 + phpt/tests/php-5.2.5/ext/gmp/tests/025.phpt | 67 + phpt/tests/php-5.2.5/ext/gmp/tests/026.phpt | 48 + phpt/tests/php-5.2.5/ext/gmp/tests/027.phpt | 39 + phpt/tests/php-5.2.5/ext/gmp/tests/028.phpt | 35 + phpt/tests/php-5.2.5/ext/gmp/tests/029.phpt | 52 + phpt/tests/php-5.2.5/ext/gmp/tests/030.phpt | 52 + phpt/tests/php-5.2.5/ext/gmp/tests/031.phpt | 44 + phpt/tests/php-5.2.5/ext/gmp/tests/032.phpt | 52 + phpt/tests/php-5.2.5/ext/gmp/tests/033.phpt | 64 + phpt/tests/php-5.2.5/ext/gmp/tests/034.phpt | 56 + phpt/tests/php-5.2.5/ext/gmp/tests/035.phpt | 33 + phpt/tests/php-5.2.5/ext/gmp/tests/036.phpt | 50 + phpt/tests/php-5.2.5/ext/gmp/tests/037.phpt | 40 + phpt/tests/php-5.2.5/ext/gmp/tests/038.phpt | 40 + phpt/tests/php-5.2.5/ext/gmp/tests/039.phpt | 40 + .../php-5.2.5/ext/gmp/tests/bug32773.phpt | 22 + .../ext/gmp/tests/gmp_nextprime.phpt | 40 + .../php-5.2.5/ext/hash/tests/adler32.phpt | 20 + .../tests/php-5.2.5/ext/hash/tests/crc32.phpt | 34 + phpt/tests/php-5.2.5/ext/hash/tests/gost.phpt | 18 + .../tests/php-5.2.5/ext/hash/tests/haval.phpt | 25 + .../php-5.2.5/ext/hash/tests/hmac-md5.phpt | 14 + phpt/tests/php-5.2.5/ext/hash/tests/md2.phpt | 11 + phpt/tests/php-5.2.5/ext/hash/tests/md4.phpt | 12 + phpt/tests/php-5.2.5/ext/hash/tests/md5.phpt | 8 + .../php-5.2.5/ext/hash/tests/ripemd128.phpt | 13 + .../php-5.2.5/ext/hash/tests/ripemd160.phpt | 13 + .../php-5.2.5/ext/hash/tests/ripemd256.phpt | 13 + .../php-5.2.5/ext/hash/tests/ripemd320.phpt | 13 + phpt/tests/php-5.2.5/ext/hash/tests/sha1.phpt | 12 + .../php-5.2.5/ext/hash/tests/sha256.phpt | 12 + .../php-5.2.5/ext/hash/tests/sha384.phpt | 12 + .../php-5.2.5/ext/hash/tests/sha512.phpt | 12 + .../php-5.2.5/ext/hash/tests/snefru.phpt | 16 + .../tests/php-5.2.5/ext/hash/tests/tiger.phpt | 16 + .../php-5.2.5/ext/hash/tests/whirlpool.phpt | 12 + .../php-5.2.5/ext/iconv/tests/Quotes.UTF-8 | 4 + .../php-5.2.5/ext/iconv/tests/bug16069.phpt | 22 + .../php-5.2.5/ext/iconv/tests/bug37176.phpt | 20 + .../php-5.2.5/ext/iconv/tests/bug37773.phpt | 18 + .../ext/iconv/tests/eucjp2iso2022jp.phpt | 27 + .../php-5.2.5/ext/iconv/tests/eucjp2sjis.phpt | 58 + .../php-5.2.5/ext/iconv/tests/eucjp2utf8.phpt | 58 + .../iconv-charset-length-cve-2007-4840.phpt | 17 + .../php-5.2.5/ext/iconv/tests/iconv001.phpt | 18 + .../php-5.2.5/ext/iconv/tests/iconv002.phpt | 30 + .../php-5.2.5/ext/iconv/tests/iconv003.phpt | 15 + .../php-5.2.5/ext/iconv/tests/iconv004.phpt | 16 + ...e_decode-charset-length-cve-2007-4840.phpt | 13 + .../ext/iconv/tests/iconv_mime_decode.phpt | 90 + ..._headers-charset-length-cve-2007-4840.phpt | 13 + .../tests/iconv_mime_decode_headers.phpt | 89 + .../ext/iconv/tests/iconv_mime_encode.phpt | 426 + ...encoding-charset-length-cve-2007-4840.phpt | 21 + .../ext/iconv/tests/iconv_stream_filter.phpt | 41 + .../ext/iconv/tests/iconv_stream_filter.txt | 1 + ...v_strlen-charset-length-cve-2007-4840.phpt | 13 + .../ext/iconv/tests/iconv_strlen.phpt | 19 + ...v_strpos-charset-length-cve-2007-4840.phpt | 13 + .../ext/iconv/tests/iconv_strpos.phpt | 58 + ..._strrpos-charset-length-cve-2007-4840.phpt | 13 + .../ext/iconv/tests/iconv_strrpos.phpt | 62 + ...v_substr-charset-length-cve-2007-4783.phpt | 14 + .../ext/iconv/tests/iconv_substr.phpt | 59 + ..._handler-charset-length-cve-2007-4840.phpt | 12 + .../ext/iconv/tests/ob_iconv_handler.phpt | 17 + .../php-5.2.5/ext/iconv/tests/skipif.inc | 5 + phpt/tests/php-5.2.5/ext/iconv/tests/test.inc | 7 + .../ext/iconv/tests/translit-failure.phpt | 31 + .../ext/iconv/tests/translit-utf8.phpt | 28 + .../php-5.2.5/ext/imap/tests/bug31142_1.phpt | 59 + .../php-5.2.5/ext/imap/tests/bug31142_2.phpt | 30 + .../php-5.2.5/ext/imap/tests/bug32589.phpt | 34 + .../php-5.2.5/ext/imap/tests/bug35669.phpt | 68 + .../php-5.2.5/ext/imap/tests/bug40854.phpt | 57 + .../php-5.2.5/ext/imap/tests/imap_utf8.phpt | 22 + .../php-5.2.5/ext/interbase/tests/002.phpt | 33 + .../php-5.2.5/ext/interbase/tests/003.phpt | 183 + .../php-5.2.5/ext/interbase/tests/004.phpt | 182 + .../php-5.2.5/ext/interbase/tests/005.phpt | 290 + .../php-5.2.5/ext/interbase/tests/006.phpt | 301 + .../php-5.2.5/ext/interbase/tests/007.phpt | 183 + .../php-5.2.5/ext/interbase/tests/008.phpt | 48 + .../ext/interbase/tests/interbase.inc | 117 + .../php-5.2.5/ext/interbase/tests/skipif.inc | 5 + phpt/tests/php-5.2.5/ext/json/tests/001.phpt | 21 + phpt/tests/php-5.2.5/ext/json/tests/002.phpt | 13 + phpt/tests/php-5.2.5/ext/json/tests/003.phpt | 12 + phpt/tests/php-5.2.5/ext/json/tests/004.phpt | 9 + phpt/tests/php-5.2.5/ext/json/tests/005.phpt | 9 + .../php-5.2.5/ext/json/tests/bug40503.phpt | 9 + .../php-5.2.5/ext/json/tests/bug41034.phpt | 2 + .../php-5.2.5/ext/json/tests/bug41067.phpt | 11 + .../php-5.2.5/ext/json/tests/bug41403.phpt | 9 + .../php-5.2.5/ext/json/tests/bug41504.phpt | 7 + .../php-5.2.5/ext/json/tests/bug41567.phpt | 7 + .../php-5.2.5/ext/json/tests/bug42090.phpt | 10 + .../php-5.2.5/ext/json/tests/bug42785.phpt | 11 + .../php-5.2.5/ext/json/tests/fail001.phpt | 36 + .../php-5.2.5/ext/json/tests/pass001.1.phpt | 94 + .../ext/json/tests/pass001.1_64bit.phpt | 94 + .../php-5.2.5/ext/json/tests/pass001.phpt | 82 + .../php-5.2.5/ext/json/tests/pass002.phpt | 24 + .../php-5.2.5/ext/json/tests/pass003.phpt | 33 + .../tests/php-5.2.5/ext/libxml/tests/001.phpt | 31 + .../tests/php-5.2.5/ext/libxml/tests/002.phpt | 87 + .../tests/php-5.2.5/ext/libxml/tests/003.phpt | 28 + .../tests/php-5.2.5/ext/libxml/tests/004.phpt | 57 + .../php-5.2.5/ext/libxml/tests/bug42112.phpt | 31 + .../tests/php-5.2.5/ext/libxml/tests/test.xml | 8 + .../ext/mbstring/libmbfl/tests/sample.c | 38 + .../ext/mbstring/tests/bug20087.phpt | 20 + .../ext/mbstring/tests/bug25140.phpt | 10 + .../ext/mbstring/tests/bug26639.phpt | 123 + .../ext/mbstring/tests/bug28220.phpt | 25 + .../ext/mbstring/tests/bug30549.phpt | 31 + .../ext/mbstring/tests/bug31911.phpt | 13 + .../ext/mbstring/tests/casefold.phpt | 24 + .../php-5.2.5/ext/mbstring/tests/common.inc | 55 + .../php-5.2.5/ext/mbstring/tests/htmlent.phpt | 41 + .../ext/mbstring/tests/ini_language.phpt | 15 + .../mbstring/tests/mb_convert_encoding.phpt | 138 + .../mbstring/tests/mb_convert_variables.phpt | 164 + .../mbstring/tests/mb_detect_encoding.phpt | 121 + .../ext/mbstring/tests/mb_detect_order.phpt | 61 + .../ext/mbstring/tests/mb_ereg-compat-01.phpt | 21 + .../ext/mbstring/tests/mb_ereg-compat-02.phpt | 25 + .../php-5.2.5/ext/mbstring/tests/mb_ereg.phpt | 47 + .../ext/mbstring/tests/mb_ereg1.phpt | 79 + .../ext/mbstring/tests/mb_ereg2.phpt | 41 + .../tests/mb_ereg_replace-compat-01.phpt | 15 + .../tests/mb_ereg_replace-compat-02.phpt | 15 + .../tests/mb_ereg_replace-compat-03.phpt | 15 + .../tests/mb_ereg_replace-compat-04.phpt | 15 + .../tests/mb_ereg_replace-compat-05.phpt | 16 + .../tests/mb_ereg_replace-compat-06.phpt | 14 + .../tests/mb_ereg_replace-compat-07.phpt | 15 + .../tests/mb_ereg_replace-compat-08.phpt | 15 + .../tests/mb_ereg_replace-compat-09.phpt | 15 + .../tests/mb_ereg_replace-compat-10.phpt | 15 + .../tests/mb_ereg_replace-compat-11.phpt | 15 + .../tests/mb_ereg_replace-compat-12.phpt | 14 + .../tests/mb_ereg_replace-compat-13.phpt | 14 + .../ext/mbstring/tests/mb_ereg_replace.phpt | 18 + .../mbstring/tests/mb_ereg_search_xxx.phpt | 82 + .../ext/mbstring/tests/mb_http_input.phpt | 51 + .../ext/mbstring/tests/mb_http_output.phpt | 84 + .../mbstring/tests/mb_internal_encoding.phpt | 68 + .../tests/mb_output_handler_euc_jp.phpt | 21 + .../tests/mb_output_handler_shift_jis.phpt | 16 + .../ext/mbstring/tests/mb_parse_str.phpt | 80 + .../ext/mbstring/tests/mb_parse_str02.phpt | 105 + .../tests/mb_preferred_mime_name.phpt | 61 + .../mbstring/tests/mb_regex_set_options.phpt | 18 + .../ext/mbstring/tests/mb_send_mail01.phpt | 38 + .../ext/mbstring/tests/mb_send_mail02.phpt | 38 + .../ext/mbstring/tests/mb_send_mail03.phpt | 38 + .../ext/mbstring/tests/mb_send_mail04.phpt | 38 + .../ext/mbstring/tests/mb_send_mail05.phpt | 42 + .../ext/mbstring/tests/mb_send_mail06.phpt | 41 + .../ext/mbstring/tests/mb_send_mail07.phpt | 41 + .../mbstring/tests/mb_split-compat-01.phpt | 23 + .../ext/mbstring/tests/mb_split.phpt | 48 + .../ext/mbstring/tests/mb_strcut.phpt | 34 + .../ext/mbstring/tests/mb_strimwidth.phpt | 43 + .../ext/mbstring/tests/mb_strlen.phpt | 102 + .../ext/mbstring/tests/mb_strpos.phpt | 175 + .../ext/mbstring/tests/mb_strwidth.phpt | 32 + .../tests/mb_substitute_character.phpt | 49 + .../ext/mbstring/tests/mb_substr.phpt | 35 + .../ext/mbstring/tests/mb_substr_count.phpt | 44 + .../ext/mbstring/tests/overload01.phpt | 25 + .../ext/mbstring/tests/overload02.phpt | 36 + .../ext/mbstring/tests/php_gr_jp_10830.phpt | 18 + .../ext/mbstring/tests/php_gr_jp_16242.phpt | 21 + .../mbstring/tests/php_gr_jp_dev_884-1.phpt | 18 + .../mbstring/tests/php_gr_jp_dev_884-2.phpt | 19 + .../ext/mbstring/tests/simpletest.phpt | 34 + .../php-5.2.5/ext/mbstring/tests/skipif.inc | 14 + .../ext/mbstring/tests/zend-multibyte.phpt | 23 + .../php-5.2.5/ext/mcrypt/tests/blowfish.phpt | 89 + .../php-5.2.5/ext/mcrypt/tests/bug35496.phpt | 14 + .../php-5.2.5/ext/mcrypt/tests/bug37595.phpt | Bin 0 -> 1094 bytes .../php-5.2.5/ext/mcrypt/tests/bug41252.phpt | 13 + .../php-5.2.5/ext/mcrypt/tests/bug8040.phpt | 24 + .../php-5.2.5/ext/mcrypt/tests/vectors.txt | 33 + phpt/tests/php-5.2.5/ext/mhash/tests/001.phpt | 73 + phpt/tests/php-5.2.5/ext/mhash/tests/002.phpt | 64 + phpt/tests/php-5.2.5/ext/mhash/tests/003.phpt | 71 + phpt/tests/php-5.2.5/ext/mhash/tests/skip.inc | 5 + .../ext/ming/tests/swfaction-new.phpt | 51 + .../php-5.2.5/ext/ming/tests/swfaction.phpt | 51 + phpt/tests/php-5.2.5/ext/mysql/tests/001.phpt | 25 + phpt/tests/php-5.2.5/ext/mysql/tests/002.phpt | 53 + phpt/tests/php-5.2.5/ext/mysql/tests/003.phpt | 84 + .../php-5.2.5/ext/mysql/tests/connect.inc | 10 + .../php-5.2.5/ext/mysql/tests/skipif.inc | 11 + .../tests/php-5.2.5/ext/mysqli/tests/001.phpt | 47 + .../tests/php-5.2.5/ext/mysqli/tests/002.phpt | 63 + .../tests/php-5.2.5/ext/mysqli/tests/003.phpt | 58 + .../tests/php-5.2.5/ext/mysqli/tests/004.phpt | 60 + .../tests/php-5.2.5/ext/mysqli/tests/005.phpt | 40 + .../tests/php-5.2.5/ext/mysqli/tests/006.phpt | 54 + .../tests/php-5.2.5/ext/mysqli/tests/007.phpt | 54 + .../tests/php-5.2.5/ext/mysqli/tests/008.phpt | 54 + .../tests/php-5.2.5/ext/mysqli/tests/009.phpt | 79 + .../tests/php-5.2.5/ext/mysqli/tests/010.phpt | 59 + .../tests/php-5.2.5/ext/mysqli/tests/011.phpt | 57 + .../tests/php-5.2.5/ext/mysqli/tests/012.phpt | 58 + .../tests/php-5.2.5/ext/mysqli/tests/013.phpt | 52 + .../tests/php-5.2.5/ext/mysqli/tests/014.phpt | 69 + .../tests/php-5.2.5/ext/mysqli/tests/015.phpt | 69 + .../tests/php-5.2.5/ext/mysqli/tests/016.phpt | 27 + .../tests/php-5.2.5/ext/mysqli/tests/017.phpt | 35 + .../tests/php-5.2.5/ext/mysqli/tests/018.phpt | 27 + .../tests/php-5.2.5/ext/mysqli/tests/019.phpt | 73 + .../tests/php-5.2.5/ext/mysqli/tests/020.phpt | 67 + .../tests/php-5.2.5/ext/mysqli/tests/021.phpt | 42 + .../tests/php-5.2.5/ext/mysqli/tests/022.phpt | 46 + .../tests/php-5.2.5/ext/mysqli/tests/023.phpt | 65 + .../tests/php-5.2.5/ext/mysqli/tests/024.phpt | 66 + .../tests/php-5.2.5/ext/mysqli/tests/025.phpt | 70 + .../tests/php-5.2.5/ext/mysqli/tests/026.phpt | 49 + .../tests/php-5.2.5/ext/mysqli/tests/027.phpt | 20 + .../tests/php-5.2.5/ext/mysqli/tests/028.phpt | 19 + .../tests/php-5.2.5/ext/mysqli/tests/029.phpt | 25 + .../tests/php-5.2.5/ext/mysqli/tests/030.phpt | 25 + .../tests/php-5.2.5/ext/mysqli/tests/031.phpt | 25 + .../tests/php-5.2.5/ext/mysqli/tests/032.phpt | 25 + .../tests/php-5.2.5/ext/mysqli/tests/033.phpt | 20 + .../tests/php-5.2.5/ext/mysqli/tests/034.phpt | 20 + .../tests/php-5.2.5/ext/mysqli/tests/035.phpt | 19 + .../tests/php-5.2.5/ext/mysqli/tests/036.phpt | 51 + .../tests/php-5.2.5/ext/mysqli/tests/037.phpt | 36 + .../tests/php-5.2.5/ext/mysqli/tests/038.phpt | 33 + .../tests/php-5.2.5/ext/mysqli/tests/039.phpt | 26 + .../tests/php-5.2.5/ext/mysqli/tests/040.phpt | 33 + .../tests/php-5.2.5/ext/mysqli/tests/041.phpt | 22 + .../tests/php-5.2.5/ext/mysqli/tests/042.phpt | 62 + .../tests/php-5.2.5/ext/mysqli/tests/043.phpt | 42 + .../tests/php-5.2.5/ext/mysqli/tests/044.phpt | 21 + .../tests/php-5.2.5/ext/mysqli/tests/045.phpt | 46 + .../tests/php-5.2.5/ext/mysqli/tests/046.phpt | 33 + .../tests/php-5.2.5/ext/mysqli/tests/047.phpt | 196 + .../tests/php-5.2.5/ext/mysqli/tests/048.phpt | 62 + .../tests/php-5.2.5/ext/mysqli/tests/049.phpt | 26 + .../tests/php-5.2.5/ext/mysqli/tests/050.phpt | 21 + .../tests/php-5.2.5/ext/mysqli/tests/051.phpt | 22 + .../tests/php-5.2.5/ext/mysqli/tests/052.phpt | 22 + .../tests/php-5.2.5/ext/mysqli/tests/053.phpt | 20 + .../tests/php-5.2.5/ext/mysqli/tests/054.phpt | 20 + .../tests/php-5.2.5/ext/mysqli/tests/055.phpt | 19 + .../tests/php-5.2.5/ext/mysqli/tests/056.phpt | 21 + .../tests/php-5.2.5/ext/mysqli/tests/057.phpt | 54 + .../tests/php-5.2.5/ext/mysqli/tests/058.phpt | 57 + .../tests/php-5.2.5/ext/mysqli/tests/059.phpt | 41 + .../tests/php-5.2.5/ext/mysqli/tests/060.phpt | 60 + .../tests/php-5.2.5/ext/mysqli/tests/061.phpt | 46 + .../tests/php-5.2.5/ext/mysqli/tests/062.phpt | 25 + .../tests/php-5.2.5/ext/mysqli/tests/063.phpt | 21 + .../tests/php-5.2.5/ext/mysqli/tests/064.phpt | 21 + .../tests/php-5.2.5/ext/mysqli/tests/065.phpt | 44 + .../tests/php-5.2.5/ext/mysqli/tests/066.phpt | 28 + .../tests/php-5.2.5/ext/mysqli/tests/067.phpt | 51 + .../tests/php-5.2.5/ext/mysqli/tests/068.phpt | 33 + .../tests/php-5.2.5/ext/mysqli/tests/071.phpt | 36 + .../tests/php-5.2.5/ext/mysqli/tests/072.phpt | 27 + .../tests/php-5.2.5/ext/mysqli/tests/073.phpt | 23 + .../php-5.2.5/ext/mysqli/tests/bug28817.phpt | 39 + .../php-5.2.5/ext/mysqli/tests/bug29311.phpt | 48 + .../php-5.2.5/ext/mysqli/tests/bug30967.phpt | 23 + .../php-5.2.5/ext/mysqli/tests/bug31141.phpt | 28 + .../php-5.2.5/ext/mysqli/tests/bug31668.phpt | 56 + .../php-5.2.5/ext/mysqli/tests/bug32405.phpt | 39 + .../php-5.2.5/ext/mysqli/tests/bug33090.phpt | 21 + .../php-5.2.5/ext/mysqli/tests/bug33263.phpt | 32 + .../php-5.2.5/ext/mysqli/tests/bug33491.phpt | 26 + .../php-5.2.5/ext/mysqli/tests/bug34785.phpt | 47 + .../php-5.2.5/ext/mysqli/tests/bug34810.phpt | 39 + .../php-5.2.5/ext/mysqli/tests/bug35103.phpt | 68 + .../php-5.2.5/ext/mysqli/tests/bug35517.phpt | 29 + .../php-5.2.5/ext/mysqli/tests/bug35759.phpt | 44 + .../php-5.2.5/ext/mysqli/tests/bug36420.phpt | 25 + .../php-5.2.5/ext/mysqli/tests/bug36745.phpt | 23 + .../php-5.2.5/ext/mysqli/tests/bug36802.phpt | 46 + .../php-5.2.5/ext/mysqli/tests/bug36949.phpt | 50 + .../php-5.2.5/ext/mysqli/tests/bug37090.phpt | 41 + .../php-5.2.5/ext/mysqli/tests/bug38003.phpt | 20 + .../php-5.2.5/ext/mysqli/tests/bug38710.phpt | 23 + .../php-5.2.5/ext/mysqli/tests/connect.inc | 25 + .../php-5.2.5/ext/mysqli/tests/skipif.inc | 10 + .../php-5.2.5/ext/mysqli/tests/skipifemb.inc | 5 + .../ext/mysqli/tests/skipifnotemb.inc | 5 + .../php-5.2.5/ext/ncurses/tests/001.phpt | 21 + .../ext/oci8/tests/array_bind_001.phpt | 69 + .../ext/oci8/tests/array_bind_002.phpt | 77 + .../ext/oci8/tests/array_bind_003.phpt | 73 + .../ext/oci8/tests/array_bind_004.phpt | 65 + .../ext/oci8/tests/array_bind_005.phpt | 74 + .../ext/oci8/tests/array_bind_006.phpt | 74 + .../ext/oci8/tests/array_bind_007.phpt | 77 + .../ext/oci8/tests/array_bind_008.phpt | 78 + .../ext/oci8/tests/array_bind_009.phpt | 17 + .../ext/oci8/tests/array_bind_010.phpt | 36 + .../ext/oci8/tests/array_bind_011.phpt | 67 + .../ext/oci8/tests/array_bind_012.phpt | 26 + .../ext/oci8/tests/array_bind_013.phpt | 39 + .../ext/oci8/tests/array_bind_014.phpt | 73 + .../ext/oci8/tests/array_bind_date.phpt | 74 + .../ext/oci8/tests/array_bind_date1.phpt | 74 + .../ext/oci8/tests/array_bind_float.phpt | 74 + .../ext/oci8/tests/array_bind_float1.phpt | 74 + .../ext/oci8/tests/array_bind_int.phpt | 74 + .../ext/oci8/tests/array_bind_int1.phpt | 74 + .../ext/oci8/tests/array_bind_str.phpt | 74 + .../ext/oci8/tests/array_bind_str1.phpt | 74 + .../php-5.2.5/ext/oci8/tests/bind_empty.phpt | 104 + .../php-5.2.5/ext/oci8/tests/bind_long.phpt | 38 + .../ext/oci8/tests/bind_long_raw.phpt | 38 + .../php-5.2.5/ext/oci8/tests/bind_raw.phpt | 39 + .../php-5.2.5/ext/oci8/tests/bug26133.phpt | 34 + .../php-5.2.5/ext/oci8/tests/bug27303.phpt | 252 + .../php-5.2.5/ext/oci8/tests/bug27303_2.phpt | 252 + .../php-5.2.5/ext/oci8/tests/bug27303_3.phpt | 252 + .../php-5.2.5/ext/oci8/tests/bug27303_4.phpt | 252 + .../php-5.2.5/ext/oci8/tests/bug32325.phpt | 39 + .../php-5.2.5/ext/oci8/tests/bug35973.phpt | 43 + .../php-5.2.5/ext/oci8/tests/bug36010.phpt | 26 + .../php-5.2.5/ext/oci8/tests/bug36096.phpt | 28 + .../php-5.2.5/ext/oci8/tests/bug37581.phpt | 69 + .../php-5.2.5/ext/oci8/tests/bug38161.phpt | 30 + .../php-5.2.5/ext/oci8/tests/bug38173.phpt | 79 + .../php-5.2.5/ext/oci8/tests/bug40078.phpt | 55 + .../php-5.2.5/ext/oci8/tests/bug40415.phpt | 200 + .../php-5.2.5/ext/oci8/tests/bug42134.phpt | 100 + .../php-5.2.5/ext/oci8/tests/bug42173.phpt | 168 + .../tests/php-5.2.5/ext/oci8/tests/close.phpt | 17 + .../php-5.2.5/ext/oci8/tests/coll_001.phpt | 27 + .../php-5.2.5/ext/oci8/tests/coll_002.phpt | 30 + .../ext/oci8/tests/coll_002_func.phpt | 30 + .../php-5.2.5/ext/oci8/tests/coll_003.phpt | 34 + .../ext/oci8/tests/coll_003_func.phpt | 34 + .../php-5.2.5/ext/oci8/tests/coll_004.phpt | 29 + .../ext/oci8/tests/coll_004_func.phpt | 29 + .../php-5.2.5/ext/oci8/tests/coll_005.phpt | 27 + .../php-5.2.5/ext/oci8/tests/coll_006.phpt | 30 + .../ext/oci8/tests/coll_006_func.phpt | 30 + .../php-5.2.5/ext/oci8/tests/coll_007.phpt | 34 + .../php-5.2.5/ext/oci8/tests/coll_008.phpt | 29 + .../php-5.2.5/ext/oci8/tests/coll_009.phpt | 42 + .../ext/oci8/tests/coll_009_func.phpt | 42 + .../php-5.2.5/ext/oci8/tests/coll_010.phpt | 41 + .../ext/oci8/tests/coll_010_func.phpt | 41 + .../php-5.2.5/ext/oci8/tests/coll_011.phpt | 43 + .../ext/oci8/tests/coll_011_func.phpt | 43 + .../php-5.2.5/ext/oci8/tests/coll_012.phpt | 41 + .../ext/oci8/tests/coll_012_func.phpt | 41 + .../php-5.2.5/ext/oci8/tests/coll_013.phpt | 38 + .../ext/oci8/tests/coll_013_func.phpt | 38 + .../php-5.2.5/ext/oci8/tests/coll_014.phpt | 38 + .../ext/oci8/tests/coll_014_func.phpt | 38 + .../php-5.2.5/ext/oci8/tests/coll_015.phpt | 38 + .../ext/oci8/tests/coll_015_func.phpt | 38 + .../php-5.2.5/ext/oci8/tests/coll_016.phpt | 48 + .../ext/oci8/tests/coll_016_func.phpt | 48 + .../php-5.2.5/ext/oci8/tests/coll_017.phpt | 38 + .../ext/oci8/tests/coll_017_func.phpt | 38 + .../php-5.2.5/ext/oci8/tests/coll_018.phpt | 93 + .../php-5.2.5/ext/oci8/tests/coll_019.phpt | 104 + .../php-5.2.5/ext/oci8/tests/commit.phpt | 148 + .../php-5.2.5/ext/oci8/tests/commit_old.phpt | 146 + .../php-5.2.5/ext/oci8/tests/connect.inc | 30 + .../php-5.2.5/ext/oci8/tests/connect.phpt | 22 + .../php-5.2.5/ext/oci8/tests/connect_1.phpt | 35 + .../ext/oci8/tests/connect_1_old.phpt | 35 + .../php-5.2.5/ext/oci8/tests/connect_old.phpt | 22 + .../oci8/tests/connect_with_charset_001.phpt | 37 + .../tests/connect_without_oracle_home.phpt | 30 + .../connect_without_oracle_home_old.phpt | 29 + .../php-5.2.5/ext/oci8/tests/create_table.inc | 19 + .../php-5.2.5/ext/oci8/tests/create_type.inc | 17 + .../php-5.2.5/ext/oci8/tests/cursor_bind.phpt | 99 + .../ext/oci8/tests/cursor_bind_err.phpt | 48 + .../php-5.2.5/ext/oci8/tests/cursors.phpt | 65 + .../php-5.2.5/ext/oci8/tests/cursors_old.phpt | 64 + .../tests/php-5.2.5/ext/oci8/tests/debug.phpt | 33 + .../ext/oci8/tests/default_prefetch.phpt | 50 + .../ext/oci8/tests/default_prefetch1.phpt | 50 + .../ext/oci8/tests/default_prefetch2.phpt | 53 + .../php-5.2.5/ext/oci8/tests/define.phpt | 41 + .../php-5.2.5/ext/oci8/tests/define1.phpt | 52 + .../php-5.2.5/ext/oci8/tests/define2.phpt | 87 + .../php-5.2.5/ext/oci8/tests/define3.phpt | 105 + .../php-5.2.5/ext/oci8/tests/define4.phpt | 67 + .../php-5.2.5/ext/oci8/tests/define5.phpt | 64 + .../php-5.2.5/ext/oci8/tests/define_old.phpt | 41 + .../php-5.2.5/ext/oci8/tests/descriptors.phpt | 49 + .../php-5.2.5/ext/oci8/tests/details.inc | 25 + .../php-5.2.5/ext/oci8/tests/drop_table.inc | 12 + .../php-5.2.5/ext/oci8/tests/drop_type.inc | 12 + .../tests/php-5.2.5/ext/oci8/tests/error.phpt | 40 + .../php-5.2.5/ext/oci8/tests/error1.phpt | 27 + .../php-5.2.5/ext/oci8/tests/error2.phpt | 24 + .../php-5.2.5/ext/oci8/tests/error_old.phpt | 40 + .../php-5.2.5/ext/oci8/tests/exec_fetch.phpt | 24 + .../ext/oci8/tests/execute_mode.phpt | 19 + .../tests/php-5.2.5/ext/oci8/tests/fetch.phpt | 56 + .../php-5.2.5/ext/oci8/tests/fetch_all.phpt | 149 + .../php-5.2.5/ext/oci8/tests/fetch_all2.phpt | 242 + .../php-5.2.5/ext/oci8/tests/fetch_all3.phpt | 577 + .../php-5.2.5/ext/oci8/tests/fetch_array.phpt | 308 + .../php-5.2.5/ext/oci8/tests/fetch_assoc.phpt | 82 + .../php-5.2.5/ext/oci8/tests/fetch_into.phpt | 82 + .../php-5.2.5/ext/oci8/tests/fetch_into1.phpt | 192 + .../php-5.2.5/ext/oci8/tests/fetch_into2.phpt | 70 + .../ext/oci8/tests/fetch_object.phpt | 82 + .../php-5.2.5/ext/oci8/tests/fetch_row.phpt | 82 + .../php-5.2.5/ext/oci8/tests/field_funcs.phpt | 105 + .../ext/oci8/tests/field_funcs1.phpt | 179 + .../ext/oci8/tests/field_funcs2.phpt | 70 + .../ext/oci8/tests/field_funcs_old.phpt | 105 + .../ext/oci8/tests/function_aliases.phpt | 198 + .../php-5.2.5/ext/oci8/tests/lob_001.phpt | Bin 0 -> 1305 bytes .../php-5.2.5/ext/oci8/tests/lob_002.phpt | 66 + .../php-5.2.5/ext/oci8/tests/lob_003.phpt | Bin 0 -> 1628 bytes .../php-5.2.5/ext/oci8/tests/lob_004.phpt | 80 + .../php-5.2.5/ext/oci8/tests/lob_005.phpt | 52 + .../php-5.2.5/ext/oci8/tests/lob_006.phpt | Bin 0 -> 1694 bytes .../php-5.2.5/ext/oci8/tests/lob_007.phpt | 66 + .../php-5.2.5/ext/oci8/tests/lob_008.phpt | 65 + .../php-5.2.5/ext/oci8/tests/lob_009.phpt | 69 + .../php-5.2.5/ext/oci8/tests/lob_009.txt | 6 + .../php-5.2.5/ext/oci8/tests/lob_010.phpt | 46 + .../php-5.2.5/ext/oci8/tests/lob_011.phpt | 78 + .../php-5.2.5/ext/oci8/tests/lob_012.phpt | 50 + .../php-5.2.5/ext/oci8/tests/lob_013.phpt | 54 + .../php-5.2.5/ext/oci8/tests/lob_014.phpt | 58 + .../php-5.2.5/ext/oci8/tests/lob_015.phpt | 53 + .../php-5.2.5/ext/oci8/tests/lob_016.phpt | 67 + .../php-5.2.5/ext/oci8/tests/lob_017.phpt | 69 + .../php-5.2.5/ext/oci8/tests/lob_018.phpt | 67 + .../php-5.2.5/ext/oci8/tests/lob_019.phpt | Bin 0 -> 1548 bytes .../php-5.2.5/ext/oci8/tests/lob_020.phpt | Bin 0 -> 3076 bytes .../php-5.2.5/ext/oci8/tests/lob_021.phpt | 74 + .../php-5.2.5/ext/oci8/tests/lob_022.phpt | 80 + .../php-5.2.5/ext/oci8/tests/lob_023.phpt | 84 + .../php-5.2.5/ext/oci8/tests/lob_024.phpt | 75 + .../php-5.2.5/ext/oci8/tests/lob_025.phpt | 82 + .../php-5.2.5/ext/oci8/tests/lob_026.phpt | 100 + .../php-5.2.5/ext/oci8/tests/lob_027.phpt | 103 + .../php-5.2.5/ext/oci8/tests/lob_028.phpt | 84 + .../php-5.2.5/ext/oci8/tests/lob_029.phpt | 119 + .../php-5.2.5/ext/oci8/tests/lob_030.phpt | 75 + .../php-5.2.5/ext/oci8/tests/lob_031.phpt | 107 + .../php-5.2.5/ext/oci8/tests/lob_032.phpt | 33 + .../php-5.2.5/ext/oci8/tests/lob_033.phpt | 38 + .../php-5.2.5/ext/oci8/tests/lob_034.phpt | 50 + .../php-5.2.5/ext/oci8/tests/lob_035.phpt | 108 + .../php-5.2.5/ext/oci8/tests/lob_036.phpt | 40 + .../php-5.2.5/ext/oci8/tests/lob_037.phpt | 68 + .../php-5.2.5/ext/oci8/tests/lob_038.phpt | 189 + .../php-5.2.5/ext/oci8/tests/lob_039.phpt | 65 + .../php-5.2.5/ext/oci8/tests/lob_040.phpt | 1041 + .../php-5.2.5/ext/oci8/tests/lob_aliases.phpt | 99 + .../php-5.2.5/ext/oci8/tests/lob_null.phpt | 265 + .../php-5.2.5/ext/oci8/tests/lob_temp.phpt | 36 + .../php-5.2.5/ext/oci8/tests/lob_temp1.phpt | 32 + phpt/tests/php-5.2.5/ext/oci8/tests/num.phpt | 221 + .../ext/oci8/tests/oci8safemode.phpt | 21 + .../ext/oci8/tests/oci_execute_segfault.phpt | 48 + .../ext/oci8/tests/old_oci_close.phpt | 23 + .../ext/oci8/tests/old_oci_close1.phpt | 25 + .../php-5.2.5/ext/oci8/tests/parse_error.phpt | 142 + .../php-5.2.5/ext/oci8/tests/password.phpt | 30 + .../php-5.2.5/ext/oci8/tests/password_2.phpt | 94 + .../ext/oci8/tests/password_new.phpt | 30 + .../ext/oci8/tests/password_old.phpt | 30 + .../ext/oci8/tests/pecl_bug10194.phpt | 47 + .../ext/oci8/tests/pecl_bug10194_blob.phpt | 47 + .../ext/oci8/tests/pecl_bug8816.phpt | 98 + .../php-5.2.5/ext/oci8/tests/persistent.phpt | 26 + .../php-5.2.5/ext/oci8/tests/prefetch.phpt | 51 + .../ext/oci8/tests/prefetch_old.phpt | 51 + .../ext/oci8/tests/privileged_connect.phpt | 25 + .../ext/oci8/tests/privileged_connect1.phpt | 27 + .../php-5.2.5/ext/oci8/tests/rowid_bind.phpt | 86 + .../php-5.2.5/ext/oci8/tests/select_null.phpt | 25 + .../ext/oci8/tests/serverversion.phpt | 30 + .../tests/php-5.2.5/ext/oci8/tests/skipif.inc | 10 + .../ext/oci8/tests/statement_cache.phpt | 35 + .../ext/oci8/tests/statement_type.phpt | 48 + .../ext/oci8/tests/statement_type_old.phpt | 56 + phpt/tests/php-5.2.5/ext/oci8/tests/test.gif | Bin 0 -> 2523 bytes phpt/tests/php-5.2.5/ext/oci8/tests/test.txt | 9 + .../php-5.2.5/ext/oci8/tests/uncommitted.phpt | 16 + .../php-5.2.5/ext/oci8/tests/xmltype_01.phpt | 120 + .../php-5.2.5/ext/openssl/tests/001.phpt | 74 + .../php-5.2.5/ext/openssl/tests/002.phpt | 32 + .../php-5.2.5/ext/openssl/tests/003.phpt | 43 + .../php-5.2.5/ext/openssl/tests/004.phpt | 34 + .../php-5.2.5/ext/openssl/tests/005.phpt | 34 + .../php-5.2.5/ext/openssl/tests/005_crt.txt | 22 + .../php-5.2.5/ext/openssl/tests/bug25614.phpt | 14 + .../php-5.2.5/ext/openssl/tests/bug28382.phpt | 41 + .../ext/openssl/tests/bug28382cert.txt | 27 + .../php-5.2.5/ext/openssl/tests/bug36732.phpt | 40 + .../php-5.2.5/ext/openssl/tests/bug37820.phpt | 36 + .../ext/openssl/tests/bug37820cert.pem | 14 + .../ext/openssl/tests/bug37820key.pem | 9 + .../php-5.2.5/ext/openssl/tests/bug38255.phpt | 55 + .../php-5.2.5/ext/openssl/tests/bug38261.phpt | 34 + .../php-5.2.5/ext/openssl/tests/bug39217.phpt | 19 + .../ext/openssl/tests/bug39217cert1.txt | 17 + .../ext/openssl/tests/bug39217cert2.txt | 18 + .../php-5.2.5/ext/openssl/tests/bug41353.phpt | 16 + phpt/tests/php-5.2.5/ext/pcntl/tests/001.phpt | 82 + phpt/tests/php-5.2.5/ext/pcre/tests/001.phpt | 87 + phpt/tests/php-5.2.5/ext/pcre/tests/002.phpt | 40 + phpt/tests/php-5.2.5/ext/pcre/tests/003.phpt | 140 + phpt/tests/php-5.2.5/ext/pcre/tests/004.phpt | 149 + phpt/tests/php-5.2.5/ext/pcre/tests/005.phpt | 476 + phpt/tests/php-5.2.5/ext/pcre/tests/006.phpt | 22 + .../ext/pcre/tests/backtrack_limit.phpt | 25 + .../php-5.2.5/ext/pcre/tests/bug20528.phpt | 24 + .../php-5.2.5/ext/pcre/tests/bug21732.phpt | 29 + .../php-5.2.5/ext/pcre/tests/bug21758.phpt | 26 + .../php-5.2.5/ext/pcre/tests/bug26927.phpt | 11 + .../php-5.2.5/ext/pcre/tests/bug27011.phpt | 13 + .../php-5.2.5/ext/pcre/tests/bug27103.phpt | 43 + .../php-5.2.5/ext/pcre/tests/bug33200.phpt | 12 + .../php-5.2.5/ext/pcre/tests/bug34790.phpt | 23 + .../php-5.2.5/ext/pcre/tests/bug37800.phpt | 31 + .../php-5.2.5/ext/pcre/tests/bug38600.phpt | 14 + .../php-5.2.5/ext/pcre/tests/bug40195.phpt | 45 + .../php-5.2.5/ext/pcre/tests/bug40909.phpt | 38 + .../php-5.2.5/ext/pcre/tests/bug41050.phpt | 26 + .../php-5.2.5/ext/pcre/tests/bug41148.phpt | 50 + .../php-5.2.5/ext/pcre/tests/bug41638.phpt | 82 + .../php-5.2.5/ext/pcre/tests/bug42298.phpt | 46 + .../php-5.2.5/ext/pcre/tests/cache_limit.phpt | 25 + .../php-5.2.5/ext/pcre/tests/delimiters.phpt | 37 + .../ext/pcre/tests/dollar_endonly.phpt | 39 + phpt/tests/php-5.2.5/ext/pcre/tests/grep.phpt | 23 + .../tests/php-5.2.5/ext/pcre/tests/grep2.phpt | 45 + .../ext/pcre/tests/invalid_utf8.phpt | 22 + .../php-5.2.5/ext/pcre/tests/locales.phpt | 25 + .../php-5.2.5/ext/pcre/tests/match_flags.phpt | 127 + .../ext/pcre/tests/match_flags2.phpt | 95 + .../ext/pcre/tests/match_flags3.phpt | 46 + .../php-5.2.5/ext/pcre/tests/multiline.phpt | 18 + .../ext/pcre/tests/pcre_anchored.phpt | 28 + .../php-5.2.5/ext/pcre/tests/pcre_count.phpt | 40 + .../ext/pcre/tests/pcre_extended.phpt | 29 + .../php-5.2.5/ext/pcre/tests/pcre_extra.phpt | 14 + .../ext/pcre/tests/preg_replace.phpt | 25 + .../ext/pcre/tests/preg_replace2.phpt | 48 + .../ext/pcre/tests/preg_replace_callback.phpt | 25 + .../pcre/tests/preg_replace_callback2.phpt | 39 + .../pcre/tests/preg_replace_callback3.phpt | 45 + .../ext/pcre/tests/recursion_limit.phpt | 25 + .../tests/php-5.2.5/ext/pcre/tests/split.phpt | 86 + .../php-5.2.5/ext/pcre/tests/split2.phpt | 315 + .../tests/php-5.2.5/ext/pcre/tests/study.phpt | 31 + .../php-5.2.5/ext/pcre/tests/ungreedy.phpt | 31 + .../php-5.2.5/ext/pdo/tests/bug_34630.phpt | 57 + .../php-5.2.5/ext/pdo/tests/bug_34687.phpt | 32 + .../php-5.2.5/ext/pdo/tests/bug_35671.phpt | 45 + .../php-5.2.5/ext/pdo/tests/bug_36428.phpt | 33 + .../php-5.2.5/ext/pdo/tests/bug_36798.phpt | 33 + .../php-5.2.5/ext/pdo/tests/bug_38253.phpt | 47 + .../php-5.2.5/ext/pdo/tests/bug_38394.phpt | 51 + .../php-5.2.5/ext/pdo/tests/bug_39398.phpt | 35 + .../php-5.2.5/ext/pdo/tests/bug_39656.phpt | 50 + .../php-5.2.5/ext/pdo/tests/bug_40285.phpt | 27 + .../php-5.2.5/ext/pdo/tests/bug_42917.phpt | 40 + .../php-5.2.5/ext/pdo/tests/bug_43130.phpt | 31 + .../php-5.2.5/ext/pdo/tests/bug_43139.phpt | 34 + phpt/tests/php-5.2.5/ext/pdo/tests/pdo.inc | 11 + .../php-5.2.5/ext/pdo/tests/pdo_001.phpt | 50 + .../php-5.2.5/ext/pdo/tests/pdo_002.phpt | 50 + .../php-5.2.5/ext/pdo/tests/pdo_003.phpt | 62 + .../php-5.2.5/ext/pdo/tests/pdo_004.phpt | 50 + .../php-5.2.5/ext/pdo/tests/pdo_005.phpt | 154 + .../php-5.2.5/ext/pdo/tests/pdo_006.phpt | 77 + .../php-5.2.5/ext/pdo/tests/pdo_007.phpt | 65 + .../php-5.2.5/ext/pdo/tests/pdo_008.phpt | 40 + .../php-5.2.5/ext/pdo/tests/pdo_009.phpt | 131 + .../php-5.2.5/ext/pdo/tests/pdo_010.phpt | 119 + .../php-5.2.5/ext/pdo/tests/pdo_011.phpt | 301 + .../php-5.2.5/ext/pdo/tests/pdo_012.phpt | 98 + .../php-5.2.5/ext/pdo/tests/pdo_013.phpt | 96 + .../php-5.2.5/ext/pdo/tests/pdo_014.phpt | 102 + .../php-5.2.5/ext/pdo/tests/pdo_015.phpt | 100 + .../php-5.2.5/ext/pdo/tests/pdo_016.phpt | 203 + .../php-5.2.5/ext/pdo/tests/pdo_016a.phpt | 203 + .../php-5.2.5/ext/pdo/tests/pdo_017.phpt | 72 + .../php-5.2.5/ext/pdo/tests/pdo_018.phpt | 270 + .../php-5.2.5/ext/pdo/tests/pdo_019.phpt | 71 + .../php-5.2.5/ext/pdo/tests/pdo_020.phpt | 34 + .../php-5.2.5/ext/pdo/tests/pdo_021.phpt | 61 + .../php-5.2.5/ext/pdo/tests/pdo_022.phpt | 62 + .../php-5.2.5/ext/pdo/tests/pdo_023.phpt | 112 + .../php-5.2.5/ext/pdo/tests/pdo_024.phpt | 35 + .../php-5.2.5/ext/pdo/tests/pdo_025.phpt | 113 + .../php-5.2.5/ext/pdo/tests/pdo_026.phpt | 111 + .../php-5.2.5/ext/pdo/tests/pdo_027.phpt | 29 + .../php-5.2.5/ext/pdo/tests/pdo_028.phpt | 45 + .../php-5.2.5/ext/pdo/tests/pdo_029.phpt | 125 + .../php-5.2.5/ext/pdo/tests/pdo_030.phpt | 139 + .../php-5.2.5/ext/pdo/tests/pdo_031.phpt | 63 + .../php-5.2.5/ext/pdo/tests/pdo_032.phpt | 83 + .../php-5.2.5/ext/pdo/tests/pdo_033.phpt | 39 + .../php-5.2.5/ext/pdo/tests/pdo_034.phpt | 62 + .../php-5.2.5/ext/pdo/tests/pdo_test.inc | 89 + .../ext/pdo/tests/pecl_bug_5217.phpt | 29 + .../ext/pdo/tests/pecl_bug_5772.phpt | 29 + .../ext/pdo/tests/pecl_bug_5809.phpt | 34 + .../ext/pdo_firebird/tests/common.phpt | 27 + .../ext/pdo_firebird/tests/connect.phpt | 16 + .../php-5.2.5/ext/pdo_firebird/tests/ddl.phpt | 37 + .../ext/pdo_firebird/tests/execute.phpt | 65 + .../ext/pdo_firebird/tests/skipif.inc | 5 + .../ext/pdo_firebird/tests/testdb.inc | 34 + .../ext/pdo_mysql/tests/bug_33689.phpt | 52 + .../ext/pdo_mysql/tests/bug_37445.phpt | 21 + .../ext/pdo_mysql/tests/bug_39483.phpt | Bin 0 -> 756 bytes .../ext/pdo_mysql/tests/bug_41698.phpt | 37 + .../php-5.2.5/ext/pdo_mysql/tests/common.phpt | 28 + .../php-5.2.5/ext/pdo_mysql/tests/config.inc | 19 + .../ext/pdo_mysql/tests/last_insert_id.phpt | 35 + .../ext/pdo_mysql/tests/pecl_bug_5200.phpt | 30 + .../ext/pdo_mysql/tests/pecl_bug_5780.phpt | 39 + .../ext/pdo_mysql/tests/pecl_bug_5802.phpt | 52 + .../ext/pdo_mysql/tests/show_tables.phpt | 20 + .../ext/pdo_oci/tests/bug_33707.phpt | 29 + .../php-5.2.5/ext/pdo_oci/tests/common.phpt | 26 + .../tests/pdo_oci_attr_autocommit_1.phpt | 64 + .../tests/pdo_oci_attr_autocommit_2.phpt | 127 + .../tests/pdo_oci_attr_autocommit_3.phpt | 51 + .../ext/pdo_oci/tests/pdo_oci_attr_case.phpt | 81 + .../pdo_oci/tests/pdo_oci_attr_client.phpt | 43 + .../tests/pdo_oci_attr_drivername.phpt | 21 + .../pdo_oci/tests/pdo_oci_attr_nulls_1.phpt | 61 + .../tests/pdo_oci_attr_prefetch_1.phpt | 37 + .../tests/pdo_oci_attr_prefetch_2.phpt | 47 + .../pdo_oci/tests/pdo_oci_attr_server.phpt | 40 + .../ext/pdo_oci/tests/pdo_oci_quote1.phpt | 163 + .../ext/pdo_oci/tests/pecl_bug_11345.phpt | 29 + .../ext/pdo_oci/tests/pecl_bug_6364.phpt | 71 + .../php-5.2.5/ext/pdo_odbc/tests/common.phpt | 48 + .../ext/pdo_odbc/tests/long_columns.phpt | 46 + .../ext/pdo_pgsql/tests/bug36727.phpt | 23 + .../ext/pdo_pgsql/tests/bug_33876.phpt | 151 + .../php-5.2.5/ext/pdo_pgsql/tests/common.phpt | 24 + .../php-5.2.5/ext/pdo_pgsql/tests/config.inc | 14 + .../ext/pdo_pgsql/tests/large_objects.phpt | 61 + .../ext/pdo_sqlite/tests/bug33841.phpt | 28 + .../ext/pdo_sqlite/tests/bug35336.phpt | 26 + .../ext/pdo_sqlite/tests/common.phpt | 12 + .../php-5.2.5/ext/pgsql/tests/01createdb.phpt | 28 + .../ext/pgsql/tests/02connection.phpt | 59 + .../ext/pgsql/tests/03sync_query.phpt | 73 + .../ext/pgsql/tests/04async_query.phpt | 65 + .../ext/pgsql/tests/05large_object.phpt | 82 + .../php-5.2.5/ext/pgsql/tests/06copy.phpt | 22 + .../php-5.2.5/ext/pgsql/tests/07optional.phpt | 24 + .../php-5.2.5/ext/pgsql/tests/08escape.phpt | 68 + .../php-5.2.5/ext/pgsql/tests/09notice.phpt | 29 + .../ext/pgsql/tests/10pg_convert.phpt | 26 + .../ext/pgsql/tests/11pg_meta_data.phpt | 64 + .../ext/pgsql/tests/12pg_insert.phpt | 21 + .../ext/pgsql/tests/13pg_select.phpt | 34 + .../ext/pgsql/tests/14pg_update.phpt | 22 + .../ext/pgsql/tests/15pg_delete.phpt | 23 + .../ext/pgsql/tests/16pg_result_status.phpt | 19 + .../php-5.2.5/ext/pgsql/tests/17result.phpt | 67 + .../ext/pgsql/tests/18pg_escape_bytea.phpt | 28 + .../php-5.2.5/ext/pgsql/tests/19pg_ping.phpt | 15 + .../ext/pgsql/tests/20pg_get_pid.phpt | 17 + .../ext/pgsql/tests/21pg_get_notify.phpt | 20 + .../ext/pgsql/tests/22pg_fetch_object.phpt | 37 + .../ext/pgsql/tests/23sync_query_params.phpt | 59 + .../pgsql/tests/24sync_query_prepared.phpt | 65 + .../ext/pgsql/tests/25async_query_params.phpt | 70 + .../pgsql/tests/26async_query_prepared.phpt | 106 + .../ext/pgsql/tests/80_bug14383.phpt | 37 + .../ext/pgsql/tests/80_bug24499.phpt | 66 + .../ext/pgsql/tests/80_bug27597.phpt | 60 + .../ext/pgsql/tests/80_bug32223.phpt | 55 + .../ext/pgsql/tests/80_bug32223b.phpt | 57 + .../ext/pgsql/tests/80_bug36625.phpt | 49 + .../ext/pgsql/tests/80_bug39971.phpt | 30 + .../ext/pgsql/tests/80_bug42783.phpt | 34 + .../php-5.2.5/ext/pgsql/tests/98old_api.phpt | 33 + .../php-5.2.5/ext/pgsql/tests/9999dropdb.phpt | 18 + phpt/tests/php-5.2.5/ext/pgsql/tests/README | 16 + .../php-5.2.5/ext/pgsql/tests/config.inc | 12 + phpt/tests/php-5.2.5/ext/pgsql/tests/php.gif | Bin 0 -> 3872 bytes .../php-5.2.5/ext/pgsql/tests/skipif.inc | 18 + phpt/tests/php-5.2.5/ext/posix/tests/001.phpt | 12 + .../tests/php-5.2.5/ext/pspell/tests/001.phpt | 116 + .../tests/php-5.2.5/ext/pspell/tests/002.phpt | 44 + .../tests/php-5.2.5/ext/pspell/tests/003.phpt | 39 + .../tests/php-5.2.5/ext/pspell/tests/004.phpt | 35 + .../tests/php-5.2.5/ext/pspell/tests/005.phpt | 46 + .../php-5.2.5/ext/pspell/tests/wordlist.txt | 5 + .../php-5.2.5/ext/reflection/tests/001.phpt | 91 + .../php-5.2.5/ext/reflection/tests/002.phpt | 65 + .../php-5.2.5/ext/reflection/tests/003.phpt | 33 + .../php-5.2.5/ext/reflection/tests/004.phpt | 44 + .../php-5.2.5/ext/reflection/tests/005.phpt | 56 + .../php-5.2.5/ext/reflection/tests/006.phpt | 105 + .../php-5.2.5/ext/reflection/tests/007.phpt | 162 + .../php-5.2.5/ext/reflection/tests/008.phpt | 41 + .../php-5.2.5/ext/reflection/tests/009.phpt | 114 + .../php-5.2.5/ext/reflection/tests/026.phpt | 36 + .../ext/reflection/tests/bug26640.phpt | 27 + .../ext/reflection/tests/bug26695.phpt | 27 + .../ext/reflection/tests/bug29268.phpt | 29 + .../ext/reflection/tests/bug29523.phpt | 40 + .../ext/reflection/tests/bug29828.phpt | 37 + .../ext/reflection/tests/bug29986.phpt | 43 + .../ext/reflection/tests/bug30146.phpt | 25 + .../ext/reflection/tests/bug30148.phpt | 37 + .../ext/reflection/tests/bug30209.phpt | 33 + .../ext/reflection/tests/bug30856.phpt | 22 + .../ext/reflection/tests/bug30961.phpt | 22 + .../ext/reflection/tests/bug31651.phpt | 26 + .../ext/reflection/tests/bug32981.phpt | 36 + .../ext/reflection/tests/bug33312.phpt | 22 + .../ext/reflection/tests/bug33389.phpt | 99 + .../ext/reflection/tests/bug36308.phpt | 22 + .../ext/reflection/tests/bug36337.phpt | 30 + .../ext/reflection/tests/bug36434.phpt | 33 + .../ext/reflection/tests/bug37816.phpt | 30 + .../ext/reflection/tests/bug38132.phpt | 34 + .../ext/reflection/tests/bug38194.phpt | 13 + .../ext/reflection/tests/bug38217.phpt | 42 + .../ext/reflection/tests/bug38465.phpt | 66 + .../ext/reflection/tests/bug38653.phpt | 30 + .../ext/reflection/tests/bug38942.phpt | 36 + .../ext/reflection/tests/bug39001.phpt | 29 + .../ext/reflection/tests/bug39067.phpt | 47 + .../ext/reflection/tests/bug39884.phpt | 24 + .../ext/reflection/tests/bug40431.phpt | 140 + .../ext/reflection/tests/bug40794.phpt | 38 + .../ext/reflection/tests/bug41061.phpt | 30 + .../ext/reflection/tests/bug41884.phpt | 25 + .../ext/reflection/tests/bug42976.phpt | 34 + .../ext/reflection/tests/exception.inc | 16 + .../ext/reflection/tests/parameters_001.phpt | 40 + .../ext/reflection/tests/parameters_002.phpt | 209 + .../ext/reflection/tests/property_exists.phpt | 224 + .../tests/reflectionClass_FileInfo_basic.phpt | 33 + .../tests/reflectionClass_FileInfo_error.phpt | 37 + .../reflectionClass_constructor_001.phpt | 33 + .../reflectionClass_constructor_002.phpt | 67 + .../reflectionClass_getConstant_basic.phpt | 41 + .../reflectionClass_getConstant_error.phpt | 37 + .../reflectionClass_getConstants_basic.phpt | 48 + .../reflectionClass_getConstants_error.phpt | 24 + .../reflectionClass_getConstructor_basic.phpt | 82 + .../reflectionClass_getConstructor_error.phpt | 24 + .../tests/reflectionClass_getName_basic.phpt | 25 + .../tests/reflectionClass_getName_error.phpt | 17 + .../tests/reflectionClass_getName_error1.phpt | 8 + .../reflectionClass_isInstance_basic.phpt | 51 + .../reflectionClass_isInstance_error.phpt | 39 + .../reflectionClass_isInstantiable_basic.phpt | 40 + .../reflectionClass_isInstantiable_error.phpt | 19 + ...lectionClass_isInstantiable_variation.phpt | 50 + .../reflectionClass_isInternal_basic.phpt | 22 + .../reflectionClass_isInternal_error.phpt | 14 + .../reflectionClass_isSubclassOf_basic.phpt | 103 + .../reflectionClass_isSubclassOf_error.phpt | 17 + .../reflectionClass_isSubclassOf_error1.phpt | 16 + .../reflectionClass_isUserDefined_basic.phpt | 22 + .../reflectionClass_isUserDefined_error.phpt | 14 + .../reflectionObject_FileInfo_basic.phpt | 25 + .../reflectionObject_FileInfo_error.phpt | 37 + .../reflectionObject_constructor_basic.phpt | 28 + .../reflectionObject_constructor_error.phpt | 49 + .../reflectionObject_getConstant_basic.phpt | 41 + .../reflectionObject_getConstant_error.phpt | 34 + .../reflectionObject_getConstants_basic.phpt | 49 + .../reflectionObject_getConstants_error.phpt | 18 + ...reflectionObject_getConstructor_basic.phpt | 82 + ...reflectionObject_getConstructor_error.phpt | 24 + .../tests/reflectionObject_getName_basic.phpt | 27 + .../tests/reflectionObject_getName_error.phpt | 23 + .../reflectionObject_getName_error1.phpt | 8 + .../reflectionObject_isInstance_basic.phpt | 33 + .../reflectionObject_isInstance_error.phpt | 38 + ...reflectionObject_isInstantiable_basic.phpt | 36 + ...reflectionObject_isInstantiable_error.phpt | 22 + ...ectionObject_isInstantiable_variation.phpt | 78 + .../reflectionObject_isInternal_basic.phpt | 23 + .../reflectionObject_isInternal_error.phpt | 15 + .../reflectionObject_isSubclassOf_basic.phpt | 116 + .../reflectionObject_isSubclassOf_error.phpt | 24 + .../reflectionObject_isUserDefined_basic.phpt | 23 + .../reflectionObject_isUserDefined_error.phpt | 15 + .../tests/static_properties_002.phpt | 62 + .../php-5.2.5/ext/session/tests/001.phpt | 34 + .../php-5.2.5/ext/session/tests/002.phpt | 11 + .../php-5.2.5/ext/session/tests/003.phpt | 45 + .../php-5.2.5/ext/session/tests/004.phpt | 111 + .../php-5.2.5/ext/session/tests/005.phpt | 146 + .../php-5.2.5/ext/session/tests/006.phpt | 71 + .../php-5.2.5/ext/session/tests/007.phpt | 62 + .../ext/session/tests/008-php4.2.3.phpt | 71 + .../php-5.2.5/ext/session/tests/009.phpt | 59 + .../php-5.2.5/ext/session/tests/010.phpt | 19 + .../php-5.2.5/ext/session/tests/011.phpt | 20 + .../php-5.2.5/ext/session/tests/012.phpt | 35 + .../php-5.2.5/ext/session/tests/013.phpt | 27 + .../php-5.2.5/ext/session/tests/014.phpt | 42 + .../php-5.2.5/ext/session/tests/015.phpt | 25 + .../php-5.2.5/ext/session/tests/016.phpt | 25 + .../php-5.2.5/ext/session/tests/017.phpt | 26 + .../php-5.2.5/ext/session/tests/018.phpt | 25 + .../php-5.2.5/ext/session/tests/019.phpt | 73 + .../php-5.2.5/ext/session/tests/020.phpt | 26 + .../php-5.2.5/ext/session/tests/021.phpt | 62 + .../php-5.2.5/ext/session/tests/bug24592.phpt | 36 + .../php-5.2.5/ext/session/tests/bug26862.phpt | 23 + .../php-5.2.5/ext/session/tests/bug31454.phpt | 21 + .../php-5.2.5/ext/session/tests/bug36459.phpt | 41 + .../php-5.2.5/ext/session/tests/bug38377.phpt | 13 + .../php-5.2.5/ext/session/tests/bug41600.phpt | 26 + .../php-5.2.5/ext/session/tests/skipif.inc | 25 + phpt/tests/php-5.2.5/ext/shmop/tests/001.phpt | 91 + .../php-5.2.5/ext/simplexml/tests/000.phpt | 254 + .../php-5.2.5/ext/simplexml/tests/000.xml | 16 + .../php-5.2.5/ext/simplexml/tests/001.phpt | 43 + .../php-5.2.5/ext/simplexml/tests/002.phpt | 64 + .../php-5.2.5/ext/simplexml/tests/003.phpt | 69 + .../php-5.2.5/ext/simplexml/tests/004.phpt | 68 + .../php-5.2.5/ext/simplexml/tests/005.phpt | 40 + .../php-5.2.5/ext/simplexml/tests/006.phpt | 80 + .../php-5.2.5/ext/simplexml/tests/007.phpt | 97 + .../php-5.2.5/ext/simplexml/tests/008.phpt | 39 + .../php-5.2.5/ext/simplexml/tests/009.phpt | 45 + .../php-5.2.5/ext/simplexml/tests/009b.phpt | 35 + .../php-5.2.5/ext/simplexml/tests/010.phpt | 64 + .../php-5.2.5/ext/simplexml/tests/011.phpt | 47 + .../php-5.2.5/ext/simplexml/tests/012.phpt | 40 + .../php-5.2.5/ext/simplexml/tests/013.phpt | 23 + .../php-5.2.5/ext/simplexml/tests/014.phpt | 60 + .../php-5.2.5/ext/simplexml/tests/014a.phpt | 56 + .../php-5.2.5/ext/simplexml/tests/014b.phpt | 55 + .../php-5.2.5/ext/simplexml/tests/015.phpt | 56 + .../php-5.2.5/ext/simplexml/tests/016.phpt | 57 + .../php-5.2.5/ext/simplexml/tests/016a.phpt | 29 + .../php-5.2.5/ext/simplexml/tests/017.phpt | 86 + .../php-5.2.5/ext/simplexml/tests/018.phpt | 65 + .../php-5.2.5/ext/simplexml/tests/019.phpt | 80 + .../php-5.2.5/ext/simplexml/tests/020.phpt | 21 + .../php-5.2.5/ext/simplexml/tests/021.phpt | 25 + .../php-5.2.5/ext/simplexml/tests/022.phpt | 62 + .../php-5.2.5/ext/simplexml/tests/023.phpt | 36 + .../php-5.2.5/ext/simplexml/tests/024.phpt | 175 + .../php-5.2.5/ext/simplexml/tests/025.phpt | 92 + .../php-5.2.5/ext/simplexml/tests/026.phpt | 40 + .../php-5.2.5/ext/simplexml/tests/027.phpt | 83 + .../php-5.2.5/ext/simplexml/tests/028.phpt | 42 + .../php-5.2.5/ext/simplexml/tests/029.phpt | 40 + .../php-5.2.5/ext/simplexml/tests/030.phpt | 44 + .../php-5.2.5/ext/simplexml/tests/031.phpt | 57 + .../php-5.2.5/ext/simplexml/tests/032.phpt | 45 + .../php-5.2.5/ext/simplexml/tests/033.phpt | 137 + .../php-5.2.5/ext/simplexml/tests/book.xml | 10 + .../ext/simplexml/tests/bug24392.phpt | 22 + .../ext/simplexml/tests/bug24392.xml | 76 + .../ext/simplexml/tests/bug25756.xsd | 24 + .../ext/simplexml/tests/bug25756_1.xml | 13 + .../ext/simplexml/tests/bug25756_2.xml | 13 + .../ext/simplexml/tests/bug26976.phpt | 28 + .../ext/simplexml/tests/bug27010.phpt | 34 + .../ext/simplexml/tests/bug35785.phpt | 30 + .../ext/simplexml/tests/bug36611.phpt | 30 + .../ext/simplexml/tests/bug37386.phpt | 25 + .../ext/simplexml/tests/bug37565.phpt | 31 + .../ext/simplexml/tests/bug38347.phpt | 28 + .../ext/simplexml/tests/bug38354.phpt | 28 + .../ext/simplexml/tests/bug38406.phpt | 33 + .../ext/simplexml/tests/bug38424.phpt | 26 + .../ext/simplexml/tests/bug39662.phpt | 37 + .../ext/simplexml/tests/bug39760.phpt | 40 + .../ext/simplexml/tests/bug40451.phpt | 22 + .../ext/simplexml/tests/bug41175.phpt | 16 + .../ext/simplexml/tests/bug41582.phpt | 18 + .../ext/simplexml/tests/bug41861.phpt | 38 + .../ext/simplexml/tests/bug41867.phpt | 14 + .../ext/simplexml/tests/bug41947.phpt | 14 + .../ext/simplexml/tests/profile01.phpt | 18 + .../ext/simplexml/tests/profile02.phpt | 21 + .../ext/simplexml/tests/profile03.phpt | 18 + .../ext/simplexml/tests/profile04.phpt | 18 + .../ext/simplexml/tests/profile05.phpt | 18 + .../ext/simplexml/tests/profile06.phpt | 20 + .../ext/simplexml/tests/profile07.phpt | 23 + .../ext/simplexml/tests/profile08.phpt | 18 + .../ext/simplexml/tests/profile09.phpt | 19 + .../ext/simplexml/tests/profile10.phpt | 25 + .../ext/simplexml/tests/profile11.phpt | 35 + .../ext/simplexml/tests/profile12.phpt | 74 + .../ext/simplexml/tests/profile13.phpt | 75 + .../simplexml/tests/simplexml_import_dom.phpt | 22 + .../php-5.2.5/ext/simplexml/tests/sxe.dtd | 34 + .../php-5.2.5/ext/simplexml/tests/sxe.ent | 1 + .../php-5.2.5/ext/simplexml/tests/sxe.xml | 17 + .../php-5.2.5/ext/skeleton/tests/001.phpt | 21 + phpt/tests/php-5.2.5/ext/soap/tests/any.phpt | 85 + .../ext/soap/tests/bugs/bug27722.phpt | 13 + .../ext/soap/tests/bugs/bug27722.wsdl | 92 + .../ext/soap/tests/bugs/bug27742.phpt | 13 + .../ext/soap/tests/bugs/bug27742.wsdl | 854 + .../ext/soap/tests/bugs/bug28751.phpt | 38 + .../ext/soap/tests/bugs/bug28969.phpt | 38 + .../ext/soap/tests/bugs/bug28985.phpt | 204 + .../ext/soap/tests/bugs/bug28985.wsdl | 683 + .../ext/soap/tests/bugs/bug29061.phpt | 12 + .../ext/soap/tests/bugs/bug29061.wsdl | 41 + .../ext/soap/tests/bugs/bug29109.phpt | 18 + .../ext/soap/tests/bugs/bug29109.wsdl | 121 + .../ext/soap/tests/bugs/bug29236.phpt | 20 + .../ext/soap/tests/bugs/bug29236.wsdl | 287 + .../ext/soap/tests/bugs/bug29795.phpt | 32 + .../ext/soap/tests/bugs/bug29795.wsdl | 40 + .../ext/soap/tests/bugs/bug29830.phpt | 25 + .../ext/soap/tests/bugs/bug29839.phpt | 41 + .../ext/soap/tests/bugs/bug29839.wsdl | 42 + .../ext/soap/tests/bugs/bug29844.phpt | 36 + .../ext/soap/tests/bugs/bug29844.wsdl | 66 + .../ext/soap/tests/bugs/bug30045.phpt | 171 + .../ext/soap/tests/bugs/bug30106.phpt | 72 + .../ext/soap/tests/bugs/bug30106.wsdl | 59 + .../ext/soap/tests/bugs/bug30175.phpt | 47 + .../ext/soap/tests/bugs/bug30175.wsdl | 126 + .../ext/soap/tests/bugs/bug30799.phpt | 25 + .../ext/soap/tests/bugs/bug30928.phpt | 63 + .../ext/soap/tests/bugs/bug30928.wsdl | 49 + .../ext/soap/tests/bugs/bug30994.phpt | 47 + .../ext/soap/tests/bugs/bug31422.phpt | 42 + .../ext/soap/tests/bugs/bug31695.phpt | 62 + .../ext/soap/tests/bugs/bug31695.wsdl | 47 + .../ext/soap/tests/bugs/bug31755.phpt | 17 + .../ext/soap/tests/bugs/bug32776.phpt | 47 + .../ext/soap/tests/bugs/bug32776.wsdl | 47 + .../ext/soap/tests/bugs/bug32941.phpt | 41 + .../ext/soap/tests/bugs/bug32941.wsdl | 141 + .../ext/soap/tests/bugs/bug34449.phpt | 20 + .../ext/soap/tests/bugs/bug34453.phpt | 41 + .../ext/soap/tests/bugs/bug34453.wsdl | 42 + .../ext/soap/tests/bugs/bug34643.phpt | 48 + .../ext/soap/tests/bugs/bug34643.wsdl | 42 + .../ext/soap/tests/bugs/bug34657.phpt | 35 + .../ext/soap/tests/bugs/bug35142.phpt | 135 + .../ext/soap/tests/bugs/bug35142.wsdl | 543 + .../ext/soap/tests/bugs/bug35273.phpt | 21 + .../ext/soap/tests/bugs/bug36226-2.phpt | 121 + .../ext/soap/tests/bugs/bug36226-2.wsdl | 543 + .../ext/soap/tests/bugs/bug36226.phpt | 139 + .../ext/soap/tests/bugs/bug36575.phpt | 52 + .../ext/soap/tests/bugs/bug36575.wsdl | 87 + .../ext/soap/tests/bugs/bug36614.phpt | 13 + .../ext/soap/tests/bugs/bug36614.wsdl | 204 + .../ext/soap/tests/bugs/bug36629.phpt | 53 + .../ext/soap/tests/bugs/bug36908.phpt | 46 + .../ext/soap/tests/bugs/bug36908.wsdl | 51 + .../ext/soap/tests/bugs/bug36999.phpt | 50 + .../ext/soap/tests/bugs/bug36999.wsdl | 48 + .../ext/soap/tests/bugs/bug37013.phpt | 58 + .../ext/soap/tests/bugs/bug37013.wsdl | 67 + .../ext/soap/tests/bugs/bug37083.phpt | 58 + .../ext/soap/tests/bugs/bug37083.wsdl | 99 + .../ext/soap/tests/bugs/bug37278.phpt | 24 + .../ext/soap/tests/bugs/bug38004.phpt | 40 + .../ext/soap/tests/bugs/bug38004.wsdl | 51 + .../ext/soap/tests/bugs/bug38005.phpt | 41 + .../ext/soap/tests/bugs/bug38055.phpt | 39 + .../ext/soap/tests/bugs/bug38055.wsdl | 49 + .../ext/soap/tests/bugs/bug38067.phpt | 40 + .../ext/soap/tests/bugs/bug38067.wsdl | 48 + .../ext/soap/tests/bugs/bug38536.phpt | 52 + .../ext/soap/tests/bugs/bug38536.wsdl | 57 + .../ext/soap/tests/bugs/bug39121.phpt | 73 + .../ext/soap/tests/bugs/bug39815.phpt | 49 + .../ext/soap/tests/bugs/bug39832.phpt | 29 + .../ext/soap/tests/bugs/bug39832.wsdl | 55 + .../ext/soap/tests/bugs/bug40609.phpt | 21 + .../ext/soap/tests/bugs/bug40609.wsdl | 26 + .../ext/soap/tests/bugs/bug41004.phpt | 36 + .../ext/soap/tests/bugs/bug41004.wsdl | 69 + .../ext/soap/tests/bugs/bug41097.phpt | 27 + .../ext/soap/tests/bugs/bug41337.phpt | 12 + .../ext/soap/tests/bugs/bug41337.wsdl | 63 + .../ext/soap/tests/bugs/bug41337_2.phpt | 12 + .../ext/soap/tests/bugs/bug41337_2.wsdl | 36 + .../ext/soap/tests/bugs/bug41337_2_1.wsdl | 47 + .../ext/soap/tests/bugs/bug41477.phpt | 20 + .../ext/soap/tests/bugs/bug41566.phpt | 65 + .../ext/soap/tests/bugs/bug42086.phpt | 31 + .../ext/soap/tests/bugs/bug42086.wsdl | 141 + .../ext/soap/tests/bugs/bug42151.phpt | 31 + .../ext/soap/tests/bugs/bug42183.phpt | 27 + .../ext/soap/tests/bugs/bug42214.phpt | 24 + .../ext/soap/tests/bugs/bug42326.phpt | 49 + .../ext/soap/tests/bugs/bug42326.wsdl | 82 + .../ext/soap/tests/bugs/bug42359.phpt | 20 + .../ext/soap/tests/bugs/bug42359.wsdl | 58 + .../ext/soap/tests/bugs/bug42488.phpt | 22 + .../php-5.2.5/ext/soap/tests/bugs/skipif.inc | 3 + .../php-5.2.5/ext/soap/tests/bugs/xml.xsd | 34 + .../php-5.2.5/ext/soap/tests/bugs/xml2.xsd | 146 + .../php-5.2.5/ext/soap/tests/classmap.wsdl | 60 + .../php-5.2.5/ext/soap/tests/classmap001.phpt | 50 + .../php-5.2.5/ext/soap/tests/classmap002.phpt | 44 + .../php-5.2.5/ext/soap/tests/classmap003.phpt | 54 + .../php-5.2.5/ext/soap/tests/classmap003.wsdl | 51 + .../php-5.2.5/ext/soap/tests/classmap004.phpt | 66 + .../interop/Round2/Base/r2_base_001p.phpt | 19 + .../interop/Round2/Base/r2_base_001s.phpt | 19 + .../interop/Round2/Base/r2_base_001w.phpt | 19 + .../interop/Round2/Base/r2_base_002p.phpt | 19 + .../interop/Round2/Base/r2_base_002s.phpt | 19 + .../interop/Round2/Base/r2_base_002w.phpt | 19 + .../interop/Round2/Base/r2_base_003p.phpt | 19 + .../interop/Round2/Base/r2_base_003s.phpt | 19 + .../interop/Round2/Base/r2_base_003w.phpt | 19 + .../interop/Round2/Base/r2_base_004p.phpt | 21 + .../interop/Round2/Base/r2_base_004s.phpt | 21 + .../interop/Round2/Base/r2_base_004w.phpt | 21 + .../interop/Round2/Base/r2_base_005p.phpt | 19 + .../interop/Round2/Base/r2_base_005s.phpt | 19 + .../interop/Round2/Base/r2_base_005w.phpt | 19 + .../interop/Round2/Base/r2_base_006p.phpt | 19 + .../interop/Round2/Base/r2_base_006s.phpt | 23 + .../interop/Round2/Base/r2_base_006w.phpt | 19 + .../interop/Round2/Base/r2_base_007p.phpt | 19 + .../interop/Round2/Base/r2_base_007s.phpt | 22 + .../interop/Round2/Base/r2_base_007w.phpt | 19 + .../interop/Round2/Base/r2_base_008p.phpt | 19 + .../interop/Round2/Base/r2_base_008s.phpt | 21 + .../interop/Round2/Base/r2_base_008w.phpt | 19 + .../interop/Round2/Base/r2_base_009p.phpt | 19 + .../interop/Round2/Base/r2_base_009s.phpt | 20 + .../interop/Round2/Base/r2_base_009w.phpt | 19 + .../interop/Round2/Base/r2_base_010p.phpt | 19 + .../interop/Round2/Base/r2_base_010s.phpt | 19 + .../interop/Round2/Base/r2_base_010w.phpt | 19 + .../interop/Round2/Base/r2_base_011p.phpt | 19 + .../interop/Round2/Base/r2_base_011s.phpt | 24 + .../interop/Round2/Base/r2_base_011w.phpt | 19 + .../interop/Round2/Base/r2_base_012p.phpt | 21 + .../interop/Round2/Base/r2_base_012s.phpt | 21 + .../interop/Round2/Base/r2_base_012w.phpt | 21 + .../interop/Round2/Base/r2_base_013p.phpt | 21 + .../interop/Round2/Base/r2_base_013s.phpt | 26 + .../interop/Round2/Base/r2_base_013w.phpt | 21 + .../interop/Round2/Base/r2_base_014p.phpt | 29 + .../interop/Round2/Base/r2_base_014s.phpt | 26 + .../interop/Round2/Base/r2_base_014w.phpt | 29 + .../interop/Round2/Base/r2_base_015p.phpt | 31 + .../interop/Round2/Base/r2_base_015s.phpt | 44 + .../interop/Round2/Base/r2_base_015w.phpt | 31 + .../interop/Round2/Base/r2_base_016p.phpt | 19 + .../interop/Round2/Base/r2_base_016s.phpt | 19 + .../interop/Round2/Base/r2_base_016w.phpt | 19 + .../interop/Round2/Base/r2_base_017p.phpt | 19 + .../interop/Round2/Base/r2_base_017s.phpt | 19 + .../interop/Round2/Base/r2_base_017w.phpt | 19 + .../interop/Round2/Base/r2_base_018p.phpt | 19 + .../interop/Round2/Base/r2_base_018s.phpt | 19 + .../interop/Round2/Base/r2_base_018w.phpt | 19 + .../interop/Round2/Base/r2_base_019p.phpt | 19 + .../interop/Round2/Base/r2_base_019s.phpt | 19 + .../interop/Round2/Base/r2_base_019w.phpt | 19 + .../interop/Round2/Base/r2_base_020p.phpt | 19 + .../interop/Round2/Base/r2_base_020s.phpt | 19 + .../interop/Round2/Base/r2_base_020w.phpt | 19 + .../interop/Round2/Base/r2_base_021p.phpt | 19 + .../interop/Round2/Base/r2_base_021s.phpt | 19 + .../interop/Round2/Base/r2_base_021w.phpt | 19 + .../interop/Round2/Base/r2_base_022p.phpt | 19 + .../interop/Round2/Base/r2_base_022s.phpt | 19 + .../interop/Round2/Base/r2_base_022w.phpt | 19 + .../interop/Round2/Base/r2_base_023p.phpt | 19 + .../interop/Round2/Base/r2_base_023s.phpt | 19 + .../interop/Round2/Base/r2_base_023w.phpt | 19 + .../interop/Round2/Base/r2_base_024p.phpt | 19 + .../interop/Round2/Base/r2_base_024s.phpt | 19 + .../interop/Round2/Base/r2_base_024w.phpt | 19 + .../tests/interop/Round2/Base/round2_base.inc | 80 + .../interop/Round2/Base/round2_base.wsdl | 332 + .../soap/tests/interop/Round2/Base/skipif.inc | 3 + .../interop/Round2/GroupB/r2_groupB_001p.phpt | 21 + .../interop/Round2/GroupB/r2_groupB_001s.phpt | 26 + .../interop/Round2/GroupB/r2_groupB_001w.phpt | 21 + .../interop/Round2/GroupB/r2_groupB_002p.phpt | 21 + .../interop/Round2/GroupB/r2_groupB_002s.phpt | 24 + .../interop/Round2/GroupB/r2_groupB_002w.phpt | 21 + .../interop/Round2/GroupB/r2_groupB_003p.phpt | 22 + .../interop/Round2/GroupB/r2_groupB_003s.phpt | 31 + .../interop/Round2/GroupB/r2_groupB_003w.phpt | 22 + .../interop/Round2/GroupB/r2_groupB_004p.phpt | 31 + .../interop/Round2/GroupB/r2_groupB_004s.phpt | 31 + .../interop/Round2/GroupB/r2_groupB_004w.phpt | 31 + .../interop/Round2/GroupB/r2_groupB_005p.phpt | 26 + .../interop/Round2/GroupB/r2_groupB_005s.phpt | 31 + .../interop/Round2/GroupB/r2_groupB_005w.phpt | 26 + .../interop/Round2/GroupB/round2_groupB.inc | 37 + .../interop/Round2/GroupB/round2_groupB.wsdl | 192 + .../tests/interop/Round2/GroupB/skipif.inc | 3 + .../Round3/GroupD/imported/import1B.wsdl | 20 + .../Round3/GroupD/imported/import2B.wsdl | 22 + .../Round3/GroupD/imported/import2B.xsd | 12 + .../GroupD/r3_groupD_compound1_001w.phpt | 30 + .../GroupD/r3_groupD_compound1_002w.phpt | 19 + .../GroupD/r3_groupD_compound1_003w.phpt | 19 + .../GroupD/r3_groupD_compound2_001w.phpt | 39 + .../Round3/GroupD/r3_groupD_doclit_001w.phpt | 19 + .../Round3/GroupD/r3_groupD_doclit_002w.phpt | 19 + .../Round3/GroupD/r3_groupD_doclit_003w.phpt | 29 + .../Round3/GroupD/r3_groupD_doclit_004w.phpt | 19 + .../GroupD/r3_groupD_doclitparams_001w.phpt | 19 + .../GroupD/r3_groupD_doclitparams_002w.phpt | 19 + .../GroupD/r3_groupD_doclitparams_003w.phpt | 29 + .../GroupD/r3_groupD_doclitparams_004w.phpt | 19 + .../Round3/GroupD/r3_groupD_emptysa_001w.phpt | 19 + .../Round3/GroupD/r3_groupD_import1_001w.phpt | 19 + .../Round3/GroupD/r3_groupD_import2_001w.phpt | 29 + .../Round3/GroupD/r3_groupD_import3_001w.phpt | 29 + .../Round3/GroupD/r3_groupD_import3_002w.phpt | 30 + .../Round3/GroupD/r3_groupD_rpcenc_001w.phpt | 19 + .../Round3/GroupD/r3_groupD_rpcenc_002w.phpt | 19 + .../Round3/GroupD/r3_groupD_rpcenc_003w.phpt | 29 + .../Round3/GroupD/r3_groupD_rpcenc_004w.phpt | 19 + .../Round3/GroupD/round3_groupD_compound1.inc | 17 + .../GroupD/round3_groupD_compound1.wsdl | 85 + .../Round3/GroupD/round3_groupD_compound2.inc | 12 + .../GroupD/round3_groupD_compound2.wsdl | 65 + .../Round3/GroupD/round3_groupD_doclit.inc | 28 + .../Round3/GroupD/round3_groupD_doclit.wsdl | 135 + .../GroupD/round3_groupD_doclitparams.inc | 29 + .../GroupD/round3_groupD_doclitparams.wsdl | 175 + .../Round3/GroupD/round3_groupD_emptysa.inc | 14 + .../Round3/GroupD/round3_groupD_emptysa.wsdl | 37 + .../Round3/GroupD/round3_groupD_import1.inc | 14 + .../Round3/GroupD/round3_groupD_import1.wsdl | 26 + .../Round3/GroupD/round3_groupD_import2.inc | 14 + .../Round3/GroupD/round3_groupD_import2.wsdl | 26 + .../round3_groupD_import2_absolute.wsdl | 26 + .../Round3/GroupD/round3_groupD_import3.inc | 19 + .../Round3/GroupD/round3_groupD_import3.wsdl | 75 + .../Round3/GroupD/round3_groupD_rpcenc.inc | 28 + .../Round3/GroupD/round3_groupD_rpcenc.wsdl | 126 + .../tests/interop/Round3/GroupD/skipif.inc | 3 + .../Round3/GroupE/r3_groupE_list_001w.phpt | 35 + .../Round3/GroupE/r3_groupE_list_002w.phpt | 42 + .../Round3/GroupE/r3_groupE_list_003w.phpt | 49 + .../Round3/GroupE/r3_groupE_list_004w.phpt | 28 + .../Round3/GroupE/r3_groupE_list_005w.phpt | 71 + .../Round3/GroupE/r3_groupE_list_006w.phpt | 64 + .../Round3/GroupE/round3_groupE_list.inc | 17 + .../Round3/GroupE/round3_groupE_list.wsdl | 61 + .../tests/interop/Round3/GroupE/skipif.inc | 3 + .../Round3/GroupF/r3_groupF_ext_001w.phpt | 19 + .../Round3/GroupF/r3_groupF_extreq_001w.phpt | 15 + .../Round3/GroupF/r3_groupF_headers_001w.phpt | 19 + .../Round3/GroupF/r3_groupF_headers_002w.phpt | 20 + .../Round3/GroupF/r3_groupF_headers_003w.phpt | 20 + .../Round3/GroupF/r3_groupF_headers_004w.phpt | 23 + .../Round3/GroupF/round3_groupF_ext.inc | 14 + .../Round3/GroupF/round3_groupF_ext.wsdl | 72 + .../Round3/GroupF/round3_groupF_extreq.wsdl | 73 + .../Round3/GroupF/round3_groupF_headers.inc | 22 + .../Round3/GroupF/round3_groupF_headers.wsdl | 70 + .../tests/interop/Round3/GroupF/skipif.inc | 3 + .../Round4/GroupG/round4_groupG_dimedoc.inc | 33 + .../Round4/GroupG/round4_groupG_dimedoc.wsdl | 216 + .../Round4/GroupG/round4_groupG_dimerpc.inc | 33 + .../Round4/GroupG/round4_groupG_dimerpc.wsdl | 171 + .../Round4/GroupG/round4_groupG_mimedoc.inc | 25 + .../Round4/GroupG/round4_groupG_mimedoc.wsdl | 185 + .../Round4/GroupG/round4_groupG_mimerpc.inc | 25 + .../Round4/GroupG/round4_groupG_mimerpc.wsdl | 151 + .../tests/interop/Round4/GroupG/skipif.inc | 3 + .../GroupH/r4_groupH_complex_doclit_001w.phpt | 29 + .../GroupH/r4_groupH_complex_doclit_002w.phpt | 35 + .../GroupH/r4_groupH_complex_doclit_003w.phpt | 43 + .../GroupH/r4_groupH_complex_doclit_004w.phpt | 38 + .../GroupH/r4_groupH_complex_doclit_005w.phpt | 38 + .../GroupH/r4_groupH_complex_doclit_006w.phpt | 38 + .../GroupH/r4_groupH_complex_doclit_007w.phpt | 52 + .../GroupH/r4_groupH_complex_doclit_008w.phpt | 52 + .../GroupH/r4_groupH_complex_doclit_009w.phpt | 52 + .../GroupH/r4_groupH_complex_doclit_010w.phpt | 52 + .../GroupH/r4_groupH_complex_rpcenc_001w.phpt | 29 + .../GroupH/r4_groupH_complex_rpcenc_002w.phpt | 28 + .../GroupH/r4_groupH_complex_rpcenc_003w.phpt | 36 + .../GroupH/r4_groupH_complex_rpcenc_004w.phpt | 36 + .../GroupH/r4_groupH_complex_rpcenc_005w.phpt | 36 + .../GroupH/r4_groupH_complex_rpcenc_006w.phpt | 36 + .../GroupH/r4_groupH_complex_rpcenc_007w.phpt | 44 + .../GroupH/r4_groupH_complex_rpcenc_008w.phpt | 44 + .../GroupH/r4_groupH_complex_rpcenc_009w.phpt | 44 + .../GroupH/r4_groupH_complex_rpcenc_010w.phpt | 44 + .../GroupH/r4_groupH_simple_doclit_001w.phpt | 19 + .../GroupH/r4_groupH_simple_doclit_002w.phpt | 19 + .../GroupH/r4_groupH_simple_doclit_003w.phpt | 19 + .../GroupH/r4_groupH_simple_doclit_004w.phpt | 23 + .../GroupH/r4_groupH_simple_doclit_005w.phpt | 23 + .../GroupH/r4_groupH_simple_doclit_006w.phpt | 23 + .../GroupH/r4_groupH_simple_doclit_007w.phpt | 23 + .../GroupH/r4_groupH_simple_doclit_008w.phpt | 24 + .../GroupH/r4_groupH_simple_doclit_009w.phpt | 24 + .../GroupH/r4_groupH_simple_doclit_010w.phpt | 24 + .../GroupH/r4_groupH_simple_doclit_011w.phpt | 24 + .../GroupH/r4_groupH_simple_doclit_012w.phpt | 21 + .../GroupH/r4_groupH_simple_doclit_013w.phpt | 21 + .../GroupH/r4_groupH_simple_doclit_014w.phpt | 21 + .../GroupH/r4_groupH_simple_doclit_015w.phpt | 21 + .../GroupH/r4_groupH_simple_doclit_016w.phpt | 21 + .../GroupH/r4_groupH_simple_doclit_017w.phpt | 21 + .../GroupH/r4_groupH_simple_rpcenc_001w.phpt | 19 + .../GroupH/r4_groupH_simple_rpcenc_002w.phpt | 19 + .../GroupH/r4_groupH_simple_rpcenc_003w.phpt | 19 + .../GroupH/r4_groupH_simple_rpcenc_004w.phpt | 21 + .../GroupH/r4_groupH_simple_rpcenc_005w.phpt | 21 + .../GroupH/r4_groupH_simple_rpcenc_006w.phpt | 21 + .../GroupH/r4_groupH_simple_rpcenc_007w.phpt | 21 + .../GroupH/r4_groupH_simple_rpcenc_008w.phpt | 21 + .../GroupH/r4_groupH_simple_rpcenc_009w.phpt | 21 + .../GroupH/r4_groupH_simple_rpcenc_010w.phpt | 21 + .../GroupH/r4_groupH_simple_rpcenc_011w.phpt | 21 + .../GroupH/r4_groupH_simple_rpcenc_012w.phpt | 19 + .../GroupH/r4_groupH_simple_rpcenc_013w.phpt | 19 + .../GroupH/r4_groupH_simple_rpcenc_014w.phpt | 19 + .../GroupH/r4_groupH_simple_rpcenc_015w.phpt | 19 + .../GroupH/r4_groupH_simple_rpcenc_016w.phpt | 19 + .../GroupH/r4_groupH_simple_rpcenc_017w.phpt | 19 + .../GroupH/r4_groupH_soapfault_001w.phpt | 19 + .../GroupH/r4_groupH_soapfault_002w.phpt | 19 + .../GroupH/r4_groupH_soapfault_003w.phpt | 19 + .../GroupH/r4_groupH_soapfault_004w.phpt | 19 + .../GroupH/round4_groupH_complex_doclit.inc | 38 + .../GroupH/round4_groupH_complex_doclit.wsdl | 329 + .../GroupH/round4_groupH_complex_rpcenc.inc | 38 + .../GroupH/round4_groupH_complex_rpcenc.wsdl | 301 + .../GroupH/round4_groupH_simple_doclit.inc | 56 + .../GroupH/round4_groupH_simple_doclit.wsdl | 418 + .../GroupH/round4_groupH_simple_rpcenc.inc | 56 + .../GroupH/round4_groupH_simple_rpcenc.wsdl | 408 + .../Round4/GroupH/round4_groupH_soapfault.inc | 22 + .../GroupH/round4_groupH_soapfault.wsdl | 81 + .../tests/interop/Round4/GroupH/skipif.inc | 3 + .../Round4/GroupI/r4_groupI_xsd_001w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_002w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_003w.phpt | 21 + .../Round4/GroupI/r4_groupI_xsd_004w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_005w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_006w.phpt | Bin 0 -> 1072 bytes .../Round4/GroupI/r4_groupI_xsd_007w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_008w.phpt | 29 + .../Round4/GroupI/r4_groupI_xsd_009w.phpt | 30 + .../Round4/GroupI/r4_groupI_xsd_010w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_011w.phpt | 21 + .../Round4/GroupI/r4_groupI_xsd_012w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_013w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_014w.phpt | 31 + .../Round4/GroupI/r4_groupI_xsd_015w.phpt | 30 + .../Round4/GroupI/r4_groupI_xsd_016w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_017w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_018w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_019w.phpt | 29 + .../Round4/GroupI/r4_groupI_xsd_020w.phpt | 30 + .../Round4/GroupI/r4_groupI_xsd_021w.phpt | 23 + .../Round4/GroupI/r4_groupI_xsd_022w.phpt | 22 + .../Round4/GroupI/r4_groupI_xsd_023w.phpt | 37 + .../Round4/GroupI/r4_groupI_xsd_024w.phpt | 31 + .../Round4/GroupI/r4_groupI_xsd_025w.phpt | 30 + .../Round4/GroupI/r4_groupI_xsd_026w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_027w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_028w.phpt | 29 + .../Round4/GroupI/r4_groupI_xsd_029w.phpt | 19 + .../Round4/GroupI/r4_groupI_xsd_030w.phpt | 20 + .../Round4/GroupI/r4_groupI_xsd_031w.phpt | 20 + .../Round4/GroupI/r4_groupI_xsd_032w.phpt | 22 + .../Round4/GroupI/r4_groupI_xsd_033w.phpt | 22 + .../Round4/GroupI/r4_groupI_xsd_034w.phpt | 20 + .../Round4/GroupI/r4_groupI_xsd_035w.phpt | 22 + .../Round4/GroupI/round4_groupI_xsd.inc | 198 + .../Round4/GroupI/round4_groupI_xsd.wsdl | 1113 + .../tests/interop/Round4/GroupI/skipif.inc | 3 + .../ext/soap/tests/schema/schema001.phpt | 20 + .../ext/soap/tests/schema/schema002.phpt | 23 + .../ext/soap/tests/schema/schema003.phpt | 23 + .../ext/soap/tests/schema/schema004.phpt | 22 + .../ext/soap/tests/schema/schema005.phpt | 24 + .../ext/soap/tests/schema/schema006.phpt | 25 + .../ext/soap/tests/schema/schema007.phpt | 25 + .../ext/soap/tests/schema/schema008.phpt | 27 + .../ext/soap/tests/schema/schema009.phpt | 20 + .../ext/soap/tests/schema/schema010.phpt | 20 + .../ext/soap/tests/schema/schema011.phpt | 24 + .../ext/soap/tests/schema/schema012.phpt | 24 + .../ext/soap/tests/schema/schema013.phpt | 20 + .../ext/soap/tests/schema/schema014.phpt | 22 + .../ext/soap/tests/schema/schema015.phpt | 30 + .../ext/soap/tests/schema/schema016.phpt | 32 + .../ext/soap/tests/schema/schema017.phpt | 29 + .../ext/soap/tests/schema/schema018.phpt | 27 + .../ext/soap/tests/schema/schema019.phpt | 27 + .../ext/soap/tests/schema/schema020.phpt | 29 + .../ext/soap/tests/schema/schema021.phpt | 24 + .../ext/soap/tests/schema/schema022.phpt | 26 + .../ext/soap/tests/schema/schema023.phpt | 29 + .../ext/soap/tests/schema/schema024.phpt | 31 + .../ext/soap/tests/schema/schema025.phpt | 30 + .../ext/soap/tests/schema/schema026.phpt | 31 + .../ext/soap/tests/schema/schema027.phpt | 35 + .../ext/soap/tests/schema/schema028.phpt | 36 + .../ext/soap/tests/schema/schema029.phpt | 38 + .../ext/soap/tests/schema/schema030.phpt | 28 + .../ext/soap/tests/schema/schema031.phpt | 28 + .../ext/soap/tests/schema/schema032.phpt | 26 + .../ext/soap/tests/schema/schema033.phpt | 36 + .../ext/soap/tests/schema/schema034.phpt | 37 + .../ext/soap/tests/schema/schema035.phpt | 38 + .../ext/soap/tests/schema/schema036.phpt | 37 + .../ext/soap/tests/schema/schema037.phpt | 28 + .../ext/soap/tests/schema/schema038.phpt | 29 + .../ext/soap/tests/schema/schema039.phpt | 31 + .../ext/soap/tests/schema/schema040.phpt | 32 + .../ext/soap/tests/schema/schema041.phpt | 31 + .../ext/soap/tests/schema/schema042.phpt | 29 + .../ext/soap/tests/schema/schema043.phpt | 38 + .../ext/soap/tests/schema/schema044.phpt | 29 + .../ext/soap/tests/schema/schema045.phpt | 36 + .../ext/soap/tests/schema/schema046.phpt | 38 + .../ext/soap/tests/schema/schema047.phpt | 34 + .../ext/soap/tests/schema/schema048.phpt | 36 + .../ext/soap/tests/schema/schema049.phpt | 35 + .../ext/soap/tests/schema/schema050.phpt | 28 + .../ext/soap/tests/schema/schema051.phpt | 33 + .../ext/soap/tests/schema/schema052.phpt | 28 + .../ext/soap/tests/schema/schema053.phpt | 26 + .../ext/soap/tests/schema/schema054.phpt | 23 + .../ext/soap/tests/schema/schema055.phpt | 30 + .../ext/soap/tests/schema/schema056.phpt | 29 + .../ext/soap/tests/schema/schema057.phpt | 31 + .../ext/soap/tests/schema/schema058.phpt | 30 + .../ext/soap/tests/schema/schema059.phpt | 31 + .../ext/soap/tests/schema/schema060.phpt | 36 + .../ext/soap/tests/schema/schema061.phpt | 38 + .../ext/soap/tests/schema/schema062.phpt | 29 + .../ext/soap/tests/schema/schema063.phpt | 18 + .../ext/soap/tests/schema/schema064.phpt | 57 + .../ext/soap/tests/schema/schema065.phpt | 26 + .../ext/soap/tests/schema/schema066.phpt | 26 + .../ext/soap/tests/schema/schema067.phpt | 26 + .../ext/soap/tests/schema/schema068.phpt | 18 + .../ext/soap/tests/schema/schema069.phpt | 27 + .../ext/soap/tests/schema/schema070.phpt | 29 + .../ext/soap/tests/schema/schema071.phpt | 23 + .../ext/soap/tests/schema/schema072.phpt | 25 + .../ext/soap/tests/schema/schema073.phpt | 24 + .../ext/soap/tests/schema/schema074.phpt | 29 + .../ext/soap/tests/schema/schema075.phpt | 30 + .../ext/soap/tests/schema/schema076.phpt | 30 + .../ext/soap/tests/schema/schema077.phpt | 30 + .../ext/soap/tests/schema/schema078.phpt | 32 + .../ext/soap/tests/schema/schema079.phpt | 32 + .../ext/soap/tests/schema/schema080.phpt | 32 + .../ext/soap/tests/schema/schema081.phpt | 29 + .../ext/soap/tests/schema/schema082.phpt | 31 + .../ext/soap/tests/schema/schema083.phpt | 30 + .../ext/soap/tests/schema/schema084.phpt | 31 + .../ext/soap/tests/schema/schema085.phpt | 45 + .../ext/soap/tests/schema/skipif.inc | 3 + .../ext/soap/tests/schema/test_schema.inc | 77 + .../php-5.2.5/ext/soap/tests/server001.phpt | 33 + .../php-5.2.5/ext/soap/tests/server002.phpt | 37 + .../php-5.2.5/ext/soap/tests/server003.phpt | 32 + .../php-5.2.5/ext/soap/tests/server004.phpt | 40 + .../php-5.2.5/ext/soap/tests/server005.phpt | 36 + .../php-5.2.5/ext/soap/tests/server006.phpt | 42 + .../php-5.2.5/ext/soap/tests/server007.phpt | 26 + .../php-5.2.5/ext/soap/tests/server008.phpt | 29 + .../php-5.2.5/ext/soap/tests/server009.phpt | 66 + .../php-5.2.5/ext/soap/tests/server010.phpt | 61 + .../php-5.2.5/ext/soap/tests/server011.phpt | 25 + .../php-5.2.5/ext/soap/tests/server012.phpt | 20 + .../php-5.2.5/ext/soap/tests/server013.phpt | 44 + .../php-5.2.5/ext/soap/tests/server014.phpt | 37 + .../php-5.2.5/ext/soap/tests/server015.phpt | 33 + .../php-5.2.5/ext/soap/tests/server016.phpt | 34 + .../php-5.2.5/ext/soap/tests/server017.phpt | 34 + .../php-5.2.5/ext/soap/tests/server018.phpt | 34 + .../php-5.2.5/ext/soap/tests/server019.phpt | 38 + .../php-5.2.5/ext/soap/tests/server020.phpt | 39 + .../php-5.2.5/ext/soap/tests/server021.phpt | 40 + .../php-5.2.5/ext/soap/tests/server022.phpt | 41 + .../php-5.2.5/ext/soap/tests/server023.phpt | 37 + .../php-5.2.5/ext/soap/tests/server024.phpt | 49 + .../php-5.2.5/ext/soap/tests/server025.phpt | 46 + .../php-5.2.5/ext/soap/tests/server025.wsdl | 55 + .../php-5.2.5/ext/soap/tests/server026.phpt | 37 + .../php-5.2.5/ext/soap/tests/server027.phpt | 30 + .../php-5.2.5/ext/soap/tests/server028.phpt | 41 + .../php-5.2.5/ext/soap/tests/server029.phpt | 55 + .../php-5.2.5/ext/soap/tests/setheaders.phpt | 38 + .../tests/php-5.2.5/ext/soap/tests/skipif.inc | 3 + .../php-5.2.5/ext/soap/tests/soap12/T01.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T02.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T03.phpt | 22 + .../php-5.2.5/ext/soap/tests/soap12/T04.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T05.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T10.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T11.phpt | 24 + .../php-5.2.5/ext/soap/tests/soap12/T12.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T13.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T14.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T15.phpt | 24 + .../php-5.2.5/ext/soap/tests/soap12/T19.phpt | 24 + .../php-5.2.5/ext/soap/tests/soap12/T22.phpt | 24 + .../php-5.2.5/ext/soap/tests/soap12/T23.phpt | 24 + .../php-5.2.5/ext/soap/tests/soap12/T24.phpt | 21 + .../php-5.2.5/ext/soap/tests/soap12/T25.phpt | 22 + .../php-5.2.5/ext/soap/tests/soap12/T26.phpt | 21 + .../php-5.2.5/ext/soap/tests/soap12/T27.phpt | 29 + .../php-5.2.5/ext/soap/tests/soap12/T28.phpt | 22 + .../php-5.2.5/ext/soap/tests/soap12/T29.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T30.phpt | 20 + .../php-5.2.5/ext/soap/tests/soap12/T31.phpt | 22 + .../php-5.2.5/ext/soap/tests/soap12/T32.phpt | 25 + .../php-5.2.5/ext/soap/tests/soap12/T33.phpt | 20 + .../php-5.2.5/ext/soap/tests/soap12/T34.phpt | 24 + .../php-5.2.5/ext/soap/tests/soap12/T35.phpt | 24 + .../php-5.2.5/ext/soap/tests/soap12/T36.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T37.phpt | 23 + .../ext/soap/tests/soap12/T38_1.phpt | 27 + .../ext/soap/tests/soap12/T38_2.phpt | 27 + .../php-5.2.5/ext/soap/tests/soap12/T39.phpt | 22 + .../php-5.2.5/ext/soap/tests/soap12/T40.phpt | 26 + .../php-5.2.5/ext/soap/tests/soap12/T41.phpt | 30 + .../php-5.2.5/ext/soap/tests/soap12/T42.phpt | 41 + .../php-5.2.5/ext/soap/tests/soap12/T43.phpt | 30 + .../php-5.2.5/ext/soap/tests/soap12/T44.phpt | 27 + .../php-5.2.5/ext/soap/tests/soap12/T45.phpt | 35 + .../php-5.2.5/ext/soap/tests/soap12/T46.phpt | 36 + .../php-5.2.5/ext/soap/tests/soap12/T47.phpt | 31 + .../php-5.2.5/ext/soap/tests/soap12/T48.phpt | 29 + .../php-5.2.5/ext/soap/tests/soap12/T49.phpt | 29 + .../php-5.2.5/ext/soap/tests/soap12/T50.phpt | 29 + .../php-5.2.5/ext/soap/tests/soap12/T51.phpt | 27 + .../php-5.2.5/ext/soap/tests/soap12/T52.phpt | 25 + .../php-5.2.5/ext/soap/tests/soap12/T53.phpt | 25 + .../php-5.2.5/ext/soap/tests/soap12/T54.phpt | 25 + .../php-5.2.5/ext/soap/tests/soap12/T55.phpt | 25 + .../php-5.2.5/ext/soap/tests/soap12/T56.phpt | 34 + .../php-5.2.5/ext/soap/tests/soap12/T57.phpt | 32 + .../php-5.2.5/ext/soap/tests/soap12/T58.phpt | 28 + .../php-5.2.5/ext/soap/tests/soap12/T59.phpt | 28 + .../php-5.2.5/ext/soap/tests/soap12/T60.phpt | 29 + .../php-5.2.5/ext/soap/tests/soap12/T61.phpt | 28 + .../php-5.2.5/ext/soap/tests/soap12/T63.phpt | 25 + .../php-5.2.5/ext/soap/tests/soap12/T64.phpt | 24 + .../php-5.2.5/ext/soap/tests/soap12/T65.phpt | 26 + .../php-5.2.5/ext/soap/tests/soap12/T66.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T67.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T68.phpt | 32 + .../php-5.2.5/ext/soap/tests/soap12/T69.phpt | 19 + .../php-5.2.5/ext/soap/tests/soap12/T70.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T71.phpt | 24 + .../php-5.2.5/ext/soap/tests/soap12/T72.phpt | 22 + .../php-5.2.5/ext/soap/tests/soap12/T73.phpt | 26 + .../php-5.2.5/ext/soap/tests/soap12/T74.phpt | 28 + .../php-5.2.5/ext/soap/tests/soap12/T75.phpt | 28 + .../ext/soap/tests/soap12/T76_1.phpt | 25 + .../ext/soap/tests/soap12/T76_2.phpt | 32 + .../ext/soap/tests/soap12/T77_1.phpt | 25 + .../ext/soap/tests/soap12/T77_2.phpt | 24 + .../ext/soap/tests/soap12/T77_3.phpt | 27 + .../php-5.2.5/ext/soap/tests/soap12/T78.phpt | 23 + .../php-5.2.5/ext/soap/tests/soap12/T80.phpt | 19 + .../ext/soap/tests/soap12/skipif.inc | 3 + .../ext/soap/tests/soap12/soap12-test.inc | 130 + .../ext/soap/tests/soap12/soap12-test.wsdl | 771 + phpt/tests/php-5.2.5/ext/soap/tests/test.wsdl | 55 + .../ext/soap/tests/transport001.phpt | 36 + .../php-5.2.5/ext/soap/tests/typemap001.phpt | 60 + .../php-5.2.5/ext/soap/tests/typemap002.phpt | 56 + .../php-5.2.5/ext/soap/tests/typemap003.phpt | 54 + .../php-5.2.5/ext/soap/tests/typemap004.phpt | 41 + .../php-5.2.5/ext/soap/tests/typemap005.phpt | 61 + .../php-5.2.5/ext/soap/tests/typemap006.phpt | 57 + .../php-5.2.5/ext/soap/tests/typemap007.phpt | 56 + .../php-5.2.5/ext/soap/tests/typemap008.phpt | 43 + .../php-5.2.5/ext/soap/tests/typemap009.phpt | 56 + .../php-5.2.5/ext/soap/tests/typemap010.phpt | 56 + .../php-5.2.5/ext/soap/tests/typemap011.phpt | 49 + .../php-5.2.5/ext/soap/tests/typemap012.phpt | 45 + .../php-5.2.5/ext/soap/tests/typemap013.phpt | 56 + .../php-5.2.5/ext/sockets/tests/ipv4loop.phpt | 49 + .../php-5.2.5/ext/sockets/tests/ipv6loop.phpt | 52 + .../spl/examples/tests/dualiterator_001.phpt | 48 + .../ext/spl/examples/tests/examples.inc | 23 + phpt/tests/php-5.2.5/ext/spl/tests/.htaccess | 3 + .../php-5.2.5/ext/spl/tests/array_001.phpt | 103 + .../php-5.2.5/ext/spl/tests/array_002.phpt | 37 + .../php-5.2.5/ext/spl/tests/array_003.phpt | 61 + .../php-5.2.5/ext/spl/tests/array_004.phpt | 143 + .../php-5.2.5/ext/spl/tests/array_005.phpt | 93 + .../php-5.2.5/ext/spl/tests/array_006.phpt | 32 + .../php-5.2.5/ext/spl/tests/array_007.phpt | 65 + .../php-5.2.5/ext/spl/tests/array_008.phpt | 62 + .../php-5.2.5/ext/spl/tests/array_009.phpt | 26 + .../php-5.2.5/ext/spl/tests/array_009a.phpt | 39 + .../php-5.2.5/ext/spl/tests/array_010.phpt | 146 + .../php-5.2.5/ext/spl/tests/array_011.phpt | 37 + .../php-5.2.5/ext/spl/tests/array_012.phpt | 65 + .../php-5.2.5/ext/spl/tests/array_013.phpt | 81 + .../php-5.2.5/ext/spl/tests/array_014.phpt | 61 + .../php-5.2.5/ext/spl/tests/array_015.phpt | 87 + .../php-5.2.5/ext/spl/tests/array_016.phpt | 34 + .../php-5.2.5/ext/spl/tests/array_017.phpt | 649 + .../php-5.2.5/ext/spl/tests/array_018.phpt | 42 + .../php-5.2.5/ext/spl/tests/array_019.phpt | 32 + .../php-5.2.5/ext/spl/tests/array_020.phpt | 66 + .../php-5.2.5/ext/spl/tests/array_021.phpt | 33 + .../php-5.2.5/ext/spl/tests/array_022.phpt | 72 + .../php-5.2.5/ext/spl/tests/bug28822.phpt | 18 + .../php-5.2.5/ext/spl/tests/bug31185.phpt | 63 + .../php-5.2.5/ext/spl/tests/bug31346.phpt | 21 + .../php-5.2.5/ext/spl/tests/bug31348.phpt | 17 + .../php-5.2.5/ext/spl/tests/bug31926.phpt | 18 + .../php-5.2.5/ext/spl/tests/bug32134.phpt | 50 + .../php-5.2.5/ext/spl/tests/bug32394.phpt | 19 + .../php-5.2.5/ext/spl/tests/bug33136.phpt | 74 + .../php-5.2.5/ext/spl/tests/bug34548.phpt | 40 + .../php-5.2.5/ext/spl/tests/bug36258.phpt | 21 + .../php-5.2.5/ext/spl/tests/bug36287.phpt | 40 + .../php-5.2.5/ext/spl/tests/bug36825.phpt | 33 + .../php-5.2.5/ext/spl/tests/bug36941.phpt | 48 + .../php-5.2.5/ext/spl/tests/bug37457.phpt | 82 + .../php-5.2.5/ext/spl/tests/bug38325.phpt | 11 + .../php-5.2.5/ext/spl/tests/bug40036.phpt | 34 + .../php-5.2.5/ext/spl/tests/bug40091.phpt | 39 + .../php-5.2.5/ext/spl/tests/bug40442.phpt | 12 + .../php-5.2.5/ext/spl/tests/bug40872.phpt | 30 + .../php-5.2.5/ext/spl/tests/bug41691.phpt | 31 + .../php-5.2.5/ext/spl/tests/bug41692.phpt | 40 + .../php-5.2.5/ext/spl/tests/bug42259.phpt | 51 + .../php-5.2.5/ext/spl/tests/bug42364.phpt | 18 + .../php-5.2.5/ext/spl/tests/bug42654.phpt | 134 + .../php-5.2.5/ext/spl/tests/bug42703.phpt | 41 + .../php-5.2.5/ext/spl/tests/dit_001.phpt | 19 + .../ext/spl/tests/fileobject_001.phpt | 90 + .../ext/spl/tests/fileobject_001a.txt | 6 + .../ext/spl/tests/fileobject_001b.txt | 6 + .../ext/spl/tests/fileobject_002.phpt | 124 + .../ext/spl/tests/fileobject_003.phpt | 101 + .../php-5.2.5/ext/spl/tests/iterator_001.phpt | 173 + .../php-5.2.5/ext/spl/tests/iterator_002.phpt | 57 + .../php-5.2.5/ext/spl/tests/iterator_003.phpt | 97 + .../php-5.2.5/ext/spl/tests/iterator_004.phpt | 144 + .../php-5.2.5/ext/spl/tests/iterator_005.phpt | 54 + .../php-5.2.5/ext/spl/tests/iterator_006.phpt | 24 + .../php-5.2.5/ext/spl/tests/iterator_007.phpt | 168 + .../php-5.2.5/ext/spl/tests/iterator_008.phpt | 91 + .../php-5.2.5/ext/spl/tests/iterator_009.phpt | 47 + .../php-5.2.5/ext/spl/tests/iterator_010.phpt | 20 + .../php-5.2.5/ext/spl/tests/iterator_011.phpt | 53 + .../php-5.2.5/ext/spl/tests/iterator_012.phpt | 35 + .../php-5.2.5/ext/spl/tests/iterator_013.phpt | 68 + .../php-5.2.5/ext/spl/tests/iterator_014.phpt | 140 + .../php-5.2.5/ext/spl/tests/iterator_015.phpt | 64 + .../php-5.2.5/ext/spl/tests/iterator_016.phpt | 78 + .../php-5.2.5/ext/spl/tests/iterator_017.phpt | 20 + .../php-5.2.5/ext/spl/tests/iterator_018.phpt | 53 + .../php-5.2.5/ext/spl/tests/iterator_019.phpt | 35 + .../php-5.2.5/ext/spl/tests/iterator_020.phpt | 68 + .../php-5.2.5/ext/spl/tests/iterator_021.phpt | 182 + .../php-5.2.5/ext/spl/tests/iterator_022.phpt | 188 + .../php-5.2.5/ext/spl/tests/iterator_023.phpt | 195 + .../php-5.2.5/ext/spl/tests/iterator_024.phpt | 51 + .../php-5.2.5/ext/spl/tests/iterator_025.phpt | 94 + .../php-5.2.5/ext/spl/tests/iterator_026.phpt | 36 + .../php-5.2.5/ext/spl/tests/iterator_027.phpt | 85 + .../php-5.2.5/ext/spl/tests/iterator_028.phpt | 114 + .../php-5.2.5/ext/spl/tests/iterator_029.phpt | 40 + .../php-5.2.5/ext/spl/tests/iterator_030.phpt | 46 + .../php-5.2.5/ext/spl/tests/iterator_031.phpt | 118 + .../php-5.2.5/ext/spl/tests/iterator_032.phpt | 52 + .../php-5.2.5/ext/spl/tests/iterator_033.phpt | 46 + .../php-5.2.5/ext/spl/tests/iterator_034.phpt | 190 + .../php-5.2.5/ext/spl/tests/iterator_035.phpt | 17 + .../php-5.2.5/ext/spl/tests/iterator_036.phpt | 24 + .../php-5.2.5/ext/spl/tests/iterator_037.phpt | 133 + .../php-5.2.5/ext/spl/tests/iterator_038.phpt | 21 + .../php-5.2.5/ext/spl/tests/iterator_039.phpt | 123 + .../php-5.2.5/ext/spl/tests/iterator_040.phpt | 49 + .../php-5.2.5/ext/spl/tests/iterator_041.phpt | 119 + .../ext/spl/tests/iterator_041a.phpt | 109 + .../ext/spl/tests/iterator_041b.phpt | 107 + .../php-5.2.5/ext/spl/tests/iterator_042.phpt | 104 + .../php-5.2.5/ext/spl/tests/iterator_043.phpt | 20 + .../php-5.2.5/ext/spl/tests/iterator_044.phpt | 169 + .../php-5.2.5/ext/spl/tests/iterator_045.phpt | 171 + .../php-5.2.5/ext/spl/tests/iterator_046.phpt | 53 + .../php-5.2.5/ext/spl/tests/iterator_047.phpt | 119 + .../php-5.2.5/ext/spl/tests/iterator_048.phpt | 38 + .../php-5.2.5/ext/spl/tests/iterator_049.phpt | 24 + .../ext/spl/tests/iterator_049b.phpt | Bin 0 -> 616 bytes .../php-5.2.5/ext/spl/tests/iterator_050.phpt | 93 + .../php-5.2.5/ext/spl/tests/iterator_051.phpt | 95 + .../php-5.2.5/ext/spl/tests/iterator_052.phpt | 314 + .../php-5.2.5/ext/spl/tests/iterator_053.phpt | 314 + .../php-5.2.5/ext/spl/tests/iterator_054.phpt | 84 + .../php-5.2.5/ext/spl/tests/iterator_055.phpt | 61 + .../php-5.2.5/ext/spl/tests/observer_001.phpt | 118 + .../php-5.2.5/ext/spl/tests/observer_002.phpt | 201 + .../php-5.2.5/ext/spl/tests/observer_003.phpt | 60 + .../php-5.2.5/ext/spl/tests/observer_004.phpt | 78 + .../php-5.2.5/ext/spl/tests/observer_005.phpt | 144 + .../php-5.2.5/ext/spl/tests/spl_001.phpt | 36 + .../php-5.2.5/ext/spl/tests/spl_002.phpt | 24 + .../php-5.2.5/ext/spl/tests/spl_003.phpt | 76 + .../php-5.2.5/ext/spl/tests/spl_004.phpt | 86 + .../php-5.2.5/ext/spl/tests/spl_005.phpt | 23 + .../php-5.2.5/ext/spl/tests/spl_006.phpt | 41 + .../php-5.2.5/ext/spl/tests/spl_007.phpt | 26 + .../ext/spl/tests/spl_autoload_001.phpt | 138 + .../ext/spl/tests/spl_autoload_002.phpt | 71 + .../ext/spl/tests/spl_autoload_003.phpt | 46 + .../ext/spl/tests/spl_autoload_004.phpt | 45 + .../ext/spl/tests/spl_autoload_005.phpt | 57 + .../ext/spl/tests/spl_autoload_006.phpt | 39 + .../ext/spl/tests/spl_autoload_007.phpt | 140 + .../ext/spl/tests/spl_autoload_008.phpt | 131 + .../ext/spl/tests/spl_autoload_009.phpt | 28 + .../php-5.2.5/ext/spl/tests/sxe_001.phpt | 64 + .../php-5.2.5/ext/spl/tests/sxe_002.phpt | 77 + .../php-5.2.5/ext/spl/tests/sxe_003.phpt | 79 + .../php-5.2.5/ext/spl/tests/sxe_004.phpt | 147 + .../php-5.2.5/ext/spl/tests/sxe_005.phpt | 46 + phpt/tests/php-5.2.5/ext/spl/tests/testclass | 5 + .../ext/spl/tests/testclass.class.inc | 9 + .../php-5.2.5/ext/spl/tests/testclass.inc | 5 + .../php-5.2.5/ext/spl/tests/testclass.php.inc | 5 + .../php-5.2.5/ext/sqlite/tests/blankdb.inc | 3 + .../php-5.2.5/ext/sqlite/tests/blankdb_oo.inc | 3 + .../php-5.2.5/ext/sqlite/tests/bug26911.phpt | 12 + .../php-5.2.5/ext/sqlite/tests/bug28112.phpt | 16 + .../php-5.2.5/ext/sqlite/tests/bug35248.phpt | 15 + .../php-5.2.5/ext/sqlite/tests/bug38759.phpt | 18 + .../ext/sqlite/tests/pdo/common.phpt | 12 + .../ext/sqlite/tests/sqlite_001.phpt | 16 + .../ext/sqlite/tests/sqlite_002.phpt | 32 + .../ext/sqlite/tests/sqlite_003.phpt | 52 + .../ext/sqlite/tests/sqlite_004.phpt | 49 + .../ext/sqlite/tests/sqlite_005.phpt | 50 + .../ext/sqlite/tests/sqlite_006.phpt | 55 + .../ext/sqlite/tests/sqlite_007.phpt | 52 + .../ext/sqlite/tests/sqlite_008.phpt | 46 + .../ext/sqlite/tests/sqlite_009.phpt | 46 + .../ext/sqlite/tests/sqlite_010.phpt | 81 + .../ext/sqlite/tests/sqlite_011.phpt | 34 + .../ext/sqlite/tests/sqlite_012.phpt | 38 + .../ext/sqlite/tests/sqlite_013.phpt | 78 + .../ext/sqlite/tests/sqlite_014.phpt | 120 + .../ext/sqlite/tests/sqlite_015.phpt | 49 + .../ext/sqlite/tests/sqlite_016.phpt | 45 + .../ext/sqlite/tests/sqlite_017.phpt | 33 + .../ext/sqlite/tests/sqlite_018.phpt | 14 + .../ext/sqlite/tests/sqlite_019.phpt | 47 + .../ext/sqlite/tests/sqlite_022.phpt | 101 + .../ext/sqlite/tests/sqlite_023.phpt | 105 + .../ext/sqlite/tests/sqlite_024.phpt | 76 + .../ext/sqlite/tests/sqlite_025.phpt | 38 + .../ext/sqlite/tests/sqlite_026.phpt | 27 + .../ext/sqlite/tests/sqlite_027.phpt | 15 + .../ext/sqlite/tests/sqlite_oo_001.phpt | 17 + .../ext/sqlite/tests/sqlite_oo_002.phpt | 41 + .../ext/sqlite/tests/sqlite_oo_003.phpt | 51 + .../ext/sqlite/tests/sqlite_oo_008.phpt | 43 + .../ext/sqlite/tests/sqlite_oo_009.phpt | 43 + .../ext/sqlite/tests/sqlite_oo_010.phpt | 44 + .../ext/sqlite/tests/sqlite_oo_011.phpt | 33 + .../ext/sqlite/tests/sqlite_oo_012.phpt | 35 + .../ext/sqlite/tests/sqlite_oo_013.phpt | 75 + .../ext/sqlite/tests/sqlite_oo_014.phpt | 118 + .../ext/sqlite/tests/sqlite_oo_015.phpt | 47 + .../ext/sqlite/tests/sqlite_oo_016.phpt | 42 + .../ext/sqlite/tests/sqlite_oo_020.phpt | 66 + .../ext/sqlite/tests/sqlite_oo_021.phpt | 48 + .../ext/sqlite/tests/sqlite_oo_022.phpt | 98 + .../ext/sqlite/tests/sqlite_oo_024.phpt | 74 + .../ext/sqlite/tests/sqlite_oo_025.phpt | 103 + .../ext/sqlite/tests/sqlite_oo_026.phpt | 56 + .../ext/sqlite/tests/sqlite_oo_027.phpt | 42 + .../ext/sqlite/tests/sqlite_oo_028.phpt | 25 + .../ext/sqlite/tests/sqlite_oo_029.phpt | 53 + .../ext/sqlite/tests/sqlite_oo_030.phpt | 44 + .../ext/sqlite/tests/sqlite_spl_001.phpt | 125 + .../ext/sqlite/tests/sqlite_spl_002.phpt | 29 + .../ext/sqlite/tests/sqlite_spl_003.phpt | 28 + .../ext/standard/tests/array/001.phpt | 157 + .../ext/standard/tests/array/002.phpt | 644 + .../ext/standard/tests/array/003.phpt | 104 + .../ext/standard/tests/array/004.phpt | 59 + .../ext/standard/tests/array/005.phpt | 291 + .../ext/standard/tests/array/006.phpt | 49 + .../ext/standard/tests/array/007.phpt | 627 + .../ext/standard/tests/array/008.phpt | 310 + .../ext/standard/tests/array/009.phpt | 714 + .../tests/array/array_change_key_case.phpt | 817 + .../array/array_change_key_case_errors.phpt | 28 + .../array_change_key_case_variation.phpt | 60 + .../ext/standard/tests/array/array_chunk.phpt | 5326 ++ .../standard/tests/array/array_chunk2.phpt | 146 + .../standard/tests/array/array_combine.phpt | 122 + .../tests/array/array_count_values.phpt | 95 + .../tests/array/array_count_values2.phpt | 43 + .../standard/tests/array/array_diff_1.phpt | 15 + .../tests/array/array_diff_assoc.phpt | 49 + .../standard/tests/array/array_diff_key.phpt | 250 + .../standard/tests/array/array_diff_key2.phpt | 44 + .../ext/standard/tests/array/array_fill.phpt | 366 + .../tests/array/array_fill_basic.phpt | 97 + .../tests/array/array_fill_error.phpt | 61 + .../standard/tests/array/array_fill_keys.phpt | 44 + .../tests/array/array_fill_object.phpt | 432 + .../tests/array/array_fill_variation1.phpt | 235 + .../array/array_fill_variation1_64bit.phpt | 235 + .../tests/array/array_fill_variation2.phpt | 213 + .../tests/array/array_fill_variation3.phpt | 110 + .../tests/array/array_fill_variation4.phpt | 168 + .../tests/array/array_fill_variation5.phpt | 291 + .../standard/tests/array/array_filter.phpt | 93 + .../tests/array/array_filter_basic.phpt | 55 + .../tests/array/array_filter_error.phpt | 50 + .../tests/array/array_filter_object.phpt | 155 + .../tests/array/array_filter_variation1.phpt | 195 + .../tests/array/array_filter_variation2.phpt | 184 + .../tests/array/array_filter_variation3.phpt | 216 + .../tests/array/array_filter_variation4.phpt | 97 + .../tests/array/array_filter_variation5.phpt | 109 + .../tests/array/array_filter_variation6.phpt | 94 + .../tests/array/array_filter_variation7.phpt | 80 + .../tests/array/array_filter_variation8.phpt | 151 + .../tests/array/array_filter_variation9.phpt | 72 + .../ext/standard/tests/array/array_flip.phpt | 58 + .../tests/array/array_flip_basic.phpt | 71 + .../tests/array/array_flip_error.phpt | 34 + .../tests/array/array_flip_variation1.phpt | 178 + .../tests/array/array_flip_variation2.phpt | Bin 0 -> 2306 bytes .../tests/array/array_flip_variation3.phpt | Bin 0 -> 2978 bytes .../tests/array/array_flip_variation4.phpt | 90 + .../tests/array/array_flip_variation5.phpt | 82 + .../tests/array/array_intersect_1.phpt | 660 + .../array/array_intersect_assoc_basic.phpt | 69 + .../array/array_intersect_assoc_error.phpt | 36 + .../array_intersect_assoc_variation1.phpt | 281 + .../array_intersect_assoc_variation10.phpt | 54 + .../array_intersect_assoc_variation2.phpt | 282 + .../array_intersect_assoc_variation3.phpt | 243 + .../array_intersect_assoc_variation4.phpt | 254 + .../array_intersect_assoc_variation5.phpt | 197 + .../array_intersect_assoc_variation6.phpt | 197 + .../array_intersect_assoc_variation7.phpt | 212 + .../array_intersect_assoc_variation8.phpt | 212 + .../array_intersect_assoc_variation9.phpt | 128 + .../tests/array/array_intersect_basic.phpt | 80 + .../tests/array/array_intersect_error.phpt | 35 + .../tests/array/array_intersect_key.phpt | 209 + .../array/array_intersect_variation1.phpt | 280 + .../array/array_intersect_variation10.phpt | 53 + .../array/array_intersect_variation2.phpt | 281 + .../array/array_intersect_variation3.phpt | 342 + .../array/array_intersect_variation4.phpt | 349 + .../array/array_intersect_variation5.phpt | 214 + .../array/array_intersect_variation6.phpt | 214 + .../array/array_intersect_variation7.phpt | 211 + .../array/array_intersect_variation8.phpt | 219 + .../array/array_intersect_variation9.phpt | 163 + .../tests/array/array_key_exists.phpt | 292 + .../tests/array/array_keys_error.phpt | 42 + .../tests/array/array_keys_variation_001.phpt | 147 + .../tests/array/array_keys_variation_002.phpt | 52 + .../array/array_keys_variation_002_64bit.phpt | 56 + .../tests/array/array_keys_variation_003.phpt | 102 + .../tests/array/array_keys_variation_004.phpt | 68 + .../tests/array/array_keys_variation_005.phpt | 40 + .../ext/standard/tests/array/array_map.phpt | 423 + .../standard/tests/array/array_map_001.phpt | 23 + .../ext/standard/tests/array/array_pad.phpt | 101 + .../ext/standard/tests/array/array_pop.phpt | 220 + .../tests/array/array_pop_errors.phpt | 64 + .../tests/array/array_pop_variation.phpt | 55 + .../ext/standard/tests/array/array_rand.phpt | 51 + .../tests/array/array_rand_basic1.phpt | 52 + .../tests/array/array_rand_basic2.phpt | 57 + .../tests/array/array_rand_error.phpt | 37 + .../tests/array/array_rand_variation1.phpt | 216 + .../tests/array/array_rand_variation2.phpt | 214 + .../tests/array/array_rand_variation3.phpt | 149 + .../tests/array/array_rand_variation4.phpt | 167 + .../tests/array/array_rand_variation5.phpt | 74 + .../tests/array/array_rand_variation6.phpt | 103 + .../tests/array/array_reverse_basic1.phpt | 72 + .../tests/array/array_reverse_basic2.phpt | 60 + .../tests/array/array_reverse_error.phpt | 40 + .../tests/array/array_reverse_variation1.phpt | 340 + .../tests/array/array_reverse_variation2.phpt | 491 + .../tests/array/array_reverse_variation3.phpt | 602 + .../tests/array/array_reverse_variation4.phpt | 377 + .../tests/array/array_reverse_variation5.phpt | 397 + .../tests/array/array_reverse_variation6.phpt | 209 + .../standard/tests/array/array_search.phpt | Bin 0 -> 539 bytes .../standard/tests/array/array_search1.phpt | 35 + .../tests/array/array_search_errors.phpt | 44 + .../tests/array/array_search_variation1.phpt | 641 + .../tests/array/array_search_variation2.phpt | 102 + .../tests/array/array_search_variation3.phpt | 58 + .../tests/array/array_search_variation4.phpt | 74 + .../tests/array/array_splice_basic.phpt | 117 + .../tests/array/array_splice_errors.phpt | 41 + .../tests/array/array_splice_variation1.phpt | 109 + .../tests/array/array_splice_variation2.phpt | 27 + .../tests/array/array_splice_variation3.phpt | 856 + .../tests/array/array_splice_variation4.phpt | 69 + .../ext/standard/tests/array/array_sum.phpt | 30 + .../standard/tests/array/array_unshift.phpt | 40 + .../tests/array/array_unshift_basic1.phpt | 63 + .../tests/array/array_unshift_basic2.phpt | 71 + .../tests/array/array_unshift_error.phpt | 34 + .../tests/array/array_unshift_object.phpt | 325 + .../tests/array/array_unshift_variation1.phpt | 338 + .../tests/array/array_unshift_variation2.phpt | 1061 + .../tests/array/array_unshift_variation3.phpt | 571 + .../tests/array/array_unshift_variation4.phpt | 390 + .../tests/array/array_unshift_variation5.phpt | 396 + .../tests/array/array_unshift_variation6.phpt | 196 + .../tests/array/array_unshift_variation7.phpt | 216 + .../tests/array/array_unshift_variation8.phpt | 214 + .../tests/array/array_unshift_variation9.phpt | 309 + .../tests/array/array_user_key_compare.phpt | 19 + .../standard/tests/array/array_values.phpt | Bin 0 -> 3060 bytes .../tests/array/array_values_errors.phpt | 36 + .../tests/array/array_values_variation.phpt | 76 + .../array/array_values_variation_64bit.phpt | 74 + .../ext/standard/tests/array/array_walk.phpt | 48 + .../tests/array/array_walk_objects.phpt | Bin 0 -> 785 bytes .../tests/array/array_walk_rec_objects.phpt | Bin 0 -> 845 bytes .../tests/array/array_walk_recursive.phpt | 26 + .../tests/array/array_walk_recursive1.phpt | 54 + .../ext/standard/tests/array/asort_basic.phpt | 133 + .../ext/standard/tests/array/asort_error.phpt | 79 + .../standard/tests/array/asort_object1.phpt | 245 + .../standard/tests/array/asort_object2.phpt | 253 + .../tests/array/asort_variation1.phpt | 399 + .../tests/array/asort_variation10.phpt | 114 + .../tests/array/asort_variation11.phpt | Bin 0 -> 3374 bytes .../tests/array/asort_variation2.phpt | 308 + .../tests/array/asort_variation3.phpt | 326 + .../tests/array/asort_variation4.phpt | 79 + .../tests/array/asort_variation5.phpt | 242 + .../tests/array/asort_variation6.phpt | 114 + .../tests/array/asort_variation7.phpt | 98 + .../tests/array/asort_variation8.phpt | 180 + .../tests/array/asort_variation9.phpt | 258 + .../ext/standard/tests/array/bug12776.phpt | 25 + .../ext/standard/tests/array/bug14580.phpt | 11 + .../ext/standard/tests/array/bug20381.phpt | 79 + .../ext/standard/tests/array/bug20865.phpt | 11 + .../ext/standard/tests/array/bug21182.phpt | 12 + .../ext/standard/tests/array/bug21918.phpt | 55 + .../ext/standard/tests/array/bug21998.phpt | 24 + .../ext/standard/tests/array/bug22088.phpt | 33 + .../ext/standard/tests/array/bug22463.phpt | 29 + .../ext/standard/tests/array/bug23581.phpt | 44 + .../ext/standard/tests/array/bug23788.phpt | 24 + .../ext/standard/tests/array/bug24198.phpt | 25 + .../ext/standard/tests/array/bug24220.phpt | 91 + .../ext/standard/tests/array/bug24766.phpt | 45 + .../ext/standard/tests/array/bug24897.phpt | 21 + .../ext/standard/tests/array/bug24980.phpt | 53 + .../ext/standard/tests/array/bug25359.phpt | 32 + .../ext/standard/tests/array/bug25708.phpt | 223 + .../ext/standard/tests/array/bug25758.phpt | 14 + .../ext/standard/tests/array/bug26458.phpt | Bin 0 -> 395 bytes .../ext/standard/tests/array/bug28739.phpt | 58 + .../ext/standard/tests/array/bug28974.phpt | 89 + .../ext/standard/tests/array/bug29253.phpt | 14 + .../ext/standard/tests/array/bug29493.phpt | 115 + .../ext/standard/tests/array/bug30074.phpt | 15 + .../ext/standard/tests/array/bug30266.phpt | 37 + .../ext/standard/tests/array/bug30833.phpt | 35 + .../ext/standard/tests/array/bug31158.phpt | 17 + .../ext/standard/tests/array/bug31213.phpt | 57 + .../ext/standard/tests/array/bug32021.phpt | 14 + .../ext/standard/tests/array/bug33382.phpt | 27 + .../ext/standard/tests/array/bug33940.phpt | 63 + .../ext/standard/tests/array/bug33989.phpt | 10 + .../ext/standard/tests/array/bug34066.phpt | 804 + .../ext/standard/tests/array/bug34066_1.phpt | 731 + .../ext/standard/tests/array/bug34227.phpt | 100 + .../ext/standard/tests/array/bug34982.phpt | 40 + .../ext/standard/tests/array/bug35014.phpt | 36 + .../standard/tests/array/bug35014_64bit.phpt | 36 + .../ext/standard/tests/array/bug35022.phpt | 21 + .../ext/standard/tests/array/bug35821.phpt | 33 + .../ext/standard/tests/array/bug36975.phpt | 62 + .../ext/standard/tests/array/bug38464.phpt | 20 + .../ext/standard/tests/array/bug39576.phpt | 52 + .../ext/standard/tests/array/bug40191.phpt | 25 + .../ext/standard/tests/array/bug40709.phpt | 28 + .../ext/standard/tests/array/bug41121.phpt | 128 + .../ext/standard/tests/array/bug41686.phpt | 56 + .../ext/standard/tests/array/bug42233.phpt | 33 + .../ext/standard/tests/array/compact.phpt | 60 + .../standard/tests/array/count_recursive.phpt | 52 + .../ext/standard/tests/array/data.inc | 13 + .../ext/standard/tests/array/each.phpt | Bin 0 -> 9548 bytes .../ext/standard/tests/array/end.phpt | 238 + .../ext/standard/tests/array/end_64bit.phpt | 238 + .../standard/tests/array/extract_error.phpt | 57 + .../tests/array/extract_variation1.phpt | 27 + .../tests/array/extract_variation2.phpt | 69 + .../tests/array/extract_variation3.phpt | 69 + .../tests/array/extract_variation4.phpt | 69 + .../tests/array/extract_variation5.phpt | 57 + .../tests/array/extract_variation6.phpt | 29 + .../tests/array/extract_variation7.phpt | 23 + .../tests/array/extract_variation8.phpt | 26 + .../tests/array/extract_variation9.phpt | 20 + .../standard/tests/array/in_array_errors.phpt | 45 + .../tests/array/in_array_variation1.phpt | 642 + .../tests/array/in_array_variation2.phpt | 102 + .../tests/array/in_array_variation3.phpt | 61 + .../tests/array/in_array_variation4.phpt | 77 + .../ext/standard/tests/array/locale_sort.phpt | 56 + .../ext/standard/tests/array/max.phpt | 41 + .../ext/standard/tests/array/max_basic.phpt | 42 + .../ext/standard/tests/array/max_error.phpt | 33 + .../standard/tests/array/max_variation1.phpt | 37 + .../standard/tests/array/max_variation2.phpt | 55 + .../ext/standard/tests/array/min.phpt | 41 + .../ext/standard/tests/array/min_basic.phpt | 37 + .../ext/standard/tests/array/min_error.phpt | 33 + .../standard/tests/array/min_variation1.phpt | 37 + .../standard/tests/array/min_variation2.phpt | 50 + .../ext/standard/tests/array/range.phpt | 448 + .../standard/tests/array/range_errors.phpt | 99 + .../standard/tests/array/range_variation.phpt | 626 + .../tests/array/range_variation1.phpt | 60 + .../tests/array/range_variation1_64bit.phpt | 60 + .../standard/tests/array/shuffle_basic1.phpt | 149 + .../standard/tests/array/shuffle_basic2.phpt | 88 + .../standard/tests/array/shuffle_error.phpt | 53 + .../tests/array/shuffle_variation1.phpt | 212 + .../tests/array/shuffle_variation2.phpt | 211 + .../tests/array/shuffle_variation3.phpt | 232 + .../tests/array/shuffle_variation4.phpt | 230 + .../tests/array/shuffle_variation5.phpt | 119 + .../ext/standard/tests/array/sort_basic.phpt | 134 + .../ext/standard/tests/array/sort_error.phpt | 79 + .../standard/tests/array/sort_object1.phpt | 242 + .../standard/tests/array/sort_object2.phpt | 257 + .../standard/tests/array/sort_variation1.phpt | 398 + .../tests/array/sort_variation10.phpt | 112 + .../tests/array/sort_variation11.phpt | Bin 0 -> 3144 bytes .../standard/tests/array/sort_variation2.phpt | 311 + .../standard/tests/array/sort_variation3.phpt | 328 + .../standard/tests/array/sort_variation4.phpt | 79 + .../standard/tests/array/sort_variation5.phpt | 233 + .../standard/tests/array/sort_variation6.phpt | 123 + .../standard/tests/array/sort_variation7.phpt | 98 + .../standard/tests/array/sort_variation8.phpt | 178 + .../standard/tests/array/sort_variation9.phpt | 259 + .../ext/standard/tests/array/var_export.phpt | 11 + .../ext/standard/tests/array/var_export2.phpt | Bin 0 -> 204 bytes .../ext/standard/tests/array/var_export3.phpt | 24 + .../ext/standard/tests/assert/assert.phpt | 39 + .../ext/standard/tests/assert/assert02.phpt | 42 + .../ext/standard/tests/assert/assert03.phpt | 33 + .../ext/standard/tests/assert/assert04.phpt | 41 + .../standard/tests/assert/assert_basic.phpt | 30 + .../standard/tests/assert/assert_basic1.phpt | 29 + .../standard/tests/assert/assert_basic2.phpt | 37 + .../standard/tests/assert/assert_basic3.phpt | 25 + .../standard/tests/assert/assert_basic4.phpt | 37 + .../standard/tests/assert/assert_basic5.phpt | 32 + .../standard/tests/assert/assert_error.phpt | 27 + .../standard/tests/assert/assert_error1.phpt | 44 + .../tests/assert/assert_variation.phpt | 131 + .../ext/standard/tests/file/001-win32.phpt | 125 + .../ext/standard/tests/file/001.phpt | 145 + .../ext/standard/tests/file/002.phpt | 52 + .../ext/standard/tests/file/003.phpt | 41 + .../ext/standard/tests/file/004.phpt | 61 + .../ext/standard/tests/file/005_basic.phpt | 54 + .../ext/standard/tests/file/005_error.phpt | 125 + .../tests/file/005_variation-win32.phpt | 221 + .../standard/tests/file/005_variation.phpt | 243 + .../ext/standard/tests/file/006_basic.phpt | 58 + .../ext/standard/tests/file/006_error.phpt | 107 + .../standard/tests/file/006_variation1.phpt | 2627 + .../standard/tests/file/006_variation2.phpt | 170 + .../ext/standard/tests/file/007_basic.phpt | 412 + .../ext/standard/tests/file/007_error.phpt | 179 + .../standard/tests/file/007_variation1.phpt | 54 + .../standard/tests/file/007_variation10.phpt | 58 + .../tests/file/007_variation11-win32.phpt | 76 + .../standard/tests/file/007_variation11.phpt | 76 + .../tests/file/007_variation12-win32.phpt | 78 + .../standard/tests/file/007_variation12.phpt | 78 + .../tests/file/007_variation13-win32.phpt | 65 + .../standard/tests/file/007_variation13.phpt | 65 + .../standard/tests/file/007_variation14.phpt | 62 + .../standard/tests/file/007_variation15.phpt | 58 + .../standard/tests/file/007_variation16.phpt | 60 + .../standard/tests/file/007_variation17.phpt | 54 + .../standard/tests/file/007_variation18.phpt | 58 + .../standard/tests/file/007_variation19.phpt | 71 + .../standard/tests/file/007_variation2.phpt | 58 + .../standard/tests/file/007_variation20.phpt | 73 + .../standard/tests/file/007_variation21.phpt | 60 + .../standard/tests/file/007_variation22.phpt | 62 + .../standard/tests/file/007_variation23.phpt | 58 + .../standard/tests/file/007_variation24.phpt | 60 + .../standard/tests/file/007_variation3.phpt | 71 + .../standard/tests/file/007_variation4.phpt | 73 + .../standard/tests/file/007_variation5.phpt | 60 + .../standard/tests/file/007_variation6.phpt | 62 + .../standard/tests/file/007_variation7.phpt | 58 + .../standard/tests/file/007_variation8.phpt | 60 + .../standard/tests/file/007_variation9.phpt | 54 + .../ext/standard/tests/file/bug12556.phpt | 48 + .../ext/standard/tests/file/bug20424.phpt | 10 + .../ext/standard/tests/file/bug22382.phpt | 25 + .../ext/standard/tests/file/bug22414.phpt | 38 + .../ext/standard/tests/file/bug24313.phpt | 16 + .../ext/standard/tests/file/bug24482.phpt | 37 + .../ext/standard/tests/file/bug26003.phpt | Bin 0 -> 225 bytes .../ext/standard/tests/file/bug26615.phpt | 20 + .../ext/standard/tests/file/bug26938.phpt | 33 + .../ext/standard/tests/file/bug27508.phpt | 70 + .../ext/standard/tests/file/bug27619.phpt | 18 + .../ext/standard/tests/file/bug30362.phpt | 26 + .../ext/standard/tests/file/bug30362.txt | 1 + .../ext/standard/tests/file/bug32160.phpt | 14 + .../ext/standard/tests/file/bug32160.txt | 1 + .../ext/standard/tests/file/bug35740.phpt | 14 + .../ext/standard/tests/file/bug35781.phpt | 24 + .../ext/standard/tests/file/bug37158.phpt | 39 + .../ext/standard/tests/file/bug37864.phpt | 12 + .../ext/standard/tests/file/bug38086.phpt | 46 + .../ext/standard/tests/file/bug38086.txt | 5 + .../ext/standard/tests/file/bug38450.phpt | 114 + .../ext/standard/tests/file/bug38450_1.phpt | 114 + .../ext/standard/tests/file/bug38450_2.phpt | 114 + .../ext/standard/tests/file/bug38450_3.phpt | 105 + .../ext/standard/tests/file/bug39367.phpt | 33 + .../ext/standard/tests/file/bug39538.phpt | 39 + .../ext/standard/tests/file/bug39551.phpt | 28 + .../ext/standard/tests/file/bug39673.phpt | 40 + .../ext/standard/tests/file/bug40374.phpt | 17 + .../ext/standard/tests/file/bug41655_1.phpt | 12 + .../ext/standard/tests/file/bug41655_2.phpt | 17 + .../ext/standard/tests/file/bug41693.phpt | 13 + .../ext/standard/tests/file/bug41815.phpt | 27 + .../ext/standard/tests/file/bug43137.phpt | 20 + .../tests/file/clearstatcache_error.phpt | 18 + .../ext/standard/tests/file/copy_basic.phpt | 57 + .../ext/standard/tests/file/copy_error.phpt | 38 + .../standard/tests/file/copy_variation1.phpt | 145 + .../standard/tests/file/copy_variation10.phpt | 37 + .../standard/tests/file/copy_variation11.phpt | 71 + .../tests/file/copy_variation12-win32.phpt | 47 + .../standard/tests/file/copy_variation12.phpt | 52 + .../standard/tests/file/copy_variation13.phpt | 57 + .../standard/tests/file/copy_variation14.phpt | 48 + .../standard/tests/file/copy_variation15.phpt | 64 + .../tests/file/copy_variation16-win32.phpt | 144 + .../standard/tests/file/copy_variation16.phpt | 143 + .../standard/tests/file/copy_variation17.phpt | 76 + .../standard/tests/file/copy_variation18.phpt | 51 + .../tests/file/copy_variation2-win32.phpt | 225 + .../standard/tests/file/copy_variation2.phpt | 237 + .../tests/file/copy_variation3-win32.phpt | 109 + .../standard/tests/file/copy_variation3.phpt | 110 + .../tests/file/copy_variation4-win32.phpt | Bin 0 -> 4276 bytes .../standard/tests/file/copy_variation4.phpt | Bin 0 -> 4480 bytes .../tests/file/copy_variation5-win32.phpt | 111 + .../standard/tests/file/copy_variation5.phpt | 107 + .../tests/file/copy_variation6-win32.phpt | 143 + .../standard/tests/file/copy_variation6.phpt | 142 + .../standard/tests/file/copy_variation7.phpt | 86 + .../standard/tests/file/copy_variation8.phpt | 176 + .../standard/tests/file/copy_variation9.phpt | 75 + .../ext/standard/tests/file/disk.phpt | 48 + .../tests/file/disk_free_space_basic.phpt | 65 + .../file/disk_free_space_error-win32.phpt | 74 + .../tests/file/disk_free_space_error.phpt | 66 + .../tests/file/disk_free_space_variation.phpt | 123 + .../tests/file/disk_total_space_basic.phpt | 48 + .../file/disk_total_space_error-win32.phpt | 55 + .../tests/file/disk_total_space_error.phpt | 51 + .../file/disk_total_space_variation.phpt | 108 + .../ext/standard/tests/file/fflush_basic.phpt | 54 + .../ext/standard/tests/file/fflush_error.phpt | 88 + .../tests/file/fflush_variation1-win32.phpt | 526 + .../tests/file/fflush_variation1.phpt | 526 + .../tests/file/fflush_variation2.phpt | 442 + .../tests/file/fflush_variation3.phpt | 382 + .../tests/file/fflush_variation4.phpt | 52 + .../ext/standard/tests/file/fgetc_basic.phpt | 543 + .../ext/standard/tests/file/fgetc_error.phpt | 73 + .../standard/tests/file/fgetc_variation1.phpt | 94 + .../standard/tests/file/fgetc_variation2.phpt | 65 + .../standard/tests/file/fgetc_variation3.phpt | 117 + .../standard/tests/file/fgetc_variation4.phpt | 290 + .../ext/standard/tests/file/fgetcsv.phpt | 158 + .../standard/tests/file/fgetcsv_error.phpt | 95 + .../tests/file/fgetcsv_variation1.phpt | 1412 + .../tests/file/fgetcsv_variation10.phpt | 1295 + .../tests/file/fgetcsv_variation11.phpt | 1835 + .../tests/file/fgetcsv_variation12.phpt | 957 + .../tests/file/fgetcsv_variation13.phpt | 189 + .../tests/file/fgetcsv_variation14.phpt | 239 + .../tests/file/fgetcsv_variation15.phpt | 940 + .../tests/file/fgetcsv_variation16.phpt | 944 + .../tests/file/fgetcsv_variation17.phpt | 1565 + .../tests/file/fgetcsv_variation18.phpt | 690 + .../tests/file/fgetcsv_variation19.phpt | 841 + .../tests/file/fgetcsv_variation2.phpt | 1413 + .../tests/file/fgetcsv_variation20.phpt | 191 + .../tests/file/fgetcsv_variation21.phpt | 191 + .../tests/file/fgetcsv_variation22.phpt | 614 + .../tests/file/fgetcsv_variation23.phpt | 48 + .../tests/file/fgetcsv_variation24.phpt | 671 + .../tests/file/fgetcsv_variation25.phpt | 935 + .../tests/file/fgetcsv_variation26.phpt | 441 + .../tests/file/fgetcsv_variation27.phpt | 935 + .../tests/file/fgetcsv_variation28.phpt | 935 + .../tests/file/fgetcsv_variation29.phpt | 615 + .../tests/file/fgetcsv_variation3.phpt | 933 + .../tests/file/fgetcsv_variation30.phpt | 614 + .../tests/file/fgetcsv_variation31.phpt | 616 + .../tests/file/fgetcsv_variation4.phpt | 932 + .../tests/file/fgetcsv_variation5.phpt | 934 + .../tests/file/fgetcsv_variation6.phpt | 2350 + .../tests/file/fgetcsv_variation7.phpt | 1292 + .../tests/file/fgetcsv_variation8.phpt | 1058 + .../tests/file/fgetcsv_variation9.phpt | 1056 + .../ext/standard/tests/file/fgets_basic.phpt | 318 + .../ext/standard/tests/file/fgets_error.phpt | 107 + .../standard/tests/file/fgets_variation1.phpt | 116 + .../standard/tests/file/fgets_variation2.phpt | 62 + .../standard/tests/file/fgets_variation3.phpt | 500 + .../tests/file/fgets_variation4-win32.phpt | 574 + .../standard/tests/file/fgets_variation4.phpt | 574 + .../standard/tests/file/fgets_variation5.phpt | 302 + .../tests/file/fgets_variation6-win32.phpt | 372 + .../standard/tests/file/fgets_variation6.phpt | 372 + .../ext/standard/tests/file/fgetss.phpt | 83 + .../ext/standard/tests/file/fgetss1.phpt | 69 + .../standard/tests/file/fgetss_basic1.phpt | 133 + .../tests/file/fgetss_basic2-win32.phpt | 214 + .../standard/tests/file/fgetss_basic2.phpt | 214 + .../ext/standard/tests/file/fgetss_error.phpt | 106 + .../tests/file/fgetss_variation1-win32.phpt | 168 + .../tests/file/fgetss_variation1.phpt | 168 + .../tests/file/fgetss_variation2.phpt | 434 + .../tests/file/fgetss_variation3-win32.phpt | 567 + .../tests/file/fgetss_variation3.phpt | 567 + .../tests/file/fgetss_variation4.phpt | 163 + .../tests/file/fgetss_variation5-win32.phpt | 217 + .../tests/file/fgetss_variation5.phpt | 217 + .../ext/standard/tests/file/file.inc | 650 + .../ext/standard/tests/file/file_basic.phpt | 76 + .../ext/standard/tests/file/file_error.phpt | 50 + ..._get_contents_file_put_contents_basic.phpt | 50 + ..._get_contents_file_put_contents_error.phpt | 71 + ...contents_file_put_contents_variation1.phpt | 116 + ...contents_file_put_contents_variation2.phpt | 57 + .../tests/file/file_put_contents.phpt | 32 + .../standard/tests/file/file_variation.phpt | 265 + .../standard/tests/file/filegroup_basic.phpt | 69 + .../standard/tests/file/filegroup_error.phpt | 43 + .../standard/tests/file/fileinode_basic.phpt | 37 + .../standard/tests/file/fileinode_error.phpt | 44 + .../tests/file/fileinode_variation.phpt | 103 + .../standard/tests/file/fileowner_basic.phpt | 50 + .../standard/tests/file/fileowner_error.phpt | 43 + .../standard/tests/file/filesize_basic.phpt | 38 + .../standard/tests/file/filesize_error.phpt | 40 + .../tests/file/filesize_variation1-win32.phpt | 45 + .../tests/file/filesize_variation1.phpt | 45 + .../tests/file/filesize_variation2-win32.phpt | 83 + .../tests/file/filesize_variation2.phpt | 83 + .../tests/file/filesize_variation3-win32.phpt | 71 + .../tests/file/filesize_variation3.phpt | 70 + .../tests/file/filesize_variation4-win32.phpt | 114 + .../tests/file/filesize_variation4.phpt | 111 + .../ext/standard/tests/file/filestat.phpt | 63 + .../standard/tests/file/filetype_basic.phpt | 22 + .../standard/tests/file/filetype_error.phpt | 39 + .../tests/file/filetype_variation.phpt | 78 + .../ext/standard/tests/file/flock.phpt | 64 + .../ext/standard/tests/file/flock_basic.phpt | 44 + .../ext/standard/tests/file/flock_error.phpt | 112 + .../standard/tests/file/flock_variation.phpt | 328 + .../standard/tests/file/fnmatch_basic.phpt | 49 + .../standard/tests/file/fnmatch_error.phpt | 57 + .../tests/file/fnmatch_variation.phpt | 402 + .../ext/standard/tests/file/fopencookie.phpt | 86 + .../standard/tests/file/fpassthru_basic.phpt | 126 + .../standard/tests/file/fpassthru_error.phpt | 40 + .../tests/file/fpassthru_variation.phpt | 114 + .../ext/standard/tests/file/fputcsv.phpt | 107 + .../standard/tests/file/fputcsv_error.phpt | 96 + .../tests/file/fputcsv_variation1.phpt | 833 + .../tests/file/fputcsv_variation10.phpt | 335 + .../tests/file/fputcsv_variation11.phpt | 833 + .../tests/file/fputcsv_variation12.phpt | 834 + .../tests/file/fputcsv_variation13.phpt | 1050 + .../tests/file/fputcsv_variation14.phpt | 356 + .../tests/file/fputcsv_variation2.phpt | 941 + .../tests/file/fputcsv_variation3.phpt | 941 + .../tests/file/fputcsv_variation4.phpt | 941 + .../tests/file/fputcsv_variation5.phpt | 833 + .../tests/file/fputcsv_variation6.phpt | 836 + .../tests/file/fputcsv_variation7.phpt | 836 + .../tests/file/fputcsv_variation8.phpt | 836 + .../tests/file/fputcsv_variation9.phpt | 1267 + .../ext/standard/tests/file/fread_basic.phpt | 640 + .../ext/standard/tests/file/fread_error.phpt | 114 + .../standard/tests/file/fread_variation1.phpt | 657 + .../standard/tests/file/fread_variation2.phpt | 656 + .../tests/file/fread_variation3-win32.phpt | 498 + .../standard/tests/file/fread_variation3.phpt | 498 + .../tests/file/fread_variation4-win32.phpt | 469 + .../standard/tests/file/fread_variation4.phpt | 469 + .../ext/standard/tests/file/fscanf.phpt | 100 + .../ext/standard/tests/file/fscanf_error.phpt | 99 + .../tests/file/fscanf_variation1.phpt | 49 + .../tests/file/fscanf_variation10.phpt | 221 + .../tests/file/fscanf_variation11.phpt | 736 + .../tests/file/fscanf_variation12.phpt | 945 + .../tests/file/fscanf_variation13.phpt | 245 + .../tests/file/fscanf_variation14.phpt | 1078 + .../tests/file/fscanf_variation15.phpt | 862 + .../tests/file/fscanf_variation16.phpt | 220 + .../tests/file/fscanf_variation17.phpt | 711 + .../tests/file/fscanf_variation18.phpt | 1013 + .../tests/file/fscanf_variation19.phpt | 249 + .../tests/file/fscanf_variation2.phpt | 1007 + .../tests/file/fscanf_variation20.phpt | 1011 + .../tests/file/fscanf_variation21.phpt | 862 + .../tests/file/fscanf_variation22.phpt | 220 + .../tests/file/fscanf_variation23.phpt | 711 + .../tests/file/fscanf_variation24.phpt | 993 + .../tests/file/fscanf_variation25.phpt | 293 + .../tests/file/fscanf_variation26.phpt | 355 + .../tests/file/fscanf_variation27.phpt | 1012 + .../tests/file/fscanf_variation28.phpt | 863 + .../tests/file/fscanf_variation29.phpt | 221 + .../tests/file/fscanf_variation3.phpt | 864 + .../tests/file/fscanf_variation30.phpt | 712 + .../tests/file/fscanf_variation31.phpt | 945 + .../tests/file/fscanf_variation32.phpt | 250 + .../tests/file/fscanf_variation33.phpt | 1018 + .../tests/file/fscanf_variation34.phpt | 868 + .../tests/file/fscanf_variation35.phpt | 216 + .../tests/file/fscanf_variation36.phpt | 707 + .../tests/file/fscanf_variation37.phpt | 945 + .../tests/file/fscanf_variation38.phpt | 245 + .../tests/file/fscanf_variation39.phpt | 1007 + .../tests/file/fscanf_variation4.phpt | 217 + .../tests/file/fscanf_variation40.phpt | 864 + .../tests/file/fscanf_variation41.phpt | 216 + .../tests/file/fscanf_variation42.phpt | 707 + .../tests/file/fscanf_variation43.phpt | 945 + .../tests/file/fscanf_variation44.phpt | 245 + .../tests/file/fscanf_variation45.phpt | 1007 + .../tests/file/fscanf_variation46.phpt | 858 + .../tests/file/fscanf_variation47.phpt | 216 + .../tests/file/fscanf_variation48.phpt | 707 + .../tests/file/fscanf_variation49.phpt | 945 + .../tests/file/fscanf_variation5.phpt | 731 + .../tests/file/fscanf_variation50.phpt | 245 + .../tests/file/fscanf_variation51.phpt | 150 + .../tests/file/fscanf_variation52.phpt | 175 + .../tests/file/fscanf_variation53.phpt | 226 + .../tests/file/fscanf_variation54.phpt | 100 + .../tests/file/fscanf_variation55.phpt | 1684 + .../tests/file/fscanf_variation6.phpt | 945 + .../tests/file/fscanf_variation7.phpt | 245 + .../tests/file/fscanf_variation8.phpt | 1613 + .../tests/file/fscanf_variation9.phpt | 1014 + .../tests/file/fseek_ftell_rewind_basic1.phpt | 453 + .../file/fseek_ftell_rewind_basic2-win32.phpt | 464 + .../tests/file/fseek_ftell_rewind_basic2.phpt | 464 + .../tests/file/fseek_ftell_rewind_error1.phpt | 99 + .../tests/file/fseek_ftell_rewind_error2.phpt | 95 + .../tests/file/fseek_ftell_rewind_error3.phpt | 95 + .../file/fseek_ftell_rewind_variation1.phpt | 428 + .../fseek_ftell_rewind_variation2-win32.phpt | 804 + .../file/fseek_ftell_rewind_variation2.phpt | 438 + .../file/fseek_ftell_rewind_variation3.phpt | 478 + .../fseek_ftell_rewind_variation4-win32.phpt | 484 + .../file/fseek_ftell_rewind_variation4.phpt | 484 + .../file/fseek_ftell_rewind_variation5.phpt | 474 + .../fseek_ftell_rewind_variation6-win32.phpt | 485 + .../file/fseek_ftell_rewind_variation6.phpt | 484 + .../file/fseek_ftell_rewind_variation7.phpt | 477 + .../fseek_ftell_rewind_variation8-win32.phpt | 485 + .../file/fseek_ftell_rewind_variation8.phpt | 485 + .../ext/standard/tests/file/fstat.phpt | 74 + .../ext/standard/tests/file/ftruncate.phpt | Bin 0 -> 1077 bytes .../standard/tests/file/ftruncate_error.phpt | 124 + .../file/ftruncate_variation1-win32.phpt | 461 + .../tests/file/ftruncate_variation1.phpt | 461 + .../file/ftruncate_variation2-win32.phpt | 462 + .../tests/file/ftruncate_variation2.phpt | 462 + .../file/ftruncate_variation3-win32.phpt | 461 + .../tests/file/ftruncate_variation3.phpt | 461 + .../file/ftruncate_variation4-win32.phpt | 462 + .../tests/file/ftruncate_variation4.phpt | 462 + .../file/ftruncate_variation5-win32.phpt | 463 + .../tests/file/ftruncate_variation5.phpt | 463 + .../file/ftruncate_variation6-win32.phpt | 482 + .../tests/file/ftruncate_variation6.phpt | 482 + .../file/ftruncate_variation7-win32.phpt | 463 + .../tests/file/ftruncate_variation7.phpt | 463 + .../ext/standard/tests/file/fwrite.phpt | 50 + .../tests/file/fwrite_basic-win32.phpt | 424 + .../ext/standard/tests/file/fwrite_basic.phpt | 424 + .../ext/standard/tests/file/fwrite_error.phpt | 120 + .../tests/file/fwrite_variation1-win32.phpt | 235 + .../tests/file/fwrite_variation1.phpt | 233 + .../tests/file/fwrite_variation2-win32.phpt | 304 + .../tests/file/fwrite_variation2.phpt | 303 + .../tests/file/fwrite_variation3-win32.phpt | 380 + .../tests/file/fwrite_variation3.phpt | 381 + .../tests/file/fwrite_variation4-win32.phpt | 275 + .../tests/file/fwrite_variation4.phpt | 275 + .../standard/tests/file/get_current_user.phpt | 15 + .../ext/standard/tests/file/glob_basic.phpt | 77 + .../ext/standard/tests/file/glob_error.phpt | 53 + .../tests/file/glob_variation-win32.phpt | 460 + .../standard/tests/file/glob_variation.phpt | 460 + .../standard/tests/file/htmlentities19.phpt | 330 + .../standard/tests/file/htmlspecialchars.phpt | 330 + .../tests/file/include_userstream_001.phpt | 82 + .../tests/file/include_userstream_002.phpt | 106 + .../ext/standard/tests/file/is_dir_basic.phpt | 43 + .../ext/standard/tests/file/is_dir_error.phpt | 35 + .../tests/file/is_dir_variation1.phpt | 43 + .../tests/file/is_dir_variation2.phpt | 84 + .../tests/file/is_dir_variation3.phpt | 46 + .../tests/file/is_dir_variation4.phpt | 85 + .../tests/file/is_executable_basic-win32.phpt | 1064 + .../tests/file/is_executable_basic.phpt | 1077 + .../tests/file/is_executable_error.phpt | 29 + .../tests/file/is_executable_variation1.phpt | 98 + .../tests/file/is_executable_variation2.phpt | 110 + .../tests/file/is_executable_variation3.phpt | 66 + .../standard/tests/file/is_file_basic.phpt | 48 + .../standard/tests/file/is_file_error.phpt | 44 + .../tests/file/is_file_variation1.phpt | 57 + .../tests/file/is_file_variation2.phpt | 46 + .../tests/file/is_file_variation3.phpt | 55 + .../tests/file/is_file_variation4.phpt | 74 + .../tests/file/is_readable_basic-win32.phpt | 1066 + .../tests/file/is_readable_basic.phpt | 1076 + .../tests/file/is_readable_error.phpt | 29 + .../tests/file/is_readable_variation1.phpt | 101 + .../tests/file/is_readable_variation2.phpt | 110 + .../tests/file/is_readable_variation3.phpt | 66 + .../tests/file/is_writable_basic.phpt | 1588 + .../tests/file/is_writable_error.phpt | 45 + .../tests/file/is_writable_variation1.phpt | 113 + .../tests/file/is_writable_variation2.phpt | 126 + .../tests/file/is_writable_variation3.phpt | 76 + .../standard/tests/file/lstat_stat_basic.phpt | 316 + .../standard/tests/file/lstat_stat_error.phpt | 83 + .../tests/file/lstat_stat_variation1.phpt | 61 + .../tests/file/lstat_stat_variation10.phpt | 58 + .../tests/file/lstat_stat_variation11.phpt | 59 + .../tests/file/lstat_stat_variation12.phpt | 65 + .../tests/file/lstat_stat_variation13.phpt | 57 + .../tests/file/lstat_stat_variation14.phpt | 62 + .../tests/file/lstat_stat_variation15.phpt | 63 + .../tests/file/lstat_stat_variation16.phpt | 57 + .../tests/file/lstat_stat_variation17.phpt | 56 + .../tests/file/lstat_stat_variation18.phpt | 176 + .../tests/file/lstat_stat_variation19.phpt | 284 + .../tests/file/lstat_stat_variation2.phpt | 59 + .../tests/file/lstat_stat_variation20.phpt | 287 + .../tests/file/lstat_stat_variation21.phpt | 65 + .../tests/file/lstat_stat_variation3.phpt | 62 + .../tests/file/lstat_stat_variation4.phpt | 64 + .../tests/file/lstat_stat_variation5.phpt | 64 + .../tests/file/lstat_stat_variation6.phpt | 78 + .../tests/file/lstat_stat_variation7.phpt | 57 + .../tests/file/lstat_stat_variation8.phpt | 63 + .../tests/file/lstat_stat_variation9.phpt | 69 + .../ext/standard/tests/file/magic_quotes.phpt | 61 + .../ext/standard/tests/file/mkdir-001.phpt | 36 + .../ext/standard/tests/file/mkdir-002.phpt | 55 + .../ext/standard/tests/file/mkdir-003.phpt | 30 + .../ext/standard/tests/file/mkdir-004.phpt | 24 + .../ext/standard/tests/file/mkdir-005.phpt | 25 + .../ext/standard/tests/file/mkdir-006.phpt | 20 + .../tests/file/mkdir_rmdir_error.phpt | 90 + .../file/mkdir_rmdir_variation-win32.phpt | 1613 + .../tests/file/mkdir_rmdir_variation1.phpt | 1579 + .../tests/file/mkdir_rmdir_variation2.phpt | 77 + .../standard/tests/file/parse_ini_file.phpt | 491 + .../standard/tests/file/pathinfo_basic.phpt | 401 + .../standard/tests/file/pathinfo_error.phpt | 24 + .../tests/file/pathinfo_variaton.phpt | 442 + .../tests/file/popen_pclose_basic-win32.phpt | 61 + .../tests/file/popen_pclose_basic.phpt | 132 + .../tests/file/popen_pclose_error-sunos.phpt | 55 + .../tests/file/popen_pclose_error-win32.phpt | 57 + .../tests/file/popen_pclose_error.phpt | 55 + .../ext/standard/tests/file/proc_open01.phpt | 69 + .../tests/file/readfile_basic-win32.phpt | 530 + .../standard/tests/file/readfile_basic.phpt | 530 + .../standard/tests/file/readfile_error.phpt | 55 + .../tests/file/readfile_variation1.phpt | 46 + .../tests/file/readfile_variation2.phpt | 87 + .../tests/file/readfile_variation3.phpt | 63 + .../tests/file/readlink_realpath_basic1.phpt | 118 + .../tests/file/readlink_realpath_basic2.phpt | 92 + .../tests/file/readlink_realpath_error.phpt | 73 + .../file/readlink_realpath_variation1.phpt | 99 + .../file/readlink_realpath_variation2.phpt | 104 + .../file/readlink_realpath_variation3.phpt | 86 + .../tests/file/realpath_basic-win32.phpt | 89 + .../tests/file/realpath_error-win32.phpt | 29 + .../tests/file/realpath_variation-win32.phpt | 102 + .../ext/standard/tests/file/rename_basic.phpt | 118 + .../ext/standard/tests/file/rename_error.phpt | 35 + .../tests/file/rename_variation-win32.phpt | 199 + .../standard/tests/file/rename_variation.phpt | 79 + .../tests/file/rename_variation1.phpt | 73 + .../tests/file/rename_variation2.phpt | 67 + .../tests/file/rename_variation3.phpt | 64 + .../tests/file/rename_variation4.phpt | 54 + .../tests/file/rename_variation5.phpt | 96 + .../tests/file/rename_variation6.phpt | 35 + .../tests/file/rename_variation7.phpt | 30 + .../standard/tests/file/stat_basic-win32.phpt | 191 + .../standard/tests/file/stat_error-win32.phpt | 56 + .../tests/file/stat_variation1-win32.phpt | 93 + .../tests/file/stat_variation2-win32.phpt | 64 + .../tests/file/stat_variation3-win32.phpt | 78 + .../tests/file/stat_variation4-win32.phpt | 91 + .../tests/file/stat_variation5-win32.phpt | 64 + .../tests/file/stat_variation6-win32.phpt | 90 + .../tests/file/stat_variation7-win32.phpt | 297 + .../tests/file/stat_variation8-win32.phpt | 75 + .../tests/file/statcache-corruption.phpt | 13 + .../ext/standard/tests/file/statpage.phpt | 20 + .../ext/standard/tests/file/stream_001.phpt | 24 + .../ext/standard/tests/file/stream_002.phpt | 53 + .../tests/file/stream_copy_to_stream.phpt | 129 + .../standard/tests/file/stream_get_line.phpt | 18 + .../tests/file/stream_rfc2397_001.phpt | 20 + .../tests/file/stream_rfc2397_002.phpt | 180 + .../tests/file/stream_rfc2397_003.gif | Bin 0 -> 273 bytes .../tests/file/stream_rfc2397_003.phpt | 36 + .../tests/file/stream_rfc2397_004.phpt | 30 + .../tests/file/stream_rfc2397_005.phpt | 36 + .../tests/file/stream_rfc2397_006.phpt | 28 + .../tests/file/stream_rfc2397_007.phpt | 141 + .../ext/standard/tests/file/symlink.phpt | 78 + .../symlink_link_linkinfo_is_link_basic1.phpt | 114 + .../symlink_link_linkinfo_is_link_basic2.phpt | 91 + .../symlink_link_linkinfo_is_link_error1.phpt | 115 + .../symlink_link_linkinfo_is_link_error2.phpt | 107 + ...link_link_linkinfo_is_link_variation1.phpt | 136 + ...link_link_linkinfo_is_link_variation2.phpt | 51 + ...link_link_linkinfo_is_link_variation3.phpt | 146 + ...link_link_linkinfo_is_link_variation4.phpt | 120 + ...link_link_linkinfo_is_link_variation5.phpt | 75 + ...link_link_linkinfo_is_link_variation6.phpt | 103 + ...link_link_linkinfo_is_link_variation7.phpt | 94 + ...link_link_linkinfo_is_link_variation8.phpt | 83 + ...link_link_linkinfo_is_link_variation9.phpt | 121 + .../standard/tests/file/tempnam_error.phpt | 46 + .../tests/file/tempnam_variation1-win32.phpt | 77 + .../tests/file/tempnam_variation1.phpt | 91 + .../tests/file/tempnam_variation2-win32.phpt | 97 + .../tests/file/tempnam_variation2.phpt | 97 + .../tests/file/tempnam_variation3-win32.phpt | 91 + .../tests/file/tempnam_variation3.phpt | 91 + .../tests/file/tempnam_variation4.phpt | 1071 + .../tests/file/tempnam_variation5.phpt | 46 + .../tests/file/tempnam_variation6.phpt | 39 + .../tests/file/tempnam_variation7-win32.phpt | 92 + .../tests/file/tempnam_variation7.phpt | 92 + .../ext/standard/tests/file/test.csv | 17 + .../ext/standard/tests/file/test2.csv | 1 + .../ext/standard/tests/file/test3.csv | Bin 0 -> 8 bytes .../ext/standard/tests/file/touch.phpt | 49 + .../ext/standard/tests/file/umask_basic.phpt | 2079 + .../ext/standard/tests/file/umask_error.phpt | 26 + .../standard/tests/file/umask_variation1.phpt | 761 + .../standard/tests/file/umask_variation2.phpt | 899 + .../ext/standard/tests/file/unlink_basic.phpt | 43 + .../tests/file/unlink_error-win32.phpt | 111 + .../ext/standard/tests/file/unlink_error.phpt | 108 + .../tests/file/unlink_variation1-win32.phpt | 85 + .../tests/file/unlink_variation1.phpt | 92 + .../tests/file/unlink_variation2-win32.phpt | 43 + .../tests/file/unlink_variation2.phpt | 37 + .../tests/file/unlink_variation3.phpt | 60 + .../tests/file/unlink_variation4.phpt | 37 + .../tests/file/unlink_variation5.phpt | 2087 + .../standard/tests/file/userdirstream.phpt | 52 + .../ext/standard/tests/file/userfilters.phpt | 37 + .../ext/standard/tests/file/userstreams.phpt | 325 + .../ext/standard/tests/file/userwrapper.phpt | 83 + .../ext/standard/tests/filters/001.phpt | 31 + .../ext/standard/tests/filters/basic.phpt | 44 + .../ext/standard/tests/filters/bug22538.phpt | 44 + .../ext/standard/tests/filters/bug35916.phpt | 42 + .../tests/filters/php_user_filter_01.phpt | 17 + .../tests/filters/php_user_filter_02.phpt | 12 + .../tests/filters/php_user_filter_03.phpt | 12 + .../ext/standard/tests/filters/read.phpt | 72 + .../standard/tests/general_functions/001.phpt | 67 + .../standard/tests/general_functions/002.phpt | 11 + .../standard/tests/general_functions/003.phpt | 58 + .../standard/tests/general_functions/004.data | 4 + .../standard/tests/general_functions/004.phpt | 16 + .../standard/tests/general_functions/005.phpt | 24 + .../standard/tests/general_functions/006.phpt | 11 + .../standard/tests/general_functions/007.phpt | 24 + .../standard/tests/general_functions/008.phpt | 40 + .../standard/tests/general_functions/009.phpt | 24 + .../standard/tests/general_functions/010.phpt | 25 + .../tests/general_functions/bug25038.phpt | 32 + .../tests/general_functions/bug27678.phpt | 14 + .../tests/general_functions/bug29038.phpt | 74 + .../tests/general_functions/bug31190.phpt | 26 + .../tests/general_functions/bug32647.phpt | 61 + .../tests/general_functions/bug34794.phpt | 34 + .../tests/general_functions/bug35229.phpt | 30 + .../tests/general_functions/bug36011.phpt | 46 + .../tests/general_functions/bug39322.phpt | 44 + .../tests/general_functions/bug40398.phpt | 90 + .../tests/general_functions/bug40752.phpt | 37 + .../tests/general_functions/bug41037.phpt | 23 + .../tests/general_functions/bug41445.phpt | 75 + .../tests/general_functions/bug41445_1.phpt | 54 + .../tests/general_functions/bug41518.phpt | 30 + .../general_functions/debug_zval_dump_b.phpt | Bin 0 -> 7277 bytes .../debug_zval_dump_b_64bit.phpt | Bin 0 -> 7277 bytes .../general_functions/debug_zval_dump_e.phpt | 23 + .../general_functions/debug_zval_dump_o.phpt | 839 + .../general_functions/debug_zval_dump_v.phpt | 215 + .../general_functions/dl-cve-2007-4887.phpt | 10 + .../general_functions/error_get_last.phpt | 43 + .../tests/general_functions/floatval.phpt | 207 + .../tests/general_functions/getopt.phpt | 30 + .../tests/general_functions/getrusage.phpt | 23 + .../gettype_settype_basic.phpt | 906 + .../gettype_settype_error.phpt | 56 + .../gettype_settype_variation1.phpt | 589 + .../gettype_settype_variation2.phpt | 1005 + .../gettype_settype_variation3.phpt | 1002 + .../gettype_settype_variation4.phpt | 1201 + .../gettype_settype_variation5.phpt | 714 + .../gettype_settype_variation6.phpt | 846 + .../gettype_settype_variation7.phpt | 844 + .../gettype_settype_variation8.phpt | 595 + .../tests/general_functions/head.phpt | 53 + .../general_functions/highlight_heredoc.phpt | 21 + .../general_functions/import_request.phpt | 76 + .../general_functions/import_request1.phpt | 99 + .../general_functions/import_request2.phpt | 25 + .../general_functions/import_request3.phpt | 25 + .../tests/general_functions/include_path.phpt | 75 + .../tests/general_functions/ini_get_all.phpt | 51 + .../tests/general_functions/intval.phpt | 306 + .../tests/general_functions/is_array.phpt | 215 + .../tests/general_functions/is_bool.phpt | 295 + .../tests/general_functions/is_callable.phpt | 1119 + .../tests/general_functions/is_float.phpt | 441 + .../general_functions/is_float_64bit.phpt | 443 + .../tests/general_functions/is_int.phpt | 466 + .../tests/general_functions/is_int_64bit.phpt | 468 + .../tests/general_functions/is_null.phpt | 297 + .../tests/general_functions/is_numeric.phpt | 388 + .../tests/general_functions/is_object.phpt | 228 + .../tests/general_functions/is_resource.phpt | 10 + .../tests/general_functions/is_scalar.phpt | 241 + .../tests/general_functions/is_string.phpt | 304 + .../general_functions/parse_ini_file.phpt | 175 + .../tests/general_functions/phpcredits.phpt | 54 + .../tests/general_functions/phpcredits2.phpt | 32 + .../tests/general_functions/phpinfo.phpt | 76 + .../tests/general_functions/phpinfo2.phpt | 33 + .../tests/general_functions/print_r.phpt | 1736 + .../general_functions/print_r_64bit.phpt | 1737 + .../tests/general_functions/proc_open.phpt | 28 + .../tests/general_functions/proc_open02.phpt | 72 + .../tests/general_functions/putenv.phpt | 28 + .../tests/general_functions/rand.phpt | 63 + .../tests/general_functions/strval.phpt | 310 + .../tests/general_functions/sunfuncts.phpt | 44 + .../general_functions/sys_getloadavg.phpt | 32 + .../tests/general_functions/type.phpt | 351 + .../tests/general_functions/var_dump.phpt | 1911 + .../general_functions/var_dump_64bit.phpt | 1911 + .../general_functions/var_export-locale.phpt | 1061 + .../tests/general_functions/var_export.phpt | 1054 + .../ext/standard/tests/image/246x247.png | Bin 0 -> 360 bytes .../ext/standard/tests/image/384x385.png | Bin 0 -> 267 bytes .../ext/standard/tests/image/bug13213.jpg | Bin 0 -> 596 bytes .../ext/standard/tests/image/bug13213.phpt | 23 + .../standard/tests/image/getimagesize.phpt | 196 + .../tests/image/getimagesize_246x247.phpt | 42 + .../tests/image/getimagesize_384x385.phpt | 42 + .../tests/image/getimagesize_swc.phpt | 25 + .../tests/image/image_type_to_extension.phpt | 103 + .../tests/image/image_type_to_mime_type.phpt | 51 + .../standard/tests/image/iptcembed_001.phpt | 18 + .../standard/tests/image/skipif_imagetype.inc | 15 + .../ext/standard/tests/image/test13pix.swf | Bin 0 -> 589 bytes .../ext/standard/tests/image/test1pix.bmp | Bin 0 -> 58 bytes .../ext/standard/tests/image/test1pix.jp2 | Bin 0 -> 243 bytes .../ext/standard/tests/image/test1pix.jpc | Bin 0 -> 127 bytes .../ext/standard/tests/image/test1pix.jpg | Bin 0 -> 523 bytes .../ext/standard/tests/image/test2pix.gif | Bin 0 -> 35 bytes .../ext/standard/tests/image/test4pix.gif | Bin 0 -> 42 bytes .../ext/standard/tests/image/test4pix.iff | Bin 0 -> 114 bytes .../ext/standard/tests/image/test4pix.png | Bin 0 -> 148 bytes .../ext/standard/tests/image/test4pix.psd | Bin 0 -> 1247 bytes .../ext/standard/tests/image/test4pix.swf | Bin 0 -> 609 bytes .../ext/standard/tests/image/test4pix.tif | Bin 0 -> 312 bytes .../ext/standard/tests/math/abs.phpt | 24 + .../ext/standard/tests/math/acos_basic.phpt | 69 + .../ext/standard/tests/math/acos_error.phpt | 30 + .../standard/tests/math/acos_variation.phpt | 52 + .../ext/standard/tests/math/acosh_basic.phpt | 46 + .../ext/standard/tests/math/acosh_error.phpt | 35 + .../standard/tests/math/acosh_variation.phpt | 57 + .../tests/math/allowed_rounding_error.inc | 18 + .../ext/standard/tests/math/asin_basic.phpt | 68 + .../ext/standard/tests/math/asin_error.phpt | 30 + .../standard/tests/math/asin_variation.phpt | 52 + .../ext/standard/tests/math/asinh_basic.phpt | 45 + .../ext/standard/tests/math/asinh_error.phpt | 35 + .../standard/tests/math/asinh_variation.phpt | 57 + .../ext/standard/tests/math/atan_basic.phpt | 40 + .../ext/standard/tests/math/atan_error.phpt | 30 + .../standard/tests/math/atan_variation.phpt | 52 + .../ext/standard/tests/math/atanh_basic.phpt | 46 + .../ext/standard/tests/math/atanh_error.phpt | 35 + .../standard/tests/math/atanh_variation.phpt | 57 + .../ext/standard/tests/math/bug21523.phpt | 12 + .../ext/standard/tests/math/bug24142.phpt | 20 + .../ext/standard/tests/math/bug25665.phpt | 16 + .../ext/standard/tests/math/bug25694.phpt | 37 + .../ext/standard/tests/math/bug27646.phpt | 48 + .../ext/standard/tests/math/bug28228.phpt | 14 + .../ext/standard/tests/math/bug30069.phpt | 12 + .../ext/standard/tests/math/bug30695.phpt | 54 + .../ext/standard/tests/math/constants.phpt | 48 + .../ext/standard/tests/math/cos_basic.phpt | 92 + .../ext/standard/tests/math/cos_error.phpt | 30 + .../standard/tests/math/cos_variation.phpt | 52 + .../ext/standard/tests/math/cosh_basic.phpt | 61 + .../ext/standard/tests/math/cosh_error.phpt | 30 + .../standard/tests/math/cosh_variation.phpt | 52 + .../ext/standard/tests/math/floorceil.phpt | 44 + .../ext/standard/tests/math/hexdec.phpt | 24 + .../ext/standard/tests/math/log.phpt | 42 + .../ext/standard/tests/math/pow.phpt | 149 + .../ext/standard/tests/math/round.phpt | 37 + .../ext/standard/tests/math/sin_basic.phpt | 92 + .../ext/standard/tests/math/sin_error.phpt | 30 + .../standard/tests/math/sin_variation.phpt | 52 + .../ext/standard/tests/math/sinh_basic.phpt | 60 + .../ext/standard/tests/math/sinh_error.phpt | 30 + .../standard/tests/math/sinh_variation.phpt | 52 + .../ext/standard/tests/math/tan_basic.phpt | 41 + .../ext/standard/tests/math/tan_error.phpt | 30 + .../standard/tests/math/tan_variation.phpt | 52 + .../ext/standard/tests/math/tanh_basic.phpt | 60 + .../ext/standard/tests/math/tanh_error.phpt | 30 + .../standard/tests/math/tanh_variation.phpt | 52 + .../ext/standard/tests/network/bug20134.phpt | 24 + .../ext/standard/tests/network/bug41347.phpt | 19 + .../ext/standard/tests/network/inet.phpt | 75 + .../ext/standard/tests/network/inet_ipv6.phpt | 50 + .../ext/standard/tests/network/ip.phpt | 67 + .../ext/standard/tests/network/ip_x86_64.phpt | 67 + .../ext/standard/tests/network/shutdown.phpt | 65 + .../ext/standard/tests/network/tcp4loop.phpt | 34 + .../ext/standard/tests/network/tcp6loop.phpt | 42 + .../ext/standard/tests/network/udgloop.phpt | 37 + .../ext/standard/tests/network/udp4loop.phpt | 27 + .../ext/standard/tests/network/udp6loop.phpt | 41 + .../ext/standard/tests/network/unixloop.phpt | 44 + .../php-5.2.5/ext/standard/tests/reg/001.phpt | 7 + .../php-5.2.5/ext/standard/tests/reg/002.phpt | 7 + .../php-5.2.5/ext/standard/tests/reg/003.phpt | 8 + .../php-5.2.5/ext/standard/tests/reg/004.phpt | 14 + .../php-5.2.5/ext/standard/tests/reg/005.phpt | 18 + .../php-5.2.5/ext/standard/tests/reg/006.phpt | 8 + .../php-5.2.5/ext/standard/tests/reg/007.phpt | 10 + .../php-5.2.5/ext/standard/tests/reg/008.phpt | 8 + .../php-5.2.5/ext/standard/tests/reg/009.phpt | 17 + .../php-5.2.5/ext/standard/tests/reg/010.phpt | 7 + .../php-5.2.5/ext/standard/tests/reg/011.phpt | 7 + .../php-5.2.5/ext/standard/tests/reg/012.phpt | 7 + .../php-5.2.5/ext/standard/tests/reg/013.phpt | 7 + .../php-5.2.5/ext/standard/tests/reg/014.phpt | 7 + .../php-5.2.5/ext/standard/tests/reg/015.phpt | 6 + .../php-5.2.5/ext/standard/tests/reg/016.phpt | 6 + .../ext/standard/tests/serialize/001.phpt | 120 + .../ext/standard/tests/serialize/002.phpt | 44 + .../ext/standard/tests/serialize/003.phpt | 25 + .../ext/standard/tests/serialize/004.phpt | 33 + .../ext/standard/tests/serialize/005.phpt | 186 + .../ext/standard/tests/serialize/006.phpt | 29 + .../tests/serialize/autoload_implements.p5c | 10 + .../tests/serialize/autoload_interface.p5c | 7 + .../standard/tests/serialize/bug14293.phpt | 36 + .../standard/tests/serialize/bug21957.phpt | 49 + .../standard/tests/serialize/bug23298.phpt | 13 + .../standard/tests/serialize/bug24063.phpt | 23 + .../standard/tests/serialize/bug25378.phpt | 59 + .../standard/tests/serialize/bug26762.phpt | 27 + .../standard/tests/serialize/bug27469.phpt | 27 + .../standard/tests/serialize/bug28325.phpt | 39 + .../standard/tests/serialize/bug30234.phpt | 40 + .../standard/tests/serialize/bug31402.phpt | 87 + .../standard/tests/serialize/bug31442.phpt | 10 + .../standard/tests/serialize/bug37947.phpt | 21 + .../tests/serialize/unserializeS.phpt | 14 + .../ext/standard/tests/strings/004.phpt | 84 + .../ext/standard/tests/strings/005.phpt | 24 + .../ext/standard/tests/strings/006.phpt | 19 + .../ext/standard/tests/strings/007.phpt | 17 + .../tests/strings/add-and-stripcslashes.phpt | 26 + .../tests/strings/add-and-stripslashes.phpt | 30 + .../tests/strings/addcslashes_001.phpt | Bin 0 -> 1604 bytes .../tests/strings/addcslashes_002.phpt | 33 + .../tests/strings/addcslashes_003.phpt | Bin 0 -> 1314 bytes .../tests/strings/addcslashes_004.phpt | 30 + .../tests/strings/addslashes_basic.phpt | 39 + .../tests/strings/addslashes_error.phpt | 44 + .../tests/strings/addslashes_variation1.phpt | 170 + .../tests/strings/addslashes_variation2.phpt | 195 + .../tests/strings/addslashes_variation3.phpt | 197 + .../ext/standard/tests/strings/basename.phpt | Bin 0 -> 1148 bytes .../tests/strings/basename_basic.phpt | Bin 0 -> 3225 bytes .../tests/strings/basename_error.phpt | 58 + .../tests/strings/basename_variation.phpt | 235 + .../ext/standard/tests/strings/bin2hex.phpt | 14 + .../ext/standard/tests/strings/bug20108.phpt | 11 + .../ext/standard/tests/strings/bug20169.phpt | 14 + .../ext/standard/tests/strings/bug20261.phpt | 26 + .../ext/standard/tests/strings/bug20927.phpt | 17 + .../ext/standard/tests/strings/bug20934.phpt | 17 + .../ext/standard/tests/strings/bug21338.phpt | 10 + .../ext/standard/tests/strings/bug21453.phpt | 18 + .../ext/standard/tests/strings/bug21730.phpt | 35 + .../ext/standard/tests/strings/bug21744.phpt | 15 + .../ext/standard/tests/strings/bug22008.phpt | 24 + .../ext/standard/tests/strings/bug22187.phpt | 10 + .../ext/standard/tests/strings/bug22207.phpt | 11 + .../ext/standard/tests/strings/bug22224.phpt | 31 + .../ext/standard/tests/strings/bug22227.phpt | 9 + .../ext/standard/tests/strings/bug22904.phpt | 30 + .../ext/standard/tests/strings/bug23650.phpt | 31 + .../ext/standard/tests/strings/bug23894.phpt | 15 + .../ext/standard/tests/strings/bug24098.phpt | 19 + .../ext/standard/tests/strings/bug24208.phpt | 12 + .../ext/standard/tests/strings/bug24281.phpt | 18 + .../ext/standard/tests/strings/bug24312.phpt | 27 + .../ext/standard/tests/strings/bug25671.phpt | 23 + .../ext/standard/tests/strings/bug25707.phpt | 12 + .../ext/standard/tests/strings/bug26817.phpt | 26 + .../ext/standard/tests/strings/bug26819.phpt | 9 + .../ext/standard/tests/strings/bug26878.phpt | 9 + .../ext/standard/tests/strings/bug26973.phpt | 34 + .../ext/standard/tests/strings/bug27276.phpt | 15 + .../ext/standard/tests/strings/bug27278.phpt | 21 + .../ext/standard/tests/strings/bug27295.phpt | 14 + .../ext/standard/tests/strings/bug27457.phpt | 21 + .../ext/standard/tests/strings/bug27675.phpt | 8 + .../ext/standard/tests/strings/bug28386.phpt | 13 + .../ext/standard/tests/strings/bug28633.phpt | 10 + .../ext/standard/tests/strings/bug29075.phpt | 14 + .../ext/standard/tests/strings/bug29119.phpt | 8 + .../ext/standard/tests/strings/bug29538.phpt | 10 + .../ext/standard/tests/strings/bug33076.phpt | 14 + .../ext/standard/tests/strings/bug33605.phpt | 11 + .../ext/standard/tests/strings/bug34214.phpt | 10 + .../ext/standard/tests/strings/bug35817.phpt | 29 + .../ext/standard/tests/strings/bug36148.phpt | 29 + .../ext/standard/tests/strings/bug36306.phpt | 15 + .../ext/standard/tests/strings/bug36392.phpt | 16 + .../ext/standard/tests/strings/bug36944.phpt | 26 + .../ext/standard/tests/strings/bug37244.phpt | 18 + .../ext/standard/tests/strings/bug37262.phpt | 9 + .../ext/standard/tests/strings/bug38322.phpt | 13 + .../ext/standard/tests/strings/bug38770.phpt | 25 + .../ext/standard/tests/strings/bug39032.phpt | 18 + .../ext/standard/tests/strings/bug39350.phpt | 13 + .../ext/standard/tests/strings/bug39621.phpt | Bin 0 -> 866 bytes .../ext/standard/tests/strings/bug39873.phpt | 17 + .../ext/standard/tests/strings/bug40432.phpt | 8 + .../ext/standard/tests/strings/bug40637.phpt | 13 + .../ext/standard/tests/strings/bug40704.phpt | 13 + .../ext/standard/tests/strings/bug40754.phpt | 63 + .../ext/standard/tests/strings/bug40915.phpt | Bin 0 -> 347 bytes .../ext/standard/tests/strings/bug42107.phpt | 47 + .../ext/standard/tests/strings/bug42208.phpt | 15 + .../standard/tests/strings/chop_basic.phpt | Bin 0 -> 861 bytes .../standard/tests/strings/chop_error.phpt | 44 + .../tests/strings/chop_variation1.phpt | 210 + .../tests/strings/chop_variation2.phpt | 173 + .../tests/strings/chop_variation3.phpt | Bin 0 -> 1974 bytes .../tests/strings/chop_variation4.phpt | Bin 0 -> 1836 bytes .../tests/strings/chop_variation5.phpt | 39 + .../ext/standard/tests/strings/chr_ord.phpt | Bin 0 -> 3181 bytes .../standard/tests/strings/chunk_split.phpt | 34 + .../tests/strings/chunk_split_basic.phpt | 53 + .../tests/strings/chunk_split_error.phpt | 40 + .../tests/strings/chunk_split_variation1.phpt | 167 + .../strings/chunk_split_variation10.phpt | 86 + .../strings/chunk_split_variation11.phpt | 95 + .../strings/chunk_split_variation12.phpt | 145 + .../strings/chunk_split_variation13.phpt | 42 + .../tests/strings/chunk_split_variation2.phpt | 172 + .../tests/strings/chunk_split_variation3.phpt | 158 + .../tests/strings/chunk_split_variation4.phpt | 176 + .../tests/strings/chunk_split_variation5.phpt | Bin 0 -> 2191 bytes .../tests/strings/chunk_split_variation6.phpt | 76 + .../tests/strings/chunk_split_variation7.phpt | Bin 0 -> 2462 bytes .../tests/strings/chunk_split_variation8.phpt | 88 + .../tests/strings/chunk_split_variation9.phpt | Bin 0 -> 3344 bytes .../tests/strings/convert_cyr_string.phpt | 54 + .../standard/tests/strings/count_chars.phpt | 18 + .../ext/standard/tests/strings/crc32.phpt | 14 + .../standard/tests/strings/crc32_basic.phpt | 41 + .../standard/tests/strings/crc32_error.phpt | 47 + .../tests/strings/crc32_variation1.phpt | 196 + .../tests/strings/crc32_variation2.phpt | 149 + .../tests/strings/crc32_variation3.phpt | 161 + .../tests/strings/crc32_variation4.phpt | 117 + .../ext/standard/tests/strings/crypt.phpt | 43 + .../standard/tests/strings/dirname_basic.phpt | 153 + .../standard/tests/strings/dirname_error.phpt | 25 + .../tests/strings/dirname_variation.phpt | 143 + .../ext/standard/tests/strings/explode.phpt | 154 + .../ext/standard/tests/strings/explode1.phpt | 509 + .../standard/tests/strings/fprintf_error.phpt | 31 + .../tests/strings/fprintf_variation_001.phpt | 124 + .../tests/strings/fprintf_variation_002.phpt | 124 + .../tests/strings/fprintf_variation_003.phpt | 47 + .../strings/fprintf_variation_003_64bit.phpt | 47 + .../tests/strings/fprintf_variation_004.phpt | Bin 0 -> 734 bytes .../tests/strings/fprintf_variation_005.phpt | 46 + .../tests/strings/fprintf_variation_006.phpt | 47 + .../strings/fprintf_variation_006_64bit.phpt | 47 + .../tests/strings/fprintf_variation_007.phpt | 47 + .../strings/fprintf_variation_007_64bit.phpt | 47 + .../tests/strings/fprintf_variation_008.phpt | 48 + .../strings/fprintf_variation_008_64bit.phpt | 48 + .../tests/strings/fprintf_variation_009.phpt | 64 + ...t_html_translation_table_basic1-win32.phpt | 269 + .../get_html_translation_table_basic1.phpt | 269 + ...t_html_translation_table_basic2-win32.phpt | 673 + .../get_html_translation_table_basic2.phpt | 672 + ...t_html_translation_table_basic3-win32.phpt | 79 + .../get_html_translation_table_basic3.phpt | 78 + .../get_html_translation_table_error.phpt | 29 + ...ml_translation_table_variation1-win32.phpt | 1117 + ...get_html_translation_table_variation1.phpt | 1116 + ...ml_translation_table_variation2-win32.phpt | 220 + ...get_html_translation_table_variation2.phpt | 219 + .../standard/tests/strings/get_meta_tags.phpt | 95 + .../tests/strings/highlight_file.phpt | 68 + .../tests/strings/htmlentities-utf.phpt | 34 + .../standard/tests/strings/htmlentities.phpt | 19 + .../tests/strings/htmlentities01.phpt | 13 + .../tests/strings/htmlentities02.phpt | 21 + .../tests/strings/htmlentities03.phpt | 20 + .../tests/strings/htmlentities04.phpt | 21 + .../tests/strings/htmlentities05.phpt | 25 + .../tests/strings/htmlentities06.phpt | 22 + .../tests/strings/htmlentities07.phpt | 23 + .../tests/strings/htmlentities08.phpt | 23 + .../tests/strings/htmlentities09.phpt | 23 + .../tests/strings/htmlentities10.phpt | 16 + .../tests/strings/htmlentities11.phpt | 14 + .../tests/strings/htmlentities12.phpt | 14 + .../tests/strings/htmlentities13.phpt | 14 + .../tests/strings/htmlentities14.phpt | 14 + .../tests/strings/htmlentities15.phpt | 23 + .../tests/strings/htmlentities16.phpt | 21 + .../tests/strings/htmlentities17.phpt | 50 + .../tests/strings/htmlentities18.phpt | 40 + .../htmlspecialchars_decode_basic.phpt | 42 + .../htmlspecialchars_decode_error.phpt | 37 + .../htmlspecialchars_decode_variation1.phpt | 160 + .../htmlspecialchars_decode_variation2.phpt | 191 + .../htmlspecialchars_decode_variation3.phpt | 99 + .../htmlspecialchars_decode_variation4.phpt | 65 + .../htmlspecialchars_decode_variation5.phpt | 76 + .../htmlspecialchars_decode_variation6.phpt | Bin 0 -> 1373 bytes .../tests/strings/http_build_query.phpt | 15 + .../ext/standard/tests/strings/implode.phpt | 23 + .../ext/standard/tests/strings/implode1.phpt | Bin 0 -> 5852 bytes .../standard/tests/strings/join_basic.phpt | 43 + .../standard/tests/strings/join_error.phpt | 50 + .../tests/strings/join_variation1.phpt | 167 + .../tests/strings/join_variation2.phpt | 198 + .../tests/strings/join_variation3.phpt | 99 + .../tests/strings/join_variation4.phpt | Bin 0 -> 2213 bytes .../tests/strings/join_variation5.phpt | 50 + .../tests/strings/join_variation6.phpt | Bin 0 -> 737 bytes .../standard/tests/strings/levenshtein.phpt | 88 + .../ext/standard/tests/strings/ltrim.phpt | 83 + .../ext/standard/tests/strings/md5.phpt | 20 + .../ext/standard/tests/strings/md5_file.phpt | Bin 0 -> 3030 bytes .../ext/standard/tests/strings/md5raw.phpt | 20 + .../ext/standard/tests/strings/metaphone.phpt | 41 + .../standard/tests/strings/moneyformat.phpt | 19 + .../ext/standard/tests/strings/nl2br.phpt | 45 + .../standard/tests/strings/nl2br_error.phpt | 34 + .../tests/strings/nl2br_variation1.phpt | 80 + .../tests/strings/nl2br_variation2.phpt | 70 + .../tests/strings/nl2br_variation3.phpt | 64 + .../tests/strings/nl2br_variation4.phpt | 41 + .../tests/strings/nl2br_variation5.phpt | 150 + .../ext/standard/tests/strings/pack.phpt | 385 + .../ext/standard/tests/strings/pathinfo.phpt | 108 + .../tests/strings/php_strip_whitespace.phpt | 52 + .../ext/standard/tests/strings/printf.phpt | 697 + .../standard/tests/strings/printf_64bit.phpt | 697 + .../ext/standard/tests/strings/rtrim.phpt | Bin 0 -> 2422 bytes .../tests/strings/setlocale_basic1.phpt | 121 + .../tests/strings/setlocale_basic2.phpt | 126 + .../tests/strings/setlocale_basic3.phpt | 100 + .../tests/strings/setlocale_error.phpt | 68 + .../tests/strings/setlocale_variation1.phpt | 99 + .../tests/strings/setlocale_variation2.phpt | 90 + .../tests/strings/setlocale_variation3.phpt | 156 + .../tests/strings/setlocale_variation4.phpt | 154 + .../tests/strings/setlocale_variation5.phpt | 158 + .../ext/standard/tests/strings/sha1.phpt | 51 + .../ext/standard/tests/strings/sha1raw.phpt | 14 + .../ext/standard/tests/strings/soundex.phpt | 55 + .../tests/strings/sprintf_basic1.phpt | 41 + .../tests/strings/sprintf_basic2.phpt | 42 + .../tests/strings/sprintf_basic3.phpt | 53 + .../tests/strings/sprintf_basic4.phpt | 42 + .../tests/strings/sprintf_basic5.phpt | 42 + .../tests/strings/sprintf_basic6.phpt | 41 + .../tests/strings/sprintf_basic7.phpt | 48 + .../tests/strings/sprintf_basic8.phpt | 47 + .../tests/strings/sprintf_basic9.phpt | 54 + .../standard/tests/strings/sprintf_error.phpt | 64 + .../ext/standard/tests/strings/sprintf_f.phpt | 40 + .../standard/tests/strings/sprintf_f_2.phpt | 116 + .../standard/tests/strings/sprintf_f_3.phpt | 23 + .../tests/strings/sprintf_variation1.phpt | 270 + .../tests/strings/sprintf_variation10.phpt | 327 + .../tests/strings/sprintf_variation11.phpt | 79 + .../tests/strings/sprintf_variation12.phpt | 263 + .../tests/strings/sprintf_variation13.phpt | 358 + .../tests/strings/sprintf_variation14.phpt | 102 + .../tests/strings/sprintf_variation15.phpt | Bin 0 -> 7416 bytes .../tests/strings/sprintf_variation16.phpt | 278 + .../tests/strings/sprintf_variation17.phpt | 78 + .../tests/strings/sprintf_variation18.phpt | 230 + .../tests/strings/sprintf_variation19.phpt | 326 + .../tests/strings/sprintf_variation2.phpt | 219 + .../tests/strings/sprintf_variation20.phpt | 102 + .../tests/strings/sprintf_variation21.phpt | Bin 0 -> 5046 bytes .../tests/strings/sprintf_variation22.phpt | Bin 0 -> 2517 bytes .../tests/strings/sprintf_variation23.phpt | 78 + .../tests/strings/sprintf_variation24.phpt | Bin 0 -> 3464 bytes .../tests/strings/sprintf_variation25.phpt | Bin 0 -> 4657 bytes .../tests/strings/sprintf_variation26.phpt | Bin 0 -> 1699 bytes .../tests/strings/sprintf_variation27.phpt | Bin 0 -> 2693 bytes .../tests/strings/sprintf_variation28.phpt | 332 + .../tests/strings/sprintf_variation29.phpt | 172 + .../tests/strings/sprintf_variation3.phpt | 325 + .../tests/strings/sprintf_variation30.phpt | 78 + .../tests/strings/sprintf_variation31.phpt | 246 + .../tests/strings/sprintf_variation32.phpt | 342 + .../tests/strings/sprintf_variation33.phpt | 102 + .../tests/strings/sprintf_variation34.phpt | 332 + .../tests/strings/sprintf_variation35.phpt | 237 + .../tests/strings/sprintf_variation36.phpt | 74 + .../tests/strings/sprintf_variation37.phpt | 230 + .../tests/strings/sprintf_variation38.phpt | 326 + .../tests/strings/sprintf_variation39.phpt | 102 + .../tests/strings/sprintf_variation4.phpt | 237 + .../tests/strings/sprintf_variation40.phpt | 333 + .../tests/strings/sprintf_variation41.phpt | 316 + .../tests/strings/sprintf_variation42.phpt | 79 + .../tests/strings/sprintf_variation43.phpt | 262 + .../tests/strings/sprintf_variation44.phpt | 365 + .../tests/strings/sprintf_variation45.phpt | 102 + .../tests/strings/sprintf_variation46.phpt | 326 + .../tests/strings/sprintf_variation47.phpt | 343 + .../tests/strings/sprintf_variation48.phpt | 79 + .../tests/strings/sprintf_variation49.phpt | 278 + .../tests/strings/sprintf_variation5.phpt | 70 + .../tests/strings/sprintf_variation50.phpt | 343 + .../tests/strings/sprintf_variation51.phpt | 102 + .../tests/strings/sprintf_variation52.phpt | 63 + .../tests/strings/sprintf_variation53.phpt | 70 + .../tests/strings/sprintf_variation6.phpt | 278 + .../tests/strings/sprintf_variation7.phpt | 102 + .../tests/strings/sprintf_variation8.phpt | 374 + .../tests/strings/sprintf_variation9.phpt | 519 + .../standard/tests/strings/str_ireplace.phpt | 101 + .../ext/standard/tests/strings/str_pad.phpt | Bin 0 -> 9780 bytes .../standard/tests/strings/str_repeat.phpt | Bin 0 -> 10821 bytes .../standard/tests/strings/str_replace.phpt | 958 + .../standard/tests/strings/str_shuffle.phpt | 12 + .../tests/strings/str_split_basic.phpt | 91 + .../tests/strings/str_split_error.phpt | 38 + .../tests/strings/str_split_variation1.phpt | 241 + .../tests/strings/str_split_variation2.phpt | 290 + .../strings/str_split_variation2_64bit.phpt | 291 + .../tests/strings/str_split_variation3.phpt | Bin 0 -> 3006 bytes .../tests/strings/str_split_variation4.phpt | 196 + .../tests/strings/str_split_variation5.phpt | 176 + .../tests/strings/str_split_variation6.phpt | 166 + .../strings/str_split_variation6_64bit.phpt | 167 + .../tests/strings/str_split_variation7.phpt | 144 + .../strings/str_split_variation7_64bit.phpt | 145 + .../tests/strings/str_word_count.phpt | 249 + .../tests/strings/str_word_count1.phpt | 26 + .../standard/tests/strings/strcasecmp.phpt | Bin 0 -> 22190 bytes .../ext/standard/tests/strings/strcmp.phpt | Bin 0 -> 19960 bytes .../ext/standard/tests/strings/strcspn.phpt | 20 + .../standard/tests/strings/strcspn_basic.phpt | 41 + .../standard/tests/strings/strcspn_error.phpt | 57 + .../tests/strings/strcspn_variation1.phpt | 276 + .../tests/strings/strcspn_variation10.phpt | 272 + .../tests/strings/strcspn_variation11.phpt | 1306 + .../tests/strings/strcspn_variation12.phpt | 2482 + .../tests/strings/strcspn_variation2.phpt | 274 + .../tests/strings/strcspn_variation3.phpt | 245 + .../tests/strings/strcspn_variation4.phpt | 198 + .../tests/strings/strcspn_variation5.phpt | Bin 0 -> 2421 bytes .../tests/strings/strcspn_variation6.phpt | 177 + .../tests/strings/strcspn_variation7.phpt | 612 + .../tests/strings/strcspn_variation8.phpt | 1892 + .../tests/strings/strcspn_variation9.phpt | Bin 0 -> 2539 bytes .../standard/tests/strings/strings001.phpt | 12 + .../standard/tests/strings/strip_tags.phpt | 27 + .../tests/strings/strip_tags_basic1.phpt | 75 + .../tests/strings/strip_tags_basic2.phpt | 61 + .../tests/strings/strip_tags_error.phpt | 40 + .../tests/strings/strip_tags_variation1.phpt | 157 + .../tests/strings/strip_tags_variation10.phpt | 55 + .../tests/strings/strip_tags_variation2.phpt | 159 + .../tests/strings/strip_tags_variation3.phpt | 167 + .../tests/strings/strip_tags_variation4.phpt | 74 + .../tests/strings/strip_tags_variation5.phpt | 104 + .../tests/strings/strip_tags_variation6.phpt | 47 + .../tests/strings/strip_tags_variation7.phpt | 72 + .../tests/strings/strip_tags_variation8.phpt | 59 + .../tests/strings/strip_tags_variation9.phpt | 54 + .../ext/standard/tests/strings/stripos.phpt | 55 + .../tests/strings/stripos_basic1.phpt | 48 + .../tests/strings/stripos_basic2.phpt | 52 + .../standard/tests/strings/stripos_error.phpt | 35 + .../tests/strings/stripos_variation1.phpt | 226 + .../tests/strings/stripos_variation10.phpt | 196 + .../tests/strings/stripos_variation11.phpt | 215 + .../tests/strings/stripos_variation12.phpt | 47 + .../tests/strings/stripos_variation13.phpt | 49 + .../tests/strings/stripos_variation14.phpt | 155 + .../tests/strings/stripos_variation15.phpt | 171 + .../tests/strings/stripos_variation2.phpt | 234 + .../tests/strings/stripos_variation3.phpt | 37 + .../tests/strings/stripos_variation4.phpt | 41 + .../tests/strings/stripos_variation5.phpt | 34 + .../tests/strings/stripos_variation6.phpt | 35 + .../tests/strings/stripos_variation7.phpt | 34 + .../tests/strings/stripos_variation8.phpt | 216 + .../tests/strings/stripos_variation9.phpt | 184 + .../tests/strings/stripslashes_basic.phpt | Bin 0 -> 2036 bytes .../tests/strings/stripslashes_error.phpt | 43 + .../strings/stripslashes_variation1.phpt | 170 + .../strings/stripslashes_variation2.phpt | Bin 0 -> 9548 bytes .../strings/stripslashes_variation3.phpt | 124 + .../strings/stripslashes_variation4.phpt | 133 + .../strings/stripslashes_variation5.phpt | Bin 0 -> 8397 bytes .../ext/standard/tests/strings/stristr.phpt | 43 + .../ext/standard/tests/strings/strlen.phpt | Bin 0 -> 7030 bytes .../tests/strings/strncasecmp_basic.phpt | 46 + .../tests/strings/strncasecmp_error.phpt | 52 + .../tests/strings/strncasecmp_variation1.phpt | 135 + .../strings/strncasecmp_variation10.phpt | 184 + .../strings/strncasecmp_variation11.phpt | 185 + .../tests/strings/strncasecmp_variation2.phpt | 63 + .../tests/strings/strncasecmp_variation3.phpt | 39 + .../tests/strings/strncasecmp_variation4.phpt | 195 + .../tests/strings/strncasecmp_variation5.phpt | 147 + .../tests/strings/strncasecmp_variation6.phpt | 810 + .../tests/strings/strncasecmp_variation7.phpt | 27 + .../tests/strings/strncasecmp_variation8.phpt | 52 + .../tests/strings/strncasecmp_variation9.phpt | 92 + .../standard/tests/strings/strncmp_basic.phpt | 46 + .../standard/tests/strings/strncmp_error.phpt | 45 + .../tests/strings/strncmp_variation1.phpt | 135 + .../tests/strings/strncmp_variation2.phpt | 63 + .../tests/strings/strncmp_variation3.phpt | 39 + .../tests/strings/strncmp_variation4.phpt | 198 + .../tests/strings/strncmp_variation5.phpt | 161 + .../tests/strings/strncmp_variation6.phpt | 811 + .../tests/strings/strncmp_variation7.phpt | 24 + .../tests/strings/strncmp_variation8.phpt | 52 + .../tests/strings/strncmp_variation9.phpt | 61 + .../ext/standard/tests/strings/strpos.phpt | Bin 0 -> 9396 bytes .../ext/standard/tests/strings/strrchr.phpt | 22 + .../standard/tests/strings/strrchr_basic.phpt | 57 + .../standard/tests/strings/strrchr_error.phpt | 40 + .../tests/strings/strrchr_variation1.phpt | Bin 0 -> 4406 bytes .../tests/strings/strrchr_variation10.phpt | 188 + .../tests/strings/strrchr_variation11.phpt | 159 + .../tests/strings/strrchr_variation12.phpt | Bin 0 -> 1128 bytes .../tests/strings/strrchr_variation2.phpt | 220 + .../tests/strings/strrchr_variation3.phpt | 43 + .../tests/strings/strrchr_variation4.phpt | 58 + .../tests/strings/strrchr_variation5.phpt | 50 + .../tests/strings/strrchr_variation6.phpt | 45 + .../tests/strings/strrchr_variation7.phpt | 44 + .../tests/strings/strrchr_variation8.phpt | 41 + .../tests/strings/strrchr_variation9.phpt | 196 + .../ext/standard/tests/strings/strrev.phpt | 19 + .../standard/tests/strings/strrev_basic.phpt | 47 + .../standard/tests/strings/strrev_error.phpt | 27 + .../tests/strings/strrev_variation1.phpt | Bin 0 -> 2941 bytes .../tests/strings/strrev_variation2.phpt | Bin 0 -> 2955 bytes .../tests/strings/strrev_variation3.phpt | Bin 0 -> 1628 bytes .../tests/strings/strrev_variation4.phpt | 180 + .../ext/standard/tests/strings/strripos.phpt | 33 + .../tests/strings/strripos_offset.phpt | 45 + .../ext/standard/tests/strings/strrpos.phpt | 32 + .../tests/strings/strrpos_basic1.phpt | 45 + .../tests/strings/strrpos_basic2.phpt | 50 + .../standard/tests/strings/strrpos_error.phpt | 34 + .../tests/strings/strrpos_variation1.phpt | 182 + .../tests/strings/strrpos_variation10.phpt | 150 + .../tests/strings/strrpos_variation11.phpt | 199 + .../tests/strings/strrpos_variation12.phpt | 47 + .../tests/strings/strrpos_variation13.phpt | 49 + .../tests/strings/strrpos_variation14.phpt | 153 + .../tests/strings/strrpos_variation15.phpt | 171 + .../tests/strings/strrpos_variation2.phpt | 186 + .../tests/strings/strrpos_variation3.phpt | 37 + .../tests/strings/strrpos_variation4.phpt | 41 + .../tests/strings/strrpos_variation5.phpt | 34 + .../tests/strings/strrpos_variation6.phpt | 35 + .../tests/strings/strrpos_variation7.phpt | 32 + .../tests/strings/strrpos_variation8.phpt | 59 + .../tests/strings/strrpos_variation9.phpt | 184 + .../ext/standard/tests/strings/strspn.phpt | 18 + .../standard/tests/strings/strspn_basic.phpt | 41 + .../standard/tests/strings/strspn_error.phpt | 57 + .../tests/strings/strspn_variation1.phpt | 275 + .../tests/strings/strspn_variation10.phpt | 274 + .../tests/strings/strspn_variation11.phpt | 1306 + .../tests/strings/strspn_variation12.phpt | 2878 + .../tests/strings/strspn_variation2.phpt | 274 + .../tests/strings/strspn_variation3.phpt | 245 + .../tests/strings/strspn_variation4.phpt | 198 + .../tests/strings/strspn_variation5.phpt | Bin 0 -> 2415 bytes .../tests/strings/strspn_variation6.phpt | 179 + .../tests/strings/strspn_variation7.phpt | 612 + .../tests/strings/strspn_variation8.phpt | 1894 + .../tests/strings/strspn_variation9.phpt | Bin 0 -> 2538 bytes .../ext/standard/tests/strings/strstr.phpt | Bin 0 -> 10387 bytes .../standard/tests/strings/strtok_basic.phpt | 63 + .../standard/tests/strings/strtok_error.phpt | 55 + .../tests/strings/strtok_variation1.phpt | 172 + .../tests/strings/strtok_variation2.phpt | 172 + .../tests/strings/strtok_variation3.phpt | 150 + .../tests/strings/strtok_variation4.phpt | 110 + .../tests/strings/strtok_variation5.phpt | 150 + .../tests/strings/strtok_variation6.phpt | 160 + .../tests/strings/strtok_variation7.phpt | 108 + .../tests/strings/strtolower-win32.phpt | Bin 0 -> 4835 bytes .../standard/tests/strings/strtolower.phpt | Bin 0 -> 4773 bytes .../standard/tests/strings/strtoupper.phpt | 20 + .../tests/strings/strtoupper1-win32.phpt | Bin 0 -> 4846 bytes .../standard/tests/strings/strtoupper1.phpt | Bin 0 -> 4785 bytes .../ext/standard/tests/strings/strtr.phpt | 10 + .../standard/tests/strings/strtr_basic.phpt | 54 + .../standard/tests/strings/strtr_error.phpt | 41 + .../tests/strings/strtr_variation1.phpt | 86 + .../tests/strings/strtr_variation2.phpt | 90 + .../tests/strings/strtr_variation3.phpt | 103 + .../tests/strings/strtr_variation4.phpt | 79 + .../tests/strings/strtr_variation5.phpt | 137 + .../tests/strings/strtr_variation6.phpt | 137 + .../tests/strings/strtr_variation7.phpt | 156 + .../tests/strings/strtr_variation8.phpt | 179 + .../tests/strings/strtr_variation9.phpt | 243 + .../ext/standard/tests/strings/strval.phpt | 24 + .../ext/standard/tests/strings/substr.phpt | Bin 0 -> 4536 bytes .../tests/strings/substr_compare.phpt | 39 + .../tests/strings/substr_count_basic.phpt | 33 + .../tests/strings/substr_count_error.phpt | 65 + .../strings/substr_count_variation_001.phpt | 87 + .../strings/substr_count_variation_002.phpt | 53 + .../tests/strings/substr_replace.phpt | 810 + .../ext/standard/tests/strings/trim.phpt | 27 + .../ext/standard/tests/strings/trim1.phpt | Bin 0 -> 2010 bytes .../ext/standard/tests/strings/ucfirst.phpt | Bin 0 -> 6055 bytes .../standard/tests/strings/ucwords_basic.phpt | 84 + .../standard/tests/strings/ucwords_error.phpt | 42 + .../tests/strings/ucwords_variation1.phpt | 199 + .../tests/strings/ucwords_variation2.phpt | 96 + .../tests/strings/ucwords_variation3.phpt | 97 + .../tests/strings/ucwords_variation4.phpt | 124 + .../ext/standard/tests/strings/unpack.phpt | 11 + .../ext/standard/tests/strings/url_t.phpt | 712 + .../ext/standard/tests/strings/uuencode.phpt | 40 + .../tests/strings/vsprintf_basic1.phpt | 33 + .../tests/strings/vsprintf_basic2.phpt | 36 + .../tests/strings/vsprintf_basic3.phpt | 45 + .../tests/strings/vsprintf_basic4.phpt | 32 + .../tests/strings/vsprintf_basic5.phpt | 32 + .../tests/strings/vsprintf_basic6.phpt | 32 + .../tests/strings/vsprintf_basic7.phpt | 36 + .../tests/strings/vsprintf_basic7_64bit.phpt | 36 + .../tests/strings/vsprintf_basic8.phpt | 32 + .../tests/strings/vsprintf_basic9.phpt | 45 + .../tests/strings/vsprintf_error.phpt | 46 + .../tests/strings/vsprintf_variation1.phpt | 191 + .../tests/strings/vsprintf_variation10.phpt | Bin 0 -> 2779 bytes .../tests/strings/vsprintf_variation11.phpt | 85 + .../strings/vsprintf_variation11_64bit.phpt | 85 + .../tests/strings/vsprintf_variation12.phpt | 118 + .../strings/vsprintf_variation12_64bit.phpt | 118 + .../tests/strings/vsprintf_variation13.phpt | 85 + .../strings/vsprintf_variation13_64bit.phpt | 85 + .../tests/strings/vsprintf_variation14.phpt | 119 + .../strings/vsprintf_variation14_64bit.phpt | 119 + .../tests/strings/vsprintf_variation15.phpt | 68 + .../strings/vsprintf_variation15_64bit.phpt | 68 + .../tests/strings/vsprintf_variation16.phpt | 104 + .../strings/vsprintf_variation16_64bit.phpt | 104 + .../tests/strings/vsprintf_variation17.phpt | 64 + .../tests/strings/vsprintf_variation18.phpt | 100 + .../tests/strings/vsprintf_variation19.phpt | 91 + .../strings/vsprintf_variation19_64bit.phpt | 91 + .../tests/strings/vsprintf_variation2.phpt | 177 + .../tests/strings/vsprintf_variation3.phpt | 82 + .../tests/strings/vsprintf_variation4.phpt | 104 + .../strings/vsprintf_variation4_64bit.phpt | 104 + .../tests/strings/vsprintf_variation5.phpt | 82 + .../tests/strings/vsprintf_variation6.phpt | 100 + .../tests/strings/vsprintf_variation7.phpt | Bin 0 -> 2238 bytes .../tests/strings/vsprintf_variation8.phpt | 101 + .../tests/strings/vsprintf_variation9.phpt | Bin 0 -> 1709 bytes .../ext/standard/tests/strings/wordwrap.phpt | 37 + .../tests/strings/wordwrap_basic.phpt | 47 + .../tests/strings/wordwrap_error.phpt | 78 + .../tests/strings/wordwrap_variation1.phpt | 335 + .../tests/strings/wordwrap_variation2.phpt | 340 + .../tests/strings/wordwrap_variation3.phpt | 302 + .../tests/strings/wordwrap_variation4.phpt | 144 + .../tests/strings/wordwrap_variation5.phpt | 60 + .../ext/standard/tests/time/001.phpt | 34 + .../ext/standard/tests/time/bug38524.phpt | 31 + .../ext/standard/tests/time/idate.phpt | 32 + .../tests/versioning/version_compare.phpt | 795 + .../ext/sybase_ct/tests/bug22403.phpt | 88 + .../ext/sybase_ct/tests/bug26407.phpt | 91 + .../ext/sybase_ct/tests/bug27843.phpt | 54 + .../ext/sybase_ct/tests/bug28354.phpt | 46 + .../ext/sybase_ct/tests/bug29064.phpt | 143 + .../ext/sybase_ct/tests/bug30312.phpt | 27 + .../ext/sybase_ct/tests/bug6339.phpt | 24 + .../php-5.2.5/ext/sybase_ct/tests/index.php | 216 + .../php-5.2.5/ext/sybase_ct/tests/skipif.inc | 8 + .../php-5.2.5/ext/sybase_ct/tests/test.inc | 86 + .../ext/sybase_ct/tests/test_appname.phpt | 65 + .../ext/sybase_ct/tests/test_connect.phpt | 19 + .../test_connectionbased_msghandler.phpt | 27 + .../sybase_ct/tests/test_fetch_object.phpt | 74 + .../ext/sybase_ct/tests/test_fields.phpt | 76 + .../ext/sybase_ct/tests/test_long.phpt | 80 + .../ext/sybase_ct/tests/test_msghandler.phpt | 43 + .../tests/test_msghandler_handled.phpt | 69 + .../sybase_ct/tests/test_query_nostore.phpt | 98 + .../ext/sybase_ct/tests/test_types.phpt | 87 + .../tests/test_unbuffered_query.phpt | 57 + .../php-5.2.5/ext/sysvmsg/tests/001.phpt | 22 + .../php-5.2.5/ext/sysvmsg/tests/002.phpt | 23 + .../php-5.2.5/ext/sysvsem/tests/sysv.phpt | 114 + .../php-5.2.5/ext/sysvshm/tests/001.phpt | 42 + .../php-5.2.5/ext/sysvshm/tests/002.phpt | 67 + .../php-5.2.5/ext/sysvshm/tests/003.phpt | 54 + .../php-5.2.5/ext/sysvshm/tests/004.phpt | 40 + .../php-5.2.5/ext/sysvshm/tests/005.phpt | 68 + .../php-5.2.5/ext/sysvshm/tests/006.phpt | 48 + .../php-5.2.5/ext/sysvshm/tests/007.phpt | 41 + phpt/tests/php-5.2.5/ext/tidy/tests/001.phpt | 10 + phpt/tests/php-5.2.5/ext/tidy/tests/002.phpt | 18 + phpt/tests/php-5.2.5/ext/tidy/tests/003.phpt | 21 + phpt/tests/php-5.2.5/ext/tidy/tests/004.phpt | 17 + phpt/tests/php-5.2.5/ext/tidy/tests/005.html | 1 + phpt/tests/php-5.2.5/ext/tidy/tests/005.phpt | 18 + phpt/tests/php-5.2.5/ext/tidy/tests/006.phpt | 16 + phpt/tests/php-5.2.5/ext/tidy/tests/007.html | 1 + phpt/tests/php-5.2.5/ext/tidy/tests/007.phpt | 29 + phpt/tests/php-5.2.5/ext/tidy/tests/008.phpt | 15 + phpt/tests/php-5.2.5/ext/tidy/tests/009.phpt | 19 + phpt/tests/php-5.2.5/ext/tidy/tests/010.phpt | 317 + phpt/tests/php-5.2.5/ext/tidy/tests/011.phpt | 22 + phpt/tests/php-5.2.5/ext/tidy/tests/012.phpt | 473 + phpt/tests/php-5.2.5/ext/tidy/tests/013.html | 1 + phpt/tests/php-5.2.5/ext/tidy/tests/013.phpt | 13 + phpt/tests/php-5.2.5/ext/tidy/tests/014.phpt | 14 + phpt/tests/php-5.2.5/ext/tidy/tests/015.html | 1 + phpt/tests/php-5.2.5/ext/tidy/tests/015.phpt | 13 + phpt/tests/php-5.2.5/ext/tidy/tests/016.html | 1 + phpt/tests/php-5.2.5/ext/tidy/tests/016.phpt | 24 + phpt/tests/php-5.2.5/ext/tidy/tests/016.tcfg | 1 + phpt/tests/php-5.2.5/ext/tidy/tests/017.phpt | 17 + phpt/tests/php-5.2.5/ext/tidy/tests/018.phpt | 16 + phpt/tests/php-5.2.5/ext/tidy/tests/019.phpt | 38 + phpt/tests/php-5.2.5/ext/tidy/tests/020.phpt | 36 + phpt/tests/php-5.2.5/ext/tidy/tests/021.phpt | 18 + phpt/tests/php-5.2.5/ext/tidy/tests/022.phpt | 38 + phpt/tests/php-5.2.5/ext/tidy/tests/023.phpt | 49 + phpt/tests/php-5.2.5/ext/tidy/tests/024.phpt | 39 + phpt/tests/php-5.2.5/ext/tidy/tests/025.phpt | 50 + phpt/tests/php-5.2.5/ext/tidy/tests/026.phpt | 24 + phpt/tests/php-5.2.5/ext/tidy/tests/027.phpt | 59 + phpt/tests/php-5.2.5/ext/tidy/tests/028.phpt | 15 + phpt/tests/php-5.2.5/ext/tidy/tests/029.phpt | 28 + .../php-5.2.5/ext/tokenizer/tests/001.phpt | 259 + .../php-5.2.5/ext/tokenizer/tests/002.phpt | 982 + .../php-5.2.5/ext/tokenizer/tests/003.phpt | 46 + .../ext/tokenizer/tests/bug26463.phpt | 164 + phpt/tests/php-5.2.5/ext/wddx/tests/001.phpt | 61 + .../php-5.2.5/ext/wddx/tests/bug27287.phpt | 20 + .../php-5.2.5/ext/wddx/tests/bug34306.phpt | 14 + .../php-5.2.5/ext/wddx/tests/bug35410.phpt | 76 + .../ext/wddx/tests/bug35410_64bit.phpt | 76 + .../php-5.2.5/ext/wddx/tests/bug37569.phpt | 778 + .../php-5.2.5/ext/wddx/tests/bug37587.phpt | 34 + .../php-5.2.5/ext/wddx/tests/bug41283.phpt | 27 + .../php-5.2.5/ext/wddx/tests/bug41527.phpt | 22 + phpt/tests/php-5.2.5/ext/wddx/tests/wddx.xml | 60 + .../php-5.2.5/ext/xml/tests/bug25666.phpt | 35 + .../php-5.2.5/ext/xml/tests/bug26528.phpt | 31 + .../php-5.2.5/ext/xml/tests/bug26614.phpt | 93 + .../ext/xml/tests/bug26614_libxml.phpt | 93 + .../php-5.2.5/ext/xml/tests/bug27908.phpt | 23 + .../php-5.2.5/ext/xml/tests/bug30266.phpt | 52 + .../php-5.2.5/ext/xml/tests/bug32001.phpt | 406 + .../php-5.2.5/ext/xml/tests/bug32001b.phpt | 184 + .../php-5.2.5/ext/xml/tests/bug35447.phpt | 49 + phpt/tests/php-5.2.5/ext/xml/tests/inc.ent | 1 + phpt/tests/php-5.2.5/ext/xml/tests/skipif.inc | 10 + .../tests/php-5.2.5/ext/xml/tests/xml001.phpt | 99 + .../tests/php-5.2.5/ext/xml/tests/xml002.phpt | 100 + .../tests/php-5.2.5/ext/xml/tests/xml003.phpt | 98 + .../tests/php-5.2.5/ext/xml/tests/xml004.phpt | 64 + .../tests/php-5.2.5/ext/xml/tests/xml006.phpt | 12 + .../tests/php-5.2.5/ext/xml/tests/xml007.phpt | 53 + .../tests/php-5.2.5/ext/xml/tests/xml009.phpt | 35 + .../tests/php-5.2.5/ext/xml/tests/xml010.phpt | 39 + .../tests/php-5.2.5/ext/xml/tests/xml011.phpt | 71 + .../tests/php-5.2.5/ext/xml/tests/xmltest.xml | 20 + .../php-5.2.5/ext/xmlreader/tests/001.phpt | 29 + .../php-5.2.5/ext/xmlreader/tests/002.phpt | 41 + .../php-5.2.5/ext/xmlreader/tests/003.phpt | 84 + .../php-5.2.5/ext/xmlreader/tests/004.phpt | 44 + .../php-5.2.5/ext/xmlreader/tests/005.phpt | 37 + .../php-5.2.5/ext/xmlreader/tests/006.phpt | 36 + .../php-5.2.5/ext/xmlreader/tests/007.phpt | 57 + .../php-5.2.5/ext/xmlreader/tests/008.phpt | 71 + .../php-5.2.5/ext/xmlreader/tests/009.phpt | 28 + .../php-5.2.5/ext/xmlreader/tests/010.phpt | 27 + .../php-5.2.5/ext/xmlreader/tests/011.phpt | 34 + .../php-5.2.5/ext/xmlreader/tests/012.dtd | 2 + .../php-5.2.5/ext/xmlreader/tests/012.phpt | 69 + .../php-5.2.5/ext/xmlreader/tests/012.xml | 3 + .../php-5.2.5/ext/xmlreader/tests/013.phpt | 52 + .../php-5.2.5/ext/xmlreader/tests/013.xsd | 10 + .../ext/xmlreader/tests/bug36743.phpt | 27 + .../ext/xmlreader/tests/bug42139.phpt | 31 + .../ext/xmlreader/tests/dtdexample.dtd | 8 + .../php-5.2.5/ext/xmlreader/tests/relaxNG.rng | 11 + .../ext/xmlreader/tests/relaxNG2.rng | 23 + .../ext/xmlreader/tests/relaxNG3.rng | 8 + .../tests/php-5.2.5/ext/xmlrpc/tests/001.phpt | 66 + .../tests/php-5.2.5/ext/xmlrpc/tests/002.phpt | 56 + .../php-5.2.5/ext/xmlrpc/tests/bug37057.phpt | 64 + .../php-5.2.5/ext/xmlrpc/tests/bug38431.phpt | 25 + .../php-5.2.5/ext/xmlrpc/tests/bug40576.phpt | 77 + .../ext/xmlrpc/tests/bug40576_64bit.phpt | 77 + .../php-5.2.5/ext/xmlrpc/tests/bug42189.phpt | 15 + .../php-5.2.5/ext/xmlwriter/tests/001.phpt | 25 + .../php-5.2.5/ext/xmlwriter/tests/002.phpt | 22 + .../php-5.2.5/ext/xmlwriter/tests/003.phpt | 35 + .../php-5.2.5/ext/xmlwriter/tests/004.phpt | 36 + .../php-5.2.5/ext/xmlwriter/tests/005.phpt | 33 + .../php-5.2.5/ext/xmlwriter/tests/006.phpt | 26 + .../php-5.2.5/ext/xmlwriter/tests/007.phpt | 38 + .../php-5.2.5/ext/xmlwriter/tests/008.phpt | 40 + .../php-5.2.5/ext/xmlwriter/tests/009.phpt | 45 + .../php-5.2.5/ext/xmlwriter/tests/010.phpt | 45 + .../php-5.2.5/ext/xmlwriter/tests/OO_001.phpt | 26 + .../php-5.2.5/ext/xmlwriter/tests/OO_002.phpt | 22 + .../php-5.2.5/ext/xmlwriter/tests/OO_003.phpt | 37 + .../php-5.2.5/ext/xmlwriter/tests/OO_004.phpt | 37 + .../php-5.2.5/ext/xmlwriter/tests/OO_005.phpt | 33 + .../php-5.2.5/ext/xmlwriter/tests/OO_006.phpt | 27 + .../php-5.2.5/ext/xmlwriter/tests/OO_007.phpt | 39 + .../php-5.2.5/ext/xmlwriter/tests/OO_008.phpt | 35 + .../php-5.2.5/ext/xmlwriter/tests/OO_009.phpt | 45 + .../ext/xmlwriter/tests/bug39504.phpt | 36 + .../ext/xmlwriter/tests/bug41287.phpt | 47 + .../ext/xmlwriter/tests/bug41326.phpt | 56 + .../php-5.2.5/ext/xsl/tests/area_list.xsl | 10 + .../php-5.2.5/ext/xsl/tests/area_name.xml | 12 + .../php-5.2.5/ext/xsl/tests/bug26384.phpt | 33 + .../php-5.2.5/ext/xsl/tests/bug33853.phpt | 33 + .../php-5.2.5/ext/xsl/tests/documentxpath.xsl | 10 + phpt/tests/php-5.2.5/ext/xsl/tests/exslt.xml | 9 + phpt/tests/php-5.2.5/ext/xsl/tests/exslt.xsl | 45 + .../tests/php-5.2.5/ext/xsl/tests/prepare.inc | 20 + phpt/tests/php-5.2.5/ext/xsl/tests/skipif.inc | 1 + .../ext/xsl/tests/streamsinclude.xsl | 6 + phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xml | 28 + phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xsl | 26 + .../tests/php-5.2.5/ext/xsl/tests/xslt.xsl.gz | Bin 0 -> 395 bytes .../php-5.2.5/ext/xsl/tests/xslt001.phpt | 22 + .../php-5.2.5/ext/xsl/tests/xslt002.phpt | 29 + .../php-5.2.5/ext/xsl/tests/xslt003.phpt | 23 + .../php-5.2.5/ext/xsl/tests/xslt004.phpt | 29 + .../php-5.2.5/ext/xsl/tests/xslt005.phpt | 31 + .../php-5.2.5/ext/xsl/tests/xslt006.phpt | 23 + .../php-5.2.5/ext/xsl/tests/xslt007.phpt | 24 + .../php-5.2.5/ext/xsl/tests/xslt008.phpt | 31 + .../php-5.2.5/ext/xsl/tests/xslt009.phpt | 28 + .../php-5.2.5/ext/xsl/tests/xslt010.phpt | 115 + .../php-5.2.5/ext/xsl/tests/xslt011.phpt | 59 + .../tests/php-5.2.5/ext/xsl/tests/xslt011.xml | 1 + .../tests/php-5.2.5/ext/xsl/tests/xslt011.xsl | 25 + .../php-5.2.5/ext/xsl/tests/xslt012.phpt | 52 + .../tests/php-5.2.5/ext/xsl/tests/xslt012.xsl | 29 + phpt/tests/php-5.2.5/ext/zip/tests/001.phpt | 12 + .../php-5.2.5/ext/zip/tests/binarynull.zip | Bin 0 -> 656 bytes .../php-5.2.5/ext/zip/tests/bug11216.phpt | 28 + .../php-5.2.5/ext/zip/tests/bug38943.phpt | 50 + .../php-5.2.5/ext/zip/tests/bug38944.phpt | 40 + .../php-5.2.5/ext/zip/tests/bug40228.phpt | 23 + .../php-5.2.5/ext/zip/tests/bug40228.zip | Bin 0 -> 274 bytes .../php-5.2.5/ext/zip/tests/bug7214.phpt | 23 + .../tests/php-5.2.5/ext/zip/tests/bug7658.odt | Bin 0 -> 8873 bytes .../php-5.2.5/ext/zip/tests/bug7658.phpt | 60 + .../tests/php-5.2.5/ext/zip/tests/bug7658.xml | 2 + .../php-5.2.5/ext/zip/tests/bug8009.phpt | 27 + .../tests/php-5.2.5/ext/zip/tests/bug8009.zip | Bin 0 -> 112 bytes .../php-5.2.5/ext/zip/tests/bug8700.phpt | 30 + .../ext/zip/tests/oo_addemptydir.phpt | 36 + .../php-5.2.5/ext/zip/tests/oo_addfile.phpt | 37 + .../php-5.2.5/ext/zip/tests/oo_close.phpt | 25 + .../php-5.2.5/ext/zip/tests/oo_delete.phpt | 76 + .../php-5.2.5/ext/zip/tests/oo_ext_zip.phpt | 27 + .../php-5.2.5/ext/zip/tests/oo_extract.phpt | 95 + .../ext/zip/tests/oo_getcomment.phpt | 36 + .../ext/zip/tests/oo_getnameindex.phpt | 47 + .../ext/zip/tests/oo_namelocate.phpt | 46 + .../php-5.2.5/ext/zip/tests/oo_open.phpt | 46 + .../ext/zip/tests/oo_properties.phpt | 60 + .../php-5.2.5/ext/zip/tests/oo_rename.phpt | 58 + .../ext/zip/tests/oo_setcomment.phpt | 71 + .../php-5.2.5/ext/zip/tests/oo_stream.phpt | 50 + phpt/tests/php-5.2.5/ext/zip/tests/test.zip | Bin 0 -> 526 bytes .../ext/zip/tests/test_procedural.zip | Bin 0 -> 541 bytes .../ext/zip/tests/test_with_comment.zip | Bin 0 -> 571 bytes phpt/tests/php-5.2.5/ext/zip/tests/utils.inc | 24 + .../php-5.2.5/ext/zip/tests/zip_close.phpt | 17 + .../zip/tests/zip_entry_compressedsize.phpt | 23 + .../tests/zip_entry_compressionmethod.phpt | 24 + .../ext/zip/tests/zip_entry_filesize.phpt | 23 + .../ext/zip/tests/zip_entry_name.phpt | 23 + .../ext/zip/tests/zip_entry_open.phpt | 18 + .../ext/zip/tests/zip_entry_read.phpt | 19 + .../php-5.2.5/ext/zip/tests/zip_open.phpt | 16 + .../php-5.2.5/ext/zip/tests/zip_read.phpt | 21 + phpt/tests/php-5.2.5/ext/zlib/tests/001.phpt | 32 + phpt/tests/php-5.2.5/ext/zlib/tests/002.phpt | 24 + phpt/tests/php-5.2.5/ext/zlib/tests/003.phpt | 14 + phpt/tests/php-5.2.5/ext/zlib/tests/004.phpt | 89 + .../tests/php-5.2.5/ext/zlib/tests/004.txt.gz | Bin 0 -> 150 bytes phpt/tests/php-5.2.5/ext/zlib/tests/005.phpt | 72 + phpt/tests/php-5.2.5/ext/zlib/tests/006.phpt | 73 + phpt/tests/php-5.2.5/ext/zlib/tests/007.phpt | 51 + .../php-5.2.5/ext/zlib/tests/bug_34821.phpt | 41 + .../ext/zlib/tests/compress_zlib_wrapper.phpt | 22 + .../ext/zlib/tests/gzfilegzreadfile.phpt | 82 + .../ext/zlib/tests/gzreadgzwrite.phpt | 31 + .../ext/zlib/tests/gzreadgzwriteplain.phpt | 45 + .../ext/zlib/tests/zlib_filter_deflate.phpt | 17 + .../ext/zlib/tests/zlib_filter_inflate.phpt | 17 + phpt/tests/php-5.2.5/sapi/cgi/tests/001.phpt | 22 + phpt/tests/php-5.2.5/sapi/cgi/tests/002.phpt | 52 + phpt/tests/php-5.2.5/sapi/cgi/tests/003.phpt | 62 + phpt/tests/php-5.2.5/sapi/cgi/tests/004.phpt | 43 + phpt/tests/php-5.2.5/sapi/cgi/tests/005.phpt | 30 + phpt/tests/php-5.2.5/sapi/cgi/tests/006.phpt | 60 + phpt/tests/php-5.2.5/sapi/cgi/tests/007.phpt | 22 + phpt/tests/php-5.2.5/sapi/cgi/tests/008.phpt | 54 + phpt/tests/php-5.2.5/sapi/cgi/tests/009.phpt | 30 + .../php-5.2.5/sapi/cgi/tests/include.inc | 57 + .../tests/php-5.2.5/sapi/cgi/tests/skipif.inc | 17 + phpt/tests/php-5.2.5/sapi/cli/tests/001.phpt | 19 + .../php-5.2.5/sapi/cli/tests/002-win32.phpt | 22 + phpt/tests/php-5.2.5/sapi/cli/tests/002.phpt | 22 + .../tests/php-5.2.5/sapi/cli/tests/003-2.phpt | 25 + phpt/tests/php-5.2.5/sapi/cli/tests/003.phpt | 32 + phpt/tests/php-5.2.5/sapi/cli/tests/004.phpt | 34 + phpt/tests/php-5.2.5/sapi/cli/tests/005.phpt | 99 + phpt/tests/php-5.2.5/sapi/cli/tests/006.phpt | 330 + phpt/tests/php-5.2.5/sapi/cli/tests/007.phpt | 52 + phpt/tests/php-5.2.5/sapi/cli/tests/008.phpt | 43 + phpt/tests/php-5.2.5/sapi/cli/tests/009.phpt | 23 + .../tests/php-5.2.5/sapi/cli/tests/010-2.phpt | 35 + phpt/tests/php-5.2.5/sapi/cli/tests/010.phpt | 47 + phpt/tests/php-5.2.5/sapi/cli/tests/011.phpt | 58 + phpt/tests/php-5.2.5/sapi/cli/tests/012.phpt | 38 + phpt/tests/php-5.2.5/sapi/cli/tests/013.phpt | 34 + phpt/tests/php-5.2.5/sapi/cli/tests/014.phpt | 44 + phpt/tests/php-5.2.5/sapi/cli/tests/015.phpt | 35 + .../tests/php-5.2.5/sapi/cli/tests/skipif.inc | 7 + phpt/tests/php-5.2.5/sapi/tests/test001.phpt | 16 + phpt/tests/php-5.2.5/sapi/tests/test002.phpt | 22 + phpt/tests/php-5.2.5/sapi/tests/test003.phpt | 21 + phpt/tests/php-5.2.5/sapi/tests/test004.phpt | 26 + phpt/tests/php-5.2.5/sapi/tests/test005.phpt | 27 + phpt/tests/php-5.2.5/sapi/tests/test006.phpt | 73 + phpt/tests/php-5.2.5/sapi/tests/test007.phpt | 46 + phpt/tests/php-5.2.5/tests/basic/001.phpt | 6 + phpt/tests/php-5.2.5/tests/basic/002.phpt | 11 + phpt/tests/php-5.2.5/tests/basic/003.phpt | 14 + phpt/tests/php-5.2.5/tests/basic/004.phpt | 12 + phpt/tests/php-5.2.5/tests/basic/005.phpt | 12 + phpt/tests/php-5.2.5/tests/basic/006.phpt | 6 + phpt/tests/php-5.2.5/tests/basic/007.phpt | 6 + phpt/tests/php-5.2.5/tests/basic/008.phpt | 6 + phpt/tests/php-5.2.5/tests/basic/009.phpt | 6 + phpt/tests/php-5.2.5/tests/basic/010.phpt | 6 + phpt/tests/php-5.2.5/tests/basic/011.phpt | 27 + phpt/tests/php-5.2.5/tests/basic/012.phpt | 28 + phpt/tests/php-5.2.5/tests/basic/013.phpt | 15 + phpt/tests/php-5.2.5/tests/basic/014.phpt | 17 + phpt/tests/php-5.2.5/tests/basic/015.phpt | 15 + phpt/tests/php-5.2.5/tests/basic/016.phpt | 17 + phpt/tests/php-5.2.5/tests/basic/017.phpt | 19 + phpt/tests/php-5.2.5/tests/basic/018.phpt | 36 + phpt/tests/php-5.2.5/tests/basic/019.phpt | 19 + phpt/tests/php-5.2.5/tests/basic/020.phpt | 17 + phpt/tests/php-5.2.5/tests/basic/021.phpt | 42 + phpt/tests/php-5.2.5/tests/basic/022.phpt | 31 + phpt/tests/php-5.2.5/tests/basic/023.phpt | 19 + phpt/tests/php-5.2.5/tests/basic/024.phpt | 30 + phpt/tests/php-5.2.5/tests/basic/025.phpt | 23 + phpt/tests/php-5.2.5/tests/basic/026.phpt | 19 + phpt/tests/php-5.2.5/tests/basic/027.phpt | 35 + .../tests/php-5.2.5/tests/basic/bug20539.phpt | 11 + .../tests/php-5.2.5/tests/basic/bug29971.phpt | 15 + phpt/tests/php-5.2.5/tests/bin-info.inc | 21 + .../php-5.2.5/tests/classes/__call_001.phpt | 39 + .../php-5.2.5/tests/classes/__call_002.phpt | 15 + .../tests/classes/__set__get_001.phpt | 70 + .../tests/classes/__set__get_002.phpt | 14 + .../tests/classes/__set__get_003.phpt | 14 + .../tests/classes/__set__get_004.phpt | 37 + .../tests/classes/__set__get_005.phpt | 66 + .../tests/classes/__set_data_corrupt.phpt | 27 + .../php-5.2.5/tests/classes/abstract.phpt | 30 + .../classes/abstract_by_interface_001.phpt | 33 + .../classes/abstract_by_interface_002.phpt | 33 + .../tests/classes/abstract_class.phpt | 29 + .../tests/classes/abstract_derived.phpt | 20 + .../tests/classes/abstract_final.phpt | 16 + .../tests/classes/abstract_inherit.phpt | 22 + .../tests/classes/abstract_not_declared.phpt | 15 + .../tests/classes/abstract_redeclare.phpt | 22 + .../tests/classes/abstract_static.phpt | 36 + .../tests/classes/abstract_user_call.phpt | 30 + .../tests/classes/array_access_001.phpt | 198 + .../tests/classes/array_access_002.phpt | 198 + .../tests/classes/array_access_003.phpt | 59 + .../tests/classes/array_access_004.phpt | 57 + .../tests/classes/array_access_005.phpt | 77 + .../tests/classes/array_access_006.phpt | 37 + .../tests/classes/array_access_007.phpt | 57 + .../tests/classes/array_access_008.phpt | 67 + .../tests/classes/array_access_009.phpt | 190 + .../tests/classes/array_access_010.phpt | 168 + .../tests/classes/array_access_011.phpt | 187 + .../tests/classes/array_access_012.phpt | 36 + .../tests/classes/array_access_013.phpt | 58 + .../tests/classes/assign_op_property_001.phpt | 31 + .../php-5.2.5/tests/classes/autoload_001.phpt | 24 + .../php-5.2.5/tests/classes/autoload_002.phpt | 27 + .../php-5.2.5/tests/classes/autoload_003.phpt | 25 + .../php-5.2.5/tests/classes/autoload_004.phpt | 28 + .../php-5.2.5/tests/classes/autoload_005.phpt | 45 + .../php-5.2.5/tests/classes/autoload_006.phpt | 40 + .../tests/classes/autoload_derived.p5c | 6 + .../tests/classes/autoload_implements.p5c | 10 + .../tests/classes/autoload_interface.p5c | 7 + .../php-5.2.5/tests/classes/autoload_root.p5c | 10 + .../php-5.2.5/tests/classes/bug23951.phpt | 44 + .../php-5.2.5/tests/classes/bug24399.phpt | 12 + .../php-5.2.5/tests/classes/bug24445.phpt | 12 + .../php-5.2.5/tests/classes/bug26737.phpt | 22 + .../php-5.2.5/tests/classes/bug27468.phpt | 17 + .../php-5.2.5/tests/classes/bug27504.phpt | 25 + .../php-5.2.5/tests/classes/bug29446.phpt | 19 + .../tests/classes/class_abstract.phpt | 28 + .../tests/classes/class_example.phpt | 85 + .../php-5.2.5/tests/classes/class_final.phpt | 22 + .../tests/classes/class_stdclass.phpt | 14 + .../php-5.2.5/tests/classes/clone_001.phpt | 38 + .../php-5.2.5/tests/classes/clone_002.phpt | 40 + .../php-5.2.5/tests/classes/clone_003.phpt | 55 + .../php-5.2.5/tests/classes/clone_004.phpt | 82 + .../php-5.2.5/tests/classes/clone_005.phpt | 19 + .../php-5.2.5/tests/classes/clone_006.phpt | 36 + .../tests/classes/constants_scope_001.phpt | 33 + .../php-5.2.5/tests/classes/ctor_dtor.phpt | 35 + .../tests/classes/ctor_dtor_inheritance.phpt | 96 + .../php-5.2.5/tests/classes/ctor_failure.phpt | 33 + .../tests/classes/ctor_in_interface_01.phpt | 19 + .../tests/classes/ctor_in_interface_02.phpt | 35 + .../tests/classes/ctor_in_interface_03.phpt | 23 + .../tests/classes/ctor_in_interface_04.phpt | 26 + .../tests/classes/ctor_name_clash.phpt | 22 + .../tests/classes/ctor_visibility.phpt | 69 + .../tests/classes/dereferencing_001.phpt | 33 + .../tests/classes/destructor_and_echo.phpt | 24 + .../classes/destructor_and_exceptions.phpt | 60 + .../tests/classes/destructor_and_globals.phpt | 56 + .../classes/destructor_and_references.phpt | 26 + .../tests/classes/destructor_inheritance.phpt | 27 + .../classes/destructor_visibility_001.phpt | 24 + .../classes/destructor_visibility_002.phpt | 22 + .../classes/destructor_visibility_003.phpt | 26 + .../php-5.2.5/tests/classes/factory_001.phpt | 33 + .../classes/factory_and_singleton_001.phpt | 99 + .../classes/factory_and_singleton_002.phpt | 98 + .../classes/factory_and_singleton_003.phpt | 18 + .../classes/factory_and_singleton_004.phpt | 18 + .../classes/factory_and_singleton_005.phpt | 19 + .../classes/factory_and_singleton_006.phpt | 20 + .../classes/factory_and_singleton_007.phpt | 20 + .../classes/factory_and_singleton_008.phpt | 20 + .../classes/factory_and_singleton_009.phpt | 19 + .../classes/factory_and_singleton_010.phpt | 19 + phpt/tests/php-5.2.5/tests/classes/final.phpt | 29 + .../tests/classes/final_abstract.phpt | 16 + .../php-5.2.5/tests/classes/final_ctor1.phpt | 29 + .../php-5.2.5/tests/classes/final_ctor2.phpt | 29 + .../tests/classes/final_redeclare.phpt | 25 + .../tests/classes/incdec_property_001.phpt | 31 + .../tests/classes/incdec_property_002.phpt | 31 + .../tests/classes/incdec_property_003.phpt | 31 + .../tests/classes/incdec_property_004.phpt | 31 + .../php-5.2.5/tests/classes/inheritance.phpt | 56 + .../tests/classes/inheritance_002.phpt | 69 + .../tests/classes/inheritance_003.phpt | 21 + .../tests/classes/inheritance_004.phpt | 21 + .../tests/classes/interface_and_extends.phpt | 26 + .../tests/classes/interface_class.phpt | 14 + .../tests/classes/interface_doubled.phpt | 201 + .../tests/classes/interface_implemented.phpt | 103 + .../tests/classes/interface_instantiate.phpt | 16 + .../tests/classes/interface_member.phpt | 13 + .../tests/classes/interface_method.phpt | 15 + .../tests/classes/interface_method_final.phpt | 15 + .../classes/interface_method_private.phpt | 15 + .../interface_must_be_implemented.phpt | 17 + .../tests/classes/interface_optional_arg.phpt | 25 + .../tests/classes/interfaces_001.phpt | 24 + .../tests/classes/interfaces_002.phpt | 29 + .../tests/classes/interfaces_003.phpt | 26 + .../tests/classes/iterators_001.phpt | 200 + .../tests/classes/iterators_002.phpt | 113 + .../tests/classes/iterators_003.phpt | 115 + .../tests/classes/iterators_004.phpt | 59 + .../tests/classes/iterators_005.phpt | 19 + .../tests/classes/iterators_006.phpt | 87 + .../tests/classes/iterators_007.phpt | 43 + .../tests/classes/object_reference_001.phpt | 25 + .../php-5.2.5/tests/classes/private_001.phpt | 26 + .../php-5.2.5/tests/classes/private_002.phpt | 35 + .../php-5.2.5/tests/classes/private_003.phpt | 36 + .../php-5.2.5/tests/classes/private_003b.phpt | 37 + .../php-5.2.5/tests/classes/private_004.phpt | 32 + .../php-5.2.5/tests/classes/private_004b.phpt | 35 + .../php-5.2.5/tests/classes/private_005.phpt | 32 + .../php-5.2.5/tests/classes/private_005b.phpt | 35 + .../php-5.2.5/tests/classes/private_006.phpt | 39 + .../php-5.2.5/tests/classes/private_006b.phpt | 39 + .../php-5.2.5/tests/classes/private_007.phpt | 28 + .../php-5.2.5/tests/classes/private_007b.phpt | 29 + .../tests/classes/private_members.phpt | 101 + .../tests/classes/private_redeclare.phpt | 38 + .../tests/classes/protected_001.phpt | 26 + .../tests/classes/protected_001b.phpt | 27 + .../tests/classes/protected_002.phpt | 35 + .../tests/classes/serialize_001.phpt | 79 + .../tests/classes/singleton_001.phpt | 35 + .../php-5.2.5/tests/classes/static_mix_1.phpt | 26 + .../php-5.2.5/tests/classes/static_mix_2.phpt | 27 + .../tests/classes/static_properties_001.phpt | 25 + .../php-5.2.5/tests/classes/static_this.phpt | 39 + phpt/tests/php-5.2.5/tests/classes/this.phpt | 54 + .../php-5.2.5/tests/classes/tostring_001.phpt | 130 + .../php-5.2.5/tests/classes/tostring_002.phpt | 29 + .../php-5.2.5/tests/classes/tostring_003.phpt | 33 + .../tests/classes/type_hinting_001.phpt | 38 + .../tests/classes/type_hinting_002.phpt | 16 + .../tests/classes/type_hinting_003.phpt | 60 + .../tests/classes/visibility_000a.phpt | 33 + .../tests/classes/visibility_000b.phpt | 33 + .../tests/classes/visibility_000c.phpt | 31 + .../tests/classes/visibility_001a.phpt | 33 + .../tests/classes/visibility_001b.phpt | 33 + .../tests/classes/visibility_001c.phpt | 31 + .../tests/classes/visibility_002a.phpt | 33 + .../tests/classes/visibility_002b.phpt | 33 + .../tests/classes/visibility_002c.phpt | 31 + .../tests/classes/visibility_003a.phpt | 31 + .../tests/classes/visibility_003b.phpt | 33 + .../tests/classes/visibility_003c.phpt | 31 + .../tests/classes/visibility_004a.phpt | 31 + .../tests/classes/visibility_004b.phpt | 31 + .../tests/classes/visibility_004c.phpt | 31 + .../tests/classes/visibility_005.phpt | 59 + phpt/tests/php-5.2.5/tests/foo | 5 + phpt/tests/php-5.2.5/tests/foo2 | 3 + phpt/tests/php-5.2.5/tests/foo3 | 43 + phpt/tests/php-5.2.5/tests/foo4 | 41 + phpt/tests/php-5.2.5/tests/func/001.phpt | 6 + phpt/tests/php-5.2.5/tests/func/002.phpt | 17 + phpt/tests/php-5.2.5/tests/func/003.phpt | 98 + phpt/tests/php-5.2.5/tests/func/004.phpt | 65 + phpt/tests/php-5.2.5/tests/func/005.phpt | 19 + phpt/tests/php-5.2.5/tests/func/005a.phpt | 28 + phpt/tests/php-5.2.5/tests/func/006.phpt | 26 + phpt/tests/php-5.2.5/tests/func/007.phpt | 22 + phpt/tests/php-5.2.5/tests/func/008.phpt | 16 + phpt/tests/php-5.2.5/tests/func/009.phpt | 16 + phpt/tests/php-5.2.5/tests/lang/001.phpt | 6 + phpt/tests/php-5.2.5/tests/lang/002.phpt | 12 + phpt/tests/php-5.2.5/tests/lang/003.phpt | 19 + phpt/tests/php-5.2.5/tests/lang/004.phpt | 13 + phpt/tests/php-5.2.5/tests/lang/005.phpt | 16 + phpt/tests/php-5.2.5/tests/lang/006.phpt | 23 + phpt/tests/php-5.2.5/tests/lang/007.phpt | 27 + phpt/tests/php-5.2.5/tests/lang/008.phpt | 18 + phpt/tests/php-5.2.5/tests/lang/009.phpt | 11 + phpt/tests/php-5.2.5/tests/lang/010.phpt | 13 + phpt/tests/php-5.2.5/tests/lang/011.phpt | 23 + phpt/tests/php-5.2.5/tests/lang/012.phpt | 18 + phpt/tests/php-5.2.5/tests/lang/013.phpt | 10 + phpt/tests/php-5.2.5/tests/lang/014.phpt | 13 + phpt/tests/php-5.2.5/tests/lang/015.inc | 3 + phpt/tests/php-5.2.5/tests/lang/015.phpt | 8 + phpt/tests/php-5.2.5/tests/lang/016.inc | 5 + phpt/tests/php-5.2.5/tests/lang/016.phpt | 9 + phpt/tests/php-5.2.5/tests/lang/017.phpt | 18 + phpt/tests/php-5.2.5/tests/lang/018.phpt | 13 + phpt/tests/php-5.2.5/tests/lang/019.phpt | 15 + phpt/tests/php-5.2.5/tests/lang/020.phpt | 76 + phpt/tests/php-5.2.5/tests/lang/021.phpt | 42 + phpt/tests/php-5.2.5/tests/lang/022.phpt | 63 + phpt/tests/php-5.2.5/tests/lang/023-1.inc | 356 + phpt/tests/php-5.2.5/tests/lang/023-2.inc | 6 + phpt/tests/php-5.2.5/tests/lang/023.phpt | 256 + phpt/tests/php-5.2.5/tests/lang/024.phpt | 11623 ++++ phpt/tests/php-5.2.5/tests/lang/025.phpt | 531 + phpt/tests/php-5.2.5/tests/lang/026.phpt | 6 + phpt/tests/php-5.2.5/tests/lang/027.phpt | 12 + phpt/tests/php-5.2.5/tests/lang/028.phpt | 1058 + phpt/tests/php-5.2.5/tests/lang/030.phpt | 36 + phpt/tests/php-5.2.5/tests/lang/031.phpt | 70 + phpt/tests/php-5.2.5/tests/lang/032.phpt | 36 + phpt/tests/php-5.2.5/tests/lang/033.phpt | 53 + phpt/tests/php-5.2.5/tests/lang/034.phpt | 19 + phpt/tests/php-5.2.5/tests/lang/035.phpt | 36 + phpt/tests/php-5.2.5/tests/lang/036.phpt | 27 + phpt/tests/php-5.2.5/tests/lang/037.phpt | 30 + phpt/tests/php-5.2.5/tests/lang/038.phpt | 41 + phpt/tests/php-5.2.5/tests/lang/039.phpt | 45 + phpt/tests/php-5.2.5/tests/lang/040.phpt | 15 + phpt/tests/php-5.2.5/tests/lang/bison1.phpt | 9 + phpt/tests/php-5.2.5/tests/lang/bug17115.phpt | 16 + phpt/tests/php-5.2.5/tests/lang/bug18872.phpt | 18 + phpt/tests/php-5.2.5/tests/lang/bug19566.phpt | 10 + phpt/tests/php-5.2.5/tests/lang/bug19943.phpt | 29 + phpt/tests/php-5.2.5/tests/lang/bug20175.phpt | 165 + phpt/tests/php-5.2.5/tests/lang/bug21094.phpt | 17 + phpt/tests/php-5.2.5/tests/lang/bug21600.phpt | 39 + phpt/tests/php-5.2.5/tests/lang/bug21669.phpt | 23 + phpt/tests/php-5.2.5/tests/lang/bug21820.phpt | 13 + phpt/tests/php-5.2.5/tests/lang/bug21849.phpt | 16 + phpt/tests/php-5.2.5/tests/lang/bug21961.phpt | 58 + phpt/tests/php-5.2.5/tests/lang/bug22231.phpt | 42 + phpt/tests/php-5.2.5/tests/lang/bug22510.phpt | 126 + phpt/tests/php-5.2.5/tests/lang/bug22592.phpt | 53 + phpt/tests/php-5.2.5/tests/lang/bug22690.phpt | 12 + phpt/tests/php-5.2.5/tests/lang/bug23279.phpt | 16 + phpt/tests/php-5.2.5/tests/lang/bug23384.phpt | 33 + phpt/tests/php-5.2.5/tests/lang/bug23489.phpt | 23 + phpt/tests/php-5.2.5/tests/lang/bug23524.phpt | 29 + phpt/tests/php-5.2.5/tests/lang/bug23584.phpt | 13 + phpt/tests/php-5.2.5/tests/lang/bug23624.phpt | 12 + phpt/tests/php-5.2.5/tests/lang/bug23922.phpt | 20 + phpt/tests/php-5.2.5/tests/lang/bug24054.phpt | 24 + phpt/tests/php-5.2.5/tests/lang/bug24396.phpt | 19 + phpt/tests/php-5.2.5/tests/lang/bug24403.phpt | 20 + phpt/tests/php-5.2.5/tests/lang/bug24436.phpt | 15 + phpt/tests/php-5.2.5/tests/lang/bug24499.phpt | 24 + phpt/tests/php-5.2.5/tests/lang/bug24573.phpt | 24 + phpt/tests/php-5.2.5/tests/lang/bug24640.phpt | 31 + phpt/tests/php-5.2.5/tests/lang/bug24652.phpt | 31 + phpt/tests/php-5.2.5/tests/lang/bug24658.phpt | 56 + phpt/tests/php-5.2.5/tests/lang/bug24783.phpt | 13 + phpt/tests/php-5.2.5/tests/lang/bug24908.phpt | 18 + phpt/tests/php-5.2.5/tests/lang/bug24926.phpt | 28 + phpt/tests/php-5.2.5/tests/lang/bug24951.phpt | 42 + phpt/tests/php-5.2.5/tests/lang/bug25145.phpt | 22 + phpt/tests/php-5.2.5/tests/lang/bug25547.phpt | 30 + phpt/tests/php-5.2.5/tests/lang/bug25652.phpt | 22 + phpt/tests/php-5.2.5/tests/lang/bug25922.phpt | 23 + phpt/tests/php-5.2.5/tests/lang/bug26182.phpt | 25 + phpt/tests/php-5.2.5/tests/lang/bug26696.phpt | 28 + phpt/tests/php-5.2.5/tests/lang/bug26866.phpt | 25 + phpt/tests/php-5.2.5/tests/lang/bug26869.phpt | 15 + phpt/tests/php-5.2.5/tests/lang/bug27354.phpt | 14 + phpt/tests/php-5.2.5/tests/lang/bug27439.phpt | 76 + phpt/tests/php-5.2.5/tests/lang/bug27443.phpt | 8 + phpt/tests/php-5.2.5/tests/lang/bug27535.phpt | 28 + phpt/tests/php-5.2.5/tests/lang/bug28213.phpt | 10 + phpt/tests/php-5.2.5/tests/lang/bug28800.phpt | 17 + phpt/tests/php-5.2.5/tests/lang/bug29566.phpt | 16 + phpt/tests/php-5.2.5/tests/lang/bug29893.phpt | 11 + phpt/tests/php-5.2.5/tests/lang/bug29944.phpt | 20 + phpt/tests/php-5.2.5/tests/lang/bug30578.phpt | 31 + phpt/tests/php-5.2.5/tests/lang/bug30638.phpt | 20 + phpt/tests/php-5.2.5/tests/lang/bug30726.phpt | 8 + phpt/tests/php-5.2.5/tests/lang/bug30862.phpt | 30 + phpt/tests/php-5.2.5/tests/lang/bug32828.phpt | 21 + phpt/tests/php-5.2.5/tests/lang/bug32924.phpt | 14 + phpt/tests/php-5.2.5/tests/lang/bug35176.phpt | 14 + phpt/tests/php-5.2.5/tests/lang/bug35382.phpt | 9 + phpt/tests/php-5.2.5/tests/lang/bug38579.inc | 3 + phpt/tests/php-5.2.5/tests/lang/bug38579.phpt | 16 + phpt/tests/php-5.2.5/tests/lang/bug7515.phpt | 31 + .../tests/lang/catchable_error_001.phpt | 22 + .../tests/lang/catchable_error_002.phpt | 37 + .../tests/lang/each_binary_safety.phpt | 13 + .../tests/lang/error_2_exception_001.phpt | 42 + .../tests/lang/foreach_with_object_001.phpt | 25 + .../lang/foreach_with_references_001.phpt | 32 + phpt/tests/php-5.2.5/tests/lang/inc.inc | 3 + .../php-5.2.5/tests/lang/type_hints_001.phpt | 26 + .../php-5.2.5/tests/lang/type_hints_002.phpt | 25 + .../php-5.2.5/tests/lang/type_hints_003.phpt | 14 + phpt/tests/php-5.2.5/tests/odbc-display.php | 19 + phpt/tests/php-5.2.5/tests/odbc-t1.php | 38 + phpt/tests/php-5.2.5/tests/odbc-t2.php | 82 + phpt/tests/php-5.2.5/tests/odbc-t3.php | 95 + phpt/tests/php-5.2.5/tests/odbc-t4.php | 91 + phpt/tests/php-5.2.5/tests/odbc-t5.php | 137 + phpt/tests/php-5.2.5/tests/quicktester.inc | 75 + phpt/tests/php-5.2.5/tests/recurse | 21 + .../php-5.2.5/tests/run-test/test001.phpt | 6 + .../php-5.2.5/tests/run-test/test002.phpt | 18 + .../php-5.2.5/tests/run-test/test003.phpt | 6 + .../php-5.2.5/tests/run-test/test004.phpt | 10 + .../php-5.2.5/tests/run-test/test005.phpt | 32 + .../php-5.2.5/tests/run-test/test006.phpt | 9 + .../php-5.2.5/tests/run-test/test007.phpt | Bin 0 -> 1191 bytes .../php-5.2.5/tests/run-test/test008.phpt | 33 + .../php-5.2.5/tests/run-test/test008a.phpt | 32 + .../php-5.2.5/tests/run-test/test009.phpt | 12 + .../php-5.2.5/tests/run-test/test010.phpt | 17 + phpt/tests/php-5.2.5/tests/run.html | 11 + phpt/tests/php-5.2.5/tests/run.php | 17 + phpt/tests/php-5.2.5/tests/scan_cases | 28 + phpt/tests/php-5.2.5/tests/strings/001.phpt | 210 + phpt/tests/php-5.2.5/tests/strings/002.phpt | 83 + phpt/tests/php-5.2.5/tests/strings/004.phpt | 22 + .../php-5.2.5/tests/strings/bug22592.phpt | 27 + .../php-5.2.5/tests/strings/bug26703.phpt | 18 + phpt/tests/php-5.2.5/tests/test.pl | 34 + .../php-5.2.5/tests/test_class_inheritance | 29 + phpt/tests/php-5.2.5/tests/testarray | 21 + phpt/tests/php-5.2.5/tests/testarray.pl | 5 + phpt/tests/php-5.2.5/tests/testarray2 | 5 + phpt/tests/php-5.2.5/tests/testarray2.pl | 3 + phpt/tests/php-5.2.5/tests/testclassfunc | 9 + phpt/tests/php-5.2.5/tests/testcom | 11 + phpt/tests/php-5.2.5/tests/testcpdf | 97 + phpt/tests/php-5.2.5/tests/testcpdfclock | 87 + phpt/tests/php-5.2.5/tests/testdom | 73 + phpt/tests/php-5.2.5/tests/testfe | 18 + phpt/tests/php-5.2.5/tests/testfunc | 33 + phpt/tests/php-5.2.5/tests/testfunc.pl | 20 + phpt/tests/php-5.2.5/tests/testfunc2 | 19 + phpt/tests/php-5.2.5/tests/testfunc2.pl | 22 + phpt/tests/php-5.2.5/tests/testfuncref | 10 + phpt/tests/php-5.2.5/tests/testhyperwave | 235 + phpt/tests/php-5.2.5/tests/testinclude | 5 + phpt/tests/php-5.2.5/tests/testobj | 29 + phpt/tests/php-5.2.5/tests/testpfpro.php | 39 + phpt/tests/php-5.2.5/tests/tests.dsp | 61 + phpt/tests/php-5.2.5/tests/tests.mak | 27 + phpt/tests/php-5.2.5/tests/testscanf.php | 113 + phpt/tests/php-5.2.5/tests/testswf | 120 + src/Makefile | 44 + src/cpp/Makefile | 14 + src/cpp/base/Makefile | 15 + src/cpp/base/array/array_data.cpp | 424 + src/cpp/base/array/array_data.h | 267 + src/cpp/base/array/array_element.cpp | 31 + src/cpp/base/array/array_element.h | 132 + src/cpp/base/array/array_funcs.h | 119 + src/cpp/base/array/array_iterator.cpp | 151 + src/cpp/base/array/array_iterator.h | 132 + src/cpp/base/array/array_util.cpp | 605 + src/cpp/base/array/array_util.h | 183 + src/cpp/base/array/empty_array.cpp | 198 + src/cpp/base/array/empty_array.h | 127 + src/cpp/base/array/map.cpp | 236 + src/cpp/base/array/map.h | 363 + src/cpp/base/array/map_long.cpp | 269 + src/cpp/base/array/map_long.h | 115 + src/cpp/base/array/map_string.cpp | 282 + src/cpp/base/array/map_string.h | 117 + src/cpp/base/array/map_variant.cpp | 601 + src/cpp/base/array/map_variant.h | 155 + src/cpp/base/array/vector.cpp | 107 + src/cpp/base/array/vector.h | 166 + src/cpp/base/array/vector_long.cpp | 301 + src/cpp/base/array/vector_long.h | 123 + src/cpp/base/array/vector_string.cpp | 310 + src/cpp/base/array/vector_string.h | 123 + src/cpp/base/array/vector_variant.cpp | 413 + src/cpp/base/array/vector_variant.h | 152 + src/cpp/base/array/zend_array.cpp | 979 + src/cpp/base/array/zend_array.h | 190 + src/cpp/base/base_includes.h | 30 + src/cpp/base/builtin_functions.cpp | 375 + src/cpp/base/builtin_functions.h | 580 + src/cpp/base/class_info.cpp | 533 + src/cpp/base/class_info.h | 333 + src/cpp/base/class_statics.cpp | 80 + src/cpp/base/class_statics.h | 68 + src/cpp/base/comparisons.cpp | 112 + src/cpp/base/comparisons.h | 616 + src/cpp/base/debug/backtrace.cpp | 59 + src/cpp/base/debug/backtrace.h | 32 + src/cpp/base/dynamic_object_data.cpp | 428 + src/cpp/base/dynamic_object_data.h | 115 + src/cpp/base/execution_context.cpp | 547 + src/cpp/base/execution_context.h | 190 + src/cpp/base/file/file.cpp | 812 + src/cpp/base/file/file.h | 143 + src/cpp/base/file/mem_file.cpp | 173 + src/cpp/base/file/mem_file.h | 66 + src/cpp/base/file/output_file.cpp | 107 + src/cpp/base/file/output_file.h | 60 + src/cpp/base/file/pipe.cpp | 63 + src/cpp/base/file/pipe.h | 49 + src/cpp/base/file/plain_file.cpp | 189 + src/cpp/base/file/plain_file.h | 91 + src/cpp/base/file/socket.cpp | 145 + src/cpp/base/file/socket.h | 76 + src/cpp/base/file/temp_file.cpp | 77 + src/cpp/base/file/temp_file.h | 52 + src/cpp/base/file/url_file.cpp | 101 + src/cpp/base/file/url_file.h | 55 + src/cpp/base/file/zip_file.cpp | 112 + src/cpp/base/file/zip_file.h | 59 + src/cpp/base/frame_injection.cpp | 126 + src/cpp/base/frame_injection.h | 67 + src/cpp/base/global_array_wrapper.cpp | 34 + src/cpp/base/global_array_wrapper.h | 241 + src/cpp/base/hphp.h | 36 + src/cpp/base/hphp_ffi.cpp | 215 + src/cpp/base/hphp_ffi.h | 204 + src/cpp/base/hphp_system.h | 207 + src/cpp/base/list_assignment.cpp | 71 + src/cpp/base/list_assignment.h | 63 + src/cpp/base/macros.h | 323 + src/cpp/base/memory/leak_detectable.cpp | 307 + src/cpp/base/memory/leak_detectable.h | 90 + src/cpp/base/memory/linear_allocator.cpp | 124 + src/cpp/base/memory/linear_allocator.h | 81 + src/cpp/base/memory/memory_manager.cpp | 149 + src/cpp/base/memory/memory_manager.h | 144 + src/cpp/base/memory/smart_allocator.cpp | 527 + src/cpp/base/memory/smart_allocator.h | 401 + src/cpp/base/memory/smart_allocator.inc | 20 + src/cpp/base/memory/sweepable.cpp | 64 + src/cpp/base/memory/sweepable.h | 65 + src/cpp/base/memory/unsafe_pointer.cpp | 40 + src/cpp/base/memory/unsafe_pointer.h | 54 + src/cpp/base/object_data.cpp | 520 + src/cpp/base/object_data.h | 308 + src/cpp/base/object_offset.cpp | 19 + src/cpp/base/object_offset.h | 168 + src/cpp/base/preg.cpp | 1368 + src/cpp/base/preg.h | 59 + src/cpp/base/program_functions.cpp | 760 + src/cpp/base/program_functions.h | 84 + src/cpp/base/resource_data.cpp | 49 + src/cpp/base/resource_data.h | 137 + src/cpp/base/rtti_info.cpp | 218 + src/cpp/base/rtti_info.h | 61 + src/cpp/base/runtime_option.cpp | 655 + src/cpp/base/runtime_option.h | 236 + src/cpp/base/server/access_log.cpp | 286 + src/cpp/base/server/access_log.h | 69 + src/cpp/base/server/admin_request_handler.cpp | 537 + src/cpp/base/server/admin_request_handler.h | 53 + src/cpp/base/server/dynamic_content_cache.cpp | 80 + src/cpp/base/server/dynamic_content_cache.h | 59 + src/cpp/base/server/http_protocol.cpp | 490 + src/cpp/base/server/http_protocol.h | 61 + src/cpp/base/server/http_request_handler.cpp | 281 + src/cpp/base/server/http_request_handler.h | 58 + src/cpp/base/server/http_server.cpp | 479 + src/cpp/base/server/http_server.h | 78 + src/cpp/base/server/ip_block_map.cpp | 73 + src/cpp/base/server/ip_block_map.h | 46 + src/cpp/base/server/libevent_server.cpp | 405 + src/cpp/base/server/libevent_server.h | 181 + .../server/libevent_server_with_takeover.cpp | 300 + .../server/libevent_server_with_takeover.h | 80 + src/cpp/base/server/libevent_transport.cpp | 208 + src/cpp/base/server/libevent_transport.h | 68 + src/cpp/base/server/pagelet_server.cpp | 255 + src/cpp/base/server/pagelet_server.h | 54 + src/cpp/base/server/replay_transport.cpp | 144 + src/cpp/base/server/replay_transport.h | 72 + src/cpp/base/server/request_uri.cpp | 285 + src/cpp/base/server/request_uri.h | 92 + src/cpp/base/server/rpc_request_handler.cpp | 188 + src/cpp/base/server/rpc_request_handler.h | 63 + src/cpp/base/server/satellite_server.cpp | 219 + src/cpp/base/server/satellite_server.h | 99 + src/cpp/base/server/server.cpp | 72 + src/cpp/base/server/server.h | 246 + src/cpp/base/server/server_note.cpp | 43 + src/cpp/base/server/server_note.h | 37 + src/cpp/base/server/server_stats.cpp | 938 + src/cpp/base/server/server_stats.h | 181 + src/cpp/base/server/service_thread.cpp | 73 + src/cpp/base/server/service_thread.h | 45 + src/cpp/base/server/source_root_info.cpp | 160 + src/cpp/base/server/source_root_info.h | 56 + src/cpp/base/server/static_content_cache.cpp | 134 + src/cpp/base/server/static_content_cache.h | 60 + src/cpp/base/server/transport.cpp | 594 + src/cpp/base/server/transport.h | 309 + src/cpp/base/server/upload.cpp | 1130 + src/cpp/base/server/upload.h | 80 + src/cpp/base/server/virtual_host.cpp | 214 + src/cpp/base/server/virtual_host.h | 91 + src/cpp/base/server/xbox_server.cpp | 372 + src/cpp/base/server/xbox_server.h | 51 + .../base/shared/process_shared_variant.cpp | 255 + src/cpp/base/shared/process_shared_variant.h | 204 + src/cpp/base/shared/shared_map.cpp | 224 + src/cpp/base/shared/shared_map.h | 154 + src/cpp/base/shared/shared_store.cpp | 1346 + src/cpp/base/shared/shared_store.h | 111 + src/cpp/base/shared/shared_string.cpp | 71 + src/cpp/base/shared/shared_string.h | 90 + src/cpp/base/shared/shared_variant.cpp | 44 + src/cpp/base/shared/shared_variant.h | 73 + src/cpp/base/shared/thread_shared_variant.cpp | 342 + src/cpp/base/shared/thread_shared_variant.h | 150 + src/cpp/base/source_info.cpp | 136 + src/cpp/base/source_info.h | 107 + src/cpp/base/string_data.cpp | 442 + src/cpp/base/string_data.h | 138 + src/cpp/base/string_offset.cpp | 34 + src/cpp/base/string_offset.h | 67 + src/cpp/base/string_util.cpp | 500 + src/cpp/base/string_util.h | 136 + src/cpp/base/time/datetime.cpp | 846 + src/cpp/base/time/datetime.h | 300 + src/cpp/base/time/timestamp.cpp | 72 + src/cpp/base/time/timestamp.h | 45 + src/cpp/base/time/timezone.cpp | 225 + src/cpp/base/time/timezone.h | 130 + src/cpp/base/timeout_thread.cpp | 149 + src/cpp/base/timeout_thread.h | 60 + src/cpp/base/type_array.cpp | 1002 + src/cpp/base/type_array.h | 607 + src/cpp/base/type_object.cpp | 54 + src/cpp/base/type_object.h | 129 + src/cpp/base/type_string.cpp | 637 + src/cpp/base/type_string.h | 315 + src/cpp/base/type_variant.cpp | 2770 + src/cpp/base/type_variant.h | 760 + src/cpp/base/types.h | 212 + src/cpp/base/util/countable.cpp | 19 + src/cpp/base/util/countable.h | 90 + src/cpp/base/util/exceptions.cpp | 43 + src/cpp/base/util/exceptions.h | 238 + src/cpp/base/util/hphp_map.cpp | 418 + src/cpp/base/util/hphp_map.h | 578 + src/cpp/base/util/hphp_map_cell.h | 155 + src/cpp/base/util/hphp_vector.h | 266 + src/cpp/base/util/http_client.cpp | 192 + src/cpp/base/util/http_client.h | 92 + src/cpp/base/util/libevent_http_client.cpp | 323 + src/cpp/base/util/libevent_http_client.h | 119 + src/cpp/base/util/light_process.cpp | 545 + src/cpp/base/util/light_process.h | 80 + src/cpp/base/util/request_local.h | 72 + src/cpp/base/util/smart_object.h | 111 + src/cpp/base/util/smart_ptr.h | 122 + src/cpp/base/util/string_buffer.cpp | 217 + src/cpp/base/util/string_buffer.h | 109 + src/cpp/base/variable_serializer.cpp | 658 + src/cpp/base/variable_serializer.h | 127 + src/cpp/base/variable_table.cpp | 27 + src/cpp/base/variable_table.h | 97 + src/cpp/base/variable_unserializer.h | 64 + src/cpp/base/zend/intl_convert.cpp | 112 + src/cpp/base/zend/intl_convert.h | 36 + src/cpp/base/zend/utf8_decode.c | 179 + src/cpp/base/zend/utf8_decode.h | 39 + src/cpp/base/zend/utf8_to_utf16.c | 65 + src/cpp/base/zend/utf8_to_utf16.h | 25 + src/cpp/base/zend/zend_collator.cpp | 610 + src/cpp/base/zend/zend_collator.h | 39 + src/cpp/base/zend/zend_functions.cpp | 244 + src/cpp/base/zend/zend_functions.h | 98 + src/cpp/base/zend/zend_html.cpp | 538 + src/cpp/base/zend/zend_html.h | 57 + src/cpp/base/zend/zend_math.h | 94 + src/cpp/base/zend/zend_md5.cpp | 328 + src/cpp/base/zend/zend_multiply.h | 43 + src/cpp/base/zend/zend_pack.cpp | 799 + src/cpp/base/zend/zend_pack.h | 86 + src/cpp/base/zend/zend_php_config.h | 2414 + src/cpp/base/zend/zend_printf.cpp | 1575 + src/cpp/base/zend/zend_printf.h | 37 + src/cpp/base/zend/zend_rand.cpp | 246 + src/cpp/base/zend/zend_scanf.cpp | 1042 + src/cpp/base/zend/zend_scanf.h | 35 + src/cpp/base/zend/zend_sha1.cpp | 314 + src/cpp/base/zend/zend_string.cpp | 3492 + src/cpp/base/zend/zend_string.h | 333 + src/cpp/base/zend/zend_strtod.cpp | 2535 + src/cpp/base/zend/zend_strtod.h | 38 + src/cpp/base/zend/zend_url.cpp | 466 + src/cpp/base/zend/zend_url.h | 58 + src/cpp/eval/Makefile | 19 + src/cpp/eval/analysis/block.cpp | 105 + src/cpp/eval/analysis/block.h | 78 + src/cpp/eval/ast/array_element_expression.cpp | 149 + src/cpp/eval/ast/array_element_expression.h | 52 + src/cpp/eval/ast/array_expression.cpp | 112 + src/cpp/eval/ast/array_expression.h | 76 + src/cpp/eval/ast/assignment_op_expression.cpp | 62 + src/cpp/eval/ast/assignment_op_expression.h | 47 + .../eval/ast/assignment_ref_expression.cpp | 42 + src/cpp/eval/ast/assignment_ref_expression.h | 44 + src/cpp/eval/ast/binary_op_expression.cpp | 108 + src/cpp/eval/ast/binary_op_expression.h | 44 + src/cpp/eval/ast/break_statement.cpp | 57 + src/cpp/eval/ast/break_statement.h | 43 + .../eval/ast/class_constant_expression.cpp | 43 + src/cpp/eval/ast/class_constant_expression.h | 43 + src/cpp/eval/ast/class_statement.cpp | 419 + src/cpp/eval/ast/class_statement.h | 134 + src/cpp/eval/ast/constant_expression.cpp | 42 + src/cpp/eval/ast/constant_expression.h | 42 + src/cpp/eval/ast/construct.cpp | 43 + src/cpp/eval/ast/construct.h | 83 + src/cpp/eval/ast/do_while_statement.cpp | 48 + src/cpp/eval/ast/do_while_statement.h | 43 + src/cpp/eval/ast/echo_statement.cpp | 48 + src/cpp/eval/ast/echo_statement.h | 42 + src/cpp/eval/ast/encaps_list_expression.cpp | 54 + src/cpp/eval/ast/encaps_list_expression.h | 43 + src/cpp/eval/ast/expr_statement.cpp | 40 + src/cpp/eval/ast/expr_statement.h | 42 + src/cpp/eval/ast/expression.cpp | 59 + src/cpp/eval/ast/expression.h | 50 + src/cpp/eval/ast/for_statement.cpp | 58 + src/cpp/eval/ast/for_statement.h | 49 + src/cpp/eval/ast/foreach_statement.cpp | 65 + src/cpp/eval/ast/foreach_statement.h | 47 + src/cpp/eval/ast/function_call_expression.cpp | 47 + src/cpp/eval/ast/function_call_expression.h | 41 + src/cpp/eval/ast/function_statement.cpp | 318 + src/cpp/eval/ast/function_statement.h | 107 + src/cpp/eval/ast/global_statement.cpp | 48 + src/cpp/eval/ast/global_statement.h | 43 + src/cpp/eval/ast/if_statement.cpp | 80 + src/cpp/eval/ast/if_statement.h | 57 + src/cpp/eval/ast/inc_op_expression.cpp | 65 + src/cpp/eval/ast/inc_op_expression.h | 44 + src/cpp/eval/ast/include_expression.cpp | 57 + src/cpp/eval/ast/include_expression.h | 47 + src/cpp/eval/ast/instanceof_expression.cpp | 45 + src/cpp/eval/ast/instanceof_expression.h | 43 + src/cpp/eval/ast/isset_expression.cpp | 46 + src/cpp/eval/ast/isset_expression.h | 41 + .../eval/ast/list_assignment_expression.cpp | 78 + src/cpp/eval/ast/list_assignment_expression.h | 69 + src/cpp/eval/ast/lval_expression.cpp | 93 + src/cpp/eval/ast/lval_expression.h | 50 + src/cpp/eval/ast/method_statement.cpp | 155 + src/cpp/eval/ast/method_statement.h | 58 + src/cpp/eval/ast/name.cpp | 85 + src/cpp/eval/ast/name.h | 68 + src/cpp/eval/ast/new_object_expression.cpp | 45 + src/cpp/eval/ast/new_object_expression.h | 43 + src/cpp/eval/ast/object_method_expression.cpp | 68 + src/cpp/eval/ast/object_method_expression.h | 43 + .../eval/ast/object_property_expression.cpp | 157 + src/cpp/eval/ast/object_property_expression.h | 51 + src/cpp/eval/ast/qop_expression.cpp | 47 + src/cpp/eval/ast/qop_expression.h | 44 + src/cpp/eval/ast/ref_param_expression.cpp | 61 + src/cpp/eval/ast/ref_param_expression.h | 47 + src/cpp/eval/ast/return_statement.cpp | 54 + src/cpp/eval/ast/return_statement.h | 42 + src/cpp/eval/ast/scalar_expression.cpp | 114 + src/cpp/eval/ast/scalar_expression.h | 59 + .../ast/simple_function_call_expression.cpp | 100 + .../ast/simple_function_call_expression.h | 48 + src/cpp/eval/ast/statement.h | 64 + src/cpp/eval/ast/statement_list_statement.cpp | 51 + src/cpp/eval/ast/statement_list_statement.h | 45 + src/cpp/eval/ast/static_member_expression.cpp | 53 + src/cpp/eval/ast/static_member_expression.h | 44 + src/cpp/eval/ast/static_method_expression.cpp | 67 + src/cpp/eval/ast/static_method_expression.h | 44 + src/cpp/eval/ast/static_statement.cpp | 70 + src/cpp/eval/ast/static_statement.h | 57 + src/cpp/eval/ast/strong_foreach_statement.cpp | 66 + src/cpp/eval/ast/strong_foreach_statement.h | 47 + src/cpp/eval/ast/switch_statement.cpp | 94 + src/cpp/eval/ast/switch_statement.h | 60 + src/cpp/eval/ast/this_expression.cpp | 42 + src/cpp/eval/ast/this_expression.h | 40 + src/cpp/eval/ast/throw_statement.cpp | 41 + src/cpp/eval/ast/throw_statement.h | 42 + src/cpp/eval/ast/try_statement.cpp | 85 + src/cpp/eval/ast/try_statement.h | 59 + src/cpp/eval/ast/unary_op_expression.cpp | 109 + src/cpp/eval/ast/unary_op_expression.h | 44 + src/cpp/eval/ast/unset_statement.cpp | 54 + src/cpp/eval/ast/unset_statement.h | 43 + src/cpp/eval/ast/variable_expression.cpp | 114 + src/cpp/eval/ast/variable_expression.h | 48 + src/cpp/eval/ast/while_statement.cpp | 48 + src/cpp/eval/ast/while_statement.h | 43 + src/cpp/eval/base/ast_ptr.h | 50 + src/cpp/eval/base/eval_base.h | 43 + src/cpp/eval/base/function.h | 54 + src/cpp/eval/eval.cpp | 154 + src/cpp/eval/eval.h | 50 + src/cpp/eval/ext/ext.cpp | 253 + src/cpp/eval/ext/ext.h | 43 + src/cpp/eval/gen.mk | 16 + src/cpp/eval/parser/hphp.x | 701 + src/cpp/eval/parser/hphp.y | 861 + src/cpp/eval/parser/parser.cpp | 1129 + src/cpp/eval/parser/parser.h | 192 + src/cpp/eval/parser/parser_defines.h | 50 + src/cpp/eval/parser/scanner.cpp | 311 + src/cpp/eval/parser/scanner.h | 188 + src/cpp/eval/runtime/arg_stack.cpp | 65 + src/cpp/eval/runtime/arg_stack.h | 46 + src/cpp/eval/runtime/assoc_list.cpp | 70 + src/cpp/eval/runtime/assoc_list.h | 52 + src/cpp/eval/runtime/eval_frame_injection.cpp | 42 + src/cpp/eval/runtime/eval_frame_injection.h | 52 + src/cpp/eval/runtime/eval_object_data.cpp | 390 + src/cpp/eval/runtime/eval_object_data.h | 103 + src/cpp/eval/runtime/eval_state.cpp | 479 + src/cpp/eval/runtime/eval_state.h | 176 + src/cpp/eval/runtime/file_repository.cpp | 166 + src/cpp/eval/runtime/file_repository.h | 78 + src/cpp/eval/runtime/variable_environment.cpp | 256 + src/cpp/eval/runtime/variable_environment.h | 155 + src/cpp/eval/strict_mode.cpp | 42 + src/cpp/eval/strict_mode.h | 49 + src/cpp/ext/JSON_parser.cpp | 788 + src/cpp/ext/JSON_parser.h | 22 + src/cpp/ext/Makefile | 16 + src/cpp/ext/README | 79 + src/cpp/ext/bcmath/add.c | 88 + src/cpp/ext/bcmath/bcmath.h | 169 + src/cpp/ext/bcmath/compare.c | 161 + src/cpp/ext/bcmath/config.h | 6 + src/cpp/ext/bcmath/debug.c | 69 + src/cpp/ext/bcmath/div.c | 274 + src/cpp/ext/bcmath/divmod.c | 87 + src/cpp/ext/bcmath/doaddsub.c | 232 + src/cpp/ext/bcmath/init.c | 129 + src/cpp/ext/bcmath/int2num.c | 84 + src/cpp/ext/bcmath/nearzero.c | 69 + src/cpp/ext/bcmath/neg.c | 49 + src/cpp/ext/bcmath/num2long.c | 70 + src/cpp/ext/bcmath/num2str.c | 79 + src/cpp/ext/bcmath/outofmem.c | 46 + src/cpp/ext/bcmath/output.c | 208 + src/cpp/ext/bcmath/private.h | 43 + src/cpp/ext/bcmath/raise.c | 124 + src/cpp/ext/bcmath/raisemod.c | 98 + src/cpp/ext/bcmath/recmul.c | 306 + src/cpp/ext/bcmath/rmzero.c | 55 + src/cpp/ext/bcmath/rt.c | 65 + src/cpp/ext/bcmath/sqrt.c | 129 + src/cpp/ext/bcmath/str2num.c | 109 + src/cpp/ext/bcmath/sub.c | 90 + src/cpp/ext/bcmath/zero.c | 64 + src/cpp/ext/crutch.cpp | 132 + src/cpp/ext/crutch.h | 64 + src/cpp/ext/ext.h | 74 + src/cpp/ext/ext_apache.cpp | 113 + src/cpp/ext/ext_apache.h | 49 + src/cpp/ext/ext_apc.cpp | 364 + src/cpp/ext/ext_apc.h | 91 + src/cpp/ext/ext_apd.cpp | 62 + src/cpp/ext/ext_apd.h | 41 + src/cpp/ext/ext_array.cpp | 994 + src/cpp/ext/ext_array.h | 348 + src/cpp/ext/ext_bcmath.cpp | 232 + src/cpp/ext/ext_bcmath.h | 43 + src/cpp/ext/ext_class.cpp | 177 + src/cpp/ext/ext_class.h | 52 + src/cpp/ext/ext_ctype.cpp | 98 + src/cpp/ext/ext_ctype.h | 43 + src/cpp/ext/ext_curl.cpp | 1102 + src/cpp/ext/ext_curl.h | 59 + src/cpp/ext/ext_datetime.cpp | 150 + src/cpp/ext/ext_datetime.h | 387 + src/cpp/ext/ext_domdocument.cpp | 3254 + src/cpp/ext/ext_domdocument.h | 610 + src/cpp/ext/ext_error.cpp | 136 + src/cpp/ext/ext_error.h | 43 + src/cpp/ext/ext_fbml.cpp | 650 + src/cpp/ext/ext_fbml.h | 52 + src/cpp/ext/ext_file.cpp | 1277 + src/cpp/ext/ext_file.h | 161 + src/cpp/ext/ext_function.cpp | 192 + src/cpp/ext/ext_function.h | 65 + src/cpp/ext/ext_hash.cpp | 365 + src/cpp/ext/ext_hash.h | 42 + src/cpp/ext/ext_hotprofiler.cpp | 849 + src/cpp/ext/ext_iconv.cpp | 1813 + src/cpp/ext/ext_iconv.h | 43 + src/cpp/ext/ext_icu.cpp | 88 + src/cpp/ext/ext_icu.h | 33 + src/cpp/ext/ext_idn.cpp | 118 + src/cpp/ext/ext_idn.h | 35 + src/cpp/ext/ext_image.cpp | 7574 +++ src/cpp/ext/ext_image.h | 162 + src/cpp/ext/ext_ipc.cpp | 711 + src/cpp/ext/ext_ipc.h | 62 + src/cpp/ext/ext_json.cpp | 94 + src/cpp/ext/ext_json.h | 34 + src/cpp/ext/ext_ldap.cpp | 332 + src/cpp/ext/ext_ldap.h | 75 + src/cpp/ext/ext_magick.cpp | 2910 + src/cpp/ext/ext_magick.h | 460 + src/cpp/ext/ext_mailparse.cpp | 224 + src/cpp/ext/ext_mailparse.h | 48 + src/cpp/ext/ext_math.cpp | 162 + src/cpp/ext/ext_math.h | 110 + src/cpp/ext/ext_mb.cpp | 4120 ++ src/cpp/ext/ext_mb.h | 87 + src/cpp/ext/ext_mcrypt.cpp | 589 + src/cpp/ext/ext_mcrypt.h | 69 + src/cpp/ext/ext_misc.cpp | 448 + src/cpp/ext/ext_misc.h | 59 + src/cpp/ext/ext_mysql.cpp | 1236 + src/cpp/ext/ext_mysql.h | 392 + src/cpp/ext/ext_network.cpp | 829 + src/cpp/ext/ext_network.h | 118 + src/cpp/ext/ext_openssl.cpp | 2284 + src/cpp/ext/ext_openssl.h | 71 + src/cpp/ext/ext_options.cpp | 586 + src/cpp/ext/ext_options.h | 81 + src/cpp/ext/ext_oracle.cpp | 294 + src/cpp/ext/ext_oracle.h | 70 + src/cpp/ext/ext_output.cpp | 67 + src/cpp/ext/ext_output.h | 113 + src/cpp/ext/ext_posix.cpp | 234 + src/cpp/ext/ext_posix.h | 158 + src/cpp/ext/ext_preg.cpp | 127 + src/cpp/ext/ext_preg.h | 65 + src/cpp/ext/ext_process.cpp | 739 + src/cpp/ext/ext_process.h | 87 + src/cpp/ext/ext_reflection.cpp | 321 + src/cpp/ext/ext_reflection.h | 43 + src/cpp/ext/ext_server.cpp | 152 + src/cpp/ext/ext_server.h | 42 + src/cpp/ext/ext_simplexml.cpp | 773 + src/cpp/ext/ext_simplexml.h | 99 + src/cpp/ext/ext_simplexml_include.h | 32 + src/cpp/ext/ext_soap.cpp | 2872 + src/cpp/ext/ext_soap.h | 260 + src/cpp/ext/ext_socket.cpp | 1085 + src/cpp/ext/ext_socket.h | 63 + src/cpp/ext/ext_sqlite3.cpp | 664 + src/cpp/ext/ext_sqlite3.h | 154 + src/cpp/ext/ext_stream.cpp | 237 + src/cpp/ext/ext_stream.h | 204 + src/cpp/ext/ext_string.cpp | 767 + src/cpp/ext/ext_string.h | 348 + src/cpp/ext/ext_thread.cpp | 37 + src/cpp/ext/ext_thread.h | 35 + src/cpp/ext/ext_thrift.cpp | 719 + src/cpp/ext/ext_thrift.h | 34 + src/cpp/ext/ext_url.cpp | 249 + src/cpp/ext/ext_url.h | 55 + src/cpp/ext/ext_variable.cpp | 167 + src/cpp/ext/ext_variable.h | 255 + src/cpp/ext/ext_xml.cpp | 251 + src/cpp/ext/ext_xml.h | 56 + src/cpp/ext/ext_xmlwriter.cpp | 766 + src/cpp/ext/ext_xmlwriter.h | 135 + src/cpp/ext/ext_zlib.cpp | 127 + src/cpp/ext/ext_zlib.h | 87 + src/cpp/ext/fql/fql.cpp | 1577 + src/cpp/ext/fql/fql.h | 42 + src/cpp/ext/fql/fql_multiparse.cpp | 77 + src/cpp/ext/fql/fql_parser.cpp | 150 + src/cpp/ext/fql/fqlnode.cpp | 173 + src/cpp/ext/fql/fqlnode.h | 491 + src/cpp/ext/fql/lexer.cpp | 2212 + src/cpp/ext/hash/hash_adler32.cpp | 58 + src/cpp/ext/hash/hash_adler32.h | 39 + src/cpp/ext/hash/hash_crc32.cpp | 65 + src/cpp/ext/hash/hash_crc32.h | 42 + src/cpp/ext/hash/hash_engine.h | 51 + src/cpp/ext/hash/hash_gost.cpp | 317 + src/cpp/ext/hash/hash_gost.h | 39 + src/cpp/ext/hash/hash_haval.cpp | 551 + src/cpp/ext/hash/hash_haval.h | 43 + src/cpp/ext/hash/hash_md.cpp | 606 + src/cpp/ext/hash/hash_md.h | 59 + src/cpp/ext/hash/hash_ripemd.cpp | 775 + src/cpp/ext/hash/hash_ripemd.h | 69 + src/cpp/ext/hash/hash_salsa.cpp | 200 + src/cpp/ext/hash/hash_salsa.h | 42 + src/cpp/ext/hash/hash_sha.cpp | 841 + src/cpp/ext/hash/hash_sha.h | 69 + src/cpp/ext/hash/hash_snefru.cpp | 191 + src/cpp/ext/hash/hash_snefru.h | 39 + src/cpp/ext/hash/hash_tiger.cpp | 265 + src/cpp/ext/hash/hash_tiger.h | 43 + src/cpp/ext/hash/hash_whirlpool.cpp | 450 + src/cpp/ext/hash/hash_whirlpool.h | 39 + src/cpp/ext/hash/php_hash_crc32_tables.h | 148 + src/cpp/ext/hash/php_hash_gost_tables.h | 154 + src/cpp/ext/hash/php_hash_snefru_tables.h | 941 + src/cpp/ext/hash/php_hash_tiger_tables.h | 547 + src/cpp/ext/hash/php_hash_whirlpool_tables.h | 584 + src/cpp/ext/php_unicode.h | 192 + src/cpp/ext/phpmcc/Makefile | 20 + src/cpp/ext/phpmcc/ext_php_mcc.h | 22 + src/cpp/ext/phpmcc/release/Makefile | 16 + src/cpp/ext/phpmcc/release/ext_php_mcc.cpp | 3568 + src/cpp/ext/phpmcc/release/ext_php_mcc.h | 165 + src/cpp/ext/phpmcc/release/ext_php_mcc_impl.h | 126 + .../ext/phpmcc/release/ext_php_mcc_resource.h | 189 + src/cpp/ext/profile/extprofile_apache.h | 185 + src/cpp/ext/profile/extprofile_apc.h | 203 + src/cpp/ext/profile/extprofile_apd.h | 113 + src/cpp/ext/profile/extprofile_array.h | 725 + src/cpp/ext/profile/extprofile_bcmath.h | 122 + src/cpp/ext/profile/extprofile_class.h | 167 + src/cpp/ext/profile/extprofile_ctype.h | 131 + src/cpp/ext/profile/extprofile_curl.h | 248 + src/cpp/ext/profile/extprofile_datetime.h | 349 + src/cpp/ext/profile/extprofile_domdocument.h | 16 + src/cpp/ext/profile/extprofile_error.h | 131 + src/cpp/ext/profile/extprofile_fbml.h | 212 + src/cpp/ext/profile/extprofile_file.h | 833 + src/cpp/ext/profile/extprofile_function.h | 158 + src/cpp/ext/profile/extprofile_hash.h | 122 + src/cpp/ext/profile/extprofile_iconv.h | 131 + src/cpp/ext/profile/extprofile_icu.h | 41 + src/cpp/ext/profile/extprofile_idn.h | 59 + src/cpp/ext/profile/extprofile_image.h | 995 + src/cpp/ext/profile/extprofile_ipc.h | 185 + src/cpp/ext/profile/extprofile_json.h | 50 + src/cpp/ext/profile/extprofile_ldap.h | 419 + src/cpp/ext/profile/extprofile_magick.h | 3884 ++ src/cpp/ext/profile/extprofile_mailparse.h | 176 + src/cpp/ext/profile/extprofile_math.h | 464 + src/cpp/ext/profile/extprofile_mb.h | 527 + src/cpp/ext/profile/extprofile_mcrypt.h | 365 + src/cpp/ext/profile/extprofile_misc.h | 275 + src/cpp/ext/profile/extprofile_mysql.h | 473 + src/cpp/ext/profile/extprofile_network.h | 302 + src/cpp/ext/profile/extprofile_openssl.h | 383 + src/cpp/ext/profile/extprofile_options.h | 473 + src/cpp/ext/profile/extprofile_oracle.h | 374 + src/cpp/ext/profile/extprofile_output.h | 221 + src/cpp/ext/profile/extprofile_php_mcc.h | 16 + src/cpp/ext/profile/extprofile_posix.h | 347 + src/cpp/ext/profile/extprofile_preg.h | 167 + src/cpp/ext/profile/extprofile_process.h | 266 + src/cpp/ext/profile/extprofile_reflection.h | 131 + src/cpp/ext/profile/extprofile_server.h | 122 + src/cpp/ext/profile/extprofile_simplexml.h | 79 + src/cpp/ext/profile/extprofile_soap.h | 34 + src/cpp/ext/profile/extprofile_socket.h | 266 + src/cpp/ext/profile/extprofile_sqlite3.h | 16 + src/cpp/ext/profile/extprofile_stream.h | 392 + src/cpp/ext/profile/extprofile_string.h | 851 + src/cpp/ext/profile/extprofile_thread.h | 59 + src/cpp/ext/profile/extprofile_thrift.h | 50 + src/cpp/ext/profile/extprofile_url.h | 122 + src/cpp/ext/profile/extprofile_variable.h | 302 + src/cpp/ext/profile/extprofile_xml.h | 248 + src/cpp/ext/profile/extprofile_xmlwriter.h | 394 + src/cpp/ext/profile/extprofile_zlib.h | 230 + src/cpp/ext/soap/encoding.cpp | 3309 + src/cpp/ext/soap/encoding.h | 254 + src/cpp/ext/soap/packet.cpp | 424 + src/cpp/ext/soap/packet.h | 34 + src/cpp/ext/soap/schema.cpp | 2004 + src/cpp/ext/soap/sdl.cpp | 983 + src/cpp/ext/soap/sdl.h | 319 + src/cpp/ext/soap/soap.cpp | 151 + src/cpp/ext/soap/soap.h | 182 + src/cpp/ext/soap/xml.cpp | 295 + src/cpp/ext/soap/xml.h | 94 + src/cpp/ext/unicode_data.h | 2754 + src/cpp/makeall.sh | 3 + src/cpp/tmp/Makefile | 17 + src/cpp/tmp/README | 2 + src/cpp/tmp/cleanup.sh | 4 + src/crutch.php | 72 + src/default.mk | 60 + src/droptables.sql | 3 + src/ffi/hs/HphpFFI.hs | 294 + src/ffi/hs/Utils.hs | 13 + src/ffi/java/Makefile | 37 + src/ffi/java/hphp/Hphp.java | 133 + src/ffi/java/hphp/HphpArray.java | 73 + src/ffi/java/hphp/HphpArrayIterator.java | 51 + src/ffi/java/hphp/HphpBoolean.java | 40 + src/ffi/java/hphp/HphpDouble.java | 24 + src/ffi/java/hphp/HphpInt64.java | 23 + src/ffi/java/hphp/HphpNull.java | 24 + src/ffi/java/hphp/HphpObject.java | 15 + src/ffi/java/hphp/HphpSession.java | 26 + src/ffi/java/hphp/HphpString.java | 26 + src/ffi/java/hphp/HphpVariant.java | 24 + src/ffi/java/hphp_ffi_java.cpp | 403 + src/ffi/swig/swig.h | 340 + src/ffi/swig/swig.i | 78 + src/hphp/Makefile | 20 + src/hphp/hook.mk | 14 + src/hphp/main.cpp | 789 + src/hphp/makefile_mono | 21 + src/hphpi/Makefile | 16 + src/hphpi/hphpi.php | 8 + src/hphpi/hphpi_build.hdf | 1 + src/idl/Makefile | 61 + src/idl/apache.idl.php | 35 + src/idl/apc.idl.php | 98 + src/idl/apd.idl.php | 35 + src/idl/array.idl.php | 364 + src/idl/base.php | 850 + src/idl/bcmath.idl.php | 53 + src/idl/class.idl.php | 61 + src/idl/ctype.idl.php | 18 + src/idl/curl.idl.php | 109 + src/idl/datetime.idl.php | 237 + src/idl/domdocument.idl.php | 461 + src/idl/error.idl.php | 39 + src/idl/fbml.idl.php | 92 + src/idl/file.idl.php | 299 + src/idl/function.idl.php | 57 + src/idl/hash.idl.php | 53 + src/idl/iconv.idl.php | 57 + src/idl/icu.idl.php | 9 + src/idl/idl.php | 337 + src/idl/idl_list.php | 37 + src/idl/idn.idl.php | 17 + src/idl/image.idl.php | 582 + src/idl/ipc.idl.php | 87 + src/idl/json.idl.php | 9 + src/idl/ldap.idl.php | 211 + src/idl/magick.idl.php | 1599 + src/idl/mailparse.idl.php | 70 + src/idl/math.idl.php | 79 + src/idl/mb.idl.php | 253 + src/idl/mcrypt.idl.php | 141 + src/idl/misc.idl.php | 92 + src/idl/mysql.idl.php | 203 + src/idl/network.idl.php | 142 + src/idl/openssl.idl.php | 204 + src/idl/options.idl.php | 145 + src/idl/oracle.idl.php | 163 + src/idl/output.idl.php | 57 + src/idl/php_mcc.idl.php | 269 + src/idl/posix.idl.php | 55 + src/idl/preg.idl.php | 87 + src/idl/process.idl.php | 95 + src/idl/reflection.idl.php | 52 + src/idl/server.idl.php | 48 + src/idl/simplexml.idl.php | 95 + src/idl/soap.idl.php | 212 + src/idl/socket.idl.php | 132 + src/idl/sqlite3.idl.php | 128 + src/idl/stream.idl.php | 186 + src/idl/string.idl.php | 369 + src/idl/thread.idl.php | 12 + src/idl/thrift.idl.php | 21 + src/idl/url.idl.php | 34 + src/idl/variable.idl.php | 65 + src/idl/xml.idl.php | 100 + src/idl/xmlwriter.idl.php | 309 + src/idl/zlib.idl.php | 94 + src/java.mk | 14 + src/lib/Makefile | 53 + src/lib/analysis/analysis_result.cpp | 2741 + src/lib/analysis/analysis_result.h | 464 + src/lib/analysis/block_scope.cpp | 77 + src/lib/analysis/block_scope.h | 119 + src/lib/analysis/class_scope.cpp | 1032 + src/lib/analysis/class_scope.h | 312 + src/lib/analysis/code_error.cpp | 305 + src/lib/analysis/code_error.h | 126 + src/lib/analysis/constant_table.cpp | 314 + src/lib/analysis/constant_table.h | 107 + src/lib/analysis/core_code_error.inc | 51 + src/lib/analysis/core_dependency.inc | 10 + src/lib/analysis/dependency_graph.cpp | 548 + src/lib/analysis/dependency_graph.h | 222 + src/lib/analysis/file_scope.cpp | 538 + src/lib/analysis/file_scope.h | 218 + src/lib/analysis/function_container.cpp | 243 + src/lib/analysis/function_container.h | 77 + src/lib/analysis/function_scope.cpp | 930 + src/lib/analysis/function_scope.h | 341 + src/lib/analysis/symbol_table.cpp | 201 + src/lib/analysis/symbol_table.h | 120 + src/lib/analysis/type.cpp | 634 + src/lib/analysis/type.h | 183 + src/lib/analysis/variable_table.cpp | 1500 + src/lib/analysis/variable_table.h | 300 + src/lib/code_generator.cpp | 326 + src/lib/code_generator.h | 213 + src/lib/construct.cpp | 112 + src/lib/construct.h | 138 + .../expression/array_element_expression.cpp | 346 + src/lib/expression/array_element_expression.h | 70 + src/lib/expression/array_pair_expression.cpp | 119 + src/lib/expression/array_pair_expression.h | 51 + src/lib/expression/assignment_expression.cpp | 344 + src/lib/expression/assignment_expression.h | 56 + src/lib/expression/binary_op_expression.cpp | 854 + src/lib/expression/binary_op_expression.h | 61 + .../expression/class_constant_expression.cpp | 197 + .../expression/class_constant_expression.h | 46 + src/lib/expression/constant_expression.cpp | 218 + src/lib/expression/constant_expression.h | 63 + src/lib/expression/dynamic_function_call.cpp | 171 + src/lib/expression/dynamic_function_call.h | 39 + src/lib/expression/dynamic_variable.cpp | 95 + src/lib/expression/dynamic_variable.h | 43 + src/lib/expression/encaps_list_expression.cpp | 138 + src/lib/expression/encaps_list_expression.h | 44 + src/lib/expression/expression.cpp | 291 + src/lib/expression/expression.h | 223 + src/lib/expression/expression_list.cpp | 331 + src/lib/expression/expression_list.h | 90 + src/lib/expression/function_call.cpp | 125 + src/lib/expression/function_call.h | 80 + src/lib/expression/include_expression.cpp | 181 + src/lib/expression/include_expression.h | 58 + src/lib/expression/list_assignment.cpp | 183 + src/lib/expression/list_assignment.h | 55 + src/lib/expression/modifier_expression.cpp | 153 + src/lib/expression/modifier_expression.h | 53 + src/lib/expression/new_object_expression.cpp | 185 + src/lib/expression/new_object_expression.h | 40 + .../expression/object_method_expression.cpp | 387 + src/lib/expression/object_method_expression.h | 53 + .../expression/object_property_expression.cpp | 345 + .../expression/object_property_expression.h | 62 + src/lib/expression/parameter_expression.cpp | 212 + src/lib/expression/parameter_expression.h | 57 + src/lib/expression/qop_expression.cpp | 120 + src/lib/expression/qop_expression.h | 46 + src/lib/expression/scalar_expression.cpp | 536 + src/lib/expression/scalar_expression.h | 90 + src/lib/expression/simple_function_call.cpp | 900 + src/lib/expression/simple_function_call.h | 95 + src/lib/expression/simple_variable.cpp | 204 + src/lib/expression/simple_variable.h | 51 + .../expression/static_member_expression.cpp | 198 + src/lib/expression/static_member_expression.h | 49 + src/lib/expression/unary_op_expression.cpp | 562 + src/lib/expression/unary_op_expression.h | 59 + src/lib/hook.mk | 10 + src/lib/hphp.h | 26 + src/lib/hphp_unique.h | 40 + src/lib/option.cpp | 605 + src/lib/option.h | 311 + src/lib/package.cpp | 453 + src/lib/package.h | 107 + src/lib/parser/hphp.x | 692 + src/lib/parser/hphp.y | 867 + src/lib/parser/parser.cpp | 892 + src/lib/parser/parser.h | 175 + src/lib/parser/scanner.cpp | 185 + src/lib/parser/scanner.h | 83 + src/lib/statement/block_statement.cpp | 92 + src/lib/statement/block_statement.h | 44 + src/lib/statement/break_statement.cpp | 115 + src/lib/statement/break_statement.h | 40 + src/lib/statement/case_statement.cpp | 152 + src/lib/statement/case_statement.h | 72 + src/lib/statement/catch_statement.cpp | 126 + src/lib/statement/catch_statement.h | 48 + src/lib/statement/class_constant.cpp | 139 + src/lib/statement/class_constant.h | 43 + src/lib/statement/class_statement.cpp | 752 + src/lib/statement/class_statement.h | 57 + src/lib/statement/class_variable.cpp | 253 + src/lib/statement/class_variable.h | 47 + src/lib/statement/continue_statement.cpp | 45 + src/lib/statement/continue_statement.h | 35 + src/lib/statement/do_statement.cpp | 112 + src/lib/statement/do_statement.h | 46 + src/lib/statement/echo_statement.cpp | 81 + src/lib/statement/echo_statement.h | 40 + src/lib/statement/exp_statement.cpp | 133 + src/lib/statement/exp_statement.h | 52 + src/lib/statement/for_statement.cpp | 137 + src/lib/statement/for_statement.h | 48 + src/lib/statement/foreach_statement.cpp | 247 + src/lib/statement/foreach_statement.h | 50 + src/lib/statement/function_statement.cpp | 257 + src/lib/statement/function_statement.h | 50 + src/lib/statement/global_statement.cpp | 149 + src/lib/statement/global_statement.h | 41 + src/lib/statement/if_branch_statement.cpp | 98 + src/lib/statement/if_branch_statement.h | 47 + src/lib/statement/if_statement.cpp | 174 + src/lib/statement/if_statement.h | 43 + src/lib/statement/interface_statement.cpp | 320 + src/lib/statement/interface_statement.h | 61 + src/lib/statement/method_statement.cpp | 1092 + src/lib/statement/method_statement.h | 99 + src/lib/statement/return_statement.cpp | 131 + src/lib/statement/return_statement.h | 40 + src/lib/statement/scope_statement.cpp | 19 + src/lib/statement/scope_statement.h | 37 + src/lib/statement/statement.cpp | 36 + src/lib/statement/statement.h | 127 + src/lib/statement/statement_list.cpp | 368 + src/lib/statement/statement_list.h | 65 + src/lib/statement/static_statement.cpp | 232 + src/lib/statement/static_statement.h | 41 + src/lib/statement/switch_statement.cpp | 238 + src/lib/statement/switch_statement.h | 44 + src/lib/statement/throw_statement.cpp | 74 + src/lib/statement/throw_statement.h | 39 + src/lib/statement/try_statement.cpp | 110 + src/lib/statement/try_statement.h | 44 + src/lib/statement/unset_statement.cpp | 100 + src/lib/statement/unset_statement.h | 40 + src/lib/statement/while_statement.cpp | 117 + src/lib/statement/while_statement.h | 45 + src/lib/system/Makefile | 10 + src/lib/system/apache.inc | 23 + src/lib/system/apc.inc | 25 + src/lib/system/apd.inc | 15 + src/lib/system/array.inc | 104 + src/lib/system/bcmath.inc | 16 + src/lib/system/builtin_symbols.cpp | 430 + src/lib/system/builtin_symbols.h | 89 + src/lib/system/class.inc | 21 + src/lib/system/classes/arrayaccess.php | 8 + src/lib/system/classes/exception.php | 79 + src/lib/system/classes/iterator.php | 137 + src/lib/system/classes/pear_error.php | 19 + src/lib/system/classes/reflection.php | 731 + src/lib/system/classes/stdclass.php | 9 + src/lib/system/ctype.inc | 17 + src/lib/system/curl.inc | 30 + src/lib/system/datetime.inc | 45 + src/lib/system/domdocument.inc | 25 + src/lib/system/error.inc | 17 + src/lib/system/ext.inc | 57 + src/lib/system/fbml.inc | 26 + src/lib/system/file.inc | 95 + src/lib/system/function.inc | 20 + src/lib/system/gen/Makefile | 26 + .../system/gen/cls/__php_incomplete_class.h | 36 + src/lib/system/gen/cls/arrayaccess.h | 35 + src/lib/system/gen/cls/arrayiterator.h | 73 + .../system/gen/cls/badfunctioncallexception.h | 39 + .../system/gen/cls/badmethodcallexception.h | 40 + src/lib/system/gen/cls/countable.h | 32 + src/lib/system/gen/cls/domainexception.h | 39 + src/lib/system/gen/cls/exception.h | 51 + src/lib/system/gen/cls/filteriterator.h | 33 + .../system/gen/cls/invalidargumentexception.h | 39 + src/lib/system/gen/cls/iterator.h | 37 + src/lib/system/gen/cls/iteratoraggregate.h | 33 + src/lib/system/gen/cls/lengthexception.h | 39 + src/lib/system/gen/cls/logicexception.h | 38 + src/lib/system/gen/cls/outeriterator.h | 32 + src/lib/system/gen/cls/outofboundsexception.h | 39 + src/lib/system/gen/cls/outofrangeexception.h | 39 + src/lib/system/gen/cls/overflowexception.h | 39 + src/lib/system/gen/cls/pear_error.h | 49 + src/lib/system/gen/cls/rangeexception.h | 39 + src/lib/system/gen/cls/reflectionclass.h | 83 + src/lib/system/gen/cls/reflectionexception.h | 38 + src/lib/system/gen/cls/reflectionextension.h | 55 + src/lib/system/gen/cls/reflectionfunction.h | 49 + .../gen/cls/reflectionfunctionabstract.h | 50 + src/lib/system/gen/cls/reflectionmethod.h | 62 + src/lib/system/gen/cls/reflectionobject.h | 45 + src/lib/system/gen/cls/reflectionparameter.h | 56 + src/lib/system/gen/cls/reflectionproperty.h | 60 + src/lib/system/gen/cls/reflector.h | 33 + src/lib/system/gen/cls/runtimeexception.h | 38 + src/lib/system/gen/cls/seekableiterator.h | 32 + src/lib/system/gen/cls/serializable.h | 33 + src/lib/system/gen/cls/stdclass.h | 36 + src/lib/system/gen/cls/traversable.h | 31 + src/lib/system/gen/cls/underflowexception.h | 39 + .../system/gen/cls/unexpectedvalueexception.h | 39 + .../system/gen/php/classes/arrayaccess.cpp | 41 + .../system/gen/php/classes/arrayaccess.fw.h | 35 + src/lib/system/gen/php/classes/arrayaccess.h | 34 + src/lib/system/gen/php/classes/exception.cpp | 3794 ++ src/lib/system/gen/php/classes/exception.fw.h | 48 + src/lib/system/gen/php/classes/exception.h | 61 + src/lib/system/gen/php/classes/iterator.cpp | 842 + src/lib/system/gen/php/classes/iterator.fw.h | 45 + src/lib/system/gen/php/classes/iterator.h | 44 + src/lib/system/gen/php/classes/pear_error.cpp | 470 + .../system/gen/php/classes/pear_error.fw.h | 35 + src/lib/system/gen/php/classes/pear_error.h | 35 + src/lib/system/gen/php/classes/reflection.cpp | 6622 ++ .../system/gen/php/classes/reflection.fw.h | 45 + src/lib/system/gen/php/classes/reflection.h | 53 + src/lib/system/gen/php/classes/stdclass.cpp | 173 + src/lib/system/gen/php/classes/stdclass.fw.h | 36 + src/lib/system/gen/php/classes/stdclass.h | 37 + src/lib/system/gen/php/globals/constants.cpp | 1919 + src/lib/system/gen/php/globals/constants.fw.h | 1912 + src/lib/system/gen/php/globals/constants.h | 33 + src/lib/system/gen/php/globals/symbols.cpp | 74 + src/lib/system/gen/php/globals/symbols.fw.h | 34 + src/lib/system/gen/php/globals/symbols.h | 33 + .../system/gen/sys/dynamic_table_class.no.cpp | 20838 ++++++ .../gen/sys/dynamic_table_constant.no.cpp | 7047 ++ .../system/gen/sys/dynamic_table_file.no.cpp | 29 + .../system/gen/sys/dynamic_table_func.no.cpp | 54894 ++++++++++++++++ src/lib/system/gen/sys/scalar_arrays_0.no.cpp | 31 + src/lib/system/gen/sys/system_globals.cpp | 55 + src/lib/system/gen/sys/system_globals.h | 201 + src/lib/system/globals/constants.php | 1952 + src/lib/system/globals/gen_constants | 38 + src/lib/system/globals/symbols.php | 28 + src/lib/system/hash.inc | 16 + src/lib/system/helper.inc | 5 + src/lib/system/iconv.inc | 17 + src/lib/system/icu.inc | 7 + src/lib/system/idn.inc | 9 + src/lib/system/image.inc | 113 + src/lib/system/ipc.inc | 23 + src/lib/system/json.inc | 8 + src/lib/system/ldap.inc | 49 + src/lib/system/magick.inc | 434 + src/lib/system/mailparse.inc | 22 + src/lib/system/math.inc | 54 + src/lib/system/mb.inc | 61 + src/lib/system/mcrypt.inc | 43 + src/lib/system/misc.inc | 33 + src/lib/system/mysql.inc | 55 + src/lib/system/network.inc | 36 + src/lib/system/openssl.inc | 45 + src/lib/system/options.inc | 55 + src/lib/system/oracle.inc | 44 + src/lib/system/output.inc | 27 + src/lib/system/php_mcc.inc | 78 + src/lib/system/posix.inc | 41 + src/lib/system/preg.inc | 21 + src/lib/system/process.inc | 32 + src/lib/system/reflection.inc | 17 + src/lib/system/server.inc | 16 + src/lib/system/simplexml.inc | 15 + src/lib/system/soap.inc | 14 + src/lib/system/socket.inc | 32 + src/lib/system/sqlite3.inc | 20 + src/lib/system/stream.inc | 46 + src/lib/system/string.inc | 97 + src/lib/system/thread.inc | 9 + src/lib/system/thrift.inc | 8 + src/lib/system/url.inc | 16 + src/lib/system/variable.inc | 36 + src/lib/system/xml.inc | 30 + src/lib/system/xmlwriter.inc | 49 + src/lib/system/zlib.inc | 28 + src/lib/util/jump_table.cpp | 78 + src/lib/util/jump_table.h | 43 + src/license.php | 137 + src/python.mk | 25 + src/rules.mk | 679 + src/schema.sql | 53 + src/test/Makefile | 44 + src/test/config-server.hdf | 18 + src/test/config.hdf | 17 + src/test/dummy_mysql_info.inc | 5 + src/test/hook.mk | 50 + src/test/images/246x247.png | Bin 0 -> 360 bytes src/test/images/php.gif | Bin 0 -> 2523 bytes src/test/images/simpletext.jpg | Bin 0 -> 1298 bytes src/test/images/smile.happy.png | Bin 0 -> 150 bytes src/test/images/test1pix.jpg | Bin 0 -> 523 bytes src/test/main.cpp | 48 + src/test/perf_ad_hoc.php | 618 + src/test/tahoma.ttf | Bin 0 -> 383140 bytes src/test/test.cpp | 107 + src/test/test.h | 38 + src/test/test.wsdl | 55 + src/test/test_base.cpp | 67 + src/test/test_base.h | 80 + src/test/test_base_fast.inc | 9 + src/test/test_base_suite.inc | 13 + src/test/test_code_error.cpp | 526 + src/test/test_code_error.h | 53 + src/test/test_code_run.cpp | 7416 +++ src/test/test_code_run.h | 162 + src/test/test_cpp_base.cpp | 952 + src/test/test_cpp_base.h | 65 + src/test/test_cpp_ext.cpp | 22 + src/test/test_cpp_ext.h | 35 + src/test/test_depend_graph.cpp | 187 + src/test/test_depend_graph.h | 62 + src/test/test_ext.h | 72 + src/test/test_ext.inc | 57 + src/test/test_ext_apache.cpp | 185 + src/test/test_ext_apache.h | 51 + src/test/test_ext_apc.cpp | 402 + src/test/test_ext_apc.h | 53 + src/test/test_ext_apd.cpp | 119 + src/test/test_ext_apd.h | 43 + src/test/test_ext_array.cpp | 1729 + src/test/test_ext_array.h | 111 + src/test/test_ext_bcmath.cpp | 98 + src/test/test_ext_bcmath.h | 44 + src/test/test_ext_class.cpp | 128 + src/test/test_ext_class.h | 49 + src/test/test_ext_ctype.cpp | 106 + src/test/test_ext_ctype.h | 45 + src/test/test_ext_curl.cpp | 385 + src/test/test_ext_curl.h | 59 + src/test/test_ext_datetime.cpp | 555 + src/test/test_ext_datetime.h | 71 + src/test/test_ext_domdocument.cpp | 454 + src/test/test_ext_domdocument.h | 119 + src/test/test_ext_error.cpp | 104 + src/test/test_ext_error.h | 45 + src/test/test_ext_fbml.cpp | 296 + src/test/test_ext_fbml.h | 54 + src/test/test_ext_file.cpp | 895 + src/test/test_ext_file.h | 127 + src/test/test_ext_file.txt | 1 + src/test/test_ext_function.cpp | 131 + src/test/test_ext_function.h | 48 + src/test/test_ext_hash.cpp | 175 + src/test/test_ext_hash.h | 44 + src/test/test_ext_iconv.cpp | 128 + src/test/test_ext_iconv.h | 45 + src/test/test_ext_icu.cpp | 63 + src/test/test_ext_icu.h | 35 + src/test/test_ext_idn.cpp | 77 + src/test/test_ext_idn.h | 37 + src/test/test_ext_image.cpp | 670 + src/test/test_ext_image.h | 141 + src/test/test_ext_ipc.cpp | 180 + src/test/test_ext_ipc.h | 55 + src/test/test_ext_json.cpp | 98 + src/test/test_ext_json.h | 36 + src/test/test_ext_ldap.cpp | 286 + src/test/test_ext_ldap.h | 77 + src/test/test_ext_magick.cpp | 2596 + src/test/test_ext_magick.h | 462 + src/test/test_ext_mailparse.cpp | 124 + src/test/test_ext_mailparse.h | 50 + src/test/test_ext_math.cpp | 377 + src/test/test_ext_math.h | 82 + src/test/test_ext_mb.cpp | 574 + src/test/test_ext_mb.h | 89 + src/test/test_ext_mcrypt.cpp | 327 + src/test/test_ext_mcrypt.h | 71 + src/test/test_ext_misc.cpp | 224 + src/test/test_ext_misc.h | 61 + src/test/test_ext_mysql.cpp | 602 + src/test/test_ext_mysql.h | 83 + src/test/test_ext_network.cpp | 239 + src/test/test_ext_network.h | 64 + src/test/test_ext_openssl.cpp | 523 + src/test/test_ext_openssl.h | 73 + src/test/test_ext_options.cpp | 406 + src/test/test_ext_options.h | 83 + src/test/test_ext_oracle.cpp | 256 + src/test/test_ext_oracle.h | 72 + src/test/test_ext_output.cpp | 221 + src/test/test_ext_output.h | 55 + src/test/test_ext_php_mcc.cpp | 209 + src/test/test_ext_php_mcc.h | 46 + src/test/test_ext_posix.cpp | 259 + src/test/test_ext_posix.h | 69 + src/test/test_ext_preg.cpp | 435 + src/test/test_ext_preg.h | 49 + src/test/test_ext_process.cpp | 352 + src/test/test_ext_process.h | 60 + src/test/test_ext_reflection.cpp | 94 + src/test/test_ext_reflection.h | 45 + src/test/test_ext_server.cpp | 142 + src/test/test_ext_server.h | 44 + src/test/test_ext_simplexml.cpp | 87 + src/test/test_ext_simplexml.h | 43 + src/test/test_ext_soap.cpp | 132 + src/test/test_ext_soap.h | 81 + src/test/test_ext_socket.cpp | 307 + src/test/test_ext_socket.h | 60 + src/test/test_ext_sqlite3.cpp | 122 + src/test/test_ext_sqlite3.h | 37 + src/test/test_ext_stream.cpp | 422 + src/test/test_ext_stream.h | 74 + src/test/test_ext_string.cpp | 796 + src/test/test_ext_string.h | 125 + src/test/test_ext_thread.cpp | 45 + src/test/test_ext_thread.h | 37 + src/test/test_ext_thrift.cpp | 41 + src/test/test_ext_thrift.h | 36 + src/test/test_ext_url.cpp | 168 + src/test/test_ext_url.h | 44 + src/test/test_ext_variable.cpp | 369 + src/test/test_ext_variable.h | 64 + src/test/test_ext_xml.cpp | 173 + src/test/test_ext_xml.h | 58 + src/test/test_ext_xmlwriter.cpp | 291 + src/test/test_ext_xmlwriter.h | 77 + src/test/test_ext_zlib.cpp | 202 + src/test/test_ext_zlib.gz | Bin 0 -> 51 bytes src/test/test_ext_zlib.h | 56 + src/test/test_get_meta_tags.html | 19 + src/test/test_hash_file.txt | 1 + src/test/test_parser.cpp | 45 + src/test/test_parser.h | 38 + src/test/test_parser_expr.cpp | 371 + src/test/test_parser_expr.h | 55 + src/test/test_parser_stmt.cpp | 633 + src/test/test_parser_stmt.h | 59 + src/test/test_pcntl_exec.sh | 10 + src/test/test_performance.cpp | 190 + src/test/test_performance.h | 41 + src/test/test_private.pem | 9 + src/test/test_public.pem | 24 + src/test/test_server.cpp | 509 + src/test/test_server.h | 94 + src/test/test_trans_expr.cpp | 1139 + src/test/test_trans_expr.h | 57 + src/test/test_trans_stmt.cpp | 2355 + src/test/test_trans_stmt.h | 61 + src/test/test_transformer.cpp | 59 + src/test/test_transformer.h | 43 + src/test/test_type_inference.cpp | 451 + src/test/test_type_inference.h | 46 + src/test/test_util.cpp | 491 + src/test/test_util.h | 39 + src/test/test_x509.crt | 7599 +++ src/test/test_zlib_file | Bin 0 -> 78 bytes src/util/Makefile | 11 + src/util/async_func.h | 213 + src/util/async_job.cpp | 20 + src/util/async_job.h | 180 + src/util/atomic.cpp | 23 + src/util/atomic.h | 54 + src/util/base.h | 182 + src/util/capability.cpp | 117 + src/util/capability.h | 40 + src/util/case_insensitive.h | 50 + src/util/compression.cpp | 595 + src/util/compression.h | 64 + src/util/config.h | 74 + src/util/dataset.cpp | 93 + src/util/dataset.h | 87 + src/util/db_conn.cpp | 360 + src/util/db_conn.h | 184 + src/util/db_dataset.cpp | 165 + src/util/db_dataset.h | 77 + src/util/db_filter.cpp | 147 + src/util/db_filter.h | 157 + src/util/db_query.cpp | 325 + src/util/db_query.h | 165 + src/util/exception.cpp | 58 + src/util/exception.h | 82 + src/util/file_cache.cpp | 306 + src/util/file_cache.h | 69 + src/util/hash.h | 319 + src/util/hdf.cpp | 538 + src/util/hdf.h | 388 + src/util/jemalloc/jemalloc.c | 5804 ++ src/util/jemalloc/jemalloc.h | 51 + src/util/jemalloc/jemalloc_defs.h | 105 + src/util/jemalloc/rb.h | 948 + src/util/jemalloc/version | 1 + src/util/job_queue.h | 296 + src/util/json.cpp | 87 + src/util/json.h | 198 + src/util/lfu_table.h | 633 + src/util/lock.cpp | 51 + src/util/lock.h | 112 + src/util/log_aggregator.cpp | 175 + src/util/log_aggregator.h | 80 + src/util/logger.cpp | 194 + src/util/logger.h | 93 + src/util/mcproxy/client.cpp | 823 + src/util/mcproxy/cluster.cpp | 235 + src/util/mcproxy/cluster.h | 17 + src/util/mcproxy/crc32.h | 135 + src/util/mcproxy/gfuncs.cpp | 189 + src/util/mcproxy/gfuncs.h | 32 + src/util/mcproxy/include.h | 54 + src/util/mcproxy/loadconfig.cpp | 438 + src/util/mcproxy/loadconfig.h | 10 + src/util/mcproxy/main.cpp | 442 + src/util/mcproxy/mctypes.h | 10 + src/util/mcproxy/prefix.cpp | 273 + src/util/mcproxy/prefix.h | 33 + src/util/mcproxy/prefix_int.h | 35 + src/util/mcproxy/proxy.h | 33 + src/util/mcproxy/qio.cpp | 947 + src/util/mcproxy/qio.h | 241 + src/util/mcproxy/qlio.cpp | 249 + src/util/mcproxy/qlio.h | 61 + src/util/mcproxy/request.cpp | 786 + src/util/mcproxy/request.h | 134 + src/util/mcproxy/request_int.h | 77 + src/util/mcproxy/request_list.cpp | 199 + src/util/mcproxy/server.cpp | 820 + src/util/mcproxy/server.h | 40 + src/util/mcproxy/server_async.cpp | 378 + src/util/mcproxy/server_int.h | 87 + src/util/mcproxy/socket.cpp | 301 + src/util/mcproxy/stats.cpp | 144 + src/util/mcproxy/stats.h | 23 + src/util/mcproxy/tinystdio.cpp | 205 + src/util/mcproxy/tinystdio.h | 56 + src/util/mutex.cpp | 34 + src/util/mutex.h | 93 + src/util/neo/cs_config.h | 224 + src/util/neo/neo_err.c | 472 + src/util/neo/neo_err.h | 226 + src/util/neo/neo_files.c | 256 + src/util/neo/neo_files.h | 37 + src/util/neo/neo_hash.c | 293 + src/util/neo/neo_hash.h | 57 + src/util/neo/neo_hdf.c | 1975 + src/util/neo/neo_hdf.h | 587 + src/util/neo/neo_misc.c | 228 + src/util/neo/neo_misc.h | 134 + src/util/neo/neo_rand.c | 114 + src/util/neo/neo_rand.h | 24 + src/util/neo/neo_str.c | 892 + src/util/neo/neo_str.h | 114 + src/util/neo/ulist.c | 286 + src/util/neo/ulist.h | 45 + src/util/neo/ulocks.c | 204 + src/util/neo/ulocks.h | 191 + src/util/neo/wildmat.c | 207 + src/util/neo/wildmat.h | 16 + src/util/network.cpp | 105 + src/util/network.h | 60 + src/util/pool.h | 55 + src/util/preprocess.cpp | 50 + src/util/preprocess.h | 34 + src/util/process.cpp | 338 + src/util/process.h | 165 + src/util/shared_memory_allocator.cpp | 42 + src/util/shared_memory_allocator.h | 241 + src/util/stack_trace.cpp | 453 + src/util/stack_trace.h | 128 + src/util/string_bag.cpp | 46 + src/util/string_bag.h | 45 + src/util/synchronizable.cpp | 65 + src/util/synchronizable.h | 51 + src/util/thread_local.h | 389 + src/util/timer.cpp | 104 + src/util/timer.h | 70 + src/util/util.cpp | 350 + src/util/util.h | 103 + src/util/ylmm/basic_buffer.hh | 449 + src/util/ylmm/basic_location.hh | 197 + src/util/ylmm/basic_messenger.hh | 242 + src/util/ylmm/basic_parser.hh | 335 + src/util/ylmm/basic_scanner.hh | 507 + src/util/ylmm/lexmm.hh | 205 + src/util/ylmm/yaccmm.hh | 268 + 6163 files changed, 884076 insertions(+) create mode 100644 Makefile create mode 100644 bin/hdf.el create mode 100644 bin/run.mk create mode 100755 bin/run.sh create mode 100644 bin/time_build.php create mode 100644 bin/valgrind.suppression create mode 100644 doc/Makefile create mode 100644 doc/command.compiled create mode 100644 doc/command.compiler create mode 100644 doc/debug.gdb create mode 100644 doc/extension.development create mode 100644 doc/extension.new_functions create mode 100644 doc/ffi.c++ create mode 100644 doc/ffi.java create mode 100644 doc/ffi.python create mode 100644 doc/hdf create mode 100644 doc/inconsistencies create mode 100644 doc/index.php create mode 100644 doc/runtime.memory_model create mode 100644 doc/runtime.type_system create mode 100644 doc/server.dangling_server create mode 100644 doc/server.documents create mode 100644 doc/server.rpc_server create mode 100644 doc/style.css create mode 100644 local/sample.mk create mode 100644 phpt/Makefile create mode 100644 phpt/README create mode 100644 phpt/tests/php-5.2.5/Zend/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/008.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/010.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/011.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/012.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/013.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/014.inc create mode 100644 phpt/tests/php-5.2.5/Zend/tests/014.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/015.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/016.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/017.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/018.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/019.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/020.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/abstract-static.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/add_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/add_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/add_003.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/add_004.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/add_005.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/add_006.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/add_007.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/and_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/array_append_COW.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/array_type_hint_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/array_unshift_COW.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug19859.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug20240.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug20242.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug21478.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug21888.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug22725.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug22836.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug23104.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug24436.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug24635.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug24699.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug24773.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug24884.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug26010.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug26077.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug26166.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug26229.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug26281.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug26696.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug26697.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug26698.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug26801.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug26802.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug27268.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug27304.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug27598.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug27669.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug27731.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug27798.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug28072.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug28377.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug28442.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug28444.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug29015.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug29104.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug29210.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug29368.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug29505.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug29674.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug29689.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug29883.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug29890.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug29896.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug29944.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30080.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30140.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30161.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30162.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug30332.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30346.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30394.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug30407.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug30451.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30519.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug30702.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30707.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30725.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30791.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30820.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30828.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug30889.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug30922.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug30998.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug31098.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug31102.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug31177-2.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug31177.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug31341.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug31525.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug31683.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug31720.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug31828.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug32080.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug32226.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug32252.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug32290.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug32296.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug32322.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug32427.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug32428.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug32429.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug32596.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug32660.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug32674.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug32799.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug32833.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug32852.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug32993.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33116.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33171.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33243.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33257.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug33277.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug33282.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33318.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33512.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33558.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33710.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33732.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug33771.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33802.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33996.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug33999.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34045.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34062.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34064.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34065.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34137.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34199.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34260.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug34310.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34358.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34467.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34518.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34617.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34678.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34712.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34767.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34786.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug34873.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34879.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug34893.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug35017.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug35106.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug35239.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug35393.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug35411.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug35437.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug35470.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug35509.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug35634.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug35655.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug36006.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug36037.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug36071.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug36214.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug36268.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug36303.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug36513.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug36568.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug36759.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug37046.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug37138.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug37144.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug37212.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug37632.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug37667.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug37707.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug37715.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug37811.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug38047.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug38146.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug38211.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug38220.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug38234.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug38287.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug38461.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug38623.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug38624.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug38772.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug38779.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug38779_1.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug38808.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug38942.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug39003.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39017.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug39036.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39297.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39304.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39438.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39445.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39449.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39542.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39542/bug39542.php create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39602.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39721.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39775.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39825.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39944.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug39990.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug40236.inc create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug40236.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug40261.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug40509.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug40621.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug40705.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug40757.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug40770.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug40784.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug40809.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug40815.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug40833.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug40899.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug41026.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug41075.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug41117_1.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug41209.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug41351.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug41351_2.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug41351_3.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug41372.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug41401.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug41421.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug41633_1.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug41633_2.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug41633_3.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug41633_4.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug41640.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug41813.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug41919.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug41929.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug41961.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug42119.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug42211.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug42767.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug42772.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug42817.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/bug42818.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/bug_debug_backtrace.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/cast_to_array.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/cast_to_bool.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/cast_to_double.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/cast_to_int.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/cast_to_object.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/cast_to_string.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/catch.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/catch_002.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/catch_003.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/catch_004.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/class_constants_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/class_constants_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/class_constants_003.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_001_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_002_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_003.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_003_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_004.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_004_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_005.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_005_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_006.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/compare_006_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/concat_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/decrement_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/decrement_001_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/div_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/div_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/double_to_string.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/double_to_string_64bit.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/dtor_scope.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_003.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_004.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_005.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_006.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_007.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_008.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_009.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_010.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_011.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_012.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_013.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_014.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_015.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_016.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_017.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_018.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_019.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_020.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_021.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_022.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_023.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_024.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_025.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_026.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_027.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_028.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_029.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_030.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_031.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_032.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_033.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_034.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_035.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_036.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_037.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_038.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_039.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_040.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_041.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_042.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/errmsg_043.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/error_reporting01.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/error_reporting02.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/error_reporting03.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/error_reporting04.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/error_reporting05.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/error_reporting06.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/error_reporting07.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/error_reporting08.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/error_reporting09.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/error_reporting10.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/exception_handler_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/exception_handler_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/exception_handler_003.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/exception_handler_004.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/exception_handler_005.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/exception_handler_006.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/foreach.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/foreach_undefined.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/get_defined_vars.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/globals.inc create mode 100644 phpt/tests/php-5.2.5/Zend/tests/globals_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/globals_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/globals_003.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/globals_004.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/halt01.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/halt02.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/halt03.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/halt_compiler1.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/halt_compiler2.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/halt_compiler3.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/halt_compiler4.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/hex_overflow_32bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/increment_001.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/instanceof.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/int_overflow_32bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/int_overflow_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/int_underflow_32bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/int_underflow_64bit.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/is_a.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_003.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_004.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_005.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_006.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_007.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_010.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/method_exists.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/mod_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/mul_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/not_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/not_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/object-null.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/object_handlers.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_003.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_004.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_005.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_006.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_007.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_008.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_009.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_010.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_011.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_012.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_013.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/objects_014.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/objects_015.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/oct_overflow_32bit.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/offset_array.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/offset_assign.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/offset_bool.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/offset_long.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/offset_null.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/offset_object.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/offset_string.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/or_001.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/selfParent_001.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/selfParent_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/settype_array.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/settype_bool.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/settype_double.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/settype_int.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/settype_null.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/settype_object.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/settype_resource.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/settype_string.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/shift_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/shift_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/strict_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/strict_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/sub_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset.inc create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv01.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv02.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv03.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv04.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv05.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv06.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv07.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv08.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv09.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv10.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/unset_cv11.phpt create mode 100755 phpt/tests/php-5.2.5/Zend/tests/unset_cv12.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/xor_001.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/xor_002.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/xor_003.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/zend2.php.txt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/zend_operators.phpt create mode 100644 phpt/tests/php-5.2.5/Zend/tests/zend_strtod.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bcmath/tests/bcadd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bcmath/tests/bccomp.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bcmath/tests/bcdiv.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bcmath/tests/bcmod.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bcmath/tests/bcmul.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bcmath/tests/bcpow.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bcmath/tests/bcscale.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bcmath/tests/bcsqrt.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bcmath/tests/bcsub.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/003.txt.bz2 create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/004_1.txt.bz2 create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/004_2.txt.bz2 create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/bz2_filter_compress.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/bz2_filter_decompress.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/with_files.phpt create mode 100644 phpt/tests/php-5.2.5/ext/bz2/tests/with_strings.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/cal_days_in_month.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/cal_from_jd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/cal_info.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/cal_to_jd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/easter_date.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/easter_days.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/frenchtojd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/gregoriantojd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/jddayofweek.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/jdmonthname.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/jdtofrench.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/jdtogregorian.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/jdtojewish.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/jdtojulian.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/jdtomonthname.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/jdtounix.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/jewishtojd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/juliantojd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/calendar/tests/unixtojd.phpt create mode 100755 phpt/tests/php-5.2.5/ext/com_dotnet/tests/27974.phpt create mode 100644 phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug33386.phpt create mode 100644 phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug34272.phpt create mode 100644 phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug39596.phpt create mode 100644 phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug39606.phpt create mode 100644 phpt/tests/php-5.2.5/ext/com_dotnet/tests/variants.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ctype/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ctype/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ctype/tests/bug25745.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ctype/tests/bug34645.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug13142.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug14561.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug17988.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug20382-1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug20382-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug21399.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug21966.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug26090.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug26198.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug26317.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug26320.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug26694.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug27719.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug27780.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug28024.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug28088.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug28599.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug29150.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug29585.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug29595.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug30096.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug30532.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug32086.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug32270.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug32555.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug32588.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33056.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33414-1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33414-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33415-1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33415-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33452.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33532.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33536.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33562.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33563.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33578.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33869.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug33957.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug34087.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug34304.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug34676.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug34771.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35143.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35218.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35414.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35422.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35425.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35456.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35499.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35624.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35630.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35699.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35705.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35885.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug35887.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug36224.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug36510.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug36599.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug36988.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug37017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug37368.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug37514.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug37616.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug37747.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug38229.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug39782.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug40861.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug41523.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug41709.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug41842.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug41844.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/bug41964.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_constants.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_create-1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_create-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_set-1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_modify-1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_modify-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_parse_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_sun_info_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/date_sun_info_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/default-timezone-1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/default-timezone-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/format-negative-timestamp.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/mktime-1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/mktime-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/mktime-3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/oo_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/oo_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/date/tests/strtotime-mysql.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/strtotime.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/strtotime2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/strtotime3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/timezone-configuration.phpt create mode 100644 phpt/tests/php-5.2.5/ext/date/tests/timezones.phpt create mode 100755 phpt/tests/php-5.2.5/ext/dba/tests/bug36436.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba008.phpt create mode 100755 phpt/tests/php-5.2.5/ext/dba/tests/dba009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb_make.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb_read.phpt create mode 100755 phpt/tests/php-5.2.5/ext/dba/tests/dba_db1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_db2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_db3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_db4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_dbm.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_flatfile.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_gdbm.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_handler.inc create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_inifile.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/dba_ndbm.phpt create mode 100755 phpt/tests/php-5.2.5/ext/dba/tests/dba_qdbm.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/test.cdb create mode 100644 phpt/tests/php-5.2.5/ext/dba/tests/test.inc create mode 100644 phpt/tests/php-5.2.5/ext/dbase/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dbase/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dbase/tests/bug31754.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/book.xml create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/book.xml.gz create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug28721.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug28817.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug32615.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug34276.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug35342.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug36756.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug37277.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug37456.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug38438.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug38474.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug38850.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug38949.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug40836.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug41257.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug41374.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/bug42082.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/canonicalization.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom.ent create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom.xml create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom_create_element.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom_import_simplexml.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom_set_attr_node.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom_test.inc create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/dom_xinclude.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/domattributes.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/domchardata.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/domelement.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/nsdoc.xml create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/regsiter_node_class.phpt create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/test.html create mode 100644 phpt/tests/php-5.2.5/ext/dom/tests/xinclude.xml create mode 100755 phpt/tests/php-5.2.5/ext/exif/tests/bug34704.jpg create mode 100755 phpt/tests/php-5.2.5/ext/exif/tests/bug34704.phpt create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/exif000.phpt create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/exif001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/exif002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/exif003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/exif004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/exif005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/exif006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/test1.jpg create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/test2.jpg create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/test3.jpg create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/test4.jpg create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/test5.jpg create mode 100644 phpt/tests/php-5.2.5/ext/exif/tests/test6.jpg create mode 100644 phpt/tests/php-5.2.5/ext/fdf/tests/01-general.phpt create mode 100644 phpt/tests/php-5.2.5/ext/fdf/tests/02-values.phpt create mode 100644 phpt/tests/php-5.2.5/ext/fdf/tests/03-read-file.phpt create mode 100644 phpt/tests/php-5.2.5/ext/fdf/tests/04-POST.phpt create mode 100644 phpt/tests/php-5.2.5/ext/fdf/tests/simple.fdf create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/016.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/018.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/019.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/020.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/021.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/022.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/023.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/024.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/025.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/026.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/027.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/028.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/029.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/030.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/031.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/032.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/033.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/033_run.inc create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/034.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/035.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/036.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/037.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/038.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/039.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/040.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/041.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/042.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/043.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/044.phpt create mode 100755 phpt/tests/php-5.2.5/ext/filter/tests/045.phpt create mode 100755 phpt/tests/php-5.2.5/ext/filter/tests/046.phpt create mode 100755 phpt/tests/php-5.2.5/ext/filter/tests/047.phpt create mode 100755 phpt/tests/php-5.2.5/ext/filter/tests/048.phpt create mode 100755 phpt/tests/php-5.2.5/ext/filter/tests/049.phpt create mode 100755 phpt/tests/php-5.2.5/ext/filter/tests/050.phpt create mode 100755 phpt/tests/php-5.2.5/ext/filter/tests/051.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/PMOPB45.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/bug39763.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/bug39846.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/bug7586.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/bug7715.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/bug7733.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/bug8315.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/callback_non_modified_var.phpt create mode 100644 phpt/tests/php-5.2.5/ext/filter/tests/filter_data.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/bug27809.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/bug37799.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/bug39458-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/bug39458.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/bug39583-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/bug39583.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/bug7216-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/bug7216.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/cert.pem create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/server.inc create mode 100644 phpt/tests/php-5.2.5/ext/ftp/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug19366.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug22544.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug24155.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug24594.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug27582_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug28147.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug36697.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug37346.gif create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug37346.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug37360.gif create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug37360.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug38112.gif create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug38112.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug38179.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug38212.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug39082.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug39273.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug39286.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug39366.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug39508.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug39780.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug39780.png create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug39780_extern.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug40764.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug41442.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug43121.gif create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/bug43121.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/colorat.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/colorclosest.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/colorexact.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/colormatch.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/colorresolve.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/conv_test.gif create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/conv_test.jpeg create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/conv_test.png create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/conv_test.xbm create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/conv_test.xpm create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/copy.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/copypalette.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/copyresized.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/createfromgd2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/createfromstring.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/createfromwbmp.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/createfromwbmp2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/createfromwbmp2_extern.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/dashedlines.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/gif.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/gif2gd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/gif2jpg.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/gif2png.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/imagefill_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/imagefilter.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/imagefttext.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/imagewbmp.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/jpeg2png.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/jpg2gd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/libgd00086.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/libgd00086.png create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/libgd00086_extern.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/libgd00094.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/libgd00094.xbm create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/libgd00101.gd create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/libgd00101.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/libgd00106.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/lines.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/png2gd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/pngcomp.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/src.gd2 create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/src.png create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/src.wbmp create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/test.png create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/test8859.ttf create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/truecolor.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/types.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/xbm2png.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/xpm2gd.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/xpm2jpg.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gd/tests/xpm2png.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gettext/tests/dcngettext.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gettext/tests/gettext_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gettext/tests/locale/fi/LC_MESSAGES/messages.mo create mode 100644 phpt/tests/php-5.2.5/ext/gettext/tests/locale/fi/LC_MESSAGES/messages.po create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/016.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/018.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/019.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/020.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/021.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/022.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/023.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/024.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/025.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/026.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/027.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/028.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/029.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/030.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/031.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/032.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/033.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/034.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/035.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/036.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/037.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/038.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/039.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/bug32773.phpt create mode 100644 phpt/tests/php-5.2.5/ext/gmp/tests/gmp_nextprime.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/adler32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/crc32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/gost.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/haval.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/hmac-md5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/md2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/md4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/md5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/ripemd128.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/ripemd160.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/ripemd256.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/ripemd320.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/sha1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/sha256.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/sha384.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/sha512.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/snefru.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/tiger.phpt create mode 100644 phpt/tests/php-5.2.5/ext/hash/tests/whirlpool.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/Quotes.UTF-8 create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/bug16069.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/bug37176.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/bug37773.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/eucjp2iso2022jp.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/eucjp2sjis.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/eucjp2utf8.phpt create mode 100755 phpt/tests/php-5.2.5/ext/iconv/tests/iconv-charset-length-cve-2007-4840.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_mime_decode-charset-length-cve-2007-4840.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_mime_decode.phpt create mode 100755 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_mime_decode_headers-charset-length-cve-2007-4840.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_mime_decode_headers.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_mime_encode.phpt create mode 100755 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_set_encoding-charset-length-cve-2007-4840.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_stream_filter.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_stream_filter.txt create mode 100755 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_strlen-charset-length-cve-2007-4840.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_strlen.phpt create mode 100755 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_strpos-charset-length-cve-2007-4840.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_strpos.phpt create mode 100755 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_strrpos-charset-length-cve-2007-4840.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_strrpos.phpt create mode 100755 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_substr-charset-length-cve-2007-4783.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/iconv_substr.phpt create mode 100755 phpt/tests/php-5.2.5/ext/iconv/tests/ob_iconv_handler-charset-length-cve-2007-4840.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/ob_iconv_handler.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/test.inc create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/translit-failure.phpt create mode 100644 phpt/tests/php-5.2.5/ext/iconv/tests/translit-utf8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/imap/tests/bug31142_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/imap/tests/bug31142_2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/imap/tests/bug32589.phpt create mode 100644 phpt/tests/php-5.2.5/ext/imap/tests/bug35669.phpt create mode 100644 phpt/tests/php-5.2.5/ext/imap/tests/bug40854.phpt create mode 100644 phpt/tests/php-5.2.5/ext/imap/tests/imap_utf8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/interbase/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/interbase/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/interbase/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/interbase/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/interbase/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/interbase/tests/007.phpt create mode 100755 phpt/tests/php-5.2.5/ext/interbase/tests/008.phpt create mode 100755 phpt/tests/php-5.2.5/ext/interbase/tests/interbase.inc create mode 100755 phpt/tests/php-5.2.5/ext/interbase/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/bug40503.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/bug41034.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/bug41067.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/bug41403.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/bug41504.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/bug41567.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/bug42090.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/bug42785.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/fail001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/pass001.1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/pass001.1_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/pass001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/pass002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/json/tests/pass003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/libxml/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/libxml/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/libxml/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/libxml/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/libxml/tests/bug42112.phpt create mode 100644 phpt/tests/php-5.2.5/ext/libxml/tests/test.xml create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/libmbfl/tests/sample.c create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/bug20087.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/bug25140.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/bug26639.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/bug28220.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/bug30549.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/bug31911.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/casefold.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/common.inc create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/htmlent.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/ini_language.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_convert_encoding.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_convert_variables.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_detect_encoding.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_detect_order.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg-compat-01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg-compat-02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-03.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-04.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-05.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-06.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-07.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-08.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-09.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace-compat-13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_replace.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_ereg_search_xxx.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_http_input.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_http_output.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_internal_encoding.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_output_handler_euc_jp.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_output_handler_shift_jis.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_parse_str.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_parse_str02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_preferred_mime_name.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_regex_set_options.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_send_mail01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_send_mail02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_send_mail03.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_send_mail04.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_send_mail05.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_send_mail06.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_send_mail07.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_split-compat-01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_split.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_strcut.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_strimwidth.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_strlen.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_strpos.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_strwidth.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_substitute_character.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_substr.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/mb_substr_count.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/overload01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/overload02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/php_gr_jp_10830.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/php_gr_jp_16242.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/php_gr_jp_dev_884-1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/php_gr_jp_dev_884-2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/simpletest.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/mbstring/tests/zend-multibyte.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mcrypt/tests/blowfish.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mcrypt/tests/bug35496.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mcrypt/tests/bug37595.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mcrypt/tests/bug41252.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mcrypt/tests/bug8040.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mcrypt/tests/vectors.txt create mode 100644 phpt/tests/php-5.2.5/ext/mhash/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mhash/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mhash/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mhash/tests/skip.inc create mode 100755 phpt/tests/php-5.2.5/ext/ming/tests/swfaction-new.phpt create mode 100644 phpt/tests/php-5.2.5/ext/ming/tests/swfaction.phpt create mode 100755 phpt/tests/php-5.2.5/ext/mysql/tests/001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/mysql/tests/002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/mysql/tests/003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/mysql/tests/connect.inc create mode 100755 phpt/tests/php-5.2.5/ext/mysql/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/016.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/018.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/019.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/020.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/021.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/022.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/023.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/024.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/025.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/026.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/027.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/028.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/029.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/030.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/031.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/032.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/033.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/034.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/035.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/036.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/037.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/038.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/039.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/040.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/041.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/042.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/043.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/044.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/045.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/046.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/047.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/048.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/049.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/050.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/051.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/052.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/053.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/054.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/055.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/056.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/057.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/058.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/059.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/060.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/061.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/062.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/063.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/064.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/065.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/066.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/067.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/068.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/071.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/072.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/073.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug28817.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug29311.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug30967.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug31141.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug31668.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug32405.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug33090.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug33263.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug33491.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug34785.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug34810.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug35103.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug35517.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug35759.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug36420.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug36745.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug36802.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug36949.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug37090.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/bug38003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/mysqli/tests/bug38710.phpt create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/connect.inc create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/skipifemb.inc create mode 100644 phpt/tests/php-5.2.5/ext/mysqli/tests/skipifnotemb.inc create mode 100644 phpt/tests/php-5.2.5/ext/ncurses/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_date.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_date1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_float.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_float1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_int.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_int1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_str.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/array_bind_str1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bind_empty.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bind_long.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bind_long_raw.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bind_raw.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug26133.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug27303.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug27303_2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug27303_3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug27303_4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug32325.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug35973.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug36010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug36096.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug37581.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug38161.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug38173.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug40078.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug40415.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug42134.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/bug42173.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/close.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_002_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_003_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_004_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_006_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_009_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_010_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_011_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_012_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_013_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_014_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_015_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_016.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_016_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_017_func.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_018.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/coll_019.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/commit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/commit_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/connect.inc create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/connect.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/connect_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/connect_1_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/connect_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/connect_with_charset_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/connect_without_oracle_home.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/connect_without_oracle_home_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/create_table.inc create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/create_type.inc create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/cursor_bind.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/cursor_bind_err.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/cursors.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/cursors_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/debug.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/default_prefetch.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/default_prefetch1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/default_prefetch2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/define.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/define1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/define2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/define3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/define4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/define5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/define_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/descriptors.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/details.inc create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/drop_table.inc create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/drop_type.inc create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/error1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/error2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/error_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/exec_fetch.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/execute_mode.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch_all.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch_all2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch_all3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch_array.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch_assoc.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch_into.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch_into1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch_into2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch_object.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/fetch_row.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/field_funcs.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/field_funcs1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/field_funcs2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/field_funcs_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/function_aliases.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_009.txt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_016.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_018.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_019.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_020.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_021.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_022.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_023.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_024.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_025.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_026.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_027.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_028.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_029.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_030.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_031.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_032.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_033.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_034.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_035.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_036.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_037.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_038.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_039.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_040.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_aliases.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_null.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_temp.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/lob_temp1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/num.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/oci8safemode.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/oci_execute_segfault.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/old_oci_close.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/old_oci_close1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/parse_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/password.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/password_2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/password_new.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/password_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/pecl_bug10194.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/pecl_bug10194_blob.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/pecl_bug8816.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/persistent.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/prefetch.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/prefetch_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/privileged_connect.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/privileged_connect1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/rowid_bind.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/select_null.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/serverversion.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/statement_cache.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/statement_type.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/statement_type_old.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/test.gif create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/test.txt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/uncommitted.phpt create mode 100644 phpt/tests/php-5.2.5/ext/oci8/tests/xmltype_01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/005_crt.txt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug25614.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug28382.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug28382cert.txt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug36732.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug37820.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug37820cert.pem create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug37820key.pem create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug38255.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug38261.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug39217.phpt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug39217cert1.txt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug39217cert2.txt create mode 100644 phpt/tests/php-5.2.5/ext/openssl/tests/bug41353.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcntl/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/backtrack_limit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug20528.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug21732.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug21758.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug26927.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug27011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug27103.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug33200.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pcre/tests/bug34790.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug37800.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug38600.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug40195.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug40909.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug41050.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug41148.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug41638.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/bug42298.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/cache_limit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/delimiters.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/dollar_endonly.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/grep.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/grep2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/invalid_utf8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/locales.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/match_flags.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/match_flags2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/match_flags3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/multiline.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/pcre_anchored.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/pcre_count.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/pcre_extended.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/pcre_extra.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/preg_replace.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/preg_replace2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/preg_replace_callback.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/preg_replace_callback2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/preg_replace_callback3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/recursion_limit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/split.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/split2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/study.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pcre/tests/ungreedy.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_34630.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_34687.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_35671.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pdo/tests/bug_36428.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_36798.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_38253.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_38394.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_39398.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_39656.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_40285.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_42917.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_43130.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/bug_43139.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pdo/tests/pdo.inc create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_016.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_016a.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_018.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_019.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_020.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_021.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_022.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_023.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_024.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_025.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_026.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_027.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_028.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_029.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_030.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_031.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_032.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_033.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_034.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pdo_test.inc create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pecl_bug_5217.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pecl_bug_5772.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo/tests/pecl_bug_5809.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_firebird/tests/common.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_firebird/tests/connect.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_firebird/tests/ddl.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_firebird/tests/execute.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_firebird/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/pdo_firebird/tests/testdb.inc create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/bug_33689.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/bug_37445.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/bug_39483.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/bug_41698.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/common.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/config.inc create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/last_insert_id.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/pecl_bug_5200.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/pecl_bug_5780.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/pecl_bug_5802.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_mysql/tests/show_tables.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/bug_33707.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/common.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_attr_autocommit_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_attr_autocommit_2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_attr_case.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_attr_client.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_attr_drivername.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_attr_nulls_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_attr_prefetch_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_attr_prefetch_2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_attr_server.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pdo_oci_quote1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pecl_bug_11345.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_oci/tests/pecl_bug_6364.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_odbc/tests/common.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_odbc/tests/long_columns.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_pgsql/tests/bug36727.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_pgsql/tests/bug_33876.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_pgsql/tests/common.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_pgsql/tests/config.inc create mode 100644 phpt/tests/php-5.2.5/ext/pdo_pgsql/tests/large_objects.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_sqlite/tests/bug33841.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_sqlite/tests/bug35336.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pdo_sqlite/tests/common.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/01createdb.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/02connection.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/03sync_query.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/04async_query.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/05large_object.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/06copy.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/07optional.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/08escape.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/09notice.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/10pg_convert.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/11pg_meta_data.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/12pg_insert.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/13pg_select.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/14pg_update.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/15pg_delete.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/16pg_result_status.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/17result.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/18pg_escape_bytea.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/19pg_ping.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/20pg_get_pid.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/21pg_get_notify.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pgsql/tests/22pg_fetch_object.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/23sync_query_params.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/24sync_query_prepared.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/25async_query_params.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/26async_query_prepared.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/80_bug14383.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pgsql/tests/80_bug24499.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pgsql/tests/80_bug27597.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pgsql/tests/80_bug32223.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pgsql/tests/80_bug32223b.phpt create mode 100755 phpt/tests/php-5.2.5/ext/pgsql/tests/80_bug36625.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/80_bug39971.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/80_bug42783.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/98old_api.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/9999dropdb.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/README create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/config.inc create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/php.gif create mode 100644 phpt/tests/php-5.2.5/ext/pgsql/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/posix/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pspell/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pspell/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pspell/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pspell/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pspell/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/pspell/tests/wordlist.txt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/006.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/007.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/008.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/026.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug26640.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug26695.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug29268.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug29523.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug29828.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug29986.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug30146.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug30148.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug30209.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug30856.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug30961.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug31651.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug32981.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug33312.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug33389.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug36308.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug36337.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug36434.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug37816.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug38132.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug38194.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug38217.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug38465.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug38653.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug38942.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug39001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug39067.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug39884.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug40431.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug40794.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/bug41061.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug41884.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/bug42976.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/exception.inc create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/parameters_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/parameters_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/property_exists.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_FileInfo_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_FileInfo_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_constructor_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_constructor_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_getConstant_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_getConstant_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_getConstants_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_getConstants_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_getConstructor_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_getConstructor_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_getName_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_getName_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_getName_error1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isInstance_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isInstance_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isInstantiable_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isInstantiable_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isInstantiable_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isInternal_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isInternal_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isSubclassOf_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isSubclassOf_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isSubclassOf_error1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isUserDefined_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionClass_isUserDefined_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_FileInfo_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_FileInfo_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_constructor_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_constructor_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_getConstant_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_getConstant_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_getConstants_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_getConstants_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_getConstructor_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_getConstructor_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_getName_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_getName_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_getName_error1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isInstance_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isInstance_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isInstantiable_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isInstantiable_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isInstantiable_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isInternal_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isInternal_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isSubclassOf_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isSubclassOf_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isUserDefined_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/reflection/tests/reflectionObject_isUserDefined_error.phpt create mode 100755 phpt/tests/php-5.2.5/ext/reflection/tests/static_properties_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/008-php4.2.3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/016.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/018.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/019.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/020.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/021.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/bug24592.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/bug26862.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/bug31454.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/bug36459.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/bug38377.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/bug41600.phpt create mode 100644 phpt/tests/php-5.2.5/ext/session/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/shmop/tests/001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/000.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/000.xml create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/006.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/008.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/009.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/009b.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/010.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/011.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/012.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/014.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/014a.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/014b.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/016.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/016a.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/018.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/019.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/020.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/021.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/022.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/023.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/024.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/025.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/026.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/027.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/028.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/029.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/030.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/031.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/032.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/033.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/book.xml create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug24392.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug24392.xml create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug25756.xsd create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug25756_1.xml create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug25756_2.xml create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug26976.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/bug27010.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/bug35785.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug36611.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug37386.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/bug37565.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug38347.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug38354.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug38406.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug38424.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug39662.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug39760.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug40451.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug41175.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug41582.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug41861.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug41867.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/bug41947.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile03.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile04.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile05.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile06.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile07.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile08.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile09.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/simplexml/tests/profile11.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/profile12.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/profile13.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/simplexml_import_dom.phpt create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/sxe.dtd create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/sxe.ent create mode 100755 phpt/tests/php-5.2.5/ext/simplexml/tests/sxe.xml create mode 100644 phpt/tests/php-5.2.5/ext/skeleton/tests/001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/any.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug27722.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug27722.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug27742.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug27742.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug28751.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug28969.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug28985.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug28985.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29061.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29061.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29109.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29109.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29236.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29236.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29795.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29795.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29830.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29839.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29839.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29844.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug29844.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug30045.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug30106.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug30106.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug30175.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug30175.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug30799.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug30928.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug30928.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug30994.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug31422.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug31695.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug31695.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug31755.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug32776.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug32776.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug32941.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug32941.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug34449.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug34453.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug34453.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug34643.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug34643.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug34657.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug35142.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug35142.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug35273.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36226-2.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36226-2.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36226.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36575.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36575.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36614.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36614.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36629.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36908.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36908.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36999.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug36999.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug37013.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug37013.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug37083.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug37083.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug37278.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug38004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug38004.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug38005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug38055.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug38055.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug38067.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug38067.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug38536.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug38536.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug39121.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug39815.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug39832.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug39832.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug40609.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug40609.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug41004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug41004.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug41097.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug41337.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug41337.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug41337_2.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug41337_2.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug41337_2_1.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug41477.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug41566.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug42086.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug42086.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug42151.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug42183.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug42214.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug42326.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug42326.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug42359.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug42359.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/bug42488.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/bugs/xml.xsd create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/bugs/xml2.xsd create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/classmap.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/classmap001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/classmap002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/classmap003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/classmap003.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/classmap004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_001p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_001s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_002p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_002s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_003p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_003s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_004p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_004s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_005p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_005s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_005w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_006p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_006s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_006w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_007p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_007s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_007w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_008p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_008s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_008w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_009p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_009s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_009w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_010p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_010s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_010w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_011p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_011s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_011w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_012p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_012s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_012w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_013p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_013s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_013w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_014p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_014s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_014w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_015p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_015w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_016p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_016s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_016w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_017p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_017s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_017w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_018p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_018s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_018w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_019p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_019s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_019w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_020p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_020s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_020w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_021p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_021s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_021w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_022p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_022s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_022w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_023p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_023s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_023w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_024p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_024s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/r2_base_024w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/round2_base.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/round2_base.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/Base/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_003p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_003s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005p.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005s.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/r2_groupB_005w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/round2_groupB.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/round2_groupB.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round2/GroupB/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/imported/import1B.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/imported/import2B.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/imported/import2B.xsd create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound1_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_compound2_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclit_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_doclitparams_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_emptysa_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import1_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import2_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_import3_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/r3_groupD_rpcenc_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound1.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound1.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound2.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_compound2.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclit.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclit.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclitparams.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_doclitparams.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_emptysa.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_emptysa.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import1.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import1.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import2.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import2.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import2_absolute.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import3.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_import3.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_rpcenc.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/round3_groupD_rpcenc.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupD/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_005w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_006w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupE/round3_groupE_list.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupE/round3_groupE_list.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupE/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/r3_groupF_ext_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/r3_groupF_extreq_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/r3_groupF_headers_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/round3_groupF_ext.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/round3_groupF_ext.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/round3_groupF_extreq.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/round3_groupF_headers.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/round3_groupF_headers.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round3/GroupF/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimedoc.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimedoc.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimerpc.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupG/round4_groupG_dimerpc.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimedoc.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimedoc.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimerpc.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupG/round4_groupG_mimerpc.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupG/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_005w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_006w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_007w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_008w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_009w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_doclit_010w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_005w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_006w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_007w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_008w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_009w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_complex_rpcenc_010w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_005w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_006w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_007w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_008w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_009w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_010w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_011w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_012w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_013w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_014w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_015w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_016w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_doclit_017w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_005w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_006w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_007w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_008w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_009w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_010w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_011w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_012w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_013w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_014w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_015w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_016w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_simple_rpcenc_017w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/r4_groupH_soapfault_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_doclit.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/round4_groupH_complex_rpcenc.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_doclit.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/round4_groupH_simple_rpcenc.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/round4_groupH_soapfault.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/round4_groupH_soapfault.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupH/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_001w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_002w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_003w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_004w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_005w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_006w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_007w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_008w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_009w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_010w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_011w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_012w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_013w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_014w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_015w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_016w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_017w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_018w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_019w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_020w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_021w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_022w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_023w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_024w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_025w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_026w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_027w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_028w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_029w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_030w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_031w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_032w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_033w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_034w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/r4_groupI_xsd_035w.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/round4_groupI_xsd.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/interop/Round4/GroupI/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema016.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema018.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema019.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema020.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema021.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema022.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema023.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema024.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema025.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema026.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema027.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema028.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema029.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema030.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema031.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema032.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema033.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema034.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema035.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema036.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema037.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema038.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema039.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema040.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema041.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema042.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema043.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema044.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema045.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema046.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema047.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema048.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema049.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema050.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema051.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema052.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema053.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema054.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema055.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema056.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema057.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema058.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema059.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema060.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema061.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema062.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema063.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema064.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema065.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema066.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema067.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema068.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema069.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema070.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema071.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema072.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema073.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema074.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema075.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema076.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema077.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema078.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema079.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema080.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema081.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema082.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema083.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema084.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/schema/schema085.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/schema/test_schema.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server016.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server018.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server019.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server020.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server021.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/server022.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/server023.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/server024.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/server025.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/server025.wsdl create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/server026.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/server027.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/server028.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/server029.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/setheaders.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T03.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T04.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T05.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T19.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T22.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T23.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T24.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T25.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T26.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T27.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T28.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T29.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T30.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T31.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T33.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T34.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T35.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T36.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T37.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T38_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T38_2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T39.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T40.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T41.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T42.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T43.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T44.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T45.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T46.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T47.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T48.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T49.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T50.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T51.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T52.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T53.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T54.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T55.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T56.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T57.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T58.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T59.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T60.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T61.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T63.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T64.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T65.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T66.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T67.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T68.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T69.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T70.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T71.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T72.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T73.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T74.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T75.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T76_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T76_2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T77_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T77_2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T77_3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T78.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/T80.phpt create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/soap12-test.inc create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/soap12/soap12-test.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/test.wsdl create mode 100644 phpt/tests/php-5.2.5/ext/soap/tests/transport001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap006.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap007.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap008.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap009.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap010.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap011.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap012.phpt create mode 100755 phpt/tests/php-5.2.5/ext/soap/tests/typemap013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sockets/tests/ipv4loop.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sockets/tests/ipv6loop.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/examples/tests/dualiterator_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/examples/tests/examples.inc create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/.htaccess create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_006.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_007.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_008.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_009.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_009a.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_010.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_011.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_012.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_013.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_014.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_015.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_016.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_017.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_018.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_019.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_020.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_021.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/array_022.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug28822.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug31185.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug31346.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug31348.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug31926.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug32134.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug32394.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug33136.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/bug34548.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/bug36258.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug36287.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/bug36825.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug36941.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug37457.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/bug38325.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/bug40036.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/bug40091.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug40442.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug40872.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/bug41691.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/bug41692.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/bug42259.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/bug42364.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug42654.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/bug42703.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/dit_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/fileobject_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/fileobject_001a.txt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/fileobject_001b.txt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/fileobject_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/fileobject_003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_006.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_007.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_008.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_009.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_010.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_011.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_012.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_013.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_014.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_015.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_016.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_017.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_018.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_019.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_020.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_021.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_022.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_023.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_024.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_025.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_026.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_027.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_028.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_029.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_030.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_031.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_032.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_033.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_034.phpt create mode 100644 phpt/tests/php-5.2.5/ext/spl/tests/iterator_035.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_036.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_037.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_038.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_039.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_040.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_041.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_041a.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_041b.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_042.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_043.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_044.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_045.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_046.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_047.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_048.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_049.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_049b.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_050.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_051.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_052.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_053.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_054.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/iterator_055.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/observer_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/observer_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/observer_003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/observer_004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/observer_005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_006.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_007.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_autoload_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_autoload_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_autoload_003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_autoload_004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_autoload_005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_autoload_006.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_autoload_007.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_autoload_008.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/spl_autoload_009.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/sxe_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/sxe_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/sxe_003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/sxe_004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/sxe_005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/testclass create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/testclass.class.inc create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/testclass.inc create mode 100755 phpt/tests/php-5.2.5/ext/spl/tests/testclass.php.inc create mode 100644 phpt/tests/php-5.2.5/ext/sqlite/tests/blankdb.inc create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/blankdb_oo.inc create mode 100644 phpt/tests/php-5.2.5/ext/sqlite/tests/bug26911.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/bug28112.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sqlite/tests/bug35248.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sqlite/tests/bug38759.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sqlite/tests/pdo/common.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_006.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_007.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_008.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_009.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_010.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_011.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_012.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_013.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_014.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_015.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_016.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_017.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_018.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_019.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_022.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_023.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_024.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_025.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_026.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_027.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_008.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_009.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_010.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_011.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_012.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_013.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_014.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_015.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_016.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_020.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_021.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_022.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_024.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_025.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_026.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_027.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_028.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_029.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_oo_030.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_spl_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_spl_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/sqlite/tests/sqlite_spl_003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_change_key_case.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_change_key_case_errors.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_change_key_case_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_chunk.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_chunk2.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/array_combine.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_count_values.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_count_values2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_diff_1.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/array_diff_assoc.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_diff_key.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_diff_key2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill_error.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill_keys.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill_object.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill_variation1_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_fill_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_object.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_filter_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_flip.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_flip_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_flip_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_flip_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_flip_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_flip_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_flip_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_flip_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_assoc_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_key.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_intersect_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_key_exists.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_keys_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_keys_variation_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_keys_variation_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_keys_variation_002_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_keys_variation_003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_keys_variation_004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_keys_variation_005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_map.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_map_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_pad.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_pop.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_pop_errors.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_pop_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_rand.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_rand_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_rand_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_rand_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_rand_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_rand_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_rand_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_rand_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_rand_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_rand_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_reverse_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_reverse_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_reverse_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_reverse_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_reverse_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_reverse_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_reverse_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_reverse_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_reverse_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_search.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_search1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_search_errors.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_search_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_search_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_search_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_search_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_splice_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_splice_errors.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_splice_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_splice_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_splice_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_splice_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_sum.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_object.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_unshift_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_user_key_compare.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_values.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_values_errors.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_values_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_values_variation_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_walk.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_walk_objects.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_walk_rec_objects.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_walk_recursive.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/array_walk_recursive1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_object1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_object2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/asort_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug12776.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug14580.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug20381.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug20865.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug21182.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/bug21918.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug21998.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug22088.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug22463.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug23581.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug23788.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug24198.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug24220.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug24766.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug24897.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug24980.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug25359.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug25708.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug25758.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug26458.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug28739.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug28974.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/bug29253.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug29493.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug30074.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/bug30266.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug30833.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/bug31158.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug31213.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug32021.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug33382.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/bug33940.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/bug33989.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug34066.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug34066_1.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/bug34227.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/array/bug34982.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug35014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug35014_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug35022.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug35821.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug36975.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug38464.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug39576.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug40191.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug40709.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug41121.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug41686.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/bug42233.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/compact.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/count_recursive.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/data.inc create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/each.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/end.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/end_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/extract_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/extract_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/extract_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/extract_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/extract_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/extract_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/extract_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/extract_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/extract_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/extract_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/in_array_errors.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/in_array_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/in_array_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/in_array_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/in_array_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/locale_sort.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/max.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/max_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/max_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/max_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/max_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/min.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/min_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/min_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/min_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/min_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/range.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/range_errors.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/range_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/range_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/range_variation1_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/shuffle_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/shuffle_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/shuffle_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/shuffle_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/shuffle_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/shuffle_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/shuffle_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/shuffle_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_object1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_object2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/sort_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/var_export.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/var_export2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/array/var_export3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert03.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert04.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert_basic3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert_basic4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert_basic5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert_error1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/assert/assert_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/001-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/005_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/005_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/005_variation-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/005_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/006_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/006_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/006_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/006_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation11-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation12-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation13-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation16.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation17.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation18.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation19.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation20.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation21.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation22.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation23.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation24.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/007_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug12556.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug20424.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug22382.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug22414.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug24313.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug24482.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug26003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug26615.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug26938.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug27508.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug27619.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug30362.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug30362.txt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug32160.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug32160.txt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug35740.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug35781.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug37158.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug37864.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug38086.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug38086.txt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug38450.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug38450_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug38450_2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug38450_3.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/bug39367.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug39538.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug39551.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug39673.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug40374.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug41655_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug41655_2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug41693.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug41815.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/bug43137.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/clearstatcache_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation12-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation16-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation16.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation17.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation18.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation3-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation4-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation5-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation6-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/copy_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/disk.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/disk_free_space_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/disk_free_space_error-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/disk_free_space_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/disk_free_space_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/disk_total_space_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/disk_total_space_error-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/disk_total_space_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/disk_total_space_variation.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/fflush_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fflush_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fflush_variation1-win32.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/fflush_variation1.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/fflush_variation2.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/fflush_variation3.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/fflush_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetc_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetc_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetc_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetc_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetc_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetc_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation16.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation17.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation18.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation19.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation20.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation21.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation22.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation23.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation24.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation25.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation26.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation27.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation28.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation29.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation30.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation31.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetcsv_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgets_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgets_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgets_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgets_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgets_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgets_variation4-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgets_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgets_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgets_variation6-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgets_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_basic2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_variation1-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_variation3-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_variation5-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/file.inc create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/file_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/file_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/file_get_contents_file_put_contents_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/file_get_contents_file_put_contents_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/file_get_contents_file_put_contents_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/file_get_contents_file_put_contents_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/file_put_contents.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/file_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filegroup_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filegroup_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fileinode_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fileinode_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fileinode_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fileowner_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fileowner_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filesize_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filesize_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filesize_variation1-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filesize_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filesize_variation2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filesize_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filesize_variation3-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filesize_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filesize_variation4-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filesize_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filestat.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filetype_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filetype_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/filetype_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/flock.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/flock_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/flock_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/flock_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fnmatch_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fnmatch_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fnmatch_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fopencookie.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fpassthru_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fpassthru_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fpassthru_variation.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fputcsv_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fread_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fread_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fread_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fread_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fread_variation3-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fread_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fread_variation4-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fread_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation16.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation17.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation18.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation19.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation20.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation21.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation22.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation23.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation24.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation25.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation26.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation27.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation28.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation29.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation30.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation31.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation33.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation34.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation35.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation36.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation37.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation38.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation39.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation40.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation41.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation42.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation43.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation44.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation45.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation46.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation47.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation48.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation49.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation50.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation51.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation52.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation53.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation54.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation55.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fscanf_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_basic2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation4-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation6-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation8-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fseek_ftell_rewind_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fstat.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation1-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation3-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation4-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation5-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation6-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation7-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/ftruncate_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_basic-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_variation1-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_variation2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_variation3-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_variation4-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/fwrite_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/get_current_user.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/glob_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/glob_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/glob_variation-win32.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/glob_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/htmlentities19.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/htmlspecialchars.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/include_userstream_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/include_userstream_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_dir_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_dir_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_dir_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_dir_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_dir_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_dir_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_executable_basic-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_executable_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_executable_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_executable_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_executable_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_executable_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_file_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_file_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_file_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_file_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_file_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_file_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_readable_basic-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_readable_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_readable_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_readable_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_readable_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_readable_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_writable_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_writable_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_writable_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_writable_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/is_writable_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_error.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation16.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation17.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation18.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation19.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation20.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation21.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation3.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation4.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation5.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/lstat_stat_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/magic_quotes.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/mkdir-001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/mkdir-002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/mkdir-003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/mkdir-004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/mkdir-005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/mkdir-006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/mkdir_rmdir_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/mkdir_rmdir_variation-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/mkdir_rmdir_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/mkdir_rmdir_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/parse_ini_file.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/pathinfo_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/pathinfo_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/pathinfo_variaton.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/popen_pclose_basic-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/popen_pclose_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/popen_pclose_error-sunos.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/popen_pclose_error-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/popen_pclose_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/proc_open01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readfile_basic-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readfile_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readfile_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readfile_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readfile_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readfile_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readlink_realpath_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readlink_realpath_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readlink_realpath_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readlink_realpath_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readlink_realpath_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/readlink_realpath_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/realpath_basic-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/realpath_error-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/realpath_variation-win32.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_basic.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_variation-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/rename_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stat_basic-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stat_error-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stat_variation1-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stat_variation2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stat_variation3-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stat_variation4-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stat_variation5-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stat_variation6-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stat_variation7-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stat_variation8-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/statcache-corruption.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/statpage.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_copy_to_stream.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_get_line.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_rfc2397_001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_rfc2397_002.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_rfc2397_003.gif create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_rfc2397_003.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_rfc2397_004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_rfc2397_005.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_rfc2397_006.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/stream_rfc2397_007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_error1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_error2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation1-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation3-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation7-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/tempnam_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/test.csv create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/test2.csv create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/test3.csv create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/touch.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/umask_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/umask_error.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/umask_variation1.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/file/umask_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/unlink_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/unlink_error-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/unlink_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/unlink_variation1-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/unlink_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/unlink_variation2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/unlink_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/unlink_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/unlink_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/unlink_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/userdirstream.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/userfilters.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/userstreams.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/file/userwrapper.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/filters/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/filters/basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/filters/bug22538.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/filters/bug35916.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/filters/php_user_filter_01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/filters/php_user_filter_02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/filters/php_user_filter_03.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/filters/read.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/004.data create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/010.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug25038.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug27678.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug29038.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug31190.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug32647.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug34794.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug35229.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug36011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug39322.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug40398.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug40752.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug41037.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug41445.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug41445_1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/bug41518.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/debug_zval_dump_b.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/debug_zval_dump_e.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/debug_zval_dump_o.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/debug_zval_dump_v.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/error_get_last.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/floatval.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/getopt.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/getrusage.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/gettype_settype_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/gettype_settype_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/gettype_settype_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/gettype_settype_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/gettype_settype_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/gettype_settype_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/gettype_settype_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/gettype_settype_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/gettype_settype_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/gettype_settype_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/head.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/highlight_heredoc.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/import_request.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/import_request1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/import_request2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/import_request3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/include_path.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/ini_get_all.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/intval.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_array.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_bool.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_callable.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_float.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_float_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_int.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_int_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_null.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_numeric.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_object.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_resource.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_scalar.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/is_string.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/parse_ini_file.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/phpcredits.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/phpcredits2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/phpinfo.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/phpinfo2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/print_r.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/print_r_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/proc_open.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/proc_open02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/putenv.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/rand.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/strval.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/sunfuncts.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/sys_getloadavg.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/type.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/var_dump.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/var_dump_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/var_export-locale.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/general_functions/var_export.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/246x247.png create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/384x385.png create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/bug13213.jpg create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/bug13213.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/getimagesize.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/getimagesize_246x247.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/getimagesize_384x385.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/getimagesize_swc.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/image_type_to_extension.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/image_type_to_mime_type.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/iptcembed_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/skipif_imagetype.inc create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/image/test13pix.swf create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/test1pix.bmp create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/test1pix.jp2 create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/test1pix.jpc create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/test1pix.jpg create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/test2pix.gif create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/test4pix.gif create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/test4pix.iff create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/test4pix.png create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/test4pix.psd create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/image/test4pix.swf create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/image/test4pix.tif create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/abs.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/acos_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/acos_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/acos_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/acosh_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/acosh_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/acosh_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/allowed_rounding_error.inc create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/asin_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/asin_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/asin_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/asinh_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/asinh_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/asinh_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/atan_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/atan_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/atan_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/atanh_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/atanh_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/atanh_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/bug21523.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/bug24142.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/bug25665.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/bug25694.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/math/bug27646.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/math/bug28228.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/math/bug30069.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/bug30695.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/constants.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/cos_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/cos_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/cos_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/cosh_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/cosh_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/cosh_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/floorceil.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/hexdec.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/log.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/pow.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/round.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/sin_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/sin_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/sin_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/sinh_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/sinh_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/sinh_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/tan_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/tan_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/tan_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/tanh_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/tanh_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/math/tanh_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/bug20134.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/bug41347.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/inet.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/inet_ipv6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/ip.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/ip_x86_64.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/network/shutdown.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/tcp4loop.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/tcp6loop.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/udgloop.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/udp4loop.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/udp6loop.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/network/unixloop.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/reg/016.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/004.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/serialize/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/006.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/serialize/autoload_implements.p5c create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/serialize/autoload_interface.p5c create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug14293.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug21957.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug23298.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug24063.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug25378.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug26762.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug27469.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug28325.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug30234.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug31402.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug31442.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/serialize/bug37947.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/serialize/unserializeS.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/add-and-stripcslashes.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/add-and-stripslashes.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/addcslashes_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/addcslashes_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/addcslashes_003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/addcslashes_004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/addslashes_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/addslashes_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/addslashes_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/addslashes_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/addslashes_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/basename.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/basename_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/basename_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/basename_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bin2hex.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug20108.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug20169.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug20261.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug20927.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug20934.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug21338.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug21453.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug21730.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug21744.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug22008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug22187.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug22207.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug22224.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug22227.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug22904.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug23650.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug23894.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug24098.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug24208.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug24281.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug24312.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug25671.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug25707.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug26817.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug26819.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug26878.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug26973.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug27276.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug27278.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug27295.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug27457.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug27675.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug28386.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug28633.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug29075.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug29119.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug29538.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug33076.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug33605.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug34214.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug35817.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug36148.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug36306.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug36392.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug36944.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug37244.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug37262.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug38322.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug38770.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug39032.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug39350.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug39621.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug39873.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug40432.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug40637.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug40704.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug40754.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug40915.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug42107.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/bug42208.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chop_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chop_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chop_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chop_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chop_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chop_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chop_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chr_ord.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/chunk_split_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/convert_cyr_string.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/count_chars.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/crc32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/crc32_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/crc32_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/crc32_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/crc32_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/crc32_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/crc32_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/crypt.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/dirname_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/dirname_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/dirname_variation.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/explode.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/explode1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_003_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_006_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_007_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_008_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/fprintf_variation_009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_basic1-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_basic2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_basic3-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_basic3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_variation1-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_variation2-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_html_translation_table_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/get_meta_tags.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/highlight_file.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities-utf.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities01.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities02.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities03.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities04.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities05.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities06.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities07.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities08.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities09.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities16.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities17.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlentities18.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlspecialchars_decode_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlspecialchars_decode_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlspecialchars_decode_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlspecialchars_decode_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlspecialchars_decode_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlspecialchars_decode_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/htmlspecialchars_decode_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/http_build_query.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/implode.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/implode1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/join_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/join_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/join_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/join_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/join_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/join_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/join_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/join_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/levenshtein.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/ltrim.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/md5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/md5_file.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/md5raw.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/metaphone.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/strings/moneyformat.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/nl2br.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/nl2br_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/nl2br_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/nl2br_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/nl2br_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/nl2br_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/nl2br_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/pack.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/pathinfo.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/php_strip_whitespace.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/strings/printf.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/strings/printf_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/rtrim.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/setlocale_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/setlocale_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/setlocale_basic3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/setlocale_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/setlocale_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/setlocale_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/setlocale_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/setlocale_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/setlocale_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sha1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sha1raw.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/soundex.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_basic3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_basic4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_basic5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_basic6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_basic7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_basic8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_basic9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_error.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_f.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_f_2.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_f_3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation16.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation17.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation18.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation19.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation20.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation21.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation22.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation23.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation24.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation25.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation26.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation27.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation28.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation29.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation30.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation31.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation33.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation34.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation35.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation36.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation37.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation38.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation39.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation40.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation41.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation42.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation43.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation44.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation45.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation46.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation47.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation48.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation49.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation50.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation51.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation52.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation53.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/sprintf_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_ireplace.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_pad.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_repeat.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_replace.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_shuffle.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_variation2_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_variation6_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_split_variation7_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_word_count.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/str_word_count1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcasecmp.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcmp.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strcspn_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strings001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/stristr.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strlen.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strpos.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strripos.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strripos_offset.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strstr.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtolower-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtolower.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtoupper.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtoupper1-win32.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtoupper1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/strval.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/substr.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_compare.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_variation_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_variation_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_replace.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/trim.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/trim1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/ucfirst.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/unpack.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/url_t.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/uuencode.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation10.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation11.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation12.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation13.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation14.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation15.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation16.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation17.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation18.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation19.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation6.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation7.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation8.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation9.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_basic.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_error.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation1.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation2.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation3.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation4.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation5.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/time/001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/standard/tests/time/bug38524.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/time/idate.phpt create mode 100644 phpt/tests/php-5.2.5/ext/standard/tests/versioning/version_compare.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug22403.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug26407.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug27843.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug28354.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug29064.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug30312.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug6339.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/index.php create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test.inc create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_appname.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_connect.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_connectionbased_msghandler.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_fetch_object.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_fields.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_long.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_msghandler.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_msghandler_handled.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_query_nostore.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_types.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_unbuffered_query.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sysvmsg/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sysvmsg/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sysvsem/tests/sysv.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sysvshm/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sysvshm/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sysvshm/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sysvshm/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sysvshm/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sysvshm/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/sysvshm/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/005.html create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/007.html create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/013.html create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/013.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/014.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/015.html create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/015.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/016.html create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/016.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/016.tcfg create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/017.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/018.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/019.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/020.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/021.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/022.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/023.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/024.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/025.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/026.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/027.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/028.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tidy/tests/029.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tokenizer/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tokenizer/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tokenizer/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/tokenizer/tests/bug26463.phpt create mode 100644 phpt/tests/php-5.2.5/ext/wddx/tests/001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/wddx/tests/bug27287.phpt create mode 100755 phpt/tests/php-5.2.5/ext/wddx/tests/bug34306.phpt create mode 100755 phpt/tests/php-5.2.5/ext/wddx/tests/bug35410.phpt create mode 100755 phpt/tests/php-5.2.5/ext/wddx/tests/bug35410_64bit.phpt create mode 100755 phpt/tests/php-5.2.5/ext/wddx/tests/bug37569.phpt create mode 100755 phpt/tests/php-5.2.5/ext/wddx/tests/bug37587.phpt create mode 100644 phpt/tests/php-5.2.5/ext/wddx/tests/bug41283.phpt create mode 100644 phpt/tests/php-5.2.5/ext/wddx/tests/bug41527.phpt create mode 100644 phpt/tests/php-5.2.5/ext/wddx/tests/wddx.xml create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/bug25666.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/bug26528.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/bug26614.phpt create mode 100755 phpt/tests/php-5.2.5/ext/xml/tests/bug26614_libxml.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/bug27908.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/bug30266.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/bug32001.phpt create mode 100755 phpt/tests/php-5.2.5/ext/xml/tests/bug32001b.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/bug35447.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/inc.ent create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/xml001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/xml002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/xml003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/xml004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/xml006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/xml007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/xml009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/xml010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/xml011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xml/tests/xmltest.xml create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/011.phpt create mode 100755 phpt/tests/php-5.2.5/ext/xmlreader/tests/012.dtd create mode 100755 phpt/tests/php-5.2.5/ext/xmlreader/tests/012.phpt create mode 100755 phpt/tests/php-5.2.5/ext/xmlreader/tests/012.xml create mode 100755 phpt/tests/php-5.2.5/ext/xmlreader/tests/013.phpt create mode 100755 phpt/tests/php-5.2.5/ext/xmlreader/tests/013.xsd create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/bug36743.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/bug42139.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/dtdexample.dtd create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG.rng create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG2.rng create mode 100644 phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG3.rng create mode 100644 phpt/tests/php-5.2.5/ext/xmlrpc/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlrpc/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug37057.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug38431.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug40576.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug40576_64bit.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug42189.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug39504.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug41287.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug41326.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/area_list.xsl create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/area_name.xml create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/bug26384.phpt create mode 100755 phpt/tests/php-5.2.5/ext/xsl/tests/bug33853.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/documentxpath.xsl create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/exslt.xml create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/exslt.xsl create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/prepare.inc create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/streamsinclude.xsl create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xml create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xsl create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xsl.gz create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt008.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt010.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.xml create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.xsl create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt012.phpt create mode 100644 phpt/tests/php-5.2.5/ext/xsl/tests/xslt012.xsl create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/binarynull.zip create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug11216.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug38943.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug38944.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug40228.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug40228.zip create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug7214.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug7658.odt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug7658.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug7658.xml create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug8009.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug8009.zip create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/bug8700.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_addemptydir.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_addfile.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_close.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_delete.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_ext_zip.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_extract.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_getcomment.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_getnameindex.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_namelocate.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_open.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_properties.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_rename.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_setcomment.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/oo_stream.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/test.zip create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/test_procedural.zip create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/test_with_comment.zip create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/utils.inc create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/zip_close.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_compressedsize.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_compressionmethod.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_filesize.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_name.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_open.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_read.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/zip_open.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zip/tests/zip_read.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/004.txt.gz create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/bug_34821.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/compress_zlib_wrapper.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/gzfilegzreadfile.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/gzreadgzwrite.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/gzreadgzwriteplain.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/zlib_filter_deflate.phpt create mode 100644 phpt/tests/php-5.2.5/ext/zlib/tests/zlib_filter_inflate.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/002.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/008.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/include.inc create mode 100644 phpt/tests/php-5.2.5/sapi/cgi/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/001.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/002-win32.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/002.phpt create mode 100755 phpt/tests/php-5.2.5/sapi/cli/tests/003-2.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/003.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/004.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/005.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/006.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/007.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/008.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/009.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/010-2.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/010.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/011.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/012.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/013.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/014.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/015.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/cli/tests/skipif.inc create mode 100644 phpt/tests/php-5.2.5/sapi/tests/test001.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/tests/test002.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/tests/test003.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/tests/test004.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/tests/test005.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/tests/test006.phpt create mode 100644 phpt/tests/php-5.2.5/sapi/tests/test007.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/004.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/005.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/006.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/007.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/008.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/009.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/010.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/011.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/012.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/013.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/014.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/015.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/016.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/017.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/018.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/019.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/020.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/021.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/022.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/023.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/024.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/025.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/026.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/027.phpt create mode 100644 phpt/tests/php-5.2.5/tests/basic/bug20539.phpt create mode 100755 phpt/tests/php-5.2.5/tests/basic/bug29971.phpt create mode 100644 phpt/tests/php-5.2.5/tests/bin-info.inc create mode 100644 phpt/tests/php-5.2.5/tests/classes/__call_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/__call_002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/__set__get_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/__set__get_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/__set__get_003.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/__set__get_004.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/__set__get_005.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/__set_data_corrupt.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/abstract.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/abstract_by_interface_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/abstract_by_interface_002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/abstract_class.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/abstract_derived.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/abstract_final.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/abstract_inherit.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/abstract_not_declared.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/abstract_redeclare.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/abstract_static.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/abstract_user_call.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/array_access_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/array_access_002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/array_access_003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/array_access_004.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/array_access_005.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/array_access_006.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/array_access_007.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/array_access_008.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/array_access_009.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/array_access_010.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/array_access_011.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/array_access_012.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/array_access_013.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/assign_op_property_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/autoload_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/autoload_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/autoload_003.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/autoload_004.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/autoload_005.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/autoload_006.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/autoload_derived.p5c create mode 100755 phpt/tests/php-5.2.5/tests/classes/autoload_implements.p5c create mode 100755 phpt/tests/php-5.2.5/tests/classes/autoload_interface.p5c create mode 100755 phpt/tests/php-5.2.5/tests/classes/autoload_root.p5c create mode 100644 phpt/tests/php-5.2.5/tests/classes/bug23951.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/bug24399.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/bug24445.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/bug26737.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/bug27468.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/bug27504.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/bug29446.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/class_abstract.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/class_example.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/class_final.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/class_stdclass.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/clone_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/clone_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/clone_003.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/clone_004.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/clone_005.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/clone_006.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/constants_scope_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/ctor_dtor.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/ctor_dtor_inheritance.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/ctor_failure.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_01.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_02.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_03.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_04.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/ctor_name_clash.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/ctor_visibility.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/dereferencing_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/destructor_and_echo.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/destructor_and_exceptions.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/destructor_and_globals.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/destructor_and_references.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/destructor_inheritance.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/destructor_visibility_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/destructor_visibility_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/destructor_visibility_003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/factory_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_003.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_004.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_005.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_006.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_007.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_008.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_009.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_010.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/final.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/final_abstract.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/final_ctor1.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/final_ctor2.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/final_redeclare.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/incdec_property_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/incdec_property_002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/incdec_property_003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/incdec_property_004.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/inheritance.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/inheritance_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/inheritance_003.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/inheritance_004.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/interface_and_extends.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interface_class.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interface_doubled.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interface_implemented.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interface_instantiate.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interface_member.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interface_method.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interface_method_final.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interface_method_private.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interface_must_be_implemented.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/interface_optional_arg.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interfaces_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/interfaces_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/interfaces_003.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/iterators_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/iterators_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/iterators_003.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/iterators_004.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/iterators_005.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/iterators_006.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/iterators_007.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/object_reference_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_003b.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_004.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_004b.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_005.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_005b.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_006.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_006b.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_007.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/private_007b.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/private_members.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/private_redeclare.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/protected_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/protected_001b.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/protected_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/serialize_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/singleton_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/static_mix_1.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/static_mix_2.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/static_properties_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/static_this.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/this.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/tostring_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/tostring_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/tostring_003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/type_hinting_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/type_hinting_002.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/type_hinting_003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_000a.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_000b.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_000c.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_001a.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_001b.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_001c.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_002a.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_002b.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_002c.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_003a.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_003b.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_003c.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_004a.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_004b.phpt create mode 100644 phpt/tests/php-5.2.5/tests/classes/visibility_004c.phpt create mode 100755 phpt/tests/php-5.2.5/tests/classes/visibility_005.phpt create mode 100644 phpt/tests/php-5.2.5/tests/foo create mode 100644 phpt/tests/php-5.2.5/tests/foo2 create mode 100644 phpt/tests/php-5.2.5/tests/foo3 create mode 100644 phpt/tests/php-5.2.5/tests/foo4 create mode 100644 phpt/tests/php-5.2.5/tests/func/001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/func/002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/func/003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/func/004.phpt create mode 100644 phpt/tests/php-5.2.5/tests/func/005.phpt create mode 100644 phpt/tests/php-5.2.5/tests/func/005a.phpt create mode 100644 phpt/tests/php-5.2.5/tests/func/006.phpt create mode 100644 phpt/tests/php-5.2.5/tests/func/007.phpt create mode 100644 phpt/tests/php-5.2.5/tests/func/008.phpt create mode 100644 phpt/tests/php-5.2.5/tests/func/009.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/004.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/005.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/006.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/007.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/008.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/009.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/010.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/011.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/012.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/013.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/014.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/015.inc create mode 100644 phpt/tests/php-5.2.5/tests/lang/015.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/016.inc create mode 100644 phpt/tests/php-5.2.5/tests/lang/016.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/017.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/018.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/019.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/020.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/021.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/022.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/023-1.inc create mode 100755 phpt/tests/php-5.2.5/tests/lang/023-2.inc create mode 100644 phpt/tests/php-5.2.5/tests/lang/023.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/024.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/025.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/026.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/027.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/028.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/030.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/031.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/032.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/033.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/034.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/035.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/036.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/037.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/038.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/039.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/040.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bison1.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug17115.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug18872.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug19566.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug19943.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug20175.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug21094.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug21600.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug21669.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug21820.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug21849.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug21961.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug22231.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug22510.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug22592.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug22690.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug23279.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug23384.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug23489.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug23524.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug23584.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug23624.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug23922.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug24054.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug24396.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug24403.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug24436.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug24499.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug24573.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug24640.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug24652.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug24658.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug24783.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug24908.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug24926.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug24951.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug25145.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug25547.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug25652.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug25922.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug26182.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug26696.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug26866.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug26869.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug27354.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug27439.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug27443.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug27535.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug28213.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug28800.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug29566.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug29893.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug29944.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug30578.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug30638.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug30726.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug30862.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug32828.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug32924.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug35176.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug35382.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug38579.inc create mode 100755 phpt/tests/php-5.2.5/tests/lang/bug38579.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/bug7515.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/catchable_error_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/catchable_error_002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/each_binary_safety.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/error_2_exception_001.phpt create mode 100755 phpt/tests/php-5.2.5/tests/lang/foreach_with_object_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/foreach_with_references_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/inc.inc create mode 100644 phpt/tests/php-5.2.5/tests/lang/type_hints_001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/type_hints_002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/lang/type_hints_003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/odbc-display.php create mode 100644 phpt/tests/php-5.2.5/tests/odbc-t1.php create mode 100644 phpt/tests/php-5.2.5/tests/odbc-t2.php create mode 100644 phpt/tests/php-5.2.5/tests/odbc-t3.php create mode 100644 phpt/tests/php-5.2.5/tests/odbc-t4.php create mode 100644 phpt/tests/php-5.2.5/tests/odbc-t5.php create mode 100644 phpt/tests/php-5.2.5/tests/quicktester.inc create mode 100644 phpt/tests/php-5.2.5/tests/recurse create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test003.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test004.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test005.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test006.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test007.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test008.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test008a.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test009.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run-test/test010.phpt create mode 100644 phpt/tests/php-5.2.5/tests/run.html create mode 100644 phpt/tests/php-5.2.5/tests/run.php create mode 100644 phpt/tests/php-5.2.5/tests/scan_cases create mode 100644 phpt/tests/php-5.2.5/tests/strings/001.phpt create mode 100644 phpt/tests/php-5.2.5/tests/strings/002.phpt create mode 100644 phpt/tests/php-5.2.5/tests/strings/004.phpt create mode 100755 phpt/tests/php-5.2.5/tests/strings/bug22592.phpt create mode 100644 phpt/tests/php-5.2.5/tests/strings/bug26703.phpt create mode 100644 phpt/tests/php-5.2.5/tests/test.pl create mode 100644 phpt/tests/php-5.2.5/tests/test_class_inheritance create mode 100644 phpt/tests/php-5.2.5/tests/testarray create mode 100644 phpt/tests/php-5.2.5/tests/testarray.pl create mode 100644 phpt/tests/php-5.2.5/tests/testarray2 create mode 100644 phpt/tests/php-5.2.5/tests/testarray2.pl create mode 100644 phpt/tests/php-5.2.5/tests/testclassfunc create mode 100644 phpt/tests/php-5.2.5/tests/testcom create mode 100644 phpt/tests/php-5.2.5/tests/testcpdf create mode 100644 phpt/tests/php-5.2.5/tests/testcpdfclock create mode 100644 phpt/tests/php-5.2.5/tests/testdom create mode 100644 phpt/tests/php-5.2.5/tests/testfe create mode 100644 phpt/tests/php-5.2.5/tests/testfunc create mode 100644 phpt/tests/php-5.2.5/tests/testfunc.pl create mode 100644 phpt/tests/php-5.2.5/tests/testfunc2 create mode 100644 phpt/tests/php-5.2.5/tests/testfunc2.pl create mode 100644 phpt/tests/php-5.2.5/tests/testfuncref create mode 100644 phpt/tests/php-5.2.5/tests/testhyperwave create mode 100644 phpt/tests/php-5.2.5/tests/testinclude create mode 100644 phpt/tests/php-5.2.5/tests/testobj create mode 100644 phpt/tests/php-5.2.5/tests/testpfpro.php create mode 100644 phpt/tests/php-5.2.5/tests/tests.dsp create mode 100644 phpt/tests/php-5.2.5/tests/tests.mak create mode 100644 phpt/tests/php-5.2.5/tests/testscanf.php create mode 100644 phpt/tests/php-5.2.5/tests/testswf create mode 100644 src/Makefile create mode 100644 src/cpp/Makefile create mode 100644 src/cpp/base/Makefile create mode 100644 src/cpp/base/array/array_data.cpp create mode 100644 src/cpp/base/array/array_data.h create mode 100644 src/cpp/base/array/array_element.cpp create mode 100644 src/cpp/base/array/array_element.h create mode 100644 src/cpp/base/array/array_funcs.h create mode 100644 src/cpp/base/array/array_iterator.cpp create mode 100644 src/cpp/base/array/array_iterator.h create mode 100644 src/cpp/base/array/array_util.cpp create mode 100644 src/cpp/base/array/array_util.h create mode 100644 src/cpp/base/array/empty_array.cpp create mode 100644 src/cpp/base/array/empty_array.h create mode 100644 src/cpp/base/array/map.cpp create mode 100644 src/cpp/base/array/map.h create mode 100644 src/cpp/base/array/map_long.cpp create mode 100644 src/cpp/base/array/map_long.h create mode 100644 src/cpp/base/array/map_string.cpp create mode 100644 src/cpp/base/array/map_string.h create mode 100644 src/cpp/base/array/map_variant.cpp create mode 100644 src/cpp/base/array/map_variant.h create mode 100644 src/cpp/base/array/vector.cpp create mode 100644 src/cpp/base/array/vector.h create mode 100644 src/cpp/base/array/vector_long.cpp create mode 100644 src/cpp/base/array/vector_long.h create mode 100644 src/cpp/base/array/vector_string.cpp create mode 100644 src/cpp/base/array/vector_string.h create mode 100644 src/cpp/base/array/vector_variant.cpp create mode 100644 src/cpp/base/array/vector_variant.h create mode 100644 src/cpp/base/array/zend_array.cpp create mode 100644 src/cpp/base/array/zend_array.h create mode 100644 src/cpp/base/base_includes.h create mode 100644 src/cpp/base/builtin_functions.cpp create mode 100644 src/cpp/base/builtin_functions.h create mode 100644 src/cpp/base/class_info.cpp create mode 100644 src/cpp/base/class_info.h create mode 100644 src/cpp/base/class_statics.cpp create mode 100644 src/cpp/base/class_statics.h create mode 100644 src/cpp/base/comparisons.cpp create mode 100644 src/cpp/base/comparisons.h create mode 100644 src/cpp/base/debug/backtrace.cpp create mode 100644 src/cpp/base/debug/backtrace.h create mode 100644 src/cpp/base/dynamic_object_data.cpp create mode 100644 src/cpp/base/dynamic_object_data.h create mode 100644 src/cpp/base/execution_context.cpp create mode 100644 src/cpp/base/execution_context.h create mode 100644 src/cpp/base/file/file.cpp create mode 100644 src/cpp/base/file/file.h create mode 100644 src/cpp/base/file/mem_file.cpp create mode 100644 src/cpp/base/file/mem_file.h create mode 100644 src/cpp/base/file/output_file.cpp create mode 100644 src/cpp/base/file/output_file.h create mode 100644 src/cpp/base/file/pipe.cpp create mode 100644 src/cpp/base/file/pipe.h create mode 100644 src/cpp/base/file/plain_file.cpp create mode 100644 src/cpp/base/file/plain_file.h create mode 100644 src/cpp/base/file/socket.cpp create mode 100644 src/cpp/base/file/socket.h create mode 100644 src/cpp/base/file/temp_file.cpp create mode 100644 src/cpp/base/file/temp_file.h create mode 100644 src/cpp/base/file/url_file.cpp create mode 100644 src/cpp/base/file/url_file.h create mode 100644 src/cpp/base/file/zip_file.cpp create mode 100644 src/cpp/base/file/zip_file.h create mode 100644 src/cpp/base/frame_injection.cpp create mode 100644 src/cpp/base/frame_injection.h create mode 100644 src/cpp/base/global_array_wrapper.cpp create mode 100644 src/cpp/base/global_array_wrapper.h create mode 100644 src/cpp/base/hphp.h create mode 100644 src/cpp/base/hphp_ffi.cpp create mode 100644 src/cpp/base/hphp_ffi.h create mode 100644 src/cpp/base/hphp_system.h create mode 100644 src/cpp/base/list_assignment.cpp create mode 100644 src/cpp/base/list_assignment.h create mode 100644 src/cpp/base/macros.h create mode 100644 src/cpp/base/memory/leak_detectable.cpp create mode 100644 src/cpp/base/memory/leak_detectable.h create mode 100644 src/cpp/base/memory/linear_allocator.cpp create mode 100644 src/cpp/base/memory/linear_allocator.h create mode 100644 src/cpp/base/memory/memory_manager.cpp create mode 100644 src/cpp/base/memory/memory_manager.h create mode 100644 src/cpp/base/memory/smart_allocator.cpp create mode 100644 src/cpp/base/memory/smart_allocator.h create mode 100644 src/cpp/base/memory/smart_allocator.inc create mode 100644 src/cpp/base/memory/sweepable.cpp create mode 100644 src/cpp/base/memory/sweepable.h create mode 100644 src/cpp/base/memory/unsafe_pointer.cpp create mode 100644 src/cpp/base/memory/unsafe_pointer.h create mode 100644 src/cpp/base/object_data.cpp create mode 100644 src/cpp/base/object_data.h create mode 100644 src/cpp/base/object_offset.cpp create mode 100644 src/cpp/base/object_offset.h create mode 100644 src/cpp/base/preg.cpp create mode 100644 src/cpp/base/preg.h create mode 100644 src/cpp/base/program_functions.cpp create mode 100644 src/cpp/base/program_functions.h create mode 100644 src/cpp/base/resource_data.cpp create mode 100644 src/cpp/base/resource_data.h create mode 100644 src/cpp/base/rtti_info.cpp create mode 100644 src/cpp/base/rtti_info.h create mode 100644 src/cpp/base/runtime_option.cpp create mode 100644 src/cpp/base/runtime_option.h create mode 100644 src/cpp/base/server/access_log.cpp create mode 100644 src/cpp/base/server/access_log.h create mode 100644 src/cpp/base/server/admin_request_handler.cpp create mode 100644 src/cpp/base/server/admin_request_handler.h create mode 100644 src/cpp/base/server/dynamic_content_cache.cpp create mode 100644 src/cpp/base/server/dynamic_content_cache.h create mode 100644 src/cpp/base/server/http_protocol.cpp create mode 100644 src/cpp/base/server/http_protocol.h create mode 100644 src/cpp/base/server/http_request_handler.cpp create mode 100644 src/cpp/base/server/http_request_handler.h create mode 100644 src/cpp/base/server/http_server.cpp create mode 100644 src/cpp/base/server/http_server.h create mode 100644 src/cpp/base/server/ip_block_map.cpp create mode 100644 src/cpp/base/server/ip_block_map.h create mode 100644 src/cpp/base/server/libevent_server.cpp create mode 100644 src/cpp/base/server/libevent_server.h create mode 100644 src/cpp/base/server/libevent_server_with_takeover.cpp create mode 100644 src/cpp/base/server/libevent_server_with_takeover.h create mode 100644 src/cpp/base/server/libevent_transport.cpp create mode 100644 src/cpp/base/server/libevent_transport.h create mode 100644 src/cpp/base/server/pagelet_server.cpp create mode 100644 src/cpp/base/server/pagelet_server.h create mode 100644 src/cpp/base/server/replay_transport.cpp create mode 100644 src/cpp/base/server/replay_transport.h create mode 100644 src/cpp/base/server/request_uri.cpp create mode 100644 src/cpp/base/server/request_uri.h create mode 100644 src/cpp/base/server/rpc_request_handler.cpp create mode 100644 src/cpp/base/server/rpc_request_handler.h create mode 100644 src/cpp/base/server/satellite_server.cpp create mode 100644 src/cpp/base/server/satellite_server.h create mode 100644 src/cpp/base/server/server.cpp create mode 100644 src/cpp/base/server/server.h create mode 100644 src/cpp/base/server/server_note.cpp create mode 100644 src/cpp/base/server/server_note.h create mode 100644 src/cpp/base/server/server_stats.cpp create mode 100644 src/cpp/base/server/server_stats.h create mode 100644 src/cpp/base/server/service_thread.cpp create mode 100644 src/cpp/base/server/service_thread.h create mode 100644 src/cpp/base/server/source_root_info.cpp create mode 100644 src/cpp/base/server/source_root_info.h create mode 100644 src/cpp/base/server/static_content_cache.cpp create mode 100644 src/cpp/base/server/static_content_cache.h create mode 100644 src/cpp/base/server/transport.cpp create mode 100644 src/cpp/base/server/transport.h create mode 100644 src/cpp/base/server/upload.cpp create mode 100644 src/cpp/base/server/upload.h create mode 100644 src/cpp/base/server/virtual_host.cpp create mode 100644 src/cpp/base/server/virtual_host.h create mode 100644 src/cpp/base/server/xbox_server.cpp create mode 100644 src/cpp/base/server/xbox_server.h create mode 100644 src/cpp/base/shared/process_shared_variant.cpp create mode 100644 src/cpp/base/shared/process_shared_variant.h create mode 100644 src/cpp/base/shared/shared_map.cpp create mode 100644 src/cpp/base/shared/shared_map.h create mode 100644 src/cpp/base/shared/shared_store.cpp create mode 100644 src/cpp/base/shared/shared_store.h create mode 100644 src/cpp/base/shared/shared_string.cpp create mode 100644 src/cpp/base/shared/shared_string.h create mode 100644 src/cpp/base/shared/shared_variant.cpp create mode 100644 src/cpp/base/shared/shared_variant.h create mode 100644 src/cpp/base/shared/thread_shared_variant.cpp create mode 100644 src/cpp/base/shared/thread_shared_variant.h create mode 100644 src/cpp/base/source_info.cpp create mode 100644 src/cpp/base/source_info.h create mode 100644 src/cpp/base/string_data.cpp create mode 100644 src/cpp/base/string_data.h create mode 100644 src/cpp/base/string_offset.cpp create mode 100644 src/cpp/base/string_offset.h create mode 100644 src/cpp/base/string_util.cpp create mode 100644 src/cpp/base/string_util.h create mode 100644 src/cpp/base/time/datetime.cpp create mode 100644 src/cpp/base/time/datetime.h create mode 100644 src/cpp/base/time/timestamp.cpp create mode 100644 src/cpp/base/time/timestamp.h create mode 100644 src/cpp/base/time/timezone.cpp create mode 100644 src/cpp/base/time/timezone.h create mode 100644 src/cpp/base/timeout_thread.cpp create mode 100644 src/cpp/base/timeout_thread.h create mode 100644 src/cpp/base/type_array.cpp create mode 100644 src/cpp/base/type_array.h create mode 100644 src/cpp/base/type_object.cpp create mode 100644 src/cpp/base/type_object.h create mode 100644 src/cpp/base/type_string.cpp create mode 100644 src/cpp/base/type_string.h create mode 100644 src/cpp/base/type_variant.cpp create mode 100644 src/cpp/base/type_variant.h create mode 100644 src/cpp/base/types.h create mode 100644 src/cpp/base/util/countable.cpp create mode 100644 src/cpp/base/util/countable.h create mode 100644 src/cpp/base/util/exceptions.cpp create mode 100644 src/cpp/base/util/exceptions.h create mode 100644 src/cpp/base/util/hphp_map.cpp create mode 100644 src/cpp/base/util/hphp_map.h create mode 100644 src/cpp/base/util/hphp_map_cell.h create mode 100644 src/cpp/base/util/hphp_vector.h create mode 100644 src/cpp/base/util/http_client.cpp create mode 100644 src/cpp/base/util/http_client.h create mode 100644 src/cpp/base/util/libevent_http_client.cpp create mode 100644 src/cpp/base/util/libevent_http_client.h create mode 100644 src/cpp/base/util/light_process.cpp create mode 100644 src/cpp/base/util/light_process.h create mode 100644 src/cpp/base/util/request_local.h create mode 100644 src/cpp/base/util/smart_object.h create mode 100644 src/cpp/base/util/smart_ptr.h create mode 100644 src/cpp/base/util/string_buffer.cpp create mode 100644 src/cpp/base/util/string_buffer.h create mode 100644 src/cpp/base/variable_serializer.cpp create mode 100644 src/cpp/base/variable_serializer.h create mode 100644 src/cpp/base/variable_table.cpp create mode 100644 src/cpp/base/variable_table.h create mode 100644 src/cpp/base/variable_unserializer.h create mode 100644 src/cpp/base/zend/intl_convert.cpp create mode 100644 src/cpp/base/zend/intl_convert.h create mode 100644 src/cpp/base/zend/utf8_decode.c create mode 100644 src/cpp/base/zend/utf8_decode.h create mode 100644 src/cpp/base/zend/utf8_to_utf16.c create mode 100644 src/cpp/base/zend/utf8_to_utf16.h create mode 100644 src/cpp/base/zend/zend_collator.cpp create mode 100644 src/cpp/base/zend/zend_collator.h create mode 100644 src/cpp/base/zend/zend_functions.cpp create mode 100644 src/cpp/base/zend/zend_functions.h create mode 100644 src/cpp/base/zend/zend_html.cpp create mode 100644 src/cpp/base/zend/zend_html.h create mode 100644 src/cpp/base/zend/zend_math.h create mode 100644 src/cpp/base/zend/zend_md5.cpp create mode 100644 src/cpp/base/zend/zend_multiply.h create mode 100644 src/cpp/base/zend/zend_pack.cpp create mode 100644 src/cpp/base/zend/zend_pack.h create mode 100644 src/cpp/base/zend/zend_php_config.h create mode 100644 src/cpp/base/zend/zend_printf.cpp create mode 100644 src/cpp/base/zend/zend_printf.h create mode 100644 src/cpp/base/zend/zend_rand.cpp create mode 100644 src/cpp/base/zend/zend_scanf.cpp create mode 100644 src/cpp/base/zend/zend_scanf.h create mode 100644 src/cpp/base/zend/zend_sha1.cpp create mode 100644 src/cpp/base/zend/zend_string.cpp create mode 100644 src/cpp/base/zend/zend_string.h create mode 100644 src/cpp/base/zend/zend_strtod.cpp create mode 100644 src/cpp/base/zend/zend_strtod.h create mode 100644 src/cpp/base/zend/zend_url.cpp create mode 100644 src/cpp/base/zend/zend_url.h create mode 100644 src/cpp/eval/Makefile create mode 100644 src/cpp/eval/analysis/block.cpp create mode 100644 src/cpp/eval/analysis/block.h create mode 100644 src/cpp/eval/ast/array_element_expression.cpp create mode 100644 src/cpp/eval/ast/array_element_expression.h create mode 100644 src/cpp/eval/ast/array_expression.cpp create mode 100644 src/cpp/eval/ast/array_expression.h create mode 100644 src/cpp/eval/ast/assignment_op_expression.cpp create mode 100644 src/cpp/eval/ast/assignment_op_expression.h create mode 100644 src/cpp/eval/ast/assignment_ref_expression.cpp create mode 100644 src/cpp/eval/ast/assignment_ref_expression.h create mode 100644 src/cpp/eval/ast/binary_op_expression.cpp create mode 100644 src/cpp/eval/ast/binary_op_expression.h create mode 100644 src/cpp/eval/ast/break_statement.cpp create mode 100644 src/cpp/eval/ast/break_statement.h create mode 100644 src/cpp/eval/ast/class_constant_expression.cpp create mode 100644 src/cpp/eval/ast/class_constant_expression.h create mode 100644 src/cpp/eval/ast/class_statement.cpp create mode 100644 src/cpp/eval/ast/class_statement.h create mode 100644 src/cpp/eval/ast/constant_expression.cpp create mode 100644 src/cpp/eval/ast/constant_expression.h create mode 100644 src/cpp/eval/ast/construct.cpp create mode 100644 src/cpp/eval/ast/construct.h create mode 100644 src/cpp/eval/ast/do_while_statement.cpp create mode 100644 src/cpp/eval/ast/do_while_statement.h create mode 100644 src/cpp/eval/ast/echo_statement.cpp create mode 100644 src/cpp/eval/ast/echo_statement.h create mode 100644 src/cpp/eval/ast/encaps_list_expression.cpp create mode 100644 src/cpp/eval/ast/encaps_list_expression.h create mode 100644 src/cpp/eval/ast/expr_statement.cpp create mode 100644 src/cpp/eval/ast/expr_statement.h create mode 100644 src/cpp/eval/ast/expression.cpp create mode 100644 src/cpp/eval/ast/expression.h create mode 100644 src/cpp/eval/ast/for_statement.cpp create mode 100644 src/cpp/eval/ast/for_statement.h create mode 100644 src/cpp/eval/ast/foreach_statement.cpp create mode 100644 src/cpp/eval/ast/foreach_statement.h create mode 100644 src/cpp/eval/ast/function_call_expression.cpp create mode 100644 src/cpp/eval/ast/function_call_expression.h create mode 100644 src/cpp/eval/ast/function_statement.cpp create mode 100644 src/cpp/eval/ast/function_statement.h create mode 100644 src/cpp/eval/ast/global_statement.cpp create mode 100644 src/cpp/eval/ast/global_statement.h create mode 100644 src/cpp/eval/ast/if_statement.cpp create mode 100644 src/cpp/eval/ast/if_statement.h create mode 100644 src/cpp/eval/ast/inc_op_expression.cpp create mode 100644 src/cpp/eval/ast/inc_op_expression.h create mode 100644 src/cpp/eval/ast/include_expression.cpp create mode 100644 src/cpp/eval/ast/include_expression.h create mode 100644 src/cpp/eval/ast/instanceof_expression.cpp create mode 100644 src/cpp/eval/ast/instanceof_expression.h create mode 100644 src/cpp/eval/ast/isset_expression.cpp create mode 100644 src/cpp/eval/ast/isset_expression.h create mode 100644 src/cpp/eval/ast/list_assignment_expression.cpp create mode 100644 src/cpp/eval/ast/list_assignment_expression.h create mode 100644 src/cpp/eval/ast/lval_expression.cpp create mode 100644 src/cpp/eval/ast/lval_expression.h create mode 100644 src/cpp/eval/ast/method_statement.cpp create mode 100644 src/cpp/eval/ast/method_statement.h create mode 100644 src/cpp/eval/ast/name.cpp create mode 100644 src/cpp/eval/ast/name.h create mode 100644 src/cpp/eval/ast/new_object_expression.cpp create mode 100644 src/cpp/eval/ast/new_object_expression.h create mode 100644 src/cpp/eval/ast/object_method_expression.cpp create mode 100644 src/cpp/eval/ast/object_method_expression.h create mode 100644 src/cpp/eval/ast/object_property_expression.cpp create mode 100644 src/cpp/eval/ast/object_property_expression.h create mode 100644 src/cpp/eval/ast/qop_expression.cpp create mode 100644 src/cpp/eval/ast/qop_expression.h create mode 100644 src/cpp/eval/ast/ref_param_expression.cpp create mode 100644 src/cpp/eval/ast/ref_param_expression.h create mode 100644 src/cpp/eval/ast/return_statement.cpp create mode 100644 src/cpp/eval/ast/return_statement.h create mode 100644 src/cpp/eval/ast/scalar_expression.cpp create mode 100644 src/cpp/eval/ast/scalar_expression.h create mode 100644 src/cpp/eval/ast/simple_function_call_expression.cpp create mode 100644 src/cpp/eval/ast/simple_function_call_expression.h create mode 100644 src/cpp/eval/ast/statement.h create mode 100644 src/cpp/eval/ast/statement_list_statement.cpp create mode 100644 src/cpp/eval/ast/statement_list_statement.h create mode 100644 src/cpp/eval/ast/static_member_expression.cpp create mode 100644 src/cpp/eval/ast/static_member_expression.h create mode 100644 src/cpp/eval/ast/static_method_expression.cpp create mode 100644 src/cpp/eval/ast/static_method_expression.h create mode 100644 src/cpp/eval/ast/static_statement.cpp create mode 100644 src/cpp/eval/ast/static_statement.h create mode 100644 src/cpp/eval/ast/strong_foreach_statement.cpp create mode 100644 src/cpp/eval/ast/strong_foreach_statement.h create mode 100644 src/cpp/eval/ast/switch_statement.cpp create mode 100644 src/cpp/eval/ast/switch_statement.h create mode 100644 src/cpp/eval/ast/this_expression.cpp create mode 100644 src/cpp/eval/ast/this_expression.h create mode 100644 src/cpp/eval/ast/throw_statement.cpp create mode 100644 src/cpp/eval/ast/throw_statement.h create mode 100644 src/cpp/eval/ast/try_statement.cpp create mode 100644 src/cpp/eval/ast/try_statement.h create mode 100644 src/cpp/eval/ast/unary_op_expression.cpp create mode 100644 src/cpp/eval/ast/unary_op_expression.h create mode 100644 src/cpp/eval/ast/unset_statement.cpp create mode 100644 src/cpp/eval/ast/unset_statement.h create mode 100644 src/cpp/eval/ast/variable_expression.cpp create mode 100644 src/cpp/eval/ast/variable_expression.h create mode 100644 src/cpp/eval/ast/while_statement.cpp create mode 100644 src/cpp/eval/ast/while_statement.h create mode 100644 src/cpp/eval/base/ast_ptr.h create mode 100644 src/cpp/eval/base/eval_base.h create mode 100644 src/cpp/eval/base/function.h create mode 100644 src/cpp/eval/eval.cpp create mode 100644 src/cpp/eval/eval.h create mode 100644 src/cpp/eval/ext/ext.cpp create mode 100644 src/cpp/eval/ext/ext.h create mode 100644 src/cpp/eval/gen.mk create mode 100644 src/cpp/eval/parser/hphp.x create mode 100644 src/cpp/eval/parser/hphp.y create mode 100644 src/cpp/eval/parser/parser.cpp create mode 100644 src/cpp/eval/parser/parser.h create mode 100644 src/cpp/eval/parser/parser_defines.h create mode 100644 src/cpp/eval/parser/scanner.cpp create mode 100644 src/cpp/eval/parser/scanner.h create mode 100644 src/cpp/eval/runtime/arg_stack.cpp create mode 100644 src/cpp/eval/runtime/arg_stack.h create mode 100644 src/cpp/eval/runtime/assoc_list.cpp create mode 100644 src/cpp/eval/runtime/assoc_list.h create mode 100644 src/cpp/eval/runtime/eval_frame_injection.cpp create mode 100644 src/cpp/eval/runtime/eval_frame_injection.h create mode 100644 src/cpp/eval/runtime/eval_object_data.cpp create mode 100644 src/cpp/eval/runtime/eval_object_data.h create mode 100644 src/cpp/eval/runtime/eval_state.cpp create mode 100644 src/cpp/eval/runtime/eval_state.h create mode 100644 src/cpp/eval/runtime/file_repository.cpp create mode 100644 src/cpp/eval/runtime/file_repository.h create mode 100644 src/cpp/eval/runtime/variable_environment.cpp create mode 100644 src/cpp/eval/runtime/variable_environment.h create mode 100644 src/cpp/eval/strict_mode.cpp create mode 100644 src/cpp/eval/strict_mode.h create mode 100644 src/cpp/ext/JSON_parser.cpp create mode 100644 src/cpp/ext/JSON_parser.h create mode 100644 src/cpp/ext/Makefile create mode 100644 src/cpp/ext/README create mode 100644 src/cpp/ext/bcmath/add.c create mode 100644 src/cpp/ext/bcmath/bcmath.h create mode 100644 src/cpp/ext/bcmath/compare.c create mode 100644 src/cpp/ext/bcmath/config.h create mode 100644 src/cpp/ext/bcmath/debug.c create mode 100644 src/cpp/ext/bcmath/div.c create mode 100644 src/cpp/ext/bcmath/divmod.c create mode 100644 src/cpp/ext/bcmath/doaddsub.c create mode 100644 src/cpp/ext/bcmath/init.c create mode 100644 src/cpp/ext/bcmath/int2num.c create mode 100644 src/cpp/ext/bcmath/nearzero.c create mode 100644 src/cpp/ext/bcmath/neg.c create mode 100644 src/cpp/ext/bcmath/num2long.c create mode 100644 src/cpp/ext/bcmath/num2str.c create mode 100644 src/cpp/ext/bcmath/outofmem.c create mode 100644 src/cpp/ext/bcmath/output.c create mode 100644 src/cpp/ext/bcmath/private.h create mode 100644 src/cpp/ext/bcmath/raise.c create mode 100644 src/cpp/ext/bcmath/raisemod.c create mode 100644 src/cpp/ext/bcmath/recmul.c create mode 100644 src/cpp/ext/bcmath/rmzero.c create mode 100644 src/cpp/ext/bcmath/rt.c create mode 100644 src/cpp/ext/bcmath/sqrt.c create mode 100644 src/cpp/ext/bcmath/str2num.c create mode 100644 src/cpp/ext/bcmath/sub.c create mode 100644 src/cpp/ext/bcmath/zero.c create mode 100644 src/cpp/ext/crutch.cpp create mode 100644 src/cpp/ext/crutch.h create mode 100644 src/cpp/ext/ext.h create mode 100644 src/cpp/ext/ext_apache.cpp create mode 100644 src/cpp/ext/ext_apache.h create mode 100644 src/cpp/ext/ext_apc.cpp create mode 100644 src/cpp/ext/ext_apc.h create mode 100644 src/cpp/ext/ext_apd.cpp create mode 100644 src/cpp/ext/ext_apd.h create mode 100644 src/cpp/ext/ext_array.cpp create mode 100644 src/cpp/ext/ext_array.h create mode 100644 src/cpp/ext/ext_bcmath.cpp create mode 100644 src/cpp/ext/ext_bcmath.h create mode 100644 src/cpp/ext/ext_class.cpp create mode 100644 src/cpp/ext/ext_class.h create mode 100644 src/cpp/ext/ext_ctype.cpp create mode 100644 src/cpp/ext/ext_ctype.h create mode 100644 src/cpp/ext/ext_curl.cpp create mode 100644 src/cpp/ext/ext_curl.h create mode 100644 src/cpp/ext/ext_datetime.cpp create mode 100644 src/cpp/ext/ext_datetime.h create mode 100644 src/cpp/ext/ext_domdocument.cpp create mode 100644 src/cpp/ext/ext_domdocument.h create mode 100644 src/cpp/ext/ext_error.cpp create mode 100644 src/cpp/ext/ext_error.h create mode 100644 src/cpp/ext/ext_fbml.cpp create mode 100644 src/cpp/ext/ext_fbml.h create mode 100644 src/cpp/ext/ext_file.cpp create mode 100644 src/cpp/ext/ext_file.h create mode 100644 src/cpp/ext/ext_function.cpp create mode 100644 src/cpp/ext/ext_function.h create mode 100644 src/cpp/ext/ext_hash.cpp create mode 100644 src/cpp/ext/ext_hash.h create mode 100644 src/cpp/ext/ext_hotprofiler.cpp create mode 100644 src/cpp/ext/ext_iconv.cpp create mode 100644 src/cpp/ext/ext_iconv.h create mode 100644 src/cpp/ext/ext_icu.cpp create mode 100644 src/cpp/ext/ext_icu.h create mode 100644 src/cpp/ext/ext_idn.cpp create mode 100644 src/cpp/ext/ext_idn.h create mode 100644 src/cpp/ext/ext_image.cpp create mode 100644 src/cpp/ext/ext_image.h create mode 100644 src/cpp/ext/ext_ipc.cpp create mode 100644 src/cpp/ext/ext_ipc.h create mode 100644 src/cpp/ext/ext_json.cpp create mode 100644 src/cpp/ext/ext_json.h create mode 100644 src/cpp/ext/ext_ldap.cpp create mode 100644 src/cpp/ext/ext_ldap.h create mode 100644 src/cpp/ext/ext_magick.cpp create mode 100644 src/cpp/ext/ext_magick.h create mode 100644 src/cpp/ext/ext_mailparse.cpp create mode 100644 src/cpp/ext/ext_mailparse.h create mode 100644 src/cpp/ext/ext_math.cpp create mode 100644 src/cpp/ext/ext_math.h create mode 100644 src/cpp/ext/ext_mb.cpp create mode 100644 src/cpp/ext/ext_mb.h create mode 100644 src/cpp/ext/ext_mcrypt.cpp create mode 100644 src/cpp/ext/ext_mcrypt.h create mode 100644 src/cpp/ext/ext_misc.cpp create mode 100644 src/cpp/ext/ext_misc.h create mode 100644 src/cpp/ext/ext_mysql.cpp create mode 100644 src/cpp/ext/ext_mysql.h create mode 100644 src/cpp/ext/ext_network.cpp create mode 100644 src/cpp/ext/ext_network.h create mode 100644 src/cpp/ext/ext_openssl.cpp create mode 100644 src/cpp/ext/ext_openssl.h create mode 100644 src/cpp/ext/ext_options.cpp create mode 100644 src/cpp/ext/ext_options.h create mode 100644 src/cpp/ext/ext_oracle.cpp create mode 100644 src/cpp/ext/ext_oracle.h create mode 100644 src/cpp/ext/ext_output.cpp create mode 100644 src/cpp/ext/ext_output.h create mode 100644 src/cpp/ext/ext_posix.cpp create mode 100644 src/cpp/ext/ext_posix.h create mode 100644 src/cpp/ext/ext_preg.cpp create mode 100644 src/cpp/ext/ext_preg.h create mode 100644 src/cpp/ext/ext_process.cpp create mode 100644 src/cpp/ext/ext_process.h create mode 100644 src/cpp/ext/ext_reflection.cpp create mode 100644 src/cpp/ext/ext_reflection.h create mode 100644 src/cpp/ext/ext_server.cpp create mode 100644 src/cpp/ext/ext_server.h create mode 100644 src/cpp/ext/ext_simplexml.cpp create mode 100644 src/cpp/ext/ext_simplexml.h create mode 100644 src/cpp/ext/ext_simplexml_include.h create mode 100644 src/cpp/ext/ext_soap.cpp create mode 100644 src/cpp/ext/ext_soap.h create mode 100644 src/cpp/ext/ext_socket.cpp create mode 100644 src/cpp/ext/ext_socket.h create mode 100644 src/cpp/ext/ext_sqlite3.cpp create mode 100644 src/cpp/ext/ext_sqlite3.h create mode 100644 src/cpp/ext/ext_stream.cpp create mode 100644 src/cpp/ext/ext_stream.h create mode 100644 src/cpp/ext/ext_string.cpp create mode 100644 src/cpp/ext/ext_string.h create mode 100644 src/cpp/ext/ext_thread.cpp create mode 100644 src/cpp/ext/ext_thread.h create mode 100644 src/cpp/ext/ext_thrift.cpp create mode 100644 src/cpp/ext/ext_thrift.h create mode 100644 src/cpp/ext/ext_url.cpp create mode 100644 src/cpp/ext/ext_url.h create mode 100644 src/cpp/ext/ext_variable.cpp create mode 100644 src/cpp/ext/ext_variable.h create mode 100644 src/cpp/ext/ext_xml.cpp create mode 100644 src/cpp/ext/ext_xml.h create mode 100644 src/cpp/ext/ext_xmlwriter.cpp create mode 100644 src/cpp/ext/ext_xmlwriter.h create mode 100644 src/cpp/ext/ext_zlib.cpp create mode 100644 src/cpp/ext/ext_zlib.h create mode 100644 src/cpp/ext/fql/fql.cpp create mode 100644 src/cpp/ext/fql/fql.h create mode 100644 src/cpp/ext/fql/fql_multiparse.cpp create mode 100644 src/cpp/ext/fql/fql_parser.cpp create mode 100644 src/cpp/ext/fql/fqlnode.cpp create mode 100644 src/cpp/ext/fql/fqlnode.h create mode 100644 src/cpp/ext/fql/lexer.cpp create mode 100644 src/cpp/ext/hash/hash_adler32.cpp create mode 100644 src/cpp/ext/hash/hash_adler32.h create mode 100644 src/cpp/ext/hash/hash_crc32.cpp create mode 100644 src/cpp/ext/hash/hash_crc32.h create mode 100644 src/cpp/ext/hash/hash_engine.h create mode 100644 src/cpp/ext/hash/hash_gost.cpp create mode 100644 src/cpp/ext/hash/hash_gost.h create mode 100644 src/cpp/ext/hash/hash_haval.cpp create mode 100644 src/cpp/ext/hash/hash_haval.h create mode 100644 src/cpp/ext/hash/hash_md.cpp create mode 100644 src/cpp/ext/hash/hash_md.h create mode 100644 src/cpp/ext/hash/hash_ripemd.cpp create mode 100644 src/cpp/ext/hash/hash_ripemd.h create mode 100644 src/cpp/ext/hash/hash_salsa.cpp create mode 100644 src/cpp/ext/hash/hash_salsa.h create mode 100644 src/cpp/ext/hash/hash_sha.cpp create mode 100644 src/cpp/ext/hash/hash_sha.h create mode 100644 src/cpp/ext/hash/hash_snefru.cpp create mode 100644 src/cpp/ext/hash/hash_snefru.h create mode 100644 src/cpp/ext/hash/hash_tiger.cpp create mode 100644 src/cpp/ext/hash/hash_tiger.h create mode 100644 src/cpp/ext/hash/hash_whirlpool.cpp create mode 100644 src/cpp/ext/hash/hash_whirlpool.h create mode 100644 src/cpp/ext/hash/php_hash_crc32_tables.h create mode 100644 src/cpp/ext/hash/php_hash_gost_tables.h create mode 100644 src/cpp/ext/hash/php_hash_snefru_tables.h create mode 100644 src/cpp/ext/hash/php_hash_tiger_tables.h create mode 100644 src/cpp/ext/hash/php_hash_whirlpool_tables.h create mode 100644 src/cpp/ext/php_unicode.h create mode 100644 src/cpp/ext/phpmcc/Makefile create mode 100644 src/cpp/ext/phpmcc/ext_php_mcc.h create mode 100644 src/cpp/ext/phpmcc/release/Makefile create mode 100644 src/cpp/ext/phpmcc/release/ext_php_mcc.cpp create mode 100644 src/cpp/ext/phpmcc/release/ext_php_mcc.h create mode 100644 src/cpp/ext/phpmcc/release/ext_php_mcc_impl.h create mode 100644 src/cpp/ext/phpmcc/release/ext_php_mcc_resource.h create mode 100644 src/cpp/ext/profile/extprofile_apache.h create mode 100644 src/cpp/ext/profile/extprofile_apc.h create mode 100644 src/cpp/ext/profile/extprofile_apd.h create mode 100644 src/cpp/ext/profile/extprofile_array.h create mode 100644 src/cpp/ext/profile/extprofile_bcmath.h create mode 100644 src/cpp/ext/profile/extprofile_class.h create mode 100644 src/cpp/ext/profile/extprofile_ctype.h create mode 100644 src/cpp/ext/profile/extprofile_curl.h create mode 100644 src/cpp/ext/profile/extprofile_datetime.h create mode 100644 src/cpp/ext/profile/extprofile_domdocument.h create mode 100644 src/cpp/ext/profile/extprofile_error.h create mode 100644 src/cpp/ext/profile/extprofile_fbml.h create mode 100644 src/cpp/ext/profile/extprofile_file.h create mode 100644 src/cpp/ext/profile/extprofile_function.h create mode 100644 src/cpp/ext/profile/extprofile_hash.h create mode 100644 src/cpp/ext/profile/extprofile_iconv.h create mode 100644 src/cpp/ext/profile/extprofile_icu.h create mode 100644 src/cpp/ext/profile/extprofile_idn.h create mode 100644 src/cpp/ext/profile/extprofile_image.h create mode 100644 src/cpp/ext/profile/extprofile_ipc.h create mode 100644 src/cpp/ext/profile/extprofile_json.h create mode 100644 src/cpp/ext/profile/extprofile_ldap.h create mode 100644 src/cpp/ext/profile/extprofile_magick.h create mode 100644 src/cpp/ext/profile/extprofile_mailparse.h create mode 100644 src/cpp/ext/profile/extprofile_math.h create mode 100644 src/cpp/ext/profile/extprofile_mb.h create mode 100644 src/cpp/ext/profile/extprofile_mcrypt.h create mode 100644 src/cpp/ext/profile/extprofile_misc.h create mode 100644 src/cpp/ext/profile/extprofile_mysql.h create mode 100644 src/cpp/ext/profile/extprofile_network.h create mode 100644 src/cpp/ext/profile/extprofile_openssl.h create mode 100644 src/cpp/ext/profile/extprofile_options.h create mode 100644 src/cpp/ext/profile/extprofile_oracle.h create mode 100644 src/cpp/ext/profile/extprofile_output.h create mode 100644 src/cpp/ext/profile/extprofile_php_mcc.h create mode 100644 src/cpp/ext/profile/extprofile_posix.h create mode 100644 src/cpp/ext/profile/extprofile_preg.h create mode 100644 src/cpp/ext/profile/extprofile_process.h create mode 100644 src/cpp/ext/profile/extprofile_reflection.h create mode 100644 src/cpp/ext/profile/extprofile_server.h create mode 100644 src/cpp/ext/profile/extprofile_simplexml.h create mode 100644 src/cpp/ext/profile/extprofile_soap.h create mode 100644 src/cpp/ext/profile/extprofile_socket.h create mode 100644 src/cpp/ext/profile/extprofile_sqlite3.h create mode 100644 src/cpp/ext/profile/extprofile_stream.h create mode 100644 src/cpp/ext/profile/extprofile_string.h create mode 100644 src/cpp/ext/profile/extprofile_thread.h create mode 100644 src/cpp/ext/profile/extprofile_thrift.h create mode 100644 src/cpp/ext/profile/extprofile_url.h create mode 100644 src/cpp/ext/profile/extprofile_variable.h create mode 100644 src/cpp/ext/profile/extprofile_xml.h create mode 100644 src/cpp/ext/profile/extprofile_xmlwriter.h create mode 100644 src/cpp/ext/profile/extprofile_zlib.h create mode 100644 src/cpp/ext/soap/encoding.cpp create mode 100644 src/cpp/ext/soap/encoding.h create mode 100644 src/cpp/ext/soap/packet.cpp create mode 100644 src/cpp/ext/soap/packet.h create mode 100644 src/cpp/ext/soap/schema.cpp create mode 100644 src/cpp/ext/soap/sdl.cpp create mode 100644 src/cpp/ext/soap/sdl.h create mode 100644 src/cpp/ext/soap/soap.cpp create mode 100644 src/cpp/ext/soap/soap.h create mode 100644 src/cpp/ext/soap/xml.cpp create mode 100644 src/cpp/ext/soap/xml.h create mode 100644 src/cpp/ext/unicode_data.h create mode 100755 src/cpp/makeall.sh create mode 100644 src/cpp/tmp/Makefile create mode 100644 src/cpp/tmp/README create mode 100755 src/cpp/tmp/cleanup.sh create mode 100755 src/crutch.php create mode 100644 src/default.mk create mode 100644 src/droptables.sql create mode 100644 src/ffi/hs/HphpFFI.hs create mode 100644 src/ffi/hs/Utils.hs create mode 100644 src/ffi/java/Makefile create mode 100644 src/ffi/java/hphp/Hphp.java create mode 100644 src/ffi/java/hphp/HphpArray.java create mode 100644 src/ffi/java/hphp/HphpArrayIterator.java create mode 100644 src/ffi/java/hphp/HphpBoolean.java create mode 100644 src/ffi/java/hphp/HphpDouble.java create mode 100644 src/ffi/java/hphp/HphpInt64.java create mode 100644 src/ffi/java/hphp/HphpNull.java create mode 100644 src/ffi/java/hphp/HphpObject.java create mode 100644 src/ffi/java/hphp/HphpSession.java create mode 100644 src/ffi/java/hphp/HphpString.java create mode 100644 src/ffi/java/hphp/HphpVariant.java create mode 100644 src/ffi/java/hphp_ffi_java.cpp create mode 100644 src/ffi/swig/swig.h create mode 100644 src/ffi/swig/swig.i create mode 100644 src/hphp/Makefile create mode 100644 src/hphp/hook.mk create mode 100644 src/hphp/main.cpp create mode 100644 src/hphp/makefile_mono create mode 100644 src/hphpi/Makefile create mode 100644 src/hphpi/hphpi.php create mode 100644 src/hphpi/hphpi_build.hdf create mode 100644 src/idl/Makefile create mode 100644 src/idl/apache.idl.php create mode 100644 src/idl/apc.idl.php create mode 100644 src/idl/apd.idl.php create mode 100644 src/idl/array.idl.php create mode 100644 src/idl/base.php create mode 100644 src/idl/bcmath.idl.php create mode 100644 src/idl/class.idl.php create mode 100644 src/idl/ctype.idl.php create mode 100644 src/idl/curl.idl.php create mode 100644 src/idl/datetime.idl.php create mode 100644 src/idl/domdocument.idl.php create mode 100644 src/idl/error.idl.php create mode 100644 src/idl/fbml.idl.php create mode 100644 src/idl/file.idl.php create mode 100644 src/idl/function.idl.php create mode 100644 src/idl/hash.idl.php create mode 100644 src/idl/iconv.idl.php create mode 100644 src/idl/icu.idl.php create mode 100644 src/idl/idl.php create mode 100644 src/idl/idl_list.php create mode 100644 src/idl/idn.idl.php create mode 100644 src/idl/image.idl.php create mode 100644 src/idl/ipc.idl.php create mode 100644 src/idl/json.idl.php create mode 100644 src/idl/ldap.idl.php create mode 100644 src/idl/magick.idl.php create mode 100644 src/idl/mailparse.idl.php create mode 100644 src/idl/math.idl.php create mode 100644 src/idl/mb.idl.php create mode 100644 src/idl/mcrypt.idl.php create mode 100644 src/idl/misc.idl.php create mode 100644 src/idl/mysql.idl.php create mode 100644 src/idl/network.idl.php create mode 100644 src/idl/openssl.idl.php create mode 100644 src/idl/options.idl.php create mode 100644 src/idl/oracle.idl.php create mode 100644 src/idl/output.idl.php create mode 100644 src/idl/php_mcc.idl.php create mode 100644 src/idl/posix.idl.php create mode 100644 src/idl/preg.idl.php create mode 100644 src/idl/process.idl.php create mode 100644 src/idl/reflection.idl.php create mode 100644 src/idl/server.idl.php create mode 100644 src/idl/simplexml.idl.php create mode 100644 src/idl/soap.idl.php create mode 100644 src/idl/socket.idl.php create mode 100644 src/idl/sqlite3.idl.php create mode 100644 src/idl/stream.idl.php create mode 100644 src/idl/string.idl.php create mode 100644 src/idl/thread.idl.php create mode 100644 src/idl/thrift.idl.php create mode 100644 src/idl/url.idl.php create mode 100644 src/idl/variable.idl.php create mode 100644 src/idl/xml.idl.php create mode 100644 src/idl/xmlwriter.idl.php create mode 100644 src/idl/zlib.idl.php create mode 100644 src/java.mk create mode 100644 src/lib/Makefile create mode 100644 src/lib/analysis/analysis_result.cpp create mode 100644 src/lib/analysis/analysis_result.h create mode 100644 src/lib/analysis/block_scope.cpp create mode 100644 src/lib/analysis/block_scope.h create mode 100644 src/lib/analysis/class_scope.cpp create mode 100644 src/lib/analysis/class_scope.h create mode 100644 src/lib/analysis/code_error.cpp create mode 100644 src/lib/analysis/code_error.h create mode 100644 src/lib/analysis/constant_table.cpp create mode 100644 src/lib/analysis/constant_table.h create mode 100644 src/lib/analysis/core_code_error.inc create mode 100644 src/lib/analysis/core_dependency.inc create mode 100644 src/lib/analysis/dependency_graph.cpp create mode 100644 src/lib/analysis/dependency_graph.h create mode 100644 src/lib/analysis/file_scope.cpp create mode 100644 src/lib/analysis/file_scope.h create mode 100644 src/lib/analysis/function_container.cpp create mode 100644 src/lib/analysis/function_container.h create mode 100644 src/lib/analysis/function_scope.cpp create mode 100644 src/lib/analysis/function_scope.h create mode 100644 src/lib/analysis/symbol_table.cpp create mode 100644 src/lib/analysis/symbol_table.h create mode 100644 src/lib/analysis/type.cpp create mode 100644 src/lib/analysis/type.h create mode 100644 src/lib/analysis/variable_table.cpp create mode 100644 src/lib/analysis/variable_table.h create mode 100644 src/lib/code_generator.cpp create mode 100644 src/lib/code_generator.h create mode 100644 src/lib/construct.cpp create mode 100644 src/lib/construct.h create mode 100644 src/lib/expression/array_element_expression.cpp create mode 100644 src/lib/expression/array_element_expression.h create mode 100644 src/lib/expression/array_pair_expression.cpp create mode 100644 src/lib/expression/array_pair_expression.h create mode 100644 src/lib/expression/assignment_expression.cpp create mode 100644 src/lib/expression/assignment_expression.h create mode 100644 src/lib/expression/binary_op_expression.cpp create mode 100644 src/lib/expression/binary_op_expression.h create mode 100644 src/lib/expression/class_constant_expression.cpp create mode 100644 src/lib/expression/class_constant_expression.h create mode 100644 src/lib/expression/constant_expression.cpp create mode 100644 src/lib/expression/constant_expression.h create mode 100644 src/lib/expression/dynamic_function_call.cpp create mode 100644 src/lib/expression/dynamic_function_call.h create mode 100644 src/lib/expression/dynamic_variable.cpp create mode 100644 src/lib/expression/dynamic_variable.h create mode 100644 src/lib/expression/encaps_list_expression.cpp create mode 100644 src/lib/expression/encaps_list_expression.h create mode 100644 src/lib/expression/expression.cpp create mode 100644 src/lib/expression/expression.h create mode 100644 src/lib/expression/expression_list.cpp create mode 100644 src/lib/expression/expression_list.h create mode 100644 src/lib/expression/function_call.cpp create mode 100644 src/lib/expression/function_call.h create mode 100644 src/lib/expression/include_expression.cpp create mode 100644 src/lib/expression/include_expression.h create mode 100644 src/lib/expression/list_assignment.cpp create mode 100644 src/lib/expression/list_assignment.h create mode 100644 src/lib/expression/modifier_expression.cpp create mode 100644 src/lib/expression/modifier_expression.h create mode 100644 src/lib/expression/new_object_expression.cpp create mode 100644 src/lib/expression/new_object_expression.h create mode 100644 src/lib/expression/object_method_expression.cpp create mode 100644 src/lib/expression/object_method_expression.h create mode 100644 src/lib/expression/object_property_expression.cpp create mode 100644 src/lib/expression/object_property_expression.h create mode 100644 src/lib/expression/parameter_expression.cpp create mode 100644 src/lib/expression/parameter_expression.h create mode 100644 src/lib/expression/qop_expression.cpp create mode 100644 src/lib/expression/qop_expression.h create mode 100644 src/lib/expression/scalar_expression.cpp create mode 100644 src/lib/expression/scalar_expression.h create mode 100644 src/lib/expression/simple_function_call.cpp create mode 100644 src/lib/expression/simple_function_call.h create mode 100644 src/lib/expression/simple_variable.cpp create mode 100644 src/lib/expression/simple_variable.h create mode 100644 src/lib/expression/static_member_expression.cpp create mode 100644 src/lib/expression/static_member_expression.h create mode 100644 src/lib/expression/unary_op_expression.cpp create mode 100644 src/lib/expression/unary_op_expression.h create mode 100644 src/lib/hook.mk create mode 100644 src/lib/hphp.h create mode 100644 src/lib/hphp_unique.h create mode 100644 src/lib/option.cpp create mode 100644 src/lib/option.h create mode 100644 src/lib/package.cpp create mode 100644 src/lib/package.h create mode 100644 src/lib/parser/hphp.x create mode 100644 src/lib/parser/hphp.y create mode 100644 src/lib/parser/parser.cpp create mode 100644 src/lib/parser/parser.h create mode 100644 src/lib/parser/scanner.cpp create mode 100644 src/lib/parser/scanner.h create mode 100644 src/lib/statement/block_statement.cpp create mode 100644 src/lib/statement/block_statement.h create mode 100644 src/lib/statement/break_statement.cpp create mode 100644 src/lib/statement/break_statement.h create mode 100644 src/lib/statement/case_statement.cpp create mode 100644 src/lib/statement/case_statement.h create mode 100644 src/lib/statement/catch_statement.cpp create mode 100644 src/lib/statement/catch_statement.h create mode 100644 src/lib/statement/class_constant.cpp create mode 100644 src/lib/statement/class_constant.h create mode 100644 src/lib/statement/class_statement.cpp create mode 100644 src/lib/statement/class_statement.h create mode 100644 src/lib/statement/class_variable.cpp create mode 100644 src/lib/statement/class_variable.h create mode 100644 src/lib/statement/continue_statement.cpp create mode 100644 src/lib/statement/continue_statement.h create mode 100644 src/lib/statement/do_statement.cpp create mode 100644 src/lib/statement/do_statement.h create mode 100644 src/lib/statement/echo_statement.cpp create mode 100644 src/lib/statement/echo_statement.h create mode 100644 src/lib/statement/exp_statement.cpp create mode 100644 src/lib/statement/exp_statement.h create mode 100644 src/lib/statement/for_statement.cpp create mode 100644 src/lib/statement/for_statement.h create mode 100644 src/lib/statement/foreach_statement.cpp create mode 100644 src/lib/statement/foreach_statement.h create mode 100644 src/lib/statement/function_statement.cpp create mode 100644 src/lib/statement/function_statement.h create mode 100644 src/lib/statement/global_statement.cpp create mode 100644 src/lib/statement/global_statement.h create mode 100644 src/lib/statement/if_branch_statement.cpp create mode 100644 src/lib/statement/if_branch_statement.h create mode 100644 src/lib/statement/if_statement.cpp create mode 100644 src/lib/statement/if_statement.h create mode 100644 src/lib/statement/interface_statement.cpp create mode 100644 src/lib/statement/interface_statement.h create mode 100644 src/lib/statement/method_statement.cpp create mode 100644 src/lib/statement/method_statement.h create mode 100644 src/lib/statement/return_statement.cpp create mode 100644 src/lib/statement/return_statement.h create mode 100644 src/lib/statement/scope_statement.cpp create mode 100644 src/lib/statement/scope_statement.h create mode 100644 src/lib/statement/statement.cpp create mode 100644 src/lib/statement/statement.h create mode 100644 src/lib/statement/statement_list.cpp create mode 100644 src/lib/statement/statement_list.h create mode 100644 src/lib/statement/static_statement.cpp create mode 100644 src/lib/statement/static_statement.h create mode 100644 src/lib/statement/switch_statement.cpp create mode 100644 src/lib/statement/switch_statement.h create mode 100644 src/lib/statement/throw_statement.cpp create mode 100644 src/lib/statement/throw_statement.h create mode 100644 src/lib/statement/try_statement.cpp create mode 100644 src/lib/statement/try_statement.h create mode 100644 src/lib/statement/unset_statement.cpp create mode 100644 src/lib/statement/unset_statement.h create mode 100644 src/lib/statement/while_statement.cpp create mode 100644 src/lib/statement/while_statement.h create mode 100644 src/lib/system/Makefile create mode 100644 src/lib/system/apache.inc create mode 100644 src/lib/system/apc.inc create mode 100644 src/lib/system/apd.inc create mode 100644 src/lib/system/array.inc create mode 100644 src/lib/system/bcmath.inc create mode 100644 src/lib/system/builtin_symbols.cpp create mode 100644 src/lib/system/builtin_symbols.h create mode 100644 src/lib/system/class.inc create mode 100644 src/lib/system/classes/arrayaccess.php create mode 100644 src/lib/system/classes/exception.php create mode 100644 src/lib/system/classes/iterator.php create mode 100644 src/lib/system/classes/pear_error.php create mode 100644 src/lib/system/classes/reflection.php create mode 100644 src/lib/system/classes/stdclass.php create mode 100644 src/lib/system/ctype.inc create mode 100644 src/lib/system/curl.inc create mode 100644 src/lib/system/datetime.inc create mode 100644 src/lib/system/domdocument.inc create mode 100644 src/lib/system/error.inc create mode 100644 src/lib/system/ext.inc create mode 100644 src/lib/system/fbml.inc create mode 100644 src/lib/system/file.inc create mode 100644 src/lib/system/function.inc create mode 100644 src/lib/system/gen/Makefile create mode 100644 src/lib/system/gen/cls/__php_incomplete_class.h create mode 100644 src/lib/system/gen/cls/arrayaccess.h create mode 100644 src/lib/system/gen/cls/arrayiterator.h create mode 100644 src/lib/system/gen/cls/badfunctioncallexception.h create mode 100644 src/lib/system/gen/cls/badmethodcallexception.h create mode 100644 src/lib/system/gen/cls/countable.h create mode 100644 src/lib/system/gen/cls/domainexception.h create mode 100644 src/lib/system/gen/cls/exception.h create mode 100644 src/lib/system/gen/cls/filteriterator.h create mode 100644 src/lib/system/gen/cls/invalidargumentexception.h create mode 100644 src/lib/system/gen/cls/iterator.h create mode 100644 src/lib/system/gen/cls/iteratoraggregate.h create mode 100644 src/lib/system/gen/cls/lengthexception.h create mode 100644 src/lib/system/gen/cls/logicexception.h create mode 100644 src/lib/system/gen/cls/outeriterator.h create mode 100644 src/lib/system/gen/cls/outofboundsexception.h create mode 100644 src/lib/system/gen/cls/outofrangeexception.h create mode 100644 src/lib/system/gen/cls/overflowexception.h create mode 100644 src/lib/system/gen/cls/pear_error.h create mode 100644 src/lib/system/gen/cls/rangeexception.h create mode 100644 src/lib/system/gen/cls/reflectionclass.h create mode 100644 src/lib/system/gen/cls/reflectionexception.h create mode 100644 src/lib/system/gen/cls/reflectionextension.h create mode 100644 src/lib/system/gen/cls/reflectionfunction.h create mode 100644 src/lib/system/gen/cls/reflectionfunctionabstract.h create mode 100644 src/lib/system/gen/cls/reflectionmethod.h create mode 100644 src/lib/system/gen/cls/reflectionobject.h create mode 100644 src/lib/system/gen/cls/reflectionparameter.h create mode 100644 src/lib/system/gen/cls/reflectionproperty.h create mode 100644 src/lib/system/gen/cls/reflector.h create mode 100644 src/lib/system/gen/cls/runtimeexception.h create mode 100644 src/lib/system/gen/cls/seekableiterator.h create mode 100644 src/lib/system/gen/cls/serializable.h create mode 100644 src/lib/system/gen/cls/stdclass.h create mode 100644 src/lib/system/gen/cls/traversable.h create mode 100644 src/lib/system/gen/cls/underflowexception.h create mode 100644 src/lib/system/gen/cls/unexpectedvalueexception.h create mode 100644 src/lib/system/gen/php/classes/arrayaccess.cpp create mode 100644 src/lib/system/gen/php/classes/arrayaccess.fw.h create mode 100644 src/lib/system/gen/php/classes/arrayaccess.h create mode 100644 src/lib/system/gen/php/classes/exception.cpp create mode 100644 src/lib/system/gen/php/classes/exception.fw.h create mode 100644 src/lib/system/gen/php/classes/exception.h create mode 100644 src/lib/system/gen/php/classes/iterator.cpp create mode 100644 src/lib/system/gen/php/classes/iterator.fw.h create mode 100644 src/lib/system/gen/php/classes/iterator.h create mode 100644 src/lib/system/gen/php/classes/pear_error.cpp create mode 100644 src/lib/system/gen/php/classes/pear_error.fw.h create mode 100644 src/lib/system/gen/php/classes/pear_error.h create mode 100644 src/lib/system/gen/php/classes/reflection.cpp create mode 100644 src/lib/system/gen/php/classes/reflection.fw.h create mode 100644 src/lib/system/gen/php/classes/reflection.h create mode 100644 src/lib/system/gen/php/classes/stdclass.cpp create mode 100644 src/lib/system/gen/php/classes/stdclass.fw.h create mode 100644 src/lib/system/gen/php/classes/stdclass.h create mode 100644 src/lib/system/gen/php/globals/constants.cpp create mode 100644 src/lib/system/gen/php/globals/constants.fw.h create mode 100644 src/lib/system/gen/php/globals/constants.h create mode 100644 src/lib/system/gen/php/globals/symbols.cpp create mode 100644 src/lib/system/gen/php/globals/symbols.fw.h create mode 100644 src/lib/system/gen/php/globals/symbols.h create mode 100644 src/lib/system/gen/sys/dynamic_table_class.no.cpp create mode 100644 src/lib/system/gen/sys/dynamic_table_constant.no.cpp create mode 100644 src/lib/system/gen/sys/dynamic_table_file.no.cpp create mode 100644 src/lib/system/gen/sys/dynamic_table_func.no.cpp create mode 100644 src/lib/system/gen/sys/scalar_arrays_0.no.cpp create mode 100644 src/lib/system/gen/sys/system_globals.cpp create mode 100644 src/lib/system/gen/sys/system_globals.h create mode 100644 src/lib/system/globals/constants.php create mode 100644 src/lib/system/globals/gen_constants create mode 100644 src/lib/system/globals/symbols.php create mode 100644 src/lib/system/hash.inc create mode 100644 src/lib/system/helper.inc create mode 100644 src/lib/system/iconv.inc create mode 100644 src/lib/system/icu.inc create mode 100644 src/lib/system/idn.inc create mode 100644 src/lib/system/image.inc create mode 100644 src/lib/system/ipc.inc create mode 100644 src/lib/system/json.inc create mode 100644 src/lib/system/ldap.inc create mode 100644 src/lib/system/magick.inc create mode 100644 src/lib/system/mailparse.inc create mode 100644 src/lib/system/math.inc create mode 100644 src/lib/system/mb.inc create mode 100644 src/lib/system/mcrypt.inc create mode 100644 src/lib/system/misc.inc create mode 100644 src/lib/system/mysql.inc create mode 100644 src/lib/system/network.inc create mode 100644 src/lib/system/openssl.inc create mode 100644 src/lib/system/options.inc create mode 100644 src/lib/system/oracle.inc create mode 100644 src/lib/system/output.inc create mode 100644 src/lib/system/php_mcc.inc create mode 100644 src/lib/system/posix.inc create mode 100644 src/lib/system/preg.inc create mode 100644 src/lib/system/process.inc create mode 100644 src/lib/system/reflection.inc create mode 100644 src/lib/system/server.inc create mode 100644 src/lib/system/simplexml.inc create mode 100644 src/lib/system/soap.inc create mode 100644 src/lib/system/socket.inc create mode 100644 src/lib/system/sqlite3.inc create mode 100644 src/lib/system/stream.inc create mode 100644 src/lib/system/string.inc create mode 100644 src/lib/system/thread.inc create mode 100644 src/lib/system/thrift.inc create mode 100644 src/lib/system/url.inc create mode 100644 src/lib/system/variable.inc create mode 100644 src/lib/system/xml.inc create mode 100644 src/lib/system/xmlwriter.inc create mode 100644 src/lib/system/zlib.inc create mode 100644 src/lib/util/jump_table.cpp create mode 100644 src/lib/util/jump_table.h create mode 100644 src/license.php create mode 100644 src/python.mk create mode 100644 src/rules.mk create mode 100644 src/schema.sql create mode 100644 src/test/Makefile create mode 100644 src/test/config-server.hdf create mode 100644 src/test/config.hdf create mode 100644 src/test/dummy_mysql_info.inc create mode 100644 src/test/hook.mk create mode 100644 src/test/images/246x247.png create mode 100644 src/test/images/php.gif create mode 100644 src/test/images/simpletext.jpg create mode 100644 src/test/images/smile.happy.png create mode 100644 src/test/images/test1pix.jpg create mode 100644 src/test/main.cpp create mode 100644 src/test/perf_ad_hoc.php create mode 100755 src/test/tahoma.ttf create mode 100644 src/test/test.cpp create mode 100644 src/test/test.h create mode 100644 src/test/test.wsdl create mode 100644 src/test/test_base.cpp create mode 100644 src/test/test_base.h create mode 100644 src/test/test_base_fast.inc create mode 100644 src/test/test_base_suite.inc create mode 100644 src/test/test_code_error.cpp create mode 100644 src/test/test_code_error.h create mode 100644 src/test/test_code_run.cpp create mode 100644 src/test/test_code_run.h create mode 100644 src/test/test_cpp_base.cpp create mode 100644 src/test/test_cpp_base.h create mode 100644 src/test/test_cpp_ext.cpp create mode 100644 src/test/test_cpp_ext.h create mode 100644 src/test/test_depend_graph.cpp create mode 100644 src/test/test_depend_graph.h create mode 100644 src/test/test_ext.h create mode 100644 src/test/test_ext.inc create mode 100644 src/test/test_ext_apache.cpp create mode 100644 src/test/test_ext_apache.h create mode 100644 src/test/test_ext_apc.cpp create mode 100644 src/test/test_ext_apc.h create mode 100644 src/test/test_ext_apd.cpp create mode 100644 src/test/test_ext_apd.h create mode 100644 src/test/test_ext_array.cpp create mode 100644 src/test/test_ext_array.h create mode 100644 src/test/test_ext_bcmath.cpp create mode 100644 src/test/test_ext_bcmath.h create mode 100644 src/test/test_ext_class.cpp create mode 100644 src/test/test_ext_class.h create mode 100644 src/test/test_ext_ctype.cpp create mode 100644 src/test/test_ext_ctype.h create mode 100644 src/test/test_ext_curl.cpp create mode 100644 src/test/test_ext_curl.h create mode 100644 src/test/test_ext_datetime.cpp create mode 100644 src/test/test_ext_datetime.h create mode 100644 src/test/test_ext_domdocument.cpp create mode 100644 src/test/test_ext_domdocument.h create mode 100644 src/test/test_ext_error.cpp create mode 100644 src/test/test_ext_error.h create mode 100644 src/test/test_ext_fbml.cpp create mode 100644 src/test/test_ext_fbml.h create mode 100644 src/test/test_ext_file.cpp create mode 100644 src/test/test_ext_file.h create mode 100755 src/test/test_ext_file.txt create mode 100644 src/test/test_ext_function.cpp create mode 100644 src/test/test_ext_function.h create mode 100644 src/test/test_ext_hash.cpp create mode 100644 src/test/test_ext_hash.h create mode 100644 src/test/test_ext_iconv.cpp create mode 100644 src/test/test_ext_iconv.h create mode 100644 src/test/test_ext_icu.cpp create mode 100644 src/test/test_ext_icu.h create mode 100644 src/test/test_ext_idn.cpp create mode 100644 src/test/test_ext_idn.h create mode 100644 src/test/test_ext_image.cpp create mode 100644 src/test/test_ext_image.h create mode 100644 src/test/test_ext_ipc.cpp create mode 100644 src/test/test_ext_ipc.h create mode 100644 src/test/test_ext_json.cpp create mode 100644 src/test/test_ext_json.h create mode 100644 src/test/test_ext_ldap.cpp create mode 100644 src/test/test_ext_ldap.h create mode 100644 src/test/test_ext_magick.cpp create mode 100644 src/test/test_ext_magick.h create mode 100644 src/test/test_ext_mailparse.cpp create mode 100644 src/test/test_ext_mailparse.h create mode 100644 src/test/test_ext_math.cpp create mode 100644 src/test/test_ext_math.h create mode 100644 src/test/test_ext_mb.cpp create mode 100644 src/test/test_ext_mb.h create mode 100644 src/test/test_ext_mcrypt.cpp create mode 100644 src/test/test_ext_mcrypt.h create mode 100644 src/test/test_ext_misc.cpp create mode 100644 src/test/test_ext_misc.h create mode 100644 src/test/test_ext_mysql.cpp create mode 100644 src/test/test_ext_mysql.h create mode 100644 src/test/test_ext_network.cpp create mode 100644 src/test/test_ext_network.h create mode 100644 src/test/test_ext_openssl.cpp create mode 100644 src/test/test_ext_openssl.h create mode 100644 src/test/test_ext_options.cpp create mode 100644 src/test/test_ext_options.h create mode 100644 src/test/test_ext_oracle.cpp create mode 100644 src/test/test_ext_oracle.h create mode 100644 src/test/test_ext_output.cpp create mode 100644 src/test/test_ext_output.h create mode 100644 src/test/test_ext_php_mcc.cpp create mode 100644 src/test/test_ext_php_mcc.h create mode 100644 src/test/test_ext_posix.cpp create mode 100644 src/test/test_ext_posix.h create mode 100644 src/test/test_ext_preg.cpp create mode 100644 src/test/test_ext_preg.h create mode 100644 src/test/test_ext_process.cpp create mode 100644 src/test/test_ext_process.h create mode 100644 src/test/test_ext_reflection.cpp create mode 100644 src/test/test_ext_reflection.h create mode 100644 src/test/test_ext_server.cpp create mode 100644 src/test/test_ext_server.h create mode 100644 src/test/test_ext_simplexml.cpp create mode 100644 src/test/test_ext_simplexml.h create mode 100644 src/test/test_ext_soap.cpp create mode 100644 src/test/test_ext_soap.h create mode 100644 src/test/test_ext_socket.cpp create mode 100644 src/test/test_ext_socket.h create mode 100644 src/test/test_ext_sqlite3.cpp create mode 100644 src/test/test_ext_sqlite3.h create mode 100644 src/test/test_ext_stream.cpp create mode 100644 src/test/test_ext_stream.h create mode 100644 src/test/test_ext_string.cpp create mode 100644 src/test/test_ext_string.h create mode 100644 src/test/test_ext_thread.cpp create mode 100644 src/test/test_ext_thread.h create mode 100644 src/test/test_ext_thrift.cpp create mode 100644 src/test/test_ext_thrift.h create mode 100644 src/test/test_ext_url.cpp create mode 100644 src/test/test_ext_url.h create mode 100644 src/test/test_ext_variable.cpp create mode 100644 src/test/test_ext_variable.h create mode 100644 src/test/test_ext_xml.cpp create mode 100644 src/test/test_ext_xml.h create mode 100644 src/test/test_ext_xmlwriter.cpp create mode 100644 src/test/test_ext_xmlwriter.h create mode 100644 src/test/test_ext_zlib.cpp create mode 100755 src/test/test_ext_zlib.gz create mode 100644 src/test/test_ext_zlib.h create mode 100644 src/test/test_get_meta_tags.html create mode 100644 src/test/test_hash_file.txt create mode 100644 src/test/test_parser.cpp create mode 100644 src/test/test_parser.h create mode 100644 src/test/test_parser_expr.cpp create mode 100644 src/test/test_parser_expr.h create mode 100644 src/test/test_parser_stmt.cpp create mode 100644 src/test/test_parser_stmt.h create mode 100755 src/test/test_pcntl_exec.sh create mode 100644 src/test/test_performance.cpp create mode 100644 src/test/test_performance.h create mode 100644 src/test/test_private.pem create mode 100644 src/test/test_public.pem create mode 100644 src/test/test_server.cpp create mode 100644 src/test/test_server.h create mode 100644 src/test/test_trans_expr.cpp create mode 100644 src/test/test_trans_expr.h create mode 100644 src/test/test_trans_stmt.cpp create mode 100644 src/test/test_trans_stmt.h create mode 100644 src/test/test_transformer.cpp create mode 100644 src/test/test_transformer.h create mode 100644 src/test/test_type_inference.cpp create mode 100644 src/test/test_type_inference.h create mode 100644 src/test/test_util.cpp create mode 100644 src/test/test_util.h create mode 100644 src/test/test_x509.crt create mode 100644 src/test/test_zlib_file create mode 100644 src/util/Makefile create mode 100644 src/util/async_func.h create mode 100644 src/util/async_job.cpp create mode 100644 src/util/async_job.h create mode 100644 src/util/atomic.cpp create mode 100644 src/util/atomic.h create mode 100644 src/util/base.h create mode 100644 src/util/capability.cpp create mode 100644 src/util/capability.h create mode 100644 src/util/case_insensitive.h create mode 100644 src/util/compression.cpp create mode 100644 src/util/compression.h create mode 100644 src/util/config.h create mode 100644 src/util/dataset.cpp create mode 100644 src/util/dataset.h create mode 100644 src/util/db_conn.cpp create mode 100644 src/util/db_conn.h create mode 100644 src/util/db_dataset.cpp create mode 100644 src/util/db_dataset.h create mode 100644 src/util/db_filter.cpp create mode 100644 src/util/db_filter.h create mode 100644 src/util/db_query.cpp create mode 100644 src/util/db_query.h create mode 100644 src/util/exception.cpp create mode 100644 src/util/exception.h create mode 100644 src/util/file_cache.cpp create mode 100644 src/util/file_cache.h create mode 100644 src/util/hash.h create mode 100644 src/util/hdf.cpp create mode 100644 src/util/hdf.h create mode 100644 src/util/jemalloc/jemalloc.c create mode 100644 src/util/jemalloc/jemalloc.h create mode 100644 src/util/jemalloc/jemalloc_defs.h create mode 100644 src/util/jemalloc/rb.h create mode 100644 src/util/jemalloc/version create mode 100644 src/util/job_queue.h create mode 100644 src/util/json.cpp create mode 100644 src/util/json.h create mode 100644 src/util/lfu_table.h create mode 100644 src/util/lock.cpp create mode 100644 src/util/lock.h create mode 100644 src/util/log_aggregator.cpp create mode 100644 src/util/log_aggregator.h create mode 100644 src/util/logger.cpp create mode 100644 src/util/logger.h create mode 100644 src/util/mcproxy/client.cpp create mode 100644 src/util/mcproxy/cluster.cpp create mode 100644 src/util/mcproxy/cluster.h create mode 100644 src/util/mcproxy/crc32.h create mode 100644 src/util/mcproxy/gfuncs.cpp create mode 100644 src/util/mcproxy/gfuncs.h create mode 100644 src/util/mcproxy/include.h create mode 100644 src/util/mcproxy/loadconfig.cpp create mode 100644 src/util/mcproxy/loadconfig.h create mode 100644 src/util/mcproxy/main.cpp create mode 100644 src/util/mcproxy/mctypes.h create mode 100644 src/util/mcproxy/prefix.cpp create mode 100644 src/util/mcproxy/prefix.h create mode 100644 src/util/mcproxy/prefix_int.h create mode 100644 src/util/mcproxy/proxy.h create mode 100644 src/util/mcproxy/qio.cpp create mode 100644 src/util/mcproxy/qio.h create mode 100644 src/util/mcproxy/qlio.cpp create mode 100644 src/util/mcproxy/qlio.h create mode 100644 src/util/mcproxy/request.cpp create mode 100644 src/util/mcproxy/request.h create mode 100644 src/util/mcproxy/request_int.h create mode 100644 src/util/mcproxy/request_list.cpp create mode 100644 src/util/mcproxy/server.cpp create mode 100644 src/util/mcproxy/server.h create mode 100644 src/util/mcproxy/server_async.cpp create mode 100644 src/util/mcproxy/server_int.h create mode 100644 src/util/mcproxy/socket.cpp create mode 100644 src/util/mcproxy/stats.cpp create mode 100644 src/util/mcproxy/stats.h create mode 100644 src/util/mcproxy/tinystdio.cpp create mode 100644 src/util/mcproxy/tinystdio.h create mode 100644 src/util/mutex.cpp create mode 100644 src/util/mutex.h create mode 100644 src/util/neo/cs_config.h create mode 100644 src/util/neo/neo_err.c create mode 100644 src/util/neo/neo_err.h create mode 100644 src/util/neo/neo_files.c create mode 100644 src/util/neo/neo_files.h create mode 100644 src/util/neo/neo_hash.c create mode 100644 src/util/neo/neo_hash.h create mode 100644 src/util/neo/neo_hdf.c create mode 100644 src/util/neo/neo_hdf.h create mode 100644 src/util/neo/neo_misc.c create mode 100644 src/util/neo/neo_misc.h create mode 100644 src/util/neo/neo_rand.c create mode 100644 src/util/neo/neo_rand.h create mode 100644 src/util/neo/neo_str.c create mode 100644 src/util/neo/neo_str.h create mode 100644 src/util/neo/ulist.c create mode 100644 src/util/neo/ulist.h create mode 100644 src/util/neo/ulocks.c create mode 100644 src/util/neo/ulocks.h create mode 100644 src/util/neo/wildmat.c create mode 100644 src/util/neo/wildmat.h create mode 100644 src/util/network.cpp create mode 100644 src/util/network.h create mode 100644 src/util/pool.h create mode 100644 src/util/preprocess.cpp create mode 100644 src/util/preprocess.h create mode 100644 src/util/process.cpp create mode 100644 src/util/process.h create mode 100644 src/util/shared_memory_allocator.cpp create mode 100644 src/util/shared_memory_allocator.h create mode 100644 src/util/stack_trace.cpp create mode 100644 src/util/stack_trace.h create mode 100644 src/util/string_bag.cpp create mode 100644 src/util/string_bag.h create mode 100644 src/util/synchronizable.cpp create mode 100644 src/util/synchronizable.h create mode 100644 src/util/thread_local.h create mode 100644 src/util/timer.cpp create mode 100644 src/util/timer.h create mode 100644 src/util/util.cpp create mode 100644 src/util/util.h create mode 100644 src/util/ylmm/basic_buffer.hh create mode 100644 src/util/ylmm/basic_location.hh create mode 100644 src/util/ylmm/basic_messenger.hh create mode 100644 src/util/ylmm/basic_parser.hh create mode 100644 src/util/ylmm/basic_scanner.hh create mode 100644 src/util/ylmm/lexmm.hh create mode 100644 src/util/ylmm/yaccmm.hh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000..f6a46458413b3 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ + +fast_tests: + $(MAKE) -C src + cd src && test/test "" "" QuickTests + cd src && test/test "" "" TestExt + cd src && test/test TestCodeRunEval + +slow_tests: + $(MAKE) -C src + cd src && NO_DISTCC=1 time test/test TestCodeRun + cd src && NO_DISTCC=1 time test/test TestServer + +clobber: + $(MAKE) -C src clobber + $(MAKE) -C facebook clobber + +clean: clobber diff --git a/bin/hdf.el b/bin/hdf.el new file mode 100644 index 0000000000000..b077655bcc22b --- /dev/null +++ b/bin/hdf.el @@ -0,0 +1,88 @@ + +;; Better HDF read/write experience in emacs (9/25/09 hzhao@facebook.com) + +(require 'font-lock) + +(defvar hdf-mode-hook nil) +(add-to-list 'auto-mode-alist '("\\.hdf\\'" . hdf-mode)) + +(defvar hdf-indent-level 2 + "Defines 2 spaces for HDF indentation.") + +;; syntax coloring +;; http://www.gnu.org/software/emacs/elisp/html_node/Faces-for-Font-Lock.html +(defconst hdf-font-lock-keywords + (list + '("^[ \t]*\\([\\#\\-]include\\)[ \t]+\\(.*\\)" + (1 font-lock-keyword-face) + (2 font-lock-string-face)) ;; include + '("^[ \t]*#.*$" . font-lock-comment-face) ;; comments + '("^[ \t]*\\([a-z0-9_\\.\\*]+\\)[ \t]*\\(!=\\)[ \t]*\\(.*\\)" + (1 font-lock-variable-name-face) + (2 font-lock-function-name-face)) ;; shell commands + '("^[ \t]*\\([a-z0-9_\\.\\*]+\\)[ \t]*\\(:=\\)[ \t]*\\([a-z0-9\\.]+\\)[ \t]*$" + (1 font-lock-variable-name-face) + (2 font-lock-function-name-face) + (3 font-lock-variable-name-face)) ;; node copying + '("^[ \t]*\\([a-z0-9_\\.\\*]+\\)[ \t]*=[ \t]*\\(true\\|false\\|yes\\|no\\|on\\|off\\)[ \t]*$" + (1 font-lock-variable-name-face) + (2 font-lock-keyword-face)) ;; booleans + '("^[ \t]*\\([a-z0-9_\\.\\*]+\\)[ \t]*=[ \t]*\\([0-9]+\\)[ \t]*$" + (1 font-lock-variable-name-face) + (2 font-lock-constant-face)) ;; numbers + '("^[ \t]*\\([a-z0-9_\\.\\*]+\\)[ \t]*=[ \t]*\\(.*\\)" + (1 font-lock-variable-name-face)) ;; strings + '("^[ \t]*\\([a-z0-9_\\.\\*]+\\)[ \t]*[{=][ \t]*$" + (1 font-lock-variable-name-face)) ;; nodes + '("^[ \t]*\\([a-z0-9_\\.\\*]+\\)[ \t]*\\(:\\)[ \t]*\\([a-z0-9\\.]+\\)[ \t]*$" + (1 font-lock-variable-name-face) + (2 font-lock-function-name-face) + (3 font-lock-variable-name-face)) ;; node aliases + '("^[ \t]*\\(@\\)\\([a-z0-9_\\.]+\\)[ \t]*$" + (1 font-lock-function-name-face) + (2 font-lock-variable-name-face)) ;; node inheritance + ) + "Hdf Keywords") + +;; indentation +(defun hdf-indent-line () + "Indent current line as HDF code." + (interactive) + (beginning-of-line) + (if (bobp) + (indent-line-to 0) + (progn + (if (looking-at "^[ \t]*}") + (save-excursion + (forward-line -1) + (while (and (not (bobp)) (looking-at "^[ \t]*$")) + (forward-line -1)) + (if (looking-at "^[ \t]*\\([a-z0-9_\\.\\*]+\\)[ \t]*{") + (setq cur-indent (current-indentation)) + (progn + (setq cur-indent (- (current-indentation) hdf-indent-level)) + (if (< cur-indent 0) + (indent-line-to 0))))) + (save-excursion + (forward-line -1) + (while (and (not (bobp)) (looking-at "^[ \t]*$")) + (forward-line -1)) + (if (looking-at "^[ \t]*\\([a-z0-9_\\.\\*]+\\)[ \t]*{") + (setq cur-indent (+ (current-indentation) hdf-indent-level)) + (setq cur-indent (current-indentation))))) + (if cur-indent + (indent-line-to cur-indent) + (indent-line-to 0))))) + +(defun hdf-mode () + "Mode for editing HDF files" + (interactive) + (kill-all-local-variables) + (set (make-local-variable 'font-lock-defaults) + '(hdf-font-lock-keywords nil, 1)) + (setq major-mode 'hdf-mode) + (setq mode-name "HDF") + (run-hooks 'hdf-mode-hook) + (set (make-local-variable 'indent-line-function) 'hdf-indent-line) + ) +(provide 'hdf-mode) diff --git a/bin/run.mk b/bin/run.mk new file mode 100644 index 0000000000000..4a39523f25e48 --- /dev/null +++ b/bin/run.mk @@ -0,0 +1,32 @@ + +PROJECT_ROOT = $(HPHP_HOME) + +ifndef PROJECT_NAME +PROJECT_NAME = program +endif + +# We want files to be sorted by size, so that larger files are dispatched by +# distcc earlier +CXX_NOOPT_SOURCES = $(shell echo `find . -name "*.no.cpp"`) +RECURSIVE_SOURCES = $(shell echo `find . -name "*.cpp"`) +SIZE_SORTED_SOURCES = $(wildcard ./sys/*.cpp) \ + $(shell echo `if [ -e cpp/ ]; then ls -S ./cpp/*.cpp; fi`) +CXX_SOURCES = $(filter-out $(CXX_NOOPT_SOURCES), $(SIZE_SORTED_SOURCES) \ + $(filter-out $(SIZE_SORTED_SOURCES), $(RECURSIVE_SOURCES))) + +CPPFLAGS += -I. +LIBS = $(HPHP_LIB)/libhphp_runtime.a $(ALL_LIBS) + +include $(HPHP_HOME)/src/rules.mk + +ifdef HPHP_BUILD_LIBRARY +TARGETS = $(STATIC_LIB) $(SHARED_LIB) +else +TARGETS = $(APP_TARGET) +endif + +all: $(TARGETS) + +ifdef HPHP_BUILD_FFI +EXTERNAL += $(HPHP_LIB)/libhphp_java.so +endif diff --git a/bin/run.sh b/bin/run.sh new file mode 100755 index 0000000000000..19f5112d07291 --- /dev/null +++ b/bin/run.sh @@ -0,0 +1,10 @@ +#!/bin/sh +#$1: output directory +#$2: program name +#$3: extra flags, for exmaple, RELEASE=1 +if [ ${#SHOW_COMPILE} -gt 0 ] ; then + echo cp $HPHP_HOME/bin/run.mk $1/Makefile + echo make -j $3 PROJECT_NAME=$2 TIME_LINK=1 -C $1 +fi +cp $HPHP_HOME/bin/run.mk $1/Makefile +make -j $3 PROJECT_NAME=$2 TIME_LINK=1 -C $1 diff --git a/bin/time_build.php b/bin/time_build.php new file mode 100644 index 0000000000000..755d97b2d5a93 --- /dev/null +++ b/bin/time_build.php @@ -0,0 +1,28 @@ + $time) { + print format_time($time)." compiling $file\n"; +} +print format_time($linktime)." linking\n"; + +function format_time($time) { + return (int)($time / 60) . "'" . + (($time % 60) > 9 ? '':'0'). ($time % 60) . '"'; +} diff --git a/bin/valgrind.suppression b/bin/valgrind.suppression new file mode 100644 index 0000000000000..bbc9ea82f7bf4 --- /dev/null +++ b/bin/valgrind.suppression @@ -0,0 +1,160 @@ +{ + Socket-1 + Memcheck:Param + write(buf) + fun:__write_nocancel + fun:_IO_file_write@@GLIBC_2.2.5 + fun:_IO_do_write@@GLIBC_2.2.5 + fun:_IO_file_close_it@@GLIBC_2.2.5 + fun:fclose@@GLIBC_2.2.5 + fun:RAND_write_file + fun:_ZN14SSLInitializerC1Ev + fun:_Z41__static_initialization_and_destruction_0ii +} +{ + Socket-2 + Memcheck:Param + socketcall.sendto(msg) + fun:__sendto_nocancel + fun:__check_pf + fun:getaddrinfo +} +{ + pthread-1 + Memcheck:Leak + fun:calloc + fun:_dl_allocate_tls + fun:pthread_create@@GLIBC_2.2.5 +} +{ + backtrace-1 + Memcheck:Param + msync(start) + obj:/lib64/libpthread-2.3.5.so + fun:access_mem +} + +{ + FBML-2 + Memcheck:Leak + fun:* + fun:* + fun:_ZN10nsHTMLTags11AddRefTableEv +} +{ + FBML-3 + Memcheck:Leak + fun:* + fun:* + fun:* + fun:_ZN10nsHTMLTags11AddRefTableEv +} +{ + FBML-4 + Memcheck:Leak + fun:* + fun:* + fun:* + fun:* + fun:_ZN10nsHTMLTags11AddRefTableEv +} +{ + FBML-5 + Memcheck:Leak + fun:* + fun:* + fun:* + fun:* + fun:* + fun:_ZN10nsHTMLTags11AddRefTableEv +} +{ + FBML-6 + Memcheck:Leak + fun:* + fun:* + fun:* + fun:* + fun:* + fun:* + fun:_ZN10nsHTMLTags11AddRefTableEv +} +{ + FBML-7 + Memcheck:Leak + fun:* + fun:* + fun:* + fun:* + fun:* + fun:* + fun:* + fun:_ZN10nsHTMLTags11AddRefTableEv +} +{ + FBML-8 + Memcheck:Leak + fun:malloc + fun:PL_NewHashTable + fun:_ZN11nsHTMLAttrs11AddRefTableEv +} +{ + hdf-1 + Memcheck:Leak + fun:calloc + fun:uListInit + fun:nerr_init + fun:hdf_init +} +{ + hdf-2 + Memcheck:Leak + fun:realloc + fun:check_resize + fun:uListAppend + fun:nerr_register + fun:nerr_init + fun:hdf_init +} +{ + SharedMemroyInit-1 + Memcheck:Leak + fun:_Znwm + fun:_ZN4HPHP19SharedMemoryManager4InitEib +} +{ + inet_ntoa-1 + Memcheck:Leak + fun:malloc + fun:inet_ntoa +} + +{ + pthread-2 + Memcheck:Leak + fun:* + fun:* + fun:pthread_once +} +{ + boost-1 + Memcheck:Leak + fun:* + fun:* + fun:* + obj:* + fun:* + obj:/usr/local/lib/libboost_program_options-gcc40-mt-1_35.so.1.35.0 +} +{ + mcrypt-1 + Memcheck:Overlap + fun:memcpy + fun:mcrypt_dlsym +} +{ + zlib-1 + Memcheck:Cond + fun:deflate_slow + fun:deflate +} diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000000000..55c667775a940 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,14 @@ + +help: + @echo "'make daemon' to start up doc server daemon" + @echo "'make server' to start up doc server" + @echo "'make clobber' to clean up directory" + +daemon: + sudo ../src/hphpi/hphpi -m daemon + +server: + sudo ../src/hphpi/hphpi -m server + +clobber: + @rm -f *~ diff --git a/doc/command.compiled b/doc/command.compiled new file mode 100644 index 0000000000000..78322df8cc376 --- /dev/null +++ b/doc/command.compiled @@ -0,0 +1,56 @@ +

Compiled Program's Command Line Options

+ += --help + +Displays the list of command line options with short descriptions. + += -m, --mode + +Specifies one of these execution modes, + +run: (default) directly executes the program from command line. +server: starts an HTTP server from command line. +daemon: starts an HTTP server and runs it as a daemon. +replay: replays a previously recorded HTTP request file. +translate: translates a hex-encoded stacktrace. + += -c, --config=FILE + +This reads in a configuration file to set options. FILE should be in HDF +format. + += -v, --config-value=STRING + +This sets a configuration option on the command line. STRING should be +a line of HDF, e.g. Section.Name=Value. The options settable are the same +as those set by --config. + += -p, --port + +Which port to start HTTP server on. + += --admin-port + +Which port to start admin server that can take URL commands to perform +adminstration, status queries, stats queries or debugging commands. + += -f, --file + +When mode is run, specifies which PHP to execute. + += --count + +How many times to repeat execution of a PHP file. + += --no-safe-access-check + +Whether to allow any file or directory access without security checking. + += --extra-header + +Extra texts to add to front of each line of logging. + += --build-id + +Specifies a version number or an arbitrary string that admin server's build-id +can return. Used for version tracking. diff --git a/doc/command.compiler b/doc/command.compiler new file mode 100644 index 0000000000000..5d62b4ce33699 --- /dev/null +++ b/doc/command.compiler @@ -0,0 +1,223 @@ +

Compiler Command Line Options

+ += --help + +Displays the list of command line options with short descriptions. + += -t, --target=TARGET + +This sets the mode of operation for hphp. TARGET is one of lint, +analyze, php, cpp, filecache, and run +(default). + +lint: only parses the input files. +analyze: runs the analysis phases of hphp but does not generate output files. +php: runs analysis on the input files and generates php source files as output. +cpp: runs analysis on the input files, generates c++ source files as output and optionally builds the program. See format options for cpp. +run: is the same as cpp but also builds and executes the program. +filecache: only builds the static file cache. + += -f, --format=FORMAT + +The possible values of FORMAT depends on the chosen target. + +If the target is lint or analyze, the format option is unused. + +If the target is php, FORMAT is a comma separated list of the following: + +pickled: This outputs php code in a canonicalized format and stripped of comments. +trimmed: This is the same as pickled, but also does not output functions that are never used. +inlined: The same as pickled but generates a single file where all includes are inlined. +typeinfo: The same as pickled, but also runs type inference on the php code and outputs the inferred types in comments. + +If the target is cpp, FORMAT is one of the following: + +cluster: (default) The generated C++ code is divided up among a fixed number of files. The number is set by the cluster-count option. +file: There is one C++ source file generated for each input PHP file. The paths to generated C++ files mirror the paths to the PHP files. +sys: This is used to generate the C++ used for the system library. +exe: This is the same as cluster but also compiles the generated C++ into an executable. +lib: The same as cluster but compiles the generated C++ into a libraray. + +If the target is run, FORMAT can be either cluster or file. These behave +the same as the corresponding formats for cpp. However, with run the generated +sources are always compiled into executables and run. + += --cluster-count=COUNT + +COUNT is an integer and determines the number of output C++ files to generate +when using the cluster format for cpp or run targets. + += --input-dir=PATH + +PATH is the path to the root directory of the PHP sources. + += --program=NAME + +When using the exe format or run target, NAME will be the name of the compiled +executable. + += --args=ARGUMENTS + +When using the run target, the executable will be run with arguments ARGUMENTS. + += -i, --inputs=FILE + +FILE is added to the list of input PHP files. + += --input-list=FILE + +FILE is the path to a file with a list of PHP sources to add to the input +list. The format is one path per line. + += --module=DIR + +DIR is a path to a directory. All PHP sources in that directory, including +subdirectories, are added to the input list. + += --exclude-dir=DIR + +DIR is the path to a directory. All PHP sources in that directory, including +subdirectories, are excluded from the input list with the exception of +forced inputs. + += --fmodule=DIR + +--fmodule is the same as --module, except it will override any --exclude-dir +commands that would affect inclusion of the PHP files. + += --ffile=FILE + +FILE is included, overriding exclusion commands. + += --exclude-file=FILE + +FILE is excluded from the input list, except where overridden by --ffile. + += --cfile=FILE + +FILE is included in the file cache. It is not affected by exclusion commands. + += --cmodule=DIR + +All static resources in DIR, including subdirectories, are added to the file +cache. It is not affected by exclusion commands. + += --parse-on-demand=BOOL (default: true) + +If BOOL is true, then include statements in PHP sources will add files to +the input list as they are encountered when the filename is statically +knowable. + += --branch=STRING + +This specifies the SVN branch for logging purposes. + += --revision=NUMBER + +This specifies the SVN revision for logging purposes. + += -o, --output-dir=DIR + +The compiler will place the generated sources in DIR. If this parameter is +not specified, the compiler will use a new directory in /tmp. + += --sync-dir=DIR + +If this parameter is set, the compiler will first output to DIR, and then +only copy over files that have changed to the output directory. This is to +preserve their timestamps so that a make will not recompile unchanged files. + += --optimize-level=INT (default: 1) + +This sets the severity of optimizations performed on the PHP code before +being translated into C++. Currently, there are two levels of optimization. +0 performs no optimizations, and 1 performs some optimizations. + += --gen-stats=BOOL (default: false) + +If BOOL is true, then detected errors in the code and code statistics will +be output to CodeError.js and Stats.js respectively in the output directory. + += --keep-tempdir=BOOL (default: false) + +If no output directory is specified, the compiler will place generated sources +into a directory in /tmp. If BOOL is true, then this directory will not be +deleted after the program is compiled and, optionally, run. + += --static-method-autofix=BOOL (default: true) + +If a method is found to be called statically but not declared static and BOOL +is true, then it will be treated as a static method. + += --db-stats=STRING + +If this parameter is given, and --gen-stats also set, the dependency graph +and code errors will be stored in the database specified by STRING. +The format is :@:/. + += --no-type-inference=BOOL (default: false) + +If BOOL is true, then no type inference will be performed before outputting +the translated sources. + += --no-min-include=BOOL (default: false) + +If BOOL is true, then minimum include analysis will not be performed for an +analyze target. + += --no-meta-info=BOOL (default: false) + +If BOOL is true, then generated C++ code will not include a class map, jump +tables, or use macros. This is intended to produce readable but non-functional +code. + += --config=FILE + +This reads in a configuration file to set options. FILE should be in HDF +format. + += --db-config=STRING + +This reads configuration from a database. STRING is of the format +:@:/. + += --config-dir=DIR (default: --input-dir) + +This sets the root directory for configuration purposes to be DIR. All +relative paths passed as options will be treated as relative from this +directory. + += -v, --config-value=STRING + +This sets a configuration option on the command line. STRING should be +a line of HDF, e.g. Section.Name=Value. The options settable are the same +as those set by --config or --db-config. + += --log=INT (default: -1) + +This sets the level of logging output to standard out. The Levels are: +-1: If the target is run, then none, else the same as 3. +0: No logging +1: Only errors +2: The same as 1 plus warnings. +3: The same as 2 plus extra information. +4: All log messages. + += --force=BOOL (default: false) + +Forces the compiler to generate output even if there are code errors +encountered. + += --filecache=FILE + +If this argument is given, a static file cache will be created with path FILE. + += --rtti-directory=DIR (default: "") + += --java-root=STRING (default: php) + +The root package of the generated Java FFI classes is set to STRING. + += --generate-ffi=BOOL (default: false) + +If BOOL is true, then ffi stubs will be included in the generated code. diff --git a/doc/debug.gdb b/doc/debug.gdb new file mode 100644 index 0000000000000..e51e335fc7d7e --- /dev/null +++ b/doc/debug.gdb @@ -0,0 +1,8 @@ + +

Useful gdb Commands

+ + info threads + thread apply [threadno] [all] args + set follow-fork-mode child + set detach-on-fork off + handle SIGPIPE nostop noprint pass diff --git a/doc/extension.development b/doc/extension.development new file mode 100644 index 0000000000000..e01ef0f974960 --- /dev/null +++ b/doc/extension.development @@ -0,0 +1,76 @@ + +

How to add new extension functions/classes

+ +All commands and directories are from src/ in this guide. + +1. Find the right extension name + +Find the best "extension" under idl/*.idl.php to add your function(s) to. +cpp/ext/README has a good list of categorized extension names. If nothing +fits, create a new IDL file with a good name. + +2. Update IDL + +Add function/class prototypes to the IDL file. Follow existing ones for +formats. Most of them are straightforward. Possible types are listed in +idl/base.php. + +3. Auto-generate files from IDL + +If it is a new IDL file, run + + make -C idl [new extension name].install + +For example, + + make -C idl my_extension.install + +This will add several files to different places. + +Otherwise, run + + make -C idl [existing extension name].update + +For example, + + make -C idl string.update + +This will modify several files with the new function/classes. + +4. Manual editing + +Some files are not automatically updated, including + + cpp/ext/ext_.h + cpp/ext/ext_.cpp + +They are created under idl/ to serve as templates that one can copy portions +of them manually. These are the two files that you will add implementation to. + +5. Unit tests + +The "make .update" does the following for test files: + creates test/test_ext_.h -- entry points for this unit test, don't modify + updates test/test_ext.inc -- to invoke the test, don't modify + creates idl/test_ext_.cpp -- A template to be modified. + +You will have to add new unit tests to + + test/test_ext_.cpp + +into both the list of RUN_TEST() at top portion of the file and a real +unit test function like this, + + void TestExt::test_ext_ () { ... } + +6. How to modify existing extension functions/classes + +Modify the IDL file. Then run + + make -C idl .update + +Follow all steps after step 3 at above. + +7. After compiling once, do this to update compiler with the latest functions: + + make -C lib/system diff --git a/doc/extension.new_functions b/doc/extension.new_functions new file mode 100644 index 0000000000000..3a303de71a98d --- /dev/null +++ b/doc/extension.new_functions @@ -0,0 +1,86 @@ + +

New Extension Functions

+ +- hphp_log +- hphp_stats +- hphp_get_stats +- hphp_output_global_state + +- clock_getres +- clock_gettime +- clock_settime + +- mysql_connect + + added connect_timeout_ms and query_timeout_ms + +- mysql_pconnect + + added connect_timeout_ms and query_timeout_ms + +- mysql_set_timeout + +- dangling_server_proxy_old_request +- dangling_server_proxy_new_request +- pagelet_server_task_start +- pagelet_server_task_status +- pagelet_server_task_result +- xbox_send_message +- xbox_post_message +- xbox_task_start +- xbox_task_status +- xbox_task_result + +- evhttp_set_cache +- evhttp_get +- evhttp_post +- evhttp_async_get +- evhttp_async_post +- evhttp_recv + +- fb_call_user_func_array_safe($function, $args = array()) + + Like call_user_func_array(), but checks that the function exists before + calling it. `$function' may be any PHP callable: the name of a function, + an array with an object and a method, or an array with the name of a class + and a static method. If whatever you pass in can actually be called without + dependency problems, it will be called and this function will return true + as the first part of its result. + + list($called, $return) = fb_call_user_func_array_safe('example', $args); + if ($called) { + // ... + } + + @param callable Name of a function to invoke, or an array with an object + and method, or an array with the name of an object and + the name of a static method. + @param array Vector of arguments to the function. + @return array A list, with a boolean indicating whether or not the + function was called, and the return value of the + function. + +- fb_call_user_func_safe($function /*, $arg, ... */) + + Like call_user_func(), but checks that the function exists. See + fb_call_user_func_array_safe() for more details. + + @param callable Name of a function to invoke, or an array with an object + and method, or an array with the name of an object and + the name of a static method. + @param ... Arguments to the function. + @return array A list, with a boolean indicating whether or not the + function was called, and the return value of the + function. + +- fb_call_user_func_safe_return($function, $default /*, $arg, ... */); + + Same as above but directly returning $default when $function is not + callable. + + WARNING: You have to make sure that $default return will be okay to get + mixed up with a null or false or other returns from that function. If a + clear distinction needs to be made, please use this form instead: + + list($called, $ret) = fb_call_user_func_safe(...); + if (!$called) ... diff --git a/doc/ffi.c++ b/doc/ffi.c++ new file mode 100644 index 0000000000000..af464c3bb6808 --- /dev/null +++ b/doc/ffi.c++ @@ -0,0 +1,89 @@ + +

How to Use HPHP Compiled Libraries in C++

+ +There are several functions that have to be called correctly to make sure +HPHP compiled binaries work in a C++ environment: + +1. Without Memory Manager + +(1) hphp_process_init() and hphp_process_exit() + +The 1st function initializes all static variables a PHP library contains. This +function is only needed to be called just ONCE before calling any other HPHP +functions. Please call this function from process level (the "main thread") +before starting any threads. + +Call hphp_process_exit() as the last HPHP function call when program exits. + +(2) hphp_session_init() and hphp_session_exit() + +If a PHP library does not have cycles in object references, one can call +hphp_session_init() at the beginning of a "session" and then call +hphp_session_exit() at the end of the session to free up all memory. + +Both functions have to be called on per-thread basis. + +2. With Memory Manager + +If memory leak is detected, it may mean the PHP library has objects or arrays +forming cycles when referring to each other. This is problematic to reference +counting based memory deallocation, but it can be solved by using +MemoryManager that can sweep dangling memory periodically. + +To enable MemorManager, this has to be set at program startup time, and it +cannot be turned off afterwards: + + HPHP::RuntimeOption::EnableMemoryManager = true; + MemoryManager::TheMemoryManager()->enable(); + +(1) hphp_process_init() + +(same as above) + +(2) Taking a checkpoint + +The memory manager is powerful enough to take a snapshot of the memory at any +time by doing + + hphp_session_init(); // required, same as above + // optionally update more global states + MemoryManager::TheMemoryManager()->checkpoint(); + +We only recommend to take checkpoint just once on per-thread basis, because +we have not tested what will happen when multiple checkpoint() is called. + +(3) Rollback periodically + +Call this once per end of "session": + + hphp_session_exit(); + +Please make sure there is no stack variables that are still alive when calling +rollback(). Otherwise, rollback() will release the memory to the pool, causing +that stack variable's destructor to work on collected memory. + + +3. Thread Local Memory Management + +Almost all variables are thread-local. If you want to share those variables +between threads, you will run into trouble. Instead, copy them into your own +object classes to do so. Alternatively, use apc_fetch() and +apc_store(). + + +4. Execution Context + +Execution context controls where PHP's stdout goes to, whether to execute +shutdown or postsend functions, etc.. It is optional to use it, but it's highly +recommended to avoid calling functions that are not "pure". + +(1) At beginning of a session, set up execution context like this, + + ExecutionContext *context = hphp_context_init(); + +(2) At end of a session, tear down execution context like this, + + hphp_context_exit(context, true); + +For the 2nd parameter, if true, post-send processing (PSP) will be performed, +if false, all PSP functions will be ignored. diff --git a/doc/ffi.java b/doc/ffi.java new file mode 100644 index 0000000000000..726b376a2f349 --- /dev/null +++ b/doc/ffi.java @@ -0,0 +1,147 @@ + +

How to Use HPHP Compiled Libraries in Java

+ +1. Representation of HPHP Data + +Each PHP value is wrapped in a Java object. Since PHP does not have a strong +type system, HPHP FFI uses variant as the basic type, which is essentially the +union of all possible types. Whenever a PHP value is exported through FFI to +Java, it is first converted to a variant, and the Java object that represents +the PHP value will store the pointer to that variant, and also automatically +takes care of decreasing the ref count in the PHP world. + +The basic classes of the Java FFI are located in hphp/src/ffi/java, and +contained in package "hphp". + +Hphp is a utility class containing several static methods for initializing +and finalizing the HPHP environment, etc. + +HphpSession is the container of an Hphp session, with an interface similar to +java.lang.Thread. In fact, it is a subclass of Thread, but Hphp session +multi-threading is not supported yet. + +HphpVariant is the base class of all the PHP values in the Java world. It has +several subclasses, describing each specific type of PHP values: + +- HphpNull +- HphpBoolean +- HphpInt64 +- HphpDouble +- HphpString +- HphpArray +- HphpObject + +Their meanings are self-explanatory. There is also an HphpArrayIterator +that provides Java-like iteration through a PHP array. + +For a particular PHP library that Java FFI is enabled, the HPHP compiler +also generates a Java stub class for each PHP class, as a subclass of +HphpObject. These generated classes are located in a package specified at +compile time with --java-root, and the default is com.facebook.php. + + +2. Using HPHP Java FFI + +The job that you want to submit to Hphp should be enclosed in an object that +extends Runnable. An HphpSession object is created, taking the Runnable object +as the constructor parameter. You can then start the Hphp session by calling +the start() method of the HphpSession object. Note that the start() method in +HphpSession is currently blocking, which means that it will return when the +job finishes. + +In the run() method of the Runnable object, one may call functions and methods +provided by library generated by HPHP. + +There are two ways of calling into PHP: + +(1) Dynamic invocation + +This is similar to using call_user_func_array in PHP. PHP functions are called +by their names provided as a String, and the parameters are provided as an +HphpArray. An HphpVariant is returned. + +To call a PHP toplevel function f + + Hphp.invoke("f", args); // args is of type HphpArray + +To call a PHP static method m in class C + + Hphp.invoke("C", "m", args); + +To call a PHP instance method m + + obj.invoke("m", args); // obj is of type HphpObject + +(2) Static invocation + +Static invocation is similar to normal Java method calls, so that the Java +compiler can checks the signature (but remember, all the parameters and +return types are HphpVariant anyway), and performs better than dynamic +invocation. Static invocation does NOT provide access to PHP built-in +functions. Moreover, non-public methods cannot be called statically. + +All the PHP toplevel functions are collected as static methods in class +HphpMain, which is in the package com.facebook.php, or any package specified +with --java-root. + +Static and instance methods of a PHP class are called through the corresponding +wrapper class in Java. For example, we have the following PHP class + + class A { + public function __construct($a, $b) { ... } // php constructor + public static function m() { ... } // static method + public function n() { ... } // instance method + } + +The following sequence of operations in Java will create an object of class A, +and call its methods + + A a = new A(1, 2); + A.m(); // static method call + a.n(); // instance method call + +Finally, after all the PHP operations are done, remember to call Hphp.finish() +to release resources used by the HPHP session. + + +3. Object Identification + +When a PHP method returns, the result has static type HphpVariant, and +dynamically one of HphpNull, HphpBoolean, HphpInt64, HphpDouble, HphpString, +HphpArray, and HphpObject. However, for performance reason, HPHP Java FFI +does NOT automatically find the exact class type for an HphpObject. Therefore, +an HphpObject, which is not directly created with a static constructor call in +the Java code, cannot be used directly as the receiver for a static invocation. +For example, the following code is NOT going to work: + + // calling PHP function f that you know it creates an object of A + HphpObject v = (HphpObject)HphpMain.f(); + ((A)v).n(); // cast fails, even if v indeed contains a PHP object of A + +The correct way is + + ((A)HphpMain.identify(v)).n(); // this succeeds + +Class types are not automatically identified, because it has to use both PHP +reflection and Java reflection, and therefore expensive, and moreover, not +every returned object will be used as the receiver of a static call. + + +4. Dynamic Libraries + +HPHP Java FFI uses JNI as the underlying mechanism, which can only load +dynamic libraries (.so files). Compiling the PHP library with command-line +parameters --format=lib-ffi and --target=cpp will generate a +dynamic library that contains the information of all the required dependencies. +The Java client program needs to load the library with System.loadLibrary(...), +and all these dynamic libraries that it depends on need to be at places that +are searchable by the linker. + + +5. Session Lifetime + +The life of an Hphp session starts when its start() method is called, and +finishes when the method returns. Beyond the session lifetime, all the +Hphp objects (HphpVariant, HphpInt64, HphpArray, etc.) created in the +session are no longer meaningful, because their underlying Hphp objects +have been destroyed. diff --git a/doc/ffi.python b/doc/ffi.python new file mode 100644 index 0000000000000..97ac439083092 --- /dev/null +++ b/doc/ffi.python @@ -0,0 +1,154 @@ + +

How to Use HPHP Compiled Libraries in Python

+ +1. Building a library for Python + +When an HPHP project is compiled with --format=lib-ffi, a SWIG .i file is +generated to wrap all the top-level PHP functions, located in directory +output/ffi. In output, run "make" with hphp/src/python.mk, +then a python wrapper and a corresponding shared library will be created in +directory output/ffi/python. + +For example, if your HPHP project is named phplib, after the above steps, +you will get a Python wrapper phplib.py and a shared library _phplib.so, both +in output/ffi/python. To use it in python, just do + + import phplib + +Then you can start using functions implemented in HPHP. + + +2. Using HPHP functions in Python + +(1) hphpStart() + +This function initializes the HPHP environment, including all static variables. +It only needs to be called ONCE before calling any HPHP functions. For example, + + phplib.hphpStart(); + +(2) hphpStartSession() and hphpFinishSession() + +The first function starts an HPHP session, within which HPHP functions are +called, and HPHP objects live. It also returns a session handle (a pointer to +the underlying HphpSession object) that becomes the first parameter of every +HPHP function call. It also initializes global HPHP variables. + +The second function takes the session handle as its parameter, and finishes +the session by destrying all the references to HPHP objects that have been +created in the session. Therefore, after hphpFinishSession(), they Python +program should NOT try to use any values generated by the HPHP library. + +Continue with the phplib example: + + s = phplib.hphpStartSession(); + # calling HPHP functions + phplib.hphpFinishSession(s); + +Each HPHP object created inside an HPHP session s will live until the time +hphpFinishSession(s) is called. Therefore, a session should not create too +many HPHP objects. After all, a session is not meant to run for a long time. +A Python program, after calling hphpStart(), may create an arbitrary number of +HPHP sessions, but two HPHP sessions must NOT overlap, at least not in the +same thread. + +(3) Calling HPHP functions + +The HPHP session needs to keep track of every HPHP object created during the +session in order to properly destroy them in the end. Therefore, every HPHP +function wrapped in Python takes an extra parameter for the session handle. +For example, if there is an HPHP function f() implemented in phplib, in Python, +it is called as (s is the session handle): + + phplib.f(s); + +(4) Passing values between HPHP and Python + +Each HPHP value is represented as a Variant pointer, which is essentially +opaque in Python. The HPHP value contained in a Variant could be one of the +following 7 types: null, boolean, int (64-bit), double, string, array, or +object. The library defines constants to represent each type: TypeNull, +TypeBoolean, TypeInt, TypeDouble, TypeString, TypeArray, TypeObject. For +example, to test whether an HPHP value v is an integer or not, one can use: + + if phplib.hphpGetType(v) == phplib.TypeInt: + ... + +There are also several helper functions that can be used to create HPHP values, +or to retrieve primitive values from an HPHP Variant. For example: + + b = phplib.hphpBoolean(s, True); # b now contains an HPHP boolean + + str = phplib.hphpString(s, "hello"); # creates a string in HPHP + print phplib.hphpGetString(s, str); # retrieves the string back to Python + + a = phplib.hphpArray(s); # a contains an empty HPHP array + phplib.hphpSet(s, a, b, str); # array (true => "hello") + str2 = phplib.hphpGet(s, a, b); # str2 contains HPHP string "hello" + +There is also an hphpAppend function to add a value to the end of an HPHP +array, phplib.hphpAppend(s, a, b) in Python is the same as a[] = b in PHP. + +Each Python value needs to be wrapped before being passed to HPHP, and each +value returned by HPHP needs to be unwrapped before Python can access the +value. Please see hphp/src/ffi/swig/swig.i for the definitions of all +the helper functions. + +(5) Invoking funtions or files dynamically + +There are also helper functions for dynamically invoking a top-level HPHP +function or including a PHP file (which must be part of the compiled library +as well). + + phplib.hphpInvoke(s, "f", arr); # invokes the HPHP function f, + # HPHP array arr contains the + # arguments + phplib.hphpIncludeFile(s, "lib/users.php"); # includes a compiled PHP file + +Moreover, all the built-in functions of PHP are also available through dynamic +invocation. + +(6) Iteration through an HPHP array + +One can iterate through an HPHP array (a set of key-value pairs) with built-in +helper functions: hphpIterBegin(), hphpIterAdvance(), and hphpIterValid(). +For example, + + iter = phplib.hphpIterBegin(s, arr); # iter is an opaque pointer + # to the underlying array + # iterator + while phplib.hphpIterValid(s, iter): + key = phplib.hphpIterGetKey(s, arr, iter); # gets the key + value = phplib.hphpIterGetValue(s, arr, iter); # gets the value + # neither of the two getter + # functions moves the + # iterator + ... + iter = phplib.hphpIterAdvance(s, arr, iter); # advances the iterator + +There are also some other helper functions that help manipulate arrays. +For example, + + a = phplib.hphpArray(s); + ... + len = phplib.hphpCount(s, a); # gets the size of the array + key = ... + b = phplib.hphpIsset(s, a, key); # checks whether a[key] is set, returns + # a boolean value in Python (not an HPHP + # variant) + + phplib.hphpUnset(s, a, key); # unsets a[key] + +(7) Accessing object variables + +Object variables are accessed through helper functions hphpSetField(), +hphpGetField(), hphpIssetField(), and hphpUnsetField(). They are generally +similar to their array counterparts. However, fields are named with Python +strings, but array keys are HPHP variants. For example, + + a = phplib.hphpNewObject(s, "A", args); # creates an object of type A + v = phplib.hphpGetField(s, a, "f"); # gets a->f + v2 = ... + phplib.hphpSetField(s, a, "f", v2); # a->f = v2 + phplib.hphpIssetField(s, a, "f"); # should return TRUE now + phplib.hphpUnsetField(s, a, "f"); # unsets the field f diff --git a/doc/hdf b/doc/hdf new file mode 100644 index 0000000000000..66a4dcf00fb1f --- /dev/null +++ b/doc/hdf @@ -0,0 +1,134 @@ + +

Hierarchical Data Format (HDF)

+ +Please use bin/hdf.el for syntax coloring that can help identify syntax errors. + +1. Basic format + + [node] = [value] + +Where, [node] can be an alphanumeric name, and [value] can be + +- booleans: true, false, on, off, yes, no, 1, 0 +- numbers +- strings: without any quoting + +2. Hierarchies + + [node] { + [subnode1] = [value] + [subnode2] = [value] + } + + [node] { + [subnode] = [value] + [subnode] { + [subsubnode1] = [value] + [subsubnode2] = [value] + } + } + +3. Dotted node names + + [node] { + [subnode] = [value1] + [subnode] { + [subsubnode] = [value2] + } + } + +is the same as, + + [node].[subnode] = [value1] + [node].[subnode].[subsubnode] = [value2] + +These dotted node names and paths can appear anywhere a node can be at. + +4. Arrays + +Use '*' for automatically generated node names that you don't care + + [node] { + * = [value1] + * = [value2] + } + +This is fine, too, except it's harder to maintain if one needs to add/delete: + + [node] { + 0 = [value1] + 1 = [value2] + } + +5. Node alias + + [node] : [another] + +Watch out, this makes those two nodes symbolic linking to each other, so this +will modify [another] as well: + + [node] : [another] + [node] { + extra = value + } + +6. Node copying + +To avoid the above accidental modification when aliasing a node, one can do, + + [node] := [another] + [node] { + extra = value + } + +Now, [node] is a different node than [another] and the modification doesn't +affect [another] + +7. Node inheritance + + [node] { + @[another] + extra = value + } + +is the same as + + [node] := [another] + [node] { + extra = value + } + +Sometimes it's easier and clearer to write node copying in inheritance format: + + [node] { + @[another1] + @[another2] + extra = value + } + +8. Special shell commands + + [node] != [command] + +This will execute shell command and use its return as the node's value. + +9. Include statement + + #include "another.hdf" + +10. Comments + + # only one format of comment is supported + # it has to start from line beginning + +Watch out, this is NOT comment: + + [node] = [value] # this will become part of node's value + +11. Multiple-line strings + + [node] << EOM + 1st line + 2nd line + ... + EOM diff --git a/doc/inconsistencies b/doc/inconsistencies new file mode 100644 index 0000000000000..f8ed01df0f2c0 --- /dev/null +++ b/doc/inconsistencies @@ -0,0 +1,72 @@ +

Inconsistenties

+ +These are the known inconsistencies between current HPHP and PHP. + +1. Operators + +(1) instanceof + +In PHP, [constant] instanceof [class name] will cause a fatal. +In HPHP, there is no special case for constants and the expression's value is +false. + +2. Classes and objects + +(1) Exceptions thrown from destructors + +In HPHP, exceptions and fatals thrown from destructors will be swallowed while +logging an error. Effectively, there is a try/catch enclosing the body of the +__destruct method. These exceptions are catchable in PHP outside of the +__destruct method. + +(2) Private properties are shared throughout class hierarchy + +In PHP, every class in a class hierarchy could define a private property +with the same name and have these properties be treated distinctly. +In HPHP, there is only one instance of the property that is shared by all +classes in the hierarchy. + +(3) Private and protected properties and __get + +In PHP, __get will be called if a property cannot be accessed from the +context of the object property expression. +In HPHP, __get will be called only if the property does not exist at all. +The interpreter will throw a fatal, and the compiler will silently ignore +the class privacy violation. + +(4) unset + +In PHP, a data member that is unset will not appear at all in vardump or +serialize. +In HPHP, it will still appear, as null. + +3. Eval Issues + +(1) eval + +Is only supported in limited circumstances. +Example unsupported case: phpt...bug21960 + +(2) create_function + +is only supported with literal arguments +Example unsupported case: phpt...bug22690 + +(3) preg_replace /e + +is only supported in limited cases. +Example unsupported case: phpt...bug24403 + +4. Dynamic declared globals + +are not supported, e.g. (phpt...bug24396) + + global $$k; / + $$k = $v; + +5. Misc + +(1) get_declared_classes + +Can return something substantially different than PHP +Example unsupported case: phpt...bug19566 diff --git a/doc/index.php b/doc/index.php new file mode 100644 index 0000000000000..04e9eb59745e3 --- /dev/null +++ b/doc/index.php @@ -0,0 +1,71 @@ +"; + +$file = 'debug.leak'; +if (isset($_GET['file'])) $file = $_GET['file']; +$doc = file_get_contents(realpath(dirname(__FILE__))."/$file"); + +echo ''; +echo '
'; +echo format_index($file); +echo ''; +echo format_document($doc); +echo '
'; + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +function format_index($file) { + $files = array(); + exec('ls '. realpath(dirname(__FILE__)), $files); + echo ''; + echo ''; + echo ''; + foreach ($files as $f) { + if (preg_match('/(~|Makefile|index\.php|style\.css|www\.pid)/', $f)) { + continue; + } + echo ''; + } + } + echo '
HipHop
 
'; + if (is_dir(realpath(dirname(__FILE__)).'/'.$f)) { + echo "$f"; + } else { + $class = $f == $file ? 'current_file' : 'file'; + echo "$f"; + echo '
'; +} + +function format_document($doc) { + $doc = preg_replace('/\n= (.*?)\n/', + "

\\1

\n", $doc); // h3 headers + $doc = preg_replace('/\n([0-9]+\. )(.*?)\n/', + "

\\1\\2

\n", $doc); // 1. 2. 3. + $doc = preg_replace('/\n(\([0-9]+\) )(.*?)\n/', + "\n\\1\\2\n", $doc); // (1) (2) (3) + $doc = preg_replace('/((?:\n- [^\n]*(?:\n [^\n]+)*)+)/', + "\n
    \\1
\n", $doc); // lists + $doc = preg_replace('/\n- /', "\n
  • ", $doc); // list items + $doc = preg_replace('/((?:\n [^\n]*)+)/', + "\n
    \\1
    \n", $doc); // code blocks + $doc = preg_replace('/(
  • [^\n]*)\n
    (.*?)<\/pre>/s',
    +                      "\\1 \\2", $doc);            // fix list item's 2nd lines
    +
    +  $doc = preg_replace('/\n([^ \t]+): (.*)/',
    +                      "
    \\1: ". + "\\2", + $doc); // item: details + + $doc = preg_replace('/\n\n/', '

    ', $doc); // paragraphs + $doc = preg_replace('//', '<T>', $doc); // C++ templates + + // copyright notice + $doc .= '

     
    '; + return $doc; +} diff --git a/doc/runtime.memory_model b/doc/runtime.memory_model new file mode 100644 index 0000000000000..bc5c6a4321fe8 --- /dev/null +++ b/doc/runtime.memory_model @@ -0,0 +1,116 @@ + +

    Memory Model

    + +In HPHP, there are several different types of variables, depending on how +their lifetime is controled and how they allocate and deallocate memories. + +1. Process Memory Variables + +(1) APC Variables + +APC stands for Alternative PHP Cache in PHP/Zend terminology, and they are +shared by multiple processes in pre-forking Apache environment. In HPHP, APC's +semantics is kept by two different implementations, depending on how program +is configured: + +- If HPHP is configured to run as one single process with multiple threads, + APC variables are merely the ones that are shared by all threads. They are + accessed through apc_store() and apc_fetch() functions by name-value lookups. + In this model, APC variables are implemented with plain memory, allocated and + deallocated through malloc/free calls. Then, granularity locking is + implemented to ensure access from multiple threads are safe and efficient. + +- If HPHP is configured to run with shared memory for APC, those variables + are allocated and deallocated through boost::inter_process classes, which + operate on real shared memory regions that multiple processes can attach to. + In this model, we used the same type of granularity locking for safe reads + and writes of these variables. + +(2) C++ Static Variables + +Regular C++ static variables will be accessible from multiple threads +automatically. Proper locking is needed for thread-safety. + +2. Thread Local Variables + +(1) ThreadLocal + +HPHP implemented ThreadLocal template class that wraps any C++ data +structures to make them thread local. A ThreadLocal object is only intended +to be accessed by a single thread, thus avoiding mutex locking. + +(2) Persistent Objects + +In PHP extensions, some objects are persistent across multiple requests, and +HPHP has also implemented this type of variables for resource data. They are +thread local, therefore, each thread has its own persistent object storage. +They are also accessed by names, just like how PHP/Zend has implemented it. + +3. Request Local Variables + +A request local variable is automatically thread local. In addition, they also +have initialization and shutdown processes at beginning and end of each +HTTP request. + +(1) PHP Variables + +All variables from user PHP code are request local variables. These variables +will go out of scope when a request is finished, even if it was a global +variable. + +These variables can be pritimive types, String, Array, Object or Variant. They +are allocated and deallocated through smart allocators and linear allocators. + +(2) RequestLocal + +HPHP also implemented RequestLocal template class to allow PHP extensions +to properly initialize and uninitialize certain request local variables. + +The template class simply implemented requestInit() and requestShutdown() +virtual functions that will be called by execution engine at startup and +shutdown time of an HTTP request. + + +

    Memory Allocators

    + +Two speciailized memory allocators are implemented in HPHP, in addition to +the general purpose tcmalloc we used for replacing glic's malloc/free. + +1. SmartAllocator + +A SmartAllocator simply allocates one slab of multiple objects with the same +size a time. Then it will use replacement new (macro-ed as NEW in HPHP code +base) for any caller to allocate a new one from the slab. + +When an object is deallocated, it will be pushed to a free list maintained by +the allocator. Such free list is first consulted when a new allocation is +requested. + +By doing so, many malloc/free calls otherwise will turn into push/pop +operations on the free list, with some rare malloc/free calls for slabs. + +The tradeoff is, each object will take an extra 64-bit pointer storage in +free list. + +2. LinearAllocator + +HPHP supports memory state check points, so that on subsequent requests, +certain user PHP code doesn't have to be executed again, if its sole purpose +is to initialize global states to certain values. + +To support this feature, we also implemented a so-called "linear allocator" +to allocate variable-sized objects during backup time of doing a checkpoint. + +For example, a String class wraps StringData that's in fixed size. So +StringData may use SmartAllocator for its allocation/deallocation. But +StringData may internally keep a char pointer that has a variable size. This +string pointer will be allocated through general purpose malloc/free initially, +but it will be copied into linear allocator, if it is allocated before a +check point is taken. When we restore a checkpoint, we then don't have to +make a new copy of the string any more, as all we have to do is to copy over +the string pointer that's always valid, as long as we hold the linear allocator +memory for the entire life. + +By doing so, we can memcpy entire linear allocator's memory each time we +restore a checkpoint, thus making it cheaper than many smaller malloc/free +calls. diff --git a/doc/runtime.type_system b/doc/runtime.type_system new file mode 100644 index 0000000000000..d1dfe9ccb3217 --- /dev/null +++ b/doc/runtime.type_system @@ -0,0 +1,57 @@ + +

    Type System

    + +1. Primitive Types + +In HPHP, booleans, integers (8-, 16-, 32- and 64-bit) and doubles are +represented as is with C++'s built-in primitive type support: + +- bool +- char, short, int, long long +- double + +2. String and Array classes + +Strings are represented as smart pointers of StringData objects, and arrays are +represented as smart pointers of ArrayData objects: + + class String : public SmartPtr + class Array : public SmartPtr + +We need smart pointers for both classes to implement pass-by-value semantics of +PHP without making real copies of internal data (StringData or ArrayData). + +Both classes have also utilized smart pointers to implement copy-on-write. They +will only make real copies, when they are being modified AND reference count is +larger than 1. + +3. Object classes + +In HPHP, all user classes derive from ObjectData. PHP object variables will +become smart pointers of different types of ObjectData objects. + +In PHP, objects are passed by reference automatically. Therefore, SmartPtr is +only helping ObjectData to do reference counting for proper deallocation when +reference count reaches zero. + +4. Variant class + +Variant type is union of all other types. When type inference fails to find +out a symbol's type, it will automatically have Variant type. + +Variant class itself serves as both a "smart pointer wrapper" class and a +countable class, so to make it a compact and reference-count-aware data +structure. + + +

    Pass-by-reference for strings and arrays

    + +Variables passed by reference are always given Variant type. + +A variable passed by reference is strongly bound to its argument variable. +Strong binding is implemented by replacing a variable's original value with a +reference cell holding that value. When another variable is strongly bound to +that variable, it acquires a reference to the cell. The reference cell is +implemented with a Variant. This is to easily pass operations from the outer +variant to the inner variant. Because operations only change the inner variant, +every outer variant that has a reference to it will see the change. diff --git a/doc/server.dangling_server b/doc/server.dangling_server new file mode 100644 index 0000000000000..4e8c47780c8e8 --- /dev/null +++ b/doc/server.dangling_server @@ -0,0 +1,20 @@ + +

    What is a Dangling Server

    + +Sometimes we need to make sure on one single web page, two AJAX requests hit +servers that are running with the same version of PHP code. This isn't always +the case during push time. Dangling server is trying to solve this problem by +running old instance of server on a different port for longer time before +shutting down. This way, on new server, if a page detects that the page needs +to be served from old version, it can simply call: + + if (dangling_server_proxy_request()) { + exit; + } + // otherwise continue executing the page with new version + +What dangling_server_proxy_request() will do is to send an HTTP request to +the local dangling server with URL, headers and POST data of current request, +and update current response's headers and output buffer with what it gets. It +will return false, if it failed to contact the dangling server that may have +shut down eventually. diff --git a/doc/server.documents b/doc/server.documents new file mode 100644 index 0000000000000..103975942a532 --- /dev/null +++ b/doc/server.documents @@ -0,0 +1,71 @@ + +

    Server Documents

    + +This flow is implemented in hphp/src/cpp/base/server/http_server.cpp: + + +-------------+ + | APC Priming | + +------+------+ + | + V + +-----------------+ + | StartupDocument | + +--------+--------+ + | + V + +---------------------------------+ + | | + V V + +============================+ +=================+ + | Worker Thread | | Service Threads | + |____________________________| |_________________| + | | | | + | +----------------+ | | ThreadDocuments | + | | WarmupDocument | | | | + | +-------+--------+ | +=================+ + | | | + | +-----> (chekpoint) | ... + | | | | + | | V | + | | +----------------+ | + | | | URL Handling | | + | | +----------------+ | + | | | | + | +-(rollback)-+ | + | | + +============================+ + + +1. StartupDocument + +This file is executed when web server starts, and it is executed before any +thread gets started but after APC is primed. Example use: + + * bootstrapping server + * preparing parameters for service threads (see below): in this case, we have + to use APC to pass those parameters into service threads. + +2. ThreadDocuments + +Each one of these files will be executed in its own thread, and they don't +share variables with any other threads. Therefore, if we need to pass data +between them, we have to use APC. + +There is a system function "hphp_service_thread_started" that needs to be +called at certain point. This function tells the engine that this thread has +finished any initialization sequences that have to happen before any HTTP +request is handled. Even if a service thread doesn't have any work to do +before HTTP requests, hphp_service_thread_started() is still needed for engine +to proceed without infinite waiting for service threads to start. + +3. WarmupDocument + +A warmup document is executed during a worker thread's startup time, and it's +only executed just once for the entire life of a worker thread. Right after +this warmup document is run, a worker thread takes a checkpoint of its memory +state. Then the worker thread will start its request handling loop. At end of +each request handling, it will rollback its memory state to the checkpoint. + +A warmup document can prepare global variables and other persistent data that +are request neutral. This way we can avoid running the same initialization +sequence for every single request. diff --git a/doc/server.rpc_server b/doc/server.rpc_server new file mode 100644 index 0000000000000..6c1e3c6084eeb --- /dev/null +++ b/doc/server.rpc_server @@ -0,0 +1,63 @@ + +

    How to execute a PHP function over network

    + +1. Parameters + +When RPC server is turned on, HPHP server will listen on a port that takes RPC +requests in a format like this, + + http://[server]:[port]/function_name?params=... + +"params" needs to be a JSON encoded array. The server will execute the function +and return its result. + +Alternatively, one can pass in one parameter a time like this, + + http://[server]:[port]/function_name?p=[json value]&p=[json value]... + +Each "p" is sequentially fed into the function as its first parameter, second +parameter, etc.. Each parameter needs to be encoded in JSON separately. + +There is also an "auth" parameter that needs to be passed in, if server is +configured to authenticate with a simple password. It would normally be a +password specified in /hphp/config.hdf under Satellites.rpc.Password. + +2. States + +Note that RPC server is considerably faster than an ajax page request, because +it has made an assumption that the function needed to run this way is "pure" or +"stateless", without leaving bad global states to subsequent calls. With this +assumption, the server only initializes libraries once and it will execution +multiple function calls (the number is configurable) within the same loop. +This is very similar to FastCGI's paradigm. + +If you need to call a function that leaves bad states to other functions, +please add "reset=1" to the parameter, so the states can be thrown away after +the function is called: + + http://[server]:[port]/function_name?reset=1&... + +3. Returns + +If stdout is needed in addition to function's return, use "output=2", and +HTTP response is a JSON encoded array like this, + + array { + "return" => [function's return] + "output" => [stdout from echos or prints] + } + +If function's return is not needed, use "output=1" to turn it off. Then HTTP +response is stdout's output (from echos and prints) without JSON encoding. + +If none is needed, use "output=-1" to suppress them. Then an empty string will +be returned. This may be useful, if the function is not a query but an action. + +By default, "output=0" and function's return is encoded in JSON response. + +To summarize, + +0: (default) just function's return in JSON encoding +1: just stdout as a string without JSON encoding +2: both function's return and stdout in a JSON encoded array +-1: none diff --git a/doc/style.css b/doc/style.css new file mode 100644 index 0000000000000..ab67545768339 --- /dev/null +++ b/doc/style.css @@ -0,0 +1,83 @@ + +a:link { color: navy; } +a:visited { color: navy; } +a:active { color: #FF6600; } +a:hover { color: #FF6600; } + +body, th, td { + border: 0px solid #bdc7d8; + font-size: 13px; + font-family: "lucida grande", tahoma, verdana, arial, sans-serif +} + +b { + color: maroon +} + +p { + line-height: 1.6em; + margin-left: 10px; +} + +h2 { + font-size: 16px; + background: #3B5998; + color: #EFEFEF; + padding: 4px; +} + +h3 { + border-bottom: 1px solid #CCCCCC; + margin-bottom: 0.75em; + margin-top: 2.5em; + margin-left: 10px; +} + +ul { + list-style: square; +} + +pre { + font-family: "lucida console", monaco, courier; + font-size: 10px; + background: #FFEEBB; + padding: 10px; + margin: 10px; + margin-left: 25px; + border: 1px solid #FFDD88; + white-space: pre; + line-height: 1.4em; +} + +.hphp { + font-family: arial; + font-size: 36px; + color: white; + border-bottom: 5px dotted #DDDDDD; +} + +.file { + color: white; + font-size: 12px; +} + +.current_file { + background: white; + font-size: 16px; + border-bottom: 1px dotted #DDDDDD; +} + +.item_header { + margin-left: 25px; + color: #444444; +} + +.item_details { + color: #888888; +} + +.footer { + border-top: 1px solid #DDDDDD; + padding-bottom: 5px; + font-size: 10px; +} diff --git a/local/sample.mk b/local/sample.mk new file mode 100644 index 0000000000000..f2d4054dc1cd4 --- /dev/null +++ b/local/sample.mk @@ -0,0 +1,6 @@ + +# copy this file into say "rules.mk" in this same directory and uncomment +# any one of these flags upon your need + +#DEBUG = 1 +#HOTPROFILER=1 diff --git a/phpt/Makefile b/phpt/Makefile new file mode 100644 index 0000000000000..4484dd5d8cf70 --- /dev/null +++ b/phpt/Makefile @@ -0,0 +1,574 @@ +ROOTDIR = tests/php-5.2.5 +PHPT_FILES = \ + $(wildcard $(ROOTDIR)/ext/bcmath/tests/*.phpt) \ + $(wildcard $(ROOTDIR)/ext/hash/tests/*.phpt) \ + $(wildcard $(ROOTDIR)/ext/date/tests/*.phpt) \ + $(wildcard $(ROOTDIR)/ext/json/tests/*.phpt) \ + $(wildcard $(ROOTDIR)/sapi/cgi/tests/*.phpt) \ + $(wildcard $(ROOTDIR)/sapi/tests/*.phpt) \ + $(wildcard $(ROOTDIR)/sapi/cli/tests/*.phpt) \ + $(wildcard $(ROOTDIR)/tests/basic/*.phpt) \ + $(wildcard $(ROOTDIR)/tests/lang/*phpt) \ + $(wildcard $(ROOTDIR)/tests/strings/*phpt) \ + $(wildcard $(ROOTDIR)/tests/func/*.phpt) \ + $(wildcard $(ROOTDIR)/tests/run-test/*phpt) \ + $(wildcard $(ROOTDIR)/tests/classes/*.phpt) \ + $(wildcard $(ROOTDIR)/Zend/tests/*.phpt) \ + +# some of these are skipped for trivial message differences +# some are skipped because the functionality isn't implemented +SKIPPED = \ + tests/php-5.2.5/sapi/cgi/tests/001.phpt \ + tests/php-5.2.5/sapi/cgi/tests/002.phpt \ + tests/php-5.2.5/sapi/cgi/tests/003.phpt \ + tests/php-5.2.5/sapi/cgi/tests/004.phpt \ + tests/php-5.2.5/sapi/cgi/tests/005.phpt \ + tests/php-5.2.5/sapi/cgi/tests/006.phpt \ + tests/php-5.2.5/sapi/cgi/tests/007.phpt \ + tests/php-5.2.5/sapi/cgi/tests/008.phpt \ + tests/php-5.2.5/sapi/cgi/tests/009.phpt \ + tests/php-5.2.5/sapi/tests/test006.phpt \ + tests/php-5.2.5/sapi/tests/test007.phpt \ + tests/php-5.2.5/sapi/cli/tests/001.phpt \ + tests/php-5.2.5/sapi/cli/tests/002.phpt \ + tests/php-5.2.5/sapi/cli/tests/002-win32.phpt \ + tests/php-5.2.5/sapi/cli/tests/003-2.phpt \ + tests/php-5.2.5/sapi/cli/tests/003.phpt \ + tests/php-5.2.5/sapi/cli/tests/004.phpt \ + tests/php-5.2.5/sapi/cli/tests/005.phpt \ + tests/php-5.2.5/sapi/cli/tests/006.phpt \ + tests/php-5.2.5/sapi/cli/tests/007.phpt \ + tests/php-5.2.5/sapi/cli/tests/008.phpt \ + tests/php-5.2.5/sapi/cli/tests/009.phpt \ + tests/php-5.2.5/sapi/cli/tests/010-2.phpt \ + tests/php-5.2.5/sapi/cli/tests/010.phpt \ + tests/php-5.2.5/sapi/cli/tests/011.phpt \ + tests/php-5.2.5/sapi/cli/tests/012.phpt \ + tests/php-5.2.5/sapi/cli/tests/013.phpt \ + tests/php-5.2.5/sapi/cli/tests/014.phpt \ + tests/php-5.2.5/sapi/cli/tests/015.phpt \ + tests/php-5.2.5/tests/basic/002.phpt \ + tests/php-5.2.5/tests/basic/003.phpt \ + tests/php-5.2.5/tests/basic/004.phpt \ + tests/php-5.2.5/tests/basic/005.phpt \ + tests/php-5.2.5/tests/basic/011.phpt \ + tests/php-5.2.5/tests/basic/012.phpt \ + tests/php-5.2.5/tests/basic/013.phpt \ + tests/php-5.2.5/tests/basic/014.phpt \ + tests/php-5.2.5/tests/basic/015.phpt \ + tests/php-5.2.5/tests/basic/016.phpt \ + tests/php-5.2.5/tests/basic/017.phpt \ + tests/php-5.2.5/tests/basic/018.phpt \ + tests/php-5.2.5/tests/basic/019.phpt \ + tests/php-5.2.5/tests/basic/020.phpt \ + tests/php-5.2.5/tests/basic/021.phpt \ + tests/php-5.2.5/tests/basic/024.phpt \ + tests/php-5.2.5/tests/basic/025.phpt \ + tests/php-5.2.5/tests/basic/026.phpt \ + tests/php-5.2.5/tests/basic/027.phpt \ + tests/php-5.2.5/tests/basic/bug29971.phpt \ +\ + tests/php-5.2.5/tests/run-test/test004.phpt \ + tests/php-5.2.5/tests/run-test/test006.phpt \ + tests/php-5.2.5/tests/run-test/test010.phpt \ +\ + tests/php-5.2.5/tests/classes/__set__get_002.phpt \ + tests/php-5.2.5/tests/classes/__set__get_003.phpt \ +\ + tests/php-5.2.5/Zend/tests/errmsg_001.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_002.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_003.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_004.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_005.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_006.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_007.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_008.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_009.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_010.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_011.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_012.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_013.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_014.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_015.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_016.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_017.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_018.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_019.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_020.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_022.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_023.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_024.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_025.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_026.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_027.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_028.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_029.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_030.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_031.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_032.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_033.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_034.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_035.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_036.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_037.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_038.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_039.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_040.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_041.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_042.phpt \ + tests/php-5.2.5/Zend/tests/errmsg_043.phpt \ + tests/php-5.2.5/Zend/tests/error_reporting01.phpt \ + tests/php-5.2.5/Zend/tests/error_reporting02.phpt \ + tests/php-5.2.5/Zend/tests/error_reporting03.phpt \ + tests/php-5.2.5/Zend/tests/error_reporting04.phpt \ + tests/php-5.2.5/Zend/tests/error_reporting05.phpt \ + tests/php-5.2.5/Zend/tests/error_reporting06.phpt \ + tests/php-5.2.5/Zend/tests/error_reporting07.phpt \ + tests/php-5.2.5/Zend/tests/error_reporting08.phpt \ + tests/php-5.2.5/Zend/tests/error_reporting09.phpt \ + tests/php-5.2.5/Zend/tests/error_reporting10.phpt \ + tests/php-5.2.5/Zend/tests/bug30922.phpt \ + tests/php-5.2.5/Zend/tests/bug31102.phpt \ + tests/php-5.2.5/Zend/tests/bug33318.phpt \ + tests/php-5.2.5/Zend/tests/bug34064.phpt \ + tests/php-5.2.5/Zend/tests/bug36071.phpt \ + tests/php-5.2.5/Zend/tests/bug36268.phpt \ + tests/php-5.2.5/Zend/tests/bug37632.phpt \ + tests/php-5.2.5/Zend/tests/bug40770.phpt \ + tests/php-5.2.5/Zend/tests/bug41117_1.phpt \ + tests/php-5.2.5/Zend/tests/bug41209.phpt \ + tests/php-5.2.5/Zend/tests/bug41351_2.phpt \ + tests/php-5.2.5/Zend/tests/bug41351_3.phpt \ + tests/php-5.2.5/Zend/tests/bug41351.phpt \ + tests/php-5.2.5/Zend/tests/bug41421.phpt \ + tests/php-5.2.5/Zend/tests/bug41633_2.phpt \ + tests/php-5.2.5/Zend/tests/bug41633_3.phpt \ + tests/php-5.2.5/Zend/tests/bug41813.phpt \ + tests/php-5.2.5/Zend/tests/bug42817.phpt \ + tests/php-5.2.5/Zend/tests/double_to_string_64bit.phpt \ + tests/php-5.2.5/Zend/tests/hex_overflow_32bit.phpt \ + tests/php-5.2.5/Zend/tests/int_overflow_64bit.phpt \ + tests/php-5.2.5/Zend/tests/int_underflow_64bit.phpt \ + tests/php-5.2.5/Zend/tests/bug42818.phpt \ + tests/php-5.2.5/Zend/tests/mul_001.phpt \ + tests/php-5.2.5/Zend/tests/not_002.phpt \ + tests/php-5.2.5/Zend/tests/objects_012.phpt \ + tests/php-5.2.5/Zend/tests/objects_013.phpt \ + tests/php-5.2.5/Zend/tests/objects_014.phpt \ + tests/php-5.2.5/Zend/tests/offset_assign.phpt \ + tests/php-5.2.5/Zend/tests/offset_object.phpt \ + tests/php-5.2.5/Zend/tests/017.phpt \ + +# These succeed, but are testing an expected parser error +# which is not handled gracefully by this makefile +SKIPPED += \ + tests/php-5.2.5/tests/lang/bug21820.phpt \ + tests/php-5.2.5/tests/lang/033.phpt \ + tests/php-5.2.5/tests/lang/bug24054.phpt \ + tests/php-5.2.5/tests/lang/bug24573.phpt \ + +# These have some warning message difference, which is not critical (e.g. line#) +# This a positive list to run, not a negative list to filter out +# Many of the SKIPPED tests could be moved here with some work on the filter +FILTERED = \ + tests/php-5.2.5/tests/lang/bug23584.phpt \ + +FAILED = \ + tests/php-5.2.5/ext/json/tests/bug41403.phpt \ + tests/php-5.2.5/ext/json/tests/pass001.1_64bit.phpt \ + tests/php-5.2.5/ext/json/tests/pass001.1.phpt \ +\ + tests/php-5.2.5/ext/date/tests/012.phpt \ + tests/php-5.2.5/ext/date/tests/013.phpt \ + tests/php-5.2.5/ext/date/tests/014.phpt \ + tests/php-5.2.5/ext/date/tests/bug20382-1.phpt \ + tests/php-5.2.5/ext/date/tests/bug20382-2.phpt \ + tests/php-5.2.5/ext/date/tests/bug26090.phpt \ + tests/php-5.2.5/ext/date/tests/bug27719.phpt \ + tests/php-5.2.5/ext/date/tests/bug28024.phpt \ + tests/php-5.2.5/ext/date/tests/bug30096.phpt \ + tests/php-5.2.5/ext/date/tests/bug30532.phpt \ + tests/php-5.2.5/ext/date/tests/bug32086.phpt \ + tests/php-5.2.5/ext/date/tests/bug32270.phpt \ + tests/php-5.2.5/ext/date/tests/bug33414-1.phpt \ + tests/php-5.2.5/ext/date/tests/bug33414-2.phpt \ + tests/php-5.2.5/ext/date/tests/bug33415-1.phpt \ + tests/php-5.2.5/ext/date/tests/bug33415-2.phpt \ + tests/php-5.2.5/ext/date/tests/bug33562.phpt \ + tests/php-5.2.5/ext/date/tests/bug35143.phpt \ + tests/php-5.2.5/ext/date/tests/bug35499.phpt \ + tests/php-5.2.5/ext/date/tests/bug39782.phpt \ + tests/php-5.2.5/ext/date/tests/bug41523.phpt \ + tests/php-5.2.5/ext/date/tests/bug41709.phpt \ + tests/php-5.2.5/ext/date/tests/bug41842.phpt \ + tests/php-5.2.5/ext/date/tests/bug41844.phpt \ + tests/php-5.2.5/ext/date/tests/date_constants.phpt \ + tests/php-5.2.5/ext/date/tests/date_create-1.phpt \ + tests/php-5.2.5/ext/date/tests/date_create-2.phpt \ + tests/php-5.2.5/ext/date/tests/date_modify-1.phpt \ + tests/php-5.2.5/ext/date/tests/date_modify-2.phpt \ + tests/php-5.2.5/ext/date/tests/date_parse_001.phpt \ + tests/php-5.2.5/ext/date/tests/mktime-1.phpt \ + tests/php-5.2.5/ext/date/tests/mktime-2.phpt \ + tests/php-5.2.5/ext/date/tests/oo_001.phpt \ + tests/php-5.2.5/ext/date/tests/oo_002.phpt \ + tests/php-5.2.5/ext/date/tests/strtotime3.phpt \ + tests/php-5.2.5/ext/date/tests/timezones.phpt \ +\ + tests/php-5.2.5/sapi/tests/test004.phpt \ + tests/php-5.2.5/tests/lang/039.phpt \ + tests/php-5.2.5/tests/lang/bug21094.phpt \ + tests/php-5.2.5/tests/lang/bug21600.phpt \ + tests/php-5.2.5/tests/lang/bug22592.phpt \ + tests/php-5.2.5/tests/lang/bug23384.phpt \ + tests/php-5.2.5/tests/lang/bug23489.phpt \ + tests/php-5.2.5/tests/lang/bug23624.phpt \ + tests/php-5.2.5/tests/lang/bug24658.phpt \ + tests/php-5.2.5/tests/lang/bug24951.phpt \ + tests/php-5.2.5/tests/lang/bug25145.phpt \ + tests/php-5.2.5/tests/lang/bug25547.phpt \ + tests/php-5.2.5/tests/lang/bug25922.phpt \ + tests/php-5.2.5/tests/lang/bug27439.phpt \ + tests/php-5.2.5/tests/lang/bug28213.phpt \ + tests/php-5.2.5/tests/lang/bug29566.phpt \ + tests/php-5.2.5/tests/lang/bug29893.phpt \ + tests/php-5.2.5/tests/lang/bug30578.phpt \ + tests/php-5.2.5/tests/lang/bug32828.phpt \ + tests/php-5.2.5/tests/lang/bug32924.phpt \ + tests/php-5.2.5/tests/lang/bug35176.phpt \ + tests/php-5.2.5/tests/lang/bug35382.phpt \ + tests/php-5.2.5/tests/lang/bug38579.phpt \ + tests/php-5.2.5/tests/lang/catchable_error_001.phpt \ + tests/php-5.2.5/tests/lang/catchable_error_002.phpt \ + tests/php-5.2.5/tests/lang/error_2_exception_001.phpt \ + tests/php-5.2.5/tests/lang/foreach_with_references_001.phpt \ + tests/php-5.2.5/tests/lang/type_hints_001.phpt \ + tests/php-5.2.5/tests/lang/type_hints_003.phpt \ +\ + tests/php-5.2.5/tests/strings/002.phpt \ + tests/php-5.2.5/tests/strings/004.phpt \ + tests/php-5.2.5/tests/strings/bug26703.phpt \ +\ + tests/php-5.2.5/tests/func/005a.phpt \ + tests/php-5.2.5/tests/func/007.phpt \ +\ + tests/php-5.2.5/tests/run-test/test005.phpt \ + tests/php-5.2.5/tests/run-test/test007.phpt \ + tests/php-5.2.5/tests/run-test/test008a.phpt \ +\ + tests/php-5.2.5/tests/classes/abstract_by_interface_001.phpt \ + tests/php-5.2.5/tests/classes/abstract_by_interface_002.phpt \ + tests/php-5.2.5/tests/classes/abstract_class.phpt \ + tests/php-5.2.5/tests/classes/abstract_derived.phpt \ + tests/php-5.2.5/tests/classes/abstract_final.phpt \ + tests/php-5.2.5/tests/classes/abstract_inherit.phpt \ + tests/php-5.2.5/tests/classes/abstract_not_declared.phpt \ + tests/php-5.2.5/tests/classes/abstract.phpt \ + tests/php-5.2.5/tests/classes/abstract_redeclare.phpt \ + tests/php-5.2.5/tests/classes/abstract_static.phpt \ + tests/php-5.2.5/tests/classes/abstract_user_call.phpt \ + tests/php-5.2.5/tests/classes/array_access_001.phpt \ + tests/php-5.2.5/tests/classes/array_access_002.phpt \ + tests/php-5.2.5/tests/classes/array_access_003.phpt \ + tests/php-5.2.5/tests/classes/array_access_004.phpt \ + tests/php-5.2.5/tests/classes/array_access_005.phpt \ + tests/php-5.2.5/tests/classes/array_access_006.phpt \ + tests/php-5.2.5/tests/classes/array_access_008.phpt \ + tests/php-5.2.5/tests/classes/array_access_009.phpt \ + tests/php-5.2.5/tests/classes/array_access_010.phpt \ + tests/php-5.2.5/tests/classes/array_access_011.phpt \ + tests/php-5.2.5/tests/classes/array_access_012.phpt \ + tests/php-5.2.5/tests/classes/autoload_001.phpt \ + tests/php-5.2.5/tests/classes/autoload_002.phpt \ + tests/php-5.2.5/tests/classes/autoload_003.phpt \ + tests/php-5.2.5/tests/classes/autoload_004.phpt \ + tests/php-5.2.5/tests/classes/autoload_005.phpt \ + tests/php-5.2.5/tests/classes/autoload_006.phpt \ + tests/php-5.2.5/tests/classes/bug26737.phpt \ + tests/php-5.2.5/tests/classes/bug27468.phpt \ + tests/php-5.2.5/tests/classes/bug27504.phpt \ + tests/php-5.2.5/tests/classes/bug29446.phpt \ + tests/php-5.2.5/tests/classes/__call_002.phpt \ + tests/php-5.2.5/tests/classes/class_abstract.phpt \ + tests/php-5.2.5/tests/classes/class_final.phpt \ + tests/php-5.2.5/tests/classes/clone_003.phpt \ + tests/php-5.2.5/tests/classes/clone_004.phpt \ + tests/php-5.2.5/tests/classes/clone_005.phpt \ + tests/php-5.2.5/tests/classes/ctor_in_interface_01.phpt \ + tests/php-5.2.5/tests/classes/ctor_in_interface_02.phpt \ + tests/php-5.2.5/tests/classes/ctor_in_interface_03.phpt \ + tests/php-5.2.5/tests/classes/ctor_in_interface_04.phpt \ + tests/php-5.2.5/tests/classes/ctor_visibility.phpt \ + tests/php-5.2.5/tests/classes/destructor_visibility_001.phpt \ + tests/php-5.2.5/tests/classes/destructor_visibility_002.phpt \ + tests/php-5.2.5/tests/classes/factory_and_singleton_002.phpt \ + tests/php-5.2.5/tests/classes/factory_and_singleton_003.phpt \ + tests/php-5.2.5/tests/classes/factory_and_singleton_004.phpt \ + tests/php-5.2.5/tests/classes/factory_and_singleton_005.phpt \ + tests/php-5.2.5/tests/classes/factory_and_singleton_006.phpt \ + tests/php-5.2.5/tests/classes/factory_and_singleton_007.phpt \ + tests/php-5.2.5/tests/classes/factory_and_singleton_008.phpt \ + tests/php-5.2.5/tests/classes/factory_and_singleton_009.phpt \ + tests/php-5.2.5/tests/classes/factory_and_singleton_010.phpt \ + tests/php-5.2.5/tests/classes/final_abstract.phpt \ + tests/php-5.2.5/tests/classes/final_ctor1.phpt \ + tests/php-5.2.5/tests/classes/final_ctor2.phpt \ + tests/php-5.2.5/tests/classes/final_redeclare.phpt \ + tests/php-5.2.5/tests/classes/incdec_property_001.phpt \ + tests/php-5.2.5/tests/classes/incdec_property_002.phpt \ + tests/php-5.2.5/tests/classes/incdec_property_003.phpt \ + tests/php-5.2.5/tests/classes/incdec_property_004.phpt \ + tests/php-5.2.5/tests/classes/inheritance.phpt \ + tests/php-5.2.5/tests/classes/interface_and_extends.phpt \ + tests/php-5.2.5/tests/classes/interface_class.phpt \ + tests/php-5.2.5/tests/classes/interface_doubled.phpt \ + tests/php-5.2.5/tests/classes/interface_implemented.phpt \ + tests/php-5.2.5/tests/classes/interface_instantiate.phpt \ + tests/php-5.2.5/tests/classes/interface_member.phpt \ + tests/php-5.2.5/tests/classes/interface_method_final.phpt \ + tests/php-5.2.5/tests/classes/interface_method.phpt \ + tests/php-5.2.5/tests/classes/interface_method_private.phpt \ + tests/php-5.2.5/tests/classes/interface_must_be_implemented.phpt \ + tests/php-5.2.5/tests/classes/interfaces_002.phpt \ + tests/php-5.2.5/tests/classes/interfaces_003.phpt \ + tests/php-5.2.5/tests/classes/iterators_001.phpt \ + tests/php-5.2.5/tests/classes/iterators_002.phpt \ + tests/php-5.2.5/tests/classes/iterators_003.phpt \ + tests/php-5.2.5/tests/classes/iterators_005.phpt \ + tests/php-5.2.5/tests/classes/iterators_006.phpt \ + tests/php-5.2.5/tests/classes/private_001.phpt \ + tests/php-5.2.5/tests/classes/private_002.phpt \ + tests/php-5.2.5/tests/classes/private_003b.phpt \ + tests/php-5.2.5/tests/classes/private_003.phpt \ + tests/php-5.2.5/tests/classes/private_004b.phpt \ + tests/php-5.2.5/tests/classes/private_004.phpt \ + tests/php-5.2.5/tests/classes/private_005b.phpt \ + tests/php-5.2.5/tests/classes/private_005.phpt \ + tests/php-5.2.5/tests/classes/private_members.phpt \ + tests/php-5.2.5/tests/classes/private_redeclare.phpt \ + tests/php-5.2.5/tests/classes/protected_001b.phpt \ + tests/php-5.2.5/tests/classes/protected_001.phpt \ + tests/php-5.2.5/tests/classes/protected_002.phpt \ + tests/php-5.2.5/tests/classes/serialize_001.phpt \ + tests/php-5.2.5/tests/classes/__set_data_corrupt.phpt \ + tests/php-5.2.5/tests/classes/__set__get_001.phpt \ + tests/php-5.2.5/tests/classes/__set__get_005.phpt \ + tests/php-5.2.5/tests/classes/static_mix_1.phpt \ + tests/php-5.2.5/tests/classes/static_mix_2.phpt \ + tests/php-5.2.5/tests/classes/this.phpt \ + tests/php-5.2.5/tests/classes/tostring_001.phpt \ + tests/php-5.2.5/tests/classes/tostring_003.phpt \ + tests/php-5.2.5/tests/classes/type_hinting_001.phpt \ + tests/php-5.2.5/tests/classes/type_hinting_002.phpt \ + tests/php-5.2.5/tests/classes/type_hinting_003.phpt \ + tests/php-5.2.5/tests/classes/visibility_000a.phpt \ + tests/php-5.2.5/tests/classes/visibility_000b.phpt \ + tests/php-5.2.5/tests/classes/visibility_001a.phpt \ + tests/php-5.2.5/tests/classes/visibility_001b.phpt \ + tests/php-5.2.5/tests/classes/visibility_002a.phpt \ + tests/php-5.2.5/tests/classes/visibility_002b.phpt \ + tests/php-5.2.5/tests/classes/visibility_003b.phpt \ + tests/php-5.2.5/tests/classes/visibility_005.phpt \ +\ + tests/php-5.2.5/Zend/tests/008.phpt \ + tests/php-5.2.5/Zend/tests/011.phpt \ + tests/php-5.2.5/Zend/tests/014.phpt \ + tests/php-5.2.5/Zend/tests/018.phpt \ + tests/php-5.2.5/Zend/tests/019.phpt \ + tests/php-5.2.5/Zend/tests/020.phpt \ + tests/php-5.2.5/Zend/tests/array_type_hint_001.phpt \ + tests/php-5.2.5/Zend/tests/bug20240.phpt \ + tests/php-5.2.5/Zend/tests/bug21478.phpt \ + tests/php-5.2.5/Zend/tests/bug24884.phpt \ + tests/php-5.2.5/Zend/tests/bug26166.phpt \ + tests/php-5.2.5/Zend/tests/bug26229.phpt \ + tests/php-5.2.5/Zend/tests/bug27669.phpt \ + tests/php-5.2.5/Zend/tests/bug27731.phpt \ + tests/php-5.2.5/Zend/tests/bug27798.phpt \ + tests/php-5.2.5/Zend/tests/bug28072.phpt \ + tests/php-5.2.5/Zend/tests/bug28377.phpt \ + tests/php-5.2.5/Zend/tests/bug28444.phpt \ + tests/php-5.2.5/Zend/tests/bug29210.phpt \ + tests/php-5.2.5/Zend/tests/bug29505.phpt \ + tests/php-5.2.5/Zend/tests/bug29689.phpt \ + tests/php-5.2.5/Zend/tests/bug29890.phpt \ + tests/php-5.2.5/Zend/tests/bug29896.phpt \ + tests/php-5.2.5/Zend/tests/bug30080.phpt \ + tests/php-5.2.5/Zend/tests/bug30162.phpt \ + tests/php-5.2.5/Zend/tests/bug30725.phpt \ + tests/php-5.2.5/Zend/tests/bug30791.phpt \ + tests/php-5.2.5/Zend/tests/bug30820.phpt \ + tests/php-5.2.5/Zend/tests/bug30828.phpt \ + tests/php-5.2.5/Zend/tests/bug30889.phpt \ + tests/php-5.2.5/Zend/tests/bug30998.phpt \ + tests/php-5.2.5/Zend/tests/bug31098.phpt \ + tests/php-5.2.5/Zend/tests/bug31720.phpt \ + tests/php-5.2.5/Zend/tests/bug32290.phpt \ + tests/php-5.2.5/Zend/tests/bug32296.phpt \ + tests/php-5.2.5/Zend/tests/bug32322.phpt \ + tests/php-5.2.5/Zend/tests/bug33116.phpt \ + tests/php-5.2.5/Zend/tests/bug33277.phpt \ + tests/php-5.2.5/Zend/tests/bug33512.phpt \ + tests/php-5.2.5/Zend/tests/bug33732.phpt \ + tests/php-5.2.5/Zend/tests/bug33771.phpt \ + tests/php-5.2.5/Zend/tests/bug33802.phpt \ + tests/php-5.2.5/Zend/tests/bug33996.phpt \ + tests/php-5.2.5/Zend/tests/bug34062.phpt \ + tests/php-5.2.5/Zend/tests/bug34137.phpt \ + tests/php-5.2.5/Zend/tests/bug34199.phpt \ + tests/php-5.2.5/Zend/tests/bug34518.phpt \ + tests/php-5.2.5/Zend/tests/bug34617.phpt \ + tests/php-5.2.5/Zend/tests/bug34786.phpt \ + tests/php-5.2.5/Zend/tests/bug35017.phpt \ + tests/php-5.2.5/Zend/tests/bug35437.phpt \ + tests/php-5.2.5/Zend/tests/bug35470.phpt \ + tests/php-5.2.5/Zend/tests/bug35634.phpt \ + tests/php-5.2.5/Zend/tests/bug35655.phpt \ + tests/php-5.2.5/Zend/tests/bug36214.phpt \ + tests/php-5.2.5/Zend/tests/bug36303.phpt \ + tests/php-5.2.5/Zend/tests/bug36513.phpt \ + tests/php-5.2.5/Zend/tests/bug36568.phpt \ + tests/php-5.2.5/Zend/tests/bug37138.phpt \ + tests/php-5.2.5/Zend/tests/bug37212.phpt \ + tests/php-5.2.5/Zend/tests/bug37667.phpt \ + tests/php-5.2.5/Zend/tests/bug37811.phpt \ + tests/php-5.2.5/Zend/tests/bug38220.phpt \ + tests/php-5.2.5/Zend/tests/bug38779_1.phpt \ + tests/php-5.2.5/Zend/tests/bug38779.phpt \ + tests/php-5.2.5/Zend/tests/bug38942.phpt \ + tests/php-5.2.5/Zend/tests/bug39003.phpt \ + tests/php-5.2.5/Zend/tests/bug39036.phpt \ + tests/php-5.2.5/Zend/tests/bug39297.phpt \ + tests/php-5.2.5/Zend/tests/bug39304.phpt \ + tests/php-5.2.5/Zend/tests/bug39449.phpt \ + tests/php-5.2.5/Zend/tests/bug39542.phpt \ + tests/php-5.2.5/Zend/tests/bug39944.phpt \ + tests/php-5.2.5/Zend/tests/bug40236.phpt \ + tests/php-5.2.5/Zend/tests/bug40509.phpt \ + tests/php-5.2.5/Zend/tests/bug40621.phpt \ + tests/php-5.2.5/Zend/tests/bug40705.phpt \ + tests/php-5.2.5/Zend/tests/bug40815.phpt \ + tests/php-5.2.5/Zend/tests/bug41026.phpt \ + tests/php-5.2.5/Zend/tests/bug41075.phpt \ + tests/php-5.2.5/Zend/tests/bug41633_4.phpt \ + tests/php-5.2.5/Zend/tests/bug41640.phpt \ + tests/php-5.2.5/Zend/tests/bug41919.phpt \ + tests/php-5.2.5/Zend/tests/bug42211.phpt \ + tests/php-5.2.5/Zend/tests/bug42767.phpt \ + tests/php-5.2.5/Zend/tests/bug_debug_backtrace.phpt \ + tests/php-5.2.5/Zend/tests/cast_to_array.phpt \ + tests/php-5.2.5/Zend/tests/cast_to_double.phpt \ + tests/php-5.2.5/Zend/tests/cast_to_int.phpt \ + tests/php-5.2.5/Zend/tests/cast_to_object.phpt \ + tests/php-5.2.5/Zend/tests/cast_to_string.phpt \ + tests/php-5.2.5/Zend/tests/catch.phpt \ + tests/php-5.2.5/Zend/tests/class_constants_001.phpt \ + tests/php-5.2.5/Zend/tests/class_constants_002.phpt \ + tests/php-5.2.5/Zend/tests/class_constants_003.phpt \ + tests/php-5.2.5/Zend/tests/compare_001_64bit.phpt \ + tests/php-5.2.5/Zend/tests/compare_002_64bit.phpt \ + tests/php-5.2.5/Zend/tests/compare_003_64bit.phpt \ + tests/php-5.2.5/Zend/tests/compare_004_64bit.phpt \ + tests/php-5.2.5/Zend/tests/compare_005_64bit.phpt \ + tests/php-5.2.5/Zend/tests/compare_006_64bit.phpt \ + tests/php-5.2.5/Zend/tests/decrement_001_64bit.phpt \ + tests/php-5.2.5/Zend/tests/div_002.phpt \ + tests/php-5.2.5/Zend/tests/exception_handler_002.phpt \ + tests/php-5.2.5/Zend/tests/exception_handler_003.phpt \ + tests/php-5.2.5/Zend/tests/exception_handler_004.phpt \ + tests/php-5.2.5/Zend/tests/foreach_undefined.phpt \ + tests/php-5.2.5/Zend/tests/get_defined_vars.phpt \ + tests/php-5.2.5/Zend/tests/globals_001.phpt \ + tests/php-5.2.5/Zend/tests/globals_002.phpt \ + tests/php-5.2.5/Zend/tests/globals_003.phpt \ + tests/php-5.2.5/Zend/tests/globals_004.phpt \ + tests/php-5.2.5/Zend/tests/halt01.phpt \ + tests/php-5.2.5/Zend/tests/halt02.phpt \ + tests/php-5.2.5/Zend/tests/halt03.phpt \ + tests/php-5.2.5/Zend/tests/halt_compiler1.phpt \ + tests/php-5.2.5/Zend/tests/halt_compiler2.phpt \ + tests/php-5.2.5/Zend/tests/halt_compiler4.phpt \ + tests/php-5.2.5/Zend/tests/instanceof.phpt \ + tests/php-5.2.5/Zend/tests/is_a.phpt \ + tests/php-5.2.5/Zend/tests/magic_by_ref_001.phpt \ + tests/php-5.2.5/Zend/tests/magic_by_ref_002.phpt \ + tests/php-5.2.5/Zend/tests/magic_by_ref_003.phpt \ + tests/php-5.2.5/Zend/tests/magic_by_ref_004.phpt \ + tests/php-5.2.5/Zend/tests/magic_by_ref_005.phpt \ + tests/php-5.2.5/Zend/tests/magic_by_ref_006.phpt \ + tests/php-5.2.5/Zend/tests/magic_by_ref_007.phpt \ + tests/php-5.2.5/Zend/tests/mod_001.phpt \ + tests/php-5.2.5/Zend/tests/object_handlers.phpt \ + tests/php-5.2.5/Zend/tests/objects_010.phpt \ + tests/php-5.2.5/Zend/tests/objects_011.phpt \ + tests/php-5.2.5/Zend/tests/oct_overflow_32bit.phpt \ + tests/php-5.2.5/Zend/tests/offset_array.phpt \ + tests/php-5.2.5/Zend/tests/settype_array.phpt \ + tests/php-5.2.5/Zend/tests/settype_double.phpt \ + tests/php-5.2.5/Zend/tests/settype_int.phpt \ + tests/php-5.2.5/Zend/tests/settype_object.phpt \ + tests/php-5.2.5/Zend/tests/settype_resource.phpt \ + tests/php-5.2.5/Zend/tests/settype_string.phpt \ + tests/php-5.2.5/Zend/tests/strict_001.phpt \ + tests/php-5.2.5/Zend/tests/sub_001.phpt \ + tests/php-5.2.5/Zend/tests/unset_cv05.phpt \ + tests/php-5.2.5/Zend/tests/unset_cv06.phpt \ + tests/php-5.2.5/Zend/tests/unset_cv07.phpt \ + tests/php-5.2.5/Zend/tests/unset_cv09.phpt \ + tests/php-5.2.5/Zend/tests/unset_cv10.phpt \ + +FAILED += tests/php-5.2.5/tests/lang/bug22231.phpt # Bug 155049 +FAILED += tests/php-5.2.5/tests/lang/038.phpt # bug 155077 + + + +######## Unsupported Features + +# private overrides private, noted in doc/inconsistencies +FAILED += tests/php-5.2.5/tests/lang/036.phpt +# eval not supported +FAILED += \ + tests/php-5.2.5/tests/lang/013.phpt \ + tests/php-5.2.5/tests/lang/014.phpt \ + tests/php-5.2.5/tests/lang/018.phpt \ + tests/php-5.2.5/tests/lang/019.phpt \ + tests/php-5.2.5/tests/lang/bug21961.phpt \ + +FAILED += tests/php-5.2.5/tests/lang/bug24403.phpt # no preg_replace +FAILED += tests/php-5.2.5/tests/lang/bug24396.phpt # dynamic global +# get_declared_classes is much different in HPHP than PHP +FAILED += tests/php-5.2.5/tests/lang/bug19566.phpt +# lambda/create_function issues +FAILED += \ + tests/php-5.2.5/tests/lang/bug17115.phpt \ + tests/php-5.2.5/tests/lang/bug22690.phpt \ + + + +RUNS = $(patsubst %.phpt, %.run, \ + $(filter-out $(SKIPPED) $(FILTERED) $(FAILED), $(PHPT_FILES))) + +RUNS_FILTERED = $(patsubst %.phpt, %.run_filtered, $(FILTERED)) + +all: $(RUNS_FILTERED) $(RUNS) + +%.run: %.phpt + @echo $< + @php $< > php.out + @../src/hphp/hphp --input-dir=$(CURDIR) $< > hphp.out + @diff php.out hphp.out + +FILTER = egrep -v "Undefined variable" +%.run_filtered: %.phpt + @echo $< + @php $< | $(PHP) > php.out + @../src/hphp/hphp --input-dir=$(CURDIR) $< | $(PHP) > hphp.out + @diff php.out hphp.out + +%.debug: %.phpt + ../src/hphp/hphp $< --log=3 --keep-tempdir=1 + +clean: + rm -f php.out hphp.out *~ + +clobber: clean diff --git a/phpt/README b/phpt/README new file mode 100644 index 0000000000000..a349dac34a568 --- /dev/null +++ b/phpt/README @@ -0,0 +1,14 @@ +The directory php-5.2.5/ is obtained by +bzip2 -dc php-5.2.5.tar.bz2 | tar xvf - +find php-5.2.5/ | grep -v "/tests/" | xargs rm -f +cd php-5.2.5/; cleanlinks + +The first command unpack the php-5.2.5 source package. +The second command removes any files that do not have "/tests" in their +paths. The assumption is that all the test files (.phpt files and test +data files) must have "/tests/" in their paths. +The third step uses the program cleanlinks to remove dangling symbolic +links and empty directories. + +This leaves us perhaps with a little more than necessary for hphp testing +but we won't miss any. diff --git a/phpt/tests/php-5.2.5/Zend/tests/001.phpt b/phpt/tests/php-5.2.5/Zend/tests/001.phpt new file mode 100644 index 0000000000000..97e45c50230c4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/001.phpt @@ -0,0 +1,54 @@ +--TEST-- +func_num_args() tests +--FILE-- + +--EXPECTF-- +int(0) +int(1) + +Warning: Missing argument 1 for test2(), called in %s on line %d +int(0) +int(2) +int(0) + +Warning: Missing argument 2 for test3() in %s on line %d +int(1) +int(2) +int(1) + +Warning: func_num_args(): Called from the global scope - no function context in %s on line %d +int(-1) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/002.phpt b/phpt/tests/php-5.2.5/Zend/tests/002.phpt new file mode 100644 index 0000000000000..ab4ae904a4ac6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/002.phpt @@ -0,0 +1,108 @@ +--TEST-- +func_get_arg() tests +--FILE-- + +--EXPECTF-- +Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d +bool(false) + +Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d +bool(false) + +Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d +bool(false) + +Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d +bool(false) +int(10) + +Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d +bool(false) +int(1) + +Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d +bool(false) + +Warning: Missing argument 1 for test2(), called in %s on line %d and defined in %s on line %d + +Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d +bool(false) + +Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d +bool(false) +int(1) +int(2) + +Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d +bool(false) + +Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d +bool(false) + +Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d +bool(false) + +Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d +bool(false) + +Warning: Missing argument 2 for test3() in %s on line %d +int(1) + +Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d +bool(false) + +Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d +bool(false) +int(1) +int(2) + +Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d +bool(false) +int(1) + +Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d +bool(false) + +Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/003.phpt b/phpt/tests/php-5.2.5/Zend/tests/003.phpt new file mode 100644 index 0000000000000..5e5e1e9cd8cf0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/003.phpt @@ -0,0 +1,81 @@ +--TEST-- +func_get_args() tests +--FILE-- + +--EXPECTF-- +array(0) { +} +array(1) { + [0]=> + int(10) +} +array(1) { + [0]=> + int(1) +} + +Warning: Missing argument 1 for test2(), called in %s on line %d and defined in %s on line %d +array(0) { +} +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(0) { +} + +Warning: Missing argument 2 for test3() in %s on line %d +array(1) { + [0]=> + int(1) +} +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(1) { + [0]=> + int(1) +} + +Warning: func_get_args(): Called from the global scope - no function context in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/004.phpt b/phpt/tests/php-5.2.5/Zend/tests/004.phpt new file mode 100644 index 0000000000000..145e0041f5937 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/004.phpt @@ -0,0 +1,25 @@ +--TEST-- +strncmp() tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for strncmp() in %s on line %d +NULL +int(0) + +Warning: Length must be greater than or equal to 0 in %s on line %d +bool(false) +int(0) +int(0) +int(-1) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/005.phpt b/phpt/tests/php-5.2.5/Zend/tests/005.phpt new file mode 100644 index 0000000000000..cbe66bb8611a2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/005.phpt @@ -0,0 +1,27 @@ +--TEST-- +strcasecmp() tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for strcasecmp() in %s on line %d +NULL +int(0) +int(-3) +int(-1) +int(0) +int(0) +int(0) +int(0) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/006.phpt b/phpt/tests/php-5.2.5/Zend/tests/006.phpt new file mode 100644 index 0000000000000..15a8b8be56a2d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/006.phpt @@ -0,0 +1,31 @@ +--TEST-- +strncasecmp() tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for strncasecmp() in %s on line %d +NULL + +Warning: Length must be greater than or equal to 0 in %s on line %d +bool(false) +int(0) +int(-3) +int(0) +int(0) +int(2) +int(0) +int(0) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/007.phpt b/phpt/tests/php-5.2.5/Zend/tests/007.phpt new file mode 100644 index 0000000000000..10b36e7a9757a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/007.phpt @@ -0,0 +1,63 @@ +--TEST-- +each() tests +--FILE-- +1,"b"=>2,"c"=>3); +var_dump(each($var)); + +$a = array(1); +$a [] =&$a[0]; + +var_dump(each($a)); + + +echo "Done\n"; +?> +--EXPECTF-- +Warning: Wrong parameter count for each() in %s on line %d +NULL + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL + +Warning: Variable passed to each() is not an array or object in %s on line %d +NULL +array(4) { + [1]=> + int(1) + ["value"]=> + int(1) + [0]=> + int(0) + ["key"]=> + int(0) +} +array(4) { + [1]=> + int(1) + ["value"]=> + int(1) + [0]=> + string(1) "a" + ["key"]=> + string(1) "a" +} +array(4) { + [1]=> + int(1) + ["value"]=> + int(1) + [0]=> + int(0) + ["key"]=> + int(0) +} +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/008.phpt b/phpt/tests/php-5.2.5/Zend/tests/008.phpt new file mode 100644 index 0000000000000..479c23db45944 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/008.phpt @@ -0,0 +1,53 @@ +--TEST-- +define() tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for define() in %s on line %d +NULL + +Warning: Wrong parameter count for define() in %s on line %d +NULL +bool(true) + +Notice: Constant true already defined in %s on line %d +bool(false) + +Notice: Array to string conversion in %s on line %d +bool(true) +bool(true) +bool(true) +bool(true) + +Notice: Constant test const already defined in %s on line %d +bool(false) + +Warning: Constants may only evaluate to scalar values in %s on line %d +bool(false) + +Warning: Constants may only evaluate to scalar values in %s on line %d +bool(false) +int(1) +int(2) +int(3) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/009.phpt b/phpt/tests/php-5.2.5/Zend/tests/009.phpt new file mode 100644 index 0000000000000..d98760ee15071 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/009.phpt @@ -0,0 +1,46 @@ +--TEST-- +get_class() tests +--FILE-- +bar(); +$f2->bar(); + +///var_dump(get_class()); +var_dump(get_class("qwerty")); + +var_dump(get_class($f1)); +var_dump(get_class($f2)); + +echo "Done\n"; +?> +--EXPECTF-- +Strict Standards: Non-static method foo::bar() should not be called statically in %s on line %d +string(3) "foo" + +Strict Standards: Non-static method foo::bar() should not be called statically in %s on line %d +string(3) "foo" +string(3) "foo" +string(3) "foo" + +Warning: get_class() called without object from outside a class in %s on line %d +bool(false) +bool(false) +string(3) "foo" +string(4) "foo2" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/010.phpt b/phpt/tests/php-5.2.5/Zend/tests/010.phpt new file mode 100644 index 0000000000000..45e1832914612 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/010.phpt @@ -0,0 +1,59 @@ +--TEST-- +get_parent_class() tests +--FILE-- +test(); +$bar->test(); +$bar->test_bar(); + +var_dump(get_parent_class($bar)); +var_dump(get_parent_class($foo)); +var_dump(get_parent_class("bar")); +var_dump(get_parent_class("foo")); +var_dump(get_parent_class("i")); + +var_dump(get_parent_class("")); +var_dump(get_parent_class("[[[[")); +var_dump(get_parent_class(" ")); +var_dump(get_parent_class(new stdclass)); +var_dump(get_parent_class(array())); +var_dump(get_parent_class(1)); + +echo "Done\n"; +?> +--EXPECTF-- +bool(false) +bool(false) +string(3) "foo" +string(3) "foo" +bool(false) +string(3) "foo" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/011.phpt b/phpt/tests/php-5.2.5/Zend/tests/011.phpt new file mode 100644 index 0000000000000..49018e440d844 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/011.phpt @@ -0,0 +1,89 @@ +--TEST-- +property_exists() tests +--FILE-- +bar(); + +$bar = new bar; +$bar->test(); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: Wrong parameter count for property_exists() in %s on line %d +NULL + +Warning: Wrong parameter count for property_exists() in %s on line %d +NULL +bool(true) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(false) +bool(false) +bool(false) +bool(false) + +Warning: First parameter must either be an object or the name of an existing class in %s on line %d +NULL + +Warning: First parameter must either be an object or the name of an existing class in %s on line %d +NULL + +Warning: First parameter must either be an object or the name of an existing class in %s on line %d +NULL +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +bool(true) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/012.phpt b/phpt/tests/php-5.2.5/Zend/tests/012.phpt new file mode 100644 index 0000000000000..c992adb5d2e45 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/012.phpt @@ -0,0 +1,34 @@ +--TEST-- +class_exists() tests +--FILE-- + +--EXPECTF-- +Warning: class_exists() expects at least 1 parameter, 0 given in %s on line %d +NULL +bool(false) +bool(false) + +Warning: class_exists() expects parameter 1 to be string, array given in %s on line %d +NULL +bool(false) +bool(true) +bool(true) +bool(true) +bool(true) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/013.phpt b/phpt/tests/php-5.2.5/Zend/tests/013.phpt new file mode 100644 index 0000000000000..5942ef28e6499 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/013.phpt @@ -0,0 +1,34 @@ +--TEST-- +interface_exists() tests +--FILE-- + +--EXPECTF-- +Warning: interface_exists() expects at least 1 parameter, 0 given in %s on line %d +NULL +bool(false) +bool(false) + +Warning: interface_exists() expects parameter 1 to be string, array given in %s on line %d +NULL +bool(false) +bool(true) +bool(true) +bool(false) +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/014.inc b/phpt/tests/php-5.2.5/Zend/tests/014.inc new file mode 100644 index 0000000000000..69c9bc0790257 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/014.inc @@ -0,0 +1,3 @@ + diff --git a/phpt/tests/php-5.2.5/Zend/tests/014.phpt b/phpt/tests/php-5.2.5/Zend/tests/014.phpt new file mode 100644 index 0000000000000..a7e59839de1bc --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/014.phpt @@ -0,0 +1,52 @@ +--TEST-- +get_included_files() tests +--FILE-- + +--EXPECTF-- +array(1) { + [0]=> + string(%d) "%s" +} +array(2) { + [0]=> + string(%d) "%s" + [1]=> + string(%d) "%s" +} + +Warning: Wrong parameter count for get_included_files() in %s on line %d +NULL +array(2) { + [0]=> + string(%d) "%s" + [1]=> + string(%d) "%s" +} + +Warning: Wrong parameter count for get_included_files() in %s on line %d +NULL +array(2) { + [0]=> + string(%d) "%s" + [1]=> + string(%d) "%s" +} +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/015.phpt b/phpt/tests/php-5.2.5/Zend/tests/015.phpt new file mode 100644 index 0000000000000..bea73763c02e0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/015.phpt @@ -0,0 +1,35 @@ +--TEST-- +trigger_error() tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for trigger_error() in %s on line %d +NULL + +Notice: error in %s on line %d +bool(true) + +Notice: Array to string conversion in %s on line %d + +Notice: Array in %s on line %d +bool(true) + +Warning: Invalid error type specified in %s on line %d +bool(false) + +Warning: Invalid error type specified in %s on line %d +bool(false) + +Warning: error in %s on line %d +bool(true) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/016.phpt b/phpt/tests/php-5.2.5/Zend/tests/016.phpt new file mode 100644 index 0000000000000..7160bf61fcdb6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/016.phpt @@ -0,0 +1,12 @@ +--TEST-- +isset() with object properties when operating on non-object +--FILE-- +bar->bar); + +echo "Done\n"; +?> +--EXPECT-- +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/017.phpt b/phpt/tests/php-5.2.5/Zend/tests/017.phpt new file mode 100644 index 0000000000000..6c9da71b65f5a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/017.phpt @@ -0,0 +1,86 @@ +--TEST-- +builtin functions tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for get_resource_type() in %s on line %d +NULL + +Warning: Supplied argument is not a valid resource handle in %s on line %d +bool(false) +string(6) "stream" +string(7) "Unknown" +string(5) "array" +int(%d) +string(5) "array" +int(%d) + +Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in %s on line %d +NULL + +Warning: Wrong parameter count for get_defined_constants() in %s on line %d +NULL +string(5) "array" +string(5) "array" +int(%d) + +Warning: Wrong parameter count for get_defined_functions() in %s on line %d +NULL +string(5) "array" +int(%d) + +Warning: Wrong parameter count for get_declared_interfaces() in %s on line %d +NULL +string(5) "array" +int(%d) + +Warning: Wrong parameter count for get_extension_funcs() in %s on line %d +NULL +bool(false) +string(5) "array" +int(%d) +string(5) "array" +int(%d) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/018.phpt b/phpt/tests/php-5.2.5/Zend/tests/018.phpt new file mode 100644 index 0000000000000..ea875c678a52f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/018.phpt @@ -0,0 +1,36 @@ +--TEST-- +constant() tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for constant() in %s on line %d +NULL + +Warning: Wrong parameter count for constant() in %s on line %d +NULL + +Warning: constant(): Couldn't find constant in %s on line %d +NULL + +Notice: Array to string conversion in %s on line %d + +Warning: constant(): Couldn't find constant Array in %s on line %d +NULL +int(1) +string(4) "test" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/019.phpt b/phpt/tests/php-5.2.5/Zend/tests/019.phpt new file mode 100644 index 0000000000000..2e9b6465b08d8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/019.phpt @@ -0,0 +1,1332 @@ +--TEST-- +Test unset(), empty() and isset() functions +--FILE-- + "One", 2 => "two"), + array("Name" => "Jack", "Age" => "30"), + array(1,2, "One" => "1", 2 => "two", ""=>"empty", "" => '') +); + +$outer_loop_counter = 1; +foreach ($array_variables as $array_var) { + echo "--- Outerloop Iteration $outer_loop_counter ---\n"; + + // check the isset and unset on non existing key + $var = 1; // a var which is defined + // try to unset the element which is non-existent + unset($array_var['non_existent']); + // check using isset() & empty() on a non_existent element in the array + var_dump( isset($array_var['non_existent']) ); + var_dump( isset($array_var['non_existent'], $var) ); + var_dump( isset($array_var['non_existent'], $array_var['none']) ); + var_dump( empty($array_var['non_existent']) ); + + // testing empty and isset on arrays + var_dump( empty($array_var) ); // expecting bool(false), except: array(), which is considered empty + var_dump( isset($array_var) ); // expecting bool(true), except: array(), which is not set + + // get the keys of the $array_var + $keys = array_keys($array_var); + // unset each element in the array and see the working of unset, isset & empty + $inner_loop_counter = 1; + foreach ($keys as $key_value) { + echo "-- Innerloop Iteration $inner_loop_counter of Outerloop Iteration $outer_loop_counter --\n"; + $inner_loop_counter++; + + // unset the element + unset($array_var[$key_value]); + // dump the array after element was unset + var_dump($array_var); + // check using isset for the element that was unset + var_dump( isset($array_var[$key_val]) ); // expected: bool(false) + // calling isset with more args + var_dump( isset($array_var[$key_val], $array_var) ); //expected: bool(false) + + // calling empty, expected bool(true) + var_dump( empty($array_var[$key_val]) ); + + // dump the array to see that that array did not get modified + // because of using isset, empty and unset on its element + var_dump($array_var); + } + + $outer_loop_counter++; + + // unset the whole array + unset($array_var); + // dump the array to see its unset + var_dump($array_var); + // use isset to see that array is not set + var_dump( isset($array_var) ); //expected: bool(false) + var_dump( isset($array_var, $array_var[$key_val]) ); // expected: bool(false) + + // empty() to see if the array is empty + var_dump( empty($array_var) ); // expected: bool(true) +} + +echo "\n*** Testing unset(), emtpy() & isset() with resource variables ***\n"; +$fp = fopen(__FILE__, "r"); +$dfp = opendir( dirname(__FILE__) ); +$resources = array ( + $fp, + $dfp +); +$loop_counter = 1; +foreach ($resources as $resource) { + $temp_var = 10; + echo "-- Iteration $loop_counter --\n"; $loop_counter++; + //dump the resource first + var_dump($resource); + + // check using isset() and empty() + var_dump( isset($resource) ); // expected: bool(true) + var_dump( empty($resource) ); // expected: bool(false) + // call isset() with two args, both set + var_dump( isset($resource, $temp_var) ); // expected: bool(true) + + // dump the resource to see using isset() and empty () had no effect on it + var_dump($resource); + + // unset the resource + unset($resource); + // check using isset() and empty() + var_dump( isset($resource) ); // expected: bool(flase) + var_dump( empty($resource) ); // expected: bool(true) + // call isset() with two args, but one set + var_dump( isset($resource, $temp_var) ); // expected: bool(false) + // uset the temp_var + unset($temp_var); + // now the isset() with both the args as unset + var_dump( isset($resource, $temp_var) ); // expected: bool(false); + + // dump the resource to see if there any effect on it + var_dump($resource); +} +// unset and dump the array containing all the resources to see that +// unset works correctly +unset($resources); +var_dump($resources); +var_dump( isset($resources) ); //expected: bool(false) +var_dump( empty($resources) ); // expected: bool(true) + +echo "\n*** Testing unset(), empty() & isset() with objects ***\n"; +class Point +{ + var $x; + var $y; + var $lable; + + function Point($x, $y) { + $this->x = $x; + $this->y = $y; + } + + function setLable($lable) { + $this->lable = $lable; + } + function testPoint() { + echo "\nPoint::testPoint() called\n"; + } +} +$point1 = new Point(30,40); + +// use unset/empty/isset to check the object +var_dump($point1); // dump the object + +// check the object and member that is not set +var_dump( isset($point1) ); // expected: bool(true) +var_dump( empty($point1) ); // expected: bool(false) +var_dump( isset($point1->$lable) ); //expected: bool(flase) +var_dump( empty($point1->$lable) ); //expected: bool(true) + +//set the member variable lable and check +$point1->setLable("Point1"); +var_dump( isset($point1->$lable) ); //expected: bool(true) +var_dump( empty($point1->$lable) ); //expected: bool(false) + +// dump the object to see that obj was not harmed +// because of the usage of the isset & empty +var_dump($point1); + +//unset a member and check +unset($point1->x); +// dump the point to see that variable was unset +var_dump($point1); +var_dump( isset($point1->x) ); // expected: bool(false) +var_dump( empty($point1->x) ); // expected: bool(true) + +// unset all members and check +unset($point1->y); +unset($point1->lable); +// dump the objec to check that all variables are unset +var_dump($point1); +var_dump( isset($point1) ); // expected: bool(ture) +var_dump( empty($point1) ); // expected: bool(false) + +//unset the object and check +unset($point1); +var_dump( isset($point1) ); // expected: bool(false) +var_dump( empty($point1) ); // expected: bool(true) +// dump to see that object is unset +var_dump($point1); + +// try isset/unset/empty on a member function +$point2 = new Point(5,6); +var_dump( isset($point2->testPoint) ); +var_dump( empty($point2->testPoint) ); +unset($point2->testPoint); +var_dump( isset($point2->testPoint) ); +var_dump( empty($point2->testPoint) ); + +// use get_class_methods to see effect if any +var_dump( get_class_methods($point2) ); +// dump the object to see the effect, none expected +var_dump($point2); + +/* testing variation in operation for isset(), empty() & unset(). +Note: Most of the variation for function unset() is testing by a + set of testcases named "Zend/tests/unset_cv??.phpt", only + variation not tested are attempted here */ + +echo "\n*** Testing possible variation in operation for isset(), empty() & unset() ***\n"; +/* unset() variation1: checking unset on static variable inside a function. + * unset() destroys the variable only in the context of the rest of a function + * Following calls will restore the previous value of a variable. + */ +echo "\n** Testing unset() variation 1: unset on static variable inside a function **\n"; +function test_unset1() { + static $static_var; + + // increment the value of the static. this change is in function context + $static_var ++; + + echo "value of static_var before unset: $static_var\n"; + // check using isset and empty + var_dump( isset($static_var) ); + var_dump( empty($static_var) ); + + // unset the static var + unset($static_var); + echo "value of static_var after unset: $static_var\n"; + // check using isset and empty + var_dump( isset($static_var) ); + var_dump( empty($static_var) ); + + // assign a value to static var + $static_var = 20; + echo "value of static_var after new assignment: $static_var\n"; +} +// call the functiont +test_unset1(); +test_unset1(); +test_unset1(); + + +echo "\n** Testing unset() variation 2: unset on a variable passed by ref. inside of a function **\n"; +/* unset() variation2: Pass by reference + * If a variable that is PASSED BY REFERENCE is unset() inside of a function, + * only the local variable is destroyed. The variable in the calling environment + * will retain the same value as before unset() was called. + */ +function test_unset2( &$ref_val ) { + // unset the variable passed + unset($ref_val); + // check using isset and empty to confirm + var_dump( isset($ref_val) ); + var_dump( empty($ref_val) ); + + // set the value ot a new one + $ref_val = "new value by ref"; +} + +$value = "value"; +var_dump($value); +test_unset2($value); +var_dump($value); + + +echo "\n** Testing unset() variation 3: unset on a global variable inside of a function **\n"; +/* unset() variation2: unset on a global variable inside a function + * If a globalized variable is unset() inside of a function, only the + * local variable is destroyed. The variable in the calling environment + * will retain the same value as before unset() was called. + */ +$global_var = 10; + +function test_unset3() { + global $global_var; + + // check the $global_var using isset and empty + var_dump( isset($global_var) ); + var_dump( empty($global_var) ); + + // unset the global var + unset($global_var); + + // check the $global_var using isset and empty + var_dump( isset($global_var) ); + var_dump( empty($global_var) ); +} + +var_dump($global_var); +test_unset3(); +var_dump($global_var); + +//Note: No error conditions relating to passing arugments can be tested +// because these are not functions but statements, it will result in syntax error. +echo "Done\n"; +///--EXPECTF-- +///*** Testing unset(), empty() & isset() with scalar variables *** +///-- Iteration 1 -- +///bool(true) +///bool(true) +///bool(true) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 2 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 3 -- +///bool(true) +///bool(true) +///bool(true) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 4 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 5 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 6 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 7 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 8 -- +///bool(true) +///bool(true) +///bool(true) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 9 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 10 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 11 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 12 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 13 -- +///bool(true) +///bool(true) +///bool(true) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 14 -- +///bool(true) +///bool(true) +///bool(true) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 15 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 16 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 17 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 18 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 19 -- +///bool(true) +///bool(true) +///bool(true) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 20 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 21 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 22 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 23 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 24 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 25 -- +///bool(true) +///bool(true) +///bool(true) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 26 -- +///bool(true) +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +///-- Iteration 27 -- +///bool(true) +///bool(true) +///bool(true) +/// +///Notice: Undefined variable: scalar_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +/// +///*** Testing unset(), empty() & isset() with arrays *** +///--- Outerloop Iteration 1 --- +///bool(false) +///bool(false) +///bool(false) +///bool(true) +///bool(true) +///bool(true) +/// +///Notice: Undefined variable: array_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///--- Outerloop Iteration 2 --- +///bool(false) +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(true) +///-- Innerloop Iteration 1 of Outerloop Iteration 2 -- +///array(0) { +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(0) { +///} +/// +///Notice: Undefined variable: array_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///--- Outerloop Iteration 3 --- +///bool(false) +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(true) +///-- Innerloop Iteration 1 of Outerloop Iteration 3 -- +///array(0) { +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(0) { +///} +/// +///Notice: Undefined variable: array_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///--- Outerloop Iteration 4 --- +///bool(false) +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(true) +///-- Innerloop Iteration 1 of Outerloop Iteration 4 -- +///array(0) { +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(0) { +///} +/// +///Notice: Undefined variable: array_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///--- Outerloop Iteration 5 --- +///bool(false) +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(true) +///-- Innerloop Iteration 1 of Outerloop Iteration 5 -- +///array(0) { +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(0) { +///} +/// +///Notice: Undefined variable: array_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///--- Outerloop Iteration 6 --- +///bool(false) +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(true) +///-- Innerloop Iteration 1 of Outerloop Iteration 6 -- +///array(3) { +/// [1]=> +/// int(2) +/// [2]=> +/// int(3) +/// [3]=> +/// int(4) +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(3) { +/// [1]=> +/// int(2) +/// [2]=> +/// int(3) +/// [3]=> +/// int(4) +///} +///-- Innerloop Iteration 2 of Outerloop Iteration 6 -- +///array(2) { +/// [2]=> +/// int(3) +/// [3]=> +/// int(4) +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(2) { +/// [2]=> +/// int(3) +/// [3]=> +/// int(4) +///} +///-- Innerloop Iteration 3 of Outerloop Iteration 6 -- +///array(1) { +/// [3]=> +/// int(4) +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(1) { +/// [3]=> +/// int(4) +///} +///-- Innerloop Iteration 4 of Outerloop Iteration 6 -- +///array(0) { +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(0) { +///} +/// +///Notice: Undefined variable: array_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///--- Outerloop Iteration 7 --- +///bool(false) +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(true) +///-- Innerloop Iteration 1 of Outerloop Iteration 7 -- +///array(2) { +/// [1]=> +/// float(2.5) +/// [2]=> +/// float(5.6) +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(2) { +/// [1]=> +/// float(2.5) +/// [2]=> +/// float(5.6) +///} +///-- Innerloop Iteration 2 of Outerloop Iteration 7 -- +///array(1) { +/// [2]=> +/// float(5.6) +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(1) { +/// [2]=> +/// float(5.6) +///} +///-- Innerloop Iteration 3 of Outerloop Iteration 7 -- +///array(0) { +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(0) { +///} +/// +///Notice: Undefined variable: array_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///--- Outerloop Iteration 8 --- +///bool(false) +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(true) +///-- Innerloop Iteration 1 of Outerloop Iteration 8 -- +///array(1) { +/// [2]=> +/// string(3) "two" +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(1) { +/// [2]=> +/// string(3) "two" +///} +///-- Innerloop Iteration 2 of Outerloop Iteration 8 -- +///array(0) { +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(0) { +///} +/// +///Notice: Undefined variable: array_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///--- Outerloop Iteration 9 --- +///bool(false) +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(true) +///-- Innerloop Iteration 1 of Outerloop Iteration 9 -- +///array(1) { +/// ["Age"]=> +/// string(2) "30" +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(1) { +/// ["Age"]=> +/// string(2) "30" +///} +///-- Innerloop Iteration 2 of Outerloop Iteration 9 -- +///array(0) { +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(0) { +///} +/// +///Notice: Undefined variable: array_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +///--- Outerloop Iteration 10 --- +///bool(false) +///bool(false) +///bool(false) +///bool(true) +///bool(false) +///bool(true) +///-- Innerloop Iteration 1 of Outerloop Iteration 10 -- +///array(4) { +/// [1]=> +/// int(2) +/// ["One"]=> +/// string(1) "1" +/// [2]=> +/// string(3) "two" +/// [""]=> +/// string(0) "" +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(4) { +/// [1]=> +/// int(2) +/// ["One"]=> +/// string(1) "1" +/// [2]=> +/// string(3) "two" +/// [""]=> +/// string(0) "" +///} +///-- Innerloop Iteration 2 of Outerloop Iteration 10 -- +///array(3) { +/// ["One"]=> +/// string(1) "1" +/// [2]=> +/// string(3) "two" +/// [""]=> +/// string(0) "" +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(3) { +/// ["One"]=> +/// string(1) "1" +/// [2]=> +/// string(3) "two" +/// [""]=> +/// string(0) "" +///} +///-- Innerloop Iteration 3 of Outerloop Iteration 10 -- +///array(2) { +/// [2]=> +/// string(3) "two" +/// [""]=> +/// string(0) "" +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(2) { +/// [2]=> +/// string(3) "two" +/// [""]=> +/// string(0) "" +///} +///-- Innerloop Iteration 4 of Outerloop Iteration 10 -- +///array(1) { +/// [""]=> +/// string(0) "" +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(1) { +/// [""]=> +/// string(0) "" +///} +///-- Innerloop Iteration 5 of Outerloop Iteration 10 -- +///array(0) { +///} +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: key_val in %s on line %d +///bool(true) +///array(0) { +///} +/// +///Notice: Undefined variable: array_var in %s on line %d +///NULL +///bool(false) +///bool(false) +///bool(true) +/// +///*** Testing unset(), emtpy() & isset() with resource variables *** +///-- Iteration 1 -- +///resource(5) of type (stream) +///bool(true) +///bool(false) +///bool(true) +///resource(5) of type (stream) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +/// +///Notice: Undefined variable: resource in %s on line %d +///NULL +///-- Iteration 2 -- +///resource(6) of type (stream) +///bool(true) +///bool(false) +///bool(true) +///resource(6) of type (stream) +///bool(false) +///bool(true) +///bool(false) +///bool(false) +/// +///Notice: Undefined variable: resource in %s on line %d +///NULL +/// +///Notice: Undefined variable: resources in %s on line %d +///NULL +///bool(false) +///bool(true) +/// +///*** Testing unset(), empty() & isset() with objects *** +///object(Point)#1 (3) { +/// ["x"]=> +/// int(30) +/// ["y"]=> +/// int(40) +/// ["lable"]=> +/// NULL +///} +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: lable in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: lable in %s on line %d +///bool(true) +/// +///Notice: Undefined variable: lable in %s on line %d +///bool(false) +/// +///Notice: Undefined variable: lable in %s on line %d +///bool(true) +///object(Point)#1 (3) { +/// ["x"]=> +/// int(30) +/// ["y"]=> +/// int(40) +/// ["lable"]=> +/// string(6) "Point1" +///} +///object(Point)#1 (2) { +/// ["y"]=> +/// int(40) +/// ["lable"]=> +/// string(6) "Point1" +///} +///bool(false) +///bool(true) +///object(Point)#1 (0) { +///} +///bool(true) +///bool(false) +///bool(false) +///bool(true) +/// +///Notice: Undefined variable: point1 in %s on line %d +///NULL +///bool(false) +///bool(true) +///bool(false) +///bool(true) +///array(3) { +/// [0]=> +/// string(5) "Point" +/// [1]=> +/// string(8) "setLable" +/// [2]=> +/// string(9) "testPoint" +///} +///object(Point)#1 (3) { +/// ["x"]=> +/// int(5) +/// ["y"]=> +/// int(6) +/// ["lable"]=> +/// NULL +///} +/// +///*** Testing possible variation in operation for isset(), empty() & unset() *** +/// +///** Testing unset() variation 1: unset on static variable inside a function ** +///value of static_var before unset: 1 +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: static_var in %s on line %d +///value of static_var after unset: +///bool(false) +///bool(true) +///value of static_var after new assignment: 20 +///value of static_var before unset: 2 +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: static_var in %s on line %d +///value of static_var after unset: +///bool(false) +///bool(true) +///value of static_var after new assignment: 20 +///value of static_var before unset: 3 +///bool(true) +///bool(false) +/// +///Notice: Undefined variable: static_var in %s on line %d +///value of static_var after unset: +///bool(false) +///bool(true) +///value of static_var after new assignment: 20 +/// +///** Testing unset() variation 2: unset on a variable passed by ref. inside of a function ** +///string(5) "value" +///bool(false) +///bool(true) +///string(5) "value" +/// +///** Testing unset() variation 3: unset on a global variable inside of a function ** +///int(10) +///bool(true) +///bool(false) +///bool(false) +///bool(true) +///int(10) +///Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/020.phpt b/phpt/tests/php-5.2.5/Zend/tests/020.phpt new file mode 100644 index 0000000000000..fa49a93279696 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/020.phpt @@ -0,0 +1,31 @@ +--TEST-- +func_get_arg() invalid usage +--FILE-- + +--EXPECTF-- +bool(false) + +Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d +bool(false) +bool(false) + +Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/abstract-static.phpt b/phpt/tests/php-5.2.5/Zend/tests/abstract-static.phpt new file mode 100644 index 0000000000000..c4ab8f2483c7a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/abstract-static.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test for abstract static classes +--FILE-- + +===DONE=== +--EXPECTF-- + +Strict Standards: Static function TestClass::getName() should not be abstract in %sabstract-static.php on line %d +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/add_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/add_001.phpt new file mode 100644 index 0000000000000..8d12aea11d25b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/add_001.phpt @@ -0,0 +1,73 @@ +--TEST-- +adding arrays +--FILE-- +"aaa",2,3); +$b = array(1,2,"a"=>"bbbbbb"); + +$c = $a + $b; +var_dump($c); + +$a += $b; +var_dump($c); + +$a += $a; +var_dump($c); + +echo "Done\n"; +?> +--EXPECTF-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + ["a"]=> + string(3) "aaa" + [0]=> + int(2) + [1]=> + int(3) +} +array(3) { + ["a"]=> + string(3) "aaa" + [0]=> + int(2) + [1]=> + int(3) +} +array(3) { + ["a"]=> + string(3) "aaa" + [0]=> + int(2) + [1]=> + int(3) +} +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/add_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/add_002.phpt new file mode 100644 index 0000000000000..31c659d0a22f9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/add_002.phpt @@ -0,0 +1,19 @@ +--TEST-- +adding objects to arrays +--FILE-- +prop = "value"; + +///$c = $a + $o; +var_dump($c); + +echo "Done\n"; +?> +--EXPECTF-- +Notice: Object of class stdClass could not be converted to int in %s on line %d + +Fatal error: Unsupported operand types in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/add_003.phpt b/phpt/tests/php-5.2.5/Zend/tests/add_003.phpt new file mode 100644 index 0000000000000..3414ff7968faf --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/add_003.phpt @@ -0,0 +1,19 @@ +--TEST-- +adding arrays to objects +--FILE-- +prop = "value"; + +///$c = $o + $a; +var_dump($c); + +echo "Done\n"; +?> +--EXPECTF-- +Notice: Object of class stdClass could not be converted to int in %s on line %d + +Fatal error: Unsupported operand types in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/add_004.phpt b/phpt/tests/php-5.2.5/Zend/tests/add_004.phpt new file mode 100644 index 0000000000000..4a4abf444863f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/add_004.phpt @@ -0,0 +1,14 @@ +--TEST-- +adding numbers to arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/add_005.phpt b/phpt/tests/php-5.2.5/Zend/tests/add_005.phpt new file mode 100644 index 0000000000000..7e9bc25d8f31b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/add_005.phpt @@ -0,0 +1,22 @@ +--TEST-- +adding integers to doubles +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +float(2834756759.1231) +float(2834756759.1231) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/add_006.phpt b/phpt/tests/php-5.2.5/Zend/tests/add_006.phpt new file mode 100644 index 0000000000000..d56df2f329cd3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/add_006.phpt @@ -0,0 +1,49 @@ +--TEST-- +adding numbers to strings +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +int(75636) +int(951858) +int(48550510) +float(75661.68) +int(75636) +int(951858) +int(48550510) +float(75661.68) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/add_007.phpt b/phpt/tests/php-5.2.5/Zend/tests/add_007.phpt new file mode 100644 index 0000000000000..ebac00a69c624 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/add_007.phpt @@ -0,0 +1,16 @@ +--TEST-- +adding strings to arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/and_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/and_001.phpt new file mode 100644 index 0000000000000..109b2ce9952f7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/and_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +bitwise AND and strings +--FILE-- + +--EXPECTF-- +string(3) "020" +string(4) "pead" +string(4) "pead" +string(4) "pead" +string(4) "pead" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/array_append_COW.phpt b/phpt/tests/php-5.2.5/Zend/tests/array_append_COW.phpt new file mode 100644 index 0000000000000..0e3008589b8e5 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/array_append_COW.phpt @@ -0,0 +1,16 @@ +--TEST-- +Tests that array manipulation code is correctly dealing with copy on write and splitting on reference +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + int(1) +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/array_type_hint_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/array_type_hint_001.phpt new file mode 100755 index 0000000000000..533319b6eab5b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/array_type_hint_001.phpt @@ -0,0 +1,15 @@ +--TEST-- +Array type hint +--FILE-- + +--EXPECTF-- +3 + +Catchable fatal error: Argument 1 passed to foo() must be an array, integer given, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2 diff --git a/phpt/tests/php-5.2.5/Zend/tests/array_unshift_COW.phpt b/phpt/tests/php-5.2.5/Zend/tests/array_unshift_COW.phpt new file mode 100644 index 0000000000000..ecc42bb0f4ec4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/array_unshift_COW.phpt @@ -0,0 +1,16 @@ +--TEST-- +Tests that array unshift code is correctly dealing with copy on write and splitting on reference +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + int(1) +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug19859.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug19859.phpt new file mode 100644 index 0000000000000..6eb1701e7b00b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug19859.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #19859 (__call() does not catch call_user_func_array() calls) +--FILE-- +fake(1); +call_user_func_array(array($x,'fake'),array(1)); +call_user_func(array($x,'fake'),2); +?> +--EXPECT-- +test::__call invoked for method 'fake' +test::__call invoked for method 'fake' +test::__call invoked for method 'fake' diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug20240.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug20240.phpt new file mode 100755 index 0000000000000..a24bafe44f2f4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug20240.phpt @@ -0,0 +1,41 @@ +--TEST-- +Bug #20240 (order of destructor calls) +--FILE-- +member = 1; + register_shutdown_function(array($this, 'destructor')); + } + + function destructor() { + print __METHOD__ . "\n"; + } + + function __destruct() { + print __METHOD__ . "\n"; + } + + function add() { + $this->member += 1; + print $this->member."\n"; + } +} + +$t = new test(); + +$t->add(); +$t->add(); + +echo "Done\n"; +?> +--EXPECT-- +2 +3 +Done +test::destructor +test::__destruct diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug20242.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug20242.phpt new file mode 100755 index 0000000000000..b426c909d50f3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug20242.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #20242 (Method call in front of class definition) +--FILE-- +show_method(); + +class test { + static function show_static() { + echo "static\n"; + } + function show_method() { + echo "method\n"; + } +} +?> +--EXPECT-- +static +method diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug21478.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug21478.phpt new file mode 100755 index 0000000000000..8b38f24d6e7b9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug21478.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #21478 (Zend/zend_alloc.c :: shutdown_memory_manager produces segfault) +--SKIPIF-- + +--FILE-- +data = strtoupper($bucket->data); + stream_bucket_append($out, $bucket); + $consumed += strlen($bucket->data); + } + return PSFS_PASS_ON; + } +} + +stream_filter_register("myfilter","debugfilter"); + +$fp = fopen(dirname(__FILE__)."/test.txt","w"); +stream_filter_append($fp, "myfilter"); +stream_filter_append($fp, "myfilter"); +stream_filter_append($fp, "myfilter"); +fwrite($fp, "This is a test.\n"); +print "Done.\n"; +fclose($fp); +// Uncommenting the following 'print' line causes the segfault to stop occuring +// print "2\n"; +readfile(dirname(__FILE__)."/test.txt"); +unlink(dirname(__FILE__)."/test.txt"); +?> +--EXPECT-- +Done. +THIS IS A TEST. diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug21888.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug21888.phpt new file mode 100755 index 0000000000000..b32bd3560732d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug21888.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #21888 (protected property and protected method of the same name) +--FILE-- +prot(); + } + + public function viewMom() { + print $this->prot; + } + +} + +$c = new child(); +$c->callMom(); +$c->viewMom(); +?> +--EXPECT-- +protected method +protected property diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug22725.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug22725.phpt new file mode 100755 index 0000000000000..eb239ec797223 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug22725.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #22725 (A derived class can call a parent's protected method that calls a private method) +aPrivateMethod(); + } +} + +class Bar extends Foo { + public function aPublicMethod() { + echo "Bar::aPublicMethod() called.\n"; + $this->aProtectedMethod(); + } +} + +$o = new Bar; +$o->aPublicMethod(); +?> +--EXPECT-- +Bar::aPublicMethod() called. +Foo::aProtectedMethod() called. +Foo::aPrivateMethod() called. diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug22836.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug22836.phpt new file mode 100644 index 0000000000000..205fd1c696ffe --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug22836.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #22836 (returning references to NULL) +--FILE-- + +--EXPECTF-- +string(3) "foo" +'foo' +string(3) "foo" +'foo' +string(3) "foo" +'foo' +string(3) "foo" +'foo' +string(3) "foo" +'foo' +string(3) "foo" +'foo' +string(3) "foo" +'foo' +string(3) "foo" +'foo' diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug23104.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug23104.phpt new file mode 100644 index 0000000000000..04df3bdeb54dd --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug23104.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #23104 (Hash position not reset for constant arrays) +--FILE-- + +--EXPECT-- +string(1) "a" diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug24436.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug24436.phpt new file mode 100755 index 0000000000000..11b8702cdc80b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug24436.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #24436 (isset()/empty() produce errors with non-existent variables in classes) +--INI-- +error_reporting=2047 +--FILE-- +test[0][0])) { print "test1\n";} + if (!isset($this->test[0][0])) { print "test2\n";} + if (empty($this->test)) { print "test1\n";} + if (!isset($this->test)) { print "test2\n";} + } +} + +$test1 = new test(); +?> +--EXPECT-- +test1 +test2 +test1 +test2 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug24635.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug24635.phpt new file mode 100644 index 0000000000000..758a803a06bd7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug24635.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #24635 (crash on dtor calling other functions) +--FILE-- +page = new PageClass(); } +} +class PageClass { + function Display() { + $section = new SectionClass("PageClass::Display"); + } +} +class SectionClass { + function __construct($comment) { + $this->Comment = $comment; + } + function __destruct() { + out($this->Comment); // this line doesn't crash PHP + out("\n"); // this line + } +} +function out($code) { return; } +$site = new SiteClass(); +$site->page->Display(); +echo "OK\n"; +?> +--EXPECT-- +OK diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug24699.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug24699.phpt new file mode 100644 index 0000000000000..0958a6e673eb3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug24699.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #24699 (Memory Leak with per-class constants) +--FILE-- + +--EXPECT-- +1 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug24773.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug24773.phpt new file mode 100644 index 0000000000000..e723de4e6729a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug24773.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #24773 (unset() of integers treated as arrays causes a crash) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot unset string offsets in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug24884.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug24884.phpt new file mode 100755 index 0000000000000..3788479cb099f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug24884.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #24884 (calling $this->__clone(); crashes php) +--FILE-- +__copy(); +var_dump($test2); +?> +--EXPECTF-- +object(Test)#%d (0) { +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug26010.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug26010.phpt new file mode 100644 index 0000000000000..a3c41faefc61e --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug26010.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #26010 (private / protected variables get exposed by get_object_vars()) +--FILE-- + +--EXPECT-- +array(1) { + ["public"]=> + string(6) "public" +} + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug26077.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug26077.phpt new file mode 100755 index 0000000000000..ea2a80273363a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug26077.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #26077 (Memory leaks when creating an instance of an object) +--FILE-- + +===DONE=== +--EXPECT-- +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug26166.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug26166.phpt new file mode 100755 index 0000000000000..3986c22f3a9ed --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug26166.phpt @@ -0,0 +1,66 @@ +--TEST-- +Bug #26166 (__toString() crash when no values returned) +--FILE-- +obj = new Foo(); + } + + function __toString() + { + return $this->obj->__toString(); + } +} + +$o = new Bar; +echo $o; + +echo "===NONE===\n"; + +function my_error_handler($errno, $errstr, $errfile, $errline) { + var_dump($errstr); +} + +set_error_handler('my_error_handler'); + +class None +{ + function __toString() { + } +} + +$o = new None; +echo $o; + +echo "===THROW===\n"; + +class Error +{ + function __toString() { +/// throw new Exception("This is an error!"); + } +} + +$o = new Error; +try { + echo $o; +} +catch (Exception $e) { + echo "Got the exception\n"; +} + +?> diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug26229.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug26229.phpt new file mode 100755 index 0000000000000..f22aa2f416911 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug26229.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #26229 (getIterator() segfaults when it returns arrays or scalars) +--FILE-- + $value) + { + var_dump($value); + } +} +catch(Exception $e) +{ + echo $e->getMessage() . "\n"; +} +?> +===DONE=== +--EXPECTF-- +Objects returned by array_iterator::getIterator() must be traversable or implement interface Iterator +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug26281.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug26281.phpt new file mode 100755 index 0000000000000..e1888a88ddac4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug26281.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #26281 (switch() crash when condition is a string offset) +--FILE-- + +--EXPECT-- +no crash diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug26696.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug26696.phpt new file mode 100755 index 0000000000000..62ceacda58d38 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug26696.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #26696 (crash in switch() when string index is used) +--FILE-- + +===DONE=== +--EXPECT-- +a-s-d-d-/-?+ +===DONE=== \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug26697.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug26697.phpt new file mode 100755 index 0000000000000..8266a23e34e36 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug26697.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #26697 (calling class_exists on a nonexistent class in __autoload results in segfault) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +__autoload(NotExistingClass) +bool(false) +__autoload(NotExistingClass), done +bool(false) +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug26698.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug26698.phpt new file mode 100755 index 0000000000000..641a2149b7b0b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug26698.phpt @@ -0,0 +1,73 @@ +--TEST-- +Bug #26698 (Thrown exceptions while evaluting argument to pass as parameter crash PHP) +--FILE-- +three($res->getNone()); + } + catch(Exception $e) + { + echo 'Caught: '.$e->getMessage()."\n"; + } + } + + function callTwo() + { + try + { + $res = new Object(); + $this->three(1, $res->getNone()); + } + catch(Exception $e) + { + echo 'Caught: '.$e->getMessage()."\n"; + } + } + + function callThree() + { + try + { + $res = new Object(); + $this->three(1, 2, $res->getNone()); + } + catch(Exception $e) + { + echo 'Caught: '.$e->getMessage()."\n"; + } + } +} + +$p = new Proxy(); + +$p->callOne(); +$p->callTwo(); +$p->callThree(); +?> +===DONE=== +--EXPECT-- +Caught: NONE +Caught: NONE +Caught: NONE +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug26801.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug26801.phpt new file mode 100755 index 0000000000000..b8cc37aa1628f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug26801.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #26801 (switch ($a{0}) crash) +--FILE-- + +===DONE=== +--EXPECT-- +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug26802.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug26802.phpt new file mode 100755 index 0000000000000..ab0ad25aa5c0f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug26802.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #26802 (Can't call static method using a variable) +--FILE-- + +===DONE=== +--EXPECT-- +global_func +foo::foo_func +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug27268.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug27268.phpt new file mode 100755 index 0000000000000..3c34c90fc39ec --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug27268.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #27268 (Bad references accentuated by clone) +--FILE-- +a; + } +} + +$A = new A; +$A->a = array(1); +$x = $A->getA(); +$clone = clone $A; +$clone->a = array(); +print_r($A); +?> +--EXPECT-- +A Object +( + [a] => Array + ( + [0] => 1 + ) + +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug27304.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug27304.phpt new file mode 100755 index 0000000000000..0f248346cf8e1 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug27304.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #27304 (Static functions don't function properly) +--FILE-- +test(); + +?> +===DONE=== +--EXPECT-- +bool(false) +bool(false) +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug27598.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug27598.phpt new file mode 100755 index 0000000000000..6ec229b608b34 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug27598.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #27598 (list() array key assignment causes HUGE memory leak) +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + int(1) +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug27669.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug27669.phpt new file mode 100755 index 0000000000000..4d513e91aa24b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug27669.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dynamically) +--FILE-- + +===DONE=== +--EXPECTF-- +Hello World +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug27731.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug27731.phpt new file mode 100644 index 0000000000000..408e4242ad5eb --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug27731.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #27731 (error_reporing() call inside @ block does not work correctly) +--FILE-- + +--EXPECT-- +int(2) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug27798.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug27798.phpt new file mode 100755 index 0000000000000..9e54efa833169 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug27798.phpt @@ -0,0 +1,72 @@ +--TEST-- +Bug #27798 (private / protected variables not exposed by get_object_vars() inside class) +--FILE-- + +===DONE=== +--EXPECT-- +Base::__construct +array(3) { + ["Foo"]=> + int(1) + ["Bar"]=> + int(2) + ["Baz"]=> + int(3) +} +array(1) { + ["Foo"]=> + int(1) +} +Base::__construct +array(3) { + ["Foo"]=> + int(1) + ["Bar"]=> + int(2) + ["Baz"]=> + int(3) +} +Child::__construct +array(3) { + ["Baz"]=> + int(4) + ["Foo"]=> + int(1) + ["Bar"]=> + int(2) +} +array(1) { + ["Foo"]=> + int(1) +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug28072.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug28072.phpt new file mode 100755 index 0000000000000..7959a1c4da4dc --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug28072.phpt @@ -0,0 +1,46 @@ +--TEST-- +Bug #28072 (static array with some constant keys will be incorrectly ordered) +--FILE-- + "111", + "b" => "222", + THIRD_KEY => "333", + "d" => "444" + ); + print_r($arr); +} + +function test2() +{ + static $arr = array( + FIRST_KEY => "111", + "a" => "222", + "c" => "333", + THIRD_KEY => "444" + ); + print_r($arr); +} + +test(); +test2(); +?> +--EXPECT-- +Array +( + [a] => 111 + [b] => 222 + [c] => 333 + [d] => 444 +) +Array +( + [a] => 111 + [c] => 444 +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug28377.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug28377.phpt new file mode 100755 index 0000000000000..69c8b3dc36dc4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug28377.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #28377 (debug_backtrace is intermittently passing args) +--FILE-- + +--EXPECT-- +dereferenced -- args: 2 +direct -- args: 2 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug28442.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug28442.phpt new file mode 100755 index 0000000000000..1237357ccaf9c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug28442.phpt @@ -0,0 +1,65 @@ +--TEST-- +Bug #28442 (Changing a static variables in a class changes it across sub/super classes.) +--FILE-- + +===DONE=== +--EXPECTF-- +===INIT=== +string(1) "A" +string(1) "C" +string(1) "C" +===SetA=== +string(2) "A2" +string(1) "C" +string(1) "C" +===SetB=== +string(2) "A2" +string(2) "B2" +string(2) "B2" +===SetC=== +string(2) "A2" +string(2) "C2" +string(2) "C2" +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug28444.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug28444.phpt new file mode 100755 index 0000000000000..78c08d2fc643a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug28444.phpt @@ -0,0 +1,81 @@ +--TEST-- +Bug #28444 (Cannot access undefined property for object with overloaded property access) +--FILE-- +x = $x; + } +} + +class Overloaded +{ + public $props = array(); + public $x; + + function __construct($x) + { + $this->x = new Object($x); + } + + function __get($prop) + { + echo __METHOD__ . "($prop)\n"; + return $this->props[$prop]; + } + + function __set($prop, $val) + { + echo __METHOD__ . "($prop,$val)\n"; + $this->props[$prop] = $val; + } +} +$y = new Overloaded(2); +var_dump($y->x); +var_dump($y->x->x); +var_dump($y->x->x = 3); +var_dump($y->y = 3); +var_dump($y->y); +var_dump($y->z = new Object(4)); +var_dump($y->z->x); +$t = $y->z; +var_dump($t->x = 5); +var_dump($y->z->x = 6); + +?> +===DONE=== +--EXPECTF-- +object(Object)#%d (1) { + ["x"]=> + int(2) +} +int(2) +int(3) +Overloaded::__set(y,3) +int(3) +Overloaded::__get(y) +int(3) +string(55) "Object of class Object could not be converted to string" +Overloaded::__set(z,) +object(Object)#%d (1) { + ["x"]=> + int(4) +} +Overloaded::__get(z) +int(4) +Overloaded::__get(z) +int(5) +Overloaded::__get(z) +int(6) +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29015.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29015.phpt new file mode 100644 index 0000000000000..017380d641f50 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29015.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #29015 (Incorrect behavior of member vars(non string ones)-numeric mem vars und others) +--FILE-- +$x = "string('')"; +var_dump($a); +?> +--EXPECTF-- +Fatal error: Cannot access empty property in %sbug29015.php on line 4 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29104.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29104.phpt new file mode 100644 index 0000000000000..e1de58eff1258 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29104.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #29104 (Function declaration in method doesn't work) +--FILE-- +g(); +f(); +?> +--EXPECT-- +function g - begin +function g - end +function f diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29210.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29210.phpt new file mode 100644 index 0000000000000..d0de54312327d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29210.phpt @@ -0,0 +1,104 @@ +--TEST-- +Bug #29210 (Function is_callable does not support private and protected methods) +--FILE-- +test_func1(); + } else { + echo "test_func1 isn't callable from inside\n"; + } + if (is_callable(array($this,'test_func2'))) { + $this->test_func2(); + } else { + echo "test_func2 isn't callable from inside\n"; + } + if (is_callable(array('test_class','test_func3'))) { + test_class::test_func3(); + } else { + echo "test_func3 isn't callable from inside\n"; + } + if (is_callable(array('test_class','test_func4'))) { + test_class::test_func4(); + } else { + echo "test_func4 isn't callable from inside\n"; + } + } +} + +class foo extends test_class { + function test() { + if (is_callable(array($this,'test_func1'))) { + $this->test_func1(); + } else { + echo "test_func1 isn't callable from child\n"; + } + if (is_callable(array($this,'test_func2'))) { + $this->test_func2(); + } else { + echo "test_func2 isn't callable from child\n"; + } + if (is_callable(array('test_class','test_func3'))) { + test_class::test_func3(); + } else { + echo "test_func3 isn't callable from child\n"; + } + if (is_callable(array('test_class','test_func4'))) { + test_class::test_func4(); + } else { + echo "test_func4 isn't callable from child\n"; + } + } +} + +$object = new test_class; +$object->test(); +if (is_callable(array($object,'test_func1'))) { + $object->test_func1(); +} else { + echo "test_func1 isn't callable from outside\n"; +} +if (is_callable(array($object,'test_func2'))) { + $object->test_func2(); +} else { + echo "test_func2 isn't callable from outside\n"; +} +if (is_callable(array('test_class','test_func3'))) { + test_class::test_func3(); +} else { + echo "test_func3 isn't callable from outside\n"; +} +if (is_callable(array('test_class','test_func4'))) { + test_class::test_func4(); +} else { + echo "test_func4 isn't callable from outside\n"; +} +$object = new foo(); +$object->test(); +?> +--EXPECTF-- +test_func1 +test_func2 +test_func3 +test_func4 +test_func1 isn't callable from outside +test_func2 isn't callable from outside +test_func3 isn't callable from outside +test_func4 isn't callable from outside +test_func1 isn't callable from child +test_func2 +test_func3 isn't callable from child +test_func4 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29368.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29368.phpt new file mode 100755 index 0000000000000..c16399abbcb1d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29368.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #29368 (The destructor is called when an exception is thrown from the constructor) +--FILE-- + +===DONE=== +--EXPECTF-- +Foo::__construct +Caught exception! +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29505.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29505.phpt new file mode 100755 index 0000000000000..36fc6fd66c7c1 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29505.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #29505 (get_class_vars() severely broken when used with arrays) +--FILE-- +"c", 3=>array()); +} + +var_dump(get_class_vars('Test')); + +?> +===DONE=== +--EXPECT-- +array(2) { + ["empty"]=> + array(0) { + } + ["three"]=> + array(3) { + [0]=> + int(1) + ["b"]=> + string(1) "c" + [3]=> + array(0) { + } + } +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29674.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29674.phpt new file mode 100755 index 0000000000000..11bc69ce9a54c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29674.phpt @@ -0,0 +1,41 @@ +--TEST-- +Bug #29674 (inherited method doesn't have access to private variables of the derived class) +--FILE-- +private_base); +/// var_dump($this->private_child); + } +} + +class ChildClass extends BaseClass +{ + private $private_child = "Child"; +} + +echo "===BASE===\n"; +$obj = new BaseClass; +$obj->printVars(); + +echo "===CHILD===\n"; +$obj = new ChildClass; +$obj->printVars(); + +?> +===DONE=== +--EXPECTF-- +===BASE=== +string(4) "Base" + +Notice: Undefined property: BaseClass::$private_child in %sbug29674.php on line %d +NULL +===CHILD=== +string(4) "Base" + +Fatal error: Cannot access private property ChildClass::$private_child in %sbug29674.php on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29689.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29689.phpt new file mode 100644 index 0000000000000..74dabc159041d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29689.phpt @@ -0,0 +1,62 @@ +--TEST-- +Bug #29689 (default value of protected member overrides default value of private) +--FILE-- +foo, " ", $this->foo2, "\n"; + } +} + +class bar extends foo { + protected $foo = 'bar'; + + function printFoo() + { + parent::printFoo(); + echo __CLASS__, ': ', $this->foo, " ", $this->foo2, "\n"; + } +} + +class baz extends bar { + protected $foo = 'baz'; + protected $foo2 = 'baz2'; +} + +class bar2 extends foo { + function printFoo() + { + parent::printFoo(); + echo __CLASS__, ': ', $this->foo, " ", $this->foo2, "\n"; + } +} + +class baz2 extends bar2 { + protected $foo = 'baz2'; + protected $foo2 = 'baz22'; +} + +$bar = new bar; +$bar->printFoo(); +echo "---baz--\n"; +$baz = new baz(); +$baz->printFoo(); +echo "---baz2--\n"; +$baz = new baz2(); +$baz->printFoo(); +?> +--EXPECTF-- +foo: foo foo2 +bar: bar +Notice: Undefined property: bar::$foo2 in %s on line %d + +---baz-- +foo: foo foo2 +bar: baz baz2 +---baz2-- +foo: foo foo2 +bar2: baz2 baz22 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29883.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29883.phpt new file mode 100644 index 0000000000000..c92f147ff7a7b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29883.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #29883 (isset gives invalid values on strings) +--FILE-- + +--EXPECT-- +bool(false) +bool(true) +u diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29890.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29890.phpt new file mode 100644 index 0000000000000..17ed5afa3467b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29890.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #29890 (crash if error handler fails) +--FILE-- + +--EXPECT-- +error :Constant TEST already defined diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29896.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29896.phpt new file mode 100755 index 0000000000000..34d43522db655 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29896.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #29896 (Backtrace argument list out of sync) +--FILE-- + +--EXPECTF-- +#0 userErrorHandler(8, Undefined variable: b, %sbug29896.php, 11, Array ([A1] => Test1)) called at [%sbug29896.php:11] +#1 GenerateError1(Test1) called at [%sbug29896.php:16] +#2 GenerateError2(Test2) called at [%sbug29896.php:19] + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug29944.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug29944.phpt new file mode 100644 index 0000000000000..2cb42ebb03fe7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug29944.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #29944 (Function defined in switch, crashes) +--FILE-- + +--EXPECT-- +ok + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30080.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30080.phpt new file mode 100755 index 0000000000000..80a70147d786a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30080.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #30080 (Passing array or non array of objects) +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + object(stdClass)#2 (0) { + } +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30140.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30140.phpt new file mode 100755 index 0000000000000..eb7f9cb3752f1 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30140.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #30140 (Problem with array in static properties) +--FILE-- + +--EXPECT-- +string(1) "x" +string(1) "y" +string(1) "z" +string(1) "x" +string(1) "y" +string(1) "z" diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30161.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30161.phpt new file mode 100755 index 0000000000000..e0c7060dcc29c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30161.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #30161 (Segmentation fault with exceptions) +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30162.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30162.phpt new file mode 100755 index 0000000000000..ae11f8ff8b711 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30162.phpt @@ -0,0 +1,52 @@ +--TEST-- +Bug #30162 (Catching exception in constructor couses lose of $this) +--FILE-- +x = "x"; + throw new Exception; + } + +} + +class hariCow extends FIIFO { + + public function __construct() { + try { + parent::__construct(); + } catch(Exception $e) { + } + $this->y = "y"; + try { + $this->z = new FIIFO; + } catch(Exception $e) { + } + } + + public function __toString() { + return "Rusticus in asino sedet."; + } + +} + +try { + $db = new FIIFO(); +} catch(Exception $e) { +} +var_dump($db); + +$db = new hariCow; + +var_dump($db); +?> +--EXPECTF-- +Notice: Undefined variable: db in %sbug30162.php on line 35 +NULL +object(hariCow)#1 (2) { + ["x"]=> + string(1) "x" + ["y"]=> + string(1) "y" +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30332.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30332.phpt new file mode 100644 index 0000000000000..873cd7d36bbcb --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30332.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #30332 (zend.ze1_compatibility_mode isnt fully compatable with array_push()) +--INI-- +zend.ze1_compatibility_mode=on +error_reporting=4095 +--FILE-- +first = " im in the first"; + +print_r($first); +print_r($second); +print_r($container); +?> +--EXPECTF-- +Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 4 + +Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 5 + +Strict Standards: Implicit cloning object of class 'x' because of 'zend.ze1_compatibility_mode' in %sbug30332.php on line 7 +x Object +( + [first] => im in the first +) +x Object +( +) +Array +( + [0] => x Object + ( + ) + +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30346.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30346.phpt new file mode 100755 index 0000000000000..30f36fbde2f44 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30346.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #30346 (arrayAccess and using $this) +--FILE-- + +===DONE=== +--EXPECT-- +page_show +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30394.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30394.phpt new file mode 100755 index 0000000000000..a979e0796cb50 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30394.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #30394 (Assignment operators yield wrong result with __get/__set) +--FILE-- +_p[ $what ]; + } + + public function __set( $what, $value ) + { + $this->_p[ $what ] = $value; + } + + private $_p = array(); +} + +$c = new Container(); +$c->a = 1; +$c->a += 1; +print $c->a; // --> 2 + +print " - "; +$c->a += max( 0, 1 ); +print $c->a; // --> 4 (!) +?> +--EXPECT-- +2 - 3 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30407.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30407.phpt new file mode 100644 index 0000000000000..6dcc6b3481fef --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30407.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #30407 (Strange behaviour of default arguments) +--FILE-- + +===DONE=== +--EXPECT-- +string(3) "one" +string(3) "one" +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30451.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30451.phpt new file mode 100644 index 0000000000000..91d51a68f8aa7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30451.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #30451 (static properties permissions broken) +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30519.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30519.phpt new file mode 100755 index 0000000000000..9fc425e51f018 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30519.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #30519 (Interface not existing says Class not found) +--FILE-- + +--EXPECTF-- +Fatal error: Interface 'a' not found in %sbug30519.php on line 2 + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30702.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30702.phpt new file mode 100644 index 0000000000000..90a1ee8906c0f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30702.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #30702 (cannot initialize class variable from class constant) +--FILE-- + +--EXPECT-- +object(bar)#1 (6) { + ["c1"]=> + int(1) + ["c2"]=> + int(2) + ["c3"]=> + int(1) + ["c4"]=> + int(2) + ["c5"]=> + int(1) + ["c6"]=> + int(1) +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30707.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30707.phpt new file mode 100755 index 0000000000000..d37d32974ea2f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30707.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #30707 (Segmentation fault on exception in method) +--FILE-- +plap($this->plop()); + } catch(Exception $e) { + } + } + + function plap($a) { + } + + function plop() { + throw new Exception; + } +} + +$x = new C; +$x->byePHP($x->plip()); +?> +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30725.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30725.phpt new file mode 100755 index 0000000000000..ce6c9a50a2609 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30725.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #30725 (PHP segfaults when an exception is thrown in getIterator() within foreach) +--FILE-- + +===DONE=== +--EXPECT-- +Caught +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30791.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30791.phpt new file mode 100755 index 0000000000000..ce270c0effe74 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30791.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #30791 (magic methods (__sleep/__wakeup/__toString) call __call if object is overloaded) +--FILE-- + +--EXPECT-- +string(50) "Object of class a could not be converted to string" + +string(50) "Object of class a could not be converted to string" + +object(a)#2 (1) { + ["a"]=> + int(4) +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30820.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30820.phpt new file mode 100755 index 0000000000000..6c136a5fc16d8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30820.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #30820 (static member conflict with $this->member silently ignored) +--INI-- +error_reporting=4095 +--FILE-- +x = 5; // no warning, but refers to different variable + + echo 'Blah::$x = '. Blah::$x ."\n"; + echo '$this->x = '. $this->x ."\n"; + } +} + +$b = new Blah(); +$b->show(); +?> +--EXPECTF-- +Strict Standards: Accessing static property Blah::$x as non static in %sbug30820.php on line 7 +Blah::$x = 1 + +Strict Standards: Accessing static property Blah::$x as non static in %sbug30820.php on line 10 +$this->x = 5 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30828.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30828.phpt new file mode 100755 index 0000000000000..eb003f1de0e75 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30828.phpt @@ -0,0 +1,61 @@ +--TEST-- +Bug #30828 (debug_backtrace() reports incorrect class in overridden methods) +--FILE-- +foo(); +B::bar(); +?> +--EXPECTF-- +#0 A->__construct() called at [%sbug30828.php:30] +#1 B->__construct() called at [%sbug30828.php:42] +A->__construct +B->__construct +#0 A->foo() called at [%sbug30828.php:34] +#1 B->foo() called at [%sbug30828.php:43] +A->foo +B->foo +#0 A::bar() called at [%sbug30828.php:38] +#1 B::bar() called at [%sbug30828.php:44] +A::bar +B::bar diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30889.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30889.phpt new file mode 100644 index 0000000000000..c80dbded7ee76 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30889.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #30889 (Conflict between __get/__set and ++ operator) +--FILE-- +values = array('a' => 0); + } + function __set($name, $value) + { + print "set $name = $value ($name was ".$this->values[$name].")\n"; + $this->values[$name] = $value; + } + function __get($name) + { + print "get $name (returns ".$this->values[$name].")\n"; + return $this->values[$name]; + } +} +$test = new overloaded(); +$test->a++; // __get(), then __set() +++$test->a; +?> +--EXPECT-- +get a (returns 0) +set a = 1 (a was 0) +get a (returns 1) +set a = 2 (a was 1) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30922.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30922.phpt new file mode 100644 index 0000000000000..c78dd3a37847e --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30922.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #30922 (reflective functions crash PHP when interfaces extend themselves) +--FILE-- + +--EXPECTF-- +Fatal error: Interface RecurisiveFooFar cannot not implement itself in %sbug30922.php on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug30998.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug30998.phpt new file mode 100755 index 0000000000000..d0ace9fa16d45 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug30998.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #30998 (Crash when user error handler returns false) +--FILE-- + +===DONE=== +--EXPECTF-- +fopen(/tmp/blah): failed to open stream: No such file or directory (2) in %s:%d + +Warning: fopen(/tmp/blah): failed to open stream: No such file or directory in %s on line %d +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug31098.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug31098.phpt new file mode 100644 index 0000000000000..c8626abef1509 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug31098.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #31098 (isset() / empty() incorrectly returns true in dereference of a wrong type) +--FILE-- +b)); +$a = 'a'; +var_dump(isset($a->b)); +$a = '0'; +var_dump(isset($a->b)); +$a = ''; +var_dump(isset($a['b'])); +$a = 'a'; +var_dump(isset($a['b'])); +$a = '0'; +var_dump(isset($a['b'])); + +$simpleString = "Bogus String Text"; +echo isset($simpleString->wrong)?"bug\n":"ok\n"; +echo isset($simpleString["wrong"])?"ok\n":"bug\n"; +echo isset($simpleString[-1])?"bug\n":"ok\n"; +echo isset($simpleString[0])?"ok\n":"bug\n"; +echo isset($simpleString["0"])?"ok\n":"bug\n"; +echo isset($simpleString["16"])?"ok\n":"bug\n"; +echo isset($simpleString["17"])?"bug\n":"ok\n"; +echo isset($simpleString["wrong"][0])?"bug\n":"ok\n"; +echo $simpleString->wrong === null?"ok\n":"bug\n"; +echo $simpleString["wrong"] === "B"?"ok\n":"bug\n"; +echo $simpleString["0"] === "B"?"ok\n":"bug\n"; +$simpleString["wrong"] = "f"; +echo $simpleString["0"] === "f"?"ok\n":"bug\n"; +?> +--EXPECTF-- +bool(false) +bool(false) +bool(false) +bool(false) +bool(true) +bool(true) +ok +ok +ok +ok +ok +ok +ok +ok + +Notice: Trying to get property of non-object in %sbug31098.php on line %d +ok +ok +ok +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug31102.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug31102.phpt new file mode 100755 index 0000000000000..b7911bea51ca9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug31102.phpt @@ -0,0 +1,48 @@ +--TEST-- +Bug #31102 (Exception not handled when thrown inside __autoload()) +--FILE-- +getMessage() . "\n"; + } +} +?> +===DONE=== + +--EXPECTF-- +__autoload(Test1,1) +Caught: Test1::__construct +__autoload(Test2,2) +Caught: __autoload +__autoload(Test3,3) + +Fatal error: Class 'Test3' not found in %sbug31102.php(%d) : eval()'d code on line 1 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug31177-2.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug31177-2.phpt new file mode 100755 index 0000000000000..4c0af8144f022 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug31177-2.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #31177 (memory corruption because of incorrect refcounting) +--FILE-- +foo(1); +} catch (Exception $e) { + var_dump($x); +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug31177.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug31177.phpt new file mode 100755 index 0000000000000..ac0fd7289631b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug31177.phpt @@ -0,0 +1,44 @@ +--TEST-- +Bug #31177 (Memory leak) +--FILE-- +query()); + } + + public function select2() { + new DbGowRecordSet($this->query()); + } + +} + +class DbGowRecordSet { + + public function __construct($resource) { + } + +} + +$db = new DbGow; + +try { + $rs = $db->select(); +} catch(Exception $e) { + echo "ok\n"; +} + +try { + $db->select2(); +} catch(Exception $e) { + echo "ok\n"; +} +?> +--EXPECT-- +ok +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug31341.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug31341.phpt new file mode 100755 index 0000000000000..309a54d76b2e5 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug31341.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #31341 (escape on curly inconsistent) +--FILE-- + +--EXPECT-- +'$ \{ ' +' \{ $' +' \{$ ' +' $\{ ' +' $\{ ' +' \{$ ' +'$ \{ ' +' \{ $' +'% \{ ' diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug31525.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug31525.phpt new file mode 100755 index 0000000000000..9c1c846cead05 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug31525.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #31525 (object reference being dropped. $this getting lost) +--INI-- +error_reporting=4095 +--FILE-- +getThis(); + } +} +$bar = new Foo(); +$bar->destroyThis(); +var_dump($bar); +?> +--EXPECTF-- +Strict Standards: Only variables should be assigned by reference in %sbug31525.php on line 7 +object(Foo)#1 (0) { +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug31683.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug31683.phpt new file mode 100644 index 0000000000000..5042450c598f0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug31683.phpt @@ -0,0 +1,95 @@ +--TEST-- +Bug #31683 (changes to $name in __get($name) override future parameters) +--FILE-- +ok("ok"); +/// $foo->ok; + $foo->ok = "ok"; + $x = $foo["ok"]; + $foo["ok"] = "ok"; +/// isset($foo["ok"]); + unset($foo["ok"]); +// $foo[]; + $foo[] = "ok"; +// isset($foo[]); +// unset($foo[]); +/// $foo->$a; + echo "---\n"; +} +?> +--EXPECT-- +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +NULL +string(2) "ok" +string(2) "ok" +--- +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +string(2) "ok" +NULL +string(2) "ok" +string(2) "ok" +--- diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug31720.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug31720.phpt new file mode 100644 index 0000000000000..3d62ac34e240f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug31720.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #31720 (Invalid object callbacks not caught in array_walk()) +--FILE-- + +===DONE=== +--EXPECTF-- +Notice: Undefined variable: nonesuchvar in %s on line %d + +Notice: Non-callable array passed to zend_call_function() in %s on line %d + +Warning: array_walk(): Unable to call Array() - function does not exist in %s on line %d +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug31828.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug31828.phpt new file mode 100644 index 0000000000000..e5c004fba2005 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug31828.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #31828 (Crash with zend.ze1_compatibility_mode=On) +--INI-- +zend.ze1_compatibility_mode=on +error_reporting=4095 +--FILE-- +id = 77; +$o->name = "Aerospace"; +$a[] = $o; +$a = $a[0]; +print_r($a); +?> +--EXPECTF-- +Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 2 + +Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 5 + +Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug31828.php on line 6 +stdClass Object +( + [id] => 77 + [name] => Aerospace +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32080.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32080.phpt new file mode 100644 index 0000000000000..c7227b4f57ca7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32080.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #32080 (segfault when assigning object to itself with zend.ze1_compatibility_mode=On) +--INI-- +zend.ze1_compatibility_mode=on +error_reporting=4095 +--FILE-- + +--EXPECTF-- +Strict Standards: Implicit cloning object of class 'test' because of 'zend.ze1_compatibility_mode' in %sbug32080.php on line 3 + +Strict Standards: Implicit cloning object of class 'test' because of 'zend.ze1_compatibility_mode' in %sbug32080.php on line 5 +object(test)#%d (0) { +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32226.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32226.phpt new file mode 100755 index 0000000000000..9536c921a3335 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32226.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #32226 (SEGV with exception handler on non existing instance) +--FILE-- + +===DONE=== +--EXPECT-- +Caught +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32252.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32252.phpt new file mode 100755 index 0000000000000..706da18cfb4dd --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32252.phpt @@ -0,0 +1,47 @@ +--TEST-- +Bug #32252 (Segfault when offsetSet throws an Exception (only without debug)) +--FILE-- + +===DONE=== +--EXPECT-- +Test::offsetSet(-1, 123) +CAUGHT +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32290.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32290.phpt new file mode 100755 index 0000000000000..c038083775740 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32290.phpt @@ -0,0 +1,126 @@ +--TEST-- +Bug #32290 (calling call_user_func_array() ends in infinite loop within child class) +--FILE-- += 5) return 5; + return call_user_func_array(array("TestA", "doSomething"), array($i)); + } + + public function doSomethingThis($i) + { + echo __METHOD__ . "($i)\n"; + $i++; + if ($i >= 5) return 5; + return call_user_func_array(array($this, "TestA::doSomethingThis"), array($i)); + } + + public function doSomethingParent($i) + { + echo __METHOD__ . "($i)\n"; + $i++; + if ($i >= 5) return 5; + return call_user_func_array(array("parent", "doSomethingParent"), array($i)); + } + + public function doSomethingParentThis($i) + { + echo __METHOD__ . "($i)\n"; + $i++; + if ($i >= 5) return 5; + return call_user_func_array(array($this, "parent::doSomethingParentThis"), array($i)); + } + + public static function doSomethingStatic($i) + { + echo __METHOD__ . "($i)\n"; + $i++; + if ($i >= 5) return 5; + return call_user_func_array(array("TestA", "doSomethingStatic"), array($i)); + } +} + +$x = new TestB(); +echo "===A===\n"; +var_dump($x->doSomething(1)); +echo "\n===B===\n"; +var_dump($x->doSomethingThis(1)); +echo "\n===C===\n"; +var_dump($x->doSomethingParent(1)); +echo "\n===D===\n"; +var_dump($x->doSomethingParentThis(1)); +echo "\n===E===\n"; +var_dump($x->doSomethingStatic(1)); + +?> +===DONE=== + +--EXPECTF-- +===A=== +TestB::doSomething(1) + +Strict Standards: Non-static method TestA::doSomething() cannot be called statically, assuming $this from compatible context TestB in %sbug32290.php on line %d +TestA::doSomething(2) +int(1) + +===B=== +TestB::doSomethingThis(1) +TestA::doSomethingThis(2) +int(1) + +===C=== +TestB::doSomethingParent(1) + +Strict Standards: Non-static method TestA::doSomethingParent() cannot be called statically, assuming $this from compatible context TestB in %sbug32290.php on line %d +TestA::doSomethingParent(2) +int(1) + +===D=== +TestB::doSomethingParentThis(1) +TestA::doSomethingParentThis(2) +int(1) + +===E=== +TestB::doSomethingStatic(1) +TestA::doSomethingStatic(2) +int(1) +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32296.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32296.phpt new file mode 100755 index 0000000000000..d2e6d0ca3b1f3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32296.phpt @@ -0,0 +1,60 @@ +--TEST-- +Bug #32296 (get_class_methods output has changed between 5.0.2 and 5.0.3) +--FILE-- +buggy(); +print_r(get_class_methods("square")); +print_r(get_class_methods($a)); +?> +--EXPECT-- +square +a:Array +( + [0] => x2 + [1] => buggy + [2] => unfold + [3] => __construct +) +b:Array +( + [0] => x2 + [1] => buggy + [2] => unfold + [3] => __construct +) +Array +( + [0] => buggy + [1] => __construct +) +Array +( + [0] => buggy + [1] => __construct +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32322.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32322.phpt new file mode 100755 index 0000000000000..fd79a04829cae --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32322.phpt @@ -0,0 +1,80 @@ +--TEST-- +Bug #32322 (Return values by reference broken( using self::),example singleton instance) +--INI-- +error_reporting=4095 +--FILE-- + myname = $value; + } + private function __clone() {} + static public function getInstance() + { + if ( self::$instance == null ) + { + self::$instance = new test('Singleton1'); + } + else { + echo "Using old class " . self::$instance -> myname . "\n"; + } + return self::$instance; + } + static public function getInstance2() + { + static $instance2 = null; + if ( $instance2 == null ) + { + $instance2 = new test('Singleton2'); + } + else { + echo "Using old class " . $instance2 -> myname . "\n"; + } + return $instance2; + } + public function __destruct() + { + if ( defined('SCRIPT_END') ) + { + echo "Class " . $this -> myname . " destroyed at script end\n"; + } else { + echo "Class " . $this -> myname . " destroyed beforce script end\n"; + } + } +} +echo "Try static instance inside class :\n"; +$getCopyofSingleton = test::getInstance(); +$getCopyofSingleton = null; +$getCopyofSingleton = &test::getInstance(); +$getCopyofSingleton = null; +$getCopyofSingleton = test::getInstance(); +echo "Try static instance inside function :\n"; +$getCopyofSingleton2 = test::getInstance2(); +$getCopyofSingleton2 = null; +$getCopyofSingleton2 = &test::getInstance2(); +$getCopyofSingleton2 = null; +$getCopyofSingleton2 = test::getInstance2(); + +define('SCRIPT_END',1); +?> +--EXPECTF-- +Try static instance inside class : +New class Singleton1 created +Using old class Singleton1 + +Strict Standards: Only variables should be assigned by reference in %sbug32322.php on line 49 +Using old class Singleton1 +Try static instance inside function : +New class Singleton2 created +Using old class Singleton2 + +Strict Standards: Only variables should be assigned by reference in %sbug32322.php on line 55 +Using old class Singleton2 +Class Singleton1 destroyed at script end +Class Singleton2 destroyed at script end diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32427.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32427.phpt new file mode 100644 index 0000000000000..b7b478dc810c8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32427.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #32427 (Interfaces are not allowed 'static' access modifier) +--FILE-- + +--EXPECT-- +I am a silly error diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32428.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32428.phpt new file mode 100755 index 0000000000000..3812d43826cc1 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32428.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #32428 (The @ warning error supression operator is broken) +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32429.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32429.phpt new file mode 100644 index 0000000000000..b711831afbd76 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32429.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #32429 (method_exists() always return TRUE if __call method exists) +--FILE-- +test(); + } + } + + public function __call($name, $args) { + throw new Exception('Call to undefined method'.get_class($this).'::'.$name.'()'); + } +} + +try { + $test = new TestClass; +} catch (Exception $e) { + exit($e->getMessage()); +} + +?> +--EXPECT-- +bool(false) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32596.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32596.phpt new file mode 100755 index 0000000000000..4e21027f832cd --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32596.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #32596 (Segfault/Memory Leak by getClass (etc) in __destruct) +--FILE-- +error; + } +} + + +BUG::instance()->error; +echo "this is still executed\n"; +?> +--EXPECT-- +BUG +please fix this thing, it wasted a nice part of my life! +this is still executed + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32660.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32660.phpt new file mode 100755 index 0000000000000..c27984d777115 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32660.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #32660 (Assignment by reference causes crash when field access is overloaded (__get)) +--FILE-- +q = 3;//array(); + } + + function __get($name) + { + return $this->q; + } +} + +$a = new A; + +$b = "short"; +$c =& $a->whatever; +$c = "long"; +print_r($a); +///$a->whatever =& $b; +$b = "much longer"; +print_r($a); +?> +--EXPECTF-- +Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 20 +A Object +( + [q] => 3 +) + +Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 23 + +Fatal error: Cannot assign by reference to overloaded object in %sbug32660.php on line 23 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32674.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32674.phpt new file mode 100644 index 0000000000000..f986132a1f403 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32674.phpt @@ -0,0 +1,62 @@ +--TEST-- +Bug #32674 (exception in iterator causes crash) +--FILE-- +_elements); + } + + public function count() { + return count($this->_elements); + } + + public function current() { + $element = current($this->_elements); + return $element; + } + + public function next() { + $element = next($this->_elements); + return $element; + } + + public function key() { + $this->_fillCollection(); + $element = key($this->_elements); + return $element; + } + + public function valid() { + throw new Exception('shit happend'); + + return ($this->current() !== false); + } +} + +class class2 { + public $dummy; +} + +$obj = new class2(); +$col = new collection(); + +try { + foreach($col as $co) { + //irrelevant + } + echo 'shouldn`t get here'; + //$dummy = 'this will not crash'; + $obj->dummy = 'this will crash'; +} catch (Exception $e) { + echo "ok\n"; +} +?> +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32799.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32799.phpt new file mode 100755 index 0000000000000..12bffd4a4ed59 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32799.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #32799 (crash: calling the corresponding global var during the destruct) +--FILE-- +c++; // no warning + print $GLOBALS['p']->c."\n"; // segfault + var_dump($GLOBALS['p']); + } +} +$p=new test; +$p=null; //destroy the object by a new assignment (segfault) +?> +--EXPECT-- +2 +object(test)#1 (1) { + ["c"]=> + int(2) +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32833.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32833.phpt new file mode 100644 index 0000000000000..b8a8bbe1b5b43 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32833.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #32833 (Invalid opcode with $a[] .= '') +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32852.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32852.phpt new file mode 100644 index 0000000000000..8b44bdcdfdd4c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32852.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #32852 (Crash with singleton and __destruct when zend.ze1_compatibility_mode = On) +--INI-- +zend.ze1_compatibility_mode=on +error_reporting=4095 +--FILE-- + +--EXPECTF-- +Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 6 +i'm called + +Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 15 +i'm called + +Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 17 +i'm called +i'm called diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug32993.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug32993.phpt new file mode 100755 index 0000000000000..86d8e266fa639 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug32993.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #32993 (implemented Iterator function current() don't throw exception) +--FILE-- +arr); } + public function current() { throw new Exception(); } + public function key() { return key($this->arr); } + public function next() { return next($this->arr); } + public function valid() { return (current($this->arr) !== false); } +} + +$t = new Test(); +$t->arr = array(1, 2, 3); + +try { + foreach ($t as $v) { + echo "$v\n"; + } +} catch (Exception $e) { + ; // handle exception +} +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33116.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33116.phpt new file mode 100755 index 0000000000000..641f4bb99a890 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33116.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #33116 (crash when assigning class name to global variable in __autoload) +--FILE-- + +--EXPECT-- +DefClass Object +( +) +Array +( + [0] => DefClass +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33171.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33171.phpt new file mode 100755 index 0000000000000..8cc44a27ae3c6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33171.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #33171 (foreach enumerates private fields declared in base classes) +--FILE-- + $val) + { + echo "$key => $val\n"; + } + } +}; + +$x = new B; +$x->go(); +?> +--EXPECT-- +c => B's c diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33243.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33243.phpt new file mode 100755 index 0000000000000..9b5b39dec2bf0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33243.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #33243 (ze1_compatibility_mode does not work as expected) +--INI-- +zend.ze1_compatibility_mode=1 +error_reporting=4095 +--FILE-- +y->z = 0; +$b = $a; // should perform deep copy of $a +$b->y->z = 1; // hence this should have no effect on $a +var_dump($a); +?> +--EXPECTF-- +Strict Standards: Creating default object from empty value in %sbug33243.php on line 2 + +Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug33243.php on line 3 + +Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug33243.php on line 5 +object(stdClass)#%d (1) { + ["y"]=> + object(stdClass)#%d (1) { + ["z"]=> + int(0) + } +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33257.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33257.phpt new file mode 100755 index 0000000000000..5c5061bb09159 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33257.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #33257 (array_splice() inconsistent when passed function instead of variable) +--INI-- +error_reporting=4095 +--FILE-- + +--EXPECTF-- +Strict Standards: Only variables should be passed by reference in %sbug33257.php on line 10 +Array +( + [0] => a + [1] => b + [2] => c +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33277.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33277.phpt new file mode 100644 index 0000000000000..b653e43f29413 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33277.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #33277 (private method accessed by child class) +--FILE-- +bar(); + } +} + +class foo2son extends fooson { + + function bar() { + echo "public!\n"; + } +} + +$b = new foo2son(); +$b->barson(); +?> +--EXPECT-- +public! diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33282.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33282.phpt new file mode 100644 index 0000000000000..65e3c16cf5a92 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33282.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #33282 (Re-assignment by reference does not clear the is_ref flag) +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + &int(3) +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33318.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33318.phpt new file mode 100755 index 0000000000000..262627b7450c9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33318.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #33318 (throw 1; results in Invalid opcode 108/1/8) +--FILE-- + +--EXPECTF-- +Fatal error: Can only throw objects in %sbug33318.php on line 2 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33512.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33512.phpt new file mode 100755 index 0000000000000..9dd4e4e5f9012 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33512.phpt @@ -0,0 +1,66 @@ +--TEST-- +Bug #33512 (unset() overloaded properties doesn't work) +--FILE-- +Var[$var] = $val; + } + function __get($var) { + if(isset($this->Var[$var])) return $this->Var[$var]; + else return -1; + } + function __unset($var) { + unset($this->Var[$var]); + } + } + + $SomeObj = new TheObj; + + // this will fine + $SomeObj->RealVar1 = 'somevalue'; + $SomeObj->{'RealVar2'} = 'othervalue'; + $SomeObj->{'RealVar'.(3)} = 'othervaluetoo'; + $SomeObj->{'RealVar'.'4'} = 'anothervalue'; + + // this will fine too + $SomeObj->Virtual1 = 'somevalue'; + $SomeObj->{'Virtual2'} = 'othervalue'; + + // it's can't be used since this will encounter error + $SomeObj->{'Virtual'.(3)} = 'othervaluetoo'; + $SomeObj->{'Virtual'.'4'} = 'anothervalue'; + + // but this will fine, ofcourse + $SomeObj->Var['Virtual'.(3)] = 'othervaluetoo'; + $SomeObj->Var['Virtual'.'4'] = 'anothervalue'; + + + var_dump($SomeObj->RealVar1); + print $SomeObj->{'RealVar'.(3)}."\n"; + + unset($SomeObj->RealVar1); + unset($SomeObj->{'RealVar'.(3)}); + + //the lines below will catch by '__get' magic method since these variables are unavailable anymore + var_dump($SomeObj->RealVar1); + print $SomeObj->{'RealVar'.(3)}."\n"; + + // now we will try to unset these variables + unset($SomeObj->Virtual1); + unset($SomeObj->{'Virtual'.(3)}); + + //but, these variables are still available??? eventhough they're "unset"-ed + print $SomeObj->Virtual1."\n"; + print $SomeObj->{'Virtual'.(3)}."\n"; +?> +--EXPECT-- +string(9) "somevalue" +othervaluetoo +int(-1) +-1 +-1 +-1 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33558.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33558.phpt new file mode 100755 index 0000000000000..15ac4a26a0df5 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33558.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #33558 (warning with nested calls to functions returning by reference) +--INI-- +error_reporting=4095 +--FILE-- + +--EXPECT-- +ok + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33710.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33710.phpt new file mode 100755 index 0000000000000..f9498ebfb5cf8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33710.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #33710 (ArrayAccess objects doesn't initialize $this) +--FILE-- +succeed(); +$bar->fail(); + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33732.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33732.phpt new file mode 100755 index 0000000000000..e723c2064ec24 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33732.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #33732 (Wrong behavior of constants in class and interface extending) +--FILE-- + +--EXPECT-- +const of iA +const of iA +const of iA +const of iA2 +const of iA2 +const of iA2 +const of iA2 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33771.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33771.phpt new file mode 100644 index 0000000000000..a786e58066134 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33771.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #33771 (error_reporting falls to 0 when @ was used inside try/catch block) +--FILE-- + +--EXPECTF-- +int(8191) +int(8191) +int(6143) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33802.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33802.phpt new file mode 100755 index 0000000000000..d2f8cd736e39a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33802.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #33802 (throw Exception in error handler causes crash) +--FILE-- + +ok +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33996.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33996.phpt new file mode 100755 index 0000000000000..e1677ce7831bb --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33996.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #33996 (No information given for fatal error on passing invalid value to typed argument) +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Warning: Missing argument 1 for NormalTest(), called in %sbug33996.php on line %d and defined in %sbug33996.php on line %d +Hi! +Catchable fatal error: Argument 1 passed to FooTest() must be an instance of Foo, none given, called in %sbug33996.php on line %d and defined in %sbug33996.php on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug33999.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug33999.phpt new file mode 100755 index 0000000000000..cbc6360525118 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug33999.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #33999 (object remains object when cast to int) +--INI-- +error_reporting=4095 +--FILE-- + +--EXPECTF-- +object(Foo)#1 (1) { + ["bar"]=> + string(3) "bat" +} + +Notice: Object of class Foo could not be converted to int in %sbug33999.php on line 9 +int(1) + +Notice: Object of class Foo could not be converted to double in %sbug33999.php on line 12 +float(1) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34045.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34045.phpt new file mode 100755 index 0000000000000..61886cf354b67 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34045.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #34045 (Buffer overflow with serialized object) +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34062.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34062.phpt new file mode 100755 index 0000000000000..bcb4ad8c64c13 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34062.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #34062 (Crash in catch block when many arguments are used) +--FILE-- + +--EXPECT-- +((( +here +))) + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34064.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34064.phpt new file mode 100755 index 0000000000000..22ddb89c5bc5e --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34064.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #34064 (arr[] as param to function in class gives invalid opcode) +--FILE-- +test_ref($ar[]); + var_dump($ar); + $this->test($ar[]); + } +} + +$o = new XmlTest(); +$o->run(); +?> +--EXPECTF-- +array(1) { + [0]=> + string(2) "ok" +} + +Fatal error: Cannot use [] for reading in %sbug34064.php on line 18 + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34065.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34065.phpt new file mode 100755 index 0000000000000..9f6e00e61daed --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34065.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #34065 (throw in foreach causes memory leaks) +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34137.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34137.phpt new file mode 100755 index 0000000000000..4e0a09ffad5e1 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34137.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #34137 (assigning array element by reference causes binary mess) +--FILE-- + array('alfa' => 'ok')); +$arr1 =& $arr1['a1']; +echo '-'.$arr1['alfa']."-\n"; +?> +--EXPECT-- +-ok- diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34199.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34199.phpt new file mode 100755 index 0000000000000..daae0deb3d521 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34199.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #34199 (if($obj)/if(!$obj) inconsistency because of cast handler) +--SKIPIF-- + +--FILE-- +"; +$xml = simplexml_load_string($xml); +$kids = $xml->children(); +var_dump((bool)$kids); +if($kids) echo "bug\n"; else echo "ok\n"; +if(!$kids) echo "ok\n"; else echo "bug\n"; +?> +--EXPECT-- +bool(false) +ok +ok + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34260.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34260.phpt new file mode 100755 index 0000000000000..4a59208545e53 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34260.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #34260 (Segfault with callbacks (array_map) + overloading) +--FILE-- + +--EXPECT-- +I hate me +I hate me +I heart me +I heart me diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34310.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34310.phpt new file mode 100644 index 0000000000000..1d2bb03ad3e50 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34310.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #34310 (foreach($arr as $c->d => $x) crashes) +--FILE-- + 'a', 2 => 'b', 3 => 'c'); + +// Works fine: +foreach($arr as $x => $c->d) +{ + echo "{$x} => {$c->d}\n"; +} + +// Crashes: +foreach($arr as $c->d => $x) +{ + echo "{$c->d} => {$x}\n"; +} + +?> +--EXPECT-- +1 => a +2 => b +3 => c +1 => a +2 => b +3 => c diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34358.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34358.phpt new file mode 100755 index 0000000000000..b9c6565f51dbc --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34358.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #34358 (Fatal error: Cannot re-assign $this(again)) +--FILE-- +bar(); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34467.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34467.phpt new file mode 100755 index 0000000000000..39862ada0db54 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34467.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #34467 (foreach + __get + __set incosistency) +--FILE-- +arr[$key] = $value; + } + + function __get ($key) { + return $this->arr[$key]; + } +} +$abc = new abc(); +foreach (array (1,2,3) as $abc->k => $abc->v) { + var_dump($abc->k,$abc->v); +} +?> +--EXPECT-- +int(0) +int(1) +int(1) +int(2) +int(2) +int(3) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34518.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34518.phpt new file mode 100755 index 0000000000000..1971fcb720a21 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34518.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #34518 (Unset doesn't separate container in CV) +--FILE-- + +--EXPECT-- +Array +( + [0] => 1 + [1] => 2 + [2] => 3 + [foo] => Array + ( + [0] => 4 + [1] => 5 + [2] => 6 + ) + +) +Array +( + [0] => 1 + [1] => 2 + [2] => 3 + [foo] => Array + ( + [1] => 5 + [2] => 6 + ) + +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34617.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34617.phpt new file mode 100755 index 0000000000000..826ff1000f0c5 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34617.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #34617 (zend_deactivate: objects_store used after zend_objects_store_destroy is called) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34678.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34678.phpt new file mode 100755 index 0000000000000..2a13201f265ec --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34678.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #34678 (__call(), is_callable() and static methods) +--FILE-- + +--EXPECT-- +foo diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34712.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34712.phpt new file mode 100755 index 0000000000000..d280c26f4acc5 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34712.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #34712 (zend.ze1_compatibility_mode = on segfault) +--INI-- +zend.ze1_compatibility_mode=1 +error_reporting=4095 +--FILE-- +bar = &$obj_ref; + } +} + + +class bar { + function bar() { + $this->foo = new foo($this); + } +} + +$test = new bar; +echo "ok\n"; +?> +--EXPECTF-- +Strict Standards: Implicit cloning object of class 'foo' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 11 + +Strict Standards: Implicit cloning object of class 'bar' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 15 +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34767.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34767.phpt new file mode 100755 index 0000000000000..c81b44bee73ce --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34767.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #34767 (Zend Engine 1 Compatibility not copying objects correctly) +--INI-- +zend.ze1_compatibility_mode=1 +error_reporting=4095 +--FILE-- +y = &new stdClass(); +print_r($a); +$b = $a; +$a->y->z = 1; +print_r($b); +?> +--EXPECTF-- + +Strict Standards: Assigning the return value of new by reference is deprecated in %sbug34767.php on line 2 +stdClass Object +( + [y] => stdClass Object + ( + ) + +) + +Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug34767.php on line 4 +stdClass Object +( + [y] => stdClass Object + ( + [z] => 1 + ) + +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34786.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34786.phpt new file mode 100755 index 0000000000000..516e18ff2e8e8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34786.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #34786 (2 @ results in change to error_reporting() to random value) +--FILE-- + +--EXPECT-- +before: 1 +bar: 0 +foo: 0 +after: 1 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34873.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34873.phpt new file mode 100644 index 0000000000000..7d9eb78ab7e45 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34873.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #34873 (Segmentation Fault on foreach in object) +--FILE-- +var = array(); + } + + function test (){ + $cont = array(); + $cont["mykey"] = "myvalue"; + + foreach ($cont as $this->var['key'] => $this->var['value']) + var_dump($this->var['value']); + } +} +$myPwa = new Pwa(); +$myPwa->test(); + +echo "Done\n"; +?> +--EXPECT-- +string(7) "myvalue" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34879.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34879.phpt new file mode 100755 index 0000000000000..6b591002a2ef7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34879.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #34879 (str_replace, array_map corrupt negative array indexes on 64-bit platforms) +--FILE-- +-1))); +?> +--EXPECT-- +Array +( + [-1] => -1 +) \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug34893.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug34893.phpt new file mode 100755 index 0000000000000..c117686eca6ec --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug34893.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #34893 (PHP5.1 overloading, Cannot access private property) +--FILE-- +$name; + } + function __set($name, $value) { + $this->$name = $value; + } +} +class B { + private $t; + function __get($name){ + return $this->$name; + } + function __set($name, $value) { + $this->$name = $value; + } +} +$a = new A; +$b = new B; +$a->p = $b; +$b->t = "foo"; + +echo $a->p->t; +$a->p->t = "bar"; +echo $a->p->t; +?> +--EXPECT-- +foobar diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug35017.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug35017.phpt new file mode 100755 index 0000000000000..b138b7fdbca99 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug35017.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #35017 (Exception thrown in error handler may cause unexpected behavior) +--FILE-- + +--EXPECT-- +This Exception should be catched diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug35106.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug35106.phpt new file mode 100755 index 0000000000000..a3f166cd57467 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug35106.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #35106 (nested foreach fails when array variable has a reference) +--FILE-- + +--EXPECT-- +12 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug35239.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug35239.phpt new file mode 100755 index 0000000000000..ad999c4ad689c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug35239.phpt @@ -0,0 +1,41 @@ +--TEST-- +Bug #35239 (Objects can lose references) +--FILE-- +x0 = new stdClass; +$a->x0->y0 = 'a'; +$a->x0->y1 =& $a->x0; +$a->x0->y2 =& $a->x0; +$a->x0->y0 = 'b'; +var_dump($a); +$a->x0->y1 = "ok\n"; +echo $a->x0; +?> +--EXPECT-- +object(stdClass)#1 (1) { + ["x0"]=> + &object(stdClass)#2 (3) { + ["y0"]=> + string(1) "b" + ["y1"]=> + &object(stdClass)#2 (3) { + ["y0"]=> + string(1) "b" + ["y1"]=> + *RECURSION* + ["y2"]=> + *RECURSION* + } + ["y2"]=> + &object(stdClass)#2 (3) { + ["y0"]=> + string(1) "b" + ["y1"]=> + *RECURSION* + ["y2"]=> + *RECURSION* + } + } +} +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug35393.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug35393.phpt new file mode 100755 index 0000000000000..059621c9fdeb4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug35393.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #35393 (changing static protected members from outside the class) +--INI-- +error_reporting=4095 +--FILE-- +'main'); + + static function getType() + { + return self::$type; + } +} +print_r(ObjectPath::getType()); +$object_type = array_pop((ObjectPath::getType())); +print_r(ObjectPath::getType()); +?> +--EXPECTF-- +Array +( + [0] => main +) + +Strict Standards: Only variables should be passed by reference in %sbug35393.php on line 12 +Array +( + [0] => main +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug35411.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug35411.phpt new file mode 100755 index 0000000000000..df2aa4f262058 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug35411.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #35411 (Regression with \{$ handling) +--FILE-- + +--EXPECT-- +foo\{bar}baz +foo\{ bar}baz +foobarbaz +foo\{bar}baz +foo\{ bar}baz diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug35437.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug35437.phpt new file mode 100755 index 0000000000000..965acf5facee6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug35437.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #35437 (Segfault or Invalid Opcode 137/1/4) +--FILE-- +getMessage()."\n"; +} +?> +--EXPECT-- +Catched: Error occuried: Non-static method TestClass::testMethod() should not be called statically diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug35470.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug35470.phpt new file mode 100755 index 0000000000000..3d708862cf92c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug35470.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #35470 (Assigning global using variable name from array doesn't function) +--FILE-- + +--EXPECT-- +Test: 55 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug35509.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug35509.phpt new file mode 100755 index 0000000000000..6cb54c03e1f22 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug35509.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #35509 (string constant as array key has different behavior inside object) +--FILE-- + 'value' ); + + public function __construct() + { + print_r($this->classArray); + } +} + +$classtest = new mytest(); + +define( "normalConstant", '01' ); +$normalArray = array( normalConstant => 'value' ); +print_r($normalArray); +?> +--EXPECT-- +Array +( + [01] => value +) +Array +( + [01] => value +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug35634.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug35634.phpt new file mode 100755 index 0000000000000..9681b6ad406b4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug35634.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #35634 (Erroneous "Class declarations may not be nested" error raised) +--INI-- +error_reporting=0 +--FILE-- +__construct(); + } + } + +} else { + + function errorHandler($errorNumber, $errorMessage, $fileName, $lineNumber) { + define("pass3", 1); + include(__FILE__); + die("Error: $errorMessage ($fileName:$lineNumber)\n"); + } + + set_error_handler('errorHandler'); + define("pass2", 1); + include(__FILE__); +} +?> +--EXPECTF-- +Error: Redefining already defined constructor for class TestClass (%sbug35634.php:12) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug35655.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug35655.phpt new file mode 100755 index 0000000000000..e35764a60e5d7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug35655.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #35655 (whitespace following end of heredoc is lost) +--INI-- +highlight.string = #DD0000 +highlight.comment = #FF8000 +highlight.keyword = #007700 +highlight.bg = #FFFFFF +highlight.default = #0000BB +highlight.html = #000000 +--FILE-- +'; +highlight_string($code); +?> +--EXPECT-- + +
    <?php
      $x 
    = <<<EOT
    some string    
    EOT
      
    $y 2;
    ?> +
    +
    diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug36006.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug36006.phpt new file mode 100755 index 0000000000000..79f9897d1343e --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug36006.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #36006 (Problem with $this in __destruct()) +--FILE-- +dad = null; /* no segfault if this is commented out */ + } +} + +class Dad extends Person { + public $son; + public function __construct() { + $this->son = new Person; + $this->son->dad = $this; /* no segfault if this is commented out */ + } + public function __destruct() { + $this->son = null; + parent::__destruct(); /* segfault here */ + } +} + +$o = new Dad; +unset($o); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug36037.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug36037.phpt new file mode 100755 index 0000000000000..3ccebf652d364 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug36037.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #36037 (heredoc adds extra line number) +--FILE-- + +--EXPECT-- +2 +7 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug36071.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug36071.phpt new file mode 100755 index 0000000000000..19e74980e94f4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug36071.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #36071 (Engine Crash related with 'clone') +--INI-- +error_reporting=4095 +--FILE-- +b = 0; +?> +--EXPECTF-- +Fatal error: __clone method called on non-object in %sbug36071.php on line 2 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug36214.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug36214.phpt new file mode 100755 index 0000000000000..dae25452cf8fb --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug36214.phpt @@ -0,0 +1,54 @@ +--TEST-- +Bug #36214 (__get method works properly only when conditional operator is used) +--SKIPIF-- + +--FILE-- +stack[$name] = $var;return; + } + + public function &__get($name) { + return $this->stack[$name]; + } +} + +$ctx = new context; +$ctx->comment_preview = array(); +$ctx->comment_preview[0] = 1; +$ctx->comment_preview[1] = 2; +var_dump($ctx->comment_preview); + +$comment_preview = array(); +$comment_preview[0] = 1; +$comment_preview[1] = 2; +$ctx->comment_preview = $comment_preview; +var_dump($ctx->comment_preview); + +$ctx->comment_preview = new ArrayObject(); +$ctx->comment_preview[0] = 1; +$ctx->comment_preview[1] = 2; +var_dump($ctx->comment_preview); +?> +--EXPECT-- +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +array(2) { + [0]=> + int(1) + [1]=> + int(2) +} +object(ArrayObject)#2 (2) { + [0]=> + int(1) + [1]=> + int(2) +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug36268.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug36268.phpt new file mode 100755 index 0000000000000..5276d50d48188 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug36268.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #36268 (Object destructors called even after fatal errors) +--FILE-- + +--EXPECTF-- +Fatal error: Call to undefined function bar() in %sbug36268.php on line 8 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug36303.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug36303.phpt new file mode 100755 index 0000000000000..13c21b7c5c214 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug36303.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #36303 (foreach on error_zval produces segfault) +--FILE-- +a->b as &$v) { +} +echo "ok\n"; +?> +--EXPECTF-- +Warning: Invalid argument supplied for foreach() in %sbug36303.php on line 3 +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug36513.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug36513.phpt new file mode 100755 index 0000000000000..2c8ca8450b771 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug36513.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #36513 (comment will be outputed in last line) +--FILE-- +5'); +echo "\n"; + +//test('5'); +?> +--EXPECT-- +135 +'5' diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug36568.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug36568.phpt new file mode 100755 index 0000000000000..0401d1e018d90 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug36568.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #36568 (memory_limit has no effect) +--SKIPIF-- + +--INI-- +memory_limit=16M +--FILE-- + +--EXPECT-- +32M diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug36759.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug36759.phpt new file mode 100755 index 0000000000000..8aa9977a0654d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug36759.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #36759 (Objects destructors are invoked in wrong order when script is finished) +--FILE-- +bar = $bar; + } + function __destruct() { + echo __METHOD__,"\n"; + unset($this->bar); + } +} + +class Bar { + function __destruct() { + echo __METHOD__,"\n"; + unset($this->bar); + } +} +$y = new Bar(); +$x = new Foo($y); +?> +--EXPECT-- +Foo::__destruct +Bar::__destruct diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug37046.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug37046.phpt new file mode 100755 index 0000000000000..8049944fffa73 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug37046.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #37046 (foreach breaks static scope) +--FILE-- + $function) { + echo "op1 $k\n"; + if ($k == 0) { + foreach (s() as $k => $function) { + echo "op2 $k\n"; + } + } +} +?> +--EXPECT-- +op1 0 +op2 0 +op2 1 +op1 1 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug37138.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug37138.phpt new file mode 100755 index 0000000000000..f8503f8da9560 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug37138.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #37138 (__autoload tries to load callback'ed self and parent) +--FILE-- + +--EXPECT-- +EHLO +EHLO +EHLO + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug37144.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug37144.phpt new file mode 100755 index 0000000000000..6191a29384b05 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug37144.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #37144 (PHP crashes trying to assign into property of dead object) +--FILE-- +bar = array(1); + return $x; +} +foo()->bar[1] = "123"; +foo()->bar[0]++; +unset(foo()->bar[0]); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug37212.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug37212.phpt new file mode 100755 index 0000000000000..81cc34fdb2e9a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug37212.phpt @@ -0,0 +1,55 @@ +--TEST-- +Bug #37212 (Access to protected property of common base class) +--FILE-- +value = $val; + } + + protected function getValue() + { + return $this->value; + } +} + +class B extends A +{ + public function copyValue($obj) + { + $this->value = $obj->getValue(); + $this->value = $obj->value; // value defined in common base class + } +} +class C extends A {} + +$B = new B("B"); +var_dump($B); +$C = new C("C"); +var_dump($C); + +$B->copyValue($C); + +var_dump($B); + +?> +===DONE=== +--EXPECTF-- +object(B)#%d (1) { + ["value:protected"]=> + string(1) "B" +} +object(C)#%d (1) { + ["value:protected"]=> + string(1) "C" +} +object(B)#%d (1) { + ["value:protected"]=> + string(1) "C" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug37632.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug37632.phpt new file mode 100755 index 0000000000000..fb72f893457f4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug37632.phpt @@ -0,0 +1,135 @@ +--TEST-- +Bug #37632 (Protected method access problem) +--FILE-- +test(); + } +} + +class C1 extends A1 +{ + protected function test() + { + echo __METHOD__ . "\n"; + } +} + +$b = new B1; +$b->doTest(new C1); + +class A2 +{ + static protected function test() + { + echo __METHOD__ . "\n"; + } +} + +class B2 extends A2 +{ + static public function doTest(A2 $obj) + { + echo __METHOD__ . "\n"; + $obj->test(); + } +} + +class C2 extends A2 +{ + static protected function test() + { + echo __METHOD__ . "\n"; + } +} + +B2::doTest(new C2); + +/* Right now Ctor's cannot be made protected when defined in a ctor. That is + * we cannot decrease visibility. + * + +interface Ctor +{ + function __construct($x); +} + +class A3 implements Ctor +{ + protected function __construct() + { + echo __METHOD__ . "\n"; + } +} + +class B3 extends A3 +{ + static public function doTest() + { + echo __METHOD__ . "\n"; + new C3; + } +} + +class C3 extends A3 +{ + protected function __construct() + { + echo __METHOD__ . "\n"; + } +} + +B3::doTest(); + +*/ + +class A4 +{ + protected function __construct() + { + echo __METHOD__ . "\n"; + } +} + +class B4 extends A4 +{ + static public function doTest() + { + echo __METHOD__ . "\n"; + new C4; + } +} + +class C4 extends A4 +{ + protected function __construct() + { + echo __METHOD__ . "\n"; + } +} + +B4::doTest(); + +?> +===DONE=== +--EXPECTF-- +B1::doTest +C1::test +B2::doTest +C2::test +B4::doTest + +Fatal error: Call to protected C4::__construct() from context 'B4' in %sbug37632.php on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug37667.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug37667.phpt new file mode 100755 index 0000000000000..b05f296f010bd --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug37667.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #37667 (Object is not added into array returned by __get) +--FILE-- + 'bar'); + + function __get($name) + { + return $this->property; + } +} + +$obj = new Test; + +var_dump($obj->property['foo']); +var_dump($obj->property[2]); + +var_dump($obj); + +$obj->property[] = 1; +$obj->property[] = 2; + +var_dump($obj); + +?> +===DONE=== +--EXPECTF-- +string(3) "bar" + +Notice: Undefined offset: 2 in %sbug37667.php on line 16 +NULL +object(Test)#%d (1) { + ["property:protected"]=> + array(1) { + ["foo"]=> + string(3) "bar" + } +} + +Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 20 + +Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 21 +object(Test)#%d (1) { + ["property:protected"]=> + array(1) { + ["foo"]=> + string(3) "bar" + } +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug37707.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug37707.phpt new file mode 100755 index 0000000000000..fdb972660d21a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug37707.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #37707 (clone without assigning leaks memory) +--FILE-- + +--EXPECT-- +clonned +NO LEAK + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug37715.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug37715.phpt new file mode 100755 index 0000000000000..b1845fed014e3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug37715.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #37715 (array pointers resetting on copy) +--FILE-- + array( + 'A', 'B', 'C', 'D', + ), + 'b' => array( + 'AA', 'BB', 'CC', 'DD', + ), +); + +// Set the pointer of $a to 'b' and the pointer of 'b' to 'CC' +reset($a); +next($a); +next($a['b']); +next($a['b']); +next($a['b']); + +var_dump(key($a['b'])); +foreach($a as $k => $d) +{ +} +// Alternatively $c = $a; and foreachloop removal will cause identical results. +var_dump(key($a['b'])); diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug37811.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug37811.phpt new file mode 100755 index 0000000000000..2b08d3326862d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug37811.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #37811 (define not using toString on objects) +--FILE-- + +===DONE=== +--EXPECTF-- +string(3) "Foo" + +Warning: Constants may only evaluate to scalar values in %sbug37811.php on line %d + +Notice: Use of undefined constant Baz - assumed 'Baz' in %sbug37811.php on line %d +string(3) "Baz" +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38047.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38047.phpt new file mode 100755 index 0000000000000..97db70450171e --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38047.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #38047 ("file" and "line" sometimes not set in backtrace from inside error handler) +--FILE-- + +--EXPECTF-- +Non-static method A::A_ftk() should not be called statically +1 %sbug38047.php:13 get_error_context() +2 %sbug38047.php:36 kalus_error_handler() +3 %sbug38047.php:36 A_ftk() + +Missing argument 1 for A::A_ftk(), called in %sbug38047.php on line 36 and defined +1 %sbug38047.php:13 get_error_context() +2 %sbug38047.php:7 kalus_error_handler() +3 %sbug38047.php:36 A_ftk() diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38146.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38146.phpt new file mode 100755 index 0000000000000..1f022f342cdb3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38146.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #38146 (Cannot use array returned from foo::__get('bar') in write context) +--FILE-- +"bar","bar"=>"foo"); + return $f; + } +} + +$f = new foo(); +foreach($f->bar as $key => $value) { + print "$key => $value\n"; +} +?> +--EXPECT-- +foo => bar +bar => foo diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38211.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38211.phpt new file mode 100755 index 0000000000000..4b088125a08f7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38211.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #38211 (variable name and cookie name match breaks script execution) +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38220.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38220.phpt new file mode 100755 index 0000000000000..3e1b2dc810a7c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38220.phpt @@ -0,0 +1,92 @@ +--TEST-- +Bug #38220 (Crash on some object operations) +--FILE-- +obj->i}\n"; + } + + function close() { + echo "close(): {$this->obj->i}\n"; + } +} + +class A { + public $i; + + function __construct($i) { + $this->i = $i; + + } + + function __call($method, $args) { + $drv = myserv::drv(); + + $drv->obj = $this; + + echo "before call $method\n"; + print_r($this); + call_user_func_array(array($drv, $method), $args); + echo "after call $method\n"; + + // Uncomment this line to work without crash +// $drv->obj = null; + } + + function __destruct() { + echo "A::__destruct()\n"; + $this->close(); + } +} + +class myserv { + private static $drv = null; + + static function drv() { + if (is_null(self::$drv)) + self::$drv = new drv; + return self::$drv; + } +} + +$obj1 = new A(1); +$obj1->func1(); + +$obj2 = new A(2); +unset($obj1); +$obj2->func1(); +?> +--EXPECT-- +before call func1 +A Object +( + [i] => 1 +) +func1(): 1 +after call func1 +A::__destruct() +before call close +A Object +( + [i] => 1 +) +close(): 1 +after call close +before call func1 +A Object +( + [i] => 2 +) +func1(): 1 +after call func1 +A::__destruct() +before call close +A Object +( + [i] => 2 +) +close(): 2 +after call close diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38234.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38234.phpt new file mode 100755 index 0000000000000..3374206670115 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38234.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #38234 (Exception in __clone makes memory leak) +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38287.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38287.phpt new file mode 100755 index 0000000000000..3052fc7f9fbfc --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38287.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #38287 (static variables mess up global vars) +--FILE-- +vars[]=1; + self::get_object()->vars[]=2; + self::get_object()->vars[]=3; + var_dump(self::get_object()->vars); + } +} +?> +--EXPECT-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +NULL diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38461.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38461.phpt new file mode 100644 index 0000000000000..281d999019f02 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38461.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #38461 (setting private attribute with __set() produces segfault) +--FILE-- +$var = $value; + } +} + +class ExtOperation extends Operation +{ + private $x; +} + +$op = new ExtOperation; +$op->x = 'test'; + +echo "Done\n"; +?> +--EXPECT-- +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38623.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38623.phpt new file mode 100755 index 0000000000000..8b03539dbaaf7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38623.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #38623 (leaks in a tricky code with switch() and exceptions) +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38624.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38624.phpt new file mode 100644 index 0000000000000..e6b09fd22bbf2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38624.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #38624 (Strange warning when incrementing an object property and exception is thrown from __get method) +--FILE-- +counter++; + } + public function __set( $name, $value ) + { +/// throw new Exception( "doesn't work" ); + } + + public function __get( $name ) + { +/// throw new Exception( "doesn't work" ); + } + +} + +$impl = new impl(); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Uncaught exception 'Exception' with message 'doesn't work' in %s:%d +Stack trace: +#0 %s(%d): impl->__get('counter') +#1 %s(%d): impl->__construct() +#2 {main} + thrown in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38772.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38772.phpt new file mode 100755 index 0000000000000..39f266d16df3a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38772.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #38772 (inconsistent overriding of methods in different visibility contexts) +--FILE-- + foo(); + } + + private function foo() { + echo __METHOD__ . "\r\n"; + } +} + +class B extends A { + public function foo() { + echo __METHOD__ . "\r\n"; + } +} + +class C extends A { + protected function foo() { + echo __METHOD__ . "\r\n"; + } +} + +class D extends A { + private function foo() { + echo __METHOD__ . "\r\n"; + } +} + +$a = new A(); +$b = new B(); +$c = new C(); +$d = new D(); diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38779.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38779.phpt new file mode 100644 index 0000000000000..14d7b15747c03 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38779.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #38779 (engine crashes when require()'ing file with syntax error through userspace stream wrapper) +--FILE-- +data = '<' . "?php \n\"\";ll l\n ?" . '>'; + $this->position = 0; + return true; + } + function stream_read($count) { + $ret = substr($this->data, $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + function stream_eof() { + return $this->position >= strlen($this->data); + } +} +stream_wrapper_register('Loader', 'Loader'); +///require 'Loader://qqq.php'; + +echo "Done\n"; +?> +--EXPECTF-- +Parse error: %s error%sin Loader://qqq.php on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38779_1.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38779_1.phpt new file mode 100644 index 0000000000000..eefa952e366b6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38779_1.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #38779 (engine crashes when require()'ing file with syntax error through userspace stream wrapper) +--FILE-- +data = '<' . "?php \n\"\";ll l\n ?" . '>'; + $this->position = 0; + return true; + } + function stream_read($count) { + $ret = substr($this->data, $this->position, $count); + $this->position += strlen($ret); + return $ret; + } + function stream_eof() { + return $this->position >= strlen($this->data); + } + function stream_flush() { + @unlink(dirname(__FILE__)."/bug38779.txt"); + var_dump("flush!"); + } + function stream_close() { + var_dump("close!"); + } +} +stream_wrapper_register('Loader', 'Loader'); +$fp = fopen ('Loader://qqq.php', 'r'); + +$filename = dirname(__FILE__)."/bug38779.txt"; +$fp1 = fopen($filename, "w"); +fwrite($fp1, "<"."?php blah blah?".">"); +fclose($fp1); + +include $filename; + +echo "Done\n"; +?> +--EXPECTF-- +Parse error: %s error%sin %s on line %d +string(6) "flush!" +string(6) "close!" diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38808.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38808.phpt new file mode 100755 index 0000000000000..0fc4bfecdc19f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38808.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #38808 ("maybe ref" issue for current() and others) +--FILE-- +'one', 2=>'two'); +$a =& $b; + +echo $current($a)."\n"; +$next($a); +echo $current($a)."\n"; +?> +--EXPECT-- +one +two \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug38942.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug38942.phpt new file mode 100755 index 0000000000000..5b86e15d717f6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug38942.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #38942 (Double old-style-ctor inheritance) +--FILE-- + +--EXPECT-- +Array +( + [0] => foo +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39003.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39003.phpt new file mode 100644 index 0000000000000..7a3da849bd4af --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39003.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #39003 (__autoload() is called for type hinting) +--FILE-- + +--EXPECTF-- +Catchable fatal error: Argument 1 passed to test() must be an instance of OtherClassName, instance of ClassName given, called in %s on line %d and defined in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39017.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39017.phpt new file mode 100755 index 0000000000000..f38b9a310d3ab --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39017.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #39017 (foreach(($obj = new myClass) as $v); echo $obj; segfaults) +--FILE-- + +--EXPECTF-- +object(A)#%d (0) { +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39036.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39036.phpt new file mode 100644 index 0000000000000..017012fddf405 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39036.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #39036 (Unsetting key of foreach() yields segmentation fault) +--FILE-- + $value) { + unset($$key); +} + +var_dump($key); + +echo "Done\n"; +?> +--EXPECTF-- +Notice: Undefined variable: key in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39297.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39297.phpt new file mode 100755 index 0000000000000..01e3f9172488b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39297.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #39297 (Memory corryption because of indirect modification of overloaded array) +--FILE-- +children[$cannonicalName] = $value; + $value->parent = $this; + } + + public function offsetGet($offset) { + echo "offsetGet()\n"; + $cannonicalName = strtolower($offset); + return $this->children[$cannonicalName]; + } + +} + +$id = 'Test'; + +$root = new MyTree(); +$child = new MyTree(); +$root[$id] = $child; + +var_dump(compareByRef($root[$id], $child)); +?> +--EXPECT-- +offsetSet() +offsetGet() +bool(true) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39304.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39304.phpt new file mode 100755 index 0000000000000..5529d700ddb80 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39304.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #39304 (Segmentation fault with list unpacking of string offset) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use string offset as an array in %sbug39304.php on line 3 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39438.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39438.phpt new file mode 100755 index 0000000000000..2dac58ac6154d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39438.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #39438 (Fatal error: Out of memory) +--INI-- +memory_limit=16M +--FILE-- + array( + 'downloadcounter' => 2777, + 'versions' => array( + '0.1.0' => array ( + 'title' => 'A1 Teasermenu', + 'description' => 'Displays a teaser for advanced subpages or a selection of advanced pages', + 'state' => 'stable', + 'reviewstate' => 0, + 'category' => 'plugin', + 'downloadcounter' => 2787, + 'lastuploaddate' => 1088427240, + 'dependencies' => array ( + 'depends' => array( + 'typo3' =>'', + 'php' =>'', + 'cms' => '' + ), + 'conflicts' => array('' =>'') + ), + 'authorname' => 'Mirko Balluff', + 'authoremail' => 'balluff@amt1.de', + 'ownerusername' => 'amt1', + 't3xfilemd5' => '3a4ec198b6ea8d0bc2d69d9b7400398f', + ) + ) + ) +); +$test=array(); +while($i<1200) { + $test[]=$test2; + $i++; +} +$out=serialize($test); +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39445.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39445.phpt new file mode 100755 index 0000000000000..87f5f03ff898c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39445.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #39445 (Calling debug_backtrace() in the __toString() function produces a crash) +--FILE-- + +--EXPECT-- +LOWERCASE diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39449.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39449.phpt new file mode 100755 index 0000000000000..725c0d47b3d23 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39449.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #39449 (Overloaded array properties do not work correctly) +--FILE-- +keys[$val]; + } + public function __set($k, $v) { + $this->keys[$k] = $v; + } +} + +$a =new A(); +$a->arr = array('a','b','c'); + +$b = &$a->arr; +$b[]= 'd'; + +foreach ($a->arr as $k => $v) { + echo "$k => $v\n"; +} + +$a->arr[]='d'; + +foreach ($a->arr as $k => $v) { + echo "$k => $v\n"; +} +?> +--EXPECT-- +0 => a +1 => b +2 => c +3 => d +0 => a +1 => b +2 => c +3 => d +4 => d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39542.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39542.phpt new file mode 100755 index 0000000000000..1b8ae3360f850 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39542.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #39542 (Behaviour of require_once/include_once different to < 5.2.0) +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39542/bug39542.php b/phpt/tests/php-5.2.5/Zend/tests/bug39542/bug39542.php new file mode 100755 index 0000000000000..1109517663c45 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39542/bug39542.php @@ -0,0 +1,7 @@ + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39602.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39602.phpt new file mode 100755 index 0000000000000..daa10e4fdb462 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39602.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #39602 (Invalid session.save_handler crashes PHP) +--SKIPIF-- + +--INI-- +session.save_handler=qwerty +error_reporting=0 +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39721.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39721.phpt new file mode 100755 index 0000000000000..63edfc23ed062 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39721.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #39721 (Runtime inheritance causes data corruption) +--FILE-- +instance = ++self::$instances; + } + +} + +$foo = new test2(); + +if (is_object($foo)) { + class test2_child extends test2 { + + } +} + +$child = new test2_child(); + +echo $foo->instance . "\n"; +echo $child->instance . "\n"; +?> +--EXPECT-- +1 +2 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39775.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39775.phpt new file mode 100755 index 0000000000000..b06797df8a45f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39775.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #39775 ("Indirect modification ..." message is not shown) +--FILE-- +array; + return $this->array; + } +} +$t = new test; +$t->anything[] = 'bar'; +print_r($t->anything); +?> +--EXPECTF-- +Notice: Indirect modification of overloaded property test::$anything has no effect in %sbug39775.php on line 10 +Array +( +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39825.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39825.phpt new file mode 100755 index 0000000000000..294b32d872f1d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39825.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #39825 (foreach produces memory error) +--FILE-- + 2, "foo" => "bar"); +$obj = (object)$array; +foreach ($obj as $name => $value) { + echo "$name -> $value\n"; +} +?> +--EXPECT-- +1 -> 2 +foo -> bar diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39944.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39944.phpt new file mode 100755 index 0000000000000..4249988ffd9c6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39944.phpt @@ -0,0 +1,88 @@ +--TEST-- +Bug #39944 (References broken) +--FILE-- +addToArray($this->getArray(), $strToAdd); + } + + function &getArray() { + if (!$this->arr) + $this->arr = array(); + return $this->arr; + } + + private function addToArray(&$arr, $strToAdd) { + $arr[] = $strToAdd; + } +} + +$objRefTest = new RefTest(); +$objRefTest->Add("xx1"); +$objRefTest->Add("xx2"); +$objRefTest->Add("xx3"); + +echo "objRefTest->getArray() = " . print_r($objRefTest->getArray(), 1); +?> +--EXPECT-- +intTheValue = 10 +intTheValue = 10 +arrTheArray = Array +( + [0] => xx1 + [1] => xx3 + [2] => xx4 +) +objRefTest->getArray() = Array +( + [0] => xx1 + [1] => xx2 + [2] => xx3 +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug39990.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug39990.phpt new file mode 100755 index 0000000000000..b2df0b5403bb3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug39990.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #39990 (Cannot "foreach" over overloaded properties) +--FILE-- +arr as $value) + echo "$value\n"; +?> +--EXPECT-- +Hello +World diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40236.inc b/phpt/tests/php-5.2.5/Zend/tests/bug40236.inc new file mode 100755 index 0000000000000..0fbbfc9ff9031 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40236.inc @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40236.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40236.phpt new file mode 100755 index 0000000000000..dfaa51f8de853 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40236.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #40236 (php -a function allocation eats memory) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Interactive %s + +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40261.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40261.phpt new file mode 100755 index 0000000000000..93a5557088c33 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40261.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #40261 (Extremely slow data handling due to memory fragmentation) +--INI-- +memory_limit=128M +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40509.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40509.phpt new file mode 100755 index 0000000000000..4e7de691ee955 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40509.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #40509 (key() function changed behaviour if global array is used within function) +--FILE-- + $v) { + var_dump($k); +} +var_dump(key($arr["v"])); diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40621.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40621.phpt new file mode 100644 index 0000000000000..60cb3477c21c9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40621.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #40621 (Crash when constructor called inappropriately (statically)) +--FILE-- + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40705.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40705.phpt new file mode 100755 index 0000000000000..940285f1d7353 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40705.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #40705 (Iterating within function moves original array pointer) +--FILE-- + $v) { + // do stuff + } +} + +$foo = array('foo', 'bar', 'baz'); +var_dump(key($foo)); +doForeach($foo); +var_dump(key($foo)); +foreach ($foo as $k => $v) { + var_dump($k); +} +var_dump(key($foo)); diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40757.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40757.phpt new file mode 100755 index 0000000000000..d413b10224876 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40757.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #40757 (get_object_vars() get nothing in child class) +--FILE-- +getFields(new Base())); +$child=new Child(); +print_r($child->getFields(new Base())); +?> +--EXPECT-- +Array +( + [p1] => sadf +) +Array +( + [p1] => sadf +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40770.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40770.phpt new file mode 100755 index 0000000000000..432a27aea163f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40770.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #40770 (Apache child exits when PHP memory limit reached) +--INI-- +memory_limit=8M +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Allowed memory size of 8388608 bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40784.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40784.phpt new file mode 100644 index 0000000000000..6da8f2a16ba12 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40784.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #40784 (Case sensivity in constructor's fallback) +--FILE-- + +--EXPECTF-- +I'm A +I'm A +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40809.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40809.phpt new file mode 100755 index 0000000000000..a90754d914a2a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40809.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #40809 (Poor perfomance of ".=") +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40815.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40815.phpt new file mode 100644 index 0000000000000..6f7477a9ebc9a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40815.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #40815 (using strings like "class::func" and static methods in set_exception_handler() might result in crash). +--FILE-- + +--EXPECTF-- +foo diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40833.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40833.phpt new file mode 100755 index 0000000000000..c56ca4c3ba377 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40833.phpt @@ -0,0 +1,72 @@ +--TEST-- +Bug #40833 (Crash when using unset() on an ArrayAccess object retrieved via __get) +--FILE-- +data[$name]) ) + return $this->data[$name]; + else + return $this->data[$name] = new set($this); + } + + function __set($name, $value) + { + $this->modified[$name] = $value; + } + } + + class set implements ArrayAccess + { + private $entity; + + function __construct($entity) + { + $this->entity = $entity; + $this->entity->whatever = $this; + } + + function clear() { + $this->entity->whatever = null; + } + + function offsetUnset($offset) + { + $this->clear(); +// $this->entity->{$this->name} = null; + } + + function offsetSet($offset, $value) + { + } + + function offsetGet($offset) + { + return 'Bogus '; + } + + function offsetExists($offset) + { + } + } + + $entity = new entity(); + echo($entity->whatever[0]); + + //This will crash +// $entity->whatever->clear(); + unset($entity->whatever[0]); + + //This will not crash (comment previous & uncomment this to test +// $test = $entity->whatever; unset($test[0]); + + echo($entity->whatever[0]); + echo "ok\n"; +?> +--EXPECT-- +Bogus Bogus ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug40899.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug40899.phpt new file mode 100644 index 0000000000000..7be0f6b8e9cb6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug40899.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #40899 (memory leak when nesting list()) +--FILE-- + +--EXPECT-- +abc diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41026.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41026.phpt new file mode 100644 index 0000000000000..7caac215e05ac --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41026.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #41026 (segfault when calling "self::method()" in shutdown functions) +--FILE-- + +--EXPECTF-- +Done + +Warning: (Registered shutdown functions) Unable to call self::on_shutdown() - function does not exist in Unknown on line 0 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41075.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41075.phpt new file mode 100644 index 0000000000000..0751cbd6904c5 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41075.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #41075 (memleak when creating default object caused exception) +--FILE-- +blah->prop = "string"; + var_dump($this->blah); + } +} + +$t = new test; +try { + $t->foo(); +} catch (Exception $e) { + var_dump($e->getMessage()); +} + +echo "Done\n"; +?> +--EXPECTF-- +string(40) "Creating default object from empty value" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41117_1.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41117_1.phpt new file mode 100755 index 0000000000000..f555b637ad80a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41117_1.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #41117 (Altering $this via argument) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot re-assign $this in %sbug41117_1.php on line 3 + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41209.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41209.phpt new file mode 100644 index 0000000000000..0834b376b2218 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41209.phpt @@ -0,0 +1,46 @@ +--TEST-- +Bug #41209 (Segmentation fault with ArrayAccess, set_error_handler and undefined var) +--FILE-- +containers[(string) $id]); + } +} + +$env = new env(); +$cache = new cache(); +var_dump(isset($cache[$id])); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Uncaught exception 'ErrorException' with message 'Undefined variable: id' in %s:%d +Stack trace: +#0 %s(%d): env::errorHandler() +#1 {main} + thrown in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41351.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41351.phpt new file mode 100644 index 0000000000000..62af6a03366f3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41351.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #41351 (Invalid opcode with foreach ($a[] as $b)) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use [] for reading in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41351_2.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41351_2.phpt new file mode 100644 index 0000000000000..7009eaa457ee4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41351_2.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #41351 (Invalid opcode with foreach ($a[] as $b)) - 2 +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use [] for reading in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41351_3.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41351_3.phpt new file mode 100644 index 0000000000000..9cb23882c20e8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41351_3.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #41351 (Invalid opcode with foreach ($a[] as $b)) - 3 +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use [] for reading in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41372.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41372.phpt new file mode 100755 index 0000000000000..090efcd310155 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41372.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #41372 Internal pointer of source array resets during array copying +--FILE-- + +--EXPECT-- +2 +2 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41401.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41401.phpt new file mode 100755 index 0000000000000..fa3309cb73060 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41401.phpt @@ -0,0 +1,7 @@ +--TEST-- +Bug #41401 (wrong precedence for unary minus) +--FILE-- + +--EXPECTF-- +Warning: feof(): wrapper::stream_eof is not implemented! Assuming EOF in %s on line %d + +Fatal error: Uncaught exception 'Exception' in %s:%d +Stack trace: +#0 [internal function]: wrapper->stream_eof() +#1 %s(%d): feof(Resource id #6) +#2 {main} + thrown in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41633_1.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41633_1.phpt new file mode 100755 index 0000000000000..fbd27418c70b3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41633_1.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #41633.1 (self:: doesn't work for constants) +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41633_2.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41633_2.phpt new file mode 100755 index 0000000000000..1aa76be21100c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41633_2.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #41633.2 (Undefined class constants must not be substituted by strings) +--FILE-- + +--EXPECTF-- +Fatal error: Undefined class constant 'self::B' in %sbug41633_2.php on line 5 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41633_3.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41633_3.phpt new file mode 100755 index 0000000000000..9b537fe35d523 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41633_3.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #41633.3 (Crash instantiating classes with self-referencing constants) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot declare self-referencing constant 'Foo::B' in %sbug41633_3.php on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41633_4.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41633_4.phpt new file mode 100755 index 0000000000000..16e58954df917 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41633_4.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #41633.4 (self:: doesn't work for constants) +--FILE-- + +--EXPECT-- +bool(true) diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41640.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41640.phpt new file mode 100644 index 0000000000000..c859d90850d66 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41640.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #41640 (get_class_vars produces error on class constants) +--FILE-- + + int(1) +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41813.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41813.phpt new file mode 100644 index 0000000000000..c330b14fe8a41 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41813.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #41813 (segmentation fault when using string offset as an object) +--FILE-- +bar = "xyz"; + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Cannot use string offset as an array in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41919.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41919.phpt new file mode 100644 index 0000000000000..127eb97bc16b8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41919.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #41919 (crash in string to array conversion) +--FILE-- +bar[1] = "bang"; + +echo "ok\n"; +?> +--EXPECTF-- +Warning: Cannot use string offset as an array in %s/bug41919.php on line %d +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41929.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41929.phpt new file mode 100755 index 0000000000000..7fa4bbcc849fc --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41929.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #41929 (Foreach on object does not iterate over all visible properties) +--FILE-- +priv,"\n"; + foreach ($this as $k=>$v) { + echo "$k: $v\n"; + } + } +} + +class D extends C { +} + +$myD = new D; +$myD->doLoop(); +?> +--EXPECT-- +ok +priv: ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug41961.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug41961.phpt new file mode 100755 index 0000000000000..1a6e523083770 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug41961.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #41961 (Ensure search for hidden private methods does not stray from class hierarchy) +--FILE-- +secret(); // bug - invokes X::secret() instead of ChildClass::secret() + } + private function secret() { + echo "Called private " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n"; + } +} + +class ParentClass { + private function secret() { } +} + +class ChildClass extends ParentClass { + public function secret() { + echo "Called public " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n"; + } +} +?> +--EXPECT-- +Called public ChildClass::secret() on an instance of: ChildClass diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug42119.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug42119.phpt new file mode 100755 index 0000000000000..79d70f0aede5b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug42119.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #42119 (array_push($arr,&$obj) doesn't work with zend.ze1_compatibility_mode On) +--INI-- +allow_call_time_pass_reference=1 +zend.ze1_compatibility_mode=1 +--FILE-- +item = 2; +echo $arr[0]->item,"\n"; +?> +--EXPECT-- +2 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug42211.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug42211.phpt new file mode 100644 index 0000000000000..e9f2a1e212453 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug42211.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #42211 (property_exists() fails to find protected properties from a parent class) +--FILE-- +foo(); +$b = new B(); +$b->foo(); +--EXPECT-- +bool(true) +bool(false) +bool(false) +bool(true) +bool(true) +bool(false) + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug42767.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug42767.phpt new file mode 100644 index 0000000000000..0de4dba5fb169 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug42767.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #42767 (highlight_string() truncates trailing comments) +--FILE-- + +--EXPECT-- + +<?php /*some comment.. + + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug42772.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug42772.phpt new file mode 100755 index 0000000000000..8887bdbd7e9e4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug42772.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #42772 (Storing $this in a static var fails while handling a cast to string) +--FILE-- + +--EXPECT-- +object(Foo)#1 (0) { +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug42817.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug42817.phpt new file mode 100644 index 0000000000000..b1beca4d0aef0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug42817.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #42817 (clone() on a non-object does not result in a fatal error) +--FILE-- +b, $c); +?> +--EXPECTF-- +Fatal error: __clone method called on non-object in %sbug42817.php on line 2 diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug42818.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug42818.phpt new file mode 100644 index 0000000000000..09ad693b44adc --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug42818.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #42818 ($foo = clone(array()); leaks memory) +--FILE-- + +--EXPECTF-- +Fatal error: __clone method called on non-object in %sbug42818.php on line 2 + diff --git a/phpt/tests/php-5.2.5/Zend/tests/bug_debug_backtrace.phpt b/phpt/tests/php-5.2.5/Zend/tests/bug_debug_backtrace.phpt new file mode 100755 index 0000000000000..3e4a0ec94667a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/bug_debug_backtrace.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug - crash in debug_backtrace when trace starts in eval +--FILE-- + +===DONE=== +--EXPECTF-- +#0 boo() called at [%s:%d] +#1 bar() called at [%s:%d] +#2 foo() called at [%s(%d) : eval()'d code:1] +#3 eval() called at [%s:%d] +Done +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/cast_to_array.phpt b/phpt/tests/php-5.2.5/Zend/tests/cast_to_array.phpt new file mode 100644 index 0000000000000000000000000000000000000000..5e351052bbba16c3ce4ef3f618256e4b332f8cf6 GIT binary patch literal 986 zcmah|+iKh}5ZzbnD+aLzIjoB>dr8Rcq1`}XDTQpI&=jNf%2|U~GP0Z!LjJuoayL!_ zNnSMa(V3$;GgcI>m)GkkVufs7rEg(dm8G&uJGhg!lABt!;0#D>D2-LJ*n#NlkgfOTs~@|4gM|sN9@05_z%}1?`$o_y3ZNrZ>;%i&NG{I)MWi7+B-O6Fqxrm?V*k9Z32P5RiHx9e`{Qd)2UwF}3jH ze4j#-9vCkwdZlPpYdTvf@o5`^DZ$-03Iq;D$^D>ku)#<4SVr_f_)u@}h$EUlLwj3% PbVT&**@3r5KMMN?X`u(3 literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/Zend/tests/cast_to_bool.phpt b/phpt/tests/php-5.2.5/Zend/tests/cast_to_bool.phpt new file mode 100644 index 0000000000000..75ab09d1b5ef4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/cast_to_bool.phpt @@ -0,0 +1,53 @@ +--TEST-- +casting different variables to boolean +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) +bool(false) +bool(true) +bool(true) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(true) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/cast_to_double.phpt b/phpt/tests/php-5.2.5/Zend/tests/cast_to_double.phpt new file mode 100644 index 0000000000000..a5b9819b02c55 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/cast_to_double.phpt @@ -0,0 +1,57 @@ +--TEST-- +casting different variables to double +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +float(0) +float(8754456) +float(0) +float(0) +float(9876545) +float(0.1) +float(0) +float(1) +float(0) +float(1) +float(0) +float(%d) + +Notice: Object of class test could not be converted to double in %s on line %d +float(1) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/cast_to_int.phpt b/phpt/tests/php-5.2.5/Zend/tests/cast_to_int.phpt new file mode 100644 index 0000000000000..28c57ddf63b94 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/cast_to_int.phpt @@ -0,0 +1,55 @@ +--TEST-- +casting different variables to integer +--FILE-- + +--EXPECTF-- +int(0) +int(8754456) +int(0) +int(0) +int(9876545) +int(0) +int(0) +int(1) +int(0) +int(1) +int(0) +int(%d) + +Notice: Object of class test could not be converted to int in %s on line %d +int(1) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/cast_to_object.phpt b/phpt/tests/php-5.2.5/Zend/tests/cast_to_object.phpt new file mode 100644 index 0000000000000000000000000000000000000000..f8d4878475e44bde9f381693eef581bfe28f8979 GIT binary patch literal 1106 zcmbVLZA-&25cX^HD~`B93ahkxRebxP8wf)LCkQGfYg1S0l9Hr~$o{*RcD{UY!uBP1 zz4UqRp1VsB%*MB~ARq}hHkZ$k=2<4RkQQFK&iT9$2CM=#e-ViV5(Ja0=@|b%IWHF_ zAuSE3kf~Bg7RT-?jypg#^^XZj3T_ZAjD-*4WtB{9t|UMlTXkzSW@Em)@wBj&mO!JB z9usdxR>-T6SBke9j$AFQ#$bqR&EFaEsHq8P2i?Qbpx+-1Yrj4oLuZZ-N5esXfL?eI zg=iYA|LsMcZl~uyGhP^h*6PZc>$~X`O-s8&5ho>6TJU56tf_+=a86x)%PvbSj5Qtd zT^vQ=8K>2mF`EQ|M;bgcHob6t^Y_~+u*jtV zc%UZX1=sZH^b9{6?QH17R~wLjd;AFTU%lIjAVdPX6B2dNy)B`+v}`?7f4ihvp}1wZ z1sidwOI^A=oWV)?mumR7o&wy hl}-d}r#`3*?0YEyHxu8$@>d%7vYRzsr*OMXJ^}pmH5cO;GD~{Sh3$3)f?w|L zz01Acy9U7~S#N@XWK`*rzd~LX1(S?xc%!nUFMFmy3s72`E(wC=-73NN7mI3F5#mU= zghEt|yJ>1#Y3hS5ZEsFUwx!>MGoyU#~k+VAxAvo!g zdH(Ia=SIlk6?z;azBZ@)hxzk~pYdO`%49Xl%2YD|$#2)@uVr-Kygbu37 literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/Zend/tests/catch.phpt b/phpt/tests/php-5.2.5/Zend/tests/catch.phpt new file mode 100755 index 0000000000000..624039afa2a56 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/catch.phpt @@ -0,0 +1,23 @@ +--TEST-- +catch shouldn't call __autoload +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/catch_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/catch_002.phpt new file mode 100755 index 0000000000000..73fa97b0a4f40 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/catch_002.phpt @@ -0,0 +1,33 @@ +--TEST-- +Catching an exception in a constructor +--FILE-- + +===DONE=== +--EXPECT-- +Caught +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/catch_003.phpt b/phpt/tests/php-5.2.5/Zend/tests/catch_003.phpt new file mode 100755 index 0000000000000..9210e3f1f19f9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/catch_003.phpt @@ -0,0 +1,38 @@ +--TEST-- +Catching an exception in a constructor fired form a static method +--FILE-- + +===DONE=== +--EXPECT-- +Caught +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/catch_004.phpt b/phpt/tests/php-5.2.5/Zend/tests/catch_004.phpt new file mode 100755 index 0000000000000..f1df067881304 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/catch_004.phpt @@ -0,0 +1,43 @@ +--TEST-- +Catching an exception in a constructor inside a static method +--FILE-- + +===DONE=== +--EXPECT-- +Caught +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/class_constants_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/class_constants_001.phpt new file mode 100644 index 0000000000000..45270f6f73071 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/class_constants_001.phpt @@ -0,0 +1,22 @@ +--TEST-- +class constants basic tests +--FILE-- + +--EXPECTF-- +string(6) "string" +int(1) + +Fatal error: Undefined class constant 'val3' in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/class_constants_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/class_constants_002.phpt new file mode 100644 index 0000000000000..9aad8088da800 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/class_constants_002.phpt @@ -0,0 +1,31 @@ +--TEST-- +class constants as default function arguments +--FILE-- + +--EXPECTF-- +int(1) +int(5) +int(10) + +Fatal error: Class 'NoSuchClass' not found in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/class_constants_003.phpt b/phpt/tests/php-5.2.5/Zend/tests/class_constants_003.phpt new file mode 100644 index 0000000000000..c2782ff1c99ef --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/class_constants_003.phpt @@ -0,0 +1,33 @@ +--TEST-- +class constants as default function arguments and dynamically loaded classes +--FILE-- + +DATA; + +$filename = dirname(__FILE__)."/cc003.dat"; +file_put_contents($filename, $class_data); + +function foo($v = test::val) { + var_dump($v); +} + +include $filename; + +foo(); +foo(5); + +unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +int(1) +int(5) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_001.phpt new file mode 100644 index 0000000000000..1d42c637d6cfb --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_001.phpt @@ -0,0 +1,389 @@ +--TEST-- +comparing different variables for equality +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(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)} != string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} == bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != object(stdClass)#1 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != object(stdClass)#2 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != object(test)#3 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != int(-2147483648) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != string(11) "-2147483648" +string(0) "" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" == string(0) "" +string(0) "" != int(1) +string(0) "" != float(2.5) +string(0) "" == int(0) +string(0) "" != string(6) "string" +string(0) "" != string(3) "123" +string(0) "" != string(3) "2.5" +string(0) "" == NULL +string(0) "" != bool(true) +string(0) "" == bool(false) +string(0) "" != object(stdClass)#1 (0) {} +string(0) "" != object(stdClass)#2 (0) {} +string(0) "" != object(test)#3 (0) {} +string(0) "" != array(0) {} +string(0) "" != int(-2147483648) +string(0) "" != string(11) "-2147483648" +int(1) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) != string(0) "" +int(1) == int(1) +int(1) != float(2.5) +int(1) != int(0) +int(1) != string(6) "string" +int(1) != string(3) "123" +int(1) != string(3) "2.5" +int(1) != NULL +int(1) == bool(true) +int(1) != bool(false) +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + == object(stdClass)#1 (0) {} +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + == object(stdClass)#2 (0) {} +int(1) +Notice: Object of class test could not be converted to int in %s on line %d + == object(test)#3 (0) {} +int(1) != array(0) {} +int(1) != int(-2147483648) +int(1) != string(11) "-2147483648" +float(2.5) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) != string(0) "" +float(2.5) != int(1) +float(2.5) == float(2.5) +float(2.5) != int(0) +float(2.5) != string(6) "string" +float(2.5) != string(3) "123" +float(2.5) == string(3) "2.5" +float(2.5) != NULL +float(2.5) == bool(true) +float(2.5) != bool(false) +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + != object(stdClass)#1 (0) {} +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + != object(stdClass)#2 (0) {} +float(2.5) +Notice: Object of class test could not be converted to double in %s on line %d + != object(test)#3 (0) {} +float(2.5) != array(0) {} +float(2.5) != int(-2147483648) +float(2.5) != string(11) "-2147483648" +int(0) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) == string(0) "" +int(0) != int(1) +int(0) != float(2.5) +int(0) == int(0) +int(0) == string(6) "string" +int(0) != string(3) "123" +int(0) != string(3) "2.5" +int(0) == NULL +int(0) != bool(true) +int(0) == bool(false) +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + != object(stdClass)#1 (0) {} +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + != object(stdClass)#2 (0) {} +int(0) +Notice: Object of class test could not be converted to int in %s on line %d + != object(test)#3 (0) {} +int(0) != array(0) {} +int(0) != int(-2147483648) +int(0) != string(11) "-2147483648" +string(6) "string" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" != string(0) "" +string(6) "string" != int(1) +string(6) "string" != float(2.5) +string(6) "string" == int(0) +string(6) "string" == string(6) "string" +string(6) "string" != string(3) "123" +string(6) "string" != string(3) "2.5" +string(6) "string" != NULL +string(6) "string" == bool(true) +string(6) "string" != bool(false) +string(6) "string" != object(stdClass)#1 (0) {} +string(6) "string" != object(stdClass)#2 (0) {} +string(6) "string" != object(test)#3 (0) {} +string(6) "string" != array(0) {} +string(6) "string" != int(-2147483648) +string(6) "string" != string(11) "-2147483648" +string(3) "123" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" != string(0) "" +string(3) "123" != int(1) +string(3) "123" != float(2.5) +string(3) "123" != int(0) +string(3) "123" != string(6) "string" +string(3) "123" == string(3) "123" +string(3) "123" != string(3) "2.5" +string(3) "123" != NULL +string(3) "123" == bool(true) +string(3) "123" != bool(false) +string(3) "123" != object(stdClass)#1 (0) {} +string(3) "123" != object(stdClass)#2 (0) {} +string(3) "123" != object(test)#3 (0) {} +string(3) "123" != array(0) {} +string(3) "123" != int(-2147483648) +string(3) "123" != string(11) "-2147483648" +string(3) "2.5" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" != string(0) "" +string(3) "2.5" != int(1) +string(3) "2.5" == float(2.5) +string(3) "2.5" != int(0) +string(3) "2.5" != string(6) "string" +string(3) "2.5" != string(3) "123" +string(3) "2.5" == string(3) "2.5" +string(3) "2.5" != NULL +string(3) "2.5" == bool(true) +string(3) "2.5" != bool(false) +string(3) "2.5" != object(stdClass)#1 (0) {} +string(3) "2.5" != object(stdClass)#2 (0) {} +string(3) "2.5" != object(test)#3 (0) {} +string(3) "2.5" != array(0) {} +string(3) "2.5" != int(-2147483648) +string(3) "2.5" != string(11) "-2147483648" +NULL != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL == string(0) "" +NULL != int(1) +NULL != float(2.5) +NULL == int(0) +NULL != string(6) "string" +NULL != string(3) "123" +NULL != string(3) "2.5" +NULL == NULL +NULL != bool(true) +NULL == bool(false) +NULL != object(stdClass)#1 (0) {} +NULL != object(stdClass)#2 (0) {} +NULL != object(test)#3 (0) {} +NULL == array(0) {} +NULL != int(-2147483648) +NULL != string(11) "-2147483648" +bool(true) == array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) != string(0) "" +bool(true) == int(1) +bool(true) == float(2.5) +bool(true) != int(0) +bool(true) == string(6) "string" +bool(true) == string(3) "123" +bool(true) == string(3) "2.5" +bool(true) != NULL +bool(true) == bool(true) +bool(true) != bool(false) +bool(true) == object(stdClass)#1 (0) {} +bool(true) == object(stdClass)#2 (0) {} +bool(true) == object(test)#3 (0) {} +bool(true) != array(0) {} +bool(true) == int(-2147483648) +bool(true) == string(11) "-2147483648" +bool(false) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) == string(0) "" +bool(false) != int(1) +bool(false) != float(2.5) +bool(false) == int(0) +bool(false) != string(6) "string" +bool(false) != string(3) "123" +bool(false) != string(3) "2.5" +bool(false) == NULL +bool(false) != bool(true) +bool(false) == bool(false) +bool(false) != object(stdClass)#1 (0) {} +bool(false) != object(stdClass)#2 (0) {} +bool(false) != object(test)#3 (0) {} +bool(false) == array(0) {} +bool(false) != int(-2147483648) +bool(false) != string(11) "-2147483648" +object(stdClass)#1 (0) {} != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#1 (0) {} != string(0) "" +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + == int(1) +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + != float(2.5) +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + != int(0) +object(stdClass)#1 (0) {} != string(6) "string" +object(stdClass)#1 (0) {} != string(3) "123" +object(stdClass)#1 (0) {} != string(3) "2.5" +object(stdClass)#1 (0) {} != NULL +object(stdClass)#1 (0) {} == bool(true) +object(stdClass)#1 (0) {} != bool(false) +object(stdClass)#1 (0) {} == object(stdClass)#1 (0) {} +object(stdClass)#1 (0) {} == object(stdClass)#2 (0) {} +object(stdClass)#1 (0) {} != object(test)#3 (0) {} +object(stdClass)#1 (0) {} != array(0) {} +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + != int(-2147483648) +object(stdClass)#1 (0) {} != string(11) "-2147483648" +object(stdClass)#2 (0) {} != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#2 (0) {} != string(0) "" +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + == int(1) +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + != float(2.5) +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + != int(0) +object(stdClass)#2 (0) {} != string(6) "string" +object(stdClass)#2 (0) {} != string(3) "123" +object(stdClass)#2 (0) {} != string(3) "2.5" +object(stdClass)#2 (0) {} != NULL +object(stdClass)#2 (0) {} == bool(true) +object(stdClass)#2 (0) {} != bool(false) +object(stdClass)#2 (0) {} == object(stdClass)#1 (0) {} +object(stdClass)#2 (0) {} == object(stdClass)#2 (0) {} +object(stdClass)#2 (0) {} != object(test)#3 (0) {} +object(stdClass)#2 (0) {} != array(0) {} +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + != int(-2147483648) +object(stdClass)#2 (0) {} != string(11) "-2147483648" +object(test)#3 (0) {} != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#3 (0) {} != string(0) "" +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + == int(1) +object(test)#3 (0) {} +Notice: Object of class test could not be converted to double in %s on line %d + != float(2.5) +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + != int(0) +object(test)#3 (0) {} != string(6) "string" +object(test)#3 (0) {} != string(3) "123" +object(test)#3 (0) {} != string(3) "2.5" +object(test)#3 (0) {} != NULL +object(test)#3 (0) {} == bool(true) +object(test)#3 (0) {} != bool(false) +object(test)#3 (0) {} != object(stdClass)#1 (0) {} +object(test)#3 (0) {} != object(stdClass)#2 (0) {} +object(test)#3 (0) {} == object(test)#3 (0) {} +object(test)#3 (0) {} != array(0) {} +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + != int(-2147483648) +object(test)#3 (0) {} != string(11) "-2147483648" +array(0) {} != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} != string(0) "" +array(0) {} != int(1) +array(0) {} != float(2.5) +array(0) {} != int(0) +array(0) {} != string(6) "string" +array(0) {} != string(3) "123" +array(0) {} != string(3) "2.5" +array(0) {} == NULL +array(0) {} != bool(true) +array(0) {} == bool(false) +array(0) {} != object(stdClass)#1 (0) {} +array(0) {} != object(stdClass)#2 (0) {} +array(0) {} != object(test)#3 (0) {} +array(0) {} == array(0) {} +array(0) {} != int(-2147483648) +array(0) {} != string(11) "-2147483648" +int(-2147483648) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-2147483648) != string(0) "" +int(-2147483648) != int(1) +int(-2147483648) != float(2.5) +int(-2147483648) != int(0) +int(-2147483648) != string(6) "string" +int(-2147483648) != string(3) "123" +int(-2147483648) != string(3) "2.5" +int(-2147483648) != NULL +int(-2147483648) == bool(true) +int(-2147483648) != bool(false) +int(-2147483648) +Notice: Object of class stdClass could not be converted to int in %s on line %d + != object(stdClass)#1 (0) {} +int(-2147483648) +Notice: Object of class stdClass could not be converted to int in %s on line %d + != object(stdClass)#2 (0) {} +int(-2147483648) +Notice: Object of class test could not be converted to int in %s on line %d + != object(test)#3 (0) {} +int(-2147483648) != array(0) {} +int(-2147483648) == int(-2147483648) +int(-2147483648) == string(11) "-2147483648" +string(11) "-2147483648" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(11) "-2147483648" != string(0) "" +string(11) "-2147483648" != int(1) +string(11) "-2147483648" != float(2.5) +string(11) "-2147483648" != int(0) +string(11) "-2147483648" != string(6) "string" +string(11) "-2147483648" != string(3) "123" +string(11) "-2147483648" != string(3) "2.5" +string(11) "-2147483648" != NULL +string(11) "-2147483648" == bool(true) +string(11) "-2147483648" != bool(false) +string(11) "-2147483648" != object(stdClass)#1 (0) {} +string(11) "-2147483648" != object(stdClass)#2 (0) {} +string(11) "-2147483648" != object(test)#3 (0) {} +string(11) "-2147483648" != array(0) {} +string(11) "-2147483648" == int(-2147483648) +string(11) "-2147483648" == string(11) "-2147483648" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_001_64bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_001_64bit.phpt new file mode 100644 index 0000000000000..bc57d0fec9b1e --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_001_64bit.phpt @@ -0,0 +1,389 @@ +--TEST-- +comparing different variables for equality +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(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)} != string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} == bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != object(test)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != int(-9223372036854775808) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} != string(20) "-9223372036854775808" +string(0) "" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" == string(0) "" +string(0) "" != int(1) +string(0) "" != float(2.5) +string(0) "" == int(0) +string(0) "" != string(6) "string" +string(0) "" != string(3) "123" +string(0) "" != string(3) "2.5" +string(0) "" == NULL +string(0) "" != bool(true) +string(0) "" == bool(false) +string(0) "" != object(stdClass)#%d (0) {} +string(0) "" != object(stdClass)#%d (0) {} +string(0) "" != object(test)#%d (0) {} +string(0) "" != array(0) {} +string(0) "" != int(-9223372036854775808) +string(0) "" != string(20) "-9223372036854775808" +int(1) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) != string(0) "" +int(1) == int(1) +int(1) != float(2.5) +int(1) != int(0) +int(1) != string(6) "string" +int(1) != string(3) "123" +int(1) != string(3) "2.5" +int(1) != NULL +int(1) == bool(true) +int(1) != bool(false) +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + == object(stdClass)#%d (0) {} +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + == object(stdClass)#%d (0) {} +int(1) +Notice: Object of class test could not be converted to int in %s on line %d + == object(test)#%d (0) {} +int(1) != array(0) {} +int(1) != int(-9223372036854775808) +int(1) != string(20) "-9223372036854775808" +float(2.5) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) != string(0) "" +float(2.5) != int(1) +float(2.5) == float(2.5) +float(2.5) != int(0) +float(2.5) != string(6) "string" +float(2.5) != string(3) "123" +float(2.5) == string(3) "2.5" +float(2.5) != NULL +float(2.5) == bool(true) +float(2.5) != bool(false) +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + != object(stdClass)#%d (0) {} +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + != object(stdClass)#%d (0) {} +float(2.5) +Notice: Object of class test could not be converted to double in %s on line %d + != object(test)#%d (0) {} +float(2.5) != array(0) {} +float(2.5) != int(-9223372036854775808) +float(2.5) != string(20) "-9223372036854775808" +int(0) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) == string(0) "" +int(0) != int(1) +int(0) != float(2.5) +int(0) == int(0) +int(0) == string(6) "string" +int(0) != string(3) "123" +int(0) != string(3) "2.5" +int(0) == NULL +int(0) != bool(true) +int(0) == bool(false) +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + != object(stdClass)#%d (0) {} +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + != object(stdClass)#%d (0) {} +int(0) +Notice: Object of class test could not be converted to int in %s on line %d + != object(test)#%d (0) {} +int(0) != array(0) {} +int(0) != int(-9223372036854775808) +int(0) != string(20) "-9223372036854775808" +string(6) "string" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" != string(0) "" +string(6) "string" != int(1) +string(6) "string" != float(2.5) +string(6) "string" == int(0) +string(6) "string" == string(6) "string" +string(6) "string" != string(3) "123" +string(6) "string" != string(3) "2.5" +string(6) "string" != NULL +string(6) "string" == bool(true) +string(6) "string" != bool(false) +string(6) "string" != object(stdClass)#%d (0) {} +string(6) "string" != object(stdClass)#%d (0) {} +string(6) "string" != object(test)#%d (0) {} +string(6) "string" != array(0) {} +string(6) "string" != int(-9223372036854775808) +string(6) "string" != string(20) "-9223372036854775808" +string(3) "123" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" != string(0) "" +string(3) "123" != int(1) +string(3) "123" != float(2.5) +string(3) "123" != int(0) +string(3) "123" != string(6) "string" +string(3) "123" == string(3) "123" +string(3) "123" != string(3) "2.5" +string(3) "123" != NULL +string(3) "123" == bool(true) +string(3) "123" != bool(false) +string(3) "123" != object(stdClass)#%d (0) {} +string(3) "123" != object(stdClass)#%d (0) {} +string(3) "123" != object(test)#%d (0) {} +string(3) "123" != array(0) {} +string(3) "123" != int(-9223372036854775808) +string(3) "123" != string(20) "-9223372036854775808" +string(3) "2.5" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" != string(0) "" +string(3) "2.5" != int(1) +string(3) "2.5" == float(2.5) +string(3) "2.5" != int(0) +string(3) "2.5" != string(6) "string" +string(3) "2.5" != string(3) "123" +string(3) "2.5" == string(3) "2.5" +string(3) "2.5" != NULL +string(3) "2.5" == bool(true) +string(3) "2.5" != bool(false) +string(3) "2.5" != object(stdClass)#%d (0) {} +string(3) "2.5" != object(stdClass)#%d (0) {} +string(3) "2.5" != object(test)#%d (0) {} +string(3) "2.5" != array(0) {} +string(3) "2.5" != int(-9223372036854775808) +string(3) "2.5" != string(20) "-9223372036854775808" +NULL != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL == string(0) "" +NULL != int(1) +NULL != float(2.5) +NULL == int(0) +NULL != string(6) "string" +NULL != string(3) "123" +NULL != string(3) "2.5" +NULL == NULL +NULL != bool(true) +NULL == bool(false) +NULL != object(stdClass)#%d (0) {} +NULL != object(stdClass)#%d (0) {} +NULL != object(test)#%d (0) {} +NULL == array(0) {} +NULL != int(-9223372036854775808) +NULL != string(20) "-9223372036854775808" +bool(true) == array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) != string(0) "" +bool(true) == int(1) +bool(true) == float(2.5) +bool(true) != int(0) +bool(true) == string(6) "string" +bool(true) == string(3) "123" +bool(true) == string(3) "2.5" +bool(true) != NULL +bool(true) == bool(true) +bool(true) != bool(false) +bool(true) == object(stdClass)#%d (0) {} +bool(true) == object(stdClass)#%d (0) {} +bool(true) == object(test)#%d (0) {} +bool(true) != array(0) {} +bool(true) == int(-9223372036854775808) +bool(true) == string(20) "-9223372036854775808" +bool(false) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) == string(0) "" +bool(false) != int(1) +bool(false) != float(2.5) +bool(false) == int(0) +bool(false) != string(6) "string" +bool(false) != string(3) "123" +bool(false) != string(3) "2.5" +bool(false) == NULL +bool(false) != bool(true) +bool(false) == bool(false) +bool(false) != object(stdClass)#%d (0) {} +bool(false) != object(stdClass)#%d (0) {} +bool(false) != object(test)#%d (0) {} +bool(false) == array(0) {} +bool(false) != int(-9223372036854775808) +bool(false) != string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} != string(0) "" +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + == int(1) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + != float(2.5) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + != int(0) +object(stdClass)#%d (0) {} != string(6) "string" +object(stdClass)#%d (0) {} != string(3) "123" +object(stdClass)#%d (0) {} != string(3) "2.5" +object(stdClass)#%d (0) {} != NULL +object(stdClass)#%d (0) {} == bool(true) +object(stdClass)#%d (0) {} != bool(false) +object(stdClass)#%d (0) {} == object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} == object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} != object(test)#%d (0) {} +object(stdClass)#%d (0) {} != array(0) {} +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + != int(-9223372036854775808) +object(stdClass)#%d (0) {} != string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} != string(0) "" +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + == int(1) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + != float(2.5) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + != int(0) +object(stdClass)#%d (0) {} != string(6) "string" +object(stdClass)#%d (0) {} != string(3) "123" +object(stdClass)#%d (0) {} != string(3) "2.5" +object(stdClass)#%d (0) {} != NULL +object(stdClass)#%d (0) {} == bool(true) +object(stdClass)#%d (0) {} != bool(false) +object(stdClass)#%d (0) {} == object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} == object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} != object(test)#%d (0) {} +object(stdClass)#%d (0) {} != array(0) {} +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + != int(-9223372036854775808) +object(stdClass)#%d (0) {} != string(20) "-9223372036854775808" +object(test)#%d (0) {} != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#%d (0) {} != string(0) "" +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + == int(1) +object(test)#%d (0) {} +Notice: Object of class test could not be converted to double in %s on line %d + != float(2.5) +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + != int(0) +object(test)#%d (0) {} != string(6) "string" +object(test)#%d (0) {} != string(3) "123" +object(test)#%d (0) {} != string(3) "2.5" +object(test)#%d (0) {} != NULL +object(test)#%d (0) {} == bool(true) +object(test)#%d (0) {} != bool(false) +object(test)#%d (0) {} != object(stdClass)#%d (0) {} +object(test)#%d (0) {} != object(stdClass)#%d (0) {} +object(test)#%d (0) {} == object(test)#%d (0) {} +object(test)#%d (0) {} != array(0) {} +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + != int(-9223372036854775808) +object(test)#%d (0) {} != string(20) "-9223372036854775808" +array(0) {} != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} != string(0) "" +array(0) {} != int(1) +array(0) {} != float(2.5) +array(0) {} != int(0) +array(0) {} != string(6) "string" +array(0) {} != string(3) "123" +array(0) {} != string(3) "2.5" +array(0) {} == NULL +array(0) {} != bool(true) +array(0) {} == bool(false) +array(0) {} != object(stdClass)#%d (0) {} +array(0) {} != object(stdClass)#%d (0) {} +array(0) {} != object(test)#%d (0) {} +array(0) {} == array(0) {} +array(0) {} != int(-9223372036854775808) +array(0) {} != string(20) "-9223372036854775808" +int(-9223372036854775808) != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-9223372036854775808) != string(0) "" +int(-9223372036854775808) != int(1) +int(-9223372036854775808) != float(2.5) +int(-9223372036854775808) != int(0) +int(-9223372036854775808) != string(6) "string" +int(-9223372036854775808) != string(3) "123" +int(-9223372036854775808) != string(3) "2.5" +int(-9223372036854775808) != NULL +int(-9223372036854775808) == bool(true) +int(-9223372036854775808) != bool(false) +int(-9223372036854775808) +Notice: Object of class stdClass could not be converted to int in %s on line %d + != object(stdClass)#%d (0) {} +int(-9223372036854775808) +Notice: Object of class stdClass could not be converted to int in %s on line %d + != object(stdClass)#%d (0) {} +int(-9223372036854775808) +Notice: Object of class test could not be converted to int in %s on line %d + != object(test)#%d (0) {} +int(-9223372036854775808) != array(0) {} +int(-9223372036854775808) == int(-9223372036854775808) +int(-9223372036854775808) == string(20) "-9223372036854775808" +string(20) "-9223372036854775808" != array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(20) "-9223372036854775808" != string(0) "" +string(20) "-9223372036854775808" != int(1) +string(20) "-9223372036854775808" != float(2.5) +string(20) "-9223372036854775808" != int(0) +string(20) "-9223372036854775808" != string(6) "string" +string(20) "-9223372036854775808" != string(3) "123" +string(20) "-9223372036854775808" != string(3) "2.5" +string(20) "-9223372036854775808" != NULL +string(20) "-9223372036854775808" == bool(true) +string(20) "-9223372036854775808" != bool(false) +string(20) "-9223372036854775808" != object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" != object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" != object(test)#%d (0) {} +string(20) "-9223372036854775808" != array(0) {} +string(20) "-9223372036854775808" == int(-9223372036854775808) +string(20) "-9223372036854775808" == string(20) "-9223372036854775808" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_002.phpt new file mode 100644 index 0000000000000..5e5009c323d3c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_002.phpt @@ -0,0 +1,341 @@ +--TEST-- +comparing different variables for identity +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(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)} !== string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== object(stdClass)#1 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== object(stdClass)#2 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== object(test)#3 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== int(-2147483648) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== string(11) "-2147483648" +string(0) "" !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" === string(0) "" +string(0) "" !== int(1) +string(0) "" !== float(2.5) +string(0) "" !== int(0) +string(0) "" !== string(6) "string" +string(0) "" !== string(3) "123" +string(0) "" !== string(3) "2.5" +string(0) "" !== NULL +string(0) "" !== bool(true) +string(0) "" !== bool(false) +string(0) "" !== object(stdClass)#1 (0) {} +string(0) "" !== object(stdClass)#2 (0) {} +string(0) "" !== object(test)#3 (0) {} +string(0) "" !== array(0) {} +string(0) "" !== int(-2147483648) +string(0) "" !== string(11) "-2147483648" +int(1) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) !== string(0) "" +int(1) === int(1) +int(1) !== float(2.5) +int(1) !== int(0) +int(1) !== string(6) "string" +int(1) !== string(3) "123" +int(1) !== string(3) "2.5" +int(1) !== NULL +int(1) !== bool(true) +int(1) !== bool(false) +int(1) !== object(stdClass)#1 (0) {} +int(1) !== object(stdClass)#2 (0) {} +int(1) !== object(test)#3 (0) {} +int(1) !== array(0) {} +int(1) !== int(-2147483648) +int(1) !== string(11) "-2147483648" +float(2.5) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) !== string(0) "" +float(2.5) !== int(1) +float(2.5) === float(2.5) +float(2.5) !== int(0) +float(2.5) !== string(6) "string" +float(2.5) !== string(3) "123" +float(2.5) !== string(3) "2.5" +float(2.5) !== NULL +float(2.5) !== bool(true) +float(2.5) !== bool(false) +float(2.5) !== object(stdClass)#1 (0) {} +float(2.5) !== object(stdClass)#2 (0) {} +float(2.5) !== object(test)#3 (0) {} +float(2.5) !== array(0) {} +float(2.5) !== int(-2147483648) +float(2.5) !== string(11) "-2147483648" +int(0) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) !== string(0) "" +int(0) !== int(1) +int(0) !== float(2.5) +int(0) === int(0) +int(0) !== string(6) "string" +int(0) !== string(3) "123" +int(0) !== string(3) "2.5" +int(0) !== NULL +int(0) !== bool(true) +int(0) !== bool(false) +int(0) !== object(stdClass)#1 (0) {} +int(0) !== object(stdClass)#2 (0) {} +int(0) !== object(test)#3 (0) {} +int(0) !== array(0) {} +int(0) !== int(-2147483648) +int(0) !== string(11) "-2147483648" +string(6) "string" !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" !== string(0) "" +string(6) "string" !== int(1) +string(6) "string" !== float(2.5) +string(6) "string" !== int(0) +string(6) "string" === string(6) "string" +string(6) "string" !== string(3) "123" +string(6) "string" !== string(3) "2.5" +string(6) "string" !== NULL +string(6) "string" !== bool(true) +string(6) "string" !== bool(false) +string(6) "string" !== object(stdClass)#1 (0) {} +string(6) "string" !== object(stdClass)#2 (0) {} +string(6) "string" !== object(test)#3 (0) {} +string(6) "string" !== array(0) {} +string(6) "string" !== int(-2147483648) +string(6) "string" !== string(11) "-2147483648" +string(3) "123" !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" !== string(0) "" +string(3) "123" !== int(1) +string(3) "123" !== float(2.5) +string(3) "123" !== int(0) +string(3) "123" !== string(6) "string" +string(3) "123" === string(3) "123" +string(3) "123" !== string(3) "2.5" +string(3) "123" !== NULL +string(3) "123" !== bool(true) +string(3) "123" !== bool(false) +string(3) "123" !== object(stdClass)#1 (0) {} +string(3) "123" !== object(stdClass)#2 (0) {} +string(3) "123" !== object(test)#3 (0) {} +string(3) "123" !== array(0) {} +string(3) "123" !== int(-2147483648) +string(3) "123" !== string(11) "-2147483648" +string(3) "2.5" !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" !== string(0) "" +string(3) "2.5" !== int(1) +string(3) "2.5" !== float(2.5) +string(3) "2.5" !== int(0) +string(3) "2.5" !== string(6) "string" +string(3) "2.5" !== string(3) "123" +string(3) "2.5" === string(3) "2.5" +string(3) "2.5" !== NULL +string(3) "2.5" !== bool(true) +string(3) "2.5" !== bool(false) +string(3) "2.5" !== object(stdClass)#1 (0) {} +string(3) "2.5" !== object(stdClass)#2 (0) {} +string(3) "2.5" !== object(test)#3 (0) {} +string(3) "2.5" !== array(0) {} +string(3) "2.5" !== int(-2147483648) +string(3) "2.5" !== string(11) "-2147483648" +NULL !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL !== string(0) "" +NULL !== int(1) +NULL !== float(2.5) +NULL !== int(0) +NULL !== string(6) "string" +NULL !== string(3) "123" +NULL !== string(3) "2.5" +NULL === NULL +NULL !== bool(true) +NULL !== bool(false) +NULL !== object(stdClass)#1 (0) {} +NULL !== object(stdClass)#2 (0) {} +NULL !== object(test)#3 (0) {} +NULL !== array(0) {} +NULL !== int(-2147483648) +NULL !== string(11) "-2147483648" +bool(true) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) !== string(0) "" +bool(true) !== int(1) +bool(true) !== float(2.5) +bool(true) !== int(0) +bool(true) !== string(6) "string" +bool(true) !== string(3) "123" +bool(true) !== string(3) "2.5" +bool(true) !== NULL +bool(true) === bool(true) +bool(true) !== bool(false) +bool(true) !== object(stdClass)#1 (0) {} +bool(true) !== object(stdClass)#2 (0) {} +bool(true) !== object(test)#3 (0) {} +bool(true) !== array(0) {} +bool(true) !== int(-2147483648) +bool(true) !== string(11) "-2147483648" +bool(false) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) !== string(0) "" +bool(false) !== int(1) +bool(false) !== float(2.5) +bool(false) !== int(0) +bool(false) !== string(6) "string" +bool(false) !== string(3) "123" +bool(false) !== string(3) "2.5" +bool(false) !== NULL +bool(false) !== bool(true) +bool(false) === bool(false) +bool(false) !== object(stdClass)#1 (0) {} +bool(false) !== object(stdClass)#2 (0) {} +bool(false) !== object(test)#3 (0) {} +bool(false) !== array(0) {} +bool(false) !== int(-2147483648) +bool(false) !== string(11) "-2147483648" +object(stdClass)#1 (0) {} !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#1 (0) {} !== string(0) "" +object(stdClass)#1 (0) {} !== int(1) +object(stdClass)#1 (0) {} !== float(2.5) +object(stdClass)#1 (0) {} !== int(0) +object(stdClass)#1 (0) {} !== string(6) "string" +object(stdClass)#1 (0) {} !== string(3) "123" +object(stdClass)#1 (0) {} !== string(3) "2.5" +object(stdClass)#1 (0) {} !== NULL +object(stdClass)#1 (0) {} !== bool(true) +object(stdClass)#1 (0) {} !== bool(false) +object(stdClass)#1 (0) {} === object(stdClass)#1 (0) {} +object(stdClass)#1 (0) {} !== object(stdClass)#2 (0) {} +object(stdClass)#1 (0) {} !== object(test)#3 (0) {} +object(stdClass)#1 (0) {} !== array(0) {} +object(stdClass)#1 (0) {} !== int(-2147483648) +object(stdClass)#1 (0) {} !== string(11) "-2147483648" +object(stdClass)#2 (0) {} !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#2 (0) {} !== string(0) "" +object(stdClass)#2 (0) {} !== int(1) +object(stdClass)#2 (0) {} !== float(2.5) +object(stdClass)#2 (0) {} !== int(0) +object(stdClass)#2 (0) {} !== string(6) "string" +object(stdClass)#2 (0) {} !== string(3) "123" +object(stdClass)#2 (0) {} !== string(3) "2.5" +object(stdClass)#2 (0) {} !== NULL +object(stdClass)#2 (0) {} !== bool(true) +object(stdClass)#2 (0) {} !== bool(false) +object(stdClass)#2 (0) {} !== object(stdClass)#1 (0) {} +object(stdClass)#2 (0) {} === object(stdClass)#2 (0) {} +object(stdClass)#2 (0) {} !== object(test)#3 (0) {} +object(stdClass)#2 (0) {} !== array(0) {} +object(stdClass)#2 (0) {} !== int(-2147483648) +object(stdClass)#2 (0) {} !== string(11) "-2147483648" +object(test)#3 (0) {} !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#3 (0) {} !== string(0) "" +object(test)#3 (0) {} !== int(1) +object(test)#3 (0) {} !== float(2.5) +object(test)#3 (0) {} !== int(0) +object(test)#3 (0) {} !== string(6) "string" +object(test)#3 (0) {} !== string(3) "123" +object(test)#3 (0) {} !== string(3) "2.5" +object(test)#3 (0) {} !== NULL +object(test)#3 (0) {} !== bool(true) +object(test)#3 (0) {} !== bool(false) +object(test)#3 (0) {} !== object(stdClass)#1 (0) {} +object(test)#3 (0) {} !== object(stdClass)#2 (0) {} +object(test)#3 (0) {} === object(test)#3 (0) {} +object(test)#3 (0) {} !== array(0) {} +object(test)#3 (0) {} !== int(-2147483648) +object(test)#3 (0) {} !== string(11) "-2147483648" +array(0) {} !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} !== string(0) "" +array(0) {} !== int(1) +array(0) {} !== float(2.5) +array(0) {} !== int(0) +array(0) {} !== string(6) "string" +array(0) {} !== string(3) "123" +array(0) {} !== string(3) "2.5" +array(0) {} !== NULL +array(0) {} !== bool(true) +array(0) {} !== bool(false) +array(0) {} !== object(stdClass)#1 (0) {} +array(0) {} !== object(stdClass)#2 (0) {} +array(0) {} !== object(test)#3 (0) {} +array(0) {} === array(0) {} +array(0) {} !== int(-2147483648) +array(0) {} !== string(11) "-2147483648" +int(-2147483648) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-2147483648) !== string(0) "" +int(-2147483648) !== int(1) +int(-2147483648) !== float(2.5) +int(-2147483648) !== int(0) +int(-2147483648) !== string(6) "string" +int(-2147483648) !== string(3) "123" +int(-2147483648) !== string(3) "2.5" +int(-2147483648) !== NULL +int(-2147483648) !== bool(true) +int(-2147483648) !== bool(false) +int(-2147483648) !== object(stdClass)#1 (0) {} +int(-2147483648) !== object(stdClass)#2 (0) {} +int(-2147483648) !== object(test)#3 (0) {} +int(-2147483648) !== array(0) {} +int(-2147483648) === int(-2147483648) +int(-2147483648) !== string(11) "-2147483648" +string(11) "-2147483648" !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(11) "-2147483648" !== string(0) "" +string(11) "-2147483648" !== int(1) +string(11) "-2147483648" !== float(2.5) +string(11) "-2147483648" !== int(0) +string(11) "-2147483648" !== string(6) "string" +string(11) "-2147483648" !== string(3) "123" +string(11) "-2147483648" !== string(3) "2.5" +string(11) "-2147483648" !== NULL +string(11) "-2147483648" !== bool(true) +string(11) "-2147483648" !== bool(false) +string(11) "-2147483648" !== object(stdClass)#1 (0) {} +string(11) "-2147483648" !== object(stdClass)#2 (0) {} +string(11) "-2147483648" !== object(test)#3 (0) {} +string(11) "-2147483648" !== array(0) {} +string(11) "-2147483648" !== int(-2147483648) +string(11) "-2147483648" === string(11) "-2147483648" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_002_64bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_002_64bit.phpt new file mode 100644 index 0000000000000..517e7b9432879 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_002_64bit.phpt @@ -0,0 +1,341 @@ +--TEST-- +comparing different variables for identity +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(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)} !== string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== object(test)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== int(-9223372036854775808) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} !== string(20) "-9223372036854775808" +string(0) "" !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" === string(0) "" +string(0) "" !== int(1) +string(0) "" !== float(2.5) +string(0) "" !== int(0) +string(0) "" !== string(6) "string" +string(0) "" !== string(3) "123" +string(0) "" !== string(3) "2.5" +string(0) "" !== NULL +string(0) "" !== bool(true) +string(0) "" !== bool(false) +string(0) "" !== object(stdClass)#%d (0) {} +string(0) "" !== object(stdClass)#%d (0) {} +string(0) "" !== object(test)#%d (0) {} +string(0) "" !== array(0) {} +string(0) "" !== int(-9223372036854775808) +string(0) "" !== string(20) "-9223372036854775808" +int(1) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) !== string(0) "" +int(1) === int(1) +int(1) !== float(2.5) +int(1) !== int(0) +int(1) !== string(6) "string" +int(1) !== string(3) "123" +int(1) !== string(3) "2.5" +int(1) !== NULL +int(1) !== bool(true) +int(1) !== bool(false) +int(1) !== object(stdClass)#%d (0) {} +int(1) !== object(stdClass)#%d (0) {} +int(1) !== object(test)#%d (0) {} +int(1) !== array(0) {} +int(1) !== int(-9223372036854775808) +int(1) !== string(20) "-9223372036854775808" +float(2.5) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) !== string(0) "" +float(2.5) !== int(1) +float(2.5) === float(2.5) +float(2.5) !== int(0) +float(2.5) !== string(6) "string" +float(2.5) !== string(3) "123" +float(2.5) !== string(3) "2.5" +float(2.5) !== NULL +float(2.5) !== bool(true) +float(2.5) !== bool(false) +float(2.5) !== object(stdClass)#%d (0) {} +float(2.5) !== object(stdClass)#%d (0) {} +float(2.5) !== object(test)#%d (0) {} +float(2.5) !== array(0) {} +float(2.5) !== int(-9223372036854775808) +float(2.5) !== string(20) "-9223372036854775808" +int(0) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) !== string(0) "" +int(0) !== int(1) +int(0) !== float(2.5) +int(0) === int(0) +int(0) !== string(6) "string" +int(0) !== string(3) "123" +int(0) !== string(3) "2.5" +int(0) !== NULL +int(0) !== bool(true) +int(0) !== bool(false) +int(0) !== object(stdClass)#%d (0) {} +int(0) !== object(stdClass)#%d (0) {} +int(0) !== object(test)#%d (0) {} +int(0) !== array(0) {} +int(0) !== int(-9223372036854775808) +int(0) !== string(20) "-9223372036854775808" +string(6) "string" !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" !== string(0) "" +string(6) "string" !== int(1) +string(6) "string" !== float(2.5) +string(6) "string" !== int(0) +string(6) "string" === string(6) "string" +string(6) "string" !== string(3) "123" +string(6) "string" !== string(3) "2.5" +string(6) "string" !== NULL +string(6) "string" !== bool(true) +string(6) "string" !== bool(false) +string(6) "string" !== object(stdClass)#%d (0) {} +string(6) "string" !== object(stdClass)#%d (0) {} +string(6) "string" !== object(test)#%d (0) {} +string(6) "string" !== array(0) {} +string(6) "string" !== int(-9223372036854775808) +string(6) "string" !== string(20) "-9223372036854775808" +string(3) "123" !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" !== string(0) "" +string(3) "123" !== int(1) +string(3) "123" !== float(2.5) +string(3) "123" !== int(0) +string(3) "123" !== string(6) "string" +string(3) "123" === string(3) "123" +string(3) "123" !== string(3) "2.5" +string(3) "123" !== NULL +string(3) "123" !== bool(true) +string(3) "123" !== bool(false) +string(3) "123" !== object(stdClass)#%d (0) {} +string(3) "123" !== object(stdClass)#%d (0) {} +string(3) "123" !== object(test)#%d (0) {} +string(3) "123" !== array(0) {} +string(3) "123" !== int(-9223372036854775808) +string(3) "123" !== string(20) "-9223372036854775808" +string(3) "2.5" !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" !== string(0) "" +string(3) "2.5" !== int(1) +string(3) "2.5" !== float(2.5) +string(3) "2.5" !== int(0) +string(3) "2.5" !== string(6) "string" +string(3) "2.5" !== string(3) "123" +string(3) "2.5" === string(3) "2.5" +string(3) "2.5" !== NULL +string(3) "2.5" !== bool(true) +string(3) "2.5" !== bool(false) +string(3) "2.5" !== object(stdClass)#%d (0) {} +string(3) "2.5" !== object(stdClass)#%d (0) {} +string(3) "2.5" !== object(test)#%d (0) {} +string(3) "2.5" !== array(0) {} +string(3) "2.5" !== int(-9223372036854775808) +string(3) "2.5" !== string(20) "-9223372036854775808" +NULL !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL !== string(0) "" +NULL !== int(1) +NULL !== float(2.5) +NULL !== int(0) +NULL !== string(6) "string" +NULL !== string(3) "123" +NULL !== string(3) "2.5" +NULL === NULL +NULL !== bool(true) +NULL !== bool(false) +NULL !== object(stdClass)#%d (0) {} +NULL !== object(stdClass)#%d (0) {} +NULL !== object(test)#%d (0) {} +NULL !== array(0) {} +NULL !== int(-9223372036854775808) +NULL !== string(20) "-9223372036854775808" +bool(true) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) !== string(0) "" +bool(true) !== int(1) +bool(true) !== float(2.5) +bool(true) !== int(0) +bool(true) !== string(6) "string" +bool(true) !== string(3) "123" +bool(true) !== string(3) "2.5" +bool(true) !== NULL +bool(true) === bool(true) +bool(true) !== bool(false) +bool(true) !== object(stdClass)#%d (0) {} +bool(true) !== object(stdClass)#%d (0) {} +bool(true) !== object(test)#%d (0) {} +bool(true) !== array(0) {} +bool(true) !== int(-9223372036854775808) +bool(true) !== string(20) "-9223372036854775808" +bool(false) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) !== string(0) "" +bool(false) !== int(1) +bool(false) !== float(2.5) +bool(false) !== int(0) +bool(false) !== string(6) "string" +bool(false) !== string(3) "123" +bool(false) !== string(3) "2.5" +bool(false) !== NULL +bool(false) !== bool(true) +bool(false) === bool(false) +bool(false) !== object(stdClass)#%d (0) {} +bool(false) !== object(stdClass)#%d (0) {} +bool(false) !== object(test)#%d (0) {} +bool(false) !== array(0) {} +bool(false) !== int(-9223372036854775808) +bool(false) !== string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} !== string(0) "" +object(stdClass)#%d (0) {} !== int(1) +object(stdClass)#%d (0) {} !== float(2.5) +object(stdClass)#%d (0) {} !== int(0) +object(stdClass)#%d (0) {} !== string(6) "string" +object(stdClass)#%d (0) {} !== string(3) "123" +object(stdClass)#%d (0) {} !== string(3) "2.5" +object(stdClass)#%d (0) {} !== NULL +object(stdClass)#%d (0) {} !== bool(true) +object(stdClass)#%d (0) {} !== bool(false) +object(stdClass)#%d (0) {} === object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} !== object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} !== object(test)#%d (0) {} +object(stdClass)#%d (0) {} !== array(0) {} +object(stdClass)#%d (0) {} !== int(-9223372036854775808) +object(stdClass)#%d (0) {} !== string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} !== string(0) "" +object(stdClass)#%d (0) {} !== int(1) +object(stdClass)#%d (0) {} !== float(2.5) +object(stdClass)#%d (0) {} !== int(0) +object(stdClass)#%d (0) {} !== string(6) "string" +object(stdClass)#%d (0) {} !== string(3) "123" +object(stdClass)#%d (0) {} !== string(3) "2.5" +object(stdClass)#%d (0) {} !== NULL +object(stdClass)#%d (0) {} !== bool(true) +object(stdClass)#%d (0) {} !== bool(false) +object(stdClass)#%d (0) {} !== object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} === object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} !== object(test)#%d (0) {} +object(stdClass)#%d (0) {} !== array(0) {} +object(stdClass)#%d (0) {} !== int(-9223372036854775808) +object(stdClass)#%d (0) {} !== string(20) "-9223372036854775808" +object(test)#%d (0) {} !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#%d (0) {} !== string(0) "" +object(test)#%d (0) {} !== int(1) +object(test)#%d (0) {} !== float(2.5) +object(test)#%d (0) {} !== int(0) +object(test)#%d (0) {} !== string(6) "string" +object(test)#%d (0) {} !== string(3) "123" +object(test)#%d (0) {} !== string(3) "2.5" +object(test)#%d (0) {} !== NULL +object(test)#%d (0) {} !== bool(true) +object(test)#%d (0) {} !== bool(false) +object(test)#%d (0) {} !== object(stdClass)#%d (0) {} +object(test)#%d (0) {} !== object(stdClass)#%d (0) {} +object(test)#%d (0) {} === object(test)#%d (0) {} +object(test)#%d (0) {} !== array(0) {} +object(test)#%d (0) {} !== int(-9223372036854775808) +object(test)#%d (0) {} !== string(20) "-9223372036854775808" +array(0) {} !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} !== string(0) "" +array(0) {} !== int(1) +array(0) {} !== float(2.5) +array(0) {} !== int(0) +array(0) {} !== string(6) "string" +array(0) {} !== string(3) "123" +array(0) {} !== string(3) "2.5" +array(0) {} !== NULL +array(0) {} !== bool(true) +array(0) {} !== bool(false) +array(0) {} !== object(stdClass)#%d (0) {} +array(0) {} !== object(stdClass)#%d (0) {} +array(0) {} !== object(test)#%d (0) {} +array(0) {} === array(0) {} +array(0) {} !== int(-9223372036854775808) +array(0) {} !== string(20) "-9223372036854775808" +int(-9223372036854775808) !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-9223372036854775808) !== string(0) "" +int(-9223372036854775808) !== int(1) +int(-9223372036854775808) !== float(2.5) +int(-9223372036854775808) !== int(0) +int(-9223372036854775808) !== string(6) "string" +int(-9223372036854775808) !== string(3) "123" +int(-9223372036854775808) !== string(3) "2.5" +int(-9223372036854775808) !== NULL +int(-9223372036854775808) !== bool(true) +int(-9223372036854775808) !== bool(false) +int(-9223372036854775808) !== object(stdClass)#%d (0) {} +int(-9223372036854775808) !== object(stdClass)#%d (0) {} +int(-9223372036854775808) !== object(test)#%d (0) {} +int(-9223372036854775808) !== array(0) {} +int(-9223372036854775808) === int(-9223372036854775808) +int(-9223372036854775808) !== string(20) "-9223372036854775808" +string(20) "-9223372036854775808" !== array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(20) "-9223372036854775808" !== string(0) "" +string(20) "-9223372036854775808" !== int(1) +string(20) "-9223372036854775808" !== float(2.5) +string(20) "-9223372036854775808" !== int(0) +string(20) "-9223372036854775808" !== string(6) "string" +string(20) "-9223372036854775808" !== string(3) "123" +string(20) "-9223372036854775808" !== string(3) "2.5" +string(20) "-9223372036854775808" !== NULL +string(20) "-9223372036854775808" !== bool(true) +string(20) "-9223372036854775808" !== bool(false) +string(20) "-9223372036854775808" !== object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" !== object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" !== object(test)#%d (0) {} +string(20) "-9223372036854775808" !== array(0) {} +string(20) "-9223372036854775808" !== int(-9223372036854775808) +string(20) "-9223372036854775808" === string(20) "-9223372036854775808" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_003.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_003.phpt new file mode 100644 index 0000000000000..9327ee58bc624 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_003.phpt @@ -0,0 +1,389 @@ +--TEST-- +comparing different variables (greater than) +--SKIPIF-- + +--FILE-- + $a[$i]) ? " > " : " <= "; + my_dump($a[$i]); + echo "\n"; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +array(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)} > string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(stdClass)#1 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(stdClass)#2 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(test)#3 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(-2147483648) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(11) "-2147483648" +string(0) "" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" <= string(0) "" +string(0) "" <= int(1) +string(0) "" <= float(2.5) +string(0) "" <= int(0) +string(0) "" <= string(6) "string" +string(0) "" <= string(3) "123" +string(0) "" <= string(3) "2.5" +string(0) "" <= NULL +string(0) "" <= bool(true) +string(0) "" <= bool(false) +string(0) "" <= object(stdClass)#1 (0) {} +string(0) "" <= object(stdClass)#2 (0) {} +string(0) "" <= object(test)#3 (0) {} +string(0) "" <= array(0) {} +string(0) "" > int(-2147483648) +string(0) "" <= string(11) "-2147483648" +int(1) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) > string(0) "" +int(1) <= int(1) +int(1) <= float(2.5) +int(1) > int(0) +int(1) > string(6) "string" +int(1) <= string(3) "123" +int(1) <= string(3) "2.5" +int(1) > NULL +int(1) <= bool(true) +int(1) > bool(false) +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#1 (0) {} +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#2 (0) {} +int(1) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#3 (0) {} +int(1) <= array(0) {} +int(1) > int(-2147483648) +int(1) > string(11) "-2147483648" +float(2.5) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) > string(0) "" +float(2.5) > int(1) +float(2.5) <= float(2.5) +float(2.5) > int(0) +float(2.5) > string(6) "string" +float(2.5) <= string(3) "123" +float(2.5) <= string(3) "2.5" +float(2.5) > NULL +float(2.5) <= bool(true) +float(2.5) > bool(false) +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + > object(stdClass)#1 (0) {} +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + > object(stdClass)#2 (0) {} +float(2.5) +Notice: Object of class test could not be converted to double in %s on line %d + > object(test)#3 (0) {} +float(2.5) <= array(0) {} +float(2.5) > int(-2147483648) +float(2.5) > string(11) "-2147483648" +int(0) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) <= string(0) "" +int(0) <= int(1) +int(0) <= float(2.5) +int(0) <= int(0) +int(0) <= string(6) "string" +int(0) <= string(3) "123" +int(0) <= string(3) "2.5" +int(0) <= NULL +int(0) <= bool(true) +int(0) <= bool(false) +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#1 (0) {} +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#2 (0) {} +int(0) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#3 (0) {} +int(0) <= array(0) {} +int(0) > int(-2147483648) +int(0) > string(11) "-2147483648" +string(6) "string" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" > string(0) "" +string(6) "string" <= int(1) +string(6) "string" <= float(2.5) +string(6) "string" <= int(0) +string(6) "string" <= string(6) "string" +string(6) "string" > string(3) "123" +string(6) "string" > string(3) "2.5" +string(6) "string" > NULL +string(6) "string" <= bool(true) +string(6) "string" > bool(false) +string(6) "string" <= object(stdClass)#1 (0) {} +string(6) "string" <= object(stdClass)#2 (0) {} +string(6) "string" <= object(test)#3 (0) {} +string(6) "string" <= array(0) {} +string(6) "string" > int(-2147483648) +string(6) "string" > string(11) "-2147483648" +string(3) "123" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" > string(0) "" +string(3) "123" > int(1) +string(3) "123" > float(2.5) +string(3) "123" > int(0) +string(3) "123" <= string(6) "string" +string(3) "123" <= string(3) "123" +string(3) "123" > string(3) "2.5" +string(3) "123" > NULL +string(3) "123" <= bool(true) +string(3) "123" > bool(false) +string(3) "123" <= object(stdClass)#1 (0) {} +string(3) "123" <= object(stdClass)#2 (0) {} +string(3) "123" <= object(test)#3 (0) {} +string(3) "123" <= array(0) {} +string(3) "123" > int(-2147483648) +string(3) "123" > string(11) "-2147483648" +string(3) "2.5" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" > string(0) "" +string(3) "2.5" > int(1) +string(3) "2.5" <= float(2.5) +string(3) "2.5" > int(0) +string(3) "2.5" <= string(6) "string" +string(3) "2.5" <= string(3) "123" +string(3) "2.5" <= string(3) "2.5" +string(3) "2.5" > NULL +string(3) "2.5" <= bool(true) +string(3) "2.5" > bool(false) +string(3) "2.5" <= object(stdClass)#1 (0) {} +string(3) "2.5" <= object(stdClass)#2 (0) {} +string(3) "2.5" <= object(test)#3 (0) {} +string(3) "2.5" <= array(0) {} +string(3) "2.5" > int(-2147483648) +string(3) "2.5" > string(11) "-2147483648" +NULL <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL <= string(0) "" +NULL <= int(1) +NULL <= float(2.5) +NULL <= int(0) +NULL <= string(6) "string" +NULL <= string(3) "123" +NULL <= string(3) "2.5" +NULL <= NULL +NULL <= bool(true) +NULL <= bool(false) +NULL <= object(stdClass)#1 (0) {} +NULL <= object(stdClass)#2 (0) {} +NULL <= object(test)#3 (0) {} +NULL <= array(0) {} +NULL <= int(-2147483648) +NULL <= string(11) "-2147483648" +bool(true) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) > string(0) "" +bool(true) <= int(1) +bool(true) <= float(2.5) +bool(true) > int(0) +bool(true) <= string(6) "string" +bool(true) <= string(3) "123" +bool(true) <= string(3) "2.5" +bool(true) > NULL +bool(true) <= bool(true) +bool(true) > bool(false) +bool(true) <= object(stdClass)#1 (0) {} +bool(true) <= object(stdClass)#2 (0) {} +bool(true) <= object(test)#3 (0) {} +bool(true) > array(0) {} +bool(true) <= int(-2147483648) +bool(true) <= string(11) "-2147483648" +bool(false) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) <= string(0) "" +bool(false) <= int(1) +bool(false) <= float(2.5) +bool(false) <= int(0) +bool(false) <= string(6) "string" +bool(false) <= string(3) "123" +bool(false) <= string(3) "2.5" +bool(false) <= NULL +bool(false) <= bool(true) +bool(false) <= bool(false) +bool(false) <= object(stdClass)#1 (0) {} +bool(false) <= object(stdClass)#2 (0) {} +bool(false) <= object(test)#3 (0) {} +bool(false) <= array(0) {} +bool(false) <= int(-2147483648) +bool(false) <= string(11) "-2147483648" +object(stdClass)#1 (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#1 (0) {} > string(0) "" +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= int(1) +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + <= float(2.5) +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(0) +object(stdClass)#1 (0) {} > string(6) "string" +object(stdClass)#1 (0) {} > string(3) "123" +object(stdClass)#1 (0) {} > string(3) "2.5" +object(stdClass)#1 (0) {} > NULL +object(stdClass)#1 (0) {} <= bool(true) +object(stdClass)#1 (0) {} > bool(false) +object(stdClass)#1 (0) {} <= object(stdClass)#1 (0) {} +object(stdClass)#1 (0) {} <= object(stdClass)#2 (0) {} +object(stdClass)#1 (0) {} <= object(test)#3 (0) {} +object(stdClass)#1 (0) {} > array(0) {} +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(-2147483648) +object(stdClass)#1 (0) {} > string(11) "-2147483648" +object(stdClass)#2 (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#2 (0) {} > string(0) "" +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= int(1) +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + <= float(2.5) +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(0) +object(stdClass)#2 (0) {} > string(6) "string" +object(stdClass)#2 (0) {} > string(3) "123" +object(stdClass)#2 (0) {} > string(3) "2.5" +object(stdClass)#2 (0) {} > NULL +object(stdClass)#2 (0) {} <= bool(true) +object(stdClass)#2 (0) {} > bool(false) +object(stdClass)#2 (0) {} <= object(stdClass)#1 (0) {} +object(stdClass)#2 (0) {} <= object(stdClass)#2 (0) {} +object(stdClass)#2 (0) {} <= object(test)#3 (0) {} +object(stdClass)#2 (0) {} > array(0) {} +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(-2147483648) +object(stdClass)#2 (0) {} > string(11) "-2147483648" +object(test)#3 (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#3 (0) {} > string(0) "" +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + <= int(1) +object(test)#3 (0) {} +Notice: Object of class test could not be converted to double in %s on line %d + <= float(2.5) +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + > int(0) +object(test)#3 (0) {} > string(6) "string" +object(test)#3 (0) {} > string(3) "123" +object(test)#3 (0) {} > string(3) "2.5" +object(test)#3 (0) {} > NULL +object(test)#3 (0) {} <= bool(true) +object(test)#3 (0) {} > bool(false) +object(test)#3 (0) {} <= object(stdClass)#1 (0) {} +object(test)#3 (0) {} <= object(stdClass)#2 (0) {} +object(test)#3 (0) {} <= object(test)#3 (0) {} +object(test)#3 (0) {} > array(0) {} +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + > int(-2147483648) +object(test)#3 (0) {} > string(11) "-2147483648" +array(0) {} <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} > string(0) "" +array(0) {} > int(1) +array(0) {} > float(2.5) +array(0) {} > int(0) +array(0) {} > string(6) "string" +array(0) {} > string(3) "123" +array(0) {} > string(3) "2.5" +array(0) {} <= NULL +array(0) {} <= bool(true) +array(0) {} <= bool(false) +array(0) {} <= object(stdClass)#1 (0) {} +array(0) {} <= object(stdClass)#2 (0) {} +array(0) {} <= object(test)#3 (0) {} +array(0) {} <= array(0) {} +array(0) {} > int(-2147483648) +array(0) {} > string(11) "-2147483648" +int(-2147483648) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-2147483648) <= string(0) "" +int(-2147483648) <= int(1) +int(-2147483648) <= float(2.5) +int(-2147483648) <= int(0) +int(-2147483648) <= string(6) "string" +int(-2147483648) <= string(3) "123" +int(-2147483648) <= string(3) "2.5" +int(-2147483648) > NULL +int(-2147483648) <= bool(true) +int(-2147483648) > bool(false) +int(-2147483648) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#1 (0) {} +int(-2147483648) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#2 (0) {} +int(-2147483648) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#3 (0) {} +int(-2147483648) <= array(0) {} +int(-2147483648) <= int(-2147483648) +int(-2147483648) <= string(11) "-2147483648" +string(11) "-2147483648" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(11) "-2147483648" > string(0) "" +string(11) "-2147483648" <= int(1) +string(11) "-2147483648" <= float(2.5) +string(11) "-2147483648" <= int(0) +string(11) "-2147483648" <= string(6) "string" +string(11) "-2147483648" <= string(3) "123" +string(11) "-2147483648" <= string(3) "2.5" +string(11) "-2147483648" > NULL +string(11) "-2147483648" <= bool(true) +string(11) "-2147483648" > bool(false) +string(11) "-2147483648" <= object(stdClass)#1 (0) {} +string(11) "-2147483648" <= object(stdClass)#2 (0) {} +string(11) "-2147483648" <= object(test)#3 (0) {} +string(11) "-2147483648" <= array(0) {} +string(11) "-2147483648" <= int(-2147483648) +string(11) "-2147483648" <= string(11) "-2147483648" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_003_64bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_003_64bit.phpt new file mode 100644 index 0000000000000..1f936c6e37245 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_003_64bit.phpt @@ -0,0 +1,389 @@ +--TEST-- +comparing different variables (greater than) +--SKIPIF-- + +--FILE-- + $a[$i]) ? " > " : " <= "; + my_dump($a[$i]); + echo "\n"; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +array(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)} > string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(test)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(-9223372036854775808) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(20) "-9223372036854775808" +string(0) "" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" <= string(0) "" +string(0) "" <= int(1) +string(0) "" <= float(2.5) +string(0) "" <= int(0) +string(0) "" <= string(6) "string" +string(0) "" <= string(3) "123" +string(0) "" <= string(3) "2.5" +string(0) "" <= NULL +string(0) "" <= bool(true) +string(0) "" <= bool(false) +string(0) "" <= object(stdClass)#%d (0) {} +string(0) "" <= object(stdClass)#%d (0) {} +string(0) "" <= object(test)#%d (0) {} +string(0) "" <= array(0) {} +string(0) "" > int(-9223372036854775808) +string(0) "" <= string(20) "-9223372036854775808" +int(1) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) > string(0) "" +int(1) <= int(1) +int(1) <= float(2.5) +int(1) > int(0) +int(1) > string(6) "string" +int(1) <= string(3) "123" +int(1) <= string(3) "2.5" +int(1) > NULL +int(1) <= bool(true) +int(1) > bool(false) +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(1) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#%d (0) {} +int(1) <= array(0) {} +int(1) > int(-9223372036854775808) +int(1) > string(20) "-9223372036854775808" +float(2.5) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) > string(0) "" +float(2.5) > int(1) +float(2.5) <= float(2.5) +float(2.5) > int(0) +float(2.5) > string(6) "string" +float(2.5) <= string(3) "123" +float(2.5) <= string(3) "2.5" +float(2.5) > NULL +float(2.5) <= bool(true) +float(2.5) > bool(false) +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + > object(stdClass)#%d (0) {} +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + > object(stdClass)#%d (0) {} +float(2.5) +Notice: Object of class test could not be converted to double in %s on line %d + > object(test)#%d (0) {} +float(2.5) <= array(0) {} +float(2.5) > int(-9223372036854775808) +float(2.5) > string(20) "-9223372036854775808" +int(0) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) <= string(0) "" +int(0) <= int(1) +int(0) <= float(2.5) +int(0) <= int(0) +int(0) <= string(6) "string" +int(0) <= string(3) "123" +int(0) <= string(3) "2.5" +int(0) <= NULL +int(0) <= bool(true) +int(0) <= bool(false) +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(0) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#%d (0) {} +int(0) <= array(0) {} +int(0) > int(-9223372036854775808) +int(0) > string(20) "-9223372036854775808" +string(6) "string" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" > string(0) "" +string(6) "string" <= int(1) +string(6) "string" <= float(2.5) +string(6) "string" <= int(0) +string(6) "string" <= string(6) "string" +string(6) "string" > string(3) "123" +string(6) "string" > string(3) "2.5" +string(6) "string" > NULL +string(6) "string" <= bool(true) +string(6) "string" > bool(false) +string(6) "string" <= object(stdClass)#%d (0) {} +string(6) "string" <= object(stdClass)#%d (0) {} +string(6) "string" <= object(test)#%d (0) {} +string(6) "string" <= array(0) {} +string(6) "string" > int(-9223372036854775808) +string(6) "string" > string(20) "-9223372036854775808" +string(3) "123" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" > string(0) "" +string(3) "123" > int(1) +string(3) "123" > float(2.5) +string(3) "123" > int(0) +string(3) "123" <= string(6) "string" +string(3) "123" <= string(3) "123" +string(3) "123" > string(3) "2.5" +string(3) "123" > NULL +string(3) "123" <= bool(true) +string(3) "123" > bool(false) +string(3) "123" <= object(stdClass)#%d (0) {} +string(3) "123" <= object(stdClass)#%d (0) {} +string(3) "123" <= object(test)#%d (0) {} +string(3) "123" <= array(0) {} +string(3) "123" > int(-9223372036854775808) +string(3) "123" > string(20) "-9223372036854775808" +string(3) "2.5" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" > string(0) "" +string(3) "2.5" > int(1) +string(3) "2.5" <= float(2.5) +string(3) "2.5" > int(0) +string(3) "2.5" <= string(6) "string" +string(3) "2.5" <= string(3) "123" +string(3) "2.5" <= string(3) "2.5" +string(3) "2.5" > NULL +string(3) "2.5" <= bool(true) +string(3) "2.5" > bool(false) +string(3) "2.5" <= object(stdClass)#%d (0) {} +string(3) "2.5" <= object(stdClass)#%d (0) {} +string(3) "2.5" <= object(test)#%d (0) {} +string(3) "2.5" <= array(0) {} +string(3) "2.5" > int(-9223372036854775808) +string(3) "2.5" > string(20) "-9223372036854775808" +NULL <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL <= string(0) "" +NULL <= int(1) +NULL <= float(2.5) +NULL <= int(0) +NULL <= string(6) "string" +NULL <= string(3) "123" +NULL <= string(3) "2.5" +NULL <= NULL +NULL <= bool(true) +NULL <= bool(false) +NULL <= object(stdClass)#%d (0) {} +NULL <= object(stdClass)#%d (0) {} +NULL <= object(test)#%d (0) {} +NULL <= array(0) {} +NULL <= int(-9223372036854775808) +NULL <= string(20) "-9223372036854775808" +bool(true) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) > string(0) "" +bool(true) <= int(1) +bool(true) <= float(2.5) +bool(true) > int(0) +bool(true) <= string(6) "string" +bool(true) <= string(3) "123" +bool(true) <= string(3) "2.5" +bool(true) > NULL +bool(true) <= bool(true) +bool(true) > bool(false) +bool(true) <= object(stdClass)#%d (0) {} +bool(true) <= object(stdClass)#%d (0) {} +bool(true) <= object(test)#%d (0) {} +bool(true) > array(0) {} +bool(true) <= int(-9223372036854775808) +bool(true) <= string(20) "-9223372036854775808" +bool(false) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) <= string(0) "" +bool(false) <= int(1) +bool(false) <= float(2.5) +bool(false) <= int(0) +bool(false) <= string(6) "string" +bool(false) <= string(3) "123" +bool(false) <= string(3) "2.5" +bool(false) <= NULL +bool(false) <= bool(true) +bool(false) <= bool(false) +bool(false) <= object(stdClass)#%d (0) {} +bool(false) <= object(stdClass)#%d (0) {} +bool(false) <= object(test)#%d (0) {} +bool(false) <= array(0) {} +bool(false) <= int(-9223372036854775808) +bool(false) <= string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} > string(0) "" +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= int(1) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + <= float(2.5) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(0) +object(stdClass)#%d (0) {} > string(6) "string" +object(stdClass)#%d (0) {} > string(3) "123" +object(stdClass)#%d (0) {} > string(3) "2.5" +object(stdClass)#%d (0) {} > NULL +object(stdClass)#%d (0) {} <= bool(true) +object(stdClass)#%d (0) {} > bool(false) +object(stdClass)#%d (0) {} <= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} <= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} <= object(test)#%d (0) {} +object(stdClass)#%d (0) {} > array(0) {} +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(-9223372036854775808) +object(stdClass)#%d (0) {} > string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} > string(0) "" +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= int(1) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + <= float(2.5) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(0) +object(stdClass)#%d (0) {} > string(6) "string" +object(stdClass)#%d (0) {} > string(3) "123" +object(stdClass)#%d (0) {} > string(3) "2.5" +object(stdClass)#%d (0) {} > NULL +object(stdClass)#%d (0) {} <= bool(true) +object(stdClass)#%d (0) {} > bool(false) +object(stdClass)#%d (0) {} <= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} <= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} <= object(test)#%d (0) {} +object(stdClass)#%d (0) {} > array(0) {} +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(-9223372036854775808) +object(stdClass)#%d (0) {} > string(20) "-9223372036854775808" +object(test)#%d (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#%d (0) {} > string(0) "" +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + <= int(1) +object(test)#%d (0) {} +Notice: Object of class test could not be converted to double in %s on line %d + <= float(2.5) +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + > int(0) +object(test)#%d (0) {} > string(6) "string" +object(test)#%d (0) {} > string(3) "123" +object(test)#%d (0) {} > string(3) "2.5" +object(test)#%d (0) {} > NULL +object(test)#%d (0) {} <= bool(true) +object(test)#%d (0) {} > bool(false) +object(test)#%d (0) {} <= object(stdClass)#%d (0) {} +object(test)#%d (0) {} <= object(stdClass)#%d (0) {} +object(test)#%d (0) {} <= object(test)#%d (0) {} +object(test)#%d (0) {} > array(0) {} +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + > int(-9223372036854775808) +object(test)#%d (0) {} > string(20) "-9223372036854775808" +array(0) {} <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} > string(0) "" +array(0) {} > int(1) +array(0) {} > float(2.5) +array(0) {} > int(0) +array(0) {} > string(6) "string" +array(0) {} > string(3) "123" +array(0) {} > string(3) "2.5" +array(0) {} <= NULL +array(0) {} <= bool(true) +array(0) {} <= bool(false) +array(0) {} <= object(stdClass)#%d (0) {} +array(0) {} <= object(stdClass)#%d (0) {} +array(0) {} <= object(test)#%d (0) {} +array(0) {} <= array(0) {} +array(0) {} > int(-9223372036854775808) +array(0) {} > string(20) "-9223372036854775808" +int(-9223372036854775808) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-9223372036854775808) <= string(0) "" +int(-9223372036854775808) <= int(1) +int(-9223372036854775808) <= float(2.5) +int(-9223372036854775808) <= int(0) +int(-9223372036854775808) <= string(6) "string" +int(-9223372036854775808) <= string(3) "123" +int(-9223372036854775808) <= string(3) "2.5" +int(-9223372036854775808) > NULL +int(-9223372036854775808) <= bool(true) +int(-9223372036854775808) > bool(false) +int(-9223372036854775808) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(-9223372036854775808) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(-9223372036854775808) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#%d (0) {} +int(-9223372036854775808) <= array(0) {} +int(-9223372036854775808) <= int(-9223372036854775808) +int(-9223372036854775808) <= string(20) "-9223372036854775808" +string(20) "-9223372036854775808" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(20) "-9223372036854775808" > string(0) "" +string(20) "-9223372036854775808" <= int(1) +string(20) "-9223372036854775808" <= float(2.5) +string(20) "-9223372036854775808" <= int(0) +string(20) "-9223372036854775808" <= string(6) "string" +string(20) "-9223372036854775808" <= string(3) "123" +string(20) "-9223372036854775808" <= string(3) "2.5" +string(20) "-9223372036854775808" > NULL +string(20) "-9223372036854775808" <= bool(true) +string(20) "-9223372036854775808" > bool(false) +string(20) "-9223372036854775808" <= object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" <= object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" <= object(test)#%d (0) {} +string(20) "-9223372036854775808" <= array(0) {} +string(20) "-9223372036854775808" <= int(-9223372036854775808) +string(20) "-9223372036854775808" <= string(20) "-9223372036854775808" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_004.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_004.phpt new file mode 100644 index 0000000000000..69131cd5cd756 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_004.phpt @@ -0,0 +1,389 @@ +--TEST-- +comparing different variables (less than) +--SKIPIF-- + +--FILE-- += "; + my_dump($a[$i]); + echo "\n"; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +array(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)} >= string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(stdClass)#1 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(stdClass)#2 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(test)#3 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(-2147483648) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(11) "-2147483648" +string(0) "" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" >= string(0) "" +string(0) "" < int(1) +string(0) "" < float(2.5) +string(0) "" >= int(0) +string(0) "" < string(6) "string" +string(0) "" < string(3) "123" +string(0) "" < string(3) "2.5" +string(0) "" >= NULL +string(0) "" < bool(true) +string(0) "" >= bool(false) +string(0) "" < object(stdClass)#1 (0) {} +string(0) "" < object(stdClass)#2 (0) {} +string(0) "" < object(test)#3 (0) {} +string(0) "" < array(0) {} +string(0) "" >= int(-2147483648) +string(0) "" < string(11) "-2147483648" +int(1) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) >= string(0) "" +int(1) >= int(1) +int(1) < float(2.5) +int(1) >= int(0) +int(1) >= string(6) "string" +int(1) < string(3) "123" +int(1) < string(3) "2.5" +int(1) >= NULL +int(1) >= bool(true) +int(1) >= bool(false) +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= object(stdClass)#1 (0) {} +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= object(stdClass)#2 (0) {} +int(1) +Notice: Object of class test could not be converted to int in %s on line %d + >= object(test)#3 (0) {} +int(1) < array(0) {} +int(1) >= int(-2147483648) +int(1) >= string(11) "-2147483648" +float(2.5) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) >= string(0) "" +float(2.5) >= int(1) +float(2.5) >= float(2.5) +float(2.5) >= int(0) +float(2.5) >= string(6) "string" +float(2.5) < string(3) "123" +float(2.5) >= string(3) "2.5" +float(2.5) >= NULL +float(2.5) >= bool(true) +float(2.5) >= bool(false) +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + >= object(stdClass)#1 (0) {} +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + >= object(stdClass)#2 (0) {} +float(2.5) +Notice: Object of class test could not be converted to double in %s on line %d + >= object(test)#3 (0) {} +float(2.5) < array(0) {} +float(2.5) >= int(-2147483648) +float(2.5) >= string(11) "-2147483648" +int(0) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) >= string(0) "" +int(0) < int(1) +int(0) < float(2.5) +int(0) >= int(0) +int(0) >= string(6) "string" +int(0) < string(3) "123" +int(0) < string(3) "2.5" +int(0) >= NULL +int(0) < bool(true) +int(0) >= bool(false) +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#1 (0) {} +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#2 (0) {} +int(0) +Notice: Object of class test could not be converted to int in %s on line %d + < object(test)#3 (0) {} +int(0) < array(0) {} +int(0) >= int(-2147483648) +int(0) >= string(11) "-2147483648" +string(6) "string" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" >= string(0) "" +string(6) "string" < int(1) +string(6) "string" < float(2.5) +string(6) "string" >= int(0) +string(6) "string" >= string(6) "string" +string(6) "string" >= string(3) "123" +string(6) "string" >= string(3) "2.5" +string(6) "string" >= NULL +string(6) "string" >= bool(true) +string(6) "string" >= bool(false) +string(6) "string" < object(stdClass)#1 (0) {} +string(6) "string" < object(stdClass)#2 (0) {} +string(6) "string" < object(test)#3 (0) {} +string(6) "string" < array(0) {} +string(6) "string" >= int(-2147483648) +string(6) "string" >= string(11) "-2147483648" +string(3) "123" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" >= string(0) "" +string(3) "123" >= int(1) +string(3) "123" >= float(2.5) +string(3) "123" >= int(0) +string(3) "123" < string(6) "string" +string(3) "123" >= string(3) "123" +string(3) "123" >= string(3) "2.5" +string(3) "123" >= NULL +string(3) "123" >= bool(true) +string(3) "123" >= bool(false) +string(3) "123" < object(stdClass)#1 (0) {} +string(3) "123" < object(stdClass)#2 (0) {} +string(3) "123" < object(test)#3 (0) {} +string(3) "123" < array(0) {} +string(3) "123" >= int(-2147483648) +string(3) "123" >= string(11) "-2147483648" +string(3) "2.5" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" >= string(0) "" +string(3) "2.5" >= int(1) +string(3) "2.5" >= float(2.5) +string(3) "2.5" >= int(0) +string(3) "2.5" < string(6) "string" +string(3) "2.5" < string(3) "123" +string(3) "2.5" >= string(3) "2.5" +string(3) "2.5" >= NULL +string(3) "2.5" >= bool(true) +string(3) "2.5" >= bool(false) +string(3) "2.5" < object(stdClass)#1 (0) {} +string(3) "2.5" < object(stdClass)#2 (0) {} +string(3) "2.5" < object(test)#3 (0) {} +string(3) "2.5" < array(0) {} +string(3) "2.5" >= int(-2147483648) +string(3) "2.5" >= string(11) "-2147483648" +NULL < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL >= string(0) "" +NULL < int(1) +NULL < float(2.5) +NULL >= int(0) +NULL < string(6) "string" +NULL < string(3) "123" +NULL < string(3) "2.5" +NULL >= NULL +NULL < bool(true) +NULL >= bool(false) +NULL < object(stdClass)#1 (0) {} +NULL < object(stdClass)#2 (0) {} +NULL < object(test)#3 (0) {} +NULL >= array(0) {} +NULL < int(-2147483648) +NULL < string(11) "-2147483648" +bool(true) >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) >= string(0) "" +bool(true) >= int(1) +bool(true) >= float(2.5) +bool(true) >= int(0) +bool(true) >= string(6) "string" +bool(true) >= string(3) "123" +bool(true) >= string(3) "2.5" +bool(true) >= NULL +bool(true) >= bool(true) +bool(true) >= bool(false) +bool(true) >= object(stdClass)#1 (0) {} +bool(true) >= object(stdClass)#2 (0) {} +bool(true) >= object(test)#3 (0) {} +bool(true) >= array(0) {} +bool(true) >= int(-2147483648) +bool(true) >= string(11) "-2147483648" +bool(false) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) >= string(0) "" +bool(false) < int(1) +bool(false) < float(2.5) +bool(false) >= int(0) +bool(false) < string(6) "string" +bool(false) < string(3) "123" +bool(false) < string(3) "2.5" +bool(false) >= NULL +bool(false) < bool(true) +bool(false) >= bool(false) +bool(false) < object(stdClass)#1 (0) {} +bool(false) < object(stdClass)#2 (0) {} +bool(false) < object(test)#3 (0) {} +bool(false) >= array(0) {} +bool(false) < int(-2147483648) +bool(false) < string(11) "-2147483648" +object(stdClass)#1 (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#1 (0) {} >= string(0) "" +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(1) +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + < float(2.5) +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(0) +object(stdClass)#1 (0) {} >= string(6) "string" +object(stdClass)#1 (0) {} >= string(3) "123" +object(stdClass)#1 (0) {} >= string(3) "2.5" +object(stdClass)#1 (0) {} >= NULL +object(stdClass)#1 (0) {} >= bool(true) +object(stdClass)#1 (0) {} >= bool(false) +object(stdClass)#1 (0) {} >= object(stdClass)#1 (0) {} +object(stdClass)#1 (0) {} >= object(stdClass)#2 (0) {} +object(stdClass)#1 (0) {} >= object(test)#3 (0) {} +object(stdClass)#1 (0) {} >= array(0) {} +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(-2147483648) +object(stdClass)#1 (0) {} >= string(11) "-2147483648" +object(stdClass)#2 (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#2 (0) {} >= string(0) "" +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(1) +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + < float(2.5) +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(0) +object(stdClass)#2 (0) {} >= string(6) "string" +object(stdClass)#2 (0) {} >= string(3) "123" +object(stdClass)#2 (0) {} >= string(3) "2.5" +object(stdClass)#2 (0) {} >= NULL +object(stdClass)#2 (0) {} >= bool(true) +object(stdClass)#2 (0) {} >= bool(false) +object(stdClass)#2 (0) {} >= object(stdClass)#1 (0) {} +object(stdClass)#2 (0) {} >= object(stdClass)#2 (0) {} +object(stdClass)#2 (0) {} >= object(test)#3 (0) {} +object(stdClass)#2 (0) {} >= array(0) {} +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(-2147483648) +object(stdClass)#2 (0) {} >= string(11) "-2147483648" +object(test)#3 (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#3 (0) {} >= string(0) "" +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(1) +object(test)#3 (0) {} +Notice: Object of class test could not be converted to double in %s on line %d + < float(2.5) +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(0) +object(test)#3 (0) {} >= string(6) "string" +object(test)#3 (0) {} >= string(3) "123" +object(test)#3 (0) {} >= string(3) "2.5" +object(test)#3 (0) {} >= NULL +object(test)#3 (0) {} >= bool(true) +object(test)#3 (0) {} >= bool(false) +object(test)#3 (0) {} >= object(stdClass)#1 (0) {} +object(test)#3 (0) {} >= object(stdClass)#2 (0) {} +object(test)#3 (0) {} >= object(test)#3 (0) {} +object(test)#3 (0) {} >= array(0) {} +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(-2147483648) +object(test)#3 (0) {} >= string(11) "-2147483648" +array(0) {} < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} >= string(0) "" +array(0) {} >= int(1) +array(0) {} >= float(2.5) +array(0) {} >= int(0) +array(0) {} >= string(6) "string" +array(0) {} >= string(3) "123" +array(0) {} >= string(3) "2.5" +array(0) {} >= NULL +array(0) {} < bool(true) +array(0) {} >= bool(false) +array(0) {} < object(stdClass)#1 (0) {} +array(0) {} < object(stdClass)#2 (0) {} +array(0) {} < object(test)#3 (0) {} +array(0) {} >= array(0) {} +array(0) {} >= int(-2147483648) +array(0) {} >= string(11) "-2147483648" +int(-2147483648) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-2147483648) < string(0) "" +int(-2147483648) < int(1) +int(-2147483648) < float(2.5) +int(-2147483648) < int(0) +int(-2147483648) < string(6) "string" +int(-2147483648) < string(3) "123" +int(-2147483648) < string(3) "2.5" +int(-2147483648) >= NULL +int(-2147483648) >= bool(true) +int(-2147483648) >= bool(false) +int(-2147483648) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#1 (0) {} +int(-2147483648) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#2 (0) {} +int(-2147483648) +Notice: Object of class test could not be converted to int in %s on line %d + < object(test)#3 (0) {} +int(-2147483648) < array(0) {} +int(-2147483648) >= int(-2147483648) +int(-2147483648) >= string(11) "-2147483648" +string(11) "-2147483648" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(11) "-2147483648" >= string(0) "" +string(11) "-2147483648" < int(1) +string(11) "-2147483648" < float(2.5) +string(11) "-2147483648" < int(0) +string(11) "-2147483648" < string(6) "string" +string(11) "-2147483648" < string(3) "123" +string(11) "-2147483648" < string(3) "2.5" +string(11) "-2147483648" >= NULL +string(11) "-2147483648" >= bool(true) +string(11) "-2147483648" >= bool(false) +string(11) "-2147483648" < object(stdClass)#1 (0) {} +string(11) "-2147483648" < object(stdClass)#2 (0) {} +string(11) "-2147483648" < object(test)#3 (0) {} +string(11) "-2147483648" < array(0) {} +string(11) "-2147483648" >= int(-2147483648) +string(11) "-2147483648" >= string(11) "-2147483648" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_004_64bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_004_64bit.phpt new file mode 100644 index 0000000000000..36bdaa78ee744 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_004_64bit.phpt @@ -0,0 +1,389 @@ +--TEST-- +comparing different variables (less than) +--SKIPIF-- + +--FILE-- += "; + my_dump($a[$i]); + echo "\n"; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +array(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)} >= string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(test)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(-9223372036854775808) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(20) "-9223372036854775808" +string(0) "" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" >= string(0) "" +string(0) "" < int(1) +string(0) "" < float(2.5) +string(0) "" >= int(0) +string(0) "" < string(6) "string" +string(0) "" < string(3) "123" +string(0) "" < string(3) "2.5" +string(0) "" >= NULL +string(0) "" < bool(true) +string(0) "" >= bool(false) +string(0) "" < object(stdClass)#%d (0) {} +string(0) "" < object(stdClass)#%d (0) {} +string(0) "" < object(test)#%d (0) {} +string(0) "" < array(0) {} +string(0) "" >= int(-9223372036854775808) +string(0) "" < string(20) "-9223372036854775808" +int(1) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) >= string(0) "" +int(1) >= int(1) +int(1) < float(2.5) +int(1) >= int(0) +int(1) >= string(6) "string" +int(1) < string(3) "123" +int(1) < string(3) "2.5" +int(1) >= NULL +int(1) >= bool(true) +int(1) >= bool(false) +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= object(stdClass)#%d (0) {} +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= object(stdClass)#%d (0) {} +int(1) +Notice: Object of class test could not be converted to int in %s on line %d + >= object(test)#%d (0) {} +int(1) < array(0) {} +int(1) >= int(-9223372036854775808) +int(1) >= string(20) "-9223372036854775808" +float(2.5) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) >= string(0) "" +float(2.5) >= int(1) +float(2.5) >= float(2.5) +float(2.5) >= int(0) +float(2.5) >= string(6) "string" +float(2.5) < string(3) "123" +float(2.5) >= string(3) "2.5" +float(2.5) >= NULL +float(2.5) >= bool(true) +float(2.5) >= bool(false) +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + >= object(stdClass)#%d (0) {} +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + >= object(stdClass)#%d (0) {} +float(2.5) +Notice: Object of class test could not be converted to double in %s on line %d + >= object(test)#%d (0) {} +float(2.5) < array(0) {} +float(2.5) >= int(-9223372036854775808) +float(2.5) >= string(20) "-9223372036854775808" +int(0) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) >= string(0) "" +int(0) < int(1) +int(0) < float(2.5) +int(0) >= int(0) +int(0) >= string(6) "string" +int(0) < string(3) "123" +int(0) < string(3) "2.5" +int(0) >= NULL +int(0) < bool(true) +int(0) >= bool(false) +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#%d (0) {} +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#%d (0) {} +int(0) +Notice: Object of class test could not be converted to int in %s on line %d + < object(test)#%d (0) {} +int(0) < array(0) {} +int(0) >= int(-9223372036854775808) +int(0) >= string(20) "-9223372036854775808" +string(6) "string" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" >= string(0) "" +string(6) "string" < int(1) +string(6) "string" < float(2.5) +string(6) "string" >= int(0) +string(6) "string" >= string(6) "string" +string(6) "string" >= string(3) "123" +string(6) "string" >= string(3) "2.5" +string(6) "string" >= NULL +string(6) "string" >= bool(true) +string(6) "string" >= bool(false) +string(6) "string" < object(stdClass)#%d (0) {} +string(6) "string" < object(stdClass)#%d (0) {} +string(6) "string" < object(test)#%d (0) {} +string(6) "string" < array(0) {} +string(6) "string" >= int(-9223372036854775808) +string(6) "string" >= string(20) "-9223372036854775808" +string(3) "123" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" >= string(0) "" +string(3) "123" >= int(1) +string(3) "123" >= float(2.5) +string(3) "123" >= int(0) +string(3) "123" < string(6) "string" +string(3) "123" >= string(3) "123" +string(3) "123" >= string(3) "2.5" +string(3) "123" >= NULL +string(3) "123" >= bool(true) +string(3) "123" >= bool(false) +string(3) "123" < object(stdClass)#%d (0) {} +string(3) "123" < object(stdClass)#%d (0) {} +string(3) "123" < object(test)#%d (0) {} +string(3) "123" < array(0) {} +string(3) "123" >= int(-9223372036854775808) +string(3) "123" >= string(20) "-9223372036854775808" +string(3) "2.5" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" >= string(0) "" +string(3) "2.5" >= int(1) +string(3) "2.5" >= float(2.5) +string(3) "2.5" >= int(0) +string(3) "2.5" < string(6) "string" +string(3) "2.5" < string(3) "123" +string(3) "2.5" >= string(3) "2.5" +string(3) "2.5" >= NULL +string(3) "2.5" >= bool(true) +string(3) "2.5" >= bool(false) +string(3) "2.5" < object(stdClass)#%d (0) {} +string(3) "2.5" < object(stdClass)#%d (0) {} +string(3) "2.5" < object(test)#%d (0) {} +string(3) "2.5" < array(0) {} +string(3) "2.5" >= int(-9223372036854775808) +string(3) "2.5" >= string(20) "-9223372036854775808" +NULL < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL >= string(0) "" +NULL < int(1) +NULL < float(2.5) +NULL >= int(0) +NULL < string(6) "string" +NULL < string(3) "123" +NULL < string(3) "2.5" +NULL >= NULL +NULL < bool(true) +NULL >= bool(false) +NULL < object(stdClass)#%d (0) {} +NULL < object(stdClass)#%d (0) {} +NULL < object(test)#%d (0) {} +NULL >= array(0) {} +NULL < int(-9223372036854775808) +NULL < string(20) "-9223372036854775808" +bool(true) >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) >= string(0) "" +bool(true) >= int(1) +bool(true) >= float(2.5) +bool(true) >= int(0) +bool(true) >= string(6) "string" +bool(true) >= string(3) "123" +bool(true) >= string(3) "2.5" +bool(true) >= NULL +bool(true) >= bool(true) +bool(true) >= bool(false) +bool(true) >= object(stdClass)#%d (0) {} +bool(true) >= object(stdClass)#%d (0) {} +bool(true) >= object(test)#%d (0) {} +bool(true) >= array(0) {} +bool(true) >= int(-9223372036854775808) +bool(true) >= string(20) "-9223372036854775808" +bool(false) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) >= string(0) "" +bool(false) < int(1) +bool(false) < float(2.5) +bool(false) >= int(0) +bool(false) < string(6) "string" +bool(false) < string(3) "123" +bool(false) < string(3) "2.5" +bool(false) >= NULL +bool(false) < bool(true) +bool(false) >= bool(false) +bool(false) < object(stdClass)#%d (0) {} +bool(false) < object(stdClass)#%d (0) {} +bool(false) < object(test)#%d (0) {} +bool(false) >= array(0) {} +bool(false) < int(-9223372036854775808) +bool(false) < string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} >= string(0) "" +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(1) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + < float(2.5) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(0) +object(stdClass)#%d (0) {} >= string(6) "string" +object(stdClass)#%d (0) {} >= string(3) "123" +object(stdClass)#%d (0) {} >= string(3) "2.5" +object(stdClass)#%d (0) {} >= NULL +object(stdClass)#%d (0) {} >= bool(true) +object(stdClass)#%d (0) {} >= bool(false) +object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} >= object(test)#%d (0) {} +object(stdClass)#%d (0) {} >= array(0) {} +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(-9223372036854775808) +object(stdClass)#%d (0) {} >= string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} >= string(0) "" +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(1) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + < float(2.5) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(0) +object(stdClass)#%d (0) {} >= string(6) "string" +object(stdClass)#%d (0) {} >= string(3) "123" +object(stdClass)#%d (0) {} >= string(3) "2.5" +object(stdClass)#%d (0) {} >= NULL +object(stdClass)#%d (0) {} >= bool(true) +object(stdClass)#%d (0) {} >= bool(false) +object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} >= object(test)#%d (0) {} +object(stdClass)#%d (0) {} >= array(0) {} +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(-9223372036854775808) +object(stdClass)#%d (0) {} >= string(20) "-9223372036854775808" +object(test)#%d (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#%d (0) {} >= string(0) "" +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(1) +object(test)#%d (0) {} +Notice: Object of class test could not be converted to double in %s on line %d + < float(2.5) +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(0) +object(test)#%d (0) {} >= string(6) "string" +object(test)#%d (0) {} >= string(3) "123" +object(test)#%d (0) {} >= string(3) "2.5" +object(test)#%d (0) {} >= NULL +object(test)#%d (0) {} >= bool(true) +object(test)#%d (0) {} >= bool(false) +object(test)#%d (0) {} >= object(stdClass)#%d (0) {} +object(test)#%d (0) {} >= object(stdClass)#%d (0) {} +object(test)#%d (0) {} >= object(test)#%d (0) {} +object(test)#%d (0) {} >= array(0) {} +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(-9223372036854775808) +object(test)#%d (0) {} >= string(20) "-9223372036854775808" +array(0) {} < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} >= string(0) "" +array(0) {} >= int(1) +array(0) {} >= float(2.5) +array(0) {} >= int(0) +array(0) {} >= string(6) "string" +array(0) {} >= string(3) "123" +array(0) {} >= string(3) "2.5" +array(0) {} >= NULL +array(0) {} < bool(true) +array(0) {} >= bool(false) +array(0) {} < object(stdClass)#%d (0) {} +array(0) {} < object(stdClass)#%d (0) {} +array(0) {} < object(test)#%d (0) {} +array(0) {} >= array(0) {} +array(0) {} >= int(-9223372036854775808) +array(0) {} >= string(20) "-9223372036854775808" +int(-9223372036854775808) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-9223372036854775808) < string(0) "" +int(-9223372036854775808) < int(1) +int(-9223372036854775808) < float(2.5) +int(-9223372036854775808) < int(0) +int(-9223372036854775808) < string(6) "string" +int(-9223372036854775808) < string(3) "123" +int(-9223372036854775808) < string(3) "2.5" +int(-9223372036854775808) >= NULL +int(-9223372036854775808) >= bool(true) +int(-9223372036854775808) >= bool(false) +int(-9223372036854775808) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#%d (0) {} +int(-9223372036854775808) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#%d (0) {} +int(-9223372036854775808) +Notice: Object of class test could not be converted to int in %s on line %d + < object(test)#%d (0) {} +int(-9223372036854775808) < array(0) {} +int(-9223372036854775808) >= int(-9223372036854775808) +int(-9223372036854775808) >= string(20) "-9223372036854775808" +string(20) "-9223372036854775808" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(20) "-9223372036854775808" >= string(0) "" +string(20) "-9223372036854775808" < int(1) +string(20) "-9223372036854775808" < float(2.5) +string(20) "-9223372036854775808" < int(0) +string(20) "-9223372036854775808" < string(6) "string" +string(20) "-9223372036854775808" < string(3) "123" +string(20) "-9223372036854775808" < string(3) "2.5" +string(20) "-9223372036854775808" >= NULL +string(20) "-9223372036854775808" >= bool(true) +string(20) "-9223372036854775808" >= bool(false) +string(20) "-9223372036854775808" < object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" < object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" < object(test)#%d (0) {} +string(20) "-9223372036854775808" < array(0) {} +string(20) "-9223372036854775808" >= int(-9223372036854775808) +string(20) "-9223372036854775808" >= string(20) "-9223372036854775808" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_005.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_005.phpt new file mode 100644 index 0000000000000..4f5cd80b542af --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_005.phpt @@ -0,0 +1,389 @@ +--TEST-- +comparing different variables (greater or equal than) +--SKIPIF-- + +--FILE-- += $a[$i]) ? " >= " : " < "; + my_dump($a[$i]); + echo "\n"; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +array(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)} >= string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(stdClass)#1 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(stdClass)#2 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(test)#3 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(-2147483648) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(11) "-2147483648" +string(0) "" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" >= string(0) "" +string(0) "" < int(1) +string(0) "" < float(2.5) +string(0) "" >= int(0) +string(0) "" < string(6) "string" +string(0) "" < string(3) "123" +string(0) "" < string(3) "2.5" +string(0) "" >= NULL +string(0) "" < bool(true) +string(0) "" >= bool(false) +string(0) "" < object(stdClass)#1 (0) {} +string(0) "" < object(stdClass)#2 (0) {} +string(0) "" < object(test)#3 (0) {} +string(0) "" < array(0) {} +string(0) "" >= int(-2147483648) +string(0) "" < string(11) "-2147483648" +int(1) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) >= string(0) "" +int(1) >= int(1) +int(1) < float(2.5) +int(1) >= int(0) +int(1) >= string(6) "string" +int(1) < string(3) "123" +int(1) < string(3) "2.5" +int(1) >= NULL +int(1) >= bool(true) +int(1) >= bool(false) +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= object(stdClass)#1 (0) {} +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= object(stdClass)#2 (0) {} +int(1) +Notice: Object of class test could not be converted to int in %s on line %d + >= object(test)#3 (0) {} +int(1) < array(0) {} +int(1) >= int(-2147483648) +int(1) >= string(11) "-2147483648" +float(2.5) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) >= string(0) "" +float(2.5) >= int(1) +float(2.5) >= float(2.5) +float(2.5) >= int(0) +float(2.5) >= string(6) "string" +float(2.5) < string(3) "123" +float(2.5) >= string(3) "2.5" +float(2.5) >= NULL +float(2.5) >= bool(true) +float(2.5) >= bool(false) +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + >= object(stdClass)#1 (0) {} +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + >= object(stdClass)#2 (0) {} +float(2.5) +Notice: Object of class test could not be converted to double in %s on line %d + >= object(test)#3 (0) {} +float(2.5) < array(0) {} +float(2.5) >= int(-2147483648) +float(2.5) >= string(11) "-2147483648" +int(0) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) >= string(0) "" +int(0) < int(1) +int(0) < float(2.5) +int(0) >= int(0) +int(0) >= string(6) "string" +int(0) < string(3) "123" +int(0) < string(3) "2.5" +int(0) >= NULL +int(0) < bool(true) +int(0) >= bool(false) +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#1 (0) {} +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#2 (0) {} +int(0) +Notice: Object of class test could not be converted to int in %s on line %d + < object(test)#3 (0) {} +int(0) < array(0) {} +int(0) >= int(-2147483648) +int(0) >= string(11) "-2147483648" +string(6) "string" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" >= string(0) "" +string(6) "string" < int(1) +string(6) "string" < float(2.5) +string(6) "string" >= int(0) +string(6) "string" >= string(6) "string" +string(6) "string" >= string(3) "123" +string(6) "string" >= string(3) "2.5" +string(6) "string" >= NULL +string(6) "string" >= bool(true) +string(6) "string" >= bool(false) +string(6) "string" < object(stdClass)#1 (0) {} +string(6) "string" < object(stdClass)#2 (0) {} +string(6) "string" < object(test)#3 (0) {} +string(6) "string" < array(0) {} +string(6) "string" >= int(-2147483648) +string(6) "string" >= string(11) "-2147483648" +string(3) "123" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" >= string(0) "" +string(3) "123" >= int(1) +string(3) "123" >= float(2.5) +string(3) "123" >= int(0) +string(3) "123" < string(6) "string" +string(3) "123" >= string(3) "123" +string(3) "123" >= string(3) "2.5" +string(3) "123" >= NULL +string(3) "123" >= bool(true) +string(3) "123" >= bool(false) +string(3) "123" < object(stdClass)#1 (0) {} +string(3) "123" < object(stdClass)#2 (0) {} +string(3) "123" < object(test)#3 (0) {} +string(3) "123" < array(0) {} +string(3) "123" >= int(-2147483648) +string(3) "123" >= string(11) "-2147483648" +string(3) "2.5" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" >= string(0) "" +string(3) "2.5" >= int(1) +string(3) "2.5" >= float(2.5) +string(3) "2.5" >= int(0) +string(3) "2.5" < string(6) "string" +string(3) "2.5" < string(3) "123" +string(3) "2.5" >= string(3) "2.5" +string(3) "2.5" >= NULL +string(3) "2.5" >= bool(true) +string(3) "2.5" >= bool(false) +string(3) "2.5" < object(stdClass)#1 (0) {} +string(3) "2.5" < object(stdClass)#2 (0) {} +string(3) "2.5" < object(test)#3 (0) {} +string(3) "2.5" < array(0) {} +string(3) "2.5" >= int(-2147483648) +string(3) "2.5" >= string(11) "-2147483648" +NULL < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL >= string(0) "" +NULL < int(1) +NULL < float(2.5) +NULL >= int(0) +NULL < string(6) "string" +NULL < string(3) "123" +NULL < string(3) "2.5" +NULL >= NULL +NULL < bool(true) +NULL >= bool(false) +NULL < object(stdClass)#1 (0) {} +NULL < object(stdClass)#2 (0) {} +NULL < object(test)#3 (0) {} +NULL >= array(0) {} +NULL < int(-2147483648) +NULL < string(11) "-2147483648" +bool(true) >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) >= string(0) "" +bool(true) >= int(1) +bool(true) >= float(2.5) +bool(true) >= int(0) +bool(true) >= string(6) "string" +bool(true) >= string(3) "123" +bool(true) >= string(3) "2.5" +bool(true) >= NULL +bool(true) >= bool(true) +bool(true) >= bool(false) +bool(true) >= object(stdClass)#1 (0) {} +bool(true) >= object(stdClass)#2 (0) {} +bool(true) >= object(test)#3 (0) {} +bool(true) >= array(0) {} +bool(true) >= int(-2147483648) +bool(true) >= string(11) "-2147483648" +bool(false) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) >= string(0) "" +bool(false) < int(1) +bool(false) < float(2.5) +bool(false) >= int(0) +bool(false) < string(6) "string" +bool(false) < string(3) "123" +bool(false) < string(3) "2.5" +bool(false) >= NULL +bool(false) < bool(true) +bool(false) >= bool(false) +bool(false) < object(stdClass)#1 (0) {} +bool(false) < object(stdClass)#2 (0) {} +bool(false) < object(test)#3 (0) {} +bool(false) >= array(0) {} +bool(false) < int(-2147483648) +bool(false) < string(11) "-2147483648" +object(stdClass)#1 (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#1 (0) {} >= string(0) "" +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(1) +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + < float(2.5) +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(0) +object(stdClass)#1 (0) {} >= string(6) "string" +object(stdClass)#1 (0) {} >= string(3) "123" +object(stdClass)#1 (0) {} >= string(3) "2.5" +object(stdClass)#1 (0) {} >= NULL +object(stdClass)#1 (0) {} >= bool(true) +object(stdClass)#1 (0) {} >= bool(false) +object(stdClass)#1 (0) {} >= object(stdClass)#1 (0) {} +object(stdClass)#1 (0) {} >= object(stdClass)#2 (0) {} +object(stdClass)#1 (0) {} < object(test)#3 (0) {} +object(stdClass)#1 (0) {} >= array(0) {} +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(-2147483648) +object(stdClass)#1 (0) {} >= string(11) "-2147483648" +object(stdClass)#2 (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#2 (0) {} >= string(0) "" +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(1) +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + < float(2.5) +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(0) +object(stdClass)#2 (0) {} >= string(6) "string" +object(stdClass)#2 (0) {} >= string(3) "123" +object(stdClass)#2 (0) {} >= string(3) "2.5" +object(stdClass)#2 (0) {} >= NULL +object(stdClass)#2 (0) {} >= bool(true) +object(stdClass)#2 (0) {} >= bool(false) +object(stdClass)#2 (0) {} >= object(stdClass)#1 (0) {} +object(stdClass)#2 (0) {} >= object(stdClass)#2 (0) {} +object(stdClass)#2 (0) {} < object(test)#3 (0) {} +object(stdClass)#2 (0) {} >= array(0) {} +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(-2147483648) +object(stdClass)#2 (0) {} >= string(11) "-2147483648" +object(test)#3 (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#3 (0) {} >= string(0) "" +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(1) +object(test)#3 (0) {} +Notice: Object of class test could not be converted to double in %s on line %d + < float(2.5) +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(0) +object(test)#3 (0) {} >= string(6) "string" +object(test)#3 (0) {} >= string(3) "123" +object(test)#3 (0) {} >= string(3) "2.5" +object(test)#3 (0) {} >= NULL +object(test)#3 (0) {} >= bool(true) +object(test)#3 (0) {} >= bool(false) +object(test)#3 (0) {} < object(stdClass)#1 (0) {} +object(test)#3 (0) {} < object(stdClass)#2 (0) {} +object(test)#3 (0) {} >= object(test)#3 (0) {} +object(test)#3 (0) {} >= array(0) {} +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(-2147483648) +object(test)#3 (0) {} >= string(11) "-2147483648" +array(0) {} < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} >= string(0) "" +array(0) {} >= int(1) +array(0) {} >= float(2.5) +array(0) {} >= int(0) +array(0) {} >= string(6) "string" +array(0) {} >= string(3) "123" +array(0) {} >= string(3) "2.5" +array(0) {} >= NULL +array(0) {} < bool(true) +array(0) {} >= bool(false) +array(0) {} < object(stdClass)#1 (0) {} +array(0) {} < object(stdClass)#2 (0) {} +array(0) {} < object(test)#3 (0) {} +array(0) {} >= array(0) {} +array(0) {} >= int(-2147483648) +array(0) {} >= string(11) "-2147483648" +int(-2147483648) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-2147483648) < string(0) "" +int(-2147483648) < int(1) +int(-2147483648) < float(2.5) +int(-2147483648) < int(0) +int(-2147483648) < string(6) "string" +int(-2147483648) < string(3) "123" +int(-2147483648) < string(3) "2.5" +int(-2147483648) >= NULL +int(-2147483648) >= bool(true) +int(-2147483648) >= bool(false) +int(-2147483648) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#1 (0) {} +int(-2147483648) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#2 (0) {} +int(-2147483648) +Notice: Object of class test could not be converted to int in %s on line %d + < object(test)#3 (0) {} +int(-2147483648) < array(0) {} +int(-2147483648) >= int(-2147483648) +int(-2147483648) >= string(11) "-2147483648" +string(11) "-2147483648" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(11) "-2147483648" >= string(0) "" +string(11) "-2147483648" < int(1) +string(11) "-2147483648" < float(2.5) +string(11) "-2147483648" < int(0) +string(11) "-2147483648" < string(6) "string" +string(11) "-2147483648" < string(3) "123" +string(11) "-2147483648" < string(3) "2.5" +string(11) "-2147483648" >= NULL +string(11) "-2147483648" >= bool(true) +string(11) "-2147483648" >= bool(false) +string(11) "-2147483648" < object(stdClass)#1 (0) {} +string(11) "-2147483648" < object(stdClass)#2 (0) {} +string(11) "-2147483648" < object(test)#3 (0) {} +string(11) "-2147483648" < array(0) {} +string(11) "-2147483648" >= int(-2147483648) +string(11) "-2147483648" >= string(11) "-2147483648" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_005_64bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_005_64bit.phpt new file mode 100644 index 0000000000000..69492b3b244ff --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_005_64bit.phpt @@ -0,0 +1,389 @@ +--TEST-- +comparing different variables (greater or equal than) +--SKIPIF-- + +--FILE-- += $a[$i]) ? " >= " : " < "; + my_dump($a[$i]); + echo "\n"; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +array(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)} >= string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} < object(test)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= int(-9223372036854775808) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} >= string(20) "-9223372036854775808" +string(0) "" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" >= string(0) "" +string(0) "" < int(1) +string(0) "" < float(2.5) +string(0) "" >= int(0) +string(0) "" < string(6) "string" +string(0) "" < string(3) "123" +string(0) "" < string(3) "2.5" +string(0) "" >= NULL +string(0) "" < bool(true) +string(0) "" >= bool(false) +string(0) "" < object(stdClass)#%d (0) {} +string(0) "" < object(stdClass)#%d (0) {} +string(0) "" < object(test)#%d (0) {} +string(0) "" < array(0) {} +string(0) "" >= int(-9223372036854775808) +string(0) "" < string(20) "-9223372036854775808" +int(1) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) >= string(0) "" +int(1) >= int(1) +int(1) < float(2.5) +int(1) >= int(0) +int(1) >= string(6) "string" +int(1) < string(3) "123" +int(1) < string(3) "2.5" +int(1) >= NULL +int(1) >= bool(true) +int(1) >= bool(false) +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= object(stdClass)#%d (0) {} +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= object(stdClass)#%d (0) {} +int(1) +Notice: Object of class test could not be converted to int in %s on line %d + >= object(test)#%d (0) {} +int(1) < array(0) {} +int(1) >= int(-9223372036854775808) +int(1) >= string(20) "-9223372036854775808" +float(2.5) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) >= string(0) "" +float(2.5) >= int(1) +float(2.5) >= float(2.5) +float(2.5) >= int(0) +float(2.5) >= string(6) "string" +float(2.5) < string(3) "123" +float(2.5) >= string(3) "2.5" +float(2.5) >= NULL +float(2.5) >= bool(true) +float(2.5) >= bool(false) +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + >= object(stdClass)#%d (0) {} +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + >= object(stdClass)#%d (0) {} +float(2.5) +Notice: Object of class test could not be converted to double in %s on line %d + >= object(test)#%d (0) {} +float(2.5) < array(0) {} +float(2.5) >= int(-9223372036854775808) +float(2.5) >= string(20) "-9223372036854775808" +int(0) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) >= string(0) "" +int(0) < int(1) +int(0) < float(2.5) +int(0) >= int(0) +int(0) >= string(6) "string" +int(0) < string(3) "123" +int(0) < string(3) "2.5" +int(0) >= NULL +int(0) < bool(true) +int(0) >= bool(false) +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#%d (0) {} +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#%d (0) {} +int(0) +Notice: Object of class test could not be converted to int in %s on line %d + < object(test)#%d (0) {} +int(0) < array(0) {} +int(0) >= int(-9223372036854775808) +int(0) >= string(20) "-9223372036854775808" +string(6) "string" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" >= string(0) "" +string(6) "string" < int(1) +string(6) "string" < float(2.5) +string(6) "string" >= int(0) +string(6) "string" >= string(6) "string" +string(6) "string" >= string(3) "123" +string(6) "string" >= string(3) "2.5" +string(6) "string" >= NULL +string(6) "string" >= bool(true) +string(6) "string" >= bool(false) +string(6) "string" < object(stdClass)#%d (0) {} +string(6) "string" < object(stdClass)#%d (0) {} +string(6) "string" < object(test)#%d (0) {} +string(6) "string" < array(0) {} +string(6) "string" >= int(-9223372036854775808) +string(6) "string" >= string(20) "-9223372036854775808" +string(3) "123" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" >= string(0) "" +string(3) "123" >= int(1) +string(3) "123" >= float(2.5) +string(3) "123" >= int(0) +string(3) "123" < string(6) "string" +string(3) "123" >= string(3) "123" +string(3) "123" >= string(3) "2.5" +string(3) "123" >= NULL +string(3) "123" >= bool(true) +string(3) "123" >= bool(false) +string(3) "123" < object(stdClass)#%d (0) {} +string(3) "123" < object(stdClass)#%d (0) {} +string(3) "123" < object(test)#%d (0) {} +string(3) "123" < array(0) {} +string(3) "123" >= int(-9223372036854775808) +string(3) "123" >= string(20) "-9223372036854775808" +string(3) "2.5" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" >= string(0) "" +string(3) "2.5" >= int(1) +string(3) "2.5" >= float(2.5) +string(3) "2.5" >= int(0) +string(3) "2.5" < string(6) "string" +string(3) "2.5" < string(3) "123" +string(3) "2.5" >= string(3) "2.5" +string(3) "2.5" >= NULL +string(3) "2.5" >= bool(true) +string(3) "2.5" >= bool(false) +string(3) "2.5" < object(stdClass)#%d (0) {} +string(3) "2.5" < object(stdClass)#%d (0) {} +string(3) "2.5" < object(test)#%d (0) {} +string(3) "2.5" < array(0) {} +string(3) "2.5" >= int(-9223372036854775808) +string(3) "2.5" >= string(20) "-9223372036854775808" +NULL < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL >= string(0) "" +NULL < int(1) +NULL < float(2.5) +NULL >= int(0) +NULL < string(6) "string" +NULL < string(3) "123" +NULL < string(3) "2.5" +NULL >= NULL +NULL < bool(true) +NULL >= bool(false) +NULL < object(stdClass)#%d (0) {} +NULL < object(stdClass)#%d (0) {} +NULL < object(test)#%d (0) {} +NULL >= array(0) {} +NULL < int(-9223372036854775808) +NULL < string(20) "-9223372036854775808" +bool(true) >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) >= string(0) "" +bool(true) >= int(1) +bool(true) >= float(2.5) +bool(true) >= int(0) +bool(true) >= string(6) "string" +bool(true) >= string(3) "123" +bool(true) >= string(3) "2.5" +bool(true) >= NULL +bool(true) >= bool(true) +bool(true) >= bool(false) +bool(true) >= object(stdClass)#%d (0) {} +bool(true) >= object(stdClass)#%d (0) {} +bool(true) >= object(test)#%d (0) {} +bool(true) >= array(0) {} +bool(true) >= int(-9223372036854775808) +bool(true) >= string(20) "-9223372036854775808" +bool(false) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) >= string(0) "" +bool(false) < int(1) +bool(false) < float(2.5) +bool(false) >= int(0) +bool(false) < string(6) "string" +bool(false) < string(3) "123" +bool(false) < string(3) "2.5" +bool(false) >= NULL +bool(false) < bool(true) +bool(false) >= bool(false) +bool(false) < object(stdClass)#%d (0) {} +bool(false) < object(stdClass)#%d (0) {} +bool(false) < object(test)#%d (0) {} +bool(false) >= array(0) {} +bool(false) < int(-9223372036854775808) +bool(false) < string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} >= string(0) "" +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(1) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + < float(2.5) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(0) +object(stdClass)#%d (0) {} >= string(6) "string" +object(stdClass)#%d (0) {} >= string(3) "123" +object(stdClass)#%d (0) {} >= string(3) "2.5" +object(stdClass)#%d (0) {} >= NULL +object(stdClass)#%d (0) {} >= bool(true) +object(stdClass)#%d (0) {} >= bool(false) +object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} < object(test)#%d (0) {} +object(stdClass)#%d (0) {} >= array(0) {} +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(-9223372036854775808) +object(stdClass)#%d (0) {} >= string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} >= string(0) "" +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(1) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + < float(2.5) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(0) +object(stdClass)#%d (0) {} >= string(6) "string" +object(stdClass)#%d (0) {} >= string(3) "123" +object(stdClass)#%d (0) {} >= string(3) "2.5" +object(stdClass)#%d (0) {} >= NULL +object(stdClass)#%d (0) {} >= bool(true) +object(stdClass)#%d (0) {} >= bool(false) +object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} >= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} < object(test)#%d (0) {} +object(stdClass)#%d (0) {} >= array(0) {} +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + >= int(-9223372036854775808) +object(stdClass)#%d (0) {} >= string(20) "-9223372036854775808" +object(test)#%d (0) {} >= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#%d (0) {} >= string(0) "" +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(1) +object(test)#%d (0) {} +Notice: Object of class test could not be converted to double in %s on line %d + < float(2.5) +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(0) +object(test)#%d (0) {} >= string(6) "string" +object(test)#%d (0) {} >= string(3) "123" +object(test)#%d (0) {} >= string(3) "2.5" +object(test)#%d (0) {} >= NULL +object(test)#%d (0) {} >= bool(true) +object(test)#%d (0) {} >= bool(false) +object(test)#%d (0) {} < object(stdClass)#%d (0) {} +object(test)#%d (0) {} < object(stdClass)#%d (0) {} +object(test)#%d (0) {} >= object(test)#%d (0) {} +object(test)#%d (0) {} >= array(0) {} +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + >= int(-9223372036854775808) +object(test)#%d (0) {} >= string(20) "-9223372036854775808" +array(0) {} < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} >= string(0) "" +array(0) {} >= int(1) +array(0) {} >= float(2.5) +array(0) {} >= int(0) +array(0) {} >= string(6) "string" +array(0) {} >= string(3) "123" +array(0) {} >= string(3) "2.5" +array(0) {} >= NULL +array(0) {} < bool(true) +array(0) {} >= bool(false) +array(0) {} < object(stdClass)#%d (0) {} +array(0) {} < object(stdClass)#%d (0) {} +array(0) {} < object(test)#%d (0) {} +array(0) {} >= array(0) {} +array(0) {} >= int(-9223372036854775808) +array(0) {} >= string(20) "-9223372036854775808" +int(-9223372036854775808) < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-9223372036854775808) < string(0) "" +int(-9223372036854775808) < int(1) +int(-9223372036854775808) < float(2.5) +int(-9223372036854775808) < int(0) +int(-9223372036854775808) < string(6) "string" +int(-9223372036854775808) < string(3) "123" +int(-9223372036854775808) < string(3) "2.5" +int(-9223372036854775808) >= NULL +int(-9223372036854775808) >= bool(true) +int(-9223372036854775808) >= bool(false) +int(-9223372036854775808) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#%d (0) {} +int(-9223372036854775808) +Notice: Object of class stdClass could not be converted to int in %s on line %d + < object(stdClass)#%d (0) {} +int(-9223372036854775808) +Notice: Object of class test could not be converted to int in %s on line %d + < object(test)#%d (0) {} +int(-9223372036854775808) < array(0) {} +int(-9223372036854775808) >= int(-9223372036854775808) +int(-9223372036854775808) >= string(20) "-9223372036854775808" +string(20) "-9223372036854775808" < array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(20) "-9223372036854775808" >= string(0) "" +string(20) "-9223372036854775808" < int(1) +string(20) "-9223372036854775808" < float(2.5) +string(20) "-9223372036854775808" < int(0) +string(20) "-9223372036854775808" < string(6) "string" +string(20) "-9223372036854775808" < string(3) "123" +string(20) "-9223372036854775808" < string(3) "2.5" +string(20) "-9223372036854775808" >= NULL +string(20) "-9223372036854775808" >= bool(true) +string(20) "-9223372036854775808" >= bool(false) +string(20) "-9223372036854775808" < object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" < object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" < object(test)#%d (0) {} +string(20) "-9223372036854775808" < array(0) {} +string(20) "-9223372036854775808" >= int(-9223372036854775808) +string(20) "-9223372036854775808" >= string(20) "-9223372036854775808" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_006.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_006.phpt new file mode 100644 index 0000000000000..743983b97fa98 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_006.phpt @@ -0,0 +1,389 @@ +--TEST-- +comparing different variables (smaller or equal than) +--SKIPIF-- + +--FILE-- + "; + my_dump($a[$i]); + echo "\n"; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +array(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)} > string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(stdClass)#1 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(stdClass)#2 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(test)#3 (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(-2147483648) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(11) "-2147483648" +string(0) "" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" <= string(0) "" +string(0) "" <= int(1) +string(0) "" <= float(2.5) +string(0) "" <= int(0) +string(0) "" <= string(6) "string" +string(0) "" <= string(3) "123" +string(0) "" <= string(3) "2.5" +string(0) "" <= NULL +string(0) "" <= bool(true) +string(0) "" <= bool(false) +string(0) "" <= object(stdClass)#1 (0) {} +string(0) "" <= object(stdClass)#2 (0) {} +string(0) "" <= object(test)#3 (0) {} +string(0) "" <= array(0) {} +string(0) "" > int(-2147483648) +string(0) "" <= string(11) "-2147483648" +int(1) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) > string(0) "" +int(1) <= int(1) +int(1) <= float(2.5) +int(1) > int(0) +int(1) > string(6) "string" +int(1) <= string(3) "123" +int(1) <= string(3) "2.5" +int(1) > NULL +int(1) <= bool(true) +int(1) > bool(false) +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#1 (0) {} +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#2 (0) {} +int(1) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#3 (0) {} +int(1) <= array(0) {} +int(1) > int(-2147483648) +int(1) > string(11) "-2147483648" +float(2.5) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) > string(0) "" +float(2.5) > int(1) +float(2.5) <= float(2.5) +float(2.5) > int(0) +float(2.5) > string(6) "string" +float(2.5) <= string(3) "123" +float(2.5) <= string(3) "2.5" +float(2.5) > NULL +float(2.5) <= bool(true) +float(2.5) > bool(false) +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + > object(stdClass)#1 (0) {} +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + > object(stdClass)#2 (0) {} +float(2.5) +Notice: Object of class test could not be converted to double in %s on line %d + > object(test)#3 (0) {} +float(2.5) <= array(0) {} +float(2.5) > int(-2147483648) +float(2.5) > string(11) "-2147483648" +int(0) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) <= string(0) "" +int(0) <= int(1) +int(0) <= float(2.5) +int(0) <= int(0) +int(0) <= string(6) "string" +int(0) <= string(3) "123" +int(0) <= string(3) "2.5" +int(0) <= NULL +int(0) <= bool(true) +int(0) <= bool(false) +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#1 (0) {} +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#2 (0) {} +int(0) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#3 (0) {} +int(0) <= array(0) {} +int(0) > int(-2147483648) +int(0) > string(11) "-2147483648" +string(6) "string" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" > string(0) "" +string(6) "string" <= int(1) +string(6) "string" <= float(2.5) +string(6) "string" <= int(0) +string(6) "string" <= string(6) "string" +string(6) "string" > string(3) "123" +string(6) "string" > string(3) "2.5" +string(6) "string" > NULL +string(6) "string" <= bool(true) +string(6) "string" > bool(false) +string(6) "string" <= object(stdClass)#1 (0) {} +string(6) "string" <= object(stdClass)#2 (0) {} +string(6) "string" <= object(test)#3 (0) {} +string(6) "string" <= array(0) {} +string(6) "string" > int(-2147483648) +string(6) "string" > string(11) "-2147483648" +string(3) "123" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" > string(0) "" +string(3) "123" > int(1) +string(3) "123" > float(2.5) +string(3) "123" > int(0) +string(3) "123" <= string(6) "string" +string(3) "123" <= string(3) "123" +string(3) "123" > string(3) "2.5" +string(3) "123" > NULL +string(3) "123" <= bool(true) +string(3) "123" > bool(false) +string(3) "123" <= object(stdClass)#1 (0) {} +string(3) "123" <= object(stdClass)#2 (0) {} +string(3) "123" <= object(test)#3 (0) {} +string(3) "123" <= array(0) {} +string(3) "123" > int(-2147483648) +string(3) "123" > string(11) "-2147483648" +string(3) "2.5" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" > string(0) "" +string(3) "2.5" > int(1) +string(3) "2.5" <= float(2.5) +string(3) "2.5" > int(0) +string(3) "2.5" <= string(6) "string" +string(3) "2.5" <= string(3) "123" +string(3) "2.5" <= string(3) "2.5" +string(3) "2.5" > NULL +string(3) "2.5" <= bool(true) +string(3) "2.5" > bool(false) +string(3) "2.5" <= object(stdClass)#1 (0) {} +string(3) "2.5" <= object(stdClass)#2 (0) {} +string(3) "2.5" <= object(test)#3 (0) {} +string(3) "2.5" <= array(0) {} +string(3) "2.5" > int(-2147483648) +string(3) "2.5" > string(11) "-2147483648" +NULL <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL <= string(0) "" +NULL <= int(1) +NULL <= float(2.5) +NULL <= int(0) +NULL <= string(6) "string" +NULL <= string(3) "123" +NULL <= string(3) "2.5" +NULL <= NULL +NULL <= bool(true) +NULL <= bool(false) +NULL <= object(stdClass)#1 (0) {} +NULL <= object(stdClass)#2 (0) {} +NULL <= object(test)#3 (0) {} +NULL <= array(0) {} +NULL <= int(-2147483648) +NULL <= string(11) "-2147483648" +bool(true) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) > string(0) "" +bool(true) <= int(1) +bool(true) <= float(2.5) +bool(true) > int(0) +bool(true) <= string(6) "string" +bool(true) <= string(3) "123" +bool(true) <= string(3) "2.5" +bool(true) > NULL +bool(true) <= bool(true) +bool(true) > bool(false) +bool(true) <= object(stdClass)#1 (0) {} +bool(true) <= object(stdClass)#2 (0) {} +bool(true) <= object(test)#3 (0) {} +bool(true) > array(0) {} +bool(true) <= int(-2147483648) +bool(true) <= string(11) "-2147483648" +bool(false) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) <= string(0) "" +bool(false) <= int(1) +bool(false) <= float(2.5) +bool(false) <= int(0) +bool(false) <= string(6) "string" +bool(false) <= string(3) "123" +bool(false) <= string(3) "2.5" +bool(false) <= NULL +bool(false) <= bool(true) +bool(false) <= bool(false) +bool(false) <= object(stdClass)#1 (0) {} +bool(false) <= object(stdClass)#2 (0) {} +bool(false) <= object(test)#3 (0) {} +bool(false) <= array(0) {} +bool(false) <= int(-2147483648) +bool(false) <= string(11) "-2147483648" +object(stdClass)#1 (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#1 (0) {} > string(0) "" +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= int(1) +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + <= float(2.5) +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(0) +object(stdClass)#1 (0) {} > string(6) "string" +object(stdClass)#1 (0) {} > string(3) "123" +object(stdClass)#1 (0) {} > string(3) "2.5" +object(stdClass)#1 (0) {} > NULL +object(stdClass)#1 (0) {} <= bool(true) +object(stdClass)#1 (0) {} > bool(false) +object(stdClass)#1 (0) {} <= object(stdClass)#1 (0) {} +object(stdClass)#1 (0) {} <= object(stdClass)#2 (0) {} +object(stdClass)#1 (0) {} > object(test)#3 (0) {} +object(stdClass)#1 (0) {} > array(0) {} +object(stdClass)#1 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(-2147483648) +object(stdClass)#1 (0) {} > string(11) "-2147483648" +object(stdClass)#2 (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#2 (0) {} > string(0) "" +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= int(1) +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + <= float(2.5) +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(0) +object(stdClass)#2 (0) {} > string(6) "string" +object(stdClass)#2 (0) {} > string(3) "123" +object(stdClass)#2 (0) {} > string(3) "2.5" +object(stdClass)#2 (0) {} > NULL +object(stdClass)#2 (0) {} <= bool(true) +object(stdClass)#2 (0) {} > bool(false) +object(stdClass)#2 (0) {} <= object(stdClass)#1 (0) {} +object(stdClass)#2 (0) {} <= object(stdClass)#2 (0) {} +object(stdClass)#2 (0) {} > object(test)#3 (0) {} +object(stdClass)#2 (0) {} > array(0) {} +object(stdClass)#2 (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(-2147483648) +object(stdClass)#2 (0) {} > string(11) "-2147483648" +object(test)#3 (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#3 (0) {} > string(0) "" +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + <= int(1) +object(test)#3 (0) {} +Notice: Object of class test could not be converted to double in %s on line %d + <= float(2.5) +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + > int(0) +object(test)#3 (0) {} > string(6) "string" +object(test)#3 (0) {} > string(3) "123" +object(test)#3 (0) {} > string(3) "2.5" +object(test)#3 (0) {} > NULL +object(test)#3 (0) {} <= bool(true) +object(test)#3 (0) {} > bool(false) +object(test)#3 (0) {} > object(stdClass)#1 (0) {} +object(test)#3 (0) {} > object(stdClass)#2 (0) {} +object(test)#3 (0) {} <= object(test)#3 (0) {} +object(test)#3 (0) {} > array(0) {} +object(test)#3 (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + > int(-2147483648) +object(test)#3 (0) {} > string(11) "-2147483648" +array(0) {} <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} > string(0) "" +array(0) {} > int(1) +array(0) {} > float(2.5) +array(0) {} > int(0) +array(0) {} > string(6) "string" +array(0) {} > string(3) "123" +array(0) {} > string(3) "2.5" +array(0) {} <= NULL +array(0) {} <= bool(true) +array(0) {} <= bool(false) +array(0) {} <= object(stdClass)#1 (0) {} +array(0) {} <= object(stdClass)#2 (0) {} +array(0) {} <= object(test)#3 (0) {} +array(0) {} <= array(0) {} +array(0) {} > int(-2147483648) +array(0) {} > string(11) "-2147483648" +int(-2147483648) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-2147483648) <= string(0) "" +int(-2147483648) <= int(1) +int(-2147483648) <= float(2.5) +int(-2147483648) <= int(0) +int(-2147483648) <= string(6) "string" +int(-2147483648) <= string(3) "123" +int(-2147483648) <= string(3) "2.5" +int(-2147483648) > NULL +int(-2147483648) <= bool(true) +int(-2147483648) > bool(false) +int(-2147483648) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#1 (0) {} +int(-2147483648) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#2 (0) {} +int(-2147483648) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#3 (0) {} +int(-2147483648) <= array(0) {} +int(-2147483648) <= int(-2147483648) +int(-2147483648) <= string(11) "-2147483648" +string(11) "-2147483648" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(11) "-2147483648" > string(0) "" +string(11) "-2147483648" <= int(1) +string(11) "-2147483648" <= float(2.5) +string(11) "-2147483648" <= int(0) +string(11) "-2147483648" <= string(6) "string" +string(11) "-2147483648" <= string(3) "123" +string(11) "-2147483648" <= string(3) "2.5" +string(11) "-2147483648" > NULL +string(11) "-2147483648" <= bool(true) +string(11) "-2147483648" > bool(false) +string(11) "-2147483648" <= object(stdClass)#1 (0) {} +string(11) "-2147483648" <= object(stdClass)#2 (0) {} +string(11) "-2147483648" <= object(test)#3 (0) {} +string(11) "-2147483648" <= array(0) {} +string(11) "-2147483648" <= int(-2147483648) +string(11) "-2147483648" <= string(11) "-2147483648" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/compare_006_64bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/compare_006_64bit.phpt new file mode 100644 index 0000000000000..56aad8d4b711a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/compare_006_64bit.phpt @@ -0,0 +1,389 @@ +--TEST-- +comparing different variables (smaller or equal than) +--SKIPIF-- + +--FILE-- + "; + my_dump($a[$i]); + echo "\n"; + } +} + +echo "Done\n"; +?> +--EXPECTF-- +array(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)} > string(0) "" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(1) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > float(2.5) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(0) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(6) "string" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(3) "123" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(3) "2.5" +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > NULL +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= bool(true) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > bool(false) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(stdClass)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} <= object(test)#%d (0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > array(0) {} +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > int(-9223372036854775808) +array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} > string(20) "-9223372036854775808" +string(0) "" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(0) "" <= string(0) "" +string(0) "" <= int(1) +string(0) "" <= float(2.5) +string(0) "" <= int(0) +string(0) "" <= string(6) "string" +string(0) "" <= string(3) "123" +string(0) "" <= string(3) "2.5" +string(0) "" <= NULL +string(0) "" <= bool(true) +string(0) "" <= bool(false) +string(0) "" <= object(stdClass)#%d (0) {} +string(0) "" <= object(stdClass)#%d (0) {} +string(0) "" <= object(test)#%d (0) {} +string(0) "" <= array(0) {} +string(0) "" > int(-9223372036854775808) +string(0) "" <= string(20) "-9223372036854775808" +int(1) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(1) > string(0) "" +int(1) <= int(1) +int(1) <= float(2.5) +int(1) > int(0) +int(1) > string(6) "string" +int(1) <= string(3) "123" +int(1) <= string(3) "2.5" +int(1) > NULL +int(1) <= bool(true) +int(1) > bool(false) +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(1) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(1) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#%d (0) {} +int(1) <= array(0) {} +int(1) > int(-9223372036854775808) +int(1) > string(20) "-9223372036854775808" +float(2.5) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +float(2.5) > string(0) "" +float(2.5) > int(1) +float(2.5) <= float(2.5) +float(2.5) > int(0) +float(2.5) > string(6) "string" +float(2.5) <= string(3) "123" +float(2.5) <= string(3) "2.5" +float(2.5) > NULL +float(2.5) <= bool(true) +float(2.5) > bool(false) +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + > object(stdClass)#%d (0) {} +float(2.5) +Notice: Object of class stdClass could not be converted to double in %s on line %d + > object(stdClass)#%d (0) {} +float(2.5) +Notice: Object of class test could not be converted to double in %s on line %d + > object(test)#%d (0) {} +float(2.5) <= array(0) {} +float(2.5) > int(-9223372036854775808) +float(2.5) > string(20) "-9223372036854775808" +int(0) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(0) <= string(0) "" +int(0) <= int(1) +int(0) <= float(2.5) +int(0) <= int(0) +int(0) <= string(6) "string" +int(0) <= string(3) "123" +int(0) <= string(3) "2.5" +int(0) <= NULL +int(0) <= bool(true) +int(0) <= bool(false) +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(0) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(0) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#%d (0) {} +int(0) <= array(0) {} +int(0) > int(-9223372036854775808) +int(0) > string(20) "-9223372036854775808" +string(6) "string" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(6) "string" > string(0) "" +string(6) "string" <= int(1) +string(6) "string" <= float(2.5) +string(6) "string" <= int(0) +string(6) "string" <= string(6) "string" +string(6) "string" > string(3) "123" +string(6) "string" > string(3) "2.5" +string(6) "string" > NULL +string(6) "string" <= bool(true) +string(6) "string" > bool(false) +string(6) "string" <= object(stdClass)#%d (0) {} +string(6) "string" <= object(stdClass)#%d (0) {} +string(6) "string" <= object(test)#%d (0) {} +string(6) "string" <= array(0) {} +string(6) "string" > int(-9223372036854775808) +string(6) "string" > string(20) "-9223372036854775808" +string(3) "123" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "123" > string(0) "" +string(3) "123" > int(1) +string(3) "123" > float(2.5) +string(3) "123" > int(0) +string(3) "123" <= string(6) "string" +string(3) "123" <= string(3) "123" +string(3) "123" > string(3) "2.5" +string(3) "123" > NULL +string(3) "123" <= bool(true) +string(3) "123" > bool(false) +string(3) "123" <= object(stdClass)#%d (0) {} +string(3) "123" <= object(stdClass)#%d (0) {} +string(3) "123" <= object(test)#%d (0) {} +string(3) "123" <= array(0) {} +string(3) "123" > int(-9223372036854775808) +string(3) "123" > string(20) "-9223372036854775808" +string(3) "2.5" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(3) "2.5" > string(0) "" +string(3) "2.5" > int(1) +string(3) "2.5" <= float(2.5) +string(3) "2.5" > int(0) +string(3) "2.5" <= string(6) "string" +string(3) "2.5" <= string(3) "123" +string(3) "2.5" <= string(3) "2.5" +string(3) "2.5" > NULL +string(3) "2.5" <= bool(true) +string(3) "2.5" > bool(false) +string(3) "2.5" <= object(stdClass)#%d (0) {} +string(3) "2.5" <= object(stdClass)#%d (0) {} +string(3) "2.5" <= object(test)#%d (0) {} +string(3) "2.5" <= array(0) {} +string(3) "2.5" > int(-9223372036854775808) +string(3) "2.5" > string(20) "-9223372036854775808" +NULL <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +NULL <= string(0) "" +NULL <= int(1) +NULL <= float(2.5) +NULL <= int(0) +NULL <= string(6) "string" +NULL <= string(3) "123" +NULL <= string(3) "2.5" +NULL <= NULL +NULL <= bool(true) +NULL <= bool(false) +NULL <= object(stdClass)#%d (0) {} +NULL <= object(stdClass)#%d (0) {} +NULL <= object(test)#%d (0) {} +NULL <= array(0) {} +NULL <= int(-9223372036854775808) +NULL <= string(20) "-9223372036854775808" +bool(true) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(true) > string(0) "" +bool(true) <= int(1) +bool(true) <= float(2.5) +bool(true) > int(0) +bool(true) <= string(6) "string" +bool(true) <= string(3) "123" +bool(true) <= string(3) "2.5" +bool(true) > NULL +bool(true) <= bool(true) +bool(true) > bool(false) +bool(true) <= object(stdClass)#%d (0) {} +bool(true) <= object(stdClass)#%d (0) {} +bool(true) <= object(test)#%d (0) {} +bool(true) > array(0) {} +bool(true) <= int(-9223372036854775808) +bool(true) <= string(20) "-9223372036854775808" +bool(false) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +bool(false) <= string(0) "" +bool(false) <= int(1) +bool(false) <= float(2.5) +bool(false) <= int(0) +bool(false) <= string(6) "string" +bool(false) <= string(3) "123" +bool(false) <= string(3) "2.5" +bool(false) <= NULL +bool(false) <= bool(true) +bool(false) <= bool(false) +bool(false) <= object(stdClass)#%d (0) {} +bool(false) <= object(stdClass)#%d (0) {} +bool(false) <= object(test)#%d (0) {} +bool(false) <= array(0) {} +bool(false) <= int(-9223372036854775808) +bool(false) <= string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} > string(0) "" +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= int(1) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + <= float(2.5) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(0) +object(stdClass)#%d (0) {} > string(6) "string" +object(stdClass)#%d (0) {} > string(3) "123" +object(stdClass)#%d (0) {} > string(3) "2.5" +object(stdClass)#%d (0) {} > NULL +object(stdClass)#%d (0) {} <= bool(true) +object(stdClass)#%d (0) {} > bool(false) +object(stdClass)#%d (0) {} <= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} <= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} > object(test)#%d (0) {} +object(stdClass)#%d (0) {} > array(0) {} +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(-9223372036854775808) +object(stdClass)#%d (0) {} > string(20) "-9223372036854775808" +object(stdClass)#%d (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(stdClass)#%d (0) {} > string(0) "" +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= int(1) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to double in %s on line %d + <= float(2.5) +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(0) +object(stdClass)#%d (0) {} > string(6) "string" +object(stdClass)#%d (0) {} > string(3) "123" +object(stdClass)#%d (0) {} > string(3) "2.5" +object(stdClass)#%d (0) {} > NULL +object(stdClass)#%d (0) {} <= bool(true) +object(stdClass)#%d (0) {} > bool(false) +object(stdClass)#%d (0) {} <= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} <= object(stdClass)#%d (0) {} +object(stdClass)#%d (0) {} > object(test)#%d (0) {} +object(stdClass)#%d (0) {} > array(0) {} +object(stdClass)#%d (0) {} +Notice: Object of class stdClass could not be converted to int in %s on line %d + > int(-9223372036854775808) +object(stdClass)#%d (0) {} > string(20) "-9223372036854775808" +object(test)#%d (0) {} > array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +object(test)#%d (0) {} > string(0) "" +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + <= int(1) +object(test)#%d (0) {} +Notice: Object of class test could not be converted to double in %s on line %d + <= float(2.5) +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + > int(0) +object(test)#%d (0) {} > string(6) "string" +object(test)#%d (0) {} > string(3) "123" +object(test)#%d (0) {} > string(3) "2.5" +object(test)#%d (0) {} > NULL +object(test)#%d (0) {} <= bool(true) +object(test)#%d (0) {} > bool(false) +object(test)#%d (0) {} > object(stdClass)#%d (0) {} +object(test)#%d (0) {} > object(stdClass)#%d (0) {} +object(test)#%d (0) {} <= object(test)#%d (0) {} +object(test)#%d (0) {} > array(0) {} +object(test)#%d (0) {} +Notice: Object of class test could not be converted to int in %s on line %d + > int(-9223372036854775808) +object(test)#%d (0) {} > string(20) "-9223372036854775808" +array(0) {} <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +array(0) {} > string(0) "" +array(0) {} > int(1) +array(0) {} > float(2.5) +array(0) {} > int(0) +array(0) {} > string(6) "string" +array(0) {} > string(3) "123" +array(0) {} > string(3) "2.5" +array(0) {} <= NULL +array(0) {} <= bool(true) +array(0) {} <= bool(false) +array(0) {} <= object(stdClass)#%d (0) {} +array(0) {} <= object(stdClass)#%d (0) {} +array(0) {} <= object(test)#%d (0) {} +array(0) {} <= array(0) {} +array(0) {} > int(-9223372036854775808) +array(0) {} > string(20) "-9223372036854775808" +int(-9223372036854775808) <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +int(-9223372036854775808) <= string(0) "" +int(-9223372036854775808) <= int(1) +int(-9223372036854775808) <= float(2.5) +int(-9223372036854775808) <= int(0) +int(-9223372036854775808) <= string(6) "string" +int(-9223372036854775808) <= string(3) "123" +int(-9223372036854775808) <= string(3) "2.5" +int(-9223372036854775808) > NULL +int(-9223372036854775808) <= bool(true) +int(-9223372036854775808) > bool(false) +int(-9223372036854775808) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(-9223372036854775808) +Notice: Object of class stdClass could not be converted to int in %s on line %d + <= object(stdClass)#%d (0) {} +int(-9223372036854775808) +Notice: Object of class test could not be converted to int in %s on line %d + <= object(test)#%d (0) {} +int(-9223372036854775808) <= array(0) {} +int(-9223372036854775808) <= int(-9223372036854775808) +int(-9223372036854775808) <= string(20) "-9223372036854775808" +string(20) "-9223372036854775808" <= array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3)} +string(20) "-9223372036854775808" > string(0) "" +string(20) "-9223372036854775808" <= int(1) +string(20) "-9223372036854775808" <= float(2.5) +string(20) "-9223372036854775808" <= int(0) +string(20) "-9223372036854775808" <= string(6) "string" +string(20) "-9223372036854775808" <= string(3) "123" +string(20) "-9223372036854775808" <= string(3) "2.5" +string(20) "-9223372036854775808" > NULL +string(20) "-9223372036854775808" <= bool(true) +string(20) "-9223372036854775808" > bool(false) +string(20) "-9223372036854775808" <= object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" <= object(stdClass)#%d (0) {} +string(20) "-9223372036854775808" <= object(test)#%d (0) {} +string(20) "-9223372036854775808" <= array(0) {} +string(20) "-9223372036854775808" <= int(-9223372036854775808) +string(20) "-9223372036854775808" <= string(20) "-9223372036854775808" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/concat_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/concat_001.phpt new file mode 100644 index 0000000000000..be1297655d967 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/concat_001.phpt @@ -0,0 +1,78 @@ +--TEST-- +concat difffent types +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +string(24) "Arraythis is test object" +string(16) "Arraysome string" +string(8) "Array222" +string(13) "Array2323.444" +string(10) "ArrayArray" +string(24) "this is test objectArray" +string(30) "this is test objectsome string" +string(22) "this is test object222" +string(27) "this is test object2323.444" +string(38) "this is test objectthis is test object" +string(30) "some stringthis is test object" +string(16) "some stringArray" +string(14) "some string222" +string(19) "some string2323.444" +string(22) "some stringsome string" +string(8) "222Array" +string(22) "222this is test object" +string(14) "222some string" +string(11) "2222323.444" +string(6) "222222" +string(13) "2323.444Array" +string(27) "2323.444this is test object" +string(19) "2323.444some string" +string(11) "2323.444222" +string(16) "2323.4442323.444" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/decrement_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/decrement_001.phpt new file mode 100644 index 0000000000000..6ade8ad1639d2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/decrement_001.phpt @@ -0,0 +1,60 @@ +--TEST-- +decrementing different variables +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +int(-1) +int(0) +float(1.5) +int(-1) +string(6) "string" +int(122) +float(1.5) +NULL +bool(true) +bool(false) +object(stdClass)#%d (0) { +} +array(0) { +} +float(-2147483649) +float(-2147483649) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/decrement_001_64bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/decrement_001_64bit.phpt new file mode 100644 index 0000000000000..7ad24b76f7369 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/decrement_001_64bit.phpt @@ -0,0 +1,60 @@ +--TEST-- +decrementing different variables +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +int(-1) +int(0) +float(1.5) +int(-1) +string(6) "string" +int(122) +float(1.5) +NULL +bool(true) +bool(false) +object(stdClass)#%d (0) { +} +array(0) { +} +float(-9.2233720368548E+18) +float(-9.2233720368548E+18) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/div_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/div_001.phpt new file mode 100644 index 0000000000000..5fa264a11e5e1 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/div_001.phpt @@ -0,0 +1,32 @@ +--TEST-- +dividing doubles +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +float(394758.39454545) +float(394758.39454545) +float(394758.39454545) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/div_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/div_002.phpt new file mode 100644 index 0000000000000..6ade1d9f51b98 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/div_002.phpt @@ -0,0 +1,15 @@ +--TEST-- +dividing arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/double_to_string.phpt b/phpt/tests/php-5.2.5/Zend/tests/double_to_string.phpt new file mode 100644 index 0000000000000..2948b0b54ccf2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/double_to_string.phpt @@ -0,0 +1,52 @@ +--TEST-- +double to string conversion tests +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(7) "2.9E+17" +string(7) "2.9E+14" +string(%d) "2%s" +string(%d) "2%s" +string(%d) "29%d" +string(13) "29000.7123123" +string(15) "239234242.71231" +string(16) "0.12345678901235" +string(14) "10000000000000" +string(7) "1.0E+14" +string(7) "1.0E+18" +string(7) "1.0E+14" +string(11) "10000000000" +string(7) "1.0E+15" +string(7) "1.0E+16" +string(1) "0" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/double_to_string_64bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/double_to_string_64bit.phpt new file mode 100644 index 0000000000000..5ecb1a6067294 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/double_to_string_64bit.phpt @@ -0,0 +1,58 @@ +--TEST-- +double to string conversion tests (64bit) +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +string(7) "2.9E+37" +string(18) "290000000000000000" +string(15) "290000000000000" +string(14) "29000000000000" +string(14) "29000000000000" +string(14) "29000000000001" +string(13) "29000.7123123" +string(15) "239234242.71231" +string(16) "0.12345678901235" +string(7) "1.0E+46" +string(7) "1.0E+33" +string(18) "100000000000000001" +string(19) "1000006000000000011" +string(15) "100000000000001" +string(11) "10000000000" +string(18) "999999999999999999" +string(7) "1.0E+19" +string(7) "1.0E+37" +string(1) "0" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/dtor_scope.phpt b/phpt/tests/php-5.2.5/Zend/tests/dtor_scope.phpt new file mode 100755 index 0000000000000..80f42cacb59ba --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/dtor_scope.phpt @@ -0,0 +1,32 @@ +--TEST-- +Scoping in destructor call +--FILE-- +var, $a); + } + + public function __destruct() + { + print_r($this->var); + } + } + + class TT extends T + { + } + $t = new TT(); + $t->add("Hello"); + $t->add("World"); +?> +--EXPECT-- +Array +( + [0] => Hello + [1] => World +) diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_001.phpt new file mode 100644 index 0000000000000..b85e032b90973 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_001.phpt @@ -0,0 +1,16 @@ +--TEST-- +errmsg: Non-abstract method must contain body +--FILE-- + +--EXPECTF-- +Fatal error: Non-abstract method Impl::Foo() must contain body in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_002.phpt new file mode 100644 index 0000000000000..b7330c9f1f407 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_002.phpt @@ -0,0 +1,14 @@ +--TEST-- +errmsg: function cannot be declared private +--FILE-- + +--EXPECTF-- +Fatal error: Abstract function test::foo() cannot be declared private in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_003.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_003.phpt new file mode 100644 index 0000000000000..64e458781d337 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_003.phpt @@ -0,0 +1,19 @@ +--TEST-- +errmsg: cannot reassign $this (by ref) +--FILE-- +foo(); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Cannot re-assign $this in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_004.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_004.phpt new file mode 100644 index 0000000000000..e6d22d6aba1d2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_004.phpt @@ -0,0 +1,15 @@ +--TEST-- +errmsg: can't use function return value in write context +--FILE-- + +--EXPECTF-- +Fatal error: Can't use function return value in write context in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_005.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_005.phpt new file mode 100644 index 0000000000000..31c924cbb35c4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_005.phpt @@ -0,0 +1,18 @@ +--TEST-- +errmsg: can't use method return value in write context +--FILE-- +foo() = 1; + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Can't use method return value in write context in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_006.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_006.phpt new file mode 100644 index 0000000000000..976093d854b7d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_006.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: can't use [] for reading +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use [] for reading in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_007.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_007.phpt new file mode 100644 index 0000000000000..1ac296695ddf7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_007.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: can't use [] for reading - 2 +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use [] for reading in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_008.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_008.phpt new file mode 100644 index 0000000000000..e900603a8993c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_008.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: can't use [] for unsetting +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use [] for unsetting in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_009.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_009.phpt new file mode 100644 index 0000000000000..4834fa3e7a71c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_009.phpt @@ -0,0 +1,13 @@ +--TEST-- +errmsg: multiple access type modifiers are not allowed (properties) +--FILE-- + +--EXPECTF-- +Fatal error: Multiple access type modifiers are not allowed in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_010.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_010.phpt new file mode 100644 index 0000000000000..ae2572f7bc0b9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_010.phpt @@ -0,0 +1,13 @@ +--TEST-- +errmsg: multiple access type modifiers are not allowed (methods) +--FILE-- + +--EXPECTF-- +Fatal error: Multiple access type modifiers are not allowed in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_011.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_011.phpt new file mode 100644 index 0000000000000..9cfde0f8bbd1a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_011.phpt @@ -0,0 +1,16 @@ +--TEST-- +errmsg: cannot redeclare (method) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot redeclare test::foo() in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_012.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_012.phpt new file mode 100644 index 0000000000000..183785be043fa --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_012.phpt @@ -0,0 +1,11 @@ +--TEST-- +errmsg: __autoload() must take exactly 1 argument +--FILE-- + +--EXPECTF-- +Fatal error: __autoload() must take exactly 1 argument in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_013.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_013.phpt new file mode 100644 index 0000000000000..d1f248ec28121 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_013.phpt @@ -0,0 +1,14 @@ +--TEST-- +errmsg: default value for parameters with array type hint can only be an array or NULL +--FILE-- + +--EXPECTF-- +Fatal error: Default value for parameters with array type hint can only be an array or NULL in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_014.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_014.phpt new file mode 100644 index 0000000000000..77e12b05e9c2f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_014.phpt @@ -0,0 +1,17 @@ +--TEST-- +errmsg: cannot call __clone() method on objects +--FILE-- +__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/phpt/tests/php-5.2.5/Zend/tests/errmsg_015.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_015.phpt new file mode 100644 index 0000000000000..8e626e5092138 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_015.phpt @@ -0,0 +1,14 @@ +--TEST-- +errmsg: __clone() cannot accept any arguments +--FILE-- + +--EXPECTF-- +Fatal error: Method test::__clone() cannot accept any arguments in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_016.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_016.phpt new file mode 100644 index 0000000000000..ccda07b9a36e3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_016.phpt @@ -0,0 +1,14 @@ +--TEST-- +errmsg: __isset() must take exactly 1 argument +--FILE-- + +--EXPECTF-- +Fatal error: Method test::__isset() must take exactly 1 argument in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_017.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_017.phpt new file mode 100644 index 0000000000000..df2b665687e70 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_017.phpt @@ -0,0 +1,14 @@ +--TEST-- +errmsg: __unset() must take exactly 1 argument +--FILE-- + +--EXPECTF-- +Fatal error: Method test::__unset() must take exactly 1 argument in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_018.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_018.phpt new file mode 100644 index 0000000000000..fb05cb1a53854 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_018.phpt @@ -0,0 +1,15 @@ +--TEST-- +errmsg: static abstract function +--FILE-- + +--EXPECTF-- +Strict Standards: Static function test::foo() should not be abstract in %s on line %d + +Fatal error: Class test contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (test::foo) in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_019.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_019.phpt new file mode 100644 index 0000000000000..2b45650cf2745 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_019.phpt @@ -0,0 +1,14 @@ +--TEST-- +errmsg: __destruct() cannot take arguments +--FILE-- + +--EXPECTF-- +Fatal error: Destructor test::__destruct() cannot take arguments in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_020.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_020.phpt new file mode 100644 index 0000000000000..8199d5d06e418 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_020.phpt @@ -0,0 +1,14 @@ +--TEST-- +errmsg: disabled function +--INI-- +disable_functions=phpinfo +--FILE-- + +--EXPECTF-- +Warning: phpinfo() has been disabled for security reasons in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_021.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_021.phpt new file mode 100644 index 0000000000000..4e62f85111fb4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_021.phpt @@ -0,0 +1,17 @@ +--TEST-- +errmsg: disabled class +--INI-- +disable_classes=stdclass +--FILE-- + +--EXPECTF-- +Warning: test() has been disabled for security reasons in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_022.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_022.phpt new file mode 100644 index 0000000000000..ea7b082f9ef79 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_022.phpt @@ -0,0 +1,14 @@ +--TEST-- +errmsg: only variables can be passed by reference +--FILE-- + +--EXPECTF-- +Fatal error: Only variables can be passed by reference in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_023.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_023.phpt new file mode 100644 index 0000000000000..9fd7804ea461d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_023.phpt @@ -0,0 +1,17 @@ +--TEST-- +errmsg: access level must be the same or weaker +--FILE-- + +--EXPECTF-- +Fatal error: Access level to test::$var must be protected (as in class test1) or weaker in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_024.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_024.phpt new file mode 100644 index 0000000000000..d8d06cbce17a9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_024.phpt @@ -0,0 +1,17 @@ +--TEST-- +errmsg: cannot change initial value of property +--FILE-- + +--EXPECTF-- +Fatal error: Cannot change initial value of property static protected test1::$var in class test in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_025.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_025.phpt new file mode 100644 index 0000000000000..d853f734285f6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_025.phpt @@ -0,0 +1,20 @@ +--TEST-- +errmsg: cannot inherit previously inherited constant +--FILE-- + +--EXPECTF-- +Fatal error: Cannot inherit previously-inherited constant FOO from interface test2 in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_026.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_026.phpt new file mode 100644 index 0000000000000..1954122900c4f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_026.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: cannot redeclare class +--FILE-- + +--EXPECTF-- +Fatal error: Cannot redeclare class stdclass in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_027.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_027.phpt new file mode 100644 index 0000000000000..f4fec6155c0d0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_027.phpt @@ -0,0 +1,16 @@ +--TEST-- +errmsg: class declarations may not be nested +--FILE-- + +--EXPECTF-- +Fatal error: Class declarations may not be nested in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_028.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_028.phpt new file mode 100644 index 0000000000000..3331cb35bf5c3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_028.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: cannot use 'self' as class name +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use 'self' as class name as it is reserved in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_029.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_029.phpt new file mode 100644 index 0000000000000..73b85ce6a510a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_029.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: cannot use 'parent' as class name +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use 'parent' as class name as it is reserved in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_030.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_030.phpt new file mode 100644 index 0000000000000..ab6ccbd41eba0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_030.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: cannot use 'self' as parent class name +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use 'self' as class name as it is reserved in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_031.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_031.phpt new file mode 100644 index 0000000000000..6e356485492fe --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_031.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: cannot use 'parent' as parent class name +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use 'parent' as class name as it is reserved in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_032.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_032.phpt new file mode 100644 index 0000000000000..6e34604cd80c7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_032.phpt @@ -0,0 +1,15 @@ +--TEST-- +errmsg: __construct() cannot be static +--FILE-- + +--EXPECTF-- +Fatal error: Constructor test::__construct() cannot be static in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_033.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_033.phpt new file mode 100644 index 0000000000000..96938900eca39 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_033.phpt @@ -0,0 +1,15 @@ +--TEST-- +errmsg: __destruct() cannot be static +--FILE-- + +--EXPECTF-- +Fatal error: Destructor test::__destruct() cannot be static in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_034.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_034.phpt new file mode 100644 index 0000000000000..1494fe53213ed --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_034.phpt @@ -0,0 +1,15 @@ +--TEST-- +errmsg: __clone() cannot be static +--FILE-- + +--EXPECTF-- +Fatal error: Clone method test::__clone() cannot be static in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_035.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_035.phpt new file mode 100644 index 0000000000000..76cbe3d48b0bf --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_035.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: cannot use 'self' as interface name +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use 'self' as interface name as it is reserved in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_036.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_036.phpt new file mode 100644 index 0000000000000..d1f4274bd110a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_036.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: cannot use 'parent' as interface name +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use 'parent' as interface name as it is reserved in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_037.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_037.phpt new file mode 100644 index 0000000000000..6b98bb33395f2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_037.phpt @@ -0,0 +1,13 @@ +--TEST-- +errmsg: properties cannot be abstract +--FILE-- + +--EXPECTF-- +Fatal error: Properties cannot be declared abstract in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_038.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_038.phpt new file mode 100644 index 0000000000000..fdab803ba85e0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_038.phpt @@ -0,0 +1,13 @@ +--TEST-- +errmsg: properties cannot be final +--FILE-- + +--EXPECTF-- +Fatal error: Cannot declare property test::$var final, the final modifier is allowed only for methods in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_039.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_039.phpt new file mode 100644 index 0000000000000..0000811879b22 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_039.phpt @@ -0,0 +1,14 @@ +--TEST-- +errmsg: cannot redeclare property +--FILE-- + +--EXPECTF-- +Fatal error: Cannot redeclare test::$var in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_040.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_040.phpt new file mode 100644 index 0000000000000..f3d0afcf0a32e --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_040.phpt @@ -0,0 +1,13 @@ +--TEST-- +errmsg: arrays are not allowed in class constants +--FILE-- + +--EXPECTF-- +Fatal error: Arrays are not allowed in class constants in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_041.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_041.phpt new file mode 100644 index 0000000000000..bfcafd261dff7 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_041.phpt @@ -0,0 +1,11 @@ +--TEST-- +errmsg: instanceof expects an object instance, constant given +--FILE-- + +--EXPECTF-- +Fatal error: instanceof expects an object instance, constant given in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_042.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_042.phpt new file mode 100644 index 0000000000000..3b4ea7c26789f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_042.phpt @@ -0,0 +1,13 @@ +--TEST-- +errmsg: key element cannot be a reference +--FILE-- +$v) { +} + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Key element cannot be a reference in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/errmsg_043.phpt b/phpt/tests/php-5.2.5/Zend/tests/errmsg_043.phpt new file mode 100644 index 0000000000000..3de8bc2062e9c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/errmsg_043.phpt @@ -0,0 +1,12 @@ +--TEST-- +errmsg: cannot create references to temp array +--FILE-- +&$v) { +} + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Cannot create references to elements of a temporary array expression in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/error_reporting01.phpt b/phpt/tests/php-5.2.5/Zend/tests/error_reporting01.phpt new file mode 100644 index 0000000000000..60be0239092c0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/error_reporting01.phpt @@ -0,0 +1,26 @@ +--TEST-- +testing @ and error_reporting - 1 +--FILE-- + +--EXPECT-- +int(6143) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/error_reporting02.phpt b/phpt/tests/php-5.2.5/Zend/tests/error_reporting02.phpt new file mode 100644 index 0000000000000..227d8c6f26068 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/error_reporting02.phpt @@ -0,0 +1,27 @@ +--TEST-- +testing @ and error_reporting - 2 +--FILE-- + +--EXPECT-- +int(8191) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/error_reporting03.phpt b/phpt/tests/php-5.2.5/Zend/tests/error_reporting03.phpt new file mode 100644 index 0000000000000..ec916048df529 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/error_reporting03.phpt @@ -0,0 +1,35 @@ +--TEST-- +testing @ and error_reporting - 3 +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: undef2 in %s on line %d +int(8191) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/error_reporting04.phpt b/phpt/tests/php-5.2.5/Zend/tests/error_reporting04.phpt new file mode 100644 index 0000000000000..1d7d678b2307c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/error_reporting04.phpt @@ -0,0 +1,23 @@ +--TEST-- +testing @ and error_reporting - 4 +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: undef in %s on line %d +int(8191) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/error_reporting05.phpt b/phpt/tests/php-5.2.5/Zend/tests/error_reporting05.phpt new file mode 100644 index 0000000000000..71fee17f4c817 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/error_reporting05.phpt @@ -0,0 +1,34 @@ +--TEST-- +testing @ and error_reporting - 5 +--FILE-- +abc = 123; +echo $test->bcd; + +@$test->qwe = 123; +echo @$test->wer; + +var_dump(error_reporting()); + +echo "Done\n"; +?> +--EXPECTF-- +Notice: Undefined variable: undef_value in %s on line %d + +Notice: Undefined variable: undef_name in %s on line %d +int(6143) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/error_reporting06.phpt b/phpt/tests/php-5.2.5/Zend/tests/error_reporting06.phpt new file mode 100644 index 0000000000000..f472d340513d2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/error_reporting06.phpt @@ -0,0 +1,30 @@ +--TEST-- +testing @ and error_reporting - 6 +--FILE-- + +--EXPECTF-- +int(6143) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/error_reporting07.phpt b/phpt/tests/php-5.2.5/Zend/tests/error_reporting07.phpt new file mode 100644 index 0000000000000..696a3757ede6a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/error_reporting07.phpt @@ -0,0 +1,30 @@ +--TEST-- +testing @ and error_reporting - 7 +--FILE-- + +--EXPECTF-- +int(6143) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/error_reporting08.phpt b/phpt/tests/php-5.2.5/Zend/tests/error_reporting08.phpt new file mode 100644 index 0000000000000..362aa37650d13 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/error_reporting08.phpt @@ -0,0 +1,32 @@ +--TEST-- +testing @ and error_reporting - 8 +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: undef3 in %s on line %d +int(8191) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/error_reporting09.phpt b/phpt/tests/php-5.2.5/Zend/tests/error_reporting09.phpt new file mode 100644 index 0000000000000..193758148c00f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/error_reporting09.phpt @@ -0,0 +1,31 @@ +--TEST-- +testing @ and error_reporting - 9 +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: blah in %s on line %d + +Notice: Undefined variable: undef2 in %s on line %d +int(8191) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/error_reporting10.phpt b/phpt/tests/php-5.2.5/Zend/tests/error_reporting10.phpt new file mode 100644 index 0000000000000..1d0abb10f3f06 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/error_reporting10.phpt @@ -0,0 +1,35 @@ +--TEST-- +testing @ and error_reporting - 10 +--FILE-- + +--EXPECTF-- +int(6143) +int(6135) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/exception_handler_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_001.phpt new file mode 100644 index 0000000000000..8f6572ef0179b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_001.phpt @@ -0,0 +1,20 @@ +--TEST-- +exception handler tests - 1 +--FILE-- + +--EXPECTF-- +string(12) "test thrown!" diff --git a/phpt/tests/php-5.2.5/Zend/tests/exception_handler_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_002.phpt new file mode 100644 index 0000000000000..3e0e4f00dd908 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_002.phpt @@ -0,0 +1,23 @@ +--TEST-- +exception handler tests - 2 +--FILE-- + +--EXPECTF-- +string(12) "test thrown!" + +Fatal error: Exception thrown without a stack frame in Unknown on line 0 diff --git a/phpt/tests/php-5.2.5/Zend/tests/exception_handler_003.phpt b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_003.phpt new file mode 100644 index 0000000000000..137a6cabb4c76 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_003.phpt @@ -0,0 +1,24 @@ +--TEST-- +exception handler tests - 3 +--FILE-- +foo(); +throw new Exception(); + +echo "Done\n"; +?> +--EXPECTF-- +string(17) "Exception thrown!" diff --git a/phpt/tests/php-5.2.5/Zend/tests/exception_handler_004.phpt b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_004.phpt new file mode 100644 index 0000000000000..2f367817e3bbb --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_004.phpt @@ -0,0 +1,21 @@ +--TEST-- +exception handler tests - 4 +--FILE-- + +--EXPECTF-- +Warning: set_exception_handler() expects the argument (fo) to be a valid callback in %s on line %d + +Warning: set_exception_handler() expects the argument (::) to be a valid callback in %s on line %d + +Warning: Wrong parameter count for set_exception_handler() in %s on line %d + +Warning: Wrong parameter count for set_exception_handler() in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/exception_handler_005.phpt b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_005.phpt new file mode 100644 index 0000000000000..cc99bc6230eb5 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_005.phpt @@ -0,0 +1,23 @@ +--TEST-- +exception handler tests - 5 +--FILE-- + +--EXPECTF-- +string(25) "foo1(): Exception thrown!" diff --git a/phpt/tests/php-5.2.5/Zend/tests/exception_handler_006.phpt b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_006.phpt new file mode 100644 index 0000000000000..05a5d927fa477 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/exception_handler_006.phpt @@ -0,0 +1,25 @@ +--TEST-- +exception handler tests - 6 +--FILE-- + +--EXPECTF-- +string(24) "foo(): Exception thrown!" diff --git a/phpt/tests/php-5.2.5/Zend/tests/foreach.phpt b/phpt/tests/php-5.2.5/Zend/tests/foreach.phpt new file mode 100644 index 0000000000000..041a7636ed9a6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/foreach.phpt @@ -0,0 +1,25 @@ +--TEST-- +foreach() by-ref bug +--FILE-- + &$val) { + if($val == 3) { + $foo[$key] = 0; + } else { + $val++; + } +} +var_dump($foo); +?> +--EXPECT-- +array(4) { + [0]=> + int(2) + [1]=> + int(3) + [2]=> + int(0) + [3]=> + &int(5) +} diff --git a/phpt/tests/php-5.2.5/Zend/tests/foreach_undefined.phpt b/phpt/tests/php-5.2.5/Zend/tests/foreach_undefined.phpt new file mode 100644 index 0000000000000..101d9839e98ed --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/foreach_undefined.phpt @@ -0,0 +1,14 @@ +--TEST-- +foreach() & undefined var +--FILE-- + +--EXPECTF-- +Notice: Undefined variable: a in %s on line %d + +Warning: Invalid argument supplied for foreach() in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/get_defined_vars.phpt b/phpt/tests/php-5.2.5/Zend/tests/get_defined_vars.phpt new file mode 100644 index 0000000000000..81aa97a455d67 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/get_defined_vars.phpt @@ -0,0 +1,128 @@ +--TEST-- +Testing get_defined_vars() Function +--FILE-- +97, 'c'=>99, 'A'=>65, 'C'=>67, 1=>"string1" ); //associative array +$boolean = TRUE; //boolean + +/* Checking for Class and Objects */ +class sample { +var $number = 233; +var $string = "string2"; +public function func() { +$local_var = 2; +var_dump( get_defined_vars() ); +} +} +$sample_obj = new sample; //object declaration + +function func() { +$string33 = 22; +var_dump( get_defined_vars() ); +} + +$arr = get_defined_vars(); + +/* Displaying various variable through the array captured by the get_defined_vars function call */ +echo "\n*** Displaying various variables through the array captured by the get_defined_vars function call ***\n"; +var_dump( $arr["argc"] ); +var_dump( $arr["number"] ); +var_dump( $arr["string"] ); +var_dump( $arr["array1"] ); +var_dump( $arr["assoc_array"] ); +var_dump( $arr["boolean"] ); +var_dump( $arr["sample_obj"] ); + + +echo "\n*** Checking for output when get_defined_vars called in local function ***\n"; +func(); + + +echo "\n*** Checking for output when get_defined_vars called in function of a class ***\n"; +$sample_obj->func(); + +echo "\n*** Checking for output when get_defined_vars called in nested functions ***\n"; +function func1(){ +$func1_var = 2; +var_dump( get_defined_vars() ); +function func2(){ +$func2_var = 3; +var_dump( get_defined_vars() ); +} +func2(); +} +func1(); + +echo "\nDone"; +?> +--EXPECTF-- +*** Displaying various variables through the array captured by the get_defined_vars function call *** +int(1) +float(22.33) +string(13) "sample string" +array(6) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(5) + [5]=> + int(8) +} +array(5) { + ["a"]=> + int(97) + ["c"]=> + int(99) + ["A"]=> + int(65) + ["C"]=> + int(67) + [1]=> + string(7) "string1" +} +bool(true) +object(sample)#1 (2) { + ["number"]=> + int(233) + ["string"]=> + string(7) "string2" +} + +*** Checking for output when get_defined_vars called in local function *** +array(1) { + ["string33"]=> + int(22) +} + +*** Checking for output when get_defined_vars called in function of a class *** +array(1) { + ["local_var"]=> + int(2) +} + +*** Checking for output when get_defined_vars called in nested functions *** +array(1) { + ["func1_var"]=> + int(2) +} +array(1) { + ["func2_var"]=> + int(3) +} + +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/globals.inc b/phpt/tests/php-5.2.5/Zend/tests/globals.inc new file mode 100644 index 0000000000000..976237cf1f420 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/globals.inc @@ -0,0 +1,15 @@ + diff --git a/phpt/tests/php-5.2.5/Zend/tests/globals_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/globals_001.phpt new file mode 100644 index 0000000000000..b678c5310154a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/globals_001.phpt @@ -0,0 +1,34 @@ +--TEST-- +globals in global scope +--INIT-- +variables_order="egpcs" +--FILE-- + +--EXPECTF-- +bool(true) +bool(false) +string(5) "array" +int(%d) +string(%d) "%s" + +Notice: Undefined index: PHP_SELF in %s on line %d +NULL + +Notice: Undefined variable: _SERVER in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/globals_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/globals_002.phpt new file mode 100644 index 0000000000000..3bc3dae2dda66 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/globals_002.phpt @@ -0,0 +1,37 @@ +--TEST-- +globals in local scope +--INIT-- +variables_order="egpcs" +--FILE-- + +--EXPECTF-- +bool(true) +bool(false) +string(5) "array" +int(%d) +string(%d) "%s" + +Notice: Undefined index: PHP_SELF in %s on line %d +NULL + +Notice: Undefined variable: _SERVER in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/globals_003.phpt b/phpt/tests/php-5.2.5/Zend/tests/globals_003.phpt new file mode 100644 index 0000000000000..dcc7935a91eae --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/globals_003.phpt @@ -0,0 +1,43 @@ +--TEST-- +globals in local scope - 2 +--INIT-- +variables_order="egpcs" +--FILE-- + +--EXPECTF-- +bool(true) +bool(false) +string(5) "array" +int(%d) +string(%d) "%s" + +Notice: Undefined index: PHP_SELF in %s on line %d +NULL + +Notice: Undefined variable: _SERVER in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/globals_004.phpt b/phpt/tests/php-5.2.5/Zend/tests/globals_004.phpt new file mode 100644 index 0000000000000..e06791e61ca22 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/globals_004.phpt @@ -0,0 +1,28 @@ +--TEST-- +globals in local scope - 3 +--INIT-- +variables_order="egpcs" +--FILE-- + +--EXPECTF-- +bool(true) +bool(false) +string(5) "array" +int(%d) +string(%d) "%s" + +Notice: Undefined index: PHP_SELF in %s on line %d +NULL + +Notice: Undefined variable: _SERVER in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/halt01.phpt b/phpt/tests/php-5.2.5/Zend/tests/halt01.phpt new file mode 100644 index 0000000000000..7233bdcb1e74f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/halt01.phpt @@ -0,0 +1,12 @@ +--TEST-- +__HALT_COMPILER() basic test +--FILE-- + +===DONE=== +--EXPECT-- +testint(73) \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/Zend/tests/halt_compiler2.phpt b/phpt/tests/php-5.2.5/Zend/tests/halt_compiler2.phpt new file mode 100644 index 0000000000000..0ced2142cde95 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/halt_compiler2.phpt @@ -0,0 +1,23 @@ +--TEST-- +__HALT_COMPILER(); 2 files +--FILE-- + +hi there"; +file_put_contents(dirname(__FILE__) . '/test1.php', $text); +$text = " +hi there 2"; +file_put_contents(dirname(__FILE__) . '/test2.php', $text); +include dirname(__FILE__) . '/test1.php'; +include dirname(__FILE__) . '/test2.php'; +?> +==DONE== +--CLEAN-- + +--EXPECT-- +testint(73) +test2int(74) +==DONE== \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/Zend/tests/halt_compiler3.phpt b/phpt/tests/php-5.2.5/Zend/tests/halt_compiler3.phpt new file mode 100644 index 0000000000000..6ee16f79b98f6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/halt_compiler3.phpt @@ -0,0 +1,10 @@ +--TEST-- +__HALT_COMPILER(); bad define() of __COMPILER_HALT_OFFSET__ 1 +--FILE-- + +==DONE== +--EXPECTF-- +Notice: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d +==DONE== \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/Zend/tests/halt_compiler4.phpt b/phpt/tests/php-5.2.5/Zend/tests/halt_compiler4.phpt new file mode 100644 index 0000000000000..43e532ce7dcbc --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/halt_compiler4.phpt @@ -0,0 +1,10 @@ +--TEST-- +__HALT_COMPILER(); bad define() of __COMPILER_HALT_OFFSET__ 2 +--FILE-- + +==DONE== +--EXPECTF-- +Notice: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/Zend/tests/hex_overflow_32bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/hex_overflow_32bit.phpt new file mode 100644 index 0000000000000..36e9a7e9d32f3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/hex_overflow_32bit.phpt @@ -0,0 +1,29 @@ +--TEST-- +testing integer overflow (32bit) +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +float(4083360297110%d) +float(4.7223664828%dE+21) +float(1.3521606402%dE+31) +float(1.9807040628%dE+27) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/increment_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/increment_001.phpt new file mode 100644 index 0000000000000..3638474971a2d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/increment_001.phpt @@ -0,0 +1,60 @@ +--TEST-- +incrementing different variables +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +string(1) "1" +int(2) +float(3.5) +int(1) +string(6) "strinh" +int(124) +float(3.5) +int(1) +bool(true) +bool(false) +object(stdClass)#%d (0) { +} +array(0) { +} +float(2147483648) +float(2147483648) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/instanceof.phpt b/phpt/tests/php-5.2.5/Zend/tests/instanceof.phpt new file mode 100755 index 0000000000000..edb5923c5bda9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/instanceof.phpt @@ -0,0 +1,18 @@ +--TEST-- +instanceof shouldn't call __autoload +--FILE-- + +--EXPECT-- +bool(false) +bool(true) diff --git a/phpt/tests/php-5.2.5/Zend/tests/int_overflow_32bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/int_overflow_32bit.phpt new file mode 100644 index 0000000000000..d9b56495e9f70 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/int_overflow_32bit.phpt @@ -0,0 +1,29 @@ +--TEST-- +testing integer overflow (32bit) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +int(-2147483648) +int(-2147483647) +int(-2147483638) +int(-2147483548) +int(-2147482648) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/int_overflow_64bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/int_overflow_64bit.phpt new file mode 100644 index 0000000000000..306fbae602ee8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/int_overflow_64bit.phpt @@ -0,0 +1,29 @@ +--TEST-- +testing integer overflow (64bit) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +int(-9223372036854775808) +int(-9223372036854775808) +int(-9223372036854775808) +int(-9223372036854775808) +int(-9223372036854775808) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/int_underflow_32bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/int_underflow_32bit.phpt new file mode 100644 index 0000000000000..901e7cfb55de2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/int_underflow_32bit.phpt @@ -0,0 +1,29 @@ +--TEST-- +testing integer underflow (32bit) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +int(-2147483648) +int(-2147483648) +int(-2147483648) +int(-2147483648) +int(-2147483648) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/int_underflow_64bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/int_underflow_64bit.phpt new file mode 100644 index 0000000000000..48a43a3ca38e4 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/int_underflow_64bit.phpt @@ -0,0 +1,29 @@ +--TEST-- +testing integer underflow (64bit) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +int(-9223372036854775808) +int(-9223372036854775808) +int(-9223372036854775808) +int(-9223372036854775808) +int(-9223372036854775808) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/is_a.phpt b/phpt/tests/php-5.2.5/Zend/tests/is_a.phpt new file mode 100755 index 0000000000000..03bb033a98c1b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/is_a.phpt @@ -0,0 +1,50 @@ +--TEST-- +is_a() and is_subclass_of() shouldn't call __autoload +--INI-- +error_reporting=4095 +--FILE-- + +--EXPECTF-- +Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 17 +bool(false) + +Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 18 +bool(true) + +Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 19 +bool(true) + +Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 20 +bool(true) +bool(false) +bool(false) +bool(true) +bool(false) +AUTOLOAD 'X1' +bool(false) diff --git a/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_001.phpt new file mode 100644 index 0000000000000..e9bcf8fa2878f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_001.phpt @@ -0,0 +1,17 @@ +--TEST-- +passing first parameter of __set() by ref +--FILE-- +$name = 1; + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__set() cannot take arguments by reference in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_002.phpt new file mode 100644 index 0000000000000..cb62f67f56add --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_002.phpt @@ -0,0 +1,16 @@ +--TEST-- +passing second parameter of __set() by ref +--FILE-- +prop = 1; + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__set() cannot take arguments by reference in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_003.phpt b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_003.phpt new file mode 100644 index 0000000000000..022cbd563c689 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_003.phpt @@ -0,0 +1,17 @@ +--TEST-- +passing parameter of __get() by ref +--FILE-- +$name); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__get() cannot take arguments by reference in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_004.phpt b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_004.phpt new file mode 100644 index 0000000000000..aa04d1aee6444 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_004.phpt @@ -0,0 +1,18 @@ +--TEST-- +passing parameter of __unset() by ref +--FILE-- +$name); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__unset() cannot take arguments by reference in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_005.phpt b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_005.phpt new file mode 100644 index 0000000000000..513c0618df222 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_005.phpt @@ -0,0 +1,18 @@ +--TEST-- +passing parameter of __isset() by ref +--FILE-- +$name)); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__isset() cannot take arguments by reference in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_006.phpt b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_006.phpt new file mode 100644 index 0000000000000..14d7d708b8e71 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_006.phpt @@ -0,0 +1,18 @@ +--TEST-- +passing first parameter of __call() by ref +--FILE-- +$func(); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__call() cannot take arguments by reference in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_007.phpt b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_007.phpt new file mode 100644 index 0000000000000..c962d4581367f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_007.phpt @@ -0,0 +1,19 @@ +--TEST-- +passing second parameter of __call() by ref +--FILE-- +$func($arg); + +echo "Done\n"; +?> +--EXPECTF-- +Fatal error: Method test::__call() cannot take arguments by reference in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_010.phpt b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_010.phpt new file mode 100644 index 0000000000000..0a45fb91137b6 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/magic_by_ref_010.phpt @@ -0,0 +1,30 @@ +--TEST-- +passing arguments by ref to a method handled by __call() +--INI-- +allow_call_time_pass_reference=1 +--FILE-- +test(&$v); + +var_dump($v); + +echo "Done\n"; +?> +--EXPECTF-- +str +5 +int(5) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/method_exists.phpt b/phpt/tests/php-5.2.5/Zend/tests/method_exists.phpt new file mode 100644 index 0000000000000..63ea3bd76dd50 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/method_exists.phpt @@ -0,0 +1,11 @@ +--TEST-- +method_exists() segfaults +--FILE-- + +--EXPECT-- +bool(true) +bool(false) diff --git a/phpt/tests/php-5.2.5/Zend/tests/mod_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/mod_001.phpt new file mode 100644 index 0000000000000..88596f3d5faff --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/mod_001.phpt @@ -0,0 +1,17 @@ +--TEST-- +modulus by zero +--FILE-- + +--EXPECTF-- +Warning: Division by zero in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/mul_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/mul_001.phpt new file mode 100644 index 0000000000000..4c5a75e7d1fdf --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/mul_001.phpt @@ -0,0 +1,15 @@ +--TEST-- +multiplying arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/not_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/not_001.phpt new file mode 100644 index 0000000000000..6eb0f000c90fb --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/not_001.phpt @@ -0,0 +1,22 @@ +--TEST-- +bitwise NOT, doubles and strings +--FILE-- + +--EXPECTF-- +int(-24) +string(8) "8c90929a" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/not_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/not_002.phpt new file mode 100644 index 0000000000000..df27772a73809 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/not_002.phpt @@ -0,0 +1,15 @@ +--TEST-- +bitwise NOT and arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/object-null.phpt b/phpt/tests/php-5.2.5/Zend/tests/object-null.phpt new file mode 100644 index 0000000000000..650178c3416de --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/object-null.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test whether an object is NULL or not. +--FILE-- + +--EXPECT-- +bool(true) +bool(false) +bool(true) +bool(false) diff --git a/phpt/tests/php-5.2.5/Zend/tests/object_handlers.phpt b/phpt/tests/php-5.2.5/Zend/tests/object_handlers.phpt new file mode 100755 index 0000000000000..bbc05e3a93d82 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/object_handlers.phpt @@ -0,0 +1,171 @@ +--TEST-- +Magic object handlers segfaults and memory errors +--FILE-- +const_get; +echo $y,"\n"; +$x->const_set = 1; +echo $y,"\n"; +$x->const_call(); +echo $y,"\n"; +$z = $x["const_dim_get"]; +echo $y,"\n"; +$x["const_dim_set"] = 1; +echo $y,"\n"; +isset($x["const_dim_isset"]); +echo $y,"\n"; +unset($x["const_dim_unset"]); +echo $y,"\n"; + +// IS_CONST + conversion +$z = $x->{1}; +echo $y,"\n"; +$x->{2} = 1; +echo $y,"\n"; + +// IS_TMP_VAR +$c = "tmp"; +$z = $x->{$c."_get"}; +echo $y,"\n"; +$x->{$c."_set"} = 1; +echo $y,"\n"; +$x->{$c."_call"}(); +echo $y,"\n"; +$z = $x[$c."_dim_get"]; +echo $y,"\n"; +$x[$c."_dim_set"] = 1; +echo $y,"\n"; +isset($x[$c."_dim_isset"]); +echo $y,"\n"; +unset($x[$c."_dim_unset"]); +echo $y,"\n"; + +// IS_TMP_VAR + conversion +$c = 0; +$z = $x->{$c+3}; +echo $y,"\n"; +$x->{$c+4} = 1; +echo $y,"\n"; + +// IS_CV +$c = "cv_get"; +$z = $x->{$c}; +echo $y,"\n"; +$c = "cv_set"; +$x->{$c} = 1; +echo $y,"\n"; +$c = "cv_call"; +$x->{$c}(); +echo $y,"\n"; +$c = "cv_dim_get"; +$z = $x[$c]; +echo $y,"\n"; +$c = "cv_dim_set"; +$x[$c] = 1; +echo $y,"\n"; +$c = "cv_dim_isset"; +isset($x[$c]); +echo $y,"\n"; +$c = "cv_dim_unset"; +unset($x[$c]); +echo $y,"\n"; + +// IS_CV + conversion +$c = 5; +$z = $x->{$c}; +echo $y,"\n"; +$c = 6; +$x->{$c} = 1; +echo $y,"\n"; + +// IS_VAR +$z = $x->{f("var_get")}; +echo $y,"\n"; +$x->{f("var_set")} = 1; +echo $y,"\n"; +$x->{f("var_call")}(); +echo $y,"\n"; +$z = $x[f("var_dim_get")]; +echo $y,"\n"; +$x[f("var_dim_set")] = 1; +echo $y,"\n"; +isset($x[f("var_dim_isset")]); +echo $y,"\n"; +unset($x[f("var_dim_unset")]); +echo $y,"\n"; + +// IS_VAR + conversion +$z = $x->{f(7)}; +echo $y,"\n"; +$x->{f(8)} = 1; +echo $y,"\n"; +?> +--EXPECT-- +const_get +const_set +const_call +const_dim_get +const_dim_set +const_dim_isset +const_dim_unset +1 +2 +tmp_get +tmp_set +tmp_call +tmp_dim_get +tmp_dim_set +tmp_dim_isset +tmp_dim_unset +3 +4 +cv_get +cv_set +cv_call +cv_dim_get +cv_dim_set +cv_dim_isset +cv_dim_unset +5 +6 +var_get +var_set +var_call +var_dim_get +var_dim_set +var_dim_isset +var_dim_unset +7 +8 diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_001.phpt new file mode 100644 index 0000000000000..04d882ca3ca87 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_001.phpt @@ -0,0 +1,60 @@ +--TEST-- +comparing objects to other types +--FILE-- + +--EXPECTF-- +bool(false) +bool(true) +bool(true) +bool(false) +bool(false) +bool(true) +bool(false) +bool(true) + +Notice: Object of class Bar could not be converted to int in %s on line %d +bool(false) + +Notice: Object of class Bar could not be converted to int in %s on line %d +bool(true) + +Notice: Object of class Bar could not be converted to int in %s on line %d +bool(true) + +Notice: Object of class Bar could not be converted to int in %s on line %d +bool(false) + +Notice: Object of class Bar could not be converted to double in %s on line %d +bool(true) + +Notice: Object of class Bar could not be converted to double in %s on line %d +bool(false) + +Notice: Object of class Bar could not be converted to int in %s on line %d +bool(true) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_002.phpt new file mode 100644 index 0000000000000..87ba0fdc3bc4c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_002.phpt @@ -0,0 +1,24 @@ +--TEST-- +method overloading with different method signature +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Declaration of test3::foo() should be compatible with that of test::foo() in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_003.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_003.phpt new file mode 100644 index 0000000000000..1c254290f72e9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_003.phpt @@ -0,0 +1,24 @@ +--TEST-- +method overloading with different method signature +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Declaration of test3::foo() should be compatible with that of test::foo() in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_004.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_004.phpt new file mode 100644 index 0000000000000..35ab4775b157b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_004.phpt @@ -0,0 +1,24 @@ +--TEST-- +method overloading with different method signature +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Declaration of test3::foo() should be compatible with that of test::foo() in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_005.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_005.phpt new file mode 100644 index 0000000000000..d583c9be90d74 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_005.phpt @@ -0,0 +1,24 @@ +--TEST-- +method overloading with different method signature +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Declaration of test3::foo() should be compatible with that of test::foo() in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_006.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_006.phpt new file mode 100644 index 0000000000000..fb2e28b3af674 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_006.phpt @@ -0,0 +1,24 @@ +--TEST-- +method overloading with different method signature +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Declaration of test3::foo() should be compatible with that of test::foo() in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_007.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_007.phpt new file mode 100644 index 0000000000000..2fce04a17db3b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_007.phpt @@ -0,0 +1,24 @@ +--TEST-- +method overloading with different method signature +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Declaration of test3::foo() should be compatible with that of test::foo() in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_008.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_008.phpt new file mode 100644 index 0000000000000..b61d16786c03c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_008.phpt @@ -0,0 +1,24 @@ +--TEST-- +method overloading with different method signature +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Declaration of test3::foo() should be compatible with that of test::foo() in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_009.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_009.phpt new file mode 100644 index 0000000000000..5fad0046a883d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_009.phpt @@ -0,0 +1,24 @@ +--TEST-- +method overloading with different method signature +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Declaration of test3::foo() should be compatible with that of test::foo() in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_010.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_010.phpt new file mode 100644 index 0000000000000..5d004629d90dd --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_010.phpt @@ -0,0 +1,19 @@ +--TEST-- +redefining constructor (__construct second) +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Redefining already defined constructor for class test in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_011.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_011.phpt new file mode 100644 index 0000000000000..eb1fc0c1f0a7b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_011.phpt @@ -0,0 +1,19 @@ +--TEST-- +redefining constructor (__construct first) +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Redefining already defined constructor for class test in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_012.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_012.phpt new file mode 100644 index 0000000000000..95cce3eca9a9b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_012.phpt @@ -0,0 +1,15 @@ +--TEST-- +implementing a class +--FILE-- + +--EXPECTF-- +Fatal error: bar cannot implement foo - it is not an interface in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_013.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_013.phpt new file mode 100644 index 0000000000000..3f7bea81af8b2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_013.phpt @@ -0,0 +1,15 @@ +--TEST-- +implementing the same interface twice +--FILE-- + +--EXPECTF-- +Fatal error: Class bar cannot implement previously implemented interface foo in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_014.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_014.phpt new file mode 100644 index 0000000000000..c422b392ea9c3 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_014.phpt @@ -0,0 +1,15 @@ +--TEST-- +extending the same interface twice +--FILE-- + +--EXPECTF-- +Fatal error: Class bar cannot implement previously implemented interface foo in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/objects_015.phpt b/phpt/tests/php-5.2.5/Zend/tests/objects_015.phpt new file mode 100755 index 0000000000000..a923ee0c46413 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/objects_015.phpt @@ -0,0 +1,26 @@ +--TEST-- +comparing objects with strings/NULL +--FILE-- + $o); +var_dump($o != null); +var_dump(is_null($o)); + +?> +===DONE=== +--EXPECT-- +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +===DONE=== diff --git a/phpt/tests/php-5.2.5/Zend/tests/oct_overflow_32bit.phpt b/phpt/tests/php-5.2.5/Zend/tests/oct_overflow_32bit.phpt new file mode 100644 index 0000000000000..d27c1f547c599 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/oct_overflow_32bit.phpt @@ -0,0 +1,31 @@ +--TEST-- +testing integer overflow (32bit) +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +float(4308640384%d) +float(3545655%d) +float(262143) +float(549755813%d) +float(1884877076%d) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/offset_array.phpt b/phpt/tests/php-5.2.5/Zend/tests/offset_array.phpt new file mode 100644 index 0000000000000..a7e2f21b1c23f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/offset_array.phpt @@ -0,0 +1,47 @@ +--TEST-- +using different variables to access array offsets +--FILE-- + +--EXPECTF-- +int(2) +int(1) + +Notice: Undefined index: in %s on line %d +NULL + +Notice: Undefined index: run away in %s on line %d +NULL +int(2) +int(1) + +Strict Standards: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d +int(%d) + +Warning: Illegal offset type in %s on line %d +NULL + +Warning: Illegal offset type in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/offset_assign.phpt b/phpt/tests/php-5.2.5/Zend/tests/offset_assign.phpt new file mode 100644 index 0000000000000..eebf63c4f370c --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/offset_assign.phpt @@ -0,0 +1,11 @@ +--TEST-- +Crash on $x['x']['y'] += 1 when $x is string +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use string offset as an array in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/offset_bool.phpt b/phpt/tests/php-5.2.5/Zend/tests/offset_bool.phpt new file mode 100644 index 0000000000000..9bf8a89da7683 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/offset_bool.phpt @@ -0,0 +1,37 @@ +--TEST-- +using different variables to access boolean offsets +--FILE-- + +--EXPECTF-- +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/offset_long.phpt b/phpt/tests/php-5.2.5/Zend/tests/offset_long.phpt new file mode 100644 index 0000000000000..c65a5ba3f8d4d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/offset_long.phpt @@ -0,0 +1,37 @@ +--TEST-- +using different variables to access long offsets +--FILE-- + +--EXPECTF-- +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/offset_null.phpt b/phpt/tests/php-5.2.5/Zend/tests/offset_null.phpt new file mode 100644 index 0000000000000..9364f0a2e522d --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/offset_null.phpt @@ -0,0 +1,37 @@ +--TEST-- +using different variables to access null offsets +--FILE-- + +--EXPECTF-- +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/offset_object.phpt b/phpt/tests/php-5.2.5/Zend/tests/offset_object.phpt new file mode 100644 index 0000000000000..b570fd2a2f6e1 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/offset_object.phpt @@ -0,0 +1,11 @@ +--TEST-- +accessing object dimension +--FILE-- + +--EXPECTF-- +Fatal error: Cannot use object of type stdClass as array in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/offset_string.phpt b/phpt/tests/php-5.2.5/Zend/tests/offset_string.phpt new file mode 100644 index 0000000000000..e8c6b775444a8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/offset_string.phpt @@ -0,0 +1,45 @@ +--TEST-- +using different variables to access string offsets +--FILE-- + +--EXPECTF-- +string(1) "i" +string(1) "S" +string(1) "S" +string(1) "S" +string(1) "i" +string(1) "S" + +Warning: Illegal offset type in %s on line %d +string(1) "%s" + +Warning: Illegal offset type in %s on line %d + +Notice: Object of class stdClass could not be converted to int in %s on line %d +string(1) "%s" + +Warning: Illegal offset type in %s on line %d +string(1) "i" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/or_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/or_001.phpt new file mode 100644 index 0000000000000..1e4e5131a590a --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/or_001.phpt @@ -0,0 +1,29 @@ +--TEST-- +bitwise OR and strings +--FILE-- + +--EXPECTF-- +string(8) "3337>755" +string(8) "3337>755" +string(4) "wou" +string(4) "wou" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/selfParent_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/selfParent_001.phpt new file mode 100755 index 0000000000000..d2796996d3d32 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/selfParent_001.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test when constants are initialised. See also selfParent_002.phpt. +--FILE-- + +--EXPECT-- +string(10) "const in A" +string(10) "const in A" diff --git a/phpt/tests/php-5.2.5/Zend/tests/selfParent_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/selfParent_002.phpt new file mode 100755 index 0000000000000..45120177a6f4f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/selfParent_002.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test when constants are initialised. See also selfParent_001.phpt. +--FILE-- + +--EXPECT-- +string(10) "const in A" +string(10) "const in A" diff --git a/phpt/tests/php-5.2.5/Zend/tests/settype_array.phpt b/phpt/tests/php-5.2.5/Zend/tests/settype_array.phpt new file mode 100644 index 0000000000000000000000000000000000000000..5da023205ead00425c78f896c8419a87e86e7555 GIT binary patch literal 1006 zcmah|?`zvI5Y1QXuQ)^o@`#6jBuz)x_QRIKAdEpX7_7r6j=UIL$w+cXDgEDfCogqd zX#2${J-vH(?_?#(W_7tq5>`p)8~q1%OUHQgnfU@-F(pzjx#H1Tp<$J4vXDP@0dv=dq z8O+n_ZzzuGRMR08JP8(Y7X +--EXPECTF-- +bool(true) +bool(true) +bool(false) +bool(true) +bool(true) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(true) +bool(true) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/settype_double.phpt b/phpt/tests/php-5.2.5/Zend/tests/settype_double.phpt new file mode 100644 index 0000000000000..ed63f8ae83b0e --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/settype_double.phpt @@ -0,0 +1,57 @@ +--TEST-- +casting different variables to double using settype() +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +float(0) +float(8754456) +float(0) +float(0) +float(9876545) +float(0.1) +float(0) +float(1) +float(0) +float(1) +float(0) +float(%d) + +Notice: Object of class test could not be converted to double in %s on line %d +float(1) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/settype_int.phpt b/phpt/tests/php-5.2.5/Zend/tests/settype_int.phpt new file mode 100644 index 0000000000000..7b96cd594eaa2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/settype_int.phpt @@ -0,0 +1,55 @@ +--TEST-- +casting different variables to integer using settype() +--FILE-- + +--EXPECTF-- +int(0) +int(8754456) +int(0) +int(0) +int(9876545) +int(0) +int(0) +int(1) +int(0) +int(1) +int(0) +int(%d) + +Notice: Object of class test could not be converted to int in %s on line %d +int(1) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/settype_null.phpt b/phpt/tests/php-5.2.5/Zend/tests/settype_null.phpt new file mode 100644 index 0000000000000..0abf2f98102fb --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/settype_null.phpt @@ -0,0 +1,53 @@ +--TEST-- +casting different variables to null using settype() +--FILE-- + +--EXPECTF-- +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/settype_object.phpt b/phpt/tests/php-5.2.5/Zend/tests/settype_object.phpt new file mode 100644 index 0000000000000000000000000000000000000000..d619dce7e3a7d86e2d78bdd1a62f86ece92e6069 GIT binary patch literal 1126 zcmbVM-%I2$5cakCD~7m23R`LSr-!FL=n4mm2(EB&9wpnRw>@f7lGH=Q|J|8(SAB2~ zc3(1+NxyIAn@k!-i`m^GidZI{FZCbD%c4+LX%A1*mU3As2i|~L{#BWW#?d!UdH-B1 z5dw>%>mTzO;=fkuL+0jwK1b8Dv=~NG3S*VbRv@}M zqyuu=>Nm}y07~x~NBRQ{qqC z#rj^u-I5lSkzU{=Y{j9Hmu;NG^&P}r^QjCZ!b?d$0)sX%_y`QQruzCym&R10oyC2C rG`w4J|I_w$F;+R#*i4C|JOon!{Qv+b6W_t(r!@4syD?p-pxI_`n+87s literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/Zend/tests/settype_resource.phpt b/phpt/tests/php-5.2.5/Zend/tests/settype_resource.phpt new file mode 100644 index 0000000000000000000000000000000000000000..cc8cde34fd50e8996a10e3467184650493c80eb0 GIT binary patch literal 1581 zcmb`H-)q}25Xbjw{S}9ofDG}l^RsK$_MuB*5JsUH8?3`9w!C<_l9A+&Qu@E|PEH#3 zt{2_;WPP~%>U3$kUEgohl$FA|M*W7WscUJZa_}TfBX+H{;4~O%b#F=uy`{gbbndy6 zJOP%bw_i4EBz(H=_8ns*1D8mPUPo9%6yM(n#V z3WYg8X?_kjLMiQ_)apqZ_uu`{wLqg_Yyp*R8zo^}u|XTYOyDRJ3kqH#_$YcC1)Ner=YCz5i3Gg%fb$NxBw7{e>ke>om zADEs3vm{s+JFQ#p-)bnSJds{~C?JiFK$;&12_IJp=oRM?U0@u8M!dSKzhQ!cV_+nmB%gmNa0;H)`kBvSlQpeM1 zYb}8fVt&HB4cm~eB3+3e4V|=lG@T(xXe~Yi=JD--Jfw6wNk*e&+~m!%j9oaIPR7Y7 zp)5Wa#1yvNewPixVR-1uLaYr^w7PcT?rA=!(9`Zv%vmXvMv<)`*v=sgxTKlBU5*3D z`fe^Fc?6_+{Z=(30>~C-D+T;oNnA?udT~w*oju>rt`;{@d{Zc+=AIR5PH^1 literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/Zend/tests/shift_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/shift_001.phpt new file mode 100644 index 0000000000000..aeb399452d50b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/shift_001.phpt @@ -0,0 +1,25 @@ +--TEST-- +shifting strings left +--FILE-- + +--EXPECTF-- +int(492) +int(0) +int(362760) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/shift_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/shift_002.phpt new file mode 100644 index 0000000000000..4d8421a5666c0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/shift_002.phpt @@ -0,0 +1,25 @@ +--TEST-- +shifting strings right +--FILE-- +>= 2; +var_dump($s); + +$s1 >>= 1; +var_dump($s1); + +$s2 >>= 3; +var_dump($s2); + +echo "Done\n"; +?> +--EXPECTF-- +int(30) +int(0) +int(5668) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/strict_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/strict_001.phpt new file mode 100644 index 0000000000000..8070eb9fe78a9 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/strict_001.phpt @@ -0,0 +1,19 @@ +--TEST-- +using resource as array offset +--INI-- +error_reporting=8191 +--FILE-- + +--EXPECTF-- +Strict Standards: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d +int(%d) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/strict_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/strict_002.phpt new file mode 100644 index 0000000000000..d8a5af2f47a5e --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/strict_002.phpt @@ -0,0 +1,27 @@ +--TEST-- +assigning static property as non static +--INI-- +error_reporting=8191 +--FILE-- +foo = 5; + +$fp = fopen(__FILE__, 'r'); + +var_dump($t); + +echo "Done\n"; +?> +--EXPECTF-- +Strict Standards: Accessing static property test::$foo as non static in %s on line %d +object(test)#%d (1) { + ["foo"]=> + int(5) +} +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/sub_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/sub_001.phpt new file mode 100644 index 0000000000000..2a8b3cdffdf9b --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/sub_001.phpt @@ -0,0 +1,15 @@ +--TEST-- +subtracting arrays +--FILE-- + +--EXPECTF-- +Fatal error: Unsupported operand types in %s on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset.inc b/phpt/tests/php-5.2.5/Zend/tests/unset.inc new file mode 100644 index 0000000000000..ecdde15816897 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset.inc @@ -0,0 +1,3 @@ + diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv01.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv01.phpt new file mode 100644 index 0000000000000..05270c18eefde --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv01.phpt @@ -0,0 +1,13 @@ +--TEST-- +unset() CV 1 (unset() global variable) +--FILE-- + +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv01.php on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv02.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv02.phpt new file mode 100644 index 0000000000000..f42d08da09f18 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv02.phpt @@ -0,0 +1,13 @@ +--TEST-- +unset() CV 2 (unset() global variable in $GLOBALS) +--FILE-- + +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv02.php on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv03.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv03.phpt new file mode 100644 index 0000000000000..15c7b89fe91d2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv03.phpt @@ -0,0 +1,13 @@ +--TEST-- +unset() CV 3 (unset() global variable in included file) +--FILE-- + +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv03.php on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv04.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv04.phpt new file mode 100644 index 0000000000000..f0634c39171b8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv04.phpt @@ -0,0 +1,16 @@ +--TEST-- +unset() CV 4 (unset() local variable in included file) +--FILE-- + +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv04.php on line %d diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv05.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv05.phpt new file mode 100644 index 0000000000000..5d26535def38f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv05.phpt @@ -0,0 +1,28 @@ +--TEST-- +unset() CV 5 (indirect unset() of global variable in session_start()) +--INI-- +register_long_arrays=1 +session.auto_start=0 +session.save_handler=files +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +ok + +Warning: session_start(): Cannot send session cookie - headers already sent by (output started at %sunset_cv05.php on line %d + +Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at %sunset_cv05.php:%d) in %sunset_cv05.php on line %d +Array +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv06.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv06.phpt new file mode 100644 index 0000000000000..fa414b20bf9d2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv06.phpt @@ -0,0 +1,26 @@ +--TEST-- +unset() CV 6 (indirect unset() of global variable in session_unset()) +--SKIPIF-- + +--INI-- +register_globals=1 +session.auto_start=0 +session.save_handler=files +--FILE-- + +--EXPECTF-- +1 +2 + +Notice: Undefined variable: x in %sunset_cv06.php on line %d +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv07.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv07.phpt new file mode 100644 index 0000000000000..fe16abf750792 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv07.phpt @@ -0,0 +1,18 @@ +--TEST-- +unset() CV 7 (indirect unset() of global variable in import_request_variables()) +--SKIPIF-- + +--GET-- +x=2 +--FILE-- + +--EXPECTF-- +1 +2 +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv08.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv08.phpt new file mode 100644 index 0000000000000..d5d52efdb0caf --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv08.phpt @@ -0,0 +1,15 @@ +--TEST-- +unset() CV 8 (unset() of global variable in array_unique($GLOBALS)) +--FILE-- + +--EXPECTF-- +ok +ok +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv09.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv09.phpt new file mode 100644 index 0000000000000..7b0f9bf50e2ab --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv09.phpt @@ -0,0 +1,14 @@ +--TEST-- +unset() CV 9 (unset() of global variable in array_pop($GLOBALS)) +--FILE-- + +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv09.php on line %d +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv10.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv10.phpt new file mode 100644 index 0000000000000..57e76fb8e9d85 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv10.phpt @@ -0,0 +1,18 @@ +--TEST-- +unset() CV 10 (unset() of global variable in ArrayObject::offsetUnset($GLOBALS)) +--SKIPIF-- + +--FILE-- +offsetUnset('x'); +echo $x; +echo "ok\n"; +?> +--EXPECTF-- +ok + +Notice: Undefined variable: x in %sunset_cv10.php on line %d +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv11.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv11.phpt new file mode 100644 index 0000000000000..9ebc3fadb76c0 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv11.phpt @@ -0,0 +1,21 @@ +--TEST-- +unset() CV 11 (unset() of copy destoies original value) +--FILE-- +"ok"); +var_dump($x); +$cf = $x; +unset($cf['default']); +var_dump($x); +echo "ok\n"; +?> +--EXPECT-- +array(1) { + ["default"]=> + string(2) "ok" +} +array(1) { + ["default"]=> + string(2) "ok" +} +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/unset_cv12.phpt b/phpt/tests/php-5.2.5/Zend/tests/unset_cv12.phpt new file mode 100755 index 0000000000000..dd4544726ae31 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/unset_cv12.phpt @@ -0,0 +1,11 @@ +--TEST-- +unset() CV 12 (unset() in indirect called function) +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/Zend/tests/xor_001.phpt b/phpt/tests/php-5.2.5/Zend/tests/xor_001.phpt new file mode 100644 index 0000000000000..e1a521dff968f --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/xor_001.phpt @@ -0,0 +1,16 @@ +--TEST-- +XORing arrays +--FILE-- + +--EXPECTF-- +int(1) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/xor_002.phpt b/phpt/tests/php-5.2.5/Zend/tests/xor_002.phpt new file mode 100644 index 0000000000000..0cf4054fa4cb2 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/xor_002.phpt @@ -0,0 +1,39 @@ +--TEST-- +XORing strings +--FILE-- + +--EXPECTF-- +string(6) "030107" +string(6) "030107" +string(8) "070a1e11" +string(8) "070a1e11" +string(8) "070a1e11" +string(8) "070a1e11" +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/xor_003.phpt b/phpt/tests/php-5.2.5/Zend/tests/xor_003.phpt new file mode 100644 index 0000000000000..8aa1c636b76ee --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/xor_003.phpt @@ -0,0 +1,19 @@ +--TEST-- +XORing booleans +--FILE-- + +--EXPECTF-- +int(1) +int(0) +int(0) +Done diff --git a/phpt/tests/php-5.2.5/Zend/tests/zend2.php.txt b/phpt/tests/php-5.2.5/Zend/tests/zend2.php.txt new file mode 100644 index 0000000000000..afe422eaaec85 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/zend2.php.txt @@ -0,0 +1,275 @@ +Example 1: A singleton (static members) +======================================= + +counter; + print "\n"; + } + } + + + class SingletonCounter { + static $m_instance = NULL; + + function Instance() + { + if (self::$m_instance == NULL) { + self::$m_instance = new Counter(); + } + return self::$m_instance; + } + } + + SingletonCounter::Instance()->increment_and_print(); + SingletonCounter::Instance()->increment_and_print(); + SingletonCounter::Instance()->increment_and_print(); + +?> + +Example 2: Factory method (derefencing objects returned from functions) +======================================================================= + +draw(); + ShapeFactoryMethod("Square")->draw(); + + +?> + +Example 3: Class constants and class scope +========================================== + + + +Example 4: Regular object method using both local and global functions +====================================================================== + +get_hello_world(); + return strlen($str); + } + } + + $obj = new HelloWorld(); + print "length_of_hello_world() = " . $obj->length_of_hello_world(); + print "\n"; +?> + +Example 5: Multiple derefencing of objects returned from methods +================================================================ + +name = $_name; + } + + function display() + { + print $this->name; + print "\n"; + } + } + + class Person { + function Person($_name, $_address) + { + $this->name = new Name($_name); + } + + function getName() + { + return $this->name; + } + } + + $person = new Person("John", "New York"); + $person->getName()->display(); + +?> + +Example 6: Exception handling +============================= + +error = $_error; + } + + function getException() + { + return $this->error; + } + } + + function ThrowException() + { + throw new MyException("'This is an exception!'"); + } + + + try { + } catch (MyException $exception) { + print "There was an exception: " . $exception->getException(); + print "\n"; + } + + try { + ThrowException(); + } catch (MyException $exception) { + print "There was an exception: " . $exception->getException(); + print "\n"; + } + +?> + +Example 7: __clone() +=================== + +id = self::$id++; + } + + function __clone() + { + $this->name = $that->name; + $this->address = "New York"; + $this->id = self::$id++; + } + } + + + + $obj = new MyCloneable(); + + $obj->name = "Hello"; + $obj->address = "Tel-Aviv"; + + print $obj->id; + print "\n"; + + $obj = $obj->__clone(); + + print $obj->id; + print "\n"; + print $obj->name; + print "\n"; + print $obj->address; + print "\n"; +?> + +Example 8: Unified constructors +=============================== + + + +Example 9: Destructors +======================= + +name = "MyDestructableClass"; + } + + function __destruct() + { + print "Destroying " . $this->name . "\n"; + } +} + +$obj = new MyDestructableClass(); + +?> diff --git a/phpt/tests/php-5.2.5/Zend/tests/zend_operators.phpt b/phpt/tests/php-5.2.5/Zend/tests/zend_operators.phpt new file mode 100644 index 0000000000000..99fdf0217c4f8 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/zend_operators.phpt @@ -0,0 +1,12 @@ +--TEST-- +Operator precedence +--FILE-- + +--EXPECT-- +bool(true) +bool(true) diff --git a/phpt/tests/php-5.2.5/Zend/tests/zend_strtod.phpt b/phpt/tests/php-5.2.5/Zend/tests/zend_strtod.phpt new file mode 100644 index 0000000000000..1b11be0388232 --- /dev/null +++ b/phpt/tests/php-5.2.5/Zend/tests/zend_strtod.phpt @@ -0,0 +1,19 @@ +--TEST-- +zend_strtod() leaks on big doubles +--INI-- +precision=14 +--FILE-- + +--EXPECTF-- +float(-100) +float(808792757210) +float(-4.5646456464565E+27) +float(-11276204760067000) +Done diff --git a/phpt/tests/php-5.2.5/ext/bcmath/tests/bcadd.phpt b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcadd.phpt new file mode 100644 index 0000000000000..61552eecded0e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcadd.phpt @@ -0,0 +1,16 @@ +--TEST-- +bcadd() function +--SKIPIF-- + +--INI-- +bcmath.scale=0 +--FILE-- + +--EXPECT-- +3 +4.0000 +8728932003911564969352217864684.00 diff --git a/phpt/tests/php-5.2.5/ext/bcmath/tests/bccomp.phpt b/phpt/tests/php-5.2.5/ext/bcmath/tests/bccomp.phpt new file mode 100644 index 0000000000000..b2bf9f4ac2b9b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bcmath/tests/bccomp.phpt @@ -0,0 +1,18 @@ +--TEST-- +bccomp() function +--SKIPIF-- + +--INI-- +bcmath.scale=0 +--FILE-- + +--EXPECT-- +-1 +-1 +0 +1 diff --git a/phpt/tests/php-5.2.5/ext/bcmath/tests/bcdiv.phpt b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcdiv.phpt new file mode 100644 index 0000000000000..cda19496d5569 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcdiv.phpt @@ -0,0 +1,18 @@ +--TEST-- +bcdiv() function +--SKIPIF-- + +--INI-- +bcmath.scale=0 +--FILE-- + +--EXPECT-- +0 +0.50 +-0.2000 +4526580661.75 diff --git a/phpt/tests/php-5.2.5/ext/bcmath/tests/bcmod.phpt b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcmod.phpt new file mode 100644 index 0000000000000..1d7be48a754b2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcmod.phpt @@ -0,0 +1,16 @@ +--TEST-- +bcmod() function +--SKIPIF-- + +--INI-- +bcmath.scale=0 +--FILE-- + +--EXPECT-- +1 +-1 +1459434331351930289678 diff --git a/phpt/tests/php-5.2.5/ext/bcmath/tests/bcmul.phpt b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcmul.phpt new file mode 100644 index 0000000000000..0ff322fe327bc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcmul.phpt @@ -0,0 +1,18 @@ +--TEST-- +bcmul() function +--SKIPIF-- + +--INI-- +bcmath.scale=0 +--FILE-- + +--EXPECT-- +2 +-15 +12193263111263526900 +3.75 diff --git a/phpt/tests/php-5.2.5/ext/bcmath/tests/bcpow.phpt b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcpow.phpt new file mode 100644 index 0000000000000..bdd4e08cab9ed --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcpow.phpt @@ -0,0 +1,16 @@ +--TEST-- +bcpow() function +--SKIPIF-- + +--INI-- +bcmath.scale=0 +--FILE-- + +--EXPECT-- +1 +-32 +18446744073709551616 diff --git a/phpt/tests/php-5.2.5/ext/bcmath/tests/bcscale.phpt b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcscale.phpt new file mode 100644 index 0000000000000..4fc2f85eb92c1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcscale.phpt @@ -0,0 +1,21 @@ +--TEST-- +bcscale() function +--SKIPIF-- + +--INI-- +bcmath.scale=0 +--FILE-- + +--EXPECT-- +3 +3.00 +3.0000000000 +3 diff --git a/phpt/tests/php-5.2.5/ext/bcmath/tests/bcsqrt.phpt b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcsqrt.phpt new file mode 100644 index 0000000000000..46d92fd5edc1f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcsqrt.phpt @@ -0,0 +1,14 @@ +--TEST-- +bcsqrt() function +--SKIPIF-- + +--INI-- +bcmath.scale=0 +--FILE-- + +--EXPECT-- +3 +43913234134.28826 diff --git a/phpt/tests/php-5.2.5/ext/bcmath/tests/bcsub.phpt b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcsub.phpt new file mode 100644 index 0000000000000..71726492f7788 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bcmath/tests/bcsub.phpt @@ -0,0 +1,16 @@ +--TEST-- +bcsub() function +--SKIPIF-- + +--INI-- +bcmath.scale=0 +--FILE-- + +--EXPECT-- +-1 +-6.0000 +8728932000054820705086578390258.00 diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/001.phpt b/phpt/tests/php-5.2.5/ext/bz2/tests/001.phpt new file mode 100644 index 0000000000000..a4ef1a2af761c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bz2/tests/001.phpt @@ -0,0 +1,43 @@ +--TEST-- +bzopen() and invalid parameters +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for bzopen() in %s on line %d +NULL + +Warning: bzopen(): '' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d +bool(false) + +Warning: bzopen(): filename cannot be empty in %s on line %d +bool(false) + +Warning: bzopen(): filename cannot be empty in %s on line %d +bool(false) + +Warning: bzopen(): 'x' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d +bool(false) + +Warning: bzopen(): 'rw' is not a valid mode for bzopen(). Only 'w' and 'r' are supported. in %s on line %d +bool(false) + +Warning: bzopen(no_such_file): failed to open stream: No such file or directory in %s on line %d +bool(false) +resource(%d) of type (stream) +Done diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/002.phpt b/phpt/tests/php-5.2.5/ext/bz2/tests/002.phpt new file mode 100644 index 0000000000000..7b9673275c4ba --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bz2/tests/002.phpt @@ -0,0 +1,129 @@ +--TEST-- +bzopen() using fd opened in wrong mode +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +resource(%d) of type (stream) +resource(%d) of type (stream) +resource(%d) of type (stream) + +Warning: bzopen(): cannot read from a stream opened in write only mode in %s on line %d +bool(false) +resource(%d) of type (stream) +resource(%d) of type (stream) + +Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d + +Warning: bzopen(): filename cannot be empty in %s on line %d +bool(false) + +Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d + +Warning: bzopen(): filename cannot be empty in %s on line %d +bool(false) + +Warning: bzopen(): cannot write to a stream opened in read only mode in %s on line %d +bool(false) + +Warning: bzopen(): cannot read from a stream opened in write only mode in %s on line %d +bool(false) + +Warning: bzopen(): cannot use stream opened in mode 'rw' in %s on line %d +bool(false) + +Warning: bzopen(): cannot use stream opened in mode 'rw' in %s on line %d +bool(false) + +Warning: bzopen(): cannot use stream opened in mode 'wr' in %s on line %d +bool(false) + +Warning: bzopen(): cannot use stream opened in mode 'wr' in %s on line %d +bool(false) + +Warning: bzopen(): cannot use stream opened in mode 'r+' in %s on line %d +bool(false) + +Warning: bzopen(): cannot use stream opened in mode 'r+' in %s on line %d +bool(false) + +Warning: bzopen(): cannot use stream opened in mode 'w+' in %s on line %d +bool(false) + +Warning: bzopen(): cannot use stream opened in mode 'w+' in %s on line %d +bool(false) + +Warning: bzopen(): cannot read from a stream opened in write only mode in %s on line %d +bool(false) +resource(%d) of type (stream) +Done diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/003.phpt b/phpt/tests/php-5.2.5/ext/bz2/tests/003.phpt new file mode 100644 index 0000000000000..1432600087a51 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bz2/tests/003.phpt @@ -0,0 +1,40 @@ +--TEST-- +bzread() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +string(0) "" + +Warning: bzread(): length may not be negative in %s on line %d +bool(false) +string(1) "R" +string(2) "is" +string(251) "ing up from the heart of the desert +Rising up for Jerusalem +Rising up from the heat of the desert +Building up Old Jerusalem +Rising up from the heart of the desert +Rising up for Jerusalem +Rising up from the heat of the desert +Heading out for Jerusalem +" +Done diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/003.txt.bz2 b/phpt/tests/php-5.2.5/ext/bz2/tests/003.txt.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..034cd4d8b7c515a7166d0755bad615da85e50c79 GIT binary patch literal 126 zcmV-^0D=EPT4*^jL0KkKS@RmjRR91S*MI;JKmZU>kN_v=-T)u~iUmq)6VWs@8%PyO zXaGGx(SzB}_H*RYl8QLsxl(G{ES<1e{c+Vh6JbLGl1iCGR7j!q>`_$5UXBgShQs1jem=|BAh5ld5vPKfbnKD@c;k- literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/004.phpt b/phpt/tests/php-5.2.5/ext/bz2/tests/004.phpt new file mode 100644 index 0000000000000..a638188bcb477 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bz2/tests/004.phpt @@ -0,0 +1,111 @@ +--TEST-- +bzread() tests with invalid files +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(2) { + ["errno"]=> + int(0) + ["errstr"]=> + string(2) "OK" +} +string(2) "OK" +int(0) +array(2) { + ["errno"]=> + int(0) + ["errstr"]=> + string(2) "OK" +} +string(2) "OK" +int(0) +string(0) "" +array(2) { + ["errno"]=> + int(-5) + ["errstr"]=> + string(16) "DATA_ERROR_MAGIC" +} +string(16) "DATA_ERROR_MAGIC" +int(-5) +string(0) "" +array(2) { + ["errno"]=> + int(-4) + ["errstr"]=> + string(10) "DATA_ERROR" +} +string(10) "DATA_ERROR" +int(-4) +string(0) "" +array(2) { + ["errno"]=> + int(-5) + ["errstr"]=> + string(16) "DATA_ERROR_MAGIC" +} +string(16) "DATA_ERROR_MAGIC" +int(-5) +string(0) "" +array(2) { + ["errno"]=> + int(-4) + ["errstr"]=> + string(10) "DATA_ERROR" +} +string(10) "DATA_ERROR" +int(-4) + +Warning: bzread(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: bzerror(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: bzerrstr(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: bzerrno(): %d is not a valid stream resource in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/004_1.txt.bz2 b/phpt/tests/php-5.2.5/ext/bz2/tests/004_1.txt.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..6a5067b277354765daa8529d2f03297e39e448aa GIT binary patch literal 125 zcmV-@0D}KQIWa+5CR17S8pTxr036qV01!X`5Kxc+C+FS(AOMO5N@^3)G&CDX6-sCT zJwVZe+0OQJi@744C`fsYVyb`&#>X@{ literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/004_2.txt.bz2 b/phpt/tests/php-5.2.5/ext/bz2/tests/004_2.txt.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..9c19f043a4d9a65ef2347f223b9424c0a6825e02 GIT binary patch literal 123 zcmV->0EGWST4*^jL0KkKS@RmjRR91S*MI;JKmZU>kSFKf03ZO01xjiY(KIw0NEJ!| zJwVZe+0OQJ3;1CmOaL{y>m>`_$5UXBgShQs1jem=|BAh5ld5vPKfC_j*GjRX_ literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/005.phpt b/phpt/tests/php-5.2.5/ext/bz2/tests/005.phpt new file mode 100644 index 0000000000000..fc2235d62786f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bz2/tests/005.phpt @@ -0,0 +1,71 @@ +--TEST-- +bzcompress()/bzdecompress() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for bzcompress() in %s on line %d +NULL +string(%d) "BZ%a" +int(-2) +int(-2) +int(-2) +int(-2) + +Warning: bzdecompress() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: bzdecompress() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +int(-5) +int(-5) +int(-5) +bool(false) +string(110) "Life it seems, will fade away +Drifting further everyday +Getting lost within myself +Nothing matters no one else" +bool(false) +string(110) "Life it seems, will fade away +Drifting further everyday +Getting lost within myself +Nothing matters no one else" +string(110) "Life it seems, will fade away +Drifting further everyday +Getting lost within myself +Nothing matters no one else" +Done diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/bz2_filter_compress.phpt b/phpt/tests/php-5.2.5/ext/bz2/tests/bz2_filter_compress.phpt new file mode 100644 index 0000000000000..b3d7b0acf438f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bz2/tests/bz2_filter_compress.phpt @@ -0,0 +1,17 @@ +--TEST-- +bzip2.compress (with convert.base64-encode) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +QlpoNDFBWSZTWRN6QG0AAAoVgECFACA395UgIABIintI1N6mpowIQ0E1MTTAQGYTNcRyMZm5kgW3ib7hVboE7Tmqj3ToGZ5G3q1ZauD2G58hibSck8KS95EEAbx1Cn+LuSKcKEgJvSA2gA== diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/bz2_filter_decompress.phpt b/phpt/tests/php-5.2.5/ext/bz2/tests/bz2_filter_decompress.phpt new file mode 100644 index 0000000000000..f1f38aa8fb7f1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bz2/tests/bz2_filter_decompress.phpt @@ -0,0 +1,17 @@ +--TEST-- +bzip2.decompress (with convert.base64-decode) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +I am the very model of a modern major general, I've information vegetable, animal, and mineral. diff --git a/phpt/tests/php-5.2.5/ext/bz2/tests/with_files.phpt b/phpt/tests/php-5.2.5/ext/bz2/tests/with_files.phpt new file mode 100644 index 0000000000000..4d9e1cd6b947b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/bz2/tests/with_files.phpt @@ -0,0 +1,23 @@ +--TEST-- +BZ2 with files +--SKIPIF-- + +--FILE-- + +--FILE-- + +--FILE-- + +--EXPECT-- +There are 31 days in August 2003 +There are 28 days in February 2003 +There are 29 days in February 2004 +There are 31 days in December 2034 diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/cal_from_jd.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/cal_from_jd.phpt new file mode 100644 index 0000000000000..9614522a05de5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/cal_from_jd.phpt @@ -0,0 +1,60 @@ +--TEST-- +cal_from_jd() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Array +( + [date] => 8/26/74 + [month] => 8 + [day] => 26 + [year] => 74 + [dow] => 0 + [abbrevdayname] => Sun + [dayname] => Sunday + [abbrevmonth] => Aug + [monthname] => August +) +Array +( + [date] => 8/26/74 + [month] => 8 + [day] => 26 + [year] => 74 + [dow] => 5 + [abbrevdayname] => Fri + [dayname] => Friday + [abbrevmonth] => Aug + [monthname] => August +) +Array +( + [date] => 8/26/74 + [month] => 8 + [day] => 26 + [year] => 74 + [dow] => 4 + [abbrevdayname] => Thu + [dayname] => Thursday + [abbrevmonth] => Nisan + [monthname] => Nisan +) +Array +( + [date] => 0/0/0 + [month] => 0 + [day] => 0 + [year] => 0 + [dow] => 1 + [abbrevdayname] => Mon + [dayname] => Monday + [abbrevmonth] => + [monthname] => +) diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/cal_info.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/cal_info.phpt new file mode 100644 index 0000000000000..2e3e612925c07 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/cal_info.phpt @@ -0,0 +1,216 @@ +--TEST-- +cal_info() +--INI-- +date.timezone=UTC +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Array +( + [0] => Array + ( + [months] => Array + ( + [1] => January + [2] => February + [3] => March + [4] => April + [5] => May + [6] => June + [7] => July + [8] => August + [9] => September + [10] => October + [11] => November + [12] => December + ) + + [abbrevmonths] => Array + ( + [1] => Jan + [2] => Feb + [3] => Mar + [4] => Apr + [5] => May + [6] => Jun + [7] => Jul + [8] => Aug + [9] => Sep + [10] => Oct + [11] => Nov + [12] => Dec + ) + + [maxdaysinmonth] => 31 + [calname] => Gregorian + [calsymbol] => CAL_GREGORIAN + ) + + [1] => Array + ( + [months] => Array + ( + [1] => January + [2] => February + [3] => March + [4] => April + [5] => May + [6] => June + [7] => July + [8] => August + [9] => September + [10] => October + [11] => November + [12] => December + ) + + [abbrevmonths] => Array + ( + [1] => Jan + [2] => Feb + [3] => Mar + [4] => Apr + [5] => May + [6] => Jun + [7] => Jul + [8] => Aug + [9] => Sep + [10] => Oct + [11] => Nov + [12] => Dec + ) + + [maxdaysinmonth] => 31 + [calname] => Julian + [calsymbol] => CAL_JULIAN + ) + + [2] => Array + ( + [months] => Array + ( + [1] => Tishri + [2] => Heshvan + [3] => Kislev + [4] => Tevet + [5] => Shevat + [6] => AdarI + [7] => AdarII + [8] => Nisan + [9] => Iyyar + [10] => Sivan + [11] => Tammuz + [12] => Av + [13] => Elul + ) + + [abbrevmonths] => Array + ( + [1] => Tishri + [2] => Heshvan + [3] => Kislev + [4] => Tevet + [5] => Shevat + [6] => AdarI + [7] => AdarII + [8] => Nisan + [9] => Iyyar + [10] => Sivan + [11] => Tammuz + [12] => Av + [13] => Elul + ) + + [maxdaysinmonth] => 30 + [calname] => Jewish + [calsymbol] => CAL_JEWISH + ) + + [3] => Array + ( + [months] => Array + ( + [1] => Vendemiaire + [2] => Brumaire + [3] => Frimaire + [4] => Nivose + [5] => Pluviose + [6] => Ventose + [7] => Germinal + [8] => Floreal + [9] => Prairial + [10] => Messidor + [11] => Thermidor + [12] => Fructidor + [13] => Extra + ) + + [abbrevmonths] => Array + ( + [1] => Vendemiaire + [2] => Brumaire + [3] => Frimaire + [4] => Nivose + [5] => Pluviose + [6] => Ventose + [7] => Germinal + [8] => Floreal + [9] => Prairial + [10] => Messidor + [11] => Thermidor + [12] => Fructidor + [13] => Extra + ) + + [maxdaysinmonth] => 30 + [calname] => French + [calsymbol] => CAL_FRENCH + ) + +) +Array +( + [months] => Array + ( + [1] => January + [2] => February + [3] => March + [4] => April + [5] => May + [6] => June + [7] => July + [8] => August + [9] => September + [10] => October + [11] => November + [12] => December + ) + + [abbrevmonths] => Array + ( + [1] => Jan + [2] => Feb + [3] => Mar + [4] => Apr + [5] => May + [6] => Jun + [7] => Jul + [8] => Aug + [9] => Sep + [10] => Oct + [11] => Nov + [12] => Dec + ) + + [maxdaysinmonth] => 31 + [calname] => Julian + [calsymbol] => CAL_JULIAN +) + +Warning: cal_info(): invalid calendar ID 99999. in %s on line %d diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/cal_to_jd.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/cal_to_jd.phpt new file mode 100644 index 0000000000000..fde1e0b455604 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/cal_to_jd.phpt @@ -0,0 +1,16 @@ +--TEST-- +cal_to_jd() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +1748326 +1748324 +374867 +0 diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/easter_date.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/easter_date.phpt new file mode 100644 index 0000000000000..1adff69293aa1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/easter_date.phpt @@ -0,0 +1,20 @@ +--TEST-- +easter_date() +--INI-- +date.timezone=UTC +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +2000-04-23 +2001-04-15 +2002-03-31 + +Warning: easter_date(): This function is only valid for years between 1970 and 2037 inclusive in %s on line %d +1970-01-01 diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/easter_days.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/easter_days.phpt new file mode 100644 index 0000000000000..04aa7ae11bed6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/easter_days.phpt @@ -0,0 +1,14 @@ +--TEST-- +easter_days() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +14 +32 +2 diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/frenchtojd.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/frenchtojd.phpt new file mode 100644 index 0000000000000..73addb6b80050 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/frenchtojd.phpt @@ -0,0 +1,16 @@ +--TEST-- +frenchtojd() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +0 +0 +2375840 +0 diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/gregoriantojd.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/gregoriantojd.phpt new file mode 100644 index 0000000000000..ec3628e899631 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/gregoriantojd.phpt @@ -0,0 +1,18 @@ +--TEST-- +gregoriantojd() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +0 +2298874 +2299151 +2440588 +2816423 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/jddayofweek.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/jddayofweek.phpt new file mode 100644 index 0000000000000..c33d59892d1dd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/jddayofweek.phpt @@ -0,0 +1,130 @@ +--TEST-- +jddayofweek() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +### JD 2440588 ### +--- mode 0 --- +4 +5 +6 +0 +1 +2 +3 +4 +--- mode 1 --- +Thursday +Friday +Saturday +Sunday +Monday +Tuesday +Wednesday +Thursday +--- mode 2 --- +Thu +Fri +Sat +Sun +Mon +Tue +Wed +Thu +### JD 2452162 ### +--- mode 0 --- +0 +1 +2 +3 +4 +5 +6 +0 +--- mode 1 --- +Sunday +Monday +Tuesday +Wednesday +Thursday +Friday +Saturday +Sunday +--- mode 2 --- +Sun +Mon +Tue +Wed +Thu +Fri +Sat +Sun +### JD 2453926 ### +--- mode 0 --- +0 +1 +2 +3 +4 +5 +6 +0 +--- mode 1 --- +Sunday +Monday +Tuesday +Wednesday +Thursday +Friday +Saturday +Sunday +--- mode 2 --- +Sun +Mon +Tue +Wed +Thu +Fri +Sat +Sun +### JD -1000 ### +--- mode 0 --- +2 +3 +4 +5 +6 +0 +1 +2 +--- mode 1 --- +Tuesday +Wednesday +Thursday +Friday +Saturday +Sunday +Monday +Tuesday +--- mode 2 --- +Tue +Wed +Thu +Fri +Sat +Sun +Mon +Tue + diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/jdmonthname.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/jdmonthname.phpt new file mode 100644 index 0000000000000..d05d3c595efca --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/jdmonthname.phpt @@ -0,0 +1,314 @@ +--TEST-- +jdmonthname() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +### JD 2440588 ### +--- mode 0 --- +Jan +Jan +Mar +Apr +May +May +Jun +Jul +Aug +Sep +Oct +Nov +Dec +--- mode 1 --- +January +January +March +April +May +May +June +July +August +September +October +November +December +--- mode 2 --- +Dec +Jan +Feb +Mar +Apr +May +Jun +Jul +Aug +Sep +Oct +Nov +Dec +--- mode 3 --- +December +January +February +March +April +May +June +July +August +September +October +November +December +--- mode 4 --- +Tevet +Shevat +AdarI +AdarII +Nisan +Iyyar +Sivan +Tammuz +Av +Elul +Tishri +Heshvan +Kislev +--- mode 5 --- + + + + + + + + + + + + + +--- mode 6 --- +Jan +Jan +Mar +Apr +May +May +Jun +Jul +Aug +Sep +Oct +Nov +Dec +### JD 2452162 ### +--- mode 0 --- +Sep +Oct +Nov +Dec +Jan +Feb +Mar +Apr +May +Jun +Jul +Aug +Sep +--- mode 1 --- +September +October +November +December +January +February +March +April +May +June +July +August +September +--- mode 2 --- +Aug +Sep +Oct +Nov +Dec +Jan +Feb +Mar +Apr +May +Jun +Jul +Aug +--- mode 3 --- +August +September +October +November +December +January +February +March +April +May +June +July +August +--- mode 4 --- +Elul +Tishri +Heshvan +Kislev +Tevet +Shevat +AdarI +Nisan +Iyyar +Sivan +Tammuz +Av +Elul +--- mode 5 --- + + + + + + + + + + + + + +--- mode 6 --- +Sep +Oct +Nov +Dec +Jan +Feb +Mar +Apr +May +Jun +Jul +Aug +Sep +### JD 2453926 ### +--- mode 0 --- +Jul +Aug +Sep +Oct +Nov +Dec +Jan +Feb +Mar +Apr +May +Jun +Jul +--- mode 1 --- +July +August +September +October +November +December +January +February +March +April +May +June +July +--- mode 2 --- +Jun +Jul +Aug +Sep +Oct +Nov +Dec +Jan +Feb +Mar +Apr +May +Jun +--- mode 3 --- +June +July +August +September +October +November +December +January +February +March +April +May +June +--- mode 4 --- +Tammuz +Av +Elul +Tishri +Heshvan +Kislev +Tevet +Shevat +AdarI +Nisan +Iyyar +Sivan +Tammuz +--- mode 5 --- + + + + + + + + + + + + + +--- mode 6 --- +Jul +Aug +Sep +Oct +Nov +Dec +Jan +Feb +Mar +Apr +May +Jun +Jul diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/jdtofrench.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtofrench.phpt new file mode 100644 index 0000000000000..27944091e3071 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtofrench.phpt @@ -0,0 +1,20 @@ +--TEST-- +jdtofrench() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +0/0/0 +1/1/1 +1/11/1 +4/11/1 +5/21/2 +0/0/0 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/jdtogregorian.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtogregorian.phpt new file mode 100644 index 0000000000000..6b1956f477a67 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtogregorian.phpt @@ -0,0 +1,18 @@ +--TEST-- +jdtogregorian() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +0/0/0 +1/1/1582 +10/5/1582 +1/1/1970 +1/1/2999 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/jdtojewish.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtojewish.phpt new file mode 100644 index 0000000000000..484b95749cca9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtojewish.phpt @@ -0,0 +1,30 @@ +--TEST-- +jdtojewish() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(184) "2/22/5763 +ëá çùåï äúùñâ +ëá çùåï ä'úùñâ +ëá çùåï ä àìôéí úùñâ +ëá çùåï ä' àìôéí úùñâ +ë"á çùåï äúùñ"â +á' çùåï äúùñ"â +á' çùåï ä'úùñ"â +á' çùåï ä àìôéí úùñ"â +á' çùåï ä' àìôéí úùñ"â +" diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/jdtojulian.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtojulian.phpt new file mode 100644 index 0000000000000..6c87aa7e54a5e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtojulian.phpt @@ -0,0 +1,18 @@ +--TEST-- +jdtojulian() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +0/0/0 +12/22/1581 +9/25/1582 +12/19/1969 +12/12/2998 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/jdtomonthname.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtomonthname.phpt new file mode 100644 index 0000000000000..76d127d6be57f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtomonthname.phpt @@ -0,0 +1,71 @@ +--TEST-- +jdtomonthname() test +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(3) "Jan" +string(7) "January" +string(3) "Jan" +string(7) "January" +string(6) "Shevat" +string(0) "" +string(3) "Jan" +string(7) "January" +string(3) "Dec" +string(8) "December" +string(5) "Tevet" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" + +Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d +bool(false) + +Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d +bool(false) + +Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d +bool(false) + +Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d +bool(false) + +Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d +bool(false) + +Warning: jdmonthname() expects parameter 1 to be long, array given in %s on line %d +bool(false) +string(3) "Dec" +string(8) "December" +string(3) "Jul" +string(4) "July" +string(6) "Tishri" +string(0) "" +Done diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/jdtounix.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtounix.phpt new file mode 100644 index 0000000000000..8d855433003d5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/jdtounix.phpt @@ -0,0 +1,16 @@ +--TEST-- +jdtounix() +--INI-- +date.timezone=UTC +--SKIPIF-- + +--FILE-- + +--EXPECT-- +1970-01-01 +2001-09-09 +2006-07-09 diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/jewishtojd.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/jewishtojd.phpt new file mode 100644 index 0000000000000..a9a2ff0e3dc92 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/jewishtojd.phpt @@ -0,0 +1,16 @@ +--TEST-- +jewishtojd() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +0 +0 +347998 +2452576 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/juliantojd.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/juliantojd.phpt new file mode 100644 index 0000000000000..9563e041a16e2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/juliantojd.phpt @@ -0,0 +1,18 @@ +--TEST-- +juliantojd() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +0 +2298884 +2299161 +2440601 +2816443 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/skipif.inc b/phpt/tests/php-5.2.5/ext/calendar/tests/skipif.inc new file mode 100644 index 0000000000000..de8e4ae9307e3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/skipif.inc @@ -0,0 +1,4 @@ + diff --git a/phpt/tests/php-5.2.5/ext/calendar/tests/unixtojd.phpt b/phpt/tests/php-5.2.5/ext/calendar/tests/unixtojd.phpt new file mode 100644 index 0000000000000..e8e953c3747c7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/calendar/tests/unixtojd.phpt @@ -0,0 +1,14 @@ +--TEST-- +unixtojd() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +2440588 +2452161 +2453926 diff --git a/phpt/tests/php-5.2.5/ext/com_dotnet/tests/27974.phpt b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/27974.phpt new file mode 100755 index 0000000000000..b764e8dd2c6d9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/27974.phpt @@ -0,0 +1,43 @@ +--TEST-- +COM: mapping a safearray +--SKIPIF-- + +--FILE-- +getCode() != DISP_E_BADINDEX) { + throw $e; + } + echo "Got BADINDEX exception OK!\n"; + } + echo "OK!"; +} catch (Exception $e) { + print $e; +} +?> +--EXPECT-- +object(variant)#1 (0) { +} +123 +456 +789 +string(3) "123" +string(5) "hello" +string(3) "789" +Got BADINDEX exception OK! +OK! diff --git a/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug33386.phpt b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug33386.phpt new file mode 100644 index 0000000000000..e57f1274c161a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug33386.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #33386 (ScriptControl only sees last function of class) +--SKIPIF-- + +--FILE-- +Language = "VBScript"; + + $oScript->AddObject ("tfA", $ciTF, true); + foreach (array(1,2) as $i) { + $oScript->ExecuteStatement ("tfA.func$i"); + $oScript->ExecuteStatement ("func$i"); + } + $oScript->AddObject ("tfB", $ciTF); + foreach (array(1,2) as $i) { + $oScript->ExecuteStatement ("tfB.func$i"); + } +} catch (Exception $e) { + print $e; +} +?> +--EXPECT-- + func one + func one + func two + func two + func one + func two diff --git a/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug34272.phpt b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug34272.phpt new file mode 100644 index 0000000000000..3a65e2ce2861d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug34272.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #34272 (empty array onto COM object blows up) +--SKIPIF-- + +--FILE-- +add('foo', array()); + print sizeof($dict['foo'])."\n"; + $dict->add('bar', array(23)); + print sizeof($dict['bar'])." \n"; +} catch (Exception $e) { + print $e; +} +?> +--EXPECT-- +0 +1 diff --git a/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug39596.phpt b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug39596.phpt new file mode 100644 index 0000000000000..dc8d1ef066106 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug39596.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #39596 (Creating Variant of type VT_ARRAY) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +aaa +bbb +ccc diff --git a/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug39606.phpt b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug39606.phpt new file mode 100644 index 0000000000000..07ebef3bd625c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/bug39606.phpt @@ -0,0 +1,22 @@ +--TEST-- +COM: Loading typelib corrupts memory +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +bool(true) +bool(true) +===DONE=== \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/com_dotnet/tests/variants.phpt b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/variants.phpt new file mode 100644 index 0000000000000..a7fce6b80a548 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/com_dotnet/tests/variants.phpt @@ -0,0 +1,637 @@ +--TEST-- +COM: General variant tests +--SKIPIF-- + +--FILE-- + 42, VT_R8 => 3.5, VT_BSTR => "hello", VT_BOOL => false); +$binary_ops = array('add', 'cat', 'sub', 'mul', 'and', 'div', + 'eqv', 'idiv', 'imp', 'mod', 'or', 'pow', 'xor'); + +foreach ($values as $t => $val) { + $v = new VARIANT($val); + if ($t != variant_get_type($v)) { + printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val); + print $v . "\n"; + } + $results = array(); + + foreach ($values as $op2) { + echo "--\n"; + foreach ($binary_ops as $op) { + try { + echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . "\n"; + } catch (com_exception $e) { + echo "$op:\n"; + echo "\tvariant_$op($v, $op2)\n"; + echo "\texception " . $e->getMessage(); + printf("\tcode %08x\n\n", $e->getCode()); + } + } + } +} + +echo "OK!"; +?> +--EXPECT-- +-- +add: 84 +cat: 4242 +sub: 0 +mul: 1764 +and: 42 +div: 1 +eqv: -1 +idiv: 1 +imp: -1 +mod: 0 +or: 42 +pow: 1.50130937545297E+68 +xor: 0 +-- +add: 45.5 +cat: 423.5 +sub: 38.5 +mul: 147 +and: 0 +div: 12 +eqv: -47 +idiv: 10 +imp: -43 +mod: 2 +or: 46 +pow: 480145.116863642 +xor: 46 +-- +add: + variant_add(42, hello) + exception Type mismatch. + code 80020005 + +cat: 42hello +sub: + variant_sub(42, hello) + exception Type mismatch. + code 80020005 + +mul: + variant_mul(42, hello) + exception Type mismatch. + code 80020005 + +and: + variant_and(42, hello) + exception Type mismatch. + code 80020005 + +div: + variant_div(42, hello) + exception Type mismatch. + code 80020005 + +eqv: + variant_eqv(42, hello) + exception Type mismatch. + code 80020005 + +idiv: + variant_idiv(42, hello) + exception Type mismatch. + code 80020005 + +imp: + variant_imp(42, hello) + exception Type mismatch. + code 80020005 + +mod: + variant_mod(42, hello) + exception Type mismatch. + code 80020005 + +or: + variant_or(42, hello) + exception Type mismatch. + code 80020005 + +pow: + variant_pow(42, hello) + exception Type mismatch. + code 80020005 + +xor: + variant_xor(42, hello) + exception Type mismatch. + code 80020005 + +-- +add: 42 +cat: 42False +sub: 42 +mul: 0 +and: 0 +div: + variant_div(42, ) + exception Division by zero. + code 80020012 + +eqv: -43 +idiv: + variant_idiv(42, ) + exception Division by zero. + code 80020012 + +imp: -43 +mod: + variant_mod(42, ) + exception Division by zero. + code 80020012 + +or: 42 +pow: 1 +xor: 42 +-- +add: 45.5 +cat: 3.542 +sub: -38.5 +mul: 147 +and: 0 +div: 8.33333333333333E-02 +eqv: -47 +idiv: 0 +imp: -5 +mod: 4 +or: 46 +pow: 7.09345573078604E+22 +xor: 46 +-- +add: 7 +cat: 3.53.5 +sub: 0 +mul: 12.25 +and: 4 +div: 1 +eqv: -1 +idiv: 1 +imp: -1 +mod: 0 +or: 4 +pow: 80.2117802289664 +xor: 0 +-- +add: + variant_add(3.5, hello) + exception Type mismatch. + code 80020005 + +cat: 3.5hello +sub: + variant_sub(3.5, hello) + exception Type mismatch. + code 80020005 + +mul: + variant_mul(3.5, hello) + exception Type mismatch. + code 80020005 + +and: + variant_and(3.5, hello) + exception Type mismatch. + code 80020005 + +div: + variant_div(3.5, hello) + exception Type mismatch. + code 80020005 + +eqv: + variant_eqv(3.5, hello) + exception Type mismatch. + code 80020005 + +idiv: + variant_idiv(3.5, hello) + exception Type mismatch. + code 80020005 + +imp: + variant_imp(3.5, hello) + exception Type mismatch. + code 80020005 + +mod: + variant_mod(3.5, hello) + exception Type mismatch. + code 80020005 + +or: + variant_or(3.5, hello) + exception Type mismatch. + code 80020005 + +pow: + variant_pow(3.5, hello) + exception Type mismatch. + code 80020005 + +xor: + variant_xor(3.5, hello) + exception Type mismatch. + code 80020005 + +-- +add: 3.5 +cat: 3.5False +sub: 3.5 +mul: 0 +and: 0 +div: + variant_div(3.5, ) + exception Division by zero. + code 80020012 + +eqv: -5 +idiv: + variant_idiv(3.5, ) + exception Division by zero. + code 80020012 + +imp: -5 +mod: + variant_mod(3.5, ) + exception Division by zero. + code 80020012 + +or: 4 +pow: 1 +xor: 4 +-- +add: + variant_add(hello, 42) + exception Type mismatch. + code 80020005 + +cat: hello42 +sub: + variant_sub(hello, 42) + exception Type mismatch. + code 80020005 + +mul: + variant_mul(hello, 42) + exception Type mismatch. + code 80020005 + +and: + variant_and(hello, 42) + exception Type mismatch. + code 80020005 + +div: + variant_div(hello, 42) + exception Type mismatch. + code 80020005 + +eqv: + variant_eqv(hello, 42) + exception Type mismatch. + code 80020005 + +idiv: + variant_idiv(hello, 42) + exception Type mismatch. + code 80020005 + +imp: + variant_imp(hello, 42) + exception Type mismatch. + code 80020005 + +mod: + variant_mod(hello, 42) + exception Type mismatch. + code 80020005 + +or: + variant_or(hello, 42) + exception Type mismatch. + code 80020005 + +pow: + variant_pow(hello, 42) + exception Type mismatch. + code 80020005 + +xor: + variant_xor(hello, 42) + exception Type mismatch. + code 80020005 + +-- +add: + variant_add(hello, 3.5) + exception Type mismatch. + code 80020005 + +cat: hello3.5 +sub: + variant_sub(hello, 3.5) + exception Type mismatch. + code 80020005 + +mul: + variant_mul(hello, 3.5) + exception Type mismatch. + code 80020005 + +and: + variant_and(hello, 3.5) + exception Type mismatch. + code 80020005 + +div: + variant_div(hello, 3.5) + exception Type mismatch. + code 80020005 + +eqv: + variant_eqv(hello, 3.5) + exception Type mismatch. + code 80020005 + +idiv: + variant_idiv(hello, 3.5) + exception Type mismatch. + code 80020005 + +imp: + variant_imp(hello, 3.5) + exception Type mismatch. + code 80020005 + +mod: + variant_mod(hello, 3.5) + exception Type mismatch. + code 80020005 + +or: + variant_or(hello, 3.5) + exception Type mismatch. + code 80020005 + +pow: + variant_pow(hello, 3.5) + exception Type mismatch. + code 80020005 + +xor: + variant_xor(hello, 3.5) + exception Type mismatch. + code 80020005 + +-- +add: hellohello +cat: hellohello +sub: + variant_sub(hello, hello) + exception Type mismatch. + code 80020005 + +mul: + variant_mul(hello, hello) + exception Type mismatch. + code 80020005 + +and: + variant_and(hello, hello) + exception Type mismatch. + code 80020005 + +div: + variant_div(hello, hello) + exception Type mismatch. + code 80020005 + +eqv: + variant_eqv(hello, hello) + exception Type mismatch. + code 80020005 + +idiv: + variant_idiv(hello, hello) + exception Type mismatch. + code 80020005 + +imp: + variant_imp(hello, hello) + exception Type mismatch. + code 80020005 + +mod: + variant_mod(hello, hello) + exception Type mismatch. + code 80020005 + +or: + variant_or(hello, hello) + exception Type mismatch. + code 80020005 + +pow: + variant_pow(hello, hello) + exception Type mismatch. + code 80020005 + +xor: + variant_xor(hello, hello) + exception Type mismatch. + code 80020005 + +-- +add: + variant_add(hello, ) + exception Type mismatch. + code 80020005 + +cat: helloFalse +sub: + variant_sub(hello, ) + exception Type mismatch. + code 80020005 + +mul: + variant_mul(hello, ) + exception Type mismatch. + code 80020005 + +and: + variant_and(hello, ) + exception Type mismatch. + code 80020005 + +div: + variant_div(hello, ) + exception Type mismatch. + code 80020005 + +eqv: + variant_eqv(hello, ) + exception Type mismatch. + code 80020005 + +idiv: + variant_idiv(hello, ) + exception Type mismatch. + code 80020005 + +imp: + variant_imp(hello, ) + exception Type mismatch. + code 80020005 + +mod: + variant_mod(hello, ) + exception Type mismatch. + code 80020005 + +or: + variant_or(hello, ) + exception Type mismatch. + code 80020005 + +pow: + variant_pow(hello, ) + exception Type mismatch. + code 80020005 + +xor: + variant_xor(hello, ) + exception Type mismatch. + code 80020005 + +-- +add: 42 +cat: False42 +sub: -42 +mul: 0 +and: 0 +div: 0 +eqv: -43 +idiv: 0 +imp: -1 +mod: 0 +or: 42 +pow: 0 +xor: 42 +-- +add: 3.5 +cat: False3.5 +sub: -3.5 +mul: 0 +and: 0 +div: 0 +eqv: -5 +idiv: 0 +imp: -1 +mod: 0 +or: 4 +pow: 0 +xor: 4 +-- +add: + variant_add(0, hello) + exception Type mismatch. + code 80020005 + +cat: Falsehello +sub: + variant_sub(0, hello) + exception Type mismatch. + code 80020005 + +mul: + variant_mul(0, hello) + exception Type mismatch. + code 80020005 + +and: + variant_and(0, hello) + exception Type mismatch. + code 80020005 + +div: + variant_div(0, hello) + exception Type mismatch. + code 80020005 + +eqv: + variant_eqv(0, hello) + exception Type mismatch. + code 80020005 + +idiv: + variant_idiv(0, hello) + exception Type mismatch. + code 80020005 + +imp: + variant_imp(0, hello) + exception Type mismatch. + code 80020005 + +mod: + variant_mod(0, hello) + exception Type mismatch. + code 80020005 + +or: + variant_or(0, hello) + exception Type mismatch. + code 80020005 + +pow: + variant_pow(0, hello) + exception Type mismatch. + code 80020005 + +xor: + variant_xor(0, hello) + exception Type mismatch. + code 80020005 + +-- +add: 0 +cat: FalseFalse +sub: 0 +mul: 0 +and: 0 +div: + variant_div(0, ) + exception Out of present range. + code 8002000a + +eqv: -1 +idiv: + variant_idiv(0, ) + exception Division by zero. + code 80020012 + +imp: -1 +mod: + variant_mod(0, ) + exception Division by zero. + code 80020012 + +or: 0 +pow: 1 +xor: 0 +OK! diff --git a/phpt/tests/php-5.2.5/ext/ctype/tests/001.phpt b/phpt/tests/php-5.2.5/ext/ctype/tests/001.phpt new file mode 100644 index 0000000000000..b7beea786134f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/ctype/tests/001.phpt @@ -0,0 +1,39 @@ +--TEST-- +ctype on integers +--SKIPIF-- + +--FILE-- + +--EXPECT-- +ctype_lower 26 +ctype_upper 26 +ctype_alpha 52 +ctype_digit 10 +ctype_alnum 62 +ctype_cntrl 33 +ctype_graph 94 +ctype_print 95 +ctype_punct 32 +ctype_space 6 +ctype_xdigit 22 diff --git a/phpt/tests/php-5.2.5/ext/ctype/tests/002.phpt b/phpt/tests/php-5.2.5/ext/ctype/tests/002.phpt new file mode 100644 index 0000000000000..598ff9be963e0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/ctype/tests/002.phpt @@ -0,0 +1,48 @@ +--TEST-- +ctype on strings +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +LOCALE is '%s' +ctype_lower 26 26 0 +ctype_upper 26 26 0 +ctype_alpha 52 52 0 +ctype_digit 10 10 0 +ctype_alnum 62 62 0 +ctype_cntrl 33 33 0 +ctype_graph 94 94 94 +ctype_print 95 95 95 +ctype_punct 32 32 0 +ctype_space 6 6 0 +ctype_xdigit 22 22 0 diff --git a/phpt/tests/php-5.2.5/ext/ctype/tests/bug25745.phpt b/phpt/tests/php-5.2.5/ext/ctype/tests/bug25745.phpt new file mode 100644 index 0000000000000..74320a865c41a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/ctype/tests/bug25745.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #25745 (ctype functions fail with non-ascii characters) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/ext/ctype/tests/bug34645.phpt b/phpt/tests/php-5.2.5/ext/ctype/tests/bug34645.phpt new file mode 100644 index 0000000000000..8c8e260c2815c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/ctype/tests/bug34645.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #34645 (ctype corrupts memory when validating large numbers) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) +int(394829384) diff --git a/phpt/tests/php-5.2.5/ext/date/tests/002.phpt b/phpt/tests/php-5.2.5/ext/date/tests/002.phpt new file mode 100644 index 0000000000000..7e8e71e4ae5fa --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/002.phpt @@ -0,0 +1,40 @@ + +--EXPECTF-- +string(4) "31st" +string(3) "1st" +string(3) "2nd" +string(3) "3rd" +string(3) "4th" +string(3) "5th" +string(3) "6th" +string(3) "7th" +string(3) "8th" +string(3) "9th" +string(4) "10th" +string(4) "11th" +string(4) "12th" +string(4) "13th" +string(4) "14th" +string(4) "15th" +string(4) "16th" +string(4) "17th" +string(4) "18th" +string(4) "19th" +string(4) "20th" +string(4) "21st" +string(4) "22nd" +string(4) "23rd" +string(4) "24th" +string(4) "25th" +string(4) "26th" +string(4) "27th" +string(4) "28th" +string(4) "29th" +string(4) "30th" +string(4) "31st" +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/004.phpt b/phpt/tests/php-5.2.5/ext/date/tests/004.phpt new file mode 100644 index 0000000000000..33e1fc791072a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/004.phpt @@ -0,0 +1,73 @@ +--TEST-- +date() format params +--FILE-- + +--EXPECTF-- +string(1) "2" +string(3) "177" +string(1) "6" +string(2) "30" +string(1) "0" +string(2) "am" +string(3) "041" +string(2) "12" +string(1) "0" +string(1) "0" +string(10) "1151366400" +string(1) "2" +string(3) "177" +string(1) "6" +string(2) "30" +string(1) "0" +string(2) "am" +string(3) "041" +string(1) "3" +string(1) "3" +string(5) "10800" +string(10) "1151366400" +string(1) "1" +string(3) "176" +string(1) "6" +string(2) "30" +string(1) "0" +string(2) "pm" +string(3) "041" +string(1) "7" +string(2) "19" +string(6) "-18000" +string(10) "1151366400" +string(1) "2" +string(3) "177" +string(1) "6" +string(2) "30" +string(1) "0" +string(2) "am" +string(3) "041" +string(1) "1" +string(1) "1" +string(4) "3600" +string(10) "1151366400" +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/005.phpt b/phpt/tests/php-5.2.5/ext/date/tests/005.phpt new file mode 100644 index 0000000000000..dfc4492af89e3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/005.phpt @@ -0,0 +1,45 @@ +--TEST-- +idate() and invalid params +--INI-- +date.timezone=UTC +--FILE-- + +--EXPECTF-- +Warning: idate() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: idate() expects at most 2 parameters, 3 given in %s on line %d +bool(false) + +Warning: idate(): Unrecognized date format token. in %s on line %d +bool(false) + +Warning: idate(): idate format is one char in %s on line %d +bool(false) + +Warning: idate(): Unrecognized date format token. in %s on line %d +bool(false) +int(41) + +Warning: idate(): Unrecognized date format token. in %s on line %d +bool(false) + +Warning: idate(): Unrecognized date format token. in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/006.phpt b/phpt/tests/php-5.2.5/ext/date/tests/006.phpt new file mode 100644 index 0000000000000..5b3e1b8e6f7ad --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/006.phpt @@ -0,0 +1,33 @@ +--TEST-- +checkdate() tests +--INI-- +date.timezone=UTC +--FILE-- + +--EXPECTF-- +Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d +bool(false) +bool(true) +bool(false) +bool(false) +bool(false) +bool(true) +bool(false) +bool(false) +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/007.phpt b/phpt/tests/php-5.2.5/ext/date/tests/007.phpt new file mode 100644 index 0000000000000..493ee7486dcbd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/007.phpt @@ -0,0 +1,11 @@ + +--EXPECTF-- +Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d +bool(false) +array(11) { + ["seconds"]=> + int(0) + ["minutes"]=> + int(0) + ["hours"]=> + int(0) + ["mday"]=> + int(27) + ["wday"]=> + int(2) + ["mon"]=> + int(6) + ["year"]=> + int(2006) + ["yday"]=> + int(177) + ["weekday"]=> + string(7) "Tuesday" + ["month"]=> + string(4) "June" + [0]=> + int(1151366400) +} +array(11) { + ["seconds"]=> + int(%d) + ["minutes"]=> + int(%d) + ["hours"]=> + int(%d) + ["mday"]=> + int(%d) + ["wday"]=> + int(%d) + ["mon"]=> + int(%d) + ["year"]=> + int(%d) + ["yday"]=> + int(%d) + ["weekday"]=> + string(%d) "%s" + ["month"]=> + string(%d) "%s" + [0]=> + int(%d) +} +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/009.phpt b/phpt/tests/php-5.2.5/ext/date/tests/009.phpt new file mode 100644 index 0000000000000..a5efd48e9f349 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/009.phpt @@ -0,0 +1,21 @@ + +--EXPECTF-- +Warning: timezone_name_from_abbr() expects at least 1 parameter, 0 given in %s on line 3 +bool(false) +string(13) "Europe/Berlin" +bool(false) +bool(false) +string(12) "Europe/Paris" +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/012.phpt b/phpt/tests/php-5.2.5/ext/date/tests/012.phpt new file mode 100644 index 0000000000000..188a8b7cb6e12 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/012.phpt @@ -0,0 +1,32 @@ +format("Y/m/d H:i:s")); +///var_dump(date_isodate_set($dto, 2006)); +var_dump($dto->format("Y/m/d H:i:s")); +var_dump(date_isodate_set($dto, 2006, 5)); +var_dump($dto->format("Y/m/d H:i:s")); +var_dump(date_isodate_set($dto, 2006, 100, 15)); +var_dump($dto->format("Y/m/d H:i:s")); +///var_dump(date_isodate_set($dto, 2006, 100, 15, 10)); +var_dump($dto->format("Y/m/d H:i:s")); + +echo "Done\n"; +?> +--EXPECTF-- +NULL +string(19) "2006/01/23 00:00:00" + +Warning: date_isodate_set() expects at least 3 parameters, 2 given in %s on line %d +bool(false) +string(19) "2006/01/23 00:00:00" +NULL +string(19) "2006/01/30 00:00:00" +NULL +string(19) "2007/12/10 00:00:00" + +Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d +bool(false) +string(19) "2007/12/10 00:00:00" +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/013.phpt b/phpt/tests/php-5.2.5/ext/date/tests/013.phpt new file mode 100644 index 0000000000000..e0b15eae4ca4b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/013.phpt @@ -0,0 +1,38 @@ +--TEST-- +date_date_set() tests +--INI-- +date.timezone=UTC +--FILE-- +format("Y.m.d H:i:s")); +///var_dump(date_date_set()); +var_dump($dto->format("Y.m.d H:i:s")); +///var_dump(date_date_set($dto, 2006, 5)); +var_dump($dto->format("Y.m.d H:i:s")); +var_dump(date_date_set($dto, 2006, 2, 15)); +var_dump($dto->format("Y.m.d H:i:s")); +var_dump(date_date_set($dto, 2006, 24, 60)); +var_dump($dto->format("Y.m.d H:i:s")); + +echo "Done\n"; +?> +--EXPECTF-- +object(DateTime)#%d (0) { +} +string(19) "2006.12.12 00:00:00" + +Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d +bool(false) +string(19) "2006.12.12 00:00:00" + +Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d +bool(false) +string(19) "2006.12.12 00:00:00" +NULL +string(19) "2006.02.15 00:00:00" +NULL +string(19) "2008.01.29 00:00:00" +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/014.phpt b/phpt/tests/php-5.2.5/ext/date/tests/014.phpt new file mode 100644 index 0000000000000..4232048eef6e2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/014.phpt @@ -0,0 +1,33 @@ +--TEST-- +timezone_offset_get() tests +--INI-- +date.timezone=UTC +--FILE-- + +--EXPECTF-- +object(DateTime)#%d (0) { +} +object(DateTimeZone)#%d (0) { +} + +Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d +bool(false) +int(0) + +Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug13142.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug13142.phpt new file mode 100644 index 0000000000000..a72684655120d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug13142.phpt @@ -0,0 +1,11 @@ + +--EXPECT-- +Tue, 04 Sep 2001 16:39:45 -0400 +Tue, 04 Sep 2001 16:39:45 -0400 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug14561.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug14561.phpt new file mode 100644 index 0000000000000..9e4f87c4ee1da --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug14561.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #14561 (strtotime() bug) +--FILE-- + +--EXPECT-- +1134847800 +1134847800 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug17988.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug17988.phpt new file mode 100644 index 0000000000000..d65178e93cf05 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug17988.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #17988 (strtotime handling of postgresql timestamps) +--FILE-- + +--EXPECT-- +2002-06-25 14:18:48 +2002-06-25 14:18:48 +2002-06-25 13:18:48 +2002-06-25 12:18:48 +2002-06-25 18:18:48 +2002-06-25 14:18:48 +2002-06-25 14:18:48 +2002-06-25 18:18:48 +2002-06-25 10:18:48 +2002-06-25 17:18:48 +2002-06-25 11:18:48 +2002-06-25 17:48:48 +2002-06-25 10:48:48 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug20382-1.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug20382-1.phpt new file mode 100644 index 0000000000000..9195c448bea0d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug20382-1.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #20382 [1] (strtotime ("Monday", $date) produces wrong result on DST changeover) +--FILE-- + +--EXPECT-- +tStamp=Wednesday 2004-10-27 17:17:17 CEST +result=Monday 2004-11-01 00:00:00 CET +wanted=Monday 2004-11-01 00:00:00 CET diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug20382-2.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug20382-2.phpt new file mode 100644 index 0000000000000..8778f992442a1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug20382-2.phpt @@ -0,0 +1,170 @@ +--TEST-- +Bug #20382 [2] (strtotime ("Monday", $date) produces wrong result on DST changeover) +--FILE-- + +--EXPECT-- +Europe/Andorra +ts = Monday 2037-10-19 17:17:17 CEST +result = Monday 2037-10-26 00:00:00 CET +wanted = Monday 00:00:00 + +Asia/Dubai +ts = Thursday 1970-01-01 17:17:17 GST +result = Monday 1970-01-05 00:00:00 GST +wanted = Monday 00:00:00 + +Asia/Kabul +ts = Thursday 1970-01-01 17:17:17 AFT +result = Monday 1970-01-05 00:00:00 AFT +wanted = Monday 00:00:00 + +America/Antigua +ts = Thursday 1970-01-01 17:17:17 AST +result = Monday 1970-01-05 00:00:00 AST +wanted = Monday 00:00:00 + +America/Anguilla +ts = Thursday 1970-01-01 17:17:17 AST +result = Monday 1970-01-05 00:00:00 AST +wanted = Monday 00:00:00 + +Europe/Tirane +ts = Monday 1983-04-11 17:17:17 CET +result = Monday 1983-04-18 01:00:00 CEST +wanted = Monday 00:00:00 + +Asia/Yerevan +ts = Monday 2037-10-19 17:17:17 AMST +result = Monday 2037-10-26 00:00:00 AMT +wanted = Monday 00:00:00 + +America/Curacao +ts = Thursday 1970-01-01 17:17:17 AST +result = Monday 1970-01-05 00:00:00 AST +wanted = Monday 00:00:00 + +Africa/Luanda +ts = Thursday 1970-01-01 17:17:17 WAT +result = Monday 1970-01-05 00:00:00 WAT +wanted = Monday 00:00:00 + +Antarctica/McMurdo +ts = Monday 2037-09-28 17:17:17 NZDT +result = Monday 2037-10-05 00:00:00 NZDT +wanted = Monday 00:00:00 + +Australia/Adelaide +ts = Friday 1971-01-01 17:17:17 CST +result = Monday 1971-01-04 00:00:00 CST +wanted = Monday 00:00:00 + +Australia/Darwin +ts = Monday 1971-03-29 17:17:17 CST +result = Monday 1971-04-05 00:00:00 CST +wanted = Monday 00:00:00 + +Australia/Perth +ts = Friday 1971-01-01 17:17:17 WST +result = Monday 1971-01-04 00:00:00 WST +wanted = Monday 00:00:00 + +America/Aruba +ts = Monday 1971-03-29 17:17:17 AST +result = Monday 1971-04-05 00:00:00 AST +wanted = Monday 00:00:00 + +Asia/Baku +ts = Friday 1971-01-01 17:17:17 BAKT +result = Monday 1971-01-04 00:00:00 BAKT +wanted = Monday 00:00:00 + +Europe/Sarajevo +ts = Friday 1971-01-01 17:17:17 CET +result = Monday 1971-01-04 00:00:00 CET +wanted = Monday 00:00:00 + +America/Barbados +ts = Friday 1971-01-01 17:17:17 AST +result = Monday 1971-01-04 00:00:00 AST +wanted = Monday 00:00:00 + +Asia/Dacca +ts = Friday 1971-01-01 17:17:17 DACT +result = Monday 1971-01-04 00:00:00 DACT +wanted = Monday 00:00:00 + +Europe/Brussels +ts = Friday 1971-01-01 17:17:17 CET +result = Monday 1971-01-04 00:00:00 CET +wanted = Monday 00:00:00 + +Africa/Ouagadougou +ts = Monday 1971-03-29 17:17:17 GMT +result = Monday 1971-04-05 00:00:00 GMT +wanted = Monday 00:00:00 + +Europe/Tirane +ts = Monday 1983-04-11 17:17:17 CET +result = Monday 1983-04-18 01:00:00 CEST +wanted = Monday 00:00:00 + +America/Buenos_Aires +ts = Monday 1974-09-30 17:17:17 ART +result = Monday 1974-10-07 00:00:00 ART +wanted = Monday 00:00:00 + +America/Rosario +ts = Monday 1974-09-30 17:17:17 ART +result = Monday 1974-10-07 00:00:00 ART +wanted = Monday 00:00:00 + +Europe/Vienna +ts = Monday 1980-03-31 17:17:17 CET +result = Monday 1980-04-07 00:00:00 CEST +wanted = Monday 00:00:00 + +Asia/Baku +ts = Monday 1995-12-25 17:17:17 AZT +result = Monday 1996-01-01 00:00:00 AZT +wanted = Monday 00:00:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug21399.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug21399.phpt new file mode 100644 index 0000000000000..b05d4da62e01a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug21399.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #21399 (strtotime() request for "YYYYMMDDhhmmss [ZZZ]") +--FILE-- + +--EXPECT-- +2005-06-20 09:14:07 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug21966.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug21966.phpt new file mode 100644 index 0000000000000..06bc659452b09 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug21966.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #21966 (date() or mktime() returning bad value for mktime month param of '2') +--FILE-- + +--EXPECT-- +27/3/04 = 1080345600 +28/3/04 = 1080432000 +28/3/04 = 1080435600 +29/3/04 = 1080514800 +30/3/04 = 1080601200 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug26090.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug26090.phpt new file mode 100644 index 0000000000000..eac99a0b52947 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug26090.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #26090 (allow colons in time zone offset to strtotime()) +--FILE-- + +--EXPECT-- +2003-10-28 13:20:30 EST +2003-10-28 13:20:30 EST diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug26198.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug26198.phpt new file mode 100644 index 0000000000000..c957bfcf7a9b9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug26198.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #26198 (strtotime handling of "M Y" and "Y M" format) +--FILE-- + +--EXPECT-- +October 2001 (2001-10-01 00:00:00 GMT) +Oct 2001 (2001-10-01 00:00:00 GMT) diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug26317.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug26317.phpt new file mode 100644 index 0000000000000..db182c4c868cb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug26317.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #26317 (military timezone offset signedness) +--FILE-- + +--EXPECT-- +2003-11-19 16:20:42 +2003-11-19 16:20:42 +2003-11-19 16:20:42 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug26320.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug26320.phpt new file mode 100644 index 0000000000000..dc2fbfdb1edbb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug26320.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #26320 (strtotime handling of XML Schema/ISO 8601 format) +--FILE-- + +--EXPECT-- +2003-11-19 12:30:42 +2003-11-19 12:30:42 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug26694.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug26694.phpt new file mode 100644 index 0000000000000..a7842c4dd5a8f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug26694.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #26694 (strtotime() request for "Sun, 21 Dec 2003 20:38:33 +0000 GMT") +--FILE-- + +--EXPECT-- +2003-12-21 20:38:33 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug27719.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug27719.phpt new file mode 100644 index 0000000000000..e4be32070819d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug27719.phpt @@ -0,0 +1,67 @@ +--TEST-- +Bug #27719 (mktime returns incorrect timestamp for dst days) +--INI-- +error_reporting=2047 +--FILE-- + +--EXPECTF-- +1081054800 04/04/04 12:00:00 +%s +1081054800 04/04/04 12:00:00 + +1075870800 02/04/04 12:00:00 +1075867200 02/03/04 11:00:00 +1075870800 02/04/04 12:00:00 + +1081054800 04/04/04 12:00:00 +1081051200 04/03/04 11:00:00 +1081054800 04/04/04 12:00:00 + +1081065600 04/04/04 04:00:00 +1081062000 04/04/04 03:00:00 +1081062000 04/04/04 03:00:00 + +1086325200 06/04/04 01:00:00 +1086321600 06/04/04 12:00:00 +1086321600 06/04/04 12:00:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug27780.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug27780.phpt new file mode 100644 index 0000000000000..222e87d01089c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug27780.phpt @@ -0,0 +1,113 @@ +--TEST-- +Bug #27780 (strtotime(+1 xxx) returns a wrong date/time) +--FILE-- + +--EXPECT-- +America/Chicago +1076824799 [2004-02-14 23:59:59 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds] +1076824800 [2004-02-15 00:00:00 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds] +1076824801 [2004-02-15 00:00:01 CST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds] +1079503200 [2004-03-17 00:00:00 CST] [2004-04-07 00:00:00 -21 days] +1080367200 [2004-03-27 00:00:00 CST] [2004-04-07 00:00:00 11 days ago] +1080460800 [2004-03-28 02:00:00 CST] [2004-04-07 00:00:00 -10 day +2 hours] +1081227600 [2004-04-06 00:00:00 CDT] [2004-04-07 00:00:00 -1 day] +1081314000 [2004-04-07 00:00:00 CDT] [2004-04-07 00:00:00] +1081317600 [2004-04-07 01:00:00 CDT] [2004-04-07 00:00:00 +1 hour] +1081321200 [2004-04-07 02:00:00 CDT] [2004-04-07 00:00:00 +2 hour] +1081400400 [2004-04-08 00:00:00 CDT] [2004-04-07 00:00:00 +1 day] +1081400400 [2004-04-08 00:00:00 CDT] [2004-04-07 00:00:00 1 day] +1083128400 [2004-04-28 00:00:00 CDT] [2004-04-07 00:00:00 +21 days] + +Europe/Amsterdam +1076799599 [2004-02-14 23:59:59 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds] +1076799600 [2004-02-15 00:00:00 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds] +1076799601 [2004-02-15 00:00:01 CET] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds] +1079478000 [2004-03-17 00:00:00 CET] [2004-04-07 00:00:00 -21 days] +1080342000 [2004-03-27 00:00:00 CET] [2004-04-07 00:00:00 11 days ago] +1080435600 [2004-03-28 03:00:00 CEST] [2004-04-07 00:00:00 -10 day +2 hours] +1081202400 [2004-04-06 00:00:00 CEST] [2004-04-07 00:00:00 -1 day] +1081288800 [2004-04-07 00:00:00 CEST] [2004-04-07 00:00:00] +1081292400 [2004-04-07 01:00:00 CEST] [2004-04-07 00:00:00 +1 hour] +1081296000 [2004-04-07 02:00:00 CEST] [2004-04-07 00:00:00 +2 hour] +1081375200 [2004-04-08 00:00:00 CEST] [2004-04-07 00:00:00 +1 day] +1081375200 [2004-04-08 00:00:00 CEST] [2004-04-07 00:00:00 1 day] +1083103200 [2004-04-28 00:00:00 CEST] [2004-04-07 00:00:00 +21 days] + +Asia/Jerusalem +1076795999 [2004-02-14 23:59:59 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds] +1076796000 [2004-02-15 00:00:00 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds] +1076796001 [2004-02-15 00:00:01 IST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds] +1079474400 [2004-03-17 00:00:00 IST] [2004-04-07 00:00:00 -21 days] +1080338400 [2004-03-27 00:00:00 IST] [2004-04-07 00:00:00 11 days ago] +1080432000 [2004-03-28 02:00:00 IST] [2004-04-07 00:00:00 -10 day +2 hours] +1081202400 [2004-04-06 00:00:00 IST] [2004-04-07 00:00:00 -1 day] +1081288800 [2004-04-07 00:00:00 IST] [2004-04-07 00:00:00] +1081292400 [2004-04-07 02:00:00 IDT] [2004-04-07 00:00:00 +1 hour] +1081292400 [2004-04-07 02:00:00 IDT] [2004-04-07 00:00:00 +2 hour] +1081371600 [2004-04-08 00:00:00 IDT] [2004-04-07 00:00:00 +1 day] +1081371600 [2004-04-08 00:00:00 IDT] [2004-04-07 00:00:00 1 day] +1083099600 [2004-04-28 00:00:00 IDT] [2004-04-07 00:00:00 +21 days] + +Asia/Singapore +1076774399 [2004-02-14 23:59:59 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds] +1076774400 [2004-02-15 00:00:00 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds] +1076774401 [2004-02-15 00:00:01 SGT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds] +1079452800 [2004-03-17 00:00:00 SGT] [2004-04-07 00:00:00 -21 days] +1080316800 [2004-03-27 00:00:00 SGT] [2004-04-07 00:00:00 11 days ago] +1080410400 [2004-03-28 02:00:00 SGT] [2004-04-07 00:00:00 -10 day +2 hours] +1081180800 [2004-04-06 00:00:00 SGT] [2004-04-07 00:00:00 -1 day] +1081267200 [2004-04-07 00:00:00 SGT] [2004-04-07 00:00:00] +1081270800 [2004-04-07 01:00:00 SGT] [2004-04-07 00:00:00 +1 hour] +1081274400 [2004-04-07 02:00:00 SGT] [2004-04-07 00:00:00 +2 hour] +1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 +1 day] +1081353600 [2004-04-08 00:00:00 SGT] [2004-04-07 00:00:00 1 day] +1083081600 [2004-04-28 00:00:00 SGT] [2004-04-07 00:00:00 +21 days] + +America/Sao_Paulo +1076810399 [2004-02-14 23:59:59 BRST] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds] +1076814000 [2004-02-15 00:00:00 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds] +1076814001 [2004-02-15 00:00:01 BRT] [2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds] +1079492400 [2004-03-17 00:00:00 BRT] [2004-04-07 00:00:00 -21 days] +1080356400 [2004-03-27 00:00:00 BRT] [2004-04-07 00:00:00 11 days ago] +1080450000 [2004-03-28 02:00:00 BRT] [2004-04-07 00:00:00 -10 day +2 hours] +1081220400 [2004-04-06 00:00:00 BRT] [2004-04-07 00:00:00 -1 day] +1081306800 [2004-04-07 00:00:00 BRT] [2004-04-07 00:00:00] +1081310400 [2004-04-07 01:00:00 BRT] [2004-04-07 00:00:00 +1 hour] +1081314000 [2004-04-07 02:00:00 BRT] [2004-04-07 00:00:00 +2 hour] +1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 +1 day] +1081393200 [2004-04-08 00:00:00 BRT] [2004-04-07 00:00:00 1 day] +1083121200 [2004-04-28 00:00:00 BRT] [2004-04-07 00:00:00 +21 days] diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug28024.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug28024.phpt new file mode 100644 index 0000000000000..42d68c2adf9a8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug28024.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #28024 (Changed behavior of strtotime()) +--FILE-- + +--EXPECT-- +1072972800 +2004-01-01 17:00:00 CET diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug28088.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug28088.phpt new file mode 100644 index 0000000000000..080260a7fb1d1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug28088.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #28088 (strtotime() cannot convert 00 hours") +--FILE-- + +--EXPECT-- +The following line rightly shows the correct date time: +04/04/04 2345 +But the following line fails to show the correct date time: +04/04/04 0045 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug28599.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug28599.phpt new file mode 100644 index 0000000000000..fcd17b46972fb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug28599.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #28599 (strtotime fails with zero base time) +--FILE-- + +--EXPECT-- +15-11-2004 16:49:33 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug29150.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug29150.phpt new file mode 100644 index 0000000000000..ede76a7fe06e6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug29150.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #29150 (Roman number format for months) +--FILE-- + +--EXPECT-- +2005-06-20 00:00:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug29585.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug29585.phpt new file mode 100644 index 0000000000000..394569924662b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug29585.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #29585 (Support week numbers in strtotime()) +--FILE-- + +--EXPECT-- +2004-07-19 00:00:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug29595.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug29595.phpt new file mode 100644 index 0000000000000..285ade140b348 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug29595.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #29595 (Roman number format for months) +--FILE-- + +--EXPECT-- +1092026907 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug30096.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug30096.phpt new file mode 100644 index 0000000000000..fa4f716ee650b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug30096.phpt @@ -0,0 +1,48 @@ +--TEST-- +Bug #30096 (gmmktime does not return the corrent time) +--INI-- +error_reporting=2047 +--FILE-- + dst\n"; +$ts = -1; +gm_date_check(01,00,00,03,27,2005); +gm_date_check(02,00,00,03,27,2005); +gm_date_check(03,00,00,03,27,2005); +gm_date_check(04,00,00,03,27,2005); + +echo "\ndst --> no dst\n"; +$ts = -1; +gm_date_check(01,00,00,10,30,2005); +gm_date_check(02,00,00,10,30,2005); +gm_date_check(03,00,00,10,30,2005); +gm_date_check(04,00,00,10,30,2005); + +function gm_date_check($hour, $minute, $second, $month, $day, $year) { + global $ts, $tsold; + + echo "gmmktime($hour,$minute,$second,$month,$day,$year): "; + + $tsold = $ts; + $ts = gmmktime($hour, $minute, $second, $month, $day, $year); + + echo $ts, " | gmdate('r', $ts):", gmdate('r', $ts); + if ($tsold > 0) { + echo " | Diff: " . ($ts - $tsold); + } + echo "\n"; +} + +?> +--EXPECT-- +no dst --> dst +gmmktime(1,0,0,3,27,2005): 1111885200 | gmdate('r', 1111885200):Sun, 27 Mar 2005 01:00:00 +0000 +gmmktime(2,0,0,3,27,2005): 1111888800 | gmdate('r', 1111888800):Sun, 27 Mar 2005 02:00:00 +0000 | Diff: 3600 +gmmktime(3,0,0,3,27,2005): 1111892400 | gmdate('r', 1111892400):Sun, 27 Mar 2005 03:00:00 +0000 | Diff: 3600 +gmmktime(4,0,0,3,27,2005): 1111896000 | gmdate('r', 1111896000):Sun, 27 Mar 2005 04:00:00 +0000 | Diff: 3600 + +dst --> no dst +gmmktime(1,0,0,10,30,2005): 1130634000 | gmdate('r', 1130634000):Sun, 30 Oct 2005 01:00:00 +0000 +gmmktime(2,0,0,10,30,2005): 1130637600 | gmdate('r', 1130637600):Sun, 30 Oct 2005 02:00:00 +0000 | Diff: 3600 +gmmktime(3,0,0,10,30,2005): 1130641200 | gmdate('r', 1130641200):Sun, 30 Oct 2005 03:00:00 +0000 | Diff: 3600 +gmmktime(4,0,0,10,30,2005): 1130644800 | gmdate('r', 1130644800):Sun, 30 Oct 2005 04:00:00 +0000 | Diff: 3600 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug30532.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug30532.phpt new file mode 100644 index 0000000000000..598ecfa2cd516 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug30532.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #30532 (strtotime - crossing daylight savings time) +--FILE-- + +--EXPECT-- +2004-10-31 01:00:00 EDT +2004-10-31 01:00:00 EST +2004-10-31 02:00:00 EST + +2004-10-31 01:00:00 EDT +2004-10-31 02:00:00 EST +2004-10-31 03:00:00 EST diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug32086.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug32086.phpt new file mode 100644 index 0000000000000..393c995f83cc5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug32086.phpt @@ -0,0 +1,49 @@ +--TEST-- +Bug #32086 (strtotime don't work in DST) +--FILE-- + +--EXPECT-- +1099278000 +1099364400 +1099364400 +1099364400 +1099447200 +2004-11-01 00:00:00 BRT +2004-11-02 01:00:00 BRST +2004-11-02 01:00:00 BRST +2004-11-02 01:00:00 BRST +2004-11-03 00:00:00 BRST +1108778400 +1108868400 +1108868400 +1108868400 +1108954800 +2005-02-19 00:00:00 BRST +2005-02-20 00:00:00 BRT +2005-02-20 00:00:00 BRT +2005-02-20 00:00:00 BRT +2005-02-21 00:00:00 BRT diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug32270.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug32270.phpt new file mode 100644 index 0000000000000..1a83a5dfe35e9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug32270.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #32270 (strtotime/date behavior) +--FILE-- + +--EXPECT-- +01/01/1902 00:00:00 PST +-2145888000 +01/01/1950 00:00:00 PST +-631123200 +01/01/2000 00:00:00 PST +946713600 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug32555.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug32555.phpt new file mode 100644 index 0000000000000..7271c627c3c75 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug32555.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #32555 (strtotime("tomorrow") can return false) +--FILE-- + +--EXPECT-- +Sat Apr 2 02:30:00 2005 EST +Sun Apr 3 00:00:00 2005 EST +Sun Apr 3 03:30:00 2005 EDT +Mon Apr 4 02:30:00 2005 EDT diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug32588.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug32588.phpt new file mode 100644 index 0000000000000..110161f4894e2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug32588.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #32588 (strtotime() error for 'last xxx' DST problem) +--FILE-- + +--EXPECT-- +1116406800 +1116407554 +1116443554 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33414-1.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33414-1.phpt new file mode 100644 index 0000000000000..f48d4abf25a3c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33414-1.phpt @@ -0,0 +1,320 @@ +--TEST-- +Bug #33414 [1] (Comprehensive list of incorrect days returned after strotime() / date() tests) +--FILE-- + +--EXPECT-- +TZ=America/Mendoza - wrong day. +tStamp=Sunday 1992-10-18 17:17:17 ARST 1 +result=Sunday 1992-10-25 00:00:00 ARST 1 +wanted=Sunday 00:00:00 + +TZ=America/Catamarca - wrong day. +tStamp=Sunday 1990-10-21 17:17:17 ARST 1 +result=Sunday 1990-10-28 00:00:00 ARST 1 +wanted=Sunday 00:00:00 + +TZ=America/Cordoba - wrong day. +tStamp=Sunday 1990-10-21 17:17:17 ARST 1 +result=Sunday 1990-10-28 00:00:00 ARST 1 +wanted=Sunday 00:00:00 + +TZ=America/Rosario - wrong day. +tStamp=Tuesday 1991-10-15 17:17:17 WART 0 +result=Tuesday 1991-10-22 00:00:00 ARST 1 +wanted=Tuesday 00:00:00 + +TZ=Europe/Vienna - wrong day - giving unexpected results, at +least on my system :-) +tStamp=Thursday 1980-04-03 17:17:17 CET 0 +result=Thursday 1980-04-10 00:00:00 CEST 1 +wanted=Thursday 00:00:00 + +TZ=Asia/Baku - wrong day. +tStamp=Sunday 1992-09-20 17:17:17 AZST 1 +result=Sunday 1992-09-27 00:00:00 AZT 0 +wanted=Sunday 00:00:00 + +TZ=America/Noronha - wrong day. +tStamp=Friday 1999-10-01 17:17:17 FNT 0 +result=Friday 1999-10-08 00:00:00 FNST 1 +wanted=Friday 00:00:00 + +TZ=America/Havana - wrong day. +tStamp=Thursday 2004-10-28 17:17:17 CDT 1 +result=Thursday 2004-11-04 00:00:00 CDT 1 +wanted=Thursday 00:00:00 + +TZ=Europe/Tallinn - wrong day. +tStamp=Saturday 2002-03-30 17:17:17 EET 0 +result=Saturday 2002-04-06 00:00:00 EEST 1 +wanted=Saturday 00:00:00 + +TZ=Asia/Jerusalem - wrong day. +tStamp=Thursday 2005-09-29 17:17:17 IDT 1 +result=Thursday 2005-10-06 00:00:00 IDT 1 +wanted=Thursday 00:00:00 + +TZ=Europe/Vilnius - wrong day. +tStamp=Friday 2003-03-28 17:17:17 EET 0 +result=Friday 2003-04-04 00:00:00 EEST 1 +wanted=Friday 00:00:00 + +TZ=Pacific/Kwajalein - wrong day. +tStamp=Friday 1993-08-13 17:17:17 KWAT 0 +result=Saturday 1993-08-21 00:00:00 MHT 0 +wanted=Friday 00:00:00 + +TZ=Asia/Ulan_Bator - wrong day. +tStamp=Saturday 2001-09-22 17:17:17 ULAST 1 +result=Saturday 2001-09-29 00:00:00 ULAST 1 +wanted=Saturday 00:00:00 + +TZ=America/Cancun - wrong day. +tStamp=Sunday 2002-04-07 17:17:17 CDT 1 +result=Sunday 2002-04-14 00:00:00 CDT 1 +wanted=Sunday 00:00:00 + +TZ=America/Mexico_City - wrong day. +tStamp=Wednesday 2002-04-03 17:17:17 CST 0 +result=Wednesday 2002-04-10 00:00:00 CDT 1 +wanted=Wednesday 00:00:00 + +TZ=America/Mazatlan - wrong day. +tStamp=Tuesday 2002-04-02 17:17:17 MST 0 +result=Tuesday 2002-04-09 00:00:00 MDT 1 +wanted=Tuesday 00:00:00 + +TZ=America/Chihuahua - wrong day. +tStamp=Thursday 2002-04-04 17:17:17 MST 0 +result=Thursday 2002-04-11 00:00:00 MDT 1 +wanted=Thursday 00:00:00 + +TZ=Asia/Kuala_Lumpur - wrong day. +tStamp=Monday 1981-12-28 17:17:17 MALT 0 +result=Monday 1982-01-04 00:00:00 MYT 0 +wanted=Monday 00:00:00 + +TZ=Pacific/Chatham - wrong day. +tStamp=Monday 1974-10-28 17:17:17 CHAST 0 +result=Monday 1974-11-04 00:00:00 CHADT 1 +wanted=Monday 00:00:00 + +TZ=America/Lima - wrong day. +tStamp=Thursday 1985-12-26 17:17:17 PET 0 +result=Thursday 1986-01-02 00:00:00 PEST 1 +wanted=Thursday 00:00:00 + +TZ=Asia/Karachi - wrong day. +tStamp=Friday 2002-04-05 17:17:17 PKT 0 +result=Friday 2002-04-12 00:00:00 PKST 1 +wanted=Friday 00:00:00 + +TZ=America/Asuncion - wrong day. +tStamp=Wednesday 2002-02-27 17:17:17 PYST 1 +result=Wednesday 2002-03-06 00:00:00 PYST 1 +wanted=Wednesday 00:00:00 + +TZ=Asia/Singapore - wrong day. +tStamp=Thursday 1981-12-31 17:17:17 SGT 0 +result=Thursday 1982-01-07 00:00:00 SGT 0 +wanted=Thursday 00:00:00 + +TZ=America/Montevideo - wrong day. +tStamp=Thursday 2004-09-16 17:17:17 UYT 0 +result=Thursday 2004-09-23 00:00:00 UYST 1 +wanted=Thursday 00:00:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33414-2.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33414-2.phpt new file mode 100644 index 0000000000000..082b5e497dbcd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33414-2.phpt @@ -0,0 +1,121 @@ +--TEST-- +Bug #33414 [2] (Comprehensive list of incorrect days returned after strotime() / date() tests) +--FILE-- + +--EXPECT-- +TZ=Pacific/Rarotonga - wrong day. +tStamp=Thursday 1970-01-01 17:17:17 CKT 0 +result=Tuesday 1970-01-06 00:00:00 CKT 0 +wanted=Tuesday 00:00:00 + +TZ=Atlantic/South_Georgia - wrong day. +tStamp=Thursday 1970-01-01 17:17:17 GST 0 +result=Tuesday 1970-01-06 00:00:00 GST 0 +wanted=Tuesday 00:00:00 + +TZ=America/Port-au-Prince - wrong day. +tStamp=Monday 2005-03-28 17:17:17 EST 0 +result=Monday 2005-04-04 00:00:00 EDT 1 +wanted=Monday 00:00:00 + +TZ=Pacific/Enderbury - wrong day, off by 2 days. +tStamp=Thursday 1970-01-01 17:17:17 PHOT 0 +result=Monday 1970-01-05 00:00:00 PHOT 0 +wanted=Monday 00:00:00 + +TZ=Pacific/Kiritimati - wrong day, off by 2 days. +tStamp=Thursday 1970-01-01 17:17:17 LINT 0 +result=Monday 1970-01-05 00:00:00 LINT 0 +wanted=Monday 00:00:00 + +TZ=America/Managua - wrong day. +tStamp=Tuesday 2005-04-05 17:17:17 CST 0 +result=Tuesday 2005-04-12 00:00:00 CDT 1 +wanted=Tuesday 00:00:00 + +TZ=Pacific/Pitcairn - wrong day. +tStamp=Thursday 1970-01-01 17:17:17 PNT 0 +result=Wednesday 1970-01-07 00:00:00 PNT 0 +wanted=Wednesday 00:00:00 + +TZ=Pacific/Fakaofo - wrong day. +tStamp=Thursday 1970-01-01 17:17:17 TKT 0 +result=Saturday 1970-01-03 00:00:00 TKT 0 +wanted=Saturday 00:00:00 + +TZ=Pacific/Johnston - wrong day. +tStamp=Thursday 1970-01-01 17:17:17 HST 0 +result=Friday 1970-01-02 00:00:00 HST 0 +wanted=Friday 00:00:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33415-1.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33415-1.phpt new file mode 100644 index 0000000000000..65f9374c2795a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33415-1.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #33415 [1] (Possibly invalid non-one-hour DST or timezone shifts) +--FILE-- + +--EXPECT-- +TZ=America/Jujuy - Is it OK for this to be 2 AM, rather than 1 +AM as per most DST transitions? +tStamp=Monday 1990-10-15 17:17:17 WART 0 +result=Monday 1990-10-22 00:00:00 WART 0 +wanted=Monday 00:00:00 + +TZ=Asia/Tbilisi - Is it OK for this to be 2 AM? +tStamp=Sunday 2005-03-20 17:17:17 GET 0 +result=Sunday 2005-03-27 00:00:00 GET 0 +wanted=Sunday 00:00:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33415-2.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33415-2.phpt new file mode 100644 index 0000000000000..2a3b1d2287a39 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33415-2.phpt @@ -0,0 +1,342 @@ +--TEST-- +Bug #33415 [2] (Possibly invalid non-one-hour DST or timezone shifts) +--FILE-- + +--EXPECT-- +TZ=Africa/Bujumbura - *Note*: Unexpected, as does not appear to +have a DST or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 CAT 0 +result=Wednesday 1970-01-07 00:00:00 CAT 0 +wanted=Wednesday 00:00:00 + +TZ=Asia/Thimbu - Is it OK for this to be 0:30 AM? yes +tStamp=Thursday 1987-09-24 17:17:17 IST 0 +result=Thursday 1987-10-01 00:30:00 BTT 0 +wanted=Thursday 00:30:00 + +TZ=Indian/Cocos - Is it OK for this to be 6:30 AM? Note: does not +appear to have a DST or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 CCT 0 +result=Thursday 1970-01-08 00:00:00 CCT 0 +wanted=Thursday 00:00:00 + +TZ=Africa/Lubumbashi - Is it OK for this to be 2 AM? Note: does +not appear to have a DST or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 CAT 0 +result=Saturday 1970-01-03 00:00:00 CAT 0 +wanted=Saturday 00:00:00 + +TZ=Asia/Kashgar - Is it OK for this to be 3 AM? yes +tStamp=Thursday 1980-04-24 17:17:17 KAST 0 +result=Thursday 1980-05-01 03:00:00 CST 0 +wanted=Thursday 03:00:00 + +TZ=Indian/Christmas - Is it OK for this to be 7 AM? Note: does +not appear to have a DST or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 CXT 0 +result=Sunday 1970-01-04 00:00:00 CXT 0 +wanted=Sunday 00:00:00 + +TZ=America/Santo_Domingo - Is it OK for this to be 0:30 AM? yes +tStamp=Sunday 1970-10-18 17:17:17 EST 0 +result=Sunday 1970-10-25 00:30:00 EHDT 1 +wanted=Sunday 00:30:00 + +TZ=Pacific/Truk - Is it OK for this to be 10 AM? Note: does not +appear to have a DST or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 TRUT 0 +result=Tuesday 1970-01-06 00:00:00 TRUT 0 +wanted=Tuesday 00:00:00 + +TZ=Pacific/Ponape - Is it OK for this to be 11 AM? Note: does +not appear to have a DST or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 PONT 0 +result=Monday 1970-01-05 00:00:00 PONT 0 +wanted=Monday 00:00:00 + +TZ=America/Scoresbysund - Is it OK for this to be 2 AM? yes +tStamp=Sunday 1981-03-22 17:17:17 CGT 0 +result=Sunday 1981-03-29 02:00:00 EGST 1 +wanted=Sunday 02:00:00 + +TZ=America/Guyana - Is it OK for this to be 0:45 AM? yes +tStamp=Thursday 1975-07-24 17:17:17 GYT 0 +result=Thursday 1975-07-31 00:45:00 GYT 0 +wanted=Thursday 00:45:00 + +TZ=Asia/Tehran - Is it OK for this to be 0:30 AM? yes +tStamp=Tuesday 1977-10-25 17:17:17 IRST 0 +result=Tuesday 1977-11-01 00:30:00 IRST 0 +wanted=Tuesday 00:30:00 + +TZ=Pacific/Tarawa - Is it OK for this to be Midday? Note: does +not appear to have a DST or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 GILT 0 +result=Monday 1970-01-05 00:00:00 GILT 0 +wanted=Monday 00:00:00 + +TZ=Africa/Monrovia - Is it OK for this to be 00:44:30 AM? yes +tStamp=Monday 1972-04-24 17:17:17 LRT 0 +result=Monday 1972-05-01 00:44:30 GMT 0 +wanted=Monday 00:44:30 + +TZ=Asia/Katmandu - Is it OK for this to 0:15 AM?. yes +tStamp=Wednesday 1985-12-25 17:17:17 IST 0 +result=Wednesday 1986-01-01 00:15:00 NPT 0 +wanted=Wednesday 00:15:00 + +TZ=Pacific/Nauru - Is it OK for this to be 0:30? yes +tStamp=Tuesday 1979-04-24 17:17:17 NRT 0 +result=Tuesday 1979-05-01 00:30:00 NRT 0 +wanted=Tuesday 00:30:00 + +TZ=Pacific/Niue - Is it OK for this to be 0:30 AM? yes +tStamp=Sunday 1978-09-24 17:17:17 NUT 0 +result=Sunday 1978-10-01 00:30:00 NUT 0 +wanted=Sunday 00:30:00 + +TZ=Pacific/Port_Moresby - Is it OK for this to be 10 AM? No DST +or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 PGT 0 +result=Thursday 1970-01-08 00:00:00 PGT 0 +wanted=Thursday 00:00:00 + +TZ=America/Miquelon - Is it OK for this to be 1 AM ? yes +tStamp=Thursday 1980-04-24 17:17:17 AST 0 +result=Thursday 1980-05-01 01:00:00 PMST 0 +wanted=Thursday 01:00:00 + +TZ=Pacific/Palau - Is it OK for this to be 9 AM? No DST or +timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 PWT 0 +result=Saturday 1970-01-03 00:00:00 PWT 0 +wanted=Saturday 00:00:00 + +TZ=Pacific/Funafuti - Is it OK for this to be midday? Note: does +not appear to have a DST or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 TVT 0 +result=Wednesday 1970-01-07 00:00:00 TVT 0 +wanted=Wednesday 00:00:00 + +TZ=Pacific/Wake - Is it OK for this to be midday? Note: does not +appear to have a DST or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 WAKT 0 +result=Tuesday 1970-01-06 00:00:00 WAKT 0 +wanted=Tuesday 00:00:00 + +TZ=Pacific/Wallis - Is it OK for this to be midday? Note: does +not appear to have a DST or timezone transition. +tStamp=Thursday 1970-01-01 17:17:17 WFT 0 +result=Tuesday 1970-01-06 00:00:00 WFT 0 +wanted=Tuesday 00:00:00 + +TZ=America/Paramaribo - Is it OK for this to be 0:30 AM? yes +tStamp=Monday 1984-09-24 17:17:17 SRT 0 +result=Monday 1984-10-01 00:30:00 SRT 0 +wanted=Monday 00:30:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33452.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33452.phpt new file mode 100644 index 0000000000000..e5abebf3c8dd6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33452.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #33452 (Support for year accompanying ISO week nr) +--FILE-- + +--EXPECT-- +2005-53 +2004-53 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33532.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33532.phpt new file mode 100644 index 0000000000000..004f881025332 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33532.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #33532 (Different output for strftime() and date()) +--INI-- +error_reporting=2047 +date.timezone=UTC +--FILE-- + +--EXPECT-- +TZ has NOT been set +Should strftime==datestr? Strftime seems to assume GMT tStamp. +input 10:00:00 AM July 1 2005 +strftime 10:00:00 AM July 1 2005 UTC +0000 +datestr 10:00:00 AM July 1 2005 UTC + +Setting TZ +input 10:00:00 AM July 1 2005 +strftime 10:00:00 AM July 1 2005 EST +1000 +datestr 10:00:00 AM July 1 2005 EST diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33536.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33536.phpt new file mode 100644 index 0000000000000..aa5f5ddb38bfe --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33536.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #33456 (strtotime defaults to now even on non time string) +--FILE-- + +--EXPECT-- +bool(false) +1970-01-01 +1970-01-01 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33562.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33562.phpt new file mode 100644 index 0000000000000..8383a79ab7359 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33562.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #33562 (date("") crashes) +--FILE-- + +--EXPECT-- +[] +done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33563.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33563.phpt new file mode 100644 index 0000000000000..9f4eb7b4d27dd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33563.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #33563 (strtotime('+1 month',$abc) cant get right time) +--FILE-- + +--EXPECT-- +strCurrDate:2005-06-30 21:04:23 strMonAfter:2005-07-30 21:04:23 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33578.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33578.phpt new file mode 100644 index 0000000000000..4ba6df85971c3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33578.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #33578 (strtotime() doesn't parse "11 Oct" format") +--FILE-- + +--EXPECTF-- +10/11/%d +10/11/%d +10/11/2005 +10/11/%d +10/11/%d +10/11/2005 +10/11/2005 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33869.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33869.phpt new file mode 100644 index 0000000000000..6957a6b7e24cd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33869.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #33869 (strtotime() doesn't parse "+1days" format) +--FILE-- + +--EXPECT-- +2005-01-06T01:01:01+0000 +2005-02-01T01:01:01+0000 +2006-01-01T01:01:01+0000 +2005-01-06T01:01:01+0000 +2005-02-01T01:01:01+0000 +2006-01-01T01:01:01+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug33957.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug33957.phpt new file mode 100644 index 0000000000000..43f14ee315f1d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug33957.phpt @@ -0,0 +1,103 @@ +--TEST-- +Bug #33957 (gmdate('W')/date('W') sometimes returns wrong week number) +--FILE-- + +--EXPECT-- +1992-12-14 51 +1992-12-15 51 +1992-12-16 51 +1992-12-17 51 +1992-12-18 51 +1992-12-19 51 +1992-12-20 51 +1992-12-21 52 +1992-12-22 52 +1992-12-23 52 +1992-12-24 52 +1992-12-25 52 +1992-12-26 52 +1992-12-27 52 +1992-12-28 53 +1992-12-29 53 +1992-12-30 53 +1992-12-31 53 +1993-01-1 53 +1993-01-2 53 +1993-01-3 53 +1993-01-4 01 +1993-01-5 01 +1993-01-6 01 +1993-01-7 01 +1993-01-8 01 +---- + 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 + (12-14) 51-1992 50-1993 50-1994 50-1995 50-1996 50-1997 51-1998 50-1999 50-2000 50-2001 50-2002 50-2003 51-2004 50-2005 50-2006 50-2007 50-2008 51-2009 50-2010 50-2011 50-2012 50-2013 50-2014 51-2015 50-2016 50-2017 50-2018 50-2019 + (12-15) 51-1992 50-1993 50-1994 50-1995 50-1996 51-1997 51-1998 50-1999 50-2000 50-2001 50-2002 51-2003 51-2004 50-2005 50-2006 50-2007 51-2008 51-2009 50-2010 50-2011 50-2012 50-2013 51-2014 51-2015 50-2016 50-2017 50-2018 50-2019 + (12-16) 51-1992 50-1993 50-1994 50-1995 51-1996 51-1997 51-1998 50-1999 50-2000 50-2001 51-2002 51-2003 51-2004 50-2005 50-2006 50-2007 51-2008 51-2009 50-2010 50-2011 50-2012 51-2013 51-2014 51-2015 50-2016 50-2017 50-2018 51-2019 + (12-17) 51-1992 50-1993 50-1994 50-1995 51-1996 51-1997 51-1998 50-1999 50-2000 51-2001 51-2002 51-2003 51-2004 50-2005 50-2006 51-2007 51-2008 51-2009 50-2010 50-2011 51-2012 51-2013 51-2014 51-2015 50-2016 50-2017 51-2018 51-2019 + (12-18) 51-1992 50-1993 50-1994 51-1995 51-1996 51-1997 51-1998 50-1999 51-2000 51-2001 51-2002 51-2003 51-2004 50-2005 51-2006 51-2007 51-2008 51-2009 50-2010 50-2011 51-2012 51-2013 51-2014 51-2015 50-2016 51-2017 51-2018 51-2019 + (12-19) 51-1992 50-1993 51-1994 51-1995 51-1996 51-1997 51-1998 50-1999 51-2000 51-2001 51-2002 51-2003 51-2004 51-2005 51-2006 51-2007 51-2008 51-2009 50-2010 51-2011 51-2012 51-2013 51-2014 51-2015 51-2016 51-2017 51-2018 51-2019 + (12-20) 51-1992 51-1993 51-1994 51-1995 51-1996 51-1997 51-1998 51-1999 51-2000 51-2001 51-2002 51-2003 52-2004 51-2005 51-2006 51-2007 51-2008 51-2009 51-2010 51-2011 51-2012 51-2013 51-2014 51-2015 51-2016 51-2017 51-2018 51-2019 + (12-21) 52-1992 51-1993 51-1994 51-1995 51-1996 51-1997 52-1998 51-1999 51-2000 51-2001 51-2002 51-2003 52-2004 51-2005 51-2006 51-2007 51-2008 52-2009 51-2010 51-2011 51-2012 51-2013 51-2014 52-2015 51-2016 51-2017 51-2018 51-2019 + (12-22) 52-1992 51-1993 51-1994 51-1995 51-1996 52-1997 52-1998 51-1999 51-2000 51-2001 51-2002 52-2003 52-2004 51-2005 51-2006 51-2007 52-2008 52-2009 51-2010 51-2011 51-2012 51-2013 52-2014 52-2015 51-2016 51-2017 51-2018 51-2019 + (12-23) 52-1992 51-1993 51-1994 51-1995 52-1996 52-1997 52-1998 51-1999 51-2000 51-2001 52-2002 52-2003 52-2004 51-2005 51-2006 51-2007 52-2008 52-2009 51-2010 51-2011 51-2012 52-2013 52-2014 52-2015 51-2016 51-2017 51-2018 52-2019 + (12-24) 52-1992 51-1993 51-1994 51-1995 52-1996 52-1997 52-1998 51-1999 51-2000 52-2001 52-2002 52-2003 52-2004 51-2005 51-2006 52-2007 52-2008 52-2009 51-2010 51-2011 52-2012 52-2013 52-2014 52-2015 51-2016 51-2017 52-2018 52-2019 + (12-25) 52-1992 51-1993 51-1994 52-1995 52-1996 52-1997 52-1998 51-1999 52-2000 52-2001 52-2002 52-2003 52-2004 51-2005 52-2006 52-2007 52-2008 52-2009 51-2010 51-2011 52-2012 52-2013 52-2014 52-2015 51-2016 52-2017 52-2018 52-2019 + (12-26) 52-1992 51-1993 52-1994 52-1995 52-1996 52-1997 52-1998 51-1999 52-2000 52-2001 52-2002 52-2003 52-2004 52-2005 52-2006 52-2007 52-2008 52-2009 51-2010 52-2011 52-2012 52-2013 52-2014 52-2015 52-2016 52-2017 52-2018 52-2019 + (12-27) 52-1992 52-1993 52-1994 52-1995 52-1996 52-1997 52-1998 52-1999 52-2000 52-2001 52-2002 52-2003 53-2004 52-2005 52-2006 52-2007 52-2008 52-2009 52-2010 52-2011 52-2012 52-2013 52-2014 52-2015 52-2016 52-2017 52-2018 52-2019 + (12-28) 53-1992 52-1993 52-1994 52-1995 52-1996 52-1997 53-1998 52-1999 52-2000 52-2001 52-2002 52-2003 53-2004 52-2005 52-2006 52-2007 52-2008 53-2009 52-2010 52-2011 52-2012 52-2013 52-2014 53-2015 52-2016 52-2017 52-2018 52-2019 + (12-29) 53-1992 52-1993 52-1994 52-1995 52-1996 01-1998 53-1998 52-1999 52-2000 52-2001 52-2002 01-2004 53-2004 52-2005 52-2006 52-2007 01-2009 53-2009 52-2010 52-2011 52-2012 52-2013 01-2015 53-2015 52-2016 52-2017 52-2018 52-2019 + (12-30) 53-1992 52-1993 52-1994 52-1995 01-1997 01-1998 53-1998 52-1999 52-2000 52-2001 01-2003 01-2004 53-2004 52-2005 52-2006 52-2007 01-2009 53-2009 52-2010 52-2011 52-2012 01-2014 01-2015 53-2015 52-2016 52-2017 52-2018 01-2020 + (12-31) 53-1992 52-1993 52-1994 52-1995 01-1997 01-1998 53-1998 52-1999 52-2000 01-2002 01-2003 01-2004 53-2004 52-2005 52-2006 01-2008 01-2009 53-2009 52-2010 52-2011 01-2013 01-2014 01-2015 53-2015 52-2016 52-2017 01-2019 01-2020 ++1 (01-01) 53-1992 52-1993 52-1994 01-1996 01-1997 01-1998 53-1998 52-1999 01-2001 01-2002 01-2003 01-2004 53-2004 52-2005 01-2007 01-2008 01-2009 53-2009 52-2010 52-2011 01-2013 01-2014 01-2015 53-2015 52-2016 01-2018 01-2019 01-2020 ++1 (01-02) 53-1992 52-1993 01-1995 01-1996 01-1997 01-1998 53-1998 52-1999 01-2001 01-2002 01-2003 01-2004 53-2004 01-2006 01-2007 01-2008 01-2009 53-2009 52-2010 01-2012 01-2013 01-2014 01-2015 53-2015 01-2017 01-2018 01-2019 01-2020 ++1 (01-03) 53-1992 01-1994 01-1995 01-1996 01-1997 01-1998 53-1998 01-2000 01-2001 01-2002 01-2003 01-2004 01-2005 01-2006 01-2007 01-2008 01-2009 53-2009 01-2011 01-2012 01-2013 01-2014 01-2015 53-2015 01-2017 01-2018 01-2019 01-2020 ++1 (01-04) 01-1993 01-1994 01-1995 01-1996 01-1997 01-1998 01-1999 01-2000 01-2001 01-2002 01-2003 01-2004 01-2005 01-2006 01-2007 01-2008 01-2009 01-2010 01-2011 01-2012 01-2013 01-2014 01-2015 01-2016 01-2017 01-2018 01-2019 01-2020 ++1 (01-05) 01-1993 01-1994 01-1995 01-1996 01-1997 02-1998 01-1999 01-2000 01-2001 01-2002 01-2003 02-2004 01-2005 01-2006 01-2007 01-2008 02-2009 01-2010 01-2011 01-2012 01-2013 01-2014 02-2015 01-2016 01-2017 01-2018 01-2019 01-2020 ++1 (01-06) 01-1993 01-1994 01-1995 01-1996 02-1997 02-1998 01-1999 01-2000 01-2001 01-2002 02-2003 02-2004 01-2005 01-2006 01-2007 01-2008 02-2009 01-2010 01-2011 01-2012 01-2013 02-2014 02-2015 01-2016 01-2017 01-2018 01-2019 02-2020 ++1 (01-07) 01-1993 01-1994 01-1995 01-1996 02-1997 02-1998 01-1999 01-2000 01-2001 02-2002 02-2003 02-2004 01-2005 01-2006 01-2007 02-2008 02-2009 01-2010 01-2011 01-2012 02-2013 02-2014 02-2015 01-2016 01-2017 01-2018 02-2019 02-2020 ++1 (01-08) 01-1993 01-1994 01-1995 02-1996 02-1997 02-1998 01-1999 01-2000 02-2001 02-2002 02-2003 02-2004 01-2005 01-2006 02-2007 02-2008 02-2009 01-2010 01-2011 01-2012 02-2013 02-2014 02-2015 01-2016 01-2017 02-2018 02-2019 02-2020 ++1 (01-09) 01-1993 01-1994 02-1995 02-1996 02-1997 02-1998 01-1999 01-2000 02-2001 02-2002 02-2003 02-2004 01-2005 02-2006 02-2007 02-2008 02-2009 01-2010 01-2011 02-2012 02-2013 02-2014 02-2015 01-2016 02-2017 02-2018 02-2019 02-2020 ++1 (01-10) 01-1993 02-1994 02-1995 02-1996 02-1997 02-1998 01-1999 02-2000 02-2001 02-2002 02-2003 02-2004 02-2005 02-2006 02-2007 02-2008 02-2009 01-2010 02-2011 02-2012 02-2013 02-2014 02-2015 01-2016 02-2017 02-2018 02-2019 02-2020 ++1 (01-11) 02-1993 02-1994 02-1995 02-1996 02-1997 02-1998 02-1999 02-2000 02-2001 02-2002 02-2003 02-2004 02-2005 02-2006 02-2007 02-2008 02-2009 02-2010 02-2011 02-2012 02-2013 02-2014 02-2015 02-2016 02-2017 02-2018 02-2019 02-2020 ++1 (01-12) 02-1993 02-1994 02-1995 02-1996 02-1997 03-1998 02-1999 02-2000 02-2001 02-2002 02-2003 03-2004 02-2005 02-2006 02-2007 02-2008 03-2009 02-2010 02-2011 02-2012 02-2013 02-2014 03-2015 02-2016 02-2017 02-2018 02-2019 02-2020 ++1 (01-13) 02-1993 02-1994 02-1995 02-1996 03-1997 03-1998 02-1999 02-2000 02-2001 02-2002 03-2003 03-2004 02-2005 02-2006 02-2007 02-2008 03-2009 02-2010 02-2011 02-2012 02-2013 03-2014 03-2015 02-2016 02-2017 02-2018 02-2019 03-2020 ++1 (01-14) 02-1993 02-1994 02-1995 02-1996 03-1997 03-1998 02-1999 02-2000 02-2001 03-2002 03-2003 03-2004 02-2005 02-2006 02-2007 03-2008 03-2009 02-2010 02-2011 02-2012 03-2013 03-2014 03-2015 02-2016 02-2017 02-2018 03-2019 03-2020 ++1 (01-15) 02-1993 02-1994 02-1995 03-1996 03-1997 03-1998 02-1999 02-2000 03-2001 03-2002 03-2003 03-2004 02-2005 02-2006 03-2007 03-2008 03-2009 02-2010 02-2011 02-2012 03-2013 03-2014 03-2015 02-2016 02-2017 03-2018 03-2019 03-2020 ++1 (01-16) 02-1993 02-1994 03-1995 03-1996 03-1997 03-1998 02-1999 02-2000 03-2001 03-2002 03-2003 03-2004 02-2005 03-2006 03-2007 03-2008 03-2009 02-2010 02-2011 03-2012 03-2013 03-2014 03-2015 02-2016 03-2017 03-2018 03-2019 03-2020 ++1 (01-17) 02-1993 03-1994 03-1995 03-1996 03-1997 03-1998 02-1999 03-2000 03-2001 03-2002 03-2003 03-2004 03-2005 03-2006 03-2007 03-2008 03-2009 02-2010 03-2011 03-2012 03-2013 03-2014 03-2015 02-2016 03-2017 03-2018 03-2019 03-2020 ++1 (01-18) 03-1993 03-1994 03-1995 03-1996 03-1997 03-1998 03-1999 03-2000 03-2001 03-2002 03-2003 03-2004 03-2005 03-2006 03-2007 03-2008 03-2009 03-2010 03-2011 03-2012 03-2013 03-2014 03-2015 03-2016 03-2017 03-2018 03-2019 03-2020 +---- diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug34087.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug34087.phpt new file mode 100644 index 0000000000000..3fa3885481731 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug34087.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #34087 (strtotime() does not work with date format "Y/m/d") +--FILE-- + +--EXPECT-- +Y/m/d: 1123804800 +Y-m-d: 1123804800 +2005-01-02T00:00:00+0000 +2005-01-02T00:00:00+0000 +2005-01-02T00:00:00+0000 +2005-01-02T00:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug34304.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug34304.phpt new file mode 100644 index 0000000000000..88030b7be5f7a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug34304.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #34304 (date('w') returns wrong number for sunday, 'N' modifier is missing) +--FILE-- + +--EXPECT-- +2004-W53-7 +2005-W01-7 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug34676.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug34676.phpt new file mode 100644 index 0000000000000..6f616feb4064a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug34676.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #34676 (missing support for strtotime("midnight") and strtotime("noon")) +--FILE-- + %s\n", $test, date(DATE_ISO8601, $t)); +} + +?> +--EXPECT-- +noon => 2005-12-22T12:00:00+0000 +midnight => 2005-12-22T00:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug34771.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug34771.phpt new file mode 100644 index 0000000000000..a27d085a1da7b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug34771.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #34771 (strtotime() fails with 1-12am/pm) +--FILE-- + %s\n", $test, date(DATE_ISO8601, $t)); +} + +?> +--EXPECT-- +12am => 2005-12-22T00:00:00+0000 +1am => 2005-12-22T01:00:00+0000 +1pm => 2005-12-22T13:00:00+0000 +12a.m. => 2005-12-22T00:00:00+0000 +1a.m. => 2005-12-22T01:00:00+0000 +1p.m. => 2005-12-22T13:00:00+0000 +12:00am => 2005-12-22T00:00:00+0000 +1:00am => 2005-12-22T01:00:00+0000 +1:00pm => 2005-12-22T13:00:00+0000 +12:00a.m. => 2005-12-22T00:00:00+0000 +1:00a.m. => 2005-12-22T01:00:00+0000 +1:00p.m. => 2005-12-22T13:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35143.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35143.phpt new file mode 100644 index 0000000000000..02b0072713df1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35143.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #35143 (gettimeofday() ignores current time zone) +--FILE-- + +--EXPECTF-- +string(3) "UTC" +array(4) { + ["sec"]=> + int(%d) + ["usec"]=> + int(%d) + ["minuteswest"]=> + int(0) + ["dsttime"]=> + int(0) +} diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35218.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35218.phpt new file mode 100644 index 0000000000000..725f03c4aa60c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35218.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #35218 (strtotime no longer ignores timezone comments like "(PST)") +--FILE-- + +--EXPECT-- +int(1131951370) +int(1131951370) diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35414.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35414.phpt new file mode 100644 index 0000000000000..f6af5110fb57e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35414.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #35414 (strtotime() no longer works with ordinal suffix) +--FILE-- + +--EXPECT-- +2005-11-26T18:18:00+0000 +2005-11-26T00:00:00+0000 +2005-12-04T00:00:00+0000 +2005-12-04T00:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35422.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35422.phpt new file mode 100644 index 0000000000000..8273c75411763 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35422.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #35422 (strtotime() does not parse times with UTC as timezone) +--FILE-- + +--EXPECT-- +2000-07-01T00:00:00+0000 +2000-07-01T00:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35425.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35425.phpt new file mode 100644 index 0000000000000..d5d7f68bbdcc8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35425.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #35425 (idate() function ignores timezone settings) +--FILE-- + +--EXPECT-- +int(292) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(31) +int(1104559261) +int(6) +int(53) +int(5) +int(2005) +int(0) +int(-18000) diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35456.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35456.phpt new file mode 100644 index 0000000000000..6432b9944530e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35456.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #35456 (+ 1 [time unit] format did not work) +--FILE-- + +--EXPECT-- +2005-11-29T22:15:19+0000 +2005-12-28T22:15:19+0000 +2005-12-05T22:15:19+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35499.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35499.phpt new file mode 100644 index 0000000000000..03f5205daa1fc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35499.phpt @@ -0,0 +1,78 @@ +--TEST-- +Bug #35499 (strtotime() does not handle whitespace around the date string) +--FILE-- + +--EXPECT-- +2005-11-20T08:00:00+0000 +2005-11-20T08:00:00+0000 +array(16) { + ["year"]=> + bool(false) + ["month"]=> + bool(false) + ["day"]=> + bool(false) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } + ["is_localtime"]=> + bool(true) + ["zone_type"]=> + int(2) + ["zone"]=> + int(-60) + ["is_dst"]=> + bool(false) + ["tz_abbr"]=> + string(1) "A" +} +array(12) { + ["year"]=> + bool(false) + ["month"]=> + bool(false) + ["day"]=> + bool(false) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } + ["is_localtime"]=> + bool(false) +} diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35624.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35624.phpt new file mode 100644 index 0000000000000..722adba823533 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35624.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #35624 (strtotime() does not handle 3 character weekdays) +--FILE-- + +--EXPECT-- +MonMon +MonMon +TueTue +TueTue +WedWed +WedWed +ThuThu +ThuThu +FriFri +FriFri +SatSat +SatSat +SunSun +SunSun diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35630.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35630.phpt new file mode 100644 index 0000000000000..b111b1aaf2e87 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35630.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #35630 (strtotime() crashes on non-separated relative modifiers) +--FILE-- + +--EXPECT-- +2006-01-09T00:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35699.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35699.phpt new file mode 100644 index 0000000000000..5e4951e9fc60f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35699.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #35699 (date() can't handle leap years before 1970) +--FILE-- + +--EXPECT-- +1964-06-06T00:00:00+0000 +1963-06-06T00:00:00+0000 +1964-01-06T00:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35705.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35705.phpt new file mode 100644 index 0000000000000..6894160a4d4c1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35705.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #35705 (strtotime() fails to parse soap date format without TZ) +--FILE-- + +--EXPECT-- +2000-10-10T10:12:30+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35885.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35885.phpt new file mode 100644 index 0000000000000..b3074f7f34fa7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35885.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #35885 (strtotime("NOW") no longer works) +--FILE-- + +--EXPECT-- +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug35887.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug35887.phpt new file mode 100644 index 0000000000000..e6ea7bd3889a4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug35887.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #35887 (wddx_deserialize not parsing dateTime fields properly) +--FILE-- + +--EXPECT-- +2006-01-06T08:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug36224.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug36224.phpt new file mode 100644 index 0000000000000..1690f4e7b2ce5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug36224.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #36224 (date(DATE_ATOM) gives wrong resulsts) +--FILE-- + +--EXPECT-- +2006-01-31T20:23:56+01:00 +2006-01-31T19:23:56+01:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug36510.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug36510.phpt new file mode 100644 index 0000000000000..ea8bb028b22f5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug36510.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #36510 (strtotime() fails to parse date strings with tabs) +--FILE-- + +--EXPECT-- +int(1140966188) +int(1140966188) diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug36599.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug36599.phpt new file mode 100644 index 0000000000000..b34a7c288fbc4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug36599.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #36599 (DATE_W3C format constant incorrect). +--FILE-- + +--EXPECT-- +2006-03-03T08:47:55+00:00 +2006-03-03T08:47:55+00:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug36988.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug36988.phpt new file mode 100644 index 0000000000000..d35e58939aa1b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug36988.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #36988 (mktime freezes on long numbers) +--INI-- +date.timezone=GMT +--FILE-- + +--EXPECT-- +smaller than one second diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug37017.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug37017.phpt new file mode 100644 index 0000000000000..61dc8ba383f38 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug37017.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #37017 (strtotime fails before 13:00:00 with some time zones identifiers). +--INI-- +date.timezone=GMT +--FILE-- + +--EXPECT-- +1147453201 +1147453200 +1147453199 +1147438799 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug37368.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug37368.phpt new file mode 100644 index 0000000000000..5be1c967987fe --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug37368.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #37368 (Incorrect timestamp returned for strtotime()). +--INI-- +date.timezone=UTC +--FILE-- + +--EXPECT-- +Wed, 07 Jun 2006 17:06:44 +0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug37514.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug37514.phpt new file mode 100644 index 0000000000000..abbb4407c8d1c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug37514.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #37514 (strtotime doesn't assume year correctly). +--INI-- +date.timezone=UTC +--FILE-- + +--EXPECT-- +Fri, 18 May 2007 05:05:00 +0000 +Fri, 18 May 2007 17:05:00 +0000 +Fri, 18 May 2007 17:05:00 +0000 +Fri, 18 May 2007 05:05:00 +0000 +Fri, 18 May 2007 05:05:00 +0000 +Thu, 18 May 2006 17:05:00 +0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug37616.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug37616.phpt new file mode 100644 index 0000000000000..7652501765e25 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug37616.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #37616 (DATE_RFC822 does not product RFC 822 dates) +--FILE-- + +--EXPECT-- +string(29) "Sat, 01 Jul 06 14:27:30 +0200" diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug37747.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug37747.phpt new file mode 100644 index 0000000000000..465f791c413d0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug37747.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #37747 (strtotime segfaults when given "nextyear") +--FILE-- + +--EXPECT-- +bool(false) +ALIVE diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug38229.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug38229.phpt new file mode 100644 index 0000000000000..472a05faef23d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug38229.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #38229 (strtotime() does not parse YYYY-MM) +--FILE-- + +--EXPECT-- +2006-01 +2006-03 +2006-12 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug39782.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug39782.phpt new file mode 100644 index 0000000000000..99abdd7bc847b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug39782.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #39782 (setTime() on a DateTime constructed with a Weekday yields incorrect results) +--FILE-- +format('D M j Y - H:i:s') . "\n"; + +$dttTest->setTime(12, 0, 0); +echo $dttTest->format('D M j Y - H:i:s') . "\n"; + +$dttTest->setTime(12, 0, 0); +echo $dttTest->format('D M j Y - H:i:s') . "\n"; +?> +--EXPECT-- +Wed Dec 13 2006 - 00:00:00 +Wed Dec 13 2006 - 12:00:00 +Wed Dec 13 2006 - 12:00:00 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug40861.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug40861.phpt new file mode 100644 index 0000000000000..d4ef96198c7ff --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug40861.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #40861 (Multiple +/- on relative units breaks strtotime()) +--FILE-- + +--EXPECT-- +2000-01-01 13:00:00 +2000-01-01 11:00:00 +2000-01-01 13:00:00 +2000-01-01 13:00:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug41523.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug41523.phpt new file mode 100644 index 0000000000000..c8aa00fd76c0d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug41523.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30) +--FILE-- +format( DateTime::ISO8601 ), "\n"; + +?> +--EXPECT-- +array(12) { + ["year"]=> + int(0) + ["month"]=> + int(0) + ["day"]=> + int(0) + ["hour"]=> + int(0) + ["minute"]=> + int(0) + ["second"]=> + int(0) + ["fraction"]=> + float(0) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } + ["is_localtime"]=> + bool(false) +} +bool(false) +object(DateTime)#1 (0) { +} +-0001-11-30T00:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug41709.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug41709.phpt new file mode 100644 index 0000000000000..69c7cb4f47270 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug41709.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #41709 (strtotime() does not handle 00.00.0000) +--FILE-- + +--EXPECT-- +Array +( + [year] => 0 + [month] => 0 + [day] => 0 + [hour] => 0 + [minute] => 0 + [second] => 0 + [fraction] => 0 + [warning_count] => 0 + [warnings] => Array + ( + ) + + [error_count] => 1 + [errors] => Array + ( + [11] => Unexpected character + ) + + [is_localtime] => +) diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug41842.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug41842.phpt new file mode 100644 index 0000000000000..b2a5ef32acd10 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug41842.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #41842 (Cannot create years < 0100 & negative years with date_create or new DateTime) +--FILE-- +format(DATE_ISO8601); +?> +--EXPECT-- +-2007-06-28T00:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug41844.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug41844.phpt new file mode 100644 index 0000000000000..c18b2f77360ac --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug41844.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #41844 (Format returns incorrect number of digits for negative years -0001 to -0999) +--FILE-- +modify('-3006 years'); +echo $date->format(DATE_ISO8601), "\n"; + +$date = new DateTime('2007-06-28'); +$date->modify('-2008 years'); +echo $date->format(DATE_ISO8601), "\n"; +?> +--EXPECT-- +-0999-06-28T00:00:00+0000 +-0001-06-28T00:00:00+0000 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/bug41964.phpt b/phpt/tests/php-5.2.5/ext/date/tests/bug41964.phpt new file mode 100644 index 0000000000000..022a1861b49cb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/bug41964.phpt @@ -0,0 +1,59 @@ +--TEST-- +Bug #41964 (strtotime returns a timestamp for non-time string of pattern '(A|a) .+') +--FILE-- + +--EXPECT-- +NULL +NULL + +int(-60) +string(1) "A" + +int(-60) +string(1) "A" + +int(-60) +string(1) "A" + +int(-60) +string(1) "A" + +int(-60) +string(1) "A" + +int(-60) +string(1) "A" diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date.phpt new file mode 100644 index 0000000000000..7cd84193552fc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date.phpt @@ -0,0 +1,22 @@ +--TEST-- +date() function +--FILE-- + +--EXPECT-- +c: 2003-01-23T12:20:59+00:00 +r: Thu, 23 Jan 2003 12:20:59 +0000 +c: 2003-01-23T13:20:59+01:00 +r: Thu, 23 Jan 2003 13:20:59 +0100 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_constants.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_constants.phpt new file mode 100644 index 0000000000000..132e24159bf84 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_constants.phpt @@ -0,0 +1,75 @@ +--TEST-- +Date constants +--FILE-- + +--EXPECT-- +string(25) "2006-07-01T14:27:30+02:00" +string(25) "2006-05-30T14:32:13+02:00" +string(33) "Saturday, 01-Jul-06 14:27:30 CEST" +string(32) "Tuesday, 30-May-06 14:32:13 CEST" +string(24) "2006-07-01T14:27:30+0200" +string(24) "2006-05-30T14:32:13+0200" +string(29) "Sat, 01 Jul 06 14:27:30 +0200" +string(29) "Tue, 30 May 06 14:32:13 +0200" +string(33) "Saturday, 01-Jul-06 14:27:30 CEST" +string(32) "Tuesday, 30-May-06 14:32:13 CEST" +string(29) "Sat, 01 Jul 06 14:27:30 +0200" +string(29) "Tue, 30 May 06 14:32:13 +0200" +string(31) "Sat, 01 Jul 2006 14:27:30 +0200" +string(31) "Tue, 30 May 2006 14:32:13 +0200" +string(31) "Sat, 01 Jul 2006 14:27:30 +0200" +string(31) "Tue, 30 May 2006 14:32:13 +0200" +string(25) "2006-07-01T14:27:30+02:00" +string(25) "2006-05-30T14:32:13+02:00" +string(31) "Sat, 01 Jul 2006 14:27:30 +0200" +string(31) "Tue, 30 May 2006 14:32:13 +0200" +string(25) "2006-07-01T14:27:30+02:00" +string(25) "2006-05-30T14:32:13+02:00" + +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_create-1.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_create-1.phpt new file mode 100644 index 0000000000000..365d54dc9469e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_create-1.phpt @@ -0,0 +1,48 @@ +--TEST-- +date_create() function [1] +--SKIPIF-- + +--FILE-- +format(DateTime::ISO8601), "\n"; +} +?> +--EXPECT-- +2005-07-14T22:30:41+0200 +2005-07-14T22:30:41+0000 +2005-07-14T22:30:41+0100 +2005-07-14T22:30:41+0200 +2005-07-14T22:30:41+0200 +2005-07-14T22:30:41-0700 +2005-07-14T22:30:41+0000 +2005-07-14T22:30:41+0100 +2005-07-14T22:30:41-0700 +2005-07-14T22:30:41+0000 +2005-07-14T22:30:41+0000 +2005-07-14T22:30:41+0000 +2005-07-14T22:30:41+0200 +2005-07-14T22:30:41-0700 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_create-2.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_create-2.phpt new file mode 100644 index 0000000000000..4aa33595d8c82 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_create-2.phpt @@ -0,0 +1,12 @@ +--TEST-- +date_create() function [2] +--SKIPIF-- + +--FILE-- +format('D, d M Y H:i:s T'), "\n"; +?> +--EXPECT-- +Mon, 18 Jul 2005 22:10:00 GMT+0400 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-1.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-1.phpt new file mode 100644 index 0000000000000..edb8fa1ac5648 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-1.phpt @@ -0,0 +1,16 @@ +--TEST-- +date_default_timezone_get() function [1] +--INI-- +date.timezone= +--FILE-- + +--EXPECTF-- +Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3 +UTC + +Strict Standards: date(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 4 +UTC diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-2.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-2.phpt new file mode 100644 index 0000000000000..ffaf1ad096f8e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-2.phpt @@ -0,0 +1,12 @@ +--TEST-- +date_default_timezone_get() function [2] +--INI-- +date.timezone=CEST +--FILE-- + +--EXPECTF-- +Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-2.php on line 3 +UTC diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-3.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-3.phpt new file mode 100644 index 0000000000000..a5489dae4ce7f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_get-3.phpt @@ -0,0 +1,15 @@ +--TEST-- +date_default_timezone_get() function [3] +--INI-- +date.timezone= +--FILE-- + +--EXPECT-- +Europe/Rome +America/Chicago diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_set-1.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_set-1.phpt new file mode 100644 index 0000000000000..cde7b7645fd4c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_default_timezone_set-1.phpt @@ -0,0 +1,28 @@ +--TEST-- +date_default_timezone_set() function [1] +--INI-- +date.timezone= +--FILE-- + +--EXPECTF-- +Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 3 + +Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 4 +America/Indiana/Knox +2005-01-12T03:00:00-0500 +2005-07-12T03:00:00-0500 +2005-01-12T08:00:00-0500 +2005-07-12T08:00:00-0500 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_modify-1.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_modify-1.phpt new file mode 100644 index 0000000000000..7707b7fc241cc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_modify-1.phpt @@ -0,0 +1,30 @@ +--TEST-- +date_modify() function [1] +--SKIPIF-- + +--FILE-- +modify("+1 second"); +echo date_format($ts, 'D, d M Y H:i:s T'), "\n"; + +date_default_timezone_set("Europe/Amsterdam"); +$ts = date_create("Sun Mar 27 01:59:59 2005"); +echo date_format($ts, 'D, d M Y H:i:s T'), "\n"; +$ts->modify("+1 second"); +echo date_format($ts, 'D, d M Y H:i:s T'), "\n"; + +$ts = date_create("Sun Oct 30 01:59:59 2005"); +echo date_format($ts, 'D, d M Y H:i:s T'), "\n"; +$ts->modify("+ 1 hour 1 second"); +echo date_format($ts, 'D, d M Y H:i:s T'), "\n"; +?> +--EXPECT-- +Thu, 19 Aug 1993 23:59:59 KWAT +Sat, 21 Aug 1993 00:00:00 MHT +Sun, 27 Mar 2005 01:59:59 CET +Sun, 27 Mar 2005 03:00:00 CEST +Sun, 30 Oct 2005 01:59:59 CEST +Sun, 30 Oct 2005 03:00:00 CET diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_modify-2.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_modify-2.phpt new file mode 100644 index 0000000000000..cc197fcdc499c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_modify-2.phpt @@ -0,0 +1,15 @@ +--TEST-- +date_modify() function [2] +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Mon, 18 Jul 2005 22:10:00 GMT+0400 +Mon, 18 Jul 2005 23:10:00 GMT+0400 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_parse_001.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_parse_001.phpt new file mode 100644 index 0000000000000..cd8fbea8eeea5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_parse_001.phpt @@ -0,0 +1,303 @@ +--TEST-- +Test basic date_parse() +--INI-- +date.timezone=UTC +--FILE-- + +--EXPECTF-- +array(12) { + ["year"]=> + int(2006) + ["month"]=> + int(12) + ["day"]=> + int(12) + ["hour"]=> + int(10) + ["minute"]=> + int(0) + ["second"]=> + int(0) + ["fraction"]=> + float(0.5) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } + ["is_localtime"]=> + bool(false) +} +array(12) { + ["year"]=> + int(2006) + ["month"]=> + int(12) + ["day"]=> + int(12) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } + ["is_localtime"]=> + bool(false) +} +array(15) { + ["year"]=> + int(2006) + ["month"]=> + int(12) + ["day"]=> + bool(false) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(1) + ["errors"]=> + array(1) { + [7]=> + string(20) "Unexpected character" + } + ["is_localtime"]=> + bool(true) + ["zone_type"]=> + int(1) + ["zone"]=> + int(720) + ["is_dst"]=> + bool(false) +} +array(12) { + ["year"]=> + int(2006) + ["month"]=> + int(2) + ["day"]=> + int(30) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } + ["is_localtime"]=> + bool(false) +} +array(12) { + ["year"]=> + int(2006) + ["month"]=> + int(3) + ["day"]=> + int(4) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } + ["is_localtime"]=> + bool(false) +} +array(12) { + ["year"]=> + int(2006) + ["month"]=> + int(3) + ["day"]=> + bool(false) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(0) + ["errors"]=> + array(0) { + } + ["is_localtime"]=> + bool(false) +} +array(15) { + ["year"]=> + bool(false) + ["month"]=> + bool(false) + ["day"]=> + bool(false) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(2) + ["errors"]=> + array(2) { + [0]=> + string(20) "Unexpected character" + [1]=> + string(20) "Unexpected character" + } + ["is_localtime"]=> + bool(true) + ["zone_type"]=> + int(1) + ["zone"]=> + int(180) + ["is_dst"]=> + bool(false) +} +array(15) { + ["year"]=> + bool(false) + ["month"]=> + bool(false) + ["day"]=> + bool(false) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(1) + ["errors"]=> + array(1) { + [0]=> + string(20) "Unexpected character" + } + ["is_localtime"]=> + bool(true) + ["zone_type"]=> + int(1) + ["zone"]=> + int(0) + ["is_dst"]=> + bool(false) +} +array(12) { + ["year"]=> + bool(false) + ["month"]=> + bool(false) + ["day"]=> + bool(false) + ["hour"]=> + bool(false) + ["minute"]=> + bool(false) + ["second"]=> + bool(false) + ["fraction"]=> + bool(false) + ["warning_count"]=> + int(0) + ["warnings"]=> + array(0) { + } + ["error_count"]=> + int(1) + ["errors"]=> + array(1) { + [0]=> + string(12) "Empty string" + } + ["is_localtime"]=> + bool(false) +} + +Warning: date_parse() expects parameter 1 to be string, array given in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_sun_info_001.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_sun_info_001.phpt new file mode 100644 index 0000000000000..d469e37e7ef41 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_sun_info_001.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test basic date_sun_info() +--INI-- +date.timezone=UTC +--FILE-- + +--EXPECTF-- +array(9) { + ["sunrise"]=> + int(1165897782) + ["sunset"]=> + int(1165934168) + ["transit"]=> + int(1165915975) + ["civil_twilight_begin"]=> + int(1165896176) + ["civil_twilight_end"]=> + int(1165935773) + ["nautical_twilight_begin"]=> + int(1165894353) + ["nautical_twilight_end"]=> + int(1165937597) + ["astronomical_twilight_begin"]=> + int(1165892570) + ["astronomical_twilight_end"]=> + int(1165939380) +} +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/date_sun_info_002.phpt b/phpt/tests/php-5.2.5/ext/date/tests/date_sun_info_002.phpt new file mode 100644 index 0000000000000..b41d123d973b2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/date_sun_info_002.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test basic date_sun_info() +--INI-- +date.timezone=Europe/Oslo +--FILE-- + $elem ) +{ + echo date( 'Y-m-d H:i:s T', $elem ), " ", $key, "\n"; +} +echo "Done\n"; +?> +--EXPECTF-- +2007-04-13 06:12:19 CEST sunrise +2007-04-13 20:31:50 CEST sunset +2007-04-13 13:22:05 CEST transit +2007-04-13 05:28:03 CEST civil_twilight_begin +2007-04-13 21:16:06 CEST civil_twilight_end +2007-04-13 04:30:08 CEST nautical_twilight_begin +2007-04-13 22:14:01 CEST nautical_twilight_end +2007-04-13 03:14:36 CEST astronomical_twilight_begin +2007-04-13 23:29:33 CEST astronomical_twilight_end +Done diff --git a/phpt/tests/php-5.2.5/ext/date/tests/default-timezone-1.phpt b/phpt/tests/php-5.2.5/ext/date/tests/default-timezone-1.phpt new file mode 100644 index 0000000000000..f135011e631e4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/default-timezone-1.phpt @@ -0,0 +1,11 @@ +--TEST-- +date.timezone setting [1] +--INI-- +date.timezone=GMT +--FILE-- + +--EXPECT-- +1119132944 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/default-timezone-2.phpt b/phpt/tests/php-5.2.5/ext/date/tests/default-timezone-2.phpt new file mode 100644 index 0000000000000..5966a9651e943 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/default-timezone-2.phpt @@ -0,0 +1,11 @@ +--TEST-- +date.timezone setting [2] +--INI-- +date.timezone=Europe/Oslo +--FILE-- + +--EXPECT-- +1119125744 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/format-negative-timestamp.phpt b/phpt/tests/php-5.2.5/ext/date/tests/format-negative-timestamp.phpt new file mode 100644 index 0000000000000..5fd6a65897b64 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/format-negative-timestamp.phpt @@ -0,0 +1,24 @@ +--TEST-- +strtotime() - Format: @timestamps +--FILE-- + $max_2) + $new_tm *= -1; + + if (strtotime("@$new_tm") != $new_tm) { + echo "Error when parsing: @$new_tm\n"; + } +} + +echo "done!"; +?> +--EXPECT-- +done! diff --git a/phpt/tests/php-5.2.5/ext/date/tests/mktime-1.phpt b/phpt/tests/php-5.2.5/ext/date/tests/mktime-1.phpt new file mode 100644 index 0000000000000..87e5e82456b3b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/mktime-1.phpt @@ -0,0 +1,44 @@ +--TEST-- +Check for mktime with out-of-range parameters +--INI-- +error_reporting=2047 +--FILE-- + +--EXPECT-- +2000-02-29 +2000-02-28 +2000-02-29 +2001-02-28 +2001-03-01 +1999-11-30 +2000-05-29 12:00:00 +2000-05-29 13:00:00 +2000-05-29 12:00:00 +2000-01-31 12:00:00 +2000-01-31 12:00:00 +2000-01-31 11:00:00 +2000-04-29 12:00:00 +2000-04-29 13:00:00 +2000-04-29 12:00:00 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/mktime-2.phpt b/phpt/tests/php-5.2.5/ext/date/tests/mktime-2.phpt new file mode 100644 index 0000000000000..e3deff1672267 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/mktime-2.phpt @@ -0,0 +1,51 @@ +--TEST-- +mktime() [2] +--INI-- +error_reporting=2047 +--FILE-- + +--EXPECTF-- +int(1009843200) +int(1009843200) +int(1009843200) +int(%s) +int(1025481600) +int(1025481600) +int(1025481600) +int(%s) +int(1009843200) +int(1009843200) +int(1009843200) +int(1009839600) +int(1025478000) +int(1025478000) +int(1025481600) +int(1025478000) diff --git a/phpt/tests/php-5.2.5/ext/date/tests/mktime-3.phpt b/phpt/tests/php-5.2.5/ext/date/tests/mktime-3.phpt new file mode 100644 index 0000000000000..0d19074fc3118 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/mktime-3.phpt @@ -0,0 +1,54 @@ +--TEST-- +mktime() [3] +--INI-- +error_reporting=2047 +--FILE-- + +--EXPECT-- +America/Toronto +Y: 0 - January 2000-01-01T01:01:01-0500 +Y: 69 - out of range +Y: 70 - January 1970-01-01T01:01:01-0500 +Y: 71 - January 1971-01-01T01:01:01-0500 +Y: 99 - January 1999-01-01T01:01:01-0500 +Y: 100 - January 2000-01-01T01:01:01-0500 +Y: 105 - January 2005-01-01T01:01:01-0500 +Y: 1900 - out of range +Y: 1901 - out of range +Y: 1902 - January 1902-01-01T01:01:01-0500 +Y: 1999 - January 1999-01-01T01:01:01-0500 +Y: 2000 - January 2000-01-01T01:01:01-0500 +Y: 2001 - January 2001-01-01T01:01:01-0500 + +Europe/Oslo +Y: 0 - January 2000-01-01T01:01:01+0100 +Y: 69 - out of range +Y: 70 - January 1970-01-01T01:01:01+0100 +Y: 71 - January 1971-01-01T01:01:01+0100 +Y: 99 - January 1999-01-01T01:01:01+0100 +Y: 100 - January 2000-01-01T01:01:01+0100 +Y: 105 - January 2005-01-01T01:01:01+0100 +Y: 1900 - out of range +Y: 1901 - out of range +Y: 1902 - January 1902-01-01T01:01:01+0100 +Y: 1999 - January 1999-01-01T01:01:01+0100 +Y: 2000 - January 2000-01-01T01:01:01+0100 +Y: 2001 - January 2001-01-01T01:01:01+0100 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/oo_001.phpt b/phpt/tests/php-5.2.5/ext/date/tests/oo_001.phpt new file mode 100644 index 0000000000000..812b44016a9b8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/oo_001.phpt @@ -0,0 +1,53 @@ +--TEST-- +date OO interface +--INI-- +date.timezone=UTC +--FILE-- +format("Y-m-d H:i:s")); + +$d = new _d; +///var_dump($d->format("Y-m-d H:i:s")); + +try { + new DateTime("1am todax"); +} catch (Exception $e) { + echo $e->getMessage(),"\n"; +} + +$t = new DateTimeZone("UTC"); +var_dump($t->getName()); + +$t = new _t; +///var_dump($t->getName()); + +try { + new DateTimeZone("GottaFindThisOne"); +} catch (Exception $e) { + echo $e->getMessage(),"\n"; +} + +echo "DONE\n"; +?> +--EXPECTF-- +string(19) "%d-%d-%d %d:%d:%d" + +Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %soo_001.php on line %d +bool(false) +DateTime::__construct(): Failed to parse time string (1am todax) at position 4 (t): The timezone could not be found in the database +string(3) "UTC" + +Warning: DateTimeZone::getName(): The DateTimeZone object has not been correctly initialized by its constructor in %soo_001.php on line %d +bool(false) +DateTimeZone::__construct(): Unknown or bad timezone (GottaFindThisOne) +DONE diff --git a/phpt/tests/php-5.2.5/ext/date/tests/oo_002.phpt b/phpt/tests/php-5.2.5/ext/date/tests/oo_002.phpt new file mode 100644 index 0000000000000..e619d9dfe158f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/oo_002.phpt @@ -0,0 +1,28 @@ +--TEST-- +date OO cloning +--INI-- +date.timezone=Europe/Berlin +--FILE-- +format(DateTime::RFC822)); +$c = clone $d; +var_dump($c->format(DateTime::RFC822)); +$d->modify("1 hour after"); +$c->modify("1 second ago"); +var_dump($d->format(DateTime::RFC822)); +var_dump($c->format(DateTime::RFC822)); +$t = new _t("Asia/Tokyo"); +var_dump($t->getName()); +$c = clone $t; +var_dump($c->getName()); +?> +--EXPECT-- +string(29) "Wed, 01 Aug 07 13:00:00 +0000" +string(29) "Wed, 01 Aug 07 13:00:00 +0000" +string(29) "Wed, 01 Aug 07 14:00:00 +0000" +string(29) "Wed, 01 Aug 07 12:59:59 +0000" +string(10) "Asia/Tokyo" +string(10) "Asia/Tokyo" diff --git a/phpt/tests/php-5.2.5/ext/date/tests/strtotime-mysql.phpt b/phpt/tests/php-5.2.5/ext/date/tests/strtotime-mysql.phpt new file mode 100755 index 0000000000000..88a8f10fed0c7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/strtotime-mysql.phpt @@ -0,0 +1,25 @@ +--TEST-- +strtotime() and mysql timestamps +--FILE-- + +--EXPECT-- +string(31) "Fri, 23 May 1997 09:15:28 +0000" +string(31) "Sun, 31 Dec 2000 18:58:59 +0000" +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/date/tests/strtotime.phpt b/phpt/tests/php-5.2.5/ext/date/tests/strtotime.phpt new file mode 100644 index 0000000000000..6560d7f1fd3e9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/strtotime.phpt @@ -0,0 +1,16 @@ +--TEST-- +strtotime() function +--FILE-- + +--EXPECT-- +2005-07-14T22:30:41+0200 +2005-07-15T00:30:41+0200 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/strtotime2.phpt b/phpt/tests/php-5.2.5/ext/date/tests/strtotime2.phpt new file mode 100644 index 0000000000000..b8b605923dbce --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/strtotime2.phpt @@ -0,0 +1,40 @@ +--TEST-- +strtotime() on date constants +--FILE-- + +--EXPECT-- +DATE_ATOM: OK +DATE_COOKIE: OK +DATE_ISO8601: OK +DATE_RFC822: OK +DATE_RFC850: OK +DATE_RFC1036: OK +DATE_RFC1123: OK +DATE_RFC2822: OK +DATE_RFC3339: OK +DATE_RSS: OK +DATE_W3C: OK diff --git a/phpt/tests/php-5.2.5/ext/date/tests/strtotime3.phpt b/phpt/tests/php-5.2.5/ext/date/tests/strtotime3.phpt new file mode 100644 index 0000000000000..c5d13d8a6f22a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/strtotime3.phpt @@ -0,0 +1,69 @@ +--TEST-- +strtotime() function +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +string(31) "Thu, 15 Jun 2006 00:00:00 +0100" +string(31) "Fri, 16 Jun 2006 22:49:12 +0100" +bool(false) +string(31) "Fri, 16 Jun 2006 23:49:12 +0100" +bool(false) +string(31) "Fri, 16 Jun 2006 02:22:00 +0100" +bool(false) +string(31) "Fri, 16 Jun 2006 02:22:33 +0100" +bool(false) +string(31) "Tue, 02 Mar 2004 00:00:00 +0000" +string(31) "Tue, 02 Mar 2004 00:00:00 +0000" +string(31) "Sun, 12 Feb 2006 23:12:23 +0000" +bool(false) +string(31) "Fri, 16 Jun 2006 00:00:00 +0100" +string(31) "Sun, 15 Jan 2006 00:00:00 +0000" +string(31) "Sun, 15 Jan 2006 00:00:00 +0000" +string(31) "Tue, 10 Oct 2000 13:55:36 +0100" +bool(false) +string(31) "Fri, 16 Jun 2006 20:06:00 +0100" +string(31) "Mon, 16 Jun 1986 22:51:59 +0100" +string(31) "Mon, 16 Jan 2006 00:00:00 +0000" +string(31) "Mon, 16 Jan 2006 00:00:00 +0000" diff --git a/phpt/tests/php-5.2.5/ext/date/tests/timezone-configuration.phpt b/phpt/tests/php-5.2.5/ext/date/tests/timezone-configuration.phpt new file mode 100644 index 0000000000000..4a313881df09f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/timezone-configuration.phpt @@ -0,0 +1,19 @@ +--TEST-- +timezone configuration [1] +--INI-- +date.timezone=GMT +--FILE-- + +--EXPECT-- +1119125744 +1119129344 +1119125744 diff --git a/phpt/tests/php-5.2.5/ext/date/tests/timezones.phpt b/phpt/tests/php-5.2.5/ext/date/tests/timezones.phpt new file mode 100644 index 0000000000000..c7e470ab8ca47 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/date/tests/timezones.phpt @@ -0,0 +1,26 @@ +--TEST-- +setting bogus timezones +--FILE-- + +--EXPECTF-- +Notice: date_default_timezone_set(): Timezone ID 'AAA' is invalid in %stimezones.php on line 4 +bool(false) + +Notice: date_default_timezone_set(): Timezone ID 'ZZZ' is invalid in %stimezones.php on line 5 +bool(false) +bool(true) +bool(true) +done diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/bug36436.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/bug36436.phpt new file mode 100755 index 0000000000000..60470660e8fac --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/bug36436.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #36436 (DBA problem with Berkeley DB4) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +resource(%d) of type (dba persistent) +string(3) "XYZ" +string(1) "X" +string(1) "Y" +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba001.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba001.phpt new file mode 100644 index 0000000000000..3d617fb2c231f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba001.phpt @@ -0,0 +1,21 @@ +--TEST-- +DBA File Creation Test +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +database handler: %s +database file created \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba002.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba002.phpt new file mode 100644 index 0000000000000..3f862e38c5107 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba002.phpt @@ -0,0 +1,22 @@ +--TEST-- +DBA Insert/Fetch Test +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +database handler: %s +This is a test insert diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba003.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba003.phpt new file mode 100644 index 0000000000000..617ae91891ef6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba003.phpt @@ -0,0 +1,24 @@ +--TEST-- +DBA Insert/Replace/Fetch Test +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +database handler: %s +This is the replacement text diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba004.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba004.phpt new file mode 100644 index 0000000000000..3b1f29c7dd6e2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba004.phpt @@ -0,0 +1,28 @@ +--TEST-- +DBA Multiple Insert/Fetch Test +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +database handler: %s +Another Content String Content String 2 diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba005.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba005.phpt new file mode 100644 index 0000000000000..5a933c48f984b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba005.phpt @@ -0,0 +1,35 @@ +--TEST-- +DBA FirstKey/NextKey Loop Test With 5 Items +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +database handler: %s +5YYYYY diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba006.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba006.phpt new file mode 100644 index 0000000000000..efa36a5d0709b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba006.phpt @@ -0,0 +1,37 @@ +--TEST-- +DBA FirstKey/NextKey with 2 deletes +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +database handler: %s +3NYNYY \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba007.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba007.phpt new file mode 100644 index 0000000000000..cc84a729c3245 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba007.phpt @@ -0,0 +1,45 @@ +--TEST-- +DBA Multiple File Creation Test +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +database handler: %s +database file created +database file created +database file created +array(3) { + [%d]=> + string(%d) "%stest0.dbm" + [%d]=> + string(%d) "%stest1.dbm" + [%d]=> + string(%d) "%stest2.dbm" +} diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba008.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba008.phpt new file mode 100644 index 0000000000000..84a47ba0836f7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba008.phpt @@ -0,0 +1,32 @@ +--TEST-- +DBA magic_quotes_runtime Test +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +database handler: %s +string(1) """ +string(2) "\"" +string(2) "\"" +string(1) """ diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba009.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba009.phpt new file mode 100755 index 0000000000000..50a50c6bd5a08 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba009.phpt @@ -0,0 +1,33 @@ +--TEST-- +DBA dba_popen Test +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +database handler: %s +Opened +Inserted +Closed +Opened +Inserted diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb.phpt new file mode 100644 index 0000000000000..f3bf7975ea06c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb.phpt @@ -0,0 +1,47 @@ +--TEST-- +DBA CDB handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +database handler: cdb +5YYYYY +Content String 2 +array(5) { + ["key1"]=> + string(16) "Content String 1" + ["key2"]=> + string(16) "Content String 2" + ["key3"]=> + string(20) "Third Content String" + ["key4"]=> + string(22) "Another Content String" + ["key5"]=> + string(23) "The last content string" +} +--NO-LOCK-- +5YYYYY +Content String 2 +array(5) { + ["key1"]=> + string(16) "Content String 1" + ["key2"]=> + string(16) "Content String 2" + ["key3"]=> + string(20) "Third Content String" + ["key4"]=> + string(22) "Another Content String" + ["key5"]=> + string(23) "The last content string" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb_make.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb_make.phpt new file mode 100644 index 0000000000000..04df9252d800b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb_make.phpt @@ -0,0 +1,38 @@ +--TEST-- +DBA CDB_MAKE handler test +--INI-- +magic_quotes_runtime=1 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +database handler: cdb_make +string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5" +string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5" \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb_read.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb_read.phpt new file mode 100644 index 0000000000000..a0fbe7bccaee2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_cdb_read.phpt @@ -0,0 +1,65 @@ +--TEST-- +DBA CDB handler test (read only) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +database handler: cdb +7YYYYNNN +=1234 +#1122 +?1212314 +#1212314 +=1231324 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_db1.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_db1.phpt new file mode 100755 index 0000000000000..983954b50b165 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_db1.phpt @@ -0,0 +1,46 @@ +--TEST-- +DBA DB1 handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +database handler: db1 +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +--NO-LOCK-- +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_db2.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_db2.phpt new file mode 100644 index 0000000000000..bcc5a9479306c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_db2.phpt @@ -0,0 +1,46 @@ +--TEST-- +DBA DB2 handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +database handler: db2 +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +--NO-LOCK-- +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_db3.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_db3.phpt new file mode 100644 index 0000000000000..c6d04cf02d084 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_db3.phpt @@ -0,0 +1,46 @@ +--TEST-- +DBA DB3 handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +database handler: db3 +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +--NO-LOCK-- +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_db4.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_db4.phpt new file mode 100644 index 0000000000000..252797bf41168 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_db4.phpt @@ -0,0 +1,32 @@ +--TEST-- +DBA DB4 handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +database handler: db4 +3NYNYY +Content String 2 +Content 2 replaced +Read during write: allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_dbm.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_dbm.phpt new file mode 100644 index 0000000000000..fdd7b375f4457 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_dbm.phpt @@ -0,0 +1,46 @@ +--TEST-- +DBA DBM handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +database handler: dbm +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +--NO-LOCK-- +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_flatfile.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_flatfile.phpt new file mode 100644 index 0000000000000..2e32b8a327815 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_flatfile.phpt @@ -0,0 +1,46 @@ +--TEST-- +DBA FlatFile handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +database handler: flatfile +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +--NO-LOCK-- +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_gdbm.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_gdbm.phpt new file mode 100644 index 0000000000000..f9b3e3c6067ad --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_gdbm.phpt @@ -0,0 +1,34 @@ +--TEST-- +DBA GDBM handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +database handler: gdbm +3NYNYY +Content String 2 +Content 2 replaced +Read during write:%sallowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_handler.inc b/phpt/tests/php-5.2.5/ext/dba/tests/dba_handler.inc new file mode 100644 index 0000000000000..1c3f5127ef384 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_handler.inc @@ -0,0 +1,90 @@ + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_inifile.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_inifile.phpt new file mode 100644 index 0000000000000..9511a8bb49b5f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_inifile.phpt @@ -0,0 +1,46 @@ +--TEST-- +DBA INIFILE handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +database handler: inifile +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +--NO-LOCK-- +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_ndbm.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_ndbm.phpt new file mode 100644 index 0000000000000..f7955c5813ecd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_ndbm.phpt @@ -0,0 +1,46 @@ +--TEST-- +DBA NDBM handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +database handler: ndbm +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +--NO-LOCK-- +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/dba_qdbm.phpt b/phpt/tests/php-5.2.5/ext/dba/tests/dba_qdbm.phpt new file mode 100755 index 0000000000000..a7c9ab69e13af --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/dba_qdbm.phpt @@ -0,0 +1,34 @@ +--TEST-- +DBA QDBM handler test +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +database handler: qdbm +3NYNYY +Content String 2 +Content 2 replaced +Read during write:%sallowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} + +Warning: dba_popen(%stest0.dbm,r-): Locking cannot be disabled for handler qdbm in %sdba_handler.inc on line %d +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/skipif.inc b/phpt/tests/php-5.2.5/ext/dba/tests/skipif.inc new file mode 100644 index 0000000000000..e75000fafdeda --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/skipif.inc @@ -0,0 +1,23 @@ + diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/test.cdb b/phpt/tests/php-5.2.5/ext/dba/tests/test.cdb new file mode 100644 index 0000000000000000000000000000000000000000..21529c6280e7496699eef289964e39490a3b07ed GIT binary patch literal 2230 zcmZ?cU;qQRQF=5SfFUrN4o33>Cy$vcp zN&^F9G(1Mr1Bv;85twE`*w7HhGBSd(42@wdBe<+FT+9%z&cp jsN@u&JOfZ3M2kRaBP8|HfZ`fR{OLeG7myF4<&eYywHS$a literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/dba/tests/test.inc b/phpt/tests/php-5.2.5/ext/dba/tests/test.inc new file mode 100644 index 0000000000000..04f954541c553 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dba/tests/test.inc @@ -0,0 +1,7 @@ + diff --git a/phpt/tests/php-5.2.5/ext/dbase/tests/001.phpt b/phpt/tests/php-5.2.5/ext/dbase/tests/001.phpt new file mode 100644 index 0000000000000..7c10efb267d9a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dbase/tests/001.phpt @@ -0,0 +1,63 @@ +--TEST-- +dbase_create() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +int(%d) + +Warning: dbase_create(): unknown field type 'E' in %s on line %d +bool(false) + +Warning: dbase_create(): unknown field type '-' in %s on line %d +bool(false) +int(%d) + +Warning: dbase_create(): expected field name as first element of list in field 0 in %s on line %d +bool(false) + +Warning: dbase_create(): Unable to create database without fields in %s on line %d +bool(false) + +Warning: dbase_create(): Expected array as second parameter in %s on line %d +bool(false) + +Warning: dbase_create(): Expected array as second parameter in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/dbase/tests/002.phpt b/phpt/tests/php-5.2.5/ext/dbase/tests/002.phpt new file mode 100644 index 0000000000000..d5dd5c9e02c76 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dbase/tests/002.phpt @@ -0,0 +1,54 @@ +--TEST-- +dbase_open() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: dbase_open(): Invalid access mode -1 in %s on line %d +bool(false) + +Warning: dbase_open(): Invalid access mode 1000 in %s on line %d +bool(false) + +Warning: dbase_open(): unable to open database %s in %s on line %d +bool(false) + +Warning: dbase_open(): unable to open database %s in %s on line %d +bool(false) + +Warning: dbase_open(): The filename cannot be empty. in %s on line %d +bool(false) +int(%d) +int(%d) +Done diff --git a/phpt/tests/php-5.2.5/ext/dbase/tests/bug31754.phpt b/phpt/tests/php-5.2.5/ext/dbase/tests/bug31754.phpt new file mode 100644 index 0000000000000..bc116ed1bdd2d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dbase/tests/bug31754.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #31754 (dbase_open() fails for mode = 1) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: dbase_open(): Cannot open /tmp/bug31754.dbf in write-only mode in %sbug31754.php on line %d diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/book.xml b/phpt/tests/php-5.2.5/ext/dom/tests/book.xml new file mode 100644 index 0000000000000..95de0da86649e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/book.xml @@ -0,0 +1,11 @@ + + + + The Grapes of Wrath + John Steinbeck + + + The Pearl + John Steinbeck + + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/book.xml.gz b/phpt/tests/php-5.2.5/ext/dom/tests/book.xml.gz new file mode 100644 index 0000000000000000000000000000000000000000..2c97807a59fbe65a0dce669be105c7a3e0e0668b GIT binary patch literal 119 zcmV--0Eqt|iwFpA0G&So17dG)Yc6@4MGE*3jja~9VE8^003c;D2V_7 literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug28721.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug28721.phpt new file mode 100644 index 0000000000000..464498ef808a0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug28721.phpt @@ -0,0 +1,485 @@ +--TEST-- +Bug #28721 (appendChild() and insertBefore() unset DOMText) +--SKIPIF-- + +--FILE-- +nodeName . " (" . $node->nodeValue . ")\n"; +} + +function print_node_r(DomNode $node) { + static $indent = ""; + echo "\n" . $indent; + print_node($node); + + echo $indent . "parent: "; + if ( $node->parentNode ) + print_node($node->parentNode); + else + echo "NULL\n"; + + echo $indent . "previousSibling: "; + if ( $node->previousSibling ) + print_node($node->previousSibling); + else + echo "NULL\n"; + + echo $indent . "nextSibling: "; + if ( $node->nextSibling ) + print_node($node->nextSibling); + else + echo "NULL\n"; + + if ( !$node->hasChildNodes() ) + return; + + foreach ($node->childNodes as $child) { + + $old_indent = $indent; + $indent .= " "; + print_node_r($child); + $indent = $old_indent; + } +} + +function err_handler($errno, $errstr, $errfile, $errline) { + echo "Error ($errno) on line $errline: $errstr\n"; +} + +// Record 'DocumentFragment is empty' warnings +set_error_handler("err_handler", E_WARNING); + +$xml = new DomDocument(); + +$p = $xml->createElement("p"); + +$p->appendChild($t1 = $xml->createTextNode(" t1 ")); +$p->appendChild($b = $xml->createElement("b")); +$b->appendChild($xml->createTextNode("X")); +$p->appendChild($t2 = $xml->createTextNode(" t2 ")); +$p->appendChild($xml->createTextNode(" xxx ")); + +print_node_r($p); + +echo "\nAppend t1 to p:\n"; +$ret = $p->appendChild($t1); + +print_node_r($p); +echo "\n"; + +echo "t1 == ret: "; +var_dump( $t1 === $ret ); + + +$d = $xml->createElement("div"); +$d->appendChild($t3 = $xml->createTextNode(" t3 ")); +$d->appendChild($b = $xml->createElement("b")); +$b->appendChild($xml->createElement("X")); +$d->appendChild($t4 = $xml->createTextNode(" t4 ")); +$d->appendChild($xml->createTextNode(" xxx ")); + +echo "\ndiv:\n"; +print_node_r($d); + +echo "\nInsert t4 before t3:\n"; + +$ret = $d->insertBefore($t4, $t3); + +print_node_r($d); +echo "\n"; + +$frag = $xml->createDocumentFragment(); + +$t5 = $frag->appendChild($xml->createTextNode(" t5 ")); +$frag->appendChild($i = $xml->createElement("i")); +$i->appendChild($xml->createTextNode(" frob ")); +$frag->appendChild($xml->createTextNOde(" t6 ")); + +echo "\np:\n"; +print_node_r($p); +echo "\nFragment:\n"; +print_node_r($frag); + +echo "\nAppending fragment to p:\n"; +$p->appendChild($frag); + +print_node_r($p); +echo "\nFragment:\n"; +print_node_r($frag); + +echo "\ndiv:\n"; +print_node_r($d); +echo "\nInserting fragment before t4\n"; +$d->insertBefore($frag, $t4); +print_node_r($d); + +echo "\np:\n"; +print_node_r($p); + +?> +--EXPECT-- + +name (value): p ( t1 X t2 xxx ) +parent: NULL +previousSibling: NULL +nextSibling: NULL + + name (value): #text ( t1 ) + parent: name (value): p ( t1 X t2 xxx ) + previousSibling: NULL + nextSibling: name (value): b (X) + + name (value): b (X) + parent: name (value): p ( t1 X t2 xxx ) + previousSibling: name (value): #text ( t1 ) + nextSibling: name (value): #text ( t2 ) + + name (value): #text (X) + parent: name (value): b (X) + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( t2 ) + parent: name (value): p ( t1 X t2 xxx ) + previousSibling: name (value): b (X) + nextSibling: name (value): #text ( xxx ) + + name (value): #text ( xxx ) + parent: name (value): p ( t1 X t2 xxx ) + previousSibling: name (value): #text ( t2 ) + nextSibling: NULL + +Append t1 to p: + +name (value): p (X t2 xxx t1 ) +parent: NULL +previousSibling: NULL +nextSibling: NULL + + name (value): b (X) + parent: name (value): p (X t2 xxx t1 ) + previousSibling: NULL + nextSibling: name (value): #text ( t2 ) + + name (value): #text (X) + parent: name (value): b (X) + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( t2 ) + parent: name (value): p (X t2 xxx t1 ) + previousSibling: name (value): b (X) + nextSibling: name (value): #text ( xxx ) + + name (value): #text ( xxx ) + parent: name (value): p (X t2 xxx t1 ) + previousSibling: name (value): #text ( t2 ) + nextSibling: name (value): #text ( t1 ) + + name (value): #text ( t1 ) + parent: name (value): p (X t2 xxx t1 ) + previousSibling: name (value): #text ( xxx ) + nextSibling: NULL + +t1 == ret: bool(true) + +div: + +name (value): div ( t3 t4 xxx ) +parent: NULL +previousSibling: NULL +nextSibling: NULL + + name (value): #text ( t3 ) + parent: name (value): div ( t3 t4 xxx ) + previousSibling: NULL + nextSibling: name (value): b () + + name (value): b () + parent: name (value): div ( t3 t4 xxx ) + previousSibling: name (value): #text ( t3 ) + nextSibling: name (value): #text ( t4 ) + + name (value): X () + parent: name (value): b () + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( t4 ) + parent: name (value): div ( t3 t4 xxx ) + previousSibling: name (value): b () + nextSibling: name (value): #text ( xxx ) + + name (value): #text ( xxx ) + parent: name (value): div ( t3 t4 xxx ) + previousSibling: name (value): #text ( t4 ) + nextSibling: NULL + +Insert t4 before t3: + +name (value): div ( t4 t3 xxx ) +parent: NULL +previousSibling: NULL +nextSibling: NULL + + name (value): #text ( t4 ) + parent: name (value): div ( t4 t3 xxx ) + previousSibling: NULL + nextSibling: name (value): #text ( t3 ) + + name (value): #text ( t3 ) + parent: name (value): div ( t4 t3 xxx ) + previousSibling: name (value): #text ( t4 ) + nextSibling: name (value): b () + + name (value): b () + parent: name (value): div ( t4 t3 xxx ) + previousSibling: name (value): #text ( t3 ) + nextSibling: name (value): #text ( xxx ) + + name (value): X () + parent: name (value): b () + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( xxx ) + parent: name (value): div ( t4 t3 xxx ) + previousSibling: name (value): b () + nextSibling: NULL + + +p: + +name (value): p (X t2 xxx t1 ) +parent: NULL +previousSibling: NULL +nextSibling: NULL + + name (value): b (X) + parent: name (value): p (X t2 xxx t1 ) + previousSibling: NULL + nextSibling: name (value): #text ( t2 ) + + name (value): #text (X) + parent: name (value): b (X) + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( t2 ) + parent: name (value): p (X t2 xxx t1 ) + previousSibling: name (value): b (X) + nextSibling: name (value): #text ( xxx ) + + name (value): #text ( xxx ) + parent: name (value): p (X t2 xxx t1 ) + previousSibling: name (value): #text ( t2 ) + nextSibling: name (value): #text ( t1 ) + + name (value): #text ( t1 ) + parent: name (value): p (X t2 xxx t1 ) + previousSibling: name (value): #text ( xxx ) + nextSibling: NULL + +Fragment: + +name (value): #document-fragment () +parent: NULL +previousSibling: NULL +nextSibling: NULL + + name (value): #text ( t5 ) + parent: name (value): #document-fragment () + previousSibling: NULL + nextSibling: name (value): i ( frob ) + + name (value): i ( frob ) + parent: name (value): #document-fragment () + previousSibling: name (value): #text ( t5 ) + nextSibling: name (value): #text ( t6 ) + + name (value): #text ( frob ) + parent: name (value): i ( frob ) + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( t6 ) + parent: name (value): #document-fragment () + previousSibling: name (value): i ( frob ) + nextSibling: NULL + +Appending fragment to p: + +name (value): p (X t2 xxx t1 t5 frob t6 ) +parent: NULL +previousSibling: NULL +nextSibling: NULL + + name (value): b (X) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: NULL + nextSibling: name (value): #text ( t2 ) + + name (value): #text (X) + parent: name (value): b (X) + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( t2 ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): b (X) + nextSibling: name (value): #text ( xxx ) + + name (value): #text ( xxx ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): #text ( t2 ) + nextSibling: name (value): #text ( t1 ) + + name (value): #text ( t1 ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): #text ( xxx ) + nextSibling: name (value): #text ( t5 ) + + name (value): #text ( t5 ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): #text ( t1 ) + nextSibling: name (value): i ( frob ) + + name (value): i ( frob ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): #text ( t5 ) + nextSibling: name (value): #text ( t6 ) + + name (value): #text ( frob ) + parent: name (value): i ( frob ) + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( t6 ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): i ( frob ) + nextSibling: NULL + +Fragment: + +name (value): #document-fragment () +parent: NULL +previousSibling: NULL +nextSibling: NULL + +div: + +name (value): div ( t4 t3 xxx ) +parent: NULL +previousSibling: NULL +nextSibling: NULL + + name (value): #text ( t4 ) + parent: name (value): div ( t4 t3 xxx ) + previousSibling: NULL + nextSibling: name (value): #text ( t3 ) + + name (value): #text ( t3 ) + parent: name (value): div ( t4 t3 xxx ) + previousSibling: name (value): #text ( t4 ) + nextSibling: name (value): b () + + name (value): b () + parent: name (value): div ( t4 t3 xxx ) + previousSibling: name (value): #text ( t3 ) + nextSibling: name (value): #text ( xxx ) + + name (value): X () + parent: name (value): b () + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( xxx ) + parent: name (value): div ( t4 t3 xxx ) + previousSibling: name (value): b () + nextSibling: NULL + +Inserting fragment before t4 +Error (2) on line 109: DOMNode::insertBefore(): Document Fragment is empty + +name (value): div ( t4 t3 xxx ) +parent: NULL +previousSibling: NULL +nextSibling: NULL + + name (value): #text ( t4 ) + parent: name (value): div ( t4 t3 xxx ) + previousSibling: NULL + nextSibling: name (value): #text ( t3 ) + + name (value): #text ( t3 ) + parent: name (value): div ( t4 t3 xxx ) + previousSibling: name (value): #text ( t4 ) + nextSibling: name (value): b () + + name (value): b () + parent: name (value): div ( t4 t3 xxx ) + previousSibling: name (value): #text ( t3 ) + nextSibling: name (value): #text ( xxx ) + + name (value): X () + parent: name (value): b () + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( xxx ) + parent: name (value): div ( t4 t3 xxx ) + previousSibling: name (value): b () + nextSibling: NULL + +p: + +name (value): p (X t2 xxx t1 t5 frob t6 ) +parent: NULL +previousSibling: NULL +nextSibling: NULL + + name (value): b (X) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: NULL + nextSibling: name (value): #text ( t2 ) + + name (value): #text (X) + parent: name (value): b (X) + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( t2 ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): b (X) + nextSibling: name (value): #text ( xxx ) + + name (value): #text ( xxx ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): #text ( t2 ) + nextSibling: name (value): #text ( t1 ) + + name (value): #text ( t1 ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): #text ( xxx ) + nextSibling: name (value): #text ( t5 ) + + name (value): #text ( t5 ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): #text ( t1 ) + nextSibling: name (value): i ( frob ) + + name (value): i ( frob ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): #text ( t5 ) + nextSibling: name (value): #text ( t6 ) + + name (value): #text ( frob ) + parent: name (value): i ( frob ) + previousSibling: NULL + nextSibling: NULL + + name (value): #text ( t6 ) + parent: name (value): p (X t2 xxx t1 t5 frob t6 ) + previousSibling: name (value): i ( frob ) + nextSibling: NULL diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug28817.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug28817.phpt new file mode 100644 index 0000000000000..a250bff03eb41 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug28817.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #28817 (properties in extended class) +--SKIPIF-- + +--FILE-- +p_array[] = 'bonus'; + $this->p_array[] = 'vir'; + $this->p_array[] = 'semper'; + $this->p_array[] = 'tiro'; + + $this->p_variable = 'Cessante causa cessat effectus'; + } +} + +$z=new z(); +var_dump($z->p_array); +var_dump($z->p_variable); +?> +--EXPECTF-- +array(4) { + [0]=> + string(5) "bonus" + [1]=> + string(3) "vir" + [2]=> + string(6) "semper" + [3]=> + string(4) "tiro" +} +string(30) "Cessante causa cessat effectus" diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug32615.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug32615.phpt new file mode 100644 index 0000000000000..c6f2b5bf86448 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug32615.phpt @@ -0,0 +1,84 @@ +--TEST-- +Bug #32615 (Replacing and inserting Fragments) +--SKIPIF-- + +--FILE-- +createDocumentFragment(); +$frag->appendChild(new DOMElement('root')); +$dom->appendChild($frag); +$root = $dom->documentElement; + +$frag->appendChild(new DOMElement('first')); +$root->appendChild($frag); + +$frag->appendChild(new DOMElement('second')); +$root->appendChild($frag); + +$node = $dom->createElement('newfirst'); +$frag->appendChild($node); +$root->replaceChild($frag, $root->firstChild); + +unset($frag); +$frag = $dom->createDocumentFragment(); + +$frag->appendChild(new DOMElement('newsecond')); +$root->replaceChild($frag, $root->lastChild); + +$node = $frag->appendChild(new DOMElement('fourth')); +$root->insertBefore($frag, NULL); + +$frag->appendChild(new DOMElement('third')); +$node = $root->insertBefore($frag, $node); + +$frag->appendChild(new DOMElement('start')); +$root->insertBefore($frag, $root->firstChild); + +$frag->appendChild(new DOMElement('newthird')); +$root->replaceChild($frag, $node); + +$frag->appendChild(new DOMElement('newfourth')); +$root->replaceChild($frag, $root->lastChild); + +$frag->appendChild(new DOMElement('first')); +$root->replaceChild($frag, $root->firstChild->nextSibling); + +$root->removeChild($root->firstChild); + +echo $dom->saveXML()."\n"; + +while ($root->hasChildNodes()) { + $root->removeChild($root->firstChild); +} + +$frag->appendChild(new DOMElement('first')); +$root->insertBefore($frag, $root->firstChild); + +$node = $frag->appendChild(new DOMElement('fourth')); +$root->appendChild($frag); + +$frag->appendChild(new DOMElement('second')); +$frag->appendChild(new DOMElement('third')); +$root->insertBefore($frag, $node); + +echo $dom->saveXML()."\n"; + +$frag = $dom->createDocumentFragment(); +$root = $dom->documentElement; +$root->replaceChild($frag, $root->firstChild); + +echo $dom->saveXML(); + +?> +--EXPECT-- + + + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug34276.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug34276.phpt new file mode 100644 index 0000000000000..fd265e58e4072 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug34276.phpt @@ -0,0 +1,43 @@ +--TEST-- +Bug #34276 setAttributeNS and default namespace +--SKIPIF-- + +--FILE-- + + +HERE; + +function dump($elems) { + foreach ($elems as $elem) { + var_dump($elem->nodeName); + dump($elem->childNodes); + } +} + +$dom = new DOMDocument(); +$dom->loadXML($xml); +$foo = $dom->documentElement; +var_dump($foo->hasAttributeNS('http://www.example.com/ns/foo', 'attra')); +var_dump($foo->getAttributeNS('http://www.example.com/ns/foo', 'attra')); + +$foo->setAttributeNS('http://www.example.com/ns/foo', 'attra', 'attranew'); +$foo->setAttributeNS('http://www.example.com/ns/fubar', 'attrb', 'attrbnew'); +$foo->setAttributeNS('http://www.example.com/ns/foo', 'attrc', 'attrc'); + +var_dump($foo->getAttributeNS('http://www.example.com/ns/foo', 'attra')); +var_dump($foo->getAttributeNS('http://www.example.com/ns/fubar', 'attrb')); +var_dump($foo->getAttributeNS('http://www.example.com/ns/foo', 'attrc')); + +print $dom->saveXML(); +?> +--EXPECT-- +bool(false) +string(0) "" +string(8) "attranew" +string(8) "attrbnew" +string(5) "attrc" + + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug35342.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug35342.phpt new file mode 100644 index 0000000000000..3248c7339835e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug35342.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #35342 isset(DOMNodeList->length) returns false +--SKIPIF-- + +--FILE-- +loadXML("foobarfoobar#2"); + +$nodelist = $dom->getElementsByTagName("foo"); + +var_dump($nodelist->length, isset($nodelist->length), isset($nodelist->foo)); +var_dump(empty($nodelist->length), empty($nodelist->foo)); +?> +--EXPECT-- +int(2) +bool(true) +bool(false) +bool(false) +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug36756.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug36756.phpt new file mode 100644 index 0000000000000..af7488d3fdf66 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug36756.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #36756 (DOMDocument::removeChild corrupts node) +--SKIPIF-- + +--FILE-- +loadXML(''); +$xpath = new DOMXpath($dom); +$node = $xpath->query('/root')->item(0); +echo $node->nodeName . "\n"; +$dom->removeChild($GLOBALS['dom']->firstChild); +echo "nodeType: " . $node->nodeType . "\n"; + +/* Node gets destroyed during removeChild */ +$dom->loadXML(''); +$xpath = new DOMXpath($dom); +$node = $xpath->query('//child')->item(0); +echo $node->nodeName . "\n"; +$GLOBALS['dom']->removeChild($GLOBALS['dom']->firstChild); + +echo "nodeType: " . $node->nodeType . "\n"; + +?> +--EXPECTF-- +root +nodeType: 1 +child + +Warning: Couldn't fetch DOMElement. Node no longer exists in %sbug36756.php on line %d + +Notice: Undefined property: DOMElement::$nodeType in %sbug36756.php on line %d +nodeType: diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug37277.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug37277.phpt new file mode 100644 index 0000000000000..112b9f46559c0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug37277.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #37277 (cloning Dom Documents or Nodes does not work) +--SKIPIF-- + +--FILE-- +'; +$dom1->loadXml($xml); + +$node = clone $dom1->documentElement; + +$dom2 = new DomDocument('1.0', 'UTF-8'); +$dom2->appendChild($dom2->importNode($node->cloneNode(true), TRUE)); + +print $dom2->saveXML(); + + +?> +--EXPECT-- + + + + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug37456.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug37456.phpt new file mode 100644 index 0000000000000..5f0fc28778362 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug37456.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #37456 (DOMElement->setAttribute() loops forever) +--SKIPIF-- + +--FILE-- +resolveExternals = true; +$doc->load(dirname(__FILE__)."/dom.xml"); + +$root = $doc->getElementsByTagName('foo')->item(0); +$root->setAttribute('bar', '>'); +$attr = $root->setAttribute('bar', 'newval'); +print $attr->nodeValue; + + +?> +--EXPECT-- + +newval + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug38438.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug38438.phpt new file mode 100644 index 0000000000000..f51252832c664 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug38438.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #38438 (DOMNodeList->item(0) segfault on empty NodeList) +--SKIPIF-- + +--FILE-- +item(0)); +echo "OK\n"; +?> +--EXPECT-- +NULL +OK diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug38474.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug38474.phpt new file mode 100644 index 0000000000000..7febd22d3146e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug38474.phpt @@ -0,0 +1,41 @@ +--TEST-- +Bug #38474 (getAttribute select attribute by order, even when prefixed) (OK to fail with libxml2 < 2.6.2x) +--SKIPIF-- + +--FILE-- +'; +$dom = new DomDocument(); +$dom->loadXML($xml); +echo $dom->firstChild->getAttribute('type')."\n"; +echo $dom->firstChild->getAttribute('pre:type')."\n"; + +$dom->firstChild->setAttribute('pre:type', 'bar2'); +$dom->firstChild->setAttribute('type', 'foo2'); +$dom->firstChild->setAttribute('post:type', 'baz'); +$dom->firstChild->setAttribute('new:type', 'baz2'); + +echo $dom->firstChild->getAttribute('type')."\n"; +echo $dom->firstChild->getAttribute('pre:type')."\n"; +echo $dom->firstChild->getAttribute('post:type')."\n"; + +$dom->firstChild->removeAttribute('pre:type'); +$dom->firstChild->removeAttribute('type'); + +echo $dom->firstChild->getAttribute('type')."\n"; +echo $dom->firstChild->getAttribute('pre:type')."\n"; +echo $dom->firstChild->getAttribute('post:type')."\n"; +echo $dom->firstChild->getAttribute('new:type'); +?> +--EXPECT-- +foo +bar +foo2 +bar2 +baz + + +baz +baz2 diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug38850.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug38850.phpt new file mode 100644 index 0000000000000..b0de90b88ded7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug38850.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #38850 (lookupNamespaceURI does not return default namespace) +--SKIPIF-- + +--FILE-- + + +HERE; + +$doc = new DOMDocument(); +$doc->loadXML($xml); + +$root = $doc->documentElement; + +print $root->lookupNamespaceURI(NULL); + + +?> +--EXPECT-- +http://www.example.com/ns/foo diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug38949.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug38949.phpt new file mode 100644 index 0000000000000..4c81d9b731986 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug38949.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #38949 (Cannot get xmlns value attribute) +--SKIPIF-- + +--FILE-- +load(dirname(__FILE__)."/nsdoc.xml"); + +$root = $doc->documentElement; + +echo $root->getAttribute("xmlns")."\n"; +echo $root->getAttribute("xmlns:ns2")."\n"; + +$child = $root->firstChild->nextSibling; +echo $child->getAttribute("xmlns")."\n"; +echo $child->getAttribute("xmlns:ns2")."\n"; + +echo "DONE\n"; +?> +--EXPECT-- +http://ns +http://ns2 + + +DONE diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug40836.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug40836.phpt new file mode 100644 index 0000000000000..b96b39cfe9fc4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug40836.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #40836 (Segfault in insertBefore) +--SKIPIF-- + +--FILE-- +preserveWhiteSpace = false; +$xml = (binary)' + + + 2007-02-14T00:00:00+01:00 + +
    +

    paragraph

    +
    +
    +
    +
    '; +$dom->loadXML($xml); +$entry = $dom->getElementsByTagNameNS("http://www.w3.org/2005/Atom", "entry")->item(0); +$contentNode = $entry->getElementsByTagName("content")->item(0)->firstChild; +$dateNode = $entry->getElementsByTagName("updated")->item(0)->firstChild; +$contentNode->firstChild->insertBefore($dateNode); +echo $dom->saveXML(); +?> +--EXPECT-- + +

    paragraph2007-02-14T00:00:00+01:00

    diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug41257.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug41257.phpt new file mode 100644 index 0000000000000..edf62a53a3b50 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug41257.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #41257 (lookupNamespaceURI does not work as expected) +--SKIPIF-- + +--FILE-- +load(dirname(__FILE__)."/nsdoc.xml"); + +$root = $doc->documentElement; + +$duri = $doc->lookupNamespaceURI("ns2")."\n"; +$euri = $root->lookupNamespaceURI("ns2")."\n"; + +var_dump($duri == $euri); + +$dpref = $doc->lookupPrefix("http://ns2")."\n"; +$epref = $root->lookupPrefix("http://ns2")."\n"; + +var_dump($dpref == $epref); + +$disdef = $doc->isDefaultNamespace("http://ns")."\n"; +$eisdef = $root->isDefaultNamespace("http://ns")."\n"; + +var_dump($dpref === $epref); +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug41374.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug41374.phpt new file mode 100644 index 0000000000000..21fc3454cdd8b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug41374.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #41374 (wholetext concats values of wrong nodes) +--SKIPIF-- + +--FILE-- + +foobaz +EOXML; + +$doc = new DOMDocument(); +$doc->loadXML($xml); + +$root = $doc->documentElement; +$foo = $root->firstChild; + +var_dump($foo->wholeText == "foo"); + +$bar = $root->insertBefore($doc->createTextNode("bar"), $foo->nextSibling); + +var_dump($foo->wholeText == "foobar"); +var_dump($foo->wholeText == $bar->wholeText); +$baz = $bar->nextSibling->nextSibling; + +var_dump($baz->wholeText === $foo->wholeText); +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/bug42082.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/bug42082.phpt new file mode 100644 index 0000000000000..3e20a6b137860 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/bug42082.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #42082 (NodeList length zero should be empty) +--FILE-- +query('*'); +var_dump($nodes); +var_dump($nodes->length); +$length = $nodes->length; +var_dump(empty($nodes->length), empty($lenght)); + +$doc->loadXML(""); +var_dump($doc->firstChild->nodeValue, empty($doc->firstChild->nodeValue), isset($doc->firstChild->nodeValue)); +var_dump(empty($doc->nodeType), empty($doc->firstChild->nodeType)) +?> +--EXPECTF-- +object(DOMNodeList)#%d (0) { +} +int(0) +bool(true) +bool(true) +string(0) "" +bool(true) +bool(true) +bool(false) +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/canonicalization.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/canonicalization.phpt new file mode 100644 index 0000000000000..cf1a81f24a95c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/canonicalization.phpt @@ -0,0 +1,102 @@ +--TEST-- +Test: Canonicalization - C14N() +--SKIPIF-- + +--FILE-- + + + + + + + + + +EOXML; + +$dom = new DOMDocument(); +$dom->loadXML($xml); +$doc = $dom->documentElement->firstChild; + +/* inclusive/without comments first child element of doc element is context. */ +echo $doc->C14N()."\n\n"; + +/* exclusive/without comments first child element of doc element is context. */ +echo $doc->c14N(TRUE)."\n\n"; + +/* inclusive/with comments first child element of doc element is context. */ +echo $doc->C14N(FALSE, TRUE)."\n\n"; + +/* exclusive/with comments first child element of doc element is context. */ +echo $doc->C14N(TRUE, TRUE)."\n\n"; + +/* exclusive/without comments using xpath query. */ +echo $doc->c14N(TRUE, FALSE, array('query'=>'(//. | //@* | //namespace::*)'))."\n\n"; + +/* exclusive/without comments first child element of doc element is context. + using xpath query with registered namespace. + test namespace prefix is also included. */ +echo $doc->c14N(TRUE, FALSE, + array('query'=>'(//a:contain | //a:bar | .//namespace::*)', + 'namespaces'=>array('a'=>'http://www.example.com/ns/foo')), + array('test'))."\n\n"; + +/* exclusive/without comments first child element of doc element is context. + test namespace prefix is also included */ +echo $doc->C14N(TRUE, FALSE, NULL, array('test')); +?> +--EXPECTF-- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom.ent b/phpt/tests/php-5.2.5/ext/dom/tests/dom.ent new file mode 100644 index 0000000000000..987ff9dc0fab6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom.ent @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom.xml b/phpt/tests/php-5.2.5/ext/dom/tests/dom.xml new file mode 100644 index 0000000000000..09ac674e55d83 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom.xml @@ -0,0 +1,8 @@ + + +%incent; +]> + + + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom001.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom001.phpt new file mode 100644 index 0000000000000..a0c78fbb0a19f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom001.phpt @@ -0,0 +1,275 @@ +--TEST-- +Test 1: Accessing single node +--SKIPIF-- + +--FILE-- +loadxml($xmlstr); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} + +// children() of of document would result in a memleak +//$children = $dom->children(); +//print_node_list($children); + +echo "--------- root\n"; +$rootnode = $dom->documentElement; +print_node($rootnode); + +echo "--------- children of root\n"; +$children = $rootnode->childNodes; +print_node_list($children); + +// The last node should be identical with the last entry in the children array +echo "--------- last\n"; +$last = $rootnode->lastChild; +print_node($last); + +// The parent of this last node is the root again +echo "--------- parent\n"; +$parent = $last->parentNode; +print_node($parent); + +// The children of this parent are the same children as one above +echo "--------- children of parent\n"; +$children = $parent->childNodes; +print_node_list($children); + +echo "--------- creating a new attribute\n"; +//This is worthless +//$attr = $dom->createAttribute("src", "picture.gif"); +//print_r($attr); + +//$rootnode->set_attributeNode($attr); +$attr = $rootnode->setAttribute("src", "picture.gif"); +$attr = $rootnode->getAttribute("src"); +print_r($attr); +print "\n"; + +echo "--------- Get Attribute Node\n"; +$attr = $rootnode->getAttributeNode("src"); +print_node($attr); + +echo "--------- Remove Attribute Node\n"; +$attr = $rootnode->removeAttribute("src"); +print "Removed " . $attr . " attributes.\n"; + +echo "--------- attributes of rootnode\n"; +$attrs = $rootnode->attributes; +print_node_list($attrs); + +echo "--------- children of an attribute\n"; +$children = $attrs->item(0)->childNodes; +print_node_list($children); + +echo "--------- Add child to root\n"; +$myelement = new domElement("Silly", "Symphony"); +$newchild = $rootnode->appendChild($myelement); +print_node($newchild); +print $dom->saveXML(); +print "\n"; + +echo "--------- Find element by tagname\n"; +echo " Using dom\n"; +$children = $dom->getElementsByTagname("Silly"); +print_node_list($children); + +echo " Using elem\n"; +$children = $rootnode->getElementsByTagName("Silly"); +print_node_list($children); + +echo "--------- Unlink Node\n"; +print_node($children->item(0)); +$rootnode->removeChild($children->item(0)); +print_node_list($rootnode->childNodes); +print $dom->savexml(); + +echo "--------- Find element by id\n"; +print ("Not implemented\n"); + +echo "--------- Check various node_name return values\n"; +print ("Not needed\n"); + +?> +--EXPECT-- +Test 1: accessing single nodes from php +--------- root +Node Name: chapter +Node Type: 1 +Num Children: 4 + +--------- children of root +Node Name: title +Node Type: 1 +Num Children: 1 +Node Content: Title + +Node Name: #text +Node Type: 3 +Num Children: 0 +Node Content: + + +Node Name: para +Node Type: 1 +Num Children: 7 + +Node Name: #text +Node Type: 3 +Num Children: 0 +Node Content: + + +--------- last +Node Name: #text +Node Type: 3 +Num Children: 0 +Node Content: + + +--------- parent +Node Name: chapter +Node Type: 1 +Num Children: 4 + +--------- children of parent +Node Name: title +Node Type: 1 +Num Children: 1 +Node Content: Title + +Node Name: #text +Node Type: 3 +Num Children: 0 +Node Content: + + +Node Name: para +Node Type: 1 +Num Children: 7 + +Node Name: #text +Node Type: 3 +Num Children: 0 +Node Content: + + +--------- creating a new attribute +picture.gif +--------- Get Attribute Node +Node Name: src +Node Type: 2 +Num Children: 1 +Node Content: picture.gif + +--------- Remove Attribute Node +Removed 1 attributes. +--------- attributes of rootnode +Node Name: language +Node Type: 2 +Num Children: 1 +Node Content: en + +--------- children of an attribute +Node Name: #text +Node Type: 3 +Num Children: 0 +Node Content: en + +--------- Add child to root +Node Name: Silly +Node Type: 1 +Num Children: 1 +Node Content: Symphony + + + +]> + +Title + +&sp; + + + + +a1b1c1 +a2c2 +a3b3c3 + + + + +Symphony + +--------- Find element by tagname + Using dom +Node Name: Silly +Node Type: 1 +Num Children: 1 +Node Content: Symphony + + Using elem +Node Name: Silly +Node Type: 1 +Num Children: 1 +Node Content: Symphony + +--------- Unlink Node +Node Name: Silly +Node Type: 1 +Num Children: 1 +Node Content: Symphony + +Node Name: title +Node Type: 1 +Num Children: 1 +Node Content: Title + +Node Name: #text +Node Type: 3 +Num Children: 0 +Node Content: + + +Node Name: para +Node Type: 1 +Num Children: 7 + +Node Name: #text +Node Type: 3 +Num Children: 0 +Node Content: + + + + +]> + +Title + +&sp; + + + + +a1b1c1 +a2c2 +a3b3c3 + + + + + +--------- Find element by id +Not implemented +--------- Check various node_name return values +Not needed diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom002.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom002.phpt new file mode 100644 index 0000000000000..3343a1774ef9d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom002.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test 2: getElementsByTagName() / getElementsByTagNameNS() +--SKIPIF-- + +--FILE-- + + + + + + + +HERE; + +function dump($elems) { + foreach ($elems as $elem) { + var_dump($elem->nodeName); + dump($elem->childNodes); + } +} + +$dom = new DOMDocument(); +$dom->loadXML($xml); +$doc = $dom->documentElement; +dump($dom->getElementsByTagName('bar')); +dump($doc->getElementsByTagName('bar')); +dump($dom->getElementsByTagNameNS('http://www.example.com/ns/fubar', 'bar')); +dump($doc->getElementsByTagNameNS('http://www.example.com/ns/fubar', 'bar')); +?> +--EXPECT-- +string(3) "bar" +string(5) "test1" +string(3) "bar" +string(5) "test2" +string(9) "fubar:bar" +string(5) "test3" +string(9) "fubar:bar" +string(5) "test4" +string(3) "bar" +string(5) "test1" +string(3) "bar" +string(5) "test2" +string(9) "fubar:bar" +string(5) "test3" +string(9) "fubar:bar" +string(5) "test4" +string(9) "fubar:bar" +string(5) "test3" +string(9) "fubar:bar" +string(5) "test4" +string(9) "fubar:bar" +string(5) "test3" +string(9) "fubar:bar" +string(5) "test4" diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom003.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom003.phpt new file mode 100644 index 0000000000000..1eb6d4a4f73ed --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom003.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test 3: Exception Test +--SKIPIF-- + +--FILE-- +load(dirname(__FILE__)."/book.xml"); +$rootNode = $dom->documentElement; +print "--- Catch exception with try/catch\n"; +try { + $rootNode->appendChild($rootNode); +} catch (domexception $e) { + var_dump($e); +} +print "--- Don't catch exception with try/catch\n"; +$rootNode->appendChild($rootNode); + + +?> +--EXPECTF-- +--- Catch exception with try/catch +object(DOMException)#%d (6) { + ["message:protected"]=> + string(23) "Hierarchy Request Error" + ["string:private"]=> + string(0) "" + ["file:protected"]=> + string(%d) "%sdom003.php" + ["line:protected"]=> + int(8) + ["trace:private"]=> + array(1) { + [0]=> + array(6) { + ["file"]=> + string(%d) "%sdom003.php" + ["line"]=> + int(8) + ["function"]=> + string(11) "appendChild" + ["class"]=> + string(7) "DOMNode" + ["type"]=> + string(2) "->" + ["args"]=> + array(1) { + [0]=> + object(DOMElement)#%d (0) { + } + } + } + } + ["code"]=> + int(3) +} +--- Don't catch exception with try/catch + +Fatal error: Uncaught exception 'DOMException' with message 'Hierarchy Request Error' in %sdom003.php:%d +Stack trace: +#0 %sdom003.php(13): DOMNode->appendChild(Object(DOMElement)) +#1 {main} + thrown in %sdom003.php on line %d diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom004.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom004.phpt new file mode 100644 index 0000000000000..82b7915f6f630 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom004.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test 4: Streams Test +--SKIPIF-- + +--FILE-- +load("compress.zlib://".dirname(__FILE__)."/book.xml.gz"); +print $dom->saveXML(); + +--EXPECT-- + + + + The Grapes of Wrath + John Steinbeck + + + The Pearl + John Steinbeck + + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom005.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom005.phpt new file mode 100644 index 0000000000000..249869eff2f25 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom005.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test 5: HTML Test +--SKIPIF-- + +--FILE-- +loadHTMLFile(dirname(__FILE__)."/test.html"); +print "--- save as XML\n"; + +print adjustDoctype($dom->saveXML()); +print "--- save as HTML\n"; + +print adjustDoctype($dom->saveHTML()); + +function adjustDoctype($xml) { + return str_replace(array("DOCTYPE HTML",'

    ','

    '),array("DOCTYPE html",'',''),$xml); +} + +--EXPECT-- +--- save as XML + + +Hello world +This is a not well-formed
    +html files with undeclared entities  + +--- save as HTML + + +Hello world + +This is a not well-formed
    +html files with undeclared entities  + + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom006.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom006.phpt new file mode 100644 index 0000000000000..b8e8ed172440a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom006.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test 6: Extends Test +--SKIPIF-- + +--FILE-- +createElement("title"); + $titleElement->appendChild($this->createTextNode($title)); + $authorElement = $this->createElement("author"); + $authorElement->appendChild($this->createTextNode($author)); + + $bookElement = $this->createElement("book"); + + $bookElement->appendChild($titleElement); + $bookElement->appendChild($authorElement); + $this->documentElement->appendChild($bookElement); + } + +} + +$dom = new books; + +$dom->load(dirname(__FILE__)."/book.xml"); +$dom->addBook("PHP de Luxe", "Richard Samar, Christian Stocker"); +print $dom->saveXML(); +--EXPECT-- + + + + The Grapes of Wrath + John Steinbeck + + + The Pearl + John Steinbeck + +PHP de LuxeRichard Samar, Christian Stocker diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom007.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom007.phpt new file mode 100644 index 0000000000000..649d630336378 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom007.phpt @@ -0,0 +1,99 @@ +--TEST-- +Test 7: DTD tests +--SKIPIF-- + +--FILE-- + + + + + + + + + + + + +]> + + + Basic Languages + Introduction to Languages + + + French I + Introduction to French + + + + +EOXML; + +$dom = new DOMDocument(); +$dom->loadXML($xml); + +$dtd = $dom->doctype; + +/* Notation Tests */ +$nots = $dtd->notations; + +$length = $nots->length; +echo "Length: ".$length."\n"; + +foreach ($nots AS $key=>$node) { + echo "Key $key: ".$node->nodeName." (".$node->systemId.") (".$node->publicId.")\n"; +} +print "\n"; +for($x=0; $x < $length; $x++) { + echo "Index $x: ".$nots->item($x)->nodeName." (".$nots->item($x)->systemId.") (".$nots->item($x)->publicId.")\n"; +} + +echo "\n"; +$node = $nots->getNamedItem('xxx'); +var_dump($node); + +echo "\n"; +/* Entity Decl Tests */ +$ents = $dtd->entities; +$length = $ents->length; +echo "Length: ".$length."\n"; +foreach ($ents AS $key=>$node) { + echo "Key: $key Name: ".$node->nodeName."\n"; +} +echo "\n"; +for($x=0; $x < $length; $x++) { + echo "Index $x: ".$ents->item($x)->nodeName."\n"; +} + +echo "\n"; +$node = $ents->item(3); +var_dump($node); +$node = $ents->getNamedItem('xxx'); +var_dump($node); + + +--EXPECT-- +Length: 1 +Key GIF: GIF (image/gif) (-) + +Index 0: GIF (image/gif) (-) + +NULL + +Length: 3 +Key: test Name: test +Key: rdf Name: rdf +Key: myimage Name: myimage + +Index 0: test +Index 1: rdf +Index 2: myimage + +NULL +NULL diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom_create_element.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom_create_element.phpt new file mode 100644 index 0000000000000..3f307099bb12b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom_create_element.phpt @@ -0,0 +1,394 @@ +--TEST-- +Test 1: Creating Elements with and without Namespaces +--SKIPIF-- + +--FILE-- +createElement('valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print " 2 DOMDocument::createElement('-invalid')\n"; +try { + $dom = new domDocument; + $dom->createElement('-invalid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print " 3 DOMDocument::createElement(' ')\n"; +try { + $dom = new domDocument; + $dom->createElement(' '); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print " 4 DOMDocument::createElement('prefix:valid')\n"; +try { + $dom = new domDocument; + $dom->createElement('prefix:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print " 5 DOMDocument::createElementNS('http://valid.com', 'valid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://valid.com', 'valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print " 6 DOMDocument::createElementNS('http://valid.com', 'prefix:valid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://valid.com', 'prefix:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print " 7 DOMDocument::createElementNS('http://valid.com', '-invalid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://valid.com', '-invalid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print " 8 DOMDocument::createElementNS('http://valid.com', 'prefix:-invalid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://valid.com', 'prefix:-invalid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print " 9 DOMDocument::createElementNS('', 'prefix:invalid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('', 'prefix:invalid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "10 DOMDocument::createElementNS('http://valid.com', 'prefix:valid:invalid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://valid.com', 'prefix:valid:invalid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "11 DOMDocument::createElementNS('http://valid.com', '-prefix:valid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://valid.com', '-prefix:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "12 DOMDocument::createElementNS('-', 'prefix:valid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('-', 'prefix:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + + +print "13 DOMElement::__construct('valid')\n"; +try { + $element = new DomElement('valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "14 DOMElement::__construct('-invalid')\n"; +try { + $element = new DomElement('-invalid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "15 DOMElement::__construct(' ')\n"; +try { + $element = new DomElement(' '); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "16 DOMElement::__construct('prefix:valid')\n"; +try { + $element = new DomElement('prefix:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "17 DOMElement::__construct('valid', '', 'http://valid.com')\n"; +try { + $element = new DomElement('valid', '', 'http://valid.com'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "18 DOMElement::__construct('prefix:valid', '', 'http://valid.com')\n"; +try { + $element = new DomElement('prefix:valid', '', 'http://valid.com'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "19 DOMElement::__construct('-invalid', '', 'http://valid.com')\n"; +try { + $element = new DomElement('-invalid', '', 'http://valid.com'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "20 DOMElement::__construct('prefix:-invalid', '', 'http://valid.com')\n"; +try { + $element = new DomElement('prefix:-invalid', '', 'http://valid.com'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "21 DOMElement::__construct('prefix:invalid', '', '')\n"; +try { + $element = new DomElement('prefix:invalid', '', ''); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "22 DOMElement::__construct('prefix:valid:invalid', '', 'http://valid.com')\n"; +try { + $element = new DomElement('prefix:valid:invalid', '', 'http://valid.com'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "23 DOMElement::__construct('-prefix:valid', '', 'http://valid.com')\n"; +try { + $element = new DomElement('-prefix:valid', '', 'http://valid.com'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "24 DOMElement::__construct('prefix:valid', '', '-')\n"; +try { + $element = new DomElement('prefix:valid', '', '-'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +/* the qualifiedName has a prefix and the namespaceURI is null */ + +print "25 DOMDocument::createElementNS('', 'prefix:valid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('', 'prefix:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +/* the qualifiedName has a prefix that is "xml" and the namespaceURI + is different from "http://www.w3.org/XML/1998/namespace" [XML Namespaces] */ + +print "26 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xml:valid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://wrong.namespaceURI.com', 'xml:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "27 DOMElement::__construct('xml:valid', '', 'http://wrong.namespaceURI.com')\n"; +try { + $element = new DomElement('xml:valid', '', 'http://wrong.namespaceURI.com'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +/* This is okay because we reuse the xml namespace from the document */ +print "28 DOMDocument::createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:valid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +/* This isn't because the xml namespace isn't there and we can't create it */ +print "29 DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace')\n"; +try { + $element = new DomElement('xml:valid', '', 'http://www.w3.org/XML/1998/namespace'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + + +/* the qualifiedName or its prefix is "xmlns" and the namespaceURI is + different from "http://www.w3.org/2000/xmlns/" */ + +print "30 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xmlns:valid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://wrong.namespaceURI.com', 'xmlns:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "31 DOMElement::__construct('xmlns:valid', '', 'http://wrong.namespaceURI.com')\n"; +try { + $element = new DomElement('xmlns:valid', '', 'http://wrong.namespaceURI.com'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "32 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:valid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "33 DOMElement::__construct('xmlns:valid', '', 'http://www.w3.org/2000/xmlns/')\n"; +try { + $element = new DomElement('xmlns:valid', '', 'http://www.w3.org/2000/xmlns/'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +/* the namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the + qualifiedName nor its prefix is "xmlns". */ + +print "34 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/', 'wrongprefix:valid')\n"; +try { + $dom = new domDocument; + $dom->createElementNS('http://www.w3.org/2000/xmlns/', 'wrongprefix:valid'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + +print "35 DOMElement::__construct('wrongprefix:valid', '', 'http://www.w3.org/2000/xmlns/')\n"; +try { + $element = new DomElement('wrongprefix:valid', '', 'http://www.w3.org/2000/xmlns/'); + print "valid\n"; +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} + + + +?> +--EXPECT-- + 1 DOMDocument::createElement('valid') +valid + 2 DOMDocument::createElement('-invalid') +Invalid Character Error + 3 DOMDocument::createElement(' ') +Invalid Character Error + 4 DOMDocument::createElement('prefix:valid') +valid + 5 DOMDocument::createElementNS('http://valid.com', 'valid') +valid + 6 DOMDocument::createElementNS('http://valid.com', 'prefix:valid') +valid + 7 DOMDocument::createElementNS('http://valid.com', '-invalid') +Namespace Error + 8 DOMDocument::createElementNS('http://valid.com', 'prefix:-invalid') +Namespace Error + 9 DOMDocument::createElementNS('', 'prefix:invalid') +Namespace Error +10 DOMDocument::createElementNS('http://valid.com', 'prefix:valid:invalid') +Namespace Error +11 DOMDocument::createElementNS('http://valid.com', '-prefix:valid') +Namespace Error +12 DOMDocument::createElementNS('-', 'prefix:valid') +valid +13 DOMElement::__construct('valid') +valid +14 DOMElement::__construct('-invalid') +Invalid Character Error +15 DOMElement::__construct(' ') +Invalid Character Error +16 DOMElement::__construct('prefix:valid') +Namespace Error +17 DOMElement::__construct('valid', '', 'http://valid.com') +valid +18 DOMElement::__construct('prefix:valid', '', 'http://valid.com') +valid +19 DOMElement::__construct('-invalid', '', 'http://valid.com') +Invalid Character Error +20 DOMElement::__construct('prefix:-invalid', '', 'http://valid.com') +Namespace Error +21 DOMElement::__construct('prefix:invalid', '', '') +Namespace Error +22 DOMElement::__construct('prefix:valid:invalid', '', 'http://valid.com') +Namespace Error +23 DOMElement::__construct('-prefix:valid', '', 'http://valid.com') +Invalid Character Error +24 DOMElement::__construct('prefix:valid', '', '-') +valid +25 DOMDocument::createElementNS('', 'prefix:valid') +Namespace Error +26 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xml:valid') +Namespace Error +27 DOMElement::__construct('xml:valid', '', 'http://wrong.namespaceURI.com') +Namespace Error +28 DOMDocument::createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:valid') +valid +29 DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace') +Namespace Error +30 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xmlns:valid') +Namespace Error +31 DOMElement::__construct('xmlns:valid', '', 'http://wrong.namespaceURI.com') +Namespace Error +32 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/', 'xmlns:valid') +valid +33 DOMElement::__construct('xmlns:valid', '', 'http://www.w3.org/2000/xmlns/') +valid +34 DOMDocument::createElementNS('http://www.w3.org/2000/xmlns/', 'wrongprefix:valid') +Namespace Error +35 DOMElement::__construct('wrongprefix:valid', '', 'http://www.w3.org/2000/xmlns/') +Namespace Error diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom_import_simplexml.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom_import_simplexml.phpt new file mode 100644 index 0000000000000..81744aa260085 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom_import_simplexml.phpt @@ -0,0 +1,27 @@ +--TEST-- +Interop Test: Import from SimpleXML +--SKIPIF-- + + +--FILE-- +ownerDocument->saveXML(); +?> +--EXPECT-- + + + + The Grapes of Wrath + John Steinbeck + + + The Pearl + John Steinbeck + + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom_set_attr_node.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom_set_attr_node.phpt new file mode 100644 index 0000000000000..7d783c56204fa --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom_set_attr_node.phpt @@ -0,0 +1,67 @@ +--TEST-- +Test: setAttributeNode() +--SKIPIF-- + +--FILE-- + + +HERE; + +$xml2 = << + +HERE; + +$dom = new DOMDocument(); +$dom->loadXML($xml); +$root = $dom->documentElement; +$attr = $root->getAttributeNode('a'); + +$dom2 = new DOMDocument(); +$dom2->loadXML($xml2); +$root2 = $dom2->documentElement; +try { + $root2->setAttributeNode($attr); +} catch (domexception $e) { + var_dump($e); +} + +?> +--EXPECTF-- +object(DOMException)#%d (6) { + ["message:protected"]=> + string(20) "Wrong Document Error" + ["string:private"]=> + string(0) "" + ["file:protected"]=> + string(%d) "%sdom_set_attr_node.php" + ["line:protected"]=> + int(%d) + ["trace:private"]=> + array(1) { + [0]=> + array(6) { + ["file"]=> + string(%d) "%sdom_set_attr_node.php" + ["line"]=> + int(%d) + ["function"]=> + string(16) "setAttributeNode" + ["class"]=> + string(10) "DOMElement" + ["type"]=> + string(2) "->" + ["args"]=> + array(1) { + [0]=> + object(DOMAttr)#%d (0) { + } + } + } + } + ["code"]=> + int(4) +} diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom_test.inc b/phpt/tests/php-5.2.5/ext/dom/tests/dom_test.inc new file mode 100644 index 0000000000000..86b426f8f37ca --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom_test.inc @@ -0,0 +1,47 @@ + + +]> + +Title + +&sp; + + + + +a1b1c1 +a2c2 +a3b3c3 + + + + + "; + +function print_node($node) +{ + print "Node Name: " . $node->nodeName; + print "\nNode Type: " . $node->nodeType; + if ($node->nodeType != 3) { + $child_count = $node->childNodes->length; + } else { + $child_count = 0; + } + print "\nNum Children: " . $child_count; + if($child_count <= 1){ + print "\nNode Content: " . $node->nodeValue; + } + print "\n\n"; +} + +function print_node_list($nodelist) +{ + foreach($nodelist as $node) + { + print_node($node); + } +} + +?> diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/dom_xinclude.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/dom_xinclude.phpt new file mode 100644 index 0000000000000..f9a3dd761ede6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/dom_xinclude.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test: Xinclude and Streams +--SKIPIF-- + +--FILE-- +loadXML($data); + +$dom->xinclude(); +print $dom->saveXML()."\n"; +foreach ($dom->documentElement->childNodes as $node) { + print $node->nodeName."\n"; +} +?> +--EXPECTF-- + + + + The Grapes of Wrath + John Steinbeck + + The Pearl + John Steinbeck + + + +#text +book +book +#text diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/domattributes.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/domattributes.phpt new file mode 100644 index 0000000000000..9097a887e9f13 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/domattributes.phpt @@ -0,0 +1,43 @@ +--TEST-- +Attributes: DOMAttribute functionality +--SKIPIF-- + +--FILE-- +loadXML($xmlstr); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} + +$node = $dom->documentElement; + +$lang = $node->getAttributeNode('language'); +echo "Language: ".$lang->value."\n"; + +$lang->value = 'en-US'; +echo "Language: ".$lang->value."\n"; + +$parent = $lang->ownerElement; + +$chapter = new DOMAttr("num", "1"); +$parent->setAttributeNode($chapter); + +echo "Is ID?: ".($chapter->isId()?'YES':'NO')."\n"; + +$top_element = $node->cloneNode(); + +print $dom->saveXML($top_element); + + +?> +--EXPECT-- + +Language: en +Language: en-US +Is ID?: NO + + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/domchardata.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/domchardata.phpt new file mode 100644 index 0000000000000..6baff6d148c17 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/domchardata.phpt @@ -0,0 +1,76 @@ +--TEST-- +CharData: DOMCharacterData and related functionality +--SKIPIF-- + +--FILE-- +loadXML($xmlstr); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} + +$node = $dom->documentElement; + +$charnode = $dom->createElement('charnode'); +$node->appendChild($charnode); + +/* DOMComment */ +$comment = new DOMComment('Testing character data and extending nodes'); +$charnode->appendChild($comment); + +echo "Comment Length: ".$comment->length."\n"; + +$comment->data = 'Updated comment'; +echo "New Comment Length: ".$comment->length."\n"; +echo "New Comment Data: ".$comment->data."\n"; + +/* DOMCDataSection */ +$cdata = new DOMCDataSection('Chars: <>&"'); +$charnode->appendChild($cdata); + +echo "Substring: ".$cdata->substringData(7, 4)."\n"; +$cdata->replaceData(10, 1, "'"); +echo "New Substring: ".$cdata->substringData(7, 4)."\n"; + +/* DOMCharacterData using DOMComment */ +$comment = new DOMComment('instructions'); +echo "Comment Value: ".$comment->data."\n"; +$comment->data = 'some more instructions'; +echo "New Comment Value: ".$comment->data."\n"; + +$comment->insertData(10, 'pi '); +$comment->replaceData(18, 5, 'i'); +$comment->insertData(20, 'g'); +$comment->deleteData(13, 2); +$comment->deleteData(10, 3); +$comment->insertData(10, 'comment '); +echo "Updated Comment Value: ".$comment->data."\n"; + +/* DOMText */ +$text = new DOMText('some text characters'); + +echo "Whole Text: ".$text->wholeText."\n"; +$text2 = $text->splitText(9); + +echo "Split text: ".$text2->wholeText."\n"; +$text3 = $text2->splitText(1); + +echo "Is Whitespace?: ".($text2->isElementContentWhitespace()?'YES':'NO'); +?> +--EXPECT-- + +Comment Length: 42 +New Comment Length: 15 +New Comment Data: Updated comment +Substring: <>&" +New Substring: <>&' +Comment Value: instructions +New Comment Value: some more instructions +Updated Comment Value: some more comment strings +Whole Text: some text characters +Split text: characters +Is Whitespace?: YES diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/domelement.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/domelement.phpt new file mode 100644 index 0000000000000..bc69af602c311 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/domelement.phpt @@ -0,0 +1,114 @@ +--TEST-- +Elements: DOMElement functionality +--SKIPIF-- + +--FILE-- +loadXML($xmlstr); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} + +$node = $dom->documentElement; +echo "Tag Name: ".$node->tagName."\n"; + + +$node->setAttribute('num', '1'); +echo "Chapter: ".$node->getAttribute('num')."\n"; +echo 'Attribute num exists?: '.($node->hasAttribute('num')?'Yes':'No')."\n"; +$node->removeAttribute('num'); +echo "Chapter: ".$node->getAttribute('num')."\n"; +echo 'Attribute num exists?: '.($node->hasAttribute('num')?'Yes':'No')."\n"; + +echo "Language: ".$node->getAttribute('language')."\n"; +$lang = $node->getAttributeNode('language'); +$lang->nodeValue = 'en-US'; +$node->setAttributeNode($lang); +echo "Language: ".$node->getAttribute('language')."\n"; +$node->removeAttributeNode($lang); +echo "Language: ".$node->getAttribute('language')."\n"; + +echo "\n-- xml:lang --\n"; +$node->setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:lang', 'en'); +echo "Language: ".$node->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')."\n"; +echo 'Attribute xml:lang exists?: '.($node->hasAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')?'Yes':'No')."\n"; + +$node->removeAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang'); +echo "Language: ".$node->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')."\n"; +echo 'Attribute xml:lang exists?: '.($node->hasAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')?'Yes':'No')."\n"; + +$lang = $dom->createAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:lang'); +$lang->nodeValue = 'en-GB'; +$node->setAttributeNodeNS($lang); +unset($lang); +echo "Language: ".$node->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang')."\n"; +$lang = $node->getAttributeNodeNS('http://www.w3.org/XML/1998/namespace', 'lang'); +echo "Language: ".$lang->value."\n"; + +echo "\n-- Elements --\n"; +$rows = $node->getElementsByTagName('row'); +echo "Row Count: ".$rows->length."\n"; + +$element_ns = new DOMElement('newns:myelement', 'default content', 'urn::dummyns'); +$node->appendChild($element_ns); +$element_ns = new DOMElement('newns2:myelement', 'second default content', 'urn::dummyns'); +$node->appendChild($element_ns); + +$myelements = $node->getElementsByTagNameNS('urn::dummyns', 'myelement'); +$mylen = $myelements->length; +echo "myelements Count: ".$mylen."\n"; + +echo "\n-- IDs --\n"; +$node->setAttribute('idatt', 'n1'); +$node->setIdAttribute('idatt', TRUE); + +for ($x = 0; $x < $mylen; $x++) { + $current = $myelements->item($x); + $current->setAttributeNS('urn::dummyns', 'newns:idatt', 'n'.($x+2))."\n"; + $current->setIdAttributeNS('urn::dummyns', 'idatt', TRUE); +} + +echo 'Element Name: '.(($elem = $dom->getElementByID('n1'))?$elem->localName:'Not Found')."\n"; +$idatt = $node->getAttributeNode('idatt'); +$node->setIdAttributeNode($idatt, FALSE); +echo 'Element Name: '.(($elem = $dom->getElementByID('n1'))?$elem->localName:'Not Found')."\n"; + +echo 'Element Name: '.(($elem = $dom->getElementByID('n3'))?$elem->nodeName:'Not Found')."\n"; +for ($x = 0; $x < $mylen; $x++) { + $node = $myelements->item($x); + $node->setIdAttributeNS('urn::dummyns', 'idatt', FALSE); +} +echo 'Element Name: '.(($elem = $dom->getElementByID('n3'))?$elem->nodeName:'Not Found')."\n"; +?> +--EXPECT-- + +Tag Name: chapter +Chapter: 1 +Attribute num exists?: Yes +Chapter: +Attribute num exists?: No +Language: en +Language: en-US +Language: + +-- xml:lang -- +Language: en +Attribute xml:lang exists?: Yes +Language: +Attribute xml:lang exists?: No +Language: en-GB +Language: en-GB + +-- Elements -- +Row Count: 3 +myelements Count: 2 + +-- IDs -- +Element Name: chapter +Element Name: Not Found +Element Name: newns2:myelement +Element Name: Not Found diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/nsdoc.xml b/phpt/tests/php-5.2.5/ext/dom/tests/nsdoc.xml new file mode 100644 index 0000000000000..9503fd8c5b1ad --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/nsdoc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/regsiter_node_class.phpt b/phpt/tests/php-5.2.5/ext/dom/tests/regsiter_node_class.phpt new file mode 100644 index 0000000000000..5444cc4b9ea82 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/regsiter_node_class.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test: registerNodeClass() +--SKIPIF-- + +--FILE-- +registerNodeClass('DOMAttr', 'myAttribute'); +$doc->registerNodeClass('DOMElement', 'myElement'); +$doc->appendChild(new DOMElement('root')); +$root = $doc->documentElement; +$root->setAttribute('a', 'a1'); +var_dump($root); +print $root->testit()."\n"; +$attr = $root->getAttributeNode('a'); +var_dump($attr); +print $attr->testit()."\n"; +unset($attr); +$doc->registerNodeClass('DOMAttr', NULL); +$attr = $root->getAttributeNode('a'); +var_dump($attr); +print $attr->testit()."\n"; +?> +--EXPECTF-- + +object(myElement)#%d (0) { +} +HELLO Element +object(myAttribute)#%d (0) { +} +HELLO Attribute +object(DOMAttr)#%d (0) { +} + +Fatal error: Call to undefined method DOMAttr::testit() in %s on line 25 diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/skipif.inc b/phpt/tests/php-5.2.5/ext/dom/tests/skipif.inc new file mode 100644 index 0000000000000..08fd695d97eba --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/skipif.inc @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/test.html b/phpt/tests/php-5.2.5/ext/dom/tests/test.html new file mode 100644 index 0000000000000..fe6d0d3dbc1cc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/test.html @@ -0,0 +1,9 @@ + + +Hello world + + +This is a not well-formed
    +html files with undeclared entities  + + diff --git a/phpt/tests/php-5.2.5/ext/dom/tests/xinclude.xml b/phpt/tests/php-5.2.5/ext/dom/tests/xinclude.xml new file mode 100644 index 0000000000000..27efa91aee06c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/dom/tests/xinclude.xml @@ -0,0 +1,4 @@ + + + + diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/bug34704.jpg b/phpt/tests/php-5.2.5/ext/exif/tests/bug34704.jpg new file mode 100755 index 0000000000000000000000000000000000000000..42b14c1908fc30fa8b7f45827487a760826c8416 GIT binary patch literal 9976 zcmeHtWl$VlyX~L@1b4T=U4sOeK!VHQE(sFcGQdEv00DwC5FijN0W#P?2=0*J8r*g8 z0Kr`j?|a_w-0#n=y665oRcCc|_w($vd)KpeSM{#yz3!*)mjT3TN~%f#G&D58i-!Yn zzrxz3=+qmyQ`|?l}*25(IHBbKl4ISg5I3Nx#-XmfFIvNHBIwl4d7AEFH z&%g%`fJuTy$|5X}O{Vh_$m&Th5(58>15&7Hr_dcaU=y`|9g2%bNkvUV%g({c#myro z{#Zg%O8VJzMI~hwRW&_*14AQY6H^;oyI1xOj!sZ7Zy%Vi-9!Ng(_#wL~50lxGkV-*R( zAy zth}@Pz=1kC>5(zADR=BI-Zt{#=MJ~mY&=ZLW8MUATbdO5mj5`L5}liKs*N}Nvxh52 z8Dy(6=hJFP7xEi!X^P;u9ryQjy71LoFL7QfZdF`gIvukqsXo+Pn_^@zBynkc>UPll zNZ6n|x96*g^VL9dKYftqKvJjIFXiT*piz?_YupUg?%gv54wod{_4mv~?p+xOy<&-!06a+Q z67)E@c<;;gp2f}^#0`kM(99WcS3sAq6t4_}7_T8a79q>iJy$-}@h0V6LslM33)eqlaZblNsduZ!ZW|fA2F!`rzp$TfHBBrL`o_o~f};eM z)F$_lW$whdeD-fSGbmJ+vzwrAp_(JvXCl6(;sp%SbC82M#6^Q3+<#@VJg_7%*J43- zUKLZz*7pZ_O5{Kuz}5yRp5j@wv)M75NjYWYPOdi)$2ibUZmGjkYZFR`5TD)(Vyr#5 zR+YApirMWY|J3&A-4K0_xzUG(0MmoBtfHM>d;7vg`Ct~o$7}LqG>S4P#=4?7+(Cy> z-(4|Y{Y>l9iKNox=S-Z%Uvb} z=jRrc9U@fGc{U)k@_y1sleSdJA)!QbtOx;;&teOvjlc z76@*)jxzRz4s+6@DUQz1K-rpRlj53c)YTIbaRfhQzbMUptDrP*krf?u_8nFom62G9 zI^`XKK`C+r``9dw#RiDivPFl2@rDk#N19yiIX=@`bf5Vb<|WZZ8u8i4f2+a9VM$mw zxu!W<`rLXJPn5x%=IXPw2su(5Cfw0o`du?HDyk^=G1+Cv$oEC5=kLr(@x9DN4L)&S z7I2gKZP8rN7@IxkIF-hAH0sZd-kZ;uFbjX=~76l40u%+V`OL+Rn__MkqLY`AN=eG3J-6Zg0UF)SkO%bxt&m zk_bPdFBqDHs~zs5QMf->3Z`F@Eo^e79%!3T}!Ni~3L&a|bmnwQ=19=C* z_H&J97^^1bZY;HL9~p=YtQfHkh9p~5S>(=2Znk_K-Iid)yHH%^+Gwe6l(2noIiJCQ7(ct80L?kdbyYBZhj9~Vhhyt0W+L7swX_!PMxIEHh<>nGcbq| ziK)~SFS`(|cKi_)^YiK~JlIhTdil7fHpx$m&L!t)L`#~Hi1D<^JEm1v`cn=qiZnni z$_$H^*Q4zOBq<()YL@F)xX4evBfoqu(l*jfmr62Z9FTjwL?2wG=zIg!fgWOkLekD_ z4tQ#OHzmPZPKfqKXI}RxXM3bsL{q|G{G8t^?*~pPh9L|aS)5a`vnYx2bNBZzTURg- zxndKSW~L-TQ~gc{OyP2rVO`RK(Oxszk{lc(sCr?b!@-aW{rUD}OZZ{&p97zU>>4VJ zdjLzduhs57pk#W>)A!3gz@W~|SrS#V1VVq>Uq=ss=ou^R5O#v2%)2k@R|GGf1+cF) zb6HkzOVlRg;`?a*)uX@i$vtJ^Qo!MSIDA?R_iwVhe2g^Y)Xt zJ7))Nb{goV+g`^O(K$-y9)Ln#8Ak4@`&ynWjHP_*$3M=o?$oxwy96UWYZ|(e^KY!i zstK@v4~-6dQyS&@jxVN89)?MHDV~ua&Vg*6aWgE;IzxlyZ{GuGs->Eq!)wwQ)_t3?X4yEC2s&A3NGeEtQ0{9M!NyswYqnRZo|2PV+@^|S zoilgR?bu+YXxWw_CGxb)I*frt53lfdma@khhRzVz_x@-o9A41@$1{OcB>LrM)0ePa z__{+}%JZsf%_c>kpQ8)0y;!F<&SV9xh7Uo(J!$FID_yazNnPcYu?YFN8h7CmaNv#IvoJT1v#=<+muPV*Qt3&Gj{zY#4Ybkv!j@UR_xXdpI14RvPYz`8PC&dKu zm7QgyohWI2E1CpBm@g1q`XR}&-^xut>89ce%3R9p6Rd}j{Dvo#TOEg~Vt)oruNUa2 zN*S=j#{d{hjLoeWx)X{;>M2{kIk8Pl{;Ptd+b~P!iIeq+zDH(shh%EQ_29|9OX1Ys z_TnJ%3!}V#cV~&PYKmHmKlB@y>n`8$jNFK`MWAy9{s9?r)3Nn+)kgyw2IKUU^kieX zHdoQ?<1_Mlo+Lk|_@v*h5el~hX>JrDe<(^Va?h3HOnnUxTLg@Mr_qK-@k1E~3S+om z$!RZy)zW9eGd(ApfvW_ezG>~XS9Zv8;pQJ*{cIsMZ@=?G-$D-HW@!@1b86c#K3tHJ z+6^KsWLPVmpnJ4(Uz|6^MSPw&Q;0?DF}&OD5-9%Z-P+i$sYl!t6u1J5+&Gwu`1-BB zp|&3S`e^^Hq&AJd%?4mIy0y?6Otz&9KQBn)yVWfl^p-9X^ri-2U)M8JcFXuPjg3~` zD9niykX*U8U}QIi@@9Mq*nt#{VAs=YUk35{`f%IEAx}9tnZLKuf#Y|~te7sWH~FY^ z^}6vh;n~w}=@jd<>u+PU>s4qK;bdw6Dt)r-$LzNwGq7g*#6X}_fRNH=xX#^3>3 z>z`O_E&8uzPh?9_A0+A)5ISE@cL_mVAA4i0N<@%ykdzfLWB!?;P5yE9;yJGe~DK|4Z1j-4l)Q~A4E=udA_7fD{PA+`@yv9>(LoSO`qNQ2KHNXtVz|? z&(RZho95Br-O$PB_HtIk^Q*eBjE8)e^!}bXuT1gsMqx8U3;UhL^DSpL_qLJxi~bcu zcWHG7lQq{KeJo6`-mW`o!ocFXi`Erur3H}Dyw#c|w%<_DdAZwZOu>$kp?3Kfu3UM3t8mAh4K z=IBR^SKR}cZUDw!S9jR&?g1oT1rVO4XX6wzTJ2}=Vo}udBL3ckhU0Sl+d`&kpH!OU zo>D7kp?P*aSxKms6}9AFmDT-iFiz=+G;w9CPxYM`8hl%WBf0Xl4fFa{?zrHIuOW>q zTk6)2$3MyIt=JWM=V^*%2StqRV%8_^;W9t~ zg!u{U8J~j>E0t=J`@?=FLo$VLj|64T+E2k*ejGVS6ZJR2RU|gYBw;c_e*p1*4DENX zicGDh0~-umH7n{ZzW)r>_6E8Kd+^K~nMLWt_Y7O9`2}ov?*TZK9nsBAYgf8S(W?9UPMX`$s!u2uQZ&X$C(w}0Pf;7D^Fhne z8~fl@e#;-cSt4|1UUl(0JblJV5DZLwTly(7n*y_+LU2$2*QFGnea|>lX}arrevdV~ zIV6!E(xdN8^*537ro+!!G=Bn!OjnJI^>X;APPc{%XrnAO=3BGYCImn&LQT=o4as)Y z*I{)bxn+~bfeZa?whx~~f-zouIbIo~7mjS=SZ$JEpX~jMC8Y1i^lQi}7$DMTBV2=|;|q*LZcD)}#a$YZEDtO567? zIUm6sZ#v~N>0`@qV2D^%g_+sG)w`EBT_#!+KBsn;tx@7BJlaWBMT%zMt=1f+4QDlu z_JAD?5qTx%#-&qf%n`5Rg{WTuD4up>W~sNum0KL_G#F@=FVA4xiMGE;}Sm%BAqpp20x&9;t4 zvpf?w3ZvOesp-r9tAj(Q?tU2TjlbD;O)~YKA%#hP(gs8LcOaUQy8QvYPOfi|tM2~h zZq3n>DJ7j7>$_cRvrMwLI7})2M$vpXQZGGaMm6)d&qu#rO0<2~=%*f1@Lnd;n#fui zrkq*&XyaVB9%^*-B2#%i!t;hbI8wIxjnSusfkR^_H+@G7nET;(tDFG?npyHW}2G z^H^CapSo;E>PTbxka~A!$`J0U?3=078_i#Ly(MPO%vG~4oy@*e>$vUR%de+pqd?7m zlK89C^*jaw*>~j?Q&B%Gik@jjvO9{XGo^0Tq*nH^W%40>sC?#yuk&E^S9$^R1xs5J zo;x~Ls(h08_AWra^=BN5@{+w*7@5}PrrTsD7x8Sh4P?})V}W0!Eyj0$T;j7@rN=Y+ zXk0Wuz$0p`DJXhfY`%*Af|Y;$@p3aZO`N0NtNG?0P@cY_)hxqj?!*bJj`HfUHe7ls zmfQjm*d-V6vk93`f~*3a>fL=xdY-g!8nZfG+E_ZbxPS zVys*oP893)%u^OQxK)!ugYTA{$2|YUtzBwQea@!OTDB&P+gaFkSZ9y2I)_VVGpKCIuL(V@F3-7Ne=ReTFpSpoE!!ED zJ??fYluqMoMH%e2u$x-+SVvIj!-K=^cpzmWO;hQ<Le!BkGr1;&2MQ* zppBD^L|V&l$(LkP9dt&NJgh^?GAKRv4i~0JWJQ-sPu6U}rXV#PqYq`UVqd>bweFJO zAI9e-#WT|t>6QI`k2$}p(10Tg{1!`!eG!&**W#0T{E3EhvR~6lF!7f+wCd=y^Fn!_ zv+_1$47?TC3vVYl-QKQ5yhNZp{LN%rXhCJl0aMH5(#C1{Jz zM=%VjYHPMwMsnNaJ$J{6(X6+|jM@})Q|Hz#HLtCZv97A>3^T2*(;pKY(Zyig2Fj5ncL~;6!b*Mthyz~shC2INXQLTy8vWLzv2BnBF-(&s~o+i-s-q&Fl!LP zTS-mRC3+%;P!d0FS+q6yY#5%U=$vvoX!+__ORrm6(vm9e4?8?o8W}3~1bW-UWOLc7 zD`aZuFK1$l&Vtz<0anqMu|3qp2!;?qe3o;tMdLNr;HS!puX6v1Dm6YjXLq4OCCRc6K~QV6mH(@y8Ko65j~-QolmH$+E9I@Hlynp2t#u$@wEhEqQi#Zpm9*ec%%rOq^yA>Rg|H zyTQ2rgT;NH2Obh@X!&`CSKT?!+Xf0H7g{c;WB&41+V)7;zLs6=XOaH+ZjD-vB}?byga|TK4WK6T@S{c)9>4Jx?KltFIPE~xl@ih zZC3mezAuIpQg@+to89%GJD7(|*7HkGUh9sOm7i)Vt?r;3S677;EL9!J-(fSzW5kPg zQ!Hr-tLuXu4f*>>Jx`=!X!c^0{OY34Y^7@kmgDcL>&8Cu4$Me=c;~JeNxcV8Kwx?s#@{-u$C&{nn z$7ok*=Hp~8!lKZsP|sbcp}@#M0i5PTNT}3a!gfwqQ>~N$VoIhKS1N$A;Y7l4hUHSoAB7J-Ra3 z>6(?Lkt-k@NDxCd+$gfth+ri3&Asl3was)rV>?4Wnae|{!$2k$TvZ>H@yK5ttB2L4 zTISj=$G44n?Ya3P2iUt_+OVReD>Z#XbuJXa1g>0v-m{m}e3 zR3^O<)#`#{srQo-S-C!xc7ub#dOYSUVvKC_LRn?;R0`O*&;GKgOO;nSM+Y#&dZG`2$-~uPx@u#e>FsW;=5#i1=hoCph;bC7ka8 zW>ihWhuC9!EoQO`GcI=U8bwyshR3oW*3c2Ph|vZlgvtIRX%LENw8_1TMD4pdgfBw< zw_k?@nd|H;Bdol{kQ*yrZrKBZH=GftpppxP(H&ilE{^zTJN+q~hi%|E=|olN^UlZl zE1=-6BaWQ%EG6FzXH}3t@5NNke1)WYp?H5yOvy86X-Dbi;w`AX_j0;{0!gS9SjaUG z6Kz;l)S~Qrzg(W*M&XO0KK&CAn{~Ze4yMC#kEuj`ZSPh*b&v*uBb|6rapp>pg`3}E zvkWYwb0GC|Q)=R+S>zJ{fb0U`tp3y0oiUH0dLmy!NK1ht3B-~BKaQ6NcuUI4rOeIw z0#!|7hCN|ioKIdCgXJxh(h<{+4!S=UCDC@Y0|rlRdXW!bV^FqOfq&&tfZElo6fd}{ zJ4?J`-@Hj5gXnOdA><>Y=y?Mz@^R%#6uVKVtL{uz(2K(FY_@AQj^G4(sAb(YdGWL2 zZ?Z4|)cC4Ayvp@COMPV=9;v}+Mw87chG6C?Vz>9tJP%Y*?XUwwHKm~?~yphEhnPaoriv#g_N@KLJ<9RG}b)TL5 zHq|nWk7UP@uGY8GBQ+5xBHUqe8mlHASx}l2$mO)%f(+oeJwulQCi&Ck8#2Nr zCNqu_sxtWJL2o|JiWGLLp;DO>fz^-eQxo(gwZwKz^WADI?G;z(9Xpq!?SmV z0-TzA)kvQTHoxU9t34=7N|x=MsDkO$UEVCEi|!Ix6%~!*4I4Tdme+jx0J57tZYA$= zb#WuzTfO!^Ih06B%8%f(CJ0@})gBo9#TeQEiOhHhdP@7!(ClN%hRYGPXwW;)PFKkC zFk#Q#i!oi%%vC7{qaz^2D+cLdNO<12P%iRQJSni=__&s*XGJ7m{bl;-&T|2Tck)~I zAe?)E!vxe9zORc|@0DBT2LFmqHc3e~Xw*rPnY{Ck@hnu|9IS;nV%l|WWIc5g?s{X( zcvn?#W=cEQ5`kJMuBS5#mEUYpxywNsS7-LJ7BXn7W}YoXZ!T%ObZpGdyG@tjqqvM~ zmLVGP5R|HWi5ksEQ~3|BxiKMQY~?|9o8;qc3LnZ#Bwmd_{*lDzXS5VsBexA+xf)fzV1Ao5eSWZBpL)r@PjwTJv#CaZoL0IgvTuS6=(UN`_~?G@|P>O3xB^o+oQ33+^?Ji!io@=AI z39$R=Uuxt>(9n}?`IXy^dksooK}61e%=!hl9HK8}@gtGd#k*Ct(P-PWSa$|rGNQjL zQRo*BXKU0nf*8%!N@x#?^8iEz;=?baU#UovPf4Afmb#d|*o$wvO;rfS3r}Eh zGNl-d^Xr)`Z|lC=U_#nv$@Qt?C(VJLP+E5!C%x7RM!UpoUghAlXuSuNA)|j>i^X{z zdFc5(s|f+Y1a>5`-t$1F@Rd<&%oTXwE{TiN zdNl3<#MIl_b)|57fzg7AC~cv^c9y5Zr#C!aRmlSirlJ*<$(gN#jX7h76s?t!$28F4 zO9B>m1Q(Wd2$;_XadON38#|lDeZlnoul0zL@Sg4?@sADAk{_nVLxar~iPROSoi1c` zrHqk7X>=uVA5~oIW7T_r?2-SteAGa~+D_$lu8Eg+=@6^0e483a#}ly;otyW9i3Cj8!d7&I`M z8}g_iD52k-ucDIoSQo*&E4ZH?_79)Dv8P8J40>^k^c17=UcBYacE#wosthbpH{hd;gPn_uJJjo?tA`vOvy8o?t(?$?DfH+*03sQWzl;65Izc(SfAj79yITee1M|VP@!;9O#KL;8rr_f|IA4H7 zj~?OTlMs=Tk`R%QkWtc8k&)91JyHO4&JJj%_fdiK1LA`NJFvwdR7?$SrIygkZh+?jhb3DX_Kee zEbxWlFPf@6MSb(sHNHqzY))Yb^<9{w)`*)wq23P+5nslrSRXcM7ki^biQFfw +--INI-- +magic_quotes_runtime=0 +output_handler= +zlib.output_compression=0 +--FILE-- + +===DONE=== +--EXPECTF-- +array(7) { + ["FileName"]=> + string(12) "bug34704.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(9976) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(4) "IFD0" + ["COMPUTED"]=> + array(5) { + ["html"]=> + string(24) "width="386" height="488"" + ["Height"]=> + int(488) + ["Width"]=> + int(386) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + } +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/exif000.phpt b/phpt/tests/php-5.2.5/ext/exif/tests/exif000.phpt new file mode 100644 index 0000000000000..eea16438cf136 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/exif/tests/exif000.phpt @@ -0,0 +1,57 @@ +--TEST-- +Check for exif_read_data default behaviour +--SKIPIF-- + +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- + +--EXPECTF-- +Array +( + [FileName] => test2.jpg + [FileDateTime] => %d + [FileSize] => 1240 + [FileType] => 2 + [MimeType] => image/jpeg + [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT + [COMPUTED] => Array + ( + [html] => width="1" height="1" + [Height] => 1 + [Width] => 1 + [IsColor] => 1 + [ByteOrderMotorola] => 1 + [UserComment] => Exif test image. + [UserCommentEncoding] => ASCII + [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger. + [Copyright.Photographer] => Photo (c) M.Boerger + [Copyright.Editor] => Edited by M.Boerger. + [Thumbnail.FileType] => 2 + [Thumbnail.MimeType] => image/jpeg + ) + + [Copyright] => Photo (c) M.Boerger + [UserComment] => ASCII + [THUMBNAIL] => Array + ( + [JPEGInterchangeFormat] => 134 + [JPEGInterchangeFormatLength] => 523 + ) + + [COMMENT] => Array + ( + [0] => Comment #1. + [1] => Comment #2. + [2] => Comment #3end + ) + +) diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/exif001.phpt b/phpt/tests/php-5.2.5/ext/exif/tests/exif001.phpt new file mode 100644 index 0000000000000..8fac4286ca686 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/exif/tests/exif001.phpt @@ -0,0 +1,84 @@ +--TEST-- +Check for exif_read_data +--SKIPIF-- + +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- + +--EXPECTF-- +array(5) { + ["FILE"]=> + array(6) { + ["FileName"]=> + string(9) "test2.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(1240) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT" + } + ["COMPUTED"]=> + array(12) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["UserComment"]=> + string(16) "Exif test image." + ["UserCommentEncoding"]=> + string(5) "ASCII" + ["Copyright"]=> + string(41) "Photo (c) M.Boerger, Edited by M.Boerger." + ["Copyright.Photographer"]=> + string(19) "Photo (c) M.Boerger" + ["Copyright.Editor"]=> + string(20) "Edited by M.Boerger." + ["Thumbnail.FileType"]=> + int(2) + ["Thumbnail.MimeType"]=> + string(10) "image/jpeg" + } + ["IFD0"]=> + array(2) { + ["Copyright"]=> + string(19) "Photo (c) M.Boerger" + ["UserComment"]=> + string(5) "ASCII" + } + ["THUMBNAIL"]=> + array(2) { + ["JPEGInterchangeFormat"]=> + int(134) + ["JPEGInterchangeFormatLength"]=> + int(523) + } + ["COMMENT"]=> + array(3) { + [0]=> + string(11) "Comment #1." + [1]=> + string(11) "Comment #2." + [2]=> + string(13) "Comment #3end" + } +} \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/exif002.phpt b/phpt/tests/php-5.2.5/ext/exif/tests/exif002.phpt new file mode 100644 index 0000000000000..1b1220c60073a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/exif/tests/exif002.phpt @@ -0,0 +1,24 @@ +--TEST-- +Check for exif_thumbnail +--SKIPIF-- + +--INI-- +magic_quotes_runtime=0 +output_handler= +zlib.output_compression=0 +--FILE-- + +--EXPECT-- +27bbfd9fc10e1e663d749f5225447905_523 == 27bbfd9fc10e1e663d749f5225447905_523 diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/exif003.phpt b/phpt/tests/php-5.2.5/ext/exif/tests/exif003.phpt new file mode 100644 index 0000000000000..20cb61ee17183 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/exif/tests/exif003.phpt @@ -0,0 +1,91 @@ +--TEST-- +Check for exif_read_data, Unicode user comment +--SKIPIF-- + +--INI-- +output_handler= +zlib.output_compression=0 +exif.decode_unicode_motorola=UCS-2BE +exif.encode_unicode=ISO-8859-15 +--FILE-- + +--EXPECTF-- +array(5) { + ["FILE"]=> + array(6) { + ["FileName"]=> + string(9) "test3.jpg" + ["FileDateTime"]=> + int(%s) + ["FileSize"]=> + int(1240) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT" + } + ["COMPUTED"]=> + array(12) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["UserComment"]=> + string(7) "ÄÖÜßäöü" + ["UserCommentEncoding"]=> + string(7) "UNICODE" + ["Copyright"]=> + string(41) "Photo (c) M.Boerger, Edited by M.Boerger." + ["Copyright.Photographer"]=> + string(19) "Photo (c) M.Boerger" + ["Copyright.Editor"]=> + string(20) "Edited by M.Boerger." + ["Thumbnail.FileType"]=> + int(2) + ["Thumbnail.MimeType"]=> + string(10) "image/jpeg" + } + ["IFD0"]=> + array(2) { + ["Copyright"]=> + string(19) "Photo (c) M.Boerger" + ["UserComment"]=> + string(7) "UNICODE" + } + ["THUMBNAIL"]=> + array(2) { + ["JPEGInterchangeFormat"]=> + int(134) + ["JPEGInterchangeFormatLength"]=> + int(523) + } + ["COMMENT"]=> + array(3) { + [0]=> + string(11) "Comment #1." + [1]=> + string(11) "Comment #2." + [2]=> + string(13) "Comment #3end" + } +} \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/exif004.phpt b/phpt/tests/php-5.2.5/ext/exif/tests/exif004.phpt new file mode 100644 index 0000000000000..229f49e1459b8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/exif/tests/exif004.phpt @@ -0,0 +1,38 @@ +--TEST-- +Check for exif_read_data, Unicode WinXP tags +--SKIPIF-- + +--INI-- +output_handler= +zlib.output_compression=0 +exif.decode_unicode_intel=UCS-2LE +exif.decode_unicode_motorola=UCS-2BE +exif.encode_unicode=ISO-8859-1 +--FILE-- + +--EXPECT-- +array(5) { + ["Subject"]=> + string(10) "Subject..." + ["Keywords"]=> + string(11) "Keywords..." + ["Author"]=> + string(9) "Rui Carmo" + ["Comments"]=> + string(29) "Comments +Line2 +Line3 +Line4" + ["Title"]=> + string(8) "Title..." +} diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/exif005.phpt b/phpt/tests/php-5.2.5/ext/exif/tests/exif005.phpt new file mode 100644 index 0000000000000..e34e3a0421746 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/exif/tests/exif005.phpt @@ -0,0 +1,22 @@ +--TEST-- +Check for exif_read_data, unusual IFD start +--SKIPIF-- + +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- + +--EXPECT-- +array(2) { + ["ImageDescription"]=> + string(11) "Ifd00000009" + ["DateTime"]=> + string(19) "2002:10:18 20:06:00" +} \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/exif006.phpt b/phpt/tests/php-5.2.5/ext/exif/tests/exif006.phpt new file mode 100644 index 0000000000000..bad74ee4fa98b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/exif/tests/exif006.phpt @@ -0,0 +1,89 @@ +--TEST-- +Check for exif_read_data, magic_quotes_runtime +--SKIPIF-- + +--INI-- +output_handler= +zlib.output_compression=0 +magic_quotes_runtime=1 +--FILE-- + +--EXPECTF-- +array(5) { + ["FILE"]=> + array(6) { + ["FileName"]=> + string(9) "test6.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(1240) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT" + } + ["COMPUTED"]=> + array(12) { + ["html"]=> + string(24) "width=\"1\" height=\"1\"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["UserComment"]=> + string(16) "Hallo \'Du\'+da!" + ["UserCommentEncoding"]=> + string(5) "ASCII" + ["Copyright"]=> + string(45) "Photo \"M. Boerger\"., Edited \'M. Boerger\'." + ["Copyright.Photographer"]=> + string(21) "Photo \"M. Boerger\"." + ["Copyright.Editor"]=> + string(22) "Edited \'M. Boerger\'." + ["Thumbnail.FileType"]=> + int(2) + ["Thumbnail.MimeType"]=> + string(10) "image/jpeg" + } + ["IFD0"]=> + array(2) { + ["Copyright"]=> + string(21) "Photo \"M. Boerger\"." + ["UserComment"]=> + string(5) "ASCII" + } + ["THUMBNAIL"]=> + array(2) { + ["JPEGInterchangeFormat"]=> + int(134) + ["JPEGInterchangeFormatLength"]=> + int(523) + } + ["COMMENT"]=> + array(3) { + [0]=> + string(13) "Comment \"1\"" + [1]=> + string(13) "Comment \'2\'" + [2]=> + string(13) "Comment #3end" + } +} diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/test1.jpg b/phpt/tests/php-5.2.5/ext/exif/tests/test1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..121decb65ad30078dc0a09bd23c62fb49d8a44ea GIT binary patch literal 523 zcmex=?U?LR#UJO6b*$~fG#Lh5@t1O zoG1cv!NH)5ABQ&u|Uz`(%4z|=H@feFac0AjUCZD6(}knIn|837sjCHV>($(jnjdQSPN zMd_(U46Z4eC8;S2NtFmOJqE{MXHQR{4v^srC8@8W}Q3`{`RvH)cmfw+x{ z3C3pP2J#vHWAoK*h86}M4h{}Z4jxWU9zkv{Zb4Cg9v*&C31MMTVPOeD9x#AX5Dq%Y z$ji;m%f~Cg$0s1d$HylEBKSlgS_FwP;Qs*zK@Om!8JQWC7?=bZnFSgD-vv6J@&6G< zd!TPv8NmSL2_RqwMhXin8#@Ol7dKE3sw5)=6EjRwfPs;Pk(r5wiIts=gO!=b7$_;o z%%Uh{$m$rFD6CZ2Xv8Kmap6WMWfjq&gGt6FMNJo-*;OY6e|Y#Yx!6=}(WYiKm&qY1 zu7?(vn2BEseU$oXbIak&rH?G-Fo!u)30G^Wo^@zZ98`D**A0d z@bvQb>C3ktzyAEYASg2QSfR-?v=A|MwW47&KiSS9IU zQPU*nVA14alaH!wAP2CknI5_Xbi`uu6xUF*lGI0VC*XF0I>HJ6Z!z#NgY6V#uxI!h TGX2y_mF53${vVC@kr?d&kaR;W literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/test3.jpg b/phpt/tests/php-5.2.5/ext/exif/tests/test3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7547a16630f6b7c2f1b4ecfa0b4bc2f53dcd8204 GIT binary patch literal 1240 zcmex=&u|Uz`(%4z|=H@feFac0AjUCZD6(-knIn|837sjCHV>($(jnjdQSPN zMd_(U46Z4eC8;S2NtFmOJ%&&}PiKD@R|bY74A&U$Fx+Q&!tjmZ56}n(CZKCsfHWfz zw=prn*i76Y$^Y1Vb(^7ufro>GgOh`Ylaoh~n~Pgel%I!(UsOU^SX5Y8LXZaxpcI6I zPBQXxbMx}?3h?m>i16|8iGT<`5r`H+Vhs3yfI*N0=x9b}MkNL&K}Kdl#{YMLj%WOT zgwY=88&*az0C@rkn1PYP!pg?Z!O6u9)PpL?$iT!5lN4ZJWMO1xVqs!sXX9XH<}n6J z3No`O3K_CG1||wC6*d~NiA-F$(MefFH0WTGu}M+WMQ3)^Nx>f;eoQVl6P; z+&w(KynXue?Z>Y_|1JoM5+)WFu$$P~SWUrBP&5=`0lJ`2Nto5BaiR#w1qXvJelS)^ zdRWvn$vIdwx!B~RDjUcF>}sZmE&&~}SUklw)T|`+5!?y5U7(I|!v9+gJj`G_1sUua VzJ^RcwNhpI|C|3uqkSYsI{@YCL^c2b literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/test4.jpg b/phpt/tests/php-5.2.5/ext/exif/tests/test4.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8a23a7b658ddc7ebf78fd17be50a39b0fffee3a7 GIT binary patch literal 713 zcma)2OH5Ni6g~5%?@Zt z)QzYC)IIoF3!-rge&Q!4wkm6=pY3?tS`99YcXH>PGxyxNnGtWqM>O|Eq7g8O;RG#+ zB1++jp+O)TJpwBL8MhZ0oW%MlZxMG9o}s)+TqB&ITp)go@CxM(;&#I4l$A(e9BG`z z05T}xXmtT6NngYTj3S3D^1sjH6*=E(<+-ytF@^AbAfma)d~j2nGQ*1TxH?|EMQ`T9RfJ3N97C2Cvl6cG+6gF?yncB zSgZaiHbasaC*7cMu1G9Eoho%lFfR=PzHs z_vqQ{?H?+Qgv=C$p2B6W_`p=j&AWQ+vDDb)tlr|^SzNKKZ5DTf@wRkMn=__Do~2bY r(VNMyZ%xlHCrf47(XKeXfo!v&21X`Eh6EsF_ zkeiEJP?VpChhJ1eSXfk8SVE8o44@Q*gHAH?a&z}sZmE&&~} qSUklw)T|`+5!?y5U7(I|!v9+gJj`G_1sUuazJ^RcwNhpI|C<0o6qVxu literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/exif/tests/test6.jpg b/phpt/tests/php-5.2.5/ext/exif/tests/test6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..073cefdfe0221f6f2d283139df9f590ad46c47a2 GIT binary patch literal 1240 zcmex=W>z~q&UQ}a?7 z{y$`z=~|JQ#=zj~%b>-;z`()4)HH*E3CPj_Vzo(aV73^L?GMBm0U7xv`3g$DdJ0bY zsYU6jMM`=Mt|^%%sVNHT2tjo{2FGA$Pfwr@kHnmudn!!If!EG#N4EFs7P22cvZ zK_?k`xw(1ycm??Q1Vs4w_(VVip9n;YATb8~KfoZ!0dzDYGoum%lOQ9rAmjhLK*uxw zKf-7a^bIQ`7=Szh1kAulVPR!s=iubx2I@hTWMp7shDi!AFtRW*GqEtSva@lpGV>S% zB?XyT6om{~9Rm}El?oe;*hD5S+~}mNA{uls$=IZ*>7p~c>ZITg4?iXsn~E*k)U4(* zIV8pP(Bcv^@k^nPQa^2OIefYF@n<*nDN9HZQ8PJ$F4p5 zX6_!IUfw=^`S#=2pMMtwMF|rN3)oHUY^Uu>f6As3gp4)HqQD+%8Z@IN|>-1|DXxoq`PZ W3|~X0pIWK1{Qu4WqtQMRqa6S<2|%_0 literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/fdf/tests/01-general.phpt b/phpt/tests/php-5.2.5/ext/fdf/tests/01-general.phpt new file mode 100644 index 0000000000000..998da3d7297cd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/fdf/tests/01-general.phpt @@ -0,0 +1,10 @@ +--TEST-- +Adobe Form Data Format functions +--SKIPIF-- + +--FILE-- + +--EXPECT-- +OK \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/fdf/tests/02-values.phpt b/phpt/tests/php-5.2.5/ext/fdf/tests/02-values.phpt new file mode 100644 index 0000000000000..40c7df4a0ebcd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/fdf/tests/02-values.phpt @@ -0,0 +1,19 @@ +--TEST-- +FDF open/save and set/get values +--SKIPIF-- + +--FILE-- + +--EXPECT-- +foo: bar +bar: foo diff --git a/phpt/tests/php-5.2.5/ext/fdf/tests/03-read-file.phpt b/phpt/tests/php-5.2.5/ext/fdf/tests/03-read-file.phpt new file mode 100644 index 0000000000000..a611142b3f123 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/fdf/tests/03-read-file.phpt @@ -0,0 +1,15 @@ +--TEST-- +FDF read file +--SKIPIF-- + +--FILE-- + +--EXPECT-- +foo: bar +bar: foo diff --git a/phpt/tests/php-5.2.5/ext/fdf/tests/04-POST.phpt b/phpt/tests/php-5.2.5/ext/fdf/tests/04-POST.phpt new file mode 100644 index 0000000000000..1d8c9de48f1d5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/fdf/tests/04-POST.phpt @@ -0,0 +1,40 @@ +--TEST-- +FDF POST data parsing +--SKIPIF-- + +--HEADERS-- +return <<> ] /ID [ <3c0e51bf6427b09f7faa482297af6957><5f9787a1646a3bfe44b7725c9c1284df> +] >> +>> +endobj +trailer +<< +/Root 1 0 R + +>> +%%EOF +--FILE-- + $value) { + echo "$key => $value\n"; +} +?> +--EXPECT-- +209 +status: Thanks George \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/fdf/tests/simple.fdf b/phpt/tests/php-5.2.5/ext/fdf/tests/simple.fdf new file mode 100644 index 0000000000000..21d3fbd55af30 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/fdf/tests/simple.fdf @@ -0,0 +1,18 @@ +%FDF-1.2 +%âãÏÓ +1 0 obj +<< +/FDF << /Fields 2 0 R >> +>> +endobj +2 0 obj +[ +<< /T (foo)/V (bar)>> << /T (bar)/V (foo)>> +] +endobj +trailer +<< +/Root 1 0 R + +>> +%%EOF diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/001.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/001.phpt new file mode 100644 index 0000000000000..2755a57363b4e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/001.phpt @@ -0,0 +1,8 @@ +--TEST-- +Simple GET test +--GET-- +a=1 +--FILE-- + +--EXPECT-- +1 diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/002.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/002.phpt new file mode 100644 index 0000000000000..7136b251a6fd5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/002.phpt @@ -0,0 +1,11 @@ +--TEST-- +GET test with 2 values and an empty one +--GET-- +a=1&b=&c=3 +--FILE-- + +--EXPECT-- +13 diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/003.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/003.phpt new file mode 100644 index 0000000000000..43e6cd9b03c07 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/003.phpt @@ -0,0 +1,22 @@ +--TEST-- +GET/POST/REQUEST Test +--POST-- +d=4&e=5 +--GET-- +a=1&b=&c=3 +--FILE-- + +--EXPECT-- +1345 +1345 diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/004.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/004.phpt new file mode 100644 index 0000000000000..b89912493648f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/004.phpt @@ -0,0 +1,26 @@ +--TEST-- +GET/POST/REQUEST Test with filtered data +--SKIPIF-- + +--INI-- +filter.default=special_chars +--POST-- +d="quotes"&e=\slash +--GET-- +a=O'Henry&b=&c=Bold +--FILE-- + +--EXPECT-- +O'Henry<b>Bold</b>"quotes"\slash +O'Henry<b>Bold</b>"quotes"\slash diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/005.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/005.phpt new file mode 100644 index 0000000000000..f44379153ea7f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/005.phpt @@ -0,0 +1,21 @@ +--TEST-- +GET/REQUEST Test with fifa example data +--INI-- +filter.default=stripped +--GET-- +id=f03_photos&pgurl=http%3A//fifaworldcup.yahoo.com/03/en/photozone/index.html +--FILE-- + +--EXPECT-- +f03_photos +http://fifaworldcup.yahoo.com/03/en/photozone/index.html +f03_photos +http://fifaworldcup.yahoo.com/03/en/photozone/index.html diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/006.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/006.phpt new file mode 100644 index 0000000000000..9439e471c2e56 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/006.phpt @@ -0,0 +1,12 @@ +--TEST-- +filter() test +--SKIPIF-- + +--POST-- +foo=abc +--FILE-- + +--EXPECT-- +abc diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/007.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/007.phpt new file mode 100644 index 0000000000000..96e0b5f18cea0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/007.phpt @@ -0,0 +1,64 @@ +--TEST-- +filter_has_var() +--SKIPIF-- + +--GET-- +a=qwe&abc=href +--POST-- +b=qwe&bbc=href +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) +bool(false) +bool(false) +bool(false) + +Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d +bool(false) +bool(true) +bool(true) +bool(false) +bool(false) +bool(false) + +Warning: filter_has_var() expects parameter 2 to be string, array given in %s007.php on line %d +bool(false) +bool(false) + +Warning: filter_has_var() expects parameter 1 to be long, string given in %s007.php on line %d +bool(false) + +Warning: filter_has_var() expects parameter 1 to be long, array given in %s007.php on line %d +bool(false) + +Warning: filter_has_var() expects parameter 1 to be long, array given in %s007.php on line %d +bool(false) + +Warning: filter_has_var() expects parameter 1 to be long, string given in %s007.php on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/008.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/008.phpt new file mode 100644 index 0000000000000..e6c646d6756b1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/008.phpt @@ -0,0 +1,55 @@ +--TEST-- +filter_list() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(18) { + [0]=> + string(3) "int" + [1]=> + string(7) "boolean" + [2]=> + string(5) "float" + [3]=> + string(15) "validate_regexp" + [4]=> + string(12) "validate_url" + [5]=> + string(14) "validate_email" + [6]=> + string(11) "validate_ip" + [7]=> + string(6) "string" + [8]=> + string(8) "stripped" + [9]=> + string(7) "encoded" + [10]=> + string(13) "special_chars" + [11]=> + string(10) "unsafe_raw" + [12]=> + string(5) "email" + [13]=> + string(3) "url" + [14]=> + string(10) "number_int" + [15]=> + string(12) "number_float" + [16]=> + string(12) "magic_quotes" + [17]=> + string(8) "callback" +} + +Warning: Wrong parameter count for filter_list() in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/009.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/009.phpt new file mode 100644 index 0000000000000..d09f996fd07dd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/009.phpt @@ -0,0 +1,32 @@ +--TEST-- +filter_id() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +int(513) +int(513) +int(518) +int(257) +bool(false) + +Warning: filter_id() expects parameter 1 to be string, array given in %s on line %d +NULL +bool(false) + +Warning: filter_id() expects exactly 1 parameter, 3 given in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/010.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/010.phpt new file mode 100644 index 0000000000000..e868c10c4c39a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/010.phpt @@ -0,0 +1,64 @@ +--TEST-- +filter_var() +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(7) { + [0]=> + int(1) + [1]=> + int(1) + [2]=> + bool(false) + [3]=> + int(-23234) + [4]=> + bool(false) + [5]=> + bool(false) + [6]=> + array(0) { + } +} +array(7) { + [0]=> + float(1.2) + [1]=> + float(1.7) + [2]=> + bool(false) + [3]=> + float(-23234.123) + [4]=> + bool(false) + [5]=> + bool(false) + [6]=> + array(0) { + } +} + +Warning: filter_var() expects parameter 2 to be long, array given in %s on line %d +NULL +string(1) "1" +string(1) "1" +string(1) "1" +bool(false) +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/011.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/011.phpt new file mode 100644 index 0000000000000..6a9bf1fa34cce --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/011.phpt @@ -0,0 +1,54 @@ +--TEST-- +input_get() +--INI-- +precision=14 +--SKIPIF-- + +--GET-- +a=test&b=http://example.com +--POST-- +c=

    string

    &d=12345.7 +--FILE-- + +--EXPECTF-- +string(4) "test" +string(18) "http://example.com" +string(27) "<b>test</b>" + +Notice: Object of class stdClass could not be converted to int in %s011.php on line %d +bool(false) +string(6) "string" +float(12345.7) +string(29) "<p>string</p>" +bool(false) + +Warning: filter_var() expects parameter 2 to be long, string given in %s011.php on line %d +NULL + +Warning: filter_input() expects parameter 3 to be long, string given in %s011.php on line %d +NULL + +Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d +NULL + +Warning: filter_var() expects at most 3 parameters, 5 given in %s011.php on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/012.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/012.phpt new file mode 100644 index 0000000000000..9a8ead944d6fc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/012.phpt @@ -0,0 +1,18 @@ +--TEST-- +filter_input() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +NULL +NULL +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/013.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/013.phpt new file mode 100644 index 0000000000000..421c5d55bfc03 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/013.phpt @@ -0,0 +1,74 @@ +--TEST-- +filter_var() and flags +--SKIPIF-- + +--FILE-- +FILTER_FLAG_ALLOW_HEX))); +var_dump(filter_var("0Xff", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); +var_dump(filter_var("0xFF", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); +var_dump(filter_var("0XFF", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); +var_dump(filter_var("07", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))); +var_dump(filter_var("0xff0000", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); +var_dump(filter_var("0666", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))); +var_dump(filter_var("08", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))); +var_dump(filter_var("00", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))); +var_dump(filter_var("000", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))); + +var_dump(filter_var("-0xff", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); +var_dump(filter_var("-0Xff", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); +var_dump(filter_var("-0xFF", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); +var_dump(filter_var("-0XFF", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); +var_dump(filter_var("-07", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))); +var_dump(filter_var("-0xff0000", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_HEX))); +var_dump(filter_var("-0666", FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))); + +var_dump(filter_var("6", FILTER_VALIDATE_INT, array("options" => array("min_range"=>1, "max_range"=>7)))); +var_dump(filter_var("6", FILTER_VALIDATE_INT, array("options" => array("min_range"=>0, "max_range"=>5)))); +var_dump(filter_var(-1, FILTER_VALIDATE_INT, array("options" => array("min_range"=>1, "max_range"=>7)))); +var_dump(filter_var(-1, FILTER_VALIDATE_INT, array("options" => array("min_range"=>-4, "max_range"=>7)))); + +var_dump(filter_var("", FILTER_VALIDATE_INT, array("options" => array("min_range"=>-4, "max_range"=>7)))); +var_dump(filter_var("", FILTER_VALIDATE_INT, array("options" => array("min_range"=>2, "max_range"=>7)))); +var_dump(filter_var("", FILTER_VALIDATE_INT, array("options" => array("min_range"=>-5, "max_range"=>-3)))); +var_dump(filter_var(345, FILTER_VALIDATE_INT, array("options" => array("min_range"=>500, "max_range"=>100)))); +var_dump(filter_var("0ff", FILTER_VALIDATE_INT)); +var_dump(filter_var("010", FILTER_VALIDATE_INT)); + +echo "Done\n"; +?> +--EXPECT-- +int(234) +int(234) +int(234) +int(255) +int(255) +int(255) +int(255) +int(7) +int(16711680) +int(438) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(6) +bool(false) +bool(false) +int(-1) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/014.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/014.phpt new file mode 100644 index 0000000000000..8837457147604 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/014.phpt @@ -0,0 +1,70 @@ +--TEST-- +filter_var() and FILTER_VALIDATE_BOOLEAN +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +bool(false) +array(5) { + [0]=> + bool(true) + [1]=> + bool(false) + [2]=> + bool(false) + [3]=> + bool(false) + [4]=> + array(2) { + [0]=> + bool(false) + [1]=> + bool(false) + } +} +bool(true) +bool(true) +bool(false) +bool(false) +bool(true) +bool(false) +bool(true) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/015.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/015.phpt new file mode 100644 index 0000000000000..a9c4a8cf48489 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/015.phpt @@ -0,0 +1,81 @@ +--TEST-- +filter_var() and FILTER_VALIDATE_URL +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(29) "http://example.com/index.html" +string(32) "http://www.example.com/index.php" +string(31) "http://www.example/img/test.png" +string(27) "http://www.example/img/dir/" +string(26) "http://www.example/img/dir" +bool(false) +bool(false) +string(18) "file:///tmp/test.c" +string(26) "ftp://ftp.example.com/tmp/" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +string(18) "mailto:foo@bar.com" +string(17) "news:news.php.net" +string(14) "file://foo/bar" +bool(false) +bool(false) +string(10) "http://qwe" +bool(false) +bool(false) +string(22) "http://www.example.com" +bool(false) +string(42) "http://www.example.com/path/at/the/server/" +bool(false) +string(40) "http://www.example.com/index.php?a=b&c=d" +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/016.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/016.phpt new file mode 100644 index 0000000000000..e013c550a623d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/016.phpt @@ -0,0 +1,34 @@ +--TEST-- +filter_var() and FILTER_VALIDATE_EMAIL +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(5) "a@b.c" +string(17) "abuse@example.com" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +string(57) "QWERTYUIOPASDFGHJKLZXCVBNM@QWERTYUIOPASDFGHJKLZXCVBNM.NET" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/017.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/017.phpt new file mode 100644 index 0000000000000..518ee7925614c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/017.phpt @@ -0,0 +1,26 @@ +--TEST-- +filter_var() and FILTER_VALIDATE_REGEXP +--SKIPIF-- + +--FILE-- +array("regexp"=>'/.*/')))); +var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/^b(.*)/')))); +var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/^d(.*)/')))); +var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/blah/')))); +var_dump(filter_var("data", FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>'/\[/')))); +var_dump(filter_var("data", FILTER_VALIDATE_REGEXP)); + +echo "Done\n"; +?> +--EXPECTF-- +string(4) "data" +bool(false) +string(4) "data" +bool(false) +bool(false) + +Warning: filter_var(): 'regexp' option missing in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/018.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/018.phpt new file mode 100644 index 0000000000000..10840aae74e0c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/018.phpt @@ -0,0 +1,52 @@ +--TEST-- +filter_var() and FILTER_VALIDATE_IP +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(11) "192.168.0.1" +bool(false) +string(3) "::1" +string(7) "fe00::0" +bool(false) +bool(false) +string(9) "127.0.0.1" +bool(false) +string(12) "192.0.34.166" +string(9) "127.0.0.1" +string(9) "192.0.0.1" +string(12) "192.0.34.166" +bool(false) +string(15) "255.255.255.255" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +string(3) "::1" +string(9) "127.0.0.1" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/019.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/019.phpt new file mode 100644 index 0000000000000..1665181cd2014 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/019.phpt @@ -0,0 +1,22 @@ +--TEST-- +filter_var() & FILTER_VALIDATE_IP and weird data +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(false) +bool(false) +bool(false) +bool(false) +string(7) "1.1.1.1" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/020.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/020.phpt new file mode 100644 index 0000000000000..c2ab6096d529b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/020.phpt @@ -0,0 +1,20 @@ +--TEST-- +filter_var() and FILTER_SANITIZE_MAGIC_QUOTES +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(36) "test\'asd\'asd\'\' asd\\\'\"asdfasdf" +string(2) "\'" +string(0) "" +string(2) "-1" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/021.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/021.phpt new file mode 100644 index 0000000000000..994dac282b00b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/021.phpt @@ -0,0 +1,46 @@ +--TEST-- +filter_var() and FILTER_SANITIZE_NUMBER_* +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(6) "123456" +string(11) "12312312323" +string(5) "12323" +string(0) "" +string(1) "0" +string(4) "1232" +string(0) "" +string(5) "123.4" +string(4) "1234" +string(4) "1234" +string(5) "123,4" +string(5) "1234e" +string(5) "1234E" +string(4) "1234" +string(8) "65456.34" +string(6) "234.56" +string(0) "" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/022.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/022.phpt new file mode 100644 index 0000000000000..649c6e409d386 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/022.phpt @@ -0,0 +1,22 @@ +--TEST-- +filter_var() and FILTER_SANITIZE_EMAIL +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(5) "a@b.c" +string(30) "a[!@#$%^&*@a@#$%^&*.com@#$%^&*" +string(21) "whitespaceheresommore" +string(0) "" +string(15) "123456789000000" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/023.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/023.phpt new file mode 100644 index 0000000000000..f8d4137bf0137 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/023.phpt @@ -0,0 +1,22 @@ +--TEST-- +filter_var() and FILTER_UNSAFE_RAW +--SKIPIF-- + +--FILE-- +test para

    ", FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP)); +var_dump(filter_var("a[!@#$%^&*()@a@#$%^&*(.
    com@#$%^&*(", FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP)); +var_dump(filter_var("white space here \ \ \" some more", FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP)); +var_dump(filter_var("", FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP)); +var_dump(filter_var(" 123456789000000 ", FILTER_UNSAFE_RAW, FILTER_FLAG_ENCODE_AMP)); + +echo "Done\n"; +?> +--EXPECT-- +string(18) "}"

    test para

    " +string(53) "a[!@#$%^&*()@a@#$%^&*(.
    com@#$%^&*(" +string(32) "white space here \ \ " some more" +string(0) "" +string(48) " 123456789000000 " +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/024.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/024.phpt new file mode 100644 index 0000000000000..7d7349fcd4a0e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/024.phpt @@ -0,0 +1,20 @@ +--TEST-- +filter_var() and FILTER_SANITIZE_ENCODED +--SKIPIF-- + +--FILE-- +blah", FILTER_SANITIZE_ENCODED)); +var_dump(filter_var("", FILTER_SANITIZE_ENCODED)); +var_dump(filter_var(" text here ", FILTER_SANITIZE_ENCODED)); +var_dump(filter_var("!@#$%^&*()QWERTYUIOP{ASDFGHJKL:\"ZXCVBNM<>?", FILTER_SANITIZE_ENCODED)); + +echo "Done\n"; +?> +--EXPECT-- +string(26) "%22%3Cbr%3Eblah%3C%2Fph%3E" +string(0) "" +string(23) "%20%20text%20here%20%20" +string(74) "%21%40%23%24%25%5E%26%2A%28%29QWERTYUIOP%7BASDFGHJKL%3A%22ZXCVBNM%3C%3E%3F" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/025.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/025.phpt new file mode 100644 index 0000000000000..df8c3737bf30d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/025.phpt @@ -0,0 +1,26 @@ +--TEST-- +filter_var() and FILTER_SANITIZE_STRING +--SKIPIF-- + +--FILE-- +", FILTER_SANITIZE_STRING)); +var_dump(filter_var("<>!@#$%^&*()'\"", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES)); +var_dump(filter_var("<>!@#$%^&*()'\"", FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP)); +var_dump(filter_var("<>`1234567890", FILTER_SANITIZE_STRING)); +var_dump(filter_var("`123`", FILTER_SANITIZE_STRING)); +var_dump(filter_var(".", FILTER_SANITIZE_STRING)); + +echo "Done\n"; +?> +--EXPECT-- +string(0) "" +string(0) "" +string(12) "!@#$%^&*()'"" +string(24) "!@#$%^&*()'"" +string(11) "`1234567890" +string(5) "`123`" +string(1) "." +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/026.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/026.phpt new file mode 100644 index 0000000000000..38d15e7d0ac52 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/026.phpt @@ -0,0 +1,32 @@ +--TEST-- +filter_var() and FILTER_SANITIZE_STRIPPED +--SKIPIF-- + +--FILE-- +Let me see you
    Stripped down to the bone

    ", FILTER_SANITIZE_STRIPPED)); +var_dump(filter_var("!@#$%^&*()><<>+_\"'

  • ", FILTER_SANITIZE_STRIPPED)); +var_dump(filter_var("", FILTER_SANITIZE_STRIPPED)); + +var_dump(filter_var("

    Let me see you
    Stripped down to the bone

    ", FILTER_SANITIZE_STRIPPED, FILTER_FLAG_STRIP_LOW)); +var_dump(filter_var("!@#$%^&*()><<>+_\"'

  • ", FILTER_SANITIZE_STRIPPED, FILTER_FLAG_STRIP_LOW)); +var_dump(filter_var("", FILTER_SANITIZE_STRIPPED, FILTER_FLAG_STRIP_LOW)); + +var_dump(filter_var("

    Let me see you
    Stripped down to the bone

    ", FILTER_SANITIZE_STRIPPED, FILTER_FLAG_STRIP_HIGH)); +var_dump(filter_var("!@#$%^&*()><<>+_\"'

  • ", FILTER_SANITIZE_STRIPPED, FILTER_FLAG_STRIP_HIGH)); +var_dump(filter_var("", FILTER_SANITIZE_STRIPPED, FILTER_FLAG_STRIP_HIGH)); + +echo "Done\n"; +?> +--EXPECTF-- +string(40) "Let me see you Stripped down to the bone" +string(11) "!@#$%^&*()>" +string(0) "" +string(40) "Let me see you Stripped down to the bone" +string(11) "!@#$%^&*()>" +string(0) "" +string(40) "Let me see you Stripped down to the bone" +string(11) "!@#$%^&*()>" +string(0) "" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/027.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/027.phpt new file mode 100644 index 0000000000000..759030a643f1a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/027.phpt @@ -0,0 +1,32 @@ +--TEST-- +filter_var() and FILTER_SANITIZE_ENCODED +--SKIPIF-- + +--FILE-- +", FILTER_SANITIZE_ENCODED)); +var_dump(filter_var("", FILTER_SANITIZE_ENCODED)); + +var_dump(filter_var("?>", FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_LOW)); +var_dump(filter_var("", FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_LOW)); + +var_dump(filter_var("?>", FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_HIGH)); +var_dump(filter_var("", FILTER_SANITIZE_ENCODED, FILTER_FLAG_ENCODE_HIGH)); + +echo "Done\n"; +?> +--EXPECT-- +string(75) "%3F%3E%3C%21%40%23%24%25%5E%26%2A%28%29%7D%7B%7EQwertyuilfdsasdfgmnbvcxcvbn" +string(17) "%3Cdata%26sons%3E" +string(0) "" +string(75) "%3F%3E%3C%21%40%23%24%25%5E%26%2A%28%29%7D%7B%7EQwertyuilfdsasdfgmnbvcxcvbn" +string(17) "%3Cdata%26sons%3E" +string(0) "" +string(75) "%3F%3E%3C%21%40%23%24%25%5E%26%2A%28%29%7D%7B%7EQwertyuilfdsasdfgmnbvcxcvbn" +string(17) "%3Cdata%26sons%3E" +string(0) "" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/028.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/028.phpt new file mode 100644 index 0000000000000..c0ab16fe833ef --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/028.phpt @@ -0,0 +1,37 @@ +--TEST-- +filter_var() and FILTER_SANITIZE_SPECIAL_CHARS +--SKIPIF-- + +--FILE-- +", FILTER_SANITIZE_SPECIAL_CHARS)); +var_dump(filter_var("", FILTER_SANITIZE_SPECIAL_CHARS)); + +var_dump(filter_var("?>", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW)); +var_dump(filter_var("", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW)); + +var_dump(filter_var("?>", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH)); +var_dump(filter_var("", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH)); + +var_dump(filter_var("кириллица", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_HIGH)); +var_dump(filter_var("кириллица", FILTER_SANITIZE_SPECIAL_CHARS, FILTER_FLAG_ENCODE_LOW)); + +echo "Done\n"; +?> +--EXPECT-- +string(55) "?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn" +string(23) "<data&sons>" +string(0) "" +string(55) "?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn" +string(23) "<data&sons>" +string(0) "" +string(55) "?><!@#$%^&*()}{~Qwertyuilfdsasdfgmnbvcxcvbn" +string(23) "<data&sons>" +string(0) "" +string(108) "кириллица" +string(18) "кириллица" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/029.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/029.phpt new file mode 100644 index 0000000000000..c1ede74ab05bf --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/029.phpt @@ -0,0 +1,105 @@ +--TEST-- +filter_var() and FILTER_CALLBACK +--SKIPIF-- + +--FILE-- +"test"))); +var_dump(filter_var("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FILTER_CALLBACK, array("options"=>"test"))); +var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test"))); +var_dump(filter_var("qwe", FILTER_CALLBACK, array("options"=>"no such func"))); +var_dump(filter_var("qwe", FILTER_CALLBACK, array("options"=>""))); +var_dump(filter_var("qwe", FILTER_CALLBACK)); + +/* Simple class method callback */ +class test_class { + static function test ($var) { + return strtolower($var); + } +} + +var_dump(filter_var("dAtA", FILTER_CALLBACK, array("options"=>array("test_class", "test")))); +var_dump(filter_var("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FILTER_CALLBACK, array("options"=>array("test_class","test")))); +var_dump(filter_var("", FILTER_CALLBACK, array("options"=>array("test_class","test")))); + +/* empty function without return value */ +function test1($var) { +} + +var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test1"))); +var_dump(filter_var("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FILTER_CALLBACK, array("options"=>"test1"))); +var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test1"))); + +/* attempting to change data by reference */ +function test2(&$var) { + $var = 1; +} + +var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test2"))); +var_dump(filter_var("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FILTER_CALLBACK, array("options"=>"test2"))); +var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test2"))); + +/* unsetting data */ +function test3(&$var) { + unset($var); +} + +var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test3"))); +var_dump(filter_var("~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?\"}{:", FILTER_CALLBACK, array("options"=>"test3"))); +var_dump(filter_var("", FILTER_CALLBACK, array("options"=>"test3"))); + +/* unset data and return value */ +function test4(&$var) { + unset($var); + return 1; +} + +var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test4"))); + +/* thrown exception in the callback */ +function test5(&$var) { + throw new Exception("test"); +} + +try { + var_dump(filter_var("data", FILTER_CALLBACK, array("options"=>"test5"))); +} catch (Exception $e) { + var_dump($e->getMessage()); +} + +echo "Done\n"; +?> +--EXPECTF-- +string(4) "DATA" +string(46) "~!@#$%^&*()_QWERTYUIOPASDFGHJKLZXCVBNM<>>?"}{:" +string(0) "" + +Warning: filter_var(): First argument is expected to be a valid callback in %s on line %d +NULL + +Warning: filter_var(): First argument is expected to be a valid callback in %s on line %d +NULL + +Warning: filter_var(): First argument is expected to be a valid callback in %s on line %d +NULL +string(4) "data" +string(46) "~!@#$%^&*()_qwertyuiopasdfghjklzxcvbnm<>>?"}{:" +string(0) "" +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +int(1) +string(4) "test" +Done diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/030.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/030.phpt new file mode 100644 index 0000000000000..d3466f5b42c68 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/030.phpt @@ -0,0 +1,43 @@ +--TEST-- +filter_var() and IPv6 +--SKIPIF-- + +--FILE-- + true, + "FF01::101:127.0.1" => false, + "FF01:0:0:0:101:127.0.1.1" => false, + "FF01:0:0:0:237:101:127.0.1.1" => true, + "FF01::101" => true, + "A1080::8:800:200C:417A" => false, + "1080::8:Z00:200C:417A" => false, + "FF01::101::1" => false, + "1080::8:800:200C:417A" => true, + "1080:0:0:0:8:800:200C:417A" => true, + "2001:ec8:1:1:1:1:1:1" => true, + "ffff::FFFF:129.144.52.38" => true, + "::ffff:1.2.3.4" => true, + "0:0:0:0:0:FFFF:129.144.52.38" => true, + "0:0:0:0:0:0:13.1.68.3" => true, + "::13.1.68.3" => true, + "::FFFF:129.144.52.38" => true, + "1:2:3:4:5:6::129.144.52.38" => false, + "::1:2:3:4:5:6:129.144.52.38" => false, + "1:2:3::4:5:6:129.144.52.38" => false, + "1:2:3:4:5:6:7:8::" => false, + "::1:2:3:4:5:6:7:8" => false, + "1:2:3:4::5:6:7:8" => false, +); +foreach ($ipv6_test as $ip => $exp) { + $out = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6); + $out = (int) ($out === false ? 0 : 1); + if ($exp != $out) { + echo "$ip failed\n"; + } +} + +echo "Ok\n"; +?> +--EXPECT-- +Ok diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/031.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/031.phpt new file mode 100644 index 0000000000000..23691fbbba739 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/031.phpt @@ -0,0 +1,58 @@ +--TEST-- +filter_var() and FLOAT +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + ',', +'1,234' => ',', +' 1.234' => '.', +'1.234' => '..', +'1.2e3' => ',' +); + +echo "\ncustom decimal:\n"; +foreach ($floats as $float => $dec) { + $out = filter_var($float, FILTER_VALIDATE_FLOAT, array("options"=>array('decimal' => $dec))); + var_dump($out); +} + +?> +--EXPECTF-- +float(1.234) +float(1.234) +float(1.234) +float(1200) +float(7000) +float(7000) +float(7000) +float(0.007) + +custom decimal: +bool(false) +float(1.234) +float(1.234) + +Warning: filter_var(): decimal separator must be one char in %s on line %d +bool(false) +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/filter/tests/032.phpt b/phpt/tests/php-5.2.5/ext/filter/tests/032.phpt new file mode 100644 index 0000000000000..d88d502792621 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/filter/tests/032.phpt @@ -0,0 +1,57 @@ +--TEST-- +input_get_args() +--SKIPIF-- + +--FILE-- + 'libgdqqq", + "asdasdblah", + "some another text <> hoho " + ); + +foreach ($array as $str) { + file_put_contents($filename, $str); + $fp = fopen($filename, "r"); + var_dump(fgetss($fp)); + var_dump(fgetss($fp)); +} + +foreach ($array as $str) { + file_put_contents($filename, $str); + $fp = fopen($filename, "r"); + var_dump(fgetss($fp, 10)); + var_dump(fgetss($fp, 10)); +} + +var_dump(fgetss($fp, -10)); +var_dump(fgetss($fp, 0)); +fclose($fp); +var_dump(fgetss($fp, 0)); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(18) "askasdfasdfaaaaaa +" +string(6) "dddddd" +string(6) "asdqw +" +string(8) "aaaaqqqq" +string(23) "aaafunction foo() {}qqq" +bool(false) +string(6) "asdasd" +string(0) "" +bool(false) +bool(false) +string(11) "some text +" +string(4) "blah" +string(24) "some another text hoho " +bool(false) +string(9) "askasdfas" +string(6) "dfaaaa" +string(5) "asdqw" +string(0) "" +string(3) "aaa" +string(7) "functio" +string(6) "asdasd" +string(0) "" +bool(false) +bool(false) +string(9) "some text" +string(2) " +" +string(9) "some anot" +string(9) "her text " + +Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d +bool(false) + +Warning: fgetss(): Length parameter must be greater than 0 in %s on line %d +bool(false) + +Warning: fgetss(): %d is not a valid stream resource in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss1.phpt new file mode 100644 index 0000000000000..96b8b6f5328e5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/file/fgetss1.phpt @@ -0,0 +1,69 @@ +--TEST-- +more fgetss() tests +--FILE-- +aaaaaa\ndddddd", + "asdqw\naaaa<>qqqq", + "aaaqqq", + "asdasdblah", + "some another text <> hoho " + ); + +foreach ($array as $str) { + file_put_contents($filename, $str); + $fp = fopen($filename, "r"); + var_dump(fgetss($fp, 1000, ",,")); + var_dump(fgetss($fp)); +} + +foreach ($array as $str) { + file_put_contents($filename, $str); + $fp = fopen($filename, "r"); + var_dump(fgetss($fp, 10)); + var_dump(fgetss($fp, 10, "", + '', + "hello

    world

    ", + 'hello

    world

    ', + "", + '' +); + + +// Calling strip_tags() with default arguments +// loop through the $string_array to test strip_tags on various inputs +$iteration = 1; +foreach($string_array as $string) +{ + echo "-- Iteration $iteration --\n"; + var_dump( strip_tags($string) ); + $iteration++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : basic functionality *** +-- Iteration 1 -- +string(5) "hello" +-- Iteration 2 -- +string(5) "hello" +-- Iteration 3 -- +string(0) "" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(0) "" +-- Iteration 6 -- +string(0) "" +-- Iteration 7 -- +string(0) "" +-- Iteration 8 -- +string(0) "" +-- Iteration 9 -- +string(12) " echo hello " +-- Iteration 10 -- +string(12) " echo hello " +-- Iteration 11 -- +string(10) "helloworld" +-- Iteration 12 -- +string(10) "helloworld" +-- Iteration 13 -- +string(0) "" +-- Iteration 14 -- +string(0) "" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_basic2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_basic2.phpt new file mode 100644 index 0000000000000..0ca5f6df39f56 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_basic2.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test strip_tags() function : basic functionality - with all arguments +--INI-- +set short_open_tag = on +--FILE-- +

    hello

    world
    Other text"; + +$allowed_tags_array=array( + "", + '', + "

    ", + '

    ', + "", + '', + "

    +--EXPECTF-- +*** Testing strip_tags() : basic functionality *** +-- Iteration 1 -- +string(33) "helloworldOther text" +-- Iteration 2 -- +string(33) "helloworldOther text" +-- Iteration 3 -- +string(27) "

    hello

    worldOther text" +-- Iteration 4 -- +string(27) "

    hello

    worldOther text" +-- Iteration 5 -- +string(44) "helloworld
    Other text" +-- Iteration 6 -- +string(44) "helloworldOther text" +-- Iteration 7 -- +string(20) "helloworldOther text" +-- Iteration 8 -- +string(20) "helloworldOther text" +-- Iteration 9 -- +string(64) "

    hello

    worldOther text" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_error.phpt new file mode 100644 index 0000000000000..fcd3963fe2dc9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test strip_tags() function : error conditions +--INI-- +set short_open_tag = on +--FILE-- +hello"; +$allowable_tags = ""; +$extra_arg = 10; +var_dump( strip_tags($str, $allowable_tags, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : error conditions *** + +-- Testing strip_tags() function with Zero arguments -- + +Warning: Wrong parameter count for strip_tags() in %s on line %d +NULL + +-- Testing strip_tags() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for strip_tags() in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation1.phpt new file mode 100644 index 0000000000000..b312fb24e1aaa --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation1.phpt @@ -0,0 +1,157 @@ +--TEST-- +Test strip_tags() function : usage variations - unexpected values for 'str' argument +--INI-- +set short_open_tag = on +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new classA(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource variable + $fp + +); + +// loop through each element of the array for allowable_tags +$iterator = 1; +foreach($values as $value) { + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($value) ); + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(5) "-10.5" +-- Iteration 7 -- +string(12) "105000000000" +-- Iteration 8 -- +string(7) "1.06E-9" +-- Iteration 9 -- +string(3) "0.5" +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 15 -- +string(0) "" +-- Iteration 16 -- +string(0) "" +-- Iteration 17 -- +string(1) "1" +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(1) "1" +-- Iteration 20 -- +string(0) "" +-- Iteration 21 -- +string(0) "" +-- Iteration 22 -- +string(0) "" +-- Iteration 23 -- +string(14) "Class A object" +-- Iteration 24 -- +string(0) "" +-- Iteration 25 -- +string(0) "" +-- Iteration 26 -- +string(%d) "Resource id #%d" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation10.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation10.phpt new file mode 100644 index 0000000000000..a9c3f6466890e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation10.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test strip_tags() function : usage variations - single quoted strings +--INI-- +set short_open_tag = on +--FILE-- + \$ -> This represents the dollar sign', + '\t\r\v The quick brown fo\fx jumped over the lazy dog

    ', + 'This is a hyper text tag', + 'hello world\\t?>', + '

    This is a paragraph

    ', + 'This is \ta text in bold letters\r\s\malong with slashes\n' +); + +$quotes = "

    +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(51) " \$ -> This represents the dollar sign" +-- Iteration 2 -- +string(63) "\t\r\v The quick brown fo\fx jumped over the lazy dog

    " +-- Iteration 3 -- +string(31) "
    This is a hyper text tag" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(26) "

    This is a paragraph

    " +-- Iteration 6 -- +string(65) "This is \ta text in bold letters\r\s\malong with slashes\n" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation2.phpt new file mode 100644 index 0000000000000..5e0df80292f9b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation2.phpt @@ -0,0 +1,159 @@ +--TEST-- +Test strip_tags() function : usage variations - unexpected values for 'allowable_tags' +--INI-- +set short_open_tag = on +--FILE-- +hello

    world

    "; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//get a resource variable +$fp = fopen(__FILE__, "r"); + +//get a class +class classA{ + public function __toString(){ + return "Class A Object"; + } +} + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.5e10, + 10.6E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new classA(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource variable + $fp +); + +// loop through each element of the array for allowable_tags +$iterator = 1; +foreach($values as $value) { + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($string, $value) ); + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(10) "helloworld" +-- Iteration 2 -- +string(10) "helloworld" +-- Iteration 3 -- +string(10) "helloworld" +-- Iteration 4 -- +string(10) "helloworld" +-- Iteration 5 -- +string(10) "helloworld" +-- Iteration 6 -- +string(10) "helloworld" +-- Iteration 7 -- +string(10) "helloworld" +-- Iteration 8 -- +string(10) "helloworld" +-- Iteration 9 -- +string(10) "helloworld" +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(10) "helloworld" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(10) "helloworld" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(10) "helloworld" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(10) "helloworld" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(10) "helloworld" +-- Iteration 15 -- +string(10) "helloworld" +-- Iteration 16 -- +string(10) "helloworld" +-- Iteration 17 -- +string(10) "helloworld" +-- Iteration 18 -- +string(10) "helloworld" +-- Iteration 19 -- +string(10) "helloworld" +-- Iteration 20 -- +string(10) "helloworld" +-- Iteration 21 -- +string(10) "helloworld" +-- Iteration 22 -- +string(10) "helloworld" +-- Iteration 23 -- +string(10) "helloworld" +-- Iteration 24 -- +string(10) "helloworld" +-- Iteration 25 -- +string(10) "helloworld" +-- Iteration 26 -- +string(10) "helloworld" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation3.phpt new file mode 100644 index 0000000000000..1e1ed9efb7ba9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation3.phpt @@ -0,0 +1,167 @@ +--TEST-- +Test strip_tags() function : usage variations - unexpected values for both 'str' and 'allowable_tags' +--INI-- +set short_open_tag = on +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new classA(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource variable + $fp + +); + +// loop through each element of the array for allowable_tags +$iterator = 1; +foreach($values as $value) { + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($value, $value) ); + $iterator++; +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(5) "-10.5" +-- Iteration 7 -- +string(12) "105000000000" +-- Iteration 8 -- +string(7) "1.06E-9" +-- Iteration 9 -- +string(3) "0.5" +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 15 -- +string(0) "" +-- Iteration 16 -- +string(0) "" +-- Iteration 17 -- +string(1) "1" +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(1) "1" +-- Iteration 20 -- +string(0) "" +-- Iteration 21 -- +string(0) "" +-- Iteration 22 -- +string(0) "" +-- Iteration 23 -- +string(14) "Class A object" +-- Iteration 24 -- +string(0) "" +-- Iteration 25 -- +string(0) "" +-- Iteration 26 -- +string(%d) "Resource id #%d" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation4.phpt new file mode 100644 index 0000000000000..b6fd404227797 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation4.phpt @@ -0,0 +1,74 @@ +--TEST-- +Test strip_tags() function : usage variations - invalid values for 'str' and valid 'allowable_tags' +--INI-- +set short_open_tag = on +--FILE-- +hello \t\tworld... strip_tags_test", + 'hello \t\tworld... strip_tags_test', + "<%?php hello\t world?%>", + '<%?php hello\t world?%>', + "<>hello<>", + '<>hello<>', + "HtMl text", + 'HtMl text', + "I am not a valid html text", + 'I am not a valid html text', + "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&", + 'I am a quoted (\") string with special chars like \$,\!,\@,\%,\&', +); + +//valid html and php tags +$quotes = "

    "; + +//loop through the various elements of strings array to test strip_tags() functionality +$iterator = 1; +foreach($strings as $string_value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($string_value, $quotes) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(32) "hello world... strip_tags_test" +-- Iteration 2 -- +string(34) "hello \t\tworld... strip_tags_test" +-- Iteration 3 -- +string(0) "" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(18) "hello" +-- Iteration 6 -- +string(18) "hello" +-- Iteration 7 -- +string(9) "HtMl text" +-- Iteration 8 -- +string(9) "HtMl text" +-- Iteration 9 -- +string(26) "I am not a valid html text" +-- Iteration 10 -- +string(26) "I am not a valid html text" +-- Iteration 11 -- +string(62) "I am a quoted (") string with special chars like $,\!,\@,\%,\&" +-- Iteration 12 -- +string(64) "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation5.phpt new file mode 100644 index 0000000000000..0eaea23de089b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation5.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test strip_tags() function : usage variations - heredoc strings +--INI-- +set short_open_tag = on +--FILE-- +hello world +

    13 < 25

    + +This is a double quoted string +EOT; + +// here doc with diferent whitespaces +$diff_whitespaces = <<hello\r world\t +1111\t\t != 2222\v\v + +EOT; + +// here doc with numeric values +$numeric_string = <<11 < 12. 123 >22 +

    string

    1111\t 0000\t = 0000\n +EOT; + +// heredoc with quote chars & slash +$quote_char_string = <<This's a string with quotes: +"strings in double quote"; +'strings in single quote'; +this\line is single quoted /with\slashes +EOT; + +$res_heredoc_strings = array( + //heredoc strings + $null_string, + $blank_line, + $multiline_string, + $diff_whitespaces, + $numeric_string, + $quote_char_string +); + +// initialize the second argument +$quotes = "
    +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(0) "" +-- Iteration 2 -- +string(0) "" +-- Iteration 3 -- +string(67) "hello world +13 < 25 + +This is a double quoted string" +-- Iteration 4 -- +string(44) "hello world +1111 != 2222 +" +-- Iteration 5 -- +string(56) "11 < 12. 123 >22 +string 1111 0000 = 0000 +" +-- Iteration 6 -- +string(150) "This's a string with quotes: +"strings in double quote"; +'strings in single quote'; +this\line is single quoted /with\slashes " +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation6.phpt new file mode 100644 index 0000000000000..ff219063650cb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation6.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test strip_tags() function : usage variations - binary safe checking +--INI-- +set short_open_tag = on +--FILE-- + I am html string ".chr(0)."", + " I am html string\0 ", + b"I am html string", + "I am html string".decbin(65)."" +); + +//loop through the strings array to check if strip_tags() is binary safe +$iterator = 1; +foreach($strings as $value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($value) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(18) " I am html string " +-- Iteration 2 -- +string(18) " I am html string " +-- Iteration 3 -- +string(16) "I am html string" +-- Iteration 4 -- +string(23) "I am html string1000001" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation7.phpt new file mode 100644 index 0000000000000..1c76940b8f1cb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation7.phpt @@ -0,0 +1,72 @@ +--TEST-- +Test strip_tags() function : usage variations - invalid values for 'str' and 'allowable_tags' +--INI-- +set short_open_tag = on +--FILE-- +hello \t\tworld... strip_tags_test", + 'hello \t\tworld... strip_tags_test', + "<%?php hello\t world?%>", + '<%?php hello\t world?%>', + "<>hello<>", + '<>hello<>', + "HtMl text", + 'HtMl text', + "I am not a valid html text", + 'I am not a valid html text', + "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&", + 'I am a quoted (\") string with special chars like \$,\!,\@,\%,\&', +); + +$quotes = "<%?<>"; + +//loop through the various elements of strings array to test strip_tags() functionality +$iterator = 1; +foreach($strings as $string_value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($string_value, $quotes) ); + $iterator++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(43) "hello world... strip_tags_test" +-- Iteration 2 -- +string(45) "hello \t\tworld... strip_tags_test" +-- Iteration 3 -- +string(0) "" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(18) "hello" +-- Iteration 6 -- +string(18) "hello" +-- Iteration 7 -- +string(9) "HtMl text" +-- Iteration 8 -- +string(9) "HtMl text" +-- Iteration 9 -- +string(37) "I am not a valid html text" +-- Iteration 10 -- +string(37) "I am not a valid html text" +-- Iteration 11 -- +string(73) "I am a quoted (") string with special chars like $,\!,\@,\%,\&" +-- Iteration 12 -- +string(75) "I am a quoted (\") string with special chars like \$,\!,\@,\%,\&" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation8.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation8.phpt new file mode 100644 index 0000000000000..a8b45c1a2a051 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation8.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test strip_tags() function : usage variations - valid value for 'str' and invalid values for 'allowable_tags' +--INI-- +set short_open_tag = on +--FILE-- +hello \tworld...

    strip_tags_test\v\f

    "; + +$quotes = array ( + "", + '', + "", + '', + "<%?php", + '<%?php', + "<>", + '<>' +); + +//loop through the various elements of strings array to test strip_tags() functionality +$iterator = 1; +foreach($quotes as $string_value) +{ + echo "-- Iteration $iterator --\n"; + var_dump( strip_tags($strings, $string_value) ); + $iterator++; +} + +echo "Done"; +--EXPECTF-- +*** Testing strip_tags() : usage variations *** +-- Iteration 1 -- +string(33) "hello world... strip_tags_test " +-- Iteration 2 -- +string(33) "hello world... strip_tags_test " +-- Iteration 3 -- +string(33) "hello world... strip_tags_test " +-- Iteration 4 -- +string(33) "hello world... strip_tags_test " +-- Iteration 5 -- +string(33) "hello world... strip_tags_test " +-- Iteration 6 -- +string(33) "hello world... strip_tags_test " +-- Iteration 7 -- +string(46) "hello world... strip_tags_test " +-- Iteration 8 -- +string(46) "hello world... strip_tags_test " +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation9.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation9.phpt new file mode 100644 index 0000000000000..2665773a51662 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strip_tags_variation9.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test strip_tags() function : usage variations - double quoted strings +--INI-- +set short_open_tag = on +--FILE-- + \$ -> This represents the dollar sign", + "\t\r\v The quick brown fo\fx jumped over the lazy dog

    ", + "This is a hyper text tag", + "hello world\\t?>", + "

    This is a paragraph

    ", + "This is \ta text in bold letters\r\s\malong with slashes\n" +); + +$quotes = "

    $ -> This represents the dollar sign" +-- Iteration 2 -- +string(59) " The quick brown fo x jumped over the lazy dog

    " +-- Iteration 3 -- +string(31) "
    This is a hyper text tag" +-- Iteration 4 -- +string(0) "" +-- Iteration 5 -- +string(26) "

    This is a paragraph

    " +-- Iteration 6 -- +string(62) "This is a text in bold letters \s\malong with slashes +" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos.phpt new file mode 100644 index 0000000000000..ef0efe5b236c8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos.phpt @@ -0,0 +1,55 @@ +--TEST-- +stripos() function test +--FILE-- + +--EXPECT-- +int(0) +int(5) +int(5) +int(3) +int(10) +int(2) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(1) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_basic1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_basic1.phpt new file mode 100644 index 0000000000000..cffbdba1b5975 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_basic1.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test stripos() function : basic functionality - with default arguments +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: basic functionality *** +-- With default arguments -- +int(0) +int(0) +int(7) +int(7) +int(4) +int(5) +int(0) +int(0) +int(0) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_basic2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_basic2.phpt new file mode 100644 index 0000000000000..3022bae168052 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_basic2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test stripos() function : basic functionality - with all arguments +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: basic functionality *** +-- With all arguments -- +int(0) +bool(false) +int(7) +int(7) +int(0) +int(0) +bool(false) +int(0) +bool(false) +int(4) +int(8) +int(8) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_error.phpt new file mode 100644 index 0000000000000..ef6ad9e6ec2c2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_error.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test stripos() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: error conditions *** + +-- With Zero arguments -- +Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d +NULL + +-- With less than expected number of arguments -- +Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d +NULL + +-- With more than expected number of arguments -- +Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d +NULL +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation1.phpt new file mode 100644 index 0000000000000..f3e743cc028d9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation1.phpt @@ -0,0 +1,226 @@ +--TEST-- +Test stripos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 "; +$needle = array( + //regular strings + "l", + "L", + "HELLO", + "hEllo", + + //escape characters + "\t", + "\T", //invalid input + " ", + "\n", + "\N", //invalid input + " +", //new line + + //nulls + "\0", + NULL, + null, + + //boolean false + FALSE, + false, + + //empty string + "", + + //special chars + " ", + "$", + " $", + "&", + "!#", + "%\o", + "\o,", + "()", + "*+", + "+", + "-", + ".", + ".;", + ":;", + ";", + "<=>", + ">", + "=>", + "?", + "@", + "@hEllo", + + "12345", //decimal numeric string + "\x23", //hexadecimal numeric string + "#", //respective ASCII char of \x23 + "\101", //octal numeric string + "A", //respective ASCII char of \101 + "456HEE", //numerics + chars + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing stripos() function: with double quoted strings *** +-- Iteration 1 -- +int(2) +int(2) +-- Iteration 2 -- +int(2) +int(2) +-- Iteration 3 -- +int(0) +int(34) +-- Iteration 4 -- +int(0) +int(34) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(7) +int(7) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- +int(7) +int(9) +-- Iteration 11 -- +int(8) +bool(false) +-- Iteration 12 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 14 -- +int(8) +bool(false) +-- Iteration 15 -- +int(8) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +-- Iteration 17 -- +int(10) +int(47) +-- Iteration 18 -- +int(12) +bool(false) +-- Iteration 19 -- +int(11) +bool(false) +-- Iteration 20 -- +int(13) +bool(false) +-- Iteration 21 -- +int(14) +bool(false) +-- Iteration 22 -- +int(16) +bool(false) +-- Iteration 23 -- +int(17) +bool(false) +-- Iteration 24 -- +int(20) +bool(false) +-- Iteration 25 -- +int(22) +bool(false) +-- Iteration 26 -- +int(23) +bool(false) +-- Iteration 27 -- +int(24) +bool(false) +-- Iteration 28 -- +int(25) +bool(false) +-- Iteration 29 -- +bool(false) +bool(false) +-- Iteration 30 -- +int(27) +bool(false) +-- Iteration 31 -- +int(28) +bool(false) +-- Iteration 32 -- +int(29) +bool(false) +-- Iteration 33 -- +int(31) +bool(false) +-- Iteration 34 -- +int(30) +bool(false) +-- Iteration 35 -- +int(32) +bool(false) +-- Iteration 36 -- +int(33) +bool(false) +-- Iteration 37 -- +int(33) +bool(false) +-- Iteration 38 -- +int(39) +int(39) +-- Iteration 39 -- +int(15) +int(48) +-- Iteration 40 -- +int(15) +int(48) +-- Iteration 41 -- +int(51) +int(51) +-- Iteration 42 -- +int(51) +int(51) +-- Iteration 43 -- +bool(false) +bool(false) +-- Iteration 44 -- +int(0) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation10.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation10.phpt new file mode 100644 index 0000000000000..efdbb52389e70 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation10.phpt @@ -0,0 +1,196 @@ +--TEST-- +Test stripos() function : usage variations - unexpected inputs for 'needle' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop through each element of the 'needle' array to check the working of stripos() +$counter = 1; +for($index = 0; $index < count($needles); $index ++) { + echo "\n-- Iteration $counter --\n"; + var_dump( stripos($haystack, $needles[$index]) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing stripos() function with unexpected values for needle *** + +-- Iteration 1 -- +bool(false) + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +bool(false) + +-- Iteration 4 -- +bool(false) + +-- Iteration 5 -- +bool(false) + +-- Iteration 6 -- +bool(false) + +-- Iteration 7 -- +bool(false) + +-- Iteration 8 -- +bool(false) + +-- Iteration 9 -- +bool(false) + +-- Iteration 10 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +bool(false) + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 20 -- +bool(false) + +-- Iteration 21 -- +bool(false) + +-- Iteration 22 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 23 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 24 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 25 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +-- Iteration 26 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation11.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation11.phpt new file mode 100644 index 0000000000000..4736761261934 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation11.phpt @@ -0,0 +1,215 @@ +--TEST-- +Test stripos() function : usage variations - unexpected inputs for 'haystack' and 'needle' arguments +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of stripos() +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $haystack = $values[$index]; + var_dump( stripos($values[$index], $values[$index]) ); + var_dump( stripos($values[$index], $values[$index], 1) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing stripos() function with unexpected values for haystack and needle *** +-- Iteration 1 -- +bool(false) +bool(false) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +bool(false) +bool(false) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +bool(false) +bool(false) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +bool(false) +bool(false) +-- Iteration 16 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 17 -- +bool(false) +bool(false) +-- Iteration 18 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 20 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 21 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 22 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 23 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 24 -- + +Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 26 -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation12.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation12.phpt new file mode 100644 index 0000000000000..bd0d8aeb8f198 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation12.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test stripos() function : usage variations - null terminated strings for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Test stripos() function: binary safe *** +int(5) +int(5) +int(0) +bool(false) +int(11) +int(11) +int(0) +bool(false) +int(5) +int(5) +int(0) +bool(false) +int(5) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation13.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation13.phpt new file mode 100644 index 0000000000000..3c4508f0837ab --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation13.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test stripos() function : usage variations - null terminated strings for 'needle' argument +--FILE-- + +--EXPECTF-- +*** Test stripos() function: binary safe *** +int(1) +int(1) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(1) +bool(false) +int(0) +bool(false) +int(1) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation14.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation14.phpt new file mode 100644 index 0000000000000..023585dbb765b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation14.phpt @@ -0,0 +1,155 @@ +--TEST-- +Test stripos() function : usage variations - unexpected inputs for 'offset' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + //resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of stripos() +$counter = 1; +for($index = 0; $index < count($offsets); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( stripos($haystack, $needle, $offsets[$index]) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing stripos() function with unexpected values for offset *** +-- Iteration 1 -- +int(6) +-- Iteration 2 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 4 -- +int(6) +-- Iteration 5 -- +int(6) +-- Iteration 6 -- + +Warning: stripos() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: stripos() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: stripos() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 9 -- + +Warning: stripos() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 10 -- + +Warning: stripos() expects parameter 3 to be long, array given in %s on line %d +NULL +-- Iteration 11 -- +int(6) +-- Iteration 12 -- +int(6) +-- Iteration 13 -- +int(6) +-- Iteration 14 -- +int(6) +-- Iteration 15 -- + +Warning: stripos() expects parameter 3 to be long, object given in %s on line %d +NULL +-- Iteration 16 -- + +Warning: stripos() expects parameter 3 to be long, string given in %s on line %d +NULL +-- Iteration 17 -- + +Warning: stripos() expects parameter 3 to be long, string given in %s on line %d +NULL +-- Iteration 18 -- +int(6) +-- Iteration 19 -- +int(6) +-- Iteration 20 -- + +Warning: stripos() expects parameter 3 to be long, resource given in %s on line %d +NULL +-- Iteration 21 -- +int(6) +-- Iteration 22 -- +int(6) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation15.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation15.phpt new file mode 100644 index 0000000000000..2304c1d35003f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation15.phpt @@ -0,0 +1,171 @@ +--TEST-- +Test stripos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + //resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of stripos() +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( stripos($values[$index], $values[$index], $values[$index]) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing stripos() function with unexpected values for haystack, needle & offset *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- + +Warning: stripos() expects parameter 3 to be long, object given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: stripos() expects parameter 3 to be long, string given in %s on line %d +NULL +-- Iteration 21 -- + +Warning: stripos() expects parameter 3 to be long, string given in %s on line %d +NULL +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- + +Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation2.phpt new file mode 100644 index 0000000000000..e4d8a153e0cf0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation2.phpt @@ -0,0 +1,234 @@ +--TEST-- +Test stripos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 '; +$needle = array( + //regular strings + 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters + '\t', + '\T', + ' ', + '\n', + '\N', + ' +', //new line + + //nulls + '\0', + NULL, + null, + + //boolean false + FALSE, + false, + + //empty string + '', + + //special chars + ' ', + '$', + ' $', + '&', + '!#', + '%\o', + '\o,', + '()', + '*+', + '+', + '-', + '.', + '.;', + '.;', + ':;', + ';', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + + '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //hexadecimal numeric string + '\101', //octal numeric string + 'A', + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing stripos() function: with single quoted strings *** +-- Iteration 1 -- +int(2) +int(2) +-- Iteration 2 -- +int(2) +int(2) +-- Iteration 3 -- +int(0) +int(38) +-- Iteration 4 -- +int(0) +int(38) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +int(6) +int(6) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(8) +int(8) +-- Iteration 9 -- +int(8) +int(8) +-- Iteration 10 -- +bool(false) +bool(false) +-- Iteration 11 -- +int(10) +int(10) +-- Iteration 12 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) + +Warning: stripos(): needle is not a string or an integer in %s on line %d +bool(false) +-- Iteration 14 -- +bool(false) +bool(false) +-- Iteration 15 -- +bool(false) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +-- Iteration 17 -- +int(14) +int(51) +-- Iteration 18 -- +int(16) +bool(false) +-- Iteration 19 -- +int(15) +bool(false) +-- Iteration 20 -- +int(17) +bool(false) +-- Iteration 21 -- +int(18) +bool(false) +-- Iteration 22 -- +int(20) +bool(false) +-- Iteration 23 -- +int(21) +bool(false) +-- Iteration 24 -- +int(24) +int(24) +-- Iteration 25 -- +int(26) +int(26) +-- Iteration 26 -- +int(27) +int(27) +-- Iteration 27 -- +int(28) +int(28) +-- Iteration 28 -- +int(29) +int(29) +-- Iteration 29 -- +bool(false) +bool(false) +-- Iteration 30 -- +bool(false) +bool(false) +-- Iteration 31 -- +int(31) +int(31) +-- Iteration 32 -- +int(32) +int(32) +-- Iteration 33 -- +int(33) +int(33) +-- Iteration 34 -- +int(35) +int(35) +-- Iteration 35 -- +int(34) +int(34) +-- Iteration 36 -- +int(36) +int(36) +-- Iteration 37 -- +int(37) +int(37) +-- Iteration 38 -- +int(37) +int(37) +-- Iteration 39 -- +int(43) +int(43) +-- Iteration 40 -- +int(52) +int(52) +-- Iteration 41 -- +int(19) +bool(false) +-- Iteration 42 -- +int(58) +int(58) +-- Iteration 43 -- +bool(false) +bool(false) +-- Iteration 44 -- +bool(false) +bool(false) +-- Iteration 45 -- +int(26) +bool(false) +-- Iteration 46 -- +int(0) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation3.phpt new file mode 100644 index 0000000000000..40cdea48fe8ca --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation3.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test stripos() function : usage variations - multi line heredoc string for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing multi lines -- +int(14) +int(23) +int(23) +bool(false) +int(7) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation4.phpt new file mode 100644 index 0000000000000..8249ef0f608d1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation4.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test stripos() function : usage variations - heredoc string containing special chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing special chars -- +int(0) +bool(false) +int(38) +int(39) +int(55) +int(55) +int(57) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation5.phpt new file mode 100644 index 0000000000000..900fe04bb7eeb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation5.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test stripos() function : usage variations - heredoc string containing escape chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing escape characters -- +int(12) +int(19) +int(12) +int(19) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation6.phpt new file mode 100644 index 0000000000000..c69ee174d1990 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation6.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test stripos() function : usage variations - heredoc string containing quotes for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: with heredoc strings *** +-- With heredoc string containing quote & slash chars -- +int(88) +int(34) +int(34) +int(34) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation7.phpt new file mode 100644 index 0000000000000..29a0a20469ac3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation7.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test stripos() function : usage variations - empty heredoc string for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: with heredoc strings *** +-- With empty heredoc string -- +bool(false) + +Warning: stripos(): Offset not contained in string in %s on line %d +bool(false) +bool(false) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation8.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation8.phpt new file mode 100644 index 0000000000000..cbf96bf12a32d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation8.phpt @@ -0,0 +1,216 @@ +--TEST-- +Test stripos() function : usage variations - repetitive chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing stripos() function: strings repetitive chars *** + +-- Iteration 1 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 2 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 3 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 4 -- +int(0) +int(2) +int(2) +int(4) +int(4) +int(6) +int(6) +int(8) +int(8) +int(10) +int(10) +int(12) +int(12) +int(14) +int(14) +int(16) +int(16) +bool(false) +bool(false) +bool(false) + +-- Iteration 5 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) + +-- Iteration 6 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) + +-- Iteration 7 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) + +-- Iteration 8 -- +int(1) +int(1) +int(3) +int(3) +int(5) +int(5) +int(7) +int(7) +int(9) +int(9) +int(11) +int(11) +int(13) +int(13) +int(15) +int(15) +bool(false) +bool(false) +bool(false) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation9.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation9.phpt new file mode 100644 index 0000000000000..1401dcfae8f8c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripos_variation9.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test stripos() function : usage variations - unexpected inputs for 'haystack' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +$needle = "heredoc 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource"; + +// loop through each element of the array and check the working of stripos() +$counter = 1; +for($index = 0; $index < count($haystacks); $index ++) { + echo "\n-- Iteration $counter --\n"; + var_dump( stripos($haystacks[$index], $needle) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing stripos() function with unexpected values for haystack *** + +-- Iteration 1 -- +bool(false) + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +bool(false) + +-- Iteration 4 -- +bool(false) + +-- Iteration 5 -- +bool(false) + +-- Iteration 6 -- +bool(false) + +-- Iteration 7 -- +bool(false) + +-- Iteration 8 -- +bool(false) + +-- Iteration 9 -- +bool(false) + +-- Iteration 10 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 11 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 12 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 13 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 14 -- + +Warning: stripos() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +bool(false) + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- +bool(false) + +-- Iteration 20 -- +bool(false) + +-- Iteration 21 -- +bool(false) + +-- Iteration 22 -- +bool(false) + +-- Iteration 23 -- +bool(false) + +-- Iteration 24 -- + +Warning: stripos() expects parameter 1 to be string, resource given in %s on line %d +NULL + +-- Iteration 25 -- +bool(false) + +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_basic.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_basic.phpt new file mode 100644 index 0000000000000000000000000000000000000000..548aee5376ce017ac1866859dafcb9af3107c1ed GIT binary patch literal 2036 zcmds1U2obj6y39b#a%RsfR<5;wrOk~np&!Mn$}8X(jFoq;}~KswW;ltvT6T)*A58@ zr9$*^d4R;e_ndP-qi8(38AlNrb7R3+EfyxDCgmn4 zUw#{*^QYk=U65`EuC=ntt`;27$Dzr20~EsY^cCJhn?MK7xM4`^hz9UOMt8Zg+yDjt zl9Ue4^hV{HabPOp1KuU8k}gJG))eDxD<(M!(6D4^8G7u#{@b zEY~|EwTm*HVsWa@sJh)FxUx|_&u_W3hRl@al%*lm%0`XdM|Zw4^R89_U4}GKm|de}sRTtN;K2 literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_error.phpt new file mode 100644 index 0000000000000..cef09fc2df8bb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_error.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test stripslashes() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing stripslashes() : error conditions *** + +-- Testing stripslashes() function with Zero arguments -- + +Warning: Wrong parameter count for stripslashes() in %s on line %d +NULL + +-- Testing stripslashes() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for stripslashes() in %s on line %d +NULL +string(18) "\"hello\"\"world\"" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation1.phpt new file mode 100644 index 0000000000000..4d58fd7a0543e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation1.phpt @@ -0,0 +1,170 @@ +--TEST-- +Test stripslashes() function : usage variations - non-string type argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // empty string + "", + '', + + // undefined variable + $undefined_var, + + // unset variable + $unset_var, + + // objects + new sample(), + + // resource + $file_handle, + + // NULL values + NULL, + null +); + + +// loop through each element of the array and check the working of stripslashes() +// when $str arugment is supplied with different values +echo "\n--- Testing stripslashes() by supplying different values for 'str' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str = $values [$index]; + + var_dump( stripslashes($str) ); + + $counter ++; +} + +// closing the file +fclose($file_handle); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing stripslashes() : with non-string type argument *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +--- Testing stripslashes() by supplying different values for 'str' argument --- +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(5) "-10.5" +-- Iteration 7 -- +string(12) "105000000000" +-- Iteration 8 -- +string(7) "1.06E-9" +-- Iteration 9 -- +string(3) "0.5" +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 15 -- +string(1) "1" +-- Iteration 16 -- +string(0) "" +-- Iteration 17 -- +string(1) "1" +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(0) "" +-- Iteration 20 -- +string(0) "" +-- Iteration 21 -- +string(0) "" +-- Iteration 22 -- +string(0) "" +-- Iteration 23 -- +string(6) "obj'ct" +-- Iteration 24 -- +string(%d) "Resource id #%d" +-- Iteration 25 -- +string(0) "" +-- Iteration 26 -- +string(0) "" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation2.phpt new file mode 100644 index 0000000000000000000000000000000000000000..d813d0b33987e958278b76cbd7b8944fe37a2812 GIT binary patch literal 9548 zcmd5?ZEw>^5bjs}D+W_=TAC(KpoO%h+(9bPokRusa33s1uDz`-9B2+{zjCSEX;Tg|v zuNfe3k{Vw%gu|e`yNyp_$ADdU%Tf>Fk@y*WWLcgd3^%TD_{9>U{lxRcW8iV0&4Arx zqcn44-%Wh{Lc;bvV|QdA5+YWqE|eg3d7c)0Q)CxsZWt3-FK`pr%UF^^7PuKcLnIdr zE?n=kRNUVu-e+Ngc13Fl4W(t#m~>S)5$fS1BNju#R{RS+#w#dHSS)CHM`*yjfP=Za zE42_pnm(LKe{4{t2Dz>l@^oVJ2#quX)Hw^?D3rJ%Us0czOGwU6TA`V}968YAi@jVhjnnvb$s^n@0{Hv8PxaB$c94&cj z?x|UuK98*o{4m8NzJT0HAZFoJaDiEyng~eo*|^5CdRAGap5kLUeNW6jR?6_I2aH;h zQhd{!Xf2AOO}53nfz%ECJxUME=qRFMgOxdA?iXhEX}MnYL(5FlJb!nNzkB$aJ=Qjz zz9*Jo_22=y0-<2^^^z*>T+cJLorROX$JpzNu&&|Cb=LcoVi{x8T`~CRuAD!TFb!h& zw8t!#XWC6Z+pJj}|zz4gbEd4rT@;RCbs$!LTzV#xGrc{pGV?&3N4N%zF6x(e~pfyRWw&KYB7cn(ZCG>IvSW z2p}sFPsmRR3zcaO8*2ZyQbFyvil{b0D1`3Nu;KAM&afrhN7Te4&acHt#(`27E_nhj zmSEYDam0yX-N+4m%3LoP)b4?siYwRw_y=Xmsm+OpLwJufq!_885IP)+u?vdj)f`O& zLUl19d59EfBwzaZ>Uv-e0H!)7c&R!qctaj#y7P)_|)NLsEXe@ke6 zZCz~rzTgpFiW%QS=!Bs_*C2z3CorbrA3vqZ=1Ibn8GJ~>t1!lxrUf)i9;hS)gzwqoL$wi3_2sf2?gux_Z7HmaMbVIiEy zTdF+QRfXK4i&L&`2F8IdkO>0OHyI^q$0&!t5SACe5SEv^Sf=EpYSZJ;*Y;is_Z^z) zE26$)uHucXo55y}wKbs(u7o+bv--KZP&`)bO%?O5GWsp*IZ7iP9NJgPFS=fMiL9#q zX~*8$P3mWt8C$yni8`Ylq~zDG=d>HieSpz!1)}j6X9t=&d?3Oe_p@Ca-K{bFWQXZ@ z2GX!|a8aFH=w{u7GPuLGJP+xlp>{K&>|XDhHJwajR(TTBfu`SED7A3AE>3XPM>vf$ z9BuOwm`SQoUG%>?W&rqmU@a4jsbEihM^?Zmo}V+v%#^ zGNiZH4NZUVVT<{+^mb=>nQFHKo2r4c?rS)lqfvDeSX92Uk(pbasGRC|3X#S|dBzM9 zg%uNNJQ`_(CDkRz@voksb}hWx&E*~nn}`{tkic3}Jm-(WZ; literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation3.phpt new file mode 100644 index 0000000000000..2ccf97ffd29fd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation3.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test stripslashes() function : usage variations - strings with newline and tab characters +--FILE-- + +--EXPECTF-- +*** Testing stripslashes() : with strings containing newline and tab characters *** + +-- Iteration 1 -- +string(1) " +" + +-- Iteration 2 -- +string(1) "n" + +-- Iteration 3 -- +string(12) "Hello +world" + +-- Iteration 4 -- +string(12) "Hello nworld" + +-- Iteration 5 -- +string(1) "n" + +-- Iteration 6 -- +string(1) "n" + +-- Iteration 7 -- +string(12) "Hello nworld" + +-- Iteration 8 -- +string(12) "Hello nworld" + +-- Iteration 9 -- +string(71) "This is line 1 +of 'heredoc' string +This is line 2 +of "heredoc" string" + +-- Iteration 10 -- +string(1) " " + +-- Iteration 11 -- +string(1) "t" + +-- Iteration 12 -- +string(12) "Hello world" + +-- Iteration 13 -- +string(12) "Hello tworld" + +-- Iteration 14 -- +string(1) "t" + +-- Iteration 15 -- +string(1) "t" + +-- Iteration 16 -- +string(12) "Hello tworld" + +-- Iteration 17 -- +string(12) "Hello tworld" + +-- Iteration 18 -- +string(71) "This is line 1 of 'heredoc' string +This is line 2 of "heredoc" string" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation4.phpt new file mode 100644 index 0000000000000..eccca6a64d435 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation4.phpt @@ -0,0 +1,133 @@ +--TEST-- +Test stripslashes() function : usage variations - double dimensional arrays +--FILE-- + +--EXPECTF-- +*** Testing stripslashes() : with double dimensional arrays *** + +-- Iteration 1 -- +array(2) { + [0]=> + string(0) "" + [1]=> + array(0) { + } +} + +-- Iteration 2 -- +array(2) { + [0]=> + string(0) "" + [1]=> + array(1) { + [0]=> + string(0) "" + } +} + +-- Iteration 3 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(2) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + } +} + +-- Iteration 4 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(1) { + [0]=> + string(0) "" + } +} + +-- Iteration 5 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(3) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + [2]=> + array(1) { + [0]=> + string(0) "" + } + } +} + +-- Iteration 6 -- +array(3) { + [0]=> + string(4) "f'oo" + [1]=> + string(4) "b'ar" + [2]=> + array(3) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + [2]=> + array(2) { + [0]=> + string(4) "fo'o" + [1]=> + string(4) "b'ar" + } + } +} +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stripslashes_variation5.phpt new file mode 100644 index 0000000000000000000000000000000000000000..0507e04960797c83bdef221c4da36a8b8c01ea69 GIT binary patch literal 8397 zcmd5>+iu%N5cO;L6_bqHy!e8mU(}!M z%<^KAT3YrxD5?aBB+i~WbJ;yZYA~3cexD5n#!MtBBx&qlBmqx6k@Who%t9yiqY$Q$ zCH!2#C69eh-y|@AD?jyM#m{|b{%01YBAF*Q3!VsY{aE0-O95YhGX{fCUw%DB2S+Ct z-i0yTfwMSDqx9xN0OFFz@Vwy|dgZs z&jUXpcn+S3g&R3#F1L%%^P)({aCCHZ`gLZ^JU;>a8~CAs5kyNc3sbXP+b|iE2`fxk zX@W?|qH+>uK~Q-r97z+P95k3x779*0j`@v2jWU;S;TYuqJupD=qHN|JM@5dZ6r1P< z9FND`NkyDsf_VxKcGg0`f;)fYo559rnV&@vL~s?wfotv>_wfjn=|DifVU(!Mi>}OA zz)h5a8=?6LmP~EwMxmKvKP9*y7Lb`Sgu*}f7PtWthJ+L^cGnuy>{w+|c#4;4cU@s! zP)eL;SupHuad(oi-yq?>i_MJhuKXaNg5gOO2!1J87v0-c4_d|;!{Y$|?Z9OnX=8TR z6;nbzc|tiwD%eJyrZVmK$y(K}wSHEvGruI%UDz#rCEy!h*}ueo;)VRABR)QTlIH8#n$&#xh0bp5w(mtG{PfTTaoFrA=drx_t}N=8C&a zy8~MJ*P;}mL>V=+ZJU|ap8V6bJ6c9Xz;{vFV`X)^FilpJk5vim+?{6LjA+S&t41Nn&VC9aNXI(yd%i)FrBnYT~AF zN@~3AL|K@ke2orC?}8}0AW=>upj`*cC@dLmowMGU~&|0+z-jGOmp~th_Lps8H%Dl@%$?*KwKz z$JzwnAP<_HTBB3x_@O)x3b^JV)=K9@m+iztc$&l-<6Con(_}uTMBFvxu~rbTw1arH zF$fc1x~)>>sB6L{=w|o4)(wTqq02L0+a$8DOJs~h^ixKgbS)_d|06DMbh*f8xSifr zGrw;A?giZ}?_2FKs6w}4(A%|p7wtIih20EfWa&oomUc{eTck_51=8ZCEml8zH;?pH zNoGm&B&T}fsnp7fw&oOYrTRZmx0PJ9rDGrAAWk_2E#;=i9=e@CRlW#(8 zvDcRl68^hx)U^ZH4BU!ATXLvJZC#$l;uaTe$r+Ir%Ox`%ZaT#K*1tk8D)r}b!4m#h-2#Z+5eMwE*6r>okH&;{4zJJHsh|4gta+TwFS r`?m4ZX#VSI_4DZiem~W%!#+(73Jwqd1-HG4C)zsr_&YXwoND|F(hAR< literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/stristr.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stristr.phpt new file mode 100644 index 0000000000000..51c4dae97c166 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/stristr.phpt @@ -0,0 +1,43 @@ +--TEST-- +stristr() function +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for stristr() in %s on line %d +NULL + +Notice: Array to string conversion in %s on line %d + +Warning: stristr(): Empty delimiter in %s on line %d +bool(false) +bool(false) + +Notice: Array to string conversion in %s on line %d +bool(false) +string(11) "tEsT sTrInG" +string(6) "sTrInG" +string(6) "sTrInG" +string(8) "T sTrInG" +string(1) "G" +string(32) "7272696018bdeb2c9a3f8d01fc2a9273" +bool(false) +bool(false) +bool(false) +string(32) "6ec19f52f0766c463f3bb240f4396913" +string(7) " sTrInG" diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strlen.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strlen.phpt new file mode 100644 index 0000000000000000000000000000000000000000..41529b39f886ea7674231765b9be2d2ef0ba27e2 GIT binary patch literal 7030 zcmeHMZFAc;63$n1rvG8Z$hM?dwkX?aa>~3rJdTD+|+VBGzm#;DN-dV%dTtB z{h#}1_b2Y21waXusmRxtX+MOMi9qndVzCSCK3F%KCr8I8&8C%RNhqRPow}pQ%Yrzv zn$6d5U*pR#5nhm@hxW;7qx;qCH%I8-I~ewd)<%O8k&TilrK~RqGJ08`;x4(=3ob=O z5FA83YHV1R@cJ>?kMYo#ZW?$L4@KhgWGT6kPju-ffqrLHC$e{~suGZ5b~j1f>l)eL zh%k)T=zW}ozP)BGEfKAneXF{!QYq=R4-U*;J>IS!K3@K?(x}|6t?%p}jOMQF$?#&yG$|X?V=(HxSt5ypyOZ;qXu*tBtwp@nYxq9*C%X!~0 zY~HwBcuP;;$?P>M&fq9Rb+XmjFKX_S@82D%(XU>-Io8dBt$7Kg^pqy-w6qIUXTb-Z z7N#+<+FfvIX?IfI&8sL8(wTHq;mNzbeo}MVU)0yR0cWYk({0_cJ!w3x!wr_2!M*T& z(e3qvAAbr5Q9S%PNwd-A`0DzX7M#De{q*xMp50XrA6I#w)avI?_J2KizSrE{sagdk z)XVAF&F#(2&F$^&DW0=4{5xwj8Y?R+A3iKsvAGWqD^l1Bq%}79`L!dTGHIW5`}6E( z!~OMLiz8VW$3uj%Bp&tpl*QBy5S5ByO}Jiv8q;vZh^%g$)T+ULYnQ6Qo)?dztd>Wu zI`=(!Ql}fZRmHz!6%eP9ay18^R)e!u3J~g^6C$6Chv)uiFs$*69G*>NouKutg-6Nl zL>x2eM5Gx9+M_k`b21>l_)&Pkpie?zkFlVh$jE-_ zW?tXD2nBWB%neB-Nu2CZ>R$6q-^zg;^S#hbQ-TFTpQ1RU3xSvDQY4x1ttA*##d4c2 zt_f$&9fcW<`-p#TL~43o{SZQg50%qQxIW8O!*;9_WEeR&c^Cod4)8P z3pZ4u|G5^lPmvgFrLnP))sz?UnVo1GSi8!g2zmB_ zQU$F_b-97qg#S*@5O!7$AKz7gP>GYLn$;zjTK3J(Kb|^gQqS4JQ$Sk*O4sqdNaIoB z31cbU0CsQ(!ogx}Z1BPLdUlmz%UAge_jW-Iu-zv>tZi)LFwHzjpI#zB8Q^!eIpgI? z#mhb;oJa`uK{v3QK}z(A;yE$qJjb6iUd`{oY#P-Dsuo09eLj>ky594w z6r3j9ftnrrA7iC@lUcFdvA=BvvlR|n&00Fg!%e0IB!7U++S9rzwoUyw^ueh>sKSwu zGcc-Ew|U8Pgtv>rC$b&L?s{RIPVHgpP}*iAU_^c#*)67{tx*&P(N8!D69<<#*N_Z( zz6eEzO=Rqsc?Sn^JnD%=a>~9)gdcnQG){t>HYohLx3_on?N`=AGVDVzp9C#tQGY`l zX~G(_k>f!R4!&7jyH9((5R5@gq5m5z*0ssa9noT2*A~SdG>rO5%=8 zAM+E->hb(<>JwA8W5uS%0dAe%C<(9WB5{#y)@D^MRp17C-_DumhGT^OSTGN|k-lUy z;Xp&(Fm^K)YNr-~YTqFAP&SUq54v5nqm1HF#yo5dtS11E^aZjU0yXZ|%v!)ZBcEfY z4BN~(E(B86gha`3nvswG#a5QB%(5akZ&L$!aP3lag-{~(eWtfw~` z!0IU*C7)b={+c-h5=1l_T;PYR6-kc^7+{s+Y6uz(b*F`3wDFsBSvWpQ*rXr;>P>wP-Tha#J>{UdC#i(&J#_tpa?$F1mX5+5ZPGT7RMR&SL2XB}cP>FJ0@u{`2C$1$%Fo zZTg4s>OZ~mCa?I#_0cEAK31#ztrj!4&DJyQ2$dQa7Os#@ORH5@o(KzoY5Bym-o{zr zi5+^ue?Z{Ep336-qAvfo5k#~si5M=Xf|h+L6uPl&+^+ejjnGn|Ww$m3a_Zmm~G6kP9bt=T 0 + +echo "-- Testing strncasecmp() with double quoted string --\n"; +var_dump( strncasecmp("Hello", "Hello", 5) ); //expected: int(0) +var_dump( strncasecmp("Hello", "Hi", 5) ); //expected: value < 0 +var_dump( strncasecmp("Hi", "Hello", 5) ); //expected: value > 0 + +echo "-- Testing strncasecmp() with here-doc string --\n"; +$str = << 0 + +echo "*** Done ***"; +?> +--EXPECTREGEX-- +\*\*\* Testing strncasecmp\(\) function: basic functionality \*\*\* +-- Testing strncasecmp\(\) with single quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncasecmp\(\) with double quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncasecmp\(\) with here-doc string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +\*\*\* Done \*\*\* diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_error.phpt new file mode 100644 index 0000000000000..7282ea95412c3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_error.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strncasecmp() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strncasecmp() function: error conditions *** + +-- Testing strncasecmp() function with Zero arguments -- +Warning: Wrong parameter count for strncasecmp() in %s on line %d +NULL + +-- Testing strncasecmp() function with less than expected number of arguments -- +Warning: Wrong parameter count for strncasecmp() in %s on line %d +NULL + +Warning: Wrong parameter count for strncasecmp() in %s on line %d +NULL + +-- Testing strncasecmp() function with more than expected number of arguments -- +Warning: Wrong parameter count for strncasecmp() in %s on line %d +NULL + +-- Testing strncasecmp() function with invalid argument -- +Warning: Length must be greater than or equal to 0 in %s on line %d +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation1.phpt new file mode 100644 index 0000000000000..bcc6ad3d069ec --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation1.phpt @@ -0,0 +1,135 @@ +--TEST-- +Test strncasecmp() function: usage variations - case-sensitivity +--FILE-- + +--EXPECTF-- +*** Test strncasecmp() function: with alphabets *** +-- Passing upper-case letters for 'str1' -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Passing lower-case letters for 'str1' -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation10.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation10.phpt new file mode 100644 index 0000000000000..e06b2b26bfa05 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation10.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test strncasecmp() function : usage variations - unexpected values for 'str1' +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + @$undefined_var, + + /* unset variable */ + @$unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncasecmp() */ +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str1 = $values[$index]; + $len = strlen($values[$index]) + 1; + var_dump( strncasecmp($str1, "string", $len) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing strncasecmp() function: with unexpected values for 'str1' *** +-- Iteration 1 -- +int(-%d) +-- Iteration 2 -- +int(-%d) +-- Iteration 3 -- +int(-%d) +-- Iteration 4 -- +int(-%d) +-- Iteration 5 -- +int(-%d) +-- Iteration 6 -- +int(-%d) +-- Iteration 7 -- +int(-%d) +-- Iteration 8 -- +int(-%d) +-- Iteration 9 -- +int(-%d) +-- Iteration 10 -- +int(-%d) +-- Iteration 11 -- +int(-%d) +-- Iteration 12 -- +int(-%d) +-- Iteration 13 -- +int(-%d) +-- Iteration 14 -- +int(-%d) +-- Iteration 15 -- + +Notice: Array to string conversion in %s on line 88 + +Notice: Array to string conversion in %s on line 89 +int(-%d) +-- Iteration 16 -- + +Notice: Array to string conversion in %s on line 88 + +Notice: Array to string conversion in %s on line 89 +int(-%d) +-- Iteration 17 -- + +Notice: Array to string conversion in %s on line 88 + +Notice: Array to string conversion in %s on line 89 +int(-%d) +-- Iteration 18 -- + +Notice: Array to string conversion in %s on line 88 + +Notice: Array to string conversion in %s on line 89 +int(-%d) +-- Iteration 19 -- + +Notice: Array to string conversion in %s on line 88 + +Notice: Array to string conversion in %s on line 89 +int(-%d) +-- Iteration 20 -- +int(-%d) +-- Iteration 21 -- +int(-%d) +-- Iteration 22 -- +int(-%d) +-- Iteration 23 -- +int(-%d) +-- Iteration 24 -- +int(-%d) +-- Iteration 25 -- +int(-%d) +-- Iteration 26 -- +int(-%d) +-- Iteration 27 -- +int(-%d) +-- Iteration 28 -- +int(-%d) +-- Iteration 29 -- +int(-%d) +-- Iteration 30 -- +int(-%d) +-- Iteration 31 -- +int(-%d) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation11.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation11.phpt new file mode 100644 index 0000000000000..f756c6c006013 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation11.phpt @@ -0,0 +1,185 @@ +--TEST-- +Test strncasecmp() function : usage variations - unexpected values for 'str2' +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + @$undefined_var, + + /* unset variable */ + @$unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncasecmp() */ +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str1 = $values[$index]; + $str2 = $values[$index]; + $len = strlen($values[$index]) + 1; + var_dump( strncasecmp("string", $str2, $len) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing strncasecmp() function: with unexpected values for 'str2' *** +-- Iteration 1 -- +int(%d) +-- Iteration 2 -- +int(%d) +-- Iteration 3 -- +int(%d) +-- Iteration 4 -- +int(%d) +-- Iteration 5 -- +int(%d) +-- Iteration 6 -- +int(%d) +-- Iteration 7 -- +int(%d) +-- Iteration 8 -- +int(%d) +-- Iteration 9 -- +int(%d) +-- Iteration 10 -- +int(%d) +-- Iteration 11 -- +int(%d) +-- Iteration 12 -- +int(%d) +-- Iteration 13 -- +int(%d) +-- Iteration 14 -- +int(%d) +-- Iteration 15 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(%d) +-- Iteration 16 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(%d) +-- Iteration 17 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(%d) +-- Iteration 18 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(%d) +-- Iteration 19 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(%d) +-- Iteration 20 -- +int(%d) +-- Iteration 21 -- +int(%d) +-- Iteration 22 -- +int(%d) +-- Iteration 23 -- +int(%d) +-- Iteration 24 -- +int(%d) +-- Iteration 25 -- +int(%d) +-- Iteration 26 -- +int(%d) +-- Iteration 27 -- +int(%d) +-- Iteration 28 -- +int(%d) +-- Iteration 29 -- +int(%d) +-- Iteration 30 -- +int(%d) +-- Iteration 31 -- +int(%d) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation2.phpt new file mode 100644 index 0000000000000..a6f8c1ebb8bcb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation2.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test strncasecmp() function: usage variations - double quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncasecmp\(\) function: with double quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 2 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 3 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +-- Iteration 5 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation3.phpt new file mode 100644 index 0000000000000..8409260b2e81e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation3.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test strncasecmp() function: usage variations - various lengths +--FILE-- += 0; $len--) { + var_dump( strncasecmp($str1, $str2, $len) ); +} +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Test strncasecmp() function: with different lengths *** +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation4.phpt new file mode 100644 index 0000000000000..3f73aa3518812 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation4.phpt @@ -0,0 +1,195 @@ +--TEST-- +Test strncasecmp() function : usage variations - unexpected values for 'str1' & 'str2' +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + @$undefined_var, + + /* unset variable */ + @$unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncasecmp() */ +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str1 = $values[$index]; + $str2 = $values[$index]; + $len = strlen($values[$index]) + 1; + var_dump( strncasecmp($str1, $str2, $len) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing strncasecmp() function: with unexpected values for 'str1' and 'str2' *** +-- Iteration 1 -- +int(0) +-- Iteration 2 -- +int(0) +-- Iteration 3 -- +int(0) +-- Iteration 4 -- +int(0) +-- Iteration 5 -- +int(0) +-- Iteration 6 -- +int(0) +-- Iteration 7 -- +int(0) +-- Iteration 8 -- +int(0) +-- Iteration 9 -- +int(0) +-- Iteration 10 -- +int(0) +-- Iteration 11 -- +int(0) +-- Iteration 12 -- +int(0) +-- Iteration 13 -- +int(0) +-- Iteration 14 -- +int(0) +-- Iteration 15 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(0) +-- Iteration 16 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(0) +-- Iteration 17 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(0) +-- Iteration 18 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(0) +-- Iteration 19 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(0) +-- Iteration 20 -- +int(0) +-- Iteration 21 -- +int(0) +-- Iteration 22 -- +int(0) +-- Iteration 23 -- +int(0) +-- Iteration 24 -- +int(0) +-- Iteration 25 -- +int(0) +-- Iteration 26 -- +int(0) +-- Iteration 27 -- +int(0) +-- Iteration 28 -- +int(0) +-- Iteration 29 -- +int(0) +-- Iteration 30 -- +int(0) +-- Iteration 31 -- +int(0) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation5.phpt new file mode 100644 index 0000000000000..4a9fa89a7ce63 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation5.phpt @@ -0,0 +1,147 @@ +--TEST-- +Test strncasecmp() function : usage variations - unexpected values for 'len' +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + @$undefined_var, + + /* unset variable */ + @$unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncasecmp() */ +$counter = 1; +for($index = 0; $index < count($lengths); $index ++) { + $len = $lengths[$index]; + echo "-- Iteration $counter --\n"; + var_dump( strncasecmp($str1, $str2, $len) ); + $counter ++; +} +fclose($file_handle); + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Test strncasecmp() function: unexpected values for 'len' *** +-- Iteration 1 -- +int(0) +-- Iteration 2 -- +int(0) +-- Iteration 3 -- +int(0) +-- Iteration 4 -- +int(0) +-- Iteration 5 -- +int(0) +-- Iteration 6 -- +int(0) +-- Iteration 7 -- +int(0) +-- Iteration 8 -- +int(0) +-- Iteration 9 -- +int(0) +-- Iteration 10 -- +int(0) +-- Iteration 11 -- +int(0) +-- Iteration 12 -- +int(0) +-- Iteration 13 -- +int(0) +-- Iteration 14 -- +int(0) +-- Iteration 15 -- +int(0) +-- Iteration 16 -- +int(0) +-- Iteration 17 -- +int(0) +-- Iteration 18 -- +int(0) +-- Iteration 19 -- +int(0) +-- Iteration 20 -- +int(0) +-- Iteration 21 -- +int(0) +-- Iteration 22 -- +int(0) +-- Iteration 23 -- +int(0) +-- Iteration 24 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +int(0) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation6.phpt new file mode 100644 index 0000000000000..765032b77347b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation6.phpt @@ -0,0 +1,810 @@ +--TEST-- +Test strncasecmp() function : usage variations - binary safe - all ASCII chars +--FILE-- + +--EXPECTF-- +*** Test strncasecmp() function: with binary inputs *** + +-- Checking with all 256 characters given, in binary format -- +-- Iteration 1 -- +int(0) +int(0) +-- Iteration 2 -- +int(0) +int(0) +-- Iteration 3 -- +int(0) +int(0) +-- Iteration 4 -- +int(0) +int(0) +-- Iteration 5 -- +int(0) +int(0) +-- Iteration 6 -- +int(0) +int(0) +-- Iteration 7 -- +int(0) +int(0) +-- Iteration 8 -- +int(0) +int(0) +-- Iteration 9 -- +int(0) +int(0) +-- Iteration 10 -- +int(0) +int(0) +-- Iteration 11 -- +int(0) +int(0) +-- Iteration 12 -- +int(0) +int(0) +-- Iteration 13 -- +int(0) +int(0) +-- Iteration 14 -- +int(0) +int(0) +-- Iteration 15 -- +int(0) +int(0) +-- Iteration 16 -- +int(0) +int(0) +-- Iteration 17 -- +int(0) +int(0) +-- Iteration 18 -- +int(0) +int(0) +-- Iteration 19 -- +int(0) +int(0) +-- Iteration 20 -- +int(0) +int(0) +-- Iteration 21 -- +int(0) +int(0) +-- Iteration 22 -- +int(0) +int(0) +-- Iteration 23 -- +int(0) +int(0) +-- Iteration 24 -- +int(0) +int(0) +-- Iteration 25 -- +int(0) +int(0) +-- Iteration 26 -- +int(0) +int(0) +-- Iteration 27 -- +int(0) +int(0) +-- Iteration 28 -- +int(0) +int(0) +-- Iteration 29 -- +int(0) +int(0) +-- Iteration 30 -- +int(0) +int(0) +-- Iteration 31 -- +int(0) +int(0) +-- Iteration 32 -- +int(0) +int(0) +-- Iteration 33 -- +int(0) +int(0) +-- Iteration 34 -- +int(0) +int(0) +-- Iteration 35 -- +int(0) +int(0) +-- Iteration 36 -- +int(0) +int(0) +-- Iteration 37 -- +int(0) +int(0) +-- Iteration 38 -- +int(0) +int(0) +-- Iteration 39 -- +int(0) +int(0) +-- Iteration 40 -- +int(0) +int(0) +-- Iteration 41 -- +int(0) +int(0) +-- Iteration 42 -- +int(0) +int(0) +-- Iteration 43 -- +int(0) +int(0) +-- Iteration 44 -- +int(0) +int(0) +-- Iteration 45 -- +int(0) +int(0) +-- Iteration 46 -- +int(0) +int(0) +-- Iteration 47 -- +int(0) +int(0) +-- Iteration 48 -- +int(0) +int(0) +-- Iteration 49 -- +int(0) +int(0) +-- Iteration 50 -- +int(0) +int(0) +-- Iteration 51 -- +int(0) +int(0) +-- Iteration 52 -- +int(0) +int(0) +-- Iteration 53 -- +int(0) +int(0) +-- Iteration 54 -- +int(0) +int(0) +-- Iteration 55 -- +int(0) +int(0) +-- Iteration 56 -- +int(0) +int(0) +-- Iteration 57 -- +int(0) +int(0) +-- Iteration 58 -- +int(0) +int(0) +-- Iteration 59 -- +int(0) +int(0) +-- Iteration 60 -- +int(0) +int(0) +-- Iteration 61 -- +int(0) +int(0) +-- Iteration 62 -- +int(0) +int(0) +-- Iteration 63 -- +int(0) +int(0) +-- Iteration 64 -- +int(0) +int(0) +-- Iteration 65 -- +int(0) +int(0) +-- Iteration 66 -- +int(0) +int(0) +-- Iteration 67 -- +int(0) +int(0) +-- Iteration 68 -- +int(0) +int(0) +-- Iteration 69 -- +int(0) +int(0) +-- Iteration 70 -- +int(0) +int(0) +-- Iteration 71 -- +int(0) +int(0) +-- Iteration 72 -- +int(0) +int(0) +-- Iteration 73 -- +int(0) +int(0) +-- Iteration 74 -- +int(0) +int(0) +-- Iteration 75 -- +int(0) +int(0) +-- Iteration 76 -- +int(0) +int(0) +-- Iteration 77 -- +int(0) +int(0) +-- Iteration 78 -- +int(0) +int(0) +-- Iteration 79 -- +int(0) +int(0) +-- Iteration 80 -- +int(0) +int(0) +-- Iteration 81 -- +int(0) +int(0) +-- Iteration 82 -- +int(0) +int(0) +-- Iteration 83 -- +int(0) +int(0) +-- Iteration 84 -- +int(0) +int(0) +-- Iteration 85 -- +int(0) +int(0) +-- Iteration 86 -- +int(0) +int(0) +-- Iteration 87 -- +int(0) +int(0) +-- Iteration 88 -- +int(0) +int(0) +-- Iteration 89 -- +int(0) +int(0) +-- Iteration 90 -- +int(0) +int(0) +-- Iteration 91 -- +int(0) +int(0) +-- Iteration 92 -- +int(0) +int(0) +-- Iteration 93 -- +int(0) +int(0) +-- Iteration 94 -- +int(0) +int(0) +-- Iteration 95 -- +int(0) +int(0) +-- Iteration 96 -- +int(0) +int(0) +-- Iteration 97 -- +int(0) +int(0) +-- Iteration 98 -- +int(0) +int(0) +-- Iteration 99 -- +int(0) +int(0) +-- Iteration 100 -- +int(0) +int(0) +-- Iteration 101 -- +int(0) +int(0) +-- Iteration 102 -- +int(0) +int(0) +-- Iteration 103 -- +int(0) +int(0) +-- Iteration 104 -- +int(0) +int(0) +-- Iteration 105 -- +int(0) +int(0) +-- Iteration 106 -- +int(0) +int(0) +-- Iteration 107 -- +int(0) +int(0) +-- Iteration 108 -- +int(0) +int(0) +-- Iteration 109 -- +int(0) +int(0) +-- Iteration 110 -- +int(0) +int(0) +-- Iteration 111 -- +int(0) +int(0) +-- Iteration 112 -- +int(0) +int(0) +-- Iteration 113 -- +int(0) +int(0) +-- Iteration 114 -- +int(0) +int(0) +-- Iteration 115 -- +int(0) +int(0) +-- Iteration 116 -- +int(0) +int(0) +-- Iteration 117 -- +int(0) +int(0) +-- Iteration 118 -- +int(0) +int(0) +-- Iteration 119 -- +int(0) +int(0) +-- Iteration 120 -- +int(0) +int(0) +-- Iteration 121 -- +int(0) +int(0) +-- Iteration 122 -- +int(0) +int(0) +-- Iteration 123 -- +int(0) +int(0) +-- Iteration 124 -- +int(0) +int(0) +-- Iteration 125 -- +int(0) +int(0) +-- Iteration 126 -- +int(0) +int(0) +-- Iteration 127 -- +int(0) +int(0) +-- Iteration 128 -- +int(0) +int(0) +-- Iteration 129 -- +int(0) +int(0) +-- Iteration 130 -- +int(0) +int(0) +-- Iteration 131 -- +int(0) +int(0) +-- Iteration 132 -- +int(0) +int(0) +-- Iteration 133 -- +int(0) +int(0) +-- Iteration 134 -- +int(0) +int(0) +-- Iteration 135 -- +int(0) +int(0) +-- Iteration 136 -- +int(0) +int(0) +-- Iteration 137 -- +int(0) +int(0) +-- Iteration 138 -- +int(0) +int(0) +-- Iteration 139 -- +int(0) +int(0) +-- Iteration 140 -- +int(0) +int(0) +-- Iteration 141 -- +int(0) +int(0) +-- Iteration 142 -- +int(0) +int(0) +-- Iteration 143 -- +int(0) +int(0) +-- Iteration 144 -- +int(0) +int(0) +-- Iteration 145 -- +int(0) +int(0) +-- Iteration 146 -- +int(0) +int(0) +-- Iteration 147 -- +int(0) +int(0) +-- Iteration 148 -- +int(0) +int(0) +-- Iteration 149 -- +int(0) +int(0) +-- Iteration 150 -- +int(0) +int(0) +-- Iteration 151 -- +int(0) +int(0) +-- Iteration 152 -- +int(0) +int(0) +-- Iteration 153 -- +int(0) +int(0) +-- Iteration 154 -- +int(0) +int(0) +-- Iteration 155 -- +int(0) +int(0) +-- Iteration 156 -- +int(0) +int(0) +-- Iteration 157 -- +int(0) +int(0) +-- Iteration 158 -- +int(0) +int(0) +-- Iteration 159 -- +int(0) +int(0) +-- Iteration 160 -- +int(0) +int(0) +-- Iteration 161 -- +int(0) +int(0) +-- Iteration 162 -- +int(0) +int(0) +-- Iteration 163 -- +int(0) +int(0) +-- Iteration 164 -- +int(0) +int(0) +-- Iteration 165 -- +int(0) +int(0) +-- Iteration 166 -- +int(0) +int(0) +-- Iteration 167 -- +int(0) +int(0) +-- Iteration 168 -- +int(0) +int(0) +-- Iteration 169 -- +int(0) +int(0) +-- Iteration 170 -- +int(0) +int(0) +-- Iteration 171 -- +int(0) +int(0) +-- Iteration 172 -- +int(0) +int(0) +-- Iteration 173 -- +int(0) +int(0) +-- Iteration 174 -- +int(0) +int(0) +-- Iteration 175 -- +int(0) +int(0) +-- Iteration 176 -- +int(0) +int(0) +-- Iteration 177 -- +int(0) +int(0) +-- Iteration 178 -- +int(0) +int(0) +-- Iteration 179 -- +int(0) +int(0) +-- Iteration 180 -- +int(0) +int(0) +-- Iteration 181 -- +int(0) +int(0) +-- Iteration 182 -- +int(0) +int(0) +-- Iteration 183 -- +int(0) +int(0) +-- Iteration 184 -- +int(0) +int(0) +-- Iteration 185 -- +int(0) +int(0) +-- Iteration 186 -- +int(0) +int(0) +-- Iteration 187 -- +int(0) +int(0) +-- Iteration 188 -- +int(0) +int(0) +-- Iteration 189 -- +int(0) +int(0) +-- Iteration 190 -- +int(0) +int(0) +-- Iteration 191 -- +int(0) +int(0) +-- Iteration 192 -- +int(0) +int(0) +-- Iteration 193 -- +int(0) +int(0) +-- Iteration 194 -- +int(0) +int(0) +-- Iteration 195 -- +int(0) +int(0) +-- Iteration 196 -- +int(0) +int(0) +-- Iteration 197 -- +int(0) +int(0) +-- Iteration 198 -- +int(0) +int(0) +-- Iteration 199 -- +int(0) +int(0) +-- Iteration 200 -- +int(0) +int(0) +-- Iteration 201 -- +int(0) +int(0) +-- Iteration 202 -- +int(0) +int(0) +-- Iteration 203 -- +int(0) +int(0) +-- Iteration 204 -- +int(0) +int(0) +-- Iteration 205 -- +int(0) +int(0) +-- Iteration 206 -- +int(0) +int(0) +-- Iteration 207 -- +int(0) +int(0) +-- Iteration 208 -- +int(0) +int(0) +-- Iteration 209 -- +int(0) +int(0) +-- Iteration 210 -- +int(0) +int(0) +-- Iteration 211 -- +int(0) +int(0) +-- Iteration 212 -- +int(0) +int(0) +-- Iteration 213 -- +int(0) +int(0) +-- Iteration 214 -- +int(0) +int(0) +-- Iteration 215 -- +int(0) +int(0) +-- Iteration 216 -- +int(0) +int(0) +-- Iteration 217 -- +int(0) +int(0) +-- Iteration 218 -- +int(0) +int(0) +-- Iteration 219 -- +int(0) +int(0) +-- Iteration 220 -- +int(0) +int(0) +-- Iteration 221 -- +int(0) +int(0) +-- Iteration 222 -- +int(0) +int(0) +-- Iteration 223 -- +int(0) +int(0) +-- Iteration 224 -- +int(0) +int(0) +-- Iteration 225 -- +int(0) +int(0) +-- Iteration 226 -- +int(0) +int(0) +-- Iteration 227 -- +int(0) +int(0) +-- Iteration 228 -- +int(0) +int(0) +-- Iteration 229 -- +int(0) +int(0) +-- Iteration 230 -- +int(0) +int(0) +-- Iteration 231 -- +int(0) +int(0) +-- Iteration 232 -- +int(0) +int(0) +-- Iteration 233 -- +int(0) +int(0) +-- Iteration 234 -- +int(0) +int(0) +-- Iteration 235 -- +int(0) +int(0) +-- Iteration 236 -- +int(0) +int(0) +-- Iteration 237 -- +int(0) +int(0) +-- Iteration 238 -- +int(0) +int(0) +-- Iteration 239 -- +int(0) +int(0) +-- Iteration 240 -- +int(0) +int(0) +-- Iteration 241 -- +int(0) +int(0) +-- Iteration 242 -- +int(0) +int(0) +-- Iteration 243 -- +int(0) +int(0) +-- Iteration 244 -- +int(0) +int(0) +-- Iteration 245 -- +int(0) +int(0) +-- Iteration 246 -- +int(0) +int(0) +-- Iteration 247 -- +int(0) +int(0) +-- Iteration 248 -- +int(0) +int(0) +-- Iteration 249 -- +int(0) +int(0) +-- Iteration 250 -- +int(0) +int(0) +-- Iteration 251 -- +int(0) +int(0) +-- Iteration 252 -- +int(0) +int(0) +-- Iteration 253 -- +int(0) +int(0) +-- Iteration 254 -- +int(0) +int(0) +-- Iteration 255 -- +int(0) +int(0) +-- Iteration 256 -- +int(0) +int(0) + +-- Checking with out of character's range, given in binary format -- +int(1) + +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation7.phpt new file mode 100644 index 0000000000000..e22fad7659aae --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation7.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test strncasecmp() function : usage variations - binary safe +--FILE-- + +--EXPECTF-- +*** Test strncasecmp() function: with null terminated strings and binary inputs *** +int(5) +int(-119) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation8.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation8.phpt new file mode 100644 index 0000000000000..6011a7b0fd996 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation8.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strncasecmp() function: usage variations - single quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncasecmp\(\) function: with single quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 2 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 3 -- +int\(0\) +int\(0\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation9.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation9.phpt new file mode 100644 index 0000000000000..0d713032e035a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncasecmp_variation9.phpt @@ -0,0 +1,92 @@ +--TEST-- +Test strncasecmp() function: usage variations - heredoc strings +--FILE-- + +--EXPECTF-- +*** Test strncasecmp() function: with here-doc strings *** +int(0) +int(63) +int(0) +int(84) +int(0) +int(-1) +int(0) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_basic.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_basic.phpt new file mode 100644 index 0000000000000..317039859f6db --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_basic.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test strncmp() function : basic functionality +--FILE-- + 0 + +echo "-- Testing strncmp() with double quoted string --\n"; +var_dump( strncmp("Hello", "Hello", 5) ); //expected: int(0) +var_dump( strncmp("Hello", "Hi", 5) ); //expected: value < 0 +var_dump( strncmp("Hi", "Hello", 5) ); //expected: value > 0 + +echo "-- Testing strncmp() with here-doc string --\n"; +$str = << 0 + +echo "*** Done ***"; +?> +--EXPECTREGEX-- +\*\*\* Testing strncmp\(\) function: basic functionality \*\*\* +-- Testing strncmp\(\) with single quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncmp\(\) with double quoted string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Testing strncmp\(\) with here-doc string -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +\*\*\* Done \*\*\* diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_error.phpt new file mode 100644 index 0000000000000..317a90406abae --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_error.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test strncmp() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strncmp() function: error conditions *** + +Warning: Wrong parameter count for strncmp() in %s on line %d +NULL + +Warning: Wrong parameter count for strncmp() in %s on line %d +NULL + +Warning: Wrong parameter count for strncmp() in %s on line %d +NULL + +Warning: Wrong parameter count for strncmp() in %s on line %d +NULL + +Warning: Length must be greater than or equal to 0 in %s on line %d +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation1.phpt new file mode 100644 index 0000000000000..2fc3c3d4c7ad2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation1.phpt @@ -0,0 +1,135 @@ +--TEST-- +Test strncmp() function: usage variations - case-sensitivity +--FILE-- + 0 +} +echo "*** Done ***"; +?> +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with alphabets \*\*\* +-- Passing upper-case letters for 'str1' -- +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) + +-- Passing lower-case letters for 'str1' -- +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +\*\*\* Done \*\*\* diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation2.phpt new file mode 100644 index 0000000000000..3c7452241725b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation2.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test strncmp() function: usage variations - double quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with double quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 2 -- +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 3 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +-- Iteration 5 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation3.phpt new file mode 100644 index 0000000000000..6a703c7050770 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation3.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test strncmp() function: usage variations - different lengths +--FILE-- += 0; $len--) { + var_dump( strncmp($str1, $str2, $len) ); +} +echo "*** Done ***\n"; +?> +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with different lengths \*\*\* +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation4.phpt new file mode 100644 index 0000000000000..2af95e9b4981b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation4.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test strncmp() function : usage variations - different inputs(all types) +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + $undefined_var, + + /* unset variable */ + $unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncmp() */ +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str1 = $values[$index]; + $str2 = $values[$index]; + $len = strlen($values[$index]) + 1; + var_dump( strncmp($str1, $str2, $len) ); + $counter ++; +} +fclose($file_handle); + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Testing strncmp() function: by supplying all types for 'str1' and 'str2' *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d +-- Iteration 1 -- +int(0) +-- Iteration 2 -- +int(0) +-- Iteration 3 -- +int(0) +-- Iteration 4 -- +int(0) +-- Iteration 5 -- +int(0) +-- Iteration 6 -- +int(0) +-- Iteration 7 -- +int(0) +-- Iteration 8 -- +int(0) +-- Iteration 9 -- +int(0) +-- Iteration 10 -- +int(0) +-- Iteration 11 -- +int(0) +-- Iteration 12 -- +int(0) +-- Iteration 13 -- +int(0) +-- Iteration 14 -- +int(0) +-- Iteration 15 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(0) +-- Iteration 16 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(0) +-- Iteration 17 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(0) +-- Iteration 18 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(0) +-- Iteration 19 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +int(0) +-- Iteration 20 -- +int(0) +-- Iteration 21 -- +int(0) +-- Iteration 22 -- +int(0) +-- Iteration 23 -- +int(0) +-- Iteration 24 -- +int(0) +-- Iteration 25 -- +int(0) +-- Iteration 26 -- +int(0) +-- Iteration 27 -- +int(0) +-- Iteration 28 -- +int(0) +-- Iteration 29 -- +int(0) +-- Iteration 30 -- +int(0) +-- Iteration 31 -- +int(0) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation5.phpt new file mode 100644 index 0000000000000..cdb3afca194d6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation5.phpt @@ -0,0 +1,161 @@ +--TEST-- +Test strncmp() function : usage variations - different lengths(all types) +--FILE-- + 'red', 'item' => 'pen'), + + /* boolean values */ + true, + false, + TRUE, + FALSE, + + /* nulls */ + NULL, + null, + + /* empty string */ + "", + '', + + /* undefined variable */ + $undefined_var, + + /* unset variable */ + $unset_var, + + /* resource */ + $file_handle, + + /* object */ + new sample() +); + +/* loop through each element of the array and check the working of strncmp() */ +$counter = 1; +for($index = 0; $index < count($lengths); $index ++) { + $len = $lengths[$index]; + echo "-- Iteration $counter --\n"; + var_dump( strncmp($str1, $str2, $len) ); + $counter ++; +} +fclose($file_handle); + +echo "*** Done ***\n"; +?> +--EXPECTF-- +*** Test strncmp() function: by supplying all types for 'len' *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d +-- Iteration 1 -- +int(0) +-- Iteration 2 -- +int(0) +-- Iteration 3 -- +int(0) +-- Iteration 4 -- +int(0) +-- Iteration 5 -- +int(0) +-- Iteration 6 -- +int(0) +-- Iteration 7 -- +int(0) +-- Iteration 8 -- +int(0) +-- Iteration 9 -- +int(0) +-- Iteration 10 -- +int(0) +-- Iteration 11 -- +int(0) +-- Iteration 12 -- +int(0) +-- Iteration 13 -- +int(0) +-- Iteration 14 -- +int(0) +-- Iteration 15 -- +int(0) +-- Iteration 16 -- +int(0) +-- Iteration 17 -- +int(0) +-- Iteration 18 -- +int(0) +-- Iteration 19 -- +int(0) +-- Iteration 20 -- +int(0) +-- Iteration 21 -- +int(0) +-- Iteration 22 -- +int(0) +-- Iteration 23 -- +int(0) +-- Iteration 24 -- +int(0) +-- Iteration 25 -- +int(0) +-- Iteration 26 -- +int(0) +-- Iteration 27 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +int(0) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation6.phpt new file mode 100644 index 0000000000000..7a79d29a514a6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation6.phpt @@ -0,0 +1,811 @@ +--TEST-- +Test strncmp() function : usage variations - binary safe(binary values) +--FILE-- + +--EXPECTF-- +*** Test strncmp() function: with binary inputs *** + +-- Checking with all 256 characters given, in binary format -- +-- Iteration 1 -- +int(0) +int(0) +-- Iteration 2 -- +int(0) +int(0) +-- Iteration 3 -- +int(0) +int(0) +-- Iteration 4 -- +int(0) +int(0) +-- Iteration 5 -- +int(0) +int(0) +-- Iteration 6 -- +int(0) +int(0) +-- Iteration 7 -- +int(0) +int(0) +-- Iteration 8 -- +int(0) +int(0) +-- Iteration 9 -- +int(0) +int(0) +-- Iteration 10 -- +int(0) +int(0) +-- Iteration 11 -- +int(0) +int(0) +-- Iteration 12 -- +int(0) +int(0) +-- Iteration 13 -- +int(0) +int(0) +-- Iteration 14 -- +int(0) +int(0) +-- Iteration 15 -- +int(0) +int(0) +-- Iteration 16 -- +int(0) +int(0) +-- Iteration 17 -- +int(0) +int(0) +-- Iteration 18 -- +int(0) +int(0) +-- Iteration 19 -- +int(0) +int(0) +-- Iteration 20 -- +int(0) +int(0) +-- Iteration 21 -- +int(0) +int(0) +-- Iteration 22 -- +int(0) +int(0) +-- Iteration 23 -- +int(0) +int(0) +-- Iteration 24 -- +int(0) +int(0) +-- Iteration 25 -- +int(0) +int(0) +-- Iteration 26 -- +int(0) +int(0) +-- Iteration 27 -- +int(0) +int(0) +-- Iteration 28 -- +int(0) +int(0) +-- Iteration 29 -- +int(0) +int(0) +-- Iteration 30 -- +int(0) +int(0) +-- Iteration 31 -- +int(0) +int(0) +-- Iteration 32 -- +int(0) +int(0) +-- Iteration 33 -- +int(0) +int(0) +-- Iteration 34 -- +int(0) +int(0) +-- Iteration 35 -- +int(0) +int(0) +-- Iteration 36 -- +int(0) +int(0) +-- Iteration 37 -- +int(0) +int(0) +-- Iteration 38 -- +int(0) +int(0) +-- Iteration 39 -- +int(0) +int(0) +-- Iteration 40 -- +int(0) +int(0) +-- Iteration 41 -- +int(0) +int(0) +-- Iteration 42 -- +int(0) +int(0) +-- Iteration 43 -- +int(0) +int(0) +-- Iteration 44 -- +int(0) +int(0) +-- Iteration 45 -- +int(0) +int(0) +-- Iteration 46 -- +int(0) +int(0) +-- Iteration 47 -- +int(0) +int(0) +-- Iteration 48 -- +int(0) +int(0) +-- Iteration 49 -- +int(0) +int(0) +-- Iteration 50 -- +int(0) +int(0) +-- Iteration 51 -- +int(0) +int(0) +-- Iteration 52 -- +int(0) +int(0) +-- Iteration 53 -- +int(0) +int(0) +-- Iteration 54 -- +int(0) +int(0) +-- Iteration 55 -- +int(0) +int(0) +-- Iteration 56 -- +int(0) +int(0) +-- Iteration 57 -- +int(0) +int(0) +-- Iteration 58 -- +int(0) +int(0) +-- Iteration 59 -- +int(0) +int(0) +-- Iteration 60 -- +int(0) +int(0) +-- Iteration 61 -- +int(0) +int(0) +-- Iteration 62 -- +int(0) +int(0) +-- Iteration 63 -- +int(0) +int(0) +-- Iteration 64 -- +int(0) +int(0) +-- Iteration 65 -- +int(0) +int(0) +-- Iteration 66 -- +int(0) +int(0) +-- Iteration 67 -- +int(0) +int(0) +-- Iteration 68 -- +int(0) +int(0) +-- Iteration 69 -- +int(0) +int(0) +-- Iteration 70 -- +int(0) +int(0) +-- Iteration 71 -- +int(0) +int(0) +-- Iteration 72 -- +int(0) +int(0) +-- Iteration 73 -- +int(0) +int(0) +-- Iteration 74 -- +int(0) +int(0) +-- Iteration 75 -- +int(0) +int(0) +-- Iteration 76 -- +int(0) +int(0) +-- Iteration 77 -- +int(0) +int(0) +-- Iteration 78 -- +int(0) +int(0) +-- Iteration 79 -- +int(0) +int(0) +-- Iteration 80 -- +int(0) +int(0) +-- Iteration 81 -- +int(0) +int(0) +-- Iteration 82 -- +int(0) +int(0) +-- Iteration 83 -- +int(0) +int(0) +-- Iteration 84 -- +int(0) +int(0) +-- Iteration 85 -- +int(0) +int(0) +-- Iteration 86 -- +int(0) +int(0) +-- Iteration 87 -- +int(0) +int(0) +-- Iteration 88 -- +int(0) +int(0) +-- Iteration 89 -- +int(0) +int(0) +-- Iteration 90 -- +int(0) +int(0) +-- Iteration 91 -- +int(0) +int(0) +-- Iteration 92 -- +int(0) +int(0) +-- Iteration 93 -- +int(0) +int(0) +-- Iteration 94 -- +int(0) +int(0) +-- Iteration 95 -- +int(0) +int(0) +-- Iteration 96 -- +int(0) +int(0) +-- Iteration 97 -- +int(0) +int(0) +-- Iteration 98 -- +int(0) +int(0) +-- Iteration 99 -- +int(0) +int(0) +-- Iteration 100 -- +int(0) +int(0) +-- Iteration 101 -- +int(0) +int(0) +-- Iteration 102 -- +int(0) +int(0) +-- Iteration 103 -- +int(0) +int(0) +-- Iteration 104 -- +int(0) +int(0) +-- Iteration 105 -- +int(0) +int(0) +-- Iteration 106 -- +int(0) +int(0) +-- Iteration 107 -- +int(0) +int(0) +-- Iteration 108 -- +int(0) +int(0) +-- Iteration 109 -- +int(0) +int(0) +-- Iteration 110 -- +int(0) +int(0) +-- Iteration 111 -- +int(0) +int(0) +-- Iteration 112 -- +int(0) +int(0) +-- Iteration 113 -- +int(0) +int(0) +-- Iteration 114 -- +int(0) +int(0) +-- Iteration 115 -- +int(0) +int(0) +-- Iteration 116 -- +int(0) +int(0) +-- Iteration 117 -- +int(0) +int(0) +-- Iteration 118 -- +int(0) +int(0) +-- Iteration 119 -- +int(0) +int(0) +-- Iteration 120 -- +int(0) +int(0) +-- Iteration 121 -- +int(0) +int(0) +-- Iteration 122 -- +int(0) +int(0) +-- Iteration 123 -- +int(0) +int(0) +-- Iteration 124 -- +int(0) +int(0) +-- Iteration 125 -- +int(0) +int(0) +-- Iteration 126 -- +int(0) +int(0) +-- Iteration 127 -- +int(0) +int(0) +-- Iteration 128 -- +int(0) +int(0) +-- Iteration 129 -- +int(0) +int(0) +-- Iteration 130 -- +int(0) +int(0) +-- Iteration 131 -- +int(0) +int(0) +-- Iteration 132 -- +int(0) +int(0) +-- Iteration 133 -- +int(0) +int(0) +-- Iteration 134 -- +int(0) +int(0) +-- Iteration 135 -- +int(0) +int(0) +-- Iteration 136 -- +int(0) +int(0) +-- Iteration 137 -- +int(0) +int(0) +-- Iteration 138 -- +int(0) +int(0) +-- Iteration 139 -- +int(0) +int(0) +-- Iteration 140 -- +int(0) +int(0) +-- Iteration 141 -- +int(0) +int(0) +-- Iteration 142 -- +int(0) +int(0) +-- Iteration 143 -- +int(0) +int(0) +-- Iteration 144 -- +int(0) +int(0) +-- Iteration 145 -- +int(0) +int(0) +-- Iteration 146 -- +int(0) +int(0) +-- Iteration 147 -- +int(0) +int(0) +-- Iteration 148 -- +int(0) +int(0) +-- Iteration 149 -- +int(0) +int(0) +-- Iteration 150 -- +int(0) +int(0) +-- Iteration 151 -- +int(0) +int(0) +-- Iteration 152 -- +int(0) +int(0) +-- Iteration 153 -- +int(0) +int(0) +-- Iteration 154 -- +int(0) +int(0) +-- Iteration 155 -- +int(0) +int(0) +-- Iteration 156 -- +int(0) +int(0) +-- Iteration 157 -- +int(0) +int(0) +-- Iteration 158 -- +int(0) +int(0) +-- Iteration 159 -- +int(0) +int(0) +-- Iteration 160 -- +int(0) +int(0) +-- Iteration 161 -- +int(0) +int(0) +-- Iteration 162 -- +int(0) +int(0) +-- Iteration 163 -- +int(0) +int(0) +-- Iteration 164 -- +int(0) +int(0) +-- Iteration 165 -- +int(0) +int(0) +-- Iteration 166 -- +int(0) +int(0) +-- Iteration 167 -- +int(0) +int(0) +-- Iteration 168 -- +int(0) +int(0) +-- Iteration 169 -- +int(0) +int(0) +-- Iteration 170 -- +int(0) +int(0) +-- Iteration 171 -- +int(0) +int(0) +-- Iteration 172 -- +int(0) +int(0) +-- Iteration 173 -- +int(0) +int(0) +-- Iteration 174 -- +int(0) +int(0) +-- Iteration 175 -- +int(0) +int(0) +-- Iteration 176 -- +int(0) +int(0) +-- Iteration 177 -- +int(0) +int(0) +-- Iteration 178 -- +int(0) +int(0) +-- Iteration 179 -- +int(0) +int(0) +-- Iteration 180 -- +int(0) +int(0) +-- Iteration 181 -- +int(0) +int(0) +-- Iteration 182 -- +int(0) +int(0) +-- Iteration 183 -- +int(0) +int(0) +-- Iteration 184 -- +int(0) +int(0) +-- Iteration 185 -- +int(0) +int(0) +-- Iteration 186 -- +int(0) +int(0) +-- Iteration 187 -- +int(0) +int(0) +-- Iteration 188 -- +int(0) +int(0) +-- Iteration 189 -- +int(0) +int(0) +-- Iteration 190 -- +int(0) +int(0) +-- Iteration 191 -- +int(0) +int(0) +-- Iteration 192 -- +int(0) +int(0) +-- Iteration 193 -- +int(0) +int(0) +-- Iteration 194 -- +int(0) +int(0) +-- Iteration 195 -- +int(0) +int(0) +-- Iteration 196 -- +int(0) +int(0) +-- Iteration 197 -- +int(0) +int(0) +-- Iteration 198 -- +int(0) +int(0) +-- Iteration 199 -- +int(0) +int(0) +-- Iteration 200 -- +int(0) +int(0) +-- Iteration 201 -- +int(0) +int(0) +-- Iteration 202 -- +int(0) +int(0) +-- Iteration 203 -- +int(0) +int(0) +-- Iteration 204 -- +int(0) +int(0) +-- Iteration 205 -- +int(0) +int(0) +-- Iteration 206 -- +int(0) +int(0) +-- Iteration 207 -- +int(0) +int(0) +-- Iteration 208 -- +int(0) +int(0) +-- Iteration 209 -- +int(0) +int(0) +-- Iteration 210 -- +int(0) +int(0) +-- Iteration 211 -- +int(0) +int(0) +-- Iteration 212 -- +int(0) +int(0) +-- Iteration 213 -- +int(0) +int(0) +-- Iteration 214 -- +int(0) +int(0) +-- Iteration 215 -- +int(0) +int(0) +-- Iteration 216 -- +int(0) +int(0) +-- Iteration 217 -- +int(0) +int(0) +-- Iteration 218 -- +int(0) +int(0) +-- Iteration 219 -- +int(0) +int(0) +-- Iteration 220 -- +int(0) +int(0) +-- Iteration 221 -- +int(0) +int(0) +-- Iteration 222 -- +int(0) +int(0) +-- Iteration 223 -- +int(0) +int(0) +-- Iteration 224 -- +int(0) +int(0) +-- Iteration 225 -- +int(0) +int(0) +-- Iteration 226 -- +int(0) +int(0) +-- Iteration 227 -- +int(0) +int(0) +-- Iteration 228 -- +int(0) +int(0) +-- Iteration 229 -- +int(0) +int(0) +-- Iteration 230 -- +int(0) +int(0) +-- Iteration 231 -- +int(0) +int(0) +-- Iteration 232 -- +int(0) +int(0) +-- Iteration 233 -- +int(0) +int(0) +-- Iteration 234 -- +int(0) +int(0) +-- Iteration 235 -- +int(0) +int(0) +-- Iteration 236 -- +int(0) +int(0) +-- Iteration 237 -- +int(0) +int(0) +-- Iteration 238 -- +int(0) +int(0) +-- Iteration 239 -- +int(0) +int(0) +-- Iteration 240 -- +int(0) +int(0) +-- Iteration 241 -- +int(0) +int(0) +-- Iteration 242 -- +int(0) +int(0) +-- Iteration 243 -- +int(0) +int(0) +-- Iteration 244 -- +int(0) +int(0) +-- Iteration 245 -- +int(0) +int(0) +-- Iteration 246 -- +int(0) +int(0) +-- Iteration 247 -- +int(0) +int(0) +-- Iteration 248 -- +int(0) +int(0) +-- Iteration 249 -- +int(0) +int(0) +-- Iteration 250 -- +int(0) +int(0) +-- Iteration 251 -- +int(0) +int(0) +-- Iteration 252 -- +int(0) +int(0) +-- Iteration 253 -- +int(0) +int(0) +-- Iteration 254 -- +int(0) +int(0) +-- Iteration 255 -- +int(0) +int(0) +-- Iteration 256 -- +int(0) +int(0) + +-- Checking with out of character's range, given in binary format -- +int(1) + +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation7.phpt new file mode 100644 index 0000000000000..35d11d981a736 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation7.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test strncmp() function : usage variations - binary safe(null terminated strings) +--FILE-- + +--EXPECTF-- +*** Test strncmp() function: Checking with the null terminated strings *** +int(5) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation8.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation8.phpt new file mode 100644 index 0000000000000..bc000d171e9b9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation8.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strncmp() function: usage variations - single quoted strings +--FILE-- + +--EXPECTREGEX-- +\*\*\* Test strncmp\(\) function: with single quoted strings \*\*\* +-- Iteration 1 -- +int\(0\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +-- Iteration 2 -- +int\([1-9][0-9]*\) +int\(0\) +int\([1-9][0-9]*\) +int\([1-9][0-9]*\) +-- Iteration 3 -- +int\(-[1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\(0\) +int\(-[1-9][0-9]*\) +-- Iteration 4 -- +int\([1-9][0-9]*\) +int\(-[1-9][0-9]*\) +int\([1-9][0-9]*\) +int\(0\) +\*\*\* Done \*\*\* diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation9.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation9.phpt new file mode 100644 index 0000000000000..282f2418491ae --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strncmp_variation9.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test strncmp() function: usage variations - different inputs(heredoc strings) +--FILE-- + +--EXPECTF-- +*** Test strncmp() function: with different input strings *** +int(0) +int(0) +int(0) +int(0) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strpos.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strpos.phpt new file mode 100644 index 0000000000000000000000000000000000000000..e64468135082651638234b2de27f0848d897d4d5 GIT binary patch literal 9396 zcmeHNZExE~63*A~S4?@%Npd7dl>Cx7c2Xm8&;V`{#13+R9T*g~ve-~um8AUAAcx-H zz5a*mJ+m(qDT$WcBKP4?e=wKanc11y*?C*FS|^9cC#{xqBGQb~EE&tR-k`xG4zf_j zPOJ6$&1+1L6A^?dzU+IO`1tDe(ILL>Js%Ip&ZBjDm&i6!-&rKSI*P>5ru@L=8&}mb_ugSq671<|hJavfZrAUJ$95VyE^eT+|1g=7UB{`r$ zn1EFo1d}8YaUl4cZ&q^FA32T)hLYU%^>t#Qc>SKAhCwcrABEWsW98xk_AGXvI+uQO z-k*%digDJ2n;Er$irXah>Nc3orJ!2$y8y2U3-zuDc~K4LZUn=m-fnETX$HacOO;@U z3TBD$$4qA-%=bpmE(6T6lu!D%&hn&RiF<}Wh0hNqg|&jSxM&ApL}~-iB4Mw zBqeQ+Df#&3QzT(DdIQPY#+rHGC&&FkM3JN`nMD0&+v~KuU21hVx|^F@uwJ4!AC8Xb zb%dNKE8c_^b#*TK5N?nSS$?fn0Ymy zA&40%LCm<-)q_@76VxiP-&j5BJ8MS+@W^fQ+E@dRw))J9)AKyi^PYNm45U=5kkm-e zlXIHbSc!EQJjNg&B~9Y97D~CoLmfxT6eXo-KqM^ zN*~CiPHQ1_-hRr@JqqL`&gynE8vOO)Lu$|$u%^A#yMkk@S-{h^@KcRK?A|kiK@eMM z*)JK6o7R!0jG_$xE0I%a{Mz=f!fePgq+t&(m`{MuzBPp_hF4@qJT-d#etzjk6OmgJ zu{n87qDPM`!ajNU24}+l9$Q|R@>6q^;AUieDUvK@t^Ohs2^4J&D}%ESSsmExlo-;n z$DCuO1rAnxtw9#F%!XT1_XD<4Hz+Kl5|@GqJqYqIW**6<%5P zei8vJD7PxLf5r*6S}Kg=3||T5EZrA=hP`DwAAoK|B1vSjOR0au#NH}moC*XH=o`1o z$2RIyEHml}#~LlN7Fey>ZR*`nUkv<7l+o2tC@-x!<6}DpEr5q{nhC#eG7YS^>(B|j zx8i{UIQE_(|5Ap10D~aX79}Ek`1A8j9_!?3G!ofRA~vNokO)3k=`L}uqxsfc zk;8t)rfvliNa%QmC=uBtiA^ME>Hwx3%va~Dvjzdq4W)gk;>rjMr&!X?%B!gOSSD}w zNt4$vAV25c+yXDKD*bA_uMY3pd!EGw%g6)eZKh#eY#tchA;)rFp0^z`)a-~a8O-?@u&K1*%thnc(k?4Yh>T!U@MU~lv z&3#2Q`JDb)dYxH%({NGH=6jLKNfN;6-=a=())E8fL8AjX7IFRjoU4QLbI6de)^d;z zKp3JQCUtjXu|jilP-#9^TRvwb)A<5yXWl$;sKQ=|oIivx%HPG4C?ex4=E!n{;h?m5 zQ5~+T=aHn|hVDMP=5z{SCO4EH#I@f?aW#T>0^QPP9H>lGB+ADPMI!n#uz9KB-zI(g zw70i+`1YkrDaGJo82U z1nXWs8n*NLoMXl$Q(EU=HRP43{e=1d0#tEsmn`hN+<(C zN%3K6r2Iz<-|<5F8BiYSmOw))ddHH zVy{|Lw|OvTE_Yysv<{&o4M$@nS}LEGJiMm#CeD03R3?*JpKC%JSgom;Thn#dvBozz z$ZqC+v&vd+;sQ1dB_)g60uHz-Ey1iEvkx}7c*!?VVJ|^0;+9Ztyhr_o1oT)ZZz|rP zQx)A%FYyshxdmnh zI2*{Zc3QnK(*;w$pV(h)rs*j0!|Ob5s1B3Yd7=jhJ$A5V23z*a))vwPozZayVoKsv zCC+jr%wpznYFnZj8)6OJ4H#UW6I+H9t(*^6*U<~CLL0LMWHY#bUo*nrI^b(#6=Vi% zlJWyZ?Cn*tw`b0Iv1Mh71^5uv08P0xLQXw*G>p@LT~{3J+{n4`hTbkFBN1owgfzZ7 zOv=Sr$O`qrI&#Wv>=GrMZImn^uDWzRK7IlJ>rc-f)=B9ZiR&@yJJFxVol3|}SzyBe zith5Emos7t+GiG|u>v)CTkFRS`X06C@pJ-cl$?9!mogUE6?Dd59339KL2G;vL^2ii zX_AT{u1P!yyDbqUUgSpcNi#d)~5^6IKrT7=k!K1=%w*j1TxIIdZDGgjA=Dyzcq_6~Mg?TXu(hG%XF zyxPv}d0m8|vyT}jOWV5$>s!OyK6i1QmBc9>M5ueIBzMKVWXiFs zFzG?R6yw>fO-{f*xVZSz{$7bt(FZ6hl})uuv?2-S%kXo1i>sL2?3jEef1<`vB30GI zE3v}TtWvnz4OE^2>)NgP5TlcZPJzBk=9`9HbB%C3zcUniD#X8}_{#I+7D(2hKyOa4lTxU7|1+Ybjx&QzG literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr.phpt new file mode 100644 index 0000000000000..5a1fe12a82645 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr.phpt @@ -0,0 +1,22 @@ +--TEST-- +strrchr() tests +--FILE-- + +--EXPECTF-- +bool(false) +bool(false) +bool(false) +string(3) "abc" +string(5) " test" +string(5) "tring" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_basic.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_basic.phpt new file mode 100644 index 0000000000000..f396834837c3d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_basic.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test strrchr() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: basic functionality *** +string(12) "Hello, World" +string(12) "Hello, World" +string(12) "Hello, World" +string(12) "Hello, World" +bool(false) +bool(false) +string(5) "World" +string(5) "World" +string(7) ", World" +string(7) ", World" +string(12) "Hello, World" +string(12) "Hello, World" +string(4) "orld" +string(4) "orld" +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_error.phpt new file mode 100644 index 0000000000000..8c2881aa531da --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_error.phpt @@ -0,0 +1,40 @@ +--TEST-- +Test strrchr() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: error conditions *** + +-- Testing strrchr() function with Zero arguments -- +Warning: Wrong parameter count for strrchr() in %s on line %d +NULL + +-- Testing strrchr() function with less than expected no. of arguments -- +Warning: Wrong parameter count for strrchr() in %s on line %d +NULL + +-- Testing strrchr() function with more than expected no. of arguments -- +Warning: Wrong parameter count for strrchr() in %s on line %d +NULL +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation1.phpt new file mode 100644 index 0000000000000000000000000000000000000000..91290ecf93f54a7ae65ceb40745361d1a77b6877 GIT binary patch literal 4406 zcmb_fZBN@s5WcVVub7$~N@4{PbEq|C9fpAEiA`5zZ{Pc>*!<_&#Yb>KIfto<>QP4;>c}_80xhVv&W)j z(U};7Q2`@HHvp7s4QfJ+v0ZgJZBSc$$iCScX~H z4>N$q?(3ajL(y%v+8t-VHy9orzdt#RX_xEy!NDQcF?_%$2;II51SeBPFqY@+v1tMH zdO5$XQkJW77Pw}oc9+apnv2nR{F~hcT8c-Aj?1+twvJ)z7j3D1!%}*M6KP+m*G$<@ z(pm_J!8869(j?;&Fsss3g7oWMpMD>YDHB>JTSvVXBIPWD8#XZoAQNgx1Iq5o*VjAJVx8p!)>}R_Thg{W(kkP~w|!-X z(hihW1{)>Um6^Yu$kkI->{C_kI&-`3DgM&yP4NVGc!aFF<9QNk$E0@4!p8i8t=@;H zlC7s|l*v7Zv#Sr6mvvES)(D5nM#Pa@MN}Fip1p*G2!w=mycmt-W|emVokbS{j}E5j z$qF3svME!#XK7W>zumT5i1cG5&|yA@fG*P6LRq0XPlcGFlH{VgjiD59%gb6=W}--H z-NRFo(5R3oC<`nlTsY2+NK{#g#j_Ti=3qe!MolXnBVX9IL z!pw2t5>=~KS5TOa6J|J(Kr-<6w7Q!$7fP`>VHXtgpEBHEEg;cU5S`A@`mPDiN0D)m zvT^brwR-f&=h27BIm-2RdSJp3d;Ga-BW6(fDeT$&jaO1uMZC~&PH*OgBP{Z@7IxonyF{w8i$TpIC ztK$Wj)FzdEr-7|~LbtD>1e>Ph>YNM?@PHd}$E_KwD82+6kKfVGj(y7$W2?;)(lstwlSEuMB6?FTUVbvowEKrM0)v3XVeN$C#z2i_R`JJ z45O2D?XmWBZu%tV|8+$*C!+Jwr!K6%g@7}T~EK8%x*fTJmS=ouPw9J5|e(~ODB*^)m(hjnWN~Gp}rY+1v)iW q?^+@OVm-gj1xw8~Z_&F-2Qb|V1HFao%z2= 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // null vlaues + NULL, + null, + + // objects + new sample(), + + // empty string + "", + '', + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop through each element of the array and check the working of strrchr() +$count = 1; +for($index = 0; $index < count($haystacks); $index++) { + echo "-- Iteration $count --\n"; + var_dump( strrchr($haystacks[$index], $needles[$index]) ); + $count ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrchr() function with unexpected inputs for needle *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- +bool(false) +-- Iteration 11 -- +bool(false) +-- Iteration 12 -- +bool(false) +-- Iteration 13 -- +bool(false) +-- Iteration 14 -- +bool(false) +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- +bool(false) +-- Iteration 20 -- +bool(false) +-- Iteration 21 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- +bool(false) +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation11.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation11.phpt new file mode 100644 index 0000000000000..d04710d7d7856 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation11.phpt @@ -0,0 +1,159 @@ +--TEST-- +Test strrchr() function : usage variations - unexpected inputs for haystack and needle +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of strrchr() +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $haystack = $values[$index]; + + var_dump( strrchr($values[$index], $values[$index]) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrchr() function: with unexpected inputs for haystack and needle *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +bool(false) +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +bool(false) +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +bool(false) +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +bool(false) +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +bool(false) +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) +-- Iteration 20 -- +bool(false) +-- Iteration 21 -- +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- +bool(false) +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation12.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation12.phpt new file mode 100644 index 0000000000000000000000000000000000000000..c31e0c86ced29638a1a834e505ab6583f50e3abe GIT binary patch literal 1128 zcmb7C-)q}25Z<%?ibI6OcH=nd!yb}ueOMDV2&2%H4wf-A`BIy?l9A-LVeEh3DYEke z*3dmky8G_?PWN4!E@wB(G-XS)4y-dq7AA^e-6-iwtzZI;754~_!j!^CETr(WRKje) ziZ!w{oqt};h~eV0E^3w~aBZ~HZc`&rHBpx8e#hKCdxh9oC*-d|2k0rpyux_OAb~5i z(v-EAo4~wOxdm4sRDyccQZ~k*k_dVY0%ReKkPZ!$ik?AW=vi)bV+bX6juXIVmyx2% zg~{pSn;J@%WXyN`!sjRORJx-3?W3p~wD1;GQ&m8M4>Sdbc`Iq57S__!Y3P%{xKB`j zIq!p)L0M?vNpeE%V5~sEmEu#jo0Nt3AdC^4hyn0VSXG)2y;-Ap$nUhNaz3C;7uf<} z9}g96pshQ=w`Jk*@qk~Ao_5T9H43VSY0k(ow$>)<@xN64n7SddzwZoK(*OVf literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation2.phpt new file mode 100644 index 0000000000000..0b15ceeeb2da0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation2.phpt @@ -0,0 +1,220 @@ +--TEST-- +Test strrchr() function : usage variations - single quoted strings +--FILE-- +?@hello123456he \x234 \101 '; +$needle = array( + //regular strings + 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters + '\t', + '\T', + ' ', + '\n', + '\N', + ' +', //new line + + //nulls + '\0', + NULL, + null, + + //boolean false + FALSE, + false, + + //empty string + '', + + //special chars + ' ', + '$', + ' $', + '&', + '!#', + '%\o', + '\o,', + '()', + '*+', + '+', + '-', + '.', + '.;', + ':;', + ';', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + + '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //hexadecimal numeric string + '\101', //octal numeric string + 'A', + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing strrchr() function: with various single quoted strings *** +-- Iteration 1 -- +string(22) "lo123456he \x234 \101 " + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 4 -- +string(14) "he \x234 \101 " + +-- Iteration 5 -- +string(5) "\101 " + +-- Iteration 6 -- +string(5) "\101 " + +-- Iteration 7 -- +string(1) " " + +-- Iteration 8 -- +string(5) "\101 " + +-- Iteration 9 -- +string(5) "\101 " + +-- Iteration 10 -- +bool(false) + +-- Iteration 11 -- +string(5) "\101 " + +-- Iteration 12 -- +bool(false) + +-- Iteration 13 -- +bool(false) + +-- Iteration 14 -- +bool(false) + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +string(1) " " + +-- Iteration 18 -- +string(47) "$&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 19 -- +string(1) " " + +-- Iteration 20 -- +string(46) "&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 21 -- +string(45) "!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 22 -- +string(43) "%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 23 -- +string(5) "\101 " + +-- Iteration 24 -- +string(39) "()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 25 -- +string(37) "*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 26 -- +string(36) "+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 27 -- +string(35) "-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 28 -- +string(34) "./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 29 -- +string(34) "./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 30 -- +string(32) ":;<=>?@hello123456he \x234 \101 " + +-- Iteration 31 -- +string(31) ";<=>?@hello123456he \x234 \101 " + +-- Iteration 32 -- +string(30) "<=>?@hello123456he \x234 \101 " + +-- Iteration 33 -- +string(28) ">?@hello123456he \x234 \101 " + +-- Iteration 34 -- +string(29) "=>?@hello123456he \x234 \101 " + +-- Iteration 35 -- +string(27) "?@hello123456he \x234 \101 " + +-- Iteration 36 -- +string(26) "@hello123456he \x234 \101 " + +-- Iteration 37 -- +string(26) "@hello123456he \x234 \101 " + +-- Iteration 38 -- +string(2) "1 " + +-- Iteration 39 -- +string(5) "\101 " + +-- Iteration 40 -- +string(44) "#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 41 -- +string(5) "\101 " + +-- Iteration 42 -- +bool(false) + +-- Iteration 43 -- +string(7) "4 \101 " + +-- Iteration 44 -- +string(37) "*+-./:;<=>?@hello123456he \x234 \101 " + +-- Iteration 45 -- +string(63) "Hello,\t\n\0\n $&!#%\o,()*+-./:;<=>?@hello123456he \x234 \101 " +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation3.phpt new file mode 100644 index 0000000000000..1d0aa30091d96 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation3.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test strrchr() function : usage variations - multi line heredoc string for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +string(19) "ing heredoc syntax." +bool(false) +string(8) " syntax." +string(63) "Example of string +spanning multiple lines +using heredoc syntax." +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation4.phpt new file mode 100644 index 0000000000000..8b2c10bf25303 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation4.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing special chars for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +string(24) "!$#$^^&*(special) +chars." +string(31) "_")!#@@!$#$^^&*(special) +chars." +string(16) "(special) +chars." +string(21) "$^^&*(special) +chars." +string(16) "(special) +chars." +string(19) "^&*(special) +chars." +string(76) "Example of heredoc string contains +$#%^*&*_("_")!#@@!$#$^^&*(special) +chars." +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation5.phpt new file mode 100644 index 0000000000000..88a4a84b01a47 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation5.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing escape sequences for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +string(33) " st ch using +\escape \seque +ce" +string(9) "\seque +ce" +string(25) " using +\escape \seque +ce" +string(9) "\seque +ce" +string(33) " st ch using +\escape \seque +ce" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation6.phpt new file mode 100644 index 0000000000000..ba0ffadbd76f6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation6.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing quote chars for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +string(3) "te'" +string(32) "" +'things' 'in' 'single' 'quote'" +bool(false) +string(14) "ingle' 'quote'" +string(6) "quote'" +string(32) "" +'things' 'in' 'single' 'quote'" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation7.phpt new file mode 100644 index 0000000000000..ed5acdc045c4f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation7.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test strrchr() function : usage variations - heredoc string containing blank line for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation8.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation8.phpt new file mode 100644 index 0000000000000..3e298a0b3a4eb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation8.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strrchr() function : usage variations - empty heredoc string for 'haystack' +--FILE-- + +--EXPECTF-- +*** Testing strrchr() function: with heredoc strings *** +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation9.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation9.phpt new file mode 100644 index 0000000000000..cd4c5b2c32070 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrchr_variation9.phpt @@ -0,0 +1,196 @@ +--TEST-- +Test strrchr() function : usage variations - unexpected inputs for haystack +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // null vlaues + NULL, + null, + + // objects + new sample(), + + // empty string + "", + '', + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +$needles = array ( + //integer numeric strings + "0", + "1", + "2", + "-2", + + //float numeric strings + "10.5", + "-10.5", + "10.5e10", + "10.6E-10", + ".5", + + //regular strings + "array", + "a", + "r", + "y", + "ay", + "true", + "false", + "TRUE", + "FALSE", + "NULL", + "null", + "object", + + //empty string + "", + '', + + //resource variable in string form + "\$file_handle", + + //undefined variable in string form + @"$undefined_var", + @"$unset_var" +); + +// loop through each element of the array and check the working of strrchr() +$count = 1; +for($index = 0; $index < count($haystacks); $index++) { + echo "-- Iteration $count --\n"; + var_dump( strrchr($haystacks[$index], $needles[$index]) ); + $count ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrchr() function: with unexpected inputs for haystack *** +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(4) "2345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(5) "-10.5" +-- Iteration 7 -- +string(12) "105000000000" +-- Iteration 8 -- +string(7) "1.06E-9" +-- Iteration 9 -- +string(2) ".5" +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(2) "ay" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(2) "ay" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(3) "ray" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(1) "y" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(2) "ay" +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- +bool(false) +-- Iteration 20 -- +bool(false) +-- Iteration 21 -- +string(6) "object" +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- +bool(false) +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev.phpt new file mode 100644 index 0000000000000..321aca5bd7a69 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev.phpt @@ -0,0 +1,19 @@ +--TEST-- +strrev() function +--FILE-- + +--EXPECT-- +string(32) "ec6df70f2569891eae50321a9179eb82" +string(0) "" +string(0) "" diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_basic.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_basic.phpt new file mode 100644 index 0000000000000..2cde4cdf8977a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_basic.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test strrev() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing strrev() : basic functionality *** +string(12) "dlroW ,olleH" +string(12) "dlroW ,olleH" +string(1) "H" +string(1) "H" +string(6) "HHHHHH" +string(6) "HhhhhH" +string(13) " +dlroW ,olleH" +string(14) "n\dlroW ,olleH" +string(12) "dlrow ,olleH" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_error.phpt new file mode 100644 index 0000000000000..e1fd9f8248eca --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_error.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test strrev() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strrev() : error conditions *** +-- Testing strrev() function with Zero arguments -- +Warning: Wrong parameter count for strrev() in %s on line %d +NULL + +-- Testing strrev() function with more than expected no. of arguments -- +Warning: Wrong parameter count for strrev() in %s on line %d +NULL +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_variation1.phpt new file mode 100644 index 0000000000000000000000000000000000000000..c0f8946185c725bb3000762e16798d44ae96852c GIT binary patch literal 2941 zcmbtVZExE~4BpqM-G5+IH}T6PMYh|ualIN?Q>4H?6l;JEn3hb-t2YWc|AU%iwz=oDVX3s226y{)GCiua%QqZ=c zG87_w=vx3@nMsaGW-?4NN&@#K#2t*{P~?cQW0s~o2=2K^*Y;0)P0!E-QtB-*UN8Wx zt+uFs62!tOtK)W=t^~v8OR1_kz+=|4vQ<3C`^N$3|Ht)rM~6q zL$(%t!^)zoY%eKWo~GWY9E48lvsYc=g{)r0i%jB)^k){1fj;z- zY|Xx-;%rvEzr(YMpgxt4iZ-Zz8I527emPF(ec%}b94Yhyy-w`Jz>X)#ixWY}{OB%AWX@#$JoGU&?cUaQP}+f} z`LSFcTE8-^C*#`Ms?DF51kax!cx@8w!^UA#1z_n2ta5D~hVZk&;J?8TR-t^BhEXDM zHa|nFyf`#@W15_yiJBjJBp#IDtqG<0j9Iw~4~hLV15U9_#(pQQZ?*ve6$;TU##Rp~ z^>2JS$Ll^+he<^%}UpO`}K$J?98gFI8>8&V;l9OnCUvd?8Y_< z_X@G~Ox7d1wR?^7kwJ63w@;i|K;JYdJso-&n}sY5@HWub0^Sd84~>G-zN@`C)e|6S z@i$6Z&kNNrZEmxsQ#y`x^c^5MQgW!|iIUe!;!Vs>_B)E-@{Xz)J+* z=dh&5Qc*oBdE8<$yJ7qqndmZsA~@0~J3xjb;SrD5vTbw+**-3v`RHcQAD&!O;OLE} Jb2YoIe*thEZIJ)~ literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrev_variation2.phpt new file mode 100644 index 0000000000000000000000000000000000000000..41e54d53c6667b9e5f6cc89a1a80d7100610a013 GIT binary patch literal 2955 zcmbtVZExE)5Z-6~ii_(;ewpk@c3&3PtARB|3hYC%2Izosi4~cS1jwXEQBH%Q`R%*gI}W>8Wie?A z2%yNsUC!a3Qfj^;BYZEsAo%#{_Y0(Y_kNphz3~7(E2*V^*m6J~3#(mJZ(V%$XC4gT z11}PlZOO$s{K0oz6&&K)iV$C9sS*x}T=8?@-}Jc9u~@}wg$s&clz4-&M}8?6RMftl zbnY{qnp|XA98Uw*Qh|?*J`fvEQVE^G;0WnC{0BC)WTG?kC{dV$f0^OOpLs?>+lIR**rLiJv4SR1phFl^nxm~hFMsOc&-6ArS)SyJb)9Trz-Nu0Btj&ISMNqsBx2eDFe z!>gj3Y%eKWndkh{Mit*Wf3>M7H(X^23~NgO+81LRMiXm^3!`Y>Mw6+du;5WNnKpoy z%EX9eNn*_fexLfj_T-O}RQ1mKBme7DZLEip?-Zv}QAbp%@jA=^=R%vz3PYn_eVQ&5<2K>BZbEu6=mYPm;L${hvos8L&V#|{(&TWH2CaM}x z0rX<=qWcnFQh&g;k*7uuj2s#nkhD>r7{#NJOOi{N(_;<`dKfWE7cOQG>RhBFU`Ko7c^Sn+SD zIGfe$cX%=p)T822$@=v#!y)wHUnI8!gNY!3Pns(;Gohjm0y7JMCeY2Q+-!T*>1g== zvOfRr15L%+ZaAEI-`!dCK?)8yT5zzu{}l)C#h;%qe!KdJv-f{ZDi5igs6#+Pn`kc# z`_NhCO5QU%jcI2O8@br1#&(Z`Ck{AzjbI!IN@Er8M5YU_oyESNsbe}hYfPcC1k0pq zrhW5QuKBCRT(E{<%_@%da~!W-jyDYlI3$AEI7H1M*nT8$9F~X@xsCOX<#Cc}9Md~8 zEXsYOw~kRrMrM|n@wgBD#f44~>dejCcpn{}Iq9NQ`! z^<6Wc?YKVJy;k|ipgrmj&!1bs&^4$$?R$vaLRJQNGuSHv?}|eYt%5d3+^2-ogZ7SE z6>ZR+;{zdbYdR$~je!724vicbd1~afk$A6kUn~~-AThV#Q#vFYnT&{OVFX?&xSqq3 z9!o>@XynNOliLjuH9K7`P~t6Pk2fOrIxyjU*8(Ri=ZK|ysz+9JFz(h#ux*HRLfk6YLS=1QlBB(6O_@eH_>XyC1Zc33Btkid3u~K z;$RUZM}w=Yqi_(;=f`Qh$4sCFy{Gb?);vk|Nmi8^;x}WfVy2-LXJ@V01^S~gPCgZ; zauMOus#WRGM5GD{fh##>LZz`V&5|q8dIu0a7<^GWLjjx=^tOFA8tPK z8Tg+o1PpQz?+aw8U5fFWmk9=^8{zbp+B;xni7TzB0g_r(D63kzs#$xb)}kihhjqj& z?rm$anFc-l^8@_1=N_M|D04_Ep>kPMoF32Tyd_6hSA(O3_agNba zq0fCrs&o)ZXPO_JtFH=bg~X52MG$m`Wn+p5LjbZ+6d82oO4%h+ 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new sample(), + + // resource + $resource, + + // undefined data + @$undefined_var, + + // unset data + @$unset_var +); + +// loop through each element of the array for str + +$count = 1; +foreach($values as $value) { + echo "\n-- Iterator $count --\n"; + var_dump( strrev($value) ); + $count++; +}; + +fclose($resource); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrev() : unexpected inputs for 'str' *** + +-- Iterator 1 -- +string(1) "0" + +-- Iterator 2 -- +string(1) "1" + +-- Iterator 3 -- +string(5) "54321" + +-- Iterator 4 -- +string(5) "5432-" + +-- Iterator 5 -- +string(4) "5.01" + +-- Iterator 6 -- +string(5) "5.01-" + +-- Iterator 7 -- +string(12) "000000000501" + +-- Iterator 8 -- +string(7) "9-E60.1" + +-- Iterator 9 -- +string(3) "5.0" + +-- Iterator 10 -- + +Notice: Array to string conversion in %s on line %d +string(5) "yarrA" + +-- Iterator 11 -- + +Notice: Array to string conversion in %s on line %d +string(5) "yarrA" + +-- Iterator 12 -- + +Notice: Array to string conversion in %s on line %d +string(5) "yarrA" + +-- Iterator 13 -- + +Notice: Array to string conversion in %s on line %d +string(5) "yarrA" + +-- Iterator 14 -- + +Notice: Array to string conversion in %s on line %d +string(5) "yarrA" + +-- Iterator 15 -- +string(0) "" + +-- Iterator 16 -- +string(0) "" + +-- Iterator 17 -- +string(1) "1" + +-- Iterator 18 -- +string(0) "" + +-- Iterator 19 -- +string(1) "1" + +-- Iterator 20 -- +string(0) "" + +-- Iterator 21 -- +string(0) "" + +-- Iterator 22 -- +string(0) "" + +-- Iterator 23 -- +string(6) "tcejbo" + +-- Iterator 24 -- +string(%d) "%d# di ecruoseR" + +-- Iterator 25 -- +string(0) "" + +-- Iterator 26 -- +string(0) "" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strripos.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strripos.phpt new file mode 100644 index 0000000000000..eb4e70bd354a9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strripos.phpt @@ -0,0 +1,33 @@ +--TEST-- +strripos() function +--FILE-- + +--EXPECT-- +int(5) +int(12) +int(18) +int(12) +int(10) +int(2) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +int(1) + diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strripos_offset.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strripos_offset.phpt new file mode 100644 index 0000000000000..daa917e79fe22 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strripos_offset.phpt @@ -0,0 +1,45 @@ +--TEST-- +strripos() offset integer overflow +--FILE-- + +--EXPECTF-- +Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Warning: strripos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) + +Notice: strripos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos.phpt new file mode 100644 index 0000000000000..691f67e599e14 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos.phpt @@ -0,0 +1,32 @@ +--TEST-- +strrpos() function +--FILE-- + +--EXPECT-- +int(5) +int(5) +int(18) +int(12) +int(10) +int(2) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(1) diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_basic1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_basic1.phpt new file mode 100644 index 0000000000000..26497fb3ffa71 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_basic1.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test strrpos() function : basic functionality - with default arguments +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: basic functionality *** +-- With default arguments -- +int(0) +bool(false) +int(7) +bool(false) +int(8) +int(5) +int(0) +int(0) +int(0) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_basic2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_basic2.phpt new file mode 100644 index 0000000000000..a65bbf3fd21f0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_basic2.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strrpos() function : basic functionality - with all arguments +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: basic functionality *** +-- With all arguments -- +int(0) +bool(false) +int(7) +int(7) +int(0) +int(0) +bool(false) +int(0) +bool(false) +int(8) +int(8) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_error.phpt new file mode 100644 index 0000000000000..3900ceaa5d7ce --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_error.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strrpos() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: error conditions *** +-- With Zero arguments -- +Warning: strrpos() expects at least 2 parameters, 0 given in %s on line %d +bool(false) + +-- With less than expected number of arguments -- +Warning: strrpos() expects at least 2 parameters, 1 given in %s on line %d +bool(false) + +-- With more than expected number of arguments -- +Warning: strrpos() expects at most 3 parameters, 4 given in %s on line %d +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation1.phpt new file mode 100644 index 0000000000000..a7ef3e9b059d7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation1.phpt @@ -0,0 +1,182 @@ +--TEST-- +Test strrpos() function : usage variations - double quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 "; +$needle = array( + //regular strings + "l", + "L", + "HELLO", + "hEllo", + + //escape characters + "\t", + "\T", //invalid input + " ", + "\n", + "\N", //invalid input + " +", //new line + + //nulls + "\0", + NULL, + null, + + //boolean false + FALSE, + false, + + //empty string + "", + + //special chars + " ", + "$", + " $", + "&", + "!#", + "()", + "<=>", + ">", + "=>", + "?", + "@", + "@hEllo", + + "12345", //decimal numeric string + "\x23", //hexadecimal numeric string + "#", //respective ASCII char of \x23 + "\101", //octal numeric string + "A", //respective ASCII char of \101 + "456HEE", //numerics + chars + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing strrpos() function: with double quoted strings *** +-- Iteration 1 -- +int(28) +int(28) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(9) +int(9) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- +int(9) +int(9) +-- Iteration 11 -- +int(8) +bool(false) +-- Iteration 12 -- +int(8) +bool(false) +-- Iteration 13 -- +int(8) +bool(false) +-- Iteration 14 -- +int(8) +bool(false) +-- Iteration 15 -- +int(8) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +-- Iteration 17 -- +int(43) +int(43) +-- Iteration 18 -- +int(12) +bool(false) +-- Iteration 19 -- +int(11) +bool(false) +-- Iteration 20 -- +int(13) +bool(false) +-- Iteration 21 -- +int(14) +bool(false) +-- Iteration 22 -- +int(17) +bool(false) +-- Iteration 23 -- +int(20) +bool(false) +-- Iteration 24 -- +int(22) +bool(false) +-- Iteration 25 -- +int(21) +bool(false) +-- Iteration 26 -- +int(23) +bool(false) +-- Iteration 27 -- +int(24) +bool(false) +-- Iteration 28 -- +bool(false) +bool(false) +-- Iteration 29 -- +int(30) +int(30) +-- Iteration 30 -- +int(39) +int(39) +-- Iteration 31 -- +int(39) +int(39) +-- Iteration 32 -- +int(42) +int(42) +-- Iteration 33 -- +int(42) +int(42) +-- Iteration 34 -- +bool(false) +bool(false) +-- Iteration 35 -- +int(0) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation10.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation10.phpt new file mode 100644 index 0000000000000..abdc5e2f49088 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation10.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test strrpos() function : usage variations - unexpected inputs for 'needle' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop through each element of the 'needle' array to check the working of strrpos() +$counter = 1; +for($index = 0; $index < count($needles); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( strrpos($haystack, $needles[$index]) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrpos() function with unexpected values for needle *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- +bool(false) +-- Iteration 11 -- +bool(false) +-- Iteration 12 -- +bool(false) +-- Iteration 13 -- +bool(false) +-- Iteration 14 -- +bool(false) +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) +-- Iteration 20 -- +bool(false) +-- Iteration 21 -- +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- +bool(false) +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation11.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation11.phpt new file mode 100644 index 0000000000000..5b5e7e3e39bd4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation11.phpt @@ -0,0 +1,199 @@ +--TEST-- +Test strrpos() function : usage variations - unexpected inputs for 'haystack' and 'needle' arguments +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of strrpos() +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $haystack = $values[$index]; + var_dump( strrpos($values[$index], $values[$index]) ); + var_dump( strrpos($values[$index], $values[$index], 1) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrpos() function with unexpected values for haystack and needle *** +-- Iteration 1 -- +bool(false) +bool(false) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +bool(false) +bool(false) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +bool(false) +bool(false) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 15 -- +bool(false) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +-- Iteration 17 -- +bool(false) +bool(false) +-- Iteration 18 -- +bool(false) +bool(false) +-- Iteration 19 -- + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) + +Notice: Object of class sample could not be converted to int in %s on line %d +bool(false) +-- Iteration 20 -- +bool(false) +bool(false) +-- Iteration 21 -- +bool(false) +bool(false) +-- Iteration 22 -- +bool(false) +bool(false) +-- Iteration 23 -- +bool(false) +bool(false) +-- Iteration 24 -- + +Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d +bool(false) + +Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d +bool(false) +-- Iteration 25 -- +bool(false) +bool(false) +-- Iteration 26 -- +bool(false) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation12.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation12.phpt new file mode 100644 index 0000000000000..87ac3b2f84c6a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation12.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test strrpos() function : usage variations - checking binary safe with 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Test strrpos() function: binary safe *** +int(5) +int(5) +int(0) +bool(false) +int(11) +int(11) +int(2) +bool(false) +int(5) +int(5) +int(0) +bool(false) +int(5) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation13.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation13.phpt new file mode 100644 index 0000000000000..f85c3c454fceb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation13.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test strrpos() function : usage variations - checking bianry safe with 'needle' argument +--FILE-- + +--EXPECTF-- +*** Test strrpos() function: binary safe *** +int(1) +int(1) +int(0) +bool(false) +int(12) +int(12) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +bool(false) +int(1) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation14.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation14.phpt new file mode 100644 index 0000000000000..617685325f1d4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation14.phpt @@ -0,0 +1,153 @@ +--TEST-- +Test strrpos() function : usage variations - unexpected inputs for 'offset' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + //resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of strrpos() +$counter = 1; +for($index = 0; $index < count($offsets); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( strrpos($haystack, $needle, $offsets[$index]) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrpos() function: with unexpected values for offset *** +-- Iteration 1 -- +int(6) +-- Iteration 2 -- +int(6) +-- Iteration 3 -- + +Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 4 -- +int(6) +-- Iteration 5 -- +int(6) +-- Iteration 6 -- + +Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d +bool(false) +-- Iteration 8 -- + +Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d +bool(false) +-- Iteration 10 -- + +Warning: strrpos() expects parameter 3 to be long, array given in %s on line %d +bool(false) +-- Iteration 11 -- +int(6) +-- Iteration 12 -- +int(6) +-- Iteration 13 -- +int(6) +-- Iteration 14 -- +int(6) +-- Iteration 15 -- + +Warning: strrpos() expects parameter 3 to be long, object given in %s on line %d +bool(false) +-- Iteration 16 -- + +Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d +bool(false) +-- Iteration 18 -- +int(6) +-- Iteration 19 -- +int(6) +-- Iteration 20 -- + +Warning: strrpos() expects parameter 3 to be long, resource given in %s on line %d +bool(false) +-- Iteration 21 -- +int(6) +-- Iteration 22 -- +int(6) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation15.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation15.phpt new file mode 100644 index 0000000000000..23c7aef145eb8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation15.phpt @@ -0,0 +1,171 @@ +--TEST-- +Test strrpos() function : usage variations - unexpected inputs for 'haystack', 'needle' & 'offset' arguments +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + //resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop through each element of the array and check the working of strrpos() +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + var_dump( strrpos($values[$index], $values[$index], $values[$index]) ); + $counter ++; +} + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrpos() function: with unexpected values for haystack, needle & offset *** +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- + +Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 4 -- + +Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 5 -- + +Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 6 -- + +Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 7 -- + +Notice: strrpos(): Offset is greater than the length of haystack string in %s on line %d +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 11 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 12 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 14 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- + +Warning: strrpos() expects parameter 3 to be long, object given in %s on line %d +bool(false) +-- Iteration 20 -- + +Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d +bool(false) +-- Iteration 21 -- + +Warning: strrpos() expects parameter 3 to be long, string given in %s on line %d +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- + +Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d +bool(false) +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation2.phpt new file mode 100644 index 0000000000000..53645866be62e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation2.phpt @@ -0,0 +1,186 @@ +--TEST-- +Test strrpos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments +--FILE-- +?@hello123456he \x234 \101 '; +$needle = array( + //regular strings + 'l', + 'L', + 'HELLO', + 'hEllo', + + //escape characters + '\t', + '\T', + ' ', + '\n', + '\N', + ' +', //new line + + //nulls + '\0', + NULL, + null, + + //boolean false + FALSE, + false, + + //empty string + '', + + //special chars + ' ', + '$', + ' $', + '&', + '!#', + '()', + '<=>', + '>', + '=>', + '?', + '@', + '@hEllo', + + '12345', //decimal numeric string + '\x23', //hexadecimal numeric string + '#', //hexadecimal numeric string + '\101', //octal numeric string + 'A', + '456HEE', //numerics + chars + 42, //needle as int(ASCII value of '*') + $haystack //haystack as needle +); + +/* loop through to get the position of the needle in haystack string */ +$count = 1; +for($index=0; $index +--EXPECTF-- +*** Testing strrpos() function: with single quoted strings *** +-- Iteration 1 -- +int(32) +int(32) +-- Iteration 2 -- +bool(false) +bool(false) +-- Iteration 3 -- +bool(false) +bool(false) +-- Iteration 4 -- +bool(false) +bool(false) +-- Iteration 5 -- +int(6) +int(6) +-- Iteration 6 -- +bool(false) +bool(false) +-- Iteration 7 -- +bool(false) +bool(false) +-- Iteration 8 -- +int(12) +int(12) +-- Iteration 9 -- +bool(false) +bool(false) +-- Iteration 10 -- +bool(false) +bool(false) +-- Iteration 11 -- +int(10) +int(10) +-- Iteration 12 -- +bool(false) +bool(false) +-- Iteration 13 -- +bool(false) +bool(false) +-- Iteration 14 -- +bool(false) +bool(false) +-- Iteration 15 -- +bool(false) +bool(false) +-- Iteration 16 -- +bool(false) +bool(false) +-- Iteration 17 -- +int(53) +int(53) +-- Iteration 18 -- +int(16) +bool(false) +-- Iteration 19 -- +int(15) +bool(false) +-- Iteration 20 -- +int(17) +bool(false) +-- Iteration 21 -- +int(18) +bool(false) +-- Iteration 22 -- +int(21) +int(21) +-- Iteration 23 -- +int(24) +int(24) +-- Iteration 24 -- +int(26) +int(26) +-- Iteration 25 -- +int(25) +int(25) +-- Iteration 26 -- +int(27) +int(27) +-- Iteration 27 -- +int(28) +int(28) +-- Iteration 28 -- +bool(false) +bool(false) +-- Iteration 29 -- +int(34) +int(34) +-- Iteration 30 -- +int(43) +int(43) +-- Iteration 31 -- +int(19) +bool(false) +-- Iteration 32 -- +int(49) +int(49) +-- Iteration 33 -- +bool(false) +bool(false) +-- Iteration 34 -- +bool(false) +bool(false) +-- Iteration 35 -- +int(23) +bool(false) +-- Iteration 36 -- +int(0) +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation3.phpt new file mode 100644 index 0000000000000..a0a0d270e88f8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation3.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test strrpos() function : usage variations - multi line heredoc string for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing multi lines -- +int(44) +int(44) +int(44) +bool(false) +int(55) +*** Done *** \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation4.phpt new file mode 100644 index 0000000000000..1ccf529856633 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation4.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strrpos() function : usage variations - heredoc string containing special chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing special chars -- +int(0) +bool(false) +int(41) +int(39) +int(55) +int(55) +int(57) +*** Done *** \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation5.phpt new file mode 100644 index 0000000000000..f9537da0e2d94 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation5.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strrpos() function : usage variations - heredoc string containing escape chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing escape characters -- +int(13) +int(19) +int(13) +int(19) +*** Done *** \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation6.phpt new file mode 100644 index 0000000000000..c879a91209dba --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation6.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test strrpos() function : usage variations - heredoc string containing quotes for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: with heredoc strings *** +-- With heredoc string containing quote & slash chars -- +int(88) +int(59) +int(59) +int(59) +*** Done *** \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation7.phpt new file mode 100644 index 0000000000000..239dc246bc859 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation7.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test strrpos() function : usage variations - empty heredoc string for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: with heredoc strings *** +-- With empty heredoc string -- +bool(false) +bool(false) +bool(false) +bool(false) +*** Done *** \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation8.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation8.phpt new file mode 100644 index 0000000000000..eac7d8ff8372d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation8.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test strrpos() function : usage variations - repetitive chars for 'haystack' argument +--FILE-- + +--EXPECTF-- +*** Testing strrpos() function: strings repetitive chars *** +-- Iteration 1 -- +int(4) +-- Iteration 2 -- +int(4) +-- Iteration 3 -- +int(4) +-- Iteration 4 -- +int(4) +-- Iteration 5 -- +int(4) +-- Iteration 6 -- +int(4) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- +bool(false) +-- Iteration 11 -- +bool(false) +-- Iteration 12 -- +bool(false) +-- Iteration 13 -- +bool(false) +-- Iteration 14 -- +bool(false) +-- Iteration 15 -- +bool(false) +*** Done *** \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation9.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation9.phpt new file mode 100644 index 0000000000000..9b3b8d673dd25 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strrpos_variation9.phpt @@ -0,0 +1,184 @@ +--TEST-- +Test strrpos() function : usage variations - unexpected inputs for 'haystack' argument +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +$needle = "heredoc 0 1 2 -2 10.5 -10.5 10.5e10 10.6E-10 .5 array true false object \"\" null Resource"; + +// loop through each element of the array and check the working of strrpos() +$counter = 1; +for($index = 0; $index < count($haystacks); $index ++) { + echo "\n-- Iteration $counter --\n"; + var_dump( strrpos($haystacks[$index], $needle) ); + $counter ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strrpos() function with unexpected values for haystack *** + +-- Iteration 1 -- +bool(false) + +-- Iteration 2 -- +bool(false) + +-- Iteration 3 -- +bool(false) + +-- Iteration 4 -- +bool(false) + +-- Iteration 5 -- +bool(false) + +-- Iteration 6 -- +bool(false) + +-- Iteration 7 -- +bool(false) + +-- Iteration 8 -- +bool(false) + +-- Iteration 9 -- +bool(false) + +-- Iteration 10 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: strrpos() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +-- Iteration 15 -- +bool(false) + +-- Iteration 16 -- +bool(false) + +-- Iteration 17 -- +bool(false) + +-- Iteration 18 -- +bool(false) + +-- Iteration 19 -- +bool(false) + +-- Iteration 20 -- +bool(false) + +-- Iteration 21 -- +bool(false) + +-- Iteration 22 -- +bool(false) + +-- Iteration 23 -- +bool(false) + +-- Iteration 24 -- + +Warning: strrpos() expects parameter 1 to be string, resource given in %s on line %d +bool(false) + +-- Iteration 25 -- +bool(false) + +-- Iteration 26 -- +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn.phpt new file mode 100644 index 0000000000000..9f498b84d67db --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test strspn() behavior +--FILE-- + +--EXPECT-- +string(25) "22222222aaaa bbb1111 cccc" +string(4) "1234" +int(8) +int(6) +int(3) diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_basic.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_basic.phpt new file mode 100644 index 0000000000000..d9b1a33881386 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_basic.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strspn() function : basic functionality +--FILE-- + +--EXPECTF-- +*** Testing strspn() : basic functionality *** +int(11) +int(11) +int(2) +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_error.phpt new file mode 100644 index 0000000000000..caa1f901a110c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_error.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test strspn() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strspn() : error conditions *** + +-- Testing strspn() function with Zero arguments -- + +Warning: strspn() expects at least 2 parameters, 0 given in %s on line %d +NULL + +-- Testing strspn() function with more than expected no. of arguments -- + +Warning: strspn() expects at most 4 parameters, 5 given in %s on line %d +NULL + +-- Testing strspn() function with less than expected no. of arguments -- + +Warning: strspn() expects at least 2 parameters, 1 given in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation1.phpt new file mode 100644 index 0000000000000..513046b62dc04 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation1.phpt @@ -0,0 +1,275 @@ +--TEST-- +Test strspn() function : usage variations - unexpected values for str argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new sample, + + // undefined data + $undefined_var, + + // unset data + $unset_var, + + // resource + $file_handle +); + +// loop through each element of the array for str + +foreach($values as $value) { + echo "\n-- Iteration with str value as \"$value\" \n"; + var_dump( strspn($value,$mask) ); // with default args + var_dump( strspn($value,$mask,$start) ); // with default len value + var_dump( strspn($value,$mask,$start,$len) ); // with all args +}; + +// closing the resource +fclose($file_handle); + +echo "Done" +?> +--EXPECTF-- +*** Testing strspn() : with unexpected values for str argument *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +-- Iteration with str value as "0" +int(1) +int(0) +int(0) + +-- Iteration with str value as "1" +int(1) +int(0) +int(0) + +-- Iteration with str value as "12345" +int(5) +int(4) +int(4) + +-- Iteration with str value as "-2345" +int(0) +int(4) +int(4) + +-- Iteration with str value as "10.5" +int(2) +int(1) +int(1) + +-- Iteration with str value as "-10.5" +int(0) +int(2) +int(2) + +-- Iteration with str value as "105000000000" +int(12) +int(11) +int(10) + +-- Iteration with str value as "1.06E-9" +int(1) +int(0) +int(0) + +-- Iteration with str value as "0.5" +int(1) +int(0) +int(0) + +-- Iteration with str value as "Array" + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration with str value as "Array" + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration with str value as "Array" + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration with str value as "Array" + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration with str value as "Array" + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, array given in %s on line %d +NULL + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "1" +int(1) +int(0) +int(0) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "1" +int(1) +int(0) +int(0) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "object" +int(2) +int(1) +int(1) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "" +int(0) +bool(false) +bool(false) + +-- Iteration with str value as "Resource id #%d" + +Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: strspn() expects parameter 1 to be string, resource given in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation10.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation10.phpt new file mode 100644 index 0000000000000..318d16ccfb4dc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation10.phpt @@ -0,0 +1,274 @@ +--TEST-- +Test strspn() function : usage variations - with varying mask & default start and len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different mask strings and default start and len arguments *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) + +-- Iteration 4 -- +int(0) +int(0) +int(1) +int(2) +int(0) +int(1) +int(1) +int(1) +int(0) +int(1) + +-- Iteration 5 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 6 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 8 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 9 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 10 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 11 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 12 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 13 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 14 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 15 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 16 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) + +-- Iteration 17 -- +int(0) +int(0) +int(4) +int(4) +int(4) +int(0) +int(4) +int(4) +int(0) +int(4) +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation11.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation11.phpt new file mode 100644 index 0000000000000..209981e69a340 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation11.phpt @@ -0,0 +1,1306 @@ +--TEST-- +Test strspn() function : usage variations - with varying start and default len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different start and default len values *** + +-- Iteration 1 -- +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 2 -- +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +bool(false) +int(1) +int(1) +bool(false) +int(1) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +bool(false) +int(1) +int(1) +bool(false) +int(1) + +-- Iteration 4 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(1) +int(2) +int(1) +int(0) +int(1) +int(2) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(1) +int(1) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(1) +int(1) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(1) + +-- Iteration 5 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +bool(false) +int(4) + +-- Iteration 6 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(1) +int(2) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(1) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 8 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 9 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +bool(false) +int(4) + +-- Iteration 10 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) + +-- Iteration 11 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 12 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 13 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(4) +int(3) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 14 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) + +-- Iteration 15 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) + +-- Iteration 16 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) + +-- Iteration 17 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(1) +bool(false) +int(4) +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation12.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation12.phpt new file mode 100644 index 0000000000000..9e2eaf010dd14 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation12.phpt @@ -0,0 +1,2878 @@ +--TEST-- +Test strspn() function : usage variations - with varying start and len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different start and len values *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) + +-- Iteration 4 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) + +-- Iteration 5 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 6 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 8 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 9 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 10 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 11 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation2.phpt new file mode 100644 index 0000000000000..b8891a5909694 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation2.phpt @@ -0,0 +1,274 @@ +--TEST-- +Test strspn() function : usage variations - unexpected values for mask argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new sample(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, + + // resource + $file_handle +); + +// loop through each element of the array for mask + +foreach($values as $value) { + echo "\n-- Iteration with mask value as \"$value\" -- \n"; + var_dump( strspn($str,$value) ); // with defalut args + var_dump( strspn($str,$value,$start) ); // with default len value + var_dump( strspn($str,$value,$start,$len) ); // with all args +}; + +// close the resource +fclose($file_handle); + +echo "Done" +?> +--EXPECTF-- +*** Testing strspn() : with diferent unexpected values of mask argument *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +-- Iteration with mask value as "0" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "1" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "12345" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "-2345" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "10.5" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "-10.5" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "105000000000" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "1.06E-9" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "0.5" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "Array" -- + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +-- Iteration with mask value as "Array" -- + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +-- Iteration with mask value as "Array" -- + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +-- Iteration with mask value as "Array" -- + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +-- Iteration with mask value as "Array" -- + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, array given in %s on line %d +NULL + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "1" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "1" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "object" -- +int(0) +int(1) +int(1) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "" -- +int(0) +int(0) +int(0) + +-- Iteration with mask value as "Resource id #%d" -- + +Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d +NULL + +Warning: strspn() expects parameter 2 to be string, resource given in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation3.phpt new file mode 100644 index 0000000000000..0773bd3ad3f04 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation3.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test strspn() function : usage variations - unexpected values of start argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new sample(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, + + // resource + $file_handle +); + +// loop through each element of the array for start + +foreach($values as $value) { + echo "\n-- Iteration with start value as \"$value\" --\n"; + var_dump( strspn($str,$mask,$value) ); // with default len value + var_dump( strspn($str,$mask,$value,$len) ); // with all args +}; + +// closing the resource +fclose($file_handle); + +echo "Done" +?> +--EXPECTF-- +*** Testing strspn() : with unexpected values of start argument *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +-- Iteration with start value as "10.5" -- +int(0) +int(0) + +-- Iteration with start value as "-10.5" -- +int(2) +int(2) + +-- Iteration with start value as "105000000000" -- +bool(false) +bool(false) + +-- Iteration with start value as "1.06E-9" -- +int(2) +int(2) + +-- Iteration with start value as "0.5" -- +int(2) +int(2) + +-- Iteration with start value as "Array" -- + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "Array" -- + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, array given in %s on line %d +NULL + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "1" -- +int(1) +int(1) + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "1" -- +int(1) +int(1) + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "" -- + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "" -- + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "string" -- + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "string" -- + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, string given in %s on line %d +NULL + +-- Iteration with start value as "object" -- + +Warning: strspn() expects parameter 3 to be long, object given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, object given in %s on line %d +NULL + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "" -- +int(2) +int(2) + +-- Iteration with start value as "Resource id #%d" -- + +Warning: strspn() expects parameter 3 to be long, resource given in %s on line %d +NULL + +Warning: strspn() expects parameter 3 to be long, resource given in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation4.phpt new file mode 100644 index 0000000000000..dd21a1d0fa7e0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation4.phpt @@ -0,0 +1,198 @@ +--TEST-- +Test strspn() function : usage variations - unexpected values of len argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new sample(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, + + // resource + $file_handle +); + +// loop through each element of the array for start + +foreach($values as $value) { + echo "\n-- Iteration with len value as \"$value\" --\n"; + var_dump( strspn($str,$mask,$start,$value) ); // with all args +}; + +// closing the resource +fclose($file_handle); + +echo "Done" +?> +--EXPECTF-- +*** Testing strspn() : with unexpected values of len argument *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +-- Iteration with len value as "10.5" -- +int(2) + +-- Iteration with len value as "-10.5" -- +int(0) + +-- Iteration with len value as "105000000000" -- +int(2) + +-- Iteration with len value as "1.06E-9" -- +int(0) + +-- Iteration with len value as "0.5" -- +int(0) + +-- Iteration with len value as "Array" -- + +Warning: strspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "Array" -- + +Warning: strspn() expects parameter 4 to be long, array given in %s on line %d +NULL + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "1" -- +int(1) + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "1" -- +int(1) + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "" -- + +Warning: strspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "" -- + +Warning: strspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "string" -- + +Warning: strspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "string" -- + +Warning: strspn() expects parameter 4 to be long, string given in %s on line %d +NULL + +-- Iteration with len value as "object" -- + +Warning: strspn() expects parameter 4 to be long, object given in %s on line %d +NULL + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "" -- +int(0) + +-- Iteration with len value as "Resource id #%d" -- + +Warning: strspn() expects parameter 4 to be long, resource given in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation5.phpt new file mode 100644 index 0000000000000000000000000000000000000000..514af55319113c075f9379f37c8b1628500865b5 GIT binary patch literal 2415 zcmcIlZEw>$6y8_-D~_suXsU*GV;eBWUg9*?Tsznf+jMpR5WkXh z;xuDj7~unz+Snc5ops01`rO|K#wc~36-?){Wo;Zl% zO8OE?VMT5-IwSSkg@?H)c&&(tTMu04po9i)*N(;U+4;LAS~`7Il@*&$;e$2a_?t=q znyF|5Qgc0T7t>#4Ex)>$$o9l7&O z<|2nHV=qyIycFaGMc36AxSEXJY}|xtHb#ZfY`iumPsz56fL!@#YMTiZnTrz;*M5#@ zopYPxfM21e8AulaUa5S!@H3sf=RMxJC?@wLWK=b@x7lyC&V!olp|>tCv3W3j3H zO}aJn5>8J~m+w~$zi4FKK2OQFREsMmwSW$kXx0n-Dc2pgkQRHPIgiz_wHJcUoWQEV zvL^QXZ+$84y_fCD2Xv;G*wph2cPqFQN}0rC`KUb6VW-<&uP0npCD)iRE3;jm{evgX z(Zi!-hU>$YoR+;@VsjyKtlm`DO6`&*iy&jsu&^ZjCyQRDQe5-YWFEV&i*K;LNcI$#_LNMxx$zG2Z4%N}|(`U~YNs}l_n4yNIhE>K?;7e=jbqRuJ_@hKKRk164 zDMFfXfZDsWgy9o{Pr8QPW)`Oo4n!Nlf33nWauOZKaE{ZsxqiavLKuz@RihOL$%u|6 zBZ%W>-h>&A7gn0rn`*M1djy&_K1L9|0CXWt!QLCIA$RP5bT+7Xiz9W!Uj2jD*z(hd z<(t(R-ei9`4H+JO(327Q!0-;7ETZ3o8SCH&1K@vWs&x|f2S{id|54NLEDVpZ?nsV? mlJpL=M>Nkmu4hBJ_8Jj;K~VVH>sXElv;6!0As$piCG-PeNd;;E literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation6.phpt new file mode 100644 index 0000000000000..3c3c1d8c37c43 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation6.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test strspn() function : usage variations - with heredoc strings, varying mask & default start and len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different mask strings *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(8) +int(11) +int(0) +int(0) +int(0) +int(1) +int(0) +int(2) + +-- Iteration 4 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(4) +int(0) +int(4) + +-- Iteration 5 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(4) +int(0) +int(4) + +-- Iteration 6 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(4) +int(0) +int(4) + +-- Iteration 7 -- +int(0) +int(0) +int(4) +int(4) +int(0) +int(0) +int(0) +int(4) +int(0) +int(4) +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation7.phpt new file mode 100644 index 0000000000000..d0ebee3c9253c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation7.phpt @@ -0,0 +1,612 @@ +--TEST-- +Test strspn() function : usage variations - with heredoc strings, varying start and default len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different start values *** + +-- Iteration 1 -- +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) +int(0) +bool(false) +bool(false) +int(0) +int(0) +bool(false) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(1) +int(2) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(1) +int(2) +bool(false) +int(2) + +-- Iteration 3 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(8) +int(7) +int(6) +int(0) +int(0) +bool(false) +int(8) +int(11) +int(10) +int(9) +int(0) +int(1) +bool(false) +int(11) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) + +-- Iteration 4 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(1) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(1) +int(0) +bool(false) +int(2) + +-- Iteration 5 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) + +-- Iteration 6 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(4) +int(3) +int(2) +int(0) +int(0) +bool(false) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +int(0) +int(2) +int(1) +int(0) +int(0) +int(0) +bool(false) +int(2) +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation8.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation8.phpt new file mode 100644 index 0000000000000..3e9e9ddd8c7b1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation8.phpt @@ -0,0 +1,1894 @@ +--TEST-- +Test strspn() function : usage variations - with heredoc strings, varying start and len args +--FILE-- + +--EXPECTF-- +*** Testing strspn() : with different start and len values *** + +-- Iteration 1 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 2 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(1) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) + +-- Iteration 3 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(8) +int(8) +int(0) +int(0) +int(1) +int(2) +int(7) +int(7) +int(0) +int(0) +int(1) +int(2) +int(6) +int(6) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(8) +int(8) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) + +-- Iteration 4 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(0) +int(1) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 5 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 6 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) + +-- Iteration 7 -- +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(1) +int(1) +int(1) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +int(0) +int(1) +int(2) +int(3) +int(3) +int(0) +int(0) +int(1) +int(2) +int(2) +int(2) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +int(0) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +int(0) +int(1) +int(2) +int(4) +int(4) +int(0) +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation9.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strspn_variation9.phpt new file mode 100644 index 0000000000000000000000000000000000000000..14af0ca0af2751931296f223a5f69008bb025489 GIT binary patch literal 2538 zcmb_c$!^;)5Y5&6ih*Fj3oP5p*3@mfphh@q(s-%!w!30Xn=K`*|k(_QUgpkVF zOcDRn3&W%1?}r%X*mPCvYTHYKg%dsp%Q| z$wKlRte9UB^#rv@TM#sUN+a?+GD|XUcv1*sVWvyeAe9R}WU%&kJgbyyGpfW=C}~N~ zwM<0{H`-hx2YD$-g%eg@;HlfTgSJc4pp6WBgZ5nO^qgYb9*~q%U7AE7$y7{0+!iCW zRw*|r9w;5dgsi^il3T#k)%CIyP+AGrA2Cca>jRaw%A~LCq^i}U5+V>nQ@Ki)ACmM! zMJa+vG7Uk$|H?3~C7y=_1d3Jg0hy2LY7uoKewA3B)c4>;E-V=!4ptPOA2lOmm|Dt_ zg?*G`_+9r=?XZ+VFkr0~9y*=s5McEBE>_FiOys$a3#?_H#>#)G>T7BLk`W?-ixfng zTiecZd&dJ5c!L=Jx%1@n8jrDe97mgLvF{&hk0dkQac}7VRl=&f!1MJ!!ILJPhbEm> z6YpO84Fkt%l~3(4?6}98Qyn;t#^d;wbN+;DJYIe6JXO9P_DS3AgnbC?tjMCxSc$Fe z{AOp@yxU9Pj}Zm~5R|5-qNd5UUOdH#3 zr_xsTxQ@@$@@mno_X+_ITt0e$sriF~J);9$2Lb#130LspkCVf1(<9u%Z#l9Ik)M|w zkXVMB9Xs*OEZGt?Y68VPznXw+_?Bx(=FZHYmk2ve(fr6fvnpyHjVSADphZif_KtR& zNUXcZZppmf--*~*lOAn0h4tF+x6qPtquz~;rEO!BjR)-R-J-1~cHS@c^zI!SlldUr hl4R7_b^qh_x%6)X{$27x-^$;G5xdy*grS;5j_9^ literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strstr.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strstr.phpt new file mode 100644 index 0000000000000000000000000000000000000000..ab10c9efbe9ca19122b76f8dad2e94d16df50ef1 GIT binary patch literal 10387 zcmeHNdsEv;63@TUr|8v@!)7tqGR8n4St@aAw~9?tfmE&vQj{!>u{N^gm1G{9%GKW2 zz5NcC`}NF79^)tGa&-@?C_Elb_jLFC`Y|n6DkrVulS;)p5otzgmf){crp_SpvLKGE zO6Ap0M=d7e5 zUW(L9f|WyWq-;+v|FMqokFFD)xrgO-j}BhMi_mPJJm))2<~K z&9T5SGn%;OhkRdNa9gh8p*!;_KXesse#&Q&dCq!|GF=5(mvBTuJV;65FeR+S8Ly~= zp#!q)A4M3(bQLF|zh135)q0&O^^N-0Rs--Odj0>2#96FW}6cMt*22^6`g z0QE}F=s+m4 ze2(oT=h;kZ0gvo;-Wz-1qbjG_g6cVs)bpDBsPQ6cTS+8G>N)8TJ_b2lZLjj0)w4)` z+VEFNQ*-jq>`H`}LVnYRv*4$E2w@!eVeTXzTy*DH-&S_EZ<)UnCnZ`50GjGk{@f=o z9z0q88MROqKnBrXR%rm9qAlp#juXq?dkuT#$ObS3yGJ@E^X zWj)q0Z4~W42dM`Di%2lagQ!2q$agcBfi5@FR1o8>o2DEH^4M`+PoFE0bH_YsfWX6Hi3&B5U1IvWq8E4cMWO;FPDUwY1 zYSmmjndl6hyPh{QLXSF*qT>dKEBhC~`ZXFOTKDs;y8Z3|*`3WHb zWk^Qa?bcP;fSVJ2vA$REs?m=$^wBS)>(KL8I?xa>vKAQrLVNL!M*?!cE?}I zHbjB1s;?T>Pz!8={^OPqeuS+eWLvMx1;as>cSE`pG@je(MuAW2KeC>1pkw zOcsyX*@_gG1J$`T0vDK*VSOtPTUt!>HM6luk&+gk+9v0B@UMG z3O~RhZ%j66!45_(#*3atDnu3cYvK@R~6d`DzIMC^|)L?Ua+u1JI*d)hH``ST=u zK>Pdqtv4@aDi@uLZt%;euouPsUxB*8P?HkyZ#e=m-J z?goi4(x z(7<~Xkzq8+r9rQcB8F=nFXrJjr8iOL;zNp=7IGFTc2(xHRaHP9D|$_X%3(a{$&mlHxM@aKrib@j2-LX0u8OU+>4sWQPxJXpE z0gl>cuAXYc&&pFyH1wd6&omlHzzXCjqLB!>luu<%8ux_W3pX_` zIu(>?m2tR=`UrR{%1u(0zvNU%Vbj4gvY$@Cgo1LukU;=vD~KIPwXp~>FO1krvyyfC_TsVTj2XQk;Jgs#h@pmYhWgH1q z?dYMsIBFffMiZ^$g>foM!*UCTkW*a86|)XzpFaax>o0FxFHT;85H`I_2g_2nF4byf z)q>H8wDSksm{)6NP31^+AS8F?MU$h->*R6MU{A#V^Iqt60 ztlL&Qj>A&N4O3CR^LRvg2#r77!=|-$U^e5XT}3p{b>3m6W!PD`&GX3U@;uTl9&1vE zhY#7qGGFB94K@~@f%_l(mwvD@H~FzhuiExn2AW*t1|wzZeu zY7V#^6WsSQq$3fm)7uu~N_L8u72Giazr(5Ro970{^o(sjYHldre!;M`LZ*AvIg~9G ziyevl>3DU_VC}FHi-cLnMESQxq$9yULjj3cjiYZ{8JM-(tUf*02n#mn^OA<~FE6LI zEI<}*;9Az}I14^4^wIBs`}-gN_&VMswSMQ8s3DVDXj@;6dCt{eZR?RS#m3c4 zVO+EJn$)Pgw;hKJJ|uX(h +--EXPECTF-- +*** Testing strtok() : basic functionality *** + +The Input string is: +"This testcase test strtok() function." + +The token string is: +" ()." + +--- Token 1 --- +string(4) "This" + +--- Token 2 --- +string(8) "testcase" + +--- Token 3 --- +string(4) "test" + +--- Token 4 --- +string(6) "strtok" + +--- Token 5 --- +string(8) "function" + +--- Token 6 --- +bool(false) + +--- Token 7 --- +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_error.phpt new file mode 100644 index 0000000000000..d83085b0c61c0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_error.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test strtok() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strtok() : error conditions *** + +-- Testing strtok() function with Zero arguments -- + +Warning: Wrong parameter count for strtok() in %s on line %d +NULL + +-- Testing strtok() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for strtok() in %s on line %d +NULL +string(13) "sample string" + +-- Testing strtok() with less than expected no. of arguments -- +bool(false) +string(10) "string val" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation1.phpt new file mode 100644 index 0000000000000..3c754c88a68c0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation1.phpt @@ -0,0 +1,172 @@ +--TEST-- +Test strtok() function : usage variations - first argument as non-string +--FILE-- + 'red-color', 'item' => 'pen-color'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // undefined variable + $undefined_var, + + // unset variable + $unset_var, + + // resource + $file_handle +); + + +// loop through each element of the array and check the working of strtok() +// when $str arugment is supplied with different values + +echo "\n--- Testing strtok() by supplying different values for 'str' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str = $values [$index]; + + var_dump( strtok($str, $token) ); + + $counter ++; +} + +//closing the resource +fclose($file_handle); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing strtok() : with first argument as non-string *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +--- Testing strtok() by supplying different values for 'str' argument --- +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(4) "2345" +-- Iteration 5 -- +string(4) "10.5" +-- Iteration 6 -- +string(4) "10.5" +-- Iteration 7 -- +string(12) "105000000000" +-- Iteration 8 -- +string(5) "1.06E" +-- Iteration 9 -- +string(3) "0.5" +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 15 -- +string(1) "1" +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +string(1) "1" +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- +string(3) "obj" +-- Iteration 20 -- +bool(false) +-- Iteration 21 -- +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- +bool(false) +-- Iteration 24 -- +bool(false) +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +string(%d) "Resource id #%d" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation2.phpt new file mode 100644 index 0000000000000..e08005ca7d87d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation2.phpt @@ -0,0 +1,172 @@ +--TEST-- +Test strtok() function : usage variations - with different token strings +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new sample(), + + // empty string + "", + '', + + // null vlaues + NULL, + null, + + // undefined variable + $undefined_var, + + // unset variable + $unset_var, + + // resource + $file_handle +); + + +// loop through each element of the array and check the working of strtok() +// when $token arugment is supplied with different values + +echo "\n--- Testing strtok() by supplying different values for 'token' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $token = $values [$index]; + + var_dump( strtok($str, $token) ); + + $counter ++; +} + +// closing the resource +fclose($file_handle); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing strtok() : with different token strings *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +--- Testing strtok() by supplying different values for 'token' argument --- +-- Iteration 1 -- +string(37) "this testcase test strtok() function " +-- Iteration 2 -- +string(37) "this testcase test strtok() function " +-- Iteration 3 -- +string(37) "this testcase test strtok() function " +-- Iteration 4 -- +string(37) "this testcase test strtok() function " +-- Iteration 5 -- +string(37) "this testcase test strtok() function " +-- Iteration 6 -- +string(37) "this testcase test strtok() function " +-- Iteration 7 -- +string(37) "this testcase test strtok() function " +-- Iteration 8 -- +string(37) "this testcase test strtok() function " +-- Iteration 9 -- +string(37) "this testcase test strtok() function " +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(10) "this testc" +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(10) "this testc" +-- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(10) "this testc" +-- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(10) "this testc" +-- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(10) "this testc" +-- Iteration 15 -- +string(37) "this testcase test strtok() function " +-- Iteration 16 -- +string(37) "this testcase test strtok() function " +-- Iteration 17 -- +string(37) "this testcase test strtok() function " +-- Iteration 18 -- +string(37) "this testcase test strtok() function " +-- Iteration 19 -- +string(4) "his " +-- Iteration 20 -- +string(37) "this testcase test strtok() function " +-- Iteration 21 -- +string(37) "this testcase test strtok() function " +-- Iteration 22 -- +string(37) "this testcase test strtok() function " +-- Iteration 23 -- +string(37) "this testcase test strtok() function " +-- Iteration 24 -- +string(37) "this testcase test strtok() function " +-- Iteration 25 -- +string(37) "this testcase test strtok() function " +-- Iteration 26 -- +string(2) "th" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation3.phpt new file mode 100644 index 0000000000000..3026d86a01991 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation3.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test strtok() function : usage variations - with heredoc strings +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with heredoc strings *** + +--- Iteration 1 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 2 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 3 --- +string(11) "first line " +string(7) "f hered" +string(8) "c string" +string(3) "sec" +string(8) "nd line " +string(7) "f hered" +string(8) "c string" +string(11) "third line " +string(7) "f hered" +string(7) "cstring" +bool(false) + +--- Iteration 4 --- +string(4) "hell" +string(1) "w" +string(3) "rld" +string(4) "hell" +string(1) "w" +string(3) "rld" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 5 --- +string(4) "hell" +string(4) "123w" +string(4) "rld4" +string(1) "6" +string(8) "1234hell" +string(4) "1234" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 6 --- +string(4) "hell" +string(1) "w" +string(3) "rld" +string(4) "hell" +string(4) "hell" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation4.phpt new file mode 100644 index 0000000000000..6f4fa6621b475 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation4.phpt @@ -0,0 +1,110 @@ +--TEST-- +Test strtok() function : usage variations - with embedded nulls in the strings +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with embedded nulls in the strings *** + +--- Iteration 1 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 2 --- +string(2) "\0" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 3 --- +string(5) "hello" +string(5) "world" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 4 --- +string(3) "hel" +string(2) "lo" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 5 --- +string(5) "hello" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 6 --- +string(11) "hello world" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 7 --- +string(4) "\0he" +string(5) "llo\0" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 8 --- +string(9) "hello\0\0" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation5.phpt new file mode 100644 index 0000000000000..c49f7ded9fda9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation5.phpt @@ -0,0 +1,150 @@ +--TEST-- +Test strtok() function : usage variations - miscellaneous inputs +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with miscellaneous inputs *** + +--- Iteration 1 --- +string(11) "HELLO WORLD" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 2 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 3 --- +string(5) "HELLO" +string(5) "WORLD" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 4 --- +string(5) "hello" +string(3) "wor" +string(2) "ld" +bool(false) +bool(false) +bool(false) + +--- Iteration 5 --- +string(3) "hel" +string(2) "lo" +string(5) "world" +bool(false) +bool(false) +bool(false) + +--- Iteration 6 --- +string(3) "one" +string(1) "$" +string(3) "two" +string(1) "!" +string(5) "three" +string(1) "#" + +--- Iteration 7 --- +string(11) "hello/r/wor" +string(3) "rld" +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 8 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 9 --- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 10 --- +string(5) "hello" +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) + +--- Iteration 11 --- +string(5) "hello" +string(5) "world" +bool(false) +bool(false) +bool(false) +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation6.phpt new file mode 100644 index 0000000000000..5a77f6f9e96a4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation6.phpt @@ -0,0 +1,160 @@ +--TEST-- +Test strtok() function : usage variations - invalid escape sequences as tokens +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with invalid escape sequences in token *** + +--- Iteration 1 --- +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(7) "khellok" +string(6) "worldk" +bool(false) +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(1) " " +string(1) "r" +bool(false) +bool(false) + + +--- Iteration 2 --- +string(1) "\" +string(6) "hello\" +string(7) " world\" +bool(false) + +string(9) "\khello\k" +string(7) "world\k" +bool(false) +bool(false) + +string(1) "\" +string(6) "hello\" +string(7) " world\" +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(1) " " +string(1) "r" +bool(false) +bool(false) + + +--- Iteration 3 --- +string(1) "/" +string(6) "hello\" +string(7) " world/" +bool(false) + +string(8) "khello\k" +string(5) "world" +string(1) "k" +bool(false) + +string(6) "hello\" +string(6) " world" +bool(false) +bool(false) + +string(1) "/" +string(5) "hello" +string(7) " world/" +bool(false) + +string(1) "/" +string(1) " " +string(1) "r" +string(1) "/" + + +--- Iteration 4 --- +string(6) "/hello" +string(7) "/ world" +bool(false) +bool(false) + +string(6) "hellok" +string(5) "world" +bool(false) +bool(false) + +string(5) "hello" +string(6) " world" +bool(false) +bool(false) + +string(6) "/hello" +string(7) "/ world" +bool(false) +bool(false) + +string(1) "/" +string(2) "/ " +string(1) "r" +bool(false) + +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation7.phpt new file mode 100644 index 0000000000000..28cbf7d917f98 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtok_variation7.phpt @@ -0,0 +1,108 @@ +--TEST-- +Test strtok() function : usage variations - modifying the input string while tokenising +--FILE-- + +--EXPECTF-- +*** Testing strtok() : with modification of input string in between tokenising *** + +*** Testing strtok() when string being tokenised is prefixed with another string in between the process *** +string(4) "this" + +-- Token 1 is -- +string(2) "is" + +-- Input str is "extra string this is a sample string" -- + +-- Token 2 is -- +string(1) "a" + +-- Input str is "extra string this is a sample string" -- + +-- Token 3 is -- +string(6) "sample" + +-- Input str is "extra string this is a sample string" -- + +-- Token 4 is -- +string(6) "string" + +-- Input str is "extra string this is a sample string" -- + +-- Token 5 is -- +bool(false) + +-- Input str is "extra string this is a sample string" -- + +-- Token 6 is -- +bool(false) + +-- Input str is "extra string this is a sample string" -- + +*** Testing strtok() when string being tokenised is suffixed with another string in between the process *** +string(5) "extra" + +-- Token 1 is -- +string(6) "string" + +-- Token 2 is -- +string(4) "this" + +-- Token 3 is -- +string(2) "is" + +-- Token 4 is -- +string(1) "a" + +-- Token 5 is -- +string(6) "sample" + +-- Token 6 is -- +string(6) "string" + +-- Token 7 is -- +bool(false) + +-- Token 8 is -- +bool(false) + +-- Token 9 is -- +bool(false) + +-- Token 10 is -- +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtolower-win32.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtolower-win32.phpt new file mode 100644 index 0000000000000000000000000000000000000000..af1290f1b1bcb31a0390ef82b1b684c0ad0e51c0 GIT binary patch literal 4835 zcmb{0{cjYx9R~3J{QMQZRqk#BB#iBOB^Ry~LW!DkC<&sikdQrNv#VQnRy!LwRP}%F zcb<*Il1r&7HPQuV$1fj04TDF^czr?}8 z#a~Weoj#XZKmEL#tuT*MH65scs&oKMudn zSL*y~sru#Ov;0zT=F6`CG^kJW%}i}OS8n)bcR%hQ;pfLPi|40jCpU9=cu&1r_nUt6 zc@-Wh8Bcy>KJ(@KofOnGeYPjplyoGuo`s=Z&sSqKkGAd3!{%ze98z7{++v~JVl{I< zZ04JXy z4od32T~3Y=`?Z?x&5yGqwKxCi*c8QBxPO2DpJLn_hgZkaWG!_#jg?GwGxhVOnT6k` ztgyd-I8n!s)#UKz^PL4TVV%kTSc@b6>pyVQ`XSc4L1w=V_6wG2$|CryTYpwBT&JF> z#r*Pe5!Bg}4_>*YEQr~Og!3^xQ>T~eqUVSo-TGa3^zO&$2co*~#R=_AKWq8RZm;a|=R5iNH}ld}sJ2%GL>%wwe@ zd&zyw#f?i^B6&D2rr_F{ET}YTdB(2G`)XWK+lBged2pakWmU7OEHe&yaKO8z#!k2Q zYfLw#dD9J-;kL>B`$xE0PXFx|Za($0Im8&&LFP9;J2y8kJq+_Go6naaCojU;S+73z z=VzVlF2~2myP(PJWU=Vgn_te)p2_mQncU6P*D`?n5FTtFzo+AXr^_KMhxumyF>tP7 zF@!rCE_>Nkr7>&Wxkkf!Esw5j3Y~Pv{N>Ic;m+)2XFO7}SpN~$y{y9bS05w--myEY zPuxT{Tt9B8Z1&`)#bb5y+bYO@)Qz`$XWMz!FT=Q}h=6zSZI(r7929qf=AY}&?4(t z=#T{#0K*2*1*zZEi64Yho#3Bu=LmxmL6Nd(qn5_ zdTawrk9Dy0SPx5&ZDHxL9V|UIz|vzQa(eO%IX$IDPETo&(^FdH^prVrdddPhJ!OfU zp0YwtPgx_Ur)-eZQ#$1IlpZ-fWs97ivO`W!8IaRcMilf^847wTje?%aprEI+DCntj z6!cUDA>WluwoNsZu^w%BP~I@~G&kT2%B@9V&XNfQp_fqNb8UH!^wc$Kdg=x>J&i+6Pwi3D)3m7RsXNs4Gyyd|bwoo?lcAxf(P-#t z3>tbGi-w*iM?+6jprNNJ(a_UWXy|EbH1sqLn&fHdX*`G|AJ@6C)fwE`y`T zX*hbEfuqM+IC@+TM~^Gu=y4?+J+6YI$JKE3xCV|M=iumZ9*!Q@LSFUcac~_RJubk} z<03pgK7*&nYj}FRfv3k?czS#ePmeF)>G35zJ-&jc$Jg-m_y(RH@8Ie29-bcG!qekB zczS$*r^iRM^n?s8Jwcr=PfYp5luu0g zM0(`;y7j*F?Nbr9FPqa`&d`$&gzDjH_;hn$K!HJA6w9uwRi zC%tB09~Q^=`djB6ISKE)vu8@)?XE}9WN_*6tLu8_dMVepRd3faJGJ!K&9)j3LAN@z zJ5|kC_2zuEZL>We-D;HYG_qP6{r>1Qo{(fQTpyiowJ&zs>oMc8_8-Pyw0S55>{d|h6kRnzRCA>TGcueZFUgE6Aysn5HbQl5@_ZkURL_w012E)Gl zj*m=7b-fe=Ccw^FyqDiSJTg4aW|yZIm$Mlz({?AeyUng&_8-&cXe#p6D(n{h3bWb8 zU(bF#dsS+E^X+=R#v+TOueNEo?1NjTqw^O(pPZjR68F<;_U7X8o6A=-dw)8G5OI-? z?r(otti>v&C?*FLCSu?E{`48XeO|_Rb#{JwGs2Sx;>S(D>vx~l>8U6^l~2JfR__js z;%NNtUO6U8N2S)wv<;iZdVoLOw|kv-SDV##tow1Xn+vyGmY?<9`LtUE5$0~=!Y*yL zBJ`^dX|pTZU0;YLir}{CF&;bt{%Fe2fE4Dvm^^s!Kn#KY)>|^Y8C*4nqi#j1`*t;X zhTLz&(Y?iS^-SDbd~>XtW+*&-IQ>_d#=Su(j!TnGsl%DBOB%Z)zgVex`t^tvrqjn0 zar|6N9^ZU_a7HJrGno#xIO4zm3wK-q#Co?a0qwK@jAh`*V)8e)`6Rw~QJje7;_`Bt z#QDj4FWf4Mi}`8E??ZYi&Mw78&k;Yk&Cl`b{rc#DHFPyCGrErM?dr?nl`aY`&E&F~gcJobt^=>|_%`i{l7qRZQ+l4Q= z54pHu)t5+~42vnbFfR*goV44D>+)0#D{8+`->zmeaaI;So0et9A!jq5EirVuKVL(- zW12VJa2f8KJbd^JH_PddPT}rjU+xS!r%fvJ8!oS#lQ&)r!yV>e$jSHV{Ja+*``71j zG8M4a*R6ZIOEZs5xa^|1m&g`b;E+xuh{b$o8N0Lk z#7!QFi7!*$H#@m$@m!q#x=!Vm6^GM(aNBv=uhMW&DFWVBPyg}b>5Fnlo}qmCzuc5i zRl~ics!&N5Br3&%LZw;IsA?8!R1FIaD#L<7)w0l{vMg9s9Sa>Q$AUxUS@5U=3jtMR zA)-nwBvhG&3`viyAnB13k{+ob>5&?e9$7=uBO6G1q=BSIwvhBl3rUacAnB0~k{;5&1F9vLC&kqMF>nW5-W6%;*6LeZlX6g^5q(W7c8dQ<~Nk1|m7s1}MIWufR%9TYvv zLD8c;6g?_H(W4?1Jt{%bqcSu-x`L)hOK5tuf~H4nXnJ%FO^Cpz79^FFIqb)Q& zx`U=iJ7{{eho(mdXnJ&nrbj1edUQrjPhFv=$4J!l7=@Z1qfygiYSi?Y1~om#pr*&P zsOd2lH9e+7O^9I8|J+^_R z#~N6AYzs?|wXpQq4wfG4VCk_QmL3~m>9G-(9-Cn4u^AmbU4@RGPNJiyQ|RdFG&*{^ z8XY}dgN~lgprfa2(b3acbo6u`I(j;Xj-Jk=qo)h#=;<2pEcoP(psc{qApKzYP@8Ie29-bZ_;OX%Zo*tjz z>G2tXo=_ps6C?sXK_So+Gy*-LMxZA&2=oMlKu>59=m{2qp3ouC6C46P!6VQU0s=iD zBG3~O0zDxk(i1C0dZI+6Cn`jGqDG`A)`;}P29cg<5b236B0bR}(i1yGdZI(5CwfGB zVnC!PMnrmILZl~VBzjVXL{E}P^dyBuPtr*Aq#B8y)F9E53=%!5MWQEJBzjVZL{D-^ z^dw)NPljca0?PBsP>4wMq=ZCI%EB%)RJ-I=qCmUpXa*Iq) zw#fA44w;_pkm<=DnVuYw>B$k9o}7^B$@%v4(wBEd*gtF@)p{x>?}uH{yj&`-?22}~ z@^rp**Sn(ay!=siMNurub7hYSZjUoQW?yd>hv)iR`<=2`K6qxYM0vKm9=$4qmmYs} zTpk=Z<@mnp?ON)fmK?g-SK}t=R)_kasv4@^?2qb{SIMUHUna@5?^mcDJ&P|x%}%mo~dS-!qBXY{N)GpFYlJF``eby#1}U?za8bS zEen2fn^oB#KNUZ1`tqJ-U0#X2Pi1RZrZenAhxZd@exH};@1{2FYVm*SX2@jR%HTh} C=g$5B literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtoupper.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtoupper.phpt new file mode 100644 index 0000000000000..41bc5e6080643 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtoupper.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test strtoupper on non-ASCII characters +--SKIPIF-- + +--FILE-- + +--EXPECT-- +ÄÖÜ diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtoupper1-win32.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtoupper1-win32.phpt new file mode 100644 index 0000000000000000000000000000000000000000..283492d9dd35c8781848ef66a620d2f85799caf3 GIT binary patch literal 4846 zcmb{0TW=dT0tMiGKEHw$(pF01WO$idQ>W|3N@J{Zf$eU#ivR&{6A4u`f+Qym7W?0q zb7VS-8zj5H>cOTpB-_`@;KG{@u$^ng?Tp?Q)p8}WX=orzuN!fw9U-S?9R_~~I9#p9FH>Gc@y-xe>{{kGqJ zSj8ViI$!#v@ywTR_EHez{N1gqW2vuH@i=b$dcGRc$!*W#_Hw=4Tn#ZG~Dgj&6jEx{}{8v zWO8pL4j+oqz3cDy7R88lMw6iy&-m}meYN~D*x5}=U>D*?@Q`XEjh@=|2l2!PaU>S= zi;G1Rr$=v{u*NlIYOSuoZ z*kN6#NbU~{Dq25Fiz>&GuC=T3L=3BHw^&~-4-UjhTG?!xmKslaaKPCTL#Mm>8q&>a zUU$Q#xNCCf&IA0{OKSVRPdACKi|d%iH(Wp0lb0`ud6#ZNA5S@Y5>HQi@xDJh4e2g( zczC!E8qKDQMK4}HKRZ26OZ<9p*F#^Y6WF)$?(PzNG@S5cxrxiod^>*^Io7yHS8+~d zzu~e^ch}UIwLZH><9eMg-*jULsXOMMrv3pwn_ap?J`icK{xh!ov5&SO9;qSekp_|;SwhkyD@b}|4M~q|AnB1UBt6nX(jy%t zJ<>zcBLgHoGD6ZLJ1BZo0Y#6JQ1mDTMUT=@^e6*Gk1C<)Q56(Ds)nLRHBj`Z7K$Ea zq3BT#iXP>m=urWR9u=YJQ5`frx`3ufOK5tuf~H4nXnM4Prbn01^ymtj9$iDzqZ?>? zbPG+7w$Suw2ThOm(Ddj4O^=Sy^ym(T9#g>3Vk)z|dn#7HlAf|aNlz(J(o-sw^pqMUJ*7cOPgx@U zuTED%S)rt-tWnZaHYn*STa@&a79~BULrG8RQPNWel=PGlB|T+_ik_-KmGh}`K2^@A z%K20|pDO25<$S7~PnGkjaz0hgr^@+MIiD)$Q{{Z>oKKzesdGMc&Zo}#)H$Cz=Tql= z>YPuV^Qm(_H9fUMO;7Dn(^Ci3^wbeGJ#~kMo~A%UPb1OL(>1h>OdRmQ^ zp4OnHr!CRa(^hEdX=}9fv<+H%+7@m0wDhzNZT7VEv;l4QwDhzcEIqb>rN>HGdaQz_ z$7)!5tbwJ+maz2L3YH#Q!_s3LSbA&=OOLg%^jHT=kM&58dg*eo0hS&cVd=3Q96hdp zqsK`&dYpoz$7wivoPndqm2mX93XUFE!_ng!IC@+QM~|~`^f(7ckMnT!xBy3wi*WR~ z4xS!gz|-R;JUw2))8jQfJ>J06<4bsYd<9RBui@$O4Lm)*g{Q|`czV2pr^kDEdVGMV z$47X2e1||!C=log5`mte5a% z0zDxh&=Vp8J)uL)`NW)0%=yHePt5tmoKMX8#GFse`NW)0%=yHePt5tG=asa6Qa&-~ z6LUUY&Zo=ybUB|c=hNkUx|~m!^Xcg6YIHfDF6Yzbe7c-Zm-FdzK3&eIqbFToUwL5q z)5Zw9$HuWq+v(BMqqE<{lcVFbF*-fDxHz4rjnUJe#nH24asDLz@%-=8-NxuSMqfMA z@MwQy%ab<6dynmfNRM|{XD`ypQ;(kE+LrC6;p#oXChZ5rd?~)&46i^I^Ym!`ZOAiK4nsIQ zJNoUb3*gHermOxoX+QDBea@%L>~p&oytM0OdT;TAc)9M=`;=9B?eR9I-C-KeuoWF% ZQ>5|bjo{?ZLmM`>_&;?s>{s$`=0D%l-L?P# literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtoupper1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtoupper1.phpt new file mode 100644 index 0000000000000000000000000000000000000000..9fb7e47f0ea0d8d4d12192407ea70c4900eeea0f GIT binary patch literal 4785 zcmb{0{cjUT8VB(E`TJK)Eh=Kbbmwhfnuazdp+uKbl!W7YLaOGKSPfpwc4({W{`Z^x zI-9yFf;;Ifkxabv@|kC5hkbT7yEs0-n9XpJ)*G?jtTz4ia+y|pQ<1M1VKeU+n9a`r ze)96EF?)6X_|?U;S$lsvg%EL` z_U^BLo-f5Br6?vl6((Za`u=nuUq2~>JUcl(z8&I=2jb(-u$527x(609Vlyu!o!Et-^;x24MK5HnygA4PIXx#vf1bBDG)tk!s5Qoy_(Xgvuyejui`F(Nr z>UjA5?C|uQ1;X~G7~*j+^w*0`(N>(_Ro^eg=5p0vzr7sxXSht^XR++p>$xv+AL8PM ztzSa&#jv503zub6jbU+XaZ{d(VOMQ8>zl=FCQi!cXVbFPIOJ@`)e=Le+w~fvJ4W-i z8*asIlZOxY@n3JL%`bg9A#zTuROUC_Vz-Mo-Vno4voqx6c{)Aq#V`HYX`D>O!NI{U zXmWXcb=8a4Kb)N&l`Vcdx!b9)$^hvtstT(J*UpSZGL zCcaF0+wAbR#S?M->oS#ND-O%ObMzebi!_`oMZn|r_@6J2pO%w(hVteAaxkH)hV!JV zP)QafD#e0ArCHFZ3=0O8Wx=AVS*TGpEHtQE7Ftvt3mq!Qf5&qW9;qPdks6X7X&~v57Lp!WL((G~NP1)oNssIx>5&eS9_b8dUS-QM<-}{bcUhFR50`y2}6%jF!UG=Lys{q^cV|6kEvnkF%1koriG!$ zbTIT72SbnXF!Y!JLyw6t^q2%gkIAs~*b0^&D`Dxe3YH$LVd=33mL6+S{;w`~fvsWb zu?;LewuPm~cChqV2TPCju=LmfOOK7P^wM=g`7@vBKPd&z`9^+Gw@oC2RG-G_4F+R;0pJt3tGsdSG>1h>OdRmQ^p4OnHr?qJ5X=}9f zv<+H%+7>N6ZHJbg)}f`R^=Rp716q38h?brZkXbRHc&T|h@q7tztvC3N(38IB%T!O`O+96e6K z(c?56JHE{H}7LFd*!O`O!96ip%(c=Qjqh7fkT!f>?B{+IqhNs6@ z@bq{IPmfpd^mq+Vk2mo2cneRDui@$O4Lm)*g{Q}N@bq{GPmlNT^!NZzkB{*5_ykXn z&j|E{3W1&=5$FjDfu5id=m`dao?sE^2{i&ep+TT0v2>DI|K5MxrMfBzlrXq9@fz^rQxfp41}IlR6}Nl0%{= z`SN@+Y?~BNo>zuKM4~4pBzjUtrYBd(^kj)lPgcnEWQ|NuHpuj3i%d_hk?F||GCjFP zrYCpE^kj!jPxi?4z=ngiKG)_{0O#UlJp19~<|Ko|eSu@a#wN{P3tGMyDqi z7pKQ1G5Y>naroj$oIfvr{P2(CZDRBTCZ8HLM zxpTcP*Uv9XhV$LsT56}39J<+7V@?D{H2PHfbf>-D zX)lKu5Bb#Jh969"hi", "hi"=>"hello", "a"=>"A", "world"=>"planet"); +var_dump(strtr("# hi all, I said hello world! #", $trans)); +?> +--EXPECT-- +string(32) "# hello All, I sAid hi planet! #" \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_basic.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_basic.phpt new file mode 100644 index 0000000000000..2892ab008231a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_basic.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test strtr() function : basic functionality +--FILE-- + "T", "e" => "E", "st" => "ST"); +$trans2_arr = array('t' => 'T', 'e' => 'E', 'st' => 'ST'); +$heredoc_str = << +--EXPECTF-- +*** Testing strtr() : basic functionality *** +string(10) "TesT sTrTr" +string(10) "TesT sTrTr" +string(10) "TesT sTrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +string(10) "TEST STrTr" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_error.phpt new file mode 100644 index 0000000000000..8466a92011bbc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_error.phpt @@ -0,0 +1,41 @@ +--TEST-- +Test strtr() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing strtr() : error conditions *** + +-- Testing strtr() function with Zero arguments -- +Warning: Wrong parameter count for strtr() in %s on line %d +NULL + +-- Testing strtr() function with less than expected no. of arguments -- +Warning: Wrong parameter count for strtr() in %s on line %d +NULL + +-- Testing strtr() function with more than expected no. of arguments -- +Warning: Wrong parameter count for strtr() in %s on line %d +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation1.phpt new file mode 100644 index 0000000000000..640194fd48e57 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation1.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test strtr() function : usage variations - regular & numeric strings for 'str' argument +--FILE-- + "a", "a" => 1, "2b3c" => "b2c3", "b2c3" => "3c2b"); + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the $str_arr element in $str variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtr() : numeric & regular double quoted strings *** +-- Iteration 1 -- +string(3) "abc" +string(3) "a23" +-- Iteration 2 -- +string(3) "123" +string(3) "1bc" +-- Iteration 3 -- +string(6) "a1b2c3" +string(6) "a1b2c3" +-- Iteration 4 -- +string(3) "abc" +string(3) "a23" +-- Iteration 5 -- +string(3) "123" +string(3) "1bc" +-- Iteration 6 -- +string(6) "a1b2c3" +string(6) "a1b2c3" +-- Iteration 7 -- +string(14) "abc +123 +a1b2c3" +string(14) "a23 +1bc +a1b2c3" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation2.phpt new file mode 100644 index 0000000000000..5772f01fc4ad1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation2.phpt @@ -0,0 +1,90 @@ +--TEST-- +Test strtr() function : usage variations - string containing special chars for 'str' argument +--FILE-- + "%", "%" => "$", "#*&@()" => "()@&*#"); + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the array element in 'str' variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtr() : string containing special chars for 'str' arg *** +-- Iteration 1 -- +string(1) "s" +string(1) "$" +-- Iteration 2 -- +string(3) "pec" +string(3) "#%*" +-- Iteration 3 -- +string(10) "text i als" +string(10) "text & @()" +-- Iteration 4 -- +string(1) "s" +string(1) "$" +-- Iteration 5 -- +string(3) "pec" +string(3) "#%*" +-- Iteration 6 -- +string(10) "text i als" +string(10) "text & @()" +-- Iteration 7 -- +string(17) "s +peci +text i als" +string(17) "$ +#%*& +text & @()" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation3.phpt new file mode 100644 index 0000000000000..fe546dc8ce539 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation3.phpt @@ -0,0 +1,103 @@ +--TEST-- +Test strtr() function : usage variations - string containing escape sequences for 'str' argument +--FILE-- + "t", "\r\n" => "T", "\n\r\t\\" => "TEST"); + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the array element in 'str' variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtr() : string containing escape sequences for 'str' arg *** +-- Iteration 1 -- +string(9) "SesSTsttE" +string(9) " es \stt " +-- Iteration 2 -- +string(12) "TtestTTstrtr" +string(12) "\test\\strtr" +-- Iteration 3 -- +string(12) "TtestETstrtr" +string(11) "ttestTstrtr" +-- Iteration 4 -- +string(9) "$variable" +string(9) "$variable" +-- Iteration 5 -- +string(7) ""quotes" +string(7) ""quotes" +-- Iteration 6 -- +string(12) "TtesTtTsttTr" +string(12) "\tes\t\stt\r" +-- Iteration 7 -- +string(12) "TtestTTstrtr" +string(12) "\test\\strtr" +-- Iteration 8 -- +string(15) "TntestTrTnstrtr" +string(15) "\ntest\r\nstrtr" +-- Iteration 9 -- +string(10) "T$variable" +string(10) "\$variable" +-- Iteration 10 -- +string(8) "T"quotes" +string(8) "\"quotes" +-- Iteration 11 -- +string(54) "SesSTsttETTtestTTstrtrTTtestETstrtrT$variableTT"quotes" +string(52) " es \sttT\test\\strtrtttestTstrtrt$variablet\"quotes" +*** Done *** \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation4.phpt new file mode 100644 index 0000000000000..faec849830c3e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation4.phpt @@ -0,0 +1,79 @@ +--TEST-- +Test strtr() function : usage variations - empty string & null for 'str' argument +--FILE-- + "t", '' => "TEST"); + + +/* loop through to test strtr() with each element of $str_arr */ +for($index = 0; $index < count($str_arr); $index++) { + echo "-- Iteration $count --\n"; + + $str = $str_arr[$index]; //getting the array element in 'str' variable + + //strtr() call in three args syntax form + var_dump( strtr($str, $from, $to) ); + + //strtr() call in two args syntax form + var_dump( strtr($str, $replace_pairs) ); + + $count++; +} +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtr() : empty string & null for 'str' arg *** +-- Iteration 1 -- +string(0) "" +string(0) "" +-- Iteration 2 -- +string(0) "" +string(0) "" +-- Iteration 3 -- +string(0) "" +string(0) "" +-- Iteration 4 -- +string(0) "" +string(0) "" +-- Iteration 5 -- +string(0) "" +string(0) "" +-- Iteration 6 -- +string(0) "" +string(0) "" +-- Iteration 7 -- +string(0) "" +string(0) "" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation5.phpt new file mode 100644 index 0000000000000..7bd1704734a1d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation5.phpt @@ -0,0 +1,137 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for 'str' argument +--FILE-- + +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for 'str' *** +-- Iteration 1 -- +string(1) "a" +-- Iteration 2 -- +string(1) "t" +-- Iteration 3 -- +string(2) "-m" +-- Iteration 4 -- +string(4) "ta.5" +-- Iteration 5 -- +string(5) "-ma.5" +-- Iteration 6 -- +string(12) "ta5aaaaaaaaa" +-- Iteration 7 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Arr0y" +-- Iteration 8 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Arr0y" +-- Iteration 9 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Arr0y" +-- Iteration 10 -- +string(1) "t" +-- Iteration 11 -- +string(0) "" +-- Iteration 12 -- +string(1) "t" +-- Iteration 13 -- +string(0) "" +-- Iteration 14 -- +string(0) "" +-- Iteration 15 -- +string(0) "" +-- Iteration 16 -- +string(13) "s02ple objec1" +-- Iteration 17 -- +string(%d) "Resource id #%d" +-- Iteration 18 -- +string(0) "" +-- Iteration 19 -- +string(0) "" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation6.phpt new file mode 100644 index 0000000000000..2d8ab7183137d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation6.phpt @@ -0,0 +1,137 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for 'from' argument +--FILE-- + +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for 'from' *** +-- Iteration 1 -- +string(6) "a12atm" +-- Iteration 2 -- +string(6) "0a2atm" +-- Iteration 3 -- +string(6) "01tatm" +-- Iteration 4 -- +string(6) "ta2atm" +-- Iteration 5 -- +string(6) "m1tatm" +-- Iteration 6 -- +string(6) "2a2atm" +-- Iteration 7 -- + +Notice: Array to string conversion in %s on line %d +string(6) "0120tm" +-- Iteration 8 -- + +Notice: Array to string conversion in %s on line %d +string(6) "0120tm" +-- Iteration 9 -- + +Notice: Array to string conversion in %s on line %d +string(6) "0120tm" +-- Iteration 10 -- +string(6) "0a2atm" +-- Iteration 11 -- +string(6) "012atm" +-- Iteration 12 -- +string(6) "0a2atm" +-- Iteration 13 -- +string(6) "012atm" +-- Iteration 14 -- +string(6) "012atm" +-- Iteration 15 -- +string(6) "012atm" +-- Iteration 16 -- +string(6) "012ttm" +-- Iteration 17 -- +string(6) "012atm" +-- Iteration 18 -- +string(6) "012atm" +-- Iteration 19 -- +string(6) "012atm" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation7.phpt new file mode 100644 index 0000000000000..04b742f31219e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation7.phpt @@ -0,0 +1,156 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for 'to' argument +--FILE-- + +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for 'to' *** + +-- Iteration 1 -- +string(6) "0120tm" + +-- Iteration 2 -- +string(6) "0121tm" + +-- Iteration 3 -- +string(6) "012-2m" + +-- Iteration 4 -- +string(6) "51210." + +-- Iteration 5 -- +string(6) ".52-20" + +-- Iteration 6 -- +string(6) "000105" + +-- Iteration 7 -- + +Notice: Array to string conversion in %s on line %d +string(6) "ay2Arr" + +-- Iteration 8 -- + +Notice: Array to string conversion in %s on line %d +string(6) "ay2Arr" + +-- Iteration 9 -- + +Notice: Array to string conversion in %s on line %d +string(6) "ay2Arr" + +-- Iteration 10 -- +string(6) "0121tm" + +-- Iteration 11 -- +string(6) "012atm" + +-- Iteration 12 -- +string(6) "0121tm" + +-- Iteration 13 -- +string(6) "012atm" + +-- Iteration 14 -- +string(6) "012atm" + +-- Iteration 15 -- +string(6) "012atm" + +-- Iteration 16 -- +string(6) "plesam" + +-- Iteration 17 -- +string(6) "ourRes" + +-- Iteration 18 -- +string(6) "012atm" + +-- Iteration 19 -- +string(6) "012atm" +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation8.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation8.phpt new file mode 100644 index 0000000000000..4d2b42b02b46d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation8.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for 'replace_pairs' argument +--FILE-- + +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for 'replace_pairs' *** + +-- Iteration 1 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 2 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 3 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 4 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 5 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 6 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 7 -- +string(6) "012atm" + +-- Iteration 8 -- +string(6) "012atm" + +-- Iteration 9 -- +string(6) "122atm" + +-- Iteration 10 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 12 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 13 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 14 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 15 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 16 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 17 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 18 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 19 -- + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation9.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation9.phpt new file mode 100644 index 0000000000000..0f5875c723ae0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strtr_variation9.phpt @@ -0,0 +1,243 @@ +--TEST-- +Test strtr() function : usage variations - unexpected inputs for all arguments +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // null vlaues + NULL, + null, + + // objects + new sample(), + + // resource + $file_handle, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop through with each element of the $values array to test strtr() function +$count = 1; +for($index = 0; $index < count($values); $index++) { + echo "\n-- Iteration $count --\n"; + var_dump( strtr($values[$index], $values[$index], $values[$index]) ); //fn call with three args + var_dump( strtr($values[$index], $values[$index]) ); //fn call with two args + $count ++; +} + +fclose($file_handle); //closing the file handle + +echo "*** Done ***"; +?> +--EXPECTF-- +*** Testing strtr() function: with unexpected inputs for all arguments *** + +-- Iteration 1 -- +string(1) "0" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 2 -- +string(1) "1" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 3 -- +string(2) "-2" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 4 -- +string(4) "10.5" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 5 -- +string(5) "-20.5" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 6 -- +string(12) "105000000000" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 7 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 8 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 9 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + +-- Iteration 12 -- +string(1) "1" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 13 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 14 -- +string(1) "1" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 15 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 16 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 17 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 18 -- +string(13) "sample object" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 19 -- +string(%d) "Resource id #%d" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 20 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) + +-- Iteration 21 -- +string(0) "" + +Warning: strtr(): The second argument is not an array in %s on line %d +bool(false) +*** Done *** diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/strval.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strval.phpt new file mode 100644 index 0000000000000..3f8b5cc985d1b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/strval.phpt @@ -0,0 +1,24 @@ +--TEST-- +strval() function +--FILE-- + +--EXPECT-- +string(3) "bar" +string(3) "BAR" +string(6) "foobar" +string(1) "1" +string(3) "1.1" +string(1) "1" +string(0) "" +string(5) "Array" diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr.phpt new file mode 100644 index 0000000000000000000000000000000000000000..b43244e4c8ebcbc550ed3bb6f20d170435805da1 GIT binary patch literal 4536 zcmeHLO>f&q5Y3stVn8H_q==3!+bLit4vNMB3>ZaFyG_x$FjmycB0w#LC1qO<`d^A3 zdg-Y^554P;_04`z5+zDV=TxejV(<$! z18UJbna4UAv4tc0P8MUWaw-OrMw#YK%KD|Uk&KgmB74-G7!jkCgzAx1Nh6`fP!>|> zJJ9_y2%cKE@@t{Bn9v(Ce;f4e_vhzr3d1(-b@mSq@hG}+Pxi49Vh0O;x^|Dvm}4@gSqH)oRgt$yV!1h0qBEf08<*ul3D%D1j1m+zNf&8xKc~ zSq9iVMA>H&`Fd#h9)M?Xxn+~j%r*Sq`NGlS!cN_qIDdGV&D%k}#ywjvl z0TBQLl!>s(xl4)x6?fU3OTgMl*&>4LW0})Qn_ioOdPBQ}AFd%Hlh;OgrJ^XJGx%Y& zQn=&&+6f7-kW>J_AWlEbeBi2CbYXVHXB|Mfi^q|mI!*k#8{D!FZ+O#Qfh(w#z>~6LMkxiB$ve8n+)x04nmf6Lv zFeOx%Zx(XaP-wpVUc5LCelya6`zlrD zkJM?p9HN=U;!4}yaWa?ORp=U_2z|iUF>bYQt%yMzx*$0m6%$VqcLS*`+fYxctiYwV zY?7NkOk+GfQgy!@R(6eozCZK+Zun!QB z>ud<F-4{{aa0cOOuD`A9(&pJ#V}FV@MWoyvvki z4t;xq!Q}ME52xQ;zQ=4*MQNF)Tdg4YD6|4M9??ggVb&?f2Jks}hPYFg^G~Aa8A@MK znkY%ndI3}H|0?FOSfs^0=E4A3S>l2P{)J38%hE<)q`7R?KCjZV#3{9>x3Tb88F(~5 z1$6#f;qGr8u5C~aG`f&y>@aW}huAO^WVwST6tci}xpr#M4_I%h1Uwy<3(QSnr(Cfp zESBp9Q8vCell8thD+{7_QOWAl$+lvj@h zWd#IZ!D0Vd`o*x+-id0cyoS})81e;Ym&&(W08^#uFBmdC3Vh{f +--EXPECTF-- +int(0) +int(0) +int(0) +int(1) +int(-1) + +Warning: substr_compare(): The length cannot exceed initial string length in %s on line %d +bool(false) + +Warning: substr_compare() expects parameter 5 to be boolean, object given in %s on line %d +bool(false) +Test + +Warning: substr_compare(): The length must be greater than zero in %s on line %d +bool(false) + +Warning: substr_compare() expects parameter 4 to be long, string given in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_basic.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_basic.phpt new file mode 100644 index 0000000000000..f880e9481e796 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_basic.phpt @@ -0,0 +1,33 @@ +--TEST-- +Test substr_count() function (basic) +--FILE-- + +--EXPECTF-- +***Testing basic operations *** +bool(false) +bool(false) +int(0) +int(0) +int(0) +int(100) +int(200) +int(160) +int(10) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_error.phpt new file mode 100644 index 0000000000000..f8284c3a1da9c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_error.phpt @@ -0,0 +1,65 @@ +--TEST-- +Test substr_count() function (error conditions) +--FILE-- + size of the string */ +var_dump(substr_count($str, "t", 25)); + +/* Using offset and length to go beyond the size of the string: + Warning message expected, as length+offset > length of string */ +var_dump( substr_count($str, "i", 5, 15) ); + +/* length as Null */ +var_dump( substr_count($str, "t", "", "") ); +var_dump( substr_count($str, "i", NULL, NULL) ); + +echo "Done\n"; + +?> +--EXPECTF-- +*** Testing error conditions *** + +Warning: Wrong parameter count for substr_count() in %s on line %d +NULL + +Notice: Undefined variable: str in %s on line %d + +Warning: Wrong parameter count for substr_count() in %s on line %d +NULL + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset should be greater than or equal to 0 in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset value 25 exceeds string length in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Offset value 5 exceeds string length in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Length should be greater than 0 in %s on line %d +bool(false) + +Notice: Undefined variable: str in %s on line %d + +Warning: substr_count(): Length should be greater than 0 in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_variation_001.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_variation_001.phpt new file mode 100644 index 0000000000000..cb6fc6bd3ede6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_variation_001.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test substr_count() function (variation - 1) +--FILE-- + +--EXPECTF-- +*** Testing possible variations *** +-- 3rd or 4th arg as string -- +int(1) +int(1) +int(2) +int(2) + +-- 3rd or 4th arg as NULL -- +int(2) +int(0) +int(2) +int(0) +int(2) + +-- overlapped substrings -- +int(2) +int(2) + +-- complex strings containing other than 7-bit chars -- +int(2) +int(2) +int(1) + +-- heredoc string -- +int(14) +int(16) + +-- heredoc null string -- +int(0) +int(0) +int(0) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_variation_002.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_variation_002.phpt new file mode 100644 index 0000000000000..f8b62bd837cd2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_count_variation_002.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test substr_count() function (variation - 2) +--FILE-- + +--EXPECTF-- +*** Testing possible variations *** + +-- complex strings containing other than 7-bit chars -- +int(2) +int(2) +int(1) + +-- heredoc string -- +int(14) +int(16) + +-- heredoc null string -- +int(0) +int(0) +int(0) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_replace.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_replace.phpt new file mode 100644 index 0000000000000..27620de9644b1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/substr_replace.phpt @@ -0,0 +1,810 @@ +--TEST-- +substr_replace() function +--FILE-- + +--EXPECT-- +substr_replace('try this', 'bala ', 2) +string(7) "trbala " + +substr_replace('try this', 'bala ', 2, 3) +string(10) "trbala his" + +substr_replace('try this', 'bala ', 2, 0) +string(13) "trbala y this" + +substr_replace('try this', 'bala ', 2, -2) +string(9) "trbala is" + + + +substr_replace('try this', array ( 0 => 'bala ',), 4 +string(9) "try bala " + +substr_replace('try this', array ( 0 => 'bala ',), 4 +string(10) "try bala s" + + + + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,) +array(1) { + [0]=> + string(9) "ala bala " +} + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => 3,)) +array(1) { + [0]=> + string(15) "ala bala tokala" +} + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => 0,)) +array(1) { + [0]=> + string(18) "ala bala portokala" +} + +substr_replace(array ( 0 => 'ala portokala',), array ( 0 => 'bala ',), array ( 0 => 4,), array ( 0 => -2,)) +array(1) { + [0]=> + string(11) "ala bala la" +} + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',4) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(5) "try s" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(10) "try bala s" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "try bala this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),4, -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(6) "try is" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',4, -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(11) "try bala is" +} + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(5) " this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(10) "bala this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "bala try this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(2) "is" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(7) "bala is" +} + + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(5) "trhis" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), 3) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(10) "trbala his" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), 0) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "trbala y this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(4) "tris" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), -2) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(9) "trbala is" +} + + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 3,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(2) "tr" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 3,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(7) "trbala " +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(2) "tr" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(7) "trbala " +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => -2,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(2) "tr" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => -2,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(7) "trbala " +} + + + + + + + +substr_replace(array ( 0 => 'ala portokala',), 'bala ',array ( 0 => 4, 1 => 2,)) +array(1) { + [0]=> + string(9) "ala bala " +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 3, 1 => 2,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(6) "trthis" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 3, 1 => 2,)) +array(2) { + [0]=> + string(15) "ala bala tokala" + [1]=> + string(11) "trbala this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => 0, 1 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(8) "try this" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => 0, 1 => 0,)) +array(2) { + [0]=> + string(18) "ala bala portokala" + [1]=> + string(13) "trbala y this" +} + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), array ( 0 => 'bala ',),array ( 0 => 4, 1 => 2,), array ( 0 => -2, 1 => -3,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(5) "trhis" +} + + +substr_replace(array ( 0 => 'ala portokala', 1 => 'try this',), 'bala ',array ( 0 => 4, 1 => 2,), array ( 0 => -2, 1 => -3,)) +array(2) { + [0]=> + string(11) "ala bala la" + [1]=> + string(10) "trbala his" +} + diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/trim.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/trim.phpt new file mode 100644 index 0000000000000..a69f17c6d7ad4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/trim.phpt @@ -0,0 +1,27 @@ +--TEST-- +trim(), rtrim() and ltrim() functions +--FILE-- +4$oju2C zVgl)7AEMaax!s-F*=w~1y^BGsB?dCLWKEoIHR!rfp^dc?t=8$svmT<|<7}D<;Wz2r zXshjgCJ!kGTusVD)eFAS_w89EoCYR|bNhoDf|_&zd`7p^*vdQ$LP=ZNkhW84h><~P zrO8p<=#=o4#&QxX#U%n2k;G45Q!uOa3K@OZ5jRb@v7J((a%p{4B#A%PI+1~*UxA5( zaU!WjMp^)ni)5PF`>JDPk>OO6H&ot{*x=J6oT9h%UyhS*IzhPeD%13KB$G;#rr2h7$MXG{}u3 zXF+QOyrIRgY&B+Yn>^1Euj7c8kwn06;`|m&XJ`64hQaHBd>9VH|iQj@K zE5=D2&NrGyBdd82)dYLa0CIa_6nTAD5hf;j5D#Jl9l(4_-p)3q^VoxcfKA_)o?sqj z?s6R^^ot@W$*kF2t48ODJacMBt)`2P8DHy{{@cDvnP|3nnIVCOBv1R_V`>He3|^Lf;o=0cFG$cKEX&04B7 zInhc&`{Q@GbbDXVG1pVvy8=geR_z8%v+|{bNP8Ztz3n3Sa%q999GwG%h?aub*?D-s zev*S?-OdSd6&NOWNLNNf#thebDsiu4i3{9G*H~x1uVKDe(PmCsQ4%Xjn~`9b{0|8h yN!Hh_(q|9y@VeAAS#Rbl!Ojjcz`rk?d0(^_oVzOLV}n(RI-F?Ht~kzK5`O?3$a=K^ literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucfirst.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucfirst.phpt new file mode 100644 index 0000000000000000000000000000000000000000..eebc4cc9c75ec53f86b4191e3039094e38a5084d GIT binary patch literal 6055 zcmeHLSyS6c5Z+hxD;jawW-(YmE|shU(ZOg z3{v1BRoRE=fn=tS`Fgsi54YP#-NU1H+p<%)??-XcY}wRLLpSkNXtmp~_FsWGilpnu z*m>k^Ve`eSy)Jfl9*+hiYkh@Yi*reW;w19Jvqnr>5xD~q2{(}urK6FIToFrJS+^|d z4iwo7_~@yKeV0V&(LW;cRT`55r{J?=Vvdv0erPR1@u`R+F`-AK|7}`xbA-=MWSrnk z%D}JLs}^M>XYC3Rw2U<9?(H4W_~6an^J246+H62e#b=*%?A5us^>x}$gMeyyE;~8b zOL?g|>lwjWO%y%X%g*vt+6yFoPE{hk?2api8kdtV4TCSno!m;sxXcKR{bZoh#GDjY z9$~jPYY?|Lt1W4?H`g||wrXzF5UVBk-|p>IQ*0*H;IQkiv{S9?=*`=%F~6r&K*?kz zt1V~7x-*>`f>V8_v$laN+1je6zId{C*sUhnnpSg|O|=C5RH{`rdb1(JkGApx8YfA{ zDPvcRB*pS`DnnP+M9N802gli{rzB$;T*xf){V<_F^N82)o$$BykW)^e)QA#A{Kjdl zqI1pys-GtU;$SAv@AqXSq2@vasf;=O^i?E)T+LGU*FhuWz$6leY=4JGoMM{ssu;aV|7oV^5ruM`fqrOBy^>d1yToj>->UucM#d_Q@W=|! zEcSf_m>5b2abhD%hm*DBGU51P3h(w&M8oEk5n(g7+4r*_>X?hSpz9}tWpRt&7Tm5k zqwH{<6`?iKEHps9Ml|3pWsio>gv@Eqf67_ZobSN0jB5j2O+4vVJ*&aTxJ=-%D{-Gv z3=ITC4-{yO#nA{BM2BtIY{Lg=#WTn+JQu)S;|;*d0@gqUUX1od=LoF~hcr9rgMOfA zL;I}n1}dJKI(xqrD>e-hd5H3jmwjlZVc>`7O?&FQ3cr=~LZ2rCi6l6qraG1cl4f{@ zc8vS20rH}!+$=(;(N%=+&dyHv;JL+(i0q#Y{7>h>FjS+@Xc5zkF)MepX9@C`8;SY$0rVldZPxnG@8U+*T zVIq_9>Q&U$7`_6;x4M(QGQ^BpbVKZeeKbR;#<{CnMQ*ufO3sq?IS8zB8PuJXZZ^0a zc>Z)KM6JUu{wpJezUM3*qQTRxU9JymK!1%!4~+nt1bI0^a|2AFTI2i3QTs&yGE;Q+9JJ{A`PZV_;AES$m~G8yFO4BNWQR?7$%9bdZqJI$bjZ0-7C~qn z3)3@?&K!3`M^tFre86~rcS1Kcf +--EXPECTF-- +*** Testing ucwords() : basic functionality *** +-- Iteration 1 -- +string(15) "Testing Ucwords" +-- Iteration 2 -- +string(15) "Testing Ucwords" +-- Iteration 3 -- +string(16) "Testing\tucwords" +-- Iteration 4 -- +string(15) "Testing Ucwords" +-- Iteration 5 -- +string(15) "Testing +Ucwords" +-- Iteration 6 -- +string(16) "Testing\nucwords" +-- Iteration 7 -- +string(15) "Testing Ucwords" +-- Iteration 8 -- +string(16) "Testing\vucwords" +-- Iteration 9 -- +string(7) "Testing" +-- Iteration 10 -- +string(7) "Testing" +-- Iteration 11 -- +string(8) " Testing" +-- Iteration 12 -- +string(8) " Testing" +-- Iteration 13 -- +string(16) "Testing Ucwords" +-- Iteration 14 -- +string(16) "Testing Ucwords" +-- Iteration 15 -- +string(16) "Testing\rucwords" +-- Iteration 16 -- +string(15) "Testing Ucwords" +-- Iteration 17 -- +string(16) "Testing\fucwords" +-- Iteration 18 -- +string(15) "Testing Ucwords" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_error.phpt new file mode 100644 index 0000000000000..cd6e7513c3d0f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_error.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test ucwords() function : error conditions +--INI-- +--FILE-- + +--EXPECTF-- +*** Testing ucwords() : error conditions *** + +-- Testing ucwords() function with Zero arguments -- + +Warning: Wrong parameter count for ucwords() in %s on line %d +NULL + +-- Testing ucwords() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for ucwords() in %s on line %d +NULL +string(10) "string_val" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation1.phpt new file mode 100644 index 0000000000000..2a3ceeeb80025 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation1.phpt @@ -0,0 +1,199 @@ +--TEST-- +Test ucwords() function : usage variations - unexpected input values +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new my(), + + // empty string + "", + '', + + //NULL + NULL, + null, + + // hex in string + "0x123", + '0x123', + "0xFF12", + "-0xFF12", + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var, + + // resource variable + $fp +); + +// loop through each element of the array and check the working of ucwords() +// when $str arugment is supplied with different values +echo "\n--- Testing ucwords() by supplying different values for 'str' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str = $values [$index]; + + var_dump( ucwords($str) ); + + $counter ++; +} + +// close the file handle +fclose($fp); +echo "Done\n"; +?> +--EXPECTF-- +*** Testing ucwords() : usage variations *** + +--- Testing ucwords() by supplying different values for 'str' argument --- +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +-- Iteration 4 -- +string(5) "-2345" +-- Iteration 5 -- +string(2) "16" +-- Iteration 6 -- +string(2) "32" +-- Iteration 7 -- +string(3) "170" +-- Iteration 8 -- +string(4) "-245" +-- Iteration 9 -- +string(2) "83" +-- Iteration 10 -- +string(4) "-226" +-- Iteration 11 -- +string(4) "10.5" +-- Iteration 12 -- +string(5) "-10.5" +-- Iteration 13 -- +string(12) "105000000000" +-- Iteration 14 -- +string(7) "1.06E-9" +-- Iteration 15 -- +string(3) "0.5" +-- Iteration 16 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 17 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 18 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 19 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 20 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" +-- Iteration 21 -- +string(1) "1" +-- Iteration 22 -- +string(0) "" +-- Iteration 23 -- +string(1) "1" +-- Iteration 24 -- +string(0) "" +-- Iteration 25 -- +string(8) "MyString" +-- Iteration 26 -- +string(0) "" +-- Iteration 27 -- +string(0) "" +-- Iteration 28 -- +string(0) "" +-- Iteration 29 -- +string(0) "" +-- Iteration 30 -- +string(5) "0x123" +-- Iteration 31 -- +string(5) "0x123" +-- Iteration 32 -- +string(6) "0xFF12" +-- Iteration 33 -- +string(7) "-0xFF12" +-- Iteration 34 -- +string(0) "" +-- Iteration 35 -- +string(0) "" +-- Iteration 36 -- +string(%d) "Resource Id #%d" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation2.phpt new file mode 100644 index 0000000000000..ab6eb2f45c84b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation2.phpt @@ -0,0 +1,96 @@ +--TEST-- +Test ucwords() function : usage variations - heredoc strings +--FILE-- + +--EXPECTF-- +*** Testing ucwords() : usage variations *** +-- Iteration 1 -- +string(0) "" +-- Iteration 2 -- +string(0) "" +-- Iteration 3 -- +string(52) "Testing Ucword() With +Multiline String Using +Heredoc" +-- Iteration 4 -- +string(93) "Testing Ucword(str) With +Multiline String Using +Heredoc +String.with Different White Spaces" +-- Iteration 5 -- +string(53) "12sting 123string 4567 +String 123string 12 Test +5test" +-- Iteration 6 -- +string(108) "It's Bright,but I Cann't See It. +"things In Double Quote" +'things In Single Quote' +This\line Is /with\slashs" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation3.phpt new file mode 100644 index 0000000000000..e6f7c405ace47 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation3.phpt @@ -0,0 +1,97 @@ +--TEST-- +Test ucwords() function : usage variations - single quoted string +--FILE-- + +--EXPECTF-- +*** Testing ucwords() : usage variations *** +-- Iteration 1 -- +string(18) "Testing Ucwords" +-- Iteration 2 -- +string(30) "T E S T I N G U C W O R D S " +-- Iteration 3 -- +string(25) "Testing Function(ucwords)" +-- Iteration 4 -- +string(38) "(testing ( Function (ucwords) )a )test" +-- Iteration 5 -- +string(3) "(t)" +-- Iteration 6 -- +string(7) " ( T )t" +-- Iteration 7 -- +string(23) ""testing",ucword,"test"" +-- Iteration 8 -- +string(14) ""t""t",test, T" +-- Iteration 9 -- +string(11) "'t 't',test" +-- Iteration 10 -- +string(27) "\ttesting\ttesting\tucwords" +-- Iteration 11 -- +string(32) "Testing\rucwords Testing Ucwords" +-- Iteration 12 -- +string(37) "Testing\fucwords \f Testing \nucwords" +-- Iteration 13 -- +string(39) "\ntesting\nucwords\n Testing \n Ucwords" +-- Iteration 14 -- +string(20) "Using\vvertical\vtab" +-- Iteration 15 -- +string(42) "T@@#$% %test ^test &test *test +test -test" +-- Iteration 16 -- +string(40) "!test ~test `test` =test= @test@test.com" +-- Iteration 17 -- +string(40) "/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/" +-- Iteration 18 -- +string(16) "!@#$%^&*()_+=-`~" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation4.phpt new file mode 100644 index 0000000000000..bed65508224dc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/ucwords_variation4.phpt @@ -0,0 +1,124 @@ +--TEST-- +Test ucwords() function : usage variations - double quoted string +--FILE-- + +--EXPECTF-- +*** Testing ucwords() : usage variations *** +-- Iteration 1 -- +string(18) "Testing Ucwords" +-- Iteration 2 -- +string(30) "T E S T I N G U C W O R D S " +-- Iteration 3 -- +string(25) "Testing Function(ucwords)" +-- Iteration 4 -- +string(38) "(testing ( Function (ucwords) )a )test" +-- Iteration 5 -- +string(3) "(t)" +-- Iteration 6 -- +string(7) " ( T )t" +-- Iteration 7 -- +string(24) ""testing",ucwords,"test"" +-- Iteration 8 -- +string(14) ""t""t",test, T" +-- Iteration 9 -- +string(14) "\'t \'t\',test" +-- Iteration 10 -- +string(10) "Jack's Pen" +-- Iteration 11 -- +string(14) "P't'y 't It's " +-- Iteration 12 -- +string(24) " Testing Testing Ucwords" +-- Iteration 13 -- +string(26) "\ttesting\ttesting Ucwords" +-- Iteration 14 -- +string(31) "Testing Ucwords Testing Ucwords" +-- Iteration 15 -- +string(32) "Testing\rucwords Testing Ucwords" +-- Iteration 16 -- +string(34) "Testing Ucwords Testing +Ucwords" +-- Iteration 17 -- +string(36) "Testing\fucwords \f Testing +Ucwords" +-- Iteration 18 -- +string(35) " +Testing +Ucwords + Testing + Ucwords" +-- Iteration 19 -- +string(39) "\ntesting\nucwords\n Testing \n Ucwords" +-- Iteration 20 -- +string(18) "Using Vertical Tab" +-- Iteration 21 -- +string(20) "Using\vvertical\vtab" +-- Iteration 22 -- +string(42) "T@@#$% %test ^test &test *test +test -test" +-- Iteration 23 -- +string(40) "!test ~test `test` =test= @test@test.com" +-- Iteration 24 -- +string(37) "/test/r Est\ucwords \y\y\u \yy\ /uu/" +-- Iteration 25 -- +string(16) "!@#$%^&*()_+=-`~" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/unpack.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/unpack.phpt new file mode 100644 index 0000000000000..26f3f2eaf974d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/unpack.phpt @@ -0,0 +1,11 @@ +--TEST-- +Invalid format type validation +--FILE-- + +--EXPECTF-- +Warning: unpack(): Invalid format type - in %sunpack.php on line %d +bool(false) +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/url_t.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/url_t.phpt new file mode 100644 index 0000000000000..e0e54110364ef --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/url_t.phpt @@ -0,0 +1,712 @@ +--TEST-- +parse_url() function +--FILE-- + +--EXPECT-- +array(1) { + ["path"]=> + string(0) "" +} +array(1) { + ["path"]=> + string(12) "64.246.30.37" +} +array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(12) "64.246.30.37" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(12) "64.246.30.37" + ["path"]=> + string(1) "/" +} +array(1) { + ["path"]=> + string(13) "64.246.30.37/" +} +array(3) { + ["host"]=> + string(12) "64.246.30.37" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} +array(1) { + ["path"]=> + string(7) "php.net" +} +array(1) { + ["path"]=> + string(8) "php.net/" +} +array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "php.net" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "php.net" + ["path"]=> + string(1) "/" +} +array(1) { + ["path"]=> + string(11) "www.php.net" +} +array(1) { + ["path"]=> + string(12) "www.php.net/" +} +array(2) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" +} +array(2) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" +} +array(1) { + ["path"]=> + string(12) "www.php.net/" +} +array(3) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(18) "/foo/bar/index.php" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" + ["query"]=> + string(37) "lots=1&of=2¶meters=3&too=4&here=5" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(45) "/this/is/a/very/deep/directory/structure/and/" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(53) "/this/is/a/very/deep/directory/structure/and/file.php" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(28) "/this/../a/../deep/directory" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(29) "/this/../a/../deep/directory/" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(42) "/this/is/a/very/deep/directory/../file.php" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["fragment"]=> + string(3) "foo" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(6) "test=1" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(1) "/" + ["query"]=> + string(7) "test=1&" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(1) "/" + ["query"]=> + string(1) "&" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(7) "test=1&" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(1) "&" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(4) "foo&" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(4) "&foo" +} +array(5) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" +} +array(5) { + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["user"]=> + string(6) "secret" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(14) "secret@hideout" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(8) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(11) "www.php.net" + ["port"]=> + int(80) + ["user"]=> + string(6) "secret" + ["pass"]=> + string(7) "hid:out" + ["path"]=> + string(10) "/index.php" + ["query"]=> + string(31) "test=1&test2=char&test3=mixesCI" + ["fragment"]=> + string(16) "some_page_ref123" +} +array(2) { + ["scheme"]=> + string(4) "nntp" + ["host"]=> + string(12) "news.php.net" +} +array(3) { + ["scheme"]=> + string(3) "ftp" + ["host"]=> + string(11) "ftp.gnu.org" + ["path"]=> + string(22) "/gnu/glic/glibc.tar.gz" +} +array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(14) "http://foo@bar" +} +array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(12) "filename.txt" +} +array(2) { + ["scheme"]=> + string(4) "zlib" + ["path"]=> + string(25) "/path/to/my/file/file.txt" +} +array(3) { + ["scheme"]=> + string(3) "foo" + ["host"]=> + string(3) "bar" + ["user"]=> + string(3) "foo" +} +array(2) { + ["scheme"]=> + string(6) "mailto" + ["path"]=> + string(15) "me@mydomain.com" +} +array(2) { + ["path"]=> + string(8) "/foo.php" + ["query"]=> + string(7) "a=b&c=d" +} +array(2) { + ["path"]=> + string(7) "foo.php" + ["query"]=> + string(7) "a=b&c=d" +} +array(6) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(15) "www.example.com" + ["port"]=> + int(8080) + ["user"]=> + string(4) "user" + ["pass"]=> + string(6) "passwd" + ["query"]=> + string(12) "bar=1&boom=0" +} +array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} +array(3) { + ["scheme"]=> + string(4) "file" + ["host"]=> + string(4) "path" + ["path"]=> + string(8) "/to/file" +} +array(2) { + ["scheme"]=> + string(4) "file" + ["path"]=> + string(13) "/path/to/file" +} +array(4) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "1.2.3.4" + ["path"]=> + string(8) "/abc.asp" + ["query"]=> + string(7) "a=1&b=2" +} +array(3) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(7) "foo.com" + ["fragment"]=> + string(3) "bar" +} +array(1) { + ["scheme"]=> + string(6) "scheme" +} +array(4) { + ["scheme"]=> + string(7) "foo+bar" + ["host"]=> + string(4) "bang" + ["user"]=> + string(3) "baz" + ["path"]=> + string(4) "/bla" +} +array(2) { + ["scheme"]=> + string(2) "gg" + ["path"]=> + string(7) "9130731" +} +array(7) { + ["scheme"]=> + string(4) "http" + ["host"]=> + string(4) "host" + ["user"]=> + string(4) "user" + ["pass"]=> + string(5) "@pass" + ["path"]=> + string(5) "/path" + ["query"]=> + string(14) "argument?value" + ["fragment"]=> + string(3) "etc" +} +string(4) "http" +string(11) "www.php.net" +int(80) +string(6) "secret" +string(7) "hideout" +string(10) "/index.php" +string(31) "test=1&test2=char&test3=mixesCI" +string(16) "some_page_ref123" diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/uuencode.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/uuencode.phpt new file mode 100644 index 0000000000000..3671cd736ce88 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/uuencode.phpt @@ -0,0 +1,40 @@ +--TEST-- +uuencode family tests +--FILE-- + +--EXPECTF-- +Warning: convert_uuencode() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Warning: convert_uudecode() expects parameter 1 to be string, array given in %s on line %d +bool(false) +bool(false) +bool(false) +string(60) "J?B%`(R0E7B8J*"E??7M03TE5651215=145-$1D=(2DM,.CQ-3D)60UA: +` +" +string(1) "%s" +string(42) "~!@#$%^&*()_}{POIUYTREWQQSDFGHJKL: +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using string format *** +string(3) "one" +string(7) "one two" +string(13) "one two three" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic2.phpt new file mode 100644 index 0000000000000..3e78aab7617bf --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic2.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test vsprintf() function : basic functionality - integer format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using integer format *** +string(3) "111" +string(7) "111 222" +string(11) "111 222 333" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic3.phpt new file mode 100644 index 0000000000000..bbb6a3267cf31 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic3.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test vsprintf() function : basic functionality - float format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using float format *** +string(9) "11.110000" +string(9) "11.110000" +string(19) "11.110000 22.220000" +string(19) "11.110000 22.220000" +string(29) "11.110000 22.220000 33.330000" +string(29) "11.110000 22.220000 33.330000" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic4.phpt new file mode 100644 index 0000000000000..a82df93ad358a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic4.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test vsprintf() function : basic functionality - bool format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using bool format *** +string(1) "1" +string(3) "1 0" +string(5) "1 0 1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic5.phpt new file mode 100644 index 0000000000000..a4a43d0521270 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic5.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test vsprintf() function : basic functionality - char format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using char format *** +string(1) "A" +string(3) "A B" +string(5) "A B C" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic6.phpt new file mode 100644 index 0000000000000..f6f6ed58a42dd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic6.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test vsprintf() function : basic functionality - exponential format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using exponential format *** +string(11) "1.000000e+3" +string(23) "1.000000e+3 2.000000e+3" +string(35) "1.000000e+3 2.000000e+3 3.000000e+3" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic7.phpt new file mode 100644 index 0000000000000..daf514391bce5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic7.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test vsprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using unsigned format *** +string(10) "4294966185" +string(21) "4294966185 4293732729" +string(32) "4294966185 4293732729 4292621864" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt new file mode 100644 index 0000000000000..022919ec73f2d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test vsprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using unsigned format *** +string(20) "18446744073709550505" +string(41) "18446744073709550505 18446744073708317049" +string(62) "18446744073709550505 18446744073708317049 18446744073707206184" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic8.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic8.phpt new file mode 100644 index 0000000000000..59f17b65071e7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic8.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test vsprintf() function : basic functionality - octal format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using octal format *** +string(2) "21" +string(6) "21 347" +string(10) "21 347 567" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic9.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic9.phpt new file mode 100644 index 0000000000000..42012a5c8f3fe --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_basic9.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test vsprintf() function : basic functionality - hexadecimal format +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : basic functionality - using hexadecimal format *** +string(1) "b" +string(1) "B" +string(4) "b 84" +string(4) "B 84" +string(7) "b 84 b1" +string(7) "B 84 B1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_error.phpt new file mode 100644 index 0000000000000..0ece4a420f0a4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_error.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test vsprintf() function : error conditions +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : error conditions *** + +-- Testing vsprintf() function with Zero arguments -- + +Warning: Wrong parameter count for vsprintf() in %s on line %d +bool(false) + +-- Testing vsprintf() function with less than expected no. of arguments -- + +Warning: Wrong parameter count for vsprintf() in %s on line %d +bool(false) + +-- testing vsprintf() function with more than expected no. of arguments -- + +Warning: Wrong parameter count for vsprintf() in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation1.phpt new file mode 100644 index 0000000000000..eb028454087ba --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation1.phpt @@ -0,0 +1,191 @@ +--TEST-- +Test vsprintf() function : usage variations - unexpected values for the format argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new sample(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, + + // resource data + $file_handle +); + +// loop through each element of the array for format + +$counter = 1; +foreach($values as $value) { + echo "\n -- Iteration $counter --\n"; + var_dump( vsprintf($value,$args) ); + $counter++; + +}; + +// closing the resource +fclose($file_handle); + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : with unexpected values for format argument *** + + -- Iteration 1 -- +string(1) "0" + + -- Iteration 2 -- +string(1) "1" + + -- Iteration 3 -- +string(5) "12345" + + -- Iteration 4 -- +string(5) "-2345" + + -- Iteration 5 -- +string(4) "10.5" + + -- Iteration 6 -- +string(5) "-10.5" + + -- Iteration 7 -- +string(12) "105000000000" + + -- Iteration 8 -- +string(7) "1.06E-9" + + -- Iteration 9 -- +string(3) "0.5" + + -- Iteration 10 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + + -- Iteration 11 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + + -- Iteration 12 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + + -- Iteration 13 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + + -- Iteration 14 -- + +Notice: Array to string conversion in %s on line %d +string(5) "Array" + + -- Iteration 15 -- +string(0) "" + + -- Iteration 16 -- +string(0) "" + + -- Iteration 17 -- +string(1) "1" + + -- Iteration 18 -- +string(0) "" + + -- Iteration 19 -- +string(1) "1" + + -- Iteration 20 -- +string(0) "" + + -- Iteration 21 -- +string(0) "" + + -- Iteration 22 -- +string(0) "" + + -- Iteration 23 -- +string(6) "object" + + -- Iteration 24 -- +string(0) "" + + -- Iteration 25 -- +string(0) "" + + -- Iteration 26 -- +string(%d) "Resource id #%d" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation10.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation10.phpt new file mode 100644 index 0000000000000000000000000000000000000000..42ba2679f18ab9882f9d9bc813d6b8ea5c18b273 GIT binary patch literal 2779 zcmbtW&2HO95Vo&;iUBKwl10+uk5t*NlRAwI1Tcyqc7Prn7&NuA1jt;0T-ptS_D~=X zlc&g`w;p>h&`0SvyA&zWDtf48ac5>{zWru)HA~OCo?Kmfo^>q>MUTZQUu0_5?a{2v zQnip7olsdM_ktdie37uFAdk{{lG9A)4~Z)1X`$wn$;{K%$7ETG!t%U}HGw#BKo1p{BJ)i_{f5W}WtZ=7HNLp^jV^%kRch&qhNkANRxCv^^pb}giV)#|#=mNLOF$eezvoJK=`?2>1O{%8b^v)6yekso5t3_-|q z&PJ`tHVN}`3Ud!wan)QU!ZhW+vVrX&@L*70#;@Znil|NeFWF_13kO;;*w#hYEBobQEjdpeA^Jr zy^fhB%c9Y)-@TvIQy1r#SJ2ww&DPYOcEIU}+q_JjYo8!Idx22(B$kh22P>4Y_C+Nd zIoOb~1l5(Tf6jMOE(QALG*JoInuA81rc0cWOFGMqOpFzWS?B0durX)iOhgrKyqZEF z5Zi<_ +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : octal formats with octal values *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(14) "37777777777 1 " + +-- Iteration 3 -- +string(38) "20000000000 o, 17777777777 20000000001" + +-- Iteration 4 -- +string(38) " 37776543211 0000" + +-- Iteration 5 -- +string(32) "111 2222 37777444445 37733333334" + +-- Iteration 6 -- +string(17) "11073 7653 123 12" + +-- Iteration 7 -- +string(6) "% %o o" + +-- Iteration 8 -- +string(7) "1 2 3 4" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt new file mode 100644 index 0000000000000..61327c84bab3d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test vsprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : octal formats with octal values *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(25) "1777777777777777777777 1 " + +-- Iteration 3 -- +string(60) "1777777777760000000000 o, 17777777777 1777777777760000000001" + +-- Iteration 4 -- +string(49) " 1777777777777776543211 0000" + +-- Iteration 5 -- +string(54) "111 2222 1777777777777777444445 1777777777777733333334" + +-- Iteration 6 -- +string(17) "11073 7653 123 12" + +-- Iteration 7 -- +string(6) "% %o o" + +-- Iteration 8 -- +string(7) "1 2 3 4" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation12.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation12.phpt new file mode 100644 index 0000000000000..ab67cc82f9d38 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation12.phpt @@ -0,0 +1,118 @@ +--TEST-- +Test vsprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different octal formats from the above $format array +// and with non-octal values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +string(116) "2 0 12 + 361100 o 37777775456 2322 + + 30071 14 37777777764 37777416700 + 12 361100 2 0" + +-- Iteration 2 -- +string(146) "2 37777777776 2 + 361100 o 37720715133 57062645 + + 57060664 4475347 37721631371 37720717336 + 2 361100 2 37777777776" + +-- Iteration 3 -- +string(88) "0 0 0 + 173 o 37777777605 173 + + 2322 0 $0 _0 + 0 173 0 0" + +-- Iteration 4 -- +string(75) "1 1 1 + 1 o 1 1 + + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 5 -- +string(75) "1 1 0 + 1 o 0 1 + + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt new file mode 100644 index 0000000000000..530f05b13f35c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt @@ -0,0 +1,118 @@ +--TEST-- +Test vsprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different octal formats from the above $format array +// and with non-octal values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +string(149) "2 0 12 + 361100 o 1777777777777777775456 2322 + + 30071 14 1777777777777777777764 1777777777777777416700 + 12 361100 2 0" + +-- Iteration 2 -- +string(201) "2 1777777777777777777776 2 + 361100 o 1777777777777720715133 57062645 + + 57060664 4475347 1777777777777721631371 1777777777777720717336 + 2 361100 2 1777777777777777777776" + +-- Iteration 3 -- +string(99) "0 0 0 + 173 o 1777777777777777777605 173 + + 2322 0 $0 _0 + 0 173 0 0" + +-- Iteration 4 -- +string(75) "1 1 1 + 1 o 1 1 + + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 5 -- +string(75) "1 1 0 + 1 o 0 1 + + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation13.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation13.phpt new file mode 100644 index 0000000000000..3e89fa3508779 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation13.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test vsprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(13) "ffffffff 1 22" + +-- Iteration 3 -- +string(28) "7fffffff x, 7000000 80000000" + +-- Iteration 4 -- +string(35) " ffed2979 0000" + +-- Iteration 5 -- +string(22) "#1 2222 1b6db bbbbbbbc" + +-- Iteration 6 -- +string(12) "123b fab 0 a" + +-- Iteration 7 -- +string(5) "%34 x" + +-- Iteration 8 -- +string(7) "1 2 3 4" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt new file mode 100644 index 0000000000000..749a4a858fb93 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test vsprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(21) "ffffffffffffffff 1 22" + +-- Iteration 3 -- +string(36) "7fffffff x, 7000000 ffffffff80000000" + +-- Iteration 4 -- +string(43) " ffffffffffed2979 0000" + +-- Iteration 5 -- +string(30) "#1 2222 1b6db ffffffffbbbbbbbc" + +-- Iteration 6 -- +string(12) "123b fab 0 a" + +-- Iteration 7 -- +string(5) "%34 x" + +-- Iteration 8 -- +string(7) "1 2 3 4" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation14.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation14.phpt new file mode 100644 index 0000000000000..bfe816ee1f910 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation14.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test vsprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different hexa formats from the above $format array +// and with non-hexa values from the above $args_array array + +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +string(101) "2 0 a + 1e240 x fffffb2e 4d2 + + 3039 c fffffff4 fffe1dc0 + a 1e240 2 0" + +-- Iteration 2 -- +string(124) "2 fffffffe 2 + 1e240 x ff439a5b bc65a5 + + bc61b4 127ae7 ff4732f9 ff439ede + 2 1e240 2 fffffffe" + +-- Iteration 3 -- +string(82) "0 0 0 + 7b x ffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0" + +-- Iteration 4 -- +string(75) "1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 5 -- +string(75) "1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt new file mode 100644 index 0000000000000..f1940ef2ee03a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt @@ -0,0 +1,119 @@ +--TEST-- +Test vsprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different hexa formats from the above $format array +// and with non-hexa values from the above $args_array array + +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +string(125) "2 0 a + 1e240 x fffffffffffffb2e 4d2 + + 3039 c fffffffffffffff4 fffffffffffe1dc0 + a 1e240 2 0" + +-- Iteration 2 -- +string(164) "2 fffffffffffffffe 2 + 1e240 x ffffffffff439a5b bc65a5 + + bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede + 2 1e240 2 fffffffffffffffe" + +-- Iteration 3 -- +string(90) "0 0 0 + 7b x ffffffffffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0" + +-- Iteration 4 -- +string(75) "1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 5 -- +string(75) "1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation15.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation15.phpt new file mode 100644 index 0000000000000..cedfe3f0efe1d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation15.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test vsprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +string(16) "1234567 342391 0" + +-- Iteration 2 -- +string(23) "3755744308 u 1234 12345" + +-- Iteration 3 -- +string(25) " 1234000 0 120" + +-- Iteration 4 -- +string(10) "#1 0 $0 10" + +-- Iteration 5 -- +string(7) "1 2 3 4" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt new file mode 100644 index 0000000000000..3af1738e564d8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt @@ -0,0 +1,68 @@ +--TEST-- +Test vsprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +string(16) "1234567 342391 0" + +-- Iteration 2 -- +string(24) "12345678900 u 1234 12345" + +-- Iteration 3 -- +string(25) " 1234000 0 120" + +-- Iteration 4 -- +string(10) "#1 0 $0 10" + +-- Iteration 5 -- +string(7) "1 2 3 4" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation16.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation16.phpt new file mode 100644 index 0000000000000..01bcc662d504f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation16.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test vsprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different unsigned formats from the above $format array +// and with signed and other types of values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +string(115) "2 0 10 + 123456 u 1234 2820130816 + 2840207360 1177509888 12345 + 12 4294967284 4294843840 _3 + 10 123456 2 0" + +-- Iteration 2 -- +string(88) "0 0 0 + 123 u 4294967173 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0" + +-- Iteration 3 -- +string(76) "1 1 1 + 1 u 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 4 -- +string(76) "1 1 0 + 1 u 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt new file mode 100644 index 0000000000000..91a69c7e70f91 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test vsprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different unsigned formats from the above $format array +// and with signed and other types of values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +string(143) "2 0 10 + 123456 u 1234 20000000000 + 2000000000000 22000000000000 12345 + 12 18446744073709551604 18446744073709428160 _3 + 10 123456 2 0" + +-- Iteration 2 -- +string(98) "0 0 0 + 123 u 18446744073709551493 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0" + +-- Iteration 3 -- +string(76) "1 1 1 + 1 u 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 4 -- +string(76) "1 1 0 + 1 u 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation17.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation17.phpt new file mode 100644 index 0000000000000..88cacdd49a5dc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation17.phpt @@ -0,0 +1,64 @@ +--TEST-- +Test vsprintf() function : usage variations - scientific formats with scientific values +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : scientific formats and scientific values *** + +-- Iteration 1 -- +string(36) "0.000000e+0 +1.000000e+0 1.000000e+3" + +-- Iteration 2 -- +string(38) "2.200000e+2 e 1.000000e+1 1.000000e+10" + +-- Iteration 3 -- +string(32) "-2.2000e+13 1.0000e+21 1.2000e+2" + +-- Iteration 4 -- +string(74) "#########1.000000e+1 1.000000e+2 $$$$$$$$-1.000000e+3 _________1.000000e+2" + +-- Iteration 5 -- +string(47) "1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation18.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation18.phpt new file mode 100644 index 0000000000000..3d1aeba33548d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation18.phpt @@ -0,0 +1,100 @@ +--TEST-- +Test vsprintf() function : usage variations - scientific formats with non-scientific values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different scientific formats from the above $format array +// and with non-scientific values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : scientific formats and non-scientific values *** + +-- Iteration 1 -- +string(232) "2.200000e+0 +2.000000e-1 1.020000e+1 + 1.234562e+5 e -1.234679e+3 1.234679e+3 + 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3 + 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5 + 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1" + +-- Iteration 2 -- +string(228) "0.000000e+0 +0.000000e+0 0.000000e+0 + 1.230000e+2 e -1.230000e+2 1.230000e+2 + 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0 + 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0 + 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0" + +-- Iteration 3 -- +string(227) "1.000000e+0 +1.000000e+0 1.000000e+0 + 1.000000e+0 e 1.000000e+0 1.000000e+0 + 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0" + +-- Iteration 4 -- +string(227) "1.000000e+0 +1.000000e+0 0.000000e+0 + 1.000000e+0 e 0.000000e+0 1.000000e+0 + 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation19.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation19.phpt new file mode 100644 index 0000000000000..4ad276a8800d3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation19.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test vsprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +string(13) "111 222 333" + +-- Iteration 2 -- +string(29) "1.100000 0.200000 -0.600000" + +-- Iteration 3 -- +string(29) "1.120000 -1.130000 0.230000" + +-- Iteration 4 -- +string(9) "1 10 11" + +-- Iteration 5 -- +string(7) "A B C" + +-- Iteration 6 -- +string(38) "2.000000e+1 2.000000e-1 -2.000000e+1" + +-- Iteration 7 -- +string(18) "4294967285 22 33" + +-- Iteration 8 -- +string(19) "12 37777777755 23" + +-- Iteration 9 -- +string(16) "11 ffffffde 33" + +-- Iteration 10 -- +string(16) "11 FFFFFFDE 33" + +-- Iteration 11 -- +string(38) "2.000000E+1 2.000000E-1 -2.000000E+1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt new file mode 100644 index 0000000000000..6e805feb7f294 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt @@ -0,0 +1,91 @@ +--TEST-- +Test vsprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +string(13) "111 222 333" + +-- Iteration 2 -- +string(29) "1.100000 0.200000 -0.600000" + +-- Iteration 3 -- +string(29) "1.120000 -1.130000 0.230000" + +-- Iteration 4 -- +string(9) "1 10 11" + +-- Iteration 5 -- +string(7) "A B C" + +-- Iteration 6 -- +string(38) "2.000000e+1 2.000000e-1 -2.000000e+1" + +-- Iteration 7 -- +string(28) "18446744073709551605 22 33" + +-- Iteration 8 -- +string(30) "12 1777777777777777777755 23" + +-- Iteration 9 -- +string(24) "11 ffffffffffffffde 33" + +-- Iteration 10 -- +string(24) "11 FFFFFFFFFFFFFFDE 33" + +-- Iteration 11 -- +string(38) "2.000000E+1 2.000000E-1 -2.000000E+1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation2.phpt new file mode 100644 index 0000000000000..fbc1e8634a4f2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation2.phpt @@ -0,0 +1,177 @@ +--TEST-- +Test vsprintf() function : usage variations - unexpected values for args argument +--FILE-- + +--EXPECTF-- +*** Testing vsprintf() : with unexpected values for args argument *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(1) "1" + +-- Iteration 3 -- +string(5) "12345" + +-- Iteration 4 -- +string(5) "-2345" + +-- Iteration 5 -- +string(4) "10.5" + +-- Iteration 6 -- +string(5) "-10.5" + +-- Iteration 7 -- +string(12) "105000000000" + +-- Iteration 8 -- +string(7) "1.06E-9" + +-- Iteration 9 -- +string(3) "0.5" + +-- Iteration 10 -- + +Warning: vsprintf(): Too few arguments in %s on line %d +bool(false) + +-- Iteration 11 -- + +Warning: vsprintf(): Too few arguments in %s on line %d +bool(false) + +-- Iteration 12 -- +string(1) "1" + +-- Iteration 13 -- +string(0) "" + +-- Iteration 14 -- +string(1) "1" + +-- Iteration 15 -- +string(0) "" + +-- Iteration 16 -- +string(0) "" + +-- Iteration 17 -- +string(0) "" + +-- Iteration 18 -- +string(6) "string" + +-- Iteration 19 -- +string(6) "string" + +-- Iteration 20 -- + +Warning: vsprintf(): Too few arguments in %s on line %d +bool(false) + +-- Iteration 21 -- + +Warning: vsprintf(): Too few arguments in %s on line %d +bool(false) + +-- Iteration 22 -- + +Warning: vsprintf(): Too few arguments in %s on line %d +bool(false) + +-- Iteration 23 -- +string(%d) "Resource id #%d" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation3.phpt new file mode 100644 index 0000000000000..fff82c8032ce5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation3.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test vsprintf() function : usage variations - int formats with int values +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : int formats with int values *** + +-- Iteration 1 -- +string(1) "0" + +-- Iteration 2 -- +string(5) "-1 1 " + +-- Iteration 3 -- +string(36) "2147483647 d, 2147483640 -2147483640" + +-- Iteration 4 -- +string(38) " 123456 12345678 -1234567 1234567" + +-- Iteration 5 -- +string(24) "111 2222 333333 44444444" + +-- Iteration 6 -- +string(15) "4667 4011 83 10" + +-- Iteration 7 -- +string(8) "%-5678 d" + +-- Iteration 8 -- +string(7) "1 2 3 4" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation4.phpt new file mode 100644 index 0000000000000..e3e6737b82679 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation4.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test vsprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different int formats from the above $format array +// and with non-int values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +string(112) "2 +0 10 + 123456 d -1234 1234 + -1474836480 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0" + +-- Iteration 2 -- +string(92) "0 +0 0 + 123 d -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0" + +-- Iteration 3 -- +string(81) "1 +1 1 + 1 d 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 4 -- +string(81) "1 +1 0 + 1 d 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt new file mode 100644 index 0000000000000..c6b6db572ccfe --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt @@ -0,0 +1,104 @@ +--TEST-- +Test vsprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different int formats from the above $format array +// and with non-int values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +string(112) "2 +0 10 + 123456 d -1234 1234 + 20000000000 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0" + +-- Iteration 2 -- +string(92) "0 +0 0 + 123 d -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0" + +-- Iteration 3 -- +string(81) "1 +1 1 + 1 d 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1" + +-- Iteration 4 -- +string(81) "1 +1 0 + 1 d 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation5.phpt new file mode 100644 index 0000000000000..dd356fbbe020c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation5.phpt @@ -0,0 +1,82 @@ +--TEST-- +Test vsprintf() function : usage variations - float formats with float values +--FILE-- + + +--EXPECTF-- +*** Testing vsprintf() : int formats with float values *** + +-- Iteration 1 -- +string(8) "0.000000" + +-- Iteration 2 -- +string(28) "-0.100000 0.100000 10.000001" + +-- Iteration 3 -- +string(57) "2147483649.000000 f, 2147483640.000000 -2147483640.000000" + +-- Iteration 4 -- +string(45) "200000.0000 0.0000 -200000.000000 -0.0000" + +-- Iteration 5 -- +string(98) "20000.000000 -1999999999999999879418332743206357172224.000000 0.000000 20000000000000000000.000000" + +-- Iteration 6 -- +string(43) "4667.000000 4011.000000 83.000000 10.000000" + +-- Iteration 7 -- +string(15) "%-5678.567800 f" + +-- Iteration 8 -- +string(35) "1.110000 2.220000 3.330000 4.440000" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation6.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation6.phpt new file mode 100644 index 0000000000000..00f9467cf9972 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation6.phpt @@ -0,0 +1,100 @@ +--TEST-- +Test vsprintf() function : usage variations - float formats with non-float values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different float formats from the above $format array +// and with non-float values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : float formats and non-float values *** + +-- Iteration 1 -- +string(244) "2.000000 -2.000000 2.000000 + 123456.000000 f -12346789.000000 12346789.000000 + 123200.0000 20000.0000 -40000.000000 22212.0000 + 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000 + 2.000000 123456.000000 2.000000 -2.000000" + +-- Iteration 2 -- +string(196) "0.000000 +0.000000 0.000000 + 123.000000 f -123.000000 123.000000 + 0.0000 0.0000 123456.000000 0.0000 + 1234.000000 0.000000 0.000000 0.000000 + 0.000000 123.000000 0.000000 0.000000" + +-- Iteration 3 -- +string(179) "1.000000 +1.000000 1.000000 + 1.000000 f 1.000000 1.000000 + 1.0000 1.0000 1.000000 1.0000 + 1.000000 1.000000 1.000000 1.000000 + 1.000000 1.000000 1.000000 1.000000" + +-- Iteration 4 -- +string(179) "1.000000 +1.000000 0.000000 + 1.000000 f 0.000000 1.000000 + 1.0000 0.0000 1.000000 0.0000 + 0.000000 1.000000 1.000000 0.000000 + 0.000000 1.000000 1.000000 1.000000" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation7.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation7.phpt new file mode 100644 index 0000000000000000000000000000000000000000..0085138b782213cd4e84338e079b73ed512e1747 GIT binary patch literal 2238 zcmbVNZENF35WarhUoq(H%66jIvYp)Jt=H0X;NYM~<3gb>Mv>N$z}AZ0Rea{S|K4X` zWXleP(%`JLvop`U>@%Y%n$I5RQN-q4X?jtWEK0rV^=Va?sV+oGH&mL*t-rJm)lohKLm%P*sev>Ew8_`R$uDL>_oT@}A#G-`()H$cH;|xMF24Tmf zgLnB{Zvd)DtgKp7V;c@nb3wsi;6gIh-Iu6;C|eUqyW#|+MH$>O-gn_l|x&Mig{aaBiPxinIv7ZPen?g%$Yc$ZSSa$h=wjb__{q zmyTVR$oi)2L;A(Eh$WHF!&4DiI9l1RbVL9x zi;{eT7sh&)r0CW9$)$>RDRokysgJR?c>%RlNXbS38%tNJM*D!xEXkLy#H~77 zK`)@7Z>s5cIbW~EVzd=@-@{3%5Kg?IvtRv?r;n0xXiJ6!Ztm{^*#$t%ElGT9|<-xd~8jg$YLI zl5@lot}v(Cz5{z=RO|_!FtkC#u+N%XUkg#0HpE5flUZ$t!J*xc*-a}cHkKF3lX&3` z7u;1CLYNWN8Yi#x&G7Q~YOjxVQc;(hOS-4{mVpq47`=THC93h!r*F7(H`o?s6wxPG z*>4E#F`~$fE+T>^J~7Lz-c-HA=<}$k_92YF8sjMbyH98e+QXfl-LmhDIhP;J1>CX^ zKQVlhW`BN}{W^cZXX*crScB5aASPhBQupFMf#D|#*zG%T^-Skhyfp#$E$vYDLP zIKmUg4bdMD^aCEJex@y($<#z*|4bW@=>WGS-vVU#e+qHgf_P_=`A;7Lay>%-GQerM oJoR(c@^b|@n0pvJr&{k?TJd|R;T{QH1QMf#Fo9|rFmt)=AADoCcmMzZ literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation8.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation8.phpt new file mode 100644 index 0000000000000..08f218486b38a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation8.phpt @@ -0,0 +1,101 @@ +--TEST-- +Test vsprintf() function : usage variations - string formats with non-string values +--FILE-- +"12twelve"), + array("3"), array("4"), array("1"), array("2") ), + + // array of boolean data + array( true, TRUE, false, + TRUE, 0, FALSE, 1, + true, false, TRUE, FALSE, + 0, 1, 1, 0, + 1, TRUE, 0, FALSE), + +); + +// looping to test vsprintf() with different string formats from the above $format array +// and with non-string values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + echo "\n-- Iteration $counter --\n"; + var_dump( vsprintf($formats, $args) ); + $counter++; +} + +echo "Done"; +?> +--EXPECTF-- +*** Testing vsprintf() : string formats and non-string values *** + +-- Iteration 1 -- +string(177) "2.2 0.2 10.2 + 123456.234 s -1234.6789 1234.6789 + 2000 2000 -400000000000 2200 + 12345.78 12.000000011111 -12.00000111111 -123456.234 + 10.2 123456.234 2.2 0.2" + +-- Iteration 2 -- +string(132) "2 -2 2 + 123456 s -12346789 12346789 + 1232 2000 -40000 2221 + 12345780 1211111 -12111111 -12345634 + 2 123456 2 -2" + +-- Iteration 3 -- +string(131) "Array Array Array + Array s Array Array + Arra Arra Array Arra + Array Array Array Array + Array Array Array Array" + +-- Iteration 4 -- +string(81) "1 1 + 1 s 1 + 1 0001 0000 + #0 1 $1 _0 + 1 1 1" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation9.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/vsprintf_variation9.phpt new file mode 100644 index 0000000000000000000000000000000000000000..2d466373915e9bdc56c452344539c5533277c013 GIT binary patch literal 1709 zcmbVM?M~Y;6y0w>#Z}g-O&ils`a#DKD@8)$2O9k`X-t*tIy4f*k?j=Fv}f4^>>2iM zyLOTi!i1(ti4)&@e6H`g*QRv2xL#69mO>lY=|n}b37bBIY0OO|V>p6Tvs(c>rXpr7 z8Yu8BQxHmZ&y0qL$ZRvqj@_j~6H3o7E*D7p;Uw86q|<^cC5<#si2&r&27}x_2g~Of zT>wle_JrfD_6fA$OlYp6#6~`X&%&fC2A0P*VpFhL=(S807r^C49D#T=9c@^=VQSOK zxDmc`2_A6L>JZ!*X~C<+rTR;H41>CT$Z{WTCI%yMXo;P z|E73=%Wh(CMsRx_*oZKSEy0W6h4Q3Ul;Ai6GzoxL=U(8xZ4Pyc?>wL1;r}HMpgy#Y zVFBxP51b+YcI~7)L|eYB@xG6ih8t>bT=fedI`St6Lmdsg?q-eppoZR|9eQ@?*LZ{Y zm>OnwYSq+`%Zc4(JI5xL$>~}vOCLp!V#rfHuxl5LZ$YQ)Too>3!y@cUCv492u#FJJ zrBXsCGIoU$c3mb}(KgS_q-I-gl?h$a(;1pw-)fruH+Um}(HP%J*$Qa&zzcv{Uwbqz zIj3l$c9>4kH7&1u!_|H4^#|(!x{u+h{ou@v(?N-PfQ%G9!vJtNEP1jm;x-TQ9r>h? z{!Yro_LObi%Bgopc@u@9P$D)jJ2h1D-W7+f zjZkn5y&1vc*djIejm>ls$cOJ(f$V7A#FWAXu5uR=>^Ug4M+X29iTBlNlinxI=Zhw1 z4WLx&uf<~8`{n~SC+z9k?HTz&NEY%;#sW{}$wz|M+v3aBV!k}b8}9!Px#cP4&;w-4 zZo+2I2k)I%0rX3Np#{Jks+d6uGjSL^?!RGP#SKfiG2$5fgf*nW)r9%0Iy;uC5+wJDSW~-&pcw~Cw~BN2=|Bp literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap.phpt new file mode 100644 index 0000000000000..c1f3b05bda56a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap.phpt @@ -0,0 +1,37 @@ +--TEST-- +wordwrap() function +--FILE-- +\n'; + +// Calling wordwrap() with default arguments +var_dump( wordwrap($str) ); + +// Calling wordwrap() with all possible optional arguments +// with $width arg +var_dump( wordwrap($str, $width) ); +// with $break arg +var_dump( wordwrap($str, $width, $break) ); + +// Calling wordwrap() with all arguments +// $cut as true +$width = 10; +$cut = true; +var_dump( wordwrap($str, $width, $break, $cut) ); + +// $cut as false +$width = 10; +$cut = false; +var_dump( wordwrap($str, $width, $break, $cut) ); +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : basic functionality *** +string(96) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy +doooooooooooooooooooooog." +string(96) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy +doooooooooooooooooooooog." +string(103) "The quick brown foooooooooox jummmmmmmmmmmmped over the lazzzzzzzzzzzy
    \ndoooooooooooooooooooooog." +string(178) "The quick
    \nbrown
    \nfooooooooo
    \nox
    \njummmmmmmm
    \nmmmmped
    \nover the
    \nlazzzzzzzz
    \nzzzy
    \ndooooooooo
    \noooooooooo
    \nooog." +string(138) "The quick
    \nbrown
    \nfoooooooooox
    \njummmmmmmmmmmmped
    \nover the
    \nlazzzzzzzzzzzy
    \ndoooooooooooooooooooooog." +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_error.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_error.phpt new file mode 100644 index 0000000000000..98f199abc6821 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_error.phpt @@ -0,0 +1,78 @@ +--TEST-- +Test wordwrap() function : error conditions +--FILE-- +\n'; +$cut = true; +$extra_arg = "extra_arg"; + +var_dump( wordwrap($str, $width, $break, $cut, $extra_arg) ); + +// $width arg as negative value +echo "\n-- Testing wordwrap() function with negative/zero value for width argument --\n"; +echo "-- width = 0 & cut = false --\n"; +// width as zero and cut as false +$width = 0; +$cut = false; +var_dump( wordwrap($str, $width, $break, $cut) ); + +echo "-- width = 0 & cut = true --\n"; +// width as zero and cut as true +$width = 0; +$cut = true; +var_dump( wordwrap($str, $width, $break, $cut) ); + +echo "-- width = -10 & cut = false --\n"; +// width as -ne and cut as false +$width = -10; +$cut = false; +var_dump( wordwrap($str, $width, $break, $cut) ); + +echo "-- width = -10 & cut = true --\n"; +// width as -ne and cut as true +$width = -10; +$cut = true; +var_dump( wordwrap($str, $width, $break, $cut) ); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : error conditions *** + +-- Testing wordwrap() function with Zero arguments -- + +Warning: wordwrap() expects at least 1 parameter, 0 given in %s on line %d +NULL + +-- Testing wordwrap() function with more than expected no. of arguments -- + +Warning: wordwrap() expects at most 4 parameters, 5 given in %s on line %d +NULL + +-- Testing wordwrap() function with negative/zero value for width argument -- +-- width = 0 & cut = false -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- width = 0 & cut = true -- + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- width = -10 & cut = false -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- width = -10 & cut = true -- +string(223) "
    \nt
    \ne
    \ns
    \nt
    \ni
    \nn
    \ng
    \n
    \nw
    \no
    \nr
    \nd
    \nw
    \nr
    \na
    \np
    \n
    \nf
    \nu
    \nn
    \nc
    \nt
    \ni
    \no
    \nn" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation1.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation1.phpt new file mode 100644 index 0000000000000..f5a172e9a173b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation1.phpt @@ -0,0 +1,335 @@ +--TEST-- +Test wordwrap() function : usage variations - unexpected values for str argument +--FILE-- +\n'; +$cut = true; + +// resource variable +$fp = fopen(__FILE__, "r"); + +// get an unset variable +$unset_var = 'string_val'; +unset($unset_var); + +// array with different values +$values = array ( + + // integer values + 0, + 1, + 12345, + -2345, + + // float values + 10.5, + -10.5, + 10.5e10, + 10.6E-10, + .5, + + // array values + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new stdclass(), + + // Null + NULL, + null, + + // empty string + "", + '', + + // resource variable + $fp, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop though each element of the array and check the working of wordwrap() +// when $str arugment is supplied with different values +echo "\n--- Testing wordwrap() by supplying different values for 'str' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $str = $values [$index]; + + var_dump( wordwrap($str) ); + var_dump( wordwrap($str, $width) ); + var_dump( wordwrap($str, $width, $break) ); + + // $cut as false + $cut = false; + var_dump( wordwrap($str, $width, $break, $cut) ); + + // $cut as true + $cut = true; + var_dump( wordwrap($str, $width, $break, $cut) ); + + $counter ++; +} + +// close the resource +fclose($fp); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : usage variations *** + +--- Testing wordwrap() by supplying different values for 'str' argument --- +-- Iteration 1 -- +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +string(1) "0" +-- Iteration 2 -- +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +-- Iteration 3 -- +string(5) "12345" +string(5) "12345" +string(5) "12345" +string(5) "12345" +string(13) "123
    \n45" +-- Iteration 4 -- +string(5) "-2345" +string(5) "-2345" +string(5) "-2345" +string(5) "-2345" +string(13) "-23
    \n45" +-- Iteration 5 -- +string(4) "10.5" +string(4) "10.5" +string(4) "10.5" +string(4) "10.5" +string(12) "10.
    \n5" +-- Iteration 6 -- +string(5) "-10.5" +string(5) "-10.5" +string(5) "-10.5" +string(5) "-10.5" +string(13) "-10
    \n.5" +-- Iteration 7 -- +string(12) "105000000000" +string(12) "105000000000" +string(12) "105000000000" +string(12) "105000000000" +string(36) "105
    \n000
    \n000
    \n000" +-- Iteration 8 -- +string(7) "1.06E-9" +string(7) "1.06E-9" +string(7) "1.06E-9" +string(7) "1.06E-9" +string(23) "1.0
    \n6E-
    \n9" +-- Iteration 9 -- +string(3) "0.5" +string(3) "0.5" +string(3) "0.5" +string(3) "0.5" +string(3) "0.5" +-- Iteration 10 -- + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +-- Iteration 16 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 17 -- +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +-- Iteration 18 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 19 -- + +Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, object given in %s on line %d +NULL +-- Iteration 20 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 21 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 22 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 23 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 24 -- + +Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +-- Iteration 26 -- +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation2.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation2.phpt new file mode 100644 index 0000000000000..2718791943dca --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation2.phpt @@ -0,0 +1,340 @@ +--TEST-- +Test wordwrap() function : usage variations - unexpected values for width argument +--FILE-- +\n'; +$cut = true; + +// resource var +$fp = fopen(__FILE__, "r"); + +// get an unset variable +$unset_var = 10; +unset($unset_var); + + +// array with different values as width +$values = array ( + // zerovalue for width + 0, + + // -ve value for width + -1, + -10, + + // array values + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // string values + "string", + 'string', + + // objects + new stdclass(), + + // Null value + NULL, + null, + + // empty string + "", + '', + + // resource variable + $fp, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + + +// loop though each element of the array and check the working of wordwrap() +// when $width arugment is supplied with different values +echo "\n--- Testing wordwrap() by supplying different values for 'width' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $width = $values [$index]; + + var_dump( wordwrap($str, $width) ); + var_dump( wordwrap($str, $width, $break) ); + + // cut as false + $cut = false; + var_dump( wordwrap($str, $width, $break, $cut) ); + + // cut as true + $cut = true; + var_dump( wordwrap($str, $width, $break, $cut) ); + + $counter ++; +} + +// close the resource +fclose($fp); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : usage variations *** + +--- Testing wordwrap() by supplying different values for 'width' argument --- +-- Iteration 1 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 2 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" +string(223) "
    \nt
    \ne
    \ns
    \nt
    \ni
    \nn
    \ng
    \n
    \nw
    \no
    \nr
    \nd
    \nw
    \nr
    \na
    \np
    \n
    \nf
    \nu
    \nn
    \nc
    \nt
    \ni
    \no
    \nn" +-- Iteration 3 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" +string(223) "
    \nt
    \ne
    \ns
    \nt
    \ni
    \nn
    \ng
    \n
    \nw
    \no
    \nr
    \nd
    \nw
    \nr
    \na
    \np
    \n
    \nf
    \nu
    \nn
    \nc
    \nt
    \ni
    \no
    \nn" +-- Iteration 4 -- + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 5 -- + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 6 -- + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 7 -- + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 8 -- + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, array given in %s on line %d +NULL +-- Iteration 9 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" +string(199) "t
    \ne
    \ns
    \nt
    \ni
    \nn
    \ng
    \nw
    \no
    \nr
    \nd
    \nw
    \nr
    \na
    \np
    \nf
    \nu
    \nn
    \nc
    \nt
    \ni
    \no
    \nn" +-- Iteration 10 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 11 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" +string(199) "t
    \ne
    \ns
    \nt
    \ni
    \nn
    \ng
    \nw
    \no
    \nr
    \nd
    \nw
    \nr
    \na
    \np
    \nf
    \nu
    \nn
    \nc
    \nt
    \ni
    \no
    \nn" +-- Iteration 12 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 13 -- + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, object given in %s on line %d +NULL +-- Iteration 16 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 17 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 19 -- + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 2 to be long, resource given in %s on line %d +NULL +-- Iteration 21 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +-- Iteration 22 -- +string(25) "testing +wordwrap +function" +string(39) "testing
    \nwordwrap
    \nfunction" +string(39) "testing
    \nwordwrap
    \nfunction" + +Warning: wordwrap(): Can't force cut when width is zero in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation3.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation3.phpt new file mode 100644 index 0000000000000..0a71944b4ea39 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation3.phpt @@ -0,0 +1,302 @@ +--TEST-- +Test wordwrap() function : usage variations - unexptected values for break argument +--INI-- +--FILE-- + 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // objects + new stdclass(), + + // empty string + "", + '', + + //Null + NULL, + null, + + // resource var + $fp, + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop though each element of the array and check the working of wordwrap() +// when $break arugment is supplied with different values +echo "\n--- Testing wordwrap() by supplying different values for 'break' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $break = $values [$index]; + + var_dump( wordwrap($str, $width, $break) ); + + // $cut as false + $cut = false; + var_dump( wordwrap($str, $width, $break, $cut) ); + + // $cut as true + $cut = true; + var_dump( wordwrap($str, $width, $break, $cut) ); + + $counter ++; +} + +// close the resource used +fclose($fp); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : usage variations *** + +--- Testing wordwrap() by supplying different values for 'break' argument --- +-- Iteration 1 -- +string(25) "testing0wordwrap0function" +string(25) "testing0wordwrap0function" +string(25) "testing0wordwrap0function" +-- Iteration 2 -- +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +-- Iteration 3 -- +string(33) "testing12345wordwrap12345function" +string(33) "testing12345wordwrap12345function" +string(33) "testing12345wordwrap12345function" +-- Iteration 4 -- +string(33) "testing-2345wordwrap-2345function" +string(33) "testing-2345wordwrap-2345function" +string(33) "testing-2345wordwrap-2345function" +-- Iteration 5 -- +string(31) "testing10.5wordwrap10.5function" +string(31) "testing10.5wordwrap10.5function" +string(31) "testing10.5wordwrap10.5function" +-- Iteration 6 -- +string(33) "testing-10.5wordwrap-10.5function" +string(33) "testing-10.5wordwrap-10.5function" +string(33) "testing-10.5wordwrap-10.5function" +-- Iteration 7 -- +string(47) "testing105000000000wordwrap105000000000function" +string(47) "testing105000000000wordwrap105000000000function" +string(47) "testing105000000000wordwrap105000000000function" +-- Iteration 8 -- +string(37) "testing1.06E-9wordwrap1.06E-9function" +string(37) "testing1.06E-9wordwrap1.06E-9function" +string(37) "testing1.06E-9wordwrap1.06E-9function" +-- Iteration 9 -- +string(29) "testing0.5wordwrap0.5function" +string(29) "testing0.5wordwrap0.5function" +string(29) "testing0.5wordwrap0.5function" +-- Iteration 10 -- + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +-- Iteration 16 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 17 -- +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +string(25) "testing1wordwrap1function" +-- Iteration 18 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, object given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 21 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 22 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 24 -- + +Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d +NULL + +Warning: wordwrap() expects parameter 3 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +-- Iteration 26 -- + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) + +Warning: wordwrap(): Break string cannot be empty in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation4.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation4.phpt new file mode 100644 index 0000000000000..440e93740a6b9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation4.phpt @@ -0,0 +1,144 @@ +--TEST-- +Test wordwrap() function : usage variations - unexptected value for cut argument +--FILE-- +\n'; + +// get an unset variable +$unset_var = true; +unset($unset_var); + +// resource variable +$fp = fopen(__FILE__, "r"); + +// array with different values +$values = array ( + + // integer values + 0, + 1, + 12345, + -2345, + + // float values + 10.5, + -10.5, + 10.5e10, + 10.6E-10, + .5, + + // array values + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // string values + "string", + 'string', + + // objects + new stdclass(), + + // empty string + "", + '', + + // undefined variable + @$undefined_var, + + // unset variable + @$unset_var +); + +// loop though each element of the array and check the working of wordwrap() +// when $cut arugment is supplied with different values +echo "\n--- Testing wordwrap() by supplying different values for 'cut' argument ---\n"; +$counter = 1; +for($index = 0; $index < count($values); $index ++) { + echo "-- Iteration $counter --\n"; + $cut = $values [$index]; + + var_dump( wordwrap($str, $width, $break, $cut) ); + + $counter ++; +} + +// close the resource +fclose($fp); + +echo "Done\n"; +?> +--EXPECTF-- +*** Testing wordwrap() : usage variations *** + +--- Testing wordwrap() by supplying different values for 'cut' argument --- +-- Iteration 1 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 2 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 3 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 4 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 5 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 6 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 7 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 8 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 9 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 10 -- + +Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: wordwrap() expects parameter 4 to be boolean, array given in %s on line %d +NULL +-- Iteration 15 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 16 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 17 -- + +Warning: wordwrap() expects parameter 4 to be boolean, object given in %s on line %d +NULL +-- Iteration 18 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 19 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 20 -- +string(39) "testing
    \nwordwrap
    \nfunction" +-- Iteration 21 -- +string(39) "testing
    \nwordwrap
    \nfunction" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation5.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation5.phpt new file mode 100644 index 0000000000000..b0911a899cd0e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/strings/wordwrap_variation5.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test wordwrap() function : usage variations - valid break arguments(spaces) +--FILE-- + +--EXPECTF-- +*** Testing wordwrap() : usage variations *** + +-- Testing wordwrap() with default break value and single space as value -- +-- with default break and cut value -- +string(24) "Testing +wordrap +function" +-- with default cut value -- +string(24) "Testing wordrap function" +string(26) "Testing wordrap function" +-- with cut value as false -- +string(24) "Testing wordrap function" +string(26) "Testing wordrap function" +-- with cut value as true -- +string(43) "T e s t i n g w o r d r a p f u n c t i o n" +string(64) "T e s t i n g w o r d r a p f u n c t i o n" +Done diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/time/001.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/time/001.phpt new file mode 100644 index 0000000000000..3b0ed8a77f40d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/time/001.phpt @@ -0,0 +1,34 @@ +--TEST-- +microtime() function +--SKIPIF-- + +--FILE-- + $last_t || ($time == $last_t && $micro >= $last_m)) { + $passed++; + } else if ($failed++ <=10) { + $result .= sprintf('%06d', $i).": $time $micro < $last_t $last_m\n"; + } + $last_m = $micro; + $last_t = $time; +} +echo "Passed: $passed\n"; +echo "Failed: $failed\n"; +echo $result; +?> +--EXPECT-- +Passed: 100000 +Failed: 0 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/time/bug38524.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/time/bug38524.phpt new file mode 100755 index 0000000000000..77d0f4f2341b1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/time/bug38524.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #38524 (strptime() does not initialize the internal date storage structure) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +array(9) { + ["tm_sec"]=> + int(0) + ["tm_min"]=> + int(0) + ["tm_hour"]=> + int(0) + ["tm_mday"]=> + int(20) + ["tm_mon"]=> + int(7) + ["tm_year"]=> + int(106) + ["tm_wday"]=> + int(0) + ["tm_yday"]=> + int(%d) + ["unparsed"]=> + string(0) "" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/time/idate.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/time/idate.phpt new file mode 100644 index 0000000000000..efeef665fd9e0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/time/idate.phpt @@ -0,0 +1,32 @@ +--TEST-- +idate() function +--FILE-- + +--EXPECT-- +U: 1043324459 +Y: 2003 +z: 22 +y: 3 +m: 1 +n: 1 +d: 23 +j: 23 +H: 12 +G: 12 +h: 12 +g: 12 +i: 20 +s: 59 +t: 31 +w: 4 +L: 0 +B: 556 +I: 0 +W: 4 diff --git a/phpt/tests/php-5.2.5/ext/standard/tests/versioning/version_compare.phpt b/phpt/tests/php-5.2.5/ext/standard/tests/versioning/version_compare.phpt new file mode 100644 index 0000000000000..145fb933abda2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/standard/tests/versioning/version_compare.phpt @@ -0,0 +1,795 @@ +--TEST-- +version_compare test +--FILE-- +", + "ge", ">=", + "eq", "=", "==", + "ne", "<>", "!=" +); +test("1", "2"); +test("10", "2"); +test("1.0", "1.1"); +test("1.2", "1.0.1"); +foreach ($special_forms as $f1) { + foreach ($special_forms as $f2) { + test("1.0$f1", "1.0$f2"); + } +} +print "TESTING OPERATORS\n"; +foreach ($special_forms as $f1) { + foreach ($special_forms as $f2) { + foreach ($operators as $op) { + $v1 = "1.0$f1"; + $v2 = "1.0$f2"; + $test = version_compare($v1, $v2, $op) ? "true" : "false"; + printf("%7s %2s %-7s : %s\n", $v1, $op, $v2, $test); + } + } +} + +function test($v1, $v2) { + $compare = version_compare($v1, $v2); + switch ($compare) { + case -1: + print "$v1 < $v2\n"; + break; + case 1: + print "$v1 > $v2\n"; + break; + case 0: + default: + print "$v1 = $v2\n"; + break; + } +} + +?> +--EXPECT-- +TESTING COMPARE +1 < 2 +10 > 2 +1.0 < 1.1 +1.2 > 1.0.1 +1.0-dev = 1.0-dev +1.0-dev < 1.0a1 +1.0-dev < 1.0b1 +1.0-dev < 1.0RC1 +1.0-dev < 1.0rc1 +1.0-dev < 1.0 +1.0-dev < 1.0pl1 +1.0a1 > 1.0-dev +1.0a1 = 1.0a1 +1.0a1 < 1.0b1 +1.0a1 < 1.0RC1 +1.0a1 < 1.0rc1 +1.0a1 < 1.0 +1.0a1 < 1.0pl1 +1.0b1 > 1.0-dev +1.0b1 > 1.0a1 +1.0b1 = 1.0b1 +1.0b1 < 1.0RC1 +1.0b1 < 1.0rc1 +1.0b1 < 1.0 +1.0b1 < 1.0pl1 +1.0RC1 > 1.0-dev +1.0RC1 > 1.0a1 +1.0RC1 > 1.0b1 +1.0RC1 = 1.0RC1 +1.0RC1 = 1.0rc1 +1.0RC1 < 1.0 +1.0RC1 < 1.0pl1 +1.0rc1 > 1.0-dev +1.0rc1 > 1.0a1 +1.0rc1 > 1.0b1 +1.0rc1 = 1.0RC1 +1.0rc1 = 1.0rc1 +1.0rc1 < 1.0 +1.0rc1 < 1.0pl1 +1.0 > 1.0-dev +1.0 > 1.0a1 +1.0 > 1.0b1 +1.0 > 1.0RC1 +1.0 > 1.0rc1 +1.0 = 1.0 +1.0 < 1.0pl1 +1.0pl1 > 1.0-dev +1.0pl1 > 1.0a1 +1.0pl1 > 1.0b1 +1.0pl1 > 1.0RC1 +1.0pl1 > 1.0rc1 +1.0pl1 > 1.0 +1.0pl1 = 1.0pl1 +TESTING OPERATORS +1.0-dev lt 1.0-dev : false +1.0-dev < 1.0-dev : false +1.0-dev le 1.0-dev : true +1.0-dev <= 1.0-dev : true +1.0-dev gt 1.0-dev : false +1.0-dev > 1.0-dev : false +1.0-dev ge 1.0-dev : true +1.0-dev >= 1.0-dev : true +1.0-dev eq 1.0-dev : true +1.0-dev = 1.0-dev : true +1.0-dev == 1.0-dev : true +1.0-dev ne 1.0-dev : false +1.0-dev <> 1.0-dev : false +1.0-dev != 1.0-dev : false +1.0-dev lt 1.0a1 : true +1.0-dev < 1.0a1 : true +1.0-dev le 1.0a1 : true +1.0-dev <= 1.0a1 : true +1.0-dev gt 1.0a1 : false +1.0-dev > 1.0a1 : false +1.0-dev ge 1.0a1 : false +1.0-dev >= 1.0a1 : false +1.0-dev eq 1.0a1 : false +1.0-dev = 1.0a1 : false +1.0-dev == 1.0a1 : false +1.0-dev ne 1.0a1 : true +1.0-dev <> 1.0a1 : true +1.0-dev != 1.0a1 : true +1.0-dev lt 1.0b1 : true +1.0-dev < 1.0b1 : true +1.0-dev le 1.0b1 : true +1.0-dev <= 1.0b1 : true +1.0-dev gt 1.0b1 : false +1.0-dev > 1.0b1 : false +1.0-dev ge 1.0b1 : false +1.0-dev >= 1.0b1 : false +1.0-dev eq 1.0b1 : false +1.0-dev = 1.0b1 : false +1.0-dev == 1.0b1 : false +1.0-dev ne 1.0b1 : true +1.0-dev <> 1.0b1 : true +1.0-dev != 1.0b1 : true +1.0-dev lt 1.0RC1 : true +1.0-dev < 1.0RC1 : true +1.0-dev le 1.0RC1 : true +1.0-dev <= 1.0RC1 : true +1.0-dev gt 1.0RC1 : false +1.0-dev > 1.0RC1 : false +1.0-dev ge 1.0RC1 : false +1.0-dev >= 1.0RC1 : false +1.0-dev eq 1.0RC1 : false +1.0-dev = 1.0RC1 : false +1.0-dev == 1.0RC1 : false +1.0-dev ne 1.0RC1 : true +1.0-dev <> 1.0RC1 : true +1.0-dev != 1.0RC1 : true +1.0-dev lt 1.0rc1 : true +1.0-dev < 1.0rc1 : true +1.0-dev le 1.0rc1 : true +1.0-dev <= 1.0rc1 : true +1.0-dev gt 1.0rc1 : false +1.0-dev > 1.0rc1 : false +1.0-dev ge 1.0rc1 : false +1.0-dev >= 1.0rc1 : false +1.0-dev eq 1.0rc1 : false +1.0-dev = 1.0rc1 : false +1.0-dev == 1.0rc1 : false +1.0-dev ne 1.0rc1 : true +1.0-dev <> 1.0rc1 : true +1.0-dev != 1.0rc1 : true +1.0-dev lt 1.0 : true +1.0-dev < 1.0 : true +1.0-dev le 1.0 : true +1.0-dev <= 1.0 : true +1.0-dev gt 1.0 : false +1.0-dev > 1.0 : false +1.0-dev ge 1.0 : false +1.0-dev >= 1.0 : false +1.0-dev eq 1.0 : false +1.0-dev = 1.0 : false +1.0-dev == 1.0 : false +1.0-dev ne 1.0 : true +1.0-dev <> 1.0 : true +1.0-dev != 1.0 : true +1.0-dev lt 1.0pl1 : true +1.0-dev < 1.0pl1 : true +1.0-dev le 1.0pl1 : true +1.0-dev <= 1.0pl1 : true +1.0-dev gt 1.0pl1 : false +1.0-dev > 1.0pl1 : false +1.0-dev ge 1.0pl1 : false +1.0-dev >= 1.0pl1 : false +1.0-dev eq 1.0pl1 : false +1.0-dev = 1.0pl1 : false +1.0-dev == 1.0pl1 : false +1.0-dev ne 1.0pl1 : true +1.0-dev <> 1.0pl1 : true +1.0-dev != 1.0pl1 : true + 1.0a1 lt 1.0-dev : false + 1.0a1 < 1.0-dev : false + 1.0a1 le 1.0-dev : false + 1.0a1 <= 1.0-dev : false + 1.0a1 gt 1.0-dev : true + 1.0a1 > 1.0-dev : true + 1.0a1 ge 1.0-dev : true + 1.0a1 >= 1.0-dev : true + 1.0a1 eq 1.0-dev : false + 1.0a1 = 1.0-dev : false + 1.0a1 == 1.0-dev : false + 1.0a1 ne 1.0-dev : true + 1.0a1 <> 1.0-dev : true + 1.0a1 != 1.0-dev : true + 1.0a1 lt 1.0a1 : false + 1.0a1 < 1.0a1 : false + 1.0a1 le 1.0a1 : true + 1.0a1 <= 1.0a1 : true + 1.0a1 gt 1.0a1 : false + 1.0a1 > 1.0a1 : false + 1.0a1 ge 1.0a1 : true + 1.0a1 >= 1.0a1 : true + 1.0a1 eq 1.0a1 : true + 1.0a1 = 1.0a1 : true + 1.0a1 == 1.0a1 : true + 1.0a1 ne 1.0a1 : false + 1.0a1 <> 1.0a1 : false + 1.0a1 != 1.0a1 : false + 1.0a1 lt 1.0b1 : true + 1.0a1 < 1.0b1 : true + 1.0a1 le 1.0b1 : true + 1.0a1 <= 1.0b1 : true + 1.0a1 gt 1.0b1 : false + 1.0a1 > 1.0b1 : false + 1.0a1 ge 1.0b1 : false + 1.0a1 >= 1.0b1 : false + 1.0a1 eq 1.0b1 : false + 1.0a1 = 1.0b1 : false + 1.0a1 == 1.0b1 : false + 1.0a1 ne 1.0b1 : true + 1.0a1 <> 1.0b1 : true + 1.0a1 != 1.0b1 : true + 1.0a1 lt 1.0RC1 : true + 1.0a1 < 1.0RC1 : true + 1.0a1 le 1.0RC1 : true + 1.0a1 <= 1.0RC1 : true + 1.0a1 gt 1.0RC1 : false + 1.0a1 > 1.0RC1 : false + 1.0a1 ge 1.0RC1 : false + 1.0a1 >= 1.0RC1 : false + 1.0a1 eq 1.0RC1 : false + 1.0a1 = 1.0RC1 : false + 1.0a1 == 1.0RC1 : false + 1.0a1 ne 1.0RC1 : true + 1.0a1 <> 1.0RC1 : true + 1.0a1 != 1.0RC1 : true + 1.0a1 lt 1.0rc1 : true + 1.0a1 < 1.0rc1 : true + 1.0a1 le 1.0rc1 : true + 1.0a1 <= 1.0rc1 : true + 1.0a1 gt 1.0rc1 : false + 1.0a1 > 1.0rc1 : false + 1.0a1 ge 1.0rc1 : false + 1.0a1 >= 1.0rc1 : false + 1.0a1 eq 1.0rc1 : false + 1.0a1 = 1.0rc1 : false + 1.0a1 == 1.0rc1 : false + 1.0a1 ne 1.0rc1 : true + 1.0a1 <> 1.0rc1 : true + 1.0a1 != 1.0rc1 : true + 1.0a1 lt 1.0 : true + 1.0a1 < 1.0 : true + 1.0a1 le 1.0 : true + 1.0a1 <= 1.0 : true + 1.0a1 gt 1.0 : false + 1.0a1 > 1.0 : false + 1.0a1 ge 1.0 : false + 1.0a1 >= 1.0 : false + 1.0a1 eq 1.0 : false + 1.0a1 = 1.0 : false + 1.0a1 == 1.0 : false + 1.0a1 ne 1.0 : true + 1.0a1 <> 1.0 : true + 1.0a1 != 1.0 : true + 1.0a1 lt 1.0pl1 : true + 1.0a1 < 1.0pl1 : true + 1.0a1 le 1.0pl1 : true + 1.0a1 <= 1.0pl1 : true + 1.0a1 gt 1.0pl1 : false + 1.0a1 > 1.0pl1 : false + 1.0a1 ge 1.0pl1 : false + 1.0a1 >= 1.0pl1 : false + 1.0a1 eq 1.0pl1 : false + 1.0a1 = 1.0pl1 : false + 1.0a1 == 1.0pl1 : false + 1.0a1 ne 1.0pl1 : true + 1.0a1 <> 1.0pl1 : true + 1.0a1 != 1.0pl1 : true + 1.0b1 lt 1.0-dev : false + 1.0b1 < 1.0-dev : false + 1.0b1 le 1.0-dev : false + 1.0b1 <= 1.0-dev : false + 1.0b1 gt 1.0-dev : true + 1.0b1 > 1.0-dev : true + 1.0b1 ge 1.0-dev : true + 1.0b1 >= 1.0-dev : true + 1.0b1 eq 1.0-dev : false + 1.0b1 = 1.0-dev : false + 1.0b1 == 1.0-dev : false + 1.0b1 ne 1.0-dev : true + 1.0b1 <> 1.0-dev : true + 1.0b1 != 1.0-dev : true + 1.0b1 lt 1.0a1 : false + 1.0b1 < 1.0a1 : false + 1.0b1 le 1.0a1 : false + 1.0b1 <= 1.0a1 : false + 1.0b1 gt 1.0a1 : true + 1.0b1 > 1.0a1 : true + 1.0b1 ge 1.0a1 : true + 1.0b1 >= 1.0a1 : true + 1.0b1 eq 1.0a1 : false + 1.0b1 = 1.0a1 : false + 1.0b1 == 1.0a1 : false + 1.0b1 ne 1.0a1 : true + 1.0b1 <> 1.0a1 : true + 1.0b1 != 1.0a1 : true + 1.0b1 lt 1.0b1 : false + 1.0b1 < 1.0b1 : false + 1.0b1 le 1.0b1 : true + 1.0b1 <= 1.0b1 : true + 1.0b1 gt 1.0b1 : false + 1.0b1 > 1.0b1 : false + 1.0b1 ge 1.0b1 : true + 1.0b1 >= 1.0b1 : true + 1.0b1 eq 1.0b1 : true + 1.0b1 = 1.0b1 : true + 1.0b1 == 1.0b1 : true + 1.0b1 ne 1.0b1 : false + 1.0b1 <> 1.0b1 : false + 1.0b1 != 1.0b1 : false + 1.0b1 lt 1.0RC1 : true + 1.0b1 < 1.0RC1 : true + 1.0b1 le 1.0RC1 : true + 1.0b1 <= 1.0RC1 : true + 1.0b1 gt 1.0RC1 : false + 1.0b1 > 1.0RC1 : false + 1.0b1 ge 1.0RC1 : false + 1.0b1 >= 1.0RC1 : false + 1.0b1 eq 1.0RC1 : false + 1.0b1 = 1.0RC1 : false + 1.0b1 == 1.0RC1 : false + 1.0b1 ne 1.0RC1 : true + 1.0b1 <> 1.0RC1 : true + 1.0b1 != 1.0RC1 : true + 1.0b1 lt 1.0rc1 : true + 1.0b1 < 1.0rc1 : true + 1.0b1 le 1.0rc1 : true + 1.0b1 <= 1.0rc1 : true + 1.0b1 gt 1.0rc1 : false + 1.0b1 > 1.0rc1 : false + 1.0b1 ge 1.0rc1 : false + 1.0b1 >= 1.0rc1 : false + 1.0b1 eq 1.0rc1 : false + 1.0b1 = 1.0rc1 : false + 1.0b1 == 1.0rc1 : false + 1.0b1 ne 1.0rc1 : true + 1.0b1 <> 1.0rc1 : true + 1.0b1 != 1.0rc1 : true + 1.0b1 lt 1.0 : true + 1.0b1 < 1.0 : true + 1.0b1 le 1.0 : true + 1.0b1 <= 1.0 : true + 1.0b1 gt 1.0 : false + 1.0b1 > 1.0 : false + 1.0b1 ge 1.0 : false + 1.0b1 >= 1.0 : false + 1.0b1 eq 1.0 : false + 1.0b1 = 1.0 : false + 1.0b1 == 1.0 : false + 1.0b1 ne 1.0 : true + 1.0b1 <> 1.0 : true + 1.0b1 != 1.0 : true + 1.0b1 lt 1.0pl1 : true + 1.0b1 < 1.0pl1 : true + 1.0b1 le 1.0pl1 : true + 1.0b1 <= 1.0pl1 : true + 1.0b1 gt 1.0pl1 : false + 1.0b1 > 1.0pl1 : false + 1.0b1 ge 1.0pl1 : false + 1.0b1 >= 1.0pl1 : false + 1.0b1 eq 1.0pl1 : false + 1.0b1 = 1.0pl1 : false + 1.0b1 == 1.0pl1 : false + 1.0b1 ne 1.0pl1 : true + 1.0b1 <> 1.0pl1 : true + 1.0b1 != 1.0pl1 : true + 1.0RC1 lt 1.0-dev : false + 1.0RC1 < 1.0-dev : false + 1.0RC1 le 1.0-dev : false + 1.0RC1 <= 1.0-dev : false + 1.0RC1 gt 1.0-dev : true + 1.0RC1 > 1.0-dev : true + 1.0RC1 ge 1.0-dev : true + 1.0RC1 >= 1.0-dev : true + 1.0RC1 eq 1.0-dev : false + 1.0RC1 = 1.0-dev : false + 1.0RC1 == 1.0-dev : false + 1.0RC1 ne 1.0-dev : true + 1.0RC1 <> 1.0-dev : true + 1.0RC1 != 1.0-dev : true + 1.0RC1 lt 1.0a1 : false + 1.0RC1 < 1.0a1 : false + 1.0RC1 le 1.0a1 : false + 1.0RC1 <= 1.0a1 : false + 1.0RC1 gt 1.0a1 : true + 1.0RC1 > 1.0a1 : true + 1.0RC1 ge 1.0a1 : true + 1.0RC1 >= 1.0a1 : true + 1.0RC1 eq 1.0a1 : false + 1.0RC1 = 1.0a1 : false + 1.0RC1 == 1.0a1 : false + 1.0RC1 ne 1.0a1 : true + 1.0RC1 <> 1.0a1 : true + 1.0RC1 != 1.0a1 : true + 1.0RC1 lt 1.0b1 : false + 1.0RC1 < 1.0b1 : false + 1.0RC1 le 1.0b1 : false + 1.0RC1 <= 1.0b1 : false + 1.0RC1 gt 1.0b1 : true + 1.0RC1 > 1.0b1 : true + 1.0RC1 ge 1.0b1 : true + 1.0RC1 >= 1.0b1 : true + 1.0RC1 eq 1.0b1 : false + 1.0RC1 = 1.0b1 : false + 1.0RC1 == 1.0b1 : false + 1.0RC1 ne 1.0b1 : true + 1.0RC1 <> 1.0b1 : true + 1.0RC1 != 1.0b1 : true + 1.0RC1 lt 1.0RC1 : false + 1.0RC1 < 1.0RC1 : false + 1.0RC1 le 1.0RC1 : true + 1.0RC1 <= 1.0RC1 : true + 1.0RC1 gt 1.0RC1 : false + 1.0RC1 > 1.0RC1 : false + 1.0RC1 ge 1.0RC1 : true + 1.0RC1 >= 1.0RC1 : true + 1.0RC1 eq 1.0RC1 : true + 1.0RC1 = 1.0RC1 : true + 1.0RC1 == 1.0RC1 : true + 1.0RC1 ne 1.0RC1 : false + 1.0RC1 <> 1.0RC1 : false + 1.0RC1 != 1.0RC1 : false + 1.0RC1 lt 1.0rc1 : false + 1.0RC1 < 1.0rc1 : false + 1.0RC1 le 1.0rc1 : true + 1.0RC1 <= 1.0rc1 : true + 1.0RC1 gt 1.0rc1 : false + 1.0RC1 > 1.0rc1 : false + 1.0RC1 ge 1.0rc1 : true + 1.0RC1 >= 1.0rc1 : true + 1.0RC1 eq 1.0rc1 : true + 1.0RC1 = 1.0rc1 : true + 1.0RC1 == 1.0rc1 : true + 1.0RC1 ne 1.0rc1 : false + 1.0RC1 <> 1.0rc1 : false + 1.0RC1 != 1.0rc1 : false + 1.0RC1 lt 1.0 : true + 1.0RC1 < 1.0 : true + 1.0RC1 le 1.0 : true + 1.0RC1 <= 1.0 : true + 1.0RC1 gt 1.0 : false + 1.0RC1 > 1.0 : false + 1.0RC1 ge 1.0 : false + 1.0RC1 >= 1.0 : false + 1.0RC1 eq 1.0 : false + 1.0RC1 = 1.0 : false + 1.0RC1 == 1.0 : false + 1.0RC1 ne 1.0 : true + 1.0RC1 <> 1.0 : true + 1.0RC1 != 1.0 : true + 1.0RC1 lt 1.0pl1 : true + 1.0RC1 < 1.0pl1 : true + 1.0RC1 le 1.0pl1 : true + 1.0RC1 <= 1.0pl1 : true + 1.0RC1 gt 1.0pl1 : false + 1.0RC1 > 1.0pl1 : false + 1.0RC1 ge 1.0pl1 : false + 1.0RC1 >= 1.0pl1 : false + 1.0RC1 eq 1.0pl1 : false + 1.0RC1 = 1.0pl1 : false + 1.0RC1 == 1.0pl1 : false + 1.0RC1 ne 1.0pl1 : true + 1.0RC1 <> 1.0pl1 : true + 1.0RC1 != 1.0pl1 : true + 1.0rc1 lt 1.0-dev : false + 1.0rc1 < 1.0-dev : false + 1.0rc1 le 1.0-dev : false + 1.0rc1 <= 1.0-dev : false + 1.0rc1 gt 1.0-dev : true + 1.0rc1 > 1.0-dev : true + 1.0rc1 ge 1.0-dev : true + 1.0rc1 >= 1.0-dev : true + 1.0rc1 eq 1.0-dev : false + 1.0rc1 = 1.0-dev : false + 1.0rc1 == 1.0-dev : false + 1.0rc1 ne 1.0-dev : true + 1.0rc1 <> 1.0-dev : true + 1.0rc1 != 1.0-dev : true + 1.0rc1 lt 1.0a1 : false + 1.0rc1 < 1.0a1 : false + 1.0rc1 le 1.0a1 : false + 1.0rc1 <= 1.0a1 : false + 1.0rc1 gt 1.0a1 : true + 1.0rc1 > 1.0a1 : true + 1.0rc1 ge 1.0a1 : true + 1.0rc1 >= 1.0a1 : true + 1.0rc1 eq 1.0a1 : false + 1.0rc1 = 1.0a1 : false + 1.0rc1 == 1.0a1 : false + 1.0rc1 ne 1.0a1 : true + 1.0rc1 <> 1.0a1 : true + 1.0rc1 != 1.0a1 : true + 1.0rc1 lt 1.0b1 : false + 1.0rc1 < 1.0b1 : false + 1.0rc1 le 1.0b1 : false + 1.0rc1 <= 1.0b1 : false + 1.0rc1 gt 1.0b1 : true + 1.0rc1 > 1.0b1 : true + 1.0rc1 ge 1.0b1 : true + 1.0rc1 >= 1.0b1 : true + 1.0rc1 eq 1.0b1 : false + 1.0rc1 = 1.0b1 : false + 1.0rc1 == 1.0b1 : false + 1.0rc1 ne 1.0b1 : true + 1.0rc1 <> 1.0b1 : true + 1.0rc1 != 1.0b1 : true + 1.0rc1 lt 1.0RC1 : false + 1.0rc1 < 1.0RC1 : false + 1.0rc1 le 1.0RC1 : true + 1.0rc1 <= 1.0RC1 : true + 1.0rc1 gt 1.0RC1 : false + 1.0rc1 > 1.0RC1 : false + 1.0rc1 ge 1.0RC1 : true + 1.0rc1 >= 1.0RC1 : true + 1.0rc1 eq 1.0RC1 : true + 1.0rc1 = 1.0RC1 : true + 1.0rc1 == 1.0RC1 : true + 1.0rc1 ne 1.0RC1 : false + 1.0rc1 <> 1.0RC1 : false + 1.0rc1 != 1.0RC1 : false + 1.0rc1 lt 1.0rc1 : false + 1.0rc1 < 1.0rc1 : false + 1.0rc1 le 1.0rc1 : true + 1.0rc1 <= 1.0rc1 : true + 1.0rc1 gt 1.0rc1 : false + 1.0rc1 > 1.0rc1 : false + 1.0rc1 ge 1.0rc1 : true + 1.0rc1 >= 1.0rc1 : true + 1.0rc1 eq 1.0rc1 : true + 1.0rc1 = 1.0rc1 : true + 1.0rc1 == 1.0rc1 : true + 1.0rc1 ne 1.0rc1 : false + 1.0rc1 <> 1.0rc1 : false + 1.0rc1 != 1.0rc1 : false + 1.0rc1 lt 1.0 : true + 1.0rc1 < 1.0 : true + 1.0rc1 le 1.0 : true + 1.0rc1 <= 1.0 : true + 1.0rc1 gt 1.0 : false + 1.0rc1 > 1.0 : false + 1.0rc1 ge 1.0 : false + 1.0rc1 >= 1.0 : false + 1.0rc1 eq 1.0 : false + 1.0rc1 = 1.0 : false + 1.0rc1 == 1.0 : false + 1.0rc1 ne 1.0 : true + 1.0rc1 <> 1.0 : true + 1.0rc1 != 1.0 : true + 1.0rc1 lt 1.0pl1 : true + 1.0rc1 < 1.0pl1 : true + 1.0rc1 le 1.0pl1 : true + 1.0rc1 <= 1.0pl1 : true + 1.0rc1 gt 1.0pl1 : false + 1.0rc1 > 1.0pl1 : false + 1.0rc1 ge 1.0pl1 : false + 1.0rc1 >= 1.0pl1 : false + 1.0rc1 eq 1.0pl1 : false + 1.0rc1 = 1.0pl1 : false + 1.0rc1 == 1.0pl1 : false + 1.0rc1 ne 1.0pl1 : true + 1.0rc1 <> 1.0pl1 : true + 1.0rc1 != 1.0pl1 : true + 1.0 lt 1.0-dev : false + 1.0 < 1.0-dev : false + 1.0 le 1.0-dev : false + 1.0 <= 1.0-dev : false + 1.0 gt 1.0-dev : true + 1.0 > 1.0-dev : true + 1.0 ge 1.0-dev : true + 1.0 >= 1.0-dev : true + 1.0 eq 1.0-dev : false + 1.0 = 1.0-dev : false + 1.0 == 1.0-dev : false + 1.0 ne 1.0-dev : true + 1.0 <> 1.0-dev : true + 1.0 != 1.0-dev : true + 1.0 lt 1.0a1 : false + 1.0 < 1.0a1 : false + 1.0 le 1.0a1 : false + 1.0 <= 1.0a1 : false + 1.0 gt 1.0a1 : true + 1.0 > 1.0a1 : true + 1.0 ge 1.0a1 : true + 1.0 >= 1.0a1 : true + 1.0 eq 1.0a1 : false + 1.0 = 1.0a1 : false + 1.0 == 1.0a1 : false + 1.0 ne 1.0a1 : true + 1.0 <> 1.0a1 : true + 1.0 != 1.0a1 : true + 1.0 lt 1.0b1 : false + 1.0 < 1.0b1 : false + 1.0 le 1.0b1 : false + 1.0 <= 1.0b1 : false + 1.0 gt 1.0b1 : true + 1.0 > 1.0b1 : true + 1.0 ge 1.0b1 : true + 1.0 >= 1.0b1 : true + 1.0 eq 1.0b1 : false + 1.0 = 1.0b1 : false + 1.0 == 1.0b1 : false + 1.0 ne 1.0b1 : true + 1.0 <> 1.0b1 : true + 1.0 != 1.0b1 : true + 1.0 lt 1.0RC1 : false + 1.0 < 1.0RC1 : false + 1.0 le 1.0RC1 : false + 1.0 <= 1.0RC1 : false + 1.0 gt 1.0RC1 : true + 1.0 > 1.0RC1 : true + 1.0 ge 1.0RC1 : true + 1.0 >= 1.0RC1 : true + 1.0 eq 1.0RC1 : false + 1.0 = 1.0RC1 : false + 1.0 == 1.0RC1 : false + 1.0 ne 1.0RC1 : true + 1.0 <> 1.0RC1 : true + 1.0 != 1.0RC1 : true + 1.0 lt 1.0rc1 : false + 1.0 < 1.0rc1 : false + 1.0 le 1.0rc1 : false + 1.0 <= 1.0rc1 : false + 1.0 gt 1.0rc1 : true + 1.0 > 1.0rc1 : true + 1.0 ge 1.0rc1 : true + 1.0 >= 1.0rc1 : true + 1.0 eq 1.0rc1 : false + 1.0 = 1.0rc1 : false + 1.0 == 1.0rc1 : false + 1.0 ne 1.0rc1 : true + 1.0 <> 1.0rc1 : true + 1.0 != 1.0rc1 : true + 1.0 lt 1.0 : false + 1.0 < 1.0 : false + 1.0 le 1.0 : true + 1.0 <= 1.0 : true + 1.0 gt 1.0 : false + 1.0 > 1.0 : false + 1.0 ge 1.0 : true + 1.0 >= 1.0 : true + 1.0 eq 1.0 : true + 1.0 = 1.0 : true + 1.0 == 1.0 : true + 1.0 ne 1.0 : false + 1.0 <> 1.0 : false + 1.0 != 1.0 : false + 1.0 lt 1.0pl1 : true + 1.0 < 1.0pl1 : true + 1.0 le 1.0pl1 : true + 1.0 <= 1.0pl1 : true + 1.0 gt 1.0pl1 : false + 1.0 > 1.0pl1 : false + 1.0 ge 1.0pl1 : false + 1.0 >= 1.0pl1 : false + 1.0 eq 1.0pl1 : false + 1.0 = 1.0pl1 : false + 1.0 == 1.0pl1 : false + 1.0 ne 1.0pl1 : true + 1.0 <> 1.0pl1 : true + 1.0 != 1.0pl1 : true + 1.0pl1 lt 1.0-dev : false + 1.0pl1 < 1.0-dev : false + 1.0pl1 le 1.0-dev : false + 1.0pl1 <= 1.0-dev : false + 1.0pl1 gt 1.0-dev : true + 1.0pl1 > 1.0-dev : true + 1.0pl1 ge 1.0-dev : true + 1.0pl1 >= 1.0-dev : true + 1.0pl1 eq 1.0-dev : false + 1.0pl1 = 1.0-dev : false + 1.0pl1 == 1.0-dev : false + 1.0pl1 ne 1.0-dev : true + 1.0pl1 <> 1.0-dev : true + 1.0pl1 != 1.0-dev : true + 1.0pl1 lt 1.0a1 : false + 1.0pl1 < 1.0a1 : false + 1.0pl1 le 1.0a1 : false + 1.0pl1 <= 1.0a1 : false + 1.0pl1 gt 1.0a1 : true + 1.0pl1 > 1.0a1 : true + 1.0pl1 ge 1.0a1 : true + 1.0pl1 >= 1.0a1 : true + 1.0pl1 eq 1.0a1 : false + 1.0pl1 = 1.0a1 : false + 1.0pl1 == 1.0a1 : false + 1.0pl1 ne 1.0a1 : true + 1.0pl1 <> 1.0a1 : true + 1.0pl1 != 1.0a1 : true + 1.0pl1 lt 1.0b1 : false + 1.0pl1 < 1.0b1 : false + 1.0pl1 le 1.0b1 : false + 1.0pl1 <= 1.0b1 : false + 1.0pl1 gt 1.0b1 : true + 1.0pl1 > 1.0b1 : true + 1.0pl1 ge 1.0b1 : true + 1.0pl1 >= 1.0b1 : true + 1.0pl1 eq 1.0b1 : false + 1.0pl1 = 1.0b1 : false + 1.0pl1 == 1.0b1 : false + 1.0pl1 ne 1.0b1 : true + 1.0pl1 <> 1.0b1 : true + 1.0pl1 != 1.0b1 : true + 1.0pl1 lt 1.0RC1 : false + 1.0pl1 < 1.0RC1 : false + 1.0pl1 le 1.0RC1 : false + 1.0pl1 <= 1.0RC1 : false + 1.0pl1 gt 1.0RC1 : true + 1.0pl1 > 1.0RC1 : true + 1.0pl1 ge 1.0RC1 : true + 1.0pl1 >= 1.0RC1 : true + 1.0pl1 eq 1.0RC1 : false + 1.0pl1 = 1.0RC1 : false + 1.0pl1 == 1.0RC1 : false + 1.0pl1 ne 1.0RC1 : true + 1.0pl1 <> 1.0RC1 : true + 1.0pl1 != 1.0RC1 : true + 1.0pl1 lt 1.0rc1 : false + 1.0pl1 < 1.0rc1 : false + 1.0pl1 le 1.0rc1 : false + 1.0pl1 <= 1.0rc1 : false + 1.0pl1 gt 1.0rc1 : true + 1.0pl1 > 1.0rc1 : true + 1.0pl1 ge 1.0rc1 : true + 1.0pl1 >= 1.0rc1 : true + 1.0pl1 eq 1.0rc1 : false + 1.0pl1 = 1.0rc1 : false + 1.0pl1 == 1.0rc1 : false + 1.0pl1 ne 1.0rc1 : true + 1.0pl1 <> 1.0rc1 : true + 1.0pl1 != 1.0rc1 : true + 1.0pl1 lt 1.0 : false + 1.0pl1 < 1.0 : false + 1.0pl1 le 1.0 : false + 1.0pl1 <= 1.0 : false + 1.0pl1 gt 1.0 : true + 1.0pl1 > 1.0 : true + 1.0pl1 ge 1.0 : true + 1.0pl1 >= 1.0 : true + 1.0pl1 eq 1.0 : false + 1.0pl1 = 1.0 : false + 1.0pl1 == 1.0 : false + 1.0pl1 ne 1.0 : true + 1.0pl1 <> 1.0 : true + 1.0pl1 != 1.0 : true + 1.0pl1 lt 1.0pl1 : false + 1.0pl1 < 1.0pl1 : false + 1.0pl1 le 1.0pl1 : true + 1.0pl1 <= 1.0pl1 : true + 1.0pl1 gt 1.0pl1 : false + 1.0pl1 > 1.0pl1 : false + 1.0pl1 ge 1.0pl1 : true + 1.0pl1 >= 1.0pl1 : true + 1.0pl1 eq 1.0pl1 : true + 1.0pl1 = 1.0pl1 : true + 1.0pl1 == 1.0pl1 : true + 1.0pl1 ne 1.0pl1 : false + 1.0pl1 <> 1.0pl1 : false + 1.0pl1 != 1.0pl1 : false \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug22403.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug22403.phpt new file mode 100644 index 0000000000000..5e0669e639d93 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug22403.phpt @@ -0,0 +1,88 @@ +--TEST-- +Sybase-CT bug #22403 (crash when executing a stored procedure without parameters) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +Stored procedure %s +bool(true) +>>> Query: exec %s +*** Caught Sybase Server Message #201 [Severity 16, state 2] at line 0 + %s +<<< Return: boolean +bool(false) +>>> Query: exec %s "foo" +*** Caught Sybase Server Message #257 [Severity 16, state 1] at line 0 + %s +<<< Return: boolean +bool(false) +>>> Query: exec does_not_exist +*** Caught Sybase Server Message #2812 [Severity 16, state %d] at line 1 + %s +<<< Return: boolean +bool(false) +>>> Query: exec %s NULL +<<< Return: resource +array(1) { + [0]=> + array(1) { + ["computed"]=> + NULL + } +} +>>> Query: exec %s 1 +<<< Return: resource +array(1) { + [0]=> + array(1) { + ["computed"]=> + int(1) + } +} +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug26407.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug26407.phpt new file mode 100644 index 0000000000000..f5ea2e5911589 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug26407.phpt @@ -0,0 +1,91 @@ +--TEST-- +Sybase-CT bug #26407 (Result set fetching broken around transactions) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +>>> Query: + begin transaction + -- anything producing a result set here will fail; + -- however, print or update statements will work + select "foo" + commit + -- anything afterwards will fail, too + +<<< Return: resource +array(1) { + [0]=> + array(1) { + ["computed"]=> + string(3) "foo" + } +} +>>> Query: + begin transaction + -- no result returned... + update #phpt_bug26407 set the_big_answer=42 + commit + +<<< Return: boolean +bool(true) +>>> Query: + select "foo" + begin transaction + -- do anything, even return a result set + commit + select "bar" + + +Notice: sybase_query(): Sybase: Unexpected results, cancelling current in %stest.inc on line %d +<<< Return: resource +array(1) { + [0]=> + array(1) { + ["computed"]=> + string(3) "foo" + } +} diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug27843.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug27843.phpt new file mode 100644 index 0000000000000..4705c5f0150f6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug27843.phpt @@ -0,0 +1,54 @@ +--TEST-- +Sybase-CT bug #27843 (notices when query is a stored procedure) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +Stored procedure %s +bool(true) +>>> Query: exec phpt_bug27843 +<<< Return: resource +array(1) { + [0]=> + array(1) { + ["computed"]=> + int(1) + } +} +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug28354.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug28354.phpt new file mode 100644 index 0000000000000..08f3a53c7c4ee --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug28354.phpt @@ -0,0 +1,46 @@ +--TEST-- +Sybase-CT bug #28354 (sybase_free_result crash) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +Stored procedure %s +bool(true) +int(0) +string(%d) "%s" diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug29064.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug29064.phpt new file mode 100644 index 0000000000000..97596fff27d37 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug29064.phpt @@ -0,0 +1,143 @@ +--TEST-- +Sybase-CT bug #29064 (Exact numeric/decimal/money datatypes lose precision) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) +bool(true) +>>> Query: select * from #test +<<< Return: resource +array(2) { + [0]=> + array(10) { + ["test_decimal"]=> + string(39) "12345678901234567890123456789012.123456" + ["test_numeric"]=> + string(39) "12345678901234567890123456.123456789012" + ["test_money"]=> + string(18) "123456789012345.12" + ["test_bigint"]=> + string(38) "12345678901234567890123456789012345678" + ["test_int"]=> + int(1234567890) + ["test_smallmoney"]=> + float(123456.12) + ["test_smallint"]=> + int(12345) + ["test_tinyint"]=> + int(123) + ["test_real"]=> + string(16) "123456789.123457" + ["test_double"]=> + string(16) "123456789.123457" + } + [1]=> + array(10) { + ["test_decimal"]=> + string(40) "-12345678901234567890123456789012.123456" + ["test_numeric"]=> + string(40) "-12345678901234567890123456.123456789012" + ["test_money"]=> + string(19) "-123456789012345.12" + ["test_bigint"]=> + string(39) "-12345678901234567890123456789012345678" + ["test_int"]=> + int(-1234567890) + ["test_smallmoney"]=> + float(-123456.12) + ["test_smallint"]=> + int(-12345) + ["test_tinyint"]=> + int(255) + ["test_real"]=> + string(17) "-123456789.123457" + ["test_double"]=> + string(17) "-123456789.123457" + } +} +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug30312.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug30312.phpt new file mode 100644 index 0000000000000..c71a39e86c903 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug30312.phpt @@ -0,0 +1,27 @@ +--TEST-- +Sybase-CT bug #30312 (sybase_unbuffered_query calls) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(%d) "%s %d %d %d:%d%s" +string(%d) "%s %d %d %d:%d%s" diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug6339.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug6339.phpt new file mode 100644 index 0000000000000..0ebfab4a384df --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/bug6339.phpt @@ -0,0 +1,24 @@ +--TEST-- +Sybase-CT bug #6339 (invalid Sybase-link resource) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(1) { + [0]=> + int(1) +} diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/index.php b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/index.php new file mode 100644 index 0000000000000..8905ac77c6b47 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/index.php @@ -0,0 +1,216 @@ +expected= $expected; + } + + function matches($output) { } + } + // }}} + + // {{{ class PHPTRegexExpectancy + // Expectancy class for regular expressions + class PHPTRegexExpectancy extends PHPTExpectancy { + + function matches($output) { + return preg_match('°^'.strtr(preg_quote(rtrim($this->expected), '°'), array( + '%s' => '(.+)', + '%d' => '([0-9]+)' + )).'°', $output); + } + } + // }}} + + // {{{ class PHPTTest + // Represents a single .phpt-style test + class PHPTTest { + var + $name = '', + $description = '', + $skipif = '', + $code = '', + $expectancy = NULL, + $output = ''; + + function &fromFile($filename) { + $fd= fopen($filename, 'r'); + + $sections= array(); + $current= NULL; + while (!feof($fd)) { + $line= fgets($fd, 0xFFFF); + if (1 == sscanf($line, '--%[^-]--', $section)) { + $sections[$section]= ''; + $current= $section; + continue; + } + $sections[$current].= $line; + } + fclose($fd); + + // Create instance from read data and return it + $t= &new PHPTTest(); { + $t->name= substr(realpath($filename), 0, -1); + $t->description= rtrim($sections['TEST']); + $t->skipif= $sections['SKIPIF']; + $t->code= $sections['FILE']; + + if (isset($sections['EXPECTF'])) { + $t->expectancy= &new PHPTRegexExpectancy($sections['EXPECTF']); + } else { + // XXX TBI XXX + } + } + return $t; + } + + function onError($errno, $errstr, $errfile, $errline) { + static $names= array( + E_NOTICE => 'Notice', + E_WARNING => 'Warning' + ); + + if (!(error_reporting() & $errno)) return; + printf( + "\n%s: %s in %s on line %d\n", + $names[$errno], + $errstr, + strstr($errfile, 'eval()\'d code') ? $this->name : $errfile, + $errline + ); + } + + function run() { + + // Precondition check - will die if test needs to be skipped + eval('?>'.$this->skipif); + + set_error_handler(array(&$this, 'onError')); { + error_reporting(E_ALL); + + ob_start(); + eval('?>'.$this->code); + $this->output= rtrim(ob_get_contents()); + ob_end_clean(); + } restore_error_handler(); + + return $this->expectancy->matches($this->output); + } + } + // }}} + + // {{{ main + if (isset($_GET['phpinfo'])) { + phpinfo((int)$_GET['phpinfo']); + + echo 'Home'; + exit(); + } + + echo <<<__ + + + PHPT Test + + + +__; + + $test= basename($_SERVER['QUERY_STRING']); + if ($test && file_exists($test)) { + $t= &PHPTTest::fromFile($test); + echo '

    '.basename($t->name), ': ', $t->description.'

    '; + echo 'Back to test suite'; + flush(); + + // Run the test + $result= $t->run(); + + // Evaluate results + if ($result) { + echo '

    Passed

    '; + } else { + echo '

    Failed


    '; + + echo '

    Actual output

    '; + echo '', $t->output, '
    '; + + echo '

    Expectancy

    '; + echo '', $t->expectancy->expected, ''; + } + + echo '
    '; + exit(); + } + + echo '

    Test suite

    '; + + // phpinfo() links + echo 'phpinfo(): '; + foreach (array( + 1 => 'General', + 4 => 'Configuration', + 8 => 'Modules' + ) as $const => $name) { + printf('%s | ', $const, $name); + } + echo '(All)'; + + echo '

    Select one to run

    '; + echo '
      '; + $d= dir(dirname(__FILE__)); + while ($entry= $d->read()) { + if ('.phpt' != substr($entry, -5)) continue; + echo '
    • '.$entry.'
    • '; + } + $d->close(); + echo '

    '; + + echo <<<__ + + +__; + // }}} +?> diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/skipif.inc b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/skipif.inc new file mode 100644 index 0000000000000..ac5fa2fe5258f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/skipif.inc @@ -0,0 +1,8 @@ + diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test.inc b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test.inc new file mode 100644 index 0000000000000..f5e4465a63379 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test.inc @@ -0,0 +1,86 @@ +>> Query: %s\n", $query); + $h= sybase_query($query, $dbh); + printf("<<< Return: %s\n", gettype($h)); + flush(); + if (!is_resource($h)) return $h; + + $return= array(); + while ($row= sybase_fetch_assoc($h)) { + $return[]= $row; + } + return $return; + } + + // {{{ mixed sybase_select_single(resource dbh, string query) + // Fires an SQL query and returns the first value from the first row + function sybase_select_single($dbh, $query) { + $a = sybase_fetch_row(sybase_query($query, $dbh)); + return array_shift($a); + } + // }}} +?> diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_appname.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_appname.phpt new file mode 100644 index 0000000000000..d409ae222c928 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_appname.phpt @@ -0,0 +1,65 @@ +--TEST-- +Sybase-CT application name +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +>>> Query: + select + hostname, + program_name + from + master..sysprocesses + where + program_name = "phpt_test" +<<< Return: resource +array(1) { + [0]=> + array(2) { + ["hostname"]=> + string(10) "php.net%s" + ["program_name"]=> + string(16) "phpt_test%s" + } +} +bool(true) +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_connect.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_connect.phpt new file mode 100644 index 0000000000000..90db5857ec852 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_connect.phpt @@ -0,0 +1,19 @@ +--TEST-- +Sybase-CT connectivity +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +resource(%d) of type (sybase-ct link) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_connectionbased_msghandler.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_connectionbased_msghandler.phpt new file mode 100644 index 0000000000000..548e7b5b1d4fa --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_connectionbased_msghandler.phpt @@ -0,0 +1,27 @@ +--TEST-- +Sybase-CT connection-based server message handler +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +resource(%d) of type (sybase-ct link) +bool(true) +>>> Query: select getdate(NULL) +*** Caught Sybase Server Message #%d [Severity %d, state %d] at line %d + %s +<<< Return: boolean +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_fetch_object.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_fetch_object.phpt new file mode 100644 index 0000000000000..cd7c2c2e3d828 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_fetch_object.phpt @@ -0,0 +1,74 @@ +--TEST-- +Sybase-CT sybase_fetch_object +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +stdClass::__set_state(array( + 'id' => 1, + 'caption' => 'Hello', + 'author' => 'timm', + 'lastchange' => '%s', +)) +article::__set_state(array( + 'id' => 1, + 'caption' => 'Hello', + 'author' => 'timm', + 'lastchange' => '%s', +)) +article::__set_state(array( + 'id' => 1, + 'caption' => 'Hello', + 'author' => 'timm', + 'lastchange' => '%s', +)) + +Notice: sybase_fetch_object(): Sybase: Class *** has not been declared in %stest_fetch_object.php on line %d +stdClass::__set_state(array( + 'id' => 1, + 'caption' => 'Hello', + 'author' => 'timm', + 'lastchange' => '%s', +)) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_fields.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_fields.phpt new file mode 100644 index 0000000000000..eef9411486fbd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_fields.phpt @@ -0,0 +1,76 @@ +--TEST-- +Sybase-CT sybase_field_* functions +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +resource(%d) of type (sybase-ct result) +int(4) +stdClass::__set_state(array( + 'name' => 'id', + 'max_length' => 11, + 'column_source' => '', + 'numeric' => 1, + 'type' => 'int', +)) +stdClass::__set_state(array( + 'name' => 'caption', + 'max_length' => 5, + 'column_source' => '', + 'numeric' => 0, + 'type' => 'string', +)) +stdClass::__set_state(array( + 'name' => 'author', + 'max_length' => 4, + 'column_source' => '', + 'numeric' => 0, + 'type' => 'string', +)) +stdClass::__set_state(array( + 'name' => 'lastchange', + 'max_length' => 29, + 'column_source' => '', + 'numeric' => 0, + 'type' => 'datetime', +)) +bool(true) +stdClass::__set_state(array( + 'name' => 'caption', + 'max_length' => 5, + 'column_source' => '', + 'numeric' => 0, + 'type' => 'string', +)) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_long.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_long.phpt new file mode 100644 index 0000000000000..512202cd15d4c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_long.phpt @@ -0,0 +1,80 @@ +--TEST-- +Sybase-CT select LONG_MAX / LONG_MIN +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +>>> Query: select value from test_long +<<< Return: resource +array(6) { + [0]=> + array(1) { + ["value"]=> + int(%s) + } + [1]=> + array(1) { + ["value"]=> + int(%s) + } + [2]=> + array(1) { + ["value"]=> + float(%s) + } + [3]=> + array(1) { + ["value"]=> + int(-%s) + } + [4]=> + array(1) { + ["value"]=> + int(-%s) + } + [5]=> + array(1) { + ["value"]=> + float(-%s) + } +} +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_msghandler.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_msghandler.phpt new file mode 100644 index 0000000000000..fcbcb71f387ac --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_msghandler.phpt @@ -0,0 +1,43 @@ +--TEST-- +Sybase-CT server message handler +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Nonexistant: +Warning: sybase_set_message_handler(): First argumented is expected to be a valid callback, 'function_does_not_exist' was given in %stest.inc on line %d +bool(false) +Static method: bool(true) +Instance method: bool(true) +Lambda function: bool(true) +Unset: bool(true) +Incorrect type: +Warning: sybase_set_message_handler(): First argumented is expected to be either NULL, an array or string, integer given in %stest.inc on line %d +bool(false) +Function: bool(true) +>>> Query: select getdate(NULL) +*** Caught Sybase Server Message #%d [Severity %d, state %d] at line %d + %s +<<< Return: boolean +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_msghandler_handled.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_msghandler_handled.phpt new file mode 100644 index 0000000000000..67eced430876c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_msghandler_handled.phpt @@ -0,0 +1,69 @@ +--TEST-- +Sybase-CT server message handler +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +>>> Query: select getdate(NULL) +*** Caught '%s' +<<< Return: boolean +bool(false) +>>> Query: print "Hi" +!!! Hi +<<< Return: boolean +bool(true) +>>> Query: use NULL +Cannot handle message #156 + +Warning: sybase_query(): Sybase: Server message: Incorrect syntax near the keyword 'NULL'. + (severity 15, procedure N/A) in %s on line %d +<<< Return: boolean +bool(false) +>>> Query: select convert(datetime, "notadate") +Cannot handle message #249 + +Warning: sybase_query(): Sybase: Server message: Syntax error during explicit conversion of VARCHAR value 'notadate' to a DATETIME field. + (severity 16, procedure N/A) in %s on line %d +<<< Return: boolean +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_query_nostore.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_query_nostore.phpt new file mode 100644 index 0000000000000..690dc5e25a008 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_query_nostore.phpt @@ -0,0 +1,98 @@ +--TEST-- +Sybase-CT query without storing +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) +bool(true) +bool(true) +resource(%d) of type (sybase-ct result) +array(5) { + ["id"]=> + int(1) + ["caption"]=> + string(5) "Hello" + ["author"]=> + string(4) "timm" + ["link"]=> + NULL + ["lastchange"]=> + string(%d) "%s" +} +array(5) { + ["id"]=> + int(2) + ["caption"]=> + string(5) "World" + ["author"]=> + string(6) "thekid" + ["link"]=> + string(17) "http://thekid.de/" + ["lastchange"]=> + string(%d) "%s" +} +array(5) { + ["id"]=> + int(3) + ["caption"]=> + string(3) "PHP" + ["author"]=> + string(6) "friebe" + ["link"]=> + NULL + ["lastchange"]=> + string(%d) "%s" +} +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_types.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_types.phpt new file mode 100644 index 0000000000000..27a843a9c5938 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_types.phpt @@ -0,0 +1,87 @@ +--TEST-- +Sybase-CT select and types +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +>>> Query: select + 1 as "integer", + -%s as "integer_min", + -%s as "integer_min_exceed", + %s as "integer_max", + %s as "integer_max_exceed", + 1.0 as "float", + 12345678901234567890123456789012.123456 as "large_float", + $22.36 as "money", + "Binford" as "string", + convert(datetime, "2004-01-23") as "date", + NULL as "null", + convert(bit, 1) as "bit", + convert(smalldatetime, "2004-01-23") as "smalldate", + convert(char(10), "char") as "char10" + +<<< Return: resource +array(1) { + [0]=> + array(%d) { + ["integer"]=> + int(1) + ["integer_min"]=> + int(-%s) + ["integer_min_exceed"]=> + float(-%s) + ["integer_max"]=> + int(%s) + ["integer_max_exceed"]=> + float(%s) + ["float"]=> + float(1) + ["large_float"]=> + string(39) "12345678901234567890123456789012.123456" + ["money"]=> + float(22.36) + ["string"]=> + string(7) "Binford" + ["date"]=> + string(19) "Jan 23 2004 12:00AM" + ["null"]=> + NULL + ["bit"]=> + int(1) + ["smalldate"]=> + string(19) "Jan 23 2004 12:00AM" + ["char10"]=> + string(10) "char " + } +} diff --git a/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_unbuffered_query.phpt b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_unbuffered_query.phpt new file mode 100644 index 0000000000000..1270081e0a88f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sybase_ct/tests/test_unbuffered_query.phpt @@ -0,0 +1,57 @@ +--TEST-- +Sybase-CT unbuffered query +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +resource(%d) of type (sybase-ct link) +resource(%d) of type (sybase-ct result) +int(%d) +int(%d) +bool(true) +resource(%d) of type (sybase-ct result) +resource(%d) of type (Unknown) + +Warning: sybase_num_rows(): %d is not a valid Sybase result resource in %stest_unbuffered_query.php on line %d +bool(true) +resource(%d) of type (sybase-ct result) +int(%d) +int(%d) +int(4) diff --git a/phpt/tests/php-5.2.5/ext/sysvmsg/tests/001.phpt b/phpt/tests/php-5.2.5/ext/sysvmsg/tests/001.phpt new file mode 100644 index 0000000000000..d3a5b1e3e6d61 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sysvmsg/tests/001.phpt @@ -0,0 +1,22 @@ +--TEST-- +send/receive serialized message. +--SKIPIF-- + +--FILE-- + +--EXPECT-- +TYPE: 1 +DATA: hello diff --git a/phpt/tests/php-5.2.5/ext/sysvmsg/tests/002.phpt b/phpt/tests/php-5.2.5/ext/sysvmsg/tests/002.phpt new file mode 100644 index 0000000000000..e603ed02b5e04 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sysvmsg/tests/002.phpt @@ -0,0 +1,23 @@ +--TEST-- +msg_receive() should return false when unserialize() failed +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: msg_receive(): message corrupted in %s002.php on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/sysvsem/tests/sysv.phpt b/phpt/tests/php-5.2.5/ext/sysvsem/tests/sysv.phpt new file mode 100644 index 0000000000000..f7d95f7f48f00 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sysvsem/tests/sysv.phpt @@ -0,0 +1,114 @@ +--TEST-- +General semaphore and shared memory test +--SKIPIF-- + +--INI-- +magic_quotes_runtime=0 +--FILE-- + +--EXPECTF-- +Start. +Got semaphore Resource id #%i. +Success aquire semaphore Resource id #%i. +Success to attach shared memory : %i. +Write var1 to shared memory. +Write var2 to shared memory. +Read var1=Variable 1. +Read var2=Variable 2. +Semaphore Resource id #%i released. +Shared memory successfully removed from SysV. +semaphore removed successfully from SysV. +End. diff --git a/phpt/tests/php-5.2.5/ext/sysvshm/tests/001.phpt b/phpt/tests/php-5.2.5/ext/sysvshm/tests/001.phpt new file mode 100644 index 0000000000000..5228265d223f0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sysvshm/tests/001.phpt @@ -0,0 +1,42 @@ +--TEST-- +ftok() tests +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for ftok() in %s on line %d +NULL + +Warning: Wrong parameter count for ftok() in %s on line %d +NULL + +Warning: Wrong parameter count for ftok() in %s on line %d +NULL + +Warning: ftok(): Pathname is invalid in %s on line %d +int(-1) + +Warning: ftok(): Project identifier is invalid in %s on line %d +int(-1) + +Warning: ftok(): Project identifier is invalid in %s on line %d +int(-1) + +Warning: ftok(): ftok() failed - No such file or directory in %s on line %d +int(-1) +int(%d) +Done diff --git a/phpt/tests/php-5.2.5/ext/sysvshm/tests/002.phpt b/phpt/tests/php-5.2.5/ext/sysvshm/tests/002.phpt new file mode 100644 index 0000000000000..21651dee58278 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sysvshm/tests/002.phpt @@ -0,0 +1,67 @@ +--TEST-- +shm_attach() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for shm_attach() in %s/sysvshm/tests/002.php on line %d +NULL + +Warning: Wrong parameter count for shm_attach() in %s/sysvshm/tests/002.php on line %d +NULL + +Warning: shm_attach(): Segment size must be greater then zero. in %s/sysvshm/tests/002.php on line %d +bool(false) + +Warning: shm_attach(): Segment size must be greater then zero. in %s/sysvshm/tests/002.php on line %d +bool(false) + +Warning: shm_attach(): Segment size must be greater then zero. in %s/sysvshm/tests/002.php on line %d +bool(false) + +Warning: shm_attach(): Segment size must be greater then zero. in %s/sysvshm/tests/002.php on line %d +bool(false) + +Warning: shm_remove(): The parameter is not a valid shm_identifier in %s/sysvshm/tests/002.php on line %d + +Warning: shm_attach(): Segment size must be greater then zero. in %s/sysvshm/tests/002.php on line %d +bool(false) + +Warning: shm_remove(): The parameter is not a valid shm_identifier in %s/sysvshm/tests/002.php on line %d +int(%d) + +Warning: shm_remove(): The parameter is not a valid shm_identifier in %s/sysvshm/tests/002.php on line %d +int(%d) +int(%d) +int(%d) +int(%d) +Done \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/sysvshm/tests/003.phpt b/phpt/tests/php-5.2.5/ext/sysvshm/tests/003.phpt new file mode 100644 index 0000000000000..0e8b0a55224cb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sysvshm/tests/003.phpt @@ -0,0 +1,54 @@ +--TEST-- +shm_detach() tests +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +Warning: Wrong parameter count for shm_detach() in %s on line %d +NULL + +Warning: Wrong parameter count for shm_detach() in %s on line %d +NULL +bool(true) + +Warning: shm_detach(): The parameter is not a valid shm_identifier in %s on line %d +bool(false) + +Warning: shm_remove(): The parameter is not a valid shm_identifier in %s on line %d + +Warning: shm_detach(): The parameter is not a valid shm_identifier in %s on line %d +bool(false) + +Warning: shm_detach(): The parameter is not a valid shm_identifier in %s on line %d +bool(false) + +Warning: shm_detach(): The parameter is not a valid shm_identifier in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/sysvshm/tests/004.phpt b/phpt/tests/php-5.2.5/ext/sysvshm/tests/004.phpt new file mode 100644 index 0000000000000..ea4d7500aa3ff --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sysvshm/tests/004.phpt @@ -0,0 +1,40 @@ +--TEST-- +shm_put_var() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for shm_put_var() in %s on line %d +NULL + +Warning: shm_put_var(): -1 is not a SysV shared memory index in %s on line %d +bool(false) + +Warning: shm_put_var(): -1 is not a SysV shared memory index in %s on line %d +bool(false) +bool(true) +bool(true) +bool(true) + +Warning: shm_put_var(): not enough shared memory left in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/sysvshm/tests/005.phpt b/phpt/tests/php-5.2.5/ext/sysvshm/tests/005.phpt new file mode 100644 index 0000000000000..49d158c7b2417 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sysvshm/tests/005.phpt @@ -0,0 +1,68 @@ +--TEST-- +shm_get_var() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for shm_get_var() in %s on line %d +NULL + +Warning: shm_get_var(): -1 is not a SysV shared memory index in %s on line %d +bool(false) + +Warning: shm_get_var(): variable key 1000 doesn't exist in %s on line %d +bool(false) + +Warning: shm_get_var(): variable key -10000 doesn't exist in %s on line %d +bool(false) +object(stdClass)#%d (0) { +} +string(11) "test string" +object(stdClass)#%d (0) { +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +bool(false) +NULL +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/sysvshm/tests/006.phpt b/phpt/tests/php-5.2.5/ext/sysvshm/tests/006.phpt new file mode 100644 index 0000000000000..ae0eef445da20 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sysvshm/tests/006.phpt @@ -0,0 +1,48 @@ +--TEST-- +shm_remove_var() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for shm_remove_var() in %s on line %d +NULL + +Warning: shm_remove_var(): -1 is not a SysV shared memory index in %s on line %d +bool(false) + +Warning: shm_remove_var(): variable key -10 doesn't exist in %s on line %d +bool(false) +string(11) "test string" +bool(true) + +Warning: shm_get_var(): variable key 1 doesn't exist in %s on line %d +bool(false) + +Warning: shm_remove_var(): variable key 1 doesn't exist in %s on line %d +bool(false) + +Warning: shm_get_var(): variable key 1 doesn't exist in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/sysvshm/tests/007.phpt b/phpt/tests/php-5.2.5/ext/sysvshm/tests/007.phpt new file mode 100644 index 0000000000000..05ef7ea189a35 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/sysvshm/tests/007.phpt @@ -0,0 +1,41 @@ +--TEST-- +shm_remove() tests +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for shm_remove() in %s on line %d +NULL + +Warning: shm_remove(): The parameter is not a valid shm_identifier in %s on line %d +bool(false) + +Warning: shm_remove(): The parameter is not a valid shm_identifier in %s on line %d +bool(false) + +Warning: shm_remove(): The parameter is not a valid shm_identifier in %s on line %d +bool(false) +bool(true) +bool(true) + +Warning: shm_remove(): The parameter is not a valid shm_identifier in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/001.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/001.phpt new file mode 100644 index 0000000000000..bfd3782078bf3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/001.phpt @@ -0,0 +1,10 @@ +--TEST-- +Check for tidy presence +--SKIPIF-- + +--FILE-- + +--EXPECT-- +tidy extension is available diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/002.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/002.phpt new file mode 100644 index 0000000000000..89c3804b89d38 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/002.phpt @@ -0,0 +1,18 @@ +--TEST-- +tidy_parse_string() +--SKIPIF-- + +--FILE-- +"); + echo tidy_get_output($a); + +?> +--EXPECT-- + + + + + + + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/003.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/003.phpt new file mode 100644 index 0000000000000..7201d6a5a22a2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/003.phpt @@ -0,0 +1,21 @@ +--TEST-- +tidy_clean_repair() +--SKIPIF-- + +--FILE-- +"); + tidy_clean_repair($a); + echo tidy_get_output($a); + +?> +--EXPECT-- + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/004.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/004.phpt new file mode 100644 index 0000000000000..e941de452bbc4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/004.phpt @@ -0,0 +1,17 @@ +--TEST-- +tidy_diagnose() +--SKIPIF-- + +--FILE-- +"); + tidy_diagnose($a); + echo tidy_get_error_buffer($a); +?> +--EXPECT-- + +line 1 column 1 - Warning: missing declaration +line 1 column 7 - Warning: discarding unexpected +line 1 column 14 - Warning: inserting missing 'title' element +Info: Document content looks like HTML 3.2 +3 warnings, 0 errors were found! \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/005.html b/phpt/tests/php-5.2.5/ext/tidy/tests/005.html new file mode 100644 index 0000000000000..8c17451f917d9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/005.html @@ -0,0 +1 @@ + diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/005.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/005.phpt new file mode 100644 index 0000000000000..1d3a10c2ffadd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/005.phpt @@ -0,0 +1,18 @@ +--TEST-- +tidy_parse_file() +--SKIPIF-- + +--FILE-- + +--EXPECT-- + + + + + + + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/006.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/006.phpt new file mode 100644 index 0000000000000..c8261813145a0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/006.phpt @@ -0,0 +1,16 @@ +--TEST-- +Verbose tidy_get_error_buffer() +--SKIPIF-- + +--FILE-- +"); + echo tidy_get_error_buffer($a); + +?> +--EXPECT-- +line 1 column 1 - Warning: missing declaration +line 1 column 7 - Error: is not recognized! +line 1 column 7 - Warning: discarding unexpected +line 1 column 17 - Warning: discarding unexpected +line 1 column 7 - Warning: inserting missing 'title' element \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/007.html b/phpt/tests/php-5.2.5/ext/tidy/tests/007.html new file mode 100644 index 0000000000000..7dc0357779df4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/007.html @@ -0,0 +1 @@ +testing
    diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/007.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/007.phpt new file mode 100644 index 0000000000000..f6bb13d556a8f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/007.phpt @@ -0,0 +1,29 @@ +--TEST-- +Verbose tidy_getopt() +--SKIPIF-- + +--INI-- +tidy.default_config= +--FILE-- +getopt("tidy-mark")); + echo "Current Value of 'error-file': "; + var_dump($a->getopt("error-file")); + echo "Current Value of 'tab-size': "; + var_dump($a->getopt("tab-size")); + + var_dump($a->getopt('bogus-opt')); + var_dump(tidy_getopt($a, 'non-ASCII string àáç')); +?> +--EXPECTF-- +Current Value of 'tidy-mark': bool(false) +Current Value of 'error-file': string(0) "" +Current Value of 'tab-size': int(8) + +Warning: tidy::getOpt(): Unknown Tidy Configuration Option 'bogus-opt' in %s007.php on line 10 +bool(false) + +Warning: tidy_getopt(): Unknown Tidy Configuration Option 'non-ASCII string àáç' in %s007.php on line 11 +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/008.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/008.phpt new file mode 100644 index 0000000000000..150b98f56074a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/008.phpt @@ -0,0 +1,15 @@ +--TEST-- +Accessing the error buffer via $obj->error_buf... +--SKIPIF-- + +--FILE-- +"); + echo $a->errorBuffer; +?> +--EXPECT-- +line 1 column 1 - Warning: missing declaration +line 1 column 7 - Error: is not recognized! +line 1 column 7 - Warning: discarding unexpected +line 1 column 17 - Warning: discarding unexpected +line 1 column 7 - Warning: inserting missing 'title' element \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/009.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/009.phpt new file mode 100644 index 0000000000000..02c65df7cbd98 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/009.phpt @@ -0,0 +1,19 @@ +--TEST-- +tidy_doc object overloading +--SKIPIF-- + +--FILE-- +"); + echo $a; + +?> +--EXPECT-- + + + + + + + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/010.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/010.phpt new file mode 100644 index 0000000000000..eabbc0391ff80 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/010.phpt @@ -0,0 +1,317 @@ +--TEST-- +Accessing root, body, html, and head nodes.. +--SKIPIF-- + +--FILE-- +"); + var_dump($a->root()); + var_dump($a->body()); + var_dump($a->html()); + var_dump($a->head()); + +?> +--EXPECT-- +object(tidyNode)#2 (8) { + ["value"]=> + string(94) " + + + + + +" + ["name"]=> + string(0) "" + ["type"]=> + int(0) + ["line"]=> + int(1) + ["column"]=> + int(1) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + array(1) { + [0]=> + &object(tidyNode)#3 (9) { + ["value"]=> + string(94) " + + + + + +" + ["name"]=> + string(4) "html" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(1) + ["proprietary"]=> + bool(false) + ["id"]=> + int(48) + ["attribute"]=> + NULL + ["child"]=> + array(2) { + [0]=> + &object(tidyNode)#4 (9) { + ["value"]=> + string(31) " + + +" + ["name"]=> + string(4) "head" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(7) + ["proprietary"]=> + bool(false) + ["id"]=> + int(46) + ["attribute"]=> + NULL + ["child"]=> + array(1) { + [0]=> + &object(tidyNode)#5 (9) { + ["value"]=> + string(16) " +" + ["name"]=> + string(5) "title" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(57) + ["proprietary"]=> + bool(false) + ["id"]=> + int(111) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + } + } + [1]=> + &object(tidyNode)#6 (9) { + ["value"]=> + string(49) " + +" + ["name"]=> + string(4) "body" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(7) + ["proprietary"]=> + bool(false) + ["id"]=> + int(16) + ["attribute"]=> + array(2) { + ["bgcolor"]=> + string(7) "#FFFFFF" + ["alink"]=> + string(7) "#000000" + } + ["child"]=> + NULL + } + } + } + } +} +object(tidyNode)#2 (9) { + ["value"]=> + string(49) " + +" + ["name"]=> + string(4) "body" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(7) + ["proprietary"]=> + bool(false) + ["id"]=> + int(16) + ["attribute"]=> + array(2) { + ["bgcolor"]=> + string(7) "#FFFFFF" + ["alink"]=> + string(7) "#000000" + } + ["child"]=> + NULL +} +object(tidyNode)#2 (9) { + ["value"]=> + string(94) " + + + + + +" + ["name"]=> + string(4) "html" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(1) + ["proprietary"]=> + bool(false) + ["id"]=> + int(48) + ["attribute"]=> + NULL + ["child"]=> + array(2) { + [0]=> + &object(tidyNode)#3 (9) { + ["value"]=> + string(31) " + + +" + ["name"]=> + string(4) "head" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(7) + ["proprietary"]=> + bool(false) + ["id"]=> + int(46) + ["attribute"]=> + NULL + ["child"]=> + array(1) { + [0]=> + &object(tidyNode)#6 (9) { + ["value"]=> + string(16) " +" + ["name"]=> + string(5) "title" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(57) + ["proprietary"]=> + bool(false) + ["id"]=> + int(111) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + } + } + [1]=> + &object(tidyNode)#4 (9) { + ["value"]=> + string(49) " + +" + ["name"]=> + string(4) "body" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(7) + ["proprietary"]=> + bool(false) + ["id"]=> + int(16) + ["attribute"]=> + array(2) { + ["bgcolor"]=> + string(7) "#FFFFFF" + ["alink"]=> + string(7) "#000000" + } + ["child"]=> + NULL + } + } +} +object(tidyNode)#2 (9) { + ["value"]=> + string(31) " + + +" + ["name"]=> + string(4) "head" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(7) + ["proprietary"]=> + bool(false) + ["id"]=> + int(46) + ["attribute"]=> + NULL + ["child"]=> + array(1) { + [0]=> + &object(tidyNode)#4 (9) { + ["value"]=> + string(16) " +" + ["name"]=> + string(5) "title" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(57) + ["proprietary"]=> + bool(false) + ["id"]=> + int(111) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + } +} diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/011.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/011.phpt new file mode 100644 index 0000000000000..2a9461675907f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/011.phpt @@ -0,0 +1,22 @@ +--TEST-- +Accessing attributes of a node +--SKIPIF-- + +--FILE-- +"); + $body = $a->body(); + var_dump($body->attribute); + foreach($body->attribute as $key=>$val) { + echo "Attrib '$key': $val\n"; + } +?> +--EXPECT-- +array(2) { + ["bgcolor"]=> + string(7) "#FFFFFF" + ["alink"]=> + string(7) "#000000" +} +Attrib 'bgcolor': #FFFFFF +Attrib 'alink': #000000 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/012.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/012.phpt new file mode 100644 index 0000000000000..43fff38df589e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/012.phpt @@ -0,0 +1,473 @@ +--TEST-- +Accessing children nodes +--SKIPIF-- + +--FILE-- +hasChildren()); + if($node->hasChildren()) { + + foreach($node->child as $c) { + + var_dump($c); + + if($c->hasChildren()) { + + dump_nodes($c); + + } + } + + } + + } + + $a = tidy_parse_string("HiByeTest"); + $html = $a->html(); + dump_nodes($html); + +?> +--EXPECT-- +bool(true) +object(tidyNode)#3 (9) { + ["value"]=> + string(31) " + + +" + ["name"]=> + string(4) "head" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(7) + ["proprietary"]=> + bool(false) + ["id"]=> + int(46) + ["attribute"]=> + NULL + ["child"]=> + array(1) { + [0]=> + &object(tidyNode)#4 (9) { + ["value"]=> + string(16) " +" + ["name"]=> + string(5) "title" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(87) + ["proprietary"]=> + bool(false) + ["id"]=> + int(111) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + } +} +bool(true) +object(tidyNode)#4 (9) { + ["value"]=> + string(16) " +" + ["name"]=> + string(5) "title" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(87) + ["proprietary"]=> + bool(false) + ["id"]=> + int(111) + ["attribute"]=> + NULL + ["child"]=> + NULL +} +object(tidyNode)#5 (9) { + ["value"]=> + string(80) " +HiByeTest + +" + ["name"]=> + string(4) "body" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(7) + ["proprietary"]=> + bool(false) + ["id"]=> + int(16) + ["attribute"]=> + array(2) { + ["bgcolor"]=> + string(7) "#FFFFFF" + ["alink"]=> + string(7) "#000000" + } + ["child"]=> + array(2) { + [0]=> + &object(tidyNode)#6 (9) { + ["value"]=> + string(9) "Hi" + ["name"]=> + string(1) "b" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(43) + ["proprietary"]=> + bool(false) + ["id"]=> + int(8) + ["attribute"]=> + NULL + ["child"]=> + array(1) { + [0]=> + &object(tidyNode)#7 (8) { + ["value"]=> + string(2) "Hi" + ["name"]=> + string(0) "" + ["type"]=> + int(4) + ["line"]=> + int(1) + ["column"]=> + int(46) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + } + } + [1]=> + &object(tidyNode)#8 (9) { + ["value"]=> + string(21) "ByeTest" + ["name"]=> + string(1) "i" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(52) + ["proprietary"]=> + bool(false) + ["id"]=> + int(49) + ["attribute"]=> + NULL + ["child"]=> + array(2) { + [0]=> + &object(tidyNode)#9 (8) { + ["value"]=> + string(3) "Bye" + ["name"]=> + string(0) "" + ["type"]=> + int(4) + ["line"]=> + int(1) + ["column"]=> + int(55) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + [1]=> + &object(tidyNode)#10 (9) { + ["value"]=> + string(11) "Test" + ["name"]=> + string(1) "u" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(58) + ["proprietary"]=> + bool(false) + ["id"]=> + int(114) + ["attribute"]=> + NULL + ["child"]=> + array(1) { + [0]=> + &object(tidyNode)#11 (8) { + ["value"]=> + string(4) "Test" + ["name"]=> + string(0) "" + ["type"]=> + int(4) + ["line"]=> + int(1) + ["column"]=> + int(61) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + } + } + } + } + } +} +bool(true) +object(tidyNode)#6 (9) { + ["value"]=> + string(9) "Hi" + ["name"]=> + string(1) "b" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(43) + ["proprietary"]=> + bool(false) + ["id"]=> + int(8) + ["attribute"]=> + NULL + ["child"]=> + array(1) { + [0]=> + &object(tidyNode)#7 (8) { + ["value"]=> + string(2) "Hi" + ["name"]=> + string(0) "" + ["type"]=> + int(4) + ["line"]=> + int(1) + ["column"]=> + int(46) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + } +} +bool(true) +object(tidyNode)#7 (8) { + ["value"]=> + string(2) "Hi" + ["name"]=> + string(0) "" + ["type"]=> + int(4) + ["line"]=> + int(1) + ["column"]=> + int(46) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + NULL +} +object(tidyNode)#8 (9) { + ["value"]=> + string(21) "ByeTest" + ["name"]=> + string(1) "i" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(52) + ["proprietary"]=> + bool(false) + ["id"]=> + int(49) + ["attribute"]=> + NULL + ["child"]=> + array(2) { + [0]=> + &object(tidyNode)#9 (8) { + ["value"]=> + string(3) "Bye" + ["name"]=> + string(0) "" + ["type"]=> + int(4) + ["line"]=> + int(1) + ["column"]=> + int(55) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + [1]=> + &object(tidyNode)#10 (9) { + ["value"]=> + string(11) "Test" + ["name"]=> + string(1) "u" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(58) + ["proprietary"]=> + bool(false) + ["id"]=> + int(114) + ["attribute"]=> + NULL + ["child"]=> + array(1) { + [0]=> + &object(tidyNode)#11 (8) { + ["value"]=> + string(4) "Test" + ["name"]=> + string(0) "" + ["type"]=> + int(4) + ["line"]=> + int(1) + ["column"]=> + int(61) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + } + } + } +} +bool(true) +object(tidyNode)#9 (8) { + ["value"]=> + string(3) "Bye" + ["name"]=> + string(0) "" + ["type"]=> + int(4) + ["line"]=> + int(1) + ["column"]=> + int(55) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + NULL +} +object(tidyNode)#10 (9) { + ["value"]=> + string(11) "Test" + ["name"]=> + string(1) "u" + ["type"]=> + int(5) + ["line"]=> + int(1) + ["column"]=> + int(58) + ["proprietary"]=> + bool(false) + ["id"]=> + int(114) + ["attribute"]=> + NULL + ["child"]=> + array(1) { + [0]=> + &object(tidyNode)#11 (8) { + ["value"]=> + string(4) "Test" + ["name"]=> + string(0) "" + ["type"]=> + int(4) + ["line"]=> + int(1) + ["column"]=> + int(61) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + NULL + } + } +} +bool(true) +object(tidyNode)#11 (8) { + ["value"]=> + string(4) "Test" + ["name"]=> + string(0) "" + ["type"]=> + int(4) + ["line"]=> + int(1) + ["column"]=> + int(61) + ["proprietary"]=> + bool(false) + ["attribute"]=> + NULL + ["child"]=> + NULL +} diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/013.html b/phpt/tests/php-5.2.5/ext/tidy/tests/013.html new file mode 100644 index 0000000000000..7dc0357779df4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/013.html @@ -0,0 +1 @@ +testing
    diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/013.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/013.phpt new file mode 100644 index 0000000000000..8f1ac94ef4a13 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/013.phpt @@ -0,0 +1,13 @@ +--TEST-- +Parsing a file using constructor +--SKIPIF-- + +--FILE-- +true)); + $tidy->cleanRepair(); + echo $tidy; + +?> +--EXPECT-- +testing diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/014.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/014.phpt new file mode 100644 index 0000000000000..a391b3dc9ebf3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/014.phpt @@ -0,0 +1,14 @@ +--TEST-- +Passing configuration options through tidy_parse_string(). +--SKIPIF-- + +--FILE-- +testing"; + $tidy = tidy_parse_string($text, array('show-body-only'=>true)); + tidy_clean_repair($tidy); + echo tidy_get_output($tidy); + +?> +--EXPECT-- +testing \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/015.html b/phpt/tests/php-5.2.5/ext/tidy/tests/015.html new file mode 100644 index 0000000000000..7dc0357779df4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/015.html @@ -0,0 +1 @@ +testing diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/015.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/015.phpt new file mode 100644 index 0000000000000..03018ffa198fd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/015.phpt @@ -0,0 +1,13 @@ +--TEST-- +Passing configuration options through tidy_parse_file(). +--SKIPIF-- + +--FILE-- +true)); + tidy_clean_repair($tidy); + echo tidy_get_output($tidy); + +?> +--EXPECT-- +testing \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/016.html b/phpt/tests/php-5.2.5/ext/tidy/tests/016.html new file mode 100644 index 0000000000000..7dc6e4aba8c96 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/016.html @@ -0,0 +1 @@ +

    testing

    diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/016.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/016.phpt new file mode 100644 index 0000000000000..001371aa3e13e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/016.phpt @@ -0,0 +1,24 @@ +--TEST-- +Passing configuration file through tidy_parse_file() (may fail with buggy libtidy) +--SKIPIF-- + +--FILE-- + +--EXPECT-- + + + + + + + + +

    testing

    + + diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/016.tcfg b/phpt/tests/php-5.2.5/ext/tidy/tests/016.tcfg new file mode 100644 index 0000000000000..fd6e4e44f4fdd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/016.tcfg @@ -0,0 +1 @@ +clean: yes diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/017.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/017.phpt new file mode 100644 index 0000000000000..ba620a32ec329 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/017.phpt @@ -0,0 +1,17 @@ +--TEST-- +The Tidy Output Buffer Filter +--SKIPIF-- + +--FILE-- + +testing +--EXPECT-- + + + + + + +testing + + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/018.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/018.phpt new file mode 100644 index 0000000000000..405a46d42b204 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/018.phpt @@ -0,0 +1,16 @@ +--TEST-- +binary safety +--SKIPIF-- + +--FILE-- +abra\0cadabra

    ", + array( 'show-body-only' => true, + 'clean' => false, + 'newline' => "\n") + ); +var_dump($x); +?> +--EXPECT-- +string(19) "

    abracadabra

    +" diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/019.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/019.phpt new file mode 100644 index 0000000000000..9d2c693cdbad3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/019.phpt @@ -0,0 +1,38 @@ +--TEST-- +tidy_repair_*() and invalid parameters +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: tidy_repair_string(): Could not load configuration file '1' in %s on line %d + +Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d + +Warning: tidy_repair_string(): Could not load configuration file '' in %s on line %d + +Warning: tidy_repair_string(): Could not load configuration file '1' in %s on line %d + +Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d + +Warning: tidy_repair_string() expects parameter 1 to be string, array given in %s on line %d + +Warning: tidy_repair_file() expects parameter 1 to be string, array given in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/020.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/020.phpt new file mode 100644 index 0000000000000..dbfda96375bcb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/020.phpt @@ -0,0 +1,36 @@ +--TEST-- +OO API +--SKIPIF-- + +--FILE-- +Isto é um texto em Português
    +para testes.

    +EOF; + +$tidy->parseString($str, array('output-xhtml'=>1), 'latin1'); +$tidy->cleanRepair(); +$tidy->diagnose(); +var_dump(tidy_warning_count($tidy) > 0); +var_dump(strlen($tidy->errorBuffer) > 50); + +echo $tidy; +?> +--EXPECT-- +bool(true) +bool(true) + + + + + + + +

    Isto é um texto em Português
    +para testes.

    + + diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/021.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/021.phpt new file mode 100644 index 0000000000000..bdf954617babd --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/021.phpt @@ -0,0 +1,18 @@ +--TEST-- +tidy_get_opt_doc() +--SKIPIF-- + +--FILE-- +getOptDoc('ncr')); +var_dump(strlen(tidy_get_opt_doc($t, 'wrap')) > 99); +?> +--EXPECTF-- +Warning: tidy_get_opt_doc(): Unknown Tidy Configuration Option 'some_bogus_cfg' in %s021.php on line 3 +bool(false) +string(73) "This option specifies if Tidy should allow numeric character references. " +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/022.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/022.phpt new file mode 100644 index 0000000000000..9d2c693cdbad3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/022.phpt @@ -0,0 +1,38 @@ +--TEST-- +tidy_repair_*() and invalid parameters +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: tidy_repair_string(): Could not load configuration file '1' in %s on line %d + +Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d + +Warning: tidy_repair_string(): Could not load configuration file '' in %s on line %d + +Warning: tidy_repair_string(): Could not load configuration file '1' in %s on line %d + +Warning: tidy_repair_string(): Could not set encoding '1' in %s on line %d + +Warning: tidy_repair_string() expects parameter 1 to be string, array given in %s on line %d + +Warning: tidy_repair_file() expects parameter 1 to be string, array given in %s on line %d +Done diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/023.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/023.phpt new file mode 100644 index 0000000000000..e7ee4b3c0c496 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/023.phpt @@ -0,0 +1,49 @@ +--TEST-- +tidy and tidyNode OO +--SKIPIF-- + +--FILE-- +isHtml()); + +$tidy = new tidy(); +$tidy->parseString(''); + +var_dump(tidy_get_root($tidy)->child[0]->isHtml()); +var_dump(tidy_get_root($tidy)->child[0]->child[0]->isPHP()); +var_dump(tidy_get_root($tidy)->child[0]->child[0]->isAsp()); +var_dump(tidy_get_root($tidy)->child[0]->child[0]->isJste()); +var_dump(tidy_get_root($tidy)->child[0]->child[0]->type === TIDY_NODETYPE_PHP); + +var_dump(tidy_get_root($tidy)->child[0]->hasChildren()); +var_dump(tidy_get_root($tidy)->child[0]->child[0]->hasChildren()); + +?> +--EXPECT-- +object(tidyNode)#1 (0) { +} +object(tidy)#1 (2) { + ["errorBuffer"]=> + NULL + ["value"]=> + NULL +} +------- +bool(false) +bool(true) +bool(true) +bool(false) +bool(false) +bool(true) +bool(true) +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/024.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/024.phpt new file mode 100644 index 0000000000000..f69b962aee7d6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/024.phpt @@ -0,0 +1,39 @@ +--TEST-- +libtidy handling of 'new-blocklevel-tags' +--SKIPIF-- + +--FILE-- + + + + +'; + +$config = array( +'new-blocklevel-tags' => 'wps:block,wps:var,wps:value' +); + +$tidy = tidy_parse_string($contents, $config, 'utf8'); +$tidy->cleanRepair(); + +var_dump($tidy->value); + +?> +--EXPECTF-- +string(11%d) " + + + + +%w +%w + +" diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/025.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/025.phpt new file mode 100644 index 0000000000000..a7bd544d6736e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/025.phpt @@ -0,0 +1,50 @@ +--TEST-- +tidyNode tests +--SKIPIF-- + +--FILE-- +isPhp()); +var_dump($node->isText()); +var_dump($node->isComment()); +var_dump($node->hasSiblings()); +var_dump((string)$node); + +$tidy=tidy_parse_string('<% %>'); +var_dump($tidy->Root()->child[0]->isAsp()); + +$tidy=tidy_parse_string('<# #>'); +var_dump($tidy->Root()->child[0]->isJste()); + +$tidy=tidy_parse_string('text'); +var_dump($tidy->Root()->child[0]->child[1]->child[0]->isText()); + +$tidy=tidy_parse_string(''); +$n = $tidy->Root()->child[0]->child[1]->child[0]; +var_dump($n->isComment()); +var_dump((string)$n); +var_dump((bool)$n); +var_dump((double)$n); +var_dump((int)$n); +var_dump($tidy->Root()->child[0]->child[0]->hasSiblings()); + +?> +--EXPECT-- +bool(false) +bool(false) +bool(false) +bool(false) +string(0) "" +bool(true) +bool(true) +bool(true) +bool(true) +string(16) "" +bool(true) +float(0) +int(0) +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/026.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/026.phpt new file mode 100644 index 0000000000000..24a1e6f4a7c11 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/026.phpt @@ -0,0 +1,24 @@ +--TEST-- +tidy.clean_output test +--SKIPIF-- + +--INI-- +tidy.clean_output=1 +--FILE-- + +xpto

    '; + +?> + +--EXPECT-- + + + + + + +

    xpto

    + + diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/027.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/027.phpt new file mode 100644 index 0000000000000..8d9f66eaf714d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/027.phpt @@ -0,0 +1,59 @@ +--TEST-- +Bug: tidy segfaults with markup=false +--SKIPIF-- + +--FILE-- +tidyconfig = array( + 'indent' => false, + 'clean' => true, + 'merge-divs' => false, + 'quote-marks' => true, + 'drop-empty-paras' => false, + 'markup' => false, + 'output-xhtml' => true, + 'wrap' => 0); + + } + + abstract public function run(); + + public function getURL($url) { + $data = "awerawer"; // in my code, $data is downloaded from a site + + $tidy = new tidy; + $tidy->parseString($data, $this->tidyconfig, 'utf8'); + $tidy->cleanRepair(); + + return $tidy; + } + +} + +class ChildClass extends BaseClass { + public function ChildClass() { + parent::__construct(); + } + + public function run() { + $result = $this->getURL('awer'); + if ($result === null) { + echo "\tError:\n"; + } + var_dump((string)$result); + } +} + +$instance = new ChildClass(); +$instance->run(); + +?> +--EXPECT-- +string(0) "" diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/028.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/028.phpt new file mode 100644 index 0000000000000..01f3fd1e1a99d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/028.phpt @@ -0,0 +1,15 @@ +--TEST-- +tidyNode::getParent() +--SKIPIF-- + +--FILE-- +
    Content
    "); +var_dump($x->body()->child[0]->name); +var_dump($x->body()->child[0]->getParent()->name); +var_dump($x->root()->getParent()); +?> +--EXPECT-- +string(3) "div" +string(4) "body" +NULL diff --git a/phpt/tests/php-5.2.5/ext/tidy/tests/029.phpt b/phpt/tests/php-5.2.5/ext/tidy/tests/029.phpt new file mode 100644 index 0000000000000..1709cd6f09b05 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tidy/tests/029.phpt @@ -0,0 +1,28 @@ +--TEST-- +tidy_get_body() crash +--SKIPIF-- + +--FILE-- + ', + ' cleanRepair(); + var_dump(tidy_get_body($t)); +} + +echo "Done\n"; +?> +--EXPECT-- +NULL +NULL +Done diff --git a/phpt/tests/php-5.2.5/ext/tokenizer/tests/001.phpt b/phpt/tests/php-5.2.5/ext/tokenizer/tests/001.phpt new file mode 100644 index 0000000000000..203e3c7ddb04e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tokenizer/tests/001.phpt @@ -0,0 +1,259 @@ +--TEST-- +token_name() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +T_INCLUDE +T_INCLUDE_ONCE +T_EVAL +T_REQUIRE +T_REQUIRE_ONCE +T_LOGICAL_OR +T_LOGICAL_XOR +T_LOGICAL_AND +T_PRINT +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_BOOLEAN_OR +T_BOOLEAN_AND +T_IS_EQUAL +T_IS_NOT_EQUAL +T_IS_IDENTICAL +T_IS_NOT_IDENTICAL +T_IS_SMALLER_OR_EQUAL +T_IS_GREATER_OR_EQUAL +T_SL +T_SR +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 +T_NEW +T_EXIT +T_IF +T_ELSEIF +T_ELSE +T_ENDIF +T_LNUMBER +T_DNUMBER +T_STRING +T_STRING_VARNAME +T_VARIABLE +T_NUM_STRING +T_INLINE_HTML +T_ENCAPSED_AND_WHITESPACE +T_CONSTANT_ENCAPSED_STRING +T_ECHO +T_DO +T_WHILE +T_ENDWHILE +T_FOR +T_ENDFOR +T_FOREACH +T_ENDFOREACH +T_DECLARE +T_ENDDECLARE +T_AS +T_SWITCH +T_ENDSWITCH +T_CASE +T_DEFAULT +T_BREAK +T_CONTINUE +T_FUNCTION +T_CONST +T_RETURN +T_USE +T_GLOBAL +T_STATIC +T_VAR +T_UNSET +T_ISSET +T_EMPTY +T_CLASS +T_EXTENDS +T_INTERFACE +T_IMPLEMENTS +T_OBJECT_OPERATOR +T_DOUBLE_ARROW +T_LIST +T_ARRAY +T_CLASS_C +T_FUNC_C +T_METHOD_C +T_LINE +T_FILE +T_COMMENT +T_DOC_COMMENT +T_OPEN_TAG +T_OPEN_TAG_WITH_ECHO +T_CLOSE_TAG +T_WHITESPACE +T_START_HEREDOC +T_END_HEREDOC +T_DOLLAR_OPEN_CURLY_BRACES +T_CURLY_OPEN +T_DOUBLE_COLON +T_DOUBLE_COLON +T_ABSTRACT +T_CATCH +T_FINAL +T_INSTANCEOF +T_PRIVATE +T_PROTECTED +T_PUBLIC +T_THROW +T_TRY +T_CLONE +T_HALT_COMPILER +UNKNOWN +UNKNOWN + +Warning: token_name() expects parameter 1 to be long, string given in %s on line %d + + +Warning: token_name() expects parameter 1 to be long, array given in %s on line %d + +Done diff --git a/phpt/tests/php-5.2.5/ext/tokenizer/tests/002.phpt b/phpt/tests/php-5.2.5/ext/tokenizer/tests/002.phpt new file mode 100644 index 0000000000000..2a40ffe292fd5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tokenizer/tests/002.phpt @@ -0,0 +1,982 @@ +--TEST-- +token_get_all() +--SKIPIF-- + +--INI-- +short_open_tag=1 +--FILE-- +', + '', + '', + /* feel free to add more yourself */ + 'wrong syntax here' +); + +foreach ($strings as $s) { + var_dump(token_get_all($s)); +} + +echo "Done\n"; +?> +--EXPECTF-- +array(49) { + [0]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) " + int(1) + } + [1]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [2]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(4) "echo" + [2]=> + int(1) + } + [3]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [4]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "1" + [2]=> + int(1) + } + [5]=> + string(1) ";" + [6]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [7]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "if" + [2]=> + int(1) + } + [8]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [9]=> + string(1) "(" + [10]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(5) "isset" + [2]=> + int(1) + } + [11]=> + string(1) "(" + [12]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$a" + [2]=> + int(1) + } + [13]=> + string(1) ")" + [14]=> + string(1) ")" + [15]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [16]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(5) "print" + [2]=> + int(1) + } + [17]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [18]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$a" + [2]=> + int(1) + } + [19]=> + string(1) "+" + [20]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "1" + [2]=> + int(1) + } + [21]=> + string(1) ";" + [22]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [23]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$a" + [2]=> + int(1) + } + [24]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "++" + [2]=> + int(1) + } + [25]=> + string(1) ";" + [26]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [27]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$a" + [2]=> + int(1) + } + [28]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "--" + [2]=> + int(1) + } + [29]=> + string(1) ";" + [30]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [31]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$a" + [2]=> + int(1) + } + [32]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [33]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "==" + [2]=> + int(1) + } + [34]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [35]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "2" + [2]=> + int(1) + } + [36]=> + string(1) ";" + [37]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [38]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$a" + [2]=> + int(1) + } + [39]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [40]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(3) "===" + [2]=> + int(1) + } + [41]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [42]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "2" + [2]=> + int(1) + } + [43]=> + string(1) ";" + [44]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [45]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(5) "endif" + [2]=> + int(1) + } + [46]=> + string(1) ";" + [47]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [48]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "?>" + [2]=> + int(1) + } +} +array(37) { + [0]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(6) " + int(1) + } + [1]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(6) "switch" + [2]=> + int(1) + } + [2]=> + string(1) "(" + [3]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$a" + [2]=> + int(1) + } + [4]=> + string(1) ")" + [5]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [6]=> + string(1) "{" + [7]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [8]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(4) "case" + [2]=> + int(1) + } + [9]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [10]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "1" + [2]=> + int(1) + } + [11]=> + string(1) ":" + [12]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [13]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(5) "break" + [2]=> + int(1) + } + [14]=> + string(1) ";" + [15]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [16]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(7) "default" + [2]=> + int(1) + } + [17]=> + string(1) ":" + [18]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [19]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(5) "break" + [2]=> + int(1) + } + [20]=> + string(1) ";" + [21]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [22]=> + string(1) "}" + [23]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [24]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(5) "while" + [2]=> + int(1) + } + [25]=> + string(1) "(" + [26]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$a" + [2]=> + int(1) + } + [27]=> + string(1) ")" + [28]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [29]=> + string(1) "{" + [30]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [31]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(4) "exit" + [2]=> + int(1) + } + [32]=> + string(1) ";" + [33]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [34]=> + string(1) "}" + [35]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [36]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "?>" + [2]=> + int(1) + } +} +array(48) { + [0]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) " + int(1) + } + [1]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [2]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(13) "/* comment */" + [2]=> + int(1) + } + [3]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [4]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "if" + [2]=> + int(1) + } + [5]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [6]=> + string(1) "(" + [7]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "1" + [2]=> + int(1) + } + [8]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [9]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "||" + [2]=> + int(1) + } + [10]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [11]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "2" + [2]=> + int(1) + } + [12]=> + string(1) ")" + [13]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [14]=> + string(1) "{" + [15]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [16]=> + string(1) "}" + [17]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [18]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$a" + [2]=> + int(1) + } + [19]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [20]=> + string(1) "=" + [21]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [22]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "2" + [2]=> + int(1) + } + [23]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [24]=> + string(1) "|" + [25]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [26]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "1" + [2]=> + int(1) + } + [27]=> + string(1) ";" + [28]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [29]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$b" + [2]=> + int(1) + } + [30]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [31]=> + string(1) "=" + [32]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [33]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "3" + [2]=> + int(1) + } + [34]=> + string(1) "^" + [35]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "2" + [2]=> + int(1) + } + [36]=> + string(1) ";" + [37]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [38]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$c" + [2]=> + int(1) + } + [39]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [40]=> + string(1) "=" + [41]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [42]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "4" + [2]=> + int(1) + } + [43]=> + string(1) "&" + [44]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "2" + [2]=> + int(1) + } + [45]=> + string(1) ";" + [46]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " " + [2]=> + int(1) + } + [47]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "?>" + [2]=> + int(1) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(17) "wrong syntax here" + [2]=> + int(1) + } +} +Done diff --git a/phpt/tests/php-5.2.5/ext/tokenizer/tests/003.phpt b/phpt/tests/php-5.2.5/ext/tokenizer/tests/003.phpt new file mode 100644 index 0000000000000..fdcf7748a8440 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tokenizer/tests/003.phpt @@ -0,0 +1,46 @@ +--TEST-- +token_get_all() and wrong parameters +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: token_get_all() expects parameter 1 to be string, array given in %s on line %d +NULL + +Warning: token_get_all() expects parameter 1 to be string, object given in %s on line %d +NULL +array(0) { +} +array(1) { + [0]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) "0" + [2]=> + int(1) + } +} +array(1) { + [0]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "-1" + [2]=> + int(1) + } +} +Done diff --git a/phpt/tests/php-5.2.5/ext/tokenizer/tests/bug26463.phpt b/phpt/tests/php-5.2.5/ext/tokenizer/tests/bug26463.phpt new file mode 100644 index 0000000000000..d07476b2046c8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/tokenizer/tests/bug26463.phpt @@ -0,0 +1,164 @@ +--TEST-- +Bug #26463 (token_get_all() does not correctly handle semicolons after T_END_HEREDOC) +--SKIPIF-- + +--FILE-- +'; +var_dump(token_get_all($str)); +?> +--EXPECTF-- +array(19) { + [0]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(6) " + int(1) + } + [1]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$x" + [2]=> + int(2) + } + [2]=> + string(1) "=" + [3]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(6) "<<
    + int(2) + } + [4]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(13) "jhdsjkfhjdsh +" + [2]=> + int(3) + } + [5]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "DD" + [2]=> + int(4) + } + [6]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " +" + [2]=> + int(4) + } + [7]=> + string(1) "." + [8]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) """" + [2]=> + int(5) + } + [9]=> + string(1) ";" + [10]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " +" + [2]=> + int(5) + } + [11]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "$a" + [2]=> + int(6) + } + [12]=> + string(1) "=" + [13]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(8) "<< + int(6) + } + [14]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(13) "jhdsjkfhjdsh +" + [2]=> + int(7) + } + [15]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(4) "DDDD" + [2]=> + int(8) + } + [16]=> + string(1) ";" + [17]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(1) " +" + [2]=> + int(8) + } + [18]=> + array(3) { + [0]=> + int(%d) + [1]=> + string(2) "?>" + [2]=> + int(9) + } +} diff --git a/phpt/tests/php-5.2.5/ext/wddx/tests/001.phpt b/phpt/tests/php-5.2.5/ext/wddx/tests/001.phpt new file mode 100644 index 0000000000000..3efc0f4b0755b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/wddx/tests/001.phpt @@ -0,0 +1,61 @@ +--TEST-- +wddx deserialization test +--SKIPIF-- + +--INI-- +precision=14 +--FILE-- + +--EXPECT-- +array(11) { + ["aNull"]=> + NULL + ["aString"]=> + string(8) "a string" + ["aNumber"]=> + float(-12.456) + ["aDateTime"]=> + int(897625932) + ["aDateTime2"]=> + int(329632332) + ["aDateTime3"]=> + string(22) "2040-06-12T04:32:12+00" + ["aBoolean"]=> + bool(true) + ["anArray"]=> + array(2) { + [0]=> + int(10) + [1]=> + string(14) "second element" + } + ["aBinary"]=> + string(11) "binary data" + ["anObject"]=> + array(2) { + ["s"]=> + string(8) "a string" + ["n"]=> + float(-12.456) + } + ["aRecordset"]=> + array(2) { + ["NAME"]=> + array(2) { + [0]=> + string(8) "John Doe" + [1]=> + string(8) "Jane Doe" + } + ["AGE"]=> + array(2) { + [0]=> + int(34) + [1]=> + int(31) + } + } +} diff --git a/phpt/tests/php-5.2.5/ext/wddx/tests/bug27287.phpt b/phpt/tests/php-5.2.5/ext/wddx/tests/bug27287.phpt new file mode 100755 index 0000000000000..72ac317aa07e2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/wddx/tests/bug27287.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #27287 (segfault with deserializing object data) +--SKIPIF-- + +--FILE-- +abc = 'def'; + + $string = wddx_serialize_value($foo); + $bar = wddx_deserialize($string); + + echo "OK\n"; + +?> +--EXPECT-- +OK diff --git a/phpt/tests/php-5.2.5/ext/wddx/tests/bug34306.phpt b/phpt/tests/php-5.2.5/ext/wddx/tests/bug34306.phpt new file mode 100755 index 0000000000000..5f1a0df72f14a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/wddx/tests/bug34306.phpt @@ -0,0 +1,14 @@ +--TEST-- +#34306 (wddx_serialize_value() crashes with long array keys) +--SKIPIF-- + +--FILE-- + 1); +$buf = wddx_serialize_value($var, 'name'); +echo "OK\n"; + +?> +--EXPECT-- +OK diff --git a/phpt/tests/php-5.2.5/ext/wddx/tests/bug35410.phpt b/phpt/tests/php-5.2.5/ext/wddx/tests/bug35410.phpt new file mode 100755 index 0000000000000..3b4b9b62cf611 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/wddx/tests/bug35410.phpt @@ -0,0 +1,76 @@ +--TEST-- +#35410 (wddx_deserialize() doesn't handle large ints as keys properly) +--SKIPIF-- + +--FILE-- + +
    +Content Configuration File +
    + + + + + + + + + +10 + + +4 + + + + + + +desc + + + + + + + + + + + + + + +WDX; + +var_dump(wddx_deserialize($wddx)); +?> +--EXPECT-- +array(1) { + ["content_queries"]=> + array(1) { + ["content_113300831086270200"]=> + array(1) { + ["113301888545229100"]=> + array(3) { + ["max"]=> + int(10) + ["cache"]=> + int(4) + ["order"]=> + array(1) { + ["content_113300831086270200"]=> + array(1) { + ["CMS_BUILD"]=> + string(4) "desc" + } + } + } + } + } +} diff --git a/phpt/tests/php-5.2.5/ext/wddx/tests/bug35410_64bit.phpt b/phpt/tests/php-5.2.5/ext/wddx/tests/bug35410_64bit.phpt new file mode 100755 index 0000000000000..15377b175ea2c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/wddx/tests/bug35410_64bit.phpt @@ -0,0 +1,76 @@ +--TEST-- +#35410 (wddx_deserialize() doesn't handle large ints as keys properly) +--SKIPIF-- + +--FILE-- + +
    +Content Configuration File +
    + + + + + + + + + +10 + + +4 + + + + + + +desc + + + + + + + + + + + + + + +WDX; + +var_dump(wddx_deserialize($wddx)); +?> +--EXPECT-- +array(1) { + ["content_queries"]=> + array(1) { + ["content_113300831086270200"]=> + array(1) { + [113301888545229100]=> + array(3) { + ["max"]=> + int(10) + ["cache"]=> + int(4) + ["order"]=> + array(1) { + ["content_113300831086270200"]=> + array(1) { + ["CMS_BUILD"]=> + string(4) "desc" + } + } + } + } + } +} diff --git a/phpt/tests/php-5.2.5/ext/wddx/tests/bug37569.phpt b/phpt/tests/php-5.2.5/ext/wddx/tests/bug37569.phpt new file mode 100755 index 0000000000000..f7422c9ec22da --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/wddx/tests/bug37569.phpt @@ -0,0 +1,778 @@ +--TEST-- +Bug #37569 (WDDX incorrectly encodes high-ascii characters) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +
    A +int(65) +int(65) +bool(true) +
    B +int(66) +int(66) +bool(true) +
    C +int(67) +int(67) +bool(true) +
    D +int(68) +int(68) +bool(true) +
    E +int(69) +int(69) +bool(true) +
    F +int(70) +int(70) +bool(true) +
    G +int(71) +int(71) +bool(true) +
    H +int(72) +int(72) +bool(true) +
    I +int(73) +int(73) +bool(true) +
    J +int(74) +int(74) +bool(true) +
    K +int(75) +int(75) +bool(true) +
    L +int(76) +int(76) +bool(true) +
    M +int(77) +int(77) +bool(true) +
    N +int(78) +int(78) +bool(true) +
    O +int(79) +int(79) +bool(true) +
    P +int(80) +int(80) +bool(true) +
    Q +int(81) +int(81) +bool(true) +
    R +int(82) +int(82) +bool(true) +
    S +int(83) +int(83) +bool(true) +
    T +int(84) +int(84) +bool(true) +
    U +int(85) +int(85) +bool(true) +
    V +int(86) +int(86) +bool(true) +
    W +int(87) +int(87) +bool(true) +
    X +int(88) +int(88) +bool(true) +
    Y +int(89) +int(89) +bool(true) +
    Z +int(90) +int(90) +bool(true) +
    [ +int(91) +int(91) +bool(true) +
    \ +int(92) +int(92) +bool(true) +
    ] +int(93) +int(93) +bool(true) +
    ^ +int(94) +int(94) +bool(true) +
    _ +int(95) +int(95) +bool(true) +
    ` +int(96) +int(96) +bool(true) +
    a +int(97) +int(97) +bool(true) +
    b +int(98) +int(98) +bool(true) +
    c +int(99) +int(99) +bool(true) +
    d +int(100) +int(100) +bool(true) +
    e +int(101) +int(101) +bool(true) +
    f +int(102) +int(102) +bool(true) +
    g +int(103) +int(103) +bool(true) +
    h +int(104) +int(104) +bool(true) +
    i +int(105) +int(105) +bool(true) +
    j +int(106) +int(106) +bool(true) +
    k +int(107) +int(107) +bool(true) +
    l +int(108) +int(108) +bool(true) +
    m +int(109) +int(109) +bool(true) +
    n +int(110) +int(110) +bool(true) +
    o +int(111) +int(111) +bool(true) +
    p +int(112) +int(112) +bool(true) +
    q +int(113) +int(113) +bool(true) +
    r +int(114) +int(114) +bool(true) +
    s +int(115) +int(115) +bool(true) +
    t +int(116) +int(116) +bool(true) +
    u +int(117) +int(117) +bool(true) +
    v +int(118) +int(118) +bool(true) +
    w +int(119) +int(119) +bool(true) +
    x +int(120) +int(120) +bool(true) +
    y +int(121) +int(121) +bool(true) +
    z +int(122) +int(122) +bool(true) +
    { +int(123) +int(123) +bool(true) +
    | +int(124) +int(124) +bool(true) +
    } +int(125) +int(125) +bool(true) +
    ~ +int(126) +int(126) +bool(true) +
     +int(127) +int(127) +bool(true) +
    € +int(128) +int(128) +bool(true) +
    Â +int(129) +int(129) +bool(true) +
    ‚ +int(130) +int(130) +bool(true) +
    ƒ +int(131) +int(131) +bool(true) +
    „ +int(132) +int(132) +bool(true) +
    Â… +int(133) +int(133) +bool(true) +
    † +int(134) +int(134) +bool(true) +
    ‡ +int(135) +int(135) +bool(true) +
    ˆ +int(136) +int(136) +bool(true) +
    ‰ +int(137) +int(137) +bool(true) +
    Š +int(138) +int(138) +bool(true) +
    ‹ +int(139) +int(139) +bool(true) +
    Π+int(140) +int(140) +bool(true) +
    Â +int(141) +int(141) +bool(true) +
    ÂŽ +int(142) +int(142) +bool(true) +
    Â +int(143) +int(143) +bool(true) +
    Â +int(144) +int(144) +bool(true) +
    ‘ +int(145) +int(145) +bool(true) +
    Â’ +int(146) +int(146) +bool(true) +
    “ +int(147) +int(147) +bool(true) +
    ” +int(148) +int(148) +bool(true) +
    • +int(149) +int(149) +bool(true) +
    – +int(150) +int(150) +bool(true) +
    — +int(151) +int(151) +bool(true) +
    ˜ +int(152) +int(152) +bool(true) +
    ™ +int(153) +int(153) +bool(true) +
    š +int(154) +int(154) +bool(true) +
    › +int(155) +int(155) +bool(true) +
    œ +int(156) +int(156) +bool(true) +
    Â +int(157) +int(157) +bool(true) +
    ž +int(158) +int(158) +bool(true) +
    Ÿ +int(159) +int(159) +bool(true) +
      +int(160) +int(160) +bool(true) +
    ¡ +int(161) +int(161) +bool(true) +
    ¢ +int(162) +int(162) +bool(true) +
    £ +int(163) +int(163) +bool(true) +
    ¤ +int(164) +int(164) +bool(true) +
    ¥ +int(165) +int(165) +bool(true) +
    ¦ +int(166) +int(166) +bool(true) +
    § +int(167) +int(167) +bool(true) +
    ¨ +int(168) +int(168) +bool(true) +
    © +int(169) +int(169) +bool(true) +
    ª +int(170) +int(170) +bool(true) +
    « +int(171) +int(171) +bool(true) +
    ¬ +int(172) +int(172) +bool(true) +
    ­ +int(173) +int(173) +bool(true) +
    ® +int(174) +int(174) +bool(true) +
    ¯ +int(175) +int(175) +bool(true) +
    ° +int(176) +int(176) +bool(true) +
    ± +int(177) +int(177) +bool(true) +
    ² +int(178) +int(178) +bool(true) +
    ³ +int(179) +int(179) +bool(true) +
    ´ +int(180) +int(180) +bool(true) +
    µ +int(181) +int(181) +bool(true) +
    ¶ +int(182) +int(182) +bool(true) +
    · +int(183) +int(183) +bool(true) +
    ¸ +int(184) +int(184) +bool(true) +
    ¹ +int(185) +int(185) +bool(true) +
    º +int(186) +int(186) +bool(true) +
    » +int(187) +int(187) +bool(true) +
    ¼ +int(188) +int(188) +bool(true) +
    ½ +int(189) +int(189) +bool(true) +
    ¾ +int(190) +int(190) +bool(true) +
    ¿ +int(191) +int(191) +bool(true) +
    À +int(192) +int(192) +bool(true) +
    Ã +int(193) +int(193) +bool(true) +
    Â +int(194) +int(194) +bool(true) +
    Ã +int(195) +int(195) +bool(true) +
    Ä +int(196) +int(196) +bool(true) +
    Ã… +int(197) +int(197) +bool(true) +
    Æ +int(198) +int(198) +bool(true) +
    Ç +int(199) +int(199) +bool(true) +
    È +int(200) +int(200) +bool(true) +
    É +int(201) +int(201) +bool(true) +
    Ê +int(202) +int(202) +bool(true) +
    Ë +int(203) +int(203) +bool(true) +
    Ì +int(204) +int(204) +bool(true) +
    Ã +int(205) +int(205) +bool(true) +
    ÃŽ +int(206) +int(206) +bool(true) +
    Ã +int(207) +int(207) +bool(true) +
    Ã +int(208) +int(208) +bool(true) +
    Ñ +int(209) +int(209) +bool(true) +
    Ã’ +int(210) +int(210) +bool(true) +
    Ó +int(211) +int(211) +bool(true) +
    Ô +int(212) +int(212) +bool(true) +
    Õ +int(213) +int(213) +bool(true) +
    Ö +int(214) +int(214) +bool(true) +
    × +int(215) +int(215) +bool(true) +
    Ø +int(216) +int(216) +bool(true) +
    Ù +int(217) +int(217) +bool(true) +
    Ú +int(218) +int(218) +bool(true) +
    Û +int(219) +int(219) +bool(true) +
    Ü +int(220) +int(220) +bool(true) +
    Ã +int(221) +int(221) +bool(true) +
    Þ +int(222) +int(222) +bool(true) +
    ß +int(223) +int(223) +bool(true) +
    à +int(224) +int(224) +bool(true) +
    á +int(225) +int(225) +bool(true) +
    â +int(226) +int(226) +bool(true) +
    ã +int(227) +int(227) +bool(true) +
    ä +int(228) +int(228) +bool(true) +
    å +int(229) +int(229) +bool(true) +
    æ +int(230) +int(230) +bool(true) +
    ç +int(231) +int(231) +bool(true) +
    è +int(232) +int(232) +bool(true) +
    é +int(233) +int(233) +bool(true) +
    ê +int(234) +int(234) +bool(true) +
    ë +int(235) +int(235) +bool(true) +
    ì +int(236) +int(236) +bool(true) +
    í +int(237) +int(237) +bool(true) +
    î +int(238) +int(238) +bool(true) +
    ï +int(239) +int(239) +bool(true) +
    ð +int(240) +int(240) +bool(true) +
    ñ +int(241) +int(241) +bool(true) +
    ò +int(242) +int(242) +bool(true) +
    ó +int(243) +int(243) +bool(true) +
    ô +int(244) +int(244) +bool(true) +
    õ +int(245) +int(245) +bool(true) +
    ö +int(246) +int(246) +bool(true) +
    ÷ +int(247) +int(247) +bool(true) +
    ø +int(248) +int(248) +bool(true) +
    ù +int(249) +int(249) +bool(true) +
    ú +int(250) +int(250) +bool(true) +
    û +int(251) +int(251) +bool(true) +
    ü +int(252) +int(252) +bool(true) +
    ý +int(253) +int(253) +bool(true) +
    þ +int(254) +int(254) +bool(true) +
    ÿ +int(255) +int(255) +bool(true) \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/wddx/tests/bug37587.phpt b/phpt/tests/php-5.2.5/ext/wddx/tests/bug37587.phpt new file mode 100755 index 0000000000000..5361d38dae4d6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/wddx/tests/bug37587.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #37587 (var without attribute causes segfault) +--SKIPIF-- + +--FILE-- + +
    + + + + + Hello World + + + + + +EOF +))); + +?> +===DONE=== +--EXPECT-- +array(1) { + [0]=> + array(1) { + ["test"]=> + string(11) "Hello World" + } +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/wddx/tests/bug41283.phpt b/phpt/tests/php-5.2.5/ext/wddx/tests/bug41283.phpt new file mode 100644 index 0000000000000..af716d1893f34 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/wddx/tests/bug41283.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #41283 (Bug with serializing array key that are doubles or floats) +--SKIPIF-- + +--FILE-- + array('1.1' => 'One 1','1.2' => 'One 2', '1.0' => 'Three') +); + +var_dump(wddx_deserialize(wddx_serialize_vars('data'))); +?> +--EXPECT-- +array(1) { + ["data"]=> + array(1) { + ["somearray"]=> + array(3) { + ["1.1"]=> + string(5) "One 1" + ["1.2"]=> + string(5) "One 2" + ["1.0"]=> + string(5) "Three" + } + } +} diff --git a/phpt/tests/php-5.2.5/ext/wddx/tests/bug41527.phpt b/phpt/tests/php-5.2.5/ext/wddx/tests/bug41527.phpt new file mode 100644 index 0000000000000..447bfc34d1c1b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/wddx/tests/bug41527.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #41527 (WDDX deserialize numeric string array keys) +--SKIPIF-- + +--FILE-- + 'Zero', '+1' => 'Plus sign', ' 1' => 'Space'); + +var_dump(wddx_deserialize(wddx_serialize_vars('data'))); +?> +--EXPECT-- +array(1) { + ["data"]=> + array(3) { + ["01"]=> + string(4) "Zero" + ["+1"]=> + string(9) "Plus sign" + [" 1"]=> + string(5) "Space" + } +} diff --git a/phpt/tests/php-5.2.5/ext/wddx/tests/wddx.xml b/phpt/tests/php-5.2.5/ext/wddx/tests/wddx.xml new file mode 100644 index 0000000000000..00857095c9809 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/wddx/tests/wddx.xml @@ -0,0 +1,60 @@ + + + +
    + + + + + + + a string + + + -12.456 + + + 1998-06-12T04:32:12+00 + + + 1980-06-12T04:32:12+00 + + + 2040-06-12T04:32:12+00 + + + + + + + 10 + second element + + + + YmluYXJ5IGRhdGE= + + + + + a string + + + -12.456 + + + + + + + John Doe + Jane Doe + + + 34 + 31 + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/bug25666.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/bug25666.phpt new file mode 100644 index 0000000000000..e162d5a2bd586 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/bug25666.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #25666 (XML namespaces broken in libxml-based SAX interface) +--SKIPIF-- + +--FILE-- + + + + +HERE; + +$parser = xml_parser_create_ns("ISO-8859-1","@"); +xml_set_element_handler($parser,'start_elem','end_elem'); +xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); +xml_parse($parser, $xml); +xml_parser_free($parser); +?> +--EXPECT-- +string(24) "http://example.com/foo@a" +string(24) "http://example.com/bar@b" +string(24) "http://example.com/baz@c" diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/bug26528.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/bug26528.phpt new file mode 100644 index 0000000000000..40a1c53c9b4c0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/bug26528.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #26528 (HTML entities are not being decoded) +--SKIPIF-- + +--FILE-- +"; + $parser = xml_parser_create(); + $res = xml_parse_into_struct($parser,$sample,$vals,$index); + xml_parser_free($parser); + var_dump($vals); +?> +--EXPECT-- +array(1) { + [0]=> + array(4) { + ["tag"]=> + string(4) "TEST" + ["type"]=> + string(8) "complete" + ["level"]=> + int(1) + ["attributes"]=> + array(1) { + ["ATTR"]=> + string(13) "angle +--FILE-- + + + +'; + +// Case 2: replace some characters so that we get comments instead +$xmls["Comment"] =' + + +'; + +// Case 3: replace even more characters so that only textual data is left +$xmls["Text"] =' + +-!-- ATA[ +multi +line +CDATA +block +--- +'; + +function startElement($parser, $name, $attrs) { + printf("<$name> at line %d, col %d (byte %d)\n", + xml_get_current_line_number($parser), + xml_get_current_column_number($parser), + xml_get_current_byte_index($parser)); +} + +function endElement($parser, $name) { + printf(" at line %d, col %d (byte %d)\n", + xml_get_current_line_number($parser), + xml_get_current_column_number($parser), + xml_get_current_byte_index($parser)); +} + +function characterData($parser, $data) { + // dummy +} + +foreach ($xmls as $desc => $xml) { + echo "$desc\n"; + $xml_parser = xml_parser_create(); + xml_set_element_handler($xml_parser, "startElement", "endElement"); + xml_set_character_data_handler($xml_parser, "characterData"); + if (!xml_parse($xml_parser, $xml, true)) + echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n"; + xml_parser_free($xml_parser); +} +?> +--EXPECT-- +CDATA + at line 2, col 0 (byte 45) + at line 9, col 0 (byte 90) +Comment + at line 2, col 0 (byte 45) + at line 9, col 0 (byte 90) +Text + at line 2, col 0 (byte 45) + at line 9, col 0 (byte 90) diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/bug26614_libxml.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/bug26614_libxml.phpt new file mode 100755 index 0000000000000..782bdb19366b3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/bug26614_libxml.phpt @@ -0,0 +1,93 @@ +--TEST-- +Bug #26614 (CDATA sections skipped on line count) +--SKIPIF-- + +--FILE-- + + + +'; + +// Case 2: replace some characters so that we get comments instead +$xmls["Comment"] =' + + +'; + +// Case 3: replace even more characters so that only textual data is left +$xmls["Text"] =' + +-!-- ATA[ +multi +line +CDATA +block +--- +'; + +function startElement($parser, $name, $attrs) { + printf("<$name> at line %d, col %d (byte %d)\n", + xml_get_current_line_number($parser), + xml_get_current_column_number($parser), + xml_get_current_byte_index($parser)); +} + +function endElement($parser, $name) { + printf(" at line %d, col %d (byte %d)\n", + xml_get_current_line_number($parser), + xml_get_current_column_number($parser), + xml_get_current_byte_index($parser)); +} + +function characterData($parser, $data) { + // dummy +} + +foreach ($xmls as $desc => $xml) { + echo "$desc\n"; + $xml_parser = xml_parser_create(); + xml_set_element_handler($xml_parser, "startElement", "endElement"); + xml_set_character_data_handler($xml_parser, "characterData"); + if (!xml_parse($xml_parser, $xml, true)) + echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n"; + xml_parser_free($xml_parser); +} +?> +--EXPECTF-- +CDATA + at line 2, col %d (byte 9) + at line 9, col %d (byte 56) +Comment + at line 2, col %d (byte 9) + at line 9, col %d (byte 56) +Text + at line 2, col %d (byte 9) + at line 9, col %d (byte 56) diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/bug27908.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/bug27908.phpt new file mode 100644 index 0000000000000..e60466fa19f54 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/bug27908.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #27908 (default handler not being called) +--SKIPIF-- + +--FILE-- +',TRUE); +xml_parser_free($xp); +echo "Done\n"; +?> +--EXPECT-- +x_default_handler +x_default_handler +Done diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/bug30266.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/bug30266.phpt new file mode 100644 index 0000000000000..0a3a5ca46bfd2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/bug30266.phpt @@ -0,0 +1,52 @@ +--TEST-- +Bug #30266 (Invalid opcode 137/1/8) +--SKIPIF-- + +--FILE-- +dummy = "b"; + throw new Exception("ex"); + } + + function endHandler($XmlParser, $tag) + { + } +} + +$p1 = new Xml_Parser(); +try { + $p1->parse(''); +} catch (Exception $e) { + echo "OK\n"; +} +?> +--EXPECT-- +OK diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/bug32001.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/bug32001.phpt new file mode 100644 index 0000000000000..0853b3ab1c15a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/bug32001.phpt @@ -0,0 +1,406 @@ +--TEST-- +Bug #32001 (xml_parse*() goes into infinite loop when autodetection in effect), using UTF-* +--SKIPIF-- + +--FILE-- +encoding = $enc; + $this->chunk_size = $chunk_size; + $this->bom = $bom; + $this->prologue = !$omit_prologue; + $this->tags = array(); + } + + function start_element($parser, $name, $attrs) { + $attrs = array_map('bin2hex', $attrs); + $this->tags[] = bin2hex($name).": ".implode(', ', $attrs); + } + + function end_element($parser, $name) { + } + + function run() { + $data = ''; + + if ($this->prologue) { + $canonical_name = preg_replace('/BE|LE/i', '', $this->encoding); + $data .= "\n"; + } + + $data .= << + <テスト:テスト2 テスト="テスト"> + <テスト:テスト3> + test! + + + +HERE; + + $data = iconv("UTF-8", $this->encoding, $data); + + if ($this->bom) { + switch (strtoupper($this->encoding)) { + case 'UTF-8': + case 'UTF8': + $data = "\xef\xbb\xbf".$data; + break; + + case 'UTF-16': + case 'UTF16': + case 'UTF-16BE': + case 'UTF16BE': + case 'UCS-2': + case 'UCS2': + case 'UCS-2BE': + case 'UCS2BE': + $data = "\xfe\xff".$data; + break; + + case 'UTF-16LE': + case 'UTF16LE': + case 'UCS-2LE': + case 'UCS2LE': + $data = "\xff\xfe".$data; + break; + + case 'UTF-32': + case 'UTF32': + case 'UTF-32BE': + case 'UTF32BE': + case 'UCS-4': + case 'UCS4': + case 'UCS-4BE': + case 'UCS4BE': + $data = "\x00\x00\xfe\xff".$data; + break; + + case 'UTF-32LE': + case 'UTF32LE': + case 'UCS-4LE': + case 'UCS4LE': + $data = "\xff\xfe\x00\x00".$data; + break; + } + } + + $parser = xml_parser_create(NULL); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); + xml_set_element_handler($parser, "start_element", "end_element"); + xml_set_object($parser, $this); + + if ($this->chunk_size == 0) { + $success = @xml_parse($parser, $data, true); + } else { + for ($offset = 0; $offset < strlen($data); + $offset += $this->chunk_size) { + $success = @xml_parse($parser, substr($data, $offset, $this->chunk_size), false); + if (!$success) { + break; + } + } + if ($success) { + $success = @xml_parse($parser, "", true); + } + } + + echo "Encoding: $this->encoding\n"; + echo "XML Prologue: ".($this->prologue ? 'present': 'not present'), "\n"; + echo "Chunk size: ".($this->chunk_size ? "$this->chunk_size byte(s)\n": "all data at once\n"); + echo "BOM: ".($this->bom ? 'prepended': 'not prepended'), "\n"; + + if ($success) { + var_dump($this->tags); + } else { + echo "[Error] ", xml_error_string(xml_get_error_code($parser)), "\n"; + } + } +} +$suite = array( + new testcase("UTF-8", 0, 0, 0), + new testcase("UTF-8", 0, 0, 1), + new testcase("UTF-8", 0, 1, 0), + new testcase("UTF-8", 0, 1, 1), + new testcase("UTF-16BE", 0, 0, 0), + new testcase("UTF-16BE", 0, 1, 0), + new testcase("UTF-16BE", 0, 1, 1), + new testcase("UTF-16LE", 0, 0, 0), + new testcase("UTF-16LE", 0, 1, 0), + new testcase("UTF-16LE", 0, 1, 1), + new testcase("UTF-8", 1, 0, 0), + new testcase("UTF-8", 1, 0, 1), + new testcase("UTF-8", 1, 1, 0), + new testcase("UTF-8", 1, 1, 1), + new testcase("UTF-16BE", 1, 0, 0), + new testcase("UTF-16BE", 1, 1, 0), + new testcase("UTF-16BE", 1, 1, 1), + new testcase("UTF-16LE", 1, 0, 0), + new testcase("UTF-16LE", 1, 1, 0), + new testcase("UTF-16LE", 1, 1, 1), +); + +if (XML_SAX_IMPL == 'libxml') { + echo "libxml2 Version => " . LIBXML_DOTTED_VERSION. "\n"; +} else { + echo "libxml2 Version => NONE\n"; +} + +foreach ($suite as $testcase) { + $testcase->run(); +} + +// vim600: sts=4 sw=4 ts=4 encoding=UTF-8 +?> +--EXPECTF-- +libxml2 Version => %s +Encoding: UTF-8 +XML Prologue: present +Chunk size: all data at once +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-8 +XML Prologue: not present +Chunk size: all data at once +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-8 +XML Prologue: present +Chunk size: all data at once +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-8 +XML Prologue: not present +Chunk size: all data at once +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16BE +XML Prologue: present +Chunk size: all data at once +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16BE +XML Prologue: present +Chunk size: all data at once +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16BE +XML Prologue: not present +Chunk size: all data at once +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16LE +XML Prologue: present +Chunk size: all data at once +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16LE +XML Prologue: present +Chunk size: all data at once +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16LE +XML Prologue: not present +Chunk size: all data at once +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-8 +XML Prologue: present +Chunk size: 1 byte(s) +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-8 +XML Prologue: not present +Chunk size: 1 byte(s) +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-8 +XML Prologue: present +Chunk size: 1 byte(s) +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-8 +XML Prologue: not present +Chunk size: 1 byte(s) +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16BE +XML Prologue: present +Chunk size: 1 byte(s) +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16BE +XML Prologue: present +Chunk size: 1 byte(s) +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16BE +XML Prologue: not present +Chunk size: 1 byte(s) +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16LE +XML Prologue: present +Chunk size: 1 byte(s) +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16LE +XML Prologue: present +Chunk size: 1 byte(s) +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: UTF-16LE +XML Prologue: not present +Chunk size: 1 byte(s) +BOM: prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/bug32001b.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/bug32001b.phpt new file mode 100755 index 0000000000000..f4aea08e5da40 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/bug32001b.phpt @@ -0,0 +1,184 @@ +--TEST-- +Bug #32001 (xml_parse*() goes into infinite loop when autodetection in effect), using EUC-JP, Shift_JIS, GB2312 +--SKIPIF-- + +--FILE-- +encoding = $enc; + $this->chunk_size = $chunk_size; + $this->bom = $bom; + $this->prologue = !$omit_prologue; + $this->tags = array(); + } + + function start_element($parser, $name, $attrs) { + $attrs = array_map('bin2hex', $attrs); + $this->tags[] = bin2hex($name).": ".implode(', ', $attrs); + } + + function end_element($parser, $name) { + } + + function run() { + $data = ''; + + if ($this->prologue) { + $canonical_name = preg_replace('/BE|LE/i', '', $this->encoding); + $data .= "\n"; + } + + $data .= << + <テスト:テスト2 テスト="テスト"> + <テスト:テスト3> + test! + + + +HERE; + + $data = iconv("UTF-8", $this->encoding, $data); + + $parser = xml_parser_create(NULL); + xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); + xml_set_element_handler($parser, "start_element", "end_element"); + xml_set_object($parser, $this); + + if ($this->chunk_size == 0) { + $success = @xml_parse($parser, $data, true); + } else { + for ($offset = 0; $offset < strlen($data); + $offset += $this->chunk_size) { + $success = @xml_parse($parser, substr($data, $offset, $this->chunk_size), false); + if (!$success) { + break; + } + } + if ($success) { + $success = @xml_parse($parser, "", true); + } + } + + echo "Encoding: $this->encoding\n"; + echo "XML Prologue: ".($this->prologue ? 'present': 'not present'), "\n"; + echo "Chunk size: ".($this->chunk_size ? "$this->chunk_size byte(s)\n": "all data at once\n"); + echo "BOM: ".($this->bom ? 'prepended': 'not prepended'), "\n"; + + if ($success) { + var_dump($this->tags); + } else { + echo "[Error] ", xml_error_string(xml_get_error_code($parser)), "\n"; + } + } +} +$suite = array( + new testcase("EUC-JP" , 0), + new testcase("EUC-JP" , 1), + new testcase("Shift_JIS", 0), + new testcase("Shift_JIS", 1), + new testcase("GB2312", 0), + new testcase("GB2312", 1), +); + +if (XML_SAX_IMPL == 'libxml') { + $php = getenv('TEST_PHP_EXECUTABLE'); + preg_match("/^libxml2 Version.*\$/im", `$php -i`, $match); + echo $match[0], "\n"; +} else { + echo "libxml2 Version => NONE\n"; +} + +foreach ($suite as $testcase) { + $testcase->run(); +} + +// vim600: sts=4 sw=4 ts=4 encoding=UTF-8 +?> +--EXPECTF-- +libxml2 Version => %s +Encoding: EUC-JP +XML Prologue: present +Chunk size: all data at once +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: EUC-JP +XML Prologue: present +Chunk size: 1 byte(s) +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: Shift_JIS +XML Prologue: present +Chunk size: all data at once +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: Shift_JIS +XML Prologue: present +Chunk size: 1 byte(s) +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: GB2312 +XML Prologue: present +Chunk size: all data at once +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} +Encoding: GB2312 +XML Prologue: present +Chunk size: 1 byte(s) +BOM: not prepended +array(3) { + [0]=> + string(128) "e38386e382b9e383883ae38386e382b9e3838831: 687474703a2f2f7777772e6578616d706c652e636f6d2fe38386e382b9e383882f, e38386e382b9e38388" + [1]=> + string(60) "e38386e382b9e383883ae38386e382b9e3838832: e38386e382b9e38388" + [2]=> + string(42) "e38386e382b9e383883ae38386e382b9e3838833: " +} diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/bug35447.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/bug35447.phpt new file mode 100644 index 0000000000000..8cbb5e519323c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/bug35447.phpt @@ -0,0 +1,49 @@ +--TEST-- +Bug #35447 (xml_parse_into_struct() chokes on the UTF-8 BOM) +--SKIPIF-- + +--FILE-- + + + +]> +A bient&244;t +END_OF_XML; + +$parser = xml_parser_create_ns('UTF-8'); +xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); +$result = xml_parse_into_struct($parser, $data, $vals, $index); +xml_parser_free($parser); +var_dump($vals); +?> +--EXPECT-- +array(1) { + [0]=> + array(5) { + ["tag"]=> + string(8) "resource" + ["type"]=> + string(8) "complete" + ["level"]=> + int(1) + ["attributes"]=> + array(2) { + ["key"]=> + string(7) "rSeeYou" + ["type"]=> + string(7) "literal" + } + ["value"]=> + string(13) "A bient&244;t" + } +} diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/inc.ent b/phpt/tests/php-5.2.5/ext/xml/tests/inc.ent new file mode 100644 index 0000000000000..8f86465c2ab0e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/inc.ent @@ -0,0 +1 @@ + diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/skipif.inc b/phpt/tests/php-5.2.5/ext/xml/tests/skipif.inc new file mode 100644 index 0000000000000..44898f3da63c2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/skipif.inc @@ -0,0 +1,10 @@ + diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/xml001.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/xml001.phpt new file mode 100644 index 0000000000000..62d597c5f8e5a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/xml001.phpt @@ -0,0 +1,99 @@ +--TEST-- +XML parser test, function callbacks +--SKIPIF-- + +--INI-- +magic_quotes_runtime=0 +--FILE-- + +--EXPECT-- +{?[]}{?[ +]}{?[]}{?[ +]}{?[%incent;]}{?[ +]}{?[]]}{?[>]}{?[ +]}{ROOT ID="elem1"}{CDATA[ +]}{CDATA[ Plain text.]}{CDATA[ +]}{CDATA[ ]}{ELEM1}{CDATA[ +]}{CDATA[ ]}{?[]}{CDATA[ +]}{CDATA[ ]}{ELEM2}{CDATA[ +]}{CDATA[ ]}{?[]}{CDATA[ +]}{CDATA[ ]}{ELEM3}{CDATA[ +]}{CDATA[ ]}{ENTREF[&included-entity;]}{CDATA[ +]}{CDATA[ ]}{ELEM4}{CDATA[ +]}{CDATA[ ]}{PI[test,processing instruction ]}{CDATA[ +]}{CDATA[ ]}{/ELEM4}{CDATA[ +]}{CDATA[ ]}{/ELEM3}{CDATA[ +]}{CDATA[ ]}{/ELEM2}{CDATA[ +]}{CDATA[ ]}{/ELEM1}{CDATA[ +]}{/ROOT}{?[ +]}parse complete diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/xml002.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/xml002.phpt new file mode 100644 index 0000000000000..8ae8dfbe66d12 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/xml002.phpt @@ -0,0 +1,100 @@ +--TEST-- +XML parser test, object tuple callbacks +--SKIPIF-- + +--INI-- +magic_quotes_runtime=0 +--FILE-- + +--EXPECT-- +{?[]}{?[ +]}{?[]}{?[ +]}{?[%incent;]}{?[ +]}{?[]]}{?[>]}{?[ +]}{ROOT ID="elem1"}{CDATA[ +]}{CDATA[ Plain text.]}{CDATA[ +]}{CDATA[ ]}{ELEM1}{CDATA[ +]}{CDATA[ ]}{?[]}{CDATA[ +]}{CDATA[ ]}{ELEM2}{CDATA[ +]}{CDATA[ ]}{?[]}{CDATA[ +]}{CDATA[ ]}{ELEM3}{CDATA[ +]}{CDATA[ ]}{ENTREF[&included-entity;]}{CDATA[ +]}{CDATA[ ]}{ELEM4}{CDATA[ +]}{CDATA[ ]}{PI[test,processing instruction ]}{CDATA[ +]}{CDATA[ ]}{/ELEM4}{CDATA[ +]}{CDATA[ ]}{/ELEM3}{CDATA[ +]}{CDATA[ ]}{/ELEM2}{CDATA[ +]}{CDATA[ ]}{/ELEM1}{CDATA[ +]}{/ROOT}{?[ +]}parse complete diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/xml003.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/xml003.phpt new file mode 100644 index 0000000000000..311c81acfbf46 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/xml003.phpt @@ -0,0 +1,98 @@ +--TEST-- +XML parser test, xml_set_object callbacks +--SKIPIF-- + +--INI-- +magic_quotes_runtime=0 +--FILE-- + +--EXPECT-- +{?[]}{?[ +]}{?[]}{?[ +]}{?[%incent;]}{?[ +]}{?[]]}{?[>]}{?[ +]}{ROOT ID="elem1"}{CDATA[ +]}{CDATA[ Plain text.]}{CDATA[ +]}{CDATA[ ]}{ELEM1}{CDATA[ +]}{CDATA[ ]}{?[]}{CDATA[ +]}{CDATA[ ]}{ELEM2}{CDATA[ +]}{CDATA[ ]}{?[]}{CDATA[ +]}{CDATA[ ]}{ELEM3}{CDATA[ +]}{CDATA[ ]}{ENTREF[&included-entity;]}{CDATA[ +]}{CDATA[ ]}{ELEM4}{CDATA[ +]}{CDATA[ ]}{PI[test,processing instruction ]}{CDATA[ +]}{CDATA[ ]}{/ELEM4}{CDATA[ +]}{CDATA[ ]}{/ELEM3}{CDATA[ +]}{CDATA[ ]}{/ELEM2}{CDATA[ +]}{CDATA[ ]}{/ELEM1}{CDATA[ +]}{/ROOT}{?[ +]}parse complete diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/xml004.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/xml004.phpt new file mode 100644 index 0000000000000..78840ee122762 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/xml004.phpt @@ -0,0 +1,64 @@ +--TEST-- +XML parser case folding test +--SKIPIF-- + +--INI-- +magic_quotes_runtime=0 +--FILE-- +\n"; +} + +function end_element($xp, $elem) +{ + print "\n"; +} +?> +--EXPECT-- + + + + + + + + + + + + + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/xml006.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/xml006.phpt new file mode 100644 index 0000000000000..c714e85913979 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/xml006.phpt @@ -0,0 +1,12 @@ +--TEST-- +UTF-8<->ISO Latin 1 encoding/decoding test +--SKIPIF-- + +--FILE-- + %s\n", urlencode("æ"), urlencode(utf8_encode("æ"))); +printf("%s <- %s\n", urlencode(utf8_decode(urldecode("%C3%A6"))), "%C3%A6"); +?> +--EXPECT-- +%E6 -> %C3%A6 +%E6 <- %C3%A6 diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/xml007.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/xml007.phpt new file mode 100644 index 0000000000000..377475bb1c5b7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/xml007.phpt @@ -0,0 +1,53 @@ +--TEST-- +xml_parse_into_struct/umlauts in tags +--SKIPIF-- + +--FILE-- +<äöü üäß="Üäß">ÄÖÜ'; +$parser = xml_parser_create('ISO-8859-1'); +xml_set_element_handler($parser, "startHandler", "endHandler"); +xml_parse_into_struct($parser, $xmldata, $struct, $index); +var_dump($struct); +?> +--EXPECT-- +string(3) "ÄÖÜ" +array(1) { + ["ÜÄß"]=> + string(3) "Üäß" +} +string(3) "ÄÖÜ" +array(1) { + [0]=> + array(5) { + ["tag"]=> + string(3) "ÄÖÜ" + ["type"]=> + string(8) "complete" + ["level"]=> + int(1) + ["attributes"]=> + array(1) { + ["ÜÄß"]=> + string(3) "Üäß" + } + ["value"]=> + string(3) "ÄÖÜ" + } +} diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/xml009.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/xml009.phpt new file mode 100644 index 0000000000000..84b89bb48802a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/xml009.phpt @@ -0,0 +1,35 @@ +--TEST-- +XML parser test, default namespaces +--SKIPIF-- + +--FILE-- + + + + +HERE; + +$parser = xml_parser_create_ns("ISO-8859-1","@"); +xml_set_element_handler($parser,'start_elem','end_elem'); +xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); +xml_parse($parser, $xml); +xml_parser_free($parser); +?> +--EXPECT-- +string(24) "http://example.com/foo@a" +string(24) "http://example.com/bar@b" +string(24) "http://example.com/foo@c" diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/xml010.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/xml010.phpt new file mode 100644 index 0000000000000..e968442123423 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/xml010.phpt @@ -0,0 +1,39 @@ +--TEST-- +XML parser test, attributes +--SKIPIF-- + +--FILE-- + $value) { + print "$key = $value "; + } + print "\n"; +} +function end_elem() +{ +} + +$xml = << + + + +HERE; + +$parser = xml_parser_create_ns("ISO-8859-1","@"); +xml_set_element_handler($parser,'start_elem','end_elem'); +xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); +xml_parse($parser, $xml); +xml_parser_free($parser); +?> +--EXPECT-- +http://example.com/foo@a +http://example.com/bar@b foo = bar +http://example.com/bar@c http://example.com/bar@nix = null foo = bar diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/xml011.phpt b/phpt/tests/php-5.2.5/ext/xml/tests/xml011.phpt new file mode 100644 index 0000000000000..9c4cfca8f14ac --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/xml011.phpt @@ -0,0 +1,71 @@ +--TEST-- +XML Parser test: concat character data and set empty handlers +--SKIPIF-- + +--FILE-- +"; +} +function end_elem() +{ + echo ""; +} + +$xml = 'start This & that'; + +$parser = xml_parser_create(); +xml_parse_into_struct($parser, $xml, $vals, $index); +print_r($vals); +xml_parser_free($parser); + +echo "\nChange to empty end handler\n"; +$parser = xml_parser_create(); +xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); +xml_set_element_handler($parser,'start_elem','end_elem'); +xml_set_element_handler($parser,'start_elem',NULL); +xml_parse($parser, $xml, TRUE); + +xml_parser_free($parser); +echo "\nDone\n"; +?> +--EXPECT-- +Array +( + [0] => Array + ( + [tag] => TEXT + [type] => open + [level] => 1 + [value] => start + ) + + [1] => Array + ( + [tag] => B + [type] => complete + [level] => 2 + ) + + [2] => Array + ( + [tag] => TEXT + [value] => This & that + [type] => cdata + [level] => 1 + ) + + [3] => Array + ( + [tag] => TEXT + [type] => close + [level] => 1 + ) + +) + +Change to empty end handler + +Done diff --git a/phpt/tests/php-5.2.5/ext/xml/tests/xmltest.xml b/phpt/tests/php-5.2.5/ext/xml/tests/xmltest.xml new file mode 100644 index 0000000000000..c15d6ea1ab04d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xml/tests/xmltest.xml @@ -0,0 +1,20 @@ + + +%incent; +]> + + Plain text. + + + + + + &included-entity; + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/001.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/001.phpt new file mode 100644 index 0000000000000..cf3d312b90403 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/001.phpt @@ -0,0 +1,29 @@ +--TEST-- +XMLReader: libxml2 XML Reader, string data +--SKIPIF-- + +--FILE-- + +'; + +$reader = new XMLReader(); +$reader->XML($xmlstring); + +// Only go through +while ($reader->read()) { + echo $reader->name."\n"; +} +$xmlstring = ''; +$reader = new XMLReader(); +$reader->XML($xmlstring); +?> +===DONE=== +--EXPECTF-- +books +books + +Warning: XMLReader::XML(): Empty string supplied as input in %s on line %d +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/002.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/002.phpt new file mode 100644 index 0000000000000..c9bf68ba1901d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/002.phpt @@ -0,0 +1,41 @@ +--TEST-- +XMLReader: libxml2 XML Reader, file data +--SKIPIF-- + +--FILE-- + +'; +file_put_contents($filename, $xmlstring); + +$reader = new XMLReader(); +if ($reader->open('')) exit(); + +$reader = new XMLReader(); +if (!$reader->open($filename)) { + $reader->close(); + exit(); +} + +// Only go through +while ($reader->read()) { + echo $reader->name."\n"; +} +$reader->close(); +unlink($filename); +touch($filename); +$reader = new XMLReader(); +$reader->open($filename); +$reader->close(); +unlink($filename); + +?> +===DONE=== +--EXPECTF-- + +Warning: XMLReader::open(): Empty string supplied as input in %s on line %d +books +books +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/003.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/003.phpt new file mode 100644 index 0000000000000..bddb58dea34ce --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/003.phpt @@ -0,0 +1,84 @@ +--TEST-- +XMLReader: libxml2 XML Reader, attributes test +--SKIPIF-- + +--FILE-- + +book1'; +file_put_contents($filename, $xmlstring); + +$reader = new XMLReader(); +if (!$reader->open($filename)) { + exit(); +} + +// Only go through +while ($reader->read()) { + if ($reader->nodeType != XMLREADER::END_ELEMENT) { + if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { + $attr = $reader->moveToFirstAttribute(); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + if ($reader->getAttribute($reader->name) == $reader->value) { + echo "1st attr (num) failed\n"; + } + + + $attr = $reader->moveToNextAttribute(); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + if ($reader->getAttribute($reader->name) == $reader->value) { + echo "2nd attr (idx) failed\n"; + } + + // Named attribute + $attr = $reader->moveToAttribute('num'); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + if ($reader->getAttribute('num') == $reader->value) { + echo "attr num failed\n"; + } + + $attr = $reader->moveToAttribute('idx'); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + if ($reader->getAttribute('idx') == $reader->value) { + echo "attr idx failed\n"; + } + + // Numeric positions of attributes + $attr = $reader->moveToAttributeNo(0); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + if ($reader->getAttributeNo(0) == $reader->value) { + echo "attr 0 failed\n"; + } + + $attr = $reader->moveToAttributeNo(1); + echo $reader->name . ": "; + echo $reader->value . "\n"; + + } + } +} +$reader->close(); +unlink($filename); +?> +===DONE=== +--EXPECT-- +num: 1 +idx: 2 +num: 1 +idx: 2 +num: 1 +idx: 2 +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/004.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/004.phpt new file mode 100644 index 0000000000000..ff22cce8ede3a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/004.phpt @@ -0,0 +1,44 @@ +--TEST-- +XMLReader: libxml2 XML Reader, attributes test +--SKIPIF-- + +--FILE-- + +book1'; +file_put_contents($filename, $xmlstring); + +$reader = new XMLReader(); +if (!$reader->open($filename)) { + exit(); +} + +while ($reader->read()) { + if ($reader->nodeType != XMLREADER::END_ELEMENT) { + echo $reader->name."\n"; + if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { + $attr = $reader->moveToFirstAttribute(); + while ($attr) { + echo " Attribute Name: ".$reader->name."\n"; + echo " Attribute Value: ".$reader->value."\n"; + $attr = $reader->moveToNextAttribute(); + } + } + } +} +$reader->close(); +unlink($filename); +?> +===DONE=== +--EXPECT-- +books +book + Attribute Name: num + Attribute Value: 1 + Attribute Name: idx + Attribute Value: 2 +#text +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/005.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/005.phpt new file mode 100644 index 0000000000000..ce2a5361de3c9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/005.phpt @@ -0,0 +1,37 @@ +--TEST-- +XMLReader: libxml2 XML Reader, parser property set/get +--SKIPIF-- + +--FILE-- + +'; + +$reader = new XMLReader(); + +$reader->XML($xmlstring); + + +$a = $reader->setParserProperty(XMLReader::LOADDTD, false); +$b = $reader->getParserProperty(XMLReader::LOADDTD); + +if (!$a && !$b) { + echo "ok\n"; +} + +$a = $reader->setParserProperty(XMLReader::SUBST_ENTITIES, true); +$b = $reader->getParserProperty(XMLReader::SUBST_ENTITIES); + +if ($a && $b) { + echo "ok\n"; +} +// Only go through +while ($reader->read()); +$reader->close(); +?> +===DONE=== +--EXPECT-- +ok +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/006.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/006.phpt new file mode 100644 index 0000000000000..d482d020bf295 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/006.phpt @@ -0,0 +1,36 @@ +--TEST-- +XMLReader: libxml2 XML Reader, moveToElement +--SKIPIF-- + +--FILE-- + +'; + +$reader = new XMLReader(); + +$reader->XML($xmlstring); + +// 2 read to get on the 2nd node +$reader->read(); +$reader->read(); + +if ($reader->nodeType != XMLREADER::END_ELEMENT) { + if ($reader->nodeType == XMLREADER::ELEMENT && $reader->hasAttributes) { + $attr = $reader->moveToFirstAttribute(); + if ($reader->moveToElement()) { + if ($reader->name == 'book') { + echo "ok\n"; + } + } + } +} + +$reader->close(); +?> +===DONE=== +--EXPECT-- +ok +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/007.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/007.phpt new file mode 100644 index 0000000000000..a94bc38590737 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/007.phpt @@ -0,0 +1,57 @@ +--TEST-- +XMLReader: libxml2 XML Reader, setRelaxNGSchema +--SKIPIF-- + +--FILE-- +hello'; +$relaxngfile = dirname(__FILE__) . '/relaxNG.rng'; +$file = dirname(__FILE__) . '/__007.xml'; +file_put_contents($file, $xmlstring); + +$reader = new XMLReader(); +$reader->open($file); + +if ($reader->setRelaxNGSchema($relaxngfile)) { + while ($reader->read()); +} +if ($reader->isValid()) { + print "file relaxNG: ok\n"; +} else { + print "file relaxNG: failed\n"; +} +$reader->close(); +unlink($file); + + +$reader = new XMLReader(); +$reader->XML($xmlstring); + +if ($reader->setRelaxNGSchema($relaxngfile)) { + while ($reader->read()); +} +if ($reader->isValid()) { + print "string relaxNG: ok\n"; +} else { + print "string relaxNG: failed\n"; +} + +$reader->close(); + +$reader = new XMLReader(); +$reader->XML($xmlstring); + +if ($reader->setRelaxNGSchema('')) { + echo 'failed'; +} +$reader->close(); +?> +===DONE=== +--EXPECTF-- +file relaxNG: ok +string relaxNG: ok + +Warning: XMLReader::setRelaxNGSchema(): Schema data source is required in %s on line %d +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/008.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/008.phpt new file mode 100644 index 0000000000000..8f3354726945f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/008.phpt @@ -0,0 +1,71 @@ +--TEST-- +XMLReader: libxml2 XML Reader, DTD +--SKIPIF-- + +--FILE-- + + + + +Move Title 1 +Location 1 + + + +Move Title 2 + +Location 2 + + +'; + +$dtdfile = rawurlencode(dirname(__FILE__)) . '/dtdexample.dtd'; +$file = dirname(__FILE__) . '/__008.xml'; +file_put_contents($file, $xmlstring); + + +$reader = new XMLReader(); +$reader->open($file); +$reader->setParserProperty(XMLREADER::LOADDTD, TRUE); +$reader->setParserProperty(XMLREADER::VALIDATE, TRUE); +while($reader->read()); +if ($reader->isValid()) { + echo "file DTD: ok\n"; +} +$reader->close(); +unlink($file); + +$xmlstring = ' + + + +Move Title 1 +Location 1 + + + +Move Title 2 + +Location 2 + + +'; + +$reader = new XMLReader(); +$reader->XML($xmlstring); + +$reader->setParserProperty(XMLREADER::LOADDTD, TRUE); +$reader->setParserProperty(XMLREADER::VALIDATE, TRUE); +while($reader->read()); +if ($reader->isValid()) { + echo "string DTD: ok\n"; +} +?> +===DONE=== +--EXPECTF-- +file DTD: ok +string DTD: ok +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/009.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/009.phpt new file mode 100644 index 0000000000000..3e9957d3eae97 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/009.phpt @@ -0,0 +1,28 @@ +--TEST-- +XMLReader: libxml2 XML Reader, next +--SKIPIF-- + +--FILE-- + +'; + +$reader = new XMLReader(); +$reader->XML($xmlstring); + +// Only go through +$reader->read(); +$reader->read(); + +$reader->next(); +echo $reader->name; +echo " "; +echo $reader->getAttribute('num'); +echo "\n"; +?> +===DONE=== +--EXPECTF-- +book 2 +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/010.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/010.phpt new file mode 100644 index 0000000000000..37d2a8ede567c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/010.phpt @@ -0,0 +1,27 @@ +--TEST-- +XMLReader: libxml2 XML Reader, next +--SKIPIF-- + +--FILE-- + +book1'; + +$reader = new XMLReader(); +$reader->XML($xmlstring); + +// Only go through +$reader->read(); +$reader->read(); + +$reader->next(); +echo $reader->name; +echo " "; +echo $reader->getAttributeNs('isbn', 'uri'); +echo "\n"; +?> +===DONE=== +--EXPECTF-- +prefix:books 12isbn +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/011.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/011.phpt new file mode 100644 index 0000000000000..be31bbe473507 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/011.phpt @@ -0,0 +1,34 @@ +--TEST-- +XMLReader: libxml2 XML Reader, string data +--SKIPIF-- + +--FILE-- + +test'; + +$reader = new XMLReader(); +$reader->XML($xmlstring); +$reader->read(); +echo $reader->readInnerXml(); +echo "\n"; +$reader->close(); + + +$reader = new XMLReader(); +$reader->XML($xmlstring); +$reader->read(); +echo $reader->readOuterXml(); +echo "\n"; +$reader->close(); +?> +===DONE=== +--EXPECT-- +test +test +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/012.dtd b/phpt/tests/php-5.2.5/ext/xmlreader/tests/012.dtd new file mode 100755 index 0000000000000..b65412af0e6a9 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/012.dtd @@ -0,0 +1,2 @@ + + diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/012.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/012.phpt new file mode 100755 index 0000000000000..ccd9d3b0b4b59 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/012.phpt @@ -0,0 +1,69 @@ +--TEST-- +XMLReader: accessing empty and non existing attributes +--SKIPIF-- + +--FILE-- + + +EOF; + +$reader = new XMLReader(); +$reader->XML($xmlstring); +$reader->read(); +var_dump($reader->getAttribute('bar')); +var_dump($reader->getAttribute('baz')); +$reader->close(); + +$xmlstring =<< + + +EOF; + +$xmlstring = str_replace('012.dtd', dirname(__FILE__).'/012.dtd', $xmlstring); + +$reader = new XMLReader(); +$reader->XML($xmlstring); +$reader->setParserProperty(XMLReader::DEFAULTATTRS, true); +while($reader->read() && $reader->nodeType != XMLReader::ELEMENT); +var_dump($reader->getAttribute('bar')); +var_dump($reader->getAttribute('baz')); +$reader->close(); + +?> +===FILE=== +open(dirname(__FILE__) . '/012.xml'); +//$reader->setParserProperty(XMLReader::DEFAULTATTRS, true); +while($reader->read() && $reader->nodeType != XMLReader::ELEMENT); +var_dump($reader->getAttribute('bar')); +var_dump($reader->getAttribute('baz')); +$reader->close(); + +$reader = new XMLReader(); +$reader->open(dirname(__FILE__) . '/012.xml'); +$reader->setParserProperty(XMLReader::DEFAULTATTRS, true); +while($reader->read() && $reader->nodeType != XMLReader::ELEMENT); +var_dump($reader->getAttribute('bar')); +var_dump($reader->getAttribute('baz')); +$reader->close(); + +?> +===DONE=== +--EXPECT-- +string(0) "" +NULL +string(0) "" +string(0) "" +===FILE=== +string(0) "" +NULL +string(0) "" +string(0) "" +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/012.xml b/phpt/tests/php-5.2.5/ext/xmlreader/tests/012.xml new file mode 100755 index 0000000000000..5012bd5eff691 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/012.xml @@ -0,0 +1,3 @@ + + + diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/013.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/013.phpt new file mode 100755 index 0000000000000..673aa9ca9e2f0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/013.phpt @@ -0,0 +1,52 @@ +--TEST-- +XMLReader: Schema validation +--SKIPIF-- + + +--FILE-- + + + 123 + 456 + +EOF; + +$reader = new XMLReader(); +$reader->XML($xml); +$reader->setSchema(dirname(__FILE__) . '/013.xsd'); +while($reader->read()) { + if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'item') { + $reader->read(); + var_dump($reader->value); + } +} +$reader->close(); + +?> +===FAIL=== + + +EOF; + +$reader = new XMLReader(); +$reader->XML($xml); +$reader->setSchema(dirname(__FILE__) . '/013.xsd'); +while($reader->read() && $reader->nodeType != XMLReader::ELEMENT); +$reader->close(); + +?> +===DONE=== +--EXPECTF-- +string(3) "123" +string(3) "456" +===FAIL=== + +Warning: XMLReader::read(): Element 'foo': %s +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/013.xsd b/phpt/tests/php-5.2.5/ext/xmlreader/tests/013.xsd new file mode 100755 index 0000000000000..50b000b6fcb05 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/013.xsd @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/bug36743.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/bug36743.phpt new file mode 100644 index 0000000000000..374941b0c712f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/bug36743.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #36743 (In a class extending XMLReader array properties are not writable) +--SKIPIF-- + +--FILE-- +testArr[] = 1; + var_dump($this->testArr); + } +} + +$t = new test; + +echo "Done\n"; +?> +--EXPECT-- +array(1) { + [0]=> + int(1) +} +Done diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/bug42139.phpt b/phpt/tests/php-5.2.5/ext/xmlreader/tests/bug42139.phpt new file mode 100644 index 0000000000000..19602f01035dc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/bug42139.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #42139 (XMLReader option constants are broken using XML()) +--SKIPIF-- + +--FILE-- + + + +]> +&x; +XML; + +$reader = new XMLReader; +$reader->XML( $xml, NULL, LIBXML_NOENT); +while ( $reader->read() ) { + echo "{$reader->nodeType}, {$reader->name}, {$reader->value}\n"; +} +$reader->close(); + +?> +--EXPECT-- +10, root, +1, root, +3, #text, y +15, root, diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/dtdexample.dtd b/phpt/tests/php-5.2.5/ext/xmlreader/tests/dtdexample.dtd new file mode 100644 index 0000000000000..ce53f0bc18c94 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/dtdexample.dtd @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG.rng b/phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG.rng new file mode 100644 index 0000000000000..f4357e04ef8ab --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG.rng @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG2.rng b/phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG2.rng new file mode 100644 index 0000000000000..4adae7b15113d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG2.rng @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG3.rng b/phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG3.rng new file mode 100644 index 0000000000000..73e1eb6165102 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlreader/tests/relaxNG3.rng @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/xmlrpc/tests/001.phpt b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/001.phpt new file mode 100644 index 0000000000000..99fd958d29fca --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/001.phpt @@ -0,0 +1,66 @@ +--TEST-- +xmlrpc_encode_request() with wrong arguments +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(174) " + +-1 + + + + 1 + + + + +" +string(160) " + + + + + + 1 + + + + +" + +Notice: Array to string conversion in %s on line %d +string(177) " + +Array + + + + 1 + + + + +" +string(175) " + +3.4 + + + + 1 + + + + +" +Done diff --git a/phpt/tests/php-5.2.5/ext/xmlrpc/tests/002.phpt b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/002.phpt new file mode 100644 index 0000000000000..c8d722b808fd0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/002.phpt @@ -0,0 +1,56 @@ +--TEST-- +xmlrpc_encode_request() and various arguments +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +array(0) { +} +string(6) "method" +array(1) { + [0]=> + int(1) +} +string(6) "method" +array(1) { + [0]=> + string(5) "param" +} +string(6) "method" +array(1) { + [0]=> + string(0) "" +} +string(2) "-1" + +Notice: Array to string conversion in %s on line %d +array(1) { + [0]=> + int(1) +} +string(5) "Array" +Done diff --git a/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug37057.phpt b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug37057.phpt new file mode 100644 index 0000000000000..013cc9192ce49 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug37057.phpt @@ -0,0 +1,64 @@ +--TEST-- +Bug #37057 (xmlrpc_decode() may produce arrays with numeric string keys which are unaccessible) +--SKIPIF-- + +--FILE-- + + + + + + + + 50 + 0.29 + + + + + +'; + +$retval=xmlrpc_decode($response); +var_dump($retval); +var_dump($retval["50"]); +var_dump($retval[50]); + +$response=' + + + + + + + 0 + 0.29 + + + + + +'; + +$retval=xmlrpc_decode($response); +var_dump($retval); +var_dump($retval["0"]); +var_dump($retval[0]); + +echo "Done\n"; +?> +--EXPECT-- +array(1) { + [50]=> + string(4) "0.29" +} +string(4) "0.29" +string(4) "0.29" +array(1) { + [0]=> + string(4) "0.29" +} +string(4) "0.29" +string(4) "0.29" +Done diff --git a/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug38431.phpt b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug38431.phpt new file mode 100644 index 0000000000000..288fe1041d901 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug38431.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #38431 (xmlrpc_get_type() crashes PHP on objects) +--SKIPIF-- + +--FILE-- +1,2,3); +var_dump(xmlrpc_get_type($var)); +$var = array("test"=>1,"test2"=>2); +var_dump(xmlrpc_get_type($var)); + +echo "Done\n"; +?> +--EXPECTF-- +string(5) "array" +string(5) "array" +string(5) "array" +string(5) "mixed" +string(6) "struct" +Done diff --git a/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug40576.phpt b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug40576.phpt new file mode 100644 index 0000000000000..6b73f4d2cd951 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug40576.phpt @@ -0,0 +1,77 @@ +--TEST-- +Bug #40576 (double values are truncated to 6 decimal digits when encoding) +--SKIPIF-- + +--INI-- +precision=12 +--FILE-- + +--EXPECTF-- +string(125) " + + + + 1.123456789 + + + +" +string(128) " + + + + 11234567891000 + + + +" +string(116) " + + + + 11234567 + + + +" +string(106) " + + + + + + + +" +string(118) " + + + + test + + + +" +string(139) " + + + + 1.22222222222222222222222 + + + +" +Done diff --git a/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug40576_64bit.phpt b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug40576_64bit.phpt new file mode 100644 index 0000000000000..bb4cbe78438cc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug40576_64bit.phpt @@ -0,0 +1,77 @@ +--TEST-- +Bug #40576 (double values are truncated to 6 decimal digits when encoding) +--SKIPIF-- + +--INI-- +precision=12 +--FILE-- + +--EXPECTF-- +string(125) " + + + + 1.123456789 + + + +" +string(119) " + + + + -1066555326 + + + +" +string(116) " + + + + 11234567 + + + +" +string(106) " + + + + + + + +" +string(118) " + + + + test + + + +" +string(139) " + + + + 1.22222222222222222222222 + + + +" +Done diff --git a/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug42189.phpt b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug42189.phpt new file mode 100644 index 0000000000000..55e726cf68707 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlrpc/tests/bug42189.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #42189 (xmlrpc_get_type() crashes PHP on invalid dates) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/001.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/001.phpt new file mode 100644 index 0000000000000..b21fd148c6f1b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/001.phpt @@ -0,0 +1,25 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, file buffer, flush +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- + + +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/002.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/002.phpt new file mode 100644 index 0000000000000..c8e6c324a3312 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/002.phpt @@ -0,0 +1,22 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, membuffer, flush +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- + + +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/003.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/003.phpt new file mode 100644 index 0000000000000..53f1b4d3bd47a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/003.phpt @@ -0,0 +1,35 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, membuffer, flush, attribute +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- + +Test text for tag1 +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/004.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/004.phpt new file mode 100644 index 0000000000000..ef436cb523ff1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/004.phpt @@ -0,0 +1,36 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, file buffer, flush +--SKIPIF-- + +--FILE-- + + +'); +unset($xw); +unlink('001.xml'); +if ($md5_out != $md5_res) { + echo "failed: $md5_res != $md5_out\n"; +} else { + echo "ok.\n"; +} +?> +===DONE=== +--EXPECT-- +ok. +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/005.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/005.phpt new file mode 100644 index 0000000000000..259e5dd39921a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/005.phpt @@ -0,0 +1,33 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, comments +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- + + +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/006.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/006.phpt new file mode 100644 index 0000000000000..21945d62e9762 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/006.phpt @@ -0,0 +1,26 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, startDTD/writeElementNS +--SKIPIF-- + +--FILE-- + +--EXPECT-- +dummy content diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/007.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/007.phpt new file mode 100644 index 0000000000000..3212dccaabd37 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/007.phpt @@ -0,0 +1,38 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, Elements & Attributes +--SKIPIF-- + +--FILE-- +\"'&"); +xmlwriter_end_attribute($xw); +xmlwriter_write_element($xw, 'chars', "special characters: <>\"'&"); +xmlwriter_end_element($xw); +xmlwriter_end_document($xw); +// Force to write and empty the buffer +$output = xmlwriter_flush($xw, true); +print $output; +?> +--EXPECT-- + + + + special characters: <>"'& + + diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/008.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/008.phpt new file mode 100644 index 0000000000000..cb6983d150892 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/008.phpt @@ -0,0 +1,40 @@ +--TEST-- +XMLWriter: libxml2 XML Writer DTD Element & Attlist +--SKIPIF-- + +--FILE-- + +--EXPECT-- + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/009.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/009.phpt new file mode 100644 index 0000000000000..021f2399c88a2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/009.phpt @@ -0,0 +1,45 @@ +--TEST-- +XMLWriter: PI, Comment, CDATA +--SKIPIF-- + +--FILE-- +&"'); +xmlwriter_end_cdata($xw); +xmlwriter_end_element($xw); +xmlwriter_end_element($xw); +xmlwriter_end_element($xw); +xmlwriter_end_document($xw); +// Force to write and empty the buffer +$output = xmlwriter_flush($xw, true); +print $output; +?> +--EXPECTF-- + + + + + %w + &"]]> + + diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/010.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/010.phpt new file mode 100644 index 0000000000000..9f066a7c3e190 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/010.phpt @@ -0,0 +1,45 @@ +--TEST-- +xmlwriter_start/end_attribute() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) +bool(true) + +Warning: xmlwriter_start_attribute(): Invalid Attribute Name in %s on line %d +bool(false) +bool(false) + +Warning: xmlwriter_start_attribute(): Invalid Attribute Name in %s on line %d +bool(false) +bool(false) +bool(true) +string(14) "" +Done diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_001.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_001.phpt new file mode 100644 index 0000000000000..b3f26cbeb22cf --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_001.phpt @@ -0,0 +1,26 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, file buffer, flush +--SKIPIF-- + +--FILE-- +openUri($doc_dest); +$xw->startDocument('1.0', 'UTF-8', 'standalonearg'); +$xw->startElement("tag1"); +$xw->endDocument(); + +// Force to write and empty the buffer +$output_bytes = $xw->flush(true); +echo file_get_contents($doc_dest); +unset($xw); +unlink('001.xml'); +?> +===DONE=== +--EXPECT-- + + +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_002.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_002.phpt new file mode 100644 index 0000000000000..488cb7307d19d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_002.phpt @@ -0,0 +1,22 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, membuffer, flush +--SKIPIF-- + +--FILE-- +openMemory(); +$xw->startDocument('1.0', 'UTF-8', 'standalone'); +$xw->startElement("tag1"); +$xw->endDocument(); + +// Force to write and empty the buffer +echo $xw->flush(true); +?> +===DONE=== +--EXPECT-- + + +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_003.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_003.phpt new file mode 100644 index 0000000000000..1e50a31a8a828 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_003.phpt @@ -0,0 +1,37 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, membuffer, flush, text, attribute +--SKIPIF-- + +--FILE-- +openMemory(); +$xw->startDocument('1.0', 'UTF-8'); +$xw->startElement("tag1"); + +$res = $xw->startAttribute('attr1'); +$xw->text("attr1_value"); +$xw->endAttribute(); + +$res = $xw->startAttribute('attr2'); +$xw->text("attr2_value"); +$xw->endAttribute(); + +$xw->text("Test text for tag1"); +$res = $xw->startElement('tag2'); +if ($res < 1) { + echo "StartElement context validation failed\n"; + exit(); +} +$xw->endDocument(); + +// Force to write and empty the buffer +echo $xw->flush(true); +?> +===DONE=== +--EXPECT-- + +Test text for tag1 +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_004.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_004.phpt new file mode 100644 index 0000000000000..b3e3b2af1a567 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_004.phpt @@ -0,0 +1,37 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, file buffer, flush +--SKIPIF-- + +--FILE-- +openUri($doc_dest); +$xw->startDocument('1.0', 'UTF-8'); +$xw->startElement("tag1"); + +$xw->startPi("PHP"); +$xw->text('echo $a;'); +$xw->endPi(); +$xw->endDocument(); + +// Force to write and empty the buffer +$xw->flush(true); +$md5_out = md5_file($doc_dest); +$md5_res = md5(' + +'); +unset($xw); +unlink('001.xml'); +if ($md5_out != $md5_res) { + echo "failed: $md5_res != $md5_out\n"; +} else { + echo "ok.\n"; +} +?> +===DONE=== +--EXPECT-- +ok. +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_005.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_005.phpt new file mode 100644 index 0000000000000..dd7a4e4559bef --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_005.phpt @@ -0,0 +1,33 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, comments +--SKIPIF-- + +--FILE-- +openUri($doc_dest); +$xw->startDocument('1.0', 'UTF-8'); +$xw->startElement("tag1"); +$xw->startComment(); +$xw->text('comment'); +$xw->endComment(); +$xw->writeComment("comment #2"); +$xw->endDocument(); + +// Force to write and empty the buffer +$output_bytes = $xw->flush(true); +echo file_get_contents($doc_dest); +unset($xw); +unlink('001.xml'); +?> +===DONE=== +--EXPECT-- + + +===DONE=== diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_006.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_006.phpt new file mode 100644 index 0000000000000..395992b6faec7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_006.phpt @@ -0,0 +1,27 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, startDTD/writeElementNS +--SKIPIF-- + +--FILE-- +openUri($doc_dest); +$xw->startDtd('foo', NULL, 'urn:bar'); +$xw->endDtd(); +$xw->startElement('foo'); +$xw->writeElementNS('foo', 'bar', 'urn:foo', 'dummy content'); +$xw->endElement(); + +// Force to write and empty the buffer +$output_bytes = $xw->flush(true); +echo file_get_contents($doc_dest); +unset($xw); +unlink('001.xml'); +?> +--EXPECT-- +dummy content diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_007.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_007.phpt new file mode 100644 index 0000000000000..0de07628dee32 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_007.phpt @@ -0,0 +1,39 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, Elements & Attributes +--SKIPIF-- + +--FILE-- +openMemory(); +$xw->setIndent(TRUE); +$xw->setIndentString(' '); +$xw->startDocument('1.0', "UTF-8"); +$xw->startElement('root'); +$xw->startElementNS('ns1', 'child1', 'urn:ns1'); +$xw->startAttributeNS('ns1', 'att1', 'urn:ns1'); +$xw->text('a&b'); +$xw->endAttribute(); +$xw->writeAttribute('att2', "double\" single'"); +$xw->startAttributeNS('ns1', 'att2', 'urn:ns1'); +$xw->text("<>\"'&"); +$xw->endAttribute(); +$xw->writeElement('chars', "special characters: <>\"'&"); +$xw->endElement(); +$xw->endDocument(); +// Force to write and empty the buffer +$output = $xw->flush(true); +print $output; +?> +--EXPECT-- + + + + special characters: <>"'& + + diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_008.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_008.phpt new file mode 100644 index 0000000000000..5541ba1dc8d6d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_008.phpt @@ -0,0 +1,35 @@ +--TEST-- +XMLWriter: libxml2 XML Writer DTD Element & Attlist +--SKIPIF-- + +--FILE-- +openMemory(); +$xw->setIndent(TRUE); +$xw->startDocument(NULL, "UTF-8"); +$xw->writeDtdElement('sxe', '(elem1+, elem11, elem22*)'); +$xw->writeDtdAttlist('sxe', 'id CDATA #implied'); +$xw->startDtdElement('elem1'); +$xw->text('elem2*'); +$xw->endDtdElement(); +$xw->startDtdAttlist('elem1'); +$xw->text("attr1 CDATA #required\n"); +$xw->text('attr2 CDATA #implied'); +$xw->endDtdAttlist(); +$xw->endDocument(); +// Force to write and empty the buffer +$output = $xw->flush(true); +print $output; +?> +--EXPECT-- + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_009.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_009.phpt new file mode 100644 index 0000000000000..7fc918ab15494 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/OO_009.phpt @@ -0,0 +1,45 @@ +--TEST-- +XMLWriter: PI, Comment, CDATA +--SKIPIF-- + +--FILE-- +openMemory(); +$xw->setIndent(TRUE); +$xw->startDocument("1.0", "UTF-8"); +$xw->startElement('root'); +$xw->writeAttribute('id', 'elem1'); +$xw->startElement('elem1'); +$xw->writeAttribute('attr1', 'first'); +$xw->writeComment('start PI'); +$xw->startElement('pi'); +$xw->writePi('php', 'echo "hello world"; '); +$xw->endElement(); +$xw->startElement('cdata'); +$xw->startCdata(); +$xw->text('<>&"'); +$xw->endCdata(); +$xw->endElement(); +$xw->endElement(); +$xw->endElement(); +$xw->endDocument(); +// Force to write and empty the buffer +$output = $xw->flush(true); +print $output; +?> +--EXPECTF-- + + + + + %w + &"]]> + + diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug39504.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug39504.phpt new file mode 100644 index 0000000000000..af97f81ed5918 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug39504.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #39504 (xmlwriter_write_dtd_entity() creates Attlist tag, not enity) +--SKIPIF-- + +--FILE-- +openMemory(); +$xw->startDocument(NULL, "UTF-8"); +$xw->startDtd("root"); +$xw->writeDtdEntity("c", NULL, 0, "-//W3C//TEXT copyright//EN", "http://www.w3.org/xmlspec/copyright.xml"); +$xw->endDtd(); +$xw->startElement("root"); +$xw->endDocument(); +print $xw->flush(true); + +?> +--EXPECTF-- + +]> + + +]> diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug41287.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug41287.phpt new file mode 100644 index 0000000000000..0612b21f15c54 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug41287.phpt @@ -0,0 +1,47 @@ +--TEST-- +Bug #41287 (Namespace functions don't allow xmlns defintion to be optional) +--SKIPIF-- + +--FILE-- +openMemory(); +$xw->setIndent(true); +$xw->startDocument(); +$xw->startElementNS('test', 'test', 'urn:x-test:'); +$xw->writeElementNS('test', 'foo', null, ''); +$xw->writeElementNS(null, 'bar', 'urn:x-test:', ''); +$xw->writeElementNS(null, 'bar', '', ''); +$xw->endElement(); +$xw->endDocument(); +print $xw->flush(true); +?> +--EXPECTF-- + + + + + + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug41326.phpt b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug41326.phpt new file mode 100644 index 0000000000000..9c154bfd39e9c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xmlwriter/tests/bug41326.phpt @@ -0,0 +1,56 @@ +--TEST-- +Bug #41287 (Writing empty tags with Xmlwriter::WriteElement[ns]) +--SKIPIF-- + +--FILE-- +openMemory(); +$xml->setIndent(true); +$xml->startDocument(); +$xml->startElement('test'); +$xml->writeElement('foo', null); +$xml->writeElement('foo2', ""); +$xml->writeElement('foo3'); +$xml->startElement('bar'); +$xml->endElement('bar'); +$xml->endElement(); +$xml->endElement(); +print $xml->flush(true); + +print "\n"; + +$xw = new XMLWriter(); +$xw->openMemory(); +$xw->setIndent(true); +$xw->startDocument(); +$xw->startElementNS('test', 'test', 'urn:x-test:'); +$xw->writeElementNS('test', 'foo', null, ''); +$xw->writeElementNS(null, 'bar', 'urn:x-test:', ''); +$xw->writeElementNS(null, 'bar', 'urn:x-test:', NULL); +$xw->writeElementNS(null, 'bar', 'urn:x-test:'); +$xw->writeElementNS(null, 'bar', '', ''); +$xw->endElement(); +$xw->endDocument(); +print $xw->flush(true); +?> +--EXPECTF-- +Warning: Wrong parameter count for XMLWriter::endElement() in %s on line %d + + + + + + + + + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/area_list.xsl b/phpt/tests/php-5.2.5/ext/xsl/tests/area_list.xsl new file mode 100644 index 0000000000000..e0c88c6215a53 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/area_list.xsl @@ -0,0 +1,10 @@ + + + + + + + + HERE + + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/area_name.xml b/phpt/tests/php-5.2.5/ext/xsl/tests/area_name.xml new file mode 100644 index 0000000000000..76cea58511edc --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/area_name.xml @@ -0,0 +1,12 @@ + + + + + 13 + "Ðвтово" м. + m."Avtovo" + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/bug26384.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/bug26384.phpt new file mode 100644 index 0000000000000..b8f80f8c3ea58 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/bug26384.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #26384 (domxslt->process causes segfault with xsl:key) +--SKIPIF-- + +--FILE-- +load(dirname(__FILE__)."/area_name.xml"); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} +$xsl = new domDocument; +$xsl->load(dirname(__FILE__)."/area_list.xsl"); +if(!$xsl) { + echo "Error while parsing the document\n"; + exit; +} +$proc = new xsltprocessor; +if(!$proc) { + echo "Error while making xsltprocessor object\n"; + exit; +} + +$proc->importStylesheet($xsl); +print $proc->transformToXml($dom); + +//this segfaulted before +print $dom->documentElement->firstChild->nextSibling->nodeName; + +--EXPECT-- +HERE +ROW diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/bug33853.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/bug33853.phpt new file mode 100755 index 0000000000000..bcf30f65a36ae --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/bug33853.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #33853 (php:function call __autoload with lowercase param) +--SKIPIF-- + +--FILE-- +loadXML(' + + + + +'); +$inputdom = new DomDocument(); +$inputdom->loadXML(' +'); + +$proc = new XsltProcessor(); +$proc->registerPhpFunctions(); +$xsl = $proc->importStylesheet($xsl); +$newdom = $proc->transformToDoc($inputdom); +?> +===DONE=== +--EXPECT-- +string(4) "TeSt" diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/documentxpath.xsl b/phpt/tests/php-5.2.5/ext/xsl/tests/documentxpath.xsl new file mode 100644 index 0000000000000..01035e82bedd1 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/documentxpath.xsl @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/exslt.xml b/phpt/tests/php-5.2.5/ext/xsl/tests/exslt.xml new file mode 100644 index 0000000000000..54913c6f5d83f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/exslt.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/exslt.xsl b/phpt/tests/php-5.2.5/ext/xsl/tests/exslt.xsl new file mode 100644 index 0000000000000..8f0baef6ca8fe --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/exslt.xsl @@ -0,0 +1,45 @@ + + + + + + + Test Date : + + year : + + leap-year : + + month-in-year : + + month-name : + + month-abbreviation : + + week-in-year : + + day-in-year : + + day-in-month : + + day-of-week-in-month : + + day-in-week : + + day-name : + + day-abbreviation : + + time : + + hour-in-day : + + minute-in-hour : + + second-in-minute : + + + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/prepare.inc b/phpt/tests/php-5.2.5/ext/xsl/tests/prepare.inc new file mode 100644 index 0000000000000..bd5bbee40cbc8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/prepare.inc @@ -0,0 +1,20 @@ +load(dirname(__FILE__)."/xslt.xml"); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} +$xsl = new domDocument; +$xsl->load(dirname(__FILE__)."/xslt.xsl"); +if(!$xsl) { + echo "Error while parsing the document\n"; + exit; +} +$proc = new xsltprocessor; +if(!$proc) { + echo "Error while making xsltprocessor object\n"; + exit; +} + +?> diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/skipif.inc b/phpt/tests/php-5.2.5/ext/xsl/tests/skipif.inc new file mode 100644 index 0000000000000..0ef73723a3b8b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/skipif.inc @@ -0,0 +1 @@ + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/streamsinclude.xsl b/phpt/tests/php-5.2.5/ext/xsl/tests/streamsinclude.xsl new file mode 100644 index 0000000000000..9b1c8be42cd73 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/streamsinclude.xsl @@ -0,0 +1,6 @@ + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xml b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xml new file mode 100644 index 0000000000000..b0e9506c7bf3e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xml @@ -0,0 +1,28 @@ + + + Title + + + + + + + + a1 + b1 + c1 + + + a2 + c2 + + + ä3 + b3 + c3 + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xsl b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xsl new file mode 100644 index 0000000000000..755687482d328 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xsl @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + +
    + + +
    +
    diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xsl.gz b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt.xsl.gz new file mode 100644 index 0000000000000000000000000000000000000000..910bb63c8e32fe078fcfbcc457ca21e6334ca041 GIT binary patch literal 395 zcmV;60d)Q!iwFpR+nhfD19)?6bS`*vYyfpqO^=%}5WVMDOszY-9^ z?V(o(CIQLVmOX^z-`DJBS+d%2um=3*eTm}v+-o?I51loo$dXh5nc6m;IhLXeR&KYO zoy^2@wJN?y3F}`?4(FgbiO1IyWJv~(Y5Ig&ijO}a-R9rE=bH`Gt*7GvKhF-OazjcdHHq005xZ#eV<* literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt001.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt001.phpt new file mode 100644 index 0000000000000..885e7c9824e56 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt001.phpt @@ -0,0 +1,22 @@ +--TEST-- +Test 1: Transform To XML String +--SKIPIF-- + +--FILE-- +importStylesheet($xsl); +print "\n"; +print $proc->transformToXml($dom); +print "\n"; + + +--EXPECT-- +Test 1: Transform To XML String + +bar +a1 b1 c1
    +a2 c2
    +ä3 b3 c3
    + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt002.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt002.phpt new file mode 100644 index 0000000000000..6c9f0c632c844 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt002.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test 2: Transform To HTML String +--SKIPIF-- + +--FILE-- +query("/xsl:stylesheet/xsl:output/@method"); +if ($res->length != 1) { + print "No or more than one xsl:output/@method found"; + exit; +} +$res->item(0)->value = "html"; +$proc->importStylesheet($xsl); +print "\n"; +print $proc->transformToXml($dom); +print "\n"; + + +--EXPECT-- +Test 2: Transform To HTML String +bar +a1 b1 c1
    +a2 c2
    +ä3 b3 c3
    + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt003.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt003.phpt new file mode 100644 index 0000000000000..a3c848b1b72de --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt003.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test 3: Using Parameters +--SKIPIF-- + +--FILE-- +importStylesheet($xsl); +$proc->setParameter( "", "foo","hello world"); +print "\n"; +print $proc->transformToXml($dom); +print "\n"; + + +--EXPECT-- +Test 3: Using Parameters + +hello world +a1 b1 c1
    +a2 c2
    +ä3 b3 c3
    + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt004.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt004.phpt new file mode 100644 index 0000000000000..6e8f47601805e --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt004.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test 4: Checking UTF8 Output +--SKIPIF-- + +--FILE-- +query("/xsl:stylesheet/xsl:output/@encoding"); +if ($res->length != 1) { + print "No or more than one xsl:output/@encoding found"; + exit; +} +$res->item(0)->value = "utf-8"; +$proc->importStylesheet($xsl); +print "\n"; +print $proc->transformToXml($dom); +print "\n"; + + +--EXPECT-- +Test 4: Checking UTF8 Output + +bar +a1 b1 c1
    +a2 c2
    +ä3 b3 c3
    + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt005.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt005.phpt new file mode 100644 index 0000000000000..a70e6ea4f1a7d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt005.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test 5: Checking Indent +--SKIPIF-- + +--FILE-- +query("/xsl:stylesheet/xsl:output/@indent"); +if ($res->length != 1) { + print "No or more than one xsl:output/@indent found"; + exit; +} +$res->item(0)->value = "yes"; +$proc->importStylesheet($xsl); +print "\n"; +print $proc->transformToXml($dom); +print "\n"; + + +--EXPECT-- +Test 5: Checking Indent + + + bar +a1 b1 c1
    +a2 c2
    +ä3 b3 c3
    + + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt006.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt006.phpt new file mode 100644 index 0000000000000..26fada1650028 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt006.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test 6: Transform To Doc +--SKIPIF-- + +--FILE-- +importStylesheet($xsl); +print "\n"; +$doc = $proc->transformToDoc($dom); +print $doc->saveXML(); +print "\n"; + + +--EXPECT-- +Test 6: Transform To Doc + +bar +a1 b1 c1
    +a2 c2
    +ä3 b3 c3
    + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt007.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt007.phpt new file mode 100644 index 0000000000000..bc6ad8477a417 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt007.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test 7: Transform To Uri +--SKIPIF-- + +--FILE-- +importStylesheet($xsl); +print "\n"; +$doc = $proc->transformToUri($dom, "file://".dirname(__FILE__)."/out.xml"); +print file_get_contents(dirname(__FILE__)."/out.xml"); +unlink(dirname(__FILE__)."/out.xml"); +print "\n"; + + +--EXPECT-- +Test 7: Transform To Uri + +bar +a1 b1 c1
    +a2 c2
    +ä3 b3 c3
    + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt008.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt008.phpt new file mode 100644 index 0000000000000..0efc88e8c5e86 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt008.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test 8: Stream Wrapper Includes +--SKIPIF-- + +--FILE-- +load(dirname(__FILE__)."/streamsinclude.xsl"); +if(!$xsl) { + echo "Error while parsing the document\n"; + exit; +} +chdir(dirname(__FILE__)); +$proc->importStylesheet($xsl); +print "\n"; +print $proc->transformToXML($dom); + + +--EXPECT-- +Test 8: Stream Wrapper Includes + +bar +a1 b1 c1
    +a2 c2
    +ä3 b3 c3
    + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt009.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt009.phpt new file mode 100644 index 0000000000000..f763e84daa6e7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt009.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test 9: Stream Wrapper XPath-Document() +--SKIPIF-- + +--FILE-- +load(dirname(__FILE__)."/documentxpath.xsl"); +if(!$xsl) { + echo "Error while parsing the document\n"; + exit; +} + +$proc->importStylesheet($xsl); +print "\n"; +print $proc->transformToXML($dom); + + +--EXPECT-- +Test 9: Stream Wrapper XPath-Document() + +foo diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt010.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt010.phpt new file mode 100644 index 0000000000000..1ac1a493c7fb5 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt010.phpt @@ -0,0 +1,115 @@ +--TEST-- +Test 10: EXSLT Support +--SKIPIF-- +hasExsltSupport()) die('skip EXSLT support not available'); +if (LIBXSLT_VERSION < 10117) die('skip too old libxsl'); +?> +--FILE-- +load(dirname(__FILE__)."/exslt.xsl"); + $proc = new xsltprocessor; + $xsl = $proc->importStylesheet($dom); + + $xml = new DomDocument(); + $xml->load(dirname(__FILE__)."/exslt.xml"); + + print $proc->transformToXml($xml); +--EXPECT-- +Test 10: EXSLT Support + + + Test Date : 0001-12-31Z + year : 1 + leap-year : false + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : 53 + day-in-year : 365 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 2 + day-name : Monday + day-abbreviation : Mon + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 3000-01-31 + year : 3000 + leap-year : false + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : 5 + day-in-year : 31 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 6 + day-name : Friday + day-abbreviation : Fri + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2000-02-29 + year : 2000 + leap-year : true + month-in-year : 2 + month-name : February + month-abbreviation : Feb + week-in-year : 9 + day-in-year : 60 + day-in-month : 29 + day-of-week-in-month : 5 + day-in-week : 3 + day-name : Tuesday + day-abbreviation : Tue + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 9990001-12-31Z + year : 9990001 + leap-year : false + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : 53 + day-in-year : 365 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 2 + day-name : Monday + day-abbreviation : Mon + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : -0004-02-29 + year : -4 + leap-year : true + month-in-year : 2 + month-name : February + month-abbreviation : Feb + week-in-year : 10 + day-in-year : 60 + day-in-month : 29 + day-of-week-in-month : 5 + day-in-week : 1 + day-name : Sunday + day-abbreviation : Sun + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.phpt new file mode 100644 index 0000000000000..5f7865279e2ff --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test 11: php:function Support +--SKIPIF-- + +--FILE-- +load(dirname(__FILE__)."/xslt011.xsl"); + $proc = new xsltprocessor; + $xsl = $proc->importStylesheet($dom); + + $xml = new DomDocument(); + $xml->load(dirname(__FILE__)."/xslt011.xml"); + $proc->registerPHPFunctions(); + print $proc->transformToXml($xml); + + function foobar($id, $secondArg = "" ) { + if (is_array($id)) { + return $id[0]->value . " - " . $secondArg; + } else { + return $id . " - " . $secondArg; + } + } + function nodeSet($id = null) { + if ($id and is_array($id)) { + return $id[0]; + } else { + $dom = new domdocument; + $dom->loadXML("this is from an external DomDocument"); + return $dom->documentElement; + } + } + function nonDomNode() { + return new foo(); + } + + class aClass { + static function aStaticFunction($id) { + return $id; + } + } + +--EXPECTF-- +Test 11: php:function Support + +Warning: XSLTProcessor::transformToXml(): A PHP Object can not be converted to a XPath-string in %s on line 16 + +foobar - secondArg +foobar - +this is from an external DomDocument +from the Input Document +static + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.xml b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.xml new file mode 100644 index 0000000000000..f40500b0f5ad0 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.xml @@ -0,0 +1 @@ +This is from the Input Document diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.xsl b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.xsl new file mode 100644 index 0000000000000..e1960e57d3beb --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt011.xsl @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt012.phpt b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt012.phpt new file mode 100644 index 0000000000000..60387af4cefef --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt012.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test 12: Using Associative Array of Parameters +--SKIPIF-- + +--FILE-- +load(dirname(__FILE__)."/xslt.xml"); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} + +$xsl = new domDocument; +$xsl->load(dirname(__FILE__)."/xslt012.xsl"); +if(!$xsl) { + echo "Error while parsing the document\n"; + exit; +} + +$proc = new xsltprocessor; +if(!$proc) { + echo "Error while making xsltprocessor object\n"; + exit; +} + + +$proc->importStylesheet($xsl); + +$parameters = Array( + 'foo' => 'barbar', + 'foo1' => 'test', + ); + +$proc->setParameter( "", $parameters); + +print "\n"; +print $proc->transformToXml($dom); +print "\n"; + + +--EXPECT-- +Test 12: Using Associative Array of Parameters + +barbar +test +a1 b1 c1
    +a2 c2
    +ä3 b3 c3
    + diff --git a/phpt/tests/php-5.2.5/ext/xsl/tests/xslt012.xsl b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt012.xsl new file mode 100644 index 0000000000000..eb0c491daa622 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/xsl/tests/xslt012.xsl @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    +
    diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/001.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/001.phpt new file mode 100644 index 0000000000000..37dccc055e08c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/001.phpt @@ -0,0 +1,12 @@ +--TEST-- +Check for zip presence +--SKIPIF-- + +--POST-- +--GET-- +--FILE-- + +--EXPECT-- +zip extension is available diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/binarynull.zip b/phpt/tests/php-5.2.5/ext/zip/tests/binarynull.zip new file mode 100644 index 0000000000000000000000000000000000000000..9da004efed082ebb572404a893dc32ee6f140ccd GIT binary patch literal 656 zcmWIWW@Zs#U|`^2sA;M*nY?a~`7cHWhV4uY44e$23?-?>C3;x}sp+91oD9r7FST97 zfjG2+h2aJB3+CVTkN-2XG3uN9o3pvOv9Y-+r2P2bfAE~;iK~W3>`!xYYv)&1w&)_?qT z^|=51{WX8T{XKp@UZLL5$iVmzLs&g0)8C^<4jnpki0_lQa +--FILE-- +open('__test.zip', ZIPARCHIVE::CREATE); +var_dump($archive->addEmptyDir('test')); +print_r($archive); +var_dump($archive->addEmptyDir('test')); +$archive->close(); +unlink('__test.zip'); +?> +--EXPECT-- +bool(true) +ZipArchive Object +( + [status] => 0 + [statusSys] => 0 + [numFiles] => 1 + [filename] => + [comment] => +) +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/bug38943.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/bug38943.phpt new file mode 100644 index 0000000000000..486c16950816f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/bug38943.phpt @@ -0,0 +1,50 @@ +--TEST-- +#38943, properties in extended class cannot be set +--SKIPIF-- + +--FILE-- +testarray[] = 1; + var_dump($this->testarray); + } +} + +$z = new myZip; +$z->testp = "foobar"; +var_dump($z); +?> +--EXPECTF-- +array(1) { + [0]=> + int(1) +} +object(myZip)#1 (%d) { + ["test:private"]=> + int(0) + ["testp"]=> + string(6) "foobar" + ["testarray:private"]=> + array(1) { + [0]=> + int(1) + } + ["status"]=> + int(0) + ["statusSys"]=> + int(0) + ["numFiles"]=> + int(0) + ["filename"]=> + string(0) "" + ["comment"]=> + string(0) "" +} diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/bug38944.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/bug38944.phpt new file mode 100644 index 0000000000000..ee12fad2b39ec --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/bug38944.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #38944 (newly created ZipArchive segfaults when accessing comment property) +--SKIPIF-- + +--FILE-- +open($arc_name, ZIPARCHIVE::CREATE);; + +var_dump($foo->status); +var_dump($foo->statusSys); +var_dump($foo->numFiles); +var_dump($foo->filename); +var_dump($foo->comment); + +var_dump($foo); + +echo "Done\n"; +?> +--EXPECTF-- +int(0) +int(0) +int(0) +string(0) "" +string(0) "" +object(ZipArchive)#%d (5) { + ["status"]=> + int(0) + ["statusSys"]=> + int(0) + ["numFiles"]=> + int(0) + ["filename"]=> + string(0) "" + ["comment"]=> + string(0) "" +} +Done diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/bug40228.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/bug40228.phpt new file mode 100644 index 0000000000000..fec29636396d4 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/bug40228.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #40228 (extractTo does not create recursive empty path) +--SKIPIF-- + +--FILE-- +open($arc_name, ZIPARCHIVE::CREATE);; +$zip->extractTo($dest); +if (is_dir($dest . '/test/empty')) { + echo "Ok\n"; + rmdir($dest . '/test/empty'); + rmdir($dest . '/test'); +} else { + echo "Failed.\n"; +} +echo "Done\n"; +?> +--EXPECT-- +Ok +Done diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/bug40228.zip b/phpt/tests/php-5.2.5/ext/zip/tests/bug40228.zip new file mode 100644 index 0000000000000000000000000000000000000000..bbcd9515f88dc8771a787b70aa463f860d2184e5 GIT binary patch literal 274 zcmWIWW@h1H0D+%AmS$iElwf5LWhhB4F3}GS;bdUGnzO_81`vl3Np{`(sxFWQIfg!*fw|;I0Wc?N}{V>;{n8L~iGM@ +--FILE-- + +--EXPECT-- +Ok diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/bug7658.odt b/phpt/tests/php-5.2.5/ext/zip/tests/bug7658.odt new file mode 100644 index 0000000000000000000000000000000000000000..527e09fefcefc76d452a3679f4028ac4459f4fbb GIT binary patch literal 8873 zcma)C2RzjO|G!Ae9+8a52SLXfBhccx5xYLeed_{`Fg$Hfg=$@o(OwEBoqxt3nJZN2z#U*)(wWh2x4Gf7`;D~;qgBcGrpvR zL^!}5v8a7DXkj5V28zL=ZJ{WkZ@8m)lLRMzg75``BL{I%J3E*w46g=>60*ahPz38< zZmz@tJxx-A(*PpE2R{AV9VUG1LA4I9NGJyO!x;kppfi8#ggeq5>y94)?DtOm4afQy zYwjqdBMOH8t^0pN{>@KyR3YDg8ZPirC5%lV z@0A#Jm$O%}h?EE`)%-%d(6UHyhVt378xJ~O-{=6 zy}Bv}_JJ<)w3dy?!-JNeN9HO_E{vWq)$f~?;L3RtRr~yywbSR^x!RIxZVmZ@#6Dno zPF`EhsL@-SILxX$uAR}cPlqRIF~_w)!P&@%+taAlq=WsKjcj{ihJe+u$O~WD^)u$P zI~?~q9rDbE=}@eJj*gCgY(O?04NI#F4*GC98r9oihQK_Ksf|e5YX0s?*FGLAdnHa> z#u1llMk7(SdF0OEqRx1dz}#Eo4J`w0dy*vAAl`dCJX4%Q%FN>p z02;ab4SEY3;To-3Gyn+M4RSt>G z6%R{&R~WB+Y3t^Bt(?stKHntr;6WnSLW#|~jxcpaKCy^Ya6=?iGPuZYC-0u`U|j#S zD$-`mUZuq(0o8yVoB0@YOJ5+&ZYqr>Ch%+fjV|@FS6d4wyR1Z)Tr>MVV9UNTCnY2% z$+ix(cY1uGXR^XFC>yD%r6o_j{yey7ytU9IakL>doIgU2i_494P(SiC50m!GR=2H- zLF!UTfG~2M99!T=w&;-aE>GtXN94FrLd~jZK`T`?)&e8w)T(4;oG;zFctPR)P~Qv% zH6gte?>q$3#V4%NLwdAsMkVhzL~q`F&>%afY({^?dMdN%Cz;)FC4EDsfx8C1zVg& zwl#LW)xp{#E@`_vFU7e!knE|s%lfY>(pGz(SkLkF0LT}tlHGXK`cPj~n4vUxfbB`b zOv)FGJUdh9r_`$;d!zhSdxwokGZk;{$n%NbTpiJQw;e#;Zv&{!j!~v1-;6#NTz_)Q zCy=v_AyD2*;xTyyL%QKKh5SZZ&utVDgO3K&W8QAcsyA0#O`(hd8UD!9f>wLnt@emU z2S49aGHn*?J2&sx$huTq%+A=&YmsRd2FgktN3T+z;~;DQ7+b{8Fc*3uMTR!vTA0FF zI8l&Jiv9VX!(1=)1#k8mk}F4WPBl1jsfI*$jd72?1bcTCB(I6IzQ;yI3d0fr>U6@ z)ZN6@SD!PnV_6~fEM~d<>n@RIV$a@;O+^VQXh!-5Ygn;D>^yYBi<`!fl!*wbz58C? zH`#<@fRZu)h7Dq~DOwMb&fPtq?5oh4rAXdYkfHnf$S|^4|8^-P^kveWw3^bSp#tAE zkpaD0Zpr!wk7likkpl3gIP0vK+eu>@s+47sAr+`&ygKU4=;=*>Nmy>~od>|Xb`5-( zLrC=_vsE*kds-*Pnn#;0I$kn__r6BVEhWScQa%JxNl%QuK|q+7S*kZIOsjS-LEG9I z^_6{W1a;}PUQ$EugE;SkH}s`lTlGI_*vVfXJ=GZYb!iBvM!U+MnkHuA!AyZ>#Ws`= z-L!@$K<~^(+MAxBbGdDJNY>n6{wht+0}tU~)LqHqrVKjw!Er|K3xd_`CbVB0JqDO#kg#U?wnZeQ5 zhi(UBo@ezGbQ_P_&F3aJM{OB9trl;N*$VCw{rgx%hJRP1F_&FoXu`>-)7%<4Bu3*q zmPrF~MHT}y7wMkNgO0Nqr@U=^AWL1WY%$EI&ymfylsU%6uTgwX(m9f0Ug^-sH^9T~)y;>rtO|<0VfSSiDvSwq8T2Sn_BF z7meWO7TPCM<}oblq66`fj9N&o$_NI5nw~T7Moljwn$N}yAnq%{8<#pQq3>iP(}%vs z0?~Yl{DU0~s#ee8e6>;Npyd({X>|iL!`CZ*C)WMr_N-bfz))4Vw_7~ z=(E+)ISzJ>!tBUp6)|6Lp(4G~lrzb1qS~h^X%>COldqi1vdss+lhrWF@e-BRYGr$& z$uDi9|BN9Ei>ooOF|QmughR*H=nsP!3NjtvUOd|?I90@?$-Kg&InJ>_1!Y!qBbRix zSiX99P<>8U`hjp{q2U}3$yQo9{d}i|^-^mYB#uOT@~FZ)GcrM{Bs!t)_PrblhL_en zA+c>~@!edZ*B-^ZmZv^B;>=3&LI7a^=wu@?27FY?kav3MRN;7Dm0dVPG_lyH;VWiJ zJozDuRYpYuWY9w<08DjN<G_$##N@!Hi-u^vjydXnWncdclyJhKu?t#Z z$qQy}$3w_2=GCfIIUJIj47W}e%VWv^tdtRVvF~kum0v^Ey+XD;6=?^r&O9Y=mE45P z!dW-pC=Eq#{a~fZm4cDE1c##2Db^xNOHZcyCOLtV;7OfJg~w7^=J^FaO;(uenyO(+;j}brjoLcH9K{dMlg3}tS8)q&*p{ICNN>(^ zQw(rO#;&)}K!2L8E04vZnUCUR&jl}M84_vPO=AVks<0qV2k*ngRt^-@9IQ-@Hq}w1 zYD|x9GGXboysr?rg}HTgNQpyuFdeRsSvNf#tHldS+Xtu&1_y$>aG` zb~y6v$C?iTRP4yRoQje}Y68F-OnkhtUuH~^eNz8>X0Fdt9thfnYv*0m*j{;SEnLJI zN~6hg+Oby|A>m2edee^sB{gG}d(PQ~nj(8h-%R-9PIojJ8^vX3CpH{;?!KwC0Eh^w zpH);6rs6S8i?A=emiQ^ggQA;^ZZNKy3v}FdL|Mf5>QPCB1?c=i@=yx*9dV#$&96r0VD zl6^SxPjv&ib!EcRUiw)b8a>4Gl4;>Ga5~0H@gu@Zh`BzcOSvgz=4AF1gY9HPN_C|% zE#ryAU9asaAIaUJezc5JeVU>z%M(p!q5m8d`$Da?%B!SSf*noDFRdKyc_Sq)m2^k1 zisA}XnukhiJhxUY0aCtl1pM-?YI9whO6v9k+s@(E=XRxQ9f)Iwk|IHk<&j^L#%z-n zPK*W!;}lQj$=lxwmg&|Dq`8+is}CO=8O{w)Jd7P!1vV#r+(G z^=tHipb1sZ`gOqK@#1lon^7B?{lUvrhwsvW2A|EN5|W>^4NDAGHYlH^;vBy)IN;K_ zAs13PrV+tr60NOd5pH!hMOv{Nbb3_L+g!2L)~MsiGjH<=iWRr|tG%{ca#DS^$=)aK zl6Dj(CW3)ogX62C5Tu|CvEN(iZQA_1>)qvb!|%OE9X?x9j^@Obc;KcZMC+ICIc2KN zk_#&IR+*&<9+jiMm^CeUK_=MzB{Z6(_0}*W-wx2Zq`X{f(9G$@rdD0Q(Ca6+PP`w; z#pe(B9FNbs__}udcOUs@0W%-()-d(dvUG@6BiLYRqt^J#D%bm?k7UO@4VbrOXS{lo zY?j(K!$O&BoKMuGoQZio{ASttOXs<0kJeLiIjM4cFj}q$%cljN@{@io53rJTc(iWQ z(eW;I@zmy`&&K;4UryF`o!m#={x;IDddC}b7RpcyH|tF(bMyA@`RNL$L}fP7ZkoFTjM`Joru!;fA2a5@D-xg7 z40AoHjQASCYsSMRgCP|!)MtD!(cH0E+IZcZYu0Non1=M& z4XFkUitozDLLb#nW~ZIHoT=w>jHE9ytjoOW#)GcfBf)a(G?W1Oo?6zutrXneAp#p< zjBMa%#9vXZxeu}d6Ai&LmWKfVLf&UOU>GRjT`D7w|KRY1q0o4)LzWXP2;$^`A?%R$ zaD<~Qr;(v5P=Zrlj!XvW-~hLSN&TQdfOwt+%7KR>&{E%;WI3@Ygw#G!B87mu!O&6| zJE`9p6RF>&rS=VdtMPJ$BV1%ToiG@8DIp;o4kw5c5k#UKg}{=Ml0y5foZn5^+x?Vt z$D&;KrR?p5@bn0QlR*oC1;Ii;WC z4a|KW3wN~#N=QnAWP}bV{AK`-fMeiLSD+mVM&OC$l%Xg%lEVP*h{O->cg#VVZ^(TF ze(r(xcs585-#alNNE8T?Gz5dCM8HzQlHbvP%E{QDDJz9Srgc9-q&2Ru2j@OO&`>i-nB|IVw)=^27A2#aV# zL@pkH{gn6y#G+v+pgqh1j)2*7?2jQ~mCACeBOH(%U{0a$Gxa~kg#VkE$bS=q{1p57 zR1qjbI2r@D`{p4AYU>IE+99zBj4Y=x=eNpzj_OAx{%PIs3(}UbS`OB_E^11K+;w?ovx zAW*z_r9`k{$7SzX&rtzl+TdFn)_Vip)!Q0eeA7%_;bmy^r9%vwG2v$0qYadv6B#2Hzi**p@9I^FG^fnw{DtFvXxCfMD~1hf7^LyTI? zz2Th?E@wUa7G7K)+1_ibX+o|+M&B@AgUg_GpH)iuN!F)Nn6-APiVIM+Z?)PcBSxo7 zWh^f@#$BQ(nccIvwAFUCPH!{G$ZA(R;z>Z>oBpN5x-Hw0p*r~)4_9|t;dLwb%?Aq~ zNRzOkqcR_`-V-0PMIJv>f(O6nGftS#J(LwhDC z<<2~m_p#ms*5R%#xQNYneMG+LDl70>FWzA<+SR$-zr8+rP4w7KIm_CK`w1tcN3(fG z7z!({EF;F&FG?Bn_J1Bzr?|4W{@Cx%;v`*icotUIck$Z$nbEHwqvm1VX^Yb7dvk+> zg4di|iau?0$5l}0Ko1SA)b~E#E*7o2GE9B{?bFW(T4fW6^G20wUfy*3Z#(c0(?hetF$|sPDA^m5)f(t41YKb#?W# zT?<@fExTa4VBUuQs$$=Yq|&8NjGarf%VU|6PrAN}PS0J7SE;$1Q7&8%Uq89lB zZ1MeqSzh^0by!og0AHtmY4s+ovkGw1=J|Bmw5-ln49hZl>xo4|_hrDf8;W#(5C+PY z9vUCTSLt7#4giJpd(|>3zVO^q*gCTUK2i}sQ^&rT*;2&oQa`QPZoy2y)%V`Hq|)-z zr8INH51kHAAJmReQtEYmoix4pc5Xd`X0y2REbcFg|Oyhf?v(;$zU38MuRkcI$whN1+_q4T;0g25J9oxMrBpdl zsH$Y+E>Ugq+Cq39`6L1LX;+Lc_sEe`-rsS)iL{HrVlnvyx{ngQ;!WfeS9WlJ~c7$ZOm- z`g+=oW)DS^TC1COGHXl%?O$@5&Ggh%_8(J z!?Z_4eT{s^DT{tt5?D1*e z-VSV{O;e+_uuhQVi=0(Qjo*g=eeGu685YZ8?=Ub&8gahHy;-n;GVj(dq1s-z2WwI>K$KFJ%X+Yro{Kn;x8X#pxIRLqSD6vKY zFV0nR$he3<JT>16G+t_Y&{Z zV}$fW(_j@aY{NAjkbb@53&)*_!jFgE@2)WIgfRJ(${h=AGG3#3eY}6htk8>F?dcw0 zWPT2OFjewwCb6u&h!NxDscf?WsTMwM&-tcNHC~IDL`8=8_ri?xSLzI^V`bd+AwkcKoCBEsPDLF$I$Nol zsNH0L?^Ry{N;C?wU8c+;H}J3kq9 zGlH>beUU7ylD3Ql7-#t^N4yb@@pR`tAGf$v8f2jmM0 zoA`*5iJr`3`<`-RJZ-;K0Y3>AUu zI;ui$Pz2lohTe}Nmc&RS8#!pMuWysZjr4ftJeG*~m}QvlCd{p*=HE?4cjT~I^!C=| zh0Dd+IT>UurnAdc(pxF=!=-13uCMjZMauMeNBS{lL{{>*p;i;*BPLP?>f$?EZr%L~ zajA$E^*Tp&%e9uZruMc-q=?wl6h|zOL~n|@<;*ShFP=AUxwd31b905L6*q(`Z}5nm zN#F6Xh#bd2%j0T$s!6O<__Q!as)39UM(e3t`L`8?r2Sm7Iqv!)aK-?`$l3CzdUS}q zNPjz5qM^CarAwbI6=_Q^=pY9avxiZZae=g+F$<0_-prYc)h|Y^-0k3M9XAhd$eo?)6-C@DrGQ71mMdkf`O!FD+7Aw&)x17U?FE0u<+mmh`J!FPpCdh2&h@8W zf(yntdYKyJ##=NZhfEc2mn{~S_;`A-Q_1a5-N`$G(Q&}PBh&c# z`z`&5Qy)bACITQtZ+|6ieDPoe`1gSHH|xK@$bLkX2_flUDF|OYsOKL6>i^{&;Q;t6 z4daUkmHrA(|2Z(fP=Etnq{9#8K`pd<%aY zdHq_+Ki1OkoCJZ#|CJJs{m$wiTrLM0i(k0+H2DA2z~4Iv{KXH{4{N_4&iESj`?2mI^7m(&u<8CvBluPJ*DY92ljI0Nj2i#9g+Ei?J4N{Q Ee~$&2H2?qr literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/bug7658.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/bug7658.phpt new file mode 100644 index 0000000000000..743761097c339 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/bug7658.phpt @@ -0,0 +1,60 @@ +--TEST-- +Bug #7658 (modify archive with general bit flag 3 set) +--SKIPIF-- + +--FILE-- +open($file)) { + echo 'failed'; +} + +dump_entries_name($zip); + +$zip->deleteName('content.xml'); +$zip->addFile($dirname . "bug7658.xml","content.xml"); +$zip->close(); +echo "\n"; +$zip->open($file); +dump_entries_name($zip); +@unlink($file); +?> +--EXPECT-- +0 mimetype +1 Configurations2/statusbar/ +2 Configurations2/accelerator/current.xml +3 Configurations2/floater/ +4 Configurations2/popupmenu/ +5 Configurations2/progressbar/ +6 Configurations2/menubar/ +7 Configurations2/toolbar/ +8 Configurations2/images/Bitmaps/ +9 content.xml +10 styles.xml +11 meta.xml +12 Thumbnails/thumbnail.png +13 settings.xml +14 META-INF/manifest.xml + +0 mimetype +1 Configurations2/statusbar/ +2 Configurations2/accelerator/current.xml +3 Configurations2/floater/ +4 Configurations2/popupmenu/ +5 Configurations2/progressbar/ +6 Configurations2/menubar/ +7 Configurations2/toolbar/ +8 Configurations2/images/Bitmaps/ +9 styles.xml +10 meta.xml +11 Thumbnails/thumbnail.png +12 settings.xml +13 META-INF/manifest.xml +14 content.xml diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/bug7658.xml b/phpt/tests/php-5.2.5/ext/zip/tests/bug7658.xml new file mode 100644 index 0000000000000..98076f1984de8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/bug7658.xml @@ -0,0 +1,2 @@ + +Other text Silvio Berlusconi, le ricordo che ha in prestito i seguenti libriTitoloInventarioCodice Da Vinci112345678Lo Zen e il tiro con l'arco1020304Lo Zen e l'arte della manutenzione della motocicletta1020305101 Storie Zen1020306Antani di Blinda come fosse di Cappotto4112345peraltro, sottolineiamo la perentorietà della restituzione anche dei vieppiù interessanti testi:TitoloAutoreInventarioAngeli e DemoniDan Brown12131415La versione di BarneyMordecai Richler2010322Manuale PHPVarii32413543La prematurata supercazzola negli anni a venireUgo Tognazzi31213243La sbiriguda in vicesindacoUgo Tognazzi1324354654Gentili saluti, la sua biblioteca diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/bug8009.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/bug8009.phpt new file mode 100644 index 0000000000000..1887c50b2bcf6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/bug8009.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #8009 (cannot add again same entry to an archive) +--SKIPIF-- + +--FILE-- +open($filename)) { + exit("cannot open $filename\n"); +} +$zip->addFromString("2.txt", "=)"); +$zip->close(); +unlink($filename); +echo "status: " . $zip->status . "\n"; +echo "\n"; + +--EXPECT-- +status: 0 diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/bug8009.zip b/phpt/tests/php-5.2.5/ext/zip/tests/bug8009.zip new file mode 100644 index 0000000000000000000000000000000000000000..45bedcbe8891cf667083f24d4ae4879d62765b88 GIT binary patch literal 112 zcmWIWW@Zs#U|`^2sNlYBqI;-0lLg3Q0%BGmHq +--FILE-- +open($filename) === FALSE) { + exit("cannot open $filename\n"); +} +$contents_from_idx = $zip->getFromIndex(0); +$contents_from_name = $zip->getFromName('1.txt'); +if ($contents_from_idx != $contents_from_name) { + echo "failed:"; + var_dump($content_from_idx, $content_from_name); +} + +$zip->close(); +echo "status: " . $zip->status . "\n"; +echo "\n"; + +--EXPECT-- +status: 0 diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_addemptydir.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_addemptydir.phpt new file mode 100644 index 0000000000000..0252c6dc89d75 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_addemptydir.phpt @@ -0,0 +1,36 @@ +--TEST-- +ziparchive::addEmptyDir +--SKIPIF-- + +--FILE-- +open($file)) { + exit('failed'); +} + +$zip->addEmptyDir('emptydir'); +if ($zip->status == ZIPARCHIVE::ER_OK) { + dump_entries_name($zip); + $zip->close(); +} else { + echo "failed\n"; +} +@unlink($file); +?> +--EXPECTF-- +0 bar +1 foobar/ +2 foobar/baz +3 entry1.txt +4 emptydir/ diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_addfile.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_addfile.phpt new file mode 100644 index 0000000000000..aee6154167d1a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_addfile.phpt @@ -0,0 +1,37 @@ +--TEST-- +ziparchive::addFile() function +--SKIPIF-- + +--FILE-- +open($file)) { + exit('failed'); +} +if (!$zip->addFile($dirname . 'utils.inc', 'test.php')) { + echo "failed\n"; +} +if ($zip->status == ZIPARCHIVE::ER_OK) { + dump_entries_name($zip); + $zip->close(); +} else { + echo "failed\n"; +} +@unlink($file); +?> +--EXPECTF-- +0 bar +1 foobar/ +2 foobar/baz +3 entry1.txt +4 test.php diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_close.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_close.phpt new file mode 100644 index 0000000000000..42b755610bdc2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_close.phpt @@ -0,0 +1,25 @@ +--TEST-- +zip::close() function +--SKIPIF-- + +--FILE-- +open($dirname . 'test.zip')) { + exit('failed'); +} + +if ($zip->status == ZIPARCHIVE::ER_OK) { + $zip->close(); + echo "ok\n"; +} else { + echo "failed\n"; +} +?> +--EXPECTF-- +ok diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_delete.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_delete.phpt new file mode 100644 index 0000000000000..902fad244e9d2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_delete.phpt @@ -0,0 +1,76 @@ +--TEST-- +Delete entries +--SKIPIF-- + +--FILE-- +open($file, ZIPARCHIVE::CREATE)) { + exit('failed'); +} +$zip->addFromString('entry1.txt', 'entry #1'); +$zip->addFromString('entry2.txt', 'entry #2'); +$zip->addFromString('dir/entry2.txt', 'entry #2'); + +if ($zip->status == ZIPARCHIVE::ER_OK) { + $zip->close(); + echo "ok\n"; +} else { + var_dump($zip); + echo "failed\n"; +} + +if (!$zip->open($file, ZIPARCHIVE::CREATE)) { + exit('failed'); +} + +if ($zip->deleteIndex(0)) { + echo "ok\n"; +} + +if ($zip->deleteName('entry2.txt')) { + echo "ok\n"; +} else { + echo "failed 3\n"; +} + +if ($zip->deleteName('dir/entry2.txt')) { + echo "ok\n"; +} else { + echo "failed 3\n"; +} + +if (!$zip->deleteIndex(123)) { + echo "ok\n"; +} else { + print_r($zip); + echo "failed\n"; +} + + +$sb = $zip->statIndex(0); +var_dump($sb); +$sb = $zip->statIndex(1); +var_dump($sb); +$sb = $zip->statIndex(2); +var_dump($sb); +@unlink($file); +?> +--EXPECTF-- +ok +ok +ok +ok +ok +bool(false) +bool(false) +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_ext_zip.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_ext_zip.phpt new file mode 100644 index 0000000000000..e911ce8f345ee --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_ext_zip.phpt @@ -0,0 +1,27 @@ +--TEST-- +Extending Zip class and array property +--SKIPIF-- + +--FILE-- +testarray[] = 1; + var_dump($this->testarray); + } +} + +$z = new myZip; +?> +--EXPECTF-- +array(1) { + [0]=> + int(1) +} diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_extract.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_extract.phpt new file mode 100644 index 0000000000000..56f2882483054 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_extract.phpt @@ -0,0 +1,95 @@ +--TEST-- +extractTo +--SKIPIF-- + +--FILE-- +open($file) !== TRUE) { + echo "open failed.\n"; + exit('failed'); +} + +$zip->extractTo($dirname . '__oo_extract_tmp'); +if (!is_dir($dirname . '__oo_extract_tmp')) { + echo "failed. mkdir\n"; +} + +if (!is_dir($dirname .'__oo_extract_tmp/foobar')) { + echo "failed. mkdir foobar\n"; +} + +if (!file_exists($dirname . '__oo_extract_tmp/foobar/baz')) { + echo "failed. extract foobar/baz\n"; +} else { + echo file_get_contents($dirname . '__oo_extract_tmp/foobar/baz') . "\n"; +} + +if (!file_exists($dirname . '__oo_extract_tmp/bar')) { + echo "failed. bar file\n"; +} else { + echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; +} + +if (!file_exists($dirname . '__oo_extract_tmp/foo')) { + echo "failed. foo file\n"; +} else { + echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n"; +} + + +/* extract one file */ +$zip->extractTo($dirname . '__oo_extract_tmp', 'bar'); +if (!file_exists($dirname . '__oo_extract_tmp/bar')) { + echo "failed. extract bar file\n"; +} else { + echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; +} + +/* extract two files */ +$zip->extractTo($dirname . '__oo_extract_tmp', array('bar','foo')); +if (!file_exists($dirname . '__oo_extract_tmp/bar')) { + echo "failed. extract bar file\n"; +} else { + echo file_get_contents($dirname . '__oo_extract_tmp/bar') . "\n"; +} +if (!file_exists($dirname . '__oo_extract_tmp/foo')) { + echo "failed. extract foo file\n"; +} else { + echo file_get_contents($dirname . '__oo_extract_tmp/foo') . "\n"; +} + +rmdir_rf($dirname . '__oo_extract_tmp'); +?> +--EXPECTF-- +blabla laber rababer sülz + +bar + +foo + + +bar + +bar + +foo +--UEXPECTF-- +blabla laber rababer sülz + +bar + +foo + + +bar + +bar + +foo diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_getcomment.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_getcomment.phpt new file mode 100644 index 0000000000000..b9bc28933a8b6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_getcomment.phpt @@ -0,0 +1,36 @@ +--TEST-- +getComment +--SKIPIF-- + +--FILE-- +open($file)) { + exit('failed'); +} +echo $zip->getArchiveComment() . "\n"; + +$idx = $zip->locateName('foo'); +echo $zip->getCommentName('foo') . "\n"; +echo $zip->getCommentIndex($idx); + +echo $zip->getCommentName('') . "\n"; +echo $zip->getCommentName() . "\n"; + +$zip->close(); + +?> +--EXPECTF-- +Zip archive comment +foo comment +foo comment +Notice: ZipArchive::getCommentName(): Empty string as entry name in %s on line %d + + +Warning: ZipArchive::getCommentName() expects at least 1 parameter, 0 given in %s on line %d diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_getnameindex.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_getnameindex.phpt new file mode 100644 index 0000000000000..bf2d4c67aeb39 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_getnameindex.phpt @@ -0,0 +1,47 @@ +--TEST-- +getNameIndex +--SKIPIF-- + +--FILE-- +open($file, ZIPARCHIVE::CREATE)) { + exit('failed'); +} + +$zip->addFromString('entry1.txt', 'entry #1'); +$zip->addFromString('entry2.txt', 'entry #2'); +$zip->addFromString('dir/entry2d.txt', 'entry #2'); + +if (!$zip->status == ZIPARCHIVE::ER_OK) { + echo "failed to write zip\n"; +} +$zip->close(); + +if (!$zip->open($file)) { + exit('failed'); +} + + +var_dump($zip->getNameIndex(0)); +var_dump($zip->getNameIndex(1)); +var_dump($zip->getNameIndex(2)); +var_dump($zip->getNameIndex(3)); + +$zip->close(); + +?> +--EXPECTF-- +string(10) "entry1.txt" +string(10) "entry2.txt" +string(15) "dir/entry2d.txt" +bool(false) diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_namelocate.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_namelocate.phpt new file mode 100644 index 0000000000000..72ac6318a12c6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_namelocate.phpt @@ -0,0 +1,46 @@ +--TEST-- +Locate entries by name +--SKIPIF-- + +--FILE-- +open($file, ZIPARCHIVE::CREATE)) { + exit('failed'); +} + +$zip->addFromString('entry1.txt', 'entry #1'); +$zip->addFromString('entry2.txt', 'entry #2'); +$zip->addFromString('dir/entry2d.txt', 'entry #2'); + +if (!$zip->status == ZIPARCHIVE::ER_OK) { + echo "failed to write zip\n"; +} +$zip->close(); + +if (!$zip->open($file)) { + exit('failed'); +} + + +var_dump($zip->locateName('entry1.txt')); +var_dump($zip->locateName('eNtry2.txt')); +var_dump($zip->locateName('eNtry2.txt', ZIPARCHIVE::FL_NOCASE)); +var_dump($zip->locateName('enTRy2d.txt', ZIPARCHIVE::FL_NOCASE|ZIPARCHIVE::FL_NODIR)); +$zip->close(); + +?> +--EXPECTF-- +int(0) +bool(false) +int(1) +int(2) diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_open.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_open.phpt new file mode 100644 index 0000000000000..9934016faf478 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_open.phpt @@ -0,0 +1,46 @@ +--TEST-- +zip::open() function +--SKIPIF-- + +--FILE-- +open($dirname . 'nofile'); +if ($r !== TRUE) { + echo "ER_OPEN: ok\n"; +} else { + echo "ER_OPEN: FAILED\n"; +} + +$r = $zip->open($dirname . 'nofile', ZIPARCHIVE::CREATE); +if (!$r) { + echo "create: failed\n"; +} else { + echo "create: ok\n"; +} +@unlink($dirname . 'nofile'); + +$zip = new ZipArchive; +$zip->open(''); + +if (!$zip->open($dirname . 'test.zip')) { + exit("failed 1\n"); +} + +if ($zip->status == ZIPARCHIVE::ER_OK) { + echo "OK\n"; +} else { + echo "failed\n"; +} +?> +--EXPECTF-- +ER_OPEN: ok +create: ok + +Warning: ZipArchive::open(): Empty string as source in %s on line %d +OK diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_properties.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_properties.phpt new file mode 100644 index 0000000000000..dc4498a87fdc6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_properties.phpt @@ -0,0 +1,60 @@ +--TEST-- +ziparchive::properties isset()/empty() checks +--SKIPIF-- + +--FILE-- +open($file)) { + exit('failed'); +} + +printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status)); +printf("zip->numFiles (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->numFiles, empty($zip->numFiles), isset($zip->numFiles)); +printf("zip->bogus (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->bogus, empty($zip->bogus), isset($zip->bogus)); + + +$zip->addEmptyDir('emptydir'); + +printf("zip->status (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->status, empty($zip->status), isset($zip->status)); +printf("zip->numFiles (%d):\n\tempty(): %d\n\tisset(): %d\n", $zip->numFiles, empty($zip->numFiles), isset($zip->numFiles)); +printf("zip->filename (%d):\n\tempty(): %d\n\tisset(): %d\n", strlen($zip->filename), empty($zip->filename), isset($zip->filename)); +printf("zip->comment (%d):\n\tempty(): %d\n\tisset(): %d\n", strlen($zip->comment), empty($zip->comment), isset($zip->comment)); + +unset($zip); //close the file before unlinking +@unlink($file); +?> +--EXPECTF-- +zip->status (0): + empty(): 1 + isset(): 1 +zip->numFiles (4): + empty(): 0 + isset(): 1 + +Notice: Undefined property: ZipArchive::$bogus in %s on line %d +zip->bogus (0): + empty(): 1 + isset(): 0 +zip->status (0): + empty(): 1 + isset(): 1 +zip->numFiles (5): + empty(): 0 + isset(): 1 +zip->filename (0): + empty(): 1 + isset(): 1 +zip->comment (19): + empty(): 0 + isset(): 1 + diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_rename.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_rename.phpt new file mode 100644 index 0000000000000..ac44146fc000f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_rename.phpt @@ -0,0 +1,58 @@ +--TEST-- +Rename entries +--SKIPIF-- + +--FILE-- +open($file, ZIPARCHIVE::CREATE)) { + exit('failed'); +} + +$zip->addFromString('entry1.txt', 'entry #1'); +$zip->addFromString('entry2.txt', 'entry #2'); +$zip->addFromString('dir/entry2.txt', 'entry #2'); + +if (!$zip->status == ZIPARCHIVE::ER_OK) { + var_dump($zip); + echo "failed\n"; +} + +$zip->close(); + +if (!$zip->open($file)) { + exit('failed'); +} + +dump_entries_name($zip); +echo "\n"; + +if (!$zip->renameIndex(0, 'ren_entry1.txt')) { + echo "failed index 0\n"; +} + +if (!$zip->renameName('dir/entry2.txt', 'dir3/ren_entry2.txt')) { + echo "failed name dir/entry2.txt\n"; +} +dump_entries_name($zip); +$zip->close(); + +@unlink($file); +?> +--EXPECTF-- +0 entry1.txt +1 entry2.txt +2 dir/entry2.txt + +0 ren_entry1.txt +1 entry2.txt +2 dir3/ren_entry2.txt diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_setcomment.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_setcomment.phpt new file mode 100644 index 0000000000000..f0dcf35c35932 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_setcomment.phpt @@ -0,0 +1,71 @@ +--TEST-- +setComment +--SKIPIF-- + +--FILE-- +open($file, ZIPARCHIVE::CREATE)) { + exit('failed'); +} + +$zip->addFromString('entry1.txt', 'entry #1'); +$zip->addFromString('entry2.txt', 'entry #2'); +$zip->addFromString('dir/entry2d.txt', 'entry #2'); +$zip->addFromString('entry4.txt', 'entry #1'); +$zip->addFromString('entry5.txt', 'entry #2'); + + +var_dump($zip->setCommentName('entry1.txt', 'entry1.txt')); +var_dump($zip->setCommentName('entry2.txt', 'entry2.txt')); +var_dump($zip->setCommentName('dir/entry2d.txt', 'dir/entry2d.txt')); +var_dump($zip->setArchiveComment('archive')); + +var_dump($zip->setCommentIndex(3, 'entry4.txt')); +var_dump($zip->setCommentIndex(4, 'entry5.txt')); +var_dump($zip->setArchiveComment('archive')); + +if (!$zip->status == ZIPARCHIVE::ER_OK) { + echo "failed to write zip\n"; +} +$zip->close(); + +if (!$zip->open($file)) { + @unlink($file); + exit('failed'); +} + +var_dump($zip->getCommentIndex(0)); +var_dump($zip->getCommentIndex(1)); +var_dump($zip->getCommentIndex(2)); +var_dump($zip->getCommentIndex(3)); +var_dump($zip->getCommentIndex(4)); +var_dump($zip->getArchiveComment()); + +$zip->close(); +@unlink($file); + +?> +--EXPECTF-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +string(10) "entry1.txt" +string(10) "entry2.txt" +string(15) "dir/entry2d.txt" +string(10) "entry4.txt" +string(10) "entry5.txt" +string(7) "archive" diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/oo_stream.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/oo_stream.phpt new file mode 100644 index 0000000000000..c7f5b0d826675 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/oo_stream.phpt @@ -0,0 +1,50 @@ +--TEST-- +getStream +--SKIPIF-- + +--FILE-- +open($file)) { + exit('failed'); +} +$fp = $zip->getStream('foo'); + +var_dump($fp); +if(!$fp) exit("\n"); +$contents = ''; +while (!feof($fp)) { + $contents .= fread($fp, 255); +} + +fclose($fp); +$zip->close(); +var_dump($contents); + + +$fp = fopen('zip://' . dirname(__FILE__) . '/test_with_comment.zip#foo', 'rb'); +if (!$fp) { + exit("cannot open\n"); +} +$contents = ''; +while (!feof($fp)) { + $contents .= fread($fp, 2); +} +var_dump($contents); +fclose($fp); + +?> +--EXPECTF-- +resource(%d) of type (stream) +string(5) "foo + +" +string(5) "foo + +" diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/test.zip b/phpt/tests/php-5.2.5/ext/zip/tests/test.zip new file mode 100644 index 0000000000000000000000000000000000000000..35bd5eecdf696886bd91e941c98df25c931c93b4 GIT binary patch literal 526 zcmWIWW@h1H0D+1|7UP$j7qPGa*&xi!Aj*)GSQHw<$-u0l^vTH&h(jw_7``y3fW)~1 z;5z$&IzcAD06S1;T7EuIkv>?r4^U?ll5UVr5ujoY29VAOyQ8uaK%O)Zb0KslC04;T zBU|l#%G2kRX9&Zjm9AW_ot_E1eteiWM@x?ZVd%nz&rEKo@O%Mzivw&Z14C+FNl~St zUP(oX_gQVtRUrXpEI=KMOybPAJkJZ%$-uw}#9JCcEO1b;LV_Z+f&oQ0W&l8RGcX7+ z{B^Vf>V^jg&;(F$AWXm&5XknIAWQ%U3z{Je3=l)Gc^u?)2sjC(5Wx`O&B_K6X92>$ KK>9a`!vFyFl4z~~ literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/test_procedural.zip b/phpt/tests/php-5.2.5/ext/zip/tests/test_procedural.zip new file mode 100644 index 0000000000000000000000000000000000000000..6b986948031d904753e54b3739462aa99b8932c9 GIT binary patch literal 541 zcmWIWW@h1H0D-bb7GoXxC9hb4Y!GH<5M@Zq&kqgZWMGz8`sCyX#Gw@|3||;iK;m3n z0dTDqK&>w~FJfTvcTA5VPFROl?CKq1^`TmW~2ZB literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/test_with_comment.zip b/phpt/tests/php-5.2.5/ext/zip/tests/test_with_comment.zip new file mode 100644 index 0000000000000000000000000000000000000000..d68f76157a359cffc580304c93a526d2ca677434 GIT binary patch literal 571 zcmWIWW@h1H0D-bb7GoXxC9hb4Y!GH<5M@Zq&kqgZWMGz8`sCyX#Gw@|3||;iK;m3n z0dTDqK&>w~FJfTF15hj2`3&jvtHlQpp cB3T&tfZk>SVqu1;%mRhPqU4OsvQ(IF0brMMYybcN literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/utils.inc b/phpt/tests/php-5.2.5/ext/zip/tests/utils.inc new file mode 100644 index 0000000000000..a03db17ae2d7b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/utils.inc @@ -0,0 +1,24 @@ +numFiles; $i++) { + $sb = $z->statIndex($i); + echo $i . ' ' . $sb['name'] . "\n"; + } +} +/* recursively remove a directoryy */ +function rmdir_rf($dir) { + if ($handle = opendir($dir)) { + while (false !== ($item = readdir($handle))) { + if ($item != "." && $item != "..") { + if (is_dir($dir . '/' . $item)) { + rmdir_rf($dir . '/' . $item); + } else { + unlink($dir . '/' . $item); + } + } + } + closedir($handle); + rmdir($dir); + } +} diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/zip_close.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/zip_close.phpt new file mode 100644 index 0000000000000..d7259b3dafcf6 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/zip_close.phpt @@ -0,0 +1,17 @@ +--TEST-- +zip_close() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +OK diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_compressedsize.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_compressedsize.phpt new file mode 100644 index 0000000000000..5e0fd9c45de91 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_compressedsize.phpt @@ -0,0 +1,23 @@ +--TEST-- +zip_entry_compressedsize() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +5 +4 +0 +24 diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_compressionmethod.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_compressionmethod.phpt new file mode 100644 index 0000000000000..d505a633b67b2 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_compressionmethod.phpt @@ -0,0 +1,24 @@ +--TEST-- +zip_entry_compressionmethod() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +stored +stored +stored +deflated + diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_filesize.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_filesize.phpt new file mode 100644 index 0000000000000..d875062713537 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_filesize.phpt @@ -0,0 +1,23 @@ +--TEST-- +zip_entry_filesize() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +5 +4 +0 +27 diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_name.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_name.phpt new file mode 100644 index 0000000000000..b47c89fdb3284 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_name.phpt @@ -0,0 +1,23 @@ +--TEST-- +zip_entry_name() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +foo +bar +foobar/ +foobar/baz diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_open.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_open.phpt new file mode 100644 index 0000000000000..280cb15573f9f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_open.phpt @@ -0,0 +1,18 @@ +--TEST-- +zip_entry_open() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +OK diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_read.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_read.phpt new file mode 100644 index 0000000000000..1dc1eeb45318f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/zip_entry_read.phpt @@ -0,0 +1,19 @@ +--TEST-- +zip_entry_read() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +foo diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/zip_open.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/zip_open.phpt new file mode 100644 index 0000000000000..6306543bcced7 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/zip_open.phpt @@ -0,0 +1,16 @@ +--TEST-- +zip_open() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +OK diff --git a/phpt/tests/php-5.2.5/ext/zip/tests/zip_read.phpt b/phpt/tests/php-5.2.5/ext/zip/tests/zip_read.phpt new file mode 100644 index 0000000000000..126fc8bda9f17 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zip/tests/zip_read.phpt @@ -0,0 +1,21 @@ +--TEST-- +zip_read() function +--SKIPIF-- + +--FILE-- + +--EXPECT-- +4 entries diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/001.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/001.phpt new file mode 100644 index 0000000000000..c1e679f97d61f --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/001.phpt @@ -0,0 +1,32 @@ +--TEST-- +gzdeflate()/gzinflate() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +100 36864 +Strings are equal +100 36864 +Strings are equal +5 15 +Strings are equal \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/002.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/002.phpt new file mode 100644 index 0000000000000..90a599598831c --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/002.phpt @@ -0,0 +1,24 @@ +--TEST-- +gzcompress()/gzuncompress() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +106 36864 +Strings are equal +106 36864 +Strings are equal diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/003.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/003.phpt new file mode 100644 index 0000000000000..2732d4cea651d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/003.phpt @@ -0,0 +1,14 @@ +--TEST-- +gzencode()/base64_encode() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +118 36864 +Strings are equal diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/004.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/004.phpt new file mode 100644 index 0000000000000..a758b8c7b3f3b --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/004.phpt @@ -0,0 +1,89 @@ +--TEST-- +gzfile() with various invalid params +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: gzfile() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: gzfile(nonexistent_file_gzfile): failed to open stream: No such file or directory in %s on line %d +bool(false) + +Warning: gzfile() expects at most 2 parameters, 3 given in %s on line %d +NULL +array(6) { + [0]=> + string(36) "When you're taught through feelings +" + [1]=> + string(26) "Destiny flying high above +" + [2]=> + string(38) "all I know is that you can realize it +" + [3]=> + string(18) "Destiny who cares +" + [4]=> + string(19) "as it turns around +" + [5]=> + string(39) "and I know that it descends down on me +" +} +array(6) { + [0]=> + string(36) "When you're taught through feelings +" + [1]=> + string(26) "Destiny flying high above +" + [2]=> + string(38) "all I know is that you can realize it +" + [3]=> + string(18) "Destiny who cares +" + [4]=> + string(19) "as it turns around +" + [5]=> + string(39) "and I know that it descends down on me +" +} +array(6) { + [0]=> + string(37) "When you\'re taught through feelings +" + [1]=> + string(26) "Destiny flying high above +" + [2]=> + string(38) "all I know is that you can realize it +" + [3]=> + string(18) "Destiny who cares +" + [4]=> + string(19) "as it turns around +" + [5]=> + string(39) "and I know that it descends down on me +" +} +Done diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/004.txt.gz b/phpt/tests/php-5.2.5/ext/zlib/tests/004.txt.gz new file mode 100644 index 0000000000000000000000000000000000000000..07805db7558078115fc0dc63a4426a87508d382a GIT binary patch literal 150 zcmV;H0BQdpiwFo?U!X()128Z&E_8Tw06mQ{4gxU@1pB;VJ3d0g3#iS-cZmqL6gx!W z^%x}RygS!d1Kh@V0JhN>q*^qS#RPf;R27L%W^soQ` E06hOe-2eap literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/005.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/005.phpt new file mode 100644 index 0000000000000..84fc3b5f10f65 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/005.phpt @@ -0,0 +1,72 @@ +--TEST-- +gzcompress()/gzuncompress() and invalid params +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: gzcompress(): compression level (1000) must be within -1..9 in %s on line %d +bool(false) +string(%d) "%a" +string(%d) "%a" +string(%d) "%a" +string(%d) "%a" +string(%d) "%a" + +Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: gzuncompress(): %s error in %s on line %d +bool(false) + +Warning: gzuncompress(): length (-1) must be greater or equal zero in %s on line %d +bool(false) + +Warning: gzuncompress(): %s error in %s on line %d +bool(false) + +Warning: gzuncompress(): %s error in %s on line %d +bool(false) +string(94) "Answer me, it can't be so hard +Cry to relieve what's in your heart +Desolation, grief and agony" +string(94) "Answer me, it can't be so hard +Cry to relieve what's in your heart +Desolation, grief and agony" + +Warning: gzuncompress(): %s error in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/006.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/006.phpt new file mode 100644 index 0000000000000..6a4e0f4e6799d --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/006.phpt @@ -0,0 +1,73 @@ +--TEST-- +gzdeflate()/gzinflate() and invalid params +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: gzdeflate() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: gzdeflate(): compression level (1000) must be within -1..9 in %s on line %d +bool(false) +string(%d) "%a" +string(%d) "%a" +string(%d) "%a" +string(%d) "%a" +string(%d) "%a" + +Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d +NULL +bool(false) + +Warning: gzinflate(): data error in %s on line %d +bool(false) + +Warning: gzinflate(): length (-1) must be greater or equal zero in %s on line %d +bool(false) + +Warning: gzinflate(): data error in %s on line %d +bool(false) + +Warning: gzinflate(): data error in %s on line %d +bool(false) +string(94) "Answer me, it can't be so hard +Cry to relieve what's in your heart +Desolation, grief and agony" +string(94) "Answer me, it can't be so hard +Cry to relieve what's in your heart +Desolation, grief and agony" + +Warning: gzinflate(): data error in %s on line %d +bool(false) +Done diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/007.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/007.phpt new file mode 100644 index 0000000000000..ec37b99de696a --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/007.phpt @@ -0,0 +1,51 @@ +--TEST-- +gzencode() and invalid params +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: gzencode() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d +NULL + +Warning: gzencode(): compression level(-10) must be within -1..9 in %s on line %d +bool(false) + +Warning: gzencode(): compression level(100) must be within -1..9 in %s on line %d +bool(false) + +Warning: gzencode(): encoding mode must be FORCE_GZIP or FORCE_DEFLATE in %s on line %d +bool(false) +string(%d) "%s" +string(%d) "%s" + +Warning: gzencode(): encoding mode must be FORCE_GZIP or FORCE_DEFLATE in %s on line %d +bool(false) +string(%d) "%s" +string(%d) "%s" +Done diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/bug_34821.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/bug_34821.phpt new file mode 100644 index 0000000000000..b378ec4097c90 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/bug_34821.phpt @@ -0,0 +1,41 @@ +--TEST-- +Bug #34821 (zlib encoders fail on widely varying binary data) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/compress_zlib_wrapper.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/compress_zlib_wrapper.phpt new file mode 100644 index 0000000000000..4bf6c08317fee --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/compress_zlib_wrapper.phpt @@ -0,0 +1,22 @@ +--TEST-- +compress.zlib:// wrapper +--SKIPIF-- + +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/gzfilegzreadfile.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/gzfilegzreadfile.phpt new file mode 100644 index 0000000000000..36539b797e020 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/gzfilegzreadfile.phpt @@ -0,0 +1,82 @@ +--TEST-- +gzfile(), gzreadfile() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(560) +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah + +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah +blah blah blah blah blah blah blah diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/gzreadgzwrite.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/gzreadgzwrite.phpt new file mode 100644 index 0000000000000..6d6729a72f682 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/gzreadgzwrite.phpt @@ -0,0 +1,31 @@ +--TEST-- +gzopen(), gzread(), gzwrite() +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(36864) +int(36864) +Strings are equal diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/gzreadgzwriteplain.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/gzreadgzwriteplain.phpt new file mode 100644 index 0000000000000..7bb567d889ee3 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/gzreadgzwriteplain.phpt @@ -0,0 +1,45 @@ +--TEST-- +gzopen(), gzread(), gzwrite() for non-compressed data +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(36864) +int(36864) +Strings are equal +int(18432) +Strings are equal diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/zlib_filter_deflate.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/zlib_filter_deflate.phpt new file mode 100644 index 0000000000000..0f1851ec6aea8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/zlib_filter_deflate.phpt @@ -0,0 +1,17 @@ +--TEST-- +zlib.deflate (with convert.base64-encode) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +HctBDoAgDETRq8zOjfEeHKOGATG0TRpC4u1Vdn/xX4IoxkVMxgP1zA4vkJVhULk9UGkM6TvSNolmxUNlNLePVQ45O3eINf0fsQxtCxwv diff --git a/phpt/tests/php-5.2.5/ext/zlib/tests/zlib_filter_inflate.phpt b/phpt/tests/php-5.2.5/ext/zlib/tests/zlib_filter_inflate.phpt new file mode 100644 index 0000000000000..0220c85e5edd8 --- /dev/null +++ b/phpt/tests/php-5.2.5/ext/zlib/tests/zlib_filter_inflate.phpt @@ -0,0 +1,17 @@ +--TEST-- +zlib.inflate (with convert.base64-decode) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +I am the very model of a modern major general, I've information vegetable, animal, and mineral. diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/001.phpt b/phpt/tests/php-5.2.5/sapi/cgi/tests/001.phpt new file mode 100644 index 0000000000000..74c694f7c08d9 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/001.phpt @@ -0,0 +1,22 @@ +--TEST-- +version string +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(%d) "PHP %s (cgi%s (built: %s +Copyright (c) 1997-20%s The PHP Group +Zend Engine v%s, Copyright (c) 1998-20%s Zend Technologies +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/002.phpt b/phpt/tests/php-5.2.5/sapi/cgi/tests/002.phpt new file mode 100644 index 0000000000000..66e2424f2858f --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/002.phpt @@ -0,0 +1,52 @@ +--TEST-- +defining INI options with -d +--SKIPIF-- + +--FILE-- +'); + +var_dump(`$php -n -d max_execution_time=111 $file`); +var_dump(`$php -n -d max_execution_time=500 $file`); +var_dump(`$php -n -d max_execution_time=500 -d max_execution_time=555 $file`); + +file_put_contents($file, ''); + +var_dump(`$php -n -d upload_tmp_dir=/test/path -d max_execution_time=555 $file`); + +unlink($file); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html + +string(3) "111" +" +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html + +string(3) "500" +" +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html + +string(3) "555" +" +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html + +string(3) "555" +string(10) "/test/path" +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/003.phpt b/phpt/tests/php-5.2.5/sapi/cgi/tests/003.phpt new file mode 100644 index 0000000000000..ea418d104ca50 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/003.phpt @@ -0,0 +1,62 @@ +--TEST-- +strip comments and whitespace with -w +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`$php -n -w "$filename"`); +var_dump(`$php -n -w "wrong"`); +var_dump(`echo "" | $php -n -w`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html + + + +" +string(%d) "Status: 404 Not Found +X-Powered-By: PHP/%s +Content-type: text/html + +No input file specified. +" +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html + + +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/004.phpt b/phpt/tests/php-5.2.5/sapi/cgi/tests/004.phpt new file mode 100644 index 0000000000000..c841b68e04f63 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/004.phpt @@ -0,0 +1,43 @@ +--TEST-- +execute a file with -f +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`$php -n -f "$filename" 2>/dev/null`); +var_dump(`$php -n -f "wrong"`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) " +
    +Fatal error: Cannot access private property test::$pri in %s004.test.php on line 8
    +" +string(25) "No input file specified. +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/005.phpt b/phpt/tests/php-5.2.5/sapi/cgi/tests/005.phpt new file mode 100644 index 0000000000000..6d82b0f311cc1 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/005.phpt @@ -0,0 +1,30 @@ +--TEST-- +using invalid combinations of cmdline options +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(55) "You cannot use both -n and -c switch. Use -h for help. +" +string(51) "No input file specified. +Interactive mode enabled + +" +string(51) "No input file specified. +Interactive mode enabled + +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/006.phpt b/phpt/tests/php-5.2.5/sapi/cgi/tests/006.phpt new file mode 100644 index 0000000000000..107ddc7747f44 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/006.phpt @@ -0,0 +1,60 @@ +--TEST-- +syntax check +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -l "$filename"`); +var_dump(`"$php" -n -l some.unknown`); + +$code = ' + +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -l "$filename" 2>/dev/null`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "No syntax errors detected in %s006.test.php +" +string(%d) "No input file specified. +" +string(%d) "
    +Parse error: %s expecting %s{%s in %s006.test.php on line 5
    +Errors parsing %s006.test.php +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/007.phpt b/phpt/tests/php-5.2.5/sapi/cgi/tests/007.phpt new file mode 100644 index 0000000000000..c0f8df1bffee7 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/007.phpt @@ -0,0 +1,22 @@ +--TEST-- +invalid arguments and error messages +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(25) "No input file specified. +" +string(31) "No syntax errors detected in - +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/008.phpt b/phpt/tests/php-5.2.5/sapi/cgi/tests/008.phpt new file mode 100644 index 0000000000000..40140e87925e4 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/008.phpt @@ -0,0 +1,54 @@ +--TEST-- +syntax highlighting +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -s "$filename"`); +var_dump(`"$php" -n -s "unknown"`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "X-Powered-By: PHP/%s +Content-type: text/html + + +
    <?php
    $test 
    "var"//var
    /* test class */
    class test {
        private 
    $var = array();

        public static function 
    foo(Test $arg) {
            echo 
    "hello";
            
    var_dump($this);
        }
    }

    $o = new test;
    ?>
    +
    +
    " +string(%d) "Status: 404 Not Found +X-Powered-By: PHP/%s +Content-type: text/html + +No input file specified. +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/009.phpt b/phpt/tests/php-5.2.5/sapi/cgi/tests/009.phpt new file mode 100644 index 0000000000000..1c429ac1985cc --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/009.phpt @@ -0,0 +1,30 @@ +--TEST-- +path info request without exported PATH_INFO +--SKIPIF-- + +--FILE-- +'); + +echo (`$php -n $f`); + +echo "Done\n"; + +@unlink($f); +?> +--EXPECTF-- +X-Powered-By: PHP/%s +Content-type: text/html + +string(%d) "%s/x" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/include.inc b/phpt/tests/php-5.2.5/sapi/cgi/tests/include.inc new file mode 100644 index 0000000000000..11bf8f3b81a20 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/include.inc @@ -0,0 +1,57 @@ + diff --git a/phpt/tests/php-5.2.5/sapi/cgi/tests/skipif.inc b/phpt/tests/php-5.2.5/sapi/cgi/tests/skipif.inc new file mode 100644 index 0000000000000..9da8b7934d827 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cgi/tests/skipif.inc @@ -0,0 +1,17 @@ + diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/001.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/001.phpt new file mode 100644 index 0000000000000..6fbd608a6fbf4 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/001.phpt @@ -0,0 +1,19 @@ +--TEST-- +version string +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(%d) "PHP %s (cli) (built: %s)%s +Copyright (c) 1997-20%d The PHP Group +Zend Engine v%s, Copyright (c) 1998-20%d Zend Technologies +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/002-win32.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/002-win32.phpt new file mode 100644 index 0000000000000..ca0e66ddcd22c --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/002-win32.phpt @@ -0,0 +1,22 @@ +--TEST-- +running code with -r +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(18) "string(5) "hello" +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/002.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/002.phpt new file mode 100644 index 0000000000000..be2b6331b31ce --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/002.phpt @@ -0,0 +1,22 @@ +--TEST-- +running code with -r +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(18) "string(5) "hello" +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/003-2.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/003-2.phpt new file mode 100755 index 0000000000000..2ed9b07db4c4b --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/003-2.phpt @@ -0,0 +1,25 @@ +--TEST-- +defining INI options with -d (as 2nd arg) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +string(16) "string(3) "111" +" +string(16) "string(3) "500" +" +===DONE=== diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/003.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/003.phpt new file mode 100644 index 0000000000000..d62360e1f6fa3 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/003.phpt @@ -0,0 +1,32 @@ +--TEST-- +defining INI options with -d +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(16) "string(3) "111" +" +string(16) "string(3) "500" +" +string(16) "string(3) "555" +" +string(40) "string(3) "555" +string(10) "/test/path" +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/004.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/004.phpt new file mode 100644 index 0000000000000..a1a01355d2e8a --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/004.phpt @@ -0,0 +1,34 @@ +--TEST-- +show information about function +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(45) "Exception: Function unknown() does not exist +" +string(42) "Exception: Function echo() does not exist +" +string(119) "Function [ function phpinfo ] { + + - Parameters [1] { + Parameter #0 [ $what ] + } +} + +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/005.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/005.phpt new file mode 100644 index 0000000000000..0b38bba765048 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/005.phpt @@ -0,0 +1,99 @@ +--TEST-- +show information about class +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(40) "Exception: Class unknown does not exist +" +string(178) "Class [ class stdClass ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [0] { + } +} + +" +string(1141) "Class [ class Exception ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [6] { + Property [ protected $message ] + Property [ private $string ] + Property [ protected $code ] + Property [ protected $file ] + Property [ protected $line ] + Property [ private $trace ] + } + + - Methods [9] { + Method [ final private method __clone ] { + } + + Method [ public method __construct ] { + + - Parameters [2] { + Parameter #0 [ $message ] + Parameter #1 [ $code ] + } + } + + Method [ final public method getMessage ] { + } + + Method [ final public method getCode ] { + } + + Method [ final public method getFile ] { + } + + Method [ final public method getLine ] { + } + + Method [ final public method getTrace ] { + } + + Method [ final public method getTraceAsString ] { + } + + Method [ public method __toString ] { + } + } +} + +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/006.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/006.phpt new file mode 100644 index 0000000000000..c553a83696573 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/006.phpt @@ -0,0 +1,330 @@ +--TEST-- +show information about extension +--SKIPIF-- + +--INI-- +date.timezone= +--FILE-- + +--EXPECTF-- +string(44) "Exception: Extension unknown does not exist +" +string(37) "Exception: Extension does not exist +" +string(%d) "Extension [ extension #%d date version %s ] { + + - Dependencies { + Dependency [ session (Optional) ] + } + + - INI { + Entry [ date.timezone ] + Current = '' + } + Entry [ date.default_latitude ] + Current = '%s' + } + Entry [ date.default_longitude ] + Current = '%s' + } + Entry [ date.sunset_zenith ] + Current = '%s' + } + Entry [ date.sunrise_zenith ] + Current = '%s' + } + } + + - Constants [14] { + Constant [ string DATE_ATOM ] { Y-m-d\TH:i:sP } + Constant [ string DATE_COOKIE ] { l, d-M-y H:i:s T } + Constant [ string DATE_ISO8601 ] { Y-m-d\TH:i:sO } + Constant [ string DATE_RFC822 ] { D, d M y H:i:s O } + Constant [ string DATE_RFC850 ] { l, d-M-y H:i:s T } + Constant [ string DATE_RFC1036 ] { D, d M y H:i:s O } + Constant [ string DATE_RFC1123 ] { D, d M Y H:i:s O } + Constant [ string DATE_RFC2822 ] { D, d M Y H:i:s O } + Constant [ string DATE_RFC3339 ] { Y-m-d\TH:i:sP } + Constant [ string DATE_RSS ] { D, d M Y H:i:s O } + Constant [ string DATE_W3C ] { Y-m-d\TH:i:sP } + Constant [ integer SUNFUNCS_RET_TIMESTAMP ] { 0 } + Constant [ integer SUNFUNCS_RET_STRING ] { 1 } + Constant [ integer SUNFUNCS_RET_DOUBLE ] { 2 } + } + + - Functions { + Function [ function strtotime ] { + + - Parameters [2] { + Parameter #0 [ $time ] + Parameter #1 [ $now ] + } + } + Function [ function date ] { + + - Parameters [2] { + Parameter #0 [ $format ] + Parameter #1 [ $timestamp ] + } + } + Function [ function idate ] { + + - Parameters [2] { + Parameter #0 [ $format ] + Parameter #1 [ $timestamp ] + } + } + Function [ function gmdate ] { + + - Parameters [2] { + Parameter #0 [ $format ] + Parameter #1 [ $timestamp ] + } + } + Function [ function mktime ] { + + - Parameters [6] { + Parameter #0 [ $hour ] + Parameter #1 [ $min ] + Parameter #2 [ $sec ] + Parameter #3 [ $mon ] + Parameter #4 [ $day ] + Parameter #5 [ $year ] + } + } + Function [ function gmmktime ] { + + - Parameters [6] { + Parameter #0 [ $hour ] + Parameter #1 [ $min ] + Parameter #2 [ $sec ] + Parameter #3 [ $mon ] + Parameter #4 [ $day ] + Parameter #5 [ $year ] + } + } + Function [ function checkdate ] { + + - Parameters [3] { + Parameter #0 [ $month ] + Parameter #1 [ $day ] + Parameter #2 [ $year ] + } + } + Function [ function strftime ] { + + - Parameters [2] { + Parameter #0 [ $format ] + Parameter #1 [ $timestamp ] + } + } + Function [ function gmstrftime ] { + + - Parameters [2] { + Parameter #0 [ $format ] + Parameter #1 [ $timestamp ] + } + } + Function [ function time ] { + + - Parameters [0] { + } + } + Function [ function localtime ] { + + - Parameters [2] { + Parameter #0 [ $timestamp ] + Parameter #1 [ $associative_array ] + } + } + Function [ function getdate ] { + + - Parameters [1] { + Parameter #0 [ $timestamp ] + } + } + Function [ function date_create ] { + } + Function [ function date_parse ] { + } + Function [ function date_format ] { + } + Function [ function date_modify ] { + } + Function [ function date_timezone_get ] { + } + Function [ function date_timezone_set ] { + } + Function [ function date_offset_get ] { + } + Function [ function date_time_set ] { + } + Function [ function date_date_set ] { + } + Function [ function date_isodate_set ] { + } + Function [ function timezone_open ] { + } + Function [ function timezone_name_get ] { + } + Function [ function timezone_name_from_abbr ] { + } + Function [ function timezone_offset_get ] { + } + Function [ function timezone_transitions_get ] { + } + Function [ function timezone_identifiers_list ] { + } + Function [ function timezone_abbreviations_list ] { + } + Function [ function date_default_timezone_set ] { + + - Parameters [1] { + Parameter #0 [ $timezone_identifier ] + } + } + Function [ function date_default_timezone_get ] { + + - Parameters [0] { + } + } + Function [ function date_sunrise ] { + + - Parameters [6] { + Parameter #0 [ $time ] + Parameter #1 [ $format ] + Parameter #2 [ $latitude ] + Parameter #3 [ $longitude ] + Parameter #4 [ $zenith ] + Parameter #5 [ $gmt_offset ] + } + } + Function [ function date_sunset ] { + + - Parameters [6] { + Parameter #0 [ $time ] + Parameter #1 [ $format ] + Parameter #2 [ $latitude ] + Parameter #3 [ $longitude ] + Parameter #4 [ $zenith ] + Parameter #5 [ $gmt_offset ] + } + } + Function [ function date_sun_info ] { + + - Parameters [3] { + Parameter #0 [ $time ] + Parameter #1 [ $latitude ] + Parameter #2 [ $longitude ] + } + } + } + + - Classes [2] { + Class [ class DateTime ] { + + - Constants [11] { + Constant [ string ATOM ] { Y-m-d\TH:i:sP } + Constant [ string COOKIE ] { l, d-M-y H:i:s T } + Constant [ string ISO8601 ] { Y-m-d\TH:i:sO } + Constant [ string RFC822 ] { D, d M y H:i:s O } + Constant [ string RFC850 ] { l, d-M-y H:i:s T } + Constant [ string RFC1036 ] { D, d M y H:i:s O } + Constant [ string RFC1123 ] { D, d M Y H:i:s O } + Constant [ string RFC2822 ] { D, d M Y H:i:s O } + Constant [ string RFC3339 ] { Y-m-d\TH:i:sP } + Constant [ string RSS ] { D, d M Y H:i:s O } + Constant [ string W3C ] { Y-m-d\TH:i:sP } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [9] { + Method [ public method __construct ] { + } + + Method [ public method format ] { + } + + Method [ public method modify ] { + } + + Method [ public method getTimezone ] { + } + + Method [ public method setTimezone ] { + } + + Method [ public method getOffset ] { + } + + Method [ public method setTime ] { + } + + Method [ public method setDate ] { + } + + Method [ public method setISODate ] { + } + } + } + + Class [ class DateTimeZone ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [2] { + Method [ static public method listAbbreviations ] { + } + + Method [ static public method listIdentifiers ] { + } + } + + - Properties [0] { + } + + - Methods [4] { + Method [ public method __construct ] { + } + + Method [ public method getName ] { + } + + Method [ public method getOffset ] { + } + + Method [ public method getTransitions ] { + } + } + } + } +} + +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/007.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/007.phpt new file mode 100644 index 0000000000000..12fddee01df72 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/007.phpt @@ -0,0 +1,52 @@ +--TEST-- +strip comments and whitespace with -w +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`$php -n -w "$filename"`); +var_dump(`$php -n -w "wrong"`); +var_dump(`echo "" | $php -n -w`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(81) " + +" +Could not open input file: wrong +NULL +string(43) " +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/008.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/008.phpt new file mode 100644 index 0000000000000..a833043096d45 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/008.phpt @@ -0,0 +1,43 @@ +--TEST-- +execute a file with -f +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`$php -n -f "$filename"`); +var_dump(`$php -n -f "wrong"`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) " + +Fatal error: Cannot access private property test::$pri in %s on line %d +" +Could not open input file: wrong +NULL +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/009.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/009.phpt new file mode 100644 index 0000000000000..c0bb319f7abc5 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/009.phpt @@ -0,0 +1,23 @@ +--TEST-- +using invalid combinations of cmdline options +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +You cannot use both -n and -c switch. Use -h for help. +NULL +Either execute direct code, process stdin or use a file. +NULL +Either execute direct code, process stdin or use a file. +NULL +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/010-2.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/010-2.phpt new file mode 100644 index 0000000000000..bd33d2cc94331 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/010-2.phpt @@ -0,0 +1,35 @@ +--TEST-- +executing a code with -R +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(21) "int(1) +int(1) +int(1) +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/010.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/010.phpt new file mode 100644 index 0000000000000..e465e37973fce --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/010.phpt @@ -0,0 +1,47 @@ +--TEST-- +executing a file with -F +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +$txt = ' +test +hello +'; + +file_put_contents($filename_txt, $txt); + +var_dump(`cat "$filename_txt" | "$php" -n -F "$filename"`); + +@unlink($filename); +@unlink($filename_txt); + +echo "Done\n"; +?> +--EXPECTF-- +string(39) " +string(10) "test +hello" + +string(0) "" +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/011.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/011.phpt new file mode 100644 index 0000000000000..ef49666d3abda --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/011.phpt @@ -0,0 +1,58 @@ +--TEST-- +syntax check +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -l $filename`); +var_dump(`"$php" -n -l some.unknown`); + +$code = ' + +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -l $filename`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(%d) "No syntax errors detected in %s011.test.php +" +Could not open input file: some.unknown +NULL +string(%d) " +Parse error: %s expecting %s{%s in %s on line %d +Errors parsing %s011.test.php +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/012.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/012.phpt new file mode 100644 index 0000000000000..137e0bd781d1e --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/012.phpt @@ -0,0 +1,38 @@ +--TEST-- +invalid arguments and error messages +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +You can use -R or -F only once. +NULL +You can use -R or -F only once. +NULL +You can use -R or -F only once. +NULL +You can use -R or -F only once. +NULL +You can use -f only once. +NULL +You can use -B only once. +NULL +You can use -E only once. +NULL +You can use -r only once. +NULL +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/013.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/013.phpt new file mode 100644 index 0000000000000..99bfe5e7bb07f --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/013.phpt @@ -0,0 +1,34 @@ +--TEST-- +running PHP code before and after processing input lines with -B and -E +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(18) "string(5) "start" +" +string(16) "string(3) "end" +" +string(34) "string(5) "start" +string(3) "end" +" +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/014.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/014.phpt new file mode 100644 index 0000000000000..b20478a03d9a5 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/014.phpt @@ -0,0 +1,44 @@ +--TEST-- +syntax highlighting +--SKIPIF-- + +--FILE-- + +'; + +file_put_contents($filename, $code); + +var_dump(`"$php" -n -s $filename`); +var_dump(`"$php" -n -s unknown`); + +@unlink($filename); + +echo "Done\n"; +?> +--EXPECTF-- +string(1478) " +
    <?php
    $test 
    "var"//var
    /* test class */
    class test {
        private 
    $var = array();

        public static function 
    foo(Test $arg) {
            echo 
    "hello";
            
    var_dump($this);
        }
    }

    $o = new test;
    ?>
    +
    +
    " +Could not open input file: unknown +NULL +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/015.phpt b/phpt/tests/php-5.2.5/sapi/cli/tests/015.phpt new file mode 100644 index 0000000000000..4d522675925e9 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/015.phpt @@ -0,0 +1,35 @@ +--TEST-- +CLI long options +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +PHP %d.%d.%d%s(cli) (built: %s)%s +Array +( + [0] => - + [1] => foo + [2] => bar + [3] => baz +) + +PHP %d.%d.%d%s(cli) (built: %s)%s +Usage: %s [options] [-f] [--] [args...] +Done diff --git a/phpt/tests/php-5.2.5/sapi/cli/tests/skipif.inc b/phpt/tests/php-5.2.5/sapi/cli/tests/skipif.inc new file mode 100644 index 0000000000000..79e6c91004c57 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/cli/tests/skipif.inc @@ -0,0 +1,7 @@ + diff --git a/phpt/tests/php-5.2.5/sapi/tests/test001.phpt b/phpt/tests/php-5.2.5/sapi/tests/test001.phpt new file mode 100644 index 0000000000000..a964393fd9178 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/tests/test001.phpt @@ -0,0 +1,16 @@ +--TEST-- +IIS style CGI missing SCRIPT_FILENAME +--DESCRIPTION-- +This would be similar to what IIS produces for a simple query. +--ENV-- +return << +--EXPECT-- +HELLO \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/sapi/tests/test002.phpt b/phpt/tests/php-5.2.5/sapi/tests/test002.phpt new file mode 100644 index 0000000000000..42ade3d96b5fc --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/tests/test002.phpt @@ -0,0 +1,22 @@ +--TEST-- +Apache style CGI +--DESCRIPTION-- +Apache likes to set SCRIPT_FILENAME to the php executable +if you use ScriptAlias configurations, and the proper +path is in PATH_TRANSLATED. SCRIPT_NAME in this is faked, +but that is ok, Apache sets SCRIPT_NAME to the ScriptAlias +of the executable. +--ENV-- +return <<conf['TEST_PHP_EXECUTABLE'] +END; +--FILE-- + +--EXPECT-- +HELLO \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/sapi/tests/test003.phpt b/phpt/tests/php-5.2.5/sapi/tests/test003.phpt new file mode 100644 index 0000000000000..522d78db4173c --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/tests/test003.phpt @@ -0,0 +1,21 @@ +--TEST-- +IIS style CGI missing SCRIPT_FILENAME, has PATH_INFO +--DESCRIPTION-- +This would be similar to what IIS produces for a simple query +that also has PATH_INFO. +--REQUEST-- +return << +--EXPECT-- +/path/info \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/sapi/tests/test004.phpt b/phpt/tests/php-5.2.5/sapi/tests/test004.phpt new file mode 100644 index 0000000000000..dad0dd0eec0c7 --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/tests/test004.phpt @@ -0,0 +1,26 @@ +--TEST-- +Apache style CGI with PATH_INFO +--DESCRIPTION-- +Apache likes to set SCRIPT_FILENAME to the php executable +if you use ScriptAlias configurations, and the proper +path is in PATH_TRANSLATED. SCRIPT_NAME in this is faked, +but that is ok, Apache sets SCRIPT_NAME to the ScriptAlias +of the executable. +--REQUEST-- +return <<conf['TEST_PHP_EXECUTABLE'] +END; +--FILE-- + +--EXPECT-- +/path/info \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/sapi/tests/test005.phpt b/phpt/tests/php-5.2.5/sapi/tests/test005.phpt new file mode 100644 index 0000000000000..7415b66a0a78f --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/tests/test005.phpt @@ -0,0 +1,27 @@ +--TEST-- +QUERY_STRING Security Bug +--DESCRIPTION-- +This bug was present in PHP 4.3.0 only. +A failure should print HELLO. +--REQUEST-- +return << +--EXPECTHEADERS-- +Status: 404 +--EXPECT-- +No input file specified. \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/sapi/tests/test006.phpt b/phpt/tests/php-5.2.5/sapi/tests/test006.phpt new file mode 100644 index 0000000000000..45e37811ef71e --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/tests/test006.phpt @@ -0,0 +1,73 @@ +--TEST-- +Multipart Form POST Data +--HEADERS-- +return << +-----------------------------240723202011929-- + +--FILE-- + +--EXPECTF-- +Array +( + [entry] => entry box + [password] => password box + [radio1] => test 1 + [checkbox1] => test 1 + [choices] => Choice 2 +) +Array +( + [file] => Array + ( + [name] => info.php + [type] => application/octet-stream + [tmp_name] => %s + [error] => 0 + [size] => 21 + ) + +) diff --git a/phpt/tests/php-5.2.5/sapi/tests/test007.phpt b/phpt/tests/php-5.2.5/sapi/tests/test007.phpt new file mode 100644 index 0000000000000..8c50e4b80fe1a --- /dev/null +++ b/phpt/tests/php-5.2.5/sapi/tests/test007.phpt @@ -0,0 +1,46 @@ +--TEST-- +Multipart Form POST Data, incorrect content length +--HEADERS-- +return << +-----------------------------240723202011929-- + +--FILE-- + +--EXPECT-- diff --git a/phpt/tests/php-5.2.5/tests/basic/001.phpt b/phpt/tests/php-5.2.5/tests/basic/001.phpt new file mode 100644 index 0000000000000..d0cc1ca082a8a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/001.phpt @@ -0,0 +1,6 @@ +--TEST-- +Trivial "Hello World" test +--FILE-- + +--EXPECT-- +Hello World diff --git a/phpt/tests/php-5.2.5/tests/basic/002.phpt b/phpt/tests/php-5.2.5/tests/basic/002.phpt new file mode 100644 index 0000000000000..e9330c8bf946f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/002.phpt @@ -0,0 +1,11 @@ +--TEST-- +Simple POST Method test +--SKIPIF-- + +--POST-- +a=Hello+World +--FILE-- + +--EXPECT-- +Hello World diff --git a/phpt/tests/php-5.2.5/tests/basic/003.phpt b/phpt/tests/php-5.2.5/tests/basic/003.phpt new file mode 100644 index 0000000000000..ae6603f448a61 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/003.phpt @@ -0,0 +1,14 @@ +--TEST-- +GET and POST Method combined +--SKIPIF-- + +--POST-- +a=Hello+World +--GET-- +b=Hello+Again+World&c=Hi+Mom +--FILE-- + +--EXPECT-- +post-a=(Hello World) get-b=(Hello Again World) get-c=(Hi Mom) diff --git a/phpt/tests/php-5.2.5/tests/basic/004.phpt b/phpt/tests/php-5.2.5/tests/basic/004.phpt new file mode 100644 index 0000000000000..86bf431860e3e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/004.phpt @@ -0,0 +1,12 @@ +--TEST-- +Two variables in POST data +--SKIPIF-- + +--POST-- +a=Hello+World&b=Hello+Again+World +--FILE-- + +--EXPECT-- +Hello World Hello Again World diff --git a/phpt/tests/php-5.2.5/tests/basic/005.phpt b/phpt/tests/php-5.2.5/tests/basic/005.phpt new file mode 100644 index 0000000000000..aa1d199825588 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/005.phpt @@ -0,0 +1,12 @@ +--TEST-- +Three variables in POST data +--SKIPIF-- + +--POST-- +a=Hello+World&b=Hello+Again+World&c=1 +--FILE-- + +--EXPECT-- +Hello World Hello Again World 1 diff --git a/phpt/tests/php-5.2.5/tests/basic/006.phpt b/phpt/tests/php-5.2.5/tests/basic/006.phpt new file mode 100644 index 0000000000000..c614cd9619793 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/006.phpt @@ -0,0 +1,6 @@ +--TEST-- +Add 3 variables together and print result +--FILE-- + +--EXPECT-- +6 diff --git a/phpt/tests/php-5.2.5/tests/basic/007.phpt b/phpt/tests/php-5.2.5/tests/basic/007.phpt new file mode 100644 index 0000000000000..dc808b73b67ff --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/007.phpt @@ -0,0 +1,6 @@ +--TEST-- +Multiply 3 variables and print result +--FILE-- + +--EXPECT-- +64 diff --git a/phpt/tests/php-5.2.5/tests/basic/008.phpt b/phpt/tests/php-5.2.5/tests/basic/008.phpt new file mode 100644 index 0000000000000..511aef0df4307 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/008.phpt @@ -0,0 +1,6 @@ +--TEST-- +Divide 3 variables and print result +--FILE-- + +--EXPECT-- +3 diff --git a/phpt/tests/php-5.2.5/tests/basic/009.phpt b/phpt/tests/php-5.2.5/tests/basic/009.phpt new file mode 100644 index 0000000000000..fefe529af1e85 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/009.phpt @@ -0,0 +1,6 @@ +--TEST-- +Subtract 3 variables and print result +--FILE-- + +--EXPECT-- +10 diff --git a/phpt/tests/php-5.2.5/tests/basic/010.phpt b/phpt/tests/php-5.2.5/tests/basic/010.phpt new file mode 100644 index 0000000000000..9cdfece9e1c8e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/010.phpt @@ -0,0 +1,6 @@ +--TEST-- +Testing | and & operators +--FILE-- + +--EXPECT-- +8 diff --git a/phpt/tests/php-5.2.5/tests/basic/011.phpt b/phpt/tests/php-5.2.5/tests/basic/011.phpt new file mode 100644 index 0000000000000..34eed7915a0b0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/011.phpt @@ -0,0 +1,27 @@ +--TEST-- +Testing $argc and $argv handling (GET) +--SKIPIF-- + +--INI-- +register_argc_argv=1 +--GET-- +ab+cd+ef+123+test +--FILE-- + +--EXPECT-- +0: ab +1: cd +2: ef +3: 123 +4: test diff --git a/phpt/tests/php-5.2.5/tests/basic/012.phpt b/phpt/tests/php-5.2.5/tests/basic/012.phpt new file mode 100644 index 0000000000000..32978532862e9 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/012.phpt @@ -0,0 +1,28 @@ +--TEST-- +Testing $argc and $argv handling (cli) +--SKIPIF-- + +--INI-- +register_argc_argv=1 +variables_order=GPS +--ARGS-- +ab cd ef 123 test +--FILE-- + +--EXPECT-- +0: ab +1: cd +2: ef +3: 123 +4: test diff --git a/phpt/tests/php-5.2.5/tests/basic/013.phpt b/phpt/tests/php-5.2.5/tests/basic/013.phpt new file mode 100644 index 0000000000000..a4155dcf64b87 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/013.phpt @@ -0,0 +1,15 @@ +--TEST-- +POST Method test and arrays +--SKIPIF-- + +--POST-- +a[]=1 +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + string(1) "1" +} diff --git a/phpt/tests/php-5.2.5/tests/basic/014.phpt b/phpt/tests/php-5.2.5/tests/basic/014.phpt new file mode 100644 index 0000000000000..9b7e59f987db4 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/014.phpt @@ -0,0 +1,17 @@ +--TEST-- +POST Method test and arrays - 2 +--SKIPIF-- + +--POST-- +a[]=1&a[]=1 +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "1" +} diff --git a/phpt/tests/php-5.2.5/tests/basic/015.phpt b/phpt/tests/php-5.2.5/tests/basic/015.phpt new file mode 100644 index 0000000000000..b297265bbc7f7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/015.phpt @@ -0,0 +1,15 @@ +--TEST-- +POST Method test and arrays - 3 +--SKIPIF-- + +--POST-- +a[]=1&a[0]=5 +--FILE-- + +--EXPECT-- +array(1) { + [0]=> + string(1) "5" +} diff --git a/phpt/tests/php-5.2.5/tests/basic/016.phpt b/phpt/tests/php-5.2.5/tests/basic/016.phpt new file mode 100644 index 0000000000000..2772531689ded --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/016.phpt @@ -0,0 +1,17 @@ +--TEST-- +POST Method test and arrays - 4 +--SKIPIF-- + +--POST-- +a[a]=1&a[b]=3 +--FILE-- + +--EXPECT-- +array(2) { + ["a"]=> + string(1) "1" + ["b"]=> + string(1) "3" +} diff --git a/phpt/tests/php-5.2.5/tests/basic/017.phpt b/phpt/tests/php-5.2.5/tests/basic/017.phpt new file mode 100644 index 0000000000000..69424caa6c0a5 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/017.phpt @@ -0,0 +1,19 @@ +--TEST-- +POST Method test and arrays - 5 +--SKIPIF-- + +--POST-- +a[]=1&a[a]=1&a[b]=3 +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + string(1) "1" + ["a"]=> + string(1) "1" + ["b"]=> + string(1) "3" +} diff --git a/phpt/tests/php-5.2.5/tests/basic/018.phpt b/phpt/tests/php-5.2.5/tests/basic/018.phpt new file mode 100644 index 0000000000000..5cae5e8a673ab --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/018.phpt @@ -0,0 +1,36 @@ +--TEST-- +POST Method test and arrays - 6 +--SKIPIF-- + +--POST-- +a[][]=1&a[][]=3&b[a][b][c]=1&b[a][b][d]=1 +--FILE-- + +--EXPECT-- +array(2) { + [0]=> + array(1) { + [0]=> + string(1) "1" + } + [1]=> + array(1) { + [0]=> + string(1) "3" + } +} +array(1) { + ["a"]=> + array(1) { + ["b"]=> + array(2) { + ["c"]=> + string(1) "1" + ["d"]=> + string(1) "1" + } + } +} diff --git a/phpt/tests/php-5.2.5/tests/basic/019.phpt b/phpt/tests/php-5.2.5/tests/basic/019.phpt new file mode 100644 index 0000000000000..467d4e6bf2271 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/019.phpt @@ -0,0 +1,19 @@ +--TEST-- +POST Method test and arrays - 7 +--SKIPIF-- + +--POST-- +a[]=1&a[]]=3&a[[]=4 +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + string(1) "1" + [1]=> + string(1) "3" + ["["]=> + string(1) "4" +} diff --git a/phpt/tests/php-5.2.5/tests/basic/020.phpt b/phpt/tests/php-5.2.5/tests/basic/020.phpt new file mode 100644 index 0000000000000..0d4704e7f96e0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/020.phpt @@ -0,0 +1,17 @@ +--TEST-- +POST Method test and arrays - 8 +--SKIPIF-- + +--POST-- +a[a[]]=1&a[b[]]=3 +--FILE-- + +--EXPECT-- +array(2) { + ["a["]=> + string(1) "1" + ["b["]=> + string(1) "3" +} diff --git a/phpt/tests/php-5.2.5/tests/basic/021.phpt b/phpt/tests/php-5.2.5/tests/basic/021.phpt new file mode 100644 index 0000000000000..d8f7c1c0ed890 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/021.phpt @@ -0,0 +1,42 @@ +--TEST-- +Bug #37276 (problems witch $_POST array) +--SKIPIF-- + +--POST_RAW-- +Content-Type: multipart/form-data; boundary=---------------------------20896060251896012921717172737 +-----------------------------20896060251896012921717172737 +Content-Disposition: form-data; name="submitter" + +testname +-----------------------------20896060251896012921717172737 +Content-Disposition: form-data; name="pics"; filename="bug37276.txt" +Content-Type: text/plain + +bug37276 + +-----------------------------20896060251896012921717172737-- +--FILE-- + +--EXPECTF-- +array(1) { + ["pics"]=> + array(5) { + ["name"]=> + string(12) "bug37276.txt" + ["type"]=> + string(10) "text/plain" + ["tmp_name"]=> + string(%d) "%s" + ["error"]=> + int(0) + ["size"]=> + int(9) + } +} +array(1) { + ["submitter"]=> + string(8) "testname" +} diff --git a/phpt/tests/php-5.2.5/tests/basic/022.phpt b/phpt/tests/php-5.2.5/tests/basic/022.phpt new file mode 100644 index 0000000000000..61718f21665c3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/022.phpt @@ -0,0 +1,31 @@ +--TEST-- +Cookies test#1 +--COOKIE-- +cookie1=val1 ; cookie2=val2%20; cookie3=val 3.; cookie 4= value 4 %3B; cookie1=bogus; %20cookie1=ignore;+cookie1=ignore;cookie1;cookie 5=%20 value; cookie%206=þæö;cookie+7=;$cookie.8;cookie-9=1;;;- & % $cookie 10=10 +--FILE-- + +--EXPECT-- +array(10) { + ["cookie1"]=> + string(6) "val1 " + ["cookie2"]=> + string(5) "val2 " + ["cookie3"]=> + string(6) "val 3." + ["cookie_4"]=> + string(10) " value 4 ;" + ["cookie__5"]=> + string(7) " value" + ["cookie_6"]=> + string(3) "þæö" + ["cookie_7"]=> + string(0) "" + ["$cookie_8"]=> + string(0) "" + ["cookie-9"]=> + string(1) "1" + ["-_&_%_$cookie_10"]=> + string(2) "10" +} diff --git a/phpt/tests/php-5.2.5/tests/basic/023.phpt b/phpt/tests/php-5.2.5/tests/basic/023.phpt new file mode 100644 index 0000000000000..4eb698fa05b70 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/023.phpt @@ -0,0 +1,19 @@ +--TEST-- +Cookies test#2 +--INI-- +magic_quotes_gpc=0 +--COOKIE-- +c o o k i e=value; c o o k i e= v a l u e ;;c%20o+o k+i%20e=v;name="value","value",UEhQIQ==;UEhQIQ==foo +--FILE-- + +--EXPECT-- +array(3) { + ["c_o_o_k_i_e"]=> + string(5) "value" + ["name"]=> + string(24) ""value","value",UEhQIQ==" + ["UEhQIQ"]=> + string(4) "=foo" +} diff --git a/phpt/tests/php-5.2.5/tests/basic/024.phpt b/phpt/tests/php-5.2.5/tests/basic/024.phpt new file mode 100644 index 0000000000000..c3336c7ce8fa2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/024.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test HTTP_RAW_POST_DATA creation +--INI-- +magic_quotes_gpc=0 +always_populate_raw_post_data=1 +--SKIPIF-- + +--POST-- +a=ABC&y=XYZ&c[]=1&c[]=2&c[a]=3 +--FILE-- + +--EXPECT-- +array(3) { + ["a"]=> + string(3) "ABC" + ["y"]=> + string(3) "XYZ" + ["c"]=> + array(3) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + ["a"]=> + string(1) "3" + } +} +string(30) "a=ABC&y=XYZ&c[]=1&c[]=2&c[a]=3" diff --git a/phpt/tests/php-5.2.5/tests/basic/025.phpt b/phpt/tests/php-5.2.5/tests/basic/025.phpt new file mode 100644 index 0000000000000..fea9468b41687 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/025.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test HTTP_RAW_POST_DATA with excessive post length +--INI-- +magic_quotes_gpc=0 +always_populate_raw_post_data=1 +post_max_size=1K +--SKIPIF-- + +--POST-- +a=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +--FILE-- + +--EXPECTF-- +Warning: Unknown: POST Content-Length of 2050 bytes exceeds the limit of 1024 bytes in Unknown on line 0 + +Warning: Cannot modify header information - headers already sent in Unknown on line 0 + +Notice: Undefined variable: HTTP_RAW_POST_DATA in %s on line %d +array(0) { +} +NULL diff --git a/phpt/tests/php-5.2.5/tests/basic/026.phpt b/phpt/tests/php-5.2.5/tests/basic/026.phpt new file mode 100644 index 0000000000000..3d0d9df1ec639 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/026.phpt @@ -0,0 +1,19 @@ +--TEST-- +Registration of HTTP_RAW_POST_DATA due to unknown content-type +--INI-- +magic_quotes_gpc=0 +always_populate_raw_post_data=0 +--SKIPIF-- + +--POST_RAW-- +Content-Type: unknown/type +a=1&b=ZYX +--FILE-- + +--EXPECT-- +array(0) { +} +string(10) "a=1&b=ZYX +" \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/basic/027.phpt b/phpt/tests/php-5.2.5/tests/basic/027.phpt new file mode 100644 index 0000000000000..248507b298b6a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/027.phpt @@ -0,0 +1,35 @@ +--TEST-- +Handling of max_input_nesting_level being reached +--INI-- +magic_quotes_gpc=0 +always_populate_raw_post_data=0 +display_errors=0 +max_input_nesting_level=10 +track_errors=1 +log_errors=0 +--SKIPIF-- + +--POST-- +a=1&b=ZYX&c[][][][][][][][][][][][][][][][][][][][][][]=123&d=123&e[][]][]=3 +--FILE-- + +--EXPECT-- +array(4) { + ["a"]=> + string(1) "1" + ["b"]=> + string(3) "ZYX" + ["d"]=> + string(3) "123" + ["e"]=> + array(1) { + [0]=> + array(1) { + [0]=> + string(1) "3" + } + } +} +string(115) "Unknown: Input variable nesting level exceeded 10. To increase the limit change max_input_nesting_level in php.ini." diff --git a/phpt/tests/php-5.2.5/tests/basic/bug20539.phpt b/phpt/tests/php-5.2.5/tests/basic/bug20539.phpt new file mode 100644 index 0000000000000..372285bfae3ef --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/bug20539.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #20539 (PHP CLI Segmentation Fault) +--INI-- +session.auto_start=1 +session.save_handler=files +--FILE-- + +--EXPECT-- +good :) diff --git a/phpt/tests/php-5.2.5/tests/basic/bug29971.phpt b/phpt/tests/php-5.2.5/tests/basic/bug29971.phpt new file mode 100755 index 0000000000000..d4b654bdb1c48 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/basic/bug29971.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #29971 (variables_order behaviour) +--INI-- +variables_order=GPC +--FILE-- + +--EXPECT-- +array(0) { +} +array(0) { +} +string(3) "GPC" diff --git a/phpt/tests/php-5.2.5/tests/bin-info.inc b/phpt/tests/php-5.2.5/tests/bin-info.inc new file mode 100644 index 0000000000000..ad42ea897a8ab --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/bin-info.inc @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/__call_001.phpt b/phpt/tests/php-5.2.5/tests/classes/__call_001.phpt new file mode 100644 index 0000000000000..6fce0a514a620 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/__call_001.phpt @@ -0,0 +1,39 @@ +--TEST-- +ZE2 __call() +x; + } +} + +$foo = new Caller(); +$a = $foo->test(1, '2', 3.4, true); +var_dump($a); + +?> +--EXPECT-- +Method test called: +array(4) { + [0]=> + int(1) + [1]=> + string(1) "2" + [2]=> + float(3.4) + [3]=> + bool(true) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} diff --git a/phpt/tests/php-5.2.5/tests/classes/__call_002.phpt b/phpt/tests/php-5.2.5/tests/classes/__call_002.phpt new file mode 100755 index 0000000000000..53a179f787787 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/__call_002.phpt @@ -0,0 +1,15 @@ +--TEST-- +ZE2 __call() signature check +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Method Test::__call() must take exactly 2 arguments in %s__call_002.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/__set__get_001.phpt b/phpt/tests/php-5.2.5/tests/classes/__set__get_001.phpt new file mode 100644 index 0000000000000..3c9cb09b4a40d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/__set__get_001.phpt @@ -0,0 +1,70 @@ +--TEST-- +ZE2 __set() and __get() +--FILE-- + 1, 'b' => 2, 'c' => 3); + + function __get($nm) { + echo "Getting [$nm]\n"; + + if (isset($this->x[$nm])) { + $r = $this->x[$nm]; + echo "Returning: $r\n"; + return $r; + } + else { + echo "Nothing!\n"; + } + } + + function __set($nm, $val) { + echo "Setting [$nm] to $val\n"; + + if (isset($this->x[$nm])) { + $this->x[$nm] = $val; + echo "OK!\n"; + } + else { + echo "Not OK!\n"; + } + } +} + +$foo = new Setter(); + +// this doesn't go through __set()... should it? +$foo->n = 1; + +// the rest are fine... +$foo->a = 100; +$foo->a++; +$foo->z++; +var_dump($foo); + +?> +--EXPECTF-- +Setting [a] to 100 +OK! +Getting [a] +Returning: 100 +Setting [a] to 101 +OK! +Getting [z] +Nothing! +Setting [z] to 1 +Not OK! +object(setter)#%d (2) { + ["n"]=> + int(1) + ["x"]=> + array(3) { + ["a"]=> + int(101) + ["b"]=> + int(2) + ["c"]=> + int(3) + } +} diff --git a/phpt/tests/php-5.2.5/tests/classes/__set__get_002.phpt b/phpt/tests/php-5.2.5/tests/classes/__set__get_002.phpt new file mode 100755 index 0000000000000..71111ccdf810a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/__set__get_002.phpt @@ -0,0 +1,14 @@ +--TEST-- +ZE2 __get() signature check +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Method Test::__get() must take exactly 1 argument in %s__set__get_002.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/__set__get_003.phpt b/phpt/tests/php-5.2.5/tests/classes/__set__get_003.phpt new file mode 100755 index 0000000000000..390d3033627cf --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/__set__get_003.phpt @@ -0,0 +1,14 @@ +--TEST-- +ZE2 __set() signature check +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Method Test::__set() must take exactly 2 arguments in %s__set__get_003.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/__set__get_004.phpt b/phpt/tests/php-5.2.5/tests/classes/__set__get_004.phpt new file mode 100755 index 0000000000000..523cccee1ef9a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/__set__get_004.phpt @@ -0,0 +1,37 @@ +--TEST-- +ZE2 __set() and __get() +--FILE-- +x[$name])) { + return $this->x[$name]; + } + else + { + return NULL; + } + } + + function __set($name, $val) { + $this->x[$name] = $val; + } +} + +$foo = new Test(); +$bar = new Test(); +$bar->baz = "Check"; + +$foo->bar = $bar; + +var_dump($bar->baz); +var_dump($foo->bar->baz); + +?> +===DONE=== +--EXPECTF-- +string(5) "Check" +string(5) "Check" +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/__set__get_005.phpt b/phpt/tests/php-5.2.5/tests/classes/__set__get_005.phpt new file mode 100755 index 0000000000000..111a2a7a19072 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/__set__get_005.phpt @@ -0,0 +1,66 @@ +--TEST-- +ZE2 __set() and __get() +--FILE-- +x[$name])) { + return $this->x[$name]; + } + else + { + return NULL; + } + } + + function __set($name, $val) { + echo __METHOD__ . "\n"; + $this->x[$name] = $val; + } +} + +class AutoGen +{ + protected $x; + + function __get($name) { + echo __METHOD__ . "\n"; + if (!isset($this->x[$name])) { + $this->x[$name] = new Test(); + } + return $this->x[$name]; + } + + function __set($name, $val) { + echo __METHOD__ . "\n"; + $this->x[$name] = $val; + } +} + +$foo = new AutoGen(); +$foo->bar->baz = "Check"; + +var_dump($foo->bar); +var_dump($foo->bar->baz); + +?> +===DONE=== +--EXPECTF-- +AutoGen::__get +Test::__set +AutoGen::__get +object(Test)#%d (1) { + ["x:protected"]=> + array(1) { + ["baz"]=> + string(5) "Check" + } +} +AutoGen::__get +Test::__get +string(5) "Check" +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/__set_data_corrupt.phpt b/phpt/tests/php-5.2.5/tests/classes/__set_data_corrupt.phpt new file mode 100644 index 0000000000000..8b51302ab3574 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/__set_data_corrupt.phpt @@ -0,0 +1,27 @@ +--TEST-- +ZE2 Data corruption in __set +--FILE-- +null); + + function bar() { + echo $this->t ='f'; + } + function __get($prop) + { + return $this->pp[$prop]; + } + function __set($prop, $val) + { + echo "__set"; + $this->pp[$prop] = ''; + } +} +$f = new foo; +$f->bar(); +?> +--EXPECT-- +__setf diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract.phpt new file mode 100644 index 0000000000000..fbebf4da73898 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract.phpt @@ -0,0 +1,30 @@ +--TEST-- +ZE2 An abstract method may not be called +--SKIPIF-- + +--FILE-- +show(); +$t->error(); + +echo "Done\n"; // shouldn't be displayed +?> +--EXPECTF-- +Call to function show() + +Fatal error: Cannot call abstract method fail::show() in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract_by_interface_001.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract_by_interface_001.phpt new file mode 100755 index 0000000000000..7565fdf45f4aa --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract_by_interface_001.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 An abstract method may not be called +--FILE-- + +===DONE=== +--EXPECTF-- +object(Leaf)#%d (0) { +} + +Fatal error: Class Fails contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (MyInterface::MyInterfaceFunc) in %sabstract_by_interface_001.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract_by_interface_002.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract_by_interface_002.phpt new file mode 100755 index 0000000000000..77c5619dfe226 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract_by_interface_002.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 An abstract method may not be called +--FILE-- + +===DONE=== +--EXPECTF-- +object(Leaf)#%d (0) { +} + +Fatal error: Class Fails contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (MyInterface::MyInterfaceFunc) in %sabstract_by_interface_002.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract_class.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract_class.phpt new file mode 100644 index 0000000000000..571a9b95814fc --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract_class.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 An abstract class cannot be instantiated +--SKIPIF-- + +--FILE-- +show(); + +$t = new fail(); +$t->show(); + +echo "Done\n"; // shouldn't be displayed +?> +--EXPECTF-- +Call to function show() + +Fatal error: Cannot instantiate abstract class fail in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract_derived.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract_derived.phpt new file mode 100644 index 0000000000000..0feceac6bb283 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract_derived.phpt @@ -0,0 +1,20 @@ +--TEST-- +ZE2 A derived class with an abstract method must be abstract +--SKIPIF-- + +--FILE-- + +===DONE=== + +--EXPECTF-- + +Fatal error: Class derived contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (derived::show) in %sabstract_derived.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract_final.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract_final.phpt new file mode 100644 index 0000000000000..20c7ae375f6a8 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract_final.phpt @@ -0,0 +1,16 @@ +--TEST-- +ZE2 A final method cannot be abstract +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Fatal error: Cannot use the final modifier on an abstract class member in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract_inherit.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract_inherit.phpt new file mode 100644 index 0000000000000..362ccb0b766d9 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract_inherit.phpt @@ -0,0 +1,22 @@ +--TEST-- +ZE2 A class that inherits an abstract method is abstract +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Fatal error: Cannot instantiate abstract class fail in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract_not_declared.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract_not_declared.phpt new file mode 100644 index 0000000000000..3b81cd4980a3b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract_not_declared.phpt @@ -0,0 +1,15 @@ +--TEST-- +ZE2 An abstract class must be declared abstract +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (fail::show) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract_redeclare.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract_redeclare.phpt new file mode 100644 index 0000000000000..9a0a1edc3c23a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract_redeclare.phpt @@ -0,0 +1,22 @@ +--TEST-- +ZE2 A method cannot be redeclared abstract +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (fail::show) in %sabstract_redeclare.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract_static.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract_static.phpt new file mode 100644 index 0000000000000..bcebec599f05e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract_static.phpt @@ -0,0 +1,36 @@ +--TEST-- +ZE2 A static abstract methods +--FILE-- + +--EXPECTF-- +Call to function show() + +Strict Standards: Static function fail::func() should not be abstract in %sabstract_static.php(%d) : eval()'d code on line %d + +Fatal error: Class fail contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (fail::func) in %sabstract_static.php(%d) : eval()'d code on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/abstract_user_call.phpt b/phpt/tests/php-5.2.5/tests/classes/abstract_user_call.phpt new file mode 100755 index 0000000000000..0e1ddbe7961c7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/abstract_user_call.phpt @@ -0,0 +1,30 @@ +--TEST-- +ZE2 An abstrcat method cannot be called indirectly +--FILE-- +func(); + +call_user_func(array($o, 'test_base::func')); + +?> +===DONE=== +--EXPECTF-- +test::func() + +Fatal error: Cannot call abstract method test_base::func() in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_001.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_001.phpt new file mode 100644 index 0000000000000..82f96d5239f10 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_001.phpt @@ -0,0 +1,198 @@ +--TEST-- +ZE2 ArrayAccess +--FILE-- +'3rd', '4th'=>4); + + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + return $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } +} + +$obj = new Object; + +var_dump($obj->a); + +echo "===EMPTY===\n"; +var_dump(empty($obj[0])); +var_dump(empty($obj[1])); +var_dump(empty($obj[2])); +var_dump(empty($obj['4th'])); +var_dump(empty($obj['5th'])); +var_dump(empty($obj[6])); + +echo "===isset===\n"; +var_dump(isset($obj[0])); +var_dump(isset($obj[1])); +var_dump(isset($obj[2])); +var_dump(isset($obj['4th'])); +var_dump(isset($obj['5th'])); +var_dump(isset($obj[6])); + +echo "===offsetGet===\n"; +var_dump($obj[0]); +var_dump($obj[1]); +var_dump($obj[2]); +var_dump($obj['4th']); +var_dump($obj['5th']); +var_dump($obj[6]); + +echo "===offsetSet===\n"; +echo "WRITE 1\n"; +$obj[1] = 'Changed 1'; +var_dump($obj[1]); +echo "WRITE 2\n"; +$obj['4th'] = 'Changed 4th'; +var_dump($obj['4th']); +echo "WRITE 3\n"; +$obj['5th'] = 'Added 5th'; +var_dump($obj['5th']); +echo "WRITE 4\n"; +$obj[6] = 'Added 6'; +var_dump($obj[6]); + +var_dump($obj[0]); +var_dump($obj[2]); + +$x = $obj[6] = 'changed 6'; +var_dump($obj[6]); +var_dump($x); + +echo "===unset===\n"; +var_dump($obj->a); +unset($obj[2]); +unset($obj['4th']); +unset($obj[7]); +unset($obj['8th']); +var_dump($obj->a); + +?> +===DONE=== +--EXPECTF-- +array(4) { + [0]=> + string(3) "1st" + [1]=> + int(1) + [2]=> + string(3) "3rd" + ["4th"]=> + int(4) +} +===EMPTY=== +object::offsetExists(0) +object::offsetGet(0) +bool(false) +object::offsetExists(1) +object::offsetGet(1) +bool(false) +object::offsetExists(2) +object::offsetGet(2) +bool(false) +object::offsetExists(4th) +object::offsetGet(4th) +bool(false) +object::offsetExists(5th) +bool(true) +object::offsetExists(6) +bool(true) +===isset=== +object::offsetExists(0) +bool(true) +object::offsetExists(1) +bool(true) +object::offsetExists(2) +bool(true) +object::offsetExists(4th) +bool(true) +object::offsetExists(5th) +bool(false) +object::offsetExists(6) +bool(false) +===offsetGet=== +object::offsetGet(0) +string(3) "1st" +object::offsetGet(1) +int(1) +object::offsetGet(2) +string(3) "3rd" +object::offsetGet(4th) +int(4) +object::offsetGet(5th) + +Notice: Undefined index: 5th in %sarray_access_001.php on line %d +NULL +object::offsetGet(6) + +Notice: Undefined offset: 6 in %sarray_access_001.php on line %d +NULL +===offsetSet=== +WRITE 1 +object::offsetSet(1,Changed 1) +object::offsetGet(1) +string(9) "Changed 1" +WRITE 2 +object::offsetSet(4th,Changed 4th) +object::offsetGet(4th) +string(11) "Changed 4th" +WRITE 3 +object::offsetSet(5th,Added 5th) +object::offsetGet(5th) +string(9) "Added 5th" +WRITE 4 +object::offsetSet(6,Added 6) +object::offsetGet(6) +string(7) "Added 6" +object::offsetGet(0) +string(3) "1st" +object::offsetGet(2) +string(3) "3rd" +object::offsetSet(6,changed 6) +object::offsetGet(6) +string(9) "changed 6" +string(9) "changed 6" +===unset=== +array(6) { + [0]=> + string(3) "1st" + [1]=> + string(9) "Changed 1" + [2]=> + string(3) "3rd" + ["4th"]=> + string(11) "Changed 4th" + ["5th"]=> + string(9) "Added 5th" + [6]=> + string(9) "changed 6" +} +object::offsetUnset(2) +object::offsetUnset(4th) +object::offsetUnset(7) +object::offsetUnset(8th) +array(4) { + [0]=> + string(3) "1st" + [1]=> + string(9) "Changed 1" + ["5th"]=> + string(9) "Added 5th" + [6]=> + string(9) "changed 6" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_002.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_002.phpt new file mode 100644 index 0000000000000..fd08eb39465a9 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_002.phpt @@ -0,0 +1,198 @@ +--TEST-- +ZE2 ArrayAccess::offsetSet without return +--FILE-- +'3rd', '4th'=>4); + + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + /*return*/ $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } +} + +$obj = new Object; + +var_dump($obj->a); + +echo "===EMPTY===\n"; +var_dump(empty($obj[0])); +var_dump(empty($obj[1])); +var_dump(empty($obj[2])); +var_dump(empty($obj['4th'])); +var_dump(empty($obj['5th'])); +var_dump(empty($obj[6])); + +echo "===isset===\n"; +var_dump(isset($obj[0])); +var_dump(isset($obj[1])); +var_dump(isset($obj[2])); +var_dump(isset($obj['4th'])); +var_dump(isset($obj['5th'])); +var_dump(isset($obj[6])); + +echo "===offsetGet===\n"; +var_dump($obj[0]); +var_dump($obj[1]); +var_dump($obj[2]); +var_dump($obj['4th']); +var_dump($obj['5th']); +var_dump($obj[6]); + +echo "===offsetSet===\n"; +echo "WRITE 1\n"; +$obj[1] = 'Changed 1'; +var_dump($obj[1]); +echo "WRITE 2\n"; +$obj['4th'] = 'Changed 4th'; +var_dump($obj['4th']); +echo "WRITE 3\n"; +$obj['5th'] = 'Added 5th'; +var_dump($obj['5th']); +echo "WRITE 4\n"; +$obj[6] = 'Added 6'; +var_dump($obj[6]); + +var_dump($obj[0]); +var_dump($obj[2]); + +$x = $obj[6] = 'changed 6'; +var_dump($obj[6]); +var_dump($x); + +echo "===unset===\n"; +var_dump($obj->a); +unset($obj[2]); +unset($obj['4th']); +unset($obj[7]); +unset($obj['8th']); +var_dump($obj->a); + +?> +===DONE=== +--EXPECTF-- +array(4) { + [0]=> + string(3) "1st" + [1]=> + int(1) + [2]=> + string(3) "3rd" + ["4th"]=> + int(4) +} +===EMPTY=== +object::offsetExists(0) +object::offsetGet(0) +bool(false) +object::offsetExists(1) +object::offsetGet(1) +bool(false) +object::offsetExists(2) +object::offsetGet(2) +bool(false) +object::offsetExists(4th) +object::offsetGet(4th) +bool(false) +object::offsetExists(5th) +bool(true) +object::offsetExists(6) +bool(true) +===isset=== +object::offsetExists(0) +bool(true) +object::offsetExists(1) +bool(true) +object::offsetExists(2) +bool(true) +object::offsetExists(4th) +bool(true) +object::offsetExists(5th) +bool(false) +object::offsetExists(6) +bool(false) +===offsetGet=== +object::offsetGet(0) +string(3) "1st" +object::offsetGet(1) +int(1) +object::offsetGet(2) +string(3) "3rd" +object::offsetGet(4th) +int(4) +object::offsetGet(5th) + +Notice: Undefined index: 5th in %sarray_access_002.php on line %d +NULL +object::offsetGet(6) + +Notice: Undefined offset: 6 in %sarray_access_002.php on line %d +NULL +===offsetSet=== +WRITE 1 +object::offsetSet(1,Changed 1) +object::offsetGet(1) +string(9) "Changed 1" +WRITE 2 +object::offsetSet(4th,Changed 4th) +object::offsetGet(4th) +string(11) "Changed 4th" +WRITE 3 +object::offsetSet(5th,Added 5th) +object::offsetGet(5th) +string(9) "Added 5th" +WRITE 4 +object::offsetSet(6,Added 6) +object::offsetGet(6) +string(7) "Added 6" +object::offsetGet(0) +string(3) "1st" +object::offsetGet(2) +string(3) "3rd" +object::offsetSet(6,changed 6) +object::offsetGet(6) +string(9) "changed 6" +string(9) "changed 6" +===unset=== +array(6) { + [0]=> + string(3) "1st" + [1]=> + string(9) "Changed 1" + [2]=> + string(3) "3rd" + ["4th"]=> + string(11) "Changed 4th" + ["5th"]=> + string(9) "Added 5th" + [6]=> + string(9) "changed 6" +} +object::offsetUnset(2) +object::offsetUnset(4th) +object::offsetUnset(7) +object::offsetUnset(8th) +array(4) { + [0]=> + string(3) "1st" + [1]=> + string(9) "Changed 1" + ["5th"]=> + string(9) "Added 5th" + [6]=> + string(9) "changed 6" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_003.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_003.phpt new file mode 100644 index 0000000000000..3e631125e7c25 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_003.phpt @@ -0,0 +1,59 @@ +--TEST-- +ZE2 ArrayAccess::offsetGet ambiguties +--INI-- +error_reporting=4095 +--FILE-- +'3rd', '4th'=>4); + + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + switch($index) { + case 1: + $a = 'foo'; + return $a . 'Bar'; + case 2: + static $a=1; + return $a; + } + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + if ($index==3) { + $this->cnt = $newval; + } + return $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } +} + +$obj = new Object; + +var_dump($obj[1]); +var_dump($obj[2]); +$obj[2]++; +var_dump($obj[2]); + +?> +===DONE=== +--EXPECTF-- +object::offsetGet(1) +string(6) "fooBar" +object::offsetGet(2) +int(1) +object::offsetGet(2) + +Notice: Indirect modification of overloaded element of object has no effect in %sarray_access_003.php on line 39 +object::offsetGet(2) +int(1) +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_004.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_004.phpt new file mode 100644 index 0000000000000..787496707c151 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_004.phpt @@ -0,0 +1,57 @@ +--TEST-- +ZE2 ArrayAccess::offsetGet ambiguties +--FILE-- +'3rd', '4th'=>4); + + function offsetExists($index) { + echo __METHOD__ . "($index)\n"; + return array_key_exists($index, $this->a); + } + function offsetGet($index) { + echo __METHOD__ . "($index)\n"; + switch($index) { + case 1: + $a = 'foo'; + return $a . 'Bar'; + case 2: + static $a=1; + return $a; + } + return $this->a[$index]; + } + function offsetSet($index, $newval) { + echo __METHOD__ . "($index,$newval)\n"; + if ($index==3) { + $this->cnt = $newval; + } + return $this->a[$index] = $newval; + } + function offsetUnset($index) { + echo __METHOD__ . "($index)\n"; + unset($this->a[$index]); + } +} + +$obj = new Object; + +var_dump($obj[1]); +var_dump($obj[2]); +$obj[2]++; +var_dump($obj[2]); + +?> +===DONE=== +--EXPECTF-- +object::offsetGet(1) +string(6) "fooBar" +object::offsetGet(2) +int(1) +object::offsetGet(2) + +Notice: Indirect modification of overloaded element of object has no effect in %sarray_access_004.php on line 39 +object::offsetGet(2) +int(1) +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_005.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_005.phpt new file mode 100755 index 0000000000000..dcb873ff5683f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_005.phpt @@ -0,0 +1,77 @@ +--TEST-- +ZE2 ArrayAccess and sub Arrays +--FILE-- +person = array(array('name'=>'Joe')); + } + + function offsetExists($index) { + return array_key_exists($this->person, $index); + } + + function offsetGet($index) { + return $this->person[$index]; + } + + function offsetSet($index, $value) { + $this->person[$index] = $value; + } + + function offsetUnset($index) { + unset($this->person[$index]); + } +} + +$people = new Peoples; + +var_dump($people->person[0]['name']); +$people->person[0]['name'] = $people->person[0]['name'] . 'Foo'; +var_dump($people->person[0]['name']); +$people->person[0]['name'] .= 'Bar'; +var_dump($people->person[0]['name']); + +echo "---ArrayOverloading---\n"; + +$people = new Peoples; + +var_dump($people[0]); +var_dump($people[0]['name']); +var_dump($people->person[0]['name'] . 'Foo'); // impossible to assign this since we don't return references here +$x = $people[0]; // creates a copy +$x['name'] .= 'Foo'; +$people[0] = $x; +var_dump($people[0]); +$people[0]['name'] = 'JoeFoo'; +var_dump($people[0]['name']); +$people[0]['name'] = 'JoeFooBar'; +var_dump($people[0]['name']); + +?> +===DONE=== +--EXPECTF-- +string(3) "Joe" +string(6) "JoeFoo" +string(9) "JoeFooBar" +---ArrayOverloading--- +array(1) { + ["name"]=> + string(3) "Joe" +} +string(3) "Joe" +string(6) "JoeFoo" +array(1) { + ["name"]=> + string(6) "JoeFoo" +} + +Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_005.php on line 46 +string(6) "JoeFoo" + +Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_005.php on line 48 +string(6) "JoeFoo" +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_006.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_006.phpt new file mode 100644 index 0000000000000..342a7e5107062 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_006.phpt @@ -0,0 +1,37 @@ +--TEST-- +ZE2 ArrayAccess and ASSIGN_OP operators (+=) +--FILE-- +realArray = array(1,2,3); + } + + function offsetExists($index) { + return array_key_exists($this->realArray, $index); + } + + function offsetGet($index) { + return $this->realArray[$index]; + } + + function offsetSet($index, $value) { + $this->realArray[$index] = $value; + } + + function offsetUnset($index) { + unset($this->realArray[$index]); + } +} + +$a = new OverloadedArray; +$a[1] += 10; +var_dump($a[1]); +echo "---Done---\n"; +?> +--EXPECT-- +int(12) +---Done--- diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_007.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_007.phpt new file mode 100755 index 0000000000000..42187fe5d5f8e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_007.phpt @@ -0,0 +1,57 @@ +--TEST-- +ZE2 ArrayAccess and [] assignment +--FILE-- +realArray = array(); + } + + function offsetExists($index) { + return array_key_exists($this->realArray, $index); + } + + function offsetGet($index) { + return $this->realArray[$index]; + } + + function offsetSet($index, $value) { + if (is_null($index)) { + $this->realArray[] = $value; + } else { + $this->realArray[$index] = $value; + } + } + + function offsetUnset($index) { + unset($this->realArray[$index]); + } + + function dump() { + var_dump($this->realArray); + } +} + +$a = new OverloadedArray; +$a[] = 1; +$a[1] = 2; +$a[2] = 3; +$a[] = 4; +$a->dump(); +?> +===DONE=== +--EXPECT-- +array(4) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_008.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_008.phpt new file mode 100755 index 0000000000000..99798891743f0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_008.phpt @@ -0,0 +1,67 @@ +--TEST-- +ZE2 ArrayAccess and ASSIGN_OP operators (.=) +--FILE-- +person = array(array('name'=>'Foo')); + } + + function offsetExists($index) { + return array_key_exists($this->person, $index); + } + + function offsetGet($index) { + return $this->person[$index]; + } + + function offsetSet($index, $value) { + $this->person[$index] = $value; + } + + function offsetUnset($index) { + unset($this->person[$index]); + } +} + +$people = new Peoples; + +var_dump($people->person[0]['name']); +$people->person[0]['name'] = $people->person[0]['name'] . 'Bar'; +var_dump($people->person[0]['name']); +$people->person[0]['name'] .= 'Baz'; +var_dump($people->person[0]['name']); + +echo "===ArrayOverloading===\n"; + +$people = new Peoples; + +var_dump($people[0]['name']); +$people[0]['name'] = 'FooBar'; +var_dump($people[0]['name']); +$people[0]['name'] = $people->person[0]['name'] . 'Bar'; +var_dump($people[0]['name']); +$people[0]['name'] .= 'Baz'; +var_dump($people[0]['name']); + +?> +===DONE=== +--EXPECTF-- +string(3) "Foo" +string(6) "FooBar" +string(9) "FooBarBaz" +===ArrayOverloading=== +string(3) "Foo" + +Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_008.php on line 40 +string(3) "Foo" + +Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_008.php on line 42 +string(3) "Foo" + +Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_008.php on line 44 +string(3) "Foo" +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_009.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_009.phpt new file mode 100755 index 0000000000000..32573f5a4ddd9 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_009.phpt @@ -0,0 +1,190 @@ +--TEST-- +ZE2 ArrayAccess and ArrayProxyAccess, ArrayProxy +--FILE-- +offsetExists($element)) + { + $object[$element] = array(); + } + $this->object = $object; + $this->element = $element; + } + + function offsetExists($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return array_key_exists($index, $this->object->proxyGet($this->element)); + } + + function offsetGet($index) { + echo __METHOD__ . "($this->element, $index)\n"; + $tmp = $this->object->proxyGet($this->element); + return isset($tmp[$index]) ? $tmp[$index] : NULL; + } + + function offsetSet($index, $value) { + echo __METHOD__ . "($this->element, $index, $value)\n"; + $this->object->proxySet($this->element, $index, $value); + } + + function offsetUnset($index) { + echo __METHOD__ . "($this->element, $index)\n"; + $this->object->proxyUnset($this->element, $index); + } +} + +class Peoples implements ArrayProxyAccess +{ + public $person; + + function __construct() + { + $this->person = array(array('name'=>'Foo')); + } + + function offsetExists($index) + { + return array_key_exists($index, $this->person); + } + + function offsetGet($index) + { + return new ArrayProxy($this, $index); + } + + function offsetSet($index, $value) + { + $this->person[$index] = $value; + } + + function offsetUnset($index) + { + unset($this->person[$index]); + } + + function proxyGet($element) + { + return $this->person[$element]; + } + + function proxySet($element, $index, $value) + { + $this->person[$element][$index] = $value; + } + + function proxyUnset($element, $index) + { + unset($this->person[$element][$index]); + } +} + +$people = new Peoples; + +var_dump($people->person[0]['name']); +$people->person[0]['name'] = $people->person[0]['name'] . 'Bar'; +var_dump($people->person[0]['name']); +$people->person[0]['name'] .= 'Baz'; +var_dump($people->person[0]['name']); + +echo "===ArrayOverloading===\n"; + +$people = new Peoples; + +var_dump($people[0]); +var_dump($people[0]['name']); +$people[0]['name'] = 'FooBar'; +var_dump($people[0]['name']); +$people[0]['name'] = $people->person[0]['name'] . 'Bar'; +var_dump($people[0]['name']); +$people[0]['name'] .= 'Baz'; +var_dump($people[0]['name']); +unset($people[0]['name']); +var_dump($people[0]); +var_dump($people[0]['name']); +$people[0]['name'] = 'BlaBla'; +var_dump($people[0]['name']); + +?> +===DONE=== +--EXPECTF-- +string(3) "Foo" +string(6) "FooBar" +string(9) "FooBarBaz" +===ArrayOverloading=== +ArrayProxy::__construct(0) +object(ArrayProxy)#1 (2) { + ["object:private"]=> + object(Peoples)#2 (1) { + ["person"]=> + array(1) { + [0]=> + array(1) { + ["name"]=> + string(3) "Foo" + } + } + } + ["element:private"]=> + int(0) +} +ArrayProxy::__construct(0) +ArrayProxy::offsetGet(0, name) +string(3) "Foo" +ArrayProxy::__construct(0) +ArrayProxy::offsetSet(0, name, FooBar) +ArrayProxy::__construct(0) +ArrayProxy::offsetGet(0, name) +string(6) "FooBar" +ArrayProxy::__construct(0) +ArrayProxy::offsetSet(0, name, FooBarBar) +ArrayProxy::__construct(0) +ArrayProxy::offsetGet(0, name) +string(9) "FooBarBar" +ArrayProxy::__construct(0) +ArrayProxy::offsetGet(0, name) +ArrayProxy::offsetSet(0, name, FooBarBarBaz) +ArrayProxy::__construct(0) +ArrayProxy::offsetGet(0, name) +string(12) "FooBarBarBaz" +ArrayProxy::__construct(0) +ArrayProxy::offsetUnset(0, name) +ArrayProxy::__construct(0) +object(ArrayProxy)#1 (2) { + ["object:private"]=> + object(Peoples)#2 (1) { + ["person"]=> + array(1) { + [0]=> + array(0) { + } + } + } + ["element:private"]=> + int(0) +} +ArrayProxy::__construct(0) +ArrayProxy::offsetGet(0, name) +NULL +ArrayProxy::__construct(0) +ArrayProxy::offsetSet(0, name, BlaBla) +ArrayProxy::__construct(0) +ArrayProxy::offsetGet(0, name) +string(6) "BlaBla" +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_010.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_010.phpt new file mode 100755 index 0000000000000..05a169b2f036e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_010.phpt @@ -0,0 +1,168 @@ +--TEST-- +ZE2 ArrayAccess and ArrayReferenceProxy with references +--FILE-- +object = $object; + $this->element = &$element; + } + + function offsetExists($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return array_key_exists($index, $this->element); + } + + function offsetGet($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return isset($this->element[$index]) ? $this->element[$index] : NULL; + } + + function offsetSet($index, $value) { + echo __METHOD__ . "($this->element, $index, $value)\n"; + $this->element[$index] = $value; + } + + function offsetUnset($index) { + echo __METHOD__ . "($this->element, $index)\n"; + unset($this->element[$index]); + } +} + +class Peoples implements ArrayAccess +{ + public $person; + + function __construct() + { + $this->person = array(array('name'=>'Foo')); + } + + function offsetExists($index) + { + return array_key_exists($index, $this->person); + } + + function offsetGet($index) + { + return new ArrayReferenceProxy($this, $this->person[$index]); + } + + function offsetSet($index, $value) + { + $this->person[$index] = $value; + } + + function offsetUnset($index) + { + unset($this->person[$index]); + } +} + +$people = new Peoples; + +var_dump($people->person[0]['name']); +$people->person[0]['name'] = $people->person[0]['name'] . 'Bar'; +var_dump($people->person[0]['name']); +$people->person[0]['name'] .= 'Baz'; +var_dump($people->person[0]['name']); + +echo "===ArrayOverloading===\n"; + +$people = new Peoples; + +var_dump($people[0]); +var_dump($people[0]['name']); +$people[0]['name'] = 'FooBar'; +var_dump($people[0]['name']); +$people[0]['name'] = $people->person[0]['name'] . 'Bar'; +var_dump($people[0]['name']); +$people[0]['name'] .= 'Baz'; +var_dump($people[0]['name']); +unset($people[0]['name']); +var_dump($people[0]); +var_dump($people[0]['name']); +$people[0]['name'] = 'BlaBla'; +var_dump($people[0]['name']); + +?> +===DONE=== + +--EXPECTF-- +string(3) "Foo" +string(6) "FooBar" +string(9) "FooBarBaz" +===ArrayOverloading=== +ArrayReferenceProxy::__construct(Array) +object(ArrayReferenceProxy)#1 (2) { + ["object:private"]=> + object(Peoples)#2 (1) { + ["person"]=> + array(1) { + [0]=> + &array(1) { + ["name"]=> + string(3) "Foo" + } + } + } + ["element:private"]=> + &array(1) { + ["name"]=> + string(3) "Foo" + } +} +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetGet(Array, name) +string(3) "Foo" +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetSet(Array, name, FooBar) +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetGet(Array, name) +string(6) "FooBar" +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetSet(Array, name, FooBarBar) +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetGet(Array, name) +string(9) "FooBarBar" +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetGet(Array, name) +ArrayReferenceProxy::offsetSet(Array, name, FooBarBarBaz) +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetGet(Array, name) +string(12) "FooBarBarBaz" +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetUnset(Array, name) +ArrayReferenceProxy::__construct(Array) +object(ArrayReferenceProxy)#1 (2) { + ["object:private"]=> + object(Peoples)#2 (1) { + ["person"]=> + array(1) { + [0]=> + &array(0) { + } + } + } + ["element:private"]=> + &array(0) { + } +} +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetGet(Array, name) +NULL +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetSet(Array, name, BlaBla) +ArrayReferenceProxy::__construct(Array) +ArrayReferenceProxy::offsetGet(Array, name) +string(6) "BlaBla" +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_011.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_011.phpt new file mode 100755 index 0000000000000..20d39568ba64b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_011.phpt @@ -0,0 +1,187 @@ +--TEST-- +ZE2 ArrayAccess and ArrayAccessReferenceProxy with references to main array +--FILE-- +object = $object; + $this->oarray = &$array; + $this->element = $element; + } + + function offsetExists($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return array_key_exists($index, $this->oarray[$this->element]); + } + + function offsetGet($index) { + echo __METHOD__ . "($this->element, $index)\n"; + return isset($this->oarray[$this->element][$index]) ? $this->oarray[$this->element][$index] : NULL; + } + + function offsetSet($index, $value) { + echo __METHOD__ . "($this->element, $index, $value)\n"; + $this->oarray[$this->element][$index] = $value; + } + + function offsetUnset($index) { + echo __METHOD__ . "($this->element, $index)\n"; + unset($this->oarray[$this->element][$index]); + } +} + +class Peoples implements ArrayAccess +{ + public $person; + + function __construct() + { + $this->person = array(array('name'=>'Foo')); + } + + function offsetExists($index) + { + return array_key_exists($index, $this->person); + } + + function offsetGet($index) + { + if (is_array($this->person[$index])) + { + return new ArrayAccessReferenceProxy($this, $this->person, $index); + } + else + { + return $this->person[$index]; + } + } + + function offsetSet($index, $value) + { + $this->person[$index] = $value; + } + + function offsetUnset($index) + { + unset($this->person[$index]); + } +} + +$people = new Peoples; + +var_dump($people->person[0]['name']); +$people->person[0]['name'] = $people->person[0]['name'] . 'Bar'; +var_dump($people->person[0]['name']); +$people->person[0]['name'] .= 'Baz'; +var_dump($people->person[0]['name']); + +echo "===ArrayOverloading===\n"; + +$people = new Peoples; + +var_dump($people[0]); +var_dump($people[0]['name']); +$people[0]['name'] = 'FooBar'; +var_dump($people[0]['name']); +$people[0]['name'] = $people->person[0]['name'] . 'Bar'; +var_dump($people[0]['name']); +$people[0]['name'] .= 'Baz'; +var_dump($people[0]['name']); +unset($people[0]['name']); +var_dump($people[0]); +var_dump($people[0]['name']); +$people[0]['name'] = 'BlaBla'; +var_dump($people[0]['name']); + +?> +===DONE=== + +--EXPECTF-- +string(3) "Foo" +string(6) "FooBar" +string(9) "FooBarBaz" +===ArrayOverloading=== +ArrayAccessReferenceProxy::__construct(0) +object(ArrayAccessReferenceProxy)#1 (3) { + ["object:private"]=> + object(Peoples)#2 (1) { + ["person"]=> + &array(1) { + [0]=> + array(1) { + ["name"]=> + string(3) "Foo" + } + } + } + ["oarray:private"]=> + &array(1) { + [0]=> + array(1) { + ["name"]=> + string(3) "Foo" + } + } + ["element:private"]=> + int(0) +} +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetGet(0, name) +string(3) "Foo" +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetSet(0, name, FooBar) +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetGet(0, name) +string(6) "FooBar" +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetSet(0, name, FooBarBar) +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetGet(0, name) +string(9) "FooBarBar" +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetGet(0, name) +ArrayAccessReferenceProxy::offsetSet(0, name, FooBarBarBaz) +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetGet(0, name) +string(12) "FooBarBarBaz" +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetUnset(0, name) +ArrayAccessReferenceProxy::__construct(0) +object(ArrayAccessReferenceProxy)#1 (3) { + ["object:private"]=> + object(Peoples)#2 (1) { + ["person"]=> + &array(1) { + [0]=> + array(0) { + } + } + } + ["oarray:private"]=> + &array(1) { + [0]=> + array(0) { + } + } + ["element:private"]=> + int(0) +} +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetGet(0, name) +NULL +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetSet(0, name, BlaBla) +ArrayAccessReferenceProxy::__construct(0) +ArrayAccessReferenceProxy::offsetGet(0, name) +string(6) "BlaBla" +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_012.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_012.phpt new file mode 100755 index 0000000000000..8f85f296eb9a4 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_012.phpt @@ -0,0 +1,36 @@ +--TEST-- +ZE2 ArrayAccess cannot assign by reference +--FILE-- +data[$index] = $value; + } + + public function offsetGet($index) { + return $this->data[$index]; + } + + public function offsetExists($index) { + return isset($this->data[$index]); + } +} + +$data = new ArrayAccessImpl(); +$test = 'some data'; +$data['element'] = NULL; // prevent notice +$data['element'] = &$test; + +?> +===DONE=== + +--EXPECTF-- + +Notice: Indirect modification of overloaded element of ArrayAccessImpl has no effect in %sarray_access_012.php on line 24 + +Fatal error: Cannot assign by reference to overloaded object in %sarray_access_012.php on line 24 diff --git a/phpt/tests/php-5.2.5/tests/classes/array_access_013.phpt b/phpt/tests/php-5.2.5/tests/classes/array_access_013.phpt new file mode 100755 index 0000000000000..206d9d5403762 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/array_access_013.phpt @@ -0,0 +1,58 @@ +--TEST-- +ZE2 ArrayAccess and exceptions +--FILE-- +getMessage() . "()\n"; +} + +try +{ + echo $t[0]; +} +catch(Exception $e) +{ + echo "Caught in " . $e->getMessage() . "()\n"; +} + +try +{ + $t[0] = 1; +} +catch(Exception $e) +{ + echo "Caught in " . $e->getMessage() . "()\n"; +} + +try +{ + unset($t[0]); +} +catch(Exception $e) +{ + echo "Caught in " . $e->getMessage() . "()\n"; +} +?> +===DONE=== +--EXPECT-- +Caught in Test::offsetExists() +Caught in Test::offsetGet() +Caught in Test::offsetSet() +Caught in Test::offsetUnset() +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/assign_op_property_001.phpt b/phpt/tests/php-5.2.5/tests/classes/assign_op_property_001.phpt new file mode 100644 index 0000000000000..54e519e8f62c2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/assign_op_property_001.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 assign_op property of overloaded object +--FILE-- +real_a = $value; + } + } + + function __get($property) { + if ($property = "a") { + return $this->real_a; + } + } +} + +$obj = new Test; +var_dump($obj->a); +$obj->a += 2; +var_dump($obj->a); +echo "---Done---\n"; +?> +--EXPECT-- +int(2) +int(4) +---Done--- diff --git a/phpt/tests/php-5.2.5/tests/classes/autoload_001.phpt b/phpt/tests/php-5.2.5/tests/classes/autoload_001.phpt new file mode 100755 index 0000000000000..6f325f49bb5f3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/autoload_001.phpt @@ -0,0 +1,24 @@ +--TEST-- +ZE2 Autoload and class_exists +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +__autoload(autoload_root) +bool(true) +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/autoload_002.phpt b/phpt/tests/php-5.2.5/tests/classes/autoload_002.phpt new file mode 100755 index 0000000000000..27dea0f9d4f82 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/autoload_002.phpt @@ -0,0 +1,27 @@ +--TEST-- +ZE2 Autoload and get_class_methods +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +__autoload(autoload_root) +array(1) { + [0]=> + string(12) "testFunction" +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/autoload_003.phpt b/phpt/tests/php-5.2.5/tests/classes/autoload_003.phpt new file mode 100755 index 0000000000000..7bdb5da36af36 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/autoload_003.phpt @@ -0,0 +1,25 @@ +--TEST-- +ZE2 Autoload and derived classes +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +__autoload(autoload_root) +__autoload(autoload_derived) +bool(true) +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/autoload_004.phpt b/phpt/tests/php-5.2.5/tests/classes/autoload_004.phpt new file mode 100755 index 0000000000000..23aea5d086697 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/autoload_004.phpt @@ -0,0 +1,28 @@ +--TEST-- +ZE2 Autoload and recursion +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +bool(false) +bool(false) +__autoload(autoload_root) +__autoload(autoload_derived) +bool(true) +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/autoload_005.phpt b/phpt/tests/php-5.2.5/tests/classes/autoload_005.phpt new file mode 100755 index 0000000000000..36a4e18f0ba95 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/autoload_005.phpt @@ -0,0 +1,45 @@ +--TEST-- +ZE2 Autoload from destructor +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +bool(false) +bool(false) +Test::__destruct +bool(false) +bool(false) +__autoload(autoload_root) +__autoload(autoload_derived) +object(autoload_derived)#%d (0) { +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/autoload_006.phpt b/phpt/tests/php-5.2.5/tests/classes/autoload_006.phpt new file mode 100755 index 0000000000000..9af6fc98299dc --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/autoload_006.phpt @@ -0,0 +1,40 @@ +--TEST-- +ZE2 Autoload from destructor +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +bool(false) +bool(false) +__autoload(autoload_interface) +__autoload(Autoload_Implements) +object(autoload_implements)#%d (0) { +} +bool(true) +bool(true) +bool(true) +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/autoload_derived.p5c b/phpt/tests/php-5.2.5/tests/classes/autoload_derived.p5c new file mode 100755 index 0000000000000..a24c6f932d0b6 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/autoload_derived.p5c @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/autoload_implements.p5c b/phpt/tests/php-5.2.5/tests/classes/autoload_implements.p5c new file mode 100755 index 0000000000000..66c8f7e532bee --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/autoload_implements.p5c @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/autoload_interface.p5c b/phpt/tests/php-5.2.5/tests/classes/autoload_interface.p5c new file mode 100755 index 0000000000000..3f9a4e70a49e2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/autoload_interface.p5c @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/autoload_root.p5c b/phpt/tests/php-5.2.5/tests/classes/autoload_root.p5c new file mode 100755 index 0000000000000..ab0283851efd7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/autoload_root.p5c @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/bug23951.phpt b/phpt/tests/php-5.2.5/tests/classes/bug23951.phpt new file mode 100644 index 0000000000000..2e272b87fe9ad --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/bug23951.phpt @@ -0,0 +1,44 @@ +--TEST-- +Bug #23951 (Defines not working in inherited classes) +--FILE-- +'foo1_value', FOO2=>'foo2_value'); + +} + +class B extends A { + + public $b_var = 'foo'; + +} + +$a = new A; +$b = new B; + +print_r($a); +print_r($b->a_var); +print_r($b->b_var); + +?> +--EXPECT-- +A Object +( + [a_var] => Array + ( + [1] => foo1_value + [2] => foo2_value + ) + +) +Array +( + [1] => foo1_value + [2] => foo2_value +) +foo diff --git a/phpt/tests/php-5.2.5/tests/classes/bug24399.phpt b/phpt/tests/php-5.2.5/tests/classes/bug24399.phpt new file mode 100644 index 0000000000000..fedf8e5d245ab --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/bug24399.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #24399 (is_subclass_of() crashes when parent class doesn't exist) +--FILE-- + +--EXPECT-- +bool(false) diff --git a/phpt/tests/php-5.2.5/tests/classes/bug24445.phpt b/phpt/tests/php-5.2.5/tests/classes/bug24445.phpt new file mode 100644 index 0000000000000..af08307ac464c --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/bug24445.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #24445 (get_parent_class() returns the current class when passed an object) +--FILE-- + +--EXPECT-- +bool(false) +bool(false) diff --git a/phpt/tests/php-5.2.5/tests/classes/bug26737.phpt b/phpt/tests/php-5.2.5/tests/classes/bug26737.phpt new file mode 100644 index 0000000000000..e190318ffd819 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/bug26737.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #26737 (Protected and private variables are not saved on serialization when a user defined __sleep is used) +--FILE-- + +--EXPECTF-- +Notice: serialize(): "no_such" returned as member variable from __sleep() but does not exist in %s on line %d +string(130) "O:3:"foo":4:{s:12:"\0foo\0private";s:7:"private";s:12:"\0*\0protected";s:9:"protected";s:6:"public";s:6:"public";s:7:"no_such";N;}" diff --git a/phpt/tests/php-5.2.5/tests/classes/bug27468.phpt b/phpt/tests/php-5.2.5/tests/classes/bug27468.phpt new file mode 100644 index 0000000000000..f7ec8b6882362 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/bug27468.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #27468 (foreach in __destruct() causes segfault) +--FILE-- +x as $x); + } +} +new foo(); +echo 'OK'; +?> +--EXPECTF-- +Notice: Undefined property: foo::$x in %sbug27468.php on line 4 + +Warning: Invalid argument supplied for foreach() in %sbug27468.php on line 4 +OK diff --git a/phpt/tests/php-5.2.5/tests/classes/bug27504.phpt b/phpt/tests/php-5.2.5/tests/classes/bug27504.phpt new file mode 100644 index 0000000000000..ca13990c9364d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/bug27504.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #27504 (call_user_func_array allows calling of private/protected methods) +--FILE-- +bar('1'); + } + private function bar ( $param ) { + echo 'Called function foo:bar('.$param.')'."\n"; + } + } + + $foo = new foo(); + + call_user_func_array( array( $foo , 'bar' ) , array( '2' ) ); + + $foo->bar('3'); +?> +--EXPECTF-- +Called function foo:bar(%d) + +Warning: call_user_func_array(): First argument is expected to be a valid callback, 'foo::bar' was given in %sbug27504.php on line %d + +Fatal error: Call to private method foo::bar() from context '' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/bug29446.phpt b/phpt/tests/php-5.2.5/tests/classes/bug29446.phpt new file mode 100644 index 0000000000000..5e30e8e74b2fd --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/bug29446.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #29446 (ZE allows multiple declarations of the same class constant) +--FILE-- + +--EXPECTF-- +Fatal error: Cannot redefine class constant testClass::TEST_CONST in %s on line 5 \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/class_abstract.phpt b/phpt/tests/php-5.2.5/tests/classes/class_abstract.phpt new file mode 100755 index 0000000000000..880f84930fd46 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/class_abstract.phpt @@ -0,0 +1,28 @@ +--TEST-- +ZE2 An abstract class cannot be instanciated +--SKIPIF-- + +--FILE-- +show(); + +$t = new base(); +$t->show(); + +echo "Done\n"; // shouldn't be displayed +?> +--EXPECTF-- +base + +Fatal error: Cannot instantiate abstract class base in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/class_example.phpt b/phpt/tests/php-5.2.5/tests/classes/class_example.phpt new file mode 100644 index 0000000000000..621958b1bd23f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/class_example.phpt @@ -0,0 +1,85 @@ +--TEST-- +Classes general test +--FILE-- + +first_name."\n"; + echo "Family name:\t ".$this->family_name."\n"; + echo "Address:\t ".$this->address."\n"; + echo "Phone:\t\t ".$this->phone_num."\n"; + echo "\n\n"; + } + function initialize($first_name,$family_name,$address,$phone_num) + { + $this->first_name = $first_name; + $this->family_name = $family_name; + $this->address = $address; + $this->phone_num = $phone_num; + } +}; + + +function test($u) +{ /* one can pass classes as arguments */ + $u->display(); + $t = $u; + $t->address = "New address..."; + return $t; /* and also return them as return values */ +} + +$user1 = new user; +$user2 = new user; + +$user1->initialize("Zeev","Suraski","Ben Gourion 3, Kiryat Bialik, Israel","+972-4-8713139"); +$user2->initialize("Andi","Gutmans","Haifa, Israel","+972-4-8231621"); +$user1->display(); +$user2->display(); + +$tmp = test($user2); +$tmp->display(); + +?> +--EXPECT-- +User information +---------------- + +First name: Zeev +Family name: Suraski +Address: Ben Gourion 3, Kiryat Bialik, Israel +Phone: +972-4-8713139 + + +User information +---------------- + +First name: Andi +Family name: Gutmans +Address: Haifa, Israel +Phone: +972-4-8231621 + + +User information +---------------- + +First name: Andi +Family name: Gutmans +Address: Haifa, Israel +Phone: +972-4-8231621 + + +User information +---------------- + +First name: Andi +Family name: Gutmans +Address: New address... +Phone: +972-4-8231621 diff --git a/phpt/tests/php-5.2.5/tests/classes/class_final.phpt b/phpt/tests/php-5.2.5/tests/classes/class_final.phpt new file mode 100755 index 0000000000000..5c73cb25563eb --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/class_final.phpt @@ -0,0 +1,22 @@ +--TEST-- +ZE2 A final class cannot be inherited +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Class derived may not inherit from final class (base) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/class_stdclass.phpt b/phpt/tests/php-5.2.5/tests/classes/class_stdclass.phpt new file mode 100755 index 0000000000000..5e3422aeae91f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/class_stdclass.phpt @@ -0,0 +1,14 @@ +--TEST-- +Instantiate stdClass +--FILE-- + +--EXPECTF-- +stdClass +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/clone_001.phpt b/phpt/tests/php-5.2.5/tests/classes/clone_001.phpt new file mode 100755 index 0000000000000..8f956955f2e12 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/clone_001.phpt @@ -0,0 +1,38 @@ +p2 = 'A'; +$obj->p3 = 'B'; +$copy = clone $obj; +$copy->p3 = 'C'; +echo "Object\n"; +var_dump($obj); +echo "Clown\n"; +var_dump($copy); +echo "Done\n"; +?> +--EXPECT-- +Object +object(test)#1 (3) { + ["p1"]=> + int(1) + ["p2"]=> + string(1) "A" + ["p3"]=> + string(1) "B" +} +Clown +object(test)#2 (3) { + ["p1"]=> + int(1) + ["p2"]=> + string(1) "A" + ["p3"]=> + string(1) "C" +} +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/clone_002.phpt b/phpt/tests/php-5.2.5/tests/classes/clone_002.phpt new file mode 100755 index 0000000000000..55e08b2cdf593 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/clone_002.phpt @@ -0,0 +1,40 @@ +p2 = 'A'; +$obj->p3 = 'B'; +$copy = clone $obj; +$copy->p3 = 'C'; +echo "Object\n"; +var_dump($obj); +echo "Clown\n"; +var_dump($copy); +echo "Done\n"; +?> +--EXPECT-- +Object +object(test)#1 (3) { + ["p1"]=> + int(1) + ["p2"]=> + string(1) "A" + ["p3"]=> + string(1) "B" +} +Clown +object(test)#2 (3) { + ["p1"]=> + int(1) + ["p2"]=> + string(1) "A" + ["p3"]=> + string(1) "C" +} +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/clone_003.phpt b/phpt/tests/php-5.2.5/tests/classes/clone_003.phpt new file mode 100755 index 0000000000000..21438227238ff --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/clone_003.phpt @@ -0,0 +1,55 @@ +--TEST-- +ZE2 object cloning, 3 +p5 = 'clone:5'; + } +} + +$obj = new test; +$obj->p4 = 'A'; +$copy = clone $obj; +echo "Object\n"; +print_r($obj); +echo "Clown\n"; +print_r($copy); +echo "Done\n"; +?> +--EXPECT-- +Object +test Object +( + [p1] => test:1 + [p3] => test:3 + [p4] => A + [p5] => test:5 + [p2] => base:2 + [p6:private] => base:6 +) +Clown +test Object +( + [p1] => test:1 + [p3] => test:3 + [p4] => A + [p5] => clone:5 + [p2] => base:2 + [p6:private] => base:6 +) +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/clone_004.phpt b/phpt/tests/php-5.2.5/tests/classes/clone_004.phpt new file mode 100755 index 0000000000000..2059103bc5aa0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/clone_004.phpt @@ -0,0 +1,82 @@ +--TEST-- +ZE2 object cloning, 4 +--FILE-- +a = array(1,2); +$o1->b = array(3,4); +$o1->show(); + +echo "Clone\n"; +$o2 = clone $o1; +$o2->show(); + +echo "Modify\n"; +$o2->a = 5; +$o2->b = 6; +$o2->show(); + +echo "Done\n"; +?> +--EXPECT-- +Original +object(test)#1 (2) { + ["b"]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } + ["a"]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +Clone +object(test)#2 (2) { + ["b"]=> + array(2) { + [0]=> + int(3) + [1]=> + int(4) + } + ["a"]=> + array(2) { + [0]=> + int(1) + [1]=> + int(2) + } +} +Modify +object(test)#2 (2) { + ["b"]=> + int(6) + ["a"]=> + int(5) +} +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/clone_005.phpt b/phpt/tests/php-5.2.5/tests/classes/clone_005.phpt new file mode 100755 index 0000000000000..bfe4d66d6fa5f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/clone_005.phpt @@ -0,0 +1,19 @@ +--TEST-- +ZE2 object cloning, 5 +--FILE-- + +--EXPECTF-- +Fatal error: Cannot override final method base::__clone() in %sclone_005.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/clone_006.phpt b/phpt/tests/php-5.2.5/tests/classes/clone_006.phpt new file mode 100755 index 0000000000000..141cd06df12e3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/clone_006.phpt @@ -0,0 +1,36 @@ +--TEST-- +ZE2 object cloning, 6 +id = self::$id++; + } + + function __clone() { + $this->address = "New York"; + $this->id = self::$id++; + } +} + +$original = new MyCloneable(); + +$original->name = "Hello"; +$original->address = "Tel-Aviv"; + +echo $original->id . "\n"; + +$clone = clone $original; + +echo $clone->id . "\n"; +echo $clone->name . "\n"; +echo $clone->address . "\n"; + +?> +--EXPECT-- +0 +1 +Hello +New York diff --git a/phpt/tests/php-5.2.5/tests/classes/constants_scope_001.phpt b/phpt/tests/php-5.2.5/tests/classes/constants_scope_001.phpt new file mode 100644 index 0000000000000..923e15e9cd2d6 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/constants_scope_001.phpt @@ -0,0 +1,33 @@ + +--EXPECTF-- + +Notice: Use of undefined constant FATAL - assumed 'FATAL' in %sconstants_scope_001.php on line %d +FATAL = FATAL +self::FATAL = Fatal error +self::FATAL = Worst error +parent::FATAL = Fatal error diff --git a/phpt/tests/php-5.2.5/tests/classes/ctor_dtor.phpt b/phpt/tests/php-5.2.5/tests/classes/ctor_dtor.phpt new file mode 100644 index 0000000000000..871ef3066d1c3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/ctor_dtor.phpt @@ -0,0 +1,35 @@ +early(); +unset($t); +$t = new late(); +//unset($t); delay to end of script + +echo "Done\n"; +?> +--EXPECTF-- +early::early +early::early +early::__destruct +late::__construct +Done +late::__destruct diff --git a/phpt/tests/php-5.2.5/tests/classes/ctor_dtor_inheritance.phpt b/phpt/tests/php-5.2.5/tests/classes/ctor_dtor_inheritance.phpt new file mode 100644 index 0000000000000..60f7f304849be --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/ctor_dtor_inheritance.phpt @@ -0,0 +1,96 @@ +--TEST-- +ZE2 A derived class can use the inherited constructor/destructor +name = 'base'; + print_r($this); + } + + function __destruct() { + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + print_r($this); + } +} + +class derived extends base { + public $other; + + function __construct() { + $this->name = 'init'; + $this->other = 'other'; + print_r($this); + parent::__construct(); + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + $this->name = 'derived'; + print_r($this); + } + + function __destruct() { + parent::__destruct(); + echo __CLASS__ . "::" . __FUNCTION__ . "\n"; + print_r($this); + } +} + +echo "Testing class base\n"; +$t = new base(); +unset($t); +echo "Testing class derived\n"; +$t = new derived(); +unset($t); + +echo "Done\n"; +?> +--EXPECTF-- +Testing class base +base::__construct +base Object +( + [name] => base +) +base::__destruct +base Object +( + [name] => base +) +Testing class derived +derived Object +( + [other] => other + [name] => init +) +base::__construct +derived Object +( + [other] => other + [name] => base +) +derived::__construct +derived Object +( + [other] => other + [name] => derived +) +base::__destruct +derived Object +( + [other] => other + [name] => derived +) +derived::__destruct +derived Object +( + [other] => other + [name] => derived +) +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/ctor_failure.phpt b/phpt/tests/php-5.2.5/tests/classes/ctor_failure.phpt new file mode 100755 index 0000000000000..b7d3b64dda6b9 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/ctor_failure.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 Do not call destructors if constructor fails +--FILE-- +getMessage() . ")\n"; +} + +?> +===DONE=== +--EXPECT-- +Test::__construct(Hello) +Caught Exception(Hello) +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_01.phpt b/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_01.phpt new file mode 100755 index 0000000000000..f6f9b66eabb9d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_01.phpt @@ -0,0 +1,19 @@ +--TEST-- +ZE2 A class constructor must keep the signature of an interface +--FILE-- + +--EXPECTF-- +Fatal error: Declaration of implem::__construct() must be compatible with that of constr::__construct() in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_02.phpt b/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_02.phpt new file mode 100755 index 0000000000000..a0dfe87788cec --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_02.phpt @@ -0,0 +1,35 @@ +--TEST-- +ZE2 A class constructor must keep the signature of all interfaces +--FILE-- + +--EXPECTF-- +Fatal error: Can't inherit abstract function constr3::__construct() (previously declared abstract in constr1) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_03.phpt b/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_03.phpt new file mode 100755 index 0000000000000..953d6822fdf5c --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_03.phpt @@ -0,0 +1,23 @@ +--TEST-- +ZE2 A class constructor must keep the signature of base class interfaces +--FILE-- + +--EXPECTF-- +Fatal error: Declaration of derived::__construct() must be compatible with that of constr::__construct() in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_04.phpt b/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_04.phpt new file mode 100755 index 0000000000000..0016244c18aae --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/ctor_in_interface_04.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 A class constructor must keep the signature of base class interfaces +--FILE-- + +--EXPECTF-- +Fatal error: Declaration of derived::__construct() must be compatible with that of constr::__construct() in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/ctor_name_clash.phpt b/phpt/tests/php-5.2.5/tests/classes/ctor_name_clash.phpt new file mode 100644 index 0000000000000..1a1d6fa511d0d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/ctor_name_clash.phpt @@ -0,0 +1,22 @@ +--TEST-- +ZE2 The child class can re-use the parent class name for a function member +--FILE-- +base(); +?> +--EXPECTF-- +base::base +derived::base diff --git a/phpt/tests/php-5.2.5/tests/classes/ctor_visibility.phpt b/phpt/tests/php-5.2.5/tests/classes/ctor_visibility.phpt new file mode 100755 index 0000000000000..8d3b1c5c501be --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/ctor_visibility.phpt @@ -0,0 +1,69 @@ +--TEST-- +ZE2 A private constructor cannot be called +--FILE-- + +===DONE=== +--EXPECTF-- +Derived::__construct() +Test::__construct() +TestPriv::__construct() +DerivedPriv::__construct() + +Fatal error: Cannot call private TestPriv::__construct() in %sctor_visibility.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/dereferencing_001.phpt b/phpt/tests/php-5.2.5/tests/classes/dereferencing_001.phpt new file mode 100644 index 0000000000000..a3ebfbaf0d35e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/dereferencing_001.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 dereferencing of objects from methods +--FILE-- +name = $_name; + } + + function display() { + echo $this->name . "\n"; + } +} + +class Person { + private $name; + + function person($_name, $_address) { + $this->name = new Name($_name); + } + + function getName() { + return $this->name; + } +} + +$person = new Person("John", "New York"); +$person->getName()->display(); + +?> +--EXPECT-- +John diff --git a/phpt/tests/php-5.2.5/tests/classes/destructor_and_echo.phpt b/phpt/tests/php-5.2.5/tests/classes/destructor_and_echo.phpt new file mode 100755 index 0000000000000..0a253593a5e32 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/destructor_and_echo.phpt @@ -0,0 +1,24 @@ +--TEST-- +ZE2 Destructors and echo +--FILE-- + +===DONE=== +--EXPECT-- +Test::__construct +===DONE=== +Test::__destruct diff --git a/phpt/tests/php-5.2.5/tests/classes/destructor_and_exceptions.phpt b/phpt/tests/php-5.2.5/tests/classes/destructor_and_exceptions.phpt new file mode 100755 index 0000000000000..947aa5bb9679b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/destructor_and_exceptions.phpt @@ -0,0 +1,60 @@ +--TEST-- +ZE2 catch exception thrown in destructor +--FILE-- +getMessage() . "\n"; +} + +class FatalException extends Exception +{ + function __construct($what) + { + echo __METHOD__ . "\n"; + $o = new FailClass; + unset($o); + echo "Done: " . __METHOD__ . "\n"; + } +} + +try +{ + throw new FatalException("Damn"); +} +catch(Exception $e) +{ + echo "Caught Exception: " . $e->getMessage() . "\n"; +} +catch(FatalException $e) +{ + echo "Caught FatalException: " . $e->getMessage() . "\n"; +} + +?> +===DONE=== +--EXPECTF-- +FailClass::__destruct +Caught: FailClass +FatalException::__construct +FailClass::__destruct +Caught Exception: FailClass +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/destructor_and_globals.phpt b/phpt/tests/php-5.2.5/tests/classes/destructor_and_globals.phpt new file mode 100755 index 0000000000000..9caf0f1026783 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/destructor_and_globals.phpt @@ -0,0 +1,56 @@ +--TEST-- +ZE2 accessing globals from destructor in shutdown +--FILE-- +id = $test_num++; + } + + public function Show() { + echo 'Id: '.$this->id."\n"; + } + + // try protected here + public function __destruct() { + global $test_cnt; + $test_cnt--; + } + + static public function destroy(&$obj) { + $obj = NULL; + } +} +Show(); +$obj1 = new counter; +$obj1->Show(); +Show(); +$obj2 = new counter; +$obj2->Show(); +Show(); +counter::destroy($obj1); +Show(); +// or uncomment this line and it works +//counter::destroy($obj2); +echo "Done\n"; +?> +--EXPECT-- +Count: 0 +Id: 0 +Count: 1 +Id: 1 +Count: 2 +Count: 1 +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/destructor_and_references.phpt b/phpt/tests/php-5.2.5/tests/classes/destructor_and_references.phpt new file mode 100755 index 0000000000000..6b9b019b62228 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/destructor_and_references.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 Destructing and references +--FILE-- +x = &$o4; + +$r1 = &$o1; + +class once {} + +$o = new once; +echo "Done\n"; +?> +--EXPECT-- +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/destructor_inheritance.phpt b/phpt/tests/php-5.2.5/tests/classes/destructor_inheritance.phpt new file mode 100755 index 0000000000000..f267a740aedc8 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/destructor_inheritance.phpt @@ -0,0 +1,27 @@ +--TEST-- +ZE2 The inherited destructor is called +--FILE-- + +--EXPECT-- +base::__construct +base::__destruct +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/destructor_visibility_001.phpt b/phpt/tests/php-5.2.5/tests/classes/destructor_visibility_001.phpt new file mode 100755 index 0000000000000..7674c512f62a7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/destructor_visibility_001.phpt @@ -0,0 +1,24 @@ +--TEST-- +ZE2 Ensuring destructor visibility +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +Fatal error: Call to private Derived::__destruct() from context '' in %sdestructor_visibility_001.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/destructor_visibility_002.phpt b/phpt/tests/php-5.2.5/tests/classes/destructor_visibility_002.phpt new file mode 100755 index 0000000000000..96cf275a7c9e6 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/destructor_visibility_002.phpt @@ -0,0 +1,22 @@ +--TEST-- +ZE2 Ensuring destructor visibility +--FILE-- + +===DONE=== +--EXPECTF-- +===DONE=== + +Warning: Call to private Derived::__destruct() from context '' during shutdown ignored in Unknown on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/destructor_visibility_003.phpt b/phpt/tests/php-5.2.5/tests/classes/destructor_visibility_003.phpt new file mode 100755 index 0000000000000..4f75166940946 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/destructor_visibility_003.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 Ensuring destructor visibility +--FILE-- + +===DONE=== +--EXPECTF-- +Derived::__destruct +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_001.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_001.phpt new file mode 100644 index 0000000000000..45f97331a5be5 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_001.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 factory objects +--FILE-- +draw(); +ShapeFactoryMethod("Square")->draw(); + +?> +--EXPECT-- +Circle +Square diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_001.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_001.phpt new file mode 100755 index 0000000000000..970c017f4bf5d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_001.phpt @@ -0,0 +1,99 @@ +--TEST-- +ZE2 factory and singleton, test 1 +--FILE-- +x = $x; + } + + static function destroy() { + test::$test = NULL; + } + + protected function __destruct() { + test::$cnt--; + } + + public function get() { + return $this->x; + } + + static public function getX() { + if (test::$test) { + return test::$test->x; + } else { + return NULL; + } + } + + static public function count() { + return test::$cnt; + } +} + +echo "Access static members\n"; +var_dump(test::getX()); +var_dump(test::count()); + +echo "Create x and y\n"; +$x = test::factory(1); +$y = test::factory(2); +var_dump(test::getX()); +var_dump(test::count()); +var_dump($x->get()); +var_dump($y->get()); + +echo "Destruct x\n"; +$x = NULL; +var_dump(test::getX()); +var_dump(test::count()); +var_dump($y->get()); + +echo "Destruct y\n"; +$y = NULL; +var_dump(test::getX()); +var_dump(test::count()); + +echo "Destruct static\n"; +test::destroy(); +var_dump(test::getX()); +var_dump(test::count()); + +echo "Done\n"; +?> +--EXPECT-- +Access static members +NULL +int(0) +Create x and y +int(1) +int(1) +int(1) +int(1) +Destruct x +int(1) +int(1) +int(1) +Destruct y +int(1) +int(1) +Destruct static +NULL +int(0) +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_002.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_002.phpt new file mode 100755 index 0000000000000..4812571497770 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_002.phpt @@ -0,0 +1,98 @@ +--TEST-- +ZE2 factory and singleton, test 2 +--FILE-- +x = $x; + } + + static function destroy() { + test::$test = NULL; + } + + protected function __destruct() { + test::$cnt--; + } + + public function get() { + return $this->x; + } + + static public function getX() { + if (test::$test) { + return test::$test->x; + } else { + return NULL; + } + } + + static public function count() { + return test::$cnt; + } +} + +echo "Access static members\n"; +var_dump(test::getX()); +var_dump(test::count()); + +echo "Create x and y\n"; +$x = test::factory(1); +$y = test::factory(2); +var_dump(test::getX()); +var_dump(test::count()); +var_dump($x->get()); +var_dump($y->get()); + +echo "Destruct x\n"; +$x = NULL; +var_dump(test::getX()); +var_dump(test::count()); +var_dump($y->get()); + +echo "Destruct y\n"; +$y = NULL; +var_dump(test::getX()); +var_dump(test::count()); + +//echo "Destruct static\n"; +//test::destroy(); +//var_dump(test::getX()); +//var_dump(test::count()); + +echo "Done\n"; +?> +--EXPECT-- +Access static members +NULL +int(0) +Create x and y +int(1) +int(1) +int(1) +int(1) +Destruct x +int(1) +int(1) +int(1) +Destruct y +int(1) +int(1) +Done + +Warning: Call to protected test::__destruct() from context '' during shutdown ignored in Unknown on line 0 diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_003.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_003.phpt new file mode 100755 index 0000000000000..3d50a810a6b00 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_003.phpt @@ -0,0 +1,18 @@ +--TEST-- +ZE2 factory and singleton, test 3 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Call to protected test::__construct() from invalid context in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_004.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_004.phpt new file mode 100755 index 0000000000000..14edcb1fc8ffc --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_004.phpt @@ -0,0 +1,18 @@ +--TEST-- +ZE2 factory and singleton, test 4 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Call to private test::__construct() from invalid context in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_005.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_005.phpt new file mode 100755 index 0000000000000..2cd7e5cc997b7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_005.phpt @@ -0,0 +1,19 @@ +--TEST-- +ZE2 factory and singleton, test 5 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Call to protected test::__destruct() from context '' in %sfactory_and_singleton_005.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_006.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_006.phpt new file mode 100755 index 0000000000000..81cf714888b87 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_006.phpt @@ -0,0 +1,20 @@ +--TEST-- +ZE2 factory and singleton, test 6 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Call to private test::__destruct() from context '' in %sfactory_and_singleton_006.php on line %d + diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_007.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_007.phpt new file mode 100755 index 0000000000000..4788dbf08795d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_007.phpt @@ -0,0 +1,20 @@ +--TEST-- +ZE2 factory and singleton, test 7 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Call to protected test::__clone() from context '' %sfactory_and_singleton_007.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_008.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_008.phpt new file mode 100755 index 0000000000000..750b9db340d1e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_008.phpt @@ -0,0 +1,20 @@ +--TEST-- +ZE2 factory and singleton, test 8 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Call to private test::__clone() from context '' %sfactory_and_singleton_008.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_009.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_009.phpt new file mode 100755 index 0000000000000..9134245a170f1 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_009.phpt @@ -0,0 +1,19 @@ +--TEST-- +ZE2 factory and singleton, test 9 +--FILE-- + +===DONE=== +--EXPECTF-- +===DONE=== + +Warning: Call to protected test::__destruct() from context '' during shutdown ignored in Unknown on line 0 diff --git a/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_010.phpt b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_010.phpt new file mode 100755 index 0000000000000..bd7e7e32b71ce --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/factory_and_singleton_010.phpt @@ -0,0 +1,19 @@ +--TEST-- +ZE2 factory and singleton, test 10 +--FILE-- + +===DONE=== +--EXPECTF-- +===DONE=== + +Warning: Call to private test::__destruct() from context '' during shutdown ignored in Unknown on line 0 diff --git a/phpt/tests/php-5.2.5/tests/classes/final.phpt b/phpt/tests/php-5.2.5/tests/classes/final.phpt new file mode 100644 index 0000000000000..f82087749b6fd --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/final.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 A method may be redeclared final +--FILE-- +show(); + +class second extends first { + final function show() { + echo "Call to function second::show()\n"; + } +} + +$t2 = new second(); +$t2->show(); + +echo "Done\n"; +?> +--EXPECTF-- +Call to function first::show() +Call to function second::show() +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/final_abstract.phpt b/phpt/tests/php-5.2.5/tests/classes/final_abstract.phpt new file mode 100644 index 0000000000000..426c852cfc5b2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/final_abstract.phpt @@ -0,0 +1,16 @@ +--TEST-- +ZE2 A final method cannot be abstract +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Fatal error: Cannot use the final modifier on an abstract class member in %s diff --git a/phpt/tests/php-5.2.5/tests/classes/final_ctor1.phpt b/phpt/tests/php-5.2.5/tests/classes/final_ctor1.phpt new file mode 100755 index 0000000000000..ebfa08081e0f5 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/final_ctor1.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 cannot override final __construct +--FILE-- + +--EXPECTF-- + +Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/final_ctor2.phpt b/phpt/tests/php-5.2.5/tests/classes/final_ctor2.phpt new file mode 100755 index 0000000000000..905337b4081ce --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/final_ctor2.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 cannot override final old style ctor +--FILE-- + +--EXPECTF-- + +Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/final_redeclare.phpt b/phpt/tests/php-5.2.5/tests/classes/final_redeclare.phpt new file mode 100644 index 0000000000000..e8f2e6ff09ecb --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/final_redeclare.phpt @@ -0,0 +1,25 @@ +--TEST-- +ZE2 A final method may not be overwritten +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Cannot override final method pass::show() in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/incdec_property_001.phpt b/phpt/tests/php-5.2.5/tests/classes/incdec_property_001.phpt new file mode 100644 index 0000000000000..39bf06f65fba2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/incdec_property_001.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 post increment/decrement property of overloaded object +--FILE-- +real_a = $value; + } + } + + function __get($property) { + if ($property = "a") { + return $this->real_a; + } + } +} + +$obj = new Test; +var_dump($obj->a); +$obj->a++; +var_dump($obj->a); +echo "---Done---\n"; +?> +--EXPECT-- +int(2) +int(3) +---Done--- diff --git a/phpt/tests/php-5.2.5/tests/classes/incdec_property_002.phpt b/phpt/tests/php-5.2.5/tests/classes/incdec_property_002.phpt new file mode 100644 index 0000000000000..fe08625ea8006 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/incdec_property_002.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 post increment/decrement property of overloaded object with assignment +--FILE-- +real_a = $value; + } + } + + function __get($property) { + if ($property = "a") { + return $this->real_a; + } + } +} + +$obj = new Test; +var_dump($obj->a); +$t1 = $obj->a++; +var_dump($obj->a); +echo "---Done---\n"; +?> +--EXPECT-- +int(2) +int(3) +---Done--- diff --git a/phpt/tests/php-5.2.5/tests/classes/incdec_property_003.phpt b/phpt/tests/php-5.2.5/tests/classes/incdec_property_003.phpt new file mode 100644 index 0000000000000..d26277ab8d1c0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/incdec_property_003.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 pre increment/decrement property of overloaded object +--FILE-- +real_a = $value; + } + } + + function __get($property) { + if ($property = "a") { + return $this->real_a; + } + } +} + +$obj = new Test; +var_dump($obj->a); +++$obj->a; +var_dump($obj->a); +echo "---Done---\n"; +?> +--EXPECT-- +int(2) +int(3) +---Done--- diff --git a/phpt/tests/php-5.2.5/tests/classes/incdec_property_004.phpt b/phpt/tests/php-5.2.5/tests/classes/incdec_property_004.phpt new file mode 100644 index 0000000000000..5ccad190b8a08 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/incdec_property_004.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 pre increment/decrement property of overloaded object with assignment +--FILE-- +real_a = $value; + } + } + + function __get($property) { + if ($property = "a") { + return $this->real_a; + } + } +} + +$obj = new Test; +var_dump($obj->a); +$t1 = ++$obj->a; +var_dump($obj->a); +echo "---Done---\n"; +?> +--EXPECT-- +int(2) +int(3) +---Done--- diff --git a/phpt/tests/php-5.2.5/tests/classes/inheritance.phpt b/phpt/tests/php-5.2.5/tests/classes/inheritance.phpt new file mode 100644 index 0000000000000..070ad9147d7c7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/inheritance.phpt @@ -0,0 +1,56 @@ +--TEST-- +Classes inheritance test +--FILE-- +a."\n"; + echo "b = ".$this->b."\n"; + } + function mul() { + return $this->a*$this->b; + } +}; + +class bar extends foo { + public $c; + function display() { /* alternative display function for class bar */ + echo "This is class bar\n"; + echo "a = ".$this->a."\n"; + echo "b = ".$this->b."\n"; + echo "c = ".$this->c."\n"; + } +}; + + +$foo1 = new foo; +$foo1->a = 2; +$foo1->b = 5; +$foo1->display(); +echo $foo1->mul()."\n"; + +echo "-----\n"; + +$bar1 = new bar; +$bar1->a = 4; +$bar1->b = 3; +$bar1->c = 12; +$bar1->display(); +echo $bar1->mul()."\n"; +--EXPECT-- +This is class foo +a = 2 +b = 5 +10 +----- +This is class bar +a = 4 +b = 3 +c = 12 +12 diff --git a/phpt/tests/php-5.2.5/tests/classes/inheritance_002.phpt b/phpt/tests/php-5.2.5/tests/classes/inheritance_002.phpt new file mode 100755 index 0000000000000..6c63b7c8b69d6 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/inheritance_002.phpt @@ -0,0 +1,69 @@ +--TEST-- +ZE2 Constructor precedence +--FILE-- + +--EXPECT-- +### PHP 4 style +string(17) "Child constructor" +string(16) "Base constructor" +### PHP 5 style +string(17) "Child constructor" +string(16) "Base constructor" +### Mixed style 1 +string(17) "Child constructor" +string(16) "Base constructor" +### Mixed style 2 +string(17) "Child constructor" +string(16) "Base constructor" diff --git a/phpt/tests/php-5.2.5/tests/classes/inheritance_003.phpt b/phpt/tests/php-5.2.5/tests/classes/inheritance_003.phpt new file mode 100755 index 0000000000000..a22e5cce58f58 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/inheritance_003.phpt @@ -0,0 +1,21 @@ +--TEST-- +ZE2 method inheritance without interfaces +--FILE-- + +===DONE=== +--EXPECTF-- + +Strict Standards: Declaration of B::f() should be compatible with that of A::f() in %sinheritance_003.php on line %d +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/inheritance_004.phpt b/phpt/tests/php-5.2.5/tests/classes/inheritance_004.phpt new file mode 100755 index 0000000000000..9c81970cc2d0c --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/inheritance_004.phpt @@ -0,0 +1,21 @@ +--TEST-- +ZE2 method inheritance without interfaces +--FILE-- + +===DONE=== +--EXPECTF-- + +Strict Standards: Declaration of B::f() should be compatible with that of A::f() in %sinheritance_004.php on line %d +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_and_extends.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_and_extends.phpt new file mode 100755 index 0000000000000..f9040ae4a9c04 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_and_extends.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 a class cannot extend an interface +--SKIPIF-- + +--FILE-- +show(); + +?> +===DONE=== +--EXPECTF-- +Fatal error: Class Tester cannot extend from interface Test in %sinterface_and_extends.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_class.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_class.phpt new file mode 100644 index 0000000000000..22520de1f9c81 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_class.phpt @@ -0,0 +1,14 @@ +--TEST-- +ZE2 A class can only implement interfaces +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: derived cannot implement base - it is not an interface in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_doubled.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_doubled.phpt new file mode 100644 index 0000000000000..e1dd31fd4d8de --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_doubled.phpt @@ -0,0 +1,201 @@ +--TEST-- +ZE2 An interface extends base interfaces +--SKIPIF-- + +--FILE-- +test('if_a'); +echo $t->test('if_b'); +echo $t->test('if_c'); +echo $t->test('if_d'); +echo $t->test('if_e'); + +echo "class_b\n"; + +class class_b extends base implements if_a, if_b { + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} +} + +$t = new class_b(); +echo $t->test('if_a'); +echo $t->test('if_b'); +echo $t->test('if_c'); +echo $t->test('if_d'); +echo $t->test('if_e'); + +echo "class_c\n"; + +class class_c extends base implements if_c { + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} +} + +$t = new class_c(); +echo $t->test('if_a'); +echo $t->test('if_b'); +echo $t->test('if_c'); +echo $t->test('if_d'); +echo $t->test('if_e'); + +echo "class_d\n"; + +class class_d extends base implements if_d{ + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} +} + +$t = new class_d(); +echo $t->test('if_a'); +echo $t->test('if_b'); +echo $t->test('if_c'); +echo $t->test('if_d'); +echo $t->test('if_e'); + +echo "class_e\n"; + +class class_e extends base implements if_a, if_b, if_c, if_d { + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} +} + +$t = new class_e(); +echo $t->test('if_a'); +echo $t->test('if_b'); +echo $t->test('if_c'); +echo $t->test('if_d'); +echo $t->test('if_e'); + +echo "class_f\n"; + +class class_f extends base implements if_e { + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} +} + +$t = new class_f(); +echo $t->test('if_a'); +echo $t->test('if_b'); +echo $t->test('if_c'); +echo $t->test('if_d'); +echo $t->test('if_e'); + +echo "class_g\n"; + +class class_g extends base implements if_f { + function f_a() {} + function f_b() {} + function f_c() {} + function f_d() {} + function f_e() {} +} + +$t = new class_g(); +echo $t->test('if_a'); +echo $t->test('if_b'); +echo $t->test('if_c'); +echo $t->test('if_d'); +echo $t->test('if_e'); + +?> +===DONE=== +--EXPECTF-- +class_a +is_a(class_a, if_a) yes +is_a(class_a, if_b) no +is_a(class_a, if_c) no +is_a(class_a, if_d) no +is_a(class_a, if_e) no +class_b +is_a(class_b, if_a) yes +is_a(class_b, if_b) yes +is_a(class_b, if_c) no +is_a(class_b, if_d) no +is_a(class_b, if_e) no +class_c +is_a(class_c, if_a) yes +is_a(class_c, if_b) yes +is_a(class_c, if_c) yes +is_a(class_c, if_d) no +is_a(class_c, if_e) no +class_d +is_a(class_d, if_a) yes +is_a(class_d, if_b) yes +is_a(class_d, if_c) no +is_a(class_d, if_d) yes +is_a(class_d, if_e) no +class_e +is_a(class_e, if_a) yes +is_a(class_e, if_b) yes +is_a(class_e, if_c) yes +is_a(class_e, if_d) yes +is_a(class_e, if_e) no +class_f +is_a(class_f, if_a) no +is_a(class_f, if_b) no +is_a(class_f, if_c) no +is_a(class_f, if_d) no +is_a(class_f, if_e) yes +class_g +is_a(class_g, if_a) yes +is_a(class_g, if_b) yes +is_a(class_g, if_c) yes +is_a(class_g, if_d) yes +is_a(class_g, if_e) no +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_implemented.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_implemented.phpt new file mode 100644 index 0000000000000..e33a4da002d01 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_implemented.phpt @@ -0,0 +1,103 @@ +--TEST-- +ZE2 An interface is inherited +--SKIPIF-- + +--FILE-- +_is_a('base'); + echo $this->_is_a('derived_a'); + echo $this->_is_a('derived_b'); + echo $this->_is_a('derived_c'); + echo $this->_is_a('derived_d'); + echo $this->_is_a('if_a'); + echo $this->_is_a('if_b'); + echo "\n"; + } +} + +class derived_a extends base implements if_a { + function f_a() {} +} + +class derived_b extends base implements if_a, if_b { + function f_a() {} + function f_b() {} +} + +class derived_c extends derived_a implements if_b { + function f_b() {} +} + +class derived_d extends derived_c { +} + +$t = new base(); +$t->test(); + +$t = new derived_a(); +$t->test(); + +$t = new derived_b(); +$t->test(); + +$t = new derived_c(); +$t->test(); + +$t = new derived_d(); +$t->test(); + +?> +--EXPECTF-- +is_a(base, base) = yes +is_a(base, derived_a) = no +is_a(base, derived_b) = no +is_a(base, derived_c) = no +is_a(base, derived_d) = no +is_a(base, if_a) = no +is_a(base, if_b) = no + +is_a(derived_a, base) = yes +is_a(derived_a, derived_a) = yes +is_a(derived_a, derived_b) = no +is_a(derived_a, derived_c) = no +is_a(derived_a, derived_d) = no +is_a(derived_a, if_a) = yes +is_a(derived_a, if_b) = no + +is_a(derived_b, base) = yes +is_a(derived_b, derived_a) = no +is_a(derived_b, derived_b) = yes +is_a(derived_b, derived_c) = no +is_a(derived_b, derived_d) = no +is_a(derived_b, if_a) = yes +is_a(derived_b, if_b) = yes + +is_a(derived_c, base) = yes +is_a(derived_c, derived_a) = yes +is_a(derived_c, derived_b) = no +is_a(derived_c, derived_c) = yes +is_a(derived_c, derived_d) = no +is_a(derived_c, if_a) = yes +is_a(derived_c, if_b) = yes + +is_a(derived_d, base) = yes +is_a(derived_d, derived_a) = yes +is_a(derived_d, derived_b) = no +is_a(derived_d, derived_c) = yes +is_a(derived_d, derived_d) = yes +is_a(derived_d, if_a) = yes +is_a(derived_d, if_b) = yes diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_instantiate.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_instantiate.phpt new file mode 100644 index 0000000000000..61c4e6b95ba0a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_instantiate.phpt @@ -0,0 +1,16 @@ +--TEST-- +ZE2 An interface cannot be instantiated +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Cannot instantiate interface if_a in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_member.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_member.phpt new file mode 100644 index 0000000000000..329c0728b5415 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_member.phpt @@ -0,0 +1,13 @@ +--TEST-- +ZE2 An interface cannot have properties +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Interfaces may not include member variables in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_method.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_method.phpt new file mode 100644 index 0000000000000..3570b359289bd --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_method.phpt @@ -0,0 +1,15 @@ +--TEST-- +ZE2 An interface method must be abstract +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Fatal error: Interface function if_a::err() cannot contain body %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_method_final.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_method_final.phpt new file mode 100644 index 0000000000000..01e599c5b9e8f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_method_final.phpt @@ -0,0 +1,15 @@ +--TEST-- +ZE2 An interface method cannot be final +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Fatal error: Cannot use the final modifier on an abstract class member in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_method_private.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_method_private.phpt new file mode 100644 index 0000000000000..aa46a033a6f7b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_method_private.phpt @@ -0,0 +1,15 @@ +--TEST-- +ZE2 An interface method cannot be private +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Fatal error: Access type for interface method if_a::err() must be omitted in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_must_be_implemented.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_must_be_implemented.phpt new file mode 100644 index 0000000000000..a4d79704e1ef3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_must_be_implemented.phpt @@ -0,0 +1,17 @@ +--TEST-- +ZE2 An interface must be implemented +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Class derived_a contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (if_a::f_a) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/interface_optional_arg.phpt b/phpt/tests/php-5.2.5/tests/classes/interface_optional_arg.phpt new file mode 100755 index 0000000000000..ae4ad2988fb79 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interface_optional_arg.phpt @@ -0,0 +1,25 @@ +--TEST-- +ZE2 An interface method allows additional default arguments +--FILE-- +bar(); + +?> +--EXPECT-- +foo + diff --git a/phpt/tests/php-5.2.5/tests/classes/interfaces_001.phpt b/phpt/tests/php-5.2.5/tests/classes/interfaces_001.phpt new file mode 100644 index 0000000000000..9037ac24dcfee --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interfaces_001.phpt @@ -0,0 +1,24 @@ +--TEST-- +ZE2 interfaces +--FILE-- +foo; + } +} + +$foo = new Exception_foo; +echo $foo->getMessage() . "\n"; + +?> +--EXPECT-- +foo + diff --git a/phpt/tests/php-5.2.5/tests/classes/interfaces_002.phpt b/phpt/tests/php-5.2.5/tests/classes/interfaces_002.phpt new file mode 100644 index 0000000000000..d26b5349bf511 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interfaces_002.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 interface with an unimplemented method +--SKIPIF-- + +--FILE-- +foo; + } +} + +// this should die -- Exception class must be abstract... +$foo = new Exception_foo; +echo "Message: " . $foo->getMessage() . "\n"; + +?> +===DONE=== +--EXPECTF-- + +Fatal error: Class Exception_foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Throwable::getErrno) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/interfaces_003.phpt b/phpt/tests/php-5.2.5/tests/classes/interfaces_003.phpt new file mode 100755 index 0000000000000..f9ab92bb151a1 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/interfaces_003.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 interface and __construct +--FILE-- + +===DONE=== +--EXPECTF-- + +Catchable fatal error: Argument 1 passed to MyTestClass::__construct() must be an instance of MyObject, none given, called in %sinterfaces_003.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/iterators_001.phpt b/phpt/tests/php-5.2.5/tests/classes/iterators_001.phpt new file mode 100755 index 0000000000000..02e36107822b2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/iterators_001.phpt @@ -0,0 +1,200 @@ +--TEST-- +ZE2 iterators and foreach +--SKIPIF-- + +--FILE-- +num = 0; + $this->obj = $obj; + } + function rewind() { + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } +} + +class c implements IteratorAggregate { + + public $max = 3; + + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } +} + +echo "===Array===\n"; + +$a = array(0,1,2); +foreach($a as $v) { + echo "array:$v\n"; +} + +echo "===Manual===\n"; +$t = new c(); +for ($iter = $t->getIterator(); $iter->valid(); $iter->next()) { + echo $iter->current() . "\n"; +} + +echo "===foreach/std===\n"; +foreach($t as $v) { + echo "object:$v\n"; +} + +echo "===foreach/rec===\n"; +foreach($t as $v) { + foreach($t as $w) { + echo "double:$v:$w\n"; + } +} + +echo "===foreach/key===\n"; +foreach($t as $i => $v) { + echo "object:$i=>$v\n"; +} + +print "Done\n"; +exit(0); +?> +--EXPECT-- +===Array=== +array:0 +array:1 +array:2 +===Manual=== +c::getIterator +c_iter::__construct +c_iter::valid = true +c_iter::current +0 +c_iter::next +c_iter::valid = true +c_iter::current +1 +c_iter::next +c_iter::valid = true +c_iter::current +2 +c_iter::next +c_iter::valid = false +===foreach/std=== +c::getIterator +c_iter::__construct +c_iter::valid = true +c_iter::current +object:0 +c_iter::next +c_iter::valid = true +c_iter::current +object:1 +c_iter::next +c_iter::valid = true +c_iter::current +object:2 +c_iter::next +c_iter::valid = false +===foreach/rec=== +c::getIterator +c_iter::__construct +c_iter::valid = true +c_iter::current +c::getIterator +c_iter::__construct +c_iter::valid = true +c_iter::current +double:0:0 +c_iter::next +c_iter::valid = true +c_iter::current +double:0:1 +c_iter::next +c_iter::valid = true +c_iter::current +double:0:2 +c_iter::next +c_iter::valid = false +c_iter::next +c_iter::valid = true +c_iter::current +c::getIterator +c_iter::__construct +c_iter::valid = true +c_iter::current +double:1:0 +c_iter::next +c_iter::valid = true +c_iter::current +double:1:1 +c_iter::next +c_iter::valid = true +c_iter::current +double:1:2 +c_iter::next +c_iter::valid = false +c_iter::next +c_iter::valid = true +c_iter::current +c::getIterator +c_iter::__construct +c_iter::valid = true +c_iter::current +double:2:0 +c_iter::next +c_iter::valid = true +c_iter::current +double:2:1 +c_iter::next +c_iter::valid = true +c_iter::current +double:2:2 +c_iter::next +c_iter::valid = false +c_iter::next +c_iter::valid = false +===foreach/key=== +c::getIterator +c_iter::__construct +c_iter::valid = true +c_iter::current +c_iter::key +object:1st=>0 +c_iter::next +c_iter::valid = true +c_iter::current +c_iter::key +object:2nd=>1 +c_iter::next +c_iter::valid = true +c_iter::current +c_iter::key +object:3rd=>2 +c_iter::next +c_iter::valid = false +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/iterators_002.phpt b/phpt/tests/php-5.2.5/tests/classes/iterators_002.phpt new file mode 100755 index 0000000000000..4a58be0324842 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/iterators_002.phpt @@ -0,0 +1,113 @@ +--TEST-- +ZE2 iterators and break +--SKIPIF-- + +--FILE-- +obj = $obj; + } + function rewind() { + echo __METHOD__ . "\n"; + $this->num = 0; + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } + function __destruct() { + echo __METHOD__ . "\n"; + } +} + +class c implements IteratorAggregate { + + public $max = 3; + + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } + function __destruct() { + echo __METHOD__ . "\n"; + } +} + +$t = new c(); + +foreach($t as $k => $v) { + foreach($t as $w) { + echo "double:$v:$w\n"; + break; + } +} + +unset($t); + +print "Done\n"; +?> +--EXPECT-- +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +c_iter::key +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +double:0:0 +c_iter::__destruct +c_iter::next +c_iter::valid = true +c_iter::current +c_iter::key +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +double:1:0 +c_iter::__destruct +c_iter::next +c_iter::valid = true +c_iter::current +c_iter::key +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +double:2:0 +c_iter::__destruct +c_iter::next +c_iter::valid = false +c_iter::__destruct +c::__destruct +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/iterators_003.phpt b/phpt/tests/php-5.2.5/tests/classes/iterators_003.phpt new file mode 100755 index 0000000000000..42695db6ba23d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/iterators_003.phpt @@ -0,0 +1,115 @@ +--TEST-- +ZE2 iterators and break +--SKIPIF-- + +--FILE-- +obj = $obj; + } + function rewind() { + echo __METHOD__ . "\n"; + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + return $this->num; + } +} + +class c implements IteratorAggregate { + + public $max = 4; + + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } +} + +$t = new c(); + +foreach($t as $v) { + if ($v == 0) { + echo "continue outer\n"; + continue; + } + foreach($t as $w) { + if ($w == 1) { + echo "continue inner\n"; + continue; + } + if ($w == 2) { + echo "break inner\n"; + break; + } + echo "double:$v:$w\n"; + } + if ($v == 2) { + echo "break outer\n"; + break; + } +} + +print "Done\n"; +?> +--EXPECT-- +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +continue outer +c_iter::next +c_iter::valid = true +c_iter::current +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +double:1:0 +c_iter::next +c_iter::valid = true +c_iter::current +continue inner +c_iter::next +c_iter::valid = true +c_iter::current +break inner +c_iter::next +c_iter::valid = true +c_iter::current +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +double:2:0 +c_iter::next +c_iter::valid = true +c_iter::current +continue inner +c_iter::next +c_iter::valid = true +c_iter::current +break inner +break outer +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/iterators_004.phpt b/phpt/tests/php-5.2.5/tests/classes/iterators_004.phpt new file mode 100755 index 0000000000000..df76c7fe31015 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/iterators_004.phpt @@ -0,0 +1,59 @@ +--TEST-- +ZE2 iterators must be implemented +--FILE-- +num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function valid() { + echo __METHOD__ . "\n"; + return $this->num < $this->max; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } +} + +$obj = new c2(); + +foreach($obj as $v => $w) { + echo "object:$v=>$w\n"; +} + +print "Done\n"; +?> +--EXPECTF-- +1st try +2nd try +object:max=>3 +object:num=>0 +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/iterators_005.phpt b/phpt/tests/php-5.2.5/tests/classes/iterators_005.phpt new file mode 100755 index 0000000000000..005deb92a27b3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/iterators_005.phpt @@ -0,0 +1,19 @@ +--TEST-- +ZE2 iterators cannot implement Traversable alone +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Class test must implement interface Traversable as part of either Iterator or IteratorAggregate in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/iterators_006.phpt b/phpt/tests/php-5.2.5/tests/classes/iterators_006.phpt new file mode 100644 index 0000000000000..b2ebfb3a75aaf --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/iterators_006.phpt @@ -0,0 +1,87 @@ +--TEST-- +ZE2 iterators and array wrapping +--SKIPIF-- + +--FILE-- +array = array('foo', 'bar', 'baz'); + } + + function rewind() { + reset($this->array); + $this->next(); + } + + function valid() { + return $this->key !== NULL; + } + + function key() { + return $this->key; + } + + function current() { + return $this->current; + } + + function next() { + list($this->key, $this->current) = each($this->array); +// list($key, $current) = each($this->array); +// $this->key = $key; +// $this->current = $current; + } +} + +class a implements IteratorAggregate { + + public function getIterator() { + return new ai(); + } +} + +$array = new a(); + +foreach ($array as $property => $value) { + print "$property: $value\n"; +} + +#$array = $array->getIterator(); +#$array->rewind(); +#$array->valid(); +#var_dump($array->key()); +#var_dump($array->current()); +echo "===2nd===\n"; + +$array = new ai(); + +foreach ($array as $property => $value) { + print "$property: $value\n"; +} + +echo "===3rd===\n"; + +foreach ($array as $property => $value) { + print "$property: $value\n"; +} + +?> +===DONE=== +--EXPECT-- +0: foo +1: bar +2: baz +===2nd=== +0: foo +1: bar +2: baz +===3rd=== +0: foo +1: bar +2: baz +===DONE=== \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/iterators_007.phpt b/phpt/tests/php-5.2.5/tests/classes/iterators_007.phpt new file mode 100755 index 0000000000000..f2638b31dcc92 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/iterators_007.phpt @@ -0,0 +1,43 @@ +--TEST-- +ZE2 iterators and exceptions +--FILE-- +x == 0) throw new Exception(__METHOD__); reset($this->arr); } + public function current() { if ($this->x == 1) throw new Exception(__METHOD__); return current($this->arr); } + public function key() { if ($this->x == 2) throw new Exception(__METHOD__); return key($this->arr); } + public function next() { if ($this->x == 3) throw new Exception(__METHOD__); next($this->arr); } + public function valid() { if ($this->x == 4) throw new Exception(__METHOD__); return (key($this->arr) !== NULL); } +} + +$t = new Test(); + +while($t->x < 5) +{ + try + { + foreach($t as $k => $v) + { + echo "Current\n"; + } + } + catch(Exception $e) + { + echo "Caught in " . $e->getMessage() . "()\n"; + } + $t->x++; +} +?> +===DONE=== +--EXPECT-- +Caught in Test::rewind() +Caught in Test::current() +Caught in Test::key() +Current +Caught in Test::next() +Caught in Test::valid() +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/object_reference_001.phpt b/phpt/tests/php-5.2.5/tests/classes/object_reference_001.phpt new file mode 100644 index 0000000000000..bb4757f246ea9 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/object_reference_001.phpt @@ -0,0 +1,25 @@ +--TEST-- +ZE2 object references +--FILE-- +name = "I'm Foo!\n"; + } +} + +$foo = new Foo; +echo $foo->name; +$bar = $foo; +$bar->name = "I'm Bar!\n"; + +// In ZE1, we would expect "I'm Foo!" +echo $foo->name; + +?> +--EXPECT-- +I'm Foo! +I'm Bar! diff --git a/phpt/tests/php-5.2.5/tests/classes/private_001.phpt b/phpt/tests/php-5.2.5/tests/classes/private_001.phpt new file mode 100644 index 0000000000000..310b9c64343ba --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_001.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 A private method can only be called inside the class +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Call show() + +Fatal error: Call to private method pass::show() from context '' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/private_002.phpt b/phpt/tests/php-5.2.5/tests/classes/private_002.phpt new file mode 100644 index 0000000000000..258fd3a17d8fc --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_002.phpt @@ -0,0 +1,35 @@ +--TEST-- +ZE2 A private method cannot be called in another class +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Call pass::show() +Call fail::show() + +Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/private_003.phpt b/phpt/tests/php-5.2.5/tests/classes/private_003.phpt new file mode 100644 index 0000000000000..716efbc8c781f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_003.phpt @@ -0,0 +1,36 @@ +--TEST-- +ZE2 A private method cannot be called in a derived class +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Call show() + +Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/private_003b.phpt b/phpt/tests/php-5.2.5/tests/classes/private_003b.phpt new file mode 100644 index 0000000000000..780b2e6b4cb87 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_003b.phpt @@ -0,0 +1,37 @@ +--TEST-- +ZE2 A private method cannot be called in a derived class +--SKIPIF-- + +--FILE-- +show(); + } +} + +class fail extends pass { + public function ok() { + $this->good(); + } + + public function not_ok() { + $this->show(); + } +} + +$t = new fail(); +$t->ok(); +$t->not_ok(); // calling a private function + +echo "Done\n"; // shouldn't be displayed +?> +--EXPECTF-- +Call show() + +Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/private_004.phpt b/phpt/tests/php-5.2.5/tests/classes/private_004.phpt new file mode 100644 index 0000000000000..027434ab87f57 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_004.phpt @@ -0,0 +1,32 @@ +--TEST-- +ZE2 A private method cannot be called in a derived class +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Call show() + +Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/private_004b.phpt b/phpt/tests/php-5.2.5/tests/classes/private_004b.phpt new file mode 100644 index 0000000000000..ea3fe610d37e7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_004b.phpt @@ -0,0 +1,35 @@ +--TEST-- +ZE2 A private method cannot be called in a derived class +--SKIPIF-- + +--FILE-- +show(); + } +} + +class fail extends pass { + function do_show() { + $this->show(); + } +} + +$t = new pass(); +$t->do_show(); + +$t2 = new fail(); +$t2->do_show(); + +echo "Done\n"; // shouldn't be displayed +?> +--EXPECTF-- +Call show() + +Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/private_005.phpt b/phpt/tests/php-5.2.5/tests/classes/private_005.phpt new file mode 100644 index 0000000000000..49b2bee3badba --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_005.phpt @@ -0,0 +1,32 @@ +--TEST-- +ZE2 A private method cannot be called in a derived class +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Call show() + +Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/private_005b.phpt b/phpt/tests/php-5.2.5/tests/classes/private_005b.phpt new file mode 100644 index 0000000000000..ea3fe610d37e7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_005b.phpt @@ -0,0 +1,35 @@ +--TEST-- +ZE2 A private method cannot be called in a derived class +--SKIPIF-- + +--FILE-- +show(); + } +} + +class fail extends pass { + function do_show() { + $this->show(); + } +} + +$t = new pass(); +$t->do_show(); + +$t2 = new fail(); +$t2->do_show(); + +echo "Done\n"; // shouldn't be displayed +?> +--EXPECTF-- +Call show() + +Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/private_006.phpt b/phpt/tests/php-5.2.5/tests/classes/private_006.phpt new file mode 100644 index 0000000000000..a51c9e70dce30 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_006.phpt @@ -0,0 +1,39 @@ +--TEST-- +ZE2 A private method can be overwritten in a second derived class +--FILE-- + +--EXPECTF-- +Call show() +Call show() +Call show() +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/private_006b.phpt b/phpt/tests/php-5.2.5/tests/classes/private_006b.phpt new file mode 100644 index 0000000000000..22c3cfd80bf1f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_006b.phpt @@ -0,0 +1,39 @@ +--TEST-- +ZE2 A private method can be overwritten in a second derived class +--FILE-- +show(); + } +} + +$t1 = new first(); +$t1->do_show(); + +class second extends first { +} + +//$t2 = new second(); +//$t2->do_show(); + +class third extends second { + private function show() { + echo "Call show()\n"; + } +} + +$t3 = new third(); +$t3->do_show(); + +echo "Done\n"; +?> +--EXPECTF-- +Call show() +Call show() +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/private_007.phpt b/phpt/tests/php-5.2.5/tests/classes/private_007.phpt new file mode 100644 index 0000000000000..f773cc8ed271f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_007.phpt @@ -0,0 +1,28 @@ +--TEST-- +ZE2 A derived class does not know about privates of ancestors +--FILE-- + +--EXPECTF-- +Bar::priv() +Foo::priv() +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/private_007b.phpt b/phpt/tests/php-5.2.5/tests/classes/private_007b.phpt new file mode 100644 index 0000000000000..cbd0e756de7e0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_007b.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 A derived class does not know about privates of ancestors +--FILE-- +priv(); + } + private function priv() { + echo "Bar::priv()\n"; + } +} +class Foo extends Bar { + public function priv() { + echo "Foo::priv()\n"; + } +} + +$obj = new Foo(); +$obj->pub(); +$obj->priv(); + +echo "Done\n"; +?> +--EXPECTF-- +Bar::priv() +Foo::priv() +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/private_members.phpt b/phpt/tests/php-5.2.5/tests/classes/private_members.phpt new file mode 100755 index 0000000000000..674cd72d7e617 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_members.phpt @@ -0,0 +1,101 @@ +--TEST-- +ZE2 A private member is +--FILE-- +member = 'base::member'; + $this->test(); + echo __METHOD__ . "(end)\n"; + } + + function test() + { + echo __METHOD__ . "\n"; + print_r($this); + } +} + +class derived extends base +{ + public $member = 'derived::member (default)'; + + function __construct() + { + echo __METHOD__ . "(begin)\n"; + parent::__construct(); + parent::test(); + $this->test(); + $this->member = 'derived::member'; + echo __METHOD__ . "(end)\n"; + } + + function test() + { + parent::test(); + echo __METHOD__ . "\n"; + print_r($this); + } +} + +$t = new derived; +$t->test(); +unset($t); + +echo "Done\n"; + +?> +--EXPECTF-- +derived::__construct(begin) +base::__construct(begin) +base::test +derived Object +( + [member] => derived::member (default) + [member:private] => base::member +) +derived::test +derived Object +( + [member] => derived::member (default) + [member:private] => base::member +) +base::__construct(end) +base::test +derived Object +( + [member] => derived::member (default) + [member:private] => base::member +) +base::test +derived Object +( + [member] => derived::member (default) + [member:private] => base::member +) +derived::test +derived Object +( + [member] => derived::member (default) + [member:private] => base::member +) +derived::__construct(end) +base::test +derived Object +( + [member] => derived::member + [member:private] => base::member +) +derived::test +derived Object +( + [member] => derived::member + [member:private] => base::member +) +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/private_redeclare.phpt b/phpt/tests/php-5.2.5/tests/classes/private_redeclare.phpt new file mode 100755 index 0000000000000..e3061f1136fac --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/private_redeclare.phpt @@ -0,0 +1,38 @@ +--TEST-- +ZE2 A derived class does not know anything about inherited private methods +--FILE-- +show(); + } +} + +$t = new base(); +$t->test(); + +class derived extends base { + function show() { + echo "derived\n"; + } + function test() { + echo "test\n"; + $this->show(); + parent::test(); + parent::show(); + } +} + +$t = new derived(); +$t->test(); +?> +--EXPECTF-- +base +test +derived +base + +Fatal error: Call to private method base::show() from context 'derived' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/protected_001.phpt b/phpt/tests/php-5.2.5/tests/classes/protected_001.phpt new file mode 100644 index 0000000000000..19872c6f16ca1 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/protected_001.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 A protected method can only be called inside the class +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Call fail() + +Fatal error: Call to protected method pass::fail() from context '' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/protected_001b.phpt b/phpt/tests/php-5.2.5/tests/classes/protected_001b.phpt new file mode 100644 index 0000000000000..4d24a926ea6b3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/protected_001b.phpt @@ -0,0 +1,27 @@ +--TEST-- +ZE2 A protected method can only be called inside the class +--SKIPIF-- + +--FILE-- +fail(); + } +} + +$t = new pass(); +$t->good(); +$t->fail();// must fail because we are calling from outside of class pass + +echo "Done\n"; // shouldn't be displayed +?> +--EXPECTF-- +Call fail() + +Fatal error: Call to protected method pass::fail() from context '' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/protected_002.phpt b/phpt/tests/php-5.2.5/tests/classes/protected_002.phpt new file mode 100644 index 0000000000000..f26ef9c495f89 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/protected_002.phpt @@ -0,0 +1,35 @@ +--TEST-- +ZE2 A protected method cannot be called in another class +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Call pass::show() +Call fail::show() + +Fatal error: Call to protected method pass::show() from context 'fail' in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/serialize_001.phpt b/phpt/tests/php-5.2.5/tests/classes/serialize_001.phpt new file mode 100755 index 0000000000000..b7182aca6285c --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/serialize_001.phpt @@ -0,0 +1,79 @@ +--TEST-- +ZE2 Serializable +--FILE-- +data = $data; + } + + function serialize() + { + echo __METHOD__ . "({$this->data})\n"; + return $this->data; + } + + function unserialize($serialized) + { + echo __METHOD__ . "($serialized)\n"; + $this->data = $serialized; + var_dump($this); + } +} + +$tests = array('String', NULL, 42, false); + +foreach($tests as $data) +{ + try + { + echo "==========\n"; + var_dump($data); + $ser = serialize(new Test($data)); + var_dump(unserialize($ser)); + } + catch(Exception $e) + { + echo 'Exception: ' . $e->getMessage() . "\n"; + } +} + +?> +===DONE=== + +--EXPECT-- +========== +string(6) "String" +Test::__construct(String) +Test::serialize(String) +Test::unserialize(String) +object(Test)#1 (1) { + ["data"]=> + string(6) "String" +} +object(Test)#1 (1) { + ["data"]=> + string(6) "String" +} +========== +NULL +Test::__construct() +Test::serialize() +NULL +========== +int(42) +Test::__construct(42) +Test::serialize(42) +Exception: Test::serialize() must return a string or NULL +========== +bool(false) +Test::__construct() +Test::serialize() +Exception: Test::serialize() must return a string or NULL +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/singleton_001.phpt b/phpt/tests/php-5.2.5/tests/classes/singleton_001.phpt new file mode 100644 index 0000000000000..45174158bec11 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/singleton_001.phpt @@ -0,0 +1,35 @@ +--TEST-- +ZE2 singleton +--FILE-- +counter; + echo "\n"; + } +} + + +class SingletonCounter { + private static $m_instance = NULL; + + static function Instance() { + if (self::$m_instance == NULL) { + self::$m_instance = new Counter(); + } + return self::$m_instance; + } +} + +SingletonCounter::Instance()->increment_and_print(); +SingletonCounter::Instance()->increment_and_print(); +SingletonCounter::Instance()->increment_and_print(); + +?> +--EXPECT-- +1 +2 +3 diff --git a/phpt/tests/php-5.2.5/tests/classes/static_mix_1.phpt b/phpt/tests/php-5.2.5/tests/classes/static_mix_1.phpt new file mode 100644 index 0000000000000..ecc9c01a2820d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/static_mix_1.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 You cannot overload a static method with a non static method +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Cannot make static method pass::show() non static in class fail in %s on line %d \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/static_mix_2.phpt b/phpt/tests/php-5.2.5/tests/classes/static_mix_2.phpt new file mode 100644 index 0000000000000..bbdaedf50ae1d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/static_mix_2.phpt @@ -0,0 +1,27 @@ +--TEST-- +ZE2 You cannot overload a non static method with a static method +--SKIPIF-- + +--FILE-- +show(); +fail::show(); + +echo "Done\n"; // shouldn't be displayed +?> +--EXPECTF-- +Fatal error: Cannot make non static method pass::show() static in class fail in %s on line %d \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/classes/static_properties_001.phpt b/phpt/tests/php-5.2.5/tests/classes/static_properties_001.phpt new file mode 100755 index 0000000000000..e14d87d7abfea --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/static_properties_001.phpt @@ -0,0 +1,25 @@ +--TEST-- +ZE2 Initializing static properties to arrays +--FILE-- + +--EXPECTF-- +array(0) { +} +array(1) { + [0]=> + int(1) +} +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/static_this.phpt b/phpt/tests/php-5.2.5/tests/classes/static_this.phpt new file mode 100755 index 0000000000000..91b02871950a7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/static_this.phpt @@ -0,0 +1,39 @@ +--TEST-- +ZE2 $this can be an argument to a static function +--FILE-- +Test1(); + } + + static function Test1() + { + var_dump($this); + } + + static function Test2($this) + { + var_dump($this); + } +} + +$obj = new TestClass; +TestClass::Test2(new stdClass); + +?> +===DONE=== +--EXPECTF-- + +Notice: Undefined variable: this in %sstatic_this.php on line %d +NULL + +Notice: Undefined variable: this in %sstatic_this.php on line %d +NULL +object(stdClass)#%d (0) { +} +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/classes/this.phpt b/phpt/tests/php-5.2.5/tests/classes/this.phpt new file mode 100755 index 0000000000000..1d9c6236e41d8 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/this.phpt @@ -0,0 +1,54 @@ +--TEST-- +ZE2 $this cannot be exchanged +--SKIPIF-- + +--FILE-- +prop; + print $other->prop; + } + + function indirect($other) + { + echo __METHOD__ . "\n"; + $this = $other; + $result = $this = $other; + print $result->prop; + print $this->prop; + } + + function retrieve(&$other) + { + echo __METHOD__ . "\n"; + $other = $this; + } +} + +$object = new Foo; +$object->prop = "Hello\n"; + +$other = new Foo; +$other->prop = "World\n"; + +$object->replace($other); +$object->indirect($other); + +print $object->prop; // still shows 'Hello' + +$object->retrieve($other); +print $other->prop; // shows 'Hello' + +?> +===DONE=== +--EXPECTF-- +Fatal error: Cannot re-assign $this in %sthis.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/tostring_001.phpt b/phpt/tests/php-5.2.5/tests/classes/tostring_001.phpt new file mode 100755 index 0000000000000..53144ca207177 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/tostring_001.phpt @@ -0,0 +1,130 @@ +--TEST-- +ZE2 __toString() +--FILE-- +__toString()] = "ERROR"; +echo $ar[$o]; + +echo "====test8====\n"; +var_dump(trim($o)); +var_dump(trim((string)$o)); + +echo "====test9====\n"; +echo sprintf("%s", $o); + +echo "====test10====\n"; +$o = new test3; +var_dump($o); +echo $o; + +?> +====DONE==== +--EXPECTF-- +====test1==== +test1 Object +( +) +string(54) "Object of class test1 could not be converted to string" +string(0) "" +object(test1)#%d (0) { +} +====test2==== +test2 Object +( +) +test2::__toString() +Converted +object(test2)#%d (0) { +} +====test3==== +test2::__toString() +Converted +====test4==== +test2::__toString() +string:Converted +====test5==== +test2::__toString() +1Converted +1test2::__toString() +Converted +====test6==== +test2::__toString() +test2::__toString() +Converted +Converted +test2::__toString() +Converted +test2::__toString() +Converted +====test7==== +test2::__toString() +string(19) "Illegal offset type" +====test8==== +test2::__toString() +string(9) "Converted" +test2::__toString() +string(9) "Converted" +====test9==== +test2::__toString() +Converted +====test10==== +object(test3)#%d (0) { +} +test3::__toString() +string(53) "Method test3::__toString() must return a string value" +====DONE==== diff --git a/phpt/tests/php-5.2.5/tests/classes/tostring_002.phpt b/phpt/tests/php-5.2.5/tests/classes/tostring_002.phpt new file mode 100755 index 0000000000000..eb1bea54475d9 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/tostring_002.phpt @@ -0,0 +1,29 @@ +--TEST-- +ZE2 __toString() in __destruct +--FILE-- + +====DONE==== +--EXPECTF-- +Hello +====DONE==== +Hello diff --git a/phpt/tests/php-5.2.5/tests/classes/tostring_003.phpt b/phpt/tests/php-5.2.5/tests/classes/tostring_003.phpt new file mode 100755 index 0000000000000..8815bd9407ff7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/tostring_003.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 __toString() in __destruct/exception +--FILE-- +getMessage()); +} + +?> +====DONE==== +--EXPECTF-- +Fatal error: Method Test::__toString() must not throw an exception in %stostring_003.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/type_hinting_001.phpt b/phpt/tests/php-5.2.5/tests/classes/type_hinting_001.phpt new file mode 100644 index 0000000000000..f55dd53bf4c93 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/type_hinting_001.phpt @@ -0,0 +1,38 @@ +--TEST-- +ZE2 class type hinting +--SKIPIF-- + +--FILE-- +a($b); +$a->b($b); + +?> +--EXPECTF-- + +Catchable fatal error: Argument 1 passed to FooBar::a() must implement interface Foo, instance of Blort given, called in %s on line 27 and defined in %s on line 12 diff --git a/phpt/tests/php-5.2.5/tests/classes/type_hinting_002.phpt b/phpt/tests/php-5.2.5/tests/classes/type_hinting_002.phpt new file mode 100755 index 0000000000000..7c685bfdba3e3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/type_hinting_002.phpt @@ -0,0 +1,16 @@ +--TEST-- +ZE2 class type hinting non existing class +--SKIPIF-- + +--FILE-- +a($o); +?> +--EXPECTF-- +Catchable fatal error: Argument 1 passed to Foo::a() must be an instance of NonExisting, instance of Foo given, called in %s on line %d and defined in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/type_hinting_003.phpt b/phpt/tests/php-5.2.5/tests/classes/type_hinting_003.phpt new file mode 100755 index 0000000000000..431d66eabc263 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/type_hinting_003.phpt @@ -0,0 +1,60 @@ +--TEST-- +ZE2 class type hinting with arrays +--FILE-- + +--EXPECTF-- +Test::f1() +array(1) { + [0]=> + int(42) +} +Test::f2() +NULL +Test::f2() +NULL +Test::f3() +array(0) { +} +Test::f4() +array(1) { + [0]=> + int(25) +} + +Catchable fatal error: Argument 1 passed to Test::f1() must be an array, integer given, called in %stype_hinting_003.php on line %d and defined in %stype_hinting_003.php on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_000a.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_000a.phpt new file mode 100644 index 0000000000000..2524494ff8e05 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_000a.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Access level to fail::f0() must be public (as in class same) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_000b.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_000b.phpt new file mode 100644 index 0000000000000..9305467323fd3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_000b.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Access level to fail::f0() must be public (as in class same) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_000c.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_000c.phpt new file mode 100644 index 0000000000000..c651b05d7532a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_000c.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--FILE-- + +--EXPECTF-- +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_001a.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_001a.phpt new file mode 100644 index 0000000000000..ebd1cc34de2c2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_001a.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Access level to fail::f1() must be public (as in class same) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_001b.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_001b.phpt new file mode 100644 index 0000000000000..e61078ede5bae --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_001b.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Access level to fail::f1() must be public (as in class same) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_001c.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_001c.phpt new file mode 100644 index 0000000000000..a9a589669502b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_001c.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--FILE-- + +--EXPECTF-- +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_002a.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_002a.phpt new file mode 100644 index 0000000000000..6c88d204d241f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_002a.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Access level to fail::f2() must be public (as in class same) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_002b.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_002b.phpt new file mode 100644 index 0000000000000..71f47c395499f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_002b.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Access level to fail::f2() must be public (as in class same) in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_002c.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_002c.phpt new file mode 100644 index 0000000000000..308c9057dbd8f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_002c.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--FILE-- + +--EXPECTF-- +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_003a.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_003a.phpt new file mode 100644 index 0000000000000..176cc4a90656d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_003a.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--FILE-- + +--EXPECTF-- +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_003b.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_003b.phpt new file mode 100644 index 0000000000000..fcfdbe3c5543d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_003b.phpt @@ -0,0 +1,33 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Fatal error: Access level to fail::f3() must be protected (as in class same) or weaker in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_003c.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_003c.phpt new file mode 100644 index 0000000000000..27e2bc2bf5dd8 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_003c.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--FILE-- + +--EXPECTF-- +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_004a.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_004a.phpt new file mode 100644 index 0000000000000..717f97199957e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_004a.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--FILE-- + +--EXPECTF-- +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_004b.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_004b.phpt new file mode 100644 index 0000000000000..1ede33450a65c --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_004b.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--FILE-- + +--EXPECTF-- +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_004c.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_004c.phpt new file mode 100644 index 0000000000000..e4f94a3567706 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_004c.phpt @@ -0,0 +1,31 @@ +--TEST-- +ZE2 A redeclared method must have the same or higher visibility +--FILE-- + +--EXPECTF-- +Done diff --git a/phpt/tests/php-5.2.5/tests/classes/visibility_005.phpt b/phpt/tests/php-5.2.5/tests/classes/visibility_005.phpt new file mode 100755 index 0000000000000..ef5daa11bc42b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/classes/visibility_005.phpt @@ -0,0 +1,59 @@ +--TEST-- +ZE2 foreach and property visibility +--FILE-- +$v) { + echo "$k=>$v\n"; + } + } +} + +class derived extends base +{ +} + +$o = new base; +$o->d = 4; +echo "===base::function===\n"; +$o->f(); +echo "===base,foreach===\n"; +foreach($o as $k=>$v) { + echo "$k=>$v\n"; +} + +$o = new derived; +$o->d = 4; +echo "===derived::function===\n"; +$o->f(); +echo "===derived,foreach===\n"; +foreach($o as $k=>$v) { + echo "$k=>$v\n"; +} + +?> +--EXPECT-- +===base::function=== +a=>1 +b=>2 +c=>3 +d=>4 +===base,foreach=== +a=>1 +d=>4 +===derived::function=== +a=>1 +b=>2 +c=>3 +d=>4 +===derived,foreach=== +a=>1 +d=>4 diff --git a/phpt/tests/php-5.2.5/tests/foo b/phpt/tests/php-5.2.5/tests/foo new file mode 100644 index 0000000000000..125c655b0fe11 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/foo @@ -0,0 +1,5 @@ +a +b +@c@ +d +e diff --git a/phpt/tests/php-5.2.5/tests/foo2 b/phpt/tests/php-5.2.5/tests/foo2 new file mode 100644 index 0000000000000..4cdd41e3dcffa --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/foo2 @@ -0,0 +1,3 @@ +b(12,13)."\n"; diff --git a/phpt/tests/php-5.2.5/tests/foo3 b/phpt/tests/php-5.2.5/tests/foo3 new file mode 100644 index 0000000000000..08681b98c2d7a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/foo3 @@ -0,0 +1,43 @@ +print_string($a->hello_world())."\n"; +print $b->print_string($b->hello_world())."\n"; +$a->foo = 5; +print $a->foo; +print $a->foo(); diff --git a/phpt/tests/php-5.2.5/tests/foo4 b/phpt/tests/php-5.2.5/tests/foo4 new file mode 100644 index 0000000000000..29df84d0e2323 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/foo4 @@ -0,0 +1,41 @@ +asd = 5; +print $b->asd; diff --git a/phpt/tests/php-5.2.5/tests/func/001.phpt b/phpt/tests/php-5.2.5/tests/func/001.phpt new file mode 100644 index 0000000000000..d08040679b9de --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/func/001.phpt @@ -0,0 +1,6 @@ +--TEST-- +Strlen() function test +--FILE-- + +--EXPECT-- +6 diff --git a/phpt/tests/php-5.2.5/tests/func/002.phpt b/phpt/tests/php-5.2.5/tests/func/002.phpt new file mode 100644 index 0000000000000..645dcbd6fc5dd --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/func/002.phpt @@ -0,0 +1,17 @@ +--TEST-- +Static variables in functions +--FILE-- +5) continue; + echo "$k\n"; + } +} + +andi (3,10); diff --git a/phpt/tests/php-5.2.5/tests/func/004.phpt b/phpt/tests/php-5.2.5/tests/func/004.phpt new file mode 100644 index 0000000000000..1434297b0de55 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/func/004.phpt @@ -0,0 +1,65 @@ +--TEST-- +General function test +--FILE-- + +--EXPECT-- + +Before function declaration... +After function declaration... +Calling function for the first time... +---- +In function, printing the string "This works!" 10 times +0) This works! +1) This works! +2) This works! +3) This works! +4) This works! +5) This works! +6) This works! +7) This works! +8) This works! +9) This works! +Done with function... +----- +Returned from function call... +Calling the function for the second time... +---- +In function, printing the string "This like, really works and stuff..." 3 times +0) This like, really works and stuff... +1) This like, really works and stuff... +2) This like, really works and stuff... +Done with function... +----- +Returned from function call... +This is some other function, to ensure more than just one function works fine... diff --git a/phpt/tests/php-5.2.5/tests/func/005.phpt b/phpt/tests/php-5.2.5/tests/func/005.phpt new file mode 100644 index 0000000000000..c4215feb4988e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/func/005.phpt @@ -0,0 +1,19 @@ +--TEST-- +Testing register_shutdown_function() +--FILE-- + +--EXPECT-- +foo() will be called on shutdown... +foo + diff --git a/phpt/tests/php-5.2.5/tests/func/005a.phpt b/phpt/tests/php-5.2.5/tests/func/005a.phpt new file mode 100644 index 0000000000000..f7843e10a329b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/func/005a.phpt @@ -0,0 +1,28 @@ +--TEST-- +Testing register_shutdown_function() with timeout. (Bug: #21513) +--FILE-- + +--EXPECT-- +Start +Shutdown diff --git a/phpt/tests/php-5.2.5/tests/func/006.phpt b/phpt/tests/php-5.2.5/tests/func/006.phpt new file mode 100644 index 0000000000000..077b6f873cb13 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/func/006.phpt @@ -0,0 +1,26 @@ +--TEST-- +Output buffering tests +--INI-- +output_buffering=0 +output_handler= +zlib.output_compression=0 +zlib.output_handler= +--FILE-- + +--EXPECT-- +string(2) "2B" +string(2) "1A" diff --git a/phpt/tests/php-5.2.5/tests/func/007.phpt b/phpt/tests/php-5.2.5/tests/func/007.phpt new file mode 100644 index 0000000000000..73aae2e649283 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/func/007.phpt @@ -0,0 +1,22 @@ +--TEST-- +INI functions test +--FILE-- + +--EXPECT-- +ini_set_works +ini_restore_works diff --git a/phpt/tests/php-5.2.5/tests/func/008.phpt b/phpt/tests/php-5.2.5/tests/func/008.phpt new file mode 100644 index 0000000000000..48098e13302e7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/func/008.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test for buffering in core functions with implicit flush off +--INI-- +implicit_flush=0 +--FILE-- + +--EXPECT-- +'foo1' + +'foo2' diff --git a/phpt/tests/php-5.2.5/tests/func/009.phpt b/phpt/tests/php-5.2.5/tests/func/009.phpt new file mode 100644 index 0000000000000..05b40e8e67eb7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/func/009.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test for buffering in core functions with implicit flush on +--INI-- +implicit_flush=1 +--FILE-- + +--EXPECT-- +'foo1' + +'foo2' diff --git a/phpt/tests/php-5.2.5/tests/lang/001.phpt b/phpt/tests/php-5.2.5/tests/lang/001.phpt new file mode 100644 index 0000000000000..71df3184781dd --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/001.phpt @@ -0,0 +1,6 @@ +--TEST-- +Simple If condition test +--FILE-- +0) { echo "Yes"; } ?> +--EXPECT-- +Yes diff --git a/phpt/tests/php-5.2.5/tests/lang/002.phpt b/phpt/tests/php-5.2.5/tests/lang/002.phpt new file mode 100644 index 0000000000000..ec14d01c3f74a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/002.phpt @@ -0,0 +1,12 @@ +--TEST-- +Simple While Loop Test +--FILE-- + +--EXPECT-- +123456789 diff --git a/phpt/tests/php-5.2.5/tests/lang/003.phpt b/phpt/tests/php-5.2.5/tests/lang/003.phpt new file mode 100644 index 0000000000000..7049db90470fa --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/003.phpt @@ -0,0 +1,19 @@ +--TEST-- +Simple Switch Test +--FILE-- + +--EXPECT-- +good diff --git a/phpt/tests/php-5.2.5/tests/lang/004.phpt b/phpt/tests/php-5.2.5/tests/lang/004.phpt new file mode 100644 index 0000000000000..be8ebf4155233 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/004.phpt @@ -0,0 +1,13 @@ +--TEST-- +Simple If/Else Test +--FILE-- + +--EXPECT-- +good diff --git a/phpt/tests/php-5.2.5/tests/lang/005.phpt b/phpt/tests/php-5.2.5/tests/lang/005.phpt new file mode 100644 index 0000000000000..404a7cbbf6d05 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/005.phpt @@ -0,0 +1,16 @@ +--TEST-- +Simple If/ElseIf/Else Test +--FILE-- + +--EXPECT-- +good diff --git a/phpt/tests/php-5.2.5/tests/lang/006.phpt b/phpt/tests/php-5.2.5/tests/lang/006.phpt new file mode 100644 index 0000000000000..2a2db013aba8d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/006.phpt @@ -0,0 +1,23 @@ +--TEST-- +Nested If/ElseIf/Else Test +--FILE-- + +--EXPECT-- +good diff --git a/phpt/tests/php-5.2.5/tests/lang/007.phpt b/phpt/tests/php-5.2.5/tests/lang/007.phpt new file mode 100644 index 0000000000000..4576d4efa5323 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/007.phpt @@ -0,0 +1,27 @@ +--TEST-- +Function call with global and static variables +--FILE-- + +--EXPECT-- +1 5 2 2 10 5 2 5 3 2 10 5 3 5 4 2 diff --git a/phpt/tests/php-5.2.5/tests/lang/008.phpt b/phpt/tests/php-5.2.5/tests/lang/008.phpt new file mode 100644 index 0000000000000..d335e6f13521e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/008.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing recursive function +--FILE-- + +--EXPECT-- +1 2 3 4 5 6 7 8 9 diff --git a/phpt/tests/php-5.2.5/tests/lang/009.phpt b/phpt/tests/php-5.2.5/tests/lang/009.phpt new file mode 100644 index 0000000000000..ea2aa9294dd22 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/009.phpt @@ -0,0 +1,11 @@ +--TEST-- +Testing function parameter passing +--FILE-- + +--EXPECT-- +3 diff --git a/phpt/tests/php-5.2.5/tests/lang/010.phpt b/phpt/tests/php-5.2.5/tests/lang/010.phpt new file mode 100644 index 0000000000000..603abe34d5613 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/010.phpt @@ -0,0 +1,13 @@ +--TEST-- +Testing function parameter passing with a return value +--FILE-- + +--EXPECT-- +2 diff --git a/phpt/tests/php-5.2.5/tests/lang/011.phpt b/phpt/tests/php-5.2.5/tests/lang/011.phpt new file mode 100644 index 0000000000000..771ef7c129a7a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/011.phpt @@ -0,0 +1,23 @@ +--TEST-- +Testing nested functions +--FILE-- + +--EXPECT-- +4 Hello 4 diff --git a/phpt/tests/php-5.2.5/tests/lang/012.phpt b/phpt/tests/php-5.2.5/tests/lang/012.phpt new file mode 100644 index 0000000000000..117137a29b57b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/012.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing stack after early function return +--FILE-- + +--EXPECT-- +HelloHello diff --git a/phpt/tests/php-5.2.5/tests/lang/013.phpt b/phpt/tests/php-5.2.5/tests/lang/013.phpt new file mode 100644 index 0000000000000..be84cdcb8fa77 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/013.phpt @@ -0,0 +1,10 @@ +--TEST-- +Testing eval function +--FILE-- + +--EXPECT-- +Hello diff --git a/phpt/tests/php-5.2.5/tests/lang/014.phpt b/phpt/tests/php-5.2.5/tests/lang/014.phpt new file mode 100644 index 0000000000000..f0033b2f77aff --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/014.phpt @@ -0,0 +1,13 @@ +--TEST-- +Testing eval function inside user-defined function +--FILE-- + +--EXPECT-- +Hello diff --git a/phpt/tests/php-5.2.5/tests/lang/015.inc b/phpt/tests/php-5.2.5/tests/lang/015.inc new file mode 100755 index 0000000000000..d436a7bb140d2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/015.inc @@ -0,0 +1,3 @@ + diff --git a/phpt/tests/php-5.2.5/tests/lang/015.phpt b/phpt/tests/php-5.2.5/tests/lang/015.phpt new file mode 100644 index 0000000000000..952e7f19d74f1 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/015.phpt @@ -0,0 +1,8 @@ +--TEST-- +Testing include +--FILE-- + +--EXPECT-- +Hello diff --git a/phpt/tests/php-5.2.5/tests/lang/016.inc b/phpt/tests/php-5.2.5/tests/lang/016.inc new file mode 100755 index 0000000000000..b73333f7b0200 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/016.inc @@ -0,0 +1,5 @@ + diff --git a/phpt/tests/php-5.2.5/tests/lang/016.phpt b/phpt/tests/php-5.2.5/tests/lang/016.phpt new file mode 100644 index 0000000000000..dbaa908b81adc --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/016.phpt @@ -0,0 +1,9 @@ +--TEST-- +Testing user-defined function in included file +--FILE-- + +--EXPECT-- +Hello diff --git a/phpt/tests/php-5.2.5/tests/lang/017.phpt b/phpt/tests/php-5.2.5/tests/lang/017.phpt new file mode 100644 index 0000000000000..fb909648209dc --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/017.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing user-defined function falling out of an If into another +--FILE-- + +--EXPECT-- +1 diff --git a/phpt/tests/php-5.2.5/tests/lang/018.phpt b/phpt/tests/php-5.2.5/tests/lang/018.phpt new file mode 100644 index 0000000000000..6ee6ed0faa3bf --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/018.phpt @@ -0,0 +1,13 @@ +--TEST-- +eval() test +--FILE-- + +--EXPECT-- +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 diff --git a/phpt/tests/php-5.2.5/tests/lang/021.phpt b/phpt/tests/php-5.2.5/tests/lang/021.phpt new file mode 100644 index 0000000000000..aff45b6be39a3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/021.phpt @@ -0,0 +1,42 @@ +--TEST-- +Switch test 2 +--FILE-- + +--EXPECT-- +i=0 +In branch 0 +i=1 +In branch 1 +i=2 +In branch 2 +i=3 +In branch 3 +hi diff --git a/phpt/tests/php-5.2.5/tests/lang/022.phpt b/phpt/tests/php-5.2.5/tests/lang/022.phpt new file mode 100644 index 0000000000000..dddc6c2955354 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/022.phpt @@ -0,0 +1,63 @@ +--TEST-- +Switch test 3 +--FILE-- + +--EXPECT-- +zero +one +2 +3 +4 +5 +6 +7 +8 +9 +zero +one +2 +3 +4 +5 +6 +7 +8 +9 +zero +one +2 +3 +4 +5 +6 +7 +8 +9 diff --git a/phpt/tests/php-5.2.5/tests/lang/023-1.inc b/phpt/tests/php-5.2.5/tests/lang/023-1.inc new file mode 100755 index 0000000000000..8d52e844c96cd --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/023-1.inc @@ -0,0 +1,356 @@ + + + + +*** Testing assignments and variable aliasing: ***
    + +This should read "blah": \n"; ?> +This should read "this is nifty": \n"; ?> +*************************************************
    + +*** Testing integer operators ***
    + +Correct result - 8:
    +Correct result - 8:
    +Correct result - 2:
    +Correct result - -2:
    +Correct result - 15:
    +Correct result - 15:
    +Correct result - 2:
    +Correct result - 3:
    +*********************************
    + +*** Testing real operators ***
    + +Correct result - 8:
    +Correct result - 8:
    +Correct result - 2:
    +Correct result - -2:
    +Correct result - 15:
    +Correct result - 15:
    +Correct result - 2:
    +Correct result - 3:
    +*********************************
    + +*** Testing if/elseif/else control ***
    + +\n"; +} elseif ($a == "5") { + echo "This "." works
    \n"; + $a = 6; + if ("andi" == ($test = "andi")) { + echo "this_still_works
    \n"; + } elseif (1) { + echo "should_not_print
    \n"; + } else { + echo "should_not_print
    \n"; + } + if (44 == 43) { + echo "should_not_print
    \n"; + } else { + echo "should_print
    \n"; + } +} elseif ($a == 6) { + echo "this "."broken
    \n"; + if (0) { + echo "this_should_not_print
    \n"; + } else { + echo "TestingDanglingElse_This_Should_not_print
    \n"; + } +} else { + echo "This "."does "." not"." work
    \n"; +} +?> + + +*** Seriously nested if's test ***
    +** spelling correction by kluzz ** +\n"; +if (0) { /* this code is not supposed to be executed */ + echo "hmm, this shouldn't be displayed #1
    \n"; + $j++; + if (1) { + $i ++= + $j; + if (0) { + $j = ++$i; + if (1) { + $j *= $i; + echo "damn, this shouldn't be displayed
    \n"; + } else { + $j /= $i; + ++$j; + echo "this shouldn't be displayed either
    \n"; + } + } elseif (1) { + $i++; $j++; + echo "this isn't supposed to be displayed
    \n"; + } + } elseif (0) { + $i++; + echo "this definitely shouldn't be displayed
    \n"; + } else { + --$j; + echo "and this too shouldn't be displayed
    \n"; + while ($j>0) { + $j--; + } + } +} elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */ + $i = ++$j; + echo "hmm, this shouldn't be displayed #2
    \n"; + if (1) { + $j = ++$i; + if (0) { + $j = $i*2+$j*($i++); + if (1) { + $i++; + echo "damn, this shouldn't be displayed
    \n"; + } else { + $j++; + echo "this shouldn't be displayed either
    \n"; + } + } else if (1) { + ++$j; + echo "this isn't supposed to be displayed
    \n"; + } + } elseif (0) { + $j++; + echo "this definitely shouldn't be displayed
    \n"; + } else { + $i++; + echo "and this too shouldn't be displayed
    \n"; + } +} else { + $j=$i++; /* this should set $i to 1, but shouldn't change $j (it's assigned $i's previous values, zero) */ + echo "this should be displayed. should be: \$i=1, \$j=0. is: \$i=$i, \$j=$j
    \n"; + if (1) { + $j += ++$i; /* ++$i --> $i==2, $j += 2 --> $j==2 */ + if (0) { + $j += 40; + if (1) { + $i += 50; + echo "damn, this shouldn't be displayed
    \n"; + } else { + $j += 20; + echo "this shouldn't be displayed either
    \n"; + } + } else if (1) { + $j *= $i; /* $j *= 2 --> $j == 4 */ + echo "this is supposed to be displayed. should be: \$i=2, \$j=4. is: \$i=$i, \$j=$j
    \n"; + echo "3 loop iterations should follow:
    \n"; + while ($i<=$j) { + echo $i++." $j
    \n"; + } + } + } elseif (0) { + echo "this definitely shouldn't be displayed
    \n"; + } else { + echo "and this too shouldn't be displayed
    \n"; + } + echo "**********************************
    \n"; +} +?> + +*** C-style else-if's ***
    +\n"; + } else if ($a++) { + echo "This shouldn't be displayed either
    \n"; + } else if (--$a) { + echo "No, this neither
    \n"; + } else if (++$a) { + echo "This should be displayed
    \n"; + } else { + echo "This shouldn't be displayed at all
    \n"; + } +?> +*************************
    + +*** WHILE tests ***
    +$j) { + echo "$i is greater than $j
    \n"; + } else if ($i==$j) { + echo "$i equals $j
    \n"; + } else { + echo "$i is smaller than $j
    \n"; + } + $i++; +} +?> +*******************
    + + +*** Nested WHILEs ***
    +\n"; + +$i=0; +while ($i<$arr_len) { + $j=0; + while ($j<$arr_len) { + $k=0; + while ($k<$arr_len) { + echo "\${test$i$j}[$k] = ".${"test$i$j"}[$k]."
    \n"; + $k++; + } + $j++; + } + $i++; +} +?> +*********************
    + +*** hash test... ***
    +\n"; +} +*/ +echo "commented out..."; +?> + +**************************
    + +*** Hash resizing test ***
    + 0) { + $a = $a . 'a'; + echo "$a
    \n"; + $resize[$a] = $i; + $i--; +} +$i = 10; +$a = 'b'; +while ($i > 0) { + $a = $a . 'a'; + echo "$a
    \n"; + echo $resize[$a]."
    \n"; + $i--; +} +?> +**************************
    + + +*** break/continue test ***
    +\n"; +while ($i<5) { + if ($i>2) { + break; + } + $j=0; + echo "\$j should go from 3 to 4, and \$q should go from 3 to 4
    \n"; + while ($j<5) { + if ($j<=2) { + $j++; + continue; + } + echo " \$j=$j
    \n"; + for ($q=0; $q<=10; $q++) { + if ($q<3) { + continue; + } + if ($q>4) { + break; + } + echo " \$q=$q
    \n"; + } + $j++; + } + $j=0; + echo "\$j should go from 0 to 2
    \n"; + while ($j<5) { + if ($j>2) { + $k=0; + echo "\$k should go from 0 to 2
    \n"; + while ($k<5) { + if ($k>2) { + break 2; + } + echo " \$k=$k
    \n"; + $k++; + } + } + echo " \$j=$j
    \n"; + $j++; + } + echo "\$i=$i
    \n"; + $i++; +} +?> +***********************
    + +*** Nested file include test ***
    + +********************************
    + +\n"; # testing some PHP style comment... +} +?> diff --git a/phpt/tests/php-5.2.5/tests/lang/023-2.inc b/phpt/tests/php-5.2.5/tests/lang/023-2.inc new file mode 100755 index 0000000000000..6dd1e730f1674 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/023-2.inc @@ -0,0 +1,6 @@ + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. + + + diff --git a/phpt/tests/php-5.2.5/tests/lang/023.phpt b/phpt/tests/php-5.2.5/tests/lang/023.phpt new file mode 100644 index 0000000000000..331308d01dc42 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/023.phpt @@ -0,0 +1,256 @@ +--TEST-- +Regression test +--INI-- +date.timezone=UTC +--FILE-- +PHP Regression Test + +0) { + $days = $time_left/(24*3600); + $time_left -= $days*24*3600; + $hours = $time_left/3600; + $time_left -= $hours*3600; + $minutes = $time_left/60; + echo "Limor Ullmann is getting married on ".($wedding_date=date("l, F dS, Y",$wedding_timestamp)).",\nwhich is $days days, $hours hours and $minutes minutes from now.\n"; + echo "Her hashed wedding date is $wedding_date.\n"; +} else { + echo "Limor Ullmann is now Limor Baruch :I\n"; +} +?> +--EXPECT-- +PHP Regression Test + + + + +*** Testing assignments and variable aliasing: ***
    +This should read "blah": blah
    +This should read "this is nifty": this is nifty
    +*************************************************
    + +*** Testing integer operators ***
    +Correct result - 8: 8
    +Correct result - 8: 8
    +Correct result - 2: 2
    +Correct result - -2: -2
    +Correct result - 15: 15
    +Correct result - 15: 15
    +Correct result - 2: 2
    +Correct result - 3: 3
    +*********************************
    + +*** Testing real operators ***
    +Correct result - 8: 8
    +Correct result - 8: 8
    +Correct result - 2: 2
    +Correct result - -2: -2
    +Correct result - 15: 15
    +Correct result - 15: 15
    +Correct result - 2: 2
    +Correct result - 3: 3
    +*********************************
    + +*** Testing if/elseif/else control ***
    + +This works
    +this_still_works
    +should_print
    + + +*** Seriously nested if's test ***
    +** spelling correction by kluzz ** +Only two lines of text should follow:
    +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0
    +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4
    +3 loop iterations should follow:
    +2 4
    +3 4
    +4 4
    +**********************************
    + +*** C-style else-if's ***
    +This should be displayed
    +*************************
    + +*** WHILE tests ***
    +0 is smaller than 20
    +1 is smaller than 20
    +2 is smaller than 20
    +3 is smaller than 20
    +4 is smaller than 20
    +5 is smaller than 20
    +6 is smaller than 20
    +7 is smaller than 20
    +8 is smaller than 20
    +9 is smaller than 20
    +10 is smaller than 20
    +11 is smaller than 20
    +12 is smaller than 20
    +13 is smaller than 20
    +14 is smaller than 20
    +15 is smaller than 20
    +16 is smaller than 20
    +17 is smaller than 20
    +18 is smaller than 20
    +19 is smaller than 20
    +20 equals 20
    +21 is greater than 20
    +22 is greater than 20
    +23 is greater than 20
    +24 is greater than 20
    +25 is greater than 20
    +26 is greater than 20
    +27 is greater than 20
    +28 is greater than 20
    +29 is greater than 20
    +30 is greater than 20
    +31 is greater than 20
    +32 is greater than 20
    +33 is greater than 20
    +34 is greater than 20
    +35 is greater than 20
    +36 is greater than 20
    +37 is greater than 20
    +38 is greater than 20
    +39 is greater than 20
    +*******************
    + + +*** Nested WHILEs ***
    +Each array variable should be equal to the sum of its indices:
    +${test00}[0] = 0
    +${test00}[1] = 1
    +${test00}[2] = 2
    +${test01}[0] = 1
    +${test01}[1] = 2
    +${test01}[2] = 3
    +${test02}[0] = 2
    +${test02}[1] = 3
    +${test02}[2] = 4
    +${test10}[0] = 1
    +${test10}[1] = 2
    +${test10}[2] = 3
    +${test11}[0] = 2
    +${test11}[1] = 3
    +${test11}[2] = 4
    +${test12}[0] = 3
    +${test12}[1] = 4
    +${test12}[2] = 5
    +${test20}[0] = 2
    +${test20}[1] = 3
    +${test20}[2] = 4
    +${test21}[0] = 3
    +${test21}[1] = 4
    +${test21}[2] = 5
    +${test22}[0] = 4
    +${test22}[1] = 5
    +${test22}[2] = 6
    +*********************
    + +*** hash test... ***
    +commented out... +**************************
    + +*** Hash resizing test ***
    +ba
    +baa
    +baaa
    +baaaa
    +baaaaa
    +baaaaaa
    +baaaaaaa
    +baaaaaaaa
    +baaaaaaaaa
    +baaaaaaaaaa
    +ba
    +10
    +baa
    +9
    +baaa
    +8
    +baaaa
    +7
    +baaaaa
    +6
    +baaaaaa
    +5
    +baaaaaaa
    +4
    +baaaaaaaa
    +3
    +baaaaaaaaa
    +2
    +baaaaaaaaaa
    +1
    +**************************
    + + +*** break/continue test ***
    +$i should go from 0 to 2
    +$j should go from 3 to 4, and $q should go from 3 to 4
    + $j=3
    + $q=3
    + $q=4
    + $j=4
    + $q=3
    + $q=4
    +$j should go from 0 to 2
    + $j=0
    + $j=1
    + $j=2
    +$k should go from 0 to 2
    + $k=0
    + $k=1
    + $k=2
    +$i=0
    +$j should go from 3 to 4, and $q should go from 3 to 4
    + $j=3
    + $q=3
    + $q=4
    + $j=4
    + $q=3
    + $q=4
    +$j should go from 0 to 2
    + $j=0
    + $j=1
    + $j=2
    +$k should go from 0 to 2
    + $k=0
    + $k=1
    + $k=2
    +$i=1
    +$j should go from 3 to 4, and $q should go from 3 to 4
    + $j=3
    + $q=3
    + $q=4
    + $j=4
    + $q=3
    + $q=4
    +$j should go from 0 to 2
    + $j=0
    + $j=1
    + $j=2
    +$k should go from 0 to 2
    + $k=0
    + $k=1
    + $k=2
    +$i=2
    +***********************
    + +*** Nested file include test ***
    + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +********************************
    + +Tests completed.
    +Limor Ullmann is now Limor Baruch :I diff --git a/phpt/tests/php-5.2.5/tests/lang/024.phpt b/phpt/tests/php-5.2.5/tests/lang/024.phpt new file mode 100644 index 0000000000000..954b58fa052a0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/024.phpt @@ -0,0 +1,11623 @@ +--TEST-- +Looped regression test (may take a while) +--FILE-- + + + +*** Testing assignments and variable aliasing: *** + +This should read "blah": +This should read "this is nifty": +************************************************* + +*** Testing integer operators *** + +Correct result - 8: + +Correct result - 8: + +Correct result - 2: + +Correct result - -2: + +Correct result - 15: + +Correct result - 15: + +Correct result - 2: + +Correct result - 3: + +********************************* + +*** Testing real operators *** + +Correct result - 8: + +Correct result - 8: + +Correct result - 2: + +Correct result - -2: + +Correct result - 15: + +Correct result - 15: + +Correct result - 2: + +Correct result - 3: + +********************************* + +*** Testing if/elseif/else control *** + + + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +0) { + $j--; + } + } +} elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */ + $i = ++$j; + echo "hmm, this shouldn't be displayed #2\n"; + if (1) { + $j = ++$i; + if (0) { + $j = $i*2+$j*($i++); + if (1) { + $i++; + echo "damn, this shouldn't be displayed\n"; + } else { + $j++; + echo "this shouldn't be displayed either\n"; + } + } else if (1) { + ++$j; + echo "this isn't supposed to be displayed\n"; + } + } elseif (0) { + $j++; + echo "this definitely shouldn't be displayed\n"; + } else { + $i++; + echo "and this too shouldn't be displayed\n"; + } +} else { + $j=$i++; /* this should set $i to 1, but shouldn't change $j (it's assigned $i's previous values, zero) */ + echo "this should be displayed. should be: \$i=1, \$j=0. is: \$i=$i, \$j=$j\n"; + if (1) { + $j += ++$i; /* ++$i --> $i==2, $j += 2 --> $j==2 */ + if (0) { + $j += 40; + if (1) { + $i += 50; + echo "damn, this shouldn't be displayed\n"; + } else { + $j += 20; + echo "this shouldn't be displayed either\n"; + } + } else if (1) { + $j *= $i; /* $j *= 2 --> $j == 4 */ + echo "this is supposed to be displayed. should be: \$i=2, \$j=4. is: \$i=$i, \$j=$j\n"; + echo "3 loop iterations should follow:\n"; + while ($i<=$j) { + echo $i++." $j\n"; + } + } + } elseif (0) { + echo "this definitely shouldn't be displayed\n"; + } else { + echo "and this too shouldn't be displayed\n"; + } + echo "**********************************\n"; +} +?> + +*** C-style else-if's *** + +************************* + +*** WHILE tests *** +$j) { + echo "$i is greater than $j\n"; + } else if ($i==$j) { + echo "$i equals $j\n"; + } else { + echo "$i is smaller than $j\n"; + } + $i++; +} +?> +******************* + + +*** Nested WHILEs *** + +********************* + +*** hash test... *** + + +************************** + +*** Hash resizing test *** + 0) { + $a = $a . "a"; + echo "$a\n"; + $resize[$a] = $i; + $i--; +} +$i = 10; +$a = "b"; +while ($i > 0) { + $a = $a . "a"; + echo "$a\n"; + echo $resize[$a]."\n"; + $i--; +} +?> +************************** + + +*** break/continue test *** +2) { + break; + } + $j=0; + echo "\$j should go from 3 to 4, and \$q should go from 3 to 4\n"; + while ($j<5) { + if ($j<=2) { + $j++; + continue; + } + echo " \$j=$j\n"; + for ($q=0; $q<=10; $q++) { + if ($q<3) { + continue; + } + if ($q>4) { + break; + } + echo " \$q=$q\n"; + } + $j++; + } + $j=0; + echo "\$j should go from 0 to 2\n"; + while ($j<5) { + if ($j>2) { + $k=0; + echo "\$k should go from 0 to 2\n"; + while ($k<5) { + if ($k>2) { + break 2; + } + echo " \$k=$k\n"; + $k++; + } + } + echo " \$j=$j\n"; + $j++; + } + echo "\$i=$i\n"; + $i++; +} +?> +*********************** + +*** Nested file include test *** + +******************************** + + +--EXPECT-- + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. + + +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** + +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 + +******************************** + +Tests completed. diff --git a/phpt/tests/php-5.2.5/tests/lang/025.phpt b/phpt/tests/php-5.2.5/tests/lang/025.phpt new file mode 100644 index 0000000000000..382960f62812b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/025.phpt @@ -0,0 +1,531 @@ +--TEST-- +Mean recursion test +--FILE-- + +--EXPECT-- + 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 4 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 3 a 3 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 4 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 2 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 4 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 3 a 3 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 4 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 diff --git a/phpt/tests/php-5.2.5/tests/lang/026.phpt b/phpt/tests/php-5.2.5/tests/lang/026.phpt new file mode 100644 index 0000000000000..eb2d6214de670 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/026.phpt @@ -0,0 +1,6 @@ +--TEST-- +Testing string scanner confirmance +--FILE-- + +--EXPECT-- +" \'\n\'a\\b\ diff --git a/phpt/tests/php-5.2.5/tests/lang/027.phpt b/phpt/tests/php-5.2.5/tests/lang/027.phpt new file mode 100644 index 0000000000000..d3eb74b22ffbc --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/027.phpt @@ -0,0 +1,12 @@ +--TEST-- +Testing do-while loop +--FILE-- +0); +?> +--EXPECT-- +321 diff --git a/phpt/tests/php-5.2.5/tests/lang/028.phpt b/phpt/tests/php-5.2.5/tests/lang/028.phpt new file mode 100644 index 0000000000000..bd4525ee60e5c --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/028.phpt @@ -0,0 +1,1058 @@ +--TEST-- +Testing calling user-level functions from C +--FILE-- +myname = "Dafna"; + } + function GetMyName() { + return $this->myname; + } + function SetMyName($name) { + $this->myname = $name; + } +}; + +for ($i=0; $i<200; $i++): + print "$i\n"; + call_user_func("dafna"); + call_user_func("print_stuff","Hey there!!\n"); + print "$i\n"; +endfor; + + +$dafna = new dafna_class(); + +print $name=call_user_func(array(&$dafna,"GetMyName")); +print "\n"; + +?> +--EXPECT-- +0 +Dafna! +I'm still alive +Hey there!! +0 +1 +Dafna! +I'm still alive +Hey there!! +1 +2 +Dafna! +I'm still alive +Hey there!! +2 +3 +Dafna! +I'm still alive +Hey there!! +3 +4 +Dafna! +I'm still alive +Hey there!! +4 +5 +Dafna! +I'm still alive +Hey there!! +5 +6 +Dafna! +I'm still alive +Hey there!! +6 +7 +Dafna! +I'm still alive +Hey there!! +7 +8 +Dafna! +I'm still alive +Hey there!! +8 +9 +Dafna! +I'm still alive +Hey there!! +9 +10 +Dafna! +I'm still alive +Hey there!! +10 +11 +Dafna! +I'm still alive +Hey there!! +11 +12 +Dafna! +I'm still alive +Hey there!! +12 +13 +Dafna! +I'm still alive +Hey there!! +13 +14 +Dafna! +I'm still alive +Hey there!! +14 +15 +Dafna! +I'm still alive +Hey there!! +15 +16 +Dafna! +I'm still alive +Hey there!! +16 +17 +Dafna! +I'm still alive +Hey there!! +17 +18 +Dafna! +I'm still alive +Hey there!! +18 +19 +Dafna! +I'm still alive +Hey there!! +19 +20 +Dafna! +I'm still alive +Hey there!! +20 +21 +Dafna! +I'm still alive +Hey there!! +21 +22 +Dafna! +I'm still alive +Hey there!! +22 +23 +Dafna! +I'm still alive +Hey there!! +23 +24 +Dafna! +I'm still alive +Hey there!! +24 +25 +Dafna! +I'm still alive +Hey there!! +25 +26 +Dafna! +I'm still alive +Hey there!! +26 +27 +Dafna! +I'm still alive +Hey there!! +27 +28 +Dafna! +I'm still alive +Hey there!! +28 +29 +Dafna! +I'm still alive +Hey there!! +29 +30 +Dafna! +I'm still alive +Hey there!! +30 +31 +Dafna! +I'm still alive +Hey there!! +31 +32 +Dafna! +I'm still alive +Hey there!! +32 +33 +Dafna! +I'm still alive +Hey there!! +33 +34 +Dafna! +I'm still alive +Hey there!! +34 +35 +Dafna! +I'm still alive +Hey there!! +35 +36 +Dafna! +I'm still alive +Hey there!! +36 +37 +Dafna! +I'm still alive +Hey there!! +37 +38 +Dafna! +I'm still alive +Hey there!! +38 +39 +Dafna! +I'm still alive +Hey there!! +39 +40 +Dafna! +I'm still alive +Hey there!! +40 +41 +Dafna! +I'm still alive +Hey there!! +41 +42 +Dafna! +I'm still alive +Hey there!! +42 +43 +Dafna! +I'm still alive +Hey there!! +43 +44 +Dafna! +I'm still alive +Hey there!! +44 +45 +Dafna! +I'm still alive +Hey there!! +45 +46 +Dafna! +I'm still alive +Hey there!! +46 +47 +Dafna! +I'm still alive +Hey there!! +47 +48 +Dafna! +I'm still alive +Hey there!! +48 +49 +Dafna! +I'm still alive +Hey there!! +49 +50 +Dafna! +I'm still alive +Hey there!! +50 +51 +Dafna! +I'm still alive +Hey there!! +51 +52 +Dafna! +I'm still alive +Hey there!! +52 +53 +Dafna! +I'm still alive +Hey there!! +53 +54 +Dafna! +I'm still alive +Hey there!! +54 +55 +Dafna! +I'm still alive +Hey there!! +55 +56 +Dafna! +I'm still alive +Hey there!! +56 +57 +Dafna! +I'm still alive +Hey there!! +57 +58 +Dafna! +I'm still alive +Hey there!! +58 +59 +Dafna! +I'm still alive +Hey there!! +59 +60 +Dafna! +I'm still alive +Hey there!! +60 +61 +Dafna! +I'm still alive +Hey there!! +61 +62 +Dafna! +I'm still alive +Hey there!! +62 +63 +Dafna! +I'm still alive +Hey there!! +63 +64 +Dafna! +I'm still alive +Hey there!! +64 +65 +Dafna! +I'm still alive +Hey there!! +65 +66 +Dafna! +I'm still alive +Hey there!! +66 +67 +Dafna! +I'm still alive +Hey there!! +67 +68 +Dafna! +I'm still alive +Hey there!! +68 +69 +Dafna! +I'm still alive +Hey there!! +69 +70 +Dafna! +I'm still alive +Hey there!! +70 +71 +Dafna! +I'm still alive +Hey there!! +71 +72 +Dafna! +I'm still alive +Hey there!! +72 +73 +Dafna! +I'm still alive +Hey there!! +73 +74 +Dafna! +I'm still alive +Hey there!! +74 +75 +Dafna! +I'm still alive +Hey there!! +75 +76 +Dafna! +I'm still alive +Hey there!! +76 +77 +Dafna! +I'm still alive +Hey there!! +77 +78 +Dafna! +I'm still alive +Hey there!! +78 +79 +Dafna! +I'm still alive +Hey there!! +79 +80 +Dafna! +I'm still alive +Hey there!! +80 +81 +Dafna! +I'm still alive +Hey there!! +81 +82 +Dafna! +I'm still alive +Hey there!! +82 +83 +Dafna! +I'm still alive +Hey there!! +83 +84 +Dafna! +I'm still alive +Hey there!! +84 +85 +Dafna! +I'm still alive +Hey there!! +85 +86 +Dafna! +I'm still alive +Hey there!! +86 +87 +Dafna! +I'm still alive +Hey there!! +87 +88 +Dafna! +I'm still alive +Hey there!! +88 +89 +Dafna! +I'm still alive +Hey there!! +89 +90 +Dafna! +I'm still alive +Hey there!! +90 +91 +Dafna! +I'm still alive +Hey there!! +91 +92 +Dafna! +I'm still alive +Hey there!! +92 +93 +Dafna! +I'm still alive +Hey there!! +93 +94 +Dafna! +I'm still alive +Hey there!! +94 +95 +Dafna! +I'm still alive +Hey there!! +95 +96 +Dafna! +I'm still alive +Hey there!! +96 +97 +Dafna! +I'm still alive +Hey there!! +97 +98 +Dafna! +I'm still alive +Hey there!! +98 +99 +Dafna! +I'm still alive +Hey there!! +99 +100 +Dafna! +I'm still alive +Hey there!! +100 +101 +Dafna! +I'm still alive +Hey there!! +101 +102 +Dafna! +I'm still alive +Hey there!! +102 +103 +Dafna! +I'm still alive +Hey there!! +103 +104 +Dafna! +I'm still alive +Hey there!! +104 +105 +Dafna! +I'm still alive +Hey there!! +105 +106 +Dafna! +I'm still alive +Hey there!! +106 +107 +Dafna! +I'm still alive +Hey there!! +107 +108 +Dafna! +I'm still alive +Hey there!! +108 +109 +Dafna! +I'm still alive +Hey there!! +109 +110 +Dafna! +I'm still alive +Hey there!! +110 +111 +Dafna! +I'm still alive +Hey there!! +111 +112 +Dafna! +I'm still alive +Hey there!! +112 +113 +Dafna! +I'm still alive +Hey there!! +113 +114 +Dafna! +I'm still alive +Hey there!! +114 +115 +Dafna! +I'm still alive +Hey there!! +115 +116 +Dafna! +I'm still alive +Hey there!! +116 +117 +Dafna! +I'm still alive +Hey there!! +117 +118 +Dafna! +I'm still alive +Hey there!! +118 +119 +Dafna! +I'm still alive +Hey there!! +119 +120 +Dafna! +I'm still alive +Hey there!! +120 +121 +Dafna! +I'm still alive +Hey there!! +121 +122 +Dafna! +I'm still alive +Hey there!! +122 +123 +Dafna! +I'm still alive +Hey there!! +123 +124 +Dafna! +I'm still alive +Hey there!! +124 +125 +Dafna! +I'm still alive +Hey there!! +125 +126 +Dafna! +I'm still alive +Hey there!! +126 +127 +Dafna! +I'm still alive +Hey there!! +127 +128 +Dafna! +I'm still alive +Hey there!! +128 +129 +Dafna! +I'm still alive +Hey there!! +129 +130 +Dafna! +I'm still alive +Hey there!! +130 +131 +Dafna! +I'm still alive +Hey there!! +131 +132 +Dafna! +I'm still alive +Hey there!! +132 +133 +Dafna! +I'm still alive +Hey there!! +133 +134 +Dafna! +I'm still alive +Hey there!! +134 +135 +Dafna! +I'm still alive +Hey there!! +135 +136 +Dafna! +I'm still alive +Hey there!! +136 +137 +Dafna! +I'm still alive +Hey there!! +137 +138 +Dafna! +I'm still alive +Hey there!! +138 +139 +Dafna! +I'm still alive +Hey there!! +139 +140 +Dafna! +I'm still alive +Hey there!! +140 +141 +Dafna! +I'm still alive +Hey there!! +141 +142 +Dafna! +I'm still alive +Hey there!! +142 +143 +Dafna! +I'm still alive +Hey there!! +143 +144 +Dafna! +I'm still alive +Hey there!! +144 +145 +Dafna! +I'm still alive +Hey there!! +145 +146 +Dafna! +I'm still alive +Hey there!! +146 +147 +Dafna! +I'm still alive +Hey there!! +147 +148 +Dafna! +I'm still alive +Hey there!! +148 +149 +Dafna! +I'm still alive +Hey there!! +149 +150 +Dafna! +I'm still alive +Hey there!! +150 +151 +Dafna! +I'm still alive +Hey there!! +151 +152 +Dafna! +I'm still alive +Hey there!! +152 +153 +Dafna! +I'm still alive +Hey there!! +153 +154 +Dafna! +I'm still alive +Hey there!! +154 +155 +Dafna! +I'm still alive +Hey there!! +155 +156 +Dafna! +I'm still alive +Hey there!! +156 +157 +Dafna! +I'm still alive +Hey there!! +157 +158 +Dafna! +I'm still alive +Hey there!! +158 +159 +Dafna! +I'm still alive +Hey there!! +159 +160 +Dafna! +I'm still alive +Hey there!! +160 +161 +Dafna! +I'm still alive +Hey there!! +161 +162 +Dafna! +I'm still alive +Hey there!! +162 +163 +Dafna! +I'm still alive +Hey there!! +163 +164 +Dafna! +I'm still alive +Hey there!! +164 +165 +Dafna! +I'm still alive +Hey there!! +165 +166 +Dafna! +I'm still alive +Hey there!! +166 +167 +Dafna! +I'm still alive +Hey there!! +167 +168 +Dafna! +I'm still alive +Hey there!! +168 +169 +Dafna! +I'm still alive +Hey there!! +169 +170 +Dafna! +I'm still alive +Hey there!! +170 +171 +Dafna! +I'm still alive +Hey there!! +171 +172 +Dafna! +I'm still alive +Hey there!! +172 +173 +Dafna! +I'm still alive +Hey there!! +173 +174 +Dafna! +I'm still alive +Hey there!! +174 +175 +Dafna! +I'm still alive +Hey there!! +175 +176 +Dafna! +I'm still alive +Hey there!! +176 +177 +Dafna! +I'm still alive +Hey there!! +177 +178 +Dafna! +I'm still alive +Hey there!! +178 +179 +Dafna! +I'm still alive +Hey there!! +179 +180 +Dafna! +I'm still alive +Hey there!! +180 +181 +Dafna! +I'm still alive +Hey there!! +181 +182 +Dafna! +I'm still alive +Hey there!! +182 +183 +Dafna! +I'm still alive +Hey there!! +183 +184 +Dafna! +I'm still alive +Hey there!! +184 +185 +Dafna! +I'm still alive +Hey there!! +185 +186 +Dafna! +I'm still alive +Hey there!! +186 +187 +Dafna! +I'm still alive +Hey there!! +187 +188 +Dafna! +I'm still alive +Hey there!! +188 +189 +Dafna! +I'm still alive +Hey there!! +189 +190 +Dafna! +I'm still alive +Hey there!! +190 +191 +Dafna! +I'm still alive +Hey there!! +191 +192 +Dafna! +I'm still alive +Hey there!! +192 +193 +Dafna! +I'm still alive +Hey there!! +193 +194 +Dafna! +I'm still alive +Hey there!! +194 +195 +Dafna! +I'm still alive +Hey there!! +195 +196 +Dafna! +I'm still alive +Hey there!! +196 +197 +Dafna! +I'm still alive +Hey there!! +197 +198 +Dafna! +I'm still alive +Hey there!! +198 +199 +Dafna! +I'm still alive +Hey there!! +199 +Dafna + diff --git a/phpt/tests/php-5.2.5/tests/lang/030.phpt b/phpt/tests/php-5.2.5/tests/lang/030.phpt new file mode 100644 index 0000000000000..758369bf0848e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/030.phpt @@ -0,0 +1,36 @@ +--TEST-- +$this in constructor test +--FILE-- +Name = $name; + $GLOBALS['List']->echoName(); + } + + function echoName() { + $GLOBALS['names'][]=$this->Name; + } +} + +function &foo2(&$foo) { + return $foo; +} + + +$bar1 =new foo('constructor'); +$bar1->Name = 'outside'; +$bar1->echoName(); +$List->echoName(); + +$bar1 =& foo2(new foo('constructor')); +$bar1->Name = 'outside'; +$bar1->echoName(); + +$List->echoName(); + +print ($names==array('constructor','outside','outside','constructor','outside','outside')) ? 'success':'failure'; +?> +--EXPECT-- +success diff --git a/phpt/tests/php-5.2.5/tests/lang/031.phpt b/phpt/tests/php-5.2.5/tests/lang/031.phpt new file mode 100644 index 0000000000000..b2d1e631ecc58 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/031.phpt @@ -0,0 +1,70 @@ +--TEST-- +Bug #16227 (Internal hash position bug on assignment) +--FILE-- + +--EXPECT-- +Correct - with inner loop reset. +inloop 0 for key1 +inloop 1 for key1 +inloop 0 for key2 +inloop 1 for key2 +What happens without inner loop reset. +inloop 0 for key1 +inloop 1 for key1 +What happens without inner loop reset but copy. +inloop 0 for key1 +inloop 1 for key1 +inloop 0 for key2 +inloop 1 for key2 +What happens with inner loop reset over copy. +inloop 0 for key1 +inloop 1 for key1 +inloop 0 for key2 +inloop 1 for key2 diff --git a/phpt/tests/php-5.2.5/tests/lang/032.phpt b/phpt/tests/php-5.2.5/tests/lang/032.phpt new file mode 100644 index 0000000000000..caa4c7e4302b0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/032.phpt @@ -0,0 +1,36 @@ +--TEST-- +Class method registration +--FILE-- + +--EXPECT-- +OK + diff --git a/phpt/tests/php-5.2.5/tests/lang/033.phpt b/phpt/tests/php-5.2.5/tests/lang/033.phpt new file mode 100644 index 0000000000000..724c67b225af4 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/033.phpt @@ -0,0 +1,53 @@ +--TEST-- +Alternative syntaxes test +--SKIPIF-- +=')) echo "skip removed in Zend Engine 2\n"; ?> +--FILE-- + +--EXPECT-- +If: 11 +While: 12346789 +For: 0123401234 +Switch: 1 +old_function: foo(1, 2); diff --git a/phpt/tests/php-5.2.5/tests/lang/034.phpt b/phpt/tests/php-5.2.5/tests/lang/034.phpt new file mode 100644 index 0000000000000..e442db8ff168e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/034.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #12647 (Locale settings affecting float parsing) +--INI-- +precision=14 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +3,14 diff --git a/phpt/tests/php-5.2.5/tests/lang/035.phpt b/phpt/tests/php-5.2.5/tests/lang/035.phpt new file mode 100644 index 0000000000000..cf2d063820609 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/035.phpt @@ -0,0 +1,36 @@ +--TEST-- +ZE2: set_exception_handler() +--FILE-- +error = $_error; + } + + function getException() + { + return $this->error; + } +} + +function ThrowException() +{ + throw new MyException("'This is an exception!'"); +} + + +try { +} catch (MyException $exception) { + print "There shouldn't be an exception: " . $exception->getException(); + print "\n"; +} + +try { + ThrowException(); +} catch (MyException $exception) { + print "There was an exception: " . $exception->getException(); + print "\n"; +} +?> +--EXPECT-- +There was an exception: 'This is an exception!' diff --git a/phpt/tests/php-5.2.5/tests/lang/036.phpt b/phpt/tests/php-5.2.5/tests/lang/036.phpt new file mode 100755 index 0000000000000..474316e363a79 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/036.phpt @@ -0,0 +1,27 @@ +--TEST-- +Child public element should not override parent private element in parent methods +--FILE-- +id; + } +}; + +class chld extends par { + public $id = "bar"; + function displayHim() + { + parent::displayMe(); + } +}; + + +$obj = new chld(); +$obj->displayHim(); +?> +--EXPECT-- +foo diff --git a/phpt/tests/php-5.2.5/tests/lang/037.phpt b/phpt/tests/php-5.2.5/tests/lang/037.phpt new file mode 100755 index 0000000000000..c2a1ee312f6b6 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/037.phpt @@ -0,0 +1,30 @@ +--TEST-- +'Static' binding for private variables +--FILE-- +displayChild(); + } +}; + +class chld extends par { + private $id = "bar"; + + function displayChild() + { + print $this->id; + } +}; + + +$obj = new chld(); +$obj->displayMe(); + +?> +--EXPECT-- +bar diff --git a/phpt/tests/php-5.2.5/tests/lang/038.phpt b/phpt/tests/php-5.2.5/tests/lang/038.phpt new file mode 100755 index 0000000000000..c3de20c973453 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/038.phpt @@ -0,0 +1,41 @@ +--TEST-- +Convert warnings to exceptions +--FILE-- +file = $errfile; + $this->line = $errline; + } +} + +function Error2Exception($errno, $errstr, $errfile, $errline) +{ + throw new MyException($errstr, $errno);//, $errfile, $errline); +} + +$err_msg = 'no exception'; +set_error_handler('Error2Exception'); + +try +{ + $con = fopen("/tmp/a_file_that_does_not_exist",'r'); +} +catch (Exception $e) +{ + $trace = $e->getTrace(); + var_dump($trace[0]['function']); + var_dump($trace[1]['function']); +} + +?> +===DONE=== + +--EXPECTF-- +string(15) "Error2Exception" +string(5) "fopen" +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/lang/039.phpt b/phpt/tests/php-5.2.5/tests/lang/039.phpt new file mode 100755 index 0000000000000..ea2cccb64fed8 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/039.phpt @@ -0,0 +1,45 @@ +--TEST-- +Catch Interfaces +--FILE-- +file = $errfile; + $this->line = $errline; + } +} + +function Error2Exception($errno, $errstr, $errfile, $errline) +{ + throw new MyException($errstr, $errno, $errfile, $errline); +} + +$err_msg = 'no exception'; +set_error_handler('Error2Exception'); + +try +{ + $con = fopen('/tmp/a_file_that_does_not_exist','r'); +} +catch (Catchable $e) +{ + echo "Catchable\n"; +} +catch (Exception $e) +{ + echo "Exception\n"; +} + +?> +===DONE=== +--EXPECTF-- +Catchable +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/lang/040.phpt b/phpt/tests/php-5.2.5/tests/lang/040.phpt new file mode 100755 index 0000000000000..7f6eafdfc557a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/040.phpt @@ -0,0 +1,15 @@ +--TEST-- +foreach into array +--FILE-- + +===DONE=== +--EXPECT-- +0 +1 +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/lang/bison1.phpt b/phpt/tests/php-5.2.5/tests/lang/bison1.phpt new file mode 100644 index 0000000000000..3571576fb8347 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bison1.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bison weirdness +--FILE-- + +--EXPECT-- +blah- diff --git a/phpt/tests/php-5.2.5/tests/lang/bug17115.phpt b/phpt/tests/php-5.2.5/tests/lang/bug17115.phpt new file mode 100644 index 0000000000000..0cb3bf44d2e6b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug17115.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #17115 (lambda functions produce segfault with static vars) +--FILE-- + +--EXPECT-- +int(0) +int(1) +int(2) diff --git a/phpt/tests/php-5.2.5/tests/lang/bug18872.phpt b/phpt/tests/php-5.2.5/tests/lang/bug18872.phpt new file mode 100644 index 0000000000000..2e3dc22c5824a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug18872.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #18872 (class constant used as default parameter) +--FILE-- + +--EXPECT-- +3 +3 diff --git a/phpt/tests/php-5.2.5/tests/lang/bug19566.phpt b/phpt/tests/php-5.2.5/tests/lang/bug19566.phpt new file mode 100644 index 0000000000000..45c3bc588e2d3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug19566.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #19566 (get_declared_classes() segfaults) +--FILE-- + +--EXPECTF-- +int(%d) diff --git a/phpt/tests/php-5.2.5/tests/lang/bug19943.phpt b/phpt/tests/php-5.2.5/tests/lang/bug19943.phpt new file mode 100644 index 0000000000000..294a320bf7cbf --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug19943.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #19943 (memleaks) +--FILE-- + +--EXPECT-- +0 -- 0 +1 -- 1 +2 -- 2 +3 -- 3 +4 -- 4 +5 -- 5 +6 -- 6 +7 -- 7 +8 -- 8 +9 -- 9 +string(10) "0123456780" diff --git a/phpt/tests/php-5.2.5/tests/lang/bug20175.phpt b/phpt/tests/php-5.2.5/tests/lang/bug20175.phpt new file mode 100644 index 0000000000000..d643aacf7a816 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug20175.phpt @@ -0,0 +1,165 @@ +--TEST-- +Bug #20175 (Static vars can't store ref to new instance) +--FILE-- +oop_name = 'oop:' . ++$oop_global; + } +} + +class oop_test { + static $oop_value; + + function oop_test() { + echo "oop_test()\n"; + } + + function oop_static() { + echo "oop_static()\n"; + if (!isset(self::$oop_value)) { + self::$oop_value = & new oop_class; + } + echo self::$oop_value->oop_name; + } +} + +print foo_static()."\n"; +print foo_static()."\n"; +print bar_static()."\n"; +print bar_static()."\n"; +//print wow_static()."\n"; +//print wow_static()."\n"; +echo "wow_static() +wow_global() +wow:1 +wow_static() +wow:1 +"; +$oop_tester = new oop_test; +print $oop_tester->oop_static()."\n"; +print $oop_tester->oop_static()."\n"; +$oop_tester = new oop_test; // repeated. +print $oop_tester->oop_static()."\n"; +?> +--EXPECTF-- +Strict Standards: Assigning the return value of new by reference is deprecated in %s.php on line %d +%s +foo_static() +foo_global() +foo:1 +foo_static() +foo:1 +bar_static() +bar_global() + +Strict Standards: Only variables should be assigned by reference in %sbug20175.php on line 47 +bar:1 +bar_static() +bar:1 +wow_static() +wow_global() +wow:1 +wow_static() +wow:1 +oop_test() +oop_static() +oop_class() +oop:1 +oop_static() +oop:1 +oop_test() +oop_static() +oop:1 diff --git a/phpt/tests/php-5.2.5/tests/lang/bug21094.phpt b/phpt/tests/php-5.2.5/tests/lang/bug21094.phpt new file mode 100644 index 0000000000000..266a1d6c8fab3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug21094.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #21094 (set_error_handler not accepting methods) +--FILE-- + +--EXPECTF-- +[1024] errstr: test, errfile: %s, errline: %d + diff --git a/phpt/tests/php-5.2.5/tests/lang/bug21600.phpt b/phpt/tests/php-5.2.5/tests/lang/bug21600.phpt new file mode 100644 index 0000000000000..6ecf69a11f7f8 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug21600.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #21600 (assign by reference function call changes variable contents) +--INI-- +error_reporting=4095 +--FILE-- + +--EXPECTF-- +Strict Standards: Only variables should be assigned by reference in %sbug21600.php on line 4 +array(1) { + ["foo"]=> + string(4) "test" +} + +Strict Standards: Only variables should be assigned by reference in %sbug21600.php on line 11 +array(1) { + ["foo"]=> + string(4) "test" +} diff --git a/phpt/tests/php-5.2.5/tests/lang/bug21669.phpt b/phpt/tests/php-5.2.5/tests/lang/bug21669.phpt new file mode 100644 index 0000000000000..643b0695ee755 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug21669.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #21669 ("$obj = new $this->var;" doesn't work) +--FILE-- +name; /* Parse error */ + return $obj; + } +} +$factory = new Factory; +$test = $factory->create(); +$test->say_hello(); +?> +--EXPECT-- +Hello world diff --git a/phpt/tests/php-5.2.5/tests/lang/bug21820.phpt b/phpt/tests/php-5.2.5/tests/lang/bug21820.phpt new file mode 100644 index 0000000000000..0ca233ea84113 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug21820.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #21820 ("$arr['foo']" generates bogus E_NOTICE, should be E_PARSE) +--FILE-- + 'bar'); +echo "$arr['foo']"; + +?> +--EXPECTREGEX-- +Parse error: (parse|syntax) error, .*expecting `?T_STRING'? or `?T_VARIABLE'? or `?T_NUM_STRING'? in .*bug21820.php on line .* diff --git a/phpt/tests/php-5.2.5/tests/lang/bug21849.phpt b/phpt/tests/php-5.2.5/tests/lang/bug21849.phpt new file mode 100644 index 0000000000000..30b311320bebf --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug21849.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #21849 (self::constant doesn't work as method's default parameter) +--FILE-- + +--EXPECT-- +fubar diff --git a/phpt/tests/php-5.2.5/tests/lang/bug21961.phpt b/phpt/tests/php-5.2.5/tests/lang/bug21961.phpt new file mode 100644 index 0000000000000..24581d663e8c2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug21961.phpt @@ -0,0 +1,58 @@ +--TEST-- +Bug #21961 (get_parent_class() segfault) +--SKIPIF-- + +--FILE-- +name = 'Mr. X'; + $this->bars = array(); + } + + function getdrunk($where) + { + $this->bars[] = new bar($where); + } + + function getName() + { + return $this->name; + } +} + +class bar extends man +{ + public $name; + + function bar($w) + { + $this->name = $w; + } + + function getName() + { + return $this->name; + } + + function whosdrunk() + { + $who = get_parent_class($this); + if($who == NULL) + { + return 'nobody'; + } + return eval("return ".$who.'::getName();'); + } +} + +$x = new man; +$x->getdrunk('The old Tavern'); +var_dump($x->bars[0]->whosdrunk()); +?> +--EXPECT-- +string(14) "The old Tavern" diff --git a/phpt/tests/php-5.2.5/tests/lang/bug22231.phpt b/phpt/tests/php-5.2.5/tests/lang/bug22231.phpt new file mode 100644 index 0000000000000..b6842c7cf6a61 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug22231.phpt @@ -0,0 +1,42 @@ +--TEST-- +Bug #22231 (segfault when returning a global variable by reference) +--INI-- +error_reporting=4095 +--FILE-- +fubar); +unset($bar); +$bar = &foo(); +var_dump($bar->fubar); + +$foo = &foo(); +var_dump($foo); +var_dump($foo->fubar); +unset($foo); +$foo = &foo(); +var_dump($foo->fubar); +?> +--EXPECTF-- +Strict Standards: Assigning the return value of new by reference is deprecated in %s on line %d +object(foo)#%d (1) { + ["fubar"]=> + string(5) "fubar" +} +string(5) "fubar" +string(5) "fubar" +object(foo)#%d (1) { + ["fubar"]=> + string(5) "fubar" +} +string(5) "fubar" +string(5) "fubar" diff --git a/phpt/tests/php-5.2.5/tests/lang/bug22510.phpt b/phpt/tests/php-5.2.5/tests/lang/bug22510.phpt new file mode 100644 index 0000000000000..450bbb577d938 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug22510.phpt @@ -0,0 +1,126 @@ +--TEST-- +Bug #22510 (segfault among complex references) +--INI-- +error_reporting=4095 +--FILE-- +list; + } + + function &method1() { + print __CLASS__."::".__FUNCTION__."\n"; + return @$this->foo; + } + + function &method2() { + print __CLASS__."::".__FUNCTION__."\n"; + return $this->foo; + } + + function method3() { + print __CLASS__."::".__FUNCTION__."\n"; + return @$this->foo; + } +} + +class bar +{ + function run1() { + print __CLASS__."::".__FUNCTION__."\n"; + $this->instance = new foo(); + $this->instance->method1($this); + $this->instance->method1($this); + } + + function run2() { + print __CLASS__."::".__FUNCTION__."\n"; + $this->instance = new foo(); + $this->instance->method2($this); + $this->instance->method2($this); + } + + function run3() { + print __CLASS__."::".__FUNCTION__."\n"; + $this->instance = new foo(); + $this->instance->method3($this); + $this->instance->method3($this); + } +} + +function ouch(&$bar) { + print __FUNCTION__."\n"; + @$a = $a; + $bar->run1(); +} + +function ok1(&$bar) { + print __FUNCTION__."\n"; + $bar->run1(); +} + +function ok2(&$bar) { + print __FUNCTION__."\n"; + @$a = $a; + $bar->run2(); +} + +function ok3(&$bar) { + print __FUNCTION__."\n"; + @$a = $a; + $bar->run3(); +} + +$bar = &new bar(); +ok1($bar); +$bar->instance->finalize(); +print "done!\n"; +ok2($bar); +$bar->instance->finalize(); +print "done!\n"; +ok3($bar); +$bar->instance->finalize(); +print "done!\n"; +ouch($bar); +$bar->instance->finalize(); +print "I'm alive!\n"; +?> +--EXPECTF-- +Strict Standards: Assigning the return value of new by reference is deprecated in %s on line %d +ok1 +bar::run1 +foo::method1 + +Notice: Only variable references should be returned by reference in %s on line %d +foo::method1 + +Notice: Only variable references should be returned by reference in %s on line %d +foo::finalize +done! +ok2 +bar::run2 +foo::method2 +foo::method2 +foo::finalize +done! +ok3 +bar::run3 +foo::method3 +foo::method3 +foo::finalize +done! +ouch +bar::run1 +foo::method1 + +Notice: Only variable references should be returned by reference in %s on line %d +foo::method1 + +Notice: Only variable references should be returned by reference in %s on line %d +foo::finalize +I'm alive! diff --git a/phpt/tests/php-5.2.5/tests/lang/bug22592.phpt b/phpt/tests/php-5.2.5/tests/lang/bug22592.phpt new file mode 100644 index 0000000000000..351ea08b9bbea --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug22592.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #22592 (cascading assignments to strings with curly braces broken) +--FILE-- + +--EXPECT-- +string(5) "* *-*" +string(7) "* *-* *" +string(7) "*4*-* *" +string(7) "*4*s* *" +string(8) "*4*s* *0" +string(8) "*-*-* *0" +string(8) "*-*s*s*0" +string(8) "4-4s4s*0" +string(9) "4-4s4s505" +string(9) "454s4s505" +string(1) "-" +string(6) "string" +int(4) +int(5) +string(1) "5" +[Illegal string offset: -1] diff --git a/phpt/tests/php-5.2.5/tests/lang/bug22690.phpt b/phpt/tests/php-5.2.5/tests/lang/bug22690.phpt new file mode 100644 index 0000000000000..6aed5be6e91d6 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug22690.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #22690 (ob_start() is broken with create_function() callbacks) +--FILE-- + +bar +--EXPECT-- +BAR +BAR diff --git a/phpt/tests/php-5.2.5/tests/lang/bug23279.phpt b/phpt/tests/php-5.2.5/tests/lang/bug23279.phpt new file mode 100644 index 0000000000000..78d7850ff4cc7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug23279.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #23279 (exception handler stops after first function call) +--FILE-- + +--EXPECT-- +Goodbye Cruel World diff --git a/phpt/tests/php-5.2.5/tests/lang/bug23384.phpt b/phpt/tests/php-5.2.5/tests/lang/bug23384.phpt new file mode 100644 index 0000000000000..382bdfe90f3b0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug23384.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #23384 (use of class constants in statics) +--INI-- +error_reporting=4095 +--FILE-- + 'ten'); + static $arr = array(Foo::HUN => 'ten'); + + print_r($arr); + print_r($arr2); + print_r($x); + } +} + +Foo::test(); +echo Foo::HUN."\n"; +?> +--EXPECTF-- +Strict Standards: Non-static method Foo::test() should not be called statically in %sbug23384.php on line %d +Array +( + [100] => ten +) +Array +( + [10] => ten +) +100100 diff --git a/phpt/tests/php-5.2.5/tests/lang/bug23489.phpt b/phpt/tests/php-5.2.5/tests/lang/bug23489.phpt new file mode 100644 index 0000000000000..645bb1b7df368 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug23489.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #23489 (ob_start() is broken with method callbacks) +--FILE-- + +failure +--EXPECT-- +success diff --git a/phpt/tests/php-5.2.5/tests/lang/bug23524.phpt b/phpt/tests/php-5.2.5/tests/lang/bug23524.phpt new file mode 100755 index 0000000000000..f1a41e6a10f04 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug23524.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #23524 (Improper handling of constants in array indices) +--FILE-- +THE_CONST)) { + print_r($a); + } + f(); + f(); + f(); + echo "Done"; +?> +--EXPECT-- +Begin +Array +( + [123] => 123 +) +Array +( + [123] => 123 +) +Array +( + [123] => 123 +) +Done diff --git a/phpt/tests/php-5.2.5/tests/lang/bug23584.phpt b/phpt/tests/php-5.2.5/tests/lang/bug23584.phpt new file mode 100644 index 0000000000000..417cfb085651a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug23584.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #23584 (error line numbers off by one when using #!php) +--FILE-- +#!php + +--EXPECTREGEX-- +Notice: Undefined variable:.*foo in .* on line 6 diff --git a/phpt/tests/php-5.2.5/tests/lang/bug23624.phpt b/phpt/tests/php-5.2.5/tests/lang/bug23624.phpt new file mode 100644 index 0000000000000..4ddb82e8c6885 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug23624.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #23624 (foreach leaves current array key as null) +--FILE-- + $value); + var_dump(current($arr)); +?> +--EXPECT-- +string(3) "one" +bool(false) diff --git a/phpt/tests/php-5.2.5/tests/lang/bug23922.phpt b/phpt/tests/php-5.2.5/tests/lang/bug23922.phpt new file mode 100644 index 0000000000000..1fc6e548ff0b4 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug23922.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #23922 (scope doesn't properly propagate into internal functions) +--FILE-- +foo == 1'); } + + function as_expr() + { assert($this->foo == 1); } + } + + $foo = new foo(); + $foo->as_expr(); + $foo->as_string(); +?> +--EXPECT-- diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24054.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24054.phpt new file mode 100644 index 0000000000000..3c9d74620431c --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24054.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #24054 (Assignment operator *= broken) +--FILE-- + 1, 'b' => 2, 'c' => 3); + +foreach($arr as $k=>$v) { + global $$k; // comment this out and it works in PHP 5 too.. + + echo "($k => $v)\n"; + + $$k = $v; +} +?> +--EXPECT-- +(a => 1) +(b => 2) +(c => 3) diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24403.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24403.phpt new file mode 100644 index 0000000000000..fe99257d3d3ae --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24403.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #24403 (scope doesn't properly propagate into internal functions) +--FILE-- +a) ? '\'.\$p[\'\\1\'].\'' : +'\'.\$r[\'\\1\'].\'')", + "{a} b {c}"); + } +} +new a(); +?> +--EXPECT-- diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24436.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24436.phpt new file mode 100644 index 0000000000000..b0cfbe093120a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24436.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #24436 (isset() and empty() produce errors with non-existent variables in objects) +--FILE-- +test[0][0])) { print "test1";} + if (!isset($this->test[0][0])) { print "test2";} + } +} + +$test1 = new test(); +?> +--EXPECT-- +test1test2 diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24499.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24499.phpt new file mode 100755 index 0000000000000..6ce56dbad7328 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24499.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #24499 (bogus handling of a public property as a private one) +--FILE-- +id = "bar"; + } +} + +$id = new Id(); +@$obj->foo = "bar"; +$id->tester($obj); +print_r($obj); +?> +--EXPECT-- +stdClass Object +( + [foo] => bar + [id] => bar +) diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24573.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24573.phpt new file mode 100644 index 0000000000000..e087d1fb2cba3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24573.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #24573 (debug_backtrace() crashes if $this is set to null) +--FILE-- +Bar(); + +echo "OK\n"; + +?> +--EXPECTF-- + +Fatal error: Cannot re-assign $this in %s on line %d \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24640.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24640.phpt new file mode 100755 index 0000000000000..ced5e7c8163e9 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24640.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #24640 (var_export and var_dump can't output large float) +--FILE-- + 0); + var_dump($f); + var_dump(array_key_exists(7, $f)); + var_dump(array_key_exists('7', $f)); + + print "----------\n"; + /* This doesn't */ + $f = array_flip(array('7')); + var_dump($f); + var_dump(array_key_exists(7, $f)); + var_dump(array_key_exists('7', $f)); +?> +--EXPECT-- +array(1) { + [7]=> + int(0) +} +bool(true) +bool(true) +---------- +array(1) { + [7]=> + int(0) +} +bool(true) +bool(true) diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24658.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24658.phpt new file mode 100644 index 0000000000000..944fe44ce8f7a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24658.phpt @@ -0,0 +1,56 @@ +--TEST-- +Bug #24658 (combo of typehint / reference causes crash) +--FILE-- + +--EXPECTF-- +object(foo)#%d (0) { +} +object(foo)#%d (0) { +} +object(foo)#%d (0) { +} +object(foo)#%d (0) { +} +===no_typehint=== +object(foo)#%d (0) { +} +int(1) +int(2) +===no_typehint_ref=== +object(foo)#%d (0) { +} +int(1) +int(2) +===typehint=== +object(foo)#%d (0) { +} + +Catchable fatal error: Argument 1 passed to typehint() must be an instance of foo, integer given in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24783.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24783.phpt new file mode 100644 index 0000000000000..8c8cd6ee01077 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24783.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #24783 ($key not binary safe in "foreach($arr as $key => $val)") +--FILE-- + "foo\0bar"); + foreach ($arr as $key => $val) { + echo strlen($key), ': '; + echo urlencode($key), ' => ', urlencode($val), "\n"; + } +?> +--EXPECT-- +7: foo%00bar => foo%00bar diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24908.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24908.phpt new file mode 100755 index 0000000000000..30056abf3cb27 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24908.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #24908 (super-globals can not be used in __destruct()) +--INI-- +variables_order=GPS +--FILE-- + +--EXPECT-- +OK diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24926.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24926.phpt new file mode 100644 index 0000000000000..3d2cc7008baf2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24926.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #24926 (lambda function (create_function()) cannot be stored in a class property) +--FILE-- +functions['test'] = $function; + print($this->functions['test']()); // werkt al niet meer + + } +} + +$a = new foo (); + +?> +--EXPECT-- +FOO +FOO diff --git a/phpt/tests/php-5.2.5/tests/lang/bug24951.phpt b/phpt/tests/php-5.2.5/tests/lang/bug24951.phpt new file mode 100644 index 0000000000000..aa48ab29368e0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug24951.phpt @@ -0,0 +1,42 @@ +--TEST-- +Bug #24951 (ob_flush() destroys output handler) +--FILE-- + +--EXPECT-- +[Hello from t1 1 Hello from t1 2 ] + +[Hello from t2 1 Hello from t2 2 ] + +Hello from t3 2 ] diff --git a/phpt/tests/php-5.2.5/tests/lang/bug25145.phpt b/phpt/tests/php-5.2.5/tests/lang/bug25145.phpt new file mode 100755 index 0000000000000..e33580ab0def9 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug25145.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #25145 (SEGV on recpt of form input with name like "123[]") +--SKIPIF-- + +--GET-- +123[]=SEGV +--FILE-- + +--EXPECT-- +array(1) { + [123]=> + array(1) { + [0]=> + string(4) "SEGV" + } +} +Done diff --git a/phpt/tests/php-5.2.5/tests/lang/bug25547.phpt b/phpt/tests/php-5.2.5/tests/lang/bug25547.phpt new file mode 100755 index 0000000000000..cce556ceb9ae9 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug25547.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #25547 (error_handler and array index with function call) +--FILE-- + +--EXPECT-- +handler(Undefined index: foo) +Array +( + [foo] => 1 +) +Done diff --git a/phpt/tests/php-5.2.5/tests/lang/bug25652.phpt b/phpt/tests/php-5.2.5/tests/lang/bug25652.phpt new file mode 100755 index 0000000000000..09cfc181977b0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug25652.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #25652 (Calling Global functions dynamically fails from Class scope) +--FILE-- +arr[0]('testvalue'); + } + } + + $a = new foo (); + $a->bar (); + +?> +--EXPECT-- +testfunc testvalue diff --git a/phpt/tests/php-5.2.5/tests/lang/bug25922.phpt b/phpt/tests/php-5.2.5/tests/lang/bug25922.phpt new file mode 100755 index 0000000000000..bb030c9df834c --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug25922.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #25922 (SEGV in error_handler when context is destroyed) +--INI-- +error_reporting=2047 +--FILE-- + +--EXPECT-- +Undefined variable: data +Undefined index here: '' diff --git a/phpt/tests/php-5.2.5/tests/lang/bug26182.phpt b/phpt/tests/php-5.2.5/tests/lang/bug26182.phpt new file mode 100644 index 0000000000000..7417293928a14 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug26182.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #26182 (Object properties created redundantly) +--INI-- +error_reporting=4095 +--FILE-- +x)) { + //just for demo + } + } +} + +$t = new A (); + +print_r($t); + +?> +--EXPECT-- +A Object +( +) diff --git a/phpt/tests/php-5.2.5/tests/lang/bug26696.phpt b/phpt/tests/php-5.2.5/tests/lang/bug26696.phpt new file mode 100644 index 0000000000000..dae182d30730f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug26696.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #26696 (string index in a switch() crashes with multiple matches) +--FILE-- + +--EXPECT-- +OK +OK diff --git a/phpt/tests/php-5.2.5/tests/lang/bug26866.phpt b/phpt/tests/php-5.2.5/tests/lang/bug26866.phpt new file mode 100644 index 0000000000000..abb99c34fd1e0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug26866.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #26866 (segfault when exception raised in __get) +--FILE-- +bar->get_name(); +} +catch (Exception $E) { + echo "Exception raised!\n"; +} +?> +--EXPECT-- +Exception raised! diff --git a/phpt/tests/php-5.2.5/tests/lang/bug26869.phpt b/phpt/tests/php-5.2.5/tests/lang/bug26869.phpt new file mode 100644 index 0000000000000..77dd2592edf95 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug26869.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #26869 (constant as the key of static array) +--FILE-- + 1); + var_dump($a); + var_dump(isset($a[A])); +?> +--EXPECT-- +array(1) { + [1]=> + int(1) +} +bool(true) diff --git a/phpt/tests/php-5.2.5/tests/lang/bug27354.phpt b/phpt/tests/php-5.2.5/tests/lang/bug27354.phpt new file mode 100644 index 0000000000000..e10ad9c924024 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug27354.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #27354 (Modulus operator crashes PHP) +--FILE-- + +--EXPECTF-- +int(%i) +int(%i) +int(%i) +int(%i) diff --git a/phpt/tests/php-5.2.5/tests/lang/bug27439.phpt b/phpt/tests/php-5.2.5/tests/lang/bug27439.phpt new file mode 100755 index 0000000000000..b12fd1ec6c626 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug27439.phpt @@ -0,0 +1,76 @@ +--TEST-- +Bug #27439 (foreach() with $this segfaults) +--FILE-- +object = new test_props; + } + + public function getArray() { + return $this->array; + } + + public function getString() { + return $this->string; + } + + public function case1() { + foreach ($this->array as $foo) { + echo $foo; + } + } + + public function case2() { + foreach ($this->foobar as $foo); + } + + public function case3() { + foreach ($this->string as $foo); + } + + public function case4() { + foreach ($this->getArray() as $foo); + } + + public function case5() { + foreach ($this->getString() as $foo); + } + + public function case6() { + foreach ($this->object as $foo) { + echo $foo; + } + } +} +$test = new test(); +$test->case1(); +$test->case2(); +$test->case3(); +$test->case4(); +$test->case5(); +$test->case6(); +echo "\n"; +echo "===DONE==="; +?> +--EXPECTF-- +123 +Notice: Undefined property: test::$foobar in %s on line %d + +Warning: Invalid argument supplied for foreach() in %s on line %d + +Warning: Invalid argument supplied for foreach() in %s on line %d + +Warning: Invalid argument supplied for foreach() in %s on line %d +123 +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/lang/bug27443.phpt b/phpt/tests/php-5.2.5/tests/lang/bug27443.phpt new file mode 100644 index 0000000000000..409794331b381 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug27443.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #27443 (defined() returns wrong type) +--FILE-- + +--EXPECT-- +boolean diff --git a/phpt/tests/php-5.2.5/tests/lang/bug27535.phpt b/phpt/tests/php-5.2.5/tests/lang/bug27535.phpt new file mode 100644 index 0000000000000..a6ceae7463c4a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug27535.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #27535 (Objects pointing to each other cause Apache to crash) +--FILE-- +storage = new Class1(); + + $this->storage->_Class2_obj = $this; + } +} + +$foo = new Class2(); + +?> +Alive! +--EXPECT-- +Alive! diff --git a/phpt/tests/php-5.2.5/tests/lang/bug28213.phpt b/phpt/tests/php-5.2.5/tests/lang/bug28213.phpt new file mode 100644 index 0000000000000..3677d4c6f3557 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug28213.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #28213 (crash in debug_print_backtrace in static methods) +--FILE-- + +--EXPECTREGEX-- +.*#1\s*include.* diff --git a/phpt/tests/php-5.2.5/tests/lang/bug28800.phpt b/phpt/tests/php-5.2.5/tests/lang/bug28800.phpt new file mode 100644 index 0000000000000..f81ad7fec982a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug28800.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #28800 (Incorrect string to number conversion for strings starting with 'inf') +--FILE-- + +--EXPECT-- +0 +0 +0 +0 +0 +0 + diff --git a/phpt/tests/php-5.2.5/tests/lang/bug29566.phpt b/phpt/tests/php-5.2.5/tests/lang/bug29566.phpt new file mode 100755 index 0000000000000..f814958ba1df8 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug29566.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #29566 (foreach/string handling strangeness) +--FILE-- + +===DONE=== +--EXPECTF-- +Warning: Invalid argument supplied for foreach() in %sbug29566.php on line %d +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/lang/bug29893.phpt b/phpt/tests/php-5.2.5/tests/lang/bug29893.phpt new file mode 100755 index 0000000000000..d320de0ee72d7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug29893.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #29893 (segfault when using array as index) +--FILE-- + +===DONE=== +--EXPECTF-- +Warning: Cannot use a scalar value as an array in %sbug29893.php on line %d +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/lang/bug29944.phpt b/phpt/tests/php-5.2.5/tests/lang/bug29944.phpt new file mode 100755 index 0000000000000..7882936f08b8d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug29944.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #29944 (function defined in switch crashes PHP) +--FILE-- + + +===DONE=== +--EXPECT-- +1 +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/lang/bug30578.phpt b/phpt/tests/php-5.2.5/tests/lang/bug30578.phpt new file mode 100644 index 0000000000000..d8a8d2e54f8d3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug30578.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #30578 (Output buffers flushed before calling __desctruct functions) +--FILE-- + +--EXPECT-- +This should be displayed first. +Buffered data: This should be displayed last. diff --git a/phpt/tests/php-5.2.5/tests/lang/bug30638.phpt b/phpt/tests/php-5.2.5/tests/lang/bug30638.phpt new file mode 100644 index 0000000000000..0ebe8d49dd17f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug30638.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #30638 (localeconv returns wrong LC_NUMERIC settings) (ok to fail on MacOS X) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +decimal_point: , +thousands_sep: . diff --git a/phpt/tests/php-5.2.5/tests/lang/bug30726.phpt b/phpt/tests/php-5.2.5/tests/lang/bug30726.phpt new file mode 100644 index 0000000000000..79aeff7d265c6 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug30726.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #30726 (-.1 like numbers are not being handled correctly) +--FILE-- + +--EXPECT-- +1 diff --git a/phpt/tests/php-5.2.5/tests/lang/bug30862.phpt b/phpt/tests/php-5.2.5/tests/lang/bug30862.phpt new file mode 100644 index 0000000000000..12c95d57e87b7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug30862.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #30862 (Static array with boolean indexes) +--FILE-- +"false", true=>"true"); +} +print_r(T::$a); +?> +---------- +"false", Y=>"true"); +} +print_r(T2::$a); +?> +--EXPECT-- +Array +( + [0] => false + [1] => true +) +---------- +Array +( + [0] => false + [1] => true +) diff --git a/phpt/tests/php-5.2.5/tests/lang/bug32828.phpt b/phpt/tests/php-5.2.5/tests/lang/bug32828.phpt new file mode 100644 index 0000000000000..ad59646f5007e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug32828.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #32828 (Throwing exception in output_callback function with ob_start and ob_end_clean leads to segfault) +--FILE-- + +--EXPECTF-- +Fatal error: Uncaught exception 'Exception' in %s:%d +Stack trace: +#0 [internal function]: output_handler('', %d) +#1 %s(%d): ob_end_clean() +#2 {main} + thrown in %s on line %d diff --git a/phpt/tests/php-5.2.5/tests/lang/bug32924.phpt b/phpt/tests/php-5.2.5/tests/lang/bug32924.phpt new file mode 100644 index 0000000000000..d72b0eaa2ec6f --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug32924.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #32924 (prepend does not add file to included files) +--INI-- +include_path={PWD} +auto_prepend_file=inc.inc +--FILE-- + +END +--EXPECT-- +Included! +END diff --git a/phpt/tests/php-5.2.5/tests/lang/bug35176.phpt b/phpt/tests/php-5.2.5/tests/lang/bug35176.phpt new file mode 100755 index 0000000000000..1d1e80d9685af --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug35176.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #35176 (include()/require()/*_once() produce wrong error messages about main()) +--INI-- +html_errors=1 +error_reporting=4095 +--FILE-- + +--EXPECTF-- +
    +Warning: require_once(nonexisiting.php) [function.require-once.html]: failed to open stream: No such file or directory in %sbug35176.php on line 2
    +
    +Fatal error: require_once() [function.require.html]: Failed opening required 'nonexisiting.php' (%s) in %sbug35176.php on line 2
    diff --git a/phpt/tests/php-5.2.5/tests/lang/bug35382.phpt b/phpt/tests/php-5.2.5/tests/lang/bug35382.phpt new file mode 100755 index 0000000000000..69190d4c955b1 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug35382.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #35382 (Comment in end of file produces fatal error) +--FILEEOF-- + diff --git a/phpt/tests/php-5.2.5/tests/lang/bug38579.phpt b/phpt/tests/php-5.2.5/tests/lang/bug38579.phpt new file mode 100755 index 0000000000000..fbf98a962df89 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug38579.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #38579 (include_once() may include the same file twice) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +ok diff --git a/phpt/tests/php-5.2.5/tests/lang/bug7515.phpt b/phpt/tests/php-5.2.5/tests/lang/bug7515.phpt new file mode 100644 index 0000000000000..2a975781f6497 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/bug7515.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #7515 (weird & invisible referencing of objects) +root=new obj(); + +ob_start(); +var_dump($o); +$x=ob_get_contents(); +ob_end_clean(); + +$o->root->method(); + +ob_start(); +var_dump($o); +$y=ob_get_contents(); +ob_end_clean(); +if ($x == $y) { + print "success"; +} else { + print "failure +x=$x +y=$y +"; +} +?> +--EXPECT-- +success diff --git a/phpt/tests/php-5.2.5/tests/lang/catchable_error_001.phpt b/phpt/tests/php-5.2.5/tests/lang/catchable_error_001.phpt new file mode 100644 index 0000000000000..f6bbdd976deeb --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/catchable_error_001.phpt @@ -0,0 +1,22 @@ +--TEST-- +Catchable fatal error [1] +--FILE-- + +--EXPECTF-- +Catchable fatal error: Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_001.php on line 15 and defined in %scatchable_error_001.php on line 5 diff --git a/phpt/tests/php-5.2.5/tests/lang/catchable_error_002.phpt b/phpt/tests/php-5.2.5/tests/lang/catchable_error_002.phpt new file mode 100644 index 0000000000000..c1762b2db7120 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/catchable_error_002.phpt @@ -0,0 +1,37 @@ +--TEST-- +Catchable fatal error [2] +--FILE-- + +--EXPECTF-- +array(5) { + [0]=> + int(4096) + [1]=> + string(%d) "Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_002.php on line %d and defined" + [2]=> + string(%d) "%scatchable_error_002.php" + [3]=> + int(5) + [4]=> + array(0) { + } +} +ALIVE! diff --git a/phpt/tests/php-5.2.5/tests/lang/each_binary_safety.phpt b/phpt/tests/php-5.2.5/tests/lang/each_binary_safety.phpt new file mode 100644 index 0000000000000..bb135345464ca --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/each_binary_safety.phpt @@ -0,0 +1,13 @@ +--TEST-- +Binary safety of each() for both keys and values +--FILE-- + "foo\0bar"); +while (list($key, $val) = each($arr)) { + echo strlen($key), ': '; + echo urlencode($key), ' => ', urlencode($val), "\n"; +} +?> +--EXPECT-- +7: foo%00bar => foo%00bar diff --git a/phpt/tests/php-5.2.5/tests/lang/error_2_exception_001.phpt b/phpt/tests/php-5.2.5/tests/lang/error_2_exception_001.phpt new file mode 100644 index 0000000000000..89237fed2c694 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/error_2_exception_001.phpt @@ -0,0 +1,42 @@ +--TEST-- +ZE2 errors caught as exceptions +errno = $_errno; + $this->errmsg = $_errmsg; + } + + function getErrno() { + return $this->errno; + } + + function getErrmsg() { + return $this->errmsg; + } +} + +function ErrorsToExceptions($errno, $errmsg) { + throw new MyException($errno, $errmsg); +} + +set_error_handler("ErrorsToExceptions"); + +// make sure it isn't catching exceptions that weren't +// thrown... + +try { +} catch (MyException $exception) { + echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n"; +} + +try { + trigger_error("I will become an exception", E_USER_ERROR); +} catch (MyException $exception) { + echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n"; +} + +?> +--EXPECT-- +There was an exception: 256, 'I will become an exception' diff --git a/phpt/tests/php-5.2.5/tests/lang/foreach_with_object_001.phpt b/phpt/tests/php-5.2.5/tests/lang/foreach_with_object_001.phpt new file mode 100755 index 0000000000000..84fe625c0efb2 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/foreach_with_object_001.phpt @@ -0,0 +1,25 @@ +--TEST-- +foreach() with foreach($o->mthd()->arr) +--FILE-- +c()->a as $value) { + print "$value\n"; +} + +?> +===DONE=== +--EXPECT-- +1 +2 +3 +4 +5 +===DONE=== diff --git a/phpt/tests/php-5.2.5/tests/lang/foreach_with_references_001.phpt b/phpt/tests/php-5.2.5/tests/lang/foreach_with_references_001.phpt new file mode 100644 index 0000000000000..eb52bb8c10678 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/foreach_with_references_001.phpt @@ -0,0 +1,32 @@ +--TEST-- +foreach() with references +--FILE-- + "one", 2 => "two", 3 => "three"); + +foreach($arr as $key => $val) { + $val = $key; +} + +print_r($arr); + +foreach($arr as $key => &$val) { + $val = $key; +} + +print_r($arr); + +--EXPECT-- +Array +( + [1] => one + [2] => two + [3] => three +) +Array +( + [1] => 1 + [2] => 2 + [3] => 3 +) diff --git a/phpt/tests/php-5.2.5/tests/lang/inc.inc b/phpt/tests/php-5.2.5/tests/lang/inc.inc new file mode 100644 index 0000000000000..64b30afe47669 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/inc.inc @@ -0,0 +1,3 @@ + diff --git a/phpt/tests/php-5.2.5/tests/lang/type_hints_001.phpt b/phpt/tests/php-5.2.5/tests/lang/type_hints_001.phpt new file mode 100644 index 0000000000000..57808d474f6a8 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/type_hints_001.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 type hinting +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Catchable fatal error: Argument 1 passed to type_hint_foo() must be an instance of Foo, instance of Bar given, called in %s on line 16 and defined in %s on line 9 diff --git a/phpt/tests/php-5.2.5/tests/lang/type_hints_002.phpt b/phpt/tests/php-5.2.5/tests/lang/type_hints_002.phpt new file mode 100644 index 0000000000000..fb27f11673b5d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/type_hints_002.phpt @@ -0,0 +1,25 @@ +--TEST-- +ZE2 type hinting +f(new P); +$o->f(); +$o->f(NULL); +?> +--EXPECT-- +object(P)#2 (0) { +} +- +NULL +- +NULL +- + diff --git a/phpt/tests/php-5.2.5/tests/lang/type_hints_003.phpt b/phpt/tests/php-5.2.5/tests/lang/type_hints_003.phpt new file mode 100644 index 0000000000000..0ef3e3516bdd5 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/lang/type_hints_003.phpt @@ -0,0 +1,14 @@ +--TEST-- +ZE2 type hinting +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + +Fatal error: Default value for parameters with a class type hint can only be NULL in %stype_hints_003.php on line 3 diff --git a/phpt/tests/php-5.2.5/tests/odbc-display.php b/phpt/tests/php-5.2.5/tests/odbc-display.php new file mode 100644 index 0000000000000..f79a854aea8c8 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/odbc-display.php @@ -0,0 +1,19 @@ + diff --git a/phpt/tests/php-5.2.5/tests/odbc-t1.php b/phpt/tests/php-5.2.5/tests/odbc-t1.php new file mode 100644 index 0000000000000..90cb97910f5bd --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/odbc-t1.php @@ -0,0 +1,38 @@ + + +Quick & dirty ODBC test + + +

    ODBC Test 1 - Connection

    +"; + $conn = odbc_connect($dsn,$dbuser,$dbpwd); + if(!$conn){ +?> +

    Error connecting to database! Check DSN, username and password

    + +

    Connection successful

    +">Proceed to next test +| Change login information + +You will need permisson to create tables for the following tests! +
    + + + + +
    Database (DSN):
    User:
    Password:
    +
    + + +
    + + + diff --git a/phpt/tests/php-5.2.5/tests/odbc-t2.php b/phpt/tests/php-5.2.5/tests/odbc-t2.php new file mode 100644 index 0000000000000..a500b09e8b5b0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/odbc-t2.php @@ -0,0 +1,82 @@ + + +Quick & dirty ODBC test #2 + + +

    ODBC Test 2 - Create table

    + +

    Error connecting to database! Check DSN, username and password

    + +- OK

    +Dropping table "php3_test" + +- OK

    +Create table "php_test" + + - OK

    +Table Info:
    + + + + + + + + + + + + + +
    NameTypeLength
    +

    +


    +

    +">Proceed to next test +| Change login information + + + +

    + + + + +
    Database (DSN):
    User:
    Password:
    + +
    + + + + diff --git a/phpt/tests/php-5.2.5/tests/odbc-t3.php b/phpt/tests/php-5.2.5/tests/odbc-t3.php new file mode 100644 index 0000000000000..edfdc658f898d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/odbc-t3.php @@ -0,0 +1,95 @@ + + +Database test #3 + + +

    ODBC Test 3 - Insert records

    + +

    Error connecting to database! Check DSN, username and password

    + + - OK

    +Clearing table "php_test" + + - OK

    +Inserting into table "php_test" + + - OK

    +

    The table "php_test" should now contain the following values:

    + + + + + + + + + + + + + + + + + + + +
    ABCD
    test-11001100.01php - values 1
    test-21002200.02php - values 2
    test-31003300.03php - values 3
    test-41004400.04php - values 4
    test-51005500.05php - values 5
    + +

    Actual contents of table "php_test":

    + +

    +


    +

    +">Proceed to next test +| Change login information + +

    + + + + +
    Database:
    User:
    Password:
    + + +
    + + + + diff --git a/phpt/tests/php-5.2.5/tests/odbc-t4.php b/phpt/tests/php-5.2.5/tests/odbc-t4.php new file mode 100644 index 0000000000000..10e8f4b2d96be --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/odbc-t4.php @@ -0,0 +1,91 @@ + + +Database test #4 + + +

    ODBC Test 4 - Cursors

    +The following test requires your ODBC driver to support positioned updates

    + +

    Error connecting to database! Check DSN, username and password

    + + - OK

    +Updating table "php_test" +1002 for update'))){ + $cursor = odbc_cursor($result); + if(($upd = odbc_prepare($conn,"update php_test set a=?, b=? where current of $cursor"))){ + while(odbc_fetch_row($result)) { + $params[0] = odbc_result($result, 1) . "(*)"; + $params[1] = odbc_result($result, 2) + 2000; + odbc_execute($upd, $params); + } + odbc_commit($conn); + } + } + if($result && $upd){ +?> + - OK

    +

    The table "php_test" should now contain the following values:

    + + + + + + + + + + + + + + + + + + + + + + +
    ABCD
    test-11001100.01php3 - values 1
    test-21002200.02php - values 2
    test-3(*)3003300.03php - values 3
    test-4(*)3004400.04php - values 4
    test-5(*)3005500.05php - values 5
    + Note: If you reload this testpage,
    + the three last rows will contain different
    values in columns A and B
    +
    + +

    Actual contents of table "php_test":

    +"; + } +?> +


    +">Proceed to next test + +

    + + + + +
    Database:
    User:
    Password:
    + + +
    + + + diff --git a/phpt/tests/php-5.2.5/tests/odbc-t5.php b/phpt/tests/php-5.2.5/tests/odbc-t5.php new file mode 100644 index 0000000000000..13af52d2226d0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/odbc-t5.php @@ -0,0 +1,137 @@ + + +Database test #5 + + +

    ODBC Test 5 - Blobs

    + +

    Please select the images (gif) you want to put into the database

    +
    +Image 1:

    +Image 2:

    +Image 3:

    +Blob database type name: +

    + + + + +| +

    + + + +

    Error connecting to database! Check DSN, username and password

    + + - OK

    +Images in database"; + while(odbc_fetch_into($res, &$imgs)){ + echo "$imgs[0] : \n

    "; + } + }else{ + echo "Couldn't execute query"; + } + echo "\n\n"; + exit; + } +?> +Dropping table "php_test" + + - OK

    +Creating table "php_test": + + - OK

    +Table Info:
    + + + + + + + + + + + + + +
    NameTypeLength
    + +Inserting data: + + - OK

    +">Display Images + +

    + + + + +
    Database:
    User:
    Password:
    + + +
    + + + diff --git a/phpt/tests/php-5.2.5/tests/quicktester.inc b/phpt/tests/php-5.2.5/tests/quicktester.inc new file mode 100644 index 0000000000000..48ed6b549fa01 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/quicktester.inc @@ -0,0 +1,75 @@ +$test) +{ + // ignore empty lines + if (!$test) continue; + + // warn for trailing ; + if (substr(trim($test), -1, 1) === ';') { + echo "WARNING: trailing ';' found in test ".($n+1)."\n"; + exit; + } + + // try for operators + $operators = array('===', '~=='); + $operator = NULL; + foreach ($operators as $a_operator) { + if (strpos($test, $a_operator)!== FALSE) { + $operator = $a_operator; + list($left,$right) = explode($operator, $test); + break; + } + } + if (!$operator) { + echo "WARNING: unknown operator in '$test' (1)\n"; + exit; + } + + $left = eval("return ($left );"); + $right = eval("return ($right);"); + switch (@$operator) { + case '===': // exact match + $result = $left === $right; + break; + case '~==': // may differ after 12th significant number + if ( !is_float($left ) && !is_int($left ) + || !is_float($right) && !is_int($right)) { + $result = FALSE; + break; + } + $result = abs(($left-$right) / $left) < 1e-12; + break; + default: + echo "WARNING: unknown operator in '$test' (2)\n"; + exit; + } + + $success = $success && $result; + if (!$result) { + echo "\nAssert failed:\n"; + echo "$test\n"; + echo "Left: ";var_dump($left ); + echo "Right: ";var_dump($right); + } +} +if ($success) echo "OK"; + diff --git a/phpt/tests/php-5.2.5/tests/recurse b/phpt/tests/php-5.2.5/tests/recurse new file mode 100644 index 0000000000000..5b8c646f6b733 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/recurse @@ -0,0 +1,21 @@ + +--EXPECT-- +string(1) "=" \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/run-test/test005.phpt b/phpt/tests/php-5.2.5/tests/run-test/test005.phpt new file mode 100644 index 0000000000000..d16a66ef7a0a8 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/run-test/test005.phpt @@ -0,0 +1,32 @@ +--TEST-- +Error message handling (without ZendOptimizer) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(1) "1" +string(4) "8191" +string(1) "0" +string(1) "1" +string(1) "0" +NULL +string(%d) "%sivision by zer%s" diff --git a/phpt/tests/php-5.2.5/tests/run-test/test006.phpt b/phpt/tests/php-5.2.5/tests/run-test/test006.phpt new file mode 100644 index 0000000000000..4dca66a4f717b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/run-test/test006.phpt @@ -0,0 +1,9 @@ +--TEST-- +Error messages are shown +--FILE-- + +--EXPECTREGEX-- +.*Division by zero.* diff --git a/phpt/tests/php-5.2.5/tests/run-test/test007.phpt b/phpt/tests/php-5.2.5/tests/run-test/test007.phpt new file mode 100644 index 0000000000000000000000000000000000000000..f5f934f72ef223f8976c9774aab2c9f92bae248c GIT binary patch literal 1191 zcma)5?@Pll5cPBZiX$}G!kX&*=A0rjK@=36=!b%IU1p25Ep0_X{NKGx(ygoY#}?S~ z?%m7F-NpCkv)j4vvt?T4(Tjpc)eZCg^NXt)qDLoXQZg0o=P8l_c2OkXZ^OO~fC_~kW-s;#s9$h!pW2MS0ij~U+A362Nz;3&g*vdBzja((Y|<%4L~%32FBWM j$UUYVK8@o4HBXPELD$%N?0UG^p|8Yc#LbpnUvAbHM)*(K literal 0 HcmV?d00001 diff --git a/phpt/tests/php-5.2.5/tests/run-test/test008.phpt b/phpt/tests/php-5.2.5/tests/run-test/test008.phpt new file mode 100644 index 0000000000000..41733d96f7cb4 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/run-test/test008.phpt @@ -0,0 +1,33 @@ +--TEST-- +Error message handling (with ZendOptimizer) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +%s: %sivision by zero in %s on line %d +string(1) "1" +string(4) "8191" +string(1) "0" +string(1) "1" +string(1) "0" +string(%d) "%sivision by zer%s" +string(%d) "%sivision by zer%s" diff --git a/phpt/tests/php-5.2.5/tests/run-test/test008a.phpt b/phpt/tests/php-5.2.5/tests/run-test/test008a.phpt new file mode 100644 index 0000000000000..a7d360dc64e7c --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/run-test/test008a.phpt @@ -0,0 +1,32 @@ +--TEST-- +Error message handling (without ZendOptimizer) +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(1) "1" +string(4) "8191" +string(1) "0" +string(1) "1" +string(1) "0" +NULL +string(%d) "%sivision by zer%s" diff --git a/phpt/tests/php-5.2.5/tests/run-test/test009.phpt b/phpt/tests/php-5.2.5/tests/run-test/test009.phpt new file mode 100644 index 0000000000000..650686f69017d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/run-test/test009.phpt @@ -0,0 +1,12 @@ +--TEST-- +print_r(Object) +--FILE-- + +--EXPECTF-- +Foo Object +( +) diff --git a/phpt/tests/php-5.2.5/tests/run-test/test010.phpt b/phpt/tests/php-5.2.5/tests/run-test/test010.phpt new file mode 100644 index 0000000000000..cc3ca3591ec5a --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/run-test/test010.phpt @@ -0,0 +1,17 @@ +--TEST-- +STDIN input +--FILE-- + +--STDIN-- +fooBar +use this to input some thing to the php script +--EXPECT-- +string(54) "fooBar +use this to input some thing to the php script +" +string(0) "" +string(0) "" diff --git a/phpt/tests/php-5.2.5/tests/run.html b/phpt/tests/php-5.2.5/tests/run.html new file mode 100644 index 0000000000000..281e9e57c8b7d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/run.html @@ -0,0 +1,11 @@ + + +
    + +
    + +
    + + + diff --git a/phpt/tests/php-5.2.5/tests/run.php b/phpt/tests/php-5.2.5/tests/run.php new file mode 100644 index 0000000000000..a6792b5af72c7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/run.php @@ -0,0 +1,17 @@ + + + +Executing:
    +"); +?> +
    + + + \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/scan_cases b/phpt/tests/php-5.2.5/tests/scan_cases new file mode 100644 index 0000000000000..d562230fde115 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/scan_cases @@ -0,0 +1,28 @@ +# Test file used by testscanf.php. Feel free to add additional cases +# sscanf test cases. formatted to be slurped and split by explode +%d|48| valid decimal (positive) +%d|-98| valid signed decimal (negative) +%d|56a| integer scan : decimal digit followed by alpha +%4d|558071|decimal integer with width specification +%i|-5489|valid signed integer (negative) +%s| the rain in spain | plain ole string matched with %s +%10s|jabberwocky| string with width specifier +%f|289.071| valid float (%f) +%f|-0.403| valid negative (%f) +%3f|76.4|Float with width specifier ending at decimal point +%3f"|789.4|Float with width specifier +%o|0321|octal with leading 0 +%o|327| valid octal digits +%o|380| octal scan with octal digit followed by non-octal +%x|fe| valid hex| +%x|0xfe| "c" style hex with leading 0x| +%x|455| hex with all single digits < f +%x|-98| hex (negative signed int) +%c|y| single char +%4c|tulips|Character with width specification (4) +%e|10e-9| signed floating point with negative exponent +%e|10e+9| signed floating point with explicit positive exponent +%e|10e9| signed floating point with positive exponent (no + sign) +# next we test multiple cases + %d %i %o %u %x %s %c %e %f %g | 19 84 0666 2000 0xface your x 31e+9 0.912 2.4 |multiple specifiers + diff --git a/phpt/tests/php-5.2.5/tests/strings/001.phpt b/phpt/tests/php-5.2.5/tests/strings/001.phpt new file mode 100644 index 0000000000000..d5e2f64774459 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/strings/001.phpt @@ -0,0 +1,210 @@ +--TEST-- +String functions +--FILE-- +?' + . '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_' + . '`abcdefghijklmnopqrstuvwxyz{|}~' + . "\0"; + +echo "Testing rawurlencode: "; +$encoded = rawurlencode($raw); +$correct = '%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F' + . '%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_' + . '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E' + . '%00'; +if ($encoded == $correct) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing rawurldecode: "; +$decoded = rawurldecode($correct); +if ($decoded == $raw) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing urlencode: "; +$encoded = urlencode($raw); +$correct = '+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F' + . '%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_' + . '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E' + . '%00'; +if ($encoded == $correct) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing urldecode: "; +$decoded = urldecode($correct); +if ($decoded == $raw) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing quotemeta: "; +$raw = "a.\\+*?" . chr(91) . "^" . chr(93) . "b\$c"; +$quoted = quotemeta($raw); +if ($quoted == "a\\.\\\\\\+\\*\\?\\[\\^\\]b\\\$c") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing ufirst: "; +$str = "fahrvergnuegen"; +$uc = ucfirst($str); +if ($uc == "Fahrvergnuegen") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing strtr: "; +$str = "test abcdefgh"; +$tr = strtr($str, "def", "456"); +if ($tr == "t5st abc456gh") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing addslashes: "; +$str = "\"\\'"; +$as = addslashes($str); +if ($as == "\\\"\\\\\\'") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing stripslashes: "; +$str = "\$\\'"; +$ss = stripslashes($str); +if ($ss == "\$'") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + + +echo "Testing uniqid: "; +$str = "prefix"; +$ui1 = uniqid($str); +$ui2 = uniqid($str); + +$len = strncasecmp(PHP_OS, 'CYGWIN', 6) ? 19 : 29; + +if (strlen($ui1) == strlen($ui2) && strlen($ui1) == $len && $ui1 != $ui2) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +?> +--EXPECT-- +Testing strtok: passed +Testing strstr: passed +Testing strrchr: passed +Testing strtoupper: passed +Testing strtolower: passed +Testing substr: passed +Testing rawurlencode: passed +Testing rawurldecode: passed +Testing urlencode: passed +Testing urldecode: passed +Testing quotemeta: passed +Testing ufirst: passed +Testing strtr: passed +Testing addslashes: passed +Testing stripslashes: passed +Testing uniqid: passed diff --git a/phpt/tests/php-5.2.5/tests/strings/002.phpt b/phpt/tests/php-5.2.5/tests/strings/002.phpt new file mode 100644 index 0000000000000..7b95a256450b4 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/strings/002.phpt @@ -0,0 +1,83 @@ +--TEST-- +Formatted print functions +--FILE-- +\n", "foo"); +printf("printf test 9:<%-20s>\n", "bar"); +printf("printf test 10: 123456789012345\n"); +printf("printf test 10:<%15s>\n", "høyesterettsjustitiarius"); +printf("printf test 11: 123456789012345678901234567890\n"); +printf("printf test 11:<%30s>\n", "høyesterettsjustitiarius"); +printf("printf test 12:%5.2f\n", -12.34); +printf("printf test 13:%5d\n", -12); +printf("printf test 14:%c\n", 64); +printf("printf test 15:%b\n", 170); +printf("printf test 16:%x\n", 170); +printf("printf test 17:%X\n", 170); +printf("printf test 18:%16b\n", 170); +printf("printf test 19:%16x\n", 170); +printf("printf test 20:%16X\n", 170); +printf("printf test 21:%016b\n", 170); +printf("printf test 22:%016x\n", 170); +printf("printf test 23:%016X\n", 170); +printf("printf test 24:%.5s\n", "abcdefghij"); +printf("printf test 25:%-2s\n", "gazonk"); +printf("printf test 26:%2\$d %1\$d\n", 1, 2); +printf("printf test 27:%3\$d %d %d\n", 1, 2, 3); +printf("printf test 28:%2\$02d %1\$2d\n", 1, 2); +printf("printf test 29:%2\$-2d %1\$2d\n", 1, 2); +print("printf test 30:"); printf("%0\$s", 1); print("x\n"); +vprintf("vprintf test 1:%2\$-2d %1\$2d\n", array(1, 2)); + + +?> +--EXPECT-- +fprintf test 1:abcde +int(20) +printf test 1:simple string +printf test 2:42 +printf test 3:3.333333 +printf test 4:3.3333333333 +printf test 5:2.50 +printf test 6:2.50000000 +printf test 7:0000002.50 +printf test 8:< foo> +printf test 9: +printf test 10: 123456789012345 +printf test 10: +printf test 11: 123456789012345678901234567890 +printf test 11:< høyesterettsjustitiarius> +printf test 12:-12.34 +printf test 13: -12 +printf test 14:@ +printf test 15:10101010 +printf test 16:aa +printf test 17:AA +printf test 18: 10101010 +printf test 19: aa +printf test 20: AA +printf test 21:0000000010101010 +printf test 22:00000000000000aa +printf test 23:00000000000000AA +printf test 24:abcde +printf test 25:gazonk +printf test 26:2 1 +printf test 27:3 1 2 +printf test 28:02 1 +printf test 29:2 1 +printf test 30:x +vprintf test 1:2 1 diff --git a/phpt/tests/php-5.2.5/tests/strings/004.phpt b/phpt/tests/php-5.2.5/tests/strings/004.phpt new file mode 100644 index 0000000000000..a283fda6991ec --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/strings/004.phpt @@ -0,0 +1,22 @@ +--TEST-- +highlight_string() buffering +--INI-- +highlight.string=#DD0000 +highlight.comment=#FF9900 +highlight.keyword=#007700 +highlight.bg=#FFFFFF +highlight.default=#0000BB +highlight.html=#000000 +--FILE-- +
    "); +$var = highlight_string("

    ", TRUE); +echo "\n[$var]\n"; +?> +--EXPECT-- + +<br /><?php echo "foo"?><br /> + +[ +<br /><?php echo "bar"?><br /> +] diff --git a/phpt/tests/php-5.2.5/tests/strings/bug22592.phpt b/phpt/tests/php-5.2.5/tests/strings/bug22592.phpt new file mode 100755 index 0000000000000..6c8edee034a5e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/strings/bug22592.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #22592 (Cascading assignments to strings with curly braces broken) +--FILE-- + +--EXPECT-- +string(6) "abcdef" +string(6) "abcdef" +string(6) "a*c*e*" +string(6) "a*c*e*" diff --git a/phpt/tests/php-5.2.5/tests/strings/bug26703.phpt b/phpt/tests/php-5.2.5/tests/strings/bug26703.phpt new file mode 100644 index 0000000000000..f21bcb900aee3 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/strings/bug26703.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #26703 (Certain characters inside strings incorrectly treated as keywords) +--INI-- +highlight.string=#DD0000 +highlight.comment=#FF9900 +highlight.keyword=#007700 +highlight.bg=#FFFFFF +highlight.default=#0000BB +highlight.html=#000000 +--FILE-- +'); +?> +--EXPECT-- + +<?php echo "foo[] $a \n"?> + + diff --git a/phpt/tests/php-5.2.5/tests/test.pl b/phpt/tests/php-5.2.5/tests/test.pl new file mode 100644 index 0000000000000..2502cb1298188 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/test.pl @@ -0,0 +1,34 @@ +class_name; + } +}; + + +class ChildClass { + var $class_name = "ChildClass"; + + function ChildClass($value, $new_value) { + BaseClass::BaseClass($value); + print "new value is '$new_value'\n"; + } + function MyClassName($a_value) { + return BaseClass::MyClassName()." and the value is '$a_value'"; + } +}; + + +$obj = new ChildClass("Test", "Another test"); +print $obj->MyClassName("not interesting"); \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/testarray b/phpt/tests/php-5.2.5/tests/testarray new file mode 100644 index 0000000000000..bee5cca546c79 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/testarray @@ -0,0 +1,21 @@ +This is a small test.... +Version}\n"; +$word->Visible = 1; +$word->Documents->Add(); +$word->Selection->TypeText("This is a test..."); +$word->Quit(); +/* +$word->Documents[1]->SaveAs("Useless test.doc"); +*/ +?> \ No newline at end of file diff --git a/phpt/tests/php-5.2.5/tests/testcpdf b/phpt/tests/php-5.2.5/tests/testcpdf new file mode 100644 index 0000000000000..a74087d18e00d --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/testcpdf @@ -0,0 +1,97 @@ + diff --git a/phpt/tests/php-5.2.5/tests/testcpdfclock b/phpt/tests/php-5.2.5/tests/testcpdfclock new file mode 100644 index 0000000000000..c885cc8e09dd7 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/testcpdfclock @@ -0,0 +1,87 @@ + 0) { + cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0); + + cpdf_set_page_animation($pdf, 4, 0.5, 0, 0, 0); /* wipe */ + + cpdf_translate($pdf, $radius + $margin, $radius + $margin); + cpdf_save($pdf); + cpdf_setrgbcolor($pdf, 0.0, 0.0, 1.0); + + /* minute strokes */ + cpdf_setlinewidth($pdf, 2.0); + for ($alpha = 0; $alpha < 360; $alpha += 6) + { + cpdf_rotate($pdf, 6.0); + cpdf_moveto($pdf, $radius, 0.0); + cpdf_lineto($pdf, $radius-$margin/3, 0.0); + cpdf_stroke($pdf); + } + + cpdf_restore($pdf); + cpdf_save($pdf); + + /* 5 minute strokes */ + cpdf_setlinewidth($pdf, 3.0); + for ($alpha = 0; $alpha < 360; $alpha += 30) + { + cpdf_rotate($pdf, 30.0); + cpdf_moveto($pdf, $radius, 0.0); + cpdf_lineto($pdf, $radius-$margin, 0.0); + cpdf_stroke($pdf); + } + + $ltime = getdate(); + + /* draw hour hand */ + cpdf_save($pdf); + cpdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0); + cpdf_moveto($pdf, -$radius/10, -$radius/20); + cpdf_lineto($pdf, $radius/2, 0.0); + cpdf_lineto($pdf, -$radius/10, $radius/20); + cpdf_closepath($pdf); + cpdf_fill($pdf); + cpdf_restore($pdf); + + /* draw minute hand */ + cpdf_save($pdf); + cpdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0); + cpdf_moveto($pdf, -$radius/10, -$radius/20); + cpdf_lineto($pdf, $radius * 0.8, 0.0); + cpdf_lineto($pdf, -$radius/10, $radius/20); + cpdf_closepath($pdf); + cpdf_fill($pdf); + cpdf_restore($pdf); + + /* draw second hand */ + cpdf_setrgbcolor($pdf, 1.0, 0.0, 0.0); + cpdf_setlinewidth($pdf, 2); + cpdf_save($pdf); + cpdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0)); + cpdf_moveto($pdf, -$radius/5, 0.0); + cpdf_lineto($pdf, $radius, 0.0); + cpdf_stroke($pdf); + cpdf_restore($pdf); + + /* draw little circle at center */ + cpdf_circle($pdf, 0, 0, $radius/30); + cpdf_fill($pdf); + + cpdf_restore($pdf); + + cpdf_finalize_page($pdf, $pagecount+1); +} + +cpdf_finalize($pdf); +cpdf_save_to_file($pdf, $pdffilename); +$pdf = cpdf_close($pdf); +?> diff --git a/phpt/tests/php-5.2.5/tests/testdom b/phpt/tests/php-5.2.5/tests/testdom new file mode 100644 index 0000000000000..c7012e0e3c1a0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/testdom @@ -0,0 +1,73 @@ + + +]> + +Title + +&sp; + + + + +a1b1c1 +a2c2 +a3b3c3 + + + + + "; + +echo "Test 1: accessing single nodes from php\n"; +$dom = xmldoc($xmlstr); +if(!$dom) { + echo "Error while parsing the document\n"; + exit; +} + +$children = $dom->childNodes(); +print_r($children); + +echo "--------- root\n"; +$rootnode = $dom->documentElement(); +print_r($rootnode); + +echo "--------- children of root\n"; +$children = $rootnode->childNodes(); +print_r($children); + +// The last node should be identical with the last entry in the children array +echo "--------- last\n"; +$last = $rootnode->lastChild(); +print_r($last); + +// The parent of this last node is the root again +echo "--------- parent\n"; +$parent = $last->parent(); +print_r($parent); + +// The children of this parent are the same children as one above +echo "--------- children of parent\n"; +$children = $parent->childNodes(); +print_r($children); + +echo "--------- creating a new attribute\n"; +$attr = $dom->createAttribute("src", "picture.gif"); +print_r($attr); + +$rootnode->setAttributeNode($attr); /* Not implemented */ +$attr = $rootnode->setAttribute("src", "picture.gif"); +$attr = $rootnode->getAttribute("src"); +print_r($attr); + +echo "--------- attribute of rootnode\n"; +$attrs = $rootnode->attributes(); +print_r($attrs); + +echo "--------- children of an attribute\n"; +$children = $attrs[0]->childNodes(); +print_r($children); + +?> diff --git a/phpt/tests/php-5.2.5/tests/testfe b/phpt/tests/php-5.2.5/tests/testfe new file mode 100644 index 0000000000000..ea627606353f0 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/testfe @@ -0,0 +1,18 @@ +"ge:Hier der Titel", "Author"=>"Hier der Autor")); + echo $objrec."\n"; + $objrec .= "\nTitle=en:Here the title"; + echo "Add another title and convert it back to an object array\n"; + $objarr = hw_objrec2array($objrec); + list_attr($objarr); + } + + if($test_4 == "yes") { + echo "TEST 4 ----------------------------------------------\n"; + echo "Get the object array of document with id 0x".dechex($id)."\n"; + $objrec = hw_getobject($connect, $id); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + $objarr = hw_objrec2array($objrec); + list_attr($objarr); + } + + if($test_5 == "yes") { + echo "TEST 5 ----------------------------------------------\n"; + echo "List the children of collection 0x".dechex($collid)."\n"; + $children = hw_childrenobj($connect, $collid); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + $c_children = count($children) - 1; + for($i=0; $i<$c_children; $i++) { + $objarr = hw_objrec2array($children[$i]); + list_attr($objarr); + } + list_attr($children[$c_children]); + } + + if($test_6 == "yes") { + echo "TEST 6 ----------------------------------------------\n"; + echo "List the parents of object 0x".dechex($id)."\n"; + $parents = hw_getparentsobj($connect, $collid); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + $c_parents = count($parents) - 1; + for($i=0; $i<$c_parents; $i++) { + $objarr = hw_objrec2array($parents[$i]); + list_attr($objarr); + } + list_attr($parents[$c_parents]); + } + + if($test_7 == "yes") { + echo "TEST 7 ----------------------------------------------\n"; + echo "Inserting a new text document into 0x".dechex($collid)."\n"; + $objrec = "Type=Document\nDocumentType=text\nName=HWTest\nTitle=en:Component\nMimeType=text/plain\nAuthor=".$username; + $contents = "Ein bischen Text"; + $doc = hw_new_document($objrec, $contents, strlen($contents)+1); + $objid = hw_insertdocument($connect, $collid, $doc); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + $objrec = hw_getobject($connect, $objid); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + $objarr = hw_objrec2array($objrec); + list_attr($objarr); + } + + if($test_8 == "yes") { + echo "TEST 8 ----------------------------------------------\n"; + echo "Removing text document just inserted\n"; + $kk[0] = (int) $objid; + hw_mv($connect, $kk, $collid, 0); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + exit; + } + echo "If the document was really deleted you should see an error now\n"; + $objrec = hw_getobject($connect, $objid); + if(hw_error($connect)) { + echo "ERROR: ".hw_errormsg($connect)."\n"; + } else { + $objarr = hw_objrec2array($objrec); + list_attr($objarr); + } + } + + if($test_9 == "yes") { + echo "TEST 9 ----------------------------------------------\n"; + echo "Searching for objects with $query\n"; + $objrecs = hw_getobjectbyqueryobj($connect, $query, -1); + $c_objrecs = count($objrecs) - 1; + echo "$c_objrecs found\n"; + for($i=0; $i<$c_objrecs; $i++) { + $objarr = hw_objrec2array($objrecs[$i]); + list_attr($objarr); + } + list_attr($objrecs[$c_objrecs]); + } + + if($test_10 == "yes") { + $anchors = hw_getanchorsobj($connect, $id); + $countanchors = count($anchors) - 1; + echo "$countanchors Anchors of Object $id\n"; + for($i=0; $i<$countanchors; $i++) { + $arr = hw_objrec2array($anchors[$i]); + list_attr($arr); + } + } + + if($test_11 == "yes") { + $doc = hw_new_document_from_file("ObjectRecord", "hw_document.txt"); + hw_output_document($doc); + } + + if($test_12 == "yes") { + $doc = hw_new_document_from_file("ObjectRecord", "hw_document.txt"); + hw_insertanchors($doc, array("Position=0x2 0x7\nObjectID=0x3\nTAnchor=Src\nDest=0x5"), array("ObjectID=0x5\nName=DestDoc")); + hw_output_document($doc); + } + + hw_close($connect); +?> diff --git a/phpt/tests/php-5.2.5/tests/testinclude b/phpt/tests/php-5.2.5/tests/testinclude new file mode 100644 index 0000000000000..1e9854370d110 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/testinclude @@ -0,0 +1,5 @@ + diff --git a/phpt/tests/php-5.2.5/tests/testobj b/phpt/tests/php-5.2.5/tests/testobj new file mode 100644 index 0000000000000..66b003ce9c651 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/testobj @@ -0,0 +1,29 @@ +initialized = 1; + } +}; + +class barbara extends foobar { + +}; + +$name = "foobar"; +$foo = new $name; // or die("Unable to construct foobar\n"); +//print $foo->initialized; + +$boo = new barbara; +print get_class($foo).endl; +print get_parent_class($foo).endl; +print get_class($boo).endl; +print get_parent_class($boo).endl; +print method_exists($foo,"foobar").endl; +print method_exists($boo,"foobar").endl; +print method_exists($boo,"barbara").endl; +//$word = new COm("word.application"); +//$word->visible = true; +//sleep(5); +//$word->quit(); diff --git a/phpt/tests/php-5.2.5/tests/testpfpro.php b/phpt/tests/php-5.2.5/tests/testpfpro.php new file mode 100644 index 0000000000000..ffb1784bdca9e --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/testpfpro.php @@ -0,0 +1,39 @@ +\n\n"; + +echo "Payflow Pro library is version ".pfpro_version()."\n"; + +pfpro_init(); + +$transaction = array(USER => 'mylogin', + PWD => 'mypassword', + TRXTYPE => 'S', + TENDER => 'C', + AMT => 1.50, + ACCT => '4111111111111111', + EXPDATE => '0900' + ); + +$response = pfpro_process($transaction); + +if (!$response) { + die("Couldn't establish link to signio software.\n"); +} + +echo "Signio response code was ".$response[RESULT]; +echo ", which means: ".$response[RESPMSG]."\n"; + +echo "\nDump of the transaction request "; +print_r($transaction); + +echo "\nDump of the response "; +print_r($response); + +pfpro_cleanup(); + +?> diff --git a/phpt/tests/php-5.2.5/tests/tests.dsp b/phpt/tests/php-5.2.5/tests/tests.dsp new file mode 100644 index 0000000000000..fc19dcfe43125 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/tests.dsp @@ -0,0 +1,61 @@ +# Microsoft Developer Studio Project File - Name="tests" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) External Target" 0x0106 + +CFG=tests - 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 "tests.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 "tests.mak" CFG="tests - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "tests - Win32 Debug" (based on "Win32 (x86) External Target") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "." +# PROP BASE Intermediate_Dir "." +# PROP BASE Cmd_Line "NMAKE /f tests.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "tests.exe" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "." +# PROP Intermediate_Dir "." +# PROP Cmd_Line "nmake /nologo /f tests.mak" +# PROP Rebuild_Opt "/a" +# PROP Target_File "__test_run_complete__" +# PROP Bsc_Name "" +# PROP Target_Dir "" +# Begin Target + +# Name "tests - Win32 Debug" + +!IF "$(CFG)" == "tests - Win32 Debug" + +!ENDIF + +# Begin Source File + +SOURCE="..\run-tests.php" +# End Source File +# Begin Source File + +SOURCE=.\tests.mak +# End Source File +# End Target +# End Project diff --git a/phpt/tests/php-5.2.5/tests/tests.mak b/phpt/tests/php-5.2.5/tests/tests.mak new file mode 100644 index 0000000000000..8b4714354405b --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/tests.mak @@ -0,0 +1,27 @@ +# +# Win32 Makefile to run the PHP unit tests. +# +# TEST_PHP_EXECUTABLE +# Required - must point to the PHP executable to test. +# +# TEST_PHP_ERROR_STYLE +# Optional - specifies error format to output so IDE can jump to test source and log. +# Values: MSVC (Microsoft Visual C++), Emacs +# +# TEST_PHP_DETAILED +# Optional - generates a more complete and detailed log if set. +# Values: 0 or unset - no details; 1 - detailed. +# + +all : run-tests + +BIN=Debug_TS + +# Specific test(s) to run (all if not specified). +TESTS= + +run-tests : + set TEST_PHP_EXECUTABLE=$(BIN)\php-cgi.exe + set TEST_PHP_ERROR_STYLE=MSVC + set TEST_PHP_DETAILED=0 + cd .. && $(BIN)\php-cgi.exe -c tests -f run-tests.php $(TESTS) | tee tests.log diff --git a/phpt/tests/php-5.2.5/tests/testscanf.php b/phpt/tests/php-5.2.5/tests/testscanf.php new file mode 100644 index 0000000000000..ad530978c5298 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/testscanf.php @@ -0,0 +1,113 @@ +") { + if (is_array($val)) { + for ($i = 0;$i< count($val);$i++) { + echo $val[$i] . $postfix; + } + } else { + echo $val . $postfix; + } +} + +function do_sscanf($string, $format) { + $s = "sscanf(\"" . $string . ",\"" . $format ."\")."; + echo "$s
    "; + $s = str_repeat("-", strlen($s)); + echo "$s
    "; + $output = sscanf($string,$format); + echo "Result : "; + print_value( $output ); + echo "$s

    "; +} + + +function run_sscanf_test_cases($filename="scan_cases") +{ + + echo "


    Running Test Cases from $filename

    "; + $arr = file($filename); + for ($i=0;$i < count($arr);$i++) { + $line_arr = explode("|",$arr[$i]); + + $format = $line_arr[0]; + $string = $line_arr[1]; + if (count($arr) > 2) { + $comment = $line_arr[2]; + } else { + $comment = ""; + } + if ( empty($format) || empty($string) ) { + continue; + } + print("

    ** Case : $comment ******************************

    "); + do_sscanf($string,$format); + } +} + +function simple_tests() { + echo "Testing sscanf with standard ANSI syntax (values returned by +reference)-
    "; + $decimal = -1; + $string = ""; + $hex = 0; + $float = 0.0; + $octal = 0.0; + $int = -1; + + echo "


    Simple Test

    "; + echo "sscanf('10','%d',&\$decimal)
    "; + echo "
    BEFORE :
    decimal = $decimal."; + $foo = sscanf("10","%d",&$decimal); + echo "
    AFTER :
    decimal = $decimal
    "; + + + echo "


    Simple Test 2

    "; + echo "sscanf(\"ghost 0xface\",\"%s %x\",&\$string, &\$int)
    "; + echo "
    BEFORE :
    string = $string, int = $int
    "; + $foo = sscanf("ghost 0xface","%s %x",&$string, &$int); + echo "
    AFTER :
    string = $string, int = $int
    "; + echo " sscan reports : "; + print_value( $foo,""); + echo " conversions
    "; + + echo "


    Multiple specifiers

    "; + echo "sscanf(\"jabberwocky 1024 0xFF 1.024 644 10\", + \"%s %d %x %f %o %i\", + &\$string,&\$decimal,&\$hex,&\$float,&\$octal,&\$int);
    "; + echo "
    BEFORE :
    "; + echo "Decimal = $decimal, String = $string, Hex = $hex
    "; + echo "Octal = $octal , Float = $float, Int = $int
    "; + $foo = sscanf( "jabberwocky 1024 0xFF 1.024 644 10", + "%s %d %x %f %o %i", + &$string,&$decimal,&$hex,&$float,&$octal,&$int); + echo "
    AFTER :
    "; + echo "decimal = $decimal, string = $string, hex = $hex
    "; + echo "octal = $octal , float = $float, int = $int
    "; + + echo " sscan reports : "; + print_value( $foo,""); + echo " conversions
    "; + echo "----------------------------------------
    "; +} + + + +?> + + + Test of sscanf() + + +

    Testing sscanf() support in PHP


    + I'm sorry but sscanf() does not exist !i
    "; + } else { + simple_tests(); + run_sscanf_test_cases(); + } + ?> + + diff --git a/phpt/tests/php-5.2.5/tests/testswf b/phpt/tests/php-5.2.5/tests/testswf new file mode 100644 index 0000000000000..e26733237d8b4 --- /dev/null +++ b/phpt/tests/php-5.2.5/tests/testswf @@ -0,0 +1,120 @@ + diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000000000..d1ccbda91dd99 --- /dev/null +++ b/src/Makefile @@ -0,0 +1,44 @@ + +PROJECT_ROOT = .. +PROJECT_NAME = hphp_runtime + +EVAL_DIR=cpp/eval + +RECURSIVE_SOURCE_SUBDIRS = cpp/base cpp/ext lib/system/gen util $(EVAL_DIR) +CXX_NOOPT_SOURCES = $(shell find $(RECURSIVE_SOURCE_SUBDIRS) -name "*.no.cpp") +CXX_SOURCES = $(filter-out $(CXX_NOOPT_SOURCES), \ + $(shell find $(RECURSIVE_SOURCE_SUBDIRS) -name "*.cpp")) +C_SOURCES = $(shell find $(RECURSIVE_SOURCE_SUBDIRS) -name "*.c") + +PROGRAMS = test hphp hphpi lib +SUB_CLEAN_DIRS = idl hphp cpp + +# Include gen files here +include $(EVAL_DIR)/gen.mk +C_SOURCES := $(filter-out $(GENERATED_CPP_SOURCES) $(GENERATED_C_SOURCES),\ + $(C_SOURCES)) +CXX_SOURCES := $(filter-out $(GENERATED_CXX_SOURCES), $(CXX_SOURCES)) + +include $(PROJECT_ROOT)/src/rules.mk + +EXCEPTIONS = $(shell find $(EXT_DIR)/mozilla -name "*.a") + +STATIC_LIBS = $(shell echo $(filter-out $(EXCEPTIONS), $(ALL_LIBS)) \ + | sed -e "s/libsicu/libicu/g") + +SHARED_LIBS = $(EXT_DIR)/icu/lib/libicuuc.so \ + $(EXT_DIR)/binutils/libbinutils.so \ + $(shell find $(EXT_DIR)/mozilla -name "*.so") \ + $(patsubst %.a, %.so, $(STATIC_LIBS)) \ + $(LINK_LIBS) \ + +EXTERNAL += $(SHARED_LIBS) + +TARGETS = $(PROGRAMS) $(SHARED_LIB) $(STATIC_LIB) + +all: $(TARGETS) + +$(PROGRAMS) : $(STATIC_LIB) +hphp: lib +hphpi : hphp +test: lib diff --git a/src/cpp/Makefile b/src/cpp/Makefile new file mode 100644 index 0000000000000..4dfd43e41f8a7 --- /dev/null +++ b/src/cpp/Makefile @@ -0,0 +1,14 @@ + +PROJECT_ROOT = ../.. + +LIB_TARGETS = base ext eval +PROGRAMS = tmp +SUB_CLEAN_DIRS = tmp + +include $(PROJECT_ROOT)/src/rules.mk +TARGETS = $(LIB_TARGETS) + +all: $(TARGETS) + +bridge: base +ext: base diff --git a/src/cpp/base/Makefile b/src/cpp/base/Makefile new file mode 100644 index 0000000000000..55a57943aec8e --- /dev/null +++ b/src/cpp/base/Makefile @@ -0,0 +1,15 @@ + +PROJECT_ROOT = ../../.. +PROJECT_NAME = hphp_cpp_base + +AUTO_SOURCES_RECURSIVE = 1 + +include $(PROJECT_ROOT)/src/rules.mk + +ifdef MAC_OS_X +TARGETS = $(STATIC_LIB) +else +TARGETS = $(STATIC_LIB) $(SHARED_LIB) +endif + +all: $(TARGETS) diff --git a/src/cpp/base/array/array_data.cpp b/src/cpp/base/array/array_data.cpp new file mode 100644 index 0000000000000..dbc341a8bd178 --- /dev/null +++ b/src/cpp/base/array/array_data.cpp @@ -0,0 +1,424 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ArrayData *ArrayData::Create() { + if (RuntimeOption::UseZendArray) { + return StaticEmptyZendArray::Get(); + } + return StaticEmptyArray::Get(); +} + +ArrayData *ArrayData::Create(CVarRef value) { + if (RuntimeOption::UseZendArray) { + ArrayData *ret = NEW(ZendArray)(1); + ret->append(value, false); + return ret; + } +#ifndef FORCE_VARIANT_ARRAYS + if (!value.isContagious()) { + switch (value.getType()) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return NEW(VectorLong)(value.toInt64()); + case LiteralString: + case KindOfString: + return NEW(VectorString)(value.toString()); + default: + break; + } + } +#endif + return NEW(VectorVariant)(value); +} + +ArrayData *ArrayData::Create(CVarRef name, CVarRef value) { + if (RuntimeOption::UseZendArray) { + ArrayData *ret = NEW(ZendArray)(1); + ret->set(name, value, false); + return ret; + } + if (!value.isContagious()) { + bool isZero = name.isInteger() && name.toInt64() == 0; +#ifndef FORCE_VARIANT_ARRAYS + switch (value.getType()) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + if (isZero) { + return NEW(VectorLong)(value.toInt64()); + } + return NEW(MapLong)(name, value.toInt64()); + case LiteralString: + case KindOfString: + if (isZero) { + return NEW(VectorString)(value.toString()); + } + return NEW(MapString)(name, value.toString()); + default: + if (isZero) { + return NEW(VectorVariant)(value); + } + break; + } +#else + if (isZero) { + return NEW(VectorVariant)(value); + } +#endif + } + return NEW(MapVariant)(name, value); +} + +ArrayData *ArrayData::Create(const std::vector &elems, + bool replace /* = true */, + bool release /* = true */) { + if (elems.empty()) { + return Create(); + } + + if (RuntimeOption::UseZendArray) { + uint size = elems.size(); + ArrayData *ret = NEW(ZendArray)(size); + for (unsigned int i = 0; i < size; i++) { + ArrayElement *elem = elems[i]; + if (elem->hasName()) { + ret->set(elem->getName(), elem->getVariant(), false, elem->getHash()); + } else { + ret->append(elem->getVariant(), false); + } + if (release) elem->release(); + } + return ret; + } + + DataType typeAll = KindOfNull; + bool associative = false; + uint size = elems.size(); + for (unsigned int i = 0; i < size; i++) { + ArrayElement *elem = elems[i]; + + DataType type = elem->getType(); + if (type != typeAll) { + if (typeAll == KindOfNull) { + typeAll = type; + } else { + typeAll = KindOfVariant; + } + } + if (elem->hasName()) associative = true; + + // nothing more to find about + if (typeAll == KindOfVariant && associative) break; + } + + ArrayData *ret = NULL; +#ifndef FORCE_VARIANT_ARRAYS + switch (typeAll) { + case KindOfInt64: + if (associative) { + ret = NEW(MapLong)(elems, replace); + } else { + ret = NEW(VectorLong)(elems); + } + break; + case KindOfString: + if (associative) { + ret = NEW(MapString)(elems, replace); + } else { + ret = NEW(VectorString)(elems); + } + break; + case KindOfVariant: + if (associative) { + ret = NEW(MapVariant)(elems, replace); + } else { + ret = NEW(VectorVariant)(elems); + } + break; + default: + ASSERT(false); + break; + } +#else + if (associative) { + ret = NEW(MapVariant)(elems, replace); + } else { + ret = NEW(VectorVariant)(elems); + } +#endif + if (release) { + size = elems.size(); + for (unsigned int i = 0; i < size; i++) { + elems[i]->release(); + } + } + + return ret; +} + +ArrayData::~ArrayData() { +} + +/////////////////////////////////////////////////////////////////////////////// +// reads + +Object ArrayData::toObject() const { + Object ret = NEW(c_stdclass)(); + ret->o_set(Array(const_cast(this))); + return ret; +} + +CVarRef ArrayData::getValueRef(ssize_t pos) const { + throw FatalErrorException("taking reference from an r-value"); +} + +bool ArrayData::isVectorData() const { + for (ssize_t i = 0; i < size(); i++) { + if (getIndex(i) != i) { + return false; + } + } + return true; +} + +int ArrayData::compare(const ArrayData *v2, bool strict) const { + ASSERT(v2); + + int count1 = size(); + int count2 = v2->size(); + if (count1 < count2) return -1; + if (count1 > count2) return 1; + if (count1 == 0) return 0; + + if (strict) { + for (ArrayIter iter1(this), iter2(v2); iter1 && iter2; ++iter1, ++iter2) { + Variant key1 = iter1.first(); + Variant key2 = iter2.first(); + if (!key1.same(key2)) return 1; // or -1 + + Variant value1 = iter1.second(); + Variant value2 = iter2.second(); + if (!value1.same(value2)) return 1; // or -1 + } + } else { + for (ArrayIter iter(this); iter; ++iter) { + Variant key = iter.first(); + if (!v2->exists(key)) return 1; + + Variant value1 = iter.second(); + Variant value2 = v2->get(key); + if (value1.more(value2)) return 1; + if (value1.less(value2)) return -1; + } + } + + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// +// stack and queue operations + +ArrayData *ArrayData::pop(Variant &value) { + if (!empty()) { + ssize_t pos = iter_end(); + value = getValue(pos); + return remove(getKey(pos), getCount() > 1); + } + value = null; + return NULL; +} + +ArrayData *ArrayData::dequeue(Variant &value) { + if (!empty()) { + ssize_t pos = iter_begin(); + value = getValue(pos); + ArrayData *ret = remove(getKey(pos), getCount() > 1); + + // In PHP, array_shift() will cause all numerically key-ed values re-keyed + if (ret) { + ret->renumber(); + } else { + renumber(); + } + + return ret; + } + value = null; + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +// MutableArrayIter related functions + +void ArrayData::getFullPos(FullPos &pos) { + pos.primary = ArrayData::invalid_index; +} +bool ArrayData::setFullPos(const FullPos &pos) { + return false; +} +CVarRef ArrayData::currentRef() { + if (m_pos >= 0 && m_pos < size()) { + return getValueRef(m_pos); + } + throw FatalErrorException("invalid ArrayData::m_pos"); +} +CVarRef ArrayData::endRef() { + if (m_pos >= 0 && m_pos < size()) { + return getValueRef(size() - 1); + } + throw FatalErrorException("invalid ArrayData::m_pos"); +} + +/////////////////////////////////////////////////////////////////////////////// +// Default implementation of position-based iterations. + +Variant ArrayData::reset() { return value(m_pos = 0);} +Variant ArrayData::prev() { return value(--m_pos);} +Variant ArrayData::next() { return value(++m_pos);} +Variant ArrayData::end() { return value(m_pos = size() - 1);} + +Variant ArrayData::key() const { + if (m_pos >= 0 && m_pos < size()) { + return getKey(m_pos); + } + return null; +} + +Variant ArrayData::value(ssize_t &pos) const { + if (pos >= 0 && pos < size()) { + return getValue(pos); + } + pos = ArrayData::invalid_index; + return false; +} + +Variant ArrayData::current() const { + if (m_pos >= 0 && m_pos < size()) { + return getValue(m_pos); + } + return false; +} + +Variant ArrayData::each() { + if (m_pos >= 0 && m_pos < size()) { + Array ret; + Variant key = getKey(m_pos); + Variant value = getValue(m_pos); + ret.set(1, value); + ret.set("value", value); + ret.set(0, key); + ret.set("key", key); + ++m_pos; + return ret; + } + return false; +} + +ssize_t ArrayData::iter_begin() const { + if (empty()) return ArrayData::invalid_index; + return 0; +} + +ssize_t ArrayData::iter_end() const { + if (empty()) return ArrayData::invalid_index; + return size() - 1; +} + +ssize_t ArrayData::iter_advance(ssize_t prev) const { + ASSERT(prev >= 0 && prev < size()); + ssize_t next = prev + 1; + if (next >= size()) return ArrayData::invalid_index; + return next; +} + +ssize_t ArrayData::iter_rewind(ssize_t prev) const { + ASSERT(prev >= 0 && prev < size()); + ssize_t next = prev - 1; + if (next < 0) return ArrayData::invalid_index; + return next; +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +void ArrayData::serialize(VariableSerializer *serializer) const { + if (serializer->incNestedLevel((void*)this)) { + serializer->writeOverflow((void*)this); + } else { + serializer->writeArrayHeader(this, size()); + for (ArrayIter iter(this); iter; ++iter) { + Variant key = iter.first(); + if (key.isInteger()) { + serializer->writeArrayKey(this, key.toInt64()); + } else { + serializer->writeArrayKey(this, key.toString()); + } + if (supportValueRef()) { + serializer->writeArrayValue(this, iter.secondRef()); + } else { + serializer->writeArrayValue(this, iter.second()); + } + } + serializer->writeArrayFooter(this); + } + serializer->decNestedLevel((void*)this); +} + +void ArrayData::dump() { + string out; dump(out); printf("%s", out.c_str()); +} + +void ArrayData::dump(std::string &out) { + VariableSerializer vs(VariableSerializer::VarDump); + Variant ret = vs.serialize(Array(this), true); + out += "ArrayData("; + out += boost::lexical_cast(_count); + out += "): "; + out += ret.toString().data(); +} + + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/array_data.h b/src/cpp/base/array/array_data.h new file mode 100644 index 0000000000000..fca3f7e0548e2 --- /dev/null +++ b/src/cpp/base/array/array_data.h @@ -0,0 +1,267 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ARRAY_DATA_H__ +#define __HPHP_ARRAY_DATA_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Base class/interface for all 7 types of specialized array data. + */ +class ArrayData : public Countable { + public: + enum ArrayOp { + Plus, + Merge, + }; + + static const ssize_t invalid_index = -1; + + public: + ArrayData() : m_pos(0) {} + ArrayData(const ArrayData *src) : m_pos(src->m_pos) {} + + /** + * Starting a virtual table that's unavoidable with 7 types of array data. + */ + virtual ~ArrayData(); + + /** + * Create a new ArrayData with specified array element(s). If "replace" is + * true, only unique elements will be inserted (with the last one replacing + * previous ones with the same name). + */ + static ArrayData *Create(); + static ArrayData *Create(CVarRef value); + static ArrayData *Create(CVarRef name, CVarRef value); + static ArrayData *Create(const std::vector &elems, + bool replace = true, bool release = true); + + /** + * Type conversion functions. All other types are handled inside Array class. + */ + Object toObject() const; + + /** + * Array interface functions. + * + * 1. For functions that return ArrayData pointers, these are the ones that + * can potentially escalate into a different ArrayData type. Return NULL + * if no escalation is needed. + * + * 2. All functions with a "key" parameter are type-specialized. + */ + + /** + * For SmartAllocator. + */ + virtual void release() = 0; + + /** + * Whether this array has any element. + */ + virtual bool empty() const { + return size() == 0; + } + + /** + * Number of elements this array has. + */ + virtual ssize_t size() const = 0; + + /** + * For ArrayIter to work. Get key or value at position "pos". getValueRef() + * gets a reference to value at that position, and it's only available to + * VectorVariant and MapVariant types. Generated code made sure array data is + * in Variant type by calling escalate() beforehand. + */ + virtual Variant getKey(ssize_t pos) const = 0; + virtual Variant getValue(ssize_t pos) const = 0; + virtual CVarRef getValueRef(ssize_t pos) const; + virtual bool isVectorData() const; + virtual bool supportValueRef() const { return false;} + + /** + * Position-based iterations. + */ + virtual Variant reset(); + virtual Variant prev(); + virtual Variant current() const; + virtual Variant next(); + virtual Variant end(); + virtual Variant key() const; + virtual Variant value(ssize_t &pos) const; + virtual Variant each(); + + /** + * Testing whether a key exists. + */ + virtual bool exists(int64 k, int64 prehash = -1) const = 0; + virtual bool exists(litstr k, int64 prehash = -1) const = 0; + virtual bool exists(CStrRef k, int64 prehash = -1) const = 0; + virtual bool exists(CVarRef k, int64 prehash = -1) const = 0; + + virtual bool idxExists(ssize_t idx) const = 0; + + /** + * Getting value at specified key. + */ + virtual Variant get(int64 k, int64 prehash = -1) const = 0; + virtual Variant get(litstr k, int64 prehash = -1) const = 0; + virtual Variant get(CStrRef k, int64 prehash = -1) const = 0; + virtual Variant get(CVarRef k, int64 prehash = -1) const = 0; + + /** + * Get the numeric index for a key. Only these need to be + * in ArrayData. + */ + virtual ssize_t getIndex(int64 k, int64 prehash = -1) const = 0; + virtual ssize_t getIndex(litstr k, int64 prehash = -1) const = 0; + virtual ssize_t getIndex(CStrRef k, int64 prehash = -1) const = 0; + virtual ssize_t getIndex(CVarRef k, int64 prehash = -1) const = 0; + + /** + * Getting l-value (that Variant pointer) at specified key. Return NULL if + * escalation is not needed, or an escalated array data. + */ + virtual ArrayData *lval(Variant *&ret, bool copy) = 0; + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1) = 0; + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1) = 0; + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1) = 0; + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1) = 0; + + /** + * Setting a value at specified key. If "copy" is true, make a copy first + * then set the value. Return NULL if escalation is not needed, or an + * escalated array data. + */ + virtual ArrayData *set(int64 k, CVarRef v, + bool copy, int64 prehash = -1) = 0; + virtual ArrayData *set(litstr k, CVarRef v, + bool copy, int64 prehash = -1) = 0; + virtual ArrayData *set(CStrRef k, CVarRef v, + bool copy, int64 prehash = -1) = 0; + virtual ArrayData *set(CVarRef k, CVarRef v, + bool copy, int64 prehash = -1) = 0; + + /** + * Remove a value at specified key. If "copy" is true, make a copy first + * then remove the value. Return NULL if escalation is not needed, or an + * escalated array data. + */ + virtual ArrayData *remove(int64 k, bool copy, int64 prehash = -1) = 0; + virtual ArrayData *remove(litstr k, bool copy, int64 prehash = -1) = 0; + virtual ArrayData *remove(CStrRef k, bool copy, int64 prehash = -1) = 0; + virtual ArrayData *remove(CVarRef k, bool copy, int64 prehash = -1) = 0; + + virtual ssize_t iter_begin() const; + virtual ssize_t iter_end() const; + virtual ssize_t iter_advance(ssize_t prev) const; + virtual ssize_t iter_rewind(ssize_t prev) const; + + virtual void getFullPos(FullPos &pos); + virtual bool setFullPos(const FullPos &pos); + virtual CVarRef currentRef(); + virtual CVarRef endRef(); + + /** + * Make a copy of myself. + */ + virtual ArrayData *copy() const = 0; + + /** + * Append a value to the array. If "copy" is true, make a copy first + * then append the value. Return NULL if escalation is not needed, or an + * escalated array data. + */ + virtual ArrayData *append(CVarRef v, bool copy) = 0; + + /** + * Implementing array appending and merging. If "copy" is true, make a copy + * first then append/merge arrays. Return NULL if escalation is not needed, + * or an escalated array data. + */ + virtual ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy) = 0; + + /** + * Stack function: pop the last item and return it. + */ + virtual ArrayData *pop(Variant &value); + + /** + * Queue function: remove the 1st item and return it. + */ + virtual ArrayData *dequeue(Variant &value); + + /** + * Array function: insert a new item at specified position. + */ + virtual ArrayData *insert(ssize_t pos, CVarRef v, bool copy) = 0; + + /** + * Only map classes need this. Re-index all numeric keys to start from 0. + */ + virtual void renumber() {} + + /** + * When an array data is set static, some calculated data members need to + * be initialized, for example, Map::getKeyVector(). More importantly, all + * sub elements will have to setStatic(). + */ + virtual void onSetStatic() { ASSERT(false);} + + /** + * Serialize this array. We could have made this virtual function to ask + * sub-classes to implement it specifically, but since this is not a critical + * function to optimize, we implement it in a generic way in this base class. + * Then all the sudden we find out all Zend HashTable functions are similar + * to implementing array functions in this base class than utilizing a type + * specialized implementation, which is normally more optimized. + */ + void serialize(VariableSerializer *serializer) const; + + virtual void dump(); + virtual void dump(std::string &out); + + /** + * Comparisons. Similar to serialize(), we implemented it here generically. + */ + int compare(const ArrayData *v2, bool strict) const; + + protected: + ssize_t m_pos; + + /** + * Helpers. + */ + static void dumpKey(std::ostream &out, int indent, unsigned int index); + static void dumpKey(std::ostream &out, int indent, CStrRef key); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ARRAY_DATA_H__ diff --git a/src/cpp/base/array/array_element.cpp b/src/cpp/base/array/array_element.cpp new file mode 100644 index 0000000000000..d34b85d561a27 --- /dev/null +++ b/src/cpp/base/array/array_element.cpp @@ -0,0 +1,31 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS(ArrayElement); +/////////////////////////////////////////////////////////////////////////////// + +void ArrayElement::dump() { + m_name.dump(); + m_value.dump(); + printf("hash: %lld\n", m_hash); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/array_element.h b/src/cpp/base/array/array_element.h new file mode 100644 index 0000000000000..43093e0888c1b --- /dev/null +++ b/src/cpp/base/array/array_element.h @@ -0,0 +1,132 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ARRAY_ELEMENT_H__ +#define __HPHP_ARRAY_ELEMENT_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * This class is purely for initializing an array. + */ +class ArrayElement { + public: + template + ArrayElement(const T &value) : m_value(value) { + } + ArrayElement(CVarRef v) { + bool contagious = v.isContagious(); + m_value = v; + if (contagious) { + m_value.setContagious(); + } + } + + template + ArrayElement(CVarRef name, const T &value, int64 prehash = -1) + : m_name(name.isNull() ? "" : name), m_value(value), m_hash(prehash) { + } + ArrayElement(CVarRef name, CVarRef v, int64 prehash = -1) + : m_hash(prehash) { + bool contagious = v.isContagious(); + m_value = v; + if (contagious) { + m_value.setContagious(); + } + // Defer assignment of name to after so that m_name doesn't steal + // the ref if name and v are the same. + m_name = name.isNull() ? "" : name; + } + + bool hasName() const { + return !m_name.isNull(); + } + Variant getName() const { + ASSERT(hasName()); + switch(m_name.getType()) { + case KindOfBoolean: + return m_name.toBoolean() ? 1LL : 0LL; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return m_name.toInt64(); + case KindOfDouble: + case LiteralString: + case KindOfString: + return m_name.toKey(); + default: + break; + } + return m_name; + } + + int64 getHash() const { + return m_hash; + } + + DataType getType() const { + if (!m_value.isContagious()) { + switch (m_value.getType()) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return KindOfInt64; + case LiteralString: + case KindOfString: + return KindOfString; + default: + break; + } + } + return KindOfVariant; + } + + int64 getInt64() const { + ASSERT(getType() == KindOfInt64); + return m_value.toInt64(); + } + String getString() const { + ASSERT(getType() == KindOfString); + return m_value.toString(); + } + CVarRef getVariant() { + return m_value; + } + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION_NOCALLBACKS(ArrayElement); + void dump(); + + private: + Variant m_name; + Variant m_value; + int64 m_hash; +}; + +typedef std::vector ArrayElementVec; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ARRAY_ELEMENT_H__ diff --git a/src/cpp/base/array/array_funcs.h b/src/cpp/base/array/array_funcs.h new file mode 100644 index 0000000000000..1e30d36eaf9d6 --- /dev/null +++ b/src/cpp/base/array/array_funcs.h @@ -0,0 +1,119 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ARRAY_FUNCS_H__ +#define __HPHP_ARRAY_FUNCS_H__ + +#include +#include +#include +#include + +namespace HPHP { + +namespace ArrayFuncs { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Create a copy of an element. + */ +inline Variant *element(CVarRef v) { + return NEW(Variant)(v); +} +inline void element(Variant *&dest, Variant *src) { + if (src->isReferenced()) src->setContagious(); + dest = NEW(Variant)(*src); +} +template +void element(Variant *&dest, const T &src) { + dest = NEW(Variant)(src); +} +template +void element(T1 &dest, const T2 &src) { + dest = src; +} + +/** + * Release an element, so we can conditionally call release() on Variant*. + */ +inline void release(Variant *v) { + v->release(); +} +template +void release(const T &v) { +} + +inline void set(HphpVector &dest, int index, Variant* const v) { + dest[index]->assign(*v, true); + ArrayFuncs::release(v); +} + +template +void set(HphpVector &dest, int index, const T &v) { + dest[index] = v; +} + +/** + * Append one vector to another. Called by varies appendImpl() functions + * in vector.h and map.h. + */ +template +void append(HphpVector &dest, const HphpVector &src, + unsigned int pos = 0, int len = -1) { + unsigned int size = src.size(); + if (len >= 0 && pos + len < size) { + size = pos + len; + } + for (unsigned int i = pos; i < size; i++) { + Variant *elem; + ArrayFuncs::element(elem, src[i]); + dest.push_back(elem); + } +} + +inline void append(HphpVector &dest, + const HphpVector &src, + unsigned int pos = 0, int len = -1) { + unsigned int size = src.size(); + if (len >= 0 && pos + len < size) { + size = pos + len; + } + for (unsigned int i = pos; i < size; i++) { + Variant *elem; + if (src[i]->isReferenced()) { + src[i]->setContagious(); + } + ArrayFuncs::element(elem, src[i]); + dest.push_back(elem); + } +} + +template +void append(HphpVector &dest, const HphpVector &src, + unsigned int pos = 0, int len = -1) { + if (len >= 0 && pos + len < src.size()) { + dest.append(src, pos, len); + } else { + dest.append(src, pos); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} + +} + +#endif // __HPHP_ARRAY_FUNCS_H__ diff --git a/src/cpp/base/array/array_iterator.cpp b/src/cpp/base/array/array_iterator.cpp new file mode 100644 index 0000000000000..32c69d18ecb21 --- /dev/null +++ b/src/cpp/base/array/array_iterator.cpp @@ -0,0 +1,151 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// ArrayIter + +ArrayIter::ArrayIter(const ArrayData *data) + : m_data(data), m_pos(0) { + create(); +} + +ArrayIter::ArrayIter(const ArrayIter &iter) + : m_data(iter.m_data), m_pos(0) { + create(); +} + +ArrayIter::ArrayIter(CArrRef array) + : m_data(array.get()), m_pos(0) { + create(); +} + +ArrayIter::~ArrayIter() { + if (m_data) { + m_data->decRefCount(); + } +} + +void ArrayIter::create() { + if (m_data) { + m_data->incRefCount(); + m_pos = m_data->iter_begin(); + } else { + m_pos = ArrayData::invalid_index; + } +} + +bool ArrayIter::end() { + return m_pos == ArrayData::invalid_index; +} + +void ArrayIter::next() { + ASSERT(m_data); + ASSERT(m_pos != ArrayData::invalid_index); + m_pos = m_data->iter_advance(m_pos); +} + +Variant ArrayIter::first() { + ASSERT(m_data); + ASSERT(m_pos != ArrayData::invalid_index); + return m_data->getKey(m_pos); +} + +Variant ArrayIter::second() { + ASSERT(m_data); + ASSERT(m_pos != ArrayData::invalid_index); + return m_data->getValue(m_pos); +} + +CVarRef ArrayIter::secondRef() { + ASSERT(m_data); + ASSERT(m_pos != ArrayData::invalid_index); + return m_data->getValueRef(m_pos); +} + +/////////////////////////////////////////////////////////////////////////////// +// MutableArrayIter + +MutableArrayIter::MutableArrayIter(const Variant *var ,Variant *key, + Variant &val) + : m_var(var), m_key(key), m_val(val), m_pos() { + ASSERT(m_var); + ArrayData *data = getData(); + if (data) { + data->reset(); + data->getFullPos(m_pos); + } +} + +bool MutableArrayIter::advance() { + ArrayData *data = getData(); + if (!data) return false; + if (!data->setFullPos(m_pos)) return false; + CVarRef curr = data->currentRef(); + curr.setContagious(); + m_val = curr; + if (m_key) *m_key = data->key(); + data->next(); + data->getFullPos(m_pos); + return true; +} + +ArrayData *MutableArrayIter::getData() { + if (m_var->is(KindOfArray)) { + return m_var->getArrayData(); + } + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +// ObjectArrayIter + +ObjectArrayIter::ObjectArrayIter(ObjectData *obj) + : m_obj(obj) { + ASSERT(m_obj); + ASSERT(m_obj->o_instanceof("iterator")); + m_obj->o_invoke("rewind", Array(), -1); +} + +bool ObjectArrayIter::end() { + return !m_obj->o_invoke("valid", Array(), -1); +} + +void ObjectArrayIter::next() { + m_obj->o_invoke("next", Array(), -1); +} + +Variant ObjectArrayIter::first() { + return m_obj->o_invoke("key", Array(), -1); +} + +Variant ObjectArrayIter::second() { + return m_obj->o_invoke("current", Array(), -1); +} + +CVarRef ObjectArrayIter::secondRef() { + throw FatalErrorException("taking reference on iterator objects"); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/array_iterator.h b/src/cpp/base/array/array_iterator.h new file mode 100644 index 0000000000000..6cc367acc16cf --- /dev/null +++ b/src/cpp/base/array/array_iterator.h @@ -0,0 +1,132 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ARRAY_ITERATOR_H__ +#define __HPHP_ARRAY_ITERATOR_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * An iteration normally looks like this: + * + * for (ArrayIter iter(data); iter; ++iter) { + * ... + * } + */ +class IArrayIterator : public Countable { +public: + virtual ~IArrayIterator() {} + void release() { delete this;} + + operator bool() { return !end();} + void operator++() { next();} + + virtual bool end() = 0; + virtual void next() = 0; + + /** + * Getting key, value or l-value at current position. + */ + virtual Variant first() = 0; + virtual Variant second() = 0; + virtual CVarRef secondRef() = 0; +}; +typedef SmartPtr ArrayIterPtr; + +/** + * Iterator for an immutable array. + */ +class ArrayIter : public IArrayIterator { +public: + /** + * Constructors. + */ + ArrayIter(const ArrayData *data); + ArrayIter(const ArrayIter &iter); + ArrayIter(CArrRef array); + ~ArrayIter(); + + virtual bool end(); + virtual void next(); + virtual Variant first(); + virtual Variant second(); + virtual CVarRef secondRef(); + +private: + const ArrayData *m_data; + ssize_t m_pos; + + void create(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +struct FullPos { + ssize_t primary; + ssize_t secondary; + FullPos() : primary(0), secondary(0) {} +}; + +/** + * Iterator for "foreach ($arr => &$v)" or "foreach ($array as $n => &$v)". + * In this case, any changes to $arr inside iteration needs to be visible to + * the iteration. Therefore, we need to store Variant* with the iterator to + * see those changes. This class should only be used for generated code. + */ +class MutableArrayIter : public Countable { +public: + MutableArrayIter(const Variant *var, Variant *key, Variant &val); + void release() { delete this;} + bool advance(); + +private: + const Variant *m_var; + Variant *m_key; + Variant &m_val; + FullPos m_pos; + int size(); + ArrayData *getData(); +}; +typedef SmartPtr MutableArrayIterPtr; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Iterator for "iterator" class of objects. + */ +class ObjectArrayIter : public IArrayIterator { +public: + ObjectArrayIter(ObjectData *obj); + + // implementing IArrayIterator + virtual bool end(); + virtual void next(); + virtual Variant first(); + virtual Variant second(); + virtual CVarRef secondRef(); + +private: + ObjectData *m_obj; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ARRAY_ITERATOR_H__ diff --git a/src/cpp/base/array/array_util.cpp b/src/cpp/base/array/array_util.cpp new file mode 100644 index 0000000000000..c3527669fb6f0 --- /dev/null +++ b/src/cpp/base/array/array_util.cpp @@ -0,0 +1,605 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// compositions + +Array ArrayUtil::CreateArray(CArrRef keys, CVarRef value) { + Array ret = Array::Create(); + for (ArrayIter iter(keys); iter; ++iter) { + ret.set(iter.second(), value); + } + return ret; +} + +Array ArrayUtil::CreateArray(int start_index, int num, CVarRef value) { + if (num <= 0) { + throw InvalidArgumentException("num", "(non-positive)"); + } + + Array ret; + ret.set(start_index, value); + for (int i = num - 1; i > 0; i--) { + ret.append(value); + } + return ret; +} + +Array ArrayUtil::Combine(CArrRef keys, CArrRef values) { + if (keys.size() != values.size()) { + throw InvalidArgumentException("keys and values", "(not same count)"); + } + if (keys.empty()) { + throw InvalidArgumentException("keys and values", "(empty)"); + } + + Array ret = Array::Create(); + for (ArrayIter iter1(keys), iter2(values); iter1; ++iter1, ++iter2) { + ret.set(iter1.second(), iter2.second()); + } + return ret; +} + +Array ArrayUtil::Chunk(CArrRef input, int size, + bool preserve_keys /* = false */) { + if (size < 1) { + throw InvalidArgumentException("size", size); + } + + Array ret = Array::Create(); + Array chunk; + int current = 0; + for (ArrayIter iter(input); iter; ++iter) { + if (preserve_keys) { + chunk.set(iter.first(), iter.second()); + } else { + chunk.append(iter.second()); + } + if ((++current % size) == 0) { + ret.append(chunk); + chunk.clear(); + } + } + + if (!chunk.empty()) { + ret.append(chunk); + } + return ret; +} + +Array ArrayUtil::Slice(CArrRef input, int offset, int length, + bool preserve_keys) { + int num_in = input.size(); + if (offset > num_in) { + offset = num_in; + } else if (offset < 0 && (offset = (num_in + offset)) < 0) { + offset = 0; + } + + if (length < 0) { + length = num_in - offset + length; + } else if (((unsigned)offset + (unsigned)length) > (unsigned)num_in) { + length = num_in - offset; + } + + Array out_hash = Array::Create(); + int pos = 0; + ArrayIter iter(input); + bool supportRef = input->supportValueRef(); + for (; pos < offset && iter; ++pos, ++iter) {} + for (; pos < offset + length && iter; ++pos, ++iter) { + bool doAppend = !preserve_keys && iter.first().isNumeric(); + if (supportRef) { + CVarRef v = iter.secondRef(); + if (v.isReferenced()) v.setContagious(); + if (doAppend) { + out_hash.append(v); + } else { + out_hash.set(iter.first(), v); + } + } else { + if (doAppend) { + out_hash.append(iter.second()); + } else { + out_hash.set(iter.first(), iter.second()); + } + } + } + return out_hash; +} + +Array ArrayUtil::Splice(CArrRef input, int offset, int length /* = 0 */, + CVarRef replacement /* = null_variant */, + Array *removed /* = NULL */) { + int num_in = input.size(); + if (offset > num_in) { + offset = num_in; + } else if (offset < 0 && (offset = (num_in + offset)) < 0) { + offset = 0; + } + + if (length < 0) { + length = num_in - offset + length; + } else if (((unsigned)offset + (unsigned)length) > (unsigned)num_in) { + length = num_in - offset; + } + + Array out_hash = Array::Create(); + int pos = 0; + ArrayIter iter(input); + for (; pos < offset && iter; ++pos, ++iter) { + if (iter.first().isNumeric()) { + out_hash.append(iter.second()); + } else { + out_hash.set(iter.first(), iter.second()); + } + } + + for (; pos < offset + length && iter; ++pos, ++iter) { + if (removed) { + if (iter.first().isNumeric()) { + removed->append(iter.second()); + } else { + removed->set(iter.first(), iter.second()); + } + } + } + + Array arr = replacement.toArray(); + if (!arr.empty()) { + for (ArrayIter iter(arr); iter; ++iter) { + out_hash.append(iter.second()); + } + } + + for (; iter; ++iter) { + if (iter.first().isNumeric()) { + out_hash.append(iter.second()); + } else { + out_hash.set(iter.first(), iter.second()); + } + } + + return out_hash; +} + +Array ArrayUtil::Pad(CArrRef input, CVarRef pad_value, int pad_size, + bool pad_right /* = true */) { + int input_size = input.size(); + if (input_size >= pad_size) { + return input; + } + + Array ret = Array::Create(); + if (pad_right) { + ret = input; + for (int i = input_size; i < pad_size; i++) { + ret.append(pad_value); + } + } else { + for (int i = input_size; i < pad_size; i++) { + ret.append(pad_value); + } + for (ArrayIter iter(input); iter; ++iter) { + if (iter.first().isNumeric()) { + ret.append(iter.second()); + } else { + ret.set(iter.first(), iter.second()); + } + } + } + return ret; +} + +Array ArrayUtil::Range(unsigned char low, unsigned char high, + int step /* = 1 */) { + if (step <= 0) { + throw InvalidArgumentException("step", step); + } + + Array ret; + if (low > high) { // Negative Steps + for (; low >= high; low -= (unsigned int)step) { + ret.append(String::FromChar(low)); + if (((signed int)low - step) < 0) { + break; + } + } + } else if (high > low) { // Positive Steps + for (; low <= high; low += (unsigned int)step) { + ret.append(String::FromChar(low)); + if (((signed int)low + step) > 255) { + break; + } + } + } else { + ret.append(String::FromChar(low)); + } + return ret; +} + +#define DOUBLE_DRIFT_FIX 0.000000000000001 + +Array ArrayUtil::Range(double low, double high, double step /* = 1.0 */) { + Array ret; + if (low > high) { // Negative steps + if (low - high < step || step <= 0) { + throw InvalidArgumentException("step", step); + } + for (; low >= (high - DOUBLE_DRIFT_FIX); low -= step) { + ret.append(low); + } + } else if (high > low) { // Positive steps + if (high - low < step || step <= 0) { + throw InvalidArgumentException("step", step); + } + for (; low <= (high + DOUBLE_DRIFT_FIX); low += step) { + ret.append(low); + } + } else { + ret.append(low); + } + return ret; +} + +Array ArrayUtil::Range(int64 low, int64 high, int64 step /* = 1 */) { + Array ret; + if (low > high) { // Negative steps + if (low - high < step || step <= 0) { + throw InvalidArgumentException("step", step); + } + for (; low >= high; low -= step) { + ret.append(low); + } + } else if (high > low) { // Positive steps + if (high - low < step || step <= 0) { + throw InvalidArgumentException("step", step); + } + for (; low <= high; low += step) { + ret.append(low); + } + } else { + ret.append(low); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// information and calculations + +double ArrayUtil::Sum(CArrRef input) { + double ret = 0; + for (ArrayIter iter(input); iter; ++iter) { + Variant entry = iter.second(); + if (!entry.is(KindOfArray) && !entry.is(KindOfObject)) { + ret += entry.toDouble(); + } + } + return ret; +} + +double ArrayUtil::Product(CArrRef input) { + double ret = 1.0; + for (ArrayIter iter(input); iter; ++iter) { + Variant entry = iter.second(); + if (!entry.is(KindOfArray) && !entry.is(KindOfObject)) { + ret *= entry.toDouble(); + } + } + return ret; +} + +Array ArrayUtil::CountValues(CArrRef input) { + Array ret = Array::Create(); + for (ArrayIter iter(input); iter; ++iter) { + Variant entry = iter.second(); + if (entry.isInteger() || entry.isString()) { + if (!ret.exists(entry)) { + ret.set(entry, 1); + } else { + ret.set(entry, ret[entry].toInt64() + 1); + } + } else { + Logger::Warning("Can only count STRING and INTEGER values!"); + } + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// manipulations + +Array ArrayUtil::ChangeKeyCase(CArrRef input, bool lower) { + Array ret = Array::Create(); + for (ArrayIter iter(input); iter; ++iter) { + Variant key = iter.first(); + if (key.isString()) { + if (lower) { + ret.set(StringUtil::ToLower(key.toString()), iter.second()); + } else { + ret.set(StringUtil::ToUpper(key.toString()), iter.second()); + } + } else { + ret.set(key, iter.second()); + } + } + return ret; +} + +Array ArrayUtil::Flip(CArrRef input) { + Array ret = Array::Create(); + for (ArrayIter iter(input); iter; ++iter) { + Variant value = iter.second(); + if (value.isString() || value.isInteger()) { + ret.set(value, iter.first()); + } else { + Logger::Warning("Can only flip STRING and INTEGER values!"); + } + } + return ret; +} + +Array ArrayUtil::Reverse(CArrRef input, bool preserve_keys /* = false */) { + if (input.empty()) { + return input; + } + + Array ret = Array::Create(); + for (ssize_t pos = input->iter_end(); pos != ArrayData::invalid_index; + pos = input->iter_rewind(pos)) { + Variant key = input->getKey(pos); + if (preserve_keys || key.isString()) { + ret.set(key, input->getValue(pos)); + } else { + ret.append(input->getValue(pos)); + } + } + return ret; +} + +Array ArrayUtil::Shuffle(CArrRef input) { + int count = input.size(); + if (count == 0) { + return input; + } + + std::vector indices; + indices.reserve(count); + for (ssize_t pos = input->iter_begin(); pos != ArrayData::invalid_index; + pos = input->iter_advance(pos)) { + indices.push_back(pos); + } + random_shuffle(indices.begin(), indices.end()); + + Array ret = Array::Create(); + for (int i = 0; i < count; i++) { + ssize_t pos = indices[i]; + ret.append(input->getValue(pos)); + } + return ret; +} + +Variant ArrayUtil::RandomKeys(CArrRef input, int num_req /* = 1 */) { + int count = input.size(); + if (num_req <= 0 || num_req > count) { + return null; + } + + std::vector indices; + indices.reserve(count); + for (ssize_t pos = input->iter_begin(); pos != ArrayData::invalid_index; + pos = input->iter_advance(pos)) { + indices.push_back(pos); + } + random_shuffle(indices.begin(), indices.end()); + + if (num_req == 1) { + return input->getKey(indices[0]); + } + + Array ret = Array::Create(); + for (int i = 0; i < num_req; i++) { + ssize_t pos = indices[i]; + ret.append(input->getKey(pos)); + } + return ret; +} + +Variant ArrayUtil::RandomValues(CArrRef input, int num_req /* = 1 */) { + int count = input.size(); + if (num_req <= 0 || num_req > count) { + return null; + } + + std::vector indices; + indices.reserve(count); + for (ssize_t pos = input->iter_begin(); pos != ArrayData::invalid_index; + pos = input->iter_advance(pos)) { + indices.push_back(pos); + } + random_shuffle(indices.begin(), indices.end()); + + if (num_req == 1) { + return input->getValue(indices[0]); + } + + Array ret = Array::Create(); + for (int i = 0; i < num_req; i++) { + ssize_t pos = indices[i]; + ret.append(input->getValue(pos)); + } + return ret; +} + +Array ArrayUtil::Filter(CArrRef input, PFUNC_FILTER filter /* = NULL */, + const void *data /* = NULL */) { + Array ret = Array::Create(); + for (ArrayIter iter(input); iter; ++iter) { + Variant value = iter.second(); + if ((filter && filter(value, data)) || (!filter && value.toBoolean())) { + ret.set(iter.first(), iter.second()); + } + } + return ret; +} + +Array ArrayUtil::Unique(CArrRef input) { + Array seenValues; + Array ret = Array::Create(); + for (ArrayIter iter(input); iter; ++iter) { + Variant entry = iter.second(); + String str(entry.toString()); + if (!seenValues.exists(str)) { + seenValues.set(str, 1); + ret.set(iter.first(), entry); + } + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// iterations + +void ArrayUtil::Walk(Variant input, PFUNC_WALK walk_function, + const void *data, bool recursive /* = false */, + CVarRef userdata /* = null_variant */) { + ASSERT(walk_function); + input.escalate(); // so we can safely take secondRef() + for (ArrayIter iter(input); iter; ++iter) { + if (recursive && iter.second().is(KindOfArray)) { + Walk(iter.second().toArray(), walk_function, data, recursive, userdata); + } else { + walk_function(ref(iter.secondRef()), iter.first(), userdata, data); + } + } +} + +Array ArrayUtil::Map(CArrRef inputs, PFUNC_MAP map_function, + const void *data) { + Array ret = Array::Create(); + + if (inputs.size() == 1) { + Array arr = inputs.begin().second().toArray(); + if (!arr.empty()) { + for (ssize_t k = arr->iter_begin(); k != ArrayData::invalid_index; + k = arr->iter_advance(k)) { + Array params; + params.append(arr->getValue(k)); + Variant result; + if (map_function) { + result = map_function(params, data); + } else { + result = params; + } + ret.set(arr->getKey(k), result); + } + } + } else { + int maxlen = 0; + vector > positions; + positions.resize(inputs.size()); + int i = 0; + for (ArrayIter iter(inputs); iter; ++iter, ++i) { + Array arr = iter.second().toArray(); + int count = arr.size(); + if (count > maxlen) maxlen = count; + + if (count > 0) { + positions[i].reserve(count); + for (ssize_t pos = arr->iter_begin(); pos != ArrayData::invalid_index; + pos = arr->iter_advance(pos)) { + positions[i].push_back(pos); + } + } + } + + for (int k = 0; k < maxlen; k++) { + Array params; + int i = 0; + for (ArrayIter iter(inputs); iter; ++iter, ++i) { + Array arr = iter.second().toArray(); + if (k < arr.size()) { + params.append(arr->getValue(positions[i][k])); + } else { + params.append(null); + } + } + + Variant result; + if (map_function) { + result = map_function(params, data); + } else { + result = params; + } + + ret.append(result); + } + } + + return ret; +} + +Variant ArrayUtil::Reduce(CArrRef input, PFUNC_REDUCE reduce_function, + const void *data, CVarRef initial /* = null_variant */) { + if (input.empty()) { + return initial; + } + + ArrayIter iter(input); + Variant result; + if (initial.isNull()) { + result = iter.second(); + } else { + result = initial; + } + + for (++iter; iter; ++iter) { + result = reduce_function(result, iter.second(), data); + } + return result; +} + +void ArrayUtil::InitScalarArrays(Array arrs[], int nArrs, + const char *scalarArrayData, + int scalarArrayDataSize) { + int len = scalarArrayDataSize; + char *uncompressed = gzdecode(scalarArrayData, len); + if (uncompressed == NULL) { + throw Exception("Bad scalarArrayData %p", scalarArrayData); + } + String s = String(uncompressed, len, AttachString); + Variant v = f_unserialize(s); + ASSERT(v.isArray()); + Array scalarArrays = v; + ASSERT(scalarArrays.size() == nArrs); + for (int i = 0; i < nArrs; i++) { + arrs[i] = scalarArrays[i]; + arrs[i].setStatic(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/array_util.h b/src/cpp/base/array/array_util.h new file mode 100644 index 0000000000000..146c695f0808e --- /dev/null +++ b/src/cpp/base/array/array_util.h @@ -0,0 +1,183 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ARRAY_UTIL_H__ +#define __HPHP_ARRAY_UTIL_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Utility array functions. + */ +class ArrayUtil { +public: + ///////////////////////////////////////////////////////////////////////////// + // Compositions. + + /** + * Create an array using the elements of the first parameter as keys + * each initialized to value. + */ + static Array CreateArray(CArrRef keys, CVarRef value); + + /** + * Create an array containing num elements starting with index start_key + * each initialized to value. + */ + static Array CreateArray(int start_index, int num, CVarRef value); + + /** + * Creates an array by using the elements of the first parameter as keys + * and the elements of the second as the corresponding values. + */ + static Array Combine(CArrRef keys, CArrRef values); + + /** + * Split array into chunks. + */ + static Array Chunk(CArrRef input, int size, bool preserve_keys = false); + + /** + * Taking a slice. When "preserve_keys" is true, a vector will turn + * into numerically keyed map. When "preserve_keys" is false, a map will + * turn into vectors, unless keys are not numeric. + */ + static Array Slice(CArrRef input, int offset, int length, + bool preserve_keys); + + /** + * Removes the elements designated by offset and length and replace them + * with supplied array. + */ + static Array Splice(CArrRef input, int offset, int length = 0, + CVarRef replacement = null_variant, Array *removed = NULL); + + /** + * Returns a copy of input array padded with pad_value to size pad_size. + */ + static Array Pad(CArrRef input, CVarRef pad_value, int pad_size, + bool pad_right = true); + + /** + * Create an array containing the range of integers or characters from low + * to high (inclusive). + */ + static Array Range(unsigned char low, unsigned char high, int step = 1); + static Array Range(double low, double high, double step = 1.0); + static Array Range(int64 low, int64 high, int64 step = 1); + + ///////////////////////////////////////////////////////////////////////////// + // Information and calculations. + + /** + * Returns the sum of the array entries. + */ + static double Sum(CArrRef input); + + /** + * Returns the product of the array entries. + */ + static double Product(CArrRef input); + + /** + * Return the value as key and the frequency of that value in input + * as value. + */ + static Array CountValues(CArrRef input); + + ///////////////////////////////////////////////////////////////////////////// + // Manipulations. Note, all these functions will create a new array than + // modifying input, although names of these functions sound like mutating. + + /** + * Retuns an array with all string keys lowercased [or uppercased]. + */ + static Array ChangeKeyCase(CArrRef input, bool lower); + + /** + * Return array with key <-> value flipped. + */ + static Array Flip(CArrRef input); + + /** + * Return input as a new array with the order of the entries reversed. + */ + static Array Reverse(CArrRef input, bool preserve_keys = false); + + /** + * Randomly shuffle the contents of an array. + */ + static Array Shuffle(CArrRef input); + + /** + * Return key/keys for random entry/entries in the array. + */ + static Variant RandomKeys(CArrRef input, int num_req = 1); + static Variant RandomValues(CArrRef input, int num_req = 1); + + /** + * Filters elements from the array via the callback. + */ + typedef bool (*PFUNC_FILTER)(CVarRef value, const void *data); + static Array Filter(CArrRef input, PFUNC_FILTER filter = NULL, + const void *data = NULL); + + /** + * Removes duplicate values from array. + */ + static Array Unique(CArrRef input); + + ///////////////////////////////////////////////////////////////////////////// + // Iterations. + + /** + * Apply a user function to every member of an array. + */ + typedef void (*PFUNC_WALK)(Variant value, CVarRef key, CVarRef userdata, + const void *data); + static void Walk(Variant input, PFUNC_WALK walk_function, const void *data, + bool recursive = false, CVarRef userdata = null_variant); + + /** + * Applies the callback to the elements in given arrays. + */ + typedef Variant (*PFUNC_MAP)(CArrRef params, const void *data); + static Array Map(CArrRef inputs, PFUNC_MAP map_function, const void *data); + + /** + * Iteratively reduce the array to a single value via the callback. + */ + typedef Variant (*PFUNC_REDUCE)(CVarRef result, CVarRef operand, + const void *data); + static Variant Reduce(CArrRef input, PFUNC_REDUCE reduce_function, + const void *data, CVarRef initial = null_variant); + + /** + * Construct scalar arrays from input data. + */ + static void InitScalarArrays(Array arrs[], int nArrs, + const char *scalarArrayData, + int scalarArrayDataSize); + +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ARRAY_UTIL_H__ diff --git a/src/cpp/base/array/empty_array.cpp b/src/cpp/base/array/empty_array.cpp new file mode 100644 index 0000000000000..bf735cbc5e551 --- /dev/null +++ b/src/cpp/base/array/empty_array.cpp @@ -0,0 +1,198 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS(EmptyArray); +/////////////////////////////////////////////////////////////////////////////// + +StaticEmptyArray StaticEmptyArray::s_theEmptyArray; + +bool EmptyArray::empty() const { + return true; +} + +ssize_t EmptyArray::size() const { + return 0; +} + +Variant EmptyArray::getKey(ssize_t pos) const { + ASSERT(false); + return null; +} + +Variant EmptyArray::getValue(ssize_t pos) const { + ASSERT(false); + return null; +} + +bool EmptyArray::exists(int64 k, int64 prehash /* = -1 */) const { + return false; +} + +bool EmptyArray::exists(litstr k, int64 prehash /* = -1 */) const { + return false; +} + +bool EmptyArray::exists(CStrRef k, int64 prehash /* = -1 */) const { + return false; +} + +bool EmptyArray::exists(CVarRef k, int64 prehash /* = -1 */) const { + return false; +} + +bool EmptyArray::idxExists(ssize_t idx) const { + return false; +} + +Variant EmptyArray::get(int64 k, int64 prehash /* = -1 */) const { + return null; +} + +Variant EmptyArray::get(litstr k, int64 prehash /* = -1 */) const { + return null; +} + +Variant EmptyArray::get(CStrRef k, int64 prehash /* = -1 */) const { + return null; +} + +Variant EmptyArray::get(CVarRef k, int64 prehash /* = -1 */) const { + return null; +} + +ssize_t EmptyArray::getIndex(int64 k, int64 prehash /* = -1 */) const { + return -1; +} + +ssize_t EmptyArray::getIndex(litstr k, int64 prehash /* = -1 */) const { + return -1; +} + +ssize_t EmptyArray::getIndex(CStrRef k, int64 prehash /* = -1 */) const { + return -1; +} + +ssize_t EmptyArray::getIndex(CVarRef k, int64 prehash /* = -1 */) const { + return -1; +} + +ArrayData *EmptyArray::lval(Variant *&ret, bool copy) { + ASSERT(false); + ret = NULL; + return NULL; +} + +ArrayData *EmptyArray::lval(int64 k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + return lvalImpl(k, ret, copy, prehash); +} + +ArrayData *EmptyArray::lval(litstr k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + return lvalImpl(k, ret, copy, prehash); +} + +ArrayData *EmptyArray::lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + return lvalImpl(k, ret, copy, prehash); +} + +ArrayData *EmptyArray::lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + return lvalImpl(k, ret, copy, prehash); +} + +ArrayData *EmptyArray::set(int64 k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + return ArrayData::Create(k, v); +} + +ArrayData *EmptyArray::set(litstr k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + return ArrayData::Create(k, v); +} + +ArrayData *EmptyArray::set(CStrRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + return ArrayData::Create(k, v); +} + +ArrayData *EmptyArray::set(CVarRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + if (k.isInteger()) { + return ArrayData::Create(k.toInt64(), v); + } + return ArrayData::Create(k, v); +} + +ArrayData *EmptyArray::remove(int64 k, bool copy, int64 prehash /* = -1 */) { + return NULL; +} + +ArrayData *EmptyArray::remove(litstr k, bool copy, int64 prehash /* = -1 */) { + return NULL; +} + +ArrayData *EmptyArray::remove(CStrRef k, bool copy, int64 prehash /* = -1 */) { + return NULL; +} + +ArrayData *EmptyArray::remove(CVarRef k, bool copy, int64 prehash /* = -1 */) { + return NULL; +} + +ArrayData *EmptyArray::copy() const { + return NEW(EmptyArray)(); +} + +ArrayData *EmptyArray::append(CVarRef v, bool copy) { + return ArrayData::Create(v); +} + +ArrayData *EmptyArray::append(const ArrayData *elems, ArrayOp op, bool copy) { + switch (op) { + case Plus: + break; + case Merge: + { + const Map *mapElems = dynamic_cast(elems); + if (mapElems && mapElems->hasNumericKeys()) { + return elems->copy(); + } + } + default: + ASSERT(false); + break; + } + return const_cast(elems); +} + +ArrayData *EmptyArray::insert(ssize_t pos, CVarRef v, bool copy) { + return append(v, false); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/empty_array.h b/src/cpp/base/array/empty_array.h new file mode 100644 index 0000000000000..42d5a97a5cf34 --- /dev/null +++ b/src/cpp/base/array/empty_array.h @@ -0,0 +1,127 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_EMPTY_ARRAY_H__ +#define __HPHP_EMPTY_ARRAY_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * An array with no element. Empty array is everywhere, so it deserves its own + * class. This also means any other typed array is guaranteed non-empty, and + * this is enforced when all array elements are removed from a typed array, + * becoming EmptyArray. (The only exception is MapVariant created when lval() + * is taken from an EmptyArray. In this case, we have no choice than creating + * an empty MapVariant beforehand). + * + * An EmptyArray is not the same as Array(), which is a null array, or an un- + * initialized array variable. In other words, + * + * Array().isNull() == true; + * Array(new EmptyArray()).isNull() == false; + * + * Recommended way to create an empty array is to call Array::Create(). + */ +class EmptyArray : public ArrayData { + public: + DECLARE_SMART_ALLOCATION_NOCALLBACKS(EmptyArray); + + EmptyArray() {} + + /** + * Implementing ArrayData... + */ + virtual bool empty() const; + virtual ssize_t size() const; + + virtual Variant getKey(ssize_t pos) const; + virtual Variant getValue(ssize_t pos) const; + + virtual bool exists(int64 k, int64 prehash = -1) const; + virtual bool exists(litstr k, int64 prehash = -1) const; + virtual bool exists(CStrRef k, int64 prehash = -1) const; + virtual bool exists(CVarRef k, int64 prehash = -1) const; + + virtual bool idxExists(ssize_t idx) const; + + virtual Variant get(int64 k, int64 prehash = -1) const; + virtual Variant get(litstr k, int64 prehash = -1) const; + virtual Variant get(CStrRef k, int64 prehash = -1) const; + virtual Variant get(CVarRef k, int64 prehash = -1) const; + + virtual ssize_t getIndex(int64 k, int64 prehash = -1) const; + virtual ssize_t getIndex(litstr k, int64 prehash = -1) const; + virtual ssize_t getIndex(CStrRef k, int64 prehash = -1) const; + virtual ssize_t getIndex(CVarRef k, int64 prehash = -1) const; + + virtual ArrayData *lval(Variant *&ret, bool copy); + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1); + + virtual ArrayData *set(int64 k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(litstr k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(CStrRef k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(CVarRef k, CVarRef v, bool copy, int64 prehash = -1); + + virtual ArrayData *remove(int64 k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(litstr k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CStrRef k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CVarRef k, bool copy, int64 prehash = -1); + + virtual ArrayData *copy() const; + virtual ArrayData *append(CVarRef v, bool copy); + virtual ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy); + virtual ArrayData *insert(ssize_t pos, CVarRef v, bool copy); + + virtual void onSetStatic() {} +private: + template + ArrayData *lvalImpl(const T& k, Variant *&ret, bool copy, int64 prehash) { + ArrayData *d1 = set(k, Variant(), copy, prehash); + ArrayData *d2 = d1->lval(k, ret, false, prehash); + if (d2) { + d1->release(); + return d2; + } + return d1; + } +}; + +class StaticEmptyArray : public EmptyArray { +public: + StaticEmptyArray() { setStatic();} + + static EmptyArray *Get() { return &s_theEmptyArray; } + +private: + static StaticEmptyArray s_theEmptyArray; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_EMPTY_ARRAY_H__ diff --git a/src/cpp/base/array/map.cpp b/src/cpp/base/array/map.cpp new file mode 100644 index 0000000000000..7236e2f6c4dbb --- /dev/null +++ b/src/cpp/base/array/map.cpp @@ -0,0 +1,236 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// constructors and destructor + +Map::Map() : m_nextIndex(0), m_keys(NULL) { +} + +Map::Map(const Map *src) : ArrayData(src), m_nextIndex(0), m_keys(NULL) { + m_map = src->m_map; + m_nextIndex = src->m_nextIndex; +} + +Map::~Map() { + delete m_keys; +} + +/////////////////////////////////////////////////////////////////////////////// +// implementing ArrayData + +Variant Map::getKey(ssize_t pos) const { + ASSERT(pos != ArrayData::invalid_index && pos < size()); + const vector &keys = getKeyVector(); + ASSERT((ssize_t)keys.size() == size()); + return keys[pos]; +} + +Variant Map::get(int64 k, int64 prehash /* = -1 */) const { + return get(Variant(k), prehash); +} + +Variant Map::get(litstr k, int64 prehash /* = -1 */) const { + return get(Variant(k), prehash); +} + +Variant Map::get(CStrRef k, int64 prehash /* = -1 */) const { + return get(Variant(k), prehash); +} + +Variant Map::get(CVarRef k, int64 prehash /* = -1 */) const { + int index = getIndex(k, prehash); + if (index >= 0) { + return getImpl(index); + } else { + return null; + } +} + +bool Map::exists(int64 k, int64 prehash /* = -1 */) const { + return getIndex(k, prehash) >= 0; +} + +bool Map::exists(litstr k, int64 prehash /* = -1 */) const { + return getIndex(k, prehash) >= 0; +} + +bool Map::exists(CStrRef k, int64 prehash /* = -1 */) const { + return getIndex(k, prehash) >= 0; +} + +bool Map::exists(CVarRef k, int64 prehash /* = -1 */) const { + return getIndex(k, prehash) >= 0; +} + +bool Map::idxExists(ssize_t idx) const { + return idx != ArrayData::invalid_index; +} + +ssize_t Map::getIndex(CVarRef k, int64 prehash /* = -1 */) const { + int index; + if (m_map.find(k, index, prehash)) { + ASSERT(index >= 0 && index < size()); + return (ssize_t)index; + } + return ArrayData::invalid_index; +} + + +ArrayData *Map::set(int64 k, CVarRef v, bool copy, int64 prehash /* = -1 */) { + return setImpl(Variant(k), v, copy, prehash); +} + +ArrayData *Map::set(litstr k, CVarRef v, bool copy, int64 prehash /* = -1 */) { + return setImpl(Variant(k), v, copy, prehash); +} + +ArrayData *Map::set(CStrRef k, CVarRef v, bool copy, + int64 prehash /* = -1 */) { + return setImpl(Variant(k), v, copy, prehash); +} + +ArrayData *Map::set(CVarRef k, CVarRef v, bool copy, + int64 prehash /* = -1 */) { + return setImpl(k, v, copy, prehash); +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +const vector &Map::getKeyVector() const { + if (m_keys == NULL) { + m_keys = new vector(); + m_keys->resize(m_map.size()); + for (HphpMapVariantToInt::const_iterator iter = m_map.begin(); + iter != m_map.end(); ++iter) { + ASSERT(iter->value() >= 0 && iter->value() < (int)m_map.size()); + (*m_keys)[iter->value()] = iter->key(); + } + // if this assertion is triggered, our m_map is messed up + ASSERT((ssize_t)m_keys->size() == size()); + } + // if this assertion is triggered, we didn't call resetKeyVector() somewhere + ASSERT((ssize_t)m_keys->size() == size()); + return *m_keys; +} + +void Map::resetKeyVector() const { + if (m_keys) { + delete m_keys; + m_keys = NULL; + } +} + +int Map::insertKey(CVarRef key, int64 prehash /* = -1 */) { + int res; + ASSERT(key.isInteger() || key.isString()); + if (m_map.insert(key, size(), res, prehash)) { + if (m_keys) { + m_keys->push_back(key); + } + if (key.isInteger()) { + int64 index = key.toInt64(); + if (index + 1 > m_nextIndex) m_nextIndex = index + 1; + } + } + return res; +} + +void Map::insertKey(int pos) { + const vector &keys = getKeyVector(); + + HphpMapVariantToInt newmap; + m_nextIndex = 0; + for (int i = 0; i <= (int)keys.size(); i++) { + if (i == pos) { + Variant newkey = (int64)m_nextIndex++; + newmap[newkey] = pos; + } else { + CVarRef key = keys[i > pos ? i-1 : i]; + int value = m_map[key]; + if (value >= pos) value++; + if (key.isInteger() && key.toInt64() >= 0) { + Variant newkey = (int64)m_nextIndex++; + newmap[newkey] = value; + } else { + newmap[key] = value; + } + } + } + m_map.swap(newmap); + + resetKeyVector(); +} + +void Map::appendKey() { + Variant key = (int64)m_nextIndex++; + m_map[key] = size(); + if (m_keys) { + m_keys->push_back(key); + } +} + +void Map::removeKey(CVarRef key, int index, int64 prehash) { + if (m_keys) { + m_keys->erase(m_keys->begin() + index); + } + for (HphpMapVariantToInt::iterator iter = m_map.begin(); iter != m_map.end(); + ++iter) { + if (iter->value() > index) { + --iter->lvalue(); + } + } + m_map.erase(key, prehash); +} + +void Map::renumber() { + const vector &keys = getKeyVector(); + + HphpMapVariantToInt newmap; + m_nextIndex = 0; + for (unsigned int i = 0; i < keys.size(); i++) { + CVarRef key = keys[i]; + if (key.isInteger()) { + Variant newkey = (int64)m_nextIndex++; + newmap[newkey] = m_map[key]; + } else { + newmap[key] = m_map[key]; + } + } + m_map.swap(newmap); + + resetKeyVector(); +} + +void Map::onSetStatic() { + for (HphpMapVariantToInt::const_iterator iter = m_map.begin(); + iter != m_map.end(); ++iter) { + iter->key().setStatic(); + } + + // populate m_keys so that it won't be populated again by different threads + getKeyVector(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/map.h b/src/cpp/base/array/map.h new file mode 100644 index 0000000000000..66e8d4e83a6eb --- /dev/null +++ b/src/cpp/base/array/map.h @@ -0,0 +1,363 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_MAP_H__ +#define __HPHP_MAP_H__ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Associative arrays of name-value pairs. + */ +class Map : public ArrayData { + public: + Map(); + Map(const Map *src); + ~Map(); + + /** + * Implementing ArrayData... + */ + virtual Variant getKey(ssize_t pos) const; + + virtual bool exists(int64 k, int64 prehash = -1) const; + virtual bool exists(litstr k, int64 prehash = -1) const; + virtual bool exists(CStrRef k, int64 prehash = -1) const; + virtual bool exists(CVarRef k, int64 prehash = -1) const; + + virtual bool idxExists(ssize_t idx) const; + + virtual Variant get(int64 k, int64 prehash = -1) const; + virtual Variant get(litstr k, int64 prehash = -1) const; + virtual Variant get(CStrRef k, int64 prehash = -1) const; + virtual Variant get(CVarRef k, int64 prehash = -1) const; + + virtual ArrayData *set(int64 k, CVarRef v, + bool copy, int64 prehash = -1); + virtual ArrayData *set(litstr k, CVarRef v, + bool copy, int64 prehash = -1); + virtual ArrayData *set(CStrRef k, CVarRef v, + bool copy, int64 prehash = -1); + virtual ArrayData *set(CVarRef k, CVarRef v, + bool copy, int64 prehash = -1); + + virtual ArrayData *setImpl(CVarRef k, CVarRef v, + bool copy, int64 prehash = -1) = 0; + /** + * Whether or not there is at least one numeric key. + */ + bool hasNumericKeys() const { return m_nextIndex;} + + /** + * Try to resolve to a numeric index. Returns -1 if not found. + */ + ssize_t getIndex(int64 k, int64 prehash = -1) const { + return getIndex(Variant(k), prehash); + } + ssize_t getIndex(litstr k, int64 prehash = -1) const { + return getIndex(Variant(k), prehash); + } + ssize_t getIndex(CStrRef k, int64 prehash = -1) const { + return getIndex(Variant(k), prehash); + } + ssize_t getIndex(CVarRef k, int64 prehash = -1) const; + + protected: + typedef HphpMap HphpMapVariantToInt; + HphpMapVariantToInt m_map; // key -> array index of m_elems in sub-classes + int m_nextIndex; // next numeric index + mutable std::vector *m_keys; // cached enumerated keys + + /** + * Memory allocator methods. + */ + bool calculate(int &size) { + if (m_keys) { + delete m_keys; + m_keys = NULL; + } + return m_map.calculate(size); + } + void backup(LinearAllocator &allocator) { + m_map.backup(allocator); + } + void restore(const char *&data) { + m_map.restore(data); + } + void sweep() { + m_map.sweep(); + } + + /** + * Since PHP array maintains ordering of keys by insertion sequence, we + * have to use an indirect string to integer map to store keys. Then + * constructing key order becomes expensive, so we have to cache the key + * vector for a while, in case repetitive calculation of the same vector. + * resetKeyVector() has to be called whenever a key membership is changed. + */ + const std::vector &getKeyVector() const; + void resetKeyVector() const; + virtual void onSetStatic(); + + /** + * Insert a string key or append a number key. + */ + int insertKey(CVarRef key, int64 prehash = -1); + void insertKey(int pos); + void appendKey(); + void removeKey(CVarRef key, int index, int64 prehash); + virtual void renumber(); + + virtual Variant getImpl(int index) const = 0; + + /** + * Copy src map and append a single value. + */ + template + void appendImpl(HphpVector &dest, const Map *srcMap, + const HphpVector &src, const T1 &v) { + m_map = srcMap->m_map; + m_nextIndex = srcMap->m_nextIndex; + dest.reserve(src.size() + 1); + ArrayFuncs::append(dest, src); + appendKey(); + dest.push_back(v); + } + + /** + * Convert a vector to map and add (k, v). + */ + template + void appendImpl(HphpVector &dest, const HphpVector &src, + CVarRef k, const T1 &v) { + m_nextIndex = src.size(); + for (int i = 0; i < m_nextIndex; i++) { + m_map[Variant((int64)i)] = i; + } + + dest.reserve(m_nextIndex + 1); + ArrayFuncs::append(dest, src); + insertKey(k.toKey()); + dest.push_back(v); + } + + /** + * Copy src map and add (k, v). + */ + template + void appendImpl(HphpVector &dest, const Map *srcMap, + const HphpVector &src, CVarRef k, const T1 &v) { + m_map = srcMap->m_map; + m_nextIndex = srcMap->m_nextIndex; + + int index = srcMap->getIndex(k); + if (index >= 0) { + ArrayFuncs::append(dest, src); + ArrayFuncs::set(dest, index, v); + } else { + dest.reserve(src.size() + 1); + ArrayFuncs::append(dest, src); + insertKey(k.toKey()); + dest.push_back(v); + } + } + + /** + * Append a vector of items. + */ + template + void appendImpl(HphpVector &dest, const HphpVector &elems, + ArrayOp op) { + unsigned int size = elems.size(); + switch (op) { + case Plus: + dest.reserve(dest.size() + size); + for (unsigned int i = 0; i < size; i++) { + Variant key = (int64)i; + int index = getIndex(key); + if (index < 0) { + insertKey(key); + T1 elem; ArrayFuncs::element(elem, elems[i]); + dest.push_back(elem); + } + } + break; + case Merge: + for (unsigned int i = 0; i < size; i++) { + appendKey(); + } + ArrayFuncs::append(dest, elems); + break; + default: + ASSERT(false); + break; + } + } + + /** + * Append a map of items. + */ + template + void appendImpl(HphpVector &dest, const Map *srcMap, + const HphpVector &elems, ArrayOp op) { + const std::vector &keys = srcMap->getKeyVector(); + unsigned int size = keys.size(); + switch (op) { + case Plus: + dest.reserve(dest.size() + elems.size()); + for (unsigned int i = 0; i < size; i++) { + CVarRef key = keys[i]; + int index = getIndex(key); + if (index < 0) { + insertKey(key); + T1 elem; ArrayFuncs::element(elem, elems[i]); + dest.push_back(elem); + } + } + break; + case Merge: + for (unsigned int i = 0; i < size; i++) { + CVarRef key = keys[i]; + int index = getIndex(key); + T1 elem; ArrayFuncs::element(elem, elems[i]); + if (index < 0) { + insertKey(key); + dest.push_back(elem); + } else { + ArrayFuncs::set(dest, index, elem); + } + } + break; + default: + ASSERT(false); + break; + } + } + + /** + * Copy src and append a vector of items. + */ + template + void appendImpl(HphpVector &dest, + const Map *srcMap, const HphpVector &src, + const HphpVector &elems, ArrayOp op) { + m_map = srcMap->m_map; + m_nextIndex = srcMap->m_nextIndex; + dest.reserve(src.size() + elems.size()); + ArrayFuncs::append(dest, src); + appendImpl(dest, elems, op); + } + + /** + * Copy src and append a map of items. + */ + template + void appendImpl(HphpVector &dest, + const Map *srcMap, const HphpVector &src, + const Map *mapElems, const HphpVector &elems, + ArrayOp op) { + m_map = srcMap->m_map; + m_nextIndex = srcMap->m_nextIndex; + dest.reserve(src.size() + elems.size()); + ArrayFuncs::append(dest, src); + appendImpl(dest, mapElems, elems, op); + } + + /** + * Convert a vector to map and append a map of items. + */ + template + void appendImpl(HphpVector &dest, const HphpVector &src, + const Map *mapElems, const HphpVector &elems, + ArrayOp op) { + m_nextIndex = src.size(); + for (int i = 0; i < m_nextIndex; i++) { + m_map[Variant((int64)i)] = i; + } + dest.reserve(m_nextIndex + elems.size()); + ArrayFuncs::append(dest, src); + appendImpl(dest, mapElems, elems, op); + } + + /** + * Copy all elements in src except the one at erase index. + */ + template + void appendImpl(HphpVector &dest, const HphpVector &src, + int eraseIndex) { + m_nextIndex = src.size(); + for (int i = 0; i < m_nextIndex; i++) { + if (i > eraseIndex) { + m_map[Variant((int64)i)] = i - 1; + } else if (i < eraseIndex) { + m_map[Variant((int64)i)] = i; + } + } + dest.reserve(m_nextIndex - 1); + ArrayFuncs::append(dest, src, 0, eraseIndex); + if (eraseIndex < m_nextIndex - 1) { + ArrayFuncs::append(dest, src, eraseIndex + 1); + } + } + + /** + * Copy all elements in src map except the one at erase index. + */ + template + void appendImpl(HphpVector &dest, const Map *srcMap, + const HphpVector &src, int eraseIndex) { + m_nextIndex = srcMap->m_nextIndex; + for (HphpMapVariantToInt::const_iterator iter = srcMap->m_map.begin(); + iter != srcMap->m_map.end(); ++iter) { + if (iter->value() > eraseIndex) { + m_map[iter->key()] = iter->value() - 1; + } else if (iter->value() < eraseIndex) { + m_map[iter->key()] = iter->value(); + } + } + dest.reserve(src.size() - 1); + ArrayFuncs::append(dest, src, 0, eraseIndex); + if (eraseIndex < (int)(src.size() - 1)) { + ArrayFuncs::append(dest, src, eraseIndex + 1); + } + } + + /** + * Swap two elements at specified position. + */ + template + void swapImpl(HphpVector &dest, int pos1, int pos2) { + ASSERT(pos1 >= 0 && pos1 < dest.size()); + ASSERT(pos2 >= 0 && pos2 < dest.size()); + + T temp = dest[pos1]; + dest[pos1] = dest[pos2]; + dest[pos2] = temp; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_MAP_H__ diff --git a/src/cpp/base/array/map_long.cpp b/src/cpp/base/array/map_long.cpp new file mode 100644 index 0000000000000..7295201332abd --- /dev/null +++ b/src/cpp/base/array/map_long.cpp @@ -0,0 +1,269 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION(MapLong, SmartAllocatorImpl::NeedRestore); +/////////////////////////////////////////////////////////////////////////////// +// constructors + +MapLong::MapLong(CVarRef k, int64 v) { + insertKey(k); + m_elems.push_back(v); +} + +MapLong::MapLong(const std::vector &elems, + bool replace /* = true */) { + unsigned int size = elems.size(); + m_elems.reserve(size); + for (unsigned int i = 0; i < size; i++) { + ArrayElement *elem = elems[i]; + if (elem->hasName()) { + uint idx = insertKey(elem->getName(), elem->getHash()); + if (idx < m_elems.size()) { + if (replace) m_elems[idx] = elem->getInt64(); + continue; + } + } else { + appendKey(); + } + m_elems.push_back(elem->getInt64()); + } +} + +MapLong::MapLong(const MapLong *src) : Map(src) { + m_elems = src->getElems(); +} + +MapLong::MapLong(const VectorLong *src, CVarRef k, int64 v) { + ASSERT(src); + ASSERT(src->getIndex(k) < 0); + appendImpl(m_elems, src->getElems(), k, v); +} + +MapLong::MapLong(const VectorLong *src, const MapLong *elems, ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src->getElems(), elems, elems->getElems(), op); +} + +MapLong::MapLong(const MapLong *src, int64 v) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), v); +} + +MapLong::MapLong(const MapLong *src, CVarRef k, int64 v) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), k, v); +} + +MapLong::MapLong(const MapLong *src, const VectorLong *elems, ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src, src->getElems(), elems->getElems(), op); +} + +MapLong::MapLong(const MapLong *src, const MapLong *elems, ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src, src->getElems(), elems, elems->getElems(), op); +} + +MapLong::MapLong(const VectorLong *src, int eraseIndex) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), eraseIndex); +} + +MapLong::MapLong(const MapLong *src, int eraseIndex) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), eraseIndex); +} + +/////////////////////////////////////////////////////////////////////////////// +// implementing ArrayData + +ssize_t MapLong::size() const { + return m_elems.size(); +} + +Variant MapLong::getValue(ssize_t pos) const { + ASSERT(pos != ArrayData::invalid_index && pos < size()); + return m_elems[pos]; +} + +ArrayData *MapLong::lval(Variant *&ret, bool copy) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(ret, false); + return escalated; +} + +ArrayData *MapLong::lval(int64 k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} +ArrayData *MapLong::lval(litstr k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} +ArrayData *MapLong::lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} +ArrayData *MapLong::lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *MapLong::setImpl(CVarRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + if (!v.isInteger()) { + return NEW(MapVariant)(this, k, v); + } + if (copy) { + return NEW(MapLong)(this, k, v.toInt64()); + } + uint index = insertKey(k, prehash); + if (index < m_elems.size()) { + m_elems[index] = v.toInt64(); + } else { + m_elems.push_back(v.toInt64()); + } + return NULL; +} + +ArrayData *MapLong::remove(int64 k, bool copy, int64 prehash /* = -1 */) { + return remove(Variant(k), copy, prehash); +} + +ArrayData *MapLong::remove(litstr k, bool copy, int64 prehash /* = -1 */) { + return remove(Variant(k), copy, prehash); +} + +ArrayData *MapLong::remove(CStrRef k, bool copy, int64 prehash /* = -1 */) { + return remove(Variant(k), copy, prehash); +} + +ArrayData *MapLong::remove(CVarRef k, bool copy, int64 prehash /* = -1 */) { + int index = getIndex(k, prehash); + if (index >= 0) { + if (size() == 1) { + return StaticEmptyArray::Get(); + } + if (copy) { + return NEW(MapLong)(this, index); + } + m_elems.remove(index); + removeKey(k, index, prehash); + if (index < m_pos) m_pos--; + } + return NULL; +} + +ArrayData *MapLong::copy() const { + return NEW(MapLong)(this); +} + +ArrayData *MapLong::append(CVarRef v, bool copy) { + if (!v.isInteger()) { + return NEW(MapVariant)(this, v); + } + + if (copy) { + return NEW(MapLong)(this, v.toInt64()); + } + + appendKey(); + m_elems.push_back(v.toInt64()); + return NULL; +} + +ArrayData *MapLong::append(const ArrayData *elems, ArrayOp op, bool copy) { + ASSERT(elems); + + const EmptyArray *none = dynamic_cast(elems); + if (none) { + return NULL; + } + + const VectorLong *longs = dynamic_cast(elems); + if (longs) { + if (copy) { + return NEW(MapLong)(this, longs, op); + } + appendImpl(m_elems, longs->getElems(), op); + return NULL; + } + + const MapLong *mapLong = dynamic_cast(elems); + if (mapLong) { + if (copy) { + return NEW(MapLong)(this, mapLong, op); + } + appendImpl(m_elems, mapLong, mapLong->getElems(), op); + return NULL; + } + + const SharedMap *mapShared = dynamic_cast(elems); + if (mapShared) { + MapVariant *escalated = mapShared->escalateToMapVariant(); + MapVariant *ret = NEW(MapVariant)(this, escalated, op); + DELETE(MapVariant)(escalated); + return ret; + } + + return NEW(MapVariant)(this, elems, op); +} + +ArrayData *MapLong::insert(ssize_t pos, CVarRef v, bool copy) { + if (pos >= size()) { + return append(v, false); + } + if (pos == ArrayData::invalid_index) pos = 0; + + if (!v.isInteger()) { + ArrayData *ret = NEW(MapVariant)(this); + ret->insert(pos, v, false); + return ret; + } + + if (copy) { + ArrayData* ret = NEW(MapLong)(this); + ret->insert(pos, v, false); + return ret; + } + + insertKey(pos); + m_elems.insert(pos, v.toInt64()); + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/map_long.h b/src/cpp/base/array/map_long.h new file mode 100644 index 0000000000000..b18e1fa4998f0 --- /dev/null +++ b/src/cpp/base/array/map_long.h @@ -0,0 +1,115 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_MAP_LONG_H__ +#define __HPHP_MAP_LONG_H__ + +#include + +namespace HPHP { + +class VectorLong; +/////////////////////////////////////////////////////////////////////////////// + +/** + * Map string to Int64 (integers). + */ +class MapLong : public Map { + public: + /** + * Constructors. + */ + MapLong(CVarRef k, int64 v); + MapLong(const std::vector &elems, bool replace = true); + MapLong(const MapLong *src); + + MapLong(const VectorLong *src, CVarRef k, int64 v); + MapLong(const VectorLong *src, const MapLong *elems, ArrayOp op); + + MapLong(const MapLong *src, int64 v); + MapLong(const MapLong *src, CVarRef k, int64 v); + MapLong(const MapLong *src, const VectorLong *elems, ArrayOp op); + MapLong(const MapLong *src, const MapLong *elems, ArrayOp op); + + MapLong(const VectorLong *src, int eraseIndex); + MapLong(const MapLong *src, int eraseIndex); + + /** + * Implementing ArrayData... + */ + virtual ssize_t size() const; + virtual Variant getValue(ssize_t pos) const; + + virtual ArrayData *lval(Variant *&ret, bool copy); + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1); + + virtual ArrayData *setImpl(CVarRef k, CVarRef v, + bool copy, int64 prehash = -1); + + virtual ArrayData *remove(int64 k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(litstr k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CStrRef k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CVarRef k, bool copy, int64 prehash = -1); + + virtual ArrayData *copy() const; + virtual ArrayData *append(CVarRef v, bool copy); + virtual ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy); + virtual ArrayData *insert(ssize_t pos, CVarRef v, bool copy); + + /** + * Low level access to underlying data. Should be limited in use. + */ + const HphpVector &getElems() const { return m_elems;} + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION(MapLong, SmartAllocatorImpl::NeedRestore); + bool calculate(int &size) { + bool ret = Map::calculate(size); + return m_elems.calculate(size) || ret; + } + void backup(LinearAllocator &allocator) { + Map::backup(allocator); + m_elems.backup(allocator); + } + void restore(const char *&data) { + Map::restore(data); + m_elems.restore(data); + } + void sweep() { + Map::sweep(); + m_elems.sweep(); + } + + protected: + virtual Variant getImpl(int index) const { return m_elems[index]; } + + private: + HphpVector m_elems; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_MAP_LONG_H__ diff --git a/src/cpp/base/array/map_string.cpp b/src/cpp/base/array/map_string.cpp new file mode 100644 index 0000000000000..8143ab9dc9f7e --- /dev/null +++ b/src/cpp/base/array/map_string.cpp @@ -0,0 +1,282 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION(MapString, SmartAllocatorImpl::NeedRestore); +/////////////////////////////////////////////////////////////////////////////// +// constructors + +MapString::MapString(CVarRef k, CStrRef v) { + insertKey(k); + m_elems.push_back(v); +} + +MapString::MapString(const std::vector &elems, + bool replace /* = true */) { + unsigned int size = elems.size(); + m_elems.reserve(size); + for (unsigned int i = 0; i < size; i++) { + ArrayElement *elem = elems[i]; + if (elem->hasName()) { + uint idx = insertKey(elem->getName(), elem->getHash()); + if (idx < m_elems.size()) { + if (replace) m_elems[idx] = elem->getString(); + continue; + } + } else { + appendKey(); + } + m_elems.push_back(elem->getString()); + } +} + +MapString::MapString(const MapString *src) : Map(src) { + m_elems = src->getElems(); +} + +MapString::MapString(const VectorString *src, CVarRef k, CStrRef v) { + ASSERT(src); + ASSERT(src->getIndex(k) < 0); + appendImpl(m_elems, src->getElems(), k, v); +} + +MapString::MapString(const VectorString *src, const MapString *elems, + ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src->getElems(), elems, elems->getElems(), op); +} + +MapString::MapString(const MapString *src, CStrRef v) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), v); +} + +MapString::MapString(const MapString *src, CVarRef k, CStrRef v) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), k, v); +} + +MapString::MapString(const MapString *src, const VectorString *elems, + ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src, src->getElems(), elems->getElems(), op); +} + +MapString::MapString(const MapString *src, const MapString *elems, + ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src, src->getElems(), elems, elems->getElems(), op); +} + +MapString::MapString(const VectorString *src, int eraseIndex) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), eraseIndex); +} + +MapString::MapString(const MapString *src, int eraseIndex) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), eraseIndex); +} + +/////////////////////////////////////////////////////////////////////////////// +// implementing ArrayData + +ssize_t MapString::size() const { + return m_elems.size(); +} + +Variant MapString::getValue(ssize_t pos) const { + ASSERT(pos >= 0 && pos < size()); + return m_elems[pos]; +} + +ArrayData *MapString::lval(Variant *&ret, bool copy) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(ret, false); + return escalated; +} + +ArrayData *MapString::lval(int64 k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *MapString::lval(litstr k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *MapString::lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *MapString::lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *MapString::setImpl(CVarRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + if (!v.isString()) { + return NEW(MapVariant)(this, k, v); + } + if (copy) { + return NEW(MapString)(this, k, v.toString()); + } + uint index = insertKey(k, prehash); + if (index < m_elems.size()) { + m_elems[index] = v.toString(); + } else { + m_elems.push_back(v.toString()); + } + return NULL; +} + +ArrayData *MapString::remove(int64 k, bool copy, int64 prehash /* = -1 */) { + return remove(Variant(k), copy, prehash); +} + +ArrayData *MapString::remove(litstr k, bool copy, int64 prehash /* = -1 */) { + return remove(Variant(k), copy, prehash); +} + +ArrayData *MapString::remove(CStrRef k, bool copy, int64 prehash /* = -1 */) { + return remove(Variant(k), copy, prehash); +} + +ArrayData *MapString::remove(CVarRef k, bool copy, int64 prehash /* = -1 */) { + int index = getIndex(k, prehash); + if (index >= 0) { + if (size() == 1) { + return StaticEmptyArray::Get(); + } + if (copy) { + return NEW(MapString)(this, index); + } + m_elems.remove(index); + removeKey(k, index, prehash); + if (index < m_pos) m_pos--; + } + return NULL; +} + +ArrayData *MapString::copy() const { + return NEW(MapString)(this); +} + +ArrayData *MapString::append(CVarRef v, bool copy) { + if (v.getType() != KindOfString) { + return NEW(MapVariant)(this, v); + } + + if (copy) { + return NEW(MapString)(this, v.toString()); + } + + appendKey(); + m_elems.push_back(v.toString()); + return NULL; +} + +ArrayData *MapString::append(const ArrayData *elems, ArrayOp op, bool copy) { + ASSERT(elems); + + const EmptyArray *none = dynamic_cast(elems); + if (none) { + return NULL; + } + + const VectorString *strs = dynamic_cast(elems); + if (strs) { + if (copy) { + return NEW(MapString)(this, strs, op); + } + appendImpl(m_elems, strs->getElems(), op); + return NULL; + } + + const MapString *mapString = dynamic_cast(elems); + if (mapString) { + if (copy) { + return NEW(MapString)(this, mapString, op); + } + appendImpl(m_elems, mapString, mapString->getElems(), op); + return NULL; + } + + const SharedMap *mapShared = dynamic_cast(elems); + if (mapShared) { + MapVariant *escalated = mapShared->escalateToMapVariant(); + MapVariant *ret = NEW(MapVariant)(this, escalated, op); + DELETE(MapVariant)(escalated); + return ret; + } + + return NEW(MapVariant)(this, elems, op); +} + +ArrayData *MapString::insert(ssize_t pos, CVarRef v, bool copy) { + if (pos >= size()) { + return append(v, false); + } + if (pos < 0) pos = 0; + + if (!v.isString()) { + ArrayData *ret = NEW(MapVariant)(this); + ret->insert(pos, v, false); + return ret; + } + + if (copy) { + ArrayData* ret = NEW(MapString)(this); + ret->insert(pos, v, false); + return ret; + } + + insertKey(pos); + m_elems.insert(pos, v.toString()); + return NULL; +} + +void MapString::onSetStatic() { + Map::onSetStatic(); + for (unsigned int i = 0; i < m_elems.size(); i++) { + m_elems[i]->setStatic(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/map_string.h b/src/cpp/base/array/map_string.h new file mode 100644 index 0000000000000..cbb0b264d4c16 --- /dev/null +++ b/src/cpp/base/array/map_string.h @@ -0,0 +1,117 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_MAP_STRING_H__ +#define __HPHP_MAP_STRING_H__ + +#include + +namespace HPHP { + +class VectorString; +/////////////////////////////////////////////////////////////////////////////// + +/** + * Map string to string. + */ +class MapString : public Map { + public: + /** + * Constructors. + */ + MapString(CVarRef k, CStrRef v); + MapString(const std::vector &elems, bool replace = true); + MapString(const MapString *src); + + MapString(const VectorString *src, CVarRef k, CStrRef v); + MapString(const VectorString *src, const MapString *elems, ArrayOp op); + + MapString(const MapString *src, CStrRef v); + MapString(const MapString *src, CVarRef k, CStrRef v); + MapString(const MapString *src, const VectorString *elems, ArrayOp op); + MapString(const MapString *src, const MapString *elems, ArrayOp op); + + MapString(const VectorString *src, int eraseIndex); + MapString(const MapString *src, int eraseIndex); + + /** + * Implementing ArrayData... + */ + virtual ssize_t size() const; + virtual Variant getValue(ssize_t pos) const; + + virtual ArrayData *lval(Variant *&ret, bool copy); + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1); + + virtual ArrayData *setImpl(CVarRef k, CVarRef v, + bool copy, int64 prehash = -1); + + virtual ArrayData *remove(int64 k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(litstr k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CStrRef k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CVarRef k, bool copy, int64 prehash = -1); + + virtual ArrayData *copy() const; + virtual ArrayData *append(CVarRef v, bool copy); + virtual ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy); + virtual ArrayData *insert(ssize_t pos, CVarRef v, bool copy); + + virtual void onSetStatic(); + + /** + * Low level access to underlying data. Should be limited in use. + */ + const HphpVector &getElems() const { return m_elems;} + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION(MapString, SmartAllocatorImpl::NeedRestore); + bool calculate(int &size) { + bool ret = Map::calculate(size); + return m_elems.calculate(size) || ret; + } + void backup(LinearAllocator &allocator) { + Map::backup(allocator); + m_elems.backup(allocator); + } + void restore(const char *&data) { + Map::restore(data); + m_elems.restore(data); + } + void sweep() { + Map::sweep(); + m_elems.sweep(); + } + + protected: + virtual Variant getImpl(int index) const { return m_elems[index]; } + + private: + HphpVector m_elems; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_MAP_STRING_H__ diff --git a/src/cpp/base/array/map_variant.cpp b/src/cpp/base/array/map_variant.cpp new file mode 100644 index 0000000000000..b68ce0bb5094a --- /dev/null +++ b/src/cpp/base/array/map_variant.cpp @@ -0,0 +1,601 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION(MapVariant, SmartAllocatorImpl::NeedRestore); +/////////////////////////////////////////////////////////////////////////////// +// constructors + +MapVariant::MapVariant(CVarRef k, CVarRef v) { + insertKey(k); + m_elems.push_back(ArrayFuncs::element(v)); +} + +MapVariant::MapVariant(const std::vector &elems, + bool replace /* = true */) { + unsigned int size = elems.size(); + m_elems.reserve(size); + for (unsigned int i = 0; i < size; i++) { + ArrayElement *elem = elems[i]; + if (elem->hasName()) { + uint idx = insertKey(elem->getName(), elem->getHash()); + if (idx < m_elems.size()) { + if (replace) { + Variant *&v = m_elems[idx]; + if (v) { + ArrayFuncs::release(v); + } + v = ArrayFuncs::element(elem->getVariant()); + } + continue; + } + } else { + appendKey(); + } + m_elems.push_back(ArrayFuncs::element(elem->getVariant())); + } +} + +MapVariant::MapVariant(const MapLong *src) : Map(src) { + ASSERT(src); + ArrayFuncs::append(m_elems, src->getElems()); +} + +MapVariant::MapVariant(const MapString *src) : Map(src) { + ASSERT(src); + ArrayFuncs::append(m_elems, src->getElems()); +} + +MapVariant::MapVariant(const MapVariant *src) : Map(src) { + ASSERT(src); + ArrayFuncs::append(m_elems, src->getElems()); +} + +MapVariant::MapVariant(const VectorLong *src) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), Plus); +} +MapVariant::MapVariant(const VectorString *src) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), Plus); +} +MapVariant::MapVariant(const VectorVariant *src) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), Plus); +} + +MapVariant::MapVariant(const VectorLong *src, CVarRef k, CVarRef v) { + ASSERT(src); + ASSERT(src->getIndex(k) < 0); + appendImpl(m_elems, src->getElems(), k, ArrayFuncs::element(v)); +} + +MapVariant::MapVariant(const VectorString *src, CVarRef k, CVarRef v) { + ASSERT(src); + ASSERT(src->getIndex(k) < 0); + appendImpl(m_elems, src->getElems(), k, ArrayFuncs::element(v)); +} + +MapVariant::MapVariant(const VectorVariant *src, CVarRef k, CVarRef v, + bool copy) { + ASSERT(src); + ASSERT(src->getIndex(k) < 0); + + const HphpVector &srcElems = src->getElems(); + m_nextIndex = srcElems.size(); + for (int i = 0; i < m_nextIndex; i++) { + m_map[Variant((int64)i)] = i; + } + + // Called by VectorVariant::setImpl(): special escalation that will NOT + // make a copy of array elements if copy is not requested + m_elems.reserve(m_nextIndex + 1); + if (copy) { + appendImpl(m_elems, src->getElems(), k, ArrayFuncs::element(v)); + } else { + m_elems.append(srcElems); + insertKey(k); + m_elems.push_back(ArrayFuncs::element(v)); + } +} + +MapVariant::MapVariant(const VectorLong *src, const MapString *elems, + ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src->getElems(), elems, elems->getElems(), op); +} + +MapVariant::MapVariant(const VectorString *src, const MapLong *elems, + ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src->getElems(), elems, elems->getElems(), op); +} + +MapVariant::MapVariant(const VectorVariant *src, const Map *elems, + ArrayOp op) { + ASSERT(src && elems); + + const MapVariant *mapVariant = dynamic_cast(elems); + if (mapVariant) { + appendImpl(m_elems, src->getElems(), elems, mapVariant->getElems(), op); + return; + } + + const MapLong *mapLong = dynamic_cast(elems); + if (mapLong) { + appendImpl(m_elems, src->getElems(), elems, mapLong->getElems(), op); + return; + } + + const MapString *mapString = dynamic_cast(elems); + if (mapString) { + appendImpl(m_elems, src->getElems(), elems, mapString->getElems(), op); + return; + } + + ASSERT(false); +} + +MapVariant::MapVariant(const MapLong *src, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), ArrayFuncs::element(v)); +} + +MapVariant::MapVariant(const MapString *src, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), ArrayFuncs::element(v)); +} + +MapVariant::MapVariant(const MapVariant *src, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), ArrayFuncs::element(v)); +} + +MapVariant::MapVariant(const MapLong *src, CVarRef k, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), k, ArrayFuncs::element(v)); +} + +MapVariant::MapVariant(const MapString *src, CVarRef k, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), k, ArrayFuncs::element(v)); +} + +MapVariant::MapVariant(const MapVariant *src, CVarRef k, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), k, ArrayFuncs::element(v)); +} + +MapVariant::MapVariant(const VectorLong *src, const MapVariant *elems, + ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src->getElems(), elems, elems->getElems(), op); +} + +MapVariant::MapVariant(const VectorString *src, const MapVariant *elems, + ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src->getElems(), elems, elems->getElems(), op); +} + +MapVariant::MapVariant(const MapLong *src, const ArrayData *elems, + ArrayOp op) { + ASSERT(src && elems); + + const MapVariant *mapVariant = dynamic_cast(elems); + if (mapVariant) { + appendImpl(m_elems, src, src->getElems(), mapVariant, + mapVariant->getElems(), op); + return; + } + + const VectorString *vecString = dynamic_cast(elems); + if (vecString) { + appendImpl(m_elems, src, src->getElems(), vecString->getElems(), op); + return; + } + + const VectorVariant *vecVariant = dynamic_cast(elems); + if (vecVariant) { + appendImpl(m_elems, src, src->getElems(), vecVariant->getElems(), op); + return; + } + + const MapLong *mapLong = dynamic_cast(elems); + if (mapLong) { + appendImpl(m_elems, src, src->getElems(), mapLong, mapLong->getElems(), + op); + return; + } + + const MapString *mapString = dynamic_cast(elems); + if (mapString) { + appendImpl(m_elems, src, src->getElems(), mapString, mapString->getElems(), + op); + return; + } + + const VectorLong *vecLong = dynamic_cast(elems); + if (vecLong) { + appendImpl(m_elems, src, src->getElems(), vecLong->getElems(), op); + return; + } + + ASSERT(false); +} + +MapVariant::MapVariant(const MapString *src, const ArrayData *elems, + ArrayOp op) { + ASSERT(src && elems); + + const MapVariant *mapVariant = dynamic_cast(elems); + if (mapVariant) { + appendImpl(m_elems, src, src->getElems(), mapVariant, + mapVariant->getElems(), op); + return; + } + + const VectorString *vecString = dynamic_cast(elems); + if (vecString) { + appendImpl(m_elems, src, src->getElems(), vecString->getElems(), op); + return; + } + + const VectorVariant *vecVariant = dynamic_cast(elems); + if (vecVariant) { + appendImpl(m_elems, src, src->getElems(), vecVariant->getElems(), op); + return; + } + + const MapLong *mapLong = dynamic_cast(elems); + if (mapLong) { + appendImpl(m_elems, src, src->getElems(), mapLong, mapLong->getElems(), + op); + return; + } + + const MapString *mapString = dynamic_cast(elems); + if (mapString) { + appendImpl(m_elems, src, src->getElems(), mapString, + mapString->getElems(), op); + return; + } + + const VectorLong *vecLong = dynamic_cast(elems); + if (vecLong) { + appendImpl(m_elems, src, src->getElems(), vecLong->getElems(), op); + return; + } + + ASSERT(false); +} + +MapVariant::MapVariant(const MapVariant *src, const ArrayData *elems, + ArrayOp op) { + ASSERT(src && elems); + + const MapVariant *mapVariant = dynamic_cast(elems); + if (mapVariant) { + appendImpl(m_elems, src, src->getElems(), mapVariant, + mapVariant->getElems(), op); + return; + } + + const VectorString *vecString = dynamic_cast(elems); + if (vecString) { + appendImpl(m_elems, src, src->getElems(), vecString->getElems(), op); + return; + } + + const VectorVariant *vecVariant = dynamic_cast(elems); + if (vecVariant) { + appendImpl(m_elems, src, src->getElems(), vecVariant->getElems(), op); + return; + } + + const MapLong *mapLong = dynamic_cast(elems); + if (mapLong) { + appendImpl(m_elems, src, src->getElems(), mapLong, mapLong->getElems(), + op); + return; + } + + const MapString *mapString = dynamic_cast(elems); + if (mapString) { + appendImpl(m_elems, src, src->getElems(), mapString, + mapString->getElems(), op); + return; + } + + const VectorLong *vecLong = dynamic_cast(elems); + if (vecLong) { + appendImpl(m_elems, src, src->getElems(), vecLong->getElems(), op); + return; + } + + ASSERT(false); +} + +MapVariant::MapVariant(const VectorVariant *src, int eraseIndex) { + ASSERT(src); + + int iMax = src->getElems().size(); + if (iMax > 0) { + HphpVector elems; + elems.reserve(iMax); + for (int i = 0; i < iMax; i++) { + elems.push_back(src->getElems()[i]); + } + appendImpl(m_elems, elems, eraseIndex); + } +} + +MapVariant::MapVariant(const MapVariant *src, int eraseIndex) { + ASSERT(src); + appendImpl(m_elems, src, src->getElems(), eraseIndex); +} + +MapVariant::~MapVariant() { + for (int i = m_elems.size() - 1; i >= 0; --i) { + ArrayFuncs::release(m_elems[i]); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// implementing ArrayData + +ssize_t MapVariant::size() const { + return m_elems.size(); +} + +Variant MapVariant::getValue(ssize_t pos) const { + ASSERT(pos >= 0 && pos < size()); + return *m_elems[pos]; +} + +CVarRef MapVariant::getValueRef(ssize_t pos) const { + ASSERT(pos >= 0 && pos < size()); + return *m_elems[pos]; +} + +ArrayData *MapVariant::lval(Variant *&ret, bool copy) { + ASSERT(!m_elems.empty()); + + if (copy) { + MapVariant* data = NEW(MapVariant)(this); + ret = data->m_elems.back(); + return data; + } + + ret = m_elems.back(); + return NULL; +} + +ArrayData *MapVariant::lval(int64 k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + return lval(Variant(k), ret, copy, prehash); +} + +ArrayData *MapVariant::lval(litstr k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + return lval(Variant(k), ret, copy, prehash); +} + +ArrayData *MapVariant::lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + return lval(Variant(k), ret, copy, prehash); +} + +ArrayData *MapVariant::lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + if (copy) { + MapVariant* data = NEW(MapVariant)(this); + ArrayData* data2 = data->lval(k, ret, false, prehash); + if (data2) { + data->release(); + return data2; + } + return data; + } + + ssize_t index = insertKey(k, prehash); + if (index >= m_elems.size()) { + ret = NEW(Variant)(); + m_elems.push_back(ret); + } else { + ret = m_elems[index]; + } + return NULL; +} + +ArrayData *MapVariant::setImpl(CVarRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + if (copy) { + return NEW(MapVariant)(this, k, v); + } + uint index = insertKey(k, prehash); + if (index < m_elems.size()) { + *m_elems[index] = v; + } else { + m_elems.push_back(ArrayFuncs::element(v)); + } + return NULL; +} + +ArrayData *MapVariant::remove(int64 k, bool copy, int64 prehash /* = -1 */) { + return remove(Variant(k), copy, prehash); +} + +ArrayData *MapVariant::remove(litstr k, bool copy, int64 prehash /* = -1 */) { + return remove(Variant(k), copy, prehash); +} + +ArrayData *MapVariant::remove(CStrRef k, bool copy, int64 prehash /* = -1 */) { + return remove(Variant(k), copy, prehash); +} + +ArrayData *MapVariant::remove(CVarRef k, bool copy, int64 prehash /* = -1 */) { + int index = getIndex(k, prehash); + if (index >= 0) { + if (size() == 1) { + return StaticEmptyArray::Get(); + } + if (copy) { + return NEW(MapVariant)(this, index); + } + m_elems[index]->release(); + m_elems.remove(index); + removeKey(k, index, prehash); + if (index < m_pos) m_pos--; + } + return NULL; +} + +ArrayData *MapVariant::copy() const { + return NEW(MapVariant)(this); +} + +ArrayData *MapVariant::append(CVarRef v, bool copy) { + if (copy) { + return NEW(MapVariant)(this, v); + } + + appendKey(); + m_elems.push_back(ArrayFuncs::element(v)); + return NULL; +} + +ArrayData *MapVariant::append(const ArrayData *elems, ArrayOp op, bool copy) { + ASSERT(elems); + + const EmptyArray *none = dynamic_cast(elems); + if (none) { + return NULL; + } + + const SharedMap *mapShared = dynamic_cast(elems); + if (mapShared) { + MapVariant *escalated = mapShared->escalateToMapVariant(); + MapVariant *ret = NULL; + if (copy) { + ret = NEW(MapVariant)(this, escalated, op); + } else { + appendImpl(m_elems, escalated, escalated->getElems(), op); + } + DELETE(MapVariant)(escalated); + return ret; + } + + if (copy) { + return NEW(MapVariant)(this, elems, op); + } + + const MapVariant *mapVariant = dynamic_cast(elems); + if (mapVariant) { + appendImpl(m_elems, mapVariant, mapVariant->getElems(), op); + return NULL; + } + + const VectorString *vecString = dynamic_cast(elems); + if (vecString) { + appendImpl(m_elems, vecString->getElems(), op); + return NULL; + } + + const VectorVariant *vecVariant = dynamic_cast(elems); + if (vecVariant) { + appendImpl(m_elems, vecVariant->getElems(), op); + return NULL; + } + + const MapLong *mapLong = dynamic_cast(elems); + if (mapLong) { + appendImpl(m_elems, mapLong, mapLong->getElems(), op); + return NULL; + } + + const MapString *mapString = dynamic_cast(elems); + if (mapString) { + appendImpl(m_elems, mapString, mapString->getElems(), op); + return NULL; + } + + const VectorLong *vecLong = dynamic_cast(elems); + if (vecLong) { + appendImpl(m_elems, vecLong->getElems(), op); + return NULL; + } + + ASSERT(false); + return NULL; +} + +ArrayData *MapVariant::insert(ssize_t pos, CVarRef v, bool copy) { + if (pos >= size()) { + return append(v, false); + } + if (pos < 0) pos = 0; + + if (copy) { + ArrayData* ret = NEW(MapVariant)(this); + ret->insert(pos, v, false); + return ret; + } + + insertKey(pos); + m_elems.insert(pos, ArrayFuncs::element(v)); + return NULL; +} + +void MapVariant::onSetStatic() { + Map::onSetStatic(); + for (unsigned int i = 0; i < m_elems.size(); i++) { + m_elems[i]->setStatic(); + } +} + +void MapVariant::getFullPos(FullPos &pos) { + if (m_pos != ArrayData::invalid_index) { + Variant k = getKey(m_pos); + const HphpMapCell &c = m_map.findCell(k); + pos.primary = c.hash(); + pos.secondary = c.num(); + } else { + pos.primary = ArrayData::invalid_index; + } +} +bool MapVariant::setFullPos(const FullPos &pos) { + // Only set if pos hasn't been invalidated. + if (pos.primary != ArrayData::invalid_index) { + m_pos = m_map.rawFind(pos.primary, pos.secondary); + } + if (m_pos == ArrayData::invalid_index || m_pos >= size()) return false; + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/map_variant.h b/src/cpp/base/array/map_variant.h new file mode 100644 index 0000000000000..dbe12db7e4b41 --- /dev/null +++ b/src/cpp/base/array/map_variant.h @@ -0,0 +1,155 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_MAP_VARIANT_H__ +#define __HPHP_MAP_VARIANT_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * MapVariant is really the last resort of ArrayData to hold something other + * types cannot hold. This is the least efficient data structure both in time + * and space, but it can describe any ArrayData. Zend's HashTable is running + * in a similar mode, although it's still a lot different from this data + * structure. + */ +class MapVariant : public Map { + public: + /** + * Constructors. + */ + MapVariant(CVarRef k, CVarRef v); + MapVariant(const std::vector &elems, bool replace = true); + + MapVariant(const MapLong *src); + MapVariant(const MapString *src); + MapVariant(const MapVariant *src); + + MapVariant(const VectorLong *src); + MapVariant(const VectorString *src); + MapVariant(const VectorVariant *src); + + MapVariant(const VectorLong *src, CVarRef k, CVarRef v); + MapVariant(const VectorString *src, CVarRef k, CVarRef v); + MapVariant(const VectorVariant *src, CVarRef k, CVarRef v, bool copy); + + MapVariant(const VectorLong *src, const MapString *elems, ArrayOp op); + MapVariant(const VectorString *src, const MapLong *elems, ArrayOp op); + MapVariant(const VectorVariant *src, const Map *elems, ArrayOp op); + + MapVariant(const MapLong *src, CVarRef v); + MapVariant(const MapString *src, CVarRef v); + MapVariant(const MapVariant *src, CVarRef v); + + MapVariant(const MapLong *src, CVarRef k, CVarRef v); + MapVariant(const MapString *src, CVarRef k, CVarRef v); + MapVariant(const MapVariant *src, CVarRef k, CVarRef v); + + MapVariant(const VectorLong *src, const MapVariant *elems, ArrayOp op); + MapVariant(const VectorString *src, const MapVariant *elems, ArrayOp op); + + MapVariant(const MapLong *src, const ArrayData *elems, ArrayOp op); + MapVariant(const MapString *src, const ArrayData *elems, ArrayOp op); + MapVariant(const MapVariant *src, const ArrayData *elems, ArrayOp op); + + MapVariant(const VectorVariant *src, int eraseIndex); + MapVariant(const MapVariant *src, int eraseIndex); + + ~MapVariant(); + + /** + * Implementing ArrayData... + */ + virtual ssize_t size() const; + virtual Variant getValue(ssize_t pos) const; + virtual CVarRef getValueRef(ssize_t pos) const; + virtual bool supportValueRef() const { return true;} + + virtual ArrayData *lval(Variant *&ret, bool copy); + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1); + + virtual ArrayData *setImpl(CVarRef k, CVarRef v, bool copy, + int64 prehash = -1); + + virtual ArrayData *remove(int64 k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(litstr k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CVarRef k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CStrRef k, bool copy, int64 prehash = -1); + + virtual ArrayData *copy() const; + virtual ArrayData *append(CVarRef v, bool copy); + virtual ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy); + virtual ArrayData *insert(ssize_t pos, CVarRef v, bool copy); + + virtual void onSetStatic(); + + virtual void getFullPos(FullPos &pos); + virtual bool setFullPos(const FullPos &pos); + + /** + * Low level access to underlying data. Should be limited in use. + */ + const HphpVector &getElems() const { return m_elems;} + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION(MapVariant, SmartAllocatorImpl::NeedRestore); + bool calculate(int &size) { + bool ret = Map::calculate(size); + return m_elems.calculate(size) || ret; + } + void backup(LinearAllocator &allocator) { + Map::backup(allocator); + m_elems.backup(allocator); + } + void restore(const char *&data) { + Map::restore(data); + m_elems.restore(data); + } + void sweep() { + Map::sweep(); + m_elems.sweep(); + } + + protected: + virtual Variant getImpl(int index) const { return *m_elems[index]; } + + private: + /** + * We have to use pointers so to avoid object copying during resizing. This + * also makes lval() safer. It does require those appendImpl() to be re- + * implemented for this class. + */ + HphpVector m_elems; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_MAP_VARIANT_H__ diff --git a/src/cpp/base/array/vector.cpp b/src/cpp/base/array/vector.cpp new file mode 100644 index 0000000000000..65d8b0cc5227c --- /dev/null +++ b/src/cpp/base/array/vector.cpp @@ -0,0 +1,107 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant Vector::getKey(ssize_t pos) const { + ASSERT(pos != ArrayData::invalid_index && pos < size()); + return (int64)pos; +} + + +Variant Vector::get(int64 k, int64 prehash /* = -1 */) const { + return getImpl(getIndex(k)); +} + +Variant Vector::get(litstr k, int64 prehash /* = -1 */) const { + return getImpl(getIndex(k)); +} + +Variant Vector::get(CStrRef k, int64 prehash /* = -1 */) const { + return getImpl(getIndex(k)); +} + +Variant Vector::get(CVarRef k, int64 prehash /* = -1 */) const { + return getImpl(getIndex(k)); +} + + +bool Vector::exists(int64 k, int64 prehash /* = -1 */) const { + return getIndex(k) >= 0; +} + +bool Vector::exists(litstr k, int64 prehash /* = -1 */) const { + return getIndex(k) >= 0; +} + +bool Vector::exists(CStrRef k, int64 prehash /* = -1 */) const { + return getIndex(k) >= 0; +} + +bool Vector::exists(CVarRef k, int64 prehash /* = -1 */) const { + return getIndex(k) >= 0; +} + +bool Vector::idxExists(ssize_t idx) const { + return idx != ArrayData::invalid_index; +} + +ssize_t Vector::getIndex(int64 k, bool expanding) const { + if (k >= 0 && (ssize_t)k <= size() - (expanding ? 0 : 1)) { + return k; + } + return ArrayData::invalid_index; +} + +ssize_t Vector::getIndex(litstr k, bool expanding) const { + return ArrayData::invalid_index; +} + +ssize_t Vector::getIndex(CStrRef k, bool expanding) const { + return ArrayData::invalid_index; +} + +ssize_t Vector::getIndex(CVarRef k, bool expanding) const { + if (k.isNumeric()) { + int64 index = k.toInt64(); + if (index >= 0 && (ssize_t)index <= size() - (expanding ? 0 : 1)) { + return index; + } + } + return ArrayData::invalid_index; +} + +ssize_t Vector::getIndex(int64 k, int64 prehash /* = -1 */) const { + return getIndex(k, false); +} + +ssize_t Vector::getIndex(litstr k, int64 prehash /* = -1 */) const { + return getIndex(k, false); +} + +ssize_t Vector::getIndex(CStrRef k, int64 prehash /* = -1 */) const { + return getIndex(k, false); +} + +ssize_t Vector::getIndex(CVarRef k, int64 prehash /* = -1 */) const { + return getIndex(k, false); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/vector.h b/src/cpp/base/array/vector.h new file mode 100644 index 0000000000000..bf0646e421ab0 --- /dev/null +++ b/src/cpp/base/array/vector.h @@ -0,0 +1,166 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_VECTOR_H__ +#define __HPHP_VECTOR_H__ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Base class of all vectors. A vector is a list of values without keys (or + * with consecutive numeric keys starting from 0). + */ +class Vector : public ArrayData { + public: + Vector() {} + Vector(const Vector *src) : ArrayData(src) {} + + /** + * Implementing ArrayData... + */ + virtual Variant getKey(ssize_t pos) const; + virtual bool isVectorData() const { return true;} + + virtual bool exists(int64 k, int64 prehash = -1) const; + virtual bool exists(litstr k, int64 prehash = -1) const; + virtual bool exists(CStrRef k, int64 prehash = -1) const; + virtual bool exists(CVarRef k, int64 prehash = -1) const; + + virtual bool idxExists(ssize_t idx) const; + + virtual Variant get(int64 k, int64 prehash = -1) const; + virtual Variant get(litstr k, int64 prehash = -1) const; + virtual Variant get(CStrRef k, int64 prehash = -1) const; + virtual Variant get(CVarRef k, int64 prehash = -1) const; + + /** + * Try to resolve to a numeic index. Returns -1 if not possible. + */ + ssize_t getIndex(int64 k, bool expanding) const; + ssize_t getIndex(litstr k, bool expanding) const; + ssize_t getIndex(CStrRef k, bool expanding) const; + ssize_t getIndex(CVarRef k, bool expanding) const; + + ssize_t getIndex(int64 k, int64 prehash = -1) const; + ssize_t getIndex(litstr k, int64 prehash = -1) const; + ssize_t getIndex(CStrRef k, int64 prehash = -1) const; + ssize_t getIndex(CVarRef k, int64 prehash = -1) const; + + protected: + virtual Variant getImpl(int index) const = 0; + /** + * Copy src to dest. This is escalating vector. + */ + template + static void appendImpl(HphpVector &dest, + const HphpVector &src) { + dest.reserve(dest.size() + src.size()); + ArrayFuncs::append(dest, src); + } + + /** + * Copy src to dest then append one single value. + */ + template + static void appendImpl(HphpVector &dest, const HphpVector &src, + const T1 &v) { + dest.reserve(dest.size() + src.size() + 1); + ArrayFuncs::append(dest, src); + dest.push_back(v); + } + + /** + * Copy src to dest then set one single value. + */ + template + static void appendImpl(HphpVector &dest, const HphpVector &src, + int index, const T1 &v) { + if (index == (int)src.size()) { + appendImpl(dest, src, v); + } else { + ASSERT(index >= 0 && index < (int)src.size()); + ArrayFuncs::append(dest, src); + ArrayFuncs::set(dest, index, v); + } + } + + /** + * Append elems to src but store result in dest without changing src. + */ + template + static void appendImpl(HphpVector &dest, const HphpVector &src, + const HphpVector &elems, ArrayOp op) { + int count1 = src.size(); + int count2 = elems.size(); + switch (op) { + case Plus: + if (count1 > count2) { + ArrayFuncs::append(dest, src); + } else { + dest.reserve(count2); + ArrayFuncs::append(dest, src); + ArrayFuncs::append(dest, elems, count1); + } + break; + case Merge: + dest.reserve(count1 + count2); + ArrayFuncs::append(dest, src); + ArrayFuncs::append(dest, elems); + break; + default: + ASSERT(false); + break; + } + } + + /** + * Append elems to dest. + */ + template + static void appendImpl(HphpVector &dest, const HphpVector &elems, + ArrayOp op) { + switch (op) { + case Plus: + { + int count1 = dest.size(); + int count2 = elems.size(); + if (count1 <= count2) { + ArrayFuncs::append(dest, elems, count1); + } + } + break; + case Merge: + ArrayFuncs::append(dest, elems); + break; + default: + ASSERT(false); + break; + } + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_VECTOR_H__ diff --git a/src/cpp/base/array/vector_long.cpp b/src/cpp/base/array/vector_long.cpp new file mode 100644 index 0000000000000..df63f901ea610 --- /dev/null +++ b/src/cpp/base/array/vector_long.cpp @@ -0,0 +1,301 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION(VectorLong, SmartAllocatorImpl::NeedRestore); +/////////////////////////////////////////////////////////////////////////////// +// constructors + +VectorLong::VectorLong(int64 v) { + m_elems.push_back(v); +} + +VectorLong::VectorLong(const std::vector &elems) { + unsigned int size = elems.size(); + m_elems.reserve(size); + for (unsigned int i = 0; i < size; i++) { + m_elems.push_back(elems[i]->getInt64()); + } +} + +VectorLong::VectorLong(const VectorLong *src) : Vector(src) { + ASSERT(src); + m_elems = src->getElems(); +} + +VectorLong::VectorLong(const VectorLong *src, int64 v) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), v); +} + +VectorLong::VectorLong(const VectorLong *src, int index, int64 v) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), index, v); +} + +VectorLong::VectorLong(const VectorLong *src, const VectorLong *elems, + ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src->getElems(), elems->getElems(), op); +} + +/////////////////////////////////////////////////////////////////////////////// +// implementing ArrayData + +ssize_t VectorLong::size() const { + return m_elems.size(); +} + +Variant VectorLong::getValue(ssize_t pos) const { + ASSERT(pos >= 0 && pos < size()); + return m_elems[pos]; +} + +ArrayData *VectorLong::lval(Variant *&ret, bool copy) { + VectorVariant *escalated = NEW(VectorVariant)(this); + escalated->lval(ret, false); + return escalated; +} + +ArrayData *VectorLong::lval(int64 k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + VectorVariant *escalated = NEW(VectorVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *VectorLong::lval(litstr k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *VectorLong::lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *VectorLong::lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + ArrayData *escalated; + if (k.isInteger()) { + escalated = NEW(VectorVariant)(this); + } else { + escalated = NEW(MapVariant)(this); + } + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *VectorLong::set(int64 k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + if (k == (int64)m_elems.size()) { + return append(v, copy); + } + return setImpl(k, v, copy); +} + +ArrayData *VectorLong::set(litstr k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + return setImpl(k, v, copy); +} + +ArrayData *VectorLong::set(CStrRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + return setImpl(k, v, copy); +} + +ArrayData *VectorLong::set(CVarRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + if (k.isInteger()) { + return set(k.toInt64(), v, copy); + } + return setImpl(k.toString(), v, copy); +} + +ArrayData *VectorLong::remove(int64 k, bool copy, int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorLong::remove(litstr k, bool copy, int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorLong::remove(CStrRef k, bool copy, int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorLong::remove(CVarRef k, bool copy, int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorLong::copy() const { + return NEW(VectorLong)(this); +} + +ArrayData *VectorLong::append(CVarRef v, bool copy) { + if (!v.isInteger()) { + return NEW(VectorVariant)(this, v); + } + + if (copy) { + return NEW(VectorLong)(this, v.toInt64()); + } + m_elems.push_back(v.toInt64()); + return NULL; +} + +ArrayData *VectorLong::append(const ArrayData *elems, ArrayOp op, bool copy) { + ASSERT(elems); + + const EmptyArray *none = dynamic_cast(elems); + if (none) { + return NULL; + } + + const VectorLong *longs = dynamic_cast(elems); + if (longs) { + if (copy) { + return NEW(VectorLong)(this, longs, op); + } + appendImpl(m_elems, longs->getElems(), op); + return NULL; + } + + // Even though resulting array may still be representable as VectorLong, + // the fact that we are appending/merging heterogenous data implies this + // array is variant by nature. + const Vector *vec = dynamic_cast(elems); + if (vec) { + return NEW(VectorVariant)(this, vec, op); + } + const MapVariant *mapVariant = dynamic_cast(elems); + if (mapVariant) { + return NEW(MapVariant)(this, mapVariant, op); + } + const MapLong *mapLong = dynamic_cast(elems); + if (mapLong) { + return NEW(MapLong)(this, mapLong, op); + } + const MapString *mapString = dynamic_cast(elems); + if (mapString) { + return NEW(MapVariant)(this, mapString, op); + } + const SharedMap *mapShared = dynamic_cast(elems); + if (mapShared) { + MapVariant *escalated = mapShared->escalateToMapVariant(); + MapVariant *ret = NEW(MapVariant)(this, escalated, op); + DELETE(MapVariant)(escalated); + return ret; + } + ASSERT(false); + return NULL; +} + +ArrayData *VectorLong::insert(ssize_t pos, CVarRef v, bool copy) { + if (!v.isInteger()) { + ArrayData *ret = NEW(VectorVariant)(this); + ret->insert(pos, v, false); + return ret; + } + + if (copy) { + ArrayData* ret = NEW(VectorLong)(this); + ret->insert(pos, v, false); + return ret; + } + + if (pos >= size()) { + return append(v, false); + } + if (pos < 0) pos = 0; + + m_elems.insert(pos, v.toInt64()); + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +Variant VectorLong::getImpl(int index) const { + if (index >= 0) { + return m_elems[index]; + } + return null; +} + +bool VectorLong::setImpl(int index, CVarRef v, bool copy, ArrayData *&ret) { + bool keepVector = false; + if (index >= 0) { + keepVector = true; + } + + if (!v.isInteger()) { + if (keepVector) { + ret = NEW(VectorVariant)(this, index, v); + return true; + } + return false; + } + + if (!keepVector) { + return false; + } + if (copy) { + ret = NEW(VectorLong)(this, index, v.toInt64()); + return true; + } + + if ((ssize_t)index < size()) { + ASSERT(index >= 0); + m_elems[index] = v.toInt64(); + } else { + ASSERT((ssize_t)index == size()); + m_elems.push_back(v.toInt64()); + } + ret = NULL; + return true; +} + +ArrayData *VectorLong::removeImpl(int index, bool copy) { + if (index >= 0) { + if (size() == 1) { + return StaticEmptyArray::Get(); + } + if (copy || (ssize_t)index < size() - 1) { + return NEW(MapLong)(this, index); + } + m_elems.remove(index); + } + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/vector_long.h b/src/cpp/base/array/vector_long.h new file mode 100644 index 0000000000000..dfa41ef4d3fa0 --- /dev/null +++ b/src/cpp/base/array/vector_long.h @@ -0,0 +1,123 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_VECTOR_LONG_H__ +#define __HPHP_VECTOR_LONG_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * A vector of Int64 or integer values. + */ +class VectorLong : public Vector { + public: + /** + * Constructors. + */ + VectorLong(int64 v); + VectorLong(const std::vector &elems); + VectorLong(const VectorLong *src); + VectorLong(const VectorLong *src, int64 v); + VectorLong(const VectorLong *src, int index, int64 v); + VectorLong(const VectorLong *src, const VectorLong *elems, ArrayOp op); + + /** + * Implementing ArrayData... + */ + virtual ssize_t size() const; + virtual Variant getValue(ssize_t pos) const; + + virtual ArrayData *lval(Variant *&ret, bool copy); + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1); + + virtual ArrayData *set(int64 k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(litstr k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(CStrRef k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(CVarRef k, CVarRef v, bool copy, int64 prehash = -1); + + virtual ArrayData *remove(int64 k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(litstr k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CStrRef k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CVarRef k, bool copy, int64 prehash = -1); + + virtual ArrayData *copy() const; + virtual ArrayData *append(CVarRef v, bool copy); + virtual ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy); + virtual ArrayData *insert(ssize_t pos, CVarRef v, bool copy); + + virtual void onSetStatic() {} + + /** + * Low level access to underlying data. Should be limited in use. + */ + const HphpVector &getElems() const { return m_elems;} + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION(VectorLong, SmartAllocatorImpl::NeedRestore); + bool calculate(int &size) { + return m_elems.calculate(size); + } + void backup(LinearAllocator &allocator) { + m_elems.backup(allocator); + } + void restore(const char *&data) { + m_elems.restore(data); + } + void sweep() { + m_elems.sweep(); + } + + protected: + Variant getImpl(int index) const; + + private: + HphpVector m_elems; + + bool setImpl(int index, CVarRef v, bool copy, ArrayData *&ret); + ArrayData *removeImpl(int index, bool copy); + + template + ArrayData *setImpl(const T &k, CVarRef v, bool copy) { + int index = getIndex(k, true); + ArrayData *ret = NULL; + if (setImpl(index, v, copy, ret)) { + return ret; + } + if (v.isInteger()) { + return NEW(MapLong)(this, String(k), v.toInt64()); + } + return NEW(MapVariant)(this, String(k), v); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_VECTOR_LONG_H__ diff --git a/src/cpp/base/array/vector_string.cpp b/src/cpp/base/array/vector_string.cpp new file mode 100644 index 0000000000000..a7359b00020bf --- /dev/null +++ b/src/cpp/base/array/vector_string.cpp @@ -0,0 +1,310 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION(VectorString, SmartAllocatorImpl::NeedRestore); +/////////////////////////////////////////////////////////////////////////////// +// constructors + +VectorString::VectorString(CStrRef v) { + m_elems.push_back(v); +} + +VectorString::VectorString(const std::vector &elems) { + unsigned int size = elems.size(); + m_elems.reserve(size); + for (unsigned int i = 0; i < size; i++) { + m_elems.push_back(elems[i]->getString()); + } +} + +VectorString::VectorString(const VectorString *src) : Vector(src) { + ASSERT(src); + m_elems = src->getElems(); +} + +VectorString::VectorString(const VectorString *src, CStrRef v) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), v); +} + +VectorString::VectorString(const VectorString *src, int index, CStrRef v) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), index, v); +} + +VectorString::VectorString(const VectorString *src, const VectorString *elems, + ArrayOp op) { + ASSERT(src && elems); + appendImpl(m_elems, src->getElems(), elems->getElems(), op); +} + +/////////////////////////////////////////////////////////////////////////////// +// implementing ArrayData + +ssize_t VectorString::size() const { + return m_elems.size(); +} + +Variant VectorString::getValue(ssize_t pos) const { + ASSERT(pos >= 0 && pos < size()); + return m_elems[pos]; +} + +ArrayData *VectorString::lval(Variant *&ret, bool copy) { + VectorVariant *escalated = NEW(VectorVariant)(this); + escalated->lval(ret, false); + return escalated; +} + +ArrayData *VectorString::lval(int64 k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + VectorVariant *escalated = NEW(VectorVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *VectorString::lval(litstr k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *VectorString::lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *VectorString::lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + ArrayData *escalated; + if (k.isInteger()) { + escalated = NEW(VectorVariant)(this); + } else { + escalated = NEW(MapVariant)(this); + } + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *VectorString::set(int64 k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + if (k == (int64)m_elems.size()) { + return append(v, copy); + } + return setImpl(k, v, copy); +} + +ArrayData *VectorString::set(litstr k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + return setImpl(k, v, copy); +} + +ArrayData *VectorString::set(CStrRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + return setImpl(k, v, copy); +} + +ArrayData *VectorString::set(CVarRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + if (k.isInteger()) { + return set(k.toInt64(), v, copy); + } + return setImpl(k.toString(), v, copy); +} + +ArrayData *VectorString::remove(int64 k, bool copy, int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorString::remove(litstr k, bool copy, int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorString::remove(CStrRef k, bool copy, + int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorString::remove(CVarRef k, bool copy, + int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorString::copy() const { + return NEW(VectorString)(this); +} + +ArrayData *VectorString::append(CVarRef v, bool copy) { + if (!v.isString()) { + return NEW(VectorVariant)(this, v); + } + + if (copy) { + return NEW(VectorString)(this, v.toString()); + } + m_elems.push_back(v.toString()); + return NULL; +} + +ArrayData *VectorString::append(const ArrayData *elems, ArrayOp op, + bool copy) { + ASSERT(elems); + + const EmptyArray *none = dynamic_cast(elems); + if (none) { + return NULL; + } + + const VectorString *strs = dynamic_cast(elems); + if (strs) { + if (copy) { + return NEW(VectorString)(this, strs, op); + } + appendImpl(m_elems, strs->getElems(), op); + return NULL; + } + + // Even though resulting array may still be representable as VectorString, + // the fact that we are appending/merging heterogenous data implies this + // array is variant by nature. + const Vector *vec = dynamic_cast(elems); + if (vec) { + return NEW(VectorVariant)(this, vec, op); + } + const MapVariant *mapVariant = dynamic_cast(elems); + if (mapVariant) { + return NEW(MapVariant)(this, mapVariant, op); + } + const MapString *mapString = dynamic_cast(elems); + if (mapString) { + return NEW(MapString)(this, mapString, op); + } + const MapLong *mapLong = dynamic_cast(elems); + if (mapLong) { + return NEW(MapVariant)(this, mapLong, op); + } + const SharedMap *mapShared = dynamic_cast(elems); + if (mapShared) { + MapVariant *escalated = mapShared->escalateToMapVariant(); + MapVariant *ret = NEW(MapVariant)(this, escalated, op); + DELETE(MapVariant)(escalated); + return ret; + } + ASSERT(false); + return NULL; +} + +ArrayData *VectorString::insert(ssize_t pos, CVarRef v, bool copy) { + if (!v.isString()) { + ArrayData *ret = NEW(VectorVariant)(this); + ret->insert(pos, v, false); + return ret; + } + + if (copy) { + ArrayData* ret = NEW(VectorString)(this); + ret->insert(pos, v, false); + return ret; + } + + if (pos >= size()) { + return append(v, false); + } + if (pos < 0) pos = 0; + + m_elems.insert(pos, v.toString()); + return NULL; +} + +void VectorString::onSetStatic() { + for (unsigned int i = 0; i < m_elems.size(); i++) { + m_elems[i]->setStatic(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +Variant VectorString::getImpl(int index) const { + if (index >= 0) { + return m_elems[index]; + } + return null; +} + +bool VectorString::setImpl(int index, CVarRef v, bool copy, ArrayData *&ret) { + bool keepVector = false; + if (index >= 0) { + keepVector = true; + } + + if (!v.isString()) { + if (keepVector) { + ret = NEW(VectorVariant)(this, index, v); + return true; + } + return false; + } + + if (!keepVector) { + return false; + } + if (copy) { + ret = NEW(VectorString)(this, index, v.toString()); + return true; + } + + if ((ssize_t)index < size()) { + ASSERT(index >= 0); + m_elems[index] = v.toString(); + } else { + ASSERT((ssize_t)index == size()); + m_elems.push_back(v.toString()); + } + ret = NULL; + return true; +} + +ArrayData *VectorString::removeImpl(int index, bool copy) { + if (index >= 0) { + if (size() == 1) { + return StaticEmptyArray::Get(); + } + if (copy || (ssize_t)index < size() - 1) { + return NEW(MapString)(this, index); + } + m_elems.remove(index); + } + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/vector_string.h b/src/cpp/base/array/vector_string.h new file mode 100644 index 0000000000000..047dd0b437f89 --- /dev/null +++ b/src/cpp/base/array/vector_string.h @@ -0,0 +1,123 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_VECTOR_STRING_H__ +#define __HPHP_VECTOR_STRING_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * A vector of strings. + */ +class VectorString : public Vector { + public: + /** + * Constructors. + */ + VectorString(CStrRef v); + VectorString(const std::vector &elems); + VectorString(const VectorString *src); + VectorString(const VectorString *src, CStrRef v); + VectorString(const VectorString *src, int index, CStrRef v); + VectorString(const VectorString *src, const VectorString *elems, ArrayOp op); + + /** + * Implementing ArrayData... + */ + virtual ssize_t size() const; + virtual Variant getValue(ssize_t pos) const; + + virtual ArrayData *lval(Variant *&ret, bool copy); + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1); + + virtual ArrayData *set(int64 k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(litstr k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(CStrRef k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(CVarRef k, CVarRef v, bool copy, int64 prehash = -1); + + virtual ArrayData *remove(int64 k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(litstr k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CStrRef k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CVarRef k, bool copy, int64 prehash = -1); + + virtual ArrayData *copy() const; + virtual ArrayData *append(CVarRef v, bool copy); + virtual ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy); + virtual ArrayData *insert(ssize_t pos, CVarRef v, bool copy); + + virtual void onSetStatic(); + + /** + * Low level access to underlying data. Should be limited in use. + */ + const HphpVector &getElems() const { return m_elems;} + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION(VectorString, SmartAllocatorImpl::NeedRestore); + bool calculate(int &size) { + return m_elems.calculate(size); + } + void backup(LinearAllocator &allocator) { + m_elems.backup(allocator); + } + void restore(const char *&data) { + m_elems.restore(data); + } + void sweep() { + m_elems.sweep(); + } + + protected: + Variant getImpl(int index) const; + + private: + HphpVector m_elems; + + bool setImpl(int index, CVarRef v, bool copy, ArrayData *&ret); + ArrayData *removeImpl(int index, bool copy); + + template + ArrayData *setImpl(const T &k, CVarRef v, bool copy) { + int index = getIndex(k, true); + ArrayData *ret = NULL; + if (setImpl(index, v, copy, ret)) { + return ret; + } + if (v.isString()) { + return NEW(MapString)(this, String(k), v.toString()); + } + return NEW(MapVariant)(this, String(k), v); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_VECTOR_STRING_H__ diff --git a/src/cpp/base/array/vector_variant.cpp b/src/cpp/base/array/vector_variant.cpp new file mode 100644 index 0000000000000..8ad70877894eb --- /dev/null +++ b/src/cpp/base/array/vector_variant.cpp @@ -0,0 +1,413 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION(VectorVariant, SmartAllocatorImpl::NeedRestore); +/////////////////////////////////////////////////////////////////////////////// +// constructors + +VectorVariant::VectorVariant(CVarRef v) { + m_elems.push_back(ArrayFuncs::element(v)); +} + +VectorVariant::VectorVariant(const std::vector &elems) { + unsigned int size = elems.size(); + m_elems.reserve(size); + for (unsigned int i = 0; i < size; i++) { + m_elems.push_back(ArrayFuncs::element(elems[i]->getVariant())); + } +} + +VectorVariant::VectorVariant(const VectorLong *src) { + ASSERT(src); + appendImpl(m_elems, src->getElems()); +} + +VectorVariant::VectorVariant(const VectorLong *src, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), ArrayFuncs::element(v)); +} + +VectorVariant::VectorVariant(const VectorLong *src, int index, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), index, ArrayFuncs::element(v)); +} + +VectorVariant::VectorVariant(const VectorLong *src, const Vector *vec, + ArrayOp op) { + ASSERT(src && vec); + const VectorString *strs = dynamic_cast(vec); + if (strs) { + appendImpl(m_elems, src->getElems(), strs->getElems(), op); + } else { + const VectorVariant *vars = dynamic_cast(vec); + ASSERT(vars); + appendImpl(m_elems, src->getElems(), vars->getElems(), op); + } +} + +VectorVariant::VectorVariant(const VectorString *src) { + ASSERT(src); + appendImpl(m_elems, src->getElems()); +} + +VectorVariant::VectorVariant(const VectorString *src, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), ArrayFuncs::element(v)); +} + +VectorVariant::VectorVariant(const VectorString *src, int index, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), index, ArrayFuncs::element(v)); +} + +VectorVariant::VectorVariant(const VectorString *src, const Vector *vec, + ArrayOp op) { + ASSERT(src && vec); + const VectorVariant *vars = dynamic_cast(vec); + if (vars) { + appendImpl(m_elems, src->getElems(), vars->getElems(), op); + } else { + const VectorLong *longs = dynamic_cast(vec); + ASSERT(longs); + appendImpl(m_elems, src->getElems(), longs->getElems(), op); + } +} + +VectorVariant::VectorVariant(const VectorVariant *src) : Vector(src) { + ASSERT(src); + ArrayFuncs::append(m_elems, src->getElems()); +} + +VectorVariant::VectorVariant(const VectorVariant *src, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), ArrayFuncs::element(v)); +} + +VectorVariant::VectorVariant(const VectorVariant *src, int index, CVarRef v) { + ASSERT(src); + appendImpl(m_elems, src->getElems(), index, ArrayFuncs::element(v)); +} + +VectorVariant::VectorVariant(const VectorVariant *src, const Vector *vec, + ArrayOp op) { + ASSERT(src && vec); + + const VectorVariant *vars = dynamic_cast(vec); + if (vars) { + appendImpl(m_elems, src->getElems(), vars->getElems(), op); + return; + } + + const VectorString *strs = dynamic_cast(vec); + if (strs) { + appendImpl(m_elems, src->getElems(), strs->getElems(), op); + return; + } + + const VectorLong *longs = dynamic_cast(vec); + if (longs) { + appendImpl(m_elems, src->getElems(), longs->getElems(), op); + return; + } + + ASSERT(false); +} + +VectorVariant::~VectorVariant() { + for (int i = m_elems.size() - 1; i >= 0; --i) { + ArrayFuncs::release(m_elems[i]); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// implementing ArrayData + +ssize_t VectorVariant::size() const { + return m_elems.size(); +} + +Variant VectorVariant::getValue(ssize_t pos) const { + ASSERT(pos >= 0 && pos < size()); + return *m_elems[pos]; +} + +CVarRef VectorVariant::getValueRef(ssize_t pos) const { + ASSERT(pos >= 0 && pos < size()); + return *m_elems[pos]; +} + +ArrayData *VectorVariant::lval(Variant *&ret, bool copy) { + ASSERT(!m_elems.empty()); + + if (copy) { + VectorVariant *data = NEW(VectorVariant)(this); + ret = data->m_elems.back(); + return data; + } + + ret = m_elems.back(); + return NULL; +} + +ArrayData *VectorVariant::lval(int64 k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + return lvalImpl(getIndex(k), ret, copy, prehash); +} + +ArrayData *VectorVariant::lval(litstr k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *VectorVariant::lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; +} + +ArrayData *VectorVariant::lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + if (k.isInteger()) { + return lvalImpl(getIndex(k), ret, copy, prehash); + } else { + MapVariant *escalated = NEW(MapVariant)(this); + escalated->lval(k, ret, false, prehash); + return escalated; + } +} + +ArrayData *VectorVariant::set(int64 k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + if (k == (int64)m_elems.size()) { + return append(v, copy); + } + return setImpl(k, v, copy); +} + +ArrayData *VectorVariant::set(litstr k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + return setImpl(k, v, copy); +} + +ArrayData *VectorVariant::set(CStrRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + return setImpl(k, v, copy); +} + +ArrayData *VectorVariant::set(CVarRef k, CVarRef v, + bool copy, int64 prehash /* = -1 */) { + if (k.isInteger()) { + return set(k.toInt64(), v, copy); + } + return setImpl(k, v, copy); +} + +ArrayData *VectorVariant::remove(int64 k, bool copy, int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorVariant::remove(litstr k, bool copy, + int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorVariant::remove(CStrRef k, bool copy, + int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorVariant::remove(CVarRef k, bool copy, + int64 prehash /* = -1 */) { + return removeImpl(getIndex(k), copy); +} + +ArrayData *VectorVariant::copy() const { + return NEW(VectorVariant)(this); +} + +ArrayData *VectorVariant::append(CVarRef v, bool copy) { + if (copy) { + return NEW(VectorVariant)(this, v); + } + m_elems.push_back(ArrayFuncs::element(v)); + return NULL; +} + +ArrayData *VectorVariant::append(const ArrayData *elems, ArrayOp op, + bool copy) { + ASSERT(elems); + + const EmptyArray *none = dynamic_cast(elems); + if (none) { + return NULL; + } + + const Map *mapAny = dynamic_cast(elems); + if (mapAny) { + return NEW(MapVariant)(this, mapAny, op); + } + + const Vector *vec = dynamic_cast(elems); + if (vec) { + if (copy) { + return NEW(VectorVariant)(this, vec, op); + } + const VectorVariant *vecVariant = dynamic_cast(vec); + if (vecVariant) { + appendImpl(m_elems, vecVariant->getElems(), op); + return NULL; + } + const VectorString *vecString = dynamic_cast(vec); + if (vecString) { + appendImpl(m_elems, vecString->getElems(), op); + return NULL; + } + const VectorLong *vecLong = dynamic_cast(vec); + if (vecLong) { + appendImpl(m_elems, vecLong->getElems(), op); + return NULL; + } + ASSERT(false); + return NULL; + } + + const SharedMap *mapShared = dynamic_cast(elems); + if (mapShared) { + MapVariant *escalated = mapShared->escalateToMapVariant(); + MapVariant *ret = NEW(MapVariant)(this, escalated, op); + DELETE(MapVariant)(escalated); + return ret; + } + ASSERT(false); + return NULL; +} + +ArrayData *VectorVariant::insert(ssize_t pos, CVarRef v, bool copy) { + if (pos >= size()) { + return append(v, false); + } + + if (copy) { + ArrayData* ret = NEW(VectorVariant)(this); + ret->insert(pos, v, false); + return ret; + } + + if (pos == ArrayData::invalid_index) pos = 0; + + m_elems.insert(pos, ArrayFuncs::element(v)); + return NULL; +} + +void VectorVariant::onSetStatic() { + for (unsigned int i = 0; i < m_elems.size(); i++) { + m_elems[i]->setStatic(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +Variant VectorVariant::getImpl(int index) const { + if (index >= 0) { + return *m_elems[index]; + } + return null; +} + +ArrayData *VectorVariant::lvalImpl(int index, Variant *&ret, bool copy, + int64 prehash) { + bool append = index < 0; + if (copy) { + VectorVariant *data = NEW(VectorVariant)(this); + if (append) { + Variant *v = NEW(Variant)(); + data->m_elems.push_back(v); + ret = v; + } else { + ret = data->m_elems[index]; + } + return data; + } + if (append) { + Variant *v = NEW(Variant)(); + m_elems.push_back(v); + ret = v; + } else { + ret = m_elems[index]; + } + return NULL; +} + +bool VectorVariant::setImpl(int index, CVarRef v, bool copy, ArrayData *&ret) { + bool keepVector = false; + if (index >= 0) { + keepVector = true; + } + + if (!keepVector) { + return false; + } + if (copy) { + ret = NEW(VectorVariant)(this, index, v); + return true; + } + + if ((ssize_t)index < size()) { + ASSERT(index >= 0); + *m_elems[index] = v; + } else { + ASSERT((ssize_t)index == size()); + m_elems.push_back(ArrayFuncs::element(v)); + } + ret = NULL; + return true; +} + +ArrayData *VectorVariant::removeImpl(int index, bool copy) { + if (index >= 0) { + if (size() == 1) { + return StaticEmptyArray::Get(); + } + if (copy || (ssize_t)index < size() - 1) { + return NEW(MapVariant)(this, index); + } + m_elems[index]->release(); + m_elems.remove(index); + } + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/vector_variant.h b/src/cpp/base/array/vector_variant.h new file mode 100644 index 0000000000000..d1ff505db93b0 --- /dev/null +++ b/src/cpp/base/array/vector_variant.h @@ -0,0 +1,152 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_VECTOR_VARIANT_H__ +#define __HPHP_VECTOR_VARIANT_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * If we can't use VectorLong or VectorString, we then have to use + * VectorVariant to box all types of values, but we are still a vector. + */ +class VectorVariant : public Vector { + public: + /** + * Constructors. + */ + VectorVariant(CVarRef v); + VectorVariant(const std::vector &elems); + VectorVariant(const VectorLong *src); + VectorVariant(const VectorLong *src, CVarRef v); + VectorVariant(const VectorLong *src, int index, CVarRef v); + VectorVariant(const VectorLong *src, const Vector *vec, ArrayOp op); + VectorVariant(const VectorString *src); + VectorVariant(const VectorString *src, CVarRef v); + VectorVariant(const VectorString *src, int index, CVarRef v); + VectorVariant(const VectorString *src, const Vector *vec, ArrayOp op); + VectorVariant(const VectorVariant *src); + VectorVariant(const VectorVariant *src, CVarRef v); + VectorVariant(const VectorVariant *src, int index, CVarRef v); + VectorVariant(const VectorVariant *src, const Vector *vec, ArrayOp op); + + ~VectorVariant(); + + /** + * Implementing ArrayData... + */ + virtual ssize_t size() const; + virtual Variant getValue(ssize_t pos) const; + virtual CVarRef getValueRef(ssize_t pos) const; + virtual bool supportValueRef() const { return true;} + + virtual ArrayData *lval(Variant *&ret, bool copy); + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1); + + virtual ArrayData *set(int64 k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(litstr k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(CStrRef k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(CVarRef k, CVarRef v, bool copy, int64 prehash = -1); + + virtual ArrayData *remove(int64 k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(litstr k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CStrRef k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CVarRef k, bool copy, int64 prehash = -1); + + virtual ArrayData *copy() const; + virtual ArrayData *append(CVarRef v, bool copy); + virtual ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy); + virtual ArrayData *insert(ssize_t pos, CVarRef v, bool copy); + + virtual void onSetStatic(); + + /** + * Low level access to underlying data. Should be limited in use. + */ + const HphpVector &getElems() const { return m_elems;} + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION(VectorVariant, SmartAllocatorImpl::NeedRestore); + bool calculate(int &size) { + return m_elems.calculate(size); + } + void backup(LinearAllocator &allocator) { + m_elems.backup(allocator); + } + void restore(const char *&data) { + m_elems.restore(data); + } + void sweep() { + m_elems.sweep(); + } + + protected: + Variant getImpl(int index) const; + + private: + /** + * We have to use pointers so to avoid object copying during resizing. This + * also makes lval() safer. It does require those appendImpl() to be re- + * implemented for this class. + */ + HphpVector m_elems; + + ArrayData *lvalImpl(int index, Variant *&ret, bool copy, int64 prehash); + bool setImpl(int index, CVarRef v, bool copy, ArrayData *&ret); + ArrayData *removeImpl(int index, bool copy); + + template + ArrayData *setImpl(const T &k, CVarRef v, bool copy) { + int index = getIndex(k, true); + ArrayData *ret = NULL; + if (setImpl(index, v, copy, ret)) { + return ret; + } + + /** + * This is the ONLY place that should escalate from VectorVariant to + * MapVariant. We will not make copies of those elements but transfer them + * from vector to map when copy is not needed. + */ + ret = NEW(MapVariant)(this, Variant(k), v, copy); + if (copy) { + ASSERT(getCount() > 1); + } else { + ASSERT(getCount() == 1); + m_elems.clear(); //...because we have transferred all items to the map + } + return ret; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_VECTOR_VARIANT_H__ diff --git a/src/cpp/base/array/zend_array.cpp b/src/cpp/base/array/zend_array.cpp new file mode 100644 index 0000000000000..da2d70ef24191 --- /dev/null +++ b/src/cpp/base/array/zend_array.cpp @@ -0,0 +1,979 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS_CLS(ZendArray, Bucket); +IMPLEMENT_SMART_ALLOCATION(ZendArray, SmartAllocatorImpl::NeedRestoreOnce); +/////////////////////////////////////////////////////////////////////////////// +// static members + +StaticEmptyZendArray StaticEmptyZendArray::s_theEmptyArray; + +/////////////////////////////////////////////////////////////////////////////// +// construction/destruciton + +ZendArray::ZendArray(uint nSize /* = 0 */) : + m_nNumOfElements(0), m_nNextFreeElement(0), + m_pListHead(NULL), m_pListTail(NULL), m_arBuckets(NULL), m_linear(false) { + + if (nSize >= 0x80000000) { + m_nTableSize = 0x80000000; // prevent overflow + } else { + uint i = 3; + while ((1U << i) < nSize) { + i++; + } + m_nTableSize = 1 << i; + } + m_nTableMask = m_nTableSize - 1; + m_arBuckets = (Bucket **)calloc(m_nTableSize, sizeof(Bucket *)); +} + +ZendArray::~ZendArray() { + Bucket *p = m_pListHead; + while (p) { + Bucket *q = p; + p = p->pListNext; + DELETE(Bucket)(q); + } + if (!m_linear && m_arBuckets) { + free(m_arBuckets); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// iterations + +ssize_t ZendArray::iter_begin() const { + Bucket *p = m_pListHead; + return p ? reinterpret_cast(p) : ArrayData::invalid_index; +} + +ssize_t ZendArray::iter_end() const { + Bucket *p = m_pListTail; + return p ? reinterpret_cast(p) : ArrayData::invalid_index; +} + +ssize_t ZendArray::iter_advance(ssize_t prev) const { + if (prev == 0 || prev == ArrayData::invalid_index) { + return ArrayData::invalid_index; + } + Bucket *p = reinterpret_cast(prev); + p = p->pListNext; + return p ? reinterpret_cast(p) : ArrayData::invalid_index; +} + +ssize_t ZendArray::iter_rewind(ssize_t prev) const { + if (prev == 0 || prev == ArrayData::invalid_index) { + return ArrayData::invalid_index; + } + Bucket *p = reinterpret_cast(prev); + p = p->pListLast; + return p ? reinterpret_cast(p) : ArrayData::invalid_index; +} + +Variant ZendArray::getKey(ssize_t pos) const { + ASSERT(pos && pos != ArrayData::invalid_index); + Bucket *p = reinterpret_cast(pos); + if (p->key) { + return p->key; + } + return (int64)p->h; +} + +Variant ZendArray::getValue(ssize_t pos) const { + ASSERT(pos && pos != ArrayData::invalid_index); + Bucket *p = reinterpret_cast(pos); + return p->data; +} + +CVarRef ZendArray::getValueRef(ssize_t pos) const { + ASSERT(pos && pos != ArrayData::invalid_index); + Bucket *p = reinterpret_cast(pos); + return p->data; +} + +bool ZendArray::isVectorData() const { + int64 index = 0; + for (Bucket *p = m_pListHead; p; p = p->pListNext) { + if (p->key || p->h != index++) return false; + } + return true; +} + +Variant ZendArray::reset() { + m_pos = (ssize_t)m_pListHead; + if (m_pListHead) { + return m_pListHead->data; + } + return false; +} + +Variant ZendArray::prev() { + if (m_pos) { + Bucket *p = reinterpret_cast(m_pos); + p = p->pListLast; + m_pos = (ssize_t)p; + if (p) { + return p->data; + } + } + return false; +} + +Variant ZendArray::next() { + if (m_pos) { + Bucket *p = reinterpret_cast(m_pos); + p = p->pListNext; + m_pos = (ssize_t)p; + if (p) { + return p->data; + } + } + return false; +} + +Variant ZendArray::end() { + m_pos = (ssize_t)m_pListTail; + if (m_pListTail) { + return m_pListTail->data; + } + return false; +} + +Variant ZendArray::key() const { + if (m_pos) { + Bucket *p = reinterpret_cast(m_pos); + if (p->key) { + return p->key; + } + return (int64)p->h; + } + return null; +} + +Variant ZendArray::value(ssize_t &pos) const { + if (pos && pos != ArrayData::invalid_index) { + Bucket *p = reinterpret_cast(pos); + return p->data; + } + return false; +} + +Variant ZendArray::current() const { + if (m_pos) { + Bucket *p = reinterpret_cast(m_pos); + return p->data; + } + return false; +} + +Variant ZendArray::each() { + if (m_pos) { + Array ret; + Bucket *p = reinterpret_cast(m_pos); + Variant key = getKey(m_pos); + Variant value = getValue(m_pos); + ret.set(1, value); + ret.set("value", value); + ret.set(0, key); + ret.set("key", key); + m_pos = (ssize_t)p->pListNext; + return ret; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// lookups + +ZendArray::Bucket *ZendArray::find(int64 h) const { + for (Bucket *p = m_arBuckets[h & m_nTableMask]; p; p = p->pNext) { + if (p->key == NULL && p->h == h) { + return p; + } + } + return NULL; +} + +ZendArray::Bucket *ZendArray::find(const char *k, int len, + int64 prehash /* = -1 */, + int64 *h /* = NULL */) const { + if (prehash < 0) { + prehash = hash_string(k, len); + if (h) { + *h = prehash; + } + } + for (Bucket *p = m_arBuckets[prehash & m_nTableMask]; p; p = p->pNext) { + if (p->key && p->h == prehash && p->key->size() == len && + memcmp(p->key->data(), k, len) == 0) { + return p; + } + } + return NULL; +} + +bool ZendArray::exists(int64 k, int64 prehash /* = -1 */) const { + return find(k); +} + +bool ZendArray::exists(litstr k, int64 prehash /* = -1 */) const { + return find(k, strlen(k), prehash); +} + +bool ZendArray::exists(CStrRef k, int64 prehash /* = -1 */) const { + return find(k.data(), k.size(), prehash); +} + +bool ZendArray::exists(CVarRef k, int64 prehash /* = -1 */) const { + if (k.isNumeric()) return find(k.toInt64()); + String key = k.toString(); + return find(key.data(), key.size(), prehash); +} + +bool ZendArray::idxExists(ssize_t idx) const { + return (idx && idx != ArrayData::invalid_index); +} + +Variant ZendArray::get(int64 k, int64 prehash /* = -1 */) const { + Bucket *p = find(k); + if (p) { + return p->data; + } + return null; +} + +Variant ZendArray::get(litstr k, int64 prehash /* = -1 */) const { + Bucket *p = find(k, strlen(k), prehash); + if (p) { + return p->data; + } + return null; +} + +Variant ZendArray::get(CStrRef k, int64 prehash /* = -1 */) const { + Bucket *p = find(k.data(), k.size(), prehash); + if (p) { + return p->data; + } + return null; +} + +Variant ZendArray::get(CVarRef k, int64 prehash /* = -1 */) const { + Bucket *p; + if (k.isNumeric()) { + p = find(k.toInt64()); + } else { + String key = k.toString(); + p = find(key.data(), key.size(), prehash); + } + if (p) { + return p->data; + } + return null; +} + +ssize_t ZendArray::getIndex(int64 k, int64 prehash /* = -1 */) const { + Bucket *p = find(k); + if (p) { + return (ssize_t)p; + } + return ArrayData::invalid_index; +} + +ssize_t ZendArray::getIndex(litstr k, int64 prehash /* = -1 */) const { + Bucket *p = find(k, strlen(k), prehash); + if (p) { + return (ssize_t)p; + } + return ArrayData::invalid_index; +} + +ssize_t ZendArray::getIndex(CStrRef k, int64 prehash /* = -1 */) const { + Bucket *p = find(k.data(), k.size(), prehash); + if (p) { + return (ssize_t)p; + } + return ArrayData::invalid_index; +} + +ssize_t ZendArray::getIndex(CVarRef k, int64 prehash /* = -1 */) const { + Bucket *p; + if (k.isNumeric()) { + p = find(k.toInt64()); + } else { + String key = k.toString(); + p = find(key.data(), key.size(), prehash); + } + if (p) { + return (ssize_t)p; + } + return ArrayData::invalid_index; +} + +/////////////////////////////////////////////////////////////////////////////// +// append/insert/update + +#define CONNECT_TO_BUCKET_DLLIST(element, list_head) \ + (element)->pNext = (list_head); \ + (element)->pLast = NULL; \ + if ((element)->pNext) { \ + (element)->pNext->pLast = (element); \ + } + +#define CONNECT_TO_GLOBAL_DLLIST(element) \ + (element)->pListLast = m_pListTail; \ + m_pListTail = (element); \ + (element)->pListNext = NULL; \ + if ((element)->pListLast != NULL) { \ + (element)->pListLast->pListNext = (element); \ + } \ + if (!m_pListHead) { \ + m_pListHead = (element); \ + } \ + if (m_pos == 0) { \ + m_pos = (ssize_t)(element); \ + } + +#define SET_ARRAY_BUCKET_HEAD(m_arBuckets, nIndex, p) \ +do { \ + if (m_linear) { \ + int nbytes = m_nTableSize * sizeof(Bucket *); \ + Bucket **t = (Bucket **)malloc(nbytes); \ + memcpy(t, m_arBuckets, nbytes); \ + m_arBuckets = t; \ + m_linear = false; \ + } \ + m_arBuckets[nIndex] = (p); \ +} while (0) + +void ZendArray::resize() { + int curSize = m_nTableSize * sizeof(Bucket *); + if (m_linear) { + Bucket **t = (Bucket **)calloc(m_nTableSize << 1, sizeof(Bucket *)); + memcpy(t, m_arBuckets, curSize); + m_arBuckets = t; + m_linear = false; + } else { + m_arBuckets = (Bucket **)realloc(m_arBuckets, curSize << 1); + memset((char*)m_arBuckets + curSize, 0, curSize); + } + m_nTableSize <<= 1; + m_nTableMask = m_nTableSize - 1; + rehash(); +} + +void ZendArray::rehash() { + memset(m_arBuckets, 0, m_nTableSize * sizeof(Bucket *)); + for (Bucket *p = m_pListHead; p; p = p->pListNext) { + uint nIndex = (p->h & m_nTableMask); + CONNECT_TO_BUCKET_DLLIST(p, m_arBuckets[nIndex]); + SET_ARRAY_BUCKET_HEAD(m_arBuckets, nIndex, p); + } +} + +bool ZendArray::update(OpFlag flag, int64 h, CVarRef data, + Variant **pDest /* = NULL */) { + Bucket *p = NULL; + if (flag & HASH_NEXT_INSERT) { + h = m_nNextFreeElement; + } else { + p = find(h); + } + + if (p) { + if (pDest) { + *pDest = &p->data; + } + if (flag & HASH_ADD) { + return false; + } + p->data = data; + if ((long)h >= (long)m_nNextFreeElement) { + m_nNextFreeElement = h + 1; + } + return true; + } + + p = NEW(Bucket)(); + p->h = h; + p->data = data; + if (pDest) { + *pDest = &p->data; + } + + uint nIndex = (h & m_nTableMask); + CONNECT_TO_BUCKET_DLLIST(p, m_arBuckets[nIndex]); + SET_ARRAY_BUCKET_HEAD(m_arBuckets, nIndex, p); + CONNECT_TO_GLOBAL_DLLIST(p); + + if ((long)h >= (long)m_nNextFreeElement) { + m_nNextFreeElement = h + 1; + } + if (++m_nNumOfElements > m_nTableSize) { + resize(); + } + return true; +} + +bool ZendArray::update(OpFlag flag, litstr key, int64 h, CVarRef data, + Variant **pDest /* = NULL */) { + int len = strlen(key); + Bucket *p = find(key, len, h, &h); + if (p) { + if (pDest) { + *pDest = &p->data; + } + if (flag & HASH_ADD) { + return false; + } + p->data = data; + return true; + } + + p = NEW(Bucket)(); + p->key = NEW(StringData)(key, len, AttachLiteral); + p->key->incRefCount(); + p->h = h; + p->data = data; + if (pDest) { + *pDest = &p->data; + } + + uint nIndex = (h & m_nTableMask); + CONNECT_TO_BUCKET_DLLIST(p, m_arBuckets[nIndex]); + SET_ARRAY_BUCKET_HEAD(m_arBuckets, nIndex, p); + CONNECT_TO_GLOBAL_DLLIST(p); + + if (++m_nNumOfElements > m_nTableSize) { + resize(); + } + return true; +} + +bool ZendArray::update(OpFlag flag, StringData *key, int64 h, CVarRef data, + Variant **pDest /* = NULL */) { + Bucket *p = find(key->data(), key->size(), h, &h); + if (p) { + if (pDest) { + *pDest = &p->data; + } + if (flag & HASH_ADD) { + return false; + } + p->data = data; + return true; + } + + p = NEW(Bucket)(); + if (key->isShared()) { + p->key = NEW(StringData)(key->data(), key->size(), CopyString); + } else { + p->key = key; + } + p->key->incRefCount(); + p->h = h; + p->data = data; + if (pDest) { + *pDest = &p->data; + } + + uint nIndex = (h & m_nTableMask); + CONNECT_TO_BUCKET_DLLIST(p, m_arBuckets[nIndex]); + SET_ARRAY_BUCKET_HEAD(m_arBuckets, nIndex, p); + CONNECT_TO_GLOBAL_DLLIST(p); + + if (++m_nNumOfElements > m_nTableSize) { + resize(); + } + return true; +} + +ArrayData *ZendArray::lval(Variant *&ret, bool copy) { + if (copy) { + ZendArray *a = copyImpl(); + ASSERT(a->m_pListTail); + ret = &a->m_pListTail->data; + return a; + } + ASSERT(m_pListTail); + ret = &m_pListTail->data; + return NULL; +} + +ArrayData *ZendArray::lval(int64 k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + if (copy) { + ZendArray *a = copyImpl(); + a->update(HASH_ADD, k, null, &ret); + return a; + } + update(HASH_ADD, k, null, &ret); + return NULL; +} + +ArrayData *ZendArray::lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + return lvalImpl(k.get(), ret, copy, prehash); +} + +ArrayData *ZendArray::lval(litstr k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + return lvalImpl(k, ret, copy, prehash); +} + +ArrayData *ZendArray::lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + if (k.isNumeric()) { + return lval(k.toInt64(), ret, copy, prehash); + } else { + String key = k.toString(); + return lvalImpl(key.get(), ret, copy, prehash); + } +} + +ArrayData *ZendArray::set(int64 k, CVarRef v, bool copy, + int64 prehash /* = -1 */) { + if (copy) { + ZendArray *a = copyImpl(); + a->update(HASH_UPDATE, k, v); + return a; + } + update(HASH_UPDATE, k, v); + return NULL; +} + +ArrayData *ZendArray::set(CStrRef k, CVarRef v, bool copy, + int64 prehash /* = -1 */) { + if (copy) { + ZendArray *a = copyImpl(); + a->update(HASH_UPDATE, k.get(), prehash, v); + return a; + } + update(HASH_UPDATE, k.get(), prehash, v); + return NULL; +} + +ArrayData *ZendArray::set(litstr k, CVarRef v, bool copy, + int64 prehash /* = -1 */) { + if (copy) { + ZendArray *a = copyImpl(); + a->update(HASH_UPDATE, k, prehash, v); + return a; + } + update(HASH_UPDATE, k, prehash, v); + return NULL; +} + +ArrayData *ZendArray::set(CVarRef k, CVarRef v, bool copy, + int64 prehash /* = -1 */) { + if (k.isNumeric()) { + if (copy) { + ZendArray *a = copyImpl(); + a->update(HASH_UPDATE, k.toInt64(), v); + return a; + } + update(HASH_UPDATE, k.toInt64(), v); + return NULL; + } else if (k.is(LiteralString)) { + if (copy) { + ZendArray *a = copyImpl(); + a->update(HASH_UPDATE, k.getLiteralString(), prehash, v); + return a; + } + update(HASH_UPDATE, k.getLiteralString(), prehash, v); + return NULL; + } else { + String sk = k.toString(); + StringData *sd = sk.get(); + if (copy) { + ZendArray *a = copyImpl(); + a->update(HASH_UPDATE, sd, prehash, v); + return a; + } + update(HASH_UPDATE, sd, prehash, v); + return NULL; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// delete + +void ZendArray::erase(Bucket *p) { + if (p) { + uint nIndex = (p->h & m_nTableMask); + if (p->pLast) { + p->pLast->pNext = p->pNext; + } else { + SET_ARRAY_BUCKET_HEAD(m_arBuckets, nIndex, p->pNext); + } + if (p->pNext) { + p->pNext->pLast = p->pLast; + } + if (p->pListLast) { + p->pListLast->pListNext = p->pListNext; + } else { + /* Deleting the head of the list */ + ASSERT(m_pListHead == p); + m_pListHead = p->pListNext; + } + if (p->pListNext) { + p->pListNext->pListLast = p->pListLast; + } else { + ASSERT(m_pListTail == p); + m_pListTail = p->pListLast; + } + if (m_pos == (ssize_t)p) { + m_pos = (ssize_t)p->pListNext; + } + m_nNumOfElements--; + + DELETE(Bucket)(p); + } +} + +ArrayData *ZendArray::remove(int64 k, bool copy, int64 prehash /* = -1 */) { + if (copy) { + ZendArray *a = copyImpl(); + a->erase(a->find(k)); + return a; + } + erase(find(k)); + return NULL; +} + +ArrayData *ZendArray::remove(CStrRef k, bool copy, int64 prehash /* = -1 */) { + if (copy) { + ZendArray *a = copyImpl(); + a->erase(a->find(k.data(), k.size(), prehash)); + return a; + } + erase(find(k.data(), k.size(), -1)); + return NULL; +} + +ArrayData *ZendArray::remove(litstr k, bool copy, int64 prehash /* = -1 */) { + if (copy) { + ZendArray *a = copyImpl(); + a->erase(a->find(k, strlen(k), prehash)); + return a; + } + erase(find(k, strlen(k), -1)); + return NULL; +} + +ArrayData *ZendArray::remove(CVarRef k, bool copy, int64 prehash /* = -1 */) { + if (k.isNumeric()) { + if (copy) { + ZendArray *a = copyImpl(); + a->erase(a->find(k.toInt64())); + return a; + } + erase(find(k.toInt64())); + return NULL; + } else { + String key = k.toString(); + if (copy) { + ZendArray *a = copyImpl(); + a->erase(a->find(key.data(), key.size(), prehash)); + return a; + } + erase(find(key.data(), key.size(), prehash)); + return NULL; + } +} + +ArrayData *ZendArray::copy() const { + return copyImpl(); +} + +ZendArray *ZendArray::copyImpl() const { + ZendArray *target = NEW(ZendArray)(m_nNumOfElements); + for (Bucket *p = m_pListHead; p; p = p->pListNext) { + if (p->data.isReferenced()) { + p->data.setContagious(); + } + if (p->key) { + target->update(HASH_UPDATE, p->key, p->h, p->data); + } else { + target->update(HASH_UPDATE, p->h, p->data); + } + } + target->m_pos = (ssize_t)target->m_pListHead; + return target; +} + +ArrayData *ZendArray::append(CVarRef v, bool copy) { + if (copy) { + ZendArray *a = copyImpl(); + a->update(HASH_NEXT_INSERT, 0, v); + return a; + } + update(HASH_NEXT_INSERT, 0, v); + return NULL; +} + +ArrayData *ZendArray::append(const ArrayData *elems, ArrayOp op, bool copy) { + if (copy) { + ZendArray *a = copyImpl(); + a->append(elems, op, false); + return a; + } + + if (elems->supportValueRef()) { + if (op == Plus) { + for (ArrayIter it(elems); !it.end(); it.next()) { + Variant key = it.first(); + CVarRef value = it.secondRef(); + if (value.isReferenced()) value.setContagious(); + if (key.isNumeric()) { + update(HASH_ADD, key.toInt64(), value); + } else { + String skey = key.toString(); + update(HASH_ADD, skey.get(), -1, value); + } + } + } else { + ASSERT(op == Merge); + for (ArrayIter it(elems); !it.end(); it.next()) { + Variant key = it.first(); + CVarRef value = it.secondRef(); + if (value.isReferenced()) value.setContagious(); + if (key.isNumeric()) { + append(value, false); + } else { + set(key, value, false); + } + } + } + } else { + if (op == Plus) { + for (ArrayIter it(elems); !it.end(); it.next()) { + Variant key = it.first(); + if (key.isNumeric()) { + update(HASH_ADD, key.toInt64(), it.second()); + } else { + String skey = key.toString(); + update(HASH_ADD, skey.get(), -1, it.second()); + } + } + } else { + ASSERT(op == Merge); + for (ArrayIter it(elems); !it.end(); it.next()) { + Variant key = it.first(); + if (key.isNumeric()) { + append(it.second(), false); + } else { + set(key, it.second(), false); + } + } + } + } + return NULL; +} + +ArrayData *ZendArray::pop(Variant &value) { + if (getCount() > 1) { + ZendArray *a = copyImpl(); + a->pop(value); + return a; + } + if (m_pListTail) { + value = m_pListTail->data; + if (!m_pListTail->key && (uint)m_pListTail->h == m_nNextFreeElement - 1) { + m_nNextFreeElement--; + } + erase(m_pListTail); + } else { + value = null; + } + return NULL; +} + +ArrayData *ZendArray::dequeue(Variant &value) { + if (getCount() > 1) { + ZendArray *a = copyImpl(); + a->dequeue(value); + return a; + } + if (m_pListHead) { + value = m_pListHead->data; + erase(m_pListHead); + renumber(); + } else { + value = null; + } + return NULL; +} + +ArrayData *ZendArray::insert(ssize_t pos, CVarRef v, bool copy) { + if (copy) { + ZendArray *a = copyImpl(); + a->insert(pos, v, false); + return a; + } + + Bucket *old_tail = m_pListTail; + update(HASH_NEXT_INSERT, 0, v); + if (m_nNumOfElements == 1) { + return NULL; // only element in array, no need to move it. + } + + // Move the newly inserted element from the tail of the ordering list to + // whatever position was requested. + Bucket *p = reinterpret_cast(pos); + if (p == old_tail) { + return NULL; // already in the proper spot at the list end + } + + if (pos == 0 || pos == ArrayData::invalid_index) { + p = m_pListHead; + } + + Bucket *new_elem = m_pListTail; + + // Remove from end of list + m_pListTail = new_elem->pListLast; + if (m_pListTail) { + m_pListTail->pListNext = NULL; + } + + // Insert before new position (p) + new_elem->pListNext = p; + new_elem->pListLast = p->pListLast; + p->pListLast = new_elem; + if (new_elem->pListLast) { + new_elem->pListLast->pListNext = new_elem; + } else { + // no 'last' means we inserted at the front, so fix that pointer + ASSERT(m_pListHead == p); + m_pListHead = new_elem; + } + + // Rewrite numeric keys to start from 0 and rehash + renumber(); + return NULL; +} + +void ZendArray::renumber() { + unsigned long i = 0; + for (Bucket *p = m_pListHead; p; p = p->pListNext) { + if (p->key == NULL) { + p->h = i++; + } + } + m_nNextFreeElement = i; + rehash(); +} + +void ZendArray::onSetStatic() { + for (Bucket *p = m_pListHead; p; p = p->pListNext) { + if (p->key) { + p->key->setStatic(); + } + p->data.setStatic(); + } +} + +void ZendArray::getFullPos(FullPos &pos) { + pos.primary = m_pos; + if (m_pos) { + Bucket *p = reinterpret_cast(m_pos); + pos.secondary = (ssize_t)p->h; + } +} + +bool ZendArray::setFullPos(const FullPos &pos) { + // Only set if pos hasn't been invalidated. + if (pos.primary) { + for (Bucket *p = m_arBuckets[pos.secondary & m_nTableMask]; p; + p = p->pNext) { + if ((ssize_t)p == pos.primary) m_pos = (ssize_t)p; + } + } + if (!m_pos) return false; + return true; +} + +CVarRef ZendArray::currentRef() { + ASSERT(m_pos); + Bucket *p = reinterpret_cast(m_pos); + return p->data; +} + +CVarRef ZendArray::endRef() { + ASSERT(m_pos); + Bucket *p = reinterpret_cast(m_pListTail); + return p->data; +} + +/////////////////////////////////////////////////////////////////////////////// +// memory allocator methods. + +bool ZendArray::calculate(int &size) { + size += m_nTableSize * sizeof(Bucket *); + return true; +} + +void ZendArray::backup(LinearAllocator &allocator) { + allocator.backup((const char*)m_arBuckets, m_nTableSize * sizeof(Bucket *)); +} + +void ZendArray::restore(const char *&data) { + m_arBuckets = (Bucket**)data; + data += m_nTableSize * sizeof(Bucket *); + m_linear = true; +} + +void ZendArray::sweep() { + if (!m_linear && m_arBuckets) { + free(m_arBuckets); + m_arBuckets = NULL; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// class Bucket + +ZendArray::Bucket::Bucket() : + h(0), key(NULL), pListNext(NULL), pListLast(NULL), pNext(NULL), pLast(NULL) { +} + +ZendArray::Bucket::~Bucket() { + if (key && key->decRefCount() == 0) { + DELETE(StringData)(key); + } +} + +void ZendArray::Bucket::dump() { + printf("ZendArray::Bucket: %llx, %p, %p, %p, %p\n", + h, pListNext, pListLast, pNext, pLast); + if (key) { + key->dump(); + } + data.dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/array/zend_array.h b/src/cpp/base/array/zend_array.h new file mode 100644 index 0000000000000..746c08fd5f5fd --- /dev/null +++ b/src/cpp/base/array/zend_array.h @@ -0,0 +1,190 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_ARRAY_H__ +#define __HPHP_ZEND_ARRAY_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class ZendArray : public ArrayData { +public: + ZendArray(uint nSize = 0); + virtual ~ZendArray(); + + virtual ssize_t size() const { return m_nNumOfElements;} + + virtual Variant getKey(ssize_t pos) const; + virtual Variant getValue(ssize_t pos) const; + virtual CVarRef getValueRef(ssize_t pos) const; + virtual bool isVectorData() const; + virtual bool supportValueRef() const { return true; } + + virtual ssize_t iter_begin() const; + virtual ssize_t iter_end() const; + virtual ssize_t iter_advance(ssize_t prev) const; + virtual ssize_t iter_rewind(ssize_t prev) const; + + virtual Variant reset(); + virtual Variant prev(); + virtual Variant current() const; + virtual Variant next(); + virtual Variant end(); + virtual Variant key() const; + virtual Variant value(ssize_t &pos) const; + virtual Variant each(); + + virtual bool exists(int64 k, int64 prehash = -1) const; + virtual bool exists(litstr k, int64 prehash = -1) const; + virtual bool exists(CStrRef k, int64 prehash = -1) const; + virtual bool exists(CVarRef k, int64 prehash = -1) const; + + virtual bool idxExists(ssize_t idx) const; + + virtual Variant get(int64 k, int64 prehash = -1) const; + virtual Variant get(litstr k, int64 prehash = -1) const; + virtual Variant get(CStrRef k, int64 prehash = -1) const; + virtual Variant get(CVarRef k, int64 prehash = -1) const; + + virtual ssize_t getIndex(int64 k, int64 prehash = -1) const; + virtual ssize_t getIndex(litstr k, int64 prehash = -1) const; + virtual ssize_t getIndex(CStrRef k, int64 prehash = -1) const; + virtual ssize_t getIndex(CVarRef k, int64 prehash = -1) const; + + virtual ArrayData *lval(Variant *&ret, bool copy); + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1); + + virtual ArrayData *set(int64 k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(litstr k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(CStrRef k, CVarRef v, bool copy, int64 prehash = -1); + virtual ArrayData *set(CVarRef k, CVarRef v, bool copy, int64 prehash = -1); + + virtual ArrayData *remove(int64 k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(litstr k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CStrRef k, bool copy, int64 prehash = -1); + virtual ArrayData *remove(CVarRef k, bool copy, int64 prehash = -1); + + virtual ArrayData *copy() const; + virtual ArrayData *append(CVarRef v, bool copy); + virtual ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy); + virtual ArrayData *pop(Variant &value); + virtual ArrayData *dequeue(Variant &value); + virtual ArrayData *insert(ssize_t pos, CVarRef v, bool copy); + virtual void renumber(); + virtual void onSetStatic(); + + virtual void getFullPos(FullPos &pos); + virtual bool setFullPos(const FullPos &pos); + virtual CVarRef currentRef(); + virtual CVarRef endRef(); + + class Bucket { + public: + Bucket(); + ~Bucket(); + + int64 h; + StringData *key; + Variant data; + Bucket *pListNext; + Bucket *pListLast; + Bucket *pNext; + Bucket *pLast; + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION_NOCALLBACKS(Bucket); + void dump(); + }; + +private: + enum OpFlag { + HASH_UPDATE = (1<<0), + HASH_ADD = (1<<1), + HASH_NEXT_INSERT = (1<<2) + }; + + uint m_nTableSize; + uint m_nTableMask; + uint m_nNumOfElements; + ulong m_nNextFreeElement; + Bucket * m_pListHead; + Bucket * m_pListTail; + Bucket **m_arBuckets; + bool m_linear; + + Bucket *find(int64 h) const; + Bucket *find(const char *k, int len, int64 prehash = -1, + int64 *h = NULL) const; + + bool update(OpFlag flag, int64 h, CVarRef data, Variant **pDest = NULL); + bool update(OpFlag flag, litstr key, int64 h, CVarRef data, + Variant **pDest = NULL); + bool update(OpFlag flag, StringData *key, int64 h, CVarRef data, + Variant **pDest = NULL); + + void erase(Bucket *p); + ZendArray *copyImpl() const; + + void resize(); + void rehash(); + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION(ZendArray, SmartAllocatorImpl::NeedRestoreOnce); + bool calculate(int &size); + void backup(LinearAllocator &allocator); + void restore(const char *&data); + void sweep(); + + template + ArrayData *lvalImpl(const T& k, Variant *&ret, bool copy, int64 prehash) { + if (copy) { + ZendArray *a = copyImpl(); + a->update(HASH_ADD, k, prehash, null, &ret); + return a; + } + update(HASH_ADD, k, prehash, null, &ret); + return NULL; + } +}; + +class StaticEmptyZendArray : public ZendArray { +public: + StaticEmptyZendArray() { setStatic();} + + static ZendArray *Get() { return &s_theEmptyArray; } + +private: + static StaticEmptyZendArray s_theEmptyArray; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_ARRAY_H__ diff --git a/src/cpp/base/base_includes.h b/src/cpp/base/base_includes.h new file mode 100644 index 0000000000000..a14c3abf078f9 --- /dev/null +++ b/src/cpp/base/base_includes.h @@ -0,0 +1,30 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_BASE_INCLUDES_H__ +#define __HPHP_BASE_INCLUDES_H__ + +/////////////////////////////////////////////////////////////////////////////// +// headers needed by extensions. + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __HPHP_BASE_INCLUDES_H__ diff --git a/src/cpp/base/builtin_functions.cpp b/src/cpp/base/builtin_functions.cpp new file mode 100644 index 0000000000000..5e48e9730675a --- /dev/null +++ b/src/cpp/base/builtin_functions.cpp @@ -0,0 +1,375 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +struct RuntimeInfo { + std::set invocation_handlers; + hphp_const_char_map renamed_functions; +}; + +static ThreadLocal s_runtime_info; + +hphp_const_char_map &get_renamed_functions() { + return s_runtime_info->renamed_functions; +} + +Variant f_call_user_func_array(CVarRef function, CArrRef params) { + Array param_arr; + if (!params.isNull()) { + if (params->isVectorData()) { + param_arr = params; + } else { + Array escalated = params; + escalated.escalate(); + for (ArrayIter iter(escalated); iter; ++iter) { + param_arr.append(ref(iter.secondRef())); + } + } + } + + if (function.isString()) { + String sfunction = function.toString(); + int c = sfunction.find("::"); + if (c != 0 && c != String::npos && c+2 < sfunction.size()) { + return invoke_static_method(sfunction.substr(0, c).c_str(), + sfunction.substr(c+2).c_str(), param_arr, + false); + } + return invoke(sfunction.c_str(), param_arr, -1, true, false); + } else if (function.is(KindOfArray)) { + Array arr = function.toArray(); + if (!(arr.size() == 2 && arr.exists(0LL) && arr.exists(1LL))) { + throw InvalidArgumentException("function", "not a valid callback array"); + } + Variant classname = arr.rvalAt(0LL); + Variant methodname = arr.rvalAt(1LL); + if (!methodname.isString()) { + throw InvalidArgumentException("function", "methodname not string"); + } + String method = methodname.toString(); + if (classname.is(KindOfObject)) { + int c = method.find("::"); + if (c != 0 && c != String::npos && c+2 < method.size()) { + String cls = method.substr(0, c); + if (cls == "self") { + cls = FrameInjection::getClassName(true); + } else if (cls == "parent") { + cls = FrameInjection::getParentClassName(true); + } + return classname.toObject()->o_invoke_ex + (cls.c_str(), method.substr(c+2).c_str(), param_arr, -1, false); + } + return classname.toObject()->o_invoke + (method.c_str(), param_arr, -1, false); + } else { + if (!classname.isString()) { + throw InvalidArgumentException("function", "classname not string"); + } + String sclass = classname.toString(); + if (sclass == "self") { + sclass = FrameInjection::getClassName(true); + } else if (sclass == "parent") { + sclass = FrameInjection::getParentClassName(true); + } + ObjectData *obj = FrameInjection::getThis(); + if (obj != NULL && instanceOf(Object(obj), sclass.c_str())) { + return obj->o_invoke_ex(sclass.c_str(), method.c_str(), param_arr, -1, + false); + } + return invoke_static_method(sclass.c_str(), method.c_str(), + param_arr, false); + } + } + throw InvalidArgumentException("function", "not string or array"); +} + +Variant invoke_failed(const char *func, CArrRef params, int64 hash, + bool fatal /* = true */) { + std::set &invocation_handlers = + s_runtime_info->invocation_handlers; + for (std::set::iterator it = invocation_handlers.begin(); + it != invocation_handlers.end(); ++it) { + Variant retval; + if ((*it)(retval, func, params, hash)) return retval; + } + if (fatal) { + throw InvalidFunctionCallException(func); + } else { + Logger::Warning("call_user_func to non-existent function %s", func); + return false; + } +} + +Variant o_invoke_failed(const char *cls, const char *meth, + bool fatal /* = true */) { + if (fatal) { + string msg = "Unknown method "; + msg += cls; + msg += "::"; + msg += meth; + throw FatalErrorException(msg.c_str()); + } else { + Logger::Warning("call_user_func to non-existent method %s::%s", + cls, meth); + return false; + } +} + +void throw_bad_type_exception(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + string msg; + Logger::VSNPrintf(msg, fmt, ap); + va_end(ap); + + if (RuntimeOption::ThrowBadTypeExceptions) { + throw InvalidOperandException(msg.c_str()); + } + + Logger::Warning("Invalid operand type was used: %s", msg.c_str()); +} + +void throw_infinite_loop_exception() { + throw FatalErrorException("infinite loop detected"); +} +void throw_infinite_recursion_exception() { + throw FatalErrorException("infinite recursion detected"); +} +void throw_request_timeout_exception() { + if (RuntimeOption::RequestTimeoutSeconds > 0) { + RequestInjectionData &data = *RequestInjection::s_reqInjectionData; + ASSERT(data.timedout); + data.timedout = false; // avoid going through here twice in a row + + // This extra checking is needed, because there may be a race condition + // a TimeoutThread sets flag "true" right after an old request finishes and + // right before a new requets resets "started". In this case, we flag + // "timedout" back to "false". + if (time(0) - data.started >= RuntimeOption::RequestTimeoutSeconds) { + throw FatalErrorException("request has timed-out"); + } + } +} + +void throw_unexpected_argument_type(int argNum, const char *fnName, + const char *expected, CVarRef val) { + const char *otype = NULL; + switch (val.getType()) { + case KindOfNull: otype = "null"; break; + case KindOfBoolean: otype = "bool"; break; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: otype = "int"; break; + case KindOfDouble: otype = "double"; break; + case LiteralString: + case KindOfString: otype = "string"; break; + case KindOfArray: otype = "array"; break; + case KindOfObject: otype = val.getObjectData()->o_getClassName(); break; + default: + ASSERT(false); + } + throw FatalErrorException + ("Argument %d passed to %s must be an instance of %s, %s given", + argNum, fnName, expected, otype); +} + +void register_invocation_handler(InvocationHandler fn) { + std::set &invocation_handlers = + s_runtime_info->invocation_handlers; + invocation_handlers.insert(fn); +} + +Object f_clone(Object obj) { + Object clone = Object(obj->clone()); + clone->t___clone(); + return clone; +} + +String f_serialize(CVarRef value) { + VariableSerializer vs(VariableSerializer::Serialize); + return vs.serialize(value, true); +} + +Variant f_unserialize(CStrRef str) { + if (str.empty()) { + return false; + } + + istringstream in(std::string(str.data(), str.size())); + VariableUnserializer vu(in); + Variant v; + try { + v = vu.unserialize(); + } catch (Exception &e) { + Logger::Verbose("Unable to unserialize: [%s]. [%s] %s.", (const char *)str, + e.getStackTrace().hexEncode().c_str(), + e.getMessage().c_str()); + return false; + } + return v; +} + +String concat3(CStrRef s1, CStrRef s2, CStrRef s3) { + int len1 = s1.size(); + int len2 = s2.size(); + int len3 = s3.size(); + int len = len1 + len2 + len3; + char *buf = (char *)malloc(len + 1); + memcpy(buf, s1.data(), len1); + memcpy(buf + len1, s2.data(), len2); + memcpy(buf + len1 + len2, s3.data(), len3); + buf[len] = 0; + return String(buf, len, AttachString); +} + +String concat4(CStrRef s1, CStrRef s2, CStrRef s3, CStrRef s4) { + int len1 = s1.size(); + int len2 = s2.size(); + int len3 = s3.size(); + int len4 = s4.size(); + int len = len1 + len2 + len3 + len4; + char *buf = (char *)malloc(len + 1); + memcpy(buf, s1.data(), len1); + memcpy(buf + len1, s2.data(), len2); + memcpy(buf + len1 + len2, s3.data(), len3); + memcpy(buf + len1 + len2 + len3, s4.data(), len4); + buf[len] = 0; + return String(buf, len, AttachString); +} + +String concat5(CStrRef s1, CStrRef s2, CStrRef s3, CStrRef s4, CStrRef s5) { + int len1 = s1.size(); + int len2 = s2.size(); + int len3 = s3.size(); + int len4 = s4.size(); + int len5 = s5.size(); + int len = len1 + len2 + len3 + len4 + len5; + char *buf = (char *)malloc(len + 1); + memcpy(buf, s1.data(), len1); + memcpy(buf + len1, s2.data(), len2); + memcpy(buf + len1 + len2, s3.data(), len3); + memcpy(buf + len1 + len2 + len3, s4.data(), len4); + memcpy(buf + len1 + len2 + len3 + len4, s5.data(), len5); + buf[len] = 0; + return String(buf, len, AttachString); +} + +String concat6(CStrRef s1, CStrRef s2, CStrRef s3, CStrRef s4, CStrRef s5, + CStrRef s6) { + int len1 = s1.size(); + int len2 = s2.size(); + int len3 = s3.size(); + int len4 = s4.size(); + int len5 = s5.size(); + int len6 = s6.size(); + int len = len1 + len2 + len3 + len4 + len5 + len6; + char *buf = (char *)malloc(len + 1); + memcpy(buf, s1.data(), len1); + memcpy(buf + len1, s2.data(), len2); + memcpy(buf + len1 + len2, s3.data(), len3); + memcpy(buf + len1 + len2 + len3, s4.data(), len4); + memcpy(buf + len1 + len2 + len3 + len4, s5.data(), len5); + memcpy(buf + len1 + len2 + len3 + len4 + len5, s6.data(), len6); + buf[len] = 0; + return String(buf, len, AttachString); +} + +Variant &concat_assign(ObjectOffset v1, CStrRef s2) { + Variant &v = v1.lval(); + String s1 = v.toString(); + s1 += s2; + v1 = s1; + return v; +} + +bool empty(CVarRef v, const CVarRef offset, int64 prehash /* = -1 */) { + try { + return !toBoolean(v.rvalAt(offset, prehash)); + } catch (UninitializedOffsetException &e) { + // ignore this as "false" return + } + return false; +} + +bool isset(CVarRef v, const CVarRef offset, int64 prehash /* = -1 */) { + if (v.is(KindOfObject)) { + return v.getArrayAccess()->o_invoke("offsetexists", + Array::Create(offset.toKey()), + -1); + } + try { + return isset(v.rvalAt(offset, prehash)); + } catch (UninitializedOffsetException &e) { + // ignore this as "false" return + } + return false; +} + +String get_source_filename(litstr path) { + if (path[0] == '/') return path; + if (RuntimeOption::SourceRoot.empty()) { + return Process::GetCurrentDirectory() + "/" + path; + } + return RuntimeOption::SourceRoot + "/" + path; +} + + +Variant include(CStrRef file, bool once /* = false */, + LVariableTable* variables /* = NULL */, + const char *currentDir /* = NULL */) { + try { + return invoke_file(file, once, variables, currentDir); + } catch (PhpFileDoesNotExistException &e) { + return false; + } +} +Variant require(CStrRef file, bool once /* = false */, + LVariableTable* variables /* = NULL */, + const char *currentDir /* = NULL */) { + try { + return invoke_file(file, once, variables, currentDir); + } catch (PhpFileDoesNotExistException &e) { + String ms = "Required file that does not exist: "; + ms += file; + throw FatalErrorException(ms.data()); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// class Limits + +double Limits::inf_double = numeric_limits::infinity(); +double Limits::nan_double = numeric_limits::quiet_NaN(); + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/builtin_functions.h b/src/cpp/base/builtin_functions.h new file mode 100644 index 0000000000000..1e887d6b46dcf --- /dev/null +++ b/src/cpp/base/builtin_functions.h @@ -0,0 +1,580 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_BUILTIN_FUNCTIONS_H__ +#define __HPHP_BUILTIN_FUNCTIONS_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * This file contains a list of functions that HPHP generates to wrap around + * different expressions to maintain semantics. If we read through all types of + * expressions in lib/expression/expression.h, we can find most of them can be + * directly transformed into C/C++ counterpart without too much syntactical + * changes. The functions in this file happen to be the ones that are somewhat + * special. + * + * Another way to think about this file is that this file has a list of C-style + * functions, and the rest of run-time has object/classes for other tasks, + * although we do have some global functions defined in other files as well, + * when they are closer to the classes/objects in the same files. + */ + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// type conversion functions + +inline bool toBoolean(bool v) { return v;} +inline bool toBoolean(char v) { return v;} +inline bool toBoolean(short v) { return v;} +inline bool toBoolean(int v) { return v;} +inline bool toBoolean(int64 v) { return v;} +inline bool toBoolean(double v) { return v;} +inline bool toBoolean(litstr v) { return v && *v;} +inline bool toBoolean(CStrRef v) { return v.toBoolean();} +inline bool toBoolean(CArrRef v) { return v.toBoolean();} +inline bool toBoolean(CObjRef v) { return v.toBoolean();} +inline bool toBoolean(CVarRef v) { return v.toBoolean();} + +inline bool empty(bool v) { return !toBoolean(v);} +inline bool empty(char v) { return !toBoolean(v);} +inline bool empty(short v) { return !toBoolean(v);} +inline bool empty(int v) { return !toBoolean(v);} +inline bool empty(int64 v) { return !toBoolean(v);} +inline bool empty(double v) { return !toBoolean(v);} +inline bool empty(litstr v) { return !toBoolean(v);} +inline bool empty(CStrRef v) { return !toBoolean(v);} +inline bool empty(CArrRef v) { return !toBoolean(v);} +inline bool empty(CObjRef v) { return !toBoolean(v);} +inline bool empty(CVarRef v) { return !toBoolean(v);} + +bool empty(CVarRef v, const CVarRef offset, int64 prehash = -1); + +inline char toByte(bool v) { return v ? 1 : 0;} +inline char toByte(char v) { return v;} +inline char toByte(short v) { return v;} +inline char toByte(int v) { return v;} +inline char toByte(int64 v) { return v;} +inline char toByte(double v) { return (char)v;} +inline char toByte(litstr v) { return StringData(v).toByte();} +inline char toByte(CStrRef v) { return v.toByte();} +inline char toByte(CArrRef v) { return v.toByte();} +inline char toByte(CObjRef v) { return v.toByte();} +inline char toByte(CVarRef v) { return v.toByte();} + +inline short toInt16(bool v) { return v ? 1 : 0;} +inline short toInt16(char v) { return v;} +inline short toInt16(short v) { return v;} +inline short toInt16(int v) { return v;} +inline short toInt16(int64 v) { return v;} +inline short toInt16(double v) { return (short)v;} +inline short toInt16(litstr v) { return StringData(v).toInt16();} +inline short toInt16(CStrRef v) { return v.toInt16();} +inline short toInt16(CArrRef v) { return v.toInt16();} +inline short toInt16(CObjRef v) { return v.toInt16();} +inline short toInt16(CVarRef v) { return v.toInt16();} + +inline int toInt32(bool v) { return v ? 1 : 0;} +inline int toInt32(char v) { return v;} +inline int toInt32(short v) { return v;} +inline int toInt32(int v) { return v;} +inline int toInt32(int64 v) { return v;} +inline int toInt32(double v) { return (int)v;} +inline int toInt32(litstr v) { return StringData(v).toInt32();} +inline int toInt32(CStrRef v) { return v.toInt32();} +inline int toInt32(CArrRef v) { return v.toInt32();} +inline int toInt32(CObjRef v) { return v.toInt32();} +inline int toInt32(CVarRef v) { return v.toInt32();} + +inline int64 toInt64(bool v) { return v ? 1 : 0;} +inline int64 toInt64(char v) { return v;} +inline int64 toInt64(short v) { return v;} +inline int64 toInt64(int v) { return v;} +inline int64 toInt64(int64 v) { return v;} +inline int64 toInt64(double v) { + return ((v > LONG_MAX) ? (uint64)v : (int64)v); +} +inline int64 toInt64(litstr v) { return StringData(v).toInt64();} +inline int64 toInt64(CStrRef v) { return v.toInt64();} +inline int64 toInt64(CArrRef v) { return v.toInt64();} +inline int64 toInt64(CObjRef v) { return v.toInt64();} +inline int64 toInt64(CVarRef v) { return v.toInt64();} + +inline double toDouble(bool v) { return v ? 1 : 0;} +inline double toDouble(char v) { return v;} +inline double toDouble(short v) { return v;} +inline double toDouble(int v) { return v;} +inline double toDouble(int64 v) { return v;} +inline double toDouble(double v) { return v;} +inline double toDouble(litstr v) { return StringData(v).toDouble();} +inline double toDouble(CStrRef v) { return v.toDouble();} +inline double toDouble(CArrRef v) { return v.toDouble();} +inline double toDouble(CObjRef v) { return v.toDouble();} +inline double toDouble(CVarRef v) { return v.toDouble();} + +inline String toString(bool v) { return v ? "1" : "";} +inline String toString(char v) { return (int64)v;} +inline String toString(short v) { return (int64)v;} +inline String toString(int v) { return (int64)v;} +inline String toString(int64 v) { return v;} +inline String toString(double v) { return v;} +inline String toString(litstr v) { return v;} +inline String toString(CStrRef v) { return v;} +inline String toString(CArrRef v) { return "Array";} +inline String toString(CObjRef v) { return v.toString();} +inline String toString(CVarRef v) { return v.toString();} + +inline Array toArray(bool v) { return Array::Create(v);} +inline Array toArray(char v) { return Array::Create(v);} +inline Array toArray(short v) { return Array::Create(v);} +inline Array toArray(int v) { return Array::Create(v);} +inline Array toArray(int64 v) { return Array::Create(v);} +inline Array toArray(double v) { return Array::Create(v);} +inline Array toArray(litstr v) { return Array::Create(v);} +inline Array toArray(CStrRef v) { return Array::Create(v);} +inline Array toArray(CArrRef v) { return v;} +inline Array toArray(CObjRef v) { return v.toArray();} +inline Array toArray(CVarRef v) { return v.toArray();} + +inline Object toObject(bool v) { return Variant(v).toObject();} +inline Object toObject(char v) { return Variant(v).toObject();} +inline Object toObject(short v) { return Variant(v).toObject();} +inline Object toObject(int v) { return Variant(v).toObject();} +inline Object toObject(int64 v) { return Variant(v).toObject();} +inline Object toObject(double v) { return Variant(v).toObject();} +inline Object toObject(litstr v) { return Variant(v).toObject();} +inline Object toObject(CStrRef v) { return Variant(v).toObject();} +inline Object toObject(CArrRef v) { return v.toObject();} +inline Object toObject(CObjRef v) { return v;} +inline Object toObject(CVarRef v) { return v.toObject();} + +/////////////////////////////////////////////////////////////////////////////// +// operators + +/** + * These functions are rarely performance bottlenecks, so we are not fully + * type-specialized, although we could. + */ + +inline bool logical_xor(bool v1, bool v2) { return (v1 ? 1:0) ^ (v2 ? 1:0);} +inline Variant bitwise_or (CVarRef v1, CVarRef v2) { return v1 | v2;} +inline Variant bitwise_and(CVarRef v1, CVarRef v2) { return v1 & v2;} +inline Variant bitwise_xor(CVarRef v1, CVarRef v2) { return v1 ^ v2;} +inline Numeric multiply(CVarRef v1, CVarRef v2) { return v1 * v2;} +inline Variant plus(CVarRef v1, CVarRef v2) { return v1 + v2;} +inline Numeric minus(CVarRef v1, CVarRef v2) { return v1 - v2;} +inline Numeric divide(CVarRef v1, CVarRef v2) { return v1 / v2; } +inline Numeric modulo(int64 v1, int64 v2) { + if (abs(v2) == 1) { + return 0; + } + if (v2 == 0) { + Logger::Warning("Division by zero"); + return false; + } + return v1 % v2; +} +inline int64 shift_left(int64 v1, int64 v2) { return v1 << v2; } +inline int64 shift_right(int64 v1, int64 v2) { return v1 >> v2; } + +inline bool logical_xor_rev(bool v2, bool v1) +{ return (v1 ? 1:0) ^ (v2 ? 1:0);} +inline Variant bitwise_or_rev(CVarRef v2, CVarRef v1) { return v1 | v2;} +inline Variant bitwise_and_rev(CVarRef v2, CVarRef v1) { return v1 & v2;} +inline Variant bitwise_xor_rev(CVarRef v2, CVarRef v1) { return v1 ^ v2;} +inline Variant multiply_rev(CVarRef v2, CVarRef v1) { return v1 * v2;} +inline Variant plus_rev(CVarRef v2, CVarRef v1) { return v1 + v2;} +inline Numeric minus_rev(CVarRef v2, CVarRef v1) { return v1 - v2;} +inline Numeric divide_rev(CVarRef v2, CVarRef v1) { return v1 / v2; } +inline int64 modulo_rev(int64 v2, int64 v1) { return v1 % v2; } +inline int64 shift_left_rev(int64 v2, int64 v1) { return v1 << v2; } +inline int64 shift_right_rev(int64 v2, int64 v1) { return v1 >> v2; } + +inline Variant bitwise_or_assign_rev(CVarRef v2, Variant& v1) +{ return v1 |= v2;} +inline Variant bitwise_and_assign_rev(CVarRef v2, Variant& v1) +{ return v1 &= v2;} +inline Variant bitwise_xor_assign_rev(CVarRef v2, Variant& v1) +{ return v1 ^= v2;} +inline Variant multiply_assign_rev(CVarRef v2, Variant& v1) +{ return v1 *= v2;} +inline Variant plus_assign_rev(CVarRef v2, Variant& v1) +{ return v1 += v2;} +inline Numeric minus_assign_rev(CVarRef v2, Variant& v1) +{ return v1 -= v2;} +inline Numeric divide_assign_rev(CVarRef v2, Variant& v1) +{ return v1 /= v2; } +inline int64 modulo_assign_rev(int64 v2, Variant& v1) +{ return v1 %= v2; } +inline int64 shift_left_assign_rev(int64 v2, Variant& v1) +{ return v1 <<= v2; } +inline int64 shift_right_assign_rev(int64 v2, Variant& v1) +{ return v1 >>= v2; } + +inline char negate(char v) { return -v; } +inline short negate(short v) { return -v; } +inline int negate(int v) { return -v; } +inline int64 negate(int64 v) { return -v; } +inline double negate(double v) { return -v; } +inline Variant negate(CVarRef v) { return -(Variant)v; } + +inline String concat(CStrRef s1, CStrRef s2) { return s1 + s2;} +inline String concat_rev(CStrRef s2, CStrRef s1) { return s1 + s2;} +inline String &concat_assign(String &s1, litstr s2) { return s1 += s2;} +inline String &concat_assign(String &s1, CStrRef s2) { return s1 += s2;} + +#define MAX_CONCAT_ARGS 6 +String concat3(CStrRef s1, CStrRef s2, CStrRef s3); +String concat4(CStrRef s1, CStrRef s2, CStrRef s3, CStrRef s4); +String concat5(CStrRef s1, CStrRef s2, CStrRef s3, CStrRef s4, CStrRef s5); +String concat6(CStrRef s1, CStrRef s2, CStrRef s3, CStrRef s4, CStrRef s5, + CStrRef s6); + +inline Variant &concat_assign(Variant &v1, litstr s2) { + if (v1.getType() == KindOfString) { + StringData *data = v1.getStringData(); + if (data->getCount() == 1) { + data->append(s2, strlen(s2)); + return v1; + } + } + String s1 = v1.toString(); + s1 += s2; + v1 = s1; + return v1; +} + +inline Variant &concat_assign(Variant &v1, CStrRef s2) { + if (v1.getType() == KindOfString) { + StringData *data = v1.getStringData(); + if (data->getCount() == 1) { + data->append(s2.data(), s2.size()); + return v1; + } + } + String s1 = v1.toString(); + s1 += s2; + v1 = s1; + return v1; +} + +Variant &concat_assign(ObjectOffset v1, CStrRef s2); + +inline String &concat_assign(const StringOffset &s1, litstr s2) { + return concat_assign(s1.lval(), s2); +} + +inline String &concat_assign(const StringOffset &s1, CStrRef s2) { + return concat_assign(s1.lval(), s2); +} + +inline String &concat_assign_rev(litstr s2, String &s1) { + return concat_assign(s1, s2); +} +inline String &concat_assign_rev(CStrRef s2, String &s1) { + return concat_assign(s1, s2); +} +inline Variant &concat_assign_rev(litstr s2, Variant &v1) { + return concat_assign(v1, s2); +} +inline Variant &concat_assign_rev(CStrRef s2, Variant &v1) { + return concat_assign(v1, s2); +} +inline Variant &concat_assign_rev(CStrRef s2, ObjectOffset v1) { + return concat_assign(v1, s2); +} +inline String &concat_assign_rev(litstr s2, const StringOffset &s1) { + return concat_assign(s1, s2); +} +inline String &concat_assign_rev(CStrRef s2, const StringOffset &s) { + return concat_assign(s, s2); +} + +inline bool instanceOf(bool v, const char *s) { return false;} +inline bool instanceOf(char v, const char *s) { return false;} +inline bool instanceOf(short v, const char *s) { return false;} +inline bool instanceOf(int v, const char *s) { return false;} +inline bool instanceOf(int64 v, const char *s) { return false;} +inline bool instanceOf(double v, const char *s) { return false;} +inline bool instanceOf(litstr v, const char *s) { return false;} +inline bool instanceOf(CStrRef v, const char *s) { return false;} +inline bool instanceOf(CArrRef v, const char *s) { return false;} +inline bool instanceOf(CObjRef v, const char *s) { return v.instanceof(s);} +inline bool instanceOf(CVarRef v, const char *s) { + return v.is(KindOfObject) && + toObject(v).instanceof(s); +} +template +bool instanceOf(const T &v, const char *s) { + return v.instanceof(s); +} + +/////////////////////////////////////////////////////////////////////////////// +// output functions + +inline int print(litstr s) { + g_context->out() << s; + return 1; +} +inline int print(CStrRef s) { + g_context->out().write((const char *)s, s.length()); + return 1; +} +inline void echo(litstr s) { + g_context->out() << s; +} +inline void echo(CStrRef s) { + g_context->out().write((const char *)s, s.length()); +} + +inline void silenceInc() { + g_context->silenceInc(); +} +inline Variant silenceDec(Variant v) { + g_context->silenceDec(); + return v; +} + +String get_source_filename(litstr path); + +inline void throw_exception(CObjRef v) { throw v;} + +/////////////////////////////////////////////////////////////////////////////// +// isset/unset + +inline bool isInitialized(CVarRef v) { return v.isInitialized();} + +inline bool isset(CVarRef v) { return !v.isNull();} +bool isset(CVarRef v, const CVarRef offset, int64 prehash = -1); + +inline Variant unset(Variant &v) { v.unset(); return null;} +inline Variant unset(const ObjectOffset &v) { return unset(v.lval());} +inline Variant unset(CVarRef v) { return null;} +inline Variant setNull(Variant &v) { v.setNull(); return null;} + +/////////////////////////////////////////////////////////////////////////////// +// special variable contexts + +/** + * lval() is mainly to make this work, + * + * $arr['a']['b'] = $value; + * + * where $arr['a'] is in an l-value context. Note that lval() cannot replace + * those offset classes, because calling these lval() functions will actually + * insert a null value into an array/object, whereas an offset class can be + * more powerful by not inserting a dummy value beforehand. For example, + * + * isset($arr['a']); // we have to use offset's exists() function + * $obj['a'] = $value; // ArrayAccess's offset is completely customized + * + */ +template +T &lval(T &v) { return v; } +inline Variant &lval(Variant &v) { return v;} +inline Array &lval(Array &v) { return v;} +inline Variant &lval(CVarRef v) { // in case generating lval(1) + throw FatalErrorException("taking reference from an r-value"); +} +inline String &lval(const StringOffset &v) { return v.lval();} +inline Variant &lval(const ObjectOffset &v) { return v.lval();} + +template +Variant &unsetLval(Variant &v, const T &key, int64 prehash = -1) { + if (v.isNull()) { + return v; + } + if (v.is(KindOfArray)) { + if (v.getArrayData()->exists(key, prehash)) { + return v.lvalAt(key, prehash); + } + return Variant::lvalBlackHole(); + } + return Variant::lvalInvalid(); +} + +template +Variant &unsetLval(Array &v, const T &key, int64 prehash = -1) { + if (!v.isNull() && v.exists(key, prehash)) { + return v.lvalAt(key, prehash); + } + return Variant::lvalBlackHole(); +} + +/** + * ref() sets contagious flag, so that next assignment will make both sides + * strongly bind to the same underlying variant data. For example, + * + * a = ref(b); // string binding: now both a and b point to the same data + * a = b; // weak binding: a will copy or copy-on-write + */ +inline CVarRef ref(CVarRef v) { v.setContagious(); return v;} +inline CVarRef ref(const ObjectOffset &v) { return ref(v.lval());} + +/////////////////////////////////////////////////////////////////////////////// +// misc functions + +Variant f_call_user_func_array(CVarRef function, CArrRef params); + +/** + * Fallback when a dynamic function call fails to find a user function + * matching the name. This will attempt to call a system function first, + * and attempt to resolve the function via any registered invocation + * handlers (via register_invocation_handler). If no handlers are able to + * invoke the function, throw an InvalidFunctionCallException. + */ +Variant invoke_failed(const char *func, CArrRef params, int64 hash, + bool fatal = true); + +Variant o_invoke_failed(const char *cls, const char *meth, + bool fatal = true); + +/** + * A function call that has too many arguments will be invoked through this + * wrapper, so to make sure all extra parameters are still evaluated. + */ +template +T invoke_too_many_args(const char *func, int count, T ret) { + Logger::Verbose("Calling %s with %d more arguments", func, count); + return ret; +} + +/** + * Invocation handlers attempt to call the named function with the passed + * parameters. They return true if the function was found and called, or + * false if the function could not be found. They should only throw + * exceptions if the function was found but an error occured during its + * execution. + */ +typedef bool(*InvocationHandler)(Variant& /*retval*/, const char* /*func*/, + CArrRef /*params*/, int64 /*hash*/); + +/** + * Register an invocation hander for use with invoke_system. + */ +void register_invocation_handler(InvocationHandler fn); + +/** + * When fatal coding errors are transformed to this function call. + */ +inline Variant throw_fatal(const char *msg, void *dummy = NULL) { + throw FatalErrorException(msg); +} +inline Variant throw_missing_class(const char *cls) { + throw ClassNotFoundException((std::string("unknown class ") + cls).c_str()); +} + +inline Variant throw_missing_file(const char *cls) { + throw PhpFileDoesNotExistException(cls); +} + +/** + * When fatal coding errors are transformed to this function call. + */ +inline Object throw_fatal_object(const char *msg, void *dummy = NULL) { + throw FatalErrorException(msg); +} + +void throw_unexpected_argument_type(int argNum, const char *fnName, + const char *expected, CVarRef val); + +/** + * Handler for exceptions thrown from object destructors. Implemented in + * program_functions.cpp. + */ +void handle_destructor_exception(); + +/** + * If RuntimeOption::AlwaysThrowBadTypeExceptions is on, we are running in + * a restrictive mode that's not compatible with PHP, and this will throw. + * If RuntimeOption::AlwaysThrowBadTypeExceptions is off, we will log a + * warning and swallow the error. + */ +void throw_bad_type_exception(const char *fmt, ...); + +/** + * Exceptions injected code throws + */ +void throw_infinite_loop_exception(); +void throw_infinite_recursion_exception(); +void throw_request_timeout_exception(); + +/** + * Cloning an object. + */ +Object f_clone(Object obj); + +/** + * Serialize/unserialize a variant into/from a string. We need these two + * functions in cpp/base, as there are functions in cpp/base that depend on + * these two functions. + */ +String f_serialize(CVarRef value); +Variant f_unserialize(CStrRef str); + + +class LVariableTable; +Variant include(CStrRef file, bool once = false, + LVariableTable* variables = NULL, + const char *currentDir = NULL); +Variant require(CStrRef file, bool once = false, + LVariableTable* variables = NULL, + const char *currentDir = NULL); + +/** + * For function interception or stubout support. + */ +hphp_const_char_map &get_renamed_functions(); + +inline void assignCallTemp(Variant& temp, CVarRef val) { + temp.unset(); + temp.clearContagious(); + temp = val; + if (temp.isReferenced()) { + temp.setContagious(); + } +} + +/** + * For wrapping expressions that have no effect, so to make gcc happy. + */ +inline bool id(bool v) { return v; } +inline char id(char v) { return v; } +inline short id(short v) { return v; } +inline int id(int v) { return v; } +inline int64 id(int64 v) { return v; } +inline uint64 id(uint64 v) { return v; } +inline ssize_t id(ssize_t v) { return v; } +inline double id(double v) { return v; } +inline litstr id(litstr v) { return v; } +inline CStrRef id(CStrRef v) { return v; } +inline CArrRef id(CArrRef v) { return v; } +inline CObjRef id(CObjRef v) { return v; } +inline CVarRef id(CVarRef v) { return v; } + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_BUILTIN_FUNCTIONS_H__ diff --git a/src/cpp/base/class_info.cpp b/src/cpp/base/class_info.cpp new file mode 100644 index 0000000000000..73f80634cc3f2 --- /dev/null +++ b/src/cpp/base/class_info.cpp @@ -0,0 +1,533 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// statics + +Mutex ClassInfo::s_mutex; +bool ClassInfo::s_loaded = false; +ClassInfo *ClassInfo::s_systemFuncs = NULL; +ClassInfo *ClassInfo::s_userFuncs = NULL; +ClassInfo::ClassMap ClassInfo::s_classes; +ClassInfo::ClassMap ClassInfo::s_interfaces; +ClassInfoHook *ClassInfo::s_hook = NULL; + +Array ClassInfo::GetSystemFunctions() { + if (!s_loaded) Load(); + + Array ret = Array::Create(); + if (s_systemFuncs) { + const MethodMap &methods = s_systemFuncs->getMethods(); + for (MethodMap::const_iterator iter = methods.begin(); + iter != methods.end(); ++iter) { + ret.append(iter->first); + } + } + return ret; +} + +Array ClassInfo::GetUserFunctions() { + if (!s_loaded) Load(); + + Array ret = Array::Create(); + if (s_userFuncs) { + const MethodMap &methods = s_userFuncs->getMethods(); + for (MethodMap::const_iterator iter = methods.begin(); + iter != methods.end(); ++iter) { + ret.append(iter->first); + } + } + if (s_hook) { + Array dyn = s_hook->getClasses(); + if (!dyn.isNull()) { + ret = ret.merge(dyn); + } + } + return ret; +} + +const ClassInfo::MethodInfo *ClassInfo::FindFunction(const char *name) { + ASSERT(name); + if (!s_loaded) Load(); + + const MethodInfo *ret = s_systemFuncs->getMethodInfo(name); + if (ret == NULL && s_hook) { + ret = s_hook->findFunction(name); + } + if (ret == NULL) { + ret = s_userFuncs->getMethodInfo(name); + } + return ret; +} + +Array ClassInfo::GetClasses() { + if (!s_loaded) Load(); + + Array ret; + for (ClassMap::const_iterator iter = s_classes.begin(); + iter != s_classes.end(); ++iter) { + ret.append(iter->first); + } + if (s_hook) { + Array dyn = s_hook->getClasses(); + if (!dyn.isNull()) { + ret = ret.merge(dyn); + } + } + return ret; +} + +bool ClassInfo::HasClass(const char *name) { + ASSERT(name); + if (!s_loaded) Load(); + + if (s_hook && s_hook->findClass(name)) return true; + + return s_classes.find(name) != s_classes.end(); +} + +const ClassInfo *ClassInfo::FindClass(const char *name) { + ASSERT(name); + if (!s_loaded) Load(); + + if (s_hook) { + const ClassInfo *cl = s_hook->findClass(name); + if (cl) return cl; + } + ClassMap::const_iterator iter = s_classes.find(name); + if (iter != s_classes.end()) { + return iter->second; + } + return NULL; +} + +Array ClassInfo::GetInterfaces() { + if (!s_loaded) Load(); + + Array ret; + for (ClassMap::const_iterator iter = s_interfaces.begin(); + iter != s_interfaces.end(); ++iter) { + ret.append(iter->first); + } + if (s_hook) { + Array dyn = s_hook->getInterfaces(); + if (!dyn.isNull()) { + ret = ret.merge(dyn); + } + } + return ret; +} + +bool ClassInfo::HasInterface(const char *name) { + ASSERT(name); + if (!s_loaded) Load(); + + if (s_hook && s_hook->findInterface(name)) return true; + return s_interfaces.find(name) != s_interfaces.end(); +} + +const ClassInfo *ClassInfo::FindInterface(const char *name) { + ASSERT(name); + if (!s_loaded) Load(); + + if (s_hook) { + const ClassInfo *iface = s_hook->findInterface(name); + if (iface) return iface; + } + ClassMap::const_iterator iter = s_interfaces.find(name); + if (iter != s_interfaces.end()) { + return iter->second; + } + return NULL; +} + +const ClassInfo::ConstantInfo *ClassInfo::FindConstant(const char *name) { + ASSERT(name); + if (!s_loaded) Load(); + const ConstantInfo *info; + info = s_systemFuncs->getConstantInfo(name); + if (info) return info; + if (s_hook) { + info = s_hook->findConstant(name); + if (info) return info; + } + info = s_userFuncs->getConstantInfo(name); + return info; +} + +Array ClassInfo::GetConstants() { + if (!s_loaded) Load(); + Array res; + Array dyn; + { + const ConstantMap &scm = s_systemFuncs->getConstants(); + for (ConstantMap::const_iterator it = scm.begin(); it != scm.end(); ++it) { + res.set(it->first, it->second->value); + } + } + { + const ConstantMap &ucm = s_userFuncs->getConstants(); + for (ConstantMap::const_iterator it = ucm.begin(); it != ucm.end(); ++it) { + res.set(it->first, it->second->value); + } + } + if (s_hook) { + dyn = s_hook->getConstants(); + if (!dyn.isNull()) { + res.merge(dyn); + } + } + dyn = get_globals()->getDynamicConstants(); + if (!dyn.isNull()) { + res.merge(dyn); + } + return res; +} + +void ClassInfo::GetClassMethods(MethodVec &ret, const char *classname, + int type /* = 0 */) { + if (classname && *classname) { + const ClassInfo *classInfo = NULL; + switch (type) { + case 0: + classInfo = FindClass(classname); + if (classInfo == NULL) { + classInfo = FindInterface(classname); + type = 2; + } + break; + case 1: + classInfo = FindClass(classname); + break; + case 2: + classInfo = FindInterface(classname); + break; + default: + ASSERT(false); + } + + if (classInfo) { + const ClassInfo::MethodVec &methods = classInfo->getMethodsVec(); + ret.insert(ret.end(), methods.begin(), methods.end()); + + if (type != 2) { + const char *parentClass = classInfo->getParentClass(); + if (parentClass && *parentClass) { + GetClassMethods(ret, parentClass, 1); + } + } + + const ClassInfo::InterfaceVec &interfaces = + classInfo->getInterfacesVec(); + for (unsigned int i = 0; i < interfaces.size(); i++) { + GetClassMethods(ret, interfaces[i], 2); + } + } + } +} + +void ClassInfo::GetClassProperties(PropertyMap &props, const char *classname) { + if (classname && *classname) { + const ClassInfo *classInfo = FindClass(classname); + if (classInfo) { + classInfo->getAllProperties(props); + } + } +} + +void ClassInfo::GetClassProperties(PropertyVec &props, const char *classname) { + if (classname && *classname) { + const ClassInfo *classInfo = FindClass(classname); + if (classInfo) { + classInfo->getAllProperties(props); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// ClassInfo + +bool ClassInfo::derivesFrom(const char *name, bool considerInterface) const { + ASSERT(name); + return derivesFromImpl(name, considerInterface); +} + +bool ClassInfo::derivesFromImpl(const char *name, bool considerInterface) const { + if (strcasecmp(name, getParentClass()) == 0) { + return true; + } + + // We don't support redeclared parents anyway. + const ClassInfo *parent = FindClass(getParentClass()); + if (parent && parent->derivesFromImpl(name, considerInterface)) { + return true; + } + + if (considerInterface) { + const InterfaceMap &interfaces = getInterfaces(); + for (InterfaceMap::const_iterator iter = interfaces.begin(); + iter != interfaces.end(); ++iter) { + if (strcasecmp(name, *iter) == 0) { + return true; + } + const ClassInfo *parent = FindInterface(*iter); + if (parent && parent->derivesFromImpl(name, considerInterface)) { + return true; + } + } + } + return false; +} + +ClassInfo::MethodInfo *ClassInfo::getMethodInfo(const char *name) const { + ASSERT(name); + + const MethodMap &methods = getMethods(); + MethodMap::const_iterator iter = methods.find(name); + if (iter != methods.end()) { + return iter->second; + } + return NULL; +} + +bool ClassInfo::hasMethod(const char *name) const { + ASSERT(name); + + const MethodMap &methods = getMethods(); + MethodMap::const_iterator it = methods.find(name); + if (it != methods.end()) { + MethodInfo *m = it->second; + if (m->invokeFn) { + return *(m->invokeFn) != m->invokeFailedFn; + } + return true; + } + const ClassInfo *parent = FindClass(getParentClass()); + return parent && parent->hasMethod(name); +} + +void ClassInfo::getAllProperties(PropertyMap &props) const { + const PropertyMap &properties = getProperties(); + props.insert(properties.begin(), properties.end()); + + const char *parentClass = getParentClass(); + if (parentClass && *parentClass) { + GetClassProperties(props, parentClass); + } +} + +void ClassInfo::getAllProperties(PropertyVec &props) const { + const PropertyVec &properties = getPropertiesVec(); + props.insert(props.end(), properties.begin(), properties.end()); + + const char *parentClass = getParentClass(); + if (parentClass && *parentClass) { + GetClassProperties(props, parentClass); + } +} + +ClassInfo::PropertyInfo *ClassInfo::getPropertyInfo(const char *name) const { + ASSERT(name); + const PropertyMap &properties = getProperties(); + PropertyMap::const_iterator iter = properties.find(name); + if (iter != properties.end()) { + return iter->second; + } + return NULL; +} + +bool ClassInfo::hasProperty(const char *name) const { + ASSERT(name); + const PropertyMap &properties = getProperties(); + return properties.find(name) != properties.end(); +} + +ClassInfo::ConstantInfo *ClassInfo::getConstantInfo(const char *name) const { + ASSERT(name); + const ConstantMap &constants = getConstants(); + ConstantMap::const_iterator iter = constants.find(name); + if (iter != constants.end()) { + return iter->second; + } + return NULL; +} + +bool ClassInfo::hasConstant(const char *name) const { + ASSERT(name); + const ConstantMap &constants = getConstants(); + return constants.find(name) != constants.end(); +} + +/////////////////////////////////////////////////////////////////////////////// +// load functions + +ClassInfoUnique::ClassInfoUnique(const char **&p) { + m_attribute = (Attribute)(int64)(*p++); + m_name = *p++; + m_parent = *p++; + + while (*p) { + const char *name = *p++; + ASSERT(m_interfaces.find(name) == m_interfaces.end()); + m_interfaces.insert(name); + m_interfacesVec.push_back(name); + } + p++; + + while (*p) { + MethodInfo *method = new MethodInfo(); + method->attribute = (Attribute)(int64)(*p++); + method->name = *p++; + method->invokeFn = (Variant (**)(const Array& params))*p++; + method->invokeFailedFn = (Variant (*)(const Array& params))*p++; + + while (*p) { + ParameterInfo *parameter = new ParameterInfo(); + parameter->attribute = (Attribute)(int64)(*p++); + parameter->name = *p++; + parameter->type = *p++; + ASSERT(Util::toLower(parameter->type) == parameter->type); + parameter->value = *p++; + + method->parameters.push_back(parameter); + } + p++; + + while (*p) { + ConstantInfo *staticVariable = new ConstantInfo(); + staticVariable->name = *p++; + staticVariable->valueLen = (int64)(*p++); + staticVariable->valueText = *p++; + istringstream in(std::string(staticVariable->valueText, + staticVariable->valueLen)); + VariableUnserializer vu(in); + try { + staticVariable->value = vu.unserialize(); + } catch (Exception &e) { + ASSERT(false); + } + method->staticVariables.push_back(staticVariable); + } + p++; + + ASSERT(m_methods.find(method->name) == m_methods.end()); + m_methods[method->name] = method; + m_methodsVec.push_back(method); + } + p++; + + while (*p) { + PropertyInfo *property = new PropertyInfo(); + property->attribute = (Attribute)(int64)(*p++); + property->name = *p++; + property->owner = this; + ASSERT(m_properties.find(property->name) == m_properties.end()); + m_properties[property->name] = property; + m_propertiesVec.push_back(property); + } + p++; + + while (*p) { + ConstantInfo *constant = new ConstantInfo(); + constant->name = *p++; + constant->valueLen = (int64)(*p++); + constant->valueText = *p++; + + if (constant->valueText) { + istringstream in(std::string(constant->valueText, constant->valueLen)); + VariableUnserializer vu(in); + try { + constant->value = vu.unserialize(); + } catch (Exception &e) { + ASSERT(false); + } + } + + ASSERT(m_constants.find(constant->name) == m_constants.end()); + m_constants[constant->name] = constant; + } + p++; +} + +ClassInfoRedeclared::ClassInfoRedeclared(const char **&p) { + m_attribute = (Attribute)(int64)(*p++); + m_name = *p++; + m_redeclaredIdGetter = (int (*)())*p++; + while (*p) { + ClassInfo *cls = new ClassInfoUnique(p); + m_redeclaredClasses.push_back(cls); + } + p++; +} + +void ClassInfo::Load() { + Lock lock(s_mutex); + if (s_loaded) return; + + const char **p = g_class_map; + while (*p) { + Attribute attribute = (Attribute)(int64)*p; + ClassInfo *info = (attribute & IsRedeclared) ? + static_cast(new ClassInfoRedeclared(p)) : + static_cast(new ClassInfoUnique(p)); + + if (info->m_name == NULL) { + if (attribute & IsSystem) { + ASSERT(s_systemFuncs == NULL); + s_systemFuncs = info; + } else { + ASSERT(s_userFuncs == NULL); + s_userFuncs = info; + } + } else if (attribute & IsInterface) { + ASSERT(s_classes.find(info->m_name) == s_classes.end()); + ASSERT(s_interfaces.find(info->m_name) == s_interfaces.end()); + s_interfaces[info->m_name] = info; + } else { + ASSERT(s_classes.find(info->m_name) == s_classes.end()); + ASSERT(s_interfaces.find(info->m_name) == s_interfaces.end()); + s_classes[info->m_name] = info; + } + } + + ASSERT(s_systemFuncs); + ASSERT(s_userFuncs); + s_loaded = true; +} + +ClassInfo::MethodInfo::~MethodInfo() { + for (vector::iterator it = parameters.begin(); + it != parameters.end(); ++it) { + delete *it; + } + for (vector::iterator it = staticVariables.begin(); + it != staticVariables.end(); ++it) { + delete *it; + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/class_info.h b/src/cpp/base/class_info.h new file mode 100644 index 0000000000000..e9bfed9743e4f --- /dev/null +++ b/src/cpp/base/class_info.h @@ -0,0 +1,333 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_CLASS_INFO_H__ +#define __HPHP_CLASS_INFO_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class ClassInfoHook; + +/** + * Though called "ClassInfo", we consider global scope as a virtual "class". + * Therefore, this is the place we store meta information of both global + * functions and class methods and properties. + */ +class ClassInfo { +public: + enum Attribute { // class property function method parameter + IsSystem = (1 << 0), // x x + IsRedeclared = (1 << 1), // x x + IsVolatile = (1 << 2), // x x + + IsInterface = (1 << 3), // x + IsAbstract = (1 << 4), // x x + IsFinal = (1 << 5), // x x + + IsPublic = (1 << 6), // x x + IsProtected = (1 << 7), // x x + IsPrivate = (1 << 8), // x x + IsStatic = (1 << 9), // x x + IsInherited = (1 << 10), // x + + IsReference = (1 << 11), // x x x + IsOptional = (1 << 12), // x + + IsNothing = (1 << 13) // need a non-zero number for const char * maps + }; + + struct ConstantInfo { + const char *name; + unsigned int valueLen; + const char *valueText; + Variant value; + }; + + struct ParameterInfo { + Attribute attribute; + const char *name; + const char *type; // hinted type + const char *value; // serialized default value + }; + + class MethodInfo { + public: + MethodInfo() : name(NULL), docComment(NULL) {} + ~MethodInfo(); + Attribute attribute; + const char *name; + Variant (**invokeFn)(const Array& params); + Variant (*invokeFailedFn)(const Array& params); + + std::vector parameters; + std::vector staticVariables; + + const char *docComment; + }; + + class PropertyInfo { + public: + PropertyInfo() : name(NULL), docComment(NULL) {} + Attribute attribute; + const char *name; + const char *docComment; + const ClassInfo *owner; + }; + + typedef hphp_const_char_imap ClassMap; + typedef hphp_const_char_iset InterfaceMap; + typedef std::vector InterfaceVec; + typedef hphp_const_char_imap MethodMap; + typedef std::vector MethodVec; + typedef hphp_const_char_map PropertyMap; + typedef std::vector PropertyVec; + typedef hphp_const_char_map ConstantMap; + +public: + /** + * Load everything. + */ + static void Load(); + + /** + * Return a list of PHP library functions. + */ + static Array GetSystemFunctions(); + + /** + * Return a list of user defined functions. + */ + static Array GetUserFunctions(); + + /** + * Locate one function. + */ + static const MethodInfo *FindFunction(const char *name); + + /** + * Return a list of declared classes. + */ + static Array GetClasses(); + + /** + * Whether a class exists, without considering interfaces. + */ + static bool HasClass(const char *name); + + /** + * Locate one class. + */ + static const ClassInfo *FindClass(const char *name); + + /** + * Return a list of declared interfaces. + */ + static Array GetInterfaces(); + + /** + * Whether an interface exists. + */ + static bool HasInterface(const char *name); + + /** + * Locate one interface. + */ + static const ClassInfo *FindInterface(const char *name); + + /** + * Locate one constant (excluding dynamic and redeclared constants) + */ + static const ConstantInfo *FindConstant(const char *name); + + /** + * Get all statically known constants + */ + static Array GetConstants(); + + /** + * Return all methods a class has, including the ones on base classes and + * interfaces. + * type: 0: unknown; 1: class; 2: interface + */ + static void GetClassMethods(MethodVec &ret, const char *classname, + int type = 0); + + /** + * Return all properties a class has, including the ones on base classes and + * the ones that were implicitly defined. + */ + static void GetClassProperties(PropertyMap &props, const char *classname); + static void GetClassProperties(PropertyVec &props, const char *classname); + + static void SetHook(ClassInfoHook *hook) { s_hook = hook; } + +public: + ClassInfo() : m_docComment(NULL) {} + virtual ~ClassInfo() {} + + Attribute getAttribute() const { return m_attribute;} + virtual const char *getName() const { return m_name;} + const char *getDocComment() const { return m_docComment; } + + /** + * Parents of this class. + */ + virtual const char *getParentClass() const = 0; + virtual const InterfaceMap &getInterfaces() const = 0; + virtual const InterfaceVec &getInterfacesVec() const = 0; + bool derivesFrom(const char *name, bool considerInterface) const; + + /** + * Method functions. + */ + virtual const MethodMap &getMethods() const = 0; // non-recursively + virtual const MethodVec &getMethodsVec() const = 0; // non-recursively + MethodInfo *getMethodInfo(const char *name) const; + bool hasMethod(const char *name) const; + + /** + * Property functions. + */ + virtual const PropertyMap &getProperties() const = 0; // non-recursively + virtual const PropertyVec &getPropertiesVec() const = 0; // non-recursively + void getAllProperties(PropertyMap &props) const; // recursively + void getAllProperties(PropertyVec &props) const; // recursively + PropertyInfo *getPropertyInfo(const char *name) const; + bool hasProperty(const char *name) const; + + /** + * Constant functions. + */ + virtual const ConstantMap &getConstants() const = 0; + ConstantInfo *getConstantInfo(const char *name) const; + bool hasConstant(const char *name) const; + +protected: + static Mutex s_mutex; + static bool s_loaded; // whether class map is loaded + static ClassInfo *s_systemFuncs; // all system functions + static ClassInfo *s_userFuncs; // all user functions + static ClassMap s_classes; // all classes + static ClassMap s_interfaces; // all interfaces + + static ClassInfoHook *s_hook; + + Attribute m_attribute; + const char *m_name; + const char *m_docComment; + + // name is already lowered + bool derivesFromImpl(const char *name, bool considerInterface) const; +}; + +/** + * Stores info about a class that appears once in the codebase. + */ +class ClassInfoUnique : public ClassInfo { +public: + + /** + * Read one class's information from specified map pointer and move it. + */ + ClassInfoUnique(const char **&p); + + // implementing ClassInfo + const char *getParentClass() const { return m_parent;} + const InterfaceMap &getInterfaces() const { return m_interfaces;} + const InterfaceVec &getInterfacesVec() const { return m_interfacesVec;} + const MethodMap &getMethods() const { return m_methods;} + const MethodVec &getMethodsVec() const { return m_methodsVec;} + const PropertyMap &getProperties() const { return m_properties;} + const PropertyVec &getPropertiesVec() const { return m_propertiesVec;} + const ConstantMap &getConstants() const { return m_constants;} + +private: + const char * m_parent; // parent class name + InterfaceMap m_interfaces; // all interfaces + InterfaceVec m_interfacesVec; // all interfaces + MethodMap m_methods; // all methods + MethodVec m_methodsVec; // in source order + PropertyMap m_properties; // all properties + PropertyVec m_propertiesVec; // in source order + ConstantMap m_constants; // all constants +}; + +/** + * Stores info about a class that is redeclared. + */ +class ClassInfoRedeclared : public ClassInfo { +public: + /** + * Read one class's information from specified map pointer and move it. + */ + ClassInfoRedeclared(const char **&p); + + // implementing ClassInfo + const char *getName() const { return current()->getName();} + const char *getParentClass() const { return current()->getParentClass();} + const InterfaceMap &getInterfaces() const { + return current()->getInterfaces(); + } + const InterfaceVec &getInterfacesVec() const { + return current()->getInterfacesVec(); + } + const MethodMap &getMethods() const { return current()->getMethods();} + const MethodVec &getMethodsVec() const { return current()->getMethodsVec();} + const PropertyMap &getProperties() const { + return current()->getProperties(); + } + const PropertyVec &getPropertiesVec() const { + return current()->getPropertiesVec(); + } + const ConstantMap &getConstants() const { return current()->getConstants();} + +private: + std::vector m_redeclaredClasses; + int (*m_redeclaredIdGetter)(); + + ClassInfo* current() const { + return m_redeclaredClasses[m_redeclaredIdGetter()]; + } +}; + +/** + * Interface for a hook into class info for eval. This way I can avoid + * a dependency on eval. + */ +class ClassInfoHook { +public: + virtual ~ClassInfoHook() {}; + virtual Array getUserFunctions() const = 0; + virtual Array getClasses() const = 0; + virtual Array getInterfaces() const = 0; + virtual Array getConstants() const = 0; + virtual const ClassInfo::MethodInfo *findFunction(const char *name) const = 0; + virtual const ClassInfo *findClass(const char *name) const = 0; + virtual const ClassInfo *findInterface(const char *name) const = 0; + virtual const ClassInfo::ConstantInfo *findConstant(const char *name) + const = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_CLASS_INFO_H__ diff --git a/src/cpp/base/class_statics.cpp b/src/cpp/base/class_statics.cpp new file mode 100644 index 0000000000000..c5aab3dee7c4d --- /dev/null +++ b/src/cpp/base/class_statics.cpp @@ -0,0 +1,80 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION(ClassStatics); +/////////////////////////////////////////////////////////////////////////////// + +ClassStatics::ClassStatics(int redecId) : m_redecId(redecId) { + m_msg = "unknown class"; +} + +ClassStatics::ClassStatics(const std::string& name) : m_redecId(-1) { + m_msg = "unknown class "; + m_msg += name.c_str(); +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant ClassStatics::os_get(const char *s, int64 hash /* = -1 */) { + throw FatalErrorException(m_msg); +} + +Variant &ClassStatics::os_lval(const char *s, int64 hash /* = -1 */) { + throw FatalErrorException(m_msg); +} + +Variant ClassStatics::os_invoke(const char *c, const char *s, + CArrRef params, int64 hash /* = -1 */, + bool fatal /* = true */) { + if (fatal) { + throw FatalErrorException(m_msg); + } else { + Logger::Warning("call_user_func to non-existent method %s::%s", + c, s); + return false; + } +} + +Object ClassStatics::create(CArrRef params, bool init /* = true */, + ObjectData* root /* = NULL */) { + throw FatalErrorException(m_msg); +} + +Variant ClassStatics::os_constant(const char *s) { + throw FatalErrorException(m_msg); +} + +Variant ClassStatics::os_invoke_from_eval +(const char *c, const char *s, Eval::VariableEnvironment &env, + const Eval::FunctionCallExpression *call, int64 hash, + bool fatal /* = true */) { + if (fatal) { + throw FatalErrorException(m_msg); + } else { + Logger::Warning("call_user_func to non-existent method %s::%s", + c, s); + return false; + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/class_statics.h b/src/cpp/base/class_statics.h new file mode 100644 index 0000000000000..8ae0b43d0d513 --- /dev/null +++ b/src/cpp/base/class_statics.h @@ -0,0 +1,68 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_CLASS_STATICS_H__ +#define __HPHP_CLASS_STATICS_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +namespace Eval { +class FunctionCallExpression; +class VariableEnvironment; +} + +class ClassStatics : public Countable { +public: + ClassStatics(int redecId); + ClassStatics(const std::string& name); + virtual ~ClassStatics() {} + + int getRedeclaringId() const { + return m_redecId; + } + + virtual Variant os_get(const char *s, int64 hash = -1); + virtual Variant &os_lval(const char *s, int64 hash = -1); + virtual Variant os_invoke(const char *c, const char *s, + CArrRef params, int64 hash = -1, bool fatal = true); + virtual Object create(CArrRef params, bool init = true, + ObjectData* root = NULL); + virtual Variant os_constant(const char *s); + virtual Variant os_invoke_from_eval(const char *c, const char *s, + Eval::VariableEnvironment &env, + const Eval::FunctionCallExpression *call, + int64 hash = -1, + bool fatal = true); + + DECLARE_OBJECT_ALLOCATION(ClassStatics); + void destruct() {} // artifact when not deriving from ObjectData + +private: + String m_msg; + int m_redecId; +}; + +typedef SmartPtr ClassStaticsPtr; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_CLASS_STATICS_H__ diff --git a/src/cpp/base/comparisons.cpp b/src/cpp/base/comparisons.cpp new file mode 100644 index 0000000000000..6f0b3e6ebf7ee --- /dev/null +++ b/src/cpp/base/comparisons.cpp @@ -0,0 +1,112 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool not_more(CVarRef v1, CVarRef v2) { + if (v1.is(KindOfArray) && v2.is(KindOfArray)) { + return !v1.toArray().more(v2.toArray(), false); + } + return !more(v1, v2); +} + +bool not_less(CVarRef v1, CVarRef v2) { + if (v1.is(KindOfArray) && v2.is(KindOfArray)) { + return !v1.toArray().less(v2.toArray(), true); + } + return !less(v1, v2); +} + +bool equal(char v1, CStrRef v2) { + return equal((int64)v1, v2); +} + +bool equal(short v1, CStrRef v2) { + return equal((int64)v1, v2); +} + +bool equal(int v1, CStrRef v2) { + return equal((int64)v1, v2); +} + +bool equal(int64 v1, CStrRef v2) { + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(v2.data(), v2.size(), &lval, &dval, 1); + if (ret == KindOfInt64) { + return v1 == lval; + } else if (ret == KindOfDouble) { + return (double)v1 == dval; + } else { + return v1 == 0; + } +} + +bool less(char v1, CStrRef v2) { + return less((int64)v1, v2); +} + +bool less(short v1, CStrRef v2) { + return less((int64)v1, v2); +} + +bool less(int v1, CStrRef v2) { + return less((int64)v1, v2); +} + +bool less(int64 v1, CStrRef v2) { + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(v2.data(), v2.size(), &lval, &dval, 1); + if (ret == KindOfInt64) { + return v1 < lval; + } else if (ret == KindOfDouble) { + return (double)v1 < dval; + } else { + return v1 < 0; + } +} + +bool more(char v1, CStrRef v2) { + return more((int64)v1, v2); +} + +bool more(short v1, CStrRef v2) { + return more((int64)v1, v2); +} + +bool more(int v1, CStrRef v2) { + return more((int64)v1, v2); +} + +bool more(int64 v1, CStrRef v2) { + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(v2.data(), v2.size(), &lval, &dval, 1); + if (ret == KindOfInt64) { + return v1 > lval; + } else if (ret == KindOfDouble) { + return (double)v1 > dval; + } else { + return v1 > 0; + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/comparisons.h b/src/cpp/base/comparisons.h new file mode 100644 index 0000000000000..b0b786f03523d --- /dev/null +++ b/src/cpp/base/comparisons.h @@ -0,0 +1,616 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_COMPARISONS_H__ +#define __HPHP_COMPARISONS_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// Variant + +inline bool same(CVarRef v1, bool v2) { return v1.same(v2);} +inline bool same(CVarRef v1, char v2) { return v1.same(v2);} +inline bool same(CVarRef v1, short v2) { return v1.same(v2);} +inline bool same(CVarRef v1, int v2) { return v1.same(v2);} +inline bool same(CVarRef v1, int64 v2) { return v1.same(v2);} +inline bool same(CVarRef v1, double v2) { return v1.same(v2);} +inline bool same(CVarRef v1, CStrRef v2) { return v1.same(v2);} +inline bool same(CVarRef v1, litstr v2) { return v1.same(v2);} +inline bool same(CVarRef v1, CArrRef v2) { return v1.same(v2);} +inline bool same(CVarRef v1, CObjRef v2) { return v1.same(v2);} +inline bool same(CVarRef v1, CVarRef v2) { return v1.same(v2);} + +inline bool same_rev(CVarRef v2, CVarRef v1) { return v1.same(v2);} + +inline bool equal(CVarRef v1, bool v2) { return v1.equal(v2);} +inline bool equal(CVarRef v1, char v2) { return v1.equal(v2);} +inline bool equal(CVarRef v1, short v2) { return v1.equal(v2);} +inline bool equal(CVarRef v1, int v2) { return v1.equal(v2);} +inline bool equal(CVarRef v1, int64 v2) { return v1.equal(v2);} +inline bool equal(CVarRef v1, double v2) { return v1.equal(v2);} +inline bool equal(CVarRef v1, CStrRef v2) { return v1.equal(v2);} +inline bool equal(CVarRef v1, litstr v2) { return v1.equal(v2);} +inline bool equal(CVarRef v1, CArrRef v2) { return v1.equal(v2);} +inline bool equal(CVarRef v1, CObjRef v2) { return v1.equal(v2);} +inline bool equal(CVarRef v1, CVarRef v2) { return v1.equal(v2);} + +inline bool equal_rev(CVarRef v2, CVarRef v1) { return v1.equal(v2);} + +inline bool less(CVarRef v1, bool v2) { return v1.less(v2);} +inline bool less(CVarRef v1, char v2) { return v1.less(v2);} +inline bool less(CVarRef v1, short v2) { return v1.less(v2);} +inline bool less(CVarRef v1, int v2) { return v1.less(v2);} +inline bool less(CVarRef v1, int64 v2) { return v1.less(v2);} +inline bool less(CVarRef v1, double v2) { return v1.less(v2);} +inline bool less(CVarRef v1, CStrRef v2) { return v1.less(v2);} +inline bool less(CVarRef v1, litstr v2) { return v1.less(v2);} +inline bool less(CVarRef v1, CArrRef v2) { return v1.less(v2);} +inline bool less(CVarRef v1, CObjRef v2) { return v1.less(v2);} +inline bool less(CVarRef v1, CVarRef v2) { return v1.less(v2);} + +inline bool less_rev(CVarRef v2, CVarRef v1) { return v1.less(v2);} + +inline bool more(CVarRef v1, bool v2) { return v1.more(v2);} +inline bool more(CVarRef v1, char v2) { return v1.more(v2);} +inline bool more(CVarRef v1, short v2) { return v1.more(v2);} +inline bool more(CVarRef v1, int v2) { return v1.more(v2);} +inline bool more(CVarRef v1, int64 v2) { return v1.more(v2);} +inline bool more(CVarRef v1, double v2) { return v1.more(v2);} +inline bool more(CVarRef v1, CStrRef v2) { return v1.more(v2);} +inline bool more(CVarRef v1, litstr v2) { return v1.more(v2);} +inline bool more(CVarRef v1, CArrRef v2) { return v1.more(v2);} +inline bool more(CVarRef v1, CObjRef v2) { return v1.more(v2);} +inline bool more(CVarRef v1, CVarRef v2) { return v1.more(v2);} + +inline bool more_rev(CVarRef v2, CVarRef v1) { return v1.more(v2);} + +/////////////////////////////////////////////////////////////////////////////// +// bool + +inline bool same(bool v1, bool v2) { return v1 == v2;} +inline bool same(bool v1, char v2) { return false;} +inline bool same(bool v1, short v2) { return false;} +inline bool same(bool v1, int v2) { return false;} +inline bool same(bool v1, int64 v2) { return false;} +inline bool same(bool v1, double v2) { return false;} +inline bool same(bool v1, CStrRef v2) { return false;} +inline bool same(bool v1, litstr v2) { return false;} +inline bool same(bool v1, CArrRef v2) { return false;} +inline bool same(bool v1, CObjRef v2) { return false;} +inline bool same(bool v1, CVarRef v2) { return same(v2, v1);} + +inline bool equal(bool v1, bool v2) { return v1 == v2;} +inline bool equal(bool v1, char v2) { return v1 == (v2 != 0);} +inline bool equal(bool v1, short v2) { return v1 == (v2 != 0);} +inline bool equal(bool v1, int v2) { return v1 == (v2 != 0);} +inline bool equal(bool v1, int64 v2) { return v1 == (v2 != 0);} +inline bool equal(bool v1, double v2) { return v1 == (v2 != 0.0);} +inline bool equal(bool v1, CStrRef v2) { return v1 == v2.toBoolean();} +inline bool equal(bool v1, litstr v2) { return equal(v1, String(v2));} +inline bool equal(bool v1, CArrRef v2) { return v1 == v2.toBoolean();} +inline bool equal(bool v1, CObjRef v2) { return v1 == v2.toBoolean();} +inline bool equal(bool v1, CVarRef v2) { return equal(v2, v1);} + +inline bool less(bool v1, bool v2) { return (v1?1:0) < (v2?1:0);} +inline bool less(bool v1, char v2) { return less(v1,(v2 != 0));} +inline bool less(bool v1, short v2) { return less(v1,(v2 != 0));} +inline bool less(bool v1, int v2) { return less(v1,(v2 != 0));} +inline bool less(bool v1, int64 v2) { return less(v1,(v2 != 0));} +inline bool less(bool v1, double v2) { return less(v1,(v2 != 0.0));} +inline bool less(bool v1, CStrRef v2) { return less(v1,v2.toBoolean());} +inline bool less(bool v1, litstr v2) { return less(v1,String(v2));} +inline bool less(bool v1, CArrRef v2) { return less(v1,v2.toBoolean());} +inline bool less(bool v1, CObjRef v2) { return less(v1,v2.toBoolean());} +inline bool less(bool v1, CVarRef v2) { return more(v2,v1);} + +inline bool more(bool v1, bool v2) { return (v1?1:0) > (v2?1:0);} +inline bool more(bool v1, char v2) { return more(v1,(v2 != 0));} +inline bool more(bool v1, short v2) { return more(v1,(v2 != 0));} +inline bool more(bool v1, int v2) { return more(v1,(v2 != 0));} +inline bool more(bool v1, int64 v2) { return more(v1,(v2 != 0));} +inline bool more(bool v1, double v2) { return more(v1,(v2 != 0.0));} +inline bool more(bool v1, CStrRef v2) { return more(v1,v2.toBoolean());} +inline bool more(bool v1, litstr v2) { return more(v1,String(v2));} +inline bool more(bool v1, CArrRef v2) { return more(v1,v2.toBoolean());} +inline bool more(bool v1, CObjRef v2) { return more(v1,v2.toBoolean());} +inline bool more(bool v1, CVarRef v2) { return less(v2,v1);} + +/////////////////////////////////////////////////////////////////////////////// +// char + +inline bool same(char v1, bool v2) { return same(v2, v1);} +inline bool same(char v1, char v2) { return v1 == v2;} +inline bool same(char v1, short v2) { return v1 == v2;} +inline bool same(char v1, int v2) { return v1 == v2;} +inline bool same(char v1, int64 v2) { return v1 == v2;} +inline bool same(char v1, double v2) { return (double)v1 == v2;} +inline bool same(char v1, CStrRef v2) { return false;} +inline bool same(char v1, litstr v2) { return false;} +inline bool same(char v1, CArrRef v2) { return false;} +inline bool same(char v1, CObjRef v2) { return false;} +inline bool same(char v1, CVarRef v2) { return same(v2, v1);} + +inline bool equal(char v1, bool v2) { return equal(v2, v1);} +inline bool equal(char v1, char v2) { return v1 == v2;} +inline bool equal(char v1, short v2) { return v1 == v2;} +inline bool equal(char v1, int v2) { return v1 == v2;} +inline bool equal(char v1, int64 v2) { return v1 == v2;} +inline bool equal(char v1, double v2) { return (double)v1 == v2;} +bool equal(char v1, CStrRef v2); +inline bool equal(char v1, litstr v2) { return equal(v1, String(v2));} +inline bool equal(char v1, CArrRef v2) { return false;} +inline bool equal(char v1, CObjRef v2) { return false;} +inline bool equal(char v1, CVarRef v2) { return equal(v2, v1);} + +inline bool less(char v1, bool v2) { return more(v2, v1);} +inline bool less(char v1, char v2) { return v1 < v2;} +inline bool less(char v1, short v2) { return v1 < v2;} +inline bool less(char v1, int v2) { return v1 < v2;} +inline bool less(char v1, int64 v2) { return v1 < v2;} +inline bool less(char v1, double v2) { return v1 < v2;} +bool less(char v1, CStrRef v2); +inline bool less(char v1, litstr v2) { return less(v1, String(v2));} +inline bool less(char v1, CArrRef v2) { return true;} +inline bool less(char v1, CObjRef v2) { return true;} +inline bool less(char v1, CVarRef v2) { return more(v2, v1);} + +inline bool more(char v1, bool v2) { return less(v2, v1);} +inline bool more(char v1, char v2) { return v1 > v2;} +inline bool more(char v1, short v2) { return v1 > v2;} +inline bool more(char v1, int v2) { return v1 > v2;} +inline bool more(char v1, int64 v2) { return v1 > v2;} +inline bool more(char v1, double v2) { return v1 > v2;} +bool more(char v1, CStrRef v2); +inline bool more(char v1, litstr v2) { return more(v1, String(v2));} +inline bool more(char v1, CArrRef v2) { return false;} +inline bool more(char v1, CObjRef v2) { return false;} +inline bool more(char v1, CVarRef v2) { return less(v2, v1);} + +/////////////////////////////////////////////////////////////////////////////// +// short + +inline bool same(short v1, bool v2) { return same(v2, v1);} +inline bool same(short v1, char v2) { return same(v2, v1);} +inline bool same(short v1, short v2) { return v1 == v2;} +inline bool same(short v1, int v2) { return v1 == v2;} +inline bool same(short v1, int64 v2) { return v1 == v2;} +inline bool same(short v1, double v2) { return (double)v1 == v2;} +inline bool same(short v1, CStrRef v2) { return false;} +inline bool same(short v1, litstr v2) { return false;} +inline bool same(short v1, CArrRef v2) { return false;} +inline bool same(short v1, CObjRef v2) { return false;} +inline bool same(short v1, CVarRef v2) { return same(v2, v1);} + +inline bool equal(short v1, bool v2) { return equal(v2, v1);} +inline bool equal(short v1, char v2) { return equal(v2, v1);} +inline bool equal(short v1, short v2) { return v1 == v2;} +inline bool equal(short v1, int v2) { return v1 == v2;} +inline bool equal(short v1, int64 v2) { return v1 == v2;} +inline bool equal(short v1, double v2) { return (double)v1 == v2;} +bool equal(short v1, CStrRef v2); +inline bool equal(short v1, litstr v2) { return equal(v1, String(v2));} +inline bool equal(short v1, CArrRef v2) { return false;} +inline bool equal(short v1, CObjRef v2) { return false;} +inline bool equal(short v1, CVarRef v2) { return equal(v2, v1);} + +inline bool less(short v1, bool v2) { return more(v2, v1);} +inline bool less(short v1, char v2) { return more(v2, v1);} +inline bool less(short v1, short v2) { return v1 < v2;} +inline bool less(short v1, int v2) { return v1 < v2;} +inline bool less(short v1, int64 v2) { return v1 < v2;} +inline bool less(short v1, double v2) { return v1 < v2;} +bool less(short v1, CStrRef v2); +inline bool less(short v1, litstr v2) { return less(v1, String(v2));} +inline bool less(short v1, CArrRef v2) { return true;} +inline bool less(short v1, CObjRef v2) { return true;} +inline bool less(short v1, CVarRef v2) { return more(v2, v1);} + +inline bool more(short v1, bool v2) { return less(v2, v1);} +inline bool more(short v1, char v2) { return less(v2, v1);} +inline bool more(short v1, short v2) { return v1 > v2;} +inline bool more(short v1, int v2) { return v1 > v2;} +inline bool more(short v1, int64 v2) { return v1 > v2;} +inline bool more(short v1, double v2) { return v1 > v2;} +bool more(short v1, CStrRef v2); +inline bool more(short v1, litstr v2) { return more(v1, String(v2));} +inline bool more(short v1, CArrRef v2) { return false;} +inline bool more(short v1, CObjRef v2) { return false;} +inline bool more(short v1, CVarRef v2) { return less(v2, v1);} + +/////////////////////////////////////////////////////////////////////////////// +// int + +inline bool same(int v1, bool v2) { return same(v2, v1);} +inline bool same(int v1, char v2) { return same(v2, v1);} +inline bool same(int v1, short v2) { return same(v2, v1);} +inline bool same(int v1, int v2) { return v1 == v2;} +inline bool same(int v1, int64 v2) { return v1 == v2;} +inline bool same(int v1, double v2) { return (double)v1 == v2;} +inline bool same(int v1, CStrRef v2) { return false;} +inline bool same(int v1, litstr v2) { return false;} +inline bool same(int v1, CArrRef v2) { return false;} +inline bool same(int v1, CObjRef v2) { return false;} +inline bool same(int v1, CVarRef v2) { return same(v2, v1);} + +inline bool equal(int v1, bool v2) { return equal(v2, v1);} +inline bool equal(int v1, char v2) { return equal(v2, v1);} +inline bool equal(int v1, short v2) { return equal(v2, v1);} +inline bool equal(int v1, int v2) { return v1 == v2;} +inline bool equal(int v1, int64 v2) { return v1 == v2;} +inline bool equal(int v1, double v2) { return (double)v1 == v2;} +bool equal(int v1, CStrRef v2); +inline bool equal(int v1, litstr v2) { return equal(v1, String(v2));} +inline bool equal(int v1, CArrRef v2) { return false;} +inline bool equal(int v1, CObjRef v2) { return false;} +inline bool equal(int v1, CVarRef v2) { return equal(v2, v1);} + +inline bool less(int v1, bool v2) { return more(v2, v1);} +inline bool less(int v1, char v2) { return more(v2, v1);} +inline bool less(int v1, short v2) { return more(v2, v1);} +inline bool less(int v1, int v2) { return v1 < v2;} +inline bool less(int v1, int64 v2) { return v1 < v2;} +inline bool less(int v1, double v2) { return v1 < v2;} +bool less(int v1, CStrRef v2); +inline bool less(int v1, litstr v2) { return less(v1, String(v2));} +inline bool less(int v1, CArrRef v2) { return true;} +inline bool less(int v1, CObjRef v2) { return true;} +inline bool less(int v1, CVarRef v2) { return more(v2, v1);} + +inline bool more(int v1, bool v2) { return less(v2, v1);} +inline bool more(int v1, char v2) { return less(v2, v1);} +inline bool more(int v1, short v2) { return less(v2, v1);} +inline bool more(int v1, int v2) { return v1 > v2;} +inline bool more(int v1, int64 v2) { return v1 > v2;} +inline bool more(int v1, double v2) { return v1 > v2;} +bool more(int v1, CStrRef v2); +inline bool more(int v1, litstr v2) { return more(v1, String(v2));} +inline bool more(int v1, CArrRef v2) { return false;} +inline bool more(int v1, CObjRef v2) { return false;} +inline bool more(int v1, CVarRef v2) { return less(v2, v1);} + +/////////////////////////////////////////////////////////////////////////////// +// int64 + +inline bool same(int64 v1, bool v2) { return same(v2, v1);} +inline bool same(int64 v1, char v2) { return same(v2, v1);} +inline bool same(int64 v1, short v2) { return same(v2, v1);} +inline bool same(int64 v1, int v2) { return same(v2, v1);} +inline bool same(int64 v1, int64 v2) { return v1 == v2;} +inline bool same(int64 v1, double v2) { return (double)v1 == v2;} +inline bool same(int64 v1, CStrRef v2) { return false;} +inline bool same(int64 v1, litstr v2) { return false;} +inline bool same(int64 v1, CArrRef v2) { return false;} +inline bool same(int64 v1, CObjRef v2) { return false;} +inline bool same(int64 v1, CVarRef v2) { return same(v2, v1);} + +inline bool equal(int64 v1, bool v2) { return equal(v2, v1);} +inline bool equal(int64 v1, char v2) { return equal(v2, v1);} +inline bool equal(int64 v1, short v2) { return equal(v2, v1);} +inline bool equal(int64 v1, int v2) { return equal(v2, v1);} +inline bool equal(int64 v1, int64 v2) { return v1 == v2;} +inline bool equal(int64 v1, double v2) { return (double)v1 == v2;} +bool equal(int64 v1, CStrRef v2); +inline bool equal(int64 v1, litstr v2) { return equal(v1, String(v2));} +inline bool equal(int64 v1, CArrRef v2) { return false;} +inline bool equal(int64 v1, CObjRef v2) { return false;} +inline bool equal(int64 v1, CVarRef v2) { return equal(v2, v1);} + +inline bool less(int64 v1, bool v2) { return more(v2, v1);} +inline bool less(int64 v1, char v2) { return more(v2, v1);} +inline bool less(int64 v1, short v2) { return more(v2, v1);} +inline bool less(int64 v1, int v2) { return more(v2, v1);} +inline bool less(int64 v1, int64 v2) { return v1 < v2;} +inline bool less(int64 v1, double v2) { return v1 < v2;} +bool less(int64 v1, CStrRef v2); +inline bool less(int64 v1, litstr v2) { return less(v1, String(v2));} +inline bool less(int64 v1, CArrRef v2) { return true;} +inline bool less(int64 v1, CObjRef v2) { return true;} +inline bool less(int64 v1, CVarRef v2) { return more(v2, v1);} + +inline bool more(int64 v1, bool v2) { return less(v2, v1);} +inline bool more(int64 v1, char v2) { return less(v2, v1);} +inline bool more(int64 v1, short v2) { return less(v2, v1);} +inline bool more(int64 v1, int v2) { return less(v2, v1);} +inline bool more(int64 v1, int64 v2) { return v1 > v2;} +inline bool more(int64 v1, double v2) { return v1 > v2;} +bool more(int64 v1, CStrRef v2); +inline bool more(int64 v1, litstr v2) { return more(v1, String(v2));} +inline bool more(int64 v1, CArrRef v2) { return false;} +inline bool more(int64 v1, CObjRef v2) { return false;} +inline bool more(int64 v1, CVarRef v2) { return less(v2, v1);} + +/////////////////////////////////////////////////////////////////////////////// +// double + +inline bool same(double v1, bool v2) { return same(v2, v1);} +inline bool same(double v1, char v2) { return same(v2, v1);} +inline bool same(double v1, short v2) { return same(v2, v1);} +inline bool same(double v1, int v2) { return same(v2, v1);} +inline bool same(double v1, int64 v2) { return same(v2, v1);} +inline bool same(double v1, double v2) { return v1 == v2;} +inline bool same(double v1, CStrRef v2) { return false;} +inline bool same(double v1, litstr v2) { return false;} +inline bool same(double v1, CArrRef v2) { return false;} +inline bool same(double v1, CObjRef v2) { return false;} +inline bool same(double v1, CVarRef v2) { return same(v2, v1);} + +inline bool equal(double v1, bool v2) { return equal(v2, v1);} +inline bool equal(double v1, char v2) { return equal(v2, v1);} +inline bool equal(double v1, short v2) { return equal(v2, v1);} +inline bool equal(double v1, int v2) { return equal(v2, v1);} +inline bool equal(double v1, int64 v2) { return equal(v2, v1);} +inline bool equal(double v1, double v2) { return v1 == v2;} +inline bool equal(double v1, CStrRef v2) { return v1 == v2.toDouble();} +inline bool equal(double v1, litstr v2) { return equal(v1,String(v2));} +inline bool equal(double v1, CArrRef v2) { return false;} +inline bool equal(double v1, CObjRef v2) { return false;} +inline bool equal(double v1, CVarRef v2) { return equal(v2, v1);} + +inline bool less(double v1, bool v2) { return more(v2, v1);} +inline bool less(double v1, char v2) { return more(v2, v1);} +inline bool less(double v1, short v2) { return more(v2, v1);} +inline bool less(double v1, int v2) { return more(v2, v1);} +inline bool less(double v1, int64 v2) { return more(v2, v1);} +inline bool less(double v1, double v2) { return v1 < v2;} +inline bool less(double v1, CStrRef v2) { return less(v1,v2.toDouble());} +inline bool less(double v1, litstr v2) { return less(v1,String(v2));} +inline bool less(double v1, CArrRef v2) { return true;} +inline bool less(double v1, CObjRef v2) { return true;} +inline bool less(double v1, CVarRef v2) { return more(v2, v1);} + +inline bool more(double v1, bool v2) { return less(v2, v1);} +inline bool more(double v1, char v2) { return less(v2, v1);} +inline bool more(double v1, short v2) { return less(v2, v1);} +inline bool more(double v1, int v2) { return less(v2, v1);} +inline bool more(double v1, int64 v2) { return less(v2, v1);} +inline bool more(double v1, double v2) { return v1 > v2;} +inline bool more(double v1, CStrRef v2) { return more(v1,v2.toDouble());} +inline bool more(double v1, litstr v2) { return more(v1,String(v2));} +inline bool more(double v1, CArrRef v2) { return false;} +inline bool more(double v1, CObjRef v2) { return false;} +inline bool more(double v1, CVarRef v2) { return less(v2, v1);} + +/////////////////////////////////////////////////////////////////////////////// +// String + +inline bool same(CStrRef v1, bool v2) { return same(v2, v1);} +inline bool same(CStrRef v1, char v2) { return same(v2, v1);} +inline bool same(CStrRef v1, short v2) { return same(v2, v1);} +inline bool same(CStrRef v1, int v2) { return same(v2, v1);} +inline bool same(CStrRef v1, int64 v2) { return same(v2, v1);} +inline bool same(CStrRef v1, double v2) { return same(v2, v1);} +inline bool same(CStrRef v1, CStrRef v2) { return v1.same(v2);} +inline bool same(CStrRef v1, litstr v2) { return v1.same(v2);} +inline bool same(CStrRef v1, CArrRef v2) { return v1.same(v2);} +inline bool same(CStrRef v1, CObjRef v2) { return v1.same(v2);} +inline bool same(CStrRef v1, CVarRef v2) { return same(v2, v1);} + +inline bool equal(CStrRef v1, bool v2) { return equal(v2, v1);} +inline bool equal(CStrRef v1, char v2) { return equal(v2, v1);} +inline bool equal(CStrRef v1, short v2) { return equal(v2, v1);} +inline bool equal(CStrRef v1, int v2) { return equal(v2, v1);} +inline bool equal(CStrRef v1, int64 v2) { return equal(v2, v1);} +inline bool equal(CStrRef v1, double v2) { return equal(v2, v1);} +inline bool equal(CStrRef v1, CStrRef v2) { return v1.equal(v2);} +inline bool equal(CStrRef v1, litstr v2) { return v1.equal(v2);} +inline bool equal(CStrRef v1, CArrRef v2) { return v1.equal(v2);} +inline bool equal(CStrRef v1, CObjRef v2) { return v1.equal(v2);} +inline bool equal(CStrRef v1, CVarRef v2) { return equal(v2, v1);} + +inline bool less(CStrRef v1, bool v2) { return more(v2, v1);} +inline bool less(CStrRef v1, char v2) { return more(v2, v1);} +inline bool less(CStrRef v1, short v2) { return more(v2, v1);} +inline bool less(CStrRef v1, int v2) { return more(v2, v1);} +inline bool less(CStrRef v1, int64 v2) { return more(v2, v1);} +inline bool less(CStrRef v1, double v2) { return more(v2, v1);} +inline bool less(CStrRef v1, CStrRef v2) { return v1.less(v2);} +inline bool less(CStrRef v1, litstr v2) { return v1.less(v2);} +inline bool less(CStrRef v1, CArrRef v2) { return v1.less(v2);} +inline bool less(CStrRef v1, CObjRef v2) { return v1.less(v2);} +inline bool less(CStrRef v1, CVarRef v2) { return more(v2, v1);} + +inline bool more(CStrRef v1, bool v2) { return less(v2, v1);} +inline bool more(CStrRef v1, char v2) { return less(v2, v1);} +inline bool more(CStrRef v1, short v2) { return less(v2, v1);} +inline bool more(CStrRef v1, int v2) { return less(v2, v1);} +inline bool more(CStrRef v1, int64 v2) { return less(v2, v1);} +inline bool more(CStrRef v1, double v2) { return less(v2, v1);} +inline bool more(CStrRef v1, CStrRef v2) { return v1.more(v2);} +inline bool more(CStrRef v1, litstr v2) { return v1.more(v2);} +inline bool more(CStrRef v1, CArrRef v2) { return v1.more(v2);} +inline bool more(CStrRef v1, CObjRef v2) { return v1.more(v2);} +inline bool more(CStrRef v1, CVarRef v2) { return less(v2, v1);} + +/////////////////////////////////////////////////////////////////////////////// +// litstr + +inline bool same(litstr v1, bool v2) { return same(String(v1), v2);} +inline bool same(litstr v1, char v2) { return same(String(v1), v2);} +inline bool same(litstr v1, short v2) { return same(String(v1), v2);} +inline bool same(litstr v1, int v2) { return same(String(v1), v2);} +inline bool same(litstr v1, int64 v2) { return same(String(v1), v2);} +inline bool same(litstr v1, double v2) { return same(String(v1), v2);} +inline bool same(litstr v1, CStrRef v2) { return same(String(v1), v2);} +inline bool same(litstr v1, litstr v2) { return same(String(v1), v2);} +inline bool same(litstr v1, CArrRef v2) { return same(String(v1), v2);} +inline bool same(litstr v1, CObjRef v2) { return same(String(v1), v2);} +inline bool same(litstr v1, CVarRef v2) { return same(String(v1), v2);} + +inline bool equal(litstr v1, bool v2) { return equal(String(v1),v2);} +inline bool equal(litstr v1, char v2) { return equal(String(v1),v2);} +inline bool equal(litstr v1, short v2) { return equal(String(v1),v2);} +inline bool equal(litstr v1, int v2) { return equal(String(v1),v2);} +inline bool equal(litstr v1, int64 v2) { return equal(String(v1),v2);} +inline bool equal(litstr v1, double v2) { return equal(String(v1),v2);} +inline bool equal(litstr v1, CStrRef v2) { return equal(String(v1),v2);} +inline bool equal(litstr v1, litstr v2) { return equal(String(v1),v2);} +inline bool equal(litstr v1, CArrRef v2) { return equal(String(v1),v2);} +inline bool equal(litstr v1, CObjRef v2) { return equal(String(v1),v2);} +inline bool equal(litstr v1, CVarRef v2) { return equal(String(v1),v2);} + +inline bool less(litstr v1, bool v2) { return less(String(v1), v2);} +inline bool less(litstr v1, char v2) { return less(String(v1), v2);} +inline bool less(litstr v1, short v2) { return less(String(v1), v2);} +inline bool less(litstr v1, int v2) { return less(String(v1), v2);} +inline bool less(litstr v1, int64 v2) { return less(String(v1), v2);} +inline bool less(litstr v1, double v2) { return less(String(v1), v2);} +inline bool less(litstr v1, CStrRef v2) { return less(String(v1), v2);} +inline bool less(litstr v1, litstr v2) { return less(String(v1), v2);} +inline bool less(litstr v1, CArrRef v2) { return less(String(v1), v2);} +inline bool less(litstr v1, CObjRef v2) { return less(String(v1), v2);} +inline bool less(litstr v1, CVarRef v2) { return less(String(v1), v2);} + +inline bool more(litstr v1, bool v2) { return more(String(v1), v2);} +inline bool more(litstr v1, char v2) { return more(String(v1), v2);} +inline bool more(litstr v1, short v2) { return more(String(v1), v2);} +inline bool more(litstr v1, int v2) { return more(String(v1), v2);} +inline bool more(litstr v1, int64 v2) { return more(String(v1), v2);} +inline bool more(litstr v1, double v2) { return more(String(v1), v2);} +inline bool more(litstr v1, CStrRef v2) { return more(String(v1), v2);} +inline bool more(litstr v1, litstr v2) { return more(String(v1), v2);} +inline bool more(litstr v1, CArrRef v2) { return more(String(v1), v2);} +inline bool more(litstr v1, CObjRef v2) { return more(String(v1), v2);} +inline bool more(litstr v1, CVarRef v2) { return more(String(v1), v2);} + +/////////////////////////////////////////////////////////////////////////////// +// Array + +inline bool same(CArrRef v1, bool v2) { return same(v2, v1);} +inline bool same(CArrRef v1, char v2) { return same(v2, v1);} +inline bool same(CArrRef v1, short v2) { return same(v2, v1);} +inline bool same(CArrRef v1, int v2) { return same(v2, v1);} +inline bool same(CArrRef v1, int64 v2) { return same(v2, v1);} +inline bool same(CArrRef v1, double v2) { return same(v2, v1);} +inline bool same(CArrRef v1, CStrRef v2) { return same(v2, v1);} +inline bool same(CArrRef v1, litstr v2) { return same(v2, v1);} +inline bool same(CArrRef v1, CArrRef v2) { return v1.same(v2);} +inline bool same(CArrRef v1, CObjRef v2) { return v1.same(v2);} +inline bool same(CArrRef v1, CVarRef v2) { return same(v2, v1);} + +inline bool equal(CArrRef v1, bool v2) { return equal(v2, v1);} +inline bool equal(CArrRef v1, char v2) { return equal(v2, v1);} +inline bool equal(CArrRef v1, short v2) { return equal(v2, v1);} +inline bool equal(CArrRef v1, int v2) { return equal(v2, v1);} +inline bool equal(CArrRef v1, int64 v2) { return equal(v2, v1);} +inline bool equal(CArrRef v1, double v2) { return equal(v2, v1);} +inline bool equal(CArrRef v1, CStrRef v2) { return equal(v2, v1);} +inline bool equal(CArrRef v1, litstr v2) { return equal(v2, v1);} +inline bool equal(CArrRef v1, CArrRef v2) { return v1.equal(v2);} +inline bool equal(CArrRef v1, CObjRef v2) { return v1.equal(v2);} +inline bool equal(CArrRef v1, CVarRef v2) { return equal(v2, v1);} + +inline bool less(CArrRef v1, bool v2) { return more(v2, v1);} +inline bool less(CArrRef v1, char v2) { return more(v2, v1);} +inline bool less(CArrRef v1, short v2) { return more(v2, v1);} +inline bool less(CArrRef v1, int v2) { return more(v2, v1);} +inline bool less(CArrRef v1, int64 v2) { return more(v2, v1);} +inline bool less(CArrRef v1, double v2) { return more(v2, v1);} +inline bool less(CArrRef v1, CStrRef v2) { return more(v2, v1);} +inline bool less(CArrRef v1, litstr v2) { return more(v2, v1);} +inline bool less(CArrRef v1, CArrRef v2) { return v1.less(v2);} +inline bool less(CArrRef v1, CObjRef v2) { return v1.less(v2);} +inline bool less(CArrRef v1, CVarRef v2) { return v1.less(v2);} + +inline bool more(CArrRef v1, bool v2) { return less(v2, v1);} +inline bool more(CArrRef v1, char v2) { return less(v2, v1);} +inline bool more(CArrRef v1, short v2) { return less(v2, v1);} +inline bool more(CArrRef v1, int v2) { return less(v2, v1);} +inline bool more(CArrRef v1, int64 v2) { return less(v2, v1);} +inline bool more(CArrRef v1, double v2) { return less(v2, v1);} +inline bool more(CArrRef v1, CStrRef v2) { return less(v2, v1);} +inline bool more(CArrRef v1, litstr v2) { return less(v2, v1);} +inline bool more(CArrRef v1, CArrRef v2) { return v1.more(v2);} +inline bool more(CArrRef v1, CObjRef v2) { return v1.more(v2);} +inline bool more(CArrRef v1, CVarRef v2) { return v1.more(v2);} + +/////////////////////////////////////////////////////////////////////////////// +// Object + +inline bool same(CObjRef v1, bool v2) { return same(v2, v1);} +inline bool same(CObjRef v1, char v2) { return same(v2, v1);} +inline bool same(CObjRef v1, short v2) { return same(v2, v1);} +inline bool same(CObjRef v1, int v2) { return same(v2, v1);} +inline bool same(CObjRef v1, int64 v2) { return same(v2, v1);} +inline bool same(CObjRef v1, double v2) { return same(v2, v1);} +inline bool same(CObjRef v1, CStrRef v2) { return same(v2, v1);} +inline bool same(CObjRef v1, litstr v2) { return same(v2, v1);} +inline bool same(CObjRef v1, CArrRef v2) { return same(v2, v1);} +inline bool same(CObjRef v1, CObjRef v2) { return v1.same(v2);} +inline bool same(CObjRef v1, CVarRef v2) { return same(v2, v1);} + +inline bool equal(CObjRef v1, bool v2) { return equal(v2, v1);} +inline bool equal(CObjRef v1, char v2) { return equal(v2, v1);} +inline bool equal(CObjRef v1, short v2) { return equal(v2, v1);} +inline bool equal(CObjRef v1, int v2) { return equal(v2, v1);} +inline bool equal(CObjRef v1, int64 v2) { return equal(v2, v1);} +inline bool equal(CObjRef v1, double v2) { return equal(v2, v1);} +inline bool equal(CObjRef v1, CStrRef v2) { return equal(v2, v1);} +inline bool equal(CObjRef v1, litstr v2) { return equal(v2, v1);} +inline bool equal(CObjRef v1, CArrRef v2) { return equal(v2, v1);} +inline bool equal(CObjRef v1, CObjRef v2) { return v1.equal(v2);} +inline bool equal(CObjRef v1, CVarRef v2) { return equal(v2, v1);} + +inline bool less(CObjRef v1, bool v2) { return more(v2, v1);} +inline bool less(CObjRef v1, char v2) { return more(v2, v1);} +inline bool less(CObjRef v1, short v2) { return more(v2, v1);} +inline bool less(CObjRef v1, int v2) { return more(v2, v1);} +inline bool less(CObjRef v1, int64 v2) { return more(v2, v1);} +inline bool less(CObjRef v1, double v2) { return more(v2, v1);} +inline bool less(CObjRef v1, CStrRef v2) { return more(v2, v1);} +inline bool less(CObjRef v1, litstr v2) { return more(v2, v1);} +inline bool less(CObjRef v1, CArrRef v2) { return more(v2, v1);} +inline bool less(CObjRef v1, CObjRef v2) { return v1.less(v2);} +inline bool less(CObjRef v1, CVarRef v2) { return more(v2, v1);} + +inline bool more(CObjRef v1, bool v2) { return less(v2, v1);} +inline bool more(CObjRef v1, char v2) { return less(v2, v1);} +inline bool more(CObjRef v1, short v2) { return less(v2, v1);} +inline bool more(CObjRef v1, int v2) { return less(v2, v1);} +inline bool more(CObjRef v1, int64 v2) { return less(v2, v1);} +inline bool more(CObjRef v1, double v2) { return less(v2, v1);} +inline bool more(CObjRef v1, CStrRef v2) { return less(v2, v1);} +inline bool more(CObjRef v1, litstr v2) { return less(v2, v1);} +inline bool more(CObjRef v1, CArrRef v2) { return less(v2, v1);} +inline bool more(CObjRef v1, CObjRef v2) { return v1.more(v2);} +inline bool more(CObjRef v1, CVarRef v2) { return less(v2, v1);} + +/////////////////////////////////////////////////////////////////////////////// +/** + * Special-casing comparisons between arrays to get the same results from + * comparisons between uncomparable arrays. + */ +bool not_more(CVarRef v1, CVarRef v2); + +inline bool not_more_rev(CVarRef v2, CVarRef v1) { + return not_more(v1, v2); +} + +bool not_less(CVarRef v1, CVarRef v2); + +inline bool not_less_rev(CVarRef v2, CVarRef v1) { + return not_less(v1, v2); +} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_COMPARISONS_H__ diff --git a/src/cpp/base/debug/backtrace.cpp b/src/cpp/base/debug/backtrace.cpp new file mode 100644 index 0000000000000..f7494e8e24d2c --- /dev/null +++ b/src/cpp/base/debug/backtrace.cpp @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Array stackTraceToBackTrace(const StackTrace& st) { + std::vector bt_pointers; + st.get(bt_pointers); + Array ret; + if (RuntimeOption::FullBacktrace) { + for (unsigned int i = 0; i < bt_pointers.size(); i++) { + StackTrace::FramePtr f = StackTrace::Translate(bt_pointers[i]); + if (RuntimeOption::TranslateSource) { + SourceInfo::TheSourceInfo.translate(f); + } + Array frame; + frame.set("file", String(f->filename)); + frame.set("line", f->lineno); + frame.set("function", String(f->funcname)); + frame.set("args", ""); + frame.set("bt", (int64)bt_pointers[i]); + ret.append(frame); + } + } else { + for (unsigned int i = 0; i < bt_pointers.size(); i++) { + Array frame; + frame.set("file", ""); + frame.set("line", 0LL); + frame.set("function", ""); + frame.set("args", ""); + frame.set("bt", (int64)bt_pointers[i]); + ret.append(frame); + } + ret.set("bts", String(st.hexEncode())); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/debug/backtrace.h b/src/cpp/base/debug/backtrace.h new file mode 100644 index 0000000000000..70b81cff53011 --- /dev/null +++ b/src/cpp/base/debug/backtrace.h @@ -0,0 +1,32 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CPP_BASE_DEBUG_BACKTRACE_H__ +#define __CPP_BASE_DEBUG_BACKTRACE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class StackTrace; +Array stackTraceToBackTrace(const StackTrace& st); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __CPP_BASE_DEBUG_BACKTRACE_H__ diff --git a/src/cpp/base/dynamic_object_data.cpp b/src/cpp/base/dynamic_object_data.cpp new file mode 100644 index 0000000000000..dbe884434a810 --- /dev/null +++ b/src/cpp/base/dynamic_object_data.cpp @@ -0,0 +1,428 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { + +///////////////////////////////////////////////////////////////////////////// +// constructor/destructor + +DynamicObjectData::DynamicObjectData(const char* pname, + ObjectData* r /* = NULL */) : + root(r ? r : this) { + if (pname) parent = create_object(pname, Array(), false, root); +} + +void DynamicObjectData::init() { + if (!parent.isNull()) { + parent->init(); + } +} + +void DynamicObjectData::dynConstruct(CArrRef params) { + if (!parent.isNull()) { + parent->dynConstruct(params); + } +} + +void DynamicObjectData::destruct() { + if (!parent.isNull()) { + if (inCtorDtor()) { + parent->setInDtor(); + } + parent = Object(); + } +} + +void DynamicObjectData::setRoot(ObjectData *r) { + root = r; + if (!parent.isNull()) { + parent->setRoot(r); + } +} + +ObjectData* DynamicObjectData::clone() { + ObjectData *clone = cloneImpl(); + clone->setRoot(clone); + return clone; +} + + +/////////////////////////////////////////////////////////////////////////////// +// instance methods and properties + +bool DynamicObjectData::o_exists(CStrRef propName, int64 hash) const { + if (!parent.isNull()) { + return parent->o_exists(propName, hash); + } else { + return ObjectData::o_exists(propName, hash); + } +} + +Variant DynamicObjectData::o_get(CStrRef propName, int64 hash) { + if (!parent.isNull()) { + return parent->o_get(propName, hash); + } else { + if (propName.size() == 0) { + return null; + } + if (o_properties && o_properties->exists(propName)) { + return o_properties->rvalAt(propName); + } + return root->t___get(propName); + } +} + +void DynamicObjectData::o_get(std::vector &props) const { + if (!parent.isNull()) { + return parent->o_get(props); + } else { + return ObjectData::o_get(props); + } +} + +Variant DynamicObjectData::o_set(CStrRef propName, int64 hash, CVarRef v, + bool forInit /* = false */) { + if (!parent.isNull()) { + return parent->o_set(propName, hash, v, forInit); + } else { + if (propName.size() == 0) { + throw EmptyObjectPropertyException(); + } + if (o_properties && o_properties->exists(propName)) { + o_properties->set(propName, v); + return v; + } + if (forInit) { + return ObjectData::t___set(propName, v); + } else { + return root->t___set(propName, v); + } + } +} + +Variant &DynamicObjectData::o_lval(CStrRef propName, int64 hash) { + if (!parent.isNull()) { + return parent->o_lval(propName, hash); + } else { + if (o_properties && o_properties->exists(propName)) { + return o_properties->lvalAt(propName, hash); + } + return root->___lval(propName); + } +} + +Array DynamicObjectData::o_toArray() const { + if (!parent.isNull()) { + return parent->o_toArray(); + } else { + return ObjectData::o_toArray(); + } +} + +Array DynamicObjectData::o_getDynamicProperties() const { + if (!parent.isNull()) { + return parent->o_getDynamicProperties(); + } else { + return ObjectData::o_getDynamicProperties(); + } +} + +Variant DynamicObjectData::o_invoke(const char *s, CArrRef params, int64 hash, + bool fatal /* = false */) { + if (!parent.isNull()) { + return parent->o_invoke(s, params, hash, fatal); + } else { + return root->doCall(s, params, fatal); + } +} + +Variant DynamicObjectData::o_invoke_ex(const char *clsname, const char *s, + CArrRef params, int64 hash, + bool fatal /* = false */) { + if (strcasecmp(o_getClassName(), clsname) == 0) { + return o_invoke(s, params, hash); + } else if(!parent.isNull()) { + return parent->o_invoke_ex(clsname, s, params, hash, fatal); + } else { + return ObjectData::o_invoke_ex(clsname, s, params, hash, fatal); + } +} + +Variant DynamicObjectData::o_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 /* = null_variant */, + CVarRef a1 /* = null_variant */, + CVarRef a2 /* = null_variant */ +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 /* = null_variant */, + CVarRef a4 /* = null_variant */, + CVarRef a5 /* = null_variant */ +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 /* = null_variant */, + CVarRef a7 /* = null_variant */, + CVarRef a8 /* = null_variant */, + CVarRef a9 /* = null_variant */ +#endif +) { + if (!parent.isNull()) { + return parent->o_invoke_few_args(s, hash, count, a0, a1, a2 +#if INVOKE_FEW_ARGS_COUNT > 3 + ,a3, a4, a5 +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,a6, a7, a8, a9 +#endif + ); + } else { + switch (count) { + case 0: { + return DynamicObjectData::o_invoke(s, Array(), hash); + } + case 1: { + Array params(NEW(ArrayElement)(a0), NULL); + return DynamicObjectData::o_invoke(s, params, hash); + } + case 2: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), NULL); + return DynamicObjectData::o_invoke(s, params, hash); + } + case 3: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NULL); + return DynamicObjectData::o_invoke(s, params, hash); + } +#if INVOKE_FEW_ARGS_COUNT > 3 + case 4: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), NULL); + return DynamicObjectData::o_invoke(s, params, hash); + } + case 5: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NULL); + return DynamicObjectData::o_invoke(s, params, hash); + } + case 6: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), NULL); + return DynamicObjectData::o_invoke(s, params, hash); + } +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + case 7: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NULL); + return DynamicObjectData::o_invoke(s, params, hash); + } + case 8: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NEW(ArrayElement)(a7), NULL); + return DynamicObjectData::o_invoke(s, params, hash); + } + case 9: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NEW(ArrayElement)(a7), + NEW(ArrayElement)(a8), NULL); + return DynamicObjectData::o_invoke(s, params, hash); + } + case 10: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NEW(ArrayElement)(a7), + NEW(ArrayElement)(a8), NEW(ArrayElement)(a9), NULL); + return DynamicObjectData::o_invoke(s, params, hash); + } +#endif + default: + ASSERT(false); + } + return null; + } +} + +Variant DynamicObjectData::o_root_invoke(const char *s, CArrRef params, + int64 hash, bool fatal /* = false */) { + if (root != this) { + return root->o_root_invoke(s, params, hash, fatal); + } else { + return o_invoke(s, params, hash, fatal); + } +} +Variant +DynamicObjectData::o_root_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 /* = null_variant */, + CVarRef a1 /* = null_variant */, + CVarRef a2 /* = null_variant */ +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 /* = null_variant */, + CVarRef a4 /* = null_variant */, + CVarRef a5 /* = null_variant */ +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 /* = null_variant */, + CVarRef a7 /* = null_variant */, + CVarRef a8 /* = null_variant */, + CVarRef a9 /* = null_variant */ +#endif +) { + if (root != this) { + return root->o_invoke_few_args(s, hash, count, a0, a1, a2 +#if INVOKE_FEW_ARGS_COUNT > 3 + ,a3, a4, a5 +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,a6, a7, a8, a9 +#endif + ); + } else { + return o_invoke_few_args(s, hash, count, a0, a1, a2 +#if INVOKE_FEW_ARGS_COUNT > 3 + ,a3, a4, a5 +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,a6, a7, a8, a9 +#endif + ); + } +} + +Variant DynamicObjectData::doCall(Variant v_name, Variant v_arguments, + bool fatal) { + if (!parent.isNull()) { + return parent->doCall(v_name, v_arguments, fatal); + } else { + return ObjectData::doCall(v_name, v_arguments, fatal); + } +} + + +/////////////////////////////////////////////////////////////////////////////// +// magic methods that user classes can override, and these are default handlers +// or actions to take: + +Variant DynamicObjectData::t___destruct() { + if (!parent.isNull()) { + return parent->t___destruct(); + } else { + return ObjectData::t___destruct(); + } +} +Variant DynamicObjectData::t___set(Variant v_name, Variant v_value) { + if (v_value.isReferenced()) { + v_value.setContagious(); + } + if (!parent.isNull()) { + return parent->t___set(v_name, v_value); + } else { + return ObjectData::t___set(v_name, v_value); + } +} + +Variant DynamicObjectData::t___get(Variant v_name) { + if (!parent.isNull()) { + return parent->t___get(v_name); + } else { + return ObjectData::t___get(v_name); + } +} + +bool DynamicObjectData::t___isset(Variant v_name) { + if (!parent.isNull()) { + return parent->t___isset(v_name); + } else { + return ObjectData::t___isset(v_name); + } +} + +Variant DynamicObjectData::t___unset(Variant v_name) { + if (!parent.isNull()) { + return parent->t___unset(v_name); + } else { + return ObjectData::t___unset(v_name); + } +} + +Variant DynamicObjectData::t___sleep() { + if (!parent.isNull()) { + return parent->t___sleep(); + } else { + return ObjectData::t___sleep(); + } +} + +Variant DynamicObjectData::t___wakeup() { + if (!parent.isNull()) { + return parent->t___wakeup(); + } else { + return ObjectData::t___wakeup(); + } +} + +Variant DynamicObjectData::t___set_state(Variant v_properties) { + if (!parent.isNull()) { + return parent->t___set_state(v_properties); + } else { + return ObjectData::t___set_state(v_properties); + } +} + +String DynamicObjectData::t___tostring() { + if (!parent.isNull()) { + return parent->t___tostring(); + } else { + return ObjectData::t___tostring(); + } +} + +Variant DynamicObjectData::t___clone() { + if (!parent.isNull()) { + return parent->t___clone(); + } else { + return ObjectData::t___clone(); + } +} + +Variant &DynamicObjectData::___lval(Variant v_name) { + if (!parent.isNull()) { + return parent->___lval(v_name); + } else { + return ObjectData::___lval(v_name); + } +} + +Variant &DynamicObjectData::___offsetget_lval(Variant v_name) { + if (!parent.isNull()) { + return parent->___offsetget_lval(v_name); + } else { + return ObjectData::___offsetget_lval(v_name); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/dynamic_object_data.h b/src/cpp/base/dynamic_object_data.h new file mode 100644 index 0000000000000..2fe153adac98e --- /dev/null +++ b/src/cpp/base/dynamic_object_data.h @@ -0,0 +1,115 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_DYNAMIC_OBJECT_DATA_H__ +#define __HPHP_DYNAMIC_OBJECT_DATA_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class DynamicObjectData : public ObjectData { + public: + DynamicObjectData(const char* pname, ObjectData *r = NULL); + + virtual void init(); + virtual void dynConstruct(CArrRef params); + virtual void destruct(); + virtual void setRoot(ObjectData *r); + + virtual ObjectData* clone(); + + // properties + virtual Array o_toArray() const; + virtual Array o_getDynamicProperties() const; + virtual bool o_exists(CStrRef s, int64 hash) const; + virtual void o_get(std::vector &props) const; + virtual Variant o_get(CStrRef s, int64 hash); + virtual Variant &o_lval(CStrRef s, int64 hash); + virtual Variant o_set(CStrRef s, int64 hash, CVarRef v, + bool forInit = false); + + // methods + virtual Variant o_invoke(const char *s, CArrRef params, int64 hash, + bool fatal = true); + virtual Variant o_invoke_ex(const char *clsname, const char *s, + CArrRef params, int64 hash, bool fatal = true); + virtual Variant o_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 = null_variant, + CVarRef a1 = null_variant, + CVarRef a2 = null_variant +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 = null_variant, + CVarRef a4 = null_variant, + CVarRef a5 = null_variant +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 = null_variant, + CVarRef a7 = null_variant, + CVarRef a8 = null_variant, + CVarRef a9 = null_variant +#endif +); + virtual Variant o_root_invoke(const char *s, CArrRef params, int64 hash, + bool fatal = false); + virtual Variant o_root_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 = null_variant, + CVarRef a1 = null_variant, + CVarRef a2 = null_variant +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 = null_variant, + CVarRef a4 = null_variant, + CVarRef a5 = null_variant +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 = null_variant, + CVarRef a7 = null_variant, + CVarRef a8 = null_variant, + CVarRef a9 = null_variant +#endif +); + + virtual Variant doCall(Variant v_name, Variant v_arguments, bool fatal); + + // magic methods + // __construct is handled in a special way + virtual Variant t___destruct(); + virtual Variant t___set(Variant v_name, Variant v_value); + virtual Variant t___get(Variant v_name); + virtual bool t___isset(Variant v_name); + virtual Variant t___unset(Variant v_name); + virtual Variant t___sleep(); + virtual Variant t___wakeup(); + virtual Variant t___set_state(Variant v_properties); + virtual String t___tostring(); + virtual Variant t___clone(); + virtual Variant &___lval(Variant v_name); + virtual Variant &___offsetget_lval(Variant v_name); + + void setParent(Object p) { parent = p; } + + protected: + ObjectData* root; + Object parent; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_OBJECT_DATA_H__ diff --git a/src/cpp/base/execution_context.cpp b/src/cpp/base/execution_context.cpp new file mode 100644 index 0000000000000..72c621a141843 --- /dev/null +++ b/src/cpp/base/execution_context.cpp @@ -0,0 +1,547 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// static + +ThreadLocal g_context; + +int RequestEventHandler::priority() const { return 0; } + +class RequestData : public RequestEventHandler { +public: + RequestData() : data(NULL) {} + + struct Data { + int errorReportingLevel; + String lastError; + String timezone; + String timezoneDefault; + Array shutdowns; + Array ticks; + std::vector systemExceptionHandlers; + std::vector userExceptionHandlers; + String cwd; + }; + Data *data; + + virtual void requestInit() { + data = new Data(); + data->errorReportingLevel = 6135; // E_ALL & ~E_NOTICE + data->cwd = Process::CurrentWorkingDirectory; + } + virtual void requestShutdown() { + delete data; + } +}; +static RequestLocal s_request_data; + +String ExecutionContext::getLastError() { + return s_request_data->data->lastError; +} +int ExecutionContext::getErrorReportingLevel() { + return s_request_data->data->errorReportingLevel; +} +void ExecutionContext::setErrorReportingLevel(int level) { + s_request_data->data->errorReportingLevel = level; +} +String ExecutionContext::getTimeZone() { + return s_request_data->data->timezone; +} +void ExecutionContext::setTimeZone(CStrRef timezone) { + s_request_data->data->timezone = timezone; +} +String ExecutionContext::getDefaultTimeZone() { + return s_request_data->data->timezoneDefault; +} +String ExecutionContext::getCwd() { + return s_request_data->data->cwd; +} +void ExecutionContext::setCwd(CStrRef cwd) { + s_request_data->data->cwd = cwd; +} + +/////////////////////////////////////////////////////////////////////////////// + +ExecutionContext::ExecutionContext() + : m_silencer(0), m_null("/dev/null"), m_implicitFlush(false), + m_protectedLevel(0), m_connStatus(Normal), m_transport(NULL) { + m_out = &cout; + m_err = &cerr; +} + +ExecutionContext::~ExecutionContext() { + obFlushAll(); + for (list::const_iterator iter = m_buffers.begin(); + iter != m_buffers.end(); ++iter) { + delete *iter; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// output buffers + +void ExecutionContext::obProtect(bool on) { + m_protectedLevel = on ? m_buffers.size() : 0; +} + +void ExecutionContext::obStart(CVarRef handler /* = null */) { + OutputBuffer *ob = new OutputBuffer(); + ob->handler = handler; + m_buffers.push_back(ob); + resetCurrentBuffer(); +} + +String ExecutionContext::obGetContents() { + if (m_buffers.empty()) { + return ""; + } + + // ideally we don't have to make a copy here... + return String(m_buffers.back()->oss.str()); +} + +std::string ExecutionContext::getContents() { + if (m_buffers.empty()) { + return ""; + } + return m_buffers.back()->oss.str(); +} + +int ExecutionContext::obGetContentLength() { + if (m_buffers.empty()) { + return 0; + } + return m_buffers.back()->oss.str().length(); +} + +void ExecutionContext::obClean() { + if (!m_buffers.empty()) { + m_buffers.back()->oss.str(""); + } +} + +bool ExecutionContext::obFlush() { + ASSERT(m_protectedLevel >= 0); + if ((int)m_buffers.size() > m_protectedLevel) { + list::const_iterator iter = m_buffers.end(); + OutputBuffer *last = *(--iter); + if (iter != m_buffers.begin()) { + OutputBuffer *prev = *(--iter); + if (last->handler.isNull()) { + prev->oss << last->oss.str(); + } else { + prev->oss << + f_call_user_func_array + (last->handler, + CREATE_VECTOR1(String(last->oss.str().c_str(), + AttachLiteral))).toString().data(); + } + last->oss.str(""); + return true; + } + cout << last->oss.str(); + last->oss.str(""); + } + return false; +} + +void ExecutionContext::obFlushAll() { + while (obFlush()) { obEnd();} +} + +bool ExecutionContext::obEnd() { + ASSERT(m_protectedLevel >= 0); + if ((int)m_buffers.size() > m_protectedLevel) { + delete m_buffers.back(); + m_buffers.pop_back(); + resetCurrentBuffer(); + return true; + } + return false; +} + +void ExecutionContext::obEndAll() { + while (obEnd()) {} +} + +int ExecutionContext::obGetLevel() { + ASSERT((int)m_buffers.size() >= m_protectedLevel); + return m_buffers.size() - m_protectedLevel; +} + +void ExecutionContext::obSetImplicitFlush(bool on) { + m_implicitFlush = on; +} + +Array ExecutionContext::obGetHandlers() { + Array ret; + for (list::const_iterator iter = m_buffers.begin(); + iter != m_buffers.end(); ++iter) { + ret.append((*iter)->handler); + } + return ret; +} + +void ExecutionContext::flush() { + if (RuntimeOption::EnableEarlyFlush && + (m_transport == NULL || m_transport->getHTTPVersion() == "1.1") && + !m_buffers.empty()) { + std::string content = m_buffers.front()->oss.str(); + if (!content.empty()) { + m_buffers.front()->oss.str(""); + if (m_transport) { + m_transport->sendString(content, 200, false, true); + } else { + cout << content; + fflush(stdout); + } + } + } +} + +void ExecutionContext::silenceInc() { + m_silencer++; +} + +void ExecutionContext::silenceDec() { + ASSERT(m_silencer > 0); + m_silencer--; +} + +bool ExecutionContext::isSilenced() { + return (m_silencer > 0); +} + +void ExecutionContext::resetCurrentBuffer() { + if (m_buffers.empty()) { + m_out = &cout; + } else { + m_out = &m_buffers.back()->oss; + } +} + +String ExecutionContext::getMimeType() { + String mimetype; + if (m_transport) { + mimetype = m_transport->getMimeType(); + } + + if (strncasecmp(mimetype.data(), "text/", 5) == 0) { + int pos = mimetype.find(';'); + if (pos != String::npos) { + mimetype = mimetype.substr(0, pos); + } + } else if (m_transport && m_transport->sendDefaultContentType()) { + mimetype = m_transport->getDefaultContentType(); + } + return mimetype; +} + +void ExecutionContext::setContentType(CStrRef mimetype, CStrRef charset) { + if (m_transport) { + String contentType = mimetype; + contentType += "; "; + contentType += "charset="; + contentType += charset; + m_transport->addHeader("Content-Type", contentType); + m_transport->setDefaultContentType(false); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// program executions + +void ExecutionContext::registerShutdownFunction(CVarRef function, + Array arguments, + ShutdownType type) { + Array callback = CREATE_MAP2("name", function, "args", arguments); + Variant &funcs = s_request_data->data->shutdowns.lvalAt(type); + funcs.append(callback); +} + +void ExecutionContext::registerTickFunction(CVarRef function, + Array arguments) { + Array callback = CREATE_MAP2("name", function, "args", arguments); + s_request_data->data->ticks.append(callback); + throw NotImplementedException(__func__); +} + +void ExecutionContext::unregisterTickFunction(CVarRef function) { + //s_request_data->data->ticks.remove(function); + throw NotImplementedException(__func__); +} + +Variant ExecutionContext::pushSystemExceptionHandler(CVarRef function) { + Variant ret; + RequestData::Data *data = s_request_data->data; + if (!data->systemExceptionHandlers.empty()) { + ret = data->systemExceptionHandlers.back(); + } + data->systemExceptionHandlers.push_back(function); + return ret; +} + +Variant ExecutionContext::pushUserExceptionHandler(CVarRef function) { + Variant ret; + RequestData::Data *data = s_request_data->data; + if (!data->userExceptionHandlers.empty()) { + ret = data->userExceptionHandlers.back(); + } + data->userExceptionHandlers.push_back(function); + return ret; +} + +void ExecutionContext::popSystemExceptionHandler() { + RequestData::Data *data = s_request_data->data; + if (!data->systemExceptionHandlers.empty()) { + data->systemExceptionHandlers.pop_back(); + } +} + +void ExecutionContext::popUserExceptionHandler() { + RequestData::Data *data = s_request_data->data; + if (!data->userExceptionHandlers.empty()) { + data->userExceptionHandlers.pop_back(); + } +} + +void ExecutionContext::registerRequestEventHandler +(RequestEventHandler *handler) { + ASSERT(handler); + m_requestEventHandlers.push_back(handler); +} + +static bool requestEventHandlerPriorityComp(RequestEventHandler *a, + RequestEventHandler *b) { + return a->priority() <= b->priority(); +} + +void ExecutionContext::onRequestShutdown() { + // Sort handlers by priority so that lower priority values get shutdown + // first + sort(m_requestEventHandlers.begin(), m_requestEventHandlers.end(), + requestEventHandlerPriorityComp); + for (unsigned int i = 0; i < m_requestEventHandlers.size(); i++) { + RequestEventHandler *handler = m_requestEventHandlers[i]; + ASSERT(handler->getInited()); + if (handler->getInited()) { + handler->requestShutdown(); + handler->setInited(false); + } + } + m_requestEventHandlers.clear(); +} + +void ExecutionContext::onShutdownPreSend() { + Array &funcs = s_request_data->data->shutdowns; + if (!funcs.isNull() && funcs.exists(ShutDown)) { + executeFunctions(funcs[ShutDown]); + } + obFlushAll(); // in case obStart was called without obFlush +} + +void ExecutionContext::onShutdownPostSend() { + Array &funcs = s_request_data->data->shutdowns; + if (!funcs.isNull()) { + if (funcs.exists(PostSend)) { + executeFunctions(funcs[PostSend]); + } + if (funcs.exists(CleanUp)) { + executeFunctions(funcs[CleanUp]); + } + } +} + +void ExecutionContext::onTick() { + executeFunctions(s_request_data->data->ticks); +} + +void ExecutionContext::onError(const Exception &e) { + if (RuntimeOption::AlwaysLogUnhandledExceptions) { + Logger::Log("Unhandled error: ", e); + } + int errline = 0; + String errfile; + Array backtrace; + const ExtendedException *ee = dynamic_cast(&e); + if (ee) { + ArrayPtr arr = ee->getBackTrace(); + if (arr) { + backtrace = *arr; + Array top = backtrace.rvalAt(0); + if (!top.isNull()) { + errfile = top.rvalAt("file"); + errline = top.rvalAt("line").toInt64(); + } + } + } + if (backtrace.isNull()) { + backtrace = stackTraceToBackTrace(e.getStackTrace()); + } + + RequestData::Data *data = s_request_data->data; + // For errors: if the user handler function returns FALSE then the normal + // error handler continues. Pass -1LL so that we log all the errors. + if (!data->systemExceptionHandlers.empty() && + !same(f_call_user_func_array + (data->systemExceptionHandlers.back(), + CREATE_VECTOR6(-1LL, String(e.getMessage()), errfile, errline, "", + backtrace)), + false)) { + return; + } + data->lastError = String(e.getMessage()); + + if (!RuntimeOption::AlwaysLogUnhandledExceptions) { + Logger::Log("Unhandled error: ", e); + } +} + +void ExecutionContext::onException(Object e) { + String err = e.toString(); + if (RuntimeOption::AlwaysLogUnhandledExceptions) { + Logger::Error("Unhandled exception: %s", err.data()); + } + + RequestData::Data *data = s_request_data->data; + if (e.instanceof("exception")) { + // user thrown exception + if (!data->userExceptionHandlers.empty()) { + f_call_user_func_array(data->userExceptionHandlers.back(), + CREATE_VECTOR1(e)); + return; + } + } else { + ASSERT(false); + } + data->lastError = err; + + if (!RuntimeOption::AlwaysLogUnhandledExceptions) { + Logger::Error("Unhandled exception: %s", err.data()); + } +} + +void ExecutionContext::executeFunctions(CArrRef funcs) { + for (ArrayIter iter(funcs); iter; ++iter) { + Array callback = iter.second(); + f_call_user_func_array(callback["name"], callback["args"]); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// persistent objects + +ThreadLocal g_persistentObjects; + +void PersistentObjectStore::removeObject(ResourceData *data) { + if (data) { + if (data->decRefCount() == 0) { + data->release(); + } else { + SweepableResourceData *sw = dynamic_cast(data); + if (sw) { + sw->decPersistent(); + } + } + } +} + +PersistentObjectStore::~PersistentObjectStore() { + for (ResourceMapMap::const_iterator iter = m_objects.begin(); + iter != m_objects.end(); ++iter) { + const ResourceMap &resources = iter->second; + for (ResourceMap::const_iterator iterInner = resources.begin(); + iterInner != resources.end(); ++iterInner) { + removeObject(iterInner->second); + } + } +} + +int PersistentObjectStore::size() const { + int total = 0; + for (ResourceMapMap::const_iterator iter = m_objects.begin(); + iter != m_objects.end(); ++iter) { + total += iter->second.size(); + } + return total; +} + +void PersistentObjectStore::set(const char *type, const char *name, + ResourceData *obj) { + ASSERT(type && *type); + ASSERT(name); + { + ResourceMap &resources = m_objects[type]; + ResourceMap::iterator iter = resources.find(name); + if (iter != resources.end()) { + if (iter->second == obj) { + return; // we are setting the same object + } + removeObject(iter->second); + resources.erase(iter); + } + } + if (obj) { + obj->incRefCount(); + SweepableResourceData *sw = dynamic_cast(obj); + if (sw) { + sw->incPersistent(); + } + m_objects[type][name] = obj; + } +} + +ResourceData *PersistentObjectStore::get(const char *type, const char *name) { + ASSERT(type && *type); + ASSERT(name); + ResourceMap &resources = m_objects[type]; + ResourceMap::const_iterator iter = resources.find(name); + if (iter == resources.end()) { + return NULL; + } + return iter->second; +} + +void PersistentObjectStore::remove(const char *type, const char *name) { + ASSERT(type && *type); + ASSERT(name); + ResourceMap &resources = m_objects[type]; + ResourceMap::iterator iter = resources.find(name); + if (iter != resources.end()) { + removeObject(iter->second); + resources.erase(iter); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/execution_context.h b/src/cpp/base/execution_context.h new file mode 100644 index 0000000000000..5473096534b3b --- /dev/null +++ b/src/cpp/base/execution_context.h @@ -0,0 +1,190 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_EXECUTION_CONTEXT_H__ +#define __HPHP_EXECUTION_CONTEXT_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Mainly designed for extensions to perform initialization and shutdown + * sequences at request scope. + */ +class RequestEventHandler { +public: + RequestEventHandler() : m_inited(false) {} + virtual ~RequestEventHandler() {} + + virtual void requestInit() = 0; + virtual void requestShutdown() = 0; + + void setInited(bool inited) { m_inited = inited;} + bool getInited() const { return m_inited;} + + // Priority of request shutdown call. Lower priority value means + // requestShutdown is called earlier than higher priority values. + virtual int priority() const; + +protected: + bool m_inited; +}; + +/** + * Put all global variables here so we can gather them into one thread-local + * variable for easy access. + */ +class ExecutionContext { +public: + enum ConnetionStatus { + Normal, + Aborted, + TimedOut, + }; + + enum ShutdownType { + ShutDown, + PostSend, + CleanUp, + }; + +public: + ExecutionContext(); + ~ExecutionContext(); + + /** + * Get current output buffer. + */ + std::ostream &out() { return *m_out;} + std::ostream &err() { return *m_err;} + + /** + * Output buffering. + */ + void obStart(CVarRef handler = null); + String obGetContents(); + std::string getContents(); + int obGetContentLength(); + void obClean(); + bool obFlush(); + void obFlushAll(); + bool obEnd(); + void obEndAll(); + int obGetLevel(); + void obSetImplicitFlush(bool on); + Array obGetHandlers(); + void obProtect(bool on); // making sure obEnd() never passes current level + void flush(); + + /** + * Called by '@' handling functions silenceInc/Dec() defined in + * builtin_functions.h. + */ + void silenceInc(); + void silenceDec(); + bool isSilenced(); + + /** + * Program execution hooks. + */ + void registerShutdownFunction(CVarRef function, Array arguments, + ShutdownType type); + void registerTickFunction(CVarRef function, Array arguments); + void unregisterTickFunction(CVarRef function); + Variant pushSystemExceptionHandler(CVarRef function); + Variant pushUserExceptionHandler(CVarRef function); + void popSystemExceptionHandler(); + void popUserExceptionHandler(); + + /** + * Request sequences. + */ + void registerRequestEventHandler(RequestEventHandler *handler); + void onRequestShutdown(); + + void onShutdownPreSend(); + void onShutdownPostSend(); + void onTick(); + void onError(const Exception &e); + void onException(Object e); + + String getLastError(); + int getErrorReportingLevel(); + void setErrorReportingLevel(int level); + String getTimeZone(); + void setTimeZone(CStrRef timezone); + String getDefaultTimeZone(); + String getCwd(); + void setCwd(CStrRef cwd); + + Transport *getTransport() { return m_transport;} + void setTransport(Transport *transport) { m_transport = transport;} + String getMimeType(); + void setContentType(CStrRef mimetype, CStrRef charset); + // TODO: support these features + ConnetionStatus getConnectionStatus() { return m_connStatus;} + +private: + struct OutputBuffer { + std::ostringstream oss; + Variant handler; + }; + + int m_silencer; // count for silenceInc/Dec() + std::ostream *m_err; // current error log stream + std::ostream *m_out; // current output buffer + std::list m_buffers; // a stack of output buffers + std::ofstream m_null; + bool m_implicitFlush; + int m_protectedLevel; + + std::vector m_requestEventHandlers; + ConnetionStatus m_connStatus; + Transport *m_transport; + + void resetCurrentBuffer(); + void executeFunctions(CArrRef funcs); +}; + +class PersistentObjectStore { +public: + ~PersistentObjectStore(); + + int size() const; + + void set(const char *type, const char *name, ResourceData *obj); + ResourceData *get(const char *type, const char *name); + void remove(const char *type, const char *name); + +private: + ResourceMapMap m_objects; + + void removeObject(ResourceData *data); +}; + +/////////////////////////////////////////////////////////////////////////////// + +extern ThreadLocal g_context; +extern ThreadLocal g_persistentObjects; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_EXECUTION_CONTEXT_H__ diff --git a/src/cpp/base/file/file.cpp b/src/cpp/base/file/file.cpp new file mode 100644 index 0000000000000..c38765c0c1023 --- /dev/null +++ b/src/cpp/base/file/file.cpp @@ -0,0 +1,812 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// statics + +String File::TranslatePath(CStrRef filename, bool useFileCache /* = false */) { + String canonicalized(Util::canonicalize(string(filename.data(), + filename.size()))); + + if (useFileCache) { + String translated = TranslatePath(canonicalized, false); + if (!translated.empty() && access(translated.data(), F_OK) < 0 && + StaticContentCache::TheFileCache) { + if (StaticContentCache::TheFileCache->exists(canonicalized.data(), + false)) { + // we use file cache's file name to make stat() work + translated = String(RuntimeOption::FileCache); + } + } + return translated; + } + + if (RuntimeOption::SafeFileAccess) { + for (unsigned int i = 0; i < RuntimeOption::AllowedDirectories.size(); + i++) { + string &directory = RuntimeOption::AllowedDirectories[i]; + int len = directory.size(); + if (canonicalized.length() >= len && + strncmp(canonicalized.data(), directory.data(), len) == 0) { + return canonicalized; + } + } + + // disallow access with an absolute path + if (canonicalized.charAt(0) == '/') { + return ""; + } + } + + if (canonicalized.charAt(0) == '/') { + return canonicalized; + } + + String cwd = g_context->getCwd(); + if (!cwd.empty() && cwd[cwd.length() - 1] == '/') { + return cwd + canonicalized; + } + return cwd + "/" + canonicalized; +} + +String File::TranslateCommand(CStrRef cmd) { + //TODO: security checking + return cmd; +} + +bool File::IsVirtualDirectory(CStrRef filename) { + if (StaticContentCache::TheFileCache && + StaticContentCache::TheFileCache->dirExists(filename.data(), false)) { + return true; + } + return false; +} + +Variant File::Open(CStrRef filename, CStrRef mode, + CArrRef options /* = null_array */) { + static const char http_prefix[] = "http://"; + static const char https_prefix[] = "https://"; + static const char zlib_prefix[] = "compress.zlib://"; + + if (!strncasecmp(filename.c_str(), "php://", 6)) { + if (!strcasecmp(filename.c_str(), "php://stdin")) { + return Object(NEW(PlainFile)(fdopen(dup(STDIN_FILENO), "r"))); + } + + if (!strncasecmp(filename.c_str(), "php://temp", 10) || + !strcasecmp(filename.c_str(), "php://memory")) { + TempFile *file = NEW(TempFile)(); + if (!file->valid()) return false; + return Object(file); + } + + if (!strcasecmp(filename.c_str(), "php://input")) { + Transport *transport = g_context->getTransport(); + if (transport) { + int size = 0; + const void *data = transport->getPostData(size); + if (data && size) { + return Object(NEW(MemFile)((const char *)data, size)); + } + } + return Object(NEW(MemFile)(NULL, 0)); + } + + if (!strcasecmp(filename.c_str(), "php://output")) { + return Object(NEW(OutputFile)(filename)); + } + + Logger::Error("Unable to open file %s", filename.c_str()); + return false; + } + + if (!strncmp(filename.data(), http_prefix, sizeof(http_prefix) - 1) || + !strncmp(filename.data(), https_prefix, sizeof(https_prefix) - 1)) { + UrlFile *file; + if (options.isNull()) { + file = NEW(UrlFile)(); + } else { + Array opts = options.rvalAt("http"); + String method = "GET"; + if (opts.exists("method")) method = opts["method"].toString(); + Array headers; + if (opts.exists("header")) { + headers = StringUtil::Explode(opts.rvalAt("header").toString(), + "\r\n"); + if (opts.exists("user_agent") && !headers.exists("User-Agent")) { + headers.set("User_Agent", opts.rvalAt("user_agent")); + } + } + int max_redirs = 20; + if (opts.exists("max_redirects")) + max_redirs = opts.rvalAt("max_redirects"); + int timeout = -1; + if (opts.exists("timeout")) + timeout = opts.rvalAt("timeout"); + file = NEW(UrlFile)(method.data(), headers, opts["content"].toString(), + max_redirs, timeout); + } + Object obj(file); + bool ret = file->open(filename, mode); + if (!ret) { + Logger::Verbose("%s", Util::safe_strerror(errno).c_str()); + return false; + } + return obj; + } + + bool gzipped = false; + String name = filename; + if (!strncmp(filename.data(), zlib_prefix, sizeof(zlib_prefix) - 1)) { + name = filename.substr(sizeof(zlib_prefix) - 1); + gzipped = true; + } + + // try to read from the file cache first + if (StaticContentCache::TheFileCache) { + string relative = + FileCache::GetRelativePath(File::TranslatePath(name).c_str()); + MemFile *file = NEW(MemFile)(); + Object obj(file); + bool ret = file->open(relative, mode); + if (ret) { + if (gzipped) { + file->unzip(); + } + return obj; + } + } + + if (gzipped) { + ZipFile *file = NEW(ZipFile)(); + Object obj(file); + bool ret = file->open(File::TranslatePath(name), mode); + if (!ret) { + Logger::Verbose("%s", Util::safe_strerror(errno).c_str()); + return false; + } + return obj; + } + + PlainFile *file = NEW(PlainFile)(); + Object obj(file); + bool ret = file->open(File::TranslatePath(name), mode); + if (!ret) { + Logger::Verbose("%s", Util::safe_strerror(errno).c_str()); + return false; + } + return obj; +} + +/////////////////////////////////////////////////////////////////////////////// +// constructor and destructor + +File::File(bool pipe) + : m_fd(-1), m_closed(false), m_pipe(pipe), m_writepos(0), + m_readpos(0), m_position(0), m_buffer(NULL) { +} + +File::~File() { + closeImpl(); +} + +void File::closeImpl() { + if (m_buffer) { + free(m_buffer); + m_buffer = NULL; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// default implementation of virtual functions + +int File::getc() { + if (m_writepos > m_readpos) { + m_position++; + return m_buffer[m_readpos++] & 0xff; + } + + char buffer[1]; + int len = readImpl(buffer, 1); + if (len != 1) { + return EOF; + } + m_position += len; + return (int)(unsigned char)buffer[0]; +} + +String File::read(int length) { + if (length <= 0) { + throw InvalidArgumentException("length", length); + } + + char *ret = (char *)malloc(length + 1); + int copied = 0; + int avail = m_writepos - m_readpos; + + while (avail < length && !eof()) { + if (m_buffer == NULL) { + m_buffer = (char *)malloc(CHUNK_SIZE); + } + + if (avail > 0) { + memcpy(ret + copied, m_buffer + m_readpos, avail); + copied += avail; + length -= avail; + } + + m_writepos = readImpl(m_buffer, CHUNK_SIZE); + m_readpos = 0; + avail = m_writepos - m_readpos; + + if (avail == 0 || m_pipe) { + // For nonblocking mode, temporary out of data. + break; + } + } + + avail = m_writepos - m_readpos; + if (avail > 0) { + int n = length < avail ? length : avail; + memcpy(ret + copied, m_buffer + m_readpos, n); + m_readpos += n; + copied += n; + } + + m_position += copied; + ret[copied] = '\0'; + return String(ret, copied, AttachString); +} + +int File::write(CStrRef data, int length /* = 0 */) { + if (length <= 0 || length > data.size()) { + length = data.size(); + } + if (length) { + return writeImpl(data.data(), length); + } + return 0; +} + +bool File::seek(int offset, int whence /* = SEEK_SET */) { + if (whence != SEEK_CUR) { + throw NotSupportedException(__func__, "cannot seek other than SEEK_CUR"); + } + if (offset < 0) { + throw NotSupportedException(__func__, "cannot seek backwards"); + } + if (offset > 0) { + int avail = m_writepos - m_readpos; + ASSERT(avail >= 0); + if (avail >= offset) { + m_readpos += offset; + return true; + } + if (avail > 0) { + m_readpos += avail; + offset -= avail; + } + + while (offset) { + char tmp[1024]; + int nread = offset > (int)sizeof(tmp) ? (int)sizeof(tmp) : offset; + nread = readImpl(tmp, nread); + if (nread <= 0) { + return false; + } + offset -= nread; + } + } + return true; +} + +int File::tell() { + throw NotSupportedException(__func__, "cannot tell"); +} + +bool File::eof() { + throw NotSupportedException(__func__, "cannot test eof"); +} + +bool File::rewind() { + throw NotSupportedException(__func__, "cannot rewind"); +} + +bool File::flush() { + return true; +} + +bool File::truncate(int size) { + throw NotSupportedException(__func__, "cannot truncate"); +} + +bool File::lock(int operation) { + bool b = false; + return lock(operation, b); +} + +bool File::lock(int operation, bool &wouldblock /* = false */) { + ASSERT(m_fd >= 0); + + if ((operation & 3) == 0) { + throw InvalidArgumentException("operation", operation); + } + + wouldblock = false; + if (flock(m_fd, operation)) { + if (errno == EWOULDBLOCK) { + wouldblock = true; + } + return false; + } + return true; +} + +Array File::getMetaData() { + Array ret = Array::Create(); + ret.set("eof", eof()); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// utility functions + +String File::readLine(int maxlen /* = 0 */) { + size_t current_buf_size = 0; + size_t total_copied = 0; + char *ret = NULL; + for (;;) { + int avail = m_writepos - m_readpos; + if (avail > 0) { + int cpysz = 0; + bool done = false; + + char *readptr = m_buffer + m_readpos; + const char *eol; + const char *cr; + const char *lf; + cr = (const char *)memchr(readptr, '\r', avail); + lf = (const char *)memchr(readptr, '\n', avail); + if (cr && lf != cr + 1 && !(lf && lf < cr)) { + /* mac */ + eol = cr; + } else if ((cr && lf && cr == lf - 1) || (lf)) { + /* dos or unix endings */ + eol = lf; + } else { + eol = cr; + } + + if (eol) { + cpysz = eol - readptr + 1; + done = true; + } else { + cpysz = avail; + } + if (maxlen > 0 && maxlen <= cpysz) { + cpysz = maxlen; + done = true; + } + + current_buf_size += cpysz + 1; + if (ret) { + ret = (char *)realloc(ret, current_buf_size); + } else { + ret = (char *)malloc(current_buf_size); + } + memcpy(ret + total_copied, readptr, cpysz); + + m_position += cpysz; + m_readpos += cpysz; + maxlen -= cpysz; + total_copied += cpysz; + + if (done) { + break; + } + } else if (eof()) { + break; + } else { + if (m_buffer == NULL) { + m_buffer = (char *)malloc(CHUNK_SIZE); + } + m_writepos = readImpl(m_buffer, CHUNK_SIZE); + m_readpos = 0; + if (m_writepos - m_readpos == 0) { + break; + } + } + } + + if (total_copied == 0) { + ASSERT(ret == NULL); + return String(); + } + + ret[total_copied] = '\0'; + return String(ret, total_copied, AttachString); +} + +String File::readRecord(CStrRef delimiter, int maxlen /* = 0 */) { + if (maxlen <= 0 || maxlen > CHUNK_SIZE) { + maxlen = CHUNK_SIZE; + } + + int avail = m_writepos - m_readpos; + if (m_buffer == NULL) { + m_buffer = (char *)malloc(CHUNK_SIZE * 2); + } + if (avail < maxlen) { + m_writepos = readImpl(m_buffer + m_readpos, maxlen - avail); + maxlen = m_writepos - m_readpos; + } + if (m_readpos >= CHUNK_SIZE) { + memcpy(m_buffer, m_buffer + m_readpos, m_writepos - m_readpos); + m_readpos = 0; + m_writepos -= m_readpos; + } + + int toread; + const char *e; + bool skip = false; + if (delimiter.empty()) { + toread = maxlen; + } else { + if (delimiter.size() == 1) { + e = (const char *)memchr(m_buffer + m_readpos, delimiter.charAt(0), + m_writepos - m_readpos); + } else { + int pos = string_find(m_buffer + m_readpos, m_writepos - m_readpos, + delimiter.data(), delimiter.size(), 0, true); + if (pos >= 0) { + e = m_buffer + m_readpos + pos; + } else { + e = NULL; + } + } + + if (!e) { + toread = maxlen; + } else { + toread = e - m_buffer - m_readpos; + skip = true; + } + } + + if (toread > maxlen && maxlen > 0) { + toread = maxlen; + } + + if (toread >= 0) { + char *buf = (char *)malloc(toread + 1); + if (toread) { + memcpy(buf, m_buffer + m_readpos, toread); + } + + m_readpos += toread; + if (skip) { + m_readpos += delimiter.size(); + m_position += delimiter.size(); + } + buf[toread] = '\0'; + return String(buf, toread, AttachString); + } + + return String(); +} + +int File::print() { + int total = 0; + while (true) { + char buffer[1024]; + int len = readImpl(buffer, 1024); + if (len == 0) break; + total += len; + g_context->out().write(buffer, len); + } + return total; +} + +int File::printf(CStrRef format, CArrRef args) { + int len = 0; + char *output = string_printf(format.data(), format.size(), args, &len); + return write(String(output, len, AttachString)); +} + +/////////////////////////////////////////////////////////////////////////////// +// csv functions + +int File::writeCSV(CArrRef fields, char delimiter_char /* = ',' */, + char enclosure_char /* = '"' */) { + int line = 0; + int count = fields.size(); + const char escape_char = '\\'; + StringBuffer csvline(1024); + + for (ArrayIter iter(fields); iter; ++iter) { + String value = iter.second().toString(); + bool need_enclosure = false; + for (int i = 0; i < value.size(); i++) { + char ch = value.charAt(i); + if (ch == delimiter_char || ch == enclosure_char || ch == escape_char || + ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ') { + need_enclosure = true; + break; + } + } + if (need_enclosure) { + csvline.append(enclosure_char); + const char *ch = value.data(); + const char *end = ch + value.size(); + bool escaped = false; + while (ch < end) { + if (*ch == escape_char) { + escaped = true; + } else if (!escaped && *ch == enclosure_char) { + csvline.append(enclosure_char); + } else { + escaped = false; + } + csvline.append(*ch); + ch++; + } + csvline.append(enclosure_char); + } else { + csvline.append(value); + } + + if (++line != count) { + csvline.append(delimiter_char); + } + } + csvline.append('\n'); + + return write(csvline); +} + +static const char *lookup_trailing_spaces(const char *ptr, int len) { + if (len > 0) { + ptr += len; + switch (*(ptr - 1)) { + case '\n': + if (len > 1 && *(ptr - 2) == '\r') { + return ptr - 2; + } + /* break is omitted intentionally */ + case '\r': + return ptr - 1; + } + } + return ptr; +} + +Array File::readCSV(int length /* = 0 */, char delimiter_char /* = ',' */, + char enclosure_char /* = '"' */) { + String line = readLine(length); + if (line.empty()) { + return Array(); + } + + String new_line; + const char *buf = line.data(); + int buf_len = line.size(); + + char *temp, *tptr, *line_end, *limit; + const char *bptr; + const char escape_char = '\\'; + + int temp_len, line_end_len; + + /* Now into new section that parses buf for delimiter/enclosure fields */ + + /* Strip trailing space from buf, saving end of line in case required + for enclosure field */ + bptr = buf; + tptr = (char *)lookup_trailing_spaces(buf, buf_len); + line_end_len = buf_len - (size_t)(tptr - buf); + line_end = limit = tptr; + + /* reserve workspace for building each individual field */ + temp_len = buf_len; + temp = (char *)malloc(temp_len + line_end_len + 1); + + /* Initialize return array */ + Array ret; + + /* Main loop to read CSV fields */ + /* NB this routine will return a single null entry for a blank line */ + do { + char *comp_end; + const char *hunk_begin; + + tptr = temp; + + /* 1. Strip any leading space */ + for (; bptr < limit; ++bptr) { + if (!isspace((int)*(unsigned char *)bptr) || *bptr == delimiter_char) { + break; + } + } + + /* 2. Read field, leaving bptr pointing at start of next field */ + if (bptr < limit && *bptr == enclosure_char) { + int state = 0; + + bptr++; /* move on to first character in field */ + hunk_begin = bptr; + + /* 2A. handle enclosure delimited field */ + + int inc_len = 1; + for (;;) { + switch (inc_len) { + case 0: + switch (state) { + case 2: + memcpy(tptr, hunk_begin, bptr - hunk_begin - 1); + tptr += (bptr - hunk_begin - 1); + hunk_begin = bptr; + goto quit_loop_2; + + case 1: + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + hunk_begin = bptr; + /* break is omitted intentionally */ + case 0: + { + if (hunk_begin != line_end) { + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + hunk_begin = bptr; + } + /* add the embedded line end to the field */ + memcpy(tptr, line_end, line_end_len); + tptr += line_end_len; + + new_line = readLine(length); + const char *new_buf = new_line.data(); + int new_len = new_line.size(); + if (new_len == 0) { + /* we've got an unterminated enclosure, + * assign all the data from the start of + * the enclosure to end of data to the + * last element */ + if ((size_t)temp_len > (size_t)(limit - buf)) { + goto quit_loop_2; + } + return ret; + } + temp_len += new_len; + char *new_temp = (char*)realloc(temp, temp_len); + tptr = new_temp + (size_t)(tptr - temp); + temp = new_temp; + + buf_len = new_len; + bptr = buf = new_buf; + hunk_begin = buf; + + line_end = limit = (char *)lookup_trailing_spaces(buf, buf_len); + line_end_len = buf_len - (size_t)(limit - buf); + state = 0; + } + break; + } + break; + case 1: + /* we need to determine if the enclosure is + * 'real' or is it escaped */ + switch (state) { + case 1: /* escaped */ + bptr++; + state = 0; + break; + case 2: /* embedded enclosure ? let's check it */ + if (*bptr != enclosure_char) { + /* real enclosure */ + memcpy(tptr, hunk_begin, bptr - hunk_begin - 1); + tptr += (bptr - hunk_begin - 1); + hunk_begin = bptr; + goto quit_loop_2; + } + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + bptr++; + hunk_begin = bptr; + state = 0; + break; + default: + if (*bptr == escape_char) { + state = 1; + } else if (*bptr == enclosure_char) { + state = 2; + } + bptr++; + break; + } + break; + } + inc_len = (bptr < limit ? 1 : 0); + } + + quit_loop_2: + /* look up for a delimiter */ + for (; bptr < limit; ++bptr) { + if (*bptr == delimiter_char) { + break; + } + } + + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + if (bptr < limit) ++bptr; + comp_end = tptr; + } else { + /* 2B. Handle non-enclosure field */ + + hunk_begin = bptr; + + for (; bptr < limit; ++bptr) { + if (*bptr == delimiter_char) { + break; + } + } + memcpy(tptr, hunk_begin, bptr - hunk_begin); + tptr += (bptr - hunk_begin); + + comp_end = (char *)lookup_trailing_spaces(temp, tptr - temp); + if (*bptr == delimiter_char) { + bptr++; + } + } + + /* 3. Now pass our field back to php */ + *comp_end = '\0'; + ret.append(String(temp, comp_end - temp, CopyString)); + } while (bptr < limit); + + free(temp); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/file/file.h b/src/cpp/base/file/file.h new file mode 100644 index 0000000000000..6f30516f617f3 --- /dev/null +++ b/src/cpp/base/file/file.h @@ -0,0 +1,143 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_FILE_H__ +#define __HPHP_FILE_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * This is PHP's "stream", base class of plain file, gzipped file, directory + * and sockets. We are not going to structure directories this way at all, + * but we will have PlainFile, ZipFile and Socket derive from this base class, + * so they can share some minimal functionalities. + */ +class File : public SweepableResourceData { +public: + static String TranslatePath(CStrRef filename, bool useFileCache = false); + static String TranslateCommand(CStrRef cmd); + static Variant Open(CStrRef filename, CStrRef mode, + CArrRef options = null_array); + + static bool IsVirtualDirectory(CStrRef filename); + +public: + File(bool pipe = false); + virtual ~File(); + + // overriding ResourceData + const char *o_getClassName() const { return "File";} + const char *o_getResourceName() const { return "stream";} + int o_getResourceId() const { + // This is different from Zend where each resource is assigned a unique id. + return o_id; + } + + int fd() const { return m_fd;} + bool valid() const { return m_fd >= 0;} + + /** + * How to open this type of file. + */ + virtual bool open(CStrRef filename, CStrRef mode) = 0; + + /** + * How to close this type of file. + */ + virtual bool close() = 0; + + /** + * Read one chunk of input. Returns a null string on failure or eof. + */ + virtual int readImpl(char *buffer, int length) = 0; + virtual int getc(); + virtual String read(int length = 0); + + /** + * Write one chunk of output. Returns bytes written. + */ + virtual int writeImpl(const char *buffer, int length) = 0; + virtual int write(CStrRef str, int length = 0); + + /** + * Optional virtual functions to implement. + */ + virtual bool seek(int offset, int whence = SEEK_SET); + virtual int tell(); + virtual bool eof(); + virtual bool rewind(); + virtual bool flush(); + virtual bool truncate(int size); + virtual bool lock(int operation); + virtual bool lock(int operation, bool &wouldblock); + virtual Array getMetaData(); + + /** + * Read one line a time. Returns a null string on failure or eof. + */ + String readLine(int maxlen = 0); + + /** + * Read one record a time. Returns a null string on failure or eof. + */ + String readRecord(CStrRef delimiter, int maxlen = 0); + + /** + * Read entire file and print it out. + */ + int print(); + + /** + * Write to file with specified format and arguments. + */ + int printf(CStrRef format, CArrRef args); + + /** + * Write one line of csv record. + */ + int writeCSV(CArrRef fields, char delimiter = ',', char enclosure = '"'); + + /** + * Read one line of csv record. + */ + Array readCSV(int length = 0, char delimiter = ',', char enclosure = '"'); + +protected: + int m_fd; // file descriptor + bool m_closed; // whether close() was called + bool m_pipe; + + // fields only useful for buffered reads + int m_writepos; // where we have read from lower level + int m_readpos; // where we have given to upper level + int m_position; // the current cursor position + + void closeImpl(); + +private: + static const int CHUNK_SIZE = 8192; + char *m_buffer; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_FILE_H__ diff --git a/src/cpp/base/file/mem_file.cpp b/src/cpp/base/file/mem_file.cpp new file mode 100644 index 0000000000000..5d74d65ba9cfa --- /dev/null +++ b/src/cpp/base/file/mem_file.cpp @@ -0,0 +1,173 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION(MemFile); +/////////////////////////////////////////////////////////////////////////////// + +MemFile::MemFile() + : m_data(NULL), m_len(-1), m_cursor(0), m_malloced(false) { +} + +MemFile::MemFile(const char *data, int len) + : m_data(NULL), m_len(len), m_cursor(0), m_malloced(true) { + m_data = (char*)malloc(len + 1); + if (m_data && len) { + memcpy(m_data, data, len); + } + m_data[len] = '\0'; +} + +MemFile::~MemFile() { + closeImpl(); +} + +bool MemFile::open(CStrRef filename, CStrRef mode) { + ASSERT(m_len == -1); + // mem files are read-only + if (strchr(mode, '+') || strchr(mode, 'a') || strchr(mode, 'w')) { + return false; + } + int len = -1; + bool compressed = false; + char *data = + StaticContentCache::TheFileCache->read(filename.c_str(), len, compressed); + if (len != -1) { + m_name = filename; + m_data = data; + m_len = len; + return true; + } + return false; +} + +bool MemFile::close() { + return closeImpl(); +} + +bool MemFile::closeImpl() { + m_closed = true; + if (m_malloced && m_data) { + free(m_data); + m_data = NULL; + } + File::closeImpl(); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +int MemFile::readImpl(char *buffer, int length) { + ASSERT(m_len != -1); + ASSERT(length > 0); + int remaining = m_len - m_cursor; + if (remaining < length) length = remaining; + if (length > 0) { + memcpy(buffer, (const void *)(m_data + m_cursor), length); + } + m_cursor += length; + return length; +} + +int MemFile::getc() { + ASSERT(m_len != -1); + return File::getc(); +} + +bool MemFile::seek(int offset, int whence /* = SEEK_SET */) { + ASSERT(m_len != -1); + if (whence == SEEK_CUR) { + if (offset > 0 && offset < m_writepos - m_readpos) { + m_readpos += offset; + m_position += offset; + return true; + } + offset += m_position; + whence = SEEK_SET; + } + + // invalidate the current buffer + m_writepos = 0; + m_readpos = 0; + if (whence == SEEK_SET) { + m_cursor = offset; + } else { + ASSERT(whence == SEEK_END); + m_cursor = m_len + offset; + } + m_position = m_cursor; + return true; +} + +int MemFile::tell() { + ASSERT(m_len != -1); + return m_position; +} + +bool MemFile::eof() { + ASSERT(m_len != -1); + int avail = m_writepos - m_readpos; + if (avail > 0) { + return false; + } + return m_cursor == m_len; +} + +bool MemFile::rewind() { + ASSERT(m_len != -1); + m_cursor = 0; + m_writepos = 0; + m_readpos = 0; + m_position = 0; + return true; +} + +int MemFile::writeImpl(const char *buffer, int length) { + throw FatalErrorException((string("cannot write a mem stream: ") + + m_name).c_str()); +} + +bool MemFile::flush() { + throw FatalErrorException((string("cannot flush a mem stream: ") + + m_name).c_str()); +} + +/////////////////////////////////////////////////////////////////////////////// + +void MemFile::unzip() { + ASSERT(m_len != -1); + ASSERT(!m_malloced); + ASSERT(m_cursor == 0); + char *data = gzdecode(m_data, m_len); + if (data == NULL) { + throw FatalErrorException((string("cannot unzip mem stream: ") + + m_name).c_str()); + } + m_data = data; + m_malloced = true; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/file/mem_file.h b/src/cpp/base/file/mem_file.h new file mode 100644 index 0000000000000..2da1fa1dd9f2e --- /dev/null +++ b/src/cpp/base/file/mem_file.h @@ -0,0 +1,66 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_MEM_FILE_H__ +#define __HPHP_MEM_FILE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * memory based files. + */ +class MemFile : public File { +public: + DECLARE_OBJECT_ALLOCATION(MemFile); + + MemFile(); + MemFile(const char *data, int len); + virtual ~MemFile(); + + // overriding ResourceData + const char *o_getClassName() const { return "MemFile";} + + virtual bool open(CStrRef filename, CStrRef mode); + virtual bool close(); + virtual int readImpl(char *buffer, int length); + virtual int getc(); + virtual int writeImpl(const char *buffer, int length); + virtual bool seek(int offset, int whence = SEEK_SET); + virtual int tell(); + virtual bool eof(); + virtual bool rewind(); + virtual bool flush(); + + void unzip(); + +protected: + std::string m_name; // name of the memory file + char *m_data; // data of the memory file + int m_len; // length of the memory file + int m_cursor; // m_data's read position + bool m_malloced; // whether to free m_data on delete + + bool closeImpl(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_MEM_FILE_H__ diff --git a/src/cpp/base/file/output_file.cpp b/src/cpp/base/file/output_file.cpp new file mode 100644 index 0000000000000..d7a0212941f32 --- /dev/null +++ b/src/cpp/base/file/output_file.cpp @@ -0,0 +1,107 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION(OutputFile); +/////////////////////////////////////////////////////////////////////////////// +// constructor and destructor + +OutputFile::OutputFile(CStrRef filename) { + if (filename != "php://output") { + throw FatalErrorException("not a php://output file "); + } +} + +OutputFile::~OutputFile() { + closeImpl(); +} + +bool OutputFile::open(CStrRef filename, CStrRef mode) { + throw FatalErrorException("cannot open a php://output file "); +} + +bool OutputFile::close() { + return closeImpl(); +} + +bool OutputFile::closeImpl() { + if (!m_closed) { + m_closed = true; + return true; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// virtual functions + +int OutputFile::readImpl(char *buffer, int length) { + Logger::Error("cannot read from a php://output stream"); + return -1; +} + +int OutputFile::getc() { + Logger::Error("cannot read from a php://output stream"); + return -1; +} + +int OutputFile::writeImpl(const char *buffer, int length) { + ASSERT(length > 0); + if (m_closed) return 0; + g_context->out().write(buffer, length); + return length; +} + +bool OutputFile::seek(int offset, int whence /* = SEEK_SET */) { + Logger::Error("cannot seek a php://output stream"); + return false; +} + +int OutputFile::tell() { + Logger::Error("cannot tell a php://output stream"); + return -1; +} + +bool OutputFile::eof() { + return false; +} + +bool OutputFile::rewind() { + Logger::Error("cannot rewind a php://output stream"); + return false; +} + +bool OutputFile::flush() { + if (!m_closed) { + (g_context->out()).flush(); + return true; + } + return false; +} + +bool OutputFile::truncate(int size) { + Logger::Error("cannot truncate a php://output stream"); + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/file/output_file.h b/src/cpp/base/file/output_file.h new file mode 100644 index 0000000000000..d10b576548b87 --- /dev/null +++ b/src/cpp/base/file/output_file.h @@ -0,0 +1,60 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_OUTPUT_FILE_H__ +#define __HPHP_OUTPUT_FILE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * For php://output, a simple wrapper of g_context->out(). + */ +class OutputFile : public File { +public: + DECLARE_OBJECT_ALLOCATION(OutputFile); + + OutputFile(CStrRef filename); + virtual ~OutputFile(); + + bool valid() const { return !m_closed;} + + // overriding ResourceData + const char *o_getClassName() const { return "OutputFile";} + + // implementing File + virtual bool open(CStrRef filename, CStrRef mode); + virtual bool close(); + virtual int readImpl(char *buffer, int length); + virtual int getc(); + virtual int writeImpl(const char *buffer, int length); + virtual bool seek(int offset, int whence = SEEK_SET); + virtual int tell(); + virtual bool eof(); + virtual bool rewind(); + virtual bool flush(); + virtual bool truncate(int size); + +protected: + bool closeImpl(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_OUTPUT_FILE_H__ diff --git a/src/cpp/base/file/pipe.cpp b/src/cpp/base/file/pipe.cpp new file mode 100644 index 0000000000000..f3e9a5c4fb90e --- /dev/null +++ b/src/cpp/base/file/pipe.cpp @@ -0,0 +1,63 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION(Pipe); +/////////////////////////////////////////////////////////////////////////////// + +Pipe::Pipe() { +} + +Pipe::~Pipe() { + closeImpl(); +} + +bool Pipe::open(CStrRef filename, CStrRef mode) { + ASSERT(m_stream == NULL); + ASSERT(m_fd == -1); + + FILE *f = LightProcess::popen(filename.data(), mode.data()); + if (!f) { + return false; + } + m_stream = f; + m_fd = fileno(f); + return true; +} + +bool Pipe::close() { + return closeImpl(); +} + +bool Pipe::closeImpl() { + bool ret = true; + if (!m_closed) { + ASSERT(m_stream); + ret = (LightProcess::pclose(m_stream) == 0); + m_closed = true; + m_stream = NULL; + } + File::closeImpl(); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/file/pipe.h b/src/cpp/base/file/pipe.h new file mode 100644 index 0000000000000..e3c449b377aca --- /dev/null +++ b/src/cpp/base/file/pipe.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_PIPE_H__ +#define __HPHP_PIPE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Wrapper around popen/pclose. + */ +class Pipe : public PlainFile { +public: + DECLARE_OBJECT_ALLOCATION(Pipe); + + Pipe(); + virtual ~Pipe(); + + // overriding ResourceData + const char *o_getClassName() const { return "Pipe";} + + // implementing File + virtual bool open(CStrRef filename, CStrRef mode); + virtual bool close(); + +private: + bool closeImpl(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_PIPE_H__ diff --git a/src/cpp/base/file/plain_file.cpp b/src/cpp/base/file/plain_file.cpp new file mode 100644 index 0000000000000..145790e9a6103 --- /dev/null +++ b/src/cpp/base/file/plain_file.cpp @@ -0,0 +1,189 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION(PlainFile); + +/////////////////////////////////////////////////////////////////////////////// +// constructor and destructor + +PlainFile::PlainFile(FILE *stream, bool pipe) + : File(pipe), m_stream(stream), m_eof(false) { + if (stream) m_fd = fileno(stream); +} + +PlainFile::~PlainFile() { + closeImpl(); +} + +bool PlainFile::open(CStrRef filename, CStrRef mode) { + ASSERT(m_stream == NULL); + ASSERT(m_fd == -1); + + FILE *f = fopen(filename.data(), mode.data()); + if (!f) { + return false; + } + m_stream = f; + m_fd = fileno(f); + return true; +} + +bool PlainFile::close() { + return closeImpl(); +} + +bool PlainFile::closeImpl() { + bool ret = true; + if (!m_closed) { + if (m_stream) { + ret = (fclose(m_stream) == 0); + } + m_closed = true; + m_stream = NULL; + } + File::closeImpl(); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// virtual functions + +int PlainFile::readImpl(char *buffer, int length) { + ASSERT(m_stream); + ASSERT(length > 0); + // use read instead of fread to handle EOL in stdin + size_t ret = ::read(m_fd, buffer, length); + if (ret == 0 + || (ret == (size_t)-1 + && errno != EWOULDBLOCK && errno != EINTR && errno != EBADF)) { + m_eof = true; + } + return ret == (size_t)-1 ? 0 : ret; +} + +int PlainFile::getc() { + ASSERT(m_stream); + return File::getc(); +} + +int PlainFile::writeImpl(const char *buffer, int length) { + ASSERT(m_stream); + ASSERT(length > 0); + + // use write instead of fwrite to be consistent with read + // o.w., read-and-write files would not work + int written = ::write(m_fd, buffer, length); + return written < 0 ? 0 : written; +} + +bool PlainFile::seek(int offset, int whence /* = SEEK_SET */) { + ASSERT(m_stream); + + if (whence == SEEK_CUR) { + if (offset > 0 && offset < m_writepos - m_readpos) { + m_readpos += offset; + m_position += offset; + return true; + } + offset += m_position; + whence = SEEK_SET; + } + + // invalidate the current buffer + m_writepos = 0; + m_readpos = 0; + // clear the eof flag + m_eof = false; + // lseek instead of seek to be consistent with read + off_t result = lseek(m_fd, offset, whence); + m_position = result; + return result != (off_t)-1; +} + +int PlainFile::tell() { + ASSERT(m_stream); + return m_position; +} + +bool PlainFile::eof() { + ASSERT(m_stream); + int avail = m_writepos - m_readpos; + if (avail > 0) { + return false; + } + return m_eof; +} + +bool PlainFile::rewind() { + ASSERT(m_stream); + seek(0); + m_writepos = 0; + m_readpos = 0; + m_position = 0; + return true; +} + +bool PlainFile::flush() { + ASSERT(m_stream); + return fflush(m_stream) == 0; +} + +bool PlainFile::truncate(int size) { + ASSERT(m_stream); + return ftruncate(fileno(m_stream), size) == 0; +} + +/////////////////////////////////////////////////////////////////////////////// +// BuiltinFiles + +RequestLocal g_builtin_files; + +void BuiltinFiles::requestShutdown() { + m_stdin.reset(); + m_stdout.reset(); + m_stderr.reset(); +} + +CVarRef BuiltinFiles::getSTDIN() { + if (g_builtin_files->m_stdin.isNull()) { + g_builtin_files->m_stdin = NEW(PlainFile)(stdin); + } + return g_builtin_files->m_stdin; +} + +CVarRef BuiltinFiles::getSTDOUT() { + if (g_builtin_files->m_stdout.isNull()) { + g_builtin_files->m_stdout = NEW(PlainFile)(stdout); + } + return g_builtin_files->m_stdout; +} + +CVarRef BuiltinFiles::getSTDERR() { + if (g_builtin_files->m_stderr.isNull()) { + g_builtin_files->m_stderr = NEW(PlainFile)(stderr); + } + return g_builtin_files->m_stderr; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/file/plain_file.h b/src/cpp/base/file/plain_file.h new file mode 100644 index 0000000000000..96036011ee427 --- /dev/null +++ b/src/cpp/base/file/plain_file.h @@ -0,0 +1,91 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_PLAIN_FILE_H__ +#define __HPHP_PLAIN_FILE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#define STDIN (BuiltinFiles::getSTDIN()) +#define STDOUT (BuiltinFiles::getSTDOUT()) +#define STDERR (BuiltinFiles::getSTDERR()) + +/** + * A file system file that's nothing but ordinary. A simple FILE* wrapper. + */ +class PlainFile : public File { +public: + DECLARE_OBJECT_ALLOCATION(PlainFile); + + PlainFile(FILE *stream = NULL, bool pipe = false); + virtual ~PlainFile(); + + // overriding ResourceData + const char *o_getClassName() const { return "PlainFile";} + + // implementing File + virtual bool open(CStrRef filename, CStrRef mode); + virtual bool close(); + virtual int readImpl(char *buffer, int length); + virtual int getc(); + virtual int writeImpl(const char *buffer, int length); + virtual bool seek(int offset, int whence = SEEK_SET); + virtual int tell(); + virtual bool eof(); + virtual bool rewind(); + virtual bool flush(); + virtual bool truncate(int size); + + FILE *getStream() { return m_stream;} + + static CVarRef getStdIn(); + static CVarRef getStdOut(); + static CVarRef getStdErr(); + +protected: + FILE *m_stream; + bool m_eof; + + bool closeImpl(); +}; + +/** + * A request-local wrapper for the three standard files: + * STDIN, STDOUT, and STDERR. + */ +class BuiltinFiles : public RequestEventHandler { +public: + virtual void requestInit() { } + virtual void requestShutdown(); + + static CVarRef getSTDIN(); + static CVarRef getSTDOUT(); + static CVarRef getSTDERR(); + +private: + Variant m_stdin; + Variant m_stdout; + Variant m_stderr; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_PLAIN_FILE_H__ diff --git a/src/cpp/base/file/socket.cpp b/src/cpp/base/file/socket.cpp new file mode 100644 index 0000000000000..400047bb4f271 --- /dev/null +++ b/src/cpp/base/file/socket.cpp @@ -0,0 +1,145 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// constructors and destructor + +Socket::Socket() + : File(true), m_type(-1), m_error(0), m_eof(false), m_timeout(0), + m_timedOut(false), m_bytesSent(0) { +} + +Socket::Socket(int sockfd, int type) + : File(true), m_type(type), m_error(0), m_eof(false), m_timeout(0), + m_timedOut(false), m_bytesSent(0) { + m_fd = sockfd; + + struct timeval tv; + tv.tv_sec = RuntimeOption::SocketDefaultTimeout; + tv.tv_usec = 0; + setsockopt(m_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); + setsockopt(m_fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)); + setTimeout(tv); +} + +Socket::~Socket() { + closeImpl(); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Socket::open(CStrRef filename, CStrRef mode) { + throw NotSupportedException(__func__, "cannot open socket this way"); +} + +bool Socket::close() { + return closeImpl(); +} + +bool Socket::closeImpl() { + if (valid() && !m_closed) { + ::close(m_fd); + m_closed = true; + } + File::closeImpl(); + return true; +} + +void Socket::setTimeout(struct timeval &tv) { + if (tv.tv_sec >= 0 && tv.tv_usec >= 0) { + m_timeout = tv.tv_sec * 1000000 + tv.tv_usec; + } else { + m_timeout = 0; + } +} + +bool Socket::waitForData() { + m_timedOut = false; + while (true) { + struct pollfd fds[1]; + fds[0].fd = m_fd; + fds[0].events = POLLIN|POLLERR|POLLHUP; + if (poll(fds, 1, m_timeout / 1000)) { + socklen_t lon = sizeof(int); + int valopt; + getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon); + if (valopt == EINTR) continue; + return valopt == 0; + } else { + m_timedOut = true; + break; + } + } + return false; +} + +int Socket::readImpl(char *buffer, int length) { + ASSERT(m_fd); + ASSERT(length > 0); + + int recvFlags = 0; + if (m_timeout > 0) { + int flags = fcntl(m_fd, F_GETFL, 0); + if ((flags & O_NONBLOCK) == 0) { + if (!waitForData()) { + m_eof = true; + return 0; + } + recvFlags = MSG_DONTWAIT; // polled, so no need to wait any more + } + } + + int ret = recv(m_fd, buffer, length, recvFlags); + if (ret == 0 || (ret == -1 && errno != EWOULDBLOCK)) { + m_eof = true; + } + return (ret < 0) ? 0 : ret; +} + +int Socket::writeImpl(const char *buffer, int length) { + ASSERT(m_fd); + ASSERT(length > 0); + m_eof = false; + int ret = send(m_fd, buffer, length, 0); + if (ret >= 0) + m_bytesSent += ret; + return ret; +} + +bool Socket::eof() { + return m_eof; +} + +Array Socket::getMetaData() { + Array ret = File::getMetaData(); + ret.set("timed_out", m_timedOut); + return ret; +} + +int Socket::tell() { + return m_bytesSent; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/file/socket.h b/src/cpp/base/file/socket.h new file mode 100644 index 0000000000000..a4cec2ea8f48a --- /dev/null +++ b/src/cpp/base/file/socket.h @@ -0,0 +1,76 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SOCKET_H__ +#define __HPHP_SOCKET_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * TCP/UDP sockets. + */ +class Socket : public File { +public: + // We cannot use object allocation for this class, because + // we need to support pfsockopen() that can make a socket persistent. + + Socket(); + Socket(int sockfd, int type); + virtual ~Socket(); + + // overriding ResourceData + const char *o_getClassName() const { return "Socket";} + + // implementing File + virtual bool open(CStrRef filename, CStrRef mode); + virtual bool close(); + virtual int readImpl(char *buffer, int length); + virtual int writeImpl(const char *buffer, int length); + virtual bool eof(); + virtual Array getMetaData(); + virtual int tell(); + + void setError(int err) { m_error = err;} + int getError() const { return m_error;} + int getType() const { return m_type;} + + // This is only for updating a local copy of timeouts set by setsockopt() + // outside of this class. + void setTimeout(struct timeval &tv); + +private: + int m_type; + int m_error; + bool m_eof; + + int m_timeout; // in micro-seconds; + bool m_timedOut; + + int m_bytesSent; + + bool closeImpl(); + bool waitForData(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_SOCKET_H__ diff --git a/src/cpp/base/file/temp_file.cpp b/src/cpp/base/file/temp_file.cpp new file mode 100644 index 0000000000000..344ea3cca6832 --- /dev/null +++ b/src/cpp/base/file/temp_file.cpp @@ -0,0 +1,77 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace std; + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION(TempFile); +/////////////////////////////////////////////////////////////////////////////// +// constructor and destructor + +TempFile::TempFile() { + FILE *tmp; + char path[PATH_MAX]; + + // open a temporary file + snprintf(path, sizeof(path), "/tmp/XXXXXX"); + int fd = mkstemp(path); + if (fd == -1 || (tmp = fdopen(fd, "r+b")) == NULL) { + if (fd != -1) ::close(fd); + Logger::Error("Unable to open temporary file"); + return; + } + m_stream = tmp; + m_fd = fd; + m_name = string(path); +} + +TempFile::~TempFile() { + closeImpl(); +} + +bool TempFile::open(CStrRef filename, CStrRef mode) { + throw FatalErrorException((string("cannot open a temp file ") + + m_name).c_str()); +} + +bool TempFile::close() { + return closeImpl(); +} + +bool TempFile::closeImpl() { + bool ret = true; + if (!m_closed) { + ASSERT(m_stream); + ret = (fclose(m_stream) == 0); + m_closed = true; + m_stream = NULL; + m_fd = -1; + } + if (!m_name.empty()) { + unlink(m_name.c_str()); + m_name.clear(); + } + File::closeImpl(); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/file/temp_file.h b/src/cpp/base/file/temp_file.h new file mode 100644 index 0000000000000..d6a31ab383f2f --- /dev/null +++ b/src/cpp/base/file/temp_file.h @@ -0,0 +1,52 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_TEMP_FILE_H__ +#define __HPHP_TEMP_FILE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * A temporary read/write file system file for php://temp, it will be deleted + * from the file system on close. + */ +class TempFile : public PlainFile { +public: + DECLARE_OBJECT_ALLOCATION(TempFile); + + TempFile(); + virtual ~TempFile(); + + // overriding ResourceData + const char *o_getClassName() const { return "TempFile";} + + // implementing File + virtual bool open(CStrRef filename, CStrRef mode); + virtual bool close(); + +private: + std::string m_name; + + bool closeImpl(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_TEMP_FILE_H__ diff --git a/src/cpp/base/file/url_file.cpp b/src/cpp/base/file/url_file.cpp new file mode 100644 index 0000000000000..050ec2ddae9cc --- /dev/null +++ b/src/cpp/base/file/url_file.cpp @@ -0,0 +1,101 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION(UrlFile); +/////////////////////////////////////////////////////////////////////////////// + +UrlFile::UrlFile(const char *method /* = "GET" */, + CArrRef headers /* = null_array */, + CStrRef postData /* = null_string */, + int maxRedirect /* = 20 */, + int timeout /* = -1 */) { + m_get = (method == NULL || strcasecmp(method, "GET") == 0); + m_headers = headers; + m_postData = postData; + m_maxRedirect = maxRedirect; + m_timeout = timeout; +} + +bool UrlFile::open(CStrRef url, CStrRef mode) { + if (strchr(mode, '+') || strchr(mode, 'a') || strchr(mode, 'w')) { + string msg("cannot open a url stream for write/append operation: "); + msg += url.c_str(); + Logger::Error(msg.c_str()); + return false; + } + HttpClient http(m_timeout, m_maxRedirect); + StringBuffer response; + + HeaderMap *pHeaders = NULL; + HeaderMap requestHeaders; + if (!m_headers.empty()) { + pHeaders = &requestHeaders; + for (ArrayIter iter(m_headers); iter; ++iter) { + requestHeaders[string(iter.first().toString().data())]. + push_back(iter.second().toString().data()); + } + } + + int code; + vector responseHeaders; + if (m_get) { + code = http.get(url.c_str(), response, pHeaders, &responseHeaders); + } else { + code = http.post(url.c_str(), m_postData.data(), m_postData.size(), + response, pHeaders, &responseHeaders); + } + + SystemGlobals *g = (SystemGlobals*)get_global_variables(); + Variant &r = g->gv_http_response_header; + r = Array::Create(); + for (unsigned int i = 0; i < responseHeaders.size(); i++) { + r.append(responseHeaders[i]); + } + + if (code == 200) { + m_name = url; + m_data = response.detach(m_len); + m_malloced = true; + return true; + } else { + return false; + } +} + +int UrlFile::writeImpl(const char *buffer, int length) { + ASSERT(m_len != -1); + throw FatalErrorException((string("cannot write a url stream: ") + + m_name).c_str()); +} + +bool UrlFile::flush() { + ASSERT(m_len != -1); + throw FatalErrorException((string("cannot flush a url stream: ") + + m_name).c_str()); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/file/url_file.h b/src/cpp/base/file/url_file.h new file mode 100644 index 0000000000000..40fcb2bc5af66 --- /dev/null +++ b/src/cpp/base/file/url_file.h @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_URL_FILE_H__ +#define __HPHP_URL_FILE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * url based files. + */ +class UrlFile : public MemFile { +public: + DECLARE_OBJECT_ALLOCATION(UrlFile); + + UrlFile(const char *method = "GET", CArrRef headers = null_array, + CStrRef postData = null_string, int maxRedirect = 20, + int timeout = -1); + + // overriding ResourceData + const char *o_getClassName() const { return "UrlFile";} + + virtual bool open(CStrRef filename, CStrRef mode); + virtual int writeImpl(const char *buffer, int length); + virtual bool flush(); + +private: + bool m_get; + Array m_headers; + String m_postData; + int m_maxRedirect; + int m_timeout; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_URL_FILE_H__ diff --git a/src/cpp/base/file/zip_file.cpp b/src/cpp/base/file/zip_file.cpp new file mode 100644 index 0000000000000..ed677cb40f5a3 --- /dev/null +++ b/src/cpp/base/file/zip_file.cpp @@ -0,0 +1,112 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP(ZipFile); +/////////////////////////////////////////////////////////////////////////////// + +ZipFile::ZipFile() : m_gzFile(NULL) { + m_innerFile = NEW(PlainFile)(); + m_innerFile->unregister(); // so Sweepable won't touch my child +} + +ZipFile::~ZipFile() { + closeImpl(); + DELETE(PlainFile)(m_innerFile); +} + +void ZipFile::sweep() { + closeImpl(); + File::closeImpl(); +} + +bool ZipFile::open(CStrRef filename, CStrRef mode) { + ASSERT(m_gzFile == NULL); + + if (strchr(mode, '+')) { + Logger::Warning("cannot open a zlib stream for reading and writing " + "at the same time!"); + return false; + } + + return m_innerFile->open(filename, mode) && + (m_gzFile = gzdopen(dup(m_innerFile->fd()), mode.data())); +} + +bool ZipFile::close() { + return closeImpl(); +} + +bool ZipFile::closeImpl() { + bool ret = true; + if (!m_closed) { + if (m_gzFile) { + ret = (gzclose(m_gzFile) == 0); + m_gzFile = NULL; + } + m_closed = true; + m_innerFile->close(); + } + File::closeImpl(); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +int ZipFile::readImpl(char *buffer, int length) { + ASSERT(m_gzFile); + return gzread(m_gzFile, buffer, length); +} + +int ZipFile::writeImpl(const char *buffer, int length) { + ASSERT(m_gzFile); + return gzwrite(m_gzFile, buffer, length); +} + +bool ZipFile::seek(int offset, int whence /* = SEEK_SET */) { + ASSERT(m_gzFile); + int newoffset = gzseek(m_gzFile, offset, whence); + return (newoffset < 0) ? -1 : 0; +} + +int ZipFile::tell() { + ASSERT(m_gzFile); + return gztell(m_gzFile); +} + +bool ZipFile::eof() { + ASSERT(m_gzFile); + return gzeof(m_gzFile); +} + +bool ZipFile::rewind() { + ASSERT(m_gzFile); + gzrewind(m_gzFile); + return true; +} + +bool ZipFile::flush() { + ASSERT(m_gzFile); + return gzflush(m_gzFile, Z_SYNC_FLUSH); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/file/zip_file.h b/src/cpp/base/file/zip_file.h new file mode 100644 index 0000000000000..5d74b5cb6e082 --- /dev/null +++ b/src/cpp/base/file/zip_file.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZIP_FILE_H__ +#define __HPHP_ZIP_FILE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * zlib based files. + */ +class ZipFile : public File { +public: + DECLARE_OBJECT_ALLOCATION(ZipFile); + + ZipFile(); + virtual ~ZipFile(); + + // overriding ResourceData + const char *o_getClassName() const { return "ZipFile";} + + virtual bool open(CStrRef filename, CStrRef mode); + virtual bool close(); + virtual int readImpl(char *buffer, int length); + virtual int writeImpl(const char *buffer, int length); + virtual bool seek(int offset, int whence = SEEK_SET); + virtual int tell(); + virtual bool eof(); + virtual bool rewind(); + virtual bool flush(); + +private: + gzFile m_gzFile; + PlainFile *m_innerFile; + + bool closeImpl(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZIP_FILE_H__ diff --git a/src/cpp/base/frame_injection.cpp b/src/cpp/base/frame_injection.cpp new file mode 100644 index 0000000000000..10dca4f00da9f --- /dev/null +++ b/src/cpp/base/frame_injection.cpp @@ -0,0 +1,126 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +IMPLEMENT_THREAD_LOCAL(FrameInjection *, FrameInjection::s_top); + +String FrameInjection::getClassName(bool skip /* = false */) { + FrameInjection *t = *s_top; + if (t && skip) { + t = t->m_prev; + } + if (t && t->m_class) { + return t->m_class; + } + return ""; +} + +String FrameInjection::getParentClassName(bool skip /* = false */) { + String cls = getClassName(skip); + if (cls.empty()) return cls; + const ClassInfo *classInfo = ClassInfo::FindClass(cls); + if (classInfo) { + const char *parentClass = classInfo->getParentClass(); + if (parentClass && parentClass[0]) { + return parentClass; + } + } + return ""; +} + +Array FrameInjection::getBacktrace(bool skip /* = false */, + bool withSelf /* = false */) { + Array bt = Array::Create(); + FrameInjection *t = *s_top; + if (skip && t) { + t = t->m_prev; + } + if (withSelf && t) { + // This is used by onError with extended exceptions + Array frame = Array::Create(); + frame.set("file", t->getFileName()); + frame.set("line", t->line); + bt.append(frame); + } + while (t) { + if (strncmp(t->m_name, "run_init::", 10) == 0) { + // TODO should we generate require_once for pseudo mains? + t = t->m_prev; + continue; + } + Array frame = Array::Create(); + const char *c = strstr(t->m_name, "::"); + if (c) { + frame.set("function", String(c + 2)); + frame.set("class", String(t->m_class)); + if (t->m_object) { + frame.set("object", t->m_object); + frame.set("type", "->"); + } else { + frame.set("type", "::"); + } + } else { + frame.set("function", t->m_name); + } + + if (t->m_prev) { + String file = t->m_prev->getFileName(); + if (!file.empty()) { + frame.set("file", file); + } + frame.set("line", t->m_prev->line); + } + + Array args = t->getArgs(); + if (!args.isNull()) { + frame.set("args", args); + } + + bt.append(frame); + t = t->m_prev; + } + return bt; +} + +String FrameInjection::getFileName() { + if (strncmp(m_name, "run_init::", 10) == 0) { + return m_name + 10; + } + const char *c = strstr(m_name, "::"); + const char *f = NULL; + if (c) { + f = SourceInfo::TheSourceInfo.getClassDeclaringFile(m_class); + } else { + f = SourceInfo::TheSourceInfo.getFunctionDeclaringFile(m_name); + } + if (f != NULL) { + return f; + } + return String(); +} + +Array FrameInjection::getArgs() { + return Array(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/frame_injection.h b/src/cpp/base/frame_injection.h new file mode 100644 index 0000000000000..519eb2c588ff0 --- /dev/null +++ b/src/cpp/base/frame_injection.h @@ -0,0 +1,67 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#ifndef __HPHP_FRAME_INJECTION_H__ +#define __HPHP_FRAME_INJECTION_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class FrameInjection { +public: + FrameInjection(const char *cls, const char *name, ObjectData *obj = NULL) + : line(0), m_class(cls), m_name(name), m_object(obj) { + m_topPtr = s_top.get(); + m_prev = *m_topPtr; + *m_topPtr = this; + } + virtual ~FrameInjection() { + *m_topPtr = m_prev; + } + + static DECLARE_THREAD_LOCAL(FrameInjection *, s_top); + + static String getClassName(bool skip = false); + static String getParentClassName(bool skip = false); + static ObjectData *getThis() { return *s_top ? (*s_top)->m_object : NULL; } + static Array getBacktrace(bool skip = false, bool withSelf = false); + + virtual String getFileName(); + + int line; + + virtual Array getArgs(); + +private: + FrameInjection **m_topPtr; + FrameInjection *m_prev; + const char *m_class; + const char *m_name; + ObjectData *m_object; +}; + +/** + * For setting line numbers, so to make gcc happy. + */ +inline void set_ln(int &ln, int v) { ln = v; } + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_FRAME_INJECTION_H__ diff --git a/src/cpp/base/global_array_wrapper.cpp b/src/cpp/base/global_array_wrapper.cpp new file mode 100644 index 0000000000000..5bb613cc629d0 --- /dev/null +++ b/src/cpp/base/global_array_wrapper.cpp @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { + +/////////////////////////////////////////////////////////////////////////////// + +ssize_t GlobalArrayWrapper::getIndex(CVarRef k, + int64 prehash /* = -1*/) const { + if (k.isInteger()) { + return ((Array*)m_globals)->get()->getIndex(k.toInt64(), prehash) + + m_globals->size(); + } + return m_globals->getIndex(k.toString().data(), prehash); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/global_array_wrapper.h b/src/cpp/base/global_array_wrapper.h new file mode 100644 index 0000000000000..4d453e2b1c0e2 --- /dev/null +++ b/src/cpp/base/global_array_wrapper.h @@ -0,0 +1,241 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_GLOBAL_ARRAY_WRAPPER_H__ +#define __HPHP_GLOBAL_ARRAY_WRAPPER_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class GlobalArrayWrapper : public ArrayData { +public: + GlobalArrayWrapper() { + m_globals = (Globals*)get_global_variables(); + } + + virtual void release() { + } + + virtual ssize_t size() const { + return m_globals->size(); + } + + virtual Variant getKey(ssize_t pos) const { + Variant k; + m_globals->getByIdx(pos, k); + return k; + } + virtual Variant getValue(ssize_t pos) const { + Variant k; + return m_globals->getByIdx(pos, k); + } + virtual CVarRef getValueRef(ssize_t pos) const { + Variant k; + return m_globals->getRefByIdx(pos, k); + } + virtual bool supportValueRef() const { return true; } + + virtual bool exists(int64 k, int64 prehash = -1) const { + return exists(Variant(k), prehash); + } + virtual bool exists(litstr k, int64 prehash = -1) const { + return exists(Variant(k), prehash); + } + virtual bool exists(CStrRef k, int64 prehash = -1) const { + return exists(Variant(k), prehash); + } + virtual bool exists(CVarRef k, int64 prehash = -1) const { + return m_globals->exists(k.toString().data()); + } + virtual bool idxExists(ssize_t idx) const { + return idx < size(); + } + + virtual Variant get(int64 k, int64 prehash = -1) const { + return get(Variant(k), prehash); + } + virtual Variant get(litstr k, int64 prehash = -1) const { + if (exists(k, prehash)) { + return m_globals->get(k); + } + return Variant(); + } + virtual Variant get(CStrRef k, int64 prehash = -1) const { + if (exists(k, prehash)) { + return m_globals->get(k); + } + return Variant(); + } + virtual Variant get(CVarRef k, int64 prehash = -1) const { + if (exists(k, prehash)) { + return m_globals->get(k); + } + return Variant(); + } + + virtual ssize_t getIndex(int64 k, int64 prehash = -1) const { + return m_globals->getIndex(toString(k), prehash); + } + virtual ssize_t getIndex(litstr k, int64 prehash = -1) const { + return m_globals->getIndex(k, prehash); + } + virtual ssize_t getIndex(CStrRef k, int64 prehash = -1) const { + return m_globals->getIndex(k.data(), prehash); + } + virtual ssize_t getIndex(CVarRef k, int64 prehash = -1) const; + + virtual ArrayData *lval(Variant *&ret, bool copy) { + ret = &m_globals->lval(); + return NULL; + } + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1) { + return lval(Variant(k), ret, copy); + } + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1) { + ret = &m_globals->get(k); + return NULL; + } + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1) { + ret = &m_globals->get(k); + return NULL; + } + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1) { + ret = &m_globals->get(k); + return NULL; + } + + virtual ArrayData *set(int64 k, CVarRef v, + bool copy, int64 prehash = -1) { + set(Variant(k), v, copy, prehash); + return NULL; + } + virtual ArrayData *set(litstr k, CVarRef v, + bool copy, int64 prehash = -1) { + m_globals->get(k) = v; + return NULL; + } + virtual ArrayData *set(CStrRef k, CVarRef v, + bool copy, int64 prehash = -1) { + m_globals->get(k) = v; + return NULL; + } + virtual ArrayData *set(CVarRef k, CVarRef v, + bool copy, int64 prehash = -1) { + m_globals->get(k) = v; + return NULL; + } + + virtual ArrayData *remove(int64 k, bool copy, int64 prehash /* = -1 */) { + return remove(Variant(k), copy, prehash); + } + virtual ArrayData *remove(litstr k, bool copy, int64 prehash /* = -1 */) { + m_globals->get(k) = null; + return NULL; + } + virtual ArrayData *remove(CStrRef k, bool copy, int64 prehash /* = -1 */) { + m_globals->get(k) = null; + return NULL; + } + virtual ArrayData *remove(CVarRef k, bool copy, int64 prehash /* = -1 */) { + m_globals->get(k) = null; + return NULL; + } + + virtual ArrayData *copy() const { + return NULL; + } + + virtual ArrayData *append(CVarRef v, bool copy) { + m_globals->append(v); + return NULL; + } + + virtual ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy) { + ((Array*)m_globals)->get()->append(elems, op, false); + return NULL; + } + + virtual ArrayData *pop(Variant &value) { + throw NotSupportedException(__func__, "manipulating globals array"); + } + + virtual ArrayData *dequeue(Variant &value) { + throw NotSupportedException(__func__, "manipulating globals array"); + } + + virtual ArrayData *insert(ssize_t pos, CVarRef v, bool copy) { + throw NotSupportedException(__func__, "manipulating globals array"); + } + + ssize_t iter_begin() const { + return m_globals->iter_begin(); + } + ssize_t iter_end() const { + return m_globals->iter_end(); + } + ssize_t iter_advance(ssize_t prev) const { + return m_globals->iter_advance(prev); + } + ssize_t iter_rewind(ssize_t prev) const { + return m_globals->iter_rewind(prev); + } + + virtual Variant next() { + m_pos = m_globals->iter_advance(m_pos); + return value(m_pos); + } + + virtual void getFullPos(FullPos &pos) { + if (m_pos == ArrayData::invalid_index) { + pos.primary = ArrayData::invalid_index; + } else if (m_pos < m_globals->staticSize()) { + pos.primary = m_pos; + pos.secondary = ArrayData::invalid_index; + } else { + m_globals->getFullPos(pos); + } + } + + virtual bool setFullPos(const FullPos &pos) { + if (pos.primary != ArrayData::invalid_index) { + if (m_pos < m_globals->staticSize()) return true; + ArrayData *data = m_globals->getArrayData(); + if (data) { + data->reset(); + return true; + } else { + return false; + } + } else { + return false; + } + } + +private: + Globals* m_globals; +}; + +/////////////////////////////////////////////////////////////////////////////// + +} +#endif diff --git a/src/cpp/base/hphp.h b/src/cpp/base/hphp.h new file mode 100644 index 0000000000000..b890fbae3d34a --- /dev/null +++ b/src/cpp/base/hphp.h @@ -0,0 +1,36 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CPP_BASE_HPHP_H__ +#define __CPP_BASE_HPHP_H__ + +/////////////////////////////////////////////////////////////////////////////// + +/** + * This is the file that's included at top of a code generated program. + * + * Do NOT include this file in cpp/base, as this depends on a generated + * globals.h that defines GlobalVariables class. + */ + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __CPP_BASE_HPHP_H__ diff --git a/src/cpp/base/hphp_ffi.cpp b/src/cpp/base/hphp_ffi.cpp new file mode 100644 index 0000000000000..46d7f9c033294 --- /dev/null +++ b/src/cpp/base/hphp_ffi.cpp @@ -0,0 +1,215 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; + +/////////////////////////////////////////////////////////////////////////////// + +void hphp_ffi_ArrayData_decRef(ArrayData *p) { + if (!p->decRefCount()) { + p->release(); + } +} +void hphp_ffi_StringData_decRef(StringData *p) { + if (!p->decRefCount()) { + p->release(); + } +} +void hphp_ffi_ObjectData_decRef(ObjectData *p) { + if (!p->decRefCount()) { + p->release(); + } +} +int hphp_ffi_exportVariant(CVarRef v, void** result) { + switch (v.getType()) { + case KindOfNull: return 0; + case KindOfBoolean: *result = (void*)v.toBoolean(); return 1; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: { + *result = (void*)v.toInt64(); + return 2; + } + case KindOfDouble: { + union { + double d; + void* p; + } u; + u.d = v.toDouble(); + *result = u.p; + return 3; + } + case LiteralString: *result = (void*)v.getLiteralString(); return 4; + case KindOfString: { + StringData *sd = v.getStringData(); + sd->incRefCount(); + *result = (void*)sd; + return 5; + } + case KindOfArray: { + ArrayData *ad = v.getArrayData(); + ad->incRefCount(); + *result = (void*)ad; + return 6; + } + case KindOfObject: { + ObjectData *od = v.getObjectData(); + od->incRefCount(); + *result = (void*)od; + return 7; + } + default: + ASSERT(false); + return 0; + } +} + +Variant *hphp_ffi_buildVariant(int t, void* v, int len) { + switch (t) { + case 0: return NEW(Variant)(); + case 1: return NEW(Variant)((bool)v); + case 2: return NEW(Variant)((int64)v); + case 3: { + union { + double d; + void* p; + } u; + u.p = v; + return new Variant(u.d); + } + case 4: return NEW(Variant)((char*)v); + case 5: return NEW(Variant)(String((StringData*)v)); + case 6: + return NEW(Variant) + (String(NEW(StringData)((const char*)v, len, CopyString))); + case 7: return NEW(Variant)((ArrayData*)v); + case 8: return NEW(Variant)((ObjectData*)v); + case 9: return NEW(Variant)(Array::Create()); + } + ASSERT(false); + return NULL; +} + +void hphp_ffi_freeVariant(Variant *v) { + DELETE(Variant)(v); +} + +void hphp_ffi_addMapItem(Variant *map, Variant *key, Variant *val) { + map->set(*key, *val); +} + +int hphp_ffi_getMapItem(void **result, Variant *map, Variant *key) { + return hphp_ffi_exportVariant(map->rvalAt(*key), result); +} + +long long hphp_ffi_iter_begin(ArrayData *arr) { + return arr->iter_begin(); +} +long long hphp_ffi_iter_advance(ArrayData *arr, long long pos) { + return arr->iter_advance(pos); +} +long long hphp_ffi_iter_end(ArrayData *arr) { + return arr->iter_end(); +} +int hphp_ffi_iter_invalid(long long pos) { + return pos == ArrayData::invalid_index; +} + +int hphp_ffi_iter_getKey(ArrayData *arr, long long pos, void** res) { + return hphp_ffi_exportVariant(arr->getKey(pos), res); +} +int hphp_ffi_iter_getValue(ArrayData *arr, long long pos, void** res) { + return hphp_ffi_exportVariant(arr->getValue(pos), res); +} + +int hphp_ffi_string_data(StringData *sd, const char** data) { + *data = sd->data(); + return sd->size(); +} + +void hphp_ffi_include_file(const char* file) { + invoke_file(file); +} + +int hphp_ffi_invoke_function(void** ret, const char* func, ArrayData* args) { + Array argsArr(args); + Variant result = invoke(func, argsArr, -1); + return hphp_ffi_exportVariant(result, ret); +} + +int hphp_ffi_invoke_static_method(void** ret, const char* cls, + const char* func, ArrayData* args) { + Array argsArr(args); + Variant result = invoke_static_method(cls, func, argsArr); + return hphp_ffi_exportVariant(result, ret); +} + +int hphp_ffi_invoke_object_method(void** ret, ObjectData* receiver, + const char* func, ArrayData* args) { + Array argsArr(args); + Variant result = receiver->o_invoke(func, argsArr, -1); + return hphp_ffi_exportVariant(result, ret); +} + +int hphp_ffi_create_object(void **ret, const char *cls, ArrayData *args) { + Array argsArr(args); + Object result = create_object(cls, argsArr); + return hphp_ffi_exportVariant(result, ret); +} + +void hphp_ffi_init() { + RuntimeOption::SourceRoot = "/"; + init_static_variables(); +} + +void hphp_ffi_init_globals() { + init_global_variables(); +} + +void hphp_ffi_free_globals() { + free_global_variables(); +} + +void hphp_ffi_session_init() { + hphp_session_init(); +} + +void hphp_ffi_session_exit() { + hphp_session_exit(); +} + +ExecutionContext *hphp_ffi_context_init() { + return hphp_context_init(); +} + +void hphp_ffi_context_exit(ExecutionContext *context) { + hphp_context_exit(context, true); +} + +/////////////////////////////////////////////////////////////////////////////// diff --git a/src/cpp/base/hphp_ffi.h b/src/cpp/base/hphp_ffi.h new file mode 100644 index 0000000000000..3da4914d3afb0 --- /dev/null +++ b/src/cpp/base/hphp_ffi.h @@ -0,0 +1,204 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_FFI_H__ +#define __HPHP_FFI_H__ + +/////////////////////////////////////////////////////////////////////////////// +namespace HPHP { + class Variant; + class ArrayData; + class StringData; + class ObjectData; + class ExecutionContext; +} + +extern "C" { + + /** + * Decreases the ref count of an HPHP array. Called when the foreign + * reference is destructed. + */ + void hphp_ffi_ArrayData_decRef(HPHP::ArrayData *p); + /** + * Decreases the ref count of an HPHP string. + */ + void hphp_ffi_StringData_decRef(HPHP::StringData *p); + /** + * Decreases the ref count of an HPHP object. + */ + void hphp_ffi_ObjectData_decRef(HPHP::ObjectData *p); + + /** + * Creates an HPHP variant from the foreign language. + * + * @param t encodes the type of the variant + * @param v foreign value from which the HPHP variant is built + * @param len length of the char array used to build the HPHP string + * @return pointer to the HPHP variant + */ + HPHP::Variant *hphp_ffi_buildVariant(int t, void* v, int len); + + /** + * Deletes an HPHP variant created from the foreign language. + */ + void hphp_ffi_freeVariant(HPHP::Variant *v); + + /** + * Sets a pair in an HPHP variant. Fails for primitive types. + */ + void hphp_ffi_addMapItem(HPHP::Variant *map, HPHP::Variant *key, + HPHP::Variant *val); + + /** + * Gets the value corresponding to a key. + */ + int hphp_ffi_getMapItem(void **result, HPHP::Variant *map, + HPHP::Variant *key); + + /** + * Returns the position of the first valid element in an HPHP array, + * -1 if the array is empty. + */ + long long hphp_ffi_iter_begin(HPHP::ArrayData *arr); + /** + * Returns the position of the element after the given position, + * -1 if out of the range. + */ + long long hphp_ffi_iter_advance(HPHP::ArrayData *arr, long long pos); + /** + * Returns the position of the last valid element in an HPHP array, + * -1 if the array is empty. + */ + long long hphp_ffi_iter_end(HPHP::ArrayData *arr); + /** + * Checks whether the given position is the invalid one, i.e., -1. + */ + int hphp_ffi_iter_invalid(long long pos); + /** + * Gets the key at the given position, and exports it as a variant. + * + * @param arr pointer to the HPHP array + * @param pos position of the key + * @param res pointer to the retrieved key + * @return type of the key + */ + int hphp_ffi_iter_getKey(HPHP::ArrayData *arr, long long pos, void** res); + /** + * Gets the value at the given position, and exports it as a variant. + */ + int hphp_ffi_iter_getValue(HPHP::ArrayData *arr, long long pos, void** res); + + /** + * Retrieves the literal string from an HPHP string. + * + * @param sd pointer to an HPHP string + * @param data pointer to the literal string + * @return length of the string + */ + int hphp_ffi_string_data(HPHP::StringData *sd, const char** data); + + /** + * Dynamically includes a file with the given name. + */ + void hphp_ffi_include_file(const char* file); + + /** + * Invokes a function, and exports the result. + * + * @param ret pointer to store the result + * @param func function name + * @param args array of the arguments + * @return type of the exported value + */ + int hphp_ffi_invoke_function(void** ret, const char* func, + HPHP::ArrayData* args); + + /** + * Invokes a static method, and exports the result. + */ + int hphp_ffi_invoke_static_method(void** ret, const char* cls, + const char* func, HPHP::ArrayData* args); + + /** + * Invokes an object method, and exports the result. + */ + int hphp_ffi_invoke_object_method(void** ret, HPHP::ObjectData* receiver, + const char* func, HPHP::ArrayData* args); + + /** + * Creates an object, and exports the result. + * + * @param ret pointer to store the result + * @param cls class name + * @param args array of the arguments + * @return type of the exported value + */ + int hphp_ffi_create_object(void **ret, const char *cls, + HPHP::ArrayData *args); + + /** + * Initializes static constants and runtime options. + */ + void hphp_ffi_init(); + + /** + * Initializes global variables. + */ + void hphp_ffi_init_globals(); + + /** + * Frees global variables. + */ + void hphp_ffi_free_globals(); + + /** + * Inits an Hphp session. + */ + void hphp_ffi_session_init(); + + /** + * Exits an Hphp session. + */ + void hphp_ffi_session_exit(); + + /** + * Creates an execution context, and returns the pointer. + */ + HPHP::ExecutionContext *hphp_ffi_context_init(); + + /** + * Finishes and releases an execution context. + */ + void hphp_ffi_context_exit(HPHP::ExecutionContext *context); +} + +/** + * Helper function to export data from HPHP to the foreign language. + * + * For primitive data, the value is directly exported; for a literal string, + * the pointer to the string is exported; for an HPHP string, array, or object, + * the pointer is exported, with the ref count increased by 1. + * + * @param v const reference to the HPHP variant data to export + * @param result pointer for storing the exported data + * @return type of the exported value + */ +int hphp_ffi_exportVariant(const HPHP::Variant &v, void** result); + +/////////////////////////////////////////////////////////////////////////////// + +#endif /* __HPHP_FFI_H__ */ diff --git a/src/cpp/base/hphp_system.h b/src/cpp/base/hphp_system.h new file mode 100644 index 0000000000000..4df8eede4e717 --- /dev/null +++ b/src/cpp/base/hphp_system.h @@ -0,0 +1,207 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CPP_BASE_HPHP_SYSTEM_H__ +#define __CPP_BASE_HPHP_SYSTEM_H__ + +/////////////////////////////////////////////////////////////////////////////// + +/** + * This is the file that's included at top of a code generated system file. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class Globals : public LVariableTable { +public: + CVarRef declareConstant(const char *name, Variant &constant, CVarRef value) { + if (!m_dynamicConstants.exists(name)) { + m_dynamicConstants.set(String(name, CopyString), value); + constant = value; + } + return value; + } + + void declareFunction(const char *name) { + m_volatileFunctions.set(String(Util::toLower(name)), true); + } + + void declareClass(const char *name) { + m_volatileClasses.set(String(Util::toLower(name)), true); + } + + void declareInterface(const char *name) { + m_volatileInterfaces.set(String(Util::toLower(name)), true); + } + + bool defined(const char *name) { + return m_dynamicConstants.exists(name); + } + + Variant getConstant(const char *name) { + return m_dynamicConstants[name]; + } + + Array getDynamicConstants() const { + return m_dynamicConstants; + } + + bool function_exists(const char *name) { + return m_volatileFunctions.exists(Util::toLower(name).c_str()); + } + + bool class_exists(const char *name) { + return m_volatileClasses.exists(Util::toLower(name).c_str()); + } + + bool interface_exists(const char *name) { + return m_volatileInterfaces.exists(Util::toLower(name).c_str()); + } + + virtual Variant getByIdx(ssize_t pos, Variant& k) { + return getRefByIdx(pos, k); + } + virtual CVarRef getRefByIdx(ssize_t pos, Variant& k) { + if (pos < -1) { + ArrayData *arr = Array::get(); + pos = wrapIter(pos); + k = arr->getKey(pos); + return arr->getValueRef(pos); + } + ASSERT(false); + throw FatalErrorException("bad code generation"); + } + virtual ssize_t getIndex(const char* s, int64 prehash) const { + return Array::get()->getIndex(s, prehash); + } + virtual ssize_t size() const { + return staticSize() + Array::size(); + } + virtual bool empty() const { + return staticSize() == 0 && Array::size() == 0; + } + virtual ssize_t staticSize() const { return 0; } + + ssize_t iter_begin() const { + if (empty()) return ArrayData::invalid_index; + if (staticSize() > 0) { + return 0; + } + return wrapIter(Array::get()->iter_begin()); + } + ssize_t iter_end() const { + if (empty()) return ArrayData::invalid_index; + if (Array::size() > 0) { + return wrapIter(Array::get()->iter_end()); + } + return staticSize() - 1; + } + ssize_t iter_advance(ssize_t prev) const { + ArrayData *arr = Array::get(); + if (prev < -1) { + return wrapIter(arr->iter_advance(wrapIter(prev))); + } + ssize_t next = prev + 1; + if (next == staticSize()) { + if (arr) return wrapIter(arr->iter_begin()); + return ArrayData::invalid_index; + } + return next; + } + ssize_t iter_rewind(ssize_t prev) const { + if (prev < -1) { + ArrayData *arr = Array::get(); + ASSERT(arr); + ssize_t next = arr->iter_rewind(wrapIter(prev)); + if (next == ArrayData::invalid_index) { + if (staticSize() > 0) { + return staticSize() - 1; + } + return ArrayData::invalid_index; + } else { + return wrapIter(next); + } + } + ssize_t next = prev - 1; + if (next < 0) return ArrayData::invalid_index; + return next; + } + + virtual void getFullPos(FullPos &pos) { + ArrayData *arr = Array::get(); + arr->getFullPos(pos); + } + + virtual bool setFullPos(const FullPos &pos) { + ArrayData *arr = Array::get(); + return arr->setFullPos(pos); + } + +public: + Variant __lvalProxy; + +private: + Array m_dynamicConstants; // declared constants + Array m_volatileFunctions; // declared functions + Array m_volatileClasses; // declared classes + Array m_volatileInterfaces; // declared interfaces + + ssize_t wrapIter(ssize_t it) const { + if (it != ArrayData::invalid_index) { + return -(it+2); + } + return ArrayData::invalid_index; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} // namespace HPHP + +#define DECLARE_SYSTEM_GLOBALS(sg) \ + SystemGlobals *sg __attribute__((__unused__)) = \ + (SystemGlobals*)get_global_variables(); + +#define DECLARE_GLOBAL_VARIABLES(g) \ + GlobalVariables *g __attribute__((__unused__)) = \ + get_global_variables(); + +// code generated file that defines all system global variables +#include + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __CPP_BASE_HPHP_SYSTEM_H__ diff --git a/src/cpp/base/list_assignment.cpp b/src/cpp/base/list_assignment.cpp new file mode 100644 index 0000000000000..4ba6ef807219a --- /dev/null +++ b/src/cpp/base/list_assignment.cpp @@ -0,0 +1,71 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// ListAssignmentElement + +ListAssignmentElement::ListAssignmentElement(Variant &var, int index, ...) + : m_var(var) { + va_list ap; + va_start(ap, index); + while (index != -1) { + m_indices.push_back(index); + index = va_arg(ap, int); + } + va_end(ap); +} + +void ListAssignmentElement::assign(CArrRef data) { + ASSERT(!m_indices.empty()); + Variant tmp = data; + unsigned int size = m_indices.size(); + for (unsigned int i = 0; i < size; i++) { + tmp = tmp.rvalAt(m_indices[i]); + } + m_var = tmp; +} + +/////////////////////////////////////////////////////////////////////////////// +// global function + +Variant list_assign(CVarRef data, ListAssignmentElement *elem, ...) { + Array adata = data.toArray(); + vector elems; + + va_list ap; + va_start(ap, elem); + while (elem) { + elems.push_back(elem); + elem = va_arg(ap, ListAssignmentElement *); + } + va_end(ap); + + for (int i = elems.size() - 1; i >= 0; i--) { + elems[i]->assign(adata); + delete elems[i]; + } + return data; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/list_assignment.h b/src/cpp/base/list_assignment.h new file mode 100644 index 0000000000000..3e5e02d86085d --- /dev/null +++ b/src/cpp/base/list_assignment.h @@ -0,0 +1,63 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_LIST_ASSIGNMENT_H__ +#define __HPHP_LIST_ASSIGNMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Helper class for transforming ListAssignment expression. + */ +class ListAssignmentElement { + public: + /** + * "var" is the l-value Variant to take some element of an array on right- + * hand side. "index" and ... are nested array indices flatten into a vector + * by code generator. For example, + * + * list($a, list($b), $c) = $data = array(1, array(2), 3); + * + * is transformed into, + * + * list_assign($data, LAE($a, 0), LAE($b, 1, 0), LAE($c, 2), NULL); + */ + ListAssignmentElement(Variant &var, int index, ...); + + /** + * Called by list_assign to assign one value. "data" is the array element + * to assign to the Variant & this object holds. + */ + void assign(CArrRef data); + + private: + Variant &m_var; // l-value variant to assign to + std::vector m_indices; // flattened nested array indices +}; + +/** + * This could be moved to builtin_functions, but list assignment is really + * special and localized. + */ +Variant list_assign(CVarRef data, ListAssignmentElement *elem, ...); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_LIST_ASSIGNMENT_H__ diff --git a/src/cpp/base/macros.h b/src/cpp/base/macros.h new file mode 100644 index 0000000000000..28c6318f7d81f --- /dev/null +++ b/src/cpp/base/macros.h @@ -0,0 +1,323 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_MACROS_H__ +#define __HPHP_MACROS_H__ + +namespace HPHP { + +/////////////////////////////////////////////////////////////////////////////// +// class macros + +#define FORWARD_DECLARE_CLASS(cls) \ + class c_##cls; \ + typedef SmartObject p_##cls; \ + +#define FORWARD_DECLARE_REDECLARED_CLASS(cls) \ + class cs_##cls; \ + +#define BEGIN_CLASS_MAP(cls) \ + public: \ + virtual bool o_instanceof(const char *s) const { \ + if (!s || !*s) return false; \ + if (strcasecmp(s, #cls) == 0) return true; \ + +#define PARENT_CLASS(parent) \ + if (strcasecmp(s, #parent) == 0) return true; \ + +#define END_CLASS_MAP(cls) \ + return false; \ + } \ + +#define INVOKE_FEW_ARGS_COUNT 6 + +#define INVOKE_FEW_ARGS_DECL3 \ + virtual Variant o_invoke_few_args(const char *s, int64 h, int count, \ + CVarRef a0 = null_variant, \ + CVarRef a1 = null_variant, \ + CVarRef a2 = null_variant) +#define INVOKE_FEW_ARGS_DECL6 \ + virtual Variant o_invoke_few_args(const char *s, int64 h, int count, \ + CVarRef a0 = null_variant, \ + CVarRef a1 = null_variant, \ + CVarRef a2 = null_variant, \ + CVarRef a3 = null_variant, \ + CVarRef a4 = null_variant, \ + CVarRef a5 = null_variant) +#define INVOKE_FEW_ARGS_DECL10 \ + virtual Variant o_invoke_few_args(const char *s, int64 h, int count, \ + CVarRef a0 = null_variant, \ + CVarRef a1 = null_variant, \ + CVarRef a2 = null_variant, \ + CVarRef a3 = null_variant, \ + CVarRef a4 = null_variant, \ + CVarRef a5 = null_variant, \ + CVarRef a6 = null_variant, \ + CVarRef a7 = null_variant, \ + CVarRef a8 = null_variant, \ + CVarRef a9 = null_variant) +#if INVOKE_FEW_ARGS_COUNT == 3 +#define INVOKE_FEW_ARGS_DECL INVOKE_FEW_ARGS_DECL3 +#elif INVOKE_FEW_ARGS_COUNT == 6 +#define INVOKE_FEW_ARGS_DECL INVOKE_FEW_ARGS_DECL6 +#elif INVOKE_FEW_ARGS_COUNT == 10 +#define INVOKE_FEW_ARGS_DECL INVOKE_FEW_ARGS_DECL10 +#endif + +#define DECLARE_CLASS(cls, originalName, parent) \ + DECLARE_OBJECT_ALLOCATION(c_##cls); \ + public: \ + static void os_static_initializer(); \ + static Variant os_get(const char *s, int64 hash); \ + static Variant &os_lval(const char *s, int64 hash); \ + static Variant os_constant(const char *s); \ + static Variant os_invoke(const char *c, const char *s, \ + CArrRef ps, int64 h, bool f = true); \ + virtual const char *o_getClassName() const { return #originalName;} \ + virtual bool o_exists(CStrRef s, int64 hash) const; \ + virtual void o_get(ArrayElementVec &props) const; \ + virtual Variant o_get(CStrRef s, int64 hash); \ + virtual Variant o_set(CStrRef s, int64 hash, CVarRef v, \ + bool forInit = false); \ + virtual Variant &o_lval(CStrRef s, int64 hash); \ + virtual Variant o_invoke(const char *s, CArrRef ps, int64 h, \ + bool f =true); \ + virtual Variant o_invoke_ex(const char *clsname, const char *s, \ + CArrRef ps, int64 h, bool f = true) { \ + if (clsname && strcasecmp(clsname, #cls) == 0) { \ + return c_##cls::o_invoke(s, ps, h, f); \ + } \ + return c_##parent::o_invoke_ex(clsname, s, ps, h, f); \ + } \ + INVOKE_FEW_ARGS_DECL; \ + protected: \ + ObjectData *cloneImpl(); \ + void cloneSet(c_##cls *cl); \ + public: \ + +#define DECLARE_DYNAMIC_CLASS(cls, originalName) \ + DECLARE_OBJECT_ALLOCATION(c_##cls); \ + public: \ + static void os_static_initializer(); \ + static Variant os_get(const char *s, int64 hash); \ + static Variant &os_lval(const char *s, int64 hash); \ + static Variant os_invoke(const char *c, const char *s, \ + CArrRef ps, int64 h, bool f = true); \ + static Variant os_constant(const char *s); \ + virtual const char *o_getClassName() const { return #originalName;} \ + virtual Variant o_invoke(const char *s, CArrRef ps, int64 h, \ + bool f = true); \ + virtual Variant o_invoke_ex(const char *clsname, const char *s, \ + CArrRef ps, int64 h, bool f = true) { \ + if (clsname && strcasecmp(clsname, #cls) == 0) { \ + return o_invoke(s, ps, h, f); \ + } \ + return parent->o_invoke_ex(clsname, s, ps, h, f); \ + } \ + INVOKE_FEW_ARGS_DECL; \ + protected: \ + ObjectData *cloneImpl(); \ + void cloneSet(c_##cls *cl); \ + public: \ + +#define DECLARE_INVOKES_FROM_EVAL \ + static Variant os_invoke_from_eval(const char *c, const char *s, \ + Eval::VariableEnvironment &env, \ + const Eval::FunctionCallExpression *call,\ + int64 hash, \ + bool fatal /* = true */); \ + Variant o_invoke_from_eval(const char *s, \ + Eval::VariableEnvironment &env, \ + const Eval::FunctionCallExpression *call, \ + int64 hash, \ + bool fatal /* = true */); + +#define IMPLEMENT_CLASS(cls) \ + IMPLEMENT_OBJECT_ALLOCATION(c_##cls); \ + +#define HASH_GUARD(code, f) \ + if (hash == code && !strcasecmp(s, #f)) +#define HASH_EXISTS(code, str) \ + if (hash == code && strcmp(s, #str) == 0) return true +#define HASH_EXISTS_STRING(code, str, len) \ + if (hash == code && s.length() == len && \ + memcmp(s.data(), #str, len) == 0) return true +#define HASH_INITIALIZED(code, name, str) \ + if (hash == code && strcmp(s, #str) == 0) \ + return isInitialized(name) +#define HASH_RETURN(code, name, str) \ + if (hash == code && strcmp(s, #str) == 0) return name +#define HASH_RETURN_STRING(code, name, str, len) \ + if (hash == code && s.length() == len && \ + memcmp(s.data(), #str, len) == 0) return name +#define HASH_SET(code, name, str) \ + if (hash == code && strcmp(s, #str) == 0) { name = v; return null;} +#define HASH_SET_STRING(code, name, str, len) \ + if (hash == code && s.length() == len && \ + memcmp(s.data(), #str, len) == 0) { name = v; return null; } +#define HASH_INDEX(code, str, index) \ + if (hash == code && strcmp(s, #str) == 0) { return index;} + +#define HASH_INVOKE(code, f) \ + if (hash == code && !strcasecmp(s, #f)) return i_ ## f(params) +#define HASH_INVOKE_REDECLARED(code, f) \ + if (hash == code && !strcasecmp(s, #f)) return g->i_ ## f(params) +#define HASH_INVOKE_METHOD(code, f) \ + if (hash == code && !strcasecmp(s, #f)) return o_i_ ## f(params) +#define HASH_INVOKE_CONSTRUCTOR(code, f, id) \ + if (hash == code && !strcasecmp(s, #f)) return o_i_ ## id(params) +#define HASH_INVOKE_STATIC_METHOD(code, f) \ + if (hash == code && !strcasecmp(s, #f)) \ + return cw_ ## f ## $os_invoke(#f, method, params, fatal) +#define HASH_INVOKE_STATIC_METHOD_REDECLARED(code, f) \ + if (hash == code && !strcasecmp(s, #f)) \ + return g->cso_ ## f->os_invoke(#f, method, params, -1, fatal) +#define HASH_GET_STATIC_PROPERTY(code, f) \ + if (hash == code && !strcasecmp(s, #f)) return cw_ ## f ## $os_get(prop) +#define HASH_GET_STATIC_PROPERTY_REDECLARED(code, f) \ + if (hash == code && !strcasecmp(s, #f)) return g->cso_ ## f->os_get(prop, -1) +#define HASH_GET_STATIC_PROPERTY_LV(code, f) \ + if (hash == code && !strcasecmp(s, #f)) return &cw_ ## f ## $os_lval(prop) +#define HASH_GET_STATIC_PROPERTY_LV_REDECLARED(code, f) \ + if (hash == code && !strcasecmp(s, #f)) \ + return &g->cso_ ## f->os_lval(prop, -1) +#define HASH_GET_CLASS_CONSTANT(code, f) \ + if (hash == code && !strcasecmp(s, #f)) \ + return cw_ ## f ## $os_constant(constant) +#define HASH_GET_CLASS_CONSTANT_REDECLARED(code, f) \ + if (hash == code && !strcasecmp(s, #f)) \ + return g->cso_ ## f->os_constant(constant) +#define HASH_CREATE_OBJECT(code, f) \ + if (hash == code && !strcasecmp(s, #f)) return co_ ## f(params, init) +#define HASH_CREATE_OBJECT_REDECLARED(code, f) \ + if (hash == code && !strcasecmp(s, #f)) \ + return g->cso_ ## f->create(params, init, root) +#define HASH_INCLUDE(code, file, fun) \ + if (hash == code && !strcmp(file, s.c_str())) { \ + return pm_ ## fun(once, variables); \ + } +#define HASH_INVOKE_FROM_EVAL(code, f) \ + if (hash == code && !strcasecmp(s, #f)) return ei_ ## f(env, caller) +#define HASH_INVOKE_REDECLARED_FROM_EVAL(code, f) \ + if (hash == code && !strcasecmp(s, #f)) return g->ei_ ## f(env_caller) + +#define INCALL_HELPER(name) \ + class incall { \ + public: \ + incall(ObjectData *obj, CStrRef name) : m_obj(obj) { \ + m_obj->setInCall(name); \ + } \ + ~incall() { \ + m_obj->clearInCall(); \ + } \ + private: \ + ObjectData *m_obj; \ + } incall_helper(this, name); \ + +/////////////////////////////////////////////////////////////////////////////// +// global variable macros + +#ifdef DIRECT_GLOBAL_VARIABLES + +#define BEGIN_GVS() +#define GVS(s) gv_##s; +#define END_GVS(c) +#define GV(s) s + +#else + +#define BEGIN_GVS() enum _gv_enums_ { +#define GVS(s) gv_##s, +#define END_GVS(c) }; Variant gv[c]; +#define GV(s) gv[GlobalVariables::gv_##s] + +#endif + +/////////////////////////////////////////////////////////////////////////////// +// code instrumentation or injections + +#ifdef INFINITE_LOOP_DETECTION +#define LOOP_COUNTER(n) int lc##n = 0; +#define LOOP_COUNTER_CHECK(n) \ + if (++lc##n > 1000000) throw_infinite_loop_exception(); +#else +#define LOOP_COUNTER(n) +#define LOOP_COUNTER_CHECK(n) +#endif + +#ifdef INFINITE_RECURSION_DETECTION +#define RECURSION_INJECTION RecursionInjection ri; +#else +#define RECURSION_INJECTION +#endif + +#ifdef REQUEST_TIMEOUT_DETECTION +#define REQUEST_TIMEOUT_INJECTION RequestInjection ti; +#else +#define REQUEST_TIMEOUT_INJECTION +#endif + +#ifdef HOTPROFILER +#define HOTPROFILER_INJECTION(n) ProfilerInjection pi(#n); +#ifndef HOTPROFILER_NO_BUILTIN +#define PROFILE_BUILTIN +#endif +#else +#define HOTPROFILER_INJECTION(n) +#endif + +#ifdef STACK_FRAME_INJECTION +#define FRAME_INJECTION(c, n) FrameInjection fi(#c, #n); +#define FRAME_INJECTION_WITH_THIS(c, n) FrameInjection fi(#c, #n, this); +#define LINE(n, e) (set_ln(fi.line, n), e) +#else +#define FRAME_INJECTION(c, n) +#define FRAME_INJECTION_WITH_THIS(c, n) +#define LINE(n, e) e +#endif + +// code injected into beginning of every function/method +#define FUNCTION_INJECTION(n) \ + RECURSION_INJECTION \ + REQUEST_TIMEOUT_INJECTION \ + HOTPROFILER_INJECTION(n) \ + FRAME_INJECTION(, n) \ + +#define STATIC_METHOD_INJECTION(c, n) \ + RECURSION_INJECTION \ + REQUEST_TIMEOUT_INJECTION \ + HOTPROFILER_INJECTION(n) \ + FRAME_INJECTION(c, n) \ + +#define INSTANCE_METHOD_INJECTION(c, n) \ + RECURSION_INJECTION \ + REQUEST_TIMEOUT_INJECTION \ + HOTPROFILER_INJECTION(n) \ + FRAME_INJECTION_WITH_THIS(c, n) \ + +// for collecting function/method parameter type information at runtime +#define RTTI_INJECTION(v, id) \ + do { \ + unsigned int *counter = getRTTICounter(id); \ + if (counter) { \ + counter[v.getType()]++; \ + } \ + } while (0) + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_MACROS_H__ diff --git a/src/cpp/base/memory/leak_detectable.cpp b/src/cpp/base/memory/leak_detectable.cpp new file mode 100644 index 0000000000000..6008ca0b46202 --- /dev/null +++ b/src/cpp/base/memory/leak_detectable.cpp @@ -0,0 +1,307 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#ifdef GOOGLE_HEAP_PROFILER +#include +#include +#endif + +using namespace std; +using namespace boost; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +int LeakDetectable::TotalCount = 0; +int LeakDetectable::TotalAllocated = 0; +Mutex LeakDetectable::LeakMutex; +LeakDetectable::StackTraceMap LeakDetectable::AllocStackTraces; + +LeakDetectable::LeakDetectable() : m_reachable(false) { + Lock lock(LeakMutex); + TotalAllocated++; + TotalCount++; + + AllocStackTraces.operator[](this); +} + +LeakDetectable::~LeakDetectable() { + Lock lock(LeakMutex); + TotalCount--; + + StackTraceMap::iterator iter = AllocStackTraces.find(this); + ASSERT(iter != AllocStackTraces.end()); + AllocStackTraces.erase(iter); +} + +void LeakDetectable::markReachable() { + ASSERT(!m_reachable); + m_reachable = true; +} + +void LeakDetectable::BeginLeakChecking() { + Lock lock(LeakMutex); + for (StackTraceMap::iterator iter = AllocStackTraces.begin(); + iter != AllocStackTraces.end(); ++iter) { + iter->first->m_reachable = false; + } +} + +int LeakDetectable::EndLeakChecking(std::string &dumps, int sampling) { + vector objDumps; + vector objStackTraces; + int count = 0; + + { + Lock lock(LeakMutex); + for (StackTraceMap::iterator iter = AllocStackTraces.begin(); + iter != AllocStackTraces.end(); ++iter) { + if (!iter->first->m_reachable) { + ++count; + if (rand() % sampling == 0) { + string out; + iter->first->dump(out); + objDumps.push_back(out); + objStackTraces.push_back(iter->second); + } + } + } + } + + for (unsigned int i = 0; i < objDumps.size(); i++) { + dumps += "---------------------------------------------------------\n"; + dumps += "Leaked Item "; + dumps += boost::lexical_cast(i+1); + dumps += ":\n"; + dumps += objDumps[i]; + dumps += objStackTraces[i].toString(); + } + + return count; +} + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef GOOGLE_HEAP_PROFILER +class AllocData { +public: + AllocData() : m_peak_malloced(0), m_current_malloced(0) {} + + int getPeakUsage() const { return m_peak_malloced;} + int getLeaked() const { return m_current_malloced;} + + void on_malloc(const void *ptr, size_t size) { + m_objects[ptr] = size; + m_current_malloced += size; + if (m_current_malloced > m_peak_malloced) { + m_peak_malloced = m_current_malloced; + } + } + + void on_free(const void *ptr) { + std::map::iterator iter = m_objects.find(ptr); + if (iter != m_objects.end()) { + m_current_malloced -= iter->second; + m_objects.erase(iter); + } + } + +private: + int m_peak_malloced; + int m_current_malloced; + std::map m_objects; +}; +static ThreadLocal s_allocs; + +static void hphp_malloc_hook_size_only(const void *ptr, size_t size) { + MallocHook::SetNewHook(NULL); + s_allocs->on_malloc(ptr, size); + MallocHook::SetNewHook(hphp_malloc_hook_size_only); +} + +static void hphp_free_hook_size_only(const void *ptr) { + MallocHook::SetDeleteHook(NULL); + s_allocs->on_free(ptr); + MallocHook::SetDeleteHook(hphp_free_hook_size_only); +} +#endif + +void LeakDetectable::EnableMallocStats(bool enable) { +#ifdef GOOGLE_HEAP_PROFILER + if (enable) { + MallocHook::SetDeleteHook(hphp_free_hook_size_only); + MallocHook::SetNewHook(hphp_malloc_hook_size_only); + } else { + MallocHook::SetNewHook(NULL); + MallocHook::SetDeleteHook(NULL); + } +#endif +} + +void LeakDetectable::LogMallocStats() { +#ifdef GOOGLE_HEAP_PROFILER + ServerStats::Log("mem.malloc.peak", s_allocs->getPeakUsage()); + ServerStats::Log("mem.malloc.leaked", s_allocs->getLeaked()); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(StackTrace); +struct AllocRecord { + time_t time; + StackTracePtr st; +}; + +static Mutex sampling_mutex; +typedef tbb::concurrent_hash_map SamplingMap; +static SamplingMap sampling_traces; + +#ifdef GOOGLE_HEAP_PROFILER +static int sampling_counter = 0; +static void hphp_malloc_hook(const void *ptr, size_t size) { + if (atomic_inc(sampling_counter) % LeakDetectable::MallocSampling == 0) { + Lock lock(sampling_mutex); + MallocHook::SetNewHook(NULL); + SamplingMap::accessor acc; + sampling_traces.insert(acc, ptr); + AllocRecord &alloc = acc->second; + alloc.time = time(NULL); + alloc.st = StackTracePtr(new StackTrace()); + MallocHook::SetNewHook(hphp_malloc_hook); + } +} + +static void hphp_free_hook(const void *ptr) { + sampling_traces.erase(ptr); +} +#endif + +int LeakDetectable::MallocSampling = 0; +int LeakDetectable::StackTraceGroupLevel = 6; + +void LeakDetectable::BeginMallocSampling() { + if (MallocSampling == 0) return; +#ifdef GOOGLE_HEAP_PROFILER + sampling_counter = 0; + MallocHook::SetDeleteHook(hphp_free_hook); + MallocHook::SetNewHook(hphp_malloc_hook); +#endif +} + +class LeakStats { +public: + LeakStats() : count(0) {} + string hash; + int count; + vector examples; +}; +static bool SortByCount(const LeakStats *s1, const LeakStats *s2) { + return s1->count < s2->count; +} + +void LeakDetectable::EndMallocSampling(std::string &dumps, int cutoff) { + if (MallocSampling == 0) return; + + // grouping + std::map leaked_stacks; + { + // turn off hooks + Lock lock(sampling_mutex); +#ifdef GOOGLE_HEAP_PROFILER + MallocHook::SetNewHook(NULL); + MallocHook::SetDeleteHook(NULL); +#endif + + time_t cutoff_time = time(NULL) - cutoff; + for (SamplingMap::iterator iter = + sampling_traces.begin(); iter != sampling_traces.end(); ++iter) { + if (iter->second.time > cutoff_time) continue; // too new + + StackTrace &st = *iter->second.st; + string hash = st.hexEncode(4, StackTraceGroupLevel + 4); + LeakStats &stats = leaked_stacks[hash]; + if (stats.count++ == 0) { + stats.hash = hash; + } + if (stats.examples.size() < 5) { + stats.examples.push_back(st.hexEncode()); + } + } + sampling_traces.clear(); + } + + // sorting + vector stats; + stats.reserve(leaked_stacks.size()); + for (std::map::iterator iter = + leaked_stacks.begin(); iter != leaked_stacks.end(); ++iter) { + stats.push_back(&iter->second); + } + sort(stats.begin(), stats.end(), SortByCount); + + // reporting + int totalLeaked = 0; + int totalGroup = 0; + for (unsigned int i = 0; i < stats.size(); i++) { + LeakStats *stat = stats[i]; + + string translated = translate_stack(stat->hash.c_str()); + if (!SuppressStackTrace(translated)) { + totalLeaked += stat->count; + totalGroup++; + + dumps += "---------------------------------------------------------\n"; + dumps += lexical_cast(i + 1) + ". Leaked "; + dumps += lexical_cast(stat->count) + " "; + dumps += stat->hash + ":\n\n"; + for (unsigned int j = 0; j < stat->examples.size(); j++) { + dumps += " ("; + dumps += lexical_cast(j + 1) + ") "; + dumps += stat->examples[j] + "\n"; + } + dumps += "\n"; + dumps += translated; + } + } + dumps += "---------------------------------------------------------\n"; + dumps += "Total Leaked " + lexical_cast(totalLeaked); + dumps += " in " + lexical_cast(totalGroup) + " groups.\n"; +} + +bool LeakDetectable::SuppressStackTrace(const std::string &st) { + static const char *known_okay_stacks[] = { + "gdCacheGet", + "ThreadSharedStore::", + "ThreadSharedVariant::ThreadSharedVariant", + }; + + for (unsigned int i = 0; + i < sizeof(known_okay_stacks)/sizeof(known_okay_stacks[0]); i++) { + if (st.find(known_okay_stacks[i]) != string::npos) { + return true; + } + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/memory/leak_detectable.h b/src/cpp/base/memory/leak_detectable.h new file mode 100644 index 0000000000000..fb09ee326299d --- /dev/null +++ b/src/cpp/base/memory/leak_detectable.h @@ -0,0 +1,90 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_LEAK_DETECTABLE_H__ +#define __HPHP_LEAK_DETECTABLE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Detect memory leaks by manual instrumentation of a specific class. + */ +class LeakDetectable { +public: + /** + * LeakDetectable object based detection: + * + * 1. Derive a class from LeakDetectable and implement dump(). + * 2. Optionally call markReachable() to exclude some reporting. + * 3. AdminRequestHandler has leak-on/off commands to capture leaks. + */ + static int TotalCount; + static int TotalAllocated; + static void BeginLeakChecking(); + static int EndLeakChecking(std::string &dumps, int sampling); + + /** + * Malloc based detection: + * + * 1. Only sample some mallocs, so not to slow down server. + * 2. Call BeginMallocSampling() after initialization to avoid reporting + * of long-lived objects. + * 4. Call EndMallocSampling() to report leaks. Use "cutoff" to filter out + * newly created objects that haven't got any chance to get deleted yet. + */ + static int MallocSampling; + static int StackTraceGroupLevel; + static void BeginMallocSampling(); + static void EndMallocSampling(std::string &dumps, int cutoff); + + /** + * Log malloc peak usage for web pages. + */ + static void EnableMallocStats(bool enable); + static void LogMallocStats(); + +public: + LeakDetectable(); + virtual ~LeakDetectable(); + + /** + * Mark an object to be supposedly reachable, so to exclude from reports. + */ + void markReachable(); + + /** + * Debug dump of a leaked item. + */ + virtual void dump(std::string &out) = 0; + +private: + typedef std::map StackTraceMap; + + static Mutex LeakMutex; + static StackTraceMap AllocStackTraces; + static bool SuppressStackTrace(const std::string &st); + + bool m_reachable; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif /* __HPHP_LEAK_DETECTABLE_H__ */ diff --git a/src/cpp/base/memory/linear_allocator.cpp b/src/cpp/base/memory/linear_allocator.cpp new file mode 100644 index 0000000000000..5957225b06e4f --- /dev/null +++ b/src/cpp/base/memory/linear_allocator.cpp @@ -0,0 +1,124 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +LinearAllocator::LinearAllocator() + : m_blob(NULL), m_size(0), m_pos(0), m_count(0), m_index(0), m_item(NULL) { +} + +LinearAllocator::~LinearAllocator() { + if (m_blob) { + free(m_blob); + } +} + +void LinearAllocator::reset() { + if (m_blob) { + free(m_blob); + m_blob = NULL; + } + m_size = 0; + m_pos = 0; + m_items.clear(); + m_count = 0; + m_index = 0; +} + +void LinearAllocator::beginBackup(int size, int count) { + if (m_blob) { + free(m_blob); + m_blob = NULL; + } + if (size > 0) { + ASSERT(count > 0); + m_blob = (char*)malloc(size); + } else { + ASSERT(size == 0); + ASSERT(count >= 0); // count can be non-zero for NULL terminiations + } + m_size = size; + m_pos = 0; + + m_items.clear(); // so it will be filled with 0s when resize + m_items.resize(count); + m_count = count; + m_index = 0; + m_item = NULL; +} + +void LinearAllocator::backup(void *p) { + ASSERT(m_index < m_count); + ItemInfo &item = m_items[m_index++]; + item.p = p; + item.end_pos = m_pos; + m_item = &item; +} + +void LinearAllocator::backup(int size) { + backup((const char *)&size, sizeof(size)); +} + +void LinearAllocator::backup(const char *data, int size) { + ASSERT(data); + ASSERT(size); + ASSERT(m_item); + + ASSERT(m_pos + size <= m_size); + memcpy(m_blob + m_pos, data, size); + m_pos += size; + m_item->end_pos = m_pos; +} + +void LinearAllocator::endBackup() { + ASSERT(m_pos == m_size); + ASSERT(m_index == m_count); + m_item = NULL; +} + +void LinearAllocator::beginRestore() { + ASSERT(m_pos == 0 || m_pos == m_size); + ASSERT(m_index == 0 || m_index == m_count); + + m_pos = 0; + m_index = 0; +} + +void *LinearAllocator::restore(const char *&data) { + ASSERT(m_pos <= m_size); + ASSERT(m_index < m_count); + + ItemInfo &item = m_items[m_index++]; + data = m_blob + m_pos; + m_pos = item.end_pos; + return item.p; +} + +void LinearAllocator::endRestore() { + ASSERT(m_pos == 0 || m_pos == m_size); + ASSERT(m_index == 0 || m_index == m_count); +} + +void LinearAllocator::checkMemory(bool detailed) { + printf("LinearAllocator: size = %d, pos = %d, count = %d, index = %d\n", + m_size, m_pos, m_count, m_index); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/memory/linear_allocator.h b/src/cpp/base/memory/linear_allocator.h new file mode 100644 index 0000000000000..c0ac9d8e8ca54 --- /dev/null +++ b/src/cpp/base/memory/linear_allocator.h @@ -0,0 +1,81 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_LINEAR_ALLOCATOR_H__ +#define __HPHP_LINEAR_ALLOCATOR_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * A LinearAllocator linearizes or serializes any number of runtime objects' + * internally malloc-ed and variable sized memory into one single continuous + * piece. This allows us to backup and restore runtime object's states quickly. + * Combined with fixed size SmartAllocator, we can then do generational + * sweeping to solve circular reference problem of reference counting, we + * can do checkpoints of the entire user memory space, and we can initializes + * static arrays a lot faster. + */ +class LinearAllocator { +public: + LinearAllocator(); + ~LinearAllocator(); + void reset(); + + /** + * Backup functions. + */ + void beginBackup(int size, int count); + void backup(void *p); + void backup(int size); + void backup(const char *data, int size); + void endBackup(); + + /** + * Restore functions. + */ + void beginRestore(); + void *restore(const char *&data); + void advance(int linearSize, int linearCount) { + m_pos += linearSize; + m_index += linearCount; + } + void endRestore(); + + void checkMemory(bool detailed); + +private: + char *m_blob; + int m_size; + int m_pos; + + struct ItemInfo { + void *p; + int end_pos; + }; + + std::vector m_items; + int m_count; + int m_index; + ItemInfo *m_item; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_LINEAR_ALLOCATOR_H__ diff --git a/src/cpp/base/memory/memory_manager.cpp b/src/cpp/base/memory/memory_manager.cpp new file mode 100644 index 0000000000000..193eab18c76e3 --- /dev/null +++ b/src/cpp/base/memory/memory_manager.cpp @@ -0,0 +1,149 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +ThreadLocal *MemoryManager::s_singleton = NULL; + +static class MemoryManagerInitializer { +public: + MemoryManagerInitializer() { + MemoryManager::TheMemoryManager(); + } +} s_memory_manager_initializer; + +ThreadLocal &MemoryManager::TheMemoryManager() { + if (s_singleton == NULL) { + s_singleton = new ThreadLocal(); + } + return *s_singleton; +} + +MemoryManager::MemoryManager() : m_enabled(false), m_checkpoint(false) { + if (RuntimeOption::EnableMemoryManager) { + m_enabled = true; + } + resetStats(); +} + +void MemoryManager::resetStats() { + m_stats.usage = 0; + m_stats.alloc = 0; + m_stats.peakUsage = 0; + m_stats.peakAlloc = 0; +} + +void MemoryManager::add(SmartAllocatorImpl *allocator) { + ASSERT(allocator); + m_smartAllocators.push_back(allocator); + allocator->registerStats(&m_stats); + + /** + * If a SmartAllocator is registered later than checkpoint, there must be no + * historical objects to restore. But this allocator still needs to be + * registered to rollback new objects after checkpoints. + */ + if (m_checkpoint) { + allocator->disableRestore(); + } +} + +void MemoryManager::add(UnsafePointer *p) { + ASSERT(p); + ASSERT(!m_checkpoint); + m_unsafePointers.insert(p); +} + +void MemoryManager::remove(UnsafePointer *p) { + ASSERT(p); + ASSERT(!m_checkpoint); + m_unsafePointers.erase(p); +} + +void MemoryManager::protectUnsafePointers() { + for (std::set::iterator iter = m_unsafePointers.begin(); + iter != m_unsafePointers.end(); ++iter) { + UnsafePointer *p = *iter; + ASSERT(p); + p->protect(); + } +} + +void MemoryManager::checkpoint() { + ASSERT(!m_checkpoint); + m_checkpoint = true; + + protectUnsafePointers(); + int size = 0; + int count = 0; + for (unsigned int i = 0; i < m_smartAllocators.size(); i++) { + count += m_smartAllocators[i]->calculateObjects(m_linearAllocator, size); + } + + m_linearAllocator.beginBackup(size, count); + for (unsigned int i = 0; i < m_smartAllocators.size(); i++) { + m_smartAllocators[i]->backupObjects(m_linearAllocator); + } + m_linearAllocator.endBackup(); +} + +void MemoryManager::rollback() { + m_linearAllocator.beginRestore(); + for (unsigned int i = 0; i < m_smartAllocators.size(); i++) { + m_smartAllocators[i]->rollbackObjects(m_linearAllocator); + } + m_linearAllocator.endRestore(); + protectUnsafePointers(); +} + +void MemoryManager::disableDealloc() { + for (unsigned int i = 0; i < m_smartAllocators.size(); i++) { + m_smartAllocators[i]->disableDealloc(); + } +} + +void MemoryManager::cleanup() { +} + +void MemoryManager::logStats() { + for (unsigned int i = 0; i < m_smartAllocators.size(); i++) { + m_smartAllocators[i]->logStats(); + } + LeakDetectable::LogMallocStats(); +} + +void MemoryManager::checkMemory(bool detailed) { + printf("----- MemoryManager for Thread %ld -----\n", (long)pthread_self()); + + printf("Current Usage: %lld bytes\t", m_stats.usage); + printf("Current Alloc: %lld bytes\n", m_stats.alloc); + printf("Peak Usage: %lld bytes\t", m_stats.peakUsage); + printf("Peak Alloc: %lld bytes\n", m_stats.peakAlloc); + + for (unsigned int i = 0; i < m_smartAllocators.size(); i++) { + m_smartAllocators[i]->checkMemory(detailed); + } + m_linearAllocator.checkMemory(detailed); + printf("Unsafe pointers: %d\n", (int)m_unsafePointers.size()); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/memory/memory_manager.h b/src/cpp/base/memory/memory_manager.h new file mode 100644 index 0000000000000..d3333dc657a69 --- /dev/null +++ b/src/cpp/base/memory/memory_manager.h @@ -0,0 +1,144 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_MEMORY_MANAGER_H__ +#define __HPHP_MEMORY_MANAGER_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * MemoryManager categorizes memory usage into 4 categories and maintain some + * of them with different strategy: + * + * 1. Fixed size objects: de/allocated by SmartAllocators, these objects have + * exactly the same size. For example, EmptyArray. + * 2. Interally malloc-ed and variable sized memory held by fixed size + * objects, for example, StringData's m_data. These memory can be backed up + * and restored by LinearAllocator. + * 3. Unsafe pointers held by fixed size objects, for example, ObjectData* + * held by Object. These pointers point to some external memory that's out + * of the control of MemoryManager, and therefore they are only interfaced + * through UnsafePointer class to make sure they are protected when these + * pointers are backed up to LinearAllocator. + * 4. Freelance memory, malloced by extensions or STL classes, that are + * completely out of MemoryManager's control. + */ +class MemoryManager { +public: + static ThreadLocal &TheMemoryManager(); + + MemoryManager(); + + /** + * Without calling this, everything should work as if there is no memory + * manager. + */ + void enable() { m_enabled = true;} + + /** + * Register a smart allocator. Done by SmartAlloctorImpl's constructor. + */ + void add(SmartAllocatorImpl *allocator); + + /** + * Register an unsafe pointer. Done by UnsafePointer's constructor. + */ + void add(UnsafePointer *p); + + /** + * Register an unsafe pointer. Done by UnsafePointer's destructor. + */ + void remove(UnsafePointer *p); + + /** + * Whether a checkpoint has been taken. + */ + bool beforeCheckpoint() const { + return m_enabled && !m_checkpoint; + } + bool afterCheckpoint() const { + return m_enabled && m_checkpoint; + } + + /** + * Mark current allocator's position as starting point of a new generation. + */ + void checkpoint(); + + /** + * Application can call this function optionally as an optimization not + * to put back object pointers to free list before sweeping them all. + */ + void disableDealloc(); + + /** + * Mark current allocator's position as ending point of a generation and + * sweep all memory that has allocated since the previous check point. + */ + void rollback(); + + /** + * For any objects that need to do extra work during thread shutdown time. + */ + void cleanup(); + + /** + * Protect the unsafe pointers. + */ + void protectUnsafePointers(); + + /** + * Write stats to ServerStats. + */ + void logStats(); + + /** + * Display any leaked or double-freed memory. + */ + void checkMemory(bool detailed); + + /** + * Find out how much memory we have used so far. + */ + const MemoryUsageStats &getStats() { return m_stats;} + + /** + * Called during session starts to reset all usage stats. + */ + void resetStats(); + +private: + static ThreadLocal *s_singleton; + + bool m_enabled; + bool m_checkpoint; + + std::vector m_smartAllocators; + LinearAllocator m_linearAllocator; + std::set m_unsafePointers; + + MemoryUsageStats m_stats; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_MEMORY_MANAGER_H__ diff --git a/src/cpp/base/memory/smart_allocator.cpp b/src/cpp/base/memory/smart_allocator.cpp new file mode 100644 index 0000000000000..503ff3d3c2c2f --- /dev/null +++ b/src/cpp/base/memory/smart_allocator.cpp @@ -0,0 +1,527 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace boost; + +#define MAX_OBJECT_COUNT_PER_SLAB 32 +#define SLAB_SIZE (128 * 1024) + +namespace HPHP { + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +static int calculate_item_count(int itemSize) { + int itemCount = SLAB_SIZE / itemSize; + if (itemCount == 0) { + itemCount = 1; + } else if (itemCount > MAX_OBJECT_COUNT_PER_SLAB) { + itemCount = MAX_OBJECT_COUNT_PER_SLAB; + } + return itemCount; +} + +/////////////////////////////////////////////////////////////////////////////// +// constructor and destructor + +SmartAllocatorImpl::SmartAllocatorImpl(int nameEnum, int itemCount, + int itemSize, int flag) + : m_itemCount(itemCount), m_itemSize(itemSize), m_flag(flag), + m_row(0), m_col(0), m_pos(-1), + m_rowChecked(0), m_colChecked(0), m_posChecked(-1), m_linearSize(0), + m_linearCount(0), m_iter(this), m_dealloc(true), m_linearized(false), + m_stats(NULL) { + + // automatically pick a good per slab item count + if (m_itemCount <= 0) { + m_itemCount = SLAB_SIZE / m_itemSize; + switch (nameEnum) { + case GlobalVariables: + m_itemCount = 1; + break; + case Variant: + case Array: + case SharedMap: + m_itemCount = 128; // rarely used items belong to this group + break; + case ObjectData: + m_itemCount = calculate_item_count(m_itemSize); + break; + case Bucket: + m_itemCount *= 4; // we need lots of Buckets + break; + } + } + + ASSERT(itemCount); + ASSERT(itemSize); + + m_colMax = m_itemSize * m_itemCount; + m_blocks.push_back((char *)malloc(m_colMax)); + m_freelist.resize(m_itemCount); + if (m_stats) { + m_stats->alloc += m_colMax; + if (m_stats->alloc > m_stats->peakAlloc) { + m_stats->peakAlloc = m_stats->alloc; + } + } + + if (nameEnum < 0) { + m_name = "(unknown)"; + } else { + static const char *TypeNames[] = { +#define SMART_ALLOCATOR_ENTRY(x) #x, +#include "smart_allocator.inc" +#undef SMART_ALLOCATOR_ENTRY + }; + ASSERT(nameEnum < (int)(sizeof(TypeNames)/sizeof(TypeNames[0]))); + m_name = TypeNames[nameEnum]; + } + + MemoryManager::TheMemoryManager()->add(this); +} + +SmartAllocatorImpl::~SmartAllocatorImpl() { + unsigned int size = m_blocks.size(); + for (unsigned int i = 0; i < size; i++) { + free(m_blocks[i]); + } + size = m_backupBlocks.size(); + for (unsigned int i = 0; i < size; i++) { + free(m_backupBlocks[i]); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// two most important methods + +void *SmartAllocatorImpl::alloc() { + if (m_stats) { + m_stats->usage += m_itemSize; + if (m_stats->usage > m_stats->peakUsage) { + m_stats->peakUsage = m_stats->usage; + if (RuntimeOption::RequestMemoryMaxBytes > 0 && + m_stats->peakUsage > RuntimeOption::RequestMemoryMaxBytes) { + throw FatalErrorException("request has exceeded memory limit"); + } + } + } + + if (m_pos > -1) { +#ifdef SMART_ALLOCATOR_STACKTRACE + m_st_allocs.operator[](m_freelist[m_pos]); +#endif + return m_freelist[m_pos--]; + } + if (m_col >= m_colMax) { + m_blocks.push_back((char *)malloc(m_colMax)); + if (m_stats) { + m_stats->alloc += m_colMax; + if (m_stats->alloc > m_stats->peakAlloc) { + m_stats->peakAlloc = m_stats->alloc; + } + } + + m_row++; + ASSERT(m_row == (int)m_blocks.size() - 1); + ASSERT(m_col == m_colMax); + m_col = 0; + m_freelist.resize(m_freelist.size() + m_itemCount); + ASSERT((int)m_freelist.size() == (m_row + 1) * m_itemCount); + } + char *ret = m_blocks[m_row] + m_col; + m_col += m_itemSize; +#ifdef SMART_ALLOCATOR_STACKTRACE + m_st_allocs.operator[](ret); +#endif + return ret; +} + +void SmartAllocatorImpl::dealloc(void *obj) { + if (obj) { + ASSERT(isValid(obj)); + ASSERT(m_pos < (int)m_freelist.size() - 1); + m_freelist[++m_pos] = obj; +#ifdef SMART_ALLOCATOR_STACKTRACE + m_st_deallocs.operator[](obj); +#endif + + if (m_stats) { + m_stats->usage -= m_itemSize; + } + } +} + +bool SmartAllocatorImpl::isValid(void *obj) const { + if (obj) { + unsigned int size = m_blocks.size(); + for (unsigned int i = 0; i < size; i++) { + char *block = m_blocks[i]; + if (obj >= block && obj < block + m_colMax && + (((char*)obj - block) % m_itemSize) == 0) { + return true; + } + } + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// SmartAllocatorManager methods + +/** + * When we restore, destination's size is always bigger, therefore, we can + * fully restore destination's old contents WITHOUT malloc-ing new memory. This + * is crucial in understanding why internal pointers between fixed size objects + * are able to get maintained during the process. + */ +void SmartAllocatorImpl::copyMemoryBlocks(std::vector &dest, + const std::vector &src, + int lastCol, + int lastBlockSize) { + int sizeDest = dest.size(); + int sizeSrc = src.size(); + ASSERT(lastCol <= lastBlockSize && lastBlockSize <= m_colMax); + ASSERT(sizeSrc > 0); + if (sizeDest < sizeSrc) { + dest.resize(sizeSrc); + for (int i = sizeDest; i < sizeSrc - 1; i++) { + dest[i] = (char *)malloc(m_colMax); + } + dest[sizeSrc - 1] = (char *)malloc(lastBlockSize); + } else if (sizeDest > sizeSrc) { + for (int i = sizeSrc; i < sizeDest; i++) { + free(dest[i]); + } + dest.resize(sizeSrc); + } + for (int i = 0; i < sizeSrc - 1; i++) { + memcpy(dest[i], src[i], m_colMax); + } + memcpy(dest[sizeSrc - 1], src[sizeSrc - 1], lastCol); +} + +int SmartAllocatorImpl::calculateObjects(LinearAllocator &allocator, + int &size) { + int count = 0; + int oldSize = size; + if (m_flag & (NeedRestore | NeedRestoreOnce)) { + m_iter.clear(); + for (m_iter.begin(); m_iter.get(); m_iter.next()) { + if (calculate(m_iter.get(), size)) { + ++count; + } + } + ++count; // we need NULL termination for each type + } + m_linearSize = size - oldSize; + m_linearCount = count; + return count; +} + +void SmartAllocatorImpl::backupObjects(LinearAllocator &allocator) { + // backup internal pointers + m_rowChecked = m_row; + m_colChecked = m_col; + m_posChecked = m_pos; + + // backup fixed size memory + copyMemoryBlocks(m_backupBlocks, m_blocks, m_col, m_col); + + // backup free list + m_backupFreelist = m_freelist; + + // backup variable sized memory + if (m_flag & (NeedRestore | NeedRestoreOnce)) { + for (m_iter.begin(); m_iter.get(); m_iter.next()) { + int size = 0; + if (calculate(m_iter.get(), size)) { + allocator.backup(m_iter.get()); + backup(m_iter.get(), allocator); + } + } + allocator.backup((void*)NULL); // indicating end of this type + m_iter.clear(); + } +} + +void SmartAllocatorImpl::rollbackObjects(LinearAllocator &allocator) { + m_dealloc = true; + + // sweep dangling objects + if (m_flag & (NeedRestore | NeedRestoreOnce | NeedSweep)) { + m_iter.clear(); + for (m_iter.begin(); m_iter.get(); m_iter.next()) { + sweep(m_iter.get()); + } + m_iter.clear(); + } + Sweepable::SweepAll(); + + // restore internal pointers + m_row = m_rowChecked; + m_col = m_colChecked; + m_pos = m_posChecked; + + // restore freelist if back'ed up + if (!(m_flag & RestoreDisabled)) { + m_freelist = m_backupFreelist; + } else { + m_freelist.resize(m_itemCount); + } + + // restore fixed size memory + ASSERT(m_blocks.size() >= m_backupBlocks.size()); + ASSERT(m_freelist.size() >= m_backupFreelist.size()); + if (m_backupBlocks.empty()) { + // this happens when SmartAllocator was created after checkpoint was taken + ASSERT(m_row == 0); + ASSERT(m_col == 0); + ASSERT(m_pos == -1); + for (unsigned int i = 1; i < m_blocks.size(); i++) { + free(m_blocks[i]); + } + m_blocks.resize(1); + } else { + copyMemoryBlocks(m_blocks, m_backupBlocks, m_colChecked, m_colMax); + + // restore variable sized memory + if (((m_flag & RestoreDisabled) == 0)) { + if (m_linearized) { + allocator.advance(m_linearSize, m_linearCount); + } else if (m_flag & (NeedRestore | NeedRestoreOnce)) { + void *p; + const char *data; + while ((p = allocator.restore(data)) != NULL) { + restore(p, data); + } + if (m_flag & NeedRestoreOnce) { + copyMemoryBlocks(m_backupBlocks, m_blocks, + m_colChecked, m_colChecked); + m_linearized = true; + } + } + } + } +} + +void SmartAllocatorImpl::logStats() { + int allocated = m_itemCount * m_row + (m_col / m_itemSize); + int freed = m_pos + 1; + + string key = string("mem.") + m_name + "." + + lexical_cast(m_itemSize); + ServerStats::Log(key + ".alloc", allocated); + ServerStats::Log(key + ".freed", freed); +} + +void SmartAllocatorImpl::checkMemory(bool detailed) { + int allocated = m_itemCount * m_row + (m_col / m_itemSize); + int freed = m_pos + 1; + printf("%16s (%6d bytes %6d x %3d): %s %8d alloc %8d free\n", + m_name, m_itemSize, m_itemCount, (m_row + 1), + freed != allocated ? "bad" : "ok ", allocated, freed); + + if (detailed) { + std::set freelist; + int index = 0; +#define MAX_REPORT 10 + int count = MAX_REPORT; + for (int i = 0; i <= m_pos; i++) { + void *p = m_freelist[i]; + if (freelist.find(p) != freelist.end()) { + if (--count == -1) { + printf("stopped reporting more than %d double-freed items\n", + MAX_REPORT); + } else if (count > 0) { + printf("Double-freed Item %d:\n", ++index); + dump(p); +#ifdef SMART_ALLOCATOR_STACKTRACE + printf("%s\n", m_st_deallocs[p].toString().c_str()); +#endif + } + } else { + freelist.insert(p); + } + } + + index = 0; + count = MAX_REPORT; + for (int i = 0; i <= m_row; i++) { + int jmax = m_colMax; + if (i == m_row) jmax = m_col; + for (int j = 0; j < jmax; j += m_itemSize) { + void *p = m_blocks[i] + j; + if (freelist.find(p) == freelist.end()) { + if (--count == -1) { + printf("stopped reporting more than %d leaked items\n", + MAX_REPORT); + } else if (count > 0) { + printf("Leaked Item at {%d:%d} %d:\n", i, j/m_itemSize, ++index); + dump(p); +#ifdef SMART_ALLOCATOR_STACKTRACE + printf("%s\n", m_st_allocs[p].toString().c_str()); +#endif + } + } else { + freelist.erase(p); + } + } + } + + count = MAX_REPORT; + for (std::set::const_iterator iter = freelist.begin(); + iter != freelist.end(); ++iter) { + if (--count == -1) { + printf("stopped reporting more than %d invalid items\n", + MAX_REPORT); + } else if (count > 0) { + void *p = *iter; + printf("Invalid Item %p:\n", p); +#ifdef SMART_ALLOCATOR_STACKTRACE + printf("%s\n", m_st_deallocs[p].toString().c_str()); + ASSERT(m_st_allocs.find(p) == m_st_allocs.end()); +#endif + } + } + } +} + +void SmartAllocatorImpl::prepareIterator(std::set &freelistSet, + std::map &blockInfoMap) { + ASSERT(freelistSet.empty()); + for (int i = 0; i <= m_pos; i++) { + char *p = (char*)m_freelist[i]; + ASSERT(freelistSet.find(p) == freelistSet.end()); + freelistSet.insert(p); + } + + ASSERT(blockInfoMap.empty()); + for (int i = 0; i < m_row; i++) { + blockInfoMap[m_blocks[i]] = m_colMax; + } + blockInfoMap[m_blocks[m_row]] = m_col; +} + +/////////////////////////////////////////////////////////////////////////////// +// PointerIterator + +SmartAllocatorImpl:: +PointerIterator::PointerIterator(SmartAllocatorImpl *allocator) + : m_allocator(allocator), m_px(NULL), m_prepared(false), m_offset(0), + m_curFree(NULL) { + ASSERT(allocator); + m_itemSize = allocator->getItemSize(); +} + +void SmartAllocatorImpl::PointerIterator::clear() { + m_freelistSet.clear(); + m_blockInfoMap.clear(); + m_prepared = false; + m_px = NULL; + m_offset = 0; + m_curFree = NULL; +} + +void SmartAllocatorImpl::PointerIterator::begin() { + if (!m_prepared) { + m_allocator->prepareIterator(m_freelistSet, m_blockInfoMap); + m_prepared = true; + } + + m_iterFreelist = m_freelistSet.begin(); + if (m_iterFreelist == m_freelistSet.end()) { + m_curFree = NULL; + } else { + m_curFree = *m_iterFreelist; + } + + m_px = NULL; + m_iterBlock = m_blockInfoMap.begin(); + if (m_iterBlock != m_blockInfoMap.end()) { + m_offset = 0; + while (search()); + } +} + +void SmartAllocatorImpl::PointerIterator::next() { + ASSERT(m_px); + m_offset += m_itemSize; + while (search()); +} + +bool SmartAllocatorImpl::PointerIterator::search() { + if (m_offset >= m_iterBlock->second) { + if (++m_iterBlock == m_blockInfoMap.end()) { + m_px = NULL; + return false; + } + m_offset = 0; + } else { + m_px = m_iterBlock->first + m_offset; + if (m_px < m_curFree || m_curFree == NULL) { + return false; + } + + ASSERT(m_px == m_curFree); + if (++m_iterFreelist == m_freelistSet.end()) { + m_curFree = NULL; + } else { + m_curFree = *m_iterFreelist; + } + m_offset += m_itemSize; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// ObjectAllocator classes + +ObjectAllocatorBase::ObjectAllocatorBase(int itemSize) + : SmartAllocatorImpl(SmartAllocatorImpl::ObjectData, + calculate_item_count(itemSize), itemSize, + SmartAllocatorImpl::NoCallbacks) { } + +int ObjectAllocatorBase::calculate(void *p, int &size) { + return false; +} + +void ObjectAllocatorBase::backup(void *p, LinearAllocator &allocator) { + // do nothing +} + +void ObjectAllocatorBase::restore(void *p, const char *&data) { + // do nothing +} + +void ObjectAllocatorBase::sweep(void *p) { + // do nothing +} + +void ObjectAllocatorBase::dump(void *p) { + printf("%p", p); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/memory/smart_allocator.h b/src/cpp/base/memory/smart_allocator.h new file mode 100644 index 0000000000000..ed7fbf06fc058 --- /dev/null +++ b/src/cpp/base/memory/smart_allocator.h @@ -0,0 +1,401 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SMART_ALLOCATOR_H__ +#define __HPHP_SMART_ALLOCATOR_H__ + +#include +#include +#include +#include + +namespace HPHP { + +#ifdef DEBUG_MEMORY_LEAK +#define DEBUGGING_SMART_ALLOCATOR 1 +#else +#ifdef DEBUG_RACE_CONDITION +#define DEBUGGING_SMART_ALLOCATOR 1 +#endif +#endif + +// #define DEBUGGING_SMART_ALLOCATOR 1 +//#define SMART_ALLOCATOR_STACKTRACE 1 + +/////////////////////////////////////////////////////////////////////////////// +/** + * If a class is using SmartAllocator, all "new" and "delete" should be done + * through these two macros in a form like this, + * + * MyClass *obj = NEW(MyClass)(...); + * DELETE(MyClass)(obj); + */ + +#ifdef DEBUGGING_SMART_ALLOCATOR +#define NEW(T) new T +#define DELETE(T) delete +#define DELETE_EX_CLS(NS,T) delete this +#define DELETE_OBJECT(T) delete this +#else +#define NEW(T) new (T::Allocator.get()) T +#define DELETE(T) T::Allocator->release +#define DELETE_EX_CLS(NS,T) this->~T(); NS::T::Allocator->release(this) +#define DELETE_OBJECT(T) this->~T() +#endif +#define DELETE_EX(T) DELETE_EX_CLS(,T) + +/////////////////////////////////////////////////////////////////////////////// +/** + * To use this allocator, simply add DECLARE_SMART_ALLOCATION macro to .h and + * add IMPLEMENT_SMART_ALLOCATION macro to .cpp. For example, + * + * class MyClass { + * DECLARE_SMART_ALLOCATION(MyClass, SmartAllocatorImpl::NoCallbacks); + * }; + * + * IMPLEMENT_SMART_ALLOCATION(MyClass, SmartAllocatorImpl::NoCallbacks); + */ + +#define DECLARE_SMART_ALLOCATION(T, F) \ + public: \ + typedef SmartAllocator AllocatorType; \ + static DECLARE_THREAD_LOCAL(AllocatorType, Allocator); \ + void release(); \ + +#define IMPLEMENT_SMART_ALLOCATION(T, F) \ + IMPLEMENT_THREAD_LOCAL(T::AllocatorType, T::Allocator); \ + void T::release() { \ + DELETE(T)(this); \ + } \ + +#define IMPLEMENT_SMART_ALLOCATION_CLS(C, T, F) \ + IMPLEMENT_THREAD_LOCAL(C::T::AllocatorType, C::T::Allocator); \ + void C::T::release() { \ + DELETE(T)(this); \ + } \ + +#define DECLARE_SMART_ALLOCATION_NOCALLBACKS(T) \ + DECLARE_SMART_ALLOCATION(T, SmartAllocatorImpl::NoCallbacks); \ + bool calculate(int &size) { \ + ASSERT(false); \ + return false; \ + } \ + void backup(LinearAllocator &allocator) { \ + ASSERT(false); \ + } \ + void restore(const char *&data) { \ + ASSERT(false); \ + } \ + void sweep() { \ + } \ + +#define IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS(T) \ + IMPLEMENT_SMART_ALLOCATION(T, SmartAllocatorImpl::NoCallbacks) \ + +#define IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS_CLS(C, T) \ + IMPLEMENT_SMART_ALLOCATION_CLS(C, T, SmartAllocatorImpl::NoCallbacks) \ + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Usage stats, all in bytes. + */ +struct MemoryUsageStats { + int64 usage; // how many bytes are currently being used + int64 alloc; // how many bytes are currently malloc-ed + int64 peakUsage; // how many bytes have been dispensed at maximum + int64 peakAlloc; // how many bytes malloc-ed at maximum +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Just a simple free-list based memory allocator. + */ +class SmartAllocatorImpl { +public: + enum Name { +#define SMART_ALLOCATOR_ENTRY(x) x, +#include "smart_allocator.inc" +#undef SMART_ALLOCATOR_ENTRY + }; + + enum Flag { + NoCallbacks = 0, // nothing is needed from linear memory allocator + NeedRestore = 1, // needs restore from linear memory allocator + RestoreDisabled = 2, // registered after checkpoint + NeedRestoreOnce = 4, // needs restore out-of-line memory only once + NeedSweep = 8, // needs to collect garbage + }; + +public: + SmartAllocatorImpl(int nameEnum, int itemCount, int itemSize, int flag); + virtual ~SmartAllocatorImpl(); + + /** + * Called by MemoryManager to store its usage stats pointer inside this + * allocator for easy access during alloc/free time. + */ + void registerStats(MemoryUsageStats *stats) { m_stats = stats;} + + int getItemSize() const { return m_itemSize;} + + /** + * Allocation/deallocation of object memory. + */ + void *alloc(); + void dealloc(void *obj); + bool isValid(void *obj) const; + + /** + * MemoryManager functions. + */ + int calculateObjects(LinearAllocator &allocator, int &size); + void backupObjects(LinearAllocator &allocator); + void rollbackObjects(LinearAllocator &allocator); + void logStats(); + void checkMemory(bool detailed); + + void disableDealloc() { m_dealloc = false;} + void disableRestore() { m_flag |= RestoreDisabled;} + + /** + * Delegated to type T. + */ + virtual int calculate(void *p, int &size) = 0; + virtual void backup(void *p, LinearAllocator &allocator) = 0; + virtual void restore(void *p, const char *&data) = 0; + virtual void sweep(void *p) = 0; + virtual void dump(void *p) = 0; + + private: + const char *m_name; + int m_itemCount; + int m_itemSize; + int m_flag; + + std::vector m_blocks; + int m_row; // outer index + int m_col; // inner position + int m_colMax; + + std::vector m_freelist; + int m_pos; // freelist index + + // checkpoint members + std::vector m_backupBlocks; + std::vector m_backupFreelist; + int m_rowChecked; + int m_colChecked; + int m_posChecked; + int m_linearSize; + int m_linearCount; + + class PointerIterator { + public: + PointerIterator(SmartAllocatorImpl *allocator); + void clear(); + + void begin(); + void *get() { return m_px;} + void next(); + + private: + SmartAllocatorImpl *m_allocator; + int m_itemSize; + char *m_px; + bool m_prepared; + std::set m_freelistSet; + std::map m_blockInfoMap; + + std::set::const_iterator m_iterFreelist; + std::map::const_iterator m_iterBlock; + int m_offset; + char *m_curFree; + + bool search(); + }; + + PointerIterator m_iter; + + void copyMemoryBlocks(std::vector &dest, + const std::vector &src, + int lastCol, int lastBlockSize); + +protected: + bool m_dealloc; + bool m_linearized; // No more restore needed for rollback + +#ifdef SMART_ALLOCATOR_STACKTRACE + std::map m_st_allocs; + std::map m_st_deallocs; +#endif + + MemoryUsageStats *m_stats; + + friend class PointerIterator; + void prepareIterator(std::set &freelistSet, + std::map &blockInfoMap); +}; + +/////////////////////////////////////////////////////////////////////////////// +// This allocator is for known and fixed sized classes, like StringData or +// ArrayData. + +template +class SmartAllocator : public SmartAllocatorImpl { + public: + /** + * Specify how many items to allocate a time. The more, the less number of + * times to grow the memory, but the higher chance of increasing memory + * footprint. + */ + SmartAllocator(int itemCount = -1) + : SmartAllocatorImpl(TNameEnum, itemCount, sizeof(T), flag) {} + + void release(T *p) { + if (p) { + p->~T(); + if (m_dealloc) { + dealloc(p); + } + } + } + + virtual int calculate(void *p, int &size) { + ASSERT(p); + return ((T*)p)->calculate(size); + } + + virtual void backup(void *p, LinearAllocator &allocator) { + ASSERT(p); + ((T*)p)->backup(allocator); + } + + virtual void restore(void *p, const char *&data) { + ASSERT(p); + ((T*)p)->restore(data); + } + + virtual void sweep(void *p) { + ASSERT(p); + ((T*)p)->sweep(); + } + + virtual void dump(void *p) { + if (p == NULL) { + printf("(null)"); + } else { + ((T*)p)->dump(); + } + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// This allocator is for unknown but fixed sized classes, like ObjectData. +// NS::T::s_T_initializer allows private inner classes to be initialized, +// this is completely hidden by using a nested private llocatorInitializer + +#define DECLARE_OBJECT_ALLOCATION(T) \ + public: \ + static ObjectAllocatorWrapper Allocator; \ + virtual void release(); \ + virtual void sweep(); + +#define IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP_CLS(NS,T) \ + static ObjectAllocatorBase *get_ ## T ## _allocator() { \ + static ThreadLocalStatic::value> > v; \ + return v.get(); \ + } \ + ObjectAllocatorWrapper NS::T::Allocator(get_ ## T ## _allocator); \ + void NS::T::release() { \ + destruct(); \ + DELETE_EX_CLS(NS, T); \ + } + +#define IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP(T) \ + IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP_CLS(HPHP,T) + +#define IMPLEMENT_OBJECT_ALLOCATION_CLS(NS,T) \ + IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP_CLS(NS,T); \ + void NS::T::sweep() { \ + DELETE_OBJECT(T); \ + } + +#define IMPLEMENT_OBJECT_ALLOCATION(T) IMPLEMENT_OBJECT_ALLOCATION_CLS(HPHP,T) + +class ObjectAllocatorBase : public SmartAllocatorImpl { +public: + ObjectAllocatorBase(int itemSize); + + void release(void *p) { + if (p && m_dealloc) { + dealloc(p); + } + } + + virtual int calculate(void *p, int &size); + virtual void backup(void *p, LinearAllocator &allocator); + virtual void restore(void *p, const char *&data); + virtual void sweep(void *p); + virtual void dump(void *p); +}; + +template +class ObjectAllocator : public ObjectAllocatorBase { +public: + static ObjectAllocator *Create() { + return new ObjectAllocator(); + } + static void Delete(ObjectAllocator *p) { + delete p; + } + + ObjectAllocator() : ObjectAllocatorBase(S) { } +}; + +class ObjectAllocatorWrapper { +public: + ObjectAllocatorWrapper(ObjectAllocatorBase *(*get)(void)) : m_get(get) { } + + ObjectAllocatorBase *operator->() const { + return m_get(); + } + + ObjectAllocatorBase *get() const { + return m_get(); + } + +private: + ObjectAllocatorBase *(*m_get)(void); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +template +inline void *operator new +(size_t sizeT, HPHP::SmartAllocator *a) { + return a->alloc(); +} + +inline void *operator new(size_t sizeT, HPHP::ObjectAllocatorBase *a) { + return a->alloc(); +} + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __HPHP_SMART_ALLOCATOR_H__ diff --git a/src/cpp/base/memory/smart_allocator.inc b/src/cpp/base/memory/smart_allocator.inc new file mode 100644 index 0000000000000..402d805f44f4e --- /dev/null +++ b/src/cpp/base/memory/smart_allocator.inc @@ -0,0 +1,20 @@ +SMART_ALLOCATOR_ENTRY(StringData) +SMART_ALLOCATOR_ENTRY(Array) +SMART_ALLOCATOR_ENTRY(ArrayElement) +SMART_ALLOCATOR_ENTRY(HphpMapNode) +SMART_ALLOCATOR_ENTRY(EmptyArray) +SMART_ALLOCATOR_ENTRY(VectorLong) +SMART_ALLOCATOR_ENTRY(VectorString) +SMART_ALLOCATOR_ENTRY(VectorVariant) +SMART_ALLOCATOR_ENTRY(MapLong) +SMART_ALLOCATOR_ENTRY(MapString) +SMART_ALLOCATOR_ENTRY(MapVariant) +SMART_ALLOCATOR_ENTRY(SharedMap) +SMART_ALLOCATOR_ENTRY(Variant) +SMART_ALLOCATOR_ENTRY(Bucket) +SMART_ALLOCATOR_ENTRY(ZendArray) +SMART_ALLOCATOR_ENTRY(ObjectData) +SMART_ALLOCATOR_ENTRY(GlobalVariables) +SMART_ALLOCATOR_ENTRY(VarAssocPair) + +SMART_ALLOCATOR_ENTRY(TestGlobals) diff --git a/src/cpp/base/memory/sweepable.cpp b/src/cpp/base/memory/sweepable.cpp new file mode 100644 index 0000000000000..df8996557ebcb --- /dev/null +++ b/src/cpp/base/memory/sweepable.cpp @@ -0,0 +1,64 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +ThreadLocal Sweepable::s_sweep_data; + +void Sweepable::SweepAll() { + s_sweep_data->sweeping = true; + SweepableSet &sweepables = s_sweep_data->sweepables; + SweepableSet persistentObjects; + for (SweepableSet::iterator iter = sweepables.begin(); + iter != sweepables.end(); ++iter) { + Sweepable *obj = *iter; + if (obj->m_persistentCount == 0) { + obj->sweep(); + } else { + persistentObjects.insert(obj); + } + } + sweepables.clear(); + if (!persistentObjects.empty()) { + sweepables = persistentObjects; + } + s_sweep_data->sweeping = false; +} + +Sweepable::Sweepable() : m_persistentCount(0) { + if (MemoryManager::TheMemoryManager()->afterCheckpoint()) { + s_sweep_data->sweepables.insert(this); + } +} + +Sweepable::~Sweepable() { + if (!s_sweep_data->sweeping) { + s_sweep_data->sweepables.erase(this); + } +} + +void Sweepable::unregister() { + s_sweep_data->sweepables.erase(this); +} + +/////////////////////////////////////////////////////////////////////////////// +} + diff --git a/src/cpp/base/memory/sweepable.h b/src/cpp/base/memory/sweepable.h new file mode 100644 index 0000000000000..29b55b186cf34 --- /dev/null +++ b/src/cpp/base/memory/sweepable.h @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SWEEPABLE_H__ +#define __HPHP_SWEEPABLE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Raw pointers that need to be deleted during garbage collection time. + */ +class Sweepable { +public: + static void SweepAll(); + +public: + Sweepable(); + virtual ~Sweepable(); + + virtual void sweep() { delete this;} + + void incPersistent() { ++m_persistentCount;} + void decPersistent() { --m_persistentCount;} + + /** + * Excluding this from being swept(). This is useful for child Sweepable + * inside a parent Sweepable, when parent's destructor will delete this + * object. For example, ZipFile containing PlainFile. + */ + void unregister(); + +private: + typedef hphp_hash_set > SweepableSet; + class SweepData { + public: + SweepData() : sweeping(false) {} + bool sweeping; + SweepableSet sweepables; + }; + static ThreadLocal s_sweep_data; + + int m_persistentCount; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif /* __HPHP_SWEEPABLE_H__ */ diff --git a/src/cpp/base/memory/unsafe_pointer.cpp b/src/cpp/base/memory/unsafe_pointer.cpp new file mode 100644 index 0000000000000..2a078a338d55d --- /dev/null +++ b/src/cpp/base/memory/unsafe_pointer.cpp @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +UnsafePointer::UnsafePointer() { + if (beforeCheckpoint()) { + MemoryManager::TheMemoryManager()->add(this); + } +} + +bool UnsafePointer::beforeCheckpoint() { + return MemoryManager::TheMemoryManager()->beforeCheckpoint(); +} + +UnsafePointer::~UnsafePointer() { + if (beforeCheckpoint()) { + MemoryManager::TheMemoryManager()->remove(this); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/memory/unsafe_pointer.h b/src/cpp/base/memory/unsafe_pointer.h new file mode 100644 index 0000000000000..8e53de12ab547 --- /dev/null +++ b/src/cpp/base/memory/unsafe_pointer.h @@ -0,0 +1,54 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_UNSAFE_POINTER_H__ +#define __HPHP_UNSAFE_POINTER_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * When we use LinearAllocator to backup memory, there are pointers that are + * external, and there is no guarantee that these pointers, when restored, will + * still be valid. Therefore, any pointers that will participate in checkpoint + * operation need to implement this interface to properly protect/unprotect at + * startup time and shutdown time, for example, by increment or decrement a + * reference count. + */ +class UnsafePointer { +public: + UnsafePointer(); + virtual ~UnsafePointer(); + + /** + * Has a checkpoint taken? If so, I don't have to protect myself to become + * persistent. Otherwise, I need to put myself into the set of unsafe + * pointers which will become persistent at checkpoint time. + */ + bool beforeCheckpoint(); + + /** + * Protect the object to be persistent. + */ + virtual void protect() = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_UNSAFE_POINTER_H__ diff --git a/src/cpp/base/object_data.cpp b/src/cpp/base/object_data.cpp new file mode 100644 index 0000000000000..4e8339a00dce2 --- /dev/null +++ b/src/cpp/base/object_data.cpp @@ -0,0 +1,520 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// statics + +static ThreadLocal os_max_id; // current maximum object identifier + +/////////////////////////////////////////////////////////////////////////////// +// constructor/destructor + +ObjectData::ObjectData() : o_properties(NULL), o_attribute(0), o_inCall(0) { + o_id = ++(*os_max_id.get()); +} + +ObjectData::~ObjectData() { + if (o_properties) { + o_properties->release(); + } + int *pmax = os_max_id.get(); + if (o_id == *pmax) { + --(*pmax); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// class info + +bool ObjectData::o_isClass(const char *s) const { + return strcasecmp(s, o_getClassName()) == 0; +} + +const Eval::MethodStatement *ObjectData::getMethodStatement(const char* name) + const { + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +// static methods and properties + +Variant ObjectData::os_get(const char *s, int64 hash) { + throw FatalErrorException((string("unknown static property ") + s).c_str()); +} + +Variant &ObjectData::os_lval(const char *s, int64 hash) { + throw FatalErrorException((string("unknown static property ") + s).c_str()); +} + +Variant ObjectData::os_invoke(const char *c, const char *s, + CArrRef params, int64 hash, + bool fatal /* = true */) { + Object obj = create_object(c, Array::Create(), false); + return obj->o_invoke(s, params, hash, fatal); +} + +Variant ObjectData::os_constant(const char *s) { + ostringstream msg; + msg << "unknown class constant " << s; + throw FatalErrorException(msg.str().c_str()); +} + +Variant +ObjectData::os_invoke_from_eval(const char *c, const char *s, + Eval::VariableEnvironment &env, + const Eval::FunctionCallExpression *call, + int64 hash, bool fatal /* = true */) { + return os_invoke(c, s, call->getParams(env), hash, fatal); +} + +/////////////////////////////////////////////////////////////////////////////// +// instance methods and properties + +bool ObjectData::o_exists(CStrRef propName, int64 hash) const { + return propName.size() > 0 && o_properties && o_properties->exists(propName); +} + +Variant ObjectData::o_get(CStrRef propName, int64 hash) { + if (propName.size() == 0) { + return null; + } + if (o_properties && o_properties->exists(propName)) { + return o_properties->rvalAt(propName); + } + return t___get(propName); +} + +Variant ObjectData::o_getUnchecked(CStrRef propName, int64 hash) { + return o_get(propName, hash); +} + +Variant ObjectData::o_set(CStrRef propName, int64 hash, CVarRef v, + bool forInit /* = false */) { + if (propName.size() == 0) { + throw EmptyObjectPropertyException(); + } + if (forInit) { + return ObjectData::t___set(propName, v); + } else { + return t___set(propName, v); + } +} + +void ObjectData::o_set(const Array properties) { + for (ArrayIter iter(properties); iter; ++iter) { + o_set(iter.first().toString(), -1, iter.second()); + } +} + +CVarRef ObjectData::set(CStrRef s, CVarRef v) { + o_set(s, -1, v); + return v; +} + +Variant &ObjectData::o_lval(CStrRef propName, int64 hash) { + if (propName.size() == 0) { + throw EmptyObjectPropertyException(); + } + if (o_properties) { + return o_properties->lvalAt(propName, hash); + } + return ___lval(propName); +} + +Array ObjectData::o_toArray() const { + vector props; + o_get(props); + Array ret(ArrayData::Create(props, false)); + if (o_properties && !o_properties->empty()) { + return ret.merge(*o_properties); + } + return ret; +} + +Array ObjectData::o_toIterArray(const char *context) { + const char *object_class = o_getClassName(); + const ClassInfo *classInfo = ClassInfo::FindClass(object_class); + const ClassInfo *contextClassInfo = NULL; + int category; + + if (!classInfo) return Array::Create(); + + Array ret = Array::Create(); + + // There are 3 cases: + // (1) called from standalone function (this_object == null) or + // the object class is not related to the context class; + // (2) the object class is a subclass of the context class or vice versa. + // (3) the object class is the same as the context class + // For (1), only public properties of the object are accessible. + // For (2) and (3), the public/protected properties of the object are + // accessible; + // any property of the context class is also accessible unless it is + // overriden by the object class. (3) is really just an optimization. + if (context == NULL || !*context) { + category = 1; + } else { + contextClassInfo = ClassInfo::FindClass(context); + ASSERT(contextClassInfo); + if (strcasecmp(object_class, context) == 0) { + category = 3; + } else if (classInfo->derivesFrom(context, false) || + contextClassInfo->derivesFrom(object_class, false)) { + category = 2; + } else { + category = 1; + } + } + + ClassInfo::PropertyVec properties; + classInfo->getAllProperties(properties); + ClassInfo::PropertyMap contextProperties; + if (category == 2) { + contextClassInfo->getAllProperties(contextProperties); + } + Array dynamics = o_getDynamicProperties(); + for (ClassInfo::PropertyVec::const_iterator iter = properties.begin(); + iter != properties.end(); ++iter) { + if ((*iter)->attribute & ClassInfo::IsStatic) continue; + + bool visible = false; + switch (category) { + case 1: + visible = ((*iter)->attribute & ClassInfo::IsPublic); + break; + case 2: + if (((*iter)->attribute & ClassInfo::IsPrivate) == 0) { + visible = true; + } else { + ClassInfo::PropertyMap::const_iterator iterProp = + contextProperties.find((*iter)->name); + if (iterProp != contextProperties.end() && + iterProp->second->owner == contextClassInfo) { + visible = true; + } else { + visible = false; + } + } + break; + case 3: + if (((*iter)->attribute & ClassInfo::IsPrivate) == 0 || + (*iter)->owner == classInfo) { + visible = true; + } + break; + default: + ASSERT(false); + } + if (visible) { + ret.set((*iter)->name, o_getUnchecked((*iter)->name, -1)); + } + dynamics.remove((*iter)->name); + } + if (dynamics.size()) { + ret.merge(dynamics); + } + return ret; +} + +Array ObjectData::o_getDynamicProperties() const { + if (o_properties) return *o_properties; + return Array(); +} + +Variant ObjectData::o_invoke(const char *s, CArrRef params, int64 hash, + bool fatal /* = true */) { + return doCall(s, params, fatal); +} + +Variant ObjectData::o_root_invoke(const char *s, CArrRef params, int64 hash, + bool fatal /* = true */) { + return o_invoke(s, params, hash, fatal); +} + +Variant ObjectData::o_invoke_ex(const char *clsname, const char *s, + CArrRef params, int64 hash, + bool fatal /* = true */) { + if (fatal) { + throw InvalidClassException(clsname); + } else { + return false; + } +} + +Variant ObjectData::o_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 /* = null_variant */, + CVarRef a1 /* = null_variant */, + CVarRef a2 /* = null_variant */ +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 /* = null_variant */, + CVarRef a4 /* = null_variant */, + CVarRef a5 /* = null_variant */ +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 /* = null_variant */, + CVarRef a7 /* = null_variant */, + CVarRef a8 /* = null_variant */, + CVarRef a9 /* = null_variant */ +#endif +) { + switch (count) { + case 0: { + return ObjectData::o_invoke(s, Array(), hash); + } + case 1: { + Array params(NEW(ArrayElement)(a0), NULL); + return ObjectData::o_invoke(s, params, hash); + } + case 2: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), NULL); + return ObjectData::o_invoke(s, params, hash); + } + case 3: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NULL); + return ObjectData::o_invoke(s, params, hash); + } +#if INVOKE_FEW_ARGS_COUNT > 3 + case 4: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), NULL); + return ObjectData::o_invoke(s, params, hash); + } + case 5: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NULL); + return ObjectData::o_invoke(s, params, hash); + } + case 6: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), NULL); + return ObjectData::o_invoke(s, params, hash); + } +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + case 7: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NULL); + return ObjectData::o_invoke(s, params, hash); + } + case 8: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NEW(ArrayElement)(a7), NULL); + return ObjectData::o_invoke(s, params, hash); + } + case 9: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NEW(ArrayElement)(a7), + NEW(ArrayElement)(a8), NULL); + return ObjectData::o_invoke(s, params, hash); + } + case 10: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NEW(ArrayElement)(a7), + NEW(ArrayElement)(a8), NEW(ArrayElement)(a9), NULL); + return ObjectData::o_invoke(s, params, hash); + } +#endif + default: + ASSERT(false); + } + return null; +} + +Variant ObjectData::o_root_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 /* = null_variant */, + CVarRef a1 /* = null_variant */, + CVarRef a2 /* = null_variant */ +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 /* = null_variant */, + CVarRef a4 /* = null_variant */, + CVarRef a5 /* = null_variant */ +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 /* = null_variant */, + CVarRef a7 /* = null_variant */, + CVarRef a8 /* = null_variant */, + CVarRef a9 /* = null_variant */ +#endif +) { + return o_invoke_few_args(s, hash, count, a0, a1, a2 +#if INVOKE_FEW_ARGS_COUNT > 3 + ,a3, a4, a5 +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,a6, a7, a8, a9 +#endif + ); +} + +Variant ObjectData::o_invoke_from_eval(const char *s, + Eval::VariableEnvironment &env, + const Eval::FunctionCallExpression *call, + int64 hash, + bool fatal /* = true */) { + return o_invoke(s, call->getParams(env), hash, fatal); +} + +Variant ObjectData::o_throw_fatal(const char *msg) { + throw_fatal(msg); + return null; +} + +void ObjectData::serialize(VariableSerializer *serializer) const { + if (serializer->incNestedLevel((void*)this, true)) { + serializer->writeOverflow((void*)this, true); + } else { + serializer->setObjectInfo(o_getClassName(), o_getId()); + o_toArray().serialize(serializer); + } + serializer->decNestedLevel((void*)this); +} + +void ObjectData::dump() const { + o_toArray().dump(); +} + +ObjectData *ObjectData::clone() { + ObjectData *clone = cloneImpl(); + return clone; +} + +void ObjectData::cloneSet(ObjectData *clone) { + if (o_properties) { + clone->o_properties = NEW(Array)(*o_properties); + } +} + +Variant ObjectData::doCall(Variant v_name, Variant v_arguments, bool fatal) { + return o_invoke_failed(o_getClassName(), v_name.toString().data(), fatal); +} + +/////////////////////////////////////////////////////////////////////////////// +// magic methods that user classes can override, and these are default handlers +// or actions to take: + +Variant ObjectData::t___destruct() { + // do nothing + return null; +} + +Variant ObjectData::t___call(Variant v_name, Variant v_arguments) { + // do nothing + return null; +} + +void ObjectData::setInCall(CStrRef name) { + if (++o_inCall > 10) { + string msg = "Too many levels of recursion in __call() while calling "; + msg += (const char *)name; + throw FatalErrorException(msg.c_str()); + } +} + +Variant ObjectData::t___set(Variant v_name, Variant v_value) { + if (!o_properties) { + o_properties = NEW(Array)(); + } + if (v_value.isReferenced()) { + o_properties->set(v_name, ref(v_value)); + } else { + o_properties->set(v_name, v_value); + } + return null; +} + +Variant ObjectData::t___get(Variant v_name) { + if (!o_properties) { + // this is needed, since a get() is actually going to create a null + // element in properties array + o_properties = NEW(Array)(); + } + return o_properties->rvalAt(v_name); +} + +Variant &ObjectData::___lval(Variant v_name) { + if (!o_properties) { + // this is needed, since a lval() is actually going to create a null + // element in properties array + o_properties = NEW(Array)(); + } + return o_properties->lvalAt(v_name); +} +Variant &ObjectData::___offsetget_lval(Variant v_name) { + return ___lval(v_name); +} +bool ObjectData::t___isset(Variant v_name) { + if (!o_exists(v_name.toString(), -1)) return false; + Variant v = o_get(v_name.toString(), -1); + return isset(v); +} + +Variant ObjectData::t___unset(Variant v_name) { + unset(o_lval(v_name.toString(), -1)); + return null; +} + +Variant ObjectData::t___sleep() { + // do nothing + return null; +} + +Variant ObjectData::t___wakeup() { + // do nothing + return null; +} + +Variant ObjectData::t___set_state(Variant v_properties) { + // do nothing + return null; +} + +String ObjectData::t___tostring() { + string msg = o_getClassName(); + msg += "::__toString() was not defined"; + throw BadTypeConversionException(msg.c_str()); +} + +Variant ObjectData::t___clone() { + // do nothing + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/object_data.h b/src/cpp/base/object_data.h new file mode 100644 index 0000000000000..f3cf1ac251b1c --- /dev/null +++ b/src/cpp/base/object_data.h @@ -0,0 +1,308 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_OBJECT_DATA_H__ +#define __HPHP_OBJECT_DATA_H__ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// Needed for eval +namespace Eval { +class MethodStatement; +class FunctionCallExpression; +class VariableEnvironment; +} + +/** + * Base class of all user-defined classes. All data members and methods in + * this class should start with "o_" or "os_" to avoid name conflicts. + * + * Calling sequence: + * + * 1. Statically resolved properties and methods will be statically called. + * 2. Dynamic properties: + * o_get() -> t___get() as fallback + * o_lval() -> o_set() -> t___set() as fallback + * 3. Dynamic methods: + * o_invoke() -> t___call() as fallback + * 4. Auto-generated jump-tables: + * o_exists() + * o_get() + * o_set() + * o_lval() + * o_invoke() + */ +class ObjectData : public Countable { + public: + enum Attribute { + inConstructor = 1, // __construct() + inDestructor = 2, // __destruct() + }; + + public: + ObjectData(); + virtual ~ObjectData(); // all PHP classes need virtual tables + + bool getAttribute(Attribute attr) const { return o_attribute & attr; } + void setAttribute(Attribute attr) { o_attribute |= attr;} + void clearAttribute(Attribute attr) { o_attribute &= ~attr;} + bool inDtor() { return getAttribute(inDestructor); } + bool inCtor() { return getAttribute(inConstructor); } + bool inCtorDtor() { return inCtor() || inDtor(); } + void setInDtor() { setAttribute(inDestructor); } + void setInCall(CStrRef name); + void clearInCall() { --o_inCall;} + bool gasInCtor(bool inCtor) { // get and set inConstructor + bool oldInCtor = getAttribute(inConstructor); + if (inCtor) { + setAttribute(inConstructor); + } else { + clearAttribute(inConstructor); + } + return oldInCtor; + } + + // class info + virtual const char *o_getClassName() const = 0; + virtual bool o_instanceof(const char *s) const = 0; + virtual bool isResource() const { return false;} + virtual int64 o_toInt64() const { return 1;} + bool o_isClass(const char *s) const; + int o_getId() const { return o_id;} + + virtual void init() {} + ObjectData *create() { init(); return this;} + ObjectData *dynCreate(const Array ¶ms, bool init = true) { + if (init) return create(); + return this; + } + virtual void dynConstruct(CArrRef params) {} + virtual void release() { destruct(); delete this; } // for SmartPtr + virtual void destruct() {} + + virtual const + Eval::MethodStatement *getMethodStatement(const char* name) const; + + // static methods and properties + static Variant os_get(const char *s, int64 hash); + static Variant &os_lval(const char *s, int64 hash); + static Variant os_invoke(const char *c, const char *s, + CArrRef params, int64 hash, bool fatal = true); + static Variant os_constant(const char *s); + + static Variant os_invoke_from_eval(const char *c, const char *s, + Eval::VariableEnvironment &env, + const Eval::FunctionCallExpression *call, + int64 hash, + bool fatal /* = true */); + + // properties + virtual Array o_toArray() const; + virtual Array o_toIterArray(const char *context); + virtual Array o_getDynamicProperties() const; + virtual bool o_exists(CStrRef s, int64 hash) const; + virtual void o_get(std::vector &props) const {} + virtual Variant o_get(CStrRef s, int64 hash); + virtual Variant o_getUnchecked(CStrRef s, int64 hash); + virtual Variant o_set(CStrRef s, int64 hash, CVarRef v, bool forInit = false); + virtual Variant &o_lval(CStrRef s, int64 hash); + void o_set(const Array properties); + + CVarRef set(CStrRef s, CVarRef v); + + // methods + virtual Variant o_invoke(const char *s, CArrRef params, int64 hash, + bool fatal = true); + virtual Variant o_root_invoke(const char *s, CArrRef params, int64 hash, + bool fatal = false); + virtual Variant o_invoke_ex(const char *clsname, const char *s, + CArrRef params, int64 hash, bool fatal = true); + + virtual Variant o_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 = null_variant, + CVarRef a1 = null_variant, + CVarRef a2 = null_variant +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 = null_variant, + CVarRef a4 = null_variant, + CVarRef a5 = null_variant +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 = null_variant, + CVarRef a7 = null_variant, + CVarRef a8 = null_variant, + CVarRef a9 = null_variant +#endif +); + virtual Variant o_root_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 = null_variant, + CVarRef a1 = null_variant, + CVarRef a2 = null_variant +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 = null_variant, + CVarRef a4 = null_variant, + CVarRef a5 = null_variant +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 = null_variant, + CVarRef a7 = null_variant, + CVarRef a8 = null_variant, + CVarRef a9 = null_variant +#endif +); + virtual Variant o_invoke_from_eval(const char *s, + Eval::VariableEnvironment &env, + const Eval::FunctionCallExpression *call, + int64 hash, + bool fatal /* = true */); + // misc + Variant o_throw_fatal(const char *msg); + virtual void serialize(VariableSerializer *serializer) const; + virtual void dump() const; + virtual ObjectData *clone(); + virtual void setRoot(ObjectData *root) {} + /** + * If __call is defined, then this gets overridden to call it. + * Otherwise, it just throws if fatal else returns false. + */ + virtual Variant doCall(Variant v_name, Variant v_arguments, bool fatal); + + // magic methods + // __construct is handled in a special way + virtual Variant t___destruct(); + virtual Variant t___call(Variant v_name, Variant v_arguments); + virtual Variant t___set(Variant v_name, Variant v_value); + virtual Variant t___get(Variant v_name); + virtual Variant &___lval(Variant v_name); + virtual Variant &___offsetget_lval(Variant v_name); + virtual bool t___isset(Variant v_name); + virtual Variant t___unset(Variant v_name); + virtual Variant t___sleep(); + virtual Variant t___wakeup(); + virtual Variant t___set_state(Variant v_properties); + virtual String t___tostring(); + virtual Variant t___clone(); + + protected: + virtual ObjectData* cloneImpl() = 0; + void cloneSet(ObjectData *clone); + int o_id; // a numeric identifier of this object + mutable Array *o_properties; // dynamic properties + + private: + mutable int16 o_attribute; // vairous flags + mutable int16 o_inCall; // counter for __call() recursion checking + +private: + ObjectData(const ObjectData &) { ASSERT(false);} +}; + +typedef ObjectData c_ObjectData; // purely for easier code generation + +/////////////////////////////////////////////////////////////////////////////// +// breaking circular dependencies + +template +void Variant::weakRemove(const T &key, int64 prehash /* = -1 */) { + if (is(KindOfArray) || + (is(KindOfObject) && getObjectData()->o_instanceof("arrayaccess"))) { + remove(key, prehash); + } +} + +template +Variant &Variant::lvalAtImpl(const T &key, int64 prehash /* = -1 */) { + if (m_type == KindOfVariant) { + return m_data.pvar->lvalAtImpl(key, prehash); + } + if (isNull() || + (is(KindOfBoolean) && !toBoolean()) || + (is(LiteralString) && !*getLiteralString()) || + (is(KindOfString) && getStringData()->empty())) { + unset(); + set(toArray()); + } + if (is(KindOfArray)) { + Variant *ret = NULL; + ArrayData *arr = m_data.parr; + ArrayData *escalated = arr->lval(key, ret, arr->getCount() > 1, prehash); + if (escalated) { + set(escalated); + } + ASSERT(ret); + return *ret; + } + if (is(KindOfObject)) { + return getArrayAccess()->___offsetget_lval(key); + } + return lvalInvalid(); +} + +template +Variant Variant::refvalAtImpl(const T &key, int64 prehash /* = -1 */) { + if (m_type == KindOfVariant) { + return m_data.pvar->refvalAtImpl(key, prehash); + } + if (is(KindOfArray) || isNull() || + (is(KindOfBoolean) && !toBoolean()) || + (is(LiteralString) && !*getLiteralString()) || + (is(KindOfString) && getStringData()->empty())) { + return ref(lvalAt(key, prehash)); + } else { + return rvalAt(key, prehash); + } + +} + +/////////////////////////////////////////////////////////////////////////////// +// Calculate item sizes for object allocators + +#define WORD_SIZE sizeof(void *) +#define ALIGN_WORD(n) (n + (WORD_SIZE - n % WORD_SIZE) % WORD_SIZE) +#define UNIT_SIZE sizeof(ObjectData) + +template +class ItemSize { +public: + enum { + prev = (M + M + 3) / 3 >= UNIT_SIZE ? (M + M + 3) / 3 : UNIT_SIZE, + value = (ItemSize::value < M ? + ALIGN_WORD(ItemSize::value + (ItemSize::value >> 1)) : + ItemSize::value) + }; +}; + +template<> +class ItemSize { +public: + enum { + prev = 0, + value = UNIT_SIZE + }; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_OBJECT_DATA_H__ diff --git a/src/cpp/base/object_offset.cpp b/src/cpp/base/object_offset.cpp new file mode 100644 index 0000000000000..110b636e6001d --- /dev/null +++ b/src/cpp/base/object_offset.cpp @@ -0,0 +1,19 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// diff --git a/src/cpp/base/object_offset.h b/src/cpp/base/object_offset.h new file mode 100644 index 0000000000000..eca6843c86203 --- /dev/null +++ b/src/cpp/base/object_offset.h @@ -0,0 +1,168 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_OBJECT_OFFSET_H__ +#define __HPHP_OBJECT_OFFSET_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * An object's "offset" is actually its property and it's always string based. + * This class should delegate all real work to ObjectData. + */ +class ObjectOffset { + public: + /** + * Constructing an object offset object. "hash" is optional and can be -1 + * when property was not a literal string during code generation time. + */ + ObjectOffset(ObjectData *data, CStrRef property, int64 hash) + : m_data(data), m_property(property), m_hash(hash) { + } + + /** + * Get r-value of this offset object. + */ + operator Variant() const { + if (m_data) { + return m_data->o_get(m_property, m_hash); + } + return null; + } + + /** + * Get l-value of this offset object. + */ + Variant &lval() const { + if (!m_data) { + throw NullPointerException(); + } + return m_data->o_lval(m_property, m_hash); + } + + /** + * Assignement operator. Almost the whole purpose for having this offset + * class. + */ + ObjectOffset &operator=(CVarRef v) { + if (m_data) { + m_data->o_set(m_property, m_hash, v, false); + } + return *this; + } + ObjectOffset &operator=(const ObjectOffset &offset) { + operator=((Variant)offset); + return *this; + } + + /** + * Operator overloading. rvalAt() and lvalAt() could be type-specialized, + * but these are rare calls, I think. + */ + Variant &operator>>=(CVarRef v) { + Variant &lv = lval(); + if (m_data) { + m_data->o_set(m_property, m_hash, lv.toInt64() >> v.toInt64()); + } + return lv; + } + Variant &operator<<=(CVarRef v) { + Variant &lv = lval(); + if (m_data) { + m_data->o_set(m_property, m_hash, lv.toInt64() << v.toInt64()); + } + return lv; + } + Variant &operator^=(CVarRef v) { + Variant &lv = lval(); + if (m_data) { + m_data->o_set(m_property, m_hash, lv ^ v); + } + return lv; + } + Variant &operator|=(CVarRef v) { + Variant &lv = lval(); + if (m_data) { + m_data->o_set(m_property, m_hash, lv | v); + } + return lv; + } + Variant &operator&=(CVarRef v) { + Variant &lv = lval(); + if (m_data) { + m_data->o_set(m_property, m_hash, lv & v); + } + return lv; + } + Variant &operator+=(CVarRef v) { + Variant &lv = lval(); + if (m_data) { + m_data->o_set(m_property, m_hash, lv + v); + } + return lv; + } + Variant &operator-=(CVarRef v) { + Variant &lv = lval(); + if (m_data) { + m_data->o_set(m_property, m_hash, lv - v); + } + return lv; + } + Variant &operator*=(CVarRef v) { + Variant &lv = lval(); + if (m_data) { + m_data->o_set(m_property, m_hash, lv * v); + } + return lv; + } + Variant &operator/=(CVarRef v) { + Variant &lv = lval(); + if (m_data) { + m_data->o_set(m_property, m_hash, lv / v); + } + return lv; + } + Variant &operator%=(CVarRef v) { + Variant &lv = lval(); + if (m_data) { + m_data->o_set(m_property, m_hash, lv % v); + } + return lv; + } + + Variant rvalAt(const Primitive &key, int64 hash = -1) { + return operator Variant().rvalAt(key, hash); + } + Variant &lvalAt(const Primitive &key, int64 hash = -1) { + return lval().lvalAt(key, hash); + } + + private: + ObjectData *m_data; + String m_property; + int64 m_hash; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_OBJECT_OFFSET_H__ diff --git a/src/cpp/base/preg.cpp b/src/cpp/base/preg.cpp new file mode 100644 index 0000000000000..24d1ff3303a1a --- /dev/null +++ b/src/cpp/base/preg.cpp @@ -0,0 +1,1368 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include +#include +#include +#include + +#define PREG_PATTERN_ORDER 1 +#define PREG_SET_ORDER 2 +#define PREG_OFFSET_CAPTURE (1<<8) + +#define PREG_SPLIT_NO_EMPTY (1<<0) +#define PREG_SPLIT_DELIM_CAPTURE (1<<1) +#define PREG_SPLIT_OFFSET_CAPTURE (1<<2) + +#define PREG_REPLACE_EVAL (1<<0) + +#define PREG_GREP_INVERT (1<<0) + +#define PCRE_CACHE_SIZE 4096 + +enum { + PHP_PCRE_NO_ERROR = 0, + PHP_PCRE_INTERNAL_ERROR, + PHP_PCRE_BACKTRACK_LIMIT_ERROR, + PHP_PCRE_RECURSION_LIMIT_ERROR, + PHP_PCRE_BAD_UTF8_ERROR, +}; + +#define BACKTRACE_LIMIT 100000 +#define RECURSION_LIMIT 100000 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// regex cache and helpers + +class pcre_cache_entry { +public: + ~pcre_cache_entry() { + free(re); + if (extra) free(extra); +#if HAVE_SETLOCALE + free(locale); + if (tables) free(tables); +#endif + } + + pcre *re; + pcre_extra *extra; // Holds results of studying + int preg_options; +#if HAVE_SETLOCALE + char *locale; + unsigned const char *tables; +#endif + int compile_options; +}; +typedef std::map PCRECache; + +class PCREData : public RequestEventHandler { +public: + ~PCREData() { + cleanup(); + } + + void cleanup() { + for (PCRECache::iterator iter = cache.begin(); iter != cache.end(); + ++iter) { + delete iter->second; + } + cache.clear(); + } + + virtual void requestInit() { + cleanup(); + } + + virtual void requestShutdown() { + cleanup(); + } + + PCRECache cache; + int error_code; + pcre_extra extra_data; +}; +static RequestLocal s_pcre_data; + +static pcre_cache_entry *pcre_get_compiled_regex_cache(CStrRef regex) { + PCRECache &pcre_cache = s_pcre_data->cache; + + /* Try to lookup the cached regex entry, and if successful, just pass + back the compiled pattern, otherwise go on and compile it. */ + std::string sregex(regex.data(), regex.size()); + PCRECache::const_iterator iter = pcre_cache.find(sregex); + if (iter != pcre_cache.end()) { + pcre_cache_entry *pce = iter->second; + /** + * We use a quick pcre_info() check to see whether cache is corrupted, + * and if it is, we flush it and compile the pattern from scratch. + */ + if (pcre_info(pce->re, NULL, NULL) == PCRE_ERROR_BADMAGIC) { + for (iter = pcre_cache.begin(); iter != pcre_cache.end(); ++iter) { + delete iter->second; + } + pcre_cache.clear(); + } else { +#if HAVE_SETLOCALE + if (!strcmp(pce->locale, locale)) { +#endif + return pce; +#if HAVE_SETLOCALE + } +#endif + } + } + + /* Parse through the leading whitespace, and display a warning if we + get to the end without encountering a delimiter. */ + const char *p = regex.data(); + while (isspace((int)*(unsigned char *)p)) p++; + if (*p == 0) { + Logger::Warning("Empty regular expression"); + return NULL; + } + + /* Get the delimiter and display a warning if it is alphanumeric + or a backslash. */ + char delimiter = *p++; + if (isalnum((int)*(unsigned char *)&delimiter) || delimiter == '\\') { + Logger::Warning("Delimiter must not be alphanumeric or backslash"); + return NULL; + } + + char start_delimiter = delimiter; + const char *pp = strchr("([{< )]}> )]}>", delimiter); + if (pp) { + delimiter = pp[5]; + } + char end_delimiter = delimiter; + + if (start_delimiter == end_delimiter) { + /* We need to iterate through the pattern, searching for the ending + * delimiter, but skipping the backslashed delimiters. If the ending + * delimiter is not found, display a warning. */ + pp = p; + while (*pp != 0) { + if (*pp == '\\' && pp[1] != 0) pp++; + else if (*pp == delimiter) + break; + pp++; + } + if (*pp == 0) { + Logger::Warning("No ending delimiter '%c' found: [%s]", delimiter, + regex.data()); + return NULL; + } + } else { + /* We iterate through the pattern, searching for the matching ending + * delimiter. For each matching starting delimiter, we increment nesting + * level, and decrement it for each matching ending delimiter. If we + * reach the end of the pattern without matching, display a warning. + */ + int brackets = 1; // brackets nesting level + pp = p; + while (*pp != 0) { + if (*pp == '\\' && pp[1] != 0) pp++; + else if (*pp == end_delimiter && --brackets <= 0) + break; + else if (*pp == start_delimiter) + brackets++; + pp++; + } + if (*pp == 0) { + Logger::Warning("No ending matching delimiter '%c' found: [%s]", + end_delimiter, regex.data()); + return NULL; + } + } + + /* Make a copy of the actual pattern. */ + String spattern(p, pp-p, CopyString); + const char *pattern = spattern.data(); + + /* Move on to the options */ + pp++; + + /* Parse through the options, setting appropriate flags. Display + a warning if we encounter an unknown modifier. */ + int coptions = 0; + int poptions = 0; + int do_study = false; + while (*pp != 0) { + switch (*pp++) { + /* Perl compatible options */ + case 'i': coptions |= PCRE_CASELESS; break; + case 'm': coptions |= PCRE_MULTILINE; break; + case 's': coptions |= PCRE_DOTALL; break; + case 'x': coptions |= PCRE_EXTENDED; break; + + /* PCRE specific options */ + case 'A': coptions |= PCRE_ANCHORED; break; + case 'D': coptions |= PCRE_DOLLAR_ENDONLY; break; + case 'S': do_study = true; break; + case 'U': coptions |= PCRE_UNGREEDY; break; + case 'X': coptions |= PCRE_EXTRA; break; + case 'u': coptions |= PCRE_UTF8; break; + + /* Custom preg options */ + case 'e': poptions |= PREG_REPLACE_EVAL; break; + + case ' ': + case '\n': + break; + + default: + Logger::Warning("Unknown modifier '%c': [%s]", pp[-1], regex.data()); + return NULL; + } + } + + unsigned const char *tables = NULL; +#if HAVE_SETLOCALE + if (strcmp(locale, "C")) { + tables = pcre_maketables(); + } +#endif + + /* Compile pattern and display a warning if compilation failed. */ + const char *error; + int erroffset; + pcre *re = pcre_compile(pattern, coptions, &error, &erroffset, tables); + if (re == NULL) { + Logger::Warning("Compilation failed: %s at offset %d", error, erroffset); + if (tables) { + free((void*)tables); + } + return NULL; + } + + /* If study option was specified, study the pattern and + store the result in extra for passing to pcre_exec. */ + pcre_extra *extra = NULL; + if (do_study) { + int soptions = 0; + extra = pcre_study(re, soptions, &error); + if (extra) { + extra->flags |= PCRE_EXTRA_MATCH_LIMIT | + PCRE_EXTRA_MATCH_LIMIT_RECURSION; + } + if (error != NULL) { + Logger::Warning("Error while studying pattern"); + } + } + + /* Store the compiled pattern and extra info in the cache. */ + pcre_cache_entry *new_entry = new pcre_cache_entry(); + new_entry->re = re; + new_entry->extra = extra; + new_entry->preg_options = poptions; + new_entry->compile_options = coptions; +#if HAVE_SETLOCALE + char *locale = setlocale(LC_CTYPE, NULL); + new_entry->locale = strdup(locale); + new_entry->tables = tables; +#endif + if (iter != pcre_cache.end()) { + delete iter->second; + } + pcre_cache[sregex] = new_entry; + return new_entry; +} + +static int *create_offset_array(pcre_cache_entry *pce, int &size_offsets) { + pcre_extra *extra = pce->extra; + if (extra == NULL) { + pcre_extra &extra_data = s_pcre_data->extra_data; + extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | + PCRE_EXTRA_MATCH_LIMIT_RECURSION; + extra = &extra_data; + } + extra->match_limit = BACKTRACE_LIMIT; + extra->match_limit_recursion = RECURSION_LIMIT; + + /* Calculate the size of the offsets array, and allocate memory for it. */ + int num_subpats; // Number of captured subpatterns + int rc = pcre_fullinfo(pce->re, extra, PCRE_INFO_CAPTURECOUNT, &num_subpats); + if (rc < 0) { + Logger::Warning("Internal pcre_fullinfo() error %d", rc); + return NULL; + } + num_subpats++; + size_offsets = num_subpats * 3; + return (int *)malloc(size_offsets * sizeof(int)); +} + +static pcre* pcre_get_compiled_regex(CStrRef regex, pcre_extra **extra, + int *preg_options) { + pcre_cache_entry *pce = pcre_get_compiled_regex_cache(regex); + if (extra) { + *extra = pce ? pce->extra : NULL; + } + if (preg_options) { + *preg_options = pce ? pce->preg_options : 0; + } + return pce ? pce->re : NULL; +} + +static inline void add_offset_pair(Variant &result, CStrRef str, int offset, + const char *name) { + Array match_pair; + match_pair.append(str); + match_pair.append(offset); + + if (name) { + result.set(name, match_pair); + } + result.append(match_pair); +} + +static void pcre_handle_exec_error(int pcre_code) { + int preg_code = 0; + switch (pcre_code) { + case PCRE_ERROR_MATCHLIMIT: + preg_code = PHP_PCRE_BACKTRACK_LIMIT_ERROR; + break; + case PCRE_ERROR_RECURSIONLIMIT: + preg_code = PHP_PCRE_RECURSION_LIMIT_ERROR; + break; + case PCRE_ERROR_BADUTF8: + preg_code = PHP_PCRE_BAD_UTF8_ERROR; + break; + default: + preg_code = PHP_PCRE_INTERNAL_ERROR; + break; + } + s_pcre_data->error_code = preg_code; +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant preg_grep(CStrRef pattern, CArrRef input, int flags /* = 0 */) { + pcre_cache_entry *pce = pcre_get_compiled_regex_cache(pattern); + if (pce == NULL) { + return false; + } + + int size_offsets = 0; + int *offsets = create_offset_array(pce, size_offsets); + if (offsets == NULL) { + return false; + } + + /* Initialize return array */ + Array ret = Array::Create(); + s_pcre_data->error_code = PHP_PCRE_NO_ERROR; + + /* Go through the input array */ + bool invert = (flags & PREG_GREP_INVERT); + pcre_extra *extra = pce->extra; + for (ArrayIter iter(input); iter; ++iter) { + String entry = iter.second().toString(); + + /* Perform the match */ + int count = pcre_exec(pce->re, extra, entry.data(), entry.size(), + 0, 0, offsets, size_offsets); + + /* Check for too many substrings condition. */ + if (count == 0) { + Logger::Warning("Matched, but too many substrings"); + count = size_offsets / 3; + } else if (count < 0 && count != PCRE_ERROR_NOMATCH) { + pcre_handle_exec_error(count); + break; + } + + /* If the entry fits our requirements */ + if ((count > 0 && !invert) || + (count == PCRE_ERROR_NOMATCH && invert)) { + + /* Add to return array */ + ret.set(iter.first(), entry); + } + } + + /* Clean up */ + free(offsets); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant preg_match_impl(CStrRef pattern, CStrRef subject, + Variant &subpats, int flags, int start_offset, + bool global) { + pcre_cache_entry *pce = pcre_get_compiled_regex_cache(pattern); + if (pce == NULL) { + return false; + } + + pcre_extra *extra = pce->extra; + subpats = Array::Create(); + + int subpats_order = global ? PREG_PATTERN_ORDER : 0; + bool offset_capture = false; + if (flags) { + offset_capture = flags & PREG_OFFSET_CAPTURE; + + /* + * subpats_order is pre-set to pattern mode so we change it only if + * necessary. + */ + if (flags & 0xff) { + subpats_order = flags & 0xff; + } + if ((global && (subpats_order < PREG_PATTERN_ORDER || + subpats_order > PREG_SET_ORDER)) || + (!global && subpats_order != 0)) { + Logger::Warning("Invalid flags specified"); + return false; + } + } + + /* Negative offset counts from the end of the string. */ + if (start_offset < 0) { + start_offset = subject.size() + start_offset; + if (start_offset < 0) { + start_offset = 0; + } + } + + int size_offsets = 0; + int *offsets = create_offset_array(pce, size_offsets); + int num_subpats = size_offsets / 3; + if (offsets == NULL) { + return false; + } + + /* + * Build a mapping from subpattern numbers to their names. We will always + * allocate the table, even though there may be no named subpatterns. This + * avoids somewhat more complicated logic in the inner loops. + */ + char **subpat_names = (char **)malloc(num_subpats * sizeof(char *)); + memset(subpat_names, 0, sizeof(char *) * num_subpats); + { + int name_cnt = 0, name_size, ni = 0; + char *name_table; + unsigned short name_idx; + + int rc = pcre_fullinfo(pce->re, extra, PCRE_INFO_NAMECOUNT, &name_cnt); + if (rc < 0) { + Logger::Warning("Internal pcre_fullinfo() error %d", rc); + free(offsets); + free(subpat_names); + return false; + } + if (name_cnt > 0) { + int rc1, rc2; + rc1 = pcre_fullinfo(pce->re, extra, PCRE_INFO_NAMETABLE, &name_table); + rc2 = pcre_fullinfo(pce->re, extra, PCRE_INFO_NAMEENTRYSIZE, &name_size); + rc = rc2 ? rc2 : rc1; + if (rc < 0) { + Logger::Warning("Internal pcre_fullinfo() error %d", rc); + free(offsets); + free(subpat_names); + return false; + } + + while (ni++ < name_cnt) { + name_idx = 0xff * name_table[0] + name_table[1]; + subpat_names[name_idx] = name_table + 2; + if (is_numeric_string(subpat_names[name_idx], + strlen(subpat_names[name_idx]), + NULL, NULL, 0) > 0) { + Logger::Warning("Numeric named subpatterns are not allowed"); + free(offsets); + free(subpat_names); + return false; + } + name_table += name_size; + } + } + } + + /* Allocate match sets array and initialize the values. */ + Array match_sets; /* An array of sets of matches for each + subpattern after a global match */ + if (global && subpats_order == PREG_PATTERN_ORDER) { + for (int i = 0; i < num_subpats; i++) { + match_sets.set(i, Array::Create()); + } + } + + const char *match = NULL; + int matched = 0; + s_pcre_data->error_code = PHP_PCRE_NO_ERROR; + + Variant result_set; // Holds a set of subpatterns after a global match + int g_notempty = 0; // If the match should not be empty + const char **stringlist; // Holds list of subpatterns + int i; + do { + /* Execute the regular expression. */ + int count = pcre_exec(pce->re, extra, subject.data(), subject.size(), + start_offset, g_notempty, offsets, size_offsets); + + /* Check for too many substrings condition. */ + if (count == 0) { + Logger::Warning("Matched, but too many substrings"); + count = size_offsets / 3; + } + + /* If something has matched */ + if (count > 0) { + matched++; + match = subject.data() + offsets[0]; + + // Try to get the list of substrings and display a warning if failed. + if (pcre_get_substring_list(subject.data(), offsets, count, + &stringlist) < 0) { + free(offsets); + free(subpat_names); + Logger::Warning("Get subpatterns list failed"); + return false; + } + + if (global) { /* global pattern matching */ + if (subpats_order == PREG_PATTERN_ORDER) { + /* For each subpattern, insert it into the appropriate array. */ + for (i = 0; i < count; i++) { + if (offset_capture) { + add_offset_pair(match_sets.lvalAt(i), + String(stringlist[i], + offsets[(i<<1)+1] - offsets[i<<1], + CopyString), + offsets[i<<1], NULL); + } else { + match_sets.lvalAt(i).append + (String(stringlist[i], + offsets[(i<<1)+1] - offsets[i<<1], CopyString)); + } + } + /* + * If the number of captured subpatterns on this run is + * less than the total possible number, pad the result + * arrays with empty strings. + */ + if (count < num_subpats) { + for (; i < num_subpats; i++) { + match_sets.lvalAt(i).append(""); + } + } + } else { + result_set = Array::Create(); + + /* Add all the subpatterns to it */ + for (i = 0; i < count; i++) { + if (offset_capture) { + add_offset_pair(result_set, + String(stringlist[i], + offsets[(i<<1)+1] - offsets[i<<1], + CopyString), + offsets[i<<1], subpat_names[i]); + } else { + String value(stringlist[i], offsets[(i<<1)+1] - offsets[i<<1], + CopyString); + if (subpat_names[i]) { + result_set.set(subpat_names[i], value); + } + result_set.append(value); + } + } + /* And add it to the output array */ + subpats.append(result_set); + } + } else { /* single pattern matching */ + /* For each subpattern, insert it into the subpatterns array. */ + for (i = 0; i < count; i++) { + if (offset_capture) { + add_offset_pair(subpats, + String(stringlist[i], + offsets[(i<<1)+1] - offsets[i<<1], + CopyString), + offsets[i<<1], subpat_names[i]); + } else { + String value(stringlist[i], offsets[(i<<1)+1] - offsets[i<<1], + CopyString); + if (subpat_names[i]) { + subpats.set(subpat_names[i], value); + } + subpats.append(value); + } + } + } + + pcre_free((void *) stringlist); + } else if (count == PCRE_ERROR_NOMATCH) { + /* If we previously set PCRE_NOTEMPTY after a null match, + this is not necessarily the end. We need to advance + the start offset, and continue. Fudge the offset values + to achieve this, unless we're already at the end of the string. */ + if (g_notempty && start_offset < subject.size()) { + offsets[0] = start_offset; + offsets[1] = start_offset + 1; + } else + break; + } else { + pcre_handle_exec_error(count); + break; + } + + /* If we have matched an empty string, mimic what Perl's /g options does. + This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try + the match again at the same point. If this fails (picked up above) we + advance to the next character. */ + g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0; + + /* Advance to the position right after the last full match */ + start_offset = offsets[1]; + } while (global); + + /* Add the match sets to the output array and clean up */ + if (global && subpats_order == PREG_PATTERN_ORDER) { + for (i = 0; i < num_subpats; i++) { + if (subpat_names[i]) { + subpats.set(subpat_names[i], match_sets[i]); + } + subpats.append(match_sets[i]); + } + } + + free(offsets); + free(subpat_names); + return matched; +} + +Variant preg_match(CStrRef pattern, CStrRef subject, + Variant &matches, int flags /* = 0 */, + int offset /* = 0 */) { + return preg_match_impl(pattern, subject, matches, flags, offset, false); +} +Variant preg_match(CStrRef pattern, CStrRef subject, int flags /* = 0 */, + int offset /* = 0 */) { + Variant matches; + return preg_match_impl(pattern, subject, matches, flags, offset, false); +} + +Variant preg_match_all(CStrRef pattern, CStrRef subject, Variant &matches, + int flags /* = 0 */, int offset /* = 0 */) { + return preg_match_impl(pattern, subject, matches, flags, offset, true); +} +Variant preg_match_all(CStrRef pattern, CStrRef subject, + int flags /* = 0 */, int offset /* = 0 */) { + Variant matches; + return preg_match_impl(pattern, subject, matches, flags, offset, true); +} + +/////////////////////////////////////////////////////////////////////////////// + +static String preg_do_repl_func(CVarRef function, CStrRef subject, + int *offsets, int count) { + Array subpats = Array::Create(); + for (int i = 0; i < count; i++) { + subpats.append(subject.substr(offsets[i<<1], + offsets[(i<<1)+1] - offsets[i<<1])); + } + + Array args; + args.set(0, subpats); + return f_call_user_func_array(function, args); +} + +static bool preg_get_backref(const char **str, int *backref) { + register char in_brace = 0; + register const char *walk = *str; + + if (walk[1] == 0) { + return false; + } + + if (*walk == '$' && walk[1] == '{') { + in_brace = 1; + walk++; + } + walk++; + + if (*walk >= '0' && *walk <= '9') { + *backref = *walk - '0'; + walk++; + } else { + return false; + } + + if (*walk && *walk >= '0' && *walk <= '9') { + *backref = *backref * 10 + *walk - '0'; + walk++; + } + + if (in_brace) { + if (*walk == 0 || *walk != '}') { + return false; + } + walk++; + } + + *str = walk; + return true; +} + +static String php_pcre_replace(CStrRef pattern, CStrRef subject, + CVarRef replace_var, bool callable, + int limit, int *replace_count) { + pcre_cache_entry *pce = pcre_get_compiled_regex_cache(pattern); + if (pce == NULL) { + return false; + } + bool eval = false; + if (pce->preg_options & PREG_REPLACE_EVAL) { + if (callable) + throw NotSupportedException("preg_replace", + "Modifier /e cannot be used with replacement " + "callback."); + eval = true; + } + + int size_offsets; + int *offsets = create_offset_array(pce, size_offsets); + if (offsets == NULL) { + return false; + } + + const char *replace = NULL; + const char *replace_end = NULL; + int replace_len = 0; + String replace_val = replace_var.toString(); + String eval_fn; + if (eval) { + // Extract eval fn + int pidx = replace_val.find('('); + const char *rd = replace_val.data(); + int rs = replace_val.size(); + + if (!(rs >= 5 && pidx >= 0 && rd[pidx+1] == '"' && + ((rd[rs-2] == '"' && rd[rs-1] == ')') || + (rd[rs-3] == '"' && rd[rs-2] == ')' && rd[rs-1] == ';')))) { + throw NotSupportedException("preg_replace", + "Modifier /e must be used with the form " + "f(\"\") or " + "f(\"\");"); + } + eval_fn = replace_val.substr(0, pidx); + replace_val = replace_val.substr(pidx+1, rs - (pidx+1) - 1); + } + if (!callable) { + replace = replace_val.data(); + replace_len = replace_val.size(); + replace_end = replace + replace_len; + } + + int alloc_len = 2 * subject.size() + 1; + char *result = (char *)malloc(alloc_len); + + /* Initialize */ + const char *match = NULL; + int start_offset = 0; + s_pcre_data->error_code = PHP_PCRE_NO_ERROR; + pcre_extra *extra = pce->extra; + + int result_len = 0; + int new_len; // Length of needed storage + const char *walk; // Used to walk the replacement string + char walk_last; // Last walked character + char *walkbuf; // Location of current replacement in the result + int match_len; // Length of the current match + int backref; // Backreference number + int g_notempty = 0; // If the match should not be empty + while (1) { + /* Execute the regular expression. */ + int count = pcre_exec(pce->re, extra, subject.data(), subject.size(), + start_offset, g_notempty, offsets, size_offsets); + + /* Check for too many substrings condition. */ + if (count == 0) { + Logger::Warning("Matched, but too many substrings"); + count = size_offsets / 3; + } + + const char *piece = subject.data() + start_offset; + if (count > 0 && (limit == -1 || limit > 0)) { + if (replace_count) { + ++*replace_count; + } + /* Set the match location in subject */ + match = subject.data() + offsets[0]; + new_len = result_len + offsets[0] - start_offset; //part before the match + + /* If evaluating, do it and add the return string's length */ + String eval_result; + if (callable) { + /* Use custom function to get replacement string and its length. */ + eval_result = preg_do_repl_func(replace_var, subject, offsets, count); + new_len += eval_result.size(); + } else { /* do regular substitution */ + walk = replace; + walk_last = 0; + while (walk < replace_end) { + if ('\\' == *walk || '$' == *walk) { + if (walk_last == '\\') { + walk++; + walk_last = 0; + continue; + } + if (preg_get_backref(&walk, &backref)) { + if (backref < count) { + new_len += offsets[(backref<<1)+1] - offsets[backref<<1]; + } + continue; + } + } + new_len++; + walk++; + walk_last = walk[-1]; + } + } + + if (new_len + 1 > alloc_len) { + alloc_len = 1 + alloc_len + 2 * new_len; + result = (char *)realloc(result, alloc_len); + } + /* copy the part of the string before the match */ + memcpy(&result[result_len], piece, match-piece); + result_len += match-piece; + + /* copy replacement and backrefs */ + walkbuf = result + result_len; + + /* If evaluating or using custom function, copy result to the buffer + * and clean up. */ + if (callable) { + memcpy(walkbuf, eval_result.data(), eval_result.size()); + result_len += eval_result.size(); + } else { /* do regular backreference copying */ + walk = replace; + walk_last = 0; + while (walk < replace_end) { + if ('\\' == *walk || '$' == *walk) { + if (walk_last == '\\') { + *(walkbuf-1) = *walk++; + walk_last = 0; + continue; + } + if (preg_get_backref(&walk, &backref)) { + if (backref < count) { + match_len = offsets[(backref<<1)+1] - offsets[backref<<1]; + memcpy(walkbuf, subject.data() + offsets[backref<<1], + match_len); + walkbuf += match_len; + } + continue; + } + } + *walkbuf++ = *walk++; + walk_last = walk[-1]; + } + *walkbuf = '\0'; + if (eval) { + String args(result + result_len, walkbuf - (result + result_len), + CopyString); + Array params; + bool slashed = false; + int lastStart = -1; + for (int i = 0; i < args.size(); i++) { + char c = args.charAt(i); + if (slashed) { + slashed = false; + continue; + } + switch (c) { + case '"': + if (lastStart >= 0) { + params.append(args.substr(lastStart, i - lastStart)); + lastStart = -1; + } else { + lastStart = i + 1; + } + break; + case '\\': + slashed = true; + break; + } + } + + eval_result = f_call_user_func_array(eval_fn, params); + memcpy(result + result_len, eval_result.data(), eval_result.size()); + result_len += eval_result.size(); + } else { + /* increment the result length by how much we've added to the string */ + result_len += walkbuf - (result + result_len); + } + } + + if (limit != -1) { + limit--; + } + + } else if (count == PCRE_ERROR_NOMATCH || limit == 0) { + /* If we previously set PCRE_NOTEMPTY after a null match, + this is not necessarily the end. We need to advance + the start offset, and continue. Fudge the offset values + to achieve this, unless we're already at the end of the string. */ + if (g_notempty != 0 && start_offset < subject.size()) { + offsets[0] = start_offset; + offsets[1] = start_offset + 1; + memcpy(&result[result_len], piece, 1); + (result_len)++; + } else { + new_len = result_len + subject.size() - start_offset; + if (new_len + 1 > alloc_len) { + alloc_len = new_len + 1; /* now we know exactly how long it is */ + result = (char *)realloc(result, alloc_len); + } + /* stick that last bit of string on our output */ + memcpy(&result[result_len], piece, subject.size() - start_offset); + result_len += subject.size() - start_offset; + result[result_len] = '\0'; + break; + } + } else { + pcre_handle_exec_error(count); + free(result); + result = NULL; + break; + } + + /* If we have matched an empty string, mimic what Perl's /g options does. + This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try + the match again at the same point. If this fails (picked up above) we + advance to the next character. */ + g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0; + + /* Advance to the next piece. */ + start_offset = offsets[1]; + } + + free(offsets); + if (result) { + return String(result, result_len, AttachString); + } + return String(); +} + +static String php_replace_in_subject(CVarRef regex, CVarRef replace, + String subject, int limit, bool callable, + int *replace_count) { + if (!regex.is(KindOfArray)) { + return php_pcre_replace(regex.toString(), subject, replace, + callable, limit, replace_count); + } + + if (callable || !replace.is(KindOfArray)) { + Array arr = regex.toArray(); + for (ArrayIter iterRegex(arr); iterRegex; ++iterRegex) { + String regex_entry = iterRegex.second().toString(); + subject = php_pcre_replace(regex_entry, subject, replace, + callable, limit, replace_count); + if (subject.isNull()) { + return subject; + } + } + return subject; + } + + Array arrReplace = replace.toArray(); + Array arrRegex = regex.toArray(); + ArrayIter iterReplace(arrReplace); + for (ArrayIter iterRegex(arrRegex); iterRegex; ++iterRegex) { + String regex_entry = iterRegex.second().toString(); + Variant replace_value; + if (iterReplace) { + replace_value = iterReplace.second(); + ++iterReplace; + } + + subject = php_pcre_replace(regex_entry, subject, replace_value, + callable, limit, replace_count); + if (subject.isNull()) { + return subject; + } + } + return subject; +} + +Variant preg_replace_impl(CVarRef pattern, CVarRef replacement, + CVarRef subject, int limit, Variant &count, + bool is_callable) { + if (!is_callable && + replacement.is(KindOfArray) && !pattern.is(KindOfArray)) { + Logger::Warning("Parameter mismatch, pattern is a string while " + "replacement is an array"); + return false; + } + + int replace_count = 0; + if (!subject.is(KindOfArray)) { + String ret = php_replace_in_subject(pattern, replacement, + subject.toString(), + limit, is_callable, &replace_count); + count = replace_count; + return ret; + } + + Array return_value; + Array arrSubject = subject.toArray(); + for (ArrayIter iter(arrSubject); iter; ++iter) { + String subject_entry = iter.second().toString(); + String result = php_replace_in_subject(pattern, replacement, subject_entry, + limit, is_callable, &replace_count); + if (!result.isNull()) { + return_value.set(iter.first(), result); + } + } + count = replace_count; + return return_value; +} + +int preg_replace(Variant &result, CVarRef pattern, CVarRef replacement, + CVarRef subject, int limit /* = -1 */) { + Variant count; + result = preg_replace_impl(pattern, replacement, subject, limit, count, false); + return count.toInt32(); +} + +int preg_replace_callback(Variant &result, CVarRef pattern, CVarRef callback, + CVarRef subject, int limit /* = -1 */) { + Variant count; + result = preg_replace_impl(pattern, callback, subject, limit, count, true); + return count.toInt32(); +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant preg_split(CVarRef pattern, CVarRef subject, int limit /* = -1 */, + int flags /* = 0 */) { + pcre_cache_entry *pce = pcre_get_compiled_regex_cache(pattern.toString()); + if (pce == NULL) { + return false; + } + + int no_empty = flags & PREG_SPLIT_NO_EMPTY; + bool delim_capture = flags & PREG_SPLIT_DELIM_CAPTURE; + bool offset_capture = flags & PREG_SPLIT_OFFSET_CAPTURE; + + if (limit == 0) { + limit = -1; + } + + int size_offsets = 0; + int *offsets = create_offset_array(pce, size_offsets); + if (offsets == NULL) { + return false; + } + + String ssubject = subject.toString(); + + /* Start at the beginning of the string */ + int start_offset = 0; + int next_offset = 0; + const char *last_match = ssubject.data(); + const char *match = NULL; + s_pcre_data->error_code = PHP_PCRE_NO_ERROR; + pcre_extra *extra = pce->extra; + + // Get next piece if no limit or limit not yet reached and something matched + Variant return_value; + int g_notempty = 0; /* If the match should not be empty */ + pcre *re_bump = NULL; /* Regex instance for empty matches */ + pcre_extra *extra_bump = NULL; /* Almost dummy */ + while ((limit == -1 || limit > 1)) { + int count = pcre_exec(pce->re, extra, ssubject.data(), ssubject.size(), + start_offset, g_notempty, offsets, size_offsets); + + /* Check for too many substrings condition. */ + if (count == 0) { + Logger::Warning("Matched, but too many substrings"); + count = size_offsets / 3; + } + + /* If something matched */ + if (count > 0) { + match = ssubject.data() + offsets[0]; + + if (!no_empty || ssubject.data() + offsets[0] != last_match) { + if (offset_capture) { + /* Add (match, offset) pair to the return value */ + add_offset_pair(return_value, + String(last_match, + ssubject.data() + offsets[0] - last_match, + CopyString), + next_offset, NULL); + } else { + /* Add the piece to the return value */ + return_value.append(String(last_match, + ssubject.data() + offsets[0] - last_match, + CopyString)); + } + + /* One less left to do */ + if (limit != -1) + limit--; + } + + last_match = ssubject.data() + offsets[1]; + next_offset = offsets[1]; + + if (delim_capture) { + int i, match_len; + for (i = 1; i < count; i++) { + match_len = offsets[(i<<1)+1] - offsets[i<<1]; + /* If we have matched a delimiter */ + if (!no_empty || match_len > 0) { + if (offset_capture) { + add_offset_pair(return_value, + String(ssubject.data() + offsets[i<<1], + match_len, CopyString), + offsets[i<<1], NULL); + } else { + return_value.append(ssubject.substr(offsets[i<<1], match_len)); + } + } + } + } + } else if (count == PCRE_ERROR_NOMATCH) { + /* If we previously set PCRE_NOTEMPTY after a null match, + this is not necessarily the end. We need to advance + the start offset, and continue. Fudge the offset values + to achieve this, unless we're already at the end of the string. */ + if (g_notempty != 0 && start_offset < ssubject.size()) { + if (pce->compile_options & PCRE_UTF8) { + if (re_bump == NULL) { + int dummy; + if ((re_bump = pcre_get_compiled_regex("/./u", &extra_bump, + &dummy)) == NULL) { + return false; + } + } + count = pcre_exec(re_bump, extra_bump, ssubject.data(), + ssubject.size(), start_offset, + 0, offsets, size_offsets); + if (count < 1) { + Logger::Warning("Unknown error"); + offsets[0] = start_offset; + offsets[1] = start_offset + 1; + } + } else { + offsets[0] = start_offset; + offsets[1] = start_offset + 1; + } + } else + break; + } else { + pcre_handle_exec_error(count); + break; + } + + /* If we have matched an empty string, mimic what Perl's /g options does. + This turns out to be rather cunning. First we set PCRE_NOTEMPTY and try + the match again at the same point. If this fails (picked up above) we + advance to the next character. */ + g_notempty = (offsets[1] == offsets[0])? PCRE_NOTEMPTY | PCRE_ANCHORED : 0; + + /* Advance to the position right after the last full match */ + start_offset = offsets[1]; + } + + if (!no_empty || start_offset != ssubject.size()) { + if (offset_capture) { + /* Add the last (match, offset) pair to the return value */ + add_offset_pair(return_value, + ssubject.substr(start_offset), + start_offset, NULL); + } else { + /* Add the last piece to the return value */ + return_value.append + (String(last_match, ssubject.data() + ssubject.size() - last_match, + CopyString)); + } + } + + /* Clean up */ + free(offsets); + return return_value; +} + +/////////////////////////////////////////////////////////////////////////////// + +String preg_quote(CStrRef str, CStrRef delimiter /* = null_string */) { + const char *in_str = str.data(); + const char *in_str_end = in_str + str.size(); + + /* Nothing to do if we got an empty string */ + if (in_str == in_str_end) { + return str; + } + + char delim_char = 0; /* Delimiter character to be quoted */ + bool quote_delim = false; /* Whether to quote additional delim char */ + if (!delimiter.empty()) { + delim_char = delimiter.charAt(0); + quote_delim = true; + } + + /* Allocate enough memory so that even if each character + is quoted, we won't run out of room */ + char *out_str = (char *)malloc(4 * str.size() + 1); + + /* Go through the string and quote necessary characters */ + const char *p; + char *q; + for (p = in_str, q = out_str; p != in_str_end; p++) { + char c = *p; + switch (c) { + case '.': case '\\': case '+': case '*': case '?': + case '[': case '^': case ']': case '$': case '(': + case ')': case '{': case '}': case '=': case '!': + case '>': case '<': case '|': case ':': + *q++ = '\\'; + *q++ = c; + break; + + case '\0': + *q++ = '\\'; + *q++ = '0'; + *q++ = '0'; + *q++ = '0'; + break; + + default: + if (quote_delim && c == delim_char) + *q++ = '\\'; + *q++ = c; + break; + } + } + *q = '\0'; + + return String(out_str, q - out_str, AttachString); +} + +int preg_last_error() { + return s_pcre_data->error_code; +} + +/////////////////////////////////////////////////////////////////////////////// +// regexec + +static void php_reg_eprint(int err, regex_t *re) { + char *buf = NULL, *message = NULL; + size_t len; + size_t buf_len; + +#ifdef REG_ITOA + /* get the length of the message */ + buf_len = regerror(REG_ITOA | err, re, NULL, 0); + if (buf_len) { + buf = (char *)malloc(buf_len); + if (!buf) return; /* fail silently */ + /* finally, get the error message */ + regerror(REG_ITOA | err, re, buf, buf_len); + } +#else + buf_len = 0; +#endif + len = regerror(err, re, NULL, 0); + if (len) { + message = (char *)malloc(buf_len + len + 2); + if (!message) { + return; /* fail silently */ + } + if (buf_len) { + snprintf(message, buf_len, "%s: ", buf); + buf_len += 1; /* so pointer math below works */ + } + /* drop the message into place */ + regerror(err, re, message + buf_len, len); + Logger::Warning("%s", message); + } + if (buf) free(buf); + if (message) free(message); +} + +Variant php_split(CStrRef spliton, CStrRef str, int count, bool icase) { + const char *strp = str.data(); + const char *endp = strp + str.size(); + + regex_t re; + int copts = icase ? REG_ICASE : 0; + int err = regcomp(&re, spliton.data(), REG_EXTENDED | copts); + if (err) { + php_reg_eprint(err, &re); + return false; + } + + Array return_value = Array::Create(); + regmatch_t subs[1]; + + /* churn through str, generating array entries as we go */ + while ((count == -1 || count > 1) && + !(err = regexec(&re, strp, 1, subs, 0))) { + if (subs[0].rm_so == 0 && subs[0].rm_eo) { + /* match is at start of string, return empty string */ + return_value.append(""); + /* skip ahead the length of the regex match */ + strp += subs[0].rm_eo; + } else if (subs[0].rm_so == 0 && subs[0].rm_eo == 0) { + /* No more matches */ + regfree(&re); + Logger::Warning("Invalid Regular Expression to split()"); + return false; + } else { + /* On a real match */ + + /* make a copy of the substring */ + int size = subs[0].rm_so; + + /* add it to the array */ + return_value.append(String(strp, size, CopyString)); + + /* point at our new starting point */ + strp = strp + subs[0].rm_eo; + } + + /* if we're only looking for a certain number of points, + stop looking once we hit it */ + if (count != -1) { + count--; + } + } + + /* see if we encountered an error */ + if (err && err != REG_NOMATCH) { + php_reg_eprint(err, &re); + regfree(&re); + return false; + } + + /* otherwise we just have one last element to add to the array */ + int size = endp - strp; + return_value.append(String(strp, size, CopyString)); + + regfree(&re); + return return_value; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/preg.h b/src/cpp/base/preg.h new file mode 100644 index 0000000000000..eaa803df78ccc --- /dev/null +++ b/src/cpp/base/preg.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __PREG_H__ +#define __PREG_H_ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant preg_grep(CStrRef pattern, CArrRef input, int flags = 0); + +Variant preg_match_impl(CStrRef pattern, CStrRef subject, + Variant &subpats, int flags, int start_offset, + bool global); +Variant preg_match(CStrRef pattern, CStrRef subject, + Variant &matches, int flags = 0, + int offset = 0); +Variant preg_match(CStrRef pattern, CStrRef subject, int flags = 0, + int offset = 0); +Variant preg_match_all(CStrRef pattern, CStrRef subject, Variant &matches, + int flags = 0, int offset = 0); +Variant preg_match_all(CStrRef pattern, CStrRef subject, + int flags = 0, int offset = 0); + +Variant preg_replace_impl(CVarRef pattern, CVarRef replacement, + CVarRef subject, int limit, Variant &count, + bool is_callable); +int preg_replace(Variant &result, CVarRef pattern, CVarRef replacement, + CVarRef subject, int limit = -1); +int preg_replace_callback(Variant &result, CVarRef pattern, CVarRef callback, + CVarRef subject, int limit = -1); + +Variant preg_split(CVarRef pattern, CVarRef subject, int limit = -1, + int flags = 0); +String preg_quote(CStrRef str, CStrRef delimiter = null_string); +Variant php_split(CStrRef spliton, CStrRef str, int count, bool icase); + +int preg_last_error(); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __PREG_H__ diff --git a/src/cpp/base/program_functions.cpp b/src/cpp/base/program_functions.cpp new file mode 100644 index 0000000000000..cdae83049f27a --- /dev/null +++ b/src/cpp/base/program_functions.cpp @@ -0,0 +1,760 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +using namespace std; +using namespace boost::program_options; +extern char **environ; + +#define MAX_INPUT_NESTING_LEVEL 64 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helpers + +class StartTime { +public: + StartTime() : startTime(time(NULL)) {} + time_t startTime; +}; +static StartTime s_startTime; + +time_t start_time() { + return s_startTime.startTime; +} + +static void process_cmd_arguments(int argc, char **argv) { + SystemGlobals *g = (SystemGlobals *)get_global_variables(); + g->gv_argc = argc; + for (int i = 0; i < argc; i++) { + g->gv_argv.lvalAt() = argv[i]; + } +} + +void process_env_variables(Variant &variables) { + for (map::const_iterator iter = + RuntimeOption::EnvVariables.begin(); + iter != RuntimeOption::EnvVariables.end(); ++iter) { + variables.set(String(iter->first), String(iter->second)); + } + for (char **env = environ; env && *env; env++) { + char *p = strchr(*env, '='); + if (p) { + String name(*env, p - *env, CopyString); + register_variable(variables, (char*)name.data(), + String(p + 1, CopyString)); + } + } +} + +void register_variable(Variant &variables, char *name, CVarRef value, + bool overwrite /* = true */) { + // ignore leading spaces in the variable name + char *var = name; + while (*var && *var == ' ') { + var++; + } + + // ensure that we don't have spaces or dots in the variable name + // (not binary safe) + bool is_array = false; + char *ip = NULL; // index pointer + char *p = var; + for (; *p; p++) { + if (*p == ' ' || *p == '.') { + *p = '_'; + } else if (*p == '[') { + is_array = true; + ip = p; + *p = 0; + break; + } + } + int var_len = p - var; + if (var_len == 0) { + // empty variable name, or variable name with a space in it + return; + } + + vector gpc_elements; + gpc_elements.reserve(MAX_INPUT_NESTING_LEVEL); // important, so no resize + Variant *symtable = &variables; + char *index = var; + int index_len = var_len; + + if (is_array) { + int nest_level = 0; + while (true) { + if (++nest_level > MAX_INPUT_NESTING_LEVEL) { + Logger::Warning("Input variable nesting level exceeded"); + return; + } + + ip++; + char *index_s = ip; + int new_idx_len = 0; + if (isspace(*ip)) { + ip++; + } + if (*ip == ']') { + index_s = NULL; + } else { + ip = strchr(ip, ']'); + if (!ip) { + // PHP variables cannot contain '[' in their names, + // so we replace the character with a '_' + *(index_s - 1) = '_'; + + index_len = 0; + if (index) { + index_len = strlen(index); + } + goto plain_var; + } + *ip = 0; + new_idx_len = strlen(index_s); + } + + if (!index) { + symtable->append(Array::Create()); + gpc_elements.push_back(null); + gpc_elements.back() = + ref(symtable->lvalAt((int)symtable->toArray().size())); + } else { + String key(index, index_len, CopyString); + Variant v = symtable->rvalAt(key); + if (v.isNull() || !v.is(KindOfArray)) { + symtable->set(key, Array::Create()); + } + gpc_elements.push_back(null); + gpc_elements.back() = ref(symtable->lvalAt(key)); + } + symtable = &gpc_elements.back(); + /* ip pointed to the '[' character, now obtain the key */ + index = index_s; + index_len = new_idx_len; + + ip++; + if (*ip == '[') { + is_array = true; + *ip = 0; + } else { + goto plain_var; + } + } + } else { + plain_var: + if (!index) { + symtable->append(value); + } else { + String key(index, index_len, CopyString); + if (overwrite || !symtable->toArray().exists(key)) { + symtable->set(key, value); + } + } + } +} + +enum ContextOfException { + WarmupDocException = 0, + ReqInitException, + InvokeException, + HandlerException, +}; + +static bool handle_exception(ExecutionContext *context, std::string &errorMsg, + ContextOfException where, bool &error) { + bool ret = false; + try { + throw; + } catch (ExitException &e) { + ret = true; + // ExitException is fine + } catch (PhpFileDoesNotExistException &e) { + if (where == WarmupDocException) { + Logger::Error("warmup error: %s", e.getMessage().c_str()); + } + } catch (Exception &e) { + if (where == HandlerException) { + errorMsg = "Exception handler threw an exception: "; + } + if (RuntimeOption::ServerStackTrace) { + errorMsg += e.what(); + } else { + errorMsg += e.getStackTrace().hexEncode(); + errorMsg += " "; + errorMsg += e.getMessage(); + } + if (where == InvokeException) { + context->onError(e); + } else { + Logger::Error("%s", errorMsg.c_str()); + } + error = true; + } catch (Object &e) { + if (where == HandlerException) { + errorMsg = "Exception handler threw an object exception: "; + } + try { + errorMsg += e.toString().data(); + } catch (...) { + errorMsg += "(unable to call toString())"; + } + if (where == InvokeException) { + context->onException(e); + } else { + Logger::Error("%s", errorMsg.c_str()); + } + error = true; + } catch (...) { + if (where == InvokeException) throw; + errorMsg = "(unknown exception was thrown)"; + Logger::Error("%s", errorMsg.c_str()); + error = true; + } + return ret; +} + +static bool hphp_chdir_file(const string filename) { + bool ret = false; + String s = File::TranslatePath(filename); + char *buf = strndup(s.data(), s.size()); + char *dir = dirname(buf); + ASSERT(dir); + if (dir) { + if (File::IsVirtualDirectory(dir)) { + g_context->setCwd(String(dir, CopyString)); + ret = true; + } else { + struct stat sb; + stat(dir, &sb); + if ((sb.st_mode & S_IFMT) == S_IFDIR) { + ret = true; + if (*dir != '.') { + g_context->setCwd(String(dir, CopyString)); + } + } + } + } + free(buf); + return ret; +} + +void handle_destructor_exception() { + string errorMsg; + try { + throw; + } catch (ExitException &e) { + // ExitException is fine + } catch (Exception &e) { + errorMsg = "Destructor threw an exception: "; + if (RuntimeOption::ServerStackTrace) { + errorMsg += e.what(); + } else { + errorMsg += e.getStackTrace().hexEncode(); + errorMsg += " "; + errorMsg += e.getMessage(); + } + Logger::Error("%s", errorMsg.c_str()); + } catch (Object &e) { + errorMsg = "Destructor threw an object exception: "; + try { + errorMsg += e.toString().data(); + } catch (...) { + errorMsg += "(unable to call toString())"; + } + Logger::Error("%s", errorMsg.c_str()); + } catch (...) { + errorMsg = "(unknown exception was thrown from destructor)"; + Logger::Error("%s", errorMsg.c_str()); + } +} + +static int execute_command_line(const char * file, int argc, char **argv) { + hphp_process_init(); + ExecutionContext *context = g_context.get(); + hphp_session_init(); + + SystemGlobals *g = (SystemGlobals *)get_global_variables(); + process_env_variables(g->gv__ENV); + g->gv__ENV.set("HPHP", 1); + + process_cmd_arguments(argc, argv); + + Variant &server = g->gv__SERVER; + server.set("DOCUMENT_ROOT", ""); + server.set("SCRIPT_FILENAME", argv[0]); + server.set("SCRIPT_NAME", argv[0]); + server.set("PHP_SELF", argv[0]); + server.set("argv", g->gv_argv); + server.set("argc", g->gv_argc); + server.set("PWD", g_context->getCwd()); + char hostname[1024]; + if (!gethostname(hostname, 1024)) { + server.set("HOSTNAME", String(hostname, CopyString)); + } + + if (RuntimeOption::EnableCliRTTI) RTTIInfo::TheRTTIInfo.init(true); + + int exitCode = -1; + bool ret = false; + string errorMsg = ""; + bool error; + ret = hphp_invoke(context, file, false, Array(), null, "", "", error, + errorMsg); + hphp_context_exit(context, true); + hphp_session_exit(); + if (ret) { + exitCode = ExitException::ExitCode; + } + return exitCode; +} + +static int start_server(const std::string &popenLog, + const std::string &username) { + // Load all code into memory to prevent slow initial queries while + // binary is pulled from disk + if (mlockall(MCL_CURRENT)) { + Logger::Warning("Could not mlockall"); + } + + if (!popenLog.empty()) { + Logger::Output = popen(popenLog.c_str(), "w"); + } + RuntimeOption::ExecutionMode = "srv"; + + if (!username.empty()) { + Capability::ChangeUnixUser(username); + LightProcess::change_user(username); + } + + HttpServer::Server = HttpServerPtr(new HttpServer()); + HttpServer::Server->run(); + return 0; +} + +string translate_stack(const char *hexencoded, bool with_frame_numbers) { + if (!hexencoded || !*hexencoded) { + return ""; + } + + StackTrace st(hexencoded); + StackTrace::FramePtrVec frames; + st.get(frames); + + ostringstream out; + for (unsigned int i = 0; i < frames.size(); i++) { + StackTrace::FramePtr f = frames[i]; + if (with_frame_numbers) { + out << "# " << (i < 10 ? " " : "") << i << ' '; + } + out << f->toString(); + if (SourceInfo::TheSourceInfo.translate(f)) { + out << " [" << f->filename << ':' << f->lineno << ']'; + } + out << '\n'; + } + return out.str(); +} + +void translate_rtti(const char *rttiDirectory) { + RTTIInfo::TheRTTIInfo.translate_rtti(rttiDirectory); +} + +/////////////////////////////////////////////////////////////////////////////// + +struct ProgramOptions { + string mode; + string config; + vector confStrings; + int port; + int admin_port; + string user; + string file; + int count; + bool noSafeAccessCheck; + vector args; + string buildId; +}; + +int execute_program(int argc, char **argv) { + string usage = "Usage:\n\n\t"; + usage += argv[0]; + usage += " [-m ] [] [] [] ...\n\nOptions"; + + ProgramOptions po; + options_description desc(usage.c_str()); + desc.add_options() + ("help", "display this message") + ("mode,m", value(&po.mode)->default_value("run"), + "run | server | daemon | replay | translate") + ("config,c", value(&po.config), + "load specified config file") + ("config-value,v", value >(&po.confStrings)->composing(), + "individual configuration string in a format of name=value, where " + "name can be any valid configuration for a config file") + ("port,p", value(&po.port)->default_value(-1), + "start an HTTP server at specified port") + ("admin-port", value(&po.admin_port)->default_value(-1), + "start admin listerner at specified port") + ("user,u", value(&po.user), + "run server under this user account") + ("file,f", value(&po.file), + "executing specified file") + ("count", value(&po.count)->default_value(1), + "how many times to repeat execution") + ("no-safe-access-check", + value(&po.noSafeAccessCheck)->default_value(false), + "whether to ignore safe file access check") + ("arg", value >(&po.args)->composing(), + "arguments") + ("extra-header", value(&Logger::ExtraHeader), + "extra-header to add to log lines") + ("build-id", value(&po.buildId), + "unique identifier of compiled server code") + ; + + positional_options_description p; + p.add("arg", -1); + variables_map vm; + try { + store(command_line_parser(argc, argv).options(desc).positional(p).run(), + vm); + notify(vm); + } catch (error &e) { + cerr << "Error in command line: " << e.what() << "\n\n"; + cout << desc << "\n"; + return -1; + } catch (...) { + cerr << "Error in command line:\n\n"; + cout << desc << "\n"; + return -1; + } + if (vm.count("help")) { + cout << desc << "\n"; + return -1; + } + + Hdf config; + if (!po.config.empty()) { + config.open(po.config); + } + for (unsigned int i = 0; i < po.confStrings.size(); i++) { + config.fromString(po.confStrings[i].c_str()); + } + RuntimeOption::Load(config); + + LightProcess::initialize(); + + RuntimeOption::BuildId = po.buildId; + if (po.port != -1) { + RuntimeOption::ServerPort = po.port; + } + if (po.admin_port != -1) { + RuntimeOption::AdminServerPort = po.admin_port; + } + if (po.noSafeAccessCheck) { + RuntimeOption::SafeFileAccess = false; + } + if (argc <= 1 || po.mode == "run") { + RuntimeOption::ExecutionMode = "cli"; + + int new_argc = po.args.size() + 1; + char **new_argv = (char **)malloc((new_argc + 1) * sizeof(char*)); + new_argv[0] = argv[0]; + for (int i = 1; i < new_argc; i++) { + new_argv[i] = (char*)po.args[i-1].c_str(); + } + new_argv[new_argc] = NULL; + + int ret = -1; + for (int i = 0; i < po.count; i++) { + ret = execute_command_line(po.file.c_str(), new_argc, new_argv); + } + + free(new_argv); + return ret; + } + + string popenLog; + if (RuntimeOption::LogFile[0] == '|') { + popenLog = RuntimeOption::LogFile.substr(1); + RuntimeOption::LogFile.clear(); + } + + if (po.mode == "daemon") { + Process::Daemonize(RuntimeOption::LogFile.c_str(), + RuntimeOption::LogFile.c_str()); + return start_server(popenLog, po.user); + } + if (po.mode == "server") { + return start_server(popenLog, po.user); + } + + if (po.mode == "replay" && !po.args.empty()) { + RuntimeOption::RecordInput = false; + RuntimeOption::ExecutionMode = "srv"; + HttpServer server; // so we initialize runtime properly + HttpRequestHandler handler; + for (int i = 0; i < po.count; i++) { + ReplayTransport rt; + rt.replayInput(po.args[0].c_str()); + handler.handleRequest(&rt); + printf("%s\n", rt.getResponse().c_str()); + } + return 0; + } + + if (po.mode == "translate" && !po.args.empty()) { + if (!access(po.args[0].c_str(), F_OK)) { + translate_rtti(po.args[0].c_str()); + } else { + printf("%s", translate_stack(po.args[0].c_str()).c_str()); + } + return 0; + } + + cout << desc << "\n"; + return -1; +} + +String canonicalize_path(CStrRef p, const char* root, int rootLen) { + String path = Util::canonicalize(string(p.c_str())); + if (path.charAt(0) == '/') { + string &sourceRoot = RuntimeOption::SourceRoot; + int len = sourceRoot.size(); + if (len && strncmp(path.data(), sourceRoot.c_str(), len) == 0) { + return path.substr(len); + } + if (root && rootLen && strncmp(path.data(), root, rootLen) == 0) { + return path.substr(rootLen); + } + } + return path; +} + +/////////////////////////////////////////////////////////////////////////////// +// C++ ffi + +class WarmupState { +public: + WarmupState() : done(false), enabled(false), + atCheckpoint(false), failed(false) {} + bool done; + bool enabled; + bool atCheckpoint; + bool failed; +}; +static ThreadLocal s_warmup_state; + +void hphp_process_init() { + init_static_variables(); + Process::InitProcessStatics(); + PageletServer::Restart(); + XboxServer::Restart(); +} + +IMPLEMENT_THREAD_LOCAL(int, RecursionInjection::s_stackdepth); + +void hphp_session_init() { + RequestInjection::s_reqInjectionData->started = time(0); + RequestInjection::s_reqInjectionData->timedout = false; + *RecursionInjection::s_stackdepth = 0; + *FrameInjection::s_top = NULL; + + MemoryManager::TheMemoryManager()->resetStats(); + + if (!s_warmup_state->done) { + free_global_variables(); // just to be safe + init_global_variables(); + } +} + +bool hphp_is_warmup_enabled() { + return s_warmup_state->enabled; +} + +void hphp_set_warmup_enabled() { + s_warmup_state->enabled = true; +} + +ExecutionContext *hphp_context_init() { + ExecutionContext *context = g_context.get(); + context->obStart(); + context->obProtect(true); + return context; +} + +bool hphp_warmup(ExecutionContext *context, const std::string &warmupDoc, + const std::string reqInitFunc, bool &error) { + bool ret = true; + error = false; + std::string errorMsg; + if (!s_warmup_state->done) { + MemoryManager *mm = MemoryManager::TheMemoryManager().get(); + if (mm->beforeCheckpoint()) { + if (!s_warmup_state->failed && !warmupDoc.empty()) { + try { + s_warmup_state->enabled = true; + ServerStatsHelper ssh("warmup"); + invoke_file(warmupDoc, true, get_variable_table()); + } catch (...) { + ret = handle_exception(context, errorMsg, WarmupDocException, error); + } + } + if (!ret) { + hphp_session_init(); + s_warmup_state->enabled = false; + s_warmup_state->failed = true; + return ret; + } + s_warmup_state->done = true; + mm->checkpoint(); + s_warmup_state->atCheckpoint = true; + } + } + + if (!reqInitFunc.empty() && s_warmup_state->enabled && + s_warmup_state->atCheckpoint) { + ServerStatsHelper ssh("reqinit"); + try { + invoke(reqInitFunc.c_str(), Array()); + } catch (...) { + ret = handle_exception(context, errorMsg, ReqInitException, error); + } + } + s_warmup_state->atCheckpoint = false; + return ret; +} +bool hphp_invoke(ExecutionContext *context, const std::string &cmd, + bool func, CArrRef funcParams, Variant funcRet, + const std::string &warmupDoc, const std::string reqInitFunc, + bool &error, std::string &errorMsg) { + bool ret = false; + bool isServer = (strcmp(RuntimeOption::ExecutionMode, "srv") == 0); + error = false; + String oldCwd; + try { + try { + if (isServer) { + oldCwd = context->getCwd(); + hphp_chdir_file(warmupDoc); + } + if (!hphp_warmup(context, warmupDoc, reqInitFunc, error)) { + if (isServer) context->setCwd(oldCwd); + return false; + } + ServerStatsHelper ssh("invoke"); + if (func) { + funcRet = invoke(cmd.c_str(), funcParams); + } else { + if (isServer) hphp_chdir_file(cmd); + invoke_file(cmd.c_str(), true, get_variable_table()); + } + ret = true; + context->onShutdownPreSend(); + } catch (...) { + ret = handle_exception(context, errorMsg, InvokeException, error); + } + } catch (...) { + ret = handle_exception(context, errorMsg, HandlerException, error); + } + if (isServer) context->setCwd(oldCwd); + return ret; +} + +void hphp_context_exit(ExecutionContext *context, bool psp) { + if (psp) { + ServerStats::SetThreadMode(ServerStats::PostProcessing); + try { + try { + ServerStatsHelper ssh("psp"); + context->onShutdownPostSend(); + } catch (ExitException &e) { + // do nothing + } catch (Exception &e) { + context->onError(e); + } catch (Object &e) { + context->onException(e); + } + } catch (...) { + Logger::Error("unknown exception was thrown from psp"); + } + ServerStats::SetThreadMode(ServerStats::Idling); + } + + context->onRequestShutdown(); + context->obProtect(false); + context->obEnd(); +} + +void hphp_session_exit() { + // Server note has to live long enough for the access log to fire. + // RequestLocal is too early. + ServerNote::Reset(); + g_context.reset(); + + MemoryManager *mm = MemoryManager::TheMemoryManager().get(); + if (RuntimeOption::CheckMemory) { + mm->checkMemory(false); + } + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemoryStats) { + mm->logStats(); + } + mm->resetStats(); + + if (mm->afterCheckpoint()) { + ServerStatsHelper ssh("rollback"); + mm->rollback(); + s_warmup_state->atCheckpoint = true; + } else { + ServerStatsHelper ssh("free"); + free_global_variables(); + } +} + +void hphp_process_exit() { + // do nothing +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/program_functions.h b/src/cpp/base/program_functions.h new file mode 100644 index 0000000000000..26b348e662b2c --- /dev/null +++ b/src/cpp/base/program_functions.h @@ -0,0 +1,84 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_PROGRAM_FUNCTIONS_H__ +#define __HPHP_PROGRAM_FUNCTIONS_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Main entry point of the entire program. + */ +int execute_program(int argc, char **argv); + +/** + * Setting up environment variables. + */ +void process_env_variables(Variant &variables); + +/** + * Inserting a variable into specified symbol table. + * + * "overwrite" parameter is only for cookies: + * According to rfc2965, more specific paths are listed above the less + * specific ones. If we encounter a duplicate cookie name, we should + * skip it, since it is not possible to have the same (plain text) + * cookie name for the same path and we should not overwrite more + * specific cookies with the less specific ones. + */ +void register_variable(Variant &variables, char *name, CVarRef value, + bool overwrite = true); + +String canonicalize_path(CStrRef path, const char* root, int rootLen); + +/** + * Translate hex encode stack into both C++ and PHP frames. + */ +std::string translate_stack(const char *hexencoded, + bool with_frame_numbers = true); + +time_t start_time(); + +/////////////////////////////////////////////////////////////////////////////// +// C++ ffi + +class ExecutionContext; + +void hphp_process_init(); +void hphp_session_init(); + +ExecutionContext *hphp_context_init(); +bool hphp_warmup(ExecutionContext *context, const std::string &warmupDoc, + const std::string reqInitFunc, bool &error); +bool hphp_invoke(ExecutionContext *context, const std::string &cmd, + bool func, CArrRef funcParams, Variant funcRet, + const std::string &warmupDoc, const std::string reqInitFunc, + bool &error, std::string &errorMsg); +void hphp_context_exit(ExecutionContext *context, bool psp); + +void hphp_session_exit(); +void hphp_process_exit(); +bool hphp_is_warmup_enabled(); +void hphp_set_warmup_enabled(); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_PROGRAM_FUNCTIONS_H__ diff --git a/src/cpp/base/resource_data.cpp b/src/cpp/base/resource_data.cpp new file mode 100644 index 0000000000000..352b316b9c595 --- /dev/null +++ b/src/cpp/base/resource_data.cpp @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +String ResourceData::t___tostring() { + return String("Resource id #") + String(o_getId()); +} + +ObjectData* ResourceData::cloneImpl() { + ASSERT(false); + return NULL; +} + +void ResourceData::serialize(VariableSerializer *serializer) const { + if (serializer->incNestedLevel((void*)this, true)) { + serializer->writeOverflow((void*)this, true); + } else { + std::string saveName; + int saveId; + serializer->getResourceInfo(saveName, saveId); + serializer->setResourceInfo(o_getResourceName(), o_getResourceId()); + o_toArray().serialize(serializer); + serializer->setResourceInfo(saveName.c_str(), saveId); + } + serializer->decNestedLevel((void*)this); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/resource_data.h b/src/cpp/base/resource_data.h new file mode 100644 index 0000000000000..b2af15ec15598 --- /dev/null +++ b/src/cpp/base/resource_data.h @@ -0,0 +1,137 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_RESOURCE_DATA_H__ +#define __HPHP_RESOURCE_DATA_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Base class of all resources used by extensions for opaquely passing object + * pointers. + */ +class ResourceData: public ObjectData, public UnsafePointer { +public: + ResourceData() {} + + // implementing ObjectData + virtual bool o_instanceof(const char *s) const { return false;} + virtual bool isResource() const { return true;} + virtual String t___tostring(); + virtual int64 o_toInt64() const { return o_getId();} + void serialize(VariableSerializer *serializer) const; + virtual const char *o_getResourceName() const { return o_getClassName();} + virtual int o_getResourceId() const { return o_getId(); } + + // implementing UnsafePointer + virtual void protect() { setStatic();} + +protected: + int rsrc_id; // resource id, not used yet. + virtual ObjectData* cloneImpl(); +}; + +/** + * Rules to avoid memory problems/leaks from ResourceData classes + * ============================================================== + * + * 1. If a ResourceData is entirely smart allocated, for example, + * + * class EntirelySmartAllocated : public ResourceData { + * public: + * int number; // primitives are allocated together with "this" + * String str; // smart-allocated objects are fine + * }; + * + * Then, the best choice is to use these two macros to make sure the object + * is always collected during request shutdown time: + * + * DECLARE_OBJECT_ALLOCATION(T); + * IMPLEMENT_OBJECT_ALLOCATION(T); + * + * This object doesn't participate in sweep(), as object allocator doesn't + * have any callback installed. + * + * 2. If a ResourceData is entirely not smart allocated, for example, + * + * class NonSmartAllocated : public SweepableResourceData { + * public: + * int number; // primitives are always not in consideration + * std::string str; // this has malloc() in its own + * std::vector vec; // all STL collection classes belong here + * HANDLE ptr; // raw pointers that need to be free-d somehow + * }; + * + * Then it has to derive from SweepableResourceData, so sweep() will be + * called. By default, it will call this object's destructor automatically, + * so everything will be free-d. + * + * When deriving from SweepableResourceData, either "new" or "NEW" can + * be used, but we prefer people use NEW with these macros: + * + * DECLARE_OBJECT_ALLOCATION(T); + * IMPLEMENT_OBJECT_ALLOCATION(T); + * + * 3. If a ResourceData is a mix of smart allocated data members and non- + * smart allocated data members, sweep() has to be overwritten to only + * free non-smart allocated data members. This is because smart allocated + * data members may have their own sweep() defined to destruct, and another + * destruction from this ResourceData's default sweep() will cause double- + * free problems on these smart allocated data members. + * + * This means, std::vector is almost always wrong, because there is + * no way to free up vector's memory without touching String, which is + * smart allocated. + * + * class MixedSmartAllocated : public SweepableResourceData { + * public: + * int number; // primitives are always not in consideration + * + * // STL classes need to new/delete to have clean sweep + * std::string *stdstr; + * std::vector *vec; + * + * HANDLE ptr; // raw pointers that need to be free-d somehow + * String str; // smart-allocated objects are fine + * + * DECLARE_OBJECT_ALLOCATION(T); + * }; + * IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP(T); + * void MixedSmartAllocated::sweep() { + * delete stdstr; + * delete vec; + * close_handle(ptr); + * // without doing anything with Strings, Arrays, or Objects + * } + * + * 4. If a ResourceData may be persistent, it cannot use object allocation. It + * then has to derive from SweepableResourceData, because a new-ed pointer + * can only be collected/deleted by sweep(). + * + */ +class SweepableResourceData : public ResourceData, public Sweepable {}; + +typedef std::map ResourceMap; +typedef std::map ResourceMapMap; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_RESOURCE_DATA_H__ diff --git a/src/cpp/base/rtti_info.cpp b/src/cpp/base/rtti_info.cpp new file mode 100644 index 0000000000000..82d67d79931f2 --- /dev/null +++ b/src/cpp/base/rtti_info.cpp @@ -0,0 +1,218 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +RTTIInfo RTTIInfo::TheRTTIInfo; + +RTTIInfo::RTTIInfo() : m_loaded(false), m_count(0), m_profData(NULL) { +} + +void RTTIInfo::translate_rtti(const char *rttiDirectory) { + if (!loadProfData(rttiDirectory)) return; + for (int i = 0; i < m_count; i++) { + int total = 0; + for (int j = 0; j < KindOfLast; j++) total += m_profData[i][j]; + if (!total) continue; + printf("%s(%d):", m_id2name[i].c_str(), total); + if (m_profData[i][KindOfNull]) { + printf(" n/%u", m_profData[i][KindOfNull]); + } + if (m_profData[i][KindOfBoolean]) { + printf(" b/%u", m_profData[i][KindOfBoolean]); + } + int totalInt = m_profData[i][KindOfByte] + m_profData[i][KindOfInt16] + + m_profData[i][KindOfInt32] + m_profData[i][KindOfInt64]; + if (totalInt) printf(" i/%u", totalInt); + if (m_profData[i][KindOfDouble]) { + printf(" d/%u", m_profData[i][KindOfDouble]); + } + int totalStr = m_profData[i][LiteralString] + m_profData[i][KindOfString]; + if (totalStr) printf(" s/%u", totalStr); + if (m_profData[i][KindOfArray]) { + printf(" a/%u", m_profData[i][KindOfArray]); + } + if (m_profData[i][KindOfObject]) { + printf(" o/%u", m_profData[i][KindOfObject]); + } + if (m_profData[i][KindOfVariant]) { + printf(" v/%u", m_profData[i][KindOfVariant]); + } + printf("\n"); + } + free(m_profData); + m_profData = NULL; +} + +class RTTICounters : public RequestEventHandler { +public: + RTTICounters() : m_data(NULL), m_count(0), m_requests(0) { } + RTTICounter *getCounter(int id) { return m_data ? &m_data[id] : NULL; } + virtual void requestInit() { + if (!m_data) { + m_count = RTTIInfo::TheRTTIInfo.getCount(); + if (m_count > 0) { + m_data = (RTTICounter *)calloc(m_count, sizeof(RTTICounter)); + } + } + } + virtual void requestShutdown() { + m_requests++; + if (strcmp(RuntimeOption::ExecutionMode, "svr") == 0 && + m_requests % 10) return; + // write rtti profile data every 10 requests + if (m_data) { + char path[PATH_MAX]; + snprintf(path, sizeof(path), "%s%d/%llx.rtti", + RuntimeOption::RTTIDirectory.c_str(), + getpid(), (unsigned long long)pthread_self()); + int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (fd == -1) { + Logger::Error("%s", Util::safe_strerror(errno).c_str()); + } else { + write(fd, m_data, (m_count * sizeof(RTTICounter))); + close(fd); + } + } + } +private: + RTTICounter *m_data; + int m_count; + unsigned int m_requests; +}; + +static RequestLocal s_rtti_counters; + +unsigned int *getRTTICounter(int id) { + return (unsigned int *)(s_rtti_counters->getCounter(id)); +} + +void RTTIInfo::init(bool createDir) { + Lock lock(m_mutex); + if (!m_loaded) { + loadParamMap(g_paramrtti_map); + if (m_count > 0) { + char path[PATH_MAX]; + snprintf(path, sizeof(path), "%s%d/", + RuntimeOption::RTTIDirectory.c_str(), getpid()); + if (createDir) Util::mkdir(path); + } + m_loaded = true; + } + if (m_count == 0) m_count = m_id2name.size(); +} + +void RTTIInfo::loadParamMap(const char **p) { + m_count = 0; + while (*p) { + const char *source = *p++; + m_count++; + m_id2name.push_back(source); + } +} + +void RTTIInfo::loadMetaData(const char *filename) { + ASSERT(!m_loaded); + FILE *f = fopen(filename, "r"); + if (f == NULL) return; + char line[1024]; + if (fgets(line, sizeof(line), f)) { + sscanf(line, "%d", &m_count); + } + while (fgets(line, sizeof(line), f)) { + int len = strlen(line); + ASSERT(len > 0); + if (line[len-1] == '\n') line[len-1] = 0; + m_functions.insert(line); + } + fclose(f); +} + +bool RTTIInfo::loadProfData(const char *rttiDirectory) { + std::vector rttiFiles; + dirent* de; + DIR* dp; + + init(false); + int size = m_count * sizeof(RTTICounter); + ASSERT(rttiDirectory); + dp = opendir(rttiDirectory); + if (!dp) return false; + + while (true) { + de = readdir( dp ); + if (de == NULL) break; + struct stat st; + string path(rttiDirectory); + path += "/"; + path += de->d_name; + if (stat(path.c_str(), &st) == 0 && + (st.st_mode & S_IFMT) == S_IFREG && + st.st_size == size) { + rttiFiles.push_back(path); + } + } + closedir( dp ); + if (rttiFiles.size() == 0) return false; + + RTTICounter *sum = (RTTICounter *)calloc(m_count, sizeof(RTTICounter)); + RTTICounter *counter = (RTTICounter *)malloc(size); + for (unsigned int i = 0; i < rttiFiles.size(); i++) { + int fd = open(rttiFiles[i].c_str(), O_RDONLY); + if (fd == -1) { + Logger::Error("%s", Util::safe_strerror(errno).c_str()); + continue; + } + if (read(fd, counter, size) != size) { + Logger::Error("%s", Util::safe_strerror(errno).c_str()); + close(fd); + continue; + } + RTTICounter *cs, *cc; + for (cs = sum, cc = counter; cs < sum + m_count; cs++, cc++) { + for (int j = 0; j < KindOfLast; j++) { + (*cs)[j] += (*cc)[j]; + } + } + close(fd); + } + free(counter); + if (m_profData) free(m_profData); + m_profData = sum; + return true; +} + +bool RTTIInfo::exists(const char *funcName) { + return m_functions.find(funcName) != m_functions.end(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/rtti_info.h b/src/cpp/base/rtti_info.h new file mode 100644 index 0000000000000..abb1cd9fa04a3 --- /dev/null +++ b/src/cpp/base/rtti_info.h @@ -0,0 +1,61 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_RTTI_INFO_H__ +#define __HPHP_RTTI_INFO_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef unsigned int RTTICounter[KindOfLast]; + +class RTTIInfo { +public: + static RTTIInfo TheRTTIInfo; + void translate_rtti(const char *rttiDir); + void loadMetaData(const char *filename); + bool loadProfData(const char *rttiDir); + bool exists(const char *funcName); + +public: + RTTIInfo(); + ~RTTIInfo() { if (m_profData) free(m_profData);} + + void init(bool createDir); + int getCount() { return m_count;} + +private: + Mutex m_mutex; + bool m_loaded; + int m_count; + std::vector m_id2name; + std::set m_functions; + RTTICounter *m_profData; + + void loadParamMap(const char **p); +}; + +unsigned int *getRTTICounter(int id); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_RTTI_INFO_H__ diff --git a/src/cpp/base/runtime_option.cpp b/src/cpp/base/runtime_option.cpp new file mode 100644 index 0000000000000..a4faeb4bdd076 --- /dev/null +++ b/src/cpp/base/runtime_option.cpp @@ -0,0 +1,655 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +const char *RuntimeOption::ExecutionMode = ""; +std::string RuntimeOption::BuildId; +std::string RuntimeOption::PidFile = "www.pid"; + +std::string RuntimeOption::LogFile; +std::string RuntimeOption::LogAggregatorFile; +std::string RuntimeOption::LogAggregatorDatabase; +int RuntimeOption::LogAggregatorSleepSeconds = 10; +bool RuntimeOption::AlwaysLogUnhandledExceptions = true; +bool RuntimeOption::EnableApplicationLog = true; + +bool RuntimeOption::ThrowBadTypeExceptions = false; +bool RuntimeOption::ThrowNotices = false; +bool RuntimeOption::AssertActive = false; +bool RuntimeOption::AssertWarning = false; + +std::string RuntimeOption::AccessLogDefaultFormat; +std::vector > RuntimeOption::AccessLogs; + +std::string RuntimeOption::AdminLogFormat; +std::string RuntimeOption::AdminLogFile; + + +std::string RuntimeOption::Tier; +std::string RuntimeOption::Host; +std::string RuntimeOption::ServerIP; +std::string RuntimeOption::ServerPrimaryIP; +int RuntimeOption::ServerPort; +int RuntimeOption::ServerThreadCount = 50; +int RuntimeOption::PageletServerThreadCount = 0; +int RuntimeOption::RequestTimeoutSeconds = -1; +int RuntimeOption::RequestMemoryMaxBytes = -1; +int RuntimeOption::ResponseQueueCount; +int RuntimeOption::ServerGracefulShutdownWait; +bool RuntimeOption::ServerHarshShutdown = true; +bool RuntimeOption::ServerEvilShutdown = true; +int RuntimeOption::ServerDanglingWait; +int RuntimeOption::GzipCompressionLevel = 3; +bool RuntimeOption::EnableKeepAlive = true; +bool RuntimeOption::EnableEarlyFlush = true; +bool RuntimeOption::ForceChunkedEncoding = false; +int RuntimeOption::MaxPostSize; +int RuntimeOption::UploadMaxFileSize; +bool RuntimeOption::EnableFileUploads; +bool RuntimeOption::LibEventSyncSend = true; +bool RuntimeOption::ExpiresActive = true; +int RuntimeOption::ExpiresDefault = 2592000; +std::string RuntimeOption::DefaultCharsetName = "UTF-8"; + +VirtualHostPtrVec RuntimeOption::VirtualHosts; +IpBlockMapPtr RuntimeOption::IpBlocks; +SatelliteServerInfoPtrVec RuntimeOption::SatelliteServerInfos; + +int RuntimeOption::XboxServerThreadCount = 0; +int RuntimeOption::XboxServerPort = 0; +int RuntimeOption::XboxDefaultLocalTimeoutMilliSeconds = 500; +int RuntimeOption::XboxDefaultRemoteTimeoutSeconds = 5; +int RuntimeOption::XboxServerInfoMaxRequest = 500; +int RuntimeOption::XboxServerInfoDuration = 120; +std::string RuntimeOption::XboxServerInfoWarmupDoc; +std::string RuntimeOption::XboxServerInfoReqInitFunc; +std::string RuntimeOption::XboxProcessMessageFunc = "xbox_process_message"; +std::string RuntimeOption::XboxPassword; + +std::string RuntimeOption::SourceRoot; +std::string RuntimeOption::FileCache; +std::string RuntimeOption::DefaultDocument; +std::string RuntimeOption::ErrorDocument404; +std::string RuntimeOption::FatalErrorMessage; +std::string RuntimeOption::FontPath; +bool RuntimeOption::EnableStaticContentCache = true; + +std::string RuntimeOption::RTTIDirectory; +bool RuntimeOption::EnableCliRTTI = false; + +std::string RuntimeOption::StartupDocument; +std::string RuntimeOption::WarmupDocument; +std::string RuntimeOption::RequestInitFunction; +std::vector RuntimeOption::ThreadDocuments; + +bool RuntimeOption::SafeFileAccess = false; +std::vector RuntimeOption::AllowedDirectories; +std::set RuntimeOption::AllowedFiles; +std::map RuntimeOption::StaticFileExtensions; +std::set RuntimeOption::StaticFileGenerators; + +std::string RuntimeOption::TakeoverFilename; +int RuntimeOption::AdminServerPort; +int RuntimeOption::AdminThreadCount = 1; +std::string RuntimeOption::AdminPassword; + +std::string RuntimeOption::ProxyOrigin; +int RuntimeOption::ProxyRetry = 3; +bool RuntimeOption::UseServeURLs; +std::set RuntimeOption::ServeURLs; +bool RuntimeOption::UseProxyURLs; +int RuntimeOption::ProxyPercentage = 0; +std::set RuntimeOption::ProxyURLs; + +bool RuntimeOption::MySQLReadOnly = false; +bool RuntimeOption::MySQLLocalize = false; +int RuntimeOption::MySQLConnectTimeout = 1000; +int RuntimeOption::MySQLReadTimeout = 1000; +int RuntimeOption::MySQLSlowQueryThreshold = 1000; // ms +bool RuntimeOption::MySQLKillOnTimeout = false; + +int RuntimeOption::HttpDefaultTimeout = 30; +int RuntimeOption::HttpSlowQueryThreshold = 5000; // ms + +int RuntimeOption::SocketDefaultTimeout = 5; +bool RuntimeOption::LocalMemcache = false; +bool RuntimeOption::MemcacheReadOnly = false; + +bool RuntimeOption::FullBacktrace = false; +bool RuntimeOption::ServerStackTrace = false; +bool RuntimeOption::ServerErrorMessage = false; +bool RuntimeOption::TranslateSource = false; +bool RuntimeOption::RecordInput = false; +bool RuntimeOption::ClearInputOnSuccess = true; +std::string RuntimeOption::ProfilerOutputDir; +std::string RuntimeOption::CoreDumpEmail; +bool RuntimeOption::CoreDumpReport = true; + +bool RuntimeOption::EnableStats = false; +bool RuntimeOption::EnableWebStats = false; +bool RuntimeOption::EnableMemoryStats = false; +bool RuntimeOption::EnableMallocStats = false; +bool RuntimeOption::EnableAPCStats = false; +bool RuntimeOption::EnableAPCKeyStats = false; +bool RuntimeOption::EnableMemcacheStats = false; +bool RuntimeOption::EnableSQLStats = false; +std::string RuntimeOption::StatsXSL; +std::string RuntimeOption::StatsXSLProxy; +int RuntimeOption::StatsSlotDuration = 10 * 60; // 10 minutes +int RuntimeOption::StatsMaxSlot = 12 * 6; // 12 hours + +int64 RuntimeOption::MaxRSS = 0; +bool RuntimeOption::EnableMemoryManager = false; +bool RuntimeOption::CheckMemory = false; +bool RuntimeOption::UseZendArray = true; +bool RuntimeOption::EnableApc = true; +bool RuntimeOption::ApcUseSharedMemory = false; +int RuntimeOption::ApcSharedMemorySize = 1024; // 1GB +std::string RuntimeOption::ApcPrimeLibrary; +int RuntimeOption::ApcLoadThread = 1; +std::set RuntimeOption::ApcCompletionKeys; +RuntimeOption::ApcTableTypes RuntimeOption::ApcTableType = ApcHashTable; +RuntimeOption::ApcTableLockTypes RuntimeOption::ApcTableLockType = + ApcReadWriteLock; +time_t RuntimeOption::ApcKeyMaturityThreshold = 20; +size_t RuntimeOption::ApcMaximumCapacity = 0; +int RuntimeOption::ApcKeyFrequencyUpdatePeriod = 1000; +bool RuntimeOption::ApcUseLockedRefs = false; +bool RuntimeOption::ApcExpireOnSets = false; +int RuntimeOption::ApcPurgeFrequency = 4096; + +bool RuntimeOption::EnableDnsCache = false; +int RuntimeOption::DnsCacheTTL = 10 * 60; // 10 minutes +time_t RuntimeOption::DnsCacheKeyMaturityThreshold = 20; +size_t RuntimeOption::DnsCacheMaximumCapacity = 0; +int RuntimeOption::DnsCacheKeyFrequencyUpdatePeriod = 1000; + +std::map RuntimeOption::ServerVariables; +std::map RuntimeOption::EnvVariables; + +std::string RuntimeOption::LightProcessFilePrefix; +int RuntimeOption::LightProcessCount; + +bool RuntimeOption::InjectedStacktrace = false; + +bool RuntimeOption::EnableXHP = true; +bool RuntimeOption::EnableStrict = false; +int RuntimeOption::StrictLevel = 1; // StrictBasic, cf strict_mode.h +bool RuntimeOption::StrictFatal = false; +std::vector RuntimeOption::IncludeSearchPaths; + +bool RuntimeOption::SandboxMode = false; +std::string RuntimeOption::SandboxPattern; +std::string RuntimeOption::SandboxHome; +std::string RuntimeOption::SandboxConfFile; +std::map RuntimeOption::SandboxServerVariables; + +std::string RuntimeOption::SendmailPath; +std::string RuntimeOption::MailForceExtraParameters; + +/////////////////////////////////////////////////////////////////////////////// +// keep this block after all the above static variables, or we will have +// static variable dependency problems on initialization + +class DefaultRuntimeOptionLoader { +public: + static DefaultRuntimeOptionLoader Loader; + + DefaultRuntimeOptionLoader() { + Hdf empty; + RuntimeOption::Load(empty); // so we load defaults defined in Load(Hdf) + } +}; + +DefaultRuntimeOptionLoader DefaultRuntimeOptionLoader::Loader; + +/////////////////////////////////////////////////////////////////////////////// + +static void setResourceLimit(int resource, Hdf rlimit, const char *nodeName) { + if (!rlimit[nodeName].getString("").empty()) { + struct rlimit rl; + getrlimit(resource, &rl); + rl.rlim_cur = rlimit[nodeName].getInt64(); + if (rl.rlim_max < rl.rlim_cur) { + rl.rlim_max = rl.rlim_cur; + } + int ret = setrlimit(resource, &rl); + if (ret) { + Logger::Error("Unable to set %s to %ld: %s (%d)", nodeName, rl.rlim_cur, + Util::safe_strerror(errno).c_str(), errno); + } + } +} + +static void normalizePath(std::string &path) { + if (!path.empty()) { + if (path[path.length() - 1] == '/') { + path = path.substr(0, path.length() - 1); + } + if (path[0] != '/') { + path = std::string("/") + path; + } + } +} + +void RuntimeOption::Load(Hdf &config) { + PidFile = config["PidFile"].getString("www.pid"); + + // Tier overwrites + { + Hdf tiers = config["Tiers"]; + string hostname = Process::GetHostName(); + for (Hdf hdf = tiers.firstChild(); hdf.exists(); hdf = hdf.next()) { + string pattern = hdf["machine"].getString(""); + if (!pattern.empty()) { + Variant ret = preg_match(String(pattern.c_str(), pattern.size(), + AttachLiteral), + String(hostname.c_str(), hostname.size(), + AttachLiteral)); + if (ret.toInt64() > 0) { + Tier = hdf.getName(); + config.copy(hdf["overwrite"]); + // no break here, so we can continue to match more overwrites + } + } + } + } + + { + Hdf logger = config["Log"]; + if (logger["Level"] == "None") { + Logger::LogLevel = Logger::LogNone; + } else if (logger["Level"] == "Error") { + Logger::LogLevel = Logger::LogError; + } else if (logger["Level"] == "Warning") { + Logger::LogLevel = Logger::LogWarning; + } else if (logger["Level"] == "Info") { + Logger::LogLevel = Logger::LogInfo; + } else if (logger["Level"] == "Verbose") { + Logger::LogLevel = Logger::LogVerbose; + } + Logger::LogHeader = logger["Header"].getBool(false); + Logger::MaxMessagesPerRequest = + logger["MaxMessagesPerRequest"].getInt32(-1); + + Logger::UseLogFile = logger["UseLogFile"].getBool(true); + if (Logger::UseLogFile) { + LogFile = logger["File"].getString(""); + } + + Hdf aggregator = logger["Aggregator"]; + Logger::UseLogAggregator = aggregator.getBool(false); + LogAggregatorFile = aggregator["File"].getString(""); + LogAggregatorDatabase = aggregator["Database"].getString(""); + LogAggregatorSleepSeconds = aggregator["SleepSeconds"].getInt16(10); + + AlwaysLogUnhandledExceptions = + logger["AlwaysLogUnhandledExceptions"].getBool(true); + EnableApplicationLog = logger["ApplicationLog"].getBool(true); + + AccessLogDefaultFormat = logger["AccessLogDefaultFormat"]. + getString("%h %l %u %t \"%r\" %>s %b"); + { + Hdf access = logger["Access"]; + for (Hdf hdf = access.firstChild(); hdf.exists(); + hdf = hdf.next()) { + string fname = hdf["File"].getString(""); + if (fname.empty()) { + continue; + } + AccessLogs. + push_back(pair(fname, hdf["Format"]. + getString(AccessLogDefaultFormat))); + } + } + + AdminLogFormat = logger["AdminLogFormat"].getString("%h %t %s %U"); + AdminLogFile = logger["AdminLogFile"].getString(""); + } + { + Hdf error = config["ErrorHandling"]; + ThrowBadTypeExceptions = error["ThrowBadTypeExceptions"].getBool(false); + ThrowNotices = error["ThrowNotices"].getBool(false); + AssertActive = error["AssertActive"].getBool(false); + AssertWarning = error["AssertWarning"].getBool(false); + } + { + Hdf rlimit = config["ResourceLimit"]; + setResourceLimit(RLIMIT_CORE, rlimit, "CoreFileSize"); + setResourceLimit(RLIMIT_NOFILE, rlimit, "MaxSocket"); + setResourceLimit(RLIMIT_DATA, rlimit, "RSS"); + MaxRSS = rlimit["RSS"].getInt64(0); + } + { + Hdf server = config["Server"]; + Host = server["Host"].getString(""); + ServerIP = server["IP"].getString("0.0.0.0"); + ServerPrimaryIP = Util::GetPrimaryIP(); + ServerPort = server["Port"].getInt16(80); + ServerThreadCount = server["ThreadCount"].getInt32(50); + PageletServerThreadCount = server["PageletServerThreadCount"].getInt32(0); + RequestTimeoutSeconds = server["RequestTimeoutSeconds"].getInt32(-1); + RequestMemoryMaxBytes = server["RequestMemoryMaxBytes"].getInt64(-1); + ResponseQueueCount = server["ResponseQueueCount"].getInt32(0); + if (ResponseQueueCount <= 0) { + ResponseQueueCount = ServerThreadCount / 10; + if (ResponseQueueCount <= 0) ResponseQueueCount = 1; + } + ServerGracefulShutdownWait = server["GracefulShutdownWait"].getInt16(0); + ServerHarshShutdown = server["HarshShutdown"].getBool(true); + ServerEvilShutdown = server["EvilShutdown"].getBool(true); + ServerDanglingWait = server["DanglingWait"].getInt16(0); + if (ServerGracefulShutdownWait < ServerDanglingWait) { + ServerGracefulShutdownWait = ServerDanglingWait; + } + GzipCompressionLevel = server["GzipCompressionLevel"].getInt16(3); + EnableKeepAlive = server["EnableKeepAlive"].getBool(true); + EnableEarlyFlush = server["EnableEarlyFlush"].getBool(true); + ForceChunkedEncoding = server["ForceChunkedEncoding"].getBool(false); + MaxPostSize = (server["MaxPostSize"].getInt32(8)) * (1 << 20); + UploadMaxFileSize = (server["MaxPostSize"].getInt32(10)) * (1 << 20); + EnableFileUploads = server["EnableFileUploads"].getBool(true); + LibEventSyncSend = server["LibEventSyncSend"].getBool(true); + TakeoverFilename = server["TakeoverFilename"].getString(""); + ExpiresActive = server["ExpiresActive"].getBool(true); + ExpiresDefault = server["ExpiresDefault"].getInt32(2592000); + if (ExpiresDefault < 0) ExpiresDefault = 2592000; + DefaultCharsetName = server["DefaultCharsetName"].getString("UTF-8"); + + SourceRoot = server["SourceRoot"].getString(""); + if (!SourceRoot.empty() && SourceRoot[SourceRoot.length() - 1] != '/') { + SourceRoot += '/'; + } + + FileCache = server["FileCache"].getString(""); + DefaultDocument = server["DefaultDocument"].getString(""); + ErrorDocument404 = server["ErrorDocument404"].getString(""); + normalizePath(ErrorDocument404); + FatalErrorMessage = server["FatalErrorMessage"].getString(""); + FontPath = server["FontPath"].getString(""); + if (!FontPath.empty() && FontPath[FontPath.length() - 1] != '/') { + FontPath += "/"; + } + EnableStaticContentCache = + server["EnableStaticContentCache"].getBool(true); + + RTTIDirectory = server["RTTIDirectory"].getString("/tmp/"); + if (!RTTIDirectory.empty() && + RTTIDirectory[RTTIDirectory.length() - 1] != '/') { + RTTIDirectory += "/"; + } + EnableCliRTTI = server["EnableCliRTTI"].getBool(false); + + StartupDocument = server["StartupDocument"].getString(""); + normalizePath(StartupDocument); + WarmupDocument = server["WarmupDocument"].getString(""); + RequestInitFunction = server["RequestInitFunction"].getString(""); + server["ThreadDocuments"].get(ThreadDocuments); + for (unsigned int i = 0; i < ThreadDocuments.size(); i++) { + normalizePath(ThreadDocuments[i]); + } + + SafeFileAccess = server["SafeFileAccess"].getBool(false); + server["AllowedDirectories"].get(AllowedDirectories); + for (unsigned int i = 0; i < AllowedDirectories.size(); i++) { + string &directory = AllowedDirectories[i]; + char resolved_path[PATH_MAX]; + if (realpath(directory.c_str(), resolved_path) && + directory != resolved_path) { + RuntimeOption::AllowedDirectories.push_back(resolved_path); + } + } + server["AllowedFiles"].get(AllowedFiles); + + EnableMemoryManager = server["EnableMemoryManager"].getBool(false); + CheckMemory = server["CheckMemory"].getBool(false); + UseZendArray = server["UseZendArray"].getBool(true); + + Hdf apc = server["APC"]; + EnableApc = apc["EnableApc"].getBool(true); + ApcUseSharedMemory = apc["UseSharedMemory"].getBool(false); + ApcSharedMemorySize = apc["SharedMemorySize"].getInt32(1024 /* 1GB */); + ApcPrimeLibrary = apc["PrimeLibrary"].getString(""); + ApcLoadThread = apc["LoadThread"].getInt16(2); + apc["CompletionKeys"].get(ApcCompletionKeys); + + string apcTableType = apc["TableType"].getString("hash"); + if (strcasecmp(apcTableType.c_str(), "hash") == 0) { + ApcTableType = ApcHashTable; + } else if (strcasecmp(apcTableType.c_str(), "lfu") == 0) { + ApcTableType = ApcLfuTable; + } else if (strcasecmp(apcTableType.c_str(), "concurrent") == 0) { + ApcTableType = ApcConcurrentTable; + } else { + throw InvalidArgumentException("apc table type", + "Invalid table type"); + } + string apcLockType = apc["LockType"].getString("readwritelock"); + if (strcasecmp(apcLockType.c_str(), "readwritelock") == 0) { + ApcTableLockType = ApcReadWriteLock; + } else if (strcasecmp(apcLockType.c_str(), "mutex") == 0) { + ApcTableLockType = ApcMutex; + } else { + throw InvalidArgumentException("apc lock type", + "Invalid lock type"); + } + + ApcUseLockedRefs = apc["UseLockedRefs"].getBool(false); + ApcExpireOnSets = apc["ExpireOnSets"].getBool(false); + ApcPurgeFrequency = apc["PurgeFrequency"].getInt32(4096); + + ApcKeyMaturityThreshold = apc["KeyMaturityThreshold"].getInt32(20); + ApcMaximumCapacity = apc["MaximumCapacity"].getInt64(0); + ApcKeyFrequencyUpdatePeriod = apc["KeyFrequencyUpdatePeriod"]. + getInt32(1000); + + + Hdf dns = server["DnsCache"]; + EnableDnsCache = dns["Enable"].getBool(false); + DnsCacheTTL = dns["TTL"].getInt32(600); // 10 minutes + DnsCacheKeyMaturityThreshold = dns["KeyMaturityThreshold"].getInt32(20); + DnsCacheMaximumCapacity = dns["MaximumCapacity"].getInt64(0); + DnsCacheKeyFrequencyUpdatePeriod = dns["KeyFrequencyUpdatePeriod"]. + getInt32(1000); + + SharedStores::Create(); + + LightProcessFilePrefix = + server["LightProcessFilePrefix"].getString("./lightprocess"); + LightProcessCount = server["LightProcessCount"].getInt32(0); + + InjectedStacktrace = server["InjectedStacktrace"].getBool(false); + } + { + Hdf hosts = config["VirtualHost"]; + if (hosts.exists()) { + for (Hdf hdf = hosts.firstChild(); hdf.exists(); hdf = hdf.next()) { + if (hdf.getName() == "default") { + VirtualHost::GetDefault().init(hdf); + } else { + VirtualHostPtr host(new VirtualHost(hdf)); + VirtualHosts.push_back(host); + } + } + for (unsigned int i = 0; i < VirtualHosts.size(); i++) { + if (!VirtualHosts[i]->valid()) { + throw InvalidArgumentException("virtual host", + "missing prefix or pattern"); + } + } + } + } + { + Hdf ipblocks = config["IpBlockMap"]; + IpBlocks = IpBlockMapPtr(new IpBlockMap(ipblocks)); + } + { + Hdf satellites = config["Satellites"]; + if (satellites.exists()) { + for (Hdf hdf = satellites.firstChild(); hdf.exists(); hdf = hdf.next()) { + SatelliteServerInfoPtr satellite(new SatelliteServerInfo(hdf)); + SatelliteServerInfos.push_back(satellite); + if (satellite->getType() == SatelliteServer::KindOfRPCServer) { + XboxPassword = satellite->getPassword(); + } + } + } + } + { + Hdf xbox = config["Xbox"]; + XboxServerThreadCount = xbox["ServerThreadCount"].getInt32(0); + XboxServerPort = xbox["ServerPort"].getInt32(0); + XboxDefaultLocalTimeoutMilliSeconds = + xbox["DefaultLocalTimeoutMilliSeconds"].getInt32(500); + XboxDefaultRemoteTimeoutSeconds = + xbox["DefaultRemoteTimeoutSeconds"].getInt32(5); + XboxServerInfoMaxRequest = xbox["ServerInfoMaxRequest"].getInt32(500); + XboxServerInfoDuration = xbox["ServerInfoDuration"].getInt32(120); + XboxServerInfoWarmupDoc = xbox["ServerInfoWarmupDoc"].get(""); + XboxServerInfoReqInitFunc = xbox["ServerInfoReqInitFunc"].get(""); + XboxProcessMessageFunc = + xbox["ProcessMessageFunc"].get("xbox_process_message"); + } + { + Hdf content = config["StaticFile"]; + content["Extensions"].get(StaticFileExtensions); + content["Generators"].get(StaticFileGenerators); + } + { + Hdf admin = config["AdminServer"]; + AdminServerPort = admin["Port"].getInt16(8088); + AdminThreadCount = admin["ThreadCount"].getInt32(1); + AdminPassword = admin["Password"].getString(""); + } + { + Hdf proxy = config["Proxy"]; + ProxyOrigin = proxy["Origin"].getString(""); + ProxyRetry = proxy["Retry"].getInt16(3); + UseServeURLs = proxy["ServeURLs"].getBool(false); + proxy["ServeURLs"].get(ServeURLs); + UseProxyURLs = proxy["ProxyURLs"].getBool(false); + ProxyPercentage = proxy["Percentage"].getByte(0); + proxy["ProxyURLs"].get(ProxyURLs); + } + { + Hdf mysql = config["MySQL"]; + MySQLReadOnly = mysql["ReadOnly"].getBool(false); + MySQLLocalize = mysql["Localize"].getBool(false); + MySQLConnectTimeout = mysql["ConnectTimeout"].getInt32(1000); + MySQLReadTimeout = mysql["ReadTimeout"].getInt32(1000); + MySQLSlowQueryThreshold = mysql["SlowQueryThreshold"].getInt32(1000); + MySQLKillOnTimeout = mysql["KillOnTimeout"].getBool(false); + } + { + Hdf http = config["Http"]; + HttpDefaultTimeout = http["DefaultTimeout"].getInt32(30); + HttpSlowQueryThreshold = http["SlowQueryThreshold"].getInt32(5000); + } + { + Hdf sandbox = config["Sandbox"]; + SocketDefaultTimeout = sandbox["SocketDefaultTimeout"].getInt16(5); + LocalMemcache = sandbox["LocalMemcache"].getBool(false); + MemcacheReadOnly = sandbox["MemcacheReadOnly"].getBool(false); + } + { + Hdf debug = config["Debug"]; + FullBacktrace = debug["FullBacktrace"].getBool(false); + ServerStackTrace = debug["ServerStackTrace"].getBool(false); + ServerErrorMessage = debug["ServerErrorMessage"].getBool(false); + TranslateSource = debug["TranslateSource"].getBool(false); + RecordInput = debug["RecordInput"].getBool(false); + ClearInputOnSuccess = debug["ClearInputOnSuccess"].getBool(true); + ProfilerOutputDir = debug["ProfilerOutputDir"].getString("/tmp"); + CoreDumpEmail = debug["CoreDumpEmail"].getString(""); + if (!CoreDumpEmail.empty()) { + StackTrace::ReportEmail = CoreDumpEmail; + } + CoreDumpReport = debug["CoreDumpReport"].getBool(true); + if (CoreDumpReport) { + StackTrace::InstallReportOnErrors(); + } + } + { + Hdf stats = config["Stats"]; + EnableStats = stats.getBool(false); // main switch + + EnableWebStats = stats["Web"].getBool(false); + EnableMemoryStats = stats["Memory"].getBool(false); + EnableMallocStats = stats["Malloc"].getBool(false); + EnableAPCStats = stats["APC"].getBool(false); + EnableAPCKeyStats = stats["APCKey"].getBool(false); + EnableMemcacheStats = stats["Memcache"].getBool(false); + EnableSQLStats = stats["SQL"].getBool(false); + + if (EnableStats && EnableMallocStats) { + LeakDetectable::EnableMallocStats(true); + } + + StatsXSL = stats["XSL"].getString(""); + StatsXSLProxy = stats["XSLProxy"].getString(""); + + StatsSlotDuration = stats["SlotDuration"].getInt32(10 * 60); // 10 minutes + StatsMaxSlot = stats["MaxSlot"].getInt32(12 * 6); // 12 hours + } + { + config["ServerVariables"].get(ServerVariables); + config["EnvVariables"].get(EnvVariables); + } + { + Hdf eval = config["Eval"]; + EnableXHP = eval["EnableXHP"].getBool(true); + EnableStrict = eval["EnableStrict"].getBool(0); + StrictLevel = eval["StrictLevel"].getInt32(1); // StrictBasic + StrictFatal = eval["StrictFatal"].getBool(false); + Hdf searchPaths = eval["IncludePaths"]; + if (searchPaths.exists()) { + searchPaths.get(IncludeSearchPaths); + } else { + IncludeSearchPaths.push_back("."); + } + } + { + Hdf sandbox = config["Sandbox"]; + SandboxMode = sandbox["SandboxMode"].getBool(false); + SandboxPattern = format_pattern(sandbox["Pattern"].getString("")); + SandboxHome = sandbox["Home"].getString(""); + SandboxConfFile = sandbox["ConfFile"].getString(""); + sandbox["ServerVariables"].get(SandboxServerVariables); + } + { + Hdf mail = config["Mail"]; + SendmailPath = mail["SendmailPath"].getString("sendmail -t -i"); + MailForceExtraParameters = mail["ForceExtraParameters"].getString(""); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/runtime_option.h b/src/cpp/base/runtime_option.h new file mode 100644 index 0000000000000..9b5d2d7699baa --- /dev/null +++ b/src/cpp/base/runtime_option.h @@ -0,0 +1,236 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __RUNTIME_OPTION_H__ +#define __RUNTIME_OPTION_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Configurable options set from command line or configurable file at startup + * time. + */ +class RuntimeOption { +public: + static void Load(Hdf &config); + + static const char *ExecutionMode; + static std::string BuildId; + static std::string PidFile; + + static std::string LogFile; + static std::string LogAggregatorFile; + static std::string LogAggregatorDatabase; + static int LogAggregatorSleepSeconds; + static bool AlwaysLogUnhandledExceptions; + static bool EnableApplicationLog; + + static bool ThrowBadTypeExceptions; + static bool ThrowNotices; + static bool AssertActive; + static bool AssertWarning; + + static std::string AccessLogDefaultFormat; + static std::vector > AccessLogs; + + static std::string AdminLogFormat; + static std::string AdminLogFile; + + static std::string Tier; + static std::string Host; + static std::string ServerIP; + static std::string ServerPrimaryIP; + static int ServerPort; + static int ServerThreadCount; + static int PageletServerThreadCount; + static int RequestTimeoutSeconds; + static int RequestMemoryMaxBytes; + static int ResponseQueueCount; + static int ServerGracefulShutdownWait; + static int ServerDanglingWait; + static bool ServerHarshShutdown; + static bool ServerEvilShutdown; + static int GzipCompressionLevel; + static bool EnableKeepAlive; + static bool EnableEarlyFlush; + static bool ForceChunkedEncoding; + static int MaxPostSize; + static int UploadMaxFileSize; + static bool EnableFileUploads; + static bool LibEventSyncSend; + static bool ExpiresActive; + static int ExpiresDefault; + static std::string DefaultCharsetName; + static VirtualHostPtrVec VirtualHosts; + static IpBlockMapPtr IpBlocks; + static SatelliteServerInfoPtrVec SatelliteServerInfos; + + static int XboxServerThreadCount; + static int XboxServerPort; + static int XboxDefaultLocalTimeoutMilliSeconds; + static int XboxDefaultRemoteTimeoutSeconds; + static int XboxServerInfoMaxRequest; + static int XboxServerInfoDuration; + static std::string XboxServerInfoWarmupDoc; + static std::string XboxServerInfoReqInitFunc; + static std::string XboxProcessMessageFunc; + static std::string XboxPassword; + + static std::string SourceRoot; + static std::string FileCache; + static std::string DefaultDocument; + static std::string ErrorDocument404; + static std::string FatalErrorMessage; + static std::string FontPath; + static bool EnableStaticContentCache; + + static std::string RTTIDirectory; + static bool EnableCliRTTI; + + static std::string StartupDocument; + static std::string WarmupDocument; + static std::string RequestInitFunction; + static std::vector ThreadDocuments; + + static bool SafeFileAccess; + static std::vector AllowedDirectories; + static std::set AllowedFiles; + static std::map StaticFileExtensions; + static std::set StaticFileGenerators; + + static std::string TakeoverFilename; + static int AdminServerPort; + static int AdminThreadCount; + static std::string AdminPassword; + + static std::string ProxyOrigin; + static int ProxyRetry; + static bool UseServeURLs; + static std::set ServeURLs; + static bool UseProxyURLs; + static int ProxyPercentage; + static std::set ProxyURLs; + + static bool MySQLReadOnly; + static bool MySQLLocalize; // whether to localize MySQL query results + static int MySQLConnectTimeout; + static int MySQLReadTimeout; + static int MySQLSlowQueryThreshold; + static bool MySQLKillOnTimeout; + + static int HttpDefaultTimeout; + static int HttpSlowQueryThreshold; + + static int SocketDefaultTimeout; + static bool LocalMemcache; + static bool MemcacheReadOnly; + + static bool FullBacktrace; + static bool ServerStackTrace; + static bool ServerErrorMessage; + static bool TranslateSource; + static bool RecordInput; + static bool ClearInputOnSuccess; + static std::string ProfilerOutputDir; + static std::string CoreDumpEmail; + static bool CoreDumpReport; + + static bool EnableStats; + static bool EnableWebStats; + static bool EnableMemoryStats; + static bool EnableMallocStats; + static bool EnableAPCStats; + static bool EnableAPCKeyStats; + static bool EnableMemcacheStats; + static bool EnableSQLStats; + static std::string StatsXSL; + static std::string StatsXSLProxy; + static int StatsSlotDuration; + static int StatsMaxSlot; + + static int64 MaxRSS; + static bool EnableMemoryManager; + static bool CheckMemory; + static bool UseZendArray; + static bool EnableApc; + static bool ApcUseSharedMemory; + static int ApcSharedMemorySize; + static std::string ApcPrimeLibrary; + static int ApcLoadThread; + static std::set ApcCompletionKeys; + enum ApcTableTypes { + ApcHashTable, + ApcLfuTable, + ApcConcurrentTable + }; + static ApcTableTypes ApcTableType; + enum ApcTableLockTypes { + ApcMutex, + ApcReadWriteLock + }; + static ApcTableLockTypes ApcTableLockType; + static time_t ApcKeyMaturityThreshold; + static size_t ApcMaximumCapacity; + static int ApcKeyFrequencyUpdatePeriod; + static bool ApcUseLockedRefs; + static bool ApcExpireOnSets; + static int ApcPurgeFrequency; + + static bool EnableDnsCache; + static int DnsCacheTTL; + static time_t DnsCacheKeyMaturityThreshold; + static size_t DnsCacheMaximumCapacity; + static int DnsCacheKeyFrequencyUpdatePeriod; + + static std::map ServerVariables; + + static std::map EnvVariables; + + // The file name that is used by LightProcess to bind the socket + // is the following prefix followed by the pid of the hphp process. + static std::string LightProcessFilePrefix; + static int LightProcessCount; + + // Use FrameInjection-based backtrace, which does not contain C++ frames. + static bool InjectedStacktrace; + + // Eval options + static bool EnableXHP; + static bool EnableStrict; + static int StrictLevel; + static bool StrictFatal; + static std::vector IncludeSearchPaths; + + // Sandbox options + static bool SandboxMode; + static std::string SandboxPattern; + static std::string SandboxHome; + static std::string SandboxConfFile; + static std::map SandboxServerVariables; + + // Mail options + static std::string SendmailPath; + static std::string MailForceExtraParameters; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __RUNTIME_OPTION_H__ diff --git a/src/cpp/base/server/access_log.cpp b/src/cpp/base/server/access_log.cpp new file mode 100644 index 0000000000000..259bf2b5c970c --- /dev/null +++ b/src/cpp/base/server/access_log.cpp @@ -0,0 +1,286 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +AccessLog::~AccessLog() { + for (uint i = 0; i < m_output.size(); ++i) { + if (m_output[i]) { + if (m_files[i].first[0] == '|') { + pclose(m_output[i]); + } else { + fclose(m_output[i]); + } + } + } +} + +bool AccessLog::init(const string &defaultFormat, + vector > &files) { + Lock l(m_initLock); + if (m_initialized) return false; + m_initialized = true; + m_defaultFormat = defaultFormat; + m_files = files; + return openFiles(); +} + +bool AccessLog::init(const string &format, + const string &file) { + Lock l(m_initLock); + if (m_initialized) return false; + m_initialized = true; + m_defaultFormat = format; + if (!file.empty() && !format.empty()) { + m_files.push_back(pair(file, format)); + } + return openFiles(); +} + +bool AccessLog::openFiles() { + ASSERT(m_output.empty()); + if (m_files.empty()) return false; + for (vector >::const_iterator it = m_files.begin(); + it != m_files.end(); ++it) { + const string &file = it->first; + ASSERT(!file.empty()); + FILE *fp = NULL; + if (file[0] == '|') { + string plog = file.substr(1); + fp = popen(plog.c_str(), "w"); + } else { + fp = fopen(file.c_str(), "a"); + } + if (!fp) { + Logger::Error("Could not open access log file %s", file.c_str()); + } + m_output.push_back(fp); + } + return !m_output.empty(); +} + +void AccessLog::log(Transport *transport) { + ASSERT(transport); + ASSERT(m_initialized); + FILE *threadLog = m_threadData->log; + if (threadLog) { + writeLog(transport, threadLog, + m_defaultFormat.c_str()); + } + for (uint i = 0; i < m_output.size(); ++i) { + FILE *outFile = m_output[i]; + if (!outFile) continue; + const char *format = m_files[i].second.c_str(); + writeLog(transport, outFile, format); + } +} + +void AccessLog::writeLog(Transport *transport, FILE *outFile, + const char *format) { + char c; + ostringstream out; + while (c = *format++) { + if (c != '%') { + out << c; + continue; + } + + if (parseConditions(format, transport->getResponseCode())) { + string arg = parseArgument(format); + if (!genField(out, format, transport, arg)) { + out << "-"; + } + } else { + skipField(format); + out << "-"; + } + } + out << endl; + string output = out.str(); + fprintf(outFile, "%s", output.c_str()); + fflush(outFile); +} + +bool AccessLog::parseConditions(const char* &format, int code) { + bool wantMatch = true; + if (*format == '!') { + wantMatch = false; + format++; + } else if (!isdigit(*format)) { + // No conditions + return true; + } + char buf[4]; + buf[3] = '\0'; + + bool matched = false; + while(isdigit(*format)) { + buf[0] = format[0]; + buf[1] = format[1]; + buf[2] = format[2]; + int c = atoi(buf); + if (c == code) { + matched = true; + break; + } + format+=4; + } + while (!(*format == '{' || isalpha(*format))) { + format++; + } + return wantMatch == matched; +} + +string AccessLog::parseArgument(const char* &format) { + if (*format != '{') return string(); + format++; + const char *start = format; + while (*format != '}') { format++; } + string res(start, format - start); + format++; + return res; +} + +void AccessLog::skipField(const char* &format) { + // Skip argument + if (*format == '{') { + while (*format != '}') { format++; } + format++; + } + // Find control letter + while (!isalpha(*format)) { format++; } + // Skip it + format++; +} + +bool AccessLog::genField(ostringstream &out, const char* &format, + Transport *transport, const string &arg) { + int responseSize = transport->getResponseSize(); + int code = transport->getResponseCode(); + + while (!isalpha(*format)) { format++; } + char type = *format; + format++; + + switch (type) { + case 'b': + if (responseSize == 0) return false; + // Fall through + case 'B': + out << responseSize; + break; + case 'h': + out << transport->getRemoteHost(); + break; + case 'i': + if (arg.empty()) return false; + { + string header = transport->getHeader(arg.c_str()); + if (header.empty()) return false; + out << header; + } + break; + case 'n': + if (arg.empty()) return false; + { + String note = ServerNote::Get(arg); + if (note.isNull()) return false; + out << note.c_str(); + } + break; + case 's': + out << code; + break; + case 't': + { + const char *format; + if (arg.empty()) { + format = "[%d/%M/%Y:%H:%M:%S %z]"; + } else { + format = arg.c_str(); + } + char buf[256]; + time_t rawtime; + struct tm * timeinfo; + time(&rawtime); + timeinfo = localtime(&rawtime); + strftime(buf, 256, format, timeinfo); + out << buf; + } + break; + case 'T': + out << TimeStamp::Current() - m_threadData->startTime; + break; + case 'r': + { + const char *method = NULL; + switch (transport->getMethod()) { + case Transport::GET: method = "GET"; break; + case Transport::POST: method = "POST"; break; + case Transport::HEAD: method = "HEAD"; break; + default: break; + } + if (!method) return false; + const char *url = transport->getUrl(); + string httpVersion = transport->getHTTPVersion(); + out << method << " " << url << " HTTP/" << httpVersion; + } + break; + case 'U': + { + String b, q; + RequestURI::splitURL(transport->getUrl(), b, q); + out << b; + } + break; + case 'v': + out << VirtualHost::GetCurrent()->serverName(); + break; + default: + return false; + } + return true; +} + +void AccessLog::onNewRequest() { + ASSERT(m_initialized); + ThreadData *threadData = m_threadData.get(); + threadData->startTime = TimeStamp::Current(); +} + +bool AccessLog::setThreadLog(const char *file) { + return (m_threadData->log = fopen(file, "a")) != NULL; +} +void AccessLog::clearThreadLog() { + FILE* &threadLog = m_threadData->log; + if (threadLog) { + fclose(threadLog); + } + threadLog = NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/access_log.h b/src/cpp/base/server/access_log.h new file mode 100644 index 0000000000000..889b23a4fc00e --- /dev/null +++ b/src/cpp/base/server/access_log.h @@ -0,0 +1,69 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#ifndef __HPHP_ACCESS_LOG_H__ +#define __HPHP_ACCESS_LOG_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class AccessLog { +public: + AccessLog() : m_initialized(false) {} + ~AccessLog(); + bool init(const std::string &defaultFormat, + std::vector > &files); + bool init(const std::string &format, const std::string &file); + void log(Transport *transport); + bool setThreadLog(const char *file); + void clearThreadLog(); + void onNewRequest(); + std::string &defaultFormat() { return m_defaultFormat; } + std::vector > &files() { + return m_files; + } +private: + bool parseConditions(const char* &format, int code); + std::string parseArgument(const char* &format); + bool genField(std::ostringstream &out, const char* &format, + Transport *transport, const std::string &arg); + void skipField(const char* &format); + void writeLog(Transport *transport, FILE *outFile, + const char *format); + + std::vector m_output; + class ThreadData { + public: + ThreadData() : log(NULL) {} + FILE *log; + int64 startTime; + }; + bool m_initialized; + ThreadLocal m_threadData; + std::string m_defaultFormat; + std::vector > m_files; + + bool openFiles(); + Mutex m_initLock; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ACCESS_LOG_H__ diff --git a/src/cpp/base/server/admin_request_handler.cpp b/src/cpp/base/server/admin_request_handler.cpp new file mode 100644 index 0000000000000..cab0b0a822514 --- /dev/null +++ b/src/cpp/base/server/admin_request_handler.cpp @@ -0,0 +1,537 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef GOOGLE_CPU_PROFILER +#include +#endif +#ifdef GOOGLE_HEAP_PROFILER +#include +#endif +#ifdef GOOGLE_TCMALLOC +#include +#endif + +using namespace std; +using namespace boost; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +AccessLog AdminRequestHandler::s_accessLog; + +AdminRequestHandler::AdminRequestHandler() { + GetAccessLog().init(RuntimeOption::AdminLogFormat, + RuntimeOption::AdminLogFile); +} + +void AdminRequestHandler::handleRequest(Transport *transport) { + GetAccessLog().onNewRequest(); + string cmd = transport->getCommand(); + + do { + if (cmd == "" || cmd == "help") { + string usage = + "/stop: stop the web server\n" + "/translate: translate hex encoded stacktrace in 'stack' param\n" + " stack required, stack trace to translate\n" + " build-id optional, if specified, build ID has to match\n" + " bare optional, whether to display frame ordinates\n" + "/build-id: returns build id that's passed in from command line" + "\n" + + "/check-load: how many threads are actively handling requests\n" + "/check-mem: report memory quick statistics in log file\n" + "/check-apc: report APC quick statistics\n" + + "/status.xml: show server status in XML\n" + "/status.json: show server status in JSON\n" + "/status.html: show server status in HTML\n" + + "/stats-on: main switch: enable server stats\n" + "/stats-off: main switch: disable server stats\n" + "/stats-clear: clear all server stats\n" + + "/stats-web: turn on/off server page stats (CPU and gen time)\n" + "/stats-mem: turn on/off memory statistics\n" + "/stats-apc: turn on/off APC statistics\n" + "/stats-apc-key: turn on/off APC key statistics\n" + "/stats-mcc: turn on/off memcache statistics\n" + "/stats-sql: turn on/off SQL statistics\n" + "/stats-mutex: turn on/off mutex statistics\n" + " sampling optional, default 1000\n" + + "/stats.keys: list all available keys\n" + " from optional, , or <-n> second ago\n" + " to optional, , or <-n> second ago\n" + "/stats.xml: show server stats in XML\n" + " from optional, , or <-n> second ago\n" + " to optional, , or <-n> second ago\n" + " agg optional, aggragation: *, url, code\n" + " keys optional, ,,,<:regex:>\n" + " url optional, only stats of this page or URL\n" + " code optional, only stats of pages returning this code\n" + "/stats.json: show server stats in JSON\n" + " (same as /stats.xml)\n" + "/stats.kvp: show server stats in key-value pairs\n" + " (same as /stats.xml)\n" + "/stats.html: show server stats in HTML\n" + " (same as /stats.xml)\n" + +#ifdef GOOGLE_CPU_PROFILER + "/prof-cpu-on: turn on CPU profiler\n" + "/prof-cpu-off: turn off CPU profiler\n" +#endif +#ifdef GOOGLE_HEAP_PROFILER + "/prof-heap-on: turn on heap profiler\n" + "/prof-heap-dump: take one snapshot of the heap\n" + "/prof-heap-off: turn off heap profiler\n" + "/stats-malloc: turn on/off malloc statistics\n" + "/leak-on: start leak detection\n" + " sampling required, frequency\n" + "/leak-off: end leak detection and report leaking\n" + " cutoff optional, default 20 seconds, ignore newer allocs\n" +#endif +#ifdef GOOGLE_TCMALLOC + "/free-mem: ask tcmalloc to release memory to system\n" + "/tcmalloc-stats: get internal tcmalloc stats\n" +#endif + ; + transport->sendString(usage); + break; + } + + if (!RuntimeOption::AdminPassword.empty() && + RuntimeOption::AdminPassword != transport->getParam("auth")) { + transport->sendString("Unauthorized", 401); + break; + } + + if (cmd == "stop") { + transport->sendString("OK\n"); + HttpServer::Server->stop(); + break; + } + if (cmd == "build-id") { + transport->sendString(RuntimeOption::BuildId, 200); + break; + } + if (cmd == "translate") { + string buildId = transport->getParam("build-id"); + if (!buildId.empty() && buildId != RuntimeOption::BuildId) { + transport->sendString("Build ID doesn't match.", 500); + break; + } + + string translated = translate_stack(transport->getParam("stack").c_str(), + transport->getParam("bare").empty()); + transport->sendString(translated); + break; + } + if (strncmp(cmd.c_str(), "check", 5) == 0 && + handleCheckRequest(cmd, transport)) { + break; + } + if (strncmp(cmd.c_str(), "status", 6) == 0 && + handleStatusRequest(cmd, transport)) { + break; + } + if (strncmp(cmd.c_str(), "stats", 5) == 0 && + handleStatsRequest(cmd, transport)) { + break; + } + if (strncmp(cmd.c_str(), "prof", 4) == 0 && + handleProfileRequest(cmd, transport)) { + break; + } + if (strncmp(cmd.c_str(), "leak", 4) == 0 && + handleLeakRequest(cmd, transport)) { + break; + } +#ifdef GOOGLE_TCMALLOC + if (cmd == "free-mem") { + MallocExtension::instance()->ReleaseFreeMemory(); + } + if (cmd == "tcmalloc-stats") { + ostringstream stats; + size_t user_allocated, heap_size, slack_bytes; + MallocExtension::instance()-> + GetNumericProperty("generic.current_allocated_bytes", &user_allocated); + MallocExtension::instance()-> + GetNumericProperty("generic.heap_size", &heap_size); + MallocExtension::instance()-> + GetNumericProperty("tcmalloc.slack_bytes", &slack_bytes); + stats << "" << endl; + stats << " " << user_allocated << "" << + endl; + stats << " " << heap_size << "" << endl; + stats << " " << slack_bytes << "" << endl; + stats << "" << endl; + transport->sendString(stats.str()); + break; + } +#endif + + transport->sendString("Unknown command: " + cmd + "\n", 404); + } while (0); + GetAccessLog().log(transport); +} + +/////////////////////////////////////////////////////////////////////////////// +// stats commands + +static bool toggle_switch(Transport *transport, bool &setting) { + setting = !setting; + transport->sendString(setting ? "On\n" : "Off\n"); + return true; +} + +static bool send_report(Transport *transport, ServerStats::Format format, + const char *mime) { + int64 from = transport->getInt64Param ("from"); + int64 to = transport->getInt64Param ("to"); + string agg = transport->getParam ("agg"); + string keys = transport->getParam ("keys"); + string url = transport->getParam ("url"); + int code = transport->getIntParam ("code"); + string prefix = transport->getParam ("prefix"); + + string out; + ServerStats::Report(out, format, from, to, agg, keys, url, code, prefix); + + transport->addHeader("Content-Type", mime); + transport->sendString(out); + return true; +} + +static bool send_status(Transport *transport, ServerStats::Format format, + const char *mime) { + string out; + ServerStats::ReportStatus(out, format); + + transport->addHeader("Content-Type", mime); + transport->sendString(out); + return true; +} + +bool AdminRequestHandler::handleCheckRequest(const std::string &cmd, + Transport *transport) { + if (cmd == "check-load") { + int count = HttpServer::Server->getPageServer()->getActiveWorker(); + transport->sendString(lexical_cast(count)); + return true; + } + if (cmd == "check-mem") { + return toggle_switch(transport, RuntimeOption::CheckMemory); + } + if (cmd == "check-apc") { + string stats = "\n"; + stats += "\n"; + stats += SharedStores::ReportStats(1); + stats += "\n"; + transport->sendString(stats); + return true; + } + return false; +} + +bool AdminRequestHandler::handleStatusRequest(const std::string &cmd, + Transport *transport) { + if (cmd == "status.xml") { + return send_status(transport, ServerStats::XML, "application/xml"); + } + if (cmd == "status.json") { + return send_status(transport, ServerStats::JSON, "application/json"); + } + if (cmd == "status.html" || cmd == "status.htm") { + return send_status(transport, ServerStats::HTML, "text/html"); + } + return false; +} + +bool AdminRequestHandler::handleStatsRequest(const std::string &cmd, + Transport *transport) { + if (cmd == "stats-on") { + RuntimeOption::EnableStats = true; + transport->sendString("OK\n"); + return true; + } + if (cmd == "stats-off") { + RuntimeOption::EnableStats = false; + transport->sendString("OK\n"); + return true; + } + if (cmd == "stats-clear") { + ServerStats::Clear(); + transport->sendString("OK\n"); + return true; + } + + if (cmd == "stats-web") { + return toggle_switch(transport, RuntimeOption::EnableWebStats); + } + if (cmd == "stats-mem") { + toggle_switch(transport, RuntimeOption::EnableMemoryStats); + return true; + } + if (cmd == "stats-malloc") { + toggle_switch(transport, RuntimeOption::EnableMallocStats); + LeakDetectable::EnableMallocStats(RuntimeOption::EnableMallocStats); + return true; + } + if (cmd == "stats-apc") { + return toggle_switch(transport, RuntimeOption::EnableAPCStats); + } + if (cmd == "stats-apc-key") { + return toggle_switch(transport, RuntimeOption::EnableAPCKeyStats); + } + if (cmd == "stats-mcc") { + return toggle_switch(transport, RuntimeOption::EnableMemcacheStats); + } + if (cmd == "stats-sql") { + return toggle_switch(transport, RuntimeOption::EnableSQLStats); + } + if (cmd == "stats-mutex") { + int sampling = transport->getIntParam("sampling"); + if (sampling > 0) { + LockProfiler::s_profile_sampling = sampling; + } + return toggle_switch(transport, LockProfiler::s_profile); + } + + if (cmd == "stats.keys") { + int64 from = transport->getInt64Param("from"); + int64 to = transport->getInt64Param("to"); + string out; + ServerStats::GetKeys(out, from, to); + transport->sendString(out); + return true; + } + if (cmd == "stats.xml") { + return send_report(transport, ServerStats::XML, "application/xml"); + } + if (cmd == "stats.json") { + return send_report(transport, ServerStats::JSON, "application/json"); + } + if (cmd == "stats.kvp") { + return send_report(transport, ServerStats::KVP, "text/plain"); + } + if (cmd == "stats.html" || cmd == "stats.htm") { + return send_report(transport, ServerStats::HTML, "text/html"); + } + + if (cmd == "stats.xsl") { + string xsl; + if (!RuntimeOption::StatsXSLProxy.empty()) { + StringBuffer response; + if (HttpClient().get(RuntimeOption::StatsXSLProxy.c_str(), response) == + 200) { + xsl = response.data(); + if (!xsl.empty()) { + transport->addHeader("Content-Type", "application/xml"); + transport->sendString(xsl); + return true; + } + } + } + transport->sendString("Not Found\n", 404); + return true; + } + + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// profile commands + +bool AdminRequestHandler::handleProfileRequest(const std::string &cmd, + Transport *transport) { +#ifdef GOOGLE_CPU_PROFILER + if (handleCPUProfilerRequest(cmd, transport)) { + return true; + } +#endif +#ifdef GOOGLE_HEAP_PROFILER + if (handleHeapProfilerRequest(cmd, transport)) { + return true; + } +#endif + return false; +} + +#if (defined(GOOGLE_CPU_PROFILER) || defined(GOOGLE_HEAP_PROFILER)) + +// call pprof to generate outputs +static void pprof(const std::string &file, const char *extra = NULL) { + string program = Process::GetAppName(); + const char *formats[] = {"--pdf", "--gif", "--callgrind"}; + const char *argv[] = {"", NULL, program.c_str(), file.c_str(), extra, NULL}; + String now = DateTime::Current()->toString("YmdHis"); + for (unsigned int i = 0; i < sizeof(formats)/sizeof(formats[0]); i++) { + argv[1] = formats[i]; + string out, err; + if (Process::Exec("pprof", argv, "", out, &err) && !out.empty()) { + char filename[PATH_MAX]; + snprintf(filename, sizeof(filename), "%s.%s.%s", file.c_str(), + now.data(), formats[i] + 2 /* skipping -- */); + FILE *f = fopen(filename, "w"); + if (f) { + fwrite(out.c_str(), 1, out.size(), f); + fclose(f); + Logger::Info("pprof generated %s", filename); + } + } + } +} + +#endif + +#ifdef GOOGLE_CPU_PROFILER +bool AdminRequestHandler::handleCPUProfilerRequest(const std::string &cmd, + Transport *transport) { + string file = RuntimeOption::ProfilerOutputDir + "/" + + Process::HostName + "/hphp.prof"; + + if (cmd == "prof-cpu-on") { + if (Util::mkdir(file)) { + ProfilerStart(file.c_str()); + transport->sendString("OK\n"); + } else { + transport->sendString("Unable to mkdir for profile data.\n"); + } + return true; + } + if (cmd == "prof-cpu-off") { + ProfilerStop(); + ProfilerFlush(); + transport->sendString("OK\n"); + pprof(file); + return true; + } + return false; +} +#endif + +#ifdef GOOGLE_HEAP_PROFILER +bool AdminRequestHandler::handleHeapProfilerRequest(const std::string &cmd, + Transport *transport) { + string root = RuntimeOption::ProfilerOutputDir + "/" + + Process::HostName; + string file = root + "/hphp.prof"; + + if (cmd == "prof-heap-on") { + if (IsHeapProfilerRunning()) { + transport->sendString("HeapProfiler is already running.\n"); + } else { + if (Util::mkdir(file)) { + // clean up leftovers + string cmd = "/bin/rm -f "; + cmd += file + ".*.heap"; + Util::ssystem(cmd.c_str()); + + HeapProfilerStart(file.c_str()); + HeapProfilerDump("start"); + transport->sendString("OK\n"); + } else { + transport->sendString("Unable to mkdir for profile data.\n"); + } + } + return true; + } + if (cmd == "prof-heap-dump") { + if (!IsHeapProfilerRunning()) { + transport->sendString("HeapProfiler is not running.\n"); + } else { + HeapProfilerDump("end"); + transport->sendString("OK\n"); + } + return true; + } + if (cmd == "prof-heap-off") { + if (!IsHeapProfilerRunning()) { + transport->sendString("HeapProfiler is not running.\n"); + } else { + HeapProfilerDump("end"); + HeapProfilerStop(); + transport->sendString("OK\n"); + + const char *argv[] = {"", root.c_str(), "-name", "*.heap", NULL}; + string files; + Process::Exec("find", argv, NULL, files); + vector out; + Util::split('\n', files.c_str(), out, true); + if (out.size() > 1) { + string base = "--base="; + base += out[0]; + pprof(out[out.size() - 1], base.c_str()); + } else { + Logger::Error("Unable to find heap profiler output"); + } + } + return true; + } + return false; +} +#endif + +/////////////////////////////////////////////////////////////////////////////// +// leak detection + +bool AdminRequestHandler::handleLeakRequest(const std::string &cmd, + Transport *transport) { + if (cmd == "leak-on") { + LeakDetectable::BeginLeakChecking(); // class-based detection starts + LeakDetectable::MallocSampling = transport->getIntParam("sampling"); + LeakDetectable::BeginMallocSampling(); // malloc-based detection starts + transport->sendString("OK\n"); + return true; + } + if (cmd == "leak-off") { + std::string dumps; + + // class-based detection ends + int count = LeakDetectable::EndLeakChecking(dumps, 1); + dumps += "\n"; + dumps += boost::lexical_cast(count) + " leaked LeakDetectables\n"; + + // malloc-based detection + int cutoff = transport->getIntParam("cutoff"); + LeakDetectable::EndMallocSampling(dumps, cutoff ? cutoff : 20); + LeakDetectable::MallocSampling = 0; + + transport->sendString(dumps); + return true; + } + + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/admin_request_handler.h b/src/cpp/base/server/admin_request_handler.h new file mode 100644 index 0000000000000..8e36613533a52 --- /dev/null +++ b/src/cpp/base/server/admin_request_handler.h @@ -0,0 +1,53 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __ADMIN_REQUEST_HANDLER_H__ +#define __ADMIN_REQUEST_HANDLER_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class AdminRequestHandler : public RequestHandler { +public: + AdminRequestHandler(); + // implementing RequestHandler + virtual void handleRequest(Transport *transport); + +private: + bool handleCheckRequest (const std::string &cmd, Transport *transport); + bool handleStatusRequest (const std::string &cmd, Transport *transport); + bool handleStatsRequest (const std::string &cmd, Transport *transport); + bool handleProfileRequest(const std::string &cmd, Transport *transport); + bool handleLeakRequest (const std::string &cmd, Transport *transport); + +#ifdef GOOGLE_CPU_PROFILER + bool handleCPUProfilerRequest (const std::string &cmd, Transport *transport); +#endif +#ifdef GOOGLE_HEAP_PROFILER + bool handleHeapProfilerRequest(const std::string &cmd, Transport *transport); +#endif + + static AccessLog s_accessLog; + static AccessLog &GetAccessLog() { return s_accessLog; } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __ADMIN_REQUEST_HANDLER_H__ diff --git a/src/cpp/base/server/dynamic_content_cache.cpp b/src/cpp/base/server/dynamic_content_cache.cpp new file mode 100644 index 0000000000000..c60d70f61fba2 --- /dev/null +++ b/src/cpp/base/server/dynamic_content_cache.cpp @@ -0,0 +1,80 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DynamicContentCache DynamicContentCache::TheCache; + +DynamicContentCache::DynamicContentCache() { +} + +bool DynamicContentCache::find(const std::string &name, const char *&data, + int &len, bool &compressed) { + ASSERT(!name.empty()); + + ReadLock lock(m_mutex); + StringToResourceFilePtrMap::const_iterator iter = m_files.find(name); + if (iter != m_files.end()) { + ResourceFile &f = *iter->second; + if (compressed && f.compressed) { + data = f.compressed->data(); + len = f.compressed->size(); + } else { + compressed = false; + data = f.file->data(); + len = f.file->size(); + } + return true; + } + return false; +} + +void DynamicContentCache::store(const std::string &name, const char *data, + int size) { + ASSERT(!name.empty()); + ASSERT(size > 0); + + ResourceFilePtr f(new ResourceFile()); + StringBufferPtr sb(new StringBuffer(size)); + sb->append(data, size); + f->file = sb; + + int len = sb->size(); + char *compressed = gzencode(sb->data(), len, 9, CODING_GZIP); + if (compressed) { + if (len < sb->size()) { + f->compressed = StringBufferPtr(new StringBuffer(compressed, len)); + } else { + free(compressed); + } + } + + WriteLock lock(m_mutex); + if (m_files.find(name) == m_files.end()) { + m_files[name] = f; + } +} + +/////////////////////////////////////////////////////////////////////////////// +} + diff --git a/src/cpp/base/server/dynamic_content_cache.h b/src/cpp/base/server/dynamic_content_cache.h new file mode 100644 index 0000000000000..2aef0f7e73705 --- /dev/null +++ b/src/cpp/base/server/dynamic_content_cache.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __DYNAMIC_CONTENT_CACHE_H__ +#define __DYNAMIC_CONTENT_CACHE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class DynamicContentCache { +public: + static DynamicContentCache TheCache; + +public: + DynamicContentCache(); + + /** + * Find a file from cache. + */ + bool find(const std::string &name, const char *&data, int &len, + bool &compressed); + + /** + * Store a file to cache. + */ + void store(const std::string &name, const char *data, int size); + +private: + ReadWriteMutex m_mutex; + + struct ResourceFile { + StringBufferPtr file; + StringBufferPtr compressed; + }; + DECLARE_BOOST_TYPES(ResourceFile); + + StringToResourceFilePtrMap m_files; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __DYNAMIC_CONTENT_CACHE_H__ diff --git a/src/cpp/base/server/http_protocol.cpp b/src/cpp/base/server/http_protocol.cpp new file mode 100644 index 0000000000000..1660380fb2d8b --- /dev/null +++ b/src/cpp/base/server/http_protocol.cpp @@ -0,0 +1,490 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +const VirtualHost *HttpProtocol::GetVirtualHost(Transport *transport) { + if (!RuntimeOption::VirtualHosts.empty()) { + string host = transport->getHeader("Host"); + for (unsigned int i = 0; i < RuntimeOption::VirtualHosts.size(); i++) { + VirtualHostPtr vhost = RuntimeOption::VirtualHosts[i]; + if (vhost->match(host)) { + VirtualHost::SetCurrent(vhost.get()); + return vhost.get(); + } + } + } + VirtualHost::SetCurrent(NULL); + return VirtualHost::GetCurrent(); +} + +/** + * PHP has "EGPCS" processing order of these global variables, and this + * order is important in preparing $_REQUEST that needs to know which to + * overwrite what when name happens to be the same. + */ +void HttpProtocol::PrepareSystemVariables(Transport *transport, + const RequestURI &r, + const SourceRootInfo &sri) { + SystemGlobals *g = (SystemGlobals*)get_global_variables(); + const VirtualHost *vhost = VirtualHost::GetCurrent(); + + // reset global symbols to nulls or empty arrays + pm_php$globals$symbols_php(); + + // $_ENV + process_env_variables(g->gv__ENV); + g->gv__ENV.set("HPHP", 1); + g->gv__ENV.set("HPHP_SERVER", 1); +#ifdef HOTPROFILER + g->gv__ENV.set("HPHP_HOTPROFILER", 1); +#endif + + Variant &request = g->gv__REQUEST; + + // $_GET and $_REQUEST + if (!r.queryString().empty()) { + DecodeParameters(g->gv__GET, r.queryString().data(), + r.queryString().size()); + CopyParams(request, g->gv__GET); + } + + string contentType = transport->getHeader("Content-Type"); + string contentLength = transport->getHeader("Content-Length"); + // $_POST and $_REQUEST + if (transport->getMethod() == Transport::POST) { + int size = 0; + const void *data = transport->getPostData(size); + if (data && size) { + ASSERT(((char*)data)[size] == 0); // we need a NULL terminated string + string boundary; + bool rfc1867Post = IsRfc1867(contentType, boundary); + if (rfc1867Post) { + int content_length = atoi(contentLength.c_str()); + if (content_length > RuntimeOption::MaxPostSize) { + // $_POST and $_FILES are empty + Logger::Warning("POST Content-Length of %d bytes exceeds " + "the limit of %ld bytes", + size, RuntimeOption::MaxPostSize); + } else { + DecodeRfc1867(g->gv__POST, g->gv__FILES, content_length, + (const char*)data, size, boundary); + } + } else { + DecodeParameters(g->gv__POST, (const char*)data, size, true); + } + CopyParams(request, g->gv__POST); + g->gv_HTTP_RAW_POST_DATA = String((char*)data, size, AttachLiteral); + } + } + + // $_COOKIE + string cookie_data = transport->getHeader("Cookie"); + if (!cookie_data.empty()) { + DecodeCookies(g->gv__COOKIE, cookie_data.data()); + CopyParams(request, g->gv__COOKIE); + } + + // $_SERVER + Variant &server = g->gv__SERVER; + + // HTTP_ headers -- we don't exclude headers we handle elsewhere (e.g., + // Content-Type, Authorization), since the CGI "spec" merely says the server + // "may" exclude them; this is not what APE does, but it's harmless. + HeaderMap headers; + transport->getHeaders(headers); + for (HeaderMap::const_iterator iter = headers.begin(); + iter != headers.end(); ++iter) { + const vector &values = iter->second; + for (unsigned int i = 0; i < values.size(); i++) { + String key = "HTTP_"; + key += StringUtil::ToUpper(iter->first).replace("-", "_"); + server.set(key, String(values[i])); + } + } + String hostName(VirtualHost::GetCurrent()->serverName()); + if (transport->getHeader("Host").empty()) { + server.set("HTTP_HOST", hostName); + } + + // APE sets CONTENT_TYPE and CONTENT_LENGTH without HTTP_ + if (!contentType.empty()) { + server.set("CONTENT_TYPE", String(contentType)); + } + if (!contentLength.empty()) { + server.set("CONTENT_LENGTH", String(contentLength)); + } + + // APE processes Authorization: Basic into PHP_AUTH_USER and PHP_AUTH_PW + string authorization = transport->getHeader("Authorization"); + if (!authorization.empty()) { + if (strncmp(authorization.c_str(), "Basic ", 6) == 0) { + // it's safe to pass this as a string literal since authorization + // outlives decodedAuth; this saves us a superfluous copy. + String decodedAuth = + StringUtil::Base64Decode(String(authorization.c_str() + 6)); + int colonPos = decodedAuth.find(':'); + if (colonPos != String::npos) { + server.set("PHP_AUTH_USER", decodedAuth.substr(0, colonPos)); + server.set("PHP_AUTH_PW", decodedAuth.substr(colonPos + 1)); + } + } + } + + server.set("REQUEST_URI", String(transport->getUrl(), CopyString)); + server.set("SCRIPT_URL", r.originalURL()); + server.set("SCRIPT_URI", String(string("http://") + hostName.data() + + r.originalURL().data())); + if (r.rewritten()) { + // when URL is rewritten, PHP decided to put original URL as SCRIPT_NAME + server.set("SCRIPT_NAME", r.originalURL()); + } else { + server.set("SCRIPT_NAME", r.resolvedURL()); + } + if (!r.rewritten() && r.pathInfo().empty()) { + server.set("PHP_SELF", r.resolvedURL()); + } else { + // when URL is rewritten, or pathinfo is not empty, use original URL + server.set("PHP_SELF", r.originalURL()); + } + + server.set("SCRIPT_FILENAME", r.absolutePath()); + if (r.pathInfo().empty()) { + server.set("PATH_TRANSLATED", r.absolutePath()); + } else { + server.set("PATH_TRANSLATED", + String(vhost->getDocumentRoot() + r.pathInfo().data())); + server.set("PATH_INFO", r.pathInfo()); + } + + server.set("argv", r.queryString()); + server.set("argc", 0); + server.set("GATEWAY_INTERFACE", "CGI/1.1"); + server.set("SERVER_ADDR", String(RuntimeOption::ServerPrimaryIP)); + server.set("SERVER_NAME", hostName); + server.set("SERVER_PORT", RuntimeOption::ServerPort); + server.set("SERVER_SOFTWARE", "HPHP"); + server.set("SERVER_PROTOCOL", "HTTP/1.1"); + server.set("SERVER_ADMIN", ""); + server.set("SERVER_SIGNATURE", ""); + switch (transport->getMethod()) { + case Transport::GET: server.set("REQUEST_METHOD", "GET"); break; + case Transport::HEAD: server.set("REQUEST_METHOD", "HEAD"); break; + case Transport::POST: + if (transport->getExtendedMethod() == NULL) { + server.set("REQUEST_METHOD", "POST"); + } else { + server.set("REQUEST_METHOD", transport->getExtendedMethod()); + } + break; + default: server.set("REQUEST_METHOD", ""); break; + } + server.set("HTTPS", ""); + server.set("REQUEST_TIME", time(NULL)); + server.set("QUERY_STRING", r.queryString()); + + server.set("REMOTE_ADDR", String(transport->getRemoteHost(), CopyString)); + server.set("REMOTE_HOST", ""); // I don't think we need to nslookup + server.set("REMOTE_PORT", 0); // TODO: quite useless + + server.set("DOCUMENT_ROOT", String(vhost->getDocumentRoot())); + + for (map::const_iterator iter = + RuntimeOption::ServerVariables.begin(); + iter != RuntimeOption::ServerVariables.end(); ++iter) { + server.set(String(iter->first), String(iter->second)); + } + const map &vServerVars = vhost->getServerVars(); + for (map::const_iterator iter = + vServerVars.begin(); + iter != vServerVars.end(); ++iter) { + server.set(String(iter->first), String(iter->second)); + } + sri.setServerVariables(server); +} + +std::string HttpProtocol::RecordRequest(Transport *transport) { + char tmpfile[PATH_MAX + 1]; + if (RuntimeOption::RecordInput) { + strcpy(tmpfile, "/tmp/hphp_request_XXXXXX"); + close(mkstemp(tmpfile)); + + ReplayTransport rt; + rt.recordInput(transport, tmpfile); + Logger::Info("request recorded in %s", tmpfile); + return tmpfile; + } + return ""; +} + +void HttpProtocol::ClearRecord(bool success, const std::string &tmpfile) { + if (success && RuntimeOption::ClearInputOnSuccess && !tmpfile.empty()) { + unlink(tmpfile.c_str()); + Logger::Info("request %s deleted", tmpfile.c_str()); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void HttpProtocol::CopyParams(Variant &dest, Variant &src) { + if (src.isArray()) { + Array srcArray = src.toArray(); + for (ArrayIter iter(srcArray); iter; ++iter) { + dest.set(iter.first(), iter.second()); + } + } +} + +void HttpProtocol::DecodeParameters(Variant &variables, const char *data, + int size, bool post /* = false */) { + if (data == NULL || size == 0) { + return; + } + + const char *s = data; + const char *e = s + size; + const char *p, *val; + + while (s < e && (p = (const char *)memchr(s, '&', (e - s)))) { + last_value: + if ((val = (const char *)memchr(s, '=', (p - s)))) { + int len = val - s; + char *name = url_decode(s, len); + String sname(name, len, AttachString); + + val++; + len = p - val; + char *value = url_decode(val, len); + String svalue(value, len, AttachString); + + register_variable(variables, (char*)sname.data(), svalue); + } else if (!post) { + int len = p - s; + char *name = url_decode(s, len); + String sname(name, len, AttachString); + register_variable(variables, (char*)sname.data(), ""); + } + s = p + 1; + } + if (s < e) { + p = e; + goto last_value; + } +} + +void HttpProtocol::DecodeCookies(Variant &variables, const char *data) { + ASSERT(data && *data); + + char *strtok_buf = NULL; + char *var = strtok_r((char*)data, ";", &strtok_buf); + while (var) { + char *val = strchr(var, '='); + + // Remove leading spaces from cookie names, needed for multi-cookie + // header where ; can be followed by a space */ + while (isspace(*var)) { + var++; + } + + if (var != val && *var != '\0') { + if (val) { /* have a value */ + int len = val - var; + char *name = url_decode(var, len); + String sname(name, len, AttachString); + + ++val; + len = strlen(val); + char *value = url_decode(val, len); + String svalue(value, len, AttachString); + + register_variable(variables, (char*)sname.data(), svalue, false); + } else { + int len = strlen(var); + char *name = url_decode(var, len); + String sname(name, len, AttachString); + + register_variable(variables, (char*)sname.data(), "", false); + } + } + + var = strtok_r(NULL, ";", &strtok_buf); + } +} + +bool HttpProtocol::IsRfc1867(const string contentType, string &boundary) { + if (contentType.empty()) return false; + const char *ctstr = contentType.c_str(); + char *s; + char *e; + for (s = (char*)ctstr; *s && !(*s == ';' || *s == ',' || *s == ' '); s++) ; + if (strncmp(ctstr, MULTIPART_CONTENT_TYPE, s - ctstr)) { + return false; + } + s = strstr(s, "boundary"); + if (!s || !(s=strchr(s, '='))) { + Logger::Warning("Missing boundary in multipart/form-data POST data"); + return false; + } + s++; + int len = strlen(s); + if (s[0] == '"') { + s++; + e = strchr(s, '"'); + if (!e) { + Logger::Warning("Invalid boundary in multipart/form-data POST data"); + return false; + } + } else { + /* search for the end of the boundary */ + e = strchr(s, ','); + } + if (e) { + e[0] = '\0'; + len = e - s; + } + boundary = s; + return true; +} + +void HttpProtocol::DecodeRfc1867(Variant &post, Variant &files, + int contentLength, const char *data, int size, + string boundary) { + rfc1867PostHandler(post, files, contentLength, data, size, boundary); +} + +const char *HttpProtocol::GetReasonString(int code) { + switch (code) { + case 100: return "Continue"; + case 101: return "Switching Protocols"; + case 200: return "OK"; + case 201: return "Created"; + case 202: return "Accepted"; + case 203: return "Non-Authoritative Information"; + case 204: return "No Content"; + case 205: return "Reset Content"; + case 206: return "Partial Content"; + case 300: return "Multiple Choices"; + case 301: return "Moved Permanently"; + case 302: return "Found"; + case 303: return "See Other"; + case 304: return "Not Modified"; + case 305: return "Use Proxy"; + case 307: return "Temporary Redirect"; + case 400: return "Bad Request"; + case 401: return "Unauthorized"; + case 402: return "Payment Required"; + case 403: return "Forbidden"; + case 404: return "Not Found"; + case 405: return "Method Not Allowed"; + case 406: return "Not Acceptable"; + case 407: return "Proxy Authentication Required"; + case 408: return "Request Time-out"; + case 409: return "Conflict"; + case 410: return "Gone"; + case 411: return "Length Required"; + case 412: return "Precondition Failed"; + case 413: return "Request Entity Too Large"; + case 414: return "Request-URI Too Large"; + case 415: return "Unsupported Media Type"; + case 416: return "Requested range not satisfiable"; + case 417: return "Expectation Failed"; + case 500: return "Internal Server Error"; + case 501: return "Not Implemented"; + case 502: return "Bad Gateway"; + case 503: return "Service Unavailable"; + case 504: return "Gateway Time-out"; + case 505: return "HTTP Version not supported"; + } + return "Bad Response"; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool HttpProtocol::ProxyRequest(Transport *transport, bool force, + const std::string &url, + int &code, std::string &error, + StringBuffer &response, + HeaderMap *extraHeaders /* = NULL */) { + HeaderMap requestHeaders; + transport->getHeaders(requestHeaders); + if (extraHeaders) { + for (HeaderMap::const_iterator iter = extraHeaders->begin(); + iter != extraHeaders->end(); ++iter) { + vector &values = requestHeaders[iter->first]; + values.insert(values.end(), iter->second.begin(), iter->second.end()); + } + } + + int size = 0; + const char *data = NULL; + if (transport->getMethod() == Transport::POST) { + data = (const char *)transport->getPostData(size); + } + + code = 0; + vector responseHeaders; + HttpClient http; + if (data && size) { + code = http.post(url.c_str(), data, size, response, &requestHeaders, + &responseHeaders); + } else { + code = http.get(url.c_str(), response, &requestHeaders, &responseHeaders); + } + if (code == 0) { + if (!force) return false; // so we can retry + Logger::Error("Unable to proxy %s: %s", url.c_str(), + http.getLastError().c_str()); + error = http.getLastError(); + return true; + } + + for (unsigned int i = 0; i < responseHeaders.size(); i++) { + String &header = responseHeaders[i]; + if (header.find(":") != String::npos && + header.find("Content-Length: ") != 0 && + header.find("Client-Transfer-Encoding: ") != 0 && + header.find("Transfer-Encoding: ") != 0 && + header.find("Connection: ") != 0) { + transport->addHeader(header.data()); + } + } + const char* respData = response.data(); + if (!respData) { + respData = ""; + } + Logger::Verbose("Response code was %d when proxying %s", code, url.c_str()); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/http_protocol.h b/src/cpp/base/server/http_protocol.h new file mode 100644 index 0000000000000..22fcc8a7b8933 --- /dev/null +++ b/src/cpp/base/server/http_protocol.h @@ -0,0 +1,61 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_HTTP_PROTOCOL_H__ +#define __HPHP_HTTP_PROTOCOL_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class RequestURI; +class SourceRootInfo; +class VirtualHost; +class StringBuffer; + +class HttpProtocol { +public: + static const VirtualHost *GetVirtualHost(Transport *transport); + static void PrepareSystemVariables(Transport *transport, const RequestURI &r, + const SourceRootInfo &sourceRootInfo); + static bool ProxyRequest(Transport *transport, bool force, + const std::string &url, int &code, + std::string &error, StringBuffer &response, + HeaderMap *extraHeaders = NULL); + + static std::string RecordRequest(Transport *transport); + static void ClearRecord(bool success, const std::string &tmpfile); + + static void DecodeParameters(Variant &variables, const char *data, int size, + bool post = false); + static void DecodeRfc1867(Variant &post, Variant &files, int contentLength, + const char *data, int size, std::string boundary); + static void DecodeCookies(Variant &variables, const char *data); + static bool IsRfc1867(const std::string contentType, std::string &boundary); + + static const char *GetReasonString(int code); + +private: + static void CopyParams(Variant &dest, Variant &src); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_HTTP_PROTOCOL_H__ diff --git a/src/cpp/base/server/http_request_handler.cpp b/src/cpp/base/server/http_request_handler.cpp new file mode 100644 index 0000000000000..e8ab9771805bc --- /dev/null +++ b/src/cpp/base/server/http_request_handler.cpp @@ -0,0 +1,281 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +AccessLog HttpRequestHandler::s_accessLog; + +HttpRequestHandler::HttpRequestHandler() + : m_pathTranslation(true) { + GetAccessLog().init(RuntimeOption::AccessLogDefaultFormat, + RuntimeOption::AccessLogs); +} + +void HttpRequestHandler::sendStaticContent(Transport *transport, + const char *data, int len, + time_t mtime, + bool compressed, + const std::string &cmd) { + size_t pos = cmd.rfind('.'); + ASSERT(pos != string::npos); + const char *ext = cmd.c_str() + pos + 1; + map::const_iterator iter = + RuntimeOption::StaticFileExtensions.find(ext); + if (iter != RuntimeOption::StaticFileExtensions.end()) { + string val = iter->second; + if (val == "text/plain" || val == "text/html") { + // Apache adds character set for these two types + val += "; charset="; + val += RuntimeOption::DefaultCharsetName; + } + transport->addHeader("Content-Type", val.c_str()); + } + + time_t base = time(NULL); + if (RuntimeOption::ExpiresActive) { + time_t expires = base + RuntimeOption::ExpiresDefault; + char age[20]; + snprintf(age, sizeof(age), "max-age=%d", RuntimeOption::ExpiresDefault); + transport->addHeader("Cache-Control", age); + transport->addHeader("Expires", + DateTime(expires, true).toString(DateTime::RFC822n)); + } + + if (mtime) { + transport->addHeader("Last-Modified:", + DateTime(mtime, true).toString(DateTime::RFC822n)); + } + transport->addHeader("Accept-Ranges", "bytes"); + + // misnomer, it means we have made decision on compression, transport + // should not attempt to compress it. + transport->disableCompression(); + + transport->sendRaw((void*)data, len, 200, compressed); +} + +void HttpRequestHandler::handleRequest(Transport *transport) { + Logger::OnNewRequest(); + GetAccessLog().onNewRequest(); + transport->enableCompression(); + + Logger::Verbose("receiving %s", transport->getCommand().c_str()); + ServerStatsHelper ssh("all", true); + + // resolve virtual host + const VirtualHost *vhost = HttpProtocol::GetVirtualHost(transport); + ASSERT(vhost); + if (vhost->disabled() || + vhost->isBlocking(transport->getCommand(), transport->getRemoteHost())) { + transport->sendString("Not Found", 404); + return; + } + ServerStats::StartRequest(transport->getCommand().c_str(), + transport->getRemoteHost(), + vhost->getName().c_str()); + + // resolve source root + string host = transport->getHeader("Host"); + SourceRootInfo sourceRootInfo(host.c_str()); + + // request URI + string pathTranslation = m_pathTranslation ? + vhost->getPathTranslation().c_str() : ""; + RequestURI reqURI(vhost, transport, sourceRootInfo.path(), pathTranslation); + if (reqURI.done()) { + return; // already handled with redirection or 404 + } + string path = reqURI.path().data(); + string absPath = reqURI.absolutePath().data(); + + bool compressed = transport->acceptEncoding("gzip"); + const char *data; int len; + size_t pos = path.rfind('.'); + const char *ext = (pos != string::npos) ? (path.c_str() + pos + 1) : NULL; + bool cachableDynamicContent = + (!RuntimeOption::StaticFileGenerators.empty() && + RuntimeOption::StaticFileGenerators.find(path) != + RuntimeOption::StaticFileGenerators.end()); + + // If this is not a php file, check the static cnd dynamic content caches + if (ext == NULL || (strcasecmp(ext, "php") != 0 && strcasecmp(ext, "phpt") != 0)) { + if (RuntimeOption::EnableStaticContentCache) { + // check against static content cache + if (StaticContentCache::TheCache.find(path, data, len, compressed)) { + struct stat sb; + stat(File::TranslatePath(RuntimeOption::FileCache), &sb); + sendStaticContent(transport, data, len, sb.st_mtime, compressed, path); + ServerStats::LogPage(path, 200); + return; + } + } else { + if (ext != NULL) { + if (RuntimeOption::StaticFileExtensions.find(ext) != + RuntimeOption::StaticFileExtensions.end()) { + StringBuffer sb(absPath.c_str()); + if (sb.valid()) { + struct stat st; + stat(absPath.c_str(), &st); + sendStaticContent(transport, sb.data(), sb.size(), st.st_mtime, + false, path); + ServerStats::LogPage(path, 200); + return; + } + } + } + } + // check static contents that were generated by dynamic pages + if (cachableDynamicContent) { + // check against dynamic content cache + ASSERT(transport->getUrl()); + string key = path + transport->getUrl(); + if (DynamicContentCache::TheCache.find(key, data, len, compressed)) { + sendStaticContent(transport, data, len, 0, compressed, path); + ServerStats::LogPage(path, 200); + return; + } + } + } + + // proxy any URLs that not specified in ServeURLs + if (!RuntimeOption::ProxyOrigin.empty() && + ((RuntimeOption::UseServeURLs && + RuntimeOption::ServeURLs.find(path) == + RuntimeOption::ServeURLs.end()) || + (RuntimeOption::UseProxyURLs && + (RuntimeOption::ProxyURLs.find(path) != + RuntimeOption::ProxyURLs.end() || + (abs(rand()) % 100) < RuntimeOption::ProxyPercentage)))) { + for (int i = 0; i < RuntimeOption::ProxyRetry; i++) { + bool force = (i == RuntimeOption::ProxyRetry - 1); // last one + if (handleProxyRequest(transport, force)) break; + } + return; + } + + // record request for debugging purpose + std::string tmpfile = HttpProtocol::RecordRequest(transport); + + // main body + hphp_session_init(); + + bool ret = false; + try { + ret = executePHPRequest(transport, reqURI, sourceRootInfo, + cachableDynamicContent); + } catch (...) { + Logger::Error("Unhandled exception in HPHP server engine."); + } + GetAccessLog().log(transport); + hphp_session_exit(); + + HttpProtocol::ClearRecord(ret, tmpfile); +} + +bool HttpRequestHandler::executePHPRequest(Transport *transport, + RequestURI &reqURI, + SourceRootInfo &sourceRootInfo, + bool cachableDynamicContent) { + ExecutionContext *context = hphp_context_init(); + context->setTransport(transport); + + string file = reqURI.absolutePath().c_str(); + { + ServerStatsHelper ssh("input"); + HttpProtocol::PrepareSystemVariables(transport, reqURI, sourceRootInfo); + reqURI.clear(); + sourceRootInfo.clear(); + } + + bool error = false; + std::string errorMsg = "Internal Server Error"; + bool ret = hphp_invoke(context, file, false, Array(), null, + RuntimeOption::WarmupDocument, + RuntimeOption::RequestInitFunction, + error, errorMsg); + + int code; + if (ret) { + std::string content = context->getContents(); + if (cachableDynamicContent && !content.empty()) { + ASSERT(transport->getUrl()); + string key = file + transport->getUrl(); + DynamicContentCache::TheCache.store(key, content.data(), content.size()); + } + code = 200; + transport->sendRaw((void*)content.data(), content.size()); + } else if (error) { + code = 500; + if (RuntimeOption::ServerErrorMessage) { + transport->sendString(errorMsg, 500); + } else { + transport->sendString(RuntimeOption::FatalErrorMessage, 500); + } + } else { + code = 404; + transport->sendString("Not Found", 404); + } + transport->onSendEnd(); + ServerStats::LogPage(file, code); + hphp_context_exit(context, true); + return ret; +} + +bool HttpRequestHandler::handleProxyRequest(Transport *transport, bool force) { + string url = RuntimeOption::ProxyOrigin + transport->getServerObject(); + + int code = 0; + std::string error; + StringBuffer response; + if (!HttpProtocol::ProxyRequest(transport, force, url, code, error, + response)) { + return false; + } + if (code == 0) { + transport->sendString(error, 500); + return true; + } + + const char* respData = response.data(); + if (!respData) { + respData = ""; + } + transport->sendRaw((void*)respData, response.size(), code); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/http_request_handler.h b/src/cpp/base/server/http_request_handler.h new file mode 100644 index 0000000000000..8e87217447f0b --- /dev/null +++ b/src/cpp/base/server/http_request_handler.h @@ -0,0 +1,58 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HTTP_REQUEST_HANDLER_H__ +#define __HTTP_REQUEST_HANDLER_H__ + +#include +#include +#include +#include + +namespace HPHP { + +class SourceRootInfo; +class RequestURI; +/////////////////////////////////////////////////////////////////////////////// + +class HttpRequestHandler : public RequestHandler { +public: + HttpRequestHandler(); + + // implementing RequestHandler + virtual void handleRequest(Transport *transport); + + // for internal invoke of a special URL + void disablePathTranslation() { m_pathTranslation = false;} + static AccessLog &GetAccessLog() { return s_accessLog; } +private: + bool m_pathTranslation; + + bool handleProxyRequest(Transport *transport, bool force); + void sendStaticContent(Transport *transport, const char *data, int len, + time_t mtime, bool compressed, + const std::string &cmd); + bool executePHPRequest(Transport *transport, RequestURI &reqURI, + SourceRootInfo &sourceRootInfo, + bool cachableDynamicContent); + + static AccessLog s_accessLog; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HTTP_REQUEST_HANDLER_H__ diff --git a/src/cpp/base/server/http_server.cpp b/src/cpp/base/server/http_server.cpp new file mode 100644 index 0000000000000..9be36bc7f14d3 --- /dev/null +++ b/src/cpp/base/server/http_server.cpp @@ -0,0 +1,479 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace boost; +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// statics + +HttpServerPtr HttpServer::Server; +time_t HttpServer::StartTime; + +/////////////////////////////////////////////////////////////////////////////// + +HttpServer::HttpServer() + : m_stopped(false), + m_loggerThread(this, &HttpServer::flushLog), + m_watchDog(this, &HttpServer::watchDog) { + + // enabling mutex profiling, but it's not turned on + LockProfiler::s_pfunc_profile = server_stats_log_mutex; + + if (RuntimeOption::TakeoverFilename.empty()) { + m_pageServer = ServerPtr + (new TypedServer + (RuntimeOption::ServerIP, RuntimeOption::ServerPort, + RuntimeOption::ServerThreadCount)); + } else { + LibEventServerWithTakeover* server = + (new TypedServer + (RuntimeOption::ServerIP, RuntimeOption::ServerPort, + RuntimeOption::ServerThreadCount)); + server->setTransferFilename(RuntimeOption::TakeoverFilename); + server->addTakeoverListener(this); + m_pageServer = ServerPtr(server); + } + + m_adminServer = ServerPtr + (new TypedServer + (RuntimeOption::ServerIP, RuntimeOption::AdminServerPort, + RuntimeOption::AdminThreadCount)); + + for (unsigned int i = 0; i < RuntimeOption::SatelliteServerInfos.size(); + i++) { + SatelliteServerInfoPtr info = RuntimeOption::SatelliteServerInfos[i]; + SatelliteServerPtr satellite = SatelliteServer::Create(info); + if (satellite) { + if (info->getType() == SatelliteServer::KindOfDanglingPageServer) { + m_danglings.push_back(satellite); + } else { + m_satellites.push_back(satellite); + } + } + } + + if (RuntimeOption::EnableStaticContentCache) { + StaticContentCache::TheCache.load(); + } + ClassInfo::Load(); + SourceInfo::TheSourceInfo.load(); + RTTIInfo::TheRTTIInfo.init(true); + + hphp_process_init(); + apc_load(RuntimeOption::ApcLoadThread); + + Server::InstallStopSignalHandlers(m_pageServer); + Server::InstallStopSignalHandlers(m_adminServer); + + if (!RuntimeOption::StartupDocument.empty()) { + Hdf hdf; + hdf["get"] = 1; + hdf["url"] = RuntimeOption::StartupDocument; + hdf["remote_host"] = RuntimeOption::ServerIP; + + ReplayTransport rt; + rt.replayInput(hdf); + HttpRequestHandler handler; + handler.handleRequest(&rt); + int code = rt.getResponseCode(); + if (code == 200) { + Logger::Info("StartupDocument %s returned 200 OK: %s", + RuntimeOption::StartupDocument.c_str(), + rt.getResponse().c_str()); + } else { + Logger::Error("StartupDocument %s failed %d: %s", + RuntimeOption::StartupDocument.c_str(), + code, rt.getResponse().data()); + return; + } + } + + for (unsigned int i = 0; i < RuntimeOption::ThreadDocuments.size(); i++) { + ServiceThreadPtr thread + (new ServiceThread(RuntimeOption::ThreadDocuments[i])); + m_serviceThreads.push_back(thread); + } +} + +void HttpServer::onServerShutdown() { + // When a new instance of HPHP has taken over our page server socket, + // stop our admin server and satellites so it can acquire those ports. + for (unsigned int i = 0; i < m_satellites.size(); i++) { + string name = m_satellites[i]->getName(); + m_satellites[i]->stop(); + Logger::Info("satellite server %s stopped", name.c_str()); + } + if (RuntimeOption::AdminServerPort) { + m_adminServer->stop(); + Logger::Info("admin server stopped"); + } + + // start dangling servers, so they can serve old version of pages + for (unsigned int i = 0; i < m_danglings.size(); i++) { + string name = m_danglings[i]->getName(); + try { + m_danglings[i]->start(); + Logger::Info("dangling server %s started", name.c_str()); + } catch (Exception &e) { + Logger::Error("Unable to start danglings server %s: %s", + name.c_str(), e.getMessage().c_str()); + // it's okay not able to start them + } + } +} + +void HttpServer::takeoverShutdown(LibEventServerWithTakeover* server) { + ASSERT(server == m_pageServer.get()); + // We want to synchronously shut down our satellite servers to free up ports, + // then asynchronously shut down everything else. + onServerShutdown(); + stop(); +} + +HttpServer::~HttpServer() { + stop(); +} + +void HttpServer::run() { + StartTime = time(0); + + m_loggerThread.start(); + m_watchDog.start(); + + for (unsigned int i = 0; i < m_serviceThreads.size(); i++) { + m_serviceThreads[i]->start(); + } + for (unsigned int i = 0; i < m_serviceThreads.size(); i++) { + m_serviceThreads[i]->waitForStarted(); + } + + if (RuntimeOption::ServerPort) { + if (!startServer(true)) { + Logger::Error("Unable to start page server"); + return; + } + Logger::Info("page server started"); + } + + if (RuntimeOption::AdminServerPort) { + if (!startServer(false)) { + Logger::Error("Unable to start admin server"); + abortServers(); + return; + } + Logger::Info("admin server started"); + } + + for (unsigned int i = 0; i < m_satellites.size(); i++) { + string name = m_satellites[i]->getName(); + try { + m_satellites[i]->start(); + Logger::Info("satellite server %s started", name.c_str()); + } catch (Exception &e) { + Logger::Error("Unable to start satellite server %s: %s", + name.c_str(), e.getMessage().c_str()); + abortServers(); + return; + } + } + + { + Logger::Info("all servers started"); + createPid(); + Lock lock(this); + // continously running until /stop is received on admin server + while (!m_stopped) { + wait(); + } + removePid(); + Logger::Info("page server stopped"); + } + + onServerShutdown(); // dangling server already started here + time_t t0 = time(0); + if (RuntimeOption::ServerPort) { + m_pageServer->stop(); + } + time_t t1 = time(0); + if (!m_danglings.empty() && RuntimeOption::ServerDanglingWait > 0) { + int elapsed = t1 - t0; + if (RuntimeOption::ServerDanglingWait > elapsed) { + sleep(RuntimeOption::ServerDanglingWait - elapsed); + } + } + + for (unsigned int i = 0; i < m_danglings.size(); i++) { + m_danglings[i]->stop(); + Logger::Info("dangling server %s stopped", + m_danglings[i]->getName().c_str()); + } + + m_watchDog.waitForEnd(); + m_loggerThread.waitForEnd(); + Logger::Info("all servers stopped"); +} + +static void exit_on_timeout(int sig) { + signal(sig, SIG_DFL); + kill(getpid(), SIGKILL); + exit(0); +} + +void HttpServer::stop() { + if (RuntimeOption::ServerGracefulShutdownWait) { + signal(SIGALRM, exit_on_timeout); + alarm(RuntimeOption::ServerGracefulShutdownWait); + } + + Lock lock(this); + m_stopped = true; + notify(); +} + +void HttpServer::abortServers() { + for (unsigned int i = 0; i < m_satellites.size(); i++) { + m_satellites[i]->stop(); + } + if (RuntimeOption::AdminServerPort) { + m_adminServer->stop(); + } + if (RuntimeOption::ServerPort) { + m_pageServer->stop(); + } +} + +void HttpServer::createPid() { + if (!RuntimeOption::PidFile.empty()) { + FILE * f = fopen(RuntimeOption::PidFile.c_str(), "w"); + if (f) { + pid_t pid = Process::GetProcessId(); + char buf[64]; + snprintf(buf, sizeof(buf), "%lld", (int64)pid); + fwrite(buf, strlen(buf), 1, f); + fclose(f); + } else { + Logger::Error("Unable to open pid file %s for write", + RuntimeOption::PidFile.c_str()); + } + } +} + +void HttpServer::removePid() { + if (!RuntimeOption::PidFile.empty()) { + unlink(RuntimeOption::PidFile.c_str()); + } +} + +void HttpServer::killPid() { + if (!RuntimeOption::PidFile.empty()) { + StringBuffer sb(RuntimeOption::PidFile.c_str()); + if (sb.size()) { + int64 pid = sb.detach().toInt64(); + if (pid) { + kill((pid_t)pid, SIGKILL); + return; + } + } + Logger::Error("Unable to read pid file %s for any meaningful pid", + RuntimeOption::PidFile.c_str()); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// logger thread + +void HttpServer::flushLog() { + if (!Logger::UseLogAggregator) return; + + ServerDataPtr database; + ostream *out = NULL; + if (!RuntimeOption::LogAggregatorDatabase.empty()) { + database = ServerData::Create(RuntimeOption::LogAggregatorDatabase); + } else if (!RuntimeOption::LogAggregatorFile.empty()) { + out = new ofstream(RuntimeOption::LogAggregatorFile.c_str()); + } else { + out = &cout; + } + + bool stopped = false; + while (!stopped) { + if (database) { + LogAggregator::TheLogAggregator.flush(database); + } else { + LogAggregator::TheLogAggregator.flush(*out); + } + sleep(RuntimeOption::LogAggregatorSleepSeconds); + + Lock lock(this); + stopped = m_stopped; + } + + if (out != &cout) { + delete out; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// watch dog thread + +void HttpServer::watchDog() { + int count = 0; + while (!m_stopped) { + if ((count % 3600) == 0) { // every hour + dropCache(); + } + + sleep(1); + ++count; + + if ((count % 60) == 0) { // every minute + checkMemory(); + } + } +} + +void HttpServer::dropCache() { + FILE *f = fopen("/proc/sys/vm/drop_caches", "w"); + if (f) { + // http://www.linuxinsight.com/proc_sys_vm_drop_caches.html + const char *FREE_ALL_CACHES = "3\n"; + fwrite(FREE_ALL_CACHES, 2, 1, f); + fclose(f); + } +} + +void HttpServer::checkMemory() { + if (RuntimeOption::MaxRSS > 0 && + Process::GetProcessRSS(Process::GetProcessId()) * 1024 * 1024 > + RuntimeOption::MaxRSS) { + stop(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// page server + +bool HttpServer::startServer(bool pageServer) { + int port = pageServer ? + RuntimeOption::ServerPort : RuntimeOption::AdminServerPort; + + // 1. try something nice + for (unsigned int i = 0; i < 60; i++) { + try { + if (pageServer) { + m_pageServer->start(); + } else { + m_adminServer->start(); + } + return true; + } catch (FailedToListenException &e) { + if (i == 0) { + Logger::Info("shutting down old HPHP server by /stop command"); + } + + if (errno == EACCES) { + Logger::Error("Permission denied listening on port %d", port); + return false; + } + + HttpClient http; + string url = "http://"; + url += RuntimeOption::ServerIP; + url += ":"; + url += lexical_cast(RuntimeOption::AdminServerPort); + url += "/stop"; + StringBuffer response; + http.get(url.c_str(), response); + + sleep(1); + } + } + + // 2. try something harsh + if (RuntimeOption::ServerHarshShutdown) { + for (unsigned int i = 0; i < 5; i++) { + try { + if (pageServer) { + m_pageServer->start(); + } else { + m_adminServer->start(); + } + return true; + } catch (FailedToListenException &e) { + if (i == 0) { + Logger::Info("shutting down old HPHP server by pid file"); + } + killPid(); + sleep(1); + } + } + } + + // 3. try something evil + if (RuntimeOption::ServerEvilShutdown) { + for (unsigned int i = 0; i < 60; i++) { + try { + if (pageServer) { + m_pageServer->start(); + } else { + m_adminServer->start(); + } + return true; + } catch (FailedToListenException &e) { + if (i == 0) { + Logger::Info("killing anything listening on port %d", port); + } + + string cmd = "lsof -t -i :"; + cmd += lexical_cast(port); + cmd += " | xargs kill -9"; + Util::ssystem(cmd.c_str()); + + sleep(1); + } + } + } + + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/http_server.h b/src/cpp/base/server/http_server.h new file mode 100644 index 0000000000000..a7ef5db9b4f8a --- /dev/null +++ b/src/cpp/base/server/http_server.h @@ -0,0 +1,78 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HTTP_SERVER_H__ +#define __HTTP_SERVER_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(HttpServer); + +class HttpServer : public Synchronizable, public TakeoverListener { +public: + static HttpServerPtr Server; + static time_t StartTime; + +public: + HttpServer(); + ~HttpServer(); + + void run(); + void stop(); + + void flushLog(); + void watchDog(); + + void takeoverShutdown(LibEventServerWithTakeover* server); + + ServerPtr getPageServer() { return m_pageServer;} + +private: + bool m_stopped; + + ServerPtr m_pageServer; + ServerPtr m_adminServer; + SatelliteServerPtrVec m_satellites; + SatelliteServerPtrVec m_danglings; + AsyncFunc m_loggerThread; + AsyncFunc m_watchDog; + ServiceThreadPtrVec m_serviceThreads; + + bool startServer(bool pageServer); + void onServerShutdown(); + void abortServers(); + + // pid file functions + void createPid(); + void removePid(); + void killPid(); + + // memory monitoring functions + void dropCache(); + void checkMemory(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HTTP_SERVER_H__ diff --git a/src/cpp/base/server/ip_block_map.cpp b/src/cpp/base/server/ip_block_map.cpp new file mode 100644 index 0000000000000..d2becb1264b9c --- /dev/null +++ b/src/cpp/base/server/ip_block_map.cpp @@ -0,0 +1,73 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +void IpBlockMap::LoadIpList(hphp_string_map &ips, Hdf hdf, bool allow) { + for (Hdf child = hdf.firstChild(); child.exists(); child = child.next()) { + string ip = child.getString(); + size_t pos = ip.find('/'); + if (pos != string::npos) { + ip = ip.substr(0, pos); + } + ips[ip] = allow; + } +} + +IpBlockMap::IpBlockMap(Hdf config) { + for (Hdf hdf = config.firstChild(); hdf.exists(); hdf = hdf.next()) { + AclPtr acl(new Acl()); + bool allow = hdf["AllowFirst"].getBool(false); + if (allow) { + LoadIpList(acl->ips, hdf["Ip.Deny"], false); + LoadIpList(acl->ips, hdf["Ip.Allow"], true); + } else { + LoadIpList(acl->ips, hdf["Ip.Allow"], true); + LoadIpList(acl->ips, hdf["Ip.Deny"], false); + } + + string location = hdf["Location"].getString(); + if (!location.empty() && location[0] == '/') { + location = location.substr(1); + } + m_acls[location] = acl; + } +} + +bool IpBlockMap::isBlocking(const std::string &command, + const std::string &ip) const { + for (StringToAclPtrMap::const_iterator iter = m_acls.begin(); + iter != m_acls.end(); ++iter) { + const string &path = iter->first; + if (command.size() >= path.size() && + strncmp(command.c_str(), path.c_str(), path.size()) == 0) { + hphp_string_map &ips = iter->second->ips; + hphp_string_map::const_iterator iter2 = ips.find(ip); + if (iter2 != ips.end()) { + return !iter2->second; + } + } + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/ip_block_map.h b/src/cpp/base/server/ip_block_map.h new file mode 100644 index 0000000000000..d9ea58c8c5816 --- /dev/null +++ b/src/cpp/base/server/ip_block_map.h @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __IP_BLOCK_MAP_H__ +#define __IP_BLOCK_MAP_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(IpBlockMap); +class IpBlockMap { +public: + IpBlockMap(Hdf config); + + bool isBlocking(const std::string &command, const std::string &ip) const; + +private: + DECLARE_BOOST_TYPES(Acl); + struct Acl { + hphp_string_map ips; // ip => true: allow; false: deny + }; + StringToAclPtrMap m_acls; // location => acl + + static void LoadIpList(hphp_string_map &ips, Hdf hdf, bool allow); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __IP_BLOCK_MAP_H__ diff --git a/src/cpp/base/server/libevent_server.cpp b/src/cpp/base/server/libevent_server.cpp new file mode 100644 index 0000000000000..e9e3acf617f7a --- /dev/null +++ b/src/cpp/base/server/libevent_server.cpp @@ -0,0 +1,405 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// static handler + +static void on_request(struct evhttp_request *request, void *obj) { + ASSERT(obj); + ((HPHP::LibEventServer*)obj)->onRequest(request); +} + +static void on_response(int fd, short what, void *obj) { + ASSERT(obj); + ((HPHP::PendingResponseQueue*)obj)->process(); +} + +static void on_timer(int fd, short events, void *context) { + event_base_loopbreak((struct event_base *)context); +} + +static void on_thread_stop(int fd, short events, void *context) { + event_base_loopbreak((struct event_base *)context); +} + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// LibEventJob + +LibEventJob::LibEventJob(evhttp_request *req) : request(req) { + if (RuntimeOption::EnableStats && RuntimeOption::EnableWebStats) { + clock_gettime(CLOCK_MONOTONIC, &start); + } +} + +void LibEventJob::stopTimer() { + if (RuntimeOption::EnableStats && RuntimeOption::EnableWebStats) { + timespec end; + clock_gettime(CLOCK_MONOTONIC, &end); + time_t dsec = end.tv_sec - start.tv_sec; + long dnsec = end.tv_nsec - start.tv_nsec; + int64 dusec = dsec * 1000000 + dnsec / 1000; + ServerStats::Log("page.wall.queuing", dusec); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// LibEventWorker + +LibEventWorker::LibEventWorker() : m_handler(NULL) { +} + +LibEventWorker::~LibEventWorker() { +} + +void LibEventWorker::doJob(LibEventJobPtr job) { + job->stopTimer(); + evhttp_request *request = job->request; + ASSERT(m_opaque); + LibEventServer *server = (LibEventServer*)m_opaque; + + if (m_handler == NULL) { + m_handler = server->createRequestHandler(); + ASSERT(m_handler); + } + + LibEventTransport transport(server, request, m_id); + bool error = true; + std::string errorMsg; + try { + std::string cmd = transport.getCommand(); + cmd = std::string("/") + cmd; + if (server->shouldHandle(cmd)) { + m_handler->handleRequest(&transport); + error = false; + } else { + transport.sendString("Not Found", 404); + return; + } + } catch (Exception &e) { + if (Server::StackTraceOnError) { + errorMsg = e.what(); + } else { + errorMsg = e.getMessage(); + } + } catch (std::exception &e) { + errorMsg = e.what(); + } catch (...) { + errorMsg = "(unknown exception)"; + } + + if (error) { + if (RuntimeOption::ServerErrorMessage) { + transport.sendString(errorMsg, 500); + } else { + transport.sendString(RuntimeOption::FatalErrorMessage, 500); + } + } +} + +void LibEventWorker::onThreadEnter() { + ASSERT(m_opaque); + LibEventServer *server = (LibEventServer*)m_opaque; + server->onThreadEnter(); +} + +void LibEventWorker::onThreadExit() { + ASSERT(m_opaque); + LibEventServer *server = (LibEventServer*)m_opaque; + server->onThreadExit(m_handler); + MemoryManager::TheMemoryManager().get()->cleanup(); +} + +/////////////////////////////////////////////////////////////////////////////// +// constructor and destructor + +LibEventServer::LibEventServer(const std::string &address, int port, + int thread) + : Server(address, port, thread), + m_accept_sock(-1), + m_timeoutThreadData(thread), + m_timeoutThread(&m_timeoutThreadData, &TimeoutThread::run), + m_dispatcher(thread, this), + m_dispatcherThread(this, &LibEventServer::dispatch) { + m_eventBase = event_base_new(); + m_server = evhttp_new(m_eventBase); + evhttp_set_gencb(m_server, on_request, this); + m_responseQueue.create(m_eventBase); +} + +LibEventServer::~LibEventServer() { + ASSERT (getStatus() == STOPPED || getStatus() == STOPPING || + getStatus() == NOT_YET_STARTED); + // We can't free event base when server is still working on it. + // This will cause a leak with event base, but normally this happens when + // process exits, so we're probably fine. + if (getStatus() != STOPPING) { + event_base_free(m_eventBase); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// implementing HttpServer + +int LibEventServer::getAcceptSocket() { + m_accept_sock = evhttp_bind_socket(m_server, m_address.c_str(), m_port); + return m_accept_sock; +} + +void LibEventServer::start() { + if (getStatus() == RUNNING) return; + + if (getAcceptSocket() != 0) { + throw FailedToListenException(m_address, m_port); + } + + setStatus(RUNNING); + m_dispatcher.start(); + m_dispatcherThread.start(); + m_timeoutThread.start(); +} + +void LibEventServer::waitForEnd() { + m_dispatcherThread.waitForEnd(); + + m_timeoutThreadData.stop(); + m_timeoutThread.waitForEnd(); +} + +void LibEventServer::dispatchWithTimeout(int timeoutSeconds) { + struct timeval timeout; + timeout.tv_sec = timeoutSeconds; + timeout.tv_usec = 0; + + event eventTimeout; + event_set(&eventTimeout, -1, 0, on_timer, m_eventBase); + event_base_set(m_eventBase, &eventTimeout); + event_add(&eventTimeout, &timeout); + + event_base_loop(m_eventBase, EVLOOP_ONCE); + + event_del(&eventTimeout); +} + +void LibEventServer::dispatch() { + m_pipeStop.open(); + event_set(&m_eventStop, m_pipeStop.getOut(), EV_READ|EV_PERSIST, + on_thread_stop, m_eventBase); + event_base_set(m_eventBase, &m_eventStop); + event_add(&m_eventStop, NULL); + + while (getStatus() != STOPPED) { + event_base_loop(m_eventBase, EVLOOP_ONCE); + } + + event_del(&m_eventStop); + + // flushing all responses + if (!m_responseQueue.empty()) { + m_responseQueue.process(); + } + m_responseQueue.close(); + + // flusing all remaining events + if (RuntimeOption::ServerGracefulShutdownWait) { + dispatchWithTimeout(RuntimeOption::ServerGracefulShutdownWait); + } +} + +void LibEventServer::stop() { + Lock lock(m_mutex); + if (getStatus() != RUNNING || m_server == NULL) return; + + // inform LibEventServer::onRequest() to stop queuing + setStatus(STOPPING); + + // stop JobQueue processing + m_dispatcher.stop(); + + // stop event loop + setStatus(STOPPED); + write(m_pipeStop.getIn(), "", 1); + m_dispatcherThread.waitForEnd(); + evhttp_free(m_server); + m_server = NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +// request/response handling + +void LibEventServer::onThreadEnter() { + m_timeoutThreadData.registerRequestThread + (RequestInjection::s_reqInjectionData.get()); +} + +void LibEventServer::onRequest(struct evhttp_request *request) { + if (getStatus() == RUNNING) { + m_dispatcher.enqueue(LibEventJobPtr(new LibEventJob(request))); + } else { + Logger::Error("throwing away one new request while shutting down"); + } +} + +void LibEventServer::onResponse(int worker, evhttp_request *request, + int code) { + int nwritten = 0; + if (RuntimeOption::LibEventSyncSend) { + const char *reason = HttpProtocol::GetReasonString(code); + nwritten = evhttp_send_reply_sync_begin(request, code, reason, NULL); + } + m_responseQueue.enqueue(worker, request, code, nwritten); +} + +void LibEventServer::onChunkedResponse(int worker, evhttp_request *request, + int code, evbuffer *chunk, + bool firstChunk) { + m_responseQueue.enqueue(worker, request, code, chunk, firstChunk); +} + +void LibEventServer::onChunkedResponseEnd(int worker, + evhttp_request *request) { + m_responseQueue.enqueue(worker, request); +} + +/////////////////////////////////////////////////////////////////////////////// +// PendingResponseQueue + +PendingResponseQueue::PendingResponseQueue() { + ASSERT(RuntimeOption::ResponseQueueCount > 0); + for (int i = 0; i < RuntimeOption::ResponseQueueCount; i++) { + m_responseQueues.push_back(ResponseQueuePtr(new ResponseQueue())); + } +} + +bool PendingResponseQueue::empty() { + for (int i = 0; i < RuntimeOption::ResponseQueueCount; i++) { + ResponseQueue &q = *m_responseQueues[i]; + Lock lock(q.m_mutex); + if (!q.m_responses.empty()) return false; + } + return true; +} + +void PendingResponseQueue::create(event_base *eventBase) { + if (!m_ready.open()) { + throw FatalErrorException("unable to create pipe for ready signal"); + } + event_set(&m_event, m_ready.getOut(), EV_READ|EV_PERSIST, on_response, this); + event_base_set(eventBase, &m_event); + event_add(&m_event, NULL); +} + +void PendingResponseQueue::close() { + event_del(&m_event); +} + +void PendingResponseQueue::enqueue(int worker, ResponsePtr response) { + { + int i = worker % RuntimeOption::ResponseQueueCount; + ResponseQueue &q = *m_responseQueues[i]; + Lock lock(q.m_mutex); + q.m_responses.push_back(response); + } + + // signal to call process() + write(m_ready.getIn(), &response, 1); +} + +void PendingResponseQueue::enqueue(int worker, evhttp_request *request, + int code, int nwritten) { + ResponsePtr res(new Response()); + res->request = request; + res->code = code; + res->nwritten = nwritten; + enqueue(worker, res); +} + +void PendingResponseQueue::enqueue(int worker, evhttp_request *request, + int code, evbuffer *chunk, + bool firstChunk) { + ResponsePtr res(new Response()); + res->request = request; + res->code = code; + res->chunked = true; + res->chunk = chunk; + res->firstChunk = firstChunk; + enqueue(worker, res); +} + +void PendingResponseQueue::enqueue(int worker, evhttp_request *request) { + ResponsePtr res(new Response()); + res->request = request; + res->chunked = true; + enqueue(worker, res); +} + +void PendingResponseQueue::process() { + // clean up the pipe for next signals + char buf[512]; + read(m_ready.getOut(), buf, sizeof(buf)); + + // making a copy so we don't hold up the mutex very long + ResponsePtrVec responses; + for (int i = 0; i < RuntimeOption::ResponseQueueCount; i++) { + ResponseQueue &q = *m_responseQueues[i]; + Lock lock(q.m_mutex); + responses.insert(responses.end(),q.m_responses.begin(),q.m_responses.end()); + q.m_responses.clear(); + } + + for (unsigned int i = 0; i < responses.size(); i++) { + Response &res = *responses[i]; + evhttp_request *request = res.request; + int code = res.code; + + if (res.chunked) { + if (res.chunk) { + if (res.firstChunk) { + const char *reason = HttpProtocol::GetReasonString(code); + evhttp_send_reply_start(request, code, reason); + } + evhttp_send_reply_chunk(request, res.chunk); + } else { + evhttp_send_reply_end(request); + } + } else if (RuntimeOption::LibEventSyncSend) { + evhttp_send_reply_sync_end(res.nwritten, request); + } else { + const char *reason = HttpProtocol::GetReasonString(code); + evhttp_send_reply(request, code, reason, NULL); + } + } +} + +PendingResponseQueue::Response::Response() + : request(NULL), code(0), nwritten(0), + chunked(false), firstChunk(false), chunk(NULL) { +} + +PendingResponseQueue::Response::~Response() { + if (chunk) { + evbuffer_free(chunk); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/libevent_server.h b/src/cpp/base/server/libevent_server.h new file mode 100644 index 0000000000000..fc64536fa99f6 --- /dev/null +++ b/src/cpp/base/server/libevent_server.h @@ -0,0 +1,181 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HTTP_SERVER_LIB_EVENT_SERVER_H__ +#define __HTTP_SERVER_LIB_EVENT_SERVER_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Wrapping evhttp_request to keep track of queuing time: from onRequest() to + * doJob(). + */ +DECLARE_BOOST_TYPES(LibEventJob); +class LibEventJob { +public: + LibEventJob(evhttp_request *req); + void stopTimer(); + + evhttp_request *request; + +private: + timespec start; +}; + +/** + * Required class for JobQueueDispatcher, who will call this class's doJob() + * with one HTTP request after another. All this class does is to delegate + * the request to an HttpRequestHandler. + */ +class LibEventWorker : public JobQueueWorker { +public: + LibEventWorker(); + virtual ~LibEventWorker(); + + /** + * Request handler called by LibEventServer. + */ + virtual void doJob(LibEventJobPtr job); + + /** + * Called when thread enters and exits. + */ + virtual void onThreadEnter(); + virtual void onThreadExit(); + +private: + RequestHandler *m_handler; +}; + +/** + * Helper class for queuing up response sending back to event loop. + */ +class PendingResponseQueue { +public: + PendingResponseQueue(); + + bool empty(); + void create(event_base *eventBase); + void enqueue(int worker, evhttp_request *request, int code, int nwritten); + void enqueue(int worker, evhttp_request *request, int code, evbuffer *chunk, + bool firstChunk); + void enqueue(int worker, evhttp_request *request); // chunked encoding ended + void process(); + void close(); + +private: + class Response { + public: + Response(); + ~Response(); + + evhttp_request *request; + int code; + int nwritten; + + bool chunked; + bool firstChunk; + evbuffer *chunk; + }; + DECLARE_BOOST_TYPES(Response); + + class ResponseQueue { + public: + Mutex m_mutex; + std::deque m_responses; + }; + DECLARE_BOOST_TYPES(ResponseQueue); + + // signal between worker thread and response processing thread + event m_event; + CPipe m_ready; + ResponseQueuePtrVec m_responseQueues; + + void enqueue(int worker, ResponsePtr response); +}; + +/** + * Implementing an evhttp based HTTP server with JobQueueDispatcher. This + * server will have one dispather thread and multiple worker threads. + */ +class LibEventServer : public Server { +public: + /** + * Constructor and destructor. + */ + LibEventServer(const std::string &address, int port, int thread); + ~LibEventServer(); + + // implemting Server + virtual void start(); + virtual void waitForEnd(); + virtual void stop(); + virtual int getActiveWorker() { + return m_dispatcher.getActiveWorker(); + } + + void onThreadEnter(); + + /** + * Request handler called by evhttp library. + */ + void onRequest(evhttp_request *request); + + /** + * Called by LibEventTransport when a response is fully prepared. + */ + void onResponse(int worker, evhttp_request *request, int code); + void onChunkedResponse(int worker, evhttp_request *request, int code, + evbuffer *chunk, bool firstChunk); + void onChunkedResponseEnd(int worker, evhttp_request *request); + +protected: + virtual int getAcceptSocket(); + + int m_accept_sock; + event_base *m_eventBase; + evhttp *m_server; + + // signal to stop the thread + event m_eventStop; + CPipe m_pipeStop; + + TimeoutThread m_timeoutThreadData; + AsyncFunc m_timeoutThread; + +private: + JobQueueDispatcher m_dispatcher; + AsyncFunc m_dispatcherThread; + + PendingResponseQueue m_responseQueue; + + // dispatcher thread runs this function + void dispatch(); + + void dispatchWithTimeout(int timeoutSeconds); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HTTP_SERVER_LIB_EVENT_SERVER_H__ diff --git a/src/cpp/base/server/libevent_server_with_takeover.cpp b/src/cpp/base/server/libevent_server_with_takeover.cpp new file mode 100644 index 0000000000000..0af190028a8bb --- /dev/null +++ b/src/cpp/base/server/libevent_server_with_takeover.cpp @@ -0,0 +1,300 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +/* +LibEventServerWithTakeover extends LibEventServer with the ability +to transfer the accept socket (the file descriptor used to accept +new connections) from an older instance of the server to a new one +that has just been brought up. + +In getAcceptSocket, if binding fails, the server will attempt to +use libafdt to transfer a file descriptor from an existing process +(which should exist, since we couldn't bind to the socket). +The transfer is performed in a separate event loop that we wait on, +so it is effectively synchronous. If we fail to get the socket, +we just return up to higher-level code (the HttpServer class will +then try to kill the existing server). If we do get the socket, +we send another request to the existing server to make it shut down +its main port, then we set up our own file descriptor server so +we can give the socket to the next instance that starts. + +It is a little bit of a hack to use libafdt to send the shutdown +request, but we need to synchronously shut down the admin server, +so we cannot use the admin server for it. +*/ + +// We use a very simple protocol for communicating over libafdt: +// One byte for the protocol version and a second code byte. +#define P_VERSION "\x01" +#define C_FD_REQ "\x02" +#define C_TERM_REQ "\x03" +#define C_FD_RESP "\x04" +#define C_TERM_OK "\x05" +#define C_TERM_BAD "\x06" +#define C_UNKNOWN "\x07" + +namespace HPHP { + +static void fd_transfer_error_hander( + const struct afdt_error_t* err, + void* userdata) { + (void)userdata; + Logger::Error( + "AFDT ERROR: phase=%s operation=%s " + "message=\"%s\" errno=\"%s\"", + afdt_phase_str(err->phase), + afdt_operation_str(err->operation), + err->message, + Util::safe_strerror(errno).c_str()); +} + +static int fd_transfer_request_handler( + const uint8_t* request, + uint32_t request_length, + uint8_t* response, + uint32_t* response_length, + void* userdata) { + LibEventServerWithTakeover* server = (LibEventServerWithTakeover*)userdata; + String req((const char*)request, request_length, CopyString); + String resp; + int fd = server->afdtRequest(req, &resp); + ASSERT(resp.size() <= (int)*response_length); + memcpy(response, resp.data(), resp.size()); + *response_length = resp.size(); + return fd; +} + +LibEventServerWithTakeover::LibEventServerWithTakeover( + const std::string &address, + int port, + int thread) + : LibEventServer(address, port, thread), + m_delete_handle(NULL), + m_took_over(false) +{ +} + +int LibEventServerWithTakeover::afdtRequest(String request, String* response) { + Logger::Info("takeover: received request"); + if (request == P_VERSION C_FD_REQ) { + Logger::Info("takeover: request is a listen socket request"); + int ret; + *response = P_VERSION C_FD_RESP; + // Make evhttp forget our copy of the accept socket so we don't accept any + // more connections and drop them. Keep the socket open until we get the + // shutdown request so that we can still serve AFDT requests (if the new + // server crashes or something). The downside is that it will take the LB + // longer to figure out that we are broken. + ret = evhttp_del_accept_socket(m_server, m_accept_sock); + if (ret < 0) { + // This will fail if we get a second AFDT request, but the spurious + // log message is not too harmful. + Logger::Error("Unable to delete accept socket"); + } + return m_accept_sock; + } else if (request == P_VERSION C_TERM_REQ) { + Logger::Info("takeover: request is a terminate request"); + // It is a little bit of a hack to use an AFDT request/response + // to shut down our accept socket, but it has to be done from + // within the main libevent thread. + int ret; + *response = P_VERSION C_TERM_BAD; + ret = close(m_accept_sock); + if (ret < 0) { + Logger::Error("Unable to close accept socket"); + return -1; + } + m_accept_sock = -1; + ret = afdt_close_server(m_delete_handle); + if (ret < 0) { + Logger::Error("Unable to close afdt server"); + return -1; + } + m_delete_handle = NULL; + + *response = P_VERSION C_TERM_OK; + Logger::Info("takeover: notifying all listeners"); + for (std::set::iterator it = + m_takeover_listeners.begin(); + it != m_takeover_listeners.end(); ++it) { + (*it)->takeoverShutdown(this); + } + Logger::Info("takeover: notification complete"); + return -1; + } else { + Logger::Info("takeover: request is unrecognize"); + *response = P_VERSION C_UNKNOWN; + return -1; + } +} + +void LibEventServerWithTakeover::setupFdServer() { + int ret; + ret = unlink(m_transfer_fname.c_str()); + if (ret < 0 && errno != ENOENT) { + Logger::Error("Unalbe to unlink '%s': %s", + m_transfer_fname.c_str(), Util::safe_strerror(errno).c_str()); + return; + } + + ret = afdt_create_server( + m_transfer_fname.c_str(), + m_eventBase, + fd_transfer_request_handler, + afdt_no_post, + fd_transfer_error_hander, + &m_delete_handle, + this); + // We don't really care if this worked or not. + // If it didn't, the next invocation of the server + // will just have to kill us. + if (ret >= 0) { + Logger::Info("takeover: fd server set up successfully"); + } +} + +int LibEventServerWithTakeover::getAcceptSocket() { + int ret; + + if (m_accept_sock != -1) { + Logger::Warning("LibEventServerWithTakeover trying to get a socket, " + "but m_accept_sock is not -1. Possibly leaking file descriptors."); + m_accept_sock = -1; + } + + ret = evhttp_bind_socket_with_fd(m_server, m_address.c_str(), m_port); + if (ret >= 0) { + Logger::Info("takeover: bound directly to port"); + m_accept_sock = ret; + return 0; + } else if (errno != EADDRINUSE) { + return -1; + } + + if (m_transfer_fname.empty()) { + return -1; + } + + Logger::Info("takeover: beginning listen socket acquisition"); + uint8_t fd_request[3] = P_VERSION C_FD_REQ; + uint8_t fd_response[3] = {0,0,0}; + uint32_t response_len = sizeof(fd_response); + afdt_error_t err = AFDT_ERROR_T_INIT; + // TODO(dreiss): Make this timeout configurable. + struct timeval timeout = { 2 , 0 }; + ret = afdt_sync_client( + m_transfer_fname.c_str(), + fd_request, + sizeof(fd_request) - 1, + fd_response, + &response_len, + &m_accept_sock, + &timeout, + &err); + if (ret < 0) { + fd_transfer_error_hander(&err, NULL); + errno = EADDRINUSE; + return -1; + } else if (m_accept_sock < 0) { + String resp((const char*)fd_response, response_len, CopyString); + Logger::Error( + "AFDT did not receive a file descriptor: " + "response = '%s'", + StringUtil::CEncode(resp, null_string).data()); + errno = EADDRINUSE; + return -1; + } + + Logger::Info("takeover: acquired listen socket"); + m_took_over = true; + + ret = evhttp_accept_socket(m_server, m_accept_sock); + if (ret < 0) { + Logger::Error("evhttp_accept_socket: %s", + Util::safe_strerror(errno).c_str()); + int errno_save = errno; + close(m_accept_sock); + m_accept_sock = -1; + errno = errno_save; + return -1; + } + + return 0; +} + +void LibEventServerWithTakeover::start() { + LibEventServer::start(); + + if (m_took_over) { + Logger::Info("takeover: requesting shutdown of satellites"); + // Use AFDT to synchronously shut down the old server's satellites + // so we can take their ports using accept. The main server will be + // stopped asynchronously. + uint8_t shutdown_request[3] = P_VERSION C_TERM_REQ; + uint8_t shutdown_response[3] = {0,0,0}; + uint32_t response_len = sizeof(shutdown_response); + int should_not_receive_fd; + afdt_error_t err = AFDT_ERROR_T_INIT; + // TODO(dreiss): Make this timeout configurable. + // We can aford to wait a long time here, since we've already started + // the dispatcher for this server. We want to give the old server + // plenty of time to shut down all of its satellite servers. + struct timeval timeout = { 10 , 0 }; + int ret = afdt_sync_client( + m_transfer_fname.c_str(), + shutdown_request, + sizeof(shutdown_request) - 1, + shutdown_response, + &response_len, + &should_not_receive_fd, + &timeout, + &err); + if (ret < 0) { + fd_transfer_error_hander(&err, NULL); + Logger::Warning("Failed to shut-down old server with AFDT."); + // The higher-level start logic will try *very* hard to recover from this. + } + String resp((const char*)shutdown_response, response_len, CopyString); + if (resp != P_VERSION C_TERM_OK) { + Logger::Error( + "Old server could not shut down: " + "response = '%s'", + StringUtil::CEncode(resp, null_string).data()); + } else { + Logger::Info("takeover: old satellites have shut down"); + } + } + + setupFdServer(); +} + +void LibEventServerWithTakeover::stop() { + if (m_delete_handle != NULL) { + afdt_close_server(m_delete_handle); + } + m_accept_sock = -1; + LibEventServer::stop(); +} + +TakeoverListener::~TakeoverListener() { +} + +} diff --git a/src/cpp/base/server/libevent_server_with_takeover.h b/src/cpp/base/server/libevent_server_with_takeover.h new file mode 100644 index 0000000000000..12c92eed02ca2 --- /dev/null +++ b/src/cpp/base/server/libevent_server_with_takeover.h @@ -0,0 +1,80 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HTTP_SERVER_LIB_EVENT_SERVER_WITH_TAKEOVER_H__ +#define __HTTP_SERVER_LIB_EVENT_SERVER_WITH_TAKEOVER_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class TakeoverListener; + +/** + * LibEventServer that adds the ability to take over an accept socket + * from another process, and give its accept socket up. + */ +class LibEventServerWithTakeover : public LibEventServer { +public: + LibEventServerWithTakeover(const std::string &address, + int port, + int thread); + + virtual void stop(); + + // Set the name of the file to be used for a Unix domain socket + // over which to transfer the accept socket. + void setTransferFilename(const std::string &fname) { + ASSERT(m_transfer_fname.empty()); + m_transfer_fname = fname; + } + + void addTakeoverListener(TakeoverListener* lisener) { + m_takeover_listeners.insert(lisener); + } + void removeTakeoverListener(TakeoverListener* lisener) { + m_takeover_listeners.erase(lisener); + } + + // These are public so they can be called from a C-style callback. + // They are not a part of the public interface. + void afdtResponse(String response, int fd); + int afdtRequest(String request, String* response); + +protected: + virtual void start(); + virtual int getAcceptSocket(); + + void setupFdServer(); + void notifyTakeoverComplete(); + + void* m_delete_handle; + std::string m_transfer_fname; + std::set m_takeover_listeners; + bool m_took_over; +}; + +class TakeoverListener { +public: + virtual ~TakeoverListener(); + virtual void takeoverShutdown(LibEventServerWithTakeover* server) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HTTP_SERVER_LIB_EVENT_SERVER_H__ diff --git a/src/cpp/base/server/libevent_transport.cpp b/src/cpp/base/server/libevent_transport.cpp new file mode 100644 index 0000000000000..8dd5614218b02 --- /dev/null +++ b/src/cpp/base/server/libevent_transport.cpp @@ -0,0 +1,208 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// libevent is not exposing this data structure, but we need it. +struct m_evkeyvalq { + struct evkeyval *tqh_first; +}; + +LibEventTransport::LibEventTransport(LibEventServer *server, + evhttp_request *request, + int workerId) + : m_server(server), m_request(request), m_workerId(workerId), + m_sendStarted(false), m_sendEnded(false) { + // HttpProtocol::PrepareSystemVariables needs this + evbuffer *buf = m_request->input_buffer; + ASSERT(buf); + int size = EVBUFFER_LENGTH(buf); + if (size) { + evbuffer_expand(buf, size + 1); // allowing NULL termination + // EVBUFFER_DATA(buf) might change after evbuffer_expand + ((char*)EVBUFFER_DATA(buf))[size] = '\0'; + } + + m_remote_host = m_request->remote_host; + + { + char buf[6]; + snprintf(buf, 6, "%d.%d", m_request->major, m_request->minor); + m_http_version = buf; + } + + switch (m_request->type) { + case EVHTTP_REQ_GET: + m_method = Transport::GET; + break; + case EVHTTP_REQ_POST: + m_method = Transport::POST; + break; + case EVHTTP_REQ_HEAD: + m_method = Transport::HEAD; + break; + default: + ASSERT(false); + m_method = Transport::UnknownMethod; + break; + } + m_extended_method = m_request->ext_method; + + ASSERT(m_request->input_headers); + for (evkeyval *p = ((m_evkeyvalq*)m_request->input_headers)->tqh_first; p; + p = p->next.tqe_next) { + if (p->key && p->value) { + m_requestHeaders[p->key].push_back(p->value); + } + } + + m_url = m_request->uri; +} + +const char *LibEventTransport::getUrl() { + return m_url.c_str(); +} + +const char *LibEventTransport::getRemoteHost() { + return m_remote_host.c_str(); +} + +void const *LibEventTransport::getPostData(int &size) { + evbuffer *buf = m_request->input_buffer; + + ASSERT(buf); + size = EVBUFFER_LENGTH(buf); + return EVBUFFER_DATA(buf); +} + +Transport::Method LibEventTransport::getMethod() { + return m_method; +} + +const char *LibEventTransport::getExtendedMethod() { + return m_extended_method; +} + +std::string LibEventTransport::getHTTPVersion() const { + return m_http_version; +} + +std::string LibEventTransport::getHeader(const char *name) { + ASSERT(name && *name); + + HeaderMap::const_iterator iter = m_requestHeaders.find(name); + if (iter != m_requestHeaders.end()) { + return iter->second[0]; + } + return ""; +} + +void LibEventTransport::getHeaders(HeaderMap &headers) { + if (&m_requestHeaders != &headers) { + headers = m_requestHeaders; + } +} + +void LibEventTransport::addHeaderImpl(const char *name, const char *value) { + ASSERT(name && *name); + ASSERT(value); + ASSERT(m_request->output_headers); + + if (m_sendStarted) { + Logger::Error("trying to add header '%s: %s' after 1st chunk", + name, value); + return; + } + + int ret = evhttp_add_header(m_request->output_headers, name, value); + if (ret < 0) { + throw InvalidHeaderException(name, value); + } +} + +void LibEventTransport::removeHeaderImpl(const char *name) { + ASSERT(name && *name); + ASSERT(m_request->output_headers); + + if (m_sendStarted) { + Logger::Error("trying to remove header '%s' after 1st chunk", name); + return; + } + + evhttp_remove_header(m_request->output_headers, name); +} + +void LibEventTransport::addRequestHeaderImpl(const char *name, + const char *value) { + ASSERT(name && *name); + ASSERT(value); + ASSERT(m_request->input_headers); + + int ret = evhttp_add_header(m_request->input_headers, name, value); + if (ret < 0) { + throw InvalidHeaderException(name, value); + } + m_requestHeaders[name].push_back(value); +} + +void LibEventTransport::removeRequestHeaderImpl(const char *name) { + ASSERT(name && *name); + ASSERT(m_request->input_headers); + evhttp_remove_header(m_request->input_headers, name); + m_requestHeaders.erase(name); +} + +bool LibEventTransport::isServerStopping() { + return m_server->getStatus() == Server::STOPPED; +} + +void LibEventTransport::sendImpl(const void *data, int size, int code, + bool chunked) { + ASSERT(data); + ASSERT(!m_sendEnded); + ASSERT(!m_sendStarted || chunked); + + if (chunked) { + evbuffer *chunk = evbuffer_new(); + evbuffer_add(chunk, data, size); + m_server->onChunkedResponse(m_workerId, m_request, code, chunk, + !m_sendStarted); + } else { + evbuffer_add(m_request->output_buffer, data, size); + m_server->onResponse(m_workerId, m_request, code); + m_sendEnded = true; + } + m_sendStarted = true; +} + +void LibEventTransport::onSendEndImpl() { + if (m_chunkedEncoding) { + m_server->onChunkedResponseEnd(m_workerId, m_request); + m_sendEnded = true; + } else { + ASSERT(m_sendEnded); // otherwise, we didn't call send for this request + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/libevent_transport.h b/src/cpp/base/server/libevent_transport.h new file mode 100644 index 0000000000000..359e2585971df --- /dev/null +++ b/src/cpp/base/server/libevent_transport.h @@ -0,0 +1,68 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HTTP_SERVER_LIB_EVENT_TRANSPORT_H__ +#define __HTTP_SERVER_LIB_EVENT_TRANSPORT_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class LibEventServer; +class LibEventTransport : public Transport { +public: + LibEventTransport(LibEventServer *server, evhttp_request *request, + int workerId); + + /** + * Implementing Transport... + */ + virtual const char *getUrl(); + virtual const char *getRemoteHost(); + virtual const void *getPostData(int &size); + virtual Method getMethod(); + virtual const char *getExtendedMethod(); + virtual std::string getHTTPVersion() const; + virtual std::string getHeader(const char *name); + virtual void getHeaders(HeaderMap &headers); + virtual void addHeaderImpl(const char *name, const char *value); + virtual void removeHeaderImpl(const char *name); + virtual void addRequestHeaderImpl(const char *name, const char *value); + virtual void removeRequestHeaderImpl(const char *name); + virtual void sendImpl(const void *data, int size, int code, bool chunked); + virtual void onSendEndImpl(); + virtual bool isServerStopping(); + +private: + LibEventServer *m_server; + evhttp_request *m_request; + int m_workerId; + std::string m_url; + std::string m_remote_host; + std::string m_http_version; + Method m_method; + const char *m_extended_method; + HeaderMap m_requestHeaders; + bool m_sendStarted; + bool m_sendEnded; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HTTP_SERVER_LIB_EVENT_TRANSPORT_H__ diff --git a/src/cpp/base/server/pagelet_server.cpp b/src/cpp/base/server/pagelet_server.cpp new file mode 100644 index 0000000000000..054e497ea1aed --- /dev/null +++ b/src/cpp/base/server/pagelet_server.cpp @@ -0,0 +1,255 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class PageletTransport : public Transport, public Synchronizable { +public: + PageletTransport(CStrRef url, CArrRef headers, CStrRef postData, + CStrRef remoteHost) + : m_refCount(0), m_done(false), m_code(0) { + m_url.append(url.data(), url.size()); + m_remoteHost.append(remoteHost.data(), remoteHost.size()); + + for (ArrayIter iter(headers); iter; ++iter) { + String header = iter.second(); + int pos = header.find(": "); + if (pos >= 0) { + string name = header.substr(0, pos).data(); + string value = header.substr(pos + 2).data(); + m_requestHeaders[name].push_back(value); + } else { + Logger::Error("throwing away bad header: %s", header.data()); + } + } + + if (postData.isNull()) { + m_get = true; + } else { + m_get = false; + m_postData.append(postData.data(), postData.size()); + } + + disableCompression(); // so we don't have to decompress during sendImpl() + } + + /** + * Implementing Transport... + */ + virtual const char *getUrl() { + return m_url.c_str(); + } + virtual const char *getRemoteHost() { + return m_remoteHost.c_str(); + } + virtual const void *getPostData(int &size) { + size = m_postData.size(); + return m_postData.data(); + } + virtual Method getMethod() { + return m_get ? Transport::GET : Transport::POST; + } + virtual std::string getHeader(const char *name) { + ASSERT(name && *name); + HeaderMap::const_iterator iter = m_requestHeaders.find(name); + if (iter != m_requestHeaders.end()) { + return iter->second[0]; + } + return ""; + } + virtual void getHeaders(HeaderMap &headers) { + headers = m_requestHeaders; + } + virtual void addHeaderImpl(const char *name, const char *value) { + ASSERT(name && *name); + ASSERT(value); + m_responseHeaders[name].push_back(value); + } + virtual void removeHeaderImpl(const char *name) { + ASSERT(name && *name); + m_responseHeaders.erase(name); + } + virtual void sendImpl(const void *data, int size, int code, + bool compressed) { + ASSERT(!compressed); + m_response.append((const char*)data, size); + if (code) { + m_code = code; + } + } + virtual void onSendEndImpl() { + Lock lock(this); + m_done = true; + notify(); + } + + // task interface + bool isDone() { + return m_done; + } + + String getResults(Array &headers, int &code) { + { + Lock lock(this); + while (!m_done) wait(); + } + + String response(m_response.c_str(), m_response.size(), CopyString); + headers = Array::Create(); + for (HeaderMap::const_iterator iter = m_responseHeaders.begin(); + iter != m_responseHeaders.end(); ++iter) { + for (unsigned int i = 0; i < iter->second.size(); i++) { + StringBuffer sb; + sb.append(iter->first); + sb.append(": "); + sb.append(iter->second[i]); + headers.append(sb.detach()); + } + } + code = m_code; + return response; + } + + // ref counting + void incRefCount() { + Lock lock(m_mutex); + ++m_refCount; + } + void decRefCount() { + { + Lock lock(m_mutex); + --m_refCount; + } + if (m_refCount == 0) { + delete this; + } + } + +private: + Mutex m_mutex; + int m_refCount; + + string m_url; + HeaderMap m_requestHeaders; + bool m_get; + string m_postData; + string m_remoteHost; + + bool m_done; + HeaderMap m_responseHeaders; + string m_response; + int m_code; +}; + +/////////////////////////////////////////////////////////////////////////////// + +class PageletWorker : public JobQueueWorker { +public: + virtual void doJob(PageletTransport *job) { + try { + HttpRequestHandler().handleRequest(job); + job->decRefCount(); + } catch (...) { + Logger::Error("HttpRequestHandler leaked exceptions"); + } + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +class PageletTask : public ResourceData { +public: + DECLARE_OBJECT_ALLOCATION(PageletTask); + + PageletTask(CStrRef url, CArrRef headers, CStrRef post_data, + CStrRef remote_host) { + m_job = new PageletTransport(url, headers, remote_host, post_data); + m_job->incRefCount(); + } + + ~PageletTask() { + m_job->decRefCount(); + } + + PageletTransport *getJob() { return m_job;} + + // overriding ResourceData + virtual const char *o_getClassName() const { return "PageletTask";} + +private: + PageletTransport *m_job; +}; +IMPLEMENT_OBJECT_ALLOCATION(PageletTask); + +/////////////////////////////////////////////////////////////////////////////// +// implementing PageletServer + +static JobQueueDispatcher *s_dispatcher; + +void PageletServer::Restart() { + if (s_dispatcher) { + s_dispatcher->stop(); + delete s_dispatcher; + s_dispatcher = NULL; + } + if (RuntimeOption::PageletServerThreadCount > 0) { + s_dispatcher = new JobQueueDispatcher + (RuntimeOption::PageletServerThreadCount, NULL); + s_dispatcher->start(); + } +} + +Object PageletServer::TaskStart(CStrRef url, CArrRef headers, + CStrRef remote_host, + CStrRef post_data /* = null_string */) { + if (RuntimeOption::PageletServerThreadCount <= 0) { + return null_object; + } + PageletTask *task = NEW(PageletTask)(url, headers, remote_host, post_data); + Object ret(task); + PageletTransport *job = task->getJob(); + job->incRefCount(); // paired with worker's decRefCount() + ASSERT(s_dispatcher); + s_dispatcher->enqueue(job); + + return ret; +} + +bool PageletServer::TaskStatus(CObjRef task) { + PageletTask *ptask = task.getTyped(); + return ptask->getJob()->isDone(); +} + +String PageletServer::TaskResult(CObjRef task, Array &headers, int &code) { + PageletTask *ptask = task.getTyped(); + return ptask->getJob()->getResults(headers, code); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/pagelet_server.h b/src/cpp/base/server/pagelet_server.h new file mode 100644 index 0000000000000..d1bece2db2cea --- /dev/null +++ b/src/cpp/base/server/pagelet_server.h @@ -0,0 +1,54 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_PAGELET_SERVER_H__ +#define __HPHP_PAGELET_SERVER_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class PageletServer { +public: + static void Restart(); + + /** + * Create a task. This returns a task handle, or null object + * if there are no worker threads. + */ + static Object TaskStart(CStrRef url, CArrRef headers, + CStrRef remote_host, + CStrRef post_data = null_string); + + /** + * Query if a task is finished. This is non-blocking and can be called as + * many times as desired. + */ + static bool TaskStatus(CObjRef task); + + /** + * Get results of a task. This is blocking until task is finished. + * + */ + static String TaskResult(CObjRef task, Array &headers, int &code); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_PAGELET_SERVER_H__ diff --git a/src/cpp/base/server/replay_transport.cpp b/src/cpp/base/server/replay_transport.cpp new file mode 100644 index 0000000000000..afd231e9fb6e4 --- /dev/null +++ b/src/cpp/base/server/replay_transport.cpp @@ -0,0 +1,144 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +void ReplayTransport::recordInput(Transport* transport, const char *filename) { + ASSERT(transport); + + Hdf hdf; + hdf["get"] = (transport->getMethod() == GET); + hdf["url"] = transport->getUrl(); + hdf["remote_host"] = transport->getRemoteHost(); + + transport->getHeaders(m_requestHeaders); + int index = 0; + for (HeaderMap::const_iterator iter = m_requestHeaders.begin(); + iter != m_requestHeaders.end(); ++iter) { + for (unsigned int i = 0; i < iter->second.size(); i++) { + Hdf header = hdf["headers"][index++]; + header["name"] = iter->first; + header["value"] = iter->second[i]; + } + } + + int size; + const void *data = transport->getPostData(size); + if (size) { + int len; + char *encoded = string_uuencode((const char *)data, size, len); + hdf["post"] = encoded; + free(encoded); + } else { + hdf["post"] = ""; + } + + hdf.write(filename); +} + +void ReplayTransport::replayInput(const char *filename) { + m_hdf.open(filename); + replayInputImpl(); +} + +void ReplayTransport::replayInput(Hdf hdf) { + m_hdf.assign(hdf); + replayInputImpl(); +} + +void ReplayTransport::replayInputImpl() { + String postData = StringUtil::UUDecode(m_hdf["post"].get("")); + m_postData = string(postData.data(), postData.size()); + m_requestHeaders.clear(); + for (Hdf hdf = m_hdf["headers"].firstChild(); hdf.exists(); + hdf = hdf.next()) { + m_requestHeaders[hdf["name"].get("")].push_back(hdf["value"].get("")); + } +} + +const char *ReplayTransport::getUrl() { + return m_hdf["url"].get(""); +} + +const char *ReplayTransport::getRemoteHost() { + return m_hdf["remote_host"].get(""); +} + +const void *ReplayTransport::getPostData(int &size) { + size = m_postData.size(); + return m_postData.data(); +} + +Transport::Method ReplayTransport::getMethod() { + return m_hdf["get"].getBool() ? GET : POST; +} + +std::string ReplayTransport::getHeader(const char *name) { + ASSERT(name); + if (m_requestHeaders.find(name) != m_requestHeaders.end()) { + ASSERT(!m_requestHeaders[name].empty()); + return m_requestHeaders[name][0]; + } + return ""; +} + +void ReplayTransport::getHeaders(HeaderMap &headers) { + headers = m_requestHeaders; +} + +void ReplayTransport::addHeaderImpl(const char *name, const char *value) { + ASSERT(name && value); + m_responseHeaders[name].push_back(value); +} + +void ReplayTransport::removeHeaderImpl(const char *name) { + ASSERT(name); + m_responseHeaders.erase(name); +} + +void ReplayTransport::sendImpl(const void *data, int size, int code, + bool chunked) { + m_code = code; + + m_response = "HTTP/1.1 "; + m_response += boost::lexical_cast(code); + m_response += " "; + m_response += (m_code == 200 ? "OK" : "Internal Server Error"); + m_response += "\r\n"; + + for (HeaderMap::const_iterator iter = m_responseHeaders.begin(); + iter != m_responseHeaders.end(); ++iter) { + for (unsigned int i = 0; i < iter->second.size(); i++) { + m_response += iter->first; + m_response += ": "; + m_response += iter->second[i]; + m_response += "\r\n"; + } + } + + m_response += "\r\n"; + m_response.append((const char *)data, size); + m_response += "\r\n"; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/replay_transport.h b/src/cpp/base/server/replay_transport.h new file mode 100644 index 0000000000000..b87699f57136b --- /dev/null +++ b/src/cpp/base/server/replay_transport.h @@ -0,0 +1,72 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_REPLAY_TRANSPORT_H__ +#define __HPHP_REPLAY_TRANSPORT_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * This transport will capture what's in another transport's requests, and + * record it in a file that later this same class can replay. Written for + * debugging HTTP requests that cause problems that are hard to debug on live + * servers. + */ +class ReplayTransport : public Transport { +public: + ReplayTransport() : m_code(0) {} + + void recordInput(Transport* transport, const char *filename); + void replayInput(const char *filename); + void replayInput(Hdf hdf); + + /** + * Implementing Transport... + */ + virtual const char *getUrl(); + virtual const char *getRemoteHost(); + virtual const void *getPostData(int &size); + virtual Method getMethod(); + virtual std::string getHeader(const char *name); + virtual void getHeaders(HeaderMap &headers); + virtual void addHeaderImpl(const char *name, const char *value); + virtual void removeHeaderImpl(const char *name); + virtual void sendImpl(const void *data, int size, int code, bool chunked); + + int getResponseCode() const { return m_code;} + const std::string &getResponse() const { return m_response;} + +private: + Hdf m_hdf; + std::string m_postData; + HeaderMap m_requestHeaders; + HeaderMap m_responseHeaders; + + int m_code; + std::string m_response; + + void replayInputImpl(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_REPLAY_TRANSPORT_H__ diff --git a/src/cpp/base/server/request_uri.cpp b/src/cpp/base/server/request_uri.cpp new file mode 100644 index 0000000000000..022a2a072d55f --- /dev/null +++ b/src/cpp/base/server/request_uri.cpp @@ -0,0 +1,285 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +RequestURI::RequestURI(const VirtualHost *vhost, Transport *transport, + const std::string &sourceRoot, + const std::string &pathTranslation) + : m_rewritten(false), m_defaultDoc(false), m_done(false) { + if (!process(vhost, transport, sourceRoot, pathTranslation, + transport->getUrl())) { + if (RuntimeOption::ErrorDocument404.empty() || + !process(vhost, transport, sourceRoot, pathTranslation, + RuntimeOption::ErrorDocument404.c_str())) { + transport->sendString("Not Found", 404); + m_done = true; + } + } +} + +RequestURI::RequestURI(const std::string rpcFunc) + : m_rewritten(false), m_defaultDoc(false), m_done(false) { + m_originalURL = m_rewrittenURL = m_resolvedURL = String(rpcFunc); +} + +bool RequestURI::process(const VirtualHost *vhost, Transport *transport, + const string &sourceRoot, + const string &pathTranslation, const char *url) { + splitURL(url, m_originalURL, m_queryString); + + // Fast path for files that exist + String canon = Util::canonicalize(string(m_originalURL.c_str(), + m_originalURL.size())); + String relUrl(canon.charAt(0) == '/' ? canon.substr(1) : + canon); + if (virtualFileExists(vhost, sourceRoot, pathTranslation, relUrl)) { + m_rewrittenURL = relUrl; + m_resolvedURL = relUrl; + PrependSlash(m_resolvedURL); + return true; + } + + if (!rewriteURL(vhost, transport, pathTranslation, sourceRoot)) { + // Redirection + m_done = true; + return true; + } + if (!resolveURL(vhost, pathTranslation, sourceRoot)) { + // Can't find + return false; + } + return true; +} + +void RequestURI::splitURL(String surl, String &base, String &querys) { + const char *url = surl.c_str(); + const char *query = strchr(url, '?'); + if (query) { + base = String(url, query - url, CopyString); + ++query; // skipping ? + querys = String(query, CopyString); + } else { + base = String(url, CopyString); + querys = ""; + } +} + +/** + * Precondition: m_originalURL and m_queryString are set + * Postcondition: Output is false and we are redirecting OR + * m_rewrittenURL is set and m_queryString is updated if needed + */ +bool RequestURI::rewriteURL(const VirtualHost *vhost, Transport *transport, + const string &pathTranslation, + const string &sourceRoot) { + bool qsa = false; + int redirect = 0; + string host = transport->getHeader("host"); + m_rewrittenURL = m_originalURL; + if (vhost->rewriteURL(host, m_rewrittenURL, qsa, redirect)) { + m_rewritten = true; + if (qsa && !m_queryString.empty()) { + m_rewrittenURL += (m_rewrittenURL.find('?') < 0) ? "?" : "&"; + m_rewrittenURL += m_queryString; + } + if (redirect) { + if (m_rewrittenURL.substr(0, 7) != "http://" && + m_rewrittenURL.substr(0, 8) != "https://") { + PrependSlash(m_rewrittenURL); + } + transport->redirect(m_rewrittenURL, redirect); + return false; + } + splitURL(m_rewrittenURL, m_rewrittenURL, m_queryString); + } + m_rewrittenURL = Util::canonicalize(string(m_rewrittenURL.c_str(), + m_rewrittenURL.size())); + if (!m_rewritten && m_rewrittenURL.charAt(0) == '/') { + // A un-rewritten URL is always relative, so remove prepending / + m_rewrittenURL = m_rewrittenURL.substr(1); + } + + // If the URL refers to a folder but does not end + // with a slash, then we need to redictect + String url = m_rewrittenURL; + if (!url.empty() && + url.charAt(url.length() - 1) != '/') { + if (virtualFolderExists(vhost, sourceRoot, pathTranslation, url)) { + url += "/"; + m_rewritten = true; + String queryStr; + m_rewrittenURL = m_originalURL; + m_rewrittenURL += "/"; + if (!m_queryString.empty()) { + m_rewrittenURL += "?"; + m_rewrittenURL += m_queryString; + } + if (m_rewrittenURL.substr(0, 7) != "http://" && + m_rewrittenURL.substr(0, 8) != "https://") { + PrependSlash(m_rewrittenURL); + } + transport->redirect(m_rewrittenURL, 301); + return false; + } + } + + return true; +} + +/** + * Precondition: m_rewrittenURL is set + * Postcondition: Output is true and m_path and m_absolutePath are set OR + * output is false and no file was found + */ +bool RequestURI::resolveURL(const VirtualHost *vhost, + const string &pathTranslation, + const string &sourceRoot) { + m_resolvedURL = m_rewrittenURL; + while (!virtualFileExists(vhost, sourceRoot, pathTranslation, + m_resolvedURL)) { + int pos = m_resolvedURL.rfind('/'); + if (pos <= 0) { + // when none of the exists, we give up, and try default doc + m_resolvedURL = m_rewrittenURL; + if (!m_resolvedURL.empty() && + m_resolvedURL.charAt(m_resolvedURL.length() - 1) != '/') { + m_resolvedURL += "/"; + } + m_resolvedURL += String(RuntimeOption::DefaultDocument); + m_pathInfo.reset(); + if (virtualFileExists(vhost, sourceRoot, pathTranslation, + m_resolvedURL)) { + m_defaultDoc = true; + PrependSlash(m_resolvedURL); + return true; + } + return false; + } + m_resolvedURL = m_rewrittenURL.substr(0, pos); + m_pathInfo = m_rewrittenURL.substr(pos); + } + PrependSlash(m_resolvedURL); + return true; +} + +bool RequestURI::virtualFileExists(const VirtualHost *vhost, + const string &sourceRoot, + const string &pathTranslation, + CStrRef filename) { + if (!filename.empty() && filename.charAt(filename.length() - 1) == '/') { + return false; + } + if (!vhost->getDocumentRoot().empty()) { + string fullname = filename.data(); + if (fullname[0] == '/') { + fullname = fullname.substr(1); + } else { + fullname = pathTranslation + fullname; + } + m_path = fullname; + m_absolutePath = String(sourceRoot) + m_path; + + if (StaticContentCache::TheFileCache && !fullname.empty() && + StaticContentCache::TheFileCache->fileExists(fullname.c_str())) { + return true; + } + + struct stat st; + return RuntimeOption::AllowedFiles.find(fullname.c_str()) != + RuntimeOption::AllowedFiles.end() || + (stat(m_absolutePath.c_str(), &st) == 0 && + (st.st_mode & S_IFMT) == S_IFREG); + } + m_path = filename; + m_absolutePath = String(sourceRoot) + filename; + return true; +} + +bool RequestURI::virtualFolderExists(const VirtualHost *vhost, + const string &sourceRoot, + const string &pathTranslation, + CStrRef foldername) { + if (!vhost->getDocumentRoot().empty()) { + string fullname = foldername.data(); + // If there is a trailing slash, remove it + if (fullname.size() > 0 && fullname[fullname.size()-1] == '/') { + fullname = fullname.substr(fullname.size()-1); + } + if (fullname[0] == '/') { + fullname = fullname.substr(1); + } else { + fullname = pathTranslation + fullname; + } + m_path = fullname; + m_absolutePath = String(sourceRoot) + m_path; + + if (StaticContentCache::TheFileCache && !fullname.empty() && + StaticContentCache::TheFileCache->dirExists(fullname.c_str())) { + return true; + } + + if (find(RuntimeOption::AllowedDirectories.begin(), + RuntimeOption::AllowedDirectories.end(), + fullname.c_str()) != RuntimeOption::AllowedDirectories.end()) + return true; + + struct stat st; + return (stat(m_absolutePath.c_str(), &st) == 0 && + (st.st_mode & S_IFMT) == S_IFDIR); + } + m_path = foldername; + m_absolutePath = String(sourceRoot) + foldername; + return true; +} + +void RequestURI::PrependSlash(String &s) { + if (!s.empty() && s.charAt(0) != '/') { + s = String("/") + s; + } +} + +void RequestURI::dump() { + m_originalURL.dump(); + m_queryString.dump(); + m_rewrittenURL.dump(); + m_resolvedURL.dump(); + m_pathInfo.dump(); + m_absolutePath.dump(); + m_path.dump(); +} + +void RequestURI::clear() { + m_originalURL.reset(); + m_queryString.reset(); + m_rewrittenURL.reset(); + m_resolvedURL.reset(); + m_pathInfo.reset(); + m_absolutePath.reset(); + m_path.reset(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/request_uri.h b/src/cpp/base/server/request_uri.h new file mode 100644 index 0000000000000..128a54ea34510 --- /dev/null +++ b/src/cpp/base/server/request_uri.h @@ -0,0 +1,92 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_REQUEST_URI_H__ +#define __HPHP_REQUEST_URI_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class VirtualHost; +class Transport; + +DECLARE_BOOST_TYPES(RequestURI); +class RequestURI { +public: + RequestURI(const VirtualHost *vhost, Transport *transport, + const std::string &pathTranslation, + const std::string &sourceRoot); + RequestURI(const std::string rpcFunc); + + CStrRef originalURL() const { return m_originalURL; } + CStrRef resolvedURL() const { return m_resolvedURL; } + CStrRef queryString() const { return m_queryString; } + + CStrRef path() const { return m_path; } + CStrRef absolutePath() const { return m_absolutePath; } + CStrRef pathInfo() const { return m_pathInfo; } + + bool rewritten() const { return m_rewritten; } + bool defaultDoc() const { return m_defaultDoc; } + bool done() const { return m_done; } + + void dump(); + void clear(); + + static void splitURL(String url, String &base, String &query); +private: + String m_originalURL; // without being rewritten, without query string + String m_queryString; + String m_rewrittenURL; // possibly rewritten + String m_resolvedURL; // possibly appended with default document and + // without pathinfo + + String m_pathInfo; + String m_absolutePath; + String m_path; // path relative to SourceRoot + + bool m_rewritten; // whether rewrite rules have applied + bool m_defaultDoc; // whether DefaultDocument was appended + bool m_done; + + bool process(const VirtualHost *vhost, Transport *transport, + const std::string &pathTranslation, + const std::string &sourceRoot, const char *url); + bool rewriteURL(const VirtualHost *vhost, Transport *transport, + const std::string &pathTranslation, + const std::string &sourceRoot); + bool resolveURL(const VirtualHost *vhost, + const std::string &pathTranslation, + const std::string &sourceRoot); + bool virtualFileExists(const VirtualHost *vhost, + const std::string &pathTranslation, + const std::string &sourceRoot, + CStrRef filename); + bool virtualFolderExists(const VirtualHost *vhost, + const std::string &pathTranslation, + const std::string &sourceRoot, + CStrRef foldername); + + static void PrependSlash(String &s); + +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_REQUEST_URI_H__ diff --git a/src/cpp/base/server/rpc_request_handler.cpp b/src/cpp/base/server/rpc_request_handler.cpp new file mode 100644 index 0000000000000..8b8e0357cccde --- /dev/null +++ b/src/cpp/base/server/rpc_request_handler.cpp @@ -0,0 +1,188 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +RPCRequestHandler::RPCRequestHandler() : m_count(0), m_reset(false) { + hphp_session_init(); + m_created = time(0); +} + +RPCRequestHandler::~RPCRequestHandler() { + hphp_session_exit(); +} + +bool RPCRequestHandler::needReset() const { + if (m_reset) return true; + return (time(0) - m_created) > m_serverInfo->getMaxDuration(); +} + +void RPCRequestHandler::handleRequest(Transport *transport) { + Logger::OnNewRequest(); + transport->enableCompression(); + + Logger::Verbose("receiving %s", transport->getCommand().c_str()); + ServerStatsHelper ssh("all", true); + + // authentication + const string &password = m_serverInfo->getPassword(); + if (!password.empty() && password != transport->getParam("auth")) { + transport->sendString("Unauthorized", 401); + transport->onSendEnd(); + return; + } + + // resolve virtual host + const VirtualHost *vhost = HttpProtocol::GetVirtualHost(transport); + ASSERT(vhost); + if (vhost->disabled()) { + transport->sendString("Virtual host disabled.", 404); + transport->onSendEnd(); + return; + } + + // resolve source root + string host = transport->getHeader("Host"); + SourceRootInfo sourceRootInfo(host.c_str()); + if (RuntimeOption::SandboxMode && !sourceRootInfo.sandboxOn()) { + transport->sendString("Sandbox configuration is incorrect.", 404); + transport->onSendEnd(); + return; + } + + // record request for debugging purpose + std::string tmpfile = HttpProtocol::RecordRequest(transport); + bool ret = executePHPFunction(transport, sourceRootInfo); + HttpProtocol::ClearRecord(ret, tmpfile); +} + +bool RPCRequestHandler::executePHPFunction(Transport *transport, + SourceRootInfo &sourceRootInfo) { + ExecutionContext *context = hphp_context_init(); + + std::string rpcFunc = transport->getCommand(); + { + ServerStatsHelper ssh("input"); + RequestURI reqURI(rpcFunc); + HttpProtocol::PrepareSystemVariables(transport, reqURI, sourceRootInfo); + sourceRootInfo.clear(); + } + + bool error = false; + + Array params; + std::string sparams = transport->getParam("params"); + if (!sparams.empty()) { + Variant jparams = f_json_decode(String(sparams)); + if (jparams.isArray()) { + params = jparams.toArray(); + } else { + error = true; + } + } else { + vector sparams; + transport->getArrayParam("p", sparams); + if (!sparams.empty()) { + for (unsigned int i = 0; i < sparams.size(); i++) { + Variant jparams = f_json_decode(String(sparams[i])); + if (same(jparams, false)) { + error = true; + break; + } + params.append(jparams); + } + } else { + // single string parameter, used by xbox to avoid any en/decoding + int size; + const void *data = transport->getPostData(size); + if (data && size) { + params.append(String((char*)data, size, AttachLiteral)); + } + } + } + + if (transport->getIntParam("reset") == 1) { + m_reset = true; + } + int output = transport->getIntParam("output"); + + int code; + if (!error) { + Variant funcRet; + std::string errorMsg = "Internal Server Error"; + string warmupDoc, reqInitFunc; + if (m_serverInfo) { + warmupDoc = m_serverInfo->getWarmupDoc(); + reqInitFunc = m_serverInfo->getReqInitFunc(); + } + if (warmupDoc.empty()) { + warmupDoc = RuntimeOption::WarmupDocument; + reqInitFunc = RuntimeOption::RequestInitFunction; + } + bool ret = hphp_invoke(context, rpcFunc, true, params, ref(funcRet), + warmupDoc, reqInitFunc, error, errorMsg); + if (ret) { + String response; + switch (output) { + case 0: response = f_json_encode(funcRet); break; + case 1: response = context->obGetContents(); break; + case 2: + response = + f_json_encode(CREATE_MAP2("output", context->obGetContents(), + "return", f_json_encode(funcRet))); + break; + } + code = 200; + transport->sendRaw((void*)response.data(), response.size()); + } else if (error) { + code = 500; + if (RuntimeOption::ServerErrorMessage) { + transport->sendString(errorMsg, 500); + } else { + transport->sendString(RuntimeOption::FatalErrorMessage, 500); + } + } else { + code = 404; + transport->sendString("Not Found", 404); + } + } else { + code = 400; + transport->sendString("Bad Request", 400); + } + params.reset(); + + transport->onSendEnd(); + ServerStats::LogPage(rpcFunc, code); + + hphp_context_exit(context, true); + return !error; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/rpc_request_handler.h b/src/cpp/base/server/rpc_request_handler.h new file mode 100644 index 0000000000000..4dcce72b9938f --- /dev/null +++ b/src/cpp/base/server/rpc_request_handler.h @@ -0,0 +1,63 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_RPC_REQUEST_HANDLER_H__ +#define __HPHP_RPC_REQUEST_HANDLER_H__ + +#include + +namespace HPHP { + +class SourceRootInfo; +class RequestURI; +class Transport; +DECLARE_BOOST_TYPES(SatelliteServerInfo); +/////////////////////////////////////////////////////////////////////////////// + +class RPCRequestHandler : public RequestHandler { +public: + RPCRequestHandler(); + virtual ~RPCRequestHandler(); + + void setServerInfo(SatelliteServerInfoPtr info) { m_serverInfo = info;} + + // implementing RequestHandler + virtual void handleRequest(Transport *transport); + + /** + * Count how many requests have been processed on this handler. + */ + int incRequest() { return ++m_count;} + + /** + * Whether state has been dirtied. + */ + bool needReset() const; + +private: + SatelliteServerInfoPtr m_serverInfo; + int m_count; + bool m_reset; + time_t m_created; + + bool executePHPFunction(Transport *transport, + SourceRootInfo &sourceRootInfo); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_RPC_REQUEST_HANDLER_H__ diff --git a/src/cpp/base/server/satellite_server.cpp b/src/cpp/base/server/satellite_server.cpp new file mode 100644 index 0000000000000..7f504089f87f1 --- /dev/null +++ b/src/cpp/base/server/satellite_server.cpp @@ -0,0 +1,219 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +std::set SatelliteServerInfo::InternalURLs; +int SatelliteServerInfo::DanglingServerPort = 0; + +SatelliteServerInfo::SatelliteServerInfo(Hdf hdf) { + m_name = hdf.getName(); + m_port = hdf["Port"].getInt16(0); + m_threadCount = hdf["ThreadCount"].getInt32(5); + m_maxRequest = hdf["MaxRequest"].getInt32(500); + m_maxDuration = hdf["MaxDuration"].getInt32(120); + m_warmupDoc = hdf["WarmupDocument"].getString(""); + m_reqInitFunc = hdf["RequestInitFunction"].getString(""); + m_password = hdf["Password"].getString(""); + + string type = hdf["Type"]; + if (type == "InternalPageServer") { + m_type = SatelliteServer::KindOfInternalPageServer; + vector urls; + hdf["URLs"].get(urls); + for (unsigned int i = 0; i < urls.size(); i++) { + m_urls.insert(format_pattern(urls[i])); + } + if (hdf["BlockMainServer"].getBool(true)) { + InternalURLs.insert(m_urls.begin(), m_urls.end()); + } + } else if (type == "DanglingPageServer") { + m_type = SatelliteServer::KindOfDanglingPageServer; + DanglingServerPort = m_port; + } else if (type == "RPCServer") { + m_type = SatelliteServer::KindOfRPCServer; + } else if (type == "ThriftServer") { + m_type = SatelliteServer::KindOfThriftServer; + } else { + m_type = SatelliteServer::UnknownType; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// InternalPageServer: LibEventServer + allowed URL checking + +DECLARE_BOOST_TYPES(InternalPageServerImpl); +class InternalPageServerImpl : public LibEventServer { +public: + InternalPageServerImpl(const std::string &address, int port, int thread) : + LibEventServer(address, port, thread) { + } + void create(const std::set &urls) { + m_allowedURLs = urls; + } + + virtual bool shouldHandle(const std::string &cmd) { + String url(cmd.c_str(), cmd.size(), AttachLiteral); + for (set::const_iterator iter = m_allowedURLs.begin(); + iter != m_allowedURLs.end(); ++iter) { + Variant ret = preg_match + (String(iter->c_str(), iter->size(), AttachLiteral), url); + if (ret.toInt64() > 0) { + return true; + } + } + return false; + } + +private: + std::set m_allowedURLs; +}; + +class InternalPageServer : public SatelliteServer { +public: + InternalPageServer(SatelliteServerInfoPtr info) { + InternalPageServerImplPtr server + (new TypedServer + (RuntimeOption::ServerIP, info->getPort(), info->getThreadCount())); + server->create(info->getURLs()); + m_server = server; + } + + virtual void start() { + m_server->start(); + } + virtual void stop() { + m_server->stop(); + m_server->waitForEnd(); + } +private: + ServerPtr m_server; +}; + +/////////////////////////////////////////////////////////////////////////////// +// DanglingPageServer: same as LibEventServer + +class DanglingPageServer : public SatelliteServer { +public: + DanglingPageServer(SatelliteServerInfoPtr info) { + m_server = ServerPtr + (new TypedServer + (RuntimeOption::ServerIP, info->getPort(), info->getThreadCount())); + } + + virtual void start() { + m_server->start(); + } + virtual void stop() { + m_server->stop(); + m_server->waitForEnd(); + } +private: + ServerPtr m_server; +}; + +/////////////////////////////////////////////////////////////////////////////// +// RPCServer: LibEventServer + RPCRequestHandler + +static ThreadLocal s_rpc_request_handler; + +class RPCServerImpl : public LibEventServer { +public: + RPCServerImpl(const std::string &address, SatelliteServerInfoPtr info) + : LibEventServer(address, info->getPort(), info->getThreadCount()), + m_serverInfo(info) { + } + + virtual RequestHandler *createRequestHandler() { + s_rpc_request_handler->setServerInfo(m_serverInfo); + if (s_rpc_request_handler->needReset() || + s_rpc_request_handler->incRequest() > m_serverInfo->getMaxRequest()) { + s_rpc_request_handler.reset(); + s_rpc_request_handler->setServerInfo(m_serverInfo); + s_rpc_request_handler->incRequest(); + } + return s_rpc_request_handler.get(); + } + + virtual void releaseRequestHandler(RequestHandler *handler) { + // do nothing + } + + virtual void onThreadExit(RequestHandler *handler) { + s_rpc_request_handler.reset(); + } + +private: + SatelliteServerInfoPtr m_serverInfo; +}; + +class RPCServer : public SatelliteServer { +public: + RPCServer(SatelliteServerInfoPtr info) { + m_server = ServerPtr(new RPCServerImpl(RuntimeOption::ServerIP, info)); + } + + virtual void start() { + m_server->start(); + } + virtual void stop() { + m_server->stop(); + m_server->waitForEnd(); + } +private: + ServerPtr m_server; +}; + +/////////////////////////////////////////////////////////////////////////////// +// SatelliteServer + +SatelliteServerPtr SatelliteServer::Create(SatelliteServerInfoPtr info) { + SatelliteServerPtr satellite; + switch (info->getType()) { + case KindOfInternalPageServer: + satellite = SatelliteServerPtr(new InternalPageServer(info)); + break; + case KindOfDanglingPageServer: + satellite = SatelliteServerPtr(new DanglingPageServer(info)); + break; + case KindOfRPCServer: + satellite = SatelliteServerPtr(new RPCServer(info)); + break; + case KindOfThriftServer: + // TODO + break; + default: + ASSERT(false); + } + if (satellite) { + satellite->setName(info->getName()); + } + return satellite; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/satellite_server.h b/src/cpp/base/server/satellite_server.h new file mode 100644 index 0000000000000..8862816d423b2 --- /dev/null +++ b/src/cpp/base/server/satellite_server.h @@ -0,0 +1,99 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SATELLITE_SERVER_H__ +#define __HPHP_SATELLITE_SERVER_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(SatelliteServerInfo); +DECLARE_BOOST_TYPES(SatelliteServer); +class SatelliteServer { +public: + enum Type { + UnknownType, + + KindOfInternalPageServer, // handles restricted URLs + KindOfDanglingPageServer, // handles old version requests during shutdown + KindOfRPCServer, // invokes one PHP function and returns JSON + KindOfThriftServer, // handles thrift requests + }; + + void setName(const std::string &name) { m_name = name;} + const std::string &getName() const { return m_name;} + +public: + static SatelliteServerPtr Create(SatelliteServerInfoPtr info); + + virtual ~SatelliteServer() {} + + virtual void start() = 0; + virtual void stop() = 0; + +private: + std::string m_name; +}; + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +class SatelliteServerInfo { +public: + /** + * These are regular expressions of URLs that are not allowed on main server. + * These are collected from all internal page servers. + */ + static std::set InternalURLs; + static int DanglingServerPort; + +public: + SatelliteServerInfo(Hdf hdf); + + const std::string &getName() const { return m_name;} + SatelliteServer::Type getType() const { return m_type;} + int getPort() const { return m_port;} + int getThreadCount() const { return m_threadCount;} + + // only for InternalPageServer + const std::set &getURLs() const { return m_urls;} + + // only for RPCServer + int getMaxRequest() const { return m_maxRequest;} + int getMaxDuration() const { return m_maxDuration;} + const std::string &getWarmupDoc() const { return m_warmupDoc;} + const std::string &getReqInitFunc() const { return m_reqInitFunc;} + const std::string &getPassword() const { return m_password;} + +protected: + std::string m_name; + SatelliteServer::Type m_type; + int m_port; + int m_threadCount; + int m_maxRequest; + int m_maxDuration; + std::set m_urls; // url regex patterns + std::string m_warmupDoc; + std::string m_reqInitFunc; + std::string m_password; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_SATELLITE_SERVER_H__ diff --git a/src/cpp/base/server/server.cpp b/src/cpp/base/server/server.cpp new file mode 100644 index 0000000000000..438e9eaae4a5f --- /dev/null +++ b/src/cpp/base/server/server.cpp @@ -0,0 +1,72 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// +// statics + +static HPHP::ServerPtrVec AllServers; +static void on_kill(int sig) { + signal(sig, SIG_DFL); + for (unsigned int i = 0; i < AllServers.size(); i++) { + AllServers[i]->stop(); + } + raise(sig); +} + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool Server::StackTraceOnError = true; + +void Server::InstallStopSignalHandlers(ServerPtr server) { + if (AllServers.empty()) { + signal(SIGTERM, on_kill); + signal(SIGUSR1, on_kill); + } + + AllServers.push_back(server); +} + +/////////////////////////////////////////////////////////////////////////////// + +Server::Server(const std::string &address, int port, int threadCount) + : m_address(address), m_port(port), m_threadCount(threadCount), + m_status(NOT_YET_STARTED) { +} + +bool Server::shouldHandle(const std::string &cmd) { + String url(cmd.c_str(), cmd.size(), AttachLiteral); + for (set::const_iterator iter = + SatelliteServerInfo::InternalURLs.begin(); + iter != SatelliteServerInfo::InternalURLs.end(); ++iter) { + Variant ret = preg_match + (String(iter->c_str(), iter->size(), AttachLiteral), url); + if (ret.toInt64() > 0) { + return false; + } + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/server.h b/src/cpp/base/server/server.h new file mode 100644 index 0000000000000..5dab13254cd0f --- /dev/null +++ b/src/cpp/base/server/server.h @@ -0,0 +1,246 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HTTP_SERVER_SERVER_H__ +#define __HTTP_SERVER_SERVER_H__ + +#include +#include +#include + +/** + * (1) For people who want to quickly come up with an HTTP server handling + * their specific requests, we really want to minimize writing an HTTP + * server to something like this, + * + * class MyRequestHandler : public RequestHandler { + * public: + * virtual void handleRequest(Transport *transport) { + * // ... + * } + * }; + * + * Then, run a server like this, + * + * ServerPtr server(new TypedServer + * ("127.0.0.1", 80, 20)); + * Server::InstallStopSignalHandlers(server); + * server->start(); + * + * This way, we can easily swap out an implementation like LibEventServer + * without any modifications to MyRequestHandler, if LibEventServer model + * doesn't perform well with the specific requests. + * + * (2) For people who are interested in implementing a high-performance HTTP + * server, derive a new class from Server just like LibEventServer + * does. + * + * class MyTransport : public Transport { + * // implements transport-related functions + * }; + * + * class MyServer : public Server { + * // implements how to start/stop a server + * }; + * + * (3) LibEventServer is pre-implemented with evhttp, and it has one thread + * listening on a socket and dispatching jobs to multiple worker threads. + * + */ + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(Server); + +/** + * Base class of an HTTP request handler. Defining minimal interface an + * HTTP request handler needs to implement. + * + * Note that each request handler may be invoked multiple times for different + * requests. + */ +class RequestHandler { +public: + virtual ~RequestHandler() {} + + /** + * Sub-class handles a request by implementing this function. + */ + virtual void handleRequest(Transport *transport) = 0; +}; + +/** + * Base class of an HTTP server. Defining minimal interface an HTTP server + * needs to implement. + */ +class Server { +public: + enum RunStatus { + NOT_YET_STARTED = 0, + RUNNING, + STOPPING, + STOPPED, + }; + + /** + * Whether to turn on full stacktrace on internal server errors. Default is + * true. + */ + static bool StackTraceOnError; + + /** + * ...so that we can grarefully stop these servers on signals. + */ + static void InstallStopSignalHandlers(ServerPtr server); + +public: + /** + * Constructor. + */ + Server(const std::string &address, int port, int threadCount); + + /** + * Informational. + */ + std::string getAddress() const { return m_address;} + int getPort() const { return m_port;} + int getThreadCount() const { return m_threadCount;} + + RunStatus getStatus() const { + return m_status; + } + void setStatus(RunStatus status) { + m_status = status; + } + + /** + * Destructor. + */ + virtual ~Server() {} + + /** + * Start this web server. Note this is a non-blocking call. + */ + virtual void start() = 0; + + /** + * Block until web server is stopped. + */ + virtual void waitForEnd() = 0; + + /** + * Gracefully stop this web server. We will stop accepting new connections + * and finish ongoing requests without being interrupted in the middle of + * them. Note this is a non-blocking call and it will return immediately. + * At background, it will eventually make the thread calling start() quit. + */ + virtual void stop() = 0; + + /** + * How many threads are actively working on handling requests. + */ + virtual int getActiveWorker() = 0; + + /** + * This is for TypedServer to specialize a worker class to use. + */ + virtual RequestHandler *createRequestHandler() = 0; + virtual void releaseRequestHandler(RequestHandler *handler) = 0; + virtual void onThreadExit(RequestHandler *handler) = 0; + + /** + * Overwrite for URL blocking. + */ + virtual bool shouldHandle(const std::string &cmd); + +protected: + std::string m_address; + int m_port; + int m_threadCount; + mutable Mutex m_mutex; + +private: + RunStatus m_status; +}; + +/** + * Binding different types together to form a concrete HTTP server that we + * can run. By conforming to their owns interfaces, RequestHandler and + * Server classes should be able to get mixed up and continue to work. + */ +template +class TypedServer : public TServer { +public: + TypedServer(const std::string &address, int port, int threadCount) + : TServer(address, port, threadCount) { + } + + virtual RequestHandler *createRequestHandler() { + return new TRequestHandler(); + } + + virtual void releaseRequestHandler(RequestHandler *handler) { + delete handler; + } + + virtual void onThreadExit(RequestHandler *handler) { + delete handler; + } +}; + +/** + * All exceptions Server throws should derive from this base class. + */ +class ServerException : public Exception { +public: + ServerException(const char *fmt, ...) { + va_list ap; va_start(ap, fmt); format(fmt, ap); va_end(ap); + } +}; + +class FailedToListenException : public ServerException { +public: + FailedToListenException(const std::string &addr, int port) + : ServerException("Failed to listen on %s:%d", addr.c_str(), port) { + } +}; + +class InvalidUrlException : public ServerException { +public: + InvalidUrlException(const char *part) + : ServerException("Invalid URL: %s", part) { + } +}; + +class InvalidMethodException : public ServerException { +public: + InvalidMethodException(const char *msg) + : ServerException("Invalid method: %s", msg) { + } +}; + +class InvalidHeaderException : public ServerException { +public: + InvalidHeaderException(const char *name, const char *value) + : ServerException("Invalid header: %s: %s", name, value) { + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HTTP_SERVER_SERVER_H__ diff --git a/src/cpp/base/server/server_note.cpp b/src/cpp/base/server/server_note.cpp new file mode 100644 index 0000000000000..f1e71c8434684 --- /dev/null +++ b/src/cpp/base/server/server_note.cpp @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static ThreadLocal s_note; + +void ServerNote::Add(CStrRef name, CStrRef value) { + Array &arr = s_note->m_notes; + arr.set(name, value); +} + +String ServerNote::Get(CStrRef name) { + Array &arr = s_note->m_notes; + String ret; + if (arr.exists(name)) { + ret = arr.rvalAt(name); + } + return ret; +} + +void ServerNote::Reset() { + s_note->m_notes.reset(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/server_note.h b/src/cpp/base/server/server_note.h new file mode 100644 index 0000000000000..8f8825e6436cb --- /dev/null +++ b/src/cpp/base/server/server_note.h @@ -0,0 +1,37 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#ifndef __HPHP_SERVER_NOTE_H__ +#define __HPHP_SERVER_NOTE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class ServerNote { +public: + static void Add(CStrRef name, CStrRef value); + static String Get(CStrRef name); + + static void Reset(); +private: + Array m_notes; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_SERVER_NOTE_H__ diff --git a/src/cpp/base/server/server_stats.cpp b/src/cpp/base/server/server_stats.cpp new file mode 100644 index 0000000000000..45615b7dd7f5e --- /dev/null +++ b/src/cpp/base/server/server_stats.cpp @@ -0,0 +1,938 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace boost; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helpers + +void ServerStats::Merge(CounterMap &dest, + const CounterMap &src) { + for (CounterMap::const_iterator iter = src.begin(); + iter != src.end(); ++iter) { + dest[iter->first] += iter->second; + } +} + +void ServerStats::Merge(PageStatsMap &dest, const PageStatsMap &src) { + for (PageStatsMap::const_iterator iter = src.begin(); + iter != src.end(); ++iter) { + const SharedString &key = iter->first; + const PageStats &s = iter->second; + + PageStatsMap::iterator diter = dest.find(key); + if (diter == dest.end()) { + dest[key] = s; + } else { + PageStats &d = diter->second; + ASSERT(d.m_url == s.m_url); + ASSERT(d.m_code == s.m_code); + d.m_hit += s.m_hit; + Merge(d.m_values, s.m_values); + } + } +} + +void ServerStats::Merge(list &dest, const list &src) { + list::iterator diter = dest.begin(); + for (list::const_iterator iter = src.begin(); + iter != src.end(); ++iter) { + TimeSlot *s = *iter; + + for (; diter != dest.end(); ++diter) { + TimeSlot *d = *diter; + if (d->m_time > s->m_time) { + TimeSlot *c = new TimeSlot(); + *c = *s; + dest.insert(diter, c); + break; + } + if (d->m_time == s->m_time) { + Merge(d->m_pages, s->m_pages); + break; + } + } + + if (diter == dest.end()) { + TimeSlot *c = new TimeSlot(); + *c = *s; + dest.insert(diter, c); + diter = dest.end(); + } + } +} + +void ServerStats::GetAllKeys(set &allKeys, + const list &slots) { + for (list::const_iterator iter = slots.begin(); + iter != slots.end(); ++iter) { + TimeSlot *s = *iter; + for (PageStatsMap::const_iterator piter = s->m_pages.begin(); + piter != s->m_pages.end(); ++piter) { + const PageStats &ps = piter->second; + for (CounterMap::const_iterator viter = + ps.m_values.begin(); viter != ps.m_values.end(); ++viter) { + allKeys.insert(viter->first->getString()); + } + } + } + + // special keys + allKeys.insert("hit"); + allKeys.insert("load"); + allKeys.insert("idle"); +} + +void ServerStats::Filter(list &slots, const std::string &keys, + const std::string &url, int code, + map &wantedKeys) { + if (!keys.empty()) { + vector rules0; + Util::split(',', keys.c_str(), rules0, true); + if (!rules0.empty()) { + + // prepare rules + map rules; + for (unsigned int i = 0; i < rules0.size(); i++) { + string &rule = rules0[i]; + ASSERT(!rule.empty()); + int len = rule.length(); + string suffix; + if (len > 4) { + len -= 4; + suffix = rule.substr(len); + } + if (suffix == "/hit") { + rules[rule.substr(0, len)] |= UDF_HIT; + } else if (suffix == "/sec") { + rules[rule.substr(0, len)] |= UDF_SEC; + } else { + rules[rule] |= UDF_NONE; + } + } + + // prepare all keys + set allKeys; + GetAllKeys(allKeys, slots); + + // prepare wantedKeys + for (set::const_iterator iter = allKeys.begin(); + iter != allKeys.end(); ++iter) { + const string &key = *iter; + for (map::const_iterator riter = rules.begin(); + riter != rules.end(); ++riter) { + const string &rule = riter->first; + if (rule[0] == ':') { + Variant ret = preg_match(String(rule), String(key)); + if (!same(ret, false) && more(ret, 0)) { + wantedKeys[key] |= riter->second; + } + } else if (rule == key) { + wantedKeys[key] |= riter->second; + } + } + } + } + } + + bool urlEmpty = url.empty(); + bool keysEmpty = keys.empty(); + for (list::const_iterator iter = slots.begin(); + iter != slots.end(); ++iter) { + TimeSlot *s = *iter; + for (PageStatsMap::iterator piter = s->m_pages.begin(); + piter != s->m_pages.end();) { + PageStats &ps = piter->second; + if ((code && ps.m_code == code) || (!urlEmpty && ps.m_url == url)) { + PageStatsMap::iterator piterTemp = piter; + ++piter; + s->m_pages.erase(piterTemp); + continue; + } + + if (!keysEmpty) { + CounterMap &values = ps.m_values; + for (CounterMap::iterator viter = + values.begin(); viter != values.end();) { + if (wantedKeys.find(viter->first->getString()) == wantedKeys.end()) { + CounterMap::iterator iterTemp = viter; + ++viter; + values.erase(iterTemp); + } else { + ++viter; + } + } + } + ++piter; + } + } +} + +void ServerStats::Aggregate(list &slots, const std::string &agg, + std::map &wantedKeys) { + int slotCount = slots.size(); + + if (!agg.empty()) { + TimeSlot *ts = new TimeSlot(); + ts->m_time = 0; + for (list::const_iterator iter = slots.begin(); + iter != slots.end(); ++iter) { + TimeSlot *s = *iter; + for (PageStatsMap::const_iterator piter = s->m_pages.begin(); + piter != s->m_pages.end(); ++piter) { + const PageStats &ps = piter->second; + string url = ps.m_url; + int code = ps.m_code; + if (agg != "url") { + url.clear(); + } + if (agg != "code") { + code = 0; + } + PageStats &psDest = ts->m_pages[url + lexical_cast(code)]; + psDest.m_hit += ps.m_hit; + psDest.m_url = url; + psDest.m_code = code; + Merge(psDest.m_values, ps.m_values); + } + } + FreeSlots(slots); + slots.push_back(ts); + } + + std::map udfKeys; + for (std::map::const_iterator iter = wantedKeys.begin(); + iter != wantedKeys.end(); ++iter) { + if (iter->second != UDF_NONE) { + udfKeys[iter->first] = iter->second; + } + } + + // Hack: These two are not really page specific. + int load = HttpServer::Server->getPageServer()->getActiveWorker(); + int idle = RuntimeOption::ServerThreadCount - load; + + for (list::const_iterator iter = slots.begin(); + iter != slots.end(); ++iter) { + TimeSlot *s = *iter; + int sec = (s->m_time == 0 ? slotCount : 1) * + RuntimeOption::StatsSlotDuration; + for (PageStatsMap::iterator piter = s->m_pages.begin(); + piter != s->m_pages.end(); ++piter) { + PageStats &ps = piter->second; + CounterMap &values = ps.m_values; + + // special keys + if (wantedKeys.find("hit") != wantedKeys.end()) { + values["hit"] = ps.m_hit; + } + if (wantedKeys.find("load") != wantedKeys.end()) { + values["load"] = load; + } + if (wantedKeys.find("idle") != wantedKeys.end()) { + values["idle"] = idle; + } + + for (map::const_iterator iter = udfKeys.begin(); + iter != udfKeys.end(); ++iter) { + const string &key = iter->first; + int udf = iter->second; + CounterMap::iterator viter = values.find(key); + if (viter != values.end()) { + if ((udf & UDF_HIT) && ps.m_hit) { + values[key + "/hit"] = viter->second * PRECISION / ps.m_hit; + } + if ((udf & UDF_SEC) && sec) { + values[key + "/sec"] = viter->second * PRECISION / sec; + } + if ((wantedKeys[key] & UDF_NONE) == 0) { + values.erase(viter); + } + } + } + } + } +} + +void ServerStats::FreeSlots(list &slots) { + for (list::const_iterator iter = slots.begin(); + iter != slots.end(); ++iter) { + delete *iter; + } + slots.clear(); +} + +/////////////////////////////////////////////////////////////////////////////// +// writers + +class Writer { +public: + Writer(ostream &out) : m_out(out), m_indent(0) {} + virtual ~Writer() {} + + virtual void writeFileHeader() = 0; + virtual void writeFileFooter() = 0; + virtual void writeIndent() = 0; + virtual void writeHeader(const char *name) = 0; + virtual void writeFooter(const char *name) = 0; + virtual void writeEntry(const char *name, const std::string &value) = 0; + virtual void writeEntry(const char *name, int64 value) = 0; + +protected: + ostream &m_out; + int m_indent; +}; + +class XMLWriter : public Writer { +public: + XMLWriter(ostream &out) : Writer(out) {} + + virtual void writeFileHeader() { + m_out << "\n"; + if (!RuntimeOption::StatsXSL.empty()) { + m_out << "\n"; + } else if (!RuntimeOption::StatsXSLProxy.empty()) { + m_out << "\n"; + } + } + + virtual void writeFileFooter() {} + + virtual void writeIndent() { + for (int i = 0; i < m_indent; i++) { + m_out << " "; + } + } + + virtual void writeHeader(const char *name) { + writeIndent(); + m_out << '<' << name << ">\n"; + ++m_indent; + } + + virtual void writeFooter(const char *name) { + --m_indent; + writeIndent(); + m_out << "\n"; + } + + virtual void writeEntry(const char *name, const string &value) { + writeIndent(); + m_out << "" << Escape(name) << ""; + m_out << "" << Escape(value.c_str()) << "\n"; + } + + virtual void writeEntry(const char *name, int64 value) { + writeIndent(); + m_out << "" << Escape(name) << ""; + m_out << "" << value << "\n"; + } + +private: + static std::string Escape(const char *s) { + string ret; + for (const char *p = s; *p; p++) { + switch (*p) { + case '<': ret += "<"; break; + case '&': ret += "&"; break; + default: ret += *p; break; + } + } + return ret; + } +}; + +class JSONWriter : public Writer { +public: + JSONWriter(ostream &out) : Writer(out) {} + + virtual void writeFileHeader() {} + + virtual void writeFileFooter() {} + + virtual void writeIndent() { + for (int i = 0; i < m_indent; i++) { + m_out << " "; + } + } + + virtual void writeHeader(const char *name) { + writeIndent(); + m_out << '"' << name << "\": {\n"; + ++m_indent; + } + + virtual void writeFooter(const char *name) { + --m_indent; + writeIndent(); + m_out << "},\n"; + } + + virtual void writeEntry(const char *name, const string &value) { + writeIndent(); + m_out << '"' << JSON::Escape(name) << "\": \"" << + JSON::Escape(value.c_str()) << "\",\n"; + } + + virtual void writeEntry(const char *name, int64 value) { + writeIndent(); + m_out << '"' << JSON::Escape(name) << "\": " << value << ",\n"; + } +}; + +class HTMLWriter : public Writer { +public: + HTMLWriter(ostream &out) : Writer(out) {} + + virtual void writeFileHeader() { + m_out << "\n\n\n" + "\n" + "\n" + "HPHP Stats\n" + "\n\n\n\n"; + } + + virtual void writeFileFooter() { + m_out << "\n
    \n\n\n"; + } + + virtual void writeIndent() { + for (int i = 0; i < m_indent; i++) { + m_out << " "; + } + } + + virtual void writeHeader(const char *name) { + writeIndent(); + m_out << "" + << "\n"; + ++m_indent; + } + + virtual void writeFooter(const char *name) { + --m_indent; + writeIndent(); + m_out << "
    " << name << "
    \n"; + } + + virtual void writeEntry(const char *name, const string &value) { + writeIndent(); + m_out << "" << Escape(name) << ""; + m_out << "" << Escape(value.c_str()) << "\n"; + } + + virtual void writeEntry(const char *name, int64 value) { + writeIndent(); + m_out << "" << Escape(name) << ""; + m_out << "" << value << "\n"; + } + +private: + static std::string Escape(const char *s) { + string ret; + for (const char *p = s; *p; p++) { + switch (*p) { + case '<': ret += "<"; break; + case '&': ret += "&"; break; + default: ret += *p; break; + } + } + return ret; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// static + +Mutex ServerStats::s_lock; +vector ServerStats::s_loggers; +ThreadLocal ServerStats::s_logger; + +void ServerStats::LogPage(const string &url, int code) { + if (RuntimeOption::EnableStats && RuntimeOption::EnableWebStats) { + ServerStats::s_logger->logPage(url, code); + } +} + +void ServerStats::Log(const string &name, int64 value) { + if (RuntimeOption::EnableStats && RuntimeOption::EnableWebStats) { + ServerStats::s_logger->log(name, value); + } +} + +void ServerStats::LogBytes(int64 bytes) { + if (RuntimeOption::EnableStats && RuntimeOption::EnableWebStats) { + ServerStats::s_logger->logBytes(bytes); + } +} + +void ServerStats::StartRequest(const char *url, const char *clientIP, + const char *vhost) { + if (RuntimeOption::EnableStats && RuntimeOption::EnableWebStats) { + ServerStats::s_logger->startRequest(url, clientIP, vhost); + } +} + +void ServerStats::SetThreadMode(ThreadMode mode) { + ServerStats::s_logger->setThreadMode(mode); +} + +int64 ServerStats::Get(const string &name) { + return ServerStats::s_logger->get(name); +} + +void ServerStats::Clear() { + Lock lock(s_lock, false); + for (unsigned int i = 0; i < s_loggers.size(); i++) { + s_loggers[i]->clear(); + } +} + +void ServerStats::CollectSlots(list &slots, int64 from, int64 to) { + if (from < 0 || to <= 0) { + time_t now = time(NULL); + if (from < 0) from = now + from; + if (to <= 0) to = now + to; + } + + int tp1 = from / RuntimeOption::StatsSlotDuration; + int tp2 = to / RuntimeOption::StatsSlotDuration; + + Lock lock(s_lock, false); + for (unsigned int i = 0; i < s_loggers.size(); i++) { + s_loggers[i]->collect(slots, tp1, tp2); + } +} + +void ServerStats::GetKeys(string &out, int64 from, int64 to) { + list slots; + CollectSlots(slots, from, to); + set allKeys; + GetAllKeys(allKeys, slots); + for (set::const_iterator iter = allKeys.begin(); + iter != allKeys.end(); ++iter) { + out += *iter; + out += "\n"; + } +} + +void ServerStats::Report(string &out, Format format, int64 from, int64 to, + const std::string &agg, const std::string &keys, + const std::string &url, int code, + const std::string &prefix) { + list slots; + CollectSlots(slots, from, to); + map wantedKeys; + Filter(slots, keys, url, code, wantedKeys); + Aggregate(slots, agg, wantedKeys); + Report(out, format, slots, prefix); + FreeSlots(slots); +} + +void ServerStats::Report(string &output, Format format, + const list &slots, + const std::string &prefix) { + ostringstream out; + if (format == KVP) { + bool first = true; + for (list::const_iterator iter = slots.begin(); + iter != slots.end(); ++iter) { + if (first) { + first = false; + } else { + out << ",\n"; + } + TimeSlot *s = *iter; + if (s->m_time) { + out << s->m_time << ": "; + } + out << "{"; + for (PageStatsMap::const_iterator piter = s->m_pages.begin(); + piter != s->m_pages.end(); ++piter) { + const PageStats &ps = piter->second; + string key = prefix; + if (!ps.m_url.empty()) { + key += ps.m_url; + } + if (ps.m_code) { + key += "$"; + key += lexical_cast(ps.m_code); + } + if (!key.empty()) { + key += "."; + } + bool firstKey = true; + for (CounterMap::const_iterator viter = + ps.m_values.begin(); viter != ps.m_values.end(); ++viter) { + if (firstKey) { + firstKey = false; + } else { + out << ", "; + } + out << '"' << JSON::Escape((key + viter->first->getString()).c_str()) + << "\": " << viter->second; + } + } + out << "}\n"; + } + + } else { + Writer *w; + if (format == XML) { + w = new XMLWriter(out); + } else if (format == HTML) { + w = new HTMLWriter(out); + } else { + ASSERT(format == JSON); + w = new JSONWriter(out); + } + + w->writeFileHeader(); + w->writeHeader("stats"); + for (list::const_iterator iter = slots.begin(); + iter != slots.end(); ++iter) { + TimeSlot *s = *iter; + if (s->m_time) { + w->writeHeader("slot"); + w->writeEntry("time", s->m_time * RuntimeOption::StatsSlotDuration); + } + w->writeHeader("pages"); + for (PageStatsMap::const_iterator piter = s->m_pages.begin(); + piter != s->m_pages.end(); ++piter) { + const PageStats &ps = piter->second; + w->writeHeader("page"); + w->writeEntry("url", ps.m_url); + w->writeEntry("code", ps.m_code); + w->writeEntry("hit", ps.m_hit); + + w->writeHeader("details"); + for (CounterMap::const_iterator viter = + ps.m_values.begin(); viter != ps.m_values.end(); ++viter) { + w->writeEntry(viter->first->getString().c_str(), viter->second); + } + w->writeFooter("details"); + + w->writeFooter("page"); + } + w->writeFooter("pages"); + if (s->m_time) { + w->writeFooter("slot"); + } + } + w->writeFooter("stats"); + w->writeFileFooter(); + + delete w; + } + + output = out.str(); +} + +static std::string format_duration(int64 duration) { + string ret; + if (duration > 0) { + int seconds = duration % 60; + int minutes = duration / 60; + int hours = minutes / 60; + minutes = minutes % 60; + if (hours) { + ret += lexical_cast(hours) + " hour"; + ret += (hours == 1) ? " " : "s "; + } + if (minutes || (hours && seconds)) { + ret += lexical_cast(minutes) + " minute"; + ret += (minutes == 1) ? " " : "s "; + } + if (seconds || minutes || hours) { + ret += lexical_cast(seconds) + " second"; + ret += (seconds == 1) ? "" : "s"; + } + } else if (duration == 0) { + ret = "0 seconds"; + } + return ret; +} + +void ServerStats::ReportStatus(std::string &output, Format format) { + ostringstream out; + Writer *w; + if (format == XML) { + w = new XMLWriter(out); + } else if (format == HTML) { + w = new HTMLWriter(out); + } else { + ASSERT(format == JSON); + w = new JSONWriter(out); + } + + time_t now = time(0); + + w->writeFileHeader(); + w->writeHeader("status"); + + w->writeHeader("process"); + w->writeEntry("id", (int64)Process::GetProcessId()); + w->writeEntry("build", RuntimeOption::BuildId); + +#ifdef DEBUG + w->writeEntry("debug", "yes"); +#else + w->writeEntry("debug", "no"); +#endif + +#ifdef HOTPROFILER + w->writeEntry("hotprofiler", "yes"); +#else + w->writeEntry("hotprofiler", "no"); +#endif + + w->writeEntry("now", DateTime(now). + toString(DateTime::DateFormatCookie).data()); + w->writeEntry("start", DateTime(HttpServer::StartTime). + toString(DateTime::DateFormatCookie).data()); + w->writeEntry("up", format_duration(now - HttpServer::StartTime)); + w->writeFooter("process"); + + w->writeHeader("threads"); + for (unsigned int i = 0; i < s_loggers.size(); i++) { + ThreadStatus &ts = s_loggers[i]->m_threadStatus; + + int64 duration = 0; + if (ts.m_done > ts.m_start) { + duration = ts.m_done - ts.m_start; + } + + const char *mode = "(unknown)"; + switch (ts.m_mode) { + case Idling: mode = "idle"; break; + case Processing: mode = "process"; break; + case Writing: mode = "writing"; break; + case PostProcessing: mode = "psp"; break; + default: ASSERT(false); + } + + w->writeHeader("thread"); + w->writeEntry("id", (int64)ts.m_threadId); + w->writeEntry("req", ts.m_requestCount); + w->writeEntry("bytes", ts.m_writeBytes); + w->writeEntry("start", DateTime(ts.m_start). + toString(DateTime::DateFormatCookie).data()); + w->writeEntry("duration", format_duration(duration)); + w->writeEntry("mode", mode); + w->writeEntry("url", ts.m_url); + w->writeEntry("client", ts.m_clientIP); + w->writeEntry("vhost", ts.m_vhost); + w->writeFooter("thread"); + } + w->writeFooter("threads"); + w->writeFooter("status"); + w->writeFileFooter(); + + delete w; + output = out.str(); +} + +/////////////////////////////////////////////////////////////////////////////// + +ServerStats::ThreadStatus::ThreadStatus() + : m_requestCount(0), m_writeBytes(0), m_start(0), m_done(0), m_mode(Idling) { + m_threadId = Process::GetThreadId(); + memset(m_url, 0, sizeof(m_url)); + memset(m_clientIP, 0, sizeof(m_clientIP)); + memset(m_vhost, 0, sizeof(m_vhost)); +} + +ServerStats::ServerStats() : m_last(0), m_min(0), m_max(0) { + m_slots.resize(RuntimeOption::StatsMaxSlot); + clear(); + + Lock lock(s_lock, false); + s_loggers.push_back(this); +} + +ServerStats::~ServerStats() { + clear(); +} + +void ServerStats::log(const string &name, int64 value) { + m_values[name] += value; +} + +int64 ServerStats::get(const std::string &name) { + CounterMap::const_iterator iter = m_values.find(name); + if (iter != m_values.end()) { + return iter->second; + } + return 0; +} + +void ServerStats::logPage(const string &url, int code) { + int64 now = time(NULL) / RuntimeOption::StatsSlotDuration; + int slot = now % RuntimeOption::StatsMaxSlot; + + { + Lock lock(m_lock, false); + int count = 0; + for (int64 t = m_last + 1; t < now; t++) { + m_slots[t % RuntimeOption::StatsMaxSlot].m_time = 0; + if (++count > RuntimeOption::StatsMaxSlot) { + break; // we have cleared all slots, good enough + } + } + TimeSlot &ts = m_slots[slot]; + if (ts.m_time != now) { + if (ts.m_time && m_min <= ts.m_time) { + m_min = ts.m_time + 1; + } + ts.m_time = now; + ts.m_pages.clear(); + } + PageStats &ps = ts.m_pages[url + lexical_cast(code)]; + ps.m_url = url; + ps.m_code = code; + ps.m_hit++; + Merge(ps.m_values, m_values); + } + + m_values.clear(); + m_last = now; + if (m_min == 0) { + m_min = now; + } + if (m_max < now) { + m_max = now; + } + + m_threadStatus.m_mode = Idling; + m_threadStatus.m_done = time(0); +} + +void ServerStats::clear() { + Lock lock(m_lock, false); + for (unsigned int i = 0; i < m_slots.size(); i++) { + m_slots[i].m_time = 0; + } +} + +void ServerStats::collect(std::list &slots, int64 from, int64 to) { + if (from > to) { + int64 tmp = from; + from = to; + to = tmp; + } + if (from < m_min) from = m_min; + if (to > m_max) to = m_max; + + Lock lock(m_lock, false); + list collected; + for (int64 t = from; t <= to; t++) { + int slot = t % RuntimeOption::StatsMaxSlot; + if (m_slots[slot].m_time == t) { + collected.push_back(&m_slots[slot]); + } + } + Merge(slots, collected); +} + +void ServerStats::logBytes(int64 bytes) { + m_threadStatus.m_writeBytes += bytes; +} + +static void safe_copy(char *dest, const char *src, int max) { + int len = strlen(src) + 1; + dest[--max] = '\0'; + strncpy(dest, src, len > max ? max : len); +} + +void ServerStats::startRequest(const char *url, const char *clientIP, + const char *vhost) { + ++m_threadStatus.m_requestCount; + m_threadStatus.m_start = time(0); + m_threadStatus.m_done = 0; + m_threadStatus.m_mode = Processing; + + safe_copy(m_threadStatus.m_url, url, sizeof(m_threadStatus.m_url)); + safe_copy(m_threadStatus.m_clientIP, clientIP, + sizeof(m_threadStatus.m_clientIP)); + safe_copy(m_threadStatus.m_vhost, vhost, sizeof(m_threadStatus.m_vhost)); +} + +void ServerStats::setThreadMode(ThreadMode mode) { + m_threadStatus.m_mode = mode; +} + +/////////////////////////////////////////////////////////////////////////////// + +ServerStatsHelper::ServerStatsHelper(const char *section, + bool trackMem /* = false */) + : m_section(section), m_trackMemory(trackMem) { + if (RuntimeOption::EnableStats && RuntimeOption::EnableWebStats) { + clock_gettime(CLOCK_MONOTONIC, &m_wallStart); + clock_gettime(CLOCK_THREAD_CPUTIME_ID, &m_cpuStart); + } +} + +ServerStatsHelper::~ServerStatsHelper() { + if (RuntimeOption::EnableStats && RuntimeOption::EnableWebStats) { + timespec wallEnd, cpuEnd; + clock_gettime(CLOCK_MONOTONIC, &wallEnd); + clock_gettime(CLOCK_THREAD_CPUTIME_ID, &cpuEnd); + + logTime("page.wall.", m_wallStart, wallEnd); + logTime("page.cpu.", m_cpuStart, cpuEnd); + + if (m_trackMemory) { + MemoryManager *mm = MemoryManager::TheMemoryManager().get(); + int64 mem = mm->getStats().peakUsage; + ServerStats::Log(string("mem.") + m_section, mem); + } + } +} + +void ServerStatsHelper::logTime(const std::string &prefix, + const timespec &start, const timespec &end) { + time_t dsec = end.tv_sec - start.tv_sec; + long dnsec = end.tv_nsec - start.tv_nsec; + int64 dusec = dsec * 1000000 + dnsec / 1000; + ServerStats::Log(prefix + m_section, dusec); +} + +/////////////////////////////////////////////////////////////////////////////// + +void server_stats_log_mutex(const std::string &stack, int64 elapsed_us) { + char buf[128]; + snprintf(buf, sizeof(buf), "mutex.%s.", stack.c_str()); + ServerStats::Log(string(buf) + "hit", 1); + ServerStats::Log(string(buf) + "time", elapsed_us); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/server_stats.h b/src/cpp/base/server/server_stats.h new file mode 100644 index 0000000000000..0af1a680de928 --- /dev/null +++ b/src/cpp/base/server/server_stats.h @@ -0,0 +1,181 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SERVER_STATS_H__ +#define __HPHP_SERVER_STATS_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class ServerStats { +public: + enum Format { + XML, + JSON, + KVP, + HTML, + }; + + enum ThreadMode { + Idling, + Processing, + Writing, + PostProcessing + }; + +public: + static void Log(const std::string &name, int64 value); + static int64 Get(const std::string &name); + static void LogPage(const std::string &url, int code); + static void Clear(); + static void GetKeys(std::string &out, int64 from, int64 to); + static void Report(std::string &out, Format format, int64 from, int64 to, + const std::string &agg, const std::string &keys, + const std::string &url, int code, + const std::string &prefix); + + // thread status functions + static void LogBytes(int64 bytes); + static void StartRequest(const char *url, const char *clientIP, + const char *vhost); + static void SetThreadMode(ThreadMode mode); + static void ReportStatus(std::string &out, Format format); + +public: + ServerStats(); + ~ServerStats(); + +private: + enum UDF { + UDF_NONE = 1, // count + UDF_HIT = 2, // count per hit + UDF_SEC = 4, // count per second + + PRECISION = 1000, + }; + + static Mutex s_lock; + static std::vector s_loggers; + static ThreadLocal s_logger; + + typedef hphp_shared_string_map CounterMap; + + struct PageStats { + std::string m_url; // which page + int m_code; // response code + int m_hit; // page hits + CounterMap m_values; // name value pairs + }; + typedef hphp_shared_string_map PageStatsMap; + struct TimeSlot { + int64 m_time; + PageStatsMap m_pages; + }; + + static void Merge(CounterMap &dest, + const CounterMap &src); + static void Merge(PageStatsMap &dest, const PageStatsMap &src); + static void Merge(std::list &dest, + const std::list &src); + static void Filter(std::list &slots, const std::string &keys, + const std::string &url, int code, + std::map &wantedKeys); + static void Aggregate(std::list &slots, const std::string &agg, + std::map &wantedKeys); + + static void CollectSlots(std::list &slots, int64 from, int64 to); + static void FreeSlots(std::list &slots); + + static void GetAllKeys(std::set &allKeys, + const std::list &slots); + static void Report(std::string &out, Format format, + const std::list &slots, + const std::string &prefix); + + Mutex m_lock; + std::vector m_slots; + int64 m_last; // previous timepoint + int64 m_min; // earliest timepoint + int64 m_max; // latest timepoint + CounterMap m_values; // current page's name value pairs + + void log(const std::string &name, int64 value); + int64 get(const std::string &name); + void logPage(const std::string &url, int code); + void clear(); + void collect(std::list &slots, int64 from, int64 to); + + /** + * Live status, instead of historical statistics. + */ + void logBytes(int64 bytes); + void startRequest(const char *url, const char *clientIP, const char *vhost); + void setThreadMode(ThreadMode mode); + + class ThreadStatus { + public: + ThreadStatus(); + + pthread_t m_threadId; + + // total traffic + int64 m_requestCount; + int64 m_writeBytes; + + // current request + time_t m_start; + time_t m_done; + ThreadMode m_mode; + char m_url[1024]; + char m_clientIP[256]; + char m_vhost[256]; + }; + ThreadStatus m_threadStatus; +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Taking server stats at different time point of execution. + */ +class ServerStatsHelper { +public: + ServerStatsHelper(const char *section, bool trackMem = false); + ~ServerStatsHelper(); + +private: + const char *m_section; + timespec m_wallStart; + timespec m_cpuStart; + bool m_trackMemory; + + void logTime(const std::string &prefix, const timespec &start, + const timespec &end); +}; + +/** + * For profiling mutexes. + */ +void server_stats_log_mutex(const std::string &stack, int64 elapsed_us); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_SERVER_STATS_H__ diff --git a/src/cpp/base/server/service_thread.cpp b/src/cpp/base/server/service_thread.cpp new file mode 100644 index 0000000000000..0705dd8970020 --- /dev/null +++ b/src/cpp/base/server/service_thread.cpp @@ -0,0 +1,73 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// statics + +static ThreadLocalProxy s_service_threads; + +ServiceThread *ServiceThread::GetThisThread() { + return s_service_threads.get(); +} + +/////////////////////////////////////////////////////////////////////////////// + +ServiceThread::ServiceThread(const std::string &url) : + AsyncFunc(this, &ServiceThread::threadRun), + m_started(false), m_url(url) { +} + +void ServiceThread::threadRun() { + Logger::Info("Service thread %s started", m_url.c_str()); + s_service_threads.set(this); + + Hdf hdf; + hdf["get"] = 1; + hdf["url"] = m_url; + hdf["remote_host"] = RuntimeOption::ServerIP; + + ReplayTransport rt; + rt.replayInput(hdf); + HttpRequestHandler handler; + handler.disablePathTranslation(); + handler.handleRequest(&rt); + + Logger::Info("Service thread %s stopped", m_url.c_str()); +} + +void ServiceThread::waitForStarted() { + Lock lock(this); + while (!m_started) { + wait(); + } +} + +void ServiceThread::notifyStarted() { + Lock lock(this); + m_started = true; + notify(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/service_thread.h b/src/cpp/base/server/service_thread.h new file mode 100644 index 0000000000000..69f7407d471cc --- /dev/null +++ b/src/cpp/base/server/service_thread.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __SERVICE_THREAD_H__ +#define __SERVICE_THREAD_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ServiceThread); +class ServiceThread : public AsyncFunc, public Synchronizable { +public: + static ServiceThread *GetThisThread(); + +public: + ServiceThread(const std::string &url); + + void threadRun(); + void waitForStarted(); + void notifyStarted(); + +private: + bool m_started; + std::string m_url; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __SERVICE_THREAD_H__ diff --git a/src/cpp/base/server/source_root_info.cpp b/src/cpp/base/server/source_root_info.cpp new file mode 100644 index 0000000000000..34d447a4df430 --- /dev/null +++ b/src/cpp/base/server/source_root_info.cpp @@ -0,0 +1,160 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +SourceRootInfo::SourceRootInfo(const char *host) + : m_sandboxOn(RuntimeOption::SandboxMode) { + if (!m_sandboxOn) return; + Variant matches; + Variant r = preg_match(RuntimeOption::SandboxPattern, host, matches); + if (!r.same(1)) { + m_sandboxOn = false; + return; + } + Array pair = StringUtil::Explode(matches.rvalAt(1), "-", 2); + m_user = pair.rvalAt(0).toString(); + String homePath = String(RuntimeOption::SandboxHome) + "/" + m_user + "/"; + { + struct stat hstat; + if (stat(homePath.c_str(), &hstat) != 0) { + m_sandboxOn = false; + return; + } + } + bool defaultSb = pair.size() == 1; + if (defaultSb) { + m_sandbox = "default"; + } else { + m_sandbox = pair.rvalAt(1).toString(); + } + + string confpath = string(homePath.c_str()) + + RuntimeOption::SandboxConfFile; + Hdf config; + String sp, lp, alp; + try { + config.open(confpath); + Hdf sboxConf = config[m_sandbox.c_str()]; + if (sboxConf.exists()) { + sp = sboxConf["path"].get(); + lp = sboxConf["log"].get(); + alp = sboxConf["accesslog"].get(); + } + } catch (HdfException &e) { + } + if (defaultSb) { + if (sp.isNull()) { + sp = "www/"; + } + if (lp.isNull()) { + lp = "hphp.log"; + } + if (alp.isNull()) { + alp = "hphp-access.log"; + } + } + if (sp.isNull()) { + m_sandboxOn = false; + return; + } + if (sp.charAt(0) == '/') { + m_path = sp; + } else { + m_path = homePath + sp; + } + if (m_path.charAt(m_path.size() - 1) != '/') { + m_path += "/"; + } + if (!lp.isNull()) { + if (lp.charAt(0) != '/') { + lp = homePath + lp; + } + if (!Logger::SetThreadLog(lp.c_str())) { + Logger::Warning("Sandbox error log %s could not be opened", + lp.c_str()); + } + } + if (!alp.isNull()) { + if (alp.charAt(0) != '/') { + alp = homePath + alp; + } + if (!HttpRequestHandler::GetAccessLog().setThreadLog(alp.c_str())) { + Logger::Warning("Sandbox access log %s could not be opened", + alp.c_str()); + } + } +} + +SourceRootInfo::~SourceRootInfo() { + if (m_sandboxOn) { + Logger::ClearThreadLog(); + HttpRequestHandler::GetAccessLog().clearThreadLog(); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void SourceRootInfo::setServerVariables(Variant &server) const { + if (!m_sandboxOn) return; + for (map::const_iterator it = + RuntimeOption::SandboxServerVariables.begin(); + it != RuntimeOption::SandboxServerVariables.end(); ++it) { + server.set(String(it->first), + String(parseSandboxServerVariable(it->second))); + } +} + +string SourceRootInfo::parseSandboxServerVariable(const string &format) const { + ostringstream res; + bool control = false; + for (uint i = 0; i < format.size(); i++) { + char c = format[i]; + if (control) { + switch (c) { + case 'p': res << m_path; break; + case 's': res << m_sandbox; break; + case 'u': res << m_user; break; + default: res << c; break; + } + control = false; + } else if (c == '%') { + control = true; + } else { + res << c; + } + } + return res.str(); +} + +string SourceRootInfo::path() const { + if (m_sandboxOn) { + return string(m_path.data(), m_path.size()); + } else { + return RuntimeOption::SourceRoot; + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/source_root_info.h b/src/cpp/base/server/source_root_info.h new file mode 100644 index 0000000000000..30bca411dd76a --- /dev/null +++ b/src/cpp/base/server/source_root_info.h @@ -0,0 +1,56 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SOURCE_ROOT_INFO_H__ +#define __HPHP_SOURCE_ROOT_INFO_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class SourceRootInfo { +public: + SourceRootInfo(const char *host); + ~SourceRootInfo(); + + void setServerVariables(Variant &server) const; + std::string path() const; + + bool sandboxOn() const { + return m_sandboxOn; + } + + void clear() { + m_user.reset(); + m_sandbox.reset(); + m_path.reset(); + } + +private: + String m_user; + String m_sandbox; + String m_path; + bool m_sandboxOn; + + std::string parseSandboxServerVariable(const std::string &format) const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_SOURCE_ROOT_INFO_H__ diff --git a/src/cpp/base/server/static_content_cache.cpp b/src/cpp/base/server/static_content_cache.cpp new file mode 100644 index 0000000000000..26f1370c98501 --- /dev/null +++ b/src/cpp/base/server/static_content_cache.cpp @@ -0,0 +1,134 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +StaticContentCache StaticContentCache::TheCache; +FileCachePtr StaticContentCache::TheFileCache; + +StaticContentCache::StaticContentCache() : m_totalSize(0) { +} + +void StaticContentCache::load() { + Timer timer(Timer::WallTime, "loading static content"); + + if (!RuntimeOption::FileCache.empty()) { + TheFileCache = FileCachePtr(new FileCache()); + TheFileCache->load(RuntimeOption::FileCache.c_str()); + Logger::Info("loaded file cache from %s", + RuntimeOption::FileCache.c_str()); + return; + } + + int rootSize = RuntimeOption::SourceRoot.size(); + if (rootSize == 0) return; + + // get a list of all files, one for each extension + Logger::Info("searching all files under source root..."); + int count = 0; + map > ext2files; + { + const char *argv[] = {"", (char*)RuntimeOption::SourceRoot.c_str(), + "-type", "f", NULL}; + string files; + vector out; + Process::Exec("find", argv, NULL, files); + Util::split('\n', files.c_str(), out, true); + for (unsigned int i = 0; i < out.size(); i++) { + const string &name = out[i]; + size_t pos = name.rfind('.'); + if (pos != string::npos) { + ext2files[name.substr(pos+1)].push_back(name); + ++count; + } + } + } + + Logger::Info("analyzing %d files under source root...", count); + for (map::const_iterator iter = + RuntimeOption::StaticFileExtensions.begin(); + iter != RuntimeOption::StaticFileExtensions.end(); ++iter) { + if (ext2files.find(iter->first) == ext2files.end()) { + continue; + } + const vector &out = ext2files[iter->first]; + + int total = 0; + for (unsigned int i = 0; i < out.size(); i++) { + ResourceFilePtr f(new ResourceFile()); + + StringBufferPtr sb(new StringBuffer(out[i].c_str())); + if (sb->valid() && sb->size() > 0) { + string url = out[i].substr(rootSize + 1); + f->file = sb; + m_files[url] = f; + + // prepare gzipped content, skipping image and swf files + if (iter->second.find("image/") != 0 && iter->first != "swf") { + int len = sb->size(); + char *data = gzencode(sb->data(), len, 9, CODING_GZIP); + if (data) { + if (len < sb->size()) { + f->compressed = StringBufferPtr(new StringBuffer(data, len)); + } else { + free(data); + } + } + } + + total += sb->size(); + } + } + Logger::Info("..loaded %d bytes of %s files", total, iter->first.c_str()); + m_totalSize += total; + } + Logger::Info("loaded %d bytes of static content in total", m_totalSize); +} + +bool StaticContentCache::find(const std::string &name, const char *&data, + int &len, bool &compressed) const { + if (TheFileCache) { + return data = TheFileCache->read(name.c_str(), len, compressed); + } + + StringToResourceFilePtrMap::const_iterator iter = m_files.find(name); + if (iter != m_files.end()) { + if (compressed && iter->second->compressed) { + data = iter->second->compressed->data(); + len = iter->second->compressed->size(); + } else { + compressed = false; + data = iter->second->file->data(); + len = iter->second->file->size(); + } + return true; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/static_content_cache.h b/src/cpp/base/server/static_content_cache.h new file mode 100644 index 0000000000000..4cbb66aff106c --- /dev/null +++ b/src/cpp/base/server/static_content_cache.h @@ -0,0 +1,60 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __STATIC_CONTENT_CACHE_H__ +#define __STATIC_CONTENT_CACHE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class StaticContentCache { +public: + static StaticContentCache TheCache; + static FileCachePtr TheFileCache; + +public: + StaticContentCache(); + + /** + * Load all registered static files from RuntimeOption::DocumentRoot. + */ + void load(); + + /** + * Find a file from cache. + */ + bool find(const std::string &name, const char *&data, int &len, + bool &compressed) const; + +private: + int m_totalSize; + + struct ResourceFile { + StringBufferPtr file; + StringBufferPtr compressed; + }; + DECLARE_BOOST_TYPES(ResourceFile); + + StringToResourceFilePtrMap m_files; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __STATIC_CONTENT_CACHE_H__ diff --git a/src/cpp/base/server/transport.cpp b/src/cpp/base/server/transport.cpp new file mode 100644 index 0000000000000..2925f563e9c65 --- /dev/null +++ b/src/cpp/base/server/transport.cpp @@ -0,0 +1,594 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Transport::Transport() + : m_url(NULL), m_postData(NULL), m_postDataParsed(false), + m_chunkedEncoding(false), m_headerSent(false), + m_responseCode(-1), m_responseSize(0), m_sendContentType(true), + m_compression(true), m_compressor(NULL) { +} + +Transport::~Transport() { + if (m_url) { + free(m_url); + } + if (m_postData) { + free(m_postData); + } + if (m_compressor) { + delete m_compressor; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// url + +const char *Transport::getServerObject() { + const char *url = getUrl(); + const char *p = strstr(url, "//"); + if (!p) return url; + + p = strchr(p + 2, '/'); + if (p) return p; + + return ""; +} + +string Transport::getCommand() { + const char *url = getServerObject(); + ASSERT(url); + if (!*url) { + return ""; + } + + if (*url == '/') { + ++url; + } + char *v = strchr(url, '?'); + if (v) { + return string(url, v - url); + } + return url; +} + +/////////////////////////////////////////////////////////////////////////////// +// parameters + +// copied and re-factored from clearsilver-0.10.5/cgi/cgi.c +void Transport::urlUnescape(char *value) { + ASSERT(value && *value); // check before calling this function + + int i = 0, o = 0; + unsigned char *s = (unsigned char *)value; + + while (s[i]) { + if (s[i] == '+') { + s[o++] = ' '; + i++; + } else if (s[i] == '%' && isxdigit(s[i+1]) && isxdigit(s[i+2])) { + char num; + num = (s[i+1] >= 'A') ? ((s[i+1] & 0xdf) - 'A') + 10 : (s[i+1] - '0'); + num *= 16; + num += (s[i+2] >= 'A') ? ((s[i+2] & 0xdf) - 'A') + 10 : (s[i+2] - '0'); + s[o++] = num; + i+=3; + } else { + s[o++] = s[i++]; + } + } + if (i && o) s[o] = '\0'; +} + +void Transport::parseQuery(char *query, ParamMap ¶ms) { + if (!query || !*query) return; + + char *l; + char *k = strtok_r(query, "&", &l); + while (k && *k) { + char *v = strchr(k, '='); + const char *fv; + if (v == NULL) { + fv = ""; + } else { + *v = '\0'; + v++; + if (*v) urlUnescape(v); + fv = v; + } + if (*k) urlUnescape(k); + params[k].push_back(fv); + k = strtok_r(NULL, "&", &l); + } +} + +void Transport::parseGetParams() { + ASSERT(m_url == NULL); + const char *url = getServerObject(); + ASSERT(url); + + const char *p = strchr(url, '?'); + if (p) { + m_url = strdup(p + 1); + } else { + m_url = strdup(""); + } + + parseQuery(m_url, m_getParams); +} + +void Transport::parsePostParams() { + ASSERT(!m_postDataParsed); + ASSERT(m_postData == NULL); + int size; + const char *data = (const char *)getPostData(size); + if (data && *data && size) { + // Post data may be binary, but if parsePostParams() is called, it is + // correct to handle it as a null-terminated string + m_postData = strdup(data); + parseQuery(m_postData, m_postParams); + } + m_postDataParsed = true; +} + +bool Transport::paramExists(const char *name, Method method /* = GET */) { + ASSERT(name && *name); + + if (method == GET || method == AUTO) { + if (m_url == NULL) { + parseGetParams(); + } + if (m_getParams.find(name) != m_getParams.end()) { + return true; + } + } + + if (method == POST || method == AUTO) { + if (m_postDataParsed) { + parsePostParams(); + } + if (m_postParams.find(name) != m_postParams.end()) { + return true; + } + } + + return false; +} + +std::string Transport::getParam(const char *name, Method method /* = GET */) { + ASSERT(name && *name); + + if (method == GET || method == AUTO) { + if (m_url == NULL) { + parseGetParams(); + } + ParamMap::const_iterator iter = m_getParams.find(name); + if (iter != m_getParams.end()) { + return iter->second[0]; + } + } + + if (method == POST || method == AUTO) { + if (m_postDataParsed) { + parsePostParams(); + } + ParamMap::const_iterator iter = m_postParams.find(name); + if (iter != m_postParams.end()) { + return iter->second[0]; + } + } + + return ""; +} + +int Transport::getIntParam(const char *name, Method method /* = GET */) { + std::string param = getParam(name, method); + if (param.empty()) { + return 0; + } + return atoi(param.c_str()); +} + +long long Transport::getInt64Param(const char *name, + Method method /* = GET */) { + std::string param = getParam(name, method); + if (param.empty()) { + return 0; + } + return atoll(param.c_str()); +} + +void Transport::getArrayParam(const char *name, + std::vector &values, + Method method /* = GET */) { + if (method == GET || method == AUTO) { + if (m_url == NULL) { + parseGetParams(); + } + ParamMap::const_iterator iter = m_getParams.find(name); + if (iter != m_getParams.end()) { + const vector ¶ms = iter->second; + values.insert(values.end(), params.begin(), params.end()); + } + } + + if (method == POST || method == AUTO) { + if (m_postDataParsed) { + parsePostParams(); + } + ParamMap::const_iterator iter = m_postParams.find(name); + if (iter != m_postParams.end()) { + const vector ¶ms = iter->second; + values.insert(values.end(), params.begin(), params.end()); + } + } +} + +void Transport::getSplitParam(const char *name, + std::vector &values, + char delimiter, Method method /* = GET */) { + std::string param = getParam(name, method); + if (!param.empty()) { + Util::split(delimiter, param.c_str(), values); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// headers + +bool Transport::splitHeader(CStrRef header, String &name, const char *&value) { + int pos = header.find(':'); + if (pos != String::npos && header.charAt(pos + 1) == ' ') { + name = header.substr(0, pos); + value = header.data() + pos + 2; + return true; + } + + // header("HTTP/1.0 404 Not Found"); + // header("HTTP/1.0 404"); + if (strncasecmp(header.data(), "http/", 5) == 0) { + int pos1 = header.find(' '); + if (pos1 != String::npos) { + int pos2 = header.find(' ', pos1 + 1); + if (pos2 == String::npos) pos2 = header.size(); + if (pos2 - pos1 > 1) { + setResponse(atoi(header.data() + pos1)); + return false; + } + } + } + + throw InvalidArgumentException("header", header.c_str()); +} + +void Transport::addHeader(const char *name, const char *value) { + ASSERT(name && *name); + ASSERT(value); + + string svalue = value; + Util::replaceAll(svalue, "\n", ""); + m_responseHeaders[name].push_back(svalue); + + if (strcasecmp(name, "Location") == 0) { + setResponse(302); + } +} + +void Transport::addHeader(CStrRef header) { + String name; + const char *value; + if (splitHeader(header, name, value)) { + addHeader(name.data(), value); + } +} + +void Transport::replaceHeader(const char *name, const char *value) { + ASSERT(name && *name); + ASSERT(value); + m_responseHeaders[name].clear(); + addHeader(name, value); +} + +void Transport::replaceHeader(CStrRef header) { + String name; + const char *value; + if (splitHeader(header, name, value)) { + replaceHeader(name.data(), value); + } +} + +void Transport::getResponseHeaders(HeaderMap &headers) { + headers = m_responseHeaders; + + vector &cookies = headers["Set-Cookie"]; + for (CookieMap::const_iterator iter = m_responseCookies.begin(); + iter != m_responseCookies.end(); ++iter) { + cookies.push_back(iter->second); + } +} + +bool Transport::acceptEncoding(const char *encoding) { + ASSERT(encoding && *encoding); + string header = getHeader("Accept-Encoding"); + + // This is testing a substring than a word match, but in practice, this + // always works. + return header.find(encoding) != string::npos; +} + +std::string Transport::getHTTPVersion() const { + return "1.1"; +} + +/////////////////////////////////////////////////////////////////////////////// +// cookies + +bool Transport::setCookie(CStrRef name, CStrRef value, int expire /* = 0 */, + CStrRef path /* = "" */, CStrRef domain /* = "" */, + bool secure /* = false */, + bool httponly /* = false */, + bool encode_url /* = true */) { + if (!name.empty() && strpbrk(name.data(), "=,; \t\r\n\013\014")) { + Logger::Warning("Cookie names can not contain any of the folllowing " + "'=,; \\t\\r\\n\\013\\014' (%s)", name.data()); + return false; + } + + if (!encode_url && + !value.empty() && strpbrk(value.data(), ",; \t\r\n\013\014")) { + Logger::Warning("Cookie values can not contain any of the folllowing " + "',; \\t\\r\\n\\013\\014' (%s)", value.data()); + return false; + } + + char *encoded_value = NULL; + int len = 0; + if (!value.empty() && encode_url) { + int encoded_value_len = value.size(); + encoded_value = url_encode(value.data(), encoded_value_len); + len += encoded_value_len; + } else if (!value.empty()) { + encoded_value = strdup(value.data()); + len += value.size(); + } + len += path.size(); + len += domain.size(); + + char *cookie = (char*)calloc(len + 100, 1); + String deleter(cookie, 1, AttachString); + if (value.empty()) { + /* + * MSIE doesn't delete a cookie when you set it to a null value + * so in order to force cookies to be deleted, even on MSIE, we + * pick an expiry date 1 year and 1 second in the past + */ + String sdt = DateTime(time(NULL) - 31536001, true) + .toString(DateTime::Cookie); + snprintf(cookie, len + 100, "%s=deleted; expires=%s", + name.data(), sdt.data()); + } else { + snprintf(cookie, len + 100, "%s=%s", + name.data(), encoded_value ? encoded_value : ""); + if (expire > 0) { + strncat(cookie, "; expires=", len + 100); + String sdt = DateTime(expire, true).toString(DateTime::Cookie); + strncat(cookie, sdt.data(), len + 100); + } + } + + if (encoded_value) { + free(encoded_value); + } + + if (!path.empty()) { + strncat(cookie, "; path=", len + 100); + strncat(cookie, path.data(), len + 100); + } + if (!domain.empty()) { + strncat(cookie, "; domain=", len + 100); + strncat(cookie, domain.data(), len + 100); + } + if (secure) { + strncat(cookie, "; secure", len + 100); + } + if (httponly) { + strncat(cookie, "; httponly", len + 100); + } + + m_responseCookies[name.data()] = cookie; + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +void Transport::prepareHeaders(bool compressed) { + for (HeaderMap::const_iterator iter = m_responseHeaders.begin(); + iter != m_responseHeaders.end(); ++iter) { + const vector &values = iter->second; + for (unsigned int i = 0; i < values.size(); i++) { + addHeaderImpl(iter->first.c_str(), values[i].c_str()); + } + } + + for (CookieMap::const_iterator iter = m_responseCookies.begin(); + iter != m_responseCookies.end(); ++iter) { + addHeaderImpl("Set-Cookie", iter->second.c_str()); + } + + if (compressed) { + addHeaderImpl("Content-Encoding", "gzip"); + removeHeaderImpl("Content-Length"); + removeHeaderImpl("Content-MD5"); + } + + if (m_responseHeaders.find("Content-Type") == m_responseHeaders.end()) { + addHeaderImpl("Content-Type", "text/html; charset=utf-8"); + } + + // shutting down servers, so need to terminate all Keep-Alive connections + if (!RuntimeOption::EnableKeepAlive || isServerStopping()) { + addHeaderImpl("Connection", "close"); + removeHeaderImpl("Keep-Alive"); + + // so lower level transports can ignore incoming "Connection: keep-alive" + removeRequestHeaderImpl("Connection"); + } +} + +String Transport::prepareResponse(const void *data, int size, bool &compressed, + bool last) { + String response((const char *)data, size, AttachLiteral); + + // we don't use chunk encoding to send anything pre-compressed + ASSERT(!compressed || !m_chunkedEncoding); + + if (compressed || !isCompressionEnabled() || !acceptEncoding("gzip")) { + return response; + } + + // There isn't that much need to gzip response, when it can fit into one + // Ethernet packet (1500 bytes), unless we are doing chunked encoding, + // where we don't really know if next chunk will benefit from compresseion. + if (m_chunkedEncoding || size > 1000) { + if (m_compressor == NULL) { + m_compressor = new StreamCompressor(RuntimeOption::GzipCompressionLevel, + CODING_GZIP, true); + } + int len = size; + char *compressedData = m_compressor->compress((const char*)data, len, last); + if (compressedData) { + String deleter(compressedData, len, AttachString); + if (m_chunkedEncoding || len < size) { + response = deleter; + compressed = true; + } + } else { + Logger::Error("Unable to compress response: level=%d len=%d", + RuntimeOption::GzipCompressionLevel, len); + } + } + + return response; +} + +void Transport::sendRaw(void *data, int size, int code /* = 200 */, + bool compressed /* = false */, + bool chunked /* = false */) { + ASSERT(data || size == 0); + ASSERT(size >= 0); + + if (!compressed && RuntimeOption::ForceChunkedEncoding) { + chunked = true; + } + if (m_chunkedEncoding) { + chunked = true; + ASSERT(!compressed); + } else if (chunked) { + m_chunkedEncoding = true; + ASSERT(!compressed); + } + + // I don't think there is any need to send an empty chunk, other than sending + // out headers earlier, which seems to be a useless feature. + if (chunked && size == 0) { + return; + } + + // compression handling + ServerStatsHelper ssh("send"); + String response = prepareResponse(data, size, compressed, !chunked); + + // HTTP header handling + if (!m_headerSent) { + prepareHeaders(compressed); + m_headerSent = true; + } + + m_responseSize += response.size(); + if (m_responseCode < 0) { + m_responseCode = code; + } + ServerStats::SetThreadMode(ServerStats::Writing); + sendImpl(response.data(), response.size(), m_responseCode, chunked); + ServerStats::SetThreadMode(ServerStats::Processing); + + ServerStats::LogBytes(size); + if (RuntimeOption::EnableStats && RuntimeOption::EnableWebStats) { + ServerStats::Log("network.uncompressed", size); + ServerStats::Log("network.compressed", response.size()); + } +} + +void Transport::onSendEnd() { + if (m_compressor && m_chunkedEncoding) { + bool compressed = false; + String response = prepareResponse("", 0, compressed, true); + sendImpl(response.data(), response.size(), m_responseCode, true); + } + onSendEndImpl(); +} + +void Transport::redirect(const char *location, int code /* = 302 */) { + addHeaderImpl("Location", location); + setResponse(code); + sendString(location, code); +} + +/////////////////////////////////////////////////////////////////////////////// +// support rfc1867 + +bool Transport::isUploadedFile(CStrRef filename) { + return is_uploaded_file(filename.c_str()); +} + +// Move a file if and only if it was created by an upload +bool Transport::moveUploadedFile(CStrRef filename, CStrRef destination) { + if (!is_uploaded_file(filename.c_str())) { + Logger::Error("%s is not an uploaded file.", filename.c_str()); + return false; + } + // Do access check. + String dest = File::TranslatePath(destination); + if (Util::rename(filename.c_str(), dest.c_str()) < 0) { + Logger::Error("Unable to move uploaded file %s to %s: %s.", + filename.c_str(), dest.c_str(), + Util::safe_strerror(errno).c_str()); + return false; + } + Logger::Verbose("Successfully moved uploaded file %s to %s.", + filename.c_str(), dest.c_str()); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/transport.h b/src/cpp/base/server/transport.h new file mode 100644 index 0000000000000..64e9984fdb71e --- /dev/null +++ b/src/cpp/base/server/transport.h @@ -0,0 +1,309 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HTTP_SERVER_TRANSPORT_H__ +#define __HTTP_SERVER_TRANSPORT_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * For storing headers and cookies. + */ +typedef std::map, stdltistr> HeaderMap; +typedef std::map CookieMap; + +/** + * A class defining an interface that request handler can use to query + * transport related information. + * + * Note that one transport object is created for each request, and + * one transport is ONLY accessed from one single thread. + */ +class Transport { +public: + enum Method { + UnknownMethod, + + GET, + POST, + HEAD, + AUTO, // check GET parameter first, then POST + }; + + // TODO: add all status codes + // (http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) + enum StatusCode { + UnknownStatusCode, + + // Success + OK = 200, + + // Redirection + MOVED_PERMANENTLY = 301, + + // Client Error + BAD_REQUEST = 400, + FORBIDDEN = 403, + NOT_FOUND = 404, + + // Server Error + INTERNAL_SERVER_ERROR = 500, + SERVICE_UNAVAILABLE = 503, + }; + +public: + Transport(); + virtual ~Transport(); + + /////////////////////////////////////////////////////////////////////////// + // Functions sub-classes have to implement. + + /** + * Request URI. + */ + virtual const char *getUrl() = 0; + virtual const char *getRemoteHost() = 0; + + /** + * POST request's data. + */ + virtual const void *getPostData(int &size) = 0; + + /** + * Is this a GET, POST or anything? + */ + virtual Method getMethod() = 0; + virtual const char *getExtendedMethod() { return NULL;} + + /** + * What version of HTTP was the request? + */ + virtual std::string getHTTPVersion() const; + + /** + * Get request header(s). + */ + virtual std::string getHeader(const char *name) = 0; + virtual void getHeaders(HeaderMap &headers) = 0; + + /** + * Get/set response headers. + */ + void addHeader(const char *name, const char *value); + void addHeader(CStrRef header); + void replaceHeader(const char *name, const char *value); + void replaceHeader(CStrRef header); + void getResponseHeaders(HeaderMap &headers); + + /** + * Content/MIME type related functions. + */ + void setMimeType(CStrRef mimeType) { m_mimeType = mimeType.data();} + String getMimeType() { return String(m_mimeType);} + const char *getDefaultContentType() { return "text/html";} + bool sendDefaultContentType() { return m_sendContentType;} + void setDefaultContentType(bool send) { m_sendContentType = send;} + + /** + * Can we gzip response? + */ + void enableCompression() { m_compression = true;} + void disableCompression() { m_compression = false;} + bool isCompressionEnabled() const { return m_compression;} + + /** + * Set cookie response header. + */ + bool setCookie(CStrRef name, CStrRef value, int expire = 0, + CStrRef path = "", CStrRef domain = "", bool secure = false, + bool httponly = false, bool encode_url = true); + + /** + * Add/remove a response header. + */ + virtual void addHeaderImpl(const char *name, const char *value) = 0; + virtual void removeHeaderImpl(const char *name) = 0; + + /** + * Add/remove a request header. Default is no-op, because not all transports + * need to support incoming request header manipulations. + */ + virtual void addRequestHeaderImpl(const char *name, const char *value) {} + virtual void removeRequestHeaderImpl(const char *name) {} + + /** + * Called when all sending should be done by this time point. Designed for + * sending last chunk of response for chunked encoding. + */ + void onSendEnd(); + + /** + * Send back a response with specified code. + * Caller deletes data, callee must copy + */ + virtual void sendImpl(const void *data, int size, int code, + bool chunked) = 0; + + /** + * Override to implement more send end logic. + */ + virtual void onSendEndImpl() {} + + /** + * Need this implementation to break keep-alive connections. + */ + virtual bool isServerStopping() { return false;} + + /////////////////////////////////////////////////////////////////////////// + // Pre-implemented utitlity functions. + + /** + * We define a "server object" as the part of URL without domain name: + * + * http://facebook.com/foo?x=1 server object is "foo?x=1" + * http://facebook.com/foo/bar?x=1 server object is "foo/bar?x=1" + */ + const char *getServerObject(); + + /** + * We define a "command" as the part of URL without parameters: + * + * /foo?x=1 command is "foo" + * foo?x=1 command is "foo" + * foo/bar?x=1 command is "foo/bar" + * /foo/bar?x=1 command is "foo/bar" + */ + std::string getCommand(); + + /** + * Whether a parameter exists. Normally this is not needed to know, unless + * "null" is different from an empty string or 0. + */ + bool paramExists(const char *name, Method method = GET); + + /** + * Get value of a parameter. Returns empty string is not present. + */ + std::string getParam(const char *name, Method method = GET); + + /** + * Turn a string parameter into an integer. + */ + int getIntParam(const char *name, Method method = GET); + + /** + * Turn a string parameter into a 64-bit number. + */ + long long getInt64Param(const char *name, Method method = GET); + + /** + * Collect multiple string parameters with the same name into "values". + * + * /foo?x=1&x=2&x=3 + */ + void getArrayParam(const char *name, std::vector &values, + Method method = GET); + + /** + * Split a string parameter into multiple sub-strings. + * + * /foo?x=1:2:3 + */ + void getSplitParam(const char *name, std::vector &values, + char delimiter, Method method = GET); + + /** + * Test whether client accepts a certain encoding. + */ + bool acceptEncoding(const char *encoding); + + /** + * Sending back a response. + */ + void setResponse(int code) { m_responseCode = code;} + bool headersSent() { return m_headerSent;} + virtual void sendRaw(void *data, int size, int code = 200, bool compressed = false, + bool chunked = false); + void sendString(const char *data, int code = 200, bool compressed = false, + bool chunked = false) { + sendRaw((void*)data, strlen(data), code, compressed, chunked); + } + void sendString(const std::string &data, int code = 200, + bool compressed = false, bool chunked = false) { + sendRaw((void*)data.c_str(), data.length(), code, compressed, chunked); + } + void redirect(const char *location, int code = 302); + + // TODO: support rfc1867 + bool isUploadedFile(CStrRef filename); + bool moveUploadedFile(CStrRef filename, CStrRef destination); + + int getResponseSize() const { return m_responseSize; } + int getResponseCode() const { return m_responseCode; } + +protected: + /** + * Parameter parsing in this class is done by making just one copy of the + * entire query (either URL or post data), then insert termintaing NULLs + * at end of tokens (name and value), url decode in-place and then store + * token's start char * addresses in ParamMaps. Therefore, this entire + * process is very efficient without excessive string copying. + */ + typedef __gnu_cxx::hash_map, + __gnu_cxx::hash, eqstr> ParamMap; + + // input + char *m_url; + char *m_postData; + bool m_postDataParsed; + ParamMap m_getParams; + ParamMap m_postParams; + + // output + bool m_chunkedEncoding; + bool m_headerSent; + int m_responseCode; + HeaderMap m_responseHeaders; + CookieMap m_responseCookies; + int m_responseSize; + + std::string m_mimeType; + bool m_sendContentType; + bool m_compression; + StreamCompressor *m_compressor; + + // helpers + void parseGetParams(); + void parsePostParams(); + static void parseQuery(char *query, ParamMap ¶ms); + static void urlUnescape(char *value); + bool splitHeader(CStrRef header, String &name, const char *&value); + + void prepareHeaders(bool compressed); + String prepareResponse(const void *data, int size, bool &compressed, + bool last); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HTTP_SERVER_TRANSPORT_H__ diff --git a/src/cpp/base/server/upload.cpp b/src/cpp/base/server/upload.cpp new file mode 100644 index 0000000000000..df7ed72d2b763 --- /dev/null +++ b/src/cpp/base/server/upload.cpp @@ -0,0 +1,1130 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static void destroy_uploaded_files(); + +class Rfc1867Data : public RequestEventHandler { +public: + std::set rfc1867ProtectedVariables; + std::set rfc1867UploadedFiles; + int (*rfc1867Callback)(unsigned int event, void *event_data, void **extra); + virtual void requestInit() { + rfc1867Callback = NULL; + } + virtual void requestShutdown() { + if (!rfc1867UploadedFiles.empty()) destroy_uploaded_files(); + } +}; +static RequestLocal s_rfc1867_data; + +/* + * This product includes software developed by the Apache Group + * for use in the Apache HTTP server project (http://www.apache.org/). + * + */ + +static void safe_php_register_variable(char *var, CVarRef val, + Variant &track_vars_array, + bool override_protection); + +#define FAILURE -1 + +/* The longest property name we use in an uploaded file array */ +#define MAX_SIZE_OF_INDEX sizeof("[tmp_name]") + +/* The longest anonymous name */ +#define MAX_SIZE_ANONNAME 33 + +/* Errors */ +#define UPLOAD_ERROR_OK 0 /* File upload succesful */ +#define UPLOAD_ERROR_A 1 /* Uploaded file exceeded upload_max_filesize */ +#define UPLOAD_ERROR_B 2 /* Uploaded file exceeded MAX_FILE_SIZE */ +#define UPLOAD_ERROR_C 3 /* Partially uploaded */ +#define UPLOAD_ERROR_D 4 /* No file uploaded */ +#define UPLOAD_ERROR_E 6 /* Missing /tmp or similar directory */ +#define UPLOAD_ERROR_F 7 /* Failed to write file to disk */ +#define UPLOAD_ERROR_X 8 /* File upload stopped by extension */ + +static void normalize_protected_variable(char *varname) { + char *s=varname, *index=NULL, *indexend=NULL, *p; + + /* overjump leading space */ + while (*s == ' ') { + s++; + } + + /* and remove it */ + if (s != varname) { + memmove(varname, s, strlen(s)+1); + } + + for (p=varname; *p && *p != '['; p++) { + switch(*p) { + case ' ': + case '.': + *p='_'; + break; + } + } + + /* find index */ + index = strchr(varname, '['); + if (index) { + index++; + s=index; + } else { + return; + } + + /* done? */ + while (index) { + + while (*index == ' ' || *index == '\r' || + *index == '\n' || *index=='\t') { + index++; + } + indexend = strchr(index, ']'); + indexend = indexend ? indexend + 1 : index + strlen(index); + + if (s != index) { + memmove(s, index, strlen(index)+1); + s += indexend-index; + } else { + s = indexend; + } + + if (*s == '[') { + s++; + index = s; + } else { + index = NULL; + } + } + *s++='\0'; +} + + +static void add_protected_variable(char *varname) { + normalize_protected_variable(varname); + s_rfc1867_data->rfc1867ProtectedVariables.insert(varname); +} + + +static bool is_protected_variable(char *varname) { + normalize_protected_variable(varname); + set::iterator iter = + s_rfc1867_data->rfc1867ProtectedVariables.find(varname); + return iter != s_rfc1867_data->rfc1867ProtectedVariables.end(); +} + + +static void safe_php_register_variable(char *var, CVarRef val, + Variant &track_vars_array, + bool override_protection) { + if (override_protection || !is_protected_variable(var)) { + register_variable(track_vars_array, var, val); + } +} + +bool is_uploaded_file(const string filename) { + set &rfc1867UploadedFiles = s_rfc1867_data->rfc1867UploadedFiles; + return rfc1867UploadedFiles.find(filename) != rfc1867UploadedFiles.end(); +} + +static void destroy_uploaded_files() { + set &rfc1867UploadedFiles = s_rfc1867_data->rfc1867UploadedFiles; + for (set::iterator iter = rfc1867UploadedFiles.begin(); + iter != rfc1867UploadedFiles.end(); iter++) { + unlink(iter->c_str()); + } + rfc1867UploadedFiles.clear(); +} + + +/* + * Following code is based on apache_multipart_buffer.c from + * libapreq-0.33 package. + * + */ + +#define FILLUNIT (1024 * 5) + +typedef struct { + + /* read buffer */ + char *buffer; + char *buf_begin; + int bufsize; + int bytes_in_buffer; + + /* boundary info */ + char *boundary; + char *boundary_next; + int boundary_next_len; + + /* post data */ + const char *post_data; + int post_size; + char *cursor; + int read_post_bytes; +} multipart_buffer; + +typedef std::list > header_list; + +static int read_post(multipart_buffer *self, char *buf, int bytes_to_read) { + int bytes_remaining = self->post_size - (self->cursor - self->post_data); + if (bytes_to_read > bytes_remaining) bytes_to_read = bytes_remaining; + memcpy(buf, self->cursor, bytes_to_read); + self->cursor += bytes_to_read; + return bytes_to_read; +} + + +/* + fill up the buffer with client data. + returns number of bytes added to buffer. +*/ +static int fill_buffer(multipart_buffer *self) { + int bytes_to_read, total_read = 0, actual_read = 0; + + /* shift the existing data if necessary */ + if (self->bytes_in_buffer > 0 && self->buf_begin != self->buffer) { + memmove(self->buffer, self->buf_begin, self->bytes_in_buffer); + } + + self->buf_begin = self->buffer; + + /* calculate the free space in the buffer */ + bytes_to_read = self->bufsize - self->bytes_in_buffer; + + /* read the required number of bytes */ + while (bytes_to_read > 0) { + + char *buf = self->buffer + self->bytes_in_buffer; + + actual_read = read_post(self, buf, bytes_to_read); + + /* update the buffer length */ + if (actual_read > 0) { + self->bytes_in_buffer += actual_read; + self->read_post_bytes += actual_read; + total_read += actual_read; + bytes_to_read -= actual_read; + } else { + break; + } + } + + return total_read; +} + + +/* eof if we are out of bytes, or if we hit the final boundary */ +static int multipart_buffer_eof(multipart_buffer *self) { + if ( (self->bytes_in_buffer == 0 && fill_buffer(self) < 1) ) { + return 1; + } else { + return 0; + } +} + + +/* create new multipart_buffer structure */ +static multipart_buffer *multipart_buffer_new(const char *data, int size, + string boundary) { + multipart_buffer *self = + (multipart_buffer *)calloc(1, sizeof(multipart_buffer)); + + int minsize = boundary.length() + 6; + if (minsize < FILLUNIT) minsize = FILLUNIT; + + self->buffer = (char *) calloc(1, minsize + 1); + self->bufsize = minsize; + + vspprintf(&self->boundary, 0, "--%s", boundary.c_str()); + + self->boundary_next_len = + vspprintf(&self->boundary_next, 0, "\n--%s", boundary.c_str()); + + self->buf_begin = self->buffer; + self->bytes_in_buffer = 0; + + self->post_data = data; + self->cursor = (char*)self->post_data; + self->post_size = size; + return self; +} + + +/* + gets the next CRLF terminated line from the input buffer. + if it doesn't find a CRLF, and the buffer isn't completely full, returns + NULL; otherwise, returns the beginning of the null-terminated line, + minus the CRLF. + + note that we really just look for LF terminated lines. this works + around a bug in internet explorer for the macintosh which sends mime + boundaries that are only LF terminated when you use an image submit + button in a multipart/form-data form. + */ +static char *next_line(multipart_buffer *self) { + /* look for LF in the data */ + char* line = self->buf_begin; + char* ptr = (char*)memchr(self->buf_begin, '\n', self->bytes_in_buffer); + + if (ptr) { /* LF found */ + + /* terminate the string, remove CRLF */ + if ((ptr - line) > 0 && *(ptr-1) == '\r') { + *(ptr-1) = 0; + } else { + *ptr = 0; + } + + /* bump the pointer */ + self->buf_begin = ptr + 1; + self->bytes_in_buffer -= (self->buf_begin - line); + + } else { /* no LF found */ + + /* buffer isn't completely full, fail */ + if (self->bytes_in_buffer < self->bufsize) { + return NULL; + } + /* return entire buffer as a partial line */ + line[self->bufsize] = 0; + self->buf_begin = ptr; + self->bytes_in_buffer = 0; + } + + return line; +} + + +/* returns the next CRLF terminated line from the client */ +static char *get_line(multipart_buffer *self) { + char* ptr = next_line(self); + + if (!ptr) { + fill_buffer(self); + ptr = next_line(self); + } + + return ptr; +} + + +/* finds a boundary */ +static int find_boundary(multipart_buffer *self, char *boundary) { + char *line; + + /* loop thru lines */ + while( (line = get_line(self)) ) + { + /* finished if we found the boundary */ + if (!strcmp(line, boundary)) { + return 1; + } + } + + /* didn't find the boundary */ + return 0; +} + + +/* parse headers */ +static int multipart_buffer_headers(multipart_buffer *self, + header_list &header) { + char *line; + std::pair prev_entry; + std::pair entry; + + /* didn't find boundary, abort */ + if (!find_boundary(self, self->boundary)) { + return 0; + } + + /* get lines of text, or CRLF_CRLF */ + + while( (line = get_line(self)) && strlen(line) > 0 ) + { + /* add header to table */ + + char *key = line; + char *value = NULL; + + /* space in the beginning means same header */ + if (!isspace(line[0])) { + value = strchr(line, ':'); + } + + if (value) { + *value = 0; + do { value++; } while(isspace(*value)); + entry = std::pair(key, value); + } else if (!header.empty()) { + /* If no ':' on the line, add to previous line */ + entry = std::pair + (prev_entry.first, prev_entry.second + line); + header.pop_back(); + } else { + continue; + } + + header.push_back(entry); + prev_entry = entry; + } + + return 1; +} + + +static char *php_mime_get_hdr_value(header_list &header, char *key) { + if (key == NULL) return NULL; + for (header_list::iterator iter = header.begin(); + iter != header.end(); iter++) { + if (!strcasecmp(iter->first.c_str(), key)) { + return (char *)iter->second.c_str(); + } + } + return NULL; +} + + +static char *php_ap_getword(char **line, char stop) { + char *pos = *line, quote; + char *res; + + while (*pos && *pos != stop) { + + if ((quote = *pos) == '"' || quote == '\'') { + ++pos; + while (*pos && *pos != quote) { + if (*pos == '\\' && pos[1] && pos[1] == quote) { + pos += 2; + } else { + ++pos; + } + } + if (*pos) { + ++pos; + } + } else ++pos; + + } + if (*pos == '\0') { + res = strdup(*line); + *line += strlen(*line); + return res; + } + + res = (char*)malloc(pos - *line + 1); + memcpy(res, *line, pos - *line); + res[pos - *line] = 0; + while (*pos == stop) { + ++pos; + } + + *line = pos; + return res; +} + + +static char *substring_conf(char *start, int len, char quote) { + char *result = (char *)malloc(len + 2); + char *resp = result; + int i; + + for (i = 0; i < len; ++i) { + if (start[i] == '\\' && + (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) { + *resp++ = start[++i]; + } else { + *resp++ = start[i]; + } + } + + *resp++ = '\0'; + return result; +} + + +static char *php_ap_getword_conf(char **line) { + char *str = *line, *strend, *res, quote; + + while (*str && isspace(*str)) { + ++str; + } + + if (!*str) { + *line = str; + return strdup(""); + } + + if ((quote = *str) == '"' || quote == '\'') { + strend = str + 1; +look_for_quote: + while (*strend && *strend != quote) { + if (*strend == '\\' && strend[1] && strend[1] == quote) { + strend += 2; + } else { + ++strend; + } + } + if (*strend && *strend == quote) { + char p = *(strend + 1); + if (p != '\r' && p != '\n' && p != '\0') { + strend++; + goto look_for_quote; + } + } + + res = substring_conf(str + 1, strend - str - 1, quote); + + if (*strend == quote) { + ++strend; + } + + } else { + + strend = str; + while (*strend && !isspace(*strend)) { + ++strend; + } + res = substring_conf(str, strend - str, 0); + } + + while (*strend && isspace(*strend)) { + ++strend; + } + + *line = strend; + return res; +} + + +/* + search for a string in a fixed-length byte string. + if partial is true, partial matches are allowed at the end of the buffer. + returns NULL if not found, or a pointer to the start of the first match. +*/ +static char *php_ap_memstr(char *haystack, int haystacklen, char *needle, + int needlen, int partial) { + int len = haystacklen; + char *ptr = haystack; + + /* iterate through first character matches */ + while( (ptr = (char *)memchr(ptr, needle[0], len)) ) { + + /* calculate length after match */ + len = haystacklen - (ptr - (char *)haystack); + + /* done if matches up to capacity of buffer */ + if (memcmp(needle, ptr, needlen < len ? needlen : len) == 0 && + (partial || len >= needlen)) { + break; + } + + /* next character */ + ptr++; len--; + } + + return ptr; +} + + +/* read until a boundary condition */ +static int multipart_buffer_read(multipart_buffer *self, char *buf, + int bytes, int *end) { + int len, max; + char *bound; + + /* fill buffer if needed */ + if (bytes > self->bytes_in_buffer) { + fill_buffer(self); + } + + /* look for a potential boundary match, only read data up to that point */ + if ((bound = + php_ap_memstr(self->buf_begin, self->bytes_in_buffer, + self->boundary_next, self->boundary_next_len, 1))) { + max = bound - self->buf_begin; + if (end && + php_ap_memstr(self->buf_begin, self->bytes_in_buffer, + self->boundary_next, self->boundary_next_len, 0)) { + *end = 1; + } + } else { + max = self->bytes_in_buffer; + } + + /* maximum number of bytes we are reading */ + len = max < bytes-1 ? max : bytes-1; + + /* if we read any data... */ + if (len > 0) { + + /* copy the data */ + memcpy(buf, self->buf_begin, len); + buf[len] = 0; + + if (bound && len > 0 && buf[len-1] == '\r') { + buf[--len] = 0; + } + + /* update the buffer */ + self->bytes_in_buffer -= len; + self->buf_begin += len; + } + + return len; +} + + +/* + 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, + unsigned int *len) { + char buf[FILLUNIT], *out=NULL; + int total_bytes=0, read_bytes=0; + + while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL))) { + out = (char *)realloc(out, total_bytes + read_bytes + 1); + memcpy(out + total_bytes, buf, read_bytes); + total_bytes += read_bytes; + } + + if (out) out[total_bytes] = '\0'; + *len = total_bytes; + + return out; +} + + +/* + * The combined READER/HANDLER + * + */ + +void rfc1867PostHandler(Variant &post, Variant &files, int content_length, + const char *data, int size, const string boundary) { + char *s=NULL, *start_arr=NULL; + string array_index, abuf; + char *temp_filename=NULL, *lbuf=NULL; + int total_bytes=0, cancel_upload=0, is_arr_upload=0, array_len=0; + int max_file_size=0, skip_upload=0, anonindex=0, is_anonymous; + set &uploaded_files = s_rfc1867_data->rfc1867UploadedFiles; + multipart_buffer *mbuff; + int fd=-1; + void *event_extra_data = NULL; + unsigned int llen = 0; + + /* Initialize the buffer */ + if (!(mbuff = multipart_buffer_new(data, size, boundary))) { + Logger::Warning("Unable to initialize the input buffer"); + return; + } + + /* Initialize $_FILES[] */ + s_rfc1867_data->rfc1867ProtectedVariables.clear(); + + uploaded_files.clear(); + + int (*php_rfc1867_callback)(unsigned int event, void *event_data, + void **extra) = s_rfc1867_data->rfc1867Callback; + + if (php_rfc1867_callback != NULL) { + multipart_event_start event_start; + + event_start.content_length = content_length; + if (php_rfc1867_callback(MULTIPART_EVENT_START, &event_start, + &event_extra_data) == FAILURE) { + goto fileupload_done; + } + } + + while (!multipart_buffer_eof(mbuff)) + { + char buff[FILLUNIT]; + char *cd=NULL,*param=NULL,*filename=NULL, *tmp=NULL; + size_t blen=0, wlen=0; + off_t offset; + + header_list header; + if (!multipart_buffer_headers(mbuff, header)) { + goto fileupload_done; + } + + if ((cd = php_mime_get_hdr_value(header, "Content-Disposition"))) { + char *pair=NULL; + int end=0; + + while (isspace(*cd)) { + ++cd; + } + + while (*cd && (pair = php_ap_getword(&cd, ';'))) + { + char *key=NULL, *word = pair; + + while (isspace(*cd)) { + ++cd; + } + + if (strchr(pair, '=')) { + key = php_ap_getword(&pair, '='); + + if (!strcasecmp(key, "name")) { + if (param) { + free(param); + } + param = php_ap_getword_conf(&pair); + } else if (!strcasecmp(key, "filename")) { + if (filename) { + free(filename); + } + filename = php_ap_getword_conf(&pair); + } + } + if (key) free(key); + free(word); + } + + /* Normal form variable, safe to read all data into memory */ + if (!filename && param) { + unsigned int value_len; + char *value = multipart_buffer_read_body(mbuff, &value_len); + unsigned int new_val_len; /* Dummy variable */ + + if (!value) { + value = strdup(""); + } + + new_val_len = value_len; + if (php_rfc1867_callback != NULL) { + multipart_event_formdata event_formdata; + size_t newlength = 0; + + event_formdata.post_bytes_processed = mbuff->read_post_bytes; + event_formdata.name = param; + event_formdata.value = &value; + event_formdata.length = new_val_len; + event_formdata.newlength = &newlength; + if (php_rfc1867_callback(MULTIPART_EVENT_FORMDATA, &event_formdata, + &event_extra_data) == FAILURE) { + free(param); + free(value); + continue; + } + new_val_len = newlength; + } + + String val(value, new_val_len, CopyString); + safe_php_register_variable(param, val, post, 0); + + if (!strcasecmp(param, "MAX_FILE_SIZE")) { + max_file_size = atol(value); + } + + free(param); + free(value); + continue; + } + + /* If file_uploads=off, skip the file part */ + if (!RuntimeOption::EnableFileUploads) { + skip_upload = 1; + } + + /* Return with an error if the posted data is garbled */ + if (!param && !filename) { + Logger::Warning("File Upload Mime headers garbled"); + goto fileupload_done; + } + + if (!param) { + is_anonymous = 1; + param = (char*)malloc(MAX_SIZE_ANONNAME); + snprintf(param, MAX_SIZE_ANONNAME, "%u", anonindex++); + } else { + is_anonymous = 0; + } + + /* New Rule: never repair potential malicious user input */ + if (!skip_upload) { + char *tmp = param; + long c = 0; + + while (*tmp) { + if (*tmp == '[') { + c++; + } else if (*tmp == ']') { + c--; + if (tmp[1] && tmp[1] != '[') { + skip_upload = 1; + break; + } + } + if (c < 0) { + skip_upload = 1; + break; + } + tmp++; + } + } + + total_bytes = cancel_upload = 0; + + if (!skip_upload) { + /* Handle file */ + char path[PATH_MAX]; + + // open a temporary file + snprintf(path, sizeof(path), "/tmp/XXXXXX"); + fd = mkstemp(path); + if (fd == -1) { + Logger::Warning("Unable to open temporary file"); + Logger::Warning("File upload error - unable to create a " + "temporary file"); + cancel_upload = UPLOAD_ERROR_E; + } + temp_filename = strdup(path); + } + + if (!skip_upload && php_rfc1867_callback != NULL) { + multipart_event_file_start event_file_start; + + event_file_start.post_bytes_processed = mbuff->read_post_bytes; + event_file_start.name = param; + event_file_start.filename = &filename; + if (php_rfc1867_callback(MULTIPART_EVENT_FILE_START, + &event_file_start, + &event_extra_data) == FAILURE) { + if (temp_filename) { + if (cancel_upload != UPLOAD_ERROR_E) { /* file creation failed */ + close(fd); + unlink(temp_filename); + } + free(temp_filename); + } + temp_filename=""; + free(param); + free(filename); + continue; + } + } + + + if (skip_upload) { + free(param); + free(filename); + continue; + } + + if(strlen(filename) == 0) { + Logger::Verbose("No file uploaded"); + cancel_upload = UPLOAD_ERROR_D; + } + + offset = 0; + end = 0; + while (!cancel_upload && + (blen = multipart_buffer_read(mbuff, buff, sizeof(buff), &end))) + { + if (php_rfc1867_callback != NULL) { + multipart_event_file_data event_file_data; + + event_file_data.post_bytes_processed = mbuff->read_post_bytes; + event_file_data.offset = offset; + event_file_data.data = buff; + event_file_data.length = blen; + event_file_data.newlength = &blen; + if (php_rfc1867_callback(MULTIPART_EVENT_FILE_DATA, + &event_file_data, + &event_extra_data) == FAILURE) { + cancel_upload = UPLOAD_ERROR_X; + continue; + } + } + + + if (RuntimeOption::UploadMaxFileSize > 0 && + total_bytes > RuntimeOption::UploadMaxFileSize) { + Logger::Verbose("upload_max_filesize of %ld bytes exceeded - file " + "[%s=%s] not saved", + RuntimeOption::UploadMaxFileSize, + param, filename); + cancel_upload = UPLOAD_ERROR_A; + } else if (max_file_size && (total_bytes > max_file_size)) { + Logger::Verbose("MAX_FILE_SIZE of %ld bytes exceeded - " + "file [%s=%s] not saved", + max_file_size, param, filename); + cancel_upload = UPLOAD_ERROR_B; + } else if (blen > 0) { + + wlen = write(fd, buff, blen); + + if (wlen < blen) { + Logger::Verbose("Only %d bytes were written, expected to " + "write %d", wlen, blen); + cancel_upload = UPLOAD_ERROR_F; + } else { + total_bytes += wlen; + } + + offset += wlen; + } + } + if (fd!=-1) { /* may not be initialized if file could not be created */ + close(fd); + } + if (!cancel_upload && !end) { + Logger::Verbose("Missing mime boundary at the end of the data for " + "file %s", strlen(filename) > 0 ? filename : ""); + cancel_upload = UPLOAD_ERROR_C; + } + if(strlen(filename) > 0 && total_bytes == 0 && !cancel_upload) { + Logger::Verbose("Uploaded file size 0 - file [%s=%s] not saved", + param, filename); + cancel_upload = 5; + } + + if (php_rfc1867_callback != NULL) { + multipart_event_file_end event_file_end; + + event_file_end.post_bytes_processed = mbuff->read_post_bytes; + event_file_end.temp_filename = temp_filename; + event_file_end.cancel_upload = cancel_upload; + if (php_rfc1867_callback(MULTIPART_EVENT_FILE_END, + &event_file_end, + &event_extra_data) == FAILURE) { + cancel_upload = UPLOAD_ERROR_X; + } + } + + if (cancel_upload) { + if (temp_filename) { + if (cancel_upload != UPLOAD_ERROR_E) { /* file creation failed */ + unlink(temp_filename); + } + free(temp_filename); + } + temp_filename=""; + } else { + s_rfc1867_data->rfc1867UploadedFiles.insert(temp_filename); + } + + /* is_arr_upload is true when name of file upload field + * ends in [.*] + * start_arr is set to point to 1st [ + */ + is_arr_upload = (start_arr = strchr(param,'[')) && + (param[strlen(param)-1] == ']'); + + if (is_arr_upload) { + array_len = strlen(start_arr); + array_index = string(start_arr+1, array_len-2); + } + + /* Add $foo_name */ + if (llen < strlen(param) + MAX_SIZE_OF_INDEX + 1) { + llen = strlen(param); + lbuf = (char *) realloc(lbuf, llen + MAX_SIZE_OF_INDEX + 1); + llen += MAX_SIZE_OF_INDEX + 1; + } + + if (is_arr_upload) { + abuf = string(param, strlen(param)-array_len); + snprintf(lbuf, llen, "%s_name[%s]", + abuf.c_str(), array_index.c_str()); + } else { + snprintf(lbuf, llen, "%s_name", param); + } + + /* The \ check should technically be needed for win32 systems only + * where it is a valid path separator. However, IE in all it's wisdom + * always sends the full path of the file on the user's filesystem, + * which means that unless the user does basename() they get a bogus + * file name. Until IE's user base drops to nill or problem is fixed + * this code must remain enabled for all systems. + */ + s = strrchr(filename, '\\'); + if ((tmp = strrchr(filename, '/')) > s) { + s = tmp; + } + + Variant globals(((Globals*)get_global_variables())->getArrayData()); + if (!is_anonymous) { + if (s && s > filename) { + String val(s+1, strlen(s+1), CopyString); + safe_php_register_variable(lbuf, val, globals, 0); + } else { + String val(filename, strlen(filename), CopyString); + safe_php_register_variable(lbuf, val, globals, 0); + } + } + + /* Add $foo[name] */ + if (is_arr_upload) { + snprintf(lbuf, llen, "%s[name][%s]", + abuf.c_str(), array_index.c_str()); + } else { + snprintf(lbuf, llen, "%s[name]", param); + } + if (s && s > filename) { + String val(s+1, strlen(s+1), CopyString); + safe_php_register_variable(lbuf, val, files, 0); + } else { + String val(filename, strlen(filename), CopyString); + safe_php_register_variable(lbuf, val, files, 0); + } + free(filename); + s = NULL; + + /* Possible Content-Type: */ + if (cancel_upload || + !(cd = php_mime_get_hdr_value(header, "Content-Type"))) { + cd = ""; + } else { + /* fix for Opera 6.01 */ + s = strchr(cd, ';'); + if (s != NULL) { + *s = '\0'; + } + } + + /* Add $foo_type */ + if (is_arr_upload) { + snprintf(lbuf, llen, "%s_type[%s]", + abuf.c_str(), array_index.c_str()); + } else { + snprintf(lbuf, llen, "%s_type", param); + } + if (!is_anonymous) { + String val(cd, strlen(cd), CopyString); + safe_php_register_variable(lbuf, val, globals, 0); + } + + /* Add $foo[type] */ + if (is_arr_upload) { + snprintf(lbuf, llen, "%s[type][%s]", + abuf.c_str(), array_index.c_str()); + } else { + snprintf(lbuf, llen, "%s[type]", param); + } + String val(cd, strlen(cd), CopyString); + safe_php_register_variable(lbuf, val, files, 0); + + /* Restore Content-Type Header */ + if (s != NULL) { + *s = ';'; + } + s = ""; + + /* Initialize variables */ + add_protected_variable(param); + + /* if param is of form xxx[.*] this will cut it to xxx */ + if (!is_anonymous) { + String val(temp_filename, strlen(temp_filename), CopyString); + safe_php_register_variable(param, val, globals, 1); + } + + /* Add $foo[tmp_name] */ + if (is_arr_upload) { + snprintf(lbuf, llen, "%s[tmp_name][%s]", + abuf.c_str(), array_index.c_str()); + } else { + snprintf(lbuf, llen, "%s[tmp_name]", param); + } + add_protected_variable(lbuf); + String tempFileName(temp_filename, strlen(temp_filename), CopyString); + safe_php_register_variable(lbuf, tempFileName, files, 1); + + Variant file_size, error_type; + + error_type = cancel_upload; + + /* Add $foo[error] */ + if (cancel_upload) { + file_size = 0; + } else { + file_size = total_bytes; + } + + if (is_arr_upload) { + snprintf(lbuf, llen, "%s[error][%s]", + abuf.c_str(), array_index.c_str()); + } else { + snprintf(lbuf, llen, "%s[error]", param); + } + safe_php_register_variable(lbuf, error_type, files, 0); + + /* Add $foo_size */ + if (is_arr_upload) { + snprintf(lbuf, llen, "%s_size[%s]", + abuf.c_str(), array_index.c_str()); + } else { + snprintf(lbuf, llen, "%s_size", param); + } + if (!is_anonymous) { + safe_php_register_variable(lbuf, file_size, globals, 0); + } + + /* Add $foo[size] */ + if (is_arr_upload) { + snprintf(lbuf, llen, "%s[size][%s]", + abuf.c_str(), array_index.c_str()); + } else { + snprintf(lbuf, llen, "%s[size]", param); + } + safe_php_register_variable(lbuf, file_size, files, 0); + free(param); + } + } +fileupload_done: + if (php_rfc1867_callback != NULL) { + multipart_event_end event_end; + + event_end.post_bytes_processed = mbuff->read_post_bytes; + php_rfc1867_callback(MULTIPART_EVENT_END, &event_end, &event_extra_data); + } + if (lbuf) free(lbuf); + s_rfc1867_data->rfc1867ProtectedVariables.clear(); + if (mbuff->boundary_next) free(mbuff->boundary_next); + if (mbuff->boundary) free(mbuff->boundary); + if (mbuff->buffer) free(mbuff->buffer); + if (mbuff) free(mbuff); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/upload.h b/src/cpp/base/server/upload.h new file mode 100644 index 0000000000000..e37ff8e556135 --- /dev/null +++ b/src/cpp/base/server/upload.h @@ -0,0 +1,80 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_UPLOAD_H__ +#define __HPHP_UPLOAD_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#define MULTIPART_CONTENT_TYPE "multipart/form-data" +#define MULTIPART_EVENT_START 0 +#define MULTIPART_EVENT_FORMDATA 1 +#define MULTIPART_EVENT_FILE_START 2 +#define MULTIPART_EVENT_FILE_DATA 3 +#define MULTIPART_EVENT_FILE_END 4 +#define MULTIPART_EVENT_END 5 + +class Variant; + +typedef struct _multipart_event_start { + size_t content_length; +} multipart_event_start; + +typedef struct _multipart_event_formdata { + size_t post_bytes_processed; + char *name; + char **value; + size_t length; + size_t *newlength; +} multipart_event_formdata; + +typedef struct _multipart_event_file_start { + size_t post_bytes_processed; + char *name; + char **filename; +} multipart_event_file_start; + +typedef struct _multipart_event_file_data { + size_t post_bytes_processed; + off_t offset; + char *data; + size_t length; + size_t *newlength; +} multipart_event_file_data; + +typedef struct _multipart_event_file_end { + size_t post_bytes_processed; + char *temp_filename; + int cancel_upload; +} multipart_event_file_end; + +typedef struct _multipart_event_end { + size_t post_bytes_processed; +} multipart_event_end; + +void rfc1867PostHandler(Variant &post, Variant &files, int content_length, + const char *data, int size, + const std::string boundary); + +bool is_uploaded_file(const std::string filename); + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __HPHP_UPLOAD_H__ diff --git a/src/cpp/base/server/virtual_host.cpp b/src/cpp/base/server/virtual_host.cpp new file mode 100644 index 0000000000000..e6299cc9f1443 --- /dev/null +++ b/src/cpp/base/server/virtual_host.cpp @@ -0,0 +1,214 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static VirtualHost s_default_vhost; +static ThreadLocalProxy s_current_vhost; + +VirtualHost &VirtualHost::GetDefault() { return s_default_vhost; } + +void VirtualHost::SetCurrent(VirtualHost *vhost) { + s_current_vhost.set(vhost); +} + +const VirtualHost *VirtualHost::GetCurrent() { + VirtualHost *ret = s_current_vhost.get(); + if (ret == NULL) { + ret = &s_default_vhost; + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +std::string format_pattern(const std::string &pattern) { + if (pattern.empty()) return pattern; + + std::string ret = "#"; + for (unsigned int i = 0; i < pattern.size(); i++) { + char ch = pattern[i]; + if (ch == '#') { + ret += "\\#"; + } else { + ret += ch; + } + } + ret += '#'; + return ret; +} + +VirtualHost::VirtualHost() : m_disabled(false) { +} + + +VirtualHost::VirtualHost(Hdf vh) : m_disabled(false) { + init(vh); +} + +void VirtualHost::init(Hdf vh) { + m_name = vh.getName(); + + const char *prefix = vh["Prefix"].get(); + const char *pattern = vh["Pattern"].get(); + const char *pathTranslation = vh["PathTranslation"].get(); + + if (prefix) m_prefix = prefix; + if (pattern) m_pattern = format_pattern(pattern); + if (pathTranslation) { + m_pathTranslation = pathTranslation; + if (!m_pathTranslation.empty() && + m_pathTranslation[m_pathTranslation.length() - 1] != '/') { + m_pathTranslation += '/'; + } + } + m_disabled = vh["Disabled"].getBool(false); + + m_documentRoot = RuntimeOption::SourceRoot + m_pathTranslation; + if (!m_documentRoot.empty() && + m_documentRoot[m_documentRoot.length() - 1] == '/') { + m_documentRoot = m_documentRoot.substr(0, m_documentRoot.length() - 1); + } + + Hdf rewriteRules = vh["RewriteRules"]; + for (Hdf hdf = rewriteRules.firstChild(); hdf.exists(); hdf = hdf.next()) { + RewriteRule dummy; + m_rewriteRules.push_back(dummy); + RewriteRule &rule = m_rewriteRules.back(); + rule.pattern = format_pattern(hdf["pattern"].getString("")); + rule.to = hdf["to"].getString(""); + rule.qsa = hdf["qsa"].getBool(false); + rule.redirect = hdf["redirect"].getInt16(0); + + if (rule.pattern.empty() || rule.to.empty()) { + throw InvalidArgumentException("rewrite rule", "(empty pattern or to)"); + } + Hdf rewriteConds = hdf["Conds"]; + for (Hdf chdf = rewriteConds.firstChild(); chdf.exists(); + chdf = chdf.next()) { + RewriteCond dummy; + rule.rewriteConds.push_back(dummy); + RewriteCond &cond = rule.rewriteConds.back(); + cond.pattern = format_pattern(chdf["pattern"].getString("")); + if (cond.pattern.empty()) { + throw InvalidArgumentException("rewrite rule", "(empty cond pattern)"); + } + const char *type = chdf["type"].get(); + if (type) { + if (strcasecmp(type, "host") == 0) { + cond.type = RewriteCond::Host; + } else if (strcasecmp(type, "request") == 0) { + cond.type = RewriteCond::Request; + } else { + throw InvalidArgumentException("rewrite rule", + "(invalid cond type)"); + } + } else { + cond.type = RewriteCond::Request; + } + cond.negate = chdf["negate"].getBool(false); + } + + } + + if (vh["IpBlockMap"].firstChild().exists()) { + Hdf ipblocks = vh["IpBlockMap"]; + m_ipBlocks = IpBlockMapPtr(new IpBlockMap(ipblocks)); + } + + vh["ServerVariables"].get(m_serverVars); + m_serverName = vh["ServerName"].getString(RuntimeOption::Host); +} + +bool VirtualHost::match(const string &host) const { + if (!m_pattern.empty()) { + Variant ret = preg_match(String(m_pattern.c_str(), m_pattern.size(), + AttachLiteral), + String(host.c_str(), host.size(), + AttachLiteral)); + return ret.toInt64() > 0; + } else if (!m_prefix.empty()) { + return strncmp(host.c_str(), m_prefix.c_str(), m_prefix.size()) == 0; + } + return true; +} + +bool VirtualHost::rewriteURL(CStrRef host, String &url, bool &qsa, + int &redirect) const { + String normalized = url; + if (normalized.empty() || normalized.charAt(0) != '/') { + normalized = String("/") + normalized; + } + + for (unsigned int i = 0; i < m_rewriteRules.size(); i++) { + const RewriteRule &rule = m_rewriteRules[i]; + + bool passed = true; + for (vector::const_iterator it = rule.rewriteConds.begin(); + it != rule.rewriteConds.end(); ++it) { + String subject; + if (it->type == RewriteCond::Request) { + subject = normalized; + } else { + subject = host; + } + Variant ret = preg_match(it->pattern.c_str(), subject); + if (!ret.same(it->negate ? 0 : 1)) { + passed = false; + break; + } + } + if (!passed) continue; + Variant ret; + int count = preg_replace(ret, rule.pattern.c_str(), rule.to.c_str(), + normalized, 1); + if (!same(ret, false) && count > 0) { + url = ret.toString(); + qsa = rule.qsa; + redirect = rule.redirect; + return true; + } + } + return false; +} + +bool VirtualHost::isBlocking(const std::string &command, + const std::string &ip) const { + if (!m_ipBlocks) { + return RuntimeOption::IpBlocks->isBlocking(command, ip); + } + return m_ipBlocks->isBlocking(command, ip); +} + +const std::string &VirtualHost::serverName() const { + if (m_serverName.empty()) { + return RuntimeOption::Host; + } else { + return m_serverName; + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/virtual_host.h b/src/cpp/base/server/virtual_host.h new file mode 100644 index 0000000000000..4f46d14212f35 --- /dev/null +++ b/src/cpp/base/server/virtual_host.h @@ -0,0 +1,91 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __VIRTUAL_HOST_H__ +#define __VIRTUAL_HOST_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(VirtualHost); +class VirtualHost { +public: + static void SetCurrent(VirtualHost *vhost); + static const VirtualHost *GetCurrent(); + +public: + VirtualHost(); + VirtualHost(Hdf vh); + + void init(Hdf vh); + const std::string &getName() const { return m_name;} + + bool valid() const { return !(m_prefix.empty() && m_pattern.empty()); } + bool match(const std::string &host) const; + bool rewriteURL(CStrRef host, String &url, bool &qsa, int &redirect) const; + bool disabled() const { return m_disabled; } + bool isBlocking(const std::string &command, const std::string &ip) const; + + const std::string &getPathTranslation() const { return m_pathTranslation;} + const std::string &getDocumentRoot() const { return m_documentRoot;} + const std::map &getServerVars() const { + return m_serverVars; + } + + static VirtualHost &GetDefault(); + + const std::string &serverName() const; +private: + struct RewriteCond { + enum Type { + Request, + Host + }; + Type type; + std::string pattern; + bool negate; + }; + + struct RewriteRule { + std::string pattern; + std::string to; + bool qsa; // whether to append original query string + int redirect; // redirect status code (301 or 302) or 0 for no redirect + std::vector rewriteConds; + }; + + std::string m_name; + std::string m_serverName; + std::string m_prefix; + std::string m_pattern; + std::vector m_rewriteRules; + IpBlockMapPtr m_ipBlocks; + std::map m_serverVars; + std::string m_pathTranslation; + std::string m_documentRoot; + bool m_disabled; +}; + +std::string format_pattern(const std::string &pattern); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __VIRTUAL_HOST_H__ diff --git a/src/cpp/base/server/xbox_server.cpp b/src/cpp/base/server/xbox_server.cpp new file mode 100644 index 0000000000000..8228adf9935e5 --- /dev/null +++ b/src/cpp/base/server/xbox_server.cpp @@ -0,0 +1,372 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class XboxTransport : public Transport, public Synchronizable { +public: + XboxTransport(CStrRef message) : m_refCount(0), m_done(false), m_code(0) { + m_message.append(message.data(), message.size()); + disableCompression(); // so we don't have to decompress during sendImpl() + } + + /** + * Implementing Transport... + */ + virtual const char *getUrl() { + return RuntimeOption::XboxProcessMessageFunc.c_str(); + } + virtual const char *getRemoteHost() { + return "127.0.0.1"; + } + virtual const void *getPostData(int &size) { + size = m_message.size(); + return m_message.data(); + } + virtual Method getMethod() { + return Transport::POST; + } + virtual std::string getHeader(const char *name) { + return ""; + } + virtual void getHeaders(HeaderMap &headers) { + // do nothing + } + virtual void addHeaderImpl(const char *name, const char *value) { + // do nothing + } + virtual void removeHeaderImpl(const char *name) { + // do nothing + } + virtual void sendImpl(const void *data, int size, int code, + bool compressed) { + ASSERT(!compressed); + m_response.append((const char*)data, size); + if (code) { + m_code = code; + } + } + virtual void onSendEndImpl() { + Lock lock(this); + m_done = true; + notify(); + } + + // task interface + bool isDone() { + return m_done; + } + + String getResults(int &code, int timeout_ms = 0) { + { + Lock lock(this); + while (!m_done) { + if (timeout_ms > 0) { + long long seconds = timeout_ms / 1000; + long long nanosecs = (timeout_ms - seconds * 1000) * 1000; + if (!wait(seconds, nanosecs)) { + code = -1; + return ""; + } + } else { + wait(); + } + } + } + + String response(m_response.c_str(), m_response.size(), CopyString); + code = m_code; + return response; + } + + // ref counting + void incRefCount() { + Lock lock(m_mutex); + ++m_refCount; + } + void decRefCount() { + { + Lock lock(m_mutex); + --m_refCount; + } + if (m_refCount == 0) { + delete this; + } + } + +private: + Mutex m_mutex; + int m_refCount; + + string m_message; + + bool m_done; + string m_response; + int m_code; +}; + +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(XboxServerInfo); +class XboxServerInfo : public SatelliteServerInfo { +public: + XboxServerInfo() : SatelliteServerInfo(Hdf()) { + } + + void reload() { + m_maxRequest = RuntimeOption::XboxServerInfoMaxRequest; + m_maxDuration = RuntimeOption::XboxServerInfoDuration; + m_warmupDoc = RuntimeOption::XboxServerInfoWarmupDoc; + m_reqInitFunc = RuntimeOption::XboxServerInfoReqInitFunc; + } +}; + +static XboxServerInfoPtr s_xbox_server_info; +static ThreadLocal s_rpc_request_handler; +/////////////////////////////////////////////////////////////////////////////// + +class XboxWorker : public JobQueueWorker { +public: + RequestHandler *createRequestHandler() { + s_rpc_request_handler->setServerInfo(s_xbox_server_info); + if (s_rpc_request_handler->needReset() || + s_rpc_request_handler->incRequest() > + s_xbox_server_info->getMaxRequest()) { + s_rpc_request_handler.reset(); + s_rpc_request_handler->setServerInfo(s_xbox_server_info); + s_rpc_request_handler->incRequest(); + } + return s_rpc_request_handler.get(); + } + + virtual void doJob(XboxTransport *job) { + try { + createRequestHandler()->handleRequest(job); + job->decRefCount(); + } catch (...) { + Logger::Error("RpcRequestHandler leaked exceptions"); + } + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +static JobQueueDispatcher *s_dispatcher; + +void XboxServer::Restart() { + if (s_dispatcher) { + s_dispatcher->stop(); + delete s_dispatcher; + s_dispatcher = NULL; + } + + s_xbox_server_info = XboxServerInfoPtr(new XboxServerInfo()); + s_xbox_server_info->reload(); + + if (RuntimeOption::XboxServerThreadCount > 0) { + s_dispatcher = new JobQueueDispatcher + (RuntimeOption::XboxServerThreadCount, NULL); + s_dispatcher->start(); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +static bool isLocalHost(CStrRef host) { + return host.empty() || host == "localhost" || host == "127.0.0.1"; +} + +bool XboxServer::SendMessage(CStrRef message, Variant &ret, int timeout_ms, + CStrRef host /* = "localhost" */) { + if (isLocalHost(host)) { + + if (RuntimeOption::XboxServerThreadCount <= 0) { + return false; + } + + XboxTransport *job = new XboxTransport(message); + job->incRefCount(); // paired with worker's decRefCount() + job->incRefCount(); // paired with decRefCount() at below + ASSERT(s_dispatcher); + s_dispatcher->enqueue(job); + + if (timeout_ms <= 0) { + timeout_ms = RuntimeOption::XboxDefaultLocalTimeoutMilliSeconds; + } + + int code = 0; + String response = job->getResults(code, timeout_ms); + job->decRefCount(); // i'm done with this job + + if (code > 0) { + ret.set("code", code); + if (code == 200) { + ret.set("response", f_json_decode(response)); + } else { + ret.set("error", response); + } + return true; + } + + } else { // remote + + string url = "http://"; + url += host.data(); + url += '/'; + url += RuntimeOption::XboxProcessMessageFunc; + + int timeoutSeconds = timeout_ms / 1000; + if (timeoutSeconds <= 0) { + timeoutSeconds = RuntimeOption::XboxDefaultRemoteTimeoutSeconds; + } + + vector headers; + LibEventHttpClientPtr http = + LibEventHttpClient::Get(url, RuntimeOption::XboxServerPort); + if (http->send(url, headers, timeoutSeconds, false, + message.data(), message.size())) { + int code = http->getCode(); + if (code > 0) { + int len = 0; + char *response = http->recv(len); + String sresponse(response, len, AttachString); + ret.set("code", code); + if (code == 200) { + ret.set("response", f_json_decode(sresponse)); + } else { + ret.set("error", sresponse); + } + return true; + } + ASSERT(false); // code wasn't correctly set by http client + } + } + + return false; +} + +bool XboxServer::PostMessage(CStrRef message, + CStrRef host /* = "localhost" */) { + if (isLocalHost(host)) { + + if (RuntimeOption::XboxServerThreadCount <= 0) { + return false; + } + + XboxTransport *job = new XboxTransport(message); + job->incRefCount(); // paired with worker's decRefCount() + ASSERT(s_dispatcher); + s_dispatcher->enqueue(job); + return true; + + } else { // remote + + string url = "http://"; + url += host.data(); + url += "/xbox_post_message"; + + vector headers; + LibEventHttpClientPtr http = + LibEventHttpClient::Get(url, RuntimeOption::XboxServerPort); + if (http->send(url, headers, 0, false, message.data(), message.size())) { + int code = http->getCode(); + if (code > 0) { + int len = 0; + char *response = http->recv(len); + String sresponse(response, len, AttachString); + if (code == 200 && same(f_json_decode(sresponse), true)) { + return true; + } + } + } + } + + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +class XboxTask : public ResourceData { +public: + DECLARE_OBJECT_ALLOCATION(XboxTask); + + XboxTask(CStrRef message) { + m_job = new XboxTransport(message); + m_job->incRefCount(); + } + + ~XboxTask() { + m_job->decRefCount(); + } + + XboxTransport *getJob() { return m_job;} + + // overriding ResourceData + virtual const char *o_getClassName() const { return "XboxTask";} + +private: + XboxTransport *m_job; +}; +IMPLEMENT_OBJECT_ALLOCATION(XboxTask); + +/////////////////////////////////////////////////////////////////////////////// + +Object XboxServer::TaskStart(CStrRef message) { + if (RuntimeOption::XboxServerThreadCount <= 0) { + return null_object; + } + XboxTask *task = NEW(XboxTask)(message); + Object ret(task); + XboxTransport *job = task->getJob(); + job->incRefCount(); // paired with worker's decRefCount() + ASSERT(s_dispatcher); + s_dispatcher->enqueue(job); + + return ret; +} + +bool XboxServer::TaskStatus(CObjRef task) { + XboxTask *ptask = task.getTyped(); + return ptask->getJob()->isDone(); +} + +int XboxServer::TaskResult(CObjRef task, int timeout_ms, Variant &ret) { + XboxTask *ptask = task.getTyped(); + + int code = 0; + String response = ptask->getJob()->getResults(code, timeout_ms); + if (code == 200) { + ret = f_json_decode(response); + } else { + ret = response; + } + return code; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/server/xbox_server.h b/src/cpp/base/server/xbox_server.h new file mode 100644 index 0000000000000..070c13363cea8 --- /dev/null +++ b/src/cpp/base/server/xbox_server.h @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_XBOX_SERVER_H__ +#define __HPHP_XBOX_SERVER_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class XboxServer { +public: + /** + * Start or restart xbox server. + */ + static void Restart(); + +public: + /** + * Send/PostMessage paradigm for local and remote RPC. + */ + static bool SendMessage(CStrRef message, Variant &ret, int timeout_ms, + CStrRef host = "localhost"); + static bool PostMessage(CStrRef message, CStrRef host = "localhost"); + + /** + * Local tasklet for parallel processing. + */ + static Object TaskStart(CStrRef message); + static bool TaskStatus(CObjRef task); + static int TaskResult(CObjRef task, int timeout_ms, Variant &ret); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_XBOX_SERVER_H__ diff --git a/src/cpp/base/shared/process_shared_variant.cpp b/src/cpp/base/shared/process_shared_variant.cpp new file mode 100644 index 0000000000000..46e2a9d8d45ab --- /dev/null +++ b/src/cpp/base/shared/process_shared_variant.cpp @@ -0,0 +1,255 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +ProcessSharedVariant::ProcessSharedVariant(SharedMemoryString& source) { + m_lock = putPtr((ProcessSharedVariantLock*)NULL); + m_type = KindOfString; + m_data.str = putPtr(&source); +} + +ProcessSharedVariant::ProcessSharedVariant(CVarRef source, + ProcessSharedVariantLock* lock) + : m_lock(putPtr(lock)) { + switch (source.getType()) { + case KindOfBoolean: + { + m_type = KindOfBoolean; + m_data.num = source.toBoolean(); + break; + } + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + { + m_type = KindOfInt64; + m_data.num = source.toInt64(); + break; + } + case KindOfDouble: + { + m_type = KindOfDouble; + m_data.dbl = source.toDouble(); + break; + } + case LiteralString: + case KindOfString: + { + String s = source.toString(); + m_type = KindOfString; + if (lock) { + m_data.str = putPtr(SharedMemoryManager::GetSegment() + ->construct + (boost::interprocess::anonymous_instance) + (s.data(), s.size())); + } else { + // Just need this string to live long enough for the key lookup so + // don't store in shared memory. + m_data.str = putPtr(new SharedMemoryString(s.data(), s.size())); + } + break; + } + case KindOfArray: + { + ASSERT(lock); + m_type = KindOfArray; + uint i = 0; + ProcessSharedVariantMapData* mapData = SharedMemoryManager::GetSegment() + ->construct + (boost::interprocess::anonymous_instance)(); + m_data.map = putPtr(mapData); + ProcessSharedVariantToIntMap* map = SharedMemoryManager::GetSegment() + ->construct + (boost::interprocess::anonymous_instance)(); + mapData->map = putPtr(map); + SharedMemoryVector* keys = + SharedMemoryManager::GetSegment() + ->construct > + (boost::interprocess::anonymous_instance)(); + mapData->keys = putPtr(keys); + SharedMemoryVector* vals = + SharedMemoryManager::GetSegment() + ->construct > + (boost::interprocess::anonymous_instance)(); + mapData->vals = putPtr(vals); + for (ArrayIterPtr it = source.begin(); !it->end(); it->next()) { + ProcessSharedVariant* key = SharedMemoryManager::GetSegment() + ->construct + (boost::interprocess::anonymous_instance) + (it->first(), getLock()); + ProcessSharedVariant* val = SharedMemoryManager::GetSegment() + ->construct + (boost::interprocess::anonymous_instance) + (it->second(), getLock()); + (*map)[key] = i++; + keys->push_back(putPtr(key)); + vals->push_back(putPtr(val)); + } + break; + } + default: + { + m_type = KindOfObject; + String s = f_serialize(source); + m_data.str = putPtr(SharedMemoryManager::GetSegment() + ->construct + (boost::interprocess::anonymous_instance) + (s.data(), s.size())); + break; + } + } +} + +Variant ProcessSharedVariant::toLocal() { + ASSERT(getLock()); + switch (m_type) { + case KindOfBoolean: + { + return (bool)m_data.num; + } + case KindOfInt64: + { + return m_data.num; + } + case KindOfDouble: + { + return m_data.dbl; + } + case KindOfString: + { + return NEW(StringData)(this); + } + case KindOfArray: + { + return NEW(SharedMap)(this); + } + default: + { + SharedMemoryString* s = getString(); + return f_unserialize(String(s->c_str(), s->size(), AttachLiteral)); + } + } +} + +void ProcessSharedVariant::dump(std::string &out) { + out += "ref("; + out += boost::lexical_cast(m_ref); + out += ") "; + switch (m_type) { + case KindOfBoolean: + out += "boolean: "; + out += m_data.num ? "true" : "false"; + break; + case KindOfInt64: + out += "int: "; + out += boost::lexical_cast(m_data.num); + break; + case KindOfDouble: + out += "double: "; + out += boost::lexical_cast(m_data.dbl); + break; + case KindOfString: + out += "string("; + out += boost::lexical_cast(stringLength()); + out += "): "; + out += stringData(); + break; + case KindOfArray: + incRef(); + SharedMap(this).dump(out); + break; + default: + out += "object: "; + out += getString()->c_str(); + break; + } + out += "\n"; +} + +ProcessSharedVariant::~ProcessSharedVariant() { + switch (m_type) { + case KindOfString: + case KindOfObject: + { + if (getLock()) { + SharedMemoryManager::GetSegment()->destroy_ptr(getString()); + } + } + break; + case KindOfArray: + { + ASSERT(getLock()); + BOOST_FOREACH(SharedVariant* v, keys()) { + getPtr(v)->decRef(); + } + BOOST_FOREACH(SharedVariant* v, vals()) { + getPtr(v)->decRef(); + } + SharedMemoryManager::GetSegment()->destroy_ptr(&map()); + SharedMemoryManager::GetSegment()->destroy_ptr(&keys()); + SharedMemoryManager::GetSegment()->destroy_ptr(&vals()); + SharedMemoryManager::GetSegment()->destroy_ptr(getMapData()); + } + break; + default: + break; + } +} + +void ProcessSharedVariant::loadElems(std::vector &elems) { + ASSERT(is(KindOfArray)); + const SharedMemoryVector& ks = keys(); + const SharedMemoryVector& vs = vals(); + uint count = ks.size(); + elems.reserve(count); + for (uint i = 0; i < count; i++) { + elems.push_back(NEW(ArrayElement)(getPtr(ks[i])->toLocal(), + getPtr(vs[i])->toLocal())); + } +} + +ProcessSharedVariantToIntMap::const_iterator +ProcessSharedVariant::lookup(CVarRef key) { + ProcessSharedVariantToIntMap::const_iterator it; + if (key.isString()) { + SharedMemoryString ks; + if (key.is(KindOfString)) { + StringData* sd = key.getStringData(); + ks = SharedMemoryString(sd->data(), sd->size()); + } else { + ks = SharedMemoryString(key.getLiteralString()); + } + ProcessSharedVariant svk(ks); + it = map().find(&svk); + } else { + ProcessSharedVariant svk(key, NULL); + it = map().find(&svk); + } + return it; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/shared/process_shared_variant.h b/src/cpp/base/shared/process_shared_variant.h new file mode 100644 index 0000000000000..6c51e4f5f3247 --- /dev/null +++ b/src/cpp/base/shared/process_shared_variant.h @@ -0,0 +1,204 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_PROCESS_SHARED_VARIANT_H__ +#define __HPHP_PROCESS_SHARED_VARIANT_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef boost::interprocess::interprocess_mutex ProcessSharedVariantLock; + +template +class ptrless +{ +public: + bool operator()(const T& x, const T& y) const { + if (x && y) { + return *x < *y; + } + return x < y; + } +}; + +class ProcessSharedVariant; + +typedef boost::interprocess::offset_ptr SharedVariantOffPtr; + +typedef SharedMemoryMapWithComp + > +ProcessSharedVariantToIntMap; + +class ProcessSharedVariantMapData { +public: + ProcessSharedVariantToIntMap* map; + SharedMemoryVector* keys; + SharedMemoryVector* vals; +}; + +class ProcessSharedVariant : public SharedVariant { + public: + ProcessSharedVariant(CVarRef source, ProcessSharedVariantLock* lock); + ProcessSharedVariant(SharedMemoryString& source); + virtual ~ProcessSharedVariant(); + + virtual void incRef() { + getLock()->lock(); + ++m_ref; + getLock()->unlock(); + } + + virtual void decRef() { + ASSERT(m_ref); + getLock()->lock(); + --m_ref; + if (m_ref == 0) { + getLock()->unlock(); + SharedMemoryManager::GetSegment()->destroy_ptr(this); + } else { + getLock()->unlock(); + } + } + + Variant toLocal(); + bool operator<(const SharedVariant& svother) const { + ProcessSharedVariant const * other = + dynamic_cast(&svother); + ASSERT(other); + if (m_type != other->m_type) { + return m_type < other->m_type; + } + switch (m_type) { + case KindOfInt64: + { + return m_data.num < other->m_data.num; + } + case KindOfString: + { + return *getString() < *other->getString(); + } + default: + break; + } + // No other types are legitimate keys + ASSERT(false); + return false; + } + + const char* stringData() const { + ASSERT(is(KindOfString)); + return getString()->c_str(); + } + size_t stringLength() const { + ASSERT(is(KindOfString)); + return getString()->size(); + } + + size_t arrSize() const { + return map().size(); + } + + int getIndex(CVarRef key) { + ASSERT(is(KindOfArray)); + ProcessSharedVariantToIntMap::const_iterator it = lookup(key); + if (it == map().end()) { + return -1; + } + return it->second; + } + + SharedVariant* get(CVarRef key) { + int idx = getIndex(key); + if (idx != -1) { + return getPtr(vals()[idx]); + } + return NULL; + } + + bool exists(CVarRef key) { + ASSERT(is(KindOfArray)); + ProcessSharedVariantToIntMap::const_iterator it = lookup(key); + return it != map().end(); + } + + + + void loadElems(std::vector &elems); + + virtual SharedVariant* getKey(ssize_t pos) const { + return getPtr(keys()[pos]); + } + virtual SharedVariant* getValue(ssize_t pos) const { + return getPtr(vals()[pos]); + } + + SharedMemoryString* getString() const { + return getPtr(m_data.str); + } + + // implementing LeakDetectable + virtual void dump(std::string &out); + + protected: + union { + int64 num; + double dbl; + SharedMemoryString* str; + ProcessSharedVariantMapData* map; + } m_data; + ProcessSharedVariantLock* m_lock; + + template + T getPtr(T p) const { + return (T)((size_t)p+(size_t)this); + } + template + T putPtr(T p) const { + return (T)((size_t)p-(size_t)this); + } + + ProcessSharedVariantMapData* getMapData() const { + return getPtr(m_data.map); + } + ProcessSharedVariantLock* getLock() const { + return getPtr(m_lock); + } + + const ProcessSharedVariantToIntMap& map() const { + return *getPtr(getMapData()->map); + } + + const SharedMemoryVector& keys() const { + ASSERT(is(KindOfArray)); + return *getPtr(getMapData()->keys); + } + const SharedMemoryVector& vals() const { + ASSERT(is(KindOfArray)); + return *getPtr(getMapData()->vals); + } + ProcessSharedVariantToIntMap::const_iterator lookup(CVarRef key); +}; + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif /* __HPHP_PROCESS_SHARED_VARIANT_H__ */ diff --git a/src/cpp/base/shared/shared_map.cpp b/src/cpp/base/shared/shared_map.cpp new file mode 100644 index 0000000000000..01a328660546b --- /dev/null +++ b/src/cpp/base/shared/shared_map.cpp @@ -0,0 +1,224 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION(SharedMap, SmartAllocatorImpl::NeedRestore); +/////////////////////////////////////////////////////////////////////////////// + +SharedMap::SharedMap(SharedVariant* source) + : m_arr(source) { + source->incRef(); +} + + +bool SharedMap::exists(CVarRef k, int64 prehash /* = -1*/) const { + return m_arr->exists(k); +} + +ArrayData *SharedMap::lval(Variant *&ret, bool copy) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->lval(ret, false); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} +ArrayData *SharedMap::lval(int64 k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->lval(k, ret, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} +ArrayData *SharedMap::lval(litstr k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->lval(k, ret, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} +ArrayData *SharedMap::lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->lval(k, ret, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} +ArrayData *SharedMap::lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash /* = -1 */) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->lval(k, ret, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} + +ArrayData *SharedMap::set(int64 k, CVarRef v, bool copy, int64 prehash) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->set(k, v, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} +ArrayData *SharedMap::set(litstr k, CVarRef v, bool copy, int64 prehash) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->set(k, v, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} +ArrayData *SharedMap::set(CStrRef k, CVarRef v, bool copy, int64 prehash) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->set(k, v, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} +ArrayData *SharedMap::set(CVarRef k, CVarRef v, bool copy, int64 prehash) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->set(k, v, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} + +ArrayData *SharedMap::remove(int64 k, bool copy, int64 prehash /* = -1 */) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->remove(k, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} +ArrayData *SharedMap::remove(litstr k, bool copy, int64 prehash /* = -1 */) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->remove(k, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} +ArrayData *SharedMap::remove(CStrRef k, bool copy, int64 prehash /* = -1 */) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->remove(k, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} +ArrayData *SharedMap::remove(CVarRef k, bool copy, int64 prehash /* = -1 */) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->remove(k, false, prehash); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} + +ArrayData *SharedMap::copy() const { + return escalate(); +} + +ArrayData *SharedMap::append(CVarRef v, bool copy) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->append(v, false); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} + +ArrayData *SharedMap::append(const ArrayData *elems, ArrayOp op, bool copy) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->append(elems, op, false); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} + +ArrayData *SharedMap::insert(ssize_t pos, CVarRef v, bool copy) { + ArrayData *escalated = escalate(); + ArrayData *ee = escalated->insert(pos, v, false); + if (ee) { + escalated->release(); + return ee; + } + return escalated; +} + +ArrayData *SharedMap::escalate() const { + ArrayData *ret = NULL; + if (RuntimeOption::UseZendArray) { + std::vector elems; + m_arr->loadElems(elems); + if (!elems.empty()) { + ret = ArrayData::Create(elems); + } else { + ret = StaticEmptyZendArray::Get()->copy(); + } + } else { + ret = escalateToMapVariant(); + } + ASSERT(!ret->isStatic()); + return ret; +} + +MapVariant *SharedMap::escalateToMapVariant() const { + std::vector elems; + m_arr->loadElems(elems); + MapVariant *escalated = NEW(MapVariant)(elems); + size_t count = elems.size(); + for (uint i = 0; i < count; i++) { + elems[i]->release(); + } + return escalated; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/shared/shared_map.h b/src/cpp/base/shared/shared_map.h new file mode 100644 index 0000000000000..3e286e54d45ea --- /dev/null +++ b/src/cpp/base/shared/shared_map.h @@ -0,0 +1,154 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __SHARED_MAP_H__ +#define __SHARED_MAP_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Wrapper for a shared memory map. + */ +class SharedMap : public ArrayData { +public: + SharedMap(SharedVariant* source); + + ~SharedMap() { + m_arr->decRef(); + } + + ssize_t size() const { + return m_arr->arrSize(); + } + + Variant getKey(ssize_t pos) const { + SharedVariant* k = m_arr->getKey(pos); + return k ? k->toLocal() : null; + } + + Variant getValue(ssize_t pos) const { + SharedVariant* v = m_arr->getValue(pos); + return v ? v->toLocal() : null; + } + + bool exists(int64 k, int64 prehash = -1) const { + return exists(Variant(k), prehash); + } + bool exists(litstr k, int64 prehash = -1) const { + return exists(Variant(k), prehash); + } + bool exists(CStrRef k, int64 prehash = -1) const { + return exists(Variant(k), prehash); + } + bool exists(CVarRef k, int64 prehash = -1) const; + + bool idxExists(ssize_t idx) const { + return idx < size(); + } + + Variant get(int64 k, int64 prehash = -1) const { + return get(Variant(k), prehash); + } + Variant get(litstr k, int64 prehash = -1) const { + return get(Variant(k), prehash); + } + Variant get(CStrRef k, int64 prehash = -1) const { + return get(Variant(k), prehash); + } + Variant get(CVarRef k, int64 prehash = -1) const { + SharedVariant* sv = m_arr->get(k); + if (sv) { + return sv->toLocal(); + } + return null; + } + + ssize_t getIndex(int64 k, int64 prehash = -1) const { + return getIndex(Variant(k), prehash); + } + ssize_t getIndex(litstr k, int64 prehash = -1) const { + return getIndex(Variant(k), prehash); + } + ssize_t getIndex(CStrRef k, int64 prehash = -1) const { + return getIndex(Variant(k), prehash); + } + ssize_t getIndex(CVarRef k, int64 prehash = -1) const { + return m_arr->getIndex(k); + } + + ArrayData *lval(Variant *&ret, bool copy); + virtual ArrayData *lval(int64 k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(litstr k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CStrRef k, Variant *&ret, bool copy, + int64 prehash = -1); + virtual ArrayData *lval(CVarRef k, Variant *&ret, bool copy, + int64 prehash = -1); + + ArrayData *set(int64 k, CVarRef v, + bool copy, int64 prehash = -1); + ArrayData *set(litstr k, CVarRef v, + bool copy, int64 prehash = -1); + ArrayData *set(CStrRef k, CVarRef v, + bool copy, int64 prehash = -1); + ArrayData *set(CVarRef k, CVarRef v, + bool copy, int64 prehash = -1); + + ArrayData *remove(int64 k, bool copy, int64 prehash = -1); + ArrayData *remove(litstr k, bool copy, int64 prehash = -1); + ArrayData *remove(CStrRef k, bool copy, int64 prehash = -1); + ArrayData *remove(CVarRef k, bool copy, int64 prehash = -1); + + ArrayData *copy() const; + + ArrayData *append(CVarRef v, bool copy); + ArrayData *append(const ArrayData *elems, ArrayOp op, bool copy); + + ArrayData *insert(ssize_t pos, CVarRef v, bool copy); + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION(SharedMap, SmartAllocatorImpl::NeedRestore); + bool calculate(int &size) { return true;} + void backup(LinearAllocator &allocator) { + m_arr->incRef(); // protect it + } + void restore(const char *&data) { m_arr->incRef();} + void sweep() { m_arr->decRef();} + + ArrayData *escalate() const; + MapVariant *escalateToMapVariant() const; + +private: + SharedVariant *m_arr; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __SHARED_MAP_H__ diff --git a/src/cpp/base/shared/shared_store.cpp b/src/cpp/base/shared/shared_store.cpp new file mode 100644 index 0000000000000..ac65b15b68c39 --- /dev/null +++ b/src/cpp/base/shared/shared_store.cpp @@ -0,0 +1,1346 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace boost; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +size_t SharedStore::s_lockCount = 10000; + + +/////////////////////////////////////////////////////////////////////////////// +// LockedSharedStore +class LockedSharedStore : public SharedStore { +public: + LockedSharedStore(int i) : SharedStore(i) {} + virtual void clear(); + virtual bool get(CStrRef key, Variant &value); + virtual bool store(CStrRef key, CVarRef val, int64 ttl); + virtual int64 inc(CStrRef key, int64 step, bool &found); + virtual bool cas(CStrRef key, int64 old, int64 val); + virtual void prime(const std::vector &vars); +protected: + virtual bool find(CStrRef key, StoreValue *&v, bool &expired) = 0; + virtual void set(CStrRef key, SharedVariant* v, int64 ttl) = 0; + virtual bool eraseImpl(CStrRef key, bool expired); + virtual bool eraseLockedImpl(CStrRef key, bool expired) = 0; + virtual void lockMap() = 0; + virtual void readLockMap() = 0; + virtual void unlockMap() = 0; + virtual void readUnlockMap() = 0; + virtual void clearImpl() = 0; + +}; + + +/////////////////////////////////////////////////////////////////////////////// +// ProcessSharedStore + +class ProcessSharedStore : public LockedSharedStore { +public: + ProcessSharedStore(int id) : LockedSharedStore(id) { + if (!s_initialized) { + Lock lock(s_mutex); + if (!s_initialized) { + SharedMemoryManager::Init(RuntimeOption::ApcSharedMemorySize * + 1024 * 1024, true); + s_initialized = true; + } + } + std::string sid = boost::lexical_cast(id); + std::string mapLockName = std::string("HPHP_MapLock") + sid; + std::string valLocksName = std::string("HPHP_VariantLocks") + sid; + std::string mapName = std::string("HPHP_APC") + sid; + m_mapLock = SharedMemoryManager::GetSegment()-> + find_or_construct + (mapLockName.c_str())(); + m_locks = SharedMemoryManager::GetSegment()-> + find_or_construct(valLocksName.c_str()) + [s_lockCount](); + m_vars = SharedMemory::OpenOrCreate(mapName.c_str()); + } + virtual bool find(CStrRef key, StoreValue *&val, bool &expired) { + ASSERT(expired == false); + SharedMap::iterator iter = + m_vars->find(SharedMemoryString(key.data(), key.size())); + if (iter != m_vars->end()) { + val = &iter->second; + if (iter->second.expired()) { + expired = true; + return false; + } + return true; + } else { + return false; + } + } + virtual void set(CStrRef key, SharedVariant* v, int64 ttl) { + (*m_vars)[SharedMemoryString(key.data(), key.size())].set(putVar(v), ttl); + } + virtual SharedVariant* construct(CStrRef key, CVarRef v) { + ProcessSharedVariantLock* lock = getLock(key); + return SharedMemoryManager::GetSegment()->construct + (boost::interprocess::anonymous_instance)(v, lock); + } + virtual SharedVariant* construct(litstr str, int len, CStrRef v, + bool serialized) { + if (serialized) { + return construct(String(str, len, AttachLiteral), f_unserialize(v)); + } + return construct(String(str, len, AttachLiteral), v); + } + virtual SharedVariant* construct(litstr str, int len, CVarRef v) { + return construct(String(str, len, AttachLiteral), v); + } + virtual void lockMap() { + m_mapLock->lock(); + } + virtual void readLockMap() { + m_mapLock->lock_sharable(); + } + virtual void unlockMap() { + m_mapLock->unlock(); + } + virtual void readUnlockMap() { + m_mapLock->unlock_sharable(); + } + + virtual SharedVariant* putVar(SharedVariant* v) const { + return (SharedVariant*)((size_t)v - (size_t)this); + } + + virtual SharedVariant* getVar(SharedVariant* v) const { + return (SharedVariant*)((size_t)v + (size_t)this); + } + + virtual void clearImpl() { + for (SharedMap::const_iterator iter = m_vars->begin(); + iter != m_vars->end(); ++iter) { + ASSERT(getVar(iter->second.var)); + getVar(iter->second.var)->decRef(); + } + m_vars->clear(); + } + + virtual bool eraseLockedImpl(CStrRef key, bool expired) { + SharedMap::const_iterator iter = + m_vars->find(SharedMemoryString(key.data(), key.size())); + if (iter != m_vars->end()) { + if (expired) { + if (!iter->second.expired()) { + return false; + } + } + getVar(iter->second.var)->decRef(); + m_vars->erase(iter); + return true; + } + return false; + } + + virtual int size() { + int ret = 0; + lockMap(); + ret = m_vars->size(); + unlockMap(); + return ret; + } + + virtual void count(int &reachable, int &expired, int &persistent) { + reachable = expired = persistent = 0; + int now = time(NULL); + lockMap(); + for (SharedMap::const_iterator iter = m_vars->begin(); + iter != m_vars->end(); ++iter) { + ASSERT(getVar(iter->second.var)); + reachable += getVar(iter->second.var)->countReachable(); + + int64 expiration = iter->second.expiry; + if (expiration == 0) { + persistent++; + } else if (expiration <= now) { + expired++; + } + } + unlockMap(); + } + +private: + typedef SharedMemoryMap SharedMap; + ProcessSharedVariantLock* getLock(CStrRef key) { + ssize_t hash = hash_string(key.data(), key.size()); + return &m_locks[hash % s_lockCount]; + } + SharedMap *m_vars; + boost::interprocess::interprocess_upgradable_mutex* m_mapLock; + ProcessSharedVariantLock *m_locks; + static Mutex s_mutex; + static bool s_initialized; +}; + +Mutex ProcessSharedStore::s_mutex; +bool ProcessSharedStore::s_initialized = false; + +/////////////////////////////////////////////////////////////////////////////// +// Constructor Parents + +class ThreadSharedVariantFactory { +public: + ThreadSharedVariantFactory() : m_locks(NULL) { + if (RuntimeOption::ApcUseLockedRefs) { + m_locks = new Mutex[SharedStore::s_lockCount]; + } + } + ~ThreadSharedVariantFactory() { + if (m_locks) { + delete [] m_locks; + } + } + + inline SharedVariant* create(CStrRef key, CVarRef v) { + if (RuntimeOption::ApcUseLockedRefs) { + return new ThreadSharedVariantLockedRefs(v, false, *getLock(key)); + } else { + return new ThreadSharedVariant(v, false); + } + } + inline SharedVariant* create(litstr str, int len, CStrRef v, + bool serialized) { + if (RuntimeOption::ApcUseLockedRefs) { + return new ThreadSharedVariantLockedRefs(v, serialized, + *getLock(str, len)); + } else { + return new ThreadSharedVariant(v, serialized); + } + } + inline SharedVariant* create(litstr str, int len, CVarRef v) { + if (RuntimeOption::ApcUseLockedRefs) { + return new ThreadSharedVariantLockedRefs(v, false, + *getLock(str, len)); + } else { + return new ThreadSharedVariant(v, false); + } + } +protected: + Mutex *m_locks; + + inline Mutex* getLock(const char *data, int len) { + ssize_t hash = hash_string(data, len); + return &m_locks[hash % SharedStore::s_lockCount]; + } + Mutex* getLock(CStrRef key) { + return getLock(key.data(), key.size()); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// Maps + +class HashTableSharedStore : public LockedSharedStore, + private ThreadSharedVariantFactory { +public: + HashTableSharedStore(int i) : LockedSharedStore(i) {} + ~HashTableSharedStore() { + clear(); + } + virtual bool find(CStrRef key, StoreValue *&val, bool &expired) { + if (key.isNull()) return false; + + ASSERT(expired == false); + StringMap::iterator iter = m_vars.find(key.get()); + if (iter == m_vars.end()) { + return false; + } else { + val = &iter->second; + if (val->expired()) { + expired = true; + return false; + } + return true; + } + } + + virtual void set(CStrRef key, SharedVariant* v, int64 ttl) { + if (key.isNull()) return; + + ASSERT(m_vars.find(key.get()) == m_vars.end()); + StoreValue &val = m_vars[key.get()->copy(true)]; + val.set(v, ttl); + } + + + virtual void clearImpl() { + std::vector keys; + keys.reserve(m_vars.size()); + for (StringMap::iterator iter = m_vars.begin(); + iter != m_vars.end(); ++iter) { + iter->second.var->decRef(); + keys.push_back(iter->first); + } + m_vars.clear(); + for (unsigned int i = 0; i < keys.size(); i++) { + delete keys[i]; + } + } + virtual bool eraseLockedImpl(CStrRef key, bool expired) { + if (key.isNull()) return false; + + StringMap::iterator iter = m_vars.find(key.get()); + if (iter != m_vars.end()) { + if (expired && !iter->second.expired()) { + return false; + } + iter->second.var->decRef(); + StringData *pkey = iter->first; + m_vars.erase(iter); + delete pkey; + return true; + } + return false; + } + virtual int size() { + int ret = 0; + lockMap(); + ret = m_vars.size(); + unlockMap(); + return ret; + } + virtual void count(int &reachable, int &expired, int &persistent) { + reachable = expired = persistent = 0; + int now = time(NULL); + lockMap(); + for (StringMap::const_iterator iter = m_vars.begin(); + iter != m_vars.end(); ++iter) { + reachable += iter->second.var->countReachable(); + + int64 expiration = iter->second.expiry; + if (expiration == 0) { + persistent++; + } else if (expiration <= now) { + expired++; + } + } + unlockMap(); + } + virtual void lockMap() { + m_mlock.acquireWrite(); + } + virtual void readLockMap() { + m_mlock.acquireRead(); + } + virtual void unlockMap() { + m_mlock.release(); + } + virtual void readUnlockMap() { + m_mlock.release(); + } + virtual SharedVariant* construct(litstr str, int len, CStrRef v, + bool serialized) { + return create(str, len, v, serialized); + } + virtual SharedVariant* construct(litstr str, int len, CVarRef v) { + return create(str, len, v); + } +protected: + virtual SharedVariant* construct(CStrRef key, CVarRef v) { + return create(key, v); + } + ReadWriteMutex m_mlock; + struct StringHash { + size_t operator()(StringData *s) const { + ASSERT(s); + return hash_string(s->data(), s->size()); + } + }; + + struct StringEqual { + bool operator()(StringData *s1, StringData *s2) const { + ASSERT(s1 && s2); + return s1->compare(s2) == 0; + } + }; + + class StringMap : + public hphp_hash_map { + public: + typedef hphp_hash_map + baseType; + ~StringMap() { + for (baseType::iterator iter = baseType::begin(); + iter != baseType::end(); ++iter) { + delete iter->first; + } + } + }; + StringMap m_vars; +}; + +class RwLockHashTableSharedStore : public HashTableSharedStore { +public: + RwLockHashTableSharedStore(int i): HashTableSharedStore(i) {} + virtual void lockMap() { + m_mlock.acquireWrite(); + } + virtual void readLockMap() { + m_mlock.acquireRead(); + } + virtual void unlockMap() { + m_mlock.release(); + } + virtual void readUnlockMap() { + m_mlock.release(); + } +protected: + ReadWriteMutex m_mlock; +}; + +class MutexHashTableSharedStore : public HashTableSharedStore { +public: + MutexHashTableSharedStore(int i): HashTableSharedStore(i) {} + virtual void lockMap() { + m_mlock.lock(); + } + virtual void readLockMap() { + m_mlock.lock(); + } + virtual void unlockMap() { + m_mlock.unlock(); + } + virtual void readUnlockMap() { + m_mlock.unlock(); + } +protected: + Mutex m_mlock; +}; + +class LfuTableSharedStore : public SharedStore, + private ThreadSharedVariantFactory { +public: + LfuTableSharedStore(int id, time_t maturity, size_t maxCap, int updatePeriod) + : SharedStore(id), m_vars(maturity, maxCap, updatePeriod) { + } + + void set(CStrRef key, SharedVariant* v, int64 ttl, bool immortal = false) { + class SetUpdater : public Map::AtomicUpdater { + public: + SetUpdater(SharedVariant *v, int64 t) : var(v), ttl(t) {} + bool update(StringData* const &k, StoreValue &val, bool newlyCreated) { + ASSERT(newlyCreated); + val.set(var, ttl); + return false; + } + private: + SharedVariant *var; + int64 ttl; + }; + if (key.isNull()) return; + SetUpdater updater(v, ttl); + m_vars.atomicUpdate(key.get()->copy(true), updater, true, immortal); + } + virtual void clear() { + m_vars.clear(); + } + virtual bool eraseImpl(CStrRef key, bool expired) { + class EraseUpdater : public Map::AtomicUpdater { + public: + EraseUpdater(bool exp) : res(false), expired(exp) {} + bool update(StringData* const &k, StoreValue &val, bool newlyCreated) { + if (expired && !val.expired()) { + return false; + } + res = true; + return true; + } + bool res; + private: + bool expired; + }; + + if (key.isNull()) return false; + EraseUpdater updater(expired); + m_vars.atomicUpdate(key.get(), updater, false); + return updater.res; + } + + void prime(const std::vector &vars); + + virtual int size() { + return m_vars.size(); + } + virtual void count(int &reachable, int &expired, int &persistent) { + class CountBody : public Map::AtomicReader { + public: + CountBody(int &r, int &e, int &p) + : now(time(NULL)), reachable(r), expired(e), persistent(p) {} + void read(StringData* const &k, const StoreValue &val) { + reachable += val.var->countReachable(); + int64 expiration = val.expiry; + if (expiration == 0) { + persistent++; + } else if (expiration <= now) { + expired++; + } + } + private: + time_t now; + int &reachable; + int &expired; + int &persistent; + }; + reachable = expired = persistent = 0; + CountBody body(reachable, expired, persistent); + m_vars.atomicForeach(body); + } + + virtual bool get(CStrRef key, Variant &value); + virtual bool store(CStrRef key, CVarRef val, int64 ttl); + virtual int64 inc(CStrRef key, int64 step, bool &found); + virtual bool cas(CStrRef key, int64 old, int64 val); + virtual bool check() { + return m_vars.check(); + } + virtual std::string reportStats(int &reachable, int indent); + virtual SharedVariant* construct(litstr str, int len, CStrRef v, + bool serialized) { + return create(str, len, v, serialized); + } + virtual SharedVariant* construct(litstr str, int len, CVarRef v) { + return create(str, len, v); + } +protected: + virtual SharedVariant* construct(CStrRef key, CVarRef v) { + return create(key, v); + } +private: + struct StringHash { + size_t operator()(StringData *s) const { + ASSERT(s); + return hash_string(s->data(), s->size()); + } + }; + + struct StringEqual { + bool operator()(StringData *s1, StringData *s2) const { + ASSERT(s1 && s2); + return s1->compare(s2) == 0; + } + }; + + class NodeDestructor { + public: + void operator()(const StringData *k, StoreValue &val) { + delete k; + val.var->decRef(); + } + }; + + class StringMap : + public LFUTable { + public: + StringMap(time_t maturity, size_t maxCap, int updatePeriod) + : LFUTable + (maturity, maxCap, updatePeriod) {} + + typedef LFUTable baseType; + }; + typedef StringMap Map; + Map m_vars; +}; + +/////////////////////////////////////////////////////////////////////////////// +// ConcurrentThreadSharedStore + +class ConcurrentTableSharedStore : public SharedStore, + private ThreadSharedVariantFactory { +public: + ConcurrentTableSharedStore(int id) : SharedStore(id), m_purgeCounter(0) {} + virtual int size() { + return m_vars.size(); + } + virtual void count(int &reachable, int &expired, int &persistent) { + reachable = expired = persistent = 0; + int now = time(NULL); + WriteLock l(m_lock); + for (Map::const_iterator iter = m_vars.begin(); + iter != m_vars.end(); ++iter) { + reachable += iter->second.var->countReachable(); + + int64 expiration = iter->second.expiry; + if (expiration == 0) { + persistent++; + } else if (expiration <= now) { + expired++; + } + } + } + virtual bool get(CStrRef key, Variant &value); + virtual bool store(CStrRef key, CVarRef val, int64 ttl); + virtual int64 inc(CStrRef key, int64 step, bool &found); + virtual bool cas(CStrRef key, int64 old, int64 val); + virtual void prime(const std::vector &vars); + virtual SharedVariant* construct(litstr str, int len, CStrRef v, + bool serialized) { + return create(str, len, v, serialized); + } + virtual SharedVariant* construct(litstr str, int len, CVarRef v) { + return create(str, len, v); + } +protected: + virtual SharedVariant* construct(CStrRef key, CVarRef v) { + return create(key, v); + } + struct StringHashCompare { + bool equal(StringData *s1, StringData *s2) const { + ASSERT(s1 && s2); + return s1->compare(s2) == 0; + } + size_t hash(StringData *s) const { + ASSERT(s); + return hash_string(s->data(), s->size()); + } + }; + typedef tbb::concurrent_hash_map + Map; + + virtual void clear() { + WriteLock l(m_lock); + for (Map::iterator iter = m_vars.begin(); iter != m_vars.end(); + ++iter) { + iter->second.var->decRef(); + delete iter->first; + } + m_vars.clear(); + } + virtual bool eraseImpl(CStrRef key, bool expired) { + if (key.isNull()) return false; + ReadLock l(m_lock); + Map::accessor acc; + if (m_vars.find(acc, key.get())) { + if (expired && !acc->second.expired()) { + return false; + } + eraseAcc(acc); + return true; + } + return false; + } + + void eraseAcc(Map::accessor &acc) { + acc->second.var->decRef(); + StringData *pkey = acc->first; + m_vars.erase(acc); + delete pkey; + } + void eraseAcc(Map::const_accessor &acc) { + acc->second.var->decRef(); + StringData *pkey = acc->first; + m_vars.erase(acc); + delete pkey; + } + + Map m_vars; + // Read lock is acquired whenever using concurrent ops + // Write lock is acquired for whole table operations + ReadWriteMutex m_lock; + + typedef std::pair ExpirationPair; + class ExpirationCompare { + public: + bool operator()(const ExpirationPair &p1, const ExpirationPair &p2) { + return p1.second > p2.second; + } + }; + + std::priority_queue, + ExpirationCompare> m_expirationQueue; + ReadWriteMutex m_expirationQueueLock; + uint64 m_purgeCounter; + + // Should be called outside m_lock + void purgeExpired() { + if ((atomic_add(m_purgeCounter, (uint64)1) % + RuntimeOption::ApcPurgeFrequency) != 0) return; + time_t now = time(NULL); + { + // Check if there's work to do + ReadLock lock(m_expirationQueueLock); + if (m_expirationQueue.empty() || m_expirationQueue.top().second > now) { + // No work + return; + } + } + // Purge items n at a time. The only operation under the write lock is + // the pop +#define PURGE_RATE 256 + StringData* s[PURGE_RATE]; + while (true) { + int i; + { + WriteLock lock(m_expirationQueueLock); + const ExpirationPair *p = NULL; + for (i = 0; i < PURGE_RATE && !m_expirationQueue.empty() && + (p = &m_expirationQueue.top())->second < now; + ++i, m_expirationQueue.pop()) { + s[i] = p->first; + } + } + for (int j = 0; j < i; ++j) { + String k(s[j]->data(), s[j]->size(), AttachLiteral); + eraseImpl(k, true); + delete s[j]; + } + if (i < PURGE_RATE) { + // No work left + break; + } + } + } + + void addToExpirationQueue(CStrRef key, int64 etime) { + ExpirationPair p(key.get()->copy(true), etime); + WriteLock lock(m_expirationQueueLock); + m_expirationQueue.push(p); + } + +}; + +/////////////////////////////////////////////////////////////////////////////// +// SharedStore + +SharedStore::SharedStore(int id) : m_id(id) { +} + +SharedStore::~SharedStore() { +} + +std::string SharedStore::GetSkeleton(CStrRef key) { + std::string ret; + const char *p = key.data(); + ret.reserve(key.size()); + bool added = false; // whether consecutive numbers are replaced by # yet + for (int i = 0; i < key.size(); i++) { + char ch = *p++; + if (ch >= '0' && ch <= '9') { + if (!added) { + ret += '#'; + added = true; + } + } else { + added = false; + ret += ch; + } + } + return ret; +} + +void LockedSharedStore::clear() { + lockMap(); + clearImpl(); + unlockMap(); +} + +bool LockedSharedStore::get(CStrRef key, Variant &value) { + bool stats = RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats; + + readLockMap(); + StoreValue *val; + bool expired = false; + if (!find(key, val, expired)) { + readUnlockMap(); + if (expired) { + erase(key, true); + } + value = false; + if (stats) { + ServerStats::Log("apc.miss", 1); + } + return false; + } + value = getVar(val->var)->toLocal(); + readUnlockMap(); + if (stats) ServerStats::Log("apc.hit", 1); + return true; +} + + +bool ConcurrentTableSharedStore::get(CStrRef key, Variant &value) { + bool stats = RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats; + const StoreValue *val; + ReadLock l(m_lock); + bool expired = false; + { + Map::const_accessor acc; + if (!m_vars.find(acc, key.get())) { + if (stats) ServerStats::Log("apc.miss", 1); + return false; + } else { + val = &acc->second; + if (val->expired()) { + // Because it only has a read lock on the data, deletion from + // expiration has to happen after the lock is released + expired = true; + } else { + value = val->var->toLocal(); + } + } + } + if (expired) { + if (stats) { + ServerStats::Log("apc.miss", 1); + } + eraseImpl(key, true); + return false; + } + if (stats) { + ServerStats::Log("apc.hit", 1); + } + return true; +} + + +bool LfuTableSharedStore::get(CStrRef key, Variant &value) { + class GetReader : public Map::AtomicReader { + public: + GetReader(Variant &v) : expired(false), value(v) {} + void read(StringData* const &k, const StoreValue &val) { + value = val.var->toLocal(); + expired = val.expired(); + } + bool expired; + Variant &value; + }; + bool stats = RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats; + GetReader reader(value); + if (!m_vars.atomicRead(key.get(), reader) || reader.expired) { + if (reader.expired) { + erase(key, true); + } + value = false; + if (stats) ServerStats::Log("apc.miss", 1); + return false; + } + if (stats) ServerStats::Log("apc.hit", 1); + return true; +} + +bool LockedSharedStore::store(CStrRef key, CVarRef val, int64 ttl) { + bool stats = RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats; + + lockMap(); + StoreValue *sval; + SharedVariant* var = construct(key, val); + bool expired = false; + if (find(key, sval, expired) || expired) { + getVar(sval->var)->decRef(); + sval->set(putVar(var), ttl); + if (stats) ServerStats::Log("apc.update", 1); + } else { + set(key, var, ttl); + if (stats) { + ServerStats::Log("apc.new", 1); + if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCKeyStats) { + string prefix = "apc.new."; + prefix += GetSkeleton(key); + ServerStats::Log(prefix, 1); + } + } + } + + unlockMap(); + return true; +} + + +bool ConcurrentTableSharedStore::store(CStrRef key, CVarRef val, int64 ttl) { + bool stats = RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats; + + StoreValue *sval; + SharedVariant* var = construct(key, val); + ReadLock l(m_lock); + + StringData *kcp = key.get()->copy(true); + bool present; + time_t expiry; + { + Map::accessor acc; + present = !m_vars.insert(acc, kcp); + sval = &acc->second; + if (present) { + delete kcp; + sval->var->decRef(); + } + sval->set(var, ttl); + expiry = sval->expiry; + } + if (RuntimeOption::ApcExpireOnSets) { + if (ttl) { + addToExpirationQueue(key, expiry); + } + purgeExpired(); + } + if (stats) { + if (present) { + ServerStats::Log("apc.update", 1); + } else { + ServerStats::Log("apc.new", 1); + if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCKeyStats) { + string prefix = "apc.new."; + prefix += GetSkeleton(key); + ServerStats::Log(prefix, 1); + } + } + } + + return true; +} + + +bool LfuTableSharedStore::store(CStrRef key, CVarRef val, int64 ttl) { + class StoreUpdater : public Map::AtomicUpdater { + public: + StoreUpdater(int64 t, SharedVariant *v, CStrRef k) + : ttl(t), var(v), key(k), newkey(key.get()->copy(true)) {} + bool update(StringData* const &k, StoreValue &val, bool newlyCreated) { + bool stats = RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats; + if (!newlyCreated) { + val.var->decRef(); + val.set(var, ttl); + if (stats) ServerStats::Log("apc.update", 1); + delete newkey; + } else { + val.set(var, ttl); + if (stats) { + ServerStats::Log("apc.new", 1); + if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCKeyStats) { + string prefix = "apc.new."; + prefix += GetSkeleton(key); + ServerStats::Log(prefix, 1); + } + } + } + return false; + } + StringData *newKey() { return newkey; } + private: + int64 ttl; + SharedVariant *var; + CStrRef key; + StringData *newkey; + }; + SharedVariant* var = construct(key, val); + StoreUpdater updater(ttl, var, key); + m_vars.atomicUpdate(updater.newKey(), updater, true); + return true; +} + +void LockedSharedStore::prime(const std::vector &vars) { + lockMap(); + // we are priming, so we are not checking existence or expiration + for (unsigned int i = 0; i < vars.size(); i++) { + const KeyValuePair &item = vars[i]; + set(String(item.key, item.len, AttachLiteral), item.value, 0); + } + unlockMap(); +} + + +void ConcurrentTableSharedStore::prime +(const std::vector &vars) { + ReadLock l(m_lock); + // we are priming, so we are not checking existence or expiration + for (unsigned int i = 0; i < vars.size(); i++) { + const SharedStore::KeyValuePair &item = vars[i]; + Map::accessor acc; + String k(item.key, item.len, AttachLiteral); + m_vars.insert(acc, k.get()->copy(true)); + acc->second.set(item.value, 0); + } +} + + +void LfuTableSharedStore::prime +(const std::vector &vars) { + // we are priming, so we are not checking existence or expiration + for (unsigned int i = 0; i < vars.size(); i++) { + const SharedStore::KeyValuePair &item = vars[i]; + // Primed values are immortal + set(String(item.key, item.len, AttachLiteral), item.value, 0, true); + } +} + +bool SharedStore::erase(CStrRef key, bool expired /* = false */) { + bool success = eraseImpl(key, expired); + + if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats) { + ServerStats::Log(success ? "apc.erased" : "apc.erase", 1); + } + return success; +} + +bool LockedSharedStore::eraseImpl(CStrRef key, bool expired /* = false */) { + lockMap(); + bool success = eraseLockedImpl(key, expired); + unlockMap(); + return success; +} + +int64 LockedSharedStore::inc(CStrRef key, int64 step, bool &found) { + found = false; + int64 ret = 0; + lockMap(); + StoreValue *val; + bool expired = false; + if (find(key, val, expired)) { + Variant v = getVar(val->var)->toLocal(); + ret = v.toInt64() + step; + v = ret; + SharedVariant *var = construct(key, v); + getVar(val->var)->decRef(); + val->var = putVar(var); + found = true; + } + unlockMap(); + if (expired) { + erase(key, true); + } + + if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats) { + ServerStats::Log("apc.inc", 1); + } + return ret; +} + + +int64 ConcurrentTableSharedStore::inc(CStrRef key, int64 step, bool &found) { + found = false; + int64 ret = 0; + ReadLock l(m_lock); + StoreValue *val; + { + Map::accessor acc; + if (m_vars.find(acc, key.get())) { + val = &acc->second; + if (val->expired()) { + eraseAcc(acc); + } else { + Variant v = val->var->toLocal(); + ret = v.toInt64() + step; + v = ret; + SharedVariant *var = construct(key, v); + val->var->decRef(); + val->var = var; + found = true; + } + } + } + + if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats) { + ServerStats::Log("apc.inc", 1); + } + return ret; +} + + +int64 LfuTableSharedStore::inc(CStrRef key, int64 step, bool &found) { + class IncUpdater : public Map::AtomicUpdater { + public: + IncUpdater(int64 s, bool &f, CStrRef k, LfuTableSharedStore *str) + : ret(0), step(s), found(f), key(k), store(str) {} + bool update(StringData* const &k, StoreValue &val, bool newlyCreated) { + if (val.expired()) { + return true; + } + + Variant v = val.var->toLocal(); + ret = v.toInt64() + step; + v = ret; + SharedVariant *var = store->construct(key, v); + val.var->decRef(); + val.var = var; + found = true; + return false; + } + int64 ret; + private: + int64 step; + bool &found; + CStrRef key; + LfuTableSharedStore *store; + }; + + found = false; + IncUpdater updater(step, found, key, this); + m_vars.atomicUpdate(key.get(), updater, false); + + if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats) { + ServerStats::Log("apc.inc", 1); + } + return updater.ret; +} + +bool LockedSharedStore::cas(CStrRef key, int64 old, int64 val) { + bool success = false; + lockMap(); + StoreValue *sval; + bool expired = false; + if (find(key, sval, expired)) { + Variant v = getVar(sval->var)->toLocal(); + if (v.toInt64() == old) { + v = val; + SharedVariant *var = construct(key, v); + getVar(sval->var)->decRef(); + sval->var = putVar(var); + success = true; + } + } + unlockMap(); + if (expired) { + erase(key, true); + } + + if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats) { + ServerStats::Log("apc.cas", 1); + } + return success; +} + + +bool ConcurrentTableSharedStore::cas(CStrRef key, int64 old, int64 val) { + bool success = false; + ReadLock l(m_lock); + StoreValue *sval; + { + Map::accessor acc; + if (m_vars.find(acc, key.get())) { + sval = &acc->second; + Variant v = sval->var->toLocal(); + if (v.toInt64() == old) { + v = val; + SharedVariant *var = construct(key, v); + sval->var->decRef(); + sval->var = var; + success = true; + } + } + } + + if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats) { + ServerStats::Log("apc.cas", 1); + } + return success; +} + + +bool LfuTableSharedStore::cas(CStrRef key, int64 old, int64 val) { + class CasUpdater : public Map::AtomicUpdater { + public: + CasUpdater(LfuTableSharedStore *s, CStrRef k, int64 o, int64 v) + : success(false), store(s), key(k), old(o), val(v) {} + bool update(StringData* const &k, StoreValue &sval, bool newlyCreated) { + if (sval.expired()) { + return true; + } + Variant v = sval.var->toLocal(); + if (v.toInt64() == old) { + v = val; + SharedVariant *var = store->construct(key, v); + sval.var->decRef(); + sval.var = var; + success = true; + } + return false; + } + bool success; + private: + LfuTableSharedStore *store; + CStrRef key; + int64 old; + int64 val; + }; + CasUpdater updater(this, key, old, val); + m_vars.atomicUpdate(key.get(), updater, false); + + if (RuntimeOption::EnableStats && RuntimeOption::EnableAPCStats) { + ServerStats::Log("apc.cas", 1); + } + return updater.success; +} + +static std::string appendElement(int indent, const char *name, int value) { + string ret; + for (int i = 0; i < indent; i++) { + ret += " "; + } + ret += "<"; ret += name; ret += ">"; + ret += lexical_cast(value); + ret += "\n"; + return ret; +} + +std::string SharedStore::reportStats(int &reachable, int indent) { + int expired, persistent; + count(reachable, expired, persistent); + + string ret; + ret += appendElement(indent, "Key", size()); + ret += appendElement(indent, "Persistent", persistent); + ret += appendElement(indent, "Expiration", size() - persistent); + ret += appendElement(indent, "Expired", expired); + ret += appendElement(indent, "Reachable", reachable); + return ret; +} + + +std::string LfuTableSharedStore::reportStats(int &reachable, int indent) { + string ret = SharedStore::reportStats(reachable, indent); + ret += appendElement(indent, "Immortal", m_vars.immortalCount()); + ret += appendElement(indent, "Maximum Capacity", m_vars.maximumCapacity()); + return ret; +} + +void StoreValue::set(SharedVariant *v, int64 ttl) { + var = v; + expiry = ttl ? time(NULL) + ttl : 0; +} +bool StoreValue::expired() const { + return expiry && time(NULL) >= expiry; +} + +/////////////////////////////////////////////////////////////////////////////// +// SharedStores + +SharedStores s_apc_store; + +SharedStores::SharedStores() { +} + +void SharedStores::create() { + for (int i = 0; i < MAX_SHARED_STORE; i++) { + if (RuntimeOption::ApcUseSharedMemory) { + m_stores[i] = new ProcessSharedStore(i); + } else { + switch (RuntimeOption::ApcTableType) { + case RuntimeOption::ApcHashTable: + switch (RuntimeOption::ApcTableLockType) { + case RuntimeOption::ApcMutex: + m_stores[i] = new MutexHashTableSharedStore(i); + break; + default: + m_stores[i] = new RwLockHashTableSharedStore(i); + } + break; + case RuntimeOption::ApcLfuTable: + { + time_t maturity = RuntimeOption::ApcKeyMaturityThreshold; + size_t maxCap = RuntimeOption::ApcMaximumCapacity; + int updatePeriod = RuntimeOption::ApcKeyFrequencyUpdatePeriod; + + if (i == SHARED_STORE_DNS_CACHE) { + maturity = RuntimeOption::DnsCacheKeyMaturityThreshold; + maxCap = RuntimeOption::DnsCacheMaximumCapacity; + updatePeriod = RuntimeOption::DnsCacheKeyFrequencyUpdatePeriod; + } + m_stores[i] = new LfuTableSharedStore(i, maturity, maxCap, + updatePeriod); + } + break; + case RuntimeOption::ApcConcurrentTable: + m_stores[i] = new ConcurrentTableSharedStore(i); + break; + default: + ASSERT(false); + } + } + } +} + +SharedStores::~SharedStores() { + clear(); +} + +void SharedStores::clear() { + for (int i = 0; i < MAX_SHARED_STORE; i++) { + delete m_stores[i]; + } +} + +void SharedStores::reset() { + clear(); + create(); +} + +std::string SharedStores::reportStats(int indent) { + string ret; + int totalReachable = 0; +#ifdef DEBUG_APC_LEAK + LeakDetectable::BeginLeakChecking(); +#endif + for (int i = 0; i < MAX_SHARED_STORE; i++) { + for (int j = 0; j < indent; j++) ret += " "; + ret += "\n"; + + ret += appendElement(indent + 1, "Index", i); + int reachable = 0; + ret += m_stores[i]->reportStats(reachable, indent + 1); + totalReachable += reachable; + + for (int j = 0; j < indent; j++) ret += " "; + ret += "\n"; + } +#ifdef DEBUG_APC_LEAK + ret += appendElement(indent, "TotalVariantsAllocated", + SharedVariant::TotalAllocated); + ret += appendElement(indent, "AliveVariants", + SharedVariant::TotalCount); + ret += appendElement(indent, "LeakedVariantsByReach", + SharedVariant::TotalCount - totalReachable); + + string dumps; + int leaked = LeakDetectable::EndLeakChecking(dumps, 10000); + ret += appendElement(indent, "LeakedVariantsByLeakDetectable", leaked); + ret += dumps; +#endif + return ret; +} + +void SharedStores::Create() { + s_apc_store.create(); +} + +std::string SharedStores::ReportStats(int indent) { + return s_apc_store.reportStats(indent); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/shared/shared_store.h b/src/cpp/base/shared/shared_store.h new file mode 100644 index 0000000000000..01f4d01c255bf --- /dev/null +++ b/src/cpp/base/shared/shared_store.h @@ -0,0 +1,111 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SHARED_STORE_H__ +#define __HPHP_SHARED_STORE_H__ + +#include +#include +#include +#include + +#define SHARED_STORE_APPLICATION_CACHE 0 +#define SHARED_STORE_DNS_CACHE 1 +#define MAX_SHARED_STORE 2 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class StoreValue { +public: + StoreValue() : var(NULL), expiry(0) {} + void set(SharedVariant *v, int64 ttl); + bool expired() const; + SharedVariant *var; + int64 expiry; +}; + +class SharedStore { +public: + SharedStore(int id); + virtual ~SharedStore(); + virtual void clear() = 0; + + virtual int size() = 0; + virtual void count(int &reachable, int &expired, int &persistent) = 0; + + virtual bool get(CStrRef key, Variant &value) = 0; + virtual bool store(CStrRef key, CVarRef val, int64 ttl) = 0; + bool erase(CStrRef key, bool expired = false); + virtual int64 inc(CStrRef key, int64 step, bool &found) = 0; + virtual bool cas(CStrRef key, int64 old, int64 val) = 0; + + // for priming only + virtual SharedVariant* construct(litstr str, int len, CStrRef v, + bool serialized) = 0; + virtual SharedVariant* construct(litstr str, int len, CVarRef v) = 0; + + struct KeyValuePair { + litstr key; + int len; + SharedVariant *value; + }; + virtual void prime(const std::vector &vars) = 0; + + virtual std::string reportStats(int &reachable, int indent); + virtual bool check() { return true; } + static size_t s_lockCount; + static std::string GetSkeleton(CStrRef key); +protected: + int m_id; + + virtual bool eraseImpl(CStrRef key, bool expired) = 0; + virtual SharedVariant* construct(CStrRef key, CVarRef v) = 0; + virtual SharedVariant* putVar(SharedVariant* v) const { return v; }; + virtual SharedVariant* getVar(SharedVariant* v) const { return v; }; +}; + +/////////////////////////////////////////////////////////////////////////////// + +class SharedStores { +public: + static void Create(); + static std::string ReportStats(int indent); + +public: + SharedStores(); + ~SharedStores(); + void create(); + void clear(); + void reset(); + + SharedStore& operator[](int id) { + ASSERT(id >= 0 && id < MAX_SHARED_STORE); + return *m_stores[id]; + } + + std::string reportStats(int indent); + +private: + SharedStore* m_stores[MAX_SHARED_STORE]; +}; + +extern SharedStores s_apc_store; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif /* __HPHP_SHARED_STORE_H__ */ diff --git a/src/cpp/base/shared/shared_string.cpp b/src/cpp/base/shared/shared_string.cpp new file mode 100644 index 0000000000000..dcd68b0b49739 --- /dev/null +++ b/src/cpp/base/shared/shared_string.cpp @@ -0,0 +1,71 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +SharedStringData::InternMap SharedStringData::s_intern; + +SharedStringData::SharedStringData(const std::string &data) : m_count(1), + m_data(data) {} + +int SharedStringData::decRefCount() const { + ASSERT(m_count > 0); + int cur = atomic_dec(m_count); + if (cur == 1) { + // Possibly only left in intern map + InternMap::accessor acc; + bool found = s_intern.find(acc, m_data); + ASSERT(found); + if (!found) return 1; + // Write lock on the map element, if count is still 1 then + // can erase + if (m_count == 1) { + s_intern.erase(acc); + m_count = 0; + return 0; + } + // May technically not be 1 but doesn't matter + return 1; + } + return cur; +} + +void SharedStringData::release() { + delete this; +} + +const std::string &SharedStringData::getString() const { + return m_data; +} + +void SharedStringData::Create(InternMap::accessor &acc, + const std::string &data) { + if (s_intern.insert(acc, data)) { + acc->second = new SharedStringData(acc->first); + } +} + +SharedString &SharedString::operator=(const std::string &data) { + SharedStringData::InternMap::accessor acc; + SharedStringData::Create(acc, data); + return operator=(acc->second); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/shared/shared_string.h b/src/cpp/base/shared/shared_string.h new file mode 100644 index 0000000000000..f2bf069135fad --- /dev/null +++ b/src/cpp/base/shared/shared_string.h @@ -0,0 +1,90 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_CPP_BASE_SHARED_SHARED_STRING_H__ +#define __HPHP_CPP_BASE_SHARED_SHARED_STRING_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +/** + * Interned immutable strings sharable across threads. + */ +class SharedStringData { +public: + SharedStringData(const std::string &data); + + void incRefCount() const { + atomic_inc(m_count); + } + int decRefCount() const; + void release(); + const std::string &getString() const; + + typedef tbb::concurrent_hash_map InternMap; + static void Create(InternMap::accessor &acc, const std::string &data); +protected: + mutable int m_count; + const std::string &m_data; + static InternMap s_intern; +}; + +class SharedString : public SmartPtr { +public: + SharedString() {} + SharedString(SharedStringData *px) : SmartPtr(px) {} + SharedString(const SharedString &src) : SmartPtr(src) {} + SharedString(const std::string &data) { + operator=(data); + } + SharedString(const char *data) { + operator=(data); + } + SharedString &operator=(const std::string &data); + SharedString &operator=(const char *data) { + return operator=(std::string(data)); + } +}; + +struct shared_string_eq { + bool operator()(const SharedString &s1, const SharedString &s2) const { + // Because pointers and strings are 1-1, can just compare the ptr. + return s1.get() == s2.get(); + } +}; + +struct shared_string_hash { + size_t operator()(const SharedString &s) const { + // Because pointers and strings are 1-1, can just hash the ptr. + return hash_int64((int64)s.get()); + } +}; + +template +class hphp_shared_string_map : + public hphp_hash_map { +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_CPP_BASE_SHARED_SHARED_STRING_H__ diff --git a/src/cpp/base/shared/shared_variant.cpp b/src/cpp/base/shared/shared_variant.cpp new file mode 100644 index 0000000000000..279ea00e8af20 --- /dev/null +++ b/src/cpp/base/shared/shared_variant.cpp @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +int SharedVariant::countReachable() { +#ifdef DEBUG_APC_LEAK + markReachable(); +#endif + int count = 1; + if (m_type == KindOfArray) { + int size = arrSize(); + count += size; // key count + for (int i = 0; i < size; i++) { + SharedVariant* p = getValue(i); + count += p->countReachable(); + p = getKey(i); + p->countReachable(); + } + } + return count; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/shared/shared_variant.h b/src/cpp/base/shared/shared_variant.h new file mode 100644 index 0000000000000..606302df22c7d --- /dev/null +++ b/src/cpp/base/shared/shared_variant.h @@ -0,0 +1,73 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SHARED_VARIANT_H__ +#define __HPHP_SHARED_VARIANT_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class SharedVariant +#ifdef DEBUG_APC_LEAK + : public LeakDetectable +#endif +{ +public: + SharedVariant() : m_ref(1) {} + virtual ~SharedVariant() {} + + bool is(DataType d) const { + return m_type == d; + } + + /** + * Reference counting. Needs to release memory when count == 0 in decRef(). + */ + virtual void incRef() = 0; + virtual void decRef() = 0; + + virtual Variant toLocal() = 0; + virtual bool operator<(const SharedVariant& other) const { return false; } + + virtual const char* stringData() const = 0; + virtual size_t stringLength() const = 0; + + virtual size_t arrSize() const = 0; + + virtual int getIndex(CVarRef key) = 0; + virtual SharedVariant* get(CVarRef key) = 0; + virtual bool exists(CVarRef key) = 0; + virtual void loadElems(std::vector &elems) = 0; + virtual SharedVariant* getKey(ssize_t pos) const = 0; + virtual SharedVariant* getValue(ssize_t pos) const = 0; + + int countReachable(); + + protected: + int m_ref; + DataType m_type; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif /* __HPHP_SHARED_VARIANT_H__ */ diff --git a/src/cpp/base/shared/thread_shared_variant.cpp b/src/cpp/base/shared/thread_shared_variant.cpp new file mode 100644 index 0000000000000..41b729d42a830 --- /dev/null +++ b/src/cpp/base/shared/thread_shared_variant.cpp @@ -0,0 +1,342 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +ThreadSharedVariant::ThreadSharedVariant(StringData *source) : m_owner(false) { + m_type = KindOfString; + m_data.str = source; +} + +ThreadSharedVariant::ThreadSharedVariant(int64 num) : m_owner(false) { + m_type = KindOfInt64; + m_data.num = num; +} + +ThreadSharedVariant::ThreadSharedVariant(CVarRef source, bool serialized) + : m_owner(true) { + ASSERT(!serialized || source.isString()); + + m_ref = 1; + + switch (source.getType()) { + case KindOfBoolean: + { + m_type = KindOfBoolean; + m_data.num = source.toBoolean(); + break; + } + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + { + m_type = KindOfInt64; + m_data.num = source.toInt64(); + break; + } + case KindOfDouble: + { + m_type = KindOfDouble; + m_data.dbl = source.toDouble(); + break; + } + case LiteralString: + case KindOfString: + { + String s = source.toString(); + m_type = serialized ? KindOfObject : KindOfString; + m_data.str = s->copy(true); + break; + } + case KindOfArray: + { + m_type = KindOfArray; + size_t size = source.getArrayData()->size(); + ThreadSharedVariantMapData* mapData = new ThreadSharedVariantMapData(); + ThreadSharedVariantToIntMap map; + SharedVariant** keys = new SharedVariant*[size]; + SharedVariant** vals = new SharedVariant*[size]; + + uint i = 0; + for (ArrayIterPtr it = source.begin(); !it->end(); it->next()) { + ThreadSharedVariant* key + = createAnother(it->first(), false); + ThreadSharedVariant* val + = createAnother(it->second(), false); + keys[i] = key; + vals[i] = val; + map[key] = i++; + } + m_data.map = mapData; + mapData->map.swap(map); + mapData->keys = keys; + mapData->vals = vals; + break; + } + default: + { + m_type = KindOfObject; + String s = f_serialize(source); + m_data.str = new StringData(s.data(), s.size(), CopyString); + break; + } + } +} + +Variant ThreadSharedVariant::toLocal() { + ASSERT(m_owner); + switch (m_type) { + case KindOfBoolean: + { + return (bool)m_data.num; + } + case KindOfInt64: + { + return m_data.num; + } + case KindOfDouble: + { + return m_data.dbl; + } + case KindOfString: + { + return NEW(StringData)(this); + } + case KindOfArray: + { + return NEW(SharedMap)(this); + } + default: + { + return f_unserialize(String(m_data.str->data(), m_data.str->size(), + AttachLiteral)); + } + } +} + +void ThreadSharedVariant::dump(std::string &out) { + out += "ref("; + out += boost::lexical_cast(m_ref); + out += ") "; + switch (m_type) { + case KindOfBoolean: + out += "boolean: "; + out += m_data.num ? "true" : "false"; + break; + case KindOfInt64: + out += "int: "; + out += boost::lexical_cast(m_data.num); + break; + case KindOfDouble: + out += "double: "; + out += boost::lexical_cast(m_data.dbl); + break; + case KindOfString: + out += "string("; + out += boost::lexical_cast(stringLength()); + out += "): "; + out += stringData(); + break; + case KindOfArray: + SharedMap(this).dump(out); + break; + default: + out += "object: "; + out += m_data.str->data(); + break; + } + out += "\n"; +} + +ThreadSharedVariant::~ThreadSharedVariant() { + switch (m_type) { + case KindOfString: + case KindOfObject: + if (m_owner) { + delete m_data.str; + } + break; + case KindOfArray: + { + ASSERT(m_owner); + ThreadSharedVariantMapData* map = m_data.map; + size_t size = map->map.size(); + for (size_t i = 0; i < size; i++) { + map->keys[i]->decRef(); + map->vals[i]->decRef(); + } + delete [] map->keys; + delete [] map->vals; + delete map; + } + break; + default: + break; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +bool ThreadSharedVariant::operator==(const SharedVariant& svother) const { + ThreadSharedVariant const *other = + dynamic_cast(&svother); + ASSERT(other); + if (m_type != other->m_type) { + return false; + } + switch (m_type) { + case KindOfInt64: + return m_data.num == other->m_data.num; + case KindOfString: + return m_data.str->compare(other->m_data.str) == 0; + default: + break; + } + // No other types are legitimate keys + ASSERT(false); + return false; +} + +ssize_t ThreadSharedVariant::hash() const { + switch (m_type) { + case KindOfInt64: + return hash_int64(m_data.num); + case KindOfString: + return hash_string(m_data.str->data(), m_data.str->size()); + default: + break; + } + // No other types are legitimate keys + ASSERT(false); + return -1; +} + +const char *ThreadSharedVariant::stringData() const { + ASSERT(is(KindOfString)); + return m_data.str->data(); +} + +size_t ThreadSharedVariant::stringLength() const { + ASSERT(is(KindOfString)); + return m_data.str->size(); +} + +const ThreadSharedVariantToIntMap &ThreadSharedVariant::map() const { + return m_data.map->map; +} +SharedVariant** ThreadSharedVariant::keys() const { + return m_data.map->keys; +} +SharedVariant** ThreadSharedVariant::vals() const { + return m_data.map->vals; +} + +size_t ThreadSharedVariant::arrSize() const { + return map().size(); +} + +int ThreadSharedVariant::getIndex(CVarRef key) { + ASSERT(is(KindOfArray)); + ThreadSharedVariantToIntMap::const_iterator it = lookup(key); + if (it == map().end()) { + return -1; + } + return it->second; +} + +SharedVariant* ThreadSharedVariant::get(CVarRef key) { + int idx = getIndex(key); + if (idx != -1) { + return vals()[idx]; + } + return NULL; +} + +bool ThreadSharedVariant::exists(CVarRef key) { + ASSERT(is(KindOfArray)); + ThreadSharedVariantToIntMap::const_iterator it = lookup(key); + return it != map().end(); +} + +void ThreadSharedVariant::loadElems(std::vector &elems) { + ASSERT(is(KindOfArray)); + SharedVariant** ks = keys(); + SharedVariant** vs = vals(); + uint count = map().size(); + elems.reserve(count); + for (uint i = 0; i < count; i++) { + elems.push_back(NEW(ArrayElement)(ks[i]->toLocal(), + vs[i]->toLocal())); + } +} + +ThreadSharedVariantToIntMap::const_iterator +ThreadSharedVariant::lookup(CVarRef key) { + ThreadSharedVariantToIntMap::const_iterator it; + switch (key.getType()) { + case KindOfString: { + ThreadSharedVariant svk(key.getStringData()); + it = map().find(&svk); + break; + } + case LiteralString: { + StringData sd(key.getLiteralString(), AttachLiteral); + ThreadSharedVariant svk(&sd); + it = map().find(&svk); + break; + } + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: { + int64 num = key.getNumData(); + ThreadSharedVariant svk(num); + it = map().find(&svk); + break; + } + default: + // No other types are legitimate keys + it = map().end(); + break; + } + return it; +} + +size_t ThreadSharedVariantHash::operator()(ThreadSharedVariant* v) const { + return v->hash(); +} + +ThreadSharedVariant *ThreadSharedVariant::createAnother +(CVarRef source, bool serialized) { + return new ThreadSharedVariant(source, serialized); +} + +ThreadSharedVariant *ThreadSharedVariantLockedRefs::createAnother +(CVarRef source, bool serialized) { + return new ThreadSharedVariantLockedRefs(source, serialized, m_lock); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/shared/thread_shared_variant.h b/src/cpp/base/shared/thread_shared_variant.h new file mode 100644 index 0000000000000..17257e03d7adc --- /dev/null +++ b/src/cpp/base/shared/thread_shared_variant.h @@ -0,0 +1,150 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_THREAD_SHARED_VARIANT_H__ +#define __HPHP_THREAD_SHARED_VARIANT_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class ThreadSharedVariantMapData; +class ThreadSharedVariant; +struct ThreadSharedVariantHash; + +template +class ptreq { +public: + bool operator()(const T& x, const T& y) const { + if (x && y) { + return *x == *y; + } + return x == y; + } +}; + +class ThreadSharedVariantHash { +public: + size_t operator()(ThreadSharedVariant* v) const; +}; + +typedef hphp_hash_map > ThreadSharedVariantToIntMap; + +/////////////////////////////////////////////////////////////////////////////// + +class ThreadSharedVariant : public SharedVariant { + public: + ThreadSharedVariant(CVarRef source, bool serialized); + virtual ~ThreadSharedVariant(); + + virtual void incRef() { + atomic_inc(m_ref); + } + + virtual void decRef() { + ASSERT(m_ref); + if (atomic_dec(m_ref) == 0) { + delete this; + } + } + + Variant toLocal(); + bool operator==(const SharedVariant& svother) const; + ssize_t hash() const; + + const char* stringData() const; + size_t stringLength() const; + + size_t arrSize() const; + int getIndex(CVarRef key); + SharedVariant* get(CVarRef key); + bool exists(CVarRef key); + + void loadElems(std::vector &elems); + + virtual SharedVariant* getKey(ssize_t pos) const { + ASSERT(is(KindOfArray)); + return keys()[pos]; + } + virtual SharedVariant* getValue(ssize_t pos) const { + ASSERT(is(KindOfArray)); + return vals()[pos]; + } + + // implementing LeakDetectable + virtual void dump(std::string &out); + +protected: + virtual ThreadSharedVariant *createAnother(CVarRef source, bool serialized); + +private: + union { + int64 num; + double dbl; + StringData *str; + ThreadSharedVariantMapData* map; + } m_data; + bool m_owner; + + const ThreadSharedVariantToIntMap &map() const; + SharedVariant** keys() const; + SharedVariant** vals() const; + + ThreadSharedVariant(StringData *source); + ThreadSharedVariant(int64 num); + ThreadSharedVariantToIntMap::const_iterator lookup(CVarRef key); +}; + +class ThreadSharedVariantMapData { +public: + ThreadSharedVariantToIntMap map; + SharedVariant** keys; + SharedVariant** vals; +}; + +class ThreadSharedVariantLockedRefs : public ThreadSharedVariant { +public: + ThreadSharedVariantLockedRefs(CVarRef source, bool serialized, Mutex &lock) + : ThreadSharedVariant(source, serialized), m_lock(lock) {} + + virtual void incRef() { + Lock lock(m_lock); + ++m_ref; + } + + virtual void decRef() { + Lock lock(m_lock); + ASSERT(m_ref); + if (--m_ref == 0) { + delete this; + } + } + +protected: + Mutex &m_lock; + virtual ThreadSharedVariant *createAnother(CVarRef source, bool serialized); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif /* __HPHP_THREAD_SHARED_VARIANT_H__ */ diff --git a/src/cpp/base/source_info.cpp b/src/cpp/base/source_info.cpp new file mode 100644 index 0000000000000..4d7fa1e8bd59e --- /dev/null +++ b/src/cpp/base/source_info.cpp @@ -0,0 +1,136 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +SourceInfo SourceInfo::TheSourceInfo; +SourceInfoHook *SourceInfo::s_hook = NULL; + +SourceInfo::SourceInfo() : m_loaded(false), m_source_root_len(0) { +} + +void SourceInfo::load() { + Lock lock(m_mutex); + if (!m_loaded) { + loadImpl(m_cpp2php, g_source_info); + loadImpl(m_cls2file, m_file2cls, g_source_cls2file); + loadImpl(m_func2file, m_file2func, g_source_func2file); + m_source_root_len = strlen(g_source_root); + m_loaded = true; + } +} + +bool SourceInfo::translate(StackTrace::FramePtr f) { + if (!m_loaded) load(); + + const char *file = f->filename.c_str(); + if (strncmp(g_source_root, file, m_source_root_len) == 0) { + char key[256]; + snprintf(key, sizeof(key), "%s:%d", file + m_source_root_len, f->lineno); + LocationMap::const_iterator iter = m_cpp2php.find(key); + if (iter != m_cpp2php.end()) { + f->filename = iter->second->file; + f->lineno = iter->second->line; + return true; + } + } + + return false; +} + +void SourceInfo::getDeclaredFunctions(const char *filename, + std::vector &functions) { + if (!m_loaded) load(); + + functions.clear(); + NameMap::const_iterator iter = m_file2func.find(filename); + if (iter != m_file2func.end()) { + functions = iter->second; + } +} + +void SourceInfo::getDeclaredClasses(const char *filename, + std::vector &classes) { + if (!m_loaded) load(); + + classes.clear(); + NameMap::const_iterator iter = m_file2cls.find(filename); + if (iter != m_file2cls.end()) { + classes = iter->second; + } +} + +const char *SourceInfo::getClassDeclaringFile(const char *name) { + if (!m_loaded) load(); + if (s_hook) { + const char *file = s_hook->getClassDeclaringFile(name); + if (file) return file; + } + INameMap::const_iterator iter = m_cls2file.find(name); + if (iter != m_cls2file.end()) { + return iter->second[0]; + } + return NULL; +} + +const char *SourceInfo::getFunctionDeclaringFile(const char *name) { + if (!m_loaded) load(); + if (s_hook) { + const char *file = s_hook->getFunctionDeclaringFile(name); + if (file) return file; + } + INameMap::const_iterator iter = m_func2file.find(name); + if (iter != m_func2file.end()) { + return iter->second[0]; + } + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// + +void SourceInfo::loadImpl(LocationMap &dest, const char **p) { + while (*p) { + const char *source = *p++; + const char *file = *p++; + int line = (int)(long)(*p++); + + LocationInfo *loc = new LocationInfo(); + loc->file = file; + loc->line = line; + + ASSERT(dest.find(source) == dest.end()); + dest[source] = loc; + } +} + +void SourceInfo::loadImpl(INameMap &forward, NameMap &backward, const char **p){ + while (*p) { + const char *name = *p++; + const char *file = *p++; + forward[name].push_back(file); + backward[file].push_back(name); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/source_info.h b/src/cpp/base/source_info.h new file mode 100644 index 0000000000000..f25c4f1094167 --- /dev/null +++ b/src/cpp/base/source_info.h @@ -0,0 +1,107 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SOURCE_INFO_H__ +#define __HPHP_SOURCE_INFO_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +class SourceInfoHook; + +class SourceInfo { +public: + static SourceInfo TheSourceInfo; + +public: + SourceInfo(); + + /** + * Load from static variables. + */ + void load(); + + /** + * Translate a C++ frame to PHP frame. + */ + bool translate(StackTrace::FramePtr f); + + /** + * Returns a list of functions declared in specified file. + */ + void getDeclaredFunctions(const char *filename, + std::vector &functions); + + /** + * Returns a list of classes declared in specified file. + */ + void getDeclaredClasses(const char *filename, + std::vector &classes); + + /** + * Which file contains this class/function's declaration. + */ + const char *getClassDeclaringFile(const char *name); + const char *getFunctionDeclaringFile(const char *name); + + static void SetHook(SourceInfoHook *hook) { s_hook = hook; } + +private: + Mutex m_mutex; + bool m_loaded; + int m_source_root_len; + + struct LocationInfo { + std::string file; + int line; + }; + + typedef hphp_const_char_map LocationMap; + typedef hphp_const_char_map > NameMap; + typedef hphp_const_char_imap > INameMap; + + // "file:line" in C++ code => (file, line) in PHP code + LocationMap m_cpp2php; + + // "php source file" <=> "func/class name" + INameMap m_cls2file; + NameMap m_file2cls; + INameMap m_func2file; + NameMap m_file2func; + + void loadImpl(LocationMap &dest, const char **p); + void loadImpl(INameMap &forward, NameMap &backward, const char **p); + + static SourceInfoHook *s_hook; +}; + +/** + * Interface for a hook into source info for eval. + */ +class SourceInfoHook { +public: + virtual ~SourceInfoHook() {} + virtual const char *getClassDeclaringFile(const char *name) = 0; + virtual const char *getFunctionDeclaringFile(const char *name) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_SOURCE_INFO_H__ diff --git a/src/cpp/base/string_data.cpp b/src/cpp/base/string_data.cpp new file mode 100644 index 0000000000000..628088846e203 --- /dev/null +++ b/src/cpp/base/string_data.cpp @@ -0,0 +1,442 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_SMART_ALLOCATION(StringData, SmartAllocatorImpl::NeedRestoreOnce); +/////////////////////////////////////////////////////////////////////////////// +// constructor and destructor + +StringData::StringData(const char *data, + StringDataMode mode /* = AttachLiteral */) + : m_len(0), m_data(NULL), m_shared(NULL) { + assign(data, mode); +} + +StringData::StringData(SharedVariant *shared) + : m_len(0), m_data(NULL), m_shared(NULL) { + assign(shared); +} + +StringData::StringData(const char *data, int len, StringDataMode mode) + : m_len(0), m_data(NULL), m_shared(NULL) { + assign(data, len, mode); +} + +StringData::~StringData() { + releaseData(); +} + +void StringData::releaseData() { + if ((m_len & (IsLinear | IsLiteral)) == 0) { + if (isShared()) { + m_shared->decRef(); + } else if (m_data) { + free((void*)m_data); + } + } +} + +void StringData::assign(const char *data, StringDataMode mode) { + ASSERT(data); + assign(data, strlen(data), mode); +} + +void StringData::assign(const char *data, int len, StringDataMode mode) { + ASSERT(data); + ASSERT(len >= 0); + ASSERT(mode >= 0 && mode < StringDataModeCount); + + if (len < 0 || (len & IsMask)) { + throw InvalidArgumentException("len", len); + } + + releaseData(); + m_shared = NULL; + m_len = len; + if (m_len) { + switch (mode) { + case CopyString: + { + char *buf = (char*)malloc(len + 1); + buf[len] = '\0'; + memcpy(buf, data, len); + m_data = buf; + } + break; + case AttachLiteral: + m_len |= IsLiteral; + m_data = data; + ASSERT(m_data[len] == '\0');// all PHP strings need NULL termination + break; + case AttachString: + m_data = data; + ASSERT(m_data[len] == '\0');// all PHP strings need NULL termination + break; + default: + ASSERT(false); + break; + } + } else { + if (mode == AttachString) { + free((void*)data); // we don't really need a malloc-ed empty string + } + m_len |= IsLiteral; + m_data = ""; + } + ASSERT(m_data); +} + +void StringData::assign(SharedVariant *shared) { + ASSERT(shared); + releaseData(); + shared->incRef(); + m_shared = shared; + m_data = m_shared->stringData(); + m_len = m_shared->stringLength() | IsShared; + ASSERT(m_data); +} + +void StringData::append(const char *s, int len) { + if (len == 0) return; + + if (len < 0 || (len & IsMask)) { + throw InvalidArgumentException("len", len); + } + + if (!isMalloced()) { + int newlen; + m_data = string_concat(data(), size(), s, len, newlen); + if (isShared()) { + m_shared->decRef(); + } + m_len = newlen; + } else if (m_data == s) { + int newlen; + char *newdata = string_concat(data(), size(), s, len, newlen); + releaseData(); + m_data = newdata; + m_len = newlen; + } else { + int dataLen = size(); + ASSERT((m_data > s && m_data - s > len) || + (m_data < s && s - m_data > dataLen)); // no overlapping + m_len = len + dataLen; + m_data = (const char*)realloc((void*)m_data, m_len + 1); + memcpy((void*)(m_data + dataLen), s, len); + ((char*)m_data)[m_len] = '\0'; + } +} + +StringData *StringData::copy(bool sharedMemory /* = false */) const { + if (sharedMemory) { + if (isLiteral()) { + return new StringData(m_data, size(), AttachLiteral); + } + return new StringData(m_data, size(), CopyString); + } else { + if (isLiteral()) { + return NEW(StringData)(m_data, size(), AttachLiteral); + } + return NEW(StringData)(m_data, size(), CopyString); + } +} + +void StringData::escalate() { + ASSERT(isImmutable()); + + int len = size(); + ASSERT(len); + + char *buf = (char*)malloc(len+1); + memcpy(buf, data(), len); + buf[len] = '\0'; + m_len = len; + m_data = buf; +} + +void StringData::dump() { + const char *p = data(); + int len = size(); + + printf("StringData(%d) (%s%s%s%d): [", _count, + isLiteral() ? "literal " : "", + isShared() ? "shared " : "", + isLinear() ? "linear " : "", + len); + for (int i = 0; i < len; i++) { + char ch = p[i]; + if (isprint(ch)) { + std::cout << ch; + } else { + printf("\\%02x", ch); + } + } + printf("]\n"); +} + +/////////////////////////////////////////////////////////////////////////////// +// mutations + +StringData *StringData::getChar(int offset) const { + if (offset >= 0 && offset < size()) { + char *buf = (char *)malloc(2); + buf[0] = m_data[offset]; + buf[1] = 0; + return NEW(StringData)(buf, 1, AttachString); + } + + if (RuntimeOption::ThrowNotices) { + throw UninitializedOffsetException(offset); + } + return NULL; +} + +void StringData::setChar(int offset, CStrRef substring) { + if (offset >= 0) { + int len = size(); + if (len == 0) { + // PHP will treat data as an array and we don't want to follow that. + throw OffsetOutOfRangeException(); + } + + if (offset < len) { + if (!substring.empty()) { + setChar(offset, substring.data()[0]); + } else { + removeChar(offset); + } + } else { + int newlen = offset + 1; + char *buf = (char *)malloc(newlen + 1); + memset(buf, ' ', newlen); + buf[newlen] = 0; + memcpy(buf, data(), len); + if (!substring.empty()) buf[offset] = substring.data()[0]; + assign(buf, newlen, AttachString); + } + } +} + +void StringData::setChar(int offset, char ch) { + ASSERT(offset >= 0 && offset < size()); + if (isImmutable()) { + escalate(); + } + ((char*)m_data)[offset] = ch; +} + +void StringData::removeChar(int offset) { + ASSERT(offset >= 0 && offset < size()); + int len = size(); + if (isImmutable()) { + char *data = (char*)malloc(len); + if (offset) { + memcpy(data, this->data(), offset); + } + if (offset < len - 1) { + memcpy(data + offset, this->data() + offset + 1, len - offset - 1); + } + data[len] = 0; + m_len = len; + releaseData(); + m_data = data; + } else { + m_len = ((m_len & IsMask) | (len - 1)); + memmove((void*)(m_data + offset), m_data + offset + 1, len - offset); + } +} + +void StringData::inc() { + if (empty()) { + m_len = (IsLiteral | 1); + m_data = "1"; + return; + } + if (isImmutable()) { + escalate(); + } + char *overflowed = increment_string((char *)m_data, size()); + if (overflowed) { + assign(overflowed, AttachString); + } +} + +void StringData::negate() { + if (empty()) return; + ASSERT(!isImmutable()); + char *buf = (char*)m_data; + int len = size(); + for (int i = 0; i < len; i++) { + buf[i] = ~(buf[i]); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// type conversions + +bool StringData::isNumeric() const { + int len = size(); + if (len) { + int64 lval; double dval; + DataType ret = is_numeric_string(data(), len, &lval, &dval, 0); + switch (ret) { + case KindOfNull: return false; + case KindOfInt64: + case KindOfDouble: return true; + default: + ASSERT(false); + break; + } + } + return false; +} + +bool StringData::isInteger() const { + int len = size(); + if (len) { + int64 lval; double dval; + DataType ret = is_numeric_string(data(), len, &lval, &dval, 0); + switch (ret) { + case KindOfNull: return false; + case KindOfInt64: return true; + case KindOfDouble: return false; + default: + ASSERT(false); + break; + } + } + return false; +} + +bool StringData::isValidVariableName() const { + return is_valid_var_name(data(), size()); +} + +bool StringData::toBoolean() const { + return !empty() && !isZero(); +} + +int64 StringData::toInt64(int base /* = 10 */) const { + return strtoll(data(), NULL, base); +} + +double StringData::toDouble() const { + int len = size(); + if (len) return zend_strtod(data(), NULL); + return 0; +} + +bool StringData::isStrictlyInteger(int64 &res) { + int nKeyLength = size(); + const char* arKey = data(); + return is_strictly_integer(arKey, nKeyLength, res); +} + +/////////////////////////////////////////////////////////////////////////////// +// comparisons + +int StringData::numericCompare(const StringData *v2) const { + ASSERT(v2); + + int64 lval1, lval2; + double dval1, dval2; + DataType ret1, ret2; + if ((ret1 = is_numeric_string(data(), size(), + &lval1, &dval1, 0)) == KindOfNull || + (ret1 == KindOfDouble && !finite(dval1)) || + (ret2 = is_numeric_string(v2->data(), v2->size(), + &lval2, &dval2, 0)) == KindOfNull || + (ret2 == KindOfDouble && !finite(dval2))) { + return -2; + } + if (ret1 == KindOfInt64 && ret2 == KindOfInt64) { + if (lval1 > lval2) return 1; + if (lval1 == lval2) return 0; + return -1; + } + if (ret1 == KindOfDouble && ret2 == KindOfDouble) { + if (dval1 > dval2) return 1; + if (dval1 == dval2) return 0; + return -1; + } + if (ret1 == KindOfDouble) { + ASSERT(ret2 == KindOfInt64); + dval2 = (double)lval2; + } else { + ASSERT(ret1 == KindOfInt64); + ASSERT(ret2 == KindOfDouble); + dval1 = (double)lval1; + } + + if (dval1 > dval2) return 1; + if (dval1 == dval2) return 0; + return -1; +} + +int StringData::compare(const StringData *v2) const { + ASSERT(v2); + + int ret = numericCompare(v2); + if (ret < -1) { + int len1 = size(); + int len2 = v2->size(); + int len = len1 < len2 ? len1 : len2; + ret = memcmp(data(), v2->data(), len); + if (ret) return ret; + if (len1 == len2) return 0; + return len < len1 ? 1 : -1; + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool StringData::calculate(int &totalSize) { + if (m_data && !isLiteral()) { + totalSize += (size() + 1); // ending NULL + return true; + } + return false; +} + +void StringData::backup(LinearAllocator &allocator) { + allocator.backup(m_data, size() + 1); +} + +void StringData::restore(const char *&data) { + ASSERT(!isLiteral()); + m_data = data; + m_len &= LenMask; + m_len |= IsLinear; +} + +void StringData::sweep() { + releaseData(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/string_data.h b/src/cpp/base/string_data.h new file mode 100644 index 0000000000000..ba68462cc4ed7 --- /dev/null +++ b/src/cpp/base/string_data.h @@ -0,0 +1,138 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_STRING_DATA_H__ +#define __HPHP_STRING_DATA_H__ + +#include +#include +#include + +namespace HPHP { + +class SharedVariant; +/////////////////////////////////////////////////////////////////////////////// + +/** + * Inner data class for String type. As a coding guideline, String and + * StringOffset classes should delegate real string work to this class, + * although both String and StringOffset classes are more than welcome to test + * nullability to avoid calling this class. + */ +class StringData : public Countable { +private: + enum BitMask { + IsLiteral = (1 << 31), // literal string + IsShared = (1 << 30), // shared memory string + IsLinear = (1 << 29), // linear allocator's memory + + IsMask = IsLiteral | IsShared | IsLinear, + LenMask = ~IsMask, + }; + +public: + StringData() : m_len(0), m_data(NULL), m_shared(NULL) { + } + + /** + * Different ways of constructing StringData. Default constructor at above + * is actually only for SmartAllocator to pre-allocate the objects. + */ + StringData(const char *data, StringDataMode mode = AttachLiteral); + StringData(const char *data, int len, StringDataMode mode); + StringData(SharedVariant *shared); + void assign(const char *data, StringDataMode mode); + void assign(const char *data, int len, StringDataMode mode); + void assign(SharedVariant *shared); + void append(const char *s, int len); + StringData *copy(bool sharedMemory = false) const; + + ~StringData(); + + /** + * Informational. + */ + const char *data() const { return m_data;} + int size() const { return m_len & LenMask;} + bool empty() const { return size() == 0;} + bool isLiteral() const { return m_len & IsLiteral;} + bool isShared() const { return m_len & IsShared;} + bool isLinear() const { return m_len & IsLinear;} + bool isMalloced() const { return (m_len & IsMask) == 0 && m_data;} + bool isImmutable() const { return m_len & (IsLiteral | IsShared | IsLinear);} + bool isNumeric() const; + bool isInteger() const; + bool isStrictlyInteger(int64 &res); + bool isZero() const { return size() == 1 && m_data[0] == '0'; } + bool isValidVariableName() const; + + /** + * Mutations. + */ + StringData *getChar(int offset) const; + void setChar(int offset, CStrRef substring); + void inc(); + void negate(); + + /** + * Type conversion functions. + */ + bool toBoolean() const; + char toByte (int base = 10) const { return toInt64(base);} + short toInt16 (int base = 10) const { return toInt64(base);} + int toInt32 (int base = 10) const { return toInt64(base);} + int64 toInt64 (int base = 10) const; + double toDouble () const; + + /** + * Comparisons. + */ + int compare(const StringData *v2) const; + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION(StringData, SmartAllocatorImpl::NeedRestoreOnce); + bool calculate(int &size); + void backup(LinearAllocator &allocator); + void restore(const char *&data); + void sweep(); + void dump(); + + private: + /** + * This order is significant. Countable has a 32-bit _count member, so we + * need to stack up small data members before m_data. + */ + mutable unsigned int m_len; + const char *m_data; + SharedVariant *m_shared; + + void releaseData(); + + /** + * Helpers. + */ + int numericCompare(const StringData *v2) const; + void escalate(); // change to malloc-ed string + void setChar(int offset, char ch); + void removeChar(int offset); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_STRING_DATA_H__ diff --git a/src/cpp/base/string_offset.cpp b/src/cpp/base/string_offset.cpp new file mode 100644 index 0000000000000..0b5ce4ae4042e --- /dev/null +++ b/src/cpp/base/string_offset.cpp @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +StringOffset::operator String() const { + return m_data->getChar(m_offset); +} + +StringOffset &StringOffset::operator=(CVarRef v) { + m_data->setChar(m_offset, v.toString()); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/string_offset.h b/src/cpp/base/string_offset.h new file mode 100644 index 0000000000000..2b5c32493708c --- /dev/null +++ b/src/cpp/base/string_offset.h @@ -0,0 +1,67 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_STRING_OFFSET_H__ +#define __HPHP_STRING_OFFSET_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Handles sub-string expressions. This class should delegate all real work to + * StringData. + */ +class StringOffset { + public: + /** + * Constructor. "offset" is where we are at in the string. + */ + StringOffset(StringData *data, int offset) + : m_data(data), m_offset(offset) { + ASSERT(m_data); + } + + /** + * Get r-value of this offset object. + */ + operator String() const; + + /** + * Get l-value of this offset object. Well, not quite, since this is illegal. + */ + String &lval() const { + throw InvalidOperandException("taking l-value of a string offset"); + } + + /** + * Assignement operator. Almost the whole purpose for having this offset + * class. + */ + StringOffset &operator=(CVarRef v); + + private: + StringData *m_data; + int m_offset; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_STRING_OFFSET_H__ diff --git a/src/cpp/base/string_util.cpp b/src/cpp/base/string_util.cpp new file mode 100644 index 0000000000000..79b86764b7a5c --- /dev/null +++ b/src/cpp/base/string_util.cpp @@ -0,0 +1,500 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// manipulations + +String StringUtil::ToLower(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_to_lower(input.data(), len); + return String(ret, len, AttachString); +} + +String StringUtil::ToUpper(CStrRef input, ToUpperType type /*= ToUpperAll */) { + if (input.empty()) return input; + + int len = input.size(); + char *ret = NULL; + switch (type) { + case ToUpperAll: + ret = string_to_upper(input.data(), len); + break; + case ToUpperFirst: + ret = string_to_upper_first(input.data(), len); + break; + case ToUpperWords: + ret = string_to_upper_words(input.data(), len); + break; + default: + ASSERT(false); + break; + } + return String(ret, len, AttachString); +} + +String StringUtil::Trim(CStrRef input, TrimType type /* = TrimBoth */, + CStrRef charlist /* = k_HPHP_TRIM_CHARLIST */) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_trim(input.data(), len, + charlist.data(), charlist.length(), type); + return String(ret, len, AttachString); +} + +String StringUtil::Pad(CStrRef input, int final_length, + CStrRef pad_string /* = " " */, + PadType type /* = PadRight */) { + int len = input.size(); + char *ret = string_pad(input.data(), len, final_length, pad_string.data(), + pad_string.size(), type); + return String(ret, len, AttachString); +} + +String StringUtil::Reverse(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + return String(string_reverse(input.data(), len), len, AttachString); +} + +String StringUtil::Repeat(CStrRef input, int count) { + if (count < 0) { + throw InvalidArgumentException("count", count); + } + if (count == 0) { + return ""; + } + if (!input.empty()) { + int len = input.size(); + char *ret = string_repeat(input.data(), len, count); + if (ret) { + return String(ret, len, AttachString); + } + } + return input; +} + +String StringUtil::Shuffle(CStrRef input) { + if (!input.empty()) { + int len = input.size(); + char *ret = string_shuffle(input.data(), len); + if (ret) { + return String(ret, len, AttachString); + } + } + return input; +} + +String StringUtil::StripHTMLTags(CStrRef input, + CStrRef allowable_tags /* = "" */) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_strip_tags(input.data(), len, allowable_tags.data(), + allowable_tags.size()); + return String(ret, len, AttachString); +} + +String StringUtil::WordWrap(CStrRef input, int width, + CStrRef wordbreak /* = "\n" */, + bool cut /* = false */) { + if (!input.empty()) { + int len = input.size(); + char *ret = string_wordwrap(input.data(), len, width, wordbreak.data(), + wordbreak.size(), cut); + if (ret) { + return String(ret, len, AttachString); + } + } + return input; +} + +/////////////////////////////////////////////////////////////////////////////// +// splits/joins + +Array StringUtil::Explode(CStrRef input, CStrRef delimiter, + int limit /* = 0x7FFFFFFF */) { + if (delimiter.empty()) { + throw InvalidArgumentException("delimiter", "(empty)"); + } + + Array ret; + int pos = input.find(delimiter); + if (limit >= 0) { + if (pos < 0) { + ret.append(input); + } else { + int len = delimiter.size(); + int pos0 = 0; + do { + ret.append(input.substr(pos0, pos - pos0)); + pos += len; + pos0 = pos; + } while ((pos = input.find(delimiter, pos)) >= 0 && --limit > 1); + + if (pos0 <= input.size()) { + ret.append(input.substr(pos0)); + } + } + } else if (pos >= 0) { + vector positions; + int len = delimiter.size(); + int pos0 = 0; + int found = 0; + do { + positions.push_back(pos0); + positions.push_back(pos - pos0); + pos += len; + pos0 = pos; + found++; + } while ((pos = input.find(delimiter, pos)) >= 0); + + if (pos0 <= input.size()) { + positions.push_back(pos0); + positions.push_back(input.size() - pos0); + found++; + } + int iMax = (found + limit) << 1; + for (int i = 0; i < iMax; i += 2) { + ret.append(input.substr(positions[i], positions[i+1])); + } + + } // else we have negative limit and delimiter not found, returning empty arr + + return ret; +} + +String StringUtil::Implode(CArrRef items, CStrRef delim) { + int size = items.size(); + if (size == 0) return ""; + + vector sitems; + sitems.reserve(size); + int len = 0; + int lenDelim = delim.size(); + for (ArrayIter iter(items); iter; ++iter) { + String item = iter.second().toString(); + sitems.push_back(item); + len += lenDelim; + len += item.size(); + } + len -= lenDelim; // always one delimiter less than count of items + ASSERT((int)sitems.size() == size); + + char *buffer = (char *)malloc(len + 1); + const char *sdelim = delim.data(); + char *p = buffer; + for (int i = 0; i < size; i++) { + String &item = sitems[i]; + if (i && lenDelim) { + memcpy(p, sdelim, lenDelim); + p += lenDelim; + } + int lenItem = item.size(); + if (lenItem) { + memcpy(p, item.data(), lenItem); + p += lenItem; + } + } + *p = '\0'; + ASSERT(p - buffer == len); + return String(buffer, len, AttachString); +} + +Array StringUtil::Split(CStrRef str, int split_length /* = 1 */) { + if (split_length <= 0) { + throw InvalidArgumentException("split_length", "(non-positive)"); + } + + Array ret; + int len = str.size(); + if (split_length >= len) { + ret.append(str); + } else { + for (int i = 0; i < len; i += split_length) { + ret.append(str.substr(i, split_length)); + } + } + return ret; +} + +String StringUtil::ChunkSplit(CStrRef body, int chunklen /* = 76 */, + CStrRef end /* = "\r\n" */) { + if (chunklen <= 0) { + throw InvalidArgumentException("chunklen", "(non-positive)"); + } + + String ret; + int len = body.size(); + if (chunklen >= len) { + ret = body; + ret += end; + } else { + char *chunked = string_chunk_split(body.data(), len, end, end.size(), + chunklen); + return String(chunked, len, AttachString); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// encoding/decoding + +String StringUtil::CEncode(CStrRef input, CStrRef charlist) { + String chars = charlist; + if (chars.isNull()) { + chars = String("\\\x00\x01..\x1f\x7f..\xff", 10, AttachLiteral); + } + if (input.empty() || chars.empty()) return input; + int len = input.size(); + char *ret = string_addcslashes(input, len, chars.data(), chars.size()); + return String(ret, len, AttachString); +} + +String StringUtil::CDecode(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_stripcslashes(input, len); + return String(ret, len, AttachString); +} + +String StringUtil::SqlEncode(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_addslashes(input, len); + return String(ret, len, AttachString); +} + +String StringUtil::SqlDecode(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_stripslashes(input, len); + return String(ret, len, AttachString); +} + +String StringUtil::RegExEncode(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_quotemeta(input, len); + return String(ret, len, AttachString); +} + +String StringUtil::HtmlEncode(CStrRef input, QuoteStyle quoteStyle) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_html_encode(input, len, quoteStyle != NoQuotes, + quoteStyle == BothQuotes); + return String(ret, len, AttachString); +} + +String StringUtil::HtmlDecode(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_html_decode(input, len); + return String(ret, len, AttachString); +} + +String StringUtil::QuotedPrintableEncode(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_quoted_printable_encode(input, len); + return String(ret, len, AttachString); +} + +String StringUtil::QuotedPrintableDecode(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_quoted_printable_decode(input, len); + return String(ret, len, AttachString); +} + +String StringUtil::HexEncode(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_bin2hex(input, len); + return String(ret, len, AttachString); +} + +String StringUtil::HexDecode(CStrRef input) { + if (input.empty()) return input; + int len = input.size(); + char *ret = string_hex2bin(input, len); + return String(ret, len, AttachString); +} + +String StringUtil::UUEncode(CStrRef input) { + if (input.empty()) return input; + + int len; + char *encoded = string_uuencode(input, input.size(), len); + return String(encoded, len, AttachString); +} + +String StringUtil::UUDecode(CStrRef input) { + if (!input.empty()) { + int len; + char *decoded = string_uudecode(input.data(), input.size(), len); + if (decoded) { + return String(decoded, len, AttachString); + } + } + return String(); +} + +String StringUtil::Base64Encode(CStrRef input) { + int len = input.size(); + char *ret = string_base64_encode(input.data(), len); + return String(ret, len, AttachString); +} + +String StringUtil::Base64Decode(CStrRef input, bool strict /* = false */) { + int len = input.size(); + char *ret = string_base64_decode(input.data(), len, strict); + return String(ret, len, AttachString); +} + +String StringUtil::UrlEncode(CStrRef input, bool encodePlus /* = true */) { + int len = input.size(); + char *ret; + if (encodePlus) { + ret = url_encode(input.data(), len); + } else { + ret = url_raw_encode(input.data(), len); + } + return String(ret, len, AttachString); +} + +String StringUtil::UrlDecode(CStrRef input, bool decodePlus /* = true */) { + int len = input.size(); + char *ret; + if (decodePlus) { + ret = url_decode(input.data(), len); + } else { + ret = url_raw_decode(input.data(), len); + } + return String(ret, len, AttachString); +} + +/////////////////////////////////////////////////////////////////////////////// +// formatting + +String StringUtil::MoneyFormat(const char *format, double value) { + ASSERT(format); + char *formatted = string_money_format(format, value); + return String(formatted, AttachString); +} + +/////////////////////////////////////////////////////////////////////////////// +// hashing + +String StringUtil::Translate(CStrRef input, CStrRef from, CStrRef to) { + if (input.empty()) return input; + + if (from.empty()) { + throw InvalidArgumentException("from", "(empty)"); + } + if (from.size() != to.size()) { + throw InvalidArgumentException("from and to", "(different sizes)"); + } + + int len = input.size(); + char *ret = (char *)malloc(len + 1); + memcpy(ret, input, len); + ret[len] = '\0'; + + string_translate(ret, len, from, to, from.size()); + return String(ret, len, AttachString); +} + +String StringUtil::ROT13(CStrRef input) { + if (input.empty()) return input; + return String(string_rot13(input, input.size()), input.size(), AttachString); +} + +int64 StringUtil::CRC32(CStrRef input) { + return string_crc32(input, input.size()); +} + +String StringUtil::Crypt(CStrRef input, const char *salt /* = "" */) { + return String(string_crypt(input, salt), AttachString); +} + +String StringUtil::MD5(CStrRef input, bool raw /* = false */) { + int len; + char *ret = string_md5(input, input.size(), raw, len); + return String(ret, len, AttachString); +} + +String StringUtil::SHA1(CStrRef input, bool raw /* = false */) { + int len; + char *ret = string_sha1(input, input.size(), raw, len); + return String(ret, len, AttachString); +} + +void StringUtil::InitLiteralStrings(StaticString literalStrings[], + int nliteralStrings, + const char *literalStringBuf, + int literalStringBufSize, + const char *literalStringLen, + int literalStringLenSize) { + int bufSize = literalStringBufSize; + int lenSize = literalStringLenSize; + static char *uncompressedBuf; // permanently allocated + char *uncompressedLen; + if (uncompressedBuf) { + throw Exception("StringUtil::InitLiteralStrings called twice"); + } + uncompressedBuf = gzdecode(literalStringBuf, bufSize); + if (uncompressedBuf == NULL) { + throw Exception("Bad literalStringBuf %p", literalStringBuf); + } + uncompressedLen = gzdecode(literalStringLen, lenSize); + if (uncompressedLen == NULL) { + throw Exception("Bad literalStringLen %p", literalStringLen); + } + + const char *pb = uncompressedBuf; + const char *pl = uncompressedLen; + const char *endBuf = pb + bufSize; + const char *endLen = pl + lenSize; + + for (int i = 0; i < nliteralStrings; i++) { + int size; + memcpy(&size, pl, sizeof(size)); + literalStrings[i] = StaticString(pb, size); + pb += size; + ASSERT(*pb == '\0'); + pb++; + pl += sizeof(size); + } + if (pb != endBuf) { + throw Exception("Bad literalStringBuf %p", literalStringBuf); + } + if (pl != endLen) { + throw Exception("Bad literalStringLen %p", literalStringLen); + } + free(uncompressedLen); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/string_util.h b/src/cpp/base/string_util.h new file mode 100644 index 0000000000000..da2a9cb0b79d7 --- /dev/null +++ b/src/cpp/base/string_util.h @@ -0,0 +1,136 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_STRING_UTIL_H__ +#define __HPHP_STRING_UTIL_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Utility string functions. These are mostly wrappers around zend/ string + * functions, but in a safe and convenient form. + */ +class StringUtil { +public: + enum ToUpperType { + ToUpperAll, + ToUpperFirst, + ToUpperWords, + }; + + enum TrimType { + TrimLeft = 1, + TrimRight = 2, + TrimBoth = 3, + }; + + enum PadType { + PadLeft = 0, + PadRight = 1, + PadBoth = 2, + }; + + enum QuoteStyle { + DoubleQuotes = 2, // k_ENT_COMPAT: escape double quotes only + BothQuotes = 3, // k_ENT_QUOTES: escape both double and single quotes + NoQuotes = 0, // k_ENT_NOQUOTES: leave all quotes alone + }; + +public: + /** + * Manipulations. Note, all these functions will create a new string than + * modifying input, although names of these functions sound like mutating. + */ + static String ToLower(CStrRef input); + static String ToUpper(CStrRef input, ToUpperType type = ToUpperAll); + static String Trim(CStrRef input, TrimType type = TrimBoth, + CStrRef charlist = k_HPHP_TRIM_CHARLIST); + static String Pad(CStrRef input, int final_length, + CStrRef pad_string = " ", PadType type = PadRight); + static String Reverse(CStrRef input); + static String Repeat(CStrRef input, int count); + static String Shuffle(CStrRef input); + static String StripHTMLTags(CStrRef input, CStrRef allowable_tags = ""); + static String WordWrap(CStrRef input, int width, + CStrRef wordbreak = "\n", bool cut = false); + + /** + * Split/joins. + */ + static Array Explode(CStrRef input, CStrRef delimiter, + int limit = 0x7FFFFFFF); + static String Implode(CArrRef items, CStrRef delim); // == Join() + static Array Split(CStrRef str, int split_length = 1); + static String ChunkSplit(CStrRef body, int chunklen = 76, + CStrRef end = "\r\n"); // for email (rfc822/2822) + + /** + * Encoding/decoding. + */ + static String CEncode(CStrRef input, CStrRef charlist); + static String CDecode(CStrRef input); + static String SqlEncode(CStrRef input); + static String SqlDecode(CStrRef input); + static String RegExEncode(CStrRef input); + static String HtmlEncode(CStrRef input, QuoteStyle quoteStyle); + static String HtmlDecode(CStrRef input); + static String QuotedPrintableEncode(CStrRef input); + static String QuotedPrintableDecode(CStrRef input); + static String HexEncode(CStrRef input); + static String HexDecode(CStrRef input); + static String UUEncode(CStrRef input); + static String UUDecode(CStrRef input); + static String Base64Encode(CStrRef input); + static String Base64Decode(CStrRef input, bool strict = false); + static String UrlEncode(CStrRef input, bool encodePlus = true); + static String UrlDecode(CStrRef input, bool decodePlus = true); + + /** + * Formatting. + */ + static String MoneyFormat(const char *format, double value); + + /** + * Hashing + */ + static String Translate(CStrRef input, CStrRef from, CStrRef to); + static String ROT13(CStrRef input); + static int64 CRC32(CStrRef input); + static String Crypt(CStrRef input, const char *salt = ""); + static String MD5(CStrRef input, bool raw = false); + static String SHA1(CStrRef input, bool raw = false); + + /** + * Construct literal strings from input data. + */ + static void InitLiteralStrings(StaticString literalStrings[], + int nliteralStrings, + const char *literalStringBuf, + int literalStringBufSize, + const char *literalStringLen, + int literalStringLenSize); + +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_STRING_UTIL_H__ diff --git a/src/cpp/base/time/datetime.cpp b/src/cpp/base/time/datetime.cpp new file mode 100644 index 0000000000000..18d1e1af170c0 --- /dev/null +++ b/src/cpp/base/time/datetime.cpp @@ -0,0 +1,846 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP(DateTime); +/////////////////////////////////////////////////////////////////////////////// +// statics + +const char *DateTime::DateFormatRFC822 = "D, d M y H:i:s O"; +const char *DateTime::DateFormatRFC822n = "D, d M y H:i:s T"; +const char *DateTime::DateFormatRFC850 = "l, d-M-y H:i:s T"; +const char *DateTime::DateFormatRFC1036 = "D, d M y H:i:s O"; +const char *DateTime::DateFormatRFC1123 = "D, d M Y H:i:s O"; +const char *DateTime::DateFormatRFC2822 = "D, d M Y H:i:s O"; +const char *DateTime::DateFormatRFC3339 = "Y-m-d\\TH:i:sP"; +const char *DateTime::DateFormatISO8601 = "Y-m-d\\TH:i:sO"; +const char *DateTime::DateFormatCookie = "D, d-M-Y H:i:s T"; + +const char *DateTime::MonthNames[] = { + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" +}; + +const char *DateTime::ShortMonthNames[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" +}; + +const char *DateTime::WeekdayNames[] = { + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" +}; + +const char *DateTime::ShortWeekdayNames[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" +}; + +const char *DateTime::GetWeekdayName(int y, int m, int d) { + int day_of_week = timelib_day_of_week(y, m, d); + if (day_of_week < 0) { + return "Unknown"; + } + return WeekdayNames[day_of_week]; +} + +const char *DateTime::GetShortWeekdayName(int y, int m, int d) { + int day_of_week = timelib_day_of_week(y, m, d); + if (day_of_week < 0) { + return "Unknown"; + } + return ShortWeekdayNames[day_of_week]; +} + +const char *DateTime::OrdinalSuffix(int number) { + if (number >= 10 && number <= 19) { + return "th"; + } + switch (number % 10) { + case 1: return "st"; + case 2: return "nd"; + case 3: return "rd"; + } + return "th"; +} + +bool DateTime::IsLeap(int year) { + return timelib_is_leap(year); +} + +int DateTime::DaysInMonth(int y, int m) { + return timelib_days_in_month(y, m); +} + +bool DateTime::IsValid(int y, int m, int d) { + return y >= 1 && y <= 32767 && m >= 1 && m <= 12 && d >= 1 && + d <= timelib_days_in_month(y, m); +} + +SmartObject DateTime::Current(bool utc /* = false */) { + return NEW(DateTime)(time(0), utc); +} + +#define PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(name, elem) \ + if ((int)parsed_time->elem == -99999) { \ + ret.set(#name, false); \ + } else { \ + ret.set(#name, (int)parsed_time->elem); \ + } + +Array DateTime::Parse(CStrRef datetime) { + struct timelib_error_container *error; + timelib_time *parsed_time = + timelib_strtotime((char*)datetime.data(), datetime.size(), &error, + TimeZone::GetDatabase()); + + Array ret; + PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(year, y); + PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(month, m); + PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(day, d); + PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(hour, h); + PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i); + PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s); + + if (parsed_time->f == -99999) { + ret.set("fraction", false); + } else { + ret.set("fraction", parsed_time->f); + } + + { + ret.set("warning_count", error->warning_count); + Array element; + for (int i = 0; i < error->warning_count; i++) { + element.set(error->warning_messages[i].position, + String(error->warning_messages[i].message, CopyString)); + } + ret.set("warnings", element); + } + { + ret.set("error_count", error->error_count); + Array element; + for (int i = 0; i < error->error_count; i++) { + element.set(error->error_messages[i].position, + String(error->error_messages[i].message, CopyString)); + } + ret.set("errors", element); + } + timelib_error_container_dtor(error); + + ret.set("is_localtime", (bool)parsed_time->is_localtime); + if (parsed_time->is_localtime) { + PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone_type, zone_type); + switch (parsed_time->zone_type) { + case TIMELIB_ZONETYPE_OFFSET: + PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone, z); + ret.set("is_dst", (bool)parsed_time->dst); + break; + case TIMELIB_ZONETYPE_ID: + if (parsed_time->tz_abbr) { + ret.set("tz_abbr", String(parsed_time->tz_abbr, CopyString)); + } + if (parsed_time->tz_info) { + ret.set("tz_id", String(parsed_time->tz_info->name, CopyString)); + } + break; + case TIMELIB_ZONETYPE_ABBR: + PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone, z); + ret.set("is_dst", (bool)parsed_time->dst); + ret.set("tz_abbr", String(parsed_time->tz_abbr, CopyString)); + break; + } + } + + { + Array element; + if (parsed_time->have_relative) { + element.set("year", parsed_time->relative.y); + element.set("month", parsed_time->relative.m); + element.set("day", parsed_time->relative.d); + element.set("hour", parsed_time->relative.h); + element.set("minute", parsed_time->relative.i); + element.set("second", parsed_time->relative.s); + } + if (parsed_time->have_weekday_relative) { + element.set("weekday", parsed_time->relative.weekday); + } + if (parsed_time->have_relative || parsed_time->have_weekday_relative) { + ret.set("relative", element); + } + } + + timelib_time_dtor(parsed_time); + return ret; +} + +Array DateTime::Parse(CStrRef ts, CStrRef format) { + struct tm parsed_time; + memset(&parsed_time, 0, sizeof(parsed_time)); + char *unparsed_part = strptime(ts.data(), format.data(), &parsed_time); + if (unparsed_part == NULL) { + return Array(); + } + + Array ret; + ret.set("tm_sec", parsed_time.tm_sec); + ret.set("tm_min", parsed_time.tm_min); + ret.set("tm_hour", parsed_time.tm_hour); + ret.set("tm_mday", parsed_time.tm_mday); + ret.set("tm_mon", parsed_time.tm_mon); + ret.set("tm_year", parsed_time.tm_year); + ret.set("tm_wday", parsed_time.tm_wday); + ret.set("tm_yday", parsed_time.tm_yday); + ret.set("unparsed", String(unparsed_part, CopyString)); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// constructors + +DateTime::DateTime() : m_timestamp(-1), m_timestampSet(false) { + m_time = TimePtr(timelib_time_ctor(), time_deleter()); + setTimezone(TimeZone::Current()); +} + +DateTime::DateTime(int64 timestamp, bool utc /* = false */) { + fromTimeStamp(timestamp, utc); +} + +void DateTime::fromTimeStamp(int64 timestamp, bool utc /* = false */) { + m_timestamp = timestamp; + m_timestampSet = true; + + timelib_time *t = timelib_time_ctor(); + if (utc) { + timelib_unixtime2gmt(t, (timelib_sll)m_timestamp); + } else { + m_tz = TimeZone::Current(); + t->tz_info = m_tz->get(); + t->zone_type = TIMELIB_ZONETYPE_ID; + timelib_unixtime2local(t, (timelib_sll)m_timestamp); + } + m_time = TimePtr(t, time_deleter()); +} + +void DateTime::sweep() { + m_time.reset(); +} + +/////////////////////////////////////////////////////////////////////////////// +// informational + +int DateTime::beat() const { + int retval = (((((long)m_time->sse)-(((long)m_time->sse) - + ((((long)m_time->sse) % 86400) + + 3600))) * 10) / 864); + while (retval < 0) { + retval += 1000; + } + retval = retval % 1000; + return retval; +} + +int DateTime::dow() const { + return timelib_day_of_week(year(), month(), day()); +} + +int DateTime::doy() const { + return timelib_day_of_year(year(), month(), day()); +} + +int DateTime::isoWeek() const { + timelib_sll iw, iy; + timelib_isoweek_from_date(year(), month(), day(), &iw, &iy); + return iw; +} + +int DateTime::isoYear() const { + timelib_sll iw, iy; + timelib_isoweek_from_date(year(), month(), day(), &iw, &iy); + return iy; +} + +int DateTime::isoDow() const { + return timelib_iso_day_of_week(year(), month(), day()); +} + +int DateTime::offset() const { + if (local()) { + switch (m_time->zone_type) { + case TIMELIB_ZONETYPE_ABBR: + case TIMELIB_ZONETYPE_OFFSET: + return (m_time->z - (m_time->dst * 60)) * -60; + default: + { + bool error; + timelib_time_offset *offset = + timelib_get_time_zone_info(toTimeStamp(error), m_tz->get()); + int ret = offset->offset; + timelib_time_offset_dtor(offset); + return ret; + } + } + } + return 0; +} + +const char *DateTime::weekdayName() const { + return GetWeekdayName(year(), month(), day()); +} + +const char *DateTime::shortWeekdayName() const { + return GetShortWeekdayName(year(), month(), day()); +} + +const char *DateTime::monthName() const { + return MonthNames[month() - 1]; +} + +const char *DateTime::shortMonthName() const { + return ShortMonthNames[month() - 1]; +} + +/////////////////////////////////////////////////////////////////////////////// +// modifications + +void DateTime::update() { + if (utc()) { + timelib_update_ts(m_time.get(), NULL); + } else { + timelib_update_ts(m_time.get(), m_tz->get()); + } + m_timestamp = 0; + m_timestampSet = false; +} + +void DateTime::set(int hou, int min, int sec, int mon, int day, int yea) { + /* Fill in the new data */ + if (yea >= 0) { + if (yea < 70) { + yea += 2000; + } else if (yea >= 70 && yea <= 110) { + yea += 1900; + } + m_time->y = yea; + } + if (day >= 0) m_time->d = day; + if (mon >= 0) m_time->m = mon; + if (sec >= 0) m_time->s = sec; + if (min >= 0) m_time->i = min; + if (hou >= 0) m_time->h = hou; + update(); +} + +void DateTime::setDate(int y, int m, int d) { + m_time->y = y; + m_time->m = m; + m_time->d = d; + update(); +} + +void DateTime::setISODate(int y, int w, int d /* = 1 */) { + m_time->y = y; + m_time->m = 1; + m_time->d = 1; + m_time->relative.d = timelib_daynr_from_weeknr(y, w, d); + m_time->have_relative = 1; + update(); +} + +void DateTime::setTime(int hour, int minute, int second) { + m_time->h = hour; + m_time->i = minute; + m_time->s = second; + update(); +} + +void DateTime::setTimezone(SmartObject timezone) { + m_tz = timezone->cloneTimeZone(); + timelib_set_timezone(m_time.get(), m_tz->get()); + timelib_unixtime2local(m_time.get(), m_time->sse); +} + +void DateTime::modify(CStrRef diff) { + timelib_time *tmp_time = timelib_strtotime((char*)diff.data(), diff.size(), + NULL, TimeZone::GetDatabase()); + m_time->relative.y = tmp_time->relative.y; + m_time->relative.m = tmp_time->relative.m; + m_time->relative.d = tmp_time->relative.d; + m_time->relative.h = tmp_time->relative.h; + m_time->relative.i = tmp_time->relative.i; + m_time->relative.s = tmp_time->relative.s; + m_time->relative.weekday = tmp_time->relative.weekday; + m_time->have_relative = tmp_time->have_relative; + m_time->have_weekday_relative = tmp_time->have_weekday_relative; + m_time->sse_uptodate = 0; + timelib_time_dtor(tmp_time); + update(); + timelib_update_from_sse(m_time.get()); +} + +/////////////////////////////////////////////////////////////////////////////// +// conversions + +void DateTime::toTm(struct tm &ta) const { + ta.tm_sec = second(); + ta.tm_min = minute(); + ta.tm_hour = hour(); + ta.tm_mday = day(); + ta.tm_mon = month() - 1; + ta.tm_year = year() - 1900; + ta.tm_wday = dow(); + ta.tm_yday = doy(); + if (utc()) { + ta.tm_isdst = 0; + ta.tm_gmtoff = 0; + ta.tm_zone = "GMT"; + } else { + timelib_time_offset *offset = + timelib_get_time_zone_info(m_time->sse, m_time->tz_info); + ta.tm_isdst = offset->is_dst; + ta.tm_gmtoff = offset->offset; + ta.tm_zone = offset->abbr; + timelib_time_offset_dtor(offset); + } +} + +int64 DateTime::toTimeStamp(bool &err) const { + err = false; + if (!m_timestampSet) { + int error; + m_timestamp = timelib_date_to_int(m_time.get(), &error); + if (error) { + err = true; + } else { + m_timestampSet = true; + } + } + return m_timestamp; +} + +int64 DateTime::toInteger(char format) const { + bool error; + switch (format) { + case 'd': + case 'j': return day(); + case 'w': return dow(); + case 'z': return doy(); + case 'W': return isoWeek(); + case 'm': + case 'n': return month(); + case 't': return DaysInMonth(year(), month()); + case 'L': return DateTime::IsLeap(year()); + case 'y': return (year() % 100); + case 'Y': return year(); + case 'B': return beat(); + case 'g': + case 'h': return hour12(); + case 'H': + case 'G': return hour(); + case 'i': return minute(); + case 's': return second(); + case 'I': return (!utc() && m_tz->dst(toTimeStamp(error))) ? 1 : 0; + case 'Z': return utc() ? 0 : m_tz->offset(toTimeStamp(error)); + case 'U': return toTimeStamp(error); + } + throw InvalidArgumentException("unknown format char", (int)format); +} + +String DateTime::toString(CStrRef format, bool stdc /* = false */) const { + if (format.empty()) { + throw ArgumentMissingException("format"); + } + return stdc ? stdcFormat(format) : rfcFormat(format); +} + +String DateTime::toString(DateFormat format) const { + switch (format) { + case RFC822: return rfcFormat(DateFormatRFC822); + case RFC822n: return rfcFormat(DateFormatRFC822n); + case RFC850: return rfcFormat(DateFormatRFC850); + case RFC1036: return rfcFormat(DateFormatRFC1036); + case RFC1123: return rfcFormat(DateFormatRFC1123); + case RFC2822: return rfcFormat(DateFormatRFC2822); + case RFC3339: return rfcFormat(DateFormatRFC3339); + case ISO8601: return rfcFormat(DateFormatISO8601); + case Cookie: return rfcFormat(DateFormatCookie); + default: + ASSERT(false); + } + throw InvalidArgumentException("format", format); +} + +String DateTime::rfcFormat(CStrRef format) const { + StringBuffer s; + bool rfc_colon = false; + bool error; + for (int i = 0; i < format.size(); i++) { + switch (format.charAt(i)) { + case 'd': s.printf("%02d", day()); break; + case 'D': s.append(shortWeekdayName()); break; + case 'j': s.append(day()); break; + case 'l': s.append(weekdayName()); break; + case 'S': s.append(OrdinalSuffix(day())); break; + case 'w': s.append(dow()); break; + case 'N': s.append(isoDow()); break; + case 'z': s.append(doy()); break; + case 'W': s.printf("%02d", isoWeek()); break; + case 'o': s.append(isoYear()); break; + case 'F': s.append(monthName()); break; + case 'm': s.printf("%02d", month()); break; + case 'M': s.append(shortMonthName()); break; + case 'n': s.append(month()); break; + case 't': s.append(DaysInMonth(year(), month())); break; + case 'L': s.append(IsLeap(year())); break; + case 'y': s.printf("%02d", year() % 100); break; + case 'Y': s.printf("%s%04d", year() < 0 ? "-" : "", abs(year())); + break; + case 'a': s.append(hour() >= 12 ? "pm" : "am"); break; + case 'A': s.append(hour() >= 12 ? "PM" : "AM"); break; + case 'B': s.printf("%03d", beat()); break; + case 'g': s.append((hour() % 12) ? (int)hour() % 12 : 12); break; + case 'G': s.append(hour()); break; + case 'h': s.printf("%02d", (hour() % 12) ? (int)hour() % 12 : 12); break; + case 'H': s.printf("%02d", (int)hour()); break; + case 'i': s.printf("%02d", (int)minute()); break; + case 's': s.printf("%02d", (int)second()); break; + case 'u': s.printf("%06d", (int)floor(fraction() * 1000000)); break; + case 'I': s.append(!utc() && m_tz->dst(toTimeStamp(error)) ? 1 : 0); + break; + case 'P': rfc_colon = true; /* break intentionally missing */ + case 'O': + if (utc()) { + s.printf("+0%s0", rfc_colon ? ":" : ""); + } else { + int offset = m_tz->offset(toTimeStamp(error)); + s.printf("%c%02d%s%02d", + (offset < 0 ? '-' : '+'), abs(offset / 3600), + rfc_colon ? ":" : "", abs((offset % 3600) / 60)); + } + break; + case 'T': s.append(utc() ? "GMT" : m_tz->abbr()); break; + case 'e': s.append(utc() ? "UTC" : m_tz->name()); break; + case 'Z': s.append(utc() ? 0 : m_tz->offset(toTimeStamp(error))); + break; + case 'c': + if (utc()) { + s.printf("%04d-%02d-%02dT%02d:%02d:%02d+0:0", + year(), month(), day(), hour(), minute(), second()); + } else { + int offset = m_tz->offset(toTimeStamp(error)); + s.printf("%04d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d", + year(), month(), day(), hour(), minute(), second(), + (offset < 0 ? '-' : '+'), + abs(offset / 3600), abs((offset % 3600) / 60)); + } + break; + case 'r': + if (utc()) { + s.printf("%3s, %02d %3s %04d %02d:%02d:%02d +00", + shortWeekdayName(), day(), shortMonthName(), year(), + hour(), minute(), second()); + } else { + int offset = m_tz->offset(toTimeStamp(error)); + s.printf("%3s, %02d %3s %04d %02d:%02d:%02d %c%02d%02d", + shortWeekdayName(), day(), shortMonthName(), year(), + hour(), minute(), second(), + (offset < 0 ? '-' : '+'), + abs(offset / 3600), abs((offset % 3600) / 60)); + } + break; + case 'U': s.printf("%lld", toTimeStamp(error)); break; + case '\\': + if (i < format.size()) i++; /* break intentionally missing */ + default: + s.append(format[i]); + break; + } + } + return s.detach(); +} + +String DateTime::stdcFormat(CStrRef format) const { + struct tm ta; + timelib_time_offset *offset = NULL; + ta.tm_sec = second(); + ta.tm_min = minute(); + ta.tm_hour = hour(); + ta.tm_mday = day(); + ta.tm_mon = month() - 1; + ta.tm_year = year() - 1900; + ta.tm_wday = dow(); + ta.tm_yday = doy(); + if (utc()) { + ta.tm_isdst = 0; + ta.tm_gmtoff = 0; + ta.tm_zone = "GMT"; + } else { + offset = timelib_get_time_zone_info(m_time->sse, m_time->tz_info); + ta.tm_isdst = offset->is_dst; + ta.tm_gmtoff = offset->offset; + ta.tm_zone = offset->abbr; + } + + int max_reallocs = 5; + size_t buf_len = 256, real_len; + char *buf = (char *)malloc(buf_len); + while ((real_len = strftime(buf, buf_len, format.data(), &ta)) == buf_len || + real_len == 0) { + buf_len *= 2; + free(buf); + buf = (char *)malloc(buf_len); + if (!--max_reallocs) { + break; + } + } + if (!utc()) { + timelib_time_offset_dtor(offset); + } + if (real_len && real_len != buf_len) { + return String(buf, real_len, AttachString); + } + free(buf); + throw InvalidArgumentException("format", "(over internal buffer)"); +} + +Array DateTime::toArray(ArrayFormat format) const { + Array ret; + bool error; + switch (format) { + case TimeMap: + ret.set("seconds", second()); + ret.set("minutes", minute()); + ret.set("hours", hour()); + ret.set("mday", day()); + ret.set("wday", dow()); + ret.set("mon", month()); + ret.set("year", year()); + ret.set("yday", doy()); + ret.set("weekday", weekdayName()); + ret.set("month", monthName()); + ret.set(0, toTimeStamp(error)); + break; + case TmMap: + { + struct tm tm; + toTm(tm); + ret.set("tm_sec", tm.tm_sec); + ret.set("tm_min", tm.tm_min); + ret.set("tm_hour", tm.tm_hour); + ret.set("tm_mday", tm.tm_mday); + ret.set("tm_mon", tm.tm_mon); + ret.set("tm_year", tm.tm_year); + ret.set("tm_wday", tm.tm_wday); + ret.set("tm_yday", tm.tm_yday); + ret.set("tm_isdst", tm.tm_isdst); + } + break; + case TmVector: + { + struct tm tm; + toTm(tm); + ret.append(tm.tm_sec); + ret.append(tm.tm_min); + ret.append(tm.tm_hour); + ret.append(tm.tm_mday); + ret.append(tm.tm_mon); + ret.append(tm.tm_year); + ret.append(tm.tm_wday); + ret.append(tm.tm_yday); + ret.append(tm.tm_isdst); + } + break; + } + return ret; +} + +bool DateTime::fromString(CStrRef input, SmartObject tz) { + struct timelib_error_container *error; + timelib_time *t = timelib_strtotime((char*)input.data(), input.size(), + &error, TimeZone::GetDatabase()); + int error1 = error->error_count; + timelib_error_container_dtor(error); + + if (m_timestamp == -1) { + fromTimeStamp(0); + } + if (tz.get()) { + setTimezone(tz); + } else { + setTimezone(TimeZone::Current()); + } + + // needed if any date part is missing + timelib_fill_holes(t, m_time.get(), 0); + timelib_update_ts(t, m_tz->get()); + + int error2; + m_timestamp = timelib_date_to_int(t, &error2); + if (error1 || error2) { + timelib_tzinfo_dtor(t->tz_info); + timelib_time_dtor(t); + return false; + } + + m_time = TimePtr(t, time_deleter()); + m_tz = NEW(TimeZone)(t->tz_info); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// sun + +Array DateTime::getSunInfo(double latitude, double longitude) const { + Array ret; + timelib_sll sunrise, sunset, transit; + double ddummy; + + /* Get sun up/down and transit */ + int rs = timelib_astro_rise_set_altitude(m_time.get(), longitude, latitude, + -35.0/60, 1, &ddummy, &ddummy, + &sunrise, &sunset, &transit); + switch (rs) { + case -1: /* always below */ + ret.set("sunrise", false); + ret.set("sunset", false); + break; + case 1: /* always above */ + ret.set("sunrise", true); + ret.set("sunset", true); + break; + default: + ret.set("sunrise", sunrise); + ret.set("sunset", sunset); + } + ret.set("transit", transit); + + /* Get civil twilight */ + rs = timelib_astro_rise_set_altitude(m_time.get(), longitude, latitude, + -6.0, 0, + &ddummy, &ddummy, &sunrise, &sunset, + &transit); + switch (rs) { + case -1: /* always below */ + ret.set("civil_twilight_begin", false); + ret.set("civil_twilight_end", false); + break; + case 1: /* always above */ + ret.set("civil_twilight_begin", true); + ret.set("civil_twilight_end", true); + break; + default: + ret.set("civil_twilight_begin", sunrise); + ret.set("civil_twilight_end", sunset); + } + + /* Get nautical twilight */ + rs = timelib_astro_rise_set_altitude(m_time.get(), longitude, latitude, + -12.0, 0, + &ddummy, &ddummy, &sunrise, &sunset, + &transit); + switch (rs) { + case -1: /* always below */ + ret.set("nautical_twilight_begin", false); + ret.set("nautical_twilight_end", false); + break; + case 1: /* always above */ + ret.set("nautical_twilight_begin", true); + ret.set("nautical_twilight_end", true); + break; + default: + ret.set("nautical_twilight_begin", sunrise); + ret.set("nautical_twilight_end", sunset); + } + + /* Get astronomical twilight */ + rs = timelib_astro_rise_set_altitude(m_time.get(), longitude, latitude, + -18.0, 0, + &ddummy, &ddummy, &sunrise, &sunset, + &transit); + switch (rs) { + case -1: /* always below */ + ret.set("astronomical_twilight_begin", false); + ret.set("astronomical_twilight_end", false); + break; + case 1: /* always above */ + ret.set("astronomical_twilight_begin", true); + ret.set("astronomical_twilight_end", true); + break; + default: + ret.set("astronomical_twilight_begin", sunrise); + ret.set("astronomical_twilight_end", sunset); + } + return ret; +} + +Variant DateTime::getSunInfo(SunInfoFormat retformat, + double latitude, double longitude, + double zenith, double utc_offset, + bool calc_sunset) const { + if (retformat != ReturnTimeStamp && + retformat != ReturnString && + retformat != ReturnDouble) { + Logger::Warning("Wrong return format given, pick one of " + "SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or " + "SUNFUNCS_RET_DOUBLE"); + return false; + } + bool error; + double altitude = 90 - zenith; + if (utc_offset == -99999.0) { + if (utc()) { + utc_offset = 0; + } else { + utc_offset = m_tz->offset(toTimeStamp(error)) / 3600; + } + } + + double h_rise, h_set; timelib_sll sunrise, sunset, transit; + int rs = timelib_astro_rise_set_altitude(m_time.get(), longitude, latitude, + altitude, altitude > -1 ? 1 : 0, + &h_rise, &h_set, &sunrise, &sunset, + &transit); + if (rs != 0) { + return false; + } + + if (retformat == ReturnTimeStamp) { + return calc_sunset ? sunset : sunrise; + } + + double N = (calc_sunset ? h_set : h_rise) + utc_offset; + if (N > 24 || N < 0) { + N -= floor(N / 24) * 24; + } + + if (retformat == ReturnString) { + char retstr[6]; + snprintf(retstr, sizeof(retstr), + "%02d:%02d", (int) N, (int) (60 * (N - (int) N))); + return String(retstr, CopyString); + } + + ASSERT(retformat == ReturnDouble); + return N; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/time/datetime.h b/src/cpp/base/time/datetime.h new file mode 100644 index 0000000000000..9746683999a70 --- /dev/null +++ b/src/cpp/base/time/datetime.h @@ -0,0 +1,300 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_DATETIME_H__ +#define __HPHP_DATETIME_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Encapsulating all date/time manipulations, conversions, input and output + * into this one single class. + */ +class DateTime : public SweepableResourceData { +public: + DECLARE_OBJECT_ALLOCATION(DateTime); + + /** + * Different RFC/ISO date/time formats for toString(DateFormat). + */ + enum DateFormat { + InvalidFormat, + + /** + * RFC822, Section 5.1: http://www.ietf.org/rfc/rfc822.txt + * date-time = [ day "," ] date time ; dd mm yy hh:mm:ss zzz + * day = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun" + * date = 1*2DIGIT month 2DIGIT ; day month year e.g. 20 Jun 82 + * month = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / + * "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" + * time = hour zone ; ANSI and Military + * hour = 2DIGIT ":" 2DIGIT [":" 2DIGIT] ; 00:00:00 - 23:59:59 + * zone = "UT" / "GMT" / "EST" / "EDT" / "CST" / "CDT" / "MST" / + * "MDT" / "PST" / "PDT" / 1ALPHA / (("+" / "-") 4DIGIT) + */ + RFC822, + + /** + * Same as RFC822 except for the named time zone + */ + RFC822n, + + /** + * RFC850, Section 2.1.4: http://www.ietf.org/rfc/rfc850.txt + * Format must be acceptable both to the ARPANET and to the getdate + * routine. One format that is acceptable to both is Weekday, + * DD-Mon-YY HH:MM:SS TIMEZONE + * TIMEZONE can be any timezone name (3 or more letters) + */ + RFC850, + + /** + * RFC1036, Section 2.1.2: http://www.ietf.org/rfc/rfc1036.txt + * Its format must be acceptable both in RFC-822 and to the getdate(3) + * Wdy, DD Mon YY HH:MM:SS TIMEZONE + * There is no hope of having a complete list of timezones. Universal + * Time (GMT), the North American timezones (PST, PDT, MST, MDT, CST, + * CDT, EST, EDT) and the +/-hhmm offset specifed in RFC-822 should be + * supported. + */ + RFC1036, + + /** + * RFC1123, Section 5.2.14: http://www.ietf.org/rfc/rfc1123.txt + * RFC-822 Date and Time Specification: RFC-822 Section 5 + * The syntax for the date is hereby changed to: + * date = 1*2DIGIT month 2*4DIGIT + */ + RFC1123, + + /** + * RFC2822, Section 3.3: http://www.ietf.org/rfc/rfc2822.txt + * FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space + * CFWS = *([FWS] comment) (([FWS] comment) / FWS) + * + * date-time = [ day-of-week "," ] date FWS time [CFWS] + * day-of-week = ([FWS] day-name) + * day-name = "Mon"/"Tue"/"Wed"/"Thu"/"Fri"/"Sat"/"Sun" + * date = day month year + * year = 4*DIGIT + * month = (FWS month-name FWS) + * month-name = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / + * "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec" + * day = ([FWS] 1*2DIGIT) + * time = time-of-day FWS zone + * time-of-day = hour ":" minute [ ":" second ] + * hour = 2DIGIT + * minute = 2DIGIT + * second = 2DIGIT + * zone = (( "+" / "-" ) 4DIGIT) + */ + RFC2822, + + /** + * RFC3339, Section 5.6: http://www.ietf.org/rfc/rfc3339.txt + * date-fullyear = 4DIGIT + * date-month = 2DIGIT ; 01-12 + * date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on + * ; month/year + * + * time-hour = 2DIGIT ; 00-23 + * time-minute = 2DIGIT ; 00-59 + * time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on + * ; leap second rules + * + * time-secfrac = "." 1*DIGIT + * time-numoffset = ("+" / "-") time-hour ":" time-minute + * time-offset = "Z" / time-numoffset + * + * partial-time = time-hour ":" time-minute ":" time-second + * [time-secfrac] + * full-date = date-fullyear "-" date-month "-" date-mday + * full-time = partial-time time-offset + * + * date-time = full-date "T" full-time + */ + RFC3339, + + ISO8601, + + /** + * Preliminary specification: + * http://wp.netscape.com/newsref/std/cookie_spec.html + * "This is based on RFC 822, RFC 850, RFC 1036, and RFC 1123, + * with the variations that the only legal time zone is GMT + * and the separators between the elements of the date must be dashes." + */ + Cookie, + + /** + * RFC4287, Section 3.3: http://www.ietf.org/rfc/rfc4287.txt + * A Date construct is an element whose content MUST conform to the + * "date-time" production in [RFC3339]. In addition, an uppercase "T" + * character MUST be used to separate date and time, and an uppercase + * "Z" character MUST be present in the absence of a numeric time zone + * offset. + */ + Atom = RFC3339, + + /** + * RSS 2.0 Specification: http://blogs.law.harvard.edu/tech/rss + * "All date-times in RSS conform to the Date and Time Specification of + * RFC 822, with the exception that the year may be expressed with two + * characters or four characters (four preferred)" + */ + RSS = RFC1123, + + W3C = RFC3339, + }; + + /** + * Different array formats for toArray(). + */ + enum ArrayFormat { + TimeMap, + TmMap, + TmVector + }; + + /** + * Different formats for getSunInfo(). + */ + enum SunInfoFormat { + ReturnTimeStamp, + ReturnString, + ReturnDouble + }; + +public: + static const char *DateFormatRFC822; + static const char *DateFormatRFC822n; + static const char *DateFormatRFC850; + static const char *DateFormatRFC1036; + static const char *DateFormatRFC1123; + static const char *DateFormatRFC2822; + static const char *DateFormatRFC3339; + static const char *DateFormatISO8601; + static const char *DateFormatCookie; + + static const char *MonthNames[]; + static const char *ShortMonthNames[]; + static const char *WeekdayNames[]; + static const char *ShortWeekdayNames[]; + + static const char *GetWeekdayName(int y, int m, int d); + static const char *GetShortWeekdayName(int y, int m, int d); + static const char *OrdinalSuffix(int number); + + static bool IsLeap(int year); + static int DaysInMonth(int y, int m); + static bool IsValid(int y, int m, int d); + + /** + * What time is it? + */ + static SmartObject Current(bool utc = false); + + /** + * Returns are really in special PHP formats, and please read datetime.cpp + * for details. + */ + static Array Parse(CStrRef datetime); + static Array Parse(CStrRef ts, CStrRef format); + +public: + // constructor + DateTime(); + DateTime(int64 timestamp, bool utc = false); // from a timestamp + + // overriding ResourceData + const char *o_getClassName() const { return "DateTime";} + + // informational + bool local() const { return m_time->is_localtime;} + bool utc() const { return !m_time->is_localtime;} + int year() const { return m_time->y;} + int month() const { return m_time->m;} + int day() const { return m_time->d;} + int hour() const { return m_time->h;} + int hour12() const { return (m_time->h % 12) ? (int) m_time->h % 12 : 12;} + int minute() const { return m_time->i;} + int second() const { return m_time->s;} + double fraction() const { return m_time->f;} + int beat() const; // Swatch Beat a.k.a. Internet Time + int dow() const; // day of week + int doy() const; // day of year + int isoWeek() const; + int isoYear() const; + int isoDow() const; + int offset() const; // timezone offset from UTC + SmartObject timezone() const { return m_tz->cloneTimeZone();} + + const char *weekdayName() const; + const char *shortWeekdayName() const; + const char *monthName() const; + const char *shortMonthName() const; + + // modifications + void set(int hour, int minute, int second, int month, int day, int year); + void setDate(int year, int month, int day); + void setISODate(int year, int week, int day = 1); + void setTime(int hour, int minute, int second = 0); + void setTimezone(SmartObject tz); + void modify(CStrRef diff); // PHP's date_modify() function, very powerful + + // conversions + void toTm(struct tm &ta) const; + int64 toTimeStamp(bool &err) const; + int64 toInteger(char format) const; + String toString(CStrRef format, bool stdc = false) const; + String toString(DateFormat format) const; + Array toArray(ArrayFormat format) const; + void fromTimeStamp(int64 timestamp, bool utc = false); + bool fromString(CStrRef input, SmartObject tz); + + // sun info + Array getSunInfo(double latitude, double longitude) const; + Variant getSunInfo(SunInfoFormat retformat, + double latitude, double longitude, + double zenith, double utc_offset, bool calc_sunset) const; + +private: + struct time_deleter { + void operator()(timelib_time *t) { + timelib_time_dtor(t); + } + }; + typedef boost::shared_ptr TimePtr; + + TimePtr m_time; + SmartObject m_tz; + mutable int64 m_timestamp; + mutable bool m_timestampSet; + + // helpers + void update(); + String rfcFormat(CStrRef format) const; + String stdcFormat(CStrRef format) const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_DATETIME_H__ diff --git a/src/cpp/base/time/timestamp.cpp b/src/cpp/base/time/timestamp.cpp new file mode 100644 index 0000000000000..97901928aa1fd --- /dev/null +++ b/src/cpp/base/time/timestamp.cpp @@ -0,0 +1,72 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// creation + +int TimeStamp::Current() { + return time(0); +} + +double TimeStamp::CurrentSecond() { + struct timeval tp; + gettimeofday(&tp, NULL); + return (double)tp.tv_sec + (double)tp.tv_usec / 1000000; +} + +Array TimeStamp::CurrentTime() { + struct timeval tp; + gettimeofday(&tp, NULL); + + timelib_time_offset *offset = + timelib_get_time_zone_info(tp.tv_sec, TimeZone::Current()->get()); + + Array ret; + ret.set("sec", (int)tp.tv_sec); + ret.set("usec", (int)tp.tv_usec); + ret.set("minuteswest", (int)(-offset->offset / 60)); + ret.set("dsttime", (bool)offset->is_dst); + + timelib_time_offset_dtor(offset); + return ret; +} + +String TimeStamp::CurrentMicroTime() { + struct timeval tp; + gettimeofday(&tp, NULL); + char ret[100]; + snprintf(ret, 100, "%.8F %ld", (double)tp.tv_usec / 1000000, tp.tv_sec); + return String(ret, CopyString); +} + +int TimeStamp::Get(bool &error, int hou, int min, int sec, int mon, int day, + int yea, bool gmt) { + DateTime dt; + if (gmt) { + dt.setTimezone(SmartObject(NEW(TimeZone)("UTC"))); + } + dt.set(hou, min, sec, mon, day, yea); + return dt.toTimeStamp(error); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/time/timestamp.h b/src/cpp/base/time/timestamp.h new file mode 100644 index 0000000000000..8dfc543b0f6e4 --- /dev/null +++ b/src/cpp/base/time/timestamp.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_TIMESTAMP_H__ +#define __HPHP_TIMESTAMP_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Using an integer to represent time: the value of time in seconds since 0 + * hours, 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal Time, + * without including leap seconds. Therefore, this integer is by definition + * non timezone specific and thus not shifted by DST. + */ +class TimeStamp { +public: + static int Current(); + static double CurrentSecond(); + static Array CurrentTime(); + static String CurrentMicroTime(); + + static int Get(bool &error, int hour = -1, int minute = -1, int second = -1, + int month = -1, int day = -1, int year = -1, bool gmt = false); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_TIMESTAMP_H__ diff --git a/src/cpp/base/time/timezone.cpp b/src/cpp/base/time/timezone.cpp new file mode 100644 index 0000000000000..13e65b3e1a526 --- /dev/null +++ b/src/cpp/base/time/timezone.cpp @@ -0,0 +1,225 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION(TimeZone); +/////////////////////////////////////////////////////////////////////////////// +// statics + +class TimeZoneData { +public: + TimeZoneData() : Database(NULL) {} + + const timelib_tzdb *Database; + MapStringToTimeZoneInfo Cache; +}; +static ThreadLocal s_timezone_data; + +const timelib_tzdb *TimeZone::GetDatabase() { + const timelib_tzdb *&Database = s_timezone_data->Database; + if (Database == NULL) { + Database = timelib_builtin_db(); + } + return Database; +} + +TimeZoneInfo TimeZone::GetTimeZoneInfo(CStrRef name) { + MapStringToTimeZoneInfo &Cache = s_timezone_data->Cache; + + MapStringToTimeZoneInfo::const_iterator iter = Cache.find(name.data()); + if (iter != Cache.end()) { + return iter->second; + } + + TimeZoneInfo tzi(timelib_parse_tzfile((char *)name.data(), GetDatabase()), + tzinfo_deleter()); + if (tzi) { + Cache[name.data()] = tzi; + } + return tzi; +} + +bool TimeZone::IsValid(CStrRef name) { + return timelib_timezone_id_is_valid((char*)name.data(), GetDatabase()); +} + +String TimeZone::CurrentName() { + /* Checking configure timezone */ + String timezone = g_context->getTimeZone(); + if (!timezone.empty()) { + return timezone; + } + + /* Check environment variable */ + char *env = getenv("TZ"); + if (env && *env && IsValid(env)) { + return String(env, CopyString); + } + + /* Check config setting for default timezone */ + String default_timezone = g_context->getDefaultTimeZone(); + if (!default_timezone.empty() && IsValid(default_timezone.data())) { + return default_timezone; + } + + /* Try to guess timezone from system information */ + + time_t the_time = time(0); + struct tm tmbuf; + struct tm *ta = localtime_r(&the_time, &tmbuf); + const char *tzid = NULL; + if (ta) { + tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, + ta->tm_isdst); + } + if (!tzid) { + tzid = "UTC"; + } + return String(tzid, CopyString); +} + +SmartObject TimeZone::Current() { + return NEW(TimeZone)(CurrentName()); +} + +bool TimeZone::SetCurrent(CStrRef zone) { + if (!IsValid(zone)) { + Logger::Verbose("Timezone ID '%s' is invalid", zone.data()); + return false; + } + g_context->setTimeZone(zone); + return true; +} + +Array TimeZone::GetNames() { + const timelib_tzdb *tzdb = timelib_builtin_db(); + int item_count = tzdb->index_size; + const timelib_tzdb_index_entry *table = tzdb->index; + + Array ret; + for (int i = 0; i < item_count; ++i) { + ret.append(String(table[i].id, AttachLiteral)); + } + return ret; +} + +Array TimeZone::GetAbbreviations() { + Array ret; + for (const timelib_tz_lookup_table *entry = + timelib_timezone_abbreviations_list(); entry->name; entry++) { + Array element; + element.set("dst", (bool)entry->type); + element.set("offset", entry->gmtoffset); + if (entry->full_tz_name) { + element.set("timezone_id", String(entry->full_tz_name, AttachLiteral)); + } else { + element.set("timezone_id", null); + } + + ret.lvalAt(entry->name).append(element); + } + return ret; +} + +String TimeZone::AbbreviationToName(String abbr, int utcoffset /* = -1 */, + bool isdst /* = true */) { + return String(timelib_timezone_id_from_abbr(abbr.data(), utcoffset, + isdst ? -1 : 0), + CopyString); +} + +/////////////////////////////////////////////////////////////////////////////// +// class TimeZone + +TimeZone::TimeZone() { +} + +TimeZone::TimeZone(CStrRef name) { + m_tzi = GetTimeZoneInfo(name); +} + +TimeZone::TimeZone(timelib_tzinfo *tzi) { + m_tzi = TimeZoneInfo(tzi, tzinfo_deleter()); +} + +SmartObject TimeZone::cloneTimeZone() const { + if (!m_tzi) return NEW(TimeZone)(); + return NEW(TimeZone)(timelib_tzinfo_clone(m_tzi.get())); +} + +String TimeZone::name() const { + if (!m_tzi) return String(); + return String(m_tzi->name, CopyString); +} + +String TimeZone::abbr() const { + if (!m_tzi) return String(); + return String(m_tzi->timezone_abbr, CopyString); +} + +int TimeZone::offset(int timestamp) const { + if (!m_tzi) return 0; + + timelib_time_offset *offset = + timelib_get_time_zone_info(timestamp, m_tzi.get()); + int ret = offset->offset; + timelib_time_offset_dtor(offset); + return ret; +} + +bool TimeZone::dst(int timestamp) const { + if (!m_tzi) return false; + + timelib_time_offset *offset = + timelib_get_time_zone_info(timestamp, m_tzi.get()); + bool ret = offset->is_dst; + timelib_time_offset_dtor(offset); + return ret; +} + +Array TimeZone::transitions() const { + Array ret; + if (m_tzi) { + for (unsigned int i = 0; i < m_tzi->timecnt; ++i) { + int index = m_tzi->trans_idx[i]; + int timestamp = m_tzi->trans[i]; + DateTime dt(timestamp); + ttinfo &offset = m_tzi->type[index]; + const char *abbr = m_tzi->timezone_abbr + offset.abbr_idx; + + Array element; + element.set("ts", timestamp); + element.set("time", dt.toString(DateTime::ISO8601)); + element.set("offset", offset.offset); + element.set("isdst", (bool)offset.isdst); + element.set("abbr", String(abbr, CopyString)); + + ret.append(element); + } + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/time/timezone.h b/src/cpp/base/time/timezone.h new file mode 100644 index 0000000000000..3f39a24670f00 --- /dev/null +++ b/src/cpp/base/time/timezone.h @@ -0,0 +1,130 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_TIMEZONE_H__ +#define __HPHP_TIMEZONE_H__ + +#include +#include +#include +#include + +extern "C" { +#include +} + +namespace HPHP { + +typedef boost::shared_ptr TimeZoneInfo; +typedef std::map MapStringToTimeZoneInfo; +/////////////////////////////////////////////////////////////////////////////// + +/** + * Handles all timezone related functions. + */ +class TimeZone : public SweepableResourceData { +public: + DECLARE_OBJECT_ALLOCATION(TimeZone); + + /** + * Get/set current timezone that controls how local time is interpreted. + */ + static String CurrentName(); // current timezone's name + static SmartObject Current(); // current timezone + static bool SetCurrent(CStrRef name); // returns false if invalid + + /** + * TimeZone database queries. + */ + static bool IsValid(CStrRef name); + static Array GetNames(); + static Array GetAbbreviations(); + static String AbbreviationToName(String abbr, int utcoffset = -1, + bool isdst = true); + +public: + /** + * Constructing a timezone object by name or a raw pointer (internal). + */ + TimeZone(); + TimeZone(CStrRef name); + TimeZone(timelib_tzinfo *tzi); + + // overriding ResourceData + const char *o_getClassName() const { return "TimeZone";} + + /** + * Whether this represents a valid timezone. + */ + bool isValid() const { return get();} + + /** + * Get timezone's name or abbreviation. + */ + String name() const; + String abbr() const; + + /** + * Get offset from UTC at the specified timestamp under this timezone. + */ + int offset(int timestamp) const; + + /** + * Test whether it was running under DST at specified timestamp. + */ + bool dst(int timestamp) const; + + /** + * Query transition times for DST. + */ + Array transitions() const; + +protected: + friend class DateTime; + friend class TimeStamp; + + /** + * Make a copy of this timezone object, so it can be changed independently. + * This is for internal use. + */ + SmartObject cloneTimeZone() const; + + /** + * Returns raw pointer. For internal use only. + */ + timelib_tzinfo *get() const { return m_tzi.get();} + +private: + struct tzinfo_deleter { + void operator()(timelib_tzinfo *tzi) { + timelib_tzinfo_dtor(tzi); + } + }; + + static const timelib_tzdb *GetDatabase(); + + /** + * Look up cache and if found return it, otherwise, read it from database. + */ + static TimeZoneInfo GetTimeZoneInfo(CStrRef name); + + TimeZoneInfo m_tzi; // raw pointer +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_TIMEZONE_H__ diff --git a/src/cpp/base/timeout_thread.cpp b/src/cpp/base/timeout_thread.cpp new file mode 100644 index 0000000000000..c8840c56080c6 --- /dev/null +++ b/src/cpp/base/timeout_thread.cpp @@ -0,0 +1,149 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// statics + +// class defined in cpp/base/types.h +IMPLEMENT_THREAD_LOCAL(RequestInjectionData, + RequestInjection::s_reqInjectionData); + +static void on_timer(int fd, short events, void *context) { + ((TimeoutThread*)context)->onTimer(fd); +} + +static void on_thread_stop(int fd, short events, void *context) { + event_base_loopbreak((struct event_base *)context); +} + +/////////////////////////////////////////////////////////////////////////////// + +void TimeoutThread::DeferTimeout(int seconds) { + // cheating by resetting started to desired timestamp + RequestInjection::s_reqInjectionData->started = time(0) + + (seconds - RuntimeOption::RequestTimeoutSeconds); +} + +/////////////////////////////////////////////////////////////////////////////// + +TimeoutThread::TimeoutThread(int timerCount) : m_index(0), m_stopped(false) { + ASSERT(timerCount > 0); + + m_eventBase = event_base_new(); + m_eventTimeouts.resize(timerCount); + m_timeoutData.resize(timerCount); +} + +TimeoutThread::~TimeoutThread() { + event_base_free(m_eventBase); +} + +void TimeoutThread::registerRequestThread(RequestInjectionData* data) { + ASSERT(data); + + Lock lock(this); + ASSERT(m_index < (int)m_timeoutData.size()); + m_timeoutData[m_index++] = data; + if (m_index == (int)m_timeoutData.size()) { + notify(); + } +} + +void TimeoutThread::run() { + { + Lock lock(this); + while (m_index < (int)m_timeoutData.size()) { + wait(); + } + ASSERT(m_index == (int)m_timeoutData.size()); + } + + if (RuntimeOption::RequestTimeoutSeconds <= 0) { + return; + } + + struct timeval timeout; + timeout.tv_usec = 0; + + // +2 to make sure when it times out, this equation always holds: + // time(0) - RequestInjection::s_reqInjectionData->started >= + // RuntimeOption::RequestTimeoutSeconds + timeout.tv_sec = RuntimeOption::RequestTimeoutSeconds + 2; + + for (unsigned int i = 0; i < m_eventTimeouts.size(); i++) { + event *e = &m_eventTimeouts[i]; + event_set(e, i, 0, on_timer, this); + event_base_set(m_eventBase, e); + event_add(e, &timeout); + } + + m_pipeStop.open(); + event_set(&m_eventStop, m_pipeStop.getOut(), EV_READ|EV_PERSIST, + on_thread_stop, m_eventBase); + event_base_set(m_eventBase, &m_eventStop); + event_add(&m_eventStop, NULL); + + while (!m_stopped) { + event_base_loop(m_eventBase, EVLOOP_ONCE); + } + + for (unsigned int i = 0; i < m_eventTimeouts.size(); i++) { + event_del(&m_eventTimeouts[i]); + } + event_del(&m_eventStop); +} + +void TimeoutThread::stop() { + m_stopped = true; + write(m_pipeStop.getIn(), "", 1); +} + +void TimeoutThread::onTimer(int index) { + ASSERT(index >= 0 && index < (int)m_eventTimeouts.size()); + + event *e = &m_eventTimeouts[index]; + event_del(e); + + RequestInjectionData *data = m_timeoutData[index]; + ASSERT(data); + + struct timeval timeout; + timeout.tv_usec = 0; + time_t now = time(0); + int delta = now - data->started; + if (delta >= RuntimeOption::RequestTimeoutSeconds) { + timeout.tv_sec = RuntimeOption::RequestTimeoutSeconds + 2; + data->timedout = true; // finally sure request is timed out + } else { + ASSERT(delta >= 0); + if (delta < 0) delta = 0; + + // otherwise, a new request started after we started the timer + timeout.tv_sec = RuntimeOption::RequestTimeoutSeconds - delta + 2; + } + + event_set(e, index, 0, on_timer, this); + event_base_set(m_eventBase, e); + event_add(e, &timeout); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/timeout_thread.h b/src/cpp/base/timeout_thread.h new file mode 100644 index 0000000000000..6575e0eb043f5 --- /dev/null +++ b/src/cpp/base/timeout_thread.h @@ -0,0 +1,60 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TIMEOUT_THREAD_H__ +#define __TIMEOUT_THREAD_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class TimeoutThread : public Synchronizable { +public: + static void DeferTimeout(int seconds); + +public: + TimeoutThread(int timerCount); + ~TimeoutThread(); + + void registerRequestThread(RequestInjectionData* data); + void run(); + void stop(); + + void onTimer(int index); + +private: + int m_index; + bool m_stopped; + + event_base *m_eventBase; + std::vector m_eventTimeouts; + std::vector m_timeoutData; + + // signal to stop the thread + event m_eventStop; + CPipe m_pipeStop; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __TIMEOUT_THREAD_H__ + diff --git a/src/cpp/base/type_array.cpp b/src/cpp/base/type_array.cpp new file mode 100644 index 0000000000000..fe8b02381c711 --- /dev/null +++ b/src/cpp/base/type_array.cpp @@ -0,0 +1,1002 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // icu + +using namespace std; + +namespace HPHP { + +const Array Array::s_nullArray = Array(); + +IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS(Array); +/////////////////////////////////////////////////////////////////////////////// +// constructors + +Array Array::Create(CVarRef name, CVarRef var) { + return ArrayData::Create(name.isString() ? name.toKey() : name, var); +} + +Array::Array(ArrayData *data) { + SmartPtr::operator=(data); +} + +Array::Array(CArrRef arr) { + SmartPtr::operator=(arr.m_px); +} + +Array::Array(ArrayElement *elem, ...) { + vector elems; + elems.reserve(10); + + va_list ap; + va_start(ap, elem); + while (elem) { + elems.push_back(elem); + elem = va_arg(ap, ArrayElement*); + } + va_end(ap); + + SmartPtr::operator=(ArrayData::Create(elems)); +} + +/////////////////////////////////////////////////////////////////////////////// +// operators + +Array &Array::operator=(ArrayData *data) { + SmartPtr::operator=(data); + return *this; +} + +Array &Array::operator=(CArrRef arr) { + SmartPtr::operator=(arr.m_px); + return *this; +} + +Array &Array::operator=(CVarRef var) { + return operator=(var.toArray()); +} + +Array Array::operator+(CVarRef var) const { + if (var.getType() != KindOfArray) { + throw BadArrayMergeException(); + } + return operator+(var.toArray()); +} + +Array Array::operator+(CArrRef arr) const { + return Array(m_px).operator+=(arr); +} + +Array &Array::operator+=(CVarRef var) { + if (var.getType() != KindOfArray) { + throw BadArrayMergeException(); + } + return operator+=(var.toArray()); +} + +Array &Array::operator+=(CArrRef arr) { + return mergeImpl(arr, ArrayData::Plus); +} + +Array Array::diff(CArrRef array, bool by_key, bool by_value, + PFUNC_CMP key_cmp_function /* = NULL */, + const void *key_data /* = NULL */, + PFUNC_CMP value_cmp_function /* = NULL */, + const void *value_data /* = NULL */) const { + return diffImpl(array, by_key, by_value, false, key_cmp_function, key_data, + value_cmp_function, value_data); +} + +Array Array::intersect(CArrRef array, bool by_key, bool by_value, + PFUNC_CMP key_cmp_function /* = NULL */, + const void *key_data /* = NULL */, + PFUNC_CMP value_cmp_function /* = NULL */, + const void *value_data /* = NULL */) const { + return diffImpl(array, by_key, by_value, true, key_cmp_function, key_data, + value_cmp_function, value_data); +} + + +static void _sort(vector &indices, CArrRef source, Array::SortData &opaque, + Array::PFUNC_CMP cmp_func, + bool by_key, const void *data /* = NULL */); + +Array Array::diffImpl(CArrRef array, bool by_key, bool by_value, bool match, + PFUNC_CMP key_cmp_function, + const void *key_data, + PFUNC_CMP value_cmp_function, + const void *value_data) const { + ASSERT(by_key || by_value); + ASSERT(by_key || key_cmp_function == NULL); + ASSERT(by_value || value_cmp_function == NULL); + + if (!value_cmp_function) { + value_cmp_function = SortStringAscending; + } + + Array ret = Array::Create(); + if (by_key && !key_cmp_function) { + // Fast case + for (ArrayIter iter(*this); iter; ++iter) { + Variant key = iter.first(); + bool found = false; + if (array.exists(key)) { + if (by_value) { + found = value_cmp_function(iter.second(), + array.rvalAt(key), value_data) == 0; + } else { + found = true; + } + } + if (found == match) { + ret.set(key, iter.second()); + } + } + return ret; + } + + if (!key_cmp_function) { + key_cmp_function = SortRegularAscending; + } + + vector perm1; + SortData opaque1; + int bottom = 0; + int top = array.size(); + PFUNC_CMP cmp; + const void *cmp_data; + if (by_key) { + cmp = key_cmp_function; + cmp_data = key_data; + } else { + cmp = value_cmp_function; + cmp_data = value_data; + } + _sort(perm1, array, opaque1, cmp, by_key, cmp_data); + + for (ArrayIter iter(*this); iter; ++iter) { + Variant target; + if (by_key) { + target = iter.first(); + } else { + target = iter.second(); + } + + int mid = -1; + int min = bottom; + int max = top; + while (min < max) { + mid = (max + min) / 2; + ssize_t pos = opaque1.positions[perm1[mid]]; + int cmp_res = cmp(target, + by_key ? array->getKey(pos) : array->getValue(pos), + cmp_data); + if (cmp_res > 0) { // outer is bigger + min = mid + 1; + } else if (cmp_res == 0) { + break; + } else { + max = mid; + } + } + bool found = false; + if (min < max) { // found + // if checking both, check value + if (by_key && by_value) { + Variant val = iter.second(); + // Have to look up and down for matches + for (int i = mid; i < max; i++) { + ssize_t pos = opaque1.positions[perm1[i]]; + if (key_cmp_function(target, array->getKey(pos), key_data) != 0) { + break; + } + if (value_cmp_function(val, array->getValue(pos), value_data) == 0) { + found = true; + break; + } + } + if (!found) { + for (int i = mid-1; i >= min; i--) { + ssize_t pos = opaque1.positions[perm1[i]]; + if (key_cmp_function(target, array->getKey(pos), key_data) != 0) { + break; + } + if (value_cmp_function(val, array->getValue(pos), + value_data) == 0) { + found = true; + break; + } + } + } + } else { + // found at mid + found = true; + } + } + + if (found == match) { + ret.set(iter.first(), iter.second()); + } + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// manipulations + +Array &Array::merge(CArrRef arr) { + return mergeImpl(arr, ArrayData::Merge); +} + +Array &Array::mergeImpl(CArrRef arr, ArrayData::ArrayOp op) { + if (m_px == NULL || arr.m_px == NULL) { + throw BadArrayMergeException(); + } + if (!arr.m_px->empty()) { + if (m_px->empty()) { + SmartPtr::operator=(arr.m_px); + } else { + ArrayData *escalated = m_px->append(arr.m_px, op, m_px->getCount() > 1); + if (escalated) { + SmartPtr::operator=(escalated); + } + } + } + return *this; +} + +Array Array::slice(int offset, int length, bool preserve_keys) const { + if (m_px == NULL) return Array(); + return ArrayUtil::Slice(m_px, offset, length, preserve_keys); +} + +/////////////////////////////////////////////////////////////////////////////// +// type conversions + +Object Array::toObject() const { + if (m_px) { + return m_px->toObject(); + } + return Object(NEW(c_stdclass)()); +} + +/////////////////////////////////////////////////////////////////////////////// +// comparisons + +bool Array::same(CArrRef v2) const { + if (m_px == NULL && v2.get() == NULL) return true; + if (m_px && v2.get()) { + return m_px->compare(v2.get(), true) == 0; + } + return false; +} + +bool Array::same(CObjRef v2) const { + return false; +} + +bool Array::equal(CArrRef v2) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::equal(toBoolean(), v2.toBoolean()); + } + return m_px->compare(v2.get(), false) == 0; +} + +bool Array::equal(CObjRef v2) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::more(toBoolean(), v2.toBoolean()); + } + return false; +} + +bool Array::less(CArrRef v2, bool flip /* = false */) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::less(toBoolean(), v2.toBoolean()); + } + if (flip) { + return v2.get()->compare(m_px, false) > 0; + } + return m_px->compare(v2.get(), false) < 0; +} + +bool Array::less(CObjRef v2) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::less(toBoolean(), v2.toBoolean()); + } + return false; +} + +bool Array::less(CVarRef v2) const { + if (m_px == NULL || v2.isNull()) { + return HPHP::less(toBoolean(), v2.toBoolean()); + } + if (v2.getType() == KindOfArray) { + return m_px->compare(v2.toArray().get(), false) < 0; + } + return v2.more(*this); +} + +bool Array::more(CArrRef v2, bool flip /* = true */) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::more(toBoolean(), v2.toBoolean()); + } + if (flip) { + return v2.get()->compare(m_px, false) < 0; + } + return m_px->compare(v2.get(), false) > 0; +} + +bool Array::more(CObjRef v2) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::more(toBoolean(), v2.toBoolean()); + } + return true; +} + +bool Array::more(CVarRef v2) const { + if (m_px == NULL || v2.isNull()) { + return HPHP::more(toBoolean(), v2.toBoolean()); + } + if (v2.getType() == KindOfArray) { + return v2.toArray().get()->compare(m_px, false) < 0; + } + return v2.less(*this); +} + +/////////////////////////////////////////////////////////////////////////////// +// iterator + +void Array::escalate() { + if (m_px) { + SharedMap *mapShared = dynamic_cast(m_px); + if (mapShared) { + SmartPtr::operator=(mapShared->escalate()); + return; + } + if (!RuntimeOption::UseZendArray) { + VectorLong *vecLong = dynamic_cast(m_px); + if (vecLong) { + SmartPtr::operator=(NEW(MapVariant)(vecLong)); + return; + } + + VectorString *vecString = dynamic_cast(m_px); + if (vecString) { + SmartPtr::operator=(NEW(MapVariant)(vecString)); + return; + } + VectorVariant *vecVariant = dynamic_cast(m_px); + if (vecVariant) { + SmartPtr::operator=(NEW(MapVariant)(vecVariant)); + return; + } + + MapLong *mapLong = dynamic_cast(m_px); + if (mapLong) { + SmartPtr::operator=(NEW(MapVariant)(mapLong)); + return; + } + + MapString *mapString = dynamic_cast(m_px); + if (mapString) { + SmartPtr::operator=(NEW(MapVariant)(mapString)); + return; + } + + SharedMap *mapShared = dynamic_cast(m_px); + if (mapShared) { + SmartPtr::operator=(mapShared->escalate()); + return; + } + + ASSERT(dynamic_cast(m_px) || + dynamic_cast(m_px) || + dynamic_cast(m_px)); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// offset functions + +Variant Array::rvalAt(CVarRef key, int64 prehash /* = -1 */) const { + if (!m_px) return null; + + switch(key.getType()) { + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return m_px->get(key.toInt64(), prehash); + default: + break; + } + Variant k = key.toKey(); + if (!k.isNull()) { + return m_px->get(k, prehash); + } + return null; +} + +Variant &Array::lvalAt(litstr key, int64 prehash /* = -1 */) { + return lvalAtImpl(String(key).toKey(), prehash); +} +Variant &Array::lvalAt(CStrRef key, int64 prehash /* = -1 */) { + return lvalAtImpl(key.toKey(), prehash); +} +Variant &Array::lvalAt(CVarRef key, int64 prehash /* = -1 */) { + Variant k = key.toKey(); + if (!k.isNull()) { + return lvalAtImpl(k, prehash); + } + return Variant::lvalBlackHole(); +} + +CVarRef Array::set(CVarRef key, CVarRef v, int64 prehash /* = -1 */) { + switch(key.getType()) { + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return setImpl(key.toInt64(), v, prehash); + default: + break; + } + Variant k = key.toKey(); + if (!k.isNull()) { + return setImpl(k, v, prehash); + } + return null_variant; +} + +/////////////////////////////////////////////////////////////////////////////// +// membership functions + +bool Array::valueExists(CVarRef search_value, + bool strict /* = false */) const { + for (ArrayIter iter(*this); iter; ++iter) { + if ((strict && iter.second().same(search_value)) || + (!strict && iter.second().equal(search_value))) { + return true; + } + } + return false; +} + +Variant Array::key(CVarRef search_value, bool strict /* = false */) const { + for (ArrayIter iter(*this); iter; ++iter) { + if ((strict && iter.second().same(search_value)) || + (!strict && iter.second().equal(search_value))) { + return iter.first(); + } + } + return false; // PHP uses "false" over null in many places +} + +Array Array::keys(CVarRef search_value /* = null_variant */, + bool strict /* = false */) const { + Array ret = Array::Create(); + if (search_value.isNull()) { + for (ArrayIter iter(*this); iter; ++iter) { + ret.append(iter.first()); + } + } else { + for (ArrayIter iter(*this); iter; ++iter) { + if ((strict && iter.second().same(search_value)) || + (!strict && iter.second().equal(search_value))) { + ret.append(iter.first()); + } + } + } + return ret; +} + +Array Array::values() const { + Array ret = Array::Create(); + for (ArrayIter iter(*this); iter; ++iter) { + ret.append(iter.second()); + } + return ret; +} + +bool Array::exists(CVarRef key, int64 prehash /* = -1 */) const { + switch(key.getType()) { + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return existsImpl(key.toInt64(), prehash); + default: + break; + } + Variant k = key.toKey(); + if (!k.isNull()) { + return existsImpl(k, prehash); + } + return false; +} + +void Array::remove(CVarRef key, int64 prehash /* = -1 */) { + switch(key.getType()) { + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + removeImpl(key.toInt64(), prehash); + return; + default: + break; + } + Variant k = key.toKey(); + if (!k.isNull()) { + removeImpl(k, prehash); + } +} + +void Array::removeAll() { + operator=(Create()); +} + +Variant Array::append(CVarRef v) { + if (!m_px) { + SmartPtr::operator=(ArrayData::Create(v)); + } else { + if (v.isContagious()) { + escalate(); + } + ArrayData *escalated = m_px->append(v, (m_px->getCount() > 1)); + if (escalated) { + SmartPtr::operator=(escalated); + } + } + return v; +} + +Variant Array::pop() { + if (m_px) { + Variant ret; + ArrayData *newarr = m_px->pop(ret); + if (newarr) { + SmartPtr::operator=(newarr); + } + return ret; + } + return null; +} + +Variant Array::dequeue() { + if (m_px) { + Variant ret; + ArrayData *newarr = m_px->dequeue(ret); + if (newarr) { + SmartPtr::operator=(newarr); + } + return ret; + } + return null; +} + +void Array::insert(int pos, CVarRef v) { + if (!m_px) { + operator=(Create()); + } + ASSERT(m_px); + + ArrayData *newarr = m_px->insert(pos, v, (m_px->getCount() > 1)); + if (newarr) { + SmartPtr::operator=(newarr); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// output functions + +void Array::serialize(VariableSerializer *serializer) const { + if (m_px) { + m_px->serialize(serializer); + } else { + serializer->writeNull(); + } +} + +void Array::unserialize(VariableUnserializer *unserializer) { + std::istream &in = unserializer->in(); + int64 size; + char sep; + in >> size >> sep; + if (sep != ':') { + throw Exception("Expected ':' but got '%c'", sep); + } + in >> sep; + if (sep != '{') { + throw Exception("Expected '{' but got '%c'", sep); + } + if (size == 0) { + operator=(Create()); + } else { + for (int64 i = 0; i < size; i++) { + Variant key = unserializer->unserializeKey(); + Variant &value = lvalAt(key); + value.unserialize(unserializer); + } + } + + in >> sep; + if (sep != '}') { + throw Exception("Expected '}' but got '%c'", sep); + } +} + +void Array::dump() { + if (m_px) { + m_px->dump(); + } else { + printf("(null)\n"); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// sorting + +#define QSORT_STACK_SIZE (sizeof(size_t) * CHAR_BIT) + +static void _zend_qsort_swap(void *a, void *b, size_t siz) { + register char *tmp_a_char; + register char *tmp_b_char; + register int *tmp_a_int; + register int *tmp_b_int; + register size_t i; + int t_i; + char t_c; + + tmp_a_int = (int *) a; + tmp_b_int = (int *) b; + + for (i = sizeof(int); i <= siz; i += sizeof(int)) { + t_i = *tmp_a_int; + *tmp_a_int++ = *tmp_b_int; + *tmp_b_int++ = t_i; + } + + tmp_a_char = (char *) tmp_a_int; + tmp_b_char = (char *) tmp_b_int; + + for (i = i - sizeof(int) + 1; i <= siz; ++i) { + t_c = *tmp_a_char; + *tmp_a_char++ = *tmp_b_char; + *tmp_b_char++ = t_c; + } +} + +typedef int (*compare_func_t)(const void *, const void *, const void *opaque); +static void zend_qsort(void *base, size_t nmemb, size_t siz, + compare_func_t compare, void *opaque) { + void *begin_stack[QSORT_STACK_SIZE]; + void *end_stack[QSORT_STACK_SIZE]; + register char *begin; + register char *end; + register char *seg1; + register char *seg2; + register char *seg2p; + register int loop; + uint offset; + + begin_stack[0] = (char *) base; + end_stack[0] = (char *) base + ((nmemb - 1) * siz); + + for (loop = 0; loop >= 0; --loop) { + begin = (char*)begin_stack[loop]; + end = (char*)end_stack[loop]; + + while (begin < end) { + offset = (end - begin) >> 1; + _zend_qsort_swap(begin, begin + (offset - (offset % siz)), siz); + + seg1 = begin + siz; + seg2 = end; + + while (1) { + for (; seg1 < seg2 && compare(begin, seg1, opaque) > 0; + seg1 += siz); + + for (; seg2 >= seg1 && compare(seg2, begin, opaque) > 0; + seg2 -= siz); + + if (seg1 >= seg2) + break; + + _zend_qsort_swap(seg1, seg2, siz); + + seg1 += siz; + seg2 -= siz; + } + + _zend_qsort_swap(begin, seg2, siz); + + seg2p = seg2; + + if ((seg2p - begin) <= (end - seg2p)) { + if ((seg2p + siz) < end) { + begin_stack[loop] = seg2p + siz; + end_stack[loop++] = end; + } + end = seg2p - siz; + } + else { + if ((seg2p - siz) > begin) { + begin_stack[loop] = begin; + end_stack[loop++] = seg2p - siz; + } + begin = seg2p + siz; + } + } + } +} + +static int array_compare_func(const void *n1, const void *n2, const void *op) { + int index1 = *(int*)n1; + int index2 = *(int*)n2; + Array::SortData *opaque = (Array::SortData*)op; + ssize_t pos1 = opaque->positions[index1]; + ssize_t pos2 = opaque->positions[index2]; + if (opaque->by_key) { + return opaque->cmp_func((*opaque->array)->getKey(pos1), + (*opaque->array)->getKey(pos2), + opaque->data); + } + return opaque->cmp_func((*opaque->array)->getValue(pos1), + (*opaque->array)->getValue(pos2), + opaque->data); +} + +static int multi_compare_func(const void *n1, const void *n2, const void *op) { + int index1 = *(int*)n1; + int index2 = *(int*)n2; + const std::vector *opaques = + (const std::vector *)op; + for (unsigned int i = 0; i < opaques->size(); i++) { + const Array::SortData *opaque = &opaques->at(i); + ssize_t pos1 = opaque->positions[index1]; + ssize_t pos2 = opaque->positions[index2]; + int result; + if (opaque->by_key) { + result = opaque->cmp_func((*opaque->array)->getKey(pos1), + (*opaque->array)->getKey(pos2), + opaque->data); + } else { + result = opaque->cmp_func((*opaque->array)->getValue(pos1), + (*opaque->array)->getValue(pos2), + opaque->data); + } + if (result != 0) return result; + } + return 0; +} + +static void _sort(vector &indices, CArrRef source, Array::SortData &opaque, + Array::PFUNC_CMP cmp_func, bool by_key, + const void *data /* = NULL */) { + ASSERT(cmp_func); + + int count = source.size(); + if (count == 0) { + return; + } + indices.reserve(count); + for (int i = 0; i < count; i++) { + indices.push_back(i); + } + + opaque.array = &source; + opaque.by_key = by_key; + opaque.cmp_func = cmp_func; + opaque.data = data; + opaque.positions.reserve(count); + for (ssize_t pos = source->iter_begin(); pos != ArrayData::invalid_index; + pos = source->iter_advance(pos)) { + opaque.positions.push_back(pos); + } + zend_qsort(&indices[0], count, sizeof(int), array_compare_func, &opaque); +} + +void Array::sort(PFUNC_CMP cmp_func, bool by_key, bool renumber, + const void *data /* = NULL */) { + Array sorted = Array::Create(); + SortData opaque; + vector indices; + _sort(indices, *this, opaque, cmp_func, by_key, data); + int count = size(); + for (int i = 0; i < count; i++) { + ssize_t pos = opaque.positions[indices[i]]; + if (renumber) { + sorted.append(m_px->getValue(pos)); + } else { + sorted.set(m_px->getKey(pos), m_px->getValue(pos)); + } + } + operator=(sorted); +} + +void Array::MultiSort(std::vector &data, bool renumber) { + if (data.empty()) { + return; + } + + int count = -1; + for (unsigned int k = 0; k < data.size(); k++) { + SortData &opaque = data[k]; + + ASSERT(opaque.array); + ASSERT(opaque.cmp_func); + int size = opaque.array->size(); + if (count == -1) { + count = size; + } else if (count != size) { + throw InvalidArgumentException("arrays", "(inconsistent sizes)"); + } + + opaque.positions.reserve(size); + CArrRef arr = *opaque.array; + if (!arr.empty()) { + for (ssize_t pos = arr->iter_begin(); pos != ArrayData::invalid_index; + pos = arr->iter_advance(pos)) { + opaque.positions.push_back(pos); + } + } + } + if (count == 0) { + return; + } + + int *indices = (int *)malloc(sizeof(int) * count); + for (int i = 0; i < count; i++) { + indices[i] = i; + } + + zend_qsort(indices, count, sizeof(int), multi_compare_func, (void *)&data); + + for (unsigned int k = 0; k < data.size(); k++) { + SortData &opaque = data[k]; + CArrRef arr = *opaque.array; + + Array sorted; + for (int i = 0; i < count; i++) { + ssize_t pos = opaque.positions[indices[i]]; + Variant k = arr->getKey(pos); + if (renumber && k.isInteger()) { + sorted.append(arr->getValue(pos)); + } else { + sorted.set(k, arr->getValue(pos)); + } + } + *opaque.original = sorted; + } + + free(indices); +} + +int Array::SortRegularAscending(CVarRef v1, CVarRef v2, const void *data) { + if (v1.less(v2)) return -1; + if (v1.equal(v2)) return 0; + return 1; +} +int Array::SortRegularDescending(CVarRef v1, CVarRef v2, const void *data) { + if (v1.less(v2)) return 1; + if (v1.equal(v2)) return 0; + return -1; +} + +int Array::SortNumericAscending(CVarRef v1, CVarRef v2, const void *data) { + double d1 = v1.toDouble(); + double d2 = v2.toDouble(); + if (d1 < d2) return -1; + if (d1 == d2) return 0; + return 1; +} +int Array::SortNumericDescending(CVarRef v1, CVarRef v2, const void *data) { + double d1 = v1.toDouble(); + double d2 = v2.toDouble(); + if (d1 < d2) return 1; + if (d1 == d2) return 0; + return -1; +} + +int Array::SortStringAscending(CVarRef v1, CVarRef v2, const void *data) { + String s1 = v1.toString(); + String s2 = v2.toString(); + return strcmp(s1.data(), s2.data()); +} +int Array::SortStringDescending(CVarRef v1, CVarRef v2, const void *data) { + String s1 = v1.toString(); + String s2 = v2.toString(); + return strcmp(s2.data(), s1.data()); +} + +int Array::SortLocaleStringAscending(CVarRef v1, CVarRef v2, + const void *data) { + String s1 = v1.toString(); + String s2 = v2.toString(); + + return strcoll(s1.data(), s2.data()); +} + +int Array::SortLocaleStringDescending(CVarRef v1, CVarRef v2, + const void *data) { + String s1 = v1.toString(); + String s2 = v2.toString(); + + return strcoll(s2.data(), s1.data()); +} + +int Array::SortNatural(CVarRef v1, CVarRef v2, const void *data) { + String s1 = v1.toString(); + String s2 = v2.toString(); + return string_natural_cmp(s1.data(), s1.size(), s2.data(), s2.size(), 0); +} + +int Array::SortNaturalCase(CVarRef v1, CVarRef v2, const void *data) { + String s1 = v1.toString(); + String s2 = v2.toString(); + return string_natural_cmp(s1.data(), s1.size(), s2.data(), s2.size(), 1); +} + +/////////////////////////////////////////////////////////////////////////////// +// StaticArray + +StaticArray::StaticArray(ArrayElement *elem, ...) { + vector elems; + elems.reserve(128); // normally scalar arrays are large in size + + va_list ap; + va_start(ap, elem); + while (elem) { + elems.push_back(elem); + elem = va_arg(ap, ArrayElement*); + } + va_end(ap); + + SmartPtr::operator=(ArrayData::Create(elems)); + m_px->setStatic(); + m_px->onSetStatic(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/type_array.h b/src/cpp/base/type_array.h new file mode 100644 index 0000000000000..1252d93cb334b --- /dev/null +++ b/src/cpp/base/type_array.h @@ -0,0 +1,607 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ARRAY_H__ +#define __HPHP_ARRAY_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#define null_array Array::s_nullArray + +// macros for creating vectors or maps + +#define CREATE_VECTOR1(e) Array::Create(e) +#define CREATE_VECTOR2(e1, e2) \ + Array(NEW(ArrayElement)(e1), \ + NEW(ArrayElement)(e2), NULL) +#define CREATE_VECTOR3(e1, e2, e3) \ + Array(NEW(ArrayElement)(e1), \ + NEW(ArrayElement)(e2), \ + NEW(ArrayElement)(e3), \ + NULL) +#define CREATE_VECTOR4(e1, e2, e3, e4) \ + Array(NEW(ArrayElement)(e1), \ + NEW(ArrayElement)(e2), \ + NEW(ArrayElement)(e3), \ + NEW(ArrayElement)(e4), \ + NULL) +#define CREATE_VECTOR5(e1, e2, e3, e4, e5) \ + Array(NEW(ArrayElement)(e1), \ + NEW(ArrayElement)(e2), \ + NEW(ArrayElement)(e3), \ + NEW(ArrayElement)(e4), \ + NEW(ArrayElement)(e5), \ + NULL) +#define CREATE_VECTOR6(e1, e2, e3, e4, e5, e6) \ + Array(NEW(ArrayElement)(e1), \ + NEW(ArrayElement)(e2), \ + NEW(ArrayElement)(e3), \ + NEW(ArrayElement)(e4), \ + NEW(ArrayElement)(e5), \ + NEW(ArrayElement)(e6), \ + NULL) + +#define CREATE_MAP1(n, e) Array::Create(n, e) +#define CREATE_MAP2(n1, e1, n2, e2) \ + Array(NEW(ArrayElement)(n1, e1), \ + NEW(ArrayElement)(n2, e2), \ + NULL) +#define CREATE_MAP3(n1, e1, n2, e2, n3, e3) \ + Array(NEW(ArrayElement)(n1, e1), \ + NEW(ArrayElement)(n2, e2), \ + NEW(ArrayElement)(n3, e3), \ + NULL) +#define CREATE_MAP4(n1, e1, n2, e2, n3, e3, n4, e4) \ + Array(NEW(ArrayElement)(n1, e1), \ + NEW(ArrayElement)(n2, e2), \ + NEW(ArrayElement)(n3, e3), \ + NEW(ArrayElement)(n4, e4), \ + NULL) +#define CREATE_MAP5(n1, e1, n2, e2, n3, e3, n4, e4, n5, e5) \ + Array(NEW(ArrayElement)(n1, e1), \ + NEW(ArrayElement)(n2, e2), \ + NEW(ArrayElement)(n3, e3), \ + NEW(ArrayElement)(n4, e4), \ + NEW(ArrayElement)(n5, e5), \ + NULL) + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Array type wrapping around 7 types of ArrayData to implement reference + * counting, copy-on-write and ArrayData escalation. + * + * "Escalation" happens when an underlying ArrayData cannot handle an operation + * any more and instead it needs to "upgrade" itself to be a more general (but + * slower) type of ArrayData to accomplish the task. This "upgrade" is called + * escalation. This describes all possible escalation paths: + * + * +---------------------------------------------+ + * | +--> VectorLong ---+ V + * | | | +--> VectorVariant + * V +--> | VectorString ---+ | | + * EmptyArray <---+ V | +------+ + * A +--> MapLong | ---+ V + * | | V +--> MapVariant + * | +--> MapString ---+ A + * +---------------------------------------------+ + * + * (1) EmptyArray can escalate to any one of the 6 types directly, depending + * on data type of a new insertion. + * + * (2) VectorLong and VectorString are parallel to each other and they have to + * escalate to VectorVariant or MapVariant upon some insertions. + * (3) VectorLong needs to escalate to MapLong when a name-long pair is added. + * (4) VectorString escalates to MapString when a name-string pair is added. + * (5) VectorVariant escalates to MapVariant when a name value pair is added. + * + * (6) MapLong and MapString are parallel to each other and they escalate to + * MapVariant when value type is different than what they can handle. + * + * (7) Every ArrayData can escalate/downgrade/degenerate to EmptyArray, + * when last element is removed. + */ +class Array : public SmartPtr { + public: + /** + * Create an empty array or an array with one element. Note these are + * different than those copying constructors that also take one value. + */ + static Array Create() { return ArrayData::Create();} + static Array Create(CVarRef value) { return ArrayData::Create(value);} + static Array Create(CVarRef key, CVarRef value); + + public: + Array() {} + + static const Array s_nullArray; + + /** + * Constructors. Those that take "arr" or "var" are copy constructors, taking + * array value from the parameter, and they are NOT constructing an array + * with that single value (then one should use Array::Create() functions). + */ + Array(ArrayData *data); + Array(CArrRef arr); + Array(ArrayElement *elem, ...); + + /** + * Informational + */ + bool empty() const { + return m_px == NULL || m_px->empty(); + } + ssize_t size() const { + return m_px ? m_px->size() : 0; + } + ssize_t length() const { + return m_px ? m_px->size() : 0; + } + bool isNull() const { + return m_px == NULL; + } + bool valueExists(CVarRef search_value, bool strict = false) const; + Variant key(CVarRef search_value, bool strict = false) const; + Array keys(CVarRef search_value = null_variant, bool strict = false) const; + Array values() const; + + /** + * Operators + */ + Array &operator = (ArrayData *data); + Array &operator = (CArrRef v); + Array &operator = (CVarRef v); + Array operator + (CArrRef v) const; + Array operator + (CVarRef v) const; + Array &operator += (CArrRef v); + Array &operator += (CVarRef v); + + /** + * Returns the entries that have keys and/or values that are not present in + * specified array. Keys and values can be compared by user supplied + * functions and key_data or value_data will be passed into PFUNC_CMP as + * "data" parameter. Otherwise, equal() will be called for comparisons. If + * both by_key and by_value, both keys and values have to match to be + * excluded. + */ + typedef int (*PFUNC_CMP)(CVarRef v1, CVarRef v2, const void *data); + Array diff(CArrRef array, bool by_key, bool by_value, + PFUNC_CMP key_cmp_function = NULL, + const void *key_data = NULL, + PFUNC_CMP value_cmp_function = NULL, + const void *value_data = NULL) const; + + /** + * Returns the entries that have keys and/or values that are present in + * specified array. Keys and values can be compared by user supplied + * functions and key_data or value_data will be passed into PFUNC_CMP as + * "data" parameter. Otherwise, equal() will be called for comparisons. If + * both by_key and by_value, both keys and values have to match to be + * included. + */ + Array intersect(CArrRef array, bool by_key, bool by_value, + PFUNC_CMP key_cmp_function = NULL, + const void *key_data = NULL, + PFUNC_CMP value_cmp_function = NULL, + const void *value_data = NULL) const; + + /** + * Iterator functions. See array_iterator.h for end() and next(). + * escalate() will escalate me to become VectorVariant or MapVariant, so that + * getValueRef() can be called to take a reference to an array element. + */ + ArrayIter begin(const char *context = NULL) const { return m_px;} + void escalate(); + + /** + * Manipulations + * + * Merge: This is different from operator "+", where existing key's values + * are NOT modified. This function will actually override with new values. + * When merging a vector with a vector, new elements are always appended, and + * this is also different from operator "+", where existing numeric indices + * are not modified. + * + * Slice: Taking a slice. When "preserve_keys" is true, a vector will turn + * into numerically keyed map. + */ + Array &merge(CArrRef arr); + Array slice(int offset, int length, bool preserve_keys) const; + + /** + * Sorting. + */ + static int SortRegularAscending(CVarRef v1, CVarRef v2, const void *data); + static int SortNumericAscending(CVarRef v1, CVarRef v2, const void *data); + static int SortStringAscending(CVarRef v1, CVarRef v2, const void *data); + static int SortLocaleStringAscending(CVarRef v1, CVarRef v2, + const void *data); + + static int SortRegularDescending(CVarRef v1, CVarRef v2, const void *data); + static int SortNumericDescending(CVarRef v1, CVarRef v2, const void *data); + static int SortStringDescending(CVarRef v1, CVarRef v2, const void *data); + static int SortLocaleStringDescending(CVarRef v1, CVarRef v2, + const void *data); + + static int SortNatural(CVarRef v1, CVarRef v2, const void *data); + static int SortNaturalCase(CVarRef v1, CVarRef v2, const void *data); + + void sort(PFUNC_CMP cmp_func, bool by_key, bool renumber, + const void *data = NULL); + + /** + * Sort multiple arrays at once similar to how ORDER BY clause works in SQL. + */ + struct SortData { + Variant *original; + const Array *array; + bool by_key; + PFUNC_CMP cmp_func; + const void *data; + std::vector positions; + }; + static void MultiSort(std::vector &data, bool renumber); + + /** + * Type conversions + */ + bool toBoolean() const { return m_px && !m_px->empty();} + char toByte () const { return (m_px && !m_px->empty()) ? 1 : 0;} + short toInt16 () const { return (m_px && !m_px->empty()) ? 1 : 0;} + int toInt32 () const { return (m_px && !m_px->empty()) ? 1 : 0;} + int64 toInt64 () const { return (m_px && !m_px->empty()) ? 1 : 0;} + double toDouble () const { return (m_px && !m_px->empty()) ? 1.0 : 0.0;} + String toString () const { return m_px ? "Array" : "";} + Object toObject () const; + + /** + * Comparisons + */ + bool same (CArrRef v2) const; + bool same (CObjRef v2) const; + bool equal(CArrRef v2) const; + bool equal(CObjRef v2) const; + bool less (CArrRef v2, bool flip = false) const; + bool less (CObjRef v2) const; + bool less (CVarRef v2) const; + bool more (CArrRef v2, bool flip = true) const; + bool more (CObjRef v2) const; + bool more (CVarRef v2) const; + + /** + * Offset + */ + Variant rvalAt(bool key, int64 prehash = -1) const { + if (m_px) return m_px->get(key ? 1LL : 0LL, prehash); + return null; + } + Variant rvalAt(char key, int64 prehash = -1) const { + if (m_px) return m_px->get((int64)key, prehash); + return null; + } + Variant rvalAt(short key, int64 prehash = -1) const { + if (m_px) return m_px->get((int64)key, prehash); + return null; + } + Variant rvalAt(int key, int64 prehash = -1) const { + if (m_px) return m_px->get((int64)key, prehash); + return null; + } + Variant rvalAt(int64 key, int64 prehash = -1) const { + if (m_px) return m_px->get(key, prehash); + return null; + } + Variant rvalAt(ssize_t key, int64 prehash = -1) const { + if (m_px) return m_px->get((int64)key); + return null; + } + Variant rvalAt(double key, int64 prehash = -1) const { + if (m_px) return m_px->get((int64)key, prehash); + return null; + } + Variant rvalAt(litstr key, int64 prehash = -1) const { + if (m_px) return m_px->get(String(key).toKey(), prehash); + return null; + } + Variant rvalAt(CStrRef key, int64 prehash = -1) const { + if (m_px) return m_px->get(key.toKey(), prehash); + return null; + } + Variant rvalAt(CVarRef key, int64 prehash = -1) const; + + const Variant operator[](bool key) const { return rvalAt(key);} + const Variant operator[](char key) const { return rvalAt(key);} + const Variant operator[](short key) const { return rvalAt(key);} + const Variant operator[](int key) const { return rvalAt(key);} + const Variant operator[](int64 key) const { return rvalAt(key);} + const Variant operator[](ssize_t key) const { return rvalAt(key);} + const Variant operator[](double key) const { return rvalAt(key);} + const Variant operator[](litstr key) const { return rvalAt(key);} + const Variant operator[](CStrRef key) const { return rvalAt(key);} + const Variant operator[](CVarRef key) const { return rvalAt(key);} + + Variant &lval() { + ASSERT(m_px); + Variant *ret = NULL; + ArrayData *escalated = m_px->lval(ret, m_px->getCount() > 1); + if (escalated) { + SmartPtr::operator=(escalated); + } + ASSERT(ret); + return *ret; + } + + template + Variant &lval(const T &key) { + ASSERT(m_px); + Variant *ret = NULL; + ArrayData *escalated = m_px->lval(key, ret, m_px->getCount() > 1); + if (escalated) { + SmartPtr::operator=(escalated); + } + ASSERT(ret); + return *ret; + } + + Variant &lvalAt() { + append(null); + return lval(); + } + + Variant &lvalAt(bool key, int64 prehash = -1) { + return lvalAtImpl(key, prehash); + } + Variant &lvalAt(char key, int64 prehash = -1) { + return lvalAtImpl(key, prehash); + } + Variant &lvalAt(short key, int64 prehash = -1) { + return lvalAtImpl(key, prehash); + } + Variant &lvalAt(int key, int64 prehash = -1) { + return lvalAtImpl(key, prehash); + } + Variant &lvalAt(int64 key, int64 prehash = -1) { + return lvalAtImpl(key, prehash); + } + Variant &lvalAt(double key, int64 prehash = -1) { + return lvalAtImpl((int64)key, prehash); + } + Variant &lvalAt(litstr key, int64 prehash = -1); + Variant &lvalAt(CStrRef key, int64 prehash = -1); + Variant &lvalAt(CVarRef key, int64 prehash = -1); + + template + CVarRef setImpl(const T &key, CVarRef v, int64 prehash) { + if (!m_px) { + ArrayData *data = ArrayData::Create(key, v); + SmartPtr::operator=(data); + } else { + if (v.isContagious()) { + escalate(); + } + ArrayData *escalated = + m_px->set(key, v, (m_px->getCount() > 1), prehash); + if (escalated) { + SmartPtr::operator=(escalated); + } + } + return v; + } + CVarRef set(bool key, CVarRef v, int64 prehash = -1) { + return setImpl(key ? 1LL : 0LL, v, prehash); + } + CVarRef set(char key, CVarRef v, int64 prehash = -1) { + return setImpl((int64)key, v, prehash); + } + CVarRef set(short key, CVarRef v, int64 prehash = -1) { + return setImpl((int64)key, v, prehash); + } + CVarRef set(int key, CVarRef v, int64 prehash = -1) { + return setImpl((int64)key, v, prehash); + } + CVarRef set(int64 key, CVarRef v, int64 prehash = -1) { + return setImpl(key, v, prehash); + } + CVarRef set(double key, CVarRef v, int64 prehash = -1) { + return setImpl((int64)key, v, prehash); + } + CVarRef set(litstr key, CVarRef v, int64 prehash = -1) { + return setImpl(String(key).toKey(), v, prehash); + } + CVarRef set(CStrRef key, CVarRef v, int64 prehash = -1) { + return setImpl(key.toKey(), v, prehash); + } + CVarRef set(CVarRef key, CVarRef v, int64 prehash = -1); + + template + Variant refvalAt(T key, int64 prehash = -1) { + return ref(lvalAt(key, prehash)); + } + + /** + * Membership functions. + */ + template + bool existsImpl(const T &key, int64 prehash) const { + if (m_px) return m_px->exists(key, prehash); + return false; + } + bool exists(bool key, int64 prehash = -1) const { + return existsImpl(key ? 1LL : 0LL, prehash); + } + bool exists(char key, int64 prehash = -1) const { + return existsImpl((int64)key, prehash); + } + bool exists(short key, int64 prehash = -1) const { + return existsImpl((int64)key, prehash); + } + bool exists(int key, int64 prehash = -1) const { + return existsImpl((int64)key, prehash); + } + bool exists(int64 key, int64 prehash = -1) const { + return existsImpl(key, prehash); + } + bool exists(double key, int64 prehash = -1) const { + return existsImpl((int64)key, prehash); + } + bool exists(litstr key, int64 prehash = -1) const { + return existsImpl(String(key).toKey(), prehash); + } + bool exists(CStrRef key, int64 prehash = -1) const { + return existsImpl(key.toKey(), prehash); + } + bool exists(CVarRef key, int64 prehash = -1) const; + + template + void removeImpl(const T &key, int64 prehash) { + if (m_px) { + ArrayData *escalated = m_px->remove(key, (m_px->getCount() > 1), prehash); + if (escalated) { + SmartPtr::operator=(escalated); + } + } + } + void remove(bool key, int64 prehash = -1) { + removeImpl(key ? 1LL : 0LL, prehash); + } + void remove(char key, int64 prehash = -1) { + removeImpl((int64)key, prehash); + } + void remove(short key, int64 prehash = -1) { + removeImpl((int64)key, prehash); + } + void remove(int key, int64 prehash = -1) { + removeImpl((int64)key, prehash); + } + void remove(int64 key, int64 prehash = -1) { + removeImpl(key, prehash); + } + void remove(double key, int64 prehash = -1) { + removeImpl((int64)key, prehash); + } + void remove(litstr key, int64 prehash = -1) { + removeImpl(String(key).toKey(), prehash); + } + void remove(CStrRef key, int64 prehash = -1) { + removeImpl(key.toKey(), prehash); + } + void remove(CVarRef key, int64 prehash = -1); + + template + void weakRemove(const T &key, int64 prehash = -1) { + if (m_px) remove(key, prehash); + } + + void removeAll(); + void clear() { removeAll();} + + Variant append(CVarRef v); + Variant pop(); + Variant dequeue(); + void insert(int pos, CVarRef v); + + /** + * Input/Output + */ + void serialize(VariableSerializer *serializer) const; + void unserialize(VariableUnserializer *in); + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION_NOCALLBACKS(Array); + void dump(); + + ArrayData *getArrayData() const { + return m_px; + } + + void setStatic() const { + if (m_px) { + m_px->setStatic(); + m_px->onSetStatic(); + } + } + + private: + // helpers + bool compare(CArrRef v2) const; + Array &mergeImpl(CArrRef arr, ArrayData::ArrayOp op); + Array diffImpl(CArrRef array, bool by_key, bool by_value, bool match, + PFUNC_CMP key_cmp_function, const void *key_data, + PFUNC_CMP value_cmp_function, const void *value_data) const; + + template + Variant &lvalAtImpl(const T &key, int64 prehash = -1) { + if (!m_px) m_px = ArrayData::Create(); + Variant *ret = NULL; + ArrayData *escalated = m_px->lval(key, ret, m_px->getCount() > 1, prehash); + if (escalated) { + SmartPtr::operator=(escalated); + } + ASSERT(ret); + return *ret; + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * A StaticArray can be co-accessed by multiple threads, therefore they are + * not thread local, and they have to be allocated BEFORE any thread starts, + * so that they won't be garbage collected by MemoryManager. This is used by + * scalar arrays, so they can be pre-allocated before request handling. + */ +class StaticArray : public Array { +public: + StaticArray() { } + StaticArray(ArrayElement *elem, ...); + ~StaticArray() { + // prevent ~SmartPtr from calling decRefCount after data is released + m_px = NULL; + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +class ArrayInit { +public: + ArrayInit(int n) : m_elements(n) { } + + ArrayInit &set(int p, const ArrayElement &e) { + m_elements[p] = (ArrayElement *)&e; + return *this; + } + + ArrayData *create() { + return ArrayData::Create(m_elements, true, false); + } + +private: + ArrayElementVec m_elements; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ARRAY_H__ diff --git a/src/cpp/base/type_object.cpp b/src/cpp/base/type_object.cpp new file mode 100644 index 0000000000000..1a0a8c2a75fe4 --- /dev/null +++ b/src/cpp/base/type_object.cpp @@ -0,0 +1,54 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { + +const Object Object::s_nullObject = Object(); + +/////////////////////////////////////////////////////////////////////////////// + +Variant Object::o_get(CStrRef propName, int64 hash /* = -1 */) const { + if (!m_px) throw NullPointerException(); + return m_px->o_get(propName, hash); +} + +ObjectOffset Object::o_lval(CStrRef propName, int64 hash /* = -1 */) { + if (!m_px) throw NullPointerException(); + return ObjectOffset(m_px, propName, hash); +} + +/////////////////////////////////////////////////////////////////////////////// +// output + +void Object::serialize(VariableSerializer *serializer) const { + if (m_px) { + m_px->serialize(serializer); + } else { + serializer->writeNull(); + } +} + +bool Object::unserialize(std::istream &in) { + throw NotImplementedException(__func__); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/type_object.h b/src/cpp/base/type_object.h new file mode 100644 index 0000000000000..10655bef8f15a --- /dev/null +++ b/src/cpp/base/type_object.h @@ -0,0 +1,129 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_OBJECT_H__ +#define __HPHP_OBJECT_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#define null_object Object::s_nullObject + +/** + * Object type wrapping around ObjectData to implement reference count. + */ +class Object : public SmartPtr { + public: + Object() {} + + static const Object s_nullObject; + + /** + * Constructors + */ + Object(ObjectData *data) { + SmartPtr::operator=(data); + } + Object(CObjRef src) { + SmartPtr::operator=(src.m_px); + } + + /** + * Informational + */ + bool isNull() const { + return m_px == NULL; + } + bool isResource() const { + return m_px && m_px->isResource(); + } + bool instanceof(const char *s) const { + return m_px && m_px->o_instanceof(s); + } + + template + T *getTyped(bool nullOkay = false, bool badTypeOkay = false) const { + if (!m_px) { + if (!nullOkay) { + throw NullPointerException(); + } + return NULL; + } + + T *px = dynamic_cast(m_px); + if (!px && !badTypeOkay) { + throw InvalidObjectTypeException(m_px->o_getClassName()); + } + + return px; + } + + template + bool is() const { + return getTyped(true, true) != NULL; + } + + /** + * Type conversions + */ + bool toBoolean() const { return m_px != NULL;} + char toByte () const { return m_px ? m_px->o_toInt64() : 0;} + short toInt16 () const { return m_px ? m_px->o_toInt64() : 0;} + int toInt32 () const { return m_px ? m_px->o_toInt64() : 0;} + int64 toInt64 () const { return m_px ? m_px->o_toInt64() : 0;} + double toDouble () const { return m_px ? m_px->o_toInt64() : 0;} + String toString () const { return m_px ? m_px->t___tostring() : String();} + Array toArray () const { return m_px ? m_px->o_toArray() : Array();} + Variant toKey() const { + return m_px ? (isResource() ? m_px->o_toInt64() : m_px->t___tostring()) + : String(); + } + + /** + * Comparisons + */ + bool same (CObjRef v2) const { return m_px == v2.get();} + bool equal(CObjRef v2) const { + return m_px == v2.get() || + (v2.get() && m_px && v2.get()->o_isClass(m_px->o_getClassName()) && + toArray().equal(v2.toArray())); + } + bool less (CObjRef v2) const { return false;} + bool more (CObjRef v2) const { return false;} + + /** + * Unresolved objects will go through these two functions than the ones + * on SmartObject. + */ + Variant o_get(CStrRef propName, int64 hash = -1) const; + ObjectOffset o_lval(CStrRef propName, int64 hash = -1); + + /** + * Input/Output + */ + void serialize(VariableSerializer *serializer) const; + bool unserialize(std::istream &in); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_OBJECT_H__ diff --git a/src/cpp/base/type_string.cpp b/src/cpp/base/type_string.cpp new file mode 100644 index 0000000000000..e95997706ecc0 --- /dev/null +++ b/src/cpp/base/type_string.cpp @@ -0,0 +1,637 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +#define SERIALIZE_MAX_SIZE (64*1024*1024) + +const String String::s_nullString = String(); + +/////////////////////////////////////////////////////////////////////////////// +// statics + +String String::FromChar(char ch) { + char tmpbuf[2]; + tmpbuf[0] = ch; + tmpbuf[1] = 0; + return String(tmpbuf, CopyString); +} + +/////////////////////////////////////////////////////////////////////////////// +// constructors + +String::String(litstr s) { + SmartPtr::operator=(NEW(StringData)(s, AttachLiteral)); +} + +String::String(const std::string &s) { + SmartPtr::operator=(NEW(StringData)(s.data(), s.size(), + CopyString)); +} + +String::String(const char *s, StringDataMode mode) { + if (s) { + SmartPtr::operator=(NEW(StringData)(s, mode)); + } +} + +String::String(const char *s, int length, StringDataMode mode) { + if (s) { + SmartPtr::operator=(NEW(StringData)(s, length, mode)); + } +} + +String::String(StringData *data) { + SmartPtr::operator=(data); +} + +String::String(CStrRef str) { + SmartPtr::operator=(str.m_px); +} + +String::String(int n) { + char tmpbuf[12]; + char *p; + int is_negative; + int len; + char *buf; + + tmpbuf[11] = '\0'; + p = conv_10(n, &is_negative, &tmpbuf[11], &len); + + buf = (char*)malloc(len + 1); + memcpy(buf, p, len + 1); // including the null terminator. + SmartPtr::operator=(NEW(StringData)(buf, AttachString)); +} + +String::String(int64 n) { + char tmpbuf[21]; + char *p; + int is_negative; + int len; + char *buf; + + tmpbuf[20] = '\0'; + p = conv_10(n, &is_negative, &tmpbuf[20], &len); + + buf = (char*)malloc(len + 1); + memcpy(buf, p, len + 1); // including the null terminator. + SmartPtr::operator=(NEW(StringData)(buf, AttachString)); +} + +String::String(double n) { + char *buf; + if (n == 0.0) n = 0.0; // so to avoid "-0" output + vspprintf(&buf, 0, "%.*G", 14, n); + SmartPtr::operator=(NEW(StringData)(buf, AttachString)); +} + +void String::assign(const char *data, StringDataMode mode) { + if (data) { + SmartPtr::operator=(NEW(StringData)(data, mode)); + } else { + reset(); + } +} + +void String::assign(const char *data, int len, StringDataMode mode) { + if (data) { + SmartPtr::operator=(NEW(StringData)(data, len, mode)); + } else { + reset(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// informational + +String String::substr(int start, int length /* = 0x7FFFFFFF */) const { + int len = size(); + char *ret = string_substr(data(), len, start, length); + return String(ret, len, AttachString); +} + +int String::find(char ch, int pos /* = 0 */, + bool caseSensitive /* = true */) const { + if (empty()) return -1; + return string_find(m_px->data(), m_px->size(), ch, pos, caseSensitive); +} + +int String::find(const char *s, int pos /* = 0 */, + bool caseSensitive /* = true */) const { + ASSERT(s); + if (empty()) return -1; + if (*s && *(s+1) == 0) { + return find(*s, pos, caseSensitive); + } + return string_find(m_px->data(), m_px->size(), s, strlen(s), + pos, caseSensitive); +} + +int String::find(CStrRef s, int pos /* = 0 */, + bool caseSensitive /* = true */) const { + if (empty()) return -1; + if (s.size() == 1) { + return find(*s.data(), pos, caseSensitive); + } + return string_find(m_px->data(), m_px->size(), s.data(), s.size(), + pos, caseSensitive); +} + +int String::rfind(char ch, int pos /* = -1 */, + bool caseSensitive /* = true */) const { + if (empty()) return -1; + return string_rfind(m_px->data(), m_px->size(), ch, pos, caseSensitive); +} + +int String::rfind(const char *s, int pos /* = -1 */, + bool caseSensitive /* = true */) const { + ASSERT(s); + if (empty()) return -1; + if (*s && *(s+1) == 0) { + return rfind(*s, pos, caseSensitive); + } + return string_rfind(m_px->data(), m_px->size(), s, strlen(s), + pos, caseSensitive); +} + +int String::rfind(CStrRef s, int pos /* = -1 */, + bool caseSensitive /* = true */) const { + if (empty()) return -1; + if (s.size() == 1) { + return rfind(*s.data(), pos, caseSensitive); + } + return string_rfind(m_px->data(), m_px->size(), s.data(), s.size(), + pos, caseSensitive); +} + +String String::replace(int start, int length, CStrRef replacement) const { + int len = size(); + char *ret = string_replace(data(), len, start, length, replacement.data(), + replacement.size()); + return String(ret, len, AttachString); +} + +String String::replace(CStrRef search, CStrRef replacement) const { + int count; + return replace(search, replacement, count, true); +} + +String String::replace(CStrRef search, CStrRef replacement, int &count, + bool caseSensitive) const { + count = 0; + if (!search.empty() && !empty()) { + int len = m_px->size(); + char *ret = string_replace(m_px->data(), len, search.data(), search.size(), + replacement.data(), replacement.size(), count, + caseSensitive); + if (ret) { + return String(ret, len, AttachString); + } + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +// offset functions: cannot inline these due to dependencies + +String String::rvalAt(CArrRef key) const { + return rvalAtImpl(key.toInt32()); +} + +String String::rvalAt(CObjRef key) const { + return rvalAtImpl(key.toInt32()); +} + +String String::rvalAt(CVarRef key) const { + return rvalAtImpl(key.toInt32()); +} + +StringOffset String::lvalAt(CArrRef key) { + return lvalAtImpl(key.toInt32()); +} + +StringOffset String::lvalAt(CObjRef key) { + return lvalAtImpl(key.toInt32()); +} + +StringOffset String::lvalAt(CVarRef key) { + return lvalAtImpl(key.toInt32()); +} + +char String::charAt(int pos) const { + ASSERT(pos >= 0 && pos <= size()); + const char *s = data(); + return s[pos]; +} + +/////////////////////////////////////////////////////////////////////////////// +// assignments + +String &String::operator=(litstr s) { + if (s) { + SmartPtr::operator=(NEW(StringData)(s, AttachLiteral)); + } else { + reset(); + } + return *this; +} + +String &String::operator=(StringData *data) { + SmartPtr::operator=(data); + return *this; +} + +String &String::operator=(CStrRef str) { + SmartPtr::operator=(str.m_px); + return *this; +} + +String &String::operator=(CVarRef var) { + return operator=(var.toString()); +} + +/////////////////////////////////////////////////////////////////////////////// +// concatenation and increments + +String &String::operator+=(litstr s) { + if (s && *s) { + if (empty()) { + SmartPtr::operator=(NEW(StringData)(s, AttachLiteral)); + } else if (m_px->getCount() == 1) { + int len = strlen(s); + m_px->append(s, len); + } else { + int len; + char *ret = string_concat(data(), size(), s, strlen(s), len); + SmartPtr::operator=(NEW(StringData)(ret, len, AttachString)); + } + } + return *this; +} + +String &String::operator+=(CStrRef str) { + if (!str.empty()) { + if (empty()) { + SmartPtr::operator=(str.m_px); + } else if (m_px->getCount() == 1) { + m_px->append(str.data(), str.size()); + } else { + int len; + char *ret = string_concat(data(), size(), str.data(), str.size(), len); + SmartPtr::operator=(NEW(StringData)(ret, len, AttachString)); + } + } + return *this; +} + +String String::operator+(litstr str) const { + if (empty()) return str; + + if (!str || !*str) return *this; + + int len; + char *ret = string_concat(data(), size(), str, strlen(str), len); + return NEW(StringData)(ret, len, AttachString); +} + +String String::operator+(CStrRef str) const { + if (empty()) return str; + + if (str.empty()) return *this; + + int len; + char *ret = string_concat(data(), size(), str.data(), str.size(), len); + return NEW(StringData)(ret, len, AttachString); +} + +String String::operator~() const { + String ret(NEW(StringData)(data(), size(), CopyString)); + ret->negate(); + return ret; +} + +String String::operator|(CStrRef v) const { + return String(m_px).operator|=(v); +} + +String String::operator&(CStrRef v) const { + return String(m_px).operator&=(v); +} + +String String::operator^(CStrRef v) const { + return String(m_px).operator^=(v); +} + +String &String::operator|=(CStrRef v) { + const char *s1 = data(); + const char *s2 = v.data(); + int len1 = size(); + int len2 = v.size(); + char *copy = NULL; + if (len2 > len1) { + copy = string_duplicate(s2, len2); + for (int i = 0; i < len1; i++) copy[i] |= s1[i]; + SmartPtr::operator=(NEW(StringData)(copy, len2, AttachString)); + } else { + copy = string_duplicate(s1, len1); + for (int i = 0; i < len2; i++) copy[i] |= s2[i]; + SmartPtr::operator=(NEW(StringData)(copy, len1, AttachString)); + } + return *this; +} + +String &String::operator&=(CStrRef v) { + const char *s1 = data(); + const char *s2 = v.data(); + int len1 = size(); + int len2 = v.size(); + char *copy = NULL; + if (len2 < len1) { + copy = string_duplicate(s2, len2); + for (int i = 0; i < len2; i++) copy[i] &= s1[i]; + SmartPtr::operator=(NEW(StringData)(copy, len2, AttachString)); + } else { + copy = string_duplicate(s1, len1); + for (int i = 0; i < len1; i++) copy[i] &= s2[i]; + SmartPtr::operator=(NEW(StringData)(copy, len1, AttachString)); + } + return *this; +} + +String &String::operator^=(CStrRef v) { + const char *s1 = data(); + const char *s2 = v.data(); + int len1 = size(); + int len2 = v.size(); + char *copy = NULL; + if (len2 < len1) { + copy = string_duplicate(s2, len2); + for (int i = 0; i < len2; i++) copy[i] ^= s1[i]; + SmartPtr::operator=(NEW(StringData)(copy, len2, AttachString)); + } else { + copy = string_duplicate(s1, len1); + for (int i = 0; i < len1; i++) copy[i] ^= s2[i]; + SmartPtr::operator=(NEW(StringData)(copy, len1, AttachString)); + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +// conversions + +Variant String::toKey() const { + if (!m_px) return *this; + int64 n = 0; + if (m_px->isStrictlyInteger(n)) { + return n; + } else { + return *this; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// comparisons + +bool String::same(litstr v2) const { + return same(String(v2)); +} + +bool String::same(CStrRef v2) const { + if (m_px == NULL && v2.get() == NULL) return true; + if (m_px && v2.get()) return equal(v2); + return false; +} + +bool String::same(CArrRef v2) const { + return false; +} + +bool String::same(CObjRef v2) const { + return false; +} + +bool String::equal(litstr v2) const { + return equal(String(v2)); +} + +bool String::equal(CStrRef v2) const { + if (size() != v2.size()) return false; + if (m_px == NULL && v2.get() == NULL) return true; + if (m_px == NULL) return v2.empty(); + if (v2.get() == NULL) return empty(); + return m_px->compare(v2.get()) == 0; +} + +bool String::equal(CArrRef v2) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::equal(toBoolean(), v2.toBoolean()); + } + return false; +} + +bool String::equal(CObjRef v2) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::equal(toBoolean(), v2.toBoolean()); + } + try { + return equal(v2.toString()); + } catch (BadTypeConversionException &e) { + return false; + } +} + +bool String::less(litstr v2) const { + return less(String(v2)); +} + +bool String::less(CStrRef v2) const { + if (m_px == NULL && v2.get() == NULL) return false; + if (m_px == NULL) return !v2.empty(); + if (v2.get() == NULL) return empty(); + return m_px->compare(v2.get()) < 0; +} + +bool String::less(CArrRef v2) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::less(toBoolean(), v2.toBoolean()); + } + return true; +} + +bool String::less(CObjRef v2) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::less(toBoolean(), v2.toBoolean()); + } + return true; +} + +bool String::more(litstr v2) const { + return more(String(v2)); +} + +bool String::more(CStrRef v2) const { + if (m_px == NULL && v2.get() == NULL) return false; + if (m_px == NULL) return v2.empty(); + if (v2.get() == NULL) return !empty(); + return m_px->compare(v2.get()) > 0; +} + +bool String::more(CArrRef v2) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::more(toBoolean(), v2.toBoolean()); + } + return false; +} + +bool String::more(CObjRef v2) const { + if (m_px == NULL || v2.get() == NULL) { + return HPHP::more(toBoolean(), v2.toBoolean()); + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// comparison operators + +bool String::operator==(litstr v) const { + return HPHP::equal(*this, v); +} + +bool String::operator!=(litstr v) const { + return !HPHP::equal(*this, v); +} + +bool String::operator>=(litstr v) const { + return not_less(*this, v); +} + +bool String::operator<=(litstr v) const { + return not_more(*this, v); +} + +bool String::operator>(litstr v) const { + return HPHP::more(*this, v); +} + +bool String::operator<(litstr v) const { + return HPHP::less(*this, v); +} + +bool String::operator==(CVarRef v) const { + return HPHP::equal(*this, v); +} + +bool String::operator!=(CVarRef v) const { + return !HPHP::equal(*this, v); +} + +bool String::operator>=(CVarRef v) const { + return not_less(*this, v); +} + +bool String::operator<=(CVarRef v) const { + return not_more(*this, v); +} + +bool String::operator>(CVarRef v) const { + return HPHP::more(*this, v); +} + +bool String::operator<(CVarRef v) const { + return HPHP::less(*this, v); +} + +/////////////////////////////////////////////////////////////////////////////// +// input/output + +void String::serialize(VariableSerializer *serializer) const { + if (m_px) { + serializer->write(m_px->data(), m_px->size()); + } else { + serializer->writeNull(); + } +} + +void String::unserialize(std::istream &in) { + int size; + in >> size; + if (size >= SERIALIZE_MAX_SIZE) { + throw Exception("Size of serialized string (%d) exceeds max", size); + } + + char ch; + in >> ch; + if (ch != ':') throw Exception("Expected ':' but got '%c'", ch); + in >> ch; + if (ch != '"') throw Exception("Expected '\"' but got '%c'", ch); + + char *buf = (char*)malloc(size + 1); + in.read(buf, size); + buf[size] = '\0'; + SmartPtr::operator=(NEW(StringData)(buf, size, AttachString)); + + in >> ch; + if (ch != '"') throw Exception("Expected '\"' but got '%c'", ch); +} + +/////////////////////////////////////////////////////////////////////////////// +// debugging + +void String::dump() { + if (m_px) { + m_px->dump(); + } else { + printf("(null)\n"); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// StaticString + +StaticString::StaticString(litstr s) : m_data(s) { + String::operator=(&m_data); + m_px->setStatic(); +} + +StaticString::StaticString(litstr s, int length) + : m_data(s, length, AttachLiteral) { + String::operator=(&m_data); + m_px->setStatic(); +} + +StaticString::StaticString(const StaticString &str) + : m_data(str.m_data.data(), str.m_data.size(), AttachLiteral) { + String::operator=(&m_data); + m_px->setStatic(); +} + +StaticString &StaticString::operator=(litstr s) { + m_data.assign(s, AttachLiteral); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/type_string.h b/src/cpp/base/type_string.h new file mode 100644 index 0000000000000..b1f3d1ae42fe3 --- /dev/null +++ b/src/cpp/base/type_string.h @@ -0,0 +1,315 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_STRING_H__ +#define __HPHP_STRING_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#define null_string String::s_nullString + +/** + * String type wrapping around StringData to implement copy-on-write and + * literal string handling (to avoid string copying). + */ +class String : public SmartPtr { +public: + // create a string from a character + static String FromChar(char ch); + +public: + String() {} + + static const String s_nullString; + + /** + * Constructors + */ + String(StringData *data); + String(int n); + String(int64 n); + String(double n); + String(litstr s); + String(CStrRef str); + + String(const std::string &s); // always make a copy + String(const char *s, StringDataMode mode); // null-terminated string + String(const char *s, int length, StringDataMode mode); // binary string + + void assign(const char *data, StringDataMode mode); + void assign(const char *data, int len, StringDataMode mode); + void assignLiteral(litstr data) { + assign(data, AttachLiteral); + } + + void clear() { reset();} + /** + * Informational + */ + operator const char *() const { + return m_px ? m_px->data() : ""; + } + const char *data() const { + return m_px ? m_px->data() : ""; + } + const char *c_str() const { + return m_px ? m_px->data() : ""; + } + bool empty() const { + return m_px ? m_px->empty() : true; + } + int size() const { + return m_px ? m_px->size() : 0; + } + int length() const { + return m_px ? m_px->size() : 0; + } + bool isNull() const { + return m_px == NULL; + } + bool isNumeric() const { + return m_px ? m_px->isNumeric() : false; + } + bool isInteger() const { + return m_px ? m_px->isInteger() : false; + } + bool isZero() const { + return m_px ? m_px->isZero() : false; + } + + bool isValidVariableName() const { + return m_px ? m_px->isValidVariableName() : false; + } + bool isLiteral() const { + return m_px ? m_px->isLiteral() : true; + } + + /** + * Take a sub-string from start with specified length. Note, read + * http://www.php.net/substr about meanings of negative start or length. + */ + String substr(int start, int length = 0x7FFFFFFF) const; + + /** + * Find a character or a substring and return its position. "pos" has to be + * within current string and it's the start point for searching. + */ + static const int npos = -1; + int find(char ch, int pos = 0, bool caseSensitive = true) const; + int find(const char *s, int pos = 0, bool caseSensitive = true) const; + int find(CStrRef s, int pos = 0, bool caseSensitive = true) const; + int rfind(char ch, int pos = -1, bool caseSensitive = true) const; + int rfind(const char *s, int pos = -1, bool caseSensitive = true) const; + int rfind(CStrRef s, int pos = -1, bool caseSensitive = true) const; + + /** + * Replace a substr with another and return replaced one. Note, read + * http://www.php.net/substr about meanings of negative start or length. + * + * The form that takes a "count" reference will still replace all occurrences + * and return total replaced count in the out parameter. It does NOT mean + * it will replace at most that many occurrences, so count's input value + * is never checked. + */ + String replace(int start, int length, CStrRef replacement) const; + String replace(CStrRef search, CStrRef replacement) const; + String replace(CStrRef search, CStrRef replacement, int &count, + bool caseSensitive) const; + + /** + * Operators + */ + String &operator = (StringData *data); + String &operator = (litstr v); + String &operator = (CStrRef v); + String &operator = (CVarRef v); + String operator + (litstr v) const; + String operator + (CStrRef v) const; + String &operator += (litstr v); + String &operator += (CStrRef v); + String operator | (CStrRef v) const; + String operator & (CStrRef v) const; + String operator ^ (CStrRef v) const; + String &operator |= (CStrRef v); + String &operator &= (CStrRef v); + String &operator ^= (CStrRef v); + String operator ~ () const; + + /** + * These are convenient functions for writing extensions, since code + * generation always uses explicit functions like same(), less() etc. that + * are type specialized and unambiguous. + */ + bool operator == (litstr v) const; + bool operator != (litstr v) const; + bool operator >= (litstr v) const; + bool operator <= (litstr v) const; + bool operator > (litstr v) const; + bool operator < (litstr v) const; + bool operator == (CVarRef v) const; + bool operator != (CVarRef v) const; + bool operator >= (CVarRef v) const; + bool operator <= (CVarRef v) const; + bool operator > (CVarRef v) const; + bool operator < (CVarRef v) const; + + /** + * Type conversions + */ + bool toBoolean() const { return m_px ? m_px->toBoolean() : false;} + char toByte () const { return m_px ? m_px->toByte () : false;} + short toInt16 () const { return m_px ? m_px->toInt16 () : 0;} + int toInt32 () const { return m_px ? m_px->toInt32 () : 0;} + int64 toInt64 () const { return m_px ? m_px->toInt64 () : 0;} + double toDouble () const { return m_px ? m_px->toDouble () : 0;} + Variant toKey () const; + + /** + * Comparisons + */ + bool same (litstr v2) const; + bool same (CStrRef v2) const; + bool same (CArrRef v2) const; + bool same (CObjRef v2) const; + bool equal(litstr v2) const; + bool equal(CStrRef v2) const; + bool equal(CArrRef v2) const; + bool equal(CObjRef v2) const; + bool less (litstr v2) const; + bool less (CStrRef v2) const; + bool less (CArrRef v2) const; + bool less (CObjRef v2) const; + bool more (litstr v2) const; + bool more (CStrRef v2) const; + bool more (CArrRef v2) const; + bool more (CObjRef v2) const; + + /** + * Offset + */ + String rvalAt(bool key) const { return rvalAtImpl(key ? 1 : 0);} + String rvalAt(char key) const { return rvalAtImpl(key);} + String rvalAt(short key) const { return rvalAtImpl(key);} + String rvalAt(int key) const { return rvalAtImpl(key);} + String rvalAt(int64 key) const { return rvalAtImpl(key);} + String rvalAt(double key) const { return rvalAtImpl((int64)key);} + String rvalAt(litstr key) const { return rvalAtImpl(String(key).toInt32());} + String rvalAt(CStrRef key) const { return rvalAtImpl(key.toInt32());} + String rvalAt(CArrRef key) const; + String rvalAt(CObjRef key) const; + String rvalAt(CVarRef key) const; + + StringOffset lvalAt(bool key) { return lvalAtImpl(key ? 1 : 0);} + StringOffset lvalAt(char key) { return lvalAtImpl(key);} + StringOffset lvalAt(short key) { return lvalAtImpl(key);} + StringOffset lvalAt(int key) { return lvalAtImpl(key);} + StringOffset lvalAt(int64 key) { return lvalAtImpl(key);} + StringOffset lvalAt(double key) { return lvalAtImpl((int64)key);} + StringOffset lvalAt(litstr key) { return lvalAtImpl(String(key).toInt32());} + StringOffset lvalAt(CStrRef key) { return lvalAtImpl(key.toInt32());} + StringOffset lvalAt(CArrRef key); + StringOffset lvalAt(CObjRef key); + StringOffset lvalAt(CVarRef key); + + template + String refvalAt(T key) { + return rvalAt(key); + } + + /** + * Returns one character at specified position. + */ + char charAt(int pos) const; + char operator[](int pos) const { return charAt(pos);} + + /** + * Input/Output + */ + void serialize(VariableSerializer *serializer) const; + void unserialize(std::istream &in); + + /** + * Debugging + */ + void dump(); + + private: + StringOffset lvalAtImpl(int key) { + SmartPtr::operator= + (NEW(StringData)(data(), size(), CopyString)); + return StringOffset(m_px, key); + } + + String rvalAtImpl(int key) const { + if (m_px) { + return m_px->getChar(key); + } + return String(); + } +}; + +struct zend_hash { + size_t operator()(CStrRef s) const { + return hash_string(s.data(), s.size()); + } +}; + +struct zend_eqstr { + bool operator()(CStrRef s1, CStrRef s2) const { + return string_strcmp(s1.data(), s1.size(), s2.data(), s2.size()) == 0; + } +}; + +/** + * Two useful typedefs + */ +typedef hphp_hash_set StringSet; +typedef hphp_hash_map MapStringToInt; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * A StaticString can be co-accessed by multiple threads, therefore they are + * not thread local, and they have to be allocated BEFORE any thread starts, + * so that they won't be garbage collected by MemoryManager. This is used by + * constant strings, so they can be pre-allocated before request handling. + */ +class StaticString : public String { +public: + StaticString() {} + StaticString(litstr s); + StaticString(litstr s, int length); // binary string + StaticString(const StaticString &str); + ~StaticString() { + // prevent ~SmartPtr from calling decRefCount after data is released + m_px = NULL; + } + StaticString &operator = (litstr v); +private: + StringData m_data; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_STRING_H__ diff --git a/src/cpp/base/type_variant.cpp b/src/cpp/base/type_variant.cpp new file mode 100644 index 0000000000000..8549d8f3d51e7 --- /dev/null +++ b/src/cpp/base/type_variant.cpp @@ -0,0 +1,2770 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { + +const Variant Variant::s_nullVariant = Variant(); + +IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS(Variant); +/////////////////////////////////////////////////////////////////////////////// +// private implementations + +Variant::Variant(CStrRef v) : m_type(KindOfString) { + StringData *s = v.get(); + if (s) { + m_data.pstr = s; + s->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } +} + +Variant::Variant(CArrRef v) : m_type(KindOfArray) { + ArrayData *a = v.get(); + if (a) { + m_data.parr = a; + a->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } +} + +Variant::Variant(CObjRef v) : m_type(KindOfObject) { + ObjectData *o = v.get(); + if (o) { + m_data.pobj = o; + o->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } +} + +Variant::Variant(StringData *v) : m_type(KindOfString) { + if (v) { + m_data.pstr = v; + v->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } +} + +Variant::Variant(ArrayData *v) : m_type(KindOfArray) { + if (v) { + m_data.parr = v; + v->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } +} + +Variant::Variant(ObjectData *v) : m_type(KindOfObject) { + if (v) { + m_data.pobj = v; + v->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } +} + +Variant::Variant(Variant *v) : m_type(KindOfVariant) { + if (v) { + m_data.pvar = v; + } else { + m_data.num = 0; + m_type = KindOfNull; + } +} + +Variant::Variant(CVarRef v) : m_type(KindOfNull) { + m_data.num = 0; + if (v.isContagious()) { + v.clearContagious(); // do it early to avoid bind() triggers deletion of v + + // we have to wrap up v into a sharable form + if (v.m_type != KindOfVariant) { + Variant *shared = NEW(Variant)(); + shared->bind(v); + const_cast(v).bind(shared); + } + + // then we can share v.m_data.pvar + bind(v.m_data.pvar); + + } else { + bind(v); + } +} + +void Variant::reset() { + m_data.num = 0; + m_type = KindOfNull; +} + +void Variant::destruct() { + switch (m_type) { + case KindOfString: + if (m_data.pstr->decRefCount() == 0) { + m_data.pstr->release(); + } + break; + case KindOfArray: + if (m_data.parr->decRefCount() == 0) { + m_data.parr->release(); + } + break; + case KindOfObject: + if (m_data.pobj->decRefCount() == 0) { + m_data.pobj->release(); + } + break; + case KindOfVariant: + if (m_data.pvar->decRefCount() == 0) { + m_data.pvar->release(); + } + break; + default: + break; + } +} + +void Variant::setNull() { + if (isPrimitive()) { + m_data.num = 0; + m_type = KindOfNull; + } else if (m_type == KindOfVariant) { + m_data.pvar->setNull(); + } else { + unset(); + } +} + +CVarRef Variant::set(bool v) { + if (isPrimitive()) { + // do nothing + } else if (m_type == KindOfVariant) { + m_data.pvar->set(v); + return *this; + } else { + unset(); + } + m_type = KindOfBoolean; + m_data.num = (v ? 1 : 0); + return *this; +} + +CVarRef Variant::set(char v) { + if (isPrimitive()) { + // do nothing + } else if (m_type == KindOfVariant) { + m_data.pvar->set(v); + return *this; + } else { + unset(); + } + m_type = KindOfByte; + m_data.num = v; + return *this; +} + +CVarRef Variant::set(short v) { + if (isPrimitive()) { + // do nothing + } else if (m_type == KindOfVariant) { + m_data.pvar->set(v); + return *this; + } else { + unset(); + } + m_type = KindOfInt16; + m_data.num = v; + return *this; +} + +CVarRef Variant::set(int v) { + if (isPrimitive()) { + // do nothing + } else if (m_type == KindOfVariant) { + m_data.pvar->set(v); + return *this; + } else { + unset(); + } + m_type = KindOfInt32; + m_data.num = v; + return *this; +} + +CVarRef Variant::set(int64 v) { + if (isPrimitive()) { + // do nothing + } else if (m_type == KindOfVariant) { + m_data.pvar->set(v); + return *this; + } else { + unset(); + } + m_type = KindOfInt64; + m_data.num = v; + return *this; +} + +CVarRef Variant::set(double v) { + if (isPrimitive()) { + // do nothing + } else if (m_type == KindOfVariant) { + m_data.pvar->set(v); + return *this; + } else { + unset(); + } + m_type = KindOfDouble; + m_data.dbl = v; + return *this; +} + +CVarRef Variant::set(litstr v) { + if (isPrimitive()) { + // do nothing + } else if (m_type == KindOfVariant) { + m_data.pvar->set(v); + return *this; + } else { + unset(); + } + m_type = LiteralString; + m_data.str = v; + return *this; +} + +CVarRef Variant::set(const ObjectOffset& v) { + return (*this = static_cast(v)); +} + +CVarRef Variant::set(StringData *v) { + if (isPrimitive()) { + // do nothing + } else if (m_type == KindOfVariant) { + m_data.pvar->set(v); + return *this; + } else { + unset(); + } + if (v) { + m_type = KindOfString; + m_data.pstr = v; + v->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } + return *this; +} + +CVarRef Variant::set(ArrayData *v) { + if (m_type == KindOfVariant) { + m_data.pvar->set(v); + return *this; + } + unset(); + if (v) { + m_type = KindOfArray; + m_data.parr = v; + v->incRefCount(); + } + return *this; +} + +CVarRef Variant::set(ObjectData *v) { + if (isPrimitive()) { + // do nothing + } else if (m_type == KindOfVariant) { + m_data.pvar->set(v); + return *this; + } else { + unset(); + } + if (v) { + m_type = KindOfObject; + m_data.pobj = v; + v->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } + return *this; +} + +CVarRef Variant::set(CStrRef v) { + return set(v.get()); +} + +CVarRef Variant::set(CArrRef v) { + return set(v.get()); +} + +CVarRef Variant::set(CObjRef v) { + return set(v.get()); +} + +void Variant::escalateString() const { + if (m_type == KindOfVariant) { + m_data.pvar->escalateString(); + return; + } + ASSERT(getType() == LiteralString); + m_type = KindOfString; + StringData *v = NEW(StringData)(m_data.str); + m_data.pstr = v; + v->incRefCount(); +} + +// This function should only be called from bind(CVarRef v) because they are +// tightly coupled together. In particular m_type should be viewed as +// KindOfNull and for complex types the old data already released. +inline void Variant::bind2(CVarRef v) { + switch (v.m_type) { + // copy-on-write: ref counting complex types + case KindOfString: { + StringData *str = v.m_data.pstr; + if (str) { + m_type = KindOfString; + m_data.pstr = str; + str->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } + break; + } + case KindOfArray: { + ArrayData *arr = v.m_data.parr; + if (arr) { + m_type = KindOfArray; + m_data.parr = arr; + arr->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } + break; + } + case KindOfObject: { + ObjectData *obj = v.m_data.pobj; + if (obj) { + m_type = KindOfObject; + m_data.pobj = obj; + obj->incRefCount(); + } else { + m_data.num = 0; + m_type = KindOfNull; + } + break; + } + case KindOfVariant: + m_type = KindOfNull; + bind(*v.m_data.pvar); + break; + default: + ASSERT(false); + } +} + +void Variant::bind(CVarRef v) { + if (isPrimitive()) { + if (v.isPrimitive()) { + m_type = v.m_type; + m_data = v.m_data; + } else { + bind2(v); + } + } else { + switch (m_type) { + case KindOfString: + case KindOfArray: + case KindOfObject: + destruct(); + m_type = KindOfNull; + if (v.isPrimitive()) { + m_type = v.m_type; + m_data = v.m_data; + } else { + bind2(v); + } + break; + case KindOfVariant: + m_data.pvar->bind(v); + break; + default: + ASSERT(false); + } + } +} + +void Variant::bind(Variant *v) { + ASSERT(v != this); + if (v) { + v->incRefCount(); // in case unset() triggers deletion of v + unset(); + m_type = KindOfVariant; + m_data.pvar = v; + } else { + unset(); + } +} + +void Variant::copy(CVarRef v, bool deep) { + // in case copying myself... + if (m_type == v.m_type && m_data.num == v.m_data.num) { + return; + } + + // if we are in StrongBinding, we copy the value into the shared data + if (m_type == KindOfVariant) { + m_data.pvar->copy(v, deep); + return; + } + + switch (v.m_type) { + + // copy primitive values + case KindOfNull: unset(); break; + case KindOfBoolean: set(v.m_data.num != 0); break; + case KindOfByte: set((char)v.m_data.num); break; + case KindOfInt16: set((short)v.m_data.num); break; + case KindOfInt32: set((int)v.m_data.num); break; + case KindOfInt64: set(v.m_data.num); break; + case KindOfDouble: set(v.m_data.dbl); break; + case LiteralString: set(v.m_data.str); break; + + // copy-by-value + case KindOfString: set(v.m_data.pstr->copy()); break; + case KindOfArray: set(v.m_data.parr->copy()); break; + + // objects are never copied by value + case KindOfObject: set(v.m_data.pobj); break; + + // go one and only one level deeper + case KindOfVariant: + if (deep) { + copy(*v.m_data.pvar, true); + } else { + bind(v.m_data.pvar); + } + break; + + default: + ASSERT(false); + break; + } +} + +void Variant::split() { + switch (getType()) { + case KindOfVariant: m_data.pvar->split(); break; + // copy-on-write + case KindOfString: set(m_data.pstr->copy()); break; + case KindOfArray: set(m_data.parr->copy()); break; + default: + break; + } +} + +Variant &Variant::assign(CVarRef v, bool deep) { + ASSERT(!isContagious() || + this == &v); // otherwise our code generation is wrong + if (v.isContagious()) { + v.clearContagious(); // do it early to avoid bind() triggers deletion of v + + // we have to wrap up v into a sharable form + if (v.m_type != KindOfVariant) { + Variant *shared = NEW(Variant)(); + shared->bind(v); + const_cast(v).bind(shared); + } + + // then we can share v.m_data.pvar + bind(v.m_data.pvar); + + } else if (isReferenced()) { + m_data.pvar->assign(v, deep); + } else { + if (this != &v) { + bind(v); + } + } + return *this; +} + +int Variant::getRefCount() const { + switch (m_type) { + case KindOfString: return m_data.pstr->getCount(); + case KindOfArray: return m_data.parr->getCount(); + case KindOfObject: return m_data.pobj->getCount(); + case KindOfVariant: return m_data.pvar->getRefCount(); + default: + break; + } + return 1; +} + +/////////////////////////////////////////////////////////////////////////////// +// informational + +bool Variant::isInteger() const { + switch (m_type) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return true; + case KindOfVariant: + return m_data.pvar->isInteger(); + default: + break; + } + return false; +} + +bool Variant::isNumeric(bool checkString /* = false */) const { + switch (m_type) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + return true; + case LiteralString: + if (checkString) { + const char *data = m_data.str; + int len = strlen(data); + if (len) { + int64 lval; double dval; + DataType ret = is_numeric_string(data, len, &lval, &dval, 0); + switch (ret) { + case KindOfNull: return false; + case KindOfInt64: + case KindOfDouble: return true; + default: + ASSERT(false); + break; + } + } + return false; + } else { + break; + } + case KindOfString: + if (checkString) { + return m_data.pstr->isNumeric(); + } else { + break; + } + case KindOfVariant: + return m_data.pvar->isNumeric(checkString); + default: + break; + } + return false; +} + +bool Variant::isScalar() const { + switch (getType()) { + case KindOfNull: + case KindOfArray: + case KindOfObject: + return false; + default: + break; + } + return true; +} + +bool Variant::isResource() const { + if (is(KindOfObject)) { + return toObject()->isResource(); + } + return false; +} + +bool Variant::instanceof(const char *s) const { + if (m_type == KindOfObject) { + return toObject().instanceof(s); + } + if (m_type == KindOfVariant) { + return m_data.pvar->instanceof(s); + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// array operations + +Variant Variant::pop() { + if (m_type == KindOfVariant) { + return m_data.pvar->pop(); + } + if (!is(KindOfArray)) { + throw_bad_type_exception("expecting an array"); + return null; + } + + Variant ret; + ArrayData *newarr = getArrayData()->pop(ret); + if (newarr) { + set(newarr); + } + return ret; +} + +Variant Variant::dequeue() { + if (m_type == KindOfVariant) { + return m_data.pvar->dequeue(); + } + if (!is(KindOfArray)) { + throw_bad_type_exception("expecting an array"); + return null; + } + + Variant ret; + ArrayData *newarr = getArrayData()->dequeue(ret); + if (newarr) { + set(newarr); + } + return ret; +} + +void Variant::insert(int pos, CVarRef v) { + if (m_type == KindOfVariant) { + return m_data.pvar->insert(pos, v); + } + if (isNull()) { + set(Array::Create()); + } + + if (is(KindOfArray)) { + ArrayData *oldArr = getArrayData(); + ArrayData *newarr = oldArr->insert(pos, v, (oldArr->getCount() > 1)); + if (newarr) { + set(newarr); + } + } else { + throw_bad_type_exception("expecting an array"); + } +} + +Variant Variant::array_iter_reset() { + if (is(KindOfArray)) { + ArrayData *arr = getArrayData(); + if (arr->getCount() > 1) { + arr = arr->copy(); + set(arr); + ASSERT(arr == getArrayData()); + } + return arr->reset(); + } + throw_bad_type_exception("expecting an array"); + return false; +} + +Variant Variant::array_iter_prev() { + if (is(KindOfArray)) { + ArrayData *arr = getArrayData(); + if (arr->getCount() > 1) { + arr = arr->copy(); + set(arr); + ASSERT(arr == getArrayData()); + } + return arr->prev(); + } + throw_bad_type_exception("expecting an array"); + return false; +} + +Variant Variant::array_iter_current() const { + if (is(KindOfArray)) { + return getArrayData()->current(); + } + throw_bad_type_exception("expecting an array"); + return false; +} + +Variant Variant::array_iter_next() { + if (is(KindOfArray)) { + ArrayData *arr = getArrayData(); + if (arr->getCount() > 1) { + arr = arr->copy(); + set(arr); + ASSERT(arr == getArrayData()); + } + return arr->next(); + } + throw_bad_type_exception("expecting an array"); + return false; +} + +Variant Variant::array_iter_end() { + if (is(KindOfArray)) { + ArrayData *arr = getArrayData(); + if (arr->getCount() > 1) { + arr = arr->copy(); + set(arr); + ASSERT(arr == getArrayData()); + } + return arr->end(); + } + throw_bad_type_exception("expecting an array"); + return false; +} + +Variant Variant::array_iter_key() const { + if (is(KindOfArray)) { + return getArrayData()->key(); + } + throw_bad_type_exception("expecting an array"); + return false; +} + +Variant Variant::array_iter_value(ssize_t &pos) const { + if (is(KindOfArray)) { + return getArrayData()->value(pos); + } + throw_bad_type_exception("expecting an array"); + return null; +} + +Variant Variant::array_iter_each() { + if (is(KindOfArray)) { + ArrayData *arr = getArrayData(); + if (arr->getCount() > 1) { + arr = arr->copy(); + set(arr); + ASSERT(arr == getArrayData()); + } + return arr->each(); + } + throw_bad_type_exception("expecting an array"); + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +// unary plus +Variant Variant::operator+() { + if (is(KindOfArray)) { + throw BadArrayOperandException(); + } + if (isDouble()) { + set(toDouble()); + } else if (isIntVal()) { + set(toInt64()); + } else if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(dval); + } else if (ret == KindOfInt64) { + set(lval); + } else { + set(toInt64()); + } + } else { + ASSERT(false); + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +// add or array append + +Variant Variant::operator+(CVarRef var) const { + if (is(KindOfArray) && var.is(KindOfArray)) { + return toArray() + var.toArray(); + } + if (is(KindOfArray) || var.is(KindOfArray)) { + throw BadArrayMergeException(); + } + if (isDouble() || var.isDouble()) { + return toDouble() + var.toDouble(); + } else if (isIntVal() && var.isIntVal()) { + return toInt64() + var.toInt64(); + } else { + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + return dval + var.toDouble(); + } + } + if (var.isString()) { + String s = var.toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + return toDouble() + dval; + } + } + } + return toInt64() + var.toInt64(); +} + +Variant &Variant::operator+=(CVarRef var) { + if (is(KindOfArray) && var.is(KindOfArray)) { + set(toArray() + var.toArray()); + return *this; + } + if (is(KindOfArray) || var.is(KindOfArray)) { + throw BadArrayMergeException(); + } + if (isDouble() || var.isDouble()) { + set(toDouble() + var.toDouble()); + } else if (isIntVal() && var.isIntVal()) { + set(toInt64() + var.toInt64()); + } else { + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(dval + var.toDouble()); + return *this; + } + } + if (var.isString()) { + String s = var.toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(toDouble() + dval); + return *this; + } + } + set(toInt64() + var.toInt64()); + } + return *this; +} + +Variant &Variant::operator+=(int64 n) { + if (is(KindOfArray)) { + throw BadArrayMergeException(); + } + if (isDouble()) { + set(toDouble() + n); + } else if (isIntVal()) { + set(toInt64() + n); + } else { + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(dval + n); + return *this; + } + } else { + ASSERT(false); + } + set(toInt64() + n); + } + return *this; +} + +Variant &Variant::operator+=(double n) { + if (is(KindOfArray)) { + throw BadArrayMergeException(); + } + set(toDouble() + n); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +// minus + +Variant Variant::operator-() { + if (is(KindOfArray)) { + throw BadArrayOperandException(); + } + if (isDouble()) { + set(-toDouble()); + } else if (isIntVal()) { + set(-toInt64()); + } else { + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(-dval); + } else if (ret == KindOfInt64) { + set(-lval); + } else { + set(-toInt64()); + } + } else { + ASSERT(false); + } + } + return *this; +} + +Variant Variant::operator-(CVarRef var) const { + if (is(KindOfArray) || var.is(KindOfArray)) { + throw BadArrayOperandException(); + } + if (isDouble() || var.isDouble()) { + return toDouble() - var.toDouble(); + } + if (isIntVal() && var.isIntVal()) { + return toInt64() - var.toInt64(); + } + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + return dval - var.toDouble(); + } + } + if (var.isString()) { + String s = var.toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + return toDouble() - dval; + } + } + return toInt64() - var.toInt64(); +} + +Variant &Variant::operator-=(CVarRef var) { + if (is(KindOfArray) || var.is(KindOfArray)) { + throw BadArrayOperandException(); + } + if (isDouble() || var.isDouble()) { + set(toDouble() - var.toDouble()); + } else if (isIntVal() && var.isIntVal()) { + set(toInt64() - var.toInt64()); + } else { + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(dval - var.toDouble()); + return *this; + } + } + if (var.isString()) { + String s = var.toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(toDouble() - dval); + return *this; + } + } + set(toInt64() - var.toInt64()); + } + return *this; +} + +Variant &Variant::operator-=(int64 n) { + if (is(KindOfArray)) { + throw BadArrayOperandException(); + } + if (isDouble()) { + set(toDouble() - n); + } else if (isIntVal()) { + set(toInt64() - n); + } else { + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(dval - n); + return *this; + } + } else { + ASSERT(false); + } + set(toInt64() - n); + } + return *this; +} + +Variant &Variant::operator-=(double n) { + if (is(KindOfArray)) { + throw BadArrayOperandException(); + } + set(toDouble() - n); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +// multiply + +Variant Variant::operator*(CVarRef var) const { + if (is(KindOfArray) || var.is(KindOfArray)) { + throw BadArrayOperandException(); + } + if (isDouble() || var.isDouble()) { + return toDouble() * var.toDouble(); + } + if (isIntVal() && var.isIntVal()) { + return toInt64() * var.toInt64(); + } + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + return dval * var.toDouble(); + } + } + if (var.isString()) { + String s = var.toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + return toDouble() * dval; + } + } + return toInt64() * var.toInt64(); +} + +Variant &Variant::operator*=(CVarRef var) { + if (is(KindOfArray) || var.is(KindOfArray)) { + throw BadArrayOperandException(); + } + if (isDouble() || var.isDouble()) { + set(toDouble() * var.toDouble()); + } else if (isIntVal() && var.isIntVal()) { + set(toInt64() * var.toInt64()); + } else { + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(dval * var.toDouble()); + return *this; + } + } + if (var.isString()) { + String s = var.toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(toDouble() * dval); + return *this; + } + } + set(toInt64() * var.toInt64()); + } + return *this; +} + +Variant &Variant::operator*=(int64 n) { + if (is(KindOfArray)) { + throw BadArrayOperandException(); + } + if (isDouble()) { + set(toDouble() * n); + } else if (isIntVal()) { + set(toInt64() * n); + } else { + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + set(dval * n); + return *this; + } + } else { + ASSERT(false); + } + set(toInt64() * n); + } + return *this; +} + +Variant &Variant::operator*=(double n) { + if (is(KindOfArray)) { + throw BadArrayOperandException(); + } + set(toDouble() * n); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +// divide + +Variant Variant::operator/(CVarRef var) const { + if (is(KindOfArray) || var.is(KindOfArray)) { + throw BadArrayOperandException(); + } + int64 lval; double dval; bool int1 = true; + int64 lval2; double dval2; bool int2 = true; + + if (isDouble()) { + dval = toDouble(); + int1 = false; + } else if (isIntVal()) { + lval = toInt64(); + } else if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + int1 = false; + } else if (ret != KindOfInt64) { + lval = 0; + } + } else { + ASSERT(false); + } + if (var.isDouble()) { + dval2 = var.toDouble(); + int2 = false; + } else if (var.isIntVal()) { + lval2 = var.toInt64(); + } else if (var.isString()) { + String s = var.toString(); + DataType ret = KindOfNull; + ret = is_numeric_string(s.data(), s.size(), &lval2, &dval2, 1); + if (ret == KindOfDouble) { + int2 = false; + } else if (ret != KindOfInt64) { + lval2 = 0; + } + } else { + ASSERT(false); + } + + if ((int2 && lval2 == 0) || (!int2 && dval2 == 0)) { + Logger::Warning("Division by zero"); + return false; + } + + if (int1 && int2) { + if (lval % lval2 == 0) { + return lval / lval2; + } else { + return (double)lval / lval2; + } + } else if (int1 && !int2) { + return lval / dval2; + } else if (!int1 && int2) { + return dval / lval2; + } else { + return dval / dval2; + } +} + +Variant &Variant::operator/=(CVarRef var) { + if (is(KindOfArray) || var.is(KindOfArray)) { + throw BadArrayOperandException(); + } + int64 lval; double dval; bool int1 = true; + int64 lval2; double dval2; bool int2 = true; + + if (isDouble()) { + dval = toDouble(); + int1 = false; + } else if (isIntVal()) { + lval = toInt64(); + } else if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfDouble) { + int1 = false; + } else if (ret != KindOfInt64) { + lval = 0; + } + } else { + ASSERT(false); + } + if (var.isDouble()) { + dval2 = var.toDouble(); + int2 = false; + } else if (var.isIntVal()) { + lval2 = var.toInt64(); + } else if (var.isString()) { + String s = var.toString(); + DataType ret = KindOfNull; + ret = is_numeric_string(s.data(), s.size(), &lval2, &dval2, 1); + if (ret == KindOfDouble) { + int2 = false; + } else if (ret != KindOfInt64) { + lval2 = 0; + } + } else { + ASSERT(false); + } + + if ((int2 && lval2 == 0) || (!int2 && dval2 == 0)) { + Logger::Warning("Division by zero"); + set(false); + return *this; + } + + if (int1 && int2) { + if (lval % lval2 == 0) { + set(lval / lval2); + } else { + set((double)lval / lval2); + } + } else if (int1 && !int2) { + set(lval / dval2); + } else if (!int1 && int2) { + set(dval / lval2); + } else { + set(dval / dval2); + } + return *this; +} + +Variant &Variant::operator/=(int64 n) { + if (is(KindOfArray)) { + throw BadArrayOperandException(); + } + if (n == 0) { + Logger::Warning("Division by zero"); + set(false); + return *this; + } + + if (isIntVal() && toInt64() % n == 0) { + set(toInt64() / n); + } else if (isDouble()) { + set(toDouble() / n); + } else { + if (isString()) { + String s = toString(); + DataType ret = KindOfNull; + int64 lval; double dval; + ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + if (ret == KindOfInt64 && lval % n == 0) { + set(lval / n); + return *this; + } + } + set(toDouble() / n); + } + return *this; +} + +Variant &Variant::operator/=(double n) { + if (is(KindOfArray)) { + throw BadArrayOperandException(); + } + if (n == 0.0) { + Logger::Warning("Division by zero"); + set(false); + return *this; + } + set(toDouble() / n); + return *this; +} + +double operator/(double n, CVarRef v) { + if (v.is(KindOfArray)) { + throw BadArrayOperandException(); + } + double dval = v.toDouble(); + if (dval == 0.0) { + Logger::Warning("Division by zero"); + return false; + } + return n / dval; +} + +double operator/(int n, CVarRef v) { + if (v.is(KindOfArray)) { + throw BadArrayOperandException(); + } + double dval = v.toDouble(); + if (dval == 0.0) { + Logger::Warning("Division by zero"); + return false; + } + return n / dval; +} + +/////////////////////////////////////////////////////////////////////////////// +// modulus + +int64 Variant::operator%(CVarRef var) const { + int64 lval = toInt64(); + int64 lval2 = var.toInt64(); + if (lval2 == 0) { + Logger::Warning("Division by zero"); + return false; + } + return lval % lval2; +} + +Variant &Variant::operator%=(CVarRef var) { + int64 lval = toInt64(); + int64 lval2 = var.toInt64(); + if (lval2 == 0) { + Logger::Warning("Division by zero"); + set(false); + return *this; + } + set(lval % lval2); + return *this; +} + +Variant &Variant::operator%=(int64 n) { + if (n == 0) { + Logger::Warning("Division by zero"); + set(false); + return *this; + } + set(toInt64() % n); + return *this; +} + +Variant &Variant::operator%=(double n) { + if ((int64)n == 0.0) { + Logger::Warning("Division by zero"); + set(false); + return *this; + } + set(toInt64() % (int64)n); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +// bitwise + +Variant Variant::operator~() const { + switch (getType()) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return ~toInt64(); + case KindOfDouble: + return ~(int64)(toDouble()); + case LiteralString: + case KindOfString: + return ~toString(); + default: + break; + } + throw InvalidOperandException("only numerics and strings can be negated"); +} + +Variant Variant::operator|(CVarRef v) const { + if (isString() && v.isString()) { + return toString() | v.toString(); + } + return toInt64() | v.toInt64(); +} + +Variant Variant::operator&(CVarRef v) const { + if (isString() && v.isString()) { + return toString() & v.toString(); + } + return toInt64() & v.toInt64(); +} + +Variant Variant::operator^(CVarRef v) const { + if (isString() && v.isString()) { + return toString() ^ v.toString(); + } + return toInt64() ^ v.toInt64(); +} + +Variant &Variant::operator|=(CVarRef v) { + if (isString() && v.isString()) { + set(toString() | v.toString()); + } else { + set(toInt64() | v.toInt64()); + } + return *this; +} + +Variant &Variant::operator&=(CVarRef v) { + if (isString() && v.isString()) { + set(toString() & v.toString()); + } else { + set(toInt64() & v.toInt64()); + } + return *this; +} + +Variant &Variant::operator^=(CVarRef v) { + if (isString() && v.isString()) { + set(toString() ^ v.toString()); + } else { + set(toInt64() ^ v.toInt64()); + } + return *this; +} + +Variant &Variant::operator<<=(int64 n) { + set(toInt64() << n); + return *this; +} + +Variant &Variant::operator>>=(int64 n) { + set(toInt64() >> n); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +// increment/decrement + +Variant &Variant::operator++() { + switch (getType()) { + case KindOfNull: set(1LL); break; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: set(toInt64() + 1); break; + case KindOfDouble: set(toDouble() + 1); break; + case LiteralString: + case KindOfString: + { + String s = toString(); + if (s.empty()) { + set(1LL); + } else { + int64 lval; double dval; + DataType ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + switch (ret) { + case KindOfInt64: set(lval + 1); break; + case KindOfDouble: set(dval + 1); break; + case KindOfNull: + split(); + if (getType() == LiteralString) { + escalateString(); + } + getStringData()->inc(); break; + default: + ASSERT(false); + break; + } + } + } + break; + default: + break; + } + return *this; +} + +Variant Variant::operator++(int) { + Variant ret(*this); + operator++(); + return ret; +} + +Variant &Variant::operator--() { + switch (getType()) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: set(toInt64() - 1); break; + case KindOfDouble: set(toDouble() - 1); break; + case LiteralString: + case KindOfString: + { + String s = toString(); + if (s.empty()) { + set(-1LL); + } else { + int64 lval; double dval; + DataType ret = is_numeric_string(s.data(), s.size(), &lval, &dval, 1); + switch (ret) { + case KindOfInt64: set(lval - 1); break; + case KindOfDouble: set(dval - 1); break; + case KindOfNull: /* do nothing */ break; + default: + ASSERT(false); + break; + } + } + } + break; + default: + break; + } + return *this; +} + +Variant Variant::operator--(int) { + Variant ret(*this); + operator--(); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// iterator functions + +ArrayIterPtr Variant::begin(const char *context /* = NULL */) const { + if (is(KindOfArray)) { + return new ArrayIter(getArrayData()); + } + if (is(KindOfObject)) { + ObjectData *obj = getObjectData(); + if (obj->o_instanceof("iterator")) { + return new ObjectArrayIter(obj); + } else { + return new ArrayIter(obj->o_toIterArray(context)); + } + } + return new ArrayIter(NULL); +} + +MutableArrayIterPtr Variant::begin(Variant *key, Variant &val) { + if (is(KindOfObject)) { + ObjectData *obj = getObjectData(); + if (obj->o_instanceof("iterator")) { + throw FatalErrorException("An iterator cannot be used with " + "foreach by reference"); + } + } + // we are about to modify an array that has other weak references, so + // we have to make a copy to preserve other instances + if (is(KindOfArray)) { + ArrayData *arr = getArrayData(); + if (arr->getCount() > 1) { + set(arr->copy()); + } + } + return new MutableArrayIter(this, key, val); +} + +void Variant::escalate() { + if (is(KindOfArray)) { + Array arr = toArray(); + arr.escalate(); + set(arr); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// type conversions + +bool Variant::toBoolean() const { + switch (m_type) { + case KindOfNull: return false; + case KindOfDouble: return m_data.dbl != 0; + case LiteralString: return StringData(m_data.str).toBoolean(); + case KindOfString: return m_data.pstr->toBoolean(); + case KindOfArray: return !m_data.parr->empty(); + case KindOfObject: return m_data.pobj != NULL; + case KindOfVariant: return m_data.pvar->toBoolean(); + default: + break; + } + return m_data.num != 0; +} + +int64 Variant::toInt64(int base /* = 10 */) const { + switch (m_type) { + case KindOfNull: return 0; + case KindOfDouble: { + return (m_data.dbl > LONG_MAX) ? (uint64)m_data.dbl : (int64)m_data.dbl; + } + case LiteralString: return StringData(m_data.str).toInt64(base); + case KindOfString: return m_data.pstr->toInt64(base); + case KindOfArray: return m_data.parr->empty() ? 0 : 1; + case KindOfObject: return m_data.pobj ? m_data.pobj->o_toInt64() : 0; + case KindOfVariant: return m_data.pvar->toInt64(base); + default: + break; + } + return m_data.num; +} + +double Variant::toDouble() const { + switch (m_type) { + case KindOfNull: return 0.0; + case KindOfDouble: return m_data.dbl; + case LiteralString: return StringData(m_data.str).toDouble(); + case KindOfString: return m_data.pstr->toDouble(); + case KindOfVariant: return m_data.pvar->toDouble(); + default: + break; + } + return (double)toInt64(); +} + +String Variant::toString() const { + switch (m_type) { + case KindOfNull: return ""; + case KindOfBoolean: return m_data.num ? "1" : ""; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: return m_data.num; + case KindOfDouble: return m_data.dbl; + case LiteralString: return m_data.str; + case KindOfString: return m_data.pstr; + case KindOfArray: return "Array"; + case KindOfObject: return m_data.pobj->t___tostring(); + case KindOfVariant: return m_data.pvar->toString(); + default: + ASSERT(false); + break; + } + return ""; +} + +Array Variant::toArray() const { + switch (m_type) { + case KindOfNull: return Array::Create(); + case KindOfInt64: return Array::Create(m_data.num); + case LiteralString: return Array::Create(m_data.str); + case KindOfString: return Array::Create(String(m_data.pstr)); + case KindOfArray: return m_data.parr; + case KindOfObject: return m_data.pobj->o_toArray(); + case KindOfVariant: return m_data.pvar->toArray(); + default: + break; + } + return Array::Create(*this); +} + +Object Variant::toObject() const { + if (m_type == KindOfObject) return m_data.pobj; + if (m_type == KindOfVariant) return m_data.pvar->toObject(); + + switch (m_type) { + case KindOfNull: + break; + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + case LiteralString: + case KindOfString: + { + c_stdclass *obj = NEW(c_stdclass)(); + obj->o_lval("scalar", -1) = *this; + return obj; + } + case KindOfArray: return m_data.parr->toObject(); + default: + ASSERT(false); + break; + } + return Object(NEW(c_stdclass)()); +} + +Variant Variant::toKey() const { + switch (m_type) { + case KindOfNull: + return String(""); + case LiteralString: + return String(m_data.str).toKey(); + case KindOfString: + { + int64 n; + if (m_data.pstr->isStrictlyInteger(n)) { + return Variant(n); + } else { + return Variant(*this); + } + } + case KindOfBoolean: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return toInt64(); + case KindOfDouble: + return (int64)m_data.dbl; + case KindOfObject: + if (isResource()) { + return toInt64(); + } + case KindOfVariant: + return m_data.pvar->toKey(); + default: + break; + } + throw_bad_type_exception("Invalid type used as key"); + return null; +} + +Variant::operator String() const { + return toString(); +} + +Variant::operator Array() const { + return toArray(); +} + +Variant::operator Object() const { + return toObject(); +} + +/////////////////////////////////////////////////////////////////////////////// +// comparisons + +bool Variant::same(bool v2) const { + return is(KindOfBoolean) && equal(v2); +} + +bool Variant::same(char v2) const { + return same((int64)v2); +} + +bool Variant::same(short v2) const { + return same((int64)v2); +} + +bool Variant::same(int v2) const { + return same((int64)v2); +} + +bool Variant::same(int64 v2) const { + switch (getType()) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return equal(v2); + default: + break; + } + return false; +} + +bool Variant::same(double v2) const { + return isDouble() && equal(v2); +} + +bool Variant::same(litstr v2) const { + return same(String(v2)); +} + +bool Variant::same(CStrRef v2) const { + bool null1 = isNull(); + bool null2 = v2.isNull(); + if (null1 && null2) return true; + if (null1 || null2) return false; + return isString() && equal(v2); +} + +bool Variant::same(CArrRef v2) const { + bool null1 = isNull(); + bool null2 = v2.isNull(); + if (null1 && null2) return true; + if (null1 || null2) return false; + return is(KindOfArray) && toArray().same(v2); +} + +bool Variant::same(CObjRef v2) const { + bool null1 = isNull(); + bool null2 = v2.isNull(); + if (null1 && null2) return true; + if (null1 || null2) return false; + return is(KindOfObject) && getObjectData() == v2.get(); +} + +bool Variant::same(CVarRef v2) const { + bool null1 = isNull(); + bool null2 = v2.isNull(); + if (null1 && null2) return true; + if (null1 || null2) return false; + + switch (getType()) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + switch (v2.getType()) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return equal(v2); + default: + break; + } + break; + case LiteralString: + case KindOfString: + return v2.isString() && equal(v2); + case KindOfArray: + if (v2.is(KindOfArray)) { + return toArray().same(v2.toArray()); + } + break; + case KindOfObject: + return v2.is(KindOfObject) && getObjectData() == v2.getObjectData(); + default: + break; + } + return getType() == v2.getType() && equal(v2); +} + +/////////////////////////////////////////////////////////////////////////////// + +#define UNWRAP(reverse) \ + switch (getType()) { \ + case KindOfNull: \ + case KindOfBoolean: return HPHP::reverse(v2, toBoolean()); \ + case KindOfByte: \ + case KindOfInt16: \ + case KindOfInt32: \ + case KindOfInt64: return HPHP::reverse(v2, toInt64()); \ + case KindOfDouble: return HPHP::reverse(v2, toDouble()); \ + case LiteralString: \ + case KindOfString: return HPHP::reverse(v2, toString()); \ + case KindOfArray: return HPHP::reverse(v2, toArray()); \ + case KindOfObject: return HPHP::reverse(v2, toObject()); \ + default: \ + ASSERT(false); \ + break; \ + } \ + return false; \ + +// "null" needs to convert to "" before comparing with a string +#define UNWRAP_STR(reverse) \ + switch (getType()) { \ + case KindOfNull: return HPHP::reverse(v2, ""); \ + case KindOfBoolean: return HPHP::reverse(v2, toBoolean()); \ + case KindOfByte: \ + case KindOfInt16: \ + case KindOfInt32: \ + case KindOfInt64: return HPHP::reverse(v2, toInt64()); \ + case KindOfDouble: return HPHP::reverse(v2, toDouble()); \ + case LiteralString: \ + case KindOfString: return HPHP::reverse(v2, toString()); \ + case KindOfArray: return HPHP::reverse(v2, toArray()); \ + case KindOfObject: return HPHP::reverse(v2, toObject()); \ + default: \ + ASSERT(false); \ + break; \ + } \ + return false; \ + +// "null" needs to convert to "" before comparing with a string +#define UNWRAP_VAR(forward, reverse) \ + switch (getType()) { \ + case KindOfNull: \ + if (v2.isString()) { \ + return HPHP::reverse(v2, ""); \ + } /* otherwise fall through */ \ + case KindOfBoolean: return HPHP::reverse(v2, toBoolean()); \ + case KindOfByte: \ + case KindOfInt16: \ + case KindOfInt32: \ + case KindOfInt64: return HPHP::reverse(v2, toInt64()); \ + case KindOfDouble: return HPHP::reverse(v2, toDouble()); \ + case LiteralString: \ + case KindOfString: return HPHP::reverse(v2, toString()); \ + case KindOfArray: \ + if (v2.is(KindOfArray)) { \ + return toArray().forward(v2.toArray()); \ + } \ + return HPHP::reverse(v2, toArray()); \ + case KindOfObject: return HPHP::reverse(v2, toObject()); \ + default: \ + ASSERT(false); \ + break; \ + } \ + return false; \ + +// array comparison is directional when they are uncomparable +// also, ">" is implemented as "!<=" in Zend +#define UNWRAP_ARR(forward, reverse) \ + switch (getType()) { \ + case KindOfNull: \ + case KindOfBoolean: return HPHP::reverse(v2, toBoolean()); \ + case KindOfByte: \ + case KindOfInt16: \ + case KindOfInt32: \ + case KindOfInt64: return HPHP::reverse(v2, toInt64()); \ + case KindOfDouble: return HPHP::reverse(v2, toDouble()); \ + case LiteralString: \ + case KindOfString: return HPHP::reverse(v2, toString()); \ + case KindOfArray: return toArray().forward(v2); \ + case KindOfObject: return HPHP::reverse(v2, toObject()); \ + default: \ + ASSERT(false); \ + break; \ + } \ + return false; \ + +bool Variant::equal(bool v2) const { UNWRAP(equal);} +bool Variant::equal(char v2) const { UNWRAP(equal);} +bool Variant::equal(short v2) const { UNWRAP(equal);} +bool Variant::equal(int v2) const { UNWRAP(equal);} +bool Variant::equal(int64 v2) const { UNWRAP(equal);} +bool Variant::equal(double v2) const { UNWRAP(equal);} +bool Variant::equal(litstr v2) const { UNWRAP_STR(equal);} +bool Variant::equal(CStrRef v2) const { UNWRAP_STR(equal);} +bool Variant::equal(CArrRef v2) const { UNWRAP(equal);} +bool Variant::equal(CObjRef v2) const { UNWRAP(equal);} +bool Variant::equal(CVarRef v2) const { UNWRAP_VAR(equal,equal);} + +bool Variant::less(bool v2) const { UNWRAP(more);} +bool Variant::less(char v2) const { UNWRAP(more);} +bool Variant::less(short v2) const { UNWRAP(more);} +bool Variant::less(int v2) const { UNWRAP(more);} +bool Variant::less(int64 v2) const { UNWRAP(more);} +bool Variant::less(double v2) const { UNWRAP(more);} +bool Variant::less(litstr v2) const { UNWRAP_STR(more);} +bool Variant::less(CStrRef v2) const { UNWRAP_STR(more);} +bool Variant::less(CArrRef v2) const { UNWRAP_ARR(less,more);} +bool Variant::less(CObjRef v2) const { UNWRAP(more);} +bool Variant::less(CVarRef v2) const { UNWRAP_VAR(less,more);} + +bool Variant::more(bool v2) const { UNWRAP(less);} +bool Variant::more(char v2) const { UNWRAP(less);} +bool Variant::more(short v2) const { UNWRAP(less);} +bool Variant::more(int v2) const { UNWRAP(less);} +bool Variant::more(int64 v2) const { UNWRAP(less);} +bool Variant::more(double v2) const { UNWRAP(less);} +bool Variant::more(litstr v2) const { UNWRAP_STR(less);} +bool Variant::more(CStrRef v2) const { UNWRAP_STR(less);} +bool Variant::more(CArrRef v2) const { UNWRAP_ARR(more,less);} +bool Variant::more(CObjRef v2) const { UNWRAP(less);} +bool Variant::more(CVarRef v2) const { UNWRAP_VAR(more,less);} + +/////////////////////////////////////////////////////////////////////////////// +// comparison operators + +bool Variant::operator==(CVarRef v) const { + return HPHP::equal(*this, v); +} + +bool Variant::operator!=(CVarRef v) const { + return !HPHP::equal(*this, v); +} + +bool Variant::operator>=(CVarRef v) const { + return not_less(*this, v); +} + +bool Variant::operator<=(CVarRef v) const { + return not_more(*this, v); +} + +bool Variant::operator>(CVarRef v) const { + return HPHP::more(*this, v); +} + +bool Variant::operator<(CVarRef v) const { + return HPHP::less(*this, v); +} + +/////////////////////////////////////////////////////////////////////////////// +// offset functions + +ObjectData *Variant::getArrayAccess() const { + ASSERT(is(KindOfObject)); + ObjectData *obj = getObjectData(); + ASSERT(obj); + if (!obj->o_instanceof("arrayaccess")) { + throw InvalidOperandException("not ArrayAccess objects"); + } + return obj; +} + +void Variant::callOffsetUnset(CVarRef key) { + getArrayAccess()->o_invoke("offsetunset", Array::Create(key), -1); +} + +Variant Variant::rvalAt(int64 offset, int64 prehash /* = -1 */) const { + switch (getType()) { + case LiteralString: + escalateString(); + // fall through + case KindOfString: + return getStringData()->getChar((int)offset); + case KindOfArray: + return getArrayData()->get(offset, prehash); + case KindOfObject: + return getArrayAccess()->o_invoke("offsetget", Array::Create(offset), -1); + default: + break; + } + return null; +} + +Variant Variant::rvalAt(litstr offset, int64 prehash /* = -1 */) const { + switch (getType()) { + case LiteralString: + escalateString(); + // fall through + case KindOfString: + return getStringData()->getChar(String(offset).toInt32()); + case KindOfArray: + return getArrayData()->get(String(offset).toKey(), prehash); + case KindOfObject: + return getArrayAccess()->o_invoke("offsetget", Array::Create(offset), -1); + default: + break; + } + return null; +} + +Variant Variant::rvalAt(CStrRef offset, int64 prehash /* = -1 */) const { + switch (getType()) { + case LiteralString: + escalateString(); + // fall through + case KindOfString: + return getStringData()->getChar(offset.toInt32()); + case KindOfArray: + return getArrayData()->get(offset.toKey(), prehash); + case KindOfObject: + return getArrayAccess()->o_invoke("offsetget", Array::Create(offset), -1); + default: + break; + } + return null; +} + +Variant Variant::rvalAt(CVarRef offset, int64 prehash /* = -1 */) const { + switch (getType()) { + case LiteralString: + escalateString(); + // fall through + case KindOfString: + return getStringData()->getChar(offset.toInt32()); + case KindOfArray: + { + ArrayData* arr = getArrayData(); + switch (offset.getType()) { + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return arr->get(offset.toInt64(), prehash); + default: + { + Variant k = offset.toKey(); + if (!k.isNull()) { + return arr->get(k, prehash); + } + return null; + } + } + } + case KindOfObject: + return getArrayAccess()->o_invoke("offsetget", Array::Create(offset), -1); + default: + break; + } + return null; +} + +Variant &Variant::lvalAt(bool key, int64 prehash /* = -1 */) { + return lvalAtImpl(key, prehash); +} +Variant &Variant::lvalAt(char key, int64 prehash /* = -1 */) { + return lvalAtImpl(key, prehash); +} +Variant &Variant::lvalAt(short key, int64 prehash /* = -1 */) { + return lvalAtImpl(key, prehash); +} +Variant &Variant::lvalAt(int key, int64 prehash /* = -1 */) { + return lvalAtImpl(key, prehash); +} +Variant &Variant::lvalAt(int64 key, int64 prehash /* = -1 */) { + return lvalAtImpl(key, prehash); +} +Variant &Variant::lvalAt(double key, int64 prehash /* = -1 */) { + return lvalAtImpl((int64)key, prehash); +} +Variant &Variant::lvalAt(litstr key, int64 prehash /* = -1 */) { + return lvalAtImpl(String(key).toKey(), prehash); +} +Variant &Variant::lvalAt(CStrRef key, int64 prehash /* = -1 */) { + return lvalAtImpl(key.toKey(), prehash); +} +Variant &Variant::lvalAt(CVarRef key, int64 prehash /* = -1 */) { + Variant k = key.toKey(); + if (!k.isNull()) { + return lvalAtImpl(k, prehash); + } + return lvalBlackHole(); +} + +Variant &Variant::lvalInvalid() { + throw_bad_type_exception("not array objects"); + return ((Globals*)get_global_variables())->__lvalProxy; +} + +Variant &Variant::lvalBlackHole() { + return ((Globals*)get_global_variables())->__lvalProxy; +} + +Variant Variant::refvalAt(bool key, int64 prehash /* = -1 */) { + return refvalAtImpl(key, prehash); +} +Variant Variant::refvalAt(char key, int64 prehash /* = -1 */) { + return refvalAtImpl(key, prehash); +} +Variant Variant::refvalAt(short key, int64 prehash /* = -1 */) { + return refvalAtImpl(key, prehash); +} +Variant Variant::refvalAt(int key, int64 prehash /* = -1 */) { + return refvalAtImpl(key, prehash); +} +Variant Variant::refvalAt(int64 key, int64 prehash /* = -1 */) { + return refvalAtImpl(key, prehash); +} +Variant Variant::refvalAt(double key, int64 prehash /* = -1 */) { + return refvalAtImpl((int64)key, prehash); +} +Variant Variant::refvalAt(litstr key, int64 prehash /* = -1 */) { + return refvalAtImpl(key, prehash); +} +Variant Variant::refvalAt(CStrRef key, int64 prehash /* = -1 */) { + return refvalAtImpl(key, prehash); +} +Variant Variant::refvalAt(CVarRef key, int64 prehash /* = -1 */) { + return refvalAtImpl(key, prehash); +} + +Variant Variant::o_get(CStrRef propName, int64 prehash /* = -1 */) const { + if (m_type == KindOfObject) { + return m_data.pobj->o_get(propName, prehash); + } else if (m_type == KindOfVariant) { + return m_data.pvar->o_get(propName, prehash); + } else { + return null; + } +} + +Variant Variant::o_invoke(const char *s, CArrRef params, int64 hash) { + if (m_type == KindOfObject) { + return m_data.pobj->o_invoke(s, params, hash); + } else if (m_type == KindOfVariant) { + return m_data.pvar->o_invoke(s, params, hash); + } else { + throw InvalidOperandException( + "Call to a member function on a non-object"); + } +} + +Variant Variant::o_root_invoke(const char *s, CArrRef params, int64 hash) { + if (m_type == KindOfObject) { + return m_data.pobj->o_root_invoke(s, params, hash); + } else if (m_type == KindOfVariant) { + return m_data.pvar->o_root_invoke(s, params, hash); + } else { + throw InvalidOperandException( + "Call to a member function on a non-object"); + } +} + +Variant Variant::o_invoke_ex(const char *clsname, const char *s, + CArrRef params, int64 hash) { + if (m_type == KindOfObject) { + return m_data.pobj->o_invoke_ex(clsname, s, params, hash); + } else if (m_type == KindOfVariant) { + return m_data.pvar->o_invoke_ex(clsname, s, params, hash); + } else { + throw InvalidOperandException( + "Call to a member function on a non-object"); + } +} + +Variant Variant::o_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 /* = null_variant */, + CVarRef a1 /* = null_variant */, + CVarRef a2 /* = null_variant */ +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 /* = null_variant */, + CVarRef a4 /* = null_variant */, + CVarRef a5 /* = null_variant */ +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 /* = null_variant */, + CVarRef a7 /* = null_variant */, + CVarRef a8 /* = null_variant */, + CVarRef a9 /* = null_variant */ +#endif +) { + if (m_type == KindOfObject) { + return m_data.pobj->o_invoke_few_args(s, hash, count, a0, a1, a2 +#if INVOKE_FEW_ARGS_COUNT > 3 + ,a3, a4, a5 +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,a6, a7, a8, a9 +#endif + ); + } else if (m_type == KindOfVariant) { + return m_data.pvar->o_invoke_few_args(s, hash, count, a0, a1, a2 +#if INVOKE_FEW_ARGS_COUNT > 3 + ,a3, a4, a5 +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,a6, a7, a8, a9 +#endif + ); + } else { + throw InvalidOperandException( + "Call to a member function on a non-object"); + } +} + +Variant Variant::o_root_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 /* = null_variant */, + CVarRef a1 /* = null_variant */, + CVarRef a2 /* = null_variant */ +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 /* = null_variant */, + CVarRef a4 /* = null_variant */, + CVarRef a5 /* = null_variant */ +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 /* = null_variant */, + CVarRef a7 /* = null_variant */, + CVarRef a8 /* = null_variant */, + CVarRef a9 /* = null_variant */ +#endif +) { + if (m_type == KindOfObject) { + return m_data.pobj->o_root_invoke_few_args(s, hash, count, a0, a1, a2 +#if INVOKE_FEW_ARGS_COUNT > 3 + ,a3, a4, a5 +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,a6, a7, a8, a9 +#endif + ); + } else if (m_type == KindOfVariant) { + return m_data.pvar->o_root_invoke_few_args(s, hash, count, a0, a1, a2 +#if INVOKE_FEW_ARGS_COUNT > 3 + ,a3, a4, a5 +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,a6, a7, a8, a9 +#endif + ); + } else { + throw InvalidOperandException( + "Call to a member function on a non-object"); + } +} + +ObjectOffset Variant::o_lval(CStrRef propName, int64 prehash /*= -1 */) { + if (m_type == KindOfObject) { + return Object(m_data.pobj).o_lval(propName, prehash); + } else if (m_type == KindOfVariant) { + return m_data.pvar->o_lval(propName, prehash); + } else { + set(Object(NEW(c_stdclass)())); + return Object(m_data.pobj).o_lval(propName, prehash); + } +} + +#define IMPLEMENT_SETAT(T) \ + CVarRef Variant::setAtImpl(T key, CVarRef v, int64 prehash) { \ + switch (m_type) { \ + case KindOfBoolean: \ + if (toBoolean()) { \ + throw_bad_type_exception("not array objects"); \ + break; \ + } \ + /* Fall through */ \ + case KindOfNull: \ + set(ArrayData::Create(key, v)); \ + break; \ + case KindOfArray: \ + { \ + if (v.isContagious()) { \ + escalate(); \ + } \ + ArrayData *escalated = \ + m_data.parr->set(key, v, (m_data.parr->getCount() > 1), \ + prehash); \ + if (escalated) { \ + set(escalated); \ + } \ + } \ + break; \ + case KindOfVariant: \ + m_data.pvar->set(key, v); \ + break; \ + case LiteralString: \ + case KindOfString: \ + { \ + String s = toString(); \ + if (s.empty()) { \ + set(Array::Create(key, v)); \ + } else { \ + s.lvalAt(key) = v; \ + set(s); \ + } \ + break; \ + } \ + case KindOfObject: \ + getArrayAccess()->o_invoke("offsetset", \ + CREATE_VECTOR2(key, v), -1); \ + break; \ + default: \ + throw_bad_type_exception("not array objects"); \ + break; \ + } \ + return v; \ + } \ + +IMPLEMENT_SETAT(int64); +IMPLEMENT_SETAT(CStrRef); +IMPLEMENT_SETAT(CVarRef); + +CVarRef Variant::set(int64 key, CVarRef v, int64 prehash /* = -1 */) { + return setAtImpl(key, v, prehash); +} + +CVarRef Variant::set(litstr key, CVarRef v, int64 prehash /* = -1 */) { + return setAtImpl(String(key).toKey(), v, prehash); +} + +CVarRef Variant::set(CStrRef key, CVarRef v, int64 prehash /* = -1 */) { + return setAtImpl(key.toKey(), v, prehash); +} + +CVarRef Variant::set(CVarRef key, CVarRef v, int64 prehash /* = -1 */) { + switch(key.getType()) { + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return setAtImpl(key.toInt64(), v, prehash); + default: + break; + } + // Trouble cases: Object and Array + Variant k = key.toKey(); + if (!k.isNull()) { + return setAtImpl(k, v, prehash); + } + return null_variant; +} + +CVarRef Variant::append(CVarRef v) { + switch (m_type) { + case KindOfNull: + set(ArrayData::Create(v)); + break; + case KindOfArray: + { + bool contagious = false; + if (v.isContagious()) { + escalate(); + contagious = true; + } + ArrayData *escalated = + m_data.parr->append(v, (m_data.parr->getCount() > 1)); + if (escalated) { + set(escalated); + // special case "$a[] = $a;" to match PHP's weird semantics + if (!contagious && + (this == &v || + (v.is(KindOfArray) && getArrayData() == v.getArrayData()))) { + const_cast(escalated->endRef()).set(escalated); + } + } + } + break; + case KindOfVariant: + m_data.pvar->append(v); + break; + case KindOfObject: + { + Array params = CREATE_VECTOR2(null, v); + m_data.pobj->o_invoke("offsetset", params, -1); + } + break; + case LiteralString: + case KindOfString: + if (toString().empty()) { + set(ArrayData::Create(v)); + return v; + } + // fall through to throw + default: + throw_bad_type_exception("[] operator not supported for this type"); + } + return v; +} + +void Variant::remove(litstr key, int64 prehash /* = -1 */) { + removeImpl(String(key).toKey(), prehash); +} +void Variant::remove(CStrRef key, int64 prehash /* = -1 */) { + removeImpl(key.toKey(), prehash); +} + +void Variant::remove(CVarRef key, int64 prehash /* = -1 */) { + switch(key.getType()) { + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + removeImpl(key.toInt64(), prehash); + return; + default: + break; + } + // Trouble cases: Array, Object + Variant k = key.toKey(); + if (!k.isNull()) { + removeImpl(k, prehash); + } +} + +void Variant::setStatic() const { + switch (m_type) { + case KindOfString: + m_data.pstr->setStatic(); + break; + case KindOfArray: + m_data.parr->setStatic(); + m_data.parr->onSetStatic(); + break; + case KindOfVariant: + m_data.pvar->setStatic(); + break; + case KindOfObject: + ASSERT(false); // object shouldn't be in a scalar array + break; + default: + break; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// output functions + +void Variant::serialize(VariableSerializer *serializer, + bool isArrayKey /* = false */) const { + if (m_type == KindOfVariant) { + // Ugly, but behavior is different for serialize + if (serializer->getType() == VariableSerializer::Serialize) { + if (serializer->incNestedLevel(m_data.pvar)) { + serializer->writeOverflow(m_data.pvar); + } else { + m_data.pvar->serialize(serializer, isArrayKey); + } + serializer->decNestedLevel(m_data.pvar); + } else { + m_data.pvar->serialize(serializer, isArrayKey); + } + return; + } + + switch (m_type) { + case KindOfNull: + ASSERT(!isArrayKey); + serializer->writeNull(); break; + case KindOfBoolean: + ASSERT(!isArrayKey); + serializer->write(m_data.num != 0); break; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + serializer->write(m_data.num); break; + case KindOfDouble: + serializer->write(m_data.dbl); break; + case LiteralString: + serializer->write(m_data.str); break; + case KindOfString: + serializer->write(m_data.pstr->data(), + m_data.pstr->size(), isArrayKey); + break; + case KindOfArray: + ASSERT(!isArrayKey); + m_data.parr->serialize(serializer); break; + case KindOfObject: + ASSERT(!isArrayKey); + m_data.pobj->serialize(serializer); break; + default: + ASSERT(false); + break; + } +} + +void Variant::unserialize(VariableUnserializer *unserializer) { + std::istream &in = unserializer->in(); + char type, sep; + in >> type >> sep; + + if (type != 'R') { + unserializer->add(this); + } + + if (type == 'N') { + // ASSERT(isNull()); + if(sep != ';') throw Exception("Expected ';' but got '%c'", sep); + return; + } + if (sep != ':') { + throw Exception("Expected ':' but got '%c'", sep); + } + + switch (type) { + case 'r': { int64 id; in >> id; operator=(unserializer->get(id)); } break; + case 'R': + { + int64 id; + in >> id; + operator=(ref(unserializer->get(id))); + } + break; + case 'b': { int64 v; in >> v; operator=((bool)v); } break; + case 'i': { int64 v; in >> v; operator=(v); } break; + case 'd': + { + double v; + char ch = in.peek(); + bool negative = false; + char buf[4]; + if (ch == '-') { + negative = true; + in >> ch; + ch = in.peek(); + } + if (ch == 'I') { + in.read(buf, 3); buf[3] = '\0'; + if (strcmp(buf, "INF")) { + throw Exception("Expected 'INF' but got '%s'", buf); + } + v = atof("inf"); + } else if (ch == 'N') { + in.read(buf, 3); buf[3] = '\0'; + if (strcmp(buf, "NAN")) { + throw Exception("Expected 'NAN' but got '%s'", buf); + } + v = atof("nan"); + } else { + in >> v; + } + operator=(negative ? -v : v); + } + break; + case 's': + { + String v; + v.unserialize(in); + operator=(v); + } + break; + case 'a': + { + Array v = Array::Create(); + v.unserialize(unserializer); + operator=(v); + return; // array has '}' terminating + } + break; + case 'O': + { + String clsName; + clsName.unserialize(in); + + in >> sep; + if (sep != ':') { + throw Exception("Expected ':' but got '%c'", sep); + } + + Object obj; + try { + obj = create_object(clsName.data(), Array::Create(), false); + } catch (ClassNotFoundException &e) { + obj = create_object("__PHP_Incomplete_Class", Array::Create(), false); + obj->o_set("__PHP_Incomplete_Class_Name", -1, clsName); + } + operator=(obj); + int64 size; + char sep; + in >> size >> sep; + if (sep != ':') { + throw Exception("Expected ':' but got '%c'", sep); + } + in >> sep; + if (sep != '{') { + throw Exception("Expected '{' but got '%c'", sep); + } + if (size > 0) { + for (int64 i = 0; i < size; i++) { + String key = unserializer->unserializeKey().toString(); + int subLen = 0; + if (key.charAt(0) == '\00') { + if (key.charAt(1) == '*') { + subLen = 3; // protected + } else { + subLen = key.find('\00', 1) + 1; // private, skipping class name + if (subLen == String::npos) { + throw Exception("Mangled private object property"); + } + } + } + Variant &value = subLen != 0 ? + obj.o_lval(key.substr(subLen), -1).lval() : + obj.o_lval(key, -1).lval(); + value.unserialize(unserializer); + } + } + in >> sep; + if (sep != '}') { + throw Exception("Expected '}' but got '%c'", sep); + } + + obj->t___wakeup(); + return; // object has '}' terminating + } + break; + default: + throw Exception("Unknown type '%c'", type); + } + in >> sep; + if (sep != ';') { + throw Exception("Expected ';' but got '%c'", sep); + } +} + +Variant Variant::share(bool save) const { + if (m_type == KindOfVariant) { + return m_data.pvar->share(save); + } + + switch (m_type) { + case KindOfNull: return false; // same as non-existent + case KindOfBoolean: return (m_data.num != 0); + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: return m_data.num; + case KindOfDouble: return m_data.dbl; + case LiteralString: return m_data.str; + case KindOfString: + return String(m_data.pstr->data(), m_data.pstr->size(), CopyString); + case KindOfArray: + { + Array ret; + for (ArrayIter iter(m_data.parr); iter; ++iter) { + ret.set(iter.first().share(save), iter.second().share(save)); + } + return ret; + } + break; + case KindOfObject: + if (save) { + // we have to return an object so to remember its type + c_stdclass *obj = NEW(c_stdclass)(); + obj->o_set("s", -1, f_serialize(*this)); + return obj; + } else { + return f_unserialize(m_data.pobj->o_get("s", -1)); + } + break; + default: + ASSERT(false); + break; + } + + return false; // same as non-existent +} + +const char *Variant::getTypeString(DataType type) { + switch (type) { + case KindOfNull: return "KindOfNull"; + case KindOfBoolean: return "KindOfBoolean"; + case KindOfByte: return "KindOfByte"; + case KindOfInt16: return "KindOfInt16"; + case KindOfInt32: return "KindOfInt32"; + case KindOfInt64: return "KindOfInt64"; + case KindOfDouble: return "KindOfDouble"; + case LiteralString: return "LiteralString"; + case KindOfString: return "KindOfString"; + case KindOfArray: return "KindOfArray"; + case KindOfObject: return "KindOfObject"; + case KindOfVariant: return "KindOfVariant"; + default: + ASSERT(false); + break; + } + return ""; +} + +std::string Variant::getDebugDump() const { + char buf[1024]; + snprintf(buf, sizeof(buf), "[%s: %p]", getTypeString(m_type), m_data.pstr); + return buf; +} + +void Variant::dump() { + VariableSerializer vs(VariableSerializer::VarDump); + Variant ret = vs.serialize(*this, true); + printf("Variant: %s", ret.toString().data()); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/type_variant.h b/src/cpp/base/type_variant.h new file mode 100644 index 0000000000000..74e1ba2a5f03e --- /dev/null +++ b/src/cpp/base/type_variant.h @@ -0,0 +1,760 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_VARIANT_H__ +#define __HPHP_VARIANT_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { + +#define null Variant() +#define null_variant Variant::s_nullVariant + +/////////////////////////////////////////////////////////////////////////////// + + +/** + * Perhaps the most important class in the entire runtime. When type inference + * fails to know type of a variable, or when certain coding requires reference + * or other dynamic-ness, we have to use Variant as a fallback of a specific + * type. This normally means slower coding. Conceptually, Variant == zval, + * in terms of tasks it has to perform. Therefore, this class is taking similar + * switch(type) approach Zend takes, and this class is pretty much the entire + * Zend re-implementation in a C++ way, whereas other classes in this library + * represent type-specialized implementation of the language. + * + * Variant is also the only way to implement references. A reference is a + * strong binding between two variables, meaning they both point to the same + * underlying data. Perhaps "contagious" bit is the hardest to understand, but + * it's really just a temporary flag to indicate that next assignment should + * set both variables to be strongly bound together. For example, + * + * a = ref(b); + * + * Here, ref() simply sets "contagious" flag on b. Then assignment a = b will + * check contagious flag. If on, both will be bound together. Then contagious + * flag will be cleared, so not to affect future assignments. Code generation + * made sure both "a" and "b" are Variants, otherwise we won't do references. + * + * In this class, strong binding is done through "pvar" member variable. All + * others are for weak bindings. Primitive types can just make copies, but not + * strings and arrays, which take a copy-on-write approach. This is done by + * doing reference counting on pstr and parr members. + * + * In summary, we have really different approaches handling different types: + * + * binding copy-by-value copy-on-write ref-counting + * num weak x (data) + * dbl weak x (data) + * str weak x (pointer) + * pstr weak x (pointer) x x + * parr weak x (pointer) x x + * pobj weak x (pointer) x + * pvar strong x (pointer) x + */ +class Variant : public Countable { +public: + Variant() : m_type(KindOfNull) { m_data.num = 1 /* uninitialized */;} + + static const Variant s_nullVariant; + + // g++ does not inline !isPrimitive() + ~Variant() { if (m_type > LiteralString) destruct();} + void reset(); // only for special memory sweeping! + + /** + * Constructors. We can't really use template here, since that will make + * Variant being able to take many other external types, messing up those + * operator overloads. + */ + Variant(CVarRef v); + Variant(bool v) : m_type(KindOfBoolean) { m_data.num = (v?1:0);} + Variant(char v) : m_type(KindOfByte ) { m_data.num = v;} + Variant(short v) : m_type(KindOfInt16 ) { m_data.num = v;} + Variant(int v) : m_type(KindOfInt32 ) { m_data.num = v;} + Variant(int64 v) : m_type(KindOfInt64 ) { m_data.num = v;} + Variant(uint64 v) : m_type(KindOfInt64 ) { m_data.num = v;} + Variant(ssize_t v) : m_type(KindOfInt64 ) { m_data.num = v;} + Variant(double v) : m_type(KindOfDouble ) { m_data.dbl = v;} + Variant(litstr v) : m_type(LiteralString) { m_data.str = v;} + + Variant(CStrRef v); + Variant(CArrRef v); + Variant(CObjRef v); + Variant(StringData *v); + Variant(ArrayData *v); + Variant(ObjectData *v); + Variant(Variant *v); + + template + Variant(const SmartObject &v) : m_type(KindOfNull) { + set(v); + } + + /** + * Break bindings and set to null. + */ + void unset() { + destruct(); + m_data.num = 0; + m_type = KindOfNull; + } + + /** + * set to null without breaking bindings (if any), faster than v_a = null; + */ + void setNull(); + + /** + * Type testing functions + */ + DataType getType() const { + return m_type == KindOfVariant ? m_data.pvar->getType() : m_type; + } + bool is(DataType type) const { + return getType() == type; + } + bool isInitialized() const { + return m_type != KindOfNull || m_data.num != 1 /* uninitialized */; + } + bool isNull() const { + return getType() == KindOfNull; + } + bool isBoolean() const { + return getType() == KindOfBoolean; + } + bool isDouble() const { + return getType() == KindOfDouble; + } + bool isString() const { + DataType type = getType(); + return type == LiteralString || type == KindOfString; + } + bool isPrimitive() const { return m_type <= LiteralString; } + bool isInteger() const; + bool isNumeric(bool checkString = false) const; + bool isScalar() const; + bool isObject () const { + return getType() == KindOfObject; + } + bool isIntVal() const { + return isInteger() || isNull() || isBoolean() || isObject(); + } + bool isArray() const { + return getType() == KindOfArray; + } + bool isResource() const; + bool instanceof(const char *s) const; + + /** + * Borrowing Countable::_count for contagious bit, and this is okay, since + * outer Variant never uses reference counting. + */ + void setContagious() const { _count = -1;} + void clearContagious() const { _count = 0;} + bool isContagious() const { return _count == -1;} + + /** + * Whether or not there are at least two variables that are strongly bound. + */ + bool isReferenced() const { + return m_type == KindOfVariant && m_data.pvar->getCount() > 1; + } + + /** + * Get reference count of weak or strong binding. For debugging purpose. + */ + int getRefCount() const; + + double getDouble() const { + ASSERT(m_type == KindOfDouble); + return m_data.dbl; + } + + /** + * Operators + */ + Variant &assign(CVarRef v, bool deep); + Variant &operator=(CVarRef v) { + return assign(v, true); + } + template Variant &operator=(const T &v) { + if (m_type != KindOfVariant) { + set(v); + } else { + m_data.pvar->set(v); + } + return *this; + } + + Variant operator + (); + Variant unary_plus() const { return Variant(*this).operator+();} + Variant operator + (CVarRef v) const; + Variant &operator += (CVarRef v); + Variant &operator += (char n) { return operator+=((int64)n);} + Variant &operator += (short n) { return operator+=((int64)n);} + Variant &operator += (int n) { return operator+=((int64)n);} + Variant &operator += (int64 n); + Variant &operator += (double n); + + Variant negate() const { return Variant(*this).operator-();} + Variant operator - (); + Variant operator - (CVarRef v) const; + Variant &operator -= (CVarRef v); + Variant &operator -= (char n) { return operator-=((int64)n);} + Variant &operator -= (short n) { return operator-=((int64)n);} + Variant &operator -= (int n) { return operator-=((int64)n);} + Variant &operator -= (int64 n); + Variant &operator -= (double n); + + Variant operator * (CVarRef v) const; + Variant &operator *= (CVarRef v); + Variant &operator *= (char n) { return operator*=((int64)n);} + Variant &operator *= (short n) { return operator*=((int64)n);} + Variant &operator *= (int n) { return operator*=((int64)n);} + Variant &operator *= (int64 n); + Variant &operator *= (double n); + + Variant operator / (CVarRef v) const; + Variant &operator /= (CVarRef v); + Variant &operator /= (char n) { return operator/=((int64)n);} + Variant &operator /= (short n) { return operator/=((int64)n);} + Variant &operator /= (int n) { return operator/=((int64)n);} + Variant &operator /= (int64 n); + Variant &operator /= (double n); + + int64 operator % (CVarRef v) const; + Variant &operator %= (CVarRef v); + Variant &operator %= (char n) { return operator%=((int64)n);} + Variant &operator %= (short n) { return operator%=((int64)n);} + Variant &operator %= (int n) { return operator%=((int64)n);} + Variant &operator %= (int64 n); + Variant &operator %= (double n); + + Variant operator ~ () const; + Variant operator | (CVarRef v) const; + Variant &operator |= (CVarRef v); + Variant operator & (CVarRef v) const; + Variant &operator &= (CVarRef v); + Variant operator ^ (CVarRef v) const; + Variant &operator ^= (CVarRef v); + Variant &operator <<=(int64 n); + Variant &operator >>=(int64 n); + + Variant &operator ++ (); + Variant operator ++ (int); + Variant &operator -- (); + Variant operator -- (int); + + /** + * These are convenient functions for writing extensions, since code + * generation always uses explicit functions like same(), less() etc. that + * are type specialized and unambiguous. + */ + bool operator == (CVarRef v) const; + bool operator != (CVarRef v) const; + bool operator >= (CVarRef v) const; + bool operator <= (CVarRef v) const; + bool operator > (CVarRef v) const; + bool operator < (CVarRef v) const; + + /** + * Iterator functions. See array_iterator.h for end() and next(). + * escalate() will escalate me to become VectorVariant or MapVariant, so that + * getValueRef() can be called to take a reference to an array element. + */ + ArrayIterPtr begin(const char *context = NULL) const; + // used by generated code + MutableArrayIterPtr begin(Variant *key, Variant &val); + void escalate(); + + /** + * Implicit type conversions. In general, we prefer explicit type conversion + * functions. These are needed simply because Variant is a coerced type from + * other types, and we need implicit type conversions to make our type + * inference coding simpler (Expression::m_expectedType handling). + */ + + operator bool () const { return toBoolean();} + operator char () const { return toByte();} + operator short () const { return toInt16();} + operator int () const { return toInt32();} + operator int64 () const { return toInt64();} + operator double () const { return toDouble();} + operator String () const; + operator Array () const; + operator Object () const; + template operator SmartObject() const { return toObject();} + + /** + * Explicit type conversions + */ + bool toBoolean() const; + char toByte () const { return (char)toInt64();} + short toInt16 (int base = 10) const { return (short)toInt64(base);} + int toInt32 (int base = 10) const { return (int)toInt64(base);} + int64 toInt64 (int base = 10) const; + double toDouble () const; + String toString () const; + Array toArray () const; + Object toObject () const; + Variant toKey () const; + + /** + * Comparisons + */ + bool same(bool v2) const; + bool same(char v2) const; + bool same(short v2) const; + bool same(int v2) const; + bool same(int64 v2) const; + bool same(double v2) const; + bool same(litstr v2) const; + bool same(CStrRef v2) const; + bool same(CArrRef v2) const; + bool same(CObjRef v2) const; + bool same(CVarRef v2) const; + + bool equal(bool v2) const; + bool equal(char v2) const; + bool equal(short v2) const; + bool equal(int v2) const; + bool equal(int64 v2) const; + bool equal(double v2) const; + bool equal(litstr v2) const; + bool equal(CStrRef v2) const; + bool equal(CArrRef v2) const; + bool equal(CObjRef v2) const; + bool equal(CVarRef v2) const; + + bool less(bool v2) const; + bool less(char v2) const; + bool less(short v2) const; + bool less(int v2) const; + bool less(int64 v2) const; + bool less(double v2) const; + bool less(litstr v2) const; + bool less(CStrRef v2) const; + bool less(CArrRef v2) const; + bool less(CObjRef v2) const; + bool less(CVarRef v2) const; + + bool more(bool v2) const; + bool more(char v2) const; + bool more(short v2) const; + bool more(int v2) const; + bool more(int64 v2) const; + bool more(double v2) const; + bool more(litstr v2) const; + bool more(CStrRef v2) const; + bool more(CArrRef v2) const; + bool more(CObjRef v2) const; + bool more(CVarRef v2) const; + + /** + * Output functions + */ + void serialize(VariableSerializer *serializer, + bool isArrayKey = false) const; + void unserialize(VariableUnserializer *unserializer); + + /** + * Used by SharedStore to save/restore a variant. + */ + Variant share(bool save) const; + + /** + * Debugging functions. + */ + static const char *getTypeString(DataType type); + std::string getDebugDump() const; + + /** + * Memory allocator methods. + */ + DECLARE_SMART_ALLOCATION_NOCALLBACKS(Variant); + void dump(); + + /** + * Offset functions + */ + Variant rvalAt(bool offset, int64 prehash = -1) const { + return rvalAt(offset ? 1LL : 0LL, prehash); + } + Variant rvalAt(char offset, int64 prehash = -1) const { + return rvalAt((int64)offset, prehash); + } + Variant rvalAt(short offset, int64 prehash = -1) const { + return rvalAt((int64)offset, prehash); + } + Variant rvalAt(int offset, int64 prehash = -1) const { + return rvalAt((int64)offset, prehash); + } + Variant rvalAt(int64 offset, int64 prehash = -1) const; + Variant rvalAt(double offset, int64 prehash = -1) const { + return rvalAt((int64)offset, prehash); + } + Variant rvalAt(litstr offset, int64 prehash = -1) const; + Variant rvalAt(CStrRef offset, int64 prehash = -1) const; + Variant rvalAt(CVarRef offset, int64 prehash = -1) const; + + const Variant operator[](bool key) const { return rvalAt(key);} + const Variant operator[](char key) const { return rvalAt(key);} + const Variant operator[](short key) const { return rvalAt(key);} + const Variant operator[](int key) const { return rvalAt(key);} + const Variant operator[](int64 key) const { return rvalAt(key);} + const Variant operator[](double key) const { return rvalAt(key);} + const Variant operator[](litstr key) const { return rvalAt(key);} + const Variant operator[](CStrRef key) const { return rvalAt(key);} + const Variant operator[](CArrRef key) const { return rvalAt(key);} + const Variant operator[](CObjRef key) const { return rvalAt(key);} + const Variant operator[](CVarRef key) const { return rvalAt(key);} + + /** + * Called from VariantOffset for taking lval(). + */ + Variant &lval() { + if (m_type == KindOfVariant) { + return m_data.pvar->lval(); + } + + ASSERT(is(KindOfArray)); + Variant *ret = NULL; + ArrayData *arr = m_data.parr; + ArrayData *escalated = arr->lval(ret, arr->getCount() > 1); + if (escalated) { + set(escalated); + } + ASSERT(ret); + return *ret; + } + + template + Variant &lval(const T &key) { + if (m_type == KindOfVariant) { + return m_data.pvar->lval(key); + } + + ASSERT(is(KindOfArray)); + Variant *ret = NULL; + ArrayData *arr = m_data.parr; + ArrayData *escalated = arr->lval(key, ret, arr->getCount() > 1); + if (escalated) { + set(escalated); + } + ASSERT(ret); + return *ret; + } + + Variant &lvalAt() { + append(null); + return lval(); + } + + static Variant &lvalInvalid(); + static Variant &lvalBlackHole(); + + Variant &lvalAt(bool key, int64 prehash = -1); + Variant &lvalAt(char key, int64 prehash = -1); + Variant &lvalAt(short key, int64 prehash = -1); + Variant &lvalAt(int key, int64 prehash = -1); + Variant &lvalAt(int64 key, int64 prehash = -1); + Variant &lvalAt(double key, int64 prehash = -1); + Variant &lvalAt(litstr key, int64 prehash = -1); + Variant &lvalAt(CStrRef key, int64 prehash = -1); + Variant &lvalAt(CVarRef key, int64 prehash = -1); + + Variant refvalAt(bool key, int64 prehash = -1); + Variant refvalAt(char key, int64 prehash = -1); + Variant refvalAt(short key, int64 prehash = -1); + Variant refvalAt(int key, int64 prehash = -1); + Variant refvalAt(int64 key, int64 prehash = -1); + Variant refvalAt(double key, int64 prehash = -1); + Variant refvalAt(litstr key, int64 prehash = -1); + Variant refvalAt(CStrRef key, int64 prehash = -1); + Variant refvalAt(CVarRef key, int64 prehash = -1); + + Variant o_get(CStrRef propName, int64 prehash = -1) const; + ObjectOffset o_lval(CStrRef propName, int64 prehash = -1); + + Variant o_invoke(const char *s, CArrRef params, int64 hash); + Variant o_root_invoke(const char *s, CArrRef params, int64 hash); + Variant o_invoke_ex(const char *clsname, const char *s, + CArrRef params, int64 hash); + + Variant o_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 = null_variant, + CVarRef a1 = null_variant, + CVarRef a2 = null_variant +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 = null_variant, + CVarRef a4 = null_variant, + CVarRef a5 = null_variant +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 = null_variant, + CVarRef a7 = null_variant, + CVarRef a8 = null_variant, + CVarRef a9 = null_variant +#endif +); + Variant o_root_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 = null_variant, + CVarRef a1 = null_variant, + CVarRef a2 = null_variant +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 = null_variant, + CVarRef a4 = null_variant, + CVarRef a5 = null_variant +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 = null_variant, + CVarRef a7 = null_variant, + CVarRef a8 = null_variant, + CVarRef a9 = null_variant +#endif +); + + /** + * The whole purpose of VariantOffset is to collect "v" parameter to call + * this function. + */ + CVarRef set(bool key, CVarRef v, int64 prehash = -1) { + return set(key ? 1LL : 0LL, v, prehash); + } + CVarRef set(char key, CVarRef v, int64 prehash = -1) { + return set((int64)key, v, prehash); + } + CVarRef set(short key, CVarRef v, int64 prehash = -1) { + return set((int64)key, v, prehash); + } + CVarRef set(int key, CVarRef v, int64 prehash = -1) { + return set((int64)key, v, prehash); + } + CVarRef set(int64 key, CVarRef v, int64 prehash = -1); + CVarRef set(double key, CVarRef v, int64 prehash = -1) { + return set((int64)key, v, prehash); + } + CVarRef set(litstr key, CVarRef v, int64 prehash = -1); + CVarRef set(CStrRef key, CVarRef v, int64 prehash = -1); + CVarRef set(CVarRef key, CVarRef v, int64 prehash = -1); + + CVarRef append(CVarRef v); + + template + void removeImpl(const T &key, int64 prehash) { + switch (getType()) { + case KindOfNull: + break; + case KindOfArray: + { + ArrayData *arr = getArrayData(); + if (arr) { + ArrayData *escalated = arr->remove(key, (arr->getCount() > 1), + prehash); + if (escalated) { + set(escalated); + } + } + } + break; + case KindOfObject: + callOffsetUnset(key); + break; + default: + lvalInvalid(); + break; + } + } + void remove(int64 key, int64 prehash = -1) { removeImpl(key, prehash);} + void remove(litstr key, int64 prehash = -1); + void remove(CStrRef key, int64 prehash = -1); + void remove(CVarRef key, int64 prehash = -1); + + // implemented in object_data.h + template + void weakRemove(const T &key, int64 prehash = -1); + + /** + * More array opeartions. + */ + Variant pop(); + Variant dequeue(); + void insert(int pos, CVarRef v); + + /** + * Position-based iterations. + */ + Variant array_iter_reset(); + Variant array_iter_prev(); + Variant array_iter_current() const; + Variant array_iter_next(); + Variant array_iter_end(); + Variant array_iter_key() const; + Variant array_iter_value(ssize_t &pos) const; + Variant array_iter_each(); + + /** + * Low level access that should be restricted to internal use. + */ + litstr getLiteralString() const { + ASSERT(getType() == LiteralString); + return m_type == KindOfVariant ? m_data.pvar->m_data.str : m_data.str; + } + + StringData *getStringData() const { + ASSERT(getType() == KindOfString); + return m_type == KindOfVariant ? m_data.pvar->m_data.pstr : m_data.pstr; + } + ArrayData *getArrayData() const { + ASSERT(is(KindOfArray)); + return m_type == KindOfVariant ? m_data.pvar->m_data.parr : m_data.parr; + } + ObjectData *getObjectData() const { + ASSERT(is(KindOfObject)); + return m_type == KindOfVariant ? m_data.pvar->m_data.pobj : m_data.pobj; + } + Variant *getVariantData() const { + // Wrap into a referenceable form, if it isn't already. + if (m_type != KindOfVariant) { + Variant *shared = NEW(Variant)(); + shared->bind(*this); + shared->_count = 1; + + _count = 0; + m_data.pvar = shared; + m_type = KindOfVariant; + } + ASSERT(m_type == KindOfVariant); + return m_data.pvar; + } + ObjectData *getArrayAccess() const; + void callOffsetUnset(CVarRef key); + int64 getNumData() const { return m_data.num; } + void setStatic() const; + + private: + mutable DataType m_type; + mutable union { + int64 num; + double dbl; + litstr str; + StringData *pstr; + ArrayData *parr; + ObjectData *pobj; + Variant *pvar; // shared data between strongly bound Variants + } m_data; + + void destruct(); + + CVarRef set(bool v); + CVarRef set(char v); + CVarRef set(short v); + CVarRef set(int v); + CVarRef set(int64 v); + CVarRef set(double v); + CVarRef set(litstr v); + CVarRef set(CStrRef v); + CVarRef set(CArrRef v); + CVarRef set(CObjRef v); + CVarRef set(const ObjectOffset& v); + CVarRef set(StringData *v); + CVarRef set(ArrayData *v); + CVarRef set(ObjectData *v); + void escalateString() const; + + template + CVarRef set(const SmartObject &v) { + return set(v.get()); + } + + CVarRef setAtImpl(int64 key, CVarRef v, int64 prehash); + CVarRef setAtImpl(CStrRef key, CVarRef v, int64 prehash); + CVarRef setAtImpl(CVarRef key, CVarRef v, int64 prehash); + + /** + * When "deep" is true, if v is strongly bound, we will follow the link to + * make a real copy of the data. This is the default mode for all cases. + * + * When "deep" is false, we will strongly bind to the same data. This is the + * mode we use when we copy array elements or object members, because we + * always make shallow copy of them when they are referenced. + */ + void copy(CVarRef v, bool deep); // making a real copy of another Variant + void bind2(CVarRef v); // internal helper function for bind + void bind(CVarRef v); // weakly binding a variable + void bind(Variant *v); // strongly binding a variable + void split(); // breaking weak binding by making a real copy + + // implemented in object_data.h + template + Variant &lvalAtImpl(const T &key, int64 prehash = -1); + template + Variant refvalAtImpl(const T &key, int64 prehash = -1); +}; + +/////////////////////////////////////////////////////////////////////////////// + +inline Variant operator+(char n, CVarRef v) { return Variant(v) += n;} +inline Variant operator+(short n, CVarRef v) { return Variant(v) += n;} +inline Variant operator+(int n, CVarRef v) { return Variant(v) += n;} +inline Variant operator+(int64 n, CVarRef v) { return Variant(v) += n;} +inline Variant operator+(double n, CVarRef v) { return Variant(v) += n;} +inline Variant operator+(CVarRef v, char n) { return Variant(v) += n;} +inline Variant operator+(CVarRef v, short n) { return Variant(v) += n;} +inline Variant operator+(CVarRef v, int n) { return Variant(v) += n;} +inline Variant operator+(CVarRef v, int64 n) { return Variant(v) += n;} +inline Variant operator+(CVarRef v, double n) { return Variant(v) += n;} + +inline Variant operator-(char n, CVarRef v) { return v.negate() += n;} +inline Variant operator-(short n, CVarRef v) { return v.negate() += n;} +inline Variant operator-(int n, CVarRef v) { return v.negate() += n;} +inline Variant operator-(int64 n, CVarRef v) { return v.negate() += n;} +inline Variant operator-(double n, CVarRef v) { return v.negate() += n;} +inline Variant operator-(CVarRef v, char n) { return Variant(v) -= n;} +inline Variant operator-(CVarRef v, short n) { return Variant(v) -= n;} +inline Variant operator-(CVarRef v, int n) { return Variant(v) -= n;} +inline Variant operator-(CVarRef v, int64 n) { return Variant(v) -= n;} +inline Variant operator-(CVarRef v, double n) { return Variant(v) -= n;} + +inline Variant operator*(char n, CVarRef v) { return Variant(v) *= n;} +inline Variant operator*(short n, CVarRef v) { return Variant(v) *= n;} +inline Variant operator*(int n, CVarRef v) { return Variant(v) *= n;} +inline Variant operator*(int64 n, CVarRef v) { return Variant(v) *= n;} +inline Variant operator*(double n, CVarRef v) { return Variant(v) *= n;} +inline Variant operator*(CVarRef v, char n) { return Variant(v) *= n;} +inline Variant operator*(CVarRef v, short n) { return Variant(v) *= n;} +inline Variant operator*(CVarRef v, int n) { return Variant(v) *= n;} +inline Variant operator*(CVarRef v, int64 n) { return Variant(v) *= n;} +inline Variant operator*(CVarRef v, double n) { return Variant(v) *= n;} + +double operator/(double n, CVarRef v); +double operator/(int n, CVarRef v); +inline Variant operator/(CVarRef v, char n) { return Variant(v) /= n;} +inline Variant operator/(CVarRef v, short n) { return Variant(v) /= n;} +inline Variant operator/(CVarRef v, int n) { return Variant(v) /= n;} +inline Variant operator/(CVarRef v, int64 n) { return Variant(v) /= n;} +inline Variant operator/(CVarRef v, double n) { return Variant(v) /= n;} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_VARIANT_H__ diff --git a/src/cpp/base/types.h b/src/cpp/base/types.h new file mode 100644 index 0000000000000..04a6cf4b95898 --- /dev/null +++ b/src/cpp/base/types.h @@ -0,0 +1,212 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_TYPES_H__ +#define __HPHP_TYPES_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// forward declarations of all data types + +/** + * Complex data types. Note that Numeric, Primitive, PlusOperand and Sequence + * are actually all Variant type in implementation, but we'd keep them using + * their own names in different places, so not to lose their inferred types. + * Should we need to take advantage of this extra type inference information + * in the future, we will be able to. + */ +class String; +class StaticString; +class Array; +class Object; +template class SmartObject; +class Variant; +typedef Variant Numeric; +typedef Variant Primitive; +typedef Variant PlusOperand; +typedef Variant Sequence; + +/** + * These are underlying data structures for the above complex data types. Since + * we use reference counting to achieve copy-on-write and automatic object + * lifetime, we need these data objects to store real data that's shared by + * multiple wrapper objects. + */ +class StringData; +class ArrayData; +class ObjectData; +class ResourceData; + +/** + * Arrays, strings and objects can take offsets or array elements. These offset + * objects will help to store temporary information to make the task easier. + */ +class StringOffset; +class ObjectOffset; + +/** + * Miscellaneous objects to help arrays to construct or to iterate. + */ +class ArrayIter; +class MutableArrayIter; +class ArrayElement; + +struct FullPos; + +/** + * Zend implementation uses HashTable for arrays ubiquitously. That just means + * it will use a lot more memory than needed sometimes, esp. with vectors. Here + * we use 7 specialized array types to store differently shaped arrays. Right + * now we rely on an "escalation" process at run-time to adjust itself to use + * a type without losing semantics. In the future, it's not that crazy to + * provide type hints on what kind of array a code write intends to build. + */ +class EmptyArray; +class Vector; +class VectorLong; +class VectorString; +class VectorVariant; +class Map; +class MapLong; +class MapString; +class MapVariant; + +class VariableSerializer; +class VariableUnserializer; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * LiteralString is separated from non-literal ones (KindOfString), because + * they deserve separate treatment for better optimizations. This means a lot + * of functions may elect to take "litstr " separately from "String" + * class. This code specialization helps speed a lot by not instantiating a + * String object to box an otherwise literal value. This also means, though not + * obviously thus dangerous not to know, whenever a function takes a parameter + * with type of "litstr ", one can only pass in a literal string that has + * a "permanent" memory address to be stored. To make this really clear, I + * invented "litstr" as a typedef-ed name for "litstr " that expects a + * literal string only. Therefore, throughout this entire runtime library, + * + * litstr == literal string + * litstr == any C-string pointer + * + */ +enum DataType { + // do not rearrange the order, we have check such as m_type <= LiteralString + KindOfNull, + KindOfBoolean, + KindOfByte, + KindOfInt16, + KindOfInt32, + KindOfInt64, + KindOfDouble, + LiteralString, + KindOfString, + KindOfArray, + KindOfObject, + KindOfVariant, + + KindOfLast, // marker, not a valid type +}; + +enum StringDataMode { + AttachLiteral, // const char * points to a literal string + AttachString, // const char * points to a malloc-ed string + CopyString, // make a real copy of the string + + StringDataModeCount +}; + +/** + * Some of these typedefs are for platform independency, including "int64". + * Some of them are for clarity, for example, "litstr". Some of them are purely + * for being able to vertically align type-specialized functions so they look + * cleaner. + */ +typedef int int32; +typedef long long int64; +typedef unsigned long long uint64; +typedef const char * litstr; /* literal string */ +typedef const String & CStrRef; +typedef const Array & CArrRef; +typedef const Object & CObjRef; +typedef const Variant & CVarRef; + +/////////////////////////////////////////////////////////////////////////////// +// code injection classes + +extern void throw_infinite_recursion_exception(); +class RecursionInjection { +public: + // This integer is reset during every hphp_session_init() + static DECLARE_THREAD_LOCAL(int, s_stackdepth); + + RecursionInjection() { + if (++*s_stackdepth > 1000) throw_infinite_recursion_exception(); + } + ~RecursionInjection() { + --*s_stackdepth; + } +}; + +extern void throw_request_timeout_exception(); +extern bool f_pcntl_signal_dispatch(); + +// implemented in cpp/base/timeout_thread +class RequestInjectionData { +public: + RequestInjectionData() : started(0), timedout(false), signaled(false) {} + + time_t started; // when a request was started + bool timedout; // flag to set when timeout is detected + + bool signaled; // flag to set when a signal was raised +}; + +class RequestInjection { +public: + static DECLARE_THREAD_LOCAL(RequestInjectionData, s_reqInjectionData); + + RequestInjection() { + RequestInjectionData *p = s_reqInjectionData.get(); + if (p->timedout) throw_request_timeout_exception(); + if (p->signaled) f_pcntl_signal_dispatch(); + } +}; + +// implemented in cpp/ext/ext_hotprofiler.cpp +class ProfilerInjection { +public: + ProfilerInjection(const char *symbol); + ~ProfilerInjection(); +}; + +// definitions for various numeric limits +// implemented in cpp/base/builtin_functions.cpp +class Limits { +public: + static double inf_double; + static double nan_double; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_TYPES_H__ diff --git a/src/cpp/base/util/countable.cpp b/src/cpp/base/util/countable.cpp new file mode 100644 index 0000000000000..9ea5dfcd2f139 --- /dev/null +++ b/src/cpp/base/util/countable.cpp @@ -0,0 +1,19 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// diff --git a/src/cpp/base/util/countable.h b/src/cpp/base/util/countable.h new file mode 100644 index 0000000000000..645478656be47 --- /dev/null +++ b/src/cpp/base/util/countable.h @@ -0,0 +1,90 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_COUNTABLE_H__ +#define __HPHP_COUNTABLE_H__ + +#include + +#ifdef DEBUG_RACE_CONDITION +#include +#endif + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Implements reference counting. We could have used boost::shared_ptr for + * reference counting, but deriving our classes from Countable is more + * efficient, both in time and space. This is because _count is not separately + * allocated from the object, and it's an int than a 64-bit pointer. We + * achieved this because we ask our classes to derive from Countable, + * something boost::shared_ptr doesn't have the luxury to. + */ +class Countable { + public: + Countable() : _count(0) { + } + + void incRefCount() const { +#ifdef DEBUG_RACE_CONDITION + Lock lock(m_mutex); +#endif + ++_count; + } + + int decRefCount() const { +#ifdef DEBUG_RACE_CONDITION + Lock lock(m_mutex); +#endif + ASSERT(_count > 0); + return --_count; + } + + int getCount() const { +#ifdef DEBUG_RACE_CONDITION + Lock lock(m_mutex); +#endif + return _count; + } + + /** + * Used by StaticString and StaticArray to make sure ref count is "never" + * going to reach 0, even if multiple threads modify it in a non-thread-safe + * fashion. + */ + void setStatic() const { + _count = (1 << 30); // INT_MAX / 2 + } + + /** + * For debugging purpose mostly. + */ + bool isStatic() const { + return _count > (1 << 29); + } + + protected: +#ifdef DEBUG_RACE_CONDITION + mutable Mutex m_mutex; +#endif + mutable int _count; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_COUNTABLE_H__ diff --git a/src/cpp/base/util/exceptions.cpp b/src/cpp/base/util/exceptions.cpp new file mode 100644 index 0000000000000..dab260f74efe8 --- /dev/null +++ b/src/cpp/base/util/exceptions.cpp @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include +#include +#include + +namespace HPHP { + +int ExitException::ExitCode = 0; +/////////////////////////////////////////////////////////////////////////////// + +ExtendedException::ExtendedException() : Exception() { + if (RuntimeOption::InjectedStacktrace) { + m_bt = ArrayPtr(new Array(FrameInjection::getBacktrace(false, true))); + } +} + +ExtendedException::ExtendedException(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + format(fmt, ap); + va_end(ap); + if (RuntimeOption::InjectedStacktrace) { + m_bt = ArrayPtr(new Array(FrameInjection::getBacktrace(false, true))); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/util/exceptions.h b/src/cpp/base/util/exceptions.h new file mode 100644 index 0000000000000..2c59033aeadf3 --- /dev/null +++ b/src/cpp/base/util/exceptions.h @@ -0,0 +1,238 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CPP_BASE_EXCEPTIONS_H__ +#define __CPP_BASE_EXCEPTIONS_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// all defined exceptions + +DECLARE_BOOST_TYPES(Array); +class ExtendedException : public Exception { +public: + ExtendedException(); + ExtendedException(const char *fmt, ...); + ArrayPtr getBackTrace() const { return m_bt; } +private: + ArrayPtr m_bt; +}; + +class Assertion : public ExtendedException { +public: + Assertion() : ExtendedException("An assertion was raised.") {} +}; + +class NullPointerException : public ExtendedException { +public: + NullPointerException() + : ExtendedException("A null object pointer was used.") {} +}; + +class InvalidObjectTypeException : public ExtendedException { +public: + InvalidObjectTypeException(const char *name) + : ExtendedException("Unexpected object type %s.", name) {} +}; + +class InvalidOperandException : public ExtendedException { +public: + InvalidOperandException(const char *msg) + : ExtendedException("Invalid operand type was used: %s.", msg) {} +}; + +class BadArrayMergeException : public InvalidOperandException { +public: + BadArrayMergeException() + : InvalidOperandException("merging an array with NULL or non-array") {} +}; + +class BadArrayOperandException : public InvalidOperandException { +public: + BadArrayOperandException() + : InvalidOperandException("cannot perform this operation with arrays") {} +}; + +class BadTypeConversionException : public ExtendedException { +public: + BadTypeConversionException(const char *msg) + : ExtendedException("Bad type conversion: %s.", msg) {} +}; + +class UninitializedOffsetException : public ExtendedException { +public: + UninitializedOffsetException(int offset) + : ExtendedException("Uninitialized string offset: %d", offset) {} +}; + +class OffsetOutOfRangeException : public ExtendedException { +public: + OffsetOutOfRangeException() + : ExtendedException("String offset is out of range.") {} +}; + +class EmptyObjectPropertyException : public ExtendedException { +public: + EmptyObjectPropertyException() + : ExtendedException("Object property name cannot be empty.") {} +}; + +class InvalidFunctionCallException : public ExtendedException { +public: + InvalidFunctionCallException(const char *func) + : ExtendedException("(1) call the function without enough arguments OR " + "(2) Unable to find function \"%s\" OR " + "(3) function was not in invoke table.", + func) {} +}; + +class InvalidClassException : public ExtendedException { +public: + InvalidClassException(const char *cls) + : ExtendedException("Unable to find class \"%s\".", cls) {} +}; + +class FatalErrorException : public ExtendedException { +public: + FatalErrorException(const char *msg, ...) { + std::string fmt = "Fatal error: "; fmt += msg; fmt += '.'; + va_list ap; va_start(ap, msg); format(fmt.c_str(), ap); va_end(ap); + } +}; + +class ClassNotFoundException : public FatalErrorException { +public: + ClassNotFoundException(const char *msg) + : FatalErrorException(msg) {} +}; + +class SystemCallFailure : public ExtendedException { +public: + SystemCallFailure(const char *func) + : ExtendedException("%s returned %d: %s.", func, errno, + Util::safe_strerror(errno).c_str()) {} +}; + +class InvalidArgumentException : public ExtendedException { +public: + InvalidArgumentException(const char *param, int value) + : ExtendedException("Invalid argument \"%s\": [%d]", param, value) {} + + InvalidArgumentException(const char *param, unsigned int value) + : ExtendedException("Invalid argument \"%s\": [%u]", param, value) {} + + InvalidArgumentException(const char *param, long value) + : ExtendedException("Invalid argument \"%s\": [%ld]", param, value) {} + + InvalidArgumentException(const char *param, long long value) + : ExtendedException("Invalid argument \"%s\": [%lld]", param, value) {} + + InvalidArgumentException(const char *param, double value) + : ExtendedException("Invalid argument \"%s\": [%g]", param, value) {} + + InvalidArgumentException(const char *param, const char *value) + : ExtendedException("Invalid argument \"%s\": [%s]", param, value) {} + + InvalidArgumentException(const char *param, const std::string &value) + : ExtendedException("Invalid argument \"%s\": [%s]", param, + value.c_str()) {} + + InvalidArgumentException(int, const char *fmt, ...) { + va_list ap; va_start(ap, fmt); format(fmt, ap); va_end(ap); + } + +protected: + InvalidArgumentException(const char *param) + : ExtendedException("Argument \"%s\" is missing", param) {} +}; + +class ArgumentMissingException : public InvalidArgumentException { +public: + ArgumentMissingException(const char *param) + : InvalidArgumentException(param) {} +}; + +class NotEnoughArgumentsException : public ExtendedException { +public: + NotEnoughArgumentsException(const char *funcname) + : ExtendedException("Not enough arguments for function %s", funcname) {} +}; + +class TooManyArgumentsException : public ExtendedException { +public: + TooManyArgumentsException(const char *funcname) + : ExtendedException("Too much arguments for function %s", funcname) {} +}; + +class TypeVariableChangeException : public ExtendedException { +public: + TypeVariableChangeException(const char *loc) + : ExtendedException("Type of variable changed at %s", loc) {} +}; + +class UseOfUndefinedVarException : public ExtendedException { +public: + UseOfUndefinedVarException(const char *loc) + : ExtendedException("Use of undefined variable at %s", loc) {} +}; + +class MethodSignatureChangeException : public ExtendedException { +public: + MethodSignatureChangeException(const char *method) + : ExtendedException("Signature of method %s changed", method) {} +}; + +class NestingLevelTooDeepException : public ExtendedException { +public: + NestingLevelTooDeepException() + : ExtendedException("Nesting level too deep - recursive dependency?") {} +}; + +class NotImplementedException : public ExtendedException { +public: + NotImplementedException(const char *feature) + : ExtendedException("%s is not implemented yet.", feature) {} +}; + +class NotSupportedException : public ExtendedException { +public: + NotSupportedException(const char *feature, const char *reason) + : ExtendedException("%s is not going to be supported: %s", + feature, reason) {} +}; + +class ExitException : public ExtendedException { +public: + static int ExitCode; + + ExitException(int exitCode) : ExtendedException("") { + ExitCode = exitCode; + } +}; + +class PhpFileDoesNotExistException : public ExtendedException { +public: + PhpFileDoesNotExistException(const char *file) + : ExtendedException("File could not be loaded: %s", file) {} +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __CPP_BASE_EXCEPTIONS_H__ diff --git a/src/cpp/base/util/hphp_map.cpp b/src/cpp/base/util/hphp_map.cpp new file mode 100644 index 0000000000000..e2ce925aa3b79 --- /dev/null +++ b/src/cpp/base/util/hphp_map.cpp @@ -0,0 +1,418 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace HPHP; +/////////////////////////////////////////////////////////////////////////////// +#ifndef OLD_HPHP_MAP +void HphpMapCell::dump() { + ASSERT(alive()); + key().dump(); + printf("value: %d\n", m_value); +} + +HphpMapConstIterator::HphpMapConstIterator(const HphpMapIterator& it) + : m_idx(it.getidx()), m_map(it.getmap()) { +} + +const HphpMapCell &HphpMapConstIterator::get() const { + return m_map->m_table[m_idx]; +} + +HphpMapConstIterator& HphpMapConstIterator::operator++() { + const HphpVector &table = m_map->m_table; + ssize_t tsize = table.size(); + if (m_idx != tsize) { + m_idx++; + while (m_idx < tsize && !table[m_idx].alive()) { m_idx++; } + } + return *this; +} + +HphpMapCell &HphpMapIterator::get() { + return m_map->m_table[m_idx]; +} + +HphpMapIterator& HphpMapIterator::operator++() { + const HphpVector &table = m_map->m_table; + ssize_t tsize = table.size(); + if (m_idx != tsize) { + m_idx++; + while (m_idx < tsize && !table[m_idx].alive()) { m_idx++; } + } + return *this; +} + +int& HphpMap::operator[](CVarRef key) { + int64 idx = hash(key); + int64 hash = idx; + Cell* cell; + while (true) { + idx &= m_table.size() - 1; + cell = &m_table[idx]; + if (cell->empty()) { + break; + } + if (cell->hash() == hash && same(key, *cell)) { + return cell->lvalue(); + } + idx++; + } + cell->set(key, hash, 0); + + m_size++; + m_useSize++; + if (overloaded()) { + growTable(); + return (*this)[key]; + } + return cell->lvalue(); +} + +void HphpMap::erase(CVarRef key) { + return erase(key, hash(key)); +} + +void HphpMap::erase(CVarRef key, int64 preHash /* = -1 */) { + ASSERT(preHash < 0 || preHash == hash(key)); + + int64 idx = preHash >= 0 ? preHash : hash(key); + int64 hash = idx; + while (true) { + idx &= m_table.size() - 1; + Cell &cell = m_table[idx]; + if (cell.empty()) { + return; + } if (cell.hash() == hash && same(key, cell)) { + cell.erase(); + m_size--; + return; + } + idx++; + } +} + +void HphpMap::growTable() { + size_t size = m_table.size(); + uint newsize = size * 2; + HphpVector newTable(newsize); + for (uint i = 0; i < size; i++) { + const Cell &cell = m_table[i]; + if (cell.alive()) { + insertCell(cell, newTable); + } + } + m_table.swap(newTable); +} + +void HphpMap::insertCell(const Cell &oldCell, HphpVector &table, + bool copy /* = false */) { + int64 idx = oldCell.hash(); + uint mask = table.size() - 1; + ASSERT((mask & (mask+1)) == 0); + while (true) { + idx &= mask; + Cell &cell = table[idx]; + if (cell.empty()) { + cell.set(oldCell, copy); + return; + } + idx++; + } +} + +void HphpMap::dump() { + printf("Map: tsize=%u, useSize=%u, size=%u\n", m_table.size(), + (uint)m_useSize, (uint)m_size); + for (uint i = 0; i < m_table.size(); i++) { + Cell& cell = m_table[i]; + if (cell.empty()) { + continue; + } + if (cell.value() == -1) { + printf("Deleted at %u:\n", i); + } else { + printf("Entry at %u:\n", i); + cell.key().dump(); + printf("to %d\n", cell.value()); + } + } +} + +#else +// Old HphpMap implementation +IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS(HphpMapNode); + +void HphpMapNode::dump() { + m_key.dump(); + printf("value: %d\n", m_value); +} + +HphpMapConstIterator::HphpMapConstIterator(const HphpMapIterator& it) + : m_node(it.get()), m_map(it.getmap()) { +} + +HphpMapConstIterator& HphpMapConstIterator::operator++() { + if (m_node->m_next) { + m_node = m_node->m_next; + } else { + size_t tsize = m_map->m_table.size(); + Node *cur = NULL; + for (uint idx = HphpMap::hash(m_node->key()) % tsize + 1; + idx < tsize && !cur; idx++) { + cur = m_map->m_table[idx]; + } + m_node = cur; + } + return *this; +} + +HphpMapIterator& HphpMapIterator::operator++() { + if (m_node->m_next) { + m_node = m_node->m_next; + } else { + size_t tsize = m_map->m_table.size(); + Node* cur = NULL; + for (uint idx = HphpMap::hash(m_node->key()) % tsize + 1; + idx < tsize && !cur; idx++) { + cur = m_map->m_table[idx]; + } + m_node = cur; + } + return *this; +} + +int64 HphpMap::hash(CVarRef s) { + int64 hash; + switch (s.getType()) { + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + hash = hash_int64(s.toInt64()); + break; + case LiteralString: + { + const char* d = s.getLiteralString(); + hash = hash_string(d, strlen(d)); + } + break; + case KindOfString: + { + StringData *st = s.getStringData(); + hash = hash_string(st->data(), st->size()); + } + break; + default: + ASSERT(false); + return 0; + } + return hash; +} + +bool HphpMap::same(CVarRef s1, CVarRef s2) { + DataType t1 = s1.getType(); + DataType t2 = s2.getType(); + switch (t1) { + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + switch (t2) { + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + break; + default: + return false; + } + break; + case LiteralString: + case KindOfString: + switch (t2) { + case LiteralString: + case KindOfString: + break; + default: + return false; + } + break; + default: + ASSERT(false); + if (t1 != t2) return false; + break; + } + + switch (t1) { + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return s1.toInt64() == s2.toInt64(); + default: + const char* s1d; + uint64 s1l; + const char* s2d; + uint64 s2l; + if (t1 == LiteralString) { + s1d = s1.getLiteralString(); + s1l = strlen(s1d); + } else { + StringData *s1data = s1.getStringData(); + s1d = s1data->data(); + s1l = s1data->size(); + } + if (t2 == LiteralString) { + s2d = s2.getLiteralString(); + s2l = strlen(s2d); + } else { + StringData *s2data = s2.getStringData(); + s2d = s2data->data(); + s2l = s2data->size(); + } + return string_strcmp(s1d, s1l, s2d, s2l) == 0; + } +} + +void HphpMap::copy(const HphpMap& map) { + ASSERT(&map != this); + + m_table.resize(map.m_table.size()); + for (const_iterator it = map.begin(); it != map.end(); ++it) { + Node* n = NEW(Node)(it->key(), it->value(), NULL); + insertNode(n, m_table); + } + m_size = map.m_size; +} + +void HphpMap::clear() { + Node *node, *next; + size_t size = m_table.size(); + for (uint i = 0; i < size; i++) { + for (node = m_table[i]; node; node = next) { + next = node->m_next; + DELETE(Node)(node); + } + m_table[i] = NULL; + } + m_size = 0; +} + +bool HphpMap::insert(CVarRef key, int value, int &oldValue, + int64 preHash /* = -1 */) { + ASSERT(preHash < 0 || preHash == hash(key)); + + uint64 idx = (preHash >= 0 ? preHash : hash(key)) % m_table.size(); + Node *head = m_table[idx]; + for (Node* node = head; node; node = node->m_next) { + if (same(node->key(), key)) { + oldValue = node->value(); + return false; + } + } + + Node *newNode = NEW(Node)(key, value, head); + m_table[idx] = newNode; + oldValue = value; + m_size++; + if (overloaded()) { + growTable(); + } + return true; +} + +int& HphpMap::operator[](CVarRef key) { + uint64 idx = hash(key) % m_table.size(); + Node* head = m_table[idx]; + for (Node* node = head; node; node = node->m_next) { + if (same(node->key(), key)) { + return node->lvalue(); + } + } + + Node* newNode = NEW(Node)(key, 0, head); + m_table[idx] = newNode; + + m_size++; + if (overloaded()) { + growTable(); + } + return newNode->lvalue(); +} + +bool HphpMap::find(CVarRef key, int &value, int64 preHash /* = -1 */) const { + ASSERT(preHash < 0 || preHash == hash(key)); + + uint64 idx = (preHash >= 0 ? preHash : hash(key)) % m_table.size(); + for (Node* node = m_table[idx]; node; node = node->m_next) { + if (same(node->key(), key)) { + value = node->value(); + return true; + } + } + return false; +} + +void HphpMap::erase(CVarRef key) { + return erase(key, hash(key)); +} + +void HphpMap::erase(CVarRef key, int64 preHash /* = -1 */) { + ASSERT(preHash < 0 || preHash == hash(key)); + + uint64 idx = (preHash >= 0 ? preHash : hash(key)) % m_table.size(); + Node* prev = NULL; + for (Node* node = m_table[idx]; + node; + prev = node, + node = node->m_next) { + if (same(node->key(), key)) { + if (prev) { + prev->m_next = node->m_next; + } else { + m_table[idx] = node->m_next; + } + DELETE(Node)(node); + m_size--; + return; + } + } +} + +void HphpMap::growTable() { + size_t size = m_table.size(); + uint newsize = size * 2; + HphpVector newTable(newsize); + for (uint i = 0; i < size; i++) { + Node* next; + for (Node* node = m_table[i]; + node; + node = next) { + next = node->m_next; + insertNode(node, newTable); + } + } + m_table.swap(newTable); +} + +void HphpMap::insertNode(Node* node, HphpVector &table) { + uint idx = hash(node->key()) % table.size(); + Node* next = table[idx]; + node->m_next = next; + table[idx] = node; +} + +#endif diff --git a/src/cpp/base/util/hphp_map.h b/src/cpp/base/util/hphp_map.h new file mode 100644 index 0000000000000..337407abd90bf --- /dev/null +++ b/src/cpp/base/util/hphp_map.h @@ -0,0 +1,578 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_HPHP_MAP_H__ +#define __HPHP_HPHP_MAP_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef OLD_HPHP_MAP + +class HphpMap; +class HphpMapConstIterator; +class HphpMapIterator; + +class HphpMapConstIterator { + typedef HphpMap Map; + typedef HphpMapCell Cell; + uint m_idx; + const Map *m_map; + public: + HphpMapConstIterator(uint idx, const Map *map) + : m_idx(idx), m_map(map) {} + + HphpMapConstIterator() : m_idx(0), m_map(NULL) {} + HphpMapConstIterator(const HphpMapConstIterator& it) + : m_idx(it.m_idx), m_map(it.m_map) {} + HphpMapConstIterator(const HphpMapIterator& it); + + const Cell& operator*() const { + return get(); + } + + const Cell* operator->() const { + return &get(); + } + HphpMapConstIterator& operator++(); + bool operator==(const HphpMapConstIterator& it) const { + return m_idx == it.m_idx; + } + bool operator!=(const HphpMapConstIterator& it) const { + return m_idx != it.m_idx; + } +private: + const Cell& get() const; +}; + +class HphpMapIterator { + typedef HphpMap Map; + typedef HphpMapCell Cell; + uint m_idx; + Map *m_map; + public: + HphpMapIterator(uint idx, Map *map) + : m_idx(idx), m_map(map) {} + + HphpMapIterator() : m_idx(0), m_map(NULL) {} + HphpMapIterator(const HphpMapIterator& it) + : m_idx(it.m_idx), m_map(it.m_map) {} + + Cell& operator*() { + return get(); + } + + Cell* operator->() { + return &get(); + } + uint getidx() const { + return m_idx; + } + const Map* getmap() const { + return m_map; + } + + HphpMapIterator& operator++(); + bool operator==(const HphpMapIterator& it) const { + return m_idx == it.m_idx; + } + bool operator!=(const HphpMapIterator& it) const { + return m_idx != it.m_idx; + } +private: + Cell& get(); +}; + +class HphpMap { + friend class HphpMapConstIterator; + friend class HphpMapIterator; + typedef HphpMapCell Cell; + public: + HphpMap() : m_table(32), m_size(0), m_useSize(0) { + } + HphpMap(const HphpMap& map) { + copy(map); + } + ~HphpMap() { clear(); } + + bool insert(CVarRef key, int value, int &oldValue, int64 preHash = -1) { + ASSERT(preHash < 0 || preHash == hash(key)); + + int64 idx = preHash >= 0 ? preHash : hash(key); + int64 hash = idx; + uint mask = m_table.size() - 1; + ASSERT((mask & (mask+1)) == 0); + while (true) { + idx &= mask; + Cell &cell = m_table[idx]; + if (cell.empty()) { + cell.set(key, hash, value); + oldValue = value; + break; + } + if (cell.hash() == hash && same(key, cell)) { + oldValue = cell.value(); + return false; + } + idx++; + } + m_size++; + m_useSize++; + if (overloaded()) { + growTable(); + } + return true; + } + + int& operator[](CVarRef key); + HphpMap& operator=(const HphpMap& map) { + copy(map); + return *this; + } + void swap(HphpMap& map) { + m_table.swap(map.m_table); + uint s = m_size; + m_size = map.m_size; + map.m_size = s; + + s = m_useSize; + m_useSize = map.m_useSize; + map.m_useSize = s; + } + + bool find(CVarRef key, int &value, int64 preHash = -1) const { + ASSERT(preHash < 0 || preHash == hash(key)); + + int64 idx = preHash >= 0 ? preHash : hash(key); + int64 hash = idx; + uint mask = m_table.size() - 1; + ASSERT((mask & (mask+1)) == 0); + while (true) { + idx &= mask; + const Cell &cell = m_table[idx]; + if (cell.empty()) { + return false; + } + if (cell.hash() == hash && same(key, cell)) { + value = cell.value(); + return true; + } + idx++; + } + } + + const Cell &findCell(CVarRef key) const { + int64 idx = hash(key); + int64 hash = idx; + uint mask = m_table.size() - 1; + ASSERT((mask & (mask+1)) == 0); + while (true) { + idx &= mask; + const Cell &cell = m_table[idx]; + if (cell.empty()) { + ASSERT(false); + return cell; + } + if (cell.hash() == hash && same(key, cell)) { + return cell; + } + idx++; + } + } + const int rawFind(int64 hash, int64 num) const { + ASSERT(hash != -1); + int64 idx = hash; + uint mask = m_table.size() - 1; + ASSERT((mask & (mask+1)) == 0); + while (true) { + idx &= mask; + const Cell &cell = m_table[idx]; + if (cell.empty()) { + return -1; + } + if (cell.hash() == hash && num == cell.num()) { + return cell.value(); + } + idx++; + } + } + + + void erase(CVarRef key); + void erase(CVarRef key, int64 preHash); + uint size() const { return m_size; } + + typedef HphpMapConstIterator const_iterator; + typedef HphpMapIterator iterator; + const_iterator begin() const { + return HphpMapConstIterator(firstIdx(), this); + } + const_iterator end() const { + return HphpMapConstIterator(m_table.size(), this); + } + iterator begin() { + return HphpMapIterator(firstIdx(), this); + } + iterator end() { + return HphpMapIterator(m_table.size(), this); + } + + uint firstIdx() const { + for (uint idx = 0; idx < m_table.size(); idx++) { + if (m_table[idx].alive()) + return idx; + } + return m_table.size(); + } + void copy(const HphpMap& map) { + ASSERT(&map != this); + + m_table.resize(map.m_table.size()); + for (const_iterator it = map.begin(); it != map.end(); ++it) { + insertCell(*it, m_table, true); + } + m_size = m_useSize = map.m_size; + } + void clear() { + uint size = m_table.size(); + for (uint i = 0; i < size; i++) { + Cell& cell = m_table[i]; + if (cell.type() == KindOfString) cell.clear(); + } + m_size = m_useSize = 0; + } + + static int64 hash(CVarRef s) { + int64 hash; + switch (s.getType()) { + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + hash = hash_int64(s.getNumData()); + break; + case LiteralString: + { + const char* d = s.getLiteralString(); + hash = hash_string(d, strlen(d)); + } + break; + case KindOfString: + { + StringData *st = s.getStringData(); + hash = hash_string(st->data(), st->size()); + } + break; + default: + ASSERT(false); + return 0; + } + return hash; + } + static bool same(CVarRef s1, const Cell &s2) { + DataType t1 = s1.getType(); + DataType t2 = s2.type(); + switch (t1) { + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + switch (t2) { + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + break; + default: + return false; + } + break; + case LiteralString: + case KindOfString: + switch (t2) { + case LiteralString: + case KindOfString: + break; + default: + return false; + } + break; + default: + ASSERT(false); + if (t1 != t2) return false; + break; + } + + switch (t1) { + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return s1.getNumData() == s2.toInt64(); + default: + const char* s1d; + uint64 s1l; + const char* s2d; + uint64 s2l; + if (t1 == LiteralString) { + s1d = s1.getLiteralString(); + s1l = strlen(s1d); + } else { + StringData *s1data = s1.getStringData(); + s1d = s1data->data(); + s1l = s1data->size(); + } + if (t2 == LiteralString) { + s2d = s2.getLiteralString(); + s2l = strlen(s2d); + } else { + StringData *s2data = s2.getStringData(); + s2d = s2data->data(); + s2l = s2data->size(); + } + return (s1d == s2d && s1l == s2l) || + string_strcmp(s1d, s1l, s2d, s2l) == 0; + } + } + + /** + * Memory allocator methods. + */ + bool calculate(int &size) { + return m_table.calculate(size); + } + void backup(LinearAllocator &allocator) { + m_table.backup(allocator); + } + void restore(const char *&data) { + m_table.restore(data); + } + void sweep() { + m_table.sweep(); + } + + void dump(); + + protected: + HphpVector m_table; + uint m_size; + uint m_useSize; + + private: + void growTable(); + void insertCell(const Cell &cell, HphpVector &table, bool copy = false); + bool overloaded() { + uint tsize = m_table.size(); + return m_useSize > (tsize >> 1); + } +}; + +#else +//Old HphpMap + +class HphpMap; +class HphpMapConstIterator; +class HphpMapIterator; + +class HphpMapNode { + typedef HphpMapNode Node; + + friend class HphpMap; + friend class HphpMapConstIterator; + friend class HphpMapIterator; + public: + DECLARE_SMART_ALLOCATION_NOCALLBACKS(HphpMapNode); + HphpMapNode(CVarRef k, int v, HphpMapNode* next) + : m_value(v), m_key(k), m_next(next) {} + + + CVarRef key() const { return m_key; } + + void dump(); + const int &value() const { return m_value; } + int &lvalue() { return m_value; } + private: + int m_value; + Variant m_key; + HphpMapNode* m_next; +}; + +class HphpMapConstIterator { + typedef HphpMap Map; + typedef HphpMapNode Node; + const Node *m_node; + const Map *m_map; + public: + HphpMapConstIterator(const Node *node, const Map *map) + : m_node(node), m_map(map) {} + + HphpMapConstIterator() : m_node(NULL), m_map(NULL) {} + HphpMapConstIterator(const HphpMapConstIterator& it) + : m_node(it.m_node), m_map(it.m_map) {} + HphpMapConstIterator(const HphpMapIterator& it); + + const Node& operator*() const { + return *m_node; + } + + const Node* operator->() const { + return m_node; + } + HphpMapConstIterator& operator++(); + bool operator==(const HphpMapConstIterator& it) const { + return m_node == it.m_node; + } + bool operator!=(const HphpMapConstIterator& it) const { + return m_node != it.m_node; + } +}; + +class HphpMapIterator { + typedef HphpMap Map; + typedef HphpMapNode Node; + Node *m_node; + const Map *m_map; + public: + HphpMapIterator(Node *node, const Map *map) + : m_node(node), m_map(map) {} + + HphpMapIterator() : m_node(NULL), m_map(NULL) {} + HphpMapIterator(const HphpMapIterator& it) + : m_node(it.m_node), m_map(it.m_map) {} + + Node& operator*() const { + return *m_node; + } + + Node* operator->() const { + return m_node; + } + + Node* get() const { + return m_node; + } + const Map* getmap() const { + return m_map; + } + + HphpMapIterator& operator++(); + bool operator==(const HphpMapIterator& it) const { + return m_node == it.m_node; + } + bool operator!=(const HphpMapIterator& it) const { + return m_node != it.m_node; + } +}; + +class HphpMap { + friend class HphpMapConstIterator; + friend class HphpMapIterator; + typedef HphpMapNode Node; + public: + HphpMap() : m_table(23), m_size(0) { + } + HphpMap(const HphpMap& map) { + copy(map); + } + ~HphpMap() { clear(); } + + bool insert(CVarRef key, int value, int &oldValue, int64 preHash = -1); + + int& operator[](CVarRef key); + HphpMap& operator=(const HphpMap& map) { + copy(map); + return *this; + } + void swap(HphpMap& map) { + m_table.swap(map.m_table); + size_t s = m_size; + m_size = map.m_size; + map.m_size = s; + } + + bool find(CVarRef key, int &value, int64 preHash = -1) const; + void erase(CVarRef key); + void erase(CVarRef key, int64 preHash); + size_t size() const { return m_size; } + + typedef HphpMapConstIterator const_iterator; + typedef HphpMapIterator iterator; + const_iterator begin() const { + return HphpMapConstIterator(firstNode(), this); + } + const_iterator end() const { + return HphpMapConstIterator(NULL, this); + } + iterator begin() { + return HphpMapIterator(firstNode(), this); + } + iterator end() { + return HphpMapIterator(NULL, this); + } + + Node* firstNode() const { + for (uint idx = 0; idx < m_table.size(); idx++) { + Node* node = m_table[idx]; + if (node) { + return node; + } + } + return NULL; + } + void clear(); + void copy(const HphpMap& map); + + static int64 hash(CVarRef str); + static bool same(CVarRef s1, CVarRef s2); + + /** + * Memory allocator methods. + */ + bool calculate(int &size) { + return m_table.calculate(size); + } + void backup(LinearAllocator &allocator) { + m_table.backup(allocator); + } + void restore(const char *&data) { + m_table.restore(data); + } + void sweep() { + m_table.sweep(); + } + void dump() {} + + protected: + HphpVector m_table; + size_t m_size; + + private: + void growTable(); + void insertNode(Node* node, HphpVector &table); + bool overloaded() { + size_t tsize = m_table.size(); + return m_size > tsize - (tsize >> 2); + } +}; + +#endif + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_HPHP_MAP_H__ diff --git a/src/cpp/base/util/hphp_map_cell.h b/src/cpp/base/util/hphp_map_cell.h new file mode 100644 index 0000000000000..a2ca9e555692e --- /dev/null +++ b/src/cpp/base/util/hphp_map_cell.h @@ -0,0 +1,155 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_HPHP_MAP_CELL_H__ +#define __HPHP_HPHP_MAP_CELL_H__ + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +#ifndef OLD_HPHP_MAP + +class HphpMapCell { +public: + HphpMapCell() : m_hash(0), m_value(0), m_type(KindOfNull) {} + + Variant key() const { + switch (m_type) { + case KindOfString: + return Variant(m_data.pstr); + case KindOfInt64: + return Variant(m_data.num); + case LiteralString: + return Variant(m_data.str); + default: + ASSERT(false); + return Variant(); + } + } + void dump(); + void clear() { + if (m_type == KindOfString) { + if (m_data.pstr->decRefCount() == 0) { + m_data.pstr->release(); + } + } + m_data.num = 0; + m_hash = 0; + m_value = 0; + m_type = KindOfNull; + } + + int64 toInt64() const { + ASSERT(m_type == KindOfInt64); + return m_data.num; + } + StringData *getStringData() const { + ASSERT(m_type == KindOfString); + return m_data.pstr; + } + litstr getLiteralString() const { + ASSERT(m_type == LiteralString); + return m_data.str; + } + + void set(CVarRef key, int64 h, int v) { + m_type = key.getType(); + switch (m_type) { + case KindOfString: + m_data.pstr = key.getStringData(); + m_data.pstr->incRefCount(); + break; + case LiteralString: + m_data.str = key.getLiteralString(); + break; + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + m_type = KindOfInt64; + m_data.num = key.toInt64(); + break; + default: + ASSERT(false); + } + m_hash = h; + m_value = v; + } + + void set(const HphpMapCell &c, bool copy) { + m_value = c.m_value; + m_hash = c.m_hash; + m_data.num = c.m_data.num; + m_type = c.m_type; + if (copy && m_type == KindOfString) { + m_data.pstr->incRefCount(); + } + } + + bool empty() const { + return m_type == KindOfNull && m_value == 0; + } + bool alive() const { + return m_type != KindOfNull; + } + bool deleted() const { + return m_type == KindOfNull && m_value == -1; + } + void erase() { + clear(); + m_value = -1; + } + + int64 hash() const { return m_hash; } + int64 num() const { return m_data.num; } + const int &value() const { return m_value; } + int &lvalue() { return m_value; } + DataType type() const { return m_type; } + +private: + HphpMapCell(const HphpMapCell &cell) {} + + int64 m_hash; + union { + int64 num; + StringData *pstr; + litstr str; + } m_data; + int m_value; + DataType m_type; + +}; + +namespace HphpVectorFuncs { +// HphpVector +inline void allocate(HphpMapCell *data, int count) { +} +inline void deallocate(HphpMapCell *data, int count) { +} +inline void reset(HphpMapCell *data, int count) {} +inline void sweep(HphpMapCell *data, int count) {} +inline void copy(HphpMapCell *dest, HphpMapCell *src, int count) { + for (int i = 0; i < count; i++) { + dest[i] = src[i]; + } +} + +} + +#endif + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif /* __HPHP_HPHP_MAP_CELL_H__ */ diff --git a/src/cpp/base/util/hphp_vector.h b/src/cpp/base/util/hphp_vector.h new file mode 100644 index 0000000000000..557d671fe8ee2 --- /dev/null +++ b/src/cpp/base/util/hphp_vector.h @@ -0,0 +1,266 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_HPHP_VECTOR_H__ +#define __HPHP_HPHP_VECTOR_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +namespace HphpVectorFuncs { + +// HphpVector +inline void allocate(int64 *data, int count) {} +inline void deallocate(int64 *data, int count) {} +inline void reset(int64 *data, int count) {} +inline void sweep(int64 *data, int count) {} +inline void copy(int64 *dest, int64 *src, int count) { + memcpy(dest, src, count * sizeof(int64)); +} + +// HphpVector +inline void allocate(String *data, int count) {} +inline void deallocate(String *data, int count) { + for (int i = 0; i < count; i++) { + data[i].~String(); + } +} +inline void reset(String *data, int count) { + memset(data, 0, count * sizeof(String)); +} +inline void sweep(String *data, int count) {} +inline void copy(String *dest, String *src, int count) { + for (int i = 0; i < count; i++) { + dest[i] = src[i]; + } +} + +// HphpVector +template inline void allocate(T **data, int count) {} +template inline void deallocate(T **data, int count) {} +template inline void reset(T **data, int count) {} +template inline void sweep(T **data, int count) {} +template inline void copy(T **dest, T **src, int count) { + memcpy(dest, src, count * sizeof(T*)); +} + +} + +/////////////////////////////////////////////////////////////////////////////// + +/** + * A vector that's using LinearMemoryAllocator. This also makes the following + * assumptions: + * + * 1. T is movable within the vector without hurting anything. + * 2. new T has all bytes 0 + * 3. T doesn't have vtable + */ +template +class HphpVector { +public: + HphpVector(int count = 0) + : m_data(NULL), m_size(0), m_count(count), m_bytes(0) { + ASSERT(count >= 0); + if (count) { + reserve(count); + HphpVectorFuncs::allocate((T*)m_data, m_count); + } else { + m_size = 4 * sizeof(T); + m_data = (char*)calloc(m_size, 1); + } + m_bytes = m_count * sizeof(T); + } + + HphpVector(const HphpVector &src) + : m_data(NULL), m_size(0), m_count(0), m_bytes(0) { + append(src); + } + + ~HphpVector() { + if (m_data) { + HphpVectorFuncs::deallocate((T*)m_data, m_count); + free(m_data); + } + } + + void reserve(int count) { + ASSERT(count >= 0); + int newsize = count * sizeof(T); + if (newsize > m_size) { + int oldsize = m_size; + for (m_size = 4; m_size < newsize; m_size <<= 1); + if (m_data) { + m_data = (char*)realloc(m_data, m_size); + memset(m_data + oldsize, 0, m_size - oldsize); + } else { + m_data = (char*)calloc(m_size, 1); + } + } + } + void clear() { + HphpVectorFuncs::deallocate((T*)m_data, m_count); + m_count = 0; + m_bytes = 0; + } + void resize(int count) { + ASSERT(count >= 0); + if (count > m_count) { + reserve(count); + HphpVectorFuncs::allocate((T*)(m_data + m_bytes), count - m_count); + m_count = count; + m_bytes = m_count * sizeof(T); + } else if (count < m_count) { + m_bytes = count * sizeof(T); + HphpVectorFuncs::deallocate((T*)(m_data + m_bytes), m_count - count); + m_count = count; + } + } + + unsigned int size() const { + return m_count; + } + bool empty() const { + return m_count == 0; + } + + const T &operator[](int index) const { + ASSERT(index >= 0); + ASSERT(index < m_count); + return *(const T*)(m_data + index * sizeof(T)); + } + T &operator[](int index) { + ASSERT(index >= 0); + ASSERT(index < m_count); + return *(T*)(m_data + index * sizeof(T)); + } + const T &back() const { + ASSERT(m_count); + return *(const T*)(m_data + m_bytes - sizeof(T)); + } + T &back() { + ASSERT(m_count); + return *(T*)(m_data + m_bytes - sizeof(T)); + } + + void push_back(const T &value) { + reserve(++m_count); + char *item = m_data + m_bytes; + HphpVectorFuncs::reset((T*)item, 1); + HphpVectorFuncs::allocate((T*)item, 1); + *(T*)item = value; + m_bytes += sizeof(T); + } + void insert(int index, const T &value) { + ASSERT(index >= 0); + ASSERT(index <= m_count); + reserve(++m_count); + int offset = index * sizeof(T); + char *item = m_data + offset; + if (m_bytes > offset) { + memmove(item + sizeof(T), item, m_bytes - offset); + } + HphpVectorFuncs::reset((T*)item, 1); + HphpVectorFuncs::allocate((T*)item, 1); + *(T*)item = value; + m_bytes += sizeof(T); + } + void remove(int index) { + ASSERT(index >= 0); + ASSERT(index < m_count); + int offset = index * sizeof(T); + char *item = m_data + offset; + HphpVectorFuncs::deallocate((T*)item, 1); + --m_count; + m_bytes -= sizeof(T); + if (m_bytes > offset) { + memmove(item, item + sizeof(T), m_bytes - offset); + } + } + void append(const HphpVector &src, int start = 0, int count = -1) { + ASSERT(&src != this); + int newcount = src.size() - start; + if (newcount <= 0) return; + if (count >= 0 && newcount > count) { + newcount = count; + if (newcount == 0) return; + } + + reserve(m_count += newcount); + char *item = m_data + m_bytes; + HphpVectorFuncs::reset((T*)item, newcount); + HphpVectorFuncs::copy((T*)item, (T*)(src.m_data + start * sizeof(T)), + newcount); + m_bytes = m_count * sizeof(T); + } + + HphpVector &operator=(const HphpVector &src) { + clear(); + append(src); + return *this; + } + + void swap(HphpVector &src) { + HphpVector tmp(0,0); + memcpy(&tmp, &src, sizeof(HphpVector)); + memcpy(&src, this, sizeof(HphpVector)); + memcpy(this, &tmp, sizeof(HphpVector)); + tmp.m_data = NULL; + } + + /** + * Memory allocator methods. + */ + bool calculate(int &size) const { + ASSERT(m_bytes == (int)(m_count * sizeof(T))); + size += sizeof(int); + size += m_bytes; + return true; + } + void backup(LinearAllocator &allocator) const { + allocator.backup(m_bytes); + allocator.backup(m_data, m_bytes); + } + void restore(const char *&data) { + int s = *(int*)data; + data += sizeof(int); + m_data = (char*)malloc(m_size); + memcpy(m_data, data, s); + data += s; + } + void sweep() { + HphpVectorFuncs::sweep((T*)m_data, m_count); + free(m_data); + m_data = NULL; + } + +private: + HphpVector(int, int) : m_data(NULL) {} // purely for swap + + char *m_data; // malloc-ed memory + int m_size; // malloc-ed size + int m_count; // item count + int m_bytes; // always equal to m_count * sizeof(T) +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_HPHP_VECTOR_H__ diff --git a/src/cpp/base/util/http_client.cpp b/src/cpp/base/util/http_client.cpp new file mode 100644 index 0000000000000..4ce9e24bfaa06 --- /dev/null +++ b/src/cpp/base/util/http_client.cpp @@ -0,0 +1,192 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +HttpClient::HttpClient(int timeout /* = 5 */, int maxRedirect /* = 1 */, + bool use11 /* = true */, bool decompress /* = false */) + : m_timeout(timeout), m_maxRedirect(maxRedirect), m_use11(use11), + m_decompress(decompress), m_response(NULL), m_responseHeaders(NULL), + m_proxyPort(0) { + if (m_timeout <= 0) { + m_timeout = RuntimeOption::SocketDefaultTimeout; + } +} + +size_t HttpClient::curl_write(char *data, size_t size, size_t nmemb, + void *ctx) { + return ((HttpClient*)ctx)->write(data, size, nmemb); +} +size_t HttpClient::write(char *data, size_t size, size_t nmemb) { + size_t length = size * nmemb; + if (length > 0 && m_response) { + m_response->append(data, (int)length); + } + return length; +} + +size_t HttpClient::curl_header(char *data, size_t size, size_t nmemb, + void *ctx) { + return ((HttpClient*)ctx)->header(data, size, nmemb); +} +size_t HttpClient::header(char *data, size_t size, size_t nmemb) { + size_t length = size * nmemb; + if (length > 2 && data[length - 2] == '\r' && data[length - 1] == '\n' && + m_responseHeaders) { + m_responseHeaders->push_back(String(data, length - 2, CopyString)); + } + return length; +} + +void HttpClient::auth(const std::string &username, + const std::string &password, bool basic /* = true */) { + m_basic = true; + m_username = username; + m_password = password; +} + +void HttpClient::proxy(const std::string &host, int port, + const std::string &username /* = "" */, + const std::string &password /* = "" */) { + m_proxyHost = host; + m_proxyPort = port; + m_proxyUsername = username; + m_proxyPassword = password; +} + +int HttpClient::get(const char *url, StringBuffer &response, + const HeaderMap *requestHeaders /* = NULL */, + std::vector *responseHeaders /* = NULL */) { + return impl(url, NULL, 0, response, requestHeaders, responseHeaders); +} + +int HttpClient::post(const char *url, const char *data, int size, + StringBuffer &response, + const HeaderMap *requestHeaders /* = NULL */, + std::vector *responseHeaders /* = NULL */) { + return impl(url, data, size, response, requestHeaders, responseHeaders); +} + +int HttpClient::impl(const char *url, const char *data, int size, + StringBuffer &response, const HeaderMap *requestHeaders, + std::vector *responseHeaders) { + SlowTimer timer(RuntimeOption::HttpSlowQueryThreshold, "curl", url); + + m_response = &response; + + char error_str[CURL_ERROR_SIZE + 1]; + memset(error_str, 0, sizeof(error_str)); + + CURL *cp = curl_easy_init(); + curl_easy_setopt(cp, CURLOPT_URL, url); + curl_easy_setopt(cp, CURLOPT_WRITEFUNCTION, curl_write); + curl_easy_setopt(cp, CURLOPT_WRITEDATA, (void*)this); + curl_easy_setopt(cp, CURLOPT_ERRORBUFFER, error_str); + curl_easy_setopt(cp, CURLOPT_NOPROGRESS, 1); + curl_easy_setopt(cp, CURLOPT_VERBOSE, 0); + curl_easy_setopt(cp, CURLOPT_NOSIGNAL, 1); + curl_easy_setopt(cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 0); // for thread-safe + curl_easy_setopt(cp, CURLOPT_DNS_CACHE_TIMEOUT, 120); + curl_easy_setopt(cp, CURLOPT_NOSIGNAL, 1); // for multithreading mode + + curl_easy_setopt(cp, CURLOPT_TIMEOUT, m_timeout); + if (m_maxRedirect > 1) { + curl_easy_setopt(cp, CURLOPT_FOLLOWLOCATION, 1); + curl_easy_setopt(cp, CURLOPT_MAXREDIRS, m_maxRedirect); + } else { + curl_easy_setopt(cp, CURLOPT_FOLLOWLOCATION, 0); + } + if (!m_use11) { + curl_easy_setopt(cp, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); + } + if (m_decompress) { + curl_easy_setopt(cp, CURLOPT_ENCODING, ""); + } + + if (!m_username.empty()) { + curl_easy_setopt(cp, CURLOPT_HTTPAUTH, + m_basic ? CURLAUTH_BASIC : CURLAUTH_DIGEST); + curl_easy_setopt(cp, CURLOPT_USERNAME, m_username.c_str()); + curl_easy_setopt(cp, CURLOPT_PASSWORD, m_password.c_str()); + } + + if (!m_proxyHost.empty() && m_proxyPort) { + curl_easy_setopt(cp, CURLOPT_PROXY, m_proxyHost.c_str()); + curl_easy_setopt(cp, CURLOPT_PROXYPORT, m_proxyPort); + if (!m_proxyUsername.empty()) { + curl_easy_setopt(cp, CURLOPT_PROXYAUTH, CURLAUTH_BASIC); + curl_easy_setopt(cp, CURLOPT_PROXYUSERNAME, m_proxyUsername.c_str()); + curl_easy_setopt(cp, CURLOPT_PROXYPASSWORD, m_proxyPassword.c_str()); + } + } + + std::vector headers; // holding those temporary strings + curl_slist *slist = NULL; + if (requestHeaders) { + for (HeaderMap::const_iterator iter = requestHeaders->begin(); + iter != requestHeaders->end(); ++iter) { + for (unsigned int i = 0; i < iter->second.size(); i++) { + String header = iter->first + ": " + iter->second[i]; + headers.push_back(header); + slist = curl_slist_append(slist, header.data()); + } + } + if (slist) { + curl_easy_setopt(cp, CURLOPT_HTTPHEADER, slist); + } + } + + if (data && size) { + curl_easy_setopt(cp, CURLOPT_POST, 1); + curl_easy_setopt(cp, CURLOPT_POSTFIELDS, data); + curl_easy_setopt(cp, CURLOPT_POSTFIELDSIZE, size); + } + + if (responseHeaders) { + m_responseHeaders = responseHeaders; + curl_easy_setopt(cp, CURLOPT_HEADERFUNCTION, curl_header); + curl_easy_setopt(cp, CURLOPT_WRITEHEADER, (void*)this); + } + + CURLcode error_no = curl_easy_perform(cp); + long code = 0; + if (error_no != CURLE_OK) { + m_error = error_str; + Logger::Verbose("HttpClient::get(%s) returned error: %s", url, error_str); + } else { + curl_easy_getinfo(cp, CURLINFO_RESPONSE_CODE, &code); + } + + if (slist) { + curl_slist_free_all(slist); + } + + curl_easy_cleanup(cp); + return code; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/util/http_client.h b/src/cpp/base/util/http_client.h new file mode 100644 index 0000000000000..7a745905f1dc9 --- /dev/null +++ b/src/cpp/base/util/http_client.h @@ -0,0 +1,92 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HTTP_CLIENT_H__ +#define __HTTP_CLIENT_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class HttpClient { +public: + HttpClient(int timeout = 5 /* seconds */, int maxRedirect = 1, + bool use11 = true, bool decompress = false); + + /** + * Authentication. + */ + void auth(const std::string &username, const std::string &password, + bool basic = true); + /** + * Set up proxy server. + */ + void proxy(const std::string &host, int port, + const std::string &username = "", + const std::string &password = ""); + + /** + * GET an URL and returns its response code. + */ + int get(const char *url, StringBuffer &response, + const HeaderMap *requestHeaders = NULL, + std::vector *responseHeaders = NULL); + + /** + * POST data to an URL and returns its response code. + */ + int post(const char *url, const char *data, int size, StringBuffer &response, + const HeaderMap *requestHeaders = NULL, + std::vector *responseHeaders = NULL); + + std::string getLastError() const { return m_error;} + +private: + int m_timeout; + int m_maxRedirect; + bool m_use11; + bool m_decompress; + + StringBuffer *m_response; + std::vector *m_responseHeaders; + std::string m_error; + + bool m_basic; + std::string m_username; + std::string m_password; + + std::string m_proxyHost; + int m_proxyPort; + std::string m_proxyUsername; + std::string m_proxyPassword; + + int impl(const char *url, const char *data, int size, StringBuffer &response, + const HeaderMap *requestHeaders, + std::vector *responseHeaders); + + static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx); + static size_t curl_header(char *data, size_t size, size_t nmemb, void *ctx); + + size_t write(char *data, size_t size, size_t nmemb); + size_t header(char *data, size_t size, size_t nmemb); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HTTP_CLIENT_H__ diff --git a/src/cpp/base/util/libevent_http_client.cpp b/src/cpp/base/util/libevent_http_client.cpp new file mode 100644 index 0000000000000..8b91e79347e21 --- /dev/null +++ b/src/cpp/base/util/libevent_http_client.cpp @@ -0,0 +1,323 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace boost; + +// libevent is not exposing this data structure, but we need it. +struct evkeyvalq_ { + struct evkeyval *tqh_first; +}; + +/////////////////////////////////////////////////////////////////////////////// +// static handlers delegating work to instance ones + +static void on_request_completed(struct evhttp_request *req, void *obj) { + ASSERT(obj); + ((HPHP::LibEventHttpClient*)obj)->onRequestCompleted(); +} + +static void on_connection_closed(struct evhttp_connection *conn, void *obj) { + ASSERT(obj); + ((HPHP::LibEventHttpClient*)obj)->onConnectionClosed(); +} + +static void timer_callback(int fd, short events, void *context) { + event_base_loopbreak((struct event_base *)context); +} + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// connection pooling + +static std::string get_hash(const std::string &address, int port) { + string hash = address; + if (port != 80) { + hash += ':'; + hash += lexical_cast(port); + } + return hash; +} + +ReadWriteMutex LibEventHttpClient::ConnectionPoolMutex; +std::map LibEventHttpClient::ConnectionPoolConfig; +std::map + LibEventHttpClient::ConnectionPool; + +void LibEventHttpClient::SetCache(const std::string &address, int port, + int maxConnection) { + string hash = get_hash(address, port); + + WriteLock lock(ConnectionPoolMutex); + if (maxConnection > 0) { + ConnectionPoolConfig[hash] = maxConnection; + } else { + ConnectionPoolConfig.erase(hash); + } +} + +LibEventHttpClientPtr LibEventHttpClient::Get(const std::string &address, + int port) { + string hash = get_hash(address, port); + + int maxConnection = 0; + { + ReadLock lock(ConnectionPoolMutex); + map::const_iterator iter = ConnectionPoolConfig.find(hash); + if (iter == ConnectionPoolConfig.end()) { + // not configured to cache + ServerStats::Log("evhttp.skip", 1); + ServerStats::Log("evhttp.skip." + hash, 1); + return LibEventHttpClientPtr(new LibEventHttpClient(address, port)); + } + maxConnection = iter->second; + } + + WriteLock lock(ConnectionPoolMutex); + LibEventHttpClientPtrVec &pool = ConnectionPool[hash]; + for (unsigned int i = 0; i < pool.size(); i++) { + LibEventHttpClientPtr client = pool[i]; + if (!client->m_busy) { + client->m_busy = true; + ServerStats::Log("evhttp.hit", 1); + ServerStats::Log("evhttp.hit." + hash, 1); + return client; + } + } + + LibEventHttpClientPtr ret(new LibEventHttpClient(address, port)); + if ((int)pool.size() < maxConnection) { + if (pool.empty()) { + pool.reserve(maxConnection); + } + pool.push_back(ret); + } + ServerStats::Log("evhttp.miss", 1); + ServerStats::Log("evhttp.miss." + hash, 1); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// constructor and destructor + +LibEventHttpClient::LibEventHttpClient(const std::string &address, int port) + : m_busy(true), m_address(address), m_port(port), m_conn(NULL), + m_request(NULL), m_thread(NULL), m_code(0), m_response(NULL), m_len(0) { + m_eventBase = event_base_new(); +} + +LibEventHttpClient::~LibEventHttpClient() { + clear(); + + // reset all per-connection data structures + if (m_conn) { + evhttp_connection_free(m_conn); + } + if (m_eventBase) { + event_base_free(m_eventBase); + } +} + +void LibEventHttpClient::clear() { + // reset all per-request data structures + if (m_thread) { + m_thread->waitForEnd(); + delete m_thread; + m_thread = NULL; + } + if (m_request) { + evhttp_request_free(m_request); + m_request = NULL; + } + m_url.clear(); + m_code = 0; + m_codeLine.clear(); + m_len = 0; + if (m_response) { + free(m_response); + m_response = NULL; + } + m_responseHeaders.clear(); +} + +void LibEventHttpClient::release() { + clear(); + m_busy = false; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool LibEventHttpClient::send(const std::string &url, + const std::vector &headers, + int timeoutSeconds, bool async, + const void *data /* = NULL */, + int size /* = 0 */) { + clear(); + m_url = url; + + if (m_conn == NULL) { + m_conn = evhttp_connection_new(m_address.c_str(), m_port); + evhttp_connection_set_closecb(m_conn, on_connection_closed, this); + evhttp_connection_set_base(m_conn, m_eventBase); + } + m_request = evhttp_request_new(on_request_completed, this); + + // url + evhttp_cmd_type cmd = data ? EVHTTP_REQ_POST : EVHTTP_REQ_GET; + int ret = evhttp_make_request(m_conn, m_request, cmd, url.c_str()); + if (ret != 0) { + Logger::Error("evhttp_make_request failed"); + return false; + } + + // REVIEW: libevent never sends a Host header (nor does it properly send HTTP + // 400 for HTTP/1.1 requests without such a header), in blatent violation of + // RFC2616; this should perhaps be fixed in the library proper. + if (m_port == 80) { + evhttp_add_header(m_request->output_headers, "Host", m_address.c_str()); + } else { + std::ostringstream ss; + ss << m_address << ":" << m_port; + evhttp_add_header(m_request->output_headers, "Host", ss.str().c_str()); + } + + // request headers + bool keepalive = true; + for (unsigned int i = 0; i < headers.size(); i++) { + const std::string &header = headers[i]; + size_t pos = header.find(':'); + if (pos != string::npos && header[pos + 1] == ' ') { + string name = header.substr(0, pos); + if (strcasecmp(name.c_str(), "Connection") == 0) { + keepalive = false; + } + int ret = evhttp_add_header(m_request->output_headers, + name.c_str(), header.c_str() + pos + 2); + if (ret >= 0) { + continue; + } + } + Logger::Error("invalid request header: [%s]", header.c_str()); + } + if (keepalive) { + evhttp_add_header(m_request->output_headers, "Connection", "keep-alive"); + } + + // post data + if (data && size) { + evbuffer_add(m_request->output_buffer, data, size); + } + + if (timeoutSeconds > 0) { + struct timeval timeout; + timeout.tv_sec = timeoutSeconds; + timeout.tv_usec = 0; + + event_set(&m_eventTimeout, -1, 0, timer_callback, m_eventBase); + event_base_set(m_eventBase, &m_eventTimeout); + event_add(&m_eventTimeout, &timeout); + } + + if (async) { + m_thread = new AsyncFunc + (this, &LibEventHttpClient::sendImpl); + m_thread->start(); + } else { + sendImpl(); + } + return true; +} + +void LibEventHttpClient::sendImpl() { + SlowTimer timer(RuntimeOption::HttpSlowQueryThreshold, "evhttp", + m_url.c_str()); + event_base_dispatch(m_eventBase); + event_del(&m_eventTimeout); +} + +void LibEventHttpClient::onRequestCompleted() { + ASSERT(m_request); + ASSERT(m_request->input_buffer); + + // response code line + m_code = m_request->response_code; + if (m_request->response_code_line) { + m_codeLine = m_request->response_code_line; + } + + bool gzip = false; + // response headers + for (evkeyval *p = ((evkeyvalq_*)m_request->input_headers)->tqh_first; p; + p = p->next.tqe_next) { + if (p->key && p->value) { + if ((strcasecmp(p->key, "Content-Encoding") == 0) && + (strncmp(p->value, "gzip", 4) == 0) && + (!p->value[4] || isspace(p->value[4]))) { + // in the (illegal) case of multiple Content-Encoding headers, any one + // with the value 'gzip' means we treat it as gzip. + gzip = true; + } + m_responseHeaders.push_back(string(p->key) + ": " + p->value); + } + } + + // response body + m_len = EVBUFFER_LENGTH(m_request->input_buffer); + if (gzip) { + m_response = + gzdecode((const char*)EVBUFFER_DATA(m_request->input_buffer), m_len); + } else { + m_response = (char*)malloc(m_len + 1); + strncpy(m_response, (char*)EVBUFFER_DATA(m_request->input_buffer), m_len); + m_response[m_len] = '\0'; + } + + // libevent will call evhttp_request_free(m_request) automatically + m_request = NULL; + + event_base_loopbreak(m_eventBase); +} + +void LibEventHttpClient::onConnectionClosed() { + m_conn = NULL; + string hash = get_hash(m_address, m_port); + ServerStats::Log("evhttp.close", 1); + ServerStats::Log("evhttp.close." + hash, 1); +} + +char *LibEventHttpClient::recv(int &len) { + if (m_thread) { + m_thread->waitForEnd(); + delete m_thread; + m_thread = NULL; + } + + char *ret = m_response; + len = m_len; + m_response = NULL; + m_len = 0; + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/util/libevent_http_client.h b/src/cpp/base/util/libevent_http_client.h new file mode 100644 index 0000000000000..621e58abd65a1 --- /dev/null +++ b/src/cpp/base/util/libevent_http_client.h @@ -0,0 +1,119 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __LIBEVENT_HTTP_CLIENT_H__ +#define __LIBEVENT_HTTP_CLIENT_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Use evhttp as our HTTP client. This isn't the same as HttpClient that's CURL + * based. HttpClient supports SSL and follows redirections, whereas this class + * doesn't. But this class allows keep-alive connections to be pooled for + * repetitively HTTP requests. + */ +DECLARE_BOOST_TYPES(LibEventHttpClient); +class LibEventHttpClient { +public: + /** + * Specify an address:port to be cached. Set to 0 to clear it. + */ + static void SetCache(const std::string &address, int port, + int maxConnection); + + /** + * Get an http client for the specified URL. + */ + static LibEventHttpClientPtr Get(const std::string &address, int port); + +private: + static ReadWriteMutex ConnectionPoolMutex; + static std::map ConnectionPool; + + /** + * address:port => max connection to pool + */ + static std::map ConnectionPoolConfig; + + LibEventHttpClient(const std::string &address, int port); + +public: + ~LibEventHttpClient(); + + /** + * Done with this object, can release back to pool. Cannot access this object + * afterwards, without calling Get() again. + */ + void release(); + + /** + * Synchronously or asynchronously GET/POST an URL. + * If data is NULL, do GET, otherwise, do POST. + */ + bool send(const std::string &url, const std::vector &headers, + int timeoutSeconds, bool async, const void *data = NULL, + int size = 0); + + /** + * Block until last send() returns some data. Caller is in charge of free-ing + * returned char*. + */ + char *recv(int &len); + + int getCode() const { return m_code;} + const std::string &getCodeLine() const { return m_codeLine;} + const std::vector &getResponseHeaders() const { + return m_responseHeaders; + } + +public: + // libevent callbacks + void onRequestCompleted(); + void onConnectionClosed(); + +private: + bool m_busy; // telling connection pool this object is in use + std::string m_address; // server address + unsigned short m_port; // server port + + event_base *m_eventBase; // event base + evhttp_connection *m_conn; // evhttp connection object + evhttp_request *m_request; // evhttp request object + event m_eventTimeout; // for timeout purpose + + AsyncFunc *m_thread; // for async GET/POST + + std::string m_url; // most recent URL + int m_code; // response code + std::string m_codeLine; // human readable response code line + char *m_response; // final response buffer + int m_len; // final response length + std::vector m_responseHeaders; + + void sendImpl(); + void clear(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __LIBEVENT_HTTP_CLIENT_H__ diff --git a/src/cpp/base/util/light_process.cpp b/src/cpp/base/util/light_process.cpp new file mode 100644 index 0000000000000..b313c3c67619e --- /dev/null +++ b/src/cpp/base/util/light_process.cpp @@ -0,0 +1,545 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "light_process.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { + +/////////////////////////////////////////////////////////////////////////////// +// helper functions + +static const unsigned int BUFFER_SIZE = 4096; + +static void read_buf(FILE *fin, char *buf) { + fgets(buf, BUFFER_SIZE, fin); + // get rid of '\n' + buf[strlen(buf) - 1] = '\0'; +} + +static bool send_fd(int afdt_fd, int fd) { + afdt_error_t err; + int ret = afdt_send_fd_msg(afdt_fd, 0, 0, fd, &err); + return ret >= 0; +} + +static int recv_fd(int afdt_fd) { + int fd; + afdt_error_t err; + uint8_t afdt_buf[AFDT_MSGLEN]; + uint32_t afdt_len; + if (afdt_recv_fd_msg(afdt_fd, afdt_buf, &afdt_len, &fd, &err) < 0) { + return -1; + } + return fd; +} + +static char **build_envp(const vector &env) { + char **envp = NULL; + int size = env.size(); + if (size) { + envp = (char **)malloc((size + 1) * sizeof(char *)); + int j = 0; + for (unsigned int i = 0; i < env.size(); i++, j++) { + *(envp + j) = (char *)env[i].c_str(); + } + *(envp + j) = NULL; + } + return envp; +} + +static void close_fds(const vector &fds) { + for (unsigned int i = 0; i < fds.size(); i++) { + ::close(fds[i]); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// shadow process tasks + +static void do_popen(FILE *fin, FILE *fout, int afdt_fd) { + char buf[BUFFER_SIZE]; + + fgets(buf, BUFFER_SIZE, fin); + bool read_only = (buf[0] == 'r'); + + read_buf(fin, buf); + FILE *f = ::popen(buf, read_only ? "r" : "w"); + if (f == NULL) { + // no need to send the errno back, as the main process will try ::popen + fprintf(fout, "error\n"); + fflush(fout); + } else { + fprintf(fout, "success\n%lld\n", (int64)f); + fflush(fout); + int fd = fileno(f); + send_fd(afdt_fd, fd); + } +} + +static void do_pclose(FILE *fin, FILE *fout) { + char buf[BUFFER_SIZE]; + + int64 fptr; + read_buf(fin, buf); + sscanf(buf, "%lld", &fptr); + FILE *f = (FILE *)fptr; + int ret = ::pclose(f); + + fprintf(fout, "%d\n", ret); + if (ret < 0) { + fprintf(fout, "%d\n", errno); + } + fflush(fout); +} + +static void do_proc_open(FILE *fin, FILE *fout, int afdt_fd) { + char cmd[BUFFER_SIZE]; + read_buf(fin, cmd); + + char cwd[BUFFER_SIZE]; + read_buf(fin, cwd); + + char buf[BUFFER_SIZE]; + int env_size = 0; + vector env; + read_buf(fin, buf); + sscanf(buf, "%d", &env_size); + for (int i = 0; i < env_size; i++) { + read_buf(fin, buf); + env.push_back(buf); + } + + int pipe_size = 0; + read_buf(fin, buf); + sscanf(buf, "%d", &pipe_size); + vector pvals; + for (int i = 0; i < pipe_size; i++) { + int fd_value; + read_buf(fin, buf); + sscanf(buf, "%d", &fd_value); + pvals.push_back(fd_value); + } + + vector pkeys; + for (int i = 0; i < pipe_size; i++) { + int fd = recv_fd(afdt_fd); + if (fd < 0) { + fprintf(fout, "error\n%d\n", errno); + fflush(fout); + close_fds(pkeys); + return; + } + pkeys.push_back(fd); + } + + // now ready to start the child process + pid_t child = fork(); + if (child == 0) { + for (int i = 0; i < pipe_size; i++) { + dup2(pkeys[i], pvals[i]); + } + if (strlen(cwd) > 0) { + chdir(cwd); + } + if (!env.empty()) { + char **envp = build_envp(env); + execle("/bin/sh", "sh", "-c", cmd, NULL, envp); + free(envp); + } else { + execl("/bin/sh", "sh", "-c", cmd, NULL); + } + _exit(127); + } else if (child > 0) { + // successfully created the child process + fprintf(fout, "%lld\n", (int64)child); + fflush(fout); + } else { + // failed creating the child process + fprintf(fout, "error\n%d\n", errno); + fflush(fout); + } + + close_fds(pkeys); +} + +static void do_waitpid(FILE *fin, FILE *fout) { + char buf[BUFFER_SIZE]; + read_buf(fin, buf); + int64 p; + int options; + sscanf(buf, "%lld %d", &p, &options); + pid_t pid = (pid_t)p; + int stat; + pid_t ret = ::waitpid(pid, &stat, options); + fprintf(fout, "%lld %d\n", (int64)ret, stat); + if (ret < 0) { + fprintf(fout, "%d\n", errno); + } + fflush(fout); +} + +static void do_change_user(FILE *fin, FILE *fout) { + char uname[BUFFER_SIZE]; + read_buf(fin, uname); + struct passwd *pw = getpwnam(uname); + if (pw && pw->pw_uid) { + setuid(pw->pw_uid); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// light-weight process + +static vector g_procs; + +LightProcess::LightProcess() +: m_shadowProcess(0), m_fin(NULL), m_fout(NULL), m_afdt_fd(-1) { } + +LightProcess::~LightProcess() { +} + +void LightProcess::initialize() { + if (RuntimeOption::LightProcessFilePrefix.empty() || + RuntimeOption::LightProcessCount <= 0) { + return; + } + + if (available()) { + // already initialized + return; + } + + g_procs.resize(RuntimeOption::LightProcessCount); + + for (int i = 0; i < RuntimeOption::LightProcessCount; i++) { + if (!g_procs[i].initShadow(i)) { + for (int j = 0; j < i; j++) { + g_procs[j].closeShadow(); + } + g_procs.clear(); + break; + } + } +} + +bool LightProcess::initShadow(int id) { + Lock lock(m_procMutex); + + ostringstream os; + os << RuntimeOption::LightProcessFilePrefix << "." << getpid() << "." << id; + m_afdtFilename = os.str(); + + // remove the possible leftover + remove(m_afdtFilename.c_str()); + + afdt_error_t err; + int lfd = afdt_listen(m_afdtFilename.c_str(), &err); + if (lfd < 0) { + Logger::Warning("Unable to afdt_listen"); + return false; + } + + CPipe p1, p2; + if (!p1.open() || !p2.open()) { + Logger::Warning("Unable to create pipe: %d %s", errno, + Util::safe_strerror(errno).c_str()); + return false; + } + + pid_t child = fork(); + if (child == 0) { + // child + pid_t sid = setsid(); + if (sid < 0) { + Logger::Warning("Unable to setsid"); + exit(-1); + } + m_afdt_fd = + afdt_connect(m_afdtFilename.c_str(), &err); + if (m_afdt_fd < 0) { + Logger::Warning("Unable to afdt_connect"); + exit(-1); + } + int fd1 = p1.detachOut(); + int fd2 = p2.detachIn(); + p1.close(); + p2.close(); + runShadow(fd1, fd2); + } else if (child < 0) { + // failed + Logger::Warning("Unable to fork lightly: %d %s", errno, + Util::safe_strerror(errno).c_str()); + return false; + } else { + // parent + m_fin = fdopen(p2.detachOut(), "r"); + m_fout = fdopen(p1.detachIn(), "w"); + m_shadowProcess = child; + + sockaddr addr; + socklen_t addrlen; + m_afdt_fd = accept(lfd, &addr, &addrlen); + if (m_afdt_fd < 0) { + Logger::Warning("Unable to establish afdt connection"); + closeShadow(); + return false; + } + } + return true; +} + +void LightProcess::close() { + for (unsigned int i = 0; i < g_procs.size(); i++) { + g_procs[i].closeShadow(); + } + g_procs.clear(); +} + +void LightProcess::closeShadow() { + Lock lock(m_procMutex); + if (m_shadowProcess) { + fprintf(m_fout, "exit\n"); + fflush(m_fout); + fclose(m_fin); + fclose(m_fout); + // removes the "zombie" process, so not to interfere with later waits + ::waitpid(m_shadowProcess, NULL, 0); + } + if (!m_afdtFilename.empty()) { + remove(m_afdtFilename.c_str()); + } + if (m_afdt_fd >= 0) { + ::close(m_afdt_fd); + m_afdt_fd = -1; + } + m_shadowProcess = 0; +} + +bool LightProcess::available() { + return !g_procs.empty(); +} + +void LightProcess::runShadow(int fdin, int fdout) { + FILE *fin = fdopen(fdin, "r"); + FILE *fout = fdopen(fdout, "w"); + + char buf[BUFFER_SIZE]; + + pollfd pfd[1]; + pfd[0].fd = fdin; + pfd[0].events = POLLIN; + while (true) { + poll(pfd, 1, -1); + if (pfd[0].revents & POLLHUP) { + // no more command can come in + break; + } + else if (pfd[0].revents & POLLIN) { + fgets(buf, BUFFER_SIZE, fin); + if (strncmp(buf, "exit", 4) == 0) { + break; + } else if (strncmp(buf, "popen", 5) == 0) { + do_popen(fin, fout, m_afdt_fd); + } else if (strncmp(buf, "pclose", 6) == 0) { + do_pclose(fin, fout); + } else if (strncmp(buf, "proc_open", 9) == 0) { + do_proc_open(fin, fout, m_afdt_fd); + } else if (strncmp(buf, "waitpid", 7) == 0) { + do_waitpid(fin, fout); + } else if (strncmp(buf, "change_user", 11) == 0) { + do_change_user(fin, fout); + } + } + } + + fclose(fin); + fclose(fout); + ::close(m_afdt_fd); + remove(m_afdtFilename.c_str()); + exit(0); +} + +int LightProcess::getId() { + return (int)pthread_self() % g_procs.size(); +} + +FILE *LightProcess::popen(const char *cmd, const char *type) { + if (!available()) { + // fallback to normal popen + Logger::Verbose("Light-weight fork not available; " + "use the heavy one instead."); + return ::popen(cmd, type); + } + + int id = getId(); + Lock lock(g_procs[id].m_procMutex); + + fprintf(g_procs[id].m_fout, "popen\n%s\n%s\n", type, cmd); + fflush(g_procs[id].m_fout); + + char buf[BUFFER_SIZE]; + read_buf(g_procs[id].m_fin, buf); + if (strncmp(buf, "error", 5) == 0) { + Logger::Verbose("Light-weight fork failed; use the heavy one instead."); + return ::popen(cmd, type); + } + + int64 fptr; + read_buf(g_procs[id].m_fin, buf); + sscanf(buf, "%lld", &fptr); + int fd = recv_fd(g_procs[id].m_afdt_fd); + if (fd < 0) { + Logger::Verbose("Light-weight fork failed; use the heavy one instead."); + return ::popen(cmd, type); + } + FILE *f = fdopen(fd, type); + g_procs[id].m_popenMap[(int64)f] = fptr; + + return f; +} + +int LightProcess::pclose(FILE *f) { + if (!available()) { + return ::pclose(f); + } + + int id = getId(); + Lock lock(g_procs[id].m_procMutex); + + map::iterator it = g_procs[id].m_popenMap.find((int64)f); + if (it == g_procs[id].m_popenMap.end()) { + // try to close it with normal pclose + return ::pclose(f); + } + + g_procs[id].m_popenMap.erase((int64)f); + fclose(f); + fprintf(g_procs[id].m_fout, "pclose\n%lld\n", it->second); + fflush(g_procs[id].m_fout); + + char buf[BUFFER_SIZE]; + read_buf(g_procs[id].m_fin, buf); + int ret; + sscanf(buf, "%d", &ret); + if (ret < 0) { + read_buf(g_procs[id].m_fin, buf); + sscanf(buf, "%d", &errno); + } + return ret; +} + +pid_t LightProcess::proc_open(const char *cmd, const vector &created, + const vector &desired, + const char *cwd, const vector &env) { + int id = getId(); + Lock lock(g_procs[id].m_procMutex); + assert(available()); + assert(created.size() == desired.size()); + + fprintf(g_procs[id].m_fout, "proc_open\n%s\n%s\n", cmd, cwd); + fprintf(g_procs[id].m_fout, "%d\n", (int)env.size()); + for (unsigned int i = 0; i < env.size(); i++) { + fprintf(g_procs[id].m_fout, "%s\n", env[i].c_str()); + } + + fprintf(g_procs[id].m_fout, "%d\n", (int)created.size()); + + for (unsigned int i = 0; i < desired.size(); i++) { + fprintf(g_procs[id].m_fout, "%d\n", desired[i]); + } + fflush(g_procs[id].m_fout); + char buf[BUFFER_SIZE]; + for (unsigned int i = 0; i < created.size(); i++) { + if (!send_fd(g_procs[id].m_afdt_fd, created[i])) break; + } + + read_buf(g_procs[id].m_fin, buf); + if (strncmp(buf, "error", 5) == 0) { + read_buf(g_procs[id].m_fin, buf); + sscanf(buf, "%d", &errno); + return -1; + } + int64 pid; + sscanf(buf, "%lld", &pid); + return (pid_t)pid; +} + +pid_t LightProcess::waitpid(pid_t pid, int *stat_loc, int options) { + if (!available()) { + // light process is not really there + return ::waitpid(pid, stat_loc, options); + } + + int id = getId(); + Lock lock(g_procs[id].m_procMutex); + + fprintf(g_procs[id].m_fout, "waitpid\n%lld %d\n", (int64)pid, options); + fflush(g_procs[id].m_fout); + + char buf[BUFFER_SIZE]; + read_buf(g_procs[id].m_fin, buf); + int64 ret; + int stat; + sscanf(buf, "%lld %d", &ret, &stat); + *stat_loc = stat; + if (ret < 0) { + read_buf(g_procs[id].m_fin, buf); + sscanf(buf, "%d", &errno); + } + return (pid_t)ret; +} + +pid_t LightProcess::pcntl_waitpid(pid_t pid, int *stat_loc, int options) { + if (!available()) { + return ::waitpid(pid, stat_loc, options); + } + + int id = getId(); + Lock lock(g_procs[id].m_procMutex); + + pid_t p = ::waitpid(pid, stat_loc, options); + if (p == g_procs[id].m_shadowProcess) { + // got the shadow process, wait again + p = ::waitpid(pid, stat_loc, options); + } + + return p; +} + +void LightProcess::change_user(const string &username) { + if (username.empty()) return; + for (unsigned i = 0; i < g_procs.size(); i++) { + Lock lock(g_procs[i].m_procMutex); + fprintf(g_procs[i].m_fout, "change_user\n%s\n", username.c_str()); + fflush(g_procs[i].m_fout); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/util/light_process.h b/src/cpp/base/util/light_process.h new file mode 100644 index 0000000000000..2b0f180cb6e6b --- /dev/null +++ b/src/cpp/base/util/light_process.h @@ -0,0 +1,80 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __LIGHT_PROCESS_H__ +#define __LIGHT_PROCESS_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// light-weight process + +class LightProcess { +public: + LightProcess(); + ~LightProcess(); + + static void close(); + static bool available(); + static void initialize(); + static FILE *popen(const char *cmd, const char *type); + static int pclose(FILE *f); + + /** + * Opens a process with given cwd and environment variables. + * + * The parameters "created" and "desired" describe the pipes that need to + * be setup for the child process: "created" contains created fd for child, + * and "desired" contains desired fd in child. + * + * The parameter env contains strings of the form =. + */ + static pid_t proc_open(const char *cmd, const std::vector &created, + const std::vector &desired, + const char *cwd, const std::vector &env); + + /** + * The main process is not the (direct) parent of the worker process, + * and therefore it has to delegate to the shadow process to do waitpid. + */ + static pid_t waitpid(pid_t pid, int *stat_loc, int options); + + static pid_t pcntl_waitpid(pid_t pid, int *stat_loc, int options); + + static void change_user(const std::string &username); + +private: + static int getId(); + bool initShadow(int id); + void runShadow(int fdin, int fdout); + void closeShadow(); + + pid_t m_shadowProcess; + FILE *m_fin; // the pipe to read from the child + FILE *m_fout; // the pipe to write to the child + Mutex m_procMutex; + std::string m_afdtFilename; + int m_afdt_fd; + std::map m_popenMap; +}; + +} + +#endif // __LIGHT_PROCESS_H__ diff --git a/src/cpp/base/util/request_local.h b/src/cpp/base/util/request_local.h new file mode 100644 index 0000000000000..545bcd29d511e --- /dev/null +++ b/src/cpp/base/util/request_local.h @@ -0,0 +1,72 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_REQUEST_LOCAL_H__ +#define __HPHP_REQUEST_LOCAL_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * A RequestLocal is automatically thread local, plus it has two handlers + * to do extra work on request init and shutdown times. T needs to derive from + * RequestEventHandler, so it will register itself with execution engines to + * be called at request shutdown time. + * + * Example: + * + * class MyRequestLocalClass : public RequestEventHandler { + * public: + * virtual void requestInit() {...} + * virtual void requestShutdown() {...} + * }; + * static RequestLocal s_data; + */ +template +class RequestLocal { +public: + RequestLocal() { + } + + T *operator->() const { return get();} + T &operator*() const { return *get();} + + T *get() const { + T *obj = m_tlsObjects.get(); + if (!obj->getInited()) { + obj->requestInit(); + obj->setInited(true); + + // this registration makes sure obj->requestShutdown() will be called + g_context->registerRequestEventHandler(obj); + } + return obj; + } + + void reset() { + m_tlsObjects.reset(); + } + +private: + ThreadLocal m_tlsObjects; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_REQUEST_LOCAL_H__ diff --git a/src/cpp/base/util/smart_object.h b/src/cpp/base/util/smart_object.h new file mode 100644 index 0000000000000..6604f5e998d5b --- /dev/null +++ b/src/cpp/base/util/smart_object.h @@ -0,0 +1,111 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SMART_OBJECT_H__ +#define __HPHP_SMART_OBJECT_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * We need a wrapper to manage lifetime of user-defined object's pointers. + * This template wraps around any user-defined class to allow direct property + * and method access like this, + * + * SmartObject obj; + * obj->method(obj->property); + * + * Note that Object class doesn't do this. Therefore we need SmartPtr right + * on a user-defined class. SmartObject is the same as SmartPtr with + * extra object specific functions. + * + * Since we can't really make every place to take SmartObject, we need to + * be able to cast SmartObject to Object as a generic fallback. With Object, + * invoking methods and accessing properties will be hash-table based, so it's + * slower. This is why when a function is written for objects, Object can be + * used as a parameter's type, but if it can be specialized to SmartObject, + * it will almost always be better. + */ +template +class SmartObject : public SmartPtr { + public: + /** + * Constructors + */ + SmartObject() { } + SmartObject(Variant v) { SmartPtr::operator=(v.toObject());} + SmartObject(T *data) { SmartPtr::operator=(data);} + template + SmartObject(Y *data) { SmartPtr::operator=(data);} + template + SmartObject(const SmartPtr &data) { SmartPtr::operator=(data);} + SmartObject(Object obj) { SmartPtr::operator=(obj);} + + bool instanceof(const char *s) { + return SmartPtr::m_px && SmartPtr::m_px->o_instanceof(s); + } + + /** + * Assignment + */ + SmartObject &operator=(CVarRef v) { + SmartPtr::operator=(v.toObject()); + return *this; + } + SmartObject &operator=(const SmartPtr &src) { + SmartPtr::operator=(src); + return *this; + } + SmartObject &operator=(T *src) { + SmartPtr::operator=(src); + return *this; + } + template + SmartObject &operator=(const SmartPtr &src) { + SmartPtr::operator=(src); + return *this; + } + + /** + * Conversions + */ + operator Object() const { return SmartPtr::m_px;} + + template + operator SmartObject() { + return static_cast(SmartPtr::m_px); + } + + /** + * r-value and l-value of object properties. + */ + Variant o_get(CStrRef propName, int64 hash) const { + if (SmartPtr::m_px == NULL) return null; + return SmartPtr::m_px->o_get(propName, hash); + } + ObjectOffset o_lval(CStrRef propName, int64 hash) { + return ObjectOffset(SmartPtr::m_px, propName, hash); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_SMART_OBJET_H__ diff --git a/src/cpp/base/util/smart_ptr.h b/src/cpp/base/util/smart_ptr.h new file mode 100644 index 0000000000000..654592d7d9497 --- /dev/null +++ b/src/cpp/base/util/smart_ptr.h @@ -0,0 +1,122 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SMART_PTR_H__ +#define __HPHP_SMART_PTR_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Work with Countable to implement reference counting. For example, + * + * class MyClassData : public Countable { + * // now MyClassData has a counter to keep track of references + * }; + * + * class MyClass : public SmartPtr { + * // now MyClassData becomes an inner pointer that's managed by SmartPtr + * }; + */ +template +class SmartPtr { +public: + /** + * C++ code is always generated with 2-phase object creations by declaring + * a smart pointer first, then assigning with a new-ed object raw pointer. + */ + SmartPtr() : m_px(NULL) {} + + SmartPtr(T *px) : m_px(px) { if (m_px) m_px->incRefCount();} + template + SmartPtr(Y *px) : m_px(px) { if (m_px) m_px->incRefCount();} + + /** + * Copy constructor. + */ + SmartPtr(const SmartPtr &src) : m_px(NULL) { + operator=(src.m_px); + } + template + SmartPtr(const SmartPtr &src) : m_px(NULL) { + operator=(src.get()); + } + + /** + * If I'm the last one who holds a reference to the object, destroy it. + */ + ~SmartPtr() { + if (m_px && m_px->decRefCount() == 0) { + m_px->release(); + } + } + + /** + * Assignments. + */ + SmartPtr &operator=(const SmartPtr &src) { + return operator=(src.m_px); + } + template + SmartPtr &operator=(const SmartPtr &src) { + return operator=(src.get()); + } + template + SmartPtr &operator=(Y *px) { + if (m_px != px) { + if (m_px && m_px->decRefCount() == 0) { + m_px->release(); + } + m_px = dynamic_cast(px); + if (m_px) m_px->incRefCount(); + } + return *this; + } + + /** + * Magic delegation. + */ + T *operator->() const { + if (!m_px) throw NullPointerException(); + return m_px; + } + + /** + * Get the raw pointer. + */ + T *get() const { + return m_px; + } + + /** + * Reset the raw pointer. + */ + void reset() { + operator=((T*)NULL); + } + + protected: + T *m_px; // raw pointer +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_SMART_PTR_H__ diff --git a/src/cpp/base/util/string_buffer.cpp b/src/cpp/base/util/string_buffer.cpp new file mode 100644 index 0000000000000..cabe7a30a7e4e --- /dev/null +++ b/src/cpp/base/util/string_buffer.cpp @@ -0,0 +1,217 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +StringBuffer::StringBuffer(int initialSize /* = 256 */) + : m_size(initialSize), m_pos(0) { + ASSERT(initialSize > 0); + m_buffer = (char *)malloc(initialSize + 1); +} + +StringBuffer::StringBuffer(const char *filename) + : m_buffer(NULL), m_size(0), m_pos(0) { + struct stat sb; + if (stat(filename, &sb) == 0) { + m_size = sb.st_size; + m_buffer = (char *)malloc(m_size + 1); + + FILE *f = fopen(filename, "r"); + if (f) { + while (m_pos < m_size) { + int buffer_size = m_size - m_pos; + int len = fread(m_buffer + m_pos, 1, buffer_size, f); + if (len == 0) break; + m_pos += len; + } + fclose(f); + } + } +} + +StringBuffer::StringBuffer(char *data, int len) + : m_buffer(data), m_size(len), m_pos(len) { +} + +StringBuffer::~StringBuffer() { + if (m_buffer) { + free(m_buffer); + } +} + +const char *StringBuffer::data() { + ASSERT(m_buffer); + + if (m_pos) { + m_buffer[m_pos] = '\0'; // fixup + return m_buffer; + } + return NULL; +} + +char StringBuffer::charAt(int pos) const { + ASSERT(pos >= 0 && pos < m_pos); + return m_buffer[pos]; +} + +char *StringBuffer::detach(int &size) { + ASSERT(m_buffer); + + if (m_pos) { + m_buffer[m_pos] = '\0'; // fixup + size = m_pos; + char *ret = m_buffer; + m_buffer = NULL; + m_pos = 0; + return ret; + } + + size = 0; + return NULL; +} + +String StringBuffer::detach() { + ASSERT(m_buffer); + + if (m_pos) { + m_buffer[m_pos] = '\0'; // fixup + String ret(m_buffer, m_pos, AttachString); + m_buffer = NULL; + m_pos = 0; + return ret; + } + return String(""); +} + +void StringBuffer::reset() { + if (m_buffer == NULL) { + m_buffer = (char *)malloc(m_size + 1); + } + m_pos = 0; +} + +void StringBuffer::resize(int size) { + ASSERT(size >= 0 && size < m_size); + m_pos = size; +} + +char *StringBuffer::reserve(int size) { + if (m_size < m_pos + size) { + m_size = m_pos + size; + if (m_buffer == NULL) { + m_buffer = (char *)malloc(m_size + 1); + } else { + m_buffer = (char *)realloc(m_buffer, m_size + 1); + } + } + return m_buffer + m_pos; +} + +void StringBuffer::append(int n) { + char buf[12]; + snprintf(buf, sizeof(buf), "%d", n); + append(buf); +} + +void StringBuffer::append(char ch) { + ASSERT(m_buffer); + + if (m_pos + 1 > m_size) { + grow(m_pos + 1); + } + m_buffer[m_pos++] = ch; +} + +void StringBuffer::append(const char *s, int len) { + ASSERT(m_buffer); + + ASSERT(s); + ASSERT(len >= 0); + if (len <= 0) return; + + if (m_pos + len > m_size) { + grow(m_pos + len); + } + memcpy(m_buffer + m_pos, s, len); + m_pos += len; +} + +void StringBuffer::printf(const char *format, ...) { + va_list ap; + va_start(ap, format); + + bool printed = false; + for (int len = 1024; !printed; len <<= 1) { + va_list v; + va_copy(v, ap); + + char *buf = (char*)malloc(len); + if (vsnprintf(buf, len, format, v) < len) { + append(buf); + printed = true; + } + free(buf); + + va_end(v); + } + + va_end(ap); +} + +void StringBuffer::read(FILE* in, int page_size /* = 1024 */) { + ASSERT(in); + ASSERT(page_size > 0); + + while (true) { + int buffer_size = m_size - m_pos; + if (buffer_size < page_size) { + grow(m_pos + page_size); + buffer_size = m_size - m_pos; + } + int len = fread(m_buffer + m_pos, 1, buffer_size, in); + if (len == 0) break; + m_pos += len; + } +} + +void StringBuffer::read(File* in, int page_size /* = 1024 */) { + ASSERT(in); + ASSERT(page_size > 0); + + while (true) { + int buffer_size = m_size - m_pos; + if (buffer_size < page_size) { + grow(m_pos + page_size); + buffer_size = m_size - m_pos; + } + int len = in->readImpl(m_buffer + m_pos, buffer_size); + if (len == 0) break; + m_pos += len; + } +} + +void StringBuffer::grow(int minSize) { + m_size <<= 1; + if (m_size < minSize) m_size = minSize; + m_buffer = (char *)realloc(m_buffer, m_size + 1); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/util/string_buffer.h b/src/cpp/base/util/string_buffer.h new file mode 100644 index 0000000000000..0b9f8d87c54d8 --- /dev/null +++ b/src/cpp/base/util/string_buffer.h @@ -0,0 +1,109 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_STRING_BUFFER_H__ +#define __HPHP_STRING_BUFFER_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class File; + +/** + * Efficient string concatenation. + */ +DECLARE_BOOST_TYPES(StringBuffer); +class StringBuffer { +public: + /** + * Constructing a string buffer with some initial size, subsequent allocation + * will double existing size every round. + */ + StringBuffer(int initialSize = 256); + StringBuffer(const char *filename); + StringBuffer(char *data, int len); // attaching + ~StringBuffer(); + + bool valid() const { return m_buffer != NULL;} + bool empty() const { return m_pos == 0;} + int size() const { return m_pos;} + int length() const { return m_pos;} + const char *data(); + char charAt(int pos) const; + + /** + * Detach buffer and yield a String. After this, do not use this StringBuffer + * object any more. + */ + char *detach(int &size); + String detach(); + operator String() { return detach();} + void reset(); + void clear() { reset();} + void resize(int size); + + /** + * Increase internal buffer to at least "size" longer, and return the write + * position to append more chars. + */ + char *reserve(int size); + + /** + * Append strings. + */ + void append(int n); + void append(char c); + void append(unsigned char c) { append((char)c);} + void append(litstr s) { ASSERT(s); append(s, strlen(s));} + void append(CStrRef s) { append(s.data(), s.size());} + void append(const char *s, int len); + void append(const std::string &s) { append(s.data(), s.size());} + StringBuffer &operator+=(int n) { append(n); return *this;} + StringBuffer &operator+=(char c) { append(c); return *this;} + StringBuffer &operator+=(litstr s) { append(s); return *this;} + StringBuffer &operator+=(CStrRef s) { append(s); return *this;} + + /** + * Write data. + */ + void printf(const char *format, ...); + + /** + * Read a file into this buffer. Use a larger page size to read more bytes + * a time for large files. + */ + void read(FILE *in, int page_size = 1024); + void read(File *in, int page_size = 1024); + +private: + // disabling copy constructor and assignment + StringBuffer(const StringBuffer &sb) { ASSERT(false);} + StringBuffer &operator=(const StringBuffer &sb) {ASSERT(false);return *this;} + + char *m_buffer; + int m_size; + int m_pos; + + void grow(int minSize); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_STRING_BUFFER_H__ diff --git a/src/cpp/base/variable_serializer.cpp b/src/cpp/base/variable_serializer.cpp new file mode 100644 index 0000000000000..1f6ec20c4bd23 --- /dev/null +++ b/src/cpp/base/variable_serializer.cpp @@ -0,0 +1,658 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +VariableSerializer::VariableSerializer(Type type, int option /* = 0 */) + : m_type(type), m_option(option), m_out(NULL), m_indent(0), + m_valueCount(0), m_referenced(false), m_refCount(1), m_maxCount(3) { +} + +void VariableSerializer::setObjectInfo(const char *objClass, int objId) { + m_objClass = objClass; + m_objId = objId; +} + +void VariableSerializer::getResourceInfo(std::string &rsrcName, int &rsrcId) { + rsrcName = m_rsrcName; + rsrcId = m_rsrcId; +} + +void VariableSerializer::setResourceInfo(const char *rsrcName, int rsrcId) { + m_rsrcName = rsrcName; + m_rsrcId = rsrcId; +} + +Variant VariableSerializer::serialize(CVarRef v, bool ret) { + std::ostringstream oss; + if (ret) { + m_out = &oss; + } else { + m_out = &g_context->out(); + } + m_valueCount = 1; + if (m_type == VarDump && v.isContagious()) *m_out << '&'; + write(v); + if (ret) { + return String(oss.str()); // TODO: fix this one extra string copy here + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +void VariableSerializer::write(bool v) { + switch (m_type) { + case PrintR: + if (v) *m_out << 1; + break; + case VarExport: + case JSON: + *m_out << (v ? "true" : "false"); + break; + case VarDump: + case DebugDump: + indent(); + *m_out << (v ? "bool(true)" : "bool(false)"); + writeRefCount(); + *m_out << '\n'; + break; + case Serialize: + *m_out << "b:" << (v ? 1 : 0) << ';'; + break; + default: + ASSERT(false); + break; + } +} + +void VariableSerializer::write(int64 v) { + switch (m_type) { + case PrintR: + case VarExport: + case JSON: + *m_out << v; + break; + case VarDump: + indent(); + *m_out << "int(" << v << ")\n"; + break; + case DebugDump: + indent(); + *m_out << "long(" << v << ')'; + writeRefCount(); + *m_out << '\n'; + break; + case Serialize: + *m_out << "i:" << v << ';'; + break; + default: + ASSERT(false); + break; + } +} + +void VariableSerializer::write(double v) { + switch (m_type) { + case JSON: + if (!isinf(v) && !isnan(v)) { + char *buf; + if (v == 0.0) v = 0.0; // so to avoid "-0" output + vspprintf(&buf, 0, "%.*k", 14, v); + *m_out << buf; + free(buf); + } else { + // PHP issues a warning: double INF/NAN does not conform to the + // JSON spec, encoded as 0. + *m_out << '0'; + } + break; + case VarExport: + case PrintR: + { + char *buf; + if (v == 0.0) v = 0.0; // so to avoid "-0" output + vspprintf(&buf, 0, "%.*G", 14, v); + *m_out << buf; + free(buf); + } + break; + case VarDump: + case DebugDump: + { + char *buf; + if (v == 0.0) v = 0.0; // so to avoid "-0" output + vspprintf(&buf, 0, "float(%.*G)", 14, v); + indent(); + *m_out << buf; + free(buf); + writeRefCount(); + *m_out << '\n'; + } + break; + case Serialize: + *m_out << "d:"; + if (isnan(v)) { + *m_out << "NAN"; + } else if (isinf(v)) { + *m_out << "INF"; + } else { + char *buf; + if (v == 0.0) v = 0.0; // so to avoid "-0" output + vspprintf(&buf, 0, "%.*G", 14, v); + *m_out << buf; + free(buf); + } + *m_out << ';'; + break; + default: + ASSERT(false); + break; + } +} + +void VariableSerializer::write(litstr v, int len /* = -1 */, + bool isArrayKey /* = false */) { + switch (m_type) { + case PrintR: { + if (len < 0) len = strlen(v); + const char *p = v; + for (int i = 0; i < len; i++) { + *m_out << *p++; + } + break; + } + case VarExport: { + if (len < 0) len = strlen(v); + *m_out << '\''; + const char *p = v; + for (int i = 0; i < len; i++, p++) { + const char c = *p; + // adapted from Zend php_var_export and php_addcslashes + if (c == '\'' || c == '\\' || (!isArrayKey && c == '\0')) { + if ((unsigned char) c < 32 || (unsigned char) c > 126) { + *m_out << '\\'; + char buffer[4]; + sprintf(buffer, "%03o", (unsigned char)c); + *m_out << buffer; + continue; + } else { + *m_out << '\\'; + } + } + *m_out << c; + } + *m_out << '\''; + break; + } + case VarDump: + case DebugDump: { + if (v == NULL) v = ""; + if (len < 0) len = strlen(v); + indent(); + *m_out << "string(" << len << ") \""; + const char *p = v; + for (int i = 0; i < len; i++) { + *m_out << *p++; + } + *m_out << '"'; + writeRefCount(); + *m_out << '\n'; + break; + } + case Serialize: + if (len < 0) { + len = strlen(v); + *m_out << "s:" << len << ":\"" << v << "\";"; + } else { + *m_out << "s:" << len << ":\""; + const char *p = v; + for (int i = 0; i < len; i++) { + *m_out << *p++; + } + *m_out << "\";"; + } + break; + case JSON: + { + if (len < 0) len = strlen(v); + char *escaped = string_json_escape(v, len, m_option); + *m_out << escaped; + free(escaped); + } + break; + default: + ASSERT(false); + break; + } +} + +void VariableSerializer::write(CStrRef v) { + v.serialize(this); +} + +void VariableSerializer::write(CArrRef v) { + v.serialize(this); +} + +void VariableSerializer::write(CObjRef v) { + v.serialize(this); +} + +void VariableSerializer::write(CVarRef v, bool isArrayKey /* = false */) { + setReferenced(v.isReferenced()); + setRefCount(v.getRefCount()); + v.serialize(this, isArrayKey); +} + +void VariableSerializer::writeNull() { + switch (m_type) { + case PrintR: + // do nothing + break; + case VarExport: + *m_out << "NULL"; + break; + case VarDump: + case DebugDump: + indent(); + *m_out << "NULL"; + writeRefCount(); + *m_out << '\n'; + break; + case Serialize: + *m_out << "N;"; + break; + case JSON: + *m_out << "null"; + break; + default: + ASSERT(false); + break; + } +} + +void VariableSerializer::writeOverflow(void* ptr, bool isObject /* = false */) { + bool wasRef = m_referenced; + setReferenced(false); + switch (m_type) { + case PrintR: + *m_out << "*RECURSION*"; + break; + case VarExport: + throw NestingLevelTooDeepException(); + case VarDump: + case DebugDump: + indent(); + *m_out << "*RECURSION*\n"; + break; + case Serialize: + { + map::const_iterator iter = m_arrayIds.find(ptr); + ASSERT(iter != m_arrayIds.end()); + int id = iter->second; + if (isObject) { + *m_out << "r:" << id << ";"; + } else if (wasRef) { + *m_out << "R:" << id << ";"; + } else { + *m_out << "N;"; + } + } + break; + case JSON: + *m_out << "null"; + break; + default: + ASSERT(false); + break; + } +} + +void VariableSerializer::writeRefCount() { + if (m_type == DebugDump) { + *m_out << " refcount(" << m_refCount << ')'; + m_refCount = 1; + } +} + +void VariableSerializer::writeArrayHeader(const ArrayData *arr, int size) { + m_arrayInfos.resize(m_arrayInfos.size() + 1); + ArrayInfo &info = m_arrayInfos.back(); + info.first_element = true; + info.is_vector = m_objClass.empty() && arr->isVectorData(); + info.indent_delta = 0; + + switch (m_type) { + case PrintR: + if (!m_objClass.empty()) { + *m_out << m_objClass << " Object\n"; + } else { + *m_out << "Array\n"; + } + if (m_indent > 0) { + m_indent += 4; + indent(); + } + *m_out << "(\n"; + m_indent += (info.indent_delta = 4); + break; + case VarExport: + if (m_indent > 0) { + *m_out << '\n'; + indent(); + } + if (!m_objClass.empty()) { + *m_out << m_objClass << "::__set_state(array(\n"; + } else { + *m_out << "array (\n"; + } + m_indent += (info.indent_delta = 2); + break; + case VarDump: + case DebugDump: + indent(); + if (!m_rsrcName.empty()) { + *m_out << "resource(" << m_rsrcId << ") of type (" << m_rsrcName << ")\n"; + break; + } else if (!m_objClass.empty()) { + *m_out << "object(" << m_objClass << ")#" << m_objId << " "; + } else { + *m_out << "array"; + } + *m_out << "(" << size << ")"; + + // ...so to strictly follow PHP's output + if (m_type == VarDump) { + *m_out << " "; + } else { + writeRefCount(); + } + + *m_out << "{\n"; + m_indent += (info.indent_delta = 2); + break; + case Serialize: + if (!m_objClass.empty()) { + *m_out << "O:" << m_objClass.size() << ":\"" << m_objClass << "\":" + << size << ":{"; + } else { + *m_out << "a:" << size << ":{"; + } + break; + case JSON: + if (info.is_vector) { + *m_out << "["; + } else { + *m_out << "{"; + } + break; + default: + ASSERT(false); + break; + } + + // ...so we don't mess up next array output + if (!m_objClass.empty() || !m_rsrcName.empty()) { + if (!m_objClass.empty()) { + info.class_info = ClassInfo::FindClass(m_objClass.c_str()); + } + m_objClass.clear(); + info.is_object = true; + } else { + info.is_object = false; + } +} + +void VariableSerializer::writePropertyPrivacy(const char *prop, + const ClassInfo *cls) { + if (!cls) return; + ClassInfo::PropertyInfo *p = cls->getPropertyInfo(prop); + while (!p && cls && cls->getParentClass()) { + cls = ClassInfo::FindClass(cls->getParentClass()); + if (cls) p = cls->getPropertyInfo(prop); + } + if (!p) return; + ClassInfo::Attribute a = p->attribute; + if (a & ClassInfo::IsProtected) { + *m_out << ":protected"; + } else if (a & ClassInfo::IsPrivate) { + *m_out << ":private"; + } +} + +void VariableSerializer::writeSerializedProperty(CStrRef prop, + const ClassInfo *cls) { + String res = prop; + if (cls) { + ClassInfo::PropertyInfo *p = cls->getPropertyInfo(prop.c_str()); + // Try to find defining class + while (!p && cls && cls->getParentClass()) { + cls = ClassInfo::FindClass(cls->getParentClass()); + if (cls) p = cls->getPropertyInfo(prop); + } + if (p) { + const ClassInfo *dcls = p->owner; + ClassInfo::Attribute a = p->attribute; + if (a & ClassInfo::IsProtected) { + res = String("\0*\0", 3, AttachLiteral) + prop; + } else if (a & ClassInfo::IsPrivate) { + const char *clsname = dcls->getName(); + int clsLen = strlen(clsname); + int headerLen = clsLen + 2; + int totalLen = headerLen + prop.size() + 1; + char *buf = (char*)malloc(totalLen); + buf[0] = '\0'; + memcpy(buf + 1, clsname, clsLen); + buf[clsLen + 1] = '\0'; + memcpy(buf + headerLen, prop.c_str(), prop.size()); + buf[totalLen - 1] = '\0'; + res = String(buf, totalLen - 1, AttachString); + } + } + } + write(res); +} + +void VariableSerializer::writeArrayKey(const ArrayData *arr, CVarRef key) { + ArrayInfo &info = m_arrayInfos.back(); + + switch (m_type) { + case PrintR: { + indent(); + *m_out << '['; + String keyStr = key.toString(); + const char *p = keyStr; + int len = keyStr.length(); + for (int i = 0; i < len; i++) { + *m_out << *p++; + } + if (info.is_object) writePropertyPrivacy(keyStr.c_str(), info.class_info); + *m_out << "] => "; + break; + } + case VarExport: + indent(); + write(key, true); + *m_out << " => "; + break; + case VarDump: + case DebugDump: + indent(); + if (key.isNumeric()) { + *m_out << '[' << (const char *)key.toString() << "]=>\n"; + } else { + *m_out << "[\""; + String keyStr = key.toString(); + const char *p = keyStr; + int len = keyStr.length(); + for (int i = 0; i < len; i++) { + *m_out << *p++; + } + if (info.is_object) writePropertyPrivacy(keyStr.c_str(), info.class_info); + *m_out << "\"]=>\n"; + } + break; + case Serialize: + if (info.is_object) { + writeSerializedProperty(key.toString(), info.class_info); + } else { + write(key); + } + break; + case JSON: + if (!info.first_element) { + *m_out << ","; + } + if (!info.is_vector) { + write(key.toString()); + *m_out << ":"; + } + break; + default: + ASSERT(false); + break; + } +} + +void VariableSerializer::writeArrayValue(const ArrayData *arr, CVarRef value) { + // Do not count referenced values after the first + if (m_type == Serialize && + !(value.isReferenced() && + m_arrayIds.find(value.getVariantData()) != m_arrayIds.end())) + m_valueCount++; + + write(value); + switch (m_type) { + case PrintR: + *m_out << '\n'; + break; + case VarExport: + *m_out << ",\n"; + break; + default: + break; + } + + ArrayInfo &info = m_arrayInfos.back(); + info.first_element = false; +} + +void VariableSerializer::writeArrayFooter(const ArrayData *arr) { + ArrayInfo &info = m_arrayInfos.back(); + + m_indent -= info.indent_delta; + switch (m_type) { + case PrintR: + indent(); + *m_out << ")\n"; + if (m_indent > 0) { + m_indent -= 4; + } + break; + case VarExport: + indent(); + if (info.is_object) { + *m_out << "))"; + } else { + *m_out << ')'; + } + break; + case VarDump: + case DebugDump: + if (m_rsrcName.empty()) { + indent(); + *m_out << "}\n"; + } + break; + case Serialize: + *m_out << '}'; + break; + case JSON: + if (info.is_vector) { + *m_out << "]"; + } else { + *m_out << "}"; + } + break; + default: + ASSERT(false); + break; + } + + m_arrayInfos.pop_back(); +} + +void VariableSerializer::indent() { + + for (int i = 0; i < m_indent; i++) { + *m_out << ' '; + } + if (m_referenced) { + if (m_indent > 0) *m_out << '&'; + m_referenced = false; + } +} + + bool VariableSerializer::incNestedLevel(void *ptr, + bool isObject /* = false */) { + switch (m_type) { + case VarExport: + break; + case PrintR: + case VarDump: + case DebugDump: + return ++m_counts[ptr] >= m_maxCount; + case Serialize: + { + int ct = ++m_counts[ptr]; + if (m_arrayIds.find(ptr) != m_arrayIds.end() && + (m_referenced || isObject)) { + return true; + } else { + m_arrayIds[ptr] = m_valueCount; + } + return ct >= (m_maxCount - 1); + } + break; + case JSON: + return ++m_counts[ptr] >= m_maxCount; + default: + ASSERT(false); + break; + } + return false; +} + +void VariableSerializer::decNestedLevel(void *ptr) { + --m_counts[ptr]; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/variable_serializer.h b/src/cpp/base/variable_serializer.h new file mode 100644 index 0000000000000..87423ef166ea3 --- /dev/null +++ b/src/cpp/base/variable_serializer.h @@ -0,0 +1,127 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_VARIABLE_SERIALIZER_H__ +#define __HPHP_VARIABLE_SERIALIZER_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +class ClassInfo; + +/** + * Maintaining states during serialization of a variable. We use this single + * class to uniformly serialize variables according to different formats: + * print_r(), var_export(), var_dump(), debug_zval_dump() or serialize(). + */ +class VariableSerializer { +public: + /** + * Supported formats. + */ + enum Type { + PrintR, + VarExport, + VarDump, + DebugDump, + Serialize, + JSON, + }; + + /** + * Constructor. + */ + VariableSerializer(Type type, int option = 0); + + /** + * Top level entry function called by f_ functions. + */ + Variant serialize(CVarRef v, bool ret); + + /** + * Type specialized output functions. + */ + void write(bool v); + void write(char v) { write((int64)v);} + void write(short v) { write((int64)v);} + void write(int v) { write((int64)v);} + void write(int64 v); + void write(double v); + void write(litstr v, int len = -1, bool isArrayKey = false); + void write(CStrRef v); + void write(CArrRef v); + void write(CObjRef v); + void write(CVarRef v, bool isArrayKey = false); + + void writeNull(); + // what to write if recursive level is over limit? + void writeOverflow(void* ptr, bool isObject = false); + void writeRefCount(); // for DebugDump only + + void writeArrayHeader(const ArrayData *arr, int size); + void writeArrayKey(const ArrayData *arr, CVarRef key); + void writeArrayValue(const ArrayData *arr, CVarRef value); + void writeArrayFooter(const ArrayData *arr); + + /** + * Helpers. + */ + void indent(); + void setReferenced(bool referenced) { m_referenced = referenced;} + void setRefCount(int count) { m_refCount = count;} + void incMaxCount() { m_maxCount++; } + bool incNestedLevel(void *ptr, bool isObject = false); + void decNestedLevel(void *ptr); + void setObjectInfo(const char *objClass, int objId); + void setResourceInfo(const char *rsrcName, int rsrcId); + void getResourceInfo(std::string &rsrcName, int &rsrcId); + Type getType() const { return m_type; } +private: + Type m_type; + int m_option; // type specific extra options + std::ostream *m_out; + int m_indent; + std::map m_counts; // counting seen arrays for recursive levels + std::map m_arrayIds; // reference ids for objs/arrays + int m_valueCount; // Current ref index + bool m_referenced; // mark current array element as reference + int m_refCount; // current variable's reference count + std::string m_objClass; // for object serialization + std::string m_rsrcName; // for resource serialization + int m_objId; // for object serialization + int m_rsrcId; // for resource serialization + int m_maxCount; // for max recursive levels + + struct ArrayInfo { + const ClassInfo *class_info; // The class info if an object + bool is_object; // nested arrays or objects + bool is_vector; // whether current array is a vector + bool first_element; // whether this is first array element + int indent_delta; // the extra indent to serialize this object + }; + std::vector m_arrayInfos; + + void writePropertyPrivacy(const char *prop, const ClassInfo *cls); + void writeSerializedProperty(CStrRef prop, const ClassInfo *cls); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_VARIABLE_SERIALIZER_H__ diff --git a/src/cpp/base/variable_table.cpp b/src/cpp/base/variable_table.cpp new file mode 100644 index 0000000000000..d22b62b7fa318 --- /dev/null +++ b/src/cpp/base/variable_table.cpp @@ -0,0 +1,27 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant &LVariableTable::getImpl(CStrRef s, int64 hash) { + return lvalAt(s, hash); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/variable_table.h b/src/cpp/base/variable_table.h new file mode 100644 index 0000000000000..bbae7ded1100b --- /dev/null +++ b/src/cpp/base/variable_table.h @@ -0,0 +1,97 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_VARIABLE_TABLE_H__ +#define __HPHP_VARIABLE_TABLE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * R-value variable table that can look up a variable's value by its name. Code + * generator will generate a subclass like this, + * + * class VariableTable : public RVariableTable { + * public: + * virtual Variant getImpl(const char *s) { + * if (strcmp(s, "a") == 0) return v_a; + * // ... + * } + * }; + */ +class RVariableTable : public Array { + public: + virtual ~RVariableTable() {} + Variant get(CVarRef s) { return getImpl(s.toString());} + Variant get(CStrRef s) { return getImpl(s);} + Variant get(litstr s) { return getImpl(s);} + + /** + * Code-generated sub-class may override this function by generating one + * entry per variable. + */ + virtual bool exists(const char *s) const { + return Array::exists(s); + } + + /** + * Code-generated sub-class will implement this function by generating one + * entry per variable. + */ + virtual Variant getImpl(const char *s) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * L-value variable table that can get/set a variable's value by its name. The + * reason we have both RVariableTable and LVariableTable, instead of just this + * one, is because LVariableTable requires all variables to be Variant type, + * taking away type inference. If we can tell no dynamic variable was used in + * l-value context, we don't have to use LVariableTable. Of course, ideally + * even RVariableTable is not needed, meaning no dynamic variable is ever used. + */ +class LVariableTable : public Array { + public: + virtual ~LVariableTable() {} + Variant &get(CVarRef s, int64 hash = -1) { + return getImpl(s.toString(), hash); + } + Variant &get(CStrRef s, int64 hash = -1) { return getImpl(s, hash);} + Variant &get(litstr s, int64 hash = -1) { return getImpl(s, hash);} + + /** + * Code-generated sub-class may override this function by generating one + * entry per variable. + */ + virtual bool exists(const char *s, int64 hash = -1) const { + return Array::exists(s, hash); + } + + /** + * Code-generated sub-class will implement this function by generating one + * entry per variable. + */ + virtual Variant &getImpl(CStrRef s, int64 hash); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_VARIABLE_TABLE_H__ diff --git a/src/cpp/base/variable_unserializer.h b/src/cpp/base/variable_unserializer.h new file mode 100644 index 0000000000000..2a3c0f5687b58 --- /dev/null +++ b/src/cpp/base/variable_unserializer.h @@ -0,0 +1,64 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_VARIABLE_UNSERIALIZER_H__ +#define __HPHP_VARIABLE_UNSERIALIZER_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class VariableUnserializer { +public: + VariableUnserializer(std::istream &in) : m_in(in), m_key(false) {} + + Variant unserialize() { + Variant v; + v.unserialize(this); + return v; + } + + Variant unserializeKey() { + m_key = true; + Variant v; + v.unserialize(this); + m_key = false; + return v; + } + + std::istream &in() const { + return m_in; + } + void add(Variant* v) { + if (!m_key) { + m_refs.push_back(v); + } + } + Variant &get(int id) { + return *m_refs[id-1]; + } + + private: + std::istream &m_in; + std::vector m_refs; + bool m_key; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_VARIABLE_UNSERIALIZER_H__ diff --git a/src/cpp/base/zend/intl_convert.cpp b/src/cpp/base/zend/intl_convert.cpp new file mode 100644 index 0000000000000..6c7f71905868f --- /dev/null +++ b/src/cpp/base/zend/intl_convert.cpp @@ -0,0 +1,112 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include + +namespace HPHP { + +void intl_convert_utf8_to_utf16(UChar** target, int* target_len, + const char* src, int src_len, + UErrorCode* status) { + UChar* dst_buf = NULL; + int32_t dst_len = 0; + + /* If *target is NULL determine required destination buffer size + * (pre-flighting). Otherwise, attempt to convert source string; + * if *target buffer is not large enough it will be resized appropriately. + */ + *status = U_ZERO_ERROR; + + u_strFromUTF8(*target, *target_len, &dst_len, src, src_len, status); + + if (*status == U_ZERO_ERROR) { + /* String is converted successfuly */ + (*target)[dst_len] = 0; + *target_len = dst_len; + return; + } + + /* Bail out if an unexpected error occured. + * (U_BUFFER_OVERFLOW_ERROR means that *target buffer is not large enough). + * (U_STRING_NOT_TERMINATED_WARNING usually means that the input string + * is empty). + */ + if (*status != U_BUFFER_OVERFLOW_ERROR && + *status != U_STRING_NOT_TERMINATED_WARNING) { + return; + } + + // Allocate memory for the destination buffer (it will be zero-terminated). + dst_buf = (UChar *)malloc((dst_len + 1) * sizeof(UChar)); + + /* Convert source string from UTF-8 to UTF-16. */ + *status = U_ZERO_ERROR; + u_strFromUTF8(dst_buf, dst_len+1, NULL, src, src_len, status); + if (U_FAILURE(*status)) { + free(dst_buf); + return; + } + + dst_buf[dst_len] = 0; + + if (*target) free(*target); + + *target = dst_buf; + *target_len = dst_len; +} + +void intl_convert_utf16_to_utf8(char** target, int* target_len, + const UChar* src, int src_len, + UErrorCode* status) { + char* dst_buf = NULL; + int32_t dst_len; + + /* Determine required destination buffer size (pre-flighting). */ + *status = U_ZERO_ERROR; + u_strToUTF8(NULL, 0, &dst_len, src, src_len, status); + + /* Bail out if an unexpected error occured. + * (U_BUFFER_OVERFLOW_ERROR means that *target buffer is not large enough). + * (U_STRING_NOT_TERMINATED_WARNING usually means that the input string + * is empty). + */ + if (*status != U_BUFFER_OVERFLOW_ERROR && + *status != U_STRING_NOT_TERMINATED_WARNING) { + return; + } + + // Allocate memory for the destination buffer (it will be zero-terminated). + dst_buf = (char *)malloc(dst_len + 1); + + /* Convert source string from UTF-16 to UTF-8. */ + *status = U_ZERO_ERROR; + u_strToUTF8(dst_buf, dst_len, NULL, src, src_len, status); + if (U_FAILURE(*status)) { + free(dst_buf); + return; + } + + /* U_STRING_NOT_TERMINATED_WARNING is OK for us => reset 'status'. */ + *status = U_ZERO_ERROR; + + dst_buf[dst_len] = 0; + *target = dst_buf; + *target_len = dst_len; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/intl_convert.h b/src/cpp/base/zend/intl_convert.h new file mode 100644 index 0000000000000..bac6615f5aa1b --- /dev/null +++ b/src/cpp/base/zend/intl_convert.h @@ -0,0 +1,36 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_INTL_CONVERT_H__ +#define __HPHP_INTL_CONVERT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +void intl_convert_utf8_to_utf16(UChar** target, int* target_len, + const char* src, int src_len, + UErrorCode* status); +void intl_convert_utf16_to_utf8(char** target, int* target_len, + const UChar* src, int src_len, + UErrorCode* status); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_INTL_CONVERT_H__ diff --git a/src/cpp/base/zend/utf8_decode.c b/src/cpp/base/zend/utf8_decode.c new file mode 100644 index 0000000000000..85c78795942b7 --- /dev/null +++ b/src/cpp/base/zend/utf8_decode.c @@ -0,0 +1,179 @@ +/* utf8_decode.c */ + +/* 2005-12-25 */ + +/* +Copyright (c) 2005 JSON.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +The Software shall be used for Good, not Evil. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#include "utf8_decode.h" + +/* + Very Strict UTF-8 Decoder + + UTF-8 is a multibyte character encoding of Unicode. A character can be + represented by 1-4 bytes. The bit pattern of the first byte indicates the + number of continuation bytes. + + Most UTF-8 decoders tend to be lenient, attempting to recover as much + information as possible, even from badly encoded input. This UTF-8 + decoder is not lenient. It will reject input which does not include + proper continuation bytes. It will reject aliases (or suboptimal + codings). It will reject surrogates. (Surrogate encoding should only be + used with UTF-16.) + + Code Contination Minimum Maximum + 0xxxxxxx 0 0 127 + 10xxxxxx error + 110xxxxx 1 128 2047 + 1110xxxx 2 2048 65535 excluding 55296 - 57343 + 11110xxx 3 65536 1114111 + 11111xxx error +*/ + + +/* + Get the next byte. It returns UTF8_END if there are no more bytes. +*/ +static int +get(json_utf8_decode *utf8) +{ + int c; + if (utf8->the_index >= utf8->the_length) { + return UTF8_END; + } + c = utf8->the_input[utf8->the_index] & 0xFF; + utf8->the_index += 1; + return c; +} + + +/* + Get the 6-bit payload of the next continuation byte. + Return UTF8_ERROR if it is not a contination byte. +*/ +static int +cont(json_utf8_decode *utf8) +{ + int c = get(utf8); + return ((c & 0xC0) == 0x80) ? (c & 0x3F) : UTF8_ERROR; +} + + +/* + Initialize the UTF-8 decoder. The decoder is not reentrant, +*/ +void +utf8_decode_init(json_utf8_decode *utf8, char p[], int length) +{ + utf8->the_index = 0; + utf8->the_input = p; + utf8->the_length = length; + utf8->the_char = 0; + utf8->the_byte = 0; +} + + +/* + Get the current byte offset. This is generally used in error reporting. +*/ +int +utf8_decode_at_byte(json_utf8_decode *utf8) +{ + return utf8->the_byte; +} + + +/* + Get the current character offset. This is generally used in error reporting. + The character offset matches the byte offset if the text is strictly ASCII. +*/ +int +utf8_decode_at_character(json_utf8_decode *utf8) +{ + return utf8->the_char > 0 ? utf8->the_char - 1 : 0; +} + + +/* + Extract the next character. + Returns: the character (between 0 and 1114111) + or UTF8_END (the end) + or UTF8_ERROR (error) +*/ +int +utf8_decode_next(json_utf8_decode *utf8) +{ + int c; /* the first byte of the character */ + int r; /* the result */ + + if (utf8->the_index >= utf8->the_length) { + return utf8->the_index == utf8->the_length ? UTF8_END : UTF8_ERROR; + } + utf8->the_byte = utf8->the_index; + utf8->the_char += 1; + c = get(utf8); +/* + Zero continuation (0 to 127) +*/ + if ((c & 0x80) == 0) { + return c; + } +/* + One contination (128 to 2047) +*/ + if ((c & 0xE0) == 0xC0) { + int c1 = cont(utf8); + if (c1 < 0) { + return UTF8_ERROR; + } + r = ((c & 0x1F) << 6) | c1; + return r >= 128 ? r : UTF8_ERROR; + } +/* + Two continuation (2048 to 55295 and 57344 to 65535) +*/ + if ((c & 0xF0) == 0xE0) { + int c1 = cont(utf8); + int c2 = cont(utf8); + if (c1 < 0 || c2 < 0) { + return UTF8_ERROR; + } + r = ((c & 0x0F) << 12) | (c1 << 6) | c2; + return r >= 2048 && (r < 55296 || r > 57343) ? r : UTF8_ERROR; + } +/* + Three continuation (65536 to 1114111) +*/ + if ((c & 0xF1) == 0xF0) { + int c1 = cont(utf8); + int c2 = cont(utf8); + int c3 = cont(utf8); + if (c1 < 0 || c2 < 0 || c3 < 0) { + return UTF8_ERROR; + } + r = ((c & 0x0F) << 18) | (c1 << 12) | (c2 << 6) | c3; + return r >= 65536 && r <= 1114111 ? r : UTF8_ERROR; + } + return UTF8_ERROR; +} diff --git a/src/cpp/base/zend/utf8_decode.h b/src/cpp/base/zend/utf8_decode.h new file mode 100644 index 0000000000000..8ecc8924e22c8 --- /dev/null +++ b/src/cpp/base/zend/utf8_decode.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ +/* utf8_decode.h */ + +#define UTF8_END -1 +#define UTF8_ERROR -2 + +#ifdef __cplusplus +extern "C" { +#endif + typedef struct json_utf8_decode { + int the_index; + char *the_input; + int the_length; + int the_char; + int the_byte; + } json_utf8_decode; + + int utf8_decode_at_byte(json_utf8_decode *utf8); + int utf8_decode_at_character(json_utf8_decode *utf8); + void utf8_decode_init(json_utf8_decode *utf8, char p[], int length); + int utf8_decode_next(json_utf8_decode *utf8); +#ifdef __cplusplus +} +#endif diff --git a/src/cpp/base/zend/utf8_to_utf16.c b/src/cpp/base/zend/utf8_to_utf16.c new file mode 100644 index 0000000000000..ea7b86b9a29a7 --- /dev/null +++ b/src/cpp/base/zend/utf8_to_utf16.c @@ -0,0 +1,65 @@ +/* utf8_to_utf16.c */ + +/* 2005-12-25 */ + +/* +Copyright (c) 2005 JSON.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +The Software shall be used for Good, not Evil. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#include "utf8_to_utf16.h" +#include "utf8_decode.h" + +int +utf8_to_utf16(unsigned short w[], char p[], int length, int loose) /*** Facebook: json_utf8_loose ***/ +{ + int c; + int the_index = 0; + json_utf8_decode utf8; + + utf8_decode_init(&utf8, p, length); + for (;;) { + c = utf8_decode_next(&utf8); + if (c < 0) { + /*** BEGIN Facebook: json_utf8_loose ***/ + if (c == UTF8_END) { + return the_index; + } + if (loose) { + w[the_index] = (unsigned short)'?'; + the_index += 1; + } else { + return UTF8_ERROR; + } + /*** END Facebook: json_utf8_loose ***/ + } else if (c < 0x10000) { + w[the_index] = (unsigned short)c; + the_index += 1; + } else { + c &= 0xFFFF; + w[the_index] = (unsigned short)(0xD800 | (c >> 10)); + the_index += 1; + w[the_index] = (unsigned short)(0xDC00 | (c & 0x3FF)); + the_index += 1; + } + } +} diff --git a/src/cpp/base/zend/utf8_to_utf16.h b/src/cpp/base/zend/utf8_to_utf16.h new file mode 100644 index 0000000000000..9543d9928fcf6 --- /dev/null +++ b/src/cpp/base/zend/utf8_to_utf16.h @@ -0,0 +1,25 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ +/* utf8_to_utf16.h */ + +#ifdef __cplusplus +extern "C" { +#endif + int utf8_to_utf16(unsigned short w[], char p[], int length, int loose); +#ifdef __cplusplus +} +#endif diff --git a/src/cpp/base/zend/zend_collator.cpp b/src/cpp/base/zend/zend_collator.cpp new file mode 100644 index 0000000000000..e18797b5cdca0 --- /dev/null +++ b/src/cpp/base/zend/zend_collator.cpp @@ -0,0 +1,610 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +#define UCHARS(len) ((len) / sizeof(UChar)) +#define UBYTES(len) ((len) * sizeof(UChar)) + +static ThreadLocal s_errcode; + +static Variant collator_convert_string_to_number_if_possible(CVarRef str); + +static double collator_u_strtod(const UChar *nptr, UChar **endptr) { + const UChar *u = nptr, *nstart; + UChar c = *u; + int any = 0; + + while (u_isspace(c)) { + c = *++u; + } + nstart = u; + + if (c == 0x2D /*'-'*/ || c == 0x2B /*'+'*/) { + c = *++u; + } + + while (c >= 0x30 /*'0'*/ && c <= 0x39 /*'9'*/) { + any = 1; + c = *++u; + } + + if (c == 0x2E /*'.'*/) { + c = *++u; + while (c >= 0x30 /*'0'*/ && c <= 0x39 /*'9'*/) { + any = 1; + c = *++u; + } + } + + if ((c == 0x65 /*'e'*/ || c == 0x45 /*'E'*/) && any) { + const UChar *e = u; + int any_exp = 0; + + c = *++u; + if (c == 0x2D /*'-'*/ || c == 0x2B /*'+'*/) { + c = *++u; + } + + while (c >= 0x30 /*'0'*/ && c <= 0x39 /*'9'*/) { + any_exp = 1; + c = *++u; + } + + if (!any_exp) { + u = e; + } + } + + if (any) { + char buf[64], *numbuf, *bufpos; + int length = u - nstart; + double value; + + if (length < (int)sizeof(buf)) { + numbuf = buf; + } else { + numbuf = (char *) malloc(length + 1); + } + + bufpos = numbuf; + + while (nstart < u) { + *bufpos++ = (char) *nstart++; + } + + *bufpos = '\0'; + value = zend_strtod(numbuf, NULL); + + if (numbuf != buf) { + free(numbuf); + } + + if (endptr != NULL) { + *endptr = (UChar *)u; + } + + return value; + } + + if (endptr != NULL) { + *endptr = (UChar *)nptr; + } + + return 0; +} + +static long collator_u_strtol(const UChar *nptr, UChar **endptr, + int base) { + const UChar *s = nptr; + unsigned long acc; + UChar c; + unsigned long cutoff; + int neg = 0, any, cutlim; + + if (s == NULL) { + errno = ERANGE; + if (endptr != NULL) { + *endptr = NULL; + } + return 0; + } + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + do { + c = *s++; + } while (u_isspace(c)); + if (c == 0x2D /*'-'*/) { + neg = 1; + c = *s++; + } else if (c == 0x2B /*'+'*/) + c = *s++; + if ((base == 0 || base == 16) && + (c == 0x30 /*'0'*/) + && (*s == 0x78 /*'x'*/ || *s == 0x58 /*'X'*/)) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = (c == 0x30 /*'0'*/) ? 8 : 10; + + /* + * Compute the cutoff value between legal numbers and illegal + * numbers. That is the largest legal value, divided by the + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for longs is + * [-2147483648..2147483647] and the input base is 10, + * cutoff will be set to 214748364 and cutlim to either + * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated + * a value > 214748364, or equal but the next digit is > 7 (or 8), + * the number is too big, and we will return a range error. + * + * Set any if any `digits' consumed; make it negative to indicate + * overflow. + */ + cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; + cutlim = cutoff % (unsigned long)base; + cutoff /= (unsigned long)base; + for (acc = 0, any = 0;; c = *s++) { + if (c >= 0x30 /*'0'*/ && c <= 0x39 /*'9'*/) + c -= 0x30 /*'0'*/; + else if (c >= 0x41 /*'A'*/ && c <= 0x5A /*'Z'*/) + c -= 0x41 /*'A'*/ - 10; + else if (c >= 0x61 /*'a'*/ && c <= 0x7A /*'z'*/) + c -= 0x61 /*'a'*/ - 10; + else + break; + if (c >= base) + break; + + if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = neg ? LONG_MIN : LONG_MAX; + errno = ERANGE; + } else if (neg) + acc = -acc; + if (endptr != NULL) + *endptr = (UChar *)(any ? s - 1 : nptr); + return (acc); +} + + +static DataType collator_is_numeric(UChar *str, int length, long *lval, + double *dval, bool allow_errors ) { + long local_lval; + double local_dval; + UChar *end_ptr_long, *end_ptr_double; + int conv_base=10; + + if (!length) { + return KindOfNull; + } + + /* handle hex numbers */ + if (length>=2 && str[0]=='0' && (str[1]=='x' || str[1]=='X')) { + conv_base=16; + } + + errno=0; + local_lval = collator_u_strtol(str, &end_ptr_long, conv_base); + if (errno != ERANGE) { + if (end_ptr_long == str+length) { /* integer string */ + if (lval) { + *lval = local_lval; + } + return KindOfInt64; + } else if (end_ptr_long == str && + *end_ptr_long != '\0' && + *str != '.' && + *str != '-') { /* ignore partial string matches */ + return KindOfNull; + } + } else { + end_ptr_long = NULL; + } + + if (conv_base == 16) { /* hex string, under UNIX strtod() messes it up */ + /* UTODO: keep compatibility with is_numeric_string() here? */ + return KindOfNull; + } + + local_dval = collator_u_strtod(str, &end_ptr_double); + if (local_dval == 0 && end_ptr_double == str) { + end_ptr_double = NULL; + } else { + if (end_ptr_double == str+length) { /* floating point string */ + if (!finite(local_dval)) { + /* "inf","nan" and maybe other weird ones */ + return KindOfNull; + } + + if (dval) { + *dval = local_dval; + } + return KindOfDouble; + } + } + + if (!allow_errors) { + return KindOfNull; + } + if (allow_errors == -1) { + Logger::Info("A non well formed numeric value encountered"); + } + + if (allow_errors) { + if (end_ptr_double > end_ptr_long && dval) { + *dval = local_dval; + return KindOfDouble; + } else if (end_ptr_long && lval) { + *lval = local_lval; + return KindOfInt64; + } + } + return KindOfNull; +} + +static Variant collator_convert_object_to_string(CVarRef obj) { + // TODO: is this equivalent to PHP's implementation? + if (!obj.isObject()) return obj; + return obj.toString(); +} + +static Variant collator_convert_string_to_number(CVarRef str) { + Variant num = collator_convert_string_to_number_if_possible(str); + if (num.same(false)) { + /* String wasn't converted => return zero. */ + return 0; + } + return num; +} + +static Variant collator_convert_string_to_double(CVarRef str) { + Variant num = collator_convert_string_to_number(str); + return num.toDouble(); +} + +static Variant collator_convert_string_to_number_if_possible(CVarRef str) { + long lval = 0; + double dval = 0; + + if (!str.isString()) return false; + + DataType ret = collator_is_numeric((UChar*)(str.toString().data()), + UCHARS(str.toString().length()), + &lval, &dval, true); + if (ret == KindOfInt64) return lval; + if (ret == KindOfDouble) return dval; + return false; +} + +static String collator_convert_str_utf16_to_utf8(CStrRef utf16_str, + UErrorCode *status) { + char* str = NULL; + int str_len = 0; + + /* Convert to utf8 then. */ + intl_convert_utf16_to_utf8(&str, &str_len, + (UChar*)(utf16_str.data()), + UCHARS(utf16_str.length()), + status); + if (U_FAILURE(*status)) { + Logger::Verbose("Error converting utf16 to utf8"); + } + return String(str, str_len, AttachString); +} + +static String collator_convert_str_utf8_to_utf16(CStrRef utf8_str, + UErrorCode *status) { + UChar* ustr = NULL; + int ustr_len = 0; + + /* Convert the string to UTF-16. */ + intl_convert_utf8_to_utf16(&ustr, &ustr_len, + utf8_str.data(), utf8_str.length(), + status ); + if (U_FAILURE(*status)) { + Logger::Verbose("Error converting utf16 to utf8"); + } + return String((char*)ustr, UBYTES(ustr_len), AttachString); +} + +static void collator_convert_array_from_utf16_to_utf8(Array &array, + UErrorCode* status) { + if (array->supportValueRef()) { + for (ArrayIter iter(array); iter; ++iter) { + CVarRef value = iter.secondRef(); + /* Process string values only. */ + if (!value.isString()) continue; + String str = collator_convert_str_utf16_to_utf8(value, status); + if (U_FAILURE(*status)) return; + /* Update current value with the converted value. */ + const_cast(value) = str; + } + } else { + for (ArrayIter iter(array); iter; ++iter) { + CVarRef value = iter.second(); + /* Process string values only. */ + if (!value.isString()) continue; + String str = collator_convert_str_utf16_to_utf8(value, status); + if (U_FAILURE(*status)) return; + /* Update current value with the converted value. */ + Variant key = iter.first(); + array.set(key, str); + } + } +} + +static void collator_convert_array_from_utf8_to_utf16(Array &array, + UErrorCode* status) { + if (array->supportValueRef()) { + for (ArrayIter iter(array); iter; ++iter) { + CVarRef value = iter.secondRef(); + /* Process string values only. */ + if (!value.isString()) continue; + String str = collator_convert_str_utf8_to_utf16(value, status); + if (U_FAILURE(*status)) return; + /* Update current value with the converted value. */ + Variant key = iter.first(); + array.set(key, str); + } + } else { + for (ArrayIter iter(array); iter; ++iter) { + CVarRef value = iter.second(); + /* Process string values only. */ + if (!value.isString()) continue; + String str = collator_convert_str_utf8_to_utf16(value, status); + if (U_FAILURE(*status)) return; + /* Update current value with the converted value. */ + Variant key = iter.first(); + array.set(key, str); + } + } +} + +static Variant collator_normalize_sort_argument(CVarRef arg) { + if (!arg.isString()) return arg; + + Variant n_arg = collator_convert_string_to_number_if_possible(arg); + if (n_arg.same(false)) { + /* Conversion to number failed. */ + UErrorCode status = U_ZERO_ERROR; + + n_arg = collator_convert_str_utf16_to_utf8(arg, &status); + if (U_FAILURE(status)) ASSERT(false); + } + return n_arg; +} + +static int collator_regular_compare_function(CVarRef v1, CVarRef v2, + const void *data, + bool ascending) { + Variant str1 = collator_convert_object_to_string(v1); + Variant str2 = collator_convert_object_to_string(v2); + Variant num1; + Variant num2; + Variant norm1; + Variant norm2; + + /* If both args are strings AND either of args is not numeric string + * then use ICU-compare. Otherwise PHP-compare. */ + if (str1.isString() && str2.isString()) { + num1 = collator_convert_string_to_number_if_possible(str1); + if (!num1.same(false)) { + num2 = collator_convert_string_to_number_if_possible(str2); + } + if (num1.same(false) || num2.same(false)) { + ASSERT(data); + int ret = ucol_strcoll((const UCollator *)data, + (UChar*)(str1.toString().data()), + UCHARS(str1.toString().length()), + (UChar*)(str2.toString().data()), + UCHARS(str2.toString().length())); + return ascending ? ret : (-ret); + } + } + + /* num1 is set if str1 and str2 are strings. */ + if (!num1.isNull()) { + if (num1.same(false)) { + UErrorCode status = U_ZERO_ERROR; + + /* str1 is string but not numeric string just convert it to utf8. */ + norm1 = collator_convert_str_utf16_to_utf8(str1, &status); + + /* num2 is not set but str2 is string => do normalization. */ + norm2 = collator_normalize_sort_argument(str2); + } else { + /* str1 is numeric strings => passthru to PHP-compare. */ + norm1 = num1; + norm1 = num1; + } + } else { + /* num1 is not set if str1 or str2 is not a string => do normalization. */ + norm1 = collator_normalize_sort_argument(str1); + + /* if num1 is not set then num2 is not set as well => do normalization. */ + norm2 = collator_normalize_sort_argument(str2); + } + if (ascending) { + if (norm1.less(norm2)) return -1; + if (norm1.equal(norm2)) return 0; + return 1; + } + if (norm1.less(norm2)) return 1; + if (norm1.equal(norm2)) return 0; + return -1; +} + +static int collator_regular_compare_ascending(CVarRef v1, CVarRef v2, + const void *data) { + return collator_regular_compare_function(v1, v2, data, true); +} + +static int collator_regular_compare_descending(CVarRef v1, CVarRef v2, + const void *data) { + return collator_regular_compare_function(v1, v2, data, false); +} + +static int collator_numeric_compare_function(CVarRef v1, CVarRef v2, + const void *data, + bool ascending) { + Variant num1; + Variant num2; + + if (v1.isString()) { + num1 = collator_convert_string_to_double(v1); + } else { + num1 = v1.toDouble(); + } + if (v2.isString()) { + num2 = collator_convert_string_to_double(v2); + } else { + num2 = v2.toDouble(); + } + if (ascending) { + if (num1.less(num2)) return -1; + if (num1.equal(num2)) return 0; + return 1; + } + if (num1.less(num2)) return 1; + if (num1.equal(num2)) return 0; + return -1; +} + +static int collator_numeric_compare_ascending(CVarRef v1, CVarRef v2, + const void *data) { + return collator_numeric_compare_function(v1, v2, data, true); +} + +static int collator_numeric_compare_descending(CVarRef v1, CVarRef v2, + const void *data) { + return collator_numeric_compare_function(v1, v2, data, false); +} + +static int collator_string_compare_function(CVarRef v1, CVarRef v2, + const void *data, + bool ascending) { + ASSERT(data); + String str1 = v1.toString(); + String str2 = v2.toString(); + int ret = ucol_strcoll((const UCollator *)data, + (UChar*)(str1.data()), + UCHARS(str1.length()), + (UChar*)(str2.data()), + UCHARS(str2.length())); + return ascending ? ret : (-ret); +} + +static int collator_string_compare_ascending(CVarRef v1, CVarRef v2, + const void *data) { + return collator_string_compare_function(v1, v2, data, true); +} + +static int collator_string_compare_descending(CVarRef v1, CVarRef v2, + const void *data) { + return collator_string_compare_function(v1, v2, data, false); +} + +static bool collator_sort_internal(bool renumber, Variant &array, + int sort_flags, bool ascending, + UCollator *coll) { + ASSERT(coll); + *s_errcode = U_ZERO_ERROR; + Array temp = array.toArray(); + Array::PFUNC_CMP cmp_func; + + switch (sort_flags) { + case COLLATOR_SORT_NUMERIC: + cmp_func = ascending ? collator_numeric_compare_ascending + : collator_numeric_compare_descending; + break; + case COLLATOR_SORT_STRING: + cmp_func = ascending ? collator_string_compare_ascending + : collator_string_compare_descending; + break; + case COLLATOR_SORT_REGULAR: + default: + cmp_func = ascending ? collator_regular_compare_ascending + : collator_regular_compare_descending; + break; + } + + /* Convert strings in the specified array from UTF-8 to UTF-16. */ + collator_convert_array_from_utf8_to_utf16(temp, &(*s_errcode)); + if (U_FAILURE(*s_errcode)) { + Logger::Verbose("Error converting array from UTF-8 to UTF-16"); + return false; + } + + /* Sort specified array. */ + temp.sort(cmp_func, false, renumber, coll); + + /* Convert strings in the specified array back to UTF-8. */ + *s_errcode = U_ZERO_ERROR; + collator_convert_array_from_utf16_to_utf8(temp, &(*s_errcode)); + if (U_FAILURE(*s_errcode)) { + // This should not happen + Logger::Error("Error converting array from UTF-16 to UTF-8"); + return false; + } + array = temp; + return true; +} + +bool collator_sort(Variant &array, int sort_flags, bool ascending, + UCollator *coll, UErrorCode *errcode) { + ASSERT(coll); + bool ret = collator_sort_internal(true, array, sort_flags, ascending, coll); + *errcode = *s_errcode; + return ret; +} + +bool collator_asort(Variant &array, int sort_flags, bool ascending, + UCollator *coll, UErrorCode *errcode) { + ASSERT(coll); + bool ret = collator_sort_internal(false, array, sort_flags, ascending, coll); + *errcode = *s_errcode; + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_collator.h b/src/cpp/base/zend/zend_collator.h new file mode 100644 index 0000000000000..7e92c613f6933 --- /dev/null +++ b/src/cpp/base/zend/zend_collator.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_COLLATOR_H__ +#define __HPHP_ZEND_COLLATOR_H__ + +#include // icu + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class Variant; +#define COLLATOR_SORT_REGULAR 0 +#define COLLATOR_SORT_NUMERIC 1 +#define COLLATOR_SORT_STRING 2 + +bool collator_sort(Variant &array, int sort_flags, bool ascending, + UCollator *coll, UErrorCode *errcode); +bool collator_asort(Variant &array, int sort_flags, bool ascending, + UCollator *coll, UErrorCode *errcode); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_COLLATOR_H__ diff --git a/src/cpp/base/zend/zend_functions.cpp b/src/cpp/base/zend/zend_functions.cpp new file mode 100644 index 0000000000000..77e6cec62de1a --- /dev/null +++ b/src/cpp/base/zend/zend_functions.cpp @@ -0,0 +1,244 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { + +#define SIZEOF_LONG 8 +#define MAX_LENGTH_OF_LONG 20 +static const char long_min_digits[] = "9223372036854775808"; + +#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') +#define IS_XDIGIT(c) (((c) >= 'A' && (c) <= 'F')||((c) >= 'a' && (c) <= 'f')) + +/////////////////////////////////////////////////////////////////////////////// + +DataType is_numeric_string(const char *str, int length, int64 *lval, + double *dval, int allow_errors /* = 1 */) { + DataType type; + const char *ptr; + int base = 10, digits = 0, dp_or_e = 0; + double local_dval = 0.0; + + if (!length) { + return KindOfNull; + } + + /* 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 (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 int64 */ + for (type = KindOfInt64; + !(digits >= MAX_LENGTH_OF_LONG && (dval || allow_errors == 1)); + digits++, ptr++) { + check_digits: + if (IS_DIGIT(*ptr) || (base == 16 && 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 (IS_DIGIT(*e)) { + goto process_double; + } + } + } + + break; + } + + if (base == 10) { + if (digits >= MAX_LENGTH_OF_LONG) { + dp_or_e = -1; + goto process_double; + } + } else if (!(digits < SIZEOF_LONG * 2 || + (digits == SIZEOF_LONG * 2 && ptr[-digits] <= '7'))) { + if (dval) { + local_dval = zend_strtod(str, (char **)&ptr); + } + type = KindOfDouble; + } + } else if (*ptr == '.' && IS_DIGIT(ptr[1])) { + process_double: + type = KindOfDouble; + + /* 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 = strtod(str, (char **)&ptr); + } else if (allow_errors != 1 && dp_or_e != -1) { + dp_or_e = (*ptr++ == '.') ? 1 : 2; + goto check_digits; + } + } else { + return KindOfNull; + } + + if (ptr != str + length) { + if (!allow_errors) { + return KindOfNull; + } + // if (allow_errors == -1) { + // zend_error(E_NOTICE, "A non well formed numeric value encountered"); + // } + } + + if (type == KindOfInt64) { + if (digits == MAX_LENGTH_OF_LONG - 1) { + int cmp = strcmp(&ptr[-digits], long_min_digits); + if (!(cmp < 0 || (cmp == 0 && *str == '-'))) { + if (dval) { + *dval = strtod(str, NULL); + } + return KindOfDouble; + } + } + if (lval) { + *lval = strtol(str, NULL, base); + } + return KindOfInt64; + } + + if (dval) { + *dval = local_dval; + } + return KindOfDouble; +} + +#define LOWER_CASE 1 +#define UPPER_CASE 2 +#define NUMERIC 3 + +char *increment_string(char *s, int len) { + ASSERT(s && *s); + + int carry=0; + int pos=len-1; + int last=0; /* Shut up the compiler warning */ + int ch; + + while (pos >= 0) { + ch = s[pos]; + if (ch >= 'a' && ch <= 'z') { + if (ch == 'z') { + s[pos] = 'a'; + carry=1; + } else { + s[pos]++; + carry=0; + } + last=LOWER_CASE; + } else if (ch >= 'A' && ch <= 'Z') { + if (ch == 'Z') { + s[pos] = 'A'; + carry=1; + } else { + s[pos]++; + carry=0; + } + last=UPPER_CASE; + } else if (ch >= '0' && ch <= '9') { + if (ch == '9') { + s[pos] = '0'; + carry=1; + } else { + s[pos]++; + carry=0; + } + last = NUMERIC; + } else { + carry=0; + break; + } + if (carry == 0) { + break; + } + pos--; + } + + if (carry) { + char *t = (char *) malloc(len+1+1); + memcpy(t+1, s, len); + t[++len] = '\0'; + switch (last) { + case NUMERIC: + t[0] = '1'; + break; + case UPPER_CASE: + t[0] = 'A'; + break; + case LOWER_CASE: + t[0] = 'a'; + break; + } + return t; + } + return NULL; +} + +bool is_valid_var_name(const char *var_name, int len) { + if (!var_name || + (!isalpha((int)((unsigned char *)var_name)[0]) && var_name[0] != '_')) { + return false; + } + for (int i = 1; i < len; i++) { + if (!isalnum((int)((unsigned char *)var_name)[i]) && var_name[i] != '_') { + return false; + } + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_functions.h b/src/cpp/base/zend/zend_functions.h new file mode 100644 index 0000000000000..26a0d55d793d2 --- /dev/null +++ b/src/cpp/base/zend/zend_functions.h @@ -0,0 +1,98 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_FUNCTIONS_H__ +#define __HPHP_ZEND_FUNCTIONS_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// zend logic: These are not string utilities, but zend's special language +// semantics. + +/** + * Testing whether a string is numeric or not. + */ +DataType is_numeric_string(const char *str, int length, int64 *lval, + double *dval, int allow_errors = 0); + +/** + * Zend's way of incrementing a string. Definitely something we want to get rid + * of in the future. + */ +char *increment_string(char *s, int len); + +/** + * Whether or not a string is a valid variable name. + */ +bool is_valid_var_name(const char *var_name, int len); + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Adapted from ap_php_conv_10 for fast signed integer to string conversion. + */ +inline char * +conv_10(register long num, register int *is_negative, char *buf_end, + register int *len) +{ + register char *p = buf_end; + register unsigned long magnitude; + + *is_negative = (num < 0); + + /* + * On a 2's complement machine, negating the most negative integer + * results in a number that cannot be represented as a signed integer. + * Here is what we do to obtain the number's magnitude: + * a. add 1 to the number + * b. negate it (becomes positive) + * c. convert it to unsigned + * d. add 1 + */ + if (*is_negative) { + long t = num + 1; + magnitude = ((unsigned long) - t) + 1; + } else { + magnitude = (unsigned long) num; + } + + /* + * We use a do-while loop so that we write at least 1 digit + */ + do { + unsigned long new_magnitude = magnitude / 10; + + *--p = (char)(magnitude - new_magnitude * 10 + '0'); + magnitude = new_magnitude; + } + while (magnitude); + + if (*is_negative) { + *--p = '-'; + } + + *len = buf_end - p; + return (p); +} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_FUNCTIONS_H__ diff --git a/src/cpp/base/zend/zend_html.cpp b/src/cpp/base/zend/zend_html.cpp new file mode 100644 index 0000000000000..6c1a4b8ef25dd --- /dev/null +++ b/src/cpp/base/zend/zend_html.cpp @@ -0,0 +1,538 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { + +#define HTML_SPECIALCHARS 0 +#define HTML_ENTITIES 1 + +#define ENT_HTML_QUOTE_NONE 0 +#define ENT_HTML_QUOTE_SINGLE 1 +#define ENT_HTML_QUOTE_DOUBLE 2 + +#define ENT_COMPAT ENT_HTML_QUOTE_DOUBLE +#define ENT_QUOTES (ENT_HTML_QUOTE_DOUBLE | ENT_HTML_QUOTE_SINGLE) +#define ENT_NOQUOTES ENT_HTML_QUOTE_NONE + +/////////////////////////////////////////////////////////////////////////////// +// UTF-8 entity tables + +typedef const char *const entity_table_t; + +static entity_table_t ent_iso_8859_1[] = { + "nbsp", "iexcl", "cent", "pound", "curren", "yen", "brvbar", + "sect", "uml", "copy", "ordf", "laquo", "not", "shy", "reg", + "macr", "deg", "plusmn", "sup2", "sup3", "acute", "micro", + "para", "middot", "cedil", "sup1", "ordm", "raquo", "frac14", + "frac12", "frac34", "iquest", "Agrave", "Aacute", "Acirc", + "Atilde", "Auml", "Aring", "AElig", "Ccedil", "Egrave", + "Eacute", "Ecirc", "Euml", "Igrave", "Iacute", "Icirc", + "Iuml", "ETH", "Ntilde", "Ograve", "Oacute", "Ocirc", "Otilde", + "Ouml", "times", "Oslash", "Ugrave", "Uacute", "Ucirc", "Uuml", + "Yacute", "THORN", "szlig", "agrave", "aacute", "acirc", + "atilde", "auml", "aring", "aelig", "ccedil", "egrave", + "eacute", "ecirc", "euml", "igrave", "iacute", "icirc", + "iuml", "eth", "ntilde", "ograve", "oacute", "ocirc", "otilde", + "ouml", "divide", "oslash", "ugrave", "uacute", "ucirc", + "uuml", "yacute", "thorn", "yuml" +}; + +static entity_table_t ent_iso_8859_15[] = { + "nbsp", "iexcl", "cent", "pound", "euro", "yen", "Scaron", + "sect", "scaron", "copy", "ordf", "laquo", "not", "shy", "reg", + "macr", "deg", "plusmn", "sup2", "sup3", NULL, /* Zcaron */ + "micro", "para", "middot", NULL, /* zcaron */ "sup1", "ordm", + "raquo", "OElig", "oelig", "Yuml", "iquest", "Agrave", "Aacute", + "Acirc", "Atilde", "Auml", "Aring", "AElig", "Ccedil", "Egrave", + "Eacute", "Ecirc", "Euml", "Igrave", "Iacute", "Icirc", + "Iuml", "ETH", "Ntilde", "Ograve", "Oacute", "Ocirc", "Otilde", + "Ouml", "times", "Oslash", "Ugrave", "Uacute", "Ucirc", "Uuml", + "Yacute", "THORN", "szlig", "agrave", "aacute", "acirc", + "atilde", "auml", "aring", "aelig", "ccedil", "egrave", + "eacute", "ecirc", "euml", "igrave", "iacute", "icirc", + "iuml", "eth", "ntilde", "ograve", "oacute", "ocirc", "otilde", + "ouml", "divide", "oslash", "ugrave", "uacute", "ucirc", + "uuml", "yacute", "thorn", "yuml" +}; + +static entity_table_t ent_uni_338_402[] = { + /* 338 (0x0152) */ + "OElig", "oelig", NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 352 (0x0160) */ + "Scaron", "scaron", NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 376 (0x0178) */ + "Yuml", NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 400 (0x0190) */ + NULL, NULL, "fnof" +}; + +static entity_table_t ent_uni_spacing[] = { + /* 710 */ + "circ", + /* 711 - 730 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 731 - 732 */ + NULL, "tilde" +}; + +static entity_table_t ent_uni_greek[] = { + /* 913 */ + "Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", + "Iota", "Kappa", "Lambda", "Mu", "Nu", "Xi", "Omicron", "Pi", "Rho", + NULL, "Sigma", "Tau", "Upsilon", "Phi", "Chi", "Psi", "Omega", + /* 938 - 944 are not mapped */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", + "iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", "rho", + "sigmaf", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega", + /* 970 - 976 are not mapped */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "thetasym", "upsih", + NULL, NULL, NULL, + "piv" +}; + +static entity_table_t ent_uni_punct[] = { + /* 8194 */ + "ensp", "emsp", NULL, NULL, NULL, NULL, NULL, + "thinsp", NULL, NULL, "zwnj", "zwj", "lrm", "rlm", + NULL, NULL, NULL, "ndash", "mdash", NULL, NULL, NULL, + /* 8216 */ + "lsquo", "rsquo", "sbquo", NULL, "ldquo", "rdquo", "bdquo", NULL, + "dagger", "Dagger", "bull", NULL, NULL, NULL, "hellip", + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "permil", NULL, + /* 8242 */ + "prime", "Prime", NULL, NULL, NULL, NULL, NULL, "lsaquo", "rsaquo", NULL, + NULL, NULL, "oline", NULL, NULL, NULL, NULL, NULL, + "frasl" +}; + +static entity_table_t ent_uni_euro[] = { + "euro" +}; + +static entity_table_t ent_uni_8465_8501[] = { + /* 8465 */ + "image", NULL, NULL, NULL, NULL, NULL, NULL, + /* 8472 */ + "weierp", NULL, NULL, NULL, + /* 8476 */ + "real", NULL, NULL, NULL, NULL, NULL, + /* 8482 */ + "trade", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8501 */ + "alefsym", +}; + +static entity_table_t ent_uni_8592_9002[] = { + /* 8592 (0x2190) */ + "larr", "uarr", "rarr", "darr", "harr", NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8608 (0x21a0) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8624 (0x21b0) */ + NULL, NULL, NULL, NULL, NULL, "crarr", NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8640 (0x21c0) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8656 (0x21d0) */ + "lArr", "uArr", "rArr", "dArr", "hArr", "vArr", NULL, NULL, + NULL, NULL, "lAarr", "rAarr", NULL, "rarrw", NULL, NULL, + /* 8672 (0x21e0) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8704 (0x2200) */ + "forall", "comp", "part", "exist", "nexist", "empty", NULL, "nabla", + "isin", "notin", "epsis", "ni", "notni", "bepsi", NULL, "prod", + /* 8720 (0x2210) */ + "coprod", "sum", "minus", "mnplus", "plusdo", NULL, "setmn", "lowast", + "compfn", NULL, "radic", NULL, NULL, "prop", "infin", "ang90", + /* 8736 (0x2220) */ + "ang", "angmsd", "angsph", "mid", "nmid", "par", "npar", "and", + "or", "cap", "cup", "int", NULL, NULL, "conint", NULL, + /* 8752 (0x2230) */ + NULL, NULL, NULL, NULL, "there4", "becaus", NULL, NULL, + NULL, NULL, NULL, NULL, "sim", "bsim", NULL, NULL, + /* 8768 (0x2240) */ + "wreath", "nsim", NULL, "sime", "nsime", "cong", NULL, "ncong", + "asymp", "nap", "ape", NULL, "bcong", "asymp", "bump", "bumpe", + /* 8784 (0x2250) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8800 (0x2260) */ + "ne", "equiv", NULL, NULL, "le", "ge", "lE", "gE", + "lnE", "gnE", "Lt", "Gt", "twixt", NULL, "nlt", "ngt", + /* 8816 (0x2270) */ + "nles", "nges", "lsim", "gsim", NULL, NULL, "lg", "gl", + NULL, NULL, "pr", "sc", "cupre", "sscue", "prsim", "scsim", + /* 8832 (0x2280) */ + "npr", "nsc", "sub", "sup", "nsub", "nsup", "sube", "supe", + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8848 (0x2290) */ + NULL, NULL, NULL, NULL, NULL, "oplus", NULL, "otimes", + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8864 (0x22a0) */ + NULL, NULL, NULL, NULL, NULL, "perp", NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8880 (0x22b0) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8896 (0x22c0) */ + NULL, NULL, NULL, NULL, NULL, "sdot", NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8912 (0x22d0) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8928 (0x22e0) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8944 (0x22f0) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8960 (0x2300) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "lceil", "rceil", "lfloor", "rfloor", NULL, NULL, NULL, NULL, + /* 8976 (0x2310) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + /* 8992 (0x2320) */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, "lang", "rang" +}; + +static entity_table_t ent_uni_9674[] = { + /* 9674 */ + "loz" +}; + +static entity_table_t ent_uni_9824_9830[] = { + /* 9824 */ + "spades", NULL, NULL, "clubs", NULL, "hearts", "diams" +}; + +struct html_entity_map { + unsigned short basechar; /* char code at start of table */ + unsigned short endchar; /* last char code in the table */ + entity_table_t *table; /* the table of mappings */ +}; + +static const struct html_entity_map entity_map[] = { + { 0xa0, 0xff, ent_iso_8859_1 }, + { 338, 402, ent_uni_338_402 }, + { 710, 732, ent_uni_spacing }, + { 913, 982, ent_uni_greek }, + { 8194, 8260, ent_uni_punct }, + { 8364, 8364, ent_uni_euro }, + { 8465, 8501, ent_uni_8465_8501 }, + { 8592, 9002, ent_uni_8592_9002 }, + { 9674, 9674, ent_uni_9674 }, + { 9824, 9830, ent_uni_9824_9830 }, +}; + +static const struct { + unsigned short charcode; + const char *entity; + int entitylen; + int flags; +} basic_entities[] = { + { '"', """, 6, ENT_HTML_QUOTE_DOUBLE }, + { '\'', "'", 6, ENT_HTML_QUOTE_SINGLE }, + { '\'', "'", 5, ENT_HTML_QUOTE_SINGLE }, + { '<', "<", 4, 0 }, + { '>', ">", 4, 0 }, + { 0, NULL, 0, 0 } +}; + +/////////////////////////////////////////////////////////////////////////////// + +static int utf32_to_utf8(unsigned char *buf, int k) { + int retval = 0; + + if (k < 0x80) { + buf[0] = k; + retval = 1; + } else if (k < 0x800) { + buf[0] = 0xc0 | (k >> 6); + buf[1] = 0x80 | (k & 0x3f); + retval = 2; + } else if (k < 0x10000) { + buf[0] = 0xe0 | (k >> 12); + buf[1] = 0x80 | ((k >> 6) & 0x3f); + buf[2] = 0x80 | (k & 0x3f); + retval = 3; + } else if (k < 0x200000) { + buf[0] = 0xf0 | (k >> 18); + buf[1] = 0x80 | ((k >> 12) & 0x3f); + buf[2] = 0x80 | ((k >> 6) & 0x3f); + buf[3] = 0x80 | (k & 0x3f); + retval = 4; + } else if (k < 0x4000000) { + buf[0] = 0xf8 | (k >> 24); + buf[1] = 0x80 | ((k >> 18) & 0x3f); + buf[2] = 0x80 | ((k >> 12) & 0x3f); + buf[3] = 0x80 | ((k >> 6) & 0x3f); + buf[4] = 0x80 | (k & 0x3f); + retval = 5; + } else { + buf[0] = 0xfc | (k >> 30); + buf[1] = 0x80 | ((k >> 24) & 0x3f); + buf[2] = 0x80 | ((k >> 18) & 0x3f); + buf[3] = 0x80 | ((k >> 12) & 0x3f); + buf[4] = 0x80 | ((k >> 6) & 0x3f); + buf[5] = 0x80 | (k & 0x3f); + retval = 6; + } + buf[retval] = '\0'; + + return retval; +} + +typedef __gnu_cxx::hash_map +, eqstr> +HtmlEntityMap; + +static bool EntityMapInited = false; +static Mutex EntityMapMutex; +static HtmlEntityMap EntityMap; + +static void init_entity_table() { + for (unsigned int i = 0; i < sizeof(entity_map)/sizeof(entity_map[0]); i++) { + const html_entity_map &em = entity_map[i]; + + int index = 0; + for (int ch = em.basechar; ch <= em.endchar; ch++, index++) { + const char *entity = em.table[index]; + if (entity) { + unsigned char buf[10]; + utf32_to_utf8(buf, ch); + EntityMap[entity] = (const char *)buf; + } + } + } + EntityMap["quot"] = "\""; + EntityMap["lt"] = "<"; + EntityMap["gt"] = ">"; + EntityMap["amp"] = "&"; +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_html_encode(const char *input, int &len, bool encode_double_quote, + bool encode_single_quote) { + ASSERT(input); + if (!*input) { + return NULL; + } + + /** + * Though seems to be wasting memory a lot, we have to realize most of the + * time this function is called with small strings, or fragments of HTMLs. + * Allocating/deallocating anything less than 1K is trivial these days, and + * we want avoid string copying as much as possible. Of course, the return + * char * is really sent back at large, occupying unnessary space for + * potentially longer time than we need, we have to realize the two closest + * solutions are not that much better, either: + * + * 1. pre-calculate size by iterating through the string once: too time + * consuming; + * 2. take a guess and double buffer size when over: still wasting, and + * it may not save that much. + */ + char *ret = (char *)malloc(len * 6 + 1); + char *q = ret; + for (const char *p = input; *p; p++) { + char c = *p; + switch (c) { + case '"': + if (encode_double_quote) { + *q++ = '&'; *q++ = 'q'; *q++ = 'u'; *q++ = 'o'; *q++ = 't'; *q++ = ';'; + } else { + *q++ = c; + } + break; + case '\'': + if (encode_single_quote) { + *q++ = '&'; *q++ = '#'; *q++ = '0'; *q++ = '3'; *q++ = '9'; *q++ = ';'; + } else { + *q++ = c; + } + break; + case '<': + *q++ = '&'; *q++ = 'l'; *q++ = 't'; *q++ = ';'; + break; + case '>': + *q++ = '&'; *q++ = 'g'; *q++ = 't'; *q++ = ';'; + break; + case '&': + *q++ = '&'; *q++ = 'a'; *q++ = 'm'; *q++ = 'p'; *q++ = ';'; + break; + default: + *q++ = c; + break; + } + } + *q = 0; + len = q - ret; + return ret; +} + +inline static void decode_entity(char *entity) { + ASSERT(entity && *entity); + if (entity[0] == '#') { + int code; + if (entity[1] == 'x' || entity[1] == 'X') { + code = strtol(entity + 2, NULL, 16); + } else { + code = strtol(entity + 1, NULL, 10); + } + if (code) { + unsigned char buf[10]; + int size = utf32_to_utf8(buf, code); + memcpy(entity, buf, size + 1); + return; + } + } else { + HtmlEntityMap::const_iterator iter = EntityMap.find(entity); + if (iter != EntityMap.end()) { + memcpy(entity, iter->second.c_str(), iter->second.length() + 1); + return; + } + } + + // bad entity + std::string s = "&"; + s += entity; + s += ";"; + memcpy(entity, s.c_str(), s.length() + 1); +} + +char *string_html_decode(const char *input, int &len) { + ASSERT(input); + if (!*input) { + return NULL; + } + + if (!EntityMapInited) { + Lock lock(EntityMapMutex); + if (!EntityMapInited) { + EntityMapInited = true; + init_entity_table(); + } + } + + char *ret = (char *)malloc(len + 1); + char *q = ret; + for (const char *p = input; *p; p++) { + char ch = *p; + if (ch != '&') { + *q++ = ch; + continue; + } + p++; + + bool found = false; + for (const char *t = p; *t; t++) { + int l = t - p; + if (l > 10) break; + + if (*t == ';') { + if (l > 0) { + found = true; + char buf[16]; + memcpy(buf, p, l); + buf[l] = '\0'; + decode_entity(buf); + l = strlen(buf); + memcpy(q, buf, l); + p = t; + q += l; + } + break; + } + } + if (!found) { + p--; + *q++ = '&'; // not an entity + } + } + *q = '\0'; + len = q - ret; + return ret; +} + +Array string_get_html_translation_table(int which, int quote_style) { + char ind[2]; ind[1] = 0; + + Array ret; + switch (which) { + case HTML_ENTITIES: + if (!EntityMapInited) { + Lock lock(EntityMapMutex); + if (!EntityMapInited) { + EntityMapInited = true; + init_entity_table(); + } + } + + for (int j = 0; j < (int)(sizeof(entity_map)/sizeof(entity_map[0])); j++) { + const html_entity_map &em = entity_map[j]; + for (int i = 0; i <= em.endchar - em.basechar; i++) { + char buffer[16]; + + if (em.table[i] == NULL) + continue; + /* what about wide chars here ?? */ + ind[0] = i + em.basechar; + snprintf(buffer, sizeof(buffer), "&%s;", em.table[i]); + ret.set(ind, String(buffer, CopyString)); + } + } + /* break thru */ + + case HTML_SPECIALCHARS: + for (int j = 0; basic_entities[j].charcode != 0; j++) { + if (basic_entities[j].flags && + (quote_style & basic_entities[j].flags) == 0) + continue; + + ind[0] = (unsigned char)basic_entities[j].charcode; + ret.set(String(ind, 2, CopyString), basic_entities[j].entity); + } + ret.set("&", "&"); + break; + } + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_html.h b/src/cpp/base/zend/zend_html.h new file mode 100644 index 0000000000000..fe0471eb659f2 --- /dev/null +++ b/src/cpp/base/zend/zend_html.h @@ -0,0 +1,57 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_HTML_H__ +#define __HPHP_ZEND_HTML_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +/** + * Major departures from Zend: + * + * 1. We are only supporting UTF-8 encoding. So, dropped charset parameters. + * Major reason for this is because the original get_next_char() bothers me, + * sacrificing performance for some character sets that people rarely used + * or that people shouldn't use. UTF-8 should really be the standard string + * format everywhere, and we ought to write coding specifilized for it to + * take full advantage of it: one example would be the new html encoding + * function that simply do *p one a time iterating through the strings to + * look for special characters for entity escaping. + * + * 2. HTML encoding function no longer encodes entities other than the basic + * ones. There is no need to encode them, since all browsers support UTF-8 + * natively, and we are ok to send out UTF-8 encoding characters without + * turning them into printable ASCIIs. Basic entities are encoded for + * a different reason! In fact, I personally don't see why HTML spec has + * those extended list of entities, other than historical artifacts. + * + * 3. Double encoding parameter is not supported. That really sounds like + * a workaround of buggy coding. I don't find a legit use for that yet. + */ + +char *string_html_encode(const char *input, int &len, bool encode_double_quote, + bool encode_single_quote); +char *string_html_decode(const char *input, int &len); +Array string_get_html_translation_table(int which, int quote_style); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_STRING_H__ diff --git a/src/cpp/base/zend/zend_math.h b/src/cpp/base/zend/zend_math.h new file mode 100644 index 0000000000000..1e5c7a22499e9 --- /dev/null +++ b/src/cpp/base/zend/zend_math.h @@ -0,0 +1,94 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_MATH_H__ +#define __HPHP_ZEND_MATH_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PHP_ROUND_FUZZ +# ifndef PHP_WIN32 +# define PHP_ROUND_FUZZ 0.50000000001 +# else +# define PHP_ROUND_FUZZ 0.5 +# endif +#endif + +#define PHP_ROUND_WITH_FUZZ(val, places) { \ + double tmp_val=val, f = pow(10.0, (double) places); \ + tmp_val *= f; \ + if (tmp_val >= 0.0) { \ + tmp_val = floor(tmp_val + PHP_ROUND_FUZZ); \ + } else { \ + tmp_val = ceil(tmp_val - PHP_ROUND_FUZZ); \ + } \ + tmp_val /= f; \ + val = !isnan(tmp_val) ? tmp_val : val; \ + } \ + +/* System Rand functions */ +#ifndef RAND_MAX +#define RAND_MAX (1<<15) +#endif + +#define MT_RAND_MAX 0x7FFFFFFFLL + +/* + * A bit of tricky math here. We want to avoid using a modulus because + * that simply tosses the high-order bits and might skew the distribution + * of random values over the range. Instead we map the range directly. + * + * We need to map the range from 0...M evenly to the range a...b + * Let n = the random number and n' = the mapped random number + * + * Then we have: n' = a + n(b-a)/M + * + * We have a problem here in that only n==M will get mapped to b which + # means the chances of getting b is much much less than getting any of + # the other values in the range. We can fix this by increasing our range + # artifically and using: + # + # n' = a + n(b-a+1)/M + * + # Now we only have a problem if n==M which would cause us to produce a + # number of b+1 which would be bad. So we bump M up by one to make sure + # this will never happen, and the final algorithm looks like this: + # + # n' = a + n(b-a+1)/(M+1) + * + * -RL + */ +#define RAND_RANGE(__n, __min, __max, __tmax) \ + (__n) = (__min) + (long) ((double) ((double)(__max) - (__min) + 1.0) * \ + ((__n) / ((__tmax) + 1.0))) + +#define GENERATE_SEED() \ + (long) (time(0) * getpid() * 1000000 * math_combined_lcg()) + +/////////////////////////////////////////////////////////////////////////////// + +void math_mt_srand(uint32 seed); +long math_mt_rand(long min = 0, long max = RAND_MAX); +double math_combined_lcg(); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_MATH_H__ diff --git a/src/cpp/base/zend/zend_md5.cpp b/src/cpp/base/zend/zend_md5.cpp new file mode 100644 index 0000000000000..64d351cf6ac25 --- /dev/null +++ b/src/cpp/base/zend/zend_md5.cpp @@ -0,0 +1,328 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + * Reference MD5 code (md5c.c) from rfc1321 + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD5 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD5 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + */ + +/* Constants for MD5Transform routine. + */ + +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + +static unsigned char PADDING[64] = { + 0x80, 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 +}; + +// F, G, H and I are basic MD5 functions. +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +// ROTATE_LEFT rotates x left n bits. +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. +// Rotation is separate from addition to prevent recomputation. +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (uint32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (uint32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (uint32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (uint32)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + +// forward declaration +static void MD5Transform(uint32 *state, const unsigned char *block); + +/** + * Encodes input (uint32) into output (unsigned char). Assumes len is + * a multiple of 4. + */ +static void Encode(unsigned char *output, uint32 *input, unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char) (input[i] & 0xff); + output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff); + output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff); + output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff); + } +} + +/** + * Decodes input (unsigned char) into output (uint32). Assumes len is + * a multiple of 4. + */ +static void Decode(uint32 *output, const unsigned char *input, + unsigned int len) { + unsigned int i, j; + for (i = 0, j = 0; j < len; i++, j += 4) { + output[i] = ((uint32) input[j]) | (((uint32) input[j + 1]) << 8) | + (((uint32) input[j + 2]) << 16) | (((uint32) input[j + 3]) << 24); + } +} + +typedef struct { + uint32 state[4]; /* state (ABCD) */ + uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} PHP_MD5_CTX; + +/** + * MD5 initialization. Begins an MD5 operation, writing a new context. + */ +void PHP_MD5Init(PHP_MD5_CTX *context) { + context->count[0] = context->count[1] = 0; + // Load magic initialization constants. + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/** + * MD5 block update operation. Continues an MD5 message-digest + * operation, processing another message block, and updating the context. + */ +void PHP_MD5Update(PHP_MD5_CTX * context, const unsigned char *input, + unsigned int inputLen) { + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((uint32) inputLen << 3)) + < ((uint32) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((uint32) inputLen >> 29); + + partLen = 64 - index; + + // Transform as many times as possible. + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + MD5Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform(context->state, &input[i]); + + index = 0; + } else { + i = 0; + } + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +/** + * MD5 finalization. Ends an MD5 message-digest operation, writing the + * the message digest and zeroizing the context. + */ +void PHP_MD5Final(unsigned char digest[16], PHP_MD5_CTX * context) { + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + Encode(bits, context->count, 8); + + // Pad out to 56 mod 64. + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + PHP_MD5Update(context, PADDING, padLen); + + /* Append length (before padding) */ + PHP_MD5Update(context, bits, 8); + + /* Store state in digest */ + Encode(digest, context->state, 16); + + // Zeroize sensitive information. + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/** + * MD5 basic transformation. Transforms state based on block. + */ +static void MD5Transform(uint32 *state, const unsigned char *block) { + uint32 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode(x, block, 64); + + /* Round 1 */ + FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */ + FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */ + FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */ + FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */ + FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */ + FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */ + FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */ + FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */ + FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */ + FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */ + FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */ + GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */ + GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */ + GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */ + GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */ + GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */ + GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */ + GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */ + GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */ + GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */ + GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */ + HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */ + HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */ + HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */ + HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */ + HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */ + HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */ + HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */ + HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */ + HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */ + II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */ + II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */ + II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */ + II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */ + II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */ + II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */ + II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */ + II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */ + II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. */ + memset((unsigned char*) x, 0, sizeof(x)); +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_md5(const char *arg, int arg_len, bool raw, int &out_len) { + PHP_MD5_CTX context; + unsigned char digest[16]; + + PHP_MD5Init(&context); + PHP_MD5Update(&context, (const unsigned char*)arg, arg_len); + PHP_MD5Final(digest, &context); + if (raw) { + out_len = 16; + return string_duplicate((const char *)digest, 16); + } + + out_len = 16; + return string_bin2hex((const char *)digest, out_len); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_multiply.h b/src/cpp/base/zend/zend_multiply.h new file mode 100644 index 0000000000000..77af143537c2a --- /dev/null +++ b/src/cpp/base/zend/zend_multiply.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#if defined(__i386__) && defined(__GNUC__) + +#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \ + long __tmpvar; \ + __asm__ ("imul %3,%0\n" \ + "adc $0,%1" \ + : "=r"(__tmpvar),"=r"(usedval) \ + : "0"(a), "r"(b), "1"(0)); \ + if (usedval) (dval) = (double) (a) * (double) (b); \ + else (lval) = __tmpvar; \ + } while (0) + +#else + +#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; \ + if ( ((usedval) = (( __dres + __delta ) != __dres))) { \ + (dval) = __dres; \ + } else { \ + (lval) = __lres; \ + } \ + } while (0) + +#endif diff --git a/src/cpp/base/zend/zend_pack.cpp b/src/cpp/base/zend/zend_pack.cpp new file mode 100644 index 0000000000000..a5503886400fb --- /dev/null +++ b/src/cpp/base/zend/zend_pack.cpp @@ -0,0 +1,799 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +namespace HPHP { + +#define INC_OUTPUTPOS(a,b) \ + if ((a) < 0 || ((INT_MAX - outputpos)/((int)b)) < (a)) { \ + throw InvalidArgumentException \ + (0, "Type %c: integer overflow in format string", code); \ + } \ + outputpos += (a)*(b); + +/////////////////////////////////////////////////////////////////////////////// + +ZendPack::ZendPack() { + int machine_endian_check = 1; + int i; + + machine_little_endian = ((char *)&machine_endian_check)[0]; + + if (machine_little_endian) { + /* Where to get lo to hi bytes from */ + byte_map[0] = 0; + + for (i = 0; i < (int)sizeof(int); i++) { + int_map[i] = i; + } + + machine_endian_short_map[0] = 0; + machine_endian_short_map[1] = 1; + big_endian_short_map[0] = 1; + big_endian_short_map[1] = 0; + little_endian_short_map[0] = 0; + little_endian_short_map[1] = 1; + + machine_endian_int32_map[0] = 0; + machine_endian_int32_map[1] = 1; + machine_endian_int32_map[2] = 2; + machine_endian_int32_map[3] = 3; + big_endian_int32_map[0] = 3; + big_endian_int32_map[1] = 2; + big_endian_int32_map[2] = 1; + big_endian_int32_map[3] = 0; + little_endian_int32_map[0] = 0; + little_endian_int32_map[1] = 1; + little_endian_int32_map[2] = 2; + little_endian_int32_map[3] = 3; + } else { + int size = sizeof(int32); + + /* Where to get hi to lo bytes from */ + byte_map[0] = size - 1; + + for (i = 0; i < (int)sizeof(int); i++) { + int_map[i] = size - (sizeof(int) - i); + } + + machine_endian_short_map[0] = size - 2; + machine_endian_short_map[1] = size - 1; + big_endian_short_map[0] = size - 2; + big_endian_short_map[1] = size - 1; + little_endian_short_map[0] = size - 1; + little_endian_short_map[1] = size - 2; + + machine_endian_int32_map[0] = size - 4; + machine_endian_int32_map[1] = size - 3; + machine_endian_int32_map[2] = size - 2; + machine_endian_int32_map[3] = size - 1; + big_endian_int32_map[0] = size - 4; + big_endian_int32_map[1] = size - 3; + big_endian_int32_map[2] = size - 2; + big_endian_int32_map[3] = size - 1; + little_endian_int32_map[0] = size - 1; + little_endian_int32_map[1] = size - 2; + little_endian_int32_map[2] = size - 3; + little_endian_int32_map[3] = size - 4; + } +} + +void ZendPack::pack(CVarRef val, int size, int *map, char *output) { + int32 n = val.toInt32(); + char *v = (char*)&n; + for (int i = 0; i < size; i++) { + *output++ = v[map[i]]; + } +} + +String ZendPack::pack(CStrRef fmt, CArrRef argv) { + /* Preprocess format into formatcodes and formatargs */ + vector formatcodes; + vector formatargs; + int argc = argv.size(); + + const char *format = fmt; + int formatlen = fmt.size(); + int currentarg = 0; + for (int i = 0; i < formatlen; ) { + char code = format[i++]; + int arg = 1; + + /* Handle format arguments if any */ + if (i < formatlen) { + char c = format[i]; + + if (c == '*') { + arg = -1; + i++; + } + else if (c >= '0' && c <= '9') { + arg = atoi(&format[i]); + + while (format[i] >= '0' && format[i] <= '9' && i < formatlen) { + i++; + } + } + } + + /* Handle special arg '*' for all codes and check argv overflows */ + switch ((int) code) { + /* Never uses any args */ + case 'x': + case 'X': + case '@': + if (arg < 0) { + throw InvalidArgumentException(0, "Type %c: '*' ignored", code); + arg = 1; + } + break; + + /* Always uses one arg */ + case 'a': + case 'A': + case 'h': + case 'H': + if (currentarg >= argc) { + throw InvalidArgumentException(0, "Type %c: not enough arguments", + code); + } + + if (arg < 0) { + arg = argv[currentarg].toString().size(); + } + + currentarg++; + break; + + /* Use as many args as specified */ + case 'c': + case 'C': + case 's': + case 'S': + case 'i': + case 'I': + case 'l': + case 'L': + case 'n': + case 'N': + case 'v': + case 'V': + case 'f': + case 'd': + if (arg < 0) { + arg = argc - currentarg; + } + + currentarg += arg; + + if (currentarg > argc) { + throw InvalidArgumentException(0, "Type %c: too few arguments", code); + } + break; + + default: + throw InvalidArgumentException(0, "Type %c: unknown format code", code); + } + + formatcodes.push_back(code); + formatargs.push_back(arg); + } + + if (currentarg < argc) { + throw InvalidArgumentException(0, "%d arguments unused", + (argc - currentarg)); + } + + int outputpos = 0, outputsize = 0; + /* Calculate output length and upper bound while processing*/ + for (int i = 0; i < (int)formatcodes.size(); i++) { + int code = (int) formatcodes[i]; + int arg = formatargs[i]; + + switch ((int) code) { + case 'h': + case 'H': + INC_OUTPUTPOS((arg + (arg % 2)) / 2,1); /* 4 bit per arg */ + break; + + case 'a': + case 'A': + case 'c': + case 'C': + case 'x': + INC_OUTPUTPOS(arg,1); /* 8 bit per arg */ + break; + + case 's': + case 'S': + case 'n': + case 'v': + INC_OUTPUTPOS(arg,2); /* 16 bit per arg */ + break; + + case 'i': + case 'I': + INC_OUTPUTPOS(arg,sizeof(int)); + break; + + case 'l': + case 'L': + case 'N': + case 'V': + INC_OUTPUTPOS(arg,4); /* 32 bit per arg */ + break; + + case 'f': + INC_OUTPUTPOS(arg,sizeof(float)); + break; + + case 'd': + INC_OUTPUTPOS(arg,sizeof(double)); + break; + + case 'X': + outputpos -= arg; + + if (outputpos < 0) { + throw InvalidArgumentException(0, "Type %c: outside of string", code); + outputpos = 0; + } + break; + + case '@': + outputpos = arg; + break; + } + + if (outputsize < outputpos) { + outputsize = outputpos; + } + } + + char *output = (char*)malloc(outputsize + 1); + outputpos = 0; + currentarg = 0; + + /* Do actual packing */ + for (int i = 0; i < (int)formatcodes.size(); i++) { + int code = (int) formatcodes[i]; + int arg = formatargs[i]; + String val; + const char *s; + int slen; + + switch ((int) code) { + case 'a': + case 'A': + memset(&output[outputpos], (code == 'a') ? '\0' : ' ', arg); + val = argv[currentarg++].toString(); + s = (const char *)val; + slen = val.size(); + memcpy(&output[outputpos], s, (slen < arg) ? slen : arg); + outputpos += arg; + break; + + case 'h': + case 'H': { + int nibbleshift = (code == 'h') ? 0 : 4; + int first = 1; + const char *v; + + val = argv[currentarg++].toString(); + v = val.data(); + slen = val.size(); + outputpos--; + if(arg > slen) { + throw InvalidArgumentException + (0, "Type %c: not enough characters in string", code); + arg = slen; + } + + while (arg-- > 0) { + char n = *v++; + + if (n >= '0' && n <= '9') { + n -= '0'; + } else if (n >= 'A' && n <= 'F') { + n -= ('A' - 10); + } else if (n >= 'a' && n <= 'f') { + n -= ('a' - 10); + } else { + throw InvalidArgumentException(0, "Type %c: illegal hex digit %c", + code, n); + n = 0; + } + + if (first--) { + output[++outputpos] = 0; + } else { + first = 1; + } + + output[outputpos] |= (n << nibbleshift); + nibbleshift = (nibbleshift + 4) & 7; + } + + outputpos++; + break; + } + + case 'c': + case 'C': + while (arg-- > 0) { + pack(argv[currentarg++], 1, byte_map, &output[outputpos]); + outputpos++; + } + break; + + case 's': + case 'S': + case 'n': + case 'v': { + int *map = machine_endian_short_map; + + if (code == 'n') { + map = big_endian_short_map; + } else if (code == 'v') { + map = little_endian_short_map; + } + + while (arg-- > 0) { + pack(argv[currentarg++], 2, map, &output[outputpos]); + outputpos += 2; + } + break; + } + + case 'i': + case 'I': + while (arg-- > 0) { + pack(argv[currentarg++], sizeof(int), int_map, &output[outputpos]); + outputpos += sizeof(int); + } + break; + + case 'l': + case 'L': + case 'N': + case 'V': { + int *map = machine_endian_int32_map; + + if (code == 'N') { + map = big_endian_int32_map; + } else if (code == 'V') { + map = little_endian_int32_map; + } + + while (arg-- > 0) { + pack(argv[currentarg++], 4, map, &output[outputpos]); + outputpos += 4; + } + break; + } + + case 'f': { + float v; + + while (arg-- > 0) { + v = argv[currentarg++].toDouble(); + memcpy(&output[outputpos], &v, sizeof(v)); + outputpos += sizeof(v); + } + break; + } + + case 'd': { + double v; + + while (arg-- > 0) { + v = argv[currentarg++].toDouble(); + memcpy(&output[outputpos], &v, sizeof(v)); + outputpos += sizeof(v); + } + break; + } + + case 'x': + memset(&output[outputpos], '\0', arg); + outputpos += arg; + break; + + case 'X': + outputpos -= arg; + + if (outputpos < 0) { + outputpos = 0; + } + break; + + case '@': + if (arg > outputpos) { + memset(&output[outputpos], '\0', arg - outputpos); + } + outputpos = arg; + break; + } + } + + output[outputpos] = '\0'; + return String(output, outputpos, AttachString); +} + +int32 ZendPack::unpack(const char *data, int size, int issigned, int *map) { + int32 result; + char *cresult = (char *) &result; + int i; + + result = issigned ? -1 : 0; + + for (i = 0; i < size; i++) { + cresult[map[i]] = *data++; + } + + return result; +} + +Array ZendPack::unpack(CStrRef fmt, CStrRef data) { + const char *format = fmt; + int formatlen = fmt.size(); + const char *input = data; + int inputlen = data.size(); + int inputpos = 0; + + Array ret; + while (formatlen-- > 0) { + char type = *(format++); + char c; + int arg = 1, argb; + const char *name; + int namelen; + int size=0; + + /* Handle format arguments if any */ + if (formatlen > 0) { + c = *format; + + if (c >= '0' && c <= '9') { + arg = atoi(format); + + while (formatlen > 0 && *format >= '0' && *format <= '9') { + format++; + formatlen--; + } + } else if (c == '*') { + arg = -1; + format++; + formatlen--; + } + } + + /* Get of new value in array */ + name = format; + argb = arg; + + while (formatlen > 0 && *format != '/') { + formatlen--; + format++; + } + + namelen = format - name; + + if (namelen > 200) + namelen = 200; + + switch ((int) type) { + /* Never use any input */ + case 'X': + size = -1; + break; + + case '@': + size = 0; + break; + + case 'a': + case 'A': + size = arg; + arg = 1; + break; + + case 'h': + case 'H': + size = (arg > 0) ? (arg + (arg % 2)) / 2 : arg; + arg = 1; + break; + + /* Use 1 byte of input */ + case 'c': + case 'C': + case 'x': + size = 1; + break; + + /* Use 2 bytes of input */ + case 's': + case 'S': + case 'n': + case 'v': + size = 2; + break; + + /* Use sizeof(int) bytes of input */ + case 'i': + case 'I': + size = sizeof(int); + break; + + /* Use 4 bytes of input */ + case 'l': + case 'L': + case 'N': + case 'V': + size = 4; + break; + + /* Use sizeof(float) bytes of input */ + case 'f': + size = sizeof(float); + break; + + /* Use sizeof(double) bytes of input */ + case 'd': + size = sizeof(double); + break; + + default: + throw InvalidArgumentException(0, "Invalid format type %c", type); + } + + /* Do actual unpacking */ + for (int i = 0; i != arg; i++ ) { + /* Space for name + number, safe as namelen is ensured <= 200 */ + char n[256]; + + if (arg != 1 || namelen == 0) { + /* Need to add element number to name */ + snprintf(n, sizeof(n), "%.*s%d", namelen, name, i + 1); + } else { + /* Truncate name to next format code or end of string */ + snprintf(n, sizeof(n), "%.*s", namelen, name); + } + + if (size != 0 && size != -1 && INT_MAX - size + 1 < inputpos) { + throw InvalidArgumentException(0, "Type %c: integer overflow", type); + inputpos = 0; + } + + if ((inputpos + size) <= inputlen) { + switch ((int) type) { + case 'a': + case 'A': { + char pad = (type == 'a') ? '\0' : ' '; + int len = inputlen - inputpos; /* Remaining string */ + + /* If size was given take minimum of len and size */ + if ((size >= 0) && (len > size)) { + len = size; + } + + size = len; + + /* Remove padding chars from unpacked data */ + while (--len >= 0) { + if (input[inputpos + len] != pad) + break; + } + + ret.set(String(n, CopyString), + String(input + inputpos, len + 1, CopyString)); + break; + } + + case 'h': + case 'H': { + int len = (inputlen - inputpos) * 2; /* Remaining */ + int nibbleshift = (type == 'h') ? 0 : 4; + int first = 1; + char *buf; + int ipos, opos; + + /* If size was given take minimum of len and size */ + if (size >= 0 && len > (size * 2)) { + len = size * 2; + } + + if (argb > 0) { + len -= argb % 2; + } + + buf = (char*)malloc(len + 1); + + for (ipos = opos = 0; opos < len; opos++) { + char c = (input[inputpos + ipos] >> nibbleshift) & 0xf; + + if (c < 10) { + c += '0'; + } else { + c += 'a' - 10; + } + + buf[opos] = c; + nibbleshift = (nibbleshift + 4) & 7; + + if (first-- == 0) { + ipos++; + first = 1; + } + } + + buf[len] = '\0'; + ret.set(String(n, CopyString), String(buf, len, AttachString)); + break; + } + + case 'c': + case 'C': { + int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0; + ret.set(String(n, CopyString), + unpack(&input[inputpos], 1, issigned, byte_map)); + break; + } + + case 's': + case 'S': + case 'n': + case 'v': { + int issigned = 0; + int *map = machine_endian_short_map; + + if (type == 's') { + issigned = input[inputpos + (machine_little_endian ? 1 : 0)] & + 0x80; + } else if (type == 'n') { + map = big_endian_short_map; + } else if (type == 'v') { + map = little_endian_short_map; + } + + ret.set(String(n, CopyString), + unpack(&input[inputpos], 2, issigned, map)); + break; + } + + case 'i': + case 'I': { + int32 v = 0; + int issigned = 0; + + if (type == 'i') { + issigned = input[inputpos + (machine_little_endian ? + (sizeof(int) - 1) : 0)] & 0x80; + } else if (sizeof(int32) > 4 && + (input[inputpos + machine_endian_int32_map[3]] + & 0x80) == 0x80) { + v = ~INT_MAX; + } + + v |= unpack(&input[inputpos], sizeof(int), issigned, int_map); + ret.set(String(n, CopyString), v); + break; + } + + case 'l': + case 'L': + case 'N': + case 'V': { + int issigned = 0; + int *map = machine_endian_int32_map; + int32 v = 0; + + if (type == 'l' || type == 'L') { + issigned = input[inputpos + (machine_little_endian ? 3 : 0)] + & 0x80; + } else if (type == 'N') { + issigned = input[inputpos] & 0x80; + map = big_endian_int32_map; + } else if (type == 'V') { + issigned = input[inputpos + 3] & 0x80; + map = little_endian_int32_map; + } + + if (sizeof(int32) > 4 && issigned) { + v = ~INT_MAX; + } + + v |= unpack(&input[inputpos], 4, issigned, map); + ret.set(String(n, CopyString), v); + break; + } + + case 'f': { + float v; + + memcpy(&v, &input[inputpos], sizeof(float)); + ret.set(String(n, CopyString), (double)v); + break; + } + + case 'd': { + double v; + + memcpy(&v, &input[inputpos], sizeof(double)); + ret.set(String(n, CopyString), v); + break; + } + + case 'x': + /* Do nothing with input, just skip it */ + break; + + case 'X': + if (inputpos < size) { + inputpos = -size; + i = arg - 1; /* Break out of for loop */ + + if (arg >= 0) { + throw InvalidArgumentException(0, "Type %c: outside of string", + type); + } + } + break; + + case '@': + if (arg <= inputlen) { + inputpos = arg; + } else { + throw InvalidArgumentException(0, "Type %c: outside of string", + type); + } + + i = arg - 1; /* Done, break out of for loop */ + break; + } + + inputpos += size; + if (inputpos < 0) { + if (size != -1) { /* only print warning if not working with * */ + throw InvalidArgumentException(0, "Type %c: outside of string", + type); + } + inputpos = 0; + } + } else if (arg < 0) { + /* Reached end of input for '*' repeater */ + break; + } else { + throw InvalidArgumentException + (0, "Type %c: not enough input, need %d, have %d", + type, size, inputlen - inputpos); + } + } + + formatlen--; /* Skip '/' separator, does no harm if inputlen == 0 */ + format++; + } + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_pack.h b/src/cpp/base/zend/zend_pack.h new file mode 100644 index 0000000000000..67b6d73a5af0c --- /dev/null +++ b/src/cpp/base/zend/zend_pack.h @@ -0,0 +1,86 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_PACK_H__ +#define __HPHP_ZEND_PACK_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// pack/unpack + +/** + * Implemented formats are A, a, h, H, c, C, s, S, i, I, l, L, n, N, f, d, + * x, X, @. + */ +class ZendPack { +public: + ZendPack(); + + /** + * Takes one or more arguments and packs them into a binary string according + * to the format argument. pack() idea stolen from Perl (implemented formats + * behave the same as there). + */ + String pack(CStrRef fmt, CArrRef argv); + + /** + * Unpack binary string into named array elements according to format + * argument. + * + * unpack() is based on Perl's unpack(), but is modified a bit from there. + * Rather than depending on error-prone ordered lists or syntactically + * unpleasant pass-by-reference, we return an object with named paramters + * (like *_fetch_object()). Syntax is "f[repeat]name/...", where "f" is the + * formatter char (like pack()), "[repeat]" is the optional repeater + * argument, and "name" is the name of the variable to use. + * Example: "c2chars/nints" will return an object with fields + * chars1, chars2, and ints. + * Numeric pack types will return numbers, a and A will return strings, + * f and d will return doubles. + */ + Array unpack(CStrRef fmt, CStrRef data); + +private: + // Whether machine is little endian + char machine_little_endian; + + // Mapping of byte from char (8bit) to int32 for machine endian + int byte_map[1]; + + // Mappings of bytes from int (machine dependant) to int for machine endian + int int_map[sizeof(int)]; + + // Mappings of bytes from shorts (16bit) for all endian environments + int machine_endian_short_map[2]; + int big_endian_short_map[2]; + int little_endian_short_map[2]; + + // Mappings of bytes from int32s (32bit) for all endian environments + int machine_endian_int32_map[4]; + int big_endian_int32_map[4]; + int little_endian_int32_map[4]; + + void pack(CVarRef val, int size, int *map, char *output); + int32 unpack(const char *data, int size, int issigned, int *map); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_PACK_H__ diff --git a/src/cpp/base/zend/zend_php_config.h b/src/cpp/base/zend/zend_php_config.h new file mode 100644 index 0000000000000..33cb11ffc7feb --- /dev/null +++ b/src/cpp/base/zend/zend_php_config.h @@ -0,0 +1,2414 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +/* $Id: acconfig.h,v 1.40.2.1.2.1 2007/01/01 09:35:45 sebastian Exp $ */ +#define ZEND_API +#define ZEND_DLEXPORT +#define ZEND_DLIMPORT + + +/* #undef uint */ +/* #undef ulong */ + +/* Define if you want to enable memory limit support */ +#define MEMORY_LIMIT 0 + + +/* */ +/* #undef AIX */ + +/* */ +/* #undef APC_FUTEX_LOCKS */ + +/* */ +#define APC_MMAP 1 + +/* */ +#define APC_PTHREADMUTEX_LOCKS 1 + +/* */ +#define APC_REQFILES 1 + +/* */ +/* #undef APC_SEM_LOCKS */ + +/* */ +/* #undef APC_SPIN_LOCKS */ + +/* Whether to use native BeOS threads */ +/* #undef BETHREADS */ + +/* Enabling BIND8 compatibility for Panther */ +/* #undef BIND_8_COMPAT */ + +/* */ +/* #undef CDB_INCLUDE_FILE */ + +/* Define if system uses EBCDIC */ +/* #undef CHARSET_EBCDIC */ + +/* Whether to build apc as dynamic module */ +/* #undef COMPILE_DL_APC */ + +/* Whether to build bcmath as dynamic module */ +/* #undef COMPILE_DL_BCMATH */ + +/* Whether to build bz2 as dynamic module */ +/* #undef COMPILE_DL_BZ2 */ + +/* Whether to build calendar as dynamic module */ +/* #undef COMPILE_DL_CALENDAR */ + +/* Whether to build ctype as dynamic module */ +/* #undef COMPILE_DL_CTYPE */ + +/* Whether to build curl as dynamic module */ +/* #undef COMPILE_DL_CURL */ + +/* Whether to build date as dynamic module */ +/* #undef COMPILE_DL_DATE */ + +/* Whether to build dba as dynamic module */ +/* #undef COMPILE_DL_DBA */ + +/* Whether to build dbase as dynamic module */ +/* #undef COMPILE_DL_DBASE */ + +/* Whether to build dom as dynamic module */ +/* #undef COMPILE_DL_DOM */ + +/* Whether to build exif as dynamic module */ +/* #undef COMPILE_DL_EXIF */ + +/* Whether to build fbsql as dynamic module */ +/* #undef COMPILE_DL_FBSQL */ + +/* Whether to build fdf as dynamic module */ +/* #undef COMPILE_DL_FDF */ + +/* Whether to build filter as dynamic module */ +/* #undef COMPILE_DL_FILTER */ + +/* Whether to build ftp as dynamic module */ +/* #undef COMPILE_DL_FTP */ + +/* Whether to build gd as dynamic module */ +/* #undef COMPILE_DL_GD */ + +/* Whether to build gettext as dynamic module */ +/* #undef COMPILE_DL_GETTEXT */ + +/* Whether to build gmp as dynamic module */ +/* #undef COMPILE_DL_GMP */ + +/* Whether to build hash as dynamic module */ +/* #undef COMPILE_DL_HASH */ + +/* Whether to build iconv as dynamic module */ +/* #undef COMPILE_DL_ICONV */ + +/* Whether to build imap as dynamic module */ +/* #undef COMPILE_DL_IMAP */ + +/* Whether to build interbase as dynamic module */ +/* #undef COMPILE_DL_INTERBASE */ + +/* Whether to build json as dynamic module */ +/* #undef COMPILE_DL_JSON */ + +/* Whether to build ldap as dynamic module */ +/* #undef COMPILE_DL_LDAP */ + +/* Whether to build libxml as dynamic module */ +/* #undef COMPILE_DL_LIBXML */ + +/* Whether to build mbstring as dynamic module */ +/* #undef COMPILE_DL_MBSTRING */ + +/* Whether to build mcrypt as dynamic module */ +/* #undef COMPILE_DL_MCRYPT */ + +/* Whether to build mhash as dynamic module */ +/* #undef COMPILE_DL_MHASH */ + +/* Whether to build mime_magic as dynamic module */ +/* #undef COMPILE_DL_MIME_MAGIC */ + +/* Whether to build ming as dynamic module */ +/* #undef COMPILE_DL_MING */ + +/* Whether to build msql as dynamic module */ +/* #undef COMPILE_DL_MSQL */ + +/* Whether to build mssql as dynamic module */ +/* #undef COMPILE_DL_MSSQL */ + +/* Whether to build mysql as dynamic module */ +/* #undef COMPILE_DL_MYSQL */ + +/* Whether to build mysqli as dynamic module */ +/* #undef COMPILE_DL_MYSQLI */ + +/* Whether to build ncurses as dynamic module */ +/* #undef COMPILE_DL_NCURSES */ + +/* Whether to build oci8 as dynamic module */ +/* #undef COMPILE_DL_OCI8 */ + +/* Whether to build odbc as dynamic module */ +/* #undef COMPILE_DL_ODBC */ + +/* Whether to build openssl as dynamic module */ +/* #undef COMPILE_DL_OPENSSL */ + +/* Whether to build pcntl as dynamic module */ +/* #undef COMPILE_DL_PCNTL */ + +/* Whether to build pcre as dynamic module */ +/* #undef COMPILE_DL_PCRE */ + +/* Whether to build pdo as dynamic module */ +/* #undef COMPILE_DL_PDO */ + +/* Whether to build pdo_dblib as dynamic module */ +/* #undef COMPILE_DL_PDO_DBLIB */ + +/* Whether to build pdo_firebird as dynamic module */ +/* #undef COMPILE_DL_PDO_FIREBIRD */ + +/* Whether to build pdo_mysql as dynamic module */ +/* #undef COMPILE_DL_PDO_MYSQL */ + +/* Whether to build pdo_oci as dynamic module */ +/* #undef COMPILE_DL_PDO_OCI */ + +/* Whether to build pdo_odbc as dynamic module */ +/* #undef COMPILE_DL_PDO_ODBC */ + +/* Whether to build pdo_pgsql as dynamic module */ +/* #undef COMPILE_DL_PDO_PGSQL */ + +/* Whether to build pdo_sqlite as dynamic module */ +/* #undef COMPILE_DL_PDO_SQLITE */ + +/* Whether to build pgsql as dynamic module */ +/* #undef COMPILE_DL_PGSQL */ + +/* Whether to build posix as dynamic module */ +/* #undef COMPILE_DL_POSIX */ + +/* Whether to build pspell as dynamic module */ +/* #undef COMPILE_DL_PSPELL */ + +/* Whether to build readline as dynamic module */ +/* #undef COMPILE_DL_READLINE */ + +/* Whether to build recode as dynamic module */ +/* #undef COMPILE_DL_RECODE */ + +/* Whether to build reflection as dynamic module */ +/* #undef COMPILE_DL_REFLECTION */ + +/* Whether to build session as dynamic module */ +/* #undef COMPILE_DL_SESSION */ + +/* Whether to build shmop as dynamic module */ +/* #undef COMPILE_DL_SHMOP */ + +/* Whether to build simplexml as dynamic module */ +/* #undef COMPILE_DL_SIMPLEXML */ + +/* Whether to build snmp as dynamic module */ +/* #undef COMPILE_DL_SNMP */ + +/* Whether to build soap as dynamic module */ +/* #undef COMPILE_DL_SOAP */ + +/* Whether to build sockets as dynamic module */ +/* #undef COMPILE_DL_SOCKETS */ + +/* Whether to build spl as dynamic module */ +/* #undef COMPILE_DL_SPL */ + +/* Whether to build sqlite as dynamic module */ +/* #undef COMPILE_DL_SQLITE */ + +/* Whether to build standard as dynamic module */ +/* #undef COMPILE_DL_STANDARD */ + +/* Whether to build sybase as dynamic module */ +/* #undef COMPILE_DL_SYBASE */ + +/* Whether to build sybase_ct as dynamic module */ +/* #undef COMPILE_DL_SYBASE_CT */ + +/* Whether to build sysvmsg as dynamic module */ +/* #undef COMPILE_DL_SYSVMSG */ + +/* Whether to build sysvsem as dynamic module */ +/* #undef COMPILE_DL_SYSVSEM */ + +/* Whether to build sysvshm as dynamic module */ +/* #undef COMPILE_DL_SYSVSHM */ + +/* Whether to build tidy as dynamic module */ +/* #undef COMPILE_DL_TIDY */ + +/* Whether to build tokenizer as dynamic module */ +/* #undef COMPILE_DL_TOKENIZER */ + +/* Whether to build wddx as dynamic module */ +/* #undef COMPILE_DL_WDDX */ + +/* Whether to build xml as dynamic module */ +/* #undef COMPILE_DL_XML */ + +/* Whether to build xmlreader as dynamic module */ +/* #undef COMPILE_DL_XMLREADER */ + +/* Whether to build xmlrpc as dynamic module */ +/* #undef COMPILE_DL_XMLRPC */ + +/* Whether to build xmlwriter as dynamic module */ +/* #undef COMPILE_DL_XMLWRITER */ + +/* Whether to build xsl as dynamic module */ +/* #undef COMPILE_DL_XSL */ + +/* Whether to build zip as dynamic module */ +/* #undef COMPILE_DL_ZIP */ + +/* Whether to build zlib as dynamic module */ +/* #undef COMPILE_DL_ZLIB */ + +/* */ +#define COOKIE_IO_FUNCTIONS_T cookie_io_functions_t + +/* */ +#define COOKIE_SEEKER_USES_OFF64_T 1 + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define if crypt_r has uses CRYPTD */ +/* #undef CRYPT_R_CRYPTD */ + +/* Define if struct crypt_data requires _GNU_SOURCE */ +/* #undef CRYPT_R_GNU_SOURCE */ + +/* Define if crypt_r uses struct crypt_data */ +/* #undef CRYPT_R_STRUCT_CRYPT_DATA */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define if the target system is darwin */ +/* #undef DARWIN */ + +/* */ +/* #undef DB1_INCLUDE_FILE */ + +/* */ +/* #undef DB1_VERSION */ + +/* */ +/* #undef DB2_INCLUDE_FILE */ + +/* */ +/* #undef DB3_INCLUDE_FILE */ + +/* */ +/* #undef DB4_INCLUDE_FILE */ + +/* */ +/* #undef DBASE */ + +/* */ +/* #undef DBA_CDB */ + +/* */ +/* #undef DBA_CDB_BUILTIN */ + +/* */ +/* #undef DBA_CDB_MAKE */ + +/* */ +/* #undef DBA_DB1 */ + +/* */ +/* #undef DBA_DB2 */ + +/* */ +/* #undef DBA_DB3 */ + +/* */ +/* #undef DBA_DB4 */ + +/* */ +/* #undef DBA_DBM */ + +/* */ +/* #undef DBA_FLATFILE */ + +/* */ +/* #undef DBA_GDBM */ + +/* */ +/* #undef DBA_INIFILE */ + +/* */ +/* #undef DBA_NDBM */ + +/* */ +/* #undef DBA_QDBM */ + +/* */ +/* #undef DBMFIX */ + +/* */ +/* #undef DBM_INCLUDE_FILE */ + +/* */ +/* #undef DBM_VERSION */ + +/* */ +#define DEFAULT_SHORT_OPEN_TAG "1" + +/* */ +/* #undef DISCARD_PATH */ + +/* Define if dlsym() requires a leading underscore in symbol names. */ +/* #undef DLSYM_NEEDS_UNDERSCORE */ + +/* Whether to enable chroot() function */ +/* #undef ENABLE_CHROOT_FUNC */ + +/* */ +/* #undef ENABLE_PATHINFO_CHECK */ + +/* */ +/* #undef FORCE_CGI_REDIRECT */ + +/* */ +/* #undef GDBM_INCLUDE_FILE */ + +/* Whether you use GNU Pth */ +/* #undef GNUPTH */ + +/* Whether 3 arg set_rebind_proc() */ +/* #undef HAVE_3ARG_SETREBINDPROC */ + +/* Define to 1 if you have the `acosh' function. */ +#define HAVE_ACOSH 1 + +/* */ +/* #undef HAVE_ADABAS */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the `alphasort' function. */ +#define HAVE_ALPHASORT 1 + +/* Whether you have AOLserver */ +/* #undef HAVE_AOLSERVER */ + +/* */ +#define HAVE_APACHE 1 + +/* */ +/* #undef HAVE_APACHE_HOOKS */ + +/* */ +#define HAVE_APC 1 + +/* Define to 1 if you have the + header file. */ +/* #undef HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H */ + +/* */ +#define HAVE_AP_COMPAT_H 1 + +/* */ +#define HAVE_AP_CONFIG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_NAMESER_H 1 + +/* Define to 1 if you have the `asctime_r' function. */ +#define HAVE_ASCTIME_R 1 + +/* Define to 1 if you have the `asinh' function. */ +#define HAVE_ASINH 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the `atanh' function. */ +#define HAVE_ATANH 1 + +/* whether atof() accepts INF */ +#define HAVE_ATOF_ACCEPTS_INF 1 + +/* whether atof() accepts NAN */ +#define HAVE_ATOF_ACCEPTS_NAN 1 + +/* Define to 1 if you have the `atoll' function. */ +#define HAVE_ATOLL 1 + +/* Whether you have bcmath */ +#define HAVE_BCMATH 1 + +/* */ +/* #undef HAVE_BIND_TEXTDOMAIN_CODESET */ + +/* */ +/* #undef HAVE_BIRDSTEP */ + +/* Define if system has broken getcwd */ +/* #undef HAVE_BROKEN_GETCWD */ + +/* Define if your glibc borks on fopen with mode a+ */ +#define HAVE_BROKEN_GLIBC_FOPEN_APPEND 1 + +/* Whether we have librecode 3.5 */ +/* #undef HAVE_BROKEN_RECODE */ + +/* Konstantin Chuguev's iconv implementation */ +/* #undef HAVE_BSD_ICONV */ + +/* */ +#define HAVE_BUILD_DEFS_H 1 + +/* */ +#define HAVE_BUNDLED_PCRE 1 + +/* */ +/* #undef HAVE_BZ2 */ + +/* */ +/* #undef HAVE_CALENDAR */ + +/* Whether to compile with Caudium support */ +/* #undef HAVE_CAUDIUM */ + +/* Define to 1 if you have the `chroot' function. */ +#define HAVE_CHROOT 1 + +/* */ +/* #undef HAVE_CLI0CLI_H */ + +/* */ +/* #undef HAVE_CLI0CORE_H */ + +/* */ +/* #undef HAVE_CLI0DEFS_H */ + +/* */ +/* #undef HAVE_CLI0ENV_H */ + +/* */ +/* #undef HAVE_CLI0EXT_H */ + +/* Whether you have struct cmsghdr */ +#define HAVE_CMSGHDR 1 + +/* */ +/* #undef HAVE_CODBC */ + +/* */ +#define HAVE_COLORCLOSESTHWB 1 + +/* Whether you have a Continuity Server */ +/* #undef HAVE_CONTINUITY */ + +/* Define to 1 if you have the `CreateProcess' function. */ +/* #undef HAVE_CREATEPROCESS */ + +/* */ +#define HAVE_CRYPT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CRYPT_H 1 + +/* Define to 1 if you have the `crypt_r' function. */ +/* #undef HAVE_CRYPT_R */ + +/* Define to 1 if you have the `ctermid' function. */ +/* #undef HAVE_CTERMID */ + +/* Define to 1 if you have the `ctime_r' function. */ +#define HAVE_CTIME_R 1 + +/* */ +#define HAVE_CTYPE 1 + +/* */ +#define HAVE_CURL 1 + +/* */ +#define HAVE_CURL_EASY_STRERROR 1 + +/* Have cURL with GnuTLS support */ +/* #undef HAVE_CURL_GNUTLS */ + +/* */ +#define HAVE_CURL_MULTI_STRERROR 1 + +/* Have cURL with OpenSSL support */ +#define HAVE_CURL_OPENSSL 1 + +/* Have cURL with SSL support */ +#define HAVE_CURL_SSL 1 + +/* */ +#define HAVE_CURL_VERSION_INFO 1 + +/* Define to 1 if you have the `cuserid' function. */ +#define HAVE_CUSERID 1 + +/* */ +/* #undef HAVE_DBA */ + +/* Whether you want DBMaker */ +/* #undef HAVE_DBMAKER */ + +/* */ +/* #undef HAVE_DCNGETTEXT */ + +/* Whether system headers declare timezone */ +#define HAVE_DECLARED_TIMEZONE 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DEFAULT_STORE_H */ + +/* */ +/* #undef HAVE_DESTROY_SWF_BLOCK */ + +/* Define if the target system has /dev/urandom device */ +#define HAVE_DEV_URANDOM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* */ +#define HAVE_DLOPEN 1 + +/* Whether you have dmalloc */ +/* #undef HAVE_DMALLOC */ + +/* */ +/* #undef HAVE_DNGETTEXT */ + +/* */ +#define HAVE_DN_EXPAND 1 + +/* */ +#define HAVE_DN_SKIPNAME 1 + +/* */ +#define HAVE_DOM 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* OpenSSL 0.9.7 or later */ +/* #undef HAVE_DSA_DEFAULT_METHOD */ + +/* embedded MySQL support enabled */ +/* #undef HAVE_EMBEDDED_MYSQLI */ + +/* */ +/* #undef HAVE_EMPRESS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* */ +/* #undef HAVE_ESOOB */ + +/* Whether you want EXIF (metadata from images) support */ +#define HAVE_EXIF 1 + +/* Define to 1 if you have the `fabsf' function. */ +#define HAVE_FABSF 1 + +/* Whether you have FrontBase */ +/* #undef HAVE_FBSQL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* */ +/* #undef HAVE_FDFLIB */ + +/* */ +/* #undef HAVE_FDFTK_5 */ + +/* */ +/* #undef HAVE_FDFTK_H_LOWER */ + +/* Define to 1 if you have the `finite' function. */ +#define HAVE_FINITE 1 + +/* Define to 1 if you have the `flock' function. */ +#define HAVE_FLOCK 1 + +/* Define to 1 if you have the `floorf' function. */ +#define HAVE_FLOORF 1 + +/* Define if flush should be called explicitly after a buffered io. */ +/* #undef HAVE_FLUSHIO */ + +/* Define to 1 if your system has a working POSIX `fnmatch' function. */ +#define HAVE_FNMATCH 1 + +/* */ +#define HAVE_FOPENCOOKIE 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the `fpclass' function. */ +/* #undef HAVE_FPCLASS */ + +/* whether floatingpoint.h defines fp_except */ +/* #undef HAVE_FP_EXCEPT */ + +/* */ +/* #undef HAVE_FREETDS */ + +/* Define to 1 if you have the `ftok' function. */ +#define HAVE_FTOK 1 + +/* Whether you want FTP support */ +/* #undef HAVE_FTP */ + +/* Define to 1 if you have the `funopen' function. */ +/* #undef HAVE_FUNOPEN */ + +/* Define to 1 if you have the `gai_strerror' function. */ +#define HAVE_GAI_STRERROR 1 + +/* Whether you have gcov */ +/* #undef HAVE_GCOV */ + +/* Define to 1 if you have the `gcvt' function. */ +#define HAVE_GCVT 1 + +/* */ +#define HAVE_GDIMAGECOLORRESOLVE 1 + +/* */ +#define HAVE_GD_BUNDLED 1 + +/* */ +/* #undef HAVE_GD_CACHE_CREATE */ + +/* */ +#define HAVE_GD_DYNAMIC_CTX_EX 1 + +/* */ +#define HAVE_GD_FONTCACHESHUTDOWN 1 + +/* */ +#define HAVE_GD_FONTMUTEX 1 + +/* */ +/* #undef HAVE_GD_FREEFONTCACHE */ + +/* */ +#define HAVE_GD_GD2 1 + +/* */ +#define HAVE_GD_GIF_CREATE 1 + +/* */ +#define HAVE_GD_GIF_CTX 1 + +/* */ +#define HAVE_GD_GIF_READ 1 + +/* */ +#define HAVE_GD_IMAGEELLIPSE 1 + +/* */ +#define HAVE_GD_IMAGESETBRUSH 1 + +/* */ +#define HAVE_GD_IMAGESETTILE 1 + +/* */ +#define HAVE_GD_JPG 1 + +/* */ +#define HAVE_GD_PNG 1 + +/* */ +#define HAVE_GD_STRINGFT 1 + +/* */ +#define HAVE_GD_STRINGFTEX 1 + +/* */ +/* #undef HAVE_GD_STRINGTTF */ + +/* */ +#define HAVE_GD_WBMP 1 + +/* */ +#define HAVE_GD_XBM 1 + +/* */ +/* #undef HAVE_GD_XPM */ + +/* Define if you have the getaddrinfo function */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getgrgid_r' function. */ +/* #undef HAVE_GETGRGID_R */ + +/* Define to 1 if you have the `getgrnam_r' function. */ +#define HAVE_GETGRNAM_R 1 + +/* Define to 1 if you have the `getgroups' function. */ +/* #undef HAVE_GETGROUPS */ + +/* */ +#define HAVE_GETHOSTBYADDR 1 + +/* */ +#define HAVE_GETHOSTBYNAME2 1 + +/* */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have the `getloadavg' function. */ +#define HAVE_GETLOADAVG 1 + +/* Define to 1 if you have the `getlogin' function. */ +#define HAVE_GETLOGIN 1 + +/* Define to 1 if you have the `getopt' function. */ +#define HAVE_GETOPT 1 + +/* Define to 1 if you have the `getpgid' function. */ +/* #undef HAVE_GETPGID */ + +/* Define to 1 if you have the `getpid' function. */ +#define HAVE_GETPID 1 + +/* Define to 1 if you have the `getpriority' function. */ +/* #undef HAVE_GETPRIORITY */ + +/* Define to 1 if you have the `getprotobyname' function. */ +#define HAVE_GETPROTOBYNAME 1 + +/* Define to 1 if you have the `getprotobynumber' function. */ +#define HAVE_GETPROTOBYNUMBER 1 + +/* Define to 1 if you have the `getpwnam_r' function. */ +#define HAVE_GETPWNAM_R 1 + +/* Define to 1 if you have the `getpwuid_r' function. */ +#define HAVE_GETPWUID_R 1 + +/* Define to 1 if you have the `getrlimit' function. */ +/* #undef HAVE_GETRLIMIT */ + +/* Define to 1 if you have the `getrusage' function. */ +#define HAVE_GETRUSAGE 1 + +/* Define to 1 if you have the `getservbyname' function. */ +#define HAVE_GETSERVBYNAME 1 + +/* Define to 1 if you have the `getservbyport' function. */ +#define HAVE_GETSERVBYPORT 1 + +/* Define to 1 if you have the `getsid' function. */ +/* #undef HAVE_GETSID */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `getwd' function. */ +#define HAVE_GETWD 1 + +/* */ +/* #undef HAVE_GICONV_H */ + +/* glibc's iconv implementation */ +#define HAVE_GLIBC_ICONV 1 + +/* Define to 1 if you have the `glob' function. */ +#define HAVE_GLOB 1 + +/* */ +/* #undef HAVE_GMP */ + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* Define to 1 if you have the `grantpt' function. */ +#define HAVE_GRANTPT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GRP_H 1 + +/* Have HASH Extension */ +#define HAVE_HASH_EXT 1 + +/* Define to 1 if you have the `hstrerror' function. */ +#define HAVE_HSTRERROR 1 + +/* */ +#define HAVE_HTONL 1 + +/* whether HUGE_VAL == INF */ +#define HAVE_HUGE_VAL_INF 1 + +/* whether HUGE_VAL + -HUGEVAL == NAN */ +#define HAVE_HUGE_VAL_NAN 1 + +/* Define to 1 if you have the `hypot' function. */ +#define HAVE_HYPOT 1 + +/* */ +/* #undef HAVE_IBASE */ + +/* */ +/* #undef HAVE_IBMDB2 */ + +/* */ +#define HAVE_ICONV 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IEEEFP_H */ + +/* */ +/* #undef HAVE_IMAP */ + +/* */ +/* #undef HAVE_IMAP2000 */ + +/* */ +/* #undef HAVE_IMAP2001 */ + +/* */ +/* #undef HAVE_IMAP2004 */ + +/* */ +/* #undef HAVE_IMAP_AUTH_GSS */ + +/* */ +/* #undef HAVE_IMAP_KRB */ + +/* */ +/* #undef HAVE_IMAP_SSL */ + +/* */ +#define HAVE_INET_ATON 1 + +/* Define to 1 if you have the `inet_ntoa' function. */ +#define HAVE_INET_NTOA 1 + +/* Define to 1 if you have the `inet_ntop' function. */ +#define HAVE_INET_NTOP 1 + +/* Define to 1 if you have the `inet_pton' function. */ +#define HAVE_INET_PTON 1 + +/* Define to 1 if you have the `initgroups' function. */ +/* #undef HAVE_INITGROUPS */ + +/* Define if int32_t type is present. */ +#define HAVE_INT32_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* */ +/* #undef HAVE_IODBC */ + +/* */ +/* #undef HAVE_IODBC_H */ + +/* Whether to enable IPv6 support */ +#define HAVE_IPV6 1 + +/* Define to 1 if you have the `isascii' function. */ +#define HAVE_ISASCII 1 + +/* Define to 1 if you have the `isfinite' function. */ +/* #undef HAVE_ISFINITE */ + +/* Define to 1 if you have the `isinf' function. */ +#define HAVE_ISINF 1 + +/* Define to 1 if you have the `isnan' function. */ +#define HAVE_ISNAN 1 + +/* */ +/* #undef HAVE_ISQLEXT_H */ + +/* */ +/* #undef HAVE_ISQL_H */ + +/* whether to enable JavaScript Object Serialization support */ +#define HAVE_JSON 1 + +/* Define to 1 if you have the `kill' function. */ +#define HAVE_KILL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LANGINFO_H 1 + +/* Define to 1 if you have the `lchown' function. */ +#define HAVE_LCHOWN 1 + +/* */ +/* #undef HAVE_LDAP */ + +/* Define to 1 if you have the `ldap_parse_reference' function. */ +/* #undef HAVE_LDAP_PARSE_REFERENCE */ + +/* Define to 1 if you have the `ldap_parse_result' function. */ +/* #undef HAVE_LDAP_PARSE_RESULT */ + +/* LDAP SASL support */ +/* #undef HAVE_LDAP_SASL */ + +/* */ +/* #undef HAVE_LDAP_SASL_H */ + +/* */ +/* #undef HAVE_LDAP_SASL_SASL_H */ + +/* Define to 1 if you have the `ldap_start_tls_s' function. */ +/* #undef HAVE_LDAP_START_TLS_S */ + +/* */ +/* #undef HAVE_LIBBIND */ + +/* */ +/* #undef HAVE_LIBCRYPT */ + +/* */ +#define HAVE_LIBDL 1 + +/* */ +/* #undef HAVE_LIBDNET_STUB */ + +/* */ +/* #undef HAVE_LIBEDIT */ + +/* */ +#define HAVE_LIBEXPAT 1 + +/* */ +#define HAVE_LIBFREETYPE 1 + +/* */ +#define HAVE_LIBGD 1 + +/* */ +#define HAVE_LIBGD13 1 + +/* */ +#define HAVE_LIBGD15 1 + +/* */ +#define HAVE_LIBGD20 1 + +/* */ +#define HAVE_LIBGD204 1 + +/* */ +/* #undef HAVE_LIBICONV */ + +/* */ +/* #undef HAVE_LIBINTL */ + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* */ +#define HAVE_LIBMCRYPT 1 + +/* */ +/* #undef HAVE_LIBMHASH */ + +/* Whether you have libmm */ +/* #undef HAVE_LIBMM */ + +/* */ +#define HAVE_LIBNSL 1 + +/* */ +/* #undef HAVE_LIBPAM */ + +/* */ +/* #undef HAVE_LIBRARYMANAGER_H */ + +/* */ +/* #undef HAVE_LIBREADLINE */ + +/* Whether we have librecode 3.5 or higher */ +/* #undef HAVE_LIBRECODE */ + +/* */ +#define HAVE_LIBRESOLV 1 + +/* Define to 1 if you have the `rt' library (-lrt). */ +#define HAVE_LIBRT 1 + +/* */ +/* #undef HAVE_LIBSOCKET */ + +/* */ +/* #undef HAVE_LIBT1 */ + +/* */ +/* #undef HAVE_LIBTTF */ + +/* */ +#define HAVE_LIBXML 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `link' function. */ +#define HAVE_LINK 1 + +/* Define to 1 if you have the `localeconv' function. */ +#define HAVE_LOCALECONV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if you have the `lockf' function. */ +#define HAVE_LOCKF 1 + +/* Define to 1 if you have the `log1p' function. */ +#define HAVE_LOG1P 1 + +/* Define to 1 if you have the `lrand48' function. */ +#define HAVE_LRAND48 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACH_O_DYLD_H */ + +/* Define to 1 if you have the `makedev' function. */ +/* #undef HAVE_MAKEDEV */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the `mblen' function. */ +#define HAVE_MBLEN 1 + +/* whether to have multibyte regex support */ +/* #undef HAVE_MBREGEX */ + +/* Define to 1 if you have the `mbrlen' function. */ +#define HAVE_MBRLEN 1 + +/* Define to 1 if you have the `mbsinit' function. */ +#define HAVE_MBSINIT 1 + +/* Define if your system has mbstate_t in wchar.h */ +#define HAVE_MBSTATE_T 1 + +/* whether to have multibyte string support */ +/* #undef HAVE_MBSTRING */ + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MEMORY_H */ + +/* Define if the target system has support for memory allocation using + mmap(MAP_ANON) */ +#define HAVE_MEM_MMAP_ANON 1 + +/* Define if the target system has support for memory allocation using + mmap("/dev/zero") */ +#define HAVE_MEM_MMAP_ZERO 1 + +/* */ +/* #undef HAVE_MING */ + +/* */ +/* #undef HAVE_MING_MOVIE_LEVEL */ + +/* */ +/* #undef HAVE_MING_SETSWFCOMPRESSION */ + +/* */ +/* #undef HAVE_MING_ZLIB */ + +/* Define to 1 if you have the `mkfifo' function. */ +/* #undef HAVE_MKFIFO */ + +/* Define to 1 if you have the `mknod' function. */ +/* #undef HAVE_MKNOD */ + +/* Define to 1 if you have the `mkstemp' function. */ +#define HAVE_MKSTEMP 1 + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MONETARY_H 1 + +/* Define to 1 if you have the `mremap' function. */ +#define HAVE_MREMAP 1 + +/* */ +/* #undef HAVE_MSQL */ + +/* */ +/* #undef HAVE_MSSQL */ + +/* Whether you have MySQL */ +#define HAVE_MYSQL 1 + +/* */ +/* #undef HAVE_MYSQLILIB */ + +/* Define to 1 if you have the `mysql_commit' function. */ +/* #undef HAVE_MYSQL_COMMIT */ + +/* Define to 1 if you have the `mysql_next_result' function. */ +/* #undef HAVE_MYSQL_NEXT_RESULT */ + +/* Define to 1 if you have the `mysql_sqlstate' function. */ +/* #undef HAVE_MYSQL_SQLSTATE */ + +/* Define to 1 if you have the `mysql_stmt_prepare' function. */ +/* #undef HAVE_MYSQL_STMT_PREPARE */ + +/* Define to 1 if you have the `nanosleep' function. */ +#define HAVE_NANOSLEEP 1 + +/* */ +/* #undef HAVE_NCURSESLIB */ + +/* */ +/* #undef HAVE_NCURSES_ASSUME_DEFAULT_COLORS */ + +/* */ +/* #undef HAVE_NCURSES_COLOR_SET */ + +/* */ +/* #undef HAVE_NCURSES_H */ + +/* */ +/* #undef HAVE_NCURSES_PANEL */ + +/* */ +/* #undef HAVE_NCURSES_SLK_COLOR */ + +/* */ +/* #undef HAVE_NCURSES_USE_EXTENDED_NAMES */ + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_TCP_H 1 + +/* */ +/* #undef HAVE_NET_SNMP */ + +/* Whether utf8_mime2text() has new signature */ +/* #undef HAVE_NEW_MIME2TEXT */ + +/* */ +/* #undef HAVE_NEW_MING */ + +/* */ +/* #undef HAVE_NGETTEXT */ + +/* Define to 1 if you have the `nice' function. */ +#define HAVE_NICE 1 + +/* Define to 1 if you have the `nl_langinfo' function. */ +#define HAVE_NL_LANGINFO 1 + +/* Whether you have a Netscape/iPlanet/Sun Webserver */ +/* #undef HAVE_NSAPI */ + +/* */ +/* #undef HAVE_NSLDAP */ + +/* */ +/* #undef HAVE_OCI8 */ + +/* */ +/* #undef HAVE_OCI8_ATTR_STATEMENT */ + +/* */ +/* #undef HAVE_OCI8_TEMP_LOB */ + +/* */ +/* #undef HAVE_OCICOLLASSIGN */ + +/* */ +/* #undef HAVE_OCIENVCREATE */ + +/* */ +/* #undef HAVE_OCIENVNLSCREATE */ + +/* */ +/* #undef HAVE_OCILOBISTEMPORARY */ + +/* */ +/* #undef HAVE_OCISTMTFETCH2 */ + +/* */ +/* #undef HAVE_OCI_ENV_CREATE */ + +/* */ +/* #undef HAVE_OCI_ENV_NLS_CREATE */ + +/* */ +/* #undef HAVE_OCI_INSTANT_CLIENT */ + +/* */ +/* #undef HAVE_OCI_LOB_READ2 */ + +/* */ +/* #undef HAVE_OCI_STMT_PREPARE2 */ + +/* */ +/* #undef HAVE_ODBC2 */ + +/* */ +/* #undef HAVE_ODBCSDK_H */ + +/* */ +/* #undef HAVE_ODBC_H */ + +/* */ +/* #undef HAVE_ODBC_ROUTER */ + +/* */ +/* #undef HAVE_OLD_COMPAT_H */ + +/* whether you have old-style readdir_r */ +/* #undef HAVE_OLD_READDIR_R */ + +/* */ +/* #undef HAVE_OPENSSL_EXT */ + +/* */ +/* #undef HAVE_ORALDAP */ + +/* */ +/* #undef HAVE_ORALDAP_10 */ + +/* Whether struct _zend_object_value is packed */ +#define HAVE_PACKED_OBJECT_VALUE 0 + +/* */ +/* #undef HAVE_PCRE */ + +/* */ +/* #undef HAVE_PDO_DBLIB */ + +/* */ +/* #undef HAVE_PDO_FIREBIRD */ + +/* Whether to build PostgreSQL for PDO support or not */ +/* #undef HAVE_PDO_PGSQL */ + +/* */ +/* #undef HAVE_PDO_SQLITELIB */ + +/* Define to 1 if you have the `perror' function. */ +#define HAVE_PERROR 1 + +/* Whether to build PostgreSQL support or not */ +/* #undef HAVE_PGSQL */ + +/* Whether libpq is compiled with --enable-multibyte */ +/* #undef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PGTRANSACTIONSTATUS */ + +/* Whether to have pg_config.h */ +/* #undef HAVE_PG_CONFIG_H */ + +/* */ +/* #undef HAVE_PHP_SESSION */ + +/* Whether you have phttpd */ +/* #undef HAVE_PHTTPD */ + +/* Define to 1 if you have the `poll' function. */ +#define HAVE_POLL 1 + +/* whether to include POSIX-like functions */ +/* #undef HAVE_POSIX */ + +/* whether you have POSIX readdir_r */ +#define HAVE_POSIX_READDIR_R 1 + +/* PostgreSQL 7.0.x or later */ +/* #undef HAVE_PQCLIENTENCODING */ + +/* Broken libpq under windows */ +/* #undef HAVE_PQCMDTUPLES */ + +/* PostgreSQL 7.2.0 or later */ +/* #undef HAVE_PQESCAPE */ + +/* PostgreSQL 8.1.4 or later */ +/* #undef HAVE_PQESCAPE_BYTEA_CONN */ + +/* PostgreSQL 8.1.4 or later */ +/* #undef HAVE_PQESCAPE_CONN */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQEXECPARAMS */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQEXECPREPARED */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQFREEMEM */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQFTABLE */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQGETCOPYDATA */ + +/* Older PostgreSQL */ +/* #undef HAVE_PQOIDVALUE */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQPARAMETERSTATUS */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQPREPARE */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQPROTOCOLVERSION */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQPUTCOPYDATA */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQPUTCOPYEND */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQRESULTERRORFIELD */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQSENDPREPARE */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQSENDQUERYPARAMS */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQSENDQUERYPREPARED */ + +/* PostgreSQL 7.4 or later */ +/* #undef HAVE_PQSETERRORVERBOSITY */ + +/* PostgreSQL 7.0.x or later */ +/* #undef HAVE_PQSETNONBLOCKING */ + +/* PostgreSQL 7.3.0 or later */ +/* #undef HAVE_PQUNESCAPEBYTEA */ + +/* */ +/* #undef HAVE_PREAD */ + +/* */ +/* #undef HAVE_PSPELL */ + +/* Define to 1 if you have the `ptsname' function. */ +#define HAVE_PTSNAME 1 + +/* Define to 1 if you have the `putenv' function. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* */ +/* #undef HAVE_PWRITE */ + +/* Define to 1 if you have the `random' function. */ +#define HAVE_RANDOM 1 + +/* Define to 1 if you have the `rand_r' function. */ +#define HAVE_RAND_R 1 + +/* Define to 1 if you have the `realpath' function. */ +#define HAVE_REALPATH 1 + +/* Whether Reflection is enabled */ +#define HAVE_REFLECTION 1 + +/* Define to 1 if you have the `regcomp' function. */ +#define HAVE_REGCOMP 1 + +/* 1 */ +#define HAVE_REGEX_T_RE_MAGIC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_RESOLV_H 1 + +/* */ +#define HAVE_RES_NMKQUERY 1 + +/* */ +#define HAVE_RES_NSEND 1 + +/* Define to 1 if you have the `res_search' function. */ +#define HAVE_RES_SEARCH 1 + +/* */ +/* #undef HAVE_RL_CALLBACK_READ_CHAR */ + +/* Define to 1 if you have the `rl_completion_matches' function. */ +/* #undef HAVE_RL_COMPLETION_MATCHES */ + +/* Whether you use Roxen */ +/* #undef HAVE_ROXEN */ + +/* */ +/* #undef HAVE_SAPDB */ + +/* Define to 1 if you have the `scandir' function. */ +#define HAVE_SCANDIR 1 + +/* */ +#define HAVE_SEMUN 0 + +/* whether you have sendmail */ +#define HAVE_SENDMAIL 1 + +/* Define to 1 if you have the `setegid' function. */ +/* #undef HAVE_SETEGID */ + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if you have the `seteuid' function. */ +/* #undef HAVE_SETEUID */ + +/* Define to 1 if you have the `setitimer' function. */ +#define HAVE_SETITIMER 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setpgid' function. */ +#define HAVE_SETPGID 1 + +/* Define to 1 if you have the `setpriority' function. */ +/* #undef HAVE_SETPRIORITY */ + +/* Define to 1 if you have the `setsid' function. */ +/* #undef HAVE_SETSID */ + +/* Define to 1 if you have the `setsockopt' function. */ +#define HAVE_SETSOCKOPT 1 + +/* Define to 1 if you have the `setvbuf' function. */ +#define HAVE_SETVBUF 1 + +/* */ +/* #undef HAVE_SHMOP */ + +/* Define to 1 if you have the `shutdown' function. */ +#define HAVE_SHUTDOWN 1 + +/* */ +/* #undef HAVE_SIGACTION */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* */ +#define HAVE_SIMPLEXML 1 + +/* Define to 1 if you have the `sin' function. */ +#define HAVE_SIN 1 + +/* */ +/* #undef HAVE_SNMP */ + +/* */ +/* #undef HAVE_SNMP_PARSE_OID */ + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* */ +#define HAVE_SOAP 1 + +/* Whether struct sockaddr has field sa_len */ +/* #undef HAVE_SOCKADDR_SA_LEN */ + +/* Whether you have struct sockaddr_storage */ +#define HAVE_SOCKADDR_STORAGE 1 + +/* */ +#define HAVE_SOCKET 1 + +/* */ +#define HAVE_SOCKETPAIR 1 + +/* */ +#define HAVE_SOCKETS 1 + +/* Whether you have socklen_t */ +#define HAVE_SOCKLEN_T 1 + +/* */ +/* #undef HAVE_SOLID */ + +/* */ +/* #undef HAVE_SOLID_30 */ + +/* */ +/* #undef HAVE_SOLID_35 */ + +/* Whether you want SPL (Standard PHP Library) support */ +#define HAVE_SPL 1 + +/* */ +/* #undef HAVE_SQLCLI1_H */ + +/* */ +/* #undef HAVE_SQLDATASOURCES */ + +/* */ +/* #undef HAVE_SQLEXT_H */ + +/* have commercial sqlite3 with crypto support */ +/* #undef HAVE_SQLITE3_KEY */ + +/* */ +/* #undef HAVE_SQLTYPES_H */ + +/* */ +/* #undef HAVE_SQLUCODE_H */ + +/* */ +/* #undef HAVE_SQLUNIX_H */ + +/* */ +/* #undef HAVE_SQL_H */ + +/* Define to 1 if you have the `srand48' function. */ +#define HAVE_SRAND48 1 + +/* Define to 1 if you have the `srandom' function. */ +#define HAVE_SRANDOM 1 + +/* Define to 1 if you have the `statfs' function. */ +#define HAVE_STATFS 1 + +/* Define to 1 if you have the `statvfs' function. */ +#define HAVE_STATVFS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define if stdarg.h is available */ +/* #undef HAVE_STDARG_PROTOTYPES */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDBOOL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `std_syslog' function. */ +/* #undef HAVE_STD_SYSLOG */ + +/* Define to 1 if you have the `strcasecmp' function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `strcoll' function. */ +#define HAVE_STRCOLL 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strfmon' function. */ +#define HAVE_STRFMON 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcat' function. */ +/* #undef HAVE_STRLCAT */ + +/* Define to 1 if you have the `strlcpy' function. */ +/* #undef HAVE_STRLCPY */ + +/* Define to 1 if you have the `strpbrk' function. */ +#define HAVE_STRPBRK 1 + +/* Define to 1 if you have the `strptime' function. */ +#define HAVE_STRPTIME 1 + +/* whether strptime() declaration fails */ +/* #undef HAVE_STRPTIME_DECL_FAILS */ + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtod' function. */ +#define HAVE_STRTOD 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define HAVE_STRTOLL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if you have the `strtoull' function. */ +#define HAVE_STRTOULL 1 + +/* whether you have struct flock */ +#define HAVE_STRUCT_FLOCK 1 + +/* Define to 1 if `st_blksize' is member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BLKSIZE */ + +/* Define to 1 if `st_blocks' is member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BLOCKS */ + +/* Define to 1 if `st_rdev' is member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_RDEV */ + +/* Define to 1 if `tm_zone' is member of `struct tm'. */ +#define HAVE_STRUCT_TM_TM_ZONE 1 + +/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */ +/* #undef HAVE_ST_BLKSIZE */ + +/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ +/* #undef HAVE_ST_BLOCKS */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ST_H */ + +/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use + `HAVE_STRUCT_STAT_ST_RDEV' instead. */ +/* #undef HAVE_ST_RDEV */ + +/* */ +/* #undef HAVE_SWFMOVIE_NAMEDANCHOR */ + +/* */ +/* #undef HAVE_SWFPREBUILTCLIP */ + +/* */ +/* #undef HAVE_SYBASE */ + +/* */ +/* #undef HAVE_SYBASE_CT */ + +/* Define to 1 if you have the `symlink' function. */ +#define HAVE_SYMLINK 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSEXITS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSLOG_H 1 + +/* */ +/* #undef HAVE_SYSVMSG */ + +/* */ +/* #undef HAVE_SYSVSEM */ + +/* */ +/* #undef HAVE_SYSVSHM */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IPC_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_LOADAVG_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MKDEV_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MOUNT_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STAT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SYSEXITS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TIMES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTSNAME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VARARGS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_VFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the `tempnam' function. */ +#define HAVE_TEMPNAM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* */ +/* #undef HAVE_TIDY */ + +/* */ +/* #undef HAVE_TIDYOPTGETDOC */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TIME_H */ + +/* whether you have tm_gmtoff in struct tm */ +#define HAVE_TM_GMTOFF 1 + +/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead. */ +#define HAVE_TM_ZONE 1 + +/* Whether you have a working ttyname_r */ +/* #undef HAVE_TTYNAME_R */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TUXMODULE_H */ + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +/* #undef HAVE_TZNAME */ + +/* Define to 1 if you have the `tzset' function. */ +#define HAVE_TZSET 1 + +/* */ +/* #undef HAVE_UDBCEXT_H */ + +/* Define if uint32_t type is present. */ +#define HAVE_UINT32_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* */ +/* #undef HAVE_UNIXODBC */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UNIX_H */ + +/* Define to 1 if you have the `unlockpt' function. */ +#define HAVE_UNLOCKPT 1 + +/* Define to 1 if you have the `unsetenv' function. */ +#define HAVE_UNSETENV 1 + +/* */ +/* #undef HAVE_UODBC */ + +/* Define to 1 if you have the `usleep' function. */ +#define HAVE_USLEEP 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ +/* #undef HAVE_UTIME_NULL */ + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 + +/* Define to 1 if you have the `wait3' function. */ +/* #undef HAVE_WAIT3 */ + +/* */ +/* #undef HAVE_WAITPID */ + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* */ +/* #undef HAVE_WDDX */ + +/* */ +#define HAVE_XML 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_XMLPARSE_H */ + +/* */ +#define HAVE_XMLREADER 1 + +/* */ +#define HAVE_XMLRPC 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_XMLTOK_H */ + +/* */ +#define HAVE_XMLWRITER 1 + +/* */ +/* #undef HAVE_XSL */ + +/* */ +/* #undef HAVE_XSL_EXSLT */ + +/* */ +#define HAVE_YP_GET_DEFAULT_DOMAIN 1 + +/* */ +/* #undef HAVE_ZIP */ + +/* */ +#define HAVE_ZLIB 1 + +/* */ +/* #undef HPUX */ + +/* */ +#define HSREGEX 1 + +/* Whether iconv supports error no or not */ +#define ICONV_SUPPORTS_ERRNO 1 + +/* */ +/* #undef ISOLARIS */ + +/* */ +/* #undef LINUX */ + +/* */ +#define MAGIC_QUOTES 0 + +/* Whether asctime_r is declared */ +/* #undef MISSING_ASCTIME_R_DECL */ + +/* Whether ctime_r is declared */ +/* #undef MISSING_CTIME_R_DECL */ + +/* */ +#define MISSING_FCLOSE_DECL 0 + +/* Whether gmtime_r is declared */ +/* #undef MISSING_GMTIME_R_DECL */ + +/* Whether localtime_r is declared */ +/* #undef MISSING_LOCALTIME_R_DECL */ + +/* */ +/* #undef MISSING_MSGHDR_MSGFLAGS */ + +/* Whether strtok_r is declared */ +/* #undef MISSING_STRTOK_R_DECL */ + +/* */ +/* #undef MSQL1 */ + +/* */ +/* #undef MYSQL_UNIX_ADDR */ + +/* */ +/* #undef NDBM_INCLUDE_FILE */ + +/* */ +/* #undef NEUTRINO */ + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +//#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +//#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +//#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +//#define PACKAGE_VERSION "" + +/* */ +/* #undef PDO_MYSQL_UNIX_ADDR */ + +/* */ +#define PHP_APACHE_HAVE_CLIENT_FD 1 + +/* Whether the system supports BlowFish salt */ +#define PHP_BLOWFISH_CRYPT 0 + +/* PHP build date */ +#define PHP_BUILD_DATE "2008-01-09" + +/* Define if your system has fork/vfork/CreateProcess */ +#define PHP_CAN_SUPPORT_PROC_OPEN 1 + +/* */ +/* #undef PHP_CURL_URL_WRAPPERS */ + +/* Whether the system supports extended DES salt */ +#define PHP_EXT_DES_CRYPT 0 + +/* */ +/* #undef PHP_FASTCGI */ + +/* Whether you have HP-UX 10.x */ +/* #undef PHP_HPUX_TIME_R */ + +/* Path to iconv.h */ +#define PHP_ICONV_H_PATH + +/* Which iconv implementation to use */ +#define PHP_ICONV_IMPL "glibc" + +/* Whether you have IRIX-style functions */ +/* #undef PHP_IRIX_TIME_R */ + +/* Whether the system supports MD5 salt */ +#define PHP_MD5_CRYPT 1 + +/* magic file path */ +/* #undef PHP_MIME_MAGIC_FILE_PATH */ + +/* */ +/* #undef PHP_OCI8_HAVE_COLLECTIONS */ + +/* uname output */ +#define PHP_OS "Linux" + +/* whether pread64 is default */ +/* #undef PHP_PREAD_64 */ + +/* whether pwrite64 is default */ +/* #undef PHP_PWRITE_64 */ + +/* see #24142 */ +#define PHP_ROUND_FUZZ 0.5 + +/* */ +#define PHP_SAFE_MODE 0 + +/* */ +#define PHP_SAFE_MODE_EXEC_DIR "/usr/local/php/bin" + +/* */ +#define PHP_SIGCHILD 0 + +/* Have PDO */ +/* #undef PHP_SQLITE2_HAVE_PDO */ + +/* Whether the system supports standard DES salt */ +#define PHP_STD_DES_CRYPT 1 + +/* */ +/* #undef PHP_SYBASE_DBOPEN */ + +/* whether write(2) works */ +#define PHP_WRITE_STDOUT 1 + +/* Whether to use Pthreads */ +/* #undef PTHREADS */ + +/* */ +/* #undef QDBM_INCLUDE_FILE */ + +/* */ +#define REGEX 1 + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Whether to use Roxen in ZTS mode */ +/* #undef ROXEN_USE_ZTS */ + +/* The size of a `char', as computed by sizeof. */ +#define SIZEOF_CHAR 1 + +/* The size of a `char *', as computed by sizeof. */ +/* #undef SIZEOF_CHAR_P */ + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `intmax_t', as computed by sizeof. */ +#define SIZEOF_INTMAX_T 8 + +/* The size of a `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of a `long int', as computed by sizeof. */ +/* #undef SIZEOF_LONG_INT */ + +/* The size of a `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of a `long long int', as computed by sizeof. */ +#define SIZEOF_LONG_LONG_INT 8 + +/* The size of a `ptrdiff_t', as computed by sizeof. */ +#define SIZEOF_PTRDIFF_T 8 + +/* The size of a `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of a `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* The size of a `ssize_t', as computed by sizeof. */ +#define SIZEOF_SSIZE_T 8 + +/* */ +/* #undef SOLARIS */ + +/* Size of a pointer */ +/* #undef SQLITE_PTR_SZ */ + +/* */ +/* #undef SQLITE_UTF8 */ + +/* Needed in sqlunix.h for wchar defs */ +/* #undef SS_FBX */ + +/* Needed in sqlunix.h */ +/* #undef SS_LINUX */ + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* */ +/* #undef TSRM_ST */ + +/* */ +/* #undef UCD_SNMP_HACK */ + +/* */ +#define UNDEF_THREADS_HACK + +/* */ +/* #undef UNIXWARE */ + +/* whether to check multibyte regex backtrack */ +/* #undef USE_COMBINATION_EXPLOSION_CHECK */ + +/* */ +#define USE_GD_IMGSTRTTF 1 + +/* */ +/* #undef USE_GD_JISX0208 */ + +/* */ +/* #undef USE_TRANSFER_TABLES */ + +/* whether you want Pi3Web support */ +/* #undef WITH_PI3WEB */ + +/* */ +/* #undef WITH_ZEUS */ + +/* Define if processor uses big-endian word */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#define YYTEXT_POINTER 1 + +/* Whether sprintf is broken */ +#define ZEND_BROKEN_SPRINTF 0 + +/* */ +#define ZEND_DEBUG 0 + +/* */ +#define ZEND_MM_ALIGNMENT 8 + +/* */ +#define ZEND_MM_ALIGNMENT_LOG2 3 + +/* */ +/* #undef ZEND_MULTIBYTE */ + +/* virtual machine dispatch method */ +#define ZEND_VM_KIND ZEND_VM_KIND_CALL + +/* */ +/* #undef ZTS */ + +/* Define to 1 if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* */ +/* #undef in_addr_t */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ + +/* Define to `unsigned int ' if does not define. */ +/* #undef uint */ + +/* Define to `unsigned long ' if does not define. */ +/* #undef ulong */ + +#ifndef ZEND_ACCONFIG_H_NO_C_PROTOS + +#ifdef HAVE_STDLIB_H +# include +#endif + +#ifdef HAVE_SYS_TYPES_H +# include +#endif + +#ifdef HAVE_SYS_SELECT_H +#include +#endif + +#ifdef HAVE_IEEEFP_H +# include +#endif + +#ifdef HAVE_STRING_H +# include +#else +# include +#endif + +#if ZEND_BROKEN_SPRINTF +int zend_sprintf(char *buffer, const char *format, ...); +#else +# define zend_sprintf sprintf +#endif + +#include + +/* To enable the is_nan, is_infinite and is_finite PHP functions */ +#ifdef NETWARE + #define HAVE_ISNAN 1 + #define HAVE_ISINF 1 + #define HAVE_ISFINITE 1 +#endif + +#ifndef zend_isnan +#ifdef HAVE_ISNAN +#define zend_isnan(a) isnan(a) +#elif defined(HAVE_FPCLASS) +#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN)) +#else +#define zend_isnan(a) 0 +#endif +#endif + +#ifdef HAVE_ISINF +#define zend_isinf(a) isinf(a) +#elif defined(INFINITY) +/* Might not work, but is required by ISO C99 */ +#define zend_isinf(a) (((a)==INFINITY)?1:0) +#elif defined(HAVE_FPCLASS) +#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF)) +#else +#define zend_isinf(a) 0 +#endif + +#ifdef HAVE_FINITE +#define zend_finite(a) finite(a) +#elif defined(HAVE_ISFINITE) || defined(isfinite) +#define zend_finite(a) isfinite(a) +#elif defined(fpclassify) +#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0) +#else +#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1) +#endif + +#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */ + +#ifdef NETWARE +#ifdef USE_WINSOCK +#/*This detection against winsock is of no use*/ undef HAVE_SOCKLEN_T +#/*This detection against winsock is of no use*/ undef HAVE_SYS_SOCKET_H +#endif +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ +/* #undef PTHREADS */ diff --git a/src/cpp/base/zend/zend_printf.cpp b/src/cpp/base/zend/zend_printf.cpp new file mode 100644 index 0000000000000..0953267b6e630 --- /dev/null +++ b/src/cpp/base/zend/zend_printf.cpp @@ -0,0 +1,1575 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +namespace HPHP { + +/* These definitions are coped from the Zend formatted output conversion + files so that we only need to make minimal changes to the Zend formatted + output conversion functions that are incorporated here. + */ +#define ALIGN_LEFT 0 +#define ALIGN_RIGHT 1 +#define ADJ_WIDTH 1 +#define ADJ_PRECISION 2 +#define NUM_BUF_SIZE 500 +#define NDIG 320 +#define FLOAT_DIGITS 6 +#define FLOAT_PRECISION 6 +#define MAX_FLOAT_DIGITS 38 +#define MAX_FLOAT_PRECISION 40 +#define EXPONENT_LENGTH 10 + +static char hexchars[] = "0123456789abcdef"; +static char HEXCHARS[] = "0123456789ABCDEF"; + +typedef enum { + LM_STD = 0, + LM_INTMAX_T, + LM_PTRDIFF_T, + LM_LONG_LONG, + LM_SIZE_T, + LM_LONG, + LM_LONG_DOUBLE +} length_modifier_e; + +typedef enum { + NO = 0, YES = 1 +} boolean_e; + +#define NUM(c) (c - '0') + +#define STR_TO_DEC(str, num) do { \ + num = NUM(*str++); \ + while (isdigit((int)*str)) { \ + num *= 10; \ + num += NUM(*str++); \ + if (num >= INT_MAX / 10) { \ + while (isdigit((int)*str++));\ + break; \ + } \ + } \ +} while (0) + +/* + * This macro does zero padding so that the precision + * requirement is satisfied. The padding is done by + * adding '0's to the left of the string that is going + * to be printed. + */ +#define FIX_PRECISION(adjust, precision, s, s_len) do { \ + if (adjust) \ + while (s_len < precision) { \ + *--s = '0'; \ + s_len++; \ + } \ +} while (0) + +typedef int64 wide_int; +typedef uint64 u_wide_int; + +#define FALSE 0 +#define TRUE 1 +#define NUL '\0' +#define INT_NULL ((int *)0) + +static const char* s_null = "(null)"; +#define S_NULL_LEN 6 + +#define FLOAT_DIGITS 6 +#define EXPONENT_LENGTH 10 + +#define HAVE_LOCALE_H 1 + +#ifdef HAVE_LOCALE_H +#include +#define LCONV_DECIMAL_POINT (*lconv->decimal_point) +#else +#define LCONV_DECIMAL_POINT '.' +#endif + +/////////////////////////////////////////////////////////////////////////////// +/* + * Copyright (c) 2002, 2006 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ + +static char * __cvt(double value, int ndigit, int *decpt, int *sign, + int fmode, int pad) { + register char *s = NULL; + char *p, *rve, c; + size_t siz; + + if (ndigit < 0) { + siz = -ndigit + 1; + } else { + siz = ndigit + 1; + } + + /* __dtoa() doesn't allocate space for 0 so we do it by hand */ + if (value == 0.0) { + *decpt = 1 - fmode; /* 1 for 'e', 0 for 'f' */ + *sign = 0; + if ((rve = s = (char *)malloc(ndigit?siz:2)) == NULL) { + return(NULL); + } + *rve++ = '0'; + *rve = '\0'; + if (!ndigit) { + return(s); + } + } else { + p = zend_dtoa(value, fmode + 2, ndigit, decpt, sign, &rve); + if (*decpt == 9999) { + /* Infinity or Nan, convert to inf or nan like printf */ + *decpt = 0; + c = *p; + zend_freedtoa(p); + return strdup(c == 'I' ? "INF" : "NAN"); + } + /* Make a local copy and adjust rve to be in terms of s */ + if (pad && fmode) { + siz += *decpt; + } + if ((s = (char *)malloc(siz+1)) == NULL) { + zend_freedtoa(p); + return(NULL); + } + (void)string_copy(s, p, siz); + rve = s + (rve - p); + zend_freedtoa(p); + } + + /* Add trailing zeros */ + if (pad) { + siz -= rve - s; + while (--siz) { + *rve++ = '0'; + } + *rve = '\0'; + } + + return(s); +} + +static inline char *php_ecvt(double value, int ndigit, int *decpt, int *sign) { + return(__cvt(value, ndigit, decpt, sign, 0, 1)); +} + +static inline char *php_fcvt(double value, int ndigit, int *decpt, int *sign) { + return(__cvt(value, ndigit, decpt, sign, 1, 1)); +} + +static inline char *php_gcvt(double value, int ndigit, char dec_point, + char exponent, char *buf) { + char *digits, *dst, *src; + int i, decpt, sign; + + digits = zend_dtoa(value, 2, ndigit, &decpt, &sign, NULL); + if (decpt == 9999) { + /* + * Infinity or NaN, convert to inf or nan with sign. + * We assume the buffer is at least ndigit long. + */ + snprintf(buf, ndigit + 1, "%s%s", (sign && *digits == 'I') ? "-" : "", + *digits == 'I' ? "INF" : "NAN"); + zend_freedtoa(digits); + return (buf); + } + + dst = buf; + if (sign) { + *dst++ = '-'; + } + + for (i = 0; i < ndigit && digits[i] != '\0'; i++); + + if ((decpt >= 0 && decpt - i > 4) + || (decpt < 0 && decpt < -3)) { /* use E-style */ + /* exponential format (e.g. 1.2345e+13) */ + if (--decpt < 0) { + sign = 1; + decpt = -decpt; + } else { + sign = 0; + } + src = digits; + *dst++ = *src++; + *dst++ = dec_point; + if (*src == '\0') { + *dst++ = '0'; + } else { + do { + *dst++ = *src++; + } while (*src != '\0'); + } + *dst++ = exponent; + if (sign) { + *dst++ = '-'; + } else { + *dst++ = '+'; + } + if (decpt < 10) { + *dst++ = '0' + decpt; + *dst = '\0'; + } else { + /* XXX - optimize */ + for (sign = decpt, i = 0; (sign /= 10) != 0; i++) + continue; + dst[i + 1] = '\0'; + while (decpt != 0) { + dst[i--] = '0' + decpt % 10; + decpt /= 10; + } + } + } else if (decpt < 0) { + /* standard format 0. */ + *dst++ = '0'; /* zero before decimal point */ + *dst++ = dec_point; + do { + *dst++ = '0'; + } while (++decpt < 0); + src = digits; + while (*src != '\0') { + *dst++ = *src++; + } + *dst = '\0'; + } else { + /* standard format */ + for (i = 0, src = digits; i < decpt; i++) { + if (*src != '\0') { + *dst++ = *src++; + } else { + *dst++ = '0'; + } + } + if (*src != '\0') { + if (src == digits) { + *dst++ = '0'; /* zero before decimal point */ + } + *dst++ = dec_point; + for (i = decpt; digits[i] != '\0'; i++) { + *dst++ = digits[i]; + } + } + *dst = '\0'; + } + zend_freedtoa(digits); + return (buf); +} + +/////////////////////////////////////////////////////////////////////////////// +// Apache license + +/* ==================================================================== + * Copyright (c) 1995-1998 The Apache Group. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the Apache Group + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * 4. The names "Apache Server" and "Apache Group" must not be used to + * endorse or promote products derived from this software without + * prior written permission. + * + * 5. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the Apache Group + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Group and was originally based + * on public domain software written at the National Center for + * Supercomputing Applications, University of Illinois, Urbana-Champaign. + * For more information on the Apache Group and the Apache HTTP server + * project, please see . + * + * This code is based on, and used with the permission of, the + * SIO stdio-replacement strx_* functions by Panos Tsirigotis + * for xinetd. + */ + +/* + * Convert num to a base X number where X is a power of 2. nbits determines X. + * For example, if nbits is 3, we do base 8 conversion + * Return value: + * a pointer to a string containing the number + * + * The caller provides a buffer for the string: that is the buf_end argument + * 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 uint64 num, register int nbits, + char format, char *buf_end, register int *len) +{ + register int mask = (1 << nbits) - 1; + register char *p = buf_end; + static char low_digits[] = "0123456789abcdef"; + static char upper_digits[] = "0123456789ABCDEF"; + register char *digits = (format == 'X') ? upper_digits : low_digits; + + do { + *--p = digits[num & mask]; + num >>= nbits; + } + while (num); + + *len = buf_end - p; + return (p); +} + +/* + * Convert num to its decimal format. + * Return value: + * - a pointer to a string containing the number (no sign) + * - len contains the length of the string + * - is_negative is set to TRUE or FALSE depending on the sign + * of the number (always set to FALSE if is_unsigned is TRUE) + * + * The caller provides a buffer for the string: that is the buf_end argument + * 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_10(register int64 num, register bool is_unsigned, + register int * is_negative, char *buf_end, + register int *len) { + register char *p = buf_end; + register uint64 magnitude; + + if (is_unsigned) { + magnitude = (uint64) num; + *is_negative = 0; + } else { + *is_negative = (num < 0); + + /* + * On a 2's complement machine, negating the most negative integer + * results in a number that cannot be represented as a signed integer. + * Here is what we do to obtain the number's magnitude: + * a. add 1 to the number + * b. negate it (becomes positive) + * c. convert it to unsigned + * d. add 1 + */ + if (*is_negative) { + int64 t = num + 1; + magnitude = ((uint64) - t) + 1; + } else { + magnitude = (uint64) num; + } + } + + /* + * We use a do-while loop so that we write at least 1 digit + */ + do { + register uint64 new_magnitude = magnitude / 10; + + *--p = (char)(magnitude - new_magnitude * 10 + '0'); + magnitude = new_magnitude; + } + while (magnitude); + + *len = buf_end - p; + return (p); +} + +/////////////////////////////////////////////////////////////////////////////// +/* + * Convert a floating point number to a string formats 'f', 'e' or 'E'. + * The result is placed in buf, and len denotes the length of the string + * The sign is returned in the is_negative argument (and is not placed + * in buf). + */ +char * php_conv_fp(register char format, register double num, + bool add_dp, int precision, char dec_point, + int *is_negative, char *buf, int *len) { + register char *s = buf; + register char *p, *p_orig; + int decimal_point; + + if (precision >= NDIG - 1) { + precision = NDIG - 2; + } + + if (format == 'F') { + p_orig = p = php_fcvt(num, precision, &decimal_point, is_negative); + } else { // either e or E format + p_orig = p = php_ecvt(num, precision + 1, &decimal_point, is_negative); + } + + // Check for Infinity and NaN + if (isalpha((int)*p)) { + *len = strlen(p); + memcpy(buf, p, *len + 1); + *is_negative = 0; + free(p_orig); + return (buf); + } + if (format == 'F') { + if (decimal_point <= 0) { + if (num != 0 || precision > 0) { + *s++ = '0'; + if (precision > 0) { + *s++ = dec_point; + while (decimal_point++ < 0) { + *s++ = '0'; + } + } else if (add_dp) { + *s++ = dec_point; + } + } + } else { + int addz = decimal_point >= NDIG ? decimal_point - NDIG + 1 : 0; + decimal_point -= addz; + while (decimal_point-- > 0) { + *s++ = *p++; + } + while (addz-- > 0) { + *s++ = '0'; + } + if (precision > 0 || add_dp) { + *s++ = dec_point; + } + } + } else { + *s++ = *p++; + if (precision > 0 || add_dp) { + *s++ = '.'; + } + } + + // copy the rest of p, the NUL is NOT copied + while (*p) { + *s++ = *p++; + } + + if (format != 'F') { + char temp[EXPONENT_LENGTH]; // for exponent conversion + int t_len; + int exponent_is_negative; + + *s++ = format; // either e or E + decimal_point--; + if (decimal_point != 0) { + p = ap_php_conv_10((int64) decimal_point, false, + &exponent_is_negative, &temp[EXPONENT_LENGTH], + &t_len); + *s++ = exponent_is_negative ? '-' : '+'; + + // Make sure the exponent has at least 2 digits + while (t_len--) { + *s++ = *p++; + } + } else { + *s++ = '+'; + *s++ = '0'; + } + } + *len = s - buf; + free(p_orig); + return (buf); +} + +/////////////////////////////////////////////////////////////////////////////// + +inline static void appendchar(char **buffer, int *pos, int *size, char add) { + if ((*pos + 1) >= *size) { + *size <<= 1; + *buffer = (char*)realloc(*buffer, *size); + } + (*buffer)[(*pos)++] = add; +} + +inline static void appendstring(char **buffer, int *pos, int *size, + const char *add, + int min_width, int max_width, char padding, + int alignment, int len, int neg, int expprec, + int always_sign) { + register int npad; + int req_size; + int copy_len; + + copy_len = (expprec ? (max_width < len ? max_width : len) : len); + npad = min_width - copy_len; + + if (npad < 0) { + npad = 0; + } + + req_size = *pos + (min_width > copy_len ? min_width : copy_len) + 1; + + if (req_size > *size) { + while (req_size > *size) { + *size <<= 1; + } + *buffer = (char*)realloc(*buffer, *size); + } + if (alignment == ALIGN_RIGHT) { + if ((neg || always_sign) && padding=='0') { + (*buffer)[(*pos)++] = (neg) ? '-' : '+'; + add++; + len--; + copy_len--; + } + while (npad-- > 0) { + (*buffer)[(*pos)++] = padding; + } + } + memcpy(&(*buffer)[*pos], add, copy_len + 1); + *pos += copy_len; + if (alignment == ALIGN_LEFT) { + while (npad--) { + (*buffer)[(*pos)++] = padding; + } + } +} + +inline static void appendint(char **buffer, int *pos, int *size, long number, + int width, char padding, int alignment, + int always_sign) { + char numbuf[NUM_BUF_SIZE]; + register unsigned long magn, nmagn; + register unsigned int i = NUM_BUF_SIZE - 1, neg = 0; + + if (number < 0) { + neg = 1; + magn = ((unsigned long) -(number + 1)) + 1; + } else { + magn = (unsigned long) number; + } + + /* Can't right-pad 0's on integers */ + if(alignment==0 && padding=='0') padding=' '; + + numbuf[i] = '\0'; + + do { + nmagn = magn / 10; + + numbuf[--i] = (unsigned char)(magn - (nmagn * 10)) + '0'; + magn = nmagn; + } + while (magn > 0 && i > 0); + if (neg) { + numbuf[--i] = '-'; + } else if (always_sign) { + numbuf[--i] = '+'; + } + appendstring(buffer, pos, size, &numbuf[i], width, 0, + padding, alignment, (NUM_BUF_SIZE - 1) - i, + neg, 0, always_sign); +} + +inline static void appenduint(char **buffer, int *pos, int *size, + unsigned long number, + int width, char padding, int alignment) { + char numbuf[NUM_BUF_SIZE]; + register unsigned long magn, nmagn; + register unsigned int i = NUM_BUF_SIZE - 1; + + magn = (unsigned long) number; + + /* Can't right-pad 0's on integers */ + if (alignment == 0 && padding == '0') padding = ' '; + + numbuf[i] = '\0'; + do { + nmagn = magn / 10; + numbuf[--i] = (unsigned char)(magn - (nmagn * 10)) + '0'; + magn = nmagn; + } while (magn > 0 && i > 0); + + appendstring(buffer, pos, size, &numbuf[i], width, 0, + padding, alignment, (NUM_BUF_SIZE - 1) - i, 0, 0, 0); +} + +inline static void appenddouble(char **buffer, int *pos, + int *size, double number, + int width, char padding, + int alignment, int precision, + int adjust, char fmt, + int always_sign) { + char num_buf[NUM_BUF_SIZE]; + char *s = NULL; + int s_len = 0, is_negative = 0; + + if ((adjust & ADJ_PRECISION) == 0) { + precision = FLOAT_PRECISION; + } else if (precision > MAX_FLOAT_PRECISION) { + precision = MAX_FLOAT_PRECISION; + } + + if (isnan(number)) { + is_negative = (number<0); + appendstring(buffer, pos, size, "NaN", 3, 0, padding, + alignment, precision, is_negative, 0, always_sign); + return; + } + + if (isinf(number)) { + is_negative = (number<0); + appendstring(buffer, pos, size, "INF", 3, 0, padding, + alignment, precision, is_negative, 0, always_sign); + return; + } + + switch (fmt) { + case 'e': + case 'E': + case 'f': + case 'F': + s = php_conv_fp((fmt == 'f')?'F':fmt, number, 0, precision, '.', + &is_negative, &num_buf[1], &s_len); + if (is_negative) { + num_buf[0] = '-'; + s = num_buf; + s_len++; + } else if (always_sign) { + num_buf[0] = '+'; + s = num_buf; + s_len++; + } + break; + + case 'g': + case 'G': + if (precision == 0) + precision = 1; + /* + * * We use &num_buf[ 1 ], so that we have room for the sign + */ + s = php_gcvt(number, precision, '.', (fmt == 'G')?'E':'e', &num_buf[1]); + is_negative = 0; + if (*s == '-') { + is_negative = 1; + s = &num_buf[1]; + } else if (always_sign) { + num_buf[0] = '+'; + s = num_buf; + } + + s_len = strlen(s); + break; + } + + appendstring(buffer, pos, size, s, width, 0, padding, + alignment, s_len, is_negative, 0, always_sign); +} + +inline static void append2n(char **buffer, int *pos, int *size, long number, + int width, char padding, int alignment, int n, + char *chartable, int expprec) { + char numbuf[NUM_BUF_SIZE]; + register unsigned long num; + register unsigned int i = NUM_BUF_SIZE - 1; + register int andbits = (1 << n) - 1; + + num = (unsigned long) number; + numbuf[i] = '\0'; + + do { + numbuf[--i] = chartable[(num & andbits)]; + num >>= n; + } + while (num > 0); + + appendstring(buffer, pos, size, &numbuf[i], width, 0, + padding, alignment, (NUM_BUF_SIZE - 1) - i, + 0, expprec, 0); +} + +inline static int getnumber(const char *buffer, int *pos) { + char *endptr; + register long num = strtol(buffer + *pos, &endptr, 10); + register int i = 0; + + if (endptr != NULL) { + i = (endptr - buffer - *pos); + } + *pos += i; + + if (num >= INT_MAX || num < 0) { + throw InvalidArgumentException("format", num); + } + return (int) num; +} + +/** + * New sprintf implementation for PHP. + * + * Modifiers: + * + * " " pad integers with spaces + * "-" left adjusted field + * n field size + * "."n precision (floats only) + * "+" Always place a sign (+ or -) in front of a number + * + * Type specifiers: + * + * "%" literal "%", modifiers are ignored. + * "b" integer argument is printed as binary + * "c" integer argument is printed as a single character + * "d" argument is an integer + * "f" the argument is a float + * "o" integer argument is printed as octal + * "s" argument is a string + * "x" integer argument is printed as lowercase hexadecimal + * "X" integer argument is printed as uppercase hexadecimal + */ +char *string_printf(const char *format, int len, CArrRef args, int *outlen) { + Array vargs = args; + if (!vargs.isNull() && !vargs->isVectorData()) { + vargs = Array::Create(); + for (ArrayIter iter(args); iter; ++iter) { + vargs.append(iter.second()); + } + } + + if (len == 0) { + return strdup(""); + } + + int size = 240; + char *result = (char *)malloc(size); + int outpos = 0; + + int argnum = 0; + for (int inpos = 0; inpos < len; ++inpos) { + char ch = format[inpos]; + + int expprec = 0; + if (ch != '%') { + appendchar(&result, &outpos, &size, ch); + continue; + } + + if (format[inpos + 1] == '%') { + appendchar(&result, &outpos, &size, '%'); + inpos++; + continue; + } + + /* starting a new format specifier, reset variables */ + int alignment = ALIGN_RIGHT; + int adjusting = 0; + char padding = ' '; + int always_sign = 0; + int width, precision; + inpos++; /* skip the '%' */ + ch = format[inpos]; + + if (isascii(ch) && !isalpha(ch)) { + /* first look for argnum */ + int temppos = inpos; + while (isdigit((int)format[temppos])) temppos++; + if (format[temppos] == '$') { + argnum = getnumber(format, &inpos); + inpos++; /* skip the '$' */ + } else { + argnum++; + } + + /* after argnum comes modifiers */ + for (;; inpos++) { + ch = format[inpos]; + + if (ch == ' ' || ch == '0') { + padding = ch; + } else if (ch == '-') { + alignment = ALIGN_LEFT; + /* space padding, the default */ + } else if (ch == '+') { + always_sign = 1; + } else if (ch == '\'') { + padding = format[++inpos]; + } else { + break; + } + } + ch = format[inpos]; + + /* after modifiers comes width */ + if (isdigit(ch)) { + width = getnumber(format, &inpos); + adjusting |= ADJ_WIDTH; + } else { + width = 0; + } + ch = format[inpos]; + + /* after width and argnum comes precision */ + if (ch == '.') { + ch = format[++inpos]; + if (isdigit((int)ch)) { + precision = getnumber(format, &inpos); + ch = format[inpos]; + adjusting |= ADJ_PRECISION; + expprec = 1; + } else { + precision = 0; + } + } else { + precision = 0; + } + } else { + width = precision = 0; + argnum++; + } + + if (argnum > vargs.size()) { + throw InvalidArgumentException("arguments", "(too few)"); + } + + if (ch == 'l') { + ch = format[++inpos]; + } + /* now we expect to find a type specifier */ + Variant tmp = vargs[argnum-1]; + + switch (ch) { + case 's': { + String s = tmp.toString(); + appendstring(&result, &outpos, &size, s, + width, precision, padding, alignment, s.size(), + 0, expprec, 0); + break; + } + case 'd': + appendint(&result, &outpos, &size, tmp.toInt64(), + width, padding, alignment, always_sign); + break; + case 'u': + appenduint(&result, &outpos, &size, tmp.toInt64(), + width, padding, alignment); + break; + + case 'g': + case 'G': + case 'e': + case 'E': + case 'f': + case 'F': + appenddouble(&result, &outpos, &size, tmp.toDouble(), + width, padding, alignment, precision, adjusting, + ch, always_sign); + break; + + case 'c': + appendchar(&result, &outpos, &size, tmp.toByte()); + break; + + case 'o': + append2n(&result, &outpos, &size, tmp.toInt64(), + width, padding, alignment, 3, hexchars, expprec); + break; + + case 'x': + append2n(&result, &outpos, &size, tmp.toInt64(), + width, padding, alignment, 4, hexchars, expprec); + break; + + case 'X': + append2n(&result, &outpos, &size, tmp.toInt64(), + width, padding, alignment, 4, HEXCHARS, expprec); + break; + + case 'b': + append2n(&result, &outpos, &size, tmp.toInt64(), + width, padding, alignment, 1, hexchars, expprec); + break; + + case '%': + appendchar(&result, &outpos, &size, '%'); + + break; + default: + break; + } + } + + /* possibly, we have to make sure we have room for the terminating null? */ + result[outpos]=0; + if (outlen) *outlen = outpos; + return result; +} + +/* + * Do format conversion placing the output in buffer + */ +static int xbuf_format_converter(char **outbuf, const char *fmt, va_list ap) +{ + register char *s = NULL; + char *q; + int s_len; + + register int min_width = 0; + int precision = 0; + enum { + LEFT, RIGHT + } adjust; + char pad_char; + char prefix_char; + + double fp_num; + wide_int i_num = (wide_int) 0; + u_wide_int ui_num; + + char num_buf[NUM_BUF_SIZE]; + char char_buf[2]; /* for printing %% and % */ + +#ifdef HAVE_LOCALE_H + struct lconv *lconv = NULL; +#endif + + /* + * Flag variables + */ + length_modifier_e modifier; + boolean_e alternate_form; + boolean_e print_sign; + boolean_e print_blank; + boolean_e adjust_precision; + boolean_e adjust_width; + int is_negative; + + int size = 240; + char *result = (char *)malloc(size); + int outpos = 0; + + while (*fmt) { + if (*fmt != '%') { + appendchar(&result, &outpos, &size, *fmt); + } else { + /* + * Default variable settings + */ + adjust = RIGHT; + alternate_form = print_sign = print_blank = NO; + pad_char = ' '; + prefix_char = NUL; + + fmt++; + + /* + * Try to avoid checking for flags, width or precision + */ + if (isascii((int)*fmt) && !islower((int)*fmt)) { + /* + * Recognize flags: -, #, BLANK, + + */ + for (;; fmt++) { + if (*fmt == '-') + adjust = LEFT; + else if (*fmt == '+') + print_sign = YES; + else if (*fmt == '#') + alternate_form = YES; + else if (*fmt == ' ') + print_blank = YES; + else if (*fmt == '0') + pad_char = '0'; + else + break; + } + + /* + * Check if a width was specified + */ + if (isdigit((int)*fmt)) { + STR_TO_DEC(fmt, min_width); + adjust_width = YES; + } else if (*fmt == '*') { + min_width = va_arg(ap, int); + fmt++; + adjust_width = YES; + if (min_width < 0) { + adjust = LEFT; + min_width = -min_width; + } + } else + adjust_width = NO; + + /* + * Check if a precision was specified + * + * XXX: an unreasonable amount of precision may be specified + * resulting in overflow of num_buf. Currently we + * ignore this possibility. + */ + if (*fmt == '.') { + adjust_precision = YES; + fmt++; + if (isdigit((int)*fmt)) { + STR_TO_DEC(fmt, precision); + } else if (*fmt == '*') { + precision = va_arg(ap, int); + fmt++; + if (precision < 0) + precision = 0; + } else + precision = 0; + } else + adjust_precision = NO; + } else + adjust_precision = adjust_width = NO; + + /* + * Modifier check + */ + switch (*fmt) { + case 'L': + fmt++; + modifier = LM_LONG_DOUBLE; + break; + case 'I': + fmt++; +#if SIZEOF_LONG_LONG + if (*fmt == '6' && *(fmt+1) == '4') { + fmt += 2; + modifier = LM_LONG_LONG; + } else +#endif + if (*fmt == '3' && *(fmt+1) == '2') { + fmt += 2; + modifier = LM_LONG; + } else { +#ifdef _WIN64 + modifier = LM_LONG_LONG; +#else + modifier = LM_LONG; +#endif + } + break; + case 'l': + fmt++; +#if SIZEOF_LONG_LONG + if (*fmt == 'l') { + fmt++; + modifier = LM_LONG_LONG; + } else +#endif + modifier = LM_LONG; + break; + case 'z': + fmt++; + modifier = LM_SIZE_T; + break; + case 'j': + fmt++; +#if SIZEOF_INTMAX_T + modifier = LM_INTMAX_T; +#else + modifier = LM_SIZE_T; +#endif + break; + case 't': + fmt++; +#if SIZEOF_PTRDIFF_T + modifier = LM_PTRDIFF_T; +#else + modifier = LM_SIZE_T; +#endif + break; + case 'h': + fmt++; + if (*fmt == 'h') { + fmt++; + } + /* these are promoted to int, so no break */ + default: + modifier = LM_STD; + break; + } + + /* + * Argument extraction and printing. + * First we determine the argument type. + * Then, we convert the argument to a string. + * On exit from the switch, s points to the string that + * must be printed, s_len has the length of the string + * The precision requirements, if any, are reflected in s_len. + * + * NOTE: pad_char may be set to '0' because of the 0 flag. + * It is reset to ' ' by non-numeric formats + */ + switch (*fmt) { + case 'u': + switch(modifier) { + default: + i_num = (wide_int) va_arg(ap, unsigned int); + break; + case LM_LONG_DOUBLE: + goto fmt_error; + case LM_LONG: + i_num = (wide_int) va_arg(ap, unsigned long int); + break; + case LM_SIZE_T: + i_num = (wide_int) va_arg(ap, size_t); + break; +#if SIZEOF_LONG_LONG + case LM_LONG_LONG: + i_num = (wide_int) va_arg(ap, u_wide_int); + break; +#endif +#if SIZEOF_INTMAX_T + case LM_INTMAX_T: + i_num = (wide_int) va_arg(ap, uintmax_t); + break; +#endif +#if SIZEOF_PTRDIFF_T + case LM_PTRDIFF_T: + i_num = (wide_int) va_arg(ap, ptrdiff_t); + break; +#endif + } + /* + * The rest also applies to other integer formats, so fall + * into that case. + */ + case 'd': + case 'i': + /* + * Get the arg if we haven't already. + */ + if ((*fmt) != 'u') { + switch(modifier) { + default: + i_num = (wide_int) va_arg(ap, int); + break; + case LM_LONG_DOUBLE: + goto fmt_error; + case LM_LONG: + i_num = (wide_int) va_arg(ap, long int); + break; + case LM_SIZE_T: +#if SIZEOF_SSIZE_T + i_num = (wide_int) va_arg(ap, ssize_t); +#else + i_num = (wide_int) va_arg(ap, size_t); +#endif + break; +#if SIZEOF_LONG_LONG + case LM_LONG_LONG: + i_num = (wide_int) va_arg(ap, wide_int); + break; +#endif +#if SIZEOF_INTMAX_T + case LM_INTMAX_T: + i_num = (wide_int) va_arg(ap, intmax_t); + break; +#endif +#if SIZEOF_PTRDIFF_T + case LM_PTRDIFF_T: + i_num = (wide_int) va_arg(ap, ptrdiff_t); + break; +#endif + } + } + s = ap_php_conv_10(i_num, (*fmt) == 'u', &is_negative, + &num_buf[NUM_BUF_SIZE], &s_len); + FIX_PRECISION(adjust_precision, precision, s, s_len); + + if (*fmt != 'u') { + if (is_negative) + prefix_char = '-'; + else if (print_sign) + prefix_char = '+'; + else if (print_blank) + prefix_char = ' '; + } + break; + + + case 'o': + switch(modifier) { + default: + ui_num = (u_wide_int) va_arg(ap, unsigned int); + break; + case LM_LONG_DOUBLE: + goto fmt_error; + case LM_LONG: + ui_num = (u_wide_int) va_arg(ap, unsigned long int); + break; + case LM_SIZE_T: + ui_num = (u_wide_int) va_arg(ap, size_t); + break; +#if SIZEOF_LONG_LONG + case LM_LONG_LONG: + ui_num = (u_wide_int) va_arg(ap, u_wide_int); + break; +#endif +#if SIZEOF_INTMAX_T + case LM_INTMAX_T: + ui_num = (u_wide_int) va_arg(ap, uintmax_t); + break; +#endif +#if SIZEOF_PTRDIFF_T + case LM_PTRDIFF_T: + ui_num = (u_wide_int) va_arg(ap, ptrdiff_t); + break; +#endif + } + s = ap_php_conv_p2(ui_num, 3, *fmt, + &num_buf[NUM_BUF_SIZE], &s_len); + FIX_PRECISION(adjust_precision, precision, s, s_len); + if (alternate_form && *s != '0') { + *--s = '0'; + s_len++; + } + break; + + + case 'x': + case 'X': + switch(modifier) { + default: + ui_num = (u_wide_int) va_arg(ap, unsigned int); + break; + case LM_LONG_DOUBLE: + goto fmt_error; + case LM_LONG: + ui_num = (u_wide_int) va_arg(ap, unsigned long int); + break; + case LM_SIZE_T: + ui_num = (u_wide_int) va_arg(ap, size_t); + break; +#if SIZEOF_LONG_LONG + case LM_LONG_LONG: + ui_num = (u_wide_int) va_arg(ap, u_wide_int); + break; +#endif +#if SIZEOF_INTMAX_T + case LM_INTMAX_T: + ui_num = (u_wide_int) va_arg(ap, uintmax_t); + break; +#endif +#if SIZEOF_PTRDIFF_T + case LM_PTRDIFF_T: + ui_num = (u_wide_int) va_arg(ap, ptrdiff_t); + break; +#endif + } + s = ap_php_conv_p2(ui_num, 4, *fmt, + &num_buf[NUM_BUF_SIZE], &s_len); + FIX_PRECISION(adjust_precision, precision, s, s_len); + if (alternate_form && i_num != 0) { + *--s = *fmt; /* 'x' or 'X' */ + *--s = '0'; + s_len += 2; + } + break; + + + case 's': + case 'v': + s = va_arg(ap, char *); + if (s != NULL) { + s_len = strlen(s); + if (adjust_precision && precision < s_len) + s_len = precision; + } else { + s = const_cast(s_null); + s_len = S_NULL_LEN; + } + pad_char = ' '; + break; + + + case 'f': + case 'F': + case 'e': + case 'E': + switch(modifier) { + case LM_LONG_DOUBLE: + fp_num = (double) va_arg(ap, long double); + break; + case LM_STD: + fp_num = va_arg(ap, double); + break; + default: + goto fmt_error; + } + + if (isnan(fp_num)) { + s = const_cast("nan"); + s_len = 3; + } else if (isinf(fp_num)) { + s = const_cast("inf"); + s_len = 3; + } else { +#ifdef HAVE_LOCALE_H + if (!lconv) { + lconv = localeconv(); + } +#endif + s = php_conv_fp((*fmt == 'f')?'F':*fmt, fp_num, alternate_form, + (adjust_precision == NO) ? FLOAT_DIGITS : precision, + (*fmt == 'f')?LCONV_DECIMAL_POINT:'.', + &is_negative, &num_buf[1], &s_len); + if (is_negative) + prefix_char = '-'; + else if (print_sign) + prefix_char = '+'; + else if (print_blank) + prefix_char = ' '; + } + break; + + + case 'g': + case 'k': + case 'G': + case 'H': + switch(modifier) { + case LM_LONG_DOUBLE: + fp_num = (double) va_arg(ap, long double); + break; + case LM_STD: + fp_num = va_arg(ap, double); + break; + default: + goto fmt_error; + } + + if (isnan(fp_num)) { + s = const_cast("NAN"); + s_len = 3; + break; + } else if (isinf(fp_num)) { + if (fp_num > 0) { + s = const_cast("INF"); + s_len = 3; + } else { + s = const_cast("-INF"); + s_len = 4; + } + break; + } + + if (adjust_precision == NO) + precision = FLOAT_DIGITS; + else if (precision == 0) + precision = 1; + /* + * * We use &num_buf[ 1 ], so that we have room for the sign + */ +#ifdef HAVE_LOCALE_H + if (!lconv) { + lconv = localeconv(); + } +#endif + s = php_gcvt(fp_num, precision, + (*fmt=='H' || *fmt == 'k') ? '.' : LCONV_DECIMAL_POINT, + (*fmt == 'G' || *fmt == 'H')?'E':'e', &num_buf[1]); + if (*s == '-') + prefix_char = *s++; + else if (print_sign) + prefix_char = '+'; + else if (print_blank) + prefix_char = ' '; + + s_len = strlen(s); + + if (alternate_form && (q = strchr(s, '.')) == NULL) + s[s_len++] = '.'; + break; + + + case 'c': + char_buf[0] = (char) (va_arg(ap, int)); + s = &char_buf[0]; + s_len = 1; + pad_char = ' '; + break; + + + case '%': + char_buf[0] = '%'; + s = &char_buf[0]; + s_len = 1; + pad_char = ' '; + break; + + + case 'n': + *(va_arg(ap, int *)) = outpos; + goto skip_output; + + /* + * Always extract the argument as a "char *" pointer. We + * should be using "void *" but there are still machines + * that don't understand it. + * If the pointer size is equal to the size of an unsigned + * integer we convert the pointer to a hex number, otherwise + * we print "%p" to indicate that we don't handle "%p". + */ + case 'p': + if (sizeof(char *) <= sizeof(u_wide_int)) { + ui_num = (u_wide_int)((size_t) va_arg(ap, char *)); + s = ap_php_conv_p2(ui_num, 4, 'x', + &num_buf[NUM_BUF_SIZE], &s_len); + if (ui_num != 0) { + *--s = 'x'; + *--s = '0'; + s_len += 2; + } + } else { + s = const_cast("%p"); + s_len = 2; + } + pad_char = ' '; + break; + + + case NUL: + /* + * The last character of the format string was %. + * We ignore it. + */ + continue; + + +fmt_error: + throw Exception("Illegal length modifier specified '%c'", *fmt); + + /* + * The default case is for unrecognized %'s. + * We print % to help the user identify what + * option is not understood. + * This is also useful in case the user wants to pass + * the output of format_converter to another function + * that understands some other % (like syslog). + * Note that we can't point s inside fmt because the + * unknown could be preceded by width etc. + */ + default: + char_buf[0] = '%'; + char_buf[1] = *fmt; + s = char_buf; + s_len = 2; + pad_char = ' '; + break; + } + + if (prefix_char != NUL) { + *--s = prefix_char; + s_len++; + } + if (adjust_width && adjust == RIGHT && min_width > s_len) { + if (pad_char == '0' && prefix_char != NUL) { + appendchar(&result, &outpos, &size, *s); + s++; + s_len--; + min_width--; + } + for (int i = 0; i < min_width - s_len; i++) { + appendchar(&result, &outpos, &size, pad_char); + } + } + /* + * Print the string s. + */ + appendstring(&result, &outpos, &size, s, 0, 0, ' ', 0, s_len, 0, 0, 0); + + if (adjust_width && adjust == LEFT && min_width > s_len) { + for (int i = 0; i < min_width - s_len; i++) { + appendchar(&result, &outpos, &size, pad_char); + } + } + } +skip_output: + fmt++; + } + result[outpos] = NUL; + *outbuf = result; + return outpos; +} + +/* + * This is the general purpose conversion function. + */ +int vspprintf(char **pbuf, size_t max_len, const char *format, ...) +{ + int len; + va_list ap; + va_start(ap, format); + len = xbuf_format_converter(pbuf, format, ap); + va_end(ap); + return len; +} + +/* + * Same as vspprintf but taking an va_list + */ +int vspprintf_ap(char **pbuf, size_t max_len, const char *format, va_list ap) +{ + int len; + len = xbuf_format_converter(pbuf, format, ap); + return len; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_printf.h b/src/cpp/base/zend/zend_printf.h new file mode 100644 index 0000000000000..5d6c91a5792c1 --- /dev/null +++ b/src/cpp/base/zend/zend_printf.h @@ -0,0 +1,37 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_PRINTF_H__ +#define __HPHP_ZEND_PRINTF_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * How PHP formats a string. Called by ext/ext_string.cpp. + */ +char *string_printf(const char *format, int len, CArrRef args, int *outlen); + +int vspprintf(char **pbuf, size_t max_len, const char *format, ...); +int vspprintf_ap(char **pbuf, size_t max_len, const char *format, va_list ap); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_PRINTF_H__ diff --git a/src/cpp/base/zend/zend_rand.cpp b/src/cpp/base/zend/zend_rand.cpp new file mode 100644 index 0000000000000..7051a66f97b51 --- /dev/null +++ b/src/cpp/base/zend/zend_rand.cpp @@ -0,0 +1,246 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +/* MT RAND FUNCTIONS */ + +/* + The following php_mt_...() functions are based on a C++ class MTRand by + Richard J. Wagner. For more information see the web page at + http://www-personal.engin.umich.edu/~wagnerr/MersenneTwister.html + + Mersenne Twister random number generator -- a C++ class MTRand + Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus + Richard J. Wagner v1.0 15 May 2003 rjwagner@writeme.com + + The Mersenne Twister is an algorithm for generating random numbers. It + was designed with consideration of the flaws in various other generators. + The period, 2^19937-1, and the order of equidistribution, 623 dimensions, + are far greater. The generator is also fast; it avoids multiplication and + division, and it benefits from caches and pipelines. For more information + see the inventors' web page at http://www.math.keio.ac.jp/~matumoto/emt.html + + Reference + M. Matsumoto and T. Nishimura, "Mersenne Twister: A 623-Dimensionally + Equidistributed Uniform Pseudo-Random Number Generator", ACM Transactions on + Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30. + + Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + Copyright (C) 2000 - 2003, Richard J. Wagner + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The original code included the following notice: + + When you use this, send an email to: matumoto@math.keio.ac.jp + with an appropriate reference to your work. + + It would be nice to CC: rjwagner@writeme.com and Cokus@math.washington.edu + when you write. +*/ + +#define MT_N (624) +#define N MT_N // length of state vector +#define M (397) // a period parameter +#define hiBit(u) ((u) & 0x80000000U) // mask all but highest bit of u +#define loBit(u) ((u) & 0x00000001U) // mask all but lowest bit of u +#define loBits(u) ((u) & 0x7FFFFFFFU) // mask the highest bit of u +#define mixBits(u, v) (hiBit(u)|loBits(v)) // move hi bit of u to hi bit of v + +#define twist(m,u,v) \ + (m ^ (mixBits(u,v)>>1) ^ ((uint32)(-(int32)(loBit(u))) & 0x9908b0dfU)) + +class RandData { +public: + RandData() + : seeded(false), left(0), next(NULL), + lcg_seeded(false), lcg_s1(0), lcg_s2(0) { + memset(state, 0, sizeof(state)); + } + + bool seeded; + int left; + uint32 state[N]; + uint32 *next; + + bool lcg_seeded; + int32 lcg_s1; + int32 lcg_s2; +}; +static ThreadLocal s_rand_data; + +static inline void php_mt_initialize(uint32 seed, uint32 *state) { + /* Initialize generator state with seed + See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. + In previous versions, most significant bits (MSBs) of the seed affect + only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. */ + + register uint32 *s = state; + register uint32 *r = state; + register int i = 1; + + *s++ = seed & 0xffffffffU; + for( ; i < N; ++i ) { + *s++ = ( 1812433253U * ( *r ^ (*r >> 30) ) + i ) & 0xffffffffU; + r++; + } +} + +static inline void php_mt_reload() { + /* Generate N new values in state + Made clearer and faster by Matthew Bellew (matthew.bellew@home.com) */ + + RandData *data = s_rand_data.get(); + register uint32 *state = data->state; + register uint32 *p = state; + register int i; + + for (i = N - M; i--; ++p) + *p = twist(p[M], p[0], p[1]); + for (i = M; --i; ++p) + *p = twist(p[M-N], p[0], p[1]); + *p = twist(p[M-N], p[0], state[0]); + data->left = N; + data->next = state; +} + +void math_mt_srand(uint32 seed) { + RandData *data = s_rand_data.get(); + + /* Seed the generator with a simple uint32 */ + php_mt_initialize(seed, data->state); + php_mt_reload(); + + /* Seed only once */ + data->seeded = true; +} + +static inline uint32 php_mt_rand() { + // Pull a 32-bit integer from the generator state + // Every other access function simply transforms the numbers extracted here + + register uint32 s1; + + RandData *data = s_rand_data.get(); + if (data->left == 0) { + php_mt_reload(); + } + --data->left; + + s1 = *data->next++; + s1 ^= (s1 >> 11); + s1 ^= (s1 << 7) & 0x9d2c5680U; + s1 ^= (s1 << 15) & 0xefc60000U; + return ( s1 ^ (s1 >> 18) ); +} + +// Returns a random number from Mersenne Twister +long math_mt_rand(long min /* = 0 */, long max /* = RAND_MAX */) { + if (!s_rand_data->seeded) { + math_mt_srand(GENERATE_SEED()); + } + + /* + * Melo: hmms.. randomMT() returns 32 random bits... + * Yet, the previous php_rand only returns 31 at most. + * So I put a right shift to loose the lsb. It *seems* + * better than clearing the msb. + * Update: + * I talked with Cokus via email and it won't ruin the algorithm + */ + long number = (php_mt_rand() >> 1); + if (min != 0 || max != RAND_MAX) { + RAND_RANGE(number, min, max, MT_RAND_MAX); + } + return number; +} + +/////////////////////////////////////////////////////////////////////////////// + +/* + * combinedLCG() returns a pseudo random number in the range of (0, 1). + * The function combines two CGs with periods of + * 2^31 - 85 and 2^31 - 249. The period of this function + * is equal to the product of both primes. + */ + +#define MODMULT(a, b, c, m, s) q = s/a;s=b*(s-a*q)-c*q;if(s<0)s+=m + +static void lcg_seed() { + RandData *data = s_rand_data.get(); + struct timeval tv; + if (gettimeofday(&tv, NULL) == 0) { + data->lcg_s1 = tv.tv_sec ^ (~tv.tv_usec); + } else { + data->lcg_s1 = 1; + } + data->lcg_s2 = (long)getpid(); + data->lcg_seeded = true; +} + +double math_combined_lcg() { + int32 q; + int32 z; + + RandData *data = s_rand_data.get(); + if (!data->lcg_seeded) { + lcg_seed(); + } + + MODMULT(53668, 40014, 12211, 2147483563L, data->lcg_s1); + MODMULT(52774, 40692, 3791, 2147483399L, data->lcg_s2); + + z = data->lcg_s1 - data->lcg_s2; + if (z < 1) { + z += 2147483562; + } + + return z * 4.656613e-10; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_scanf.cpp b/src/cpp/base/zend/zend_scanf.cpp new file mode 100644 index 0000000000000..c299e976eafc2 --- /dev/null +++ b/src/cpp/base/zend/zend_scanf.cpp @@ -0,0 +1,1042 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +/* + scanf.c -- + + This file contains the base code which implements sscanf and by extension + fscanf. Original code is from TCL8.3.0 and bears the following copyright: + + This software is copyrighted by the Regents of the University of + California, Sun Microsystems, Inc., Scriptics Corporation, + and other parties. The following terms apply to all files associated + with the software unless explicitly disclaimed in individual files. + + The authors hereby grant permission to use, copy, modify, distribute, + and license this software and its documentation for any purpose, provided + that existing copyright notices are retained in all copies and that this + notice is included verbatim in any distributions. No written agreement, + license, or royalty fee is required for any of the authorized uses. + Modifications to this software may be copyrighted by their authors + and need not follow the licensing terms described here, provided that + the new terms are clearly indicated on the first page of each file where + they apply. + + IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY + FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY + DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE + IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE + NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR + MODIFICATIONS. + + GOVERNMENT USE: If you are acquiring this software on behalf of the + U.S. government, the Government shall have only "Restricted Rights" + in the software and related documentation as defined in the Federal + Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you + are acquiring the software on behalf of the Department of Defense, the + software shall be classified as "Commercial Computer Software" and the + Government shall have only "Restricted Rights" as defined in Clause + 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the + authors grant the U.S. Government and others acting in its behalf + permission to use and distribute the software in accordance with the + terms specified in this license. +*/ + +#define SCAN_MAX_ARGS 0xFF // Maximum number of variable which can be + // passed to (f|s)scanf. This is an artifical + // upper limit to keep resources in check and + // minimize the possibility of exploits + +#define SCAN_SUCCESS SUCCESS +#define SCAN_ERROR_EOF -1 // indicates premature termination of scan + // can be caused by bad parameters or format + // string. +#define SCAN_ERROR_INVALID_FORMAT (SCAN_ERROR_EOF - 1) +#define SCAN_ERROR_VAR_PASSED_BYVAL (SCAN_ERROR_INVALID_FORMAT - 1) +#define SCAN_ERROR_WRONG_PARAM_COUNT (SCAN_ERROR_VAR_PASSED_BYVAL - 1) +#define SCAN_ERROR_INTERNAL (SCAN_ERROR_WRONG_PARAM_COUNT - 1) + +/* + * Flag values used internally by [f|s]canf. + */ +#define SCAN_NOSKIP 0x1 /* Don't skip blanks. */ +#define SCAN_SUPPRESS 0x2 /* Suppress assignment. */ +#define SCAN_UNSIGNED 0x4 /* Read an unsigned value. */ +#define SCAN_WIDTH 0x8 /* A width value was supplied. */ + +#define SCAN_SIGNOK 0x10 /* A +/- character is allowed. */ +#define SCAN_NODIGITS 0x20 /* No digits have been scanned. */ +#define SCAN_NOZERO 0x40 /* No zero digits have been scanned. */ +#define SCAN_XOK 0x80 /* An 'x' is allowed. */ +#define SCAN_PTOK 0x100 /* Decimal point is allowed. */ +#define SCAN_EXPOK 0x200 /* An exponent is allowed. */ + +#define UCHAR(x) (unsigned char)(x) + +/////////////////////////////////////////////////////////////////////////////// +/* + * The following structure contains the information associated with + * a character set. + */ +struct Range { + char start; + char end; +}; + +typedef struct CharSet { + int exclude; /* 1 if this is an exclusion set. */ + int nchars; + char *chars; + int nranges; + Range *ranges; +} CharSet; + +/** + *---------------------------------------------------------------------- + * + * BuildCharSet -- + * + * This function examines a character set format specification + * and builds a CharSet containing the individual characters and + * character ranges specified. + * + * Results: + * Returns the next format position. + * + * Side effects: + * Initializes the charset. + * + *---------------------------------------------------------------------- + */ +static const char *BuildCharSet(CharSet *cset, const char *format) { + const char *ch; + char start; + int nranges; + const char *end; + + memset(cset, 0, sizeof(CharSet)); + + ch = format; + if (*ch == '^') { + cset->exclude = 1; + ch = ++format; + } + end = format + 1; /* verify this - cc */ + + /* + * Find the close bracket so we can overallocate the set. + */ + if (*ch == ']') { + ch = end++; + } + nranges = 0; + while (*ch != ']') { + if (*ch == '-') { + nranges++; + } + ch = end++; + } + + cset->chars = (char *)malloc(end - format - 1); + if (nranges > 0) { + cset->ranges = (struct Range *)malloc(sizeof(struct Range) * nranges); + } else { + cset->ranges = NULL; + } + + /* + * Now build the character set. + */ + cset->nchars = cset->nranges = 0; + ch = format++; + start = *ch; + if (*ch == ']' || *ch == '-') { + cset->chars[cset->nchars++] = *ch; + ch = format++; + } + while (*ch != ']') { + if (*format == '-') { + /* + * This may be the first character of a range, so don't add + * it yet. + */ + start = *ch; + } else if (*ch == '-') { + /* + * Check to see if this is the last character in the set, in which + * case it is not a range and we should add the previous character + * as well as the dash. + */ + if (*format == ']') { + cset->chars[cset->nchars++] = start; + cset->chars[cset->nchars++] = *ch; + } else { + ch = format++; + + /* + * Check to see if the range is in reverse order. + */ + if (start < *ch) { + cset->ranges[cset->nranges].start = start; + cset->ranges[cset->nranges].end = *ch; + } else { + cset->ranges[cset->nranges].start = *ch; + cset->ranges[cset->nranges].end = start; + } + cset->nranges++; + } + } else { + cset->chars[cset->nchars++] = *ch; + } + ch = format++; + } + return format; +} + +/** + *---------------------------------------------------------------------- + * + * CharInSet -- + * + * Check to see if a character matches the given set. + * + * Results: + * Returns non-zero if the character matches the given set. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +static int CharInSet(CharSet *cset, int c) { + char ch = (char) c; + int i, match = 0; + + for (i = 0; i < cset->nchars; i++) { + if (cset->chars[i] == ch) { + match = 1; + break; + } + } + if (!match) { + for (i = 0; i < cset->nranges; i++) { + if ((cset->ranges[i].start <= ch) + && (ch <= cset->ranges[i].end)) { + match = 1; + break; + } + } + } + return (cset->exclude ? !match : match); +} + +/** + *---------------------------------------------------------------------- + * + * ReleaseCharSet -- + * + * Free the storage associated with a character set. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +static void ReleaseCharSet(CharSet *cset) { + free((char *)cset->chars); + if (cset->ranges) { + free((char *)cset->ranges); + } +} + +/** + *---------------------------------------------------------------------- + * + * ValidateFormat -- + * + * Parse the format string and verify that it is properly formed + * and that there are exactly enough variables on the command line. + * + * Parameters : + * format The format string. + * numVars The number of variables passed to the scan command. + * totalSubs The number of variables that will be required. + * + *---------------------------------------------------------------------- +*/ +static void ValidateFormat(const char *format, int numVars, int *totalSubs) { +#define STATIC_LIST_SIZE 16 + int gotXpg, gotSequential, value, i, flags; + const char *end, *ch = NULL; + int staticAssign[STATIC_LIST_SIZE]; + int *nassign = staticAssign; + int objIndex, xpgSize, nspace = STATIC_LIST_SIZE; + + /* + * Initialize an array that records the number of times a variable + * is assigned to by the format string. We use this to detect if + * a variable is multiply assigned or left unassigned. + */ + if (numVars > nspace) { + nassign = (int*)malloc(sizeof(int) * numVars); + nspace = numVars; + } + for (i = 0; i < nspace; i++) { + nassign[i] = 0; + } + + xpgSize = objIndex = gotXpg = gotSequential = 0; + + while (*format != '\0') { + ch = format++; + flags = 0; + + if (*ch != '%') { + continue; + } + ch = format++; + if (*ch == '%') { + continue; + } + if (*ch == '*') { + flags |= SCAN_SUPPRESS; + ch = format++; + goto xpgCheckDone; + } + + if ( isdigit( (int)*ch ) ) { + /* + * Check for an XPG3-style %n$ specification. Note: there + * must not be a mixture of XPG3 specs and non-XPG3 specs + * in the same format string. + */ + char *endptr; + value = strtoul(format-1, &endptr, 10); + end = endptr; + if (*end != '$') { + goto notXpg; + } + format = end+1; + ch = format++; + gotXpg = 1; + if (gotSequential) { + goto mixedXPG; + } + objIndex = value - 1; + if ((objIndex < 0) || (numVars && (objIndex >= numVars))) { + goto badIndex; + } else if (numVars == 0) { + /* + * In the case where no vars are specified, the user can + * specify %9999$ legally, so we have to consider special + * rules for growing the assign array. 'value' is + * guaranteed to be > 0. + */ + + /* set a lower artificial limit on this + * in the interest of security and resource friendliness + * 255 arguments should be more than enough. - cc + */ + if (value > SCAN_MAX_ARGS) { + goto badIndex; + } + + xpgSize = (xpgSize > value) ? xpgSize : value; + } + goto xpgCheckDone; + } + +notXpg: + gotSequential = 1; + if (gotXpg) { +mixedXPG: + if (nassign != staticAssign) free((char *)nassign); + throw InvalidArgumentException + ("format", "cannot mix \"\%\" and \"\%n$\" conversion specifiers"); + } + +xpgCheckDone: + /* + * Parse any width specifier. + */ + if (isdigit(UCHAR(*ch))) { + char *endptr; + value = strtoul(format-1, &endptr, 10); + format = endptr; + flags |= SCAN_WIDTH; + ch = format++; + } + + /* + * Ignore size specifier. + */ + if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) { + ch = format++; + } + + if (!(flags & SCAN_SUPPRESS) && numVars && (objIndex >= numVars)) { + goto badIndex; + } + + /* + * Handle the various field types. + */ + switch (*ch) { + case 'n': + case 'd': + case 'D': + case 'i': + case 'o': + case 'x': + case 'X': + case 'u': + case 'f': + case 'e': + case 'E': + case 'g': + case 's': + break; + + case 'c': + /* we differ here with the TCL implementation in allowing for */ + /* a character width specification, to be more consistent with */ + /* ANSI. since Zend auto allocates space for vars, this is no */ + /* problem - cc */ + /* + if (flags & SCAN_WIDTH) { + throw InvalidArgumentException + ("format", "Field width may not be specified in %c conversion"); + } + */ + break; + + case '[': + if (*format == '\0') { + goto badSet; + } + ch = format++; + if (*ch == '^') { + if (*format == '\0') { + goto badSet; + } + ch = format++; + } + if (*ch == ']') { + if (*format == '\0') { + goto badSet; + } + ch = format++; + } + while (*ch != ']') { + if (*format == '\0') { + goto badSet; + } + ch = format++; + } + break; + badSet: + if (nassign != staticAssign) free((char *)nassign); + throw InvalidArgumentException("format", "Unmatched [ in format string"); + + default: + if (nassign != staticAssign) free((char *)nassign); + throw InvalidArgumentException + (0, "Bad scan conversion character \"%c\"", *ch); + } + + if (!(flags & SCAN_SUPPRESS)) { + if (objIndex >= nspace) { + /* + * Expand the nassign buffer. If we are using XPG specifiers, + * make sure that we grow to a large enough size. xpgSize is + * guaranteed to be at least one larger than objIndex. + */ + value = nspace; + if (xpgSize) { + nspace = xpgSize; + } else { + nspace += STATIC_LIST_SIZE; + } + if (nassign == staticAssign) { + nassign = (int*)malloc(nspace * sizeof(int)); + for (i = 0; i < STATIC_LIST_SIZE; ++i) { + nassign[i] = staticAssign[i]; + } + } else { + nassign = (int*)realloc((void *)nassign, nspace * sizeof(int)); + } + for (i = value; i < nspace; i++) { + nassign[i] = 0; + } + } + nassign[objIndex]++; + objIndex++; + } + } /* while (*format != '\0') */ + + /* + * Verify that all of the variable were assigned exactly once. + */ + if (numVars == 0) { + if (xpgSize) { + numVars = xpgSize; + } else { + numVars = objIndex; + } + } + if (totalSubs) { + *totalSubs = numVars; + } + for (i = 0; i < numVars; i++) { + if (nassign[i] > 1) { + if (nassign != staticAssign) free((char *)nassign); + throw InvalidArgumentException + ("format", "Variable is assigned by multiple \"%%n$\" specifiers"); + } else if (!xpgSize && (nassign[i] == 0)) { + /* + * If the space is empty, and xpgSize is 0 (means XPG wasn't + * used, and/or numVars != 0), then too many vars were given + */ + if (nassign != staticAssign) free((char *)nassign); + throw InvalidArgumentException + ("format", "Variable is not assigned by any conversion specifiers"); + } + } + + if (nassign != staticAssign) free((char *)nassign); + return; + +badIndex: + if (nassign != staticAssign) free((char *)nassign); + if (gotXpg) { + throw InvalidArgumentException + ("format", "\"%%n$\" argument index out of range"); + } else { + throw InvalidArgumentException + ("format", "Different numbers of variable names and field specifiers"); + } +#undef STATIC_LIST_SIZE +} + +/** + * This is the internal function which does processing on behalf of + * both sscanf() and fscanf() + * + * parameters : + * string literal string to be processed + * format format string + * return_value set with the results of the scan + */ +void string_sscanf(const char *string, const char *format, int numVars, + Array &return_value) { + int totalVars = -1; + int value; + char *end; + const char *baseString; + char op = 0; + int base = 0; + int underflow = 0; + size_t width; + long (*fn)(const char *, char **, int) = NULL; + const char *ch; + char sch; + int flags; + char buf[64]; /* Temporary buffer to hold scanned number + * strings before they are passed to strtoul() */ + + /* + * Check for errors in the format string. + */ + ValidateFormat(format, numVars, &totalVars); + + baseString = string; + + /* + * Iterate over the format string filling in the result objects until + * we reach the end of input, the end of the format string, or there + * is a mismatch. + */ + while (*format != '\0') { + ch = format++; + flags = 0; + + /* + * If we see whitespace in the format, skip whitespace in the string. + */ + if ( isspace( (int)*ch ) ) { + sch = *string; + while ( isspace( (int)sch ) ) { + if (*string == '\0') { + return; + } + string++; + sch = *string; + } + continue; + } + + if (*ch != '%') { + literal: + if (*string == '\0') { + underflow = 1; + return; + } + sch = *string; + string++; + if (*ch != sch) { + return; + } + continue; + } + + ch = format++; + if (*ch == '%') { + goto literal; + } + + /* + * Check for assignment suppression ('*') or an XPG3-style + * assignment ('%n$'). + */ + if (*ch == '*') { + flags |= SCAN_SUPPRESS; + ch = format++; + } else if ( isdigit(UCHAR(*ch))) { + value = strtoul(format-1, &end, 10); + if (*end == '$') { + format = end+1; + ch = format++; + } + } + + /* + * Parse any width specifier. + */ + if ( isdigit(UCHAR(*ch))) { + char *endptr; + width = strtoul(format-1, &endptr, 10); + format = endptr; + ch = format++; + } else { + width = 0; + } + + /* + * Ignore size specifier. + */ + if ((*ch == 'l') || (*ch == 'L') || (*ch == 'h')) { + ch = format++; + } + + /* + * Handle the various field types. + */ + switch (*ch) { + case 'n': + if (!(flags & SCAN_SUPPRESS)) { + return_value.append((int)(string - baseString)); + } + continue; + + case 'd': + case 'D': + op = 'i'; + base = 10; + fn = (long (*)(const char *, char **, int))strtol; + break; + case 'i': + op = 'i'; + base = 0; + fn = (long (*)(const char *, char **, int))strtol; + break; + case 'o': + op = 'i'; + base = 8; + fn = (long (*)(const char *, char **, int))strtol; + break; + case 'x': + case 'X': + op = 'i'; + base = 16; + fn = (long (*)(const char *, char **, int))strtol; + break; + case 'u': + op = 'i'; + base = 10; + flags |= SCAN_UNSIGNED; + fn = (long (*)(const char *, char **, int))strtoul; + break; + + case 'f': + case 'e': + case 'E': + case 'g': + op = 'f'; + break; + + case 's': + op = 's'; + break; + + case 'c': + op = 's'; + flags |= SCAN_NOSKIP; + /*-cc-*/ + if (0 == width) { + width = 1; + } + /*-cc-*/ + break; + case '[': + op = '['; + flags |= SCAN_NOSKIP; + break; + } /* switch */ + + /* + * At this point, we will need additional characters from the + * string to proceed. + */ + if (*string == '\0') { + underflow = 1; + return; + } + + /* + * Skip any leading whitespace at the beginning of a field unless + * the format suppresses this behavior. + */ + if (!(flags & SCAN_NOSKIP)) { + while (*string != '\0') { + sch = *string; + if (! isspace((int)sch) ) { + break; + } + string++; + } + if (*string == '\0') { + underflow = 1; + return; + } + } + + /* + * Perform the requested scanning operation. + */ + switch (op) { + case 'c': + case 's': + /* + * Scan a string up to width characters or whitespace. + */ + if (width == 0) { + width = (size_t) ~0; + } + end = (char*)string; + while (*end != '\0') { + sch = *end; + if ( isspace( (int)sch ) ) { + break; + } + end++; + if (--width == 0) { + break; + } + } + if (!(flags & SCAN_SUPPRESS)) { + return_value.append(String(string, end-string, CopyString)); + } + string = end; + break; + + case '[': { + CharSet cset; + + if (width == 0) { + width = (size_t) ~0; + } + end = (char*)string; + + format = BuildCharSet(&cset, format); + while (*end != '\0') { + sch = *end; + if (!CharInSet(&cset, (int)sch)) { + break; + } + end++; + if (--width == 0) { + break; + } + } + ReleaseCharSet(&cset); + + if (string == end) { + /* + * Nothing matched the range, stop processing + */ + return; + } + if (!(flags & SCAN_SUPPRESS)) { + return_value.append(String(string, end-string, CopyString)); + } + string = end; + break; + } + case 'i': + /* + * Scan an unsigned or signed integer. + */ + /*-cc-*/ + buf[0] = '\0'; + /*-cc-*/ + if ((width == 0) || (width > sizeof(buf) - 1)) { + width = sizeof(buf) - 1; + } + + flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO; + for (end = buf; width > 0; width--) { + switch (*string) { + /* + * The 0 digit has special meaning at the beginning of + * a number. If we are unsure of the base, it + * indicates that we are in base 8 or base 16 (if it is + * followed by an 'x'). + */ + case '0': + /*-cc-*/ + if (base == 16) { + flags |= SCAN_XOK; + } + /*-cc-*/ + if (base == 0) { + base = 8; + flags |= SCAN_XOK; + } + if (flags & SCAN_NOZERO) { + flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS | SCAN_NOZERO); + } else { + flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); + } + goto addToInt; + + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': + if (base == 0) { + base = 10; + } + flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); + goto addToInt; + + case '8': case '9': + if (base == 0) { + base = 10; + } + if (base <= 8) { + break; + } + flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); + goto addToInt; + + case 'A': case 'B': case 'C': + case 'D': case 'E': case 'F': + case 'a': case 'b': case 'c': + case 'd': case 'e': case 'f': + if (base <= 10) { + break; + } + flags &= ~(SCAN_SIGNOK | SCAN_XOK | SCAN_NODIGITS); + goto addToInt; + + case '+': case '-': + if (flags & SCAN_SIGNOK) { + flags &= ~SCAN_SIGNOK; + goto addToInt; + } + break; + + case 'x': case 'X': + if ((flags & SCAN_XOK) && (end == buf+1)) { + base = 16; + flags &= ~SCAN_XOK; + goto addToInt; + } + break; + } + + /* + * We got an illegal character so we are done accumulating. + */ + break; + + addToInt: + /* + * Add the character to the temporary buffer. + */ + *end++ = *string++; + if (*string == '\0') { + break; + } + } + + /* + * Check to see if we need to back up because we only got a + * sign or a trailing x after a 0. + */ + if (flags & SCAN_NODIGITS) { + if (*string == '\0') { + underflow = 1; + } + return; + } else if (end[-1] == 'x' || end[-1] == 'X') { + end--; + string--; + } + + /* + * Scan the value from the temporary buffer. If we are + * returning a large unsigned value, we have to convert it back + * to a string since PHP only supports signed values. + */ + if (!(flags & SCAN_SUPPRESS)) { + *end = '\0'; + value = (int) (*fn)(buf, NULL, base); + if ((flags & SCAN_UNSIGNED) && (value < 0)) { + snprintf(buf, sizeof(buf), "%u", value); /* INTL: ISO digit */ + return_value.append(String(buf, CopyString)); + } else { + return_value.append(value); + } + } + break; + + case 'f': + /* + * Scan a floating point number + */ + buf[0] = '\0'; /* call me pedantic */ + if ((width == 0) || (width > sizeof(buf) - 1)) { + width = sizeof(buf) - 1; + } + flags |= SCAN_SIGNOK | SCAN_NODIGITS | SCAN_PTOK | SCAN_EXPOK; + for (end = buf; width > 0; width--) { + switch (*string) { + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + case '8': case '9': + flags &= ~(SCAN_SIGNOK | SCAN_NODIGITS); + goto addToFloat; + case '+': + case '-': + if (flags & SCAN_SIGNOK) { + flags &= ~SCAN_SIGNOK; + goto addToFloat; + } + break; + case '.': + if (flags & SCAN_PTOK) { + flags &= ~(SCAN_SIGNOK | SCAN_PTOK); + goto addToFloat; + } + break; + case 'e': + case 'E': + /* + * An exponent is not allowed until there has + * been at least one digit. + */ + if ((flags & (SCAN_NODIGITS | SCAN_EXPOK)) == SCAN_EXPOK) { + flags = (flags & ~(SCAN_EXPOK|SCAN_PTOK)) + | SCAN_SIGNOK | SCAN_NODIGITS; + goto addToFloat; + } + break; + } + + /* + * We got an illegal character so we are done accumulating. + */ + break; + + addToFloat: + /* + * Add the character to the temporary buffer. + */ + *end++ = *string++; + if (*string == '\0') { + break; + } + } + + /* + * Check to see if we need to back up because we saw a + * trailing 'e' or sign. + */ + if (flags & SCAN_NODIGITS) { + if (flags & SCAN_EXPOK) { + /* + * There were no digits at all so scanning has + * failed and we are done. + */ + if (*string == '\0') { + underflow = 1; + } + return; + } + + /* + * We got a bad exponent ('e' and maybe a sign). + */ + end--; + string--; + if (*end != 'e' && *end != 'E') { + end--; + string--; + } + } + + /* + * Scan the value from the temporary buffer. + */ + if (!(flags & SCAN_SUPPRESS)) { + double dvalue; + *end = '\0'; + dvalue = strtod(buf, NULL); + return_value.append(dvalue); + } + break; + } /* switch (op) */ + } /* while (*format != '\0') */ +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_scanf.h b/src/cpp/base/zend/zend_scanf.h new file mode 100644 index 0000000000000..6ed909a86c6b3 --- /dev/null +++ b/src/cpp/base/zend/zend_scanf.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_SCANF_H__ +#define __HPHP_ZEND_SCANF_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * How PHP scans a string. Called by ext/ext_string.cpp. + */ +void string_sscanf(const char *string, const char *format, int numVars, + Array &return_value); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_SCANF_H__ diff --git a/src/cpp/base/zend/zend_sha1.cpp b/src/cpp/base/zend/zend_sha1.cpp new file mode 100644 index 0000000000000..f646366d85554 --- /dev/null +++ b/src/cpp/base/zend/zend_sha1.cpp @@ -0,0 +1,314 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static unsigned char PADDING[64] = { + 0x80, 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 +}; + +// F, G, H and I are basic SHA1 functions. +#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define G(x, y, z) ((x) ^ (y) ^ (z)) +#define H(x, y, z) (((x) & (y)) | ((z) & ((x) | (y)))) +#define I(x, y, z) ((x) ^ (y) ^ (z)) + +// ROTATE_LEFT rotates x left n bits. +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +// W[i] +#define W(i) ( tmp=x[(i-3)&15]^x[(i-8)&15]^x[(i-14)&15]^x[i&15], \ + (x[i&15]=ROTATE_LEFT(tmp, 1)) ) + +// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. +#define FF(a, b, c, d, e, w) { \ + (e) += F ((b), (c), (d)) + (w) + (uint32)(0x5A827999); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } +#define GG(a, b, c, d, e, w) { \ + (e) += G ((b), (c), (d)) + (w) + (uint32)(0x6ED9EBA1); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } +#define HH(a, b, c, d, e, w) { \ + (e) += H ((b), (c), (d)) + (w) + (uint32)(0x8F1BBCDC); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } +#define II(a, b, c, d, e, w) { \ + (e) += I ((b), (c), (d)) + (w) + (uint32)(0xCA62C1D6); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } + +static void SHA1Transform(uint32 state[5], const unsigned char block[64]); + +/** + * Encodes input (uint32) into output (unsigned char). Assumes len is + * a multiple of 4. + */ +static void SHA1Encode(unsigned char *output, uint32 *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char) ((input[i] >> 24) & 0xff); + output[j + 1] = (unsigned char) ((input[i] >> 16) & 0xff); + output[j + 2] = (unsigned char) ((input[i] >> 8) & 0xff); + output[j + 3] = (unsigned char) (input[i] & 0xff); + } +} + +/** + * Decodes input (unsigned char) into output (uint32). Assumes len is + * a multiple of 4. + */ +static void SHA1Decode(uint32 *output, const unsigned char *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[i] = ((uint32) input[j + 3]) | (((uint32) input[j + 2]) << 8) | + (((uint32) input[j + 1]) << 16) | (((uint32) input[j]) << 24); + } +} + +/* SHA1 context. */ +typedef struct { + uint32 state[5]; /* state (ABCD) */ + uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} PHP_SHA1_CTX; + +/** + * SHA1 initialization. Begins an SHA1 operation, writing a new context. + */ +void PHP_SHA1Init(PHP_SHA1_CTX * context) { + context->count[0] = context->count[1] = 0; + // Load magic initialization constants. + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; + context->state[4] = 0xc3d2e1f0; +} + +/** + * SHA1 block update operation. Continues an SHA1 message-digest + * operation, processing another message block, and updating the context. + */ +void PHP_SHA1Update(PHP_SHA1_CTX * context, const unsigned char *input, + unsigned int inputLen) { + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((uint32) inputLen << 3)) + < ((uint32) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((uint32) inputLen >> 29); + + partLen = 64 - index; + + // Transform as many times as possible. + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + SHA1Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) { + SHA1Transform(context->state, &input[i]); + } + + index = 0; + } else + i = 0; + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +/** + * SHA1 finalization. Ends an SHA1 message-digest operation, writing the + * the message digest and zeroizing the context. + */ +void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX * context) { + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + bits[7] = context->count[0] & 0xFF; + bits[6] = (context->count[0] >> 8) & 0xFF; + bits[5] = (context->count[0] >> 16) & 0xFF; + bits[4] = (context->count[0] >> 24) & 0xFF; + bits[3] = context->count[1] & 0xFF; + bits[2] = (context->count[1] >> 8) & 0xFF; + bits[1] = (context->count[1] >> 16) & 0xFF; + bits[0] = (context->count[1] >> 24) & 0xFF; + + // Pad out to 56 mod 64. + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + PHP_SHA1Update(context, PADDING, padLen); + + /* Append length (before padding) */ + PHP_SHA1Update(context, bits, 8); + + /* Store state in digest */ + SHA1Encode(digest, context->state, 20); + + // Zeroize sensitive information. + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/** + * SHA1 basic transformation. Transforms state based on block. + */ +static void SHA1Transform(uint32 state[5], const unsigned char block[64]) { + uint32 a = state[0], b = state[1], c = state[2]; + uint32 d = state[3], e = state[4], x[16], tmp; + + SHA1Decode(x, block, 64); + + /* Round 1 */ + FF(a, b, c, d, e, x[0]); /* 1 */ + FF(e, a, b, c, d, x[1]); /* 2 */ + FF(d, e, a, b, c, x[2]); /* 3 */ + FF(c, d, e, a, b, x[3]); /* 4 */ + FF(b, c, d, e, a, x[4]); /* 5 */ + FF(a, b, c, d, e, x[5]); /* 6 */ + FF(e, a, b, c, d, x[6]); /* 7 */ + FF(d, e, a, b, c, x[7]); /* 8 */ + FF(c, d, e, a, b, x[8]); /* 9 */ + FF(b, c, d, e, a, x[9]); /* 10 */ + FF(a, b, c, d, e, x[10]); /* 11 */ + FF(e, a, b, c, d, x[11]); /* 12 */ + FF(d, e, a, b, c, x[12]); /* 13 */ + FF(c, d, e, a, b, x[13]); /* 14 */ + FF(b, c, d, e, a, x[14]); /* 15 */ + FF(a, b, c, d, e, x[15]); /* 16 */ + FF(e, a, b, c, d, W(16)); /* 17 */ + FF(d, e, a, b, c, W(17)); /* 18 */ + FF(c, d, e, a, b, W(18)); /* 19 */ + FF(b, c, d, e, a, W(19)); /* 20 */ + + /* Round 2 */ + GG(a, b, c, d, e, W(20)); /* 21 */ + GG(e, a, b, c, d, W(21)); /* 22 */ + GG(d, e, a, b, c, W(22)); /* 23 */ + GG(c, d, e, a, b, W(23)); /* 24 */ + GG(b, c, d, e, a, W(24)); /* 25 */ + GG(a, b, c, d, e, W(25)); /* 26 */ + GG(e, a, b, c, d, W(26)); /* 27 */ + GG(d, e, a, b, c, W(27)); /* 28 */ + GG(c, d, e, a, b, W(28)); /* 29 */ + GG(b, c, d, e, a, W(29)); /* 30 */ + GG(a, b, c, d, e, W(30)); /* 31 */ + GG(e, a, b, c, d, W(31)); /* 32 */ + GG(d, e, a, b, c, W(32)); /* 33 */ + GG(c, d, e, a, b, W(33)); /* 34 */ + GG(b, c, d, e, a, W(34)); /* 35 */ + GG(a, b, c, d, e, W(35)); /* 36 */ + GG(e, a, b, c, d, W(36)); /* 37 */ + GG(d, e, a, b, c, W(37)); /* 38 */ + GG(c, d, e, a, b, W(38)); /* 39 */ + GG(b, c, d, e, a, W(39)); /* 40 */ + + /* Round 3 */ + HH(a, b, c, d, e, W(40)); /* 41 */ + HH(e, a, b, c, d, W(41)); /* 42 */ + HH(d, e, a, b, c, W(42)); /* 43 */ + HH(c, d, e, a, b, W(43)); /* 44 */ + HH(b, c, d, e, a, W(44)); /* 45 */ + HH(a, b, c, d, e, W(45)); /* 46 */ + HH(e, a, b, c, d, W(46)); /* 47 */ + HH(d, e, a, b, c, W(47)); /* 48 */ + HH(c, d, e, a, b, W(48)); /* 49 */ + HH(b, c, d, e, a, W(49)); /* 50 */ + HH(a, b, c, d, e, W(50)); /* 51 */ + HH(e, a, b, c, d, W(51)); /* 52 */ + HH(d, e, a, b, c, W(52)); /* 53 */ + HH(c, d, e, a, b, W(53)); /* 54 */ + HH(b, c, d, e, a, W(54)); /* 55 */ + HH(a, b, c, d, e, W(55)); /* 56 */ + HH(e, a, b, c, d, W(56)); /* 57 */ + HH(d, e, a, b, c, W(57)); /* 58 */ + HH(c, d, e, a, b, W(58)); /* 59 */ + HH(b, c, d, e, a, W(59)); /* 60 */ + + /* Round 4 */ + II(a, b, c, d, e, W(60)); /* 61 */ + II(e, a, b, c, d, W(61)); /* 62 */ + II(d, e, a, b, c, W(62)); /* 63 */ + II(c, d, e, a, b, W(63)); /* 64 */ + II(b, c, d, e, a, W(64)); /* 65 */ + II(a, b, c, d, e, W(65)); /* 66 */ + II(e, a, b, c, d, W(66)); /* 67 */ + II(d, e, a, b, c, W(67)); /* 68 */ + II(c, d, e, a, b, W(68)); /* 69 */ + II(b, c, d, e, a, W(69)); /* 70 */ + II(a, b, c, d, e, W(70)); /* 71 */ + II(e, a, b, c, d, W(71)); /* 72 */ + II(d, e, a, b, c, W(72)); /* 73 */ + II(c, d, e, a, b, W(73)); /* 74 */ + II(b, c, d, e, a, W(74)); /* 75 */ + II(a, b, c, d, e, W(75)); /* 76 */ + II(e, a, b, c, d, W(76)); /* 77 */ + II(d, e, a, b, c, W(77)); /* 78 */ + II(c, d, e, a, b, W(78)); /* 79 */ + II(b, c, d, e, a, W(79)); /* 80 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + + /* Zeroize sensitive information. */ + memset((unsigned char*) x, 0, sizeof(x)); +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_sha1(const char *arg, int arg_len, bool raw, int &out_len) { + PHP_SHA1_CTX context; + unsigned char digest[20]; + + PHP_SHA1Init(&context); + PHP_SHA1Update(&context, (const unsigned char *)arg, arg_len); + PHP_SHA1Final(digest, &context); + if (raw) { + out_len = 20; + return string_duplicate((const char *)digest, 20); + } + + out_len = 20; + return string_bin2hex((const char*)digest, out_len); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_string.cpp b/src/cpp/base/zend/zend_string.cpp new file mode 100644 index 0000000000000..7db77b3a22d40 --- /dev/null +++ b/src/cpp/base/zend/zend_string.cpp @@ -0,0 +1,3492 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#define PHP_QPRINT_MAXL 75 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helpers + +/** + * Calculates and adjusts "start" and "length" according to string's length. + * This function determines how those two parameters are interpreted in varies + * substr-related functions. + */ +bool string_substr_check(int len, int &f, int &l) { + // if "from" position is negative, count start position from the end + if (f < 0) { + f += len; + if (f < 0) { + return false; + } + } + if (f >= len) { + return false; + } + + // 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 += len - f; + if (l < 0) { + return false; + } + } + if ((unsigned int)f + (unsigned int)l > (unsigned int)len) { + l = len - f; + } + return true; +} + +/** + * Fills a 256-byte bytemask with input. You can specify a range like 'a..z', + * it needs to be incrementing. This function determines how "charlist" + * parameters are interpreted in varies functions that take a list of + * characters. + */ +void string_charmask(const char *sinput, int len, char *mask) { + const unsigned char *input = (unsigned char *)sinput; + const unsigned char *end; + unsigned char c; + + memset(mask, 0, 256); + for (end = input+len; input < end; input++) { + c=*input; + if ((input+3 < end) && input[1] == '.' && input[2] == '.' + && input[3] >= c) { + memset(mask+c, 1, input[3] - c + 1); + input+=3; + } else if ((input+1 < end) && input[0] == '.' && input[1] == '.') { + /* Error, try to be as helpful as possible: + (a range ending/starting with '.' won't be captured here) */ + if (end-len >= input) { /* there was no 'left' char */ + throw InvalidArgumentException + ("charlist", "Invalid '..'-range, missing left of '..'"); + } + if (input+2 >= end) { /* there is no 'right' char */ + throw InvalidArgumentException + ("charlist", "Invalid '..'-range, missing right of '..'"); + } + if (input[-1] > input[2]) { /* wrong order */ + throw InvalidArgumentException + ("charlist", "'..'-range needs to be incrementing"); + } + /* FIXME: better error (a..b..c is the only left possibility?) */ + throw InvalidArgumentException("charlist", "Invalid '..'-range"); + } else { + mask[c]=1; + } + } +} + +int string_copy(char *dst, const char *src, int siz) { + register char *d = dst; + register const char *s = src; + register size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) { + do { + if ((*d++ = *s++) == 0) + break; + } while (--n != 0); + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + + return(s - src - 1); /* count does not include NUL */ +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_concat(const char *s1, int len1, const char *s2, int len2, + int &len) { + len = len1 + len2; + char *buf = (char *)malloc(len + 1); + memcpy(buf, s1, len1); + memcpy(buf + len1, s2, len2); + buf[len] = 0; + return buf; +} + +/////////////////////////////////////////////////////////////////////////////// +// comparisons + +int string_cmp(const char *s1, int len1, const char *s2, int len2) { + if (len1 <= len2) { + for (int i = 0; i < len1; i++) { + char c1 = s1[i]; + char c2 = s2[i]; + if (c1 > c2) return 1; + if (c1 < c2) return -1; + } + return len1 < len2 ? -1 : 0; + } + + for (int i = 0; i < len2; i++) { + char c1 = s1[i]; + char c2 = s2[i]; + if (c1 > c2) return 1; + if (c1 < c2) return -1; + } + return 1; +} + +int string_casecmp(const char *s1, int len1, const char *s2, int len2) { + if (len1 <= len2) { + for (int i = 0; i < len1; i++) { + char c1 = toupper(s1[i]); + char c2 = toupper(s2[i]); + if (c1 > c2) return 1; + if (c1 < c2) return -1; + } + return len1 < len2 ? -1 : 0; + } + + for (int i = 0; i < len2; i++) { + char c1 = toupper(s1[i]); + char c2 = toupper(s2[i]); + if (c1 > c2) return 1; + if (c1 < c2) return -1; + } + return 1; +} + +int string_ncmp(const char *s1, const char *s2, int len) { + for (int i = 0; i < len; i++) { + char c1 = s1[i]; + char c2 = s2[i]; + if (c1 > c2) return 1; + if (c1 < c2) return -1; + } + return 0; +} + +int string_ncasecmp(const char *s1, const char *s2, int len) { + for (int i = 0; i < len; i++) { + char c1 = toupper(s1[i]); + char c2 = toupper(s2[i]); + if (c1 > c2) return 1; + if (c1 < c2) return -1; + } + return 0; +} + +static int compare_right(char const **a, char const *aend, + char const **b, char const *bend) { + int bias = 0; + + /* The longest run of digits wins. That aside, the greatest + value wins, but we can't know that it will until we've scanned + both numbers to know that they have the same magnitude, so we + remember it in BIAS. */ + for(;; (*a)++, (*b)++) { + if ((*a == aend || !isdigit((int)(unsigned char)**a)) && + (*b == bend || !isdigit((int)(unsigned char)**b))) + return bias; + else if (*a == aend || !isdigit((int)(unsigned char)**a)) + return -1; + else if (*b == bend || !isdigit((int)(unsigned char)**b)) + return +1; + else if (**a < **b) { + if (!bias) + bias = -1; + } else if (**a > **b) { + if (!bias) + bias = +1; + } + } + + return 0; +} + +static int compare_left(char const **a, char const *aend, + char const **b, char const *bend) { + /* Compare two left-aligned numbers: the first to have a + different value wins. */ + for(;; (*a)++, (*b)++) { + if ((*a == aend || !isdigit((int)(unsigned char)**a)) && + (*b == bend || !isdigit((int)(unsigned char)**b))) + return 0; + else if (*a == aend || !isdigit((int)(unsigned char)**a)) + return -1; + else if (*b == bend || !isdigit((int)(unsigned char)**b)) + return +1; + else if (**a < **b) + return -1; + else if (**a > **b) + return +1; + } + + return 0; +} + +int string_natural_cmp(char const *a, size_t a_len, + char const *b, size_t b_len, int fold_case) { + char ca, cb; + char const *ap, *bp; + char const *aend = a + a_len, *bend = b + b_len; + int fractional, result; + + if (a_len == 0 || b_len == 0) + return a_len - b_len; + + ap = a; + bp = b; + while (1) { + ca = *ap; cb = *bp; + + /* skip over leading spaces or zeros */ + while (isspace((int)(unsigned char)ca)) + ca = *++ap; + + while (isspace((int)(unsigned char)cb)) + cb = *++bp; + + /* process run of digits */ + if (isdigit((int)(unsigned char)ca) && isdigit((int)(unsigned char)cb)) { + fractional = (ca == '0' || cb == '0'); + + if (fractional) + result = compare_left(&ap, aend, &bp, bend); + else + result = compare_right(&ap, aend, &bp, bend); + + if (result != 0) + return result; + else if (ap == aend && bp == bend) + /* End of the strings. Let caller sort them out. */ + return 0; + else { + /* Keep on comparing from the current point. */ + ca = *ap; cb = *bp; + } + } + + if (fold_case) { + ca = toupper((int)(unsigned char)ca); + cb = toupper((int)(unsigned char)cb); + } + + if (ca < cb) + return -1; + else if (ca > cb) + return +1; + + ++ap; ++bp; + if (ap >= aend && bp >= bend) + /* The strings compare the same. Perhaps the caller + will want to call strcmp to break the tie. */ + return 0; + else if (ap >= aend) + return -1; + else if (bp >= bend) + return 1; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_to_lower(const char *s, int len) { + ASSERT(s); + char *ret = (char *)malloc(len + 1); + for (int i = 0; i < len; i++) { + ret[i] = tolower(s[i]); + } + ret[len] = '\0'; + return ret; +} + +char *string_to_upper(const char *s, int len) { + ASSERT(s); + char *ret = (char *)malloc(len + 1); + for (int i = 0; i < len; i++) { + ret[i] = toupper(s[i]); + } + ret[len] = '\0'; + return ret; +} + +char *string_to_upper_first(const char *s, int len) { + ASSERT(s); + char *ret = string_duplicate(s, len); + if (*ret) { + *ret = toupper(*ret); + } + return ret; +} + +char *string_to_upper_words(const char *s, int len) { + ASSERT(s); + char *ret = string_duplicate(s, len); + if (*ret) { + *ret = toupper(*ret); + for (int i = 1; i < len; i++) { + if (isspace(ret[i-1])) { + ret[i] = toupper(ret[i]); + } + } + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_trim(const char *s, int &len, + const char *charlist, int charlistlen, int mode) { + ASSERT(s); + char mask[256]; + string_charmask(charlist, charlistlen, mask); + + int trimmed = 0; + if (mode & 1) { + for (int i = 0; i < len; i++) { + if (mask[(unsigned char)s[i]]) { + trimmed++; + } else { + break; + } + } + len -= trimmed; + s += trimmed; + } + if (mode & 2) { + for (int i = len - 1; i >= 0; i--) { + if (mask[(unsigned char)s[i]]) { + len--; + } else { + break; + } + } + } + return string_duplicate(s, len); +} + +#define STR_PAD_LEFT 0 +#define STR_PAD_RIGHT 1 +#define STR_PAD_BOTH 2 + +char *string_pad(const char *input, int &len, int pad_length, + const char *pad_string, int pad_str_len, + int pad_type) { + ASSERT(input); + int num_pad_chars = pad_length - len; + + /* If resulting string turns out to be shorter than input string, + we simply copy the input and return. */ + if (pad_length < 0 || num_pad_chars < 0) { + return string_duplicate(input, len); + } + + /* Setup the padding string values if specified. */ + if (pad_str_len == 0) { + throw InvalidArgumentException("pad_string", "(empty)"); + } + + char *result = (char *)malloc(pad_length + 1); + + /* We need to figure out the left/right padding lengths. */ + int left_pad, right_pad; + switch (pad_type) { + case STR_PAD_RIGHT: + left_pad = 0; + right_pad = num_pad_chars; + break; + case STR_PAD_LEFT: + left_pad = num_pad_chars; + right_pad = 0; + break; + case STR_PAD_BOTH: + left_pad = num_pad_chars / 2; + right_pad = num_pad_chars - left_pad; + break; + default: + throw InvalidArgumentException("pad_type", pad_type); + } + + /* First we pad on the left. */ + int result_len = 0; + for (int i = 0; i < left_pad; i++) { + result[result_len++] = pad_string[i % pad_str_len]; + } + + /* Then we copy the input string. */ + memcpy(result + result_len, input, len); + result_len += len; + + /* Finally, we pad on the right. */ + for (int i = 0; i < right_pad; i++) { + result[result_len++] = pad_string[i % pad_str_len]; + } + result[result_len] = '\0'; + + len = result_len; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_substr(const char *s, int &len, int start, int length) { + ASSERT(s); + if (!string_substr_check(len, start, length)) { + len = 0; + return string_duplicate("", 0); + } else { + len = length; + return string_duplicate(s + start, length); + } +} + +int string_find(const char *input, int len, char ch, int pos, + bool case_sensitive) { + ASSERT(input); + if (len && pos < len) { + if (!case_sensitive) { + ch = tolower(ch); + char *lowered = string_to_lower(input, len); + int ret = string_find(lowered, len, ch, pos, true); + free(lowered); + return ret; + } + + int l = 1; + if (!string_substr_check(len, pos, l)) { + return -1; + } + for (int i = pos; i < len; i++) { + if (input[i] == ch) { + return i; + } + } + } + return -1; +} + +int string_rfind(const char *input, int len, char ch, int pos, + bool case_sensitive) { + ASSERT(input); + + if (pos < 0) pos = len - 1; + if (len > 0 && pos < len) { + if (!case_sensitive) { + ch = tolower(ch); + char *lowered = string_to_lower(input, len); + int ret = string_rfind(lowered, len, ch, pos, true); + free(lowered); + return ret; + } + + int l = 1; + if (!string_substr_check(len, pos, l)) { + return -1; + } + for (int i = pos; i >= 0; i--) { + if (input[i] == ch) { + return i; + } + } + } + return -1; +} + +int string_find(const char *input, int len, const char *s, int s_len, + int pos, bool case_sensitive) { + ASSERT(input); + ASSERT(s); + if (!s_len) { + return -1; + } + if (len && pos < len) { + if (!case_sensitive) { + char *lowered_s = string_to_lower(s, s_len); + char *lowered = string_to_lower(input, len); + int ret = string_find(lowered, len, lowered_s, s_len, pos, true); + free(lowered); + free(lowered_s); + return ret; + } + + int l = 1; + if (!string_substr_check(len, pos, l)) { + return -1; + } + int i_max = len - s_len + 1; + for (int i = pos; i < i_max; i++) { + if (input[i] == s[0] && memcmp(input+i, s, s_len) == 0) { + return i; + } + } + } + return -1; +} + +int string_rfind(const char *input, int len, const char *s, int s_len, + int pos, bool case_sensitive) { + ASSERT(input); + ASSERT(s); + if (!s_len) { + return -1; + } + + if (pos < 0) pos = len; + if (len && pos < len) { + if (!case_sensitive) { + char *lowered_s = string_to_lower(s, s_len); + char *lowered = string_to_lower(input, len); + int ret = string_find(lowered, len, lowered_s, s_len, pos, true); + free(lowered); + free(lowered_s); + return ret; + } + + int l = 1; + if (!string_substr_check(len, pos, l)) { + return -1; + } + int i_max = len - s_len; + for (int i = (pos > i_max ? i_max : pos) ; i >= 0; i--) { + if (input[i] == s[0] && memcmp(input+i, s, s_len) == 0) { + return i; + } + } + } + return -1; +} + +const char *string_memnstr(const char *haystack, const char *needle, + int needle_len, const char *end) { + const char *p = haystack; + char ne = needle[needle_len-1]; + + end -= needle_len; + while (p <= end) { + if ((p = (char *)memchr(p, *needle, (end-p+1))) && ne == p[needle_len-1]) { + if (!memcmp(needle, p, needle_len-1)) { + return p; + } + } + if (p == NULL) { + return NULL; + } + p++; + } + return NULL; +} + +void *string_memrchr(const void *s, int c, size_t n) { + register unsigned char *e; + + if (n <= 0) { + return NULL; + } + for (e = (unsigned char *)s + n - 1; e >= (unsigned char *)s; e--) { + if (*e == (unsigned char)c) { + return (void *)e; + } + } + return NULL; +} + +char *string_replace(const char *s, int &len, int start, int length, + const char *replacement, int len_repl) { + ASSERT(s); + ASSERT(replacement); + if (!string_substr_check(len, start, length)) { + len = 0; + return string_duplicate("", 0); + } + + char *ret = (char *)malloc(len + len_repl - length + 1); + + int ret_len = 0; + if (start) { + memcpy(ret, s, start); + ret_len += start; + } + if (len_repl) { + memcpy(ret + ret_len, replacement, len_repl); + ret_len += len_repl; + } + len -= (start + length); + if (len) { + memcpy(ret + ret_len, s + start + length, len); + ret_len += len; + } + + len = ret_len; + ret[ret_len] = '\0'; + return ret; +} + +char *string_replace(const char *input, int &len, + const char *search, int len_search, + const char *replacement, int len_replace, + int &count, bool case_sensitive) { + ASSERT(input); + ASSERT(search && len_search); + + if (len == 0) { + return NULL; + } + + std::vector founds; + founds.reserve(16); + if (len_search == 1) { + for (int pos = string_find(input, len, *search, 0, case_sensitive); + pos >= 0; + pos = string_find(input, len, *search, pos + len_search, + case_sensitive)) { + founds.push_back(pos); + } + } else { + for (int pos = string_find(input, len, search, len_search, 0, + case_sensitive); + pos >= 0; + pos = string_find(input, len, search, len_search, + pos + len_search, case_sensitive)) { + founds.push_back(pos); + } + } + + count = founds.size(); + if (count == 0) { + return NULL; // not found + } + + char *ret = (char *)malloc(len + (len_replace - len_search) * count + 1); + char *p = ret; + int pos = 0; // last position in input that hasn't been copied over yet + int n; + for (unsigned int i = 0; i < founds.size(); i++) { + n = founds[i]; + if (n > pos) { + n -= pos; + memcpy(p, input, n); + p += n; + input += n; + pos += n; + } + if (len_replace) { + memcpy(p, replacement, len_replace); + p += len_replace; + } + input += len_search; + pos += len_search; + } + n = len; + if (n > pos) { + n -= pos; + memcpy(p, input, n); + p += n; + } + *p = '\0'; + + len = p - ret; + return ret; +} + +int string_span(const char *s1, int s1_len, const char *s2, int s2_len) { + const char *s1_end = s1 + s1_len; + const char *s2_end = s2 + s2_len; + register const char *p = s1, *spanp; + register char c = *p; + + cont: + for (spanp = s2; p != s1_end && spanp != s2_end;) { + if (*spanp++ == c) { + c = *(++p); + goto cont; + } + } + return (p - s1); +} + +int string_cspan(const char *s1, int s1_len, const char *s2, int s2_len) { + const char *s1_end = s1 + s1_len; + const char *s2_end = s2 + s2_len; + register const char *p, *spanp; + register char c = *s1; + + for (p = s1;;) { + spanp = s2; + do { + if (*spanp == c || p == s1_end) { + return p - s1; + } + } while (spanp++ < (s2_end - 1)); + c = *++p; + } + ASSERT(false); + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_reverse(const char *s, int len) { + ASSERT(s); + char *n = (char *)malloc(len + 1); + char *p = n; + const char *e = s + len; + + while (--e >= s) { + *p++ = *e; + } + + *p = '\0'; + return n; +} + +char *string_repeat(const char *s, int &len, int count) { + ASSERT(s); + + if (len == 0 || count <= 0) { + return NULL; + } + + char *ret = (char *)malloc(len * count + 1); + if (len == 1) { + memset(ret, *s, count); + len = count; + } else { + char *p = ret; + for (int i = 0; i < count; i++) { + memcpy(p, s, len); + p += len; + } + len = p - ret; + } + ret[len] = '\0'; + return ret; +} + +char *string_shuffle(const char *str, int len) { + ASSERT(str); + if (len <= 1) { + return NULL; + } + + char *ret = string_duplicate(str, len); + int n_left = len; + while (--n_left) { + int rnd_idx = rand() % n_left; + char temp = ret[n_left]; + ret[n_left] = ret[rnd_idx]; + ret[rnd_idx] = temp; + } + return ret; +} + +char *string_chunk_split(const char *src, int &srclen, const char *end, + int endlen, int chunklen) { + int chunks = srclen / chunklen; // complete chunks! + int restlen = srclen - chunks * chunklen; /* srclen % chunklen */ + + int out_len = (chunks + 1) * endlen + srclen + 1; + char *dest = (char *)malloc(out_len); + + const char *p; char *q; + const char *pMax = src + srclen - chunklen + 1; + for (p = src, q = dest; p < pMax; ) { + memcpy(q, p, chunklen); + q += chunklen; + memcpy(q, end, endlen); + q += endlen; + p += chunklen; + } + + if (restlen) { + memcpy(q, p, restlen); + q += restlen; + memcpy(q, end, endlen); + q += endlen; + } + + *q = '\0'; + srclen = q - dest; + return(dest); +} + +/////////////////////////////////////////////////////////////////////////////// + +#define PHP_TAG_BUF_SIZE 1023 + +/** + * Check if tag is in a set of tags + * + * states: + * + * 0 start tag + * 1 first non-whitespace char seen + */ +static int string_tag_find(const char *tag, int len, char *set) { + char c, *n; + const char *t; + int state=0, done=0; + char *norm; + + if (len <= 0) { + return 0; + } + + norm = (char *)malloc(len+1); + + n = norm; + t = tag; + c = tolower(*t); + /* + normalize the tag removing leading and trailing whitespace + and turn any into just and any
    + into + */ + while (!done) { + switch (c) { + case '<': + *(n++) = c; + break; + case '>': + done =1; + break; + default: + if (!isspace((int)c)) { + if (state == 0) { + state=1; + if (c != '/') + *(n++) = c; + } else { + *(n++) = c; + } + } else { + if (state == 1) + done=1; + } + break; + } + c = tolower(*(++t)); + } + *(n++) = '>'; + *n = '\0'; + if (strstr(set, norm)) { + done=1; + } else { + done=0; + } + free(norm); + return done; +} + +/** + * A simple little state-machine to strip out html and php tags + * + * State 0 is the output state, State 1 means we are inside a + * normal html tag and state 2 means we are inside a php tag. + * + * The state variable is passed in to allow a function like fgetss + * to maintain state across calls to the function. + * + * lc holds the last significant character read and br is a bracket + * counter. + * + * When an allow string is passed in we keep track of the string + * in state 1 and when the tag is closed check it against the + * allow string to see if we should allow it. + + * swm: Added ability to strip = PHP_TAG_BUF_SIZE ? tbuf: tp); + *(tp++) = '<'; + } + } else if (state == 1) { + depth++; + } + break; + + case '(': + if (state == 2) { + if (lc != '"' && lc != '\'') { + lc = '('; + br++; + } + } else if (allow && state == 1) { + tp = ((tp-tbuf) >= PHP_TAG_BUF_SIZE ? tbuf: tp); + *(tp++) = c; + } else if (state == 0) { + *(rp++) = c; + } + break; + + case ')': + if (state == 2) { + if (lc != '"' && lc != '\'') { + lc = ')'; + br--; + } + } else if (allow && state == 1) { + tp = ((tp-tbuf) >= PHP_TAG_BUF_SIZE ? tbuf: tp); + *(tp++) = c; + } else if (state == 0) { + *(rp++) = c; + } + break; + + case '>': + if (depth) { + depth--; + break; + } + + if (in_q) { + break; + } + + switch (state) { + case 1: /* HTML/XML */ + lc = '>'; + in_q = state = 0; + if (allow) { + tp = ((tp-tbuf) >= PHP_TAG_BUF_SIZE ? tbuf: tp); + *(tp++) = '>'; + *tp='\0'; + if (string_tag_find(tbuf, tp-tbuf, allow)) { + memcpy(rp, tbuf, tp-tbuf); + rp += tp-tbuf; + } + tp = tbuf; + } + break; + + case 2: /* PHP */ + if (!br && lc != '\"' && *(p-1) == '?') { + in_q = state = 0; + tp = tbuf; + } + break; + + case 3: + in_q = state = 0; + tp = tbuf; + break; + + case 4: /* JavaScript/CSS/etc... */ + if (p >= buf + 2 && *(p-1) == '-' && *(p-2) == '-') { + in_q = state = 0; + tp = tbuf; + } + break; + + default: + *(rp++) = c; + break; + } + break; + + case '"': + case '\'': + if (state == 2 && *(p-1) != '\\') { + if (lc == c) { + lc = '\0'; + } else if (lc != '\\') { + lc = c; + } + } else if (state == 0) { + *(rp++) = c; + } else if (allow && state == 1) { + tp = ((tp-tbuf) >= PHP_TAG_BUF_SIZE ? tbuf: tp); + *(tp++) = c; + } + if (state && p != buf && *(p-1) != '\\' && (!in_q || *p == in_q)) { + if (in_q) { + in_q = 0; + } else { + in_q = *p; + } + } + break; + + case '!': + /* JavaScript & Other HTML scripting languages */ + if (state == 1 && *(p-1) == '<') { + state = 3; + lc = c; + } else { + if (state == 0) { + *(rp++) = c; + } else if (allow && state == 1) { + tp = ((tp-tbuf) >= PHP_TAG_BUF_SIZE ? tbuf: tp); + *(tp++) = c; + } + } + break; + + case '-': + if (state == 3 && p >= buf + 2 && *(p-1) == '-' && *(p-2) == '!') { + state = 4; + } else { + goto reg_char; + } + break; + + case '?': + + if (state == 1 && *(p-1) == '<') { + br=0; + state=2; + break; + } + + case 'E': + case 'e': + /* !DOCTYPE exception */ + if (state==3 && p > buf+6 + && tolower(*(p-1)) == 'p' + && tolower(*(p-2)) == 'y' + && tolower(*(p-3)) == 't' + && tolower(*(p-4)) == 'c' + && tolower(*(p-5)) == 'o' + && tolower(*(p-6)) == 'd') { + state = 1; + break; + } + /* fall-through */ + + case 'l': + + /* swm: If we encounter ' buf+2 && *(p-1) == 'm' && *(p-2) == 'x') { + state = 1; + break; + } + + /* fall-through */ + default: + reg_char: + if (state == 0) { + *(rp++) = c; + } else if (allow && state == 1) { + tp = ((tp-tbuf) >= PHP_TAG_BUF_SIZE ? tbuf: tp); + *(tp++) = c; + } + break; + } + c = *(++p); + i++; + } + if (rp < rbuf + len) { + *rp = '\0'; + } + free(buf); + if (allow) + free(tbuf); + if (stateptr) + *stateptr = state; + + return (size_t)(rp - rbuf); +} + +char *string_strip_tags(const char *s, int &len, const char *allow, + int allow_len) { + ASSERT(s); + ASSERT(allow); + + char *ret = string_duplicate(s, len); + char *sallow = string_duplicate(allow, allow_len); + len = strip_tags_impl(ret, len, NULL, sallow, allow_len, false); + free(sallow); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_wordwrap(const char *text, int &textlen, int linelength, + const char *breakchar, int breakcharlen, bool docut) { + ASSERT(text); + ASSERT(breakchar); + + char *newtext; + int newtextlen, chk; + size_t alloced; + long current = 0, laststart = 0, lastspace = 0; + + if (textlen == 0) { + return NULL; + } + + if (breakcharlen == 0) { + throw InvalidArgumentException("wordbreak", "(empty)"); + } + + if (linelength == 0 && docut) { + throw InvalidArgumentException("width", "can't force cut when width = 0"); + } + + /* Special case for a single-character break as it needs no + additional storage space */ + if (breakcharlen == 1 && !docut) { + newtext = string_duplicate(text, textlen); + + laststart = lastspace = 0; + for (current = 0; current < textlen; current++) { + if (text[current] == breakchar[0]) { + laststart = lastspace = current; + } else if (text[current] == ' ') { + if (current - laststart >= linelength) { + newtext[current] = breakchar[0]; + laststart = current + 1; + } + lastspace = current; + } else if (current - laststart >= linelength && laststart != lastspace) { + newtext[lastspace] = breakchar[0]; + laststart = lastspace + 1; + } + } + + return newtext; + } + + /* Multiple character line break or forced cut */ + if (linelength > 0) { + chk = (int)(textlen/linelength + 1); + alloced = textlen + chk * breakcharlen + 1; + } else { + chk = textlen; + alloced = textlen * (breakcharlen + 1) + 1; + } + newtext = (char *)malloc(alloced); + + /* now keep track of the actual new text length */ + newtextlen = 0; + + laststart = lastspace = 0; + for (current = 0; current < textlen; current++) { + if (chk <= 0) { + alloced += (int) (((textlen - current + 1)/linelength + 1) * + breakcharlen) + 1; + newtext = (char *)realloc(newtext, alloced); + chk = (int) ((textlen - current)/linelength) + 1; + } + /* when we hit an existing break, copy to new buffer, and + * fix up laststart and lastspace */ + if (text[current] == breakchar[0] + && current + breakcharlen < textlen + && !strncmp(text+current, breakchar, breakcharlen)) { + memcpy(newtext+newtextlen, text+laststart, + current-laststart+breakcharlen); + newtextlen += current-laststart+breakcharlen; + current += breakcharlen - 1; + laststart = lastspace = current + 1; + chk--; + } + /* if it is a space, check if it is at the line boundary, + * copy and insert a break, or just keep track of it */ + else if (text[current] == ' ') { + if (current - laststart >= linelength) { + memcpy(newtext+newtextlen, text+laststart, current-laststart); + newtextlen += current - laststart; + memcpy(newtext+newtextlen, breakchar, breakcharlen); + newtextlen += breakcharlen; + laststart = current + 1; + chk--; + } + lastspace = current; + } + /* if we are cutting, and we've accumulated enough + * characters, and we haven't see a space for this line, + * copy and insert a break. */ + else if (current - laststart >= linelength + && docut && laststart >= lastspace) { + memcpy(newtext+newtextlen, text+laststart, current-laststart); + newtextlen += current - laststart; + memcpy(newtext+newtextlen, breakchar, breakcharlen); + newtextlen += breakcharlen; + laststart = lastspace = current; + chk--; + } + /* if the current word puts us over the linelength, copy + * back up until the last space, insert a break, and move + * up the laststart */ + else if (current - laststart >= linelength + && laststart < lastspace) { + memcpy(newtext+newtextlen, text+laststart, lastspace-laststart); + newtextlen += lastspace - laststart; + memcpy(newtext+newtextlen, breakchar, breakcharlen); + newtextlen += breakcharlen; + laststart = lastspace = lastspace + 1; + chk--; + } + } + + /* copy over any stragglers */ + if (laststart != current) { + memcpy(newtext+newtextlen, text+laststart, current-laststart); + newtextlen += current - laststart; + } + + textlen = newtextlen; + newtext[newtextlen] = '\0'; + return newtext; +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_addcslashes(const char *str, int &length, const char *what, + int wlength) { + ASSERT(str); + ASSERT(what); + + char flags[256]; + string_charmask(what, wlength, flags); + + char *new_str = (char *)malloc((length << 2) + 1); + const char *source; + const char *end; + char *target; + for (source = str, end = source + length, target = new_str; source < end; + source++) { + char c = *source; + if (flags[(unsigned char)c]) { + if ((unsigned char) c < 32 || (unsigned char) c > 126) { + *target++ = '\\'; + switch (c) { + case '\n': *target++ = 'n'; break; + case '\t': *target++ = 't'; break; + case '\r': *target++ = 'r'; break; + case '\a': *target++ = 'a'; break; + case '\v': *target++ = 'v'; break; + case '\b': *target++ = 'b'; break; + case '\f': *target++ = 'f'; break; + default: target += sprintf(target, "%03o", (unsigned char) c); + } + continue; + } + *target++ = '\\'; + } + *target++ = c; + } + *target = 0; + length = target - new_str; + return new_str; +} + +char *string_stripcslashes(const char *input, int &nlen) { + ASSERT(input); + if (nlen == 0) { + return NULL; + } + + char *str = string_duplicate(input, nlen); + + char *source, *target, *end; + int i; + char numtmp[4]; + + for (source=str, end=str+nlen, target=str; source < end; source++) { + if (*source == '\\' && source+1 < end) { + source++; + switch (*source) { + case 'n': *target++='\n'; nlen--; break; + case 'r': *target++='\r'; nlen--; break; + case 'a': *target++='\a'; nlen--; break; + case 't': *target++='\t'; nlen--; break; + case 'v': *target++='\v'; nlen--; break; + case 'b': *target++='\b'; nlen--; break; + case 'f': *target++='\f'; nlen--; break; + case '\\': *target++='\\'; nlen--; break; + case 'x': + if (source+1 < end && isxdigit((int)(*(source+1)))) { + numtmp[0] = *++source; + if (source+1 < end && isxdigit((int)(*(source+1)))) { + numtmp[1] = *++source; + numtmp[2] = '\0'; + nlen-=3; + } else { + numtmp[1] = '\0'; + nlen-=2; + } + *target++=(char)strtol(numtmp, NULL, 16); + break; + } + /* break is left intentionally */ + default: + i=0; + while (source < end && *source >= '0' && *source <= '7' && i<3) { + numtmp[i++] = *source++; + } + if (i) { + numtmp[i]='\0'; + *target++=(char)strtol(numtmp, NULL, 8); + nlen-=i; + source--; + } else { + *target++=*source; + nlen--; + } + } + } else { + *target++=*source; + } + } + *target='\0'; + nlen = target - str; + return str; +} + +char *string_addslashes(const char *str, int &length) { + ASSERT(str); + if (length == 0) { + return NULL; + } + + char *new_str = (char *)malloc((length << 1) + 1); + const char *source = str; + const char *end = source + length; + char *target = new_str; + + while (source < end) { + switch (*source) { + case '\0': + *target++ = '\\'; + *target++ = '0'; + break; + case '\'': + case '\"': + case '\\': + *target++ = '\\'; + /* break is missing *intentionally* */ + default: + *target++ = *source; + break; + } + + source++; + } + + *target = 0; + length = target - new_str; + return new_str; +} + +char *string_stripslashes(const char *input, int &l) { + ASSERT(input); + if (!*input) { + return NULL; + } + + char *str = string_duplicate(input, l); + char *s, *t; + s = str; + t = str; + + while (l > 0) { + if (*t == '\\') { + t++; /* skip the slash */ + l--; + if (l > 0) { + if (*t == '0') { + *s++='\0'; + t++; + } else { + *s++ = *t++; /* preserve the next character */ + } + l--; + } + } else { + *s++ = *t++; + l--; + } + } + if (s != t) { + *s = '\0'; + } + l = s - str; + return str; +} + +char *string_quotemeta(const char *input, int &len) { + ASSERT(input); + if (len == 0) { + return NULL; + } + + char *ret = (char *)malloc((len << 1) + 1); + char *q = ret; + for (const char *p = input; *p; p++) { + char c = *p; + switch (c) { + case '.': + case '\\': + case '+': + case '*': + case '?': + case '[': + case '^': + case ']': + case '$': + case '(': + case ')': + *q++ = '\\'; + /* break is missing _intentionally_ */ + default: + *q++ = c; + } + } + *q = 0; + len = q - ret; + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +static char string_hex2int(int c) { + if (isdigit(c)) { + return c - '0'; + } + if (c >= 'A' && c <= 'F') { + return c - 'A' + 10; + } + if (c >= 'a' && c <= 'f') { + return c - 'a' + 10; + } + return -1; +} + +char *string_quoted_printable_encode(const char *input, int &len) { + const char *hex = "0123456789ABCDEF"; + + unsigned char *ret = + (unsigned char *)malloc(3 * len + 3 * (((3 * len)/PHP_QPRINT_MAXL) + 1)); + unsigned char *d = ret; + + int length = len; + unsigned char c; + unsigned long lp = 0; + while (length--) { + if (((c = *input++) == '\015') && (*input == '\012') && length > 0) { + *d++ = '\015'; + *d++ = *input++; + length--; + lp = 0; + } else { + if (iscntrl (c) || (c == 0x7f) || (c & 0x80) || (c == '=') || + ((c == ' ') && (*input == '\015'))) { + if ((lp += 3) > PHP_QPRINT_MAXL) { + *d++ = '='; + *d++ = '\015'; + *d++ = '\012'; + lp = 3; + } + *d++ = '='; + *d++ = hex[c >> 4]; + *d++ = hex[c & 0xf]; + } else { + if ((++lp) > PHP_QPRINT_MAXL) { + *d++ = '='; + *d++ = '\015'; + *d++ = '\012'; + lp = 1; + } + *d++ = c; + } + } + } + *d = '\0'; + len = d - ret; + return (char*)ret; +} + +char *string_quoted_printable_decode(const char *input, int &len) { + ASSERT(input); + if (len == 0) { + return NULL; + } + + int i = 0, j = 0, k; + const char *str_in = input; + char *str_out = (char *)malloc(len + 1); + while (str_in[i]) { + switch (str_in[i]) { + case '=': + if (str_in[i + 1] && str_in[i + 2] && + isxdigit((int) str_in[i + 1]) && + isxdigit((int) str_in[i + 2])) + { + str_out[j++] = (string_hex2int((int) str_in[i + 1]) << 4) + + string_hex2int((int) str_in[i + 2]); + i += 3; + } else /* check for soft line break according to RFC 2045*/ { + k = 1; + while (str_in[i + k] && + ((str_in[i + k] == 32) || (str_in[i + k] == 9))) { + /* Possibly, skip spaces/tabs at the end of line */ + k++; + } + if (!str_in[i + k]) { + /* End of line reached */ + i += k; + } + else if ((str_in[i + k] == 13) && (str_in[i + k + 1] == 10)) { + /* CRLF */ + i += k + 2; + } + else if ((str_in[i + k] == 13) || (str_in[i + k] == 10)) { + /* CR or LF */ + i += k + 1; + } + else { + str_out[j++] = str_in[i++]; + } + } + break; + default: + str_out[j++] = str_in[i++]; + } + } + str_out[j] = '\0'; + len = j; + return str_out; +} + +char *string_bin2hex(const char *input, int &len) { + static char hexconvtab[] = "0123456789abcdef"; + + ASSERT(input); + if (len == 0) { + return NULL; + } + + int i, j; + char *result = (char *)malloc((len << 1) + 1); + + for (i = j = 0; i < len; i++) { + result[j++] = hexconvtab[(unsigned char)input[i] >> 4]; + result[j++] = hexconvtab[(unsigned char)input[i] & 15]; + } + result[j] = '\0'; + len = j; + return result; +} + +char *string_hex2bin(const char *input, int &len) { + len <<= 1; + char *str = (char *)malloc(len + 1); + int i, j; + for (i = j = 0; i < len; i++) { + char c = input[j++]; + if (c >= '0' && c <= '9') { + str[i] = (c - '0') << 4; + } else if (c >= 'a' && c <= 'f') { + str[i] = (c - 'a' + 10) << 4; + } else if (c >= 'A' && c <= 'F') { + str[i] = (c - 'A' + 10) << 4; + } else { + throw InvalidArgumentException("bad encoding at position", j); + } + c = input[j++]; + if (c >= '0' && c <= '9') { + str[i] |= c - '0'; + } else if (c >= 'a' && c <= 'f') { + str[i] |= c - 'a' + 10; + } else if (c >= 'A' && c <= 'F') { + str[i] |= c - 'A' + 10; + } else { + throw InvalidArgumentException("bad encoding at position", j); + } + } + str[len] = '\0'; + return str; +} + +long string_base_to_long(const char *s, int len, int base) { + long num = 0, digit, onum; + const char *orig = s; + if (base < 2 || base > 36) { + return 0; + } + for (int i = len; i > 0; i--) { + char c = *s++; + + digit = (c >= '0' && c <= '9') ? c - '0' + : (c >= 'A' && c <= 'Z') ? c - 'A' + 10 + : (c >= 'a' && c <= 'z') ? c - 'a' + 10 + : base; + + if (digit >= base) { + continue; + } + + onum = num; + num = num * base + digit; + if (num >= onum) continue; + Logger::Warning("Number '%s' is too big to fit in long", orig); + return LONG_MAX; + } + return num; +} + +Variant string_base_to_numeric(const char *s, int len, int base) { + long num = 0; + double fnum = 0; + int mode = 0; + long cutoff; + int cutlim; + + if (base < 2 || base > 36) { + return false; + } + + cutoff = LONG_MAX / base; + cutlim = LONG_MAX % base; + + for (int i = len; i > 0; i--) { + char c = *s++; + + /* might not work for EBCDIC */ + if (c >= '0' && c <= '9') + c -= '0'; + else if (c >= 'A' && c <= 'Z') + c -= 'A' - 10; + else if (c >= 'a' && c <= 'z') + c -= 'a' - 10; + else + continue; + + if (c >= base) + continue; + + switch (mode) { + case 0: /* Integer */ + if (num < cutoff || (num == cutoff && c <= cutlim)) { + num = num * base + c; + break; + } else { + fnum = num; + mode = 1; + } + /* fall-through */ + case 1: /* Float */ + fnum = fnum * base + c; + } + } + + if (mode == 1) { + return fnum; + } + return num; +} + +char *string_long_to_base(unsigned long value, int base) { + static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + char buf[(sizeof(unsigned long) << 3) + 1]; + char *ptr, *end; + + if (base < 2 || base > 36) { + throw InvalidArgumentException("base", base); + } + + end = ptr = buf + sizeof(buf) - 1; + *ptr = '\0'; + + do { + *--ptr = digits[value % base]; + value /= base; + } while (ptr > buf && value); + + return string_duplicate(ptr, end - ptr); +} + +char *string_numeric_to_base(CVarRef value, int base) { + static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + + if ((!value.isInteger() && !value.isDouble()) || base < 2 || base > 36) { + return string_duplicate("", 0); + } + + if (value.isDouble()) { + double fvalue = floor(value); /* floor it just in case */ + char *ptr, *end; + char buf[(sizeof(double) << 3) + 1]; + + /* Don't try to convert +/- infinity */ + if (fvalue == HUGE_VAL || fvalue == -HUGE_VAL) { + Logger::Warning("Number too large"); + return string_duplicate("", 0); + } + + end = ptr = buf + sizeof(buf) - 1; + *ptr = '\0'; + + do { + *--ptr = digits[(int) fmod(fvalue, base)]; + fvalue /= base; + } while (ptr > buf && fabs(fvalue) >= 1); + + return string_duplicate(ptr, end - ptr); + } + + return string_long_to_base(value.toInt64(), base); +} + +/////////////////////////////////////////////////////////////////////////////// +// uuencode + +#define PHP_UU_ENC(c) \ + ((c) ? ((c) & 077) + ' ' : '`') +#define PHP_UU_ENC_C2(c) \ + PHP_UU_ENC(((*(c) << 4) & 060) | ((*((c) + 1) >> 4) & 017)) +#define PHP_UU_ENC_C3(c) \ + PHP_UU_ENC(((*(c + 1) << 2) & 074) | ((*((c) + 2) >> 6) & 03)) +#define PHP_UU_DEC(c) \ + (((c) - ' ') & 077) + +char *string_uuencode(const char *src, int src_len, int &dest_len) { + ASSERT(src); + ASSERT(src_len); + + int len = 45; + char *p; + const char *s, *e, *ee; + char *dest; + + /* encoded length is ~ 38% greater then the original */ + p = dest = (char *)malloc((int)ceil(src_len * 1.38) + 46); + s = src; + e = src + src_len; + + while ((s + 3) < e) { + ee = s + len; + if (ee > e) { + ee = e; + len = ee - s; + if (len % 3) { + ee = s + (int) (floor(len / 3) * 3); + } + } + *p++ = PHP_UU_ENC(len); + + while (s < ee) { + *p++ = PHP_UU_ENC(*s >> 2); + *p++ = PHP_UU_ENC_C2(s); + *p++ = PHP_UU_ENC_C3(s); + *p++ = PHP_UU_ENC(*(s + 2) & 077); + + s += 3; + } + + if (len == 45) { + *p++ = '\n'; + } + } + + if (s < e) { + if (len == 45) { + *p++ = PHP_UU_ENC(e - s); + len = 0; + } + + *p++ = PHP_UU_ENC(*s >> 2); + *p++ = PHP_UU_ENC_C2(s); + *p++ = ((e - s) > 1) ? PHP_UU_ENC_C3(s) : PHP_UU_ENC('\0'); + *p++ = ((e - s) > 2) ? PHP_UU_ENC(*(s + 2) & 077) : PHP_UU_ENC('\0'); + } + + if (len < 45) { + *p++ = '\n'; + } + + *p++ = PHP_UU_ENC('\0'); + *p++ = '\n'; + *p = '\0'; + + dest_len = p - dest; + return dest; +} + +char *string_uudecode(const char *src, int src_len, int &total_len) { + total_len = 0; + int len; + const char *s, *e, *ee; + char *p, *dest; + + p = dest = (char *)malloc((int)ceil(src_len * 0.75) + 1); + s = src; + e = src + src_len; + + while (s < e) { + if ((len = PHP_UU_DEC(*s++)) <= 0) { + break; + } + /* sanity check */ + if (len > src_len) { + goto err; + } + + total_len += len; + + ee = s + (len == 45 ? 60 : (int) floor(len * 1.33)); + /* sanity check */ + if (ee > e) { + goto err; + } + + while (s < ee) { + *p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4; + *p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2; + *p++ = PHP_UU_DEC(*(s + 2)) << 6 | PHP_UU_DEC(*(s + 3)); + s += 4; + } + + if (len < 45) { + break; + } + + /* skip \n */ + s++; + } + + if ((len = total_len > (p - dest))) { + *p++ = PHP_UU_DEC(*s) << 2 | PHP_UU_DEC(*(s + 1)) >> 4; + if (len > 1) { + *p++ = PHP_UU_DEC(*(s + 1)) << 4 | PHP_UU_DEC(*(s + 2)) >> 2; + if (len > 2) { + *p++ = PHP_UU_DEC(*(s + 2)) << 6 | PHP_UU_DEC(*(s + 3)); + } + } + } + + *(dest + total_len) = '\0'; + + return dest; + + err: + free(dest); + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +// base64 + +static const char base64_table[] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0' +}; + +static const char base64_pad = '='; + +static const short base64_reverse_table[256] = { + -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -2, -2, -1, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, -2, -2, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, -2, -2, -2, + -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, -2, + -2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, + -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2 +}; + +static unsigned char *php_base64_encode(const unsigned char *str, int length, + int *ret_length) { + const unsigned char *current = str; + unsigned char *p; + unsigned char *result; + + if ((length + 2) < 0 || ((length + 2) / 3) >= (1 << (sizeof(int) * 8 - 2))) { + if (ret_length != NULL) { + *ret_length = 0; + } + return NULL; + } + + result = (unsigned char *)malloc(((length + 2) / 3) * 4 + 1); + p = result; + + while (length > 2) { /* keep going until we have less than 24 bits */ + *p++ = base64_table[current[0] >> 2]; + *p++ = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)]; + *p++ = base64_table[((current[1] & 0x0f) << 2) + (current[2] >> 6)]; + *p++ = base64_table[current[2] & 0x3f]; + + current += 3; + length -= 3; /* we just handle 3 octets of data */ + } + + /* now deal with the tail end of things */ + if (length != 0) { + *p++ = base64_table[current[0] >> 2]; + if (length > 1) { + *p++ = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)]; + *p++ = base64_table[(current[1] & 0x0f) << 2]; + *p++ = base64_pad; + } else { + *p++ = base64_table[(current[0] & 0x03) << 4]; + *p++ = base64_pad; + *p++ = base64_pad; + } + } + if (ret_length != NULL) { + *ret_length = (int)(p - result); + } + *p = '\0'; + return result; +} + +static unsigned char *php_base64_decode(const unsigned char *str, + int length, int *ret_length, + bool strict) { + const unsigned char *current = str; + int ch, i = 0, j = 0, k; + /* this sucks for threaded environments */ + unsigned char *result; + + result = (unsigned char *)malloc(length + 1); + + /* run through the whole string, converting as we go */ + while ((ch = *current++) != '\0' && length-- > 0) { + if (ch == base64_pad) break; + + ch = base64_reverse_table[ch]; + if ((!strict && ch < 0) || ch == -1) { + /* a space or some other separator character, we simply skip over */ + continue; + } else if (ch == -2) { + free(result); + return NULL; + } + + switch(i % 4) { + case 0: + result[j] = ch << 2; + break; + case 1: + result[j++] |= ch >> 4; + result[j] = (ch & 0x0f) << 4; + break; + case 2: + result[j++] |= ch >>2; + result[j] = (ch & 0x03) << 6; + break; + case 3: + result[j++] |= ch; + break; + } + i++; + } + + k = j; + /* mop things up if we ended on a boundary */ + if (ch == base64_pad) { + switch(i % 4) { + case 1: + free(result); + return NULL; + case 2: + k++; + case 3: + result[k++] = 0; + } + } + if(ret_length) { + *ret_length = j; + } + result[j] = '\0'; + return result; +} + +char *string_base64_encode(const char *input, int &len) { + return (char *)php_base64_encode((unsigned char *)input, len, &len); +} + +char *string_base64_decode(const char *input, int &len, bool strict) { + return (char *)php_base64_decode((unsigned char *)input, len, &len, strict); +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_escape_shell_arg(const char *str) { + int x, y, l; + char *cmd; + + y = 0; + l = strlen(str); + + cmd = (char *)malloc((l << 2) + 3); /* worst case */ + + cmd[y++] = '\''; + + for (x = 0; x < l; x++) { + switch (str[x]) { + case '\'': + cmd[y++] = '\''; + cmd[y++] = '\\'; + cmd[y++] = '\''; + /* fall-through */ + default: + cmd[y++] = str[x]; + } + } + cmd[y++] = '\''; + cmd[y] = '\0'; + return cmd; +} + +char *string_escape_shell_cmd(const char *str) { + register int x, y, l; + char *cmd; + char *p = NULL; + + l = strlen(str); + cmd = (char *)malloc((l << 1) + 1); + + for (x = 0, y = 0; x < l; x++) { + switch (str[x]) { + case '"': + case '\'': + if (!p && (p = (char *)memchr(str + x + 1, str[x], l - x - 1))) { + /* noop */ + } else if (p && *p == str[x]) { + p = NULL; + } else { + cmd[y++] = '\\'; + } + cmd[y++] = str[x]; + break; + case '#': /* This is character-set independent */ + case '&': + case ';': + case '`': + case '|': + case '*': + case '?': + case '~': + case '<': + case '>': + case '^': + case '(': + case ')': + case '[': + case ']': + case '{': + case '}': + case '$': + case '\\': + case '\x0A': /* excluding these two */ + case '\xFF': + cmd[y++] = '\\'; + /* fall-through */ + default: + cmd[y++] = str[x]; + } + } + cmd[y] = '\0'; + return cmd; +} + +/////////////////////////////////////////////////////////////////////////////// +// json + +#define REVERSE16(us) (((us & 0xf) << 12) | (((us >> 4) & 0xf) << 8) | (((us >> 8) & 0xf) << 4) | ((us >> 12) & 0xf)) + +char *string_json_escape(const char *s, int &len, bool loose) { + StringBuffer sb; + if (len == 0) { + sb.append("\"\"", 2); + } else { + unsigned short *utf16 = + (unsigned short *)malloc(len * sizeof(unsigned short)); + + len = utf8_to_utf16(utf16, (char*)s, len, loose ? 1 : 0); + if (len <= 0) { + sb.append("\"\"", 2); + } else { + static const char digits[] = "0123456789abcdef"; + + sb += '"'; + for (int pos = 0; pos < len; pos++) { + unsigned short us = utf16[pos]; + switch (us) { + case '"': sb.append("\\\"", 2); break; + case '\\': sb.append("\\\\", 2); break; + case '/': sb.append("\\/", 2); break; + case '\b': sb.append("\\b", 2); break; + case '\f': sb.append("\\f", 2); break; + case '\n': sb.append("\\n", 2); break; + case '\r': sb.append("\\r", 2); break; + case '\t': sb.append("\\t", 2); break; + default: + if (us >= ' ' && (us & 127) == us) { + sb.append((char)us); + } else { + sb.append("\\u", 2); + us = REVERSE16(us); + sb.append(digits[us & ((1 << 4) - 1)]); us >>= 4; + sb.append(digits[us & ((1 << 4) - 1)]); us >>= 4; + sb.append(digits[us & ((1 << 4) - 1)]); us >>= 4; + sb.append(digits[us & ((1 << 4) - 1)]); + } + break; + } + } + sb += '"'; + } + + free(utf16); + } + + return sb.detach(len); +} + +/////////////////////////////////////////////////////////////////////////////// + +void string_translate(char *str, int len, const char *str_from, + const char *str_to, int trlen) { + int i; + unsigned char xlat[256]; + + if ((trlen < 1) || (len < 1)) { + return; + } + + for (i = 0; i < 256; xlat[i] = i, i++); + for (i = 0; i < trlen; i++) { + xlat[(unsigned char) str_from[i]] = str_to[i]; + } + + for (i = 0; i < len; i++) { + str[i] = xlat[(unsigned char) str[i]]; + } +} + +char *string_rot13(const char *input, int len) { + ASSERT(input); + + static char rot13_from[] = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + static char rot13_to[] = + "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"; + + if (len == 0) { + return NULL; + } + char *ret = string_duplicate(input, len); + string_translate(ret, len, rot13_from, rot13_to, 52); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +static void string_similar_str(const char *txt1, int len1, + const char *txt2, int len2, + int *pos1, int *pos2, int *max) { + const char *p, *q; + const char *end1 = txt1 + len1; + const char *end2 = txt2 + len2; + int l; + + *max = 0; + for (p = txt1; p < end1; p++) { + for (q = txt2; q < end2; q++) { + for (l = 0; (p + l < end1) && (q + l < end2) && (p[l] == q[l]); l++); + if (l > *max) { + *max = l; + *pos1 = p - txt1; + *pos2 = q - txt2; + } + } + } +} + +static int string_similar_char(const char *txt1, int len1, + const char *txt2, int len2) { + int sum; + int pos1 = 0, pos2 = 0, max; + + string_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max); + if ((sum = max)) { + if (pos1 && pos2) { + sum += string_similar_char(txt1, pos1, txt2, pos2); + } + if ((pos1 + max < len1) && (pos2 + max < len2)) { + sum += string_similar_char(txt1 + pos1 + max, len1 - pos1 - max, + txt2 + pos2 + max, len2 - pos2 - max); + } + } + + return sum; +} + +int string_similar_text(const char *t1, int len1, + const char *t2, int len2, float *percent) { + if (len1 == 0 && len2 == 0) { + if (percent) *percent = 0.0; + return 0; + } + + int sim = string_similar_char(t1, len1, t2, len2); + if (percent) *percent = sim * 200.0 / (len1 + len2); + return sim; +} + +/////////////////////////////////////////////////////////////////////////////// + +#define LEVENSHTEIN_MAX_LENTH 255 + +// reference implementation, only optimized for memory usage, not speed +int string_levenshtein(const char *s1, int l1, const char *s2, int l2, + int cost_ins, int cost_rep, int cost_del ) { + int *p1, *p2, *tmp; + int i1, i2, c0, c1, c2; + + if(l1==0) return l2*cost_ins; + if(l2==0) return l1*cost_del; + + if((l1>LEVENSHTEIN_MAX_LENTH)||(l2>LEVENSHTEIN_MAX_LENTH)) + return -1; + + p1 = (int*)malloc((l2+1) * sizeof(int)); + p2 = (int*)malloc((l2+1) * sizeof(int)); + + for(i2=0;i2<=l2;i2++) { + p1[i2] = i2*cost_ins; + } + + for(i1=0;i1 + */ + +#define CRC32(crc, ch) (crc = (crc >> 8) ^ crc32tab[(crc ^ (ch)) & 0xff]) + +/* generated using the AUTODIN II polynomial + * x^32 + x^26 + x^23 + x^22 + x^16 + + * x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1 + */ +static const unsigned int crc32tab[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, +}; + +int string_crc32(const char *p, int len) { + uint32 crcinit = 0; + register int32 crc = crcinit ^ 0xFFFFFFFF; + for (; len--; ++p) { + crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*p)) & 0xFF]; + } + return crc ^ 0xFFFFFFFF; +} + +/////////////////////////////////////////////////////////////////////////////// +// crypt + +#include + +static unsigned char itoa64[] = + "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +static void ito64(char *s, long v, int n) { + while (--n >= 0) { + *s++ = itoa64[v&0x3f]; + v >>= 6; + } +} + +char *string_crypt(const char *key, const char *salt) { + ASSERT(key); + ASSERT(salt); + + char random_salt[3]; + if (!*salt) { + ito64(random_salt, rand(), 2); + random_salt[2] = '\0'; + salt = random_salt; + } + + static Mutex mutex; + Lock lock(mutex); + return strdup(crypt(key, salt)); +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_money_format(const char *format, double value) { + bool check = false; + const char *p = format; + while ((p = strchr(p, '%'))) { + if (*(p + 1) == '%') { + p += 2; + } else if (!check) { + check = true; + p++; + } else { + throw InvalidArgumentException + ("format", "Only a single %%i or %%n token can be used"); + } + } + + int format_len = strlen(format); + int str_len = format_len + 1024; + char *str = (char *)malloc(str_len); + str_len = strfmon(str, str_len, format, value); + ASSERT(str_len >= 0); + str[str_len] = 0; + return str; +} + +/////////////////////////////////////////////////////////////////////////////// + +char *string_number_format(double d, int dec, char dec_point, + char thousand_sep) { + char *tmpbuf = NULL, *resbuf; + char *s, *t; /* source, target */ + char *dp; + int integral; + int tmplen, reslen=0; + int count=0; + int is_negative=0; + + if (d < 0) { + is_negative = 1; + d = -d; + } + + if (dec < 0) dec = 0; + PHP_ROUND_WITH_FUZZ(d, dec); + + // departure from PHP: we got rid of dependencies on spprintf() here. + tmpbuf = (char *)malloc(64); + snprintf(tmpbuf, 64, "%.*F", dec, d); + tmplen = strlen(tmpbuf); + if (tmpbuf == NULL || !isdigit((int)tmpbuf[0])) { + return tmpbuf; + } + + /* find decimal point, if expected */ + if (dec) { + dp = strpbrk(tmpbuf, ".,"); + } else { + dp = NULL; + } + + /* calculate the length of the return buffer */ + if (dp) { + integral = dp - tmpbuf; + } else { + /* no decimal point was found */ + integral = tmplen; + } + + /* allow for thousand separators */ + if (thousand_sep) { + integral += (integral-1) / 3; + } + + reslen = integral; + + if (dec) { + reslen += dec; + + if (dec_point) { + reslen++; + } + } + + /* add a byte for minus sign */ + if (is_negative) { + reslen++; + } + resbuf = (char *) malloc(reslen+1); /* +1 for NUL terminator */ + + s = tmpbuf+tmplen-1; + t = resbuf+reslen; + *t-- = '\0'; + + /* copy the decimal places. + * Take care, as the sprintf implementation may return less places than + * we requested due to internal buffer limitations */ + if (dec) { + int declen = dp ? s - dp : 0; + int topad = dec > declen ? dec - declen : 0; + + /* pad with '0's */ + while (topad--) { + *t-- = '0'; + } + + if (dp) { + s -= declen + 1; /* +1 to skip the point */ + t -= declen; + + /* now copy the chars after the point */ + memcpy(t + 1, dp + 1, declen); + } + + /* add decimal point */ + if (dec_point) { + *t-- = dec_point; + } + } + + /* copy the numbers before the decimal point, adding thousand + * separator every three digits */ + while(s >= tmpbuf) { + *t-- = *s--; + if (thousand_sep && (++count%3)==0 && s>=tmpbuf) { + *t-- = thousand_sep; + } + } + + /* and a minus sign, if needed */ + if (is_negative) { + *t-- = '-'; + } + + free(tmpbuf); + return resbuf; +} + +/////////////////////////////////////////////////////////////////////////////// +// soundex + +/* Simple soundex algorithm as described by Knuth in TAOCP, vol 3 */ +char *string_soundex(const char *str) { + ASSERT(str); + + int _small, code, last; + char soundex[4 + 1]; + + static char soundex_table[26] = { + 0, /* A */ + '1', /* B */ + '2', /* C */ + '3', /* D */ + 0, /* E */ + '1', /* F */ + '2', /* G */ + 0, /* H */ + 0, /* I */ + '2', /* J */ + '2', /* K */ + '4', /* L */ + '5', /* M */ + '5', /* N */ + 0, /* O */ + '1', /* P */ + '2', /* Q */ + '6', /* R */ + '2', /* S */ + '3', /* T */ + 0, /* U */ + '1', /* V */ + 0, /* W */ + '2', /* X */ + 0, /* Y */ + '2' /* Z */ + }; + + if (!*str) { + return NULL; + } + + /* build soundex string */ + last = -1; + const char *p = str; + for (_small = 0; *p && _small < 4; p++) { + /* convert chars to upper case and strip non-letter chars */ + /* BUG: should also map here accented letters used in non */ + /* English words or names (also found in English text!): */ + /* esstsett, thorn, n-tilde, c-cedilla, s-caron, ... */ + code = toupper((int)(unsigned char)(*p)); + if (code >= 'A' && code <= 'Z') { + if (_small == 0) { + /* remember first valid char */ + soundex[_small++] = code; + last = soundex_table[code - 'A']; + } else { + /* ignore sequences of consonants with same soundex */ + /* code in trail, and vowels unless they separate */ + /* consonant letters */ + code = soundex_table[code - 'A']; + if (code != last) { + if (code != 0) { + soundex[_small++] = code; + } + last = code; + } + } + } + } + /* pad with '0' and terminate with 0 ;-) */ + while (_small < 4) { + soundex[_small++] = '0'; + } + soundex[_small] = '\0'; + return strdup(soundex); +} + +/////////////////////////////////////////////////////////////////////////////// +// metaphone + +/** + * this is now the original code by Michael G Schwern: + * i've changed it just a slightly bit (use emalloc, + * get rid of includes etc) + * - thies - 13.09.1999 + */ + +/*----------------------------- */ +/* this used to be "metaphone.h" */ +/*----------------------------- */ + +/* Special encodings */ +#define SH 'X' +#define TH '0' + +/*----------------------------- */ +/* end of "metaphone.h" */ +/*----------------------------- */ + +/*----------------------------- */ +/* this used to be "metachar.h" */ +/*----------------------------- */ + +/* Metachar.h ... little bits about characters for metaphone */ +/*-- Character encoding array & accessing macros --*/ +/* Stolen directly out of the book... */ +char _codes[26] = { 1,16,4,16,9,2,4,16,9,2,0,2,2,2,1,4,0,2,4,4,1,0,0,0,8,0}; + +#define ENCODE(c) (isalpha(c) ? _codes[((toupper(c)) - 'A')] : 0) + +#define isvowel(c) (ENCODE(c) & 1) /* AEIOU */ + +/* These letters are passed through unchanged */ +#define NOCHANGE(c) (ENCODE(c) & 2) /* FJMNR */ + +/* These form dipthongs when preceding H */ +#define AFFECTH(c) (ENCODE(c) & 4) /* CGPST */ + +/* These make C and G soft */ +#define MAKESOFT(c) (ENCODE(c) & 8) /* EIY */ + +/* These prevent GH from becoming F */ +#define NOGHTOF(c) (ENCODE(c) & 16) /* BDH */ + +/*----------------------------- */ +/* end of "metachar.h" */ +/*----------------------------- */ + +/* I suppose I could have been using a character pointer instead of + * accesssing the array directly... */ + +/* Look at the next letter in the word */ +#define Next_Letter (toupper(word[w_idx+1])) +/* Look at the current letter in the word */ +#define Curr_Letter (toupper(word[w_idx])) +/* Go N letters back. */ +#define Look_Back_Letter(n) (w_idx >= n ? toupper(word[w_idx-n]) : '\0') +/* Previous letter. I dunno, should this return null on failure? */ +#define Prev_Letter (Look_Back_Letter(1)) +/* Look two letters down. It makes sure you don't walk off the string. */ +#define After_Next_Letter (Next_Letter != '\0' ? toupper(word[w_idx+2]) \ + : '\0') +#define Look_Ahead_Letter(n) (toupper(Lookahead(word+w_idx, n))) + +/* Allows us to safely look ahead an arbitrary # of letters */ +/* I probably could have just used strlen... */ +static char Lookahead(unsigned char *word, int how_far) { + char letter_ahead = '\0'; /* null by default */ + int idx; + for (idx = 0; word[idx] != '\0' && idx < how_far; idx++); + /* Edge forward in the string... */ + + letter_ahead = (char)word[idx]; /* idx will be either == to how_far or + * at the end of the string + */ + return letter_ahead; +} + +/* phonize one letter + * We don't know the buffers size in advance. On way to solve this is to just + * re-allocate the buffer size. We're using an extra of 2 characters (this + * could be one though; or more too). */ +#define Phonize(c) { \ + if (p_idx >= max_buffer_len) { \ + phoned_word = (char *)realloc(phoned_word, max_buffer_len + 2); \ + max_buffer_len += 2; \ + } \ + phoned_word[p_idx++] = c; \ + } +/* Slap a null character on the end of the phoned word */ +#define End_Phoned_Word {phoned_word[p_idx] = '\0';} +/* How long is the phoned word? */ +#define Phone_Len (p_idx) + +/* Note is a letter is a 'break' in the word */ +#define Isbreak(c) (!isalpha(c)) + +char *string_metaphone(const char *input, int word_len, long max_phonemes, + int traditional) { + unsigned char *word = (unsigned char *)input; + char *phoned_word; + + int w_idx = 0; /* point in the phonization we're at. */ + int p_idx = 0; /* end of the phoned phrase */ + int max_buffer_len = 0; /* maximum length of the destination buffer */ + + /*-- Parameter checks --*/ + /* Negative phoneme length is meaningless */ + + if (max_phonemes < 0) + return NULL; + + /* Empty/null string is meaningless */ + /* Overly paranoid */ + /* assert(word != NULL && word[0] != '\0'); */ + + if (word == NULL) + return NULL; + + /*-- Allocate memory for our phoned_phrase --*/ + if (max_phonemes == 0) { /* Assume largest possible */ + max_buffer_len = word_len; + phoned_word = (char *)malloc(word_len + 1); + } else { + max_buffer_len = max_phonemes; + phoned_word = (char *)malloc(max_phonemes +1); + } + + /*-- The first phoneme has to be processed specially. --*/ + /* Find our first letter */ + for (; !isalpha(Curr_Letter); w_idx++) { + /* On the off chance we were given nothing but crap... */ + if (Curr_Letter == '\0') { + End_Phoned_Word + return phoned_word; /* For testing */ + } + } + + switch (Curr_Letter) { + /* AE becomes E */ + case 'A': + if (Next_Letter == 'E') { + Phonize('E'); + w_idx += 2; + } + /* Remember, preserve vowels at the beginning */ + else { + Phonize('A'); + w_idx++; + } + break; + /* [GKP]N becomes N */ + case 'G': + case 'K': + case 'P': + if (Next_Letter == 'N') { + Phonize('N'); + w_idx += 2; + } + break; + /* WH becomes H, + WR becomes R + W if followed by a vowel */ + case 'W': + if (Next_Letter == 'H' || + Next_Letter == 'R') { + Phonize(Next_Letter); + w_idx += 2; + } else if (isvowel(Next_Letter)) { + Phonize('W'); + w_idx += 2; + } + /* else ignore */ + break; + /* X becomes S */ + case 'X': + Phonize('S'); + w_idx++; + break; + /* Vowels are kept */ + /* We did A already + case 'A': + case 'a': + */ + case 'E': + case 'I': + case 'O': + case 'U': + Phonize(Curr_Letter); + w_idx++; + break; + default: + /* do nothing */ + break; + } + + /* On to the metaphoning */ + for (; Curr_Letter != '\0' && + (max_phonemes == 0 || Phone_Len < max_phonemes); + w_idx++) { + /* How many letters to skip because an eariler encoding handled + * multiple letters */ + unsigned short int skip_letter = 0; + + + /* THOUGHT: It would be nice if, rather than having things like... + * well, SCI. For SCI you encode the S, then have to remember + * to skip the C. So the phonome SCI invades both S and C. It would + * be better, IMHO, to skip the C from the S part of the encoding. + * Hell, I'm trying it. + */ + + /* Ignore non-alphas */ + if (!isalpha(Curr_Letter)) + continue; + + /* Drop duplicates, except CC */ + if (Curr_Letter == Prev_Letter && + Curr_Letter != 'C') + continue; + + switch (Curr_Letter) { + /* B -> B unless in MB */ + case 'B': + if (Prev_Letter != 'M') + Phonize('B'); + break; + /* 'sh' if -CIA- or -CH, but not SCH, except SCHW. + * (SCHW is handled in S) + * S if -CI-, -CE- or -CY- + * dropped if -SCI-, SCE-, -SCY- (handed in S) + * else K + */ + case 'C': + if (MAKESOFT(Next_Letter)) { /* C[IEY] */ + if (After_Next_Letter == 'A' && + Next_Letter == 'I') { /* CIA */ + Phonize(SH); + } + /* SC[IEY] */ + else if (Prev_Letter == 'S') { + /* Dropped */ + } else { + Phonize('S'); + } + } else if (Next_Letter == 'H') { + if ((!traditional) && (After_Next_Letter == 'R' || + Prev_Letter == 'S')) { /* Christ, School */ + Phonize('K'); + } else { + Phonize(SH); + } + skip_letter++; + } else { + Phonize('K'); + } + break; + /* J if in -DGE-, -DGI- or -DGY- + * else T + */ + case 'D': + if (Next_Letter == 'G' && MAKESOFT(After_Next_Letter)) { + Phonize('J'); + skip_letter++; + } else + Phonize('T'); + break; + /* F if in -GH and not B--GH, D--GH, -H--GH, -H---GH + * else dropped if -GNED, -GN, + * else dropped if -DGE-, -DGI- or -DGY- (handled in D) + * else J if in -GE-, -GI, -GY and not GG + * else K + */ + case 'G': + if (Next_Letter == 'H') { + if (!(NOGHTOF(Look_Back_Letter(3)) || Look_Back_Letter(4) == 'H')) { + Phonize('F'); + skip_letter++; + } else { + /* silent */ + } + } else if (Next_Letter == 'N') { + if (Isbreak(After_Next_Letter) || + (After_Next_Letter == 'E' && Look_Ahead_Letter(3) == 'D')) { + /* dropped */ + } else + Phonize('K'); + } else if (MAKESOFT(Next_Letter) && Prev_Letter != 'G') { + Phonize('J'); + } else { + Phonize('K'); + } + break; + /* H if before a vowel and not after C,G,P,S,T */ + case 'H': + if (isvowel(Next_Letter) && !AFFECTH(Prev_Letter)) + Phonize('H'); + break; + /* dropped if after C + * else K + */ + case 'K': + if (Prev_Letter != 'C') + Phonize('K'); + break; + /* F if before H + * else P + */ + case 'P': + if (Next_Letter == 'H') { + Phonize('F'); + } else { + Phonize('P'); + } + break; + /* K + */ + case 'Q': + Phonize('K'); + break; + /* 'sh' in -SH-, -SIO- or -SIA- or -SCHW- + * else S + */ + case 'S': + if (Next_Letter == 'I' && + (After_Next_Letter == 'O' || After_Next_Letter == 'A')) { + Phonize(SH); + } else if (Next_Letter == 'H') { + Phonize(SH); + skip_letter++; + } else if ((!traditional) && + (Next_Letter == 'C' && Look_Ahead_Letter(2) == 'H' && + Look_Ahead_Letter(3) == 'W')) { + Phonize(SH); + skip_letter += 2; + } else { + Phonize('S'); + } + break; + /* 'sh' in -TIA- or -TIO- + * else 'th' before H + * else T + */ + case 'T': + if (Next_Letter == 'I' && + (After_Next_Letter == 'O' || After_Next_Letter == 'A')) { + Phonize(SH); + } else if (Next_Letter == 'H') { + Phonize(TH); + skip_letter++; + } else { + Phonize('T'); + } + break; + /* F */ + case 'V': + Phonize('F'); + break; + /* W before a vowel, else dropped */ + case 'W': + if (isvowel(Next_Letter)) + Phonize('W'); + break; + /* KS */ + case 'X': + Phonize('K'); + Phonize('S'); + break; + /* Y if followed by a vowel */ + case 'Y': + if (isvowel(Next_Letter)) + Phonize('Y'); + break; + /* S */ + case 'Z': + Phonize('S'); + break; + /* No transformation */ + case 'F': + case 'J': + case 'L': + case 'M': + case 'N': + case 'R': + Phonize(Curr_Letter); + break; + default: + /* nothing */ + break; + } /* END SWITCH */ + + w_idx += skip_letter; + } /* END FOR */ + + End_Phoned_Word; + return phoned_word; +} + +/////////////////////////////////////////////////////////////////////////////// +// Cyrillic + +/** + * This is codetables for different Cyrillic charsets (relative to koi8-r). + * Each table contains data for 128-255 symbols from ASCII table. + * First 256 symbols are for conversion from koi8-r to corresponding charset, + * second 256 symbols are for reverse conversion, from charset to koi8-r. + * + * Here we have the following tables: + * _cyr_win1251 - for windows-1251 charset + * _cyr_iso88595 - for iso8859-5 charset + * _cyr_cp866 - for x-cp866 charset + * _cyr_mac - for x-mac-cyrillic charset + */ +typedef unsigned char _cyr_charset_table[512]; + +static const _cyr_charset_table _cyr_win1251 = { + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, + 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, + 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, + 46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46, + 154,174,190,46,159,189,46,46,179,191,180,157,46,46,156,183, + 46,46,182,166,173,46,46,158,163,152,164,155,46,46,46,167, + 225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, + 242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, + 193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, + 210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209, + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, + 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, + 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 32,32,32,184,186,32,179,191,32,32,32,32,32,180,162,32, + 32,32,32,168,170,32,178,175,32,32,32,32,32,165,161,169, + 254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238, + 239,255,240,241,242,243,230,226,252,251,231,248,253,249,247,250, + 222,192,193,214,196,197,212,195,213,200,201,202,203,204,205,206, + 207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218, +}; + +static const _cyr_charset_table _cyr_cp866 = { + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, + 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, + 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, + 242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, + 193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, + 35,35,35,124,124,124,124,43,43,124,124,43,43,43,43,43, + 43,45,45,124,45,43,124,124,43,43,45,45,124,45,43,45, + 45,45,45,43,43,43,43,43,43,43,43,35,35,124,124,35, + 210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209, + 179,163,180,164,183,167,190,174,32,149,158,32,152,159,148,154, + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, + 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, + 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 205,186,213,241,243,201,32,245,187,212,211,200,190,32,247,198, + 199,204,181,240,242,185,32,244,203,207,208,202,216,32,246,32, + 238,160,161,230,164,165,228,163,229,168,169,170,171,172,173,174, + 175,239,224,225,226,227,166,162,236,235,167,232,237,233,231,234, + 158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142, + 143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154, +}; + +static const _cyr_charset_table _cyr_iso88595 = { + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, + 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, + 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 32,179,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, + 242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, + 193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, + 210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209, + 32,163,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, + 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, + 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, + 32,32,32,241,32,32,32,32,32,32,32,32,32,32,32,32, + 32,32,32,161,32,32,32,32,32,32,32,32,32,32,32,32, + 238,208,209,230,212,213,228,211,229,216,217,218,219,220,221,222, + 223,239,224,225,226,227,214,210,236,235,215,232,237,233,231,234, + 206,176,177,198,180,181,196,179,197,184,185,186,187,188,189,190, + 191,207,192,193,194,195,182,178,204,203,183,200,205,201,199,202, +}; + +static const _cyr_charset_table _cyr_mac = { + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, + 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, + 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240, + 242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,179,163,209, + 193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208, + 210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,255, + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, + 32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63, + 64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95, + 96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111, + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, + 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, + 160,161,162,222,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,221,180,181,182,183,184,185,186,187,188,189,190,191, + 254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238, + 239,223,240,241,242,243,230,226,252,251,231,248,253,249,247,250, + 158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142, + 143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154, +}; + +/** + * This is the function that performs real in-place conversion of the string + * between charsets. + * Parameters: + * str - string to be converted + * from,to - one-symbol label of source and destination charset + * The following symbols are used as labels: + * k - koi8-r + * w - windows-1251 + * i - iso8859-5 + * a - x-cp866 + * d - x-cp866 + * m - x-mac-cyrillic + */ +char *string_convert_cyrillic_string(const char *input, int length, + char from, char to) { + ASSERT(input); + const unsigned char *from_table, *to_table; + unsigned char tmp; + unsigned char *str = (unsigned char *)string_duplicate(input, length); + + from_table = NULL; + to_table = NULL; + + switch (toupper((int)(unsigned char)from)) { + case 'W': from_table = _cyr_win1251; break; + case 'A': + case 'D': from_table = _cyr_cp866; break; + case 'I': from_table = _cyr_iso88595; break; + case 'M': from_table = _cyr_mac; break; + case 'K': + break; + default: + throw InvalidArgumentException(0, "Unknown source charset: %c", from); + } + + switch (toupper((int)(unsigned char)to)) { + case 'W': to_table = _cyr_win1251; break; + case 'A': + case 'D': to_table = _cyr_cp866; break; + case 'I': to_table = _cyr_iso88595; break; + case 'M': to_table = _cyr_mac; break; + case 'K': + break; + default: + throw InvalidArgumentException(0, "Unknown destination charset: %c", to); + } + + if (!str) { + return (char *)str; + } + + for (int i = 0; i= 224) && (((unsigned char) c) <= 250)) ? 1 : 0) +#define _isblank(c) \ + (((((unsigned char) c) == ' ' || ((unsigned char) c) == '\t')) ? 1 : 0) +#define _isnewline(c) \ + (((((unsigned char) c) == '\n' || ((unsigned char) c) == '\r')) ? 1 : 0) + +/** + * Converts Logical Hebrew text (Hebrew Windows style) to Visual text + * Cheers/complaints/flames - Zeev Suraski + */ +char *string_convert_hebrew_string(const char *str, int &str_len, + int max_chars_per_line, + int convert_newlines) { + ASSERT(str); + const char *tmp; + char *heb_str, *broken_str; + char *target; + int block_start, block_end, block_type, block_length, i; + long max_chars=0; + int begin, end, char_count, orig_begin; + + if (str_len == 0) { + return NULL; + } + + tmp = str; + block_start=block_end=0; + + heb_str = (char *) malloc(str_len + 1); + target = heb_str+str_len; + *target = 0; + target--; + + block_length=0; + + if (isheb(*tmp)) { + block_type = _HEB_BLOCK_TYPE_HEB; + } else { + block_type = _HEB_BLOCK_TYPE_ENG; + } + + do { + if (block_type == _HEB_BLOCK_TYPE_HEB) { + while ((isheb((int)*(tmp+1)) || + _isblank((int)*(tmp+1)) || + ispunct((int)*(tmp+1)) || + (int)*(tmp+1)=='\n' ) && block_end': *target = '<'; break; + case '\\': *target = '/'; break; + case '/': *target = '\\'; break; + default: + break; + } + target--; + } + block_type = _HEB_BLOCK_TYPE_ENG; + } else { + while (!isheb(*(tmp+1)) && + (int)*(tmp+1)!='\n' && block_end < str_len-1) { + tmp++; + block_end++; + block_length++; + } + while ((_isblank((int)*tmp) || + ispunct((int)*tmp)) && *tmp!='/' && + *tmp!='-' && block_end > block_start) { + tmp--; + block_end--; + } + for (i = block_end; i >= block_start; i--) { + *target = str[i]; + target--; + } + block_type = _HEB_BLOCK_TYPE_HEB; + } + block_start=block_end+1; + } while (block_end < str_len-1); + + + broken_str = (char *) malloc(str_len+1); + begin=end=str_len-1; + target = broken_str; + + while (1) { + char_count=0; + while ((!max_chars || char_count < max_chars) && begin > 0) { + char_count++; + begin--; + if (begin <= 0 || _isnewline(heb_str[begin])) { + while (begin > 0 && _isnewline(heb_str[begin-1])) { + begin--; + char_count++; + } + break; + } + } + if (char_count == max_chars) { /* try to avoid breaking words */ + int new_char_count=char_count, new_begin=begin; + + while (new_char_count > 0) { + if (_isblank(heb_str[new_begin]) || _isnewline(heb_str[new_begin])) { + break; + } + new_begin++; + new_char_count--; + } + if (new_char_count > 0) { + char_count=new_char_count; + begin=new_begin; + } + } + orig_begin=begin; + + if (_isblank(heb_str[begin])) { + heb_str[begin]='\n'; + } + while (begin <= end && _isnewline(heb_str[begin])) { + /* skip leading newlines */ + begin++; + } + for (i = begin; i <= end; i++) { /* copy content */ + *target = heb_str[i]; + target++; + } + for (i = orig_begin; i <= end && _isnewline(heb_str[i]); i++) { + *target = heb_str[i]; + target++; + } + begin=orig_begin; + + if (begin <= 0) { + *target = 0; + break; + } + begin--; + end=begin; + } + free((void*)heb_str); + + if (convert_newlines) { + int count; + char *ret = string_replace(broken_str, str_len, "\n", strlen("\n"), + "
    \n", strlen("
    \n"), count, true); + if (ret) { + free(broken_str); + return ret; + } + } + return broken_str; +} + +#ifdef MAC_OS_X + + void *memrchr(const void *s, int c, size_t n) { + for (const char *p = (const char *)s + n - 1; p >= s; p--) { + if (*p == c) return (void *)p; + } + return NULL; + } + +#endif + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_string.h b/src/cpp/base/zend/zend_string.h new file mode 100644 index 0000000000000..0292c55c31936 --- /dev/null +++ b/src/cpp/base/zend/zend_string.h @@ -0,0 +1,333 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_STRING_H__ +#define __HPHP_ZEND_STRING_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +/** + * Low-level string functions PHP uses. + * + * 1. If a function returns a char *, it has malloc-ed a new string and it's + * caller's responsibility to free it. + * + * 2. If a function takes "int &len" right after the 1st string parameter, it + * is input string's length, and in return, it's return string's length. + * + * 3. All functions work with binary strings and all returned strings are + * NULL terminated, regardless of whether it's a binary string. + */ + +/* + * Copy src to string dst of size siz. At most siz-1 characters + * will be copied. Always NUL terminates (unless siz == 0). + * Returns strlen(src); if retval >= siz, truncation occurred. + */ +int string_copy(char *dst, const char *src, int siz); + +/** + * Duplicate a binary string. Note that NULL termination is needed even for + * a binary string, because String class only wraps such a "safe" one that can + * work with any functions that takes a C-string. + */ +inline char *string_duplicate(const char *s, int len) { + char *ret = (char *)malloc(len + 1); + memcpy(ret, s, len); + ret[len] = '\0'; + return ret; +} + +/** + * Compare two binary strings. + */ +inline int string_strcmp(const char *s1, int len1, const char *s2, int len2) { + int minlen = len1 < len2 ? len1 : len2; + int retval; + + retval = memcmp(s1, s2, minlen); + if (!retval) { + return (len1 - len2); + } + return retval; +} +/** + * Compare two binary strings of the first n bytes. + */ +inline int string_strncmp(const char *s1, int len1, const char *s2, int len2, + int len) { + int minlen = len1 < len2 ? len1 : len2; + int retval; + + if (len < minlen) { + minlen = len; + } + retval = memcmp(s1, s2, minlen); + if (!retval) { + return (len < len1 ? len : len1) - (len < len2 ? len : len2); + } else { + return retval; + } +} +/** + * Compare two binary strings, ignore case. + */ +inline int string_strcasecmp(const char *s1, int len1, + const char *s2, int len2) { + int minlen = len1 < len2 ? len1 : len2; + int c1, c2; + + while (minlen--) { + c1 = tolower((int)*(unsigned char *)s1++); + c2 = tolower((int)*(unsigned char *)s2++); + if (c1 != c2) { + return c1 - c2; + } + } + return len1 - len2; +} +/** + * Compare two binary strings of the first n bytes, ignore case. + */ +inline int string_strncasecmp(const char *s1, int len1, + const char *s2, int len2, int len) { + int minlen = len1 < len2 ? len1 : len2; + int c1, c2; + + if (len < minlen) { + minlen = len; + } + while (minlen--) { + c1 = tolower((int)*(unsigned char *)s1++); + c2 = tolower((int)*(unsigned char *)s2++); + if (c1 != c2) { + return c1 - c2; + } + } + return (len < len1 ? len : len1) - (len < len2 ? len : len2); +} +/** + * Concatenate two into one. + */ +char *string_concat(const char *s1, int len1, const char *s2, int len2, + int &len); + +/** + * Compare strings. + */ +int string_cmp(const char *s1, int len1, const char *s2, int len2); +int string_casecmp(const char *s1, int len1, const char *s2, int len2); +int string_ncmp(const char *s1, const char *s2, int len); +int string_ncasecmp(const char *s1, const char *s2, int len); +int string_natural_cmp(char const *a, size_t a_len, + char const *b, size_t b_len, int fold_case); + +/** + * Changing string's cases. Return's length is always the same as "len". + */ +char *string_to_lower(const char *s, int len); +char *string_to_upper(const char *s, int len); +char *string_to_upper_first(const char *s, int len); +char *string_to_upper_words(const char *s, int len); + +/** + * Trim a string by removing characters in the specified charlist. + * + * mode 1 : trim left + * mode 2 : trim right + * mode 3 : trim left and right + */ +char *string_trim(const char *s, int &len, + const char *charlist, int charlistlen, int mode); + +/** + * Pad a string with pad_string to pad_length. "len" is + * input string's length, and in return, it's trimmed string's length. pad_type + * can be k_STR_PAD_RIGHT, k_STR_PAD_LEFT or k_STR_PAD_BOTH. + */ +char *string_pad(const char *input, int &len, int pad_length, + const char *pad_string, int pad_str_len, int pad_type); + +/** + * Get a substring of input from "start" position with specified length. + * "start" and "length" can be negative and refer to PHP's doc for meanings. + */ +char *string_substr(const char *s, int &len, int start, int length); + +/** + * Find a character or substring and return it's position (or -1 if not found). + */ +int string_find(const char *input, int len, char ch, int pos, + bool case_sensitive); +int string_rfind(const char *input, int len, char ch, int pos, + bool case_sensitive); +int string_find(const char *input, int len, const char *s, int s_len, + int pos, bool case_sensitive); +int string_rfind(const char *input, int len, const char *s, int s_len, + int pos, bool case_sensitive); + +const char *string_memnstr(const char *haystack, const char *needle, + int needle_len, const char *end); +void *string_memrchr(const void *s, int c, size_t n); + +/** + * Replace specified substring or search string with specified replacement. + */ +char *string_replace(const char *s, int &len, int start, int length, + const char *replacement, int len_repl); +char *string_replace(const char *input, int &len, + const char *search, int len_search, + const char *replacement, int len_replace, + int &count, bool case_sensitive); + +/** + * Find the longest span of substrings that have or not have specified + * characters. Please read PHP's documentation for more details. + */ +int string_span(const char *s1, int s1_len, const char *s2, int s2_len); +int string_cspan(const char *s1, int s1_len, const char *s2, int s2_len); + +/** + * Reverse, repeat or shuffle a string. + */ +char *string_reverse(const char *s, int len); +char *string_repeat(const char *s, int &len, int count); +char *string_shuffle(const char *str, int len); +char *string_chunk_split(const char *src, int &srclen, const char *end, + int endlen, int chunklen); + +/** + * Strip HTML and PHP tags. + */ +char *string_strip_tags(const char *s, int &len, const char *allow, + int allow_len); + +/** + * Wrap text on word breaks. + */ +char *string_wordwrap(const char *text, int &textlen, int linelength, + const char *breakchar, int breakcharlen, bool docut); + +/** + * Encoding/decoding strings according to certain formats. + */ +char *string_addcslashes(const char *str, int &length, const char *what, + int wlength); +char *string_stripcslashes(const char *input, int &nlen); +char *string_addslashes(const char *str, int &length); +char *string_stripslashes(const char *input, int &l); +char *string_quotemeta(const char *input, int &len); +char *string_quoted_printable_encode(const char *input, int &len); +char *string_quoted_printable_decode(const char *input, int &len); +char *string_uuencode(const char *src, int src_len, int &dest_len); +char *string_uudecode(const char *src, int src_len, int &dest_len); +char *string_base64_encode(const char *input, int &len); +char *string_base64_decode(const char *input, int &len, bool strict); +char *string_escape_shell_arg(const char *str); +char *string_escape_shell_cmd(const char *str); +char *string_json_escape(const char *s, int &len, bool loose); + +/** + * Convert between strings and numbers. + */ +char *string_bin2hex(const char *input, int &len); +char *string_hex2bin(const char *input, int &len); +long string_base_to_long(const char *s, int len, int base); +Variant string_base_to_numeric(const char *s, int len, int base); +char *string_long_to_base(unsigned long value, int base); +char *string_numeric_to_base(CVarRef value, int base); + +/** + * Translates characters in str_from into characters in str_to one by one, + * assuming str_from and str_to have the same length of "trlen". + */ +void string_translate(char *str, int len, const char *str_from, + const char *str_to, int trlen); + +/** + * Hashing a string. + */ +char *string_rot13(const char *input, int len); +int string_crc32(const char *p, int len); +char *string_crypt(const char *key, const char *salt); +char *string_md5(const char *arg, int arg_len, bool raw, int &out_len); +char *string_sha1(const char *arg, int arg_len, bool raw, int &out_len); + +/** + * Formatting. + */ +char *string_money_format(const char *format, double value); + +char *string_number_format(double d, int dec, char dec_point, + char thousand_sep); + +/** + * Similarity and other properties of strings. + */ +int string_levenshtein(const char *s1, int l1, const char *s2, int l2, + int cost_ins, int cost_rep, int cost_del); +int string_similar_text(const char *t1, int len1, + const char *t2, int len2, float *percent); +char *string_soundex(const char *str); + +char *string_metaphone(const char *input, int word_len, long max_phonemes, + int traditional); + +/** + * Locale strings. + */ +char *string_convert_cyrillic_string(const char *input, int length, + char from, char to); +char *string_convert_hebrew_string(const char *str, int &str_len, + int max_chars_per_line, + int convert_newlines); + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +/** + * Calculates and adjusts "start" and "length" according to string's length. + * This function determines how those two parameters are interpreted in varies + * substr-related functions. It returns true if the start/length pair is + * valid or false if invalid. + */ +bool string_substr_check(int len, int &f, int &l); + +/** + * Fills a 256-byte bytemask with input. You can specify a range like 'a..z', + * it needs to be incrementing. This function determines how "charlist" + * parameters are interpreted in varies functions that take a list of + * characters. + */ +void string_charmask(const char *input, int len, char *mask); + +/////////////////////////////////////////////////////////////////////////////// +// mac doesn't have memrchr + +#ifdef MAC_OS_X + + void *memrchr(const void *s, int c, size_t n); + +#endif + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_STRING_H__ diff --git a/src/cpp/base/zend/zend_strtod.cpp b/src/cpp/base/zend/zend_strtod.cpp new file mode 100644 index 0000000000000..243afd3563852 --- /dev/null +++ b/src/cpp/base/zend/zend_strtod.cpp @@ -0,0 +1,2535 @@ +/**************************************************************** + * + * The author of this software is David M. Gay. + * + * Copyright (c) 1991 by AT&T. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + * + ***************************************************************/ + +/* Please send bug reports to + David M. Gay + AT&T Bell Laboratories, Room 2C-463 + 600 Mountain Avenue + Murray Hill, NJ 07974-2070 + U.S.A. + dmg@research.att.com or research!dmg + */ + +/* strtod for IEEE-, VAX-, and IBM-arithmetic machines. + * + * This strtod returns a nearest machine number to the input decimal + * string (or sets errno to ERANGE). With IEEE arithmetic, ties are + * broken by the IEEE round-even rule. Otherwise ties are broken by + * biased rounding (add half and chop). + * + * Inspired loosely by William D. Clinger's paper "How to Read Floating + * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. + * + * Modifications: + * + * 1. We only require IEEE, IBM, or VAX double-precision + * arithmetic (not IEEE double-extended). + * 2. We get by with floating-point arithmetic in a case that + * Clinger missed -- when we're computing d * 10^n + * for a small integer d and the integer n is not too + * much larger than 22 (the maximum integer k for which + * we can represent 10^k exactly), we may be able to + * compute (d*10^k) * 10^(e-k) with just one roundoff. + * 3. Rather than a bit-at-a-time adjustment of the binary + * result in the hard case, we use floating-point + * arithmetic to determine the adjustment to within + * one bit; only in really hard cases do we need to + * compute a second residual. + * 4. Because of 3., we don't need a large table of powers of 10 + * for ten-to-e (just some small tables, e.g. of 10^k + * for 0 <= k <= 22). + */ + +/* + * #define IEEE_LITTLE_ENDIAN for IEEE-arithmetic machines where the least + * significant byte has the lowest address. + * #define IEEE_BIG_ENDIAN for IEEE-arithmetic machines where the most + * significant byte has the lowest address. + * #define Long int on machines with 32-bit ints and 64-bit longs. + * #define Sudden_Underflow for IEEE-format machines without gradual + * underflow (i.e., that flush to zero on underflow). + * #define IBM for IBM mainframe-style floating-point arithmetic. + * #define VAX for VAX-style floating-point arithmetic. + * #define Unsigned_Shifts if >> does treats its left operand as unsigned. + * #define No_leftright to omit left-right logic in fast floating-point + * computation of dtoa. + * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3. + * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines + * that use extended-precision instructions to compute rounded + * products and quotients) with IBM. + * #define ROUND_BIASED for IEEE-format with biased rounding. + * #define Inaccurate_Divide for IEEE-format with correctly rounded + * products but inaccurate quotients, e.g., for Intel i860. + * #define Just_16 to store 16 bits per 32-bit Long when doing high-precision + * integer arithmetic. Whether this speeds things up or slows things + * down depends on the machine and the number being converted. + * #define KR_headers for old-style C function headers. + * #define Bad_float_h if your system lacks a float.h or if it does not + * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, + * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. + * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) + * if memory is available and otherwise does something you deem + * appropriate. If MALLOC is undefined, malloc will be invoked + * directly -- and assumed always to succeed. + */ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) +# if defined(__LITTLE_ENDIAN__) +# undef WORDS_BIGENDIAN +# else +# if defined(__BIG_ENDIAN__) +# define WORDS_BIGENDIAN +# endif +# endif +#endif + +#ifdef WORDS_BIGENDIAN +#define IEEE_BIG_ENDIAN +#else +#define IEEE_LITTLE_ENDIAN +#endif + +#if defined(__arm__) && !defined(__VFP_FP__) +/* + * * Although the CPU is little endian the FP has different + * * byte and word endianness. The byte order is still little endian + * * but the word order is big endian. + * */ +#define IEEE_BIG_ENDIAN +#undef IEEE_LITTLE_ENDIAN +#endif + +#ifdef __vax__ +#define VAX +#endif + +#if defined(_MSC_VER) +#define int32_t __int32 +#define uint32_t unsigned __int32 +#define IEEE_LITTLE_ENDIAN +#endif + +#define Long int32_t +#define ULong uint32_t + +#ifdef MALLOC +#ifdef KR_headers +extern char *MALLOC(); +#else +extern void *MALLOC(size_t); +#endif +#else +#define MALLOC malloc +#endif + +#include "ctype.h" +#include "errno.h" + +#ifdef Bad_float_h +#ifdef IEEE_BIG_ENDIAN +#define IEEE_ARITHMETIC +#endif +#ifdef IEEE_LITTLE_ENDIAN +#define IEEE_ARITHMETIC +#endif + +#ifdef IEEE_ARITHMETIC +#define DBL_DIG 15 +#define DBL_MAX_10_EXP 308 +#define DBL_MAX_EXP 1024 +#define FLT_RADIX 2 +#define FLT_ROUNDS 1 +#define DBL_MAX 1.7976931348623157e+308 +#endif + +#ifdef IBM +#define DBL_DIG 16 +#define DBL_MAX_10_EXP 75 +#define DBL_MAX_EXP 63 +#define FLT_RADIX 16 +#define FLT_ROUNDS 0 +#define DBL_MAX 7.2370055773322621e+75 +#endif + +#ifdef VAX +#define DBL_DIG 16 +#define DBL_MAX_10_EXP 38 +#define DBL_MAX_EXP 127 +#define FLT_RADIX 2 +#define FLT_ROUNDS 1 +#define DBL_MAX 1.7014118346046923e+38 +#endif + + +#ifndef LONG_MAX +#define LONG_MAX 2147483647 +#endif +#else +#include "float.h" +#endif +#ifndef __MATH_H__ +#include "math.h" +#endif + +#ifndef CONST +#ifdef KR_headers +#define CONST /* blank */ +#else +#define CONST const +#endif +#endif + +#ifdef Unsigned_Shifts +#define Sign_Extend(a,b) if (b < 0) a |= 0xffff0000; +#else +#define Sign_Extend(a,b) /*no-op*/ +#endif + +#if defined(IEEE_LITTLE_ENDIAN) + defined(IEEE_BIG_ENDIAN) + defined(VAX) + \ + defined(IBM) != 1 + Exactly one of IEEE_LITTLE_ENDIAN IEEE_BIG_ENDIAN, VAX, or + IBM should be defined. +#endif + + typedef union { + double d; + ULong ul[2]; + } _double; +#define value(x) ((x).d) +#ifdef IEEE_LITTLE_ENDIAN +#define word0(x) ((x).ul[1]) +#define word1(x) ((x).ul[0]) +#else +#define word0(x) ((x).ul[0]) +#define word1(x) ((x).ul[1]) +#endif + +/* The following definition of Storeinc is appropriate for MIPS processors. + * An alternative that might be better on some machines is + * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) + */ +#if defined(IEEE_LITTLE_ENDIAN) + defined(VAX) + defined(__arm__) +#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \ + ((unsigned short *)a)[0] = (unsigned short)c, a++) +#else +#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \ + ((unsigned short *)a)[1] = (unsigned short)c, a++) +#endif + +/* #define P DBL_MANT_DIG */ +/* Ten_pmax = floor(P*log(2)/log(5)) */ +/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */ +/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ +/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ + +#if defined(IEEE_LITTLE_ENDIAN) + defined(IEEE_BIG_ENDIAN) +#define Exp_shift 20 +#define Exp_shift1 20 +#define Exp_msk1 0x100000 +#define Exp_msk11 0x100000 +#define Exp_mask 0x7ff00000 +#define P 53 +#define Bias 1023 +#define IEEE_Arith +#define Emin (-1022) +#define Exp_1 0x3ff00000 +#define Exp_11 0x3ff00000 +#define Ebits 11 +#define Frac_mask 0xfffff +#define Frac_mask1 0xfffff +#define Ten_pmax 22 +#define Bletch 0x10 +#define Bndry_mask 0xfffff +#define Bndry_mask1 0xfffff +#define LSB 1 +#define Sign_bit 0x80000000 +#define Log2P 1 +#define Tiny0 0 +#define Tiny1 1 +#define Quick_max 14 +#define Int_max 14 +#define Infinite(x) (word0(x) == 0x7ff00000) /* sufficient test for here */ +#else +#undef Sudden_Underflow +#define Sudden_Underflow +#ifdef IBM +#define Exp_shift 24 +#define Exp_shift1 24 +#define Exp_msk1 0x1000000 +#define Exp_msk11 0x1000000 +#define Exp_mask 0x7f000000 +#define P 14 +#define Bias 65 +#define Exp_1 0x41000000 +#define Exp_11 0x41000000 +#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */ +#define Frac_mask 0xffffff +#define Frac_mask1 0xffffff +#define Bletch 4 +#define Ten_pmax 22 +#define Bndry_mask 0xefffff +#define Bndry_mask1 0xffffff +#define LSB 1 +#define Sign_bit 0x80000000 +#define Log2P 4 +#define Tiny0 0x100000 +#define Tiny1 0 +#define Quick_max 14 +#define Int_max 15 +#else /* VAX */ +#define Exp_shift 23 +#define Exp_shift1 7 +#define Exp_msk1 0x80 +#define Exp_msk11 0x800000 +#define Exp_mask 0x7f80 +#define P 56 +#define Bias 129 +#define Exp_1 0x40800000 +#define Exp_11 0x4080 +#define Ebits 8 +#define Frac_mask 0x7fffff +#define Frac_mask1 0xffff007f +#define Ten_pmax 24 +#define Bletch 2 +#define Bndry_mask 0xffff007f +#define Bndry_mask1 0xffff007f +#define LSB 0x10000 +#define Sign_bit 0x8000 +#define Log2P 1 +#define Tiny0 0x80 +#define Tiny1 0 +#define Quick_max 15 +#define Int_max 15 +#endif +#endif + +#ifndef IEEE_Arith +#define ROUND_BIASED +#endif + +#ifdef RND_PRODQUOT +#define rounded_product(a,b) a = rnd_prod(a, b) +#define rounded_quotient(a,b) a = rnd_quot(a, b) +#ifdef KR_headers +extern double rnd_prod(), rnd_quot(); +#else +extern double rnd_prod(double, double), rnd_quot(double, double); +#endif +#else +#define rounded_product(a,b) a *= b +#define rounded_quotient(a,b) a /= b +#endif + +#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) +#define Big1 0xffffffff + +#ifndef Just_16 +/* When Pack_32 is not defined, we store 16 bits per 32-bit Long. + * * This makes some inner loops simpler and sometimes saves work + * * during multiplications, but it often seems to make things slightly + * * slower. Hence the default is now to store 32 bits per Long. + * */ +#ifndef Pack_32 +#define Pack_32 +#endif +#endif + +#define Kmax 15 + +struct Bigint { + struct Bigint *next; + int k, maxwds, sign, wds; + ULong x[1]; +}; + +typedef struct Bigint Bigint; + +void destroy_freelist(void); + +class BigintData { +public: + BigintData() : p5s(NULL) { + freelist = (Bigint **)calloc(Kmax + 1, sizeof(Bigint *)); + } + ~BigintData() { + destroy_freelist(); + free(freelist); + } + + Bigint **freelist; + Bigint *p5s; +}; +static ThreadLocal s_bigint_data; + +static Bigint * Balloc(int k) +{ + int x; + Bigint *rv; + + if (k > Kmax) { + throw FatalErrorException("Balloc() allocation exceeds list boundary"); + } + + Bigint **&freelist = s_bigint_data->freelist; + if ((rv = freelist[k])) { + freelist[k] = rv->next; + } else { + x = 1 << k; + rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(Long)); + if (!rv) { + throw FatalErrorException("Balloc() failed to allocate memory"); + } + rv->k = k; + rv->maxwds = x; + } + rv->sign = rv->wds = 0; + return rv; +} + +static void Bfree(Bigint *v) +{ + if (v) { + Bigint **&freelist = s_bigint_data->freelist; + v->next = freelist[v->k]; + freelist[v->k] = v; + } +} + +#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ + y->wds*sizeof(Long) + 2*sizeof(int)) + +/* return value is only used as a simple string, so mis-aligned parts + * inside the Bigint are not at risk on strict align architectures + */ +static char * rv_alloc(int i) { + int j, k, *r; + + j = sizeof(ULong); + for(k = 0; + (int)(sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j) <= i; + j <<= 1) { + k++; + } + r = (int*)Balloc(k); + *r = k; + return (char *)(r+1); +} + + +static char * nrv_alloc(const char *s, char **rve, int n) +{ + char *rv, *t; + + t = rv = rv_alloc(n); + while((*t = *s++) !=0) { + t++; + } + if (rve) { + *rve = t; + } + return rv; +} + +static Bigint * multadd(Bigint *b, int m, int a) /* multiply by m and add a */ +{ + int i, wds; + ULong *x, y; +#ifdef Pack_32 + ULong xi, z; +#endif + Bigint *b1; + + wds = b->wds; + x = b->x; + i = 0; + do { +#ifdef Pack_32 + xi = *x; + y = (xi & 0xffff) * m + a; + z = (xi >> 16) * m + (y >> 16); + a = (int)(z >> 16); + *x++ = (z << 16) + (y & 0xffff); +#else + y = *x * m + a; + a = (int)(y >> 16); + *x++ = y & 0xffff; +#endif + } + while(++i < wds); + if (a) { + if (wds >= b->maxwds) { + b1 = Balloc(b->k+1); + Bcopy(b1, b); + Bfree(b); + b = b1; + } + b->x[wds++] = a; + b->wds = wds; + } + return b; +} + +static int hi0bits(ULong x) +{ + int k = 0; + + if (!(x & 0xffff0000)) { + k = 16; + x <<= 16; + } + if (!(x & 0xff000000)) { + k += 8; + x <<= 8; + } + if (!(x & 0xf0000000)) { + k += 4; + x <<= 4; + } + if (!(x & 0xc0000000)) { + k += 2; + x <<= 2; + } + if (!(x & 0x80000000)) { + k++; + if (!(x & 0x40000000)) { + return 32; + } + } + return k; +} + +static int lo0bits(ULong *y) +{ + int k; + ULong x = *y; + + if (x & 7) { + if (x & 1) { + return 0; + } + if (x & 2) { + *y = x >> 1; + return 1; + } + *y = x >> 2; + return 2; + } + k = 0; + if (!(x & 0xffff)) { + k = 16; + x >>= 16; + } + if (!(x & 0xff)) { + k += 8; + x >>= 8; + } + if (!(x & 0xf)) { + k += 4; + x >>= 4; + } + if (!(x & 0x3)) { + k += 2; + x >>= 2; + } + if (!(x & 1)) { + k++; + x >>= 1; + if (!(x & 1)) { + return 32; + } + } + *y = x; + return k; +} + +static Bigint * i2b(int i) +{ + Bigint *b; + + b = Balloc(1); + b->x[0] = i; + b->wds = 1; + return b; +} + +static Bigint * mult(Bigint *a, Bigint *b) +{ + Bigint *c; + int k, wa, wb, wc; + ULong carry, y, z; + ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0; +#ifdef Pack_32 + ULong z2; +#endif + + if (a->wds < b->wds) { + c = a; + a = b; + b = c; + } + k = a->k; + wa = a->wds; + wb = b->wds; + wc = wa + wb; + if (wc > a->maxwds) { + k++; + } + c = Balloc(k); + for(x = c->x, xa = x + wc; x < xa; x++) { + *x = 0; + } + xa = a->x; + xae = xa + wa; + xb = b->x; + xbe = xb + wb; + xc0 = c->x; +#ifdef Pack_32 + for(; xb < xbe; xb++, xc0++) { + if ((y = *xb & 0xffff)) { + x = xa; + xc = xc0; + carry = 0; + do { + z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; + carry = z >> 16; + z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; + carry = z2 >> 16; + Storeinc(xc, z2, z); + } + while(x < xae); + *xc = carry; + } + if ((y = *xb >> 16)) { + x = xa; + xc = xc0; + carry = 0; + z2 = *xc; + do { + z = (*x & 0xffff) * y + (*xc >> 16) + carry; + carry = z >> 16; + Storeinc(xc, z, z2); + z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; + carry = z2 >> 16; + } + while(x < xae); + *xc = z2; + } + } +#else + for(; xb < xbe; xc0++) { + if (y = *xb++) { + x = xa; + xc = xc0; + carry = 0; + do { + z = *x++ * y + *xc + carry; + carry = z >> 16; + *xc++ = z & 0xffff; + } + while(x < xae); + *xc = carry; + } + } +#endif + for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; + c->wds = wc; + return c; +} + +static Bigint * s2b (CONST char *s, int nd0, int nd, ULong y9) +{ + Bigint *b; + int i, k; + Long x, y; + + x = (nd + 8) / 9; + for(k = 0, y = 1; x > y; y <<= 1, k++) ; +#ifdef Pack_32 + b = Balloc(k); + b->x[0] = y9; + b->wds = 1; +#else + b = Balloc(k+1); + b->x[0] = y9 & 0xffff; + b->wds = (b->x[1] = y9 >> 16) ? 2 : 1; +#endif + + i = 9; + if (9 < nd0) { + s += 9; + do b = multadd(b, 10, *s++ - '0'); + while(++i < nd0); + s++; + } else { + s += 10; + } + for(; i < nd; i++) { + b = multadd(b, 10, *s++ - '0'); + } + return b; +} + +static Bigint * pow5mult(Bigint *b, int k) +{ + Bigint *b1, *p5, *p51; + int i; + static int p05[3] = { 5, 25, 125 }; + + Bigint *&p5s = s_bigint_data->p5s; + if ((i = k & 3)) { + b = multadd(b, p05[i-1], 0); + } + + if (!(k >>= 2)) { + return b; + } + if (!(p5 = p5s)) { + /* first time */ + p5 = p5s = i2b(625); + p5->next = 0; + } + for(;;) { + if (k & 1) { + b1 = mult(b, p5); + Bfree(b); + b = b1; + } + if (!(k >>= 1)) { + break; + } + if (!(p51 = p5->next)) { + if (!(p51 = p5->next)) { + p51 = p5->next = mult(p5,p5); + p51->next = 0; + } + } + p5 = p51; + } + return b; +} + + +static Bigint *lshift(Bigint *b, int k) +{ + int i, k1, n, n1; + Bigint *b1; + ULong *x, *x1, *xe, z; + +#ifdef Pack_32 + n = k >> 5; +#else + n = k >> 4; +#endif + k1 = b->k; + n1 = n + b->wds + 1; + for(i = b->maxwds; n1 > i; i <<= 1) { + k1++; + } + b1 = Balloc(k1); + x1 = b1->x; + for(i = 0; i < n; i++) { + *x1++ = 0; + } + x = b->x; + xe = x + b->wds; +#ifdef Pack_32 + if (k &= 0x1f) { + k1 = 32 - k; + z = 0; + do { + *x1++ = *x << k | z; + z = *x++ >> k1; + } + while(x < xe); + if ((*x1 = z)) { + ++n1; + } + } +#else + if (k &= 0xf) { + k1 = 16 - k; + z = 0; + do { + *x1++ = *x << k & 0xffff | z; + z = *x++ >> k1; + } + while(x < xe); + if (*x1 = z) { + ++n1; + } + } +#endif + else do + *x1++ = *x++; + while(x < xe); + b1->wds = n1 - 1; + Bfree(b); + return b1; +} + +static int cmp(Bigint *a, Bigint *b) +{ + ULong *xa, *xa0, *xb, *xb0; + int i, j; + + i = a->wds; + j = b->wds; + if (i -= j) + return i; + xa0 = a->x; + xa = xa0 + j; + xb0 = b->x; + xb = xb0 + j; + for(;;) { + if (*--xa != *--xb) + return *xa < *xb ? -1 : 1; + if (xa <= xa0) + break; + } + return 0; +} + + +static Bigint * diff(Bigint *a, Bigint *b) +{ + Bigint *c; + int i, wa, wb; + Long borrow, y; /* We need signed shifts here. */ + ULong *xa, *xae, *xb, *xbe, *xc; +#ifdef Pack_32 + Long z; +#endif + + i = cmp(a,b); + if (!i) { + c = Balloc(0); + c->wds = 1; + c->x[0] = 0; + return c; + } + if (i < 0) { + c = a; + a = b; + b = c; + i = 1; + } else { + i = 0; + } + c = Balloc(a->k); + c->sign = i; + wa = a->wds; + xa = a->x; + xae = xa + wa; + wb = b->wds; + xb = b->x; + xbe = xb + wb; + xc = c->x; + borrow = 0; +#ifdef Pack_32 + do { + y = (*xa & 0xffff) - (*xb & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*xa++ >> 16) - (*xb++ >> 16) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(xc, z, y); + } while(xb < xbe); + while(xa < xae) { + y = (*xa & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*xa++ >> 16) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(xc, z, y); + } +#else + do { + y = *xa++ - *xb++ + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *xc++ = y & 0xffff; + } while(xb < xbe); + while(xa < xae) { + y = *xa++ + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *xc++ = y & 0xffff; + } +#endif + while(!*--xc) { + wa--; + } + c->wds = wa; + return c; +} + +static double ulp (double _x) +{ + _double x; + register Long L; + _double a; + + value(x) = _x; + L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; +#ifndef Sudden_Underflow + if (L > 0) { +#endif +#ifdef IBM + L |= Exp_msk1 >> 4; +#endif + word0(a) = L; + word1(a) = 0; +#ifndef Sudden_Underflow + } + else { + L = -L >> Exp_shift; + if (L < Exp_shift) { + word0(a) = 0x80000 >> L; + word1(a) = 0; + } + else { + word0(a) = 0; + L -= Exp_shift; + word1(a) = L >= 31 ? 1 : 1 << (31 - L); + } + } +#endif + return value(a); +} + +static double +b2d +#ifdef KR_headers +(a, e) Bigint *a; int *e; +#else +(Bigint *a, int *e) +#endif +{ + ULong *xa, *xa0, w, y, z; + int k; + _double d; +#ifdef VAX + ULong d0, d1; +#else +#define d0 word0(d) +#define d1 word1(d) +#endif + + xa0 = a->x; + xa = xa0 + a->wds; + y = *--xa; + k = hi0bits(y); + *e = 32 - k; +#ifdef Pack_32 + if (k < Ebits) { + d0 = Exp_1 | y >> (Ebits - k); + w = xa > xa0 ? *--xa : 0; + d1 = y << ((32-Ebits) + k) | w >> (Ebits - k); + goto ret_d; + } + z = xa > xa0 ? *--xa : 0; + if (k -= Ebits) { + d0 = Exp_1 | y << k | z >> (32 - k); + y = xa > xa0 ? *--xa : 0; + d1 = z << k | y >> (32 - k); + } + else { + d0 = Exp_1 | y; + d1 = z; + } +#else + if (k < Ebits + 16) { + z = xa > xa0 ? *--xa : 0; + d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k; + w = xa > xa0 ? *--xa : 0; + y = xa > xa0 ? *--xa : 0; + d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k; + goto ret_d; + } + z = xa > xa0 ? *--xa : 0; + w = xa > xa0 ? *--xa : 0; + k -= Ebits + 16; + d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k; + y = xa > xa0 ? *--xa : 0; + d1 = w << k + 16 | y << k; +#endif +ret_d: +#ifdef VAX + word0(d) = d0 >> 16 | d0 << 16; + word1(d) = d1 >> 16 | d1 << 16; +#else +#undef d0 +#undef d1 +#endif + return value(d); +} + + +static Bigint * d2b(double _d, int *e, int *bits) +{ + Bigint *b; + int de, i, k; + ULong *x, y, z; + _double d; +#ifdef VAX + ULong d0, d1; +#endif + + value(d) = _d; +#ifdef VAX + d0 = word0(d) >> 16 | word0(d) << 16; + d1 = word1(d) >> 16 | word1(d) << 16; +#else +#define d0 word0(d) +#define d1 word1(d) +#endif + +#ifdef Pack_32 + b = Balloc(1); +#else + b = Balloc(2); +#endif + x = b->x; + + z = d0 & Frac_mask; + d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ +#ifdef Sudden_Underflow + de = (int)(d0 >> Exp_shift); +#ifndef IBM + z |= Exp_msk11; +#endif +#else + if ((de = (int)(d0 >> Exp_shift))) + z |= Exp_msk1; +#endif +#ifdef Pack_32 + if ((y = d1)) { + if ((k = lo0bits(&y))) { + x[0] = y | (z << (32 - k)); + z >>= k; + } else { + x[0] = y; + } + i = b->wds = (x[1] = z) ? 2 : 1; + } else { + k = lo0bits(&z); + x[0] = z; + i = b->wds = 1; + k += 32; + } +#else + if (y = d1) { + if (k = lo0bits(&y)) { + if (k >= 16) { + x[0] = y | z << 32 - k & 0xffff; + x[1] = z >> k - 16 & 0xffff; + x[2] = z >> k; + i = 2; + } else { + x[0] = y & 0xffff; + x[1] = y >> 16 | z << 16 - k & 0xffff; + x[2] = z >> k & 0xffff; + x[3] = z >> k+16; + i = 3; + } + } else { + x[0] = y & 0xffff; + x[1] = y >> 16; + x[2] = z & 0xffff; + x[3] = z >> 16; + i = 3; + } + } else { + k = lo0bits(&z); + if (k >= 16) { + x[0] = z; + i = 0; + } else { + x[0] = z & 0xffff; + x[1] = z >> 16; + i = 1; + } + k += 32; + } + while(!x[i]) + --i; + b->wds = i + 1; +#endif +#ifndef Sudden_Underflow + if (de) { +#endif +#ifdef IBM + *e = (de - Bias - (P-1) << 2) + k; + *bits = 4*P + 8 - k - hi0bits(word0(d) & Frac_mask); +#else + *e = de - Bias - (P-1) + k; + *bits = P - k; +#endif +#ifndef Sudden_Underflow + } else { + *e = de - Bias - (P-1) + 1 + k; +#ifdef Pack_32 + *bits = 32*i - hi0bits(x[i-1]); +#else + *bits = (i+2)*16 - hi0bits(x[i]); +#endif + } +#endif + return b; +} +#undef d0 +#undef d1 + + +static double ratio (Bigint *a, Bigint *b) +{ + _double da, db; + int k, ka, kb; + + value(da) = b2d(a, &ka); + value(db) = b2d(b, &kb); +#ifdef Pack_32 + k = ka - kb + 32*(a->wds - b->wds); +#else + k = ka - kb + 16*(a->wds - b->wds); +#endif +#ifdef IBM + if (k > 0) { + word0(da) += (k >> 2)*Exp_msk1; + if (k &= 3) { + da *= 1 << k; + } + } else { + k = -k; + word0(db) += (k >> 2)*Exp_msk1; + if (k &= 3) + db *= 1 << k; + } +#else + if (k > 0) { + word0(da) += k*Exp_msk1; + } else { + k = -k; + word0(db) += k*Exp_msk1; + } +#endif + return value(da) / value(db); +} + +static CONST double +tens[] = { + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, + 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + 1e20, 1e21, 1e22 +#ifdef VAX + , 1e23, 1e24 +#endif +}; + +#ifdef IEEE_Arith +static CONST double bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }; +static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, 1e-256 }; +#define n_bigtens 5 +#else +#ifdef IBM +static CONST double bigtens[] = { 1e16, 1e32, 1e64 }; +static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64 }; +#define n_bigtens 3 +#else +static CONST double bigtens[] = { 1e16, 1e32 }; +static CONST double tinytens[] = { 1e-16, 1e-32 }; +#define n_bigtens 2 +#endif +#endif + + +static int quorem(Bigint *b, Bigint *S) +{ + int n; + Long borrow, y; + ULong carry, q, ys; + ULong *bx, *bxe, *sx, *sxe; +#ifdef Pack_32 + Long z; + ULong si, zs; +#endif + + n = S->wds; + if (b->wds < n) + return 0; + sx = S->x; + sxe = sx + --n; + bx = b->x; + bxe = bx + n; + q = *bxe / (*sxe + 1); /* ensure q <= true quotient */ + if (q) { + borrow = 0; + carry = 0; + do { +#ifdef Pack_32 + si = *sx++; + ys = (si & 0xffff) * q + carry; + zs = (si >> 16) * q + (ys >> 16); + carry = zs >> 16; + y = (*bx & 0xffff) - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*bx >> 16) - (zs & 0xffff) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(bx, z, y); +#else + ys = *sx++ * q + carry; + carry = ys >> 16; + y = *bx - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *bx++ = y & 0xffff; +#endif + } + while(sx <= sxe); + if (!*bxe) { + bx = b->x; + while(--bxe > bx && !*bxe) + --n; + b->wds = n; + } + } + if (cmp(b, S) >= 0) { + q++; + borrow = 0; + carry = 0; + bx = b->x; + sx = S->x; + do { +#ifdef Pack_32 + si = *sx++; + ys = (si & 0xffff) + carry; + zs = (si >> 16) + (ys >> 16); + carry = zs >> 16; + y = (*bx & 0xffff) - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*bx >> 16) - (zs & 0xffff) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(bx, z, y); +#else + ys = *sx++ + carry; + carry = ys >> 16; + y = *bx - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *bx++ = y & 0xffff; +#endif + } + while(sx <= sxe); + bx = b->x; + bxe = bx + n; + if (!*bxe) { + while(--bxe > bx && !*bxe) + --n; + b->wds = n; + } + } + return q; +} + +void destroy_freelist(void) +{ + int i; + Bigint *tmp; + + Bigint **&freelist = s_bigint_data->freelist; + for (i = 0; i <= Kmax; i++) { + Bigint **listp = &freelist[i]; + while ((tmp = *listp) != NULL) { + *listp = tmp->next; + free(tmp); + } + freelist[i] = NULL; + } + +} + + +void zend_freedtoa(char *s) +{ + Bigint *b = (Bigint *)((int *)s - 1); + b->maxwds = 1 << (b->k = *(int*)b); + Bfree(b); +} + +/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. + * + * Inspired by "How to Print Floating-Point Numbers Accurately" by + * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 92-101]. + * + * Modifications: + * 1. Rather than iterating, we use a simple numeric overestimate + * to determine k = floor(log10(d)). We scale relevant + * quantities using O(log2(k)) rather than O(k) multiplications. + * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't + * try to generate digits strictly left to right. Instead, we + * compute with fewer bits and propagate the carry if necessary + * when rounding the final digit up. This is often faster. + * 3. Under the assumption that input will be rounded nearest, + * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. + * That is, we allow equality in stopping tests when the + * round-nearest rule will give the same floating-point value + * as would satisfaction of the stopping test with strict + * inequality. + * 4. We remove common factors of powers of 2 from relevant + * quantities. + * 5. When converting floating-point integers less than 1e16, + * we use floating-point arithmetic rather than resorting + * to multiple-precision integers. + * 6. When asked to produce fewer than 15 digits, we first try + * to get by with floating-point arithmetic; we resort to + * multiple-precision integer arithmetic only if we cannot + * guarantee that the floating-point calculation has given + * the correctly rounded result. For k requested digits and + * "uniformly" distributed input, the probability is + * something like 10^(k-15) that we must resort to the Long + * calculation. + */ + +char * zend_dtoa(double _d, int mode, int ndigits, int *decpt, int *sign, char **rve) +{ + /* Arguments ndigits, decpt, sign are similar to those + of ecvt and fcvt; trailing zeros are suppressed from + the returned string. If not null, *rve is set to point + to the end of the return value. If d is +-Infinity or NaN, + then *decpt is set to 9999. + + mode: + 0 ==> shortest string that yields d when read in + and rounded to nearest. + 1 ==> like 0, but with Steele & White stopping rule; + e.g. with IEEE P754 arithmetic , mode 0 gives + 1e23 whereas mode 1 gives 9.999999999999999e22. + 2 ==> max(1,ndigits) significant digits. This gives a + return value similar to that of ecvt, except + that trailing zeros are suppressed. + 3 ==> through ndigits past the decimal point. This + gives a return value similar to that from fcvt, + except that trailing zeros are suppressed, and + ndigits can be negative. + 4-9 should give the same return values as 2-3, i.e., + 4 <= mode <= 9 ==> same return as mode + 2 + (mode & 1). These modes are mainly for + debugging; often they run slower but sometimes + faster than modes 2-3. + 4,5,8,9 ==> left-to-right digit generation. + 6-9 ==> don't try fast floating-point estimate + (if applicable). + + Values of mode other than 0-9 are treated as mode 0. + + Sufficient space is allocated to the return value + to hold the suppressed trailing zeros. + */ + + int bbits, b2, b5, be, dig, i, ieps, ilim = 0, ilim0, ilim1 = 0, + j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, + spec_case = 0, try_quick; + Long L; +#ifndef Sudden_Underflow + int denorm; + ULong x; +#endif + Bigint *b, *b1, *delta, *mlo = 0, *mhi, *S, *tmp; + double ds; + char *s, *s0; + _double d, d2, eps; + + value(d) = _d; + + if (word0(d) & Sign_bit) { + /* set sign for everything, including 0's and NaNs */ + *sign = 1; + word0(d) &= ~Sign_bit; /* clear sign bit */ + } + else + *sign = 0; + +#if defined(IEEE_Arith) + defined(VAX) +#ifdef IEEE_Arith + if ((word0(d) & Exp_mask) == Exp_mask) +#else + if (word0(d) == 0x8000) +#endif + { + /* Infinity or NaN */ + *decpt = 9999; +#ifdef IEEE_Arith + if (!word1(d) && !(word0(d) & 0xfffff)) + return nrv_alloc("Infinity", rve, 8); +#endif + return nrv_alloc("NaN", rve, 3); + } +#endif +#ifdef IBM + value(d) += 0; /* normalize */ +#endif + if (!value(d)) { + *decpt = 1; + return nrv_alloc("0", rve, 1); + } + + b = d2b(value(d), &be, &bbits); +#ifdef Sudden_Underflow + i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); +#else + if ((i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) { +#endif + value(d2) = value(d); + word0(d2) &= Frac_mask1; + word0(d2) |= Exp_11; +#ifdef IBM + if (j = 11 - hi0bits(word0(d2) & Frac_mask)) + value(d2) /= 1 << j; +#endif + + /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 + * log10(x) = log(x) / log(10) + * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) + * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2) + * + * This suggests computing an approximation k to log10(d) by + * + * k = (i - Bias)*0.301029995663981 + * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); + * + * We want k to be too large rather than too small. + * The error in the first-order Taylor series approximation + * is in our favor, so we just round up the constant enough + * to compensate for any error in the multiplication of + * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, + * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, + * adding 1e-13 to the constant term more than suffices. + * Hence we adjust the constant term to 0.1760912590558. + * (We could get a more accurate k by invoking log10, + * but this is probably not worthwhile.) + */ + + i -= Bias; +#ifdef IBM + i <<= 2; + i += j; +#endif +#ifndef Sudden_Underflow + denorm = 0; + } + else { + /* d is denormalized */ + + i = bbits + be + (Bias + (P-1) - 1); + x = i > 32 ? (word0(d) << (64 - i)) | (word1(d) >> (i - 32)) + : (word1(d) << (32 - i)); + value(d2) = x; + word0(d2) -= 31*Exp_msk1; /* adjust exponent */ + i -= (Bias + (P-1) - 1) + 1; + denorm = 1; + } +#endif + ds = (value(d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; + k = (int)ds; + if (ds < 0. && ds != k) + k--; /* want k = floor(ds) */ + k_check = 1; + if (k >= 0 && k <= Ten_pmax) { + if (value(d) < tens[k]) + k--; + k_check = 0; + } + j = bbits - i - 1; + if (j >= 0) { + b2 = 0; + s2 = j; + } + else { + b2 = -j; + s2 = 0; + } + if (k >= 0) { + b5 = 0; + s5 = k; + s2 += k; + } + else { + b2 -= k; + b5 = -k; + s5 = 0; + } + if (mode < 0 || mode > 9) + mode = 0; + try_quick = 1; + if (mode > 5) { + mode -= 4; + try_quick = 0; + } + leftright = 1; + switch(mode) { + case 0: + case 1: + ilim = ilim1 = -1; + i = 18; + ndigits = 0; + break; + case 2: + leftright = 0; + /* no break */ + case 4: + if (ndigits <= 0) + ndigits = 1; + ilim = ilim1 = i = ndigits; + break; + case 3: + leftright = 0; + /* no break */ + case 5: + i = ndigits + k + 1; + ilim = i; + ilim1 = i - 1; + if (i <= 0) + i = 1; + } + s = s0 = rv_alloc(i); + + if (ilim >= 0 && ilim <= Quick_max && try_quick) { + + /* Try to get by with floating-point arithmetic. */ + + i = 0; + value(d2) = value(d); + k0 = k; + ilim0 = ilim; + ieps = 2; /* conservative */ + if (k > 0) { + ds = tens[k&0xf]; + j = k >> 4; + if (j & Bletch) { + /* prevent overflows */ + j &= Bletch - 1; + value(d) /= bigtens[n_bigtens-1]; + ieps++; + } + for(; j; j >>= 1, i++) + if (j & 1) { + ieps++; + ds *= bigtens[i]; + } + value(d) /= ds; + } + else if ((j1 = -k)) { + value(d) *= tens[j1 & 0xf]; + for(j = j1 >> 4; j; j >>= 1, i++) + if (j & 1) { + ieps++; + value(d) *= bigtens[i]; + } + } + if (k_check && value(d) < 1. && ilim > 0) { + if (ilim1 <= 0) + goto fast_failed; + ilim = ilim1; + k--; + value(d) *= 10.; + ieps++; + } + value(eps) = ieps*value(d) + 7.; + word0(eps) -= (P-1)*Exp_msk1; + if (ilim == 0) { + S = mhi = 0; + value(d) -= 5.; + if (value(d) > value(eps)) + goto one_digit; + if (value(d) < -value(eps)) + goto no_digits; + goto fast_failed; + } +#ifndef No_leftright + if (leftright) { + /* Use Steele & White method of only + * generating digits needed. + */ + value(eps) = 0.5/tens[ilim-1] - value(eps); + for(i = 0;;) { + L = (int32_t)value(d); + value(d) -= L; + *s++ = '0' + (int)L; + if (value(d) < value(eps)) + goto ret1; + if (1. - value(d) < value(eps)) + goto bump_up; + if (++i >= ilim) + break; + value(eps) *= 10.; + value(d) *= 10.; + } + } + else { +#endif + /* Generate ilim digits, then fix them up. */ + value(eps) *= tens[ilim-1]; + for(i = 1;; i++, value(d) *= 10.) { + L = (int32_t)value(d); + value(d) -= L; + *s++ = '0' + (int)L; + if (i == ilim) { + if (value(d) > 0.5 + value(eps)) + goto bump_up; + else if (value(d) < 0.5 - value(eps)) { + /* cut ALL traling zeros only if the number of chars is greater than precision + * otherwise cut only extra zeros + */ + if (k < ndigits) { + while(*--s == '0' && (s - s0) > k); + } else { + while(*--s == '0'); + } + s++; + goto ret1; + } + break; + } + } +#ifndef No_leftright + } +#endif +fast_failed: + s = s0; + value(d) = value(d2); + k = k0; + ilim = ilim0; + } + + /* Do we have a "small" integer? */ + + if (be >= 0 && k <= Int_max) { + /* Yes. */ + ds = tens[k]; + if (ndigits < 0 && ilim <= 0) { + S = mhi = 0; + if (ilim < 0 || value(d) <= 5*ds) + goto no_digits; + goto one_digit; + } + for(i = 1;; i++) { + L = (int32_t)(value(d) / ds); + value(d) -= L*ds; +#ifdef Check_FLT_ROUNDS + /* If FLT_ROUNDS == 2, L will usually be high by 1 */ + if (value(d) < 0) { + L--; + value(d) += ds; + } +#endif + *s++ = '0' + (int)L; + if (i == ilim) { + value(d) += value(d); + if (value(d) > ds || (value(d) == ds && (L & 1))) { +bump_up: + while(*--s == '9') + if (s == s0) { + k++; + *s = '0'; + break; + } + ++*s++; + } + break; + } + if (!(value(d) *= 10.)) + break; + } + goto ret1; + } + + m2 = b2; + m5 = b5; + mhi = mlo = 0; + if (leftright) { + if (mode < 2) { + i = +#ifndef Sudden_Underflow + denorm ? be + (Bias + (P-1) - 1 + 1) : +#endif +#ifdef IBM + 1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3); +#else + 1 + P - bbits; +#endif + } + else { + j = ilim - 1; + if (m5 >= j) + m5 -= j; + else { + s5 += j -= m5; + b5 += j; + m5 = 0; + } + if ((i = ilim) < 0) { + m2 -= i; + i = 0; + } + } + b2 += i; + s2 += i; + mhi = i2b(1); + } + if (m2 > 0 && s2 > 0) { + i = m2 < s2 ? m2 : s2; + b2 -= i; + m2 -= i; + s2 -= i; + } + if (b5 > 0) { + if (leftright) { + if (m5 > 0) { + mhi = pow5mult(mhi, m5); + b1 = mult(mhi, b); + Bfree(b); + b = b1; + } + if ((j = b5 - m5)) { + b = pow5mult(b, j); + } + } else { + b = pow5mult(b, b5); + } + } + S = i2b(1); + if (s5 > 0) + S = pow5mult(S, s5); + /* Check for special case that d is a normalized power of 2. */ + + if (mode < 2) { + if (!word1(d) && !(word0(d) & Bndry_mask) +#ifndef Sudden_Underflow + && word0(d) & Exp_mask +#endif + ) { + /* The special case */ + b2 += Log2P; + s2 += Log2P; + spec_case = 1; + } else { + spec_case = 0; + } + } + + /* Arrange for convenient computation of quotients: + * shift left if necessary so divisor has 4 leading 0 bits. + * + * Perhaps we should just compute leading 28 bits of S once + * and for all and pass them and a shift to quorem, so it + * can do shifts and ors to compute the numerator for q. + */ +#ifdef Pack_32 + if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f)) + i = 32 - i; +#else + if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf)) + i = 16 - i; +#endif + if (i > 4) { + i -= 4; + b2 += i; + m2 += i; + s2 += i; + } + else if (i < 4) { + i += 28; + b2 += i; + m2 += i; + s2 += i; + } + if (b2 > 0) + b = lshift(b, b2); + if (s2 > 0) + S = lshift(S, s2); + if (k_check) { + if (cmp(b,S) < 0) { + k--; + b = multadd(b, 10, 0); /* we botched the k estimate */ + if (leftright) + mhi = multadd(mhi, 10, 0); + ilim = ilim1; + } + } + if (ilim <= 0 && mode > 2) { + if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) { + /* no digits, fcvt style */ +no_digits: + k = -1 - ndigits; + goto ret; + } +one_digit: + *s++ = '1'; + k++; + goto ret; + } + if (leftright) { + if (m2 > 0) + mhi = lshift(mhi, m2); + + /* Compute mlo -- check for special case + * that d is a normalized power of 2. + */ + + mlo = mhi; + if (spec_case) { + mhi = Balloc(mhi->k); + Bcopy(mhi, mlo); + mhi = lshift(mhi, Log2P); + } + + for(i = 1;;i++) { + dig = quorem(b,S) + '0'; + /* Do we yet have the shortest decimal string + * that will round to d? + */ + j = cmp(b, mlo); + delta = diff(S, mhi); + j1 = delta->sign ? 1 : cmp(b, delta); + Bfree(delta); +#ifndef ROUND_BIASED + if (j1 == 0 && !mode && !(word1(d) & 1)) { + if (dig == '9') + goto round_9_up; + if (j > 0) + dig++; + *s++ = dig; + goto ret; + } +#endif + if (j < 0 || (j == 0 && !mode +#ifndef ROUND_BIASED + && !(word1(d) & 1) +#endif + )) { + if (j1 > 0) { + b = lshift(b, 1); + j1 = cmp(b, S); + if ((j1 > 0 || (j1 == 0 && (dig & 1))) + && dig++ == '9') + goto round_9_up; + } + *s++ = dig; + goto ret; + } + if (j1 > 0) { + if (dig == '9') { /* possible if i == 1 */ +round_9_up: + *s++ = '9'; + goto roundoff; + } + *s++ = dig + 1; + goto ret; + } + *s++ = dig; + if (i == ilim) + break; + b = multadd(b, 10, 0); + if (mlo == mhi) + mlo = mhi = multadd(mhi, 10, 0); + else { + mlo = multadd(mlo, 10, 0); + mhi = multadd(mhi, 10, 0); + } + } + } + else + for(i = 1;; i++) { + *s++ = dig = quorem(b,S) + '0'; + if (i >= ilim) + break; + b = multadd(b, 10, 0); + } + + /* Round off last digit */ + + b = lshift(b, 1); + j = cmp(b, S); + if (j > 0 || (j == 0 && (dig & 1))) { +roundoff: + while(*--s == '9') + if (s == s0) { + k++; + *s++ = '1'; + goto ret; + } + ++*s++; + } + else { + while(*--s == '0'); + s++; + } +ret: + Bfree(S); + if (mhi) { + if (mlo && mlo != mhi) + Bfree(mlo); + Bfree(mhi); + } +ret1: + + { + Bigint *&p5s = s_bigint_data->p5s; + while (p5s) { + tmp = p5s; + p5s = p5s->next; + free(tmp); + } + } + + Bfree(b); + + if (s == s0) { /* don't return empty string */ + *s++ = '0'; + k = 0; + } + *s = 0; + *decpt = k + 1; + if (rve) + *rve = s; + return s0; +} + +double zend_strtod (CONST char *s00, char **se) +{ + int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, + e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; + CONST char *s, *s0, *s1; + double aadj, aadj1, adj; + _double rv, rv0; + Long L; + ULong y, z; + Bigint *bb = 0, *bb1, *bd = 0, *bd0, *bs = 0, *delta = 0, *tmp; + double result; + + CONST char decimal_point = '.'; + + sign = nz0 = nz = 0; + value(rv) = 0.; + + + for(s = s00; isspace((unsigned char) *s); s++) + ; + + if (*s == '-') { + sign = 1; + s++; + } else if (*s == '+') { + s++; + } + + if (*s == '\0') { + s = s00; + goto ret; + } + + if (*s == '0') { + nz0 = 1; + while(*++s == '0') ; + if (!*s) + goto ret; + } + s0 = s; + y = z = 0; + for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) + if (nd < 9) + y = 10*y + c - '0'; + else if (nd < 16) + z = 10*z + c - '0'; + nd0 = nd; + if (c == decimal_point) { + c = *++s; + if (!nd) { + for(; c == '0'; c = *++s) + nz++; + if (c > '0' && c <= '9') { + s0 = s; + nf += nz; + nz = 0; + goto have_dig; + } + goto dig_done; + } + for(; c >= '0' && c <= '9'; c = *++s) { +have_dig: + nz++; + if (c -= '0') { + nf += nz; + for(i = 1; i < nz; i++) + if (nd++ < 9) + y *= 10; + else if (nd <= DBL_DIG + 1) + z *= 10; + if (nd++ < 9) + y = 10*y + c; + else if (nd <= DBL_DIG + 1) + z = 10*z + c; + nz = 0; + } + } + } +dig_done: + e = 0; + if (c == 'e' || c == 'E') { + if (!nd && !nz && !nz0) { + s = s00; + goto ret; + } + s00 = s; + esign = 0; + switch(c = *++s) { + case '-': + esign = 1; + case '+': + c = *++s; + } + if (c >= '0' && c <= '9') { + while(c == '0') + c = *++s; + if (c > '0' && c <= '9') { + L = c - '0'; + s1 = s; + while((c = *++s) >= '0' && c <= '9') + L = 10*L + c - '0'; + if (s - s1 > 8 || L > 19999) + /* Avoid confusion from exponents + * so large that e might overflow. + */ + e = 19999; /* safe for 16 bit ints */ + else + e = (int)L; + if (esign) + e = -e; + } + else + e = 0; + } + else + s = s00; + } + if (!nd) { + if (!nz && !nz0) + s = s00; + goto ret; + } + e1 = e -= nf; + + /* Now we have nd0 digits, starting at s0, followed by a + * decimal point, followed by nd-nd0 digits. The number we're + * after is the integer represented by those digits times + * 10**e */ + + if (!nd0) + nd0 = nd; + k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; + value(rv) = y; + if (k > 9) + value(rv) = tens[k - 9] * value(rv) + z; + bd0 = 0; + if (nd <= DBL_DIG +#ifndef RND_PRODQUOT + && FLT_ROUNDS == 1 +#endif + ) { + if (!e) + goto ret; + if (e > 0) { + if (e <= Ten_pmax) { +#ifdef VAX + goto vax_ovfl_check; +#else + /* value(rv) = */ rounded_product(value(rv), + tens[e]); + goto ret; +#endif + } + i = DBL_DIG - nd; + if (e <= Ten_pmax + i) { + /* A fancier test would sometimes let us do + * this for larger i values. + */ + e -= i; + value(rv) *= tens[i]; +#ifdef VAX + /* VAX exponent range is so narrow we must + * worry about overflow here... + */ +vax_ovfl_check: + word0(rv) -= P*Exp_msk1; + /* value(rv) = */ rounded_product(value(rv), + tens[e]); + if ((word0(rv) & Exp_mask) + > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) + goto ovfl; + word0(rv) += P*Exp_msk1; +#else + /* value(rv) = */ rounded_product(value(rv), + tens[e]); +#endif + goto ret; + } + } +#ifndef Inaccurate_Divide + else if (e >= -Ten_pmax) { + /* value(rv) = */ rounded_quotient(value(rv), + tens[-e]); + goto ret; + } +#endif + } + e1 += nd - k; + + /* Get starting approximation = rv * 10**e1 */ + + if (e1 > 0) { + if ((i = e1 & 15)) + value(rv) *= tens[i]; + if (e1 &= ~15) { + if (e1 > DBL_MAX_10_EXP) { +ovfl: + errno = ERANGE; +#ifndef Bad_float_h + value(rv) = HUGE_VAL; +#else + /* Can't trust HUGE_VAL */ +#ifdef IEEE_Arith + word0(rv) = Exp_mask; + word1(rv) = 0; +#else + word0(rv) = Big0; + word1(rv) = Big1; +#endif +#endif + if (bd0) + goto retfree; + goto ret; + } + if (e1 >>= 4) { + for(j = 0; e1 > 1; j++, e1 >>= 1) + if (e1 & 1) + value(rv) *= bigtens[j]; + /* The last multiplication could overflow. */ + word0(rv) -= P*Exp_msk1; + value(rv) *= bigtens[j]; + if ((z = word0(rv) & Exp_mask) + > Exp_msk1*(DBL_MAX_EXP+Bias-P)) + goto ovfl; + if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) { + /* set to largest number */ + /* (Can't trust DBL_MAX) */ + word0(rv) = Big0; + word1(rv) = Big1; + } + else + word0(rv) += P*Exp_msk1; + } + + } + } + else if (e1 < 0) { + e1 = -e1; + if ((i = e1 & 15)) + value(rv) /= tens[i]; + if (e1 &= ~15) { + e1 >>= 4; + if (e1 >= 1 << n_bigtens) + goto undfl; + for(j = 0; e1 > 1; j++, e1 >>= 1) + if (e1 & 1) + value(rv) *= tinytens[j]; + /* The last multiplication could underflow. */ + value(rv0) = value(rv); + value(rv) *= tinytens[j]; + if (!value(rv)) { + value(rv) = 2.*value(rv0); + value(rv) *= tinytens[j]; + if (!value(rv)) { +undfl: + value(rv) = 0.; + errno = ERANGE; + if (bd0) + goto retfree; + goto ret; + } + word0(rv) = Tiny0; + word1(rv) = Tiny1; + /* The refinement below will clean + * this approximation up. + */ + } + } + } + + /* Now the hard part -- adjusting rv to the correct value.*/ + + /* Put digits into bd: true value = bd * 10^e */ + + bd0 = s2b(s0, nd0, nd, y); + + for(;;) { + bd = Balloc(bd0->k); + Bcopy(bd, bd0); + bb = d2b(value(rv), &bbe, &bbbits); /* rv = bb * 2^bbe */ + bs = i2b(1); + + if (e >= 0) { + bb2 = bb5 = 0; + bd2 = bd5 = e; + } + else { + bb2 = bb5 = -e; + bd2 = bd5 = 0; + } + if (bbe >= 0) + bb2 += bbe; + else + bd2 -= bbe; + bs2 = bb2; +#ifdef Sudden_Underflow +#ifdef IBM + j = 1 + 4*P - 3 - bbbits + ((bbe + bbbits - 1) & 3); +#else + j = P + 1 - bbbits; +#endif +#else + i = bbe + bbbits - 1; /* logb(rv) */ + if (i < Emin) /* denormal */ + j = bbe + (P-Emin); + else + j = P + 1 - bbbits; +#endif + bb2 += j; + bd2 += j; + i = bb2 < bd2 ? bb2 : bd2; + if (i > bs2) + i = bs2; + if (i > 0) { + bb2 -= i; + bd2 -= i; + bs2 -= i; + } + if (bb5 > 0) { + bs = pow5mult(bs, bb5); + bb1 = mult(bs, bb); + Bfree(bb); + bb = bb1; + } + if (bb2 > 0) + bb = lshift(bb, bb2); + if (bd5 > 0) + bd = pow5mult(bd, bd5); + if (bd2 > 0) + bd = lshift(bd, bd2); + if (bs2 > 0) + bs = lshift(bs, bs2); + delta = diff(bb, bd); + dsign = delta->sign; + delta->sign = 0; + i = cmp(delta, bs); + if (i < 0) { + /* Error is less than half an ulp -- check for + * special case of mantissa a power of two. + */ + if (dsign || word1(rv) || word0(rv) & Bndry_mask) + break; + delta = lshift(delta,Log2P); + if (cmp(delta, bs) > 0) + goto drop_down; + break; + } + if (i == 0) { + /* exactly half-way between */ + if (dsign) { + if ((word0(rv) & Bndry_mask1) == Bndry_mask1 + && word1(rv) == 0xffffffff) { + /*boundary case -- increment exponent*/ + word0(rv) = (word0(rv) & Exp_mask) + + Exp_msk1 +#ifdef IBM + | Exp_msk1 >> 4 +#endif + ; + word1(rv) = 0; + break; + } + } + else if (!(word0(rv) & Bndry_mask) && !word1(rv)) { +drop_down: + /* boundary case -- decrement exponent */ +#ifdef Sudden_Underflow + L = word0(rv) & Exp_mask; +#ifdef IBM + if (L < Exp_msk1) +#else + if (L <= Exp_msk1) +#endif + goto undfl; + L -= Exp_msk1; +#else + L = (word0(rv) & Exp_mask) - Exp_msk1; +#endif + word0(rv) = L | Bndry_mask1; + word1(rv) = 0xffffffff; +#ifdef IBM + goto cont; +#else + break; +#endif + } +#ifndef ROUND_BIASED + if (!(word1(rv) & LSB)) + break; +#endif + if (dsign) + value(rv) += ulp(value(rv)); +#ifndef ROUND_BIASED + else { + value(rv) -= ulp(value(rv)); +#ifndef Sudden_Underflow + if (!value(rv)) + goto undfl; +#endif + } +#endif + break; + } + if ((aadj = ratio(delta, bs)) <= 2.) { + if (dsign) + aadj = aadj1 = 1.; + else if (word1(rv) || word0(rv) & Bndry_mask) { +#ifndef Sudden_Underflow + if (word1(rv) == Tiny1 && !word0(rv)) + goto undfl; +#endif + aadj = 1.; + aadj1 = -1.; + } + else { + /* special case -- power of FLT_RADIX to be */ + /* rounded down... */ + + if (aadj < 2./FLT_RADIX) + aadj = 1./FLT_RADIX; + else + aadj *= 0.5; + aadj1 = -aadj; + } + } + else { + aadj *= 0.5; + aadj1 = dsign ? aadj : -aadj; +#ifdef Check_FLT_ROUNDS + switch(FLT_ROUNDS) { + case 2: /* towards +infinity */ + aadj1 -= 0.5; + break; + case 0: /* towards 0 */ + case 3: /* towards -infinity */ + aadj1 += 0.5; + } +#else + if (FLT_ROUNDS == 0) + aadj1 += 0.5; +#endif + } + y = word0(rv) & Exp_mask; + + /* Check for overflow */ + + if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) { + value(rv0) = value(rv); + word0(rv) -= P*Exp_msk1; + adj = aadj1 * ulp(value(rv)); + value(rv) += adj; + if ((word0(rv) & Exp_mask) >= + Exp_msk1*(DBL_MAX_EXP+Bias-P)) { + if (word0(rv0) == Big0 && word1(rv0) == Big1) + goto ovfl; + word0(rv) = Big0; + word1(rv) = Big1; + goto cont; + } + else + word0(rv) += P*Exp_msk1; + } + else { +#ifdef Sudden_Underflow + if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { + value(rv0) = value(rv); + word0(rv) += P*Exp_msk1; + adj = aadj1 * ulp(value(rv)); + value(rv) += adj; +#ifdef IBM + if ((word0(rv) & Exp_mask) < P*Exp_msk1) +#else + if ((word0(rv) & Exp_mask) <= P*Exp_msk1) +#endif + { + if (word0(rv0) == Tiny0 + && word1(rv0) == Tiny1) + goto undfl; + word0(rv) = Tiny0; + word1(rv) = Tiny1; + goto cont; + } + else + word0(rv) -= P*Exp_msk1; + } + else { + adj = aadj1 * ulp(value(rv)); + value(rv) += adj; + } +#else + /* Compute adj so that the IEEE rounding rules will + * correctly round rv + adj in some half-way cases. + * If rv * ulp(rv) is denormalized (i.e., + * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid + * trouble from bits lost to denormalization; + * example: 1.2e-307 . + */ + if (y <= (P-1)*Exp_msk1 && aadj >= 1.) { + aadj1 = (double)(int)(aadj + 0.5); + if (!dsign) + aadj1 = -aadj1; + } + adj = aadj1 * ulp(value(rv)); + value(rv) += adj; +#endif + } + z = word0(rv) & Exp_mask; + if (y == z) { + /* Can we stop now? */ + L = (int32_t)aadj; + aadj -= L; + /* The tolerances below are conservative. */ + if (dsign || word1(rv) || word0(rv) & Bndry_mask) { + if (aadj < .4999999 || aadj > .5000001) + break; + } + else if (aadj < .4999999/FLT_RADIX) + break; + } +cont: + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(delta); + } +retfree: + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(bd0); + Bfree(delta); +ret: + if (se) + *se = (char *)s; + result = sign ? -value(rv) : value(rv); + + Bigint *&p5s = s_bigint_data->p5s; + while (p5s) { + tmp = p5s; + p5s = p5s->next; + free(tmp); + } + + return result; +} + +double zend_hex_strtod(const char *str, char **endptr) +{ + const char *s = str; + char c; + int any = 0; + double value = 0; + + if (*s == '0' && (s[1] == 'x' || s[1] == 'X')) { + s += 2; + } + + while ((c = *s++)) { + if (c >= '0' && c <= '9') { + c -= '0'; + } else if (c >= 'A' && c <= 'F') { + c -= 'A' - 10; + } else if (c >= 'a' && c <= 'f') { + c -= 'a' - 10; + } else { + break; + } + + any = 1; + value = value * 16 + c; + } + + if (endptr != NULL) { + *endptr = (char *)(any ? s - 1 : str); + } + + return value; +} + +double zend_oct_strtod(const char *str, char **endptr) +{ + const char *s = str; + char c; + double value = 0; + int any = 0; + + /* skip leading zero */ + s++; + + while ((c = *s++)) { + if (c > '7') { + /* break and return the current value if the number is not well-formed + * that's what Linux strtol() does + */ + break; + } + value = value * 8 + c - '0'; + any = 1; + } + + if (endptr != NULL) { + *endptr = (char *)(any ? s - 1 : str); + } + + return value; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_strtod.h b/src/cpp/base/zend/zend_strtod.h new file mode 100644 index 0000000000000..6253d5cc94212 --- /dev/null +++ b/src/cpp/base/zend/zend_strtod.h @@ -0,0 +1,38 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_STRTOD_H__ +#define __HPHP_ZEND_STRTOD_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +void zend_freedtoa(char *s); +char * zend_dtoa(double _d, int mode, int ndigits, int *decpt, int *sign, + char **rve); +double zend_strtod(const char *s00, char **se); +double zend_hex_strtod(const char *str, char **endptr); +double zend_oct_strtod(const char *str, char **endptr); +int zend_startup_strtod(void); +int zend_shutdown_strtod(void); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_STRTOD_H__ diff --git a/src/cpp/base/zend/zend_url.cpp b/src/cpp/base/zend/zend_url.cpp new file mode 100644 index 0000000000000..a7306e9a643eb --- /dev/null +++ b/src/cpp/base/zend/zend_url.cpp @@ -0,0 +1,466 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static char *replace_controlchars(char *str, int len) { + unsigned char *s = (unsigned char *)str; + unsigned char *e = (unsigned char *)str + len; + + if (!str) { + return (NULL); + } + + while (s < e) { + if (iscntrl(*s)) { + *s='_'; + } + s++; + } + + return (str); +} + +Url::~Url() { + if (scheme) free(scheme); + if (user) free(user); + if (pass) free(pass); + if (host) free(host); + if (path) free(path); + if (query) free(query); + if (fragment) free(fragment); +} + +bool url_parse(Url &output, const char *str, int length) { + memset(&output, 0, sizeof(Url)); + + char port_buf[6]; + const char *s, *e, *p, *pp, *ue; + + s = str; + ue = s + length; + + /* parse scheme */ + if ((e = (const char *)memchr((const void *)s, ':', length)) && (e - s)) { + /* validate scheme */ + p = s; + while (p < e) { + /* scheme = 1*[ lowalpha | digit | "+" | "-" | "." ] */ + if (!isalpha(*p) && !isdigit(*p) && + *p != '+' && *p != '.' && *p != '-') { + if (e + 1 < ue) { + goto parse_port; + } else { + goto just_path; + } + } + p++; + } + + if (*(e + 1) == '\0') { /* only scheme is available */ + output.scheme = string_duplicate(s, (e - s)); + replace_controlchars(output.scheme, (e - s)); + goto end; + } + + /* + * certain schemas like mailto: and zlib: may not have any / after them + * this check ensures we support those. + */ + if (*(e+1) != '/') { + /* check if the data we get is a port this allows us to + * correctly parse things like a.com:80 + */ + p = e + 1; + while (isdigit(*p)) { + p++; + } + + if ((*p == '\0' || *p == '/') && (p - e) < 7) { + goto parse_port; + } + + output.scheme = string_duplicate(s, (e-s)); + replace_controlchars(output.scheme, (e - s)); + + length -= ++e - s; + s = e; + goto just_path; + } else { + output.scheme = string_duplicate(s, (e-s)); + replace_controlchars(output.scheme, (e - s)); + + if (*(e+2) == '/') { + s = e + 3; + if (!strncasecmp("file", output.scheme, sizeof("file"))) { + if (*(e + 3) == '/') { + /* support windows drive letters as in: + file:///c:/somedir/file.txt + */ + if (*(e + 5) == ':') { + s = e + 4; + } + goto nohost; + } + } + } else { + if (!strncasecmp("file", output.scheme, sizeof("file"))) { + s = e + 1; + goto nohost; + } else { + length -= ++e - s; + s = e; + goto just_path; + } + } + } + } else if (e) { /* no scheme, look for port */ + parse_port: + p = e + 1; + pp = p; + + while (pp-p < 6 && isdigit(*pp)) { + pp++; + } + + if (pp-p < 6 && (*pp == '/' || *pp == '\0')) { + memcpy(port_buf, p, (pp-p)); + port_buf[pp-p] = '\0'; + output.port = atoi(port_buf); + } else { + goto just_path; + } + } else { + just_path: + ue = s + length; + goto nohost; + } + + e = ue; + + if (!(p = (const char *)memchr(s, '/', (ue - s)))) { + if ((p = (const char *)memchr(s, '?', (ue - s)))) { + e = p; + } else if ((p = (const char *)memchr(s, '#', (ue - s)))) { + e = p; + } + } else { + e = p; + } + + /* check for login and password */ + if ((p = (const char *)memrchr(s, '@', (e-s)))) { + if ((pp = (const char *)memchr(s, ':', (p-s)))) { + if ((pp-s) > 0) { + output.user = string_duplicate(s, (pp-s)); + replace_controlchars(output.user, (pp - s)); + } + + pp++; + if (p-pp > 0) { + output.pass = string_duplicate(pp, (p-pp)); + replace_controlchars(output.pass, (p-pp)); + } + } else { + output.user = string_duplicate(s, (p-s)); + replace_controlchars(output.user, (p-s)); + } + + s = p + 1; + } + + /* check for port */ + if (*s == '[' && *(e-1) == ']') { + /* Short circuit portscan, + we're dealing with an + IPv6 embedded address */ + p = s; + } else { + /* memrchr is a GNU specific extension + Emulate for wide compatability */ + for(p = e; *p != ':' && p >= s; p--); + } + + if (p >= s && *p == ':') { + if (!output.port) { + p++; + if (e-p > 5) { /* port cannot be longer then 5 characters */ + return false; + } else if (e - p > 0) { + memcpy(port_buf, p, (e-p)); + port_buf[e-p] = '\0'; + output.port = atoi(port_buf); + } + p--; + } + } else { + p = e; + } + + /* check if we have a valid host, if we don't reject the string as url */ + if ((p-s) < 1) { + return false; + } + + output.host = string_duplicate(s, (p-s)); + replace_controlchars(output.host, (p - s)); + + if (e == ue) { + return true; + } + + s = e; + + nohost: + + if ((p = (const char *)memchr(s, '?', (ue - s)))) { + pp = strchr(s, '#'); + + if (pp && pp < p) { + p = pp; + pp = strchr(pp+2, '#'); + } + + if (p - s) { + output.path = string_duplicate(s, (p-s)); + replace_controlchars(output.path, (p - s)); + } + + if (pp) { + if (pp - ++p) { + output.query = string_duplicate(p, (pp-p)); + replace_controlchars(output.query, (pp - p)); + } + p = pp; + goto label_parse; + } else if (++p - ue) { + output.query = string_duplicate(p, (ue-p)); + replace_controlchars(output.query, (ue - p)); + } + } else if ((p = (const char *)memchr(s, '#', (ue - s)))) { + if (p - s) { + output.path = string_duplicate(s, (p-s)); + replace_controlchars(output.path, (p - s)); + } + + label_parse: + p++; + + if (ue - p) { + output.fragment = string_duplicate(p, (ue-p)); + replace_controlchars(output.fragment, (ue - p)); + } + } else { + output.path = string_duplicate(s, (ue-s)); + replace_controlchars(output.path, (ue - s)); + } +end: + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +static int php_htoi(char *s) { + int value; + int c; + + c = ((unsigned char *)s)[0]; + if (isupper(c)) + c = tolower(c); + value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16; + + c = ((unsigned char *)s)[1]; + if (isupper(c)) + c = tolower(c); + value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10; + + return (value); +} + +/* rfc1738: + + ...The characters ";", + "/", "?", ":", "@", "=" and "&" are the characters which may be + reserved for special meaning within a scheme... + + ...Thus, only alphanumerics, the special characters "$-_.+!*'(),", and + reserved characters used for their reserved purposes may be used + unencoded within a URL... + + For added safety, we only leave -_. unencoded. + */ + +static unsigned char hexchars[] = "0123456789ABCDEF"; + +char *url_encode(const char *s, int &len) { + register unsigned char c; + unsigned char *to, *start; + unsigned char const *from, *end; + + from = (unsigned char const *)s; + end = (unsigned char const *)s + len; + start = to = (unsigned char *)malloc(3 * len + 1); + + while (from < end) { + c = *from++; + + if (c == ' ') { + *to++ = '+'; + } else if ((c < '0' && c != '-' && c != '.') || + (c < 'A' && c > '9') || + (c > 'Z' && c < 'a' && c != '_') || + (c > 'z')) { + to[0] = '%'; + to[1] = hexchars[c >> 4]; + to[2] = hexchars[c & 15]; + to += 3; + } else { + *to++ = c; + } + } + *to = 0; + len = to - start; + return (char *) start; +} + +char *url_decode(const char *s, int &len) { + char *str = string_duplicate(s, len); + char *dest = str; + char *data = str; + + while (len--) { + if (*data == '+') { + *dest = ' '; + } + else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) + && isxdigit((int) *(data + 2))) { + *dest = (char) php_htoi(data + 1); + data += 2; + len -= 2; + } else { + *dest = *data; + } + data++; + dest++; + } + *dest = '\0'; + len = dest - str; + return str; +} + +// copied and re-factored from clearsilver-0.10.5/cgi/cgi.c +int url_decode(char *value) { + ASSERT(value && *value); // check before calling this function + + int i = 0, o = 0; + unsigned char *s = (unsigned char *)value; + + while (s[i]) { + if (s[i] == '+') { + s[o++] = ' '; + i++; + } else if (s[i] == '%' && isxdigit(s[i+1]) && isxdigit(s[i+2])) { + char num; + num = (s[i+1] >= 'A') ? ((s[i+1] & 0xdf) - 'A') + 10 : (s[i+1] - '0'); + num *= 16; + num += (s[i+2] >= 'A') ? ((s[i+2] & 0xdf) - 'A') + 10 : (s[i+2] - '0'); + s[o++] = num; + i+=3; + } else { + s[o++] = s[i++]; + } + } + if (i && o) s[o] = '\0'; + return o; +} + +int url_decode_ex(char *value, int len) { + ASSERT(value && *value); // check before calling this function + ASSERT(len >= 0); + if (len <= 0) return 0; + + int i = 0, o = 0; + unsigned char *s = (unsigned char *)value; + unsigned char *end = s + len; + while (s + i < end) { + if (s[i] == '+') { + s[o++] = ' '; + i++; + } else if (s[i] == '%' && isxdigit(s[i+1]) && isxdigit(s[i+2])) { + char num; + num = (s[i+1] >= 'A') ? ((s[i+1] & 0xdf) - 'A') + 10 : (s[i+1] - '0'); + num *= 16; + num += (s[i+2] >= 'A') ? ((s[i+2] & 0xdf) - 'A') + 10 : (s[i+2] - '0'); + s[o++] = num; + i+=3; + } else { + s[o++] = s[i++]; + } + } + if (i && o) s[o] = '\0'; + return o; +} + +char *url_raw_encode(const char *s, int &len) { + register int x, y; + unsigned char *str; + + str = (unsigned char *)malloc(3 * len + 1); + for (x = 0, y = 0; len--; x++, y++) { + str[y] = (unsigned char) s[x]; + if ((str[y] < '0' && str[y] != '-' && str[y] != '.') || + (str[y] < 'A' && str[y] > '9') || + (str[y] > 'Z' && str[y] < 'a' && str[y] != '_') || + (str[y] > 'z')) { + str[y++] = '%'; + str[y++] = hexchars[(unsigned char) s[x] >> 4]; + str[y] = hexchars[(unsigned char) s[x] & 15]; + } + } + str[y] = '\0'; + len = y; + return ((char *)str); +} + +char *url_raw_decode(const char *s, int &len) { + char *str = string_duplicate(s, len); + char *dest = str; + char *data = str; + + while (len--) { + if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) + && isxdigit((int) *(data + 2))) { + *dest = (char) php_htoi(data + 1); + data += 2; + len -= 2; + } else { + *dest = *data; + } + data++; + dest++; + } + *dest = '\0'; + len = dest - str; + return str; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/base/zend/zend_url.h b/src/cpp/base/zend/zend_url.h new file mode 100644 index 0000000000000..640ae18f02472 --- /dev/null +++ b/src/cpp/base/zend/zend_url.h @@ -0,0 +1,58 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1998-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_ZEND_URL_H__ +#define __HPHP_ZEND_URL_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Helper struct storing parsed result from url_parse(). + */ +class Url { +public: + ~Url(); + + char *scheme; + char *user; + char *pass; + char *host; + unsigned short port; + char *path; + char *query; + char *fragment; +}; + +bool url_parse(Url &output, const char *str, int length); + +/** + * raw_ versions ignore "+" or " ". + */ +char *url_encode(const char *s, int &len); +char *url_decode(const char *s, int &len); +int url_decode(char *value); // in-place version, also assuming C-string +int url_decode_ex(char *value, int len); +char *url_raw_encode(const char *s, int &len); +char *url_raw_decode(const char *s, int &len); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_ZEND_URL_H__ diff --git a/src/cpp/eval/Makefile b/src/cpp/eval/Makefile new file mode 100644 index 0000000000000..b9627f4ace4c5 --- /dev/null +++ b/src/cpp/eval/Makefile @@ -0,0 +1,19 @@ + +PROJECT_ROOT = ../../.. +PROJECT_NAME = hphp_cpp_eval + +SYSTEM=$(PROJECT_ROOT)/src/lib/system + +AUTO_SOURCES_RECURSIVE = 1 +EVAL_DIR=. + +include gen.mk +include $(PROJECT_ROOT)/src/rules.mk + +ifdef MAC_OS_X +TARGETS = $(STATIC_LIB) +else +TARGETS = $(STATIC_LIB) $(SHARED_LIB) +endif + +all: $(TARGETS) diff --git a/src/cpp/eval/analysis/block.cpp b/src/cpp/eval/analysis/block.cpp new file mode 100644 index 0000000000000..2a6fb8fff00aa --- /dev/null +++ b/src/cpp/eval/analysis/block.cpp @@ -0,0 +1,105 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +void VariableIndex::set(CStrRef name, int idx) { + m_idx = idx; + m_hash = hash_string(name.c_str(), name.size()); + m_sg = isSuperGlobal(name); +} + +VariableIndex::SuperGlobal VariableIndex::isSuperGlobal(CStrRef name) { + if (name == "GLOBALS") { + return Globals; + } else if (name.data()[0] == '_') { + if (name == "_SERVER") { + return Server; + } else if (name == "_GET") { + return Get; + } else if (name == "_POST") { + return Post; + } else if (name == "_FILES") { + return Files; + } else if (name == "_COOKIE") { + return Cookie; + } else if (name == "_SESSION") { + return Session; + } else if (name == "_REQUEST") { + return Request; + } else if (name == "_ENV") { + return Env; + } + } else if (name == "http_response_header") { + return HttpResponseHeader; + } + return Normal; +} + +Block::Block() {} + +Block::Block(const vector &stat) { + for (vector::const_iterator it = stat.begin(); + it != stat.end(); ++it) { + declareStaticStatement(*it); + } +} + +Block::~Block() {} + +void Block::declareStaticStatement(StaticStatementPtr stat) { + for (vector::const_iterator it = stat->vars().begin(); + it != stat->vars().end(); ++it) { + m_staticStmts[(*it)->name()->getStatic().data()] = (*it)->val(); + } +} + +int Block::declareVariable(CStrRef var) { + string svar(var.data(), var.size()); + VariableIndices::const_iterator it = m_variableIndices.find(svar); + if (it == m_variableIndices.end()) { + int i = m_variableIndices.size(); + m_variableIndices[svar].set(svar, i); + return i; + } + return it->second.idx(); +} + +const Block::VariableIndices &Block::varIndices() const { + return m_variableIndices; +} + +// PHP is insane +Variant Block::getStaticValue(VariableEnvironment &env, + const char *name) const { + map::const_iterator it = m_staticStmts.find(name); + if (it != m_staticStmts.end() && it->second) { + return it->second->eval(env); + } + return Variant(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} diff --git a/src/cpp/eval/analysis/block.h b/src/cpp/eval/analysis/block.h new file mode 100644 index 0000000000000..e07596290985f --- /dev/null +++ b/src/cpp/eval/analysis/block.h @@ -0,0 +1,78 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_BLOCK_H__ +#define __EVAL_BLOCK_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(Expression); +DECLARE_AST_PTR(StaticStatement); +class VariableEnvironment; + +class VariableIndex { +public: + enum SuperGlobal { + Server = 0, + Get, + Post, + Files, + Cookie, + Session, + Request, + Env, + Globals, + HttpResponseHeader, + Normal + }; + void set(CStrRef name, int idx); + int idx() const { return m_idx; } + int64 hash() const { return m_hash; } + SuperGlobal superGlobal() const { return m_sg; } + static SuperGlobal isSuperGlobal(CStrRef name); +private: + int m_idx; + int64 m_hash; + SuperGlobal m_sg; +}; + +class Block { +public: + // Varname -> (idx, hash) + typedef std::map VariableIndices; + + Block(); + ~Block(); + Block(const std::vector &stat); + void declareStaticStatement(StaticStatementPtr stat); + Variant getStaticValue(VariableEnvironment &env, const char *name) + const; + int declareVariable(CStrRef var); + const VariableIndices &varIndices() const; +protected: + std::map m_staticStmts; + VariableIndices m_variableIndices; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_BLOCK_H__ */ diff --git a/src/cpp/eval/ast/array_element_expression.cpp b/src/cpp/eval/ast/array_element_expression.cpp new file mode 100644 index 0000000000000..d70761d8298bb --- /dev/null +++ b/src/cpp/eval/ast/array_element_expression.cpp @@ -0,0 +1,149 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +ArrayElementExpression::ArrayElementExpression(EXPRESSION_ARGS, + LvalExpressionPtr arr, + ExpressionPtr idx) + : LvalExpression(EXPRESSION_PASS), m_arr(arr), m_idx(idx) {} + +Variant ArrayElementExpression::eval(VariableEnvironment &env) const { + if (!m_idx) { + throw InvalidOperandException("Cannot use [] in read context"); + } + Variant arr = m_arr->eval(env); + Variant idx = m_idx->eval(env); + return arr.rvalAt(idx); +} + +bool ArrayElementExpression::exist(VariableEnvironment &env, int op) const { + if (!m_idx) { + throw InvalidOperandException("Cannot use [] in read context"); + } + Variant arr = m_arr->eval(env); + Variant idx = m_idx->eval(env); + + if (op == T_ISSET) { + return HPHP::isset(arr, idx); + } + ASSERT(op == T_EMPTY); + return HPHP::empty(arr, idx); +} + +Variant &ArrayElementExpression::lval(VariableEnvironment &env) const { + Variant &arr = m_arr->lval(env); + if (m_idx) { + Variant idx = m_idx->eval(env); + return arr.lvalAt(idx); + } else { + return arr.lvalAt(); + } +} + +bool ArrayElementExpression::weakLval(VariableEnvironment &env, + Variant *&v) const { + if (!m_idx) { + throw InvalidOperandException("Cannot unset array append"); + } + Variant *arr; + if (m_arr->weakLval(env, arr)) { + Variant idx = m_idx->eval(env); + if (!arr->is(KindOfArray)) { + return false; + } + if (arr->getArrayData()->exists(idx)) { + v = &arr->lvalAt(idx); + return true; + } + } + return false; +} + +Variant ArrayElementExpression::refval(VariableEnvironment &env) const { + if (m_idx) { + Variant arr = m_arr->refval(env); + Variant idx = m_idx->eval(env); + return ref(arr.refvalAt(idx)); + } else { + return ref(lval(env)); + } +} + +Variant ArrayElementExpression::set(VariableEnvironment &env, CVarRef val) + const { + Variant &arr = m_arr->lval(env); + if (m_idx) { + Variant idx = m_idx->eval(env); + return arr.set(idx, val); + } else { + return arr.append(val); + } +} + +void ArrayElementExpression::unset(VariableEnvironment &env) const { + if (!m_idx) { + throw InvalidOperandException("Cannot unset array append"); + } + Variant *arr; + if (m_arr->weakLval(env, arr)) { + Variant idx = m_idx->eval(env); + arr->weakRemove(idx); + } +} + +void ArrayElementExpression::sinkStaticMember(Parser *parser, + const string &className) { + ArrayElementExpressionPtr arr = m_arr->cast(); + if (arr) { + arr->sinkStaticMember(parser, className); + return; + } + + VariableExpressionPtr var = m_arr->cast(); + if (var) { + m_arr = + StaticMemberExpressionPtr(new StaticMemberExpression(parser, + className, + var->getName())); + return; + } + ASSERT(false); +} + +void ArrayElementExpression::dump() const { + m_arr->dump(); + printf("["); + if (m_idx) { + m_idx->dump(); + } + printf("]"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/array_element_expression.h b/src/cpp/eval/ast/array_element_expression.h new file mode 100644 index 0000000000000..ace926c581e75 --- /dev/null +++ b/src/cpp/eval/ast/array_element_expression.h @@ -0,0 +1,52 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_ARRAY_ELEMENT_EXPRESSION_H__ +#define __EVAL_ARRAY_ELEMENT_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ArrayElementExpression); + +class ArrayElementExpression : public LvalExpression { +public: + ArrayElementExpression(EXPRESSION_ARGS, LvalExpressionPtr arr, + ExpressionPtr idx); + virtual Variant eval(VariableEnvironment &env) const; + virtual Variant &lval(VariableEnvironment &env) const; + virtual void unset(VariableEnvironment &env) const; + virtual bool exist(VariableEnvironment &env, int op) const; + virtual bool weakLval(VariableEnvironment &env, Variant* &v) const; + virtual Variant refval(VariableEnvironment &env) const; + virtual Variant set(VariableEnvironment &env, CVarRef val) const; + void sinkStaticMember(Parser *parser, const std::string &className); + LvalExpressionPtr getArr() const { return m_arr; } + ExpressionPtr getIdx() const { return m_idx; } + virtual void dump() const; +private: + LvalExpressionPtr m_arr; + ExpressionPtr m_idx; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_ARRAY_ELEMENT_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/array_expression.cpp b/src/cpp/eval/ast/array_expression.cpp new file mode 100644 index 0000000000000..042903d85a636 --- /dev/null +++ b/src/cpp/eval/ast/array_expression.cpp @@ -0,0 +1,112 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ArrayPair::ArrayPair(CONSTRUCT_ARGS) : Construct(CONSTRUCT_PASS) {} +ArrayPair::ArrayPair(CONSTRUCT_ARGS, ExpressionPtr key) + : Construct(CONSTRUCT_PASS), m_key(key) {}; + + +Variant ArrayPair::key(VariableEnvironment &env) const { + if (m_key) { + return m_key->eval(env); + } + return Variant(); +} + +ArrayPairVal::ArrayPairVal(CONSTRUCT_ARGS, ExpressionPtr key, ExpressionPtr val) + : ArrayPair(CONSTRUCT_PASS, key), m_val(val) {} +ArrayPairVal::ArrayPairVal(CONSTRUCT_ARGS, ExpressionPtr val) + : ArrayPair(CONSTRUCT_PASS), m_val(val) {} + +Variant ArrayPairVal::val(VariableEnvironment &env) const { + return m_val->eval(env); +} + +void ArrayPairVal::set(VariableEnvironment &env, Array &arr) const { + if (m_key) { + arr.set(key(env), val(env)); + } else { + arr.append(val(env)); + } +} + +void ArrayPairVal::dump() const { + if (m_key) { + m_key->dump(); + printf(" => "); + } + m_val->dump(); +} + +ArrayPairRef::ArrayPairRef(CONSTRUCT_ARGS, ExpressionPtr key, + LvalExpressionPtr val) + : ArrayPair(CONSTRUCT_PASS, key), m_val(val) {} +ArrayPairRef::ArrayPairRef(CONSTRUCT_ARGS, LvalExpressionPtr val) : + ArrayPair(CONSTRUCT_PASS), m_val(val) {} + + +Variant &ArrayPairRef::val(VariableEnvironment &env) const { + return m_val->lval(env); +} + +void ArrayPairRef::set(VariableEnvironment &env, Array &arr) const { + if (m_key) { + arr.set(key(env), ref(val(env))); + } else { + arr.append(ref(val(env))); + } +} + +void ArrayPairRef::dump() const { + if (m_key) { + m_key->dump(); + printf(" => "); + } + m_val->dump(); +} + +ArrayExpression::ArrayExpression(EXPRESSION_ARGS, + const std::vector &elems) + : Expression(EXPRESSION_PASS), m_elems(elems) {} + + +Variant ArrayExpression::eval(VariableEnvironment &env) const { + Array arr = Array::Create(); + for (std::vector::const_iterator it = m_elems.begin(); + it != m_elems.end(); ++it) { + (*it)->set(env, arr); + } + return arr; +} + +void ArrayExpression::dump() const { + printf("array("); + dumpVector(m_elems, ", "); + printf(")"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/array_expression.h b/src/cpp/eval/ast/array_expression.h new file mode 100644 index 0000000000000..7c02442bf7b08 --- /dev/null +++ b/src/cpp/eval/ast/array_expression.h @@ -0,0 +1,76 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_ARRAY_EXPRESSION_H__ +#define __EVAL_ARRAY_EXPRESSION_H__ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ArrayPair); +DECLARE_AST_PTR(ArrayExpression); +DECLARE_AST_PTR(LvalExpression); + +class ArrayPair : public Construct { +public: + ArrayPair(CONSTRUCT_ARGS); + ArrayPair(CONSTRUCT_ARGS, ExpressionPtr key); + virtual void set(VariableEnvironment &env, Array &arr) const = 0; +protected: + ExpressionPtr m_key; + Variant key(VariableEnvironment &env) const; +}; + +class ArrayPairVal : public ArrayPair { +public: + ArrayPairVal(CONSTRUCT_ARGS, ExpressionPtr key, ExpressionPtr val); + ArrayPairVal(CONSTRUCT_ARGS, ExpressionPtr val); + virtual void set(VariableEnvironment &env, Array &arr) const; + virtual void dump() const; +private: + ExpressionPtr m_val; + Variant val(VariableEnvironment &env) const; +}; + +class ArrayPairRef : public ArrayPair { +public: + ArrayPairRef(CONSTRUCT_ARGS, ExpressionPtr key, LvalExpressionPtr val); + ArrayPairRef(CONSTRUCT_ARGS, LvalExpressionPtr val); + virtual void set(VariableEnvironment &env, Array &arr) const; + virtual void dump() const; +private: + LvalExpressionPtr m_val; + Variant &val(VariableEnvironment &env) const; +}; + +class ArrayExpression : public Expression { +public: + ArrayExpression(EXPRESSION_ARGS, const std::vector &elems); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + std::vector m_elems; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_ARRAY_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/assignment_op_expression.cpp b/src/cpp/eval/ast/assignment_op_expression.cpp new file mode 100644 index 0000000000000..0e44a8d0a6db5 --- /dev/null +++ b/src/cpp/eval/ast/assignment_op_expression.cpp @@ -0,0 +1,62 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +AssignmentOpExpression::AssignmentOpExpression(EXPRESSION_ARGS, int op, + LvalExpressionPtr lhs, + ExpressionPtr rhs) + : Expression(EXPRESSION_PASS), m_op(op), m_lhs(lhs), m_rhs(rhs) {} + +Variant AssignmentOpExpression::eval(VariableEnvironment &env) const { + Variant rhs = m_rhs->eval(env); + if (m_op == '=') return m_lhs->set(env, rhs); + return m_lhs->setOp(env, m_op, rhs); +} + +void AssignmentOpExpression::dump() const { + m_lhs->dump(); + const char* op = ""; + switch (m_op) { + case '=': op = "="; break; + case T_PLUS_EQUAL: op = "+="; break; + case T_MINUS_EQUAL: op = "-="; break; + case T_MUL_EQUAL: op = "*="; break; + case T_DIV_EQUAL: op = "/="; break; + case T_CONCAT_EQUAL: op = ".="; break; + case T_MOD_EQUAL: op = "%="; break; + case T_AND_EQUAL: op = "&="; break; + case T_OR_EQUAL: op = "|="; break; + case T_XOR_EQUAL: op = "^="; break; + case T_SL_EQUAL: op = "<<="; break; + case T_SR_EQUAL: op = ">>="; break; + default: + ASSERT(false); + } + printf(" %s ", op); + m_rhs->dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/assignment_op_expression.h b/src/cpp/eval/ast/assignment_op_expression.h new file mode 100644 index 0000000000000..68a228d2d34ec --- /dev/null +++ b/src/cpp/eval/ast/assignment_op_expression.h @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_ASSIGNMENT_OP_EXPRESSION_H__ +#define __EVAL_ASSIGNMENT_OP_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(AssignmentOpExpression); +DECLARE_AST_PTR(LvalExpression); + +class AssignmentOpExpression : public Expression { +public: + AssignmentOpExpression(EXPRESSION_ARGS, int op, LvalExpressionPtr lhs, + ExpressionPtr rhs); + virtual Variant eval(VariableEnvironment &env) const; + LvalExpressionPtr getLhs() const { return m_lhs; } + ExpressionPtr getRhs() const { return m_rhs; } + virtual void dump() const; +private: + int m_op; + LvalExpressionPtr m_lhs; + ExpressionPtr m_rhs; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_BINARY_OP_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/assignment_ref_expression.cpp b/src/cpp/eval/ast/assignment_ref_expression.cpp new file mode 100644 index 0000000000000..d05e94c0d8bd3 --- /dev/null +++ b/src/cpp/eval/ast/assignment_ref_expression.cpp @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +AssignmentRefExpression::AssignmentRefExpression(EXPRESSION_ARGS, + LvalExpressionPtr lhs, + ExpressionPtr rhs) + : Expression(EXPRESSION_PASS), m_lhs(lhs), m_rhs(rhs) {} + +Variant AssignmentRefExpression::eval(VariableEnvironment &env) const { + return m_lhs->set(env, ref(m_rhs->refval(env))); +} + +void AssignmentRefExpression::dump() const { + m_lhs->dump(); + printf(" = &"); + m_rhs->dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/assignment_ref_expression.h b/src/cpp/eval/ast/assignment_ref_expression.h new file mode 100644 index 0000000000000..2f7852cd4010c --- /dev/null +++ b/src/cpp/eval/ast/assignment_ref_expression.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_ASSIGNMENT_REF_EXPRESSION_H__ +#define __EVAL_ASSIGNMENT_REF_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(AssignmentRefExpression); +DECLARE_AST_PTR(LvalExpression); + +class AssignmentRefExpression : public Expression { +public: + AssignmentRefExpression(EXPRESSION_ARGS, LvalExpressionPtr lhs, + ExpressionPtr rhs); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + LvalExpressionPtr m_lhs; + ExpressionPtr m_rhs; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_BINARY_REF_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/binary_op_expression.cpp b/src/cpp/eval/ast/binary_op_expression.cpp new file mode 100644 index 0000000000000..b733070552c0f --- /dev/null +++ b/src/cpp/eval/ast/binary_op_expression.cpp @@ -0,0 +1,108 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +BinaryOpExpression::BinaryOpExpression(EXPRESSION_ARGS, ExpressionPtr exp1, + int op, ExpressionPtr exp2) + : Expression(EXPRESSION_PASS), m_exp1(exp1), m_exp2(exp2), m_op(op) {} + +Variant BinaryOpExpression::eval(VariableEnvironment &env) const { + switch (m_op) { + case T_LOGICAL_OR: + case T_BOOLEAN_OR: return m_exp1->eval(env) || + m_exp2->eval(env); + case T_LOGICAL_AND: + case T_BOOLEAN_AND: return m_exp1->eval(env) && + m_exp2->eval(env); + default: + { + Variant v1 = m_exp1->eval(env); + Variant v2 = m_exp2->eval(env); + switch (m_op) { + case T_LOGICAL_XOR: return logical_xor(v1, v2); + case '|': return bitwise_or(v1, v2); + case '&': return bitwise_and(v1, v2); + case '^': return bitwise_xor(v1, v2); + case '.': return concat(v1, v2); + case '+': return v1 + v2; + case '-': return v1 - v2; + case '*': return multiply(v1, v2); + case '/': return divide(v1, v2); + case '%': return modulo(v1, v2); + case T_SL: return v1.toInt64() << v2.toInt64(); + case T_SR: return v1.toInt64() >> v2.toInt64(); + case T_IS_IDENTICAL: return same(v1, v2); + case T_IS_NOT_IDENTICAL: return !same(v1, v2); + case T_IS_EQUAL: return equal(v1, v2); + case T_IS_NOT_EQUAL: return !equal(v1, v2); + case '<': return less(v1, v2); + case T_IS_SMALLER_OR_EQUAL: return not_more(v1, v2); + case '>': return more(v1, v2); + case T_IS_GREATER_OR_EQUAL: return not_less(v1, v2); + default: + ASSERT(false); + return Variant(); + } + } + } +} + +void BinaryOpExpression::dump() const { + m_exp1->dump(); + const char* op = ""; + switch (m_op) { + case T_LOGICAL_OR: op = "OR"; break; + case T_BOOLEAN_OR: op = "||"; break; + case T_LOGICAL_AND: op = "AND"; break; + case T_BOOLEAN_AND: op = "&&"; break; + case T_LOGICAL_XOR: op = "XOR"; break; + case '|': op = "|"; break; + case '&': op = "&"; break; + case '^': op = "^"; break; + case '.': op = "."; break; + case '+': op = "+"; break; + case '-': op = "-"; break; + case '*': op = "*"; break; + case '/': op = "/"; break; + case '%': op = "%"; break; + case T_SL: op = "<<"; break; + case T_SR: op = ">>"; break; + case T_IS_IDENTICAL: op = "==="; break; + case T_IS_NOT_IDENTICAL: op = "!=="; break; + case T_IS_EQUAL: op = "=="; break; + case T_IS_NOT_EQUAL: op = "!="; break; + case '<': op = "<"; break; + case T_IS_SMALLER_OR_EQUAL: op = "<="; break; + case '>': op = ">"; break; + case T_IS_GREATER_OR_EQUAL: op = ">="; break; + default: + ASSERT(false); + } + printf(" %s ", op); + m_exp2->dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} + +} + diff --git a/src/cpp/eval/ast/binary_op_expression.h b/src/cpp/eval/ast/binary_op_expression.h new file mode 100644 index 0000000000000..a3e69fa7fe4c7 --- /dev/null +++ b/src/cpp/eval/ast/binary_op_expression.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_BINARY_OP_EXPRESSION_H__ +#define __EVAL_BINARY_OP_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(BinaryOpExpression); + +class BinaryOpExpression : public Expression { +public: + BinaryOpExpression(EXPRESSION_ARGS, ExpressionPtr exp1, int op, + ExpressionPtr exp2); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_exp1; + ExpressionPtr m_exp2; + int m_op; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_BINARY_OP_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/break_statement.cpp b/src/cpp/eval/ast/break_statement.cpp new file mode 100644 index 0000000000000..5fa576c2dfc8d --- /dev/null +++ b/src/cpp/eval/ast/break_statement.cpp @@ -0,0 +1,57 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +BreakStatement::BreakStatement(STATEMENT_ARGS, ExpressionPtr level, + bool isBreak) + : Statement(STATEMENT_PASS), m_level(level), m_isBreak(isBreak) {} + +void BreakStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + int64 level = m_level ? m_level->eval(env).toInt64() : 1; + if (level > 0) { + if (m_isBreak) { + env.setBreak(level); + } else { + env.setBreak(-level); + } + } +} + +void BreakStatement::dump() const { + if (m_isBreak) { + printf("break"); + } else { + printf("continue"); + } + if (m_level) { + printf(" "); + m_level->dump(); + } + printf(";"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/break_statement.h b/src/cpp/eval/ast/break_statement.h new file mode 100644 index 0000000000000..03841b9bf551b --- /dev/null +++ b/src/cpp/eval/ast/break_statement.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_BREAK_STATEMENT_H__ +#define __EVAL_BREAK_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(BreakStatement); +DECLARE_AST_PTR(Expression); + +class BreakStatement : public Statement { +public: + BreakStatement(STATEMENT_ARGS, ExpressionPtr level, bool isBreak); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_level; + bool m_isBreak; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_BREAK_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/class_constant_expression.cpp b/src/cpp/eval/ast/class_constant_expression.cpp new file mode 100644 index 0000000000000..8fda13b73b535 --- /dev/null +++ b/src/cpp/eval/ast/class_constant_expression.cpp @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ClassConstantExpression::ClassConstantExpression(EXPRESSION_ARGS, + const string &cls, + const string &constant) + : Expression(EXPRESSION_PASS), m_class(cls), + m_constant(constant) {} + +Variant ClassConstantExpression::eval(VariableEnvironment &env) const { + return get_class_constant(m_class.c_str(), m_constant.c_str()); +} + +void ClassConstantExpression::dump() const { + printf("%s::%s", m_class.c_str(), m_constant.c_str()); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/class_constant_expression.h b/src/cpp/eval/ast/class_constant_expression.h new file mode 100644 index 0000000000000..51dec5682f01a --- /dev/null +++ b/src/cpp/eval/ast/class_constant_expression.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_CLASS_CONSTANT_EXPRESSION_H__ +#define __EVAL_CLASS_CONSTANT_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ClassConstantExpression); + +class ClassConstantExpression : public Expression { +public: + ClassConstantExpression(EXPRESSION_ARGS, const std::string &cls, + const std::string &constant); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + std::string m_class; + std::string m_constant; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_CLASS_CONSTANT_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/class_statement.cpp b/src/cpp/eval/ast/class_statement.cpp new file mode 100644 index 0000000000000..f5585762b2106 --- /dev/null +++ b/src/cpp/eval/ast/class_statement.cpp @@ -0,0 +1,419 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +ClassVariable::ClassVariable(CONSTRUCT_ARGS, const string &name, int modifiers, + ExpressionPtr value, const string &doc) + : Construct(CONSTRUCT_PASS), m_name(name), + m_hash(hash_string_i(name.c_str(), name.size())), + m_modifiers(modifiers), m_value(value), m_docComment(doc) {} + +void ClassVariable::set(VariableEnvironment &env, EvalObjectData *self) const { + if (!(m_modifiers & ClassStatement::Static) && + !self->o_exists(m_name.c_str(), m_hash)) { + self->o_set(m_name.c_str(), m_hash, m_value ? m_value->eval(env) : Variant(), + true); + } +} +void ClassVariable::setStatic(VariableEnvironment &env, LVariableTable &st) + const { + if ((m_modifiers & ClassStatement::Static)) { + st.get(m_name.c_str()) = m_value ? m_value->eval(env) : Variant(); + } +} + +void ClassVariable::dump() const { + ClassStatement::printModifiers(m_modifiers); + printf("$%s", m_name.c_str()); + if (m_value) { + printf(" = "); + m_value->dump(); + } + printf(";"); +} + +void ClassVariable::getInfo(ClassInfo::PropertyInfo &info) const { + int attr = 0; + if (m_modifiers & ClassStatement::Protected) attr |= ClassInfo::IsProtected; + if (m_modifiers & ClassStatement::Private) attr |= ClassInfo::IsPrivate; + if (attr == 0) attr |= ClassInfo::IsPublic; + if (m_modifiers & ClassStatement::Static) attr |= ClassInfo::IsStatic; + info.attribute = (ClassInfo::Attribute)attr; + info.name = m_name.c_str(); + if (!m_docComment.empty()) { + info.docComment = m_docComment.c_str(); + } +} + +ClassStatement::ClassStatement(STATEMENT_ARGS, const string &name, + const string &parent, const string &doc) + : Statement(STATEMENT_PASS), m_name(name), + m_lname(Util::toLower(m_name)), + m_modifiers(0), m_parent(parent), m_docComment(doc) {} + +void ClassStatement::finish() { +} + +const ClassStatement *ClassStatement::parentStatement() const { + return RequestEvalState::findClass(m_parent.c_str()); +} + + +void ClassStatement:: +loadMethodTable(hphp_const_char_imap &mtable) const { + if (!m_parent.empty()) { + const ClassStatement* parent_cls = parentStatement(); + if (parent_cls) { + parent_cls->loadMethodTable(mtable); + } else { + // Built in + ClassInfo::MethodVec meths; + ClassInfo::GetClassMethods(meths, m_parent.c_str(), 1); + for (ClassInfo::MethodVec::const_iterator it = meths.begin(); + it != meths.end(); ++it) { + mtable[(*it)->name] = NULL; + } + } + } + for (vector::const_iterator it = m_methodsVec.begin(); + it != m_methodsVec.end(); ++it) { + mtable[(*it)->name().c_str()] = it->get(); + } + MethodStatement *constructor = NULL; + bool nameMethod = false; + bool constructMethod = false; + hphp_const_char_imap::const_iterator it = + m_methods.find(m_name.c_str()); + if (it != m_methods.end()) { + constructor = it->second.get(); + nameMethod = true; + } + it = m_methods.find("__construct"); + if (it != m_methods.end()) { + constructor = it->second.get(); + constructMethod = true; + } + if (constructMethod && !nameMethod) { + mtable[m_name.c_str()] = constructor; + } else if (!constructMethod && nameMethod) { + mtable["__construct"] = constructor; + } +} + +void ClassStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + RequestEvalState::declareClass(this); + + const ClassStatement* parent_cls = parentStatement(); + if (parent_cls && parent_cls->getModifiers() & Final) { + // Extended a final class + throw FatalErrorException("Class %s may not inherit from final class (%s)", + name().c_str(), parent_cls->name().c_str()); + } + if (RuntimeOption::EnableStrict && parent_cls) { + for (vector::const_iterator it = m_methodsVec.begin(); + it != m_methodsVec.end(); ++it) { + + const MethodStatementPtr child_method = *it; + + const ClassStatement* cs = this; + while ((cs = cs->parentStatement())) { + if (cs->findMethod(child_method->name().c_str())) { + break; + } + } + if (cs) { + const MethodStatement* parent_method = + cs->findMethod(child_method->name().c_str()); + + ASSERT(parent_method); + + const vector& child_params = child_method->getParams(); + const vector& parent_params = parent_method->getParams(); + + vector::const_iterator pchild = child_params.begin(); + vector::const_iterator pparent = parent_params.begin(); + + for (; pchild != child_params.end() && pparent != parent_params.end(); + ++pchild, ++pparent) { + if ((*pchild)->isOptional() != (*pparent)->isOptional()) { + throw_strict(MethodSignatureChangeException( + child_method->name().c_str()), + StrictMode::StrictBasic); + } + } + + // more parameters in child than parent + for (; pchild != child_params.end(); ++pchild) { + // TODO? do we want the child to allow optional extra parameters ? + throw_strict(MethodSignatureChangeException( + child_method->name().c_str()), + StrictMode::StrictBasic); + } + + // more parameters in parent than child + if (pparent != parent_params.end()) { + throw_strict(MethodSignatureChangeException( + child_method->name().c_str()), + StrictMode::StrictBasic); + } + } + } + } +} + +Object ClassStatement::create(ClassEvalState &ce, CArrRef params, + bool init, ObjectData* root /* = NULL*/) const { + if (getModifiers() & Abstract) { + throw FatalErrorException("Cannot instantiate abstract class %s", + name().c_str()); + } + + EvalObjectData *eo; + ce.initializeMethods(); + + // Only need a parent for the dynamic class if the parent + // is builtin or compiled + const char *builtinParent = NULL; + const ClassStatement *cls = this; + while (!cls->parent().empty()) { + const ClassStatement *pcls = cls->parentStatement(); + if (!pcls) { + builtinParent = cls->parent().c_str(); + break; + } + cls = pcls; + } + + eo = NEW(EvalObjectData)(ce, builtinParent, root); + + Object o(eo); + if (init) { + eo->dynCreate(params, init); + } + return o; +} + +void ClassStatement::initializeObject(EvalObjectData *obj) const { + DummyVariableEnvironment env; + for (vector::const_iterator it = + m_variablesVec.begin(); + it != m_variablesVec.end(); ++it) { + (*it)->set(env, obj); + } + const ClassStatement *cls = parentStatement(); + if (cls) { + cls->initializeObject(obj); + } +} + +void ClassStatement::initializeStatics(LVariableTable &statics) const { + DummyVariableEnvironment env; + for (vector::const_iterator it = + m_variablesVec.begin(); + it != m_variablesVec.end(); ++it) { + (*it)->setStatic(env, statics); + } +} + +void ClassStatement::addBases(const std::vector &bases) { + for (std::vector::const_iterator it = bases.begin(); + it != bases.end(); ++it) { + string s(it->data(), it->size()); + m_basesVec.push_back(s); + m_bases[m_basesVec.back().c_str()] = true; + } +} + +void ClassStatement::addMethod(MethodStatementPtr m) { + m_methods[m->lname().c_str()] = m; + m_methodsVec.push_back(m); +} +void ClassStatement::addConstant(const string &name, ExpressionPtr v) { + m_constants[name] = v; +} + +bool ClassStatement::instanceOf(const char *c) const { + if (strcasecmp(m_name.c_str(), c) == 0 || + m_bases.find(c) != m_bases.end()) return true; + for (vector::const_iterator it = m_basesVec.begin(); + it != m_basesVec.end(); ++it) { + const ClassStatement *iface = RequestEvalState::findClass(it->c_str()); + if (iface && iface->instanceOf(c)) return true; + } + return false; +} +bool ClassStatement::subclassOf(const char *c) const { + const ClassStatement *cls = this; + while (cls) { + if (cls->instanceOf(c)) return true; + cls = cls->parentStatement(); + } + return false; +} + +const MethodStatement* ClassStatement::findMethod(const char* name) const { + hphp_const_char_imap::const_iterator it = + m_methods.find(name); + if (it != m_methods.end()) { + return it->second.get(); + } else { + return NULL; + } +} + +bool ClassStatement::getConstant(Variant &res, const char *c) const { + map::const_iterator it = m_constants.find(c); + if (it != m_constants.end()) { + DummyVariableEnvironment env; + res = it->second->eval(env); + return true; + } + return false; +} + +void ClassStatement::dump() const { + printf("class %s {", m_name.c_str()); + for (hphp_const_char_imap::const_iterator it = + m_methods.begin(); it != m_methods.end(); ++it) { + it->second->dump(); + } + printf("}"); +} + +void ClassStatement::printModifiers(int m) { + if (m & Public) printf("public "); + if (m & Protected) printf("protected "); + if (m & Private) printf("private "); + if (m & Static) printf("static "); + if (m & Abstract) printf("abstract "); + if (m & Final) printf("final "); + if (m & Interface) printf("interface "); +} + +void ClassStatement::getPropertyInfo(ClassInfoEvaled &owner) const { + for (vector::const_iterator it = + m_variablesVec.begin(); + it != m_variablesVec.end(); ++it) { + ClassInfo::PropertyInfo *p = new ClassInfo::PropertyInfo; + (*it)->getInfo(*p); + p->owner = &owner; + owner.m_properties[p->name] = p; + owner.m_propertiesVec.push_back(p); + } +} + +void ClassStatement::getInfo(ClassInfoEvaled &info) const { + int attr = 0; + if (m_modifiers & Interface) attr |= ClassInfo::IsInterface; + if (m_modifiers & Abstract) attr |= ClassInfo::IsAbstract; + if (m_modifiers & Final) attr |= ClassInfo::IsFinal; + if (attr == 0) attr = ClassInfo::IsNothing; + + info.m_attribute = (ClassInfo::Attribute)attr; + info.m_name = m_name.c_str(); + info.m_parentClass = m_parent.c_str(); + if (!m_docComment.empty()) { + info.m_docComment = m_docComment.c_str(); + } + for (vector::const_iterator it = m_basesVec.begin(); + it != m_basesVec.end(); ++it) { + info.m_interfacesVec.push_back(it->c_str()); + info.m_interfaces.insert(it->c_str()); + } + getPropertyInfo(info); + DummyVariableEnvironment dv; + for (map::const_iterator it = m_constants.begin(); + it != m_constants.end(); ++it) { + ClassInfo::ConstantInfo *c = new ClassInfo::ConstantInfo; + c->name = it->first.c_str(); + c->value = it->second->eval(dv); + String sv = c->value.toString(); + char* buf = new char[sv.size()+1]; + memcpy(buf, sv.data(), sv.size()+1); + c->valueLen = sv.size(); + c->valueText = buf; + info.m_constants[c->name] = c; + } + + for (vector::const_iterator it = m_methodsVec.begin(); + it != m_methodsVec.end(); ++it) { + ClassInfo::MethodInfo *m = new ClassInfo::MethodInfo; + (*it)->getInfo(*m); + info.m_methods[(*it)->lname().c_str()] = m; + info.m_methodsVec.push_back(m); + } +} + +bool ClassStatement::hasAccess(CStrRef context, Modifier level) const { + ASSERT(context); + switch (level) { + case Public: return true; + case Private: return strcasecmp(context.c_str(), m_name.c_str()) == 0; + case Protected: + { + if (context.empty()) return false; + if (strcasecmp(context.c_str(), m_name.c_str()) == 0) return true; + const ClassStatement *cls = RequestEvalState::findClass(context.c_str()); + return cls->subclassOf(m_name.c_str()) || subclassOf(context.c_str()); + } + default: + ASSERT(false); + return true; + } +} + +bool ClassStatement::attemptPropertyAccess(CStrRef prop) const { + CStrRef context = FrameInjection::getClassName(false); + hphp_const_char_imap::const_iterator it = + m_variables.find(prop); + if (it == m_variables.end()) { + return false; + } + int mods = it->second->getModifiers(); + Modifier level = Public; + if (mods & Private) level = Private; + else if (mods & Protected) level = Protected; + if (!hasAccess(context, level)) { + string msg("Attempt to access "); + if (level == Private) msg += "private "; + else msg += string("protected "); + msg += m_name + "::" + prop.data(); + if (!context.empty()) msg += string(" from ") + context.c_str(); + throw_fatal(msg.c_str()); + } + + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +} +} diff --git a/src/cpp/eval/ast/class_statement.h b/src/cpp/eval/ast/class_statement.h new file mode 100644 index 0000000000000..9c4183ab85bb0 --- /dev/null +++ b/src/cpp/eval/ast/class_statement.h @@ -0,0 +1,134 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_CLASS_STATEMENT_H__ +#define __EVAL_CLASS_STATEMENT_H__ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(Expression); +DECLARE_AST_PTR(ClassVariable); +DECLARE_AST_PTR(ClassStatement); +DECLARE_AST_PTR(MethodStatement); +DECLARE_AST_PTR(ScalarExpression); +class EvalObjectData; +class ClassInfoEvaled; +class ClassEvalState; + +class ClassVariable : public Construct { +public: + ClassVariable(CONSTRUCT_ARGS, const std::string &name, int modifiers, + ExpressionPtr value, const std::string &doc); + void set(VariableEnvironment &env, EvalObjectData *self) const; + void setStatic(VariableEnvironment &env, LVariableTable &statics) const; + virtual void dump() const; + const std::string &name() const { return m_name; } + void getInfo(ClassInfo::PropertyInfo &info) const; + int getModifiers() const { return m_modifiers; } +private: + std::string m_name; + int64 m_hash; + int m_modifiers; + ExpressionPtr m_value; + std::string m_docComment; +}; + +class ClassStatement : public Statement { +public: + enum Modifier { + Public = 1, + Protected = 2, + Private = 4, + Static = 8, + Abstract = 16, + Final = 32, + Interface = 64 + }; + + ClassStatement(STATEMENT_ARGS, const std::string &name, + const std::string &parent, const std::string &doc); + void finish(); + const std::string &name() const { return m_name; } + const std::string &lname() const { return m_lname; } + const std::string &parent() const { return m_parent; } + const ClassStatement *parentStatement() const; + void setModifiers(int m) { m_modifiers = m; } + int getModifiers() const { return m_modifiers; } + void addBases(const std::vector &bases); + void addVariable(ClassVariablePtr v) { + m_variables[v->name().c_str()] = v; + m_variablesVec.push_back(v); + } + void addMethod(MethodStatementPtr m); + void addConstant(const std::string &name, ExpressionPtr v); + + bool instanceOf(const char *c) const; + bool subclassOf(const char *c) const; + + // Eval is called at declaration, not invocation + virtual void eval(VariableEnvironment &env) const; + // Called by create_class + Object create(ClassEvalState &ce, CArrRef params, bool init, + ObjectData* root = NULL) const; + void initializeObject(EvalObjectData *obj) const; + void initializeStatics(LVariableTable &statics) const; + + const MethodStatement* findMethod(const char* name) const; + bool getConstant(Variant &res, const char *c) const; + + virtual void dump() const; + static void printModifiers(int m); + + void getPropertyInfo(ClassInfoEvaled &owner) const; + void getInfo(ClassInfoEvaled &info) const; + + bool hasAccess(CStrRef context, Modifier level) const; + bool attemptPropertyAccess(CStrRef prop) const; + + void loadMethodTable(hphp_const_char_imap &mtable) + const; + +protected: + std::string m_name; + std::string m_lname; + int m_modifiers; + + std::string m_parent; + hphp_const_char_imap m_bases; + std::vector m_basesVec; + + hphp_const_char_imap m_variables; + std::vector m_variablesVec; + hphp_const_char_imap m_methods; + std::vector m_methodsVec; + std::map m_constants; + + std::string m_docComment; + + void loadProperties(ClassInfoEvaled &info) const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_CLASS_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/constant_expression.cpp b/src/cpp/eval/ast/constant_expression.cpp new file mode 100644 index 0000000000000..22d5a3ac054be --- /dev/null +++ b/src/cpp/eval/ast/constant_expression.cpp @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +ConstantExpression::ConstantExpression(EXPRESSION_ARGS, + const string &constant) + : Expression(EXPRESSION_PASS), m_constant(constant) {} + +Variant ConstantExpression::eval(VariableEnvironment &env) const { + //cerr << "Getting constant " << m_constant << endl; + Variant r = get_constant(m_constant); + return r; +} + +void ConstantExpression::dump() const { + printf("%s", m_constant.c_str()); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/constant_expression.h b/src/cpp/eval/ast/constant_expression.h new file mode 100644 index 0000000000000..4f536286b62ca --- /dev/null +++ b/src/cpp/eval/ast/constant_expression.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_CONSTANT_EXPRESSION_H__ +#define __EVAL_CONSTANT_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ConstantExpression); + +class ConstantExpression : public Expression { +public: + ConstantExpression(EXPRESSION_ARGS, const std::string &constant); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; + const std::string &getName() const { return m_constant; } +private: + std::string m_constant; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_CONSTANT_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/construct.cpp b/src/cpp/eval/ast/construct.cpp new file mode 100644 index 0000000000000..8ef2a4d5a7b90 --- /dev/null +++ b/src/cpp/eval/ast/construct.cpp @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +Construct::Construct(CONSTRUCT_ARGS) : _count(0) { + parser->getLocation(m_loc); +} + +void Construct::release() { + delete this; +} + +void Construct::dump() const { + printf("", this); +} + +void Construct::dumpLoc() const { + cerr << m_loc.file << ":" << m_loc.line1 << endl; +} + +/////////////////////////////////////////////////////////////////////////////// +} +} diff --git a/src/cpp/eval/ast/construct.h b/src/cpp/eval/ast/construct.h new file mode 100644 index 0000000000000..73a901d9dd06c --- /dev/null +++ b/src/cpp/eval/ast/construct.h @@ -0,0 +1,83 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_AST_CONSTRUCT_H__ +#define __EVAL_AST_CONSTRUCT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(Construct); + +class Parser; + +#define CONSTRUCT_ARGS Parser *parser +#define CONSTRUCT_PASS parser + +/** + * Not deriving from Countable because I don't want _count to be mutable + */ +class Construct { +public: + Construct(CONSTRUCT_ARGS); + virtual ~Construct() {} + void release(); + void incRefCount() { + ++_count; + } + int decRefCount() { + ASSERT(_count > 0); + return --_count; + } + int getCount() const { + return _count; + } + + template + AstPtr cast() { + T* p = dynamic_cast(this); + return AstPtr(p); + } + virtual void dump() const; + + template + static void dumpVector(const std::vector &v, const char* delim) { + bool first = true; + for (uint i = 0; i < v.size(); i++) { + if (first) { + first = false; + } else { + printf("%s", delim); + } + v[i]->dump(); + } + } + const Location *loc() const { return &m_loc; } + void dumpLoc() const; +protected: + Location m_loc; +private: + int _count; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_AST_CONSTRUCT_H__ */ diff --git a/src/cpp/eval/ast/do_while_statement.cpp b/src/cpp/eval/ast/do_while_statement.cpp new file mode 100644 index 0000000000000..25c6303992186 --- /dev/null +++ b/src/cpp/eval/ast/do_while_statement.cpp @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DoWhileStatement::DoWhileStatement(STATEMENT_ARGS, StatementPtr body, + ExpressionPtr cond) + : Statement(STATEMENT_PASS), m_cond(cond), m_body(body) {} + +void DoWhileStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + do { + if (!m_body) continue; + EVAL_STMT_HANDLE_BREAK(m_body, env); + } while (m_cond->eval(env)); +} + +void DoWhileStatement::dump() const { + printf("do {"); + if (m_body) m_body->dump(); + printf("} while("); + m_cond->dump(); + printf(");"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/do_while_statement.h b/src/cpp/eval/ast/do_while_statement.h new file mode 100644 index 0000000000000..4fdfd5cc1a1a1 --- /dev/null +++ b/src/cpp/eval/ast/do_while_statement.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_DO_WHILE_STATEMENT_H__ +#define __EVAL_DO_WHILE_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(DoWhileStatement); +DECLARE_AST_PTR(Expression); + +class DoWhileStatement : public Statement { +public: + DoWhileStatement(STATEMENT_ARGS, StatementPtr body, ExpressionPtr cond); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_cond; + StatementPtr m_body; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_DO_WHILE_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/echo_statement.cpp b/src/cpp/eval/ast/echo_statement.cpp new file mode 100644 index 0000000000000..f4febe044fe66 --- /dev/null +++ b/src/cpp/eval/ast/echo_statement.cpp @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +EchoStatement::EchoStatement(STATEMENT_ARGS, + const std::vector &args) + : Statement(STATEMENT_PASS), m_args(args) {} + +void EchoStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + for (vector::const_iterator it = m_args.begin(); + it != m_args.end(); ++it) { + echo((*it)->eval(env)); + } +} + +void EchoStatement::dump() const { + printf("echo("); + dumpVector(m_args, ", "); + printf(");"); +} + + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/echo_statement.h b/src/cpp/eval/ast/echo_statement.h new file mode 100644 index 0000000000000..bb6a5e79b5eb6 --- /dev/null +++ b/src/cpp/eval/ast/echo_statement.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_ECHO_STATEMENT_H__ +#define __EVAL_ECHO_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(EchoStatement); +DECLARE_AST_PTR(Expression); + +class EchoStatement : public Statement { +public: + EchoStatement(STATEMENT_ARGS, const std::vector &args); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + std::vector m_args; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_ECHO_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/encaps_list_expression.cpp b/src/cpp/eval/ast/encaps_list_expression.cpp new file mode 100644 index 0000000000000..91444cb8f29dd --- /dev/null +++ b/src/cpp/eval/ast/encaps_list_expression.cpp @@ -0,0 +1,54 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +EncapsListExpression::EncapsListExpression(EXPRESSION_ARGS, + std::vector encaps, + bool shell) + : Expression(EXPRESSION_PASS), m_encaps(encaps), m_shell(shell) {} + +Variant EncapsListExpression::eval(VariableEnvironment &env) const { + String result = ""; + for (std::vector::const_iterator it = m_encaps.begin(); + it != m_encaps.end(); ++it) { + Variant e = (*it)->eval(env); + concat_assign(result, e.toString()); + } + if (m_shell) { + return f_shell_exec(result); + } + return result; +} + +void EncapsListExpression::dump() const { + if (m_shell) { + printf("shell_exec"); + } + printf("("); + dumpVector(m_encaps, "."); + printf(")"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/encaps_list_expression.h b/src/cpp/eval/ast/encaps_list_expression.h new file mode 100644 index 0000000000000..c0948d2a3ae02 --- /dev/null +++ b/src/cpp/eval/ast/encaps_list_expression.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_ENCAPS_LIST_EXPRESSION_H__ +#define __EVAL_ENCAPS_LIST_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(EncapsListExpression); + +class EncapsListExpression : public Expression { +public: + EncapsListExpression(EXPRESSION_ARGS, std::vector encaps, + bool shell); + Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +protected: + std::vector m_encaps; + bool m_shell; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_ENCAPS_LIST_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/expr_statement.cpp b/src/cpp/eval/ast/expr_statement.cpp new file mode 100644 index 0000000000000..ad2aa88ccadbd --- /dev/null +++ b/src/cpp/eval/ast/expr_statement.cpp @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ExprStatement::ExprStatement(STATEMENT_ARGS, ExpressionPtr exp) + : Statement(STATEMENT_PASS), m_exp(exp) {} + +void ExprStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + m_exp->eval(env); +} + +void ExprStatement::dump() const { + m_exp->dump(); + printf(";"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/expr_statement.h b/src/cpp/eval/ast/expr_statement.h new file mode 100644 index 0000000000000..94a97c0ab81e8 --- /dev/null +++ b/src/cpp/eval/ast/expr_statement.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_EXPR_STATEMENT_H__ +#define __EVAL_EXPR_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ExprStatement); +DECLARE_AST_PTR(Expression); + +class ExprStatement : public Statement { +public: + ExprStatement(STATEMENT_ARGS, ExpressionPtr exp); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_exp; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_EXPR_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/expression.cpp b/src/cpp/eval/ast/expression.cpp new file mode 100644 index 0000000000000..0ba84f1754088 --- /dev/null +++ b/src/cpp/eval/ast/expression.cpp @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +Expression::Expression(EXPRESSION_ARGS) : Construct(CONSTRUCT_PASS) {} + +Variant Expression::evalVector(const std::vector &v, + VariableEnvironment &env) { + Variant res; + for (std::vector::const_iterator it = v.begin(); + it != v.end(); ++it) { + res = (*it)->eval(env); + } + return res; +} + +Variant Expression::refval(VariableEnvironment &env) const { + return ref(eval(env)); +} + +bool Expression::exist(VariableEnvironment &env, int op) const { + if (op == T_ISSET) { + return HPHP::isset(eval(env)); + } + ASSERT(op == T_EMPTY); + return HPHP::empty(eval(env)); +} + +const LvalExpression *Expression::toLval() const { + return NULL; +} + +bool Expression::isRefParam() const { + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} +} diff --git a/src/cpp/eval/ast/expression.h b/src/cpp/eval/ast/expression.h new file mode 100644 index 0000000000000..5df9d3e401984 --- /dev/null +++ b/src/cpp/eval/ast/expression.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_EXPRESSION_H__ +#define __EVAL_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(Expression); +DECLARE_AST_PTR(LvalExpression); + +#define EXPRESSION_ARGS CONSTRUCT_ARGS +#define EXPRESSION_PASS CONSTRUCT_PASS + +class Expression : public Construct { +public: + Expression(EXPRESSION_ARGS); + virtual ~Expression() {} + virtual Variant eval(VariableEnvironment &env) const = 0; + virtual Variant refval(VariableEnvironment &env) const; + virtual bool exist(VariableEnvironment &env, int op) const; + virtual const LvalExpression *toLval() const; + virtual bool isRefParam() const; + + static Variant evalVector(const std::vector &v, + VariableEnvironment &env); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/for_statement.cpp b/src/cpp/eval/ast/for_statement.cpp new file mode 100644 index 0000000000000..8f9dbbcc313a0 --- /dev/null +++ b/src/cpp/eval/ast/for_statement.cpp @@ -0,0 +1,58 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ForStatement::ForStatement(STATEMENT_ARGS, + const std::vector &init, + const std::vector &cond, + const std::vector &next, + StatementPtr body) + : Statement(STATEMENT_PASS), m_init(init), m_cond(cond), m_next(next), + m_body(body) {} + +void ForStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + for (Expression::evalVector(m_init, env); + m_cond.empty() ? true : (bool)Expression::evalVector(m_cond, env); + Expression::evalVector(m_next, env)) { + EVAL_STMT_HANDLE_BREAK(m_body, env); + } +} + +void ForStatement::dump() const { + printf("for ("); + dumpVector(m_init, ", "); + printf("; "); + dumpVector(m_cond, ", "); + printf("; "); + dumpVector(m_next, ", "); + printf(") {"); + if (m_body) m_body->dump(); + printf("}"); + +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/for_statement.h b/src/cpp/eval/ast/for_statement.h new file mode 100644 index 0000000000000..7e7408e5fb191 --- /dev/null +++ b/src/cpp/eval/ast/for_statement.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_FOR_STATEMENT_H__ +#define __EVAL_FOR_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ForStatement); +DECLARE_AST_PTR(Expression); + +class ForStatement : public Statement { +public: + ForStatement(STATEMENT_ARGS, + const std::vector &init, + const std::vector &cond, + const std::vector &next, + StatementPtr body); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + std::vector m_init; + std::vector m_cond; + std::vector m_next; + StatementPtr m_body; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_FOR_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/foreach_statement.cpp b/src/cpp/eval/ast/foreach_statement.cpp new file mode 100644 index 0000000000000..9d26c9e4a04bd --- /dev/null +++ b/src/cpp/eval/ast/foreach_statement.cpp @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ForEachStatement::ForEachStatement(STATEMENT_ARGS, ExpressionPtr source, + LvalExpressionPtr key, + LvalExpressionPtr value, StatementPtr body) + : Statement(STATEMENT_PASS), m_source(source), m_key(key), m_value(value), + m_body(body) {} + +void ForEachStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + Variant map = m_source->eval(env); + Variant &v = m_value->lval(env); + Variant *k = NULL; + if (m_key) { + k = &m_key->lval(env); + } + for (ArrayIterPtr iter = map.begin(env.currentContext()); !iter->end(); + iter->next()) { + v = iter->second(); + if (k) *k = iter->first(); + if (!m_body) continue; + EVAL_STMT_HANDLE_BREAK(m_body, env); + } +} + +void ForEachStatement::dump() const { + printf("foreach ("); + m_source->dump(); + printf(" as "); + if (m_key) { + m_key->dump(); + printf(" => "); + } + m_value->dump(); + printf(") {"); + m_body->dump(); + printf("}"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/foreach_statement.h b/src/cpp/eval/ast/foreach_statement.h new file mode 100644 index 0000000000000..ac94ded374bca --- /dev/null +++ b/src/cpp/eval/ast/foreach_statement.h @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_FOREACH_STATEMENT_H__ +#define __EVAL_FOREACH_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ForEachStatement); +DECLARE_AST_PTR(LvalExpression); +DECLARE_AST_PTR(Expression); + +class ForEachStatement : public Statement { +public: + ForEachStatement(STATEMENT_ARGS, ExpressionPtr source, LvalExpressionPtr key, + LvalExpressionPtr value, StatementPtr body); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_source; + LvalExpressionPtr m_key; + LvalExpressionPtr m_value; + StatementPtr m_body; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_FOREACH_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/function_call_expression.cpp b/src/cpp/eval/ast/function_call_expression.cpp new file mode 100644 index 0000000000000..72d10356dbed2 --- /dev/null +++ b/src/cpp/eval/ast/function_call_expression.cpp @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +FunctionCallExpression::FunctionCallExpression(EXPRESSION_ARGS, + const std::vector + ¶ms) + : Expression(EXPRESSION_PASS), m_params(params) {} + +Array FunctionCallExpression::getParams(VariableEnvironment &env) const { + Array params; + for (std::vector::const_iterator it = m_params.begin(); + it != m_params.end(); ++it) { + params.append(ref((*it)->refval(env))); + } + return params; +} + +void FunctionCallExpression::dumpParams() const { + printf("("); + dumpVector(m_params, ", "); + printf(")"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/function_call_expression.h b/src/cpp/eval/ast/function_call_expression.h new file mode 100644 index 0000000000000..ef6c933e61fe1 --- /dev/null +++ b/src/cpp/eval/ast/function_call_expression.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_FUNCTION_CALL_EXPRESSION_H__ +#define __EVAL_FUNCTION_CALL_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +class FunctionCallExpression : public Expression { +public: + const std::vector ¶ms() const { return m_params; } + Array getParams(VariableEnvironment &env) const; +protected: + FunctionCallExpression(EXPRESSION_ARGS, + const std::vector ¶ms); + std::vector m_params; + void dumpParams() const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_FUNCTION_CALL_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/function_statement.cpp b/src/cpp/eval/ast/function_statement.cpp new file mode 100644 index 0000000000000..b9b08ac72d316 --- /dev/null +++ b/src/cpp/eval/ast/function_statement.cpp @@ -0,0 +1,318 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +Parameter::Parameter(CONSTRUCT_ARGS, const string &type, + const string &name, int idx, bool ref, + ExpressionPtr defVal, int argNum) + : Construct(CONSTRUCT_PASS), m_type(type), + m_name(Name::fromString(CONSTRUCT_PASS, name)), m_defVal(defVal), + m_fnName(NULL), m_idx(idx), m_kind(KindOfNull), m_argNum(argNum), + m_ref(ref), m_nullDefault(false) { + if (!type.empty()) { + m_fnName = parser->peekFunc()->name().c_str(); + if (strcasecmp(type.c_str(), "array") == 0) { + m_kind = KindOfArray; + } else { + m_kind = KindOfObject; + if (strcasecmp(type.c_str(), "self") == 0 && parser->haveClass()) { + m_type = parser->peekClass()->name(); + } + } + if (m_defVal) { + ScalarExpressionPtr s = m_defVal->cast(); + bool correct = false; + if (s) { + DataType dtype = s->getValue().getType(); + correct = m_nullDefault = dtype == KindOfNull; + } else { + ArrayExpressionPtr a = m_defVal->cast(); + correct = a && m_kind == KindOfArray; + } + if (!correct) { + if (m_kind == KindOfArray) { + throw_fatal("Default value for parameters with array type hint can " + "only be an array or NULL"); + } else { + throw_fatal("Default value for parameters with a class type hint can" + " only be NULL"); + } + } + } + } +} + +void Parameter::bind(VariableEnvironment &env, CVarRef val, + bool ref /* = false */) const { + if (m_kind != KindOfNull) { + DataType otype = val.getType(); + if (!(m_nullDefault && otype == KindOfNull || + otype == m_kind && + (m_kind != KindOfObject || + m_kind == KindOfObject && + val.toObject().instanceof(m_type.c_str())))) { + throw_unexpected_argument_type(m_argNum, m_fnName, m_type.c_str(), val); + } + } + if (ref) val.setContagious(); + env.getIdx(m_idx) = val; +} + +void Parameter::bindDefault(VariableEnvironment &env) const { + if (m_defVal) { + Variant val = m_defVal->eval(env); + env.getIdx(m_idx) = val; + } +} + +void Parameter::dump() const { + if (!m_type.empty()) { + printf("%s ", m_type.c_str()); + } + if (m_ref) { + printf("&"); + } + m_name->dump(); + + if (m_defVal) { + printf(" = "); + m_defVal->dump(); + } +} + +void Parameter::getInfo(ClassInfo::ParameterInfo &info) const { + int attr = 0; + if (m_ref) { + attr |= ClassInfo::IsReference; + } + if (m_defVal) { + attr |= ClassInfo::IsOptional; + } + if (attr == 0) { + attr = ClassInfo::IsNothing; + } + info.attribute = (ClassInfo::Attribute)attr; + info.name = m_name->getStatic().c_str(); + info.type = m_type.c_str(); + info.value = NULL; + if (m_defVal) info.value = ""; +} + +bool Parameter::isOptional() const { + return m_defVal; +} + +FunctionStatement::FunctionStatement(STATEMENT_ARGS, const string &name, + const string &doc) + : Statement(STATEMENT_PASS), m_name(name), + m_lname(Util::toLower(m_name)), m_docComment(doc) { +} +FunctionStatement::~FunctionStatement() {} + +void FunctionStatement::init(bool ref, const vector params, + StatementListStatementPtr body, + bool has_call_to_get_args) { + m_ref = ref; + m_params = params; + m_body = body; + m_hasCallToGetArgs = has_call_to_get_args; +} + +const string &FunctionStatement::fullName() const { + return m_name; +} + +void FunctionStatement::changeName(const std::string &name) { + m_name = name; + m_lname = Util::toLower(name); +} + +void FunctionStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + // register with function_exists, invoke, etc. + RequestEvalState::declareFunction(this); +} + +Variant FunctionStatement::invoke(CArrRef params) const { + FuncScopeVariableEnvironment env(this, params.size()); + EvalFrameInjection fi("", m_name.c_str(), env, loc()->file); + if (m_ref) { + return ref(invokeImpl(env, params)); + } + Variant r = invokeImpl(env, params); + return r; +} + +void FunctionStatement::directBind(VariableEnvironment &env, + const FunctionCallExpression *caller, + FuncScopeVariableEnvironment &fenv) const { + vector::const_iterator piter = m_params.begin(); + const vector &args = caller->params(); + vector::const_iterator it = args.begin(); + ArgStack &as = RequestEvalState::argStack(); + for (; it != args.end() && piter != m_params.end(); ++it, ++piter) { + Variant v; + if ((*piter)->isRef() || (*it)->isRefParam()) { + // should throw if it's ref and not lval + v = ref((*it)->refval(env)); + (*piter)->bind(fenv, v, true); + } else { + v = (*it)->eval(env); + (*piter)->bind(fenv, v); + } + as.push(v); + fenv.incArgc(); + } + // more parameters than actual arguments + for (; piter != m_params.end(); ++piter) { + if (RuntimeOption::EnableStrict && !(*piter)->isOptional()) { + throw_strict(NotEnoughArgumentsException(name().c_str()), + StrictMode::StrictBasic); + } + (*piter)->bindDefault(fenv); + } + // more arguments than parameters + for (; it != args.end(); ++it) { + if (RuntimeOption::EnableStrict && !m_hasCallToGetArgs) { + throw_strict(TooManyArgumentsException(name().c_str()), + StrictMode::StrictBasic); + } + as.push((*it)->eval(env)); + fenv.incArgc(); + } +} + +Variant FunctionStatement::evalBody(VariableEnvironment &env) const { + if (m_body) { + m_body->eval(env); + if (env.isReturning()) { + if (m_ref) { + env.getRet().setContagious(); + } + return env.getRet(); + } else if (env.isBreaking()) { + throw FatalErrorException("Cannot break/continue out of function"); + } + } + return Variant(); +} + +// env is caller's env +Variant FunctionStatement::directInvoke(VariableEnvironment &env, + const FunctionCallExpression *caller) + const { + FuncScopeVariableEnvironment fenv(this, 0); + directBind(env, caller, fenv); + EvalFrameInjection fi("", m_name.c_str(), fenv, loc()->file); + if (m_ref) { + return ref(evalBody(fenv)); + } else { + return evalBody(fenv); + } +} + +LVariableTable *FunctionStatement::getStaticVars(VariableEnvironment &env) + const { + return &RequestEvalState::getFunctionStatics(this); +} + +Variant FunctionStatement::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + ArgStack &as = RequestEvalState::argStack(); + vector::const_iterator piter = m_params.begin(); + for (ArrayIter iter(params); !iter.end() && piter != m_params.end(); + ++piter, iter.next()) { + if ((*piter)->isRef()) { + (*piter)->bind(env, iter.secondRef(), true); + } else { + (*piter)->bind(env, iter.second()); + } + } + for (ArrayIter iter(params); !iter.end(); iter.next()) { + as.push(iter.second()); + } + for (; piter != m_params.end(); ++piter) { + (*piter)->bindDefault(env); + } + + if (m_ref) { + return ref(evalBody(env)); + } else { + return evalBody(env); + } +} + +void FunctionStatement::dump() const { + printf("function %s%s(", m_ref ? "&" : "", m_name.c_str()); + dumpVector(m_params, ", "); + printf(") {"); + if (m_body) m_body->dump(); + printf("}"); +} + +void FunctionStatement::getInfo(ClassInfo::MethodInfo &info) const { + info.attribute = m_ref ? ClassInfo::IsReference : ClassInfo::IsNothing; + info.name = m_name.c_str(); + if (!m_docComment.empty()) { + info.docComment = m_docComment.c_str(); + } + info.invokeFn = NULL; + info.invokeFailedFn = NULL; + for (vector::const_iterator it = m_params.begin(); + it != m_params.end(); ++it) { + ClassInfo::ParameterInfo *pi = new ClassInfo::ParameterInfo; + (*it)->getInfo(*pi); + info.parameters.push_back(pi); + } + DummyVariableEnvironment env; + for (map::const_iterator it = m_staticStmts.begin(); + it != m_staticStmts.end(); ++it) { + ClassInfo::ConstantInfo *ci = new ClassInfo::ConstantInfo; + ci->name = it->first.c_str(); + ci->valueLen = 12; + ci->valueText = "unsupported"; + if (it->second) { + ci->value = it->second->eval(env); + } + info.staticVariables.push_back(ci); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/function_statement.h b/src/cpp/eval/ast/function_statement.h new file mode 100644 index 0000000000000..251adaa9cc40e --- /dev/null +++ b/src/cpp/eval/ast/function_statement.h @@ -0,0 +1,107 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_AST_FUNCTION_STATEMENT_H__ +#define __EVAL_AST_FUNCTION_STATEMENT_H__ + +#include +#include +#include +#include + +#include + + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(StatementListStatement); +DECLARE_AST_PTR(Parameter); +DECLARE_AST_PTR(FunctionStatement); +DECLARE_AST_PTR(Expression); +DECLARE_AST_PTR(Name); +DECLARE_AST_PTR(StaticStatement); +class FunctionCallExpression; +class FuncScopeVariableEnvironment; + +class Parameter : public Construct { +public: + Parameter(CONSTRUCT_ARGS, const std::string &type, const std::string &name, + int idx, bool ref, ExpressionPtr defVal, int argNum); + bool isRef() const { return m_ref; } + void bind(VariableEnvironment &env, CVarRef val, bool ref = false) const; + void bindDefault(VariableEnvironment &env) const; + virtual void dump() const; + void getInfo(ClassInfo::ParameterInfo &info) const; + bool isOptional() const; +private: + std::string m_type; + NamePtr m_name; + ExpressionPtr m_defVal; + const char *m_fnName; + int m_idx; + DataType m_kind; + int m_argNum; + bool m_ref; + bool m_nullDefault; +}; + +class FunctionStatement : public Statement, public Block, public Function { +public: + FunctionStatement(STATEMENT_ARGS, const std::string &name, + const std::string &doc); + ~FunctionStatement(); + void init(bool ref, const std::vector params, + StatementListStatementPtr body, bool has_call_to_get_args); + const std::string &name() const { return m_name; } + const std::string &lname() const { return m_lname; } + void changeName(const std::string &name); + // Eval is called at declaration, not invocation + virtual void eval(VariableEnvironment &env) const; + Variant invoke(CArrRef params) const; + // Direct invoke is faster and gives access to the caller and its env + Variant directInvoke(VariableEnvironment &env, + const FunctionCallExpression *caller) const; + Variant invokeImpl(VariableEnvironment &env, CArrRef params) const; + virtual LVariableTable *getStaticVars(VariableEnvironment &env) const; + virtual void dump() const; + void getInfo(ClassInfo::MethodInfo &info) const; + bool refReturn() const { return m_ref; } + const std::vector& getParams() const { return m_params; } +protected: + bool m_ref; + std::string m_name; + std::string m_lname; + std::vector m_params; + + StatementListStatementPtr m_body; + bool m_hasCallToGetArgs; + + std::string m_docComment; + + virtual const std::string &fullName() const; + void directBind(VariableEnvironment &env, + const FunctionCallExpression *caller, + FuncScopeVariableEnvironment &fenv) const; + Variant evalBody(VariableEnvironment &env) const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_AST_FUNCTION_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/global_statement.cpp b/src/cpp/eval/ast/global_statement.cpp new file mode 100644 index 0000000000000..08b89df6ad418 --- /dev/null +++ b/src/cpp/eval/ast/global_statement.cpp @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +GlobalStatement::GlobalStatement(STATEMENT_ARGS, + const std::vector &vars) + : Statement(STATEMENT_PASS), m_vars(vars) {} +GlobalStatement::GlobalStatement(STATEMENT_ARGS) : Statement(STATEMENT_PASS) {} + +void GlobalStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + for (std::vector::const_iterator it = m_vars.begin(); + it != m_vars.end(); ++it) { + String n = (*it)->get(env); + env.flagGlobal(n.data(), (*it)->hash()); + } +} + +void GlobalStatement::dump() const { + printf("global "); + dumpVector(m_vars, ", "); + printf(";"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/global_statement.h b/src/cpp/eval/ast/global_statement.h new file mode 100644 index 0000000000000..71659b854c18a --- /dev/null +++ b/src/cpp/eval/ast/global_statement.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_GLOBAL_STATEMENT_H__ +#define __EVAL_GLOBAL_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(GlobalStatement); +DECLARE_AST_PTR(Name); + +class GlobalStatement : public Statement { +public: + GlobalStatement(STATEMENT_ARGS, const std::vector &vars); + GlobalStatement(STATEMENT_ARGS); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + std::vector m_vars; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_GLOBAL_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/if_statement.cpp b/src/cpp/eval/ast/if_statement.cpp new file mode 100644 index 0000000000000..b38b287b3a374 --- /dev/null +++ b/src/cpp/eval/ast/if_statement.cpp @@ -0,0 +1,80 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +IfBranch::IfBranch(CONSTRUCT_ARGS, ExpressionPtr cond, StatementPtr body) + : Construct(CONSTRUCT_PASS), m_cond(cond), m_body(body) {} + +bool IfBranch::proc(VariableEnvironment &env) const { + Variant cond = m_cond->eval(env); + if (cond) { + if (m_body) m_body->eval(env); + return true; + } + return false; +} + +Variant IfBranch::evalCond(VariableEnvironment &env) const { + return m_cond->eval(env); +} + +void IfBranch::dump() const { + printf("if ("); + m_cond->dump(); + printf(") {"); + if (m_body) m_body->dump(); + printf("}"); +} + +IfStatement::IfStatement(STATEMENT_ARGS, + const std::vector &branches, + StatementPtr els) + : Statement(STATEMENT_PASS), m_branches(branches), m_else(els) {} + +void IfStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + for (std::vector::const_iterator it = m_branches.begin(); + it != m_branches.end(); ++it) { + if ((*it)->evalCond(env)) { + if ((*it)->body()) { + EVAL_STMT((*it)->body(), env); + } + return; + } + } + if (m_else) EVAL_STMT(m_else, env); +} + +void IfStatement::dump() const { + dumpVector(m_branches, " else "); + if (m_else) { + printf(" else {"); + m_else->dump(); + printf("}"); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/if_statement.h b/src/cpp/eval/ast/if_statement.h new file mode 100644 index 0000000000000..eb945b1259d0a --- /dev/null +++ b/src/cpp/eval/ast/if_statement.h @@ -0,0 +1,57 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_IF_STATEMENT_H__ +#define __EVAL_IF_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(IfBranch); +DECLARE_AST_PTR(IfStatement); +DECLARE_AST_PTR(Expression); + +class IfBranch : public Construct { +public: + IfBranch(CONSTRUCT_ARGS, ExpressionPtr cond, StatementPtr body); + bool proc(VariableEnvironment &env) const; + virtual void dump() const; + Variant evalCond(VariableEnvironment &env) const; + const StatementPtr &body() { return m_body; } +private: + ExpressionPtr m_cond; + StatementPtr m_body; +}; + +class IfStatement : public Statement { +public: + IfStatement(STATEMENT_ARGS, const std::vector &branches, + StatementPtr els); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + std::vector m_branches; + StatementPtr m_else; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_IF_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/inc_op_expression.cpp b/src/cpp/eval/ast/inc_op_expression.cpp new file mode 100644 index 0000000000000..d3e41c10ee3c5 --- /dev/null +++ b/src/cpp/eval/ast/inc_op_expression.cpp @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +IncOpExpression::IncOpExpression(EXPRESSION_ARGS, LvalExpressionPtr exp, + bool inc, bool front) + : Expression(EXPRESSION_PASS), m_exp(exp), m_inc(inc), m_front(front) {} + +Variant IncOpExpression::eval(VariableEnvironment &env) const { + Variant &v = m_exp->lval(env); + if (m_inc) { + if (m_front) { + return ++v; + } else { + return v++; + } + } else { + if (m_front) { + return --v; + } else { + return v--; + } + } +} + +void IncOpExpression::dump() const { + if (m_front) { + if (m_inc) + printf("++"); + else + printf("--"); + } + m_exp->dump(); + if (!m_front) { + if (m_inc) + printf("++"); + else + printf("--"); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} + +} + diff --git a/src/cpp/eval/ast/inc_op_expression.h b/src/cpp/eval/ast/inc_op_expression.h new file mode 100644 index 0000000000000..cdb3d8c3b01ac --- /dev/null +++ b/src/cpp/eval/ast/inc_op_expression.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_INC_OP_EXPRESSION_H__ +#define __EVAL_INC_OP_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(IncOpExpression); +DECLARE_AST_PTR(LvalExpression); + +class IncOpExpression : public Expression { +public: + IncOpExpression(EXPRESSION_ARGS, LvalExpressionPtr exp, bool inc, bool front); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + LvalExpressionPtr m_exp; + bool m_inc; + bool m_front; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_INC_OP_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/include_expression.cpp b/src/cpp/eval/ast/include_expression.cpp new file mode 100644 index 0000000000000..e96927f8f5a2e --- /dev/null +++ b/src/cpp/eval/ast/include_expression.cpp @@ -0,0 +1,57 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +IncludeExpression::IncludeExpression(EXPRESSION_ARGS, bool include, bool once, + ExpressionPtr file) + : Expression(EXPRESSION_PASS), m_file(file), m_include(include), m_once(once) +{ + m_localDir = loc()->file; + size_t fileIdx = m_localDir.rfind('/'); + if (fileIdx == string::npos) { + m_localDir = ""; + } else { + m_localDir = m_localDir.substr(0, fileIdx); + } +} + +Variant IncludeExpression::eval(VariableEnvironment &env) const { + String file = m_file->eval(env).toString(); + if (m_include) { + return HPHP::include(file, m_once, &env, m_localDir.c_str()); + } else { + return HPHP::require(file, m_once, &env, m_localDir.c_str()); + } +} + +void IncludeExpression::dump() const { + printf("%s%s(", m_include ? "include" : "require", + m_once ? "_once" : ""); + m_file->dump(); + printf(")"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/include_expression.h b/src/cpp/eval/ast/include_expression.h new file mode 100644 index 0000000000000..7b20ebc5c4695 --- /dev/null +++ b/src/cpp/eval/ast/include_expression.h @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_AST_INCLUDE_EXPRESSION_H__ +#define __EVAL_AST_INCLUDE_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(IncludeExpression); + +class IncludeExpression : public Expression { +public: + IncludeExpression(EXPRESSION_ARGS, bool include, bool once, + ExpressionPtr file); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; + bool include() const { return m_include; } + bool once() const { return m_once; } +private: + ExpressionPtr m_file; + bool m_include; + bool m_once; + std::string m_localDir; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_AST_INCLUDE_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/instanceof_expression.cpp b/src/cpp/eval/ast/instanceof_expression.cpp new file mode 100644 index 0000000000000..dd4717ece9646 --- /dev/null +++ b/src/cpp/eval/ast/instanceof_expression.cpp @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +InstanceOfExpression::InstanceOfExpression(EXPRESSION_ARGS, ExpressionPtr obj, + NamePtr name) + : Expression(EXPRESSION_PASS), m_obj(obj), m_name(name) {} + +Variant InstanceOfExpression::eval(VariableEnvironment &env) const { + Variant obj = m_obj->eval(env); + String name = m_name->get(env); + return instanceOf(obj, name); +} + +void InstanceOfExpression::dump() const { + printf("instanceof("); + m_obj->dump(); + printf(", "); + m_name->dump(); + printf(")"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/instanceof_expression.h b/src/cpp/eval/ast/instanceof_expression.h new file mode 100644 index 0000000000000..ee2c2899a6011 --- /dev/null +++ b/src/cpp/eval/ast/instanceof_expression.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_INSTANCEOF_EXPRESSION_H__ +#define __EVAL_INSTANCEOF_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(InstanceOfExpression); +DECLARE_AST_PTR(Name); + +class InstanceOfExpression : public Expression { +public: + InstanceOfExpression(EXPRESSION_ARGS, ExpressionPtr obj, NamePtr name); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_obj; + NamePtr m_name; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_INSTANCEOF_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/isset_expression.cpp b/src/cpp/eval/ast/isset_expression.cpp new file mode 100644 index 0000000000000..dd23d5f279bdd --- /dev/null +++ b/src/cpp/eval/ast/isset_expression.cpp @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +IssetExpression::IssetExpression(EXPRESSION_ARGS, + const std::vector &exps) + : Expression(EXPRESSION_PASS), m_exps(exps) {} + +Variant IssetExpression::eval(VariableEnvironment &env) const { + for (vector::const_iterator it = m_exps.begin(); + it != m_exps.end(); ++it) { + if (!(*it)->exist(env, T_ISSET)) return false; + } + return true; +} + +void IssetExpression::dump() const { + printf("isset("); + dumpVector(m_exps, ", "); + printf(");"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/isset_expression.h b/src/cpp/eval/ast/isset_expression.h new file mode 100644 index 0000000000000..b9ece16a48d06 --- /dev/null +++ b/src/cpp/eval/ast/isset_expression.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_ISSET_EXPRESSION_H__ +#define __EVAL_ISSET_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(IssetExpression); + +class IssetExpression : public Expression { +public: + IssetExpression(EXPRESSION_ARGS, const std::vector &exps); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + std::vector m_exps; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_ISSET_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/list_assignment_expression.cpp b/src/cpp/eval/ast/list_assignment_expression.cpp new file mode 100644 index 0000000000000..b3bcf278751f4 --- /dev/null +++ b/src/cpp/eval/ast/list_assignment_expression.cpp @@ -0,0 +1,78 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ListElement::ListElement(CONSTRUCT_ARGS) : Construct(CONSTRUCT_PASS) {} + +LvalListElement::LvalListElement(CONSTRUCT_ARGS, LvalExpressionPtr lval) + : ListElement(CONSTRUCT_PASS), m_lval(lval) {} + +void LvalListElement::set(VariableEnvironment &env, CVarRef val) const { + if (m_lval) m_lval->lval(env) = val; +} + +void LvalListElement::dump() const { + if (m_lval) m_lval->dump(); +} + +SubListElement::SubListElement(CONSTRUCT_ARGS, + const std::vector &elems) + : ListElement(CONSTRUCT_PASS), m_elems(elems) {} + +void SubListElement::set(VariableEnvironment &env, CVarRef val) const { + for (int i = m_elems.size() - 1; i >= 0; i--) { + const ListElementPtr &le = m_elems[i]; + if (le) { + le->set(env, val.rvalAt(i)); + } + } +} + +void SubListElement::dump() const { + Construct::dumpVector(m_elems, ", "); +} + +ListAssignmentExpression::ListAssignmentExpression(EXPRESSION_ARGS, + ListElementPtr lhs, + ExpressionPtr rhs) + : Expression(EXPRESSION_PASS), m_lhs(lhs), m_rhs(rhs) {} + +Variant ListAssignmentExpression::eval(VariableEnvironment &env) const { + Variant rhs = m_rhs->eval(env); + Variant val; + if (rhs.is(KindOfArray)) { + val = rhs; + } + m_lhs->set(env, val); + return rhs; +} + +void ListAssignmentExpression::dump() const { + printf("list("); + m_lhs->dump(); + printf(") = "); + m_rhs->dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/list_assignment_expression.h b/src/cpp/eval/ast/list_assignment_expression.h new file mode 100644 index 0000000000000..ba525da2cb750 --- /dev/null +++ b/src/cpp/eval/ast/list_assignment_expression.h @@ -0,0 +1,69 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_LIST_ASSIGNMENT_EXPRESSION_H__ +#define __EVAL_LIST_ASSIGNMENT_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ListElement); +DECLARE_AST_PTR(ListAssignmentExpression); + +class ListElement : public Construct { +public: + ListElement(CONSTRUCT_ARGS); + virtual void set(VariableEnvironment &env, CVarRef val) const = 0; +}; + +class LvalListElement : public ListElement { +public: + LvalListElement(CONSTRUCT_ARGS, LvalExpressionPtr lval); + virtual void set(VariableEnvironment &env, CVarRef val) const; + virtual void dump() const; +private: + LvalExpressionPtr m_lval; +}; + +class SubListElement : public ListElement { +public: + SubListElement(CONSTRUCT_ARGS, const std::vector &elems); + virtual void set(VariableEnvironment &env, CVarRef val) const; + virtual void dump() const; +private: + std::vector m_elems; +}; + +class ListAssignmentExpression : public Expression { +public: + ListAssignmentExpression(EXPRESSION_ARGS, ListElementPtr lhs, + ExpressionPtr rhs); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ListElementPtr m_lhs; + ExpressionPtr m_rhs; +}; + + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_LIST_ASSIGNMENT_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/lval_expression.cpp b/src/cpp/eval/ast/lval_expression.cpp new file mode 100644 index 0000000000000..b62de50b920ce --- /dev/null +++ b/src/cpp/eval/ast/lval_expression.cpp @@ -0,0 +1,93 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +LvalExpression::LvalExpression(EXPRESSION_ARGS) : Expression(EXPRESSION_PASS) +{} + +Variant LvalExpression::set(VariableEnvironment &env, CVarRef val) const { + return lval(env) = val; +} + +Variant LvalExpression::setOpVariant(Variant &lhs, int op, CVarRef rhs) const { + switch (op) { + case T_PLUS_EQUAL: + lhs += rhs; + break; + case T_MINUS_EQUAL: + lhs -= rhs; + break; + case T_MUL_EQUAL: + lhs *= rhs; + break; + case T_DIV_EQUAL: + lhs /= rhs; + break; + case T_CONCAT_EQUAL: + concat_assign(lhs, rhs); + break; + case T_MOD_EQUAL: + lhs %= rhs; + break; + case T_AND_EQUAL: + lhs &= rhs; + break; + case T_OR_EQUAL: + lhs |= rhs; + break; + case T_XOR_EQUAL: + lhs ^= rhs; + break; + case T_SL_EQUAL: + lhs <<= rhs; + break; + case T_SR_EQUAL: + lhs >>= rhs; + break; + default: + ASSERT(false); + } + return lhs; +} + +Variant LvalExpression::setOp(VariableEnvironment &env, int op, CVarRef rhs) + const { + Variant &lhs = lval(env); + return setOpVariant(lhs, op, rhs); +} + +void LvalExpression::unset(VariableEnvironment &env) const { + lval(env).unset(); +} + +Variant LvalExpression::refval(VariableEnvironment &env) const { + return ref(lval(env)); +} + +const LvalExpression *LvalExpression::toLval() const { + return this; +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/lval_expression.h b/src/cpp/eval/ast/lval_expression.h new file mode 100644 index 0000000000000..dcbcd330ac611 --- /dev/null +++ b/src/cpp/eval/ast/lval_expression.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_AST_LVAL_EXPRESSION_H__ +#define __EVAL_AST_LVAL_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(LvalExpression); + +class LvalExpression : public Expression { +public: + LvalExpression(EXPRESSION_ARGS); + virtual Variant eval(VariableEnvironment &env) const + { return lval(env); } + virtual Variant &lval(VariableEnvironment &env) const = 0; + virtual bool weakLval(VariableEnvironment &env, Variant* &v) const { + v = &lval(env); + return true; + } + virtual Variant refval(VariableEnvironment &env) const; + virtual Variant set(VariableEnvironment &env, CVarRef val) const; + virtual Variant setOp(VariableEnvironment &env, int op, CVarRef rhs) const; + virtual Variant setOpVariant(Variant &lhs, int op, CVarRef rhs) const; + virtual void unset(VariableEnvironment &env) const; + virtual const LvalExpression *toLval() const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_AST_LVAL_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/method_statement.cpp b/src/cpp/eval/ast/method_statement.cpp new file mode 100644 index 0000000000000..da80faffb094c --- /dev/null +++ b/src/cpp/eval/ast/method_statement.cpp @@ -0,0 +1,155 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +MethodStatement::MethodStatement(STATEMENT_ARGS, const string &name, + const ClassStatement *cls, int modifiers, + const string &doc) + : FunctionStatement(STATEMENT_PASS, name, doc), m_class(cls), + m_modifiers(modifiers) { + m_fullName = cls->name() + "::" + name; +} + +const string &MethodStatement::fullName() const { + return m_fullName; +} + +void MethodStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + // register with reflection, invoke, etc. +} + +LVariableTable *MethodStatement::getStaticVars(VariableEnvironment &env) + const { + return &RequestEvalState::getMethodStatics(this, env.currentClass()); +} + +Variant MethodStatement::invokeInstance(CObjRef obj, + CArrRef params) const { + // The debug frame should have been pushed at ObjectMethodExpression + MethScopeVariableEnvironment env(this, params.size()); + env.setCurrentObject(obj); + EvalFrameInjection fi(m_class->name().c_str(), m_fullName.c_str(), env, + loc()->file, obj.get()); + if (m_ref) { + return ref(invokeImpl(env, params)); + } + return invokeImpl(env, params); +} + +Variant MethodStatement:: +invokeInstanceDirect(CObjRef obj, VariableEnvironment &env, + const FunctionCallExpression *caller) const { + attemptAccess(env.currentContext()); + MethScopeVariableEnvironment fenv(this, 0); + directBind(env, caller, fenv); + fenv.setCurrentObject(obj); + EvalFrameInjection fi(m_class->name().c_str(), m_fullName.c_str(), fenv, + loc()->file, obj.get()); + if (m_ref) { + return ref(evalBody(fenv)); + } + return evalBody(fenv); +} + +Variant MethodStatement::invokeStatic(const char* cls, CArrRef params) const { + MethScopeVariableEnvironment env(this, params.size()); + // Debug frame pushad at StaticMethodExpression + env.setCurrentClass(cls); + EvalFrameInjection fi(m_class->name().c_str(), m_fullName.c_str(), env, + loc()->file); + if (m_ref) { + return ref(invokeImpl(env, params)); + } + return invokeImpl(env, params); +} + +Variant MethodStatement:: +invokeStaticDirect(const char* cls, VariableEnvironment &env, + const FunctionCallExpression *caller) + const { + attemptAccess(env.currentContext()); + MethScopeVariableEnvironment fenv(this, 0); + directBind(env, caller, fenv); + fenv.setCurrentClass(cls); + EvalFrameInjection fi(m_class->name().c_str(), m_fullName.c_str(), fenv, + loc()->file); + if (m_ref) { + return ref(evalBody(fenv)); + } + return evalBody(fenv); +} + +void MethodStatement::getInfo(ClassInfo::MethodInfo &info) const { + FunctionStatement::getInfo(info); + int attr = info.attribute == ClassInfo::IsNothing ? 0 : info.attribute; + if (m_modifiers & ClassStatement::Abstract) attr |= ClassInfo::IsAbstract; + if (m_modifiers & ClassStatement::Final) attr |= ClassInfo::IsFinal; + if (m_modifiers & ClassStatement::Protected) attr |= ClassInfo::IsProtected; + if (m_modifiers & ClassStatement::Private) attr |= ClassInfo::IsPrivate; + if (m_modifiers & ClassStatement::Static) attr |= ClassInfo::IsStatic; + if (!(attr & ClassStatement::Protected || attr & ClassStatement::Private)) + attr |= ClassInfo::IsPublic; + info.attribute = (ClassInfo::Attribute)attr; +} + +void MethodStatement::attemptAccess(const char *context) const { + int mods = getModifiers(); + const ClassStatement *cs = getClass(); + ClassStatement::Modifier level = ClassStatement::Public; + if (mods & ClassStatement::Private) level = ClassStatement::Private; + else if (mods & ClassStatement::Protected) level = ClassStatement::Protected; + bool access = true; + if (level == ClassStatement::Protected) { + while (!cs->hasAccess(context, level)) { + while ((cs = cs->parentStatement())) { + if (cs->findMethod(m_name.c_str())) { + break; + } + } + if (!cs) { + access = false; + break; + } + } + } else { + access = cs->hasAccess(context, level); + } + if (!access) { + string msg("Attempt to call "); + if (level == ClassStatement::Private) msg += "private "; + else msg += string("protected "); + msg += cs->name() + "::" + m_name.c_str() + "()"; + if (context[0]) msg += string(" from ") + context; + throw_fatal(msg.c_str()); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/method_statement.h b/src/cpp/eval/ast/method_statement.h new file mode 100644 index 0000000000000..7752cf4d2da5a --- /dev/null +++ b/src/cpp/eval/ast/method_statement.h @@ -0,0 +1,58 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_AST_METHOD_STATEMENT_H__ +#define __EVAL_AST_METHOD_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(MethodStatement); +class ClassStatement; + +class MethodStatement : public FunctionStatement { +public: + MethodStatement(STATEMENT_ARGS, const std::string &name, + const ClassStatement *cls, int modifiers, + const std::string &doc); + // Eval is called at declaration, not invocation + virtual void eval(VariableEnvironment &env) const; + Variant invokeInstance(CObjRef obj, CArrRef params) const; + Variant invokeStatic(const char* cls, CArrRef params) const; + Variant invokeInstanceDirect(CObjRef obj, VariableEnvironment &env, + const FunctionCallExpression *caller) const; + Variant invokeStaticDirect(const char* cls, VariableEnvironment &env, + const FunctionCallExpression *caller) const; + void getInfo(ClassInfo::MethodInfo &info) const; + virtual LVariableTable *getStaticVars(VariableEnvironment &env) const; + const ClassStatement *getClass() const { return m_class; } + int getModifiers() const { return m_modifiers; } + void attemptAccess(const char *context) const; +private: + const ClassStatement *m_class; + int m_modifiers; + std::string m_fullName; + virtual const std::string &fullName() const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_AST_METHOD_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/name.cpp b/src/cpp/eval/ast/name.cpp new file mode 100644 index 0000000000000..d412369127e05 --- /dev/null +++ b/src/cpp/eval/ast/name.cpp @@ -0,0 +1,85 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +Name::Name(CONSTRUCT_ARGS) : Construct(CONSTRUCT_PASS) {} + +int64 Name::hash() const { + return -1; +} +int64 Name::hashLwr() const { + return -1; +} + +NamePtr Name::fromString(CONSTRUCT_ARGS, const string &name) { + return NamePtr(new StringName(CONSTRUCT_PASS, name)); +} + +NamePtr Name::fromExp(CONSTRUCT_ARGS, ExpressionPtr e) { + return NamePtr(new ExprName(CONSTRUCT_PASS, e)); +} + +StringName::StringName(CONSTRUCT_ARGS, const string &name) + : Name(CONSTRUCT_PASS), m_name(name), + m_hash(hash_string(m_name.c_str(), m_name.size())), + m_hashLwr(hash_string_i(m_name.c_str(), m_name.size())) {} + +String StringName::get(VariableEnvironment &env) const { + return getStatic(); +} + +String StringName::getStatic() const { + return String(m_name.c_str(), m_name.size(), AttachLiteral); +} + +int64 StringName::hash() const { + return m_hash; +} +int64 StringName::hashLwr() const { + return m_hashLwr; +} + + +void StringName::dump() const { + printf("%s", m_name.c_str()); +} + +ExprName::ExprName(CONSTRUCT_ARGS, ExpressionPtr name) + : Name(CONSTRUCT_PASS), m_name(name) {} + +String ExprName::get(VariableEnvironment &env) const { + return m_name->eval(env).toString(); +} + +void ExprName::dump() const { + printf("${"); + m_name->dump(); + printf("}"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/name.h b/src/cpp/eval/ast/name.h new file mode 100644 index 0000000000000..a9dff176e52e6 --- /dev/null +++ b/src/cpp/eval/ast/name.h @@ -0,0 +1,68 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_NAME_H__ +#define __EVAL_NAME_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(Name); +DECLARE_AST_PTR(Expression); +class VariableEnvironment; + +class Name : public Construct { +public: + Name(CONSTRUCT_ARGS); + virtual String get(VariableEnvironment &env) const = 0; + virtual int64 hash() const; + virtual int64 hashLwr() const; + virtual String getStatic() const { return String(); } + static NamePtr fromString(CONSTRUCT_ARGS, const std::string &name); + static NamePtr fromExp(CONSTRUCT_ARGS, ExpressionPtr e); +}; + +class StringName : public Name { +public: + StringName(CONSTRUCT_ARGS, const std::string &name); + virtual String get(VariableEnvironment &env) const; + virtual int64 hash() const; + virtual int64 hashLwr() const; + virtual String getStatic() const; + virtual void dump() const; +private: + std::string m_name; + int64 m_hash; + int64 m_hashLwr; +}; + +class ExprName : public Name { +public: + ExprName(CONSTRUCT_ARGS, ExpressionPtr name); + virtual String get(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_name; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_NAME_H__ */ diff --git a/src/cpp/eval/ast/new_object_expression.cpp b/src/cpp/eval/ast/new_object_expression.cpp new file mode 100644 index 0000000000000..38f15f7b82be2 --- /dev/null +++ b/src/cpp/eval/ast/new_object_expression.cpp @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +NewObjectExpression::NewObjectExpression(EXPRESSION_ARGS, NamePtr name, + const std::vector ¶ms) + : FunctionCallExpression(EXPRESSION_PASS, params), m_name(name) {} + +Variant NewObjectExpression::eval(VariableEnvironment &env) const { + SET_LINE; + String name = m_name->get(env); + Array params = getParams(env); + return create_object(name.data(), params); +} + +void NewObjectExpression::dump() const { + printf("new "); + m_name->dump(); + dumpParams(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/new_object_expression.h b/src/cpp/eval/ast/new_object_expression.h new file mode 100644 index 0000000000000..7d54ef39fb743 --- /dev/null +++ b/src/cpp/eval/ast/new_object_expression.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_NEW_OBJECT_EXPRESSION_H__ +#define __EVAL_NEW_OBJECT_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(NewObjectExpression); +DECLARE_AST_PTR(Name); + +class NewObjectExpression : public FunctionCallExpression { +public: + NewObjectExpression(EXPRESSION_ARGS, NamePtr name, + const std::vector ¶ms); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + NamePtr m_name; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_NEW_OBJECT_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/object_method_expression.cpp b/src/cpp/eval/ast/object_method_expression.cpp new file mode 100644 index 0000000000000..d89e466501516 --- /dev/null +++ b/src/cpp/eval/ast/object_method_expression.cpp @@ -0,0 +1,68 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ObjectMethodExpression::ObjectMethodExpression(EXPRESSION_ARGS, + ExpressionPtr obj, NamePtr name, + std::vector param) + : SimpleFunctionCallExpression(EXPRESSION_PASS, name, param), m_obj(obj) {} + +Variant ObjectMethodExpression::eval(VariableEnvironment &env) const { + SET_LINE; + String name = m_name->get(env); + Object obj = toObject(m_obj->eval(env)); + Variant cobj = env.currentObject(); + const MethodStatement *ms = NULL; + if (cobj.is(KindOfObject) && obj.get() == cobj.getObjectData()) { + // Have to try current class first for private method + const ClassStatement *cls = env.currentClassStatement(); + if (cls) { + const MethodStatement *ccms = cls->findMethod(name.c_str()); + if (ccms && ccms->getModifiers() & ClassStatement::Private) { + ms = ccms; + } + } + } + if (!ms) { + ms = obj->getMethodStatement(name.data()); + } + if (ms) { + return ref(ms->invokeInstanceDirect(obj, env, this)); + } + return ref(obj->o_invoke_from_eval(name.data(), env, this, + m_name->hashLwr(), true)); +} + +void ObjectMethodExpression::dump() const { + m_obj->dump(); + printf("->"); + SimpleFunctionCallExpression::dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/object_method_expression.h b/src/cpp/eval/ast/object_method_expression.h new file mode 100644 index 0000000000000..aabdf0f525afb --- /dev/null +++ b/src/cpp/eval/ast/object_method_expression.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_AST_OBJECT_METHOD_EXPRESSION_H__ +#define __EVAL_AST_OBJECT_METHOD_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ObjectMethodExpression); +DECLARE_AST_PTR(Name); + +class ObjectMethodExpression : public SimpleFunctionCallExpression { +public: + ObjectMethodExpression(EXPRESSION_ARGS, ExpressionPtr obj, NamePtr name, + std::vector params); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_obj; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_AST_OBJECT_METHOD_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/object_property_expression.cpp b/src/cpp/eval/ast/object_property_expression.cpp new file mode 100644 index 0000000000000..b276893af7d80 --- /dev/null +++ b/src/cpp/eval/ast/object_property_expression.cpp @@ -0,0 +1,157 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ObjectPropertyExpression::ObjectPropertyExpression(EXPRESSION_ARGS, + ExpressionPtr obj, + NamePtr name) + : LvalExpression(EXPRESSION_PASS), m_obj(obj), m_name(name) { +} + +Variant ObjectPropertyExpression::eval(VariableEnvironment &env) const { + Object obj = toObject(m_obj->eval(env)); + String name = m_name->get(env); + return obj.o_get(name, m_name->hash()); +} + +Variant &ObjectPropertyExpression::lval(VariableEnvironment &env) const { + // How annoying. Sometimes object is an lval and should be treated as such + // and sometimes it isn't eg method call. + const LvalExpression *lobj = m_obj->toLval(); + if (lobj) { + Variant &lv = lobj->lval(env); + String name = m_name->get(env); + return HPHP::lval(lv.o_lval(name, m_name->hash())); + } else { + Variant obj = m_obj->eval(env); + String name = m_name->get(env); + return HPHP::lval(obj.o_lval(name, m_name->hash())); + } +} + +bool ObjectPropertyExpression::weakLval(VariableEnvironment &env, + Variant* &v) const { + Variant vobj = m_obj->eval(env); + if (vobj.is(KindOfObject)) { + Object obj = toObject(vobj); + String name = m_name->get(env); + if (obj->o_exists(name, m_name->hash())) { + v = &HPHP::lval(obj.o_lval(name, m_name->hash())); + return true; + } + } + return false; +} + + +Variant ObjectPropertyExpression::set(VariableEnvironment &env, CVarRef val) + const { + const LvalExpression *lobj = m_obj->toLval(); + if (lobj) { + Variant &lv = lobj->lval(env); + String name = m_name->get(env); + lv.o_lval(name, m_name->hash()) = val; + } else { + Variant obj = m_obj->eval(env); + String name = m_name->get(env); + obj.o_lval(name, m_name->hash()) = val; + } + return val; +} + +Variant ObjectPropertyExpression::setOp(VariableEnvironment &env, int op, + CVarRef rhs) const { + Variant *vobj; + Variant obj; + const LvalExpression *lobj = m_obj->toLval(); + if (lobj) { + vobj = &lobj->lval(env); + } else { + obj = m_obj->eval(env); + vobj = &obj; + } + String name = m_name->get(env); + switch (op) { + case T_PLUS_EQUAL: + vobj->o_lval(name, m_name->hash()) += rhs; + break; + case T_MINUS_EQUAL: + vobj->o_lval(name, m_name->hash()) -= rhs; + break; + case T_MUL_EQUAL: + vobj->o_lval(name, m_name->hash()) *= rhs; + break; + case T_DIV_EQUAL: + vobj->o_lval(name, m_name->hash()) /= rhs; + break; + case T_CONCAT_EQUAL: + concat_assign(vobj->o_lval(name, m_name->hash()), rhs); + break; + case T_MOD_EQUAL: + vobj->o_lval(name, m_name->hash()) %= rhs; + break; + case T_AND_EQUAL: + vobj->o_lval(name, m_name->hash()) &= rhs; + break; + case T_OR_EQUAL: + vobj->o_lval(name, m_name->hash()) |= rhs; + break; + case T_XOR_EQUAL: + vobj->o_lval(name, m_name->hash()) ^= rhs; + break; + case T_SL_EQUAL: + vobj->o_lval(name, m_name->hash()) <<= rhs; + break; + case T_SR_EQUAL: + vobj->o_lval(name, m_name->hash()) >>= rhs; + break; + default: + ASSERT(false); + } + return rhs; +} + +bool ObjectPropertyExpression::isset(VariableEnvironment &env) const { + Object obj = toObject(m_obj->eval(env)); + String name = m_name->get(env); + return obj->t___isset(name); +} +void ObjectPropertyExpression::unset(VariableEnvironment &env) const { + Object obj = toObject(m_obj->eval(env)); + String name = m_name->get(env); + obj->t___unset(name); +} + +NamePtr ObjectPropertyExpression::getProperty() const { return m_name; } + +void ObjectPropertyExpression::dump() const { + m_obj->dump(); + printf("->"); + m_name->dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/object_property_expression.h b/src/cpp/eval/ast/object_property_expression.h new file mode 100644 index 0000000000000..99f977145c072 --- /dev/null +++ b/src/cpp/eval/ast/object_property_expression.h @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_OBJECT_PROPERTY_EXPRESSION_H__ +#define __EVAL_OBJECT_PROPERTY_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ObjectPropertyExpression); +DECLARE_AST_PTR(Name); + +class ObjectPropertyExpression : public LvalExpression { +public: + ObjectPropertyExpression(EXPRESSION_ARGS, ExpressionPtr obj, NamePtr name); + virtual Variant eval(VariableEnvironment &env) const; + virtual Variant &lval(VariableEnvironment &env) const; + virtual bool weakLval(VariableEnvironment &env, Variant* &v) const; + virtual Variant set(VariableEnvironment &env, CVarRef val) const; + virtual bool isset(VariableEnvironment &env) const; + virtual void unset(VariableEnvironment &env) const; + virtual Variant setOp(VariableEnvironment &env, int op, CVarRef rhs) const; + ExpressionPtr getObject() { return m_obj; } + NamePtr getProperty() const; + virtual void dump() const; +private: + ExpressionPtr m_obj; + NamePtr m_name; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_OBJECT_PROPERTY_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/qop_expression.cpp b/src/cpp/eval/ast/qop_expression.cpp new file mode 100644 index 0000000000000..7d52acab8ab42 --- /dev/null +++ b/src/cpp/eval/ast/qop_expression.cpp @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +QOpExpression::QOpExpression(EXPRESSION_ARGS, ExpressionPtr cond, + ExpressionPtr t, ExpressionPtr f) + : Expression(EXPRESSION_PASS), m_cond(cond), m_true(t), m_false(f) {} + +Variant QOpExpression::eval(VariableEnvironment &env) const { + Variant cond = m_cond->eval(env); + if (cond) { + return m_true->eval(env); + } else { + return m_false->eval(env); + } +} + +void QOpExpression::dump() const { + m_cond->dump(); + printf(" ? "); + m_true->dump(); + printf(" : "); + m_false->dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/qop_expression.h b/src/cpp/eval/ast/qop_expression.h new file mode 100644 index 0000000000000..c69e8117dd334 --- /dev/null +++ b/src/cpp/eval/ast/qop_expression.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_QOP_EXPRESSION_H__ +#define __EVAL_QOP_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(QOpExpression); + +class QOpExpression : public Expression { +public: + QOpExpression(EXPRESSION_ARGS, ExpressionPtr cond, ExpressionPtr t, + ExpressionPtr f); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_cond; + ExpressionPtr m_true; + ExpressionPtr m_false; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/ref_param_expression.cpp b/src/cpp/eval/ast/ref_param_expression.cpp new file mode 100644 index 0000000000000..cb9fe7cf84e87 --- /dev/null +++ b/src/cpp/eval/ast/ref_param_expression.cpp @@ -0,0 +1,61 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +RefParamExpression::RefParamExpression(EXPRESSION_ARGS, LvalExpressionPtr lv) + : LvalExpression(EXPRESSION_PASS), m_lv(lv) {} + +Variant &RefParamExpression::lval(VariableEnvironment &env) const { + return m_lv->lval(env); +} + +bool RefParamExpression::weakLval(VariableEnvironment &env, Variant* &v) const { + return m_lv->weakLval(env, v); +} + +Variant RefParamExpression::refval(VariableEnvironment &env) const { + return m_lv->refval(env); +} + +Variant RefParamExpression::set(VariableEnvironment &env, CVarRef val) const { + return m_lv->set(env, val); +} + +Variant RefParamExpression::setOp(VariableEnvironment &env, int op, + CVarRef rhs) const { + return m_lv->setOp(env, op, rhs); +} + +void RefParamExpression::unset(VariableEnvironment &env) const { + m_lv->unset(env); +} + +void RefParamExpression::dump() const { + printf("&"); + m_lv->dump(); +} + +bool RefParamExpression::isRefParam() const { + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +} +} diff --git a/src/cpp/eval/ast/ref_param_expression.h b/src/cpp/eval/ast/ref_param_expression.h new file mode 100644 index 0000000000000..28e18a4527101 --- /dev/null +++ b/src/cpp/eval/ast/ref_param_expression.h @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_AST_REF_PARAM_EXPRESSION_H__ +#define __EVAL_AST_REF_PARAM_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(RefParamExpression); + +class RefParamExpression : public LvalExpression { +public: + RefParamExpression(EXPRESSION_ARGS, LvalExpressionPtr lv); + virtual Variant &lval(VariableEnvironment &env) const; + virtual bool weakLval(VariableEnvironment &env, Variant* &v) const; + virtual Variant refval(VariableEnvironment &env) const; + virtual Variant set(VariableEnvironment &env, CVarRef val) const; + virtual Variant setOp(VariableEnvironment &env, int op, CVarRef rhs) const; + virtual void unset(VariableEnvironment &env) const; + virtual void dump() const; + virtual bool isRefParam() const; +private: + LvalExpressionPtr m_lv; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_AST_REF_PARAM_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/return_statement.cpp b/src/cpp/eval/ast/return_statement.cpp new file mode 100644 index 0000000000000..38e1d99f24a33 --- /dev/null +++ b/src/cpp/eval/ast/return_statement.cpp @@ -0,0 +1,54 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ReturnStatement::ReturnStatement(STATEMENT_ARGS, ExpressionPtr value) + : Statement(STATEMENT_PASS), m_value(value) {} + +void ReturnStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + if (m_value) { + if (env.refReturn()) { + env.setRet(ref(m_value->refval(env))); + return; + } + env.setRet(m_value->eval(env)); + return; + } + env.setRet(); +} + +void ReturnStatement::dump() const { + printf("return"); + if (m_value) { + printf(" "); + m_value->dump(); + } + printf(";"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/return_statement.h b/src/cpp/eval/ast/return_statement.h new file mode 100644 index 0000000000000..13afc4815e23b --- /dev/null +++ b/src/cpp/eval/ast/return_statement.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_RETURN_STATEMENT_H__ +#define __EVAL_RETURN_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ReturnStatement); +DECLARE_AST_PTR(Expression); + +class ReturnStatement : public Statement { +public: + ReturnStatement(STATEMENT_ARGS, ExpressionPtr value); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_value; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_RETURN_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/scalar_expression.cpp b/src/cpp/eval/ast/scalar_expression.cpp new file mode 100644 index 0000000000000..9af26f285815e --- /dev/null +++ b/src/cpp/eval/ast/scalar_expression.cpp @@ -0,0 +1,114 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +ScalarExpression::ScalarExpression(EXPRESSION_ARGS, int type, + const string &value) + : Expression(EXPRESSION_PASS), m_value(value) { + switch (type) { + case T_NUM_STRING: { + const char *s = m_value.c_str(); + if (!((*s == '0' && m_value.size() == 1) || ('1' <= *s && *s <= '9'))) { + // Offset must be treated as a string + m_kind = SString; + break; + } + m_kind = SInt; + // fall through + } + case T_LNUMBER: { + m_num.num = strtoll(m_value.c_str(), NULL, 0); + m_kind = SInt; + break; + } + case T_DNUMBER: { + m_num.dbl = String(m_value).toDouble(); + m_kind = SDouble; + break; + } + case T_STRING : + m_kind = SString; + break; + default: + ASSERT(false); + } +} + +ScalarExpression::ScalarExpression(EXPRESSION_ARGS) + : Expression(EXPRESSION_PASS), m_kind(SNull) {} +ScalarExpression::ScalarExpression(EXPRESSION_ARGS, bool b) + : Expression(EXPRESSION_PASS), m_kind(SBool) { + m_num.num = b ? 1 : 0; +} +ScalarExpression::ScalarExpression(EXPRESSION_ARGS, const string &s) + : Expression(EXPRESSION_PASS), m_value(s), m_kind(SString) +{} + +Variant ScalarExpression::eval(VariableEnvironment &env) const { + return getValue(); +} + +Variant ScalarExpression::getValue() const { + switch (m_kind) { + case SNull: + return null_variant; + case SBool: + return (bool)m_num.num; + case SString: + return String(m_value.c_str(), m_value.size(), AttachLiteral); + case SInt: + return m_num.num; + case SDouble: + return m_num.dbl; + default: + ASSERT(false); + } + return Variant(); +} + +void ScalarExpression::dump() const { + switch (m_kind) { + case SNull: + printf("NULL"); + break; + case SBool: + printf("%s", m_num.num ? "true" : "false"); + break; + case SString: + printf("\"%s\"", m_value.c_str()); + break; + case SInt: + printf("%lld", m_num.num); + break; + case SDouble: + printf("%f", m_num.dbl); + break; + default: + ASSERT(false); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/scalar_expression.h b/src/cpp/eval/ast/scalar_expression.h new file mode 100644 index 0000000000000..4e625b35e3a67 --- /dev/null +++ b/src/cpp/eval/ast/scalar_expression.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_SCALAR_EXPRESSION_H__ +#define __EVAL_SCALAR_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ScalarExpression); + +class ScalarExpression : public Expression { +public: + ScalarExpression(EXPRESSION_ARGS); + ScalarExpression(EXPRESSION_ARGS, bool b); + ScalarExpression(EXPRESSION_ARGS, const std::string &s); + ScalarExpression(EXPRESSION_ARGS, int type, const std::string &val); + virtual Variant eval(VariableEnvironment &env) const; + Variant getValue() const; + virtual void dump() const; + const std::string &getString() const { return m_value; } +private: + enum Kind { + SNull, + SBool, + SInt, + SDouble, + SString + }; + std::string m_value; + union { + int64 num; + double dbl; + } m_num; + Kind m_kind; + bool m_quoted; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_SCALAR_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/simple_function_call_expression.cpp b/src/cpp/eval/ast/simple_function_call_expression.cpp new file mode 100644 index 0000000000000..7a729de83b712 --- /dev/null +++ b/src/cpp/eval/ast/simple_function_call_expression.cpp @@ -0,0 +1,100 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +SimpleFunctionCallExpression::SimpleFunctionCallExpression +(EXPRESSION_ARGS, NamePtr name, const std::vector ¶ms) : + FunctionCallExpression(EXPRESSION_PASS, params), m_name(name) {} + +Variant SimpleFunctionCallExpression::eval(VariableEnvironment &env) const { + SET_LINE; + String name = m_name->get(env); + bool renamed = false; + { + // so hacky, gotta do this properly by overriding rename_function. + hphp_const_char_map &funcs = get_renamed_functions(); + hphp_const_char_map::const_iterator iter = + funcs.find(name.data()); + if (iter != funcs.end()) { + name = iter->second; + renamed = true; + } + } + // fast path for interpreted fn + const Function *fs = RequestEvalState::findFunction(name.c_str()); + if (fs) { + return ref(fs->directInvoke(env, this)); + } else { + //Array params = getParams(env); + // Super gross but what can I do + //return ref(invoke(name.data(), params, renamed ? -1 : m_name->hashLwr())); + return ref(invoke_from_eval(name.data(), env, this, + renamed ? -1 : m_name->hashLwr())); + } + + /* + Array params = getParams(env); + // Super gross but what can I do + return ref(invoke(name.data(), params, m_name->hashLwr())); + */ +} + +void SimpleFunctionCallExpression::dump() const { + m_name->dump(); + dumpParams(); +} + +ExpressionPtr +SimpleFunctionCallExpression::make(EXPRESSION_ARGS, NamePtr name, + const vector ¶ms, + const Parser &p) { + String sname = StringUtil::ToLower(name->getStatic()); + if (!sname.isNull()) { + if (sname == "get_class" && params.size() == 0) { + if (p.currentClass()) { + return new ScalarExpression(EXPRESSION_PASS, p.currentClass()->name()); + } else { + return new ScalarExpression(EXPRESSION_PASS, false); + } + } else if (sname == "get_parent_class" && params.size() == 0) { + if (p.currentClass() && !p.currentClass()->parent().empty()) { + return new ScalarExpression(EXPRESSION_PASS, + p.currentClass()->parent()); + } else { + return new ScalarExpression(EXPRESSION_PASS, false); + } + } + } + return new SimpleFunctionCallExpression(EXPRESSION_PASS, name, params); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/simple_function_call_expression.h b/src/cpp/eval/ast/simple_function_call_expression.h new file mode 100644 index 0000000000000..fbd990266ddfa --- /dev/null +++ b/src/cpp/eval/ast/simple_function_call_expression.h @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_SIMPLE_FUNCTION_CALL_EXPRESSION_H__ +#define __EVAL_SIMPLE_FUNCTION_CALL_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(SimpleFunctionCallExpression); +DECLARE_AST_PTR(Name); +class Parser; + +class SimpleFunctionCallExpression : public FunctionCallExpression { +public: + SimpleFunctionCallExpression(EXPRESSION_ARGS, NamePtr name, + const std::vector ¶ms); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; + // Not quite sure if this is the right place + static ExpressionPtr make(EXPRESSION_ARGS, NamePtr name, + const std::vector ¶ms, + const Parser &p); +protected: + NamePtr m_name; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_FUNCTION_CALL_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/statement.h b/src/cpp/eval/ast/statement.h new file mode 100644 index 0000000000000..3a7fa4b53f887 --- /dev/null +++ b/src/cpp/eval/ast/statement.h @@ -0,0 +1,64 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_STATEMENT_H__ +#define __EVAL_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(Statement); + +#define STATEMENT_ARGS CONSTRUCT_ARGS +#define STATEMENT_PASS CONSTRUCT_PASS + +class Statement : public Construct { +public: + Statement(STATEMENT_ARGS) : Construct(CONSTRUCT_PASS) {}; + virtual void eval(VariableEnvironment &env) const = 0; +}; + +#define EVAL_STMT(stmt, env) \ + { \ + (stmt)->eval(env); \ + if (env.isEscaping()) return; \ + } +#define EVAL_STMT_HANDLE_BREAK(stmt, env) \ + { \ + (stmt)->eval(env); \ + int hb = env.handleBreak(); \ + if (hb == 1 || env.isReturning()) return; \ + if (hb == 2) break; \ + } +#define EVAL_STMT_HANDLE_BREAK_CONT(stmt, env) \ + { \ + (stmt)->eval(env); \ + int hb = env.handleBreak(); \ + if (hb == 1 || env.isReturning()) return; \ + if (hb == 2 || hb == 3) break; \ + } + +#define ENTER_STMT \ + SET_LINE + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/statement_list_statement.cpp b/src/cpp/eval/ast/statement_list_statement.cpp new file mode 100644 index 0000000000000..10ac3adcdf47f --- /dev/null +++ b/src/cpp/eval/ast/statement_list_statement.cpp @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +StatementListStatement:: +StatementListStatement(STATEMENT_ARGS, const std::vector &stmts) + : Statement(STATEMENT_PASS), m_stmts(stmts) {} +StatementListStatement::StatementListStatement(STATEMENT_ARGS) + : Statement(STATEMENT_PASS) {} + +void StatementListStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + for (vector::const_iterator it = m_stmts.begin(); + it != m_stmts.end(); ++it) { + EVAL_STMT(*it, env); + } +} + +void StatementListStatement::add(StatementPtr stmt) { + m_stmts.push_back(stmt); +} + +void StatementListStatement::dump() const { + dumpVector(m_stmts, " "); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/statement_list_statement.h b/src/cpp/eval/ast/statement_list_statement.h new file mode 100644 index 0000000000000..9df23a5462708 --- /dev/null +++ b/src/cpp/eval/ast/statement_list_statement.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_STATEMENT_LIST_STATEMENT_H__ +#define __EVAL_STATEMENT_LIST_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(StatementListStatement); + +class StatementListStatement : public Statement { +public: + StatementListStatement(STATEMENT_ARGS, + const std::vector &stmts); + StatementListStatement(STATEMENT_ARGS); + virtual void eval(VariableEnvironment &env) const; + void add(StatementPtr stmt); + const std::vector &stmts() const { return m_stmts; } + virtual void dump() const; +private: + std::vector m_stmts; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_STATEMENT_LIST_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/static_member_expression.cpp b/src/cpp/eval/ast/static_member_expression.cpp new file mode 100644 index 0000000000000..24b63ea2a8c3b --- /dev/null +++ b/src/cpp/eval/ast/static_member_expression.cpp @@ -0,0 +1,53 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace std; + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +StaticMemberExpression::StaticMemberExpression(EXPRESSION_ARGS, + const string &cls, + NamePtr variable) + : LvalExpression(EXPRESSION_PASS), m_class(cls), + m_variable(variable) {} + +Variant &StaticMemberExpression::lval(VariableEnvironment &env) const { + String variable = m_variable->get(env); + Variant *lv = get_static_property_lv(m_class.c_str(), variable.data()); + if (lv) { + return *lv; + } + ostringstream msg; + msg << "static member " << m_class << "::$" << variable.data() << + " does not exist"; + throw FatalErrorException(msg.str().c_str()); +} + +void StaticMemberExpression::dump() const { + printf("%s::", m_class.c_str()); + m_variable->dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/static_member_expression.h b/src/cpp/eval/ast/static_member_expression.h new file mode 100644 index 0000000000000..99b9f55fd2f13 --- /dev/null +++ b/src/cpp/eval/ast/static_member_expression.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_STATIC_MEMBER_EXPRESSION_H__ +#define __EVAL_STATIC_MEMBER_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(StaticMemberExpression); +DECLARE_AST_PTR(Name); + +class StaticMemberExpression : public LvalExpression { +public: + StaticMemberExpression(EXPRESSION_ARGS, const std::string &cls, + NamePtr variable); + virtual Variant &lval(VariableEnvironment &env) const; + virtual void dump() const; +private: + std::string m_class; + NamePtr m_variable; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_STATIC_MEMBER_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/static_method_expression.cpp b/src/cpp/eval/ast/static_method_expression.cpp new file mode 100644 index 0000000000000..3b394cb6d585d --- /dev/null +++ b/src/cpp/eval/ast/static_method_expression.cpp @@ -0,0 +1,67 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +StaticMethodExpression:: +StaticMethodExpression(EXPRESSION_ARGS, const string &cname, + NamePtr &name, + const vector ¶ms) : + SimpleFunctionCallExpression(EXPRESSION_PASS, name, params), m_cname(cname) {} + +Variant StaticMethodExpression::eval(VariableEnvironment &env) const { + SET_LINE; + // Static method expressions can be object method expressions inside + // of a method when an object is available and the object's class inherits. + // Super slow. + String name = m_name->get(env); + Object co = env.currentObject(); + bool foundClass; + const MethodStatement *ms = RequestEvalState::findMethod(m_cname.data(), + name.data(), + foundClass); + if (ms) { + if (!co.isNull() && co->o_instanceof(m_cname.data())) { + return ref(ms->invokeInstanceDirect(co, env, this)); + } + return ref(ms->invokeStaticDirect(m_cname.data(), env, this)); + } + Array params = getParams(env); + if (!co.isNull() && co->o_instanceof(m_cname.data())) { + return ref(co->o_invoke_ex(m_cname.data(), name.data(), params, + m_name->hashLwr())); + } + return ref(invoke_static_method(m_cname.data(), name.data(), params)); +} + +void StaticMethodExpression::dump() const { + printf("%s::", m_cname.c_str()); + SimpleFunctionCallExpression::dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/static_method_expression.h b/src/cpp/eval/ast/static_method_expression.h new file mode 100644 index 0000000000000..4c1a403e24bcb --- /dev/null +++ b/src/cpp/eval/ast/static_method_expression.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_STATIC_METHOD_EXPRESSION_H__ +#define __EVAL_STATIC_METHOD_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(StaticMethodExpression); +DECLARE_AST_PTR(Name); + +class StaticMethodExpression : public SimpleFunctionCallExpression { +public: + StaticMethodExpression(EXPRESSION_ARGS, const std::string &cname, + NamePtr &name, + const std::vector ¶ms); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +protected: + std::string m_cname; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_STATIC_METHOD_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/static_statement.cpp b/src/cpp/eval/ast/static_statement.cpp new file mode 100644 index 0000000000000..5a16a8ab9384f --- /dev/null +++ b/src/cpp/eval/ast/static_statement.cpp @@ -0,0 +1,70 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +StaticVariable::StaticVariable(CONSTRUCT_ARGS, const string &name, + ExpressionPtr val) + : Construct(CONSTRUCT_PASS), m_name(Name::fromString(CONSTRUCT_PASS, name)), + m_val(val) {} + +void StaticVariable::set(VariableEnvironment &env) const { + env.flagStatic(m_name->get(env), m_name->hash()); +} + +void StaticVariable::dump() const { + m_name->dump(); + if (m_val) { + printf(" = "); + m_val->dump(); + } +} + +const NamePtr &StaticVariable::name() { + return m_name; +} + +StaticStatement::StaticStatement(STATEMENT_ARGS, + const std::vector &vars) + : Statement(STATEMENT_PASS), m_vars(vars) {} + + +void StaticStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + for (std::vector::const_iterator it = m_vars.begin(); + it != m_vars.end(); ++it) { + (*it)->set(env); + } +} + +void StaticStatement::dump() const { + printf("static "); + dumpVector(m_vars, ", "); + printf(";"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/static_statement.h b/src/cpp/eval/ast/static_statement.h new file mode 100644 index 0000000000000..06f69cd22d3dc --- /dev/null +++ b/src/cpp/eval/ast/static_statement.h @@ -0,0 +1,57 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_STATIC_STATEMENT_H__ +#define __EVAL_STATIC_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(StaticVariable); +DECLARE_AST_PTR(StaticStatement); +DECLARE_AST_PTR(Expression); +DECLARE_AST_PTR(Name); + +class StaticVariable : public Construct { +public: + StaticVariable(CONSTRUCT_ARGS, const std::string &name, ExpressionPtr val); + void set(VariableEnvironment &env) const; + virtual void dump() const; + const NamePtr &name(); + const ExpressionPtr &val() { return m_val; } +private: + NamePtr m_name; + ExpressionPtr m_val; +}; + +class StaticStatement : public Statement { +public: + StaticStatement(STATEMENT_ARGS, const std::vector &vars); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; + const std::vector &vars() const { return m_vars; } +private: + std::vector m_vars; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_STATIC_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/strong_foreach_statement.cpp b/src/cpp/eval/ast/strong_foreach_statement.cpp new file mode 100644 index 0000000000000..04a8c22c79f1b --- /dev/null +++ b/src/cpp/eval/ast/strong_foreach_statement.cpp @@ -0,0 +1,66 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +StrongForEachStatement:: +StrongForEachStatement(STATEMENT_ARGS, LvalExpressionPtr source, + LvalExpressionPtr key, LvalExpressionPtr value, + StatementPtr body) : + Statement(STATEMENT_PASS), m_source(source), m_key(key), m_value(value), + m_body(body) +{} + +void StrongForEachStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + Variant source = ref(m_source->lval(env)); + source.escalate(); + Variant &v = m_value->lval(env); + Variant *k = NULL; + if (m_key) { + k = &m_key->lval(env); + } + for (MutableArrayIterPtr iter = source.begin(k, v); iter->advance();) { + if (!m_body) continue; + EVAL_STMT_HANDLE_BREAK(m_body, env); + } +} + +void StrongForEachStatement::dump() const { + printf("foreach ("); + m_source->dump(); + printf(" as "); + if (m_key) { + m_key->dump(); + printf(" => "); + } + printf("&"); + m_value->dump(); + printf(") {"); + if (m_body) m_body->dump(); + printf("}"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/strong_foreach_statement.h b/src/cpp/eval/ast/strong_foreach_statement.h new file mode 100644 index 0000000000000..ae586747c0818 --- /dev/null +++ b/src/cpp/eval/ast/strong_foreach_statement.h @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_STRONG_FOREACH_STATEMENT_H__ +#define __EVAL_STRONG_FOREACH_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(StrongForEachStatement); +DECLARE_AST_PTR(LvalExpression); + +class StrongForEachStatement : public Statement { +public: + StrongForEachStatement(STATEMENT_ARGS, LvalExpressionPtr source, + LvalExpressionPtr key, + LvalExpressionPtr value, StatementPtr body); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + LvalExpressionPtr m_source; + LvalExpressionPtr m_key; + LvalExpressionPtr m_value; + StatementPtr m_body; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_STRONG_FOREACH_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/switch_statement.cpp b/src/cpp/eval/ast/switch_statement.cpp new file mode 100644 index 0000000000000..9bb7ac1ede598 --- /dev/null +++ b/src/cpp/eval/ast/switch_statement.cpp @@ -0,0 +1,94 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace std; + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +CaseStatement::CaseStatement(STATEMENT_ARGS, ExpressionPtr match, + StatementPtr body) + : Statement(STATEMENT_PASS), m_match(match), m_body(body) {} + +bool CaseStatement::match(VariableEnvironment &env, CVarRef value) const { + ASSERT(m_match); + Variant match = m_match->eval(env); + return equal(match, value); +} + +void CaseStatement::eval(VariableEnvironment &env) const { + if (m_body) m_body->eval(env); +} + +bool CaseStatement::isDefault() const { + return !m_match; +} + +void CaseStatement::dump() const { + if (m_match) { + printf("case "); + m_match->dump(); + } else { + printf("default"); + } + printf(": "); + m_body->dump(); +} + +SwitchStatement::SwitchStatement(STATEMENT_ARGS, ExpressionPtr source, + const std::vector &cases) + : Statement(STATEMENT_PASS), m_source(source), m_cases(cases) {} + +void SwitchStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + Variant source = m_source->eval(env); + bool matched = false; + vector::const_iterator defaultPos = m_cases.end(); + for (vector::const_iterator iter = m_cases.begin(); + iter != m_cases.end(); ++iter) { + if ((*iter)->isDefault()) { + defaultPos = iter; + } else if (!matched && (*iter)->match(env, source)) { + matched = true; + } + if (matched) { + EVAL_STMT_HANDLE_BREAK_CONT(*iter, env); + } + } + if (!matched && defaultPos != m_cases.end()) { + for (; defaultPos != m_cases.end(); ++defaultPos) { + EVAL_STMT_HANDLE_BREAK_CONT(*defaultPos, env); + } + } +} + +void SwitchStatement::dump() const { + printf("switch ("); + m_source->dump(); + printf(") {"); + dumpVector(m_cases, " "); + printf("}"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/switch_statement.h b/src/cpp/eval/ast/switch_statement.h new file mode 100644 index 0000000000000..51fa25bc92f6e --- /dev/null +++ b/src/cpp/eval/ast/switch_statement.h @@ -0,0 +1,60 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_SWITCH_STATEMENT_H__ +#define __EVAL_SWITCH_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(CaseStatement); +DECLARE_AST_PTR(SwitchStatement); +DECLARE_AST_PTR(Expression); + +/** + * Not sure if this should really be a statement + */ +class CaseStatement : public Statement { +public: + CaseStatement(STATEMENT_ARGS, ExpressionPtr match, StatementPtr body); + bool match(VariableEnvironment &env, CVarRef value) const; + virtual void eval(VariableEnvironment &env) const; + bool isDefault() const; + virtual void dump() const; +private: + ExpressionPtr m_match; + StatementPtr m_body; +}; + +class SwitchStatement : public Statement { +public: + SwitchStatement(STATEMENT_ARGS, ExpressionPtr source, + const std::vector &cases); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_source; + std::vector m_cases; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_SWITCH_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/this_expression.cpp b/src/cpp/eval/ast/this_expression.cpp new file mode 100644 index 0000000000000..deb1108bcb1a3 --- /dev/null +++ b/src/cpp/eval/ast/this_expression.cpp @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ThisExpression::ThisExpression(EXPRESSION_ARGS) + : LvalExpression(EXPRESSION_PASS) {} + +Variant &ThisExpression::lval(VariableEnvironment &env) const { + return env.currentObject(); +} + +Variant ThisExpression::set(VariableEnvironment &env, CVarRef val) const { + throw FatalErrorException("Cannot re-assign $this"); +} + +void ThisExpression::dump() const { + printf("$this"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/this_expression.h b/src/cpp/eval/ast/this_expression.h new file mode 100644 index 0000000000000..b62981c188e9c --- /dev/null +++ b/src/cpp/eval/ast/this_expression.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_THIS_EXPRESSION_H__ +#define __EVAL_THIS_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ThisExpression); + +class ThisExpression : public LvalExpression { +public: + ThisExpression(EXPRESSION_ARGS); + virtual Variant &lval(VariableEnvironment &env) const; + virtual Variant set(VariableEnvironment &env, CVarRef val) const; + virtual void dump() const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_THIS_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/throw_statement.cpp b/src/cpp/eval/ast/throw_statement.cpp new file mode 100644 index 0000000000000..000ce57bfa43e --- /dev/null +++ b/src/cpp/eval/ast/throw_statement.cpp @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +ThrowStatement::ThrowStatement(STATEMENT_ARGS, ExpressionPtr value) + : Statement(STATEMENT_PASS), m_value(value) {} + +void ThrowStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + throw m_value->eval(env).toObject(); +} + +void ThrowStatement::dump() const { + printf("throw "); + m_value->dump(); + printf(";"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/throw_statement.h b/src/cpp/eval/ast/throw_statement.h new file mode 100644 index 0000000000000..98f299c1a900f --- /dev/null +++ b/src/cpp/eval/ast/throw_statement.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_THROW_STATEMENT_H__ +#define __EVAL_THROW_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ThrowStatement); +DECLARE_AST_PTR(Expression); + +class ThrowStatement : public Statement { +public: + ThrowStatement(STATEMENT_ARGS, ExpressionPtr value); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_value; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_THROW_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/try_statement.cpp b/src/cpp/eval/ast/try_statement.cpp new file mode 100644 index 0000000000000..345dd19fe2f54 --- /dev/null +++ b/src/cpp/eval/ast/try_statement.cpp @@ -0,0 +1,85 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +CatchBlock::CatchBlock(CONSTRUCT_ARGS, const string &ename, + const string &vname, StatementPtr body) + : Construct(CONSTRUCT_PASS), m_ename(ename), + m_vname(vname), m_body(body) {} + +bool CatchBlock::match(CObjRef exn) const { + return exn.instanceof(m_ename.c_str()); +} + +bool CatchBlock::proc(CObjRef exn, VariableEnvironment &env) const { + if (exn.instanceof(m_ename.c_str())) { + if (m_body) { + env.get(m_vname) = exn; + m_body->eval(env); + } + return true; + } + return false; +} + +void CatchBlock::dump() const { + printf("catch (%s %s) {", m_ename.c_str(), m_vname.c_str()); + if (m_body) m_body->dump(); + printf("}"); +} + +TryStatement::TryStatement(STATEMENT_ARGS, StatementPtr body, + const std::vector &catches) + : Statement(STATEMENT_PASS), m_catches(catches), m_body(body) {} + +void TryStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + try { + m_body->eval(env); + } catch (Object e) { + for (vector::const_iterator it = m_catches.begin(); + it != m_catches.end(); ++it) { + if ((*it)->match(e)) { + if ((*it)->body()) { + env.get((*it)->vname()) = e; + EVAL_STMT((*it)->body(), env); + } + return; + } + } + throw e; + } +} + +void TryStatement::dump() const { + printf("try {"); + m_body->dump(); + printf("}"); + dumpVector(m_catches, " "); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/try_statement.h b/src/cpp/eval/ast/try_statement.h new file mode 100644 index 0000000000000..887de96cdbf63 --- /dev/null +++ b/src/cpp/eval/ast/try_statement.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_TRY_STATEMENT_H__ +#define __EVAL_TRY_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(CatchBlock); +DECLARE_AST_PTR(TryStatement); + +class CatchBlock : public Construct { +public: + CatchBlock(CONSTRUCT_ARGS, const std::string &ename, const std::string &vname, + StatementPtr body); + bool proc(CObjRef exn, VariableEnvironment &env) const; + bool match(CObjRef exn) const; + const StatementPtr &body() const { return m_body; } + const std::string &vname() const { return m_vname; } + virtual void dump() const; +private: + std::string m_ename; + std::string m_vname; + StatementPtr m_body; +}; + +class TryStatement : public Statement { +public: + TryStatement(STATEMENT_ARGS, StatementPtr body, + const std::vector &catches); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + std::vector m_catches; + StatementPtr m_body; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_TRY_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/unary_op_expression.cpp b/src/cpp/eval/ast/unary_op_expression.cpp new file mode 100644 index 0000000000000..e699bfb797eae --- /dev/null +++ b/src/cpp/eval/ast/unary_op_expression.cpp @@ -0,0 +1,109 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +UnaryOpExpression::UnaryOpExpression(EXPRESSION_ARGS, ExpressionPtr exp, + int op, bool front) + : Expression(EXPRESSION_PASS), m_exp(exp), m_op(op), m_front(front) {} + +Variant UnaryOpExpression::eval(VariableEnvironment &env) const { + if (m_op == '@') { + silenceInc(); + return silenceDec(m_exp->eval(env)); + } else if (m_op == T_ISSET || m_op == T_EMPTY) { + return m_exp->exist(env, m_op); + } + + Variant exp; + if (m_exp) exp = m_exp->eval(env); + switch (m_op) { + case T_CLONE: return f_clone(exp); + case '+': return +exp; + case '-': return negate(exp); + case '!': return !exp; + case '~': return ~exp; + case '(': return exp; + case T_INT_CAST: return toInt64(exp); + case T_DOUBLE_CAST: return toDouble(exp); + case T_STRING_CAST: return toString(exp); + case T_ARRAY_CAST: return toArray(exp); + case T_OBJECT_CAST: return toObject(exp); + case T_BOOL_CAST: return toBoolean(exp); + case T_UNSET_CAST: return unset(exp); + case T_EXIT: return f_exit(exp); + case T_PRINT: return print(exp.toString()); + case T_EVAL: return HPHP::eval(&env, env.currentObject(), exp); + default: + ASSERT(false); + return Variant(); + } +} + +void UnaryOpExpression::dump() const { + if (m_op == '(') { + printf("("); + m_exp->dump(); + printf(")"); + return; + } + if (m_front) { + dumpOp(); + } + m_exp->dump(); + if (!m_front) { + dumpOp(); + } +} + +void UnaryOpExpression::dumpOp() const { + const char* op = ""; + switch (m_op) { + case '@': op = "@"; break; + case T_ISSET: op = "isset "; break; + case T_CLONE: op = "clone "; break; + case '+': op = "+"; break; + case '-': op = "-"; break; + case '!': op = "!"; break; + case '~': op = "~"; break; + case T_INT_CAST: op = "(int)"; break; + case T_DOUBLE_CAST: op = "(double)"; break; + case T_STRING_CAST: op = "(string)"; break; + case T_ARRAY_CAST: op = "(array)"; break; + case T_OBJECT_CAST: op = "(object)"; break; + case T_BOOL_CAST: op = "(bool)"; break; + case T_UNSET_CAST: op = "(unset)"; break; + case T_EXIT: op = "exit "; break; + case T_PRINT: op = "print "; break; + case T_EMPTY: op = "empty "; break; + case T_EVAL: op = "eval "; break; + } + printf("%s", op); +} + +/////////////////////////////////////////////////////////////////////////////// +} + +} + diff --git a/src/cpp/eval/ast/unary_op_expression.h b/src/cpp/eval/ast/unary_op_expression.h new file mode 100644 index 0000000000000..6a2e0b735ac7a --- /dev/null +++ b/src/cpp/eval/ast/unary_op_expression.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_UNARY_OP_EXPRESSION_H__ +#define __EVAL_UNARY_OP_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(UnaryOpExpression); + +class UnaryOpExpression : public Expression { +public: + UnaryOpExpression(EXPRESSION_ARGS, ExpressionPtr exp, int op, bool front); + virtual Variant eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_exp; + int m_op; + bool m_front; + void dumpOp() const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_UNARY_OP_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/unset_statement.cpp b/src/cpp/eval/ast/unset_statement.cpp new file mode 100644 index 0000000000000..be90590820fcf --- /dev/null +++ b/src/cpp/eval/ast/unset_statement.cpp @@ -0,0 +1,54 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +UnsetStatement::UnsetStatement(STATEMENT_ARGS, + const std::vector &vals) + : Statement(STATEMENT_PASS) { + m_vals.reserve(vals.size()); + for (std::vector::const_iterator it = vals.begin(); + it != vals.end(); ++it) { + LvalExpressionPtr lv = (*it)->cast(); + ASSERT(lv); + m_vals.push_back(lv); + } +} + +void UnsetStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + for (std::vector::const_iterator it = m_vals.begin(); + it != m_vals.end(); ++it) { + (*it)->unset(env); + } +} + +void UnsetStatement::dump() const { + printf("unset("); + dumpVector(m_vals, ", "); + printf(");"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/unset_statement.h b/src/cpp/eval/ast/unset_statement.h new file mode 100644 index 0000000000000..6e1345b99d0dd --- /dev/null +++ b/src/cpp/eval/ast/unset_statement.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_UNSET_STATEMENT_H__ +#define __EVAL_UNSET_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(UnsetStatement); +DECLARE_AST_PTR(Expression); +DECLARE_AST_PTR(LvalExpression); + +class UnsetStatement : public Statement { +public: + UnsetStatement(STATEMENT_ARGS, const std::vector &vals); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + std::vector m_vals; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_UNSET_STATEMENT_H__ */ diff --git a/src/cpp/eval/ast/variable_expression.cpp b/src/cpp/eval/ast/variable_expression.cpp new file mode 100644 index 0000000000000..deabc8aa3efc3 --- /dev/null +++ b/src/cpp/eval/ast/variable_expression.cpp @@ -0,0 +1,114 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +VariableExpression::VariableExpression(EXPRESSION_ARGS, NamePtr name, + int idx /* = -1 */) + : LvalExpression(EXPRESSION_PASS), m_name(name), m_idx(idx) {} + +Variant VariableExpression::eval(VariableEnvironment &env) const { + Variant &lhs = lval(env); + if (RuntimeOption::EnableStrict) { + /* note that 'if (!env.exists(str, name->hash()))' does not work + * as undefined local variables are still in the (function) environment */ + if (!lhs.isInitialized()) { + throw_strict(UseOfUndefinedVarException(this->loc()->toString()), + StrictMode::StrictBasic, + true); + } + } + return lhs; +} + +bool checkCompatibleAssignment(const Variant &left, const Variant &right) { + bool ok = true; + if (left.isNull()) { + // everything is ok with NULL + } else if (left.isBoolean()) { + ok = right.isBoolean(); + } else if (left.isNumeric()) { + ok = right.isNumeric(); + } else if (left.isString()) { + ok = right.isString(); + } else if (left.isArray()) { + ok = right.isArray(); + } else if (left.isObject()) { + //TODO? check class of right derives from class of left ? + ok = right.isObject(); + } else { + ASSERT(false); + } + return ok; +} + +Variant VariableExpression::set(VariableEnvironment &env, CVarRef val) const { + Variant &lhs = lval(env); + if (RuntimeOption::EnableStrict) { + if (!checkCompatibleAssignment(lhs, val)) { + throw_strict(TypeVariableChangeException(this->loc()->toString()), + StrictMode::StrictHardCore); + } + } + return lhs = val; +} + +Variant VariableExpression::setOp(VariableEnvironment &env, int op, CVarRef rhs) + const { + Variant &lhs = lval(env); + if (RuntimeOption::EnableStrict) { + if (!checkCompatibleAssignment(lhs, rhs)) { + throw_strict(TypeVariableChangeException(this->loc()->toString()), + StrictMode::StrictHardCore); + } + } + return LvalExpression::setOpVariant(lhs, op, rhs); +} + +Variant &VariableExpression::lval(VariableEnvironment &env) const { + if (m_idx != -1) { + return env.getIdx(m_idx); + } + String name = m_name->get(env); + return env.get(name, m_name->hash()); +} + +void VariableExpression::unset(VariableEnvironment &env) const { + String name = m_name->get(env); + env.unset(name, m_name->hash()); +} + +NamePtr VariableExpression::getName() const { + return m_name; +} + +void VariableExpression::dump() const { + printf("$"); + m_name->dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/variable_expression.h b/src/cpp/eval/ast/variable_expression.h new file mode 100644 index 0000000000000..377fbd24274ec --- /dev/null +++ b/src/cpp/eval/ast/variable_expression.h @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_VARIABLE_EXPRESSION_H__ +#define __EVAL_VARIABLE_EXPRESSION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(VariableExpression); +DECLARE_AST_PTR(Name); + +class VariableExpression : public LvalExpression { +public: + VariableExpression(EXPRESSION_ARGS, NamePtr name, int idx = -1); + virtual Variant eval(VariableEnvironment &env) const; + virtual Variant &lval(VariableEnvironment &env) const; + virtual void unset(VariableEnvironment &env) const; + virtual Variant set(VariableEnvironment &env, CVarRef val) const; + virtual Variant setOp(VariableEnvironment &env, int op, CVarRef rhs) const; + NamePtr getName() const; + virtual void dump() const; +private: + NamePtr m_name; + int m_idx; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_VARIABLE_EXPRESSION_H__ */ diff --git a/src/cpp/eval/ast/while_statement.cpp b/src/cpp/eval/ast/while_statement.cpp new file mode 100644 index 0000000000000..f70cba30b6ab9 --- /dev/null +++ b/src/cpp/eval/ast/while_statement.cpp @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +WhileStatement::WhileStatement(STATEMENT_ARGS, ExpressionPtr cond, + StatementPtr body) + : Statement(STATEMENT_PASS), m_cond(cond), m_body(body) {} + +void WhileStatement::eval(VariableEnvironment &env) const { + ENTER_STMT; + while (m_cond->eval(env)) { + if (!m_body) continue; + EVAL_STMT_HANDLE_BREAK(m_body, env); + } +} + +void WhileStatement::dump() const { + printf("while ("); + m_cond->dump(); + printf(") {"); + if (m_body) m_body->dump(); + printf("}"); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/ast/while_statement.h b/src/cpp/eval/ast/while_statement.h new file mode 100644 index 0000000000000..6f734759ccdcf --- /dev/null +++ b/src/cpp/eval/ast/while_statement.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_WHILE_STATEMENT_H__ +#define __EVAL_WHILE_STATEMENT_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(WhileStatement); +DECLARE_AST_PTR(Expression); + +class WhileStatement : public Statement { +public: + WhileStatement(STATEMENT_ARGS, ExpressionPtr cond, StatementPtr body); + virtual void eval(VariableEnvironment &env) const; + virtual void dump() const; +private: + ExpressionPtr m_cond; + StatementPtr m_body; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_WHILE_STATEMENT_H__ */ diff --git a/src/cpp/eval/base/ast_ptr.h b/src/cpp/eval/base/ast_ptr.h new file mode 100644 index 0000000000000..862357018c77f --- /dev/null +++ b/src/cpp/eval/base/ast_ptr.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_AST_PTR_H__ +#define __HPHP_AST_PTR_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +#define DECLARE_AST_PTR(cls) \ + class cls; \ + typedef AstPtr cls##Ptr + +template +class AstPtr : public SmartPtr { +public: + AstPtr() : SmartPtr() {} + template + AstPtr(Y v) : SmartPtr(v) {} + + operator bool() const { return this->m_px; } + + template + AstPtr &operator=(Y px) { + SmartPtr::operator=(px); + return *this; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif // __HPHP_AST_PTR_H__ diff --git a/src/cpp/eval/base/eval_base.h b/src/cpp/eval/base/eval_base.h new file mode 100644 index 0000000000000..b482cdfb2ceb4 --- /dev/null +++ b/src/cpp/eval/base/eval_base.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_BASE_H__ +#define __EVAL_BASE_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +class VariableEnvironment; + +struct Location { + const char *file; + int line1; + int char1; + String toString() const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_BASE_H__ */ diff --git a/src/cpp/eval/base/function.h b/src/cpp/eval/base/function.h new file mode 100644 index 0000000000000..c2ea97e6a7df6 --- /dev/null +++ b/src/cpp/eval/base/function.h @@ -0,0 +1,54 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_BASE_FUNCTION_H__ +#define __EVAL_BASE_FUNCTION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +class VariableEnvironment; +class FunctionCallExpression; + +class Function { +public: + virtual ~Function() {} + virtual Variant invoke(CArrRef params) const = 0; + virtual Variant directInvoke(VariableEnvironment &env, + const FunctionCallExpression *caller) const = 0; +}; + +extern Variant invoke_from_eval(const char *function, + VariableEnvironment &env, + const FunctionCallExpression *caller, + int64 hash = -1, + bool fatal = true); + +extern Variant invoke_from_eval_builtin(const char *function, + VariableEnvironment &env, + const FunctionCallExpression *caller, + int64 hash = -1, + bool fatal = true); + + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_BASE_FUNCTION_H__ */ diff --git a/src/cpp/eval/eval.cpp b/src/cpp/eval/eval.cpp new file mode 100644 index 0000000000000..c3b20ef49ca04 --- /dev/null +++ b/src/cpp/eval/eval.cpp @@ -0,0 +1,154 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +using namespace Eval; +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +Variant eval(LVariableTable *vars, CObjRef self, CStrRef code_str, + bool prepend_php /* = true */) { + vector statics; + String code_str2 = prepend_php ? concat("cast(); + if (sl) { + const std::vector &stmts = sl->stmts(); + std::vector cls; + std::vector funcs; + for (std::vector::const_iterator it = stmts.begin(); + it != stmts.end(); ++it) { + Eval::ClassStatementPtr cl = (*it)->cast(); + if (cl) { + cls.push_back(cl); + } else { + Eval::FunctionStatementPtr fn = (*it)->cast(); + if (fn) { + funcs.push_back(fn); + } else { + // Classes and funcs are all at the start + break; + } + } + } + if (cls.size() > 0 || funcs.size() > 0) { + // install string code container to globals + StringCodeContainer *scc = + new StringCodeContainer(cls, funcs); + RequestEvalState::addCodeContainer(scc); + } + } + // todo: pass in params + NestedVariableEnvironment env(vars, blk, Array(), self); + s->eval(env); + return true; +} + +bool eval_invoke_hook(Variant &res, const char *s, CArrRef params, int64 hash) { + const Eval::Function *fs = Eval::RequestEvalState::findFunction(s); + if (fs) { + res = ref(fs->invoke(params)); + ref(res); + return true; + } + return false; +} +bool eval_create_object_hook(Variant &res, const char *s, CArrRef params, + bool init, ObjectData *root) { + Eval::ClassEvalState *ce = Eval::RequestEvalState::findClassState(s); + if (ce) { + res = ce->getClass()->create(*ce, params, init, root); + return true; + } + return false; +} +bool eval_try_autoload(const char *s) { + const Eval::Function *fn = + Eval::RequestEvalState::findFunction("__autoload"); + if (fn) { + fn->invoke(CREATE_VECTOR1(String(s, AttachLiteral))); + return true; + } + return false; +} +bool eval_invoke_static_method_hook(Variant &res, const char *s, + const char* method, CArrRef params, + bool &foundClass) { + const MethodStatement *ms = Eval::RequestEvalState::findMethod(s, method, + foundClass); + if (ms) { + res = ref(ms->invokeStatic(s, params)); + ref(res); + return true; + } + return false; +} +bool eval_get_static_property_hook(Variant &res, const char *s, + const char* prop) { + Variant *v; + if (eval_get_static_property_lv_hook(v, s, prop)) { + res = *v; + return true; + } + return false; +} +bool eval_get_static_property_lv_hook(Variant *&res, const char *s, + const char *prop) { + const Eval::ClassStatement *cls = Eval::RequestEvalState::findClass(s); + while (cls) { + LVariableTable *statics = Eval::RequestEvalState::getClassStatics(cls); + if (!statics) return false; + if (statics->exists(prop)) { + cls->attemptPropertyAccess(prop); + res = &statics->get(prop); + return true; + } + cls = cls->parentStatement(); + } + return false; +} +bool eval_get_class_constant_hook(Variant &res, const char *s, + const char* constant) { +const Eval::ClassStatement *cls = Eval::RequestEvalState::findClass(s); + while (cls) { + if (cls->getConstant(res, constant)) return true; + cls = cls->parentStatement(); + } + return false; +} +bool eval_constant_hook(Variant &res, CStrRef name) { + return Eval::RequestEvalState::findConstant(name, res); +} +bool eval_invoke_file_hook(Variant &res, CStrRef path, bool once, + LVariableTable* variables, const char *currentDir) { + return RequestEvalState::includeFile(res, path, once, variables, currentDir); +} +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/eval/eval.h b/src/cpp/eval/eval.h new file mode 100644 index 0000000000000..6430a9fc2e011 --- /dev/null +++ b/src/cpp/eval/eval.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_EVAL_H__ +#define __EVAL_EVAL_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant eval(LVariableTable *vars, CObjRef self, CStrRef code_str, + bool prepend_php = true); + +bool eval_invoke_hook(Variant &res, const char *s, CArrRef params, int64 hash); +bool eval_create_object_hook(Variant &res, const char *s, CArrRef params, + bool init, ObjectData *root); +bool eval_try_autoload(const char *s); +bool eval_invoke_static_method_hook(Variant &res, const char *s, + const char* method, CArrRef params, + bool &foundClass); +bool eval_get_static_property_hook(Variant &res, const char *s, + const char* prop); +bool eval_get_static_property_lv_hook(Variant *&res, const char *s, + const char *prop); +bool eval_get_class_constant_hook(Variant &res, const char *s, + const char* constant); +bool eval_constant_hook(Variant &res, CStrRef name); +bool eval_invoke_file_hook(Variant &res, CStrRef path, bool once, + LVariableTable* variables, const char *currentDir); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EVAL_EVAL_H__ diff --git a/src/cpp/eval/ext/ext.cpp b/src/cpp/eval/ext/ext.cpp new file mode 100644 index 0000000000000..b02685c90491b --- /dev/null +++ b/src/cpp/eval/ext/ext.cpp @@ -0,0 +1,253 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +class ExtFunction : public Function { +public: + Variant invoke(CArrRef params) const; + Variant directInvoke(VariableEnvironment &env, + const FunctionCallExpression *caller) const; + virtual Variant invokeImpl(VariableEnvironment &env, + CArrRef params) const = 0; +}; +Variant ExtFunction::invoke(CArrRef params) const { + throw NotSupportedException("Dynamic invoke of special functions", + "It's hard and I haven't gotten around to it"); +} +Variant ExtFunction::directInvoke(VariableEnvironment &env, + const FunctionCallExpression *caller) const { + return invokeImpl(env, caller->getParams(env)); +} + +#define EVAL_EXT(name) \ + class Eval##name : public ExtFunction { \ + public: \ + Variant invokeImpl(VariableEnvironment &env, \ + CArrRef params) const; \ + }; + +EVAL_EXT(Extract); +EVAL_EXT(Define); +EVAL_EXT(FuncGetArg); +EVAL_EXT(FuncGetArgs); +EVAL_EXT(FuncNumArgs); +EVAL_EXT(Compact); +EVAL_EXT(CreateFunction); +EVAL_EXT(Assert); +EVAL_EXT(ClassExists); +#undef EVAL_EXT + +class EvalFunctionExists : public ExtFunction { +public: + EvalFunctionExists(); + Variant invokeImpl(VariableEnvironment &env, + CArrRef params) const; +private: + hphp_const_char_imap m_blacklist; +}; + +EvalOverrides::EvalOverrides() { + m_functions["extract"] = new EvalExtract(); + m_functions["define"] = new EvalDefine(); + m_functions["func_get_arg"] = new EvalFuncGetArg(); + m_functions["func_get_args"] = new EvalFuncGetArgs(); + m_functions["func_num_args"] = new EvalFuncNumArgs(); + m_functions["compact"] = new EvalCompact(); + m_functions["create_function"] = new EvalCreateFunction(); + m_functions["assert"] = new EvalAssert(); + m_functions["function_exists"] = new EvalFunctionExists(); + m_functions["class_exists"] = new EvalClassExists(); +} +EvalOverrides::~EvalOverrides() { + for (hphp_const_char_imap::iterator it = + m_functions.begin(); it != m_functions.end(); ++it) { + delete it->second; + } + m_functions.clear(); +} + +const Function *EvalOverrides::findFunction(const char *name) const { + hphp_const_char_imap::const_iterator it = + m_functions.find(name); + if (it != m_functions.end()) { + return it->second; + } + return NULL; +} + +EvalOverrides evalOverrides; + +////////////////////////////////////////////////////////////////////////////// +///// Invoke definitions + +Variant EvalExtract::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + int size = params.size(); + switch (size) { + case 1: return extract(&env,params.rvalAt(0)); + case 2: return extract(&env,params.rvalAt(0), params.rvalAt(1)); + case 3: return extract(&env,params.rvalAt(0), params.rvalAt(1), + params.rvalAt(2)); + default: throw InvalidFunctionCallException("extract"); + } +} +Variant EvalDefine::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + int size = params.size(); + switch (size) { + case 2: + case 3: + { + Variant n = params.rvalAt(0); + if (!f_defined(n)) { + return RequestEvalState::declareConstant(n, params.rvalAt(1)); + } else { + return false; + } + } + default: throw InvalidFunctionCallException("define"); + } +} + +Variant EvalFuncGetArg::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + int size = params.size(); + switch (size) { + case 1: return env.getParams().rvalAt(params.rvalAt(0)); + default: throw InvalidFunctionCallException("func_get_arg"); + } +} + +Variant EvalFuncGetArgs::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + int size = params.size(); + switch (size) { + case 0: { + Array res = Array::Create(); + for (ArrayIter iter(env.getParams()); !iter.end(); iter.next()) { + res.append(iter.second()); + } + return res; + } + default: throw InvalidFunctionCallException("func_get_args"); + } +} + +Variant EvalFuncNumArgs::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + int size = params.size(); + if (size != 0) throw InvalidFunctionCallException("func_num_args"); + return env.getParams().size(); +} + +Variant EvalCompact::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + int size = params.size(); + if (size == 0) throw InvalidFunctionCallException("compact"); + return compact(&env, params.size(), params.rvalAt(0), + params.slice(1, params.size() - 1, false)); +} + +Variant EvalCreateFunction::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + int size = params.size(); + if (size != 2) throw InvalidFunctionCallException("create_function"); + Variant var = params.rvalAt(0); + Variant body = params.rvalAt(1); + + vector statics; + ostringstream fnStream; + int64 id = RequestEvalState::unique(); + fnStream << "cast()->stmts()[0]; + ASSERT(f); + f->changeName(nameStream.str()); + vector fs; + fs.push_back(f); + vector cls; + StringCodeContainer *cc = new StringCodeContainer(cls, fs); + RequestEvalState::addCodeContainer(cc); + f->eval(env); + return String(f->name().c_str(), f->name().size(), AttachLiteral); +} + +Variant EvalAssert::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + Variant assertion = params.rvalAt(0); + if (assertion.isString()) { + // Todo: eval this assertion + return null; + } + return f_assert(assertion); +} + +Variant EvalClassExists::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + String cname = params.rvalAt(0); + if (!f_class_exists(cname)) { + if ((params.size() == 1 || params.rvalAt(1).toBoolean()) && + eval_try_autoload(cname.data())) { + return f_class_exists(cname); + } + return false; + } + return true; +} + +EvalFunctionExists::EvalFunctionExists() { + m_blacklist["fb_get_derived_classes"] = true; +} + +Variant EvalFunctionExists::invokeImpl(VariableEnvironment &env, + CArrRef params) const { + + if (params.size() != 1) + throw InvalidFunctionCallException("function_exists"); + String fn = params.rvalAt(0).toString(); + if (m_blacklist.find(fn.data()) != m_blacklist.end()) return false; + return f_function_exists(fn); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} diff --git a/src/cpp/eval/ext/ext.h b/src/cpp/eval/ext/ext.h new file mode 100644 index 0000000000000..89da9dd929d88 --- /dev/null +++ b/src/cpp/eval/ext/ext.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_EXT_EXT_H__ +#define __EVAL_EXT_EXT_H__ + +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// +class Function; + +class EvalOverrides { +public: + EvalOverrides(); + ~EvalOverrides(); + const Function *findFunction(const char *name) const; +private: + hphp_const_char_imap m_functions; +}; + +extern EvalOverrides evalOverrides; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_EXT_EXT_H__ */ diff --git a/src/cpp/eval/gen.mk b/src/cpp/eval/gen.mk new file mode 100644 index 0000000000000..fd47f1fc4a2e9 --- /dev/null +++ b/src/cpp/eval/gen.mk @@ -0,0 +1,16 @@ +GENERATED_CPP_SOURCES += \ + $(EVAL_DIR)/parser/lex.eval_.c \ + $(EVAL_DIR)/parser/hphp.tab.c +INTERMEDIATE_FILES += \ + $(EVAL_DIR)/parser/hphp.tab.h \ + $(EVAL_DIR)/parser/hphp.output + +overall: all + +$(EVAL_DIR)/parser/lex.eval_.c: $(EVAL_DIR)/parser/hphp.x $(EVAL_DIR)/parser/hphp.tab.c + @echo "Generating scanner code..." + @cd $(EVAL_DIR)/parser && flex -w -i -Peval_ hphp.x + +$(EVAL_DIR)/parser/hphp.tab.c: $(EVAL_DIR)/parser/hphp.y + @echo "Generating parser code..." + @cd $(EVAL_DIR)/parser && bison -v -d -p eval_ hphp.y diff --git a/src/cpp/eval/parser/hphp.x b/src/cpp/eval/parser/hphp.x new file mode 100644 index 0000000000000..5725c12fdf851 --- /dev/null +++ b/src/cpp/eval/parser/hphp.x @@ -0,0 +1,701 @@ +%{ +#include +#include +#define YLMM_SCANNER_CLASS HPHP::Eval::Scanner +#include +#include +#define SETTOKEN _scanner->setToken(yytext, yyleng, yytext, yyleng) +// STEPPOS is for tokens that we don't need the string of. +#define STEPPOS _scanner->setToken(yytext, yyleng, yytext, yyleng, false) +%} + +%x ST_IN_SCRIPTING +%x ST_DOUBLE_QUOTES +%x ST_BACKQUOTE +%x ST_HEREDOC +%x ST_START_HEREDOC +%x ST_END_HEREDOC +%x ST_LOOKING_FOR_PROPERTY +%x ST_LOOKING_FOR_VARNAME +%x ST_VAR_OFFSET +%x ST_COMMENT +%x ST_DOC_COMMENT +%x ST_ONE_LINE_COMMENT +%option stack + +LNUM [0-9]+ +DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*) +EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) +HNUM "0x"[0-9a-fA-F]+ +LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* +WHITESPACE [ \n\r\t]+ +TABS_AND_SPACES [ \t]* +TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@] +ANY_CHAR (.|[\n]) +NEWLINE ("\r"|"\n"|"\r\n") + +/* + * LITERAL_DOLLAR matches unescaped $ that aren't followed by a label character + * or a { and therefore will be taken literally. The case of literal $ before + * a variable or "${" is handled in a rule for each string type + */ +DOUBLE_QUOTES_LITERAL_DOLLAR ("$"+([^a-zA-Z_\x7f-\xff$"\\{]|("\\"{ANY_CHAR}))) +BACKQUOTE_LITERAL_DOLLAR ("$"+([^a-zA-Z_\x7f-\xff$`\\{]|("\\"{ANY_CHAR}))) +HEREDOC_LITERAL_DOLLAR ("$"+([^a-zA-Z_\x7f-\xff$\n\r\\{]|("\\"[^\n\r]))) +/* + * Usually, HEREDOC_NEWLINE will just function like a simple NEWLINE, but some + * special cases need to be handled. HEREDOC_CHARS doesn't allow a line to + * match when { or $, and/or \ is at the end. (("{"*|"$"*)"\\"?) handles that, + * along with cases where { or $, and/or \ is the ONLY thing on a line + * + * The other case is when a line contains a label, followed by ONLY + * { or $, and/or \ Handled by ({LABEL}";"?((("{"+|"$"+)"\\"?)|"\\")) + */ +HEREDOC_NEWLINE ((({LABEL}";"?((("{"+|"$"+)"\\"?)|"\\"))|(("{"*|"$"*)"\\"?)){NEWLINE}) + +/* + * This pattern is just used in the next 2 for matching { or literal $, and/or + * \ escape sequence immediately at the beginning of a line or after a label + */ +HEREDOC_CURLY_OR_ESCAPE_OR_DOLLAR (("{"+[^$\n\r\\{])|("{"*"\\"[^\n\r])|{HEREDOC_LITERAL_DOLLAR}) + +/* + * These 2 label-related patterns allow HEREDOC_CHARS to continue "regular" + * matching after a newline that starts with either a non-label character or a + * label that isn't followed by a newline. Like HEREDOC_CHARS, they won't match + * a variable or "{$" Matching a newline, and possibly label, up TO a variable + * or "{$", is handled in the heredoc rules + * + * The HEREDOC_LABEL_NO_NEWLINE pattern (";"[^$\n\r\\{]) handles cases where ; + * follows a label. [^a-zA-Z0-9_\x7f-\xff;$\n\r\\{] is needed to prevent a label + * character or ; from matching on a possible (real) ending label + */ +HEREDOC_NON_LABEL ([^a-zA-Z_\x7f-\xff$\n\r\\{]|{HEREDOC_CURLY_OR_ESCAPE_OR_DOLLAR}) +HEREDOC_LABEL_NO_NEWLINE ({LABEL}([^a-zA-Z0-9_\x7f-\xff;$\n\r\\{]|(";"[^$\n\r\\{])|(";"?{HEREDOC_CURLY_OR_ESCAPE_OR_DOLLAR}))) +/* + * CHARS matches everything up to a variable or "{$" + * {'s are matched as long as they aren't followed by a $ + * The case of { before "{$" is handled in a rule for each string type + * + * For heredocs, matching continues across/after newlines if/when it's known + * that the next line doesn't contain a possible ending label + */ +DOUBLE_QUOTES_CHARS ("{"*([^$"\\{]|("\\"{ANY_CHAR}))|{DOUBLE_QUOTES_LITERAL_DOLLAR}) +BACKQUOTE_CHARS ("{"*([^$`\\{]|("\\"{ANY_CHAR}))|{BACKQUOTE_LITERAL_DOLLAR}) +HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({HEREDOC_NEWLINE}+({HEREDOC_NON_LABEL}|{HEREDOC_LABEL_NO_NEWLINE}))) + +%% + +"exit" {STEPPOS; return T_EXIT;} +"die" {STEPPOS; return T_EXIT;} +"function" {STEPPOS; return T_FUNCTION;} +"const" {STEPPOS; return T_CONST;} +"return" {STEPPOS; return T_RETURN;} +"try" {STEPPOS; return T_TRY;} +"catch" {STEPPOS; return T_CATCH;} +"throw" {STEPPOS; return T_THROW;} +"if" {STEPPOS; return T_IF;} +"elseif" {STEPPOS; return T_ELSEIF;} +"endif" {STEPPOS; return T_ENDIF;} +"else" {STEPPOS; return T_ELSE;} +"while" {STEPPOS; return T_WHILE;} +"endwhile" {STEPPOS; return T_ENDWHILE;} +"do" {STEPPOS; return T_DO;} +"for" {STEPPOS; return T_FOR;} +"endfor" {STEPPOS; return T_ENDFOR;} +"foreach" {STEPPOS; return T_FOREACH;} +"endforeach" {STEPPOS; return T_ENDFOREACH;} +"declare" {STEPPOS; return T_DECLARE;} +"enddeclare" {STEPPOS; return T_ENDDECLARE;} +"instanceof" {STEPPOS; return T_INSTANCEOF;} +"as" {STEPPOS; return T_AS;} +"switch" {STEPPOS; return T_SWITCH;} +"endswitch" {STEPPOS; return T_ENDSWITCH;} +"case" {STEPPOS; return T_CASE;} +"default" {STEPPOS; return T_DEFAULT;} +"break" {STEPPOS; return T_BREAK;} +"continue" {STEPPOS; return T_CONTINUE;} +"echo" {STEPPOS; return T_ECHO;} +"print" {STEPPOS; return T_PRINT;} +"class" {STEPPOS; return T_CLASS;} +"interface" {STEPPOS; return T_INTERFACE;} +"extends" {STEPPOS; return T_EXTENDS;} +"implements" {STEPPOS; return T_IMPLEMENTS;} + +^"#HPHP_DECLARE" {STEPPOS; return T_HPHP_DECLARE;} + +"->" { + STEPPOS; + yy_push_state(ST_LOOKING_FOR_PROPERTY); + return T_OBJECT_OPERATOR; +} + +"->" { + STEPPOS; + return T_OBJECT_OPERATOR; +} + +{LABEL} { + SETTOKEN; + yy_pop_state(); + return T_STRING; +} + +{ANY_CHAR} { + yyless(0); + yy_pop_state(); +} + +"::" {STEPPOS;return T_PAAMAYIM_NEKUDOTAYIM;} +"new" {STEPPOS;return T_NEW;} +"clone" {STEPPOS;return T_CLONE;} +"var" {STEPPOS;return T_VAR;} + +"("{TABS_AND_SPACES}("int"|"integer"){TABS_AND_SPACES}")" { + STEPPOS; + return T_INT_CAST; +} + +"("{TABS_AND_SPACES}("real"|"double"|"float"){TABS_AND_SPACES}")" { + STEPPOS; + return T_DOUBLE_CAST; +} + +"("{TABS_AND_SPACES}"string"{TABS_AND_SPACES}")" { + STEPPOS; + return T_STRING_CAST; +} + +"("{TABS_AND_SPACES}"binary"{TABS_AND_SPACES}")" { + STEPPOS; + return T_STRING_CAST; +} + +"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" { + STEPPOS; + return T_ARRAY_CAST; +} + +"("{TABS_AND_SPACES}"object"{TABS_AND_SPACES}")" { + STEPPOS; + return T_OBJECT_CAST; +} + +"("{TABS_AND_SPACES}("bool"|"boolean"){TABS_AND_SPACES}")" { + STEPPOS; + return T_BOOL_CAST; +} + +"("{TABS_AND_SPACES}("unset"){TABS_AND_SPACES}")" { + STEPPOS; + return T_UNSET_CAST; +} + +"eval" {STEPPOS; return T_EVAL;} +"include" {STEPPOS; return T_INCLUDE;} +"include_once" {STEPPOS; return T_INCLUDE_ONCE;} +"require" {STEPPOS; return T_REQUIRE;} +"require_once" {STEPPOS; return T_REQUIRE_ONCE;} +"use" {STEPPOS; return T_USE;} +"global" {STEPPOS; return T_GLOBAL;} +"isset" {STEPPOS; return T_ISSET;} +"empty" {STEPPOS; return T_EMPTY;} +"__halt_compiler" {STEPPOS; return T_HALT_COMPILER;} +"static" {STEPPOS; return T_STATIC;} +"abstract" {STEPPOS; return T_ABSTRACT;} +"final" {STEPPOS; return T_FINAL;} +"private" {STEPPOS; return T_PRIVATE;} +"protected" {STEPPOS; return T_PROTECTED;} +"public" {STEPPOS; return T_PUBLIC;} +"unset" {STEPPOS; return T_UNSET;} +"=>" {STEPPOS; return T_DOUBLE_ARROW;} +"list" {STEPPOS; return T_LIST;} +"array" {STEPPOS; return T_ARRAY;} +"++" {STEPPOS; return T_INC;} +"--" {STEPPOS; return T_DEC;} +"===" {STEPPOS; return T_IS_IDENTICAL;} +"!==" {STEPPOS; return T_IS_NOT_IDENTICAL;} +"==" {STEPPOS; return T_IS_EQUAL;} +"!="|"<>" {STEPPOS; return T_IS_NOT_EQUAL;} +"<=" {STEPPOS; return T_IS_SMALLER_OR_EQUAL;} +">=" {STEPPOS; return T_IS_GREATER_OR_EQUAL;} +"+=" {STEPPOS; return T_PLUS_EQUAL;} +"-=" {STEPPOS; return T_MINUS_EQUAL;} +"*=" {STEPPOS; return T_MUL_EQUAL;} +"/=" {STEPPOS; return T_DIV_EQUAL;} +".=" {STEPPOS; return T_CONCAT_EQUAL;} +"%=" {STEPPOS; return T_MOD_EQUAL;} +"<<=" {STEPPOS; return T_SL_EQUAL;} +">>=" {STEPPOS; return T_SR_EQUAL;} +"&=" {STEPPOS; return T_AND_EQUAL;} +"|=" {STEPPOS; return T_OR_EQUAL;} +"^=" {STEPPOS; return T_XOR_EQUAL;} +"||" {STEPPOS; return T_BOOLEAN_OR;} +"&&" {STEPPOS; return T_BOOLEAN_AND;} +"OR" {STEPPOS; return T_LOGICAL_OR;} +"AND" {STEPPOS; return T_LOGICAL_AND;} +"XOR" {STEPPOS; return T_LOGICAL_XOR;} +"<<" {STEPPOS; return T_SL;} +">>" {STEPPOS; return T_SR;} +{TOKENS} {STEPPOS; return yytext[0];} + +"{" { + STEPPOS; + yy_push_state(ST_IN_SCRIPTING); + return '{'; +} + +"${" { + STEPPOS; + yy_push_state(ST_LOOKING_FOR_VARNAME); + return T_DOLLAR_OPEN_CURLY_BRACES; +} + +"}" { + STEPPOS; + if (yy_start_stack_ptr) yy_pop_state(); + return '}'; +} + +{LABEL} { + SETTOKEN; + yy_pop_state(); + yy_push_state(ST_IN_SCRIPTING); + return T_STRING_VARNAME; +} + +{ANY_CHAR} { + yyless(0); + yy_pop_state(); + yy_push_state(ST_IN_SCRIPTING); +} + +{LNUM} { + SETTOKEN; + errno = 0; + long ret = strtoll(yytext, NULL, 0); + if (errno == ERANGE) { + _scanner->error("Dec number is too big: %s", yytext); + return T_LNUMBER; + } + return ret < 0 ? T_DNUMBER : T_LNUMBER; +} + +{HNUM} { + SETTOKEN; + errno = 0; + long ret = strtoull(yytext, NULL, 16); + if (errno == ERANGE) { + _scanner->error("Hex number is too big: %s", yytext); + return T_LNUMBER; + } + return ret < 0 ? T_DNUMBER : T_LNUMBER; +} + +0|([1-9][0-9]*) { /* Offset could be treated as a long */ + SETTOKEN; + errno = 0; + strtoll(yytext, NULL, 0); + if (errno == ERANGE) { + _scanner->error("Offset number is too big: %s", yytext); + } + return T_NUM_STRING; +} + +{LNUM}|{HNUM} { /* Offset must be treated as a string */ + SETTOKEN; + return T_NUM_STRING; +} + +{DNUM}|{EXPONENT_DNUM} { + SETTOKEN; + return T_DNUMBER; +} + +"__CLASS__" { STEPPOS; return T_CLASS_C; } +"__FUNCTION__" { STEPPOS; return T_FUNC_C; } +"__METHOD__" { STEPPOS; return T_METHOD_C;} +"__LINE__" { STEPPOS; return T_LINE; } +"__FILE__" { STEPPOS; return T_FILE; } + +"#"[^\n]*"\n" { + SETTOKEN; + return T_INLINE_HTML; +} + +(([^<]|"<"[^?%s<]){1,400})|""" { + SETTOKEN; + if (_scanner->shortTags() || yyleng > 2) { + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG; + } else { + return T_INLINE_HTML; + } +} + +"<%="|"aspTags()) || + (yytext[1]=='?' && _scanner->shortTags())) { + BEGIN(ST_IN_SCRIPTING); + return T_ECHO; //return T_OPEN_TAG_WITH_ECHO; + } else { + return T_INLINE_HTML; + } +} + +"<%" { + SETTOKEN; + if (_scanner->aspTags()) { + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG; + } else { + return T_INLINE_HTML; + } +} + +""$"{LABEL} { + _scanner->setToken(yytext, yyleng, yytext+1, yyleng-1); + return T_VARIABLE; +} + +"$"{LABEL}"->"[a-zA-Z_\x7f-\xff] { + yyless(yyleng - 3); + yy_push_state(ST_LOOKING_FOR_PROPERTY); + _scanner->setToken(yytext, yyleng, yytext+1, yyleng-1); + return T_VARIABLE; +} + +"$"{LABEL}"[" { + yyless(yyleng - 1); + yy_push_state(ST_VAR_OFFSET); + _scanner->setToken(yytext, yyleng, yytext+1, yyleng-1); + return T_VARIABLE; +} + +"]" { + yy_pop_state(); + return ']'; +} + +{TOKENS}|[{}"`] { + /* Only '[' can be valid, but returning other tokens will allow + a more explicit parse error */ + return yytext[0]; +} + +[ \n\r\t\\'#] { + /* Invalid rule to return a more explicit parse error with proper + line number */ + yyless(0); + yy_pop_state(); + return T_ENCAPSED_AND_WHITESPACE; +} + +{LABEL} { + SETTOKEN; + return T_STRING; +} + +{WHITESPACE} { + STEPPOS; + return T_WHITESPACE; +} + +"#"|"//" { + BEGIN(ST_ONE_LINE_COMMENT); + yymore(); +} + +"?"|"%"|">" { + yymore(); +} + +[^\n\r?%>]*{ANY_CHAR} { + switch (yytext[yyleng-1]) { + case '?': + case '%': + case '>': + yyless(yyleng-1); + yymore(); + break; + default: + STEPPOS; + BEGIN(ST_IN_SCRIPTING); + return T_COMMENT; + } +} + +{NEWLINE} { + STEPPOS; + BEGIN(ST_IN_SCRIPTING); + return T_COMMENT; +} + +"?>"|"%>" { + if (_scanner->aspTags() || yytext[yyleng-2] != '%') { + _scanner->setToken(yytext, yyleng-2, yytext, yyleng-2); + yyless(yyleng-2); + BEGIN(ST_IN_SCRIPTING); + return T_COMMENT; + } else { + yymore(); + } +} + +"/**"{WHITESPACE} { + BEGIN(ST_DOC_COMMENT); + yymore(); +} + +"/*" { + BEGIN(ST_COMMENT); + yymore(); +} + +[^*]+ { + yymore(); +} + +"*/" { + STEPPOS; + _scanner->setDocComment(yytext, yyleng); + BEGIN(ST_IN_SCRIPTING); + return T_DOC_COMMENT; +} + +"*/" { + STEPPOS; + BEGIN(ST_IN_SCRIPTING); + /* + if (yyleng > 6 && yytext[2] == '|' && yytext[yyleng-3] == '|') { + _scanner->setToken(yytext, yyleng, yytext+3, yyleng-6); + return T_HPHP_NOTE; + } + */ + return T_COMMENT; +} + +"*" { + yymore(); +} + +("?>"|""){NEWLINE}? { + STEPPOS; + BEGIN(INITIAL); + return ';'; //return T_CLOSE_TAG; +} + +"%>"{NEWLINE}? { + if (_scanner->aspTags()) { + STEPPOS; + BEGIN(INITIAL); + return ';'; //return T_CLOSE_TAG; + } else { + yyless(1); + _scanner->setToken(yytext, 1, yytext, 1); + return yytext[0]; + } +} + +(b?["]{DOUBLE_QUOTES_CHARS}*("{"*|"$"*)["]) { + int bprefix = (yytext[0] != '"') ? 1 : 0; + std::string strval = + _scanner->scanEscapeString(yytext + bprefix + 1, + yyleng - bprefix - 2, '"'); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_CONSTANT_ENCAPSED_STRING; +} + +(b?[']([^'\\]|("\\"{ANY_CHAR}))*[']) { + int bprefix = (yytext[0] != '\'') ? 1 : 0; + std::string strval = + _scanner->scanEscapeString(yytext + bprefix + 1, + yyleng - bprefix - 2, '\''); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_CONSTANT_ENCAPSED_STRING; +} + +b?["] { + int bprefix = (yytext[0] != '"') ? 1 : 0; + _scanner->setToken(yytext, yyleng, yytext + bprefix, yyleng - bprefix); + BEGIN(ST_DOUBLE_QUOTES); + return '\"'; +} + +b?"<<<"{TABS_AND_SPACES}{LABEL}{NEWLINE} { + int bprefix = (yytext[0] != '<') ? 1 : 0; + int label_len = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0); + char *s = yytext+bprefix+3; + while ((*s == ' ') || (*s == '\t')) { + s++; + label_len--; + } + _scanner->setHeredocLabel(s, label_len); + _scanner->setToken(yytext, yyleng, s, label_len); + BEGIN(ST_HEREDOC); + return T_START_HEREDOC; +} + +[`] { + STEPPOS; + BEGIN(ST_BACKQUOTE); + return '`'; +} + +{ANY_CHAR} { + yyless(0); + BEGIN(ST_HEREDOC); +} + +{LABEL}";"?[\n\r] { + int label_len = yyleng-1; + if (yytext[label_len-1]==';') { + label_len--; + } + if (label_len == _scanner->getHeredocLabelLen() && + !memcmp(yytext, _scanner->getHeredocLabel(), label_len)) { + _scanner->setToken(yytext, label_len, yytext, label_len); + yyless(label_len); + _scanner->resetHeredoc(); + BEGIN(ST_IN_SCRIPTING); + return T_END_HEREDOC; + } else { + yymore(); + BEGIN(ST_HEREDOC); + } +} + +{HEREDOC_CHARS}*{HEREDOC_NEWLINE}+{LABEL}";"?[\n\r] { + char *end = yytext + yyleng - 1; + + if (end[-1] == ';') { + end--; + yyleng--; + } + int heredocLen = _scanner->getHeredocLabelLen(); + if (yyleng > heredocLen && + !memcmp(end - heredocLen, _scanner->getHeredocLabel(), + heredocLen)) { + int len = yyleng - heredocLen - 2; + /* 2 for newline before and after label */ + if (len > 0 && + yytext[len - 1] == '\r' && yytext[len] == '\n') { + len--; + } + yyless(yyleng - 2); + yyleng -= heredocLen - 1; + std::string strval = + _scanner->scanEscapeString(yytext, len, 0); + _scanner->setToken(yytext, yyleng, + strval.c_str(), strval.length()); + BEGIN(ST_END_HEREDOC); + return T_ENCAPSED_AND_WHITESPACE; + } else { + /* Go back to end of label, so the next match works correctly in + * case of a variable or another label at the beginning of the + * next line + */ + yyless(yyleng - 1); + yymore(); + } +} + +{ANY_CHAR} { + BEGIN(ST_IN_SCRIPTING); + STEPPOS; + return T_END_HEREDOC; +} + +"{$" { + _scanner->setToken(yytext, 1, yytext, 1); + yy_push_state(ST_IN_SCRIPTING); + yyless(1); + return T_CURLY_OPEN; +} + +{DOUBLE_QUOTES_CHARS}+ { + std::string strval = _scanner->scanEscapeString(yytext, yyleng, '"'); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +{DOUBLE_QUOTES_CHARS}*("{"{2,}|"$"{2,}|(("{"+|"$"+)["])) { + yyless(yyleng - 1); + std::string strval = _scanner->scanEscapeString(yytext, yyleng, '"'); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +{BACKQUOTE_CHARS}+ { + std::string strval = _scanner->scanEscapeString(yytext, yyleng, '`'); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +{BACKQUOTE_CHARS}*("{"{2,}|"$"{2,}|(("{"+|"$"+)[`])) { + yyless(yyleng - 1); + std::string strval = _scanner->scanEscapeString(yytext, yyleng, '`'); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +{HEREDOC_CHARS}*({HEREDOC_NEWLINE}+({LABEL}";"?)?)? { + std::string strval = _scanner->scanEscapeString(yytext, yyleng, 0); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +{HEREDOC_CHARS}*({HEREDOC_NEWLINE}+({LABEL}";"?)?)?("{"{2,}|"$"{2,}) { + yyless(yyleng - 1); + std::string strval = _scanner->scanEscapeString(yytext, yyleng, 0); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +["] { + BEGIN(ST_IN_SCRIPTING); + return '"'; +} + +[`] { + BEGIN(ST_IN_SCRIPTING); + return '`'; +} + +<> { + _scanner->error("Unterminated comment at end of file"); + return 0; +} + +{ANY_CHAR} { + _scanner->error("Unexpected character in input: '%c' (ASCII=%d)", + yytext[0], yytext[0]); +} + +%% +void _eval_scanner_init() { + BEGIN(INITIAL); +} + +static void suppress_defined_but_not_used_warnings() { + yy_fatal_error(0); + yyunput(0, 0); + yy_top_state(); + suppress_defined_but_not_used_warnings(); +} + +void _eval_scanner_reset() { + YY_FLUSH_BUFFER; +} diff --git a/src/cpp/eval/parser/hphp.y b/src/cpp/eval/parser/hphp.y new file mode 100644 index 0000000000000..0dfb1e59dec5c --- /dev/null +++ b/src/cpp/eval/parser/hphp.y @@ -0,0 +1,861 @@ +%{ +#include + +using namespace HPHP; +using namespace HPHP::Eval; + +#define YYSTYPE Token +#define YLMM_PARSER_CLASS Parser +#define YLMM_LEX_STATIC +#define YYERROR_VERBOSE +#define YYINITDEPTH 500 +#include + +#define _p _parser +#define BEXP(e...) _parser->onBinaryOpExp(e); +#define UEXP(e...) _parser->onUnaryOpExp(e); +%} + +%expect 2 + +%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 +%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 +%left '?' ':' +%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 '[' + +%nonassoc T_NEW T_CLONE +%token T_EXIT +%token T_IF +%left T_ELSEIF +%left T_ELSE +%left T_ENDIF +%token T_LNUMBER +%token T_DNUMBER +%token T_STRING +%token T_STRING_VARNAME +%token T_VARIABLE +%token T_NUM_STRING +%token T_INLINE_HTML +%token T_CHARACTER +%token T_BAD_CHARACTER +%token T_ENCAPSED_AND_WHITESPACE +%token T_CONSTANT_ENCAPSED_STRING +%token T_ECHO +%token T_DO +%token T_WHILE +%token T_ENDWHILE +%token T_FOR +%token T_ENDFOR +%token T_FOREACH +%token T_ENDFOREACH +%token T_DECLARE +%token T_ENDDECLARE +%token T_AS +%token T_SWITCH +%token T_ENDSWITCH +%token T_CASE +%token T_DEFAULT +%token T_BREAK +%token T_CONTINUE +%token T_FUNCTION +%token T_CONST +%token T_RETURN +%token T_TRY +%token T_CATCH +%token T_THROW +%token T_USE +%token T_GLOBAL +%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC +%token T_VAR +%token T_UNSET +%token T_ISSET +%token T_EMPTY +%token T_HALT_COMPILER +%token T_CLASS +%token T_INTERFACE +%token T_EXTENDS +%token T_IMPLEMENTS +%token T_OBJECT_OPERATOR +%token T_DOUBLE_ARROW +%token T_LIST +%token T_ARRAY +%token T_CLASS_C +%token T_METHOD_C +%token T_FUNC_C +%token T_LINE +%token T_FILE +%token T_COMMENT +%token T_DOC_COMMENT +%token T_OPEN_TAG +%token T_OPEN_TAG_WITH_ECHO +%token T_CLOSE_TAG +%token T_WHITESPACE +%token T_START_HEREDOC +%token T_END_HEREDOC +%token T_DOLLAR_OPEN_CURLY_BRACES +%token T_CURLY_OPEN +%token T_PAAMAYIM_NEKUDOTAYIM + +%left T_HPHP_NOTE +%token T_HPHP_NOTE +%token T_HPHP_DECLARE + +%% + +start: + top_statement_list { _p->saveParseTree($$);} +; + +top_statement_list: + top_statement_list + top_statement { _p->addStatement($$,$1,$2);} + | { $$.reset();} +; +top_statement: + statement { $$ = $1;} + | function_declaration_statement { $$ = $1;} + | class_declaration_statement { $$ = $1;} + | T_HPHP_NOTE function_declaration_statement + { _p->onHphpNoteStatement($$,$1,$2);} + | T_HPHP_NOTE class_declaration_statement + { _p->onHphpNoteStatement($$,$1,$2);} + | T_HALT_COMPILER '(' ')' ';' { $$.reset();} + | T_HPHP_DECLARE hphp_declare_list ';' + { $$.reset(); } +; +hphp_declare_list: + hphp_declare_list ',' hphp_declare + { $$.reset();} + | hphp_declare { $$.reset();} +; +hphp_declare: + '@' T_STRING { _p->addHphpSuppressError($2);} + | T_STRING { _p->addHphpDeclare($1);} +; +inner_statement_list: + inner_statement_list + inner_statement { _p->addStatement($$,$1,$2);} + | { $$.reset();} +; +inner_statement: + statement { $$ = $1;} + | function_declaration_statement { $$ = $1;} + | class_declaration_statement { $$ = $1;} + | T_HPHP_NOTE function_declaration_statement + { _p->onHphpNoteStatement($$,$1,$2);} + | T_HPHP_NOTE class_declaration_statement + { _p->onHphpNoteStatement($$,$1,$2);} +; +statement: + expr ';' { _p->onExpStatement($$, $1);} + | statement_without_expr { $$ = $1;} + | T_HPHP_NOTE statement_without_expr { _p->onHphpNoteStatement($$,$1,$2);} + +statement_without_expr: + '{' inner_statement_list '}' { _p->onBlock($$, $2);} + + | T_IF '(' expr ')' + statement + elseif_list + else_single { _p->onIf($$,$3,$5,$6,$7);} + + | T_IF '(' expr ')' ':' + inner_statement_list + new_elseif_list + new_else_single + T_ENDIF ';' { _p->onIf($$,$3,$6,$7,$8);} + + | T_WHILE '(' expr ')' + while_statement { _p->onWhile($$,$3,$5);} + + | T_DO statement + T_WHILE '(' expr ')' ';' { _p->onDo($$,$2,$5);} + + | T_FOR '(' for_expr ';' + for_expr ';' for_expr ')' + for_statement { _p->onFor($$,$3,$5,$7,$9);} + + | T_SWITCH '(' expr ')' + switch_case_list { _p->onSwitch($$,$3,$5);} + + | T_BREAK ';' { _p->onBreak($$, NULL);} + | T_BREAK expr ';' { _p->onBreak($$, &$2);} + + | T_CONTINUE ';' { _p->onContinue($$, NULL);} + | T_CONTINUE expr ';' { _p->onContinue($$, &$2);} + + | T_RETURN ';' { _p->onReturn($$, NULL);} + | T_RETURN expr_without_variable ';' { _p->onReturn($$, &$2);} + | T_RETURN variable ';' { _p->onReturn($$, &$2);} + + | T_GLOBAL global_var_list ';' { _p->onGlobal($$, $2);} + | T_STATIC static_var_list ';' { _p->onStatic($$, $2);} + | T_ECHO echo_expr_list ';' { _p->onEcho($$, $2, 0);} + | T_UNSET '(' unset_variables ')' + ';' { _p->onUnset($$, $3);} + | ';' { $$.reset();} + + | T_INLINE_HTML { _p->onEcho($$, $1, 1);} + + | T_FOREACH '(' variable + T_AS foreach_variable + foreach_optional_arg ')' + foreach_statement { _p->onForEach($$,$3,$5,$6,$8);} + + | T_FOREACH '(' expr_without_variable + T_AS variable + foreach_optional_arg ')' + foreach_statement { _p->onForEach($$,$3,$5,$6,$8);} + + | T_DECLARE '(' declare_list ')' + declare_statement { _p->onBlock($$, $5);} + + | T_TRY '{' inner_statement_list '}' + T_CATCH '(' + fully_qualified_class_name + T_VARIABLE ')' + '{' inner_statement_list '}' + additional_catches { _p->onTry($$,$3,$7,$8,$11,$13);} + + | T_THROW expr ';' { _p->onThrow($$, $2);} +; + +additional_catches: + additional_catches + T_CATCH '(' + fully_qualified_class_name + T_VARIABLE ')' + '{' inner_statement_list '}' { _p->onCatch($$, $1, $4, $5, $8);} +| { $$.reset(); } +; + +unset_variables: + unset_variable { _p->onExprListElem($$, NULL, $1);} + | unset_variables ',' unset_variable { _p->onExprListElem($$, &$1, $3);} +; +unset_variable: + variable { $$ = $1;} +; + +is_reference: + '&' { $$ = 1;} + | { $$.reset();} +; + +function_declaration_statement: + T_FUNCTION is_reference T_STRING { _p->onFunctionStart($3);} + '(' parameter_list ')' + '{' inner_statement_list '}' { _p->onFunction($$,$2,$3,$6,$9);} +; + +class_declaration_statement: + class_entry_type T_STRING + extends_from { _p->onClassStart($2, &$3);} + implements_list '{' + class_statement_list '}' { _p->onClass($$,$1,$5);} + +| T_INTERFACE T_STRING { _p->onClassStart($2, NULL);} + interface_extends_list '{' + class_statement_list '}' { _p->onInterface($$,$4);} +; +class_entry_type: + T_CLASS { $$ = T_CLASS;} + | T_ABSTRACT T_CLASS { $$ = T_ABSTRACT;} + | T_FINAL T_CLASS { $$ = T_FINAL;} +; +extends_from: + T_EXTENDS + fully_qualified_class_name { $$ = $2;} + | { $$.reset();} +; +implements_list: + T_IMPLEMENTS interface_list { $$ = $2;} + | { $$.reset();} +; +interface_extends_list: + T_EXTENDS interface_list { $$ = $2;} + | { $$.reset();} +; +interface_list: + fully_qualified_class_name { _p->onInterfaceName($$, NULL, $1);} + | interface_list ',' + fully_qualified_class_name { _p->onInterfaceName($$, &$1, $3);} +; + +foreach_optional_arg: + T_DOUBLE_ARROW foreach_variable { $$ = $2;} + | { $$.reset();} +; +foreach_variable: + variable { $$ = $1;} + | '&' variable { $$ = $2; $$ = 1;} +; + +for_statement: + statement { $$ = $1;} + | ':' inner_statement_list + T_ENDFOR ';' { $$ = $2;} +; +foreach_statement: + statement { $$ = $1;} + | ':' inner_statement_list + T_ENDFOREACH ';' { $$ = $2;} +; +while_statement: + statement { $$ = $1;} + | ':' inner_statement_list + T_ENDWHILE ';' { $$ = $2;} +; +declare_statement: + statement { $$ = $1;} + | ':' inner_statement_list + T_ENDDECLARE ';' { $$ = $2;} +; + +declare_list: + T_STRING '=' static_scalar + | declare_list ',' + T_STRING '=' static_scalar +; + +switch_case_list: + '{' case_list '}' { $$ = $2;} + | '{' ';' case_list '}' { $$ = $3;} + | ':' case_list T_ENDSWITCH ';' { $$ = $2;} + | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3;} +; +case_list: + case_list T_CASE expr + case_separator + inner_statement_list { _p->onCase($$,$1,&$3,$5);} + | case_list T_DEFAULT case_separator + inner_statement_list { _p->onCase($$,$1,NULL,$4);} + | { $$.reset();} +; +case_separator: + ':' { $$.reset();} + | ';' { $$.reset();} +; + +elseif_list: + elseif_list T_ELSEIF '(' expr ')' + statement { _p->onElseIf($$,$1,$4,$6);} + | { $$.reset();} +; +new_elseif_list: + new_elseif_list T_ELSEIF + '(' expr ')' ':' + inner_statement_list { _p->onElseIf($$,$1,$4,$7);} + | { $$.reset();} +; +else_single: + T_ELSE statement { $$ = $2;} + | { $$.reset();} +; +new_else_single: + T_ELSE ':' inner_statement_list { $$ = $3;} + | { $$.reset();} +; + +parameter_list: + non_empty_parameter_list { $$ = $1;} + | { $$.reset();} +; +non_empty_parameter_list: + optional_class_type T_VARIABLE { _p->onParam($$,NULL,$1,$2,0,NULL);} + | optional_class_type '&' T_VARIABLE { _p->onParam($$,NULL,$1,$3,1,NULL);} + | optional_class_type '&' T_VARIABLE + '=' static_scalar { _p->onParam($$,NULL,$1,$3,1,&$5);} + | optional_class_type T_VARIABLE + '=' static_scalar { _p->onParam($$,NULL,$1,$2,0,&$4);} + | non_empty_parameter_list ',' + optional_class_type T_VARIABLE { _p->onParam($$,&$1,$3,$4,0,NULL);} + | non_empty_parameter_list ',' + optional_class_type '&' T_VARIABLE { _p->onParam($$,&$1,$3,$5,1,NULL);} + | non_empty_parameter_list ',' + optional_class_type '&' T_VARIABLE + '=' static_scalar { _p->onParam($$,&$1,$3,$5,1,&$7);} + | non_empty_parameter_list ',' + optional_class_type T_VARIABLE + '=' static_scalar { _p->onParam($$,&$1,$3,$4,0,&$6);} +; +optional_class_type: + T_STRING { $$ = $1;} + | T_ARRAY { $$.setText("array");} + | { $$.reset();} +; + +function_call_parameter_list: + non_empty_fcall_parameter_list { $$ = $1;} + | { $$.reset();} +; +non_empty_fcall_parameter_list: + expr_without_variable { _p->onCallParam($$,NULL,$1,false);} + | variable { _p->onCallParam($$,NULL,$1,false);} + | '&' w_variable { _p->onCallParam($$,NULL,$2,true);} + | non_empty_fcall_parameter_list ',' + expr_without_variable { _p->onCallParam($$,&$1,$3,false);} + | non_empty_fcall_parameter_list ',' + variable { _p->onCallParam($$,&$1,$3,false);} + | non_empty_fcall_parameter_list ',' + '&' w_variable { _p->onCallParam($$,&$1,$4,true);} +; + +global_var_list: + global_var_list ',' global_var { _p->onGlobalVar($$, &$1, $3);} + | global_var { _p->onGlobalVar($$, NULL, $1);} +; +global_var: + T_VARIABLE { $$ = $1;} + | '$' r_variable { $$ = $2; $$ = 1;} + | '$' '{' expr '}' { $$ = $3; $$ = 1;} +; + +static_var_list: + static_var_list ',' T_VARIABLE { _p->onStaticVariable($$,&$1,$3,NULL);} + | static_var_list ',' T_VARIABLE + '=' static_scalar { _p->onStaticVariable($$,&$1,$3,&$5);} + | T_VARIABLE { _p->onStaticVariable($$,NULL,$1,NULL);} + | T_VARIABLE '=' static_scalar { _p->onStaticVariable($$,NULL,$1,&$3);} +; + +class_statement_list: + class_statement_list + class_statement { } + | { } +; +class_statement: + variable_modifiers { _p->onClassVariableStart($1); } + class_variable_declaration ';' + | class_constant_declaration ';' { } + | method_modifiers T_FUNCTION + is_reference T_STRING '(' { _p->onMethodStart($4, $1);} + parameter_list ')' method_body { _p->onMethod($1,$3,$4,$7, + $9);} + | T_HPHP_NOTE + method_modifiers T_FUNCTION + is_reference T_STRING '(' { _p->onMethodStart($5,$2);} + parameter_list ')' method_body { _p->onMethod($2,$4,$5,$8, + $10); + _p->onHphpNoteStatement($$,$1,$$);} +; +method_body: + ';' { $$.reset();} + | '{' inner_statement_list '}' { _p->finishStatement($$, $2); + $$ = 1;} +; +variable_modifiers: + non_empty_member_modifiers { $$ = $1;} + | T_VAR { $$.reset();} +; +method_modifiers: + non_empty_member_modifiers { $$ = $1;} + | { $$.reset();} +; +non_empty_member_modifiers: + member_modifier { _p->onMemberModifier($$,NULL,$1);} + | non_empty_member_modifiers + member_modifier { _p->onMemberModifier($$,&$1,$2);} +; +member_modifier: + T_PUBLIC { $$ = T_PUBLIC;} + | T_PROTECTED { $$ = T_PROTECTED;} + | T_PRIVATE { $$ = T_PRIVATE;} + | T_STATIC { $$ = T_STATIC;} + | T_ABSTRACT { $$ = T_ABSTRACT;} + | T_FINAL { $$ = T_FINAL;} +; +class_variable_declaration: + class_variable_declaration ',' + T_VARIABLE { _p->onClassVariable($3,NULL);} + | class_variable_declaration ',' + T_VARIABLE '=' static_scalar { _p->onClassVariable($3,&$5);} + | T_VARIABLE { _p->onClassVariable($1,NULL);} + | T_VARIABLE '=' static_scalar { _p->onClassVariable($1,&$3);} +; +class_constant_declaration: + class_constant_declaration ',' + T_STRING '=' static_scalar { _p->onClassConstant($3,$5);} + | T_CONST T_STRING '=' static_scalar { _p->onClassConstant($2,$4);} +; + +echo_expr_list: + echo_expr_list ',' expr { _p->onExprListElem($$, &$1, $3);} + | expr { _p->onExprListElem($$, NULL, $1);} +; + +for_expr: + non_empty_for_expr { $$ = $1;} + | { $$.reset();} +; +non_empty_for_expr: + non_empty_for_expr ',' expr { _p->onExprListElem($$, &$1, $3);} + | expr { _p->onExprListElem($$, NULL, $1);} +; + +expr_without_variable: + T_LIST '(' assignment_list ')' + '=' expr { _p->onListAssignment($$, $3, $6);} + | variable '=' expr { _p->onAssign($$, $1, $3, 0);} + | variable '=' '&' variable { _p->onAssign($$, $1, $4, 1);} + | variable '=' '&' T_NEW + class_name_reference + ctor_arguments { _p->onAssignNew($$,$1,$5,$6);} + | T_NEW class_name_reference + ctor_arguments { _p->onNewObject($$, $2, $3);} + | T_CLONE expr { UEXP($$,$2,T_CLONE,1);} + | variable T_PLUS_EQUAL expr { BEXP($$,$1,$3,T_PLUS_EQUAL);} + | variable T_MINUS_EQUAL expr { BEXP($$,$1,$3,T_MINUS_EQUAL);} + | variable T_MUL_EQUAL expr { BEXP($$,$1,$3,T_MUL_EQUAL);} + | variable T_DIV_EQUAL expr { BEXP($$,$1,$3,T_DIV_EQUAL);} + | variable T_CONCAT_EQUAL expr { BEXP($$,$1,$3,T_CONCAT_EQUAL);} + | variable T_MOD_EQUAL expr { BEXP($$,$1,$3,T_MOD_EQUAL);} + | variable T_AND_EQUAL expr { BEXP($$,$1,$3,T_AND_EQUAL);} + | variable T_OR_EQUAL expr { BEXP($$,$1,$3,T_OR_EQUAL);} + | variable T_XOR_EQUAL expr { BEXP($$,$1,$3,T_XOR_EQUAL);} + | variable T_SL_EQUAL expr { BEXP($$,$1,$3,T_SL_EQUAL);} + | variable T_SR_EQUAL expr { BEXP($$,$1,$3,T_SR_EQUAL);} + | rw_variable T_INC { UEXP($$,$1,T_INC,0);} + | T_INC rw_variable { UEXP($$,$2,T_INC,1);} + | rw_variable T_DEC { UEXP($$,$1,T_DEC,0);} + | T_DEC rw_variable { UEXP($$,$2,T_DEC,1);} + | expr T_BOOLEAN_OR expr { BEXP($$,$1,$3,T_BOOLEAN_OR);} + | expr T_BOOLEAN_AND expr { BEXP($$,$1,$3,T_BOOLEAN_AND);} + | expr T_LOGICAL_OR expr { BEXP($$,$1,$3,T_LOGICAL_OR);} + | expr T_LOGICAL_AND expr { BEXP($$,$1,$3,T_LOGICAL_AND);} + | expr T_LOGICAL_XOR expr { BEXP($$,$1,$3,T_LOGICAL_XOR);} + | expr '|' expr { BEXP($$,$1,$3,'|');} + | expr '&' expr { BEXP($$,$1,$3,'&');} + | expr '^' expr { BEXP($$,$1,$3,'^');} + | expr '.' expr { BEXP($$,$1,$3,'.');} + | expr '+' expr { BEXP($$,$1,$3,'+');} + | expr '-' expr { BEXP($$,$1,$3,'-');} + | expr '*' expr { BEXP($$,$1,$3,'*');} + | expr '/' expr { BEXP($$,$1,$3,'/');} + | expr '%' expr { BEXP($$,$1,$3,'%');} + | expr T_SL expr { BEXP($$,$1,$3,T_SL);} + | expr T_SR expr { BEXP($$,$1,$3,T_SR);} + | '+' expr %prec T_INC { UEXP($$,$2,'+',1);} + | '-' expr %prec T_INC { UEXP($$,$2,'-',1);} + | '!' expr { UEXP($$,$2,'!',1);} + | '~' expr { UEXP($$,$2,'~',1);} + | expr T_IS_IDENTICAL expr { BEXP($$,$1,$3,T_IS_IDENTICAL);} + | expr T_IS_NOT_IDENTICAL expr { BEXP($$,$1,$3,T_IS_NOT_IDENTICAL);} + | expr T_IS_EQUAL expr { BEXP($$,$1,$3,T_IS_EQUAL);} + | expr T_IS_NOT_EQUAL expr { BEXP($$,$1,$3,T_IS_NOT_EQUAL);} + | expr '<' expr { BEXP($$,$1,$3,'<');} + | expr T_IS_SMALLER_OR_EQUAL expr { BEXP($$,$1,$3, + T_IS_SMALLER_OR_EQUAL);} + | expr '>' expr { BEXP($$,$1,$3,'>');} + | expr T_IS_GREATER_OR_EQUAL expr { BEXP($$,$1,$3, + T_IS_GREATER_OR_EQUAL);} + | expr T_INSTANCEOF + class_name_reference { BEXP($$,$1,$3,T_INSTANCEOF);} + | '(' expr ')' { UEXP($$,$2,'(',1);} + | expr '?' expr ':' expr { _p->onQOp($$, $1, $3, $5);} + | internal_functions { $$ = $1;} + | T_INT_CAST expr { UEXP($$,$2,T_INT_CAST,1);} + | T_DOUBLE_CAST expr { UEXP($$,$2,T_DOUBLE_CAST,1);} + | T_STRING_CAST expr { UEXP($$,$2,T_STRING_CAST,1);} + | T_ARRAY_CAST expr { UEXP($$,$2,T_ARRAY_CAST,1);} + | T_OBJECT_CAST expr { UEXP($$,$2,T_OBJECT_CAST,1);} + | T_BOOL_CAST expr { UEXP($$,$2,T_BOOL_CAST,1);} + | T_UNSET_CAST expr { UEXP($$,$2,T_UNSET_CAST,1);} + | T_EXIT exit_expr { UEXP($$,$2,T_EXIT,1);} + | '@' expr { UEXP($$,$2,'@',1);} + | scalar { $$ = $1;} + | T_ARRAY '(' array_pair_list ')' { _p->onArray($$,$3);} + | '`' encaps_list '`' { _p->onEncapsList($$,'`',$2);} + | T_PRINT expr { UEXP($$,$2,T_PRINT,1);} + | T_HPHP_NOTE expr { _p->onHphpNoteExpr($$,$1,$2);} +; + +function_call: + T_STRING '(' + function_call_parameter_list ')' { _p->onCall($$,0,$1,$3,NULL);} + | variable_without_objects '(' + function_call_parameter_list ')' { _p->onCall($$,1,$1,$3,NULL);} + | fully_qualified_class_name + T_PAAMAYIM_NEKUDOTAYIM + T_STRING '(' + function_call_parameter_list ')' { _p->onCall($$,0,$3,$5,&$1);} + | fully_qualified_class_name + T_PAAMAYIM_NEKUDOTAYIM + variable_without_objects '(' + function_call_parameter_list ')' { _p->onCall($$,1,$3,$5,&$1);} +; +fully_qualified_class_name: + T_STRING { $$ = $1;} +; +class_name_reference: + T_STRING { _p->onName($$, $1, true);} + | dynamic_class_name_reference { _p->onName($$, $1, false);} +; +dynamic_class_name_reference: + base_variable { _p->pushObject($1);} + T_OBJECT_OPERATOR object_property + object_properties { _p->popObject($$);} + | base_variable { $$ = $1; } +; +object_properties: + object_properties + dynamic_class_name_variable_prop { } + | { } +; +dynamic_class_name_variable_prop: + T_OBJECT_OPERATOR object_property { } +; + +exit_expr: + '(' ')' { $$.reset();} + | '(' expr ')' { $$ = $2;} + | { $$.reset();} +; + +ctor_arguments: + '(' + function_call_parameter_list ')' { $$ = $2;} + | { $$.reset();} +; + +common_scalar: + T_LNUMBER { _p->onScalar($$, T_LNUMBER, $1);} + | T_DNUMBER { _p->onScalar($$, T_DNUMBER, $1);} + | T_CONSTANT_ENCAPSED_STRING { _p->onScalar($$, + T_CONSTANT_ENCAPSED_STRING, $1);} + | T_LINE { _p->onScalar($$, T_LINE, $1);} + | T_FILE { _p->onScalar($$, T_FILE, $1);} + | T_CLASS_C { _p->onScalar($$, T_CLASS_C, $1);} + | T_METHOD_C { _p->onScalar($$, T_METHOD_C, $1);} + | T_FUNC_C { _p->onScalar($$, T_FUNC_C, $1);} +; +static_scalar: + common_scalar { $$ = $1;} + | T_STRING { _p->onConstant($$, $1);} + | '+' static_scalar { UEXP($$,$2,'+',1);} + | '-' static_scalar { UEXP($$,$2,'-',1);} + | T_ARRAY '(' + static_array_pair_list ')' { _p->onArray($$,$3);} + | static_class_constant { $$ = $1;} +; +static_class_constant: + T_STRING T_PAAMAYIM_NEKUDOTAYIM + T_STRING { _p->onClassConst($$, $1, $3);} +; +scalar: + T_STRING { _p->onConstant($$, $1);} + | T_STRING_VARNAME { _p->onConstant($$, $1);} + | class_constant { $$ = $1} + | common_scalar { $$ = $1;} + | '"' encaps_list '"' { _p->onEncapsList($$,'"',$2);} + | '\'' encaps_list '\'' { _p->onEncapsList($$,'\'',$2);} + | T_START_HEREDOC encaps_list + T_END_HEREDOC { _p->onEncapsList($$,T_START_HEREDOC, + $2);} +; +static_array_pair_list: + non_empty_static_array_pair_list + possible_comma { $$ = $1;} + | { $$.reset();} +; +possible_comma: + ',' { $$.reset();} + | { $$.reset();} +; +non_empty_static_array_pair_list: + non_empty_static_array_pair_list + ',' static_scalar T_DOUBLE_ARROW + static_scalar { _p->onArrayPair($$,&$1,&$3,$5,false);} + | non_empty_static_array_pair_list + ',' static_scalar { _p->onArrayPair($$,&$1,NULL,$3,false);} + | static_scalar T_DOUBLE_ARROW + static_scalar { _p->onArrayPair($$,NULL,&$1,$3,false);} + | static_scalar { _p->onArrayPair($$,NULL,NULL,$1,false);} +; + +expr: + r_variable { $$ = $1;} + | expr_without_variable { $$ = $1;} +; +r_variable: + variable { $$ = $1;} +; +w_variable: + variable { $$ = $1;} +; +rw_variable: + variable { $$ = $1;} +; +variable: + base_variable_with_function_calls { _p->pushObject($1);} + T_OBJECT_OPERATOR object_property + method_or_not { _p->appendMethodParams($5);} + variable_properties { _p->popObject($$);} + | base_variable_with_function_calls { _p->pushObject($1); + _p->popObject($$);} +; +variable_properties: + variable_properties + variable_property { } + | { } +; +variable_property: + T_OBJECT_OPERATOR object_property + method_or_not { _p->appendMethodParams($3);} +; +method_or_not: + '(' + function_call_parameter_list ')' { $$ = $2; $$.num = 1;} + | { $$.reset();} +; + +variable_without_objects: + reference_variable { $$ = $1;} + | simple_indirect_reference + reference_variable { _p->onIndirectRef($$,$1,$2);} +; +static_member: + fully_qualified_class_name + T_PAAMAYIM_NEKUDOTAYIM + variable_without_objects { _p->onStaticMember($$,$1,$3);} +; + +base_variable_with_function_calls: + base_variable { $$ = $1;} + | function_call { $$ = $1;} +; +base_variable: + reference_variable { $$ = $1;} + | simple_indirect_reference + reference_variable { _p->onIndirectRef($$,$1,$2);} + | static_member { $$ = $1; $$ = 2;} +; +reference_variable: + reference_variable + '[' dim_offset ']' { _p->onRefDim($$, $1, $3);} + | reference_variable '{' expr '}' { _p->onRefDim($$, $1, $3);} + | compound_variable { $$ = $1;} +; +compound_variable: + T_VARIABLE { _p->onSimpleVariable($$, $1);} + | '$' '{' expr '}' { _p->onDynamicVariable($$, $3, 0);} +; +dim_offset: + expr { $$ = $1;} + | { $$.reset();} +; + +object_property: + object_dim_list { } + | variable_without_objects { _p->appendProperty($1);} +; +object_dim_list: + object_dim_list '[' dim_offset ']' { _p->appendRefDim($3);} + | object_dim_list '{' expr '}' { _p->appendRefDim($3);} + | variable_name { _p->appendProperty($1);} +; +variable_name: + T_STRING { _p->onName($$, $1, true);} + | '{' expr '}' { _p->onName($$, $2, false);} +; + +simple_indirect_reference: + '$' { $$ = 1;} + | simple_indirect_reference '$' { $$++;} +; + +assignment_list: + assignment_list ',' { _p->onAListVar($$,&$1,NULL);} + | assignment_list ',' variable { _p->onAListVar($$,&$1,&$3);} + | assignment_list ',' + T_LIST '(' assignment_list ')' { _p->onAListSub($$,&$1,$5);} + | { _p->onAListVar($$,NULL,NULL);} + | variable { _p->onAListVar($$,NULL,&$1);} + | T_LIST '(' assignment_list ')' { _p->onAListSub($$,NULL,$3);} + +; + +array_pair_list: + non_empty_array_pair_list + possible_comma { $$ = $1;} + | { $$.reset();} +; +non_empty_array_pair_list: + non_empty_array_pair_list + ',' expr T_DOUBLE_ARROW expr { _p->onArrayPair($$,&$1,&$3,$5,false);} + | non_empty_array_pair_list ',' expr { _p->onArrayPair($$,&$1,NULL,$3,false);} + | expr T_DOUBLE_ARROW expr { _p->onArrayPair($$,NULL,&$1,$3,false);} + | expr { _p->onArrayPair($$,NULL,NULL,$1,false);} + | non_empty_array_pair_list + ',' expr T_DOUBLE_ARROW + '&' w_variable { _p->onArrayPair($$,&$1,&$3,$6,true);} + | non_empty_array_pair_list ',' + '&' w_variable { _p->onArrayPair($$,&$1,NULL,$4,true);} + | expr T_DOUBLE_ARROW '&' w_variable { _p->onArrayPair($$,NULL,&$1,$4,true);} + | '&' w_variable { _p->onArrayPair($$,NULL,NULL,$2,true);} +; + +encaps_list: + encaps_list encaps_var { _p->addEncap($$, $1, $2, -1);} + | encaps_list + T_ENCAPSED_AND_WHITESPACE { _p->addEncap($$, $1, $2, 0);} + | { $$.reset();} +; +encaps_var: + T_VARIABLE { _p->onSimpleVariable($$, $1);} + | T_VARIABLE '[' + encaps_var_offset ']' { _p->encapRefDim($$, $1, $3);} + | T_VARIABLE T_OBJECT_OPERATOR + T_STRING { _p->encapObjProp($$, $1, $3);} + | T_DOLLAR_OPEN_CURLY_BRACES + expr '}' { _p->onDynamicVariable($$, $2, 1);} + | T_DOLLAR_OPEN_CURLY_BRACES + T_STRING_VARNAME '[' expr ']' '}' { _p->encapArray($$, $2, $4);} + | T_CURLY_OPEN variable '}' { $$ = $2;} +; +encaps_var_offset: + T_STRING { $$ = $1; $$ = T_STRING;} + | T_NUM_STRING { $$ = $1; $$ = T_NUM_STRING;} + | T_VARIABLE { $$ = $1; $$ = T_VARIABLE;} +; + +internal_functions: + T_ISSET '(' isset_variables ')' { UEXP($$,$3,T_ISSET,1);} + | T_EMPTY '(' variable ')' { UEXP($$,$3,T_EMPTY,1);} + | T_INCLUDE expr { UEXP($$,$2,T_INCLUDE,1);} + | T_INCLUDE_ONCE expr { UEXP($$,$2,T_INCLUDE_ONCE,1);} + | T_EVAL '(' expr ')' { UEXP($$,$3,T_EVAL,1);} + | T_REQUIRE expr { UEXP($$,$2,T_REQUIRE,1);} + | T_REQUIRE_ONCE expr { UEXP($$,$2,T_REQUIRE_ONCE,1);} +; + +isset_variables: + variable { _p->onExprListElem($$, NULL, $1);} + | isset_variables ',' variable { _p->onExprListElem($$, &$1, $3);} +; + +class_constant: + fully_qualified_class_name + T_PAAMAYIM_NEKUDOTAYIM T_STRING { _p->onClassConst($$, $1, $3);} +; +%% + +static int __attribute__((unused)) suppress_warning = yydebug; diff --git a/src/cpp/eval/parser/parser.cpp b/src/cpp/eval/parser/parser.cpp new file mode 100644 index 0000000000000..2fe667a356c2b --- /dev/null +++ b/src/cpp/eval/parser/parser.cpp @@ -0,0 +1,1129 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +using namespace HPHP; +using namespace HPHP::Eval; +using namespace std; +using namespace boost; + +#define NEW_EXP0(cls) \ + cls##ExpressionPtr(new cls##Expression(this)) +#define NEW_EXP(cls, e...) \ + cls##ExpressionPtr(new cls##Expression(this, e)) +#define NEW_STMT0(cls) \ + cls##StatementPtr(new cls##Statement(this)) +#define NEW_STMT(cls, e...) \ + cls##StatementPtr(new cls##Statement(this, e)) + +/////////////////////////////////////////////////////////////////////////////// +// statics + +StatementPtr Parser::parseString(const char *input, + vector &statics) { + ASSERT(input); + istringstream iss(input); + stringstream ss; + istream *is = RuntimeOption::EnableXHP ? preprocessXHP(iss, ss, "") : &iss; + Scanner scanner(new ylmm::basic_buffer(*is, false, true), true, false); + Parser parser(scanner, NULL, statics); + if (parser.parse()) { + scanner.flushFlex(); + Logger::Error("Error parsing %s: %s\n", input, + parser.getMessage().c_str()); + return StatementPtr(); + } + StatementPtr s = parser.getTree(); + return s; +} + +StatementPtr Parser::parseFile(const char *input, + vector &statics) { + ASSERT(input); + ifstream iss(input); + StatementPtr s; + if (!iss.good()) return s; + + stringstream ss; + istream *is = RuntimeOption::EnableXHP ? preprocessXHP(iss, ss, input) : &iss; + Scanner scanner(new ylmm::basic_buffer(*is, false, true), + true, false); + Parser parser(scanner, input, statics); + if (parser.parse()) { + scanner.flushFlex(); + Logger::Error("Error parsing %s: %s\n", input, + parser.getMessage().c_str()); + return StatementPtr(); + } + s = parser.getTree(); + return s; +} + +/////////////////////////////////////////////////////////////////////////////// +String Location::toString() const { + StringBuffer buf; + buf.printf("%s:%d:%d", this->file, this->line1, this->char1); + return buf.detach(); +} + +/////////////////////////////////////////////////////////////////////////////// + +Parser::Parser(Scanner &s, const char *fileName, + vector &statics) + : m_scanner(s), m_staticStatements(statics) { + _location = &m_location; + m_messenger.error_stream(m_err); + m_messenger.message_stream(m_msg); + messenger(m_messenger); + m_fileName = fileName; +} + +ClassStatementPtr Parser::currentClass() const { + if (haveClass()) { + return peekClass(); + } + return ClassStatementPtr(); +} + +StatementPtr Parser::getTree() const { + return m_tree; +} + +std::string Parser::getMessage() { + string ret; + ret += m_scanner.getError(); + int line = m_scanner.getLine(); + int column = m_scanner.getColumn(); + + ret += " ("; + ret += string("Line: ") + lexical_cast(line); + ret += ", Char: " + lexical_cast(column) + "): "; + ret += m_err.str() + "\n"; + return ret; +} + +void Parser::getLocation(Location &location) { + location.file = file(); + location.line1 = line1(); + location.char1 = char1(); +} + +void Parser::pushClass(ClassStatementPtr cl) { m_classes.push(cl); } +bool Parser::haveClass() const { return !m_classes.empty(); } +ClassStatementPtr Parser::peekClass() const { return m_classes.top(); } +void Parser::popClass() { m_classes.pop(); } + +void Parser::pushFunc(FunctionStatementPtr fs) { m_funcs.push(fs); } +bool Parser::haveFunc() const { return !m_funcs.empty(); } +FunctionStatementPtr Parser::peekFunc() const { return m_funcs.top(); } +void Parser::popFunc() { m_funcs.pop(); } + +const char *Parser::file() { + return m_fileName; +} + +int Parser::line0() { + return m_location.first_line(); +} + +int Parser::char0() { + return m_location.first_column(); +} + +int Parser::line1() { + return m_location.last_line(); +} + +int Parser::char1() { + return m_location.last_column(); +} + +int Parser::scan(void *arg /* = NULL */) { + return m_scanner.getNextToken(token(), where()); +} + +/////////////////////////////////////////////////////////////////////////////// +// names + +void Parser::onName(Token &out, Token &name, bool string) { + out.reset(); + if (string) { + out->name() = Name::fromString(this, name.getText()); + } else { + out->name() = Name::fromExp(this, name->exp()); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// variables + +void Parser::onStaticVariable(Token &out, Token *exprs, Token &var, + Token *value) { + out.reset(); + if (exprs) { + out = *exprs; + } + ExpressionPtr exp; + if (value) { + exp = (*value)->exp(); + } + out->staticVars(). + push_back(StaticVariablePtr(new StaticVariable(this, var.getText(), + exp))); +} + +void Parser::onSimpleVariable(Token &out, Token &var) { + out.reset(); + if (var.getText() == "this") { + out->exp() = NEW_EXP0(This); + } else { + int idx = -1; + if (haveFunc()) { + idx = peekFunc()->declareVariable(var.getText()); + } + out->exp() = NEW_EXP(Variable, + Name::fromString(this, var.getText()), idx); + } +} + +void Parser::onDynamicVariable(Token &out, Token &expr, bool encap) { + out.reset(); + out->exp() = getDynamicVariable(expr->exp(), encap); +} + +void Parser::onIndirectRef(Token &out, Token &refCount, Token &var) { + out.reset(); + out->exp() = var->exp(); + for (int i = 0; i < refCount.num; i++) { + out->exp() = createDynamicVariable(out->exp()); + } +} + +void Parser::onStaticMember(Token &out, Token &className, Token &name) { + out.reset(); + ArrayElementExpressionPtr arr = name->getExp(); + string cn = className.getText(); + if (haveClass()) { + if (cn == "self") { + cn = peekClass()->name(); + } else if (cn == "parent") { + cn = peekClass()->parent(); + } + } + if (arr) { + arr->sinkStaticMember(this, cn); + out->exp() = name->exp(); + } else { + NamePtr n; + VariableExpressionPtr var = name->getExp(); + if (var) { + n = var->getName(); + } + ASSERT(n); + out->exp() = NEW_EXP(StaticMember, cn, n); + } +} + +void Parser::onRefDim(Token &out, Token &var, Token &offset) { + out.reset(); + if (!var->exp()) { + ASSERT(false); + //var->exp() = NEW_EXP(ConstantExpression, var.getText()); + } + LvalExpressionPtr lv = var->getExp(); + ASSERT(lv); + out->exp() = NEW_EXP(ArrayElement, lv, offset->exp()); +} + +ExpressionPtr Parser::getDynamicVariable(ExpressionPtr exp, bool encap) { + NamePtr n; + if (encap) { + ConstantExpressionPtr var = exp->cast(); + if (var) { + n = Name::fromString(this, var->getName()); + } + } else { + n = Name::fromExp(this, exp); + } + return NEW_EXP(Variable, n); +} + +ExpressionPtr Parser::createDynamicVariable(ExpressionPtr exp) { + return NEW_EXP(Variable, Name::fromExp(this, exp)); +} + +void Parser::onCallParam(Token &out, Token *params, Token &expr, bool ref) { + out.reset(); + if (params) { + out = *params; + } + ExpressionPtr param = expr->exp(); + if (ref) { + param = NEW_EXP(RefParam, param->cast()); + } + out->exprs().push_back(param); +} + +void Parser::onCall(Token &out, bool dynamic, Token &name, Token ¶ms, + Token *className) { + out.reset(); + NamePtr n; + if (dynamic) { + n = Name::fromExp(this, name->exp()); + } else { + n = Name::fromString(this, name.getText()); + string s = name.getText(); + if((s == "func_num_args") || + (s == "func_get_args") || + (s == "func_get_arg")) { + m_hasCallToGetArgs = true; + } + } + + if (className) { + string cn = className->getText(); + if (haveClass()) { + if (cn == "self") { + cn = peekClass()->name(); + } else if (cn == "parent") { + cn = peekClass()->parent(); + } + } + out->exp() = NEW_EXP(StaticMethod, cn, n, + params->exprs()); + } else { + out->exp() = SimpleFunctionCallExpression::make(this, n, + params->exprs(), *this); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// object property and method calls + +void Parser::pushObject(Token &base) { + m_objects.push_back(base->exp()); +} + +void Parser::popObject(Token &out) { + out->exp() = m_objects.back(); + m_objects.pop_back(); +} + +void Parser::appendMethodParams(Token ¶ms) { + if (params.num == 1) { + ObjectPropertyExpressionPtr prop = (m_objects.back())-> + cast(); + if (prop) { + ObjectMethodExpressionPtr method = + NEW_EXP(ObjectMethod, + prop->getObject(), prop->getProperty(), params->exprs()); + m_objects.back() = method; + } else { + m_objects.back() = NEW_EXP(SimpleFunctionCall, + Name::fromExp(this, m_objects.back()), + params->exprs()); + } + } +} + +void Parser::appendProperty(Token &prop) { + // Gross + if (prop->getMode() == TokenPayload::SingleName) { + m_objects.back() = NEW_EXP(ObjectProperty, m_objects.back(), prop->name()); + } else { + m_objects.back() = NEW_EXP(ObjectProperty, m_objects.back(), + Name::fromExp(this, prop->exp())); + } +} + +void Parser::appendRefDim(Token &offset) { + LvalExpressionPtr lv = m_objects.back()->cast(); + ASSERT(lv); + m_objects.back() = NEW_EXP(ArrayElement, lv, offset->exp()); +} + +/////////////////////////////////////////////////////////////////////////////// +// encapsed expressions + +void Parser::onEncapsList(Token &out, int type, Token &list) { + out.reset(); + out->exp() = NEW_EXP(EncapsList, list->exprs(), type == '`'); +} + +void Parser::addEncap(Token &out, Token &list, Token &expr, int type) { + out.reset(); + out = list; + ExpressionPtr exp; + if (type == -1) { + exp = expr->exp(); + } else { + ScalarExpressionPtr scalar = + NEW_EXP(Scalar, T_STRING, expr.getText()); + exp = scalar; + } + out->exprs().push_back(exp); +} + +void Parser::encapRefDim(Token &out, Token &var, Token &offset) { + out.reset(); + ExpressionPtr dim; + switch (offset.num) { + case T_STRING: + dim = NEW_EXP(Scalar, T_STRING, offset.getText()); + break; + case T_NUM_STRING: + dim = NEW_EXP(Scalar, T_NUM_STRING, offset.getText()); + break; + case T_VARIABLE: + dim = NEW_EXP(Variable, Name::fromString(this, offset.getText())); + break; + default: + ASSERT(false); + } + + LvalExpressionPtr arr = NEW_EXP(Variable, + Name::fromString(this, var.getText())); + out->exp() = NEW_EXP(ArrayElement, arr, dim); +} + +void Parser::encapObjProp(Token &out, Token &var, Token &name) { + out.reset(); + ExpressionPtr obj; + if (var.getText() == "this") { + obj = NEW_EXP0(This); + } else { + obj = NEW_EXP(Variable, Name::fromString(this, var.getText())); + } + out->exp() = NEW_EXP(ObjectProperty, obj, Name::fromString(this, + name.getText())); +} + +void Parser::encapArray(Token &out, Token &var, Token &expr) { + out.reset(); + LvalExpressionPtr arr = NEW_EXP(Variable, Name::fromString(this, + var.getText())); + ExpressionPtr exp = NEW_EXP(ArrayElement, arr, expr->exp()); + out->exp() = getDynamicVariable(exp, false); +} + +/////////////////////////////////////////////////////////////////////////////// +// expressions + +void Parser::onConstant(Token &out, Token &constant) { + out.reset(); + string lower = Util::toLower(constant.getText()); + if (lower == "true") { + out->exp() = NEW_EXP(Scalar, true); + } else if (lower == "false") { + out->exp() = NEW_EXP(Scalar, false); + } else if (lower == "null") { + out->exp() = NEW_EXP0(Scalar); + } else { + out->exp() = NEW_EXP(Constant, constant.getText()); + } +} + +void Parser::onScalar(Token &out, int type, Token &scalar) { + out.reset(); + ScalarExpressionPtr exp; + string stext = scalar.getText(); + switch (type) { + case T_CLASS_C: + type = T_STRING; + stext = haveClass() ? peekClass()->name() : ""; + break; + case T_METHOD_C: + type = T_STRING; + if (haveClass() && haveFunc()) { + stext = peekClass()->name() + "::" + peekFunc()->name(); + break; + } + // Fall through + case T_FUNC_C: + type = T_STRING; + stext = haveFunc() ? peekFunc()->name() : ""; + } + switch (type) { + case T_STRING: + case T_LNUMBER: + case T_DNUMBER: + exp = NEW_EXP(Scalar, type, stext); + break; + case T_CONSTANT_ENCAPSED_STRING: + exp = NEW_EXP(Scalar, T_STRING, stext); + break; + case T_LINE: { + exp = NEW_EXP(Scalar, T_LNUMBER, + lexical_cast(line1())); + break; + } + case T_FILE: { + exp = NEW_EXP(Scalar, T_STRING, file()); + break; + } + default: + ASSERT(false); + } + out->exp() = exp; +} + +void Parser::onExprListElem(Token &out, Token *exprs, Token &expr) { + out.reset(); + if (exprs) { + out = *exprs; + } + out->exprs().push_back(expr->exp()); +} + +void Parser::onListAssignment(Token &out, Token &vars, Token &expr) { + out.reset(); + ListElementPtr le(new SubListElement(this, vars->listElems())); + out->exp() = NEW_EXP(ListAssignment, le, expr->exp()); +} + +void Parser::onAListVar(Token &out, Token *list, Token *var) { + out.reset(); + if (list) { + out = *list; + } + LvalExpressionPtr lv; + if (var) { + lv = (*var)->getExp(); + } + ListElementPtr le(new LvalListElement(this, lv)); + out->listElems().push_back(le); +} +void Parser::onAListSub(Token &out, Token *list, Token &sublist) { + out.reset(); + if (list) { + out = *list; + } + ListElementPtr le(new SubListElement(this, sublist->listElems())); + out->listElems().push_back(le); +} + + +void Parser::onAssign(Token &out, Token &var, Token &expr, bool ref) { + out.reset(); + LvalExpressionPtr lv = var->getExp(); + if (!lv) { + throw FatalErrorException("Can't use function return/method value in write " + "context"); + } + if (ref) { + out->exp() = NEW_EXP(AssignmentRef, lv, expr->exp()); + } else { + out->exp() = NEW_EXP(AssignmentOp, '=', lv, expr->exp()); + } +} + +void Parser::onAssignNew(Token &out, Token &var, Token &name, Token &args) { + out.reset(); + LvalExpressionPtr lv = var->getExp(); + if (!lv) { + throw FatalErrorException("Can't use function/method return value in write " + "context"); + } + ExpressionPtr exp; + exp = NEW_EXP(NewObject, name->name(), args->exprs()); + out->exp() = NEW_EXP(AssignmentOp, '=', lv, exp); +} + +void Parser::onNewObject(Token &out, Token &name, Token &args) { + out.reset(); + out->exp() = NEW_EXP(NewObject, name->name(), args->exprs()); +} + +void Parser::onUnaryOpExp(Token &out, Token &operand, int op, bool front) { + out.reset(); + switch (op) { + case T_INCLUDE: + case T_INCLUDE_ONCE: + case T_REQUIRE: + case T_REQUIRE_ONCE: + { + IncludeExpressionPtr exp = NEW_EXP(Include, op == T_INCLUDE || + op == T_INCLUDE_ONCE, + op == T_INCLUDE_ONCE || + op == T_REQUIRE_ONCE, + operand->exp()); + out->exp() = exp; + } + break; + case T_INC: + case T_DEC: + { + LvalExpressionPtr lv = operand->getExp(); + if (!lv) { + throw FatalErrorException("Can't use function/method return value in write " + "context"); + } + out->exp() = NEW_EXP(IncOp,operand->exp(), op == T_INC, front); + break; + } + case T_ISSET: + { + out->exp() = NEW_EXP(Isset, operand->exprs()); + break; + } + default: + { + UnaryOpExpressionPtr exp = NEW_EXP(UnaryOp, operand->exp(), op, + front); + out->exp() = exp; + } + break; + } +} + +void Parser::onBinaryOpExp(Token &out, Token &operand1, Token &operand2, + int op) { + out.reset(); + switch (op) { + case T_PLUS_EQUAL: + case T_MINUS_EQUAL: + case T_MUL_EQUAL: + case T_DIV_EQUAL: + case T_CONCAT_EQUAL: + case T_MOD_EQUAL: + case T_AND_EQUAL: + case T_OR_EQUAL: + case T_XOR_EQUAL: + case T_SL_EQUAL: + case T_SR_EQUAL: + { + LvalExpressionPtr lv = operand1->getExp(); + if (!lv) { + throw FatalErrorException("Can't use function/method return value in write " + "context"); + } + out->exp() = NEW_EXP(AssignmentOp, op, lv, operand2->exp()); + break; + } + case T_INSTANCEOF: + { + out->exp() = NEW_EXP(InstanceOf, operand1->exp(), operand2->name()); + break; + } + default: + out->exp() = NEW_EXP(BinaryOp, operand1->exp(), op, operand2->exp()); + } +} + +void Parser::onQOp(Token &out, Token &exprCond, Token &expYes, Token &expNo) { + out.reset(); + out->exp() = NEW_EXP(QOp, exprCond->exp(), expYes->exp(), expNo->exp()); +} + +void Parser::onArray(Token &out, Token &pairs) { + out.reset(); + out->exp() = NEW_EXP(Array, pairs->arrayPairs()); +} + +void Parser::onArrayPair(Token &out, Token *pairs, Token *name, Token &value, + bool ref) { + out.reset(); + if (pairs) { + out = *pairs; + } + ArrayPairPtr ap; + if (ref) { + // Parser guarantees lv + LvalExpressionPtr lv = value->getExp(); + ASSERT(lv); + if (name) { + ap = ArrayPairPtr(new ArrayPairRef(this, (*name)->exp(), lv)); + } else { + ap = ArrayPairPtr(new ArrayPairRef(this, lv)); + } + } else { + if (name) { + ap = ArrayPairPtr(new ArrayPairVal(this, (*name)->exp(), + value->exp())); + } else { + ap = ArrayPairPtr(new ArrayPairVal(this, value->exp())); + } + } + + out->arrayPairs().push_back(ap); +} + +void Parser::onClassConst(Token &out, Token &className, Token &name) { + out.reset(); + string cn = className.getText(); + if (haveClass()) { + if (cn == "self") { + cn = peekClass()->name(); + } else if (cn == "parent") { + cn = peekClass()->parent(); + } + } + out->exp() = NEW_EXP(ClassConstant, cn, name.getText()); +} + +/////////////////////////////////////////////////////////////////////////////// +// function/method declaration + +void Parser::onFunctionStart(Token &name) { + FunctionStatementPtr func = NEW_STMT(Function, name.getText(), + m_scanner.getDocComment()); + m_hasCallToGetArgs = false; + pushFunc(func); +} + +void Parser::onFunction(Token &out, Token &ref, Token &name, Token ¶ms, + Token &stmt) { + out.reset(); + FunctionStatementPtr func = peekFunc(); + ASSERT(func); + func->init(ref.num, + params->params(), + stmt->getStmtList(), + m_hasCallToGetArgs); + out->stmt() = func; + popFunc(); +} + +void Parser::onParam(Token &out, Token *params, Token &type, Token &var, + bool ref, Token *defValue) { + out.reset(); + if (params) { + out = *params; + } + int idx = -1; + if (haveFunc()) { + FunctionStatementPtr func = peekFunc(); + idx = func->declareVariable(var.getText()); + } + ParameterPtr p(new Parameter(this, type.getText(), var.getText(), + idx, ref, defValue ? (*defValue)->exp() + : ExpressionPtr(), out->params().size() + 1)); + out->params().push_back(p); +} + +void Parser::onClassStart(Token &name, Token *parent) { + pushClass(NEW_STMT(Class, name.getText(), parent ? parent->getText() : "", + m_scanner.getDocComment())); +} + +void Parser::onClass(Token &out, Token &type, Token &bases) { + out.reset(); + ClassStatementPtr cs = peekClass(); + popClass(); + int mod = 0; + if (type.num == T_ABSTRACT) mod = ClassStatement::Abstract; + else if (type.num == T_FINAL) mod = ClassStatement::Final; + cs->setModifiers(mod); + std::vector &interfaceNames = bases->strings(); + cs->addBases(interfaceNames); + cs->finish(); + out->stmt() = cs; +} + +void Parser::onInterface(Token &out, Token &bases) { + out.reset(); + ClassStatementPtr cs = peekClass(); + popClass(); + cs->setModifiers(ClassStatement::Interface); + std::vector &interfaceNames = bases->strings(); + cs->addBases(interfaceNames); + out->stmt() = cs; +} + +void Parser::onInterfaceName(Token &out, Token *names, Token &name) { + out.reset(); + if (names) { + out = *names; + } + out->strings().push_back(name.getText()); +} + +void Parser::onClassVariableStart(Token &mods) { + ClassStatementPtr cs = peekClass(); + cs->setModifiers(mods.num); +} + +void Parser::onClassVariable(Token &name, Token *val) { + ClassStatementPtr cs = peekClass(); + int mod = cs->getModifiers(); + ExpressionPtr v; + if (val) { + v = (*val)->exp(); + } + cs->addVariable(ClassVariablePtr( + new ClassVariable(this, name.getText(), mod, v, + m_scanner.getDocComment()))); +} + +void Parser::onClassConstant(Token &name, Token &val) { + ClassStatementPtr cs = peekClass(); + cs->addConstant(name.getText(), val->exp()); +} + +void Parser::onMethodStart(Token &name, Token &modifiers) { + ClassStatementPtr cs = peekClass(); + FunctionStatementPtr func = NEW_STMT(Method, name.getText(), cs.get(), + modifiers.num, + m_scanner.getDocComment()); + m_hasCallToGetArgs = false; + pushFunc(func); +} + +void Parser::onMethod(Token &modifiers, Token &ref, Token &name, + Token ¶ms, Token &stmt) { + ClassStatementPtr cs = peekClass(); + MethodStatementPtr ms = peekFunc()->cast(); + ASSERT(ms); + popFunc(); + StatementListStatementPtr stmts = stmt->getStmtList(); + ms->init(ref.num, params->params(), stmts, m_hasCallToGetArgs); + cs->addMethod(ms); +} + +void Parser::onMemberModifier(Token &out, Token *modifiers, Token &modifier) { + out.reset(); + if (modifiers) { + out.num = modifiers->num; + } + switch (modifier.num) { + case T_PUBLIC: out.num |= ClassStatement::Public; break; + case T_PROTECTED: out.num |= ClassStatement::Protected; break; + case T_PRIVATE: out.num |= ClassStatement::Private; break; + case T_STATIC: out.num |= ClassStatement::Static; break; + case T_ABSTRACT: out.num |= ClassStatement::Abstract; break; + case T_FINAL: out.num |= ClassStatement::Final; break; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// statements + +void Parser::saveParseTree(Token &tree) { + StatementListStatementPtr s = tree->getStmtList(); + // Reorder so that classes and funcs are first. + if (s) { + std::vector scopes; + std::vector rest; + const std::vector &svec = s->stmts(); + for (std::vector::const_iterator it = svec.begin(); + it != svec.end(); ++it) { + if ((*it)->cast() || (*it)->cast()) { + scopes.push_back(*it); + } else { + rest.push_back(*it); + } + } + rest.insert(rest.begin(), scopes.begin(), scopes.end()); + m_tree = StatementPtr(new StatementListStatement(this, rest)); + } else { + m_tree = tree->stmt(); + } + if (!m_tree) { + m_tree = NEW_STMT0(StatementList); + } +} + +void Parser::addStatement(Token &out, Token &stmts, Token &new_stmt) { + out.reset(); + if (!stmts->stmt()) { + out->stmt() = NEW_STMT0(StatementList); + } else { + out->stmt() = stmts->stmt(); + } + ASSERT(out->getStmtList()); + if (new_stmt->stmt()) { + out->getStmtList()->add(new_stmt->stmt()); + } +} + +void Parser::finishStatement(Token &out, Token &stmts) { + out.reset(); + out->stmt() = stmts->stmt(); +} + +void Parser::onBlock(Token &out, Token &stmts) { + out.reset(); + out->stmt() = stmts->stmt(); +} + +void Parser::onIf(Token &out, Token &cond, Token &stmt, Token &elseifs, + Token &elseStmt) { + out.reset(); + std::vector &branches = elseifs->ifBranches(); + branches.insert(branches.begin(), + IfBranchPtr(new IfBranch(this, cond->exp(), + stmt->stmt()))); + out->stmt() = NEW_STMT(If, branches, elseStmt->stmt()); +} + +void Parser::onElseIf(Token &out, Token &elseifs, Token &cond, Token &stmt) { + out.reset(); + out = elseifs; + out->ifBranches().push_back(IfBranchPtr(new IfBranch(this, + cond->exp(), + stmt->stmt()))); +} + +void Parser::onWhile(Token &out, Token &cond, Token &stmt) { + out.reset(); + out->stmt() = NEW_STMT(While, cond->exp(), stmt->stmt()); +} + +void Parser::onDo(Token &out, Token &stmt, Token &cond) { + out.reset(); + out->stmt() = NEW_STMT(DoWhile, stmt->stmt(), cond->exp()); +} + +void Parser::onFor(Token &out, Token &expr1, Token &expr2, Token &expr3, + Token &stmt) { + out.reset(); + out->stmt() = NEW_STMT(For, expr1->exprs(), expr2->exprs(), + expr3->exprs(), stmt->stmt()); +} + +void Parser::onSwitch(Token &out, Token &expr, Token &cases) { + out.reset(); + out->stmt() = NEW_STMT(Switch, expr->exp(), + cases->cases()); +} + +void Parser::onCase(Token &out, Token &cases, Token *cond, Token &stmt) { + out.reset(); + out = cases; + out->cases().push_back(NEW_STMT(Case, cond ? + (*cond)->exp() : ExpressionPtr(), + stmt->stmt())); +} + +void Parser::onBreak(Token &out, Token *expr) { + out.reset(); + out->stmt() = NEW_STMT(Break, + expr ? (*expr)->exp() : ExpressionPtr(), true); +} + +void Parser::onContinue(Token &out, Token *expr) { + out.reset(); + out->stmt() = NEW_STMT(Break, + expr ? (*expr)->exp() : ExpressionPtr(), false); +} + +void Parser::onReturn(Token &out, Token *expr) { + out.reset(); + out->stmt() = NEW_STMT(Return, expr ? + (*expr)->exp() : ExpressionPtr()); +} + +void Parser::onGlobal(Token &out, Token &expr) { + out.reset(); + out->stmt() = NEW_STMT(Global, expr->names()); +} + +void Parser::onGlobalVar(Token &out, Token *exprs, Token &expr) { + out.reset(); + if (exprs) { + out = *exprs; + } + std::vector &names = out->names(); + switch (expr.num) { + case 0: + names.push_back(Name::fromString(this, expr.getText())); + break; + case 1: + names.push_back(Name::fromExp(this, expr->exp())); + break; + default: + ASSERT(false); + } +} + +void Parser::onStatic(Token &out, Token &expr) { + out.reset(); + StaticStatementPtr st = NEW_STMT(Static, expr->staticVars()); + out->stmt() = st; + // I really hate this static nonsense. + if (haveFunc()) { + peekFunc()->declareStaticStatement(st); + } else { + m_staticStatements.push_back(st); + } +} + +void Parser::onEcho(Token &out, Token &expr, bool html) { + out.reset(); + if (html) { + if (line1() == 2 && char1() == 0 && expr.getText().data()[0] == '#') { + // skipping linux interpreter declaration + out->stmt() = NEW_STMT0(StatementList); + } else { + ExpressionPtr exp = NEW_EXP(Scalar, T_STRING, expr.getText()); + std::vector expList; + expList.push_back(exp); + out->stmt() = NEW_STMT(Echo, expList); + } + } else { + out->stmt() = NEW_STMT(Echo, expr->exprs()); + } +} + +void Parser::onUnset(Token &out, Token &expr) { + out.reset(); + out->stmt() = NEW_STMT(Unset, expr->exprs()); +} + +void Parser::onExpStatement(Token &out, Token &expr) { + out.reset(); + out->stmt() = NEW_STMT(Expr, expr->exp()); +} + +void Parser::onForEach(Token &out, Token &arr, Token &name, Token &value, + Token &stmt) { + out.reset(); + if (value->exp()) { + if (value.num == 0) { + out->stmt() = NEW_STMT(ForEach, arr->exp(), + name->getExp(), + value->getExp(), stmt->stmt()); + } else { + out->stmt() = NEW_STMT(StrongForEach, arr->exp(), + name->getExp(), + value->getExp(), stmt->stmt()); + } + } else { + if (name.num == 0) { + out->stmt() = NEW_STMT(ForEach, arr->exp(), LvalExpressionPtr(), + name->getExp(), stmt->stmt()); + } else { + out->stmt() = NEW_STMT(StrongForEach, arr->exp(), LvalExpressionPtr(), + name->getExp(), stmt->stmt()); + } + } +} + +void Parser::onTry(Token &out, Token &tryStmt, Token &className, Token &var, + Token &catchStmt, Token &catches) { + out.reset(); + std::vector &cs = catches->catches(); + cs.insert(cs.begin(), + CatchBlockPtr(new CatchBlock(this, className.getText(), + var.getText(), catchStmt->stmt()))); + out->stmt() = NEW_STMT(Try, tryStmt->stmt(), cs); +} + +void Parser::onCatch(Token &out, Token &catches, Token &className, Token &var, + Token &stmt) { + out.reset(); + out = catches; + out->catches().push_back(CatchBlockPtr(new CatchBlock(this, + className.getText(), + var.getText(), + stmt->stmt()))); +} + +void Parser::onThrow(Token &out, Token &expr) { + out.reset(); + out->stmt() = NEW_STMT(Throw, expr->exp()); +} + + /* +void Parser::addHphpNote(ConstructPtr c, const std::string ¬e) { + + if (note[0] == '@') { + CodeError::ErrorType e; + if (CodeError::lookupErrorType(note.substr(1), e)) { + c->addSuppressError(e); + } else { + c->addHphpNote(note); + } + } else { + c->addHphpNote(note); + } + +} + */ + +void Parser::onHphpNoteExpr(Token &out, Token ¬e, Token &expr) { + out.reset(); + //addHphpNote(expr->exp(), note.getText()); + out->exp() = expr->exp(); +} +void Parser::onHphpNoteStatement(Token &out, Token ¬e, Token &stmt) { + out.reset(); + //addHphpNote(stmt->stmt(), note.getText()); + out->stmt() = stmt->stmt(); +} + +void Parser::addHphpDeclare(Token &declare) { + +} + +void Parser::addHphpSuppressError(Token &error) { + +} diff --git a/src/cpp/eval/parser/parser.h b/src/cpp/eval/parser/parser.h new file mode 100644 index 0000000000000..667673385d663 --- /dev/null +++ b/src/cpp/eval/parser/parser.h @@ -0,0 +1,192 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_PARSER_H__ +#define __EVAL_PARSER_H__ + +#include + +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(Location); +DECLARE_AST_PTR(Statement); +DECLARE_AST_PTR(ClassStatement); +DECLARE_AST_PTR(FunctionStatement); +DECLARE_AST_PTR(StaticStatement); + +class Parser : public ylmm::basic_parser { +public: + static StatementPtr + parseString(const char *input, + std::vector &statics); + static StatementPtr + parseFile(const char *input, + std::vector &statics); +public: + Parser(Scanner &s, const char *fileName, + std::vector &statics); + // Gets + StatementPtr getTree() const; + std::string getMessage(); + void getLocation(Location &location); + const char *file(); + int line0(); + int char0(); + int line1(); + int char1(); + + // implementing basic_parser + int scan(void *arg = NULL); + + // parser handlers + void saveParseTree(Token &tree); + void onName(Token &out, Token &name, bool string); + void onStaticVariable(Token &out, Token *exprs, Token &var, Token *value); + void onSimpleVariable(Token &out, Token &var); + void onDynamicVariable(Token &out, Token &expr, bool encap); + void onIndirectRef(Token &out, Token &refCount, Token &var); + void onStaticMember(Token &out, Token &className, Token &name); + void onRefDim(Token &out, Token &var, Token &offset); + void onCallParam(Token &out, Token *params, Token &expr, bool ref); + void onCall(Token &out, bool dynamic, Token &name, Token ¶ms, + Token *className); + void onEncapsList(Token &out, int type, Token &list); + void addEncap(Token &out, Token &list, Token &expr, int type); + void encapRefDim(Token &out, Token &var, Token &offset); + void encapObjProp(Token &out, Token &var, Token &name); + void encapArray(Token &out, Token &var, Token &expr); + void onConstant(Token &out, Token &constant); + void onScalar(Token &out, int type, Token &scalar); + void onExprListElem(Token &out, Token *exprs, Token &expr); + + void pushObject(Token &base); + void popObject(Token &out); + void appendMethodParams(Token ¶ms); + void appendProperty(Token &prop); + void appendRefDim(Token &offset); + + void onListAssignment(Token &out, Token &vars, Token &expr); + void onAListVar(Token &out, Token *list, Token *var); + void onAListSub(Token &out, Token *list, Token &sublist); + void onAssign(Token &out, Token &var, Token &expr, bool ref); + void onAssignNew(Token &out, Token &var, Token &name, Token &args); + void onNewObject(Token &out, Token &name, Token &args); + void onUnaryOpExp(Token &out, Token &operand, int op, bool front); + void onBinaryOpExp(Token &out, Token &operand1, Token &operand2, int op); + void onQOp(Token &out, Token &exprCond, Token &expYes, Token &expNo); + void onArray(Token &out, Token &pairs); + void onArrayPair(Token &out, Token *pairs, Token *name, Token &value, + bool ref); + void onClassConst(Token &out, Token &className, Token &name); + void onFunctionStart(Token &name); + void onFunction(Token &out, Token &ref, Token &name, Token ¶ms, + Token &stmt); + void onParam(Token &out, Token *params, Token &type, Token &var, + bool ref, Token *defValue); + void onClassStart(Token &name, Token *parent); + void onClass(Token &out, Token &type, Token &bases); + void onInterface(Token &out, Token &bases); + void onInterfaceName(Token &out, Token *names, Token &name); + void onClassVariableStart(Token &mods); + void onClassVariable(Token &name, Token *val); + void onClassConstant(Token &name, Token &val); + void onMethodStart(Token &name, Token &mods); + void onMethod(Token &modifiers, Token &ref, Token &name, Token ¶ms, + Token &stmt); + void onMemberModifier(Token &out, Token *modifiers, Token &modifier); + void addStatement(Token &out, Token &stmts, Token &new_stmt); + void finishStatement(Token &out, Token &stmts); + void onBlock(Token &out, Token &stmts); + void onIf(Token &out, Token &cond, Token &stmt, Token &elseifs, + Token &elseStmt); + void onElseIf(Token &out, Token &elseifs, Token &cond, Token &stmt); + void onWhile(Token &out, Token &cond, Token &stmt); + void onDo(Token &out, Token &stmt, Token &cond); + void onFor(Token &out, Token &expr1, Token &expr2, Token &expr3, + Token &stmt); + void onSwitch(Token &out, Token &expr, Token &cases); + void onCase(Token &out, Token &cases, Token *cond, Token &stmt); + void onBreak(Token &out, Token *expr); + void onContinue(Token &out, Token *expr); + void onReturn(Token &out, Token *expr); + void onGlobal(Token &out, Token &expr); + void onGlobalVar(Token &out, Token *exprs, Token &expr); + void onStatic(Token &out, Token &expr); + void onEcho(Token &out, Token &expr, bool html); + void onUnset(Token &out, Token &expr); + void onExpStatement(Token &out, Token &expr); + void onForEach(Token &out, Token &arr, Token &name, Token &value, + Token &stmt); + void onTry(Token &out, Token &tryStmt, Token &className, Token &var, + Token &catchStmt, Token &catches); + void onCatch(Token &out, Token &catches, Token &className, Token &var, + Token &stmt); + void onThrow(Token &out, Token &expr); + + //void addHphpNote(ConstructPtr c, const std::string ¬e); + void onHphpNoteExpr(Token &out, Token ¬e, Token &expr); + void onHphpNoteStatement(Token &out, Token ¬e, Token &stmt); + + void addHphpDeclare(Token &declare); + void addHphpSuppressError(Token &error); + + ClassStatementPtr currentClass() const; + + bool haveClass() const; + ClassStatementPtr peekClass() const; + bool haveFunc() const; + FunctionStatementPtr peekFunc() const; +private: + ylmm::basic_location m_location; + std::ostringstream m_err; + std::ostringstream m_msg; + ylmm::basic_messenger m_messenger; + + Scanner &m_scanner; + const char *m_fileName; + std::vector m_objects; // for parsing object property/method calls + std::stack m_classes; + std::stack m_funcs; + std::vector &m_staticStatements; + + // parser output + StatementPtr m_tree; + + void pushClass(ClassStatementPtr cl); + void popClass(); + + void pushFunc(FunctionStatementPtr fs); + void popFunc(); + bool m_hasCallToGetArgs; + + ExpressionPtr getDynamicVariable(ExpressionPtr exp, bool encap); + ExpressionPtr createDynamicVariable(ExpressionPtr exp); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + + +#endif // __HPHP_PARSER_H__ diff --git a/src/cpp/eval/parser/parser_defines.h b/src/cpp/eval/parser/parser_defines.h new file mode 100644 index 0000000000000..5291d0709d4e9 --- /dev/null +++ b/src/cpp/eval/parser/parser_defines.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_PARSER_DEFINES_H__ +#define __EVAL_PARSER_DEFINES_H__ + +/* gross but necessary for ylmm */ +#define yyparse eval_parse +#define yylex eval_lex +#define yyerror eval_error +#define yylval eval_lval +#define yychar eval_char +#define yydebug eval_debug +#define yynerrs eval_nerrs + +#define yy_create_buffer eval__create_buffer +#define yy_delete_buffer eval__delete_buffer +#define yy_flex_debug eval__flex_debug +#define yy_init_buffer eval__init_buffer +#define yy_flush_buffer eval__flush_buffer +#define yy_load_buffer_state eval__load_buffer_state +#define yy_switch_to_buffer eval__switch_to_buffer +#define yyin eval_in +#define yyleng eval_leng +#define yylineno eval_lineno +#define yyout eval_out +#define yyrestart eval_restart +#define yytext eval_text +#define yywrap eval_wrap +#define yyalloc eval_alloc +#define yyrealloc eval_realloc +#define yyfree eval_free + +void _eval_scanner_reset(); + +#endif /* __EVAL_PARSER_DEFINES_H__ */ + diff --git a/src/cpp/eval/parser/scanner.cpp b/src/cpp/eval/parser/scanner.cpp new file mode 100644 index 0000000000000..58097b2b8f84b --- /dev/null +++ b/src/cpp/eval/parser/scanner.cpp @@ -0,0 +1,311 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace HPHP; +using namespace HPHP::Eval; + +/////////////////////////////////////////////////////////////////////////////// + +const string Token::s_empty; + +TokenPayload::TokenPayload() : m_mode(None) {} + +TokenPayload::~TokenPayload() { + switch (m_mode) { + case IfBranch: delete m_data.ifBranches; break; + case CaseStatement: delete m_data.cases; break; + case Expression: delete m_data.exprs; break; + case ListElement: delete m_data.listElems; break; + case ArrayPair: delete m_data.arrayPairs; break; + case CatchBlock: delete m_data.catches; break; + case Parameter: delete m_data.params; break; + case Name: delete m_data.names; break; + case StaticVariable: delete m_data.staticVars; break; + case Strings: delete m_data.strings; break; + default: + // All good + break; + } +} + +void TokenPayload::release() { + delete this; +} + +StatementListStatementPtr TokenPayload::getStmtList() const { + return getStmt(); +} + +ExpressionPtr &TokenPayload::exp() { + if (m_mode == None) { + m_mode = SingleExpression; + } + ASSERT(m_mode = SingleExpression); + return m_exp; +} + +StatementPtr &TokenPayload::stmt() { + if (m_mode == None) { + m_mode = SingleStatement; + } + ASSERT(m_mode = SingleStatement); + return m_stmt; +} + +NamePtr &TokenPayload::name() { + if (m_mode == None) { + m_mode = SingleName; + } + ASSERT(m_mode = SingleName); + return m_name; +} + +#define GETTER(type, data) \ + std::vector &TokenPayload::data() { \ + if (m_mode == None) { \ + m_mode = type; \ + m_data.data = new std::vector(); \ + } \ + ASSERT(m_mode == type); \ + return *m_data.data; \ + } + + GETTER(IfBranch, ifBranches); + GETTER(Expression, exprs); + GETTER(CaseStatement, cases); + GETTER(ListElement, listElems); + GETTER(ArrayPair, arrayPairs); + GETTER(CatchBlock, catches); + GETTER(Parameter, params); + GETTER(Name, names); + GETTER(StaticVariable, staticVars); + +#undef GETTER + +std::vector &TokenPayload::strings() { + if (m_mode == None) { + m_mode = Strings; + m_data.strings = new std::vector(); + } + ASSERT(m_mode == Strings); + return *m_data.strings; +} + +TokenPayloadPtr &Token::operator->() { + if (!m_payload) { + m_payload = TokenPayloadPtr(new TokenPayload()); + } + return m_payload; +} + +Token &Token::operator=(Token &other) { + num = other.num; + text = other.text; + m_payload = other.m_payload; + return *this; +} + +void Token::setText(const char *t) { + text = boost::shared_ptr(new string(t)); +} + +void Token::reset() { + text.reset(); + num = 0; + m_payload.reset(); +} + +Scanner::Scanner(ylmm::basic_buffer* buf, bool bShortTags, bool bASPTags, + bool full /* = false */) + : ylmm::basic_scanner(buf), m_shortTags(bShortTags), + m_aspTags(bASPTags), m_full(full), m_line(1), m_column(0) { + _current->auto_increment(true); + m_messenger.error_stream(m_err); + m_messenger.message_stream(m_msg); + messenger(m_messenger); + _eval_scanner_init(); +} + +void Scanner::setToken(const char *rawText, int rawLeng, + const char *yytext, int yyleng, + bool save /* = true */) { + if (save || m_full) { + _token.text = boost::shared_ptr(new string(yytext, yyleng)); + } + incLoc(rawText, rawLeng); +} + +void Scanner::incLoc(const char *yytext, int yyleng) { + for (int i = 0; i < yyleng; i++) { + if (yytext[i] == '\n') { + m_line++; + m_column = 0; + } else { + m_column++; + } + } +} + +void Scanner::setDocComment(const char *yytext, int yyleng) { + m_docComment.assign(yytext, yyleng); +} + +void Scanner::setHeredocLabel(const char *label, int len) { + m_heredocLabel.assign(label, len); +} + +int Scanner::getHeredocLabelLen() const { + return m_heredocLabel.length(); +} + +const char *Scanner::getHeredocLabel() const { + return m_heredocLabel.data(); +} + +void Scanner::resetHeredoc() { + m_heredocLabel.clear(); +} + +int Scanner::getNextToken(token_type& t, location_type& l) { + int tokid; + bool done = false; + + do { + tokid = next(t); + switch (tokid) { + case T_COMMENT: + case T_DOC_COMMENT: + case T_OPEN_TAG: + case T_WHITESPACE: + break; + default: + done = true; + break; + } + } while (!done && !m_full); + + l.last_line(m_line); + l.last_column(m_column); + return tokid; +} + +string Scanner::scanEscapeString(char *str, int len, char quote_type) const { + string output; + output.reserve(len); + + if (quote_type == '\'') { + for (int i = 0; i < len; i++) { + unsigned char ch = str[i]; + if (ch == '\\') { + if (++i < len) { + switch (str[i]) { + case '\\': output += "\\"; break; + case '\'': output += '\''; break; + default: + output += ch; + output += str[i]; + break; + } + } else { + ASSERT(false); + output += ch; + } + } + else { + output += ch; + } + } + } else { + for (int i = 0; i < len; i++) { + unsigned char ch = str[i]; + if (ch == '\\') { + if (++i < len) { + switch (str[i]) { + case 'n': output += '\n'; break; + case 't': output += '\t'; break; + case 'r': output += '\r'; break; + case 'v': output += '\v'; break; + case 'f': output += '\f'; break; + case '\\': output += '\\'; break; + case '$': output += '$'; break; + case '"': + if (str[i] != quote_type) { + output += '\\'; + output += '"'; + break; + } else { + output += '"'; + break; + } + case 'x': + case 'X': + if (isxdigit(str[i+1])) { + string shex; + shex += str[++i]; // 0th hex digit + if (isxdigit(str[i+1])) { + shex += str[++i]; // 1st hex digit + } + output += strtol(shex.c_str(), NULL, 16); + } else { + output += ch; + output += str[i]; + } + break; + default: + // check for an octal + if ('0' <= str[i] && str[i] <= '7') { + string soct; + soct += str[i]; // 0th octal digit + if ('0' <= str[i+1] && str[i+1] <= '7') { + soct += str[++i]; // 1st octal digit + if ('0' <= str[i+1] && str[i+1] <= '7') { + soct += str[++i]; // 2nd octal digit + } + } + output += strtol(soct.c_str(), NULL, 8); + } else { + output += ch; + output += str[i]; + } + break; + } + } else { + output += ch; + } + } else { + output += ch; + } + } + } + return output; +} + +void Scanner::flushFlex() { + _eval_scanner_reset(); +} diff --git a/src/cpp/eval/parser/scanner.h b/src/cpp/eval/parser/scanner.h new file mode 100644 index 0000000000000..6ef6afc508874 --- /dev/null +++ b/src/cpp/eval/parser/scanner.h @@ -0,0 +1,188 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_SCANNER_H__ +#define __EVAL_SCANNER_H__ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(TokenPayload); +DECLARE_AST_PTR(IfBranch); +DECLARE_AST_PTR(StatementListStatement); +DECLARE_AST_PTR(CaseStatement); +DECLARE_AST_PTR(ListElement); +DECLARE_AST_PTR(ArrayPair); +DECLARE_AST_PTR(CatchBlock); +DECLARE_AST_PTR(Parameter); +DECLARE_AST_PTR(Name); +DECLARE_AST_PTR(StaticVariable); + +class TokenPayload { +public: + enum Mode { + None, + SingleExpression, + SingleStatement, + SingleName, + IfBranch, + CaseStatement, + Expression, + ListElement, + ArrayPair, + CatchBlock, + Parameter, + Name, + StaticVariable, + Strings + }; + + TokenPayload(); + ~TokenPayload(); + void release(); + template + AstPtr getExp() const { + return m_exp ? m_exp->cast() : AstPtr(); + } + template + AstPtr getStmt() const { + return m_stmt ? m_stmt->cast() : AstPtr(); + } + StatementListStatementPtr getStmtList() const; + + ExpressionPtr &exp(); + StatementPtr &stmt(); + NamePtr &name(); +#define GETTER(type, data) std::vector &data(); + GETTER(IfBranch, ifBranches); + GETTER(Expression, exprs); + GETTER(CaseStatement, cases); + GETTER(ListElement, listElems); + GETTER(ArrayPair, arrayPairs); + GETTER(CatchBlock, catches); + GETTER(Parameter, params); + GETTER(Name, names); + GETTER(StaticVariable, staticVars); +#undef GETTER + + std::vector &strings(); + + Mode getMode() const { return m_mode; } + +private: + ExpressionPtr m_exp; + StatementPtr m_stmt; + NamePtr m_name; + Mode m_mode; + union { + std::vector *ifBranches; + std::vector *cases; + std::vector *exprs; + std::vector *listElems; + std::vector *arrayPairs; + std::vector *catches; + std::vector *params; + std::vector *names; + std::vector *staticVars; + std::vector *strings; + } m_data; +}; + +class Token { +public: + Token() : num(0) {} + ~Token() { reset(); } + // token text after lexical analysis + boost::shared_ptr text; + int num; // internal token id + + + const std::string &getText() const { + if (text.get()) return *text.get(); + else return s_empty; + } + void setText(const char *t); + TokenPayloadPtr &operator->(); + Token &operator=(Token &other); + Token &operator=(int num) { this->num = num; return *this;} + void operator++(int) { this->num++;} + void reset(); + +private: + TokenPayloadPtr m_payload; + const static std::string s_empty; +}; + +inline std::ostream &operator<< (std::ostream &o, const Token &e) { + return o; +} + +class Scanner : public ylmm::basic_scanner { +public: + Scanner(ylmm::basic_buffer* buf, bool bShortTags, bool bASPTags, + bool full = false); + ~Scanner() { switch_buffer(0);} + void setToken(const char *rawText, int rawLeng, + const char *yytext, int yyleng, bool save = true); + bool shortTags() const { return m_shortTags;} + bool aspTags() const { return m_aspTags;} + void setHeredocLabel(const char *label, int len); + int getHeredocLabelLen() const; + const char *getHeredocLabel() const; + void resetHeredoc(); + int wrap() { return 1;} + int getNextToken(token_type& t, location_type& l); + std::string scanEscapeString(char *str, int len, char quote_type) const; + + std::string getError() const { return m_err.str();} + std::string getMessage() const { return m_msg.str();} + int getLine() const { return m_line;} + int getColumn() const { return m_column;} + void setDocComment(const char *yytext, int yyleng); + std::string getDocComment() { + std::string dc = m_docComment; + m_docComment = ""; + return dc; + } + void flushFlex(); +protected: + std::ostringstream m_err; + std::ostringstream m_msg; + ylmm::basic_messenger m_messenger; + bool m_shortTags; + bool m_aspTags; + bool m_full; + std::string m_heredocLabel; + int m_line; // last token line + int m_column; // last token column + std::string m_docComment; + void incLoc(const char *yytext, int yyleng); +}; +} +} + +extern void _eval_scanner_init(); +/////////////////////////////////////////////////////////////////////////////// + +#endif // __EVAL_SCANNER_H__ diff --git a/src/cpp/eval/runtime/arg_stack.cpp b/src/cpp/eval/runtime/arg_stack.cpp new file mode 100644 index 0000000000000..126122c1ea375 --- /dev/null +++ b/src/cpp/eval/runtime/arg_stack.cpp @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +ArgStack::ArgStack() : m_ptr(0), m_cap(400) { + m_stack = (Variant*)calloc(m_cap, sizeof(Variant)); +} + +ArgStack::~ArgStack() { + free(m_stack); +} + +void ArgStack::push(CVarRef v) { + if (m_ptr == m_cap) { + uint oldcap = m_cap; + m_cap *= 2; + m_stack = (Variant*)realloc(m_stack, m_cap * sizeof(Variant)); + memset(m_stack + oldcap, 0, oldcap * sizeof(Variant)); + } + m_stack[m_ptr++] = v; +} + +void ArgStack::pop(uint n) { + ASSERT(m_ptr >= n); + for (uint i = m_ptr - n; i < m_ptr; i++) { + m_stack[i].unset(); + } + m_ptr -= n; +} + +Array ArgStack::pull(uint s, uint n) const { + ASSERT(m_ptr >= s + n); + Array r = Array::Create(); + for (uint i = 0; i < n; i++) { + r.append(m_stack[s + i]); + } + return r; +} + +void ArgStack::clear() { + ASSERT(m_ptr == 0); + m_ptr = 0; +} + +/////////////////////////////////////////////////////////////////////////////// +} +} diff --git a/src/cpp/eval/runtime/arg_stack.h b/src/cpp/eval/runtime/arg_stack.h new file mode 100644 index 0000000000000..ddccb1088d50d --- /dev/null +++ b/src/cpp/eval/runtime/arg_stack.h @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_ARG_STACK_H__ +#define __EVAL_ARG_STACK_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +class ArgStack { +public: + ArgStack(); + ~ArgStack(); + void push(CVarRef v); + void pop(uint n); + Array pull(uint s, uint n) const; + void clear(); + uint pos() const { return m_ptr; } +private: + uint m_ptr; + uint m_cap; + Variant *m_stack; +}; + + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_ARG_STACK_H__ */ diff --git a/src/cpp/eval/runtime/assoc_list.cpp b/src/cpp/eval/runtime/assoc_list.cpp new file mode 100644 index 0000000000000..418d2882f1af6 --- /dev/null +++ b/src/cpp/eval/runtime/assoc_list.cpp @@ -0,0 +1,70 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS(VarAssocPair); + +VarAssocPair::VarAssocPair(CStrRef s, VarAssocPair *next /* = NULL */) + : m_name(s), m_next(next) {} + +AssocList::AssocList() : m_list(NULL) {} +AssocList::~AssocList() { + VarAssocPair *vp = m_list; + while (vp) { + VarAssocPair *tp = vp->next(); + DELETE(VarAssocPair)(vp); + vp = tp; + } +} + +Variant &AssocList::prepend(CStrRef name) { + m_list = NEW(VarAssocPair)(name, m_list); + return m_list->var(); +} + +Variant &AssocList::get(CStrRef name) { + Variant *v = getPtr(name); + if (!v) return prepend(name); + return *v; +} + +Variant *AssocList::getPtr(CStrRef name) { + for (VarAssocPair *vp = m_list; vp; vp = vp->next()) { + if (name.same(vp->name())) { + return &vp->var(); + } + } + return NULL; +} + +bool AssocList::exists(CStrRef name) const { + for (VarAssocPair *vp = m_list; vp; vp = vp->next()) { + if (name.same(vp->name())) { + return true; + } + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/runtime/assoc_list.h b/src/cpp/eval/runtime/assoc_list.h new file mode 100644 index 0000000000000..4db587917235f --- /dev/null +++ b/src/cpp/eval/runtime/assoc_list.h @@ -0,0 +1,52 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +class VarAssocPair { +public: + DECLARE_SMART_ALLOCATION_NOCALLBACKS(VarAssocPair); + VarAssocPair(CStrRef s, VarAssocPair *next = NULL); + Variant &var() { return m_var; } + CStrRef name() const { return m_name; } + void dump() const {} + VarAssocPair *next() const { return m_next; } +private: + String m_name; + Variant m_var; + VarAssocPair *m_next; +}; + +class AssocList { +public: + AssocList(); + ~AssocList(); + Variant &prepend(CStrRef name); + Variant &get(CStrRef name); + Variant *getPtr(CStrRef name); + bool exists(CStrRef name) const; +private: + VarAssocPair *m_list; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/runtime/eval_frame_injection.cpp b/src/cpp/eval/runtime/eval_frame_injection.cpp new file mode 100644 index 0000000000000..18dc1d0689faf --- /dev/null +++ b/src/cpp/eval/runtime/eval_frame_injection.cpp @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +String EvalFrameInjection::getFileName() { + return m_file; +} + +Array EvalFrameInjection::getArgs() { + return m_env.getParams(); +} + +void EvalFrameInjection::SetLine(const Construct *c) { + (*s_top)->line = c->loc()->line1; +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + + + diff --git a/src/cpp/eval/runtime/eval_frame_injection.h b/src/cpp/eval/runtime/eval_frame_injection.h new file mode 100644 index 0000000000000..9ecff2e90fe5c --- /dev/null +++ b/src/cpp/eval/runtime/eval_frame_injection.h @@ -0,0 +1,52 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#ifndef __HPHP_EVAL_RUNTIME_EVAL_FRAME_INJECTION_H__ +#define __HPHP_EVAL_RUNTIME_EVAL_FRAME_INJECTION_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +class VariableEnvironment; +class Construct; + +class EvalFrameInjection : public FrameInjection { +public: + EvalFrameInjection(const char *cls, const char *name, + VariableEnvironment &env, const char *file, + ObjectData *obj = NULL) + : FrameInjection(cls, name, obj), m_env(env), m_file(file) { + } + + virtual String getFileName(); + virtual Array getArgs(); + static void SetLine(const Construct *c); +private: + VariableEnvironment &m_env; + const char *m_file; +}; + +#define SET_LINE \ + EvalFrameInjection::SetLine(this) + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif // __HPHP_EVAL_RUNTIME_EVAL_FRAME_INJECTION_H__ + diff --git a/src/cpp/eval/runtime/eval_object_data.cpp b/src/cpp/eval/runtime/eval_object_data.cpp new file mode 100644 index 0000000000000..59a63fdd82830 --- /dev/null +++ b/src/cpp/eval/runtime/eval_object_data.cpp @@ -0,0 +1,390 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { + +///////////////////////////////////////////////////////////////////////////// +// constructor/destructor + +IMPLEMENT_OBJECT_ALLOCATION_CLS(HPHP::Eval,EvalObjectData) + +EvalObjectData::EvalObjectData(ClassEvalState &cls, const char* pname, + ObjectData* r /* = NULL */) +: DynamicObjectData(pname, r ? r : this), m_cls(cls) { + if (r == NULL) { + RequestEvalState::registerObject(this); + } +} +// Only used for cloning and so should not register object +EvalObjectData::EvalObjectData(ClassEvalState &cls) : + DynamicObjectData(NULL, this), m_cls(cls) { +} + +ObjectData *EvalObjectData::dynCreate(CArrRef params, bool ini /* = true */) { + if (ini) { + init(); + dynConstruct(params); + } + return this; +} + +void EvalObjectData::init() { + m_cls.getClass()->initializeObject(this); + DynamicObjectData::init(); +} + +void EvalObjectData::dynConstruct(CArrRef params) { + const MethodStatement *ms = getMethodStatement("__construct"); + if (ms) { + ms->invokeInstance(Object(root), params); + } else { + DynamicObjectData::dynConstruct(params); + } +} + +void EvalObjectData::destruct() { + const MethodStatement *ms; + incRefCount(); + if (!inCtorDtor() && (ms = getMethodStatement("__destruct"))) { + setInDtor(); + try { + ms->invokeInstance(Object(root),Array()); + } catch (...) { + handle_destructor_exception(); + } + } + DynamicObjectData::destruct(); + if (root == this) { + RequestEvalState::deregisterObject(this); + } +} + +void EvalObjectData::o_get(std::vector &props) const { + return DynamicObjectData::o_get(props); +} + +Variant EvalObjectData::o_get(CStrRef s, int64 hash) { + m_cls.getClass()->attemptPropertyAccess(s); + return DynamicObjectData::o_get(s, hash); +} + +Variant EvalObjectData::o_getUnchecked(CStrRef s, int64 hash) { + return DynamicObjectData::o_get(s, hash); +} + + +Variant &EvalObjectData::o_lval(CStrRef s, int64 hash) { + return DynamicObjectData::o_lval(s, hash); +} +Variant EvalObjectData::o_set(CStrRef s, int64 hash, CVarRef v, + bool forInit /* = false */) { + if (!forInit) m_cls.getClass()->attemptPropertyAccess(s); + return DynamicObjectData::o_set(s, hash, v, forInit); +} + +const char *EvalObjectData::o_getClassName() const { + return m_cls.getClass()->name().c_str(); +} + +const MethodStatement +*EvalObjectData::getMethodStatement(const char* name) const { + const hphp_const_char_imap &meths = + m_cls.getMethodTable(); + hphp_const_char_imap::const_iterator it = + meths.find(name); + if (it != meths.end()) { + return it->second; + } + return NULL; +} + +bool EvalObjectData::o_instanceof(const char *s) const { + return m_cls.getClass()->subclassOf(s) || + (!parent.isNull() && parent->o_instanceof(s)); +} + +Variant EvalObjectData::o_invoke(const char *s, CArrRef params, int64 hash, + bool fatal /* = true */) { + const hphp_const_char_imap &meths = + m_cls.getMethodTable(); + hphp_const_char_imap::const_iterator it = + meths.find(s); + if (it != meths.end()) { + if (it->second) { + return it->second->invokeInstance(Object(root), params); + } else { + return DynamicObjectData::o_invoke(s, params, hash, fatal); + } + } else { + return doCall(s, params, fatal); + } +} + +Variant EvalObjectData::o_invoke_ex(const char *clsname, const char *s, + CArrRef params, int64 hash, + bool fatal /* = false */) { + if (m_cls.getClass()->subclassOf(clsname)) { + bool foundClass; + const MethodStatement *ms = RequestEvalState::findMethod(clsname, s, + foundClass); + if (ms) { + return ms->invokeInstance(Object(root), params); + } else { + // Possibly builtin class has this method + const hphp_const_char_imap &meths = + m_cls.getMethodTable(); + if (meths.find(s) == meths.end()) { + // Absolutely nothing in the hierarchy has this method + return doCall(s, params, fatal); + } + } + // Know it's a builtin parent so no need for _ex + return DynamicObjectData::o_invoke(s, params, hash, fatal); + } + return DynamicObjectData::o_invoke_ex(clsname, s, params, hash, fatal); +} + +Variant EvalObjectData::o_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 /* = null_variant */, + CVarRef a1 /* = null_variant */, + CVarRef a2 /* = null_variant */ +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 /* = null_variant */, + CVarRef a4 /* = null_variant */, + CVarRef a5 /* = null_variant */ +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 /* = null_variant */, + CVarRef a7 /* = null_variant */, + CVarRef a8 /* = null_variant */, + CVarRef a9 /* = null_variant */ +#endif +) { + switch (count) { + case 0: { + return o_invoke(s, Array(), hash); + } + case 1: { + Array params(NEW(ArrayElement)(a0), NULL); + return o_invoke(s, params, hash); + } + case 2: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), NULL); + return o_invoke(s, params, hash); + } + case 3: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NULL); + return o_invoke(s, params, hash); + } +#if INVOKE_FEW_ARGS_COUNT > 3 + case 4: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), NULL); + return o_invoke(s, params, hash); + } + case 5: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NULL); + return o_invoke(s, params, hash); + } + case 6: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), NULL); + return o_invoke(s, params, hash); + } +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + case 7: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NULL); + return o_invoke(s, params, hash); + } + case 8: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NEW(ArrayElement)(a7), NULL); + return o_invoke(s, params, hash); + } + case 9: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NEW(ArrayElement)(a7), + NEW(ArrayElement)(a8), NULL); + return o_invoke(s, params, hash); + } + case 10: { + Array params(NEW(ArrayElement)(a0), NEW(ArrayElement)(a1), + NEW(ArrayElement)(a2), NEW(ArrayElement)(a3), + NEW(ArrayElement)(a4), NEW(ArrayElement)(a5), + NEW(ArrayElement)(a6), NEW(ArrayElement)(a7), + NEW(ArrayElement)(a8), NEW(ArrayElement)(a9), NULL); + return o_invoke(s, params, hash); + } +#endif + default: + ASSERT(false); + } + return null; +} + +Variant EvalObjectData::doCall(Variant v_name, Variant v_arguments, + bool fatal) { + const MethodStatement *ms = getMethodStatement("__call"); + if (ms) { + return ms->invokeInstance(Object(root), CREATE_VECTOR2(v_name, v_arguments)); + } else { + return DynamicObjectData::doCall(v_name, v_arguments, fatal); + } +} + +Variant EvalObjectData::t___destruct() { + const MethodStatement *ms = getMethodStatement("__destruct"); + if (ms) { + return ms->invokeInstance(Object(root), Array()); + } else { + return DynamicObjectData::t___destruct(); + } +} +Variant EvalObjectData::t___set(Variant v_name, Variant v_value) { + if (v_value.isReferenced()) { + v_value.setContagious(); + } + const MethodStatement *ms = getMethodStatement("__set"); + if (ms) { + return ms->invokeInstance(Object(root), CREATE_VECTOR2(v_name, v_value)); + } else { + return DynamicObjectData::t___set(v_name, v_value); + } +} +Variant EvalObjectData::t___get(Variant v_name) { + const MethodStatement *ms = getMethodStatement("__get"); + if (ms) { + return ms->invokeInstance(Object(root), CREATE_VECTOR1(v_name)); + } else { + return DynamicObjectData::t___get(v_name); + } +} +bool EvalObjectData::t___isset(Variant v_name) { + const MethodStatement *ms = getMethodStatement("__name"); + if (ms) { + return ms->invokeInstance(Object(root), CREATE_VECTOR1(v_name)); + } else { + return DynamicObjectData::t___isset(v_name); + } +} +Variant EvalObjectData::t___unset(Variant v_name) { + const MethodStatement *ms = getMethodStatement("__unset"); + if (ms) { + return ms->invokeInstance(Object(root), CREATE_VECTOR1(v_name)); + } else { + return DynamicObjectData::t___unset(v_name); + } +} +Variant EvalObjectData::t___sleep() { + const MethodStatement *ms = getMethodStatement("__unset"); + if (ms) { + return ms->invokeInstance(Object(root), Array()); + } else { + return DynamicObjectData::t___sleep(); + } +} +Variant EvalObjectData::t___wakeup() { + const MethodStatement *ms = getMethodStatement("__wakeup"); + if (ms) { + return ms->invokeInstance(Object(root), Array()); + } else { + return DynamicObjectData::t___wakeup(); + } +} +Variant EvalObjectData::t___set_state(Variant v_properties) { + const MethodStatement *ms = getMethodStatement("__set_state"); + if (ms) { + return ms->invokeInstance(Object(root), CREATE_VECTOR1(v_properties)); + } else { + return DynamicObjectData::t___set_state(v_properties); + } +} +String EvalObjectData::t___tostring() { + const MethodStatement *ms = getMethodStatement("__tostring"); + if (ms) { + return ms->invokeInstance(Object(root), Array()); + } else { + return DynamicObjectData::t___tostring(); + } +} +Variant EvalObjectData::t___clone() { + const MethodStatement *ms = getMethodStatement("__clone"); + if (ms) { + return ms->invokeInstance(Object(root), Array()); + } else { + return DynamicObjectData::t___clone(); + } +} + +ObjectData* EvalObjectData::cloneImpl() { + EvalObjectData *e = NEW(EvalObjectData)(m_cls); + if (!parent.isNull()) { + e->setParent(parent->clone()); + } else { + cloneSet(e); + } + // Registration is done here because the clone constructor is not + // passed root. + if (root == this) { + RequestEvalState::registerObject(e); + } + return e; +} + +Variant &EvalObjectData::___lval(Variant v_name) { + const MethodStatement *ms = getMethodStatement("__get"); + if (ms) { + Variant &v = get_globals()->__lvalProxy; + v = ms->invokeInstance(Object(root), CREATE_VECTOR1(v_name)); + return v; + } else { + return DynamicObjectData::___lval(v_name); + } +} +Variant &EvalObjectData::___offsetget_lval(Variant v_name) { + const MethodStatement *ms = getMethodStatement("offsetget"); + if (ms) { + Variant &v = get_globals()->__lvalProxy; + v = ms->invokeInstance(Object(root), CREATE_VECTOR1(v_name)); + return v; + } else { + return DynamicObjectData::___offsetget_lval(v_name); + } +} + + +/////////////////////////////////////////////////////////////////////////////// +} +} diff --git a/src/cpp/eval/runtime/eval_object_data.h b/src/cpp/eval/runtime/eval_object_data.h new file mode 100644 index 0000000000000..a5867a2a16cd4 --- /dev/null +++ b/src/cpp/eval/runtime/eval_object_data.h @@ -0,0 +1,103 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_EVAL_OBJECT_DATA_H__ +#define __HPHP_EVAL_OBJECT_DATA_H__ + +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +class ClassStatement; +class ClassEvalState; + +class EvalObjectData : public DynamicObjectData { + DECLARE_OBJECT_ALLOCATION(EvalObjectData); +public: + EvalObjectData(ClassEvalState &cls, const char* pname, + ObjectData *r = NULL); + EvalObjectData(ClassEvalState &cls); + ObjectData *dynCreate(CArrRef params, bool init /* = true */); + void dynConstruct(CArrRef params); + virtual void init(); + virtual void destruct(); + + // properties + virtual void o_get(std::vector &props) const; + virtual Variant o_get(CStrRef s, int64 hash); + virtual Variant o_getUnchecked(CStrRef s, int64 hash); + virtual Variant &o_lval(CStrRef s, int64 hash); + virtual Variant o_set(CStrRef s, int64 hash, CVarRef v, + bool forInit = false); + + // methods + virtual const char *o_getClassName() const; + virtual const MethodStatement *getMethodStatement(const char* name) const; + + virtual bool o_instanceof(const char *s) const; + + virtual Variant o_invoke(const char *s, CArrRef params, int64 hash, + bool fatal = true); + virtual Variant o_invoke_ex(const char *clsname, const char *s, + CArrRef params, int64 hash, + bool fatal /* = false */); + virtual Variant o_invoke_few_args(const char *s, int64 hash, int count, + CVarRef a0 = null_variant, + CVarRef a1 = null_variant, + CVarRef a2 = null_variant +#if INVOKE_FEW_ARGS_COUNT > 3 + ,CVarRef a3 = null_variant, + CVarRef a4 = null_variant, + CVarRef a5 = null_variant +#endif +#if INVOKE_FEW_ARGS_COUNT > 6 + ,CVarRef a6 = null_variant, + CVarRef a7 = null_variant, + CVarRef a8 = null_variant, + CVarRef a9 = null_variant +#endif +); + + virtual Variant doCall(Variant v_name, Variant v_arguments, bool fatal); + + // magic methods + // __construct is handled in a special way + virtual Variant t___destruct(); + virtual Variant t___set(Variant v_name, Variant v_value); + virtual Variant t___get(Variant v_name); + virtual bool t___isset(Variant v_name); + virtual Variant t___unset(Variant v_name); + virtual Variant t___sleep(); + virtual Variant t___wakeup(); + virtual Variant t___set_state(Variant v_properties); + virtual String t___tostring(); + virtual Variant t___clone(); + virtual Variant &___lval(Variant v_name); + virtual Variant &___offsetget_lval(Variant v_name); + +protected: + virtual ObjectData* cloneImpl(); +private: + ClassEvalState &m_cls; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __HPHP_EVAL_OBJECT_DATA_H__ */ diff --git a/src/cpp/eval/runtime/eval_state.cpp b/src/cpp/eval/runtime/eval_state.cpp new file mode 100644 index 0000000000000..ded6985a309a3 --- /dev/null +++ b/src/cpp/eval/runtime/eval_state.cpp @@ -0,0 +1,479 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +StringCodeContainer::StringCodeContainer +(const vector &classes, + const vector &functions) + : m_classes(classes), m_functions(functions) {} + +void StringCodeContainer:: +addDeclarations(hphp_const_char_imap &classes, + hphp_const_char_imap &functions) { + for (vector::const_iterator it = m_classes.begin(); + it != m_classes.end(); ++it) { + classes[(*it)->lname().c_str()].init(it->get()); + } + for (vector::const_iterator it = m_functions.begin(); + it != m_functions.end(); ++it) { + functions[(*it)->lname().c_str()] = it->get(); + } +} + +void ClassEvalState::init(const ClassStatement *cls) { + m_class = cls; +} + +const MethodStatement *ClassEvalState::getMethod(const char *m) { + hphp_const_char_imap::const_iterator it = + m_methodTable.find(m); + if (it == m_methodTable.end()) return NULL; + return it->second; +} + +void ClassEvalState::initializeMethods() { + if (!m_initializedMethods) { + m_class->loadMethodTable(m_methodTable); + m_initializedMethods = true; + } +} + +void ClassEvalState::initializeStatics() { + if (!m_initializedStatics) { + m_class->initializeStatics(m_statics); + m_initializedStatics = true; + } +} + +void RequestEvalState::requestInit() {} + +void RequestEvalState::requestShutdown() { + while (!m_livingObjects.empty()) { + EvalObjectData *eo = *m_livingObjects.begin(); + m_livingObjects.erase(eo); + const MethodStatement *des = eo->getMethodStatement("__destruct"); + if (des) { + try { + des->invokeInstance(Object(eo), Array()); + } catch (...) { + handle_destructor_exception(); + } + } + eo->setInDtor(); + + } + + m_functionStatics.clear(); + m_methodStatics.clear(); + + m_classes.clear(); + m_functions.clear(); + m_constants = Array(); + m_constantInfos.clear(); + m_methodInfos.clear(); + m_classInfos.clear(); + m_interfaceInfos.clear(); + m_ids = 0; + m_argStack.clear(); + + for (vector::const_iterator it = + m_codeContainers.begin(); it != m_codeContainers.end(); + ++it) { + delete *it; + } + for (map::const_iterator it = + m_evaledFiles.begin(); it != m_evaledFiles.end(); ++it) { + it->second->decRef(); + } + m_codeContainers.clear(); + m_evaledFiles.clear(); +} + +// Should run last +int RequestEvalState::priority() const { + return 0x7FFFFFFF; +} + +static RequestLocal s_res; +void RequestEvalState::addCodeContainer(CodeContainer *cc) { + RequestEvalState *self = s_res.get(); + self->m_codeContainers.push_back(cc); + cc->addDeclarations(self->m_classes, self->m_functions); +} + +ClassEvalState &RequestEvalState::declareClass(const ClassStatement *cls) { + RequestEvalState *self = s_res.get(); + ClassEvalState &ce = self->m_classes[cls->lname().c_str()]; + ce.init(cls); + return ce; +} +void RequestEvalState::declareFunction(const FunctionStatement *fn) { + RequestEvalState *self = s_res.get(); + self->m_functions[fn->lname().c_str()] = fn; +} + +bool RequestEvalState::declareConstant(CStrRef name, CVarRef val) { + RequestEvalState *self = s_res.get(); + if (self->m_constants.exists(name)) return false; + self->m_constants.set(name, val); + ClassInfo::ConstantInfo &ci = self->m_constantInfos[name.c_str()]; + // Only need to set value really. + ci.name = NULL; + ci.valueLen = 0; + ci.valueText = NULL; + ci.value = val; + return true; +} + +ClassInfoEvaled::~ClassInfoEvaled() { + for (MethodVec::iterator it = m_methodsVec.begin(); it != m_methodsVec.end(); + ++it) { + delete *it; + } + for (PropertyMap::iterator it = m_properties.begin(); + it != m_properties.end(); ++it) { + delete it->second; + } + for (ConstantMap::iterator it = m_constants.begin(); it != m_constants.end(); + ++it) { + delete [] it->second->valueText; + delete it->second; + } +} + +const ClassStatement *RequestEvalState::findClass(const char *name) { + RequestEvalState *self = s_res.get(); + hphp_const_char_imap::const_iterator it = + self->m_classes.find(name); + if (it != self->m_classes.end()) { + return it->second.getClass(); + } + return NULL; +} + +ClassEvalState *RequestEvalState::findClassState(const char *name) { + RequestEvalState *self = s_res.get(); + hphp_const_char_imap::iterator it = + self->m_classes.find(name); + if (it != self->m_classes.end()) { + return &it->second; + } + return NULL; +} + +const MethodStatement *RequestEvalState::findMethod(const char *cname, + const char *name, + bool &foundClass) { + const Eval::ClassStatement *cls = Eval::RequestEvalState::findClass(cname); + if (cls) { + foundClass = true; + } + while (cls) { + const Eval::MethodStatement *meth = cls->findMethod(name); + if (meth) { + return meth; + } + cls = Eval::RequestEvalState::findClass(cls->parent().c_str()); + } + return NULL; +} + +const Function *RequestEvalState::findFunction(const char *name) { + const Function *f = findUserFunction(name); + if (f) return f; + return evalOverrides.findFunction(name); +} +const FunctionStatement *RequestEvalState::findUserFunction(const char *name) { + RequestEvalState *self = s_res.get(); + hphp_const_char_imap::const_iterator it = + self->m_functions.find(name); + if (it != self->m_functions.end()) { + return it->second; + } + return NULL; +} + +bool RequestEvalState::findConstant(CStrRef name, Variant &ret) { + RequestEvalState *self = s_res.get(); + if (self->m_constants.exists(name)) { + ret = self->m_constants.rvalAt(name); + return true; + } + return false; +} + +bool RequestEvalState::includeFile(Variant &res, CStrRef path, bool once, + LVariableTable* variables, + const char *currentDir) { + RequestEvalState *self = s_res.get(); + string spath(path.data()); + time_t modtime; + if (!FileRepository::findFile(spath, modtime, currentDir)) return false; + map::const_iterator it = self->m_evaledFiles.find(spath); + Eval::PhpFile *efile = NULL; + if (it != self->m_evaledFiles.end()) { + if (once) { + res = true; + return true; + } + efile = it->second; + } else { + efile = FileRepository::checkoutFile(spath, modtime); + if (efile) self->m_evaledFiles[spath] = efile; + } + if (efile) { + res = efile->eval(variables); + return true; + } + return false; +} + +LVariableTable &RequestEvalState:: +getFunctionStatics(const FunctionStatement* func) { + RequestEvalState *self = s_res.get(); + return self->m_functionStatics[func]; +} + +LVariableTable &RequestEvalState:: +getMethodStatics(const MethodStatement* func, const char* cls) { + RequestEvalState *self = s_res.get(); + return self->m_methodStatics[func][cls]; +} + +LVariableTable *RequestEvalState::getClassStatics(const ClassStatement* cls) { + RequestEvalState *self = s_res.get(); + hphp_const_char_imap::iterator it = + self->m_classes.find(cls->name().c_str()); + if (it == self->m_classes.end()) return NULL; + it->second.initializeStatics(); + return &it->second.getStatics(); +} + +int64 RequestEvalState::unique() { + RequestEvalState *self = s_res.get(); + return self->m_ids++; +} + +Array RequestEvalState::getUserFunctionsInfo() { + RequestEvalState *self = s_res.get(); + Array ret; + for (hphp_const_char_imap::const_iterator it = + self->m_functions.begin(); it != self->m_functions.end(); ++it) { + ret.append(it->first); + } + return ret; +} +Array RequestEvalState::getClassesInfo() { + RequestEvalState *self = s_res.get(); + Array ret; + for (hphp_const_char_imap::const_iterator it = + self->m_classes.begin(); it != self->m_classes.end(); ++it) { + if (it->second.getClass()->getModifiers() & ClassStatement::Interface) + continue; + ret.append(it->first); + } + return ret; +} +Array RequestEvalState::getInterfacesInfo() { + RequestEvalState *self = s_res.get(); + Array ret; + for (hphp_const_char_imap::const_iterator it = + self->m_classes.begin(); it != self->m_classes.end(); ++it) { + if (it->second.getClass()->getModifiers() & ClassStatement::Interface) { + ret.append(it->first); + } + } + return ret; +} + +Array RequestEvalState::getConstants() { + RequestEvalState *self = s_res.get(); + return self->m_constants; +} + +const ClassInfo::MethodInfo *RequestEvalState:: +findFunctionInfo(const char *name) { + RequestEvalState *self = s_res.get(); + map::iterator it = + self->m_methodInfos.find(name); + if (it == self->m_methodInfos.end()) { + const FunctionStatement *fs = findUserFunction(name); + if (fs) { + ClassInfo::MethodInfo &m = self->m_methodInfos[name]; + fs->getInfo(m); + return &m; + } + return NULL; + } else { + return &it->second; + } +} + +const ClassInfo *RequestEvalState::findClassInfo(const char *name) { + RequestEvalState *self = s_res.get(); + map::const_iterator it = + self->m_classInfos.find(name); + if (it == self->m_classInfos.end()) { + const ClassStatement *cls = findClass(name); + if (cls && !(cls->getModifiers() & ClassStatement::Interface)) { + ClassInfoEvaled &cl = self->m_classInfos[name]; + cls->getInfo(cl); + return &cl; + } + return NULL; + } else { + return &it->second; + } +} + +const ClassInfo *RequestEvalState::findInterfaceInfo(const char *name) { + RequestEvalState *self = s_res.get(); + map::const_iterator it = + self->m_interfaceInfos.find(name); + if (it == self->m_interfaceInfos.end()) { + const ClassStatement *cls = findClass(name); + if (cls && (cls->getModifiers() & ClassStatement::Interface)) { + ClassInfoEvaled &cl = self->m_interfaceInfos[name]; + cls->getInfo(cl); + return &cl; + } + return NULL; + } else { + return &it->second; + } +} + +const ClassInfo::ConstantInfo *RequestEvalState:: +findConstantInfo(const char *name) { + RequestEvalState *self = s_res.get(); + map::const_iterator it = + self->m_constantInfos.find(name); + if (it != self->m_constantInfos.end()) { + return &it->second; + } + return NULL; +} + +void RequestEvalState::registerObject(EvalObjectData *obj) { + RequestEvalState *self = s_res.get(); + self->m_livingObjects.insert(obj); +} +void RequestEvalState::deregisterObject(EvalObjectData *obj) { + RequestEvalState *self = s_res.get(); + self->m_livingObjects.erase(obj); +} + +class EvalClassInfoHook : public ClassInfoHook { +public: + EvalClassInfoHook() { + ClassInfo::SetHook(this); + } + + virtual Array getUserFunctions() const { + return RequestEvalState::getUserFunctionsInfo(); + } + virtual Array getClasses() const { + return RequestEvalState::getClassesInfo(); + } + virtual Array getInterfaces() const { + return RequestEvalState::getInterfacesInfo(); + } + virtual Array getConstants() const { + return RequestEvalState::getConstants(); + } + virtual const ClassInfo::MethodInfo *findFunction(const char *name) const { + return RequestEvalState::findFunctionInfo(name); + } + virtual const ClassInfo *findClass(const char *name) const { + return RequestEvalState::findClassInfo(name); + } + virtual const ClassInfo *findInterface(const char *name) const { + return RequestEvalState::findInterfaceInfo(name); + } + virtual const ClassInfo::ConstantInfo *findConstant(const char *name) const { + return RequestEvalState::findConstantInfo(name); + } +}; +static EvalClassInfoHook eval_class_info_hook; + +class EvalSourceInfoHook : public SourceInfoHook { +public: + EvalSourceInfoHook() { + SourceInfo::SetHook(this); + } + virtual const char *getClassDeclaringFile(const char *name) { + const ClassStatement *f = RequestEvalState::findClass(name); + if (f) { + return f->loc()->file; + } else { + return NULL; + } + } + virtual const char *getFunctionDeclaringFile(const char *name) { + const FunctionStatement *f = RequestEvalState::findUserFunction(name); + if (f) { + return f->loc()->file; + } else { + return NULL; + } + } +}; + +static EvalSourceInfoHook eval_source_info_hook; + +void RequestEvalState::info() { + RequestEvalState *self = s_res.get(); + cerr << "Eval State Status" << endl; + cerr << "-----------------" << endl; + cerr << "Classes:" << endl; + for (hphp_const_char_imap::const_iterator it = + self->m_classes.begin(); it != self->m_classes.end(); ++it) { + cerr << " " << it->first << " " << it->second.getClass()->name() << endl; + } + cerr << "Functions:" << endl; + for (hphp_const_char_imap::const_iterator it = + self->m_functions.begin(); it != self->m_functions.end(); ++it) { + cerr << " " << it->second->name() << endl; + } +} + +ArgStack &RequestEvalState::argStack() { + RequestEvalState *self = s_res.get(); + return self->m_argStack; +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/runtime/eval_state.h b/src/cpp/eval/runtime/eval_state.h new file mode 100644 index 0000000000000..8db51ff59395a --- /dev/null +++ b/src/cpp/eval/runtime/eval_state.h @@ -0,0 +1,176 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_STATE_H__ +#define __EVAL_STATE_H__ + +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(ClassStatement); +DECLARE_AST_PTR(FunctionStatement); +DECLARE_AST_PTR(MethodStatement); +class PhpFile; +class Function; +class EvalObjectData; + +class ClassEvalState { +public: + ClassEvalState() : m_initializedMethods(false), + m_initializedStatics(false) {} + void init(const ClassStatement *cls); + const ClassStatement *getClass() const { + return m_class; + } + const MethodStatement *getMethod(const char *m); + hphp_const_char_imap &getMethodTable() { + return m_methodTable; + } + LVariableTable &getStatics() { + return m_statics; + } + void initializeMethods(); + void initializeStatics(); + +private: + const ClassStatement *m_class; + hphp_const_char_imap m_methodTable; + LVariableTable m_statics; + bool m_initializedMethods; + bool m_initializedStatics; +}; + +/** + * Containers to live in Globals and do the garbage collection. + */ +class CodeContainer { +public: + virtual ~CodeContainer() {} + virtual void addDeclarations(hphp_const_char_imap + &classes, + hphp_const_char_imap + &m_functions) = 0; +}; + +class StringCodeContainer : public CodeContainer { +public: + StringCodeContainer(const std::vector &classes, + const std::vector &functions); + virtual void addDeclarations(hphp_const_char_imap + &classes, + hphp_const_char_imap + &functions); +private: + std::vector m_classes; + std::vector m_functions; +}; + + class ClassInfoEvaled : public ClassInfo { + public: + ~ClassInfoEvaled(); + virtual const char *getParentClass() const { return m_parentClass; } + const InterfaceMap &getInterfaces() const { return m_interfaces;} + const InterfaceVec &getInterfacesVec() const { return m_interfacesVec;} + const MethodMap &getMethods() const { return m_methods;} + const MethodVec &getMethodsVec() const { return m_methodsVec;} + const PropertyMap &getProperties() const { return m_properties;} + const PropertyVec &getPropertiesVec() const { return m_propertiesVec;} + const ConstantMap &getConstants() const { return m_constants;} + private: + friend class ClassStatement; + const char* m_parentClass; + InterfaceMap m_interfaces; // all interfaces + InterfaceVec m_interfacesVec; // all interfaces + MethodMap m_methods; // all methods + MethodVec m_methodsVec; // in source order + PropertyMap m_properties; // all properties + PropertyVec m_propertiesVec; // in source order + ConstantMap m_constants; // all constants +}; + +class RequestEvalState : public RequestEventHandler { +public: + virtual void requestInit(); + virtual void requestShutdown(); + virtual int priority() const; + + static void addCodeContainer(CodeContainer *cc); + static ClassEvalState &declareClass(const ClassStatement *cls); + static void declareFunction(const FunctionStatement *cls); + static bool declareConstant(CStrRef name, CVarRef value); + static const ClassStatement *findClass(const char *name); + static ClassEvalState *findClassState(const char *name); + static const MethodStatement *findMethod(const char *cname, const char *name, + bool &foundClass); + static const FunctionStatement *findUserFunction(const char *name); + static const Function *findFunction(const char *name); + static bool findConstant(CStrRef name, Variant &ret); + static bool includeFile(Variant &res, CStrRef path, bool once, + LVariableTable* variables, + const char *currentDir); + static LVariableTable &getFunctionStatics(const FunctionStatement* func); + static LVariableTable &getMethodStatics(const MethodStatement* func, + const char* cls); + static LVariableTable *getClassStatics(const ClassStatement* cls); + + // Class info hook methods + static Array getUserFunctionsInfo(); + static Array getClassesInfo(); + static Array getInterfacesInfo(); + static Array getConstants(); + static const ClassInfo::MethodInfo *findFunctionInfo(const char *name); + static const ClassInfo *findClassInfo(const char *name); + static const ClassInfo *findInterfaceInfo(const char *name); + static const ClassInfo::ConstantInfo *findConstantInfo(const char *name); + + // Misc + static int64 unique(); + static void info(); + + static ArgStack &argStack(); + + static void registerObject(EvalObjectData *obj); + static void deregisterObject(EvalObjectData *obj); +private: + std::map m_evaledFiles; + std::vector m_codeContainers; + + hphp_const_char_imap m_classes; + hphp_const_char_imap m_functions; + std::map m_functionStatics; + std::map > + m_methodStatics; + Array m_constants; + std::map m_constantInfos; + std::map m_methodInfos; + std::map m_classInfos; + std::map m_interfaceInfos; + std::set m_livingObjects; + int64 m_ids; + ArgStack m_argStack; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_STATE_H__ */ diff --git a/src/cpp/eval/runtime/file_repository.cpp b/src/cpp/eval/runtime/file_repository.cpp new file mode 100644 index 0000000000000..1b17cecfcebde --- /dev/null +++ b/src/cpp/eval/runtime/file_repository.cpp @@ -0,0 +1,166 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +set FileRepository::s_names; + +PhpFile::PhpFile(StatementPtr tree, const vector &statics, + Mutex &lock) + : Block(statics), m_lock(lock), m_refCount(1), m_timestamp(time(NULL)), + m_tree(tree), m_profName(string("run_init::") + string(m_tree->loc()->file)) +{ +} + +PhpFile::~PhpFile() { + ASSERT(m_refCount == 0); +} + +Variant PhpFile::eval(LVariableTable *vars) { + NestedVariableEnvironment env(vars, *this); + EvalFrameInjection fi("", m_profName.c_str(), env, + m_tree->loc()->file); + m_tree->eval(env); + if (env.isReturning()) { + return env.getRet(); + } else if (env.isBreaking()) { + throw FatalErrorException("Cannot break/continue out of a file"); + } + return true; +} + +void PhpFile::decRef() { + m_lock.lock(); + --m_refCount; + if (m_refCount == 0) { + m_lock.unlock(); + delete this; + return; + } + m_lock.unlock(); +} + +void PhpFile::incRef() { + m_lock.lock(); + ++m_refCount; + m_lock.unlock(); +} + +Mutex FileRepository::s_lock; +Mutex FileRepository::s_locks[128]; +hphp_hash_map +FileRepository::m_files; + +PhpFile *FileRepository::checkoutFile(const std::string &rname, time_t t) { + PhpFile *ret = NULL; + Lock lock(s_lock); + string name; + + if (rname[0] == '/') { + name = rname; + } else if (RuntimeOption::SourceRoot.empty()) { + name = Process::GetCurrentDirectory() + "/" + rname; + } else { + name = RuntimeOption::SourceRoot + "/" + rname; + } + + hphp_hash_map::iterator it = + m_files.find(name); + if (it == m_files.end()) { + ret = readFile(name); + if (ret) { + m_files[name] = ret; + } + } else { + if (t > it->second->readTime()) { + ret = readFile(name); + if (ret) { + it->second->decRef(); + it->second = ret; + } + } else { + ret = it->second; + } + } + if (ret) ret->incRef(); + return ret; +} + +bool FileRepository::findFile(std::string &path, time_t &modTime, + const char *currentDir) { + // Check working directory first since that's what php does + if (modifyTime(path, modTime)) { + return true; + } + for (vector::const_iterator it = + RuntimeOption::IncludeSearchPaths.begin(); + it != RuntimeOption::IncludeSearchPaths.end(); ++it) { + string p; + if ((*it)[0] == '.' && currentDir) { + p = string(currentDir) + it->substr(1); + } else { + p = *it; + } + p += string("/") + path; + if (modifyTime(p, modTime)) { + path = p; + return true; + } + } + return false; +} + +PhpFile *FileRepository::readFile(const std::string &name) { + vector sts; + const char *canoname = canonicalize(name); + StatementPtr stmt = Parser::parseFile(canoname, sts); + if (stmt) { + uint lock = hash_string(canoname) & 127; + PhpFile *p = new PhpFile(stmt, sts, s_locks[lock]); + return p; + } + return NULL; +} + +bool FileRepository::modifyTime(const std::string &name, time_t &time) { + struct stat s; + if (stat(name.c_str(), &s) == 0) { + time = s.st_mtime; + return true; + } + return false; +} + +const char* FileRepository::canonicalize(const std::string &name) { + return s_names.insert(name).first->c_str(); +} + +/////////////////////////////////////////////////////////////////////////////// +} +} diff --git a/src/cpp/eval/runtime/file_repository.h b/src/cpp/eval/runtime/file_repository.h new file mode 100644 index 0000000000000..1f39c06625b4c --- /dev/null +++ b/src/cpp/eval/runtime/file_repository.h @@ -0,0 +1,78 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_FILE_REPOSITORY_H__ +#define __EVAL_FILE_REPOSITORY_H__ + +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_AST_PTR(Statement); +DECLARE_AST_PTR(StaticStatement); + +class PhpFile : public Block { +public: + PhpFile(StatementPtr tree, const std::vector &statics, + Mutex &lock); + ~PhpFile(); + Variant eval(LVariableTable *env); + void decRef(); + void incRef(); + time_t readTime() const { return m_timestamp; } +private: + Mutex &m_lock; + int m_refCount; + time_t m_timestamp; + StatementPtr m_tree; + std::string m_profName; +}; + +/** + * FileRepository is global. + */ +class FileRepository { +public: + /** + * The first time you attempt to invoke a file in a request, this is called. + * From then on, invoke_file will store the PhpFile and use that. + */ + static PhpFile *checkoutFile(const std::string &name, time_t t); + static bool findFile(std::string &path, time_t &modTime, + const char *currentDir); +private: + static Mutex s_lock; + static hphp_hash_map m_files; + static Mutex s_locks[128]; + + static PhpFile *readFile(const std::string &name); + static bool modifyTime(const std::string &name, time_t &time); + static std::set s_names; + + static const char* canonicalize(const std::string &n); +}; + + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_FILE_REPOSITORY_H__ */ diff --git a/src/cpp/eval/runtime/variable_environment.cpp b/src/cpp/eval/runtime/variable_environment.cpp new file mode 100644 index 0000000000000..6343437416ce3 --- /dev/null +++ b/src/cpp/eval/runtime/variable_environment.cpp @@ -0,0 +1,256 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +namespace Eval { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +VariableEnvironment::VariableEnvironment() + : m_currentClass(NULL), m_breakLevel(0), m_returning(false) +{ +} + +void VariableEnvironment::flagGlobal(CStrRef name, int64 hash) { + get(name, hash) = ref(get_globals()->get(name, hash)); +} + +void VariableEnvironment::unset(CStrRef name, int64 hash) { + HPHP::unset(get(name, hash)); +} + +void VariableEnvironment::setCurrentObject(CObjRef co) { + ASSERT(!m_currentClass); + m_currentObject = co; + m_currentClass = co->o_getClassName(); +} +void VariableEnvironment::setCurrentClass(const char* cls) { + ASSERT(m_currentObject.isNull()); + m_currentClass = cls; +} + +Variant &VariableEnvironment::currentObject() { + return m_currentObject; +} + +const char* VariableEnvironment::currentClass() const { + return m_currentClass; +} +const ClassStatement *VariableEnvironment::currentClassStatement() const { + return NULL; +} +const char* VariableEnvironment::currentContext() const { + return m_currentClass ? m_currentClass : ""; +} + +Variant &VariableEnvironment::getIdx(int idx) { + ASSERT(false); + throw FatalErrorException("getIdx not supported in this env"); +} + +DummyVariableEnvironment::DummyVariableEnvironment() +{} + +void DummyVariableEnvironment::flagStatic(CStrRef name, int64 hash) { + ASSERT(false); +} +void DummyVariableEnvironment::flagGlobal(CStrRef name, int64 hash) { + ASSERT(false); +} +void DummyVariableEnvironment::unset(CStrRef name, int64 hash) { + ASSERT(false); +} +bool DummyVariableEnvironment::exists(const char *s, int64 hash) const { + ASSERT(false); + return false; +} +Variant &DummyVariableEnvironment::getImpl(CStrRef s, int64 hash) { + ASSERT(false); + throw FatalErrorException("Tried to get from a dummy environment"); +} +Array DummyVariableEnvironment::getParams() const { + ASSERT(false); + return Array(); +} + +class SuperGlobalInitializer { +public: + SuperGlobalInitializer() { + for (int i = 0; i < s_num; i++) { + s_hashes[i] = hash_string(s_names[i].data(), s_names[i].size()); + } + } + void init(VariableEnvironment &env) const { + for (int i = 0; i < s_num-1; i++) { + env.flagGlobal(s_names[i], s_hashes[i]); + } + initGlobals(env); + } + void initGlobals(VariableEnvironment &env) const { + env.get(s_names[s_num-1], s_hashes[s_num-1]) = get_global_array_wrapper(); + } + void initAL(AssocList &al) const { + Globals *g = get_globals(); + for (int i = 0; i < s_num-1; i++) { + al.prepend(s_names[i]) = ref(g->get(s_names[i], s_hashes[i])); + } + al.prepend("GLOBALS") = get_global_array_wrapper(); + } +private: + static const int s_num; + static const StaticString s_names[]; + static int64 s_hashes[]; +}; +const StaticString SuperGlobalInitializer::s_names[] = + {"_SERVER", + "_GET", + "_POST", + "_FILES", + "_COOKIE", + "_SESSION", + "_REQUEST", + "_ENV", + "http_response_header", + "GLOBALS"}; +const int SuperGlobalInitializer::s_num = + sizeof(SuperGlobalInitializer::s_names)/ + sizeof(SuperGlobalInitializer::s_names[0]); +int64 SuperGlobalInitializer::s_hashes[SuperGlobalInitializer::s_num]; +static SuperGlobalInitializer g_sinit; + +FuncScopeVariableEnvironment:: +FuncScopeVariableEnvironment(const FunctionStatement *func, int argc) + : m_func(func), m_staticEnv(NULL), m_argc(argc), + m_argStart(RequestEvalState::argStack().pos()) { + + const Block::VariableIndices &vi = func->varIndices(); + m_byIdx.resize(vi.size()); + Globals *g = NULL; + for (Block::VariableIndices::const_iterator it = vi.begin(); + it != vi.end(); ++it) { + const VariableIndex &v = it->second; + Variant &val = m_alist.prepend(String(it->first.c_str(), + it->first.size(), + AttachLiteral)); + m_byIdx[v.idx()] = &val; + if (v.superGlobal() == VariableIndex::Globals) { + val = get_global_array_wrapper(); + } else if (v.superGlobal() != VariableIndex::Normal) { + if (!g) g = get_globals(); + val = ref(g->get(String(it->first.c_str(), it->first.size(), + AttachLiteral), + v.hash())); + } + } +} + +FuncScopeVariableEnvironment::~FuncScopeVariableEnvironment() { + RequestEvalState::argStack().pop(m_argc); +} + +void FuncScopeVariableEnvironment::flagStatic(CStrRef name, int64 hash) { + if (!m_staticEnv) { + m_staticEnv = m_func->getStaticVars(*this); + } + if (!m_staticEnv->exists(name.data())) { + m_staticEnv->get(name) = m_func->getStaticValue(*this, name); + } + get(name, hash) = ref(m_staticEnv->get(name, hash)); +} + +Variant &FuncScopeVariableEnvironment::getIdx(int idx) { + return *m_byIdx[idx]; +} + +bool FuncScopeVariableEnvironment::refReturn() const { + return m_func->refReturn(); +} + +Array FuncScopeVariableEnvironment::getParams() const { + return RequestEvalState::argStack().pull(m_argStart, m_argc); +} + +bool FuncScopeVariableEnvironment::exists(const char *name, int64 hash) const { + return m_alist.exists(name); + //return LVariableTable::exists(name, hash); +} +Variant &FuncScopeVariableEnvironment::getImpl(CStrRef s, int64 hash) { + { + Variant *v = m_alist.getPtr(s); + if (v) return *v; + } + Variant &v = m_alist.prepend(s); + VariableIndex::SuperGlobal sg = VariableIndex::isSuperGlobal(s); + if (sg == VariableIndex::Globals) { + v = get_global_array_wrapper(); + } else if (sg != VariableIndex::Normal) { + v = ref(get_globals()->get(s, -1)); + } + return v; + //return LVariableTable::getImpl(s, hash); +} + +MethScopeVariableEnvironment:: +MethScopeVariableEnvironment(const MethodStatement *meth, int argc) + : FuncScopeVariableEnvironment(meth, argc), m_cls(meth->getClass()) {} + +const char* MethScopeVariableEnvironment::currentContext() const { + return m_cls->name().c_str(); +} + +const ClassStatement* MethScopeVariableEnvironment::currentClassStatement() + const { + return m_cls; +} + +NestedVariableEnvironment::NestedVariableEnvironment +(LVariableTable *ext, const Block &blk, CArrRef params /* = Array() */, + CObjRef current_object /* = Object() */) + : m_ext(ext), m_block(blk), m_params(params) { + if (!current_object.isNull()) setCurrentObject(current_object); + g_sinit.initGlobals(*this); +} + +void NestedVariableEnvironment::flagStatic(CStrRef name, int64 hash) { + // Behavior is to set the variable to init + // .. and do some other stupid stuff that I'm not going to try + get(name, hash) = m_block.getStaticValue(*this, name); +} + +bool NestedVariableEnvironment::exists(const char *s, int64 hash) const { + return m_ext->exists(s, hash); +} + +Variant &NestedVariableEnvironment::getImpl(CStrRef s, int64 hash) { + return m_ext->get(s, hash); +} + +Array NestedVariableEnvironment::getParams() const { + return m_params; +} + +/////////////////////////////////////////////////////////////////////////////// +} +} + diff --git a/src/cpp/eval/runtime/variable_environment.h b/src/cpp/eval/runtime/variable_environment.h new file mode 100644 index 0000000000000..9de46ea4f4eaf --- /dev/null +++ b/src/cpp/eval/runtime/variable_environment.h @@ -0,0 +1,155 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EVAL_RUNTIME_VARIABLE_ENVIRONMENT_H__ +#define __EVAL_RUNTIME_VARIABLE_ENVIRONMENT_H__ + +#include +#include +#include + +namespace HPHP { +namespace Eval { +/////////////////////////////////////////////////////////////////////////////// + +class FunctionStatement; +class Block; +class ClassStatement; + +class VariableEnvironment : public LVariableTable { +public: + VariableEnvironment(); + void setCurrentObject(CObjRef co); + void setCurrentClass(const char* cls); + virtual void flagStatic(CStrRef name, int64 hash) = 0; + virtual void flagGlobal(CStrRef name, int64 hash); + virtual void unset(CStrRef name, int64 hash); + virtual Variant &getIdx(int idx); + Variant ¤tObject(); + virtual const char* currentClass() const; + virtual const ClassStatement *currentClassStatement() const; + virtual const char* currentContext() const; + virtual Array getParams() const = 0; + virtual bool refReturn() const { return false; } + + void setBreak(int n) { m_breakLevel = n; } + void decBreak() { + if (m_breakLevel > 0) { + m_breakLevel--; + } else if (m_breakLevel < 0) { + m_breakLevel++; + } + } + int handleBreak() { + int r = m_breakLevel; + decBreak(); + if (m_breakLevel == 0) { + if (r == 1) return 2; + if (r == -1) return 3; + } + if (m_breakLevel != 0) return 1; + return 0; + } + Variant &getRet() { return m_ret; } + void setRet(CVarRef ret) { m_ret = ret; m_returning = true; } + void setRet() { m_returning = true; } + bool isReturning() const { return m_returning; } + bool isBreaking() const { + if (m_breakLevel != 0) { + return true; + } + return false; + } + bool isEscaping() const { return isBreaking() || m_returning; } +protected: + Variant m_currentObject; + const char* m_currentClass; + int m_breakLevel; + bool m_returning; + Variant m_ret; +}; + +/** + * This is gross but I need it to eval statics sometimes. + */ +class DummyVariableEnvironment : public VariableEnvironment { +public: + DummyVariableEnvironment(); + virtual void flagStatic(CStrRef name, int64 hash); + virtual void flagGlobal(CStrRef name, int64 hash); + virtual void unset(CStrRef name, int64 hash); + virtual bool exists(const char *name, int64 hash = -1) const; + virtual Variant &getImpl(CStrRef s, int64 hash); + virtual Array getParams() const; +}; + +/** + * Used by functions and methods. Pass in an env for statics. + */ +class FuncScopeVariableEnvironment : public VariableEnvironment { +public: + FuncScopeVariableEnvironment(const FunctionStatement *func, int argc); + ~FuncScopeVariableEnvironment(); + virtual void flagStatic(CStrRef name, int64 hash); + virtual Variant &getIdx(int idx); + virtual bool refReturn() const; + virtual Array getParams() const; + virtual bool exists(const char *name, int64 hash = -1) const; + virtual Variant &getImpl(CStrRef s, int64 hash); + void incArgc() { m_argc++; } +private: + Array m_statics; + const FunctionStatement *m_func; + LVariableTable *m_staticEnv; + std::vector m_byIdx; + AssocList m_alist; + int m_argc; + int m_argStart; +}; + +class MethScopeVariableEnvironment : public FuncScopeVariableEnvironment { +public: + MethScopeVariableEnvironment(const MethodStatement *meth, int argc); + virtual const char* currentContext() const; + const ClassStatement *currentClassStatement() const; +private: + const ClassStatement *m_cls; +}; + +/** + * Used to wrap a variable table for eval calls. + */ +class NestedVariableEnvironment : public VariableEnvironment { +public: + NestedVariableEnvironment(LVariableTable *ext, + const Block &blk, + CArrRef params = Array(), + CObjRef current_object = Object()); + virtual void flagStatic(CStrRef name, int64 hash); + virtual bool exists(const char *s, int64 hash = 1) const; + virtual Variant &getImpl(CStrRef s, int64 hash); + virtual Array getParams() const; +private: + LVariableTable *m_ext; + const Block &m_block; + Array m_params; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +} + +#endif /* __EVAL_RUNTIME_VARIABLE_ENVIRONMENT_H__ */ diff --git a/src/cpp/eval/strict_mode.cpp b/src/cpp/eval/strict_mode.cpp new file mode 100644 index 0000000000000..231118739db98 --- /dev/null +++ b/src/cpp/eval/strict_mode.cpp @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include + +namespace HPHP { + +using namespace Eval; +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +void throw_strict(const ExtendedException &exn, + int strict_level_exn, + bool call_user_error_handler) { + + if (strict_level_exn <= RuntimeOption::StrictLevel) { + if (RuntimeOption::StrictFatal) { + throw exn; + } else { + if (call_user_error_handler) { + g_context->onError(dynamic_cast(exn)); + } + Logger::Warning("StrictMode WARNING: %s\n", exn.getMessage().c_str()); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/eval/strict_mode.h b/src/cpp/eval/strict_mode.h new file mode 100644 index 0000000000000..ffdacb502a573 --- /dev/null +++ b/src/cpp/eval/strict_mode.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#ifndef __EVAL_STRICT_MODE_H__ +#define __EVAL_STRICT_MODE_H__ + +#include +#include + +/** + * This file works in concert with the StrictLevel and StrictFatal variables + * defined in runtime_option.h. It implements the policy regarding + * the "strict" checking mode of hphpi. Do we throw an exception when + * a semantic check failed, or just a warning ? Or do we do anything at all ? + */ + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class StrictMode { +public: + enum StrictLevel { + StrictNone = 0, + + StrictBasic = 1, + StrictHardCore = 2, + }; +}; + +void throw_strict(const ExtendedException &exn, + int strict_level_exn, + bool call_user_error_handler = false); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EVAL_STRICT_MODE_H__ diff --git a/src/cpp/ext/JSON_parser.cpp b/src/cpp/ext/JSON_parser.cpp new file mode 100644 index 0000000000000..4c28d75ecb535 --- /dev/null +++ b/src/cpp/ext/JSON_parser.cpp @@ -0,0 +1,788 @@ +/* JSON_parser.c */ + +/* 2005-12-30 */ + +/* +Copyright (c) 2005 JSON.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +The Software shall be used for Good, not Evil. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + + +#include +#include +#include +#include +#include +#include + +#define MAX_LENGTH_OF_LONG 20 +static const char long_min_digits[] = "9223372036854775808"; + +using namespace HPHP; + +#define true 1 +#define false 0 + +/* + Characters are mapped into these 32 symbol classes. This allows for + significant reductions in the size of the state transition table. +*/ + +/* error */ +#define S_ERR -1 + +/* space */ +#define S_SPA 0 + +/* other whitespace */ +#define S_WSP 1 + +/* { */ +#define S_LBE 2 + +/* } */ +#define S_RBE 3 + +/* [ */ +#define S_LBT 4 + +/* ] */ +#define S_RBT 5 + +/* : */ +#define S_COL 6 + +/* , */ +#define S_COM 7 + +/* " */ +#define S_QUO 8 + +/* \ */ +#define S_BAC 9 + +/* / */ +#define S_SLA 10 + +/* + */ +#define S_PLU 11 + +/* - */ +#define S_MIN 12 + +/* . */ +#define S_DOT 13 + +/* 0 */ +#define S_ZER 14 + +/* 123456789 */ +#define S_DIG 15 + +/* a */ +#define S__A_ 16 + +/* b */ +#define S__B_ 17 + +/* c */ +#define S__C_ 18 + +/* d */ +#define S__D_ 19 + +/* e */ +#define S__E_ 20 + +/* f */ +#define S__F_ 21 + +/* l */ +#define S__L_ 22 + +/* n */ +#define S__N_ 23 + +/* r */ +#define S__R_ 24 + +/* s */ +#define S__S_ 25 + +/* t */ +#define S__T_ 26 + +/* u */ +#define S__U_ 27 + +/* ABCDF */ +#define S_A_F 28 + +/* E */ +#define S_E 29 + +/* everything else */ +#define S_ETC 30 + + +/* + This table maps the 128 ASCII characters into the 32 character classes. + The remaining Unicode characters should be mapped to S_ETC. +*/ +static const int ascii_class[128] = { + S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, + S_ERR, S_WSP, S_WSP, S_ERR, S_ERR, S_WSP, S_ERR, S_ERR, + S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, + S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, + + S_SPA, S_ETC, S_QUO, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, + S_ETC, S_ETC, S_ETC, S_PLU, S_COM, S_MIN, S_DOT, S_SLA, + S_ZER, S_DIG, S_DIG, S_DIG, S_DIG, S_DIG, S_DIG, S_DIG, + S_DIG, S_DIG, S_COL, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, + + S_ETC, S_A_F, S_A_F, S_A_F, S_A_F, S_E , S_A_F, S_ETC, + S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, + S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, + S_ETC, S_ETC, S_ETC, S_LBT, S_BAC, S_RBT, S_ETC, S_ETC, + + S_ETC, S__A_, S__B_, S__C_, S__D_, S__E_, S__F_, S_ETC, + S_ETC, S_ETC, S_ETC, S_ETC, S__L_, S_ETC, S__N_, S_ETC, + S_ETC, S_ETC, S__R_, S__S_, S__T_, S__U_, S_ETC, S_ETC, + S_ETC, S_ETC, S_ETC, S_LBE, S_ETC, S_RBE, S_ETC, S_ETC +}; + +/**/ +static const int loose_ascii_class[128] = { + S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, + S_ERR, S_WSP, S_WSP, S_ERR, S_ERR, S_WSP, S_ERR, S_ERR, + S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, + S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, S_ERR, + + S_SPA, S_ETC, S_QUO, S_ETC, S_ETC, S_ETC, S_ETC, S_QUO, + S_ETC, S_ETC, S_ETC, S_PLU, S_COM, S_MIN, S_DOT, S_SLA, + S_ZER, S_DIG, S_DIG, S_DIG, S_DIG, S_DIG, S_DIG, S_DIG, + S_DIG, S_DIG, S_COL, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, + + S_ETC, S_A_F, S_A_F, S_A_F, S_A_F, S_E , S_A_F, S_ETC, + S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, + S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, S_ETC, + S_ETC, S_ETC, S_ETC, S_LBT, S_BAC, S_RBT, S_ETC, S_ETC, + + S_ETC, S__A_, S__B_, S__C_, S__D_, S__E_, S__F_, S_ETC, + S_ETC, S_ETC, S_ETC, S_ETC, S__L_, S_ETC, S__N_, S_ETC, + S_ETC, S_ETC, S__R_, S__S_, S__T_, S__U_, S_ETC, S_ETC, + S_ETC, S_ETC, S_ETC, S_LBE, S_ETC, S_RBE, S_ETC, S_ETC +}; +/**/ + + + +/* + The state transition table takes the current state and the current symbol, + and returns either a new state or an action. A new state is a number between + 0 and 29. An action is a negative number between -1 and -9. A JSON text is + accepted if the end of the text is in state 9 and mode is MODE_DONE. +*/ +static const int state_transition_table[30][31] = { +/* 0*/ { 0, 0,-8,-1,-6,-1,-1,-1, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/* 1*/ { 1, 1,-1,-9,-1,-1,-1,-1, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/* 2*/ { 2, 2,-8,-1,-6,-5,-1,-1, 3,-1,-1,-1,20,-1,21,22,-1,-1,-1,-1,-1,13,-1,17,-1,-1,10,-1,-1,-1,-1}, +/* 3*/ { 3,-1, 3, 3, 3, 3, 3, 3,-4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, +/* 4*/ {-1,-1,-1,-1,-1,-1,-1,-1, 3, 3, 3,-1,-1,-1,-1,-1,-1, 3,-1,-1,-1, 3,-1, 3, 3,-1, 3, 5,-1,-1,-1}, +/* 5*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 6, 6, 6, 6, 6, 6, 6, 6,-1,-1,-1,-1,-1,-1, 6, 6,-1}, +/* 6*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 7, 7, 7, 7, 7, 7, 7, 7,-1,-1,-1,-1,-1,-1, 7, 7,-1}, +/* 7*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 8, 8, 8, 8, 8, 8, 8, 8,-1,-1,-1,-1,-1,-1, 8, 8,-1}, +/* 8*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 3, 3, 3, 3, 3, 3, 3, 3,-1,-1,-1,-1,-1,-1, 3, 3,-1}, +/* 9*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*10*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,-1,-1,-1,-1,-1,-1}, +/*11*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,12,-1,-1,-1}, +/*12*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*13*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,14,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*14*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,15,-1,-1,-1,-1,-1,-1,-1,-1}, +/*15*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,16,-1,-1,-1,-1,-1}, +/*16*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*17*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,18,-1,-1,-1}, +/*18*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,-1,-1,-1,-1,-1,-1,-1,-1}, +/*19*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 9,-1,-1,-1,-1,-1,-1,-1,-1}, +/*20*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,21,22,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*21*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,23,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*22*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,23,22,22,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,24,-1}, +/*23*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,-1,23,23,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,24,-1}, +/*24*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,25,25,-1,26,26,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*25*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,26,26,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*26*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,-1,26,26,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*27*/ {27,27,-1,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*28*/ {28,28,-8,-1,-6,-1,-1,-1, 3,-1,-1,-1,20,-1,21,22,-1,-1,-1,-1,-1,13,-1,17,-1,-1,10,-1,-1,-1,-1}, +/*29*/ {29,29,-1,-1,-1,-1,-1,-1, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1} +}; + +/**/ +/* + Alternate "loose" transition table to support unquoted keys. +*/ +static const int loose_state_transition_table[31][31] = { +/* 0*/ { 0, 0,-8,-1,-6,-1,-1,-1, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/* 1*/ { 1, 1,-1,-9,-1,-1,-1,-1, 3,-1,-1,-1,-1,-1,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30}, +/* 2*/ { 2, 2,-8,-1,-6,-5,-1,-1, 3,-1,-1,-1,20,-1,21,22,-1,-1,-1,-1,-1,13,-1,17,-1,-1,10,-1,-1,-1,-1}, +/* 3*/ { 3,-1, 3, 3, 3, 3, 3, 3,-4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}, +/* 4*/ {-1,-1,-1,-1,-1,-1,-1,-1, 3, 3, 3,-1,-1,-1,-1,-1,-1, 3,-1,-1,-1, 3,-1, 3, 3,-1, 3, 5,-1,-1,-1}, +/* 5*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 6, 6, 6, 6, 6, 6, 6, 6,-1,-1,-1,-1,-1,-1, 6, 6,-1}, +/* 6*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 7, 7, 7, 7, 7, 7, 7, 7,-1,-1,-1,-1,-1,-1, 7, 7,-1}, +/* 7*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 8, 8, 8, 8, 8, 8, 8, 8,-1,-1,-1,-1,-1,-1, 8, 8,-1}, +/* 8*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 3, 3, 3, 3, 3, 3, 3, 3,-1,-1,-1,-1,-1,-1, 3, 3,-1}, +/* 9*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*10*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,-1,-1,-1,-1,-1,-1}, +/*11*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,12,-1,-1,-1}, +/*12*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*13*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,14,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*14*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,15,-1,-1,-1,-1,-1,-1,-1,-1}, +/*15*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,16,-1,-1,-1,-1,-1}, +/*16*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*17*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,18,-1,-1,-1}, +/*18*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,19,-1,-1,-1,-1,-1,-1,-1,-1}, +/*19*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 9,-1,-1,-1,-1,-1,-1,-1,-1}, +/*20*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,21,22,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*21*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,23,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*22*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,23,22,22,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,24,-1}, +/*23*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,-1,23,23,-1,-1,-1,-1,24,-1,-1,-1,-1,-1,-1,-1,-1,24,-1}, +/*24*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,25,25,-1,26,26,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*25*/ {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,26,26,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*26*/ { 9, 9,-1,-7,-1,-5,-1,-3,-1,-1,-1,-1,-1,-1,26,26,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*27*/ {27,27,-1,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, +/*28*/ {28,28,-8,-1,-6,-5,-1,-1, 3,-1,-1,-1,20,-1,21,22,-1,-1,-1,-1,-1,13,-1,17,-1,-1,10,-1,-1,-1,-1}, +/*29*/ {29,29,-1,-7,-1,-1,-1,-7, 3,-1,-1,-1,-1,-1,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30}, +/*30*/ {30,-1,30,30,30,30,-10,30,-4,4,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30} +}; +/**/ + + +#define JSON_PARSER_MAX_DEPTH 128 + +/** + * A stack maintains the states of nested structures. + */ +typedef struct json_parser { + int the_stack[JSON_PARSER_MAX_DEPTH]; + Variant the_zstack[JSON_PARSER_MAX_DEPTH]; + int the_top; +} json_parser; + +/** + * These modes can be pushed on the PDA stack. + */ +#define MODE_DONE 1 +#define MODE_KEY 2 +#define MODE_OBJECT 3 +#define MODE_ARRAY 4 + +/** + * Push a mode onto the stack. Return false if there is overflow. + */ +static int push(json_parser *json, int mode) { + json->the_top += 1; + if (json->the_top >= JSON_PARSER_MAX_DEPTH) { + return false; + } + json->the_stack[json->the_top] = mode; + return true; +} + + +/** + * Pop the stack, assuring that the current mode matches the expectation. + * Return false if there is underflow or if the modes mismatch. + */ +static int pop(json_parser *json, int mode) { + if (json->the_top < 0 || json->the_stack[json->the_top] != mode) { + return false; + } + if (mode == MODE_ARRAY) { + json->the_zstack[json->the_top].unset(); + } + json->the_stack[json->the_top] = 0; + json->the_top -= 1; + return true; +} + +static int dehexchar(char c) { + if (c >= '0' && c <= '9') return c - '0'; + if (c >= 'A' && c <= 'F') return c - ('A' - 10); + if (c >= 'a' && c <= 'f') return c - ('a' - 10); + return -1; +} + +static void json_create_zval(Variant &z, StringBuffer &buf, int type) { + switch (type) { + case KindOfInt64: + { + const char *p = buf.data(); + ASSERT(p); + if (p == NULL) { + z = 0LL; + return; + } + + bool neg = (buf.charAt(0) == '-'); + + int len = buf.size(); + if (neg) len--; + if (len >= MAX_LENGTH_OF_LONG - 1) { + if (len == MAX_LENGTH_OF_LONG - 1) { + int cmp = strcmp(p + (neg ? 1 : 0), long_min_digits); + if (!(cmp < 0 || (cmp == 0 && neg))) { + z = strtod(p, NULL); + return; + } + } else { + z = strtod(p, NULL); + return; + } + } + z = strtoll(buf.data(), NULL, 10); + } + break; + case KindOfDouble: + z = buf.data() ? strtod(buf.data(), NULL) : 0.0; + break; + case KindOfString: + z = buf.detach(); + buf.reset(); + break; + case KindOfBoolean: + z = (buf.data() && (*buf.data() == 't')); + break; + default: + z = null; + break; + } +} + +static void utf16_to_utf8(StringBuffer &buf, unsigned short utf16) { + if (utf16 < 0x80) { + buf += (char)utf16; + } else if (utf16 < 0x800) { + buf += (char)(0xc0 | (utf16 >> 6)); + buf += (char)(0x80 | (utf16 & 0x3f)); + } else if ((utf16 & 0xfc00) == 0xdc00 + && buf.size() >= 3 + && ((unsigned char)buf.charAt(buf.size() - 3)) == 0xed + && ((unsigned char)buf.charAt(buf.size() - 2) & 0xf0) == 0xa0 + && ((unsigned char)buf.charAt(buf.size() - 1)& 0xc0) == 0x80) { + /* found surrogate pair */ + unsigned long utf32; + + utf32 = (((buf.charAt(buf.size() - 2) & 0xf) << 16) + | ((buf.charAt(buf.size() - 1) & 0x3f) << 10) + | (utf16 & 0x3ff)) + 0x10000; + buf.resize(buf.size() - 3); + + buf += (char)(0xf0 | (utf32 >> 18)); + buf += (char)(0x80 | ((utf32 >> 12) & 0x3f)); + buf += (char)(0x80 | ((utf32 >> 6) & 0x3f)); + buf += (char)(0x80 | (utf32 & 0x3f)); + } else { + buf += (char)(0xe0 | (utf16 >> 12)); + buf += (char)(0x80 | ((utf16 >> 6) & 0x3f)); + buf += (char)(0x80 | (utf16 & 0x3f)); + } +} + +static void object_set(Variant &var, StringBuffer &key, Variant &value, + int assoc) { + String data = key.detach(); + if (!assoc) { + if (data.empty()) { + var.toObject()->o_set("_empty_", -1, ref(value)); + } else { + var.toObject()->o_set(data, -1, ref(value)); + } + } else { + var.set(data, ref(value)); + } + key.reset(); +} + +static void attach_zval(json_parser *json, int up, int cur, StringBuffer &key, + int assoc) { + Variant &root = json->the_zstack[up]; + Variant &child = json->the_zstack[cur]; + int up_mode = json->the_stack[up]; + + if (up_mode == MODE_ARRAY) { + root.append(ref(child)); + } else if (up_mode == MODE_OBJECT) { + object_set(root, key, child, assoc); + } +} + +#define SWAP_BUFFERS(from, to) do { \ + StringBuffer *tmp = from; \ + from = to; \ + to = tmp; \ + } while(0); +#define JSON_RESET_TYPE() do { type = -1; } while(0); +#define JSON(x) the_json.x + +/** + * The JSON_parser takes a UTF-16 encoded string and determines if it is a + * syntactically correct JSON text. Along the way, it creates a PHP variable. + * + * It is implemented as a Pushdown Automaton; that means it is a finite state + * machine with a stack. + */ +int JSON_parser(Variant &z, unsigned short p[], int length, int assoc/**/, + int loose/**/) { + int b; /* the next character */ + int c; /* the next character class */ + int s; /* the next state */ + json_parser the_json; /* the parser state */ + int the_state = 0; + int the_index; + + /**/ + int qchr = 0; + int const *byte_class; + if (loose) { + byte_class = loose_ascii_class; + } else { + byte_class = ascii_class; + } + /**/ + + StringBuffer sb_buf, sb_key; + StringBuffer *buf = &sb_buf; + StringBuffer *key = &sb_key; + + int type = -1; + unsigned short utf16 = 0; + + JSON(the_top) = -1; + push(&the_json, MODE_DONE); + + for (the_index = 0; the_index < length; the_index += 1) { + b = p[the_index]; + if ((b & 127) == b) { + /**/ + c = byte_class[b]; + /**/ + if (c <= S_ERR) { + return false; + } + } else { + c = S_ETC; + } + /* + Get the next state from the transition table. + */ + + /**/ + if (loose) { + s = loose_state_transition_table[the_state][c]; + } else { + s = state_transition_table[the_state][c]; + } + + if (s == -4) { + if (b != qchr) { + s = 3; + } else { + qchr = 0; + } + } + /**/ + + if (s < 0) { + /* + Perform one of the predefined actions. + */ + switch (s) { + /* + empty } + */ + case -9: + if (!pop(&the_json, MODE_KEY)) { + return false; + } + the_state = 9; + break; + /* + { + */ + case -8: + if (!push(&the_json, MODE_KEY)) { + return false; + } + + the_state = 1; + if (JSON(the_top) > 0) { + Variant &top = JSON(the_zstack)[JSON(the_top)]; + if (JSON(the_top) == 1) { + top = ref(z); + } else { + top.unset(); + } + if (!assoc) { + top = Object(NEW(c_stdclass)()); + } else { + top = Array::Create(); + } + if (JSON(the_top) > 1) { + attach_zval(&the_json, JSON(the_top-1), JSON(the_top), *key, + assoc); + } + JSON_RESET_TYPE(); + } + break; + /* + } + */ + case -7: + /*** BEGIN Facebook: json_utf8_loose ***/ + /* + If this is a trailing comma in an object definition, + we're in MODE_KEY. In that case, throw that off the + stack and restore MODE_OBJECT so that we pretend the + trailing comma just didn't happen. + */ + if (loose) { + if (pop(&the_json, MODE_KEY)) { + push(&the_json, MODE_OBJECT); + } + } + /*** END Facebook: json_utf8_loose ***/ + + if (type != -1 && + (JSON(the_stack)[JSON(the_top)] == MODE_OBJECT || + JSON(the_stack)[JSON(the_top)] == MODE_ARRAY)) { + Variant mval; + json_create_zval(mval, *buf, type); + Variant &top = JSON(the_zstack)[JSON(the_top)]; + object_set(top, *key, mval, assoc); + buf->reset(); + JSON_RESET_TYPE(); + } + + + if (!pop(&the_json, MODE_OBJECT)) { + return false; + } + the_state = 9; + break; + /* + [ + */ + case -6: + if (!push(&the_json, MODE_ARRAY)) { + return false; + } + the_state = 2; + + if (JSON(the_top) > 0) { + if (JSON(the_top) == 1) { + JSON(the_zstack)[JSON(the_top)] = ref(z); + } else { + JSON(the_zstack)[JSON(the_top)].unset(); + } + JSON(the_zstack)[JSON(the_top)] = Array::Create(); + if (JSON(the_top) > 1) { + attach_zval(&the_json, JSON(the_top-1), JSON(the_top), *key, + assoc); + } + JSON_RESET_TYPE(); + } + break; + /* + ] + */ + case -5: + { + if (type != -1 && + (JSON(the_stack)[JSON(the_top)] == MODE_OBJECT || + JSON(the_stack)[JSON(the_top)] == MODE_ARRAY)) { + Variant mval; + json_create_zval(mval, *buf, type); + JSON(the_zstack)[JSON(the_top)].append(mval); + buf->reset(); + JSON_RESET_TYPE(); + } + + if (!pop(&the_json, MODE_ARRAY)) { + return false; + } + the_state = 9; + } + break; + /* + " + */ + case -4: + switch (JSON(the_stack)[JSON(the_top)]) { + case MODE_KEY: + the_state = 27; + SWAP_BUFFERS(buf, key); + JSON_RESET_TYPE(); + break; + case MODE_ARRAY: + case MODE_OBJECT: + the_state = 9; + break; + case MODE_DONE: + if (type == KindOfString) { + z = buf->detach(); + buf->reset(); + the_state = 9; + break; + } + /* fall through if not KindOfString */ + default: + return false; + } + break; + /* + , + */ + case -3: + { + Variant mval; + if (type != -1 && + (JSON(the_stack)[JSON(the_top)] == MODE_OBJECT || + JSON(the_stack[JSON(the_top)]) == MODE_ARRAY)) { + json_create_zval(mval, *buf, type); + } + + switch (JSON(the_stack)[JSON(the_top)]) { + case MODE_OBJECT: + if (pop(&the_json, MODE_OBJECT) && + push(&the_json, MODE_KEY)) { + if (type != -1) { + Variant &top = JSON(the_zstack)[JSON(the_top)]; + object_set(top, *key, mval, assoc); + } + the_state = 29; + } + break; + case MODE_ARRAY: + if (type != -1) { + JSON(the_zstack)[JSON(the_top)].append(mval); + } + the_state = 28; + break; + default: + return false; + } + buf->reset(); + JSON_RESET_TYPE(); + } + break; + + /**/ + /* + : (after unquoted string) + */ + case -10: + if (JSON(the_stack)[JSON(the_top)] == MODE_KEY) { + the_state = 27; + SWAP_BUFFERS(buf, key); + JSON_RESET_TYPE(); + s = -2; + } else { + s = 3; + break; + } + /**/ + + /* + : + */ + case -2: + if (pop(&the_json, MODE_KEY) && push(&the_json, MODE_OBJECT)) { + the_state = 28; + break; + } + /* + syntax error + */ + case -1: + return false; + } + } else { + /* + Change the state and iterate. + */ + if (type == KindOfString) { + if (/**/(/**/s == 3/**/ || s == 30)/**/ && + the_state != 8) { + if (the_state != 4) { + utf16_to_utf8(*buf, b); + } else { + switch (b) { + case 'b': buf->append('\b'); break; + case 't': buf->append('\t'); break; + case 'n': buf->append('\n'); break; + case 'f': buf->append('\f'); break; + case 'r': buf->append('\r'); break; + default: + utf16_to_utf8(*buf, b); + break; + } + } + } else if (s == 6) { + utf16 = dehexchar(b) << 12; + } else if (s == 7) { + utf16 += dehexchar(b) << 8; + } else if (s == 8) { + utf16 += dehexchar(b) << 4; + } else if (s == 3 && the_state == 8) { + utf16 += dehexchar(b); + utf16_to_utf8(*buf, utf16); + } + } else if ((type < 0 || type == KindOfNull) && + (c == S_DIG || c == S_ZER)) { + type = KindOfInt64; + buf->append((char)b); + } else if (type == KindOfInt64 && s == 24) { + type = KindOfDouble; + buf->append((char)b); + } else if ((type < 0 || type == KindOfNull || type == KindOfInt64) && + c == S_DOT) { + type = KindOfDouble; + buf->append((char)b); + } else if (type != KindOfString && c == S_QUO) { + type = KindOfString; + /**/qchr = b;/**/ + } else if ((type < 0 || type == KindOfNull || type == KindOfInt64 || + type == KindOfDouble) && + ((the_state == 12 && s == 9) || + (the_state == 16 && s == 9))) { + type = KindOfBoolean; + } else if (type < 0 && the_state == 19 && s == 9) { + type = KindOfNull; + } else if (type != KindOfString && c > S_WSP) { + utf16_to_utf8(*buf, b); + } + + the_state = s; + } + } + + return the_state == 9 && pop(&the_json, MODE_DONE); +} diff --git a/src/cpp/ext/JSON_parser.h b/src/cpp/ext/JSON_parser.h new file mode 100644 index 0000000000000..e81cfdf7be02f --- /dev/null +++ b/src/cpp/ext/JSON_parser.h @@ -0,0 +1,22 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +/* JSON_checker.h */ + +#include + +int JSON_parser(HPHP::Variant &z, unsigned short p[], int length, + int assoc/**/, int loose/**/); diff --git a/src/cpp/ext/Makefile b/src/cpp/ext/Makefile new file mode 100644 index 0000000000000..d03490b65fc8c --- /dev/null +++ b/src/cpp/ext/Makefile @@ -0,0 +1,16 @@ + +PROJECT_ROOT = ../../.. +PROJECT_NAME = hphp_cpp_ext + +AUTO_SOURCES = 1 +SOURCE_SUBDIRS = bcmath hash fql phpmcc + +include $(PROJECT_ROOT)/src/rules.mk + +ifdef MAC_OS_X +TARGETS = $(STATIC_LIB) +else +TARGETS = $(STATIC_LIB) $(SHARED_LIB) +endif + +all: $(TARGETS) diff --git a/src/cpp/ext/README b/src/cpp/ext/README new file mode 100644 index 0000000000000..bbf71d702fa73 --- /dev/null +++ b/src/cpp/ext/README @@ -0,0 +1,79 @@ + +I. Language Internals +========================= + +1. ext_variable 30 x +2. ext_function 14 x +3. ext_class 15 x +4. ext_error 11 x +5. ext_misc 25 x +6. ext_options 46 x +7. ext_apache 14 x +------------------------- + 155 x + +II. Data Types +========================= + +01. ext_string 90 x +02. ext_url 10 x +03. ext_datetime 37 x +04. ext_array 72 x +05. ext_hash 10 x +06. ext_mcrypt 37 x +07. ext_openssl 39 x +08. ext_math 48 x +09. ext_bcmath 10 x +10. ext_json 02 x +------------------------- + 355 x + +III. System Functions +========================= + +1. ext_output 17 x +2. ext_file 89 x +3. ext_stream 40 x +4. ext_socket 25 x +5. ext_network 32 x +6. ext_ipc 17 x +7. ext_process 25 x +8. ext_posix 35 x +------------------------- + 280 x + +IV. External Packages +========================= + +01. ext_apc 10 x +02. ext_mysql 49 x +03. ext_preg 15 x +04. ext_zlib 22 x +05. ext_ctype 11 x +06. ext_curl 18 x +07. ext_apd 9 x +08. ext_iconv 11 x +09. ext_mb 55 x +10. ext_simplexml 7 x +11. ext_image 107 x +12. ext_xmlwriter 42 x + +13. ext_ldap 43 - +14. ext_mailparse 16 - +15. ext_xml 24 - +16. ext_magick 428 - +17. ext_oracle 38 - +------------------------- + 905 + +V. Facebook Specifics +========================= + +1. ext_facebook 17 x +2. ext_fbml 23 x +3. ext_mcc 48 x +------------------------- + 88 x + +************************* + Total: 1731 diff --git a/src/cpp/ext/bcmath/add.c b/src/cpp/ext/bcmath/add.c new file mode 100644 index 0000000000000..ebfe152a52d1c --- /dev/null +++ b/src/cpp/ext/bcmath/add.c @@ -0,0 +1,88 @@ +/* add.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +/* Here is the full add routine that takes care of negative numbers. + N1 is added to N2 and the result placed into RESULT. SCALE_MIN + is the minimum scale for the result. */ + +void +bc_add (n1, n2, result, scale_min) + bc_num n1, n2, *result; + int scale_min; +{ + bc_num sum = NULL; + int cmp_res; + int res_scale; + + if (n1->n_sign == n2->n_sign) + { + sum = _bc_do_add (n1, n2, scale_min); + sum->n_sign = n1->n_sign; + } + else + { + /* subtraction must be done. */ + cmp_res = _bc_do_compare (n1, n2, FALSE, FALSE); /* Compare magnitudes. */ + switch (cmp_res) + { + case -1: + /* n1 is less than n2, subtract n1 from n2. */ + sum = _bc_do_sub (n2, n1, scale_min); + sum->n_sign = n2->n_sign; + break; + case 0: + /* They are equal! return zero with the correct scale! */ + res_scale = MAX (scale_min, MAX(n1->n_scale, n2->n_scale)); + sum = bc_new_num (1, res_scale); + memset (sum->n_value, 0, res_scale+1); + break; + case 1: + /* n2 is less than n1, subtract n2 from n1. */ + sum = _bc_do_sub (n1, n2, scale_min); + sum->n_sign = n1->n_sign; + } + } + + /* Clean up and return. */ + bc_free_num (result); + *result = sum; +} + diff --git a/src/cpp/ext/bcmath/bcmath.h b/src/cpp/ext/bcmath/bcmath.h new file mode 100644 index 0000000000000..048bd34e44379 --- /dev/null +++ b/src/cpp/ext/bcmath/bcmath.h @@ -0,0 +1,169 @@ +/* bcmath.h: bcmath library header. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#ifndef _BCMATH_H_ +#define _BCMATH_H_ + +#include "config.h" + +typedef enum {PLUS, MINUS} sign; + +typedef struct bc_struct *bc_num; + +typedef struct bc_struct + { + sign n_sign; + int n_len; /* The number of digits before the decimal point. */ + int n_scale; /* The number of digits after the decimal point. */ + int n_refs; /* The number of pointers to this number. */ + bc_num n_next; /* Linked list for available list. */ + char *n_ptr; /* The pointer to the actual storage. + If NULL, n_value points to the inside of + another number (bc_multiply...) and should + not be "freed." */ + char *n_value; /* The number. Not zero char terminated. + May not point to the same place as n_ptr as + in the case of leading zeros generated. */ + } bc_struct; + + +/* The base used in storing the numbers in n_value above. + Currently this MUST be 10. */ + +#define BASE 10 + +/* Some useful macros and constants. */ + +#define CH_VAL(c) (c - '0') +#define BCD_CHAR(d) (d + '0') + +#ifdef MIN +#undef MIN +#undef MAX +#endif +#define MAX(a, b) ((a)>(b)?(a):(b)) +#define MIN(a, b) ((a)>(b)?(b):(a)) +#define ODD(a) ((a)&1) + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif + +#ifndef LONG_MAX +#define LONG_MAX 0x7ffffff +#endif + + +/* Function Prototypes */ + +/* Define the _PROTOTYPE macro if it is needed. */ + +#define _PROTOTYPE(func, args) func args + +#ifdef __cplusplus +extern "C" { +#endif + +_PROTOTYPE(void bc_init_numbers, (TSRMLS_D)); + +_PROTOTYPE(bc_num _bc_new_num_ex, (int length, int scale, int persistent)); + +_PROTOTYPE(void _bc_free_num_ex, (bc_num *num, int persistent)); + +_PROTOTYPE(bc_num bc_copy_num, (bc_num num)); + +_PROTOTYPE(void bc_init_num, (bc_num *num TSRMLS_DC)); + +_PROTOTYPE(void bc_str2num, (bc_num *num, char *str, int scale TSRMLS_DC)); + +_PROTOTYPE(char *bc_num2str, (bc_num num)); + +_PROTOTYPE(void bc_int2num, (bc_num *num, int val)); + +_PROTOTYPE(long bc_num2long, (bc_num num)); + +_PROTOTYPE(int bc_compare, (bc_num n1, bc_num n2)); + +_PROTOTYPE(char bc_is_zero, (bc_num num TSRMLS_DC)); + +_PROTOTYPE(char bc_is_near_zero, (bc_num num, int scale)); + +_PROTOTYPE(char bc_is_neg, (bc_num num)); + +_PROTOTYPE(void bc_add, (bc_num n1, bc_num n2, bc_num *result, int scale_min)); + +_PROTOTYPE(void bc_sub, (bc_num n1, bc_num n2, bc_num *result, int scale_min)); + +_PROTOTYPE(void bc_multiply, (bc_num n1, bc_num n2, bc_num *prod, int scale TSRMLS_DC)); + +_PROTOTYPE(int bc_divide, (bc_num n1, bc_num n2, bc_num *quot, int scale TSRMLS_DC)); + +_PROTOTYPE(int bc_modulo, (bc_num num1, bc_num num2, bc_num *result, + int scale TSRMLS_DC)); + +_PROTOTYPE(int bc_divmod, (bc_num num1, bc_num num2, bc_num *quot, + bc_num *rem, int scale TSRMLS_DC)); + +_PROTOTYPE(int bc_raisemod, (bc_num base, bc_num expo, bc_num mod, + bc_num *result, int scale TSRMLS_DC)); + +_PROTOTYPE(void bc_raise, (bc_num num1, bc_num num2, bc_num *result, + int scale TSRMLS_DC)); + +_PROTOTYPE(int bc_sqrt, (bc_num *num, int scale TSRMLS_DC)); + +_PROTOTYPE(void bc_out_num, (bc_num num, int o_base, void (* out_char)(int), + int leading_zero TSRMLS_DC)); + +/* Prototypes needed for external utility routines. */ + +_PROTOTYPE(void bc_rt_warn, (char *mesg ,...)); +_PROTOTYPE(void bc_rt_error, (char *mesg ,...)); +_PROTOTYPE(void bc_out_of_memory, (void)); + +#define bc_new_num(length, scale) _bc_new_num_ex((length), (scale), 0) +#define bc_free_num(num) _bc_free_num_ex((num), 0) + +struct BCMathGlobals { + bc_num _zero_; + bc_num _one_; + bc_num _two_; + long bc_precision; +}; +extern struct BCMathGlobals *get_bcmath_globals(); +#define BCG(n) (get_bcmath_globals()->n) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/cpp/ext/bcmath/compare.c b/src/cpp/ext/bcmath/compare.c new file mode 100644 index 0000000000000..3089467d73758 --- /dev/null +++ b/src/cpp/ext/bcmath/compare.c @@ -0,0 +1,161 @@ +/* compare.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +/* Compare two bc numbers. Return value is 0 if equal, -1 if N1 is less + than N2 and +1 if N1 is greater than N2. If USE_SIGN is false, just + compare the magnitudes. */ + + int +_bc_do_compare (n1, n2, use_sign, ignore_last) + bc_num n1, n2; + int use_sign; + int ignore_last; +{ + char *n1ptr, *n2ptr; + int count; + + /* First, compare signs. */ + if (use_sign && n1->n_sign != n2->n_sign) + { + if (n1->n_sign == PLUS) + return (1); /* Positive N1 > Negative N2 */ + else + return (-1); /* Negative N1 < Positive N1 */ + } + + /* Now compare the magnitude. */ + if (n1->n_len != n2->n_len) + { + if (n1->n_len > n2->n_len) + { + /* Magnitude of n1 > n2. */ + if (!use_sign || n1->n_sign == PLUS) + return (1); + else + return (-1); + } + else + { + /* Magnitude of n1 < n2. */ + if (!use_sign || n1->n_sign == PLUS) + return (-1); + else + return (1); + } + } + + /* If we get here, they have the same number of integer digits. + check the integer part and the equal length part of the fraction. */ + count = n1->n_len + MIN (n1->n_scale, n2->n_scale); + n1ptr = n1->n_value; + n2ptr = n2->n_value; + + while ((count > 0) && (*n1ptr == *n2ptr)) + { + n1ptr++; + n2ptr++; + count--; + } + if (ignore_last && count == 1 && n1->n_scale == n2->n_scale) + return (0); + if (count != 0) + { + if (*n1ptr > *n2ptr) + { + /* Magnitude of n1 > n2. */ + if (!use_sign || n1->n_sign == PLUS) + return (1); + else + return (-1); + } + else + { + /* Magnitude of n1 < n2. */ + if (!use_sign || n1->n_sign == PLUS) + return (-1); + else + return (1); + } + } + + /* They are equal up to the last part of the equal part of the fraction. */ + if (n1->n_scale != n2->n_scale) + { + if (n1->n_scale > n2->n_scale) + { + for (count = n1->n_scale-n2->n_scale; count>0; count--) + if (*n1ptr++ != 0) + { + /* Magnitude of n1 > n2. */ + if (!use_sign || n1->n_sign == PLUS) + return (1); + else + return (-1); + } + } + else + { + for (count = n2->n_scale-n1->n_scale; count>0; count--) + if (*n2ptr++ != 0) + { + /* Magnitude of n1 < n2. */ + if (!use_sign || n1->n_sign == PLUS) + return (-1); + else + return (1); + } + } + } + + /* They must be equal! */ + return (0); +} + + +/* This is the "user callable" routine to compare numbers N1 and N2. */ + +int +bc_compare (n1, n2) + bc_num n1, n2; +{ + return _bc_do_compare (n1, n2, TRUE, FALSE); +} + diff --git a/src/cpp/ext/bcmath/config.h b/src/cpp/ext/bcmath/config.h new file mode 100644 index 0000000000000..f8071114cfb19 --- /dev/null +++ b/src/cpp/ext/bcmath/config.h @@ -0,0 +1,6 @@ + +#define TSRMLS_D +#define TSRMLS_DC +#define TSRMLS_CC + +#include diff --git a/src/cpp/ext/bcmath/debug.c b/src/cpp/ext/bcmath/debug.c new file mode 100644 index 0000000000000..a57e1cfd517cb --- /dev/null +++ b/src/cpp/ext/bcmath/debug.c @@ -0,0 +1,69 @@ +/* debug.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* pn prints the number NUM in base 10. */ + +static void +out_char (int c) +{ + putchar(c); +} + + +void +pn (bc_num num TSRMLS_DC) +{ + bc_out_num (num, 10, out_char, 0 TSRMLS_CC); + out_char ('\n'); +} + + +/* pv prints a character array as if it was a string of bcd digits. */ +void +pv (name, num, len) + char *name; + unsigned char *num; + int len; +{ + int i; + printf ("%s=", name); + for (i=0; i +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +/* Some utility routines for the divide: First a one digit multiply. + NUM (with SIZE digits) is multiplied by DIGIT and the result is + placed into RESULT. It is written so that NUM and RESULT can be + the same pointers. */ + +static void +_one_mult (num, size, digit, result) + unsigned char *num; + int size, digit; + unsigned char *result; +{ + int carry, value; + unsigned char *nptr, *rptr; + + if (digit == 0) + memset (result, 0, size); + else + { + if (digit == 1) + memcpy (result, num, size); + else + { + /* Initialize */ + nptr = (unsigned char *) (num+size-1); + rptr = (unsigned char *) (result+size-1); + carry = 0; + + while (size-- > 0) + { + value = *nptr-- * digit + carry; + *rptr-- = value % BASE; + carry = value / BASE; + } + + if (carry != 0) *rptr = carry; + } + } +} + + +/* The full division routine. This computes N1 / N2. It returns + 0 if the division is ok and the result is in QUOT. The number of + digits after the decimal point is SCALE. It returns -1 if division + by zero is tried. The algorithm is found in Knuth Vol 2. p237. */ + +int +bc_divide (bc_num n1, bc_num n2, bc_num *quot, int scale TSRMLS_DC) +{ + bc_num qval; + unsigned char *num1, *num2; + unsigned char *ptr1, *ptr2, *n2ptr, *qptr; + int scale1, val; + unsigned int len1, len2, scale2, qdigits, extra, count; + unsigned int qdig, qguess, borrow, carry; + unsigned char *mval; + char zero; + unsigned int norm; + + /* Test for divide by zero. */ + if (bc_is_zero (n2 TSRMLS_CC)) return -1; + + /* Test for divide by 1. If it is we must truncate. */ + if (n2->n_scale == 0) + { + if (n2->n_len == 1 && *n2->n_value == 1) + { + qval = bc_new_num (n1->n_len, scale); + qval->n_sign = (n1->n_sign == n2->n_sign ? PLUS : MINUS); + memset (&qval->n_value[n1->n_len],0,scale); + memcpy (qval->n_value, n1->n_value, + n1->n_len + MIN(n1->n_scale,scale)); + bc_free_num (quot); + *quot = qval; + } + } + + /* Set up the divide. Move the decimal point on n1 by n2's scale. + Remember, zeros on the end of num2 are wasted effort for dividing. */ + scale2 = n2->n_scale; + n2ptr = (unsigned char *) n2->n_value+n2->n_len+scale2-1; + while ((scale2 > 0) && (*n2ptr-- == 0)) scale2--; + + len1 = n1->n_len + scale2; + scale1 = n1->n_scale - scale2; + if (scale1 < scale) + extra = scale - scale1; + else + extra = 0; + num1 = (unsigned char *)malloc(n1->n_len+n1->n_scale + extra+2); + if (num1 == NULL) bc_out_of_memory(); + memset (num1, 0, n1->n_len+n1->n_scale+extra+2); + memcpy (num1+1, n1->n_value, n1->n_len+n1->n_scale); + + len2 = n2->n_len + scale2; + num2 = (unsigned char *)malloc(len2 + 1); + if (num2 == NULL) bc_out_of_memory(); + memcpy (num2, n2->n_value, len2); + *(num2+len2) = 0; + n2ptr = num2; + while (*n2ptr == 0) + { + n2ptr++; + len2--; + } + + /* Calculate the number of quotient digits. */ + if (len2 > len1+scale) + { + qdigits = scale+1; + zero = TRUE; + } + else + { + zero = FALSE; + if (len2>len1) + qdigits = scale+1; /* One for the zero integer part. */ + else + qdigits = len1-len2+scale+1; + } + + /* Allocate and zero the storage for the quotient. */ + qval = bc_new_num (qdigits-scale,scale); + memset (qval->n_value, 0, qdigits); + + /* Allocate storage for the temporary storage mval. */ + mval = (unsigned char *)malloc(len2 + 1); + if (mval == NULL) bc_out_of_memory (); + + /* Now for the full divide algorithm. */ + if (!zero) + { + /* Normalize */ + norm = 10 / ((int)*n2ptr + 1); + if (norm != 1) + { + _one_mult (num1, len1+scale1+extra+1, norm, num1); + _one_mult (n2ptr, len2, norm, n2ptr); + } + + /* Initialize divide loop. */ + qdig = 0; + if (len2 > len1) + qptr = (unsigned char *) qval->n_value+len2-len1; + else + qptr = (unsigned char *) qval->n_value; + + /* Loop */ + while (qdig <= len1+scale-len2) + { + /* Calculate the quotient digit guess. */ + if (*n2ptr == num1[qdig]) + qguess = 9; + else + qguess = (num1[qdig]*10 + num1[qdig+1]) / *n2ptr; + + /* Test qguess. */ + if (n2ptr[1]*qguess > + (num1[qdig]*10 + num1[qdig+1] - *n2ptr*qguess)*10 + + num1[qdig+2]) + { + qguess--; + /* And again. */ + if (n2ptr[1]*qguess > + (num1[qdig]*10 + num1[qdig+1] - *n2ptr*qguess)*10 + + num1[qdig+2]) + qguess--; + } + + /* Multiply and subtract. */ + borrow = 0; + if (qguess != 0) + { + *mval = 0; + _one_mult (n2ptr, len2, qguess, mval+1); + ptr1 = (unsigned char *) num1+qdig+len2; + ptr2 = (unsigned char *) mval+len2; + for (count = 0; count < len2+1; count++) + { + val = (int) *ptr1 - (int) *ptr2-- - borrow; + if (val < 0) + { + val += 10; + borrow = 1; + } + else + borrow = 0; + *ptr1-- = val; + } + } + + /* Test for negative result. */ + if (borrow == 1) + { + qguess--; + ptr1 = (unsigned char *) num1+qdig+len2; + ptr2 = (unsigned char *) n2ptr+len2-1; + carry = 0; + for (count = 0; count < len2; count++) + { + val = (int) *ptr1 + (int) *ptr2-- + carry; + if (val > 9) + { + val -= 10; + carry = 1; + } + else + carry = 0; + *ptr1-- = val; + } + if (carry == 1) *ptr1 = (*ptr1 + 1) % 10; + } + + /* We now know the quotient digit. */ + *qptr++ = qguess; + qdig++; + } + } + + /* Clean up and return the number. */ + qval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS ); + if (bc_is_zero (qval TSRMLS_CC)) qval->n_sign = PLUS; + _bc_rm_leading_zeros (qval); + bc_free_num (quot); + *quot = qval; + + /* Clean up temporary storage. */ + free (mval); + free (num1); + free (num2); + + return 0; /* Everything is OK. */ +} + diff --git a/src/cpp/ext/bcmath/divmod.c b/src/cpp/ext/bcmath/divmod.c new file mode 100644 index 0000000000000..b8ed9c0364bf0 --- /dev/null +++ b/src/cpp/ext/bcmath/divmod.c @@ -0,0 +1,87 @@ +/* divmod.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +/* Division *and* modulo for numbers. This computes both NUM1 / NUM2 and + NUM1 % NUM2 and puts the results in QUOT and REM, except that if QUOT + is NULL then that store will be omitted. + */ + +int +bc_divmod (bc_num num1, bc_num num2, bc_num *quot, bc_num *rem, int scale TSRMLS_DC) +{ + bc_num quotient = NULL; + bc_num temp; + int rscale; + + /* Check for correct numbers. */ + if (bc_is_zero (num2 TSRMLS_CC)) return -1; + + /* Calculate final scale. */ + rscale = MAX (num1->n_scale, num2->n_scale+scale); + bc_init_num(&temp TSRMLS_CC); + + /* Calculate it. */ + bc_divide (num1, num2, &temp, scale TSRMLS_CC); + if (quot) + quotient = bc_copy_num (temp); + bc_multiply (temp, num2, &temp, rscale TSRMLS_CC); + bc_sub (num1, temp, rem, rscale); + bc_free_num (&temp); + + if (quot) + { + bc_free_num (quot); + *quot = quotient; + } + + return 0; /* Everything is OK. */ +} + + +/* Modulo for numbers. This computes NUM1 % NUM2 and puts the + result in RESULT. */ + +int +bc_modulo (bc_num num1, bc_num num2, bc_num *result, int scale TSRMLS_DC) +{ + return bc_divmod (num1, num2, NULL, result, scale TSRMLS_CC); +} + diff --git a/src/cpp/ext/bcmath/doaddsub.c b/src/cpp/ext/bcmath/doaddsub.c new file mode 100644 index 0000000000000..586b718f55ec9 --- /dev/null +++ b/src/cpp/ext/bcmath/doaddsub.c @@ -0,0 +1,232 @@ +/* doaddsub.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +/* Perform addition: N1 is added to N2 and the value is + returned. The signs of N1 and N2 are ignored. + SCALE_MIN is to set the minimum scale of the result. */ + + bc_num +_bc_do_add (n1, n2, scale_min) + bc_num n1, n2; + int scale_min; +{ + bc_num sum; + int sum_scale, sum_digits; + char *n1ptr, *n2ptr, *sumptr; + int carry, n1bytes, n2bytes; + int count; + + /* Prepare sum. */ + sum_scale = MAX (n1->n_scale, n2->n_scale); + sum_digits = MAX (n1->n_len, n2->n_len) + 1; + sum = bc_new_num (sum_digits, MAX(sum_scale, scale_min)); + + /* Zero extra digits made by scale_min. */ + if (scale_min > sum_scale) + { + sumptr = (char *) (sum->n_value + sum_scale + sum_digits); + for (count = scale_min - sum_scale; count > 0; count--) + *sumptr++ = 0; + } + + /* Start with the fraction part. Initialize the pointers. */ + n1bytes = n1->n_scale; + n2bytes = n2->n_scale; + n1ptr = (char *) (n1->n_value + n1->n_len + n1bytes - 1); + n2ptr = (char *) (n2->n_value + n2->n_len + n2bytes - 1); + sumptr = (char *) (sum->n_value + sum_scale + sum_digits - 1); + + /* Add the fraction part. First copy the longer fraction.*/ + if (n1bytes != n2bytes) + { + if (n1bytes > n2bytes) + while (n1bytes>n2bytes) + { *sumptr-- = *n1ptr--; n1bytes--;} + else + while (n2bytes>n1bytes) + { *sumptr-- = *n2ptr--; n2bytes--;} + } + + /* Now add the remaining fraction part and equal size integer parts. */ + n1bytes += n1->n_len; + n2bytes += n2->n_len; + carry = 0; + while ((n1bytes > 0) && (n2bytes > 0)) + { + *sumptr = *n1ptr-- + *n2ptr-- + carry; + if (*sumptr > (BASE-1)) + { + carry = 1; + *sumptr -= BASE; + } + else + carry = 0; + sumptr--; + n1bytes--; + n2bytes--; + } + + /* Now add carry the longer integer part. */ + if (n1bytes == 0) + { n1bytes = n2bytes; n1ptr = n2ptr; } + while (n1bytes-- > 0) + { + *sumptr = *n1ptr-- + carry; + if (*sumptr > (BASE-1)) + { + carry = 1; + *sumptr -= BASE; + } + else + carry = 0; + sumptr--; + } + + /* Set final carry. */ + if (carry == 1) + *sumptr += 1; + + /* Adjust sum and return. */ + _bc_rm_leading_zeros (sum); + return sum; +} + + +/* Perform subtraction: N2 is subtracted from N1 and the value is + returned. The signs of N1 and N2 are ignored. Also, N1 is + assumed to be larger than N2. SCALE_MIN is the minimum scale + of the result. */ + + bc_num +_bc_do_sub (n1, n2, scale_min) + bc_num n1, n2; + int scale_min; +{ + bc_num diff; + int diff_scale, diff_len; + int min_scale, min_len; + char *n1ptr, *n2ptr, *diffptr; + int borrow, count, val; + + /* Allocate temporary storage. */ + diff_len = MAX (n1->n_len, n2->n_len); + diff_scale = MAX (n1->n_scale, n2->n_scale); + min_len = MIN (n1->n_len, n2->n_len); + min_scale = MIN (n1->n_scale, n2->n_scale); + diff = bc_new_num (diff_len, MAX(diff_scale, scale_min)); + + /* Zero extra digits made by scale_min. */ + if (scale_min > diff_scale) + { + diffptr = (char *) (diff->n_value + diff_len + diff_scale); + for (count = scale_min - diff_scale; count > 0; count--) + *diffptr++ = 0; + } + + /* Initialize the subtract. */ + n1ptr = (char *) (n1->n_value + n1->n_len + n1->n_scale -1); + n2ptr = (char *) (n2->n_value + n2->n_len + n2->n_scale -1); + diffptr = (char *) (diff->n_value + diff_len + diff_scale -1); + + /* Subtract the numbers. */ + borrow = 0; + + /* Take care of the longer scaled number. */ + if (n1->n_scale != min_scale) + { + /* n1 has the longer scale */ + for (count = n1->n_scale - min_scale; count > 0; count--) + *diffptr-- = *n1ptr--; + } + else + { + /* n2 has the longer scale */ + for (count = n2->n_scale - min_scale; count > 0; count--) + { + val = - *n2ptr-- - borrow; + if (val < 0) + { + val += BASE; + borrow = 1; + } + else + borrow = 0; + *diffptr-- = val; + } + } + + /* Now do the equal length scale and integer parts. */ + + for (count = 0; count < min_len + min_scale; count++) + { + val = *n1ptr-- - *n2ptr-- - borrow; + if (val < 0) + { + val += BASE; + borrow = 1; + } + else + borrow = 0; + *diffptr-- = val; + } + + /* If n1 has more digits then n2, we now do that subtract. */ + if (diff_len != min_len) + { + for (count = diff_len - min_len; count > 0; count--) + { + val = *n1ptr-- - borrow; + if (val < 0) + { + val += BASE; + borrow = 1; + } + else + borrow = 0; + *diffptr-- = val; + } + } + + /* Clean up and return. */ + _bc_rm_leading_zeros (diff); + return diff; +} + diff --git a/src/cpp/ext/bcmath/init.c b/src/cpp/ext/bcmath/init.c new file mode 100644 index 0000000000000..356607e320dcc --- /dev/null +++ b/src/cpp/ext/bcmath/init.c @@ -0,0 +1,129 @@ +/* init.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +#if SANDER_0 + bc_num _bc_Free_list = NULL; +#endif + +/* new_num allocates a number and sets fields to known values. */ + +bc_num +_bc_new_num_ex (length, scale, persistent) + int length, scale, persistent; +{ + bc_num temp; + + temp = (bc_num)malloc(sizeof(bc_struct)+length + scale); +#if 0 + if (_bc_Free_list != NULL) { + temp = _bc_Free_list; + _bc_Free_list = temp->n_next; + } else { + temp = (bc_num)malloc (sizeof(bc_struct)); + if (temp == NULL) bc_out_of_memory (); + } +#endif + temp->n_sign = PLUS; + temp->n_len = length; + temp->n_scale = scale; + temp->n_refs = 1; + temp->n_ptr = (char *)malloc(length + scale); + if (temp->n_ptr == NULL) bc_out_of_memory(); + temp->n_value = temp->n_ptr; + memset(temp->n_ptr, 0, length+scale); + return temp; +} + + +/* "Frees" a bc_num NUM. Actually decreases reference count and only + frees the storage if reference count is zero. */ + +void +_bc_free_num_ex (num, persistent) + bc_num *num; + int persistent; +{ + if (*num == NULL) return; + (*num)->n_refs--; + if ((*num)->n_refs == 0) { + if ((*num)->n_ptr) { + free((*num)->n_ptr); + } + free(*num); +#if 0 + (*num)->n_next = _bc_Free_list; + _bc_Free_list = *num; +#endif + } + *num = NULL; +} + + +/* Intitialize the number package! */ + +void +bc_init_numbers (TSRMLS_D) +{ + BCG(_zero_) = _bc_new_num_ex (1,0,1); + BCG(_one_) = _bc_new_num_ex (1,0,1); + BCG(_one_)->n_value[0] = 1; + BCG(_two_) = _bc_new_num_ex (1,0,1); + BCG(_two_)->n_value[0] = 2; +} + + +/* Make a copy of a number! Just increments the reference count! */ + +bc_num +bc_copy_num (bc_num num) +{ + num->n_refs++; + return num; +} + + +/* Initialize a number NUM by making it a copy of zero. */ + +void +bc_init_num (bc_num *num TSRMLS_DC) +{ + *num = bc_copy_num (BCG(_zero_)); +} + diff --git a/src/cpp/ext/bcmath/int2num.c b/src/cpp/ext/bcmath/int2num.c new file mode 100644 index 0000000000000..7c2b57098f697 --- /dev/null +++ b/src/cpp/ext/bcmath/int2num.c @@ -0,0 +1,84 @@ +/* int2num.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +/* Convert an integer VAL to a bc number NUM. */ + +void +bc_int2num (num, val) + bc_num *num; + int val; +{ + char buffer[30]; + char *bptr, *vptr; + int ix = 1; + char neg = 0; + + /* Sign. */ + if (val < 0) + { + neg = 1; + val = -val; + } + + /* Get things going. */ + bptr = buffer; + *bptr++ = val % BASE; + val = val / BASE; + + /* Extract remaining digits. */ + while (val != 0) + { + *bptr++ = val % BASE; + val = val / BASE; + ix++; /* Count the digits. */ + } + + /* Make the number. */ + bc_free_num (num); + *num = bc_new_num (ix, 0); + if (neg) (*num)->n_sign = MINUS; + + /* Assign the digits. */ + vptr = (*num)->n_value; + while (ix-- > 0) + *vptr++ = *--bptr; +} + diff --git a/src/cpp/ext/bcmath/nearzero.c b/src/cpp/ext/bcmath/nearzero.c new file mode 100644 index 0000000000000..9719d1cad7736 --- /dev/null +++ b/src/cpp/ext/bcmath/nearzero.c @@ -0,0 +1,69 @@ +/* nearzero.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* In some places we need to check if the number NUM is almost zero. + Specifically, all but the last digit is 0 and the last digit is 1. + Last digit is defined by scale. */ + +char +bc_is_near_zero (num, scale) + bc_num num; + int scale; +{ + int count; + char *nptr; + + /* Error checking */ + if (scale > num->n_scale) + scale = num->n_scale; + + /* Initialize */ + count = num->n_len + scale; + nptr = num->n_value; + + /* The check */ + while ((count > 0) && (*nptr++ == 0)) count--; + + if (count != 0 && (count != 1 || *--nptr != 1)) + return FALSE; + else + return TRUE; +} + diff --git a/src/cpp/ext/bcmath/neg.c b/src/cpp/ext/bcmath/neg.c new file mode 100644 index 0000000000000..61c2cf2563a0a --- /dev/null +++ b/src/cpp/ext/bcmath/neg.c @@ -0,0 +1,49 @@ +/* neg.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* In some places we need to check if the number is negative. */ + +char +bc_is_neg (num) + bc_num num; +{ + return num->n_sign == MINUS; +} + diff --git a/src/cpp/ext/bcmath/num2long.c b/src/cpp/ext/bcmath/num2long.c new file mode 100644 index 0000000000000..32de7e56649f7 --- /dev/null +++ b/src/cpp/ext/bcmath/num2long.c @@ -0,0 +1,70 @@ +/* num2long.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* Convert a number NUM to a long. The function returns only the integer + part of the number. For numbers that are too large to represent as + a long, this function returns a zero. This can be detected by checking + the NUM for zero after having a zero returned. */ + +long +bc_num2long (num) + bc_num num; +{ + long val; + char *nptr; + int index; + + /* Extract the int value, ignore the fraction. */ + val = 0; + nptr = num->n_value; + for (index=num->n_len; (index>0) && (val<=(LONG_MAX/BASE)); index--) + val = val*BASE + *nptr++; + + /* Check for overflow. If overflow, return zero. */ + if (index>0) val = 0; + if (val < 0) val = 0; + + /* Return the value. */ + if (num->n_sign == PLUS) + return (val); + else + return (-val); +} + diff --git a/src/cpp/ext/bcmath/num2str.c b/src/cpp/ext/bcmath/num2str.c new file mode 100644 index 0000000000000..61bee8c0f1141 --- /dev/null +++ b/src/cpp/ext/bcmath/num2str.c @@ -0,0 +1,79 @@ +/* num2str.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* Convert a numbers to a string. Base 10 only.*/ + +char +*bc_num2str (num) + bc_num num; +{ + char *str, *sptr; + char *nptr; + int index, signch; + + /* Allocate the string memory. */ + signch = ( num->n_sign == PLUS ? 0 : 1 ); /* Number of sign chars. */ + if (num->n_scale > 0) + str = (char *)malloc(num->n_len + num->n_scale + 2 + signch); + else + str = (char *)malloc(num->n_len + 1 + signch); + if (str == NULL) bc_out_of_memory(); + + /* The negative sign if needed. */ + sptr = str; + if (signch) *sptr++ = '-'; + + /* Load the whole number. */ + nptr = num->n_value; + for (index=num->n_len; index>0; index--) + *sptr++ = BCD_CHAR(*nptr++); + + /* Now the fraction. */ + if (num->n_scale > 0) + { + *sptr++ = '.'; + for (index=0; indexn_scale; index++) + *sptr++ = BCD_CHAR(*nptr++); + } + + /* Terminate the string and return it! */ + *sptr = '\0'; + return (str); +} diff --git a/src/cpp/ext/bcmath/outofmem.c b/src/cpp/ext/bcmath/outofmem.c new file mode 100644 index 0000000000000..3ff2cb26f61cf --- /dev/null +++ b/src/cpp/ext/bcmath/outofmem.c @@ -0,0 +1,46 @@ +/* outofmem.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +void bc_out_of_memory (void) +{ + (void) fprintf (stderr, "bcmath: out of memory!\n"); + exit (1); +} diff --git a/src/cpp/ext/bcmath/output.c b/src/cpp/ext/bcmath/output.c new file mode 100644 index 0000000000000..63dbf8c516e6b --- /dev/null +++ b/src/cpp/ext/bcmath/output.c @@ -0,0 +1,208 @@ +/* output.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +/* The following routines provide output for bcd numbers package + using the rules of POSIX bc for output. */ + +/* This structure is used for saving digits in the conversion process. */ +typedef struct stk_rec { + long digit; + struct stk_rec *next; +} stk_rec; + +/* The reference string for digits. */ +static char ref_str[] = "0123456789ABCDEF"; + + +/* A special output routine for "multi-character digits." Exactly + SIZE characters must be output for the value VAL. If SPACE is + non-zero, we must output one space before the number. OUT_CHAR + is the actual routine for writing the characters. */ + +void +bc_out_long (val, size, space, out_char) + long val; + int size, space; +#ifdef __STDC__ + void (*out_char)(int); +#else + void (*out_char)(); +#endif +{ + char digits[40]; + int len, ix; + + if (space) (*out_char) (' '); + snprintf(digits, sizeof(digits), "%ld", val); + len = strlen (digits); + while (size > len) + { + (*out_char) ('0'); + size--; + } + for (ix=0; ix < len; ix++) + (*out_char) (digits[ix]); +} + +/* Output of a bcd number. NUM is written in base O_BASE using OUT_CHAR + as the routine to do the actual output of the characters. */ + +void +#ifdef __STDC__ +bc_out_num (bc_num num, int o_base, void (*out_char)(int), int leading_zero TSRMLS_DC) +#else +bc_out_num (bc_num num, int o_base, void (*out_char)(), int leading_zero TSRMLS_DC) +#endif +{ + char *nptr; + int index, fdigit, pre_space; + stk_rec *digits, *temp; + bc_num int_part, frac_part, base, cur_dig, t_num, max_o_digit; + + /* The negative sign if needed. */ + if (num->n_sign == MINUS) (*out_char) ('-'); + + /* Output the number. */ + if (bc_is_zero (num TSRMLS_CC)) + (*out_char) ('0'); + else + if (o_base == 10) + { + /* The number is in base 10, do it the fast way. */ + nptr = num->n_value; + if (num->n_len > 1 || *nptr != 0) + for (index=num->n_len; index>0; index--) + (*out_char) (BCD_CHAR(*nptr++)); + else + nptr++; + + if (leading_zero && bc_is_zero (num TSRMLS_CC)) + (*out_char) ('0'); + + /* Now the fraction. */ + if (num->n_scale > 0) + { + (*out_char) ('.'); + for (index=0; indexn_scale; index++) + (*out_char) (BCD_CHAR(*nptr++)); + } + } + else + { + /* special case ... */ + if (leading_zero && bc_is_zero (num TSRMLS_CC)) + (*out_char) ('0'); + + /* The number is some other base. */ + digits = NULL; + bc_init_num (&int_part TSRMLS_CC); + bc_divide (num, BCG(_one_), &int_part, 0 TSRMLS_CC); + bc_init_num (&frac_part TSRMLS_CC); + bc_init_num (&cur_dig TSRMLS_CC); + bc_init_num (&base TSRMLS_CC); + bc_sub (num, int_part, &frac_part, 0); + /* Make the INT_PART and FRAC_PART positive. */ + int_part->n_sign = PLUS; + frac_part->n_sign = PLUS; + bc_int2num (&base, o_base); + bc_init_num (&max_o_digit TSRMLS_CC); + bc_int2num (&max_o_digit, o_base-1); + + + /* Get the digits of the integer part and push them on a stack. */ + while (!bc_is_zero (int_part TSRMLS_CC)) + { + bc_modulo (int_part, base, &cur_dig, 0 TSRMLS_CC); + /* PHP Change: malloc() -> emalloc() */ + temp = (stk_rec *)malloc (sizeof(stk_rec)); + if (temp == NULL) bc_out_of_memory(); + temp->digit = bc_num2long (cur_dig); + temp->next = digits; + digits = temp; + bc_divide (int_part, base, &int_part, 0 TSRMLS_CC); + } + + /* Print the digits on the stack. */ + if (digits != NULL) + { + /* Output the digits. */ + while (digits != NULL) + { + temp = digits; + digits = digits->next; + if (o_base <= 16) + (*out_char) (ref_str[ (int) temp->digit]); + else + bc_out_long (temp->digit, max_o_digit->n_len, 1, out_char); + free (temp); + } + } + + /* Get and print the digits of the fraction part. */ + if (num->n_scale > 0) + { + (*out_char) ('.'); + pre_space = 0; + t_num = bc_copy_num (BCG(_one_)); + while (t_num->n_len <= num->n_scale) { + bc_multiply (frac_part, base, &frac_part, num->n_scale TSRMLS_CC); + fdigit = bc_num2long (frac_part); + bc_int2num (&int_part, fdigit); + bc_sub (frac_part, int_part, &frac_part, 0); + if (o_base <= 16) + (*out_char) (ref_str[fdigit]); + else { + bc_out_long (fdigit, max_o_digit->n_len, pre_space, out_char); + pre_space = 1; + } + bc_multiply (t_num, base, &t_num, 0 TSRMLS_CC); + } + bc_free_num (&t_num); + } + + /* Clean up. */ + bc_free_num (&int_part); + bc_free_num (&frac_part); + bc_free_num (&base); + bc_free_num (&cur_dig); + bc_free_num (&max_o_digit); + } +} diff --git a/src/cpp/ext/bcmath/private.h b/src/cpp/ext/bcmath/private.h new file mode 100644 index 0000000000000..f8f1048ab7831 --- /dev/null +++ b/src/cpp/ext/bcmath/private.h @@ -0,0 +1,43 @@ +/* private.h: bcmath library header. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +/* "Private" routines to bcmath. */ + +/* variables */ +#if SANDER_0 +extern bc_num _bc_Free_list; +#endif + +/* routines */ +int _bc_do_compare (bc_num n1, bc_num n2, int use_sign, int ignore_last); +bc_num _bc_do_add (bc_num n1, bc_num n2, int scale_min); +bc_num _bc_do_sub (bc_num n1, bc_num n2, int scale_min); +void _bc_rm_leading_zeros (bc_num num); diff --git a/src/cpp/ext/bcmath/raise.c b/src/cpp/ext/bcmath/raise.c new file mode 100644 index 0000000000000..714b70c87da13 --- /dev/null +++ b/src/cpp/ext/bcmath/raise.c @@ -0,0 +1,124 @@ +/* raise.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +/* Raise NUM1 to the NUM2 power. The result is placed in RESULT. + Maximum exponent is LONG_MAX. If a NUM2 is not an integer, + only the integer part is used. */ + +void +bc_raise (bc_num num1, bc_num num2, bc_num *result, int scale TSRMLS_DC) +{ + bc_num temp, power; + long exponent; + int rscale; + int pwrscale; + int calcscale; + char neg; + + /* Check the exponent for scale digits and convert to a long. */ + if (num2->n_scale != 0) + bc_rt_warn ("non-zero scale in exponent"); + exponent = bc_num2long (num2); + if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0)) + bc_rt_error ("exponent too large in raise"); + + /* Special case if exponent is a zero. */ + if (exponent == 0) + { + bc_free_num (result); + *result = bc_copy_num (BCG(_one_)); + return; + } + + /* Other initializations. */ + if (exponent < 0) + { + neg = TRUE; + exponent = -exponent; + rscale = scale; + } + else + { + neg = FALSE; + rscale = MIN (num1->n_scale*exponent, MAX(scale, num1->n_scale)); + } + + /* Set initial value of temp. */ + power = bc_copy_num (num1); + pwrscale = num1->n_scale; + while ((exponent & 1) == 0) + { + pwrscale = 2*pwrscale; + bc_multiply (power, power, &power, pwrscale TSRMLS_CC); + exponent = exponent >> 1; + } + temp = bc_copy_num (power); + calcscale = pwrscale; + exponent = exponent >> 1; + + /* Do the calculation. */ + while (exponent > 0) + { + pwrscale = 2*pwrscale; + bc_multiply (power, power, &power, pwrscale TSRMLS_CC); + if ((exponent & 1) == 1) { + calcscale = pwrscale + calcscale; + bc_multiply (temp, power, &temp, calcscale TSRMLS_CC); + } + exponent = exponent >> 1; + } + + /* Assign the value. */ + if (neg) + { + bc_divide (BCG(_one_), temp, result, rscale TSRMLS_CC); + bc_free_num (&temp); + } + else + { + bc_free_num (result); + *result = temp; + if ((*result)->n_scale > rscale) + (*result)->n_scale = rscale; + } + bc_free_num (&power); +} + diff --git a/src/cpp/ext/bcmath/raisemod.c b/src/cpp/ext/bcmath/raisemod.c new file mode 100644 index 0000000000000..3415f9fe6d545 --- /dev/null +++ b/src/cpp/ext/bcmath/raisemod.c @@ -0,0 +1,98 @@ +/* raisemod.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* Raise BASE to the EXPO power, reduced modulo MOD. The result is + placed in RESULT. If a EXPO is not an integer, + only the integer part is used. */ + +int +bc_raisemod (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale TSRMLS_DC) +{ + bc_num power, exponent, parity, temp; + int rscale; + + /* Check for correct numbers. */ + if (bc_is_zero(mod TSRMLS_CC)) return -1; + if (bc_is_neg(expo)) return -1; + + /* Set initial values. */ + power = bc_copy_num (base); + exponent = bc_copy_num (expo); + temp = bc_copy_num (BCG(_one_)); + bc_init_num(&parity TSRMLS_CC); + + /* Check the base for scale digits. */ + if (base->n_scale != 0) + bc_rt_warn ("non-zero scale in base"); + + /* Check the exponent for scale digits. */ + if (exponent->n_scale != 0) + { + bc_rt_warn ("non-zero scale in exponent"); + bc_divide (exponent, BCG(_one_), &exponent, 0 TSRMLS_CC); /*truncate */ + } + + /* Check the modulus for scale digits. */ + if (mod->n_scale != 0) + bc_rt_warn ("non-zero scale in modulus"); + + /* Do the calculation. */ + rscale = MAX(scale, base->n_scale); + while ( !bc_is_zero(exponent TSRMLS_CC) ) + { + (void) bc_divmod (exponent, BCG(_two_), &exponent, &parity, 0 TSRMLS_CC); + if ( !bc_is_zero(parity TSRMLS_CC) ) + { + bc_multiply (temp, power, &temp, rscale TSRMLS_CC); + (void) bc_modulo (temp, mod, &temp, scale TSRMLS_CC); + } + + bc_multiply (power, power, &power, rscale TSRMLS_CC); + (void) bc_modulo (power, mod, &power, scale TSRMLS_CC); + } + + /* Assign the value. */ + bc_free_num (&power); + bc_free_num (&exponent); + bc_free_num (result); + bc_free_num (&parity); + *result = temp; + return 0; /* Everything is OK. */ +} diff --git a/src/cpp/ext/bcmath/recmul.c b/src/cpp/ext/bcmath/recmul.c new file mode 100644 index 0000000000000..868e78c1dae2b --- /dev/null +++ b/src/cpp/ext/bcmath/recmul.c @@ -0,0 +1,306 @@ +/* recmul.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* Recursive vs non-recursive multiply crossover ranges. */ +#if defined(MULDIGITS) +#include "muldigits.h" +#else +#define MUL_BASE_DIGITS 80 +#endif + +int mul_base_digits = MUL_BASE_DIGITS; +#define MUL_SMALL_DIGITS mul_base_digits/4 + +/* Multiply utility routines */ + +static bc_num +new_sub_num (length, scale, value) + int length, scale; + char *value; +{ + bc_num temp; + +#ifdef SANDER_0 + if (_bc_Free_list != NULL) { + temp = _bc_Free_list; + _bc_Free_list = temp->n_next; + } else { +#endif + temp = (bc_num)malloc (sizeof(bc_struct)); +#ifdef SANDER_0 + if (temp == NULL) bc_out_of_memory (); + } +#endif + temp->n_sign = PLUS; + temp->n_len = length; + temp->n_scale = scale; + temp->n_refs = 1; + temp->n_ptr = NULL; + temp->n_value = value; + return temp; +} + +static void +_bc_simp_mul (bc_num n1, int n1len, bc_num n2, int n2len, bc_num *prod, + int full_scale) +{ + char *n1ptr, *n2ptr, *pvptr; + char *n1end, *n2end; /* To the end of n1 and n2. */ + int indx, sum, prodlen; + + prodlen = n1len+n2len+1; + + *prod = bc_new_num (prodlen, 0); + + n1end = (char *) (n1->n_value + n1len - 1); + n2end = (char *) (n2->n_value + n2len - 1); + pvptr = (char *) ((*prod)->n_value + prodlen - 1); + sum = 0; + + /* Here is the loop... */ + for (indx = 0; indx < prodlen-1; indx++) + { + n1ptr = (char *) (n1end - MAX(0, indx-n2len+1)); + n2ptr = (char *) (n2end - MIN(indx, n2len-1)); + while ((n1ptr >= n1->n_value) && (n2ptr <= n2end)) + sum += *n1ptr-- * *n2ptr++; + *pvptr-- = sum % BASE; + sum = sum / BASE; + } + *pvptr = sum; +} + + +/* A special adder/subtractor for the recursive divide and conquer + multiply algorithm. Note: if sub is called, accum must + be larger that what is being subtracted. Also, accum and val + must have n_scale = 0. (e.g. they must look like integers. *) */ +static void +_bc_shift_addsub (bc_num accum, bc_num val, int shift, int sub) +{ + signed char *accp, *valp; + int count, carry; + + count = val->n_len; + if (val->n_value[0] == 0) + count--; + assert (accum->n_len+accum->n_scale >= shift+count); + + /* Set up pointers and others */ + accp = (signed char *)(accum->n_value + + accum->n_len + accum->n_scale - shift - 1); + valp = (signed char *)(val->n_value + val->n_len - 1); + carry = 0; + + if (sub) { + /* Subtraction, carry is really borrow. */ + while (count--) { + *accp -= *valp-- + carry; + if (*accp < 0) { + carry = 1; + *accp-- += BASE; + } else { + carry = 0; + accp--; + } + } + while (carry) { + *accp -= carry; + if (*accp < 0) + *accp-- += BASE; + else + carry = 0; + } + } else { + /* Addition */ + while (count--) { + *accp += *valp-- + carry; + if (*accp > (BASE-1)) { + carry = 1; + *accp-- -= BASE; + } else { + carry = 0; + accp--; + } + } + while (carry) { + *accp += carry; + if (*accp > (BASE-1)) + *accp-- -= BASE; + else + carry = 0; + } + } +} + +/* Recursive divide and conquer multiply algorithm. + Based on + Let u = u0 + u1*(b^n) + Let v = v0 + v1*(b^n) + Then uv = (B^2n+B^n)*u1*v1 + B^n*(u1-u0)*(v0-v1) + (B^n+1)*u0*v0 + + B is the base of storage, number of digits in u1,u0 close to equal. +*/ +static void +_bc_rec_mul (bc_num u, int ulen, bc_num v, int vlen, bc_num *prod, + int full_scale TSRMLS_DC) +{ + bc_num u0, u1, v0, v1; + int u0len, v0len; + bc_num m1, m2, m3, d1, d2; + int n, prodlen, m1zero; + int d1len, d2len; + + /* Base case? */ + if ((ulen+vlen) < mul_base_digits + || ulen < MUL_SMALL_DIGITS + || vlen < MUL_SMALL_DIGITS ) { + _bc_simp_mul (u, ulen, v, vlen, prod, full_scale); + return; + } + + /* Calculate n -- the u and v split point in digits. */ + n = (MAX(ulen, vlen)+1) / 2; + + /* Split u and v. */ + if (ulen < n) { + u1 = bc_copy_num (BCG(_zero_)); + u0 = new_sub_num (ulen,0, u->n_value); + } else { + u1 = new_sub_num (ulen-n, 0, u->n_value); + u0 = new_sub_num (n, 0, u->n_value+ulen-n); + } + if (vlen < n) { + v1 = bc_copy_num (BCG(_zero_)); + v0 = new_sub_num (vlen,0, v->n_value); + } else { + v1 = new_sub_num (vlen-n, 0, v->n_value); + v0 = new_sub_num (n, 0, v->n_value+vlen-n); + } + _bc_rm_leading_zeros (u1); + _bc_rm_leading_zeros (u0); + u0len = u0->n_len; + _bc_rm_leading_zeros (v1); + _bc_rm_leading_zeros (v0); + v0len = v0->n_len; + + m1zero = bc_is_zero(u1 TSRMLS_CC) || bc_is_zero(v1 TSRMLS_CC); + + /* Calculate sub results ... */ + + bc_init_num(&d1 TSRMLS_CC); + bc_init_num(&d2 TSRMLS_CC); + bc_sub (u1, u0, &d1, 0); + d1len = d1->n_len; + bc_sub (v0, v1, &d2, 0); + d2len = d2->n_len; + + + /* Do recursive multiplies and shifted adds. */ + if (m1zero) + m1 = bc_copy_num (BCG(_zero_)); + else + _bc_rec_mul (u1, u1->n_len, v1, v1->n_len, &m1, 0 TSRMLS_CC); + + if (bc_is_zero(d1 TSRMLS_CC) || bc_is_zero(d2 TSRMLS_CC)) + m2 = bc_copy_num (BCG(_zero_)); + else + _bc_rec_mul (d1, d1len, d2, d2len, &m2, 0 TSRMLS_CC); + + if (bc_is_zero(u0 TSRMLS_CC) || bc_is_zero(v0 TSRMLS_CC)) + m3 = bc_copy_num (BCG(_zero_)); + else + _bc_rec_mul (u0, u0->n_len, v0, v0->n_len, &m3, 0 TSRMLS_CC); + + /* Initialize product */ + prodlen = ulen+vlen+1; + *prod = bc_new_num(prodlen, 0); + + if (!m1zero) { + _bc_shift_addsub (*prod, m1, 2*n, 0); + _bc_shift_addsub (*prod, m1, n, 0); + } + _bc_shift_addsub (*prod, m3, n, 0); + _bc_shift_addsub (*prod, m3, 0, 0); + _bc_shift_addsub (*prod, m2, n, d1->n_sign != d2->n_sign); + + /* Now clean up! */ + bc_free_num (&u1); + bc_free_num (&u0); + bc_free_num (&v1); + bc_free_num (&m1); + bc_free_num (&v0); + bc_free_num (&m2); + bc_free_num (&m3); + bc_free_num (&d1); + bc_free_num (&d2); +} + +/* The multiply routine. N2 times N1 is put int PROD with the scale of + the result being MIN(N2 scale+N1 scale, MAX (SCALE, N2 scale, N1 scale)). + */ + +void +bc_multiply (bc_num n1, bc_num n2, bc_num *prod, int scale TSRMLS_DC) +{ + bc_num pval; + int len1, len2; + int full_scale, prod_scale; + + /* Initialize things. */ + len1 = n1->n_len + n1->n_scale; + len2 = n2->n_len + n2->n_scale; + full_scale = n1->n_scale + n2->n_scale; + prod_scale = MIN(full_scale,MAX(scale,MAX(n1->n_scale,n2->n_scale))); + + /* Do the multiply */ + _bc_rec_mul (n1, len1, n2, len2, &pval, full_scale TSRMLS_CC); + + /* Assign to prod and clean up the number. */ + pval->n_sign = ( n1->n_sign == n2->n_sign ? PLUS : MINUS ); + pval->n_value = pval->n_ptr; + pval->n_len = len2 + len1 + 1 - full_scale; + pval->n_scale = prod_scale; + _bc_rm_leading_zeros (pval); + if (bc_is_zero (pval TSRMLS_CC)) + pval->n_sign = PLUS; + bc_free_num (prod); + *prod = pval; +} diff --git a/src/cpp/ext/bcmath/rmzero.c b/src/cpp/ext/bcmath/rmzero.c new file mode 100644 index 0000000000000..99747e20ceb88 --- /dev/null +++ b/src/cpp/ext/bcmath/rmzero.c @@ -0,0 +1,55 @@ +/* rmzero.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* For many things, we may have leading zeros in a number NUM. + _bc_rm_leading_zeros just moves the data "value" pointer to the + correct place and adjusts the length. */ + + void +_bc_rm_leading_zeros (num) + bc_num num; +{ + /* We can move n_value to point to the first non zero digit! */ + while (*num->n_value == 0 && num->n_len > 1) { + num->n_value++; + num->n_len--; + } +} + diff --git a/src/cpp/ext/bcmath/rt.c b/src/cpp/ext/bcmath/rt.c new file mode 100644 index 0000000000000..d290a01eac123 --- /dev/null +++ b/src/cpp/ext/bcmath/rt.c @@ -0,0 +1,65 @@ +/* rt.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +void bc_rt_warn (char *mesg ,...) +{ + va_list args; + char error_mesg [255]; + + va_start (args, mesg); + vsnprintf (error_mesg, sizeof(error_mesg), mesg, args); + va_end (args); + + fprintf (stderr, "bc math warning: %s\n", error_mesg); +} + + +void bc_rt_error (char *mesg ,...) +{ + va_list args; + char error_mesg [255]; + + va_start (args, mesg); + vsnprintf (error_mesg, sizeof(error_mesg), mesg, args); + va_end (args); + + fprintf (stderr, "bc math error: %s\n", error_mesg); +} diff --git a/src/cpp/ext/bcmath/sqrt.c b/src/cpp/ext/bcmath/sqrt.c new file mode 100644 index 0000000000000..127df10064474 --- /dev/null +++ b/src/cpp/ext/bcmath/sqrt.c @@ -0,0 +1,129 @@ +/* sqrt.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* Take the square root NUM and return it in NUM with SCALE digits + after the decimal place. */ + +int +bc_sqrt (bc_num *num, int scale TSRMLS_DC) +{ + int rscale, cmp_res, done; + int cscale; + bc_num guess, guess1, point5, diff; + + /* Initial checks. */ + cmp_res = bc_compare (*num, BCG(_zero_)); + if (cmp_res < 0) + return 0; /* error */ + else + { + if (cmp_res == 0) + { + bc_free_num (num); + *num = bc_copy_num (BCG(_zero_)); + return 1; + } + } + cmp_res = bc_compare (*num, BCG(_one_)); + if (cmp_res == 0) + { + bc_free_num (num); + *num = bc_copy_num (BCG(_one_)); + return 1; + } + + /* Initialize the variables. */ + rscale = MAX (scale, (*num)->n_scale); + bc_init_num(&guess TSRMLS_CC); + bc_init_num(&guess1 TSRMLS_CC); + bc_init_num(&diff TSRMLS_CC); + point5 = bc_new_num (1,1); + point5->n_value[1] = 5; + + + /* Calculate the initial guess. */ + if (cmp_res < 0) + { + /* The number is between 0 and 1. Guess should start at 1. */ + guess = bc_copy_num (BCG(_one_)); + cscale = (*num)->n_scale; + } + else + { + /* The number is greater than 1. Guess should start at 10^(exp/2). */ + bc_int2num (&guess,10); + + bc_int2num (&guess1,(*num)->n_len); + bc_multiply (guess1, point5, &guess1, 0 TSRMLS_CC); + guess1->n_scale = 0; + bc_raise (guess, guess1, &guess, 0 TSRMLS_CC); + bc_free_num (&guess1); + cscale = 3; + } + + /* Find the square root using Newton's algorithm. */ + done = FALSE; + while (!done) + { + bc_free_num (&guess1); + guess1 = bc_copy_num (guess); + bc_divide (*num, guess, &guess, cscale TSRMLS_CC); + bc_add (guess, guess1, &guess, 0); + bc_multiply (guess, point5, &guess, cscale TSRMLS_CC); + bc_sub (guess, guess1, &diff, cscale+1); + if (bc_is_near_zero (diff, cscale)) + { + if (cscale < rscale+1) + cscale = MIN (cscale*3, rscale+1); + else + done = TRUE; + } + } + + /* Assign the number and clean up. */ + bc_free_num (num); + bc_divide (guess,BCG(_one_),num,rscale TSRMLS_CC); + bc_free_num (&guess); + bc_free_num (&guess1); + bc_free_num (&point5); + bc_free_num (&diff); + return 1; +} + diff --git a/src/cpp/ext/bcmath/str2num.c b/src/cpp/ext/bcmath/str2num.c new file mode 100644 index 0000000000000..21e1f9cd3942e --- /dev/null +++ b/src/cpp/ext/bcmath/str2num.c @@ -0,0 +1,109 @@ +/* str2num.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* Convert strings to bc numbers. Base 10 only.*/ + +void +bc_str2num (bc_num *num, char *str, int scale TSRMLS_DC) +{ + int digits, strscale; + char *ptr, *nptr; + char zero_int; + + /* Prepare num. */ + bc_free_num (num); + + /* Check for valid number and count digits. */ + ptr = str; + digits = 0; + strscale = 0; + zero_int = FALSE; + if ( (*ptr == '+') || (*ptr == '-')) ptr++; /* Sign */ + while (*ptr == '0') ptr++; /* Skip leading zeros. */ + while (isdigit((int)*ptr)) ptr++, digits++; /* digits */ + if (*ptr == '.') ptr++; /* decimal point */ + while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */ + if ((*ptr != '\0') || (digits+strscale == 0)) + { + *num = bc_copy_num (BCG(_zero_)); + return; + } + + /* Adjust numbers and allocate storage and initialize fields. */ + strscale = MIN(strscale, scale); + if (digits == 0) + { + zero_int = TRUE; + digits = 1; + } + *num = bc_new_num (digits, strscale); + + /* Build the whole number. */ + ptr = str; + if (*ptr == '-') + { + (*num)->n_sign = MINUS; + ptr++; + } + else + { + (*num)->n_sign = PLUS; + if (*ptr == '+') ptr++; + } + while (*ptr == '0') ptr++; /* Skip leading zeros. */ + nptr = (*num)->n_value; + if (zero_int) + { + *nptr++ = 0; + digits = 0; + } + for (;digits > 0; digits--) + *nptr++ = CH_VAL(*ptr++); + + + /* Build the fractional part. */ + if (strscale > 0) + { + ptr++; /* skip the decimal point! */ + for (;strscale > 0; strscale--) + *nptr++ = CH_VAL(*ptr++); + } +} + diff --git a/src/cpp/ext/bcmath/sub.c b/src/cpp/ext/bcmath/sub.c new file mode 100644 index 0000000000000..5ef6008359999 --- /dev/null +++ b/src/cpp/ext/bcmath/sub.c @@ -0,0 +1,90 @@ +/* sub.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + + +/* Here is the full subtract routine that takes care of negative numbers. + N2 is subtracted from N1 and the result placed in RESULT. SCALE_MIN + is the minimum scale for the result. */ + +void +bc_sub (n1, n2, result, scale_min) + bc_num n1, n2, *result; + int scale_min; +{ + bc_num diff = NULL; + int cmp_res; + int res_scale; + + if (n1->n_sign != n2->n_sign) + { + diff = _bc_do_add (n1, n2, scale_min); + diff->n_sign = n1->n_sign; + } + else + { + /* subtraction must be done. */ + /* Compare magnitudes. */ + cmp_res = _bc_do_compare (n1, n2, FALSE, FALSE); + switch (cmp_res) + { + case -1: + /* n1 is less than n2, subtract n1 from n2. */ + diff = _bc_do_sub (n2, n1, scale_min); + diff->n_sign = (n2->n_sign == PLUS ? MINUS : PLUS); + break; + case 0: + /* They are equal! return zero! */ + res_scale = MAX (scale_min, MAX(n1->n_scale, n2->n_scale)); + diff = bc_new_num (1, res_scale); + memset (diff->n_value, 0, res_scale+1); + break; + case 1: + /* n2 is less than n1, subtract n2 from n1. */ + diff = _bc_do_sub (n1, n2, scale_min); + diff->n_sign = n1->n_sign; + break; + } + } + + /* Clean up and return. */ + bc_free_num (result); + *result = diff; +} + diff --git a/src/cpp/ext/bcmath/zero.c b/src/cpp/ext/bcmath/zero.c new file mode 100644 index 0000000000000..15ff692cbab07 --- /dev/null +++ b/src/cpp/ext/bcmath/zero.c @@ -0,0 +1,64 @@ +/* zero.c: bcmath library file. */ +/* + Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 2000 Philip A. Nelson + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. (COPYING.LIB) + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to: + + The Free Software Foundation, Inc. + 59 Temple Place, Suite 330 + Boston, MA 02111-1307 USA. + + You may contact the author by: + e-mail: philnelson@acm.org + us-mail: Philip A. Nelson + Computer Science Department, 9062 + Western Washington University + Bellingham, WA 98226-9062 + +*************************************************************************/ + +#include "config.h" +#include +#include +#include +#include +#include +#include "bcmath.h" +#include "private.h" + +/* In some places we need to check if the number NUM is zero. */ + +char +bc_is_zero (bc_num num TSRMLS_DC) +{ + int count; + char *nptr; + + /* Quick check. */ + if (num == BCG(_zero_)) return TRUE; + + /* Initialize */ + count = num->n_len + num->n_scale; + nptr = num->n_value; + + /* The check */ + while ((count > 0) && (*nptr++ == 0)) count--; + + if (count != 0) + return FALSE; + else + return TRUE; +} + diff --git a/src/cpp/ext/crutch.cpp b/src/cpp/ext/crutch.cpp new file mode 100644 index 0000000000000..2aa8c2ceb9f1a --- /dev/null +++ b/src/cpp/ext/crutch.cpp @@ -0,0 +1,132 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// OpaqueObject + +Object OpaqueObject::GetObject(int index) { + if (index) { + return Object(new OpaqueObject(index)); + } + return Object(); +} + +int OpaqueObject::GetIndex(Object obj) { + OpaqueObject *oo = dynamic_cast(obj.get()); + return oo ? oo->m_index : 0; +} + +OpaqueObject::OpaqueObject(int index) : m_index(index) { +} + +/////////////////////////////////////////////////////////////////////////////// +// statics + +bool Crutch::Enabled = false; +Mutex Crutch::s_mutex; +Crutch Crutch::s_singleton; + +Array Crutch::Invoke(String func, Array schema, Array params) { + Lock lock(s_mutex); + if (!Enabled) { + throw NotImplementedException(func); + } + return s_singleton.invoke(func, schema, params); +} + +/////////////////////////////////////////////////////////////////////////////// +// construction and destruction + +Crutch::Crutch() : m_php(0) { +} + +Crutch::~Crutch() { + terminate(); +} + +void Crutch::init() { + char filename[64]; + strcpy(filename, "/tmp/hphp_crutch_XXXXXX"); + int fd = mkstemp(filename); + if (!fd) { + throw FatalErrorException("unable to create a temporary file for crutch"); + } + close(fd); + + m_queue = f_msg_get_queue(f_ftok(filename, "a")); + if (m_queue.get() == NULL) { + throw FatalErrorException("unable to create a message queue for crutch"); + } + + int pid = fork(); + if (pid == 0) { + const char *argv[] = {"/usr/local/bin/hphp/crutch.php", filename, NULL}; + execvp(argv[0], const_cast(argv)); + _exit(-1); // something wrong + } + + m_php = pid; + Variant type, ret; + if (!f_msg_receive(m_queue, 2, ref(type), MSG_MAX_SIZE, ref(ret)) || + !same(ret, "CRUTCH")) { + terminate(); + throw FatalErrorException("unable to hear startup signal from crutch"); + } +} + +void Crutch::terminate() { + if (m_queue.get()) { + f_msg_remove_queue(m_queue); + m_queue.reset(); + } + if (m_php) { + kill(m_php, SIGKILL); // not needed normally but be safe + int status = -1; + wait(&status); + m_php = 0; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// RMI + +Array Crutch::invoke(String func, Array schema, Array params) { + if (!m_php) init(); + + Array message = CREATE_VECTOR4(func, schema, params.size(), params); + if (!f_msg_send(m_queue, 1, message)) { + terminate(); + throw SystemCallFailure("f_msg_send"); + } + + Variant type, ret; + if (!f_msg_receive(m_queue, 2, ref(type), MSG_MAX_SIZE, ref(ret))) { + terminate(); + throw SystemCallFailure("f_msg_receive"); + } + + return ret.toArray(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/crutch.h b/src/cpp/ext/crutch.h new file mode 100644 index 0000000000000..d6422bb83b603 --- /dev/null +++ b/src/cpp/ext/crutch.h @@ -0,0 +1,64 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CRUTCH_H__ +#define __CRUTCH_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class Crutch { + public: + static bool Enabled; + static Array Invoke(String func, Array schema, Array params); + + private: + static const int MSG_MAX_SIZE = 10 * 1024 * 1024; + static Crutch s_singleton; + static Mutex s_mutex; + + pid_t m_php; + Object m_queue; + + Crutch(); + ~Crutch(); + void init(); + void terminate(); + Array invoke(String func, Array schema, Array params); +}; + +class OpaqueObject : public ResourceData { + public: + static Object GetObject(int index); + static int GetIndex(Object obj); + + // overriding ResourceData + const char *o_getClassName() const { return "OpaqueObject";} + + private: + OpaqueObject(int index); + int m_index; // array index of $Objects in crutch.php +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __CRUTCH_H__ diff --git a/src/cpp/ext/ext.h b/src/cpp/ext/ext.h new file mode 100644 index 0000000000000..e6154bdc192a1 --- /dev/null +++ b/src/cpp/ext/ext.h @@ -0,0 +1,74 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +/* Generated by idl_list.php. Do NOT modify. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/cpp/ext/ext_apache.cpp b/src/cpp/ext/ext_apache.cpp new file mode 100644 index 0000000000000..d8c28d0fc65dc --- /dev/null +++ b/src/cpp/ext/ext_apache.cpp @@ -0,0 +1,113 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_apache_child_terminate() { + throw NotSupportedException(__func__, "apache is not in use"); +} + +Array f_apache_get_modules() { + throw NotSupportedException(__func__, "apache is not in use"); +} + +String f_apache_get_version() { + throw NotSupportedException(__func__, "apache is not in use"); +} + +String f_apache_getenv(CStrRef variable, bool walk_to_top /* = false */) { + throw NotSupportedException(__func__, "apache is not in use"); +} + +Object f_apache_lookup_uri(CStrRef filename) { + throw NotSupportedException(__func__, "apache is not in use"); +} + +Variant f_apache_note(CStrRef note_name, + CStrRef note_value /* = null_string */) { + String prev = ServerNote::Get(note_name); + if (!note_value.isNull()) { + ServerNote::Add(note_name, note_value); + } + if (!prev.isNull()) { + return prev; + } + return false; +} + +Array f_apache_request_headers() { + throw NotSupportedException(__func__, "apache is not in use"); +} + +bool f_apache_reset_timeout() { + throw NotSupportedException(__func__, "apache is not in use"); +} + +Array f_apache_response_headers() { + throw NotSupportedException(__func__, "apache is not in use"); +} + +bool f_apache_setenv(CStrRef variable, CStrRef value, + bool walk_to_top /* = false */) { + return false; +} + +int f_ascii2ebcdic(CStrRef ascii_str) { + throw NotSupportedException(__func__, "apache is not in use"); +} + +int f_ebcdic2ascii(CStrRef ebcdic_str) { + throw NotSupportedException(__func__, "apache is not in use"); +} + +Array f_getallheaders() { + throw NotSupportedException(__func__, "apache is not in use"); +} + +bool f_virtual(CStrRef filename) { + throw NotSupportedException(__func__, "apache is not in use"); +} + +Variant f_apache_get_config() { + Array ret; + ret.set("restart_time", HttpServer::StartTime); + ret.set("max_clients", RuntimeOption::ServerThreadCount); + return ret; +} + +Variant f_apache_get_scoreboard() { + Array ret; + Array child_status; + for (int i = 0; i < RuntimeOption::ServerThreadCount; i++) { + child_status.set(i, 2); + } + ret.set("child_status", child_status); + return ret; +} + +Variant f_apache_get_rewrite_rules() { + throw NotSupportedException(__func__, "apache is not in use"); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_apache.h b/src/cpp/ext/ext_apache.h new file mode 100644 index 0000000000000..a86ec0fe7655f --- /dev/null +++ b/src/cpp/ext/ext_apache.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_APACHE_H__ +#define __EXT_APACHE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_apache_child_terminate(); +Array f_apache_get_modules(); +String f_apache_get_version(); +String f_apache_getenv(CStrRef variable, bool walk_to_top = false); +Object f_apache_lookup_uri(CStrRef filename); +Variant f_apache_note(CStrRef note_name, CStrRef note_value = null_string); +Array f_apache_request_headers(); +bool f_apache_reset_timeout(); +Array f_apache_response_headers(); +bool f_apache_setenv(CStrRef variable, CStrRef value, bool walk_to_top = false); +int f_ascii2ebcdic(CStrRef ascii_str); +int f_ebcdic2ascii(CStrRef ebcdic_str); +Array f_getallheaders(); +bool f_virtual(CStrRef filename); +Variant f_apache_get_config(); +Variant f_apache_get_scoreboard(); +Variant f_apache_get_rewrite_rules(); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_APACHE_H__ diff --git a/src/cpp/ext/ext_apc.cpp b/src/cpp/ext/ext_apc.cpp new file mode 100644 index 0000000000000..dd5d64f915980 --- /dev/null +++ b/src/cpp/ext/ext_apc.cpp @@ -0,0 +1,364 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_apc_store(CStrRef key, CVarRef var, int64 ttl /* = 0 */, + int64 cache_id /* = 0 */) { + if (!RuntimeOption::EnableApc) return false; + + if (cache_id < 0 || cache_id >= MAX_SHARED_STORE) { + throw InvalidArgumentException("cache_id", cache_id); + } + return s_apc_store[cache_id].store(key, var, ttl); +} + +bool f_apc_add(CStrRef key, CVarRef var, int64 ttl /* = 0 */, + int64 cache_id /* = 0 */) { + if (!RuntimeOption::EnableApc) return false; + + if (cache_id < 0 || cache_id >= MAX_SHARED_STORE) { + throw InvalidArgumentException("cache_id", cache_id); + } + SharedStore &sharedStore = s_apc_store[cache_id]; + Variant value; + if (!sharedStore.get(key, value)) { + sharedStore.store(key, var, ttl); + return true; + } + return false; +} + +Variant f_apc_fetch(CVarRef key, Variant success /* = null */, + int64 cache_id /* = 0 */) { + if (!RuntimeOption::EnableApc) return false; + + if (cache_id < 0 || cache_id >= MAX_SHARED_STORE) { + throw InvalidArgumentException("cache_id", cache_id); + } + + Variant v; + + if (key.is(KindOfArray)) { + bool tmp = false; + Array ret = Array::Create(); + Array keys = key.toArray(); + for (ArrayIter iter(keys); iter; ++iter) { + Variant k = iter.second(); + if (!k.isString()) { + throw InvalidArgumentException("apc key", "(not a string)"); + } + if (s_apc_store[cache_id].get(k.toString(), v)) { + tmp = true; + ret.set(k, v); + } + } + success = tmp; + return ret; + } + + if (s_apc_store[cache_id].get(key.toString(), v)) { + success = true; + } else { + success = false; + v = false; + } + return v; +} + +Variant f_apc_delete(CVarRef key, int64 cache_id /* = 0 */) { + if (!RuntimeOption::EnableApc) return false; + + if (cache_id < 0 || cache_id >= MAX_SHARED_STORE) { + throw InvalidArgumentException("cache_id", cache_id); + } + + if (key.is(KindOfArray)) { + Array ret = Array::Create(); + Array keys = key.toArray(); + for (ArrayIter iter(keys); iter; ++iter) { + Variant k = iter.second(); + if (!k.isString()) { + Logger::Warning("apc key is not a string"); + ret.append(k); + } else if (!s_apc_store[cache_id].erase(k.toString())) { + ret.append(k); + } + } + return ret; + } + + return s_apc_store[cache_id].erase(key.toString()); +} + +bool f_apc_clear_cache(int64 cache_id /* = 0 */) { + if (!RuntimeOption::EnableApc) return false; + + if (cache_id < 0 || cache_id >= MAX_SHARED_STORE) { + throw InvalidArgumentException("cache_id", cache_id); + } + s_apc_store[cache_id].clear(); + return true; +} + +Variant f_apc_inc(CStrRef key, int64 step /* = 1 */, + Variant success /* = null */, int64 cache_id /* = 0 */) { + if (!RuntimeOption::EnableApc) return false; + + if (cache_id < 0 || cache_id >= MAX_SHARED_STORE) { + throw InvalidArgumentException("cache_id", cache_id); + } + bool found = false; + int64 newValue = s_apc_store[cache_id].inc(key, step, found); + success = found; + return newValue; +} + +Variant f_apc_dec(CStrRef key, int64 step /* = 1 */, + Variant success /* = null */, int64 cache_id /* = 0 */) { + if (!RuntimeOption::EnableApc) return false; + + if (cache_id < 0 || cache_id >= MAX_SHARED_STORE) { + throw InvalidArgumentException("cache_id", cache_id); + } + bool found = false; + int64 newValue = s_apc_store[cache_id].inc(key, -step, found); + success = found; + return newValue; +} + +bool f_apc_cas(CStrRef key, int64 old_cas, int64 new_cas, + int64 cache_id /* = 0 */) { + if (!RuntimeOption::EnableApc) return false; + + if (cache_id < 0 || cache_id >= MAX_SHARED_STORE) { + throw InvalidArgumentException("cache_id", cache_id); + } + return s_apc_store[cache_id].cas(key, old_cas, new_cas); +} + +Variant f_apc_cache_info(int64 cache_id /* = 0 */, bool limited /* = false */) { + return CREATE_MAP1("start_time", start_time()); +} + +/////////////////////////////////////////////////////////////////////////////// +// loading APC from archive files + +typedef void(*PFUNC_APC_LOAD)(); + +static Mutex dl_mutex; +static PFUNC_APC_LOAD apc_load_func(void *handle, const char *name) { + Lock lock(dl_mutex); + dlerror(); // clear errors + PFUNC_APC_LOAD p = (PFUNC_APC_LOAD)dlsym(handle, name); + char *error = dlerror(); + if (error || p == NULL) { + throw Exception("Unable to find %s in %s: %s", name, + RuntimeOption::ApcPrimeLibrary.c_str(), + error ? error : "(unknown error)"); + } + return p; +} + +DECLARE_BOOST_TYPES(ApcLoadJob); +class ApcLoadJob { +public: + ApcLoadJob(void *handle, int index) : m_handle(handle), m_index(index) {} + void *m_handle; int m_index; +}; + +class ApcLoadWorker { +public: + void doJob(ApcLoadJobPtr job) { + char func_name[128]; + snprintf(func_name, sizeof(func_name), "_apc_load_%d", job->m_index); + apc_load_func(job->m_handle, func_name)(); + } +}; + +void apc_load(int thread) { + static void *handle = NULL; + if (handle || + RuntimeOption::ApcPrimeLibrary.empty() || + !RuntimeOption::EnableApc) { + return; + } + + Timer timer(Timer::WallTime, "loading APC data"); + handle = dlopen(RuntimeOption::ApcPrimeLibrary.c_str(), RTLD_LAZY); + if (!handle) { + throw Exception("Unable to open apc prime library %s: %s", + RuntimeOption::ApcPrimeLibrary.c_str(), dlerror()); + } + + if (thread <= 1) { + apc_load_func(handle, "_apc_load_all")(); + } else { + int count = ((int(*)())apc_load_func(handle, "_apc_load_count"))(); + + ApcLoadJobPtrVec jobs; + jobs.reserve(count); + for (int i = 0; i < count; i++) { + jobs.push_back(ApcLoadJobPtr(new ApcLoadJob(handle, i))); + } + JobDispatcher(jobs, thread).run(); + } + + for (set::const_iterator iter = + RuntimeOption::ApcCompletionKeys.begin(); + iter != RuntimeOption::ApcCompletionKeys.end(); ++iter) { + f_apc_store(String(*iter), 1); + } +} + +static int count_items(const char **p, int step) { + int count = 0; + for (const char **k = p; *k; k += step) { + count++; + } + return count; +} + +void apc_load_impl(const char **int_keys, int64 *int_values, + const char **char_keys, char *char_values, + const char **strings, const char **objects, + const char **thrifts, const char **others) { + SharedStore &s = s_apc_store[0]; + { + int count = count_items(int_keys, 2); + if (count) { + vector vars(count); + const char **k = int_keys; + int64 *v = int_values; + for (int i = 0; i < count; i++, k += 2) { + SharedStore::KeyValuePair &item = vars[i]; + item.key = *k; + item.len = (int)(int64)*(k+1); + item.value = s.construct(item.key, item.len, *v++); + } + s.prime(vars); + } + } + { + int count = count_items(char_keys, 2); + if (count) { + vector vars(count); + const char **k = char_keys; + char *v = char_values; + for (int i = 0; i < count; i++, k += 2) { + SharedStore::KeyValuePair &item = vars[i]; + item.key = *k; + item.len = (int)(int64)*(k+1); + switch (*v++) { + case 0: item.value = s.construct(item.key, item.len, false); break; + case 1: item.value = s.construct(item.key, item.len, true ); break; + case 2: item.value = s.construct(item.key, item.len, null ); break; + default: + throw Exception("bad apc archive, unknown char type"); + } + } + s.prime(vars); + } + } + { + int count = count_items(strings, 4); + if (count) { + vector vars(count); + const char **p = strings; + for (int i = 0; i < count; i++, p += 4) { + SharedStore::KeyValuePair &item = vars[i]; + item.key = *p; + item.len = (int)(int64)*(p+1); + String value(*(p+2), (int)(int64)*(p+3), AttachLiteral); + item.value = s.construct(item.key, item.len, value, false); + } + s.prime(vars); + } + } + { + int count = count_items(objects, 4); + if (count) { + vector vars(count); + const char **p = objects; + for (int i = 0; i < count; i++, p += 4) { + SharedStore::KeyValuePair &item = vars[i]; + item.key = *p; + item.len = (int)(int64)*(p+1); + String value(*(p+2), (int)(int64)*(p+3), AttachLiteral); + item.value = s.construct(item.key, item.len, value, true); + } + s.prime(vars); + } + } + { + int count = count_items(thrifts, 4); + if (count) { + vector vars(count); + const char **p = thrifts; + for (int i = 0; i < count; i++, p += 4) { + SharedStore::KeyValuePair &item = vars[i]; + item.key = *p; + item.len = (int)(int64)*(p+1); + String value(*(p+2), (int)(int64)*(p+3), AttachLiteral); + Variant success; + Variant v = f_fb_thrift_unserialize(value, ref(success)); + if (same(success, false)) { + throw Exception("bad apc archive, f_fb_thrift_unserialize failed"); + } + item.value = s.construct(item.key, item.len, v); + } + s.prime(vars); + } + } + { + int count = count_items(others, 4); + if (count) { + vector vars(count); + const char **p = others; + for (int i = 0; i < count; i++, p += 4) { + SharedStore::KeyValuePair &item = vars[i]; + item.key = *p; + item.len = (int)(int64)*(p+1); + + String value(*(p+2), (int)(int64)*(p+3), AttachLiteral); + Variant v = f_unserialize(value); + if (same(v, false)) { + // we can't possibly get here if it was a boolean "false" that's + // supposed to be serialized as a char + throw Exception("bad apc archive, f_unserialize failed"); + } + item.value = s.construct(item.key, item.len, v); + } + s.prime(vars); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_apc.h b/src/cpp/ext/ext_apc.h new file mode 100644 index 0000000000000..a4013f19ba012 --- /dev/null +++ b/src/cpp/ext/ext_apc.h @@ -0,0 +1,91 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_APC_H__ +#define __EXT_APC_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_apc_add(CStrRef key, CVarRef var, int64 ttl = 0, int64 cache_id = 0); +bool f_apc_store(CStrRef key, CVarRef var, int64 ttl = 0, int64 cache_id = 0); +Variant f_apc_fetch(CVarRef key, Variant success = null, int64 cache_id = 0); +Variant f_apc_delete(CVarRef key, int64 cache_id = 0); +bool f_apc_clear_cache(int64 cache_id = 0); +Variant f_apc_inc(CStrRef key, int64 step = 1, Variant success = null, int64 cache_id = 0); +Variant f_apc_dec(CStrRef key, int64 step = 1, Variant success = null, int64 cache_id = 0); +bool f_apc_cas(CStrRef key, int64 old_cas, int64 new_cas, int64 cache_id = 0); + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_apc_cache_info(int64 cache_id = 0, bool limited = false); +inline Array f_apc_sma_info(bool limited = false) { + return Array::Create(); +} +inline bool f_apc_define_constants(CStrRef key, CStrRef constants, + bool case_sensitive = true, + int64 cache_id = 0) { + throw NotSupportedException(__func__, "dynamic coding"); +} +inline bool f_apc_load_constants(CStrRef key, bool case_sensitive = true, + int64 cache_id = 0) { + throw NotSupportedException(__func__, "dynamic coding"); +} +inline bool f_apc_compile_file(CStrRef filename, bool atomic = true, + int64 cache_id = 0) { + throw NotSupportedException(__func__, "dynamic coding"); +} +inline Array f_apc_filehits() { + throw NotSupportedException(__func__, "feature not supported"); +} +inline Variant f_apc_delete_file(CVarRef keys, int64 cache_id = 0) { + throw NotSupportedException(__func__, "feature not supported"); +} +inline Variant f_apc_bin_dump(int64 cache_id = 0, CVarRef filter = null_variant) { + throw NotSupportedException(__func__, "feature not supported"); +} +inline bool f_apc_bin_load(CStrRef data, int64 flags = 0, int64 cache_id = 0) { + throw NotSupportedException(__func__, "feature not supported"); +} +inline Variant f_apc_bin_dumpfile(int64 cache_id, CVarRef filter, + CStrRef filename, int64 flags = 0, + CObjRef context = null) { + throw NotSupportedException(__func__, "feature not supported"); +} +inline bool f_apc_bin_loadfile(CStrRef filename, CObjRef context = null, + int64 flags = 0, int64 cache_id = 0) { + throw NotSupportedException(__func__, "feature not supported"); +} + +/////////////////////////////////////////////////////////////////////////////// +// loading APC from archive files + +void apc_load(int thread); + +// needed by generated apc archive .cpp files +void apc_load_impl(const char **int_keys, int64 *int_values, + const char **char_keys, char *char_values, + const char **strings, const char **objects, + const char **thrifts, const char **others); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_APC_H__ diff --git a/src/cpp/ext/ext_apd.cpp b/src/cpp/ext/ext_apd.cpp new file mode 100644 index 0000000000000..02d8467cedd41 --- /dev/null +++ b/src/cpp/ext/ext_apd.cpp @@ -0,0 +1,62 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_override_function(CStrRef name, CStrRef args, CStrRef code) { + throw NotSupportedException(__func__, "dynamic coding is not supported"); +} + +bool f_rename_function(CStrRef orig_name, CStrRef new_name) { + throw NotSupportedException(__func__, "dynamic coding is not supported"); +} + +void f_apd_set_browser_trace() { + throw NotSupportedException(__func__, "apd is not supported"); +} + +String f_apd_set_pprof_trace(CStrRef dumpdir /* = null_string */, + CStrRef frament /* = null_string */) { + throw NotSupportedException(__func__, "apd is not supported"); +} + +bool f_apd_set_session_trace_socket(CStrRef ip_or_filename, int domain, + int port, int mask) { + throw NotSupportedException(__func__, "apd is not supported"); +} + +void f_apd_stop_trace() { + throw NotSupportedException(__func__, "apd is not supported"); +} + +bool f_apd_breakpoint() { + throw NotSupportedException(__func__, "apd is not supported"); +} + +bool f_apd_continue() { + throw NotSupportedException(__func__, "apd is not supported"); +} + +bool f_apd_echo(CStrRef output) { + throw NotSupportedException(__func__, "apd is not supported"); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_apd.h b/src/cpp/ext/ext_apd.h new file mode 100644 index 0000000000000..e3161764da32f --- /dev/null +++ b/src/cpp/ext/ext_apd.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_APD_H__ +#define __EXT_APD_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_override_function(CStrRef name, CStrRef args, CStrRef code); +bool f_rename_function(CStrRef orig_name, CStrRef new_name); +void f_apd_set_browser_trace(); +String f_apd_set_pprof_trace(CStrRef dumpdir = null_string, CStrRef frament = null_string); +bool f_apd_set_session_trace_socket(CStrRef ip_or_filename, int domain, int port, int mask); +void f_apd_stop_trace(); +bool f_apd_breakpoint(); +bool f_apd_continue(); +bool f_apd_echo(CStrRef output); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_APD_H__ diff --git a/src/cpp/ext/ext_array.cpp b/src/cpp/ext/ext_array.cpp new file mode 100644 index 0000000000000..0724ef8bc0609 --- /dev/null +++ b/src/cpp/ext/ext_array.cpp @@ -0,0 +1,994 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include // icu +#include // icu +#include // icu + +#define SORT_REGULAR 0 +#define SORT_NUMERIC 1 +#define SORT_STRING 2 +#define SORT_LOCALE_STRING 5 + +#define SORT_DESC 3 +#define SORT_ASC 4 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +const int64 k_UCOL_DEFAULT = UCOL_DEFAULT; + +const int64 k_UCOL_PRIMARY = UCOL_PRIMARY; +const int64 k_UCOL_SECONDARY = UCOL_SECONDARY; +const int64 k_UCOL_TERTIARY = UCOL_TERTIARY; +const int64 k_UCOL_DEFAULT_STRENGTH = UCOL_DEFAULT_STRENGTH; +const int64 k_UCOL_QUATERNARY = UCOL_QUATERNARY; +const int64 k_UCOL_IDENTICAL = UCOL_IDENTICAL; + +const int64 k_UCOL_OFF = UCOL_OFF; +const int64 k_UCOL_ON = UCOL_ON; + +const int64 k_UCOL_SHIFTED = UCOL_SHIFTED; +const int64 k_UCOL_NON_IGNORABLE = UCOL_NON_IGNORABLE; + +const int64 k_UCOL_LOWER_FIRST = UCOL_LOWER_FIRST; +const int64 k_UCOL_UPPER_FIRST = UCOL_UPPER_FIRST; + +const int64 k_UCOL_FRENCH_COLLATION = UCOL_FRENCH_COLLATION; +const int64 k_UCOL_ALTERNATE_HANDLING = UCOL_ALTERNATE_HANDLING; +const int64 k_UCOL_CASE_FIRST = UCOL_CASE_FIRST; +const int64 k_UCOL_CASE_LEVEL = UCOL_CASE_LEVEL; +const int64 k_UCOL_NORMALIZATION_MODE = UCOL_NORMALIZATION_MODE; +const int64 k_UCOL_STRENGTH = UCOL_STRENGTH; +const int64 k_UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_HIRAGANA_QUATERNARY_MODE; +const int64 k_UCOL_NUMERIC_COLLATION = UCOL_NUMERIC_COLLATION; + +static bool filter_func(CVarRef value, const void *data) { + Variant *callback = (Variant *)data; + return f_call_user_func_array(*callback, CREATE_VECTOR1(value)); +} +Variant f_array_filter(CVarRef input, CVarRef callback /* = null_variant */) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + if (callback.isNull()) { + return ArrayUtil::Filter(toArray(input)); + } + return ArrayUtil::Filter(toArray(input), filter_func, &callback); +} + +bool f_array_key_exists(CVarRef key, CVarRef search) { + if (!search.isArray() && !search.is(KindOfObject)) { + throw_bad_type_exception("array_key_exists expects an array or an object; " + "false returned."); + return false; + } + if (key.isString() || key.isInteger()) { + return toArray(search).exists(key); + } + if (key.isNull()) { + return toArray(search).exists(""); + } + Logger::Warning("Array key should be either a string or an integer"); + return false; +} + +static Variant map_func(CArrRef params, const void *data) { + Variant *callback = (Variant *)data; + return f_call_user_func_array(*callback, params); +} +Variant f_array_map(int _argc, CVarRef callback, CVarRef arr1, CArrRef _argv /* = null_array */) { + Array inputs; + if (!arr1.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + inputs.append(arr1); + if (!_argv.empty()) { + inputs = inputs.merge(_argv); + } + return ArrayUtil::Map(inputs, map_func, &callback); +} + +static void php_array_merge(Array &arr1, CArrRef arr2, bool recursive) { + if (arr2->supportValueRef()) { + for (ArrayIter iter(arr2); iter; ++iter) { + Variant key = iter.first(); + CVarRef value = iter.secondRef(); + if (key.isNumeric()) { + if (value.isReferenced()) value.setContagious(); + arr1.append(value); + } else if (recursive && arr1.exists(key)) { + Array subarr1 = arr1[key].toArray(); + php_array_merge(subarr1, value.toArray(), recursive); + arr1.set(key, subarr1); + } else { + if (value.isReferenced()) value.setContagious(); + arr1.set(key, value); + } + } + } else { + for (ArrayIter iter(arr2); iter; ++iter) { + Variant key = iter.first(); + Variant value = iter.second(); + if (key.isNumeric()) { + arr1.append(value); + } else if (recursive && arr1.exists(key)) { + Array subarr1 = arr1[key].toArray(); + php_array_merge(subarr1, value.toArray(), recursive); + arr1.set(key, subarr1); + } else { + arr1.set(key, value); + } + } + } +} +static Array php_array_merge_wrapper(Array arr1, Array args, bool recursive) { + Array ret = Array::Create(); + php_array_merge(ret, arr1, recursive); + for (ArrayIter iter(args); iter; ++iter) { + php_array_merge(ret, iter.second().toArray(), recursive); + } + return ret; +} +Variant f_array_merge_recursive(int _argc, CVarRef array1, + CArrRef _argv /* = null_array */) { + if (!array1.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return php_array_merge_wrapper(array1, _argv, true); +} +Variant f_array_merge(int _argc, CVarRef array1, + CArrRef _argv /* = null_array */) { + if (!array1.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return php_array_merge_wrapper(array1, _argv, false); +} + +Variant f_array_push(int _argc, Variant array, CVarRef var, CArrRef _argv /* = null_array */) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + array.append(var); + for (ArrayIter iter(_argv); iter; ++iter) { + array.append(iter.second()); + } + return array.toArray().size(); +} + +static Variant reduce_func(CVarRef result, CVarRef operand, const void *data) { + Variant *callback = (Variant *)data; + return f_call_user_func_array(*callback, CREATE_VECTOR2(result, operand)); +} +Variant f_array_reduce(CVarRef input, CVarRef callback, + CVarRef initial /* = null_variant */) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return ArrayUtil::Reduce(toArray(input), reduce_func, &callback, initial); +} + +int f_array_unshift(int _argc, Variant array, CVarRef var, CArrRef _argv /* = null_array */) { + if (array.toArray()->isVectorData()) { + if (!_argv.empty()) { + for (ssize_t pos = _argv->iter_end(); pos != ArrayData::invalid_index; + pos = _argv->iter_rewind(pos)) { + array.insert(0, _argv->getValue(pos)); + } + } + array.insert(0, var); + } else { + Array newArray; + newArray.append(var); + if (!_argv.empty()) { + for (ssize_t pos = _argv->iter_begin(); pos != ArrayData::invalid_index; + pos = _argv->iter_advance(pos)) { + newArray.append(_argv->getValue(pos)); + } + } + for (ArrayIter iter(array); iter; ++iter) { + if (iter.first().isInteger()) { + newArray.append(iter.second()); + } else { + newArray.set(iter.first(), iter.second()); + } + } + array = newArray; + } + return array.toArray().size(); +} + +static void walk_func(Variant value, CVarRef key, CVarRef userdata, + const void *data) { + Variant *callback = (Variant *)data; + f_call_user_func_array(*callback, CREATE_VECTOR3(ref(value), key, userdata)); +} +bool f_array_walk_recursive(Variant input, CVarRef funcname, + CVarRef userdata /* = null_variant */) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + ArrayUtil::Walk(ref(input), walk_func, &funcname, true, userdata); + return true; +} +bool f_array_walk(Variant input, CVarRef funcname, + CVarRef userdata /* = null_variant */) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + ArrayUtil::Walk(ref(input), walk_func, &funcname, false, userdata); + return true; +} + +Array f_compact(int _argc, CVarRef varname, CArrRef _argv /* = null_array */) { + throw FatalErrorException("bad HPHP code generation"); +} + +template +static void compact(T *variables, Array &ret, CVarRef var) { + if (var.isArray()) { + Array vars = var.toArray(); + for (ArrayIter iter(vars); iter; ++iter) { + compact(variables, ret, iter.second()); + } + } else { + String varname = var.toString(); + if (!varname.empty() && variables->exists(varname)) { + ret.set(varname, variables->get(varname)); + } + } +} + +Array compact(RVariableTable *variables, int _argc, CVarRef varname, + CArrRef _argv /* = null_array */) { + FUNCTION_INJECTION(compact); + Array ret = Array::Create(); + compact(variables, ret, varname); + compact(variables, ret, _argv); + return ret; +} + +Array compact(LVariableTable *variables, int _argc, CVarRef varname, + CArrRef _argv /* = null_array */) { + FUNCTION_INJECTION(compact); + Array ret = Array::Create(); + compact(variables, ret, varname); + compact(variables, ret, _argv); + return ret; +} + +static int php_count_recursive(CArrRef array) { + long cnt = array.size(); + for (ArrayIter iter(array); iter; ++iter) { + Variant value = iter.second(); + if (value.isArray()) { + cnt += php_count_recursive(value.toArray()); + } + } + return cnt; +} + +int f_count(CVarRef var, bool recursive /* = false */) { + switch (var.getType()) { + case KindOfNull: + return 0; + case KindOfObject: + { + Object obj = var.toObject(); + if (obj.instanceof("countable")) { + return obj->o_invoke_few_args("count", -1, 0); + } else if (recursive) { + return php_count_recursive(var.toArray()); + } else { + return var.toArray().getArrayData()->size(); + } + } + break; + case KindOfArray: + if (recursive) { + return php_count_recursive(var.toArray()); + } + return var.getArrayData()->size(); + default: + break; + } + return 1; +} + +Array f_range(CVarRef low, CVarRef high, CVarRef step /* = 1 */) { + if (low.isString() && high.isString()) { + String slow = low.toString(); + String shigh = high.toString(); + int64 n1, n2; + double d1, d2; + DataType type1 = is_numeric_string(slow.data(), slow.size(), &n1, &d1, 0); + DataType type2 = is_numeric_string(shigh.data(), shigh.size(), &n2, &d2, 0); + if (type1 == KindOfDouble || type2 == KindOfDouble || + step.is(KindOfDouble)) { + return ArrayUtil::Range(d1, d2, step.toDouble()); + } + + if (type1 == KindOfInt64 || type2 == KindOfInt64) { + return ArrayUtil::Range(n1, n2, step.toInt64()); + } + + return ArrayUtil::Range(slow.charAt(0), shigh.charAt(0), step.toInt32()); + } + + if (low.is(KindOfDouble) || high.is(KindOfDouble) || step.is(KindOfDouble)) { + return ArrayUtil::Range(low.toDouble(), high.toDouble(), step.toDouble()); + } + + return ArrayUtil::Range(low.toInt64(), high.toInt64(), step.toInt64()); +} + +/////////////////////////////////////////////////////////////////////////////// +// diff functions + +static int cmp_func(CVarRef v1, CVarRef v2, const void *data) { + Variant *callback = (Variant *)data; + return f_call_user_func_array(*callback, CREATE_VECTOR2(v1, v2)); +} + +Variant f_array_diff(int _argc, CVarRef array1, CVarRef array2, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Array ret = toArray(array1).diff(toArray(array2), false, true); + for (ArrayIter iter(_argv); iter; ++iter) { + ret = ret.diff(iter.second(), false, true); + } + return ret; +} +Variant f_array_udiff(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Variant func = data_compare_func; + Array extra = _argv; + if (!extra.empty()) { + extra.insert(0, func); + func = extra.pop(); + } + Array ret = + toArray(array1).diff(toArray(array2), false, true, NULL, NULL, cmp_func, + &func); + for (ArrayIter iter(extra); iter; ++iter) { + ret = ret.diff(iter.second(), false, true, NULL, NULL, cmp_func, &func); + } + return ret; +} + +Variant f_array_diff_assoc(int _argc, CVarRef array1, CVarRef array2, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Array ret = toArray(array1).diff(toArray(array2), true, true); + for (ArrayIter iter(_argv); iter; ++iter) { + ret = ret.diff(iter.second(), true, true); + } + return ret; +} + +Variant f_array_diff_uassoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef key_compare_func, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Variant func = key_compare_func; + Array extra = _argv; + if (!extra.empty()) { + extra.insert(0, func); + func = extra.pop(); + } + Array ret = + toArray(array1).diff(toArray(array2), true, true, cmp_func, &func); + for (ArrayIter iter(extra); iter; ++iter) { + ret = ret.diff(iter.second(), true, true, cmp_func, &func); + } + return ret; +} + +Variant f_array_udiff_assoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Variant func = data_compare_func; + Array extra = _argv; + if (!extra.empty()) { + extra.insert(0, func); + func = extra.pop(); + } + Array ret = toArray(array1).diff(toArray(array2), true, true, NULL, NULL, + cmp_func, &func); + for (ArrayIter iter(extra); iter; ++iter) { + ret = ret.diff(iter.second(), true, true, NULL, NULL, cmp_func, &func); + } + return ret; +} + +Variant f_array_udiff_uassoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, + CVarRef key_compare_func, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Variant data_func = data_compare_func; + Variant key_func = key_compare_func; + Array extra = _argv; + if (!extra.empty()) { + extra.insert(0, key_func); + extra.insert(0, data_func); + key_func = extra.pop(); + data_func = extra.pop(); + } + Array ret = + toArray(array1).diff(toArray(array2), true, true, cmp_func, &key_func, + cmp_func, &data_func); + for (ArrayIter iter(extra); iter; ++iter) { + ret = ret.diff(iter.second(), true, true, cmp_func, &key_func, + cmp_func, &data_func); + } + return ret; +} + +Variant f_array_diff_key(int _argc, CVarRef array1, CVarRef array2, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Array ret = toArray(array1).diff(toArray(array2), true, false); + for (ArrayIter iter(_argv); iter; ++iter) { + ret = ret.diff(iter.second(), true, false); + } + return ret; +} + +Variant f_array_diff_ukey(int _argc, CVarRef array1, CVarRef array2, + CVarRef key_compare_func, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Variant func = key_compare_func; + Array extra = _argv; + if (!extra.empty()) { + extra.insert(0, func); + func = extra.pop(); + } + Array ret = + toArray(array1).diff(toArray(array2), true, false, cmp_func, &func); + for (ArrayIter iter(extra); iter; ++iter) { + ret = ret.diff(iter.second(), true, false, cmp_func, &func); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// intersect functions + +Variant f_array_intersect(int _argc, CVarRef array1, CVarRef array2, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Array ret = toArray(array1).intersect(toArray(array2), false, true); + for (ArrayIter iter(_argv); iter; ++iter) { + ret = ret.intersect(iter.second(), false, true); + } + return ret; +} + +Variant f_array_uintersect(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Variant func = data_compare_func; + Array extra = _argv; + if (!extra.empty()) { + extra.insert(0, func); + func = extra.pop(); + } + Array ret = + toArray(array1).intersect(toArray(array2), false, true, NULL, NULL, + cmp_func, &func); + for (ArrayIter iter(extra); iter; ++iter) { + ret = ret.intersect(iter.second(), false, true, NULL, NULL, + cmp_func, &func); + } + return ret; +} + +Variant f_array_intersect_assoc(int _argc, CVarRef array1, CVarRef array2, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Array ret = toArray(array1).intersect(toArray(array2), true, true); + for (ArrayIter iter(_argv); iter; ++iter) { + ret = ret.intersect(iter.second(), true, true); + } + return ret; +} + +Variant f_array_intersect_uassoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef key_compare_func, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Variant func = key_compare_func; + Array extra = _argv; + if (!extra.empty()) { + extra.insert(0, func); + func = extra.pop(); + } + Array ret = + toArray(array1).intersect(toArray(array2), true, true, cmp_func, &func); + for (ArrayIter iter(extra); iter; ++iter) { + ret = ret.intersect(iter.second(), true, true, cmp_func, &func); + } + return ret; +} + +Variant f_array_uintersect_assoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Variant func = data_compare_func; + Array extra = _argv; + if (!extra.empty()) { + extra.insert(0, func); + func = extra.pop(); + } + Array ret = + toArray(array1).intersect(toArray(array2), true, true, NULL, NULL, + cmp_func, &func); + for (ArrayIter iter(extra); iter; ++iter) { + ret = ret.intersect(iter.second(), true, true, NULL, NULL, + cmp_func, &func); + } + return ret; +} + +Variant f_array_uintersect_uassoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, + CVarRef key_compare_func, + CArrRef _argv /* = null_array */) { + if (!array1.isArray() || !array2.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Variant data_func = data_compare_func; + Variant key_func = key_compare_func; + Array extra = _argv; + if (!extra.empty()) { + extra.insert(0, key_func); + extra.insert(0, data_func); + key_func = extra.pop(); + data_func = extra.pop(); + } + Array ret = + toArray(array1).intersect(toArray(array2), true, true, cmp_func, &key_func, + cmp_func, &data_func); + for (ArrayIter iter(extra); iter; ++iter) { + ret = ret.intersect(iter.second(), true, true, cmp_func, &key_func, + cmp_func, &data_func); + } + return ret; +} + +Variant f_array_intersect_key(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv /* = null_array */) { + Array ret = toArray(array1).intersect(toArray(array2), true, false); + for (ArrayIter iter(_argv); iter; ++iter) { + ret = ret.intersect(iter.second(), true, false); + } + return ret; +} + +Variant f_array_intersect_ukey(int _argc, CVarRef array1, CVarRef array2, + CVarRef key_compare_func, CArrRef _argv /* = null_array */) { + Variant func = key_compare_func; + Array extra = _argv; + if (!extra.empty()) { + extra.insert(0, func); + func = extra.pop(); + } + Array ret = + toArray(array1).intersect(toArray(array2), true, false, cmp_func, &func); + for (ArrayIter iter(extra); iter; ++iter) { + ret = ret.intersect(iter.second(), true, false, cmp_func, &func); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// sorting functions + +class Collator : public RequestEventHandler { +public: + String getLocale() { + return m_locale; + } + UErrorCode &getErrorCodeRef() { + return m_errcode; + } + bool setLocale(CStrRef locale) { + if (m_locale.same(locale)) { + return true; + } + if (m_ucoll) { + ucol_close(m_ucoll); + m_ucoll = NULL; + } + m_errcode = U_ZERO_ERROR; + m_ucoll = ucol_open(locale.data(), &m_errcode); + if (m_ucoll == NULL) { + Logger::Error("failed to load %s locale from icu data", locale.data()); + return false; + } + if (U_FAILURE(m_errcode)) { + ucol_close(m_ucoll); + m_ucoll = NULL; + return false; + } + m_locale = locale; + return true; + } + + UCollator *getCollator() { + return m_ucoll; + } + + bool setAttribute(int64 attr, int64 val) { + if (!m_ucoll) { + Logger::Verbose("m_ucoll is NULL"); + return false; + } + m_errcode = U_ZERO_ERROR; + ucol_setAttribute(m_ucoll, (UColAttribute)attr, + (UColAttributeValue)val, &m_errcode); + if (U_FAILURE(m_errcode)) { + Logger::Verbose("Error setting attribute value"); + return false; + } + return true; + } + + bool setStrength(int64 strength) { + if (!m_ucoll) { + Logger::Verbose("m_ucoll is NULL"); + return false; + } + ucol_setStrength(m_ucoll, (UCollationStrength)strength); + return true; + } + + Variant getErrorCode() { + if (!m_ucoll) { + Logger::Verbose("m_ucoll is NULL"); + return false; + } + return m_errcode; + } + + virtual void requestInit() { + m_locale = String(uloc_getDefault(), CopyString); + m_errcode = U_ZERO_ERROR; + m_ucoll = ucol_open(m_locale.data(), &m_errcode); + ASSERT(m_ucoll); + } + virtual void requestShutdown() { + m_locale.reset(); + if (m_ucoll) { + ucol_close(m_ucoll); + m_ucoll = NULL; + } + } + +private: + String m_locale; + UCollator *m_ucoll; + UErrorCode m_errcode; +}; +static RequestLocal s_collator; + +static Array::PFUNC_CMP get_cmp_func(int sort_flags, bool ascending) { + switch (sort_flags) { + case SORT_REGULAR: + return ascending ? + Array::SortRegularAscending : Array::SortRegularDescending; + case SORT_NUMERIC: + return ascending ? + Array::SortNumericAscending : Array::SortNumericDescending; + case SORT_STRING: + return ascending ? + Array::SortStringAscending : Array::SortStringDescending; + case SORT_LOCALE_STRING: + return ascending ? + Array::SortLocaleStringAscending : Array::SortLocaleStringDescending; + default: + break; + } + throw InvalidArgumentException("sort_flags", sort_flags); +} + +bool f_sort(Variant array, int sort_flags /* = 0 */, + bool use_collator /* = false */) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + if (use_collator && sort_flags != SORT_LOCALE_STRING) { + UCollator *coll = s_collator->getCollator(); + if (coll) { + UErrorCode &errcode = s_collator->getErrorCodeRef(); + return collator_sort(array, sort_flags, true, coll, &errcode); + } + } + Array temp = array.toArray(); + temp.sort(get_cmp_func(sort_flags, true), false, true); + array = temp; + return true; +} + +bool f_rsort(Variant array, int sort_flags /* = 0 */, + bool use_collator /* = false */) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + if (use_collator && sort_flags != SORT_LOCALE_STRING) { + UCollator *coll = s_collator->getCollator(); + if (coll) { + UErrorCode &errcode = s_collator->getErrorCodeRef(); + return collator_sort(array, sort_flags, false, coll, &errcode); + } + } + Array temp = array.toArray(); + temp.sort(get_cmp_func(sort_flags, false), false, true); + array = temp; + return true; +} + +bool f_asort(Variant array, int sort_flags /* = 0 */, + bool use_collator /* = false */) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + if (use_collator && sort_flags != SORT_LOCALE_STRING) { + UCollator *coll = s_collator->getCollator(); + if (coll) { + UErrorCode &errcode = s_collator->getErrorCodeRef(); + return collator_asort(array, sort_flags, true, coll, &errcode); + } + } + Array temp = array.toArray(); + temp.sort(get_cmp_func(sort_flags, true), false, false); + array = temp; + return true; +} + +bool f_arsort(Variant array, int sort_flags /* = 0 */, + bool use_collator /* = false */) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + if (use_collator && sort_flags != SORT_LOCALE_STRING) { + UCollator *coll = s_collator->getCollator(); + if (coll) { + UErrorCode &errcode = s_collator->getErrorCodeRef(); + return collator_asort(array, sort_flags, false, coll, &errcode); + } + } + Array temp = array.toArray(); + temp.sort(get_cmp_func(sort_flags, false), false, false); + array = temp; + return true; +} + +bool f_ksort(Variant array, int sort_flags /* = 0 */) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + Array temp = array.toArray(); + temp.sort(get_cmp_func(sort_flags, true), true, false); + array = temp; + return true; +} + +bool f_krsort(Variant array, int sort_flags /* = 0 */) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + Array temp = array.toArray(); + temp.sort(get_cmp_func(sort_flags, false), true, false); + array = temp; + return true; +} + +bool f_usort(Variant array, CVarRef cmp_function) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + Array temp = array.toArray(); + temp.sort(cmp_func, false, true, &cmp_function); + array = temp; + return true; +} + +bool f_uasort(Variant array, CVarRef cmp_function) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + Array temp = array.toArray(); + temp.sort(cmp_func, false, false, &cmp_function); + array = temp; + return true; +} + +bool f_uksort(Variant array, CVarRef cmp_function) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + Array temp = array.toArray(); + temp.sort(cmp_func, true, false, &cmp_function); + array = temp; + return true; +} + +Variant f_natsort(Variant array) { + // NOTE, PHP natsort accepts ArrayAccess objects as well, + // which does not make much sense, and which is not supported here. + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Array temp = array.toArray(); + temp.sort(Array::SortNatural, false, false); + array = temp; + return true; +} + +Variant f_natcasesort(Variant array) { + // NOTE, PHP natcasesort accepts ArrayAccess objects as well, + // which does not make much sense, and which is not supported here. + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Array temp = array.toArray(); + temp.sort(Array::SortNaturalCase, false, false); + array = temp; + return true; +} + +bool f_array_multisort(int _argc, Variant ar1, + CArrRef _argv /* = null_array */) { + if (!ar1.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + std::vector data; + std::vector arrays; + arrays.reserve(1 + _argv.size()); // so no resize would happen + + Array::SortData sd; + sd.original = &ar1; + arrays.push_back(ar1.toArray()); + sd.array = &arrays.back(); + sd.by_key = false; + + int sort_flags = SORT_REGULAR; + bool ascending = true; + for (int i = 0; i < _argv.size(); i++) { + Variant *v = &((Array&)_argv).lvalAt(i); + if (v->isArray()) { + sd.cmp_func = get_cmp_func(sort_flags, ascending); + data.push_back(sd); + + sort_flags = SORT_REGULAR; + ascending = true; + + sd.original = v; + arrays.push_back(sd.original->toArray()); + sd.array = &arrays.back(); + } else { + int n = v->toInt32(); + if (n == SORT_ASC) { + ascending = true; + } else if (n == SORT_DESC) { + ascending = false; + } else { + sort_flags = n; + } + } + } + + sd.cmp_func = get_cmp_func(sort_flags, ascending); + data.push_back(sd); + + Array::MultiSort(data, true); + return true; +} + +String f_i18n_loc_get_default() { + return s_collator->getLocale(); +} + +bool f_i18n_loc_set_default(CStrRef locale) { + return s_collator->setLocale(locale); +} + +bool f_i18n_loc_set_attribute(int64 attr, int64 val) { + return s_collator->setAttribute(attr, val); +} + +bool f_i18n_loc_set_strength(int64 strength) { + return s_collator->setStrength(strength); +} + +Variant f_i18n_loc_get_error_code() { + return s_collator->getErrorCode(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_array.h b/src/cpp/ext/ext_array.h new file mode 100644 index 0000000000000..5754128854b5b --- /dev/null +++ b/src/cpp/ext/ext_array.h @@ -0,0 +1,348 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_ARRAY_H__ +#define __EXT_ARRAY_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +extern const int64 k_UCOL_DEFAULT; +extern const int64 k_UCOL_PRIMARY; +extern const int64 k_UCOL_SECONDARY; +extern const int64 k_UCOL_TERTIARY; +extern const int64 k_UCOL_DEFAULT_STRENGTH; +extern const int64 k_UCOL_QUATERNARY; +extern const int64 k_UCOL_IDENTICAL; +extern const int64 k_UCOL_OFF; +extern const int64 k_UCOL_ON; +extern const int64 k_UCOL_SHIFTED; +extern const int64 k_UCOL_NON_IGNORABLE; +extern const int64 k_UCOL_LOWER_FIRST; +extern const int64 k_UCOL_UPPER_FIRST; +extern const int64 k_UCOL_FRENCH_COLLATION; +extern const int64 k_UCOL_ALTERNATE_HANDLING; +extern const int64 k_UCOL_CASE_FIRST; +extern const int64 k_UCOL_CASE_LEVEL; +extern const int64 k_UCOL_NORMALIZATION_MODE; +extern const int64 k_UCOL_STRENGTH; +extern const int64 k_UCOL_HIRAGANA_QUATERNARY_MODE; +extern const int64 k_UCOL_NUMERIC_COLLATION; + +inline void throw_bad_array_exception(const char *func) { + throw_bad_type_exception("%s expects array(s)", func + 2); +} + +inline Variant f_array_change_key_case(CVarRef input, bool upper = false) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + return ArrayUtil::ChangeKeyCase(toArray(input), !upper); +} +inline Variant f_array_chunk(CVarRef input, int size, + bool preserve_keys = false) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return ArrayUtil::Chunk(toArray(input), size, preserve_keys); +} +inline Variant f_array_combine(CVarRef keys, CVarRef values) { + if (!keys.isArray() || !values.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Array arr_keys = toArray(keys); + Array arr_values = toArray(values); + if (arr_keys.size() != arr_values.size()) { + Logger::Warning("Both parameters should have an equal number of elements"); + return false; + } + if (arr_keys.empty()) { + Logger::Warning("Both parameters should have at least 1 element"); + return false; + } + return ArrayUtil::Combine(arr_keys, arr_values); +} +inline Variant f_array_count_values(CVarRef input) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return ArrayUtil::CountValues(toArray(input)); +} +inline Variant f_array_fill_keys(CVarRef keys, CVarRef value) { + if (!keys.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return ArrayUtil::CreateArray(toArray(keys), value); +} +inline Array f_array_fill(int start_index, int num, CVarRef value) { + return ArrayUtil::CreateArray(start_index, num, value); +} + +Variant f_array_filter(CVarRef input, CVarRef callback = null_variant); + +inline Variant f_array_flip(CVarRef trans) { + if (!trans.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + return ArrayUtil::Flip(toArray(trans)); +} + +bool f_array_key_exists(CVarRef key, CVarRef search); + +inline Variant f_array_keys(CVarRef input, CVarRef search_value = null_variant, + bool strict = false) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return toArray(input).keys(search_value, strict); +} + +Variant f_array_map(int _argc, CVarRef callback, CVarRef arr1, CArrRef _argv = null_array); + +Variant f_array_merge_recursive(int _argc, CVarRef array1, CArrRef _argv = null_array); + +Variant f_array_merge(int _argc, CVarRef array1, CArrRef _argv = null_array); + +inline Variant f_array_pad(CVarRef input, int pad_size, CVarRef pad_value) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + if (pad_size > 0) { + return ArrayUtil::Pad(toArray(input), pad_value, pad_size, true); + } + return ArrayUtil::Pad(toArray(input), pad_value, -pad_size, false); +} + +inline Variant f_array_pop(Variant array) { + return array.pop(); +} +inline Variant f_array_product(CVarRef array) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return ArrayUtil::Product(toArray(array)); +} + +Variant f_array_push(int _argc, Variant array, CVarRef var, CArrRef _argv = null_array); + +inline Variant f_array_rand(CVarRef input, int num_req = 1) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return ArrayUtil::RandomKeys(toArray(input), num_req); +} + +Variant f_array_reduce(CVarRef input, CVarRef callback, + CVarRef initial = null_variant); + +inline Variant f_array_reverse(CVarRef array, bool preserve_keys = false) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return ArrayUtil::Reverse(toArray(array), preserve_keys); +} +inline Variant f_array_search(CVarRef needle, CVarRef haystack, + bool strict = false) { + if (!haystack.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + return toArray(haystack).key(needle, strict); +} +inline Variant f_array_shift(Variant array) { + return array.dequeue(); +} +inline Variant f_array_slice(CVarRef array, int offset, + CVarRef length = null_variant, + bool preserve_keys = false) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + int64 len = length.isNull() ? 0x7FFFFFFF : length.toInt64(); + return ArrayUtil::Slice(toArray(array), offset, len, preserve_keys); +} +inline Variant f_array_splice(Variant input, int offset, + CVarRef length = null_variant, + CVarRef replacement = null_variant) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + Array ret; + int64 len = length.isNull() ? 0x7FFFFFFF : length.toInt64(); + input = ArrayUtil::Splice(input, offset, len, replacement, &ret); + return ret; +} +inline Variant f_array_sum(CVarRef array) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return ArrayUtil::Sum(array); +} +inline Variant f_array_unique(CVarRef array) { + // NOTE, PHP array_unique accepts ArrayAccess objects as well, + // which is not supported here. + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + return ArrayUtil::Unique(toArray(array)); +} + +int f_array_unshift(int _argc, Variant array, CVarRef var, CArrRef _argv = null_array); + +inline Variant f_array_values(CVarRef input) { + if (!input.isArray()) { + throw_bad_array_exception(__func__); + return null; + } + return toArray(input).values(); +} + +bool f_array_walk_recursive(Variant input, CVarRef funcname, + CVarRef userdata = null_variant); + +bool f_array_walk(Variant input, CVarRef funcname, + CVarRef userdata = null_variant); + +/** + * LVariableTable parameter is added by HPHP. + */ +Array f_compact(int _argc, CVarRef varname, CArrRef _argv = null_array); +Array compact(RVariableTable *variables, int _argc, CVarRef varname, + CArrRef _argv = null_array); +Array compact(LVariableTable *variables, int _argc, CVarRef varname, + CArrRef _argv = null_array); + +inline bool f_shuffle(Variant array) { + if (!array.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + array = ArrayUtil::Shuffle(array); + return true; +} + +int f_count(CVarRef var, bool recursive = false); + +inline int f_sizeof(CVarRef var, bool recursive = false) { + return f_count(var, recursive); +} +inline Variant f_each(Variant array) { + return array.array_iter_each(); +} +inline Variant f_current(Variant array) { + return array.array_iter_current(); +} +inline Variant f_next(Variant array) { + return array.array_iter_next(); +} +inline Variant f_pos(Variant array) { + return array.array_iter_current(); +} +inline Variant f_prev(Variant array) { + return array.array_iter_prev(); +} +inline Variant f_reset(Variant array) { + return array.array_iter_reset(); +} +inline Variant f_end(Variant array) { + return array.array_iter_end(); +} +inline bool f_in_array(CVarRef needle, CVarRef haystack, bool strict = false) { + if (!haystack.isArray()) { + throw_bad_array_exception(__func__); + return false; + } + return toArray(haystack).valueExists(needle, strict); +} +inline Variant f_key(Variant array) { + return array.array_iter_key(); +} + +Array f_range(CVarRef low, CVarRef high, CVarRef step = 1); + +Variant f_array_diff(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array); +Variant f_array_udiff(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, CArrRef _argv = null_array); +Variant f_array_diff_assoc(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array); +Variant f_array_diff_uassoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef key_compare_func, CArrRef _argv = null_array); +Variant f_array_udiff_assoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, CArrRef _argv = null_array); +Variant f_array_udiff_uassoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, + CVarRef key_compare_func, CArrRef _argv = null_array); +Variant f_array_diff_key(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array); +Variant f_array_diff_ukey(int _argc, CVarRef array1, CVarRef array2, + CVarRef key_compare_func, CArrRef _argv = null_array); + +Variant f_array_intersect(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array); +Variant f_array_uintersect(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, CArrRef _argv = null_array); +Variant f_array_intersect_assoc(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array); +Variant f_array_intersect_uassoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef key_compare_func, CArrRef _argv = null_array); +Variant f_array_uintersect_assoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, CArrRef _argv = null_array); +Variant f_array_uintersect_uassoc(int _argc, CVarRef array1, CVarRef array2, + CVarRef data_compare_func, + CVarRef key_compare_func, CArrRef _argv = null_array); +Variant f_array_intersect_key(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array); +Variant f_array_intersect_ukey(int _argc, CVarRef array1, CVarRef array2, + CVarRef key_compare_func, CArrRef _argv = null_array); + +bool f_sort(Variant array, int sort_flags = 0, bool use_collator = false); +bool f_rsort(Variant array, int sort_flags = 0, bool use_collator = false); +bool f_asort(Variant array, int sort_flags = 0, bool use_collator = false); +bool f_arsort(Variant array, int sort_flags = 0, bool use_collator = false); +bool f_ksort(Variant array, int sort_flags = 0); +bool f_krsort(Variant array, int sort_flags = 0); +bool f_usort(Variant array, CVarRef cmp_function); +bool f_uasort(Variant array, CVarRef cmp_function); +bool f_uksort(Variant array, CVarRef cmp_function); +Variant f_natsort(Variant array); +Variant f_natcasesort(Variant array); + +bool f_array_multisort(int _argc, Variant ar1, CArrRef _argv = null_array); + +String f_i18n_loc_get_default(); +bool f_i18n_loc_set_default(CStrRef locale); +bool f_i18n_loc_set_attribute(int64 attr, int64 val); +bool f_i18n_loc_set_strength(int64 strength); +Variant f_i18n_loc_get_error_code(); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_ARRAY_H__ diff --git a/src/cpp/ext/ext_bcmath.cpp b/src/cpp/ext/ext_bcmath.cpp new file mode 100644 index 0000000000000..505d2e21a8516 --- /dev/null +++ b/src/cpp/ext/ext_bcmath.cpp @@ -0,0 +1,232 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { + +class bcmath_data { +public: + bcmath_data() { + // we can't really call bc_init_numbers() that calls into this constructor + data._zero_ = _bc_new_num_ex (1,0,1); + data._one_ = _bc_new_num_ex (1,0,1); + data._one_->n_value[0] = 1; + data._two_ = _bc_new_num_ex (1,0,1); + data._two_->n_value[0] = 2; + data.bc_precision = 0; + } + BCMathGlobals data; +}; +static ThreadLocal s_globals; + +/////////////////////////////////////////////////////////////////////////////// + +static void php_str2num(bc_num *num, const char *str) { + const char *p; + if (!(p = strchr(str, '.'))) { + bc_str2num(num, (char*)str, 0); + } else { + bc_str2num(num, (char*)str, strlen(p + 1)); + } +} + +bool f_bcscale(int64 scale) { + BCG(bc_precision) = scale < 0 ? 0 : scale; + return true; +} + +String f_bcadd(CStrRef left, CStrRef right, int64 scale /* = -1 */) { + if (scale < 0) scale = BCG(bc_precision); + bc_num first, second, result; + bc_init_num(&first); + bc_init_num(&second); + bc_init_num(&result); + php_str2num(&first, (char*)left.data()); + php_str2num(&second, (char*)right.data()); + bc_add(first, second, &result, scale); + if (result->n_scale > scale) { + result->n_scale = scale; + } + String ret(bc_num2str(result), AttachString); + bc_free_num(&first); + bc_free_num(&second); + bc_free_num(&result); + return ret; +} + +String f_bcsub(CStrRef left, CStrRef right, int64 scale /* = -1 */) { + if (scale < 0) scale = BCG(bc_precision); + bc_num first, second, result; + bc_init_num(&first); + bc_init_num(&second); + bc_init_num(&result); + php_str2num(&first, (char*)left.data()); + php_str2num(&second, (char*)right.data()); + bc_sub(first, second, &result, scale); + if (result->n_scale > scale) { + result->n_scale = scale; + } + String ret(bc_num2str(result), AttachString); + bc_free_num(&first); + bc_free_num(&second); + bc_free_num(&result); + return ret; +} + +int64 f_bccomp(CStrRef left, CStrRef right, int64 scale /* = -1 */) { + if (scale < 0) scale = BCG(bc_precision); + bc_num first, second; + bc_init_num(&first); + bc_init_num(&second); + bc_str2num(&first, (char*)left.data(), scale); + bc_str2num(&second, (char*)right.data(), scale); + int64 ret = bc_compare(first, second); + bc_free_num(&first); + bc_free_num(&second); + return ret; +} + +String f_bcmul(CStrRef left, CStrRef right, int64 scale /* = -1 */) { + if (scale < 0) scale = BCG(bc_precision); + bc_num first, second, result; + bc_init_num(&first); + bc_init_num(&second); + bc_init_num(&result); + php_str2num(&first, (char*)left.data()); + php_str2num(&second, (char*)right.data()); + bc_multiply(first, second, &result, scale); + if (result->n_scale > scale) { + result->n_scale = scale; + } + String ret(bc_num2str(result), AttachString); + bc_free_num(&first); + bc_free_num(&second); + bc_free_num(&result); + return ret; +} + +String f_bcdiv(CStrRef left, CStrRef right, int64 scale /* = -1 */) { + if (scale < 0) scale = BCG(bc_precision); + bc_num first, second, result; + bc_init_num(&first); + bc_init_num(&second); + bc_init_num(&result); + php_str2num(&first, (char*)left.data()); + php_str2num(&second, (char*)right.data()); + if (bc_divide(first, second, &result, scale) == -1) { + Logger::Warning("Division by zero"); + return String(); + } + String ret(bc_num2str(result), AttachString); + bc_free_num(&first); + bc_free_num(&second); + bc_free_num(&result); + return ret; +} + +String f_bcmod(CStrRef left, CStrRef right) { + bc_num first, second, result; + bc_init_num(&first); + bc_init_num(&second); + bc_init_num(&result); + php_str2num(&first, (char*)left.data()); + php_str2num(&second, (char*)right.data()); + if (bc_modulo(first, second, &result, 0) == -1) { + Logger::Warning("Division by zero"); + return String(); + } + String ret(bc_num2str(result), AttachString); + bc_free_num(&first); + bc_free_num(&second); + bc_free_num(&result); + return ret; +} + +String f_bcpow(CStrRef left, CStrRef right, int64 scale /* = -1 */) { + if (scale < 0) scale = BCG(bc_precision); + bc_num first, second, result; + bc_init_num(&first); + bc_init_num(&second); + bc_init_num(&result); + php_str2num(&first, (char*)left.data()); + php_str2num(&second, (char*)right.data()); + bc_raise(first, second, &result, scale); + if (result->n_scale > scale) { + result->n_scale = scale; + } + String ret(bc_num2str(result), AttachString); + bc_free_num(&first); + bc_free_num(&second); + bc_free_num(&result); + return ret; +} + +Variant f_bcpowmod(CStrRef left, CStrRef right, CStrRef modulus, + int64 scale /* = -1 */) { + if (scale < 0) scale = BCG(bc_precision); + bc_num first, second, mod, result; + bc_init_num(&first); + bc_init_num(&second); + bc_init_num(&mod); + bc_init_num(&result); + php_str2num(&first, (char*)left.data()); + php_str2num(&second, (char*)right.data()); + php_str2num(&mod, (char*)modulus.data()); + if (bc_raisemod(first, second, mod, &result, scale) == -1) { + return false; + } + if (result->n_scale > scale) { + result->n_scale = scale; + } + String ret(bc_num2str(result), AttachString); + bc_free_num(&first); + bc_free_num(&second); + bc_free_num(&mod); + bc_free_num(&result); + return ret; +} + +Variant f_bcsqrt(CStrRef operand, int64 scale /* = -1 */) { + if (scale < 0) scale = BCG(bc_precision); + bc_num result; + bc_init_num(&result); + php_str2num(&result, (char*)operand.data()); + Variant ret; + if (bc_sqrt(&result, scale) != 0) { + if (result->n_scale > scale) { + result->n_scale = scale; + } + ret = String(bc_num2str(result), AttachString); + } else { + Logger::Warning("Square root of negative number"); + } + bc_free_num(&result); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +extern "C" { + struct BCMathGlobals *get_bcmath_globals() { + return &HPHP::s_globals.get()->data; + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_bcmath.h b/src/cpp/ext/ext_bcmath.h new file mode 100644 index 0000000000000..28c546e6504ee --- /dev/null +++ b/src/cpp/ext/ext_bcmath.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_BCMATH_H__ +#define __EXT_BCMATH_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_bcscale(int64 scale); +String f_bcadd(CStrRef left, CStrRef right, int64 scale = -1); +String f_bcsub(CStrRef left, CStrRef right, int64 scale = -1); +int64 f_bccomp(CStrRef left, CStrRef right, int64 scale = -1); +String f_bcmul(CStrRef left, CStrRef right, int64 scale = -1); +String f_bcdiv(CStrRef left, CStrRef right, int64 scale = -1); +String f_bcmod(CStrRef left, CStrRef right); +String f_bcpow(CStrRef left, CStrRef right, int64 scale = -1); +Variant f_bcpowmod(CStrRef left, CStrRef right, CStrRef modulus, + int64 scale = -1); +Variant f_bcsqrt(CStrRef operand, int64 scale = -1); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_BCMATH_H__ diff --git a/src/cpp/ext/ext_class.cpp b/src/cpp/ext/ext_class.cpp new file mode 100644 index 0000000000000..0d38a91f6746d --- /dev/null +++ b/src/cpp/ext/ext_class.cpp @@ -0,0 +1,177 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helpers + +static String get_classname(Variant class_or_object) { + if (class_or_object.is(KindOfObject)) { + return class_or_object.toObject()->o_getClassName(); + } + return class_or_object.toString(); +} + +/////////////////////////////////////////////////////////////////////////////// + +Array f_get_declared_classes() { + return ClassInfo::GetClasses(); +} + +Array f_get_declared_interfaces() { + return ClassInfo::GetInterfaces(); +} + +bool f_class_exists(CStrRef class_name, bool autoload /* = false */) { + const ClassInfo::ClassInfo *info = ClassInfo::FindClass(class_name.data()); + if (info) { + ClassInfo::Attribute attr = info->getAttribute(); + if (attr & ClassInfo::IsSystem) return true; + if (attr & ClassInfo::IsVolatile) { + return ((Globals*)get_global_variables())-> + class_exists(class_name.data()); + } else { + return true; + } + } else { + return false; + } +} + +bool f_interface_exists(CStrRef interface_name, bool autoload /* = false */) { + const ClassInfo::ClassInfo *info = + ClassInfo::FindInterface(interface_name.data()); + if (info) { + ClassInfo::Attribute attr = info->getAttribute(); + if (attr & ClassInfo::IsSystem) return true; + if (attr & ClassInfo::IsVolatile) { + return ((Globals*)get_global_variables())-> + interface_exists(interface_name.data()); + } else { + return true; + } + } else { + return false; + } +} + +Array f_get_class_methods(CVarRef class_or_object) { + ClassInfo::MethodVec methods; + ClassInfo::GetClassMethods(methods, get_classname(class_or_object)); + + Array ret = Array::Create(); + for (unsigned int i = 0; i < methods.size(); i++) { + ret.append(methods[i]->name); + } + return ret; +} + +Array f_get_class_vars(CStrRef class_name) { + ClassInfo::PropertyMap properties; + ClassInfo::GetClassProperties(properties, class_name); + + Array ret = Array::Create(); + for (ClassInfo::PropertyMap::const_iterator iter = properties.begin(); + iter != properties.end(); ++iter) { + ret.append(iter->first); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_get_class(CVarRef object /* = null_variant */) { + if (!object.isObject()) return false; + return object.toObject()->o_getClassName(); +} + +Variant f_get_parent_class(CVarRef object /* = null_variant */) { + Variant class_name; + if (object.isObject()) { + class_name = f_get_class(object); + } else if (object.isString()) { + class_name = object; + } else { + return false; + } + const ClassInfo *classInfo = ClassInfo::FindClass(class_name.toString()); + if (classInfo) { + const char *parentClass = classInfo->getParentClass(); + if (parentClass && parentClass[0]) { + return parentClass; + } + } + return false; +} + +bool f_is_a(CObjRef object, CStrRef class_name) { + return object.instanceof(class_name); +} + +bool f_is_subclass_of(CVarRef class_or_object, CStrRef class_name) { + const ClassInfo *classInfo = + ClassInfo::FindClass(get_classname(class_or_object)); + if (classInfo) { + return classInfo->derivesFrom(class_name, false); + } + return false; +} + +bool f_method_exists(CVarRef class_or_object, CStrRef method_name) { + const ClassInfo *classInfo = + ClassInfo::FindClass(get_classname(class_or_object)); + if (classInfo) { + return classInfo->hasMethod(method_name); + } + return false; +} + +bool f_property_exists(CVarRef class_or_object, CStrRef property) { + const ClassInfo *classInfo = + ClassInfo::FindClass(get_classname(class_or_object)); + while (classInfo) { + if (classInfo->hasProperty(property)) { + return true; + } else { + classInfo = ClassInfo::FindClass(classInfo->getParentClass()); + } + } + return false; +} + +Array f_get_object_vars(CObjRef object) { + return object->o_toIterArray(FrameInjection::getClassName(true)); +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_call_user_method_array(CStrRef method_name, Variant obj, + CArrRef paramarr) { + return obj.toObject()->o_invoke(method_name, paramarr, -1); +} + +Variant f_call_user_method(int _argc, CStrRef method_name, Variant obj, + CArrRef _argv /* = null_array */) { + return obj.toObject()->o_invoke(method_name, _argv, -1); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_class.h b/src/cpp/ext/ext_class.h new file mode 100644 index 0000000000000..508c3eb96e2a2 --- /dev/null +++ b/src/cpp/ext/ext_class.h @@ -0,0 +1,52 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_CLASS_H__ +#define __EXT_CLASS_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Array f_get_declared_classes(); +Array f_get_declared_interfaces(); +bool f_class_exists(CStrRef class_name, bool autoload = false); +bool f_interface_exists(CStrRef interface_name, bool autoload = false); +Array f_get_class_methods(CVarRef class_or_object); +Array f_get_class_vars(CStrRef class_name); + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_get_class(CVarRef object = null_variant); +Variant f_get_parent_class(CVarRef object = null_variant); +bool f_is_a(CObjRef object, CStrRef class_name); +bool f_is_subclass_of(CVarRef class_or_object, CStrRef class_name); +bool f_method_exists(CVarRef class_or_object, CStrRef method_name); +bool f_property_exists(CVarRef class_or_object, CStrRef property); +Array f_get_object_vars(CObjRef object); + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_call_user_method_array(CStrRef method_name, Variant obj, + CArrRef paramarr); +Variant f_call_user_method(int _argc, CStrRef method_name, Variant obj, CArrRef _argv = null_array); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_CLASS_H__ diff --git a/src/cpp/ext/ext_ctype.cpp b/src/cpp/ext/ext_ctype.cpp new file mode 100644 index 0000000000000..463617ce57057 --- /dev/null +++ b/src/cpp/ext/ext_ctype.cpp @@ -0,0 +1,98 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static bool ctype(CVarRef v, int (*iswhat)(int)) { + if (v.isInteger()) { + int64 n = v.toInt64(); + if (n <= 255 && n >= 0) { + return iswhat(n); + } + + if (n >= -128 && n < 0) { + return iswhat(n + 256); + } + + return ctype(v.toString(), iswhat); + } + + if (v.isString()) { + String s = v.toString(); + if (!s.empty()) { + const char *p = s.data(); + const char *e = s.data() + s.size(); + while (p < e) { + if (!iswhat((int)*(unsigned char *)(p++))) { + return false; + } + } + return true; + } + } + return false; +} + +bool f_ctype_alnum(CVarRef text) { + return ctype(text, isalnum); +} + +bool f_ctype_alpha(CVarRef text) { + return ctype(text, isalpha); +} + +bool f_ctype_cntrl(CVarRef text) { + return ctype(text, iscntrl); +} + +bool f_ctype_digit(CVarRef text) { + return ctype(text, isdigit); +} + +bool f_ctype_graph(CVarRef text) { + return ctype(text, isgraph); +} + +bool f_ctype_lower(CVarRef text) { + return ctype(text, islower); +} + +bool f_ctype_print(CVarRef text) { + return ctype(text, isprint); +} + +bool f_ctype_punct(CVarRef text) { + return ctype(text, ispunct); +} + +bool f_ctype_space(CVarRef text) { + return ctype(text, isspace); +} + +bool f_ctype_upper(CVarRef text) { + return ctype(text, isupper); +} + +bool f_ctype_xdigit(CVarRef text) { + return ctype(text, isxdigit); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_ctype.h b/src/cpp/ext/ext_ctype.h new file mode 100644 index 0000000000000..2d4392f4ba921 --- /dev/null +++ b/src/cpp/ext/ext_ctype.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_CTYPE_H__ +#define __EXT_CTYPE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_ctype_alnum(CVarRef text); +bool f_ctype_alpha(CVarRef text); +bool f_ctype_cntrl(CVarRef text); +bool f_ctype_digit(CVarRef text); +bool f_ctype_graph(CVarRef text); +bool f_ctype_lower(CVarRef text); +bool f_ctype_print(CVarRef text); +bool f_ctype_punct(CVarRef text); +bool f_ctype_space(CVarRef text); +bool f_ctype_upper(CVarRef text); +bool f_ctype_xdigit(CVarRef text); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_CTYPE_H__ diff --git a/src/cpp/ext/ext_curl.cpp b/src/cpp/ext/ext_curl.cpp new file mode 100644 index 0000000000000..a9564b3369b65 --- /dev/null +++ b/src/cpp/ext/ext_curl.cpp @@ -0,0 +1,1102 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace std; + +#define CURLOPT_RETURNTRANSFER 19913 +#define CURLOPT_BINARYTRANSFER 19914 +#define PHP_CURL_STDOUT 0 +#define PHP_CURL_FILE 1 +#define PHP_CURL_USER 2 +#define PHP_CURL_DIRECT 3 +#define PHP_CURL_RETURN 4 +#define PHP_CURL_ASCII 5 +#define PHP_CURL_BINARY 6 +#define PHP_CURL_IGNORE 7 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helper data structure + +class CurlResource : public SweepableResourceData { +private: + DECLARE_OBJECT_ALLOCATION(CurlResource); + + class WriteHandler { + public: + WriteHandler() : method(0), fp(0), type(0) {} + + int method; + Variant callback; + FILE *fp; + StringBuffer buf; + String content; + int type; + }; + + class ReadHandler { + public: + ReadHandler() : method(0), fp(0), fd(0) {} + + int method; + Variant callback; + FILE *fp; + long fd; + }; + + DECLARE_BOOST_TYPES(ToFree); + class ToFree { + public: + vector str; + vector post; + vector slist; + + ~ToFree() { + for (unsigned int i = 0; i < str.size(); i++) { + free(str[i]); + } + for (unsigned int i = 0; i < post.size(); i++) { + curl_formfree(post[i]); + } + for (unsigned int i = 0; i < slist.size(); i++) { + curl_slist_free_all(slist[i]); + } + } + }; + +public: + // overriding ResourceData + const char *o_getClassName() const { return "cURL handle";} + + CurlResource(CStrRef url) : m_emptyPost(true) { + m_cp = curl_easy_init(); + m_url = url; + + memset(m_error_str, 0, sizeof(m_error_str)); + m_error_no = CURLE_OK; + m_to_free = ToFreePtr(new ToFree()); + + m_write.method = PHP_CURL_STDOUT; + m_write.type = PHP_CURL_ASCII; + m_read.method = PHP_CURL_DIRECT; + m_write_header.method = PHP_CURL_IGNORE; + + curl_easy_setopt(m_cp, CURLOPT_NOPROGRESS, 1); + curl_easy_setopt(m_cp, CURLOPT_VERBOSE, 0); + curl_easy_setopt(m_cp, CURLOPT_ERRORBUFFER, m_error_str); + curl_easy_setopt(m_cp, CURLOPT_WRITEFUNCTION, curl_write); + curl_easy_setopt(m_cp, CURLOPT_FILE, (void*)this); + curl_easy_setopt(m_cp, CURLOPT_READFUNCTION, curl_read); + curl_easy_setopt(m_cp, CURLOPT_INFILE, (void*)this); + curl_easy_setopt(m_cp, CURLOPT_HEADERFUNCTION, curl_write_header); + curl_easy_setopt(m_cp, CURLOPT_WRITEHEADER, (void*)this); + curl_easy_setopt(m_cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 0); // for thread-safe + curl_easy_setopt(m_cp, CURLOPT_DNS_CACHE_TIMEOUT, 120); + curl_easy_setopt(m_cp, CURLOPT_MAXREDIRS, 20); // no infinite redirects + curl_easy_setopt(m_cp, CURLOPT_NOSIGNAL, 1); // for multithreading mode + + curl_easy_setopt(m_cp, CURLOPT_TIMEOUT, + RuntimeOption::HttpDefaultTimeout); + curl_easy_setopt(m_cp, CURLOPT_CONNECTTIMEOUT, + RuntimeOption::HttpDefaultTimeout); + + if (!url.empty()) { + char *urlcopy = strndup(url.data(), url.size()); + curl_easy_setopt(m_cp, CURLOPT_URL, urlcopy); + m_to_free->str.push_back(urlcopy); + } + } + + CurlResource(CurlResource *src) { + ASSERT(src && src != this); + m_cp = curl_easy_duphandle(src->get()); + + memset(m_error_str, 0, sizeof(m_error_str)); + m_error_no = CURLE_OK; + + m_write.method = src->m_write.method; + m_write.type = src->m_write.type; + m_read.method = src->m_read.method; + m_write_header.method = src->m_write_header.method; + + m_write.fp = src->m_write.fp; + m_write_header.fp = src->m_write_header.fp; + m_read.fp = src->m_read.fp; + m_read.fd = src->m_read.fd; + + m_write.callback = src->m_write.callback; + m_read.callback = src->m_read.callback; + m_write_header.callback = src->m_write_header.callback; + + curl_easy_setopt(m_cp, CURLOPT_ERRORBUFFER, m_error_str); + curl_easy_setopt(m_cp, CURLOPT_FILE, (void*)this); + curl_easy_setopt(m_cp, CURLOPT_INFILE, (void*)this); + curl_easy_setopt(m_cp, CURLOPT_WRITEHEADER, (void*)this); + + m_to_free = src->m_to_free; + } + + ~CurlResource() { + close(); + } + + void close() { + if (m_cp) { + curl_easy_cleanup(m_cp); + m_cp = NULL; + } + m_to_free.reset(); + } + + Variant execute() { + if (m_cp == NULL) { + return false; + } + if (m_emptyPost) { + // As per curl docs, an empty post must set POSTFIELDSIZE to be 0 or + // the reader function will be called + curl_easy_setopt(m_cp, CURLOPT_POSTFIELDSIZE, 0); + } + m_write.buf.reset(); + m_write.content.clear(); + m_header.clear(); + memset(m_error_str, 0, sizeof(m_error_str)); + m_error_no = curl_easy_perform(m_cp); + + /* CURLE_PARTIAL_FILE is returned by HEAD requests */ + if (m_error_no != CURLE_OK && m_error_no != CURLE_PARTIAL_FILE) { + m_write.buf.reset(); + m_write.content.clear(); + return false; + } + + if (m_write.method == PHP_CURL_RETURN) { + if (!m_write.buf.empty()) { + m_write.content = m_write.buf.detach(); + } + if (!m_write.content.empty()) { + return m_write.content; + } + } + if (m_write.method == PHP_CURL_RETURN) { + return String(""); + } + return true; + } + + String getUrl() { + return m_url; + } + + String getHeader() { + return m_header; + } + + String getContents() { + if (m_write.method == PHP_CURL_RETURN) { + if (!m_write.buf.empty()) { + m_write.content = m_write.buf.detach(); + } + return m_write.content; + } + return String(); + } + + bool setOption(long option, CVarRef value) { + if (m_cp == NULL) { + return false; + } + + switch (option) { + case CURLOPT_INFILESIZE: + case CURLOPT_VERBOSE: + case CURLOPT_HEADER: + case CURLOPT_NOPROGRESS: + case CURLOPT_NOBODY: + case CURLOPT_FAILONERROR: + case CURLOPT_UPLOAD: + case CURLOPT_POST: + case CURLOPT_FTPLISTONLY: + case CURLOPT_FTPAPPEND: + case CURLOPT_NETRC: + case CURLOPT_PUT: + case CURLOPT_TIMEOUT: + //case CURLOPT_TIMEOUT_MS: + case CURLOPT_FTP_USE_EPSV: + case CURLOPT_LOW_SPEED_LIMIT: + case CURLOPT_SSLVERSION: + case CURLOPT_LOW_SPEED_TIME: + case CURLOPT_RESUME_FROM: + case CURLOPT_TIMEVALUE: + case CURLOPT_TIMECONDITION: + case CURLOPT_TRANSFERTEXT: + case CURLOPT_HTTPPROXYTUNNEL: + case CURLOPT_FILETIME: + case CURLOPT_MAXREDIRS: + case CURLOPT_MAXCONNECTS: + case CURLOPT_CLOSEPOLICY: + case CURLOPT_FRESH_CONNECT: + case CURLOPT_FORBID_REUSE: + case CURLOPT_CONNECTTIMEOUT: + //case CURLOPT_CONNECTTIMEOUT_MS: + case CURLOPT_SSL_VERIFYHOST: + case CURLOPT_SSL_VERIFYPEER: + //case CURLOPT_DNS_USE_GLOBAL_CACHE: not thread-safe when set to true + case CURLOPT_NOSIGNAL: + case CURLOPT_PROXYTYPE: + case CURLOPT_BUFFERSIZE: + case CURLOPT_HTTPGET: + case CURLOPT_HTTP_VERSION: + case CURLOPT_CRLF: + case CURLOPT_DNS_CACHE_TIMEOUT: + case CURLOPT_PROXYPORT: + case CURLOPT_FTP_USE_EPRT: + case CURLOPT_HTTPAUTH: + case CURLOPT_PROXYAUTH: + case CURLOPT_FTP_CREATE_MISSING_DIRS: + case CURLOPT_FTPSSLAUTH: + case CURLOPT_FTP_SSL: + case CURLOPT_UNRESTRICTED_AUTH: + case CURLOPT_PORT: + case CURLOPT_AUTOREFERER: + case CURLOPT_COOKIESESSION: + case CURLOPT_TCP_NODELAY: + case CURLOPT_IPRESOLVE: + case CURLOPT_FOLLOWLOCATION: + m_error_no = curl_easy_setopt(m_cp, (CURLoption)option, value.toInt64()); + break; + case CURLOPT_RETURNTRANSFER: + m_write.method = value.toBoolean() ? PHP_CURL_RETURN : PHP_CURL_STDOUT; + break; + case CURLOPT_BINARYTRANSFER: + m_write.type = value.toBoolean() ? PHP_CURL_BINARY : PHP_CURL_ASCII; + break; + case CURLOPT_PRIVATE: + case CURLOPT_URL: + case CURLOPT_PROXY: + case CURLOPT_USERPWD: + case CURLOPT_PROXYUSERPWD: + case CURLOPT_RANGE: + case CURLOPT_CUSTOMREQUEST: + case CURLOPT_USERAGENT: + case CURLOPT_FTPPORT: + case CURLOPT_COOKIE: + case CURLOPT_REFERER: + case CURLOPT_INTERFACE: + case CURLOPT_KRB4LEVEL: + case CURLOPT_EGDSOCKET: + case CURLOPT_CAINFO: + case CURLOPT_CAPATH: + case CURLOPT_SSL_CIPHER_LIST: + case CURLOPT_SSLKEY: + case CURLOPT_SSLKEYTYPE: + case CURLOPT_SSLKEYPASSWD: + case CURLOPT_SSLENGINE: + case CURLOPT_SSLENGINE_DEFAULT: + case CURLOPT_SSLCERTTYPE: + case CURLOPT_ENCODING: + case CURLOPT_COOKIEJAR: + case CURLOPT_SSLCERT: + case CURLOPT_RANDOM_FILE: + case CURLOPT_COOKIEFILE: + { + String svalue = value.toString(); + char *copystr = strndup(svalue.data(), svalue.size()); + m_to_free->str.push_back(copystr); + m_error_no = curl_easy_setopt(m_cp, (CURLoption)option, copystr); + } + break; + case CURLOPT_FILE: + case CURLOPT_INFILE: + case CURLOPT_WRITEHEADER: + case CURLOPT_STDERR: + { + if (!value.is(KindOfObject)) { + return false; + } + + Object obj = value.toObject(); + if (obj.isNull() || obj.getTyped(true) == NULL) { + return false; + } + FILE *fp = obj.getTyped()->getStream(); + if (!fp) { + return false; + } + + switch (option) { + case CURLOPT_FILE: + m_write.fp = fp; + m_write.method = PHP_CURL_FILE; + break; + case CURLOPT_WRITEHEADER: + m_write_header.fp = fp; + m_write_header.method = PHP_CURL_FILE; + break; + case CURLOPT_INFILE: + m_read.fp = fp; + m_read.fd = obj.getTyped()->fd(); + m_emptyPost = false; + break; + default: + m_error_no = curl_easy_setopt(m_cp, (CURLoption)option, fp); + break; + } + } + break; + case CURLOPT_WRITEFUNCTION: + m_write.callback = value; + m_write.method = PHP_CURL_USER; + break; + case CURLOPT_READFUNCTION: + m_read.callback = value; + m_read.method = PHP_CURL_USER; + m_emptyPost = false; + break; + case CURLOPT_HEADERFUNCTION: + m_write_header.callback = value; + m_write_header.method = PHP_CURL_USER; + break; + case CURLOPT_POSTFIELDS: + m_emptyPost = false; + if (value.is(KindOfArray) || value.is(KindOfObject)) { + Array arr = value.toArray(); + curl_httppost *first = NULL; + curl_httppost *last = NULL; + for (ArrayIter iter(arr); iter; ++iter) { + String key = iter.first().toString(); + String val = iter.second().toString(); + const char *postval = val.data(); + + /* The arguments after _NAMELENGTH and _CONTENTSLENGTH + * must be explicitly cast to long in curl_formadd + * use since curl needs a long not an int. */ + if (*postval == '@') { + ++postval; + m_error_no = (CURLcode)curl_formadd + (&first, &last, + CURLFORM_COPYNAME, key.data(), + CURLFORM_NAMELENGTH, (long)key.size(), + CURLFORM_FILE, postval, + CURLFORM_END); + } else { + m_error_no = (CURLcode)curl_formadd + (&first, &last, + CURLFORM_COPYNAME, key.data(), + CURLFORM_NAMELENGTH, (long)key.size(), + CURLFORM_COPYCONTENTS, postval, + CURLFORM_CONTENTSLENGTH,(long)val.size(), + CURLFORM_END); + } + } + + if (m_error_no != CURLE_OK) { + return false; + } + + m_to_free->post.push_back(first); + m_error_no = curl_easy_setopt(m_cp, CURLOPT_HTTPPOST, first); + + } else { + String svalue = value.toString(); + char *post = strndup(svalue.data(), svalue.size()); + m_to_free->str.push_back(post); + + m_error_no = curl_easy_setopt(m_cp, CURLOPT_POSTFIELDS, post); + m_error_no = curl_easy_setopt(m_cp, CURLOPT_POSTFIELDSIZE, + svalue.size()); + } + break; + case CURLOPT_HTTPHEADER: + case CURLOPT_QUOTE: + case CURLOPT_HTTP200ALIASES: + case CURLOPT_POSTQUOTE: + if (value.is(KindOfArray) || value.is(KindOfObject)) { + Array arr = value.toArray(); + curl_slist *slist = NULL; + for (ArrayIter iter(arr); iter; ++iter) { + String key = iter.first().toString(); + String val = iter.second().toString(); + + char *indiv = strndup(val.data(), val.size()); + m_to_free->str.push_back(indiv); + + slist = curl_slist_append(slist, indiv); + if (!slist) { + Logger::Warning("Could not build curl_slist"); + return false; + } + } + + m_to_free->slist.push_back(slist); + m_error_no = curl_easy_setopt(m_cp, (CURLoption)option, slist); + + } else { + Logger::Warning("You must pass either an object or an array with the CURLOPT_HTTPHEADER, CURLOPT_QUOTE, CURLOPT_HTTP200ALIASES and CURLOPT_POSTQUOTE arguments"); + return false; + } + break; + + case CURLINFO_HEADER_OUT: + if (value.toInt64() == 1) { + curl_easy_setopt(m_cp, CURLOPT_DEBUGFUNCTION, curl_debug); + curl_easy_setopt(m_cp, CURLOPT_DEBUGDATA, (void *)this); + curl_easy_setopt(m_cp, CURLOPT_VERBOSE, 1); + } else { + curl_easy_setopt(m_cp, CURLOPT_DEBUGFUNCTION, NULL); + curl_easy_setopt(m_cp, CURLOPT_DEBUGDATA, NULL); + curl_easy_setopt(m_cp, CURLOPT_VERBOSE, 0); + } + break; + + default: + throw InvalidArgumentException("option", option); + } + + return m_error_no == CURLE_OK; + } + + static int curl_debug(CURL *cp, curl_infotype type, char *buf, + size_t buf_len, void *ctx) { + CurlResource *ch = (CurlResource *)ctx; + if (type == CURLINFO_HEADER_OUT && buf_len > 0) { + ch->m_header = String(buf, buf_len, CopyString); + } + return 0; + } + + static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) { + CurlResource *ch = (CurlResource *)ctx; + ReadHandler *t = &ch->m_read; + + int length = -1; + switch (t->method) { + case PHP_CURL_DIRECT: + if (t->fp) { + length = fread(data, size, nmemb, t->fp); + } + break; + case PHP_CURL_USER: + { + int data_size = size * nmemb; + Variant ret = f_call_user_func_array + (t->callback, CREATE_VECTOR3(Object(ch), t->fd, data_size)); + if (ret.isString()) { + String sret = ret.toString(); + length = data_size < sret.size() ? data_size : sret.size(); + memcpy(data, sret.data(), length); + } + break; + } + } + return length; + } + + static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx) { + CurlResource *ch = (CurlResource *)ctx; + WriteHandler *t = &ch->m_write; + size_t length = size * nmemb; + + switch (t->method) { + case PHP_CURL_STDOUT: + echo(String(data, length, AttachLiteral)); + break; + case PHP_CURL_FILE: + return fwrite(data, size, nmemb, t->fp); + case PHP_CURL_RETURN: + if (length > 0) { + t->buf.append(data, (int)length); + } + break; + case PHP_CURL_USER: + { + Variant ret = f_call_user_func_array + (t->callback, + CREATE_VECTOR2(Object(ch), String(data, length, CopyString))); + length = ret.toInt64(); + } + break; + } + + return length; + } + + static size_t curl_write_header(char *data, size_t size, size_t nmemb, + void *ctx) { + CurlResource *ch = (CurlResource *)ctx; + WriteHandler *t = &ch->m_write_header; + size_t length = size * nmemb; + + switch (t->method) { + case PHP_CURL_STDOUT: + // Handle special case write when we're returning the entire transfer + if (ch->m_write.method == PHP_CURL_RETURN && length > 0) { + ch->m_write.buf.append(data, (int)length); + } else { + echo(String(data, length, AttachLiteral)); + } + break; + case PHP_CURL_FILE: + return fwrite(data, size, nmemb, t->fp); + case PHP_CURL_USER: + { + Variant ret = f_call_user_func_array + (t->callback, + CREATE_VECTOR2(Object(ch), String(data, length, CopyString))); + length = ret.toInt64(); + } + break; + case PHP_CURL_IGNORE: + return length; + default: + return (size_t)-1; + } + + return length; + } + + CURL *get() { + if (m_cp == NULL) { + throw NullPointerException(); + } + return m_cp; + } + + int getError() { + return m_error_no; + } + + String getErrorString() { + return String(m_error_str, CopyString); + } + +private: + CURL *m_cp; + + char m_error_str[CURL_ERROR_SIZE + 1]; + CURLcode m_error_no; + + ToFreePtr m_to_free; + + String m_url; + String m_header; + + WriteHandler m_write; + WriteHandler m_write_header; + ReadHandler m_read; + + bool m_emptyPost; +}; +IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP(CurlResource); +void CurlResource::sweep() { + close(); +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_curl_init(CStrRef url /* = null_string */) { + return NEW(CurlResource)(url); +} + +Object f_curl_copy_handle(CObjRef ch) { + return NEW(CurlResource)(ch.getTyped()); +} + +Variant f_curl_version(int uversion /* = CURLVERSION_NOW */) { + curl_version_info_data *d = curl_version_info((CURLversion)uversion); + if (d == NULL) { + return false; + } + + Array ret; + ret.set("version_number", (int)d->version_num); + ret.set("age", d->age); + ret.set("features", d->features); + ret.set("ssl_version_number", d->ssl_version_num); + ret.set("version", d->version); + ret.set("host", d->host); + ret.set("ssl_version", d->ssl_version); + ret.set("libz_version", d->libz_version); + + // Add an array of protocols + char **p = (char **) d->protocols; + Array protocol_list; + while (*p != NULL) { + protocol_list.append(String(*p++, CopyString)); + } + ret.set("protocols", protocol_list); + + return ret; +} + +bool f_curl_setopt(CObjRef ch, int option, CVarRef value) { + return ch.getTyped()->setOption(option, value); +} + +bool f_curl_setopt_array(CObjRef ch, CArrRef options) { + CurlResource *curle = ch.getTyped(); + for (ArrayIter iter(options); iter; ++iter) { + if (!curle->setOption(iter.first().toInt32(), iter.second())) { + return false; + } + } + return true; +} + +Variant f_curl_exec(CObjRef ch) { + CurlResource *curl = ch.getTyped(); + return curl->execute(); +} + +Variant f_curl_getinfo(CObjRef ch, int opt /* = 0 */) { + CurlResource *curle = ch.getTyped(); + CURL *cp = curle->get(); + + if (opt == 0) { + char *s_code; + long l_code; + double d_code; + + Array ret; + if (curl_easy_getinfo(cp, CURLINFO_EFFECTIVE_URL, &s_code) == CURLE_OK) { + ret.set("url", String(s_code, CopyString)); + } + if (curl_easy_getinfo(cp, CURLINFO_CONTENT_TYPE, &s_code) == CURLE_OK && + s_code != NULL) { + ret.set("content_type", String(s_code, CopyString)); + } + if (curl_easy_getinfo(cp, CURLINFO_HTTP_CODE, &l_code) == CURLE_OK) { + ret.set("http_code", l_code); + } + if (curl_easy_getinfo(cp, CURLINFO_HEADER_SIZE, &l_code) == CURLE_OK) { + ret.set("header_size", l_code); + } + if (curl_easy_getinfo(cp, CURLINFO_REQUEST_SIZE, &l_code) == CURLE_OK) { + ret.set("request_size", l_code); + } + if (curl_easy_getinfo(cp, CURLINFO_FILETIME, &l_code) == CURLE_OK) { + ret.set("filetime", l_code); + } + if (curl_easy_getinfo(cp, CURLINFO_SSL_VERIFYRESULT, &l_code) == + CURLE_OK) { + ret.set("ssl_verify_result", l_code); + } + if (curl_easy_getinfo(cp, CURLINFO_REDIRECT_COUNT, &l_code) == CURLE_OK) { + ret.set("redirect_count", l_code); + } + if (curl_easy_getinfo(cp, CURLINFO_TOTAL_TIME, &d_code) == CURLE_OK) { + ret.set("total_time", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_NAMELOOKUP_TIME, &d_code) == CURLE_OK) { + ret.set("namelookup_time", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_CONNECT_TIME, &d_code) == CURLE_OK) { + ret.set("connect_time", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_PRETRANSFER_TIME, &d_code) == + CURLE_OK) { + ret.set("pretransfer_time", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_SIZE_UPLOAD, &d_code) == CURLE_OK) { + ret.set("size_upload", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_SIZE_DOWNLOAD, &d_code) == CURLE_OK) { + ret.set("size_download", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_SPEED_DOWNLOAD, &d_code) == CURLE_OK) { + ret.set("speed_download", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_SPEED_UPLOAD, &d_code) == CURLE_OK) { + ret.set("speed_upload", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d_code) == + CURLE_OK) { + ret.set("download_content_length", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_CONTENT_LENGTH_UPLOAD, &d_code) == + CURLE_OK) { + ret.set("upload_content_length", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_STARTTRANSFER_TIME, &d_code) == + CURLE_OK) { + ret.set("starttransfer_time", d_code); + } + if (curl_easy_getinfo(cp, CURLINFO_REDIRECT_TIME, &d_code) == CURLE_OK) { + ret.set("redirect_time", d_code); + } + String header = curle->getHeader(); + if (!header.empty()) { + ret.set("request_header", header); + } + return ret; + } + + switch (opt) { + case CURLINFO_PRIVATE: + case CURLINFO_EFFECTIVE_URL: + case CURLINFO_CONTENT_TYPE: { + char *s_code = NULL; + if (curl_easy_getinfo(cp, (CURLINFO)opt, &s_code) == CURLE_OK && + s_code) { + return String(s_code, CopyString); + } + return false; + } + case CURLINFO_HTTP_CODE: + case CURLINFO_HEADER_SIZE: + case CURLINFO_REQUEST_SIZE: + case CURLINFO_FILETIME: + case CURLINFO_SSL_VERIFYRESULT: + case CURLINFO_REDIRECT_COUNT: { + long code = 0; + if (curl_easy_getinfo(cp, (CURLINFO)opt, &code) == CURLE_OK) { + return code; + } + return false; + } + case CURLINFO_TOTAL_TIME: + case CURLINFO_NAMELOOKUP_TIME: + case CURLINFO_CONNECT_TIME: + case CURLINFO_PRETRANSFER_TIME: + case CURLINFO_SIZE_UPLOAD: + case CURLINFO_SIZE_DOWNLOAD: + case CURLINFO_SPEED_DOWNLOAD: + case CURLINFO_SPEED_UPLOAD: + case CURLINFO_CONTENT_LENGTH_DOWNLOAD: + case CURLINFO_CONTENT_LENGTH_UPLOAD: + case CURLINFO_STARTTRANSFER_TIME: + case CURLINFO_REDIRECT_TIME: { + double code = 0.0; + if (curl_easy_getinfo(cp, (CURLINFO)opt, &code) == CURLE_OK) { + return code; + } + return false; + } + case CURLINFO_HEADER_OUT: + { + String header = curle->getHeader(); + if (!header.empty()) { + return header; + } + return false; + } + } + + return null; +} + +int f_curl_errno(CObjRef ch) { + return ch.getTyped()->getError(); +} + +String f_curl_error(CObjRef ch) { + return ch.getTyped()->getErrorString(); +} + +void f_curl_close(CObjRef ch) { + ch.getTyped()->close(); +} + +/////////////////////////////////////////////////////////////////////////////// + +class CurlMultiResource : public SweepableResourceData { +public: + DECLARE_OBJECT_ALLOCATION(CurlMultiResource); + + // overriding ResourceData + const char *o_getClassName() const { return "cURL Multi Handle";} + + CurlMultiResource() { + m_multi = curl_multi_init(); + } + + ~CurlMultiResource() { + close(); + } + + void close() { + if (m_multi) { + curl_multi_cleanup(m_multi); + m_easyh.clear(); + m_multi = NULL; + } + } + + void add(CObjRef ch) { + m_easyh.append(ch); + } + + void remove(CurlResource *curle) { + for (ArrayIter iter(m_easyh); iter; ++iter) { + if (toObject(iter.second()).getTyped()->get() == + curle->get()) { + m_easyh.remove(iter.first()); + return; + } + } + } + + Object find(CURL *cp) { + for (ArrayIter iter(m_easyh); iter; ++iter) { + if (toObject(iter.second()).getTyped()->get() == cp) { + return iter.second(); + } + } + return Object(); + } + + CURLM *get() { + if (m_multi == NULL) { + throw NullPointerException(); + } + return m_multi; + } + +private: + int m_still_running; + CURLM *m_multi; + Array m_easyh; +}; +IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP(CurlMultiResource); +void CurlMultiResource::sweep() { + if (m_multi) { + curl_multi_cleanup(m_multi); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +Object f_curl_multi_init() { + return NEW(CurlMultiResource)(); +} + +int f_curl_multi_add_handle(CObjRef mh, CObjRef ch) { + CurlMultiResource *curlm = mh.getTyped(); + CurlResource *curle = ch.getTyped(); + curlm->add(ch); + return curl_multi_add_handle(curlm->get(), curle->get()); +} + +int f_curl_multi_remove_handle(CObjRef mh, CObjRef ch) { + CurlResource *curle = ch.getTyped(); + CurlMultiResource *curlm = mh.getTyped(); + curlm->remove(curle); + return curl_multi_remove_handle(curlm->get(), curle->get()); +} + +int f_curl_multi_exec(CObjRef mh, Variant still_running) { + CurlMultiResource *curlm = mh.getTyped(); + int running = still_running.toInt32(); + int result = curl_multi_perform(curlm->get(), &running); + still_running = running; + return result; +} + +int f_curl_multi_select(CObjRef mh, double timeout /* = 1.0 */) { + CurlMultiResource *curlm = mh.getTyped(); + + int ret; + unsigned long timeout_ms = (unsigned long)(timeout * 1000.0); + curl_multi_select(curlm->get(), timeout_ms, &ret); + return ret; +} + +String f_curl_multi_getcontent(CObjRef ch) { + CurlResource *curle = ch.getTyped(); + return curle->getContents(); +} + +Variant f_curl_multi_info_read(CObjRef mh, + Variant msgs_in_queue /* = null */) { + CurlMultiResource *curlm = mh.getTyped(); + + int queued_msgs; + CURLMsg *tmp_msg = curl_multi_info_read(curlm->get(), &queued_msgs); + if (tmp_msg == NULL) { + return false; + } + msgs_in_queue = queued_msgs; + + Array ret; + ret.set("msg", tmp_msg->msg); + ret.set("result", tmp_msg->data.result); + Object curle = curlm->find(tmp_msg->easy_handle); + if (!curle.isNull()) { + ret.set("handle", curle); + } + return ret; +} + +void f_curl_multi_close(CObjRef mh) { + mh.getTyped()->close(); +} + +/////////////////////////////////////////////////////////////////////////////// +// evhttp functions + +class LibEventHttpHandle : public ResourceData { +public: + DECLARE_OBJECT_ALLOCATION(LibEventHttpHandle); + + // overriding ResourceData + virtual const char *o_getClassName() const { return "LibEventHttp";} + + LibEventHttpHandle(LibEventHttpClientPtr client) : m_client(client) { + } + + ~LibEventHttpHandle() { + if (m_client) { + m_client->release(); + } + } + + LibEventHttpClientPtr m_client; +}; +IMPLEMENT_OBJECT_ALLOCATION(LibEventHttpHandle); + +static LibEventHttpClientPtr prepare_client +(CStrRef url, CStrRef data, CArrRef headers, int timeout, + bool async, bool post) { + string sUrl = url.data(); + if (sUrl.size() < 7 || sUrl.substr(0, 7) != "http://") { + Logger::Error("Invalid URL: %s", sUrl.c_str()); + return LibEventHttpClientPtr(); + } + + // parsing server address + size_t pos = sUrl.find('/', 7); + string path; + if (pos == string::npos) { + pos = sUrl.length(); + path = "/"; + } else if (pos == 7) { + Logger::Error("Invalid URL: %s", sUrl.c_str()); + return LibEventHttpClientPtr(); + } else { + path = sUrl.substr(pos); + } + string address = sUrl.substr(7, pos - 7); + + // parsing server port + pos = address.find(':'); + int port = 80; + if (pos != string::npos) { + if (pos < address.length() - 1) { + string sport = address.substr(pos + 1, address.length() - pos - 1); + port = atoi(sport.c_str()); + } + address = address.substr(0, pos); + } + + LibEventHttpClientPtr client = LibEventHttpClient::Get(address, port); + if (!client) { + return client; + } + + vector sheaders; + for (ArrayIter iter(headers); iter; ++iter) { + sheaders.push_back(iter.second().toString().data()); + } + if (!client->send(path.c_str(), sheaders, timeout, async, + post ? (void*)data.data() : NULL, + post ? data.size() : 0)) { + return LibEventHttpClientPtr(); + } + return client; +} + +static Array prepare_response(LibEventHttpClientPtr client) { + int len = 0; + char *res = client->recv(len); // block on return + + Array ret = Array::Create(); + ret.set("code", client->getCode()); + ret.set("response", String(res, len, AttachString)); + + Array headers = Array::Create(); + const vector &responseHeaders = client->getResponseHeaders(); + for (unsigned int i = 0; i < responseHeaders.size(); i++) { + headers.append(String(responseHeaders[i])); + } + ret.set("headers", headers); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +void f_evhttp_set_cache(CStrRef address, int max_conn, int port /* = 80 */) { + LibEventHttpClient::SetCache(address.data(), port, max_conn); +} + +Variant f_evhttp_get(CStrRef url, CArrRef headers /* = null_array */, + int timeout /* = 5 */) { + LibEventHttpClientPtr client = prepare_client(url, "", headers, timeout, + false, false); + if (client) { + return prepare_response(client); + } + return false; +} + +Variant f_evhttp_post(CStrRef url, CStrRef data, + CArrRef headers /* = null_array */, + int timeout /* = 5 */) { + LibEventHttpClientPtr client = prepare_client(url, data, headers, timeout, + false, true); + if (client) { + return prepare_response(client); + } + return false; +} + +Variant f_evhttp_async_get(CStrRef url, CArrRef headers /* = null_array */, + int timeout /* = 5 */) { + LibEventHttpClientPtr client = prepare_client(url, "", headers, timeout, + true, false); + if (client) { + return Object(NEW(LibEventHttpHandle)(client)); + } + return false; +} + +Variant f_evhttp_async_post(CStrRef url, CStrRef data, + CArrRef headers /* = null_array */, + int timeout /* = 5 */) { + LibEventHttpClientPtr client = prepare_client(url, data, headers, timeout, + true, true); + if (client) { + return Object(NEW(LibEventHttpHandle)(client)); + } + return false; +} + +Variant f_evhttp_recv(CObjRef handle) { + LibEventHttpHandle *obj = handle.getTyped(); + if (obj->m_client) { + return prepare_response(obj->m_client); + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_curl.h b/src/cpp/ext/ext_curl.h new file mode 100644 index 0000000000000..36bea331f46aa --- /dev/null +++ b/src/cpp/ext/ext_curl.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_CURL_H__ +#define __EXT_CURL_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< +#include +#include +#include + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_curl_init(CStrRef url = null_string); +Object f_curl_copy_handle(CObjRef ch); +Variant f_curl_version(int uversion = CURLVERSION_NOW); +bool f_curl_setopt(CObjRef ch, int option, CVarRef value); +bool f_curl_setopt_array(CObjRef ch, CArrRef options); +Variant f_curl_exec(CObjRef ch); +Variant f_curl_getinfo(CObjRef ch, int opt = 0); +int f_curl_errno(CObjRef ch); +String f_curl_error(CObjRef ch); +void f_curl_close(CObjRef ch); +Object f_curl_multi_init(); +int f_curl_multi_add_handle(CObjRef mh, CObjRef ch); +int f_curl_multi_remove_handle(CObjRef mh, CObjRef ch); +int f_curl_multi_exec(CObjRef mh, Variant still_running); +int f_curl_multi_select(CObjRef mh, double timeout = 1.0); +String f_curl_multi_getcontent(CObjRef ch); +Variant f_curl_multi_info_read(CObjRef mh, Variant msgs_in_queue = null); +void f_curl_multi_close(CObjRef mh); +void f_evhttp_set_cache(CStrRef address, int max_conn, int port = 80); +Variant f_evhttp_get(CStrRef url, CArrRef headers = null_array, int timeout = 5); +Variant f_evhttp_post(CStrRef url, CStrRef data, CArrRef headers = null_array, int timeout = 5); +Variant f_evhttp_async_get(CStrRef url, CArrRef headers = null_array, int timeout = 5); +Variant f_evhttp_async_post(CStrRef url, CStrRef data, CArrRef headers = null_array, int timeout = 5); +Variant f_evhttp_recv(CObjRef handle); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_CURL_H__ diff --git a/src/cpp/ext/ext_datetime.cpp b/src/cpp/ext/ext_datetime.cpp new file mode 100644 index 0000000000000..4d077ef05d42f --- /dev/null +++ b/src/cpp/ext/ext_datetime.cpp @@ -0,0 +1,150 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// constants + +const StaticString q_datetime_ATOM = "Y-m-d\\TH:i:sP"; +const StaticString q_datetime_COOKIE = "l, d-M-y H:i:s T"; +const StaticString q_datetime_ISO8601 = "Y-m-d\\TH:i:sO"; +const StaticString q_datetime_RFC822 = "D, d M y H:i:s O"; +const StaticString q_datetime_RFC850 = "l, d-M-y H:i:s T"; +const StaticString q_datetime_RFC1036 = "D, d M y H:i:s O"; +const StaticString q_datetime_RFC1123 = "D, d M Y H:i:s O"; +const StaticString q_datetime_RFC2822 = "D, d M Y H:i:s O"; +const StaticString q_datetime_RFC3339 = "Y-m-d\\TH:i:sP"; +const StaticString q_datetime_RSS = "D, d M Y H:i:s O"; +const StaticString q_datetime_W3C = "Y-m-d\\TH:i:sP"; + +const int64 q_datetimezone_AFRICA = 1; +const int64 q_datetimezone_AMERICA = 2; +const int64 q_datetimezone_ANTARCTICA = 4; +const int64 q_datetimezone_ARCTIC = 8; +const int64 q_datetimezone_ASIA = 16; +const int64 q_datetimezone_ATLANTIC = 32; +const int64 q_datetimezone_AUSTRALIA = 64; +const int64 q_datetimezone_EUROPE = 128; +const int64 q_datetimezone_INDIAN = 256; +const int64 q_datetimezone_PACIFIC = 512; +const int64 q_datetimezone_UTC = 1024; +const int64 q_datetimezone_ALL = 2047; +const int64 q_datetimezone_ALL_WITH_BC = 4095; +const int64 q_datetimezone_PER_COUNTRY = 4096; + +/////////////////////////////////////////////////////////////////////////////// +// methods + +c_datetime::c_datetime() { +} + +c_datetime::~c_datetime() { +} + +void c_datetime::t___construct(CStrRef time /*= "now"*/, + CObjRef timezone /*= null_object*/) { + m_dt = NEW(DateTime)(TimeStamp::Current()); + if (!time.empty()) { + m_dt->fromString(time, c_datetimezone::unwrap(timezone)); + } +} + +String c_datetime::t_format(CStrRef format) { + return m_dt->toString(format, false); +} + +int64 c_datetime::t_getoffset() { + return m_dt->offset(); +} + +Variant c_datetime::t_gettimezone() { + SmartObject tz = m_dt->timezone(); + if (tz->isValid()) { + return c_datetimezone::wrap(tz); + } + return false; +} + +Object c_datetime::t_modify(CStrRef modify) { + m_dt->modify(modify); + return this; +} + +Object c_datetime::t_setdate(int64 year, int64 month, int64 day) { + m_dt->setDate(year, month, day); + return this; +} + +Object c_datetime::t_setisodate(int64 year, int64 week, int64 day /*= 1*/) { + m_dt->setISODate(year, week, day); + return this; +} + +Object c_datetime::t_settime(int64 hour, int64 minute, int64 second /*= 0*/) { + m_dt->setTime(hour, minute, second); + return this; +} + +Object c_datetime::t_settimezone(CObjRef timezone) { + m_dt->setTimezone(c_datetimezone::unwrap(timezone)); + return this; +} + +Variant c_datetime::t___destruct() { + return null; +} + +c_datetimezone::c_datetimezone() { +} + +c_datetimezone::~c_datetimezone() { +} + +void c_datetimezone::t___construct(CStrRef timezone) { + m_tz = NEW(TimeZone)(timezone); +} + +String c_datetimezone::t_getname() { + return m_tz->name(); +} + +int64 c_datetimezone::t_getoffset(CObjRef datetime) { + bool error; + int64 ts = c_datetime::unwrap(datetime)->toTimeStamp(error); + return m_tz->offset(ts); +} + +Array c_datetimezone::t_gettransitions() { + return m_tz->transitions(); +} + +Array c_datetimezone::ti_listabbreviations(const char* cls) { + return TimeZone::GetAbbreviations(); +} + +Array c_datetimezone::ti_listidentifiers(const char* cls) { + return TimeZone::GetNames(); +} + +Variant c_datetimezone::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_datetime.h b/src/cpp/ext/ext_datetime.h new file mode 100644 index 0000000000000..13c9e8f93f11a --- /dev/null +++ b/src/cpp/ext/ext_datetime.h @@ -0,0 +1,387 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_DATETIME_H__ +#define __EXT_DATETIME_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// class DateTime + +extern const StaticString q_datetime_ATOM; +extern const StaticString q_datetime_COOKIE; +extern const StaticString q_datetime_ISO8601; +extern const StaticString q_datetime_RFC822; +extern const StaticString q_datetime_RFC850; +extern const StaticString q_datetime_RFC1036; +extern const StaticString q_datetime_RFC1123; +extern const StaticString q_datetime_RFC2822; +extern const StaticString q_datetime_RFC3339; +extern const StaticString q_datetime_RSS; +extern const StaticString q_datetime_W3C; + +FORWARD_DECLARE_CLASS(datetime); +class c_datetime : public ObjectData { + public: + BEGIN_CLASS_MAP(datetime) + END_CLASS_MAP(datetime) + DECLARE_CLASS(datetime, DateTime, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_datetime(); + public: ~c_datetime(); + public: void t___construct(CStrRef time = "now", + CObjRef timezone = null_object); + public: String t_format(CStrRef format); + public: int64 t_getoffset(); + public: Variant t_gettimezone(); + public: Object t_modify(CStrRef modify); + public: Object t_setdate(int64 year, int64 month, int64 day); + public: Object t_setisodate(int64 year, int64 week, int64 day = 1); + public: Object t_settime(int64 hour, int64 minute, int64 second = 0); + public: Object t_settimezone(CObjRef timezone); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(String time = "now", + Object timezone = null_object); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + // Helper for DateTime -> c_datetime conversion + public: static Object wrap(SmartObject dt) { + c_datetime *cdt = NEW(c_datetime)(); + Object ret(cdt); + cdt->m_dt = dt; + return ret; + } + + // Helper for c_datetime -> DateTime conversion + public: static SmartObject unwrap(CObjRef datetime) { + SmartObject cdt = datetime.getTyped(true); + if (cdt.get() == NULL) + return SmartObject(); + return cdt->m_dt; + } + + private: + SmartObject m_dt; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DateTimeZone + +extern const int64 q_datetimezone_AFRICA; +extern const int64 q_datetimezone_AMERICA; +extern const int64 q_datetimezone_ANTARCTICA; +extern const int64 q_datetimezone_ARCTIC; +extern const int64 q_datetimezone_ASIA; +extern const int64 q_datetimezone_ATLANTIC; +extern const int64 q_datetimezone_AUSTRALIA; +extern const int64 q_datetimezone_EUROPE; +extern const int64 q_datetimezone_INDIAN; +extern const int64 q_datetimezone_PACIFIC; +extern const int64 q_datetimezone_UTC; +extern const int64 q_datetimezone_ALL; +extern const int64 q_datetimezone_ALL_WITH_BC; +extern const int64 q_datetimezone_PER_COUNTRY; + +FORWARD_DECLARE_CLASS(datetimezone); +class c_datetimezone : public ObjectData { + public: + BEGIN_CLASS_MAP(datetimezone) + END_CLASS_MAP(datetimezone) + DECLARE_CLASS(datetimezone, DateTimeZone, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_datetimezone(); + public: ~c_datetimezone(); + public: void t___construct(CStrRef timezone); + public: String t_getname(); + public: int64 t_getoffset(CObjRef datetime); + public: Array t_gettransitions(); + public: static Array ti_listabbreviations(const char* cls); + public: static Array ti_listidentifiers(const char* cls); + public: static Array t_listabbreviations() { + return ti_listabbreviations("datetimezone"); + } + public: static Array t_listidentifiers() { + return ti_listidentifiers("datetimezone"); + } + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(String timezone); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + // Helper for TimeZone -> c_datetimezone conversion + public: static Object wrap(SmartObject tz) { + c_datetimezone *ctz = NEW(c_datetimezone)(); + Object ret(ctz); + ctz->m_tz = tz; + return ret; + } + + // Helper for c_datetimezone -> TimeZone conversion + public: static SmartObject unwrap(CObjRef timezone) { + SmartObject ctz = timezone.getTyped(true); + if (ctz.get() == NULL) + return SmartObject(); + return ctz->m_tz; + } + + private: + SmartObject m_tz; +}; + +/////////////////////////////////////////////////////////////////////////////// +// timestamp + +inline Variant f_gettimeofday(bool return_float = false) { + if (return_float) { + return TimeStamp::CurrentSecond(); + } + return TimeStamp::CurrentTime(); +} + +inline Variant f_microtime(bool get_as_float = false) { + if (get_as_float) { + return TimeStamp::CurrentSecond(); + } + return TimeStamp::CurrentMicroTime(); +} + +inline int f_time() { + return time(0); +} + +inline Variant f_mktime(int hour = -1, int minute = -1, int second = -1, + int month = -1, int day = -1, int year = -1) { + bool error; + int64 ts = TimeStamp::Get(error, hour, minute, second, month, day, year, + false); + if (error) return false; + return ts; +} + +inline Variant f_gmmktime(int hour = -1, int minute = -1, int second = -1, + int month = -1, int day = -1, int year = -1) { + bool error; + int64 ts = TimeStamp::Get(error, hour, minute, second, month, day, year, + true); + if (error) return false; + return ts; +} + +inline int64 f_idate(CStrRef format, int64 timestamp = TimeStamp::Current()) { + if (format.size() != 1) { + throw InvalidArgumentException("format", format.data()); + } + return DateTime(timestamp, false).toInteger(*format.data()); +} + +inline String f_date(CStrRef format, int64 timestamp = TimeStamp::Current()) { + return DateTime(timestamp, false).toString(format, false); +} + +inline String f_gmdate(CStrRef format, + int64 timestamp = TimeStamp::Current()) { + return DateTime(timestamp, true).toString(format, false); +} + +inline String f_strftime(CStrRef format, + int64 timestamp = TimeStamp::Current()) { + return DateTime(timestamp, false).toString(format, true); +} + +inline String f_gmstrftime(CStrRef format, + int64 timestamp = TimeStamp::Current()) { + return DateTime(timestamp, true).toString(format, true); +} + +inline Array f_getdate(int64 timestamp = TimeStamp::Current()) { + return DateTime(timestamp, false).toArray(DateTime::TimeMap); +} + +inline Array f_localtime(int64 timestamp = TimeStamp::Current(), + bool is_associative = false) { + DateTime::ArrayFormat format = + is_associative ? DateTime::TmMap : DateTime::TmVector; + return DateTime(timestamp, false).toArray(format); +} + +inline Variant f_strptime(CStrRef date, CStrRef format) { + Array ret = DateTime::Parse(date, format); + if (ret.empty()) { + return false; + } + return ret; +} + +inline Variant f_strtotime(CStrRef input, + int64 timestamp = TimeStamp::Current()) { + if (input.empty()) { + return false; + } + + DateTime dt(timestamp); + if (!dt.fromString(input, SmartObject())) { + return false; + } + bool error; + return dt.toTimeStamp(error); +} + +/////////////////////////////////////////////////////////////////////////////// +// timezone + +inline String f_date_default_timezone_get() { + return TimeZone::Current()->name(); +} + +inline bool f_date_default_timezone_set(CStrRef name) { + return TimeZone::SetCurrent(name); +} + +inline Array f_timezone_identifiers_list() { + return c_datetimezone::t_listidentifiers(); +} + +inline Array f_timezone_abbreviations_list() { + return c_datetimezone::t_listabbreviations(); +} + +inline Variant f_timezone_name_from_abbr(CStrRef abbr, int gmtoffset = -1, + bool isdst = true) { + String ret = TimeZone::AbbreviationToName(abbr, gmtoffset, isdst); + if (ret.isNull()) { + return false; + } + return ret; +} + +inline Object f_timezone_open(CStrRef timezone) { + c_datetimezone *ctz = NEW(c_datetimezone)(); + Object ret(ctz); + ctz->t___construct(timezone); + return ret; +} + +inline String f_timezone_name_get(CObjRef object) { + return object.getTyped()->t_getname(); +} + +inline int f_timezone_offset_get(CObjRef object, CObjRef dt) { + return object.getTyped()->t_getoffset(dt); +} + +inline Array f_timezone_transitions_get(CObjRef object) { + return object.getTyped()->t_gettransitions(); +} + +/////////////////////////////////////////////////////////////////////////////// +// datetime + +inline bool f_checkdate(int month, int day, int year) { + return DateTime::IsValid(year, month, day); +} + +inline Object f_date_create(CStrRef time = null_string, + CObjRef timezone = null_object) { + c_datetime *cdt = NEW(c_datetime)(); + Object ret(cdt); + cdt->t___construct(time, timezone); + return ret; +} + +inline void f_date_date_set(CObjRef object, int year, int month, int day) { + object.getTyped()->t_setdate(year, month, day); +} + +inline void f_date_isodate_set(CObjRef object, int year, int week, + int day = 1) { + object.getTyped()->t_setisodate(year, week, day); +} + +inline String f_date_format(CObjRef object, CStrRef format) { + return object.getTyped()->t_format(format); +} + +inline void f_date_modify(CObjRef object, CStrRef modify) { + object.getTyped()->t_modify(modify); +} + +inline int f_date_offset_get(CObjRef object) { + return object.getTyped()->t_getoffset(); +} + +inline Variant f_date_parse(CStrRef date) { + return DateTime::Parse(date); +} + +inline void f_date_time_set(CObjRef object, int hour, int minute, + int second = 0) { + object.getTyped()->t_settime(hour, minute, second); +} + +inline Variant f_date_timezone_get(CObjRef object) { + return object.getTyped()->t_gettimezone(); +} + +inline void f_date_timezone_set(CObjRef object, CObjRef timezone) { + object.getTyped()->t_settimezone(timezone); +} + +/////////////////////////////////////////////////////////////////////////////// +// sun + +inline Array f_date_sun_info(int64 ts, double latitude, double longitude) { + return DateTime(ts, false).getSunInfo(latitude, longitude); +} + +inline Variant f_date_sunrise(int64 timestamp, int format = 0, + double latitude = 0.0, double longitude = 0.0, + double zenith = 0.0, + double gmt_offset = 99999.0) { + return DateTime(timestamp, false).getSunInfo + (static_cast(format), latitude, longitude, + zenith, gmt_offset, false); +} + +inline Variant f_date_sunset(int64 timestamp, int format = 0, + double latitude = 0.0, double longitude = 0.0, + double zenith = 0.0, + double gmt_offset = 99999.0) { + return DateTime(timestamp, false).getSunInfo + (static_cast(format), latitude, longitude, + zenith, gmt_offset, true); +} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_DATETIME_H__ diff --git a/src/cpp/ext/ext_domdocument.cpp b/src/cpp/ext/ext_domdocument.cpp new file mode 100644 index 0000000000000..f363117d7799b --- /dev/null +++ b/src/cpp/ext/ext_domdocument.cpp @@ -0,0 +1,3254 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// domexception errors +typedef enum { +// PHP_ERR is non-spec code for PHP errors: + PHP_ERR = 0, + INDEX_SIZE_ERR = 1, + DOMSTRING_SIZE_ERR = 2, + HIERARCHY_REQUEST_ERR = 3, + WRONG_DOCUMENT_ERR = 4, + INVALID_CHARACTER_ERR = 5, + NO_DATA_ALLOWED_ERR = 6, + NO_MODIFICATION_ALLOWED_ERR = 7, + NOT_FOUND_ERR = 8, + NOT_SUPPORTED_ERR = 9, + INUSE_ATTRIBUTE_ERR = 10, +// Introduced in DOM Level 2: + INVALID_STATE_ERR = 11, +// Introduced in DOM Level 2: + SYNTAX_ERR = 12, +// Introduced in DOM Level 2: + INVALID_MODIFICATION_ERR = 13, +// Introduced in DOM Level 2: + NAMESPACE_ERR = 14, +// Introduced in DOM Level 2: + INVALID_ACCESS_ERR = 15, +// Introduced in DOM Level 3: + VALIDATION_ERR = 16 +} dom_exception_code; + +#define DOM_XMLNS_NAMESPACE \ + (const xmlChar *) "http://www.w3.org/2000/xmlns/" + +#define DOM_LOAD_STRING 0 +#define DOM_LOAD_FILE 1 + +#define LIBXML_SAVE_NOEMPTYTAG 1<<2 + +#define PHP_DOM_XPATH_QUERY 0 +#define PHP_DOM_XPATH_EVALUATE 1 + +#define VCWD_REALPATH(path, real_path) f_realpath(path, real_path) + +int dom_has_feature(char *feature, char *version) +{ + int retval = 0; + if (!(strcmp (version, "1.0") && strcmp (version,"2.0") && strcmp(version, ""))) { + if ((!strcasecmp(feature, "Core") && !strcmp (version, "1.0")) || !strcasecmp(feature, "XML")) + retval = 1; + } + return retval; +} + +void dom_normalize(xmlNodePtr nodep) +{ + xmlNodePtr child, nextp, newnextp; + xmlAttrPtr attr; + xmlChar *strContent; + child = nodep->children; + while(child != NULL) { + switch (child->type) { + case XML_TEXT_NODE: + nextp = child->next; + while (nextp != NULL) { + if (nextp->type == XML_TEXT_NODE) { + newnextp = nextp->next; + strContent = xmlNodeGetContent(nextp); + xmlNodeAddContent(child, strContent); + xmlFree(strContent); + xmlUnlinkNode(nextp); + nextp = newnextp; + } else { + break; + } + } + break; + case XML_ELEMENT_NODE: + dom_normalize (child); + attr = child->properties; + while (attr != NULL) { + dom_normalize((xmlNodePtr)attr); + attr = attr->next; + } + break; + case XML_ATTRIBUTE_NODE: + dom_normalize(child); + break; + default: + break; + } + child = child->next; + } +} + +static Variant dom_canonicalization(xmlNodePtr nodep, CStrRef file, bool exclusive, bool with_comments, CVarRef xpath_array, CVarRef ns_prefixes, int mode) +{ + xmlDocPtr docp; + xmlNodeSetPtr nodeset = NULL; + xmlChar **inclusive_ns_prefixes = NULL; + int ret = -1; + xmlOutputBufferPtr buf; + xmlXPathContextPtr ctxp=NULL; + xmlXPathObjectPtr xpathobjp=NULL; + + docp = nodep->doc; + if (!docp) { + return false; + } + if (xpath_array.isNull()) { + if (nodep->type != XML_DOCUMENT_NODE) { + ctxp = xmlXPathNewContext(docp); + ctxp->node = nodep; + xpathobjp = xmlXPathEvalExpression((xmlChar*)"(.//. | .//@* | .//namespace::*)", ctxp); + ctxp->node = NULL; + if (xpathobjp && xpathobjp->type == XPATH_NODESET) { + nodeset = xpathobjp->nodesetval; + } else { + if (xpathobjp) { + xmlXPathFreeObject(xpathobjp); + } + xmlXPathFreeContext(ctxp); + return false; + } + } + } else { + // xpath query from xpath_array + Array arr = xpath_array.toArray(); + String xquery; + if (!arr.exists("query")) + return false; + Variant tmp = arr.rvalAt("query"); + if(tmp.isString()) + return false; + xquery = tmp.toString(); + ctxp = xmlXPathNewContext(docp); + ctxp->node = nodep; + if (arr.exists("namespaces")) { + Variant tmp = arr.rvalAt("namespaces"); + if(tmp.isArray()) { + for (ArrayIter it = tmp.toArray().begin(); !it.end(); it.next()) { + Variant prefix = it.first(); + Variant tmpns = it.second(); + if (prefix.isString() || tmpns.isString()) { + xmlXPathRegisterNs(ctxp, (xmlChar*)prefix.toString().data(), (xmlChar*)tmpns.toString().data()); + } + } + } + } + xpathobjp = xmlXPathEvalExpression((xmlChar*)xquery.data(), ctxp); + ctxp->node = NULL; + if (xpathobjp && xpathobjp->type == XPATH_NODESET) { + nodeset = xpathobjp->nodesetval; + } else { + if (xpathobjp) { + xmlXPathFreeObject(xpathobjp); + } + xmlXPathFreeContext(ctxp); + return false; + } + } + if (!ns_prefixes.isNull()) { + if (exclusive) { + int nscount = 0; + inclusive_ns_prefixes = (xmlChar**)malloc((ns_prefixes.toArray().size()+1) * sizeof(xmlChar *)); + for (ArrayIter it = ns_prefixes.toArray().begin(); !it.end(); it.next()) { + Variant tmpns = it.second(); + if (tmpns.isString()) { + inclusive_ns_prefixes[nscount++] = (xmlChar*)tmpns.toString().data(); + } + } + inclusive_ns_prefixes[nscount] = NULL; + } else { + //php_error_docref(NULL TSRMLS_CC, E_NOTICE, + // "Inclusive namespace prefixes only allowed in exlcusive mode."); + } + } + if (mode == 1) { + buf = xmlOutputBufferCreateFilename(file, NULL, 0); + } else { + buf = xmlAllocOutputBuffer(NULL); + } + if (buf != NULL) { + ret = xmlC14NDocSaveTo(docp, nodeset, exclusive, inclusive_ns_prefixes, + with_comments, buf); + } + if (inclusive_ns_prefixes != NULL) { + free(inclusive_ns_prefixes); + } + if (xpathobjp != NULL) { + xmlXPathFreeObject(xpathobjp); + } + if (ctxp != NULL) { + xmlXPathFreeContext(ctxp); + } + Variant retval; + if (buf == NULL || ret < 0) { + retval = false; + } else { + if (mode == 0) { + ret = buf->buffer->use; + if (ret > 0) { + retval = String((char *)buf->buffer->content, ret, CopyString); + } else { + retval = String(); + } + } + } + if (buf) { + int bytes; + bytes = xmlOutputBufferClose(buf); + if (mode == 1 && (ret >= 0)) { + retval = bytes; + } + } + return retval; +} + +bool dom_node_children_valid(xmlNodePtr node) { + switch (node->type) { + case XML_DOCUMENT_TYPE_NODE: + case XML_DTD_NODE: + case XML_PI_NODE: + case XML_COMMENT_NODE: + case XML_TEXT_NODE: + case XML_CDATA_SECTION_NODE: + case XML_NOTATION_NODE: + return false; + break; + default: + return true; + } +} + +bool dom_node_is_read_only(xmlNodePtr node) { + switch (node->type) { + case XML_ENTITY_REF_NODE: + case XML_ENTITY_NODE: + case XML_DOCUMENT_TYPE_NODE: + case XML_NOTATION_NODE: + case XML_DTD_NODE: + case XML_ELEMENT_DECL: + case XML_ATTRIBUTE_DECL: + case XML_ENTITY_DECL: + case XML_NAMESPACE_DECL: + return true; + break; + default: + if (node->doc == NULL) { + return true; + } else { + return false; + } + } +} + +void dom_set_old_ns(xmlDoc *doc, xmlNs *ns) { + xmlNs *cur; + if (doc == NULL) + return; + if (doc->oldNs == NULL) { + doc->oldNs = (xmlNsPtr) xmlMalloc(sizeof(xmlNs)); + if (doc->oldNs == NULL) { + return; + } + memset(doc->oldNs, 0, sizeof(xmlNs)); + doc->oldNs->type = XML_LOCAL_NAMESPACE; + doc->oldNs->href = xmlStrdup(XML_XML_NAMESPACE); + doc->oldNs->prefix = xmlStrdup((const xmlChar *)"xml"); + } + cur = doc->oldNs; + while (cur->next != NULL) { + cur = cur->next; + } + cur->next = ns; +} + +static void dom_reconcile_ns(xmlDocPtr doc, xmlNodePtr nodep) +{ + xmlNsPtr nsptr, nsdftptr, curns, prevns = NULL; + if (nodep->type == XML_ELEMENT_NODE) { + // Following if block primarily used for inserting nodes created via createElementNS + if (nodep->nsDef != NULL) { + curns = nodep->nsDef; + while (curns) { + nsdftptr = curns->next; + if (curns->href != NULL) { + if((nsptr = xmlSearchNsByHref(doc, nodep->parent, curns->href)) && + (curns->prefix == NULL || xmlStrEqual(nsptr->prefix, curns->prefix))) { + curns->next = NULL; + if (prevns == NULL) { + nodep->nsDef = nsdftptr; + } else { + prevns->next = nsdftptr; + } + dom_set_old_ns(doc, curns); + curns = prevns; + } + } + prevns = curns; + curns = nsdftptr; + } + } + xmlReconciliateNs(doc, nodep); + } +} + +bool dom_hierarchy(xmlNodePtr parent, xmlNodePtr child) +{ + xmlNodePtr nodep; + if (parent == NULL || child == NULL || child->doc != parent->doc) { + return true; + } + nodep = parent; + while (nodep) { + if (nodep == child) { + return false; + } + nodep = nodep->parent; + } + return true; +} + +static xmlNodePtr _php_dom_insert_fragment(xmlNodePtr nodep, xmlNodePtr prevsib, xmlNodePtr nextsib, xmlNodePtr fragment) +{ + xmlNodePtr newchild, node; + newchild = fragment->children; + if (newchild) { + if (prevsib == NULL) { + nodep->children = newchild; + } else { + prevsib->next = newchild; + } + newchild->prev = prevsib; + if (nextsib == NULL) { + nodep->last = fragment->last; + } else { + fragment->last->next = nextsib; + nextsib->prev = fragment->last; + } + node = newchild; + while (node != NULL) { + node->parent = nodep; + if (node->doc != nodep->doc) { + xmlSetTreeDoc(node, nodep->doc); + if (node->_private != NULL) { + //childobj = node->_private; + //childobj->document = intern->document; + //php_libxml_increment_doc_ref((php_libxml_node_object *)childobj, NULL TSRMLS_CC); + } + } + if (node == fragment->last) { + break; + } + node = node->next; + } + fragment->children = NULL; + fragment->last = NULL; + } + return newchild; +} + +int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, int name_len) { + if (name_len == 0) { + return NAMESPACE_ERR; + } + *localname = (char *)xmlSplitQName2((xmlChar *)qname, (xmlChar **) prefix); + if (*localname == NULL) { + *localname = (char *)xmlStrdup((xmlChar *)qname); + if (*prefix == NULL && uri_len == 0) { + return 0; + } + } + if (xmlValidateQName((xmlChar *) qname, 0) != 0) { + return NAMESPACE_ERR; + } + if (*prefix != NULL && uri_len == 0) { + return NAMESPACE_ERR; + } + return 0; +} + +xmlNsPtr dom_get_ns(xmlNodePtr nodep, char *uri, int *errorcode, char *prefix) { + xmlNsPtr nsptr = NULL; + *errorcode = 0; + if (! ((prefix && !strcmp (prefix, "xml") && strcmp(uri, (char *)XML_XML_NAMESPACE)) || + (prefix && !strcmp (prefix, "xmlns") && strcmp(uri, (char *)DOM_XMLNS_NAMESPACE)) || + (prefix && !strcmp(uri, (char *)DOM_XMLNS_NAMESPACE) && strcmp (prefix, "xmlns")))) { + nsptr = xmlNewNs(nodep, (xmlChar *)uri, (xmlChar *)prefix); + } + if (nsptr == NULL) { + *errorcode = NAMESPACE_ERR; + } + return nsptr; +} + +char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_path_len) +{ + xmlURI *uri; + xmlChar *escsource; + char *file_dest; + int isFileUri = 0; + + uri = xmlCreateURI(); + escsource = xmlURIEscapeStr((xmlChar*)source, (xmlChar*)":"); + xmlParseURIReference(uri, (char*)escsource); + xmlFree(escsource); + + if (uri->scheme != NULL) { + /* absolute file uris - libxml only supports localhost or empty host */ + if (strncasecmp(source, "file:///",8) == 0) { + isFileUri = 1; + source += 7; + } else if (strncasecmp(source, "file://localhost/",17) == 0) { + isFileUri = 1; + source += 16; + } + } + + file_dest = source; + + /* + if ((uri->scheme == NULL || isFileUri)) { + // XXX possible buffer overflow if VCWD_REALPATH does not know size of resolved_path + if (!VCWD_REALPATH(source, resolved_path)) && !expand_filepath(source, resolved_path)) { + xmlFreeURI(uri); + return NULL; + } + file_dest = resolved_path; + } + */ + + xmlFreeURI(uri); + + return file_dest; +} + +static xmlDocPtr dom_document_parser(int mode, char *source, int options) +{ + xmlDocPtr ret; + xmlParserCtxtPtr ctxt = NULL; + //dom_doc_propsptr doc_props; + //dom_object *intern; + //php_libxml_ref_obj *document = NULL; + //int validate, recover, resolve_externals, keep_blanks, substitute_ent; + int resolved_path_len; + //int old_error_reporting = 0; + char *directory=NULL, resolved_path[4096]; + + /*if (id != NULL) { + intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); + document = intern->document; + }*/ + + /* + doc_props = dom_get_doc_props(document); + validate = doc_props->validateonparse; + resolve_externals = doc_props->resolveexternals; + keep_blanks = doc_props->preservewhitespace; + substitute_ent = doc_props->substituteentities; + recover = doc_props->recover; + */ + + /*if (document == NULL) { + efree(doc_props); + }*/ + + xmlInitParser(); + + if (mode == DOM_LOAD_FILE) { + char *file_dest = _dom_get_valid_file_path(source, resolved_path, 4096); + if (file_dest) { + ctxt = xmlCreateFileParserCtxt(file_dest); + } + } else { + ctxt = xmlCreateDocParserCtxt((xmlChar*)source); + } + + if (ctxt == NULL) { + return(NULL); + } + + /* If loading from memory, we need to set the base directory for the document */ + if (mode != DOM_LOAD_FILE) { +#if HAVE_GETCWD + directory = VCWD_GETCWD(resolved_path, 4096); +#elif HAVE_GETWD + directory = VCWD_GETWD(resolved_path); +#endif + if (directory) { + if(ctxt->directory != NULL) { + xmlFree((char *) ctxt->directory); + } + resolved_path_len = strlen(resolved_path); + if (resolved_path[resolved_path_len - 1] != '/') { + resolved_path[resolved_path_len] = '/'; + resolved_path[++resolved_path_len] = '\0'; + } + ctxt->directory = (char*)xmlCanonicPath((const xmlChar*)resolved_path); + } + } + + /* + ctxt->vctxt.error = php_libxml_ctx_error; + ctxt->vctxt.warning = php_libxml_ctx_warning; + + if (ctxt->sax != NULL) { + ctxt->sax->error = php_libxml_ctx_error; + ctxt->sax->warning = php_libxml_ctx_warning; + } + */ + + /* + if (validate && ! (options & XML_PARSE_DTDVALID)) { + options |= XML_PARSE_DTDVALID; + } + if (resolve_externals && ! (options & XML_PARSE_DTDATTR)) { + options |= XML_PARSE_DTDATTR; + } + if (substitute_ent && ! (options & XML_PARSE_NOENT)) { + options |= XML_PARSE_NOENT; + } + if (keep_blanks == 0 && ! (options & XML_PARSE_NOBLANKS)) { + options |= XML_PARSE_NOBLANKS; + } + */ + + xmlCtxtUseOptions(ctxt, options); + + /*ctxt->recovery = recover; + if (recover) { + old_error_reporting = EG(error_reporting); + EG(error_reporting) = old_error_reporting | E_WARNING; + }*/ + + xmlParseDocument(ctxt); + + //if (ctxt->wellFormed || recover) { + ret = ctxt->myDoc; + /*if (ctxt->recovery) { + EG(error_reporting) = old_error_reporting; + }*/ + /* If loading from memory, set the base reference uri for the document */ + if (ret && ret->URL == NULL && ctxt->directory != NULL) { + ret->URL = xmlStrdup((xmlChar*)ctxt->directory); + } + /* + } else { + ret = NULL; + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = NULL; + } + */ + + xmlFreeParserCtxt(ctxt); + + return(ret); +} + +static Variant dom_parse_document(c_domdocument * domdoc, CStrRef source, int options, int mode) { + //xmlDocPtr docp = (xmlDocPtr)domdoc->m_node; + xmlDoc *newdoc; + //dom_doc_propsptr doc_prop; + //int refcount; + if (source.size() == 0) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string supplied as input"); + return false; + } + newdoc = dom_document_parser(mode, (char*)source.data(), options); + if (!newdoc) + return false; + + domdoc->m_node = (xmlNodePtr)newdoc; + return true; + + // Hmm... + /* + if (id != NULL) { + docp = (xmlDocPtr) dom_object_get_node(intern); + doc_prop = NULL; + if (docp != NULL) { + php_libxml_decrement_node_ptr((php_libxml_node_object *) intern TSRMLS_CC); + doc_prop = intern->document->doc_props; + intern->document->doc_props = NULL; + refcount = php_libxml_decrement_doc_ref((php_libxml_node_object *)intern TSRMLS_CC); + if (refcount != 0) { + docp->_private = NULL; + } + } + intern->document = NULL; + if (php_libxml_increment_doc_ref((php_libxml_node_object *)intern, newdoc TSRMLS_CC) == -1) { + return false; + } + intern->document->doc_props = doc_prop; + } + php_libxml_increment_node_ptr((php_libxml_node_object *)intern, (xmlNodePtr)newdoc, (void *)intern TSRMLS_CC); + return true; + } else { + SmartObject ret = NEW(c_domdocument)(); + ret->m_node = (xmlNodePtr)newdoc; + return ret; + } + */ +} + +static Variant dom_load_html(c_domdocument * domdoc, CStrRef source, int mode) +{ + //SmartObject domdoc = obj.getTyped(); + //xmlDocPtr docp = (xmlDocPtr)domdoc->m_node; + xmlDoc *newdoc; + //int refcount; + htmlParserCtxtPtr ctxt; + if (source.size() == 0) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty string supplied as input"); + return false; + } + if (mode == DOM_LOAD_FILE) { + ctxt = htmlCreateFileParserCtxt(source.data(), NULL); + } else { + //source_len = xmlStrlen(source); + ctxt = htmlCreateMemoryParserCtxt(source.data(), source.size()); + } + if (!ctxt) { + return false; + } + /* + ctxt->vctxt.error = php_libxml_ctx_error; + ctxt->vctxt.warning = php_libxml_ctx_warning; + if (ctxt->sax != NULL) { + ctxt->sax->error = php_libxml_ctx_error; + ctxt->sax->warning = php_libxml_ctx_warning; + } + */ + htmlParseDocument(ctxt); + newdoc = ctxt->myDoc; + htmlFreeParserCtxt(ctxt); + if (!newdoc) + return false; + /* + if (id != NULL && instanceof_function(Z_OBJCE_P(id), dom_document_class_entry TSRMLS_CC)) { + intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); + if (intern != NULL) { + docp = (xmlDocPtr) dom_object_get_node(intern); + doc_prop = NULL; + if (docp != NULL) { + php_libxml_decrement_node_ptr((php_libxml_node_object *) intern TSRMLS_CC); + doc_prop = intern->document->doc_props; + intern->document->doc_props = NULL; + //refcount = php_libxml_decrement_doc_ref((php_libxml_node_object *)intern TSRMLS_CC); + //if (refcount != 0) { + // docp->_private = NULL; + //} + } + intern->document = NULL; + //if (php_libxml_increment_doc_ref((php_libxml_node_object *)intern, newdoc TSRMLS_CC) == -1) { + // return false; + //} + intern->document->doc_props = doc_prop; + } + //php_libxml_increment_node_ptr((php_libxml_node_object *)intern, (xmlNodePtr)newdoc, (void *)intern TSRMLS_CC); + return true; + } else {*/ + SmartObject ret = NEW(c_domdocument)(); + ret->m_node = (xmlNodePtr)newdoc; + return ret; + /*}*/ +} + +bool _dom_document_relaxNG_validate(c_domdocument * domdoc, CStrRef source, int type) { + char *valid_file = NULL; + xmlRelaxNGParserCtxtPtr parser; + xmlRelaxNGPtr sptr; + xmlRelaxNGValidCtxtPtr vptr; + int is_valid; + char resolved_path[4096 + 1]; + + if (source.size() == 0) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema source"); + return false; + } + + xmlDocPtr docp = (xmlDocPtr)domdoc->m_node; + + switch (type) { + case DOM_LOAD_FILE: + valid_file = _dom_get_valid_file_path((char*)source.data(), resolved_path, 4096); + if (!valid_file) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG file source"); + return false; + } + parser = xmlRelaxNGNewParserCtxt(valid_file); + break; + case DOM_LOAD_STRING: + parser = xmlRelaxNGNewMemParserCtxt(source.data(), source.size()); + /* If loading from memory, we need to set the base directory for the document· + but it is not apparent how to do that for schema's */ + break; + default: + return false; + } + + /*xmlRelaxNGSetParserErrors(parser, + (xmlRelaxNGValidityErrorFunc) php_libxml_error_handler, + (xmlRelaxNGValidityWarningFunc) php_libxml_error_handler, + parser);*/ + sptr = xmlRelaxNGParse(parser); + xmlRelaxNGFreeParserCtxt(parser); + if (!sptr) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid RelaxNG"); + return false; + } + + //docp = (xmlDocPtr) dom_object_get_node(intern); + + vptr = xmlRelaxNGNewValidCtxt(sptr); + if (!vptr) { + xmlRelaxNGFree(sptr); + //php_error(E_ERROR, "Invalid RelaxNG Validation Context"); + return false; + } + + //xmlRelaxNGSetValidErrors(vptr, php_libxml_error_handler, php_libxml_error_handler, vptr); + is_valid = xmlRelaxNGValidateDoc(vptr, docp); + xmlRelaxNGFree(sptr); + xmlRelaxNGFreeValidCtxt(vptr); + + if (is_valid == 0) { + return true; + } else { + return false; + } +} + +bool _dom_document_schema_validate(c_domdocument * domdoc, CStrRef source, int type) +{ + xmlDocPtr docp = (xmlDocPtr)domdoc->m_node; + char *valid_file = NULL; + xmlSchemaParserCtxtPtr parser; + xmlSchemaPtr sptr; + xmlSchemaValidCtxtPtr vptr; + int is_valid; + char resolved_path[4096 + 1]; + + if (source.size() == 0) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema source"); + return false; + } + + switch (type) { + case DOM_LOAD_FILE: + valid_file = _dom_get_valid_file_path((char*)source.data(), resolved_path, 4096); + if (!valid_file) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema file source"); + return false; + } + parser = xmlSchemaNewParserCtxt(valid_file); + break; + case DOM_LOAD_STRING: + parser = xmlSchemaNewMemParserCtxt(source.data(), source.size()); + /* If loading from memory, we need to set the base directory for the document· + but it is not apparent how to do that for schema's */ + break; + default: + return false; + } + + /*xmlSchemaSetParserErrors(parser, + (xmlSchemaValidityErrorFunc) php_libxml_error_handler, + (xmlSchemaValidityWarningFunc) php_libxml_error_handler, + parser);*/ + sptr = xmlSchemaParse(parser); + xmlSchemaFreeParserCtxt(parser); + if (!sptr) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Schema"); + return false; + } + + vptr = xmlSchemaNewValidCtxt(sptr); + if (!vptr) { + xmlSchemaFree(sptr); + //php_error(E_ERROR, "Invalid Schema Validation Context"); + return false; + } + + /*xmlSchemaSetValidErrors(vptr, php_libxml_error_handler, php_libxml_error_handler, vptr);*/ + is_valid = xmlSchemaValidateDoc(vptr, docp); + xmlSchemaFree(sptr); + xmlSchemaFreeValidCtxt(vptr); + + if (is_valid == 0) { + return true; + } else { + return false; + } +} + +static xmlNodePtr php_dom_free_xinclude_node(xmlNodePtr cur) +{ + xmlNodePtr xincnode; + xincnode = cur; + cur = cur->next; + xmlUnlinkNode(xincnode); + //php_libxml_node_free_resource(xincnode); + return cur; +} + +static void php_dom_remove_xinclude_nodes(xmlNodePtr cur) +{ + while(cur) { + if (cur->type == XML_XINCLUDE_START) { + cur = php_dom_free_xinclude_node(cur); + /* XML_XINCLUDE_END node will be a sibling of XML_XINCLUDE_START */ + while(cur && cur->type != XML_XINCLUDE_END) { + /* remove xinclude processing nodes from recursive xincludes */ + if (cur->type == XML_ELEMENT_NODE) { + php_dom_remove_xinclude_nodes(cur->children); + } + cur = cur->next; + } + + if (cur && cur->type == XML_XINCLUDE_END) { + cur = php_dom_free_xinclude_node(cur); + } + } else { + if (cur->type == XML_ELEMENT_NODE) { + php_dom_remove_xinclude_nodes(cur->children); + } + cur = cur->next; + } + } +} + +static void php_dom_xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) +{ + xmlAttrPtr prop; + xmlNodePtr cur; + if (tree) { + if(tree->type == XML_ELEMENT_NODE) { + prop = tree->properties; + while (prop != NULL) { + prop->doc = doc; + if (prop->children) { + cur = prop->children; + while (cur != NULL) { + php_dom_xmlSetTreeDoc(cur, doc); + cur = cur->next; + } + } + prop = prop->next; + } + } + if (tree->children != NULL) { + cur = tree->children; + while (cur != NULL) { + php_dom_xmlSetTreeDoc(cur, doc); + cur = cur->next; + } + } + tree->doc = doc; + } +} + +static xmlNodePtr dom_get_dom1_attribute(xmlNodePtr elem, xmlChar *name) +{ + int len; + const xmlChar *nqname; + nqname = xmlSplitQName3(name, &len); + if (nqname != NULL) { + xmlNsPtr ns; + xmlChar *prefix = xmlStrndup(name, len); + if (prefix && xmlStrEqual(prefix, (xmlChar*)"xmlns")) { + ns = elem->nsDef; + while (ns) { + if (xmlStrEqual(ns->prefix, nqname)) { + break; + } + ns = ns->next; + } + xmlFree(prefix); + return (xmlNodePtr)ns; + } + ns = xmlSearchNs(elem->doc, elem, prefix); + if (prefix != NULL) { + xmlFree(prefix); + } + if (ns != NULL) { + return (xmlNodePtr)xmlHasNsProp(elem, nqname, ns->href); + } + } else { + if (xmlStrEqual(name, (xmlChar*)"xmlns")) { + xmlNsPtr nsPtr = elem->nsDef; + while (nsPtr) { + if (nsPtr->prefix == NULL) { + return (xmlNodePtr)nsPtr; + } + nsPtr = nsPtr->next; + } + return NULL; + } + } + return (xmlNodePtr)xmlHasNsProp(elem, name, NULL); +} + +xmlNsPtr dom_get_nsdecl(xmlNode *node, xmlChar *localName) { + xmlNsPtr cur; + xmlNs *ret = NULL; + if (node == NULL) + return NULL; + if (localName == NULL || xmlStrEqual(localName, (xmlChar *)"")) { + cur = node->nsDef; + while (cur != NULL) { + if (cur->prefix == NULL && cur->href != NULL) { + ret = cur; + break; + } + cur = cur->next; + } + } else { + cur = node->nsDef; + while (cur != NULL) { + if (cur->prefix != NULL && xmlStrEqual(localName, cur->prefix)) { + ret = cur; + break; + } + cur = cur->next; + } + } + return ret; +} + +static Variant php_xpath_eval(c_domxpath * domxpath, CStrRef expr, CObjRef context, int type) /* {{{ */ +{ + xmlXPathObjectPtr xpathobjp; + int nsnbr = 0, xpath_type; + xmlDoc *docp = NULL; + xmlNsPtr *ns; + xmlXPathContextPtr ctxp = (xmlXPathContextPtr)domxpath->m_node; + if (ctxp == NULL) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid XPath Context"); + return false; + } + docp = (xmlDocPtr)ctxp->doc; + if (docp == NULL) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid XPath Document Pointer"); + return false; + } + xmlNodePtr nodep = NULL; + if (!context.isNull()) { + SmartObject domxpath = context.getTyped(); + nodep = domxpath->m_node; + } + if (!nodep) { + nodep = xmlDocGetRootElement(docp); + } + if (nodep && docp != nodep->doc) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Node From Wrong Document"); + return false; + } + ctxp->node = nodep; + /* Register namespaces in the node */ + ns = xmlGetNsList(docp, nodep); + if (ns != NULL) { + while (ns[nsnbr] != NULL) + nsnbr++; + } + ctxp->namespaces = ns; + ctxp->nsNr = nsnbr; + xpathobjp = xmlXPathEvalExpression((xmlChar*)expr.data(), ctxp); + ctxp->node = NULL; + if (ns != NULL) { + xmlFree(ns); + ctxp->namespaces = NULL; + ctxp->nsNr = 0; + } + if (!xpathobjp) { + return false; + } + if (type == PHP_DOM_XPATH_QUERY) { + xpath_type = XPATH_NODESET; + } else { + xpath_type = xpathobjp->type; + } + Variant ret; + switch (xpath_type) { + case XPATH_NODESET: + { + int i; + xmlNodeSetPtr nodesetp; + Array retval = Array::Create(); + if (xpathobjp->type == XPATH_NODESET && NULL != (nodesetp = xpathobjp->nodesetval)) { + for (i = 0; i < nodesetp->nodeNr; i++) { + xmlNodePtr node = nodesetp->nodeTab[i]; + if (node->type == XML_NAMESPACE_DECL) { + xmlNsPtr curns; + //xmlNodePtr nsparent; + //nsparent = node->_private; + curns = xmlNewNs(NULL, node->name, NULL); + if (node->children) { + curns->prefix = xmlStrdup((xmlChar*)node->children); + } + if (node->children) { + node = xmlNewDocNode(docp, NULL, (xmlChar*)node->children, node->name); + } else { + node = xmlNewDocNode(docp, NULL, (xmlChar*)"xmlns", node->name); + } + node->type = XML_NAMESPACE_DECL; + //node->parent = nsparent; + node->ns = curns; + } + // Ugh, the statement below creates a new object and adds it to an array... + SmartObject child = NEW(c_domnode)(); + child->m_node = node; + retval.append(child); + } + } + // TODO: Return a nodelist object instead of an array.. + ret = retval; + break; + } + case XPATH_BOOLEAN: + ret = (bool)(xpathobjp->boolval); + break; + case XPATH_NUMBER: + ret = (double)(xpathobjp->floatval); + break; + case XPATH_STRING: + ret = String((char*)xpathobjp->stringval, CopyString); + break; + default: + ret = null; + break; + } + xmlXPathFreeObject(xpathobjp); + return ret; +} + +void node_list_unlink(xmlNodePtr node) +{ + //dom_object *wrapper; + while (node != NULL) { + //wrapper = php_dom_object_get_data(node); + //if (wrapper != NULL) { + // xmlUnlinkNode(node); + //} else { + if (node->type == XML_ENTITY_REF_NODE) + break; + node_list_unlink(node->children); + switch (node->type) { + case XML_ATTRIBUTE_DECL: + case XML_DTD_NODE: + case XML_DOCUMENT_TYPE_NODE: + case XML_ENTITY_DECL: + case XML_ATTRIBUTE_NODE: + case XML_TEXT_NODE: + break; + default: + node_list_unlink((xmlNodePtr)node->properties); + } + //} + node = node->next; + } +} + +static void php_set_attribute_id(xmlAttrPtr attrp, bool is_id) +{ + if (is_id == 1 && attrp->atype != XML_ATTRIBUTE_ID) { + xmlChar *id_val; + id_val = xmlNodeListGetString(attrp->doc, attrp->children, 1); + if (id_val != NULL) { + xmlAddID(NULL, attrp->doc, id_val, attrp); + xmlFree(id_val); + } + } else { + if (attrp->atype == XML_ATTRIBUTE_ID) { + xmlRemoveID(attrp->doc, attrp); + attrp->atype = (xmlAttributeType)0; + } + } +} + +static xmlNsPtr _dom_new_reconNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) +{ + xmlNsPtr def; + xmlChar prefix[50]; + int counter = 1; + if ((tree == NULL) || (ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) { + return NULL; + } + /* Code taken from libxml2 (2.6.20) xmlNewReconciliedNs + * + * Find a close prefix which is not already in use. + * Let's strip namespace prefixes longer than 20 chars! + */ + if (ns->prefix == NULL) + snprintf((char*)prefix, sizeof(prefix), "default"); + else + snprintf((char*)prefix, sizeof(prefix), "%.20s", (char *)ns->prefix); + def = xmlSearchNs(doc, tree, prefix); + while (def != NULL) { + if (counter > 1000) return(NULL); + if (ns->prefix == NULL) + snprintf((char*)prefix, sizeof(prefix), "default%d", counter++); + else + snprintf((char*)prefix, sizeof(prefix), "%.20s%d", + (char*)ns->prefix, counter++); + def = xmlSearchNs(doc, tree, prefix); + } + /* + * OK, now we are ready to create a new one. + */ + def = xmlNewNs(tree, ns->href, prefix); + return(def); +} + + +/////////////////////////////////////////////////////////////////////////////// + + +c_domnode::c_domnode() { +} + +c_domnode::~c_domnode() { +} + +void c_domnode::t___construct() { + throw NotImplementedException(__func__); +} + +Variant c_domnode::t___destruct() { + return null; +} + +Variant c_domnode::t_appendchild(CObjRef newnode) +{ + xmlNodePtr nodep = m_node; + if (!dom_node_children_valid(nodep)) { + return false; + } + SmartObject newdomnode = newnode.getTyped(); + xmlNodePtr child = newdomnode->m_node; + xmlNodePtr new_child = NULL; + if (dom_node_is_read_only(nodep) || + (child->parent != NULL && dom_node_is_read_only(child->parent))) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, stricterror TSRMLS_CC); + return false; + } + if (!dom_hierarchy(nodep, child)) { + //php_dom_throw_error(HIERARCHY_REQUEST_ERR, stricterror TSRMLS_CC); + return false; + } + if (!(child->doc == NULL || child->doc == nodep->doc)) { + //php_dom_throw_error(WRONG_DOCUMENT_ERR, stricterror TSRMLS_CC); + return false; + } + if (child->type == XML_DOCUMENT_FRAG_NODE && child->children == NULL) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document Fragment is empty"); + return false; + } + if (child->doc == NULL && nodep->doc != NULL) { + //childobj->document = intern->document; + //php_libxml_increment_doc_ref((php_libxml_node_object *)childobj, NULL TSRMLS_CC); + } + if (child->parent != NULL){ + xmlUnlinkNode(child); + } + if (child->type == XML_TEXT_NODE && nodep->last != NULL && nodep->last->type == XML_TEXT_NODE) { + child->parent = nodep; + if (child->doc == NULL) { + xmlSetTreeDoc(child, nodep->doc); + } + new_child = child; + if (nodep->children == NULL) { + nodep->children = child; + nodep->last = child; + } else { + child = nodep->last; + child->next = new_child; + new_child->prev = child; + nodep->last = new_child; + } + } else if (child->type == XML_ATTRIBUTE_NODE) { + xmlAttrPtr lastattr; + if (child->ns == NULL) + lastattr = xmlHasProp(nodep, child->name); + else + lastattr = xmlHasNsProp(nodep, child->name, child->ns->href); + if (lastattr != NULL && lastattr->type != XML_ATTRIBUTE_DECL) { + if (lastattr != (xmlAttrPtr)child) { + xmlUnlinkNode((xmlNodePtr)lastattr); + //php_libxml_node_free_resource((xmlNodePtr)lastattr); + } + } + } else if (child->type == XML_DOCUMENT_FRAG_NODE) { + new_child = _php_dom_insert_fragment(nodep, nodep->last, NULL, child); + } + if (new_child == NULL) { + new_child = xmlAddChild(nodep, child); + if (new_child == NULL) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't append node"); + return false; + } + } + dom_reconcile_ns(nodep->doc, new_child); + SmartObject ret = NEW(c_domnode)(); + ret->m_node = new_child; + return ret; +} + +Variant c_domnode::t_clonenode(bool deep /* = false */) { + xmlNodePtr n = m_node; + xmlNode * node = xmlDocCopyNode(n, n->doc, deep); + if (!node) + return false; + // When deep is false Element nodes still require the attributes + // Following taken from libxml as xmlDocCopyNode doesnt do this + if (n->type == XML_ELEMENT_NODE && !deep) { + if (n->nsDef != NULL) { + node->nsDef = xmlCopyNamespaceList(n->nsDef); + } + if (n->ns != NULL) { + xmlNsPtr ns; + ns = xmlSearchNs(n->doc, node, n->ns->prefix); + if (ns == NULL) { + ns = xmlSearchNs(n->doc, n, n->ns->prefix); + if (ns != NULL) { + xmlNodePtr root = node; + while (root->parent != NULL) { + root = root->parent; + } + node->ns = xmlNewNs(root, ns->href, ns->prefix); + } + } else { + node->ns = ns; + } + } + if (n->properties != NULL) { + node->properties = xmlCopyPropList(node, n->properties); + } + } + SmartObject ret = NEW(c_domnode)(); + ret->m_node = node; + return ret; +} + +int64 c_domnode::t_getlineno() { + xmlNodePtr nodep = m_node; + return xmlGetLineNo(nodep); +} + +bool c_domnode::t_hasattributes() { + xmlNodePtr nodep = m_node; + if (nodep->type != XML_ELEMENT_NODE) + return false; + if (nodep->properties) { + return true; + } else { + return false; + } +} + +bool c_domnode::t_haschildnodes() { + xmlNodePtr nodep = m_node; + if (!dom_node_children_valid(nodep)) { + return false; + } + if (nodep->children) { + return true; + } else { + return false; + } +} + +Variant c_domnode::t_insertbefore(CObjRef newnode, CObjRef refnode /* = null */) { + xmlNodePtr parentp = m_node; + if (!dom_node_children_valid(parentp)) { + return false; + } + SmartObject domchildnode = newnode.getTyped(); + xmlNodePtr child = domchildnode->m_node; + xmlNodePtr new_child = NULL; + //stricterror = dom_get_strict_error(intern->document); + if (dom_node_is_read_only(parentp) || + (child->parent != NULL && dom_node_is_read_only(child->parent))) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, stricterror TSRMLS_CC); + return false; + } + if (!dom_hierarchy(parentp, child)) { + //php_dom_throw_error(HIERARCHY_REQUEST_ERR, stricterror TSRMLS_CC); + return false; + } + if (child->doc != parentp->doc && child->doc != NULL) { + //php_dom_throw_error(WRONG_DOCUMENT_ERR, stricterror TSRMLS_CC); + return false; + } + if (child->type == XML_DOCUMENT_FRAG_NODE && child->children == NULL) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document Fragment is empty"); + return false; + } + if (child->doc == NULL && parentp->doc != NULL) { + //childobj->document = intern->document; + //php_libxml_increment_doc_ref((php_libxml_node_object *)childobj, NULL TSRMLS_CC); + } + if (!refnode.isNull()) { + SmartObject domrefnode = refnode.getTyped(); + xmlNodePtr refp = domrefnode->m_node; + if (refp->parent != parentp) { + //php_dom_throw_error(NOT_FOUND_ERR, stricterror TSRMLS_CC); + return false; + } + if (child->parent != NULL) { + xmlUnlinkNode(child); + } + if (child->type == XML_TEXT_NODE && (refp->type == XML_TEXT_NODE || + (refp->prev != NULL && refp->prev->type == XML_TEXT_NODE))) { + if (child->doc == NULL) { + xmlSetTreeDoc(child, parentp->doc); + } + new_child = child; + new_child->parent = refp->parent; + new_child->next = refp; + new_child->prev = refp->prev; + refp->prev = new_child; + if (new_child->prev != NULL) { + new_child->prev->next = new_child; + } + if (new_child->parent != NULL) { + if (new_child->parent->children == refp) { + new_child->parent->children = new_child; + } + } + } else if (child->type == XML_ATTRIBUTE_NODE) { + xmlAttrPtr lastattr; + if (child->ns == NULL) + lastattr = xmlHasProp(refp->parent, child->name); + else + lastattr = xmlHasNsProp(refp->parent, child->name, child->ns->href); + if (lastattr != NULL && lastattr->type != XML_ATTRIBUTE_DECL) { + if (lastattr != (xmlAttrPtr)child) { + xmlUnlinkNode((xmlNodePtr)lastattr); + //php_libxml_node_free_resource((xmlNodePtr) lastattr TSRMLS_CC); + } else { + SmartObject ret = NEW(c_domnode)(); + ret->m_node = child; + return ret; + } + } + } else if (child->type == XML_DOCUMENT_FRAG_NODE) { + new_child = _php_dom_insert_fragment(parentp, refp->prev, refp, child); + } + if (new_child == NULL) { + new_child = xmlAddPrevSibling(refp, child); + } + } else { + if (child->parent != NULL){ + xmlUnlinkNode(child); + } + if (child->type == XML_TEXT_NODE && parentp->last != NULL && parentp->last->type == XML_TEXT_NODE) { + child->parent = parentp; + if (child->doc == NULL) { + xmlSetTreeDoc(child, parentp->doc); + } + new_child = child; + if (parentp->children == NULL) { + parentp->children = child; + parentp->last = child; + } else { + child = parentp->last; + child->next = new_child; + new_child->prev = child; + parentp->last = new_child; + } + } else if (child->type == XML_ATTRIBUTE_NODE) { + xmlAttrPtr lastattr; + if (child->ns == NULL) + lastattr = xmlHasProp(parentp, child->name); + else + lastattr = xmlHasNsProp(parentp, child->name, child->ns->href); + if (lastattr != NULL && lastattr->type != XML_ATTRIBUTE_DECL) { + if (lastattr != (xmlAttrPtr)child) { + xmlUnlinkNode((xmlNodePtr)lastattr); + //php_libxml_node_free_resource((xmlNodePtr) lastattr TSRMLS_CC); + } else { + SmartObject ret = NEW(c_domnode)(); + ret->m_node = child; + return ret; + } + } + } else if (child->type == XML_DOCUMENT_FRAG_NODE) { + new_child = _php_dom_insert_fragment(parentp, parentp->last, NULL, child); + } + if (new_child == NULL) { + new_child = xmlAddChild(parentp, child); + } + } + if (NULL == new_child) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't add newnode as the previous sibling of refnode"); + return false; + } + dom_reconcile_ns(parentp->doc, new_child); + SmartObject ret = NEW(c_domnode)(); + ret->m_node = new_child; + return ret; +} + +bool c_domnode::t_isdefaultnamespace(CStrRef namespaceuri) { + xmlNodePtr nodep = m_node; + xmlNsPtr nsptr; + if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) { + nodep = xmlDocGetRootElement((xmlDocPtr)nodep); + } + if (nodep && namespaceuri.size() > 0) { + nsptr = xmlSearchNs(nodep->doc, nodep, NULL); + if (nsptr && xmlStrEqual(nsptr->href, (xmlChar*)namespaceuri.data())) { + return true; + } + } + return false; +} + +bool c_domnode::t_issamenode(CObjRef node) { + SmartObject otherdomnode = node.getTyped(); + if (m_node == otherdomnode->m_node) + return true; + return false; +} + +bool c_domnode::t_issupported(CStrRef feature, CStrRef version) { + // dom_has_feature makes a bunch of calls to strcmp, we should + // look into making it use string_strcmp instead + if (dom_has_feature((char*)feature.data(), (char*)version.data())) + return true; + return false; +} + +Variant c_domnode::t_lookupnamespaceuri(CStrRef namespaceuri) { + xmlNodePtr nodep = m_node; + xmlNsPtr nsptr; + if (nodep->type == XML_DOCUMENT_NODE || nodep->type == XML_HTML_DOCUMENT_NODE) { + nodep = xmlDocGetRootElement((xmlDocPtr) nodep); + if (nodep == NULL) { + return null; + } + } + nsptr = xmlSearchNs(nodep->doc, nodep, (xmlChar*)namespaceuri.data()); + if (nsptr && nsptr->href != NULL) { + return String((char *)nsptr->href, CopyString); + } + return null; +} + +Variant c_domnode::t_lookupprefix(CStrRef prefix) { + xmlNodePtr nodep = m_node; + xmlNodePtr lookupp; + xmlNsPtr nsptr; + if (prefix.size() > 0) { + switch (nodep->type) { + case XML_ELEMENT_NODE: + lookupp = nodep; + break; + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + lookupp = xmlDocGetRootElement((xmlDocPtr)nodep); + break; + case XML_ENTITY_NODE: + case XML_NOTATION_NODE: + case XML_DOCUMENT_FRAG_NODE: + case XML_DOCUMENT_TYPE_NODE: + case XML_DTD_NODE: + return null; + break; + default: + lookupp = nodep->parent; + } + if (lookupp != NULL && (nsptr = xmlSearchNsByHref(lookupp->doc, lookupp, (xmlChar*)prefix.data()))) { + if (nsptr->prefix != NULL) { + return String((char *)nsptr->prefix, CopyString); + } + } + } + return null; +} + +void c_domnode::t_normalize() { + xmlNodePtr nodep = m_node; + dom_normalize(nodep); +} + +Variant c_domnode::t_removechild(CObjRef node) { + xmlNodePtr children; + xmlNodePtr nodep = m_node; + if (!dom_node_children_valid(nodep)) { + return false; + } + SmartObject domnode2 = node.getTyped(); + xmlNodePtr child = domnode2->m_node; + //stricterror = dom_get_strict_error(intern->document); + if (dom_node_is_read_only(nodep) || + (child->parent != NULL && dom_node_is_read_only(child->parent))) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, stricterror TSRMLS_CC); + return false; + } + children = nodep->children; + if (!children) { + //php_dom_throw_error(NOT_FOUND_ERR, stricterror TSRMLS_CC); + return false; + } + while (children) { + if (children == child) { + xmlUnlinkNode(child); + SmartObject ret = NEW(c_domnode)(); + ret->m_node = child; + return ret; + } + children = children->next; + } + //php_dom_throw_error(NOT_FOUND_ERR, stricterror TSRMLS_CC); + return false; +} + +Variant c_domnode::t_replacechild(CObjRef newchildobj, CObjRef oldchildobj) { + int foundoldchild = 0; + xmlNodePtr nodep = m_node; + if (!dom_node_children_valid(nodep)) { + return false; + } + SmartObject domnewchildnode = newchildobj.getTyped(); + xmlNodePtr newchild = domnewchildnode->m_node; + SmartObject domoldchildnode = oldchildobj.getTyped(); + xmlNodePtr oldchild = domoldchildnode->m_node; + xmlNodePtr children = nodep->children; + if (!children) { + return false; + } + //stricterror = dom_get_strict_error(intern->document); + if (dom_node_is_read_only(nodep) || + (newchild->parent != NULL && dom_node_is_read_only(newchild->parent))) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, stricterror TSRMLS_CC); + return false; + } + if (newchild->doc != nodep->doc && newchild->doc != NULL) { + //php_dom_throw_error(WRONG_DOCUMENT_ERR, stricterror TSRMLS_CC); + return false; + } + if (!dom_hierarchy(nodep, newchild)) { + //php_dom_throw_error(HIERARCHY_REQUEST_ERR, stricterror TSRMLS_CC); + return false; + } + // check for the old child and whether the new child is already a child + while (children) { + if (children == oldchild) { + foundoldchild = 1; + break; + } + children = children->next; + } + if (foundoldchild) { + xmlNodePtr node; + if (newchild->type == XML_DOCUMENT_FRAG_NODE) { + xmlNodePtr prevsib, nextsib; + prevsib = oldchild->prev; + nextsib = oldchild->next; + xmlUnlinkNode(oldchild); + newchild = _php_dom_insert_fragment(nodep, prevsib, nextsib, newchild); + if (newchild) { + dom_reconcile_ns(nodep->doc, newchild); + } + } else if (oldchild != newchild) { + if (newchild->doc == NULL && nodep->doc != NULL) { + xmlSetTreeDoc(newchild, nodep->doc); + //newchildobj->document = intern->document; + //php_libxml_increment_doc_ref((php_libxml_node_object *)newchildobj, NULL TSRMLS_CC); + } + node = xmlReplaceNode(oldchild, newchild); + dom_reconcile_ns(nodep->doc, newchild); + } + SmartObject ret = NEW(c_domnode)(); + ret->m_node = oldchild; + return ret; + } else { + //php_dom_throw_error(NOT_FOUND_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } +} + +Variant c_domnode::t_c14n(bool exclusive /* = false */, bool with_comments /* = false */, CVarRef xpath /* = null */, CVarRef ns_prefixes /* = null */) { + xmlNodePtr nodep = m_node; + return dom_canonicalization(nodep, "", exclusive, with_comments, xpath, ns_prefixes, 0); +} + +Variant c_domnode::t_c14nfile(CStrRef uri, bool exclusive /* = false */, bool with_comments /* = false */, CVarRef xpath /* = null */, CVarRef ns_prefixes /* = null */) { + xmlNodePtr nodep = m_node; + return dom_canonicalization(nodep, uri, exclusive, with_comments, xpath, ns_prefixes, 1); +} + +Variant c_domnode::t_getnodepath() { + xmlNodePtr n = m_node; + char *value = (char*)xmlGetNodePath(n); + if (value == NULL) { + return null; + } else { + String ret = String(value, CopyString); + xmlFree(value); + return ret; + } +} + +c_domattr::c_domattr() { +} + +c_domattr::~c_domattr() { +} + +void c_domattr::t___construct(CVarRef name, CVarRef value) { + throw NotImplementedException(__func__); +} + +Variant c_domattr::t___destruct() { + return null; +} + +bool c_domattr::t_isid() { + xmlAttrPtr attrp = (xmlAttrPtr)m_node; + if (attrp->atype == XML_ATTRIBUTE_ID) { + return true; + } else { + return false; + } +} + +c_domcharacterdata::c_domcharacterdata() { +} + +c_domcharacterdata::~c_domcharacterdata() { +} + +void c_domcharacterdata::t___construct(CVarRef value) { + throw NotImplementedException(__func__); +} + +Variant c_domcharacterdata::t___destruct() { + return null; +} + +bool c_domcharacterdata::t_appenddata(CStrRef arg) { + xmlNodePtr nodep = m_node; + // Implement logic from libxml xmlTextConcat to add suport for comments and PI + if ((nodep->content == (xmlChar *) &(nodep->properties)) || + ((nodep->doc != NULL) && (nodep->doc->dict != NULL) && + xmlDictOwns(nodep->doc->dict, nodep->content))) { + nodep->content = xmlStrncatNew(nodep->content, (xmlChar*)arg.data(), arg.size()); + } else { + nodep->content = xmlStrncat(nodep->content, (xmlChar*)arg.data(), arg.size()); + } + nodep->properties = NULL; + return true; +} + +bool c_domcharacterdata::t_deletedata(int64 offset, int64 count) { + xmlNodePtr node = m_node; + xmlChar *cur, *substring, *second; + int length; + cur = xmlNodeGetContent(node); + if (cur == NULL) { + return false; + } + length = xmlUTF8Strlen(cur); + if (offset < 0 || count < 0 || offset > length) { + xmlFree(cur); + //php_dom_throw_error(INDEX_SIZE_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + if (offset > 0) { + substring = xmlUTF8Strsub(cur, 0, offset); + } else { + substring = NULL; + } + if ((offset + count) > length) { + count = length - offset; + } + second = xmlUTF8Strsub(cur, offset + count, length - offset); + substring = xmlStrcat(substring, second); + xmlNodeSetContent(node, substring); + xmlFree(cur); + xmlFree(second); + xmlFree(substring); + return true; +} + +bool c_domcharacterdata::t_insertdata(int64 offset, CStrRef data) { + xmlNodePtr node = m_node; + xmlChar *cur, *first, *second; + int length; + cur = xmlNodeGetContent(node); + if (cur == NULL) { + return false; + } + length = xmlUTF8Strlen(cur); + if (offset < 0 || offset > length) { + xmlFree(cur); + //php_dom_throw_error(INDEX_SIZE_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + first = xmlUTF8Strndup(cur, offset); + second = xmlUTF8Strsub(cur, offset, length - offset); + xmlFree(cur); + xmlNodeSetContent(node, first); + xmlNodeAddContent(node, (xmlChar*)data.data()); + xmlNodeAddContent(node, second); + xmlFree(first); + xmlFree(second); + return true; +} + +bool c_domcharacterdata::t_replacedata(int64 offset, int64 count, CStrRef data) { + xmlNodePtr node = m_node; + xmlChar *cur, *substring, *second = NULL; + int length; + cur = xmlNodeGetContent(node); + if (cur == NULL) { + return false; + } + length = xmlUTF8Strlen(cur); + if (offset < 0 || count < 0 || offset > length) { + xmlFree(cur); + //php_dom_throw_error(INDEX_SIZE_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + if (offset > 0) { + substring = xmlUTF8Strsub(cur, 0, offset); + } else { + substring = NULL; + } + if ((offset + count) > length) { + count = length - offset; + } + if (offset < length) { + second = xmlUTF8Strsub(cur, offset + count, length - offset); + } + substring = xmlStrcat(substring, (xmlChar*)data.data()); + substring = xmlStrcat(substring, second); + xmlNodeSetContent(node, substring); + xmlFree(cur); + if (second) { + xmlFree(second); + } + xmlFree(substring); + return true; +} + +String c_domcharacterdata::t_substringdata(int64 offset, int64 count) { + xmlNodePtr node = m_node; + xmlChar *cur; + xmlChar *substring; + int length; + cur = xmlNodeGetContent(node); + if (cur == NULL) { + return false; + } + length = xmlUTF8Strlen(cur); + if (offset < 0 || count < 0 || offset > length) { + xmlFree(cur); + //php_dom_throw_error(INDEX_SIZE_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + if ((offset + count) > length) { + count = length - offset; + } + substring = xmlUTF8Strsub(cur, offset, count); + xmlFree(cur); + String ret; + if (substring) { + ret = String((char*)substring, CopyString); + xmlFree(substring); + } else { + ret = String("", CopyString); + } + return ret; +} + +c_domcomment::c_domcomment() { +} + +c_domcomment::~c_domcomment() { +} + +void c_domcomment::t___construct(CVarRef value) { + throw NotImplementedException(__func__); +} + +Variant c_domcomment::t___destruct() { + return null; +} + +c_domtext::c_domtext() { +} + +c_domtext::~c_domtext() { +} + +void c_domtext::t___construct(CVarRef value) { + throw NotImplementedException(__func__); +} + +Variant c_domtext::t___destruct() { + return null; +} + +bool c_domtext::t_iswhitespaceinelementcontent() { + xmlNodePtr node = m_node; + if (xmlIsBlankNode(node)) { + return true; + } else { + return false; + } +} + +Variant c_domtext::t_splittext(int64 offset) { + xmlNodePtr node = m_node; + xmlChar *cur; + xmlChar *first; + xmlChar *second; + xmlNodePtr nnode; + int length; + if (node->type != XML_TEXT_NODE) { + return false; + } + cur = xmlNodeGetContent(node); + if (cur == NULL) { + return false; + } + length = xmlUTF8Strlen(cur); + if (offset > length || offset < 0) { + xmlFree(cur); + return false; + } + first = xmlUTF8Strndup(cur, offset); + second = xmlUTF8Strsub(cur, offset, length - offset); + xmlFree(cur); + xmlNodeSetContent(node, first); + nnode = xmlNewDocText(node->doc, second); + xmlFree(first); + xmlFree(second); + if (nnode == NULL) { + return false; + } + if (node->parent != NULL) { + nnode->type = XML_ELEMENT_NODE; + xmlAddNextSibling(node, nnode); + nnode->type = XML_TEXT_NODE; + } + SmartObject ret = NEW(c_domtext)(); + ret->m_node = nnode; + return ret; +} + +c_domcdatasection::c_domcdatasection() { +} + +c_domcdatasection::~c_domcdatasection() { +} + +void c_domcdatasection::t___construct(CVarRef value) { + throw NotImplementedException(__func__); +} + +Variant c_domcdatasection::t___destruct() { + return null; +} + +c_domdocument::c_domdocument() { +} + +c_domdocument::~c_domdocument() { +} + +void c_domdocument::t___construct(CStrRef version, CStrRef encoding) { + xmlDoc *docp = xmlNewDoc((xmlChar*)version.data()); + if (!docp) { + //php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC); + //RETURN_FALSE; + return; + } + if (encoding.size() > 0) { + docp->encoding = (const xmlChar*)xmlStrdup((xmlChar*)encoding.data()); + } + m_node = (xmlNodePtr)docp; +} + +Variant c_domdocument::t___destruct() { + return null; +} + +Variant c_domdocument::t_createattribute(CStrRef name) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlAttrPtr node; + if (xmlValidateName((xmlChar*)name.data(), 0) != 0) { + //php_dom_throw_error(INVALID_CHARACTER_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + node = xmlNewDocProp(docp, (xmlChar*)name.data(), NULL); + if (!node) { + return false; + } + SmartObject ret = NEW(c_domattr)(); + ret->m_node = (xmlNodePtr)node; + return ret; +} + +Variant c_domdocument::t_createattributens(CStrRef namespaceuri, CStrRef qualifiedname) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlNodePtr nodep = NULL, root; + xmlNsPtr nsptr; + char *localname = NULL, *prefix = NULL; + int errorcode; + root = xmlDocGetRootElement(docp); + if (root != NULL) { + errorcode = dom_check_qname((char*)qualifiedname.data(), &localname, &prefix, namespaceuri.size(), qualifiedname.size()); + if (errorcode == 0) { + if (xmlValidateName((xmlChar*)localname, 0) == 0) { + nodep = (xmlNodePtr)xmlNewDocProp(docp, (xmlChar*)localname, NULL); + if (nodep != NULL && namespaceuri.size() > 0) { + nsptr = xmlSearchNsByHref(nodep->doc, root, (xmlChar*)namespaceuri.data()); + if (nsptr == NULL) { + nsptr = dom_get_ns(root, (char*)namespaceuri.data(), &errorcode, prefix); + } + xmlSetNs(nodep, nsptr); + } + } else { + errorcode = INVALID_CHARACTER_ERR; + } + } + } else { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Document Missing Root Element"); + return false; + } + xmlFree(localname); + if (prefix != NULL) { + xmlFree(prefix); + } + if (errorcode != 0) { + if (nodep != NULL) { + xmlFreeProp((xmlAttrPtr) nodep); + } + //php_dom_throw_error(errorcode, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + if (nodep == NULL) { + return false; + } + SmartObject ret = NEW(c_domattr)(); + ret->m_node = nodep; + return ret; +} + +Variant c_domdocument::t_createcdatasection(CStrRef data) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlNode *node; + node = xmlNewCDataBlock(docp, (xmlChar*)data.data(), data.size()); + if (!node) { + return false; + } + SmartObject ret = NEW(c_domcharacterdata)(); + ret->m_node = node; + return ret; +} + +Variant c_domdocument::t_createcomment(CStrRef data) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlNode *node; + node = xmlNewCDataBlock(docp, (xmlChar*)data.data(), data.size()); + if (!node) { + return false; + } + SmartObject ret = NEW(c_domcomment)(); + ret->m_node = node; + return ret; +} + +Variant c_domdocument::t_createdocumentfragment() { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlNode *node; + node = xmlNewDocFragment(docp); + if (!node) { + return false; + } + SmartObject ret = NEW(c_domdocumentfragment)(); + ret->m_node = node; + return ret; +} + +Variant c_domdocument::t_createelement(CStrRef name, CStrRef value /* = null_string */) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlNode *node; + if (xmlValidateName((xmlChar*)name.data(), 0) != 0) { + //php_dom_throw_error(INVALID_CHARACTER_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + node = xmlNewDocNode(docp, NULL, (xmlChar*)name.data(), (xmlChar*)value.data()); + if (!node) { + return false; + } + SmartObject ret = NEW(c_domelement)(); + ret->m_node = node; + return ret; +} + +Variant c_domdocument::t_createelementns(CStrRef namespaceuri, CStrRef qualifiedname, CStrRef value /* = null_string */) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlNodePtr nodep = NULL; + xmlNsPtr nsptr = NULL; + char *localname = NULL, *prefix = NULL; + int errorcode; + errorcode = dom_check_qname((char*)qualifiedname.data(), &localname, &prefix, namespaceuri.size(), qualifiedname.size()); + if (errorcode == 0) { + if (xmlValidateName((xmlChar*)localname, 0) == 0) { + nodep = xmlNewDocNode(docp, NULL, (xmlChar*)localname, (xmlChar*)value.data()); + if (nodep != NULL && !namespaceuri.isNull()) { + nsptr = xmlSearchNsByHref(nodep->doc, nodep, (xmlChar*)namespaceuri.data()); + if (nsptr == NULL) { + nsptr = dom_get_ns(nodep, (char*)namespaceuri.data(), &errorcode, prefix); + } + xmlSetNs(nodep, nsptr); + } + } else { + errorcode = INVALID_CHARACTER_ERR; + } + } + xmlFree(localname); + if (prefix != NULL) { + xmlFree(prefix); + } + if (errorcode != 0) { + if (nodep != NULL) { + xmlFreeNode(nodep); + } + //php_dom_throw_error(errorcode, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + if (nodep == NULL) { + return false; + } + nodep->ns = nsptr; + SmartObject ret = NEW(c_domelement)(); + ret->m_node = nodep; + return ret; +} + +Variant c_domdocument::t_createentityreference(CStrRef name) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlNode *node; + if (xmlValidateName((xmlChar*)name.data(), 0) != 0) { + //php_dom_throw_error(INVALID_CHARACTER_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + node = xmlNewReference(docp, (xmlChar*)name.data()); + if (!node) { + return false; + } + SmartObject ret = NEW(c_domentity)(); + ret->m_node = node; + return ret; +} + +Variant c_domdocument::t_createprocessinginstruction(CStrRef target, CStrRef data /* = null_string */) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlNode *node; + if (xmlValidateName((xmlChar*)target.data(), 0) != 0) { + //php_dom_throw_error(INVALID_CHARACTER_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + node = xmlNewPI((xmlChar*)target.data(), (xmlChar*)data.data()); + if (!node) { + return false; + } + node->doc = docp; + SmartObject ret = NEW(c_domprocessinginstruction)(); + ret->m_node = node; + return ret; +} + +Variant c_domdocument::t_createtextnode(CStrRef data) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlNode *node; + node = xmlNewDocText(docp, (xmlChar*)data.data()); + if (!node) { + return false; + } + SmartObject ret = NEW(c_domtext)(); + ret->m_node = node; + return ret; +} + +Variant c_domdocument::t_getelementbyid(CStrRef elementid) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlAttrPtr attrp; + attrp = xmlGetID(docp, (xmlChar*)elementid.data()); + if (attrp && attrp->parent) { + SmartObject ret = NEW(c_domtext)(); + ret->m_node = attrp->parent; + return ret; + } + return null; +} + +Variant c_domdocument::t_getelementsbytagname(CStrRef name) { + throw NotImplementedException(__func__); +} + +Variant c_domdocument::t_getelementsbytagnamens(CStrRef namespaceuri, CStrRef localname) { + throw NotImplementedException(__func__); +} + +Variant c_domdocument::t_importnode(CObjRef importednode, bool deep /* = false */) { + xmlDocPtr docp = (xmlDocPtr)m_node; + SmartObject domnode = importednode.getTyped(); + xmlNodePtr nodep = domnode->m_node; + xmlNodePtr retnodep; + long recursive = deep ? 1 : 0; + if (nodep->type == XML_HTML_DOCUMENT_NODE || nodep->type == XML_DOCUMENT_NODE + || nodep->type == XML_DOCUMENT_TYPE_NODE) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot import: Node Type Not Supported"); + return false; + } + if (nodep->doc == docp) { + retnodep = nodep; + } else { + if ((recursive == 0) && (nodep->type == XML_ELEMENT_NODE)) { + recursive = 2; + } + retnodep = xmlDocCopyNode(nodep, docp, recursive); + if (!retnodep) { + return false; + } + } + SmartObject ret = NEW(c_domnode)(); + ret->m_node = retnodep; + return ret; +} + +Variant c_domdocument::t_load(CStrRef filename, int64 options /* = 0 */) { + return dom_parse_document(this, filename, options, DOM_LOAD_FILE); +} + +Variant c_domdocument::t_loadhtml(CStrRef source) { + return dom_load_html(this, source, DOM_LOAD_STRING); +} + +Variant c_domdocument::t_loadhtmlfile(CStrRef filename) { + return dom_load_html(this, filename, DOM_LOAD_FILE); +} + +Variant c_domdocument::t_loadxml(CStrRef source, int64 options /* = 0 */) { + return dom_parse_document(this, source, options, DOM_LOAD_STRING); +} + +void c_domdocument::t_normalizedocument() { + xmlDocPtr docp = (xmlDocPtr)m_node; + dom_normalize((xmlNodePtr)docp); +} + +bool c_domdocument::t_registernodeclass(CStrRef baseclass, CStrRef extendedclass) { + // This look really trick.. for now just return false + /* + xmlDoc *docp; + char *baseclass = NULL, *extendedclass = NULL; + int baseclass_len = 0, extendedclass_len = 0; + zend_class_entry *basece = NULL, *ce = NULL; + + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oss!", &id, dom_document_class_entry, &baseclass, &baseclass_len, &extendedclass, &extendedclass_len) == FAILURE) { + return; + } + + if (baseclass_len) { + zend_class_entry **pce; + if (zend_lookup_class(baseclass, baseclass_len, &pce TSRMLS_CC) == FAILURE) { + //php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s does not exist", baseclass); + return; + } + basece = *pce; + } + + if (basece == NULL || ! instanceof_function(basece, dom_node_class_entry TSRMLS_CC)) { + //php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s is not derived from DOMNode.", baseclass); + return; + } + + if (extendedclass_len) { + zend_class_entry **pce; + if (zend_lookup_class(extendedclass, extendedclass_len, &pce TSRMLS_CC) == FAILURE) { + //php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s does not exist", extendedclass); + } + ce = *pce; + } + + if (ce == NULL || instanceof_function(ce, basece TSRMLS_CC)) { + + DOM_GET_OBJ(docp, id, xmlDocPtr, intern); + + if (dom_set_doc_classmap(intern->document, basece, ce TSRMLS_CC) == FAILURE) { + //php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s could not be registered.", extendedclass); + } + return true; + } else { + //php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s is not derived from %s.", extendedclass, baseclass); + } + */ + return false; +} + +bool c_domdocument::t_relaxngvalidate(CStrRef filename) { + return _dom_document_relaxNG_validate(this, filename, DOM_LOAD_FILE); +} + +bool c_domdocument::t_relaxngvalidatesource(CStrRef source) { + return _dom_document_relaxNG_validate(this, source, DOM_LOAD_STRING); +} + +Variant c_domdocument::t_save(CStrRef file, int64 options /* = 0 */) { + xmlDocPtr docp = (xmlDocPtr)m_node; + int bytes, format = 0, saveempty = 0; + //dom_doc_propsptr doc_props; + + if (file.size() == 0) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Filename"); + return false; + } + + /* encoding handled by property on doc */ + + //doc_props = dom_get_doc_props(intern->document); + //format = doc_props->formatoutput; + if (options & LIBXML_SAVE_NOEMPTYTAG) { + saveempty = xmlSaveNoEmptyTags; + xmlSaveNoEmptyTags = 1; + } + bytes = xmlSaveFormatFileEnc(file, docp, NULL, format); + if (options & LIBXML_SAVE_NOEMPTYTAG) { + xmlSaveNoEmptyTags = saveempty; + } + if (bytes == -1) { + return false; + } + return bytes; +} + +Variant c_domdocument::t_savehtml() { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlChar *mem; + int size; + htmlDocDumpMemory(docp, &mem, &size); + if (!size) { + if (mem) + xmlFree(mem); + return false; + } + String ret = String((char*)mem, size, CopyString); + xmlFree(mem); + return ret; +} + +Variant c_domdocument::t_savehtmlfile(CStrRef file) { + xmlDocPtr docp = (xmlDocPtr)m_node; + int bytes, format = 0; + //dom_doc_propsptr doc_props; + if (file.size() == 0) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid Filename"); + return false; + } + /* encoding handled by property on doc */ + //doc_props = dom_get_doc_props(intern->document); + //format = doc_props->formatoutput; + bytes = htmlSaveFileFormat(file.data(), docp, NULL, format); + if (bytes == -1) { + return false; + } + return bytes; +} + +Variant c_domdocument::t_savexml(CObjRef node /* = null_object */, int64 options /* = 0 */) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlBufferPtr buf; + xmlChar *mem; + //dom_doc_propsptr doc_props; + int size, format = 0, saveempty = 0; + + //doc_props = dom_get_doc_props(intern->document); + //format = doc_props->formatoutput; + + if (!node.isNull()) { + SmartObject domnode = node.getTyped(); + xmlNodePtr node = domnode->m_node; + /* Dump contents of Node */ + if (node->doc != docp) { + //php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + buf = xmlBufferCreate(); + if (!buf) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not fetch buffer"); + return false; + } + if (options & LIBXML_SAVE_NOEMPTYTAG) { + saveempty = xmlSaveNoEmptyTags; + xmlSaveNoEmptyTags = 1; + } + xmlNodeDump(buf, docp, node, 0, format); + if (options & LIBXML_SAVE_NOEMPTYTAG) { + xmlSaveNoEmptyTags = saveempty; + } + mem = (xmlChar*)xmlBufferContent(buf); + if (!mem) { + xmlBufferFree(buf); + return false; + } + String ret = String((char*)mem, CopyString); + xmlBufferFree(buf); + return ret; + } else { + if (options & LIBXML_SAVE_NOEMPTYTAG) { + saveempty = xmlSaveNoEmptyTags; + xmlSaveNoEmptyTags = 1; + } + // Encoding is handled from the encoding property set on the document + xmlDocDumpFormatMemory(docp, &mem, &size, format); + if (options & LIBXML_SAVE_NOEMPTYTAG) { + xmlSaveNoEmptyTags = saveempty; + } + if (!size) { + return false; + } + String ret = String((char*)mem, size, CopyString); + xmlFree(mem); + return ret; + } +} + +bool c_domdocument::t_schemavalidate(CStrRef filename) { + return _dom_document_schema_validate(this, filename, DOM_LOAD_FILE); +} + +bool c_domdocument::t_schemavalidatesource(CStrRef source) { + return _dom_document_schema_validate(this, source, DOM_LOAD_STRING); +} + +bool c_domdocument::t_validate() { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlValidCtxt *cvp; + if (docp->intSubset == NULL) { + //php_error_docref(NULL TSRMLS_CC, E_NOTICE, "No DTD given in XML-Document"); + } + cvp = xmlNewValidCtxt(); + cvp->userData = NULL; + //cvp->error = (xmlValidityErrorFunc) php_libxml_error_handler; + //cvp->warning = (xmlValidityErrorFunc) php_libxml_error_handler; + bool ret; + if (xmlValidateDocument(cvp, docp)) { + ret = true; + } else { + ret = false; + } + xmlFreeValidCtxt(cvp); + return ret; +} + +Variant c_domdocument::t_xinclude(int64 options /* = 0 */) { + xmlDocPtr docp = (xmlDocPtr)m_node; + xmlNodePtr root; + int err; + err = xmlXIncludeProcessFlags(docp, options); + /* XML_XINCLUDE_START and XML_XINCLUDE_END nodes need to be removed as these + are added via xmlXIncludeProcess to mark beginning and ending of xincluded document· + but are not wanted in resulting document - must be done even if err as it could fail after + having processed some xincludes */ + root = (xmlNodePtr) docp->children; + while(root && root->type != XML_ELEMENT_NODE && root->type != XML_XINCLUDE_START) { + root = root->next; + } + if (root) { + php_dom_remove_xinclude_nodes(root); + } + if (err) { + return err; + } else { + return false; + } +} + +c_domdocumentfragment::c_domdocumentfragment() { +} + +c_domdocumentfragment::~c_domdocumentfragment() { +} + +void c_domdocumentfragment::t___construct() { +} + +Variant c_domdocumentfragment::t___destruct() { + return null; +} + +c_domdocumenttype::c_domdocumenttype() { +} + +c_domdocumenttype::~c_domdocumenttype() { +} + +void c_domdocumenttype::t___construct() { +} + +Variant c_domdocumenttype::t___destruct() { + return null; +} + +bool c_domdocumentfragment::t_appendxml(CStrRef data) { + xmlNodePtr nodep = m_node; + int err; + xmlNodePtr lst; + if (dom_node_is_read_only(nodep)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + if (data) { + err = xmlParseBalancedChunkMemory(nodep->doc, NULL, NULL, 0, (xmlChar*)data.data(), &lst); + if (err != 0) { + return false; + } + /* Following needed due to bug in libxml2 <= 2.6.14 + ifdef after next libxml release as bug is fixed in their cvs */ + php_dom_xmlSetTreeDoc(lst, nodep->doc); + /* End stupid hack */ + xmlAddChildList(nodep,lst); + } + return true; +} + +c_domelement::c_domelement() { +} + +c_domelement::~c_domelement() { +} + +void c_domelement::t___construct(CVarRef name, CVarRef value, CVarRef namespaceuri) { + throw NotImplementedException(__func__); +} + +Variant c_domelement::t___destruct() { + return null; +} + +String c_domelement::t_getattribute(CStrRef name) { + xmlNodePtr nodep = m_node; + xmlChar *value = NULL; + xmlNodePtr attr; + attr = dom_get_dom1_attribute(nodep, (xmlChar*)name.data()); + if (attr) { + switch (attr->type) { + case XML_ATTRIBUTE_NODE: + value = xmlNodeListGetString(attr->doc, attr->children, 1); + break; + case XML_NAMESPACE_DECL: + value = xmlStrdup(((xmlNsPtr)attr)->href); + break; + default: + value = xmlStrdup(((xmlAttributePtr)attr)->defaultValue); + } + } + if (value == NULL) { + return String(""); + } else { + String ret = String((char*)value, CopyString); + xmlFree(value); + return ret; + } +} + +Variant c_domelement::t_getattributenode(CStrRef name) { + xmlNodePtr nodep = m_node; + xmlNodePtr attrp; + attrp = dom_get_dom1_attribute(nodep, (xmlChar*)name.data()); + if (attrp == NULL) { + return false; + } + if (attrp->type == XML_NAMESPACE_DECL) { + xmlNsPtr curns; + //xmlNodePtr nsparent; + //nsparent = attrp->_private; + curns = xmlNewNs(NULL, attrp->name, NULL); + if (attrp->children) { + curns->prefix = xmlStrdup((xmlChar*)attrp->children); + } + if (attrp->children) { + attrp = xmlNewDocNode(nodep->doc, NULL, (xmlChar *) attrp->children, attrp->name); + } else { + attrp = xmlNewDocNode(nodep->doc, NULL, (xmlChar *)"xmlns", attrp->name); + } + attrp->type = XML_NAMESPACE_DECL; + //attrp->parent = nsparent; + attrp->ns = curns; + } + SmartObject ret = NEW(c_domattr)(); + ret->m_node = (xmlNodePtr)attrp; + return ret; +} + +Object c_domelement::t_getattributenodens(CStrRef namespaceuri, CStrRef localname) { + xmlNodePtr elemp = m_node; + xmlAttrPtr attrp; + attrp = xmlHasNsProp(elemp, (xmlChar*)localname.data(), (xmlChar*)namespaceuri.data()); + if (attrp == NULL) { + return null_object; + } + SmartObject ret = NEW(c_domattr)(); + ret->m_node = (xmlNodePtr)attrp; + return ret; +} + +String c_domelement::t_getattributens(CStrRef namespaceuri, CStrRef localname) { + xmlNodePtr elemp = m_node; + xmlNsPtr nsptr; + xmlChar *strattr; + strattr = xmlGetNsProp(elemp, (xmlChar*)localname.data(), (xmlChar*)namespaceuri.data()); + String ret = String(""); + if (strattr != NULL) { + ret = String((char*)strattr, CopyString); + xmlFree(strattr); + } else { + if (xmlStrEqual((xmlChar*)namespaceuri.data(), (xmlChar*)DOM_XMLNS_NAMESPACE)) { + nsptr = dom_get_nsdecl(elemp, (xmlChar*)localname.data()); + if (nsptr != NULL) { + ret = String((char*)nsptr->href, CopyString); + } + } + } + return ret; +} + +Object c_domelement::t_getelementsbytagname(CStrRef name) { + throw NotImplementedException(__func__); +} + +Object c_domelement::t_getelementsbytagnamens(CStrRef namespaceuri, CStrRef localname) { + throw NotImplementedException(__func__); +} + +bool c_domelement::t_hasattribute(CStrRef name) { + xmlNodePtr nodep = m_node; + xmlNodePtr attr; + attr = dom_get_dom1_attribute(nodep, (xmlChar*)name.data()); + if (attr == NULL) { + return false; + } else { + return true; + } +} + +bool c_domelement::t_hasattributens(CStrRef namespaceuri, CStrRef localname) { + xmlNodePtr elemp = m_node; + xmlNs *nsp; + xmlChar *value; + value = xmlGetNsProp(elemp, (xmlChar*)localname.data(), (xmlChar*)namespaceuri.data()); + if (value != NULL) { + xmlFree(value); + return true; + } else { + if (xmlStrEqual((xmlChar*)namespaceuri.data(), (xmlChar*)DOM_XMLNS_NAMESPACE)) { + nsp = dom_get_nsdecl(elemp, (xmlChar*)localname.data()); + if (nsp != NULL) { + return true; + } + } + } + return false; +} + +bool c_domelement::t_removeattribute(CStrRef name) { + xmlNodePtr nodep = m_node; + xmlNodePtr attrp; + if (dom_node_is_read_only(nodep)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + attrp = dom_get_dom1_attribute(nodep, (xmlChar*)name.data()); + if (attrp == NULL) { + return false; + } + switch (attrp->type) { + case XML_ATTRIBUTE_NODE: + //if (php_dom_object_get_data(attrp) == NULL) { + // node_list_unlink(attrp->children); + // xmlUnlinkNode(attrp); + // xmlFreeProp((xmlAttrPtr)attrp); + //} else { + xmlUnlinkNode(attrp); + //} + break; + case XML_NAMESPACE_DECL: + return false; + default: + break; + } + return true; +} + +Variant c_domelement::t_removeattributenode(CObjRef oldattr) { + xmlNodePtr nodep = m_node; + SmartObject attr = oldattr.getTyped(); + xmlAttrPtr attrp = (xmlAttrPtr)attr->m_node; + if (dom_node_is_read_only(nodep)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + if (attrp->type != XML_ATTRIBUTE_NODE || attrp->parent != nodep) { + //php_dom_throw_error(NOT_FOUND_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + xmlUnlinkNode((xmlNodePtr)attrp); + SmartObject ret = NEW(c_domattr)(); + ret->m_node = (xmlNodePtr)attrp; + return ret; +} + +Variant c_domelement::t_removeattributens(CStrRef namespaceuri, CStrRef localname) { + xmlNodePtr nodep = m_node; + xmlAttr *attrp; + xmlNsPtr nsptr; + if (dom_node_is_read_only(nodep)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return null; + } + attrp = xmlHasNsProp(nodep, (xmlChar*)localname.data(), (xmlChar*)namespaceuri.data()); + nsptr = dom_get_nsdecl(nodep, (xmlChar*)localname.data()); + if (nsptr != NULL) { + if (xmlStrEqual((xmlChar*)namespaceuri.data(), nsptr->href)) { + if (nsptr->href != NULL) { + xmlFree((char*)nsptr->href); + nsptr->href = NULL; + } + if (nsptr->prefix != NULL) { + xmlFree((char*)nsptr->prefix); + nsptr->prefix = NULL; + } + } else { + return null; + } + } + if (attrp && attrp->type != XML_ATTRIBUTE_DECL) { + //if (php_dom_object_get_data((xmlNodePtr) attrp) == NULL) { + // node_list_unlink(attrp->children); + // xmlUnlinkNode((xmlNodePtr)attrp); + // xmlFreeProp(attrp); + //} else { + xmlUnlinkNode((xmlNodePtr)attrp); + //} + } + return null; +} + +Variant c_domelement::t_setattribute(CStrRef name, CStrRef value) { + xmlNodePtr nodep = m_node; + xmlNodePtr attr = NULL; + int name_valid; + if (name.size() == 0) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute Name is required"); + return false; + } + name_valid = xmlValidateName((xmlChar*)name.data(), 0); + if (name_valid != 0) { + //php_dom_throw_error(INVALID_CHARACTER_ERR, 1 TSRMLS_CC); + return false; + } + if (dom_node_is_read_only(nodep)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + attr = dom_get_dom1_attribute(nodep, (xmlChar*)name.data()); + if (attr != NULL) { + switch (attr->type) { + case XML_ATTRIBUTE_NODE: + //node_list_unlink(attr->children); + break; + case XML_NAMESPACE_DECL: + return false; + default: + break; + } + } + if (xmlStrEqual((xmlChar*)name.data(), (xmlChar*)"xmlns")) { + if (xmlNewNs(nodep, (xmlChar*)value.data(), NULL)) { + return true; + } + } else { + attr = (xmlNodePtr)xmlSetProp(nodep, (xmlChar*)name.data(), (xmlChar*)value.data()); + } + if (!attr) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such attribute '%s'", name); + return false; + } + SmartObject ret = NEW(c_domattr)(); + ret->m_node = (xmlNodePtr)attr; + return ret; +} + +Variant c_domelement::t_setattributenode(CObjRef newattr) { + xmlNodePtr nodep = m_node; + SmartObject domattr = newattr.getTyped(); + xmlAttrPtr attrp = (xmlAttrPtr)domattr->m_node; + xmlAttr *existattrp = NULL; + if (dom_node_is_read_only(nodep)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + if (attrp->type != XML_ATTRIBUTE_NODE) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute node is required"); + return false; + } + if (!(attrp->doc == NULL || attrp->doc == nodep->doc)) { + //php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + existattrp = xmlHasProp(nodep, attrp->name); + if (existattrp != NULL && existattrp->type != XML_ATTRIBUTE_DECL) { + //if ((oldobj = php_dom_object_get_data((xmlNodePtr)existattrp)) != NULL && + // ((php_libxml_node_ptr*)oldobj->ptr)->node == (xmlNodePtr)attrp) + //{ + // RETURN_NULL(); + //} + xmlUnlinkNode((xmlNodePtr)existattrp); + } + if (attrp->parent != NULL) { + xmlUnlinkNode((xmlNodePtr)attrp); + } + if (attrp->doc == NULL && nodep->doc != NULL) { + //attrobj->document = intern->document; + //php_libxml_increment_doc_ref((php_libxml_node_object *)attrobj, NULL TSRMLS_CC); + } + xmlAddChild(nodep, (xmlNodePtr)attrp); + /* Returns old property if removed otherwise NULL */ + if (existattrp != NULL) { + SmartObject ret = NEW(c_domattr)(); + ret->m_node = (xmlNodePtr)existattrp; + return ret; + } else { + return null; + } +} + +Variant c_domelement::t_setattributenodens(CObjRef newattr) { + xmlNs *nsp; + xmlAttr *existattrp = NULL; + xmlNodePtr nodep = m_node; + SmartObject domattr = newattr.getTyped(); + xmlAttrPtr attrp = (xmlAttrPtr)domattr->m_node; + if (dom_node_is_read_only(nodep)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + if (attrp->type != XML_ATTRIBUTE_NODE) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute node is required"); + return false; + } + if (!(attrp->doc == NULL || attrp->doc == nodep->doc)) { + //php_dom_throw_error(WRONG_DOCUMENT_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return false; + } + nsp = attrp->ns; + if (nsp != NULL) { + existattrp = xmlHasNsProp(nodep, nsp->href, attrp->name); + } else { + existattrp = xmlHasProp(nodep, attrp->name); + } + if (existattrp != NULL && existattrp->type != XML_ATTRIBUTE_DECL) { + //if ((oldobj = php_dom_object_get_data((xmlNodePtr) existattrp)) != NULL &&· + // ((php_libxml_node_ptr *)oldobj->ptr)->node == (xmlNodePtr) attrp) + //{ + // RETURN_NULL(); + //} + xmlUnlinkNode((xmlNodePtr)existattrp); + } + if (attrp->parent != NULL) { + xmlUnlinkNode((xmlNodePtr) attrp); + } + if (attrp->doc == NULL && nodep->doc != NULL) { + //attrobj->document = intern->document; + //php_libxml_increment_doc_ref((php_libxml_node_object *)attrobj, NULL TSRMLS_CC); + } + xmlAddChild(nodep, (xmlNodePtr) attrp); + /* Returns old property if removed otherwise NULL */ + if (existattrp != NULL) { + SmartObject ret = NEW(c_domattr)(); + ret->m_node = (xmlNodePtr)existattrp; + return ret; + } else { + return null; + } +} + +Variant c_domelement::t_setattributens(CStrRef namespaceuri, CStrRef name, CStrRef value) { + xmlNodePtr elemp = m_node; + xmlNsPtr nsptr; + xmlNode *nodep; + xmlAttr *attr; + char *localname = NULL, *prefix = NULL; + int errorcode = 0, stricterror, is_xmlns = 0, name_valid; + if (name.size() == 0) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute Name is required"); + return false; + } + //stricterror = dom_get_strict_error(intern->document); + if (dom_node_is_read_only(elemp)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, stricterror TSRMLS_CC); + return null; + } + errorcode = dom_check_qname((char*)name.data(), &localname, &prefix, namespaceuri.size(), name.size()); + if (errorcode == 0) { + if (namespaceuri.size() > 0) { + nodep = (xmlNodePtr)xmlHasNsProp(elemp, (xmlChar*)localname, (xmlChar*)namespaceuri.data()); + if (nodep != NULL && nodep->type != XML_ATTRIBUTE_DECL) { + node_list_unlink(nodep->children); + } + if (xmlStrEqual((xmlChar*)prefix, (xmlChar*)"xmlns") && + xmlStrEqual((xmlChar*)namespaceuri.data(), (xmlChar*)DOM_XMLNS_NAMESPACE)) { + is_xmlns = 1; + nsptr = dom_get_nsdecl(elemp, (xmlChar*)localname); + } else { + nsptr = xmlSearchNsByHref(elemp->doc, elemp, (xmlChar*)namespaceuri.data()); + if (nsptr && nsptr->prefix == NULL) { + xmlNsPtr tmpnsptr; + tmpnsptr = nsptr->next; + while (tmpnsptr) { + if ((tmpnsptr->prefix != NULL) && (tmpnsptr->href != NULL) && + (xmlStrEqual(tmpnsptr->href, (xmlChar*)namespaceuri.data()))) { + nsptr = tmpnsptr; + break; + } + tmpnsptr = tmpnsptr->next; + } + if (tmpnsptr == NULL) { + nsptr = _dom_new_reconNs(elemp->doc, elemp, nsptr); + } + } + } + if (nsptr == NULL) { + if (prefix == NULL) { + errorcode = NAMESPACE_ERR; + } else { + if (is_xmlns == 1) { + xmlNewNs(elemp, (xmlChar*)value.data(), (xmlChar*)localname); + } else { + nsptr = dom_get_ns(elemp, (char*)namespaceuri.data(), &errorcode, prefix); + } + xmlReconciliateNs(elemp->doc, elemp); + } + } else { + if (is_xmlns == 1) { + if (nsptr->href) { + xmlFree((xmlChar*)nsptr->href); + } + nsptr->href = xmlStrdup((xmlChar*)value.data()); + } + } + + if (errorcode == 0 && is_xmlns == 0) { + attr = xmlSetNsProp(elemp, nsptr, (xmlChar*)localname, (xmlChar*)value.data()); + } + } else { + name_valid = xmlValidateName((xmlChar*)localname, 0); + if (name_valid != 0) { + errorcode = INVALID_CHARACTER_ERR; + stricterror = 1; + } else { + attr = xmlHasProp(elemp, (xmlChar*)localname); + if (attr != NULL && attr->type != XML_ATTRIBUTE_DECL) { + node_list_unlink(attr->children); + } + attr = xmlSetProp(elemp, (xmlChar*)localname, (xmlChar*)value.data()); + } + } + } + xmlFree(localname); + if (prefix != NULL) { + xmlFree(prefix); + } + if (errorcode != 0) { + //php_dom_throw_error(errorcode, stricterror TSRMLS_CC); + } + return null; +} + +Variant c_domelement::t_setidattribute(CStrRef name, bool isid) { + xmlNodePtr nodep = m_node; + xmlAttrPtr attrp; + if (dom_node_is_read_only(nodep)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return null; + } + attrp = xmlHasNsProp(nodep, (xmlChar*)name.data(), NULL); + if (attrp == NULL || attrp->type == XML_ATTRIBUTE_DECL) { + //php_dom_throw_error(NOT_FOUND_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + } else { + php_set_attribute_id(attrp, isid); + } + return null; +} + +Variant c_domelement::t_setidattributenode(CObjRef idattr, bool isid) { + xmlNodePtr nodep = m_node; + SmartObject domattr = idattr.getTyped(); + xmlAttrPtr attrp = (xmlAttrPtr)domattr->m_node; + if (dom_node_is_read_only(nodep)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return null; + } + if (attrp->parent != nodep) { + //php_dom_throw_error(NOT_FOUND_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + } else { + php_set_attribute_id(attrp, isid); + } + return null; +} + +Variant c_domelement::t_setidattributens(CStrRef namespaceuri, CStrRef localname, bool isid) { + xmlNodePtr elemp = m_node; + xmlAttrPtr attrp; + if (dom_node_is_read_only(elemp)) { + //php_dom_throw_error(NO_MODIFICATION_ALLOWED_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + return null; + } + attrp = xmlHasNsProp(elemp, (xmlChar*)localname.data(), (xmlChar*)namespaceuri.data()); + if (attrp == NULL || attrp->type == XML_ATTRIBUTE_DECL) { + //php_dom_throw_error(NOT_FOUND_ERR, dom_get_strict_error(intern->document) TSRMLS_CC); + } else { + php_set_attribute_id(attrp, isid); + } + return null; +} + +c_domentity::c_domentity() { +} + +c_domentity::~c_domentity() { +} + +void c_domentity::t___construct() { + throw NotImplementedException(__func__); +} + +Variant c_domentity::t___destruct() { + return null; +} + +c_domentityreference::c_domentityreference() { +} + +c_domentityreference::~c_domentityreference() { +} + +void c_domentityreference::t___construct(CVarRef name) { + throw NotImplementedException(__func__); +} + +Variant c_domentityreference::t___destruct() { + return null; +} + +c_domnotation::c_domnotation() { +} + +c_domnotation::~c_domnotation() { +} + +void c_domnotation::t___construct() { + throw NotImplementedException(__func__); +} + +Variant c_domnotation::t___destruct() { + return null; +} + +c_domprocessinginstruction::c_domprocessinginstruction() { +} + +c_domprocessinginstruction::~c_domprocessinginstruction() { +} + +void c_domprocessinginstruction::t___construct(CVarRef name, CVarRef value /*= null_variant*/) { + throw NotImplementedException(__func__); +} + +Variant c_domprocessinginstruction::t___destruct() { + return null; +} + +c_domnamednodemap::c_domnamednodemap() { +} + +c_domnamednodemap::~c_domnamednodemap() { +} + +void c_domnamednodemap::t___construct() { + throw NotImplementedException(__func__); +} + +Variant c_domnamednodemap::t___destruct() { + return null; +} + +Variant c_domnamednodemap::t_getnameditem(CStrRef name) { + throw NotImplementedException(__func__); +} + +Variant c_domnamednodemap::t_getnameditemns(CStrRef namespaceuri, CStrRef localname) { + throw NotImplementedException(__func__); +} + +Object c_domnamednodemap::t_item(int64 index) { + throw NotImplementedException(__func__); +} + +c_domnodelist::c_domnodelist() { +} + +c_domnodelist::~c_domnodelist() { +} + +void c_domnodelist::t___construct() { + throw NotImplementedException(__func__); +} + +Variant c_domnodelist::t___destruct() { + return null; +} + +Object c_domnodelist::t_item(int64 index) { + throw NotImplementedException(__func__); +} + +c_domexception::c_domexception() { +} + +c_domexception::~c_domexception() { +} + +void c_domexception::t___construct() { + throw NotImplementedException(__func__); +} + +Variant c_domexception::t___destruct() { + return null; +} + +c_domimplementation::c_domimplementation() { +} + +c_domimplementation::~c_domimplementation() { +} + +void c_domimplementation::t___construct() { + throw NotImplementedException(__func__); +} + +Variant c_domimplementation::t___destruct() { + return null; +} + +Variant c_domimplementation::t_createdocument(CStrRef namespaceuri /* = null_string */, CStrRef qualifiedname /* = null_string */, CObjRef doctypeobj /* = null_object */) { + xmlDoc *docp; + xmlNode *nodep; + xmlNsPtr nsptr = NULL; + int errorcode = 0; + char *prefix = NULL, *localname = NULL; + xmlDtdPtr doctype = NULL; + if (!doctypeobj.isNull()) { + SmartObject domdoctype = doctypeobj.getTyped(); + doctype = (xmlDtdPtr)domdoctype->m_node; + if (doctype->type == XML_DOCUMENT_TYPE_NODE) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid DocumentType object"); + return false; + } + if (doctype->doc != NULL) { + //php_dom_throw_error(WRONG_DOCUMENT_ERR, 1 TSRMLS_CC); + return false; + } + } else { + //doctobj = NULL; + } + if (qualifiedname.size() > 0) { + errorcode = dom_check_qname((char*)qualifiedname.data(), (char**)&localname, (char**)&prefix, 1, qualifiedname.size()); + if (errorcode == 0 && namespaceuri.size() > 0 && ((nsptr = xmlNewNs(NULL, (xmlChar*)namespaceuri.data(), (xmlChar*)prefix)) == NULL)) { + errorcode = NAMESPACE_ERR; + } + } + if (prefix != NULL) { + xmlFree(prefix); + } + if (errorcode != 0) { + if (localname != NULL) { + xmlFree(localname); + } + //php_dom_throw_error(errorcode, 1 TSRMLS_CC); + return false; + } + /* currently letting libxml2 set the version string */ + docp = xmlNewDoc(NULL); + if (!docp) { + if (localname != NULL) { + xmlFree(localname); + } + return false; + } + if (doctype != NULL) { + docp->intSubset = doctype; + doctype->parent = docp; + doctype->doc = docp; + docp->children = (xmlNodePtr)doctype; + docp->last = (xmlNodePtr)doctype; + } + if (localname != NULL) { + nodep = xmlNewDocNode(docp, nsptr, (xmlChar*)localname, NULL); + if (!nodep) { + if (doctype != NULL) { + docp->intSubset = NULL; + doctype->parent = NULL; + doctype->doc = NULL; + docp->children = NULL; + docp->last = NULL; + } + xmlFreeDoc(docp); + xmlFree(localname); + /* Need some type of error here */ + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected Error"); + return false; + } + nodep->nsDef = nsptr; + xmlDocSetRootElement(docp, nodep); + xmlFree(localname); + } + SmartObject ret = NEW(c_domdocument)(); + ret->m_node = (xmlNodePtr)docp; + //if (doctobj != NULL) { + //doctobj->document = ((dom_object *)((php_libxml_node_ptr *)docp->_private)->_private)->document; + //php_libxml_increment_doc_ref((php_libxml_node_object *)doctobj, docp TSRMLS_CC); + //} + return ret; +} + +Variant c_domimplementation::t_createdocumenttype(CStrRef qualifiedname /* = null_string */, CStrRef publicid /* = null_string */, CStrRef systemid /* = null_string */) { + xmlDtd *doctype; + xmlChar *pch1 = NULL, *pch2 = NULL, *localname = NULL; + xmlURIPtr uri; + if (qualifiedname.size() == 0) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "qualifiedName is required"); + return false; + } + if (publicid.size() > 0) + pch1 = (xmlChar*)publicid.data(); + if (systemid.size() > 0) + pch2 = (xmlChar*)systemid.data(); + uri = xmlParseURI((char*)qualifiedname.data()); + if (uri != NULL && uri->opaque != NULL) { + localname = xmlStrdup((xmlChar*)uri->opaque); + if (xmlStrchr(localname, (xmlChar)':') != NULL) { + //php_dom_throw_error(NAMESPACE_ERR, 1 TSRMLS_CC); + xmlFreeURI(uri); + xmlFree(localname); + return false; + } + } else { + localname = xmlStrdup((xmlChar*)qualifiedname.data()); + } + if (uri) { + xmlFreeURI(uri); + } + doctype = xmlCreateIntSubset(NULL, localname, pch1, pch2); + xmlFree(localname); + if (doctype == NULL) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create DocumentType"); + return false; + } + SmartObject ret = NEW(c_domnode)(); + ret->m_node = (xmlNodePtr)doctype; + return ret; +} + +bool c_domimplementation::t_hasfeature(CStrRef feature, CStrRef version) { + if (dom_has_feature((char*)feature.data(), (char*)version.data())) { + return true; + } else { + return false; + } +} + +c_domxpath::c_domxpath() { +} + +c_domxpath::~c_domxpath() { +} + +void c_domxpath::t___construct(CVarRef doc) { + throw NotImplementedException(__func__); +} + +Variant c_domxpath::t___destruct() { + return null; +} + +Variant c_domxpath::t_evaluate(CStrRef expr, CObjRef context /* = null_object */) { + return php_xpath_eval(this, expr, context, PHP_DOM_XPATH_EVALUATE); +} + +Variant c_domxpath::t_query(CStrRef expr, CObjRef context /* = null_object */) { + return php_xpath_eval(this, expr, context, PHP_DOM_XPATH_QUERY); +} + +bool c_domxpath::t_registernamespace(CStrRef prefix, CStrRef uri) { + xmlXPathContextPtr ctxp = (xmlXPathContextPtr)m_node; + if (ctxp == NULL) { + //php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid XPath Context"); + return false; + } + if (xmlXPathRegisterNs(ctxp, (xmlChar*)prefix.data(), (xmlChar*)uri.data()) != 0) { + return false; + } + return true; +} + +Variant c_domxpath::t_registerphpfunctions(CVarRef funcs /* = null */) { + // This one looks tricky... + throw NotImplementedException(__func__); +} + + +/////////////////////////////////////////////////////////////////////////////// + +} diff --git a/src/cpp/ext/ext_domdocument.h b/src/cpp/ext/ext_domdocument.h new file mode 100644 index 0000000000000..32ce0601ee7dd --- /dev/null +++ b/src/cpp/ext/ext_domdocument.h @@ -0,0 +1,610 @@ + +#ifndef __EXT_DOMDOCUMENT_H__ +#define __EXT_DOMDOCUMENT_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +// class DOMNode + +FORWARD_DECLARE_CLASS(domnode); +class c_domnode : public ObjectData { + public: + BEGIN_CLASS_MAP(domnode) + END_CLASS_MAP(domnode) + DECLARE_CLASS(domnode, DOMNode, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domnode(); + public: ~c_domnode(); + public: void t___construct(); + public: Variant t_appendchild(CObjRef newnode); + public: Variant t_clonenode(bool deep = false); + public: int64 t_getlineno(); + public: bool t_hasattributes(); + public: bool t_haschildnodes(); + public: Variant t_insertbefore(CObjRef newnode, CObjRef refnode = null); + public: bool t_isdefaultnamespace(CStrRef namespaceuri); + public: bool t_issamenode(CObjRef node); + public: bool t_issupported(CStrRef feature, CStrRef version); + public: Variant t_lookupnamespaceuri(CStrRef namespaceuri); + public: Variant t_lookupprefix(CStrRef prefix); + public: void t_normalize(); + public: Variant t_removechild(CObjRef node); + public: Variant t_replacechild(CObjRef newchildobj, CObjRef oldchildobj); + public: Variant t_c14n(bool exclusive = false, bool with_comments = false, CVarRef xpath = null, CVarRef ns_prefixes = null); + public: Variant t_c14nfile(CStrRef uri, bool exclusive = false, bool with_comments = false, CVarRef xpath = null, CVarRef ns_prefixes = null); + public: Variant t_getnodepath(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: + xmlNodePtr m_node; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMAttr + +FORWARD_DECLARE_CLASS(domattr); +class c_domattr: public c_domnode { + public: + BEGIN_CLASS_MAP(domattr) + PARENT_CLASS(domnode) + END_CLASS_MAP(domattr) + DECLARE_CLASS(domattr, DOMAttr, domnode) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domattr(); + public: ~c_domattr(); + public: void t___construct(CVarRef name, CVarRef value); + public: bool t_isid(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant name, Variant value); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMCharacterData + +FORWARD_DECLARE_CLASS(domcharacterdata); +class c_domcharacterdata: public c_domnode { + public: + BEGIN_CLASS_MAP(domcharacterdata) + PARENT_CLASS(domnode) + END_CLASS_MAP(domcharacterdata) + DECLARE_CLASS(domcharacterdata, DOMCharacterData, domnode) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domcharacterdata(); + public: ~c_domcharacterdata(); + public: void t___construct(CVarRef value); + public: bool t_appenddata(CStrRef arg); + public: bool t_deletedata(int64 offset, int64 count); + public: bool t_insertdata(int64 offset, CStrRef data); + public: bool t_replacedata(int64 offset, int64 count, CStrRef data); + public: String t_substringdata(int64 offset, int64 count); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant value); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMComment + +FORWARD_DECLARE_CLASS(domcomment); +class c_domcomment: public c_domcharacterdata { + public: + BEGIN_CLASS_MAP(domcomment) + PARENT_CLASS(domcharacterdata) + END_CLASS_MAP(domcomment) + DECLARE_CLASS(domcomment, DOMComment, domcharacterdata) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domcomment(); + public: ~c_domcomment(); + public: void t___construct(CVarRef value); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant value); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMText + +FORWARD_DECLARE_CLASS(domtext); +class c_domtext: public c_domcharacterdata { + public: + BEGIN_CLASS_MAP(domtext) + PARENT_CLASS(domcharacterdata) + END_CLASS_MAP(domtext) + DECLARE_CLASS(domtext, DOMText, domcharacterdata) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domtext(); + public: ~c_domtext(); + public: void t___construct(CVarRef value); + public: bool t_iswhitespaceinelementcontent(); + public: Variant t_splittext(int64 offset); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant value); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMCdataSection + +FORWARD_DECLARE_CLASS(domcdatasection); +class c_domcdatasection: public c_domtext { + public: + BEGIN_CLASS_MAP(domcdatasection) + PARENT_CLASS(domtext) + END_CLASS_MAP(domcdatasection) + DECLARE_CLASS(domcdatasection, DOMCdataSection, domtext) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domcdatasection(); + public: ~c_domcdatasection(); + public: void t___construct(CVarRef value); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant value); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMDocument + +FORWARD_DECLARE_CLASS(domdocument); +class c_domdocument: public c_domnode { + public: + BEGIN_CLASS_MAP(domdocument) + PARENT_CLASS(domnode) + END_CLASS_MAP(domdocument) + DECLARE_CLASS(domdocument, DOMDocument, domnode) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domdocument(); + public: ~c_domdocument(); + public: void t___construct(CStrRef version, CStrRef encoding); + public: Variant t_createattribute(CStrRef name); + public: Variant t_createattributens(CStrRef namespaceuri, CStrRef qualifiedname); + public: Variant t_createcdatasection(CStrRef data); + public: Variant t_createcomment(CStrRef data); + public: Variant t_createdocumentfragment(); + public: Variant t_createelement(CStrRef name, CStrRef value = null_string); + public: Variant t_createelementns(CStrRef namespaceuri, CStrRef qualifiedname, CStrRef value = null_string); + public: Variant t_createentityreference(CStrRef name); + public: Variant t_createprocessinginstruction(CStrRef target, CStrRef data = null_string); + public: Variant t_createtextnode(CStrRef data); + public: Variant t_getelementbyid(CStrRef elementid); + public: Variant t_getelementsbytagname(CStrRef name); + public: Variant t_getelementsbytagnamens(CStrRef namespaceuri, CStrRef localname); + public: Variant t_importnode(CObjRef importednode, bool deep = false); + public: Variant t_load(CStrRef filename, int64 options = 0); + public: Variant t_loadhtml(CStrRef source); + public: Variant t_loadhtmlfile(CStrRef filename); + public: Variant t_loadxml(CStrRef source, int64 options = 0); + public: void t_normalizedocument(); + public: bool t_registernodeclass(CStrRef baseclass, CStrRef extendedclass); + public: bool t_relaxngvalidate(CStrRef filename); + public: bool t_relaxngvalidatesource(CStrRef source); + public: Variant t_save(CStrRef file, int64 options = 0); + public: Variant t_savehtml(); + public: Variant t_savehtmlfile(CStrRef file); + public: Variant t_savexml(CObjRef node = null_object, int64 options = 0); + public: bool t_schemavalidate(CStrRef filename); + public: bool t_schemavalidatesource(CStrRef source); + public: bool t_validate(); + public: Variant t_xinclude(int64 options = 0); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(String version, String encoding); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMDocumentFragment + +FORWARD_DECLARE_CLASS(domdocumentfragment); +class c_domdocumentfragment: public c_domnode { + public: + BEGIN_CLASS_MAP(domdocumentfragment) + PARENT_CLASS(domnode) + END_CLASS_MAP(domdocumentfragment) + DECLARE_CLASS(domdocumentfragment, DOMDocumentFragment, domnode) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domdocumentfragment(); + public: ~c_domdocumentfragment(); + public: void t___construct(); + public: bool t_appendxml(CStrRef data); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMDocumentType + +FORWARD_DECLARE_CLASS(domdocumenttype); +class c_domdocumenttype: public c_domnode { + public: + BEGIN_CLASS_MAP(domdocumenttype) + PARENT_CLASS(domnode) + END_CLASS_MAP(domdocumenttype) + DECLARE_CLASS(domdocumenttype, DOMDocumentType, domnode) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domdocumenttype(); + public: ~c_domdocumenttype(); + public: void t___construct(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMElement + +FORWARD_DECLARE_CLASS(domelement); +class c_domelement: public c_domnode { + public: + BEGIN_CLASS_MAP(domelement) + PARENT_CLASS(domnode) + END_CLASS_MAP(domelement) + DECLARE_CLASS(domelement, DOMElement, domnode) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domelement(); + public: ~c_domelement(); + public: void t___construct(CVarRef name, CVarRef value, CVarRef namespaceuri); + public: String t_getattribute(CStrRef name); + public: Variant t_getattributenode(CStrRef name); + public: Object t_getattributenodens(CStrRef namespaceuri, CStrRef localname); + public: String t_getattributens(CStrRef namespaceuri, CStrRef localname); + public: Object t_getelementsbytagname(CStrRef name); + public: Object t_getelementsbytagnamens(CStrRef namespaceuri, CStrRef localname); + public: bool t_hasattribute(CStrRef name); + public: bool t_hasattributens(CStrRef namespaceuri, CStrRef localname); + public: bool t_removeattribute(CStrRef name); + public: Variant t_removeattributenode(CObjRef oldattr); + public: Variant t_removeattributens(CStrRef namespaceuri, CStrRef localname); + public: Variant t_setattribute(CStrRef name, CStrRef value); + public: Variant t_setattributenode(CObjRef newattr); + public: Variant t_setattributenodens(CObjRef newattr); + public: Variant t_setattributens(CStrRef namespaceuri, CStrRef name, CStrRef value); + public: Variant t_setidattribute(CStrRef name, bool isid); + public: Variant t_setidattributenode(CObjRef idattr, bool isid); + public: Variant t_setidattributens(CStrRef namespaceuri, CStrRef localname, bool isid); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant name, Variant value, Variant namespaceuri); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMEntity + +FORWARD_DECLARE_CLASS(domentity); +class c_domentity: public c_domnode { + public: + BEGIN_CLASS_MAP(domentity) + PARENT_CLASS(domnode) + END_CLASS_MAP(domentity) + DECLARE_CLASS(domentity, DOMEntity, domnode) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domentity(); + public: ~c_domentity(); + public: void t___construct(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMEntityReference + +FORWARD_DECLARE_CLASS(domentityreference); +class c_domentityreference: public c_domnode { + public: + BEGIN_CLASS_MAP(domentityreference) + PARENT_CLASS(domnode) + END_CLASS_MAP(domentityreference) + DECLARE_CLASS(domentityreference, DOMEntityReference, domnode) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domentityreference(); + public: ~c_domentityreference(); + public: void t___construct(CVarRef name); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant name); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMNotation + +FORWARD_DECLARE_CLASS(domnotation); +class c_domnotation: public c_domnode { + public: + BEGIN_CLASS_MAP(domnotation) + PARENT_CLASS(domnode) + END_CLASS_MAP(domnotation) + DECLARE_CLASS(domnotation, DOMNotation, domnode) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domnotation(); + public: ~c_domnotation(); + public: void t___construct(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMProcessingInstruction + +FORWARD_DECLARE_CLASS(domprocessinginstruction); +class c_domprocessinginstruction: public c_domnode { + public: + BEGIN_CLASS_MAP(domprocessinginstruction) + PARENT_CLASS(domnode) + END_CLASS_MAP(domprocessinginstruction) + DECLARE_CLASS(domprocessinginstruction, DOMProcessingInstruction, domnode) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domprocessinginstruction(); + public: ~c_domprocessinginstruction(); + public: void t___construct(CVarRef name, CVarRef value = null_variant); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant name, Variant value = null_variant); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMNamedNodeMap + +FORWARD_DECLARE_CLASS(domnamednodemap); +class c_domnamednodemap : public ObjectData { + public: + BEGIN_CLASS_MAP(domnamednodemap) + END_CLASS_MAP(domnamednodemap) + DECLARE_CLASS(domnamednodemap, DOMNamedNodeMap, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domnamednodemap(); + public: ~c_domnamednodemap(); + public: void t___construct(); + public: Variant t_getnameditem(CStrRef name); + public: Variant t_getnameditemns(CStrRef namespaceuri, CStrRef localname); + public: Object t_item(int64 index); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMNodeList + +FORWARD_DECLARE_CLASS(domnodelist); +class c_domnodelist : public ObjectData { + public: + BEGIN_CLASS_MAP(domnodelist) + END_CLASS_MAP(domnodelist) + DECLARE_CLASS(domnodelist, DOMNodeList, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domnodelist(); + public: ~c_domnodelist(); + public: void t___construct(); + public: Object t_item(int64 index); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMException + +FORWARD_DECLARE_CLASS(domexception); +class c_domexception: public c_exception { + public: + BEGIN_CLASS_MAP(domexception) + PARENT_CLASS(exception) + END_CLASS_MAP(domexception) + DECLARE_CLASS(domexception, DOMException, exception) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domexception(); + public: ~c_domexception(); + public: void t___construct(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMImplementation + +FORWARD_DECLARE_CLASS(domimplementation); +class c_domimplementation : public ObjectData { + public: + BEGIN_CLASS_MAP(domimplementation) + END_CLASS_MAP(domimplementation) + DECLARE_CLASS(domimplementation, DOMImplementation, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domimplementation(); + public: ~c_domimplementation(); + public: void t___construct(); + public: Variant t_createdocument(CStrRef namespaceuri = null_string, CStrRef qualifiedname = null_string, CObjRef doctypeobj = null_object); + public: Variant t_createdocumenttype(CStrRef qualifiedname = null_string, CStrRef publicid = null_string, CStrRef systemid = null_string); + public: bool t_hasfeature(CStrRef feature, CStrRef version); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class DOMXPath + +FORWARD_DECLARE_CLASS(domxpath); +class c_domxpath : public ObjectData { + public: + BEGIN_CLASS_MAP(domxpath) + END_CLASS_MAP(domxpath) + DECLARE_CLASS(domxpath, DOMXPath, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_domxpath(); + public: ~c_domxpath(); + public: void t___construct(CVarRef doc); + public: Variant t_evaluate(CStrRef expr, CObjRef context = null_object); + public: Variant t_query(CStrRef expr, CObjRef context = null_object); + public: bool t_registernamespace(CStrRef prefix, CStrRef uri); + public: Variant t_registerphpfunctions(CVarRef funcs = null); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant doc); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: + xmlNodePtr m_node; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_DOMDOCUMENT_H__ diff --git a/src/cpp/ext/ext_error.cpp b/src/cpp/ext/ext_error.cpp new file mode 100644 index 0000000000000..bb80ad33ed9b0 --- /dev/null +++ b/src/cpp/ext/ext_error.cpp @@ -0,0 +1,136 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Array f_debug_backtrace() { + if (RuntimeOption::InjectedStacktrace) { + return FrameInjection::getBacktrace(true); + } else { + StackTrace st; + return stackTraceToBackTrace(st); + } +} + +void f_debug_print_backtrace() { + if (RuntimeOption::InjectedStacktrace) { + Array bt = FrameInjection::getBacktrace(true); + int i = 0; + for (ArrayIter it = bt.begin(); !it.end(); it.next(), i++) { + Array frame = it.second().toArray(); + StringBuffer buf; + buf.append('#'); + buf.append(i); + if (i < 10) buf.append(' '); + buf.append(' '); + if (frame.exists("class")) { + buf.append(frame->get("class").toString()); + buf.append(frame->get("type").toString()); + } + buf.append(frame->get("function").toString()); + buf.append("()"); + if (frame.exists("file")) { + buf.append(" called at ["); + buf.append(frame->get("file").toString()); + buf.append(':'); + buf.append(frame->get("line").toString()); + buf.append(']'); + } + buf.append('\n'); + echo(buf.detach()); + } + } else { + StackTrace st; + echo(String(st.toString())); + } +} + +Array f_error_get_last() { + String lastError = g_context->getLastError(); + if (lastError.isNull()) { + return (ArrayData *)NULL; + } else { + return CREATE_VECTOR1(g_context->getLastError()); + } +} + +bool f_error_log(CStrRef message, int message_type /* = 0 */, + CStrRef destination /* = null_string */, + CStrRef extra_headers /* = null_string */) { + String line = message.replace("\n", "\\n"); + Logger::Error("%s", line.data()); + return true; +} + +int f_error_reporting(int level /* = 0 */) { + int oldErrorReportingLevel = g_context->getErrorReportingLevel(); + g_context->setErrorReportingLevel(level); + return oldErrorReportingLevel; +} + +bool f_restore_error_handler() { + g_context->popSystemExceptionHandler(); + return true; +} + +bool f_restore_exception_handler() { + g_context->popUserExceptionHandler(); + return false; +} + +Variant f_set_error_handler(CStrRef error_handler, int error_types /* = 0 */) { + return g_context->pushSystemExceptionHandler(error_handler); +} + +String f_set_exception_handler(CStrRef exception_handler) { + return g_context->pushUserExceptionHandler(exception_handler); +} + +bool f_trigger_error(CStrRef error_msg, + int error_type /* = k_E_USER_NOTICE */) { + Logger::LogLevelType level; + if (error_type == k_E_USER_ERROR) { + level = Logger::LogError; + } else if (error_type == k_E_USER_WARNING) { + level = Logger::LogWarning; + } else if (error_type == k_E_USER_NOTICE) { + level = Logger::LogVerbose; + } else { + return false; + } + if (Logger::LogLevel <= level) { + throw Exception("Error %d: %s", error_type, (const char *)error_msg); + } + return true; +} + +bool f_user_error(CStrRef error_msg, int error_type /* = k_E_USER_NOTICE */) { + return f_trigger_error(error_msg, error_type); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_error.h b/src/cpp/ext/ext_error.h new file mode 100644 index 0000000000000..5a1e1b9551733 --- /dev/null +++ b/src/cpp/ext/ext_error.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_ERROR_H__ +#define __EXT_ERROR_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Array f_debug_backtrace(); +void f_debug_print_backtrace(); +Array f_error_get_last(); +bool f_error_log(CStrRef message, int message_type = 0, CStrRef destination = null_string, CStrRef extra_headers = null_string); +int f_error_reporting(int level = 0); +bool f_restore_error_handler(); +bool f_restore_exception_handler(); +Variant f_set_error_handler(CStrRef error_handler, int error_types = 0); +String f_set_exception_handler(CStrRef exception_handler); +bool f_trigger_error(CStrRef error_msg, int error_type = k_E_USER_NOTICE); +bool f_user_error(CStrRef error_msg, int error_type = k_E_USER_NOTICE); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_ERROR_H__ diff --git a/src/cpp/ext/ext_fbml.cpp b/src/cpp/ext/ext_fbml.cpp new file mode 100644 index 0000000000000..ed7cd9eab1a7f --- /dev/null +++ b/src/cpp/ext/ext_fbml.cpp @@ -0,0 +1,650 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace std; + +#define MAXTAGSIZE 512 + +namespace HPHP { + +static ReadWriteMutex s_mutex; +/////////////////////////////////////////////////////////////////////////////// +// helpers + +class FBMLTree : public SweepableResourceData { +public: + DECLARE_OBJECT_ALLOCATION(FBMLTree); + + FBMLTree(fbml_node *tree) : m_tree(tree) { + } + + virtual ~FBMLTree() { + if (m_tree) { + fbml_node_free(m_tree); + m_tree = NULL; + } + } + + // overriding ResourceData + const char *o_getClassName() const { return "FBMLTree";} + +private: + fbml_node *m_tree; +}; +IMPLEMENT_OBJECT_ALLOCATION(FBMLTree); + +/** + * This class doesn't need to be SweepableResourceData, as there is nothing + * in its data members to free during garbage collection time, nor itself. + * Both m_tree and itself are object allocation that will be collected + * automatically. This is a very special case. + */ +class FBMLNode : public ResourceData { +public: + DECLARE_OBJECT_ALLOCATION(FBMLNode); + + FBMLNode(fbml_node *node, CObjRef tree) : m_node(node), m_tree(tree) { + } + + // overriding ResourceData + const char *o_getClassName() const { return "FBMLNode";} + + fbml_node *m_node; + Object m_tree; // this is just to make sure m_node is not free-d by anyone +}; +IMPLEMENT_OBJECT_ALLOCATION(FBMLNode); + +static void copy_hash_to_strings(CArrRef contains_hash, char ** strings, + vector &holder) { + int i = 0; + for (ArrayIter iter(contains_hash); iter; ++iter) { + String s = iter.second().toString(); + holder.push_back(s); // so "s" won't be deallocated + strings[i++] = (char*)s.data(); + } + strings[i] = NULL; +} + +static fbml_schema *make_fbml_schema() { + fbml_schema *in_schema = new fbml_schema(); + in_schema->illegal_children = (char**)malloc(MAXTAGSIZE*sizeof(char*)); + in_schema->illegal_children_attr = (char**)malloc(MAXTAGSIZE*sizeof(char*)); + return in_schema; +} + +static void free_fbml_schema(fbml_schema *schema) { + free(schema->illegal_children); + free(schema->illegal_children_attr); + delete schema; +} + +static fbml_context_schema * +make_fbml_context_schema(char * key, fbml_schema * in_schema) { + fbml_context_schema *new_context = new fbml_context_schema(); + new_context->context_tag = key; + new_context->schema = (fbml_schema **)malloc(2 * sizeof(fbml_schema*)); + new_context->schema[0] = in_schema; + new_context->schema[1] = NULL; + return new_context; +} + +static void free_fbml_context_schema(fbml_context_schema *context) { + free_fbml_schema(context->schema[0]); + free(context->schema); + delete context; +} + +/////////////////////////////////////////////////////////////////////////////// +// sanitizers + +struct callback_parameter { + String user_func_name; + Variant user_data; + const char *fallback; /* what string to return when a failure occurs */ + + String id_prefix; + String id_selector; +}; + +static char *callback_user_function(char *input, void *data) { + struct callback_parameter *param = (struct callback_parameter*)data; + + Array params; + params.append(param->user_data); + params.append(input); + Variant vret = invoke(param->user_func_name.data(), params); + String sret = vret.toString(); + const char *ret = sret.data(); + + return strdup((ret && *ret) ? ret : param->fallback); +} + +static char *callback_attr_function(char *tag, char *attr, char *val, + void *data) { + struct callback_parameter *param = (struct callback_parameter*)data; + + Array params; + params.append(param->user_data); + params.append(tag); + params.append(attr); + params.append(val); + Variant ret = invoke(param->user_func_name.data(), params); + + return strdup(ret.toString().data()); +} +struct node_callback_parameter { + String user_func_name; + Variant user_data; + Object tree; + const char *fallback; /* what string to return when a failure occurs */ +}; + +static char *callback_node_function(struct fbml_node *node, void *data) { + node_callback_parameter *param = (node_callback_parameter*)data; + + Array params; + params.append(param->user_data); + params.append(Object(NEW(FBMLNode)(node, param->tree))); + Variant ret = invoke(param->user_func_name.data(), params); + + return strdup(ret.toString().data()); +} + +static fbml_css_sanitizer * +get_css_sanitizer(CVarRef sanitizer, callback_parameter *param, + fbml_css_sanitizer *css_sanitizer) { + if (sanitizer.isNull()) return NULL; + + Variant v = sanitizer["func"]; + if (!v.isNull()) { + param->user_func_name = v.toString(); + } else { + param->user_func_name = "fbml_css_translate_url"; + } + v = sanitizer["data"]; + if (!v.isNull()) { + param->user_data = v; + } + v = sanitizer["prefix"]; + if (!v.isNull()) { + String s = v.toString(); + param->id_prefix = s; + css_sanitizer->container_selector = (char*)s.data(); + } else { + css_sanitizer->container_selector = NULL; + } + v = sanitizer["id_selector"]; + if (!v.isNull()) { + String s = v.toString(); + param->id_selector = s; + css_sanitizer->identifier_prefix = (char*)s.data(); + } else { + css_sanitizer->identifier_prefix = NULL; + } + + param->fallback = "\"\""; + css_sanitizer->pfunc_url_translator = callback_user_function; + css_sanitizer->url_translate_data = param; + return css_sanitizer; +} + +static fbml_js_sanitizer * +get_js_sanitizer(CVarRef sanitizer, callback_parameter *param, + fbml_js_sanitizer *js_sanitizer) { + fbml_js_sanitizer_init(js_sanitizer); + + if (sanitizer.isNull() || sanitizer.toArray().empty()) return NULL; + + // non-array or empty array is treated as no sanitization + Variant v = sanitizer["func"]; + if (!v.isNull()) { + param->user_func_name = v.toString(); + } else { + param->user_func_name = "fbml_js_translate_event_handler"; + } + v = sanitizer["data"]; + if (!v.isNull()) { + param->user_data = v; + } + v = sanitizer["prefix"]; + if (!v.isNull()) { + String s = v.toString(); + param->id_prefix = s; + js_sanitizer->identifier_prefix = (char*)s.data(); + } + v = sanitizer["that"]; + if (!v.isNull()) { + String s = v.toString(); + param->id_selector = s; // all we need is to hold the String + js_sanitizer->this_replacement = (char*)s.data(); + } + param->fallback = ""; + js_sanitizer->pfunc_eh_translator = callback_user_function; + js_sanitizer->eh_translate_data = param; + return js_sanitizer; +} + +static fbml_attr_rewriter * +get_attr_rewriter(CVarRef rewriter, callback_parameter *param, + fbml_attr_rewriter *attr_rewriter) { + if (rewriter.isNull()) return NULL; + + Variant v = rewriter["func"]; + if (!v.isNull()) { + param->user_func_name = v.toString(); + } else { + param->user_func_name = "fbml_rewrite_event_handler"; + } + v = rewriter["data"]; + if (!v.isNull()) { + param->user_data = v; + } + param->fallback = ""; + attr_rewriter->pfunc_rewriter = callback_attr_function; + attr_rewriter->rewrite_data = param; + return attr_rewriter; +} + +/////////////////////////////////////////////////////////////////////////////// +// fbml + +bool f_fbml_tag_list_expanded_11() { + return fbml_tag_list_expanded(); +} + +void f_fbml_complex_expand_tag_list_11(CArrRef new_tags, CArrRef new_attrs, + CArrRef special_html, CArrRef precache, + CArrRef style, CArrRef style_attrs, + CArrRef script_attrs, + CArrRef rewrite_attrs, + CArrRef special_attrs, + CArrRef schema) { + vector holder; // hold Strings so interal char* will live longer + holder.reserve(1024); + + // Extension Tags + char *tags[MAXTAGSIZE]; + copy_hash_to_strings(new_tags, tags, holder); + + // Extension Attrs + char *attrs[MAXTAGSIZE]; + copy_hash_to_strings(new_attrs, attrs, holder); + + // special, precache, style, macros + fbml_flaggable_tags *flagged_tags_pointers[5]; + fbml_flaggable_tags flagged_tags[4]; + char *tags_tags[4][MAXTAGSIZE]; + +#define MAKE_TAG_FLAGS(i, hash, TAG) \ + copy_hash_to_strings(hash, tags_tags[i], holder); \ + flagged_tags[i].tags = tags_tags[i]; \ + flagged_tags[i].flag = TAG; \ + flagged_tags_pointers[i] = &flagged_tags[i]; \ + + MAKE_TAG_FLAGS(0, special_html, FB_FLAG_SPECIAL_HTML); + MAKE_TAG_FLAGS(1, precache, FB_FLAG_PRECACHE); + MAKE_TAG_FLAGS(2, new_tags, FB_FLAG_FBNODE); + MAKE_TAG_FLAGS(3, style, FB_FLAG_STYLE); + flagged_tags_pointers[4] = NULL; + + // style, script, special, rewrite + fbml_flaggable_attrs *flagged_attrs_pointers[5]; + fbml_flaggable_attrs flagged_attrs[4]; + char *attrs_tags[4][MAXTAGSIZE]; + +#define MAKE_ATTR_FLAGS(i, hash, TAG) \ + copy_hash_to_strings(hash, attrs_tags[i], holder); \ + flagged_attrs[i].attrs = attrs_tags[i]; \ + flagged_attrs[i].flag = TAG; \ + flagged_attrs_pointers[i] = &flagged_attrs[i]; \ + + MAKE_ATTR_FLAGS(0, special_attrs, FB_FLAG_ATTR_SPECIAL); + MAKE_ATTR_FLAGS(1, rewrite_attrs, FB_FLAG_ATTR_REWRITE); + MAKE_ATTR_FLAGS(2, script_attrs, FB_FLAG_ATTR_SCRIPT); + MAKE_ATTR_FLAGS(3, style_attrs, FB_FLAG_ATTR_STYLE); + flagged_attrs_pointers[4] = NULL; + + // schema - double loop {"context_tag" -> [tags]} + fbml_context_schema *context_schema[MAXTAGSIZE]; + int i = 0; + for (ArrayIter iter(schema); iter; ++iter) { + fbml_schema *in_schema = make_fbml_schema(); + + int n_children = 0; + int n_attr = 0; + + Array arrTags = iter.second(); + for (ArrayIter iterTag(arrTags); iterTag; ++iterTag) { + String tag = iterTag.second(); + holder.push_back(tag); + const char *s = tag.data(); + if (s[0] != '_') { + in_schema->illegal_children[n_children++] = (char*)s; + } else { + in_schema->illegal_children_attr[n_attr++] = (char*)(s + 1); + } + } + in_schema->illegal_children[n_children] = NULL; + in_schema->illegal_children_attr[n_attr] = NULL; + + String key = iter.first(); + holder.push_back(key); + in_schema->ancestor_tag = (char*)key.data(); + context_schema[i] = make_fbml_context_schema((char*)key.data(), in_schema); + i++; + } + context_schema[i] = NULL; + + // do it + { + WriteLock lock(s_mutex); + fbml_expand_tag_list(tags, attrs, + flagged_tags_pointers, flagged_attrs_pointers, + context_schema); + } + + // cleanup + for (fbml_context_schema **p = context_schema; *p; ++p) { + free_fbml_context_schema(*p); + } +} + +Array f_fbml_parse_opaque_11(CStrRef unsanitized_fbml, bool body_only, + bool preserve_comment, + bool internal_mode /* = false */, + CVarRef css_sanitizer /* = null_variant */, + CVarRef js_sanitizer /* = null_variant */, + CVarRef attr_rewriter /* = null_variant */) { + callback_parameter css_param; + fbml_css_sanitizer css_sanitizer_data; + callback_parameter js_param; + fbml_js_sanitizer js_sanitizer_data; + callback_parameter attr_param; + fbml_attr_rewriter attr_rewriter_data; + fbml_node *tree; + char *error = NULL; + { + ReadLock lock(s_mutex); + fbml_parse((char*)unsanitized_fbml.data(), body_only, preserve_comment, + internal_mode, + get_css_sanitizer(css_sanitizer, &css_param, + &css_sanitizer_data), + get_js_sanitizer(js_sanitizer, &js_param, + &js_sanitizer_data), + get_attr_rewriter(attr_rewriter, &attr_param, + &attr_rewriter_data), + NULL, NULL, + &tree, &error); + } + + fbml_node *root_node = tree; + if (body_only && tree->children_count == 1) { + root_node = tree->children[0]; + } + + Array ret; + ret.set("root", Object(NEW(FBMLNode)(root_node, + Object(NEW(FBMLTree)(tree))))); + + if (error) { + if (*error) { + ret.set("error", String(error, AttachString)); + } else { + free(error); + } + } + return ret; +} + +Array f_fbml_sanitize_css_11(CStrRef unsanitized_css, bool decl_only, + int line_number, CArrRef css_sanitizer) { + struct callback_parameter param; + struct fbml_css_sanitizer sanitizer; + char *sanitized_css = NULL; + char *error = NULL; + { + ReadLock lock(s_mutex); + fbml_sanitize_css((char*)unsanitized_css.data(), decl_only, line_number, + get_css_sanitizer(css_sanitizer, ¶m, &sanitizer), + &sanitized_css, &error); + } + + Array ret; + if (sanitized_css) { + ret.set("sanitized", String(sanitized_css, AttachString)); + } + if (error) { + if (*error) { + ret.set("error", String(error, AttachString)); + } else { + free(error); + } + } + return ret; +} + +Array f_fbml_sanitize_js_11(CStrRef unsanitized_js, int line_number, + CArrRef js_sanitizer) { + struct callback_parameter param; + struct fbml_js_sanitizer sanitizer; + char *sanitized_js = NULL; + char *error = NULL; + { + ReadLock lock(s_mutex); + fbml_sanitize_js((char*)unsanitized_js.data(), unsanitized_js.size(), + 0, line_number, + get_js_sanitizer(js_sanitizer, ¶m, &sanitizer), + &sanitized_js, &error); + } + + Array ret; + if (sanitized_js) { + ret.set("sanitized", String(sanitized_js, AttachString)); + } + if (error) { + if (*error) { + ret.set("error", String(error, AttachString)); + } else { + free(error); + } + } + return ret; +} + +String f_fbml_get_tag_name_11(CObjRef node) { + return String(node.getTyped()->m_node->tag_name, CopyString); +} + +Array f_fbml_get_children_11(CObjRef node) { + FBMLNode *fnode = node.getTyped(); + fbml_node *p = fnode->m_node; + + Array ret; + for (int i = 0 ; i < p->children_count; i++) { + ret.append(Object(NEW(FBMLNode)(p->children[i], fnode->m_tree))); + } + return ret; +} + +int f_fbml_get_children_count_11(CObjRef node) { + return node.getTyped()->m_node->children_count; +} + +Array f_fbml_get_children_by_name_11(CObjRef node, CStrRef tag) { + unsigned short lookup = fbml_lookup_tag_by_name((char*)tag.data()); + FBMLNode *fnode = node.getTyped(); + fbml_node *p = fnode->m_node; + + Array ret; + for (int i = 0 ; i < p->children_count; i++) { + fbml_node *cur = p->children[i]; + if (cur->eHTMLTag == lookup) { + ret.append(Object(NEW(FBMLNode)(cur, fnode->m_tree))); + } + } + return ret; +} + +Array f_fbml_get_attributes_11(CObjRef node) { + FBMLNode *fnode = node.getTyped(); + fbml_node *p = fnode->m_node; + + Array ret; + for (int i = 0 ; i < p->attribute_count; i++) { + fbml_attribute *cur = p->attributes[i]; + ret.set(String(cur->name, CopyString), String(cur->value, CopyString)); + } + return ret; +} + +String f_fbml_get_attribute_11(CObjRef node, CStrRef name) { + FBMLNode *fnode = node.getTyped(); + char *result = fbml_node_get_attribute(fnode->m_node, (char*)name.data()); + if (result) { + return String(result, CopyString); + } + return String(); +} + +Variant f_fbml_attr_to_bool_11(CStrRef name) { + int result; + int state = fbml_node_attr_to_bool((char*)name.data(), &result); + if (state == 1) { + return (bool)result; + } + return null; +} + +String f_fbml_attr_to_color_11(CStrRef name) { + char *result; + int state = fbml_node_attr_to_color((char*)name.data(), &result); + if (state == 1) { + return String(result, AttachString); + } + return String(); +} + +String f_fbml_get_text_11(CObjRef node) { + FBMLNode *fnode = node.getTyped(); + fbml_node *p = fnode->m_node; + if (p->text) { + return String(p->text, CopyString); + } + return String(); +} + +void f_fbml_precache_11(CObjRef node, CVarRef data, CStrRef callback) { + FBMLNode *fnode = node.getTyped(); + + struct node_callback_parameter param; + param.tree = fnode->m_tree; + param.user_func_name = callback; + param.user_data = data; + param.fallback = ""; + + struct fbml_node_precacher node_pre; + node_pre.precache_node_data = ¶m; + node_pre.pfunc_precacher = callback_node_function; + + fbml_node_precache(fnode->m_node, &node_pre); +} + +Array f_fbml_batch_precache_11(CObjRef node) { + FBMLNode *fnode = node.getTyped(); + fbml_precache_bunch **node_bunch = fbml_node_batch_precache(fnode->m_node); + Array ret; + for (fbml_precache_bunch **iter = node_bunch; *iter; iter++) { + Array nodes; + for (fbml_node **node_iter = (*iter)->nodes; *node_iter; node_iter++) { + nodes.append(Object(NEW(FBMLNode)(*node_iter, fnode->m_tree))); + } + ret.set((*iter)->tag, nodes); + fbml_node_bunch_free(*iter); + } + free(node_bunch); + + return ret; +} + +String f_fbml_render_children_11(CObjRef node, CVarRef data, + CStrRef html_callback, CStrRef fb_callback, + int internal_mode /* = 0 */) { + FBMLNode *fnode = node.getTyped(); + + struct node_callback_parameter html; + html.tree = fnode->m_tree; + html.user_func_name = html_callback; + html.user_data = data; + html.fallback = ""; + + struct node_callback_parameter fb; + fb.tree = fnode->m_tree; + fb.user_func_name = fb_callback; + fb.user_data = data; + fb.fallback = ""; + + struct fbml_node_renderer node_rend; + node_rend.fb_node_data = &fb; + node_rend.html_node_data = &html; + node_rend.pfunc_renderer = callback_node_function; + node_rend.node = fnode->m_node; + + char *result = fbml_node_render_children(fnode->m_node, internal_mode, + &node_rend); + return String(result, AttachString); +} + +String f_fbml_flatten_11(CObjRef node) { + FBMLNode *fnode = node.getTyped(); + char *s = fbml_node_print(fnode->m_node); + return String(s, AttachString); +} + +/////////////////////////////////////////////////////////////////////////////// +// html profiler + +static string html_profile_read_file(const char *filename) { + Array params; + params.append(filename); + Variant ret = invoke("html_profile_read_file", params); + return ret.toString().data(); +} + +String f_html_profile(CStrRef html) { + ReadLock lock(s_mutex); + + ostringstream out; + int ret = html_profile(html.data(), out, html_profile_read_file); + if (ret == 0) { + return out.str(); + } + return ""; +} + +/////////////////////////////////////////////////////////////////////////////// + +String f_fbjsparse(CStrRef input) { + throw NotImplementedException(__func__); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_fbml.h b/src/cpp/ext/ext_fbml.h new file mode 100644 index 0000000000000..a2c96107a04a1 --- /dev/null +++ b/src/cpp/ext/ext_fbml.h @@ -0,0 +1,52 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_FBML_H__ +#define __EXT_FBML_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_fbml_tag_list_expanded_11(); +void f_fbml_complex_expand_tag_list_11(CArrRef new_tags, CArrRef new_attrs, CArrRef special_html, CArrRef precache, CArrRef style, CArrRef style_attrs, CArrRef script_attrs, CArrRef rewrite_attrs, CArrRef special_attrs, CArrRef schema); +Array f_fbml_parse_opaque_11(CStrRef unsanitized_fbml, bool body_only, bool preserve_comment, bool internal_mode = false, CVarRef css_sanitizer = null_variant, CVarRef js_sanitizer = null_variant, CVarRef attr_rewriter = null_variant); +Array f_fbml_sanitize_css_11(CStrRef unsanitized_css, bool decl_only, int line_number, CArrRef css_sanitizer); +Array f_fbml_sanitize_js_11(CStrRef unsanitized_js, int line_number, CArrRef js_sanitizer); +String f_fbml_get_tag_name_11(CObjRef node); +Array f_fbml_get_children_11(CObjRef node); +int f_fbml_get_children_count_11(CObjRef node); +Array f_fbml_get_children_by_name_11(CObjRef node, CStrRef tag); +Array f_fbml_get_attributes_11(CObjRef node); +String f_fbml_get_attribute_11(CObjRef node, CStrRef name); +Variant f_fbml_attr_to_bool_11(CStrRef name); +String f_fbml_attr_to_color_11(CStrRef name); +String f_fbml_get_text_11(CObjRef node); +void f_fbml_precache_11(CObjRef node, CVarRef data, CStrRef callback); +Array f_fbml_batch_precache_11(CObjRef node); +String f_fbml_render_children_11(CObjRef node, CVarRef data, CStrRef html_callback, CStrRef fb_callback, int internal_mode = 0); +String f_fbml_flatten_11(CObjRef node); +String f_html_profile(CStrRef html); +String f_fbjsparse(CStrRef input); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_FBML_H__ diff --git a/src/cpp/ext/ext_file.cpp b/src/cpp/ext/ext_file.cpp new file mode 100644 index 0000000000000..155872d828cfa --- /dev/null +++ b/src/cpp/ext/ext_file.cpp @@ -0,0 +1,1277 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define CHECK_SYSTEM(exp) \ + if ((exp) != 0) { \ + Logger::Verbose("%s/%d: %s", __FUNCTION__, __LINE__, \ + Util::safe_strerror(errno).c_str()); \ + return false; \ + } \ + +// libxml/xpathInternals.h defines CHECK_ERROR, +// we need to undef it first +#ifdef CHECK_ERROR +#undef CHECK_ERROR +#endif +#define CHECK_ERROR(ret) \ + check_error(__FUNCTION__, __LINE__, (ret)) + +#define PHP_FILE_USE_INCLUDE_PATH 1 +#define PHP_FILE_IGNORE_NEW_LINES 2 +#define PHP_FILE_SKIP_EMPTY_LINES 4 +#define PHP_FILE_APPEND 8 +#define PHP_FILE_NO_DEFAULT_CONTEXT 16 + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helpers + +static bool check_error(const char *function, int line, bool ret) { + if (!ret) { + Logger::Verbose("%s/%d: %s", function, line, + Util::safe_strerror(errno).c_str()); + } + return ret; +} + +static Array stat_impl(struct stat *stat_sb) { + Array ret; + + ret.append((int64)stat_sb->st_dev); + ret.append((int64)stat_sb->st_ino); + ret.append((int64)stat_sb->st_mode); + ret.append((int64)stat_sb->st_nlink); + ret.append((int64)stat_sb->st_uid); + ret.append((int64)stat_sb->st_gid); + ret.append((int64)stat_sb->st_rdev); + ret.append((int64)stat_sb->st_size); + ret.append((int64)stat_sb->st_atime); + ret.append((int64)stat_sb->st_mtime); + ret.append((int64)stat_sb->st_ctime); + ret.append((int64)stat_sb->st_blksize); + ret.append((int64)stat_sb->st_blocks); + + ret.set("dev", (int64)stat_sb->st_dev); + ret.set("ino", (int64)stat_sb->st_ino); + ret.set("mode", (int64)stat_sb->st_mode); + ret.set("nlink", (int64)stat_sb->st_nlink); + ret.set("uid", (int64)stat_sb->st_uid); + ret.set("gid", (int64)stat_sb->st_gid); + ret.set("rdev", (int64)stat_sb->st_rdev); + ret.set("size", (int64)stat_sb->st_size); + ret.set("atime", (int64)stat_sb->st_atime); + ret.set("mtime", (int64)stat_sb->st_mtime); + ret.set("ctime", (int64)stat_sb->st_ctime); + ret.set("blksize", (int64)stat_sb->st_blksize); + ret.set("blocks", (int64)stat_sb->st_blocks); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_fopen(CStrRef filename, CStrRef mode, + bool use_include_path /* = false */, + CObjRef context /* = null_object */) { + Array options; + if (!context.isNull()) { + StreamContext *streamContext = context.getTyped(); + options = streamContext->m_options; + } + return File::Open(filename, mode, options); +} + +Variant f_popen(CStrRef command, CStrRef mode) { + File *file = NEW(Pipe)(); + Object handle(file); + bool ret = CHECK_ERROR(file->open(File::TranslateCommand(command), mode)); + if (!ret) { + return false; + } + return handle; +} + +bool f_fclose(CObjRef handle) { + SmartObject f = handle.getTyped(true, true); + if (f.get() == NULL) { + Logger::Warning("Not a valid stream resource"); + return false; + } + return CHECK_ERROR(f->close()); +} + +int f_pclose(CObjRef handle) { + return CHECK_ERROR(handle.getTyped()->close()); +} + +Variant f_fseek(CObjRef handle, int64 offset, int64 whence /* = SEEK_SET */) { + return CHECK_ERROR(handle.getTyped()->seek(offset, whence)) ? 0 : -1; +} + +bool f_rewind(CObjRef handle) { + return CHECK_ERROR(handle.getTyped()->rewind()); +} + +Variant f_ftell(CObjRef handle) { + int64 ret = handle.getTyped()->tell(); + if (!CHECK_ERROR(ret != -1)) { + return false; + } + return ret; +} + +bool f_feof(CObjRef handle) { + return handle.getTyped()->eof(); +} + +Variant f_fstat(CObjRef handle) { + PlainFile *file = handle.getTyped(); + struct stat sb; + CHECK_SYSTEM(fstat(file->fd(), &sb)); + return stat_impl(&sb); +} + +Variant f_fread(CObjRef handle, int64 length) { + return handle.getTyped()->read(length); +} + +Variant f_fgetc(CObjRef handle) { + int result = handle.getTyped()->getc(); + if (result == EOF) { + return false; + } + return String::FromChar(result); +} + +String f_fgets(CObjRef handle, int64 length /* = 1024 */) { + if (length < 0) { + throw InvalidArgumentException("length", "(negative)"); + } + SmartObject f = handle.getTyped(true, true); + if (f.get() == NULL) { + Logger::Warning("Not a valid stream resource"); + return ""; + } + return f->readLine(length); +} + +String f_fgetss(CObjRef handle, int64 length /* = 0 */, + CStrRef allowable_tags /* = null_string */) { + String ret = f_fgets(handle, length); + if (!ret.empty()) { + return StringUtil::StripHTMLTags(ret, allowable_tags); + } + return ret; +} + +Variant f_fscanf(int _argc, CObjRef handle, CStrRef format, CArrRef _argv /* = null_array */) { + File *file = handle.getTyped(); + StringBuffer str; + str.read(file); + return f_sscanf(_argc, str.detach(), format, _argv); +} + +Variant f_fpassthru(CObjRef handle) { + return handle.getTyped()->print(); +} + +int64 f_fwrite(CObjRef handle, CStrRef data, int64 length /* = 0 */) { + int64 ret = handle.getTyped()->write(data, length); + if (ret < 0) ret = 0; + return ret; +} + +int64 f_fputs(CObjRef handle, CStrRef data, int64 length /* = 0 */) { + int64 ret = handle.getTyped()->write(data, length); + if (ret < 0) ret = 0; + return ret; +} + +Variant f_fprintf(int _argc, CObjRef handle, CStrRef format, CArrRef _argv /* = null_array */) { + return handle.getTyped()->printf(format, _argv); +} + +Variant f_vfprintf(CObjRef handle, CStrRef format, CArrRef args) { + return handle.getTyped()->printf(format, args); +} + +bool f_fflush(CObjRef handle) { + return CHECK_ERROR(handle.getTyped()->flush()); +} + +bool f_ftruncate(CObjRef handle, int64 size) { + return CHECK_ERROR(handle.getTyped()->truncate(size)); +} + +bool f_flock(CObjRef handle, int operation, Variant wouldblock /* = null */) { + bool block = false; + bool ret = handle.getTyped()->lock(operation, block); + wouldblock = block; + return ret; +} + +Variant f_fputcsv(CObjRef handle, CArrRef fields, CStrRef delimiter /* = "," */, + CStrRef enclosure /* = "\"" */) { + if (delimiter.size() != 1) { + throw InvalidArgumentException("delimiter", delimiter.data()); + } + if (enclosure.size() != 1) { + throw InvalidArgumentException("enclosure", enclosure.data()); + } + return handle.getTyped()->writeCSV(fields, delimiter.charAt(0), + enclosure.charAt(0)); +} + +Variant f_fgetcsv(CObjRef handle, int64 length /* = 0 */, + CStrRef delimiter /* = "," */, + CStrRef enclosure /* = "\"" */) { + if (delimiter.size() != 1) { + throw InvalidArgumentException("delimiter", delimiter.data()); + } + if (enclosure.size() != 1) { + throw InvalidArgumentException("enclosure", enclosure.data()); + } + Array ret = handle.getTyped()->readCSV(length, delimiter.charAt(0), + enclosure.charAt(0)); + if (!ret.isNull()) { + return ret; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_file_get_contents(CStrRef filename, + bool use_include_path /* = false */, + CObjRef context /* = null_object */, + int64 offset /* = 0 */, + int64 maxlen /* = 0 */) { + Variant stream = f_fopen(filename, "rb"); + if (same(stream, false)) return false; + return f_stream_get_contents(stream, maxlen, offset); +} + +Variant f_file_put_contents(CStrRef filename, CVarRef data, + int flags /* = 0 */, + CObjRef context /* = null_object */) { + FILE *f = fopen(File::TranslatePath(filename).data(), + (flags & PHP_FILE_APPEND) ? "ab" : "wb"); + Object closer(NEW(PlainFile)(f)); + if (!f) { + Logger::Verbose("%s/%d: %s", __FUNCTION__, __LINE__, + Util::safe_strerror(errno).c_str()); + return false; + } + + if ((flags & LOCK_EX) && flock(fileno(f), LOCK_EX)) { + return false; + } + + int numbytes = 0; + switch (data.getType()) { + case KindOfObject: + { + File *fsrc = data.toObject().getTyped(); + while (true) { + char buffer[1024]; + int len = fsrc->readImpl(buffer, sizeof(buffer)); + if (len == 0) break; + numbytes += len; + int written = fwrite(buffer, 1, len, f); + if (written != len) { + numbytes = -1; + break; + } + } + } + break; + case KindOfArray: + { + Array arr = data.toArray(); + for (ArrayIter iter(arr); iter; ++iter) { + String value = iter.second(); + if (!value.empty()) { + numbytes += value.size(); + int written = fwrite(value.data(), 1, value.size(), f); + if (written != value.size()) { + numbytes = -1; + break; + } + } + } + } + break; + default: + { + String value = data.toString(); + numbytes += value.size(); + int written = fwrite(value.data(), 1, value.size(), f); + if (written != value.size()) { + numbytes = -1; + } + } + break; + } + + if (numbytes < 0) { + return false; + } + return numbytes; +} + +Variant f_file(CStrRef filename, int flags /* = 0 */, + CObjRef context /* = null_object */) { + Variant contents = f_file_get_contents(filename, + flags & PHP_FILE_USE_INCLUDE_PATH); + if (same(contents, false)) { + return false; + } + String content = contents.toString(); + Array ret; + if (content.empty()) { + return ret; + } + + char eol_marker = '\n'; + bool include_new_line = !(flags & PHP_FILE_IGNORE_NEW_LINES); + bool skip_blank_lines = flags & PHP_FILE_SKIP_EMPTY_LINES; + const char *s = content.data(); + const char *e = s + content.size(); + + int i = 0; + const char *p = (const char *)memchr(s, '\n', content.size()); + if (!p) { + p = e; + goto parse_eol; + } + + if (include_new_line) { + do { + p++; + parse_eol: + ret.set(i++, String(s, p-s, CopyString)); + s = p; + } while ((p = (const char *)memchr(p, eol_marker, (e-p)))); + } else { + do { + if (skip_blank_lines && !(p-s)) { + s = ++p; + continue; + } + ret.set(i++, String(s, p-s, CopyString)); + s = ++p; + } while ((p = (const char *)memchr(p, eol_marker, (e-p)))); + } + + /* handle any left overs of files without new lines */ + if (s != e) { + p = e; + goto parse_eol; + } + return ret; +} + +Variant f_readfile(CStrRef filename, bool use_include_path /* = false */, + CObjRef context /* = null_object */) { + Variant f = f_fopen(filename, "rb"); + if (same(f, false)) { + Logger::Verbose("%s/%d: %s", __FUNCTION__, __LINE__, + Util::safe_strerror(errno).c_str()); + return false; + } + Variant ret = f_fpassthru(f.toObject()); + return ret; +} + +bool f_move_uploaded_file(CStrRef filename, CStrRef destination) { + Transport *transport = g_context->getTransport(); + if (transport) { + return transport->moveUploadedFile(filename, destination); + } + return false; +} + +Variant f_parse_ini_file(CStrRef filename, + bool process_sections /* = false */) { + throw NotSupportedException(__func__, "ini file is not supported"); +} + +Variant f_md5_file(CStrRef filename, bool raw_output /* = false */) { + String str = f_file_get_contents(filename); + return StringUtil::MD5(str, raw_output); +} + +Variant f_sha1_file(CStrRef filename, bool raw_output /* = false */) { + String str = f_file_get_contents(filename); + return StringUtil::SHA1(str, raw_output); +} + +/////////////////////////////////////////////////////////////////////////////// +// stats functions + +Variant f_fileperms(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename, true).data(), &sb)); + return (int64)sb.st_mode; +} + +Variant f_fileinode(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename).data(), &sb)); + return (int64)sb.st_ino; +} + +Variant f_filesize(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename, true).data(), &sb)); + return (int64)sb.st_size; +} + +Variant f_fileowner(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename, true).data(), &sb)); + return (int64)sb.st_uid; +} + +Variant f_filegroup(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename, true).data(), &sb)); + return (int64)sb.st_gid; +} + +Variant f_fileatime(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename, true).data(), &sb)); + return (int64)sb.st_atime; +} + +Variant f_filemtime(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename, true).data(), &sb)); + return (int64)sb.st_mtime; +} + +Variant f_filectime(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename, true).data(), &sb)); + return (int64)sb.st_ctime; +} + +Variant f_filetype(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename).data(), &sb)); + + switch (sb.st_mode & S_IFMT) { + case S_IFLNK: return "link"; + case S_IFIFO: return "fifo"; + case S_IFCHR: return "char"; + case S_IFDIR: return "dir"; + case S_IFBLK: return "block"; + case S_IFREG: return "file"; + case S_IFSOCK: return "socket"; + } + return "unknown"; +} + +Variant f_linkinfo(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename).data(), &sb)); + return (int64)sb.st_dev; +} + +bool f_is_writable(CStrRef filename) { + struct stat sb; + if (stat(File::TranslatePath(filename).data(), &sb)) { + return false; + } + CHECK_SYSTEM(access(File::TranslatePath(filename).data(), W_OK)); + return true; + /* + int mask = S_IWOTH; + if (sb.st_uid == getuid()) { + mask = S_IWUSR; + } else if (sb.st_gid == getgid()) { + mask = S_IWGRP; + } else { + int groups = getgroups(0, NULL); + if (groups > 0) { + gid_t *gids = (gid_t *)malloc(groups * sizeof(gid_t)); + int n = getgroups(groups, gids); + for (int i = 0; i < n; i++) { + if (sb.st_gid == gids[i]) { + mask = S_IWGRP; + break; + } + } + free(gids); + } + } + return sb.st_mode & mask; + */ +} + +bool f_is_writeable(CStrRef filename) { + return f_is_writable(filename); +} + +bool f_is_readable(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename, true).data(), &sb)); + CHECK_SYSTEM(access(File::TranslatePath(filename, true).data(), R_OK)); + return true; + /* + int mask = S_IROTH; + if (sb.st_uid == getuid()) { + mask = S_IRUSR; + } else if (sb.st_gid == getgid()) { + mask = S_IRGRP; + } else { + int groups = getgroups(0, NULL); + if (groups > 0) { + gid_t *gids = (gid_t *)malloc(groups * sizeof(gid_t)); + int n = getgroups(groups, gids); + for (int i = 0; i < n; i++) { + if (sb.st_gid == gids[i]) { + mask = S_IRGRP; + break; + } + } + free(gids); + } + } + return sb.st_mode & mask; + */ +} + +bool f_is_executable(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename).data(), &sb)); + CHECK_SYSTEM(access(File::TranslatePath(filename).data(), X_OK)); + return true; + /* + int mask = S_IXOTH; + if (sb.st_uid == getuid()) { + mask = S_IXUSR; + } else if (sb.st_gid == getgid()) { + mask = S_IXGRP; + } else { + int groups = getgroups(0, NULL); + if (groups > 0) { + gid_t *gids = (gid_t *)malloc(groups * sizeof(gid_t)); + int n = getgroups(groups, gids); + for (int i = 0; i < n; i++) { + if (sb.st_gid == gids[i]) { + mask = S_IXGRP; + break; + } + } + free(gids); + } + } + return (sb.st_mode & mask) && (sb.st_mode & S_IFMT) != S_IFDIR; + */ +} + +bool f_is_file(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename, true).data(), &sb)); + return (sb.st_mode & S_IFMT) == S_IFREG; +} + +bool f_is_dir(CStrRef filename) { + String cwd; + bool isRelative = (filename.charAt(0) != '/'); + if (isRelative) cwd = g_context->getCwd(); + if (!isRelative || cwd == RuntimeOption::SourceRoot.c_str()) { + if (File::IsVirtualDirectory(filename)) { + return true; + } + } + + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename).data(), &sb)); + return (sb.st_mode & S_IFMT) == S_IFDIR; +} + +bool f_is_link(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename).data(), &sb)); + return (sb.st_mode & S_IFMT) == S_IFLNK; +} + +bool f_is_uploaded_file(CStrRef filename) { + Transport *transport = g_context->getTransport(); + if (transport) { + return transport->isUploadedFile(filename); + } + return false; +} + +bool f_file_exists(CStrRef filename) { + if ((access(File::TranslatePath(filename, true).data(), F_OK)) < 0) { + return false; + } + return true; +} + +Variant f_stat(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(stat(File::TranslatePath(filename, true).data(), &sb)); + return stat_impl(&sb); +} + +Variant f_lstat(CStrRef filename) { + struct stat sb; + CHECK_SYSTEM(lstat(File::TranslatePath(filename, true).data(), &sb)); + return stat_impl(&sb); +} + +void f_clearstatcache() { + // we are not having a cache for file stats, so do nothing here +} + +Variant f_readlink(CStrRef path) { + char buff[PATH_MAX]; + int ret = readlink(File::TranslatePath(path).data(), buff, PATH_MAX-1); + if (ret < 0) { + Logger::Verbose("%s/%d: %s", __FUNCTION__, __LINE__, + Util::safe_strerror(errno).c_str()); + return false; + } + buff[ret] = '\0'; + return String(buff, ret, CopyString); +} + +Variant f_realpath(CStrRef path) { + String translated = File::TranslatePath(path); + if (translated.empty()) { + return false; + } + if (StaticContentCache::TheFileCache && + StaticContentCache::TheFileCache->exists(translated.data(), false)) { + return translated; + } + if (access(translated.data(), F_OK) == 0) { + char resolved_path[PATH_MAX]; + if (!realpath(translated, resolved_path)) { + return false; + } + return String(resolved_path, CopyString); + } + return false; +} + +#define PHP_PATHINFO_DIRNAME 1 +#define PHP_PATHINFO_BASENAME 2 +#define PHP_PATHINFO_EXTENSION 4 +#define PHP_PATHINFO_FILENAME 8 + +Variant f_pathinfo(CStrRef path, int opt /* = 15 */) { + Array ret; + + if ((opt & PHP_PATHINFO_DIRNAME) == PHP_PATHINFO_DIRNAME) { + String dirname = f_dirname(path); + if (opt == PHP_PATHINFO_DIRNAME) { + return dirname; + } + ret.set("dirname", dirname); + } + + String basename = f_basename(path); + if ((opt & PHP_PATHINFO_BASENAME) == PHP_PATHINFO_BASENAME) { + if (opt == PHP_PATHINFO_BASENAME) { + return basename; + } + ret.set("basename", basename); + } + + if ((opt & PHP_PATHINFO_EXTENSION) == PHP_PATHINFO_EXTENSION) { + int pos = basename.rfind('.'); + String extension; + if (pos >= 0) { + extension = basename.substr(pos + 1); + } + if (opt == PHP_PATHINFO_EXTENSION) { + return extension; + } + ret.set("extension", extension); + } + + if ((opt & PHP_PATHINFO_FILENAME) == PHP_PATHINFO_FILENAME) { + int pos = basename.rfind('.'); + String filename; + if (pos >= 0) { + filename = basename.substr(0, pos); + } else { + filename = basename; + } + if (opt == PHP_PATHINFO_FILENAME) { + return filename; + } + ret.set("filename", filename); + } + + return ret; +} + +Variant f_disk_free_space(CStrRef directory) { + struct statfs buf; + CHECK_SYSTEM(statfs(File::TranslatePath(directory), &buf)); + return (double)buf.f_bsize * (double)buf.f_bavail; +} + +Variant f_diskfreespace(CStrRef directory) { + return f_disk_free_space(directory); +} + +Variant f_disk_total_space(CStrRef directory) { + struct statfs buf; + CHECK_SYSTEM(statfs(File::TranslatePath(directory), &buf)); + return (double)buf.f_bsize * (double)buf.f_blocks; +} + +/////////////////////////////////////////////////////////////////////////////// +// system wrappers + +bool f_chmod(CStrRef filename, int64 mode) { + CHECK_SYSTEM(chmod(File::TranslatePath(filename).data(), mode)); + return true; +} + +static int get_uid(CVarRef user) { + int uid; + if (user.isString()) { + String suser = user.toString(); + struct passwd *pw = getpwnam(suser.data()); + if (!pw) { + Logger::Verbose("%s/%d: Unable to find uid for %s", + __FUNCTION__, __LINE__, suser.data()); + return 0; + } + uid = pw->pw_uid; + } else { + uid = user.toInt32(); + } + return uid; +} + +bool f_chown(CStrRef filename, CVarRef user) { + int uid = get_uid(user); + if (uid == 0) return false; + CHECK_SYSTEM(chown(File::TranslatePath(filename).data(), uid, (gid_t)-1)); + return true; +} + +bool f_lchown(CStrRef filename, CVarRef user) { + int uid = get_uid(user); + if (uid == 0) return false; + CHECK_SYSTEM(lchown(File::TranslatePath(filename).data(), uid, (gid_t)-1)); + return true; +} + +static int get_gid(CVarRef group) { + int gid; + if (group.isString()) { + String sgroup = group.toString(); + struct group *gr = getgrnam(sgroup.data()); + if (!gr) { + Logger::Verbose("%s/%d: Unable to find gid for %s", + __FUNCTION__, __LINE__, sgroup.data()); + return 0; + } + gid = gr->gr_gid; + } else { + gid = group.toInt32(); + } + return gid; +} + +bool f_chgrp(CStrRef filename, CVarRef group) { + int gid = get_gid(group); + if (gid == 0) return false; + CHECK_SYSTEM(chown(File::TranslatePath(filename).data(), (uid_t)-1, gid)); + return true; +} + +bool f_lchgrp(CStrRef filename, CVarRef group) { + int gid = get_gid(group); + if (gid == 0) return false; + CHECK_SYSTEM(lchown(File::TranslatePath(filename).data(), (uid_t)-1, gid)); + return true; +} + +bool f_touch(CStrRef filename, int64 mtime /* = 0 */, int64 atime /* = 0 */) { + String translated = File::TranslatePath(filename); + + /* create the file if it doesn't exist already */ + if (access(translated.data(), F_OK)) { + FILE *f = fopen(translated.data(), "w"); + if (f == NULL) { + Logger::Verbose("%s/%d: Unable to create file %s because %s", + __FUNCTION__, __LINE__, translated.data(), + Util::safe_strerror(errno).c_str()); + return false; + } + fclose(f); + } + + if (mtime == 0 || atime == 0) { + int now = time(0); + if (mtime == 0) mtime = now; + if (atime == 0) atime = now; + } + struct utimbuf newtime; + newtime.actime = atime; + newtime.modtime = mtime; + CHECK_SYSTEM(utime(translated.data(), &newtime)); + return true; +} + +bool f_copy(CStrRef source, CStrRef dest, CObjRef context /* = null_object */) { + String content = f_file_get_contents(File::TranslatePath(source)); + if (content.isNull()) { + return false; + } + Variant ret = f_file_put_contents(File::TranslatePath(dest), content); + if (same(ret, false)) { + return false; + } + return true; +} + +bool f_rename(CStrRef oldname, CStrRef newname, + CObjRef context /* = null_object */) { + int ret = Util::rename(File::TranslatePath(oldname).data(), + File::TranslatePath(newname).data()); + return (ret == 0); +} + +int f_umask(CVarRef mask /* = null_variant */) { + int oldumask = umask(077); + if (mask.isNull()) { + umask(oldumask); + } else { + umask(mask.toInt32()); + } + return oldumask; +} + +bool f_unlink(CStrRef filename, CObjRef context /* = null_object */) { + CHECK_SYSTEM(unlink(File::TranslatePath(filename).data())); + return true; +} + +bool f_link(CStrRef target, CStrRef link) { + CHECK_SYSTEM(::link(File::TranslatePath(target).data(), + File::TranslatePath(link).data())); + return true; +} + +bool f_symlink(CStrRef target, CStrRef link) { + CHECK_SYSTEM(symlink(File::TranslatePath(target).data(), + File::TranslatePath(link).data())); + return true; +} + +String f_basename(CStrRef path, CStrRef suffix /* = null_string */) { + int state = 0; + const char *c = path.data(); + const char *comp, *cend; + comp = cend = c; + for (int cnt = path.size(); cnt > 0; --cnt, ++c) { + if (*c == '/') { + if (state == 1) { + state = 0; + cend = c; + } + } else if (state == 0) { + comp = c; + state = 1; + } + } + + if (state == 1) { + cend = c; + } + int sufflen = suffix.size(); + if (!suffix.empty() && sufflen < (int)(cend - comp) && + memcmp(cend - sufflen, suffix.data(), sufflen) == 0) { + cend -= sufflen; + } + int len = cend - comp; + char *ret = (char *)malloc(len + 1); + memcpy(ret, comp, len); + ret[len] = '\0'; + return String(ret, len, AttachString); +} + +bool f_fnmatch(CStrRef pattern, CStrRef filename, int flags /* = 0 */) { + return fnmatch(pattern.data(), filename.data(), flags) == 0; +} + +Variant f_glob(CStrRef pattern, int flags /* = 0 */) { + glob_t globbuf; + int cwd_skip = 0; + memset(&globbuf, 0, sizeof(glob_t)); + globbuf.gl_offs = 0; + String work_pattern; + + if (pattern.charAt(0) == '/') { + work_pattern = pattern; + } else { + String cwd = g_context->getCwd(); + if (!cwd.empty() && cwd[cwd.length() - 1] == '/') { + work_pattern = cwd + pattern; + cwd_skip = cwd.length(); + } else { + work_pattern = cwd + "/" + pattern; + cwd_skip = cwd.length() + 1; + } + } + int nret = glob(work_pattern.data(), flags, NULL, &globbuf); + if (nret == GLOB_NOMATCH) { + if (!f_is_dir(work_pattern)) { + return false; + } + return Array::Create(); + } + if (nret) { + return false; + } + + Array ret; + bool basedir_limit = false; + for (int n = 0; n < (int)globbuf.gl_pathc; n++) { + String translated = File::TranslatePath(globbuf.gl_pathv[n]); + if (translated.empty()) { + basedir_limit = true; + continue; + } + /* we need to do this everytime since GLOB_ONLYDIR does not guarantee that + * all directories will be filtered. GNU libc documentation states the + * following: + * If the information about the type of the file is easily available + * non-directories will be rejected but no extra work will be done to + * determine the information for each file. I.e., the caller must still be + * able to filter directories out. + */ + if ((flags & GLOB_ONLYDIR) && !f_is_dir(globbuf.gl_pathv[n])) { + continue; + } + ret.append(String(globbuf.gl_pathv[n] + cwd_skip, CopyString)); + } + + globfree(&globbuf); + + if (basedir_limit && ret.empty()) { + return false; + } + return ret; +} + +Variant f_tempnam(CStrRef dir, CStrRef prefix) { + String rootDir = File::TranslatePath(dir); + String templ = rootDir + "/" + prefix + "XXXXXX"; + if (templ.size() > PATH_MAX) { + throw InvalidArgumentException("prefix", "(too long)"); + } + + char buf[PATH_MAX + 1]; + strcpy(buf, templ.data()); + int fd = mkstemp(buf); + if (fd < 0) { + Logger::Verbose("%s/%d: %s", __FUNCTION__, __LINE__, + Util::safe_strerror(errno).c_str()); + return false; + } + + close(fd); + return String(buf, CopyString); +} + +Variant f_tmpfile() { + FILE *f = tmpfile(); + if (f) { + return Object(NEW(PlainFile)(f)); + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// directory functions + +bool f_mkdir(CStrRef pathname, int64 mode /* = 0 */, + bool recursive /* = false */, CObjRef context /* = null_object */) { + if (recursive) { + String path = File::TranslatePath(pathname); + if (path.empty()) return false; + if (path.charAt(path.size() - 1) != '/') { + path += "/"; + } + return Util::mkdir(path.data(), mode); + } + CHECK_SYSTEM(mkdir(File::TranslatePath(pathname).data(), mode)); + return true; +} + +bool f_rmdir(CStrRef dirname, CObjRef context /* = null_object */) { + CHECK_SYSTEM(rmdir(File::TranslatePath(dirname).data())); + return true; +} + +static size_t php_dirname(char *path, int len) { + if (len == 0) { + /* Illegal use of this function */ + return 0; + } + + /* Strip trailing slashes */ + register char *end = path + len - 1; + while (end >= path && *end == '/') { + end--; + } + if (end < path) { + /* The path only contained slashes */ + path[0] = '/'; + path[1] = '\0'; + return 1; + } + + /* Strip filename */ + while (end >= path && *end != '/') { + end--; + } + if (end < path) { + /* No slash found, therefore return '.' */ + path[0] = '.'; + path[1] = '\0'; + return 1; + } + + /* Strip slashes which came before the file name */ + while (end >= path && *end == '/') { + end--; + } + if (end < path) { + path[0] = '/'; + path[1] = '\0'; + return 1; + } + *(end+1) = '\0'; + + return end + 1 - path; +} + +String f_dirname(CStrRef path) { + char *buf = strndup(path.data(), path.size()); + int len = php_dirname(buf, path.size()); + return String(buf, len, AttachString); +} + +Variant f_getcwd() { + return g_context->getCwd(); +} + +bool f_chdir(CStrRef directory) { + if (f_is_dir(directory)) { + g_context->setCwd(File::TranslatePath(directory)); + return true; + } + return false; +} + +bool f_chroot(CStrRef directory) { + CHECK_SYSTEM(chroot(File::TranslatePath(directory).data())); + CHECK_SYSTEM(chdir("/")); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +class Directory : public SweepableResourceData { +public: + Directory(DIR *handle) : dir(handle) { + ASSERT(handle); + } + + ~Directory() { + close(); + } + + // overriding ResourceData + const char *o_getClassName() const { return "Directory";} + + void close() { + if (dir) { + closedir(dir); + dir = NULL; + } + } + + DIR *dir; +}; + +class DirectoryRequestData : public RequestEventHandler { +public: + virtual void requestInit() { + defaultDirectory.reset(); + } + + virtual void requestShutdown() { + defaultDirectory.reset(); + } + + Object defaultDirectory; +}; +static RequestLocal s_directory_data; + +static DIR *get_dir(CObjRef dir_handle) { + Object obj; + if (dir_handle.isNull()) { + obj = s_directory_data->defaultDirectory; + } else { + Array arr = dir_handle.toArray(); + if (arr.exists("handle")) { + obj = arr["handle"].toObject(); + } else { + obj = dir_handle; + } + } + if (obj.get()) { + return obj.getTyped()->dir; + } + return NULL; +} + +Variant f_dir(CStrRef directory) { + Variant dir = f_opendir(directory); + if (same(dir, false)) { + return false; + } + + Array ret; + ret.set("path", directory); + ret.set("handle", dir); + return ret; +} + +Variant f_opendir(CStrRef path, CObjRef context /* = null */) { + DIR *dir = opendir(File::TranslatePath(path).data()); + if (dir == NULL) { + return false; + } + + Directory *p = new Directory(dir); + s_directory_data->defaultDirectory = p; + return Object(p); +} + +Variant f_readdir(CObjRef dir_handle) { + DIR *dir = get_dir(dir_handle); + if (dir) { + struct dirent entry; + struct dirent *result; + CHECK_SYSTEM(readdir_r(dir, &entry, &result)); + if (result) { + return String(entry.d_name, CopyString); + } + } + return false; +} + +void f_rewinddir(CObjRef dir_handle) { + DIR *dir = get_dir(dir_handle); + if (dir) { + rewinddir(dir); + } +} + +static bool StringDescending(CStrRef s1, CStrRef s2) { + return s1.more(s2); +} + +Variant f_scandir(CStrRef directory, bool descending /* = false */, + CObjRef context /* = null */) { + DIR *dir = opendir(File::TranslatePath(directory).data()); + if (dir == NULL) { + return false; + } + Object deleter(new Directory(dir)); + + std::vector names; + while (true) { + struct dirent entry; + struct dirent *result; + CHECK_SYSTEM(readdir_r(dir, &entry, &result)); + if (result == NULL) { + break; + } + names.push_back(String(entry.d_name, CopyString)); + } + + if (descending) { + sort(names.begin(), names.end(), StringDescending); + } + + Array ret; + for (unsigned int i = 0; i < names.size(); i++) { + ret.append(names[i]); + } + return ret; +} + +void f_closedir(CObjRef dir_handle) { + if (!dir_handle.isNull()) { + Object obj; + Array arr = dir_handle.toArray(); + if (arr.exists("handle")) { + obj = arr["handle"].toObject(); + } else { + obj = dir_handle; + } + if (same(s_directory_data->defaultDirectory, obj)) { + s_directory_data->defaultDirectory = NULL; + } + obj.getTyped()->close(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_file.h b/src/cpp/ext/ext_file.h new file mode 100644 index 0000000000000..e66105960e015 --- /dev/null +++ b/src/cpp/ext/ext_file.h @@ -0,0 +1,161 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_FILE_H__ +#define __EXT_FILE_H__ + +#include + +/** + * Two departures from PHP: + * + * 1. Stream model: There are only 3 major types, local files/dirs, sockets and + * URL-based resources. Mixing them up doesn't always make sense. For + * example, many file system functions don't apply to URL at all, yet + * suffering extra layers of coding. We here break them up into separate + * classes and functions: local file functions are grouped under File + * class, URL handling is left to CURL extension functions, and socket + * functions are just plain socket functions. + * + * 2. Stream context/filter/protocol/bucket: not supported until we really + * find good use of it, then we may implement them in transport layers in + * a different way. + */ +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// file handle based file operations + +Variant f_fopen(CStrRef filename, CStrRef mode, bool use_include_path = false, + CObjRef context = null_object); +Variant f_popen(CStrRef command, CStrRef mode); +bool f_fclose(CObjRef handle); +int f_pclose(CObjRef handle); +Variant f_fseek(CObjRef handle, int64 offset, int64 whence = SEEK_SET); +bool f_rewind(CObjRef handle); +Variant f_ftell(CObjRef handle); +bool f_feof(CObjRef handle); +Variant f_fstat(CObjRef handle); +Variant f_fread(CObjRef handle, int64 length); +Variant f_fgetc(CObjRef handle); +String f_fgets(CObjRef handle, int64 length = 1024); +String f_fgetss(CObjRef handle, int64 length = 0, + CStrRef allowable_tags = null_string); +Variant f_fscanf(int _argc, CObjRef handle, CStrRef format, CArrRef _argv = null_array); +Variant f_fpassthru(CObjRef handle); +int64 f_fwrite(CObjRef handle, CStrRef data, int64 length = 0); +int64 f_fputs(CObjRef handle, CStrRef data, int64 length = 0); +Variant f_fprintf(int _argc, CObjRef handle, CStrRef format, CArrRef _argv = null_array); +Variant f_vfprintf(CObjRef handle, CStrRef format, CArrRef args); +bool f_fflush(CObjRef handle); +bool f_ftruncate(CObjRef handle, int64 size); +bool f_flock(CObjRef handle, int operation, Variant wouldblock = null); +Variant f_fputcsv(CObjRef handle, CArrRef fields, CStrRef delimiter = ",", + CStrRef enclosure = "\""); +Variant f_fgetcsv(CObjRef handle, int64 length = 0, CStrRef delimiter = ",", + CStrRef enclosure = "\""); + +/////////////////////////////////////////////////////////////////////////////// +// file name based file operations + +Variant f_file_get_contents(CStrRef filename, bool use_include_path = false, + CObjRef context = null_object, int64 offset = 0, + int64 maxlen = 0); +Variant f_file_put_contents(CStrRef filename, CVarRef data, int flags = 0, + CObjRef context = null_object); +Variant f_file(CStrRef filename, int flags = 0, CObjRef context = null_object); +Variant f_readfile(CStrRef filename, bool use_include_path = false, + CObjRef context = null_object); +bool f_move_uploaded_file(CStrRef filename, CStrRef destination); +Variant f_parse_ini_file(CStrRef filename, bool process_sections = false); +Variant f_md5_file(CStrRef filename, bool raw_output = false); +Variant f_sha1_file(CStrRef filename, bool raw_output = false); + +/////////////////////////////////////////////////////////////////////////////// +// shell commands + +bool f_chmod(CStrRef filename, int64 mode); +bool f_chown(CStrRef filename, CVarRef user); +bool f_lchown(CStrRef filename, CVarRef user); +bool f_chgrp(CStrRef filename, CVarRef group); +bool f_lchgrp(CStrRef filename, CVarRef group); +bool f_touch(CStrRef filename, int64 mtime = 0, int64 atime = 0); +bool f_copy(CStrRef source, CStrRef dest, CObjRef context = null_object); +bool f_rename(CStrRef oldname, CStrRef newname, CObjRef context = null_object); +int f_umask(CVarRef mask = null_variant); +bool f_unlink(CStrRef filename, CObjRef context = null_object); +bool f_link(CStrRef target, CStrRef link); +bool f_symlink(CStrRef target, CStrRef link); +String f_basename(CStrRef path, CStrRef suffix = null_string); +bool f_fnmatch(CStrRef pattern, CStrRef filename, int flags = 0); +Variant f_glob(CStrRef pattern, int flags = 0); +Variant f_tempnam(CStrRef dir, CStrRef prefix); +Variant f_tmpfile(); + +/////////////////////////////////////////////////////////////////////////////// +// stats functions + +Variant f_fileperms(CStrRef filename); +Variant f_fileinode(CStrRef filename); +Variant f_filesize(CStrRef filename); +Variant f_fileowner(CStrRef filename); +Variant f_filegroup(CStrRef filename); +Variant f_fileatime(CStrRef filename); +Variant f_filemtime(CStrRef filename); +Variant f_filectime(CStrRef filename); +Variant f_filetype(CStrRef filename); +Variant f_linkinfo(CStrRef filename); +bool f_is_writable(CStrRef filename); +bool f_is_writeable(CStrRef filename); +bool f_is_readable(CStrRef filename); +bool f_is_executable(CStrRef filename); +bool f_is_file(CStrRef filename); +bool f_is_dir(CStrRef filename); +bool f_is_link(CStrRef filename); +bool f_is_uploaded_file(CStrRef filename); +bool f_file_exists(CStrRef filename); +Variant f_stat(CStrRef filename); +Variant f_lstat(CStrRef filename); +void f_clearstatcache(); +Variant f_readlink(CStrRef path); +Variant f_realpath(CStrRef path); +Variant f_pathinfo(CStrRef path, int opt = 15); +Variant f_disk_free_space(CStrRef directory); +Variant f_diskfreespace(CStrRef directory); +Variant f_disk_total_space(CStrRef directory); + +/////////////////////////////////////////////////////////////////////////////// +// directory functions + +bool f_mkdir(CStrRef pathname, int64 mode = 0, bool recursive = false, + CObjRef context = null_object); +bool f_rmdir(CStrRef dirname, CObjRef context = null_object); +String f_dirname(CStrRef path); +Variant f_getcwd(); +bool f_chdir(CStrRef directory); +bool f_chroot(CStrRef directory); +Variant f_dir(CStrRef directory); +Variant f_opendir(CStrRef path, CObjRef context = null); +Variant f_readdir(CObjRef dir_handle); +void f_rewinddir(CObjRef dir_handle); +Variant f_scandir(CStrRef directory, bool descending = false, + CObjRef context = null); +void f_closedir(CObjRef dir_handle); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_FILE_H__ diff --git a/src/cpp/ext/ext_function.cpp b/src/cpp/ext/ext_function.cpp new file mode 100644 index 0000000000000..903b0c8f43ab4 --- /dev/null +++ b/src/cpp/ext/ext_function.cpp @@ -0,0 +1,192 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Array f_get_defined_functions() { + Array ret; + ret.set("internal", ClassInfo::GetSystemFunctions()); + ret.set("user", ClassInfo::GetUserFunctions()); + return ret; +} + +bool f_function_exists(CStrRef function_name) { + const ClassInfo::MethodInfo *info = + ClassInfo::FindFunction(function_name.data()); + if (info) { + if (info->attribute & ClassInfo::IsSystem) return true; + if (info->attribute & ClassInfo::IsVolatile) { + return ((Globals*)get_global_variables())-> + function_exists(function_name.data()); + } else { + return true; + } + } else { + return false; + } +} + +bool f_is_callable(CVarRef v, bool syntax /* = false */, + Variant name /* = null */) { + if (v.isString()) { + if (!name.isNull()) name = v; + if (syntax) return true; + + string lowered = Util::toLower((const char *)v.toString()); + size_t c = lowered.find("::"); + if (c != 0 && c != string::npos && c+2 < lowered.size()) { + string classname = lowered.substr(0, c); + string methodname = lowered.substr(c+2); + const ClassInfo *clsInfo = ClassInfo::FindClass(classname.c_str()); + if (clsInfo) { + return clsInfo->hasMethod(methodname.c_str()); + } + return false; + } + + return f_function_exists(v.toString()); + } + + if (v.is(KindOfArray)) { + Array arr = v.toArray(); + if (arr.size() == 2 && arr.exists(0LL) && arr.exists(1LL)) { + Variant v0 = arr.rvalAt(0LL); + Variant v1 = arr.rvalAt(1LL); + if (v0.is(KindOfObject)) { + v0 = v0.toObject()->o_getClassName(); + } + if (v0.isString() && v1.isString()) { + if (!name.isNull()) { + name = v0.toString() + "::" + v1.toString(); + } + if (same(v0, "self") || same(v0, "parent")) { + throw NotImplementedException("augmenting class scope info"); + } + const ClassInfo *clsInfo = ClassInfo::FindClass(v0.toString()); + if (clsInfo) { + return clsInfo->hasMethod(v1.toString()); + } + return false; + } + } + } + + if (!name.isNull()) { + name = v.toString(); + } + return false; +} + +Variant f_call_user_func(int _argc, CVarRef function, CArrRef _argv /* = null_array */) { + return f_call_user_func_array(function, _argv); +} + +String f_create_function(CStrRef args, CStrRef code) { + throw NotSupportedException(__func__, "dynamic coding"); +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_func_get_arg(int arg_num) { + throw FatalErrorException("bad HPHP code generation"); +} +Variant func_get_arg(int num_args, CArrRef params, CArrRef args, int pos) { + FUNCTION_INJECTION(func_get_arg); + if (num_args <= params.size()) { + if (pos >= 0 && pos < num_args) { + return params.rvalAt(pos); + } + } else { + if (pos >= 0) { + int index = pos - params.size(); + if (index < 0) { + return params.rvalAt(pos); + } + if (index < args.size()) { + return args.rvalAt(index); + } + } + } + return null; +} + +Array f_func_get_args() { + throw FatalErrorException("bad HPHP code generation"); +} +Array func_get_args(int num_args, CArrRef params, Array &args) { + FUNCTION_INJECTION(func_get_args); + if (params.empty() && args.empty()) return Array::Create(); + if (args.empty()) { + if (num_args < params.size()) { + return params.slice(0, num_args, false); + } + return params; + } + + Array derefArgs; + for (ArrayIter iter(args); iter; ++iter) { + derefArgs.append(iter.second()); + } + + if (params.empty()) return derefArgs; + ASSERT(num_args > params.size()); + Array ret = Array(params).merge(derefArgs); + return ret; +} + +int f_func_num_args() { + // we shouldn't be here, since HPHP code generation will inline this function + ASSERT(false); + return -1; +} + +/////////////////////////////////////////////////////////////////////////////// + +void f_register_postsend_function(int _argc, CVarRef function, CArrRef _argv /* = null_array */) { + g_context->registerShutdownFunction(function, _argv, + ExecutionContext::PostSend); +} + +void f_register_shutdown_function(int _argc, CVarRef function, CArrRef _argv /* = null_array */) { + g_context->registerShutdownFunction(function, _argv, + ExecutionContext::ShutDown); +} + +void f_register_cleanup_function(int _argc, CVarRef function, CArrRef _argv /* = null_array */) { + g_context->registerShutdownFunction(function, _argv, + ExecutionContext::CleanUp); +} + +bool f_register_tick_function(int _argc, CVarRef function, CArrRef _argv /* = null_array */) { + g_context->registerTickFunction(function, _argv); + return true; +} + +void f_unregister_tick_function(CVarRef function_name) { + g_context->unregisterTickFunction(function_name); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_function.h b/src/cpp/ext/ext_function.h new file mode 100644 index 0000000000000..118cb89db26ef --- /dev/null +++ b/src/cpp/ext/ext_function.h @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_FUNCTION_H__ +#define __EXT_FUNCTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Array f_get_defined_functions(); +bool f_function_exists(CStrRef function_name); +bool f_is_callable(CVarRef v, bool syntax = false, + Variant name = null); +Variant f_call_user_func(int _argc, CVarRef function, CArrRef _argv = null_array); +String f_create_function(CStrRef args, CStrRef code); + +/////////////////////////////////////////////////////////////////////////////// + +/** + * PHP's func_get_arg() is transformed to this function with some extra + * parameters to help the implementation. + */ +Variant f_func_get_arg(int arg_num); +Variant func_get_arg(int num_args, CArrRef params, CArrRef args, int pos); + +/** + * PHP's func_get_args() is transformed to this function with some extra + * parameters to help the implementation. + */ +Array f_func_get_args(); +Array func_get_args(int num_args, CArrRef params, Array &args); + +/** + * HPHP actually inlines this function, so this is degenerated. + */ +int f_func_num_args(); + +/////////////////////////////////////////////////////////////////////////////// + +void f_register_postsend_function(int _argc, CVarRef function, CArrRef _argv = null_array); +void f_register_shutdown_function(int _argc, CVarRef function, CArrRef _argv = null_array); +void f_register_cleanup_function(int _argc, CVarRef function, CArrRef _argv = null_array); +bool f_register_tick_function(int _argc, CVarRef function, CArrRef _argv = null_array); +void f_unregister_tick_function(CVarRef function_name); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_FUNCTION_H__ diff --git a/src/cpp/ext/ext_hash.cpp b/src/cpp/ext/ext_hash.cpp new file mode 100644 index 0000000000000..5019b38a1d4a7 --- /dev/null +++ b/src/cpp/ext/ext_hash.cpp @@ -0,0 +1,365 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// hash engines + +static HashEngineMap HashEngines; + +class HashEngineMapInitializer { +public: + HashEngineMapInitializer() { + HashEngines["md2"] = HashEnginePtr(new hash_md2()); + HashEngines["md4"] = HashEnginePtr(new hash_md4()); + HashEngines["md5"] = HashEnginePtr(new hash_md5()); + HashEngines["sha1"] = HashEnginePtr(new hash_sha1()); + HashEngines["sha256"] = HashEnginePtr(new hash_sha256()); + HashEngines["sha384"] = HashEnginePtr(new hash_sha384()); + HashEngines["sha512"] = HashEnginePtr(new hash_sha512()); + HashEngines["ripemd128"] = HashEnginePtr(new hash_ripemd128()); + HashEngines["ripemd160"] = HashEnginePtr(new hash_ripemd160()); + HashEngines["ripemd256"] = HashEnginePtr(new hash_ripemd256()); + HashEngines["ripemd320"] = HashEnginePtr(new hash_ripemd320()); + HashEngines["whirlpool"] = HashEnginePtr(new hash_whirlpool()); + HashEngines["tiger128,3"] = HashEnginePtr(new hash_tiger(true, 128)); + HashEngines["tiger160,3"] = HashEnginePtr(new hash_tiger(true, 160)); + HashEngines["tiger192,3"] = HashEnginePtr(new hash_tiger(true, 192)); + HashEngines["tiger128,4"] = HashEnginePtr(new hash_tiger(false, 128)); + HashEngines["tiger160,4"] = HashEnginePtr(new hash_tiger(false, 160)); + HashEngines["tiger192,4"] = HashEnginePtr(new hash_tiger(false, 192)); + HashEngines["snefru"] = HashEnginePtr(new hash_snefru()); + HashEngines["gost"] = HashEnginePtr(new hash_gost()); + HashEngines["adler32"] = HashEnginePtr(new hash_adler32()); + HashEngines["crc32"] = HashEnginePtr(new hash_crc32(false)); + HashEngines["crc32b"] = HashEnginePtr(new hash_crc32(true)); + HashEngines["haval128,3"] = HashEnginePtr(new hash_haval(3,128)); + HashEngines["haval160,3"] = HashEnginePtr(new hash_haval(3,160)); + HashEngines["haval192,3"] = HashEnginePtr(new hash_haval(3,192)); + HashEngines["haval224,3"] = HashEnginePtr(new hash_haval(3,224)); + HashEngines["haval256,3"] = HashEnginePtr(new hash_haval(3,256)); + HashEngines["haval128,4"] = HashEnginePtr(new hash_haval(4,128)); + HashEngines["haval160,4"] = HashEnginePtr(new hash_haval(4,160)); + HashEngines["haval192,4"] = HashEnginePtr(new hash_haval(4,192)); + HashEngines["haval224,4"] = HashEnginePtr(new hash_haval(4,224)); + HashEngines["haval256,4"] = HashEnginePtr(new hash_haval(4,256)); + HashEngines["haval128,5"] = HashEnginePtr(new hash_haval(5,128)); + HashEngines["haval160,5"] = HashEnginePtr(new hash_haval(5,160)); + HashEngines["haval192,5"] = HashEnginePtr(new hash_haval(5,192)); + HashEngines["haval224,5"] = HashEnginePtr(new hash_haval(5,224)); + HashEngines["haval256,5"] = HashEnginePtr(new hash_haval(5,256)); + } +}; + +static HashEngineMapInitializer s_engine_initializer; + +/////////////////////////////////////////////////////////////////////////////// +// hash context + +class HashContext : public SweepableResourceData { +public: + // overriding ResourceData + const char *o_getClassName() const { return "Hash Context";} + + HashContext(HashEnginePtr ops_, void *context_, int options_) + : ops(ops_), context(context_), options(options_), key(NULL) { + } + + ~HashContext() { + /* Just in case the algo has internally allocated resources */ + if (context) { + unsigned char *dummy = (unsigned char *)malloc(ops->digest_size); + ops->hash_final(dummy, context); + free(dummy); + free(context); + } + + if (key) { + memset(key, 0, ops->block_size); + free(key); + } + } + + HashEnginePtr ops; + void *context; + int options; + char *key; +}; + +/////////////////////////////////////////////////////////////////////////////// +// hash functions + +Array f_hash_algos() { + Array ret; + for (HashEngineMap::const_iterator iter = HashEngines.begin(); + iter != HashEngines.end(); ++iter) { + ret.append(String(iter->first)); + } + return ret; +} + +static HashEnginePtr php_hash_fetch_ops(CStrRef algo) { + HashEngineMap::const_iterator iter = + HashEngines.find(StringUtil::ToLower(algo).data()); + if (iter == HashEngines.end()) { + return HashEnginePtr(); + } + return iter->second; +} + +static Variant php_hash_do_hash(CStrRef algo, CStrRef data, bool isfilename, + bool raw_output) { + HashEnginePtr ops = php_hash_fetch_ops(algo); + if (!ops) { + Logger::Warning("Unknown hashing algorithm: %s", algo.data()); + return false; + } + Variant f; + if (isfilename) { + f = f_fopen(data, "rb"); + if (same(f, false)) { + return false; + } + } + + void *context = malloc(ops->context_size); + ops->hash_init(context); + + if (isfilename) { + for (Variant chunk = f_fread(f, 1024); !same(chunk, ""); + chunk = f_fread(f, 1024)) { + String schunk = chunk.toString(); + ops->hash_update(context, (unsigned char *)schunk.data(), schunk.size()); + } + } else { + ops->hash_update(context, (unsigned char *)data.data(), data.size()); + } + + char *digest = (char*)malloc(ops->digest_size + 1); + ops->hash_final((unsigned char *)digest, context); + free(context); + + digest[ops->digest_size] = '\0'; + String raw(digest, ops->digest_size, AttachString); + if (raw_output) { + return raw; + } + return StringUtil::HexEncode(raw); +} + +Variant f_hash(CStrRef algo, CStrRef data, bool raw_output /* = false */) { + return php_hash_do_hash(algo, data, false, raw_output); +} + +Variant f_hash_file(CStrRef algo, CStrRef filename, + bool raw_output /* = false */) { + return php_hash_do_hash(algo, filename, true, raw_output); +} + +static char *prepare_hmac_key(HashEnginePtr ops, void *context, CStrRef key) { + char *K = (char*)malloc(ops->block_size); + memset(K, 0, ops->block_size); + if (key.size() > ops->block_size) { + /* Reduce the key first */ + ops->hash_update(context, (unsigned char *)key.data(), key.size()); + ops->hash_final((unsigned char *)K, context); + /* Make the context ready to start over */ + ops->hash_init(context); + } else { + memcpy(K, key.data(), key.size()); + } + + /* XOR ipad */ + for (int i = 0; i < ops->block_size; i++) { + K[i] ^= 0x36; + } + ops->hash_update(context, (unsigned char *)K, ops->block_size); + return K; +} + +static void finalize_hmac_key(char *K, HashEnginePtr ops, void *context, + char *digest) { + /* Convert K to opad -- 0x6A = 0x36 ^ 0x5C */ + for (int i = 0; i < ops->block_size; i++) { + K[i] ^= 0x6A; + } + + /* Feed this result into the outter hash */ + ops->hash_init(context); + ops->hash_update(context, (unsigned char *)K, ops->block_size); + ops->hash_update(context, (unsigned char *)digest, ops->digest_size); + ops->hash_final((unsigned char *)digest, context); + + /* Zero the key */ + memset(K, 0, ops->block_size); + free(K); +} + +static Variant php_hash_do_hash_hmac(CStrRef algo, CStrRef data, + bool isfilename, CStrRef key, + bool raw_output /* = false */) { + HashEnginePtr ops = php_hash_fetch_ops(algo); + if (!ops) { + Logger::Warning("Unknown hashing algorithm: %s", algo.data()); + return false; + } + Variant f; + if (isfilename) { + f = f_fopen(data, "rb"); + if (same(f, false)) { + return false; + } + } + + void *context = malloc(ops->context_size); + ops->hash_init(context); + + char *K = prepare_hmac_key(ops, context, key); + + if (isfilename) { + for (Variant chunk = f_fread(f, 1024); !same(chunk, ""); + chunk = f_fread(f, 1024)) { + String schunk = chunk.toString(); + ops->hash_update(context, (unsigned char *)schunk.data(), schunk.size()); + } + } else { + ops->hash_update(context, (unsigned char *)data.data(), data.size()); + } + + char *digest = (char*)malloc(ops->digest_size + 1); + ops->hash_final((unsigned char *)digest, context); + finalize_hmac_key(K, ops, context, digest); + free(context); + + digest[ops->digest_size] = '\0'; + String raw(digest, ops->digest_size, AttachString); + if (raw_output) { + return raw; + } + return StringUtil::HexEncode(raw); +} + +Variant f_hash_hmac(CStrRef algo, CStrRef data, CStrRef key, + bool raw_output /* = false */) { + return php_hash_do_hash_hmac(algo, data, false, key, raw_output); +} + +Variant f_hash_hmac_file(CStrRef algo, CStrRef filename, CStrRef key, + bool raw_output /* = false */) { + return php_hash_do_hash_hmac(algo, filename, true, key, raw_output); +} + +Variant f_hash_init(CStrRef algo, int options /* = 0 */, + CStrRef key /* = null_string */) { + HashEnginePtr ops = php_hash_fetch_ops(algo); + if (!ops) { + Logger::Warning("Unknown hashing algorithm: %s", algo.data()); + return false; + } + + if ((options & k_HASH_HMAC) && key.empty()) { + Logger::Warning("HMAC requested without a key"); + return false; + } + + void *context = malloc(ops->context_size); + ops->hash_init(context); + + HashContext *hash = new HashContext(ops, context, options); + if (options & k_HASH_HMAC) { + hash->key = prepare_hmac_key(ops, context, key); + } + return Object(hash); +} + +bool f_hash_update(CObjRef context, CStrRef data) { + HashContext *hash = context.getTyped(); + hash->ops->hash_update(hash->context, (unsigned char *)data.data(), + data.size()); + return true; +} + +bool f_hash_update_file(CObjRef init_context, CStrRef filename, + CObjRef stream_context /* = null */) { + Variant f = f_fopen(filename, "rb"); + if (same(f, false)) { + return false; + } + + HashContext *hash = init_context.getTyped(); + for (Variant chunk = f_fread(f, 1024); !same(chunk, ""); + chunk = f_fread(f, 1024)) { + String schunk = chunk.toString(); + hash->ops->hash_update(hash->context, (unsigned char *)schunk.data(), + schunk.size()); + } + return true; +} + +int f_hash_update_stream(CObjRef context, CObjRef handle, + int length /* = -1 */) { + HashContext *hash = context.getTyped(); + int didread = 0; + while (length) { + Variant chunk = f_fread(handle, length > 0 ? length : 1024); + if (same(chunk, "")) { + return didread; + } + String schunk = chunk.toString(); + hash->ops->hash_update(hash->context, (unsigned char *)schunk.data(), + schunk.size()); + didread += schunk.size(); + length -= schunk.size(); + } + return didread; +} + +String f_hash_final(CObjRef context, bool raw_output /* = false */) { + HashContext *hash = context.getTyped(); + + char *digest = (char*)malloc(hash->ops->digest_size + 1); + hash->ops->hash_final((unsigned char *)digest, hash->context); + if (hash->options & k_HASH_HMAC) { + finalize_hmac_key(hash->key, hash->ops, hash->context, digest); + hash->key = NULL; + } + free(hash->context); + hash->context = NULL; + + digest[hash->ops->digest_size] = '\0'; + String raw(digest, hash->ops->digest_size, AttachString); + if (raw_output) { + return raw; + } + return StringUtil::HexEncode(raw); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_hash.h b/src/cpp/ext/ext_hash.h new file mode 100644 index 0000000000000..60070d718e5de --- /dev/null +++ b/src/cpp/ext/ext_hash.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_H__ +#define __EXT_HASH_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_hash(CStrRef algo, CStrRef data, bool raw_output = false); +Array f_hash_algos(); +Variant f_hash_init(CStrRef algo, int options = 0, CStrRef key = null_string); +Variant f_hash_file(CStrRef algo, CStrRef filename, bool raw_output = false); +String f_hash_final(CObjRef context, bool raw_output = false); +Variant f_hash_hmac_file(CStrRef algo, CStrRef filename, CStrRef key, bool raw_output = false); +Variant f_hash_hmac(CStrRef algo, CStrRef data, CStrRef key, bool raw_output = false); +bool f_hash_update_file(CObjRef init_context, CStrRef filename, CObjRef stream_context = null); +int f_hash_update_stream(CObjRef context, CObjRef handle, int length = -1); +bool f_hash_update(CObjRef context, CStrRef data); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_H__ diff --git a/src/cpp/ext/ext_hotprofiler.cpp b/src/cpp/ext/ext_hotprofiler.cpp new file mode 100644 index 0000000000000..9377a159c60c3 --- /dev/null +++ b/src/cpp/ext/ext_hotprofiler.cpp @@ -0,0 +1,849 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +#include + +// Append the delimiter +#define HP_STACK_DELIM "==>" +#define HP_STACK_DELIM_LEN (sizeof(HP_STACK_DELIM) - 1) + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helpers + +/* + * A hash function to calculate a 8-bit hash code for a function name. + * This is based on a small modification to 'zend_inline_hash_func' by summing + * up all bytes of the ulong returned by 'zend_inline_hash_func'. + * + * @param str, char *, string to be calculated hash code for. + * + * @author cjiang + */ +static inline uint8 hprof_inline_hash(const char * str) { + ulong h = 5381; + uint i = 0; + uint8 res = 0; + + while (*str) { + h += (h << 5); + h ^= (ulong) *str++; + } + + for (i = 0; i < sizeof(ulong); i++) { + res += ((uint8 *)&h)[i]; + } + return res; +} + +/** + * Get time delta in microseconds. + */ +static long get_us_interval(struct timeval *start, struct timeval *end) { + return (((end->tv_sec - start->tv_sec) * 1000000) + + (end->tv_usec - start->tv_usec)); +} + +/** + * Incr time with the given microseconds. + */ +static void incr_us_interval(struct timeval *start, uint64 incr) { + incr += (start->tv_sec * 1000000 + start->tv_usec); + start->tv_sec = incr/1000000; + start->tv_usec = incr%1000000; + return; +} + +/** + * Truncates the given timeval to the nearest slot begin, where + * the slot size is determined by intr + * + * @param tv Input timeval to be truncated in place + * @param intr Time interval in microsecs - slot width + * @return void + * @author veeve + */ +static void hp_trunc_time(struct timeval *tv, uint64 intr) { + uint64 time_in_micro; + + // Convert to microsecs and trunc that first + time_in_micro = (tv->tv_sec * 1000000) + tv->tv_usec; + time_in_micro /= intr; + time_in_micro *= intr; + + // Update tv + tv->tv_sec = (time_in_micro / 1000000); + tv->tv_usec = (time_in_micro % 1000000); +} + +/////////////////////////////////////////////////////////////////////////////// +// High precision timer related functions. + +/** + * Get time stamp counter (TSC) value via 'rdtsc' instruction. + * + * @return 64 bit unsigned integer + * @author cjiang + */ +inline uint64 cycle_timer() { + uint32 __a,__d; + uint64 val; + asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); + (val) = ((uint64)__a) | (((uint64)__d)<<32); + return val; +} + +/** + * This is a microbenchmark to get cpu frequency the process is running on. The + * returned value is used to convert TSC counter values to microseconds. + * + * @return double. + * @author cjiang + */ +static double get_cpu_frequency() { + struct timeval start; + struct timeval end; + + if (gettimeofday(&start, 0)) { + perror("gettimeofday"); + return 0.0; + } + uint64 tsc_start = cycle_timer(); + // Sleep for 5 miliseconds. Comparaing with gettimeofday's few microseconds + // execution time, this should be enough. + usleep(5000); + if (gettimeofday(&end, 0)) { + perror("gettimeofday"); + return 0.0; + } + uint64 tsc_end = cycle_timer(); + return (tsc_end - tsc_start) * 1.0 / (get_us_interval(&start, &end)); +} + +/////////////////////////////////////////////////////////////////////////////// +// Machine information that we collect just once. + +class MachineInfo { +public: + /** + * Bind the current process to a specified CPU. This function is to ensure + * that the OS won't schedule the process to different processors, which + * would make values read by rdtsc unreliable. + * + * @param uint32 cpu_id, the id of the logical cpu to be bound to. + * + * @author cjiang + */ + static void BindToCPU(uint32 cpu_id) { + cpu_set_t new_mask; + CPU_ZERO(&new_mask); + CPU_SET(cpu_id, &new_mask); + sched_setaffinity(0, sizeof(cpu_set_t), &new_mask); + } + +public: + // This array is used to store cpu frequencies for all available logical + // cpus. For now, we assume the cpu frequencies will not change for power + // saving or other reasons. If we need to worry about that in the future, we + // can use a periodical timer to re-calculate this arrary every once in a + // while (for example, every 1 or 5 seconds). + double *m_cpu_frequencies; + + // The number of logical CPUs this machine has. + int m_cpu_num; + + MachineInfo() { + m_cpu_num = sysconf(_SC_NPROCESSORS_CONF); + m_cpu_frequencies = (double*)malloc(sizeof(double) * m_cpu_num); + + cpu_set_t prev_mask; + sched_getaffinity(0, sizeof(cpu_set_t), &prev_mask); + for (int id = 0; id < m_cpu_num; ++id) { + BindToCPU(id); + + // Make sure the current process gets scheduled to the target cpu. This + // might not be necessary though. + usleep(0); + + m_cpu_frequencies[id] = get_cpu_frequency(); + } + sched_setaffinity(0, sizeof(cpu_set_t), &prev_mask); + } + + ~MachineInfo() { + free(m_cpu_frequencies); + } +}; +static MachineInfo s_machine; + +/////////////////////////////////////////////////////////////////////////////// +// classes + +/** + * All information we collect about a frame. + */ +class Frame { +public: + Frame *m_parent; // ptr to parent frame + const char *m_name; // function name + uint8 m_hash_code; // hash_code for the function name + int m_recursion; // recursion level for function + + uint64 m_tsc_start; // start value for TSC counter + int64 m_mu_start; // memory usage + int64 m_pmu_start; // peak memory usage + struct rusage m_ru_start; // user/sys time start + + /** + * Returns formatted function name + * + * @param result_buf ptr to result buf + * @param result_len max size of result buf + * @return total size of the function name returned in result_buf + * @author veeve + */ + size_t getName(char *result_buf, size_t result_len) { + if (result_len <= 1) { + return 0; // Insufficient result_bug. Bail! + } + + // Add '@recurse_level' if required + // NOTE: Dont use snprintf's return val as it is compiler dependent + if (m_recursion) { + snprintf(result_buf, result_len, "%s@%d", m_name, m_recursion); + } else { + snprintf(result_buf, result_len, "%s", m_name); + } + + // Force null-termination at MAX + result_buf[result_len - 1] = 0; + return strlen(result_buf); + } + + /** + * Build a caller qualified name for a callee. + * + * For example, if A() is caller for B(), then it returns "A==>B". + * Recursive invokations are denoted with @ where n is the recursion + * depth. + * + * For example, "foo==>foo@1", and "foo@2==>foo@3" are examples of direct + * recursion. And "bar==>foo@1" is an example of an indirect recursive + * call to foo (implying the foo() is on the call stack some levels + * above). + */ + size_t getStack(int level, char *result_buf, size_t result_len) { + // End recursion if we dont need deeper levels or + // we dont have any deeper levels + if (!m_parent || level <= 1) { + return getName(result_buf, result_len); + } + + // Take care of all ancestors first + size_t len = m_parent->getStack(level - 1, result_buf, result_len); + if (result_len < (len + HP_STACK_DELIM_LEN)) { + return len; // Insufficient result_buf. Bail out! + } + + // Add delimiter only if entry had ancestors + if (len) { + strncat(result_buf + len, HP_STACK_DELIM, result_len - len); + len += HP_STACK_DELIM_LEN; + } + + // Append the current function name + return len + getName(result_buf + len, result_len - len); + } +}; + +/** + * Maintain profiles of a running stack. + */ +class Profiler { +public: + Profiler() : m_stack(NULL), m_frame_free_list(NULL) { + // bind to a random cpu so that we can use rdtsc instruction. + m_cur_cpu_id = rand() % s_machine.m_cpu_num; + sched_getaffinity(0, sizeof(cpu_set_t), &m_prev_mask); + MachineInfo::BindToCPU(m_cur_cpu_id); + + memset(m_func_hash_counters, 0, sizeof(m_func_hash_counters)); + } + + virtual ~Profiler() { + sched_setaffinity(0, sizeof(cpu_set_t), &m_prev_mask); + + endAllFrames(); + for (Frame *p = m_frame_free_list; p;) { + Frame *cur = p; + p = p->m_parent; + free(cur); + } + } + + /** + * Subclass can do extra work by overriding these two virtual functions. + */ + virtual void beginFrameEx() {} // called right before a function call + virtual void endFrameEx() {} // called right after a function is finished + + /** + * Final results. + */ + virtual void writeStats(Array &ret) {} + + /** + * Start a new frame with the specified symbol. + */ + void beginFrame(const char *symbol) { + Frame *current = createFrame(symbol); + + // NOTE(cjiang): use hash code to fend off most of call-stack traversal + int recursion_level = 0; + if (m_func_hash_counters[current->m_hash_code] > 0) { + // Find this symbols recurse level + for (Frame *p = current->m_parent; p; p = p->m_parent) { + if (strcmp(current->m_name, p->m_name) == 0) { + recursion_level = p->m_recursion + 1; + break; + } + } + } + current->m_recursion = recursion_level; + + m_func_hash_counters[current->m_hash_code]++; + beginFrameEx(); + } + + /** + * End top of the stack. + */ + void endFrame(bool endMain = false) { + if (m_stack) { + // special case for main() frame that's only ended by endAllFrames() + if (!endMain && m_stack->m_parent == NULL) { + return; + } + endFrameEx(); + m_func_hash_counters[m_stack->m_hash_code]--; + releaseFrame(); + } + } + + void endAllFrames() { + while (m_stack) { + endFrame(true); + } + } + +protected: + uint32 m_cur_cpu_id; // cpu id current process is bound to + Frame *m_stack; // top of the profile stack + +private: + cpu_set_t m_prev_mask; // saved cpu affinity + Frame *m_frame_free_list; // freelist of Frame + uint8 m_func_hash_counters[256]; // counter table by hash code; + + /** + * Fast allocate a Frame structure. Picks one from the + * free list if available, else does an actual allocate. + */ + Frame *createFrame(const char *symbol) { + Frame *p = m_frame_free_list; + if (p) { + m_frame_free_list = p->m_parent; + } else { + p = (Frame*)malloc(sizeof(Frame)); + } + p->m_parent = m_stack; + p->m_name = symbol; + p->m_hash_code = hprof_inline_hash(symbol); + m_stack = p; + return p; + } + + /** + * Fast free a Frame structure. Simply returns back the Frame to a free list + * and doesn't actually perform the free. + */ + void releaseFrame() { + ASSERT(m_stack); + + Frame *p = m_stack; + m_stack = p->m_parent; + p->m_parent = m_frame_free_list; // we overload the m_parent field here + m_frame_free_list = p; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// SimpleProfiler + +/** + * getrusage() based profiler, but simple enough to print basic information. + * + * COMMENT(cjiang): getrusage is very expensive and inaccurate. It is based + * on sampling at the rate about once every 5 to 10 miliseconds. The sampling + * error can be very significantly, especially given that we are + * instrumenting at a very fine granularity. (every PHP function call will + * lead to one invokation of getrusage.) Most PHP functions such as the + * built-ins typically finish in microseconds. Thus the result we get from + * getrusage is very likely going to be skewed. Also worth noting that + * getrusage actually is a system call, which involves expensive swapping + * between user-mode and kernel mode. I would suggest we remove collecting + * CPU usage all together, as exclusive wall-time is very useful already. + * Or at least we should make it an opt-in choice. + * + * See: http://ww2.cs.fsu.edu/~hines/present/timing_linux.pdf + * + * Above is a nice paper talking about the overhead and the inaccucy problem + * asscociated with getrusage. + */ +class SimpleProfiler : public Profiler { +private: + class CountMap { + public: + CountMap() : count(0), wall_time(0), user_time(0), system_time(0) {} + + int64 count; + int64 wall_time; + int64 user_time; + int64 system_time; + }; + typedef __gnu_cxx::hash_map StatsMap; + StatsMap m_stats; // outcome + +public: + SimpleProfiler() { + print("
    "); + } + + ~SimpleProfiler() { + print("
    "); + print_output(); + } + + virtual void beginFrameEx() { + m_stack->m_tsc_start = cycle_timer(); + getrusage(RUSAGE_SELF, &m_stack->m_ru_start); + } + + virtual void endFrameEx() { + struct rusage ru_end; + getrusage(RUSAGE_SELF, &ru_end); + + CountMap &counts = m_stats[m_stack->m_name]; + counts.count++; + counts.wall_time += + (int64)((double)(cycle_timer() - m_stack->m_tsc_start)/ + s_machine.m_cpu_frequencies[m_cur_cpu_id]); + counts.user_time += + get_us_interval(&m_stack->m_ru_start.ru_utime, &ru_end.ru_utime); + counts.system_time += + get_us_interval(&m_stack->m_ru_start.ru_stime, &ru_end.ru_stime); + } + +private: + void print_output() { + print("" + "" + "

    Hotprofiler Data


    " + "
    " + "

     
    "); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// HierarchicalProfiler + +class HierarchicalProfiler : public Profiler { +private: + class CountMap { + public: + CountMap() : count(0), wall_time(0), cpu(0), memory(0), peak_memory(0) {} + + int64 count; + int64 wall_time; + int64 cpu; + int64 memory; + int64 peak_memory; + }; + typedef __gnu_cxx::hash_map StatsMap; + StatsMap m_stats; // outcome + +public: + enum Flag { + TrackBuiltins = 1, + TrackCPU = 2, + TrackMemory = 4, + }; + +public: + HierarchicalProfiler(int flags) : m_flags(flags) { + } + + virtual void beginFrameEx() { + m_stack->m_tsc_start = cycle_timer(); + + if (m_flags & TrackCPU) { + getrusage(RUSAGE_SELF, &m_stack->m_ru_start); + } + + if (m_flags & TrackMemory) { + MemoryManager *mm = MemoryManager::TheMemoryManager().get(); + const MemoryUsageStats &stats = mm->getStats(); + m_stack->m_mu_start = stats.usage; + m_stack->m_pmu_start = stats.peakUsage; + } + } + + virtual void endFrameEx() { + char symbol[512]; + m_stack->getStack(2, symbol, sizeof(symbol)); + CountMap &counts = m_stats[symbol]; + counts.count++; + counts.wall_time += + (int64)((double)(cycle_timer() - m_stack->m_tsc_start)/ + s_machine.m_cpu_frequencies[m_cur_cpu_id]); + + if (m_flags & TrackCPU) { + struct rusage ru_end; + getrusage(RUSAGE_SELF, &ru_end); + counts.cpu += + get_us_interval(&m_stack->m_ru_start.ru_utime, &ru_end.ru_utime) + + get_us_interval(&m_stack->m_ru_start.ru_stime, &ru_end.ru_stime); + } + + if (m_flags & TrackMemory) { + MemoryManager *mm = MemoryManager::TheMemoryManager().get(); + const MemoryUsageStats &stats = mm->getStats(); + int64 mu_end = stats.usage; + int64 pmu_end = stats.peakUsage; + counts.memory += mu_end - m_stack->m_mu_start; + counts.peak_memory += pmu_end - m_stack->m_pmu_start; + } + } + + virtual void writeStats(Array &ret) { + for (StatsMap::const_iterator iter = m_stats.begin(); + iter != m_stats.end(); ++iter) { + const CountMap &counts = iter->second; + Array arr; + arr.set("ct", counts.count); + arr.set("wt", counts.wall_time); + if (m_flags & TrackCPU) { + arr.set("cpu", counts.cpu); + } + if (m_flags & TrackMemory) { + arr.set("mu", counts.memory); + arr.set("pmu", counts.peak_memory); + } + ret.set(String(iter->first), arr); + } + } + +private: + uint32 m_flags; +}; + +/////////////////////////////////////////////////////////////////////////////// +// SampleProfiler + +/** + * Sampling based profiler. + */ +class SampleProfiler : public Profiler { +private: + typedef __gnu_cxx::hash_map CountMap; + typedef __gnu_cxx::hash_map StatsMap; + StatsMap m_stats; // outcome + +public: + SampleProfiler() { + struct timeval now; + uint64 truncated_us; + uint64 truncated_tsc; + double cpu_freq = s_machine.m_cpu_frequencies[m_cur_cpu_id]; + + // Init the last_sample in tsc + m_last_sample_tsc = cycle_timer(); + + // Find the microseconds that need to be truncated + gettimeofday(&m_last_sample_time, 0); + now = m_last_sample_time; + hp_trunc_time(&m_last_sample_time, SAMPLING_INTERVAL); + + // Subtract truncated time from last_sample_tsc + truncated_us = get_us_interval(&m_last_sample_time, &now); + truncated_tsc = (int64)((double)truncated_us * cpu_freq); + if (m_last_sample_tsc > truncated_tsc) { + // just to be safe while subtracting unsigned ints + m_last_sample_tsc -= truncated_tsc; + } + + // Convert sampling interval to ticks + m_sampling_interval_tsc = (int64)((double)SAMPLING_INTERVAL * cpu_freq); + } + + virtual void beginFrameEx() { + sample_check(); + } + + virtual void endFrameEx() { + sample_check(); + } + + virtual void writeStats(Array &ret) { + for (StatsMap::const_iterator iter = m_stats.begin(); + iter != m_stats.end(); ++iter) { + Array arr; + const CountMap &counts = iter->second; + for (CountMap::const_iterator iterCount = counts.begin(); + iterCount != counts.end(); ++iterCount) { + arr.set(String(iterCount->first), iterCount->second); + } + ret.set(String(iter->first), arr); + } + } + +private: + static const int SAMPLING_INTERVAL = 100000; // microsecs + + struct timeval m_last_sample_time; + uint64 m_last_sample_tsc; + uint64 m_sampling_interval_tsc; + + /** + * Sample the stack. Add it to the stats_count global. + * + * @param tv current time + * @param entries func stack as linked list of hprof_entry_t + * @return void + * @author veeve + */ + void sample_stack() { + char key[512]; + snprintf(key, sizeof(key), "%ld.%06ld", + m_last_sample_time.tv_sec, m_last_sample_time.tv_usec); + + char symbol[5120]; + m_stack->getStack(INT_MAX, symbol, sizeof(symbol)); + m_stats[key][symbol] = 1; + } + + /** + * Checks to see if it is time to sample the stack. + * Calls hp_sample_stack() if its time. + * + * @param entries func stack as linked list of hprof_entry_t + * @param last_sample time the last sample was taken + * @param sampling_intr sampling interval in microsecs + * @return void + * @author veeve + */ + void sample_check() { + if (m_stack) { + // While loop is to handle a single function taking a long time + // and passing several sampling intervals + while ((cycle_timer() - m_last_sample_tsc) > m_sampling_interval_tsc) { + m_last_sample_tsc += m_sampling_interval_tsc; + // HAS TO BE UPDATED BEFORE calling sample_stack + incr_us_interval(&m_last_sample_time, SAMPLING_INTERVAL); + sample_stack(); + } + } + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +class ProfilerFactory : public RequestEventHandler { +public: + enum Level { + Simple = 1, + Hierarchical = 2, + Memory = 3, + Sample = 620002, // Rockfort's zip code + }; + +public: + ProfilerFactory() : m_profiler(NULL) { + } + + ~ProfilerFactory() { + stop(); + } + + Profiler *getProfiler() { + return m_profiler; + } + + virtual void requestInit() { + } + + virtual void requestShutdown() { + stop(); + } + + void start(Level level, long flags) { + if (m_profiler == NULL) { + switch (level) { + case Simple: + m_profiler = new SimpleProfiler(); + break; + case Hierarchical: + m_profiler = new HierarchicalProfiler(flags); + break; + case Sample: + m_profiler = new SampleProfiler(); + break; + default: + throw InvalidArgumentException("level", level); + } + m_profiler->beginFrame("main()"); + } + } + + Variant stop() { + if (m_profiler) { + m_profiler->endAllFrames(); + + Array ret; + m_profiler->writeStats(ret); + delete m_profiler; + m_profiler = NULL; + return ret; + } + return null; + } + +private: + Profiler *m_profiler; +}; + +static RequestLocal s_factory; + +/////////////////////////////////////////////////////////////////////////////// +// main functions + +void f_hotprofiler_enable(int level) { +#ifdef HOTPROFILER + long flags = 0; + if (level == ProfilerFactory::Hierarchical) { + flags = HierarchicalProfiler::TrackBuiltins; + } else if (level == ProfilerFactory::Memory) { + level = ProfilerFactory::Hierarchical; + flags = HierarchicalProfiler::TrackBuiltins | + HierarchicalProfiler::TrackMemory; + } + s_factory->start((ProfilerFactory::Level)level, flags); +#endif +} + +Variant f_hotprofiler_disable() { +#ifdef HOTPROFILER + return s_factory->stop(); +#else + return null; +#endif +} + +void f_phprof_enable(int flags /* = 0 */) { +#ifdef HOTPROFILER + s_factory->start(ProfilerFactory::Hierarchical, flags); +#endif +} + +Variant f_phprof_disable() { +#ifdef HOTPROFILER + return s_factory->stop(); +#else + return null; +#endif +} + +void f_xhprof_enable(int flags/* = 0 */, + CArrRef args /* = null_array */) { +#ifdef HOTPROFILER + s_factory->start(ProfilerFactory::Hierarchical, flags); +#endif +} + +Variant f_xhprof_disable() { +#ifdef HOTPROFILER + return s_factory->stop(); +#else + return null; +#endif +} + +void f_xhprof_sample_enable() { +#ifdef HOTPROFILER + s_factory->start(ProfilerFactory::Sample, 0); +#endif +} + +Variant f_xhprof_sample_disable() { +#ifdef HOTPROFILER + return s_factory->stop(); +#else + return null; +#endif +} + +/////////////////////////////////////////////////////////////////////////////// +// injected code + +ProfilerInjection::ProfilerInjection(const char *symbol) { + Profiler *profiler = s_factory->getProfiler(); + if (profiler) { + profiler->beginFrame(symbol); + } +} + +ProfilerInjection::~ProfilerInjection() { + Profiler *profiler = s_factory->getProfiler(); + if (profiler) { + profiler->endFrame(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_iconv.cpp b/src/cpp/ext/ext_iconv.cpp new file mode 100644 index 0000000000000..73713eebf6e3b --- /dev/null +++ b/src/cpp/ext/ext_iconv.cpp @@ -0,0 +1,1813 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +#define ICONV_SUPPORTS_ERRNO 1 +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#define _php_iconv_memequal(a, b, c) \ + ((c) == sizeof(unsigned long) ? *((unsigned long *)(a)) == *((unsigned long *)(b)) : ((c) == sizeof(unsigned int) ? *((unsigned int *)(a)) == *((unsigned int *)(b)) : memcmp(a, b, c) == 0)) + +static char _generic_superset_name[] = "UCS-4LE"; +#define GENERIC_SUPERSET_NAME _generic_superset_name +#define GENERIC_SUPERSET_NBYTES 4 + +#define PHP_ICONV_MIME_DECODE_STRICT (1<<0) +#define PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR (1<<1) + +typedef enum _php_iconv_enc_scheme_t { + PHP_ICONV_ENC_SCHEME_BASE64, + PHP_ICONV_ENC_SCHEME_QPRINT +} php_iconv_enc_scheme_t; + +typedef enum _php_iconv_err_t { + PHP_ICONV_ERR_SUCCESS = 0, + PHP_ICONV_ERR_CONVERTER = 1, + PHP_ICONV_ERR_WRONG_CHARSET = 2, + PHP_ICONV_ERR_TOO_BIG = 3, + PHP_ICONV_ERR_ILLEGAL_SEQ = 4, + PHP_ICONV_ERR_ILLEGAL_CHAR = 5, + PHP_ICONV_ERR_UNKNOWN = 6, + PHP_ICONV_ERR_MALFORMED = 7, + PHP_ICONV_ERR_ALLOC = 8 +} php_iconv_err_t; + +static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset, + const char *in_charset) { + switch (err) { + case PHP_ICONV_ERR_SUCCESS: + break; + case PHP_ICONV_ERR_CONVERTER: + Logger::Error("Cannot open converter"); + break; + case PHP_ICONV_ERR_WRONG_CHARSET: + Logger::Error("Wrong charset, " + "conversion from `%s' to `%s' is not allowed", + in_charset, out_charset); + break; + case PHP_ICONV_ERR_ILLEGAL_CHAR: + Logger::Verbose("Detected an incomplete multibyte character " + "in input string"); + break; + case PHP_ICONV_ERR_ILLEGAL_SEQ: + Logger::Verbose("Detected an illegal character in input string"); + break; + case PHP_ICONV_ERR_TOO_BIG: + // should not happen + Logger::Error("Buffer length exceeded"); + break; + case PHP_ICONV_ERR_MALFORMED: + Logger::Verbose("Malformed string"); + break; + default: + // other error + Logger::Verbose("Unknown error (%d)", errno); + break; + } +} + +class ICONVGlobals : public RequestEventHandler { +public: + String input_encoding; + String output_encoding; + String internal_encoding; + + ICONVGlobals() {} + + virtual void requestInit() { + input_encoding = "ISO-8859-1"; + output_encoding = "ISO-8859-1"; + internal_encoding = "ISO-8859-1"; + } + + virtual void requestShutdown() { + } +}; +static RequestLocal s_iconv_globals; +#define ICONVG(name) s_iconv_globals->name + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +#ifndef ICONV_CSNMAXLEN +#define ICONV_CSNMAXLEN 64 +#endif +static void validate_charset(CStrRef charset) { + if (charset.size() >= ICONV_CSNMAXLEN) { + throw InvalidArgumentException + (0, "Charset parameter exceeds the maximum allowed " + "length of %d characters", ICONV_CSNMAXLEN); + } +} + +static String check_charset(CStrRef charset) { + validate_charset(charset); + if (charset.empty()) { + return ICONVG(internal_encoding); + } + return charset; +} + +static php_iconv_err_t _php_iconv_appendl(StringBuffer &d, const char *s, + size_t l, iconv_t cd) { + const char *in_p = s; + size_t in_left = l; + size_t out_left = 0; + size_t buf_growth = 128; + char *out_p; +#if !ICONV_SUPPORTS_ERRNO + size_t prev_in_left = in_left; +#endif + + if (in_p != NULL) { + while (in_left > 0) { + out_left = buf_growth - out_left; + out_p = d.reserve(out_left); + + if (iconv(cd, (char **)&in_p, &in_left, (char **)&out_p, &out_left) == + (size_t)-1) { +#if ICONV_SUPPORTS_ERRNO + switch (errno) { + case EINVAL: return PHP_ICONV_ERR_ILLEGAL_CHAR; + case EILSEQ: return PHP_ICONV_ERR_ILLEGAL_SEQ; + case E2BIG: break; + default: + return PHP_ICONV_ERR_UNKNOWN; + } +#else + if (prev_in_left == in_left) { + return PHP_ICONV_ERR_UNKNOWN; + } +#endif + } +#if !ICONV_SUPPORTS_ERRNO + prev_in_left = in_left; +#endif + d.resize(d.size() + buf_growth - out_left); + buf_growth <<= 1; + } + } else { + for (;;) { + out_left = buf_growth - out_left; + out_p = d.reserve(out_left); + + if (iconv(cd, NULL, NULL, (char **)&out_p, &out_left) == (size_t)0) { + d.resize(d.size() + buf_growth - out_left); + break; + } else { +#if ICONV_SUPPORTS_ERRNO + if (errno != E2BIG) { + return PHP_ICONV_ERR_UNKNOWN; + } +#else + if (out_left != 0) { + return PHP_ICONV_ERR_UNKNOWN; + } +#endif + } + d.resize(d.size() + buf_growth - out_left); + buf_growth <<= 1; + } + } + return PHP_ICONV_ERR_SUCCESS; +} + +static php_iconv_err_t _php_iconv_appendc(StringBuffer &d, const char c, + iconv_t cd) { + return _php_iconv_appendl(d, &c, 1, cd); +} + +static php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, + char **out, size_t *out_len, + const char *out_charset, + const char *in_charset) { +#if !ICONV_SUPPORTS_ERRNO + size_t in_size, out_size, out_left; + char *out_buffer, *out_p; + iconv_t cd; + size_t result; + + *out = NULL; + *out_len = 0; + + /** + * This is not the right way to get output size... + * This is not space efficient for large text. + * This is also problem for encoding like UTF-7/UTF-8/ISO-2022 which + * a single char can be more than 4 bytes. + * I added 15 extra bytes for safety. + */ + out_size = in_len * sizeof(int) + 15; + out_left = out_size; + + in_size = in_len; + + cd = iconv_open(out_charset, in_charset); + + if (cd == (iconv_t)(-1)) { + return PHP_ICONV_ERR_UNKNOWN; + } + + out_buffer = (char *)malloc(out_size + 1); + out_p = out_buffer; + + result = iconv(cd, (char **)&in_p, &in_size, (char **)&out_p, &out_left); + if (result == (size_t)(-1)) { + free(out_buffer); + return PHP_ICONV_ERR_UNKNOWN; + } + + if (out_left < 8) { + out_buffer = (char *)realloc(out_buffer, out_size + 8); + } + + // flush the shift-out sequences + result = iconv(cd, NULL, NULL, &out_p, &out_left); + + if (result == (size_t)(-1)) { + free(out_buffer); + return PHP_ICONV_ERR_UNKNOWN; + } + + *out_len = out_size - out_left; + out_buffer[*out_len] = '\0'; + *out = out_buffer; + + iconv_close(cd); + + return PHP_ICONV_ERR_SUCCESS; + +#else // iconv supports errno. Handle it better way. + + iconv_t cd; + size_t in_left, out_size, out_left; + char *out_p, *out_buf, *tmp_buf; + size_t bsz, result = 0; + php_iconv_err_t retval = PHP_ICONV_ERR_SUCCESS; + + *out = NULL; + *out_len = 0; + + cd = iconv_open(out_charset, in_charset); + + if (cd == (iconv_t)(-1)) { + if (errno == EINVAL) { + return PHP_ICONV_ERR_WRONG_CHARSET; + } else { + return PHP_ICONV_ERR_CONVERTER; + } + } + in_left= in_len; + out_left = in_len + 32; // Avoid realloc() most cases + out_size = 0; + bsz = out_left; + out_buf = (char *)malloc(bsz + 1); + out_p = out_buf; + + while (in_left > 0) { + result = iconv(cd, (char **)&in_p, &in_left, (char **)&out_p, &out_left); + out_size = bsz - out_left; + if (result == (size_t)(-1)) { + if (errno == E2BIG && in_left > 0) { + // converted string is longer than out buffer + bsz += in_len; + + tmp_buf = (char*)realloc(out_buf, bsz + 1); + out_p = out_buf = tmp_buf; + out_p += out_size; + out_left = bsz - out_size; + continue; + } + } + break; + } + + if (result != (size_t)(-1)) { + // flush the shift-out sequences + for (;;) { + result = iconv(cd, NULL, NULL, (char **)&out_p, &out_left); + out_size = bsz - out_left; + + if (result != (size_t)(-1)) { + break; + } + + if (errno == E2BIG) { + bsz += 16; + tmp_buf = (char *)realloc(out_buf, bsz); + + out_p = out_buf = tmp_buf; + out_p += out_size; + out_left = bsz - out_size; + } else { + break; + } + } + } + + iconv_close(cd); + + if (result == (size_t)(-1)) { + switch (errno) { + case EINVAL: retval = PHP_ICONV_ERR_ILLEGAL_CHAR; break; + case EILSEQ: retval = PHP_ICONV_ERR_ILLEGAL_SEQ; break; + case E2BIG: + // should not happen + retval = PHP_ICONV_ERR_TOO_BIG; + break; + default: + // other error + retval = PHP_ICONV_ERR_UNKNOWN; + free(out_buf); + return PHP_ICONV_ERR_UNKNOWN; + } + } + *out_p = '\0'; + *out = out_buf; + *out_len = out_size; + return retval; +#endif +} + +static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, + const char *str, size_t nbytes, + const char *enc) { + char buf[GENERIC_SUPERSET_NBYTES*2]; + php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; + iconv_t cd; + const char *in_p; + size_t in_left; + char *out_p; + size_t out_left; + unsigned int cnt; + + *pretval = (unsigned int)-1; + + cd = iconv_open(GENERIC_SUPERSET_NAME, enc); + if (cd == (iconv_t)(-1)) { +#if ICONV_SUPPORTS_ERRNO + if (errno == EINVAL) { + return PHP_ICONV_ERR_WRONG_CHARSET; + } else { + return PHP_ICONV_ERR_CONVERTER; + } +#else + return PHP_ICONV_ERR_UNKNOWN; +#endif + } + + errno = out_left = 0; + + for (in_p = str, in_left = nbytes, cnt = 0; in_left > 0; cnt+=2) { + size_t prev_in_left; + out_p = buf; + out_left = sizeof(buf); + + prev_in_left = in_left; + + if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) + == (size_t)-1) { + if (prev_in_left == in_left) { + break; + } + } + } + + if (out_left > 0) { + cnt -= out_left / GENERIC_SUPERSET_NBYTES; + } + +#if ICONV_SUPPORTS_ERRNO + switch (errno) { + case EINVAL: err = PHP_ICONV_ERR_ILLEGAL_CHAR; break; + case EILSEQ: err = PHP_ICONV_ERR_ILLEGAL_SEQ; break; + case E2BIG: + case 0: + *pretval = cnt; + break; + default: + err = PHP_ICONV_ERR_UNKNOWN; + break; + } +#else + *pretval = cnt; +#endif + + iconv_close(cd); + return err; +} + +static php_iconv_err_t _php_iconv_substr(StringBuffer &pretval, + const char *str, size_t nbytes, + int offset, int len, const char *enc){ + char buf[GENERIC_SUPERSET_NBYTES]; + php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; + iconv_t cd1, cd2; + const char *in_p; + size_t in_left; + char *out_p; + size_t out_left; + unsigned int cnt; + unsigned int total_len; + + err = _php_iconv_strlen(&total_len, str, nbytes, enc); + if (err != PHP_ICONV_ERR_SUCCESS) { + return err; + } + + if (len < 0) { + if ((len += (total_len - offset)) < 0) { + return PHP_ICONV_ERR_SUCCESS; + } + } + + if (offset < 0) { + if ((offset += total_len) < 0) { + return PHP_ICONV_ERR_SUCCESS; + } + } + + if (len > (int)total_len) { + len = total_len; + } + + + if (offset >= (int)total_len) { + return PHP_ICONV_ERR_SUCCESS; + } + + if ((offset + len) > (int)total_len ) { + /* trying to compute the length */ + len = total_len - offset; + } + + if (len == 0) { + return PHP_ICONV_ERR_SUCCESS; + } + + cd1 = iconv_open(GENERIC_SUPERSET_NAME, enc); + + if (cd1 == (iconv_t)(-1)) { +#if ICONV_SUPPORTS_ERRNO + if (errno == EINVAL) { + return PHP_ICONV_ERR_WRONG_CHARSET; + } else { + return PHP_ICONV_ERR_CONVERTER; + } +#else + return PHP_ICONV_ERR_UNKNOWN; +#endif + } + + cd2 = (iconv_t)NULL; + errno = 0; + + for (in_p = str, in_left = nbytes, cnt = 0; in_left > 0 && len > 0; ++cnt) { + size_t prev_in_left; + out_p = buf; + out_left = sizeof(buf); + + prev_in_left = in_left; + + if (iconv(cd1, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == + (size_t)-1) { + if (prev_in_left == in_left) { + break; + } + } + + if (cnt >= (unsigned int)offset) { + if (cd2 == (iconv_t)NULL) { + cd2 = iconv_open(enc, GENERIC_SUPERSET_NAME); + + if (cd2 == (iconv_t)(-1)) { + cd2 = (iconv_t)NULL; +#if ICONV_SUPPORTS_ERRNO + if (errno == EINVAL) { + err = PHP_ICONV_ERR_WRONG_CHARSET; + } else { + err = PHP_ICONV_ERR_CONVERTER; + } +#else + err = PHP_ICONV_ERR_UNKNOWN; +#endif + break; + } + } + + if (_php_iconv_appendl(pretval, buf, sizeof(buf), cd2) != + PHP_ICONV_ERR_SUCCESS) { + break; + } + --len; + } + } + +#if ICONV_SUPPORTS_ERRNO + switch (errno) { + case EINVAL: + err = PHP_ICONV_ERR_ILLEGAL_CHAR; + break; + + case EILSEQ: + err = PHP_ICONV_ERR_ILLEGAL_SEQ; + break; + + case E2BIG: + break; + } +#endif + if (err == PHP_ICONV_ERR_SUCCESS) { + if (cd2 != (iconv_t)NULL) { + _php_iconv_appendl(pretval, NULL, 0, cd2); + } + } + + if (cd1 != (iconv_t)NULL) { + iconv_close(cd1); + } + + if (cd2 != (iconv_t)NULL) { + iconv_close(cd2); + } + return err; +} + +static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval, + const char *haystk, + size_t haystk_nbytes, + const char *ndl, size_t ndl_nbytes, + int offset, const char *enc) { + char buf[GENERIC_SUPERSET_NBYTES]; + php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; + iconv_t cd; + const char *in_p; + size_t in_left; + char *out_p; + size_t out_left; + unsigned int cnt; + char *ndl_buf; + const char *ndl_buf_p; + size_t ndl_buf_len, ndl_buf_left; + unsigned int match_ofs; + + *pretval = (unsigned int)-1; + + err = php_iconv_string(ndl, ndl_nbytes, + &ndl_buf, &ndl_buf_len, GENERIC_SUPERSET_NAME, enc); + + if (err != PHP_ICONV_ERR_SUCCESS) { + if (ndl_buf != NULL) { + free(ndl_buf); + } + return err; + } + + cd = iconv_open(GENERIC_SUPERSET_NAME, enc); + + if (cd == (iconv_t)(-1)) { + if (ndl_buf != NULL) { + free(ndl_buf); + } +#if ICONV_SUPPORTS_ERRNO + if (errno == EINVAL) { + return PHP_ICONV_ERR_WRONG_CHARSET; + } else { + return PHP_ICONV_ERR_CONVERTER; + } +#else + return PHP_ICONV_ERR_UNKNOWN; +#endif + } + + ndl_buf_p = ndl_buf; + ndl_buf_left = ndl_buf_len; + match_ofs = (unsigned int)-1; + + for (in_p = haystk, in_left = haystk_nbytes, cnt = 0; in_left > 0; ++cnt) { + size_t prev_in_left; + out_p = buf; + out_left = sizeof(buf); + + prev_in_left = in_left; + + if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == + (size_t)-1) { + if (prev_in_left == in_left) { +#if ICONV_SUPPORTS_ERRNO + switch (errno) { + case EINVAL: err = PHP_ICONV_ERR_ILLEGAL_CHAR; break; + case EILSEQ: err = PHP_ICONV_ERR_ILLEGAL_SEQ; break; + case E2BIG: + break; + default: + err = PHP_ICONV_ERR_UNKNOWN; + break; + } +#endif + break; + } + } + if (offset >= 0) { + if (cnt >= (unsigned int)offset) { + if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) { + if (match_ofs == (unsigned int)-1) { + match_ofs = cnt; + } + ndl_buf_p += GENERIC_SUPERSET_NBYTES; + ndl_buf_left -= GENERIC_SUPERSET_NBYTES; + if (ndl_buf_left == 0) { + *pretval = match_ofs; + break; + } + } else { + unsigned int i, j, lim; + + i = 0; + j = GENERIC_SUPERSET_NBYTES; + lim = (unsigned int)(ndl_buf_p - ndl_buf); + + while (j < lim) { + if (_php_iconv_memequal(&ndl_buf[j], &ndl_buf[i], + GENERIC_SUPERSET_NBYTES)) { + i += GENERIC_SUPERSET_NBYTES; + } else { + j -= i; + i = 0; + } + j += GENERIC_SUPERSET_NBYTES; + } + + if (_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) { + match_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES; + i += GENERIC_SUPERSET_NBYTES; + ndl_buf_p = &ndl_buf[i]; + ndl_buf_left = ndl_buf_len - i; + } else { + match_ofs = (unsigned int)-1; + ndl_buf_p = ndl_buf; + ndl_buf_left = ndl_buf_len; + } + } + } + } else { + if (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) { + if (match_ofs == (unsigned int)-1) { + match_ofs = cnt; + } + ndl_buf_p += GENERIC_SUPERSET_NBYTES; + ndl_buf_left -= GENERIC_SUPERSET_NBYTES; + if (ndl_buf_left == 0) { + *pretval = match_ofs; + ndl_buf_p = ndl_buf; + ndl_buf_left = ndl_buf_len; + match_ofs = (unsigned int)-1; + } + } else { + unsigned int i, j, lim; + + i = 0; + j = GENERIC_SUPERSET_NBYTES; + lim = (unsigned int)(ndl_buf_p - ndl_buf); + + while (j < lim) { + if (_php_iconv_memequal(&ndl_buf[j], &ndl_buf[i], + GENERIC_SUPERSET_NBYTES)) { + i += GENERIC_SUPERSET_NBYTES; + } else { + j -= i; + i = 0; + } + j += GENERIC_SUPERSET_NBYTES; + } + + if (_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) { + match_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES; + i += GENERIC_SUPERSET_NBYTES; + ndl_buf_p = &ndl_buf[i]; + ndl_buf_left = ndl_buf_len - i; + } else { + match_ofs = (unsigned int)-1; + ndl_buf_p = ndl_buf; + ndl_buf_left = ndl_buf_len; + } + } + } + } + + if (ndl_buf) { + free(ndl_buf); + } + + iconv_close(cd); + return err; +} + +static php_iconv_err_t _php_iconv_mime_decode(StringBuffer &retval, + const char *str, + size_t str_nbytes, + const char *enc, + const char **next_pos, + int mode) { + php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; + + iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1); + + const char *p1; + size_t str_left; + unsigned int scan_stat = 0; + const char *csname = NULL; + size_t csname_len; + const char *encoded_text = NULL; + size_t encoded_text_len = 0; + const char *encoded_word = NULL; + const char *spaces = NULL; + + php_iconv_enc_scheme_t enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64; + + if (next_pos != NULL) { + *next_pos = NULL; + } + cd_pl = iconv_open(enc, "ASCII"); + + if (cd_pl == (iconv_t)(-1)) { +#if ICONV_SUPPORTS_ERRNO + if (errno == EINVAL) { + err = PHP_ICONV_ERR_WRONG_CHARSET; + } else { + err = PHP_ICONV_ERR_CONVERTER; + } +#else + err = PHP_ICONV_ERR_UNKNOWN; +#endif + goto out; + } + + p1 = str; + for (str_left = str_nbytes; str_left > 0; str_left--, p1++) { + int eos = 0; + + switch (scan_stat) { + case 0: /* expecting any character */ + switch (*p1) { + case '\r': /* part of an EOL sequence? */ + scan_stat = 7; + break; + + case '\n': + scan_stat = 8; + break; + + case '=': /* first letter of an encoded chunk */ + encoded_word = p1; + scan_stat = 1; + break; + + case ' ': case '\t': /* a chunk of whitespaces */ + spaces = p1; + scan_stat = 11; + break; + + default: /* first letter of a non-encoded word */ + _php_iconv_appendc(retval, *p1, cd_pl); + encoded_word = NULL; + if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { + scan_stat = 12; + } + break; + } + break; + + case 1: /* expecting a delimiter */ + if (*p1 != '?') { + err = _php_iconv_appendl(retval, encoded_word, + (size_t)((p1 + 1) - encoded_word), cd_pl); + if (err != PHP_ICONV_ERR_SUCCESS) { + goto out; + } + encoded_word = NULL; + if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { + scan_stat = 12; + } else { + scan_stat = 0; + } + break; + } + csname = p1 + 1; + scan_stat = 2; + break; + + case 2: /* expecting a charset name */ + switch (*p1) { + case '?': /* normal delimiter: encoding scheme follows */ + scan_stat = 3; + break; + + case '*': /* new style delimiter: locale id follows */ + scan_stat = 10; + break; + } + if (scan_stat != 2) { + char tmpbuf[80]; + + if (csname == NULL) { + err = PHP_ICONV_ERR_MALFORMED; + goto out; + } + + csname_len = (size_t)(p1 - csname); + + if (csname_len > sizeof(tmpbuf) - 1) { + if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { + err = _php_iconv_appendl(retval, encoded_word, + (size_t)((p1 + 1) - encoded_word), cd_pl); + if (err != PHP_ICONV_ERR_SUCCESS) { + goto out; + } + encoded_word = NULL; + if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { + scan_stat = 12; + } else { + scan_stat = 0; + } + break; + } else { + err = PHP_ICONV_ERR_MALFORMED; + goto out; + } + } + + memcpy(tmpbuf, csname, csname_len); + tmpbuf[csname_len] = '\0'; + + if (cd != (iconv_t)(-1)) { + iconv_close(cd); + } + + cd = iconv_open(enc, tmpbuf); + + if (cd == (iconv_t)(-1)) { + if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { + err = _php_iconv_appendl(retval, encoded_word, + (size_t)((p1 + 1) - encoded_word), cd_pl); + if (err != PHP_ICONV_ERR_SUCCESS) { + goto out; + } + encoded_word = NULL; + if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { + scan_stat = 12; + } else { + scan_stat = 0; + } + break; + } else { +#if ICONV_SUPPORTS_ERRNO + if (errno == EINVAL) { + err = PHP_ICONV_ERR_WRONG_CHARSET; + } else { + err = PHP_ICONV_ERR_CONVERTER; + } +#else + err = PHP_ICONV_ERR_UNKNOWN; +#endif + goto out; + } + } + } + break; + + case 3: /* expecting a encoding scheme specifier */ + switch (*p1) { + case 'b': + case 'B': + enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64; + scan_stat = 4; + break; + + case 'q': + case 'Q': + enc_scheme = PHP_ICONV_ENC_SCHEME_QPRINT; + scan_stat = 4; + break; + + default: + if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { + err = _php_iconv_appendl(retval, encoded_word, + (size_t)((p1 + 1) - encoded_word), cd_pl); + if (err != PHP_ICONV_ERR_SUCCESS) { + goto out; + } + encoded_word = NULL; + if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { + scan_stat = 12; + } else { + scan_stat = 0; + } + break; + } else { + err = PHP_ICONV_ERR_MALFORMED; + goto out; + } + } + break; + + case 4: /* expecting a delimiter */ + if (*p1 != '?') { + if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { + /* pass the entire chunk through the converter */ + err = _php_iconv_appendl(retval, encoded_word, + (size_t)((p1 + 1) - encoded_word), cd_pl); + if (err != PHP_ICONV_ERR_SUCCESS) { + goto out; + } + encoded_word = NULL; + if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { + scan_stat = 12; + } else { + scan_stat = 0; + } + break; + } else { + err = PHP_ICONV_ERR_MALFORMED; + goto out; + } + } + encoded_text = p1 + 1; + scan_stat = 5; + break; + + case 5: /* expecting an encoded portion */ + if (*p1 == '?') { + encoded_text_len = (size_t)(p1 - encoded_text); + scan_stat = 6; + } + break; + + case 7: /* expecting a "\n" character */ + if (*p1 == '\n') { + scan_stat = 8; + } else { + /* bare CR */ + _php_iconv_appendc(retval, '\r', cd_pl); + _php_iconv_appendc(retval, *p1, cd_pl); + scan_stat = 0; + } + break; + + case 8: /* checking whether the following line is part of a + folded header */ + if (*p1 != ' ' && *p1 != '\t') { + --p1; + str_left = 1; /* quit_loop */ + break; + } + if (encoded_word == NULL) { + _php_iconv_appendc(retval, ' ', cd_pl); + } + spaces = NULL; + scan_stat = 11; + break; + + case 6: /* expecting a End-Of-Chunk character "=" */ + if (*p1 != '=') { + if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { + /* pass the entire chunk through the converter */ + err = _php_iconv_appendl(retval, encoded_word, + (size_t)((p1 + 1) - encoded_word), cd_pl); + if (err != PHP_ICONV_ERR_SUCCESS) { + goto out; + } + encoded_word = NULL; + if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { + scan_stat = 12; + } else { + scan_stat = 0; + } + break; + } else { + err = PHP_ICONV_ERR_MALFORMED; + goto out; + } + } + scan_stat = 9; + if (str_left == 1) { + eos = 1; + } else { + break; + } + + case 9: /* choice point, seeing what to do next.*/ + switch (*p1) { + default: + /* Handle non-RFC-compliant formats + * + * RFC2047 requires the character that comes right + * after an encoded word (chunk) to be a whitespace, + * while there are lots of broken implementations that + * generate such malformed headers that don't fulfill + * that requirement. + */ + if (!eos) { + if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { + /* pass the entire chunk through the converter */ + err = _php_iconv_appendl(retval, encoded_word, + (size_t)((p1 + 1) - encoded_word), cd_pl); + if (err != PHP_ICONV_ERR_SUCCESS) { + goto out; + } + scan_stat = 12; + break; + } + } + /* break is omitted intentionally */ + + case '\r': case '\n': case ' ': case '\t': { + String decoded; + switch (enc_scheme) { + case PHP_ICONV_ENC_SCHEME_BASE64: + { + int len = encoded_text_len; + char *ret = string_base64_decode(encoded_text, len, false); + decoded = String(ret, len, AttachString); + } + break; + case PHP_ICONV_ENC_SCHEME_QPRINT: + { + int len = encoded_text_len; + char *ret = string_quoted_printable_decode(encoded_text, len); + decoded = String(ret, len, AttachString); + } + break; + default: + break; + } + + if (decoded.isNull()) { + if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { + /* pass the entire chunk through the converter */ + err = _php_iconv_appendl(retval, encoded_word, + (size_t)((p1 + 1) - encoded_word), cd_pl); + if (err != PHP_ICONV_ERR_SUCCESS) { + goto out; + } + encoded_word = NULL; + if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { + scan_stat = 12; + } else { + scan_stat = 0; + } + break; + } else { + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } + } + + err = _php_iconv_appendl(retval, decoded.data(), decoded.size(), cd); + if (err != PHP_ICONV_ERR_SUCCESS) { + if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { + /* pass the entire chunk through the converter */ + err = _php_iconv_appendl(retval, encoded_word, + (size_t)(p1 - encoded_word), cd_pl); + if (err != PHP_ICONV_ERR_SUCCESS) { + goto out; + } + encoded_word = NULL; + } else { + goto out; + } + } + + if (eos) { /* reached end-of-string. done. */ + scan_stat = 0; + break; + } + + switch (*p1) { + case '\r': /* part of an EOL sequence? */ + scan_stat = 7; + break; + + case '\n': + scan_stat = 8; + break; + + case '=': /* first letter of an encoded chunk */ + scan_stat = 1; + break; + + case ' ': case '\t': /* medial whitespaces */ + spaces = p1; + scan_stat = 11; + break; + + default: /* first letter of a non-encoded word */ + _php_iconv_appendc(retval, *p1, cd_pl); + scan_stat = 12; + break; + } + } break; + } + break; + + case 10: /* expects a language specifier. dismiss it for now */ + if (*p1 == '?') { + scan_stat = 3; + } + break; + + case 11: /* expecting a chunk of whitespaces */ + switch (*p1) { + case '\r': /* part of an EOL sequence? */ + scan_stat = 7; + break; + + case '\n': + scan_stat = 8; + break; + + case '=': /* first letter of an encoded chunk */ + if (spaces != NULL && encoded_word == NULL) { + _php_iconv_appendl(retval, spaces, (size_t)(p1 - spaces), cd_pl); + spaces = NULL; + } + encoded_word = p1; + scan_stat = 1; + break; + + case ' ': case '\t': + break; + + default: /* first letter of a non-encoded word */ + if (spaces != NULL) { + _php_iconv_appendl(retval, spaces, (size_t)(p1 - spaces), cd_pl); + spaces = NULL; + } + _php_iconv_appendc(retval, *p1, cd_pl); + encoded_word = NULL; + if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { + scan_stat = 12; + } else { + scan_stat = 0; + } + break; + } + break; + + case 12: /* expecting a non-encoded word */ + switch (*p1) { + case '\r': /* part of an EOL sequence? */ + scan_stat = 7; + break; + + case '\n': + scan_stat = 8; + break; + + case ' ': case '\t': + spaces = p1; + scan_stat = 11; + break; + + case '=': /* first letter of an encoded chunk */ + if (!(mode & PHP_ICONV_MIME_DECODE_STRICT)) { + encoded_word = p1; + scan_stat = 1; + break; + } + /* break is omitted intentionally */ + + default: + _php_iconv_appendc(retval, *p1, cd_pl); + break; + } + break; + } + } + switch (scan_stat) { + case 0: case 8: case 11: case 12: + break; + default: + if ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) { + if (scan_stat == 1) { + _php_iconv_appendc(retval, '=', cd_pl); + } + err = PHP_ICONV_ERR_SUCCESS; + } else { + err = PHP_ICONV_ERR_MALFORMED; + goto out; + } + } + + if (next_pos != NULL) { + *next_pos = p1; + } + + out: + if (cd != (iconv_t)(-1)) { + iconv_close(cd); + } + if (cd_pl != (iconv_t)(-1)) { + iconv_close(cd_pl); + } + return err; +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_iconv_mime_encode(CStrRef field_name, CStrRef field_value, + CVarRef preferences /* = null_variant */) { + php_iconv_enc_scheme_t scheme_id = PHP_ICONV_ENC_SCHEME_BASE64; + String in_charset; + String out_charset; + long line_len = 76; + String lfchars = "\r\n"; + StringBuffer ret; + char *buf = NULL; + + if (!preferences.isNull()) { + Variant scheme = preferences["scheme"]; + if (scheme.isString()) { + String s = scheme.toString(); + switch (*s.data()) { + case 'B': case 'b': + scheme_id = PHP_ICONV_ENC_SCHEME_BASE64; + break; + case 'Q': case 'q': + scheme_id = PHP_ICONV_ENC_SCHEME_QPRINT; + break; + } + } + + Variant input_charset = preferences["input-charset"]; + if (input_charset.isString()) { + in_charset = input_charset.toString(); + validate_charset(in_charset); + } + + Variant output_charset = preferences["output-charset"]; + if (output_charset.isString()) { + out_charset = output_charset.toString(); + validate_charset(out_charset); + } + + Variant line_length = preferences["line-length"]; + if (!line_length.isNull()) { + line_len = line_length.toInt64(); + } + + Variant line_break_chars = preferences["line-break-chars"]; + if (!line_break_chars.isNull()) { + lfchars = line_break_chars.toString(); + } + } + + static int qp_table[256] = { + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x00 */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 */ + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x20 */ + 1, 1, 1, 1, 1, 1, 1 ,1, 1, 1, 1, 1, 1, 3, 1, 3, /* 0x30 */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, /* 0x50 */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, /* 0x70 */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x80 */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x90 */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xA0 */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xB0 */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xC0 */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xD0 */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xE0 */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 /* 0xF0 */ + }; + + php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; + iconv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1); + + if ((field_name.size() + 2) >= line_len || + (out_charset.size() + 12) >= line_len) { + /* field name is too long */ + err = PHP_ICONV_ERR_TOO_BIG; + goto out; + } + + cd_pl = iconv_open("ASCII", in_charset.data()); + if (cd_pl == (iconv_t)(-1)) { +#if ICONV_SUPPORTS_ERRNO + if (errno == EINVAL) { + err = PHP_ICONV_ERR_WRONG_CHARSET; + } else { + err = PHP_ICONV_ERR_CONVERTER; + } +#else + err = PHP_ICONV_ERR_UNKNOWN; +#endif + goto out; + } + + cd = iconv_open(out_charset.data(), in_charset.data()); + if (cd == (iconv_t)(-1)) { +#if ICONV_SUPPORTS_ERRNO + if (errno == EINVAL) { + err = PHP_ICONV_ERR_WRONG_CHARSET; + } else { + err = PHP_ICONV_ERR_CONVERTER; + } +#else + err = PHP_ICONV_ERR_UNKNOWN; +#endif + goto out; + } + + const char *in_p; + size_t in_left; + char *out_p; + size_t out_left; + + buf = (char*)malloc(line_len + 5); + unsigned int char_cnt; + char_cnt = line_len; + + _php_iconv_appendl(ret, field_name.data(), field_name.size(), cd_pl); + char_cnt -= field_name.size(); + ret.append(": "); + char_cnt -= 2; + + in_p = field_value.data(); + in_left = field_value.size(); + + do { + size_t prev_in_left; + size_t out_size; + + if ((int)char_cnt < (out_charset.size() + 12)) { + ret.append(lfchars); // lfchars must be encoded in ASCII here + ret.append(' '); + char_cnt = line_len - 1; + } + + ret.append("=?"); + char_cnt -= 2; + ret.append(out_charset); + char_cnt -= out_charset.size(); + ret.append('?'); + char_cnt --; + + switch (scheme_id) { + case PHP_ICONV_ENC_SCHEME_BASE64: + { + size_t ini_in_left; + const char *ini_in_p; + size_t out_reserved = 4; + + ret.append('B'); + char_cnt--; + ret.append('?'); + char_cnt--; + + prev_in_left = ini_in_left = in_left; + ini_in_p = in_p; + + out_size = (char_cnt - 2) / 4 * 3; + + for (;;) { + out_p = buf; + + if (out_size <= out_reserved) { + err = PHP_ICONV_ERR_TOO_BIG; + goto out; + } + + out_left = out_size - out_reserved; + + if (iconv(cd, (char **)&in_p, &in_left, + (char **)&out_p, &out_left) == (size_t)-1) { +#if ICONV_SUPPORTS_ERRNO + switch (errno) { + case EINVAL: err = PHP_ICONV_ERR_ILLEGAL_CHAR; goto out; + case EILSEQ: err = PHP_ICONV_ERR_ILLEGAL_SEQ; goto out; + case E2BIG: + if (prev_in_left == in_left) { + err = PHP_ICONV_ERR_TOO_BIG; + goto out; + } + break; + default: + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } +#else + if (prev_in_left == in_left) { + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } +#endif + } + + out_left += out_reserved; + + if (iconv(cd, NULL, NULL, (char **)&out_p, &out_left) == + (size_t)-1) { +#if ICONV_SUPPORTS_ERRNO + if (errno != E2BIG) { + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } +#else + if (out_left != 0) { + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } +#endif + } else { + break; + } + + if (iconv(cd, NULL, NULL, NULL, NULL) == (size_t)-1) { + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } + + out_reserved += 4; + in_left = ini_in_left; + in_p = ini_in_p; + } + + prev_in_left = in_left; + + + int encoded_len = out_size - out_left; + char *encoded_str = string_base64_encode(buf, encoded_len); + String encoded(encoded_str, encoded_len, AttachString); + if ((int)char_cnt < encoded.size()) { + /* something went wrong! */ + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } + + ret.append(encoded); + char_cnt -= encoded.size(); + ret.append("?="); + char_cnt -= 2; + } + break; /* case PHP_ICONV_ENC_SCHEME_BASE64: */ + + case PHP_ICONV_ENC_SCHEME_QPRINT: + { + size_t ini_in_left; + const char *ini_in_p; + const unsigned char *p; + size_t nbytes_required; + + ret.append('Q'); + char_cnt--; + ret.append('?'); + char_cnt--; + + prev_in_left = ini_in_left = in_left; + ini_in_p = in_p; + + for (out_size = char_cnt; out_size > 0;) { + size_t prev_out_left; + + nbytes_required = 0; + + out_p = buf; + out_left = out_size; + + if (iconv(cd, (char **)&in_p, &in_left, + (char **)&out_p, &out_left) == (size_t)-1) { +#if ICONV_SUPPORTS_ERRNO + switch (errno) { + case EINVAL: err = PHP_ICONV_ERR_ILLEGAL_CHAR; goto out; + case EILSEQ: err = PHP_ICONV_ERR_ILLEGAL_SEQ; goto out; + case E2BIG: + if (prev_in_left == in_left) { + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } + break; + default: + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } +#else + if (prev_in_left == in_left) { + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } +#endif + } + + prev_out_left = out_left; + if (iconv(cd, NULL, NULL, (char **)&out_p, &out_left) == + (size_t)-1) { +#if ICONV_SUPPORTS_ERRNO + if (errno != E2BIG) { + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } +#else + if (out_left == prev_out_left) { + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } +#endif + } + + for (p = (unsigned char *)buf; p < (unsigned char *)out_p; p++) { + nbytes_required += qp_table[*p]; + } + + if (nbytes_required <= char_cnt - 2) { + break; + } + + out_size -= ((nbytes_required - (char_cnt - 2)) + 1) / (3 - 1); + in_left = ini_in_left; + in_p = ini_in_p; + } + + for (p = (unsigned char *)buf; p < (unsigned char *)out_p; p++) { + if (qp_table[*p] == 1) { + ret.append(*(char*)p); + char_cnt--; + } else { + static char qp_digits[] = "0123456789ABCDEF"; + ret.append('='); + ret.append(qp_digits[(*p >> 4) & 0x0f]); + ret.append(qp_digits[(*p & 0x0f)]); + char_cnt -= 3; + } + } + prev_in_left = in_left; + + ret.append("?="); + char_cnt -= 2; + + if (iconv(cd, NULL, NULL, NULL, NULL) == (size_t)-1) { + err = PHP_ICONV_ERR_UNKNOWN; + goto out; + } + + } break; /* case PHP_ICONV_ENC_SCHEME_QPRINT: */ + } + } while (in_left > 0); + + out: + if (cd != (iconv_t)(-1)) { + iconv_close(cd); + } + if (cd_pl != (iconv_t)(-1)) { + iconv_close(cd_pl); + } + if (buf != NULL) { + free(buf); + } + + if (err != PHP_ICONV_ERR_SUCCESS) { + return false; + } + return ret.detach(); +} + +Variant f_iconv_mime_decode(CStrRef encoded_string, int mode /* = 0 */, + CStrRef charset /* = null_string */) { + String enc = check_charset(charset); + + StringBuffer retval; + php_iconv_err_t err = + _php_iconv_mime_decode(retval, encoded_string.data(), + encoded_string.size(), enc.data(), NULL, mode); + _php_iconv_show_error(err, enc.data(), "???"); + + if (err == PHP_ICONV_ERR_SUCCESS) { + return retval.detach(); + } + return false; +} + +Variant f_iconv_mime_decode_headers(CStrRef encoded_headers, + int mode /* = 0 */, + CStrRef charset /* = null_string */) { + String enc = check_charset(charset); + + Array ret; + php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS; + const char *encoded_str = encoded_headers.data(); + int encoded_str_len = encoded_headers.size(); + while (encoded_str_len > 0) { + StringBuffer decoded_header; + + const char *header_name = NULL; + size_t header_name_len = 0; + const char *header_value = NULL; + size_t header_value_len = 0; + const char *p, *limit; + + const char *next_pos; + err = _php_iconv_mime_decode(decoded_header, encoded_str, encoded_str_len, + enc.data(), &next_pos, mode); + if (err != PHP_ICONV_ERR_SUCCESS || decoded_header.data() == NULL) { + break; + } + + limit = decoded_header.data() + decoded_header.size(); + for (p = decoded_header.data(); p < limit; p++) { + if (*p == ':') { + *((char*)p) = '\0'; + header_name = decoded_header.data(); + header_name_len = p - decoded_header.data(); + + while (++p < limit) { + if (*p != ' ' && *p != '\t') { + break; + } + } + + header_value = p; + header_value_len = limit - p; + break; + } + } + + if (header_name != NULL) { + String header(header_name, header_name_len, CopyString); + String value(header_value, header_value_len, CopyString); + if (ret.exists(header)) { + Variant elem = ret[header]; + if (!elem.is(KindOfArray)) { + ret.set(header, CREATE_VECTOR2(elem, value)); + } else { + elem.append(value); + ret.set(header, elem); + } + } else { + ret.set(header, value); + } + } + encoded_str_len -= next_pos - encoded_str; + encoded_str = next_pos; + } + + if (err != PHP_ICONV_ERR_SUCCESS) { + _php_iconv_show_error(err, enc.data(), "???"); + return false; + } + return ret; +} + +Variant f_iconv_get_encoding(CStrRef type /* = "all" */) { + if (type == "all") { + Array ret; + ret.set("input_encoding", ICONVG(input_encoding)); + ret.set("output_encoding", ICONVG(output_encoding)); + ret.set("internal_encoding", ICONVG(internal_encoding)); + return ret; + } + if (type == "input_encoding") return ICONVG(input_encoding); + if (type == "output_encoding") return ICONVG(output_encoding); + if (type == "internal_encoding") return ICONVG(internal_encoding); + return false; +} + +bool f_iconv_set_encoding(CStrRef type, CStrRef charset) { + validate_charset(charset); + if (type == "input_encoding") { + ICONVG(input_encoding) = charset; + } else if (type == "output_encoding") { + ICONVG(output_encoding) = charset; + } else if (type == "internal_encoding") { + ICONVG(internal_encoding) = charset; + } else { + return false; + } + return true; +} + +Variant f_iconv(CStrRef in_charset, CStrRef out_charset, CStrRef str) { + validate_charset(in_charset); + validate_charset(out_charset); + + char *out_buffer; + size_t out_len; + php_iconv_err_t err = + php_iconv_string(str.data(), str.size(), &out_buffer, &out_len, + out_charset.data(), in_charset.data()); + _php_iconv_show_error(err, out_charset.data(), in_charset.data()); + if (out_buffer != NULL) { + return String(out_buffer, out_len, AttachString); + } + return false; +} + +Variant f_iconv_strlen(CStrRef str, CStrRef charset /* = null_string */) { + String enc = check_charset(charset); + unsigned int retval; + php_iconv_err_t err = _php_iconv_strlen(&retval, str.data(), str.size(), + enc.data()); + _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, enc.data()); + if (err == PHP_ICONV_ERR_SUCCESS) { + return (int64)retval; + } + return false; +} + +Variant f_iconv_strpos(CStrRef haystack, CStrRef needle, int offset /* = 0 */, + CStrRef charset /* = null_string */) { + if (offset < 0) { + Logger::Warning("Offset not contained in string."); + return false; + } + if (needle.size() < 1) { + return false; + } + + String enc = check_charset(charset); + unsigned int retval; + php_iconv_err_t err = + _php_iconv_strpos(&retval, haystack.data(), haystack.size(), + needle.data(), needle.size(), offset, enc.data()); + _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, enc.data()); + if (err == PHP_ICONV_ERR_SUCCESS && retval != (unsigned int)-1) { + return (long)retval; + } + return false; +} + +Variant f_iconv_strrpos(CStrRef haystack, CStrRef needle, + CStrRef charset /* = null_string */) { + if (needle.size() < 1) { + return false; + } + + String enc = check_charset(charset); + unsigned int retval; + php_iconv_err_t err = + _php_iconv_strpos(&retval, haystack.data(), haystack.size(), + needle.data(), needle.size(), -1, enc.data()); + _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, enc.data()); + if (err == PHP_ICONV_ERR_SUCCESS && retval != (unsigned int)-1) { + return (long)retval; + } + return false; +} + +Variant f_iconv_substr(CStrRef str, int offset, int length /* = 0 */, + CStrRef charset /* = null_string */) { + if (length == 0) { + length = str.size(); + } + + String enc = check_charset(charset); + StringBuffer retval; + php_iconv_err_t err = _php_iconv_substr(retval, str.data(), str.size(), + offset, length, enc.data()); + _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, enc.data()); + if (err == PHP_ICONV_ERR_SUCCESS && !str.empty() && retval.data()) { + return retval.detach(); + } + return false; +} + +String f_ob_iconv_handler(CStrRef contents, int status) { + String mimetype = g_context->getMimeType(); + if (!mimetype.empty()) { + char *out_buffer; + size_t out_len; + php_iconv_err_t err = + php_iconv_string(contents.data(), contents.size(), + &out_buffer, &out_len, + ICONVG(output_encoding), ICONVG(internal_encoding)); + _php_iconv_show_error(err, ICONVG(output_encoding), + ICONVG(internal_encoding)); + if (out_buffer != NULL) { + g_context->setContentType(mimetype, ICONVG(output_encoding)); + return String(out_buffer, out_len, AttachString); + } + } + return contents; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_iconv.h b/src/cpp/ext/ext_iconv.h new file mode 100644 index 0000000000000..e35b4fb183d60 --- /dev/null +++ b/src/cpp/ext/ext_iconv.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_ICONV_H__ +#define __EXT_ICONV_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_iconv_mime_encode(CStrRef field_name, CStrRef field_value, CVarRef preferences = null_variant); +Variant f_iconv_mime_decode(CStrRef encoded_string, int mode = 0, CStrRef charset = null_string); +Variant f_iconv_mime_decode_headers(CStrRef encoded_headers, int mode = 0, CStrRef charset = null_string); +Variant f_iconv_get_encoding(CStrRef type = "all"); +bool f_iconv_set_encoding(CStrRef type, CStrRef charset); +Variant f_iconv(CStrRef in_charset, CStrRef out_charset, CStrRef str); +Variant f_iconv_strlen(CStrRef str, CStrRef charset = null_string); +Variant f_iconv_strpos(CStrRef haystack, CStrRef needle, int offset = 0, CStrRef charset = null_string); +Variant f_iconv_strrpos(CStrRef haystack, CStrRef needle, CStrRef charset = null_string); +Variant f_iconv_substr(CStrRef str, int offset, int length = 0, CStrRef charset = null_string); +String f_ob_iconv_handler(CStrRef contents, int status); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_ICONV_H__ diff --git a/src/cpp/ext/ext_icu.cpp b/src/cpp/ext/ext_icu.cpp new file mode 100644 index 0000000000000..866015c7ef564 --- /dev/null +++ b/src/cpp/ext/ext_icu.cpp @@ -0,0 +1,88 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include "ext_icu.h" +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// Need to have a valid installation of the transliteration data in /lib64. +// Initialization will be taken care of by ext_array which also uses icu. + +class TransliteratorWrapper { +public: + TransliteratorWrapper() { + UnicodeString basicID("Any-Latin ; NFKD; [:nonspacing mark:] Remove"); + UnicodeString basicIDAccent("Any-Latin ; NFKC"); + UErrorCode status = U_ZERO_ERROR; + m_tl = Transliterator::createInstance(basicID, UTRANS_FORWARD, status); + // Note that if the first createInstance fails, the status will cause the + // second createInstance to also fail. + m_tl_accent = + Transliterator::createInstance(basicIDAccent, UTRANS_FORWARD, status); + + if (U_FAILURE(status)) { + Logger::Error(u_errorName(status)); + //m_tl should be NULL if createInstance fails but better safe than sorry. + m_tl = NULL; + m_tl_accent = NULL; + } + } + + void transliterate(UnicodeString& u_str) { + if (m_tl) { + m_tl->transliterate(u_str); + } else { + Logger::Error("Transliterator not initialized."); + } + } + + void transliterate_with_accents(UnicodeString& u_str) { + if (m_tl_accent) { + m_tl_accent->transliterate(u_str); + } else { + Logger::Error("Transliterator not initialized."); + } + } + +private: + Transliterator* m_tl; + Transliterator* m_tl_accent; +}; + +ThreadLocal s_transliterator; + +String f_icu_transliterate(CStrRef str, bool remove_accents) { + UnicodeString u_str = UnicodeString::fromUTF8(str.data()); + if (remove_accents) { + s_transliterator->transliterate(u_str); + } else { + s_transliterator->transliterate_with_accents(u_str); + } + + // Convert the UnicodeString back into a UTF8 String. + int32_t capacity = u_str.countChar32() * sizeof(UChar) + 1; + char* out = (char *)malloc(capacity); + CheckedArrayByteSink bs(out, capacity); + u_str.toUTF8(bs); + + return String(out, AttachString); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_icu.h b/src/cpp/ext/ext_icu.h new file mode 100644 index 0000000000000..c7750200fe801 --- /dev/null +++ b/src/cpp/ext/ext_icu.h @@ -0,0 +1,33 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_ICU_H__ +#define __EXT_ICU_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +String f_icu_transliterate(CStrRef str, bool remove_accents); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_ICU_H__ diff --git a/src/cpp/ext/ext_idn.cpp b/src/cpp/ext/ext_idn.cpp new file mode 100644 index 0000000000000..cf00abbbd7082 --- /dev/null +++ b/src/cpp/ext/ext_idn.cpp @@ -0,0 +1,118 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// NOTE: We rely on "cpp/ext/ext_array.cpp" to call u_init() to +// initialize the ICU library for us during startup. For more info +// see the ICUInitializer class. + +enum { + INTL_IDN_TO_ASCII = 0, + INTL_IDN_TO_UTF8 +}; + +Variant php_intl_idn_to(CStrRef domain, Variant errorcode, int mode) { + long option = 0; + UChar* ustring = NULL; + int ustring_len = 0; + UErrorCode status; + char *converted_utf8 = NULL; + int32_t converted_utf8_len; + UChar* converted = NULL; + int32_t converted_ret_len; + + // Convert the string to UTF-16 + status = U_ZERO_ERROR; + intl_convert_utf8_to_utf16(&ustring, &ustring_len, + (char*)domain.data(), domain.size(), &status); + if (U_FAILURE(status)) { + free(ustring); + errorcode = status; + return false; + } + + // Call the appropriate IDN function + int converted_len = (ustring_len > 1) ? ustring_len : 1; + for (;;) { + UParseError parse_error; + status = U_ZERO_ERROR; + converted = (UChar*)malloc(sizeof(UChar)*converted_len); + // If the malloc failed, bail out + if (!converted) { + free(ustring); + errorcode = U_MEMORY_ALLOCATION_ERROR; + return false; + } + if (mode == INTL_IDN_TO_ASCII) { + converted_ret_len = uidna_IDNToASCII(ustring, + ustring_len, converted, converted_len, + (int32_t)option, &parse_error, &status); + } else { + converted_ret_len = uidna_IDNToUnicode(ustring, + ustring_len, converted, converted_len, + (int32_t)option, &parse_error, &status); + } + if (status != U_BUFFER_OVERFLOW_ERROR) + break; + // If we have a buffer overflow error, try again with a larger buffer + free(converted); + converted = NULL; + converted_len = converted_len * 2; + } + free(ustring); + if (U_FAILURE(status)) { + free(converted); + errorcode = status; + return false; + } + + // Convert the string back to UTF-8 + status = U_ZERO_ERROR; + intl_convert_utf16_to_utf8(&converted_utf8, &converted_utf8_len, + converted, converted_ret_len, &status); + free(converted); + if (U_FAILURE(status)) { + free(converted_utf8); + errorcode = status; + return false; + } + + // Return the string + return String(converted_utf8, converted_utf8_len, AttachString); +} + +Variant f_idn_to_ascii(CStrRef domain, Variant errorcode /* = null */) { + return php_intl_idn_to(domain, ref(errorcode), INTL_IDN_TO_ASCII); +} + +Variant f_idn_to_unicode(CStrRef domain, Variant errorcode /* = null */) { + return php_intl_idn_to(domain, ref(errorcode), INTL_IDN_TO_UTF8); +} + +Variant f_idn_to_utf8(CStrRef domain, Variant errorcode /* = null */) { + return php_intl_idn_to(domain, ref(errorcode), INTL_IDN_TO_UTF8); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_idn.h b/src/cpp/ext/ext_idn.h new file mode 100644 index 0000000000000..21a9eafd7076f --- /dev/null +++ b/src/cpp/ext/ext_idn.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_IDN_H__ +#define __EXT_IDN_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_idn_to_ascii(CStrRef domain, Variant errorcode = null); +Variant f_idn_to_unicode(CStrRef domain, Variant errorcode = null); +Variant f_idn_to_utf8(CStrRef domain, Variant errorcode = null); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_IDN_H__ diff --git a/src/cpp/ext/ext_image.cpp b/src/cpp/ext/ext_image.cpp new file mode 100644 index 0000000000000..f60929fd99215 --- /dev/null +++ b/src/cpp/ext/ext_image.cpp @@ -0,0 +1,7574 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include +#include +#include +#include /* 1 Tiny font */ +#include /* 2 Small font */ +#include /* 3 Medium bold font */ +#include /* 4 Large font */ +#include /* 5 Giant font */ +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Image::~Image() { + if (m_gdImage) { + gdImageDestroy(m_gdImage); + m_gdImage = NULL; + } +} + +#define CHECK_BUFFER(begin, end, size) \ +do { \ + if (((char*)end) - ((char*)(begin)) < (size)) { \ + Logger::Warning("%s/%d: Buffer overrun (%p, %p, %d)", \ + __FUNCTION__, __LINE__, begin, end, size); \ + return; \ + } \ +} while (0) + +#define CHECK_BUFFER_R(begin, end, size, retcod) \ +do { \ + if (((char*)(end)) - ((char*)(begin)) < (size)) { \ + Logger::Warning("%s/%d: Buffer overrun (%p, %p, %d, %d)", \ + __FUNCTION__, __LINE__, begin, end, size, retcod); \ + return retcod; \ + } \ +} while (0) + +typedef enum { + IMAGE_FILETYPE_UNKNOWN=0, + IMAGE_FILETYPE_GIF=1, + IMAGE_FILETYPE_JPEG, + IMAGE_FILETYPE_PNG, + IMAGE_FILETYPE_SWF, + IMAGE_FILETYPE_PSD, + IMAGE_FILETYPE_BMP, + IMAGE_FILETYPE_TIFF_II, /* intel */ + IMAGE_FILETYPE_TIFF_MM, /* motorola */ + IMAGE_FILETYPE_JPC, + IMAGE_FILETYPE_JP2, + IMAGE_FILETYPE_JPX, + IMAGE_FILETYPE_JB2, + IMAGE_FILETYPE_SWC, + IMAGE_FILETYPE_IFF, + IMAGE_FILETYPE_WBMP, + /* IMAGE_FILETYPE_JPEG2000 is a userland alias for IMAGE_FILETYPE_JPC */ + IMAGE_FILETYPE_XBM +} image_filetype; + + +// PHP extension STANDARD: image.c +/* file type markers */ +static const char php_sig_gif[3] = {'G', 'I', 'F'}; +static const char php_sig_psd[4] = {'8', 'B', 'P', 'S'}; +static const char php_sig_bmp[2] = {'B', 'M'}; +static const char php_sig_swf[3] = {'F', 'W', 'S'}; +static const char php_sig_swc[3] = {'C', 'W', 'S'}; +static const char php_sig_jpg[3] = {(char) 0xff, (char) 0xd8, (char) 0xff}; +static const char php_sig_png[8] = + {(char) 0x89, (char) 0x50, (char) 0x4e, (char) 0x47, + (char) 0x0d, (char) 0x0a, (char) 0x1a, (char) 0x0a}; +static const char php_sig_tif_ii[4] = {'I','I', (char)0x2A, (char)0x00}; +static const char php_sig_tif_mm[4] = {'M','M', (char)0x00, (char)0x2A}; +static const char php_sig_jpc[3] = {(char)0xff, (char)0x4f, (char)0xff}; +static const char php_sig_jp2[12] = + {(char)0x00, (char)0x00, (char)0x00, (char)0x0c, + (char)0x6a, (char)0x50, (char)0x20, (char)0x20, + (char)0x0d, (char)0x0a, (char)0x87, (char)0x0a}; +static const char php_sig_iff[4] = {'F','O','R','M'}; + +static struct gfxinfo *php_handle_gif(CObjRef stream) { + struct gfxinfo *result = NULL; + String dim; + const unsigned char *s; + + if (f_fseek(stream, 3, SEEK_CUR)) return NULL; + dim = f_fread(stream, 5); + if (dim.length() != 5) return NULL; + s = (unsigned char *)dim.c_str(); + result = (struct gfxinfo *)calloc(1, sizeof(struct gfxinfo)); + result->width = (unsigned int)s[0] | (((unsigned int)s[1])<<8); + result->height = (unsigned int)s[2] | (((unsigned int)s[3])<<8); + result->bits = s[4]&0x80 ? ((((unsigned int)s[4])&0x07) + 1) : 0; + result->channels = 3; /* allways */ + return result; +} + +static struct gfxinfo *php_handle_psd (CObjRef stream) { + struct gfxinfo *result = NULL; + String dim; + const unsigned char *s; + + if (f_fseek(stream, 11, SEEK_CUR)) return NULL; + + dim = f_fread(stream, 8); + if (dim.length() != 8) return NULL; + s = (unsigned char *)dim.c_str(); + result = (struct gfxinfo *)calloc(1, sizeof(struct gfxinfo)); + result->height = (((unsigned int)s[0]) << 24) + + (((unsigned int)s[1]) << 16) + + (((unsigned int)s[2]) << 8) + + ((unsigned int)s[3]); + result->width = (((unsigned int)s[4]) << 24) + + (((unsigned int)s[5]) << 16) + + (((unsigned int)s[6]) << 8) + + ((unsigned int)s[7]); + return result; +} + +static struct gfxinfo *php_handle_bmp (CObjRef stream) { + struct gfxinfo *result = NULL; + String dim; + const unsigned char *s; + int size; + + if (f_fseek(stream, 11, SEEK_CUR)) return NULL; + + dim = f_fread(stream, 16); + if (dim.length() != 16) return NULL; + s = (unsigned char *)dim.c_str(); + + size = (((unsigned int)s[3]) << 24) + + (((unsigned int)s[2]) << 16) + + (((unsigned int)s[1]) << 8) + + ((unsigned int)s[0]); + if (size == 12) { + result = (struct gfxinfo *)calloc (1, sizeof(struct gfxinfo)); + result->width = (((unsigned int)s[5]) << 8) + ((unsigned int)s[4]); + result->height = (((unsigned int)s[7]) << 8) + ((unsigned int)s[6]); + result->bits = ((unsigned int)s[11]); + } else if (size > 12 && (size <= 64 || size == 108)) { + result = (struct gfxinfo *)calloc (1, sizeof(struct gfxinfo)); + result->width = (((unsigned int)s[7]) << 24) + + (((unsigned int)s[6]) << 16) + + (((unsigned int)s[5]) << 8) + + ((unsigned int)s[4]); + result->height = (((unsigned int)s[11]) << 24) + + (((unsigned int)s[10]) << 16) + + (((unsigned int)s[9]) << 8) + + ((unsigned int)s[8]); + result->bits = (((unsigned int)s[15]) << 8) + + ((unsigned int)s[14]); + } else { + return NULL; + } + + return result; +} + +static unsigned long int php_swf_get_bits(unsigned char* buffer, + unsigned int pos, + unsigned int count) { + unsigned int loop; + unsigned long int result = 0; + + for (loop = pos; loop < pos + count; loop++) + { + result = result + + ((((buffer[loop / 8]) >> (7 - (loop % 8))) & 0x01) << + (count - (loop - pos) - 1)); + } + return result; +} + +#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB) +static struct gfxinfo *php_handle_swc(CObjRef stream) { + struct gfxinfo *result = NULL; + + long bits; + String a; + unsigned long len=64, szlength; + int factor=1,maxfactor=16; + int slength, status=0; + unsigned char *b, *buf=NULL; + String bufz; + String tmp; + + b = (unsigned char *)calloc (1, len + 1); + + if (f_fseek(stream, 5, SEEK_CUR)) return NULL; + + a = toString(f_fread(stream, 64)); + if (a.length() != 64) return NULL; + + if (uncompress((Bytef*)b, &len, (const Bytef*)a.c_str(), 64) != Z_OK) { + /* failed to decompress the file, will try reading the rest of the file */ + if (f_fseek(stream, 8, SEEK_SET)) return NULL; + + while (!(tmp = f_fread(stream, 8192)).empty()) { + bufz += tmp; + } + slength = bufz.length(); + /* + * zlib::uncompress() wants to know the output data length + * if none was given as a parameter + * we try from input length * 2 up to input length * 2^8 + * doubling it whenever it wasn't big enough + * that should be eneugh for all real life cases + */ + + do { + szlength=slength*(1<width = (php_swf_get_bits (b, 5 + bits, bits) - + php_swf_get_bits (b, 5, bits)) / 20; + result->height = (php_swf_get_bits (b, 5 + (3 * bits), bits) - + php_swf_get_bits (b, 5 + (2 * bits), bits)) / 20; + } else { + result = NULL; + } + + free (b); + return result; +} +#endif + +static struct gfxinfo *php_handle_swf(CObjRef stream) { + struct gfxinfo *result = NULL; + long bits; + unsigned char *a; + + if (f_fseek(stream, 5, SEEK_CUR)) return NULL; + + String str = toString(f_fread(stream, 32)); + if (str.length() != 32) return NULL; + a = (unsigned char *)str.c_str(); + result = (struct gfxinfo *)calloc (1, sizeof (struct gfxinfo)); + bits = php_swf_get_bits (a, 0, 5); + result->width = (php_swf_get_bits (a, 5 + bits, bits) - + php_swf_get_bits (a, 5, bits)) / 20; + result->height = (php_swf_get_bits (a, 5 + (3 * bits), bits) - + php_swf_get_bits (a, 5 + (2 * bits), bits)) / 20; + result->bits = 0; + result->channels = 0; + return result; +} + +static struct gfxinfo *php_handle_png(CObjRef stream) { + struct gfxinfo *result = NULL; + String dim; + const unsigned char *s; + /* Width: 4 bytes + * Height: 4 bytes + * Bit depth: 1 byte + * Color type: 1 byte + * Compression method: 1 byte + * Filter method: 1 byte + * Interlace method: 1 byte + */ + + if (f_fseek(stream, 8, SEEK_CUR)) return NULL; + + dim = f_fread(stream, 9); + if (dim.length() < 9) return NULL; + + s = (unsigned char *)dim.c_str(); + result = (struct gfxinfo *)calloc(1, sizeof(struct gfxinfo)); + result->width = (((unsigned int)s[0]) << 24) + + (((unsigned int)s[1]) << 16) + + (((unsigned int)s[2]) << 8) + + ((unsigned int)s[3]); + result->height = (((unsigned int)s[4]) << 24) + + (((unsigned int)s[5]) << 16) + + (((unsigned int)s[6]) << 8) + + ((unsigned int)s[7]); + result->bits = (unsigned int)s[8]; + return result; +} + +/* routines to handle JPEG data */ + +/* some defines for the different JPEG block types */ +#define M_SOF0 0xC0 /* Start Of Frame N */ +#define M_SOF1 0xC1 /* N indicates which compression process */ +#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ +#define M_SOF3 0xC3 +#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ +#define M_SOF6 0xC6 +#define M_SOF7 0xC7 +#define M_SOF9 0xC9 +#define M_SOF10 0xCA +#define M_SOF11 0xCB +#define M_SOF13 0xCD +#define M_SOF14 0xCE +#define M_SOF15 0xCF +#define M_SOI 0xD8 +#define M_EOI 0xD9 /* End Of Image (end of datastream) */ +#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ +#define M_APP0 0xe0 +#define M_APP1 0xe1 +#define M_APP2 0xe2 +#define M_APP3 0xe3 +#define M_APP4 0xe4 +#define M_APP5 0xe5 +#define M_APP6 0xe6 +#define M_APP7 0xe7 +#define M_APP8 0xe8 +#define M_APP9 0xe9 +#define M_APP10 0xea +#define M_APP11 0xeb +#define M_APP12 0xec +#define M_APP13 0xed +#define M_APP14 0xee +#define M_APP15 0xef +#define M_COM 0xFE /* COMment */ + +#define M_PSEUDO 0xFFD8 /* pseudo marker for start of image(byte 0) */ + +#define M_EXIF 0xE1 /* Exif Attribute Information */ + +static unsigned short php_read2(CObjRef stream) { + unsigned char *a; + String str = toString(f_fread(stream, 2)); + /* just return 0 if we hit the end-of-file */ + if (str.length() != 2) return 0; + a = (unsigned char *)str.c_str(); + return (((unsigned short)a[0]) << 8) + ((unsigned short)a[1]); +} + +static unsigned int php_next_marker(CObjRef stream, int last_marker, + int comment_correction, int ff_read) { + int a=0, marker; + + // get marker byte, swallowing possible padding + if (last_marker==M_COM && comment_correction) { + // some software does not count the length bytes of COM section + // one company doing so is very much envolved in JPEG... so we accept too + // by the way: some of those companies changed their code now... + comment_correction = 2; + } else { + last_marker = 0; + comment_correction = 0; + } + if (ff_read) { + a = 1; /* already read 0xff in filetype detection */ + } + do { + File *file = stream.getTyped(); + if ((marker = file->getc()) == EOF) + { + return M_EOI;/* we hit EOF */ + } + if (last_marker==M_COM && comment_correction>0) + { + if (marker != 0xFF) + { + marker = 0xff; + comment_correction--; + } else { + last_marker = M_PSEUDO; /* stop skipping non 0xff for M_COM */ + } + } + if (++a > 25) + { + /* who knows the maxim amount of 0xff? though 7 */ + /* but found other implementations */ + return M_EOI; + } + } while (marker == 0xff); + if (a < 2) + { + return M_EOI; /* at least one 0xff is needed before marker code */ + } + if ( last_marker==M_COM && comment_correction) + { + return M_EOI; /* ah illegal: char after COM section not 0xFF */ + } + return (unsigned int)marker; +} + +static int php_skip_variable(CObjRef stream) { + off_t length = (unsigned int)php_read2(stream); + + if (length < 2) { + return 0; + } + length = length - 2; + f_fseek(stream, (long)length, SEEK_CUR); + return 1; +} + +static int php_read_APP(CObjRef stream, unsigned int marker, Variant info) { + unsigned short length; + Variant buffer; + unsigned char markername[16]; + + length = php_read2(stream); + if (length < 2) { + return 0; + } + length -= 2; /* length includes itself */ + + buffer = f_fread(stream, (long)length); + if (same(buffer, "")) { + return 0; + } + + snprintf((char*)markername, sizeof(markername), "APP%d", marker - M_APP0); + + if (!info.toArray().exists((const char *)markername)) { + /* XXX we onyl catch the 1st tag of it's kind! */ + info.set(String((char*)markername, CopyString), buffer); + } + + return 1; +} + +static struct gfxinfo *php_handle_jpeg(CObjRef stream, Variant info) { + struct gfxinfo *result = NULL; + unsigned int marker = M_PSEUDO; + unsigned short length, ff_read=1; + + for (;;) { + marker = php_next_marker(stream, marker, 1, ff_read); + ff_read = 0; + switch (marker) { + case M_SOF0: + case M_SOF1: + case M_SOF2: + case M_SOF3: + case M_SOF5: + case M_SOF6: + case M_SOF7: + case M_SOF9: + case M_SOF10: + case M_SOF11: + case M_SOF13: + case M_SOF14: + case M_SOF15: + if (result == NULL) { + File *file = stream.getTyped(); + /* handle SOFn block */ + result = (struct gfxinfo *)calloc(1, sizeof(struct gfxinfo)); + length = php_read2(stream); + result->bits = file->getc(); + result->height = php_read2(stream); + result->width = php_read2(stream); + result->channels = file->getc(); + if (info.isNull() || length < 8) { + /* if we don't want an extanded info -> return */ + return result; + } + if (f_fseek(stream, length - 8, SEEK_CUR)) { + /* file error after info */ + return result; + } + } else { + if (!php_skip_variable(stream)) { + return result; + } + } + break; + + case M_APP0: + case M_APP1: + case M_APP2: + case M_APP3: + case M_APP4: + case M_APP5: + case M_APP6: + case M_APP7: + case M_APP8: + case M_APP9: + case M_APP10: + case M_APP11: + case M_APP12: + case M_APP13: + case M_APP14: + case M_APP15: + if (!info.isNull()) { + if (!php_read_APP(stream, marker, info)) { + /* read all the app markes... */ + return result; + } + } else { + if (!php_skip_variable(stream)) { + return result; + } + } + break; + + case M_SOS: + case M_EOI: + /* we're about to hit image data, or are at EOF. stop processing. */ + return result; + + default: + if (!php_skip_variable(stream)) { + /* anything else isn't interesting */ + return result; + } + break; + } + } + + return result; /* perhaps image broken -> no info but size */ +} + +static unsigned short php_read4(CObjRef stream) { + unsigned char *a; + String str = toString(f_fread(stream, 4)); + /* just return 0 if we hit the end-of-file */ + if (str.length() != 4) return 0; + a = (unsigned char *)str.c_str(); + return (((unsigned int)a[0]) << 24) + + (((unsigned int)a[1]) << 16) + + (((unsigned int)a[2]) << 8) + + (((unsigned int)a[3])); +} + +/* JPEG 2000 Marker Codes */ +#define JPEG2000_MARKER_PREFIX 0xFF /* All marker codes start with this */ +#define JPEG2000_MARKER_SOC 0x4F /* Start of Codestream */ +#define JPEG2000_MARKER_SOT 0x90 /* Start of Tile part */ +#define JPEG2000_MARKER_SOD 0x93 /* Start of Data */ +#define JPEG2000_MARKER_EOC 0xD9 /* End of Codestream */ +#define JPEG2000_MARKER_SIZ 0x51 /* Image and tile size */ +#define JPEG2000_MARKER_COD 0x52 /* Coding style default */ +#define JPEG2000_MARKER_COC 0x53 /* Coding style component */ +#define JPEG2000_MARKER_RGN 0x5E /* Region of interest */ +#define JPEG2000_MARKER_QCD 0x5C /* Quantization default */ +#define JPEG2000_MARKER_QCC 0x5D /* Quantization component */ +#define JPEG2000_MARKER_POC 0x5F /* Progression order change */ +#define JPEG2000_MARKER_TLM 0x55 /* Tile-part lengths */ +#define JPEG2000_MARKER_PLM 0x57 /* Packet length, main header */ +#define JPEG2000_MARKER_PLT 0x58 /* Packet length, tile-part header */ +#define JPEG2000_MARKER_PPM 0x60 /* Packed packet headers, main header */ +#define JPEG2000_MARKER_PPT 0x61 /* Packed packet headers, tile part header */ +#define JPEG2000_MARKER_SOP 0x91 /* Start of packet */ +#define JPEG2000_MARKER_EPH 0x92 /* End of packet header */ +#define JPEG2000_MARKER_CRG 0x63 /* Component registration */ +#define JPEG2000_MARKER_COM 0x64 /* Comment */ + +/* Main loop to parse JPEG2000 raw codestream structure */ +static struct gfxinfo *php_handle_jpc(CObjRef stream) { + struct gfxinfo *result = NULL; + unsigned short dummy_short; + int highest_bit_depth, bit_depth; + unsigned char first_marker_id; + unsigned int i; + + /* JPEG 2000 components can be vastly different from one another. + Each component can be sampled at a different resolution, use + a different colour space, have a seperate colour depth, and + be compressed totally differently! This makes giving a single + "bit depth" answer somewhat problematic. For this implementation + we'll use the highest depth encountered. */ + + /* Get the single byte that remains after the file type indentification */ + File *file = stream.getTyped(); + first_marker_id = file->getc(); + + /* Ensure that this marker is SIZ (as is mandated by the standard) */ + if (first_marker_id != JPEG2000_MARKER_SIZ) { + Logger::Warning("JPEG2000 codestream corrupt(Expected SIZ marker " + "not found after SOC)"); + return NULL; + } + + result = (struct gfxinfo *)calloc(1, sizeof(struct gfxinfo)); + + dummy_short = php_read2(stream); /* Lsiz */ + dummy_short = php_read2(stream); /* Rsiz */ + result->width = php_read4(stream); /* Xsiz */ + result->height = php_read4(stream); /* Ysiz */ + +#if MBO_0 + php_read4(stream); /* XOsiz */ + php_read4(stream); /* YOsiz */ + php_read4(stream); /* XTsiz */ + php_read4(stream); /* YTsiz */ + php_read4(stream); /* XTOsiz */ + php_read4(stream); /* YTOsiz */ +#else + if (f_fseek(stream, 24, SEEK_CUR)) { + free(result); + return NULL; + } +#endif + + result->channels = php_read2(stream); /* Csiz */ + if (result->channels < 0 || result->channels > 256) { + free(result); + return NULL; + } + + /* Collect bit depth info */ + highest_bit_depth = bit_depth = 0; + for (i = 0; i < result->channels; i++) { + bit_depth = file->getc(); /* Ssiz[i] */ + bit_depth++; + if (bit_depth > highest_bit_depth) { + highest_bit_depth = bit_depth; + } + + file->getc(); /* XRsiz[i] */ + file->getc(); /* YRsiz[i] */ + } + + result->bits = highest_bit_depth; + + return result; +} + +/* main loop to parse JPEG 2000 JP2 wrapper format structure */ +static struct gfxinfo *php_handle_jp2(CObjRef stream) { + struct gfxinfo *result = NULL; + unsigned int box_length; + unsigned int box_type; + char jp2c_box_id[] = {(char)0x6a, (char)0x70, (char)0x32, (char)0x63}; + + /* JP2 is a wrapper format for JPEG 2000. Data is contained within "boxes". + Boxes themselves can be contained within "super-boxes". Super-Boxes can + contain super-boxes which provides us with a hierarchical storage system. + + It is valid for a JP2 file to contain multiple individual codestreams. + We'll just look for the first codestream at the root of the box structure + and handle that. + */ + + for (;;) + { + box_length = php_read4(stream); /* LBox */ + /* TBox */ + String str = toString(f_fread(stream, sizeof(box_type))); + if (str.length() != sizeof(box_type)) { + /* Use this as a general "out of stream" error */ + break; + } + memcpy(&box_type, str.c_str(), sizeof(box_type)); + + if (box_length == 1) { + /* We won't handle XLBoxes */ + return NULL; + } + + if (!memcmp(&box_type, jp2c_box_id, 4)) + { + /* Skip the first 3 bytes to emulate the file type examination */ + f_fseek(stream, 3, SEEK_CUR); + + result = php_handle_jpc(stream); + break; + } + + /* Stop if this was the last box */ + if ((int)box_length <= 0) { + break; + } + + /* Skip over LBox (Which includes both TBox and LBox itself */ + if (f_fseek(stream, box_length - 8, SEEK_CUR)) { + break; + } + } + + if (result == NULL) { + Logger::Warning("JP2 file has no codestreams at root level"); + } + + return result; +} + +/* tiff constants */ +static const int php_tiff_bytes_per_format[] = + {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8}; + +static int get_php_tiff_bytes_per_format(int format) { + int size = sizeof(php_tiff_bytes_per_format)/sizeof(int); + if (format >= size) { + Logger::Warning("Invalid format %d", format); + format = 0; + } + return php_tiff_bytes_per_format[format]; +} + +/* uncompressed only */ +#define TAG_IMAGEWIDTH 0x0100 +#define TAG_IMAGEHEIGHT 0x0101 +/* compressed images only */ +#define TAG_COMP_IMAGEWIDTH 0xA002 +#define TAG_COMP_IMAGEHEIGHT 0xA003 + +#define TAG_FMT_BYTE 1 +#define TAG_FMT_STRING 2 +#define TAG_FMT_USHORT 3 +#define TAG_FMT_ULONG 4 +#define TAG_FMT_URATIONAL 5 +#define TAG_FMT_SBYTE 6 +#define TAG_FMT_UNDEFINED 7 +#define TAG_FMT_SSHORT 8 +#define TAG_FMT_SLONG 9 +#define TAG_FMT_SRATIONAL 10 +#define TAG_FMT_SINGLE 11 +#define TAG_FMT_DOUBLE 12 + +/* Convert a 16 bit unsigned value from file's native byte order */ +static int php_ifd_get16u(void *Short, int motorola_intel) { + if (motorola_intel) { + return (((unsigned char *)Short)[0] << 8) | ((unsigned char *)Short)[1]; + } else { + return (((unsigned char *)Short)[1] << 8) | ((unsigned char *)Short)[0]; + } +} + +/* Convert a 16 bit signed value from file's native byte order */ +static signed short php_ifd_get16s(void *Short, int motorola_intel) { + return (signed short)php_ifd_get16u(Short, motorola_intel); +} + +/* Convert a 32 bit signed value from file's native byte order */ +static int php_ifd_get32s(void *Long, int motorola_intel) { + if (motorola_intel) { + return ((( char *)Long)[0] << 24) | + (((unsigned char *)Long)[1] << 16) | + (((unsigned char *)Long)[2] << 8) | + (((unsigned char *)Long)[3] << 0); + } else { + return ((( char *)Long)[3] << 24) | + (((unsigned char *)Long)[2] << 16) | + (((unsigned char *)Long)[1] << 8) | + (((unsigned char *)Long)[0] << 0); + } +} + +/* Convert a 32 bit unsigned value from file's native byte order */ +static unsigned php_ifd_get32u(void *Long, int motorola_intel) { + return (unsigned)php_ifd_get32s(Long, motorola_intel) & 0xffffffff; +} + +/* main loop to parse TIFF structure */ +static struct gfxinfo *php_handle_tiff(CObjRef stream, int motorola_intel) { + struct gfxinfo *result = NULL; + int i, num_entries; + unsigned char *dir_entry; + size_t ifd_size, dir_size, entry_value, width=0, height=0, ifd_addr; + int entry_tag , entry_type; + String ifd_data; + String ifd_data2; + String ifd_ptr; + + ifd_ptr = stream.getTyped()->read(4); + if (ifd_ptr.length() != 4) return NULL; + ifd_addr = php_ifd_get32u((void*)ifd_ptr.c_str(), motorola_intel); + if (f_fseek(stream, ifd_addr-8, SEEK_CUR)) return NULL; + ifd_size = 2; + ifd_data = f_fread(stream, 2); + if (ifd_data.length() != 2) return NULL; + num_entries = php_ifd_get16u((void*)ifd_data.c_str(), motorola_intel); + dir_size = 2/*num dir entries*/ +12/*length of entry*/* + num_entries + + 4/* offset to next ifd (points to thumbnail or NULL)*/; + ifd_size = dir_size; + ifd_data2 = f_fread(stream, dir_size-2); + if ((size_t)ifd_data2.length() != dir_size-2) return NULL; + ifd_data += ifd_data2; + /* now we have the directory we can look how long it should be */ + ifd_size = dir_size; + for(i=0;iheight = height; + result->width = width; + result->bits = 0; + result->channels = 0; + return result; + } + return NULL; +} + +static struct gfxinfo *php_handle_iff(CObjRef stream) { + struct gfxinfo * result; + String str; + char *a; + int chunkId; + int size; + short width, height, bits; + + str = f_fread(stream, 8); + if (str.length() != 8) return NULL; + a = (char *)str.c_str(); + if (strncmp(a+4, "ILBM", 4) && strncmp(a+4, "PBM ", 4)) { + return NULL; + } + + /* loop chunks to find BMHD chunk */ + do { + str = f_fread(stream, 8); + if (str.length() != 8) return NULL; + a = (char *)str.c_str(); + chunkId = php_ifd_get32s(a+0, 1); + size = php_ifd_get32s(a+4, 1); + if (size < 0) return NULL; + if ((size & 1) == 1) { + size++; + } + if (chunkId == 0x424d4844) { /* BMHD chunk */ + if (size < 9) return NULL; + str = f_fread(stream, 9); + if (str.length() != 9) return NULL; + a = (char *)str.c_str(); + width = php_ifd_get16s(a+0, 1); + height = php_ifd_get16s(a+2, 1); + bits = a[8] & 0xff; + if (width > 0 && height > 0 && bits > 0 && bits < 33) { + result = (struct gfxinfo *)calloc(1, sizeof(struct gfxinfo)); + result->width = width; + result->height = height; + result->bits = bits; + result->channels = 0; + return result; + } + } else { + if (f_fseek(stream, size, SEEK_CUR)) return NULL; + } + } while (1); +} + +/* + * int WBMP file format type + * byte Header Type + * byte Extended Header + * byte Header Data (type 00 = multibyte) + * byte Header Data (type 11 = name/pairs) + * int Number of columns + * int Number of rows + */ +static int php_get_wbmp(CObjRef stream, struct gfxinfo **result, int check) { + int i, width = 0, height = 0; + + if (!f_rewind(stream)) { + return 0; + } + + File *file = stream.getTyped(); + /* get type */ + if (file->getc() != 0) { + return 0; + } + + /* skip header */ + do { + i = file->getc(); + if (i < 0) { + return 0; + } + } while (i & 0x80); + + /* get width */ + do { + i = file->getc(); + if (i < 0) { + return 0; + } + width = (width << 7) | (i & 0x7f); + } while (i & 0x80); + + /* get height */ + do { + i = file->getc(); + if (i < 0) { + return 0; + } + height = (height << 7) | (i & 0x7f); + } while (i & 0x80); + + // maximum valid sizes for wbmp (although 127x127 may be a + // more accurate one) + if (!height || !width || height > 2048 || width > 2048) { + return 0; + } + + if (!check) { + (*result)->width = width; + (*result)->height = height; + } + + return IMAGE_FILETYPE_WBMP; +} + +static struct gfxinfo *php_handle_wbmp(CObjRef stream) { + struct gfxinfo *result = + (struct gfxinfo *)calloc(1, sizeof(struct gfxinfo)); + + if (!php_get_wbmp(stream, &result, 0)) { + free(result); + return NULL; + } + + return result; +} + +static int php_get_xbm(CObjRef stream, struct gfxinfo **result) { + String fline; + char *iname; + char *type; + int value; + unsigned int width = 0, height = 0; + + if (result) { + *result = NULL; + } + if (!f_rewind(stream)) { + return 0; + } + while (!(fline=f_fgets(stream, 0)).empty()) { + iname = (char *)malloc(fline.size() + 1); + if (sscanf(fline.c_str(), "#define %s %d", iname, &value) == 2) { + if (!(type = strrchr(iname, '_'))) { + type = iname; + } else { + type++; + } + + if (!strcmp("width", type)) { + width = (unsigned int)value; + if (height) { + free(iname); + break; + } + } + if (!strcmp("height", type)) { + height = (unsigned int)value; + if (width) { + free(iname); + break; + } + } + } + free(iname); + } + + if (width && height) { + if (result) { + *result = (struct gfxinfo *)calloc(1, sizeof(struct gfxinfo)); + (*result)->width = width; + (*result)->height = height; + } + return IMAGE_FILETYPE_XBM; + } + + return 0; +} + +static struct gfxinfo *php_handle_xbm(CObjRef stream) { + struct gfxinfo *result; + php_get_xbm(stream, &result); + return result; +} + +/* Convert internal image_type to mime type */ +static char *php_image_type_to_mime_type(int image_type) { + switch( image_type) { + case IMAGE_FILETYPE_GIF: + return "image/gif"; + case IMAGE_FILETYPE_JPEG: + return "image/jpeg"; + case IMAGE_FILETYPE_PNG: + return "image/png"; + case IMAGE_FILETYPE_SWF: + case IMAGE_FILETYPE_SWC: + return "application/x-shockwave-flash"; + case IMAGE_FILETYPE_PSD: + return "image/psd"; + case IMAGE_FILETYPE_BMP: + return "image/bmp"; + case IMAGE_FILETYPE_TIFF_II: + case IMAGE_FILETYPE_TIFF_MM: + return "image/tiff"; + case IMAGE_FILETYPE_IFF: + return "image/iff"; + case IMAGE_FILETYPE_WBMP: + return "image/vnd.wap.wbmp"; + case IMAGE_FILETYPE_JPC: + return "application/octet-stream"; + case IMAGE_FILETYPE_JP2: + return "image/jp2"; + case IMAGE_FILETYPE_XBM: + return "image/xbm"; + default: + case IMAGE_FILETYPE_UNKNOWN: + return "application/octet-stream"; /* suppose binary format */ + } +} + +/* detect filetype from first bytes */ +static int php_getimagetype(CObjRef stream) { + File *file = stream.getTyped(); + String fileType; + String data; + + fileType = file->read(3); + if (fileType.length() != 3) { + Logger::Info("Read error!"); + return IMAGE_FILETYPE_UNKNOWN; + } + + /* BYTES READ: 3 */ + if (!memcmp(fileType.c_str(), php_sig_gif, 3)) { + return IMAGE_FILETYPE_GIF; + } else if (!memcmp(fileType.c_str(), php_sig_jpg, 3)) { + return IMAGE_FILETYPE_JPEG; + } else if (!memcmp(fileType.c_str(), php_sig_png, 3)) { + data = file->read(5); + if (data.length() != 5) { + Logger::Info("Read error!"); + return IMAGE_FILETYPE_UNKNOWN; + } + if (!memcmp((fileType + data).c_str(), php_sig_png, 8)) { + return IMAGE_FILETYPE_PNG; + } else { + Logger::Warning("PNG file corrupted by ASCII conversion"); + return IMAGE_FILETYPE_UNKNOWN; + } + } else if (!memcmp(fileType.c_str(), php_sig_swf, 3)) { + return IMAGE_FILETYPE_SWF; + } else if (!memcmp(fileType.c_str(), php_sig_swc, 3)) { + return IMAGE_FILETYPE_SWC; + } else if (!memcmp(fileType.c_str(), php_sig_psd, 3)) { + return IMAGE_FILETYPE_PSD; + } else if (!memcmp(fileType.c_str(), php_sig_bmp, 2)) { + return IMAGE_FILETYPE_BMP; + } else if (!memcmp(fileType.c_str(), php_sig_jpc, 3)) { + return IMAGE_FILETYPE_JPC; + } + + data = file->read(1); + if (data.length() != 1) { + Logger::Info("Read error!"); + return IMAGE_FILETYPE_UNKNOWN; + } + + /* BYTES READ: 4 */ + fileType += data; + if (!memcmp(fileType.c_str(), php_sig_tif_ii, 4)) { + return IMAGE_FILETYPE_TIFF_II; + } else if (!memcmp(fileType.c_str(), php_sig_tif_mm, 4)) { + return IMAGE_FILETYPE_TIFF_MM; + } + if (!memcmp(fileType.c_str(), php_sig_iff, 4)) { + return IMAGE_FILETYPE_IFF; + } + + data = file->read(8); + if (data.length() != 8) { + Logger::Info("Read error!"); + return IMAGE_FILETYPE_UNKNOWN; + } + + /* BYTES READ: 12 */ + fileType += data; + if (!memcmp(fileType.c_str(), php_sig_jp2, 12)) { + return IMAGE_FILETYPE_JP2; + } + + /* AFTER ALL ABOVE FAILED */ + if (php_get_wbmp(stream, NULL, 1)) { + return IMAGE_FILETYPE_WBMP; + } + if (php_get_xbm(stream, NULL)) { + return IMAGE_FILETYPE_XBM; + } + return IMAGE_FILETYPE_UNKNOWN; +} + +String f_image_type_to_mime_type(int imagetype) { + switch( imagetype) { + case IMAGE_FILETYPE_GIF: + return "image/gif"; + case IMAGE_FILETYPE_JPEG: + return "image/jpeg"; + case IMAGE_FILETYPE_PNG: + return "image/png"; + case IMAGE_FILETYPE_SWF: + case IMAGE_FILETYPE_SWC: + return "application/x-shockwave-flash"; + case IMAGE_FILETYPE_PSD: + return "image/psd"; + case IMAGE_FILETYPE_BMP: + return "image/bmp"; + case IMAGE_FILETYPE_TIFF_II: + case IMAGE_FILETYPE_TIFF_MM: + return "image/tiff"; + case IMAGE_FILETYPE_IFF: + return "image/iff"; + case IMAGE_FILETYPE_WBMP: + return "image/vnd.wap.wbmp"; + case IMAGE_FILETYPE_JPC: + return "application/octet-stream"; + case IMAGE_FILETYPE_JP2: + return "image/jp2"; + case IMAGE_FILETYPE_XBM: + return "image/xbm"; + default: + case IMAGE_FILETYPE_UNKNOWN: + return "application/octet-stream"; /* suppose binary format */ + } +} + +String f_image_type_to_extension(int imagetype, + bool include_dot /* = true */) { + String ret; + switch (imagetype) { + case IMAGE_FILETYPE_GIF: + return include_dot ? String(".gif") : String("gif"); + case IMAGE_FILETYPE_JPEG: + return include_dot ? String(".jpeg") : String("jpeg"); + case IMAGE_FILETYPE_PNG: + return include_dot ? String(".png") : String("png"); + case IMAGE_FILETYPE_SWF: + case IMAGE_FILETYPE_SWC: + return include_dot ? String(".swf") : String("swf"); + case IMAGE_FILETYPE_PSD: + return include_dot ? String(".psd") : String("psd"); + case IMAGE_FILETYPE_BMP: + case IMAGE_FILETYPE_WBMP: + return include_dot ? String(".bmp") : String("bmp"); + case IMAGE_FILETYPE_TIFF_II: + case IMAGE_FILETYPE_TIFF_MM: + return include_dot ? String(".tiff") : String("tiff"); + case IMAGE_FILETYPE_IFF: + return include_dot ? String(".iff") : String("iff"); + case IMAGE_FILETYPE_JPC: + return include_dot ? String(".jpc") : String("jpc"); + case IMAGE_FILETYPE_JP2: + return include_dot ? String(".jp2") : String("jp2"); + case IMAGE_FILETYPE_JPX: + return include_dot ? String(".jpx") : String("jpx"); + case IMAGE_FILETYPE_JB2: + return include_dot ? String(".jb2") : String("jb2"); + case IMAGE_FILETYPE_XBM: + return include_dot ? String(".xbm") : String("xbm"); + default: + return ret; + } +} + +Variant f_getimagesize(CStrRef filename, Variant imageinfo /* = null */) { + int itype = 0; + char *temp; + struct gfxinfo *result = NULL; + + Array ret; + Variant stream = f_fopen(filename, "rb"); + if (same(stream, false)) { + Logger::Warning("failed to open stream: %s", filename.c_str()); + return false; + } + itype = php_getimagetype(stream); + switch( itype) { + case IMAGE_FILETYPE_GIF: + result = php_handle_gif(stream); + break; + case IMAGE_FILETYPE_JPEG: + result = php_handle_jpeg(stream, imageinfo); + break; + case IMAGE_FILETYPE_PNG: + result = php_handle_png(stream); + break; + case IMAGE_FILETYPE_SWF: + result = php_handle_swf(stream); + break; + case IMAGE_FILETYPE_SWC: +#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB) + result = php_handle_swc(stream); +#else + Logger::Info("The image is a compressed SWF file, but you do not " + "have a static version of the zlib extension enabled"); +#endif + break; + case IMAGE_FILETYPE_PSD: + result = php_handle_psd(stream); + break; + case IMAGE_FILETYPE_BMP: + result = php_handle_bmp(stream); + break; + case IMAGE_FILETYPE_TIFF_II: + result = php_handle_tiff(stream, 0); + break; + case IMAGE_FILETYPE_TIFF_MM: + result = php_handle_tiff(stream, 1); + break; + case IMAGE_FILETYPE_JPC: + result = php_handle_jpc(stream); + break; + case IMAGE_FILETYPE_JP2: + result = php_handle_jp2(stream); + break; + case IMAGE_FILETYPE_IFF: + result = php_handle_iff(stream); + break; + case IMAGE_FILETYPE_WBMP: + result = php_handle_wbmp(stream); + break; + case IMAGE_FILETYPE_XBM: + result = php_handle_xbm(stream); + break; + default: + case IMAGE_FILETYPE_UNKNOWN: + break; + } + + f_fclose(stream); + + if (result) { + ret.set(0, (int64)result->width); + ret.set(1, (int64)result->height); + ret.set(2, itype); + vspprintf(&temp, 0, "width=\"%d\" height=\"%d\"", + result->width, result->height); + ret.set(3, String(temp, AttachString)); + + if (result->bits != 0) { + ret.set("bits", (int64)result->bits); + } + if (result->channels != 0) { + ret.set("channels", (int64)result->channels); + } + ret.set("mime", (char*)php_image_type_to_mime_type(itype)); + free(result); + return ret; + } else { + return false; + } +} + +// PHP extension gd.c +#define HAVE_GDIMAGECREATEFROMPNG 1 + +#if HAVE_LIBTTF|HAVE_LIBFREETYPE +#define ENABLE_GD_TTF +#endif + +#define PHP_GDIMG_TYPE_GIF 1 +#define PHP_GDIMG_TYPE_PNG 2 +#define PHP_GDIMG_TYPE_JPG 3 +#define PHP_GDIMG_TYPE_WBM 4 +#define PHP_GDIMG_TYPE_XBM 5 +#define PHP_GDIMG_TYPE_XPM 6 +#define PHP_GDIMG_CONVERT_WBM 7 +#define PHP_GDIMG_TYPE_GD 8 +#define PHP_GDIMG_TYPE_GD2 9 +#define PHP_GDIMG_TYPE_GD2PART 10 + +#if HAVE_GD_BUNDLED +#define PHP_GD_VERSION_STRING "bundled (2.0.34 compatible)" +#elif HAVE_LIBGD20 +#define PHP_GD_VERSION_STRING "2.0 or higher" +#elif HAVE_GDIMAGECOLORRESOLVE +#define PHP_GD_VERSION_STRING "1.6.2 or higher" +#elif HAVE_LIBGD13 +#define PHP_GD_VERSION_STRING "between 1.3 and 1.6.1" +#else +#define PHP_GD_VERSION_STRING "1.2" +#endif + +#if HAVE_LIBGD15 +/* it's >= 1.5, i.e. has IOCtx */ +#define USE_GD_IOCTX 1 +#else +#undef USE_GD_IOCTX +#endif + +#ifdef USE_GD_IOCTX +#define CTX_PUTC(c,ctx) ctx->putC(ctx, c) + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +static Variant php_open_plain_file(CStrRef filename, const char *mode, + FILE **fpp) { + Variant stream = f_fopen(filename, mode); + if (same(stream, false)) { + return false; + } + PlainFile *plain_file = Object(stream).getTyped(false, true); + FILE *fp = NULL; + if (!plain_file || !(fp = plain_file->getStream())) { + f_fclose(stream); + return false; + } + if (fpp) *fpp = fp; + return stream; +} + +static int php_write(void *buf, uint size) { + g_context->out().write((const char *)buf, size); + return size; +} + +static void _php_image_output_putc(struct gdIOCtx *ctx, int c) { + /* without the following downcast, the write will fail + * (i.e., will write a zero byte) for all + * big endian architectures: + */ + unsigned char ch = (unsigned char) c; + php_write(&ch, 1); +} + +static int _php_image_output_putbuf(struct gdIOCtx *ctx, const void* buf, + int len) { + return php_write((void *)buf, len); +} + +static void _php_image_output_ctxfree(struct gdIOCtx *ctx) { + if(ctx) { + free(ctx); + } +} +static bool _php_image_output_ctx(CObjRef image, CStrRef filename, + int quality, int basefilter, + int image_type, char *tn, + void (*func_p)()) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + Variant stream; + FILE *fp = NULL; + int q = quality, i; + int f = basefilter; + gdIOCtx *ctx; + + /* The third (quality) parameter for Wbmp stands for the threshold + when called from image2wbmp(). The third (quality) parameter for + Wbmp and Xbm stands for the foreground color index when called + from imagey(). + */ + + if (!filename.empty()) { + stream = php_open_plain_file(filename, "wb", &fp); + if (same(stream, false)) { + Logger::Warning("Unable to open '%s' for writing", filename.c_str()); + return false; + } + ctx = gdNewFileCtx(fp); + } else { + ctx = (gdIOCtx *)malloc(sizeof(gdIOCtx)); + ctx->putC = _php_image_output_putc; + ctx->putBuf = _php_image_output_putbuf; +#if HAVE_LIBGD204 + ctx->gd_free = _php_image_output_ctxfree; +#else + ctx->free = _php_image_output_ctxfree; +#endif + } + + switch(image_type) { + case PHP_GDIMG_CONVERT_WBM: + if(q<0||q>255) { + Logger::Warning("Invalid threshold value '%d'. " + "It must be between 0 and 255", q); + } + case PHP_GDIMG_TYPE_JPG: + ((void(*)(gdImagePtr, gdIOCtx *, int))(func_p))(im, ctx, q); + break; + case PHP_GDIMG_TYPE_PNG: + ((void(*)(gdImagePtr, gdIOCtx *, int, int))(func_p))(im, ctx, q, f); + break; + case PHP_GDIMG_TYPE_XBM: + case PHP_GDIMG_TYPE_WBM: + if (q == -1) { // argc < 3 + for(i=0; i < gdImageColorsTotal(im); i++) { + if(!gdImageRed(im, i) && !gdImageGreen(im, i) && !gdImageBlue(im, i)) break; + } + q = i; + } + if (image_type == PHP_GDIMG_TYPE_XBM) { + ((void(*)(gdImagePtr, char *, int, gdIOCtx *))(func_p)) + (im, (char*)filename.c_str(), q, ctx); + } else { + ((void(*)(gdImagePtr, int, gdIOCtx *))(func_p))(im, q, ctx); + } + break; + default: + ((void(*)(gdImagePtr, gdIOCtx *))(func_p))(im, ctx); + break; + } + +#if HAVE_LIBGD204 + ctx->gd_free(ctx); +#else + ctx->free(ctx); +#endif + + if(fp) { + fflush(fp); + f_fclose(stream); + } + + return true; +} +#else +#define gdImageCreateFromGdCtx NULL +#define gdImageCreateFromGd2Ctx NULL +#define gdImageCreateFromGd2partCtx NULL +#define gdImageCreateFromGifCtx NULL +#define gdImageCreateFromJpegCtx NULL +#define gdImageCreateFromPngCtx NULL +#define gdImageCreateFromWBMPCtx NULL +typedef FILE gdIOCtx; +#define CTX_PUTC(c, fp) fputc(c, fp) +#endif + +#ifdef HAVE_GD_WBMP +/* It converts a gd Image to bw using a threshold value */ +static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, + int threshold) { + gdImagePtr im_dest; + int white, black; + int color, color_org, median; + int dest_height = gdImageSY(im_org); + int dest_width = gdImageSX(im_org); + int x, y; + + im_dest = gdImageCreate(dest_width, dest_height); + if (im_dest == NULL) { + Logger::Warning("Unable to allocate temporary buffer"); + return; + } + + white = gdImageColorAllocate(im_dest, 255, 255, 255); + if (white == -1) { + Logger::Warning("Unable to allocate the colors for " + "the destination buffer"); + return; + } + + black = gdImageColorAllocate(im_dest, 0, 0, 0); + if (black == -1) { + Logger::Warning("Unable to allocate the colors for " + "the destination buffer"); + return; + } + +#if HAVE_LIBGD20 + if (im_org->trueColor) { + gdImageTrueColorToPalette(im_org, 1, 256); + } +#endif + + for (y = 0; y < dest_height; y++) { + for (x = 0; x < dest_width; x++) { + color_org = gdImageGetPixel(im_org, x, y); + median = (im_org->red[color_org] + + im_org->green[color_org] + + im_org->blue[color_org]) / 3; + if (median < threshold) { + color = black; + } else { + color = white; + } + gdImageSetPixel (im_dest, x, y, color); + } + } +#ifdef USE_GD_IOCTX + gdImageWBMPCtx (im_dest, black, out); +#else + gdImageWBMP (im_dest, black, out); +#endif +} + +/* + * converts jpeg/png images to wbmp and resizes them as needed + */ +static bool _php_image_convert(CStrRef f_org, CStrRef f_dest, + int dest_height, int dest_width, + int threshold, int image_type) { + gdImagePtr im_org, im_dest, im_tmp; + Variant org_stream, dest_stream; + FILE *org, *dest; + int org_height, org_width; + int white, black; + int color, color_org, median; + int x, y; + float x_ratio, y_ratio; +#ifdef HAVE_GD_JPG + // long ignore_warning; +#endif + + /* Check threshold value */ + if (threshold < 0 || threshold > 8) { + Logger::Warning("Invalid threshold value '%d'", threshold); + return false; + } + + /* Open origin file */ + org_stream = php_open_plain_file(f_org, "rb", &org); + if (same(org_stream, false)) { + Logger::Warning("Unable to open '%s' for reading", f_org.c_str()); + return false; + } + + /* Open destination file */ + dest_stream = php_open_plain_file(f_dest, "wb", &dest); + if (same(dest_stream, false)) { + Logger::Warning("Unable to open '%s' for writing", f_dest.c_str()); + return false; + } + + switch (image_type) { +#ifdef HAVE_GD_GIF_READ + case PHP_GDIMG_TYPE_GIF: + im_org = gdImageCreateFromGif(org); + if (im_org == NULL) { + Logger::Warning("Unable to open '%s' Not a valid GIF file", + f_org.c_str()); + return false; + } + break; +#endif /* HAVE_GD_GIF_READ */ + +#ifdef HAVE_GD_JPG + case PHP_GDIMG_TYPE_JPG: + im_org = gdImageCreateFromJpeg(org); + if (im_org == NULL) { + Logger::Warning("Unable to open '%s' Not a valid JPEG file", + f_org.c_str()); + return false; + } + break; +#endif /* HAVE_GD_JPG */ + + +#ifdef HAVE_GD_PNG + case PHP_GDIMG_TYPE_PNG: + im_org = gdImageCreateFromPng(org); + if (im_org == NULL) { + Logger::Warning("Unable to open '%s' Not a valid PNG file", + f_org.c_str()); + return false; + } + break; +#endif /* HAVE_GD_PNG */ + + default: + Logger::Warning("Format not supported"); + return false; + } + + org_width = gdImageSX (im_org); + org_height = gdImageSY (im_org); + + x_ratio = (float) org_width / (float) dest_width; + y_ratio = (float) org_height / (float) dest_height; + + if (x_ratio > 1 && y_ratio > 1) { + if (y_ratio > x_ratio) { + x_ratio = y_ratio; + } else { + y_ratio = x_ratio; + } + dest_width = (int) (org_width / x_ratio); + dest_height = (int) (org_height / y_ratio); + } else { + x_ratio = (float) dest_width / (float) org_width; + y_ratio = (float) dest_height / (float) org_height; + + if (y_ratio < x_ratio) { + x_ratio = y_ratio; + } else { + y_ratio = x_ratio; + } + dest_width = (int) (org_width * x_ratio); + dest_height = (int) (org_height * y_ratio); + } + + im_tmp = gdImageCreate (dest_width, dest_height); + if (im_tmp == NULL ) { + Logger::Warning("Unable to allocate temporary buffer"); + return false; + } + + gdImageCopyResized (im_tmp, im_org, 0, 0, 0, 0, + dest_width, dest_height, org_width, org_height); + + gdImageDestroy(im_org); + + f_fclose(org_stream); + + im_dest = gdImageCreate(dest_width, dest_height); + if (im_dest == NULL) { + Logger::Warning("Unable to allocate destination buffer"); + return false; + } + + white = gdImageColorAllocate(im_dest, 255, 255, 255); + if (white == -1) { + Logger::Warning("Unable to allocate the colors for " + "the destination buffer"); + return false; + } + + black = gdImageColorAllocate(im_dest, 0, 0, 0); + if (black == -1) { + Logger::Warning("Unable to allocate the colors for " + "the destination buffer"); + return false; + } + + threshold = threshold * 32; + + for (y = 0; y < dest_height; y++) { + for (x = 0; x < dest_width; x++) { + color_org = gdImageGetPixel (im_tmp, x, y); + median = (im_tmp->red[color_org] + + im_tmp->green[color_org] + + im_tmp->blue[color_org]) / 3; + if (median < threshold) { + color = black; + } else { + color = white; + } + gdImageSetPixel (im_dest, x, y, color); + } + } + + gdImageDestroy (im_tmp ); + + gdImageWBMP(im_dest, black , dest); + + fflush(dest); + f_fclose(dest_stream); + + gdImageDestroy(im_dest); + + return true; +} +#endif /* HAVE_GD_WBMP */ + +// For quality and type, -1 means that the argument does not exist +static bool _php_image_output(CObjRef image, CStrRef filename, int quality, + int type, int image_type, char *tn, + void (*func_p)()) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + Variant stream; + FILE *fp; + int q = quality, i, t = type; + + /* 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 (!filename.empty()) { + stream = php_open_plain_file(filename, "wb", &fp); + if (same(stream, false)) { + Logger::Warning("Unable to open '%s' for writing", filename.c_str()); + return false; + } + + switch (image_type) { +#ifdef HAVE_GD_WBMP + case PHP_GDIMG_CONVERT_WBM: + if (q == -1) { + q = 0; + } else if (q < 0 || q > 255) { + Logger::Warning("Invalid threshold value '%d'. " + "It must be between 0 and 255", q); + q = 0; + } + gdImageWBMP(im, q, fp); + break; +#endif + case PHP_GDIMG_TYPE_JPG: { + // gdImageJpeg + ((void(*)(gdImagePtr, FILE *, int))(func_p))(im, fp, q); + break; + } + case PHP_GDIMG_TYPE_WBM: + for (i = 0; i < gdImageColorsTotal(im); i++) { + if (gdImageRed(im, i) == 0) break; + } + // gdImageWBMP + ((void(*)(gdImagePtr, int, FILE *))(func_p))(im, i, fp); + break; +#if HAVE_LIBGD20 + case PHP_GDIMG_TYPE_GD: + if (im->trueColor){ + gdImageTrueColorToPalette(im,1,256); + } + // gdImageGd + ((void(*)(gdImagePtr, FILE *))(func_p))(im, fp); + break; +#endif +#ifdef HAVE_GD_GD2 + case PHP_GDIMG_TYPE_GD2: + if (q == -1) { + q = 128; + } + // gdImageGd2 + ((void(*)(gdImagePtr, FILE *, int, int))(func_p))(im, fp, q, t); + break; +#endif + default: + if (q == -1) { + q = 128; + } + ((void(*)(gdImagePtr, FILE *, int, int))(func_p))(im, fp, q, t); + break; + } + fflush(fp); + f_fclose(stream); + } else { + int b; + FILE *tmp; + char buf[4096]; + char path[PATH_MAX]; + + // open a temporary file + snprintf(path, sizeof(path), "/tmp/XXXXXX"); + int fd = mkstemp(path); + if (fd == -1 || (tmp = fdopen(fd, "r+b")) == NULL) { + if (fd != -1) close(fd); + Logger::Warning("Unable to open temporary file"); + return false; + } + + switch (image_type) { +#ifdef HAVE_GD_WBMP + case PHP_GDIMG_CONVERT_WBM: + if (q == -1) { + q = 0; + } else if (q < 0 || q > 255) { + Logger::Warning("Invalid threshold value '%d'. " + "It must be between 0 and 255", q); + q = 0; + } + gdImageWBMP(im, q, tmp); + break; +#endif + case PHP_GDIMG_TYPE_JPG: + ((void(*)(gdImagePtr, FILE *, int))(func_p))(im, tmp, q); + break; + case PHP_GDIMG_TYPE_WBM: + for (i = 0; i < gdImageColorsTotal(im); i++) { + if (gdImageRed(im, i) == 0) { + break; + } + } + ((void(*)(gdImagePtr, int, FILE *))(func_p))(im, q, tmp); + break; +#if HAVE_LIBGD20 + case PHP_GDIMG_TYPE_GD: + if (im->trueColor) { + gdImageTrueColorToPalette(im,1,256); + } + ((void(*)(gdImagePtr, FILE *))(func_p))(im, tmp); + break; +#endif +#ifdef HAVE_GD_GD2 + case PHP_GDIMG_TYPE_GD2: + if (q == -1) { + q = 128; + } + ((void(*)(gdImagePtr, FILE *, int, int))(func_p))(im, tmp, q, t); + break; +#endif + default: + ((void(*)(gdImagePtr, FILE *))(func_p))(im, tmp); + break; + } + + fseek(tmp, 0, SEEK_SET); + + while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) { + g_context->out().write(buf, b); + } + + fclose(tmp); + /* make sure that the temporary file is removed */ + unlink((const char *)path); + } + return true; +} + +static gdImagePtr _php_image_create_from(CStrRef filename, + int srcX, int srcY, + int width, int height, + int image_type, char *tn, + gdImagePtr(*func_p)(), + gdImagePtr(*ioctx_func_p)()) { + gdImagePtr im = NULL; + Variant stream; +#ifdef HAVE_GD_JPG + // long ignore_warning; +#endif + + if (image_type == PHP_GDIMG_TYPE_GD2PART) { + if (width < 1 || height < 1) { + Logger::Warning("Zero width or height not allowed"); + return NULL; + } + } + stream = f_fopen(filename, "rb"); + if (same(stream, false)) { + Logger::Warning("failed to open stream: %s", filename.c_str()); + return NULL; + } + +#ifndef USE_GD_IOCTX + ioctx_func_p = NULL; /* don't allow sockets without IOCtx */ +#endif + + FILE *fp = NULL; + File *file = Object(stream).getTyped(); + PlainFile *plain_file = dynamic_cast(file); + if (plain_file) { + fp = plain_file->getStream(); + } else if (ioctx_func_p) { +#ifdef USE_GD_IOCTX + /* we can create an io context */ + gdIOCtx* io_ctx; + + // copy all + String buff = file->read(8192); + String str; + do { + str = file->read(8192); + buff += str; + } while (!str.empty()); + + if (buff.empty()) { + Logger::Warning("Cannot read image data"); + goto out_err; + } + + io_ctx = gdNewDynamicCtxEx(buff.length(), (char *)buff.c_str(), 0); + if (!io_ctx) { + Logger::Warning("Cannot allocate GD IO context"); + goto out_err; + } + + if (image_type == PHP_GDIMG_TYPE_GD2PART) { + im = + ((gdImagePtr(*)(gdIOCtx *, int, int, int, int))(ioctx_func_p)) + (io_ctx, srcX, srcY, width, height); + } else { + im = ((gdImagePtr(*)(gdIOCtx *))(ioctx_func_p))(io_ctx); + } +#if HAVE_LIBGD204 + io_ctx->gd_free(io_ctx); +#else + io_ctx->free(io_ctx); +#endif +#endif + } + else { + /* TODO: try and force the stream to be FILE* */ + ASSERT(false); + } + + if (!im && fp) { + switch (image_type) { + case PHP_GDIMG_TYPE_GD2PART: + im = ((gdImagePtr(*)(FILE *, int, int, int, int))(func_p)) + (fp, srcX, srcY, width, height); + break; +#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) + case PHP_GDIMG_TYPE_XPM: + im = gdImageCreateFromXpm(filename); + break; +#endif + +#ifdef HAVE_GD_JPG + case PHP_GDIMG_TYPE_JPG: + im = gdImageCreateFromJpeg(fp); + break; +#endif + + default: + im = ((gdImagePtr(*)(FILE*))(func_p))(fp); + break; + } + + fflush(fp); + } + + if (im) { + f_fclose(stream); + return im; + } + + Logger::Warning("'%s' is not a valid %s file", filename.c_str(), tn); +out_err: + f_fclose(stream); + return NULL; +} + +static const char php_sig_gd2[3] = {'g', 'd', '2'}; + +/* getmbi + ** ------ + ** Get a multibyte integer from a generic getin function + ** 'getin' can be getc, with in = NULL + ** you can find getin as a function just above the main function + ** This way you gain a lot of flexibilty about how this package + ** reads a wbmp file. + */ +static int getmbi(int (*getin) (void *in), void *in) { + int i, mbi = 0; + + do { + i = getin (in); + if (i < 0) + return (-1); + mbi = (mbi << 7) | (i & 0x7f); + } while (i & 0x80); + + return (mbi); +} + +/* skipheader + ** ---------- + ** Skips the ExtHeader. Not needed for the moment + ** + */ +int skipheader (int (*getin) (void *in), void *in) { + int i; + + do { + i = getin (in); + if (i < 0) return (-1); + } + while (i & 0x80); + + return (0); +} + +static int _php_image_type (char data[8]) { +#ifdef HAVE_LIBGD15 + + if (data == NULL) { + return -1; + } + + if (!memcmp(data, php_sig_gd2, 3)) { + return PHP_GDIMG_TYPE_GD2; + } else if (!memcmp(data, php_sig_jpg, 3)) { + return PHP_GDIMG_TYPE_JPG; + } else if (!memcmp(data, php_sig_png, 3)) { + if (!memcmp(data, php_sig_png, 8)) { + return PHP_GDIMG_TYPE_PNG; + } + } else if (!memcmp(data, php_sig_gif, 3)) { + return PHP_GDIMG_TYPE_GIF; + } +#ifdef HAVE_GD_WBMP + else { + gdIOCtx *io_ctx; + io_ctx = gdNewDynamicCtxEx(8, data, 0); + if (io_ctx) { + if (getmbi((int(*)(void *)) gdGetC, io_ctx) == 0 && + skipheader((int(*)(void *)) gdGetC, io_ctx) == 0 ) { +#if HAVE_LIBGD204 + io_ctx->gd_free(io_ctx); +#else + io_ctx->free(io_ctx); +#endif + return PHP_GDIMG_TYPE_WBM; + } else { +#if HAVE_LIBGD204 + io_ctx->gd_free(io_ctx); +#else + io_ctx->free(io_ctx); +#endif + } + } + } +#endif + return -1; +#endif +} + +#ifdef HAVE_LIBGD15 +gdImagePtr _php_image_create_from_string(CStrRef image, char *tn, + gdImagePtr (*ioctx_func_p)()) { + gdImagePtr im; + gdIOCtx *io_ctx; + + io_ctx = gdNewDynamicCtxEx(image.length(), (char *)image.c_str(), 0); + + if (!io_ctx) { + return NULL; + } + + im = (*(gdImagePtr (*)(gdIOCtx *))ioctx_func_p)(io_ctx); + if (!im) { + Logger::Warning("Passed data is not in '%s' format", tn); +#if HAVE_LIBGD204 + io_ctx->gd_free(io_ctx); +#else + io_ctx->free(io_ctx); +#endif + return NULL; + } + +#if HAVE_LIBGD204 + io_ctx->gd_free(io_ctx); +#else + io_ctx->free(io_ctx); +#endif + + return im; +} +#endif + +static gdFontPtr php_find_gd_font(int size) { + gdFontPtr font; + + switch (size) { + case 1: + font = gdFontTiny; + break; + case 2: + font = gdFontSmall; + break; + case 3: + font = gdFontMediumBold; + break; + case 4: + font = gdFontLarge; + break; + case 5: + font = gdFontGiant; + break; + default: + Logger::Warning("Unsupported font: %d", size); + // font = zend_list_find(size - 5, &ind_type); + // if (!font || ind_type != le_gd_font) { + if (size < 1) { + font = gdFontTiny; + } else { + font = gdFontGiant; + } + break; + } + return font; +} + +/* workaround for a bug in gd 1.2 */ +static void php_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, + int c, int color) { + int cx, cy, px, py, fline; + cx = 0; + cy = 0; + + if ((c < f->offset) || (c >= (f->offset + f->nchars))) { + return; + } + + fline = (c - f->offset) * f->h * f->w; + for (py = y; (py > (y - f->w)); py--) { + for (px = x; (px < (x + f->h)); px++) { + if (f->data[fline + cy * f->w + cx]) { + gdImageSetPixel(im, px, py, color); + } + cy++; + } + cy = 0; + cx++; + } +} + +/* + * arg = 0 ImageChar + * arg = 1 ImageCharUp + * arg = 2 ImageString + * arg = 3 ImageStringUp + */ +static bool php_imagechar(CObjRef image, int size, int x, int y, + CStrRef c, int color, int mode) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + int ch = 0; + gdFontPtr font; + + if (mode < 2) { + ch = (int)((unsigned char)(c.charAt(0))); + } + + font = php_find_gd_font(size); + + switch (mode) { + case 0: + gdImageChar(im, font, x, y, ch, color); + break; + case 1: + php_gdimagecharup(im, font, x, y, ch, color); + break; + case 2: + for (int i = 0; (i < c.length()); i++) { + gdImageChar(im, font, x, y, (int)((unsigned char)c.charAt(i)), color); + x += font->w; + } + break; + case 3: + for (int i = 0; (i < c.length()); i++) { + gdImageCharUp(im, font, x, y, (int)c.charAt(i), color); + y -= font->w; + } + break; + } + return true; +} + +/* arg = 0 normal polygon + arg = 1 filled polygon */ +static bool php_imagepolygon(CObjRef image, CArrRef points, int num_points, + int color, int filled) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdPointPtr pts; + int nelem, i; + + nelem = points.size(); + if (nelem < 6) { + Logger::Warning("You must have at least 3 points in your array"); + return false; + } + + if (nelem < num_points * 2) { + Logger::Warning("Trying to use %d points in array with only %d points", + num_points, nelem/2); + return false; + } + + pts = (gdPointPtr)malloc(num_points * sizeof(gdPoint)); + + for (i = 0; i < num_points; i++) { + if (points.exists(i * 2)) { + pts[i].x = points[i * 2]; + } + if (points.exists(i * 2 + 1)) { + pts[i].y = points[i * 2 + 1]; + } + } + + if (filled) { + gdImageFilledPolygon(im, pts, num_points, color); + } else { + gdImagePolygon(im, pts, num_points, color); + } + + free(pts); + return true; +} + +static bool php_image_filter_negate(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, "gdImageNegate does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + + if (gdImageNegate(im) == 1) { + return true; + } + + return false; +*/ +} + +static bool php_image_filter_grayscale(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, "gdImageGrayScale does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + + if (gdImageGrayScale(im) == 1) { + return true; + } + + return false; +*/ +} + +static bool php_image_filter_brightness(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, "gdImageBrightness does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + int brightness = arg1; + + if (gdImageBrightness(im, brightness) == 1) { + return true; + } + return false; +*/ +} + +static bool php_image_filter_contrast(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, "gdImageContrast does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + int contrast = arg1; + + if (gdImageContrast(im, contrast) == 1) { + return true; + } + return false; +*/ +} + +static bool php_image_filter_colorize(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, "gdImageColor does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + int r = arg1; + int g = arg2; + int b = arg3; + int a = arg1; + + if (gdImageColor(im, r, g, b, a) == 1) { + return true; + } + return false; +*/ +} + +static bool php_image_filter_edgedetect(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, + "gdImageEdgeDetectQuick does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + + if (gdImageEdgeDetectQuick(im) == 1) { + return true; + } + + return false; +*/ +} + +static bool php_image_filter_emboss(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, "gdImageEmboss does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + + if (gdImageEmboss(im) == 1) { + return true; + } + + return false; +*/ +} + +static bool php_image_filter_gaussian_blur(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, "gdImageGaussianBlur does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + + if (gdImageGaussianBlur(im) == 1) { + return true; + } + + return false; +*/ +} + +static bool php_image_filter_selective_blur(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, "gdImageSelectiveBlur does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + + if (gdImageSelectiveBlur(im) == 1) { + return true; + } + + return false; +*/ +} + +static bool php_image_filter_mean_removal(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, "gdImageMeanRemoval does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + + if (gdImageMeanRemoval(im) == 1) { + return true; + } + + return false; +*/ +} + +static bool php_image_filter_smooth(CObjRef image, + int arg1 /* = 0 */, + int arg2 /* = 0 */, + int arg3 /* = 0 */, + int arg4 /* = 0 */) { + throw NotSupportedException(__func__, "gdImageSmooth does not exists"); +/* + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + int weight = arg1; + + if (gdImageSmooth(im, weight) == 1) { + return true; + } + + return false; +*/ +} + +/* + * arg = 0 ImageFontWidth + * arg = 1 ImageFontHeight + */ +static int php_imagefontsize(int size, int arg) { + gdFontPtr font = php_find_gd_font(size); + return (arg ? font->h : font->w); +} + +#ifdef ENABLE_GD_TTF +#define TTFTEXT_DRAW 0 +#define TTFTEXT_BBOX 1 +#endif + +#ifdef ENABLE_GD_TTF + +static Variant php_imagettftext_common(int mode, int extended, + CVarRef arg1, + CVarRef arg2, + CVarRef arg3, + CVarRef arg4, + CVarRef arg5 = null_variant, + CVarRef arg6 = null_variant, + CVarRef arg7 = null_variant, + CVarRef arg8 = null_variant, + CVarRef arg9 = null_variant) { + gdImagePtr im=NULL; + long col = -1, x = -1, y = -1; + int brect[8]; + double ptsize, angle; + String str; + String fontname; + Array extrainfo; + char *error = NULL; +#if HAVE_GD_STRINGFTEX + gdFTStringExtra strex = {0}; +#endif + +#if !HAVE_GD_STRINGFTEX + assert(!extended); +#endif + + if (mode == TTFTEXT_BBOX) { + ptsize = arg1; + angle = arg2; + fontname = arg3; + str = arg4; + extrainfo = arg5; + } else { + Object image = arg1; + ptsize = arg2; + angle = arg3; + x = toInt64(arg4); + y = toInt64(arg5); + col = toInt64(arg6); + fontname = arg7; + str = arg8; + extrainfo = arg9; + im = image.getTyped()->get(); + if (!im) return false; + } + + /* convert angle to radians */ + angle = angle * (M_PI/180); + +#if HAVE_GD_STRINGFTEX + if (extended && !extrainfo.empty()) { /* parse extended info */ + + /* walk the assoc array */ + for (ArrayIter iter(extrainfo); iter; ++iter) { + Variant key = iter.first(); + if (!key.isString()) continue; + Variant item = iter.second(); + if (key == "linespacing") { + strex.flags |= gdFTEX_LINESPACE; + strex.linespacing = toDouble(item); + } + } + } +#endif + + FILE *fp = NULL; + if (!RuntimeOption::FontPath.empty()) { + fontname = String(RuntimeOption::FontPath.c_str()) + f_basename(fontname); + } + Variant stream = php_open_plain_file(fontname, "rb", &fp); + if (same(stream, false)) { + Logger::Error("Invalid font filename %s", fontname.c_str()); + return false; + } + f_fclose(stream); + +#ifdef USE_GD_IMGSTRTTF +# if HAVE_GD_STRINGFTEX + if (extended) { + error = gdImageStringFTEx(im, brect, col, (char*)fontname.c_str(), + ptsize, angle, x, y, (char*)str.c_str(), + &strex); + } + else +# endif + +# if HAVE_GD_STRINGFT + error = gdImageStringFT(im, brect, col, (char*)fontname.c_str(), + ptsize, angle, x, y, (char*)str.c_str()); +# elif HAVE_GD_STRINGTTF + error = gdImageStringTTF(im, brect, col, fontname.c_str(), + ptsize, angle, x, y, str.c_str()); +# endif + +#else /* !USE_GD_IMGSTRTTF */ + error = gdttf(im, brect, col, fontname.c_str(), + ptsize, angle, x, y, str.c_str()); +#endif + + if (error) { + Logger::Warning("%s", error); + return false; + } + + /* return array with the text's bounding box */ + Array ret; + for (int i = 0; i < 8; i++) { + ret.set(i, brect[i]); + } + return ret; +} +#endif /* ENABLE_GD_TTF */ + +Array f_gd_info() { + Array ret; + + ret.set("GD Version", PHP_GD_VERSION_STRING); + +#ifdef ENABLE_GD_TTF + ret.set("FreeType Support", true); +#if HAVE_LIBFREETYPE + ret.set("FreeType Linkage", "with freetype"); +#elif HAVE_LIBTTF + ret.set("FreeType Linkage", "with TTF library"); +#else + ret.set("FreeType Linkage", "with unknown library"); +#endif +#else + ret.set("FreeType Support", false); +#endif + +#ifdef HAVE_LIBT1 + ret.set("T1Lib Support", true); +#else + ret.set("T1Lib Support", false); +#endif +#ifdef HAVE_GD_GIF_READ + ret.set("GIF Read Support", true); +#else + ret.set("GIF Read Support", false); +#endif +#ifdef HAVE_GD_GIF_CREATE + ret.set("GIF Create Support", true); +#else + ret.set("GIF Create Support", false); +#endif +#ifdef HAVE_GD_JPG + ret.set("JPG Support", true); +#else + ret.set("JPG Support", false); +#endif +#ifdef HAVE_GD_PNG + ret.set("PNG Support", true); +#else + ret.set("PNG Support", false); +#endif +#ifdef HAVE_GD_WBMP + ret.set("WBMP Support", true); +#else + ret.set("WBMP Support", false); +#endif +#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) + ret.set("XPM Support", true); +#else + ret.set("XPM Support", false); +#endif +#ifdef HAVE_GD_XBM + ret.set("XBM Support", true); +#else + ret.set("XBM Support", false); +#endif +#if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED) + ret.set("JIS-mapped Japanese Font Support", true); +#else + ret.set("JIS-mapped Japanese Font Support", false); +#endif + return ret; +} + +#define FLIPWORD(a) (((a & 0xff000000) >> 24) | \ + ((a & 0x00ff0000) >> 8) | \ + ((a & 0x0000ff00) << 8) | \ + ((a & 0x000000ff) << 24)) + +Variant f_imageloadfont(CStrRef file) { + // TODO: ind = 5 + zend_list_insert(font, le_gd_font); + throw NotSupportedException(__func__, "NYI"); +#ifdef NEVER + Variant stream; + zval **file; + int hdr_size = sizeof(gdFont) - sizeof(char *); + int ind, body_size, n = 0, b, i, body_size_check; + gdFontPtr font; + php_stream *stream; + + + stream = f_fopen(file, "rb"); + if (same(stream, false)) { + Logger::Warning("failed to open file: %s", file.c_str()); + return false; + } + + /* Only supports a architecture-dependent binary dump format + * at the moment. + * The file format is like this on machines with 32-byte integers: + * + * byte 0-3: (int) number of characters in the font + * byte 4-7: (int) value of first character in the font (often 32, space) + * byte 8-11: (int) pixel width of each character + * byte 12-15: (int) pixel height of each character + * bytes 16-: (char) array with character data, one byte per pixel + * in each character, for a total of + * (nchars*width*height) bytes. + */ + font = (gdFontPtr) malloc(sizeof(gdFont)); + b = 0; + String hdr = f_fread(stream, hdr_size); + if (hdr.length() < hdr_size) { + free(font); + if (f_feof(stream)) { + Logger::Warning("End of file while reading header"); + } else { + Logger::Warning("Error while reading header"); + } + f_fclose(stream); + return false; + } + memcpy((void*)font, hdr.c_str(), hdr.length()); + i = toInt64(f_tell(stream)); + f_fseek(stream, 0, SEEK_END); + body_size_check = toInt64(f_tell(stream)) - hdr_size; + f_fseek(stream, i, SEEK_SET); + + body_size = font->w * font->h * font->nchars; + if (body_size != body_size_check) { + font->w = FLIPWORD(font->w); + font->h = FLIPWORD(font->h); + font->nchars = FLIPWORD(font->nchars); + body_size = font->w * font->h * font->nchars; + } + + if (body_size != body_size_check) { + Logger::Warning("Error reading font"); + free(font); + f_fclose(stream); + return false; + } + + String body = f_fread(stream, body_size); + if (body.length() < body_size) { + free(font); + if (f_feof(stream)) { + Logger::Warning("End of file while reading body"); + } else { + Logger::Warning("Error while reading body"); + } + f_fclose(stream); + return false; + } + font->data = malloc(body_size); + memcpy((void*)font->data, body.c_str(), body.length()); + f_fclose(stream); + + /* Adding 5 to the font index so we will never have font indices + * that overlap with the old fonts (with indices 1-5). The first + * list index given out is always 1. + */ + // ind = 5 + zend_list_insert(font, le_gd_font); + + return ind; +#endif +} + +bool f_imagesetstyle(CObjRef image, CArrRef style) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + int *stylearr; + int index; + + stylearr = (int *)malloc(sizeof(int) * style.size()); + index = 0; + for (ArrayIter iter(style); iter; ++iter) { + stylearr[index++] = iter.secondRef(); + } + gdImageSetStyle(im, stylearr, index); + free(stylearr); + return true; +} + +Variant f_imagecreatetruecolor(int width, int height) { + gdImagePtr im; + + if (width <= 0 || height <= 0 || width >= INT_MAX || height >= INT_MAX) { + Logger::Warning("Invalid image dimensions"); + return false; + } + + im = gdImageCreateTrueColor(width, height); + + if (!im) { + return false; + } + return Object(new Image(im)); +} + +bool f_imageistruecolor(CObjRef image) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return im->trueColor; +} + +Variant f_imagetruecolortopalette(CObjRef image, bool dither, int ncolors) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + + if (ncolors <= 0) { + Logger::Warning("Number of colors has to be greater than zero"); + return false; + } + gdImageTrueColorToPalette(im, dither, ncolors); + return true; +} + +Variant f_imagecolormatch(CObjRef image1, CObjRef image2) { + throw NotSupportedException(__func__, "gdImageColorMatch does not exist"); +/* + gdImagePtr im1 = image1.getTyped()->get(); + if (!im1) return false; + gdImagePtr im2 = image2.getTyped()->get(); + if (!im2) return false; + int result; + + result = gdImageColorMatch(im1, im2); + switch (result) { + case -1: + Logger::Warning("Image1 must be TrueColor" ); + return false; + case -2: + Logger::Warning("Image2 must be Palette" ); + return false; + case -3: + Logger::Warning("Image1 and Image2 must be the same size" ); + return false; + case -4: + Logger::Warning("Image2 must have at least one color" ); + return false; + } + + return true; +*/ +} + +bool f_imagesetthickness(CObjRef image, int thickness) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageSetThickness(im, thickness); + return true; +} + +bool f_imagefilledellipse(CObjRef image, int cx, int cy, + int width, int height, int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageFilledEllipse(im, cx, cy, width, height, color); + return true; +} + +bool f_imagefilledarc(CObjRef image, int cx, int cy, int width, int height, + int start, int end, int color, int style) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + if (end < 0) end %= 360; + if (start < 0) start %= 360; + gdImageFilledArc(im, cx, cy, width, height, start, end, color, style); + return true; +} + +bool f_imagealphablending(CObjRef image, bool blendmode) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageAlphaBlending(im, blendmode); + return true; +} + +bool f_imagesavealpha(CObjRef image, bool saveflag) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageSaveAlpha(im, saveflag); + return true; +} + +bool f_imagelayereffect(CObjRef image, int effect) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageAlphaBlending(im, effect); + return true; +} + +Variant f_imagecolorallocatealpha(CObjRef image, int red, int green, int blue, + int alpha) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + int ct = gdImageColorAllocateAlpha(im, red, green, blue, alpha); + if (ct < 0) { + return false; + } + return ct; +} + +Variant f_imagecolorresolvealpha(CObjRef image, int red, int green, int blue, + int alpha) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return gdImageColorResolveAlpha(im, red, green, blue, alpha); +} + +Variant f_imagecolorclosestalpha(CObjRef image, int red, int green, int blue, + int alpha) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return gdImageColorClosestAlpha(im, red, green, blue, alpha); +} + +Variant f_imagecolorexactalpha(CObjRef image, int red, int green, int blue, + int alpha) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return gdImageColorExactAlpha(im, red, green, blue, alpha); +} + +bool f_imagecopyresampled(CObjRef dst_im, CObjRef src_im, + int dst_x, int dst_y, int src_x, int src_y, + int dst_w, int dst_h, int src_w, int src_h) { + gdImagePtr im_src = src_im.getTyped()->get(); + if (!im_src) return false; + gdImagePtr im_dst = dst_im.getTyped()->get(); + if (!im_dst) return false; + gdImageCopyResampled(im_dst, im_src, dst_x, dst_y, src_x, src_y, + dst_w, dst_h, src_w, src_h); + return true; +} + +Variant f_imagegrabwindow(int window, int client_area /* = 0 */) { +#ifdef PHP_WIN32 + #error config error: PHP_WIN32 defined! +#else + throw NotSupportedException(__func__, "PHP_WIN32 undefined"); +#endif +} + +Variant f_imagegrabscreen() { +#ifdef PHP_WIN32 + #error config error: PHP_WIN32 defined! +#else + throw NotSupportedException(__func__, "PHP_WIN32 undefined"); +#endif +} + +Variant f_imagerotate(CObjRef source_image, double angle, int bgd_color, + int ignore_transparent /* = 0 */) { + throw NotSupportedException(__func__, "gdImageRotate does not exist"); +/* + gdImagePtr im_src = source_image.getTyped()->get(); + if (!im_src) return false; + gdImagePtr im_dst = gdImageRotate(im_src, angle, bgd_color, + ignore_transparent); + if (!im_dst) return false; + return Object(new Image(im_dst)); +*/ +} + +bool f_imagesettile(CObjRef image, CObjRef tile) { +#if HAVE_GD_IMAGESETTILE + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImagePtr til = tile.getTyped()->get(); + if (!til) return false; + gdImageSetTile(im, til); + return true; +#else + throw NotSupportedException(__func__, "HAVE_GD_IMAGESETTILE undefined"); +#endif +} + +bool f_imagesetbrush(CObjRef image, CObjRef brush) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImagePtr tile = brush.getTyped()->get(); + if (!tile) return false; + gdImageSetBrush(im, tile); + return true; +} + +Variant f_imagecreate(int width, int height) { + gdImagePtr im; + if (width <= 0 || height <= 0 || width >= INT_MAX || height >= INT_MAX) { + Logger::Warning("Invalid image dimensions"); + return false; + } + im = gdImageCreate(width, height); + if (!im) { + return false; + } + return Object(new Image(im)); +} + +int f_imagetypes() { + int ret=0; +#ifdef HAVE_GD_GIF_CREATE + ret = 1; +#endif +#ifdef HAVE_GD_JPG + ret |= 2; +#endif +#ifdef HAVE_GD_PNG + ret |= 4; +#endif +#ifdef HAVE_GD_WBMP + ret |= 8; +#endif +#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) + ret |= 16; +#endif + return ret; +} + +Variant f_imagecreatefromstring(CStrRef data) { +#ifdef HAVE_LIBGD15 + gdImagePtr im; + int imtype; + char sig[8]; + + if (data.length() < 8) { + Logger::Warning("Empty string or invalid image"); + return false; + } + memcpy(sig, data.c_str(), 8); + imtype = _php_image_type(sig); + switch (imtype) { + case PHP_GDIMG_TYPE_JPG: +#ifdef HAVE_GD_JPG + im = _php_image_create_from_string(data, "JPEG", + (gdImagePtr(*)())gdImageCreateFromJpegCtx); +#else + Logger::Warning("No JPEG support"); + return false; +#endif + break; + + case PHP_GDIMG_TYPE_PNG: +#ifdef HAVE_GD_PNG + im = _php_image_create_from_string(data, "PNG", + (gdImagePtr(*)())gdImageCreateFromPngCtx); +#else + Logger::Warning("No PNG support"); + return false; +#endif + break; + + case PHP_GDIMG_TYPE_GIF: +#ifdef HAVE_GD_GIF_READ + im = _php_image_create_from_string(data, "GIF", + (gdImagePtr(*)())gdImageCreateFromGifCtx); +#else + Logger::Warning("No GIF support"); + return false; +#endif + break; + + case PHP_GDIMG_TYPE_WBM: +#ifdef HAVE_GD_WBMP + im = _php_image_create_from_string(data, "WBMP", + (gdImagePtr(*)())gdImageCreateFromWBMPCtx); +#else + Logger::Warning("No WBMP support"); + return false; +#endif + break; + + case PHP_GDIMG_TYPE_GD2: +#ifdef HAVE_GD_GD2 + im = _php_image_create_from_string(data, "GD2", + (gdImagePtr(*)())gdImageCreateFromGd2Ctx); +#else + Logger::Warning("No GD2 support"); + return false; +#endif + break; + + default: + Logger::Warning("Data is not in a recognized format"); + return false; + } + + if (!im) { + Logger::Warning("Couldn't create GD Image Stream out of Data"); + return false; + } + return Object(new Image(im)); +#else + throw NotSupportedException(__func__, "HAVE_LIBGD15 undefined"); +#endif +} + +Variant f_imagecreatefromgif(CStrRef filename) { +#ifdef HAVE_GD_GIF_READ + gdImagePtr im = + _php_image_create_from(filename, -1, -1, -1, -1, + PHP_GDIMG_TYPE_GIF, "GIF", + (gdImagePtr(*)())gdImageCreateFromGif, + (gdImagePtr(*)())gdImageCreateFromGifCtx); + return Object(new Image(im)); +#else + throw NotSupportedException(__func__, "HAVE_GD_GIF_READ undefined"); +#endif +} + +Variant f_imagecreatefromjpeg(CStrRef filename) { +#ifdef HAVE_GD_JPG + gdImagePtr im = + _php_image_create_from(filename, -1, -1, -1, -1, + PHP_GDIMG_TYPE_JPG, "JPEG", + (gdImagePtr(*)())gdImageCreateFromJpeg, + (gdImagePtr(*)())gdImageCreateFromJpegCtx); + return Object(new Image(im)); +#else + throw NotSupportedException(__func__, "HAVE_GD_JPG undefined"); +#endif +} + +Variant f_imagecreatefrompng(CStrRef filename) { +#ifdef HAVE_GD_PNG + gdImagePtr im = + _php_image_create_from(filename, -1, -1, -1, -1, + PHP_GDIMG_TYPE_PNG, "PNG", + (gdImagePtr(*)())gdImageCreateFromPng, + (gdImagePtr(*)())gdImageCreateFromPngCtx); + return Object(new Image(im)); +#else + throw NotSupportedException(__func__, "HAVE_GD_PNG undefined"); +#endif +} + +Variant f_imagecreatefromxbm(CStrRef filename) { +#ifdef HAVE_GD_XBM + gdImagePtr im = + _php_image_create_from(filename, -1, -1, -1, -1, + PHP_GDIMG_TYPE_XBM, "XBM", + (gdImagePtr(*)())gdImageCreateFromXbm, + (gdImagePtr(*)())NULL); + return Object(new Image(im)); +#else + throw NotSupportedException(__func__, "HAVE_GD_XBM undefined"); +#endif +} + +Variant f_imagecreatefromxpm(CStrRef filename) { +#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) + gdImagePtr im = + _php_image_create_from(filename, -1, -1, -1, -1, + PHP_GDIMG_TYPE_XPM, "XPM", + (gdImagePtr(*)())gdImageCreateFromXpm, + (gdImagePtr(*)())NULL); + return Object(new Image(im)); +#else + throw NotSupportedException(__func__, + "HAVE_GD_XPM or HAVE_GD_BUNDLED undefined"); +#endif +} + +Variant f_imagecreatefromwbmp(CStrRef filename) { +#ifdef HAVE_GD_WBMP + gdImagePtr im = + _php_image_create_from(filename, -1, -1, -1, -1, + PHP_GDIMG_TYPE_WBM, "WBMP", + (gdImagePtr(*)())gdImageCreateFromWBMP, + (gdImagePtr(*)())gdImageCreateFromWBMPCtx); + return Object(new Image(im)); +#else + throw NotSupportedException(__func__, "HAVE_GD_WBMP undefined"); +#endif +} + +Variant f_imagecreatefromgd(CStrRef filename) { + gdImagePtr im = + _php_image_create_from(filename, -1, -1, -1, -1, + PHP_GDIMG_TYPE_GD, "GD", + (gdImagePtr(*)())gdImageCreateFromGd, + (gdImagePtr(*)())gdImageCreateFromGdCtx); + return Object(new Image(im)); +} + +Variant f_imagecreatefromgd2(CStrRef filename) { + gdImagePtr im = + _php_image_create_from(filename, -1, -1, -1, -1, + PHP_GDIMG_TYPE_GD2, "GD2", + (gdImagePtr(*)())gdImageCreateFromGd2, + (gdImagePtr(*)())gdImageCreateFromGd2Ctx); + return Object(new Image(im)); +} + +Variant f_imagecreatefromgd2part(CStrRef filename, + int srcx, int srcy, int width, int height) { + gdImagePtr im = + _php_image_create_from(filename, srcx, srcy, width, height, + PHP_GDIMG_TYPE_GD2PART, "GD2", + (gdImagePtr(*)())gdImageCreateFromGd2Part, + (gdImagePtr(*)())gdImageCreateFromGd2PartCtx); + return Object(new Image(im)); +} + +bool f_imagexbm(CObjRef image, CStrRef filename /* = null_string */, + int foreground /* = -1 */) { + throw NotSupportedException(__func__, "gdImageXbmCtx does not exist"); +} + +bool f_imagegif(CObjRef image, CStrRef filename /* = null_string */) { +#ifdef HAVE_GD_GIF_CTX + return _php_image_output_ctx(image, filename, -1, -1, + PHP_GDIMG_TYPE_GIF, "GIF", + (void (*)())gdImageGifCtx); +#else + return _php_image_output(image, filename, -1, -1, + PHP_GDIMG_TYPE_GIF, "GIF", + (void (*)())gdImageGif); +#endif +} + +bool f_imagepng(CObjRef image, CStrRef filename /* = null_string */, + int quality /* = -1 */, int filters /* = -1 */) { +#ifdef HAVE_GD_PNG +#ifdef USE_GD_IOCTX + return _php_image_output_ctx(image, filename, quality, filters, + PHP_GDIMG_TYPE_PNG, "PNG", + (void (*)())gdImagePngCtxEx); +#else + return _php_image_output(image, filename, quality, filters, + PHP_GDIMG_TYPE_PNG, "PNG", + (void (*)())gdImagePng); +#endif +#else + throw NotSupportedException(__func__, "HAVE_GD_PNG undefined"); +#endif +} + +bool f_imagejpeg(CObjRef image, CStrRef filename /* = null_string */, + int quality /* = -1 */) { +#ifdef HAVE_GD_JPG +#ifdef USE_GD_IOCTX + return _php_image_output_ctx(image, filename, quality, -1, + PHP_GDIMG_TYPE_JPG, "JPEG", + (void (*)())gdImageJpegCtx); +#else + return _php_image_output(image, filename, quality, -1, + PHP_GDIMG_TYPE_JPG, "JPEG", + (void (*)())gdImageJpeg); +#endif +#else + throw NotSupportedException(__func__, "HAVE_GD_JPG undefined"); +#endif +} + +bool f_imagewbmp(CObjRef image, CStrRef filename /* = null_string */, + int foreground /* = -1 */) { +#ifdef USE_GD_IOCTX + return _php_image_output_ctx(image, filename, foreground, -1, + PHP_GDIMG_TYPE_WBM, "WBMP", + (void (*)())gdImageWBMPCtx); +#else + retgurn _php_image_output(image, filename, foreground, -1, + PHP_GDIMG_TYPE_WBM, "WBMP", + (void (*)())gdImageWBMP); +#endif +} + +bool f_imagegd(CObjRef image, CStrRef filename /* = null_string */) { + return _php_image_output(image, filename, -1, -1, PHP_GDIMG_TYPE_GD, "GD", + (void (*)())gdImageGd); +} + +bool f_imagegd2(CObjRef image, CStrRef filename /* = null_string */, + int chunk_size /* = 0 */, int type /* = 0 */) { + return _php_image_output(image, filename, chunk_size, type, + PHP_GDIMG_TYPE_GD2, "GD2", + (void (*)())gdImageGd2); +} + +bool f_imagedestroy(CObjRef image) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageDestroy(im); + image.getTyped()->reset(); + return true; +} + +Variant f_imagecolorallocate(CObjRef image, int red, int green, int blue) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + int ct = gdImageColorAllocate(im, red, green, blue); + if (ct < 0) { + return false; + } + return ct; +} + +void f_imagepalettecopy(CObjRef destination, CObjRef source) { +/* + gdImagePtr dstim = destination.getTyped()->get(); + if (!dstim) return false; + gdImagePtr srcim = source.getTyped()->get(); + if (!srcim) return false; + + gdImagePaletteCopy(dstim, srcim); +*/ +} + +Variant f_imagecolorat(CObjRef image, int x, int y) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; +#if HAVE_LIBGD20 + if (gdImageTrueColor(im)) { + if (im->tpixels && gdImageBoundsSafe(im, x, y)) { + return gdImageTrueColorPixel(im, x, y); + } else { + Logger::Info("%ld,%ld is out of bounds", x, y); + return false; + } + } else { +#endif + if (im->pixels && gdImageBoundsSafe(im, x, y)) { +#if HAVE_LIBGD13 + return (im->pixels[y][x]); +#else + return (im->pixels[x][y]); +#endif + } else { + Logger::Info("%ld,%ld is out of bounds", x, y); + return false; + } +#if HAVE_LIBGD20 + } +#endif +} + +Variant f_imagecolorclosest(CObjRef image, int red, int green, int blue) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return gdImageColorClosest(im, red, green, blue); +} + +Variant f_imagecolorclosesthwb(CObjRef image, int red, int green, int blue) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return gdImageColorClosestHWB(im, red, green, blue); +} + +bool f_imagecolordeallocate(CObjRef image, int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; +#if HAVE_LIBGD20 + /* We can return right away for a truecolor image as deallocating colours + is meaningless here */ + if (gdImageTrueColor(im)) return true; +#endif + + if (color >= 0 && color < gdImageColorsTotal(im)) { + gdImageColorDeallocate(im, color); + return true; + } else { + Logger::Warning("Color index %d out of range", color); + return false; + } +} + +Variant f_imagecolorresolve(CObjRef image, int red, int green, int blue) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return gdImageColorResolve(im, red, green, blue); +} + +Variant f_imagecolorexact(CObjRef image, int red, int green, int blue) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return gdImageColorExact(im, red, green, blue); +} + +Variant f_imagecolorset(CObjRef image, int index, + int red, int green, int blue) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + if (index >= 0 && index < gdImageColorsTotal(im)) { + im->red[index] = red; + im->green[index] = green; + im->blue[index] = blue; + return true; + } else { + return false; + } +} + +Variant f_imagecolorsforindex(CObjRef image, int index) { + Array ret; + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; +#if HAVE_LIBGD20 + if ((index >= 0 && gdImageTrueColor(im)) || + (!gdImageTrueColor(im) && index >= 0 && + index < gdImageColorsTotal(im))) { + ret.set("red", gdImageRed(im,index)); + ret.set("green", gdImageGreen(im,index)); + ret.set("blue", gdImageBlue(im,index)); + ret.set("alpha", gdImageAlpha(im,index)); + } +#else + if (col >= 0 && col < gdImageColorsTotal(im)) { + ret.set("red", im->red[col]); + ret.set("green", im->green[col]); + ret.set("blue", im->blue[col]); + } +#endif + else { + Logger::Warning("Color index %d out of range", index); + return false; + } + return ret; +} + +bool f_imagegammacorrect(CObjRef image, double inputgamma, + double outputgamma) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; +#if HAVE_LIBGD20 + if (gdImageTrueColor(im)) { + int x, y, c; + + for (y = 0; y < gdImageSY(im); y++) { + for (x = 0; x < gdImageSX(im); x++) { + c = gdImageGetPixel(im, x, y); + gdImageSetPixel(im, x, y, + gdTrueColor((int)((pow((pow((gdTrueColorGetRed(c)/255.0), + inputgamma)),1.0/outputgamma)*255) + .5), + (int)((pow((pow((gdTrueColorGetGreen(c)/255.0), + inputgamma)),1.0/outputgamma) * 255) + .5), + (int)((pow((pow((gdTrueColorGetBlue(c)/255.0), + inputgamma)),1.0/outputgamma) * 255) + .5))); + } + } + return true; + } +#endif + for (int i = 0; i < gdImageColorsTotal(im); i++) { + im->red[i] = (int)((pow((pow((im->red[i]/255.0), inputgamma)), + 1.0/outputgamma)*255) + .5); + im->green[i] = (int)((pow((pow((im->green[i]/255.0), inputgamma)), + 1.0/outputgamma)*255) + .5); + im->blue[i] = (int)((pow((pow((im->blue[i]/255.0), inputgamma)), + 1.0/outputgamma)*255) + .5); + } + + return true; +} + +bool f_imagesetpixel(CObjRef image, int x, int y, int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageSetPixel(im, x, y, color); + return true; +} + +bool f_imageline(CObjRef image, int x1, int y1, int x2, int y2, int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageLine(im, x1, y1, x2, y2, color); + return true; +} + +bool f_imagedashedline(CObjRef image, int x1, int y1, int x2, int y2, + int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageDashedLine(im, x1, y1, x2, y2, color); + return true; +} + +bool f_imagerectangle(CObjRef image, int x1, int y1, + int x2, int y2, int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageRectangle(im, x1, y1, x2, y2, color); + return true; +} + +bool f_imagefilledrectangle(CObjRef image, int x1, int y1, + int x2, int y2, int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageFilledRectangle(im, x1, y1, x2, y2, color); + return true; +} + +bool f_imagearc(CObjRef image, int cx, int cy, int width, int height, + int start, int end, int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + if (end < 0) end %= 360; + if (start < 0) start %= 360; + gdImageArc(im, cx, cy, width, height, start, end, color); + return true; +} + +bool f_imageellipse(CObjRef image, int cx, int cy, int width, int height, + int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageArc(im, cx, cy, width, height, 0, 360, color); + return true; +} + +bool f_imagefilltoborder(CObjRef image, int x, int y, + int border, int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageFillToBorder(im, x, y, border, color); + return true; +} + +bool f_imagefill(CObjRef image, int x, int y, int color) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + gdImageFill(im, x, y, color); + return true; +} + +Variant f_imagecolorstotal(CObjRef image) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return (gdImageColorsTotal(im)); +} + +Variant f_imagecolortransparent(CObjRef image, int color /* = -1 */) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + if (color != -1) { + // has color argument + gdImageColorTransparent(im, color); + } + return gdImageGetTransparent(im); +} + +Variant f_imageinterlace(CObjRef image, int interlace /* = 0 */) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + if (interlace != 0) { + // has interlace argument + gdImageInterlace(im, interlace); + } + return gdImageGetInterlaced(im); +} + +bool f_imagepolygon(CObjRef image, CArrRef points, + int num_points, int color) { + return php_imagepolygon(image, points, num_points, color, 0); +} + +bool f_imagefilledpolygon(CObjRef image, CArrRef points, int num_points, + int color) { + return php_imagepolygon(image, points, num_points, color, 1); +} + +int f_imagefontwidth(int font) { + return php_imagefontsize(font, 0); +} + +int f_imagefontheight(int font) { + return php_imagefontsize(font, 1); +} + +bool f_imagechar(CObjRef image, int font, int x, int y, + CStrRef c, int color) { + return php_imagechar(image, font, x, y, c, color, 0); +} + +bool f_imagecharup(CObjRef image, int font, int x, int y, + CStrRef c, int color) { + return php_imagechar(image, font, x, y, c, color, 1); +} + +bool f_imagestring(CObjRef image, int font, int x, int y, + CStrRef str, int color) { + return php_imagechar(image, font, x, y, str, color, 2); +} + +bool f_imagestringup(CObjRef image, int font, int x, int y, + CStrRef str, int color) { + return php_imagechar(image, font, x, y, str, color, 3); +} + +bool f_imagecopy(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, + int src_x, int src_y, int src_w, int src_h) { + gdImagePtr im_src = src_im.getTyped()->get(); + if (!im_src) return false; + gdImagePtr im_dst = dst_im.getTyped()->get(); + if (!im_dst) return false; + gdImageCopy(im_dst, im_src, dst_x, dst_y, src_x, src_y, src_w, src_h); + return true; +} + +bool f_imagecopymerge(CObjRef dst_im, CObjRef src_im, + int dst_x, int dst_y, int src_x, int src_y, + int src_w, int src_h, int pct) { + gdImagePtr im_src = src_im.getTyped()->get(); + if (!im_src) return false; + gdImagePtr im_dst = dst_im.getTyped()->get(); + if (!im_dst) return false; +#if HAVE_LIBGD15 + gdImageCopyMerge(im_dst, im_src, dst_x, dst_y, + src_x, src_y, src_w, src_h, pct); + return true; +#else + throw NotSupportedException(__func__, "HAVE_LIBGD15 undefined"); +#endif +} + +bool f_imagecopymergegray(CObjRef dst_im, CObjRef src_im, + int dst_x, int dst_y, + int src_x, int src_y, + int src_w, int src_h, int pct) { + gdImagePtr im_src = src_im.getTyped()->get(); + if (!im_src) return false; + gdImagePtr im_dst = dst_im.getTyped()->get(); + if (!im_dst) return false; + gdImageCopyMergeGray(im_dst, im_src, dst_x, dst_y, + src_x, src_y, src_w, src_h, pct); + return true; +} + +bool f_imagecopyresized(CObjRef dst_im, CObjRef src_im, + int dst_x, int dst_y, int src_x, int src_y, + int dst_w, int dst_h, int src_w, int src_h) { + gdImagePtr im_src = src_im.getTyped()->get(); + if (!im_src) return false; + gdImagePtr im_dst = dst_im.getTyped()->get(); + if (!im_dst) return false; + if (dst_w <= 0 || dst_h <= 0 || src_w <= 0 || src_h <= 0) { + Logger::Warning("Invalid image dimensions"); + return false; + } + gdImageCopyResized(im_dst, im_src, + dst_x, dst_y, src_x, src_y, + dst_w, dst_h, src_w, src_h); + return true; +} + +Variant f_imagesx(CObjRef image) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return gdImageSX(im); +} + +Variant f_imagesy(CObjRef image) { + gdImagePtr im = image.getTyped()->get(); + if (!im) return false; + return gdImageSY(im); +} + +Variant f_imageftbbox(double size, double angle, CStrRef font_file, + CStrRef text, CArrRef extrainfo /* = null */) { +#if defined(ENABLE_GD_TTF) && HAVE_LIBGD20 && \ + HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX + return php_imagettftext_common(TTFTEXT_BBOX, 1, + size, angle, font_file, text, extrainfo); +#else + throw NotSupportedException(__func__, "ENABLE_GD_TTF undefined or " + "!(HAVE_LIBGD20 && HAVE_LIBFREETYPE && " + "HAVE_GD_STRINGFTEX)"); +#endif +} + +Variant f_imagefttext(CObjRef image, double size, double angle, + int x, int y, int col, CStrRef font_file, + CStrRef text, CArrRef extrainfo /* = null */) { +#if defined(ENABLE_GD_TTF) && HAVE_LIBGD20 && \ + HAVE_LIBFREETYPE && HAVE_GD_STRINGFTEX + return php_imagettftext_common(TTFTEXT_DRAW, 1, + image, size, angle, x, y, col, + font_file, text, extrainfo); +#else + throw NotSupportedException(__func__, "ENABLE_GD_TTF undefined or " + "!(HAVE_LIBGD20 && HAVE_LIBFREETYPE && " + "HAVE_GD_STRINGFTEX)"); +#endif +} + +Variant f_imagettfbbox(double size, double angle, + CStrRef fontfile, CStrRef text) { +#ifdef ENABLE_GD_TTF + return php_imagettftext_common(TTFTEXT_BBOX, 0, + size, angle, fontfile, text); +#else + throw NotSupportedException(__func__, "ENABLE_GD_TTF undefined"); +#endif +} + +Variant f_imagettftext(CObjRef image, double size, double angle, + int x, int y, int color, + CStrRef fontfile, CStrRef text) { +#ifdef ENABLE_GD_TTF + return php_imagettftext_common(TTFTEXT_DRAW, 0, + image, size, angle, x, y, color, + fontfile, text); +#else + throw NotSupportedException(__func__, "ENABLE_GD_TTF undefined"); +#endif +} + +Object f_imagepsloadfont(CStrRef filename) { +#ifdef HAVE_LIBT1 + #error config error: HAVE_LIBT1 defined! +#else + throw NotSupportedException(__func__, "HAVE_LIBT1 undefined"); +#endif +} + +bool f_imagepsfreefont(CObjRef fontindex) { +#ifdef HAVE_LIBT1 + #error config error: HAVE_LIBT1 defined! +#else + throw NotSupportedException(__func__, "HAVE_LIBT1 undefined"); +#endif +} + +bool f_imagepsencodefont(CObjRef font_index, CStrRef encodingfile) { +#ifdef HAVE_LIBT1 + #error config error: HAVE_LIBT1 defined! +#else + throw NotSupportedException(__func__, "HAVE_LIBT1 undefined"); +#endif +} + +bool f_imagepsextendfont(int font_index, double extend) { +#ifdef HAVE_LIBT1 + #error config error: HAVE_LIBT1 defined! +#else + throw NotSupportedException(__func__, "HAVE_LIBT1 undefined"); +#endif +} + +bool f_imagepsslantfont(CObjRef font_index, double slant) { +#ifdef HAVE_LIBT1 + #error config error: HAVE_LIBT1 defined! +#else + throw NotSupportedException(__func__, "HAVE_LIBT1 undefined"); +#endif +} + +Array f_imagepstext(CObjRef image, CStrRef text, CObjRef font, int size, + int foreground, int background, int x, int y, + int space /* = 0 */, int tightness /* = 0 */, + double angle /* = 0.0 */, + int antialias_steps /* = 0 */) { +#ifdef HAVE_LIBT1 + #error config error: HAVE_LIBT1 defined! +#else + throw NotSupportedException(__func__, "HAVE_LIBT1 undefined"); +#endif +} + +Array f_imagepsbbox(CStrRef text, int font, int size, int space /* = 0 */, + int tightness /* = 0 */, double angle /* = 0.0 */) { +#ifdef HAVE_LIBT1 + #error config error: HAVE_LIBT1 defined! +#else + throw NotSupportedException(__func__, "HAVE_LIBT1 undefined"); +#endif +} + +bool f_image2wbmp(CObjRef image, CStrRef filename /* = null_string */, + int threshold /* = -1 */) { +#ifdef HAVE_GD_WBMP + return _php_image_output(image, filename, threshold, -1, + PHP_GDIMG_CONVERT_WBM, "WBMP", + (void (*)())_php_image_bw_convert); +#else + throw NotSupportedException(__func__, "HAVE_GD_WBMP undefined"); +#endif +} + +bool f_jpeg2wbmp(CStrRef jpegname, CStrRef wbmpname, int dest_height, + int dest_width, int threshold) { + return _php_image_convert(jpegname, wbmpname, dest_height, dest_width, + threshold, PHP_GDIMG_TYPE_JPG); +} + +bool f_png2wbmp(CStrRef pngname, CStrRef wbmpname, int dest_height, + int dest_width, int threshold) { + return _php_image_convert(pngname, wbmpname, dest_height, dest_width, + threshold, PHP_GDIMG_TYPE_PNG); +} + +bool f_imagefilter(CObjRef image, int filtertype, + int arg1 /* = 0 */, int arg2 /* = 0 */, + int arg3 /* = 0 */, int arg4 /* = 0 */) { + typedef bool (*image_filter)(CObjRef, int, int, int, int); + image_filter filters[] = { + php_image_filter_negate , + php_image_filter_grayscale, + php_image_filter_brightness, + php_image_filter_contrast, + php_image_filter_colorize, + php_image_filter_edgedetect, + php_image_filter_emboss, + php_image_filter_gaussian_blur, + php_image_filter_selective_blur, + php_image_filter_mean_removal, + php_image_filter_smooth + }; + int num_filters = sizeof(filters)/sizeof(image_filter); + if (filtertype >= 0 && filtertype < num_filters) { + return filters[filtertype](image, arg1, arg2, arg3, arg4); + } + return false; +} + +// gdImageConvolution does not exist in our libgd.a, copied from +// php's libgd/gd.c + +/* Filters function added on 2003/12 + * by Pierre-Alain Joye (pajoye@pearfr.org) + **/ +/* Begin filters function */ +#ifndef HAVE_GET_TRUE_COLOR +#define GET_PIXEL_FUNCTION(src) \ + (src->trueColor?gdImageGetTrueColorPixel:gdImageGetPixel) +#endif +#undef MAX +#undef MIN +#define MAX(a,b) ((a)<(b)?(b):(a)) +#define MIN(a,b) ((a)<(b)?(a):(b)) + +static int gdImageConvolution(gdImagePtr src, float filter[3][3], + float filter_div, float offset) { + int x, y, i, j, new_a; + float new_r, new_g, new_b; + int new_pxl, pxl=0; + gdImagePtr srcback; + typedef int (*FuncPtr)(gdImagePtr, int, int); + FuncPtr f; + + if (src==NULL) { + return 0; + } + + /* We need the orinal image with each safe neoghb. pixel */ + srcback = gdImageCreateTrueColor (src->sx, src->sy); + gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy); + + if (srcback==NULL) { + return 0; + } + + f = GET_PIXEL_FUNCTION(src); + + for ( y=0; ysy; y++) { + for(x=0; xsx; x++) { + new_r = new_g = new_b = 0; + new_a = gdImageAlpha(srcback, pxl); + + for (j=0; j<3; j++) { + int yv = MIN(MAX(y - 1 + j, 0), src->sy - 1); + for (i=0; i<3; i++) { + pxl = f(srcback, MIN(MAX(x - 1 + i, 0), src->sx - 1), yv); + new_r += (float)gdImageRed(srcback, pxl) * filter[j][i]; + new_g += (float)gdImageGreen(srcback, pxl) * filter[j][i]; + new_b += (float)gdImageBlue(srcback, pxl) * filter[j][i]; + } + } + + new_r = (new_r/filter_div)+offset; + new_g = (new_g/filter_div)+offset; + new_b = (new_b/filter_div)+offset; + + new_r = (new_r > 255.0f)? 255.0f : ((new_r < 0.0f)? 0.0f:new_r); + new_g = (new_g > 255.0f)? 255.0f : ((new_g < 0.0f)? 0.0f:new_g); + new_b = (new_b > 255.0f)? 255.0f : ((new_b < 0.0f)? 0.0f:new_b); + + new_pxl = gdImageColorAllocateAlpha(src, (int)new_r, (int)new_g, + (int)new_b, new_a); + if (new_pxl == -1) { + new_pxl = gdImageColorClosestAlpha(src, (int)new_r, (int)new_g, + (int)new_b, new_a); + } + gdImageSetPixel (src, x, y, new_pxl); + } + } + gdImageDestroy(srcback); + return 1; +} + +bool f_imageconvolution(CObjRef image, CArrRef matrix, + double div, double offset) { + gdImagePtr im_src = image.getTyped()->get(); + if (!im_src) return false; + int nelem = matrix.size(); + int i, j; + float mtx[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}}; + Variant v; + Array row; + + if (nelem != 3) { + Logger::Warning("You must have 3x3 array"); + return false; + } + for (i=0; i<3; i++) { + if (matrix.exists(i) && (v = matrix[i]).isArray()) { + if ((row = toArray(v)).size() != 3) { + Logger::Warning("You must have 3x3 array"); + return false; + } + + for (j=0; j<3; j++) { + if (row.exists(j)) { + mtx[i][j] = toDouble(row[j]); + } else { + Logger::Warning("You must have a 3x3 matrix"); + return false; + } + } + } + } + if (gdImageConvolution(im_src, mtx, div, offset)) { + return true; + } else { + return false; + } +} + +bool f_imageantialias(CObjRef image, bool on) { + throw NotSupportedException(__func__, "gdImageAntialias does not exist"); + // gdImagePtr im = image.getTyped()->get(); + // if (!im) return false; + // gdImageAntialias(im, on); + // return true; +} + +// PHP extension STANDARD: iptc.c +static int php_iptc_put1(File *file, int spool, unsigned char c, + unsigned char **spoolbuf) { + if (spool > 0) { + g_context->out().write((const char *)&c, 1); + } + + if (spoolbuf) *(*spoolbuf)++ = c; + + return c; +} + +static int php_iptc_get1(File *file, int spool, unsigned char **spoolbuf) { + int c; + char cc; + + c = file->getc(); + + if (c == EOF) return EOF; + + if (spool > 0) { + cc = c; + g_context->out().write((const char *)&cc, 1); + } + + if (spoolbuf) *(*spoolbuf)++ = c; + + return c; +} + +static int php_iptc_read_remaining(File *file, int spool, + unsigned char **spoolbuf) { + while (php_iptc_get1(file, spool, spoolbuf) != EOF) continue; + + return M_EOI; +} + +static int php_iptc_skip_variable(File *file, int spool, + unsigned char **spoolbuf) { + unsigned int length; + int c1, c2; + + if ((c1 = php_iptc_get1(file, spool, spoolbuf)) == EOF) return M_EOI; + + if ((c2 = php_iptc_get1(file, spool, spoolbuf)) == EOF) return M_EOI; + + length = (((unsigned char) c1) << 8) + ((unsigned char) c2); + + length -= 2; + + while (length--) { + if (php_iptc_get1(file, spool, spoolbuf) == EOF) return M_EOI; + } + return 0; +} + +static int php_iptc_next_marker(File *file, int spool, + unsigned char **spoolbuf) { + int c; + + /* skip unimportant stuff */ + + c = php_iptc_get1(file, spool, spoolbuf); + + if (c == EOF) return M_EOI; + + while (c != 0xff) { + if ((c = php_iptc_get1(file, spool, spoolbuf)) == EOF) { + return M_EOI; /* we hit EOF */ + } + } + + /* get marker byte, swallowing possible padding */ + do { + c = php_iptc_get1(file, 0, 0); + if (c == EOF) + return M_EOI; /* we hit EOF */ + else if (c == 0xff) + php_iptc_put1(file, spool, (unsigned char)c, spoolbuf); + } while (c == 0xff); + + return (unsigned int) c; +} + +Variant f_iptcembed(CStrRef iptcdata, CStrRef jpeg_file_name, + int spool /* = 0 */) { + char psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0"; + unsigned int iptcdata_len = iptcdata.length(); + unsigned int marker, inx; + unsigned char *spoolbuf = NULL, *poi = NULL; + bool done = false; + bool written = false; + + Variant stream = f_fopen(jpeg_file_name, "rb"); + if (same(stream, false)) { + Logger::Warning("failed to open file: %s", jpeg_file_name.c_str()); + return false; + } + if (spool < 2) { + Array stat = f_fstat(stream); + int st_size = stat["size"]; + poi = spoolbuf = + (unsigned char *)malloc(iptcdata_len + sizeof(psheader) + + st_size + 1024 + 1); + memset(poi, 0, iptcdata_len + sizeof(psheader) + st_size + 1024 + 1); + } + File *file = Object(stream).getTyped(); + if (php_iptc_get1(file, spool, poi?&poi:0) != 0xFF) { + f_fclose(stream); + if (spoolbuf) { + free(spoolbuf); + } + return false; + } + + if (php_iptc_get1(file, spool, poi?&poi:0) != 0xD8) { + f_fclose(stream); + if (spoolbuf) { + free(spoolbuf); + } + return false; + } + + while (!done) { + marker = php_iptc_next_marker(file, spool, poi?&poi:0); + if (marker == M_EOI) { /* EOF */ + break; + } else if (marker != M_APP13) { + php_iptc_put1(file, spool, (unsigned char)marker, poi?&poi:0); + } + switch (marker) { + case M_APP13: + /* we are going to write a new APP13 marker, so don't + output the old one */ + php_iptc_skip_variable(file, 0, 0); + php_iptc_read_remaining(file, spool, poi?&poi:0); + done = true; + break; + + case M_APP0: + /* APP0 is in each and every JPEG, so when we hit APP0 + we insert our new APP13! */ + case M_APP1: + if (written) { + /* don't try to write the data twice */ + break; + } + written = true; + + php_iptc_skip_variable(file, spool, poi?&poi:0); + + if (iptcdata_len & 1) { + iptcdata_len++; /* make the length even */ + } + + psheader[2] = (iptcdata_len+28)>>8; + psheader[3] = (iptcdata_len+28)&0xff; + + for (inx = 0; inx < 28; inx++) { + php_iptc_put1(file, spool, psheader[inx], poi?&poi:0); + } + + php_iptc_put1(file, spool, (unsigned char)(iptcdata_len>>8), + poi?&poi:0); + php_iptc_put1(file, spool, (unsigned char)(iptcdata_len&0xff), + poi?&poi:0); + + for (inx = 0; inx < iptcdata_len; inx++) { + php_iptc_put1(file, spool, iptcdata.c_str()[inx], poi?&poi:0); + } + break; + + case M_SOS: + /* we hit data, no more marker-inserting can be done! */ + php_iptc_read_remaining(file, spool, poi?&poi:0); + done = true; + break; + + default: + php_iptc_skip_variable(file, spool, poi?&poi:0); + break; + } + } + + f_fclose(stream); + + if (spool < 2) { + return String((char *)spoolbuf, poi - spoolbuf, AttachString); + } + return true; +} + +Variant f_iptcparse(CStrRef iptcblock) { + unsigned int inx = 0, len, tagsfound = 0; + unsigned char *buffer, recnum, dataset, key[16]; + unsigned int str_len = iptcblock.length(); + Array ret; + + buffer = (unsigned char *)iptcblock.c_str(); + while (inx < str_len) { /* find 1st tag */ + if ((buffer[inx] == 0x1c) && + ((buffer[inx+1] == 0x01) || (buffer[inx+1] == 0x02))){ + break; + } else { + inx++; + } + } + + while (inx < str_len) { + if (buffer[ inx++ ] != 0x1c) { + /* we ran against some data which does not conform to IPTC - + stop parsing! */ + break; + } + + if ((inx + 4) >= str_len) + break; + + dataset = buffer[inx++]; + recnum = buffer[inx++]; + + if (buffer[inx] & (unsigned char) 0x80) { /* long tag */ + len = (((long)buffer[inx + 2]) << 24) + + (((long)buffer[inx + 3]) << 16) + + (((long)buffer[inx + 4]) << 8) + + (((long)buffer[inx + 5])); + inx += 6; + } else { /* short tag */ + len = (((unsigned short)buffer[inx])<<8) | + (unsigned short)buffer[inx+1]; + inx += 2; + } + + snprintf((char *)key, sizeof(key), "%d#%03d", + (unsigned int)dataset, (unsigned int)recnum); + + if ((len > str_len) || (inx + len) > str_len) { + break; + } + + String skey((const char *)key, CopyString); + if (!ret.exists(skey)) { + ret.set(skey, Array()); + } + ret.lvalAt(skey).append(String((const char *)(buffer+inx), len, + CopyString)); + inx += len; + tagsfound++; + } + + if (!tagsfound) { + return false; + } + return ret; +} + +// PHP extension exif.c +#define NUM_FORMATS 13 + +#define TAG_FMT_BYTE 1 +#define TAG_FMT_STRING 2 +#define TAG_FMT_USHORT 3 +#define TAG_FMT_ULONG 4 +#define TAG_FMT_URATIONAL 5 +#define TAG_FMT_SBYTE 6 +#define TAG_FMT_UNDEFINED 7 +#define TAG_FMT_SSHORT 8 +#define TAG_FMT_SLONG 9 +#define TAG_FMT_SRATIONAL 10 +#define TAG_FMT_SINGLE 11 +#define TAG_FMT_DOUBLE 12 +#define TAG_FMT_IFD 13 + +/* Describes tag values */ +#define TAG_GPS_VERSION_ID 0x0000 +#define TAG_GPS_LATITUDE_REF 0x0001 +#define TAG_GPS_LATITUDE 0x0002 +#define TAG_GPS_LONGITUDE_REF 0x0003 +#define TAG_GPS_LONGITUDE 0x0004 +#define TAG_GPS_ALTITUDE_REF 0x0005 +#define TAG_GPS_ALTITUDE 0x0006 +#define TAG_GPS_TIME_STAMP 0x0007 +#define TAG_GPS_SATELLITES 0x0008 +#define TAG_GPS_STATUS 0x0009 +#define TAG_GPS_MEASURE_MODE 0x000A +#define TAG_GPS_DOP 0x000B +#define TAG_GPS_SPEED_REF 0x000C +#define TAG_GPS_SPEED 0x000D +#define TAG_GPS_TRACK_REF 0x000E +#define TAG_GPS_TRACK 0x000F +#define TAG_GPS_IMG_DIRECTION_REF 0x0010 +#define TAG_GPS_IMG_DIRECTION 0x0011 +#define TAG_GPS_MAP_DATUM 0x0012 +#define TAG_GPS_DEST_LATITUDE_REF 0x0013 +#define TAG_GPS_DEST_LATITUDE 0x0014 +#define TAG_GPS_DEST_LONGITUDE_REF 0x0015 +#define TAG_GPS_DEST_LONGITUDE 0x0016 +#define TAG_GPS_DEST_BEARING_REF 0x0017 +#define TAG_GPS_DEST_BEARING 0x0018 +#define TAG_GPS_DEST_DISTANCE_REF 0x0019 +#define TAG_GPS_DEST_DISTANCE 0x001A +#define TAG_GPS_PROCESSING_METHOD 0x001B +#define TAG_GPS_AREA_INFORMATION 0x001C +#define TAG_GPS_DATE_STAMP 0x001D +#define TAG_GPS_DIFFERENTIAL 0x001E +#define TAG_TIFF_COMMENT 0x00FE /* SHOUDLNT HAPPEN */ +#define TAG_NEW_SUBFILE 0x00FE /* New version of subfile tag */ +#define TAG_SUBFILE_TYPE 0x00FF /* Old version of subfile tag */ +#define TAG_IMAGEWIDTH 0x0100 +#define TAG_IMAGEHEIGHT 0x0101 +#define TAG_BITS_PER_SAMPLE 0x0102 +#define TAG_COMPRESSION 0x0103 +#define TAG_PHOTOMETRIC_INTERPRETATION 0x0106 +#define TAG_TRESHHOLDING 0x0107 +#define TAG_CELL_WIDTH 0x0108 +#define TAG_CELL_HEIGHT 0x0109 +#define TAG_FILL_ORDER 0x010A +#define TAG_DOCUMENT_NAME 0x010D +#define TAG_IMAGE_DESCRIPTION 0x010E +#define TAG_MAKE 0x010F +#define TAG_MODEL 0x0110 +#define TAG_STRIP_OFFSETS 0x0111 +#define TAG_ORIENTATION 0x0112 +#define TAG_SAMPLES_PER_PIXEL 0x0115 +#define TAG_ROWS_PER_STRIP 0x0116 +#define TAG_STRIP_BYTE_COUNTS 0x0117 +#define TAG_MIN_SAMPPLE_VALUE 0x0118 +#define TAG_MAX_SAMPLE_VALUE 0x0119 +#define TAG_X_RESOLUTION 0x011A +#define TAG_Y_RESOLUTION 0x011B +#define TAG_PLANAR_CONFIGURATION 0x011C +#define TAG_PAGE_NAME 0x011D +#define TAG_X_POSITION 0x011E +#define TAG_Y_POSITION 0x011F +#define TAG_FREE_OFFSETS 0x0120 +#define TAG_FREE_BYTE_COUNTS 0x0121 +#define TAG_GRAY_RESPONSE_UNIT 0x0122 +#define TAG_GRAY_RESPONSE_CURVE 0x0123 +#define TAG_RESOLUTION_UNIT 0x0128 +#define TAG_PAGE_NUMBER 0x0129 +#define TAG_TRANSFER_FUNCTION 0x012D +#define TAG_SOFTWARE 0x0131 +#define TAG_DATETIME 0x0132 +#define TAG_ARTIST 0x013B +#define TAG_HOST_COMPUTER 0x013C +#define TAG_PREDICTOR 0x013D +#define TAG_WHITE_POINT 0x013E +#define TAG_PRIMARY_CHROMATICITIES 0x013F +#define TAG_COLOR_MAP 0x0140 +#define TAG_HALFTONE_HINTS 0x0141 +#define TAG_TILE_WIDTH 0x0142 +#define TAG_TILE_LENGTH 0x0143 +#define TAG_TILE_OFFSETS 0x0144 +#define TAG_TILE_BYTE_COUNTS 0x0145 +#define TAG_SUB_IFD 0x014A +#define TAG_INK_SETMPUTER 0x014C +#define TAG_INK_NAMES 0x014D +#define TAG_NUMBER_OF_INKS 0x014E +#define TAG_DOT_RANGE 0x0150 +#define TAG_TARGET_PRINTER 0x0151 +#define TAG_EXTRA_SAMPLE 0x0152 +#define TAG_SAMPLE_FORMAT 0x0153 +#define TAG_S_MIN_SAMPLE_VALUE 0x0154 +#define TAG_S_MAX_SAMPLE_VALUE 0x0155 +#define TAG_TRANSFER_RANGE 0x0156 +#define TAG_JPEG_TABLES 0x015B +#define TAG_JPEG_PROC 0x0200 +#define TAG_JPEG_INTERCHANGE_FORMAT 0x0201 +#define TAG_JPEG_INTERCHANGE_FORMAT_LEN 0x0202 +#define TAG_JPEG_RESTART_INTERVAL 0x0203 +#define TAG_JPEG_LOSSLESS_PREDICTOR 0x0205 +#define TAG_JPEG_POINT_TRANSFORMS 0x0206 +#define TAG_JPEG_Q_TABLES 0x0207 +#define TAG_JPEG_DC_TABLES 0x0208 +#define TAG_JPEG_AC_TABLES 0x0209 +#define TAG_YCC_COEFFICIENTS 0x0211 +#define TAG_YCC_SUB_SAMPLING 0x0212 +#define TAG_YCC_POSITIONING 0x0213 +#define TAG_REFERENCE_BLACK_WHITE 0x0214 +/* 0x0301 - 0x0302 */ +/* 0x0320 */ +/* 0x0343 */ +/* 0x5001 - 0x501B */ +/* 0x5021 - 0x503B */ +/* 0x5090 - 0x5091 */ +/* 0x5100 - 0x5101 */ +/* 0x5110 - 0x5113 */ +/* 0x80E3 - 0x80E6 */ +/* 0x828d - 0x828F */ +#define TAG_COPYRIGHT 0x8298 +#define TAG_EXPOSURETIME 0x829A +#define TAG_FNUMBER 0x829D +#define TAG_EXIF_IFD_POINTER 0x8769 +#define TAG_ICC_PROFILE 0x8773 +#define TAG_EXPOSURE_PROGRAM 0x8822 +#define TAG_SPECTRAL_SENSITY 0x8824 +#define TAG_GPS_IFD_POINTER 0x8825 +#define TAG_ISOSPEED 0x8827 +#define TAG_OPTOELECTRIC_CONVERSION_F 0x8828 +/* 0x8829 - 0x882b */ +#define TAG_EXIFVERSION 0x9000 +#define TAG_DATE_TIME_ORIGINAL 0x9003 +#define TAG_DATE_TIME_DIGITIZED 0x9004 +#define TAG_COMPONENT_CONFIG 0x9101 +#define TAG_COMPRESSED_BITS_PER_PIXEL 0x9102 +#define TAG_SHUTTERSPEED 0x9201 +#define TAG_APERTURE 0x9202 +#define TAG_BRIGHTNESS_VALUE 0x9203 +#define TAG_EXPOSURE_BIAS_VALUE 0x9204 +#define TAG_MAX_APERTURE 0x9205 +#define TAG_SUBJECT_DISTANCE 0x9206 +#define TAG_METRIC_MODULE 0x9207 +#define TAG_LIGHT_SOURCE 0x9208 +#define TAG_FLASH 0x9209 +#define TAG_FOCAL_LENGTH 0x920A +/* 0x920B - 0x920D */ +/* 0x9211 - 0x9216 */ +#define TAG_SUBJECT_AREA 0x9214 +#define TAG_MAKER_NOTE 0x927C +#define TAG_USERCOMMENT 0x9286 +#define TAG_SUB_SEC_TIME 0x9290 +#define TAG_SUB_SEC_TIME_ORIGINAL 0x9291 +#define TAG_SUB_SEC_TIME_DIGITIZED 0x9292 +/* 0x923F */ +/* 0x935C */ +#define TAG_XP_TITLE 0x9C9B +#define TAG_XP_COMMENTS 0x9C9C +#define TAG_XP_AUTHOR 0x9C9D +#define TAG_XP_KEYWORDS 0x9C9E +#define TAG_XP_SUBJECT 0x9C9F +#define TAG_FLASH_PIX_VERSION 0xA000 +#define TAG_COLOR_SPACE 0xA001 +#define TAG_COMP_IMAGE_WIDTH 0xA002 /* compressed images only */ +#define TAG_COMP_IMAGE_HEIGHT 0xA003 +#define TAG_RELATED_SOUND_FILE 0xA004 +#define TAG_INTEROP_IFD_POINTER 0xA005 /* IFD pointer */ +#define TAG_FLASH_ENERGY 0xA20B +#define TAG_SPATIAL_FREQUENCY_RESPONSE 0xA20C +#define TAG_FOCALPLANE_X_RES 0xA20E +#define TAG_FOCALPLANE_Y_RES 0xA20F +#define TAG_FOCALPLANE_RESOLUTION_UNIT 0xA210 +#define TAG_SUBJECT_LOCATION 0xA214 +#define TAG_EXPOSURE_INDEX 0xA215 +#define TAG_SENSING_METHOD 0xA217 +#define TAG_FILE_SOURCE 0xA300 +#define TAG_SCENE_TYPE 0xA301 +#define TAG_CFA_PATTERN 0xA302 +#define TAG_CUSTOM_RENDERED 0xA401 +#define TAG_EXPOSURE_MODE 0xA402 +#define TAG_WHITE_BALANCE 0xA403 +#define TAG_DIGITAL_ZOOM_RATIO 0xA404 +#define TAG_FOCAL_LENGTH_IN_35_MM_FILM 0xA405 +#define TAG_SCENE_CAPTURE_TYPE 0xA406 +#define TAG_GAIN_CONTROL 0xA407 +#define TAG_CONTRAST 0xA408 +#define TAG_SATURATION 0xA409 +#define TAG_SHARPNESS 0xA40A +#define TAG_DEVICE_SETTING_DESCRIPTION 0xA40B +#define TAG_SUBJECT_DISTANCE_RANGE 0xA40C +#define TAG_IMAGE_UNIQUE_ID 0xA420 + +/* Olympus specific tags */ +#define TAG_OLYMPUS_SPECIALMODE 0x0200 +#define TAG_OLYMPUS_JPEGQUAL 0x0201 +#define TAG_OLYMPUS_MACRO 0x0202 +#define TAG_OLYMPUS_DIGIZOOM 0x0204 +#define TAG_OLYMPUS_SOFTWARERELEASE 0x0207 +#define TAG_OLYMPUS_PICTINFO 0x0208 +#define TAG_OLYMPUS_CAMERAID 0x0209 +/* end Olympus specific tags */ + +/* Internal */ +#define TAG_NONE -1 /* note that -1 <> 0xFFFF */ +#define TAG_COMPUTED_VALUE -2 +#define TAG_END_OF_LIST 0xFFFD + +/* Values for TAG_PHOTOMETRIC_INTERPRETATION */ +#define PMI_BLACK_IS_ZERO 0 +#define PMI_WHITE_IS_ZERO 1 +#define PMI_RGB 2 +#define PMI_PALETTE_COLOR 3 +#define PMI_TRANSPARENCY_MASK 4 +#define PMI_SEPARATED 5 +#define PMI_YCBCR 6 +#define PMI_CIELAB 8 + +typedef const struct { + unsigned short Tag; + char *Desc; +} tag_info_type; + +typedef tag_info_type tag_info_array[]; +typedef tag_info_type *tag_table_type; + +#define TAG_TABLE_END \ + {((unsigned short)TAG_NONE), "No tag value"},\ + {((unsigned short)TAG_COMPUTED_VALUE), "Computed value"},\ + {TAG_END_OF_LIST, ""} /* Important for exif_get_tagname() + IF value != "" function result is != false */ + +static const tag_info_array tag_table_IFD = { + { 0x000B, "ACDComment"}, + { 0x00FE, "NewSubFile"}, /* better name it 'ImageType' ? */ + { 0x00FF, "SubFile"}, + { 0x0100, "ImageWidth"}, + { 0x0101, "ImageLength"}, + { 0x0102, "BitsPerSample"}, + { 0x0103, "Compression"}, + { 0x0106, "PhotometricInterpretation"}, + { 0x010A, "FillOrder"}, + { 0x010D, "DocumentName"}, + { 0x010E, "ImageDescription"}, + { 0x010F, "Make"}, + { 0x0110, "Model"}, + { 0x0111, "StripOffsets"}, + { 0x0112, "Orientation"}, + { 0x0115, "SamplesPerPixel"}, + { 0x0116, "RowsPerStrip"}, + { 0x0117, "StripByteCounts"}, + { 0x0118, "MinSampleValue"}, + { 0x0119, "MaxSampleValue"}, + { 0x011A, "XResolution"}, + { 0x011B, "YResolution"}, + { 0x011C, "PlanarConfiguration"}, + { 0x011D, "PageName"}, + { 0x011E, "XPosition"}, + { 0x011F, "YPosition"}, + { 0x0120, "FreeOffsets"}, + { 0x0121, "FreeByteCounts"}, + { 0x0122, "GrayResponseUnit"}, + { 0x0123, "GrayResponseCurve"}, + { 0x0124, "T4Options"}, + { 0x0125, "T6Options"}, + { 0x0128, "ResolutionUnit"}, + { 0x0129, "PageNumber"}, + { 0x012D, "TransferFunction"}, + { 0x0131, "Software"}, + { 0x0132, "DateTime"}, + { 0x013B, "Artist"}, + { 0x013C, "HostComputer"}, + { 0x013D, "Predictor"}, + { 0x013E, "WhitePoint"}, + { 0x013F, "PrimaryChromaticities"}, + { 0x0140, "ColorMap"}, + { 0x0141, "HalfToneHints"}, + { 0x0142, "TileWidth"}, + { 0x0143, "TileLength"}, + { 0x0144, "TileOffsets"}, + { 0x0145, "TileByteCounts"}, + { 0x014A, "SubIFD"}, + { 0x014C, "InkSet"}, + { 0x014D, "InkNames"}, + { 0x014E, "NumberOfInks"}, + { 0x0150, "DotRange"}, + { 0x0151, "TargetPrinter"}, + { 0x0152, "ExtraSample"}, + { 0x0153, "SampleFormat"}, + { 0x0154, "SMinSampleValue"}, + { 0x0155, "SMaxSampleValue"}, + { 0x0156, "TransferRange"}, + { 0x0157, "ClipPath"}, + { 0x0158, "XClipPathUnits"}, + { 0x0159, "YClipPathUnits"}, + { 0x015A, "Indexed"}, + { 0x015B, "JPEGTables"}, + { 0x015F, "OPIProxy"}, + { 0x0200, "JPEGProc"}, + { 0x0201, "JPEGInterchangeFormat"}, + { 0x0202, "JPEGInterchangeFormatLength"}, + { 0x0203, "JPEGRestartInterval"}, + { 0x0205, "JPEGLosslessPredictors"}, + { 0x0206, "JPEGPointTransforms"}, + { 0x0207, "JPEGQTables"}, + { 0x0208, "JPEGDCTables"}, + { 0x0209, "JPEGACTables"}, + { 0x0211, "YCbCrCoefficients"}, + { 0x0212, "YCbCrSubSampling"}, + { 0x0213, "YCbCrPositioning"}, + { 0x0214, "ReferenceBlackWhite"}, + { 0x02BC, "ExtensibleMetadataPlatform"}, + /* XAP: Extensible Authoring Publishing, obsoleted by XMP: + Extensible Metadata Platform */ + { 0x0301, "Gamma"}, + { 0x0302, "ICCProfileDescriptor"}, + { 0x0303, "SRGBRenderingIntent"}, + { 0x0320, "ImageTitle"}, + { 0x5001, "ResolutionXUnit"}, + { 0x5002, "ResolutionYUnit"}, + { 0x5003, "ResolutionXLengthUnit"}, + { 0x5004, "ResolutionYLengthUnit"}, + { 0x5005, "PrintFlags"}, + { 0x5006, "PrintFlagsVersion"}, + { 0x5007, "PrintFlagsCrop"}, + { 0x5008, "PrintFlagsBleedWidth"}, + { 0x5009, "PrintFlagsBleedWidthScale"}, + { 0x500A, "HalftoneLPI"}, + { 0x500B, "HalftoneLPIUnit"}, + { 0x500C, "HalftoneDegree"}, + { 0x500D, "HalftoneShape"}, + { 0x500E, "HalftoneMisc"}, + { 0x500F, "HalftoneScreen"}, + { 0x5010, "JPEGQuality"}, + { 0x5011, "GridSize"}, + { 0x5012, "ThumbnailFormat"}, + { 0x5013, "ThumbnailWidth"}, + { 0x5014, "ThumbnailHeight"}, + { 0x5015, "ThumbnailColorDepth"}, + { 0x5016, "ThumbnailPlanes"}, + { 0x5017, "ThumbnailRawBytes"}, + { 0x5018, "ThumbnailSize"}, + { 0x5019, "ThumbnailCompressedSize"}, + { 0x501A, "ColorTransferFunction"}, + { 0x501B, "ThumbnailData"}, + { 0x5020, "ThumbnailImageWidth"}, + { 0x5021, "ThumbnailImageHeight"}, + { 0x5022, "ThumbnailBitsPerSample"}, + { 0x5023, "ThumbnailCompression"}, + { 0x5024, "ThumbnailPhotometricInterp"}, + { 0x5025, "ThumbnailImageDescription"}, + { 0x5026, "ThumbnailEquipMake"}, + { 0x5027, "ThumbnailEquipModel"}, + { 0x5028, "ThumbnailStripOffsets"}, + { 0x5029, "ThumbnailOrientation"}, + { 0x502A, "ThumbnailSamplesPerPixel"}, + { 0x502B, "ThumbnailRowsPerStrip"}, + { 0x502C, "ThumbnailStripBytesCount"}, + { 0x502D, "ThumbnailResolutionX"}, + { 0x502E, "ThumbnailResolutionY"}, + { 0x502F, "ThumbnailPlanarConfig"}, + { 0x5030, "ThumbnailResolutionUnit"}, + { 0x5031, "ThumbnailTransferFunction"}, + { 0x5032, "ThumbnailSoftwareUsed"}, + { 0x5033, "ThumbnailDateTime"}, + { 0x5034, "ThumbnailArtist"}, + { 0x5035, "ThumbnailWhitePoint"}, + { 0x5036, "ThumbnailPrimaryChromaticities"}, + { 0x5037, "ThumbnailYCbCrCoefficients"}, + { 0x5038, "ThumbnailYCbCrSubsampling"}, + { 0x5039, "ThumbnailYCbCrPositioning"}, + { 0x503A, "ThumbnailRefBlackWhite"}, + { 0x503B, "ThumbnailCopyRight"}, + { 0x5090, "LuminanceTable"}, + { 0x5091, "ChrominanceTable"}, + { 0x5100, "FrameDelay"}, + { 0x5101, "LoopCount"}, + { 0x5110, "PixelUnit"}, + { 0x5111, "PixelPerUnitX"}, + { 0x5112, "PixelPerUnitY"}, + { 0x5113, "PaletteHistogram"}, + { 0x1000, "RelatedImageFileFormat"}, + { 0x800D, "ImageID"}, + { 0x80E3, "Matteing"}, /* obsoleted by ExtraSamples */ + { 0x80E4, "DataType"}, /* obsoleted by SampleFormat */ + { 0x80E5, "ImageDepth"}, + { 0x80E6, "TileDepth"}, + { 0x828D, "CFARepeatPatternDim"}, + { 0x828E, "CFAPattern"}, + { 0x828F, "BatteryLevel"}, + { 0x8298, "Copyright"}, + { 0x829A, "ExposureTime"}, + { 0x829D, "FNumber"}, + { 0x83BB, "IPTC/NAA"}, + { 0x84E3, "IT8RasterPadding"}, + { 0x84E5, "IT8ColorTable"}, + { 0x8649, "ImageResourceInformation"}, /* PhotoShop */ + { 0x8769, "Exif_IFD_Pointer"}, + { 0x8773, "ICC_Profile"}, + { 0x8822, "ExposureProgram"}, + { 0x8824, "SpectralSensity"}, + { 0x8828, "OECF"}, + { 0x8825, "GPS_IFD_Pointer"}, + { 0x8827, "ISOSpeedRatings"}, + { 0x8828, "OECF"}, + { 0x9000, "ExifVersion"}, + { 0x9003, "DateTimeOriginal"}, + { 0x9004, "DateTimeDigitized"}, + { 0x9101, "ComponentsConfiguration"}, + { 0x9102, "CompressedBitsPerPixel"}, + { 0x9201, "ShutterSpeedValue"}, + { 0x9202, "ApertureValue"}, + { 0x9203, "BrightnessValue"}, + { 0x9204, "ExposureBiasValue"}, + { 0x9205, "MaxApertureValue"}, + { 0x9206, "SubjectDistance"}, + { 0x9207, "MeteringMode"}, + { 0x9208, "LightSource"}, + { 0x9209, "Flash"}, + { 0x920A, "FocalLength"}, + { 0x920B, "FlashEnergy"}, /* 0xA20B in JPEG */ + { 0x920C, "SpatialFrequencyResponse"}, /* 0xA20C - - */ + { 0x920D, "Noise"}, + { 0x920E, "FocalPlaneXResolution"}, /* 0xA20E - - */ + { 0x920F, "FocalPlaneYResolution"}, /* 0xA20F - - */ + { 0x9210, "FocalPlaneResolutionUnit"}, /* 0xA210 - - */ + { 0x9211, "ImageNumber"}, + { 0x9212, "SecurityClassification"}, + { 0x9213, "ImageHistory"}, + { 0x9214, "SubjectLocation"}, /* 0xA214 - - */ + { 0x9215, "ExposureIndex"}, /* 0xA215 - - */ + { 0x9216, "TIFF/EPStandardID"}, + { 0x9217, "SensingMethod"}, /* 0xA217 - - */ + { 0x923F, "StoNits"}, + { 0x927C, "MakerNote"}, + { 0x9286, "UserComment"}, + { 0x9290, "SubSecTime"}, + { 0x9291, "SubSecTimeOriginal"}, + { 0x9292, "SubSecTimeDigitized"}, + { 0x935C, "ImageSourceData"}, + /* "Adobe Photoshop Document Data Block": 8BIM... */ + { 0x9c9b, "Title" }, /* Win XP specific, Unicode */ + { 0x9c9c, "Comments" }, /* Win XP specific, Unicode */ + { 0x9c9d, "Author" }, /* Win XP specific, Unicode */ + { 0x9c9e, "Keywords" }, /* Win XP specific, Unicode */ + { 0x9c9f, "Subject" }, /* Win XP specific, Unicode, + not to be confused with SubjectDistance + and SubjectLocation */ + { 0xA000, "FlashPixVersion"}, + { 0xA001, "ColorSpace"}, + { 0xA002, "ExifImageWidth"}, + { 0xA003, "ExifImageLength"}, + { 0xA004, "RelatedSoundFile"}, + { 0xA005, "InteroperabilityOffset"}, + { 0xA20B, "FlashEnergy"}, /* 0x920B in TIFF/EP */ + { 0xA20C, "SpatialFrequencyResponse"}, /* 0x920C - - */ + { 0xA20D, "Noise"}, + { 0xA20E, "FocalPlaneXResolution"}, /* 0x920E - - */ + { 0xA20F, "FocalPlaneYResolution"}, /* 0x920F - - */ + { 0xA210, "FocalPlaneResolutionUnit"}, /* 0x9210 - - */ + { 0xA211, "ImageNumber"}, + { 0xA212, "SecurityClassification"}, + { 0xA213, "ImageHistory"}, + { 0xA214, "SubjectLocation"}, /* 0x9214 - - */ + { 0xA215, "ExposureIndex"}, /* 0x9215 - - */ + { 0xA216, "TIFF/EPStandardID"}, + { 0xA217, "SensingMethod"}, /* 0x9217 - - */ + { 0xA300, "FileSource"}, + { 0xA301, "SceneType"}, + { 0xA302, "CFAPattern"}, + { 0xA401, "CustomRendered"}, + { 0xA402, "ExposureMode"}, + { 0xA403, "WhiteBalance"}, + { 0xA404, "DigitalZoomRatio"}, + { 0xA405, "FocalLengthIn35mmFilm"}, + { 0xA406, "SceneCaptureType"}, + { 0xA407, "GainControl"}, + { 0xA408, "Contrast"}, + { 0xA409, "Saturation"}, + { 0xA40A, "Sharpness"}, + { 0xA40B, "DeviceSettingDescription"}, + { 0xA40C, "SubjectDistanceRange"}, + { 0xA420, "ImageUniqueID"}, + TAG_TABLE_END +}; + +static const tag_info_array tag_table_GPS = { + { 0x0000, "GPSVersion"}, + { 0x0001, "GPSLatitudeRef"}, + { 0x0002, "GPSLatitude"}, + { 0x0003, "GPSLongitudeRef"}, + { 0x0004, "GPSLongitude"}, + { 0x0005, "GPSAltitudeRef"}, + { 0x0006, "GPSAltitude"}, + { 0x0007, "GPSTimeStamp"}, + { 0x0008, "GPSSatellites"}, + { 0x0009, "GPSStatus"}, + { 0x000A, "GPSMeasureMode"}, + { 0x000B, "GPSDOP"}, + { 0x000C, "GPSSpeedRef"}, + { 0x000D, "GPSSpeed"}, + { 0x000E, "GPSTrackRef"}, + { 0x000F, "GPSTrack"}, + { 0x0010, "GPSImgDirectionRef"}, + { 0x0011, "GPSImgDirection"}, + { 0x0012, "GPSMapDatum"}, + { 0x0013, "GPSDestLatitudeRef"}, + { 0x0014, "GPSDestLatitude"}, + { 0x0015, "GPSDestLongitudeRef"}, + { 0x0016, "GPSDestLongitude"}, + { 0x0017, "GPSDestBearingRef"}, + { 0x0018, "GPSDestBearing"}, + { 0x0019, "GPSDestDistanceRef"}, + { 0x001A, "GPSDestDistance"}, + { 0x001B, "GPSProcessingMode"}, + { 0x001C, "GPSAreaInformation"}, + { 0x001D, "GPSDateStamp"}, + { 0x001E, "GPSDifferential"}, + TAG_TABLE_END +}; + +static const tag_info_array tag_table_IOP = { + { 0x0001, "InterOperabilityIndex"}, /* should be 'R98' or 'THM' */ + { 0x0002, "InterOperabilityVersion"}, + { 0x1000, "RelatedFileFormat"}, + { 0x1001, "RelatedImageWidth"}, + { 0x1002, "RelatedImageHeight"}, + TAG_TABLE_END +}; + +static const tag_info_array tag_table_VND_CANON = { + { 0x0001, "ModeArray"}, /* guess */ + { 0x0004, "ImageInfo"}, /* guess */ + { 0x0006, "ImageType"}, + { 0x0007, "FirmwareVersion"}, + { 0x0008, "ImageNumber"}, + { 0x0009, "OwnerName"}, + { 0x000C, "Camera"}, + { 0x000F, "CustomFunctions"}, + TAG_TABLE_END +}; + +static const tag_info_array tag_table_VND_CASIO = { + { 0x0001, "RecordingMode"}, + { 0x0002, "Quality"}, + { 0x0003, "FocusingMode"}, + { 0x0004, "FlashMode"}, + { 0x0005, "FlashIntensity"}, + { 0x0006, "ObjectDistance"}, + { 0x0007, "WhiteBalance"}, + { 0x000A, "DigitalZoom"}, + { 0x000B, "Sharpness"}, + { 0x000C, "Contrast"}, + { 0x000D, "Saturation"}, + { 0x0014, "CCDSensitivity"}, + TAG_TABLE_END +}; + +static const tag_info_array tag_table_VND_FUJI = { + { 0x0000, "Version"}, + { 0x1000, "Quality"}, + { 0x1001, "Sharpness"}, + { 0x1002, "WhiteBalance"}, + { 0x1003, "Color"}, + { 0x1004, "Tone"}, + { 0x1010, "FlashMode"}, + { 0x1011, "FlashStrength"}, + { 0x1020, "Macro"}, + { 0x1021, "FocusMode"}, + { 0x1030, "SlowSync"}, + { 0x1031, "PictureMode"}, + { 0x1100, "ContTake"}, + { 0x1300, "BlurWarning"}, + { 0x1301, "FocusWarning"}, + { 0x1302, "AEWarning "}, + TAG_TABLE_END +}; + +static const tag_info_array tag_table_VND_NIKON = { + { 0x0003, "Quality"}, + { 0x0004, "ColorMode"}, + { 0x0005, "ImageAdjustment"}, + { 0x0006, "CCDSensitivity"}, + { 0x0007, "WhiteBalance"}, + { 0x0008, "Focus"}, + { 0x000a, "DigitalZoom"}, + { 0x000b, "Converter"}, + TAG_TABLE_END +}; + +static const tag_info_array tag_table_VND_NIKON_990 = { + { 0x0001, "Version"}, + { 0x0002, "ISOSetting"}, + { 0x0003, "ColorMode"}, + { 0x0004, "Quality"}, + { 0x0005, "WhiteBalance"}, + { 0x0006, "ImageSharpening"}, + { 0x0007, "FocusMode"}, + { 0x0008, "FlashSetting"}, + { 0x000F, "ISOSelection"}, + { 0x0080, "ImageAdjustment"}, + { 0x0082, "AuxiliaryLens"}, + { 0x0085, "ManualFocusDistance"}, + { 0x0086, "DigitalZoom"}, + { 0x0088, "AFFocusPosition"}, + { 0x0010, "DataDump"}, + TAG_TABLE_END +}; + +static const tag_info_array tag_table_VND_OLYMPUS = { + { 0x0200, "SpecialMode"}, + { 0x0201, "JPEGQuality"}, + { 0x0202, "Macro"}, + { 0x0204, "DigitalZoom"}, + { 0x0207, "SoftwareRelease"}, + { 0x0208, "PictureInfo"}, + { 0x0209, "CameraId"}, + { 0x0F00, "DataDump"}, + TAG_TABLE_END +}; + +typedef enum mn_byte_order_t { + MN_ORDER_INTEL = 0, + MN_ORDER_MOTOROLA = 1, + MN_ORDER_NORMAL +} mn_byte_order_t; + +typedef enum mn_offset_mode_t { + MN_OFFSET_NORMAL, + MN_OFFSET_MAKER, + MN_OFFSET_GUESS +} mn_offset_mode_t; + +typedef struct { + tag_table_type tag_table; + char *make; + char *model; + char *id_string; + int id_string_len; + int offset; + mn_byte_order_t byte_order; + mn_offset_mode_t offset_mode; +} maker_note_type; + +static const maker_note_type maker_note_array[] = { + { tag_table_VND_CANON, "Canon", NULL, NULL, + 0, 0, MN_ORDER_INTEL, MN_OFFSET_GUESS}, +/* { tag_table_VND_CANON, "Canon", NULL, NULL, + 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},*/ + { tag_table_VND_CASIO, "CASIO", NULL, NULL, + 0, 0, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL}, + { tag_table_VND_FUJI, "FUJIFILM", NULL, "FUJIFILM\x0C\x00\x00\x00", + 12, 12, MN_ORDER_INTEL, MN_OFFSET_MAKER}, + { tag_table_VND_NIKON, "NIKON", NULL, "Nikon\x00\x01\x00", + 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, + { tag_table_VND_NIKON_990, "NIKON", NULL, NULL, + 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, + { tag_table_VND_OLYMPUS, "OLYMPUS OPTICAL CO.,LTD", + NULL, "OLYMP\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, +}; + +size_t php_strlcpy(char *dst, const char *src, size_t siz) { + char *d = dst; + const char *s = src; + size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) { + do { + if ((*d++ = *s++) == 0) + break; + } while (--n != 0); + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + return(s - src - 1); /* count does not include NUL */ +} + +/* Get headername for tag_num or NULL if not defined */ +static char * exif_get_tagname(int tag_num, char *ret, int len, + tag_table_type tag_table) { + int i, t; + char tmp[32]; + + for (i = 0; (t = tag_table[i].Tag) != TAG_END_OF_LIST; i++) { + if (t == tag_num) { + if (ret && len) { + php_strlcpy(ret, tag_table[i].Desc, abs(len)); + if (len < 0) { + memset(ret + strlen(ret), ' ', -len - strlen(ret) - 1); + ret[-len - 1] = '\0'; + } + return ret; + } + return tag_table[i].Desc; + } + } + + if (ret && len) { + snprintf(tmp, sizeof(tmp), "UndefinedTag:0x%04X", tag_num); + php_strlcpy(ret, tmp, abs(len)); + if (len < 0) { + memset(ret + strlen(ret), ' ', -len - strlen(ret) - 1); + ret[-len - 1] = '\0'; + } + return ret; + } + return ""; +} + +#define MAX_IFD_NESTING_LEVEL 100 + +#ifndef WORD +#define WORD unsigned short +#endif +#ifndef DWORD +#define DWORD unsigned int +#endif + +typedef struct { + int num; + int den; +} signed_rational; + +typedef struct { + unsigned int num; + unsigned int den; +} unsigned_rational; + +typedef union _image_info_value { + char *s; + unsigned u; + int i; + float f; + double d; + signed_rational sr; + unsigned_rational ur; + union _image_info_value *list; +} image_info_value; + +typedef struct { + WORD tag; + WORD format; + DWORD length; + DWORD dummy; /* value ptr of tiff directory entry */ + char *name; + image_info_value value; +} image_info_data; + +typedef struct { + int count; + image_info_data *list; +} image_info_list; + +#define SECTION_FILE 0 +#define SECTION_COMPUTED 1 +#define SECTION_ANY_TAG 2 +#define SECTION_IFD0 3 +#define SECTION_THUMBNAIL 4 +#define SECTION_COMMENT 5 +#define SECTION_APP0 6 +#define SECTION_EXIF 7 +#define SECTION_FPIX 8 +#define SECTION_GPS 9 +#define SECTION_INTEROP 10 +#define SECTION_APP12 11 +#define SECTION_WINXP 12 +#define SECTION_MAKERNOTE 13 +#define SECTION_COUNT 14 + +#define FOUND_FILE (1<2) { + sections[len-2] = '\0'; + } + return sections; +} + +/* + This structure stores Exif header image elements in a simple manner + Used to store camera data as extracted from the various ways that + it can be stored in a nexif header +*/ +typedef struct { + int type; + size_t size; + uchar *data; +} file_section; + +typedef struct { + int count; + file_section *list; +} file_section_list; + +typedef struct { + image_filetype filetype; + size_t width, height; + size_t size; + size_t offset; + char *data; +} thumbnail_data; + +typedef struct { + char *value; + size_t size; + int tag; +} xp_field_type; + +typedef struct { + int count; + xp_field_type *list; +} xp_field_list; + +/* This structure is used to store a section of a Jpeg file. */ +typedef struct { + File *infile; + String FileName; + time_t FileDateTime; + size_t FileSize; + image_filetype FileType; + int Height, Width; + int IsColor; + char *make; + char *model; + + float ApertureFNumber; + float ExposureTime; + double FocalplaneUnits; + float CCDWidth; + double FocalplaneXRes; + size_t ExifImageWidth; + float FocalLength; + float Distance; + + int motorola_intel; /* 1 Motorola; 0 Intel */ + + char *UserComment; + int UserCommentLength; + char *UserCommentEncoding; + char *encode_unicode; + char *decode_unicode_be; + char *decode_unicode_le; + char *encode_jis; + char *decode_jis_be; + char *decode_jis_le; + /* EXIF standard defines Copyright as + " [ '\0' ] ['\0']" */ + char *Copyright; + char *CopyrightPhotographer; + char *CopyrightEditor; + + xp_field_list xp_fields; + + thumbnail_data Thumbnail; + /* other */ + int sections_found; /* FOUND_ */ + image_info_list info_list[SECTION_COUNT]; + /* for parsing */ + bool read_thumbnail; + bool read_all; + int ifd_nesting_level; + /* internal */ + file_section_list file; +} image_info_type; + +typedef struct { + int bits_per_sample; + size_t width; + size_t height; + int num_components; +} jpeg_sof_info; + +/* forward declarations */ +static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, + char *dir_start, char *offset_base, + char *end, + size_t IFDlength, size_t displacement, + int section_index); +static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, + char *offset_base, char *end, size_t IFDlength, + size_t displacement, int section_index, + int ReadNextIFD, tag_table_type tag_table); + +/* + Add a file_section to image_info + returns the used block or -1. if size>0 and data == NULL buffer of + size is allocated +*/ +static int exif_file_sections_add(image_info_type *ImageInfo, int type, + size_t size, uchar *data) { + file_section *tmp; + int count = ImageInfo->file.count; + + tmp = (file_section *) + realloc(ImageInfo->file.list, (count+1) * sizeof(file_section)); + ImageInfo->file.list = tmp; + ImageInfo->file.list[count].type = 0xFFFF; + ImageInfo->file.list[count].data = NULL; + ImageInfo->file.list[count].size = 0; + ImageInfo->file.count = count+1; + if (!size) { + data = NULL; + } else if (data == NULL) { + data = (uchar *)malloc(size); + } + ImageInfo->file.list[count].type = type; + ImageInfo->file.list[count].data = data; + ImageInfo->file.list[count].size = size; + return count; +} + +/* get length of string if buffer if less than buffer size or buffer size */ +static size_t php_strnlen(char* str, size_t maxlen) { + size_t len = 0; + + if (str && maxlen && *str) { + do { + len++; + } while (--maxlen && *(++str)); + } + return len; +} + +// original Zend name is _estrndup +static char *php_strndup(const char* s, uint length) { + char *p; + + p = (char *)malloc(length+1); + memcpy(p, s, length); + p[length] = 0; + return p; +} + +/* Add a value to image_info */ +static void exif_iif_add_value(image_info_type *image_info, int section_index, + char *name, int tag, int format, int length, + void* value, int motorola_intel) { + size_t idex; + void *vptr; + image_info_value *info_value; + image_info_data *info_data; + image_info_data *list; + + if (length < 0) { + return; + } + + list = (image_info_data*)realloc(image_info->info_list[section_index].list, + (image_info->info_list[section_index].count+1) * + sizeof(image_info_data)); + image_info->info_list[section_index].list = list; + + info_data = &image_info->info_list[section_index]. + list[image_info->info_list[section_index].count]; + memset(info_data, 0, sizeof(image_info_data)); + info_data->tag = tag; + info_data->format = format; + info_data->length = length; + info_data->name = strdup(name); + info_value = &info_data->value; + + switch (format) { + case TAG_FMT_STRING: + if (value) { + length = php_strnlen((char*)value, length); + // TODO + // if (PG(magic_quotes_runtime)) { + // info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC); + // } else { + info_value->s = php_strndup((const char *)value, length); + // } + info_data->length = length; + } else { + info_data->length = 0; + info_value->s = strdup(""); + } + break; + + default: + /* Standard says more types possible but skip them... + * but allow users to handle data if they know how to + * So not return but use type UNDEFINED + * return; + */ + info_data->tag = TAG_FMT_UNDEFINED;/* otherwise not freed from memory */ + case TAG_FMT_SBYTE: + case TAG_FMT_BYTE: + /* in contrast to strings bytes do not need to allocate buffer for + NULL if length==0 */ + if (!length) + break; + case TAG_FMT_UNDEFINED: + if (value) { + /* do not recompute length here */ + // TODO + // if (PG(magic_quotes_runtime)) { + // info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC); + // } else { + info_value->s = php_strndup((const char*)value, length); + // } + info_data->length = length; + } else { + info_data->length = 0; + info_value->s = strdup(""); + } + break; + + case TAG_FMT_USHORT: + case TAG_FMT_ULONG: + case TAG_FMT_URATIONAL: + case TAG_FMT_SSHORT: + case TAG_FMT_SLONG: + case TAG_FMT_SRATIONAL: + case TAG_FMT_SINGLE: + case TAG_FMT_DOUBLE: + if (length==0) { + break; + } else if (length>1) { + info_value->list = + (image_info_value*)calloc(length, sizeof(image_info_value)); + } else { + info_value = &info_data->value; + } + for (idex=0,vptr=value; idex<(size_t)length; + idex++,vptr=(char *) vptr + get_php_tiff_bytes_per_format(format)) { + if (length>1) { + info_value = &info_data->value.list[idex]; + } + switch (format) { + case TAG_FMT_USHORT: + info_value->u = php_ifd_get16u(vptr, motorola_intel); + break; + + case TAG_FMT_ULONG: + info_value->u = php_ifd_get32u(vptr, motorola_intel); + break; + + case TAG_FMT_URATIONAL: + info_value->ur.num = php_ifd_get32u(vptr, motorola_intel); + info_value->ur.den = php_ifd_get32u(4+(char *)vptr, motorola_intel); + break; + + case TAG_FMT_SSHORT: + info_value->i = php_ifd_get16s(vptr, motorola_intel); + break; + + case TAG_FMT_SLONG: + info_value->i = php_ifd_get32s(vptr, motorola_intel); + break; + + case TAG_FMT_SRATIONAL: + info_value->sr.num = php_ifd_get32u(vptr, motorola_intel); + info_value->sr.den = php_ifd_get32u(4+(char *)vptr, motorola_intel); + break; + + case TAG_FMT_SINGLE: + info_value->f = *(float *)value; + + case TAG_FMT_DOUBLE: + info_value->d = *(double *)value; + break; + } + } + } + image_info->sections_found |= 1<info_list[section_index].count++; +} + +/* Add a tag from IFD to image_info */ +static void exif_iif_add_tag(image_info_type *image_info, int section_index, + char *name, int tag, int format, + size_t length, void* value) { + exif_iif_add_value(image_info, section_index, name, tag, format, + (int)length, value, image_info->motorola_intel); +} + +/* Evaluate number, be it int, rational, or float from directory. */ +static double exif_convert_any_format(void *value, int format, + int motorola_intel) { + int s_den; + unsigned u_den; + + switch(format) { + case TAG_FMT_SBYTE: + return *(signed char *)value; + case TAG_FMT_BYTE: + return *(uchar *)value; + + case TAG_FMT_USHORT: + return php_ifd_get16u(value, motorola_intel); + case TAG_FMT_ULONG: + return php_ifd_get32u(value, motorola_intel); + + case TAG_FMT_URATIONAL: + u_den = php_ifd_get32u(4+(char *)value, motorola_intel); + if (u_den == 0) { + return 0; + } else { + return (double)php_ifd_get32u(value, motorola_intel) / u_den; + } + + case TAG_FMT_SRATIONAL: + s_den = php_ifd_get32s(4+(char *)value, motorola_intel); + if (s_den == 0) { + return 0; + } else { + return (double)php_ifd_get32s(value, motorola_intel) / s_den; + } + + case TAG_FMT_SSHORT: + return (signed short)php_ifd_get16u(value, motorola_intel); + case TAG_FMT_SLONG: + return php_ifd_get32s(value, motorola_intel); + + /* Not sure if this is correct (never seen float used in Exif format) */ + case TAG_FMT_SINGLE: + return (double)*(float *)value; + case TAG_FMT_DOUBLE: + return *(double *)value; + } + return 0; +} + +/* Evaluate number, be it int, rational, or float from directory. */ +static size_t exif_convert_any_to_int(void *value, int format, + int motorola_intel) { + int s_den; + unsigned u_den; + + switch(format) { + case TAG_FMT_SBYTE: + return *(signed char *)value; + case TAG_FMT_BYTE: + return *(uchar *)value; + + case TAG_FMT_USHORT: + return php_ifd_get16u(value, motorola_intel); + case TAG_FMT_ULONG: + return php_ifd_get32u(value, motorola_intel); + + case TAG_FMT_URATIONAL: + u_den = php_ifd_get32u(4+(char *)value, motorola_intel); + if (u_den == 0) { + return 0; + } else { + return php_ifd_get32u(value, motorola_intel) / u_den; + } + + case TAG_FMT_SRATIONAL: + s_den = php_ifd_get32s(4+(char *)value, motorola_intel); + if (s_den == 0) { + return 0; + } else { + return php_ifd_get32s(value, motorola_intel) / s_den; + } + + case TAG_FMT_SSHORT: + return php_ifd_get16u(value, motorola_intel); + case TAG_FMT_SLONG: + return php_ifd_get32s(value, motorola_intel); + + /* Not sure if this is correct (never seen float used in Exif format) */ + case TAG_FMT_SINGLE: + return (size_t)*(float *)value; + case TAG_FMT_DOUBLE: + return (size_t)*(double *)value; + } + return 0; +} + +/* Get 16 bits motorola order (always) for jpeg header stuff. */ +static int php_jpg_get16(void *value) { + return (((uchar *)value)[0] << 8) | ((uchar *)value)[1]; +} + +/* Write 16 bit unsigned value to data */ +static void php_ifd_set16u(char *data, unsigned int value, int motorola_intel) { + if (motorola_intel) { + data[0] = (value & 0xFF00) >> 8; + data[1] = (value & 0x00FF); + } else { + data[1] = (value & 0xFF00) >> 8; + data[0] = (value & 0x00FF); + } +} + +/* Convert a 32 bit unsigned value from file's native byte order */ +static void php_ifd_set32u(char *data, size_t value, int motorola_intel) { + if (motorola_intel) { + data[0] = (value & 0xFF000000) >> 24; + data[1] = (value & 0x00FF0000) >> 16; + data[2] = (value & 0x0000FF00) >> 8; + data[3] = (value & 0x000000FF); + } else { + data[3] = (value & 0xFF000000) >> 24; + data[2] = (value & 0x00FF0000) >> 16; + data[1] = (value & 0x0000FF00) >> 8; + data[0] = (value & 0x000000FF); + } +} + +/* Create a value for an ifd from an info_data pointer */ +static void* exif_ifd_make_value(image_info_data *info_data, + int motorola_intel) { + size_t byte_count; + char *value_ptr, *data_ptr; + size_t i; + + image_info_value *info_value; + + byte_count = + get_php_tiff_bytes_per_format(info_data->format) * info_data->length; + value_ptr = (char *)malloc((byte_count > 4 ? byte_count : 4)); + memset(value_ptr, 0, 4); + if (!info_data->length) { + return value_ptr; + } + if (info_data->format == TAG_FMT_UNDEFINED || + info_data->format == TAG_FMT_STRING || + (byte_count>1 && (info_data->format == TAG_FMT_BYTE || + info_data->format == TAG_FMT_SBYTE))) { + memmove(value_ptr, info_data->value.s, byte_count); + return value_ptr; + } else if (info_data->format == TAG_FMT_BYTE) { + *value_ptr = info_data->value.u; + return value_ptr; + } else if (info_data->format == TAG_FMT_SBYTE) { + *value_ptr = info_data->value.i; + return value_ptr; + } else { + data_ptr = value_ptr; + for(i=0; ilength; i++) { + if (info_data->length==1) { + info_value = &info_data->value; + } else { + info_value = &info_data->value.list[i]; + } + switch(info_data->format) { + case TAG_FMT_USHORT: + php_ifd_set16u(data_ptr, info_value->u, motorola_intel); + data_ptr += 2; + break; + case TAG_FMT_ULONG: + php_ifd_set32u(data_ptr, info_value->u, motorola_intel); + data_ptr += 4; + break; + case TAG_FMT_SSHORT: + php_ifd_set16u(data_ptr, info_value->i, motorola_intel); + data_ptr += 2; + break; + case TAG_FMT_SLONG: + php_ifd_set32u(data_ptr, info_value->i, motorola_intel); + data_ptr += 4; + break; + case TAG_FMT_URATIONAL: + php_ifd_set32u(data_ptr, info_value->sr.num, motorola_intel); + php_ifd_set32u(data_ptr+4, info_value->sr.den, motorola_intel); + data_ptr += 8; + break; + case TAG_FMT_SRATIONAL: + php_ifd_set32u(data_ptr, info_value->ur.num, motorola_intel); + php_ifd_set32u(data_ptr+4, info_value->ur.den, motorola_intel); + data_ptr += 8; + break; + case TAG_FMT_SINGLE: + memmove(data_ptr, &info_data->value.f, byte_count); + data_ptr += 4; + break; + case TAG_FMT_DOUBLE: + memmove(data_ptr, &info_data->value.d, byte_count); + data_ptr += 8; + break; + } + } + } + return value_ptr; +} + +/* + Process a COM marker. + We want to print out the marker contents as legible text; + we must guard against random junk and varying newline representations. +*/ +static void exif_process_COM(image_info_type *image_info, char *value, + size_t length) { + exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", + TAG_COMPUTED_VALUE, TAG_FMT_STRING, + length-2, value+2); +} + +/* Check and build thumbnail */ +static void exif_thumbnail_build(image_info_type *ImageInfo) { + size_t new_size, new_move, new_value; + char *new_data; + void *value_ptr; + int i, byte_count; + image_info_list *info_list; + image_info_data *info_data; + + if (!ImageInfo->read_thumbnail || !ImageInfo->Thumbnail.offset || + !ImageInfo->Thumbnail.size) { + return; /* ignore this call */ + } + switch(ImageInfo->Thumbnail.filetype) { + default: + case IMAGE_FILETYPE_JPEG: + /* done */ + break; + case IMAGE_FILETYPE_TIFF_II: + case IMAGE_FILETYPE_TIFF_MM: + info_list = &ImageInfo->info_list[SECTION_THUMBNAIL]; + new_size = 8 + 2 + info_list->count * 12 + 4; + new_value= new_size; /* offset for ifd values outside ifd directory */ + for (i=0; icount; i++) { + info_data = &info_list->list[i]; + byte_count = + get_php_tiff_bytes_per_format(info_data->format) * info_data->length; + if (byte_count > 4) { + new_size += byte_count; + } + } + new_move = new_size; + new_data = (char *)realloc(ImageInfo->Thumbnail.data, + ImageInfo->Thumbnail.size + new_size); + ImageInfo->Thumbnail.data = new_data; + memmove(ImageInfo->Thumbnail.data + new_move, + ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size); + ImageInfo->Thumbnail.size += new_size; + /* fill in data */ + if (ImageInfo->motorola_intel) { + memmove(new_data, "MM\x00\x2a\x00\x00\x00\x08", 8); + } else { + memmove(new_data, "II\x2a\x00\x08\x00\x00\x00", 8); + } + new_data += 8; + php_ifd_set16u(new_data, info_list->count, ImageInfo->motorola_intel); + new_data += 2; + for (i=0; icount; i++) { + info_data = &info_list->list[i]; + byte_count = + get_php_tiff_bytes_per_format(info_data->format) * info_data->length; + if (info_data->tag==TAG_STRIP_OFFSETS || + info_data->tag==TAG_JPEG_INTERCHANGE_FORMAT) { + php_ifd_set16u(new_data + 0, info_data->tag, + ImageInfo->motorola_intel); + php_ifd_set16u(new_data + 2, TAG_FMT_ULONG, + ImageInfo->motorola_intel); + php_ifd_set32u(new_data + 4, 1, ImageInfo->motorola_intel); + php_ifd_set32u(new_data + 8, new_move, ImageInfo->motorola_intel); + } else { + php_ifd_set16u(new_data + 0, info_data->tag, + ImageInfo->motorola_intel); + php_ifd_set16u(new_data + 2, info_data->format, + ImageInfo->motorola_intel); + php_ifd_set32u(new_data + 4, info_data->length, + ImageInfo->motorola_intel); + value_ptr = exif_ifd_make_value(info_data, ImageInfo->motorola_intel); + if (byte_count <= 4) { + memmove(new_data+8, value_ptr, 4); + } else { + php_ifd_set32u(new_data+8, new_value, ImageInfo->motorola_intel); + memmove(ImageInfo->Thumbnail.data+new_value, value_ptr, byte_count); + new_value += byte_count; + } + free(value_ptr); + } + new_data += 12; + } + memset(new_data, 0, 4); /* next ifd pointer */ + break; + } +} + +/* Grab the thumbnail, corrected */ +static void exif_thumbnail_extract(image_info_type *ImageInfo, + char *offset, size_t length) { + if (ImageInfo->Thumbnail.data) { + Logger::Warning("Multiple possible thumbnails"); + return; /* Should not happen */ + } + if (!ImageInfo->read_thumbnail) { + return; /* ignore this call */ + } + /* according to exif2.1, the thumbnail is not supposed to be greater + than 64K */ + if (ImageInfo->Thumbnail.size >= 65536 || + ImageInfo->Thumbnail.size <= 0 || + ImageInfo->Thumbnail.offset <= 0) { + Logger::Warning("Illegal thumbnail size/offset"); + return; + } + /* Check to make sure we are not going to go past the ExifLength */ + if ((ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length) { + Logger::Warning("Thumbnail goes IFD boundary or end of file reached"); + return; + } + ImageInfo->Thumbnail.data = + php_strndup(offset + ImageInfo->Thumbnail.offset, + ImageInfo->Thumbnail.size); + exif_thumbnail_build(ImageInfo); +} + +/* Copy a string/buffer in Exif header to a character string and return + length of allocated buffer if any. */ +static int exif_process_undefined(char **result, char *value, + size_t byte_count) { + /* we cannot use strlcpy - here the problem is that we have to copy NUL + * chars up to byte_count, we also have to add a single NUL character to + * force end of string. + */ + if (byte_count) { + (*result) = php_strndup(value, byte_count); /* NULL @ byte_count!!! */ + return byte_count+1; + } + return 0; +} + +/* Copy a string in Exif header to a character string returns length of + allocated buffer if any. */ +#if !EXIF_USE_MBSTRING +static int exif_process_string_raw(char **result, char *value, + size_t byte_count) { + /* we cannot use strlcpy - here the problem is that we have to copy NUL + * chars up to byte_count, we also have to add a single NUL character to + * force end of string. + */ + if (byte_count) { + (*result) = (char*)malloc(byte_count + 1); + memcpy(*result, value, byte_count); + (*result)[byte_count] = '\0'; + return byte_count+1; + } + return 0; +} +#endif + +/* + * Copy a string in Exif header to a character string and return length of + allocated buffer if any. In contrast to exif_process_string this function + does allways return a string buffer */ +static int exif_process_string(char **result, char *value, + size_t byte_count) { + /* we cannot use strlcpy - here the problem is that we cannot use strlen to + * determin length of string and we cannot use strlcpy with len=byte_count+1 + * because then we might get into an EXCEPTION if we exceed an allocated + * memory page...so we use php_strnlen in conjunction with memcpy and add + * the NUL char. + */ + if ((byte_count=php_strnlen(value, byte_count)) > 0) { + return exif_process_undefined(result, value, byte_count); + } + (*result) = php_strndup("", 1); /* force empty string */ + return byte_count+1; +} + +/* Process UserComment in IFD. */ +static int exif_process_user_comment(image_info_type *ImageInfo, + char **pszInfoPtr, char **pszEncoding, + char *szValuePtr, int ByteCount) { + int a; + +#if EXIF_USE_MBSTRING + char *decode; + size_t len;; +#endif + + *pszEncoding = NULL; + /* Copy the comment */ + if (ByteCount>=8) { + if (!memcmp(szValuePtr, "UNICODE\0", 8)) { + *pszEncoding = strdup((const char*)szValuePtr); + szValuePtr = szValuePtr+8; + ByteCount -= 8; +#if EXIF_USE_MBSTRING + /* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16) + * since we have no encoding support for the BOM yet we skip that. + */ + if (!memcmp(szValuePtr, "\xFE\xFF", 2)) { + decode = "UCS-2BE"; + szValuePtr = szValuePtr+2; + ByteCount -= 2; + } else if (!memcmp(szValuePtr, "\xFF\xFE", 2)) { + decode = "UCS-2LE"; + szValuePtr = szValuePtr+2; + ByteCount -= 2; + } else if (ImageInfo->motorola_intel) { + decode = ImageInfo->decode_unicode_be; + } else { + decode = ImageInfo->decode_unicode_le; + } + *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, + ImageInfo->encode_unicode, + decode, &len); + return len; +#else + return exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount); +#endif + } else + if (!memcmp(szValuePtr, "ASCII\0\0\0", 8)) { + *pszEncoding = strdup((const char*)szValuePtr); + szValuePtr = szValuePtr+8; + ByteCount -= 8; + } else + if (!memcmp(szValuePtr, "JIS\0\0\0\0\0", 8)) { + /* JIS should be tanslated to MB or we leave it to the user - leave it to the user */ + *pszEncoding = strdup((const char*)szValuePtr); + szValuePtr = szValuePtr+8; + ByteCount -= 8; +#if EXIF_USE_MBSTRING + if (ImageInfo->motorola_intel) { + *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_jis, ImageInfo->decode_jis_be, &len); + } else { + *pszInfoPtr = php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_jis, ImageInfo->decode_jis_le, &len); + } + return len; +#else + return exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount); +#endif + } else + if (!memcmp(szValuePtr, "\0\0\0\0\0\0\0\0", 8)) { + /* 8 NULL means undefined and should be ASCII... */ + *pszEncoding = strdup("UNDEFINED"); + szValuePtr = szValuePtr+8; + ByteCount -= 8; + } + } + + /* Olympus has this padded with trailing spaces. Remove these first. */ + if (ByteCount>0) { + for (a=ByteCount-1;a && szValuePtr[a]==' ';a--) { + (szValuePtr)[a] = '\0'; + } + } + + /* normal text without encoding */ + exif_process_string(pszInfoPtr, szValuePtr, ByteCount); + return strlen(*pszInfoPtr); +} + +/* Process unicode field in IFD. */ +static int exif_process_unicode(image_info_type *ImageInfo, + xp_field_type *xp_field, int tag, + char *szValuePtr, int ByteCount) { + xp_field->tag = tag; + + /* Copy the comment */ +#if EXIF_USE_MBSTRING + xp_field->value = + php_mb_convert_encoding(szValuePtr, ByteCount, ImageInfo->encode_unicode, + ImageInfo->decode_unicode_le, &xp_field->size); + return xp_field->size; +#else + xp_field->size = + exif_process_string_raw(&xp_field->value, szValuePtr, ByteCount); + return xp_field->size; +#endif +} + +/* Process nested IFDs directories in Maker Note. */ +static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, + char * value_ptr, int value_len, + char *offset_base, size_t IFDlength, + size_t displacement) { + int de, section_index = SECTION_MAKERNOTE; + int NumDirEntries, old_motorola_intel, offset_diff; + const maker_note_type *maker_note; + char *dir_start; + char *value_end = value_ptr + value_len; + + for (unsigned int i=0; + i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) { + if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) + return 0; + maker_note = maker_note_array+i; + + if (maker_note->make && + (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make))) { + continue; + } + if (maker_note->model && + (!ImageInfo->model || strcmp(maker_note->model, ImageInfo->model))) { + continue; + } + if (maker_note->id_string && + strncmp(maker_note->id_string, value_ptr, + (maker_note->id_string_len < value_len ? + maker_note->id_string_len : value_len))) { + continue; + } + break; + } + + if (maker_note->offset >= value_len) return 0; + + dir_start = value_ptr + maker_note->offset; + ImageInfo->sections_found |= FOUND_MAKERNOTE; + + old_motorola_intel = ImageInfo->motorola_intel; + switch (maker_note->byte_order) { + case MN_ORDER_INTEL: + ImageInfo->motorola_intel = 0; + break; + case MN_ORDER_MOTOROLA: + ImageInfo->motorola_intel = 1; + break; + default: + case MN_ORDER_NORMAL: + break; + } + if (value_end - dir_start < 2) return 0; + NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); + + switch (maker_note->offset_mode) { + case MN_OFFSET_MAKER: + offset_base = value_ptr; + break; + case MN_OFFSET_GUESS: + if (value_end - (dir_start+10) < 4) return 0; + offset_diff = 2 + NumDirEntries*12 + 4 - + php_ifd_get32u(dir_start+10, ImageInfo->motorola_intel); + offset_base = value_ptr + offset_diff; + break; + default: + case MN_OFFSET_NORMAL: + break; + } + + if ((2+NumDirEntries*12) > value_len) { + Logger::Warning("Illegal IFD size: 2 + x%04X*12 = x%04X > x%04X", + NumDirEntries, 2+NumDirEntries*12, value_len); + return 0; + } + + for (de=0;detag_table)) { + return 0; + } + } + ImageInfo->motorola_intel = old_motorola_intel; + return 0; +} + +/* Process one of the nested IFDs directories. */ +static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, + char *offset_base, char *end, size_t IFDlength, + size_t displacement, int section_index, + int ReadNextIFD, tag_table_type tag_table) { + size_t length; + int tag, format, components; + char *value_ptr, tagname[64], cbuf[32], *outside=NULL; + size_t byte_count, offset_val, fpos, fgot; + xp_field_type *tmp_xp; + + /* Protect against corrupt headers */ + if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) { + Logger::Warning("corrupt EXIF header: maximum directory " + "nesting level reached"); + return 0; + } + ImageInfo->ifd_nesting_level++; + + CHECK_BUFFER_R(dir_entry+4, end, 4, 0); + tag = php_ifd_get16u(dir_entry, ImageInfo->motorola_intel); + format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); + components = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel); + + if (!format || format > NUM_FORMATS) { + /* (-1) catches illegal zero case as unsigned underflows to + positive large. */ + Logger::Warning("Process tag(x%04X=%s): Illegal format code 0x%04X, " + "suppose BYTE", tag, + exif_get_tagname(tag, tagname, -12, tag_table), format); + format = TAG_FMT_BYTE; + /*return TRUE;*/ + } + + byte_count = components * get_php_tiff_bytes_per_format(format); + + if ((ssize_t)byte_count < 0) { + Logger::Warning("Process tag(x%04X=%s): Illegal byte_count(%ld)", + tag, exif_get_tagname(tag, tagname, -12, tag_table), + byte_count); + return 0; + } + + if (byte_count > 4) { + CHECK_BUFFER_R(dir_entry+8, end, 4, 0); + offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); + /* If its bigger than 4 bytes, the dir entry contains an offset. */ + value_ptr = offset_base+offset_val; + if (offset_val+byte_count > IFDlength || value_ptr < dir_entry) { + /* + // It is important to check for IMAGE_FILETYPE_TIFF + // JPEG does not use absolute pointers instead its pointers are relative to the start + // of the TIFF header in APP1 section. + */ + if (offset_val+byte_count>ImageInfo->FileSize || + (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && + ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM && + ImageInfo->FileType!=IMAGE_FILETYPE_JPEG)) { + if (value_ptr < dir_entry) { + /* we can read this if offset_val > 0 */ + /* some files have their values in other parts of the file */ + Logger::Warning("Process tag(x%04X=%s): Illegal pointer offset" + "(x%04X < x%04X)", tag, + exif_get_tagname(tag, tagname, -12, tag_table), + offset_val, dir_entry); + } else { + /* this is for sure not allowed */ + /* exception are IFD pointers */ + Logger::Warning("Process tag(x%04X=%s): Illegal pointer offset" + "(x%04X + x%04X = x%04X > x%04X)", tag, + exif_get_tagname(tag, tagname, -12, tag_table), + offset_val, byte_count, offset_val+byte_count, + IFDlength); + } + return 1; + } + if (byte_count>sizeof(cbuf)) { + /* mark as outside range and get buffer */ + value_ptr = (char *)malloc(byte_count); + outside = value_ptr; + } else { + /* + // in most cases we only access a small range so + // it is faster to use a static buffer there + // BUT it offers also the possibility to have + // pointers read without the need to free them + // explicitley before returning. + */ + memset(&cbuf, 0, sizeof(cbuf)); + value_ptr = cbuf; + } + + fpos = ImageInfo->infile->tell(); + ImageInfo->infile->seek(offset_val, SEEK_SET); + fgot = ImageInfo->infile->tell(); + if (fgot!=offset_val) { + if (outside) free(outside); + Logger::Warning("Wrong file pointer: 0x%08X != 0x08X", + fgot, offset_val); + return 0; + } + String str = ImageInfo->infile->read(byte_count); + fgot = str.length(); + memcpy(value_ptr, str.c_str(), fgot); + ImageInfo->infile->seek(fpos, SEEK_SET); + if (fgotsections_found |= FOUND_ANY_TAG; + if (section_index==SECTION_THUMBNAIL) { + if (!ImageInfo->Thumbnail.data) { + switch(tag) { + case TAG_IMAGEWIDTH: + case TAG_COMP_IMAGE_WIDTH: + ImageInfo->Thumbnail.width = + exif_convert_any_to_int(value_ptr, format, + ImageInfo->motorola_intel); + break; + + case TAG_IMAGEHEIGHT: + case TAG_COMP_IMAGE_HEIGHT: + ImageInfo->Thumbnail.height = + exif_convert_any_to_int(value_ptr, format, + ImageInfo->motorola_intel); + break; + + case TAG_STRIP_OFFSETS: + case TAG_JPEG_INTERCHANGE_FORMAT: + /* accept both formats */ + ImageInfo->Thumbnail.offset = + exif_convert_any_to_int(value_ptr, format, + ImageInfo->motorola_intel); + break; + + case TAG_STRIP_BYTE_COUNTS: + if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || + ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM) { + ImageInfo->Thumbnail.filetype = ImageInfo->FileType; + } else { + /* motorola is easier to read */ + ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_TIFF_MM; + } + ImageInfo->Thumbnail.size = + exif_convert_any_to_int(value_ptr, format, + ImageInfo->motorola_intel); + break; + + case TAG_JPEG_INTERCHANGE_FORMAT_LEN: + if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) { + ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG; + ImageInfo->Thumbnail.size = + exif_convert_any_to_int(value_ptr, format, + ImageInfo->motorola_intel); + } + break; + } + } + } else { + if (section_index==SECTION_IFD0 || section_index==SECTION_EXIF) + switch(tag) { + case TAG_COPYRIGHT: + /* check for " NUL NUL" */ + if (byte_count>1 && (length=php_strnlen(value_ptr, byte_count)) > 0) { + if (lengthCopyrightPhotographer = strdup(value_ptr); + ImageInfo->CopyrightEditor = strdup(value_ptr+length+1); + vspprintf(&ImageInfo->Copyright, 0, "%s, %s", + value_ptr, value_ptr+length+1); + /* format = TAG_FMT_UNDEFINED; this musn't be ASCII */ + /* but we are not supposed to change this */ + /* keep in mind that image_info does not store editor value */ + } else { + ImageInfo->Copyright = strdup(value_ptr); + } + } + break; + + case TAG_USERCOMMENT: + ImageInfo->UserCommentLength = + exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), + &(ImageInfo->UserCommentEncoding), + value_ptr, byte_count); + break; + + case TAG_XP_TITLE: + case TAG_XP_COMMENTS: + case TAG_XP_AUTHOR: + case TAG_XP_KEYWORDS: + case TAG_XP_SUBJECT: + tmp_xp = + (xp_field_type*)realloc(ImageInfo->xp_fields.list, + (ImageInfo->xp_fields.count+1) * + sizeof(xp_field_type)); + ImageInfo->sections_found |= FOUND_WINXP; + ImageInfo->xp_fields.list = tmp_xp; + ImageInfo->xp_fields.count++; + exif_process_unicode(ImageInfo, + &(ImageInfo->xp_fields.list[ImageInfo->xp_fields.count-1]), + tag, value_ptr, byte_count); + break; + + case TAG_FNUMBER: + /* Simplest way of expressing aperture, so I trust it the most. + (overwrite previously computed value if there is one) */ + ImageInfo->ApertureFNumber = + (float)exif_convert_any_format(value_ptr, format, + ImageInfo->motorola_intel); + break; + + case TAG_APERTURE: + case TAG_MAX_APERTURE: + /* More relevant info always comes earlier, so only use this + field if we don't have appropriate aperture information yet. */ + if (ImageInfo->ApertureFNumber == 0) { + ImageInfo->ApertureFNumber + = (float)exp(exif_convert_any_format(value_ptr, format, + ImageInfo->motorola_intel)*log(2)*0.5); + } + break; + + case TAG_SHUTTERSPEED: + /* More complicated way of expressing exposure time, so only use + this value if we don't already have it from somewhere else. + SHUTTERSPEED comes after EXPOSURE TIME + */ + if (ImageInfo->ExposureTime == 0) { + ImageInfo->ExposureTime + = (float)(1/exp(exif_convert_any_format(value_ptr, format, + ImageInfo->motorola_intel)*log(2))); + } + break; + case TAG_EXPOSURETIME: + ImageInfo->ExposureTime = -1; + break; + + case TAG_COMP_IMAGE_WIDTH: + ImageInfo->ExifImageWidth = + exif_convert_any_to_int(value_ptr, format, + ImageInfo->motorola_intel); + break; + + case TAG_FOCALPLANE_X_RES: + ImageInfo->FocalplaneXRes = + exif_convert_any_format(value_ptr, format, + ImageInfo->motorola_intel); + break; + + case TAG_SUBJECT_DISTANCE: + /* Inidcates the distacne the autofocus camera is focused to. + Tends to be less accurate as distance increases. */ + ImageInfo->Distance = + (float)exif_convert_any_format(value_ptr, format, + ImageInfo->motorola_intel); + break; + + case TAG_FOCALPLANE_RESOLUTION_UNIT: + switch((int)exif_convert_any_format(value_ptr, format, + ImageInfo->motorola_intel)) { + case 1: ImageInfo->FocalplaneUnits = 25.4; break; /* inch */ + case 2: + /* According to the information I was using, 2 measn meters. + But looking at the Cannon powershot's files, inches is the only + sensible value. */ + ImageInfo->FocalplaneUnits = 25.4; + break; + + case 3: ImageInfo->FocalplaneUnits = 10; break; /* centimeter */ + case 4: ImageInfo->FocalplaneUnits = 1; break; /* milimeter */ + case 5: ImageInfo->FocalplaneUnits = .001; break; /* micrometer */ + } + break; + + case TAG_SUB_IFD: + if (format==TAG_FMT_IFD) { + /* If this is called we are either in a TIFFs thumbnail or + a JPEG where we cannot handle it */ + /* TIFF thumbnail: our data structure cannot store a thumbnail + of a thumbnail */ + /* JPEG do we have the data area and what to do with it */ + Logger::Info("Skip SUB IFD"); + } + break; + + case TAG_MAKE: + ImageInfo->make = strdup(value_ptr); + break; + case TAG_MODEL: + ImageInfo->model = strdup(value_ptr); + break; + + case TAG_MAKER_NOTE: + exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, + offset_base, IFDlength, displacement); + break; + + case TAG_EXIF_IFD_POINTER: + case TAG_GPS_IFD_POINTER: + case TAG_INTEROP_IFD_POINTER: + if (ReadNextIFD) { + char *Subdir_start; + int sub_section_index = 0; + switch(tag) { + case TAG_EXIF_IFD_POINTER: + ImageInfo->sections_found |= FOUND_EXIF; + sub_section_index = SECTION_EXIF; + break; + case TAG_GPS_IFD_POINTER: + ImageInfo->sections_found |= FOUND_GPS; + sub_section_index = SECTION_GPS; + break; + case TAG_INTEROP_IFD_POINTER: + ImageInfo->sections_found |= FOUND_INTEROP; + sub_section_index = SECTION_INTEROP; + break; + } + CHECK_BUFFER_R(value_ptr, end, 4, 0); + Subdir_start = offset_base + + php_ifd_get32u(value_ptr, ImageInfo->motorola_intel); + if (Subdir_start < offset_base || + Subdir_start > offset_base+IFDlength) { + Logger::Warning("Illegal IFD Pointer"); + return 0; + } + if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, + offset_base, end, IFDlength, + displacement, sub_section_index)) { + return 0; + } + } + } + } + exif_iif_add_tag(ImageInfo, section_index, + exif_get_tagname(tag, tagname, sizeof(tagname), tag_table), + tag, format, components, value_ptr); + if (outside) free(outside); + return 1; +} + +/* Process one of the nested IFDs directories. */ +static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, + char *dir_start, char *offset_base, + char *end, + size_t IFDlength, size_t displacement, + int section_index) { + int de; + int NumDirEntries; + int NextDirOffset; + + ImageInfo->sections_found |= FOUND_IFD0; + + CHECK_BUFFER_R(dir_start, end, 2, 0); + NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); + + if ((dir_start+2+NumDirEntries*12) > (offset_base+IFDlength)) { + Logger::Warning("Illegal IFD size: x%04X + 2 + x%04X*12 = x%04X > x%04X", + (int)((size_t)dir_start+2-(size_t)offset_base), + NumDirEntries, + (int)((size_t)dir_start+2+ + NumDirEntries*12-(size_t)offset_base), IFDlength); + return 0; + } + + for (de=0;demotorola_intel); + if (NextDirOffset) { + /* the next line seems false but here IFDlength means + length of all IFDs */ + if (offset_base + NextDirOffset < offset_base || + offset_base + NextDirOffset > offset_base+IFDlength) { + Logger::Warning("Illegal IFD offset"); + return 0; + } + /* That is the IFD for the first thumbnail */ + if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, + end, offset_base, IFDlength, displacement, + SECTION_THUMBNAIL)) { + if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN && + ImageInfo->Thumbnail.size && + ImageInfo->Thumbnail.offset && + ImageInfo->read_thumbnail) { + exif_thumbnail_extract(ImageInfo, offset_base, IFDlength); + } + return 1; + } else { + return 0; + } + } + return 1; +} + +/* Process a TIFF header in a JPEG file */ +static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, + char *CharBuf, size_t length, + size_t displacement) { + char *end = CharBuf + length; + unsigned exif_value_2a, offset_of_ifd; + + /* set the thumbnail stuff to nothing so we can test to see if + they get set up */ + CHECK_BUFFER(CharBuf, end, 2); + if (memcmp(CharBuf, "II", 2) == 0) { + ImageInfo->motorola_intel = 0; + } else if (memcmp(CharBuf, "MM", 2) == 0) { + ImageInfo->motorola_intel = 1; + } else { + Logger::Warning("Invalid TIFF a lignment marker"); + return; + } + + /* Check the next two values for correctness. */ + CHECK_BUFFER(CharBuf+4, end, 4); + exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel); + offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel); + if ( exif_value_2a != 0x2a || offset_of_ifd < 0x08) { + Logger::Warning("Invalid TIFF start (1)"); + return; + } + + ImageInfo->sections_found |= FOUND_IFD0; + /* First directory starts at offset 8. Offsets starts at 0. */ + exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, + CharBuf, end, length/* -14*/, displacement, + SECTION_IFD0); + + /* Compute the CCD width, in milimeters. */ + if (ImageInfo->FocalplaneXRes != 0) { + ImageInfo->CCDWidth = (float)(ImageInfo->ExifImageWidth * + ImageInfo->FocalplaneUnits / ImageInfo->FocalplaneXRes); + } +} + +/* Process an JPEG APP1 block marker + Describes all the drivel that most digital cameras include... +*/ +static void exif_process_APP1(image_info_type *ImageInfo, char *CharBuf, + size_t length, size_t displacement) { + /* Check the APP1 for Exif Identifier Code */ + char *end = CharBuf + length; + static const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00}; + CHECK_BUFFER(CharBuf+2, end, 6); + if (memcmp(CharBuf+2, ExifHeader, 6)) { + Logger::Warning("Incorrect APP1 Exif Identifier Code"); + return; + } + exif_process_TIFF_in_JPEG(ImageInfo, CharBuf + 8, length - 8, + displacement+8); +} + +/* Process an JPEG APP12 block marker used by OLYMPUS */ +static void exif_process_APP12(image_info_type *ImageInfo, + char *buffer, size_t length) { + size_t l1, l2=0; + if ((l1 = php_strnlen(buffer+2, length-2)) > 0) { + exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", + TAG_NONE, TAG_FMT_STRING, l1, buffer+2); + if (length > 2+l1+1) { + l2 = php_strnlen(buffer+2+l1+1, length-2-l1+1); + exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", + TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1); + } + } +} + +/* Process a SOFn marker. This is useful for the image dimensions */ +static void exif_process_SOFn (uchar *Data, int marker, + jpeg_sof_info *result) { + result->bits_per_sample = Data[2]; + result->height = php_jpg_get16(Data+3); + result->width = php_jpg_get16(Data+5); + result->num_components = Data[7]; +} + +/* Parse the marker stream until SOS or EOI is seen; */ +static int exif_scan_JPEG_header(image_info_type *ImageInfo) { + int section, sn; + int marker = 0, last_marker = M_PSEUDO, comment_correction=1; + unsigned int ll, lh; + uchar *Data; + size_t fpos, size, got, itemlen; + jpeg_sof_info sof_info; + + for(section=0;;section++) { + // get marker byte, swallowing possible padding + // some software does not count the length bytes of COM section + // one company doing so is very much envolved in JPEG... + // so we accept too + if (last_marker==M_COM && comment_correction) { + comment_correction = 2; + } + do { + if ((marker = ImageInfo->infile->getc()) == EOF) { + Logger::Warning("File structure corrupted"); + return 0; + } + if (last_marker==M_COM && comment_correction>0) { + if (marker!=0xFF) { + marker = 0xff; + comment_correction--; + } else { + last_marker = M_PSEUDO; /* stop skipping 0 for M_COM */ + } + } + } while (marker == 0xff); + if (last_marker==M_COM && !comment_correction) { + Logger::Info("Image has corrupt COM section: some software set " + "wrong length information"); + } + if (last_marker==M_COM && comment_correction) + return M_EOI; /* ah illegal: char after COM section not 0xFF */ + + fpos = ImageInfo->infile->tell(); + + if (marker == 0xff) { + // 0xff is legal padding, but if we get that many, something's wrong. + Logger::Warning("To many padding bytes"); + return 0; + } + + /* Read the length of the section. */ + lh = ImageInfo->infile->getc(); + ll = ImageInfo->infile->getc(); + + itemlen = (lh << 8) | ll; + + if (itemlen < 2) { + Logger::Warning("File structure corrupted"); + return 0; + } + + sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, NULL); + Data = ImageInfo->file.list[sn].data; + + /* Store first two pre-read bytes. */ + Data[0] = (uchar)lh; + Data[1] = (uchar)ll; + + String str = ImageInfo->infile->read(itemlen-2); + got = str.length(); + if (got != itemlen-2) { + Logger::Warning("Error reading from file: " + "got=x%04X(=%d) != itemlen-2=x%04X(=%d)", + got, got, itemlen-2, itemlen-2); + return 0; + } + memcpy(Data+2, str.c_str(), got); + switch(marker) { + case M_SOS: /* stop before hitting compressed data */ + // If reading entire image is requested, read the rest of the data. + if (ImageInfo->read_all) { + /* Determine how much file is left. */ + fpos = ImageInfo->infile->tell(); + size = ImageInfo->FileSize - fpos; + sn = exif_file_sections_add(ImageInfo, M_PSEUDO, size, NULL); + Data = ImageInfo->file.list[sn].data; + str = ImageInfo->infile->read(size); + got = str.length(); + if (got != size) { + Logger::Warning("Unexpected end of file reached"); + return 0; + } + memcpy(Data, str.c_str(), got); + } + return 1; + + case M_EOI: /* in case it's a tables-only JPEG stream */ + Logger::Warning("No image in jpeg!"); + return (ImageInfo->sections_found&(~FOUND_COMPUTED)) ? 1 : 0; + + case M_COM: /* Comment section */ + exif_process_COM(ImageInfo, (char *)Data, itemlen); + break; + + case M_EXIF: + if (!(ImageInfo->sections_found&FOUND_IFD0)) { + /*ImageInfo->sections_found |= FOUND_EXIF;*/ + /* Seen files from some 'U-lead' software with Vivitar scanner + that uses marker 31 later in the file (no clue what for!) */ + exif_process_APP1(ImageInfo, (char *)Data, itemlen, fpos); + } + break; + + case M_APP12: + exif_process_APP12(ImageInfo, (char *)Data, itemlen); + break; + + + case M_SOF0: + case M_SOF1: + case M_SOF2: + case M_SOF3: + case M_SOF5: + case M_SOF6: + case M_SOF7: + case M_SOF9: + case M_SOF10: + case M_SOF11: + case M_SOF13: + case M_SOF14: + case M_SOF15: + exif_process_SOFn(Data, marker, &sof_info); + ImageInfo->Width = sof_info.width; + ImageInfo->Height = sof_info.height; + if (sof_info.num_components == 3) { + ImageInfo->IsColor = 1; + } else { + ImageInfo->IsColor = 0; + } + break; + default: + /* skip any other marker silently. */ + break; + } + + /* keep track of last marker */ + last_marker = marker; + } + return 1; +} + +/* Reallocate a file section returns 0 on success and -1 on failure */ +static int exif_file_sections_realloc(image_info_type *ImageInfo, + int section_index, size_t size) { + void *tmp; + + /* This is not a malloc/realloc check. It is a plausibility check for the + * function parameters (requirements engineering). + */ + if (section_index >= ImageInfo->file.count) { + Logger::Warning("Illegal reallocating of undefined file section"); + return -1; + } + tmp = realloc(ImageInfo->file.list[section_index].data, size); + ImageInfo->file.list[section_index].data = (uchar *)tmp; + ImageInfo->file.list[section_index].size = size; + return 0; +} + +/* Parse the TIFF header; */ +static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, + size_t dir_offset, int section_index) { + int i, sn, num_entries, sub_section_index = 0; + unsigned char *dir_entry; + char tagname[64]; + size_t ifd_size, dir_size, entry_offset, next_offset, + entry_length, entry_value=0, fgot; + int entry_tag , entry_type; + tag_table_type tag_table = exif_get_tag_table(section_index); + + if (ImageInfo->FileSize >= dir_offset+2) { + sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL); + /* we do not know the order of sections */ + ImageInfo->infile->seek(dir_offset, SEEK_SET); + String snData = ImageInfo->infile->read(2); + memcpy(ImageInfo->file.list[sn].data, snData.c_str(), 2); + num_entries = php_ifd_get16u(ImageInfo->file.list[sn].data, + ImageInfo->motorola_intel); + dir_size = 2/*num dir entries*/ + + 12/*length of entry*/*num_entries + + 4/* offset to next ifd (points to thumbnail or NULL)*/; + if (ImageInfo->FileSize >= dir_offset+dir_size) { + if (exif_file_sections_realloc(ImageInfo, sn, dir_size)) { + return 0; + } + snData = ImageInfo->infile->read(dir_size-2); + memcpy(ImageInfo->file.list[sn].data+2, snData.c_str(), dir_size-2); + next_offset = + php_ifd_get32u(ImageInfo->file.list[sn].data + dir_size - 4, + ImageInfo->motorola_intel); + /* now we have the directory we can look how long it should be */ + ifd_size = dir_size; + char *end = (char*)ImageInfo->file.list[sn].data + dir_size; + for(i=0;ifile.list[sn].data+2+i*12; + CHECK_BUFFER_R(dir_entry+4, end, 4, 0); + entry_tag = php_ifd_get16u(dir_entry+0, ImageInfo->motorola_intel); + entry_type = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); + if (entry_type > NUM_FORMATS) { + Logger::Info("Read from TIFF: tag(0x%04X,%12s): " + "Illegal format code 0x%04X, switching to BYTE", + entry_tag, + exif_get_tagname(entry_tag, tagname, -12, tag_table), + entry_type); + /* Since this is repeated in exif_process_IFD_TAG make it a + notice here and make it a warning in the exif_process_IFD_TAG + which is called elsewhere. */ + entry_type = TAG_FMT_BYTE; + } + entry_length = + php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel) * + get_php_tiff_bytes_per_format(entry_type); + if (entry_length <= 4) { + switch(entry_type) { + case TAG_FMT_USHORT: + CHECK_BUFFER_R(dir_entry+8, end, 2, 0); + entry_value = php_ifd_get16u(dir_entry+8, + ImageInfo->motorola_intel); + break; + case TAG_FMT_SSHORT: + CHECK_BUFFER_R(dir_entry+8, end, 2, 0); + entry_value = php_ifd_get16s(dir_entry+8, + ImageInfo->motorola_intel); + break; + case TAG_FMT_ULONG: + CHECK_BUFFER_R(dir_entry+8, end, 4, 0); + entry_value = php_ifd_get32u(dir_entry+8, + ImageInfo->motorola_intel); + break; + case TAG_FMT_SLONG: + CHECK_BUFFER_R(dir_entry+8, end, 4, 0); + entry_value = php_ifd_get32s(dir_entry+8, + ImageInfo->motorola_intel); + break; + } + switch(entry_tag) { + case TAG_IMAGEWIDTH: + case TAG_COMP_IMAGE_WIDTH: + ImageInfo->Width = entry_value; + break; + case TAG_IMAGEHEIGHT: + case TAG_COMP_IMAGE_HEIGHT: + ImageInfo->Height = entry_value; + break; + case TAG_PHOTOMETRIC_INTERPRETATION: + switch (entry_value) { + case PMI_BLACK_IS_ZERO: + case PMI_WHITE_IS_ZERO: + case PMI_TRANSPARENCY_MASK: + ImageInfo->IsColor = 0; + break; + case PMI_RGB: + case PMI_PALETTE_COLOR: + case PMI_SEPARATED: + case PMI_YCBCR: + case PMI_CIELAB: + ImageInfo->IsColor = 1; + break; + } + break; + } + } else { + CHECK_BUFFER_R(dir_entry+8, end, 4, 0); + entry_offset = + php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); + /* if entry needs expading ifd cache and entry is at end of + current ifd cache. */ + /* otherwise there may be huge holes between two entries */ + if (entry_offset + entry_length > dir_offset + ifd_size && + entry_offset == dir_offset + ifd_size) { + ifd_size = entry_offset + entry_length - dir_offset; + } + } + } + if (ImageInfo->FileSize >= + dir_offset + ImageInfo->file.list[sn].size) { + if (ifd_size > dir_size) { + if (dir_offset + ifd_size > ImageInfo->FileSize) { + Logger::Warning("Error in TIFF: filesize(x%04X) less than " + "size of IFD(x%04X + x%04X)", + ImageInfo->FileSize, dir_offset, ifd_size); + return 0; + } + if (exif_file_sections_realloc(ImageInfo, sn, ifd_size)) { + return 0; + } + /* read values not stored in directory itself */ + snData = ImageInfo->infile->read(ifd_size-dir_size); + memcpy(ImageInfo->file.list[sn].data+dir_size, snData.c_str(), + ifd_size-dir_size); + } + /* now process the tags */ + for(i=0;ifile.list[sn].data+2+i*12; + CHECK_BUFFER_R(dir_entry+2, end, 2, 0); + entry_tag = php_ifd_get16u(dir_entry+0, ImageInfo->motorola_intel); + entry_type = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); + if (entry_tag == TAG_EXIF_IFD_POINTER || + entry_tag == TAG_INTEROP_IFD_POINTER || + entry_tag == TAG_GPS_IFD_POINTER || + entry_tag == TAG_SUB_IFD) { + switch(entry_tag) { + case TAG_EXIF_IFD_POINTER: + ImageInfo->sections_found |= FOUND_EXIF; + sub_section_index = SECTION_EXIF; + break; + case TAG_GPS_IFD_POINTER: + ImageInfo->sections_found |= FOUND_GPS; + sub_section_index = SECTION_GPS; + break; + case TAG_INTEROP_IFD_POINTER: + ImageInfo->sections_found |= FOUND_INTEROP; + sub_section_index = SECTION_INTEROP; + break; + case TAG_SUB_IFD: + ImageInfo->sections_found |= FOUND_THUMBNAIL; + sub_section_index = SECTION_THUMBNAIL; + break; + } + CHECK_BUFFER_R(dir_entry+8, end, 4, 0); + entry_offset = + php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); + exif_process_IFD_in_TIFF(ImageInfo, entry_offset, + sub_section_index); + if (section_index!=SECTION_THUMBNAIL && entry_tag==TAG_SUB_IFD) { + if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN && + ImageInfo->Thumbnail.size && + ImageInfo->Thumbnail.offset && + ImageInfo->read_thumbnail) { + if (!ImageInfo->Thumbnail.data) { + ImageInfo->Thumbnail.data = + (char *)malloc(ImageInfo->Thumbnail.size); + ImageInfo->infile->seek(ImageInfo->Thumbnail.offset, + SEEK_SET); + String str = + ImageInfo->infile->read(ImageInfo->Thumbnail.size); + fgot = str.length(); + if (fgot < ImageInfo->Thumbnail.size) { + Logger::Warning("Thumbnail goes IFD boundary or " + "end of file reached"); + } + memcpy(ImageInfo->Thumbnail.data, str.c_str(), fgot); + exif_thumbnail_build(ImageInfo); + } + } + } + } else { + if (!exif_process_IFD_TAG(ImageInfo, (char*)dir_entry, + (char*)ImageInfo->file.list[sn].data + ifd_size, + (char*)(ImageInfo->file.list[sn].data-dir_offset), + ifd_size, 0, section_index, 0, tag_table)) { + return 0; + } + } + } + /* If we had a thumbnail in a SUB_IFD we have ANOTHER image in + NEXT IFD */ + if (next_offset && section_index != SECTION_THUMBNAIL) { + /* this should be a thumbnail IFD */ + /* the thumbnail itself is stored at Tag=StripOffsets */ + exif_process_IFD_in_TIFF(ImageInfo, next_offset, + SECTION_THUMBNAIL); + if (!ImageInfo->Thumbnail.data && ImageInfo->Thumbnail.offset && + ImageInfo->Thumbnail.size && ImageInfo->read_thumbnail) { + ImageInfo->Thumbnail.data = + (char *)malloc(ImageInfo->Thumbnail.size); + ImageInfo->infile->seek(ImageInfo->Thumbnail.offset, SEEK_SET); + String str = ImageInfo->infile->read(ImageInfo->Thumbnail.size); + fgot = str.length(); + if (fgot < ImageInfo->Thumbnail.size) { + Logger::Warning("Thumbnail goes IFD boundary or " + "end of file reached"); + } + memcpy(ImageInfo->Thumbnail.data, str.c_str(), fgot); + exif_thumbnail_build(ImageInfo); + } + } + return 1; + } else { + Logger::Warning("Error in TIFF: filesize(x%04X) less than " + "size of IFD(x%04X)", + ImageInfo->FileSize, + dir_offset+ImageInfo->file.list[sn].size); + return 0; + } + } else { + Logger::Warning("Error in TIFF: filesize(x%04X) less than size " + "of IFD dir(x%04X)", + ImageInfo->FileSize, dir_offset+dir_size); + return 0; + } + } else { + Logger::Warning("Error in TIFF: filesize(x%04X) less than " + "start of IFD dir(x%04X)", + ImageInfo->FileSize, dir_offset+2); + return 0; + } +} + +/* Parse the marker stream until SOS or EOI is seen; */ +static int exif_scan_FILE_header(image_info_type *ImageInfo) { + unsigned char *file_header; + int ret = 0; + + ImageInfo->FileType = IMAGE_FILETYPE_UNKNOWN; + + if (ImageInfo->FileSize >= 2) { + ImageInfo->infile->seek(0, SEEK_SET); + String fileHeader = ImageInfo->infile->read(2); + if (fileHeader.length() != 2) { + return 0; + } + file_header = (unsigned char *)fileHeader.c_str(); + if ((file_header[0]==0xff) && (file_header[1]==M_SOI)) { + ImageInfo->FileType = IMAGE_FILETYPE_JPEG; + if (exif_scan_JPEG_header(ImageInfo)) { + ret = 1; + } else { + Logger::Warning("Invalid JPEG file"); + } + } else if (ImageInfo->FileSize >= 8) { + String str = ImageInfo->infile->read(6); + if (str.length() != 6) { + return 0; + } + fileHeader += str; + file_header = (unsigned char *)fileHeader.c_str(); + if (!memcmp(file_header, "II\x2A\x00", 4)) { + ImageInfo->FileType = IMAGE_FILETYPE_TIFF_II; + ImageInfo->motorola_intel = 0; + ImageInfo->sections_found |= FOUND_IFD0; + if (exif_process_IFD_in_TIFF(ImageInfo, + php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel), + SECTION_IFD0)) { + ret = 1; + } else { + Logger::Warning("Invalid TIFF file"); + } + } + else if (!memcmp(file_header, "MM\x00\x2a", 4)) { + ImageInfo->FileType = IMAGE_FILETYPE_TIFF_MM; + ImageInfo->motorola_intel = 1; + ImageInfo->sections_found |= FOUND_IFD0; + if (exif_process_IFD_in_TIFF(ImageInfo, + php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel), + SECTION_IFD0)) { + ret = 1; + } else { + Logger::Warning("Invalid TIFF file"); + } + } else { + Logger::Warning("File not supported"); + return 0; + } + } + } else { + Logger::Warning("File too small (%d)", ImageInfo->FileSize); + } + return ret; +} + +static int exif_read_file(image_info_type *ImageInfo, String FileName, + bool read_thumbnail, bool read_all) { + int ret; + struct stat st; + + /* Start with an empty image information structure. */ + memset(ImageInfo, 0, sizeof(*ImageInfo)); + + ImageInfo->motorola_intel = -1; /* flag as unknown */ + + Variant stream = f_fopen(FileName, "rb"); + if (same(stream, false)) { + Logger::Warning("Unable to open file %s", FileName.c_str()); + return 0; + } + ImageInfo->infile = Object(stream).getTyped(); + PlainFile *plain_file = dynamic_cast(ImageInfo->infile); + if (plain_file) { + if (stat(FileName.c_str(), &st) >= 0) { + if ((st.st_mode & S_IFMT) != S_IFREG) { + Logger::Warning("Not a file"); + return 0; + } + } + + /* Store file date/time. */ + ImageInfo->FileDateTime = st.st_mtime; + ImageInfo->FileSize = st.st_size; + } else { + if (!ImageInfo->FileSize) { + f_fseek(stream, 0, SEEK_END); + ImageInfo->FileSize = ImageInfo->infile->tell(); + f_fseek(stream, 0, SEEK_SET); + } + } + + ImageInfo->FileName = f_basename(FileName); + ImageInfo->read_thumbnail = read_thumbnail; + ImageInfo->read_all = read_all; + ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN; + + ImageInfo->encode_unicode = strdup("ISO-8859-15"); + ImageInfo->decode_unicode_be = strdup("UCS-2BE"); + ImageInfo->decode_unicode_le = strdup("UCS-2LE"); + ImageInfo->encode_jis = strdup(""); + ImageInfo->decode_jis_be = strdup("JIS"); + ImageInfo->decode_jis_le = strdup("JIS"); + + ImageInfo->ifd_nesting_level = 0; + + /* Scan the JPEG headers. */ + ret = exif_scan_FILE_header(ImageInfo); + + f_fclose(stream); + return ret; +} + +/* Free memory allocated for image_info */ +static void exif_iif_free(image_info_type *image_info, int section_index) { + int i; + void *f; /* faster */ + + if (image_info->info_list[section_index].count) { + for (i=0; i < image_info->info_list[section_index].count; i++) { + if ((f=image_info->info_list[section_index].list[i].name) != NULL) { + free(f); + } + switch(image_info->info_list[section_index].list[i].format) { + case TAG_FMT_SBYTE: + case TAG_FMT_BYTE: + /* in contrast to strings bytes do not need to allocate + buffer for NULL if length==0 */ + if (image_info->info_list[section_index].list[i].length<1) + break; + default: + case TAG_FMT_UNDEFINED: + case TAG_FMT_STRING: + if ((f=image_info->info_list[section_index].list[i].value.s) + != NULL) { + free(f); + } + break; + + case TAG_FMT_USHORT: + case TAG_FMT_ULONG: + case TAG_FMT_URATIONAL: + case TAG_FMT_SSHORT: + case TAG_FMT_SLONG: + case TAG_FMT_SRATIONAL: + case TAG_FMT_SINGLE: + case TAG_FMT_DOUBLE: + /* nothing to do here */ + if (image_info->info_list[section_index].list[i].length > 1) { + if ((f=image_info->info_list[section_index].list[i].value.list) + != NULL) { + free(f); + } + } + break; + } + } + } + if (image_info->info_list[section_index].list) { + free(image_info->info_list[section_index].list); + } +} + +/* Discard all file_sections in ImageInfo */ +static int exif_file_sections_free(image_info_type *ImageInfo) { + int i; + + if (ImageInfo->file.count) { + for (i=0; ifile.count; i++) { + if (ImageInfo->file.list[i].data) free(ImageInfo->file.list[i].data); + } + } + if (ImageInfo->file.list) free(ImageInfo->file.list); + ImageInfo->file.count = 0; + return 1; +} + +/* Discard data scanned by exif_read_file. */ +static int exif_discard_imageinfo(image_info_type *ImageInfo) { + int i; + + if (ImageInfo->UserComment) free(ImageInfo->UserComment); + if (ImageInfo->UserCommentEncoding) free(ImageInfo->UserCommentEncoding); + if (ImageInfo->Copyright) free(ImageInfo->Copyright); + if (ImageInfo->CopyrightPhotographer) free(ImageInfo->CopyrightPhotographer); + if (ImageInfo->CopyrightEditor) free(ImageInfo->CopyrightEditor); + if (ImageInfo->Thumbnail.data) free(ImageInfo->Thumbnail.data); + if (ImageInfo->encode_unicode) free(ImageInfo->encode_unicode); + if (ImageInfo->decode_unicode_be) free(ImageInfo->decode_unicode_be); + if (ImageInfo->decode_unicode_le) free(ImageInfo->decode_unicode_le); + if (ImageInfo->encode_jis) free(ImageInfo->encode_jis); + if (ImageInfo->decode_jis_be) free(ImageInfo->decode_jis_be); + if (ImageInfo->decode_jis_le) free(ImageInfo->decode_jis_le); + if (ImageInfo->make) free(ImageInfo->make); + if (ImageInfo->model) free(ImageInfo->model); + for (i=0; ixp_fields.count; i++) { + if (ImageInfo->xp_fields.list[i].value) { + free(ImageInfo->xp_fields.list[i].value); + } + } + if (ImageInfo->xp_fields.list) free(ImageInfo->xp_fields.list); + for (i=0; iinfo_list[section_index].list, + (image_info->info_list[section_index].count+1) * + sizeof(image_info_data)); + image_info->info_list[section_index].list = list; + + info_data = &image_info->info_list[section_index]. + list[image_info->info_list[section_index].count]; + info_data->tag = (unsigned short)TAG_NONE; + info_data->format = TAG_FMT_SLONG; + info_data->length = 1; + info_data->name = strdup(name); + info_data->value.i = value; + image_info->sections_found |= 1<info_list[section_index].count++; +} + +/* Add a string value to image_info MUST BE NUL TERMINATED */ +static void exif_iif_add_str(image_info_type *image_info, + int section_index, char *name, char *value) { + image_info_data *info_data; + image_info_data *list; + + if (value) { + list = (image_info_data *) + realloc(image_info->info_list[section_index].list, + (image_info->info_list[section_index].count+1) * + sizeof(image_info_data)); + image_info->info_list[section_index].list = list; + info_data = &image_info->info_list[section_index]. + list[image_info->info_list[section_index].count]; + info_data->tag = (unsigned short)TAG_NONE; + info_data->format = TAG_FMT_STRING; + info_data->length = 1; + info_data->name = strdup(name); + // TODO + // if (PG(magic_quotes_runtime)) { + // info_data->value.s = php_addslashes(value, strlen(value), NULL, 0); + // } else { + info_data->value.s = strdup(value); + image_info->sections_found |= 1<info_list[section_index].count++; + } +} + +/* Add a format string value to image_info MUST BE NUL TERMINATED */ +static void exif_iif_add_fmt(image_info_type *image_info, int section_index, + char *name, char *value, ...) { + char *tmp; + va_list arglist; + + va_start(arglist, value); + if (value) { + vspprintf_ap(&tmp, 0, value, arglist); + exif_iif_add_str(image_info, section_index, name, tmp); + free(tmp); + } + va_end(arglist); +} + +/* Add a string value to image_info MUST BE NUL TERMINATED */ +static void exif_iif_add_buffer(image_info_type *image_info, + int section_index, char *name, + int length, char *value) { + image_info_data *info_data; + image_info_data *list; + + if (value) { + list = (image_info_data *) + realloc(image_info->info_list[section_index].list, + (image_info->info_list[section_index].count+1) * + sizeof(image_info_data)); + image_info->info_list[section_index].list = list; + info_data = &image_info->info_list[section_index]. + list[image_info->info_list[section_index].count]; + info_data->tag = (unsigned short)TAG_NONE; + info_data->format = TAG_FMT_UNDEFINED; + info_data->length = length; + info_data->name = strdup(name); + // if (PG(magic_quotes_runtime)) { + // info_data->value.s = php_addslashes(value, length, &length, 0); + // info_data->length = length; + // } else { + info_data->value.s = (char *)malloc(length + 1); + memcpy(info_data->value.s, value, length); + info_data->value.s[length] = 0; + image_info->sections_found |= 1<info_list[section_index].count++; + } +} + +/* scan JPEG in thumbnail (memory) */ +static int exif_scan_thumbnail(image_info_type *ImageInfo) { + uchar c, *data = (uchar*)ImageInfo->Thumbnail.data; + int n, marker; + size_t length=2, pos=0; + jpeg_sof_info sof_info; + + if (!data) { + return 0; /* nothing to do here */ + } + if (memcmp(data, "\xFF\xD8\xFF", 3)) { + if (!ImageInfo->Thumbnail.width && !ImageInfo->Thumbnail.height) { + Logger::Warning("Thumbnail is not a JPEG image"); + } + return 0; + } + for (;;) { + pos += length; + if (pos>=ImageInfo->Thumbnail.size) + return 0; + c = data[pos++]; + if (pos>=ImageInfo->Thumbnail.size) + return 0; + if (c != 0xFF) { + return 0; + } + n = 8; + while ((c = data[pos++]) == 0xFF && n--) { + if (pos+3>=ImageInfo->Thumbnail.size) + return 0; + /* +3 = pos++ of next check when reaching marker + 2 bytes for length */ + } + if (c == 0xFF) + return 0; + marker = c; + length = php_jpg_get16(data+pos); + if (pos+length>=ImageInfo->Thumbnail.size) { + return 0; + } + switch (marker) { + case M_SOF0: + case M_SOF1: + case M_SOF2: + case M_SOF3: + case M_SOF5: + case M_SOF6: + case M_SOF7: + case M_SOF9: + case M_SOF10: + case M_SOF11: + case M_SOF13: + case M_SOF14: + case M_SOF15: + /* handle SOFn block */ + exif_process_SOFn(data+pos, marker, &sof_info); + ImageInfo->Thumbnail.height = sof_info.height; + ImageInfo->Thumbnail.width = sof_info.width; + return 1; + + case M_SOS: + case M_EOI: + Logger::Warning("Could not compute size of thumbnail"); + return 0; + break; + + default: + /* just skip */ + break; + } + } + + Logger::Warning("Could not compute size of thumbnail"); + return 0; +} + +/* Add image_info to associative array value. */ +static void add_assoc_image_info(Array &value, bool sub_array, + image_info_type *image_info, + int section_index) { + char buffer[64], *val, *name, uname[64]; + int i, ap, l, b, idx=0, unknown=0; + image_info_value *info_value; + image_info_data *info_data; + Array tmpi, array; + + if (image_info->info_list[section_index].count) { + if (!sub_array) { + tmpi = value; + } + + for(i=0; iinfo_list[section_index].count; i++) { + info_data = &image_info->info_list[section_index].list[i]; + info_value = &info_data->value; + if (!(name = info_data->name)) { + snprintf(uname, sizeof(uname), "%d", unknown++); + name = uname; + } + if (info_data->length==0) { + tmpi.set(String(name, CopyString), null); + } else { + switch (info_data->format) { + default: + /* Standard says more types possible but skip them... + * but allow users to handle data if they know how to + * So not return but use type UNDEFINED + * return; + */ + case TAG_FMT_BYTE: + case TAG_FMT_SBYTE: + case TAG_FMT_UNDEFINED: + if (!info_value->s) { + tmpi.set(String(name, CopyString), ""); + } else { + tmpi.set(String(name, CopyString), + String(info_value->s, info_data->length, CopyString)); + } + break; + + case TAG_FMT_STRING: + if (!(val = info_value->s)) { + val = ""; + } + if (section_index==SECTION_COMMENT) { + tmpi.set(idx++, String(val, CopyString)); + } else { + tmpi.set(String(name, CopyString), String(val, CopyString)); + } + break; + + case TAG_FMT_URATIONAL: + case TAG_FMT_SRATIONAL: + /*case TAG_FMT_BYTE: + case TAG_FMT_SBYTE:*/ + case TAG_FMT_USHORT: + case TAG_FMT_SSHORT: + case TAG_FMT_SINGLE: + case TAG_FMT_DOUBLE: + case TAG_FMT_ULONG: + case TAG_FMT_SLONG: + /* now the rest, first see if it becomes an array */ + if ((l = info_data->length) > 1) { + array.clear(); + } + for(ap=0; ap1) { + info_value = &info_data->value.list[ap]; + } + switch (info_data->format) { + case TAG_FMT_BYTE: + if (l>1) { + info_value = &info_data->value; + for (b=0;bs[b])); + } + break; + } + case TAG_FMT_USHORT: + case TAG_FMT_ULONG: + if (l==1) { + tmpi.set(String(name, CopyString), (int)info_value->u); + } else { + array.set(ap, (int)info_value->u); + } + break; + + case TAG_FMT_URATIONAL: + snprintf(buffer, sizeof(buffer), "%i/%i", + info_value->ur.num, info_value->ur.den); + if (l==1) { + tmpi.set(String(name, CopyString), + String(buffer, CopyString)); + } else { + array.set(ap, String(buffer, CopyString)); + } + break; + + case TAG_FMT_SBYTE: + if (l>1) { + info_value = &info_data->value; + for (b=0;bs[b]); + } + break; + } + case TAG_FMT_SSHORT: + case TAG_FMT_SLONG: + if (l==1) { + tmpi.set(String(name, CopyString), info_value->i); + } else { + array.set(ap, info_value->i); + } + break; + + case TAG_FMT_SRATIONAL: + snprintf(buffer, sizeof(buffer), "%i/%i", + info_value->sr.num, info_value->sr.den); + if (l==1) { + tmpi.set(String(name, CopyString), + String(buffer, CopyString)); + } else { + array.set(ap, String(buffer, CopyString)); + } + break; + + case TAG_FMT_SINGLE: + if (l==1) { + tmpi.set(String(name, CopyString), info_value->f); + } else { + array.set(ap, info_value->f); + } + break; + + case TAG_FMT_DOUBLE: + if (l==1) { + tmpi.set(String(name, CopyString), info_value->d); + } else { + array.set(ap, info_value->d); + } + break; + } + info_value = &info_data->value.list[ap]; + } + if (l>1) { + tmpi.set(String(name, CopyString), array); + } + break; + } + } + } + if (sub_array) { + value.set(exif_get_sectionname(section_index), tmpi); + } + } +} + +Variant f_exif_tagname(int index) { + char *szTemp; + + szTemp = exif_get_tagname(index, NULL, 0, tag_table_IFD); + if (index <0 || !szTemp || !szTemp[0]) { + return false; + } else { + return String(szTemp, CopyString); + } +} + +Variant f_exif_read_data(CStrRef filename, + CStrRef sections /* = null_string */, + bool arrays /* = false */, + bool thumbnail /* = false */) { + int i, ret, sections_needed=0; + image_info_type ImageInfo; + char tmp[64], *sections_str, *s; + + memset(&ImageInfo, 0, sizeof(ImageInfo)); + if (!sections.isNull()) { + vspprintf(§ions_str, 0, ",%s,", sections.c_str()); + + /* sections_str DOES start with , and SPACES are NOT allowed in names */ + s = sections_str; + while(*++s) { + if(*s==' ') { + *s = ','; + } + } + for (i=0; i0 && ImageInfo.Height>0) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "html", + "width=\"%d\" height=\"%d\"", + ImageInfo.Width, ImageInfo.Height); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Height", + ImageInfo.Height); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Width", + ImageInfo.Width); + } + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "IsColor", + ImageInfo.IsColor); + if (ImageInfo.motorola_intel != -1) { + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "ByteOrderMotorola", + ImageInfo.motorola_intel); + } + if (ImageInfo.FocalLength) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocalLength", + "%4.1Fmm", ImageInfo.FocalLength); + if(ImageInfo.CCDWidth) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "35mmFocalLength", + "%dmm", + (int)(ImageInfo.FocalLength/ImageInfo.CCDWidth*35+0.5)); + } + } + if(ImageInfo.CCDWidth) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "CCDWidth", + "%dmm", (int)ImageInfo.CCDWidth); + } + if(ImageInfo.ExposureTime>0) { + if(ImageInfo.ExposureTime <= 0.5) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime", + "%0.3F s (1/%d)", ImageInfo.ExposureTime, + (int)(0.5 + 1/ImageInfo.ExposureTime)); + } else { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime", + "%0.3F s", ImageInfo.ExposureTime); + } + } + if(ImageInfo.ApertureFNumber) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ApertureFNumber", + "f/%.1F", ImageInfo.ApertureFNumber); + } + if(ImageInfo.Distance) { + if(ImageInfo.Distance<0) { + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "FocusDistance", + "Infinite"); + } else { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocusDistance", + "%0.2Fm", ImageInfo.Distance); + } + } + if (ImageInfo.UserComment) { + exif_iif_add_buffer(&ImageInfo, SECTION_COMPUTED, "UserComment", + ImageInfo.UserCommentLength, ImageInfo.UserComment); + if (ImageInfo.UserCommentEncoding && + strlen(ImageInfo.UserCommentEncoding)) { + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "UserCommentEncoding", + ImageInfo.UserCommentEncoding); + } + } + + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright", + ImageInfo.Copyright); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Photographer", + ImageInfo.CopyrightPhotographer); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Editor", + ImageInfo.CopyrightEditor); + + for (i=0; i +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +struct gfxinfo { + unsigned int width; + unsigned int height; + unsigned int bits; + unsigned int channels; +}; + +class Image : public SweepableResourceData { +public: + Image() { m_gdImage = NULL;} + Image(gdImagePtr gdImage) { m_gdImage = gdImage;} + ~Image(); + gdImagePtr get() { return m_gdImage;} + void reset() { m_gdImage = NULL;} + + // overriding ResourceData + virtual const char *o_getClassName() const { return "gd";} + virtual bool isResource() const { return m_gdImage != NULL;} + +private: + gdImagePtr m_gdImage; +}; + +Array f_gd_info(); +Variant f_getimagesize(CStrRef filename, Variant imageinfo = null); +String f_image_type_to_extension(int imagetype, bool include_dot = true); +String f_image_type_to_mime_type(int imagetype); +bool f_image2wbmp(CObjRef image, CStrRef filename = null_string, int threshold = -1); +bool f_imagealphablending(CObjRef image, bool blendmode); +bool f_imageantialias(CObjRef image, bool on); +bool f_imagearc(CObjRef image, int cx, int cy, int width, int height, int start, int end, int color); +bool f_imagechar(CObjRef image, int font, int x, int y, CStrRef c, int color); +bool f_imagecharup(CObjRef image, int font, int x, int y, CStrRef c, int color); +Variant f_imagecolorallocate(CObjRef image, int red, int green, int blue); +Variant f_imagecolorallocatealpha(CObjRef image, int red, int green, int blue, int alpha); +Variant f_imagecolorat(CObjRef image, int x, int y); +Variant f_imagecolorclosest(CObjRef image, int red, int green, int blue); +Variant f_imagecolorclosestalpha(CObjRef image, int red, int green, int blue, int alpha); +Variant f_imagecolorclosesthwb(CObjRef image, int red, int green, int blue); +bool f_imagecolordeallocate(CObjRef image, int color); +Variant f_imagecolorexact(CObjRef image, int red, int green, int blue); +Variant f_imagecolorexactalpha(CObjRef image, int red, int green, int blue, int alpha); +Variant f_imagecolormatch(CObjRef image1, CObjRef image2); +Variant f_imagecolorresolve(CObjRef image, int red, int green, int blue); +Variant f_imagecolorresolvealpha(CObjRef image, int red, int green, int blue, int alpha); +Variant f_imagecolorset(CObjRef image, int index, int red, int green, int blue); +Variant f_imagecolorsforindex(CObjRef image, int index); +Variant f_imagecolorstotal(CObjRef image); +Variant f_imagecolortransparent(CObjRef image, int color = -1); +bool f_imageconvolution(CObjRef image, CArrRef matrix, double div, double offset); +bool f_imagecopy(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h); +bool f_imagecopymerge(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct); +bool f_imagecopymergegray(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct); +bool f_imagecopyresampled(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h); +bool f_imagecopyresized(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h); +Variant f_imagecreate(int width, int height); +Variant f_imagecreatefromgd2part(CStrRef filename, int srcx, int srcy, int width, int height); +Variant f_imagecreatefromgd(CStrRef filename); +Variant f_imagecreatefromgd2(CStrRef filename); +Variant f_imagecreatefromgif(CStrRef filename); +Variant f_imagecreatefromjpeg(CStrRef filename); +Variant f_imagecreatefrompng(CStrRef filename); +Variant f_imagecreatefromstring(CStrRef data); +Variant f_imagecreatefromwbmp(CStrRef filename); +Variant f_imagecreatefromxbm(CStrRef filename); +Variant f_imagecreatefromxpm(CStrRef filename); +Variant f_imagecreatetruecolor(int width, int height); +bool f_imagedashedline(CObjRef image, int x1, int y1, int x2, int y2, int color); +bool f_imagedestroy(CObjRef image); +bool f_imageellipse(CObjRef image, int cx, int cy, int width, int height, int color); +bool f_imagefill(CObjRef image, int x, int y, int color); +bool f_imagefilledarc(CObjRef image, int cx, int cy, int width, int height, int start, int end, int color, int style); +bool f_imagefilledellipse(CObjRef image, int cx, int cy, int width, int height, int color); +bool f_imagefilledpolygon(CObjRef image, CArrRef points, int num_points, int color); +bool f_imagefilledrectangle(CObjRef image, int x1, int y1, int x2, int y2, int color); +bool f_imagefilltoborder(CObjRef image, int x, int y, int border, int color); +bool f_imagefilter(CObjRef image, int filtertype, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0); +int f_imagefontheight(int font); +int f_imagefontwidth(int font); +Variant f_imageftbbox(double size, double angle, CStrRef font_file, CStrRef text, CArrRef extrainfo = null); +Variant f_imagefttext(CObjRef image, double size, double angle, int x, int y, int col, CStrRef font_file, CStrRef text, CArrRef extrainfo = null); +bool f_imagegammacorrect(CObjRef image, double inputgamma, double outputgamma); +bool f_imagegd2(CObjRef image, CStrRef filename = null_string, int chunk_size = 0, int type = 0); +bool f_imagegd(CObjRef image, CStrRef filename = null_string); +bool f_imagegif(CObjRef image, CStrRef filename = null_string); +Variant f_imagegrabscreen(); +Variant f_imagegrabwindow(int window, int client_area = 0); +Variant f_imageinterlace(CObjRef image, int interlace = 0); +bool f_imageistruecolor(CObjRef image); +bool f_imagejpeg(CObjRef image, CStrRef filename = null_string, int quality = -1); +bool f_imagelayereffect(CObjRef image, int effect); +bool f_imageline(CObjRef image, int x1, int y1, int x2, int y2, int color); +Variant f_imageloadfont(CStrRef file); +void f_imagepalettecopy(CObjRef destination, CObjRef source); +bool f_imagepng(CObjRef image, CStrRef filename = null_string, int quality = -1, int filters = -1); +bool f_imagepolygon(CObjRef image, CArrRef points, int num_points, int color); +Array f_imagepsbbox(CStrRef text, int font, int size, int space = 0, int tightness = 0, double angle = 0.0); +bool f_imagepsencodefont(CObjRef font_index, CStrRef encodingfile); +bool f_imagepsextendfont(int font_index, double extend); +bool f_imagepsfreefont(CObjRef fontindex); +Object f_imagepsloadfont(CStrRef filename); +bool f_imagepsslantfont(CObjRef font_index, double slant); +Array f_imagepstext(CObjRef image, CStrRef text, CObjRef font, int size, int foreground, int background, int x, int y, int space = 0, int tightness = 0, double angle = 0.0, int antialias_steps = 0); +bool f_imagerectangle(CObjRef image, int x1, int y1, int x2, int y2, int color); +Variant f_imagerotate(CObjRef source_image, double angle, int bgd_color, int ignore_transparent = 0); +bool f_imagesavealpha(CObjRef image, bool saveflag); +bool f_imagesetbrush(CObjRef image, CObjRef brush); +bool f_imagesetpixel(CObjRef image, int x, int y, int color); +bool f_imagesetstyle(CObjRef image, CArrRef style); +bool f_imagesetthickness(CObjRef image, int thickness); +bool f_imagesettile(CObjRef image, CObjRef tile); +bool f_imagestring(CObjRef image, int font, int x, int y, CStrRef str, int color); +bool f_imagestringup(CObjRef image, int font, int x, int y, CStrRef str, int color); +Variant f_imagesx(CObjRef image); +Variant f_imagesy(CObjRef image); +Variant f_imagetruecolortopalette(CObjRef image, bool dither, int ncolors); +Variant f_imagettfbbox(double size, double angle, CStrRef fontfile, CStrRef text); +Variant f_imagettftext(CObjRef image, double size, double angle, int x, int y, int color, CStrRef fontfile, CStrRef text); +int f_imagetypes(); +bool f_imagewbmp(CObjRef image, CStrRef filename = null_string, int foreground = -1); +bool f_imagexbm(CObjRef image, CStrRef filename = null_string, int foreground = -1); +Variant f_iptcembed(CStrRef iptcdata, CStrRef jpeg_file_name, int spool = 0); +Variant f_iptcparse(CStrRef iptcblock); +bool f_jpeg2wbmp(CStrRef jpegname, CStrRef wbmpname, int dest_height, int dest_width, int threshold); +bool f_png2wbmp(CStrRef pngname, CStrRef wbmpname, int dest_height, int dest_width, int threshold); +Variant f_exif_imagetype(CStrRef filename); +Variant f_exif_read_data(CStrRef filename, CStrRef sections = null_string, bool arrays = false, bool thumbnail = false); +Variant f_read_exif_data(CStrRef filename, CStrRef sections = null_string, bool arrays = false, bool thumbnail = false); +Variant f_exif_tagname(int index); +Variant f_exif_thumbnail(CStrRef filename, Variant width = null, Variant height = null, Variant imagetype = null); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_IMAGE_H__ diff --git a/src/cpp/ext/ext_ipc.cpp b/src/cpp/ext/ext_ipc.cpp new file mode 100644 index 0000000000000..f1866e8383204 --- /dev/null +++ b/src/cpp/ext/ext_ipc.cpp @@ -0,0 +1,711 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +using namespace std; + +#ifdef MAC_OS_X +#include +#define MSGBUF_MTYPE(b) (b)->msg_magic +#define MSGBUF_MTEXT(b) (b)->msg_bufc +#else +#define MSGBUF_MTYPE(b) (b)->mtype +#define MSGBUF_MTEXT(b) (b)->mtext +#endif + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +int64 f_ftok(CStrRef pathname, CStrRef proj) { + if (pathname.empty()) { + Logger::Warning("Pathname is empty"); + return -1; + } + if (proj.length() != 1) { + Logger::Warning("Project identifier has to be one character int64: %s", + (const char *)proj); + return -1; + } + return ftok((const char *)pathname, (int)(*((const char *)proj))); +} + +/////////////////////////////////////////////////////////////////////////////// +// message queue + +class MessageQueue : public ResourceData { +public: + DECLARE_OBJECT_ALLOCATION(MessageQueue); + + int64 key; + int id; + + // overriding ResourceData + const char *o_getClassName() const { return "MessageQueue";} +}; +IMPLEMENT_OBJECT_ALLOCATION(MessageQueue); + +Variant f_msg_get_queue(int64 key, int64 perms /* = 0666 */) { + int id = msgget(key, 0); + if (id < 0) { + id = msgget(key, IPC_CREAT | IPC_EXCL | perms); + if (id < 0) { + Logger::Warning("Failed to create message queue for key 0x%lx: %s", + key, Util::safe_strerror(errno).c_str()); + return false; + } + } + MessageQueue *q = NEW(MessageQueue)(); + q->key = key; + q->id = id; + return Object(q); +} + +bool f_msg_remove_queue(CObjRef queue) { + MessageQueue *q = queue.getTyped(); + if (!q) { + Logger::Warning("Invalid message queue was specified"); + return false; + } + + return msgctl(q->id, IPC_RMID, NULL) == 0; +} + +bool f_msg_set_queue(CObjRef queue, CArrRef data) { + MessageQueue *q = queue.getTyped(); + if (!q) { + Logger::Warning("Invalid message queue was specified"); + return false; + } + + struct msqid_ds stat; + if (msgctl(q->id, IPC_STAT, &stat) == 0) { + Variant value; + value = data["msg_perm.uid"]; + if (!value.isNull()) stat.msg_perm.uid = (int64)value; + value = data["msg_perm.gid"]; + if (!value.isNull()) stat.msg_perm.uid = (int64)value; + value = data["msg_perm.mode"]; + if (!value.isNull()) stat.msg_perm.uid = (int64)value; + value = data["msg_qbytes"]; + if (!value.isNull()) stat.msg_perm.uid = (int64)value; + + return msgctl(q->id, IPC_SET, &stat) == 0; + } + + return false; +} + +Array f_msg_stat_queue(CObjRef queue) { + MessageQueue *q = queue.getTyped(); + if (!q) { + Logger::Warning("Invalid message queue was specified"); + return Array(); + } + + struct msqid_ds stat; + if (msgctl(q->id, IPC_STAT, &stat) == 0) { + Array data; + data.set("msg_perm.uid", (int64)stat.msg_perm.uid); + data.set("msg_perm.gid", (int64)stat.msg_perm.gid); + data.set("msg_perm.mode", stat.msg_perm.mode); + data.set("msg_stime", (int64)stat.msg_stime); + data.set("msg_rtime", (int64)stat.msg_rtime); + data.set("msg_ctime", (int64)stat.msg_ctime); + data.set("msg_qnum", (int64)stat.msg_qnum); + data.set("msg_qbytes", (int64)stat.msg_qbytes); + data.set("msg_lspid", stat.msg_lspid); + data.set("msg_lrpid", stat.msg_lrpid); + return data; + } + + return Array(); +} + +bool f_msg_send(CObjRef queue, int64 msgtype, CVarRef message, + bool serialize /* = true */, bool blocking /* = true */, + Variant errorcode /* = null */) { + MessageQueue *q = queue.getTyped(); + if (!q) { + Logger::Warning("Invalid message queue was specified"); + return false; + } + + struct msgbuf *buffer = NULL; + String data; + if (serialize) { + data = f_serialize(message); + } else { + data = message.toString(); + } + int len = data.length(); + buffer = (struct msgbuf *)calloc(len + sizeof(struct msgbuf), 1); + String deleter((char*)buffer, 1, AttachString); + MSGBUF_MTYPE(buffer) = msgtype; + memcpy(MSGBUF_MTEXT(buffer), (const char *)data, len + 1); + + int result = msgsnd(q->id, buffer, len, blocking ? 0 : IPC_NOWAIT); + if (result < 0) { + int err = errno; + Logger::Warning("Unable to send message: %s", + Util::safe_strerror(err).c_str()); + if (!errorcode.isNull()) { + errorcode = err; + } + return false; + } + return true; +} + +bool f_msg_receive(CObjRef queue, int64 desiredmsgtype, Variant msgtype, + int64 maxsize, Variant message, + bool unserialize /* = true */, + int64 flags /* = 0 */, Variant errorcode /* = null */) { + MessageQueue *q = queue.getTyped(); + if (!q) { + Logger::Warning("Invalid message queue was specified"); + return false; + } + + if (maxsize <= 0) { + Logger::Warning("Maximum size of the message has to be greater than zero"); + return false; + } + + int64 realflags = 0; + if (flags != 0) { +#ifndef MAC_OS_X + if (flags & k_MSG_EXCEPT) realflags |= MSG_EXCEPT; +#endif + if (flags & k_MSG_NOERROR) realflags |= MSG_NOERROR; + if (flags & k_MSG_IPC_NOWAIT) realflags |= IPC_NOWAIT; + } + + struct msgbuf *buffer = + (struct msgbuf *)calloc(maxsize + sizeof(struct msgbuf), 1); + String deleter((char*)buffer, 1, AttachString); + + int result = msgrcv(q->id, buffer, maxsize, desiredmsgtype, realflags); + if (result < 0) { + int err = errno; + Logger::Warning("Unable to receive message: %s", + Util::safe_strerror(err).c_str()); + if (!errorcode.isNull()) { + errorcode = err; + } + return false; + } + + msgtype = (int)MSGBUF_MTYPE(buffer); + if (unserialize) { + istringstream in((const char *)MSGBUF_MTEXT(buffer)); + VariableUnserializer vu(in); + try { + message = vu.unserialize(); + } catch (Exception &e) { + Logger::Warning("Message corrupted"); + return false; + } + } else { + message = (const char *)MSGBUF_MTEXT(buffer); + } + + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// semaphore + +/* Semaphore functions using System V semaphores. Each semaphore + * actually consists of three semaphores allocated as a unit under the + * same key. Semaphore 0 (SYSVSEM_SEM) is the actual semaphore, it is + * initialized to max_acquire and decremented as processes acquire it. + * The value of semaphore 1 (SYSVSEM_USAGE) is a count of the number + * of processes using the semaphore. After calling semget(), if a + * process finds that the usage count is 1, it will set the value of + * SYSVSEM_SEM to max_acquire. This allows max_acquire to be set and + * track the PHP code without having a global init routine or external + * semaphore init code. Except see the bug regarding a race condition + * php_sysvsem_get(). Semaphore 2 (SYSVSEM_SETVAL) serializes the + * calls to GETVAL SYSVSEM_USAGE and SETVAL SYSVSEM_SEM. It can be + * acquired only when it is zero. + */ +#define SYSVSEM_SEM 0 +#define SYSVSEM_USAGE 1 +#define SYSVSEM_SETVAL 2 + +union semun { + int val; /* value for SETVAL */ + struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */ + unsigned short *array; /* array for GETALL, SETALL */ + /* Linux specific part: */ + struct seminfo *__buf; /* buffer for IPC_INFO */ +}; + +class Semaphore : public SweepableResourceData { +public: + int key; // For error reporting. + int semid; // Returned by semget() + int count; // Acquire count for auto-release. + int auto_release; // flag that says to auto-release. + + // overriding ResourceData + const char *o_getClassName() const { return "Semaphore";} + + bool op(bool acquire) { + struct sembuf sop; + + if (!acquire && count == 0) { + Logger::Warning("SysV semaphore %d (key 0x%x) is not currently acquired", + o_getId(), key); + return false; + } + + sop.sem_num = SYSVSEM_SEM; + sop.sem_op = acquire ? -1 : 1; + sop.sem_flg = SEM_UNDO; + + while (semop(semid, &sop, 1) == -1) { + if (errno != EINTR) { + Logger::Warning("failed to %s key 0x%x: %s", + acquire ? "acquire" : "release", + key, Util::safe_strerror(errno).c_str()); + return false; + } + } + + count -= acquire ? -1 : 1; + return true; + } + + ~Semaphore() { + struct sembuf sop[2]; + int opcount = 1; + + /* + * if count == -1, semaphore has been removed + * Need better way to handle this + */ + if (count == -1 || !auto_release) { + return; + } + + /* Decrement the usage count. */ + sop[0].sem_num = SYSVSEM_USAGE; + sop[0].sem_op = -1; + sop[0].sem_flg = SEM_UNDO; + + /* Release the semaphore if it has been acquired but not released. */ + if (count) { + sop[1].sem_num = SYSVSEM_SEM; + sop[1].sem_op = count; + sop[1].sem_flg = SEM_UNDO; + opcount++; + } + + semop(semid, sop, opcount); + } +}; + +bool f_sem_acquire(CObjRef sem_identifier) { + return sem_identifier.getTyped()->op(true); +} + +bool f_sem_release(CObjRef sem_identifier) { + return sem_identifier.getTyped()->op(false); +} + +/** + * Return an id for the semaphore with the given key, and allow max_acquire + * (default 1) processes to acquire it simultaneously. + */ +Variant f_sem_get(int64 key, int64 max_acquire /* = 1 */, + int64 perm /* = 0666 */, bool auto_release /* = true */) { + /* Get/create the semaphore. Note that we rely on the semaphores + * being zeroed when they are created. Despite the fact that + * the(?) Linux semget() man page says they are not initialized, + * the kernel versions 2.0.x and 2.1.z do in fact zero them. + */ + int semid = semget(key, 3, perm|IPC_CREAT); + if (semid == -1) { + Logger::Warning("failed for key 0x%lx: %s", key, + Util::safe_strerror(errno).c_str()); + return false; + } + + /* Find out how many processes are using this semaphore. Note + * that on Linux (at least) there is a race condition here because + * semaphore undo on process exit is not atomic, so we could + * acquire SYSVSEM_SETVAL before a crashed process has decremented + * SYSVSEM_USAGE in which case count will be greater than it + * should be and we won't set max_acquire. Fortunately this + * doesn't actually matter in practice. + */ + + /* Wait for sem 1 to be zero . . . */ + struct sembuf sop[3]; + sop[0].sem_num = SYSVSEM_SETVAL; + sop[0].sem_op = 0; + sop[0].sem_flg = 0; + + /* . . . and increment it so it becomes non-zero . . . */ + sop[1].sem_num = SYSVSEM_SETVAL; + sop[1].sem_op = 1; + sop[1].sem_flg = SEM_UNDO; + + /* . . . and increment the usage count. */ + sop[2].sem_num = SYSVSEM_USAGE; + sop[2].sem_op = 1; + sop[2].sem_flg = SEM_UNDO; + + while (semop(semid, sop, 3) == -1) { + if (errno != EINTR) { + Logger::Warning("failed acquiring SYSVSEM_SETVAL for key 0x%lx: %s", + key, Util::safe_strerror(errno).c_str()); + break; + } + } + + /* Get the usage count. */ + int count = semctl(semid, SYSVSEM_USAGE, GETVAL, NULL); + if (count == -1) { + Logger::Warning("failed for key 0x%lx: %s", key, + Util::safe_strerror(errno).c_str()); + } + + /* If we are the only user, then take this opportunity to set the max. */ + if (count == 1) { + union semun semarg; + semarg.val = max_acquire; + if (semctl(semid, SYSVSEM_SEM, SETVAL, semarg) == -1) { + Logger::Warning("failed for key 0x%lx: %s", key, + Util::safe_strerror(errno).c_str()); + } + } + + /* Set semaphore 1 back to zero. */ + sop[0].sem_num = SYSVSEM_SETVAL; + sop[0].sem_op = -1; + sop[0].sem_flg = SEM_UNDO; + while (semop(semid, sop, 1) == -1) { + if (errno != EINTR) { + Logger::Warning("failed releasing SYSVSEM_SETVAL for key 0x%lx: %s", + key, Util::safe_strerror(errno).c_str()); + break; + } + } + + Semaphore *sem_ptr = new Semaphore(); + sem_ptr->key = key; + sem_ptr->semid = semid; + sem_ptr->count = 0; + sem_ptr->auto_release = auto_release; + return Object(sem_ptr); +} + +/** + * contributed by Gavin Sherry gavin@linuxworld.com.au + * Fri Mar 16 00:50:13 EST 2001 + */ +bool f_sem_remove(CObjRef sem_identifier) { + Semaphore *sem_ptr = sem_identifier.getTyped(); + + union semun un; + struct semid_ds buf; + un.buf = &buf; + if (semctl(sem_ptr->semid, 0, IPC_STAT, un) < 0) { + Logger::Warning("SysV semaphore %d does not (any longer) exist", + sem_identifier->o_getId()); + return false; + } + + if (semctl(sem_ptr->semid, 0, IPC_RMID, un) < 0) { + Logger::Warning("failed for SysV sempphore %d: %s", + sem_identifier->o_getId(), + Util::safe_strerror(errno).c_str()); + return false; + } + + /* let release_sysvsem_sem know we have removed + * the semaphore to avoid issues with releasing. + */ + sem_ptr->count = -1; + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// shared memory + +typedef struct { + long key; + long length; + long next; + char mem; +} sysvshm_chunk; + +typedef struct { + char magic[8]; + long start; + long end; + long free; + long total; +} sysvshm_chunk_head; + +class sysvshm_shm { +public: + key_t key; /* Key set by user */ + long id; /* Returned by shmget. */ + sysvshm_chunk_head *ptr; /* memoryaddress of shared memory */ + + ~sysvshm_shm() { + shmdt((void *)ptr); + } +}; + +class shm_set : public std::set { +public: + ~shm_set() { + for (std::set::iterator iter = begin(); iter != end(); + ++iter) { + delete *iter; + } + } +}; + +static Mutex g_shm_mutex; +static shm_set g_shms; + +static long check_shm_data(sysvshm_chunk_head *ptr, long key) { + long pos; + sysvshm_chunk *shm_var; + + pos = ptr->start; + + for (;;) { + if (pos >= ptr->end) { + return -1; + } + shm_var = (sysvshm_chunk*) ((char *) ptr + pos); + if (shm_var->key == key) { + return pos; + } + pos += shm_var->next; + + if (shm_var->next <= 0 || pos < ptr->start) { + return -1; + } + } + return -1; +} + +static int remove_shm_data(sysvshm_chunk_head *ptr, long shm_varpos) { + sysvshm_chunk *chunk_ptr, *next_chunk_ptr; + long memcpy_len; + + chunk_ptr = (sysvshm_chunk *) ((char *) ptr + shm_varpos); + next_chunk_ptr = + (sysvshm_chunk *) ((char *) ptr + shm_varpos + chunk_ptr->next); + + memcpy_len = ptr->end-shm_varpos - chunk_ptr->next; + ptr->free += chunk_ptr->next; + ptr->end -= chunk_ptr->next; + if (memcpy_len > 0) { + memcpy(chunk_ptr, next_chunk_ptr, memcpy_len); + } + return 0; +} + +static int put_shm_data(sysvshm_chunk_head *ptr, long key, char *data, + long len) { + sysvshm_chunk *shm_var; + long total_size; + long shm_varpos; + + total_size = ((long) (len + sizeof(sysvshm_chunk) - 1) / 4) * 4 + + 4; /* 4-byte alligment */ + + if ((shm_varpos = check_shm_data(ptr, key)) > 0) { + remove_shm_data(ptr, shm_varpos); + } + + if (ptr->free < total_size) { + return -1; /* not enough memeory */ + } + + shm_var = (sysvshm_chunk *) ((char *) ptr + ptr->end); + shm_var->key = key; + shm_var->length = len; + shm_var->next = total_size; + memcpy(&(shm_var->mem), data, len); + ptr->end += total_size; + ptr->free -= total_size; + return 0; +} + +Variant f_shm_attach(int64 shm_key, int64 shm_size /* = 10000 */, + int64 shm_flag /* = 0666 */) { + char *shm_ptr; + long shm_id; + + if (shm_size < 1) { + Logger::Warning("Segment size must be greater then zero."); + return false; + } + + sysvshm_shm *shm_list_ptr = new sysvshm_shm(); + + /* get the id from a specified key or create new shared memory */ + if ((shm_id = shmget(shm_key, 0, 0)) < 0) { + if (shm_size < (int)sizeof(sysvshm_chunk_head)) { + Logger::Warning("failed for key 0x%x: memorysize too small", shm_key); + free(shm_list_ptr); + return false; + } + if ((shm_id = shmget(shm_key, shm_size, shm_flag | IPC_CREAT | IPC_EXCL)) + < 0) { + Logger::Warning("failed for key 0x%x: %s", shm_key, + Util::safe_strerror(errno).c_str()); + free(shm_list_ptr); + return false; + } + } + + if ((shm_ptr = (char*)shmat(shm_id, NULL, 0)) == (char *)-1) { + Logger::Warning("failed for key 0x%x: %s", shm_key, + Util::safe_strerror(errno).c_str()); + free(shm_list_ptr); + return false; + } + + /* check if shm is already initialized */ + sysvshm_chunk_head *chunk_ptr = (sysvshm_chunk_head *)shm_ptr; + if (strcmp((char*) &(chunk_ptr->magic), "PHP_SM") != 0) { + strcpy((char*) &(chunk_ptr->magic), "PHP_SM"); + chunk_ptr->start = sizeof(sysvshm_chunk_head); + chunk_ptr->end = chunk_ptr->start; + chunk_ptr->total = shm_size; + chunk_ptr->free = shm_size-chunk_ptr->end; + } + + shm_list_ptr->key = shm_key; + shm_list_ptr->id = shm_id; + shm_list_ptr->ptr = chunk_ptr; + Lock lock(g_shm_mutex); + g_shms.insert(shm_list_ptr); + return (int64)shm_list_ptr; +} + +bool f_shm_detach(int64 shm_identifier) { + Lock lock(g_shm_mutex); + set::iterator iter = g_shms.find((sysvshm_shm*)shm_identifier); + if (iter == g_shms.end()) { + Logger::Warning("%lld is not a SysV shared memory index", shm_identifier); + return false; + } + g_shms.erase(iter); + delete *iter; + return true; +} + +bool f_shm_remove(int64 shm_identifier) { + Lock lock(g_shm_mutex); + set::iterator iter = g_shms.find((sysvshm_shm*)shm_identifier); + if (iter == g_shms.end()) { + Logger::Warning("%lld is not a SysV shared memory index", shm_identifier); + return false; + } + sysvshm_shm *shm_list_ptr = *iter; + + if (shmctl(shm_list_ptr->id, IPC_RMID,NULL) < 0) { + Logger::Warning("failed for key 0x%x, id %lld: %s", shm_list_ptr->key, + shm_identifier, Util::safe_strerror(errno).c_str()); + return false; + } + return true; +} + +Variant f_shm_get_var(int64 shm_identifier, int64 variable_key) { + Lock lock(g_shm_mutex); + set::iterator iter = g_shms.find((sysvshm_shm*)shm_identifier); + if (iter == g_shms.end()) { + Logger::Warning("%lld is not a SysV shared memory index", shm_identifier); + return false; + } + sysvshm_shm *shm_list_ptr = *iter; + + long shm_varpos = check_shm_data(shm_list_ptr->ptr, variable_key); + if (shm_varpos < 0) { + return false; + } + + sysvshm_chunk *shm_var = + (sysvshm_chunk*)((char *)shm_list_ptr->ptr + shm_varpos); + return f_unserialize(String(&shm_var->mem, shm_var->length, AttachLiteral)); +} + +bool f_shm_put_var(int64 shm_identifier, int64 variable_key, + CVarRef variable) { + Lock lock(g_shm_mutex); + set::iterator iter = g_shms.find((sysvshm_shm*)shm_identifier); + if (iter == g_shms.end()) { + Logger::Warning("%lld is not a SysV shared memory index", shm_identifier); + return false; + } + sysvshm_shm *shm_list_ptr = *iter; + + /* setup string-variable and serialize */ + String serialized = f_serialize(variable); + + /* insert serialized variable into shared memory */ + int ret = put_shm_data(shm_list_ptr->ptr, variable_key, + (char*)serialized.data(), serialized.size()); + if (ret == -1) { + Logger::Warning("not enough shared memory left"); + return false; + } + return true; +} + +bool f_shm_remove_var(int64 shm_identifier, int64 variable_key) { + Lock lock(g_shm_mutex); + set::iterator iter = g_shms.find((sysvshm_shm*)shm_identifier); + if (iter == g_shms.end()) { + Logger::Warning("%lld is not a SysV shared memory index", shm_identifier); + return false; + } + sysvshm_shm *shm_list_ptr = *iter; + + long shm_varpos = check_shm_data(shm_list_ptr->ptr, variable_key); + if (shm_varpos < 0) { + Logger::Warning("variable key %lld doesn't exist", variable_key); + return false; + } + remove_shm_data(shm_list_ptr->ptr, shm_varpos); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_ipc.h b/src/cpp/ext/ext_ipc.h new file mode 100644 index 0000000000000..f44439130e841 --- /dev/null +++ b/src/cpp/ext/ext_ipc.h @@ -0,0 +1,62 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_IPC_H__ +#define __EXT_IPC_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// message queue + +int64 f_ftok(CStrRef pathname, CStrRef proj); + +Variant f_msg_get_queue(int64 key, int64 perms = 0666); +bool f_msg_send(CObjRef queue, int64 msgtype, CVarRef message, + bool serialize = true, bool blocking = true, + Variant errorcode = null); +bool f_msg_receive(CObjRef queue, int64 desiredmsgtype, Variant msgtype, + int64 maxsize, Variant message, bool unserialize = true, + int64 flags = 0, Variant errorcode = null); +bool f_msg_remove_queue(CObjRef queue); +bool f_msg_set_queue(CObjRef queue, CArrRef data); +Array f_msg_stat_queue(CObjRef queue); + +/////////////////////////////////////////////////////////////////////////////// +// semaphore + +bool f_sem_acquire(CObjRef sem_identifier); +Variant f_sem_get(int64 key, int64 max_acquire = 1, int64 perm = 0666, + bool auto_release = true); +bool f_sem_release(CObjRef sem_identifier); +bool f_sem_remove(CObjRef sem_identifier); + +/////////////////////////////////////////////////////////////////////////////// +// shared memory + +Variant f_shm_attach(int64 shm_key, int64 shm_size = 10000, int64 shm_flag = 0666); +bool f_shm_detach(int64 shm_identifier); +bool f_shm_remove(int64 shm_identifier); +Variant f_shm_get_var(int64 shm_identifier, int64 variable_key); +bool f_shm_put_var(int64 shm_identifier, int64 variable_key, CVarRef variable); +bool f_shm_remove_var(int64 shm_identifier, int64 variable_key); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_IPC_H__ diff --git a/src/cpp/ext/ext_json.cpp b/src/cpp/ext/ext_json.cpp new file mode 100644 index 0000000000000..4ab610ef7c1e2 --- /dev/null +++ b/src/cpp/ext/ext_json.cpp @@ -0,0 +1,94 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +String f_json_encode(CVarRef value, bool loose /* = false */) { + VariableSerializer vs(VariableSerializer::JSON, loose ? 1 : 0); + Variant ret = vs.serialize(value, true); + if (value.isContagious()) { + value.clearContagious(); + } + return ret; +} + +Variant f_json_decode(CStrRef json, bool assoc /* = false */, + bool loose /* = false */) { + if (json.empty()) { + return null; + } + + unsigned short *utf16 = (unsigned short *)malloc((json.size() + 1) * + sizeof(unsigned short) + 1); + + int utf16_len = utf8_to_utf16(utf16, (char*)json.data(), json.size(), + loose ? 1 : 0); + if (utf16_len <= 0) { + if (utf16) { + free(utf16); + } + return null; + } + + Variant z; + if (JSON_parser(z, utf16, utf16_len, assoc, loose)) { + free(utf16); + return z; + } + free(utf16); + + if (json.size() == 4) { + if (!strcasecmp(json.data(), "null")) return null; + if (!strcasecmp(json.data(), "true")) return true; + } else if (json.size() == 5 && !strcasecmp(json.data(), "false")) { + return false; + } + + int64 p; + double d; + DataType type = is_numeric_string(json.data(), json.size(), &p, &d, 0); + if (type == KindOfInt64) { + return p; + } else if (type == KindOfDouble) { + return d; + } + + char ch0 = json.charAt(0); + if (json.size() > 1 && ch0 == '"' && json.charAt(json.size() - 1) == '"') { + return json.substr(1, json.size() - 2); + } + + if (loose && json.size() > 1 && + ch0 == '\'' && json.charAt(json.size() - 1) == '\'') { + return json.substr(1, json.size() - 2); + } + + if (ch0 == '{' || ch0 == '[') { /* invalid JSON string */ + return null; + } + + return json; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_json.h b/src/cpp/ext/ext_json.h new file mode 100644 index 0000000000000..77c868bb5a600 --- /dev/null +++ b/src/cpp/ext/ext_json.h @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_JSON_H__ +#define __EXT_JSON_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +String f_json_encode(CVarRef value, bool loose = false); +Variant f_json_decode(CStrRef json, bool assoc = false, bool loose = false); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_JSON_H__ diff --git a/src/cpp/ext/ext_ldap.cpp b/src/cpp/ext/ext_ldap.cpp new file mode 100644 index 0000000000000..7ea323b40f886 --- /dev/null +++ b/src/cpp/ext/ext_ldap.cpp @@ -0,0 +1,332 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include "crutch.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Object f_ldap_connect(CStrRef hostname /* = null_string */, int port /* = 389 */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(hostname), NEW(ArrayElement)(port), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_connect", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Array f_ldap_explode_dn(CStrRef dn, int with_attrib) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(dn), NEW(ArrayElement)(with_attrib), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_explode_dn", _schema, _params); + return (Variant)_ret[0]; +} + +String f_ldap_dn2ufn(CStrRef db) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(db), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_dn2ufn", _schema, _params); + return (Variant)_ret[0]; +} + +String f_ldap_err2str(int errnum) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(errnum), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_err2str", _schema, _params); + return (Variant)_ret[0]; +} + +String f_ldap_8859_to_t61(CStrRef value) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(value), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_8859_to_t61", _schema, _params); + return (Variant)_ret[0]; +} + +String f_ldap_t61_to_8859(CStrRef value) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(value), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_t61_to_8859", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_add(CObjRef link_identifier, CStrRef dn, CArrRef entry) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(dn), NEW(ArrayElement)(entry), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_add", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_mod_add(CObjRef link_identifier, CStrRef dn, CArrRef entry) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(dn), NEW(ArrayElement)(entry), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_mod_add", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_mod_del(CObjRef link_identifier, CStrRef dn, CArrRef entry) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(dn), NEW(ArrayElement)(entry), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_mod_del", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_mod_replace(CObjRef link_identifier, CStrRef dn, CArrRef entry) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(dn), NEW(ArrayElement)(entry), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_mod_replace", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_modify(CObjRef link_identifier, CStrRef dn, CArrRef entry) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(dn), NEW(ArrayElement)(entry), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_modify", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_bind(CObjRef link_identifier, CStrRef bind_rdn /* = null_string */, CStrRef bind_password /* = null_string */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(bind_rdn), NEW(ArrayElement)(bind_password), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_bind", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_sasl_bind(CObjRef link, CStrRef binddn /* = null_string */, CStrRef password /* = null_string */, CStrRef sasl_mech /* = null_string */, CStrRef sasl_realm /* = null_string */, CStrRef sasl_authz_id /* = null_string */, CStrRef props /* = null_string */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link)), NEW(ArrayElement)(binddn), NEW(ArrayElement)(password), NEW(ArrayElement)(sasl_mech), NEW(ArrayElement)(sasl_realm), NEW(ArrayElement)(sasl_authz_id), NEW(ArrayElement)(props), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_sasl_bind", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_set_rebind_proc(CObjRef link, CStrRef callback) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link)), NEW(ArrayElement)(callback), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_set_rebind_proc", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_sort(CObjRef link, CObjRef result, CStrRef sortfilter) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link)), NEW(ArrayElement)(OpaqueObject::GetIndex(result)), NEW(ArrayElement)(sortfilter), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_sort", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_start_tls(CObjRef link) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_start_tls", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_unbind(CObjRef link_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_unbind", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_get_option(CObjRef link_identifier, int option, Variant retval) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(2, "R"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(option), NEW(ArrayElement)(retval), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_get_option", _schema, _params); + retval = ((Variant)_ret[1])[2]; + return (Variant)_ret[0]; +} + +bool f_ldap_set_option(CObjRef link_identifier, int option, CVarRef newval) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(option), NEW(ArrayElement)(newval), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_set_option", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_close(CObjRef link_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_close", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_ldap_list(CObjRef link_identifier, CStrRef base_dn, CStrRef filter, CArrRef attributes /* = null */, int attrsonly /* = 0 */, int sizelimit /* = 0 */, int timelimit /* = 0 */, int deref /* = 0 */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(base_dn), NEW(ArrayElement)(filter), NEW(ArrayElement)(attributes), NEW(ArrayElement)(attrsonly), NEW(ArrayElement)(sizelimit), NEW(ArrayElement)(timelimit), NEW(ArrayElement)(deref), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_list", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_ldap_read(CObjRef link_identifier, CStrRef base_dn, CStrRef filter, CArrRef attributes /* = null */, int attrsonly /* = 0 */, int sizelimit /* = 0 */, int timelimit /* = 0 */, int deref /* = 0 */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(base_dn), NEW(ArrayElement)(filter), NEW(ArrayElement)(attributes), NEW(ArrayElement)(attrsonly), NEW(ArrayElement)(sizelimit), NEW(ArrayElement)(timelimit), NEW(ArrayElement)(deref), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_read", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_ldap_search(CObjRef link_identifier, CStrRef base_dn, CStrRef filter, CArrRef attributes /* = null */, int attrsonly /* = 0 */, int sizelimit /* = 0 */, int timelimit /* = 0 */, int deref /* = 0 */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(base_dn), NEW(ArrayElement)(filter), NEW(ArrayElement)(attributes), NEW(ArrayElement)(attrsonly), NEW(ArrayElement)(sizelimit), NEW(ArrayElement)(timelimit), NEW(ArrayElement)(deref), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_search", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_ldap_rename(CObjRef link_identifier, CStrRef dn, CStrRef newrdn, CStrRef newparent, bool deleteoldrdn) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(dn), NEW(ArrayElement)(newrdn), NEW(ArrayElement)(newparent), NEW(ArrayElement)(deleteoldrdn), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_rename", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ldap_delete(CObjRef link_identifier, CStrRef dn) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(dn), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_delete", _schema, _params); + return (Variant)_ret[0]; +} + +Variant f_ldap_compare(CObjRef link_identifier, CStrRef dn, CStrRef attribute, CStrRef value) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(dn), NEW(ArrayElement)(attribute), NEW(ArrayElement)(value), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_compare", _schema, _params); + return (Variant)_ret[0]; +} + +int f_ldap_errno(CObjRef link_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_errno", _schema, _params); + return (Variant)_ret[0]; +} + +String f_ldap_error(CObjRef link_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_error", _schema, _params); + return (Variant)_ret[0]; +} + +String f_ldap_get_dn(CObjRef link_identifier, CObjRef result_entry_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_entry_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_get_dn", _schema, _params); + return (Variant)_ret[0]; +} + +int f_ldap_count_entries(CObjRef link_identifier, CObjRef result_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_count_entries", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_ldap_get_entries(CObjRef link_identifier, CObjRef result_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_get_entries", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_ldap_first_entry(CObjRef link_identifier, CObjRef result_identifier) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_first_entry", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_ldap_next_entry(CObjRef link_identifier, CObjRef result_identifier) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_next_entry", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Array f_ldap_get_attributes(CObjRef link_identifier, CObjRef result_entry_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_entry_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_get_attributes", _schema, _params); + return (Variant)_ret[0]; +} + +String f_ldap_first_attribute(CObjRef link_identifier, CObjRef result_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_first_attribute", _schema, _params); + return (Variant)_ret[0]; +} + +String f_ldap_next_attribute(CObjRef link_identifier, CObjRef result_entry_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_entry_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_next_attribute", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_ldap_first_reference(CObjRef link_identifier, CObjRef result_identifier) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_first_reference", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_ldap_next_reference(CObjRef link_identifier, CObjRef result_identifier) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_next_reference", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_ldap_parse_reference(CObjRef link_identifier, CObjRef result_identifier, Variant referrals) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), NEW(ArrayElement)(2, "R"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_identifier)), NEW(ArrayElement)(referrals), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_parse_reference", _schema, _params); + referrals = ((Variant)_ret[1])[2]; + return (Variant)_ret[0]; +} + +bool f_ldap_parse_result(CObjRef link_identifier, CObjRef result_entry_identifier, Variant errcode, Variant matcheddn /* = null */, Variant errmsg /* = null */, Variant referrals /* = null */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), NEW(ArrayElement)(2, "R"), NEW(ArrayElement)(3, "R"), NEW(ArrayElement)(4, "R"), NEW(ArrayElement)(5, "R"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_entry_identifier)), NEW(ArrayElement)(errcode), NEW(ArrayElement)(matcheddn), NEW(ArrayElement)(errmsg), NEW(ArrayElement)(referrals), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_parse_result", _schema, _params); + errcode = ((Variant)_ret[1])[2]; + matcheddn = ((Variant)_ret[1])[3]; + errmsg = ((Variant)_ret[1])[4]; + referrals = ((Variant)_ret[1])[5]; + return (Variant)_ret[0]; +} + +bool f_ldap_free_result(CObjRef result_identifier) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(result_identifier)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_free_result", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_ldap_get_values_len(CObjRef link_identifier, CObjRef result_entry_identifier, CStrRef attribute) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_entry_identifier)), NEW(ArrayElement)(attribute), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_get_values_len", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_ldap_get_values(CObjRef link_identifier, CObjRef result_entry_identifier, CStrRef attribute) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(link_identifier)), NEW(ArrayElement)(OpaqueObject::GetIndex(result_entry_identifier)), NEW(ArrayElement)(attribute), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ldap_get_values", _schema, _params); + return (Variant)_ret[0]; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_ldap.h b/src/cpp/ext/ext_ldap.h new file mode 100644 index 0000000000000..62815c0a9af6f --- /dev/null +++ b/src/cpp/ext/ext_ldap.h @@ -0,0 +1,75 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_LDAP_H__ +#define __EXT_LDAP_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Object f_ldap_connect(CStrRef hostname = null_string, int port = 389); +Array f_ldap_explode_dn(CStrRef dn, int with_attrib); +String f_ldap_dn2ufn(CStrRef db); +String f_ldap_err2str(int errnum); +String f_ldap_8859_to_t61(CStrRef value); +String f_ldap_t61_to_8859(CStrRef value); +bool f_ldap_add(CObjRef link_identifier, CStrRef dn, CArrRef entry); +bool f_ldap_mod_add(CObjRef link_identifier, CStrRef dn, CArrRef entry); +bool f_ldap_mod_del(CObjRef link_identifier, CStrRef dn, CArrRef entry); +bool f_ldap_mod_replace(CObjRef link_identifier, CStrRef dn, CArrRef entry); +bool f_ldap_modify(CObjRef link_identifier, CStrRef dn, CArrRef entry); +bool f_ldap_bind(CObjRef link_identifier, CStrRef bind_rdn = null_string, CStrRef bind_password = null_string); +bool f_ldap_sasl_bind(CObjRef link, CStrRef binddn = null_string, CStrRef password = null_string, CStrRef sasl_mech = null_string, CStrRef sasl_realm = null_string, CStrRef sasl_authz_id = null_string, CStrRef props = null_string); +bool f_ldap_set_rebind_proc(CObjRef link, CStrRef callback); +bool f_ldap_sort(CObjRef link, CObjRef result, CStrRef sortfilter); +bool f_ldap_start_tls(CObjRef link); +bool f_ldap_unbind(CObjRef link_identifier); +bool f_ldap_get_option(CObjRef link_identifier, int option, Variant retval); +bool f_ldap_set_option(CObjRef link_identifier, int option, CVarRef newval); +bool f_ldap_close(CObjRef link_identifier); +Object f_ldap_list(CObjRef link_identifier, CStrRef base_dn, CStrRef filter, CArrRef attributes = null, int attrsonly = 0, int sizelimit = 0, int timelimit = 0, int deref = 0); +Object f_ldap_read(CObjRef link_identifier, CStrRef base_dn, CStrRef filter, CArrRef attributes = null, int attrsonly = 0, int sizelimit = 0, int timelimit = 0, int deref = 0); +Object f_ldap_search(CObjRef link_identifier, CStrRef base_dn, CStrRef filter, CArrRef attributes = null, int attrsonly = 0, int sizelimit = 0, int timelimit = 0, int deref = 0); +bool f_ldap_rename(CObjRef link_identifier, CStrRef dn, CStrRef newrdn, CStrRef newparent, bool deleteoldrdn); +bool f_ldap_delete(CObjRef link_identifier, CStrRef dn); +Variant f_ldap_compare(CObjRef link_identifier, CStrRef dn, CStrRef attribute, CStrRef value); +int f_ldap_errno(CObjRef link_identifier); +String f_ldap_error(CObjRef link_identifier); +String f_ldap_get_dn(CObjRef link_identifier, CObjRef result_entry_identifier); +int f_ldap_count_entries(CObjRef link_identifier, CObjRef result_identifier); +Array f_ldap_get_entries(CObjRef link_identifier, CObjRef result_identifier); +Object f_ldap_first_entry(CObjRef link_identifier, CObjRef result_identifier); +Object f_ldap_next_entry(CObjRef link_identifier, CObjRef result_identifier); +Array f_ldap_get_attributes(CObjRef link_identifier, CObjRef result_entry_identifier); +String f_ldap_first_attribute(CObjRef link_identifier, CObjRef result_identifier); +String f_ldap_next_attribute(CObjRef link_identifier, CObjRef result_entry_identifier); +Object f_ldap_first_reference(CObjRef link_identifier, CObjRef result_identifier); +Object f_ldap_next_reference(CObjRef link_identifier, CObjRef result_identifier); +bool f_ldap_parse_reference(CObjRef link_identifier, CObjRef result_identifier, Variant referrals); +bool f_ldap_parse_result(CObjRef link_identifier, CObjRef result_entry_identifier, Variant errcode, Variant matcheddn = null, Variant errmsg = null, Variant referrals = null); +bool f_ldap_free_result(CObjRef result_identifier); +Array f_ldap_get_values_len(CObjRef link_identifier, CObjRef result_entry_identifier, CStrRef attribute); +Array f_ldap_get_values(CObjRef link_identifier, CObjRef result_entry_identifier, CStrRef attribute); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_LDAP_H__ diff --git a/src/cpp/ext/ext_magick.cpp b/src/cpp/ext/ext_magick.cpp new file mode 100644 index 0000000000000..ddd840f0bb2ad --- /dev/null +++ b/src/cpp/ext/ext_magick.cpp @@ -0,0 +1,2910 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include "crutch.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +String f_magickgetcopyright() { + Array _schema((ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetcopyright", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgethomeurl() { + Array _schema((ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgethomeurl", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetpackagename() { + Array _schema((ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetpackagename", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetquantumdepth() { + Array _schema((ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetquantumdepth", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetreleasedate() { + Array _schema((ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetreleasedate", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetresourcelimit(int resource_type) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(resource_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetresourcelimit", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetversion() { + Array _schema((ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetversion", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetversionnumber() { + Array _schema((ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetversionnumber", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetversionstring() { + Array _schema((ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetversionstring", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickqueryconfigureoption(CStrRef option) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(option), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickqueryconfigureoption", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickqueryconfigureoptions(CStrRef pattern) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(pattern), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickqueryconfigureoptions", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickqueryfonts(CStrRef pattern) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(pattern), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickqueryfonts", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickqueryformats(CStrRef pattern) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(pattern), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickqueryformats", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetresourcelimit(int resource_type, double limit) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(resource_type), NEW(ArrayElement)(limit), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetresourcelimit", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_newdrawingwand() { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("newdrawingwand", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_newmagickwand() { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("newmagickwand", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_newpixeliterator(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("newpixeliterator", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_newpixelregioniterator(CObjRef mgck_wnd, int x, int y, int columns, int rows) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), NEW(ArrayElement)(columns), NEW(ArrayElement)(rows), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("newpixelregioniterator", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_newpixelwand(CStrRef imagemagick_col_str /* = null_string */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(imagemagick_col_str), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("newpixelwand", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Array f_newpixelwandarray(int num_pxl_wnds) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(num_pxl_wnds), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("newpixelwandarray", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_newpixelwands(int num_pxl_wnds) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(num_pxl_wnds), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("newpixelwands", _schema, _params); + return (Variant)_ret[0]; +} + +void f_destroydrawingwand(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("destroydrawingwand", _schema, _params); +} + +void f_destroymagickwand(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("destroymagickwand", _schema, _params); +} + +void f_destroypixeliterator(CObjRef pxl_iter) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_iter)), (ArrayElement*)NULL); + Crutch::Invoke("destroypixeliterator", _schema, _params); +} + +void f_destroypixelwand(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("destroypixelwand", _schema, _params); +} + +void f_destroypixelwandarray(CArrRef pxl_wnd_array) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(pxl_wnd_array), (ArrayElement*)NULL); + Crutch::Invoke("destroypixelwandarray", _schema, _params); +} + +void f_destroypixelwands(CArrRef pxl_wnd_array) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(pxl_wnd_array), (ArrayElement*)NULL); + Crutch::Invoke("destroypixelwands", _schema, _params); +} + +bool f_isdrawingwand(CVarRef var) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(var), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("isdrawingwand", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ismagickwand(CVarRef var) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(var), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ismagickwand", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ispixeliterator(CVarRef var) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(var), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ispixeliterator", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_ispixelwand(CVarRef var) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(var), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("ispixelwand", _schema, _params); + return (Variant)_ret[0]; +} + +void f_cleardrawingwand(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("cleardrawingwand", _schema, _params); +} + +void f_clearmagickwand(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("clearmagickwand", _schema, _params); +} + +void f_clearpixeliterator(CObjRef pxl_iter) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_iter)), (ArrayElement*)NULL); + Crutch::Invoke("clearpixeliterator", _schema, _params); +} + +void f_clearpixelwand(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("clearpixelwand", _schema, _params); +} + +Object f_clonedrawingwand(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("clonedrawingwand", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_clonemagickwand(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("clonemagickwand", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Array f_wandgetexception(CObjRef wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("wandgetexception", _schema, _params); + return (Variant)_ret[0]; +} + +String f_wandgetexceptionstring(CObjRef wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("wandgetexceptionstring", _schema, _params); + return (Variant)_ret[0]; +} + +int f_wandgetexceptiontype(CObjRef wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("wandgetexceptiontype", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_wandhasexception(CObjRef wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("wandhasexception", _schema, _params); + return (Variant)_ret[0]; +} + +void f_drawaffine(CObjRef drw_wnd, double sx, double sy, double rx, double ry, double tx, double ty) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(sx), NEW(ArrayElement)(sy), NEW(ArrayElement)(rx), NEW(ArrayElement)(ry), NEW(ArrayElement)(tx), NEW(ArrayElement)(ty), (ArrayElement*)NULL); + Crutch::Invoke("drawaffine", _schema, _params); +} + +void f_drawannotation(CObjRef drw_wnd, double x, double y, CStrRef text) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), NEW(ArrayElement)(text), (ArrayElement*)NULL); + Crutch::Invoke("drawannotation", _schema, _params); +} + +void f_drawarc(CObjRef drw_wnd, double sx, double sy, double ex, double ey, double sd, double ed) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(sx), NEW(ArrayElement)(sy), NEW(ArrayElement)(ex), NEW(ArrayElement)(ey), NEW(ArrayElement)(sd), NEW(ArrayElement)(ed), (ArrayElement*)NULL); + Crutch::Invoke("drawarc", _schema, _params); +} + +void f_drawbezier(CObjRef drw_wnd, CArrRef x_y_points_array) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x_y_points_array), (ArrayElement*)NULL); + Crutch::Invoke("drawbezier", _schema, _params); +} + +void f_drawcircle(CObjRef drw_wnd, double ox, double oy, double px, double py) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(ox), NEW(ArrayElement)(oy), NEW(ArrayElement)(px), NEW(ArrayElement)(py), (ArrayElement*)NULL); + Crutch::Invoke("drawcircle", _schema, _params); +} + +void f_drawcolor(CObjRef drw_wnd, double x, double y, int paint_method) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), NEW(ArrayElement)(paint_method), (ArrayElement*)NULL); + Crutch::Invoke("drawcolor", _schema, _params); +} + +void f_drawcomment(CObjRef drw_wnd, CStrRef comment) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(comment), (ArrayElement*)NULL); + Crutch::Invoke("drawcomment", _schema, _params); +} + +bool f_drawcomposite(CObjRef drw_wnd, int composite_operator, double x, double y, double width, double height, CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(6, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(composite_operator), NEW(ArrayElement)(x), NEW(ArrayElement)(y), NEW(ArrayElement)(width), NEW(ArrayElement)(height), NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawcomposite", _schema, _params); + return (Variant)_ret[0]; +} + +void f_drawellipse(CObjRef drw_wnd, double ox, double oy, double rx, double ry, double start, double end) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(ox), NEW(ArrayElement)(oy), NEW(ArrayElement)(rx), NEW(ArrayElement)(ry), NEW(ArrayElement)(start), NEW(ArrayElement)(end), (ArrayElement*)NULL); + Crutch::Invoke("drawellipse", _schema, _params); +} + +String f_drawgetclippath(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetclippath", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgetcliprule(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetcliprule", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgetclipunits(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetclipunits", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_drawgetexception(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetexception", _schema, _params); + return (Variant)_ret[0]; +} + +String f_drawgetexceptionstring(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetexceptionstring", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgetexceptiontype(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetexceptiontype", _schema, _params); + return (Variant)_ret[0]; +} + +double f_drawgetfillalpha(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetfillalpha", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_drawgetfillcolor(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetfillcolor", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +double f_drawgetfillopacity(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetfillopacity", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgetfillrule(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetfillrule", _schema, _params); + return (Variant)_ret[0]; +} + +String f_drawgetfont(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetfont", _schema, _params); + return (Variant)_ret[0]; +} + +String f_drawgetfontfamily(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetfontfamily", _schema, _params); + return (Variant)_ret[0]; +} + +double f_drawgetfontsize(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetfontsize", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgetfontstretch(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetfontstretch", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgetfontstyle(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetfontstyle", _schema, _params); + return (Variant)_ret[0]; +} + +double f_drawgetfontweight(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetfontweight", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgetgravity(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetgravity", _schema, _params); + return (Variant)_ret[0]; +} + +double f_drawgetstrokealpha(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetstrokealpha", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_drawgetstrokeantialias(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetstrokeantialias", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_drawgetstrokecolor(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetstrokecolor", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Array f_drawgetstrokedasharray(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetstrokedasharray", _schema, _params); + return (Variant)_ret[0]; +} + +double f_drawgetstrokedashoffset(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetstrokedashoffset", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgetstrokelinecap(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetstrokelinecap", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgetstrokelinejoin(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetstrokelinejoin", _schema, _params); + return (Variant)_ret[0]; +} + +double f_drawgetstrokemiterlimit(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetstrokemiterlimit", _schema, _params); + return (Variant)_ret[0]; +} + +double f_drawgetstrokeopacity(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetstrokeopacity", _schema, _params); + return (Variant)_ret[0]; +} + +double f_drawgetstrokewidth(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetstrokewidth", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgettextalignment(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgettextalignment", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_drawgettextantialias(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgettextantialias", _schema, _params); + return (Variant)_ret[0]; +} + +int f_drawgettextdecoration(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgettextdecoration", _schema, _params); + return (Variant)_ret[0]; +} + +String f_drawgettextencoding(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgettextencoding", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_drawgettextundercolor(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgettextundercolor", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +String f_drawgetvectorgraphics(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawgetvectorgraphics", _schema, _params); + return (Variant)_ret[0]; +} + +void f_drawline(CObjRef drw_wnd, double sx, double sy, double ex, double ey) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(sx), NEW(ArrayElement)(sy), NEW(ArrayElement)(ex), NEW(ArrayElement)(ey), (ArrayElement*)NULL); + Crutch::Invoke("drawline", _schema, _params); +} + +void f_drawmatte(CObjRef drw_wnd, double x, double y, int paint_method) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), NEW(ArrayElement)(paint_method), (ArrayElement*)NULL); + Crutch::Invoke("drawmatte", _schema, _params); +} + +void f_drawpathclose(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("drawpathclose", _schema, _params); +} + +void f_drawpathcurvetoabsolute(CObjRef drw_wnd, double x1, double y1, double x2, double y2, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x1), NEW(ArrayElement)(y1), NEW(ArrayElement)(x2), NEW(ArrayElement)(y2), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathcurvetoabsolute", _schema, _params); +} + +void f_drawpathcurvetoquadraticbezierabsolute(CObjRef drw_wnd, double x1, double y1, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x1), NEW(ArrayElement)(y1), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathcurvetoquadraticbezierabsolute", _schema, _params); +} + +void f_drawpathcurvetoquadraticbezierrelative(CObjRef drw_wnd, double x1, double y1, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x1), NEW(ArrayElement)(y1), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathcurvetoquadraticbezierrelative", _schema, _params); +} + +void f_drawpathcurvetoquadraticbeziersmoothabsolute(CObjRef drw_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathcurvetoquadraticbeziersmoothabsolute", _schema, _params); +} + +void f_drawpathcurvetoquadraticbeziersmoothrelative(CObjRef drw_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathcurvetoquadraticbeziersmoothrelative", _schema, _params); +} + +void f_drawpathcurvetorelative(CObjRef drw_wnd, double x1, double y1, double x2, double y2, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x1), NEW(ArrayElement)(y1), NEW(ArrayElement)(x2), NEW(ArrayElement)(y2), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathcurvetorelative", _schema, _params); +} + +void f_drawpathcurvetosmoothabsolute(CObjRef drw_wnd, double x2, double y2, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x2), NEW(ArrayElement)(y2), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathcurvetosmoothabsolute", _schema, _params); +} + +void f_drawpathcurvetosmoothrelative(CObjRef drw_wnd, double x2, double y2, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x2), NEW(ArrayElement)(y2), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathcurvetosmoothrelative", _schema, _params); +} + +void f_drawpathellipticarcabsolute(CObjRef drw_wnd, double rx, double ry, double x_axis_rotation, bool large_arc_flag, bool sweep_flag, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(rx), NEW(ArrayElement)(ry), NEW(ArrayElement)(x_axis_rotation), NEW(ArrayElement)(large_arc_flag), NEW(ArrayElement)(sweep_flag), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathellipticarcabsolute", _schema, _params); +} + +void f_drawpathellipticarcrelative(CObjRef drw_wnd, double rx, double ry, double x_axis_rotation, bool large_arc_flag, bool sweep_flag, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(rx), NEW(ArrayElement)(ry), NEW(ArrayElement)(x_axis_rotation), NEW(ArrayElement)(large_arc_flag), NEW(ArrayElement)(sweep_flag), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathellipticarcrelative", _schema, _params); +} + +void f_drawpathfinish(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("drawpathfinish", _schema, _params); +} + +void f_drawpathlinetoabsolute(CObjRef drw_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathlinetoabsolute", _schema, _params); +} + +void f_drawpathlinetohorizontalabsolute(CObjRef drw_wnd, double x) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), (ArrayElement*)NULL); + Crutch::Invoke("drawpathlinetohorizontalabsolute", _schema, _params); +} + +void f_drawpathlinetohorizontalrelative(CObjRef drw_wnd, double x) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), (ArrayElement*)NULL); + Crutch::Invoke("drawpathlinetohorizontalrelative", _schema, _params); +} + +void f_drawpathlinetorelative(CObjRef drw_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathlinetorelative", _schema, _params); +} + +void f_drawpathlinetoverticalabsolute(CObjRef drw_wnd, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathlinetoverticalabsolute", _schema, _params); +} + +void f_drawpathlinetoverticalrelative(CObjRef drw_wnd, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathlinetoverticalrelative", _schema, _params); +} + +void f_drawpathmovetoabsolute(CObjRef drw_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathmovetoabsolute", _schema, _params); +} + +void f_drawpathmovetorelative(CObjRef drw_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpathmovetorelative", _schema, _params); +} + +void f_drawpathstart(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("drawpathstart", _schema, _params); +} + +void f_drawpoint(CObjRef drw_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawpoint", _schema, _params); +} + +void f_drawpolygon(CObjRef drw_wnd, CArrRef x_y_points_array) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x_y_points_array), (ArrayElement*)NULL); + Crutch::Invoke("drawpolygon", _schema, _params); +} + +void f_drawpolyline(CObjRef drw_wnd, CArrRef x_y_points_array) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x_y_points_array), (ArrayElement*)NULL); + Crutch::Invoke("drawpolyline", _schema, _params); +} + +void f_drawrectangle(CObjRef drw_wnd, double x1, double y1, double x2, double y2) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x1), NEW(ArrayElement)(y1), NEW(ArrayElement)(x2), NEW(ArrayElement)(y2), (ArrayElement*)NULL); + Crutch::Invoke("drawrectangle", _schema, _params); +} + +bool f_drawrender(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawrender", _schema, _params); + return (Variant)_ret[0]; +} + +void f_drawrotate(CObjRef drw_wnd, double degrees) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(degrees), (ArrayElement*)NULL); + Crutch::Invoke("drawrotate", _schema, _params); +} + +void f_drawroundrectangle(CObjRef drw_wnd, double x1, double y1, double x2, double y2, double rx, double ry) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x1), NEW(ArrayElement)(y1), NEW(ArrayElement)(x2), NEW(ArrayElement)(y2), NEW(ArrayElement)(rx), NEW(ArrayElement)(ry), (ArrayElement*)NULL); + Crutch::Invoke("drawroundrectangle", _schema, _params); +} + +void f_drawscale(CObjRef drw_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawscale", _schema, _params); +} + +bool f_drawsetclippath(CObjRef drw_wnd, CStrRef clip_path) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(clip_path), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawsetclippath", _schema, _params); + return (Variant)_ret[0]; +} + +void f_drawsetcliprule(CObjRef drw_wnd, int fill_rule) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(fill_rule), (ArrayElement*)NULL); + Crutch::Invoke("drawsetcliprule", _schema, _params); +} + +void f_drawsetclipunits(CObjRef drw_wnd, int clip_path_units) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(clip_path_units), (ArrayElement*)NULL); + Crutch::Invoke("drawsetclipunits", _schema, _params); +} + +void f_drawsetfillalpha(CObjRef drw_wnd, double fill_opacity) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(fill_opacity), (ArrayElement*)NULL); + Crutch::Invoke("drawsetfillalpha", _schema, _params); +} + +void f_drawsetfillcolor(CObjRef drw_wnd, CObjRef fill_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(fill_pxl_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("drawsetfillcolor", _schema, _params); +} + +void f_drawsetfillopacity(CObjRef drw_wnd, double fill_opacity) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(fill_opacity), (ArrayElement*)NULL); + Crutch::Invoke("drawsetfillopacity", _schema, _params); +} + +bool f_drawsetfillpatternurl(CObjRef drw_wnd, CStrRef fill_url) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(fill_url), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawsetfillpatternurl", _schema, _params); + return (Variant)_ret[0]; +} + +void f_drawsetfillrule(CObjRef drw_wnd, int fill_rule) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(fill_rule), (ArrayElement*)NULL); + Crutch::Invoke("drawsetfillrule", _schema, _params); +} + +bool f_drawsetfont(CObjRef drw_wnd, CStrRef font_file) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(font_file), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawsetfont", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_drawsetfontfamily(CObjRef drw_wnd, CStrRef font_family) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(font_family), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawsetfontfamily", _schema, _params); + return (Variant)_ret[0]; +} + +void f_drawsetfontsize(CObjRef drw_wnd, double pointsize) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(pointsize), (ArrayElement*)NULL); + Crutch::Invoke("drawsetfontsize", _schema, _params); +} + +void f_drawsetfontstretch(CObjRef drw_wnd, int stretch_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(stretch_type), (ArrayElement*)NULL); + Crutch::Invoke("drawsetfontstretch", _schema, _params); +} + +void f_drawsetfontstyle(CObjRef drw_wnd, int style_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(style_type), (ArrayElement*)NULL); + Crutch::Invoke("drawsetfontstyle", _schema, _params); +} + +void f_drawsetfontweight(CObjRef drw_wnd, double font_weight) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(font_weight), (ArrayElement*)NULL); + Crutch::Invoke("drawsetfontweight", _schema, _params); +} + +void f_drawsetgravity(CObjRef drw_wnd, int gravity_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(gravity_type), (ArrayElement*)NULL); + Crutch::Invoke("drawsetgravity", _schema, _params); +} + +void f_drawsetstrokealpha(CObjRef drw_wnd, double stroke_opacity) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(stroke_opacity), (ArrayElement*)NULL); + Crutch::Invoke("drawsetstrokealpha", _schema, _params); +} + +void f_drawsetstrokeantialias(CObjRef drw_wnd, bool stroke_antialias /* = true */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(stroke_antialias), (ArrayElement*)NULL); + Crutch::Invoke("drawsetstrokeantialias", _schema, _params); +} + +void f_drawsetstrokecolor(CObjRef drw_wnd, CObjRef strokecolor_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(strokecolor_pxl_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("drawsetstrokecolor", _schema, _params); +} + +void f_drawsetstrokedasharray(CObjRef drw_wnd, CArrRef dash_array /* = null_array */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(dash_array), (ArrayElement*)NULL); + Crutch::Invoke("drawsetstrokedasharray", _schema, _params); +} + +void f_drawsetstrokedashoffset(CObjRef drw_wnd, double dash_offset) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(dash_offset), (ArrayElement*)NULL); + Crutch::Invoke("drawsetstrokedashoffset", _schema, _params); +} + +void f_drawsetstrokelinecap(CObjRef drw_wnd, int line_cap) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(line_cap), (ArrayElement*)NULL); + Crutch::Invoke("drawsetstrokelinecap", _schema, _params); +} + +void f_drawsetstrokelinejoin(CObjRef drw_wnd, int line_join) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(line_join), (ArrayElement*)NULL); + Crutch::Invoke("drawsetstrokelinejoin", _schema, _params); +} + +void f_drawsetstrokemiterlimit(CObjRef drw_wnd, double miterlimit) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(miterlimit), (ArrayElement*)NULL); + Crutch::Invoke("drawsetstrokemiterlimit", _schema, _params); +} + +void f_drawsetstrokeopacity(CObjRef drw_wnd, double stroke_opacity) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(stroke_opacity), (ArrayElement*)NULL); + Crutch::Invoke("drawsetstrokeopacity", _schema, _params); +} + +bool f_drawsetstrokepatternurl(CObjRef drw_wnd, CStrRef stroke_url) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(stroke_url), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawsetstrokepatternurl", _schema, _params); + return (Variant)_ret[0]; +} + +void f_drawsetstrokewidth(CObjRef drw_wnd, double stroke_width) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(stroke_width), (ArrayElement*)NULL); + Crutch::Invoke("drawsetstrokewidth", _schema, _params); +} + +void f_drawsettextalignment(CObjRef drw_wnd, int align_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(align_type), (ArrayElement*)NULL); + Crutch::Invoke("drawsettextalignment", _schema, _params); +} + +void f_drawsettextantialias(CObjRef drw_wnd, bool text_antialias /* = true */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(text_antialias), (ArrayElement*)NULL); + Crutch::Invoke("drawsettextantialias", _schema, _params); +} + +void f_drawsettextdecoration(CObjRef drw_wnd, int decoration_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(decoration_type), (ArrayElement*)NULL); + Crutch::Invoke("drawsettextdecoration", _schema, _params); +} + +void f_drawsettextencoding(CObjRef drw_wnd, CStrRef encoding) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(encoding), (ArrayElement*)NULL); + Crutch::Invoke("drawsettextencoding", _schema, _params); +} + +void f_drawsettextundercolor(CObjRef drw_wnd, CObjRef undercolor_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(undercolor_pxl_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("drawsettextundercolor", _schema, _params); +} + +bool f_drawsetvectorgraphics(CObjRef drw_wnd, CStrRef vector_graphics) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(vector_graphics), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("drawsetvectorgraphics", _schema, _params); + return (Variant)_ret[0]; +} + +void f_drawsetviewbox(CObjRef drw_wnd, double x1, double y1, double x2, double y2) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x1), NEW(ArrayElement)(y1), NEW(ArrayElement)(x2), NEW(ArrayElement)(y2), (ArrayElement*)NULL); + Crutch::Invoke("drawsetviewbox", _schema, _params); +} + +void f_drawskewx(CObjRef drw_wnd, double degrees) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(degrees), (ArrayElement*)NULL); + Crutch::Invoke("drawskewx", _schema, _params); +} + +void f_drawskewy(CObjRef drw_wnd, double degrees) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(degrees), (ArrayElement*)NULL); + Crutch::Invoke("drawskewy", _schema, _params); +} + +void f_drawtranslate(CObjRef drw_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Crutch::Invoke("drawtranslate", _schema, _params); +} + +void f_pushdrawingwand(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("pushdrawingwand", _schema, _params); +} + +void f_drawpushclippath(CObjRef drw_wnd, CStrRef clip_path_id) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(clip_path_id), (ArrayElement*)NULL); + Crutch::Invoke("drawpushclippath", _schema, _params); +} + +void f_drawpushdefs(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("drawpushdefs", _schema, _params); +} + +void f_drawpushpattern(CObjRef drw_wnd, CStrRef pattern_id, double x, double y, double width, double height) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(pattern_id), NEW(ArrayElement)(x), NEW(ArrayElement)(y), NEW(ArrayElement)(width), NEW(ArrayElement)(height), (ArrayElement*)NULL); + Crutch::Invoke("drawpushpattern", _schema, _params); +} + +void f_popdrawingwand(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("popdrawingwand", _schema, _params); +} + +void f_drawpopclippath(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("drawpopclippath", _schema, _params); +} + +void f_drawpopdefs(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("drawpopdefs", _schema, _params); +} + +void f_drawpoppattern(CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("drawpoppattern", _schema, _params); +} + +bool f_magickadaptivethresholdimage(CObjRef mgck_wnd, double width, double height, double offset) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(width), NEW(ArrayElement)(height), NEW(ArrayElement)(offset), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickadaptivethresholdimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickaddimage(CObjRef mgck_wnd, CObjRef add_wand) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(add_wand)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickaddimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickaddnoiseimage(CObjRef mgck_wnd, int noise_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(noise_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickaddnoiseimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickaffinetransformimage(CObjRef mgck_wnd, CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickaffinetransformimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickannotateimage(CObjRef mgck_wnd, CObjRef drw_wnd, double x, double y, double angle, CStrRef text) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), NEW(ArrayElement)(angle), NEW(ArrayElement)(text), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickannotateimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickappendimages(CObjRef mgck_wnd, bool stack_vertical /* = false */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(stack_vertical), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickappendimages", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_magickaverageimages(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickaverageimages", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_magickblackthresholdimage(CObjRef mgck_wnd, CObjRef threshold_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(threshold_pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickblackthresholdimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickblurimage(CObjRef mgck_wnd, double radius, double sigma, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), NEW(ArrayElement)(sigma), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickblurimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickborderimage(CObjRef mgck_wnd, CObjRef bordercolor, double width, double height) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(bordercolor)), NEW(ArrayElement)(width), NEW(ArrayElement)(height), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickborderimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickcharcoalimage(CObjRef mgck_wnd, double radius, double sigma) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), NEW(ArrayElement)(sigma), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcharcoalimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickchopimage(CObjRef mgck_wnd, double width, double height, int x, int y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(width), NEW(ArrayElement)(height), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickchopimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickclipimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickclipimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickclippathimage(CObjRef mgck_wnd, CStrRef pathname, bool inside) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(pathname), NEW(ArrayElement)(inside), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickclippathimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickcoalesceimages(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcoalesceimages", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_magickcolorfloodfillimage(CObjRef mgck_wnd, CObjRef fillcolor_pxl_wnd, double fuzz, CObjRef bordercolor_pxl_wnd, int x, int y) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), NEW(ArrayElement)(3, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(fillcolor_pxl_wnd)), NEW(ArrayElement)(fuzz), NEW(ArrayElement)(OpaqueObject::GetIndex(bordercolor_pxl_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcolorfloodfillimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickcolorizeimage(CObjRef mgck_wnd, CObjRef colorize, CObjRef opacity_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), NEW(ArrayElement)(2, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(colorize)), NEW(ArrayElement)(OpaqueObject::GetIndex(opacity_pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcolorizeimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickcombineimages(CObjRef mgck_wnd, int channel_type) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcombineimages", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_magickcommentimage(CObjRef mgck_wnd, CStrRef comment) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(comment), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcommentimage", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickcompareimages(CObjRef mgck_wnd, CObjRef reference_wnd, int metric_type, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(reference_wnd)), NEW(ArrayElement)(metric_type), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcompareimages", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickcompositeimage(CObjRef mgck_wnd, CObjRef composite_wnd, int composite_operator, int x, int y) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(composite_wnd)), NEW(ArrayElement)(composite_operator), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcompositeimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickconstituteimage(CObjRef mgck_wnd, double columns, double rows, CStrRef smap, int storage_type, CArrRef pixel_array) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(columns), NEW(ArrayElement)(rows), NEW(ArrayElement)(smap), NEW(ArrayElement)(storage_type), NEW(ArrayElement)(pixel_array), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickconstituteimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickcontrastimage(CObjRef mgck_wnd, bool sharpen) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(sharpen), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcontrastimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickconvolveimage(CObjRef mgck_wnd, CArrRef kernel_array, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(kernel_array), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickconvolveimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickcropimage(CObjRef mgck_wnd, double width, double height, int x, int y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(width), NEW(ArrayElement)(height), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcropimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickcyclecolormapimage(CObjRef mgck_wnd, int num_positions) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(num_positions), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickcyclecolormapimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickdeconstructimages(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickdeconstructimages", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +String f_magickdescribeimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickdescribeimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickdespeckleimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickdespeckleimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickdrawimage(CObjRef mgck_wnd, CObjRef drw_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickdrawimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickechoimageblob(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickechoimageblob", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickechoimagesblob(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickechoimagesblob", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickedgeimage(CObjRef mgck_wnd, double radius) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickedgeimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickembossimage(CObjRef mgck_wnd, double radius, double sigma) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), NEW(ArrayElement)(sigma), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickembossimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickenhanceimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickenhanceimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickequalizeimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickequalizeimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickevaluateimage(CObjRef mgck_wnd, int evaluate_op, double constant, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(evaluate_op), NEW(ArrayElement)(constant), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickevaluateimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickflattenimages(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickflattenimages", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_magickflipimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickflipimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickflopimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickflopimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickframeimage(CObjRef mgck_wnd, CObjRef matte_color, double width, double height, int inner_bevel, int outer_bevel) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(matte_color)), NEW(ArrayElement)(width), NEW(ArrayElement)(height), NEW(ArrayElement)(inner_bevel), NEW(ArrayElement)(outer_bevel), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickframeimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickfximage(CObjRef mgck_wnd, CStrRef expression, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(expression), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickfximage", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_magickgammaimage(CObjRef mgck_wnd, double gamma, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(gamma), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgammaimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickgaussianblurimage(CObjRef mgck_wnd, double radius, double sigma, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), NEW(ArrayElement)(sigma), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgaussianblurimage", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetcharheight(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline /* = false */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(txt), NEW(ArrayElement)(multiline), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetcharheight", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetcharwidth(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline /* = false */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(txt), NEW(ArrayElement)(multiline), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetcharwidth", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetexception(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetexception", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetexceptionstring(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetexceptionstring", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetexceptiontype(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetexceptiontype", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetfilename(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetfilename", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetformat(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetformat", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickgetimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimage", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_magickgetimagebackgroundcolor(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagebackgroundcolor", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +String f_magickgetimageblob(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageblob", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetimageblueprimary(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageblueprimary", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickgetimagebordercolor(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagebordercolor", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Array f_magickgetimagechannelmean(CObjRef mgck_wnd, int channel_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagechannelmean", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickgetimagecolormapcolor(CObjRef mgck_wnd, double index) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(index), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagecolormapcolor", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +double f_magickgetimagecolors(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagecolors", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimagecolorspace(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagecolorspace", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimagecompose(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagecompose", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimagecompression(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagecompression", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetimagecompressionquality(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagecompressionquality", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetimagedelay(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagedelay", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetimagedepth(CObjRef mgck_wnd, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagedepth", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimagedispose(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagedispose", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetimageextrema(CObjRef mgck_wnd, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageextrema", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetimagefilename(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagefilename", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetimageformat(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageformat", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetimagegamma(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagegamma", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetimagegreenprimary(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagegreenprimary", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetimageheight(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageheight", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetimagehistogram(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagehistogram", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimageindex(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageindex", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimageinterlacescheme(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageinterlacescheme", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetimageiterations(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageiterations", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickgetimagemattecolor(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagemattecolor", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +String f_magickgetimagemimetype(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagemimetype", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetimagepixels(CObjRef mgck_wnd, int x_offset, int y_offset, double columns, double rows, CStrRef smap, int storage_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x_offset), NEW(ArrayElement)(y_offset), NEW(ArrayElement)(columns), NEW(ArrayElement)(rows), NEW(ArrayElement)(smap), NEW(ArrayElement)(storage_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagepixels", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetimageprofile(CObjRef mgck_wnd, CStrRef name) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(name), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageprofile", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetimageredprimary(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageredprimary", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimagerenderingintent(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagerenderingintent", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetimageresolution(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageresolution", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetimagescene(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagescene", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetimagesignature(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagesignature", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimagesize(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagesize", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimagetype(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagetype", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimageunits(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimageunits", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetimagevirtualpixelmethod(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagevirtualpixelmethod", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetimagewhitepoint(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagewhitepoint", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetimagewidth(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagewidth", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetimagesblob(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetimagesblob", _schema, _params); + return (Variant)_ret[0]; +} + +int f_magickgetinterlacescheme(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetinterlacescheme", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetmaxtextadvance(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline /* = false */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(txt), NEW(ArrayElement)(multiline), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetmaxtextadvance", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickgetmimetype(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetmimetype", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetnumberimages(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetnumberimages", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetsamplingfactors(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetsamplingfactors", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetsize(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetsize", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetstringheight(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline /* = false */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(txt), NEW(ArrayElement)(multiline), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetstringheight", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgetstringwidth(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline /* = false */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(txt), NEW(ArrayElement)(multiline), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetstringwidth", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgettextascent(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline /* = false */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(txt), NEW(ArrayElement)(multiline), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgettextascent", _schema, _params); + return (Variant)_ret[0]; +} + +double f_magickgettextdescent(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline /* = false */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(txt), NEW(ArrayElement)(multiline), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgettextdescent", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickgetwandsize(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickgetwandsize", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickhasnextimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickhasnextimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickhaspreviousimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickhaspreviousimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickimplodeimage(CObjRef mgck_wnd, double amount) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(amount), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickimplodeimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicklabelimage(CObjRef mgck_wnd, CStrRef label) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(label), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicklabelimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicklevelimage(CObjRef mgck_wnd, double black_point, double gamma, double white_point, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(black_point), NEW(ArrayElement)(gamma), NEW(ArrayElement)(white_point), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicklevelimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickmagnifyimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickmagnifyimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickmapimage(CObjRef mgck_wnd, CObjRef map_wand, bool dither) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(map_wand)), NEW(ArrayElement)(dither), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickmapimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickmattefloodfillimage(CObjRef mgck_wnd, double opacity, double fuzz, CObjRef bordercolor_pxl_wnd, int x, int y) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(3, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(opacity), NEW(ArrayElement)(fuzz), NEW(ArrayElement)(OpaqueObject::GetIndex(bordercolor_pxl_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickmattefloodfillimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickmedianfilterimage(CObjRef mgck_wnd, double radius) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickmedianfilterimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickminifyimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickminifyimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickmodulateimage(CObjRef mgck_wnd, double brightness, double saturation, double hue) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(brightness), NEW(ArrayElement)(saturation), NEW(ArrayElement)(hue), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickmodulateimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickmontageimage(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef tile_geometry, CStrRef thumbnail_geometry, int montage_mode, CStrRef frame) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(tile_geometry), NEW(ArrayElement)(thumbnail_geometry), NEW(ArrayElement)(montage_mode), NEW(ArrayElement)(frame), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickmontageimage", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_magickmorphimages(CObjRef mgck_wnd, double number_frames) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(number_frames), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickmorphimages", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_magickmosaicimages(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickmosaicimages", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_magickmotionblurimage(CObjRef mgck_wnd, double radius, double sigma, double angle) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), NEW(ArrayElement)(sigma), NEW(ArrayElement)(angle), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickmotionblurimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicknegateimage(CObjRef mgck_wnd, bool only_the_gray /* = false */, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(only_the_gray), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicknegateimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicknewimage(CObjRef mgck_wnd, double width, double height, CStrRef imagemagick_col_str /* = null_string */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(width), NEW(ArrayElement)(height), NEW(ArrayElement)(imagemagick_col_str), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicknewimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicknextimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicknextimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicknormalizeimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicknormalizeimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickoilpaintimage(CObjRef mgck_wnd, double radius) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickoilpaintimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickpaintopaqueimage(CObjRef mgck_wnd, CObjRef target_pxl_wnd, CObjRef fill_pxl_wnd, double fuzz /* = 0.0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), NEW(ArrayElement)(2, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(target_pxl_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(fill_pxl_wnd)), NEW(ArrayElement)(fuzz), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickpaintopaqueimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickpainttransparentimage(CObjRef mgck_wnd, CObjRef target, double opacity /* = k_MW_TransparentOpacity */, double fuzz /* = 0.0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(target)), NEW(ArrayElement)(opacity), NEW(ArrayElement)(fuzz), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickpainttransparentimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickpingimage(CObjRef mgck_wnd, CStrRef filename) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(filename), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickpingimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickposterizeimage(CObjRef mgck_wnd, double levels, bool dither) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(levels), NEW(ArrayElement)(dither), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickposterizeimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magickpreviewimages(CObjRef mgck_wnd, int preview) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(preview), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickpreviewimages", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_magickpreviousimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickpreviousimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickprofileimage(CObjRef mgck_wnd, CStrRef name, CStrRef profile /* = null_string */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(name), NEW(ArrayElement)(profile), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickprofileimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickquantizeimage(CObjRef mgck_wnd, double number_colors, int colorspace_type, double treedepth, bool dither, bool measure_error) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(number_colors), NEW(ArrayElement)(colorspace_type), NEW(ArrayElement)(treedepth), NEW(ArrayElement)(dither), NEW(ArrayElement)(measure_error), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickquantizeimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickquantizeimages(CObjRef mgck_wnd, double number_colors, int colorspace_type, double treedepth, bool dither, bool measure_error) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(number_colors), NEW(ArrayElement)(colorspace_type), NEW(ArrayElement)(treedepth), NEW(ArrayElement)(dither), NEW(ArrayElement)(measure_error), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickquantizeimages", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_magickqueryfontmetrics(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline /* = false */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(drw_wnd)), NEW(ArrayElement)(txt), NEW(ArrayElement)(multiline), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickqueryfontmetrics", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickradialblurimage(CObjRef mgck_wnd, double angle) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(angle), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickradialblurimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickraiseimage(CObjRef mgck_wnd, double width, double height, int x, int y, bool raise) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(width), NEW(ArrayElement)(height), NEW(ArrayElement)(x), NEW(ArrayElement)(y), NEW(ArrayElement)(raise), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickraiseimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickreadimage(CObjRef mgck_wnd, CStrRef filename) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(filename), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickreadimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickreadimageblob(CObjRef mgck_wnd, CStrRef blob) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(blob), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickreadimageblob", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickreadimagefile(CObjRef mgck_wnd, CObjRef handle) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(handle)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickreadimagefile", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickreadimages(CObjRef mgck_wnd, CArrRef img_filenames_array) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(img_filenames_array), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickreadimages", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickreducenoiseimage(CObjRef mgck_wnd, double radius) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickreducenoiseimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickremoveimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickremoveimage", _schema, _params); + return (Variant)_ret[0]; +} + +String f_magickremoveimageprofile(CObjRef mgck_wnd, CStrRef name) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(name), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickremoveimageprofile", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickremoveimageprofiles(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickremoveimageprofiles", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickresampleimage(CObjRef mgck_wnd, double x_resolution, double y_resolution, int filter_type, double blur) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x_resolution), NEW(ArrayElement)(y_resolution), NEW(ArrayElement)(filter_type), NEW(ArrayElement)(blur), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickresampleimage", _schema, _params); + return (Variant)_ret[0]; +} + +void f_magickresetiterator(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("magickresetiterator", _schema, _params); +} + +bool f_magickresizeimage(CObjRef mgck_wnd, double columns, double rows, int filter_type, double blur) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(columns), NEW(ArrayElement)(rows), NEW(ArrayElement)(filter_type), NEW(ArrayElement)(blur), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickresizeimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickrollimage(CObjRef mgck_wnd, int x_offset, int y_offset) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x_offset), NEW(ArrayElement)(y_offset), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickrollimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickrotateimage(CObjRef mgck_wnd, CObjRef background, double degrees) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(background)), NEW(ArrayElement)(degrees), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickrotateimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksampleimage(CObjRef mgck_wnd, double columns, double rows) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(columns), NEW(ArrayElement)(rows), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksampleimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickscaleimage(CObjRef mgck_wnd, double columns, double rows) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(columns), NEW(ArrayElement)(rows), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickscaleimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickseparateimagechannel(CObjRef mgck_wnd, int channel_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickseparateimagechannel", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetcompressionquality(CObjRef mgck_wnd, double quality) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(quality), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetcompressionquality", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetfilename(CObjRef mgck_wnd, CStrRef filename /* = null_string */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(filename), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetfilename", _schema, _params); + return (Variant)_ret[0]; +} + +void f_magicksetfirstiterator(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("magicksetfirstiterator", _schema, _params); +} + +bool f_magicksetformat(CObjRef mgck_wnd, CStrRef format) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(format), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetformat", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimage(CObjRef mgck_wnd, CObjRef replace_wand) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(replace_wand)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagebackgroundcolor(CObjRef mgck_wnd, CObjRef background_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(background_pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagebackgroundcolor", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagebias(CObjRef mgck_wnd, double bias) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(bias), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagebias", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimageblueprimary(CObjRef mgck_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimageblueprimary", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagebordercolor(CObjRef mgck_wnd, CObjRef border_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(border_pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagebordercolor", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagecolormapcolor(CObjRef mgck_wnd, double index, CObjRef mapcolor_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(2, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(index), NEW(ArrayElement)(OpaqueObject::GetIndex(mapcolor_pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagecolormapcolor", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagecolorspace(CObjRef mgck_wnd, int colorspace_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(colorspace_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagecolorspace", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagecompose(CObjRef mgck_wnd, int composite_operator) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(composite_operator), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagecompose", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagecompression(CObjRef mgck_wnd, int compression_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(compression_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagecompression", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagecompressionquality(CObjRef mgck_wnd, double quality) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(quality), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagecompressionquality", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagedelay(CObjRef mgck_wnd, double delay) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(delay), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagedelay", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagedepth(CObjRef mgck_wnd, int depth, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(depth), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagedepth", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagedispose(CObjRef mgck_wnd, int dispose_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(dispose_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagedispose", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagefilename(CObjRef mgck_wnd, CStrRef filename /* = null_string */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(filename), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagefilename", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimageformat(CObjRef mgck_wnd, CStrRef format) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(format), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimageformat", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagegamma(CObjRef mgck_wnd, double gamma) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(gamma), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagegamma", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagegreenprimary(CObjRef mgck_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagegreenprimary", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimageindex(CObjRef mgck_wnd, int index) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(index), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimageindex", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimageinterlacescheme(CObjRef mgck_wnd, int interlace_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(interlace_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimageinterlacescheme", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimageiterations(CObjRef mgck_wnd, double iterations) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(iterations), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimageiterations", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagemattecolor(CObjRef mgck_wnd, CObjRef matte_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(matte_pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagemattecolor", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimageoption(CObjRef mgck_wnd, CStrRef format, CStrRef key, CStrRef value) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(format), NEW(ArrayElement)(key), NEW(ArrayElement)(value), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimageoption", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagepixels(CObjRef mgck_wnd, int x_offset, int y_offset, double columns, double rows, CStrRef smap, int storage_type, CArrRef pixel_array) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x_offset), NEW(ArrayElement)(y_offset), NEW(ArrayElement)(columns), NEW(ArrayElement)(rows), NEW(ArrayElement)(smap), NEW(ArrayElement)(storage_type), NEW(ArrayElement)(pixel_array), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagepixels", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimageprofile(CObjRef mgck_wnd, CStrRef name, CStrRef profile) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(name), NEW(ArrayElement)(profile), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimageprofile", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimageredprimary(CObjRef mgck_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimageredprimary", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagerenderingintent(CObjRef mgck_wnd, int rendering_intent) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(rendering_intent), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagerenderingintent", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimageresolution(CObjRef mgck_wnd, double x_resolution, double y_resolution) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x_resolution), NEW(ArrayElement)(y_resolution), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimageresolution", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagescene(CObjRef mgck_wnd, double scene) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(scene), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagescene", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagetype(CObjRef mgck_wnd, int image_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(image_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagetype", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimageunits(CObjRef mgck_wnd, int resolution_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(resolution_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimageunits", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagevirtualpixelmethod(CObjRef mgck_wnd, int virtual_pixel_method) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(virtual_pixel_method), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagevirtualpixelmethod", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetimagewhitepoint(CObjRef mgck_wnd, double x, double y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetimagewhitepoint", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetinterlacescheme(CObjRef mgck_wnd, int interlace_type) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(interlace_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetinterlacescheme", _schema, _params); + return (Variant)_ret[0]; +} + +void f_magicksetlastiterator(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Crutch::Invoke("magicksetlastiterator", _schema, _params); +} + +bool f_magicksetpassphrase(CObjRef mgck_wnd, CStrRef passphrase) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(passphrase), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetpassphrase", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetresolution(CObjRef mgck_wnd, double x_resolution, double y_resolution) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(x_resolution), NEW(ArrayElement)(y_resolution), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetresolution", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetsamplingfactors(CObjRef mgck_wnd, double number_factors, CArrRef sampling_factors) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(number_factors), NEW(ArrayElement)(sampling_factors), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetsamplingfactors", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetsize(CObjRef mgck_wnd, int columns, int rows) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(columns), NEW(ArrayElement)(rows), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetsize", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksetwandsize(CObjRef mgck_wnd, int columns, int rows) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(columns), NEW(ArrayElement)(rows), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksetwandsize", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksharpenimage(CObjRef mgck_wnd, double radius, double sigma, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), NEW(ArrayElement)(sigma), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksharpenimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickshaveimage(CObjRef mgck_wnd, int columns, int rows) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(columns), NEW(ArrayElement)(rows), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickshaveimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickshearimage(CObjRef mgck_wnd, CObjRef background, double x_shear, double y_shear) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(background)), NEW(ArrayElement)(x_shear), NEW(ArrayElement)(y_shear), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickshearimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicksolarizeimage(CObjRef mgck_wnd, double threshold) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(threshold), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksolarizeimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickspliceimage(CObjRef mgck_wnd, double width, double height, int x, int y) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(width), NEW(ArrayElement)(height), NEW(ArrayElement)(x), NEW(ArrayElement)(y), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickspliceimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickspreadimage(CObjRef mgck_wnd, double radius) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickspreadimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magicksteganoimage(CObjRef mgck_wnd, CObjRef watermark_wand, int offset) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(watermark_wand)), NEW(ArrayElement)(offset), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicksteganoimage", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_magickstereoimage(CObjRef mgck_wnd, CObjRef offset_wand) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(offset_wand)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickstereoimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickstripimage(CObjRef mgck_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickstripimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickswirlimage(CObjRef mgck_wnd, double degrees) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(degrees), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickswirlimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magicktextureimage(CObjRef mgck_wnd, CObjRef texture_wand) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(texture_wand)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicktextureimage", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_magickthresholdimage(CObjRef mgck_wnd, double threshold, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(threshold), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickthresholdimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magicktintimage(CObjRef mgck_wnd, int tint_pxl_wnd, CObjRef opacity_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(2, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(tint_pxl_wnd), NEW(ArrayElement)(OpaqueObject::GetIndex(opacity_pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicktintimage", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_magicktransformimage(CObjRef mgck_wnd, CStrRef crop, CStrRef geometry) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(crop), NEW(ArrayElement)(geometry), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicktransformimage", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_magicktrimimage(CObjRef mgck_wnd, double fuzz) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(fuzz), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magicktrimimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickunsharpmaskimage(CObjRef mgck_wnd, double radius, double sigma, double amount, double threshold, int channel_type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(radius), NEW(ArrayElement)(sigma), NEW(ArrayElement)(amount), NEW(ArrayElement)(threshold), NEW(ArrayElement)(channel_type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickunsharpmaskimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickwaveimage(CObjRef mgck_wnd, double amplitude, double wave_length) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(amplitude), NEW(ArrayElement)(wave_length), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickwaveimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickwhitethresholdimage(CObjRef mgck_wnd, CObjRef threshold_pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(threshold_pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickwhitethresholdimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickwriteimage(CObjRef mgck_wnd, CStrRef filename) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(filename), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickwriteimage", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickwriteimagefile(CObjRef mgck_wnd, CObjRef handle) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(handle)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickwriteimagefile", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickwriteimages(CObjRef mgck_wnd, CStrRef filename /* = "" */, bool join_images /* = false */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(filename), NEW(ArrayElement)(join_images), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickwriteimages", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_magickwriteimagesfile(CObjRef mgck_wnd, CObjRef handle) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mgck_wnd)), NEW(ArrayElement)(OpaqueObject::GetIndex(handle)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("magickwriteimagesfile", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetalpha(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetalpha", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetalphaquantum(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetalphaquantum", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetblack(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetblack", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetblackquantum(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetblackquantum", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetblue(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetblue", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetbluequantum(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetbluequantum", _schema, _params); + return (Variant)_ret[0]; +} + +String f_pixelgetcolorasstring(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetcolorasstring", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetcolorcount(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetcolorcount", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetcyan(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetcyan", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetcyanquantum(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetcyanquantum", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_pixelgetexception(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetexception", _schema, _params); + return (Variant)_ret[0]; +} + +String f_pixelgetexceptionstring(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetexceptionstring", _schema, _params); + return (Variant)_ret[0]; +} + +int f_pixelgetexceptiontype(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetexceptiontype", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetgreen(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetgreen", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetgreenquantum(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetgreenquantum", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetindex(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetindex", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetmagenta(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetmagenta", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetmagentaquantum(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetmagentaquantum", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetopacity(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetopacity", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetopacityquantum(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetopacityquantum", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_pixelgetquantumcolor(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetquantumcolor", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetred(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetred", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetredquantum(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetredquantum", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetyellow(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetyellow", _schema, _params); + return (Variant)_ret[0]; +} + +double f_pixelgetyellowquantum(CObjRef pxl_wnd) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetyellowquantum", _schema, _params); + return (Variant)_ret[0]; +} + +void f_pixelsetalpha(CObjRef pxl_wnd, double alpha) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(alpha), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetalpha", _schema, _params); +} + +void f_pixelsetalphaquantum(CObjRef pxl_wnd, double alpha) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(alpha), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetalphaquantum", _schema, _params); +} + +void f_pixelsetblack(CObjRef pxl_wnd, double black) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(black), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetblack", _schema, _params); +} + +void f_pixelsetblackquantum(CObjRef pxl_wnd, double black) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(black), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetblackquantum", _schema, _params); +} + +void f_pixelsetblue(CObjRef pxl_wnd, double blue) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(blue), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetblue", _schema, _params); +} + +void f_pixelsetbluequantum(CObjRef pxl_wnd, double blue) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(blue), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetbluequantum", _schema, _params); +} + +void f_pixelsetcolor(CObjRef pxl_wnd, CStrRef imagemagick_col_str) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(imagemagick_col_str), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetcolor", _schema, _params); +} + +void f_pixelsetcolorcount(CObjRef pxl_wnd, int count) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(count), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetcolorcount", _schema, _params); +} + +void f_pixelsetcyan(CObjRef pxl_wnd, double cyan) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(cyan), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetcyan", _schema, _params); +} + +void f_pixelsetcyanquantum(CObjRef pxl_wnd, double cyan) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(cyan), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetcyanquantum", _schema, _params); +} + +void f_pixelsetgreen(CObjRef pxl_wnd, double green) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(green), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetgreen", _schema, _params); +} + +void f_pixelsetgreenquantum(CObjRef pxl_wnd, double green) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(green), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetgreenquantum", _schema, _params); +} + +void f_pixelsetindex(CObjRef pxl_wnd, double index) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(index), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetindex", _schema, _params); +} + +void f_pixelsetmagenta(CObjRef pxl_wnd, double magenta) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(magenta), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetmagenta", _schema, _params); +} + +void f_pixelsetmagentaquantum(CObjRef pxl_wnd, double magenta) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(magenta), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetmagentaquantum", _schema, _params); +} + +void f_pixelsetopacity(CObjRef pxl_wnd, double opacity) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(opacity), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetopacity", _schema, _params); +} + +void f_pixelsetopacityquantum(CObjRef pxl_wnd, double opacity) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(opacity), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetopacityquantum", _schema, _params); +} + +void f_pixelsetquantumcolor(CObjRef pxl_wnd, double red, double green, double blue, double opacity /* = 0.0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(red), NEW(ArrayElement)(green), NEW(ArrayElement)(blue), NEW(ArrayElement)(opacity), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetquantumcolor", _schema, _params); +} + +void f_pixelsetred(CObjRef pxl_wnd, double red) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(red), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetred", _schema, _params); +} + +void f_pixelsetredquantum(CObjRef pxl_wnd, double red) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(red), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetredquantum", _schema, _params); +} + +void f_pixelsetyellow(CObjRef pxl_wnd, double yellow) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(yellow), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetyellow", _schema, _params); +} + +void f_pixelsetyellowquantum(CObjRef pxl_wnd, double yellow) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_wnd)), NEW(ArrayElement)(yellow), (ArrayElement*)NULL); + Crutch::Invoke("pixelsetyellowquantum", _schema, _params); +} + +Array f_pixelgetiteratorexception(CObjRef pxl_iter) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_iter)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetiteratorexception", _schema, _params); + return (Variant)_ret[0]; +} + +String f_pixelgetiteratorexceptionstring(CObjRef pxl_iter) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_iter)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetiteratorexceptionstring", _schema, _params); + return (Variant)_ret[0]; +} + +int f_pixelgetiteratorexceptiontype(CObjRef pxl_iter) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_iter)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetiteratorexceptiontype", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_pixelgetnextiteratorrow(CObjRef pxl_iter) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_iter)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelgetnextiteratorrow", _schema, _params); + return (Variant)_ret[0]; +} + +void f_pixelresetiterator(CObjRef pxl_iter) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_iter)), (ArrayElement*)NULL); + Crutch::Invoke("pixelresetiterator", _schema, _params); +} + +bool f_pixelsetiteratorrow(CObjRef pxl_iter, int row) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_iter)), NEW(ArrayElement)(row), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelsetiteratorrow", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_pixelsynciterator(CObjRef pxl_iter) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(pxl_iter)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("pixelsynciterator", _schema, _params); + return (Variant)_ret[0]; +} + + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_magick.h b/src/cpp/ext/ext_magick.h new file mode 100644 index 0000000000000..1c2c0820e26a3 --- /dev/null +++ b/src/cpp/ext/ext_magick.h @@ -0,0 +1,460 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_MAGICK_H__ +#define __EXT_MAGICK_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +String f_magickgetcopyright(); +String f_magickgethomeurl(); +String f_magickgetpackagename(); +double f_magickgetquantumdepth(); +String f_magickgetreleasedate(); +double f_magickgetresourcelimit(int resource_type); +Array f_magickgetversion(); +int f_magickgetversionnumber(); +String f_magickgetversionstring(); +String f_magickqueryconfigureoption(CStrRef option); +Array f_magickqueryconfigureoptions(CStrRef pattern); +Array f_magickqueryfonts(CStrRef pattern); +Array f_magickqueryformats(CStrRef pattern); +bool f_magicksetresourcelimit(int resource_type, double limit); +Object f_newdrawingwand(); +Object f_newmagickwand(); +Object f_newpixeliterator(CObjRef mgck_wnd); +Object f_newpixelregioniterator(CObjRef mgck_wnd, int x, int y, int columns, int rows); +Object f_newpixelwand(CStrRef imagemagick_col_str = null_string); +Array f_newpixelwandarray(int num_pxl_wnds); +Array f_newpixelwands(int num_pxl_wnds); +void f_destroydrawingwand(CObjRef drw_wnd); +void f_destroymagickwand(CObjRef mgck_wnd); +void f_destroypixeliterator(CObjRef pxl_iter); +void f_destroypixelwand(CObjRef pxl_wnd); +void f_destroypixelwandarray(CArrRef pxl_wnd_array); +void f_destroypixelwands(CArrRef pxl_wnd_array); +bool f_isdrawingwand(CVarRef var); +bool f_ismagickwand(CVarRef var); +bool f_ispixeliterator(CVarRef var); +bool f_ispixelwand(CVarRef var); +void f_cleardrawingwand(CObjRef drw_wnd); +void f_clearmagickwand(CObjRef mgck_wnd); +void f_clearpixeliterator(CObjRef pxl_iter); +void f_clearpixelwand(CObjRef pxl_wnd); +Object f_clonedrawingwand(CObjRef drw_wnd); +Object f_clonemagickwand(CObjRef mgck_wnd); +Array f_wandgetexception(CObjRef wnd); +String f_wandgetexceptionstring(CObjRef wnd); +int f_wandgetexceptiontype(CObjRef wnd); +bool f_wandhasexception(CObjRef wnd); +void f_drawaffine(CObjRef drw_wnd, double sx, double sy, double rx, double ry, double tx, double ty); +void f_drawannotation(CObjRef drw_wnd, double x, double y, CStrRef text); +void f_drawarc(CObjRef drw_wnd, double sx, double sy, double ex, double ey, double sd, double ed); +void f_drawbezier(CObjRef drw_wnd, CArrRef x_y_points_array); +void f_drawcircle(CObjRef drw_wnd, double ox, double oy, double px, double py); +void f_drawcolor(CObjRef drw_wnd, double x, double y, int paint_method); +void f_drawcomment(CObjRef drw_wnd, CStrRef comment); +bool f_drawcomposite(CObjRef drw_wnd, int composite_operator, double x, double y, double width, double height, CObjRef mgck_wnd); +void f_drawellipse(CObjRef drw_wnd, double ox, double oy, double rx, double ry, double start, double end); +String f_drawgetclippath(CObjRef drw_wnd); +int f_drawgetcliprule(CObjRef drw_wnd); +int f_drawgetclipunits(CObjRef drw_wnd); +Array f_drawgetexception(CObjRef drw_wnd); +String f_drawgetexceptionstring(CObjRef drw_wnd); +int f_drawgetexceptiontype(CObjRef drw_wnd); +double f_drawgetfillalpha(CObjRef drw_wnd); +Object f_drawgetfillcolor(CObjRef drw_wnd); +double f_drawgetfillopacity(CObjRef drw_wnd); +int f_drawgetfillrule(CObjRef drw_wnd); +String f_drawgetfont(CObjRef drw_wnd); +String f_drawgetfontfamily(CObjRef drw_wnd); +double f_drawgetfontsize(CObjRef drw_wnd); +int f_drawgetfontstretch(CObjRef drw_wnd); +int f_drawgetfontstyle(CObjRef drw_wnd); +double f_drawgetfontweight(CObjRef drw_wnd); +int f_drawgetgravity(CObjRef drw_wnd); +double f_drawgetstrokealpha(CObjRef drw_wnd); +bool f_drawgetstrokeantialias(CObjRef drw_wnd); +Object f_drawgetstrokecolor(CObjRef drw_wnd); +Array f_drawgetstrokedasharray(CObjRef drw_wnd); +double f_drawgetstrokedashoffset(CObjRef drw_wnd); +int f_drawgetstrokelinecap(CObjRef drw_wnd); +int f_drawgetstrokelinejoin(CObjRef drw_wnd); +double f_drawgetstrokemiterlimit(CObjRef drw_wnd); +double f_drawgetstrokeopacity(CObjRef drw_wnd); +double f_drawgetstrokewidth(CObjRef drw_wnd); +int f_drawgettextalignment(CObjRef drw_wnd); +bool f_drawgettextantialias(CObjRef drw_wnd); +int f_drawgettextdecoration(CObjRef drw_wnd); +String f_drawgettextencoding(CObjRef drw_wnd); +Object f_drawgettextundercolor(CObjRef drw_wnd); +String f_drawgetvectorgraphics(CObjRef drw_wnd); +void f_drawline(CObjRef drw_wnd, double sx, double sy, double ex, double ey); +void f_drawmatte(CObjRef drw_wnd, double x, double y, int paint_method); +void f_drawpathclose(CObjRef drw_wnd); +void f_drawpathcurvetoabsolute(CObjRef drw_wnd, double x1, double y1, double x2, double y2, double x, double y); +void f_drawpathcurvetoquadraticbezierabsolute(CObjRef drw_wnd, double x1, double y1, double x, double y); +void f_drawpathcurvetoquadraticbezierrelative(CObjRef drw_wnd, double x1, double y1, double x, double y); +void f_drawpathcurvetoquadraticbeziersmoothabsolute(CObjRef drw_wnd, double x, double y); +void f_drawpathcurvetoquadraticbeziersmoothrelative(CObjRef drw_wnd, double x, double y); +void f_drawpathcurvetorelative(CObjRef drw_wnd, double x1, double y1, double x2, double y2, double x, double y); +void f_drawpathcurvetosmoothabsolute(CObjRef drw_wnd, double x2, double y2, double x, double y); +void f_drawpathcurvetosmoothrelative(CObjRef drw_wnd, double x2, double y2, double x, double y); +void f_drawpathellipticarcabsolute(CObjRef drw_wnd, double rx, double ry, double x_axis_rotation, bool large_arc_flag, bool sweep_flag, double x, double y); +void f_drawpathellipticarcrelative(CObjRef drw_wnd, double rx, double ry, double x_axis_rotation, bool large_arc_flag, bool sweep_flag, double x, double y); +void f_drawpathfinish(CObjRef drw_wnd); +void f_drawpathlinetoabsolute(CObjRef drw_wnd, double x, double y); +void f_drawpathlinetohorizontalabsolute(CObjRef drw_wnd, double x); +void f_drawpathlinetohorizontalrelative(CObjRef drw_wnd, double x); +void f_drawpathlinetorelative(CObjRef drw_wnd, double x, double y); +void f_drawpathlinetoverticalabsolute(CObjRef drw_wnd, double y); +void f_drawpathlinetoverticalrelative(CObjRef drw_wnd, double y); +void f_drawpathmovetoabsolute(CObjRef drw_wnd, double x, double y); +void f_drawpathmovetorelative(CObjRef drw_wnd, double x, double y); +void f_drawpathstart(CObjRef drw_wnd); +void f_drawpoint(CObjRef drw_wnd, double x, double y); +void f_drawpolygon(CObjRef drw_wnd, CArrRef x_y_points_array); +void f_drawpolyline(CObjRef drw_wnd, CArrRef x_y_points_array); +void f_drawrectangle(CObjRef drw_wnd, double x1, double y1, double x2, double y2); +bool f_drawrender(CObjRef drw_wnd); +void f_drawrotate(CObjRef drw_wnd, double degrees); +void f_drawroundrectangle(CObjRef drw_wnd, double x1, double y1, double x2, double y2, double rx, double ry); +void f_drawscale(CObjRef drw_wnd, double x, double y); +bool f_drawsetclippath(CObjRef drw_wnd, CStrRef clip_path); +void f_drawsetcliprule(CObjRef drw_wnd, int fill_rule); +void f_drawsetclipunits(CObjRef drw_wnd, int clip_path_units); +void f_drawsetfillalpha(CObjRef drw_wnd, double fill_opacity); +void f_drawsetfillcolor(CObjRef drw_wnd, CObjRef fill_pxl_wnd); +void f_drawsetfillopacity(CObjRef drw_wnd, double fill_opacity); +bool f_drawsetfillpatternurl(CObjRef drw_wnd, CStrRef fill_url); +void f_drawsetfillrule(CObjRef drw_wnd, int fill_rule); +bool f_drawsetfont(CObjRef drw_wnd, CStrRef font_file); +bool f_drawsetfontfamily(CObjRef drw_wnd, CStrRef font_family); +void f_drawsetfontsize(CObjRef drw_wnd, double pointsize); +void f_drawsetfontstretch(CObjRef drw_wnd, int stretch_type); +void f_drawsetfontstyle(CObjRef drw_wnd, int style_type); +void f_drawsetfontweight(CObjRef drw_wnd, double font_weight); +void f_drawsetgravity(CObjRef drw_wnd, int gravity_type); +void f_drawsetstrokealpha(CObjRef drw_wnd, double stroke_opacity); +void f_drawsetstrokeantialias(CObjRef drw_wnd, bool stroke_antialias = true); +void f_drawsetstrokecolor(CObjRef drw_wnd, CObjRef strokecolor_pxl_wnd); +void f_drawsetstrokedasharray(CObjRef drw_wnd, CArrRef dash_array = null_array); +void f_drawsetstrokedashoffset(CObjRef drw_wnd, double dash_offset); +void f_drawsetstrokelinecap(CObjRef drw_wnd, int line_cap); +void f_drawsetstrokelinejoin(CObjRef drw_wnd, int line_join); +void f_drawsetstrokemiterlimit(CObjRef drw_wnd, double miterlimit); +void f_drawsetstrokeopacity(CObjRef drw_wnd, double stroke_opacity); +bool f_drawsetstrokepatternurl(CObjRef drw_wnd, CStrRef stroke_url); +void f_drawsetstrokewidth(CObjRef drw_wnd, double stroke_width); +void f_drawsettextalignment(CObjRef drw_wnd, int align_type); +void f_drawsettextantialias(CObjRef drw_wnd, bool text_antialias = true); +void f_drawsettextdecoration(CObjRef drw_wnd, int decoration_type); +void f_drawsettextencoding(CObjRef drw_wnd, CStrRef encoding); +void f_drawsettextundercolor(CObjRef drw_wnd, CObjRef undercolor_pxl_wnd); +bool f_drawsetvectorgraphics(CObjRef drw_wnd, CStrRef vector_graphics); +void f_drawsetviewbox(CObjRef drw_wnd, double x1, double y1, double x2, double y2); +void f_drawskewx(CObjRef drw_wnd, double degrees); +void f_drawskewy(CObjRef drw_wnd, double degrees); +void f_drawtranslate(CObjRef drw_wnd, double x, double y); +void f_pushdrawingwand(CObjRef drw_wnd); +void f_drawpushclippath(CObjRef drw_wnd, CStrRef clip_path_id); +void f_drawpushdefs(CObjRef drw_wnd); +void f_drawpushpattern(CObjRef drw_wnd, CStrRef pattern_id, double x, double y, double width, double height); +void f_popdrawingwand(CObjRef drw_wnd); +void f_drawpopclippath(CObjRef drw_wnd); +void f_drawpopdefs(CObjRef drw_wnd); +void f_drawpoppattern(CObjRef drw_wnd); +bool f_magickadaptivethresholdimage(CObjRef mgck_wnd, double width, double height, double offset); +bool f_magickaddimage(CObjRef mgck_wnd, CObjRef add_wand); +bool f_magickaddnoiseimage(CObjRef mgck_wnd, int noise_type); +bool f_magickaffinetransformimage(CObjRef mgck_wnd, CObjRef drw_wnd); +bool f_magickannotateimage(CObjRef mgck_wnd, CObjRef drw_wnd, double x, double y, double angle, CStrRef text); +Object f_magickappendimages(CObjRef mgck_wnd, bool stack_vertical = false); +Object f_magickaverageimages(CObjRef mgck_wnd); +bool f_magickblackthresholdimage(CObjRef mgck_wnd, CObjRef threshold_pxl_wnd); +bool f_magickblurimage(CObjRef mgck_wnd, double radius, double sigma, int channel_type = 0); +bool f_magickborderimage(CObjRef mgck_wnd, CObjRef bordercolor, double width, double height); +bool f_magickcharcoalimage(CObjRef mgck_wnd, double radius, double sigma); +bool f_magickchopimage(CObjRef mgck_wnd, double width, double height, int x, int y); +bool f_magickclipimage(CObjRef mgck_wnd); +bool f_magickclippathimage(CObjRef mgck_wnd, CStrRef pathname, bool inside); +Object f_magickcoalesceimages(CObjRef mgck_wnd); +bool f_magickcolorfloodfillimage(CObjRef mgck_wnd, CObjRef fillcolor_pxl_wnd, double fuzz, CObjRef bordercolor_pxl_wnd, int x, int y); +bool f_magickcolorizeimage(CObjRef mgck_wnd, CObjRef colorize, CObjRef opacity_pxl_wnd); +Object f_magickcombineimages(CObjRef mgck_wnd, int channel_type); +bool f_magickcommentimage(CObjRef mgck_wnd, CStrRef comment); +Array f_magickcompareimages(CObjRef mgck_wnd, CObjRef reference_wnd, int metric_type, int channel_type = 0); +bool f_magickcompositeimage(CObjRef mgck_wnd, CObjRef composite_wnd, int composite_operator, int x, int y); +bool f_magickconstituteimage(CObjRef mgck_wnd, double columns, double rows, CStrRef smap, int storage_type, CArrRef pixel_array); +bool f_magickcontrastimage(CObjRef mgck_wnd, bool sharpen); +bool f_magickconvolveimage(CObjRef mgck_wnd, CArrRef kernel_array, int channel_type = 0); +bool f_magickcropimage(CObjRef mgck_wnd, double width, double height, int x, int y); +bool f_magickcyclecolormapimage(CObjRef mgck_wnd, int num_positions); +Object f_magickdeconstructimages(CObjRef mgck_wnd); +String f_magickdescribeimage(CObjRef mgck_wnd); +bool f_magickdespeckleimage(CObjRef mgck_wnd); +bool f_magickdrawimage(CObjRef mgck_wnd, CObjRef drw_wnd); +bool f_magickechoimageblob(CObjRef mgck_wnd); +bool f_magickechoimagesblob(CObjRef mgck_wnd); +bool f_magickedgeimage(CObjRef mgck_wnd, double radius); +bool f_magickembossimage(CObjRef mgck_wnd, double radius, double sigma); +bool f_magickenhanceimage(CObjRef mgck_wnd); +bool f_magickequalizeimage(CObjRef mgck_wnd); +bool f_magickevaluateimage(CObjRef mgck_wnd, int evaluate_op, double constant, int channel_type = 0); +Object f_magickflattenimages(CObjRef mgck_wnd); +bool f_magickflipimage(CObjRef mgck_wnd); +bool f_magickflopimage(CObjRef mgck_wnd); +bool f_magickframeimage(CObjRef mgck_wnd, CObjRef matte_color, double width, double height, int inner_bevel, int outer_bevel); +Object f_magickfximage(CObjRef mgck_wnd, CStrRef expression, int channel_type = 0); +bool f_magickgammaimage(CObjRef mgck_wnd, double gamma, int channel_type = 0); +bool f_magickgaussianblurimage(CObjRef mgck_wnd, double radius, double sigma, int channel_type = 0); +double f_magickgetcharheight(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false); +double f_magickgetcharwidth(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false); +Array f_magickgetexception(CObjRef mgck_wnd); +String f_magickgetexceptionstring(CObjRef mgck_wnd); +int f_magickgetexceptiontype(CObjRef mgck_wnd); +String f_magickgetfilename(CObjRef mgck_wnd); +String f_magickgetformat(CObjRef mgck_wnd); +Object f_magickgetimage(CObjRef mgck_wnd); +Object f_magickgetimagebackgroundcolor(CObjRef mgck_wnd); +String f_magickgetimageblob(CObjRef mgck_wnd); +Array f_magickgetimageblueprimary(CObjRef mgck_wnd); +Object f_magickgetimagebordercolor(CObjRef mgck_wnd); +Array f_magickgetimagechannelmean(CObjRef mgck_wnd, int channel_type); +Object f_magickgetimagecolormapcolor(CObjRef mgck_wnd, double index); +double f_magickgetimagecolors(CObjRef mgck_wnd); +int f_magickgetimagecolorspace(CObjRef mgck_wnd); +int f_magickgetimagecompose(CObjRef mgck_wnd); +int f_magickgetimagecompression(CObjRef mgck_wnd); +double f_magickgetimagecompressionquality(CObjRef mgck_wnd); +double f_magickgetimagedelay(CObjRef mgck_wnd); +double f_magickgetimagedepth(CObjRef mgck_wnd, int channel_type = 0); +int f_magickgetimagedispose(CObjRef mgck_wnd); +Array f_magickgetimageextrema(CObjRef mgck_wnd, int channel_type = 0); +String f_magickgetimagefilename(CObjRef mgck_wnd); +String f_magickgetimageformat(CObjRef mgck_wnd); +double f_magickgetimagegamma(CObjRef mgck_wnd); +Array f_magickgetimagegreenprimary(CObjRef mgck_wnd); +double f_magickgetimageheight(CObjRef mgck_wnd); +Array f_magickgetimagehistogram(CObjRef mgck_wnd); +int f_magickgetimageindex(CObjRef mgck_wnd); +int f_magickgetimageinterlacescheme(CObjRef mgck_wnd); +double f_magickgetimageiterations(CObjRef mgck_wnd); +Object f_magickgetimagemattecolor(CObjRef mgck_wnd); +String f_magickgetimagemimetype(CObjRef mgck_wnd); +Array f_magickgetimagepixels(CObjRef mgck_wnd, int x_offset, int y_offset, double columns, double rows, CStrRef smap, int storage_type); +String f_magickgetimageprofile(CObjRef mgck_wnd, CStrRef name); +Array f_magickgetimageredprimary(CObjRef mgck_wnd); +int f_magickgetimagerenderingintent(CObjRef mgck_wnd); +Array f_magickgetimageresolution(CObjRef mgck_wnd); +double f_magickgetimagescene(CObjRef mgck_wnd); +String f_magickgetimagesignature(CObjRef mgck_wnd); +int f_magickgetimagesize(CObjRef mgck_wnd); +int f_magickgetimagetype(CObjRef mgck_wnd); +int f_magickgetimageunits(CObjRef mgck_wnd); +int f_magickgetimagevirtualpixelmethod(CObjRef mgck_wnd); +Array f_magickgetimagewhitepoint(CObjRef mgck_wnd); +double f_magickgetimagewidth(CObjRef mgck_wnd); +String f_magickgetimagesblob(CObjRef mgck_wnd); +int f_magickgetinterlacescheme(CObjRef mgck_wnd); +double f_magickgetmaxtextadvance(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false); +String f_magickgetmimetype(CObjRef mgck_wnd); +double f_magickgetnumberimages(CObjRef mgck_wnd); +Array f_magickgetsamplingfactors(CObjRef mgck_wnd); +Array f_magickgetsize(CObjRef mgck_wnd); +double f_magickgetstringheight(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false); +double f_magickgetstringwidth(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false); +double f_magickgettextascent(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false); +double f_magickgettextdescent(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false); +Array f_magickgetwandsize(CObjRef mgck_wnd); +bool f_magickhasnextimage(CObjRef mgck_wnd); +bool f_magickhaspreviousimage(CObjRef mgck_wnd); +bool f_magickimplodeimage(CObjRef mgck_wnd, double amount); +bool f_magicklabelimage(CObjRef mgck_wnd, CStrRef label); +bool f_magicklevelimage(CObjRef mgck_wnd, double black_point, double gamma, double white_point, int channel_type = 0); +bool f_magickmagnifyimage(CObjRef mgck_wnd); +bool f_magickmapimage(CObjRef mgck_wnd, CObjRef map_wand, bool dither); +bool f_magickmattefloodfillimage(CObjRef mgck_wnd, double opacity, double fuzz, CObjRef bordercolor_pxl_wnd, int x, int y); +bool f_magickmedianfilterimage(CObjRef mgck_wnd, double radius); +bool f_magickminifyimage(CObjRef mgck_wnd); +bool f_magickmodulateimage(CObjRef mgck_wnd, double brightness, double saturation, double hue); +Object f_magickmontageimage(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef tile_geometry, CStrRef thumbnail_geometry, int montage_mode, CStrRef frame); +Object f_magickmorphimages(CObjRef mgck_wnd, double number_frames); +Object f_magickmosaicimages(CObjRef mgck_wnd); +bool f_magickmotionblurimage(CObjRef mgck_wnd, double radius, double sigma, double angle); +bool f_magicknegateimage(CObjRef mgck_wnd, bool only_the_gray = false, int channel_type = 0); +bool f_magicknewimage(CObjRef mgck_wnd, double width, double height, CStrRef imagemagick_col_str = null_string); +bool f_magicknextimage(CObjRef mgck_wnd); +bool f_magicknormalizeimage(CObjRef mgck_wnd); +bool f_magickoilpaintimage(CObjRef mgck_wnd, double radius); +bool f_magickpaintopaqueimage(CObjRef mgck_wnd, CObjRef target_pxl_wnd, CObjRef fill_pxl_wnd, double fuzz = 0.0); +bool f_magickpainttransparentimage(CObjRef mgck_wnd, CObjRef target, double opacity = k_MW_TransparentOpacity, double fuzz = 0.0); +bool f_magickpingimage(CObjRef mgck_wnd, CStrRef filename); +bool f_magickposterizeimage(CObjRef mgck_wnd, double levels, bool dither); +Object f_magickpreviewimages(CObjRef mgck_wnd, int preview); +bool f_magickpreviousimage(CObjRef mgck_wnd); +bool f_magickprofileimage(CObjRef mgck_wnd, CStrRef name, CStrRef profile = null_string); +bool f_magickquantizeimage(CObjRef mgck_wnd, double number_colors, int colorspace_type, double treedepth, bool dither, bool measure_error); +bool f_magickquantizeimages(CObjRef mgck_wnd, double number_colors, int colorspace_type, double treedepth, bool dither, bool measure_error); +Array f_magickqueryfontmetrics(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false); +bool f_magickradialblurimage(CObjRef mgck_wnd, double angle); +bool f_magickraiseimage(CObjRef mgck_wnd, double width, double height, int x, int y, bool raise); +bool f_magickreadimage(CObjRef mgck_wnd, CStrRef filename); +bool f_magickreadimageblob(CObjRef mgck_wnd, CStrRef blob); +bool f_magickreadimagefile(CObjRef mgck_wnd, CObjRef handle); +bool f_magickreadimages(CObjRef mgck_wnd, CArrRef img_filenames_array); +bool f_magickreducenoiseimage(CObjRef mgck_wnd, double radius); +bool f_magickremoveimage(CObjRef mgck_wnd); +String f_magickremoveimageprofile(CObjRef mgck_wnd, CStrRef name); +bool f_magickremoveimageprofiles(CObjRef mgck_wnd); +bool f_magickresampleimage(CObjRef mgck_wnd, double x_resolution, double y_resolution, int filter_type, double blur); +void f_magickresetiterator(CObjRef mgck_wnd); +bool f_magickresizeimage(CObjRef mgck_wnd, double columns, double rows, int filter_type, double blur); +bool f_magickrollimage(CObjRef mgck_wnd, int x_offset, int y_offset); +bool f_magickrotateimage(CObjRef mgck_wnd, CObjRef background, double degrees); +bool f_magicksampleimage(CObjRef mgck_wnd, double columns, double rows); +bool f_magickscaleimage(CObjRef mgck_wnd, double columns, double rows); +bool f_magickseparateimagechannel(CObjRef mgck_wnd, int channel_type); +bool f_magicksetcompressionquality(CObjRef mgck_wnd, double quality); +bool f_magicksetfilename(CObjRef mgck_wnd, CStrRef filename = null_string); +void f_magicksetfirstiterator(CObjRef mgck_wnd); +bool f_magicksetformat(CObjRef mgck_wnd, CStrRef format); +bool f_magicksetimage(CObjRef mgck_wnd, CObjRef replace_wand); +bool f_magicksetimagebackgroundcolor(CObjRef mgck_wnd, CObjRef background_pxl_wnd); +bool f_magicksetimagebias(CObjRef mgck_wnd, double bias); +bool f_magicksetimageblueprimary(CObjRef mgck_wnd, double x, double y); +bool f_magicksetimagebordercolor(CObjRef mgck_wnd, CObjRef border_pxl_wnd); +bool f_magicksetimagecolormapcolor(CObjRef mgck_wnd, double index, CObjRef mapcolor_pxl_wnd); +bool f_magicksetimagecolorspace(CObjRef mgck_wnd, int colorspace_type); +bool f_magicksetimagecompose(CObjRef mgck_wnd, int composite_operator); +bool f_magicksetimagecompression(CObjRef mgck_wnd, int compression_type); +bool f_magicksetimagecompressionquality(CObjRef mgck_wnd, double quality); +bool f_magicksetimagedelay(CObjRef mgck_wnd, double delay); +bool f_magicksetimagedepth(CObjRef mgck_wnd, int depth, int channel_type = 0); +bool f_magicksetimagedispose(CObjRef mgck_wnd, int dispose_type); +bool f_magicksetimagefilename(CObjRef mgck_wnd, CStrRef filename = null_string); +bool f_magicksetimageformat(CObjRef mgck_wnd, CStrRef format); +bool f_magicksetimagegamma(CObjRef mgck_wnd, double gamma); +bool f_magicksetimagegreenprimary(CObjRef mgck_wnd, double x, double y); +bool f_magicksetimageindex(CObjRef mgck_wnd, int index); +bool f_magicksetimageinterlacescheme(CObjRef mgck_wnd, int interlace_type); +bool f_magicksetimageiterations(CObjRef mgck_wnd, double iterations); +bool f_magicksetimagemattecolor(CObjRef mgck_wnd, CObjRef matte_pxl_wnd); +bool f_magicksetimageoption(CObjRef mgck_wnd, CStrRef format, CStrRef key, CStrRef value); +bool f_magicksetimagepixels(CObjRef mgck_wnd, int x_offset, int y_offset, double columns, double rows, CStrRef smap, int storage_type, CArrRef pixel_array); +bool f_magicksetimageprofile(CObjRef mgck_wnd, CStrRef name, CStrRef profile); +bool f_magicksetimageredprimary(CObjRef mgck_wnd, double x, double y); +bool f_magicksetimagerenderingintent(CObjRef mgck_wnd, int rendering_intent); +bool f_magicksetimageresolution(CObjRef mgck_wnd, double x_resolution, double y_resolution); +bool f_magicksetimagescene(CObjRef mgck_wnd, double scene); +bool f_magicksetimagetype(CObjRef mgck_wnd, int image_type); +bool f_magicksetimageunits(CObjRef mgck_wnd, int resolution_type); +bool f_magicksetimagevirtualpixelmethod(CObjRef mgck_wnd, int virtual_pixel_method); +bool f_magicksetimagewhitepoint(CObjRef mgck_wnd, double x, double y); +bool f_magicksetinterlacescheme(CObjRef mgck_wnd, int interlace_type); +void f_magicksetlastiterator(CObjRef mgck_wnd); +bool f_magicksetpassphrase(CObjRef mgck_wnd, CStrRef passphrase); +bool f_magicksetresolution(CObjRef mgck_wnd, double x_resolution, double y_resolution); +bool f_magicksetsamplingfactors(CObjRef mgck_wnd, double number_factors, CArrRef sampling_factors); +bool f_magicksetsize(CObjRef mgck_wnd, int columns, int rows); +bool f_magicksetwandsize(CObjRef mgck_wnd, int columns, int rows); +bool f_magicksharpenimage(CObjRef mgck_wnd, double radius, double sigma, int channel_type = 0); +bool f_magickshaveimage(CObjRef mgck_wnd, int columns, int rows); +bool f_magickshearimage(CObjRef mgck_wnd, CObjRef background, double x_shear, double y_shear); +bool f_magicksolarizeimage(CObjRef mgck_wnd, double threshold); +bool f_magickspliceimage(CObjRef mgck_wnd, double width, double height, int x, int y); +bool f_magickspreadimage(CObjRef mgck_wnd, double radius); +Object f_magicksteganoimage(CObjRef mgck_wnd, CObjRef watermark_wand, int offset); +bool f_magickstereoimage(CObjRef mgck_wnd, CObjRef offset_wand); +bool f_magickstripimage(CObjRef mgck_wnd); +bool f_magickswirlimage(CObjRef mgck_wnd, double degrees); +Object f_magicktextureimage(CObjRef mgck_wnd, CObjRef texture_wand); +bool f_magickthresholdimage(CObjRef mgck_wnd, double threshold, int channel_type = 0); +bool f_magicktintimage(CObjRef mgck_wnd, int tint_pxl_wnd, CObjRef opacity_pxl_wnd); +Object f_magicktransformimage(CObjRef mgck_wnd, CStrRef crop, CStrRef geometry); +bool f_magicktrimimage(CObjRef mgck_wnd, double fuzz); +bool f_magickunsharpmaskimage(CObjRef mgck_wnd, double radius, double sigma, double amount, double threshold, int channel_type = 0); +bool f_magickwaveimage(CObjRef mgck_wnd, double amplitude, double wave_length); +bool f_magickwhitethresholdimage(CObjRef mgck_wnd, CObjRef threshold_pxl_wnd); +bool f_magickwriteimage(CObjRef mgck_wnd, CStrRef filename); +bool f_magickwriteimagefile(CObjRef mgck_wnd, CObjRef handle); +bool f_magickwriteimages(CObjRef mgck_wnd, CStrRef filename = "", bool join_images = false); +bool f_magickwriteimagesfile(CObjRef mgck_wnd, CObjRef handle); +double f_pixelgetalpha(CObjRef pxl_wnd); +double f_pixelgetalphaquantum(CObjRef pxl_wnd); +double f_pixelgetblack(CObjRef pxl_wnd); +double f_pixelgetblackquantum(CObjRef pxl_wnd); +double f_pixelgetblue(CObjRef pxl_wnd); +double f_pixelgetbluequantum(CObjRef pxl_wnd); +String f_pixelgetcolorasstring(CObjRef pxl_wnd); +double f_pixelgetcolorcount(CObjRef pxl_wnd); +double f_pixelgetcyan(CObjRef pxl_wnd); +double f_pixelgetcyanquantum(CObjRef pxl_wnd); +Array f_pixelgetexception(CObjRef pxl_wnd); +String f_pixelgetexceptionstring(CObjRef pxl_wnd); +int f_pixelgetexceptiontype(CObjRef pxl_wnd); +double f_pixelgetgreen(CObjRef pxl_wnd); +double f_pixelgetgreenquantum(CObjRef pxl_wnd); +double f_pixelgetindex(CObjRef pxl_wnd); +double f_pixelgetmagenta(CObjRef pxl_wnd); +double f_pixelgetmagentaquantum(CObjRef pxl_wnd); +double f_pixelgetopacity(CObjRef pxl_wnd); +double f_pixelgetopacityquantum(CObjRef pxl_wnd); +Array f_pixelgetquantumcolor(CObjRef pxl_wnd); +double f_pixelgetred(CObjRef pxl_wnd); +double f_pixelgetredquantum(CObjRef pxl_wnd); +double f_pixelgetyellow(CObjRef pxl_wnd); +double f_pixelgetyellowquantum(CObjRef pxl_wnd); +void f_pixelsetalpha(CObjRef pxl_wnd, double alpha); +void f_pixelsetalphaquantum(CObjRef pxl_wnd, double alpha); +void f_pixelsetblack(CObjRef pxl_wnd, double black); +void f_pixelsetblackquantum(CObjRef pxl_wnd, double black); +void f_pixelsetblue(CObjRef pxl_wnd, double blue); +void f_pixelsetbluequantum(CObjRef pxl_wnd, double blue); +void f_pixelsetcolor(CObjRef pxl_wnd, CStrRef imagemagick_col_str); +void f_pixelsetcolorcount(CObjRef pxl_wnd, int count); +void f_pixelsetcyan(CObjRef pxl_wnd, double cyan); +void f_pixelsetcyanquantum(CObjRef pxl_wnd, double cyan); +void f_pixelsetgreen(CObjRef pxl_wnd, double green); +void f_pixelsetgreenquantum(CObjRef pxl_wnd, double green); +void f_pixelsetindex(CObjRef pxl_wnd, double index); +void f_pixelsetmagenta(CObjRef pxl_wnd, double magenta); +void f_pixelsetmagentaquantum(CObjRef pxl_wnd, double magenta); +void f_pixelsetopacity(CObjRef pxl_wnd, double opacity); +void f_pixelsetopacityquantum(CObjRef pxl_wnd, double opacity); +void f_pixelsetquantumcolor(CObjRef pxl_wnd, double red, double green, double blue, double opacity = 0.0); +void f_pixelsetred(CObjRef pxl_wnd, double red); +void f_pixelsetredquantum(CObjRef pxl_wnd, double red); +void f_pixelsetyellow(CObjRef pxl_wnd, double yellow); +void f_pixelsetyellowquantum(CObjRef pxl_wnd, double yellow); +Array f_pixelgetiteratorexception(CObjRef pxl_iter); +String f_pixelgetiteratorexceptionstring(CObjRef pxl_iter); +int f_pixelgetiteratorexceptiontype(CObjRef pxl_iter); +Array f_pixelgetnextiteratorrow(CObjRef pxl_iter); +void f_pixelresetiterator(CObjRef pxl_iter); +bool f_pixelsetiteratorrow(CObjRef pxl_iter, int row); +bool f_pixelsynciterator(CObjRef pxl_iter); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_MAGICK_H__ diff --git a/src/cpp/ext/ext_mailparse.cpp b/src/cpp/ext/ext_mailparse.cpp new file mode 100644 index 0000000000000..acdcea941eef3 --- /dev/null +++ b/src/cpp/ext/ext_mailparse.cpp @@ -0,0 +1,224 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include "crutch.h" + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// utility functions + +/** + * Removes whitespaces from the end, and replaces control characters with ' ' + * from the beginning. + */ +static String php_trim(CStrRef str) { + string s(str.c_str()); + unsigned int l = s.length(); + while (l > 0 && isspace((unsigned char)s[l - 1])) { + l--; + } + for (unsigned int i = 0; i < l; i++) { + if (iscntrl((unsigned char)s[i])) { + if (i + 2 < l && s[i] == '\r' && s[i + 1] == '\n' && + (s[i + 2] == ' ' || s[i + 2] == '\t')) { + i += 2; + while (i + 1 < l && (s[i + 1] == ' ' || s[i + 1] == '\t')) { + i++; + } + continue; + } + s[i] = ' '; + } + } + return s.substr(0, l); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool php_mail(CStrRef to, CStrRef subject, CStrRef message, CStrRef headers, + CStrRef extra_cmd) { + // assumes we always have sendmail installed + assert(!RuntimeOption::SendmailPath.empty()); + + ostringstream os; + os << RuntimeOption::SendmailPath; + if (!extra_cmd.empty()) { + os << ' ' << extra_cmd.c_str(); + } + + errno = 0; + FILE *sendmail = popen(os.str().c_str(), "w"); + if (sendmail == NULL || EACCES == errno) { + Logger::Warning("Unable to execute %s", + RuntimeOption::SendmailPath.c_str()); + return false; + } + + fprintf(sendmail, "To: %s\n", to.c_str()); + fprintf(sendmail, "Subject: %s\n", subject.c_str()); + if (!headers.empty()) { + fprintf(sendmail, "%s\n", headers.c_str()); + } + fprintf(sendmail, "\n%s\n", message.c_str()); + + int ret = pclose(sendmail); + return (!ret); +} + +static const StaticString zero("\0", 1); + +bool f_mail(CStrRef to, CStrRef subject, CStrRef message, CStrRef additional_headers /* = null_string */, CStrRef additional_parameters /* = null_string */) { + // replace \0 with spaces + String to2 = to.replace(zero, " "); + String subject2 = subject.replace(zero, " "); + String message2 = message.replace(zero, " "); + String headers2; + if (!additional_headers.empty()) { + headers2 = additional_headers.replace(zero, " "); + } + String params2; + if (!additional_parameters.empty()) { + params2 = additional_parameters.replace(zero, " "); + } + + to2 = php_trim(to2); + subject2 = php_trim(subject2); + + if (!RuntimeOption::MailForceExtraParameters.empty()) { + params2 = f_escapeshellcmd(RuntimeOption::MailForceExtraParameters); + } else { + params2 = f_escapeshellcmd(params2); + } + + return php_mail(to2, subject2, message2, headers2, params2); +} + +int f_ezmlm_hash(CStrRef addr) { + unsigned long h = 5381L; + int str_len = addr.length(); + for (int i = 0; i < str_len; i++) { + h = (h + (h << 5)) ^ + ((unsigned long)(unsigned char)tolower(addr.charAt(i))); + } + h = (h % 53); + return (int)h; +} + +Object f_mailparse_msg_create() { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params((ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_msg_create", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_mailparse_msg_free(CObjRef mimemail) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mimemail)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_msg_free", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_mailparse_msg_parse_file(CStrRef filename) { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(filename), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_msg_parse_file", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_mailparse_msg_parse(CObjRef mimemail, CStrRef data) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mimemail)), NEW(ArrayElement)(data), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_msg_parse", _schema, _params); + return (Variant)_ret[0]; +} + +String f_mailparse_msg_extract_part_file(CObjRef mimemail, CStrRef filename, CStrRef callbackfunc /* = null_string */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mimemail)), NEW(ArrayElement)(filename), NEW(ArrayElement)(callbackfunc), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_msg_extract_part_file", _schema, _params); + return (Variant)_ret[0]; +} + +String f_mailparse_msg_extract_whole_part_file(CObjRef mimemail, CStrRef filename, CStrRef callbackfunc /* = null_string */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mimemail)), NEW(ArrayElement)(filename), NEW(ArrayElement)(callbackfunc), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_msg_extract_whole_part_file", _schema, _params); + return (Variant)_ret[0]; +} + +void f_mailparse_msg_extract_part(CObjRef mimemail, CStrRef msgbody, CStrRef callbackfunc /* = null_string */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mimemail)), NEW(ArrayElement)(msgbody), NEW(ArrayElement)(callbackfunc), (ArrayElement*)NULL); + Crutch::Invoke("mailparse_msg_extract_part", _schema, _params); +} + +Array f_mailparse_msg_get_part_data(CObjRef mimemail) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mimemail)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_msg_get_part_data", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_mailparse_msg_get_part(CObjRef mimemail, CStrRef mimesection) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mimemail)), NEW(ArrayElement)(mimesection), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_msg_get_part", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Array f_mailparse_msg_get_structure(CObjRef mimemail) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(mimemail)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_msg_get_structure", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_mailparse_rfc822_parse_addresses(CStrRef addresses) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(addresses), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_rfc822_parse_addresses", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_mailparse_stream_encode(CObjRef sourcefp, CObjRef destfp, CStrRef encoding) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(sourcefp)), NEW(ArrayElement)(OpaqueObject::GetIndex(destfp)), NEW(ArrayElement)(encoding), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_stream_encode", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_mailparse_uudecode_all(CObjRef fp) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(fp)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_uudecode_all", _schema, _params); + return (Variant)_ret[0]; +} + +String f_mailparse_determine_best_xfer_encoding(CObjRef fp) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(fp)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("mailparse_determine_best_xfer_encoding", _schema, _params); + return (Variant)_ret[0]; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_mailparse.h b/src/cpp/ext/ext_mailparse.h new file mode 100644 index 0000000000000..e7a7098b53b8b --- /dev/null +++ b/src/cpp/ext/ext_mailparse.h @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_MAILPARSE_H__ +#define __EXT_MAILPARSE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_mail(CStrRef to, CStrRef subject, CStrRef message, CStrRef additional_headers = null_string, CStrRef additional_parameters = null_string); +int f_ezmlm_hash(CStrRef addr); +Object f_mailparse_msg_create(); +bool f_mailparse_msg_free(CObjRef mimemail); +Object f_mailparse_msg_parse_file(CStrRef filename); +bool f_mailparse_msg_parse(CObjRef mimemail, CStrRef data); +String f_mailparse_msg_extract_part_file(CObjRef mimemail, CStrRef filename, CStrRef callbackfunc = null_string); +String f_mailparse_msg_extract_whole_part_file(CObjRef mimemail, CStrRef filename, CStrRef callbackfunc = null_string); +void f_mailparse_msg_extract_part(CObjRef mimemail, CStrRef msgbody, CStrRef callbackfunc = null_string); +Array f_mailparse_msg_get_part_data(CObjRef mimemail); +Object f_mailparse_msg_get_part(CObjRef mimemail, CStrRef mimesection); +Array f_mailparse_msg_get_structure(CObjRef mimemail); +Array f_mailparse_rfc822_parse_addresses(CStrRef addresses); +bool f_mailparse_stream_encode(CObjRef sourcefp, CObjRef destfp, CStrRef encoding); +Array f_mailparse_uudecode_all(CObjRef fp); +String f_mailparse_determine_best_xfer_encoding(CObjRef fp); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_MAILPARSE_H__ diff --git a/src/cpp/ext/ext_math.cpp b/src/cpp/ext/ext_math.cpp new file mode 100644 index 0000000000000..9abce818498ae --- /dev/null +++ b/src/cpp/ext/ext_math.cpp @@ -0,0 +1,162 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_min(int _argc, CVarRef value, CArrRef _argv /* = null_array */) { + Variant ret; + if (_argv.empty() && value.is(KindOfArray)) { + Array v = value.toArray(); + if (!v.empty()) { + ssize_t pos = v->iter_begin(); + if (pos != ArrayData::invalid_index) { + ret = v->getValue(pos); + while (true) { + pos = v->iter_advance(pos); + if (pos == ArrayData::invalid_index) break; + Variant tmp = v->getValue(pos); + if (less(tmp, ret)) { + ret = tmp; + } + } + } + } + } else { + ret = value; + if (!_argv.empty()) { + for (ssize_t pos = _argv->iter_begin(); pos != ArrayData::invalid_index; + pos = _argv->iter_advance(pos)) { + Variant tmp = _argv->getValue(pos); + if (less(tmp, ret)) { + ret = tmp; + } + } + } + } + return ret; +} + +Variant f_max(int _argc, CVarRef value, CArrRef _argv /* = null_array */) { + Variant ret; + if (_argv.empty() && value.is(KindOfArray)) { + Array v = value.toArray(); + if (!v.empty()) { + ssize_t pos = v->iter_begin(); + if (pos != ArrayData::invalid_index) { + ret = v->getValue(pos); + while (true) { + pos = v->iter_advance(pos); + if (pos == ArrayData::invalid_index) break; + Variant tmp = v->getValue(pos); + if (more(tmp, ret)) { + ret = tmp; + } + } + } + } + } else { + ret = value; + if (!_argv.empty()) { + for (ssize_t pos = _argv->iter_begin(); pos != ArrayData::invalid_index; + pos = _argv->iter_advance(pos)) { + Variant tmp = _argv->getValue(pos); + if (more(tmp, ret)) { + ret = tmp; + } + } + } + } + return ret; +} + +Variant f_abs(CVarRef number) { + if (number.is(KindOfDouble)) { + return fabs(number.toDouble()); + } + int64 ret = number.toInt64(); + return ret >= 0 ? ret : -ret; +} + +double f_round(CVarRef val, int64 precision /* = 0 */) { + if (val.isInteger() && precision >= 0) { + return val.toInt64(); + } + double ret = val.toDouble(); + PHP_ROUND_WITH_FUZZ(ret, precision); + return ret; +} + +Numeric f_pow(CVarRef base, CVarRef exp) { + if (base.isInteger() && exp.isInteger()) { + int64 i = exp.toInt64(); + if (i == 0) return 1LL; + int64 l2 = base.toInt64(); + if (l2 == 0) return 0LL; + + // calculate pow(long,long) in O(log exp) operations, bail if overflow + int64 l1 = 1; + while (i >= 1) { + int overflow; + double dval = 0.0; + if (i % 2) { + --i; + ZEND_SIGNED_MULTIPLY_LONG(l1, l2, l1, dval, overflow); + if (overflow) return dval * pow(l2, i); + } else { + i /= 2; + ZEND_SIGNED_MULTIPLY_LONG(l2, l2, l2, dval, overflow); + if (overflow) return (double)l1 * pow(dval,i); + } + if (i == 0) { + return l1; + } + } + } + return pow(base.toDouble(), exp.toDouble()); +} + +/////////////////////////////////////////////////////////////////////////////// + +void f_srand(CVarRef seed /* = null_variant */) { + if (seed.isNull()) { + return srand(GENERATE_SEED()); + } + return srand(seed.toInt32()); +} + +int64 f_rand(int64 min /* = 0 */, int64 max /* = RAND_MAX */) { + int number = rand(); + if (min != 0 || max != RAND_MAX) { + RAND_RANGE(number, min, max, RAND_MAX); + } + return number; +} + +void f_mt_srand(CVarRef seed /* = null_variant */) { + if (seed.isNull()) { + return srand(GENERATE_SEED()); + } + return srand(seed.toInt32()); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_math.h b/src/cpp/ext/ext_math.h new file mode 100644 index 0000000000000..a902ee7ae7056 --- /dev/null +++ b/src/cpp/ext/ext_math.h @@ -0,0 +1,110 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_MATH_H__ +#define __EXT_MATH_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +inline double f_pi() { return k_M_PI;} + +Variant f_min(int _argc, CVarRef value, CArrRef _argv = null_array); +Variant f_max(int _argc, CVarRef value, CArrRef _argv = null_array); +Variant f_abs(CVarRef number); + +inline bool f_is_finite(double val) { return finite(val);} +inline bool f_is_infinite(double val) { return isinf(val);} +inline bool f_is_nan(double val) { return isnan(val);} + +inline double f_ceil(double value) { return ceil(value);} +inline double f_floor(double value) { return floor(value);} +double f_round(CVarRef val, int64 precision = 0); + +inline double f_deg2rad(double number) { return number / 180.0 * k_M_PI;} +inline double f_rad2deg(double number) { return number / k_M_PI * 180.0;} + +// departure from PHP: not using "double" for these conversions +inline String f_decbin(int64 number) { + return String(string_long_to_base(number, 2), AttachString); +} +inline String f_dechex(int64 number) { + return String(string_long_to_base(number, 16), AttachString); +} +inline String f_decoct(int64 number) { + return String(string_long_to_base(number, 8), AttachString); +} +inline Variant f_bindec(CStrRef binary_string) { + return string_base_to_numeric(binary_string.data(), binary_string.size(), 2); +} +inline Variant f_hexdec(CStrRef hex_string) { + return string_base_to_numeric(hex_string.data(), hex_string.size(), 16); +} +inline Variant f_octdec(CStrRef octal_string) { + return string_base_to_numeric(octal_string.data(), octal_string.size(), 8); +} +inline String f_base_convert(CStrRef number, int64 frombase, int64 tobase) { + Variant v = string_base_to_numeric(number.data(), number.size(), frombase); + return String(string_numeric_to_base(v, tobase), AttachString); +} + +Numeric f_pow(CVarRef base, CVarRef exp); +inline double f_exp(double arg) { return exp(arg);} +inline double f_expm1(double arg) { return expm1(arg);} +inline double f_log10(double arg) { return log10(arg);} +inline double f_log1p(double number) { return log1p(number);} +inline double f_log(double arg, double base = 0) { + return base <= 0 ? log(arg) : log(arg)/log(base); +} + +inline double f_cos(double arg) { return cos(arg); } +inline double f_cosh(double arg) { return cosh(arg); } +inline double f_sin(double arg) { return sin(arg); } +inline double f_sinh(double arg) { return sinh(arg); } +inline double f_tan(double arg) { return tan(arg); } +inline double f_tanh(double arg) { return tanh(arg); } +inline double f_acos(double arg) { return acos(arg); } +inline double f_acosh(double arg) { return acosh(arg);} +inline double f_asin(double arg) { return asin(arg); } +inline double f_asinh(double arg) { return asinh(arg);} +inline double f_atan(double arg) { return atan(arg); } +inline double f_atanh(double arg) { return atanh(arg);} +inline double f_atan2(double y, double x) { return atan2(y, x);} + +inline double f_hypot(double x, double y) { return hypot(x, y);} +inline double f_fmod(double x, double y) { return fmod(x, y);} +inline double f_sqrt(double arg) { return sqrt(arg);} + +inline int64 f_getrandmax() { return RAND_MAX;} +void f_srand(CVarRef seed = null_variant); +int64 f_rand(int64 min = 0, int64 max = RAND_MAX); +inline int64 f_mt_getrandmax() { return MT_RAND_MAX;} +void f_mt_srand(CVarRef seed = null_variant); +inline int64 f_mt_rand(int64 min = 0, int64 max = RAND_MAX) { + return math_mt_rand(min, max); +} +inline double f_lcg_value() { return math_combined_lcg();} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_MATH_H__ diff --git a/src/cpp/ext/ext_mb.cpp b/src/cpp/ext/ext_mb.cpp new file mode 100644 index 0000000000000..583dbe5b6ed8d --- /dev/null +++ b/src/cpp/ext/ext_mb.cpp @@ -0,0 +1,4120 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +#include +} + +#define php_mb_re_pattern_buffer re_pattern_buffer +#define php_mb_regex_t regex_t +#define php_mb_re_registers re_registers + +extern void mbfl_memory_device_unput(mbfl_memory_device *device); + +#define PARSE_POST 0 +#define PARSE_GET 1 +#define PARSE_COOKIE 2 +#define PARSE_STRING 3 +#define PARSE_ENV 4 +#define PARSE_SERVER 5 +#define PARSE_SESSION 6 + +#define PHP_OUTPUT_HANDLER_START (1<<0) +#define PHP_OUTPUT_HANDLER_CONT (1<<1) +#define PHP_OUTPUT_HANDLER_END (1<<2) + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// statics + +#define PHP_MBSTR_STACK_BLOCK_SIZE 32 + +typedef struct _php_mb_nls_ident_list { + mbfl_no_language lang; + mbfl_no_encoding* list; + int list_size; +} php_mb_nls_ident_list; + +static mbfl_no_encoding php_mb_default_identify_list_ja[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_jis, + mbfl_no_encoding_utf8, + mbfl_no_encoding_euc_jp, + mbfl_no_encoding_sjis +}; + +static mbfl_no_encoding php_mb_default_identify_list_cn[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_utf8, + mbfl_no_encoding_euc_cn, + mbfl_no_encoding_cp936 +}; + +static mbfl_no_encoding php_mb_default_identify_list_tw_hk[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_utf8, + mbfl_no_encoding_euc_tw, + mbfl_no_encoding_big5 +}; + +static mbfl_no_encoding php_mb_default_identify_list_kr[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_utf8, + mbfl_no_encoding_euc_kr, + mbfl_no_encoding_uhc +}; + +static mbfl_no_encoding php_mb_default_identify_list_ru[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_utf8, + mbfl_no_encoding_koi8r, + mbfl_no_encoding_cp1251, + mbfl_no_encoding_cp866 +}; + +static mbfl_no_encoding php_mb_default_identify_list_hy[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_utf8, + mbfl_no_encoding_armscii8 +}; + +static mbfl_no_encoding php_mb_default_identify_list_tr[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_utf8, + mbfl_no_encoding_8859_9 +}; + +static mbfl_no_encoding php_mb_default_identify_list_neut[] = { + mbfl_no_encoding_ascii, + mbfl_no_encoding_utf8 +}; + +static php_mb_nls_ident_list php_mb_default_identify_list[] = { + { mbfl_no_language_japanese, php_mb_default_identify_list_ja, + sizeof(php_mb_default_identify_list_ja) / + sizeof(php_mb_default_identify_list_ja[0]) }, + { mbfl_no_language_korean, php_mb_default_identify_list_kr, + sizeof(php_mb_default_identify_list_kr) / + sizeof(php_mb_default_identify_list_kr[0]) }, + { mbfl_no_language_traditional_chinese, php_mb_default_identify_list_tw_hk, + sizeof(php_mb_default_identify_list_tw_hk) / + sizeof(php_mb_default_identify_list_tw_hk[0]) }, + { mbfl_no_language_simplified_chinese, php_mb_default_identify_list_cn, + sizeof(php_mb_default_identify_list_cn) / + sizeof(php_mb_default_identify_list_cn[0]) }, + { mbfl_no_language_russian, php_mb_default_identify_list_ru, + sizeof(php_mb_default_identify_list_ru) / + sizeof(php_mb_default_identify_list_ru[0]) }, + { mbfl_no_language_armenian, php_mb_default_identify_list_hy, + sizeof(php_mb_default_identify_list_hy) / + sizeof(php_mb_default_identify_list_hy[0]) }, + { mbfl_no_language_turkish, php_mb_default_identify_list_tr, + sizeof(php_mb_default_identify_list_tr) / + sizeof(php_mb_default_identify_list_tr[0]) }, + { mbfl_no_language_neutral, php_mb_default_identify_list_neut, + sizeof(php_mb_default_identify_list_neut) / + sizeof(php_mb_default_identify_list_neut[0]) } +}; + +/////////////////////////////////////////////////////////////////////////////// +// globals +typedef std::map RegexCache; + +class MBGlobals : public RequestEventHandler { +public: + mbfl_no_language language; + mbfl_no_language current_language; + mbfl_no_encoding internal_encoding; + mbfl_no_encoding current_internal_encoding; + mbfl_no_encoding http_output_encoding; + mbfl_no_encoding current_http_output_encoding; + mbfl_no_encoding http_input_identify; + mbfl_no_encoding http_input_identify_get; + mbfl_no_encoding http_input_identify_post; + mbfl_no_encoding http_input_identify_cookie; + mbfl_no_encoding http_input_identify_string; + mbfl_no_encoding *http_input_list; + int http_input_list_size; + mbfl_no_encoding *detect_order_list; + int detect_order_list_size; + mbfl_no_encoding *current_detect_order_list; + int current_detect_order_list_size; + mbfl_no_encoding *default_detect_order_list; + int default_detect_order_list_size; + int filter_illegal_mode; + int filter_illegal_substchar; + int current_filter_illegal_mode; + int current_filter_illegal_substchar; + bool encoding_translation; + long strict_detection; + long illegalchars; + mbfl_buffer_converter *outconv; + + OnigEncoding default_mbctype; + OnigEncoding current_mbctype; + RegexCache ht_rc; + std::string search_str; + unsigned int search_pos; + php_mb_regex_t *search_re; + OnigRegion *search_regs; + OnigOptionType regex_default_options; + OnigSyntaxType *regex_default_syntax; + + MBGlobals() : + language(mbfl_no_language_uni), + current_language(mbfl_no_language_uni), + internal_encoding(mbfl_no_encoding_utf8), + current_internal_encoding(mbfl_no_encoding_utf8), + http_output_encoding(mbfl_no_encoding_pass), + current_http_output_encoding(mbfl_no_encoding_pass), + http_input_identify(mbfl_no_encoding_invalid), + http_input_identify_get(mbfl_no_encoding_invalid), + http_input_identify_post(mbfl_no_encoding_invalid), + http_input_identify_cookie(mbfl_no_encoding_invalid), + http_input_identify_string(mbfl_no_encoding_invalid), + http_input_list(NULL), + http_input_list_size(0), + detect_order_list(NULL), + detect_order_list_size(0), + current_detect_order_list(NULL), + current_detect_order_list_size(0), + default_detect_order_list + ((mbfl_no_encoding *)php_mb_default_identify_list_neut), + default_detect_order_list_size + (sizeof(php_mb_default_identify_list_neut) / + sizeof(php_mb_default_identify_list_neut[0])), + filter_illegal_mode(MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR), + filter_illegal_substchar(0x3f), /* '?' */ + current_filter_illegal_mode(MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR), + current_filter_illegal_substchar(0x3f), /* '?' */ + encoding_translation(0), + strict_detection(0), + illegalchars(0), + outconv(NULL), + default_mbctype(ONIG_ENCODING_EUC_JP), + current_mbctype(ONIG_ENCODING_EUC_JP), + search_pos(0), + search_re((php_mb_regex_t*)NULL), + search_regs((OnigRegion*)NULL), + regex_default_options(ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE), + regex_default_syntax(ONIG_SYNTAX_RUBY) { + } + + virtual void requestInit() { + current_language = language; + current_internal_encoding = internal_encoding; + current_http_output_encoding = http_output_encoding; + current_filter_illegal_mode = filter_illegal_mode; + current_filter_illegal_substchar = filter_illegal_substchar; + if (!encoding_translation) { + illegalchars = 0; + } + + mbfl_no_encoding *list=NULL, *entry; + int n = 0; + if (detect_order_list) { + list = detect_order_list; + n = detect_order_list_size; + } + if (n <= 0) { + list = default_detect_order_list; + n = default_detect_order_list_size; + } + entry = (mbfl_no_encoding *)malloc(n * sizeof(int)); + current_detect_order_list = entry; + current_detect_order_list_size = n; + while (n > 0) { + *entry++ = *list++; + n--; + } + } + + virtual void requestShutdown() { + if (current_detect_order_list != NULL) { + free(current_detect_order_list); + current_detect_order_list = NULL; + current_detect_order_list_size = 0; + } + if (outconv != NULL) { + illegalchars += mbfl_buffer_illegalchars(outconv); + mbfl_buffer_converter_delete(outconv); + outconv = NULL; + } + + /* clear http input identification. */ + http_input_identify = mbfl_no_encoding_invalid; + http_input_identify_post = mbfl_no_encoding_invalid; + http_input_identify_get = mbfl_no_encoding_invalid; + http_input_identify_cookie = mbfl_no_encoding_invalid; + http_input_identify_string = mbfl_no_encoding_invalid; + + current_mbctype = default_mbctype; + + search_str.clear(); + search_pos = 0; + + if (search_regs != NULL) { + onig_region_free(search_regs, 1); + search_regs = (OnigRegion *)NULL; + } + for (RegexCache::const_iterator it = ht_rc.begin(); it != ht_rc.end(); + ++it) { + onig_free(it->second); + } + ht_rc.clear(); + } +}; +static RequestLocal s_mb_globals; +#define MBSTRG(name) s_mb_globals->name + +/////////////////////////////////////////////////////////////////////////////// +// unicode functions + +/* + * A simple array of 32-bit masks for lookup. + */ +static unsigned long masks32[32] = { + 0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020, + 0x00000040, 0x00000080, 0x00000100, 0x00000200, 0x00000400, 0x00000800, + 0x00001000, 0x00002000, 0x00004000, 0x00008000, 0x00010000, 0x00020000, + 0x00040000, 0x00080000, 0x00100000, 0x00200000, 0x00400000, 0x00800000, + 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, 0x20000000, + 0x40000000, 0x80000000 +}; + +static int prop_lookup(unsigned long code, unsigned long n) { + long l, r, m; + + /* + * There is an extra node on the end of the offsets to allow this routine + * to work right. If the index is 0xffff, then there are no nodes for the + * property. + */ + if ((l = _ucprop_offsets[n]) == 0xffff) + return 0; + + /* + * Locate the next offset that is not 0xffff. The sentinel at the end of + * the array is the max index value. + */ + for (m = 1; n + m < _ucprop_size && _ucprop_offsets[n + m] == 0xffff; m++) + ; + + r = _ucprop_offsets[n + m] - 1; + + while (l <= r) { + /* + * Determine a "mid" point and adjust to make sure the mid point is at + * the beginning of a range pair. + */ + m = (l + r) >> 1; + m -= (m & 1); + if (code > _ucprop_ranges[m + 1]) + l = m + 2; + else if (code < _ucprop_ranges[m]) + r = m - 2; + else if (code >= _ucprop_ranges[m] && code <= _ucprop_ranges[m + 1]) + return 1; + } + return 0; + +} + +static int php_unicode_is_prop(unsigned long code, unsigned long mask1, + unsigned long mask2) { + unsigned long i; + + if (mask1 == 0 && mask2 == 0) + return 0; + + for (i = 0; mask1 && i < 32; i++) { + if ((mask1 & masks32[i]) && prop_lookup(code, i)) + return 1; + } + + for (i = 32; mask2 && i < _ucprop_size; i++) { + if ((mask2 & masks32[i & 31]) && prop_lookup(code, i)) + return 1; + } + + return 0; +} + +static unsigned long case_lookup(unsigned long code, long l, long r, + int field) { + long m; + + /* + * Do the binary search. + */ + while (l <= r) { + /* + * Determine a "mid" point and adjust to make sure the mid point is at + * the beginning of a case mapping triple. + */ + m = (l + r) >> 1; + m -= (m % 3); + if (code > _uccase_map[m]) + l = m + 3; + else if (code < _uccase_map[m]) + r = m - 3; + else if (code == _uccase_map[m]) + return _uccase_map[m + field]; + } + + return code; +} + +static unsigned long php_turkish_toupper(unsigned long code, long l, long r, + int field) { + if (code == 0x0069L) { + return 0x0130L; + } + return case_lookup(code, l, r, field); +} + +static unsigned long php_turkish_tolower(unsigned long code, long l, long r, + int field) { + if (code == 0x0049L) { + return 0x0131L; + } + return case_lookup(code, l, r, field); +} + +static unsigned long php_unicode_toupper(unsigned long code, + enum mbfl_no_encoding enc) { + int field; + long l, r; + + if (php_unicode_is_upper(code)) + return code; + + if (php_unicode_is_lower(code)) { + /* + * The character is lower case. + */ + field = 2; + l = _uccase_len[0]; + r = (l + _uccase_len[1]) - 3; + + if (enc == mbfl_no_encoding_8859_9) { + return php_turkish_toupper(code, l, r, field); + } + + } else { + /* + * The character is title case. + */ + field = 1; + l = _uccase_len[0] + _uccase_len[1]; + r = _uccase_size - 3; + } + return case_lookup(code, l, r, field); +} + +static unsigned long php_unicode_tolower(unsigned long code, + enum mbfl_no_encoding enc) { + int field; + long l, r; + + if (php_unicode_is_lower(code)) + return code; + + if (php_unicode_is_upper(code)) { + /* + * The character is upper case. + */ + field = 1; + l = 0; + r = _uccase_len[0] - 3; + + if (enc == mbfl_no_encoding_8859_9) { + return php_turkish_tolower(code, l, r, field); + } + + } else { + /* + * The character is title case. + */ + field = 2; + l = _uccase_len[0] + _uccase_len[1]; + r = _uccase_size - 3; + } + return case_lookup(code, l, r, field); +} + +static unsigned long php_unicode_totitle(unsigned long code, + enum mbfl_no_encoding enc) { + int field; + long l, r; + + if (php_unicode_is_title(code)) + return code; + + /* + * The offset will always be the same for converting to title case. + */ + field = 2; + + if (php_unicode_is_upper(code)) { + /* + * The character is upper case. + */ + l = 0; + r = _uccase_len[0] - 3; + } else { + /* + * The character is lower case. + */ + l = _uccase_len[0]; + r = (l + _uccase_len[1]) - 3; + } + return case_lookup(code, l, r, field); + +} + +#define BE_ARY_TO_UINT32(ptr) (\ + ((unsigned char*)(ptr))[0]<<24 |\ + ((unsigned char*)(ptr))[1]<<16 |\ + ((unsigned char*)(ptr))[2]<< 8 |\ + ((unsigned char*)(ptr))[3] ) + +#define UINT32_TO_BE_ARY(ptr,val) { \ + unsigned int v = val; \ + ((unsigned char*)(ptr))[0] = (v>>24) & 0xff,\ + ((unsigned char*)(ptr))[1] = (v>>16) & 0xff,\ + ((unsigned char*)(ptr))[2] = (v>> 8) & 0xff,\ + ((unsigned char*)(ptr))[3] = (v ) & 0xff;\ +} + +/** + * Return 0 if input contains any illegal encoding, otherwise 1. + * Even if any illegal encoding is detected the result may contain a list + * of parsed encodings. + */ +static int php_mb_parse_encoding_list(const char *value, int value_length, + mbfl_no_encoding **return_list, + int *return_size, int persistent) { + int n, l, size, bauto, ret = 1; + char *p, *p1, *p2, *endp, *tmpstr; + mbfl_no_encoding no_encoding; + mbfl_no_encoding *src, *entry, *list; + + list = NULL; + if (value == NULL || value_length <= 0) { + if (return_list) { + *return_list = NULL; + } + if (return_size) { + *return_size = 0; + } + return 0; + } else { + mbfl_no_encoding *identify_list; + int identify_list_size; + + identify_list = MBSTRG(default_detect_order_list); + identify_list_size = MBSTRG(default_detect_order_list_size); + + /* copy the value string for work */ + if (value[0]=='"' && value[value_length-1]=='"' && value_length>2) { + tmpstr = (char *)strndup(value+1, value_length-2); + value_length -= 2; + } + else + tmpstr = (char *)strndup(value, value_length); + if (tmpstr == NULL) { + return 0; + } + /* count the number of listed encoding names */ + endp = tmpstr + value_length; + n = 1; + p1 = tmpstr; + while ((p2 = (char*)string_memnstr(p1, ",", 1, endp)) != NULL) { + p1 = p2 + 1; + n++; + } + size = n + identify_list_size; + /* make list */ + list = (mbfl_no_encoding *)calloc(size, sizeof(int)); + if (list != NULL) { + entry = list; + n = 0; + bauto = 0; + p1 = tmpstr; + do { + p2 = p = (char*)string_memnstr(p1, ",", 1, endp); + if (p == NULL) { + p = endp; + } + *p = '\0'; + /* trim spaces */ + while (p1 < p && (*p1 == ' ' || *p1 == '\t')) { + p1++; + } + p--; + while (p > p1 && (*p == ' ' || *p == '\t')) { + *p = '\0'; + p--; + } + /* convert to the encoding number and check encoding */ + if (strcasecmp(p1, "auto") == 0) { + if (!bauto) { + bauto = 1; + l = identify_list_size; + src = identify_list; + while (l > 0) { + *entry++ = *src++; + l--; + n++; + } + } + } else { + no_encoding = mbfl_name2no_encoding(p1); + if (no_encoding != mbfl_no_encoding_invalid) { + *entry++ = no_encoding; + n++; + } else { + ret = 0; + } + } + p1 = p2 + 1; + } while (n < size && p2 != NULL); + if (n > 0) { + if (return_list) { + *return_list = list; + } else { + free(list); + } + } else { + free(list); + if (return_list) { + *return_list = NULL; + } + ret = 0; + } + if (return_size) { + *return_size = n; + } + } else { + if (return_list) { + *return_list = NULL; + } + if (return_size) { + *return_size = 0; + } + ret = 0; + } + free(tmpstr); + } + + return ret; +} + +static char *php_mb_convert_encoding(const char *input, size_t length, + const char *_to_encoding, + const char *_from_encodings, + unsigned int *output_len) { + mbfl_string string, result, *ret; + mbfl_no_encoding from_encoding, to_encoding; + mbfl_buffer_converter *convd; + int size; + mbfl_no_encoding *list; + char *output = NULL; + + if (output_len) { + *output_len = 0; + } + if (!input) { + return NULL; + } + /* new encoding */ + if (_to_encoding && strlen(_to_encoding)) { + to_encoding = mbfl_name2no_encoding(_to_encoding); + if (to_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", _to_encoding); + return NULL; + } + } else { + to_encoding = MBSTRG(current_internal_encoding); + } + + /* initialize string */ + mbfl_string_init(&string); + mbfl_string_init(&result); + from_encoding = MBSTRG(current_internal_encoding); + string.no_encoding = from_encoding; + string.no_language = MBSTRG(current_language); + string.val = (unsigned char *)input; + string.len = length; + + /* pre-conversion encoding */ + if (_from_encodings) { + list = NULL; + size = 0; + php_mb_parse_encoding_list(_from_encodings, strlen(_from_encodings), + &list, &size, 0); + if (size == 1) { + from_encoding = *list; + string.no_encoding = from_encoding; + } else if (size > 1) { + /* auto detect */ + from_encoding = mbfl_identify_encoding_no(&string, list, size, + MBSTRG(strict_detection)); + if (from_encoding != mbfl_no_encoding_invalid) { + string.no_encoding = from_encoding; + } else { + Logger::Warning("Unable to detect character encoding"); + from_encoding = mbfl_no_encoding_pass; + to_encoding = from_encoding; + string.no_encoding = from_encoding; + } + } else { + Logger::Warning("Illegal character encoding specified"); + } + if (list != NULL) { + free((void *)list); + } + } + + /* initialize converter */ + convd = mbfl_buffer_converter_new(from_encoding, to_encoding, string.len); + if (convd == NULL) { + Logger::Warning("Unable to create character encoding converter"); + return NULL; + } + mbfl_buffer_converter_illegal_mode + (convd, MBSTRG(current_filter_illegal_mode)); + mbfl_buffer_converter_illegal_substchar + (convd, MBSTRG(current_filter_illegal_substchar)); + + /* do it */ + ret = mbfl_buffer_converter_feed_result(convd, &string, &result); + if (ret) { + if (output_len) { + *output_len = ret->len; + } + output = (char *)ret->val; + } + + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); + mbfl_buffer_converter_delete(convd); + return output; +} + +static char *php_unicode_convert_case(int case_mode, const char *srcstr, + size_t srclen, unsigned int *ret_len, + const char *src_encoding) { + char *unicode, *newstr; + unsigned int unicode_len; + unsigned char *unicode_ptr; + size_t i; + enum mbfl_no_encoding _src_encoding = mbfl_name2no_encoding(src_encoding); + + unicode = php_mb_convert_encoding(srcstr, srclen, "UCS-4BE", src_encoding, + &unicode_len); + if (unicode == NULL) + return NULL; + + unicode_ptr = (unsigned char *)unicode; + + switch(case_mode) { + case PHP_UNICODE_CASE_UPPER: + for (i = 0; i < unicode_len; i+=4) { + UINT32_TO_BE_ARY(&unicode_ptr[i], + php_unicode_toupper(BE_ARY_TO_UINT32(&unicode_ptr[i]), + _src_encoding)); + } + break; + + case PHP_UNICODE_CASE_LOWER: + for (i = 0; i < unicode_len; i+=4) { + UINT32_TO_BE_ARY(&unicode_ptr[i], + php_unicode_tolower(BE_ARY_TO_UINT32(&unicode_ptr[i]), + _src_encoding)); + } + break; + + case PHP_UNICODE_CASE_TITLE: + { + int mode = 0; + + for (i = 0; i < unicode_len; i+=4) { + int res = php_unicode_is_prop + (BE_ARY_TO_UINT32(&unicode_ptr[i]), + UC_MN|UC_ME|UC_CF|UC_LM|UC_SK|UC_LU|UC_LL|UC_LT, 0); + if (mode) { + if (res) { + UINT32_TO_BE_ARY + (&unicode_ptr[i], + php_unicode_tolower(BE_ARY_TO_UINT32(&unicode_ptr[i]), + _src_encoding)); + } else { + mode = 0; + } + } else { + if (res) { + mode = 1; + UINT32_TO_BE_ARY + (&unicode_ptr[i], + php_unicode_totitle(BE_ARY_TO_UINT32(&unicode_ptr[i]), + _src_encoding)); + } + } + } + } + break; + } + + newstr = php_mb_convert_encoding(unicode, unicode_len, src_encoding, + "UCS-4BE", ret_len); + free(unicode); + return newstr; +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +/** + * Return 0 if input contains any illegal encoding, otherwise 1. + * Even if any illegal encoding is detected the result may contain a list + * of parsed encodings. + */ +static int php_mb_parse_encoding_array(CArrRef array, + mbfl_no_encoding **return_list, + int *return_size, int persistent) { + int n, l, size, bauto,ret = 1; + mbfl_no_encoding no_encoding; + mbfl_no_encoding *src, *list, *entry; + + list = NULL; + mbfl_no_encoding *identify_list = MBSTRG(default_detect_order_list); + int identify_list_size = MBSTRG(default_detect_order_list_size); + + size = array.size() + identify_list_size; + list = (mbfl_no_encoding *)calloc(size, sizeof(int)); + if (list != NULL) { + entry = list; + bauto = 0; + n = 0; + for (ArrayIter iter(array); iter; ++iter) { + String hash_entry = iter.second(); + if (strcasecmp(hash_entry.data(), "auto") == 0) { + if (!bauto) { + bauto = 1; + l = identify_list_size; + src = identify_list; + while (l > 0) { + *entry++ = *src++; + l--; + n++; + } + } + } else { + no_encoding = mbfl_name2no_encoding(hash_entry.data()); + if (no_encoding != mbfl_no_encoding_invalid) { + *entry++ = no_encoding; + n++; + } else { + ret = 0; + } + } + } + if (n > 0) { + if (return_list) { + *return_list = list; + } else { + free(list); + } + } else { + free(list); + if (return_list) { + *return_list = NULL; + } + ret = 0; + } + if (return_size) { + *return_size = n; + } + } else { + if (return_list) { + *return_list = NULL; + } + if (return_size) { + *return_size = 0; + } + ret = 0; + } + return ret; +} + +static bool php_mb_parse_encoding(CVarRef encoding, + mbfl_no_encoding **return_list, + int *return_size, bool persistent) { + bool ret; + if (encoding.is(KindOfArray)) { + ret = php_mb_parse_encoding_array(encoding.toArray(), + return_list, return_size, + persistent ? 1 : 0); + } else { + String enc = encoding.toString(); + ret = php_mb_parse_encoding_list(enc.data(), enc.size(), + return_list, return_size, + persistent ? 1 : 0); + } + if (!ret) { + if (return_list && *return_list) { + free(*return_list); + *return_list = NULL; + } + return_size = 0; + } + return ret; +} + +static int php_mb_nls_get_default_detect_order_list(mbfl_no_language lang, + mbfl_no_encoding **plist, + int* plist_size) { + size_t i; + *plist = (mbfl_no_encoding *) php_mb_default_identify_list_neut; + *plist_size = sizeof(php_mb_default_identify_list_neut) / + sizeof(php_mb_default_identify_list_neut[0]); + + for (i = 0; i < sizeof(php_mb_default_identify_list) / + sizeof(php_mb_default_identify_list[0]); i++) { + if (php_mb_default_identify_list[i].lang == lang) { + *plist = php_mb_default_identify_list[i].list; + *plist_size = php_mb_default_identify_list[i].list_size; + return 1; + } + } + return 0; +} + +static size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc) { + if (enc != NULL) { + if (enc->flag & MBFL_ENCTYPE_MBCS) { + if (enc->mblen_table != NULL) { + if (s != NULL) return enc->mblen_table[*(unsigned char *)s]; + } + } else if (enc->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) { + return 2; + } else if (enc->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) { + return 4; + } + } + return 1; +} + +static int php_mb_stripos(int mode, + const char *old_haystack, int old_haystack_len, + const char *old_needle, int old_needle_len, + long offset, const char *from_encoding) { + int n; + mbfl_string haystack, needle; + n = -1; + + mbfl_string_init(&haystack); + mbfl_string_init(&needle); + haystack.no_language = MBSTRG(current_language); + haystack.no_encoding = MBSTRG(current_internal_encoding); + needle.no_language = MBSTRG(current_language); + needle.no_encoding = MBSTRG(current_internal_encoding); + + do { + haystack.val = (unsigned char *)php_unicode_convert_case + (PHP_UNICODE_CASE_UPPER, old_haystack, (size_t)old_haystack_len, + &haystack.len, from_encoding); + if (!haystack.val) { + break; + } + if (haystack.len <= 0) { + break; + } + + needle.val = (unsigned char *)php_unicode_convert_case + (PHP_UNICODE_CASE_UPPER, old_needle, (size_t)old_needle_len, + &needle.len, from_encoding); + if (!needle.val) { + break; + } + if (needle.len <= 0) { + break; + } + + haystack.no_encoding = needle.no_encoding = + mbfl_name2no_encoding(from_encoding); + if (haystack.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", from_encoding); + break; + } + + if (offset < 0 || (unsigned long)offset > haystack.len) { + Logger::Warning("Offset not contained in string."); + break; + } + + n = mbfl_strpos(&haystack, &needle, offset, mode); + } while(0); + + if (haystack.val) { + free(haystack.val); + } + if (needle.val) { + free(needle.val); + } + return n; +} + +/////////////////////////////////////////////////////////////////////////////// + +Array f_mb_list_encodings() { + Array ret; + int i = 0; + const mbfl_encoding **encodings = mbfl_get_supported_encodings(); + const mbfl_encoding *encoding; + while ((encoding = encodings[i++]) != NULL) { + ret.append(String(encoding->name, CopyString)); + } + return ret; +} + +Variant f_mb_list_encodings_alias_names(CStrRef name /* = null_string */) { + const mbfl_encoding **encodings; + const mbfl_encoding *encoding; + mbfl_no_encoding no_encoding; + int i, j; + + Array ret; + if (name.isNull()) { + i = 0; + encodings = mbfl_get_supported_encodings(); + while ((encoding = encodings[i++]) != NULL) { + Array row; + if (encoding->aliases != NULL) { + j = 0; + while ((*encoding->aliases)[j] != NULL) { + row.append(String((*encoding->aliases)[j], CopyString)); + j++; + } + } + ret.set(String(encoding->name, CopyString), row); + } + } else { + no_encoding = mbfl_name2no_encoding(name.data()); + if (no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", name.data()); + return false; + } + + char *name = (char *)mbfl_no_encoding2name(no_encoding); + if (name != NULL) { + i = 0; + encodings = mbfl_get_supported_encodings(); + while ((encoding = encodings[i++]) != NULL) { + if (strcmp(encoding->name, name) != 0) continue; + + if (encoding->aliases != NULL) { + j = 0; + while ((*encoding->aliases)[j] != NULL) { + ret.append(String((*encoding->aliases)[j], CopyString)); + j++; + } + } + + break; + } + } else { + return false; + } + } + return ret; +} + +Variant f_mb_list_mime_names(CStrRef name /* = null_string */) { + const mbfl_encoding **encodings; + const mbfl_encoding *encoding; + mbfl_no_encoding no_encoding; + int i; + + Array ret; + if (name.isNull()) { + i = 0; + encodings = mbfl_get_supported_encodings(); + while ((encoding = encodings[i++]) != NULL) { + if (encoding->mime_name != NULL) { + ret.set(String(encoding->name, CopyString), + String(encoding->mime_name, CopyString)); + } else{ + ret.set(String(encoding->name, CopyString), ""); + } + } + } else { + no_encoding = mbfl_name2no_encoding(name.data()); + if (no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", name.data()); + return false; + } + + char *name = (char *)mbfl_no_encoding2name(no_encoding); + if (name != NULL) { + i = 0; + encodings = mbfl_get_supported_encodings(); + while ((encoding = encodings[i++]) != NULL) { + if (strcmp(encoding->name, name) != 0) continue; + if (encoding->mime_name != NULL) { + return String(encoding->mime_name, CopyString); + } + break; + } + return ""; + } else { + return false; + } + } + return ret; +} + +bool f_mb_check_encoding(CStrRef var /* = null_string */, + CStrRef encoding /* = null_string */) { + mbfl_buffer_converter *convd; + mbfl_no_encoding no_encoding = MBSTRG(current_internal_encoding); + mbfl_string string, result, *ret = NULL; + long illegalchars = 0; + + if (var.isNull()) { + return MBSTRG(illegalchars) == 0; + } + + if (!encoding.isNull()) { + no_encoding = mbfl_name2no_encoding(encoding.data()); + if (no_encoding == mbfl_no_encoding_invalid || + no_encoding == mbfl_no_encoding_pass) { + Logger::Warning("Invalid encoding \"%s\"", encoding.data()); + return false; + } + } + + convd = mbfl_buffer_converter_new(no_encoding, no_encoding, 0); + if (convd == NULL) { + Logger::Warning("Unable to create converter"); + return false; + } + mbfl_buffer_converter_illegal_mode + (convd, MBSTRG(current_filter_illegal_mode)); + mbfl_buffer_converter_illegal_substchar + (convd, MBSTRG(current_filter_illegal_substchar)); + + /* initialize string */ + mbfl_string_init(&string); + mbfl_string_init(&result); + string.no_encoding = no_encoding; + string.no_language = MBSTRG(current_language); + + string.val = (unsigned char *)var.data(); + string.len = var.size(); + ret = mbfl_buffer_converter_feed_result(convd, &string, &result); + illegalchars = mbfl_buffer_illegalchars(convd); + mbfl_buffer_converter_delete(convd); + + if (ret != NULL) { + MBSTRG(illegalchars) += illegalchars; + if (illegalchars == 0 && + strncmp((const char *)string.val, (const char *)ret->val, + string.len) == 0) { + free(ret->val); + return true; + } else { + free(ret->val); + return false; + } + } else { + return false; + } +} + +Variant f_mb_convert_case(CStrRef str, int mode, + CStrRef encoding /* = null_string */) { + const char *enc = NULL; + if (encoding.empty()) { + enc = mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + } + + unsigned int ret_len; + char *newstr = php_unicode_convert_case(mode, str.data(), str.size(), + &ret_len, enc); + if (newstr) { + return String(newstr, ret_len, AttachString); + } + return false; +} + +Variant f_mb_convert_encoding(CStrRef str, CStrRef to_encoding, + CVarRef from_encoding /* = null_variant */) { + String encoding = from_encoding.toString(); + if (from_encoding.is(KindOfArray)) { + StringBuffer _from_encodings; + Array encs = from_encoding.toArray(); + for (ArrayIter iter(encs); iter; ++iter) { + if (!_from_encodings.empty()) { + _from_encodings.append(","); + } + _from_encodings.append(iter.second().toString()); + } + encoding = _from_encodings.detach(); + } + + unsigned int size; + char *ret = php_mb_convert_encoding(str.data(), str.size(), + to_encoding.data(), encoding.data(), + &size); + if (ret != NULL) { + return String(ret, size, AttachString); + } + return false; +} + +Variant f_mb_convert_kana(CStrRef str, CStrRef option /* = null_string */, + CStrRef encoding /* = null_string */) { + mbfl_string string, result, *ret; + mbfl_string_init(&string); + string.no_language = MBSTRG(current_language); + string.no_encoding = MBSTRG(current_internal_encoding); + string.val = (unsigned char *)str.data(); + + int opt = 0x900; + if (!option.empty()) { + const char *p = option.data(); + int n = option.size(); + int i = 0; + opt = 0; + while (i < n) { + i++; + switch (*p++) { + case 'A': opt |= 0x1; break; + case 'a': opt |= 0x10; break; + case 'R': opt |= 0x2; break; + case 'r': opt |= 0x20; break; + case 'N': opt |= 0x4; break; + case 'n': opt |= 0x40; break; + case 'S': opt |= 0x8; break; + case 's': opt |= 0x80; break; + case 'K': opt |= 0x100; break; + case 'k': opt |= 0x1000; break; + case 'H': opt |= 0x200; break; + case 'h': opt |= 0x2000; break; + case 'V': opt |= 0x800; break; + case 'C': opt |= 0x10000; break; + case 'c': opt |= 0x20000; break; + case 'M': opt |= 0x100000; break; + case 'm': opt |= 0x200000; break; + } + } + } + + /* encoding */ + if (!encoding.empty()) { + string.no_encoding = mbfl_name2no_encoding(encoding.data()); + if (string.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + } + + ret = mbfl_ja_jp_hantozen(&string, &result, opt); + if (ret != NULL) { + return String((const char*)ret->val, ret->len, AttachString); + } + return false; +} + +static bool php_mbfl_encoding_detect(CVarRef var, + mbfl_encoding_detector *identd, + mbfl_string *string) { + if (var.is(KindOfArray) || var.is(KindOfObject)) { + Array items = var.toArray(); + for (ArrayIter iter(items); iter; ++iter) { + if (php_mbfl_encoding_detect(iter.second(), identd, string)) { + return true; + } + } + } else if (var.isString()) { + String svar = var.toString(); + string->val = (unsigned char *)svar.data(); + string->len = svar.size(); + if (mbfl_encoding_detector_feed(identd, string)) { + return true; + } + } + return false; +} + +static Variant php_mbfl_convert(CVarRef var, + mbfl_buffer_converter *convd, + mbfl_string *string, + mbfl_string *result) { + if (var.is(KindOfArray)) { + Array ret; + Array items = var.toArray(); + for (ArrayIter iter(items); iter; ++iter) { + ret.set(iter.first(), + php_mbfl_convert(iter.second(), convd, string, result)); + } + return ret; + } + + if (var.is(KindOfObject)) { + Object obj = var.toObject(); + Array items = var.toArray(); + for (ArrayIter iter(items); iter; ++iter) { + obj->o_set(iter.first().toString(), -1, + php_mbfl_convert(iter.second().toString().data(), convd, + string, result)); + } + return var; // which still has obj + } + + if (var.isString()) { + String svar = var.toString(); + string->val = (unsigned char *)svar.data(); + string->len = svar.size(); + mbfl_string *ret = + mbfl_buffer_converter_feed_result(convd, string, result); + return String((const char*)ret->val, ret->len, AttachString); + } + + return var; +} + +Variant f_mb_convert_variables(int _argc, CStrRef to_encoding, + CVarRef from_encoding, Variant vars, + CArrRef _argv /* = null_array */) { + mbfl_string string, result; + mbfl_no_encoding _from_encoding, _to_encoding; + mbfl_encoding_detector *identd; + mbfl_buffer_converter *convd; + int elistsz; + mbfl_no_encoding *elist; + char *name; + + /* new encoding */ + _to_encoding = mbfl_name2no_encoding(to_encoding.data()); + if (_to_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", to_encoding.data()); + return false; + } + + /* initialize string */ + mbfl_string_init(&string); + mbfl_string_init(&result); + _from_encoding = MBSTRG(current_internal_encoding); + string.no_encoding = _from_encoding; + string.no_language = MBSTRG(current_language); + + /* pre-conversion encoding */ + elist = NULL; + elistsz = 0; + php_mb_parse_encoding(from_encoding, &elist, &elistsz, false); + if (elistsz <= 0) { + _from_encoding = mbfl_no_encoding_pass; + } else if (elistsz == 1) { + _from_encoding = *elist; + } else { + /* auto detect */ + _from_encoding = mbfl_no_encoding_invalid; + identd = mbfl_encoding_detector_new(elist, elistsz, + MBSTRG(strict_detection)); + if (identd != NULL) { + for (int n = -1; n < _argv.size(); n++) { + if (php_mbfl_encoding_detect(n < 0 ? vars : _argv[n], + identd, &string)) { + break; + } + } + _from_encoding = mbfl_encoding_detector_judge(identd); + mbfl_encoding_detector_delete(identd); + } + + if (_from_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unable to detect encoding"); + _from_encoding = mbfl_no_encoding_pass; + } + } + if (elist != NULL) { + free((void *)elist); + } + + /* create converter */ + convd = NULL; + if (_from_encoding != mbfl_no_encoding_pass) { + convd = mbfl_buffer_converter_new(_from_encoding, _to_encoding, 0); + if (convd == NULL) { + Logger::Warning("Unable to create converter"); + return false; + } + mbfl_buffer_converter_illegal_mode + (convd, MBSTRG(current_filter_illegal_mode)); + mbfl_buffer_converter_illegal_substchar + (convd, MBSTRG(current_filter_illegal_substchar)); + } + + /* convert */ + if (convd != NULL) { + vars = php_mbfl_convert(vars, convd, &string, &result); + for (int n = 0; n < _argv.size(); n++) { + lval(((Array&)_argv).lval(n)) = + php_mbfl_convert(_argv[n], convd, &string, &result); + } + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); + mbfl_buffer_converter_delete(convd); + } + + name = (char *)mbfl_no_encoding2name(_from_encoding); + if (name != NULL) { + return String(name, CopyString); + } + return false; +} + +Variant f_mb_decode_mimeheader(CStrRef str) { + mbfl_string string, result, *ret; + + mbfl_string_init(&string); + string.no_language = MBSTRG(current_language); + string.no_encoding = MBSTRG(current_internal_encoding); + string.val = (unsigned char *)str.data(); + string.len = str.size(); + + mbfl_string_init(&result); + ret = mbfl_mime_header_decode(&string, &result, + MBSTRG(current_internal_encoding)); + if (ret != NULL) { + return String((const char*)ret->val, ret->len, AttachString); + } + return false; +} + +static Variant php_mb_numericentity_exec(CStrRef str, CVarRef convmap, + CStrRef encoding, int type) { + int mapsize=0; + mbfl_string string, result, *ret; + mbfl_no_encoding no_encoding; + + mbfl_string_init(&string); + string.no_language = MBSTRG(current_language); + string.no_encoding = MBSTRG(current_internal_encoding); + string.val = (unsigned char *)str.data(); + string.len = str.size(); + + /* encoding */ + if (!encoding.empty()) { + no_encoding = mbfl_name2no_encoding(encoding.data()); + if (no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } else { + string.no_encoding = no_encoding; + } + } + + /* conversion map */ + int *iconvmap = NULL; + if (convmap.is(KindOfArray)) { + Array convs = convmap.toArray(); + mapsize = convs.size(); + if (mapsize > 0) { + iconvmap = (int*)malloc(mapsize * sizeof(int)); + int *mapelm = iconvmap; + for (ArrayIter iter(convs); iter; ++iter) { + *mapelm++ = iter.second().toInt32(); + } + } + } + if (iconvmap == NULL) { + return false; + } + mapsize /= 4; + + ret = mbfl_html_numeric_entity(&string, &result, iconvmap, mapsize, type); + free(iconvmap); + if (ret != NULL) { + return String((const char*)ret->val, ret->len, AttachString); + } + return false; +} + +Variant f_mb_decode_numericentity(CStrRef str, CVarRef convmap, + CStrRef encoding /* = null_string */) { + return php_mb_numericentity_exec(str, convmap, encoding, 1); +} + +Variant f_mb_detect_encoding(CStrRef str, CVarRef encoding_list /* = null_variant */, + CVarRef strict /* = null_variant */) { + mbfl_string string; + const char *ret; + mbfl_no_encoding *elist; + int size; + mbfl_no_encoding *list = 0; + + /* make encoding list */ + list = NULL; + size = 0; + php_mb_parse_encoding(encoding_list, &list, &size, false); + if (size > 0 && list != NULL) { + elist = list; + } else { + elist = MBSTRG(current_detect_order_list); + size = MBSTRG(current_detect_order_list_size); + } + + long nstrict = 0; + if (!strict.isNull()) { + nstrict = strict.toInt64(); + } else { + nstrict = MBSTRG(strict_detection); + } + + mbfl_string_init(&string); + string.no_language = MBSTRG(current_language); + string.val = (unsigned char *)str.data(); + string.len = str.size(); + ret = mbfl_identify_encoding_name(&string, elist, size, nstrict); + if (list != NULL) { + free(list); + } + if (ret != NULL) { + return String(ret, CopyString); + } + return false; +} + +Variant f_mb_detect_order(CVarRef encoding_list /* = null_variant */) { + int n, size; + mbfl_no_encoding *list, *entry; + + if (encoding_list.isNull()) { + Array ret; + entry = MBSTRG(current_detect_order_list); + n = MBSTRG(current_detect_order_list_size); + while (n > 0) { + char *name = (char *)mbfl_no_encoding2name(*entry); + if (name) { + ret.append(String(name, CopyString)); + } + entry++; + n--; + } + return ret; + } + + list = NULL; + size = 0; + if (!php_mb_parse_encoding(encoding_list, &list, &size, false) || + list == NULL) { + return false; + } + if (MBSTRG(current_detect_order_list)) { + free(MBSTRG(current_detect_order_list)); + } + MBSTRG(current_detect_order_list) = list; + MBSTRG(current_detect_order_list_size) = size; + return true; +} + +Variant f_mb_encode_mimeheader(CStrRef str, CStrRef charset /* = null_string */, + CStrRef transfer_encoding /* = null_string */, + CStrRef linefeed /* = "\r\n" */, + int indent /* = 0 */) { + mbfl_no_encoding charsetenc, transenc; + mbfl_string string, result, *ret; + + mbfl_string_init(&string); + string.no_language = MBSTRG(current_language); + string.no_encoding = MBSTRG(current_internal_encoding); + string.val = (unsigned char *)str.data(); + string.len = str.size(); + + charsetenc = mbfl_no_encoding_pass; + transenc = mbfl_no_encoding_base64; + + if (!charset.empty()) { + charsetenc = mbfl_name2no_encoding(charset.data()); + if (charsetenc == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", charset.data()); + return false; + } + } else { + const mbfl_language *lang = mbfl_no2language(MBSTRG(current_language)); + if (lang != NULL) { + charsetenc = lang->mail_charset; + transenc = lang->mail_header_encoding; + } + } + + if (!transfer_encoding.empty()) { + char ch = *transfer_encoding.data(); + if (ch == 'B' || ch == 'b') { + transenc = mbfl_no_encoding_base64; + } else if (ch == 'Q' || ch == 'q') { + transenc = mbfl_no_encoding_qprint; + } + } + + mbfl_string_init(&result); + ret = mbfl_mime_header_encode(&string, &result, charsetenc, transenc, + linefeed.data(), indent); + if (ret != NULL) { + return String((const char*)ret->val, ret->len, AttachString); + } + return false; +} + +Variant f_mb_encode_numericentity(CStrRef str, CVarRef convmap, + CStrRef encoding /* = null_string */) { + return php_mb_numericentity_exec(str, convmap, encoding, 0); +} + +Variant f_mb_get_info(CStrRef type /* = null_string */) { + const mbfl_language *lang = mbfl_no2language(MBSTRG(current_language)); + mbfl_no_encoding *entry; + int n; + + char *name; + if (type.empty() || strcasecmp(type.data(), "all") == 0) { + Array ret; + if ((name = (char *)mbfl_no_encoding2name + (MBSTRG(current_internal_encoding))) != NULL) { + ret.set("internal_encoding", String(name, CopyString)); + } + if ((name = (char *)mbfl_no_encoding2name + (MBSTRG(http_input_identify))) != NULL) { + ret.set("http_input", String(name, CopyString)); + } + if ((name = (char *)mbfl_no_encoding2name + (MBSTRG(current_http_output_encoding))) != NULL) { + ret.set("http_output", String(name, CopyString)); + } + if (lang != NULL) { + if ((name = (char *)mbfl_no_encoding2name + (lang->mail_charset)) != NULL) { + ret.set("mail_charset", String(name, CopyString)); + } + if ((name = (char *)mbfl_no_encoding2name + (lang->mail_header_encoding)) != NULL) { + ret.set("mail_header_encoding", String(name, CopyString)); + } + if ((name = (char *)mbfl_no_encoding2name + (lang->mail_body_encoding)) != NULL) { + ret.set("mail_body_encoding", String(name, CopyString)); + } + } + ret.set("illegal_chars", MBSTRG(illegalchars)); + ret.set("encoding_translation", + MBSTRG(encoding_translation) ? "On" : "Off"); + if ((name = (char *)mbfl_no_language2name + (MBSTRG(current_language))) != NULL) { + ret.set("language", String(name, CopyString)); + } + n = MBSTRG(current_detect_order_list_size); + entry = MBSTRG(current_detect_order_list); + if (n > 0) { + Array row; + while (n > 0) { + if ((name = (char *)mbfl_no_encoding2name(*entry)) != NULL) { + row.append(String(name, CopyString)); + } + entry++; + n--; + } + ret.set("detect_order", row); + } + switch (MBSTRG(current_filter_illegal_mode)) { + case MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE: + ret.set("substitute_character", "none"); + break; + case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG: + ret.set("substitute_character", "long"); + break; + case MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY: + ret.set("substitute_character", "entity"); + break; + default: + ret.set("substitute_character", + MBSTRG(current_filter_illegal_substchar)); + } + ret.set("strict_detection", MBSTRG(strict_detection) ? "On" : "Off"); + return ret; + } else if (strcasecmp(type.data(), "internal_encoding") == 0) { + if ((name = (char *)mbfl_no_encoding2name + (MBSTRG(current_internal_encoding))) != NULL) { + return String(name, CopyString); + } + } else if (strcasecmp(type.data(), "http_input") == 0) { + if ((name = (char *)mbfl_no_encoding2name + (MBSTRG(http_input_identify))) != NULL) { + return String(name, CopyString); + } + } else if (strcasecmp(type.data(), "http_output") == 0) { + if ((name = (char *)mbfl_no_encoding2name + (MBSTRG(current_http_output_encoding))) != NULL) { + return String(name, CopyString); + } + } else if (strcasecmp(type.data(), "mail_charset") == 0) { + if (lang != NULL && + (name = (char *)mbfl_no_encoding2name + (lang->mail_charset)) != NULL) { + return String(name, CopyString); + } + } else if (strcasecmp(type.data(), "mail_header_encoding") == 0) { + if (lang != NULL && + (name = (char *)mbfl_no_encoding2name + (lang->mail_header_encoding)) != NULL) { + return String(name, CopyString); + } + } else if (strcasecmp(type.data(), "mail_body_encoding") == 0) { + if (lang != NULL && + (name = (char *)mbfl_no_encoding2name + (lang->mail_body_encoding)) != NULL) { + return String(name, CopyString); + } + } else if (strcasecmp(type.data(), "illegal_chars") == 0) { + return MBSTRG(illegalchars); + } else if (strcasecmp(type.data(), "encoding_translation") == 0) { + return MBSTRG(encoding_translation) ? "On" : "Off"; + } else if (strcasecmp(type.data(), "language") == 0) { + if ((name = (char *)mbfl_no_language2name + (MBSTRG(current_language))) != NULL) { + return String(name, CopyString); + } + } else if (strcasecmp(type.data(), "detect_order") == 0) { + n = MBSTRG(current_detect_order_list_size); + entry = MBSTRG(current_detect_order_list); + if (n > 0) { + Array ret; + while (n > 0) { + name = (char *)mbfl_no_encoding2name(*entry); + if (name) { + ret.append(String(name, CopyString)); + } + entry++; + n--; + } + } + } else if (strcasecmp(type.data(), "substitute_character") == 0) { + if (MBSTRG(current_filter_illegal_mode) == + MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) { + return "none"; + } else if (MBSTRG(current_filter_illegal_mode) == + MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) { + return "long"; + } else if (MBSTRG(current_filter_illegal_mode) == + MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) { + return "entity"; + } else { + return MBSTRG(current_filter_illegal_substchar); + } + } else if (strcasecmp(type.data(), "strict_detection") == 0) { + return MBSTRG(strict_detection) ? "On" : "Off"; + } + return false; +} + +Variant f_mb_http_input(CStrRef type /* = null_string */) { + int n; + char *name; + mbfl_no_encoding *entry; + mbfl_no_encoding result = mbfl_no_encoding_invalid; + + if (type.empty()) { + result = MBSTRG(http_input_identify); + } else { + switch (*type.data()) { + case 'G': case 'g': result = MBSTRG(http_input_identify_get); break; + case 'P': case 'p': result = MBSTRG(http_input_identify_post); break; + case 'C': case 'c': result = MBSTRG(http_input_identify_cookie); break; + case 'S': case 's': result = MBSTRG(http_input_identify_string); break; + case 'I': case 'i': + { + Array ret; + entry = MBSTRG(http_input_list); + n = MBSTRG(http_input_list_size); + while (n > 0) { + name = (char *)mbfl_no_encoding2name(*entry); + if (name) { + ret.append(String(name, CopyString)); + } + entry++; + n--; + } + return ret; + } + case 'L': case 'l': + { + entry = MBSTRG(http_input_list); + n = MBSTRG(http_input_list_size); + StringBuffer list; + while (n > 0) { + name = (char *)mbfl_no_encoding2name(*entry); + if (name) { + if (list.empty()) { + list.append(name); + } else { + list.append(','); + list.append(name); + } + } + entry++; + n--; + } + if (list.empty()) { + return false; + } + return list.detach(); + } + default: + result = MBSTRG(http_input_identify); + break; + } + } + + if (result != mbfl_no_encoding_invalid && + (name = (char *)mbfl_no_encoding2name(result)) != NULL) { + return String(name, CopyString); + } + return false; +} + +Variant f_mb_http_output(CStrRef encoding /* = null_string */) { + if (encoding.empty()) { + char *name = (char *)mbfl_no_encoding2name + (MBSTRG(current_http_output_encoding)); + if (name != NULL) { + return String(name, CopyString); + } + return false; + } + + mbfl_no_encoding no_encoding = mbfl_name2no_encoding(encoding.data()); + if (no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + MBSTRG(current_http_output_encoding) = no_encoding; + return true; +} + +Variant f_mb_internal_encoding(CStrRef encoding /* = null_string */) { + if (encoding.empty()) { + char *name = (char *)mbfl_no_encoding2name + (MBSTRG(current_internal_encoding)); + if (name != NULL) { + return String(name, CopyString); + } + return false; + } + + mbfl_no_encoding no_encoding = mbfl_name2no_encoding(encoding.data()); + if (no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + + MBSTRG(current_internal_encoding) = no_encoding; + return true; +} + +Variant f_mb_language(CStrRef language /* = null_string */) { + if (language.empty()) { + return String(mbfl_no_language2name(MBSTRG(current_language)), CopyString); + } + + mbfl_no_language no_language = mbfl_name2no_language(language.data()); + if (no_language == mbfl_no_language_invalid) { + Logger::Warning("Unknown language \"%s\"", language.data()); + return false; + } + + php_mb_nls_get_default_detect_order_list + (no_language, &MBSTRG(default_detect_order_list), + &MBSTRG(default_detect_order_list_size)); + MBSTRG(current_language) = no_language; + return true; +} + +String f_mb_output_handler(CStrRef contents, int status) { + mbfl_string string, result; + int last_feed; + + mbfl_no_encoding encoding = MBSTRG(current_http_output_encoding); + + /* start phase only */ + if (status & PHP_OUTPUT_HANDLER_START) { + /* delete the converter just in case. */ + if (MBSTRG(outconv)) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv)); + mbfl_buffer_converter_delete(MBSTRG(outconv)); + MBSTRG(outconv) = NULL; + } + if (encoding == mbfl_no_encoding_pass) { + return contents; + } + + /* analyze mime type */ + String mimetype = g_context->getMimeType(); + if (!mimetype.empty()) { + const char *charset = mbfl_no2preferred_mime_name(encoding); + if (charset) { + g_context->setContentType(mimetype, charset); + } + /* activate the converter */ + MBSTRG(outconv) = mbfl_buffer_converter_new + (MBSTRG(current_internal_encoding), encoding, 0); + } + } + + /* just return if the converter is not activated. */ + if (MBSTRG(outconv) == NULL) { + return contents; + } + + /* flag */ + last_feed = ((status & PHP_OUTPUT_HANDLER_END) != 0); + /* mode */ + mbfl_buffer_converter_illegal_mode + (MBSTRG(outconv), MBSTRG(current_filter_illegal_mode)); + mbfl_buffer_converter_illegal_substchar + (MBSTRG(outconv), MBSTRG(current_filter_illegal_substchar)); + + /* feed the string */ + mbfl_string_init(&string); + string.no_language = MBSTRG(current_language); + string.no_encoding = MBSTRG(current_internal_encoding); + string.val = (unsigned char *)contents.data(); + string.len = contents.size(); + mbfl_buffer_converter_feed(MBSTRG(outconv), &string); + if (last_feed) { + mbfl_buffer_converter_flush(MBSTRG(outconv)); + } + /* get the converter output, and return it */ + mbfl_buffer_converter_result(MBSTRG(outconv), &result); + + /* delete the converter if it is the last feed. */ + if (last_feed) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(MBSTRG(outconv)); + mbfl_buffer_converter_delete(MBSTRG(outconv)); + MBSTRG(outconv) = NULL; + } + + return String((const char *)result.val, result.len, AttachString); +} + +typedef struct _php_mb_encoding_handler_info_t { + int data_type; + const char *separator; + unsigned int force_register_globals: 1; + unsigned int report_errors: 1; + enum mbfl_no_language to_language; + enum mbfl_no_encoding to_encoding; + enum mbfl_no_language from_language; + int num_from_encodings; + const enum mbfl_no_encoding *from_encodings; +} php_mb_encoding_handler_info_t; + +static mbfl_no_encoding _php_mb_encoding_handler_ex +(const php_mb_encoding_handler_info_t *info, Variant &arg, char *res) { + char *var, *val; + const char *s1, *s2; + char *strtok_buf = NULL, **val_list = NULL; + int n, num, *len_list = NULL; + unsigned int val_len; + mbfl_string string, resvar, resval; + enum mbfl_no_encoding from_encoding = mbfl_no_encoding_invalid; + mbfl_encoding_detector *identd = NULL; + mbfl_buffer_converter *convd = NULL; + + mbfl_string_init_set(&string, info->to_language, info->to_encoding); + mbfl_string_init_set(&resvar, info->to_language, info->to_encoding); + mbfl_string_init_set(&resval, info->to_language, info->to_encoding); + + if (!res || *res == '\0') { + goto out; + } + + /* count the variables(separators) contained in the "res". + * separator may contain multiple separator chars. + */ + num = 1; + for (s1=res; *s1 != '\0'; s1++) { + for (s2=info->separator; *s2 != '\0'; s2++) { + if (*s1 == *s2) { + num++; + } + } + } + num *= 2; /* need space for variable name and value */ + + val_list = (char **)calloc(num, sizeof(char *)); + len_list = (int *)calloc(num, sizeof(int)); + + /* split and decode the query */ + n = 0; + strtok_buf = NULL; + var = strtok_r(res, info->separator, &strtok_buf); + while (var) { + val = strchr(var, '='); + if (val) { /* have a value */ + len_list[n] = url_decode_ex(var, val-var); + val_list[n] = var; + n++; + + *val++ = '\0'; + val_list[n] = val; + len_list[n] = url_decode_ex(val, strlen(val)); + } else { + len_list[n] = url_decode_ex(var, strlen(var)); + val_list[n] = var; + n++; + + val_list[n] = const_cast(""); + len_list[n] = 0; + } + n++; + var = strtok_r(NULL, info->separator, &strtok_buf); + } + num = n; /* make sure to process initilized vars only */ + + /* initialize converter */ + if (info->num_from_encodings <= 0) { + from_encoding = mbfl_no_encoding_pass; + } else if (info->num_from_encodings == 1) { + from_encoding = info->from_encodings[0]; + } else { + /* auto detect */ + from_encoding = mbfl_no_encoding_invalid; + identd = mbfl_encoding_detector_new + ((enum mbfl_no_encoding *)info->from_encodings, + info->num_from_encodings, MBSTRG(strict_detection)); + if (identd) { + n = 0; + while (n < num) { + string.val = (unsigned char *)val_list[n]; + string.len = len_list[n]; + if (mbfl_encoding_detector_feed(identd, &string)) { + break; + } + n++; + } + from_encoding = mbfl_encoding_detector_judge(identd); + mbfl_encoding_detector_delete(identd); + } + if (from_encoding == mbfl_no_encoding_invalid) { + if (info->report_errors) { + Logger::Warning("Unable to detect encoding"); + } + from_encoding = mbfl_no_encoding_pass; + } + } + + convd = NULL; + if (from_encoding != mbfl_no_encoding_pass) { + convd = mbfl_buffer_converter_new(from_encoding, info->to_encoding, 0); + if (convd != NULL) { + mbfl_buffer_converter_illegal_mode + (convd, MBSTRG(current_filter_illegal_mode)); + mbfl_buffer_converter_illegal_substchar + (convd, MBSTRG(current_filter_illegal_substchar)); + } else { + if (info->report_errors) { + Logger::Warning("Unable to create converter"); + } + goto out; + } + } + + /* convert encoding */ + string.no_encoding = from_encoding; + + n = 0; + while (n < num) { + string.val = (unsigned char *)val_list[n]; + string.len = len_list[n]; + if (convd != NULL && + mbfl_buffer_converter_feed_result(convd, &string, &resvar) != NULL) { + var = (char *)resvar.val; + } else { + var = val_list[n]; + } + n++; + string.val = (unsigned char *)val_list[n]; + string.len = len_list[n]; + if (convd != NULL && + mbfl_buffer_converter_feed_result(convd, &string, &resval) != NULL) { + val = (char *)resval.val; + val_len = resval.len; + } else { + val = val_list[n]; + val_len = len_list[n]; + } + n++; + + arg.set(String(var, CopyString), String(val, val_len, CopyString)); + + if (convd != NULL){ + mbfl_string_clear(&resvar); + mbfl_string_clear(&resval); + } + } + +out: + if (convd != NULL) { + MBSTRG(illegalchars) += mbfl_buffer_illegalchars(convd); + mbfl_buffer_converter_delete(convd); + } + if (val_list != NULL) { + free((void *)val_list); + } + if (len_list != NULL) { + free((void *)len_list); + } + + return from_encoding; +} + +bool f_mb_parse_str(CStrRef encoded_string, Variant result /* = null */) { + php_mb_encoding_handler_info_t info; + info.data_type = PARSE_STRING; + info.separator = ";&"; + info.force_register_globals = false; + info.report_errors = 1; + info.to_encoding = MBSTRG(current_internal_encoding); + info.to_language = MBSTRG(current_language); + info.from_encodings = MBSTRG(http_input_list); + info.num_from_encodings = MBSTRG(http_input_list_size); + info.from_language = MBSTRG(current_language); + + char *encstr = strndup(encoded_string.data(), encoded_string.size()); + mbfl_no_encoding detected = + _php_mb_encoding_handler_ex(&info, result, encstr); + free(encstr); + + MBSTRG(http_input_identify) = detected; + return detected != mbfl_no_encoding_invalid; +} + +Variant f_mb_preferred_mime_name(CStrRef encoding) { + mbfl_no_encoding no_encoding = mbfl_name2no_encoding(encoding.data()); + if (no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + + const char *preferred_name = mbfl_no2preferred_mime_name(no_encoding); + if (preferred_name == NULL || *preferred_name == '\0') { + Logger::Warning("No MIME preferred name corresponding to \"%s\"", + encoding.data()); + return false; + } + + return String(preferred_name, CopyString); +} + +static Variant php_mb_substr(CStrRef str, int from, int len, + CStrRef encoding, bool substr) { + mbfl_string string; + mbfl_string_init(&string); + string.no_language = MBSTRG(current_language); + string.no_encoding = MBSTRG(current_internal_encoding); + string.val = (unsigned char *)str.data(); + string.len = str.size(); + + if (!encoding.empty()) { + string.no_encoding = mbfl_name2no_encoding(encoding.data()); + if (string.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + } + + int size; + if (substr) { + size = mbfl_strlen(&string); + } else { + size = str.size(); + } + if (len == 0x7FFFFFFF) { + len = size; + } + + /* if "from" position is negative, count start position from the end + * of the string + */ + if (from < 0) { + from = size + from; + if (from < 0) { + from = 0; + } + } + + /* if "length" position is negative, set it to the length + * needed to stop that many chars from the end of the string + */ + if (len < 0) { + len = (size - from) + len; + if (len < 0) { + len = 0; + } + } + + if (from >= size) { + return false; + } + if ((int)((unsigned)from + (unsigned)len) > size) { + len = size - from; + } + + mbfl_string result; + mbfl_string *ret; + if (substr) { + ret = mbfl_substr(&string, &result, from, len); + } else { + ret = mbfl_strcut(&string, &result, from, len); + } + if (ret != NULL) { + return String((const char*)ret->val, ret->len, AttachString); + } + return false; +} + +Variant f_mb_substr(CStrRef str, int start, int length /* = 0x7FFFFFFF */, + CStrRef encoding /* = null_string */) { + return php_mb_substr(str, start, length, encoding, true); +} + +Variant f_mb_strcut(CStrRef str, int start, int length /* = 0x7FFFFFFF */, + CStrRef encoding /* = null_string */) { + return php_mb_substr(str, start, length, encoding, false); +} + +Variant f_mb_strimwidth(CStrRef str, int start, int width, + CStrRef trimmarker /* = null_string */, + CStrRef encoding /* = null_string */) { + mbfl_string string, result, marker, *ret; + + mbfl_string_init(&string); + mbfl_string_init(&marker); + string.no_language = MBSTRG(current_language); + string.no_encoding = MBSTRG(current_internal_encoding); + marker.no_language = MBSTRG(current_language); + marker.no_encoding = MBSTRG(current_internal_encoding); + marker.val = NULL; + marker.len = 0; + + if (!encoding.empty()) { + string.no_encoding = marker.no_encoding = + mbfl_name2no_encoding(encoding.data()); + if (string.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + } + + string.val = (unsigned char *)str.data(); + string.len = str.size(); + + if (start < 0 || start > str.size()) { + Logger::Warning("Start position is out of reange"); + return false; + } + + if (width < 0) { + Logger::Warning("Width is negative value"); + return false; + } + + marker.val = (unsigned char *)trimmarker.data(); + marker.len = trimmarker.size(); + + ret = mbfl_strimwidth(&string, &marker, &result, start, width); + if (ret != NULL) { + return String((const char *)ret->val, ret->len, AttachString); + } + return false; +} + +Variant f_mb_stripos(CStrRef haystack, CStrRef needle, int offset /* = 0 */, + CStrRef encoding /* = null_string */) { + const char *from_encoding; + if (encoding.empty()) { + from_encoding = + mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + } else { + from_encoding = encoding.data(); + } + + int n = php_mb_stripos(0, haystack.data(), haystack.size(), + needle.data(), needle.size(), offset, from_encoding); + if (n >= 0) { + return n; + } + return false; +} + +Variant f_mb_strripos(CStrRef haystack, CStrRef needle, int offset /* = 0 */, + CStrRef encoding /* = null_string */) { + const char *from_encoding; + if (encoding.empty()) { + from_encoding = + mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + } else { + from_encoding = encoding.data(); + } + + if (offset > haystack.size()) { + return false; + } + + int n = php_mb_stripos(1, haystack.data(), haystack.size(), + needle.data(), needle.size(), offset, from_encoding); + if (n >= 0) { + return n; + } + return false; +} + +Variant f_mb_stristr(CStrRef haystack, CStrRef needle, bool part /* = false */, + CStrRef encoding /* = null_string */) { + mbfl_string mbs_haystack; + mbfl_string_init(&mbs_haystack); + mbs_haystack.no_language = MBSTRG(current_language); + mbs_haystack.no_encoding = MBSTRG(current_internal_encoding); + mbs_haystack.val = (unsigned char *)haystack.data(); + mbs_haystack.len = haystack.size(); + + mbfl_string mbs_needle; + mbfl_string_init(&mbs_needle); + mbs_needle.no_language = MBSTRG(current_language); + mbs_needle.no_encoding = MBSTRG(current_internal_encoding); + mbs_needle.val = (unsigned char *)needle.data(); + mbs_needle.len = needle.size(); + if (!mbs_needle.len) { + Logger::Warning("Empty delimiter."); + return false; + } + + const char *from_encoding; + if (encoding.empty()) { + from_encoding = + mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + } else { + from_encoding = encoding.data(); + } + mbs_haystack.no_encoding = mbs_needle.no_encoding = + mbfl_name2no_encoding(from_encoding); + if (mbs_haystack.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", from_encoding); + return false; + } + + int n = php_mb_stripos(0, (const char*)mbs_haystack.val, mbs_haystack.len, + (const char *)mbs_needle.val, mbs_needle.len, + 0, from_encoding); + if (n < 0) { + return false; + } + + int mblen = mbfl_strlen(&mbs_haystack); + mbfl_string result, *ret = NULL; + if (part) { + ret = mbfl_substr(&mbs_haystack, &result, 0, n); + } else { + int len = (mblen - n); + ret = mbfl_substr(&mbs_haystack, &result, n, len); + } + + if (ret != NULL) { + return String((const char*)ret->val, ret->len, AttachString); + } + return false; +} + +Variant f_mb_strlen(CStrRef str, CStrRef encoding /* = null_string */) { + mbfl_string string; + mbfl_string_init(&string); + string.val = (unsigned char *)str.data(); + string.len = str.size(); + string.no_language = MBSTRG(current_language); + + if (encoding.empty()) { + string.no_encoding = MBSTRG(current_internal_encoding); + } else { + string.no_encoding = mbfl_name2no_encoding(encoding.data()); + if (string.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + } + + int n = mbfl_strlen(&string); + if (n >= 0) { + return n; + } + return false; +} + +Variant f_mb_strpos(CStrRef haystack, CStrRef needle, int offset /* = 0 */, + CStrRef encoding /* = null_string */) { + mbfl_string mbs_haystack; + mbfl_string_init(&mbs_haystack); + mbs_haystack.no_language = MBSTRG(current_language); + mbs_haystack.no_encoding = MBSTRG(current_internal_encoding); + mbs_haystack.val = (unsigned char *)haystack.data(); + mbs_haystack.len = haystack.size(); + + mbfl_string mbs_needle; + mbfl_string_init(&mbs_needle); + mbs_needle.no_language = MBSTRG(current_language); + mbs_needle.no_encoding = MBSTRG(current_internal_encoding); + mbs_needle.val = (unsigned char *)needle.data(); + mbs_needle.len = needle.size(); + + if (!encoding.empty()) { + mbs_haystack.no_encoding = mbs_needle.no_encoding = + mbfl_name2no_encoding(encoding.data()); + if (mbs_haystack.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + } + + if (offset < 0 || (unsigned long)offset > mbs_haystack.len) { + Logger::Warning("Offset not contained in string."); + return false; + } + if (mbs_needle.len == 0) { + Logger::Warning("Empty delimiter."); + return false; + } + + int reverse = 0; + int n = mbfl_strpos(&mbs_haystack, &mbs_needle, offset, reverse); + if (n >= 0) { + return n; + } + + switch (-n) { + case 1: + break; + case 2: + Logger::Warning("Needle has not positive length."); + break; + case 4: + Logger::Warning("Unknown encoding or conversion error."); + break; + case 8: + Logger::Warning("Argument is empty."); + break; + default: + Logger::Warning("Unknown error in mb_strpos."); + break; + } + return false; +} + +Variant f_mb_strrpos(CStrRef haystack, CStrRef needle, + CVarRef offset /* = 0LL */, + CStrRef encoding /* = null_string */) { + mbfl_string mbs_haystack; + mbfl_string_init(&mbs_haystack); + mbs_haystack.no_language = MBSTRG(current_language); + mbs_haystack.no_encoding = MBSTRG(current_internal_encoding); + mbs_haystack.val = (unsigned char *)haystack.data(); + mbs_haystack.len = haystack.size(); + + mbfl_string mbs_needle; + mbfl_string_init(&mbs_needle); + mbs_needle.no_language = MBSTRG(current_language); + mbs_needle.no_encoding = MBSTRG(current_internal_encoding); + mbs_needle.val = (unsigned char *)needle.data(); + mbs_needle.len = needle.size(); + + const char *enc_name = encoding.data(); + int enc_name_len = encoding.size(); + long noffset = 0; + String soffset = offset.toString(); + if (offset.isString()) { + enc_name = soffset.data(); + enc_name_len = soffset.size(); + + int str_flg = 1; + if (enc_name != NULL) { + switch (*enc_name) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case ' ': case '-': case '.': + break; + default : + str_flg = 0; + break; + } + } + if (str_flg) { + noffset = offset.toInt32(); + enc_name = encoding.data(); + enc_name_len = encoding.size(); + } + } else { + noffset = offset.toInt32(); + } + + if (!enc_name && !*enc_name) { + mbs_haystack.no_encoding = mbs_needle.no_encoding = + mbfl_name2no_encoding(enc_name); + if (mbs_haystack.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", enc_name); + return false; + } + } + + if (mbs_haystack.len <= 0) { + return false; + } + if (mbs_needle.len <= 0) { + return false; + } + int n = mbfl_strpos(&mbs_haystack, &mbs_needle, noffset, 1); + if (n >= 0) { + return n; + } + return false; +} + +Variant f_mb_strrchr(CStrRef haystack, CStrRef needle, bool part /* = false */, + CStrRef encoding /* = null_string */) { + mbfl_string mbs_haystack; + mbfl_string_init(&mbs_haystack); + mbs_haystack.no_language = MBSTRG(current_language); + mbs_haystack.no_encoding = MBSTRG(current_internal_encoding); + mbs_haystack.val = (unsigned char *)haystack.data(); + mbs_haystack.len = haystack.size(); + + mbfl_string mbs_needle; + mbfl_string_init(&mbs_needle); + mbs_needle.no_language = MBSTRG(current_language); + mbs_needle.no_encoding = MBSTRG(current_internal_encoding); + mbs_needle.val = (unsigned char *)needle.data(); + mbs_needle.len = needle.size(); + + if (!encoding.empty()) { + mbs_haystack.no_encoding = mbs_needle.no_encoding = + mbfl_name2no_encoding(encoding.data()); + if (mbs_haystack.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + } + + if (mbs_haystack.len <= 0) { + return false; + } + if (mbs_needle.len <= 0) { + return false; + } + + mbfl_string result, *ret = NULL; + int n = mbfl_strpos(&mbs_haystack, &mbs_needle, 0, 1); + if (n >= 0) { + int mblen = mbfl_strlen(&mbs_haystack); + if (part) { + ret = mbfl_substr(&mbs_haystack, &result, 0, n); + } else { + int len = (mblen - n); + ret = mbfl_substr(&mbs_haystack, &result, n, len); + } + } + + if (ret != NULL) { + return String((const char*)ret->val, ret->len, AttachString); + } + return false; +} + +Variant f_mb_strrichr(CStrRef haystack, CStrRef needle, bool part /* = false */, + CStrRef encoding /* = null_string */) { + mbfl_string mbs_haystack; + mbfl_string_init(&mbs_haystack); + mbs_haystack.no_language = MBSTRG(current_language); + mbs_haystack.no_encoding = MBSTRG(current_internal_encoding); + mbs_haystack.val = (unsigned char *)haystack.data(); + mbs_haystack.len = haystack.size(); + + mbfl_string mbs_needle; + mbfl_string_init(&mbs_needle); + mbs_needle.no_language = MBSTRG(current_language); + mbs_needle.no_encoding = MBSTRG(current_internal_encoding); + mbs_needle.val = (unsigned char *)needle.data(); + mbs_needle.len = needle.size(); + + const char *from_encoding; + if (encoding.empty()) { + from_encoding = + mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + } else { + from_encoding = encoding.data(); + } + mbs_haystack.no_encoding = mbs_needle.no_encoding = + mbfl_name2no_encoding(from_encoding); + if (mbs_haystack.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", from_encoding); + return false; + } + + int n = php_mb_stripos(1, (const char*)mbs_haystack.val, mbs_haystack.len, + (const char*)mbs_needle.val, mbs_needle.len, + 0, from_encoding); + if (n < 0) { + return false; + } + + mbfl_string result, *ret = NULL; + int mblen = mbfl_strlen(&mbs_haystack); + if (part) { + ret = mbfl_substr(&mbs_haystack, &result, 0, n); + } else { + int len = (mblen - n); + ret = mbfl_substr(&mbs_haystack, &result, n, len); + } + + if (ret != NULL) { + return String((const char*)ret->val, ret->len, AttachString); + } + return false; +} + +Variant f_mb_strstr(CStrRef haystack, CStrRef needle, bool part /* = false */, + CStrRef encoding /* = null_string */) { + mbfl_string mbs_haystack; + mbfl_string_init(&mbs_haystack); + mbs_haystack.no_language = MBSTRG(current_language); + mbs_haystack.no_encoding = MBSTRG(current_internal_encoding); + mbs_haystack.val = (unsigned char *)haystack.data(); + mbs_haystack.len = haystack.size(); + + mbfl_string mbs_needle; + mbfl_string_init(&mbs_needle); + mbs_needle.no_language = MBSTRG(current_language); + mbs_needle.no_encoding = MBSTRG(current_internal_encoding); + mbs_needle.val = (unsigned char *)needle.data(); + mbs_needle.len = needle.size(); + + if (!encoding.empty()) { + mbs_haystack.no_encoding = mbs_needle.no_encoding = + mbfl_name2no_encoding(encoding.data()); + if (mbs_haystack.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + } + + if (mbs_needle.len <= 0) { + Logger::Warning("Empty delimiter."); + return false; + } + + mbfl_string result, *ret = NULL; + int n = mbfl_strpos(&mbs_haystack, &mbs_needle, 0, 0); + if (n >= 0) { + int mblen = mbfl_strlen(&mbs_haystack); + if (part) { + ret = mbfl_substr(&mbs_haystack, &result, 0, n); + } else { + int len = (mblen - n); + ret = mbfl_substr(&mbs_haystack, &result, n, len); + } + } + + if (ret != NULL) { + return String((const char*)ret->val, ret->len, AttachString); + } + return false; +} + +Variant f_mb_strtolower(CStrRef str, CStrRef encoding /* = null_string */) { + const char *from_encoding; + if (encoding.empty()) { + from_encoding = + mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + } else { + from_encoding = encoding.data(); + } + + unsigned int ret_len; + char *newstr = php_unicode_convert_case(PHP_UNICODE_CASE_LOWER, + str.data(), str.size(), + &ret_len, from_encoding); + if (newstr) { + return String(newstr, ret_len, AttachString); + } + return false; +} + +Variant f_mb_strtoupper(CStrRef str, CStrRef encoding /* = null_string */) { + const char *from_encoding; + if (encoding.empty()) { + from_encoding = + mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); + } else { + from_encoding = encoding.data(); + } + + unsigned int ret_len; + char *newstr = php_unicode_convert_case(PHP_UNICODE_CASE_UPPER, + str.data(), str.size(), + &ret_len, from_encoding); + if (newstr) { + return String(newstr, ret_len, AttachString); + } + return false; +} + +Variant f_mb_strwidth(CStrRef str, CStrRef encoding /* = null_string */) { + mbfl_string string; + mbfl_string_init(&string); + string.no_language = MBSTRG(current_language); + string.no_encoding = MBSTRG(current_internal_encoding); + string.val = (unsigned char *)str.data(); + string.len = str.size(); + + if (!encoding.empty()) { + string.no_encoding = mbfl_name2no_encoding(encoding.data()); + if (string.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + } + + int n = mbfl_strwidth(&string); + if (n >= 0) { + return n; + } + return false; +} + +Variant f_mb_substitute_character(CVarRef substrchar /* = null_variant */) { + if (substrchar.isNull()) { + switch (MBSTRG(current_filter_illegal_mode)) { + case MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE: + return "none"; + case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG: + return "long"; + case MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY: + return "entity"; + default: + return MBSTRG(current_filter_illegal_substchar); + } + } + + if (substrchar.isString()) { + String s = substrchar.toString(); + if (strcasecmp("none", s.data()) == 0) { + MBSTRG(current_filter_illegal_mode) = + MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE; + return true; + } + if (strcasecmp("long", s.data()) == 0) { + MBSTRG(current_filter_illegal_mode) = + MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG; + return true; + } + if (strcasecmp("entity", s.data()) == 0) { + MBSTRG(current_filter_illegal_mode) = + MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY; + return true; + } + } + + int64 n = substrchar.toInt64(); + if (n < 0xffff && n > 0) { + MBSTRG(current_filter_illegal_mode) = + MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR; + MBSTRG(current_filter_illegal_substchar) = n; + } else { + Logger::Warning("Unknown character."); + return false; + } + return true; +} + +Variant f_mb_substr_count(CStrRef haystack, CStrRef needle, + CStrRef encoding /* = null_string */) { + mbfl_string mbs_haystack; + mbfl_string_init(&mbs_haystack); + mbs_haystack.no_language = MBSTRG(current_language); + mbs_haystack.no_encoding = MBSTRG(current_internal_encoding); + mbs_haystack.val = (unsigned char *)haystack.data(); + mbs_haystack.len = haystack.size(); + + mbfl_string mbs_needle; + mbfl_string_init(&mbs_needle); + mbs_needle.no_language = MBSTRG(current_language); + mbs_needle.no_encoding = MBSTRG(current_internal_encoding); + mbs_needle.val = (unsigned char *)needle.data(); + mbs_needle.len = needle.size(); + + if (!encoding.empty()) { + mbs_haystack.no_encoding = mbs_needle.no_encoding = + mbfl_name2no_encoding(encoding.data()); + if (mbs_haystack.no_encoding == mbfl_no_encoding_invalid) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + } + + if (mbs_needle.len <= 0) { + Logger::Warning("Empty substring."); + return false; + } + + int n = mbfl_substr_count(&mbs_haystack, &mbs_needle); + if (n >= 0) { + return n; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// regex helpers + +typedef struct _php_mb_regex_enc_name_map_t { + const char *names; + OnigEncoding code; +} php_mb_regex_enc_name_map_t; + +static php_mb_regex_enc_name_map_t enc_name_map[] ={ + { + "EUC-JP\0EUCJP\0X-EUC-JP\0UJIS\0EUCJP\0EUCJP-WIN\0", + ONIG_ENCODING_EUC_JP + }, + { + "UTF-8\0UTF8\0", + ONIG_ENCODING_UTF8 + }, + { + "UTF-16\0UTF-16BE\0", + ONIG_ENCODING_UTF16_BE + }, + { + "UTF-16LE\0", + ONIG_ENCODING_UTF16_LE + }, + { + "UCS-4\0UTF-32\0UTF-32BE\0", + ONIG_ENCODING_UTF32_BE + }, + { + "UCS-4LE\0UTF-32LE\0", + ONIG_ENCODING_UTF32_LE + }, + { + "SJIS\0CP932\0MS932\0SHIFT_JIS\0SJIS-WIN\0WINDOWS-31J\0", + ONIG_ENCODING_SJIS + }, + { + "BIG5\0BIG-5\0BIGFIVE\0CN-BIG5\0BIG-FIVE\0", + ONIG_ENCODING_BIG5 + }, + { + "EUC-CN\0EUCCN\0EUC_CN\0GB-2312\0GB2312\0", + ONIG_ENCODING_EUC_CN + }, + { + "EUC-TW\0EUCTW\0EUC_TW\0", + ONIG_ENCODING_EUC_TW + }, + { + "EUC-KR\0EUCKR\0EUC_KR\0", + ONIG_ENCODING_EUC_KR + }, + { + "KOI8R\0KOI8-R\0KOI-8R\0", + ONIG_ENCODING_KOI8_R + }, + { + "ISO-8859-1\0ISO8859-1\0ISO_8859_1\0ISO8859_1\0", + ONIG_ENCODING_ISO_8859_1 + }, + { + "ISO-8859-2\0ISO8859-2\0ISO_8859_2\0ISO8859_2\0", + ONIG_ENCODING_ISO_8859_2 + }, + { + "ISO-8859-3\0ISO8859-3\0ISO_8859_3\0ISO8859_3\0", + ONIG_ENCODING_ISO_8859_3 + }, + { + "ISO-8859-4\0ISO8859-4\0ISO_8859_4\0ISO8859_4\0", + ONIG_ENCODING_ISO_8859_4 + }, + { + "ISO-8859-5\0ISO8859-5\0ISO_8859_5\0ISO8859_5\0", + ONIG_ENCODING_ISO_8859_5 + }, + { + "ISO-8859-6\0ISO8859-6\0ISO_8859_6\0ISO8859_6\0", + ONIG_ENCODING_ISO_8859_6 + }, + { + "ISO-8859-7\0ISO8859-7\0ISO_8859_7\0ISO8859_7\0", + ONIG_ENCODING_ISO_8859_7 + }, + { + "ISO-8859-8\0ISO8859-8\0ISO_8859_8\0ISO8859_8\0", + ONIG_ENCODING_ISO_8859_8 + }, + { + "ISO-8859-9\0ISO8859-9\0ISO_8859_9\0ISO8859_9\0", + ONIG_ENCODING_ISO_8859_9 + }, + { + "ISO-8859-10\0ISO8859-10\0ISO_8859_10\0ISO8859_10\0", + ONIG_ENCODING_ISO_8859_10 + }, + { + "ISO-8859-11\0ISO8859-11\0ISO_8859_11\0ISO8859_11\0", + ONIG_ENCODING_ISO_8859_11 + }, + { + "ISO-8859-13\0ISO8859-13\0ISO_8859_13\0ISO8859_13\0", + ONIG_ENCODING_ISO_8859_13 + }, + { + "ISO-8859-14\0ISO8859-14\0ISO_8859_14\0ISO8859_14\0", + ONIG_ENCODING_ISO_8859_14 + }, + { + "ISO-8859-15\0ISO8859-15\0ISO_8859_15\0ISO8859_15\0", + ONIG_ENCODING_ISO_8859_15 + }, + { + "ISO-8859-16\0ISO8859-16\0ISO_8859_16\0ISO8859_16\0", + ONIG_ENCODING_ISO_8859_16 + }, + { + "ASCII\0US-ASCII\0US_ASCII\0ISO646\0", + ONIG_ENCODING_ASCII + }, + { NULL, ONIG_ENCODING_UNDEF } +}; + +static OnigEncoding php_mb_regex_name2mbctype(const char *pname) { + const char *p; + php_mb_regex_enc_name_map_t *mapping; + + if (pname == NULL) { + return ONIG_ENCODING_UNDEF; + } + + for (mapping = enc_name_map; mapping->names != NULL; mapping++) { + for (p = mapping->names; *p != '\0'; p += (strlen(p) + 1)) { + if (strcasecmp(p, pname) == 0) { + return mapping->code; + } + } + } + + return ONIG_ENCODING_UNDEF; +} + +static const char *php_mb_regex_mbctype2name(OnigEncoding mbctype) { + php_mb_regex_enc_name_map_t *mapping; + + for (mapping = enc_name_map; mapping->names != NULL; mapping++) { + if (mapping->code == mbctype) { + return mapping->names; + } + } + + return NULL; +} + +/* + * regex cache + */ +static php_mb_regex_t *php_mbregex_compile_pattern(CStrRef pattern, + OnigOptionType options, + OnigEncoding enc, + OnigSyntaxType *syntax) { + int err_code = 0; + OnigErrorInfo err_info; + OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; + php_mb_regex_t *rc = NULL; + + std::string spattern = std::string(pattern.data(), pattern.size()); + RegexCache &cache = MBSTRG(ht_rc); + RegexCache::const_iterator it = + cache.find(spattern); + if (it != cache.end()) { + rc = it->second; + } + + if (!rc || rc->options != options || rc->enc != enc || + rc->syntax != syntax) { + if (rc) { + onig_free(rc); + rc = NULL; + } + if ((err_code = onig_new(&rc, (OnigUChar *)pattern.data(), + (OnigUChar *)(pattern.data() + pattern.size()), + options,enc, syntax, &err_info)) != ONIG_NORMAL) { + onig_error_code_to_str(err_str, err_code, err_info); + Logger::Warning("mbregex compile err: %s", err_str); + return NULL; + } + MBSTRG(ht_rc)[spattern] = rc; + } + return rc; +} + +static size_t _php_mb_regex_get_option_string(char *str, size_t len, + OnigOptionType option, + OnigSyntaxType *syntax) { + size_t len_left = len; + size_t len_req = 0; + char *p = str; + char c; + + if ((option & ONIG_OPTION_IGNORECASE) != 0) { + if (len_left > 0) { + --len_left; + *(p++) = 'i'; + } + ++len_req; + } + + if ((option & ONIG_OPTION_EXTEND) != 0) { + if (len_left > 0) { + --len_left; + *(p++) = 'x'; + } + ++len_req; + } + + if ((option & (ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE)) == + (ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE)) { + if (len_left > 0) { + --len_left; + *(p++) = 'p'; + } + ++len_req; + } else { + if ((option & ONIG_OPTION_MULTILINE) != 0) { + if (len_left > 0) { + --len_left; + *(p++) = 'm'; + } + ++len_req; + } + + if ((option & ONIG_OPTION_SINGLELINE) != 0) { + if (len_left > 0) { + --len_left; + *(p++) = 's'; + } + ++len_req; + } + } + if ((option & ONIG_OPTION_FIND_LONGEST) != 0) { + if (len_left > 0) { + --len_left; + *(p++) = 'l'; + } + ++len_req; + } + if ((option & ONIG_OPTION_FIND_NOT_EMPTY) != 0) { + if (len_left > 0) { + --len_left; + *(p++) = 'n'; + } + ++len_req; + } + + c = 0; + + if (syntax == ONIG_SYNTAX_JAVA) { + c = 'j'; + } else if (syntax == ONIG_SYNTAX_GNU_REGEX) { + c = 'u'; + } else if (syntax == ONIG_SYNTAX_GREP) { + c = 'g'; + } else if (syntax == ONIG_SYNTAX_EMACS) { + c = 'c'; + } else if (syntax == ONIG_SYNTAX_RUBY) { + c = 'r'; + } else if (syntax == ONIG_SYNTAX_PERL) { + c = 'z'; + } else if (syntax == ONIG_SYNTAX_POSIX_BASIC) { + c = 'b'; + } else if (syntax == ONIG_SYNTAX_POSIX_EXTENDED) { + c = 'd'; + } + + if (c != 0) { + if (len_left > 0) { + --len_left; + *(p++) = c; + } + ++len_req; + } + + if (len_left > 0) { + --len_left; + *(p++) = '\0'; + } + ++len_req; + if (len < len_req) { + return len_req; + } + + return 0; +} + +static void _php_mb_regex_init_options(const char *parg, int narg, + OnigOptionType *option, + OnigSyntaxType **syntax, int *eval) { + int n; + char c; + int optm = 0; + + *syntax = ONIG_SYNTAX_RUBY; + if (parg != NULL) { + n = 0; + while (n < narg) { + c = parg[n++]; + switch (c) { + case 'i': optm |= ONIG_OPTION_IGNORECASE; break; + case 'x': optm |= ONIG_OPTION_EXTEND; break; + case 'm': optm |= ONIG_OPTION_MULTILINE; break; + case 's': optm |= ONIG_OPTION_SINGLELINE; break; + case 'p': optm |= ONIG_OPTION_MULTILINE | ONIG_OPTION_SINGLELINE; break; + case 'l': optm |= ONIG_OPTION_FIND_LONGEST; break; + case 'n': optm |= ONIG_OPTION_FIND_NOT_EMPTY; break; + case 'j': *syntax = ONIG_SYNTAX_JAVA; break; + case 'u': *syntax = ONIG_SYNTAX_GNU_REGEX; break; + case 'g': *syntax = ONIG_SYNTAX_GREP; break; + case 'c': *syntax = ONIG_SYNTAX_EMACS; break; + case 'r': *syntax = ONIG_SYNTAX_RUBY; break; + case 'z': *syntax = ONIG_SYNTAX_PERL; break; + case 'b': *syntax = ONIG_SYNTAX_POSIX_BASIC; break; + case 'd': *syntax = ONIG_SYNTAX_POSIX_EXTENDED; break; + case 'e': + if (eval != NULL) *eval = 1; + break; + default: + break; + } + } + if (option != NULL) *option|=optm; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// regex functions + +bool f_mb_ereg_match(CStrRef pattern, CStrRef str, + CStrRef option /* = null_string */) { + OnigSyntaxType *syntax; + OnigOptionType noption = 0; + if (!option.empty()) { + _php_mb_regex_init_options(option.data(), option.size(), &noption, + &syntax, NULL); + } else { + noption |= MBSTRG(regex_default_options); + syntax = MBSTRG(regex_default_syntax); + } + + php_mb_regex_t *re; + if ((re = php_mbregex_compile_pattern + (pattern, noption, MBSTRG(current_mbctype), syntax)) == NULL) { + return false; + } + + /* match */ + int err = onig_match(re, (OnigUChar *)str.data(), + (OnigUChar *)(str.data() + str.size()), + (OnigUChar *)str.data(), NULL, 0); + return err >= 0; +} + +static Variant _php_mb_regex_ereg_replace_exec(CVarRef pattern, + CStrRef replacement, + CStrRef str, + CStrRef option, + OnigOptionType options) { + const char *p; + php_mb_regex_t *re; + OnigSyntaxType *syntax; + OnigRegion *regs = NULL; + StringBuffer out_buf; + int i, err, eval, n; + OnigUChar *pos; + OnigUChar *string_lim; + char pat_buf[2]; + + const mbfl_encoding *enc; + + { + const char *current_enc_name; + current_enc_name = php_mb_regex_mbctype2name(MBSTRG(current_mbctype)); + if (current_enc_name == NULL || + (enc = mbfl_name2encoding(current_enc_name)) == NULL) { + Logger::Warning("Unknown error"); + return false; + } + } + eval = 0; + { + if (!option.empty()) { + _php_mb_regex_init_options(option.data(), option.size(), + &options, &syntax, &eval); + } else { + options |= MBSTRG(regex_default_options); + syntax = MBSTRG(regex_default_syntax); + } + } + + String spattern; + if (pattern.isString()) { + spattern = pattern.toString(); + } else { + /* FIXME: this code is not multibyte aware! */ + pat_buf[0] = pattern.toByte(); + pat_buf[1] = '\0'; + spattern = String(pat_buf, 1, CopyString); + } + /* create regex pattern buffer */ + re = php_mbregex_compile_pattern(spattern, options, + MBSTRG(current_mbctype), syntax); + if (re == NULL) { + return false; + } + + if (eval) { + throw NotSupportedException("ereg_replace", "dynamic coding"); + } + + /* do the actual work */ + err = 0; + pos = (OnigUChar*)str.data(); + string_lim = (OnigUChar*)(str.data() + str.size()); + regs = onig_region_new(); + while (err >= 0) { + err = onig_search(re, (OnigUChar *)str.data(), (OnigUChar *)string_lim, + pos, (OnigUChar *)string_lim, regs, 0); + if (err <= -2) { + OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; + onig_error_code_to_str(err_str, err); + Logger::Warning("mbregex search failure: %s", err_str); + break; + } + if (err >= 0) { +#if moriyoshi_0 + if (regs->beg[0] == regs->end[0]) { + Logger::Warning("Empty regular expression"); + break; + } +#endif + /* copy the part of the string before the match */ + out_buf.append((const char *)pos, + (OnigUChar *)(str.data() + regs->beg[0]) - pos); + /* copy replacement and backrefs */ + i = 0; + p = replacement.data(); + while (i < replacement.size()) { + int fwd = (int)php_mb_mbchar_bytes_ex(p, enc); + n = -1; + if ((replacement.size() - i) >= 2 && fwd == 1 && + p[0] == '\\' && p[1] >= '0' && p[1] <= '9') { + n = p[1] - '0'; + } + if (n >= 0 && n < regs->num_regs) { + if (regs->beg[n] >= 0 && regs->beg[n] < regs->end[n] && + regs->end[n] <= str.size()) { + out_buf.append(str.data() + regs->beg[n], + regs->end[n] - regs->beg[n]); + } + p += 2; + i += 2; + } else { + out_buf.append(p, fwd); + p += fwd; + i += fwd; + } + } + n = regs->end[0]; + if ((pos - (OnigUChar *)str.data()) < n) { + pos = (OnigUChar *)(str.data() + n); + } else { + if (pos < string_lim) { + out_buf.append((const char *)pos, 1); + } + pos++; + } + } else { /* nomatch */ + /* stick that last bit of string on our output */ + if (string_lim - pos > 0) { + out_buf.append((const char *)pos, string_lim - pos); + } + } + onig_region_free(regs, 0); + } + + if (regs != NULL) { + onig_region_free(regs, 1); + } + + if (err <= -2) { + return false; + } + return out_buf.detach(); +} + +Variant f_mb_ereg_replace(CVarRef pattern, CStrRef replacement, CStrRef str, + CStrRef option /* = null_string */) { + return _php_mb_regex_ereg_replace_exec(pattern, replacement, + str, option, 0); +} + +Variant f_mb_eregi_replace(CVarRef pattern, CStrRef replacement, CStrRef str, + CStrRef option /* = null_string */) { + return _php_mb_regex_ereg_replace_exec(pattern, replacement, + str, option, ONIG_OPTION_IGNORECASE); +} + +int f_mb_ereg_search_getpos() { + return MBSTRG(search_pos); +} + +bool f_mb_ereg_search_setpos(int position) { + if (position < 0 || position >= (int)MBSTRG(search_str).size()) { + Logger::Warning("Position is out of range"); + MBSTRG(search_pos) = 0; + return false; + } + MBSTRG(search_pos) = position; + return true; +} + +Variant f_mb_ereg_search_getregs() { + OnigRegion *search_regs = MBSTRG(search_regs); + if (search_regs && !MBSTRG(search_str).empty()) { + Array ret; + OnigUChar *str = (OnigUChar *)MBSTRG(search_str).data(); + int len = MBSTRG(search_str).size(); + int n = search_regs->num_regs; + for (int i = 0; i < n; i++) { + int beg = search_regs->beg[i]; + int end = search_regs->end[i]; + if (beg >= 0 && beg <= end && end <= len) { + ret.append(String((const char *)(str + beg), end - beg, CopyString)); + } else { + ret.append(false); + } + } + return ret; + } + return false; +} + +bool f_mb_ereg_search_init(CStrRef str, CStrRef pattern /* = null_string */, + CStrRef option /* = null_string */) { + OnigOptionType noption = MBSTRG(regex_default_options); + OnigSyntaxType *syntax = MBSTRG(regex_default_syntax); + if (!option.empty()) { + noption = 0; + _php_mb_regex_init_options(option.data(), option.size(), + &noption, &syntax, NULL); + } + if (!pattern.empty()) { + if ((MBSTRG(search_re) = php_mbregex_compile_pattern + (pattern, noption, MBSTRG(current_mbctype), syntax)) == NULL) { + return false; + } + } + + MBSTRG(search_str) = std::string(str.data(), str.size()); + MBSTRG(search_pos) = 0; + + if (MBSTRG(search_regs) != NULL) { + onig_region_free(MBSTRG(search_regs), 1); + MBSTRG(search_regs) = (OnigRegion *)NULL; + } + return true; +} + +/* regex search */ +static Variant _php_mb_regex_ereg_search_exec(CStrRef pattern, CStrRef option, + int mode) { + int n, i, err, pos, len, beg, end; + OnigUChar *str; + OnigSyntaxType *syntax = NULL; + OnigOptionType noption; + + noption = MBSTRG(regex_default_options); + if (!option.empty()) { + noption = 0; + _php_mb_regex_init_options(option.data(), option.size(), + &noption, &syntax, NULL); + } + if (!pattern.empty()) { + if ((MBSTRG(search_re) = php_mbregex_compile_pattern + (pattern, noption, MBSTRG(current_mbctype), syntax)) == NULL) { + return false; + } + } + + pos = MBSTRG(search_pos); + str = NULL; + len = 0; + if (!MBSTRG(search_str).empty()) { + str = (OnigUChar *)MBSTRG(search_str).data(); + len = MBSTRG(search_str).size(); + } + + if (MBSTRG(search_re) == NULL) { + Logger::Warning("No regex given"); + return false; + } + + if (str == NULL) { + Logger::Warning("No string given"); + return false; + } + + if (MBSTRG(search_regs)) { + onig_region_free(MBSTRG(search_regs), 1); + } + MBSTRG(search_regs) = onig_region_new(); + + err = onig_search(MBSTRG(search_re), str, str + len, str + pos, str + len, + MBSTRG(search_regs), 0); + Variant ret; + if (err == ONIG_MISMATCH) { + MBSTRG(search_pos) = len; + ret = false; + } else if (err <= -2) { + OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; + onig_error_code_to_str(err_str, err); + Logger::Warning("mbregex search failure in mbregex_search(): %s", err_str); + ret = false; + } else { + if (MBSTRG(search_regs)->beg[0] == MBSTRG(search_regs)->end[0]) { + Logger::Warning("Empty regular expression"); + } + switch (mode) { + case 1: + { + beg = MBSTRG(search_regs)->beg[0]; + end = MBSTRG(search_regs)->end[0]; + ret.append(beg); + ret.append(end - beg); + } + break; + case 2: + n = MBSTRG(search_regs)->num_regs; + for (i = 0; i < n; i++) { + beg = MBSTRG(search_regs)->beg[i]; + end = MBSTRG(search_regs)->end[i]; + if (beg >= 0 && beg <= end && end <= len) { + ret.append(String((const char *)(str + beg), end - beg, CopyString)); + } else { + ret.append(false); + } + } + break; + default: + ret = true; + break; + } + end = MBSTRG(search_regs)->end[0]; + if (pos < end) { + MBSTRG(search_pos) = end; + } else { + MBSTRG(search_pos) = pos + 1; + } + } + + if (err < 0) { + onig_region_free(MBSTRG(search_regs), 1); + MBSTRG(search_regs) = (OnigRegion *)NULL; + } + return ret; +} + +Variant f_mb_ereg_search(CStrRef pattern /* = null_string */, + CStrRef option /* = null_string */) { + return _php_mb_regex_ereg_search_exec(pattern, option, 0); +} + +Variant f_mb_ereg_search_pos(CStrRef pattern /* = null_string */, + CStrRef option /* = null_string */) { + return _php_mb_regex_ereg_search_exec(pattern, option, 1); +} + +Variant f_mb_ereg_search_regs(CStrRef pattern /* = null_string */, + CStrRef option /* = null_string */) { + return _php_mb_regex_ereg_search_exec(pattern, option, 2); +} + +static Variant _php_mb_regex_ereg_exec(CVarRef pattern, CStrRef str, + Variant ®s, int icase) { + php_mb_regex_t *re; + OnigRegion *regions = NULL; + int i, match_len, beg, end; + OnigOptionType options; + + options = MBSTRG(regex_default_options); + if (icase) { + options |= ONIG_OPTION_IGNORECASE; + } + + /* compile the regular expression from the supplied regex */ + String spattern; + if (!pattern.isString()) { + /* we convert numbers to integers and treat them as a string */ + if (pattern.is(KindOfDouble)) { + spattern = String(pattern.toInt64()); /* get rid of decimal places */ + } else { + spattern = pattern.toString(); + } + } else { + spattern = pattern.toString(); + } + re = php_mbregex_compile_pattern(spattern, options, MBSTRG(current_mbctype), + MBSTRG(regex_default_syntax)); + if (re == NULL) { + return false; + } + + regions = onig_region_new(); + + /* actually execute the regular expression */ + if (onig_search(re, (OnigUChar *)str.data(), + (OnigUChar *)(str.data() + str.size()), + (OnigUChar *)str.data(), + (OnigUChar *)(str.data() + str.size()), + regions, 0) < 0) { + onig_region_free(regions, 1); + return false; + } + + const char *s = str.data(); + int string_len = str.size(); + match_len = regions->end[0] - regions->beg[0]; + regs = Array::Create(); + for (i = 0; i < regions->num_regs; i++) { + beg = regions->beg[i]; + end = regions->end[i]; + if (beg >= 0 && beg < end && end <= string_len) { + regs.append(String(s + beg, end - beg, CopyString)); + } else { + regs.append(false); + } + } + + if (match_len == 0) { + match_len = 1; + } + if (regions != NULL) { + onig_region_free(regions, 1); + } + return match_len; +} + +Variant f_mb_ereg(CVarRef pattern, CStrRef str, Variant regs /* = null */) { + return _php_mb_regex_ereg_exec(pattern, str, regs, 0); +} + +Variant f_mb_eregi(CVarRef pattern, CStrRef str, Variant regs /* = null */) { + return _php_mb_regex_ereg_exec(pattern, str, regs, 1); +} + +Variant f_mb_regex_encoding(CStrRef encoding /* = null_string */) { + if (encoding.empty()) { + const char *retval = php_mb_regex_mbctype2name(MBSTRG(current_mbctype)); + if (retval != NULL) { + return String(retval, CopyString); + } + return false; + } + + OnigEncoding mbctype = php_mb_regex_name2mbctype(encoding.data()); + if (mbctype == ONIG_ENCODING_UNDEF) { + Logger::Warning("Unknown encoding \"%s\"", encoding.data()); + return false; + } + + MBSTRG(current_mbctype) = mbctype; + return true; +} + +static void php_mb_regex_set_options(OnigOptionType options, + OnigSyntaxType *syntax, + OnigOptionType *prev_options, + OnigSyntaxType **prev_syntax) { + if (prev_options != NULL) { + *prev_options = MBSTRG(regex_default_options); + } + if (prev_syntax != NULL) { + *prev_syntax = MBSTRG(regex_default_syntax); + } + MBSTRG(regex_default_options) = options; + MBSTRG(regex_default_syntax) = syntax; +} + +String f_mb_regex_set_options(CStrRef options /* = null_string */) { + OnigOptionType opt; + OnigSyntaxType *syntax; + char buf[16]; + + if (!options.empty()) { + opt = 0; + syntax = NULL; + _php_mb_regex_init_options(options.data(), options.size(), + &opt, &syntax, NULL); + php_mb_regex_set_options(opt, syntax, NULL, NULL); + } else { + opt = MBSTRG(regex_default_options); + syntax = MBSTRG(regex_default_syntax); + } + _php_mb_regex_get_option_string(buf, sizeof(buf), opt, syntax); + return String(buf, CopyString); +} + +Variant f_mb_split(CStrRef pattern, CStrRef str, int count /* = -1 */) { + php_mb_regex_t *re; + OnigRegion *regs = NULL; + + int n, err; + if (count == 0) { + count = 1; + } + + /* create regex pattern buffer */ + if ((re = php_mbregex_compile_pattern(pattern, + MBSTRG(regex_default_options), + MBSTRG(current_mbctype), + MBSTRG(regex_default_syntax))) + == NULL) { + return false; + } + + Array ret; + OnigUChar *pos0 = (OnigUChar *)str.data(); + OnigUChar *pos_end = (OnigUChar *)(str.data() + str.size()); + OnigUChar *pos = pos0; + err = 0; + regs = onig_region_new(); + /* churn through str, generating array entries as we go */ + while ((--count != 0) && + (err = onig_search(re, pos0, pos_end, pos, pos_end, regs, 0)) >= 0) { + if (regs->beg[0] == regs->end[0]) { + Logger::Warning("Empty regular expression"); + break; + } + + /* add it to the array */ + if (regs->beg[0] < str.size() && regs->beg[0] >= (pos - pos0)) { + ret.append(String((const char *)pos, + ((OnigUChar *)(str.data() + regs->beg[0]) - pos), + CopyString)); + } else { + err = -2; + break; + } + /* point at our new starting point */ + n = regs->end[0]; + if ((pos - pos0) < n) { + pos = pos0 + n; + } + if (count < 0) { + count = 0; + } + onig_region_free(regs, 0); + } + + onig_region_free(regs, 1); + + /* see if we encountered an error */ + if (err <= -2) { + OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN]; + onig_error_code_to_str(err_str, err); + Logger::Warning("mbregex search failure in mbsplit(): %s", err_str); + return false; + } + + /* otherwise we just have one last element to add to the array */ + n = pos_end - pos; + if (n > 0) { + ret.append(String((const char *)pos, n, CopyString)); + } else { + ret.append(""); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +#define SKIP_LONG_HEADER_SEP_MBSTRING(str, pos) \ + if (str[pos] == '\r' && str[pos + 1] == '\n' && \ + (str[pos + 2] == ' ' || str[pos + 2] == '\t')) { \ + pos += 2; \ + while (str[pos + 1] == ' ' || str[pos + 1] == '\t') { \ + pos++; \ + } \ + continue; \ + } + +static int _php_mbstr_parse_mail_headers(Array &ht, const char *str, + size_t str_len) { + const char *ps; + size_t icnt; + int state = 0; + int crlf_state = -1; + + StringBuffer token; + String fld_name, fld_val; + + ps = str; + icnt = str_len; + + /* + * C o n t e n t - T y p e : t e x t / h t m l \r\n + * ^ ^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^^^^^^^^ ^^^^ + * state 0 1 2 3 + * + * C o n t e n t - T y p e : t e x t / h t m l \r\n + * ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ + * crlf_state -1 0 1 -1 + * + */ + + while (icnt > 0) { + switch (*ps) { + case ':': + if (crlf_state == 1) { + token.append('\r'); + } + + if (state == 0 || state == 1) { + fld_name = token.detach(); + + state = 2; + } else { + token.append(*ps); + } + + crlf_state = 0; + break; + + case '\n': + if (crlf_state == -1) { + goto out; + } + crlf_state = -1; + break; + + case '\r': + if (crlf_state == 1) { + token.append('\r'); + } else { + crlf_state = 1; + } + break; + + case ' ': case '\t': + if (crlf_state == -1) { + if (state == 3) { + /* continuing from the previous line */ + state = 4; + } else { + /* simply skipping this new line */ + state = 5; + } + } else { + if (crlf_state == 1) { + token.append('\r'); + } + if (state == 1 || state == 3) { + token.append(*ps); + } + } + crlf_state = 0; + break; + + default: + switch (state) { + case 0: + token.clear(); + state = 1; + break; + + case 2: + if (crlf_state != -1) { + token.clear(); + state = 3; + break; + } + /* break is missing intentionally */ + + case 3: + if (crlf_state == -1) { + fld_val = token.detach(); + if (!fld_name.empty() && !fld_val.empty()) { + /* FIXME: some locale free implementation is + * really required here,,, */ + ht.set(StringUtil::ToUpper(fld_name), fld_val); + } + state = 1; + } + break; + + case 4: + token.append(' '); + state = 3; + break; + } + + if (crlf_state == 1) { + token.append('\r'); + } + + token.append(*ps); + + crlf_state = 0; + break; + } + ps++, icnt--; + } +out: + if (state == 2) { + token.clear(); + state = 3; + } + if (state == 3) { + fld_val = token.detach(); + if (!fld_name.empty() && !fld_val.empty()) { + /* FIXME: some locale free implementation is + * really required here,,, */ + ht.set(StringUtil::ToUpper(fld_name), fld_val); + } + } + return state; +} + +static int php_mail(const char *to, const char *subject, const char *message, + const char *headers, const char *extra_cmd) { + const char *sendmail_path = "/usr/sbin/sendmail -t -i"; + String sendmail_cmd = sendmail_path; + if (extra_cmd != NULL) { + sendmail_cmd += " "; + sendmail_cmd += extra_cmd; + } + + /* Since popen() doesn't indicate if the internal fork() doesn't work + * (e.g. the shell can't be executed) we explicitely set it to 0 to be + * sure we don't catch any older errno value. */ + errno = 0; + FILE *sendmail = popen(sendmail_cmd.data(), "w"); + if (sendmail == NULL) { + Logger::Warning("Could not execute mail delivery program '%s'", + sendmail_path); + return 0; + } + + if (EACCES == errno) { + Logger::Warning("Permission denied: unable to execute shell to run " + "mail delivery binary '%s'", sendmail_path); + pclose(sendmail); + return 0; + } + + fprintf(sendmail, "To: %s\n", to); + fprintf(sendmail, "Subject: %s\n", subject); + if (headers != NULL) { + fprintf(sendmail, "%s\n", headers); + } + fprintf(sendmail, "\n%s\n", message); + int ret = pclose(sendmail); +#if defined(EX_TEMPFAIL) + if ((ret != EX_OK) && (ret != EX_TEMPFAIL)) return 0; +#elif defined(EX_OK) + if (ret != EX_OK) return 0; +#else + if (ret != 0) return 0; +#endif + return 1; +} + +bool f_mb_send_mail(CStrRef to, CStrRef subject, CStrRef message, + CStrRef headers /* = null_string */, + CStrRef extra_cmd /* = null_string */) { + /* initialize */ + /* automatic allocateable buffer for additional header */ + mbfl_memory_device device; + mbfl_memory_device_init(&device, 0, 0); + mbfl_string orig_str, conv_str; + mbfl_string_init(&orig_str); + mbfl_string_init(&conv_str); + + /* character-set, transfer-encoding */ + mbfl_no_encoding + tran_cs, /* transfar text charset */ + head_enc, /* header transfar encoding */ + body_enc; /* body transfar encoding */ + tran_cs = mbfl_no_encoding_utf8; + head_enc = mbfl_no_encoding_base64; + body_enc = mbfl_no_encoding_base64; + const mbfl_language *lang = mbfl_no2language(MBSTRG(current_language)); + if (lang != NULL) { + tran_cs = lang->mail_charset; + head_enc = lang->mail_header_encoding; + body_enc = lang->mail_body_encoding; + } + + Array ht_headers; + if (!headers.empty()) { + _php_mbstr_parse_mail_headers(ht_headers, headers.data(), headers.size()); + } + + struct { + int cnt_type:1; + int cnt_trans_enc:1; + } suppressed_hdrs = { 0, 0 }; + + String s = ht_headers["CONTENT-TYPE"]; + if (!s.isNull()) { + char *tmp; + char *param_name; + char *charset = NULL; + + char *p = strchr(s.data(), ';'); + if (p != NULL) { + /* skipping the padded spaces */ + do { + ++p; + } while (*p == ' ' || *p == '\t'); + + if (*p != '\0') { + if ((param_name = strtok_r(p, "= ", &tmp)) != NULL) { + if (strcasecmp(param_name, "charset") == 0) { + mbfl_no_encoding _tran_cs = tran_cs; + + charset = strtok_r(NULL, "= ", &tmp); + if (charset != NULL) { + _tran_cs = mbfl_name2no_encoding(charset); + } + + if (_tran_cs == mbfl_no_encoding_invalid) { + Logger::Warning("Unsupported charset \"%s\" - " + "will be regarded as ascii", charset); + _tran_cs = mbfl_no_encoding_ascii; + } + tran_cs = _tran_cs; + } + } + } + } + suppressed_hdrs.cnt_type = 1; + } + + s = ht_headers["CONTENT-TRANSFER-ENCODING"]; + if (!s.isNull()) { + mbfl_no_encoding _body_enc = mbfl_name2no_encoding(s.data()); + switch (_body_enc) { + case mbfl_no_encoding_base64: + case mbfl_no_encoding_7bit: + case mbfl_no_encoding_8bit: + body_enc = _body_enc; + break; + + default: + Logger::Warning("Unsupported transfer encoding \"%s\" - " + "will be regarded as 8bit", s.data()); + body_enc = mbfl_no_encoding_8bit; + break; + } + suppressed_hdrs.cnt_trans_enc = 1; + } + + /* To: */ + char *to_r = NULL; + int err = 0; + if (!to.empty()) { + int to_len = to.size(); + if (to_len > 0) { + to_r = strndup(to.data(), to_len); + for (; to_len; to_len--) { + if (!isspace((unsigned char)to_r[to_len - 1])) { + break; + } + to_r[to_len - 1] = '\0'; + } + for (int i = 0; to_r[i]; i++) { + if (iscntrl((unsigned char)to_r[i])) { + /** + * According to RFC 822, section 3.1.1 long headers may be + * separated into parts using CRLF followed at least one + * linear-white-space character ('\t' or ' '). + * To prevent these separators from being replaced with a space, + * we use the SKIP_LONG_HEADER_SEP_MBSTRING to skip over them. + */ + SKIP_LONG_HEADER_SEP_MBSTRING(to_r, i); + to_r[i] = ' '; + } + } + } else { + to_r = (char*)to.data(); + } + } else { + Logger::Warning("Missing To: field"); + err = 1; + } + + /* Subject: */ + String encoded_subject; + if (!subject.isNull()) { + orig_str.no_language = MBSTRG(current_language); + orig_str.val = (unsigned char *)subject.data(); + orig_str.len = subject.size(); + orig_str.no_encoding = MBSTRG(current_internal_encoding); + if (orig_str.no_encoding == mbfl_no_encoding_invalid + || orig_str.no_encoding == mbfl_no_encoding_pass) { + orig_str.no_encoding = mbfl_identify_encoding_no + (&orig_str, MBSTRG(current_detect_order_list), + MBSTRG(current_detect_order_list_size), MBSTRG(strict_detection)); + } + mbfl_string *pstr = mbfl_mime_header_encode + (&orig_str, &conv_str, tran_cs, head_enc, + "\n", sizeof("Subject: [PHP-jp nnnnnnnn]")); + if (pstr != NULL) { + encoded_subject = String((const char *)pstr->val, pstr->len, + AttachString); + } + } else { + Logger::Warning("Missing Subject: field"); + err = 1; + } + + /* message body */ + String encoded_message; + if (!message.empty()) { + orig_str.no_language = MBSTRG(current_language); + orig_str.val = (unsigned char*)message.data(); + orig_str.len = message.size(); + orig_str.no_encoding = MBSTRG(current_internal_encoding); + + if (orig_str.no_encoding == mbfl_no_encoding_invalid + || orig_str.no_encoding == mbfl_no_encoding_pass) { + orig_str.no_encoding = mbfl_identify_encoding_no + (&orig_str, MBSTRG(current_detect_order_list), + MBSTRG(current_detect_order_list_size), MBSTRG(strict_detection)); + } + + mbfl_string *pstr = NULL; + { + mbfl_string tmpstr; + if (mbfl_convert_encoding(&orig_str, &tmpstr, tran_cs) != NULL) { + tmpstr.no_encoding = mbfl_no_encoding_8bit; + pstr = mbfl_convert_encoding(&tmpstr, &conv_str, body_enc); + free(tmpstr.val); + } + } + if (pstr != NULL) { + encoded_message = String((const char *)pstr->val, pstr->len, + AttachString); + } + } else { + /* this is not really an error, so it is allowed. */ + Logger::Warning("Empty message body"); + } + + /* other headers */ +#define PHP_MBSTR_MAIL_MIME_HEADER1 "Mime-Version: 1.0" +#define PHP_MBSTR_MAIL_MIME_HEADER2 "Content-Type: text/plain" +#define PHP_MBSTR_MAIL_MIME_HEADER3 "; charset=" +#define PHP_MBSTR_MAIL_MIME_HEADER4 "Content-Transfer-Encoding: " + if (!headers.empty()) { + const char *p = headers.data(); + int n = headers.size(); + mbfl_memory_device_strncat(&device, p, n); + if (n > 0 && p[n - 1] != '\n') { + mbfl_memory_device_strncat(&device, "\n", 1); + } + } + + mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER1, + sizeof(PHP_MBSTR_MAIL_MIME_HEADER1) - 1); + mbfl_memory_device_strncat(&device, "\n", 1); + + if (!suppressed_hdrs.cnt_type) { + mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER2, + sizeof(PHP_MBSTR_MAIL_MIME_HEADER2) - 1); + + char *p = (char *)mbfl_no2preferred_mime_name(tran_cs); + if (p != NULL) { + mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER3, + sizeof(PHP_MBSTR_MAIL_MIME_HEADER3) - 1); + mbfl_memory_device_strcat(&device, p); + } + mbfl_memory_device_strncat(&device, "\n", 1); + } + if (!suppressed_hdrs.cnt_trans_enc) { + mbfl_memory_device_strncat(&device, PHP_MBSTR_MAIL_MIME_HEADER4, + sizeof(PHP_MBSTR_MAIL_MIME_HEADER4) - 1); + const char *p = (char *)mbfl_no2preferred_mime_name(body_enc); + if (p == NULL) { + p = "7bit"; + } + mbfl_memory_device_strcat(&device, p); + mbfl_memory_device_strncat(&device, "\n", 1); + } + + mbfl_memory_device_unput(&device); + mbfl_memory_device_output('\0', &device); + + char *all_headers = (char *)device.buffer; + + String cmd = f_escapeshellcmd(extra_cmd); + bool ret = (!err && php_mail(to_r, encoded_subject.data(), + encoded_message.data(), + all_headers, cmd.data())); + mbfl_memory_device_clear(&device); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_mb.h b/src/cpp/ext/ext_mb.h new file mode 100644 index 0000000000000..f3e2ad8d1dd53 --- /dev/null +++ b/src/cpp/ext/ext_mb.h @@ -0,0 +1,87 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_MB_H__ +#define __EXT_MB_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Array f_mb_list_encodings(); +Variant f_mb_list_encodings_alias_names(CStrRef name = null_string); +Variant f_mb_list_mime_names(CStrRef name = null_string); +bool f_mb_check_encoding(CStrRef var = null_string, CStrRef encoding = null_string); +Variant f_mb_convert_case(CStrRef str, int mode, CStrRef encoding = null_string); +Variant f_mb_convert_encoding(CStrRef str, CStrRef to_encoding, CVarRef from_encoding = null_variant); +Variant f_mb_convert_kana(CStrRef str, CStrRef option = null_string, CStrRef encoding = null_string); +Variant f_mb_convert_variables(int _argc, CStrRef to_encoding, CVarRef from_encoding, Variant vars, CArrRef _argv = null_array); +Variant f_mb_decode_mimeheader(CStrRef str); +Variant f_mb_decode_numericentity(CStrRef str, CVarRef convmap, CStrRef encoding = null_string); +Variant f_mb_detect_encoding(CStrRef str, CVarRef encoding_list = null_variant, CVarRef strict = null_variant); +Variant f_mb_detect_order(CVarRef encoding_list = null_variant); +Variant f_mb_encode_mimeheader(CStrRef str, CStrRef charset = null_string, CStrRef transfer_encoding = null_string, CStrRef linefeed = "\r\n", int indent = 0); +Variant f_mb_encode_numericentity(CStrRef str, CVarRef convmap, CStrRef encoding = null_string); +bool f_mb_ereg_match(CStrRef pattern, CStrRef str, CStrRef option = null_string); +Variant f_mb_ereg_replace(CVarRef pattern, CStrRef replacement, CStrRef str, CStrRef option = null_string); +int f_mb_ereg_search_getpos(); +Variant f_mb_ereg_search_getregs(); +bool f_mb_ereg_search_init(CStrRef str, CStrRef pattern = null_string, CStrRef option = null_string); +Variant f_mb_ereg_search_pos(CStrRef pattern = null_string, CStrRef option = null_string); +Variant f_mb_ereg_search_regs(CStrRef pattern = null_string, CStrRef option = null_string); +bool f_mb_ereg_search_setpos(int position); +Variant f_mb_ereg_search(CStrRef pattern = null_string, CStrRef option = null_string); +Variant f_mb_ereg(CVarRef pattern, CStrRef str, Variant regs = null); +Variant f_mb_eregi_replace(CVarRef pattern, CStrRef replacement, CStrRef str, CStrRef option = null_string); +Variant f_mb_eregi(CVarRef pattern, CStrRef str, Variant regs = null); +Variant f_mb_get_info(CStrRef type = null_string); +Variant f_mb_http_input(CStrRef type = null_string); +Variant f_mb_http_output(CStrRef encoding = null_string); +Variant f_mb_internal_encoding(CStrRef encoding = null_string); +Variant f_mb_language(CStrRef language = null_string); +String f_mb_output_handler(CStrRef contents, int status); +bool f_mb_parse_str(CStrRef encoded_string, Variant result = null); +Variant f_mb_preferred_mime_name(CStrRef encoding); +Variant f_mb_regex_encoding(CStrRef encoding = null_string); +String f_mb_regex_set_options(CStrRef options = null_string); +bool f_mb_send_mail(CStrRef to, CStrRef subject, CStrRef message, CStrRef headers = null_string, CStrRef extra_cmd = null_string); +Variant f_mb_split(CStrRef pattern, CStrRef str, int count = -1); +Variant f_mb_strcut(CStrRef str, int start, int length = 0x7FFFFFFF, CStrRef encoding = null_string); +Variant f_mb_strimwidth(CStrRef str, int start, int width, CStrRef trimmarker = null_string, CStrRef encoding = null_string); +Variant f_mb_stripos(CStrRef haystack, CStrRef needle, int offset = 0, CStrRef encoding = null_string); +Variant f_mb_stristr(CStrRef haystack, CStrRef needle, bool part = false, CStrRef encoding = null_string); +Variant f_mb_strlen(CStrRef str, CStrRef encoding = null_string); +Variant f_mb_strpos(CStrRef haystack, CStrRef needle, int offset = 0, CStrRef encoding = null_string); +Variant f_mb_strrchr(CStrRef haystack, CStrRef needle, bool part = false, CStrRef encoding = null_string); +Variant f_mb_strrichr(CStrRef haystack, CStrRef needle, bool part = false, CStrRef encoding = null_string); +Variant f_mb_strripos(CStrRef haystack, CStrRef needle, int offset = 0, CStrRef encoding = null_string); +Variant f_mb_strrpos(CStrRef haystack, CStrRef needle, CVarRef offset = 0LL, CStrRef encoding = null_string); +Variant f_mb_strstr(CStrRef haystack, CStrRef needle, bool part = false, CStrRef encoding = null_string); +Variant f_mb_strtolower(CStrRef str, CStrRef encoding = null_string); +Variant f_mb_strtoupper(CStrRef str, CStrRef encoding = null_string); +Variant f_mb_strwidth(CStrRef str, CStrRef encoding = null_string); +Variant f_mb_substitute_character(CVarRef substrchar = null_variant); +Variant f_mb_substr_count(CStrRef haystack, CStrRef needle, CStrRef encoding = null_string); +Variant f_mb_substr(CStrRef str, int start, int length = 0x7FFFFFFF, CStrRef encoding = null_string); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_MB_H__ diff --git a/src/cpp/ext/ext_mcrypt.cpp b/src/cpp/ext/ext_mcrypt.cpp new file mode 100644 index 0000000000000..15e0d1320a078 --- /dev/null +++ b/src/cpp/ext/ext_mcrypt.cpp @@ -0,0 +1,589 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +#include +#include +#include + +#define NON_FREE +#define MCRYPT2 +#include + +namespace HPHP { + +/////////////////////////////////////////////////////////////////////////////// + +class MCrypt : public SweepableResourceData { +public: + MCrypt(MCRYPT td) : m_td(td), m_init(false) { + } + + ~MCrypt() { + close(); + } + + void close() { + if (m_td != MCRYPT_FAILED) { + mcrypt_generic_deinit(m_td); + mcrypt_module_close(m_td); + m_td = MCRYPT_FAILED; + } + } + + // overriding ResourceData + const char *o_getClassName() const { return "MCrypt";} + + MCRYPT m_td; + bool m_init; +}; + +typedef enum { + RANDOM = 0, + URANDOM, + RAND +} iv_source; + +class mcrypt_data { +public: + std::string algorithms_dir; + std::string modes_dir; +}; +static mcrypt_data s_globals; +#define MCG(n) (s_globals.n) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MCRYPT_OPEN_MODULE_FAILED "Module initialization failed" + +static Variant php_mcrypt_do_crypt(CStrRef cipher, CStrRef key, CStrRef data, + CStrRef mode, CStrRef iv, bool dencrypt) { + MCRYPT td = mcrypt_module_open((char*)cipher.data(), + (char*)MCG(algorithms_dir).data(), + (char*)mode.data(), + (char*)MCG(modes_dir).data()); + if (td == MCRYPT_FAILED) { + Logger::Warning(MCRYPT_OPEN_MODULE_FAILED); + return false; + } + + /* Checking for key-length */ + int max_key_length = mcrypt_enc_get_key_size(td); + if (key.size() > max_key_length) { + Logger::Warning("Size of key is too large for this algorithm"); + } + int count; + int *key_length_sizes = mcrypt_enc_get_supported_key_sizes(td, &count); + int use_key_length; + char *key_s = NULL; + if (count == 0 && key_length_sizes == NULL) { // all lengths 1 - k_l_s = OK + use_key_length = key.size(); + key_s = (char*)malloc(use_key_length); + memcpy(key_s, key.data(), use_key_length); + } else if (count == 1) { /* only m_k_l = OK */ + key_s = (char*)malloc(key_length_sizes[0]); + memset(key_s, 0, key_length_sizes[0]); + memcpy(key_s, key.data(), MIN(key.size(), key_length_sizes[0])); + use_key_length = key_length_sizes[0]; + } else { /* dertermine smallest supported key > length of requested key */ + use_key_length = max_key_length; /* start with max key length */ + for (int i = 0; i < count; i++) { + if (key_length_sizes[i] >= key.size() && + key_length_sizes[i] < use_key_length) { + use_key_length = key_length_sizes[i]; + } + } + key_s = (char*)malloc(use_key_length); + memset(key_s, 0, use_key_length); + memcpy(key_s, key.data(), MIN(key.size(), use_key_length)); + } + mcrypt_free(key_length_sizes); + + /* Check IV */ + char *iv_s = NULL; + int iv_size = mcrypt_enc_get_iv_size(td); + if (!iv.empty()) { + if (iv_size != iv.size()) { + Logger::Warning("The IV parameter must be as long as the blocksize"); + } else { + iv_s = (char*)malloc(iv_size + 1); + memcpy(iv_s, iv.data(), iv_size); + } + } else if (iv_size != 0) { + Logger::Warning("Attempt to use an empty IV, which is NOT recommended"); + iv_s = (char*)malloc(iv_size + 1); + memset(iv_s, 0, iv_size + 1); + } + + int block_size; + unsigned long int data_size; + char *data_s; + /* Check blocksize */ + if (mcrypt_enc_is_block_mode(td) == 1) { /* It's a block algorithm */ + block_size = mcrypt_enc_get_block_size(td); + data_size = (((data.size() - 1) / block_size) + 1) * block_size; + data_s = (char*)malloc(data_size + 1); + memset(data_s, 0, data_size); + memcpy(data_s, data.data(), data.size()); + } else { /* It's not a block algorithm */ + data_size = data.size(); + data_s = (char*)malloc(data_size + 1); + memcpy(data_s, data.data(), data.size()); + } + + if (mcrypt_generic_init(td, key_s, use_key_length, iv_s) < 0) { + Logger::Warning("Mcrypt initialisation failed"); + return false; + } + if (dencrypt) { + mdecrypt_generic(td, data_s, data_size); + } else { + mcrypt_generic(td, data_s, data_size); + } + data_s[data_size] = '\0'; + + String ret(data_s, data_size, AttachString); + + /* freeing vars */ + mcrypt_generic_end(td); + if (key_s != NULL) { + free(key_s); + } + if (iv_s != NULL) { + free(iv_s); + } + return ret; +} + +static Variant mcrypt_generic(CObjRef td, CStrRef data, bool dencrypt) { + MCrypt *pm = td.getTyped(); + if (!pm->m_init) { + Logger::Warning("Operation disallowed prior to mcrypt_generic_init()."); + return false; + } + + if (data.empty()) { + Logger::Warning("An empty string was passed"); + return false; + } + + unsigned char* data_s; + int block_size, data_size; + /* Check blocksize */ + if (mcrypt_enc_is_block_mode(pm->m_td) == 1) { /* It's a block algorithm */ + block_size = mcrypt_enc_get_block_size(pm->m_td); + data_size = (((data.size() - 1) / block_size) + 1) * block_size; + data_s = (unsigned char*)malloc(data_size + 1); + memset(data_s, 0, data_size); + memcpy(data_s, data.data(), data.size()); + } else { /* It's not a block algorithm */ + data_size = data.size(); + data_s = (unsigned char*)malloc(data_size + 1); + memcpy(data_s, data.data(), data.size()); + } + + if (dencrypt) { + mdecrypt_generic(pm->m_td, data_s, data_size); + } else { + mcrypt_generic(pm->m_td, data_s, data_size); + } + data_s[data_size] = '\0'; + return String((char*)data_s, data_size, AttachString); +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_mcrypt_module_open(CStrRef algorithm, CStrRef algorithm_directory, + CStrRef mode, CStrRef mode_directory) { + MCRYPT td = mcrypt_module_open + ((char*)algorithm.data(), + (char*)(algorithm_directory.empty() ? MCG(algorithms_dir).data() : + algorithm_directory.data()), + (char*)mode.data(), + (char*)(mode_directory.empty() ? (char*)MCG(modes_dir).data() : + mode_directory.data())); + + if (td == MCRYPT_FAILED) { + Logger::Warning("Could not open encryption module"); + return false; + } + + return Object(new MCrypt(td)); +} + +bool f_mcrypt_module_close(CObjRef td) { + td.getTyped()->close(); + return true; +} + +Array f_mcrypt_list_algorithms(CStrRef lib_dir /* = null_string */) { + String dir = lib_dir.empty() ? MCG(algorithms_dir) : lib_dir; + + int count = 0; + char **modules = mcrypt_list_algorithms((char*)dir.data(), &count); + if (count == 0) { + Logger::Warning("No algorithms found in module dir"); + } + Array ret = Array::Create(); + for (int i = 0; i < count; i++) { + ret.append(String(modules[i], CopyString)); + } + mcrypt_free_p(modules, count); + return ret; +} + +Array f_mcrypt_list_modes(CStrRef lib_dir /* = null_string */) { + String dir = lib_dir.empty() ? MCG(modes_dir) : lib_dir; + + int count = 0; + char **modules = mcrypt_list_modes((char*)dir.data(), &count); + if (count == 0) { + Logger::Warning("No modes found in module dir"); + } + Array ret = Array::Create(); + for (int i = 0; i < count; i++) { + ret.append(String(modules[i], CopyString)); + } + mcrypt_free_p(modules, count); + return ret; +} + +int f_mcrypt_module_get_algo_block_size(CStrRef algorithm, + CStrRef lib_dir /* = null_string */) { + String dir = lib_dir.empty() ? MCG(algorithms_dir) : lib_dir; + return mcrypt_module_get_algo_block_size((char*)algorithm.data(), + (char*)dir.data()); +} + +int f_mcrypt_module_get_algo_key_size(CStrRef algorithm, + CStrRef lib_dir /* = null_string */) { + String dir = lib_dir.empty() ? MCG(algorithms_dir) : lib_dir; + return mcrypt_module_get_algo_key_size((char*)algorithm.data(), + (char*)dir.data()); +} + +Array f_mcrypt_module_get_supported_key_sizes(CStrRef algorithm, + CStrRef lib_dir /* = null_string */) { + String dir = lib_dir.empty() ? MCG(algorithms_dir) : lib_dir; + + int count = 0; + int *key_sizes = mcrypt_module_get_algo_supported_key_sizes + ((char*)algorithm.data(), (char*)dir.data(), &count); + + Array ret = Array::Create(); + for (int i = 0; i < count; i++) { + ret.append(key_sizes[i]); + } + mcrypt_free(key_sizes); + return ret; +} + +bool f_mcrypt_module_is_block_algorithm_mode(CStrRef mode, + CStrRef lib_dir /* = null_string */) { + String dir = lib_dir.empty() ? MCG(modes_dir) : lib_dir; + return mcrypt_module_is_block_algorithm_mode((char*)mode.data(), + (char*)dir.data()) == 1; +} + +bool f_mcrypt_module_is_block_algorithm(CStrRef algorithm, + CStrRef lib_dir /* = null_string */) { + String dir = lib_dir.empty() ? MCG(algorithms_dir) : lib_dir; + return mcrypt_module_is_block_algorithm((char*)algorithm.data(), + (char*)dir.data()) == 1; +} + +bool f_mcrypt_module_is_block_mode(CStrRef mode, + CStrRef lib_dir /* = null_string */) { + String dir = lib_dir.empty() ? MCG(modes_dir) : lib_dir; + return mcrypt_module_is_block_mode((char*)mode.data(), + (char*)dir.data()) == 1; +} + +bool f_mcrypt_module_self_test(CStrRef algorithm, + CStrRef lib_dir /* = null_string */) { + String dir = lib_dir.empty() ? MCG(algorithms_dir) : lib_dir; + return mcrypt_module_self_test((char*)algorithm.data(), + (char*)dir.data()) == 0; +} + +Variant f_mcrypt_create_iv(int size, int source /* = 0 */) { + if (size <= 0 || size >= INT_MAX) { + Logger::Warning("Can not create an IV with a size of less then 1 or " + "greater then %d", INT_MAX); + return false; + } + + int n = 0; + char *iv = (char*)calloc(size + 1, 1); + if (source == RANDOM || source == URANDOM) { + int fd = open(source == RANDOM ? "/dev/random" : "/dev/urandom", O_RDONLY); + if (fd < 0) { + free(iv); + Logger::Warning("Cannot open source device"); + return false; + } + int read_bytes; + for (read_bytes = 0; read_bytes < size && n >= 0; read_bytes += n) { + n = read(fd, iv + read_bytes, size - read_bytes); + } + n = read_bytes; + close(fd); + if (n < size) { + free(iv); + Logger::Warning("Could not gather sufficient random data"); + return false; + } + } else { + n = size; + while (size) { + iv[--size] = (char)(255.0 * rand() / RAND_MAX); + } + } + return String(iv, n, AttachString); +} + +Variant f_mcrypt_encrypt(CStrRef cipher, CStrRef key, CStrRef data, + CStrRef mode, CStrRef iv /* = null_string */) { + return php_mcrypt_do_crypt(cipher, key, data, mode, iv, false); +} + +Variant f_mcrypt_decrypt(CStrRef cipher, CStrRef key, CStrRef data, + CStrRef mode, CStrRef iv /* = null_string */) { + return php_mcrypt_do_crypt(cipher, key, data, mode, iv, true); +} + +Variant f_mcrypt_cbc(CStrRef cipher, CStrRef key, CStrRef data, int mode, + CStrRef iv /* = null_string */) { + return php_mcrypt_do_crypt(cipher, key, data, "cbc", iv, mode); +} + +Variant f_mcrypt_cfb(CStrRef cipher, CStrRef key, CStrRef data, int mode, + CStrRef iv /* = null_string */) { + return php_mcrypt_do_crypt(cipher, key, data, "cfb", iv, mode); +} + +Variant f_mcrypt_ecb(CStrRef cipher, CStrRef key, CStrRef data, int mode, + CStrRef iv /* = null_string */) { + return php_mcrypt_do_crypt(cipher, key, data, "ecb", iv, mode); +} + +Variant f_mcrypt_ofb(CStrRef cipher, CStrRef key, CStrRef data, int mode, + CStrRef iv /* = null_string */) { + return php_mcrypt_do_crypt(cipher, key, data, "ofb", iv, mode); +} + +Variant f_mcrypt_get_block_size(CStrRef cipher, CStrRef module /* = null_string */) { + MCRYPT td = mcrypt_module_open((char*)cipher.data(), + (char*)MCG(algorithms_dir).data(), + (char*)module.data(), + (char*)MCG(modes_dir).data()); + if (td == MCRYPT_FAILED) { + Logger::Warning(MCRYPT_OPEN_MODULE_FAILED); + return false; + } + + int64 ret = mcrypt_enc_get_block_size(td); + mcrypt_module_close(td); + return ret; +} + +Variant f_mcrypt_get_cipher_name(CStrRef cipher) { + MCRYPT td = mcrypt_module_open((char*)cipher.data(), + (char*)MCG(algorithms_dir).data(), + (char*)"ecb", + (char*)MCG(modes_dir).data()); + if (td == MCRYPT_FAILED) { + td = mcrypt_module_open((char*)cipher.data(), + (char*)MCG(algorithms_dir).data(), + (char*)"stream", + (char*)MCG(modes_dir).data()); + if (td == MCRYPT_FAILED) { + Logger::Warning(MCRYPT_OPEN_MODULE_FAILED); + return false; + } + } + + char *cipher_name = mcrypt_enc_get_algorithms_name(td); + mcrypt_module_close(td); + String ret(cipher_name, CopyString); + mcrypt_free(cipher_name); + return ret; +} + +Variant f_mcrypt_get_iv_size(CStrRef cipher, CStrRef mode) { + MCRYPT td = mcrypt_module_open((char*)cipher.data(), + (char*)MCG(algorithms_dir).data(), + (char*)mode.data(), + (char*)MCG(modes_dir).data()); + if (td == MCRYPT_FAILED) { + Logger::Warning(MCRYPT_OPEN_MODULE_FAILED); + return false; + } + + int64 ret = mcrypt_enc_get_iv_size(td); + mcrypt_module_close(td); + return ret; +} + +int f_mcrypt_get_key_size(CStrRef cipher, CStrRef module) { + MCRYPT td = mcrypt_module_open((char*)cipher.data(), + (char*)MCG(algorithms_dir).data(), + (char*)module.data(), + (char*)MCG(modes_dir).data()); + if (td == MCRYPT_FAILED) { + Logger::Warning(MCRYPT_OPEN_MODULE_FAILED); + return false; + } + + int64 ret = mcrypt_enc_get_key_size(td); + mcrypt_module_close(td); + return ret; +} + +String f_mcrypt_enc_get_algorithms_name(CObjRef td) { + char *name = mcrypt_enc_get_algorithms_name(td.getTyped()->m_td); + String ret(name, CopyString); + mcrypt_free(name); + return ret; +} + +int f_mcrypt_enc_get_block_size(CObjRef td) { + return mcrypt_enc_get_block_size(td.getTyped()->m_td); +} + +int f_mcrypt_enc_get_iv_size(CObjRef td) { + return mcrypt_enc_get_iv_size(td.getTyped()->m_td); +} + +int f_mcrypt_enc_get_key_size(CObjRef td) { + return mcrypt_enc_get_key_size(td.getTyped()->m_td); +} + +String f_mcrypt_enc_get_modes_name(CObjRef td) { + char *name = mcrypt_enc_get_modes_name(td.getTyped()->m_td); + String ret(name, CopyString); + mcrypt_free(name); + return ret; +} + +Array f_mcrypt_enc_get_supported_key_sizes(CObjRef td) { + int count = 0; + int *key_sizes = + mcrypt_enc_get_supported_key_sizes(td.getTyped()->m_td, &count); + + Array ret = Array::Create(); + for (int i = 0; i < count; i++) { + ret.append(key_sizes[i]); + } + mcrypt_free(key_sizes); + return ret; +} + +bool f_mcrypt_enc_is_block_algorithm_mode(CObjRef td) { + return mcrypt_enc_is_block_algorithm_mode(td.getTyped()->m_td) == 1; +} + +bool f_mcrypt_enc_is_block_algorithm(CObjRef td) { + return mcrypt_enc_is_block_algorithm(td.getTyped()->m_td) == 1; +} + +bool f_mcrypt_enc_is_block_mode(CObjRef td) { + return mcrypt_enc_is_block_mode(td.getTyped()->m_td) == 1; +} + +int f_mcrypt_enc_self_test(CObjRef td) { + return mcrypt_enc_self_test(td.getTyped()->m_td); +} + +int f_mcrypt_generic_init(CObjRef td, CStrRef key, CStrRef iv) { + MCrypt *pm = td.getTyped(); + int max_key_size = mcrypt_enc_get_key_size(pm->m_td); + int iv_size = mcrypt_enc_get_iv_size(pm->m_td); + + if (key.empty()) { + Logger::Warning("Key size is 0"); + } + + unsigned char *key_s = (unsigned char *)malloc(key.size()); + memset(key_s, 0, key.size()); + + unsigned char *iv_s = (unsigned char *)malloc(iv_size + 1); + memset(iv_s, 0, iv_size + 1); + + int key_size; + if (key.size() > max_key_size) { + Logger::Warning("Key size too large; supplied length: %d, max: %d", + key.size(), max_key_size); + key_size = max_key_size; + } else { + key_size = key.size(); + } + memcpy(key_s, key.data(), key.size()); + + if (iv.size() != iv_size) { + Logger::Warning("Iv size incorrect; supplied length: %d, needed: %d", + iv.size(), iv_size); + } + memcpy(iv_s, iv.data(), iv_size); + + mcrypt_generic_deinit(pm->m_td); + int result = mcrypt_generic_init(pm->m_td, key_s, key_size, iv_s); + + /* If this function fails, close the mcrypt module to prevent crashes + * when further functions want to access this resource */ + if (result < 0) { + pm->close(); + switch (result) { + case -3: + Logger::Warning("Key length incorrect"); + break; + case -4: + Logger::Warning("Memory allocation error"); + break; + case -1: + default: + Logger::Warning("Unknown error"); + break; + } + } + pm->m_init = true; + free(iv_s); + free(key_s); + return result; +} + +Variant f_mcrypt_generic(CObjRef td, CStrRef data) { + return mcrypt_generic(td, data, false); +} + +Variant f_mdecrypt_generic(CObjRef td, CStrRef data) { + return mcrypt_generic(td, data, true); +} + +bool f_mcrypt_generic_deinit(CObjRef td) { + if (mcrypt_generic_deinit(td.getTyped()->m_td) < 0) { + Logger::Warning("Could not terminate encryption specifier"); + return false; + } + return true; +} + +bool f_mcrypt_generic_end(CObjRef td) { + return f_mcrypt_generic_deinit(td); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_mcrypt.h b/src/cpp/ext/ext_mcrypt.h new file mode 100644 index 0000000000000..c906777fc151b --- /dev/null +++ b/src/cpp/ext/ext_mcrypt.h @@ -0,0 +1,69 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_MCRYPT_H__ +#define __EXT_MCRYPT_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_mcrypt_module_open(CStrRef algorithm, CStrRef algorithm_directory, CStrRef mode, CStrRef mode_directory); +bool f_mcrypt_module_close(CObjRef td); +Array f_mcrypt_list_algorithms(CStrRef lib_dir = null_string); +Array f_mcrypt_list_modes(CStrRef lib_dir = null_string); +int f_mcrypt_module_get_algo_block_size(CStrRef algorithm, CStrRef lib_dir = null_string); +int f_mcrypt_module_get_algo_key_size(CStrRef algorithm, CStrRef lib_dir = null_string); +Array f_mcrypt_module_get_supported_key_sizes(CStrRef algorithm, CStrRef lib_dir = null_string); +bool f_mcrypt_module_is_block_algorithm_mode(CStrRef mode, CStrRef lib_dir = null_string); +bool f_mcrypt_module_is_block_algorithm(CStrRef algorithm, CStrRef lib_dir = null_string); +bool f_mcrypt_module_is_block_mode(CStrRef mode, CStrRef lib_dir = null_string); +bool f_mcrypt_module_self_test(CStrRef algorithm, CStrRef lib_dir = null_string); +Variant f_mcrypt_create_iv(int size, int source = 0); +Variant f_mcrypt_encrypt(CStrRef cipher, CStrRef key, CStrRef data, CStrRef mode, CStrRef iv = null_string); +Variant f_mcrypt_decrypt(CStrRef cipher, CStrRef key, CStrRef data, CStrRef mode, CStrRef iv = null_string); +Variant f_mcrypt_cbc(CStrRef cipher, CStrRef key, CStrRef data, int mode, CStrRef iv = null_string); +Variant f_mcrypt_cfb(CStrRef cipher, CStrRef key, CStrRef data, int mode, CStrRef iv = null_string); +Variant f_mcrypt_ecb(CStrRef cipher, CStrRef key, CStrRef data, int mode, CStrRef iv = null_string); +Variant f_mcrypt_ofb(CStrRef cipher, CStrRef key, CStrRef data, int mode, CStrRef iv = null_string); +Variant f_mcrypt_get_block_size(CStrRef cipher, CStrRef module = null_string); +Variant f_mcrypt_get_cipher_name(CStrRef cipher); +Variant f_mcrypt_get_iv_size(CStrRef cipher, CStrRef mode); +int f_mcrypt_get_key_size(CStrRef cipher, CStrRef module); +String f_mcrypt_enc_get_algorithms_name(CObjRef td); +int f_mcrypt_enc_get_block_size(CObjRef td); +int f_mcrypt_enc_get_iv_size(CObjRef td); +int f_mcrypt_enc_get_key_size(CObjRef td); +String f_mcrypt_enc_get_modes_name(CObjRef td); +Array f_mcrypt_enc_get_supported_key_sizes(CObjRef td); +bool f_mcrypt_enc_is_block_algorithm_mode(CObjRef td); +bool f_mcrypt_enc_is_block_algorithm(CObjRef td); +bool f_mcrypt_enc_is_block_mode(CObjRef td); +int f_mcrypt_enc_self_test(CObjRef td); +Variant f_mcrypt_generic(CObjRef td, CStrRef data); +int f_mcrypt_generic_init(CObjRef td, CStrRef key, CStrRef iv); +Variant f_mdecrypt_generic(CObjRef td, CStrRef data); +bool f_mcrypt_generic_deinit(CObjRef td); +bool f_mcrypt_generic_end(CObjRef td); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_MCRYPT_H__ diff --git a/src/cpp/ext/ext_misc.cpp b/src/cpp/ext/ext_misc.cpp new file mode 100644 index 0000000000000..aeab5bc97d845 --- /dev/null +++ b/src/cpp/ext/ext_misc.cpp @@ -0,0 +1,448 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +int f_connection_aborted() { + return f_connection_status() == k_CONNECTION_ABORTED; +} + +int f_connection_status() { + switch (g_context->getConnectionStatus()) { + case ExecutionContext::Normal: return k_CONNECTION_NORMAL; + case ExecutionContext::Aborted: return k_CONNECTION_ABORTED; + case ExecutionContext::TimedOut: return k_CONNECTION_TIMEOUT; + default: + ASSERT(false); + break; + } + return k_CONNECTION_NORMAL; +} + +int f_connection_timeout() { + return f_connection_status() == k_CONNECTION_TIMEOUT; +} + +Variant f_constant(CStrRef name) { + const char *data = name.data(); + int len = name.length(); + char *colon; + if ((colon = (char*)memchr(data, ':', len)) && colon[1] == ':') { + // class constant + int classNameLen = colon - data; + char *constantName = colon + 2; + String className(data, classNameLen, CopyString); + + // translate "self" or "parent" + if (className == "self") { + String this_class = FrameInjection::getClassName(true); + if (this_class.empty()) { + throw FatalErrorException("Cannot access self:: " + "when no class scope is active"); + } else { + className = this_class; + } + } else if (className == "parent") { + String parent_class = FrameInjection::getParentClassName("constant"); + if (parent_class.empty()) { + throw FatalErrorException("Cannot access parent"); + } else { + className = parent_class; + } + } + if (f_class_exists(className)) { // taking care of volatile class + const ClassInfo::ClassInfo *info; + for (const char *parentClass = className.data(); parentClass; + parentClass = info->getParentClass()) { + info = ClassInfo::FindClass(parentClass); + if (!info) { + ASSERT(false); + } + ClassInfo::ConstantInfo *cinfo = info->getConstantInfo(constantName); + // This isn't right, only constants that have scalar values are valid + if (cinfo) return cinfo->value; + } + return null; + } else { + return null; + } + } else { + const ClassInfo::ConstantInfo *cinfo = ClassInfo::FindConstant(name.data()); + // system/uniquely defined scalar constant (must be valid) + if (cinfo) return cinfo->value; + // dynamic/redeclared constant + return ((Globals*)get_global_variables())->getConstant(name.data()); + } +} + +bool f_define(CStrRef name, CVarRef value, + bool case_insensitive /* = false */) { + ASSERT(false); // define() should be turned into constant definition by HPHP + return false; +} + +bool f_defined(CStrRef name) { + const char *data = name.data(); + int len = name.length(); + char *colon; + if ((colon = (char*)memchr(data, ':', len)) && colon[1] == ':') { + // class constant + int classNameLen = colon - data; + char *constantName = colon + 2; + String className(data, classNameLen, CopyString); + + // translate "self" or "parent" + if (className == "self") { + String this_class = FrameInjection::getClassName(true); + if (this_class.empty()) { + throw FatalErrorException("Cannot access self:: " + "when no class scope is active"); + } else { + className = this_class; + } + } else if (className == "parent") { + String parent_class = FrameInjection::getParentClassName("defined"); + if (parent_class.empty()) { + throw FatalErrorException("Cannot access parent"); + } else { + className = parent_class; + } + } + if (f_class_exists(className)) { // taking care of volatile class + const ClassInfo::ClassInfo *info; + for (const char *parentClass = className.data(); + parentClass && *parentClass; + parentClass = info->getParentClass()) { + info = ClassInfo::FindClass(parentClass); + if (!info) { + ASSERT(false); + } + if (info->hasConstant(constantName)) return true; + } + return false; + } else { + return false; + } + } else { + // system/uniquely defined scalar constant + if (ClassInfo::FindConstant(name.data())) return true; + // dynamic/redeclared constant + return ((Globals*)get_global_variables())->defined(name.data()); + } +} + +Variant f_die(CVarRef status /* = null_variant */) { + return f_exit(status); +} + +Variant f_exit(CVarRef status /* = null_variant */) { + if (status.isString()) { + echo(status.toString()); + throw ExitException(0); + } + throw ExitException(status.toInt32()); +} + +Variant f_eval(CStrRef code_str) { + throw NotSupportedException(__func__, "rebuild with eval mode"); +} + +Variant f_get_browser(CStrRef user_agent /* = null_string */, + bool return_array /* = false */) { + throw NotSupportedException(__func__, "bad idea"); +} + +void f___halt_compiler() { + // do nothing +} + +Variant f_highlight_file(CStrRef filename, bool ret /* = false */) { + throw NotSupportedException(__func__, "PHP specific"); +} + +Variant f_show_source(CStrRef filename, bool ret /* = false */) { + throw NotSupportedException(__func__, "PHP specific"); +} + +Variant f_highlight_string(CStrRef str, bool ret /* = false */) { + throw NotSupportedException(__func__, "PHP specific"); +} + +int f_ignore_user_abort(bool setting /* = false */) { + return 0; +} + +String f_pack(int _argc, CStrRef format, CArrRef _argv /* = null_array */) { + return ZendPack().pack(format, _argv); +} + +bool f_php_check_syntax(CStrRef filename, Variant error_message /* = null */) { + throw NotSupportedException(__func__, "PHP specific"); +} + +String f_php_strip_whitespace(CStrRef filename) { + throw NotSupportedException(__func__, "PHP specific"); +} + +int f_sleep(int seconds) { + sleep(seconds); + return 0; +} + +void f_usleep(int micro_seconds) { + usleep(micro_seconds); +} + +Variant f_time_nanosleep(int seconds, int nanoseconds) { + if (seconds < 0) { + throw InvalidArgumentException("seconds", "cannot be negative"); + } + if (nanoseconds < 0 || nanoseconds > 999999999) { + throw InvalidArgumentException("nanoseconds", "has to be 0 to 999999999"); + } + + struct timespec req, rem; + req.tv_sec = (time_t)seconds; + req.tv_nsec = nanoseconds; + if (!nanosleep(&req, &rem)) { + return true; + } + if (errno == EINTR) { + return CREATE_MAP2("seconds", (int64)rem.tv_sec, + "nanoseconds", (int64)rem.tv_nsec); + } + return false; +} + +bool f_time_sleep_until(double timestamp) { + struct timeval tm; + if (gettimeofday((struct timeval *)&tm, NULL) != 0) { + return false; + } + + double c_ts = (double)(timestamp - tm.tv_sec - tm.tv_usec / 1000000.0); + if (c_ts < 0) { + throw InvalidArgumentException + ("timestamp", "Sleep until to time is less than current time"); + } + + struct timespec req, rem; + req.tv_sec = (time_t)c_ts; + req.tv_nsec = (long)((c_ts - req.tv_sec) * 1000000000.0); + while (nanosleep(&req, &rem)) { + if (errno != EINTR) return false; + req.tv_sec = rem.tv_sec; + req.tv_nsec = rem.tv_nsec; + } + + return true; +} + +String f_uniqid(CStrRef prefix /* = null_string */, + bool more_entropy /* = false */) { + if (!more_entropy) { + usleep(1); + } + + struct timeval tv; + gettimeofday((struct timeval *)&tv, NULL); + int sec = (int)tv.tv_sec; + int usec = (int)(tv.tv_usec % 0x100000); + + char uniqid[256]; + if (more_entropy) { + snprintf(uniqid, sizeof(uniqid), "%s%08x%05x%08x", + (const char *)prefix, sec, usec, rand()); + } else { + snprintf(uniqid, sizeof(uniqid), "%s%08x%05x", + (const char *)prefix, sec, usec); + } + return String(uniqid, CopyString); +} + +Array f_unpack(CStrRef format, CStrRef data) { + return ZendPack().unpack(format, data); +} + +Array f_sys_getloadavg() { + double load[3]; + getloadavg(load, 3); + return CREATE_VECTOR3(load[0], load[1], load[2]); +} + + +Array f_token_get_all(CStrRef source) { + const char *input = source.data(); + istringstream iss(input); + stringstream ss; + + istream *is = RuntimeOption::EnableXHP ? preprocessXHP(iss, ss, input) : &iss; + Eval::Scanner scanner(new ylmm::basic_buffer(*is, false, true), + true, false, true); + Eval::Token tok; + ylmm::basic_location loc; + int tokid; + Array res; + while ((tokid = scanner.getNextToken(tok, loc))) { + if (tokid < 256) { + res.append(String::FromChar((char)tokid)); + } else { + Array p = CREATE_VECTOR3(tokid, String(tok.getText()), loc.last_line()); + res.append(p); + } + } + return res; +} + +String f_token_name(int64 token) { + switch (token) { + case 258: return "T_REQUIRE_ONCE"; + case 259: return "T_REQUIRE"; + case 260: return "T_EVAL"; + case 261: return "T_INCLUDE_ONCE"; + case 262: return "T_INCLUDE"; + case 263: return "T_LOGICAL_OR"; + case 264: return "T_LOGICAL_XOR"; + case 265: return "T_LOGICAL_AND"; + case 266: return "T_PRINT"; + case 267: return "T_SR_EQUAL"; + case 268: return "T_SL_EQUAL"; + case 269: return "T_XOR_EQUAL"; + case 270: return "T_OR_EQUAL"; + case 271: return "T_AND_EQUAL"; + case 272: return "T_MOD_EQUAL"; + case 273: return "T_CONCAT_EQUAL"; + case 274: return "T_DIV_EQUAL"; + case 275: return "T_MUL_EQUAL"; + case 276: return "T_MINUS_EQUAL"; + case 277: return "T_PLUS_EQUAL"; + case 278: return "T_BOOLEAN_OR"; + case 279: return "T_BOOLEAN_AND"; + case 280: return "T_IS_NOT_IDENTICAL"; + case 281: return "T_IS_IDENTICAL"; + case 282: return "T_IS_NOT_EQUAL"; + case 283: return "T_IS_EQUAL"; + case 284: return "T_IS_GREATER_OR_EQUAL"; + case 285: return "T_IS_SMALLER_OR_EQUAL"; + case 286: return "T_SR"; + case 287: return "T_SL"; + case 288: return "T_INSTANCEOF"; + case 289: return "T_UNSET_CAST"; + case 290: return "T_BOOL_CAST"; + case 291: return "T_OBJECT_CAST"; + case 292: return "T_ARRAY_CAST"; + case 293: return "T_STRING_CAST"; + case 294: return "T_DOUBLE_CAST"; + case 295: return "T_INT_CAST"; + case 296: return "T_DEC"; + case 297: return "T_INC"; + case 298: return "T_CLONE"; + case 299: return "T_NEW"; + case 300: return "T_EXIT"; + case 301: return "T_IF"; + case 302: return "T_ELSEIF"; + case 303: return "T_ELSE"; + case 304: return "T_ENDIF"; + case 305: return "T_LNUMBER"; + case 306: return "T_DNUMBER"; + case 307: return "T_STRING"; + case 308: return "T_STRING_VARNAME"; + case 309: return "T_VARIABLE"; + case 310: return "T_NUM_STRING"; + case 311: return "T_INLINE_HTML"; + case 312: return "T_CHARACTER"; + case 313: return "T_BAD_CHARACTER"; + case 314: return "T_ENCAPSED_AND_WHITESPACE"; + case 315: return "T_CONSTANT_ENCAPSED_STRING"; + case 316: return "T_ECHO"; + case 317: return "T_DO"; + case 318: return "T_WHILE"; + case 319: return "T_ENDWHILE"; + case 320: return "T_FOR"; + case 321: return "T_ENDFOR"; + case 322: return "T_FOREACH"; + case 323: return "T_ENDFOREACH"; + case 324: return "T_DECLARE"; + case 325: return "T_ENDDECLARE"; + case 326: return "T_AS"; + case 327: return "T_SWITCH"; + case 328: return "T_ENDSWITCH"; + case 329: return "T_CASE"; + case 330: return "T_DEFAULT"; + case 331: return "T_BREAK"; + case 332: return "T_CONTINUE"; + case 333: return "T_FUNCTION"; + case 334: return "T_CONST"; + case 335: return "T_RETURN"; + case 336: return "T_TRY"; + case 337: return "T_CATCH"; + case 338: return "T_THROW"; + case 339: return "T_USE"; + case 340: return "T_GLOBAL"; + case 341: return "T_PUBLIC"; + case 342: return "T_PROTECTED"; + case 343: return "T_PRIVATE"; + case 344: return "T_FINAL"; + case 345: return "T_ABSTRACT"; + case 346: return "T_STATIC"; + case 347: return "T_VAR"; + case 348: return "T_UNSET"; + case 349: return "T_ISSET"; + case 350: return "T_EMPTY"; + case 351: return "T_HALT_COMPILER"; + case 352: return "T_CLASS"; + case 353: return "T_INTERFACE"; + case 354: return "T_EXTENDS"; + case 355: return "T_IMPLEMENTS"; + case 356: return "T_OBJECT_OPERATOR"; + case 357: return "T_DOUBLE_ARROW"; + case 358: return "T_LIST"; + case 359: return "T_ARRAY"; + case 360: return "T_CLASS_C"; + case 361: return "T_METHOD_C"; + case 362: return "T_FUNC_C"; + case 363: return "T_LINE"; + case 364: return "T_FILE"; + case 365: return "T_COMMENT"; + case 366: return "T_DOC_COMMENT"; + case 367: return "T_OPEN_TAG"; + case 368: return "T_OPEN_TAG_WITH_ECHO"; + case 369: return "T_CLOSE_TAG"; + case 370: return "T_WHITESPACE"; + case 371: return "T_START_HEREDOC"; + case 372: return "T_END_HEREDOC"; + case 373: return "T_DOLLAR_OPEN_CURLY_BRACES"; + case 374: return "T_CURLY_OPEN"; + case 375: return "T_PAAMAYIM_NEKUDOTAYIM"; + default: + return "UNKNOWN"; + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_misc.h b/src/cpp/ext/ext_misc.h new file mode 100644 index 0000000000000..d59dca1f87a4c --- /dev/null +++ b/src/cpp/ext/ext_misc.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_MISC_H__ +#define __EXT_MISC_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +int f_connection_aborted(); +int f_connection_status(); +int f_connection_timeout(); +Variant f_constant(CStrRef name); +bool f_define(CStrRef name, CVarRef value, bool case_insensitive = false); +bool f_defined(CStrRef name); +Variant f_die(CVarRef status = null_variant); +Variant f_exit(CVarRef status = null_variant); +Variant f_eval(CStrRef code_str); +Variant f_get_browser(CStrRef user_agent = null_string, bool return_array = false); +void f___halt_compiler(); +Variant f_highlight_file(CStrRef filename, bool ret = false); +Variant f_show_source(CStrRef filename, bool ret = false); +Variant f_highlight_string(CStrRef str, bool ret = false); +int f_ignore_user_abort(bool setting = false); +String f_pack(int _argc, CStrRef format, CArrRef _argv = null_array); +bool f_php_check_syntax(CStrRef filename, Variant error_message = null); +String f_php_strip_whitespace(CStrRef filename); +int f_sleep(int seconds); +void f_usleep(int micro_seconds); +Variant f_time_nanosleep(int seconds, int nanoseconds); +bool f_time_sleep_until(double timestamp); +String f_uniqid(CStrRef prefix = null_string, bool more_entropy = false); +Array f_unpack(CStrRef format, CStrRef data); +Array f_sys_getloadavg(); +Array f_token_get_all(CStrRef source); +String f_token_name(int64 token); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_MISC_H__ diff --git a/src/cpp/ext/ext_mysql.cpp b/src/cpp/ext/ext_mysql.cpp new file mode 100644 index 0000000000000..beea51d017c7e --- /dev/null +++ b/src/cpp/ext/ext_mysql.cpp @@ -0,0 +1,1236 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP(MySQLResult); + +MySQLResult::~MySQLResult() { + close(); + if (m_fields) { + for (int i = 0; i < m_field_count; i++) { + MySQLFieldInfo &info = m_fields[i]; + if (info.name) { + DELETE(Variant)(info.name); + DELETE(Variant)(info.table); + DELETE(Variant)(info.def); + } + } + delete[] m_fields; + m_fields = NULL; + } + if (m_rows) { + for (list >::const_iterator it = m_rows->begin(); + it != m_rows->end(); it++) { + for (unsigned int i = 0; i < it->size(); i++) { + DELETE(Variant)((*it)[i]); + } + } + delete m_rows; + m_rows = NULL; + } +} + +void MySQLResult::sweep() { + close(); + // When a dangling MySQLResult is swept, there is no need to deallocate + // any Variant object. + delete[] m_fields; + delete m_rows; +} + +/////////////////////////////////////////////////////////////////////////////// + +class MySQLStaticInitializer { +public: + MySQLStaticInitializer() { + mysql_library_init(0, NULL, NULL); + } +}; +static MySQLStaticInitializer s_mysql_initializer; + +class MySQLRequestData : public RequestEventHandler { +public: + virtual void requestInit() { + defaultConn.reset(); + readTimeout = RuntimeOption::MySQLReadTimeout; + } + + virtual void requestShutdown() { + defaultConn.reset(); + } + + Object defaultConn; + int readTimeout; +}; +static RequestLocal s_mysql_data; + +/////////////////////////////////////////////////////////////////////////////// +// class MySQL statics + +int MySQL::s_default_port = 0; + +MySQL *MySQL::Get(CVarRef link_identifier) { + if (link_identifier.isNull()) { + return GetDefaultConn(); + } + MySQL *mysql = link_identifier.toObject().getTyped + (!RuntimeOption::ThrowBadTypeExceptions, + !RuntimeOption::ThrowBadTypeExceptions); + if (mysql) { + SetDefaultConn(mysql); + } + return mysql; +} + +MYSQL *MySQL::GetConn(CVarRef link_identifier, MySQL **rconn /* = NULL */) { + MySQL *mySQL = Get(link_identifier); + MYSQL *ret = NULL; + if (mySQL) { + ret = mySQL->get(); + } + if (ret == NULL) { + Logger::Warning("supplied argument is not a valid MySQL-Link resource"); + } + if (rconn) { + *rconn = mySQL; + } + return ret; +} + +bool MySQL::CloseConn(CVarRef link_identifier) { + MySQL *mySQL = Get(link_identifier); + if (mySQL) { + mySQL->close(); + } + return true; +} + +int MySQL::GetDefaultPort() { + if (s_default_port <= 0) { + s_default_port = MYSQL_PORT; + char *env = getenv("MYSQL_TCP_PORT"); + if (env && *env) { + s_default_port = atoi(env); + } else { + Variant ret = f_getservbyname("mysql", "tcp"); + if (!same(ret, false)) { + s_default_port = ret.toInt16(); + } + } + } + return s_default_port; +} + +String MySQL::GetHash(CStrRef host, int port, CStrRef socket, CStrRef username, + CStrRef password, int client_flags) { + char buf[1024]; + snprintf(buf, sizeof(buf), "%s:%d:%s:%s:%s:%d", + host.data(), port, socket.data(), + username.data(), password.data(), client_flags); + return String(buf, CopyString); +} + +MySQL *MySQL::GetCachedImpl(const char *name, CStrRef host, int port, + CStrRef socket, CStrRef username, CStrRef password, + int client_flags) { + String key = GetHash(host, port, socket, username, password, client_flags); + return dynamic_cast(g_persistentObjects->get(name, key.data())); +} + +void MySQL::SetCachedImpl(const char *name, CStrRef host, int port, + CStrRef socket, CStrRef username, CStrRef password, + int client_flags, MySQL *conn) { + String key = GetHash(host, port, socket, username, password, client_flags); + g_persistentObjects->set(name, key.data(), conn); +} + +MySQL *MySQL::GetDefaultConn() { + return s_mysql_data->defaultConn.getTyped(true); +} + +void MySQL::SetDefaultConn(MySQL *conn) { + s_mysql_data->defaultConn = conn; +} + +/////////////////////////////////////////////////////////////////////////////// +// class MySQL +enum MysqlTimeoutType { + ConnectTimeout, + ReadTimeout, + WriteTimeout +}; + +// Abstraction of setting timeout so that dependency on mysql customizations +// can be removed. +static int set_mysql_timeout(MYSQL *mysql, MysqlTimeoutType type, int ms) { + mysql_option opt; +#ifdef MYSQL_MILLISECOND_TIMEOUT + switch (type) { + case ConnectTimeout: opt = MYSQL_OPT_CONNECT_TIMEOUT_MS; break; + case ReadTimeout: opt = MYSQL_OPT_READ_TIMEOUT_MS; break; + case WriteTimeout: opt = MYSQL_OPT_WRITE_TIMEOUT_MS; break; + default: ASSERT(false); break; + } +#else + switch (type) { + case ConnectTimeout: opt = MYSQL_OPT_CONNECT_TIMEOUT; break; + case ReadTimeout: opt = MYSQL_OPT_READ_TIMEOUT; break; + case WriteTimeout: opt = MYSQL_OPT_WRITE_TIMEOUT; break; + default: ASSERT(false); break; + } + ms = (ms + 999) / 1000; +#endif + return mysql_options(mysql, opt, (const char*)&ms); +} + +static MYSQL *create_new_conn() { + MYSQL *ret = mysql_init(NULL); + if (RuntimeOption::MySQLConnectTimeout) { + set_mysql_timeout(ret, ConnectTimeout, RuntimeOption::MySQLConnectTimeout); + } + int readTimeout = s_mysql_data->readTimeout; + if (readTimeout) { + set_mysql_timeout(ret, ReadTimeout, readTimeout); + set_mysql_timeout(ret, WriteTimeout, readTimeout); + } + return ret; +} + +MySQL::MySQL(const char *host, int port, const char *username, + const char *password) : m_port(port) { + if (host) m_host = host; + if (username) m_username = username; + if (password) m_password = password; + + m_conn = create_new_conn(); +} + +MySQL::~MySQL() { + close(); +} + +void MySQL::close() { + if (m_conn) { + mysql_close(m_conn); + m_conn = NULL; + } +} + +bool MySQL::connect(CStrRef host, int port, CStrRef socket, CStrRef username, + CStrRef password, int client_flags, int connect_timeout) { + if (m_conn == NULL) { + m_conn = create_new_conn(); + } + if (connect_timeout >= 0) { + set_mysql_timeout(m_conn, ConnectTimeout, connect_timeout); + } + if (RuntimeOption::EnableStats && RuntimeOption::EnableSQLStats) { + ServerStats::Log("sql.conn", 1); + } + return mysql_real_connect(m_conn, host.data(), username.data(), + password.data(), NULL, port, socket.data(), + client_flags); +} + +bool MySQL::reconnect(CStrRef host, int port, CStrRef socket, CStrRef username, + CStrRef password, int client_flags, + int connect_timeout) { + if (m_conn == NULL) { + m_conn = create_new_conn(); + if (connect_timeout >= 0) { + set_mysql_timeout(m_conn, ConnectTimeout, connect_timeout); + } + if (RuntimeOption::EnableStats && RuntimeOption::EnableSQLStats) { + ServerStats::Log("sql.reconn_new", 1); + } + return mysql_real_connect(m_conn, host.data(), username.data(), + password.data(), NULL, port, socket.data(), + client_flags); + } + + if (!mysql_ping(m_conn)) { + if (RuntimeOption::EnableStats && RuntimeOption::EnableSQLStats) { + ServerStats::Log("sql.reconn_ok", 1); + } + return true; + } + + if (connect_timeout >= 0) { + set_mysql_timeout(m_conn, ConnectTimeout, connect_timeout); + } + if (RuntimeOption::EnableStats && RuntimeOption::EnableSQLStats) { + ServerStats::Log("sql.reconn_old", 1); + } + return mysql_real_connect(m_conn, host.data(), username.data(), + password.data(), NULL, port, socket.data(), + client_flags); +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +static MySQLResult *get_result(CVarRef result) { + MySQLResult *res = result.toObject().getTyped + (!RuntimeOption::ThrowBadTypeExceptions, + !RuntimeOption::ThrowBadTypeExceptions); + if (res == NULL || (res->get() == NULL && !res->isLocalized())) { + Logger::Warning("supplied argument is not a valid MySQL result resource"); + } + return res; +} + +static const char *php_mysql_get_field_name(int field_type) { + switch (field_type) { + case FIELD_TYPE_STRING: + case FIELD_TYPE_VAR_STRING: + return "string"; + case FIELD_TYPE_TINY: + case FIELD_TYPE_SHORT: + case FIELD_TYPE_LONG: + case FIELD_TYPE_LONGLONG: + case FIELD_TYPE_INT24: + return "int"; + case FIELD_TYPE_FLOAT: + case FIELD_TYPE_DOUBLE: + case FIELD_TYPE_DECIMAL: + //case FIELD_TYPE_NEWDECIMAL: + return "real"; + case FIELD_TYPE_TIMESTAMP: + return "timestamp"; + case FIELD_TYPE_YEAR: + return "year"; + case FIELD_TYPE_DATE: + case FIELD_TYPE_NEWDATE: + return "date"; + case FIELD_TYPE_TIME: + return "time"; + case FIELD_TYPE_SET: + return "set"; + case FIELD_TYPE_ENUM: + return "enum"; + case FIELD_TYPE_GEOMETRY: + return "geometry"; + case FIELD_TYPE_DATETIME: + return "datetime"; + case FIELD_TYPE_TINY_BLOB: + case FIELD_TYPE_MEDIUM_BLOB: + case FIELD_TYPE_LONG_BLOB: + case FIELD_TYPE_BLOB: + return "blob"; + case FIELD_TYPE_NULL: + return "null"; + default: + break; + } + return "unknown"; +} + +#define PHP_MYSQL_FIELD_NAME 1 +#define PHP_MYSQL_FIELD_TABLE 2 +#define PHP_MYSQL_FIELD_LEN 3 +#define PHP_MYSQL_FIELD_TYPE 4 +#define PHP_MYSQL_FIELD_FLAGS 5 + +static Variant php_mysql_field_info(CVarRef result, int field, + int entry_type) { + MySQLResult *res = get_result(result); + if (res == NULL) return false; + + if (!res->seekField(field)) return false; + + MySQLFieldInfo *info; + if (!(info = res->fetchFieldInfo())) return false; + + switch (entry_type) { + case PHP_MYSQL_FIELD_NAME: + return *(info->name); + case PHP_MYSQL_FIELD_TABLE: + return *(info->table); + case PHP_MYSQL_FIELD_LEN: + return info->length; + case PHP_MYSQL_FIELD_TYPE: + return php_mysql_get_field_name(info->type); + case PHP_MYSQL_FIELD_FLAGS: + { + char buf[512]; + buf[0] = '\0'; + unsigned int flags = info->flags; +#ifdef IS_NOT_NULL + if (IS_NOT_NULL(flags)) { + strcat(buf, "not_null "); + } +#endif +#ifdef IS_PRI_KEY + if (IS_PRI_KEY(flags)) { + strcat(buf, "primary_key "); + } +#endif +#ifdef UNIQUE_KEY_FLAG + if (flags & UNIQUE_KEY_FLAG) { + strcat(buf, "unique_key "); + } +#endif +#ifdef MULTIPLE_KEY_FLAG + if (flags & MULTIPLE_KEY_FLAG) { + strcat(buf, "multiple_key "); + } +#endif +#ifdef IS_BLOB + if (IS_BLOB(flags)) { + strcat(buf, "blob "); + } +#endif +#ifdef UNSIGNED_FLAG + if (flags & UNSIGNED_FLAG) { + strcat(buf, "unsigned "); + } +#endif +#ifdef ZEROFILL_FLAG + if (flags & ZEROFILL_FLAG) { + strcat(buf, "zerofill "); + } +#endif +#ifdef BINARY_FLAG + if (flags & BINARY_FLAG) { + strcat(buf, "binary "); + } +#endif +#ifdef ENUM_FLAG + if (flags & ENUM_FLAG) { + strcat(buf, "enum "); + } +#endif +#ifdef SET_FLAG + if (flags & SET_FLAG) { + strcat(buf, "set "); + } +#endif +#ifdef AUTO_INCREMENT_FLAG + if (flags & AUTO_INCREMENT_FLAG) { + strcat(buf, "auto_increment "); + } +#endif +#ifdef TIMESTAMP_FLAG + if (flags & TIMESTAMP_FLAG) { + strcat(buf, "timestamp "); + } +#endif + int len = strlen(buf); + /* remove trailing space, if present */ + if (len && buf[len-1] == ' ') { + buf[len-1] = 0; + len--; + } + + return String(buf, len, CopyString); + } + default: + break; + } + return false; +} + +static Variant php_mysql_do_connect(String server, String username, + String password, int client_flags, + bool persistent, + int connect_timeout_ms, + int query_timeout_ms) { + if (connect_timeout_ms < 0) { + connect_timeout_ms = RuntimeOption::MySQLConnectTimeout; + } + if (query_timeout_ms < 0) { + query_timeout_ms = s_mysql_data->readTimeout; + } + if (server.empty()) server = MySQL::GetDefaultServer(); + if (username.empty()) username = MySQL::GetDefaultUsername(); + if (password.empty()) password = MySQL::GetDefaultPassword(); + + // server format: hostname[:port][:/path/to/socket] + String host, socket; + int port = MYSQL_PORT; + int pos = server.find(':'); + if (pos >= 0) { + host = server.substr(0, pos); + if (server.charAt(pos + 1) != '/') { + String sport = server.substr(pos + 1); + port = sport.toInt32(); + pos = sport.find(':'); + if (pos >= 0) { + socket = sport.substr(pos + 1); + } + } else { + socket = server.substr(pos + 1); + } + } else { + host = server; + port = MySQL::GetDefaultPort(); + } + if (socket.empty()) { + socket = MySQL::GetDefaultSocket(); + } + + Object ret; + MySQL *mySQL = NULL; + if (persistent) { + mySQL = MySQL::GetPersistent(host, port, socket, username, password, + client_flags); + } + + if (mySQL == NULL) { + mySQL = new MySQL(host, port, username, password); + ret = mySQL; + if (!mySQL->connect(host, port, socket, username, password, + client_flags, connect_timeout_ms)) { + return false; + } + } else { + ret = mySQL; + if (!mySQL->reconnect(host, port, socket, username, password, + client_flags, connect_timeout_ms)) { + return false; + } + } + + if (persistent) { + MySQL::SetPersistent(host, port, socket, username, password, + client_flags, mySQL); + } + MySQL::SetDefaultConn(mySQL); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_mysql_connect(CStrRef server /* = null_string */, + CStrRef username /* = null_string */, + CStrRef password /* = null_string */, + bool new_link /* = false */, + int client_flags /* = 0 */, + int connect_timeout_ms /* = -1 */, + int query_timeout_ms /* = -1 */) { + return php_mysql_do_connect(server, username, password, client_flags, false, + connect_timeout_ms, query_timeout_ms); +} + +Variant f_mysql_pconnect(CStrRef server /* = null_string */, + CStrRef username /* = null_string */, + CStrRef password /* = null_string */, + int client_flags /* = 0 */, + int connect_timeout_ms /* = -1 */, + int query_timeout_ms /* = -1 */) { + return php_mysql_do_connect(server, username, password, client_flags, true, + connect_timeout_ms, query_timeout_ms); +} + +bool f_mysql_set_timeout(int query_timeout_ms /* = -1 */, + CVarRef link_identifier /* = null */) { + if (query_timeout_ms < 0) { + query_timeout_ms = RuntimeOption::MySQLReadTimeout; + } + s_mysql_data->readTimeout = query_timeout_ms; + return true; +} + +String f_mysql_escape_string(CStrRef unescaped_string) { + char *new_str = (char *)malloc(unescaped_string.size() * 2 + 1); + int new_len = mysql_escape_string(new_str, unescaped_string.data(), + unescaped_string.size()); + return String(new_str, new_len, AttachString); +} + +Variant f_mysql_real_escape_string(CStrRef unescaped_string, + CVarRef link_identifier /* = null */) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (conn) { + char *new_str = (char *)malloc(unescaped_string.size() * 2 + 1); + int new_len = mysql_real_escape_string(conn, new_str, + unescaped_string.data(), + unescaped_string.size()); + return String(new_str, new_len, AttachString); + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// query functions + +static Variant mysql_makevalue(CStrRef data, MYSQL_FIELD *mysql_field) { + switch (mysql_field->type) { + case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_TINY: + case MYSQL_TYPE_SHORT: + case MYSQL_TYPE_LONG: + case MYSQL_TYPE_LONGLONG: + case MYSQL_TYPE_INT24: + case MYSQL_TYPE_YEAR: + return data.toInt64(); + case MYSQL_TYPE_FLOAT: + case MYSQL_TYPE_DOUBLE: + //case MYSQL_TYPE_NEWDECIMAL: + return data.toDouble(); + case MYSQL_TYPE_NULL: + return null; + default: + break; + } + return data; +} + +extern "C" { +struct MEM_ROOT; +unsigned long cli_safe_read(MYSQL *); +unsigned long net_field_length(unsigned char **); +void free_root(::MEM_ROOT *, int); +} + +static bool php_mysql_read_rows(MYSQL *mysql, CVarRef result) { + unsigned long pkt_len; + unsigned char *cp; + unsigned int fields = mysql->field_count; + NET *net = &mysql->net; + MySQLResult *res = get_result(result); + + if ((pkt_len = cli_safe_read(mysql)) == packet_error) { + return false; + } + + res->setFieldCount((int64)fields); + + // localizes all the rows + while (*(cp = net->read_pos) != 254 || pkt_len >= 8) { + res->addRow(); + for (unsigned int i = 0; i < fields; i++) { + unsigned long len = net_field_length(&cp); + Variant *data = NEW(Variant)(); + if (len != NULL_LENGTH) { + *data = mysql_makevalue(String((char *)cp, len, CopyString), + mysql->fields + i); + cp += len; + if (mysql->fields) { + if (mysql->fields[i].max_length < len) + mysql->fields[i].max_length = len; + } + } + res->addField(data); + } + if ((pkt_len = cli_safe_read(mysql)) == packet_error) { + return false; + } + } + + // localizes all the field info + for (unsigned int i = 0; i < fields; i++) { + res->setFieldInfo((int64)i, mysql->fields + i); + } + + return true; +} + +static Variant php_mysql_localize_result(MYSQL *mysql) { + mysql = mysql->last_used_con; + if (!mysql->fields) return true; + if (mysql->status != MYSQL_STATUS_GET_RESULT) { + // consistent with php_mysql_do_query_general + return true; + } + mysql->status = MYSQL_STATUS_READY; + Variant result = Object(NEW(MySQLResult)(NULL, true)); + if (!php_mysql_read_rows(mysql, result)) { + return true; + } + + // clean up + if (mysql->fields) { + free_root(&mysql->field_alloc, 0); + } + mysql->unbuffered_fetch_owner = 0; + + return result; +} + +static Variant php_mysql_do_query_general(CStrRef query, CVarRef link_id, + bool use_store) { + if (RuntimeOption::MySQLReadOnly && + same(f_preg_match("/^((\\/\\*.*?\\*\\/)|\\(|\\s)*select/i", query), 0)) { + Logger::Verbose("cpp/ext_mysql: write query not executed [%s]", + query.data()); + return true; // pretend it worked + } + + MySQL *rconn = NULL; + MYSQL *conn = MySQL::GetConn(link_id, &rconn); + if (!conn || !rconn) return false; + + if (RuntimeOption::EnableStats && RuntimeOption::EnableSQLStats) { + ServerStats::Log("sql.query", 1); + + Variant matches; + f_preg_match("/^(?:(?:\\/\\*.*?\\*\\/)|\\(|\\s)*(?:" + "(insert).*?\\s+(?:into\\s+)?([^\\s]+)|" + "(update)\\s+([^\\s]+)|" + "(replace).*?\\s+into\\s+([^\\s]+)|" + "(delete).*?\\s+from\\s+([^\\s]+)|" + "(select).*?[\\s`]+from\\s+([^\\s]+))/is", + query, ref(matches)); + int size = matches.toArray().size(); + if (size > 2) { + string verb = Util::toLower(matches[size - 2].toString().data()); + string table = Util::toLower(matches[size - 1].toString().data()); + if (!table.empty() && table[0] == '`') { + table = table.substr(1, table.length() - 2); + } + ServerStats::Log(string("sql.query.") + table + "." + verb, 1); + } else { + f_preg_match("/^(?:(?:\\/\\*.*?\\*\\/)|\\(|\\s)*" + "(begin|commit|rollback)/is", + query, ref(matches)); + size = matches.toArray().size(); + if (size == 2) { + string verb = Util::toLower(matches[1].toString().data()); + ServerStats::Log(string("sql.query.") + verb, 1); + } else { + Logger::Error("Unable to record MySQL stats with: %s", query.data()); + ServerStats::Log("sql.query.unknown", 1); + } + } + } + + SlowTimer timer(RuntimeOption::MySQLSlowQueryThreshold, + "cpp/ext_mysql: slow query", query.data()); + unsigned long tid = mysql_thread_id(conn); + if (mysql_real_query(conn, query.data(), query.size())) { + Logger::Verbose("cpp/ext_mysql: failed executing [%s] [%s]", query.data(), + mysql_error(conn)); + + // When we are timed out, and we're SELECT-ing, we're potentially + // running a long query on the server without waiting for any results + // back, wasting server resource. So we're sending a KILL command + // to see if we can stop the query execution. + if (tid && RuntimeOption::MySQLKillOnTimeout) { + unsigned int errcode = mysql_errno(conn); + if (errcode == 2058 /* CR_NET_READ_INTERRUPTED */ || + errcode == 2059 /* CR_NET_WRITE_INTERRUPTED */) { + Variant ret = f_preg_match("/^((\\/\\*.*?\\*\\/)|\\(|\\s)*select/is", + query); + if (!same(ret, false)) { + MYSQL *new_conn = create_new_conn(); + MYSQL *connected = mysql_real_connect + (new_conn, rconn->m_host.c_str(), rconn->m_username.c_str(), + rconn->m_password.c_str(), NULL, rconn->m_port, NULL, 0); + if (connected) { + string killsql = "KILL " + boost::lexical_cast(tid); + if (mysql_real_query(connected, killsql.c_str(), killsql.size())) { + Logger::Error("Unable to kill thread %llu", tid); + } + } + mysql_close(new_conn); + } + } + } + + return false; + } + Logger::Verbose("cpp/ext_mysql: successfully executed [%dms] [%s]", + (int)timer.getTime(), query.data()); + + MYSQL_RES *mysql_result; + if (use_store) { + if (RuntimeOption::MySQLLocalize) { + return php_mysql_localize_result(conn); + } + mysql_result = mysql_store_result(conn); + } else { + mysql_result = mysql_use_result(conn); + } + if (!mysql_result) { + return true; + } + return Object(NEW(MySQLResult)(mysql_result)); +} + +Variant f_mysql_query(CStrRef query, CVarRef link_identifier /* = null */) { + return php_mysql_do_query_general(query, link_identifier, true); +} + +Variant f_mysql_unbuffered_query(CStrRef query, + CVarRef link_identifier /* = null */) { + return php_mysql_do_query_general(query, link_identifier, false); +} + +Variant f_mysql_list_dbs(CVarRef link_identifier /* = null */) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + MYSQL_RES *res = mysql_list_dbs(conn, NULL); + if (!res) { + Logger::Warning("Unable to save MySQL query result"); + return false; + } + return Object(NEW(MySQLResult)(res)); +} + +Variant f_mysql_list_tables(CStrRef database, + CVarRef link_identifier /* = null */) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + if (mysql_select_db(conn, database.data())) { + return false; + } + MYSQL_RES *res = mysql_list_tables(conn, NULL); + if (!res) { + Logger::Warning("Unable to save MySQL query result"); + return false; + } + return Object(NEW(MySQLResult)(res)); +} + +Variant f_mysql_list_processes(CVarRef link_identifier /* = null */) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + MYSQL_RES *res = mysql_list_processes(conn); + if (!res) { + Logger::Warning("Unable to save MySQL query result"); + return false; + } + return Object(NEW(MySQLResult)(res)); +} + +/////////////////////////////////////////////////////////////////////////////// +// row operations + +bool f_mysql_data_seek(CVarRef result, int row) { + MySQLResult *res = get_result(result); + if (res == NULL) return false; + + return res->seekRow(row); +} + +#define MYSQL_ASSOC 1 << 0 +#define MYSQL_NUM 1 << 1 +#define MYSQL_BOTH (MYSQL_ASSOC|MYSQL_NUM) + +static Variant php_mysql_fetch_hash(CVarRef result, int result_type) { + if ((result_type & MYSQL_BOTH) == 0) { + throw InvalidArgumentException("result_type", result_type); + } + + MySQLResult *res = get_result(result); + if (res == NULL) return false; + + Array ret; + if (res->isLocalized()) { + if (!res->fetchRow()) return false; + + for (int i = 0; i < res->getFieldCount(); i++) { + if (result_type & MYSQL_NUM) { + ret.set(i, res->getField(i)); + } + if (result_type & MYSQL_ASSOC) { + MySQLFieldInfo *info = res->getFieldInfo(i); + ret.set(info->name->toString(), res->getField(i)); + } + } + return ret; + } + + MYSQL_RES *mysql_result = res->get(); + MYSQL_ROW mysql_row = mysql_fetch_row(mysql_result); + if (!mysql_row) { + return false; + } + unsigned long *mysql_row_lengths = mysql_fetch_lengths(mysql_result); + if (!mysql_row_lengths) { + return false; + } + + mysql_field_seek(mysql_result, 0); + + MYSQL_FIELD *mysql_field; + int i; + for (mysql_field = mysql_fetch_field(mysql_result), i = 0; mysql_field; + mysql_field = mysql_fetch_field(mysql_result), i++) { + Variant data; + if (mysql_row[i]) { + data = mysql_makevalue(String(mysql_row[i], mysql_row_lengths[i], + CopyString), mysql_field); + } + if (result_type & MYSQL_NUM) { + ret.set(i, data); + } + if (result_type & MYSQL_ASSOC) { + ret.set(String(mysql_field->name, CopyString), data); + } + } + return ret; +} + +Variant f_mysql_fetch_row(CVarRef result) { + return php_mysql_fetch_hash(result, MYSQL_NUM); +} + +Variant f_mysql_fetch_assoc(CVarRef result) { + return php_mysql_fetch_hash(result, MYSQL_ASSOC); +} + +Variant f_mysql_fetch_array(CVarRef result, int result_type /* = 3 */) { + return php_mysql_fetch_hash(result, result_type); +} + +Variant f_mysql_fetch_object(CVarRef result, + CStrRef class_name /* = "stdClass" */, + CArrRef params /* = null */) { + Variant properties = php_mysql_fetch_hash(result, MYSQL_ASSOC); + if (!same(properties, false)) { + Object obj = create_object(class_name.data(), params); + obj->o_set(properties); + return obj; + } + return Object(); +} + +Variant f_mysql_fetch_lengths(CVarRef result) { + MySQLResult *res = get_result(result); + if (res == NULL) return false; + + if (res->isLocalized()) { + if (!res->isRowReady()) return false; + + Array ret; + for (int i = 0; i < res->getFieldCount(); i++) { + MySQLFieldInfo *info = res->getFieldInfo(i); + if (info->type == MYSQL_TYPE_YEAR) { + // special case for years, because of leading zeros + ret.set(i, info->length); + } else { + // convert fields back to Strings to get lengths + ret.set(i, res->getField(i).toString().length()); + } + } + return ret; + } + + MYSQL_RES *mysql_result = res->get(); + unsigned long *lengths = mysql_fetch_lengths(mysql_result); + if (!lengths) { + return false; + } + + Array ret; + int num_fields = mysql_num_fields(mysql_result); + for (int i = 0; i < num_fields; i++) { + ret.set(i, (int)lengths[i]); + } + return ret; +} + +Variant f_mysql_result(CVarRef result, int row, + CVarRef field /* = null_variant */) { + MySQLResult *res = get_result(result); + if (res == NULL) return false; + + MYSQL_RES *mysql_result = NULL; + MYSQL_ROW sql_row = NULL; + unsigned long *sql_row_lengths = NULL; + + if (res->isLocalized()) { + if (!res->seekRow(row)) return false; + if (!res->fetchRow()) return false; + } else { + mysql_result = res->get(); + if (row < 0 || row >= (int)mysql_num_rows(mysql_result)) { + Logger::Warning("Unable to jump to row %ld on MySQL result index %ld", + row, result.toObject()->o_getId()); + return false; + } + mysql_data_seek(mysql_result, row); + + sql_row = mysql_fetch_row(mysql_result); + if (!sql_row) { + return false; + } + sql_row_lengths = mysql_fetch_lengths(mysql_result); + if (!sql_row_lengths) { + return false; + } + } + + int field_offset = 0; + if (!field.isNull()) { + if (field.isString()) { + String sfield = field.toString(); + char *tmp = strchr(sfield.data(), '.'); + String table_name, field_name; + if (tmp) { + int pos = tmp - sfield.data(); + table_name = sfield.substr(0, pos); + field_name = sfield.substr(pos + 1); + } else { + field_name = sfield; + } + + int i = 0; + bool found = false; + res->seekField(0); + while (i < res->getFieldCount()) { + MySQLFieldInfo *info = res->getFieldInfo(i); + if ((table_name.empty() || table_name.same(info->table->toString())) && + field_name.same(info->name->toString())) { + field_offset = i; + found = true; + break; + } + i++; + } + if (!found) { /* no match found */ + Logger::Warning("%s%s%s not found in MySQL result index %ld", + table_name.data(), (table_name.empty() ? "" : "."), + field_name.data(), result.toObject()->o_getId()); + return false; + } + } else { + field_offset = field.toInt32(); + if (field_offset < 0 || + field_offset >= (int)res->getFieldCount()) { + Logger::Warning("Bad column offset specified"); + return false; + } + } + } + + if (res->isLocalized()) { + Variant f = res->getField(field_offset); + if (!f.isNull()) { + return f.toString(); + } + } else { + if (sql_row[field_offset]) { + return String(sql_row[field_offset], sql_row_lengths[field_offset], + CopyString); + } + } + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +// result functions + +Variant f_mysql_num_fields(CVarRef result) { + MySQLResult *res = get_result(result); + if (res) { + return res->getFieldCount(); + } + return false; +} + +Variant f_mysql_num_rows(CVarRef result) { + MySQLResult *res = get_result(result); + if (res) { + return res->getRowCount(); + } + return false; +} + +Variant f_mysql_free_result(CVarRef result) { + MySQLResult *res = get_result(result); + if (res) { + res->close(); + return true; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// field info + +Variant f_mysql_fetch_field(CVarRef result, int field /* = -1 */) { + MySQLResult *res = get_result(result); + if (res == NULL) return false; + + if (field != -1) { + if (!res->seekField(field)) return false; + } + MySQLFieldInfo *info; + if (!(info = res->fetchFieldInfo())) return false; + + Object obj(NEW(c_stdclass)()); + obj->set("name", *(info->name)); + obj->set("table", *(info->table)); + obj->set("def", *(info->def)); + obj->set("max_length", (int)info->max_length); + obj->set("not_null", IS_NOT_NULL(info->flags)? 1 : 0); + obj->set("primary_key", IS_PRI_KEY(info->flags)? 1 : 0); + obj->set("multiple_key", info->flags & MULTIPLE_KEY_FLAG? 1 : 0); + obj->set("unique_key", info->flags & UNIQUE_KEY_FLAG? 1 : 0); + obj->set("numeric", IS_NUM(info->type)? 1 : 0); + obj->set("blob", IS_BLOB(info->flags)? 1 : 0); + obj->set("type", php_mysql_get_field_name(info->type)); + obj->set("unsigned", info->flags & UNSIGNED_FLAG? 1 : 0); + obj->set("zerofill", info->flags & ZEROFILL_FLAG? 1 : 0); + return obj; +} + +bool f_mysql_field_seek(CVarRef result, int field /* = 0 */) { + MySQLResult *res = get_result(result); + if (res == NULL) return false; + res->seekField(field); + return true; +} + +Variant f_mysql_field_name(CVarRef result, int field /* = 0 */) { + return php_mysql_field_info(result, field, PHP_MYSQL_FIELD_NAME); +} +Variant f_mysql_field_table(CVarRef result, int field /* = 0 */) { + return php_mysql_field_info(result, field, PHP_MYSQL_FIELD_TABLE); +} +Variant f_mysql_field_len(CVarRef result, int field /* = 0 */) { + return php_mysql_field_info(result, field, PHP_MYSQL_FIELD_LEN); +} +Variant f_mysql_field_type(CVarRef result, int field /* = 0 */) { + return php_mysql_field_info(result, field, PHP_MYSQL_FIELD_TYPE); +} +Variant f_mysql_field_flags(CVarRef result, int field /* = 0 */) { + return php_mysql_field_info(result, field, PHP_MYSQL_FIELD_FLAGS); +} + +/////////////////////////////////////////////////////////////////////////////// +// MySQLResult + +void MySQLResult::addRow() { + m_row_count++; + m_rows->push_back(vector()); + m_rows->back().reserve(getFieldCount()); +} + +void MySQLResult::addField(Variant *value) { + m_rows->back().push_back(value); +} + +void MySQLResult::setFieldCount(int64 fields) { + m_field_count = fields; + m_fields = new MySQLFieldInfo[fields]; +} + +void MySQLResult::setFieldInfo(int64 f, MYSQL_FIELD *field) { + MySQLFieldInfo &info = m_fields[f]; + info.name = NEW(Variant)(String(field->name, CopyString)); + info.table = NEW(Variant)(String(field->table, CopyString)); + info.def = NEW(Variant)(String(field->def, CopyString)); + info.max_length = (int64)field->max_length; + info.length = (int64)field->length; + info.type = (int)field->type; + info.flags = field->flags; +} + +MySQLFieldInfo *MySQLResult::getFieldInfo(int64 field) { + if (field < 0 || field >= getFieldCount()) { + return NULL; + } + + if (!m_localized && !m_fields) { + if (m_res->fields == NULL) return NULL; + // cache field info + setFieldCount(getFieldCount()); + for (int i = 0; i < getFieldCount(); i++) { + setFieldInfo(i, m_res->fields + i); + } + } + return m_fields + field; +} + +Variant MySQLResult::getField(int64 field) const { + if (!m_localized || field < 0 || field >= (int64)m_current_row->size()) { + return null; + } + return *(*m_current_row)[field]; +} + +int64 MySQLResult::getFieldCount() const { + if (!m_localized) { + return (int64)mysql_num_fields(m_res); + } + return m_field_count; +} + +int64 MySQLResult::getRowCount() const { + if (!m_localized) { + return (int64)mysql_num_rows(m_res); + } + return m_row_count; +} + +bool MySQLResult::seekRow(int64 row) { + if (row < 0 || row >= getRowCount()) { + Logger::Warning("Unable to jump to row %ld on MySQL result index %ld", + row, o_getId()); + return false; + } + + if (!m_localized) { + mysql_data_seek(m_res, (my_ulonglong)row); + } else { + m_current_row = m_rows->begin(); + for (int i = 0; i < row; i++) m_current_row++; + m_row_ready = false; + } + return true; +} + +bool MySQLResult::fetchRow() { + if (m_current_row != m_rows->end()) m_current_row++; + if (m_current_row != m_rows->end()) { + m_row_ready = true; + return true; + } + return false; +} + +bool MySQLResult::seekField(int64 field) { + if (field < 0 || field >= getFieldCount()) { + Logger::Warning("Field %ld is invalid for MySQL result index %ld", + field, o_getId()); + return false; + } + + if (!m_localized) { + mysql_field_seek(m_res, (MYSQL_FIELD_OFFSET)field); + } + m_current_field = field - 1; + return true; +} + +MySQLFieldInfo *MySQLResult::fetchFieldInfo() { + if (!m_localized) { + mysql_fetch_field(m_res); + } + if (m_current_field < getFieldCount()) m_current_field++; + return getFieldInfo(m_current_field); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_mysql.h b/src/cpp/ext/ext_mysql.h new file mode 100644 index 0000000000000..79a7da7ff1b65 --- /dev/null +++ b/src/cpp/ext/ext_mysql.h @@ -0,0 +1,392 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_MYSQL_H__ +#define __EXT_MYSQL_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class MySQL : public SweepableResourceData { +public: + /** + * Operations on a resource object. + */ + static MYSQL *GetConn(CVarRef link_identifier, MySQL **rconn = NULL); + static bool CloseConn(CVarRef link_identifier); + + /** + * Default settings. + */ + static String GetDefaultServer() { return String();} + static int GetDefaultPort(); + static String GetDefaultSocket() { return String();} + static String GetDefaultUsername() { return String();} + static String GetDefaultPassword() { return String();} + + /** + * A connection may be persistent across multiple HTTP requests. + */ + static MySQL *GetPersistent(CStrRef host, int port, CStrRef socket, + CStrRef username, CStrRef password, + int client_flags) { + return GetCachedImpl("mysql::persistent_conns", host, port, socket, + username, password, client_flags); + } + + static void SetPersistent(CStrRef host, int port, CStrRef socket, + CStrRef username, CStrRef password, + int client_flags, MySQL *conn) { + SetCachedImpl("mysql::persistent_conns", host, port, socket, + username, password, client_flags, conn); + } + + /** + * If connection object is not provided, a default connection will be used. + */ + static MySQL *GetDefaultConn(); + static void SetDefaultConn(MySQL *conn); + +private: + static int s_default_port; + + static MySQL *Get(CVarRef link_identifier); + static String GetHash(CStrRef host, int port, CStrRef socket, + CStrRef username, CStrRef password, int client_flags); + + static MySQL *GetCachedImpl(const char *name, CStrRef host, int port, + CStrRef socket, CStrRef username, + CStrRef password, int client_flags); + + static void SetCachedImpl(const char *name, CStrRef host, int port, + CStrRef socket, CStrRef username, CStrRef password, + int client_flags, MySQL *conn); + +public: + MySQL(const char *host, int port, const char *username, + const char *password); + ~MySQL(); + void close(); + + // overriding ResourceData + virtual const char *o_getClassName() const { return "MySQL";} + virtual bool isResource() const { return m_conn != NULL;} + + bool connect(CStrRef host, int port, CStrRef socket, CStrRef username, + CStrRef password, int client_flags, int connect_timeout); + bool reconnect(CStrRef host, int port, CStrRef socket, CStrRef username, + CStrRef password, int client_flags, int connect_timeout); + + MYSQL *get() { return m_conn;} + +private: + MYSQL *m_conn; + +public: + std::string m_host; + int m_port; + std::string m_username; + std::string m_password; +}; + +/////////////////////////////////////////////////////////////////////////////// + +class MySQLFieldInfo { +public: + MySQLFieldInfo() + : name(NULL), table(NULL), def(NULL), + max_length(0), length(0), type(0), flags(0) {} + + Variant *name; + Variant *table; + Variant *def; + int64 max_length; + int64 length; + int type; + unsigned int flags; +}; + +class MySQLResult : public SweepableResourceData { +public: + DECLARE_OBJECT_ALLOCATION(MySQLResult); + + MySQLResult(MYSQL_RES *res, bool localized = false) + : m_res(res), m_localized(localized) { + m_fields = NULL; + m_field_count = 0; + m_current_field = -1; + if (localized) { + m_res = NULL; // ensure that localized results don't have another result + m_rows = new std::list >(1); //sentinel + m_current_row = m_rows->begin(); + m_row_ready = false; + m_row_count = 0; + } else { + m_rows = NULL; + } + } + + virtual ~MySQLResult(); + + // overriding ResourceData + const char *o_getClassName() const { return "MySQLResult";} + + void close() { + if (m_res) { + mysql_free_result(m_res); + m_res = NULL; + } + } + + MYSQL_RES *get() { + return m_res; + } + + bool isLocalized() { + return m_localized; + } + + void addRow(); + + void addField(Variant *value); + + void setFieldCount(int64 fields); + void setFieldInfo(int64 f, MYSQL_FIELD *field); + MySQLFieldInfo *getFieldInfo(int64 field); + + /** + * Gets the field content. Only for localized result. + */ + Variant getField(int64 field) const; + + int64 getFieldCount() const; + + int64 getRowCount() const; + + bool seekRow(int64 row); + + bool fetchRow(); + + bool isRowReady() const { + return m_row_ready; + } + + bool seekField(int64 field); + + MySQLFieldInfo *fetchFieldInfo(); + +protected: + MYSQL_RES *m_res; + bool m_localized; // whether all the rows have been localized + MySQLFieldInfo *m_fields; + std::list > *m_rows; + std::list >::const_iterator m_current_row; + int64 m_current_field; + bool m_row_ready; // set to false after seekRow, true after fetchRow + int64 m_field_count; + int64 m_row_count; +}; + +/////////////////////////////////////////////////////////////////////////////// +// connection functions + +Variant f_mysql_connect(CStrRef server = null_string, + CStrRef username = null_string, + CStrRef password = null_string, + bool new_link = false, + int client_flags = 0, + int connect_timeout_ms = -1, + int query_timeout_ms = -1); +Variant f_mysql_pconnect(CStrRef server = null_string, + CStrRef username = null_string, + CStrRef password = null_string, + int client_flags = 0, + int connect_timeout_ms = -1, + int query_timeout_ms = -1); + +String f_mysql_escape_string(CStrRef unescaped_string); + +Variant f_mysql_real_escape_string(CStrRef unescaped_string, + CVarRef link_identifier = null); + +inline String f_mysql_get_client_info() { + return String(mysql_get_client_info(), CopyString); +} +inline Variant f_mysql_set_charset(CStrRef charset, + CVarRef link_identifier = null) { + throw NotSupportedException(__func__, "added in MySQL 4.1.13"); + //return mysql_set_character_set(MySQL::GetConn(link_identifier), + // charset.data()) == 0; +} +inline Variant f_mysql_ping(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return null; + return !mysql_ping(conn); +} +inline Variant f_mysql_client_encoding(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return String(mysql_character_set_name(conn), CopyString); +} +inline Variant f_mysql_close(CVarRef link_identifier = null) { + return MySQL::CloseConn(link_identifier); +} +inline Variant f_mysql_errno(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return (int64)mysql_errno(conn); +} +inline Variant f_mysql_error(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return String(mysql_error(conn), CopyString); +} +inline Variant f_mysql_get_host_info(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return String(mysql_get_host_info(conn), CopyString); +} +inline Variant f_mysql_get_proto_info(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return (int64)mysql_get_proto_info(conn); +} +inline Variant f_mysql_get_server_info(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return String(mysql_get_server_info(conn), CopyString); +} +inline Variant f_mysql_info(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return String(mysql_info(conn), CopyString); +} +inline Variant f_mysql_insert_id(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return mysql_insert_id(conn); +} +inline Variant f_mysql_stat(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return String(mysql_stat(conn), CopyString); +} +inline Variant f_mysql_thread_id(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return (int64)mysql_thread_id(conn); +} +inline Variant f_mysql_create_db(CStrRef db, + CVarRef link_identifier = null) { + throw NotSupportedException + (__func__, "Deprecated. Use mysql_query(CREATE DATABASE) instead."); +} +inline Variant f_mysql_select_db(CStrRef db, + CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return mysql_select_db(conn, db.data()) == 0; +} +inline Variant f_mysql_drop_db(CStrRef db, + CVarRef link_identifier = null) { + throw NotSupportedException + (__func__, "Deprecated. Use mysql_query(DROP DATABASE) instead."); +} +inline Variant f_mysql_affected_rows(CVarRef link_identifier = null) { + MYSQL *conn = MySQL::GetConn(link_identifier); + if (!conn) return false; + return mysql_affected_rows(conn); +} + +/////////////////////////////////////////////////////////////////////////////// +// query functions + +bool f_mysql_set_timeout(int query_timeout_ms = -1, + CVarRef link_identifier = null); + +Variant f_mysql_query(CStrRef query, CVarRef link_identifier = null); + +Variant f_mysql_unbuffered_query(CStrRef query, + CVarRef link_identifier = null); +inline Variant f_mysql_db_query(CStrRef database, CStrRef query, + CVarRef link_identifier = null) { + throw NotSupportedException + (__func__, "Deprecated. Use mysql_query() instead."); +} +Variant f_mysql_list_dbs(CVarRef link_identifier = null); + +Variant f_mysql_list_tables(CStrRef database, + CVarRef link_identifier = null); +inline Variant f_mysql_list_fields(CStrRef database_name, CStrRef table_name, + CVarRef link_identifier = null) { + throw NotSupportedException + (__func__, "Deprecated. Use mysql_query(SHOW COLUMNS FROM table " + "[LIKE 'name']) instead."); +} +Variant f_mysql_list_processes(CVarRef link_identifier = null); + +/////////////////////////////////////////////////////////////////////////////// +// row operations + +bool f_mysql_data_seek(CVarRef result, int row); + +Variant f_mysql_fetch_row(CVarRef result); + +Variant f_mysql_fetch_assoc(CVarRef result); + +Variant f_mysql_fetch_array(CVarRef result, int result_type = 3); + +Variant f_mysql_fetch_lengths(CVarRef result); + +Variant f_mysql_fetch_object(CVarRef result, CStrRef class_name = "stdClass", + CArrRef params = null); + +Variant f_mysql_result(CVarRef result, int row, CVarRef field = null_variant); + +/////////////////////////////////////////////////////////////////////////////// +// result functions + +inline Variant f_mysql_db_name(CVarRef result, int row, + CVarRef field = null_variant) { + return f_mysql_result(result, row, field); +} +inline Variant f_mysql_tablename(CVarRef result, int i) { + return f_mysql_result(result, i); +} + +Variant f_mysql_num_fields(CVarRef result); +Variant f_mysql_num_rows(CVarRef result); +Variant f_mysql_free_result(CVarRef result); + +/////////////////////////////////////////////////////////////////////////////// +// field info + +Variant f_mysql_fetch_field(CVarRef result, int field = -1); +bool f_mysql_field_seek(CVarRef result, int field = 0); +Variant f_mysql_field_name(CVarRef result, int field = 0); +Variant f_mysql_field_table(CVarRef result, int field = 0); +Variant f_mysql_field_len(CVarRef result, int field = 0); +Variant f_mysql_field_type(CVarRef result, int field = 0); +Variant f_mysql_field_flags(CVarRef result, int field = 0); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_MYSQL_H__ diff --git a/src/cpp/ext/ext_network.cpp b/src/cpp/ext/ext_network.cpp new file mode 100644 index 0000000000000..aaf9418b7bf5e --- /dev/null +++ b/src/cpp/ext/ext_network.cpp @@ -0,0 +1,829 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAXPACKET 8192 /* max packet size used internally by BIND */ +#define DNS_T_A 1 +#define DNS_T_NS 2 +#define DNS_T_CNAME 5 +#define DNS_T_SOA 6 +#define DNS_T_PTR 12 +#define DNS_T_HINFO 13 +#define DNS_T_MINFO 14 +#define DNS_T_MX 15 +#define DNS_T_TXT 16 +#define DNS_T_AAAA 28 +#define DNS_T_SRV 33 +#define DNS_T_NAPTR 35 +#define DNS_T_A6 38 +#define DNS_T_ANY 255 + +#define PHP_DNS_NUM_TYPES 12 // Number of DNS Types Supported by PHP +#define PHP_DNS_A 0x00000001 +#define PHP_DNS_NS 0x00000002 +#define PHP_DNS_CNAME 0x00000010 +#define PHP_DNS_SOA 0x00000020 +#define PHP_DNS_PTR 0x00000800 +#define PHP_DNS_HINFO 0x00001000 +#define PHP_DNS_MX 0x00004000 +#define PHP_DNS_TXT 0x00008000 +#define PHP_DNS_A6 0x01000000 +#define PHP_DNS_SRV 0x02000000 +#define PHP_DNS_NAPTR 0x04000000 +#define PHP_DNS_AAAA 0x08000000 +#define PHP_DNS_ANY 0x10000000 +#define PHP_DNS_ALL (PHP_DNS_A|PHP_DNS_NS|PHP_DNS_CNAME|PHP_DNS_SOA| \ + PHP_DNS_PTR|PHP_DNS_HINFO|PHP_DNS_MX|PHP_DNS_TXT| \ + PHP_DNS_A6|PHP_DNS_SRV|PHP_DNS_NAPTR|PHP_DNS_AAAA) + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// DNS + +static Mutex NetworkMutex; + +Variant f_gethostbyaddr(CStrRef ip_address) { + Lock lock(NetworkMutex); + + struct in6_addr addr6; + struct in_addr addr; + struct hostent *hp; + if (inet_pton(AF_INET6, ip_address.data(), &addr6)) { + hp = gethostbyaddr((char *) &addr6, sizeof(addr6), AF_INET6); + } else if (inet_pton(AF_INET, ip_address.data(), &addr)) { + hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET); + } else { + return false; + } + + if (!hp || hp->h_name == NULL || hp->h_name[0] == '\0') { + return ip_address; + } + + return String(hp->h_name, CopyString); +} + +String f_gethostbyname(CStrRef hostname) { + if (RuntimeOption::EnableDnsCache) { + Variant success; + Variant resolved = f_apc_fetch(hostname, ref(success), + SHARED_STORE_DNS_CACHE); + if (same(success, true)) { + if (same(resolved, false)) { + return hostname; + } + return resolved.toString(); + } + } + + Util::HostEnt result; + if (!Util::safe_gethostbyname(hostname.data(), result)) { + if (RuntimeOption::EnableDnsCache) { + f_apc_store(hostname, false, RuntimeOption::DnsCacheTTL, + SHARED_STORE_DNS_CACHE); + } + return hostname; + } + + struct in_addr in; + memcpy(&in.s_addr, *(result.hostbuf.h_addr_list), sizeof(in.s_addr)); + String ret(Util::safe_inet_ntoa(in)); + if (RuntimeOption::EnableDnsCache) { + f_apc_store(hostname, ret, RuntimeOption::DnsCacheTTL, + SHARED_STORE_DNS_CACHE); + } + return ret; +} + +Variant f_gethostbynamel(CStrRef hostname) { + Util::HostEnt result; + if (!Util::safe_gethostbyname(hostname.data(), result)) { + return false; + } + + Array ret; + for (int i = 0 ; result.hostbuf.h_addr_list[i] != 0 ; i++) { + struct in_addr in = *(struct in_addr *)result.hostbuf.h_addr_list[i]; + ret.append(String(Util::safe_inet_ntoa(in))); + } + return ret; +} + +Variant f_getprotobyname(CStrRef name) { + Lock lock(NetworkMutex); + + struct protoent *ent = getprotobyname(name.data()); + if (ent == NULL) { + return false; + } + return ent->p_proto; +} + +Variant f_getprotobynumber(int number) { + Lock lock(NetworkMutex); + + struct protoent *ent = getprotobynumber(number); + if (ent == NULL) { + return false; + } + return String(ent->p_name, CopyString); +} + +Variant f_getservbyname(CStrRef service, CStrRef protocol) { + Lock lock(NetworkMutex); + + struct servent *serv = getservbyname(service.data(), protocol.data()); + if (serv == NULL) { + return false; + } + return ntohs(serv->s_port); +} + +Variant f_getservbyport(int port, CStrRef protocol) { + Lock lock(NetworkMutex); + + struct servent *serv = getservbyport(htons(port), protocol.data()); + if (serv == NULL) { + return false; + } + return String(serv->s_name, CopyString); +} + +Variant f_inet_ntop(CStrRef in_addr) { + int af = AF_INET; + if (in_addr.size() == 16) { + af = AF_INET6; + } else if (in_addr.size() != 4) { + Logger::Warning("Invalid in_addr value"); + return false; + } + + char buffer[40]; + if (!inet_ntop(af, in_addr.data(), buffer, sizeof(buffer))) { + Logger::Warning("An unknown error occured"); + return false; + } + return String(buffer, CopyString); +} + +Variant f_inet_pton(CStrRef address) { + int af = AF_INET; + const char *saddress = address.data(); + if (strchr(saddress, ':')) { + af = AF_INET6; + } else if (!strchr(saddress, '.')) { + Logger::Warning("Unrecognized address %s", saddress); + return false; + } + + char buffer[17]; + memset(buffer, 0, sizeof(buffer)); + int ret = inet_pton(af, saddress, buffer); + if (ret <= 0) { + Logger::Warning("Unrecognized address %s", saddress); + return false; + } + + return String(buffer, af == AF_INET ? 4 : 16, CopyString); +} + +Variant f_ip2long(CStrRef ip_address) { + unsigned long int ip; + if (ip_address.empty() || + (ip = inet_addr(ip_address.data())) == INADDR_NONE) { + /* the only special case when we should return -1 ourselves, + * because inet_addr() considers it wrong. We return 0xFFFFFFFF and + * not -1 or ~0 because of 32/64bit issues. + */ + if (ip_address == "255.255.255.255") { + return (int64)0xFFFFFFFF; + } + return false; + } + return (int64)ntohl(ip); +} + +String f_long2ip(int proper_address) { + struct in_addr myaddr; + myaddr.s_addr = htonl(proper_address); + return Util::safe_inet_ntoa(myaddr); +} + +bool f_dns_check_record(CStrRef host, CStrRef type /* = null_string */) { + const char *stype; + if (type.empty()) { + stype = "MX"; + } else { + stype = type.data(); + } + if (host.empty()) { + throw ArgumentMissingException("host"); + } + + int ntype; + if (!strcasecmp("A", stype)) ntype = DNS_T_A; + else if (!strcasecmp("NS", stype)) ntype = DNS_T_NS; + else if (!strcasecmp("MX", stype)) ntype = DNS_T_MX; + else if (!strcasecmp("PTR", stype)) ntype = DNS_T_PTR; + else if (!strcasecmp("ANY", stype)) ntype = DNS_T_ANY; + else if (!strcasecmp("SOA", stype)) ntype = DNS_T_SOA; + else if (!strcasecmp("TXT", stype)) ntype = DNS_T_TXT; + else if (!strcasecmp("CNAME", stype)) ntype = DNS_T_CNAME; + else if (!strcasecmp("AAAA", stype)) ntype = DNS_T_AAAA; + else if (!strcasecmp("SRV", stype)) ntype = DNS_T_SRV; + else if (!strcasecmp("NAPTR", stype)) ntype = DNS_T_NAPTR; + else if (!strcasecmp("A6", stype)) ntype = DNS_T_A6; + else { + throw InvalidArgumentException("type", stype); + } + + unsigned char ans[MAXPACKET]; + return res_search(host.data(), C_IN, ntype, ans, sizeof(ans)) >= 0; +} + +typedef union { + HEADER qb1; + u_char qb2[65536]; +} querybuf; + +static void php_dns_free_res(struct __res_state res) { + int ns; + for (ns = 0; ns < MAXNS; ns++) { + if (res._u._ext.nsaddrs[ns] != NULL) { + free(res._u._ext.nsaddrs[ns]); + res._u._ext.nsaddrs[ns] = NULL; + } + } +} + +static unsigned char *php_parserr(unsigned char *cp, querybuf *answer, + int type_to_fetch, bool store, + Array &subarray) { + unsigned short type, cls, dlen; + unsigned long ttl; + int64 n, i; + unsigned short s; + unsigned char *tp, *p; + char name[MAXHOSTNAMELEN]; + int have_v6_break = 0, in_v6_break = 0; + + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, sizeof(name) - 2); + if (n < 0) { + return NULL; + } + cp += n; + + GETSHORT(type, cp); + GETSHORT(cls, cp); + GETLONG(ttl, cp); + GETSHORT(dlen, cp); + if (type_to_fetch != T_ANY && type != type_to_fetch) { + cp += dlen; + return cp; + } + + if (!store) { + cp += dlen; + return cp; + } + + subarray.set("host", String(name, CopyString)); + switch (type) { + case DNS_T_A: + subarray.set("type", "A"); + snprintf(name, sizeof(name), "%d.%d.%d.%d", cp[0], cp[1], cp[2], cp[3]); + subarray.set("ip", String(name, CopyString)); + cp += dlen; + break; + case DNS_T_MX: + subarray.set("type", "MX"); + GETSHORT(n, cp); + subarray.set("pri", n); + /* no break; */ + case DNS_T_CNAME: + if (type == DNS_T_CNAME) { + subarray.set("type", "CNAME"); + } + /* no break; */ + case DNS_T_NS: + if (type == DNS_T_NS) { + subarray.set("type", "NS"); + } + /* no break; */ + case DNS_T_PTR: + if (type == DNS_T_PTR) { + subarray.set("type", "PTR"); + } + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); + if (n < 0) { + return NULL; + } + cp += n; + subarray.set("target", String(name, CopyString)); + break; + case DNS_T_HINFO: + /* See RFC 1010 for values */ + subarray.set("type", "HINFO"); + n = *cp & 0xFF; + cp++; + subarray.set("cpu", String((const char *)cp, n, CopyString)); + cp += n; + n = *cp & 0xFF; + cp++; + subarray.set("os", String((const char *)cp, n, CopyString)); + cp += n; + break; + case DNS_T_TXT: + subarray.set("type", "TXT"); + n = cp[0]; + tp = (unsigned char *)malloc(n + 1); + memcpy(tp, cp + 1, n); + tp[n] = '\0'; + cp += dlen; + subarray.set("txt", String((const char *)tp, n, AttachString)); + break; + case DNS_T_SOA: + subarray.set("type", "SOA"); + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2); + if (n < 0) { + return NULL; + } + cp += n; + subarray.set("mname", String(name, CopyString)); + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) -2); + if (n < 0) { + return NULL; + } + cp += n; + subarray.set("rname", String(name, CopyString)); + GETLONG(n, cp); + subarray.set("serial", n); + GETLONG(n, cp); + subarray.set("refresh", n); + GETLONG(n, cp); + subarray.set("retry", n); + GETLONG(n, cp); + subarray.set("expire", n); + GETLONG(n, cp); + subarray.set("minimum-ttl", n); + break; + case DNS_T_AAAA: + tp = (unsigned char *)name; + for (i = 0; i < 8; i++) { + GETSHORT(s, cp); + if (s != 0) { + if (tp > (u_char *)name) { + in_v6_break = 0; + tp[0] = ':'; + tp++; + } + tp += sprintf((char *)tp, "%x", s); + } else { + if (!have_v6_break) { + have_v6_break = 1; + in_v6_break = 1; + tp[0] = ':'; + tp++; + } else if (!in_v6_break) { + tp[0] = ':'; + tp++; + tp[0] = '0'; + tp++; + } + } + } + if (have_v6_break && in_v6_break) { + tp[0] = ':'; + tp++; + } + tp[0] = '\0'; + subarray.set("type", "AAAA"); + subarray.set("ipv6", String(name, CopyString)); + break; + case DNS_T_A6: + p = cp; + subarray.set("type", "A6"); + n = ((int)cp[0]) & 0xFF; + cp++; + subarray.set("masklen", n); + tp = (unsigned char *)name; + if (n > 15) { + have_v6_break = 1; + in_v6_break = 1; + tp[0] = ':'; + tp++; + } + if (n % 16 > 8) { + /* Partial short */ + if (cp[0] != 0) { + if (tp > (u_char *)name) { + in_v6_break = 0; + tp[0] = ':'; + tp++; + } + sprintf((char *)tp, "%x", cp[0] & 0xFF); + } else { + if (!have_v6_break) { + have_v6_break = 1; + in_v6_break = 1; + tp[0] = ':'; + tp++; + } else if (!in_v6_break) { + tp[0] = ':'; + tp++; + tp[0] = '0'; + tp++; + } + } + cp++; + } + for (i = (n + 8)/16; i < 8; i++) { + GETSHORT(s, cp); + if (s != 0) { + if (tp > (u_char *)name) { + in_v6_break = 0; + tp[0] = ':'; + tp++; + } + tp += sprintf((char*)tp,"%x",s); + } else { + if (!have_v6_break) { + have_v6_break = 1; + in_v6_break = 1; + tp[0] = ':'; + tp++; + } else if (!in_v6_break) { + tp[0] = ':'; + tp++; + tp[0] = '0'; + tp++; + } + } + } + if (have_v6_break && in_v6_break) { + tp[0] = ':'; + tp++; + } + tp[0] = '\0'; + subarray.set("ipv6", String(name, CopyString)); + if (cp < p + dlen) { + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, + (sizeof name) - 2); + if (n < 0) { + return NULL; + } + cp += n; + subarray.set("chain", String(name, CopyString)); + } + break; + case DNS_T_SRV: + subarray.set("type", "SRV"); + GETSHORT(n, cp); + subarray.set("pri", n); + GETSHORT(n, cp); + subarray.set("weight", n); + GETSHORT(n, cp); + subarray.set("port", n); + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); + if (n < 0) { + return NULL; + } + cp += n; + subarray.set("target", String(name, CopyString)); + break; + case DNS_T_NAPTR: + subarray.set("type", "NAPTR"); + GETSHORT(n, cp); + subarray.set("order", n); + GETSHORT(n, cp); + subarray.set("pref", n); + n = (cp[0] & 0xFF); + subarray.set("flags", String((const char *)(++cp), n, CopyString)); + cp += n; + n = (cp[0] & 0xFF); + subarray.set("services", String((const char *)(++cp), n, CopyString)); + cp += n; + n = (cp[0] & 0xFF); + subarray.set("regex", String((const char *)(++cp), n, CopyString)); + cp += n; + n = dn_expand(answer->qb2, answer->qb2+65536, cp, name, (sizeof name) - 2); + if (n < 0) { + return NULL; + } + cp += n; + subarray.set("replacement", String(name, CopyString)); + break; + default: + cp += dlen; + } + + subarray.set("class", "IN"); + subarray.set("ttl", (int)ttl); + return cp; +} + +Variant f_dns_get_record(CStrRef hostname, int type /* = -1 */, + Variant authns /* = null */, + Variant addtl /* = null */) { + if (type < 0) type = PHP_DNS_ALL; + if (type & ~PHP_DNS_ALL && type != PHP_DNS_ANY) { + Logger::Warning("Type '%d' not supported", type); + return false; + } + + /* Initialize the return array */ + Array ret; + authns = Array::Create(); + addtl = Array::Create(); + + unsigned char *cp = NULL, *end = NULL; + int qd, an, ns = 0, ar = 0; + querybuf buf, answer; + + /* - We emulate an or'ed type mask by querying type by type. + * (Steps 0 - NUMTYPES-1 ) + * If additional info is wanted we check again with DNS_T_ANY + * (step NUMTYPES / NUMTYPES+1 ) + * store_results is used to skip storing the results retrieved in step + * NUMTYPES+1 when results were already fetched. + * - In case of PHP_DNS_ANY we use the directly fetch DNS_T_ANY. + * (step NUMTYPES+1 ) + */ + bool first_query = true; + bool store_results = true; + for (int t = (type == PHP_DNS_ANY ? (PHP_DNS_NUM_TYPES + 1) : 0); + t < PHP_DNS_NUM_TYPES + 2 || first_query; t++) { + first_query = false; + int type_to_fetch; + switch (t) { + case 0: type_to_fetch = type & PHP_DNS_A ? DNS_T_A : 0; break; + case 1: type_to_fetch = type & PHP_DNS_NS ? DNS_T_NS : 0; break; + case 2: type_to_fetch = type & PHP_DNS_CNAME ? DNS_T_CNAME : 0; break; + case 3: type_to_fetch = type & PHP_DNS_SOA ? DNS_T_SOA : 0; break; + case 4: type_to_fetch = type & PHP_DNS_PTR ? DNS_T_PTR : 0; break; + case 5: type_to_fetch = type & PHP_DNS_HINFO ? DNS_T_HINFO : 0; break; + case 6: type_to_fetch = type & PHP_DNS_MX ? DNS_T_MX : 0; break; + case 7: type_to_fetch = type & PHP_DNS_TXT ? DNS_T_TXT : 0; break; + case 8: type_to_fetch = type & PHP_DNS_AAAA ? DNS_T_AAAA : 0; break; + case 9: type_to_fetch = type & PHP_DNS_SRV ? DNS_T_SRV : 0; break; + case 10: type_to_fetch = type & PHP_DNS_NAPTR ? DNS_T_NAPTR : 0; break; + case 11: type_to_fetch = type & PHP_DNS_A6 ? DNS_T_A6 : 0; break; + case PHP_DNS_NUM_TYPES: + store_results = false; + continue; + default: + case (PHP_DNS_NUM_TYPES + 1): + type_to_fetch = DNS_T_ANY; + break; + } + if (!type_to_fetch) continue; + + struct __res_state res; + memset(&res, 0, sizeof(res)); + res_ninit(&res); + res.retrans = 5; + res.options &= ~RES_DEFNAMES; + + int n = res_nmkquery(&res, QUERY, hostname.data(), C_IN, type_to_fetch, + NULL, 0, NULL, buf.qb2, sizeof buf); + if (n < 0) { + Logger::Warning("res_nmkquery() failed"); + res_nclose(&res); + php_dns_free_res(res); + return false; + } + + n = res_nsend(&res, buf.qb2, n, answer.qb2, sizeof answer); + if (n < 0) { + Logger::Warning("res_nsend() failed"); + res_nclose(&res); + php_dns_free_res(res); + return false; + } + + HEADER *hp; + cp = answer.qb2 + HFIXEDSZ; + end = answer.qb2 + n; + hp = (HEADER *)&answer; + qd = ntohs(hp->qdcount); + an = ntohs(hp->ancount); + ns = ntohs(hp->nscount); + ar = ntohs(hp->arcount); + + /* Skip QD entries, they're only used by dn_expand later on */ + while (qd-- > 0) { + n = dn_skipname(cp, end); + if (n < 0) { + Logger::Warning("Unable to parse DNS data received"); + res_nclose(&res); + php_dns_free_res(res); + return false; + } + cp += n + QFIXEDSZ; + } + + /* YAY! Our real answers! */ + while (an-- && cp && cp < end) { + Array retval; + cp = php_parserr(cp, &answer, type_to_fetch, store_results, retval); + if (!retval.empty() && store_results) { + ret.append(retval); + } + } + res_nclose(&res); + php_dns_free_res(res); + } + + /* List of Authoritative Name Servers */ + while (ns-- > 0 && cp && cp < end) { + Array retval; + cp = php_parserr(cp, &answer, DNS_T_ANY, true, retval); + if (!retval.empty()) { + authns.append(retval); + } + } + + /* Additional records associated with authoritative name servers */ + while (ar-- > 0 && cp && cp < end) { + Array retval; + cp = php_parserr(cp, &answer, DNS_T_ANY, true, retval); + if (!retval.empty()) { + addtl.append(retval); + } + } + + return ret; +} + +bool f_dns_get_mx(CStrRef hostname, Variant mxhosts, + Variant weights /* = null */) { + int count, qdc; + unsigned short type, weight; + unsigned char ans[MAXPACKET]; + char buf[MAXHOSTNAMELEN]; + unsigned char *cp, *end; + + mxhosts = Array::Create(); + weights = Array::Create(); + + /* Go! */ + int i = res_search(hostname.data(), C_IN, DNS_T_MX, (unsigned char *)&ans, + sizeof(ans)); + if (i < 0) { + return false; + } + if (i > (int)sizeof(ans)) { + i = sizeof(ans); + } + HEADER *hp = (HEADER *)&ans; + cp = (unsigned char *)&ans + HFIXEDSZ; + end = (unsigned char *)&ans +i; + for (qdc = ntohs((unsigned short)hp->qdcount); qdc--; cp += i + QFIXEDSZ) { + if ((i = dn_skipname(cp, end)) < 0 ) { + return false; + } + } + count = ntohs((unsigned short)hp->ancount); + while (--count >= 0 && cp < end) { + if ((i = dn_skipname(cp, end)) < 0 ) { + return false; + } + cp += i; + GETSHORT(type, cp); + cp += INT16SZ + INT32SZ; + GETSHORT(i, cp); + if (type != DNS_T_MX) { + cp += i; + continue; + } + GETSHORT(weight, cp); + if ((i = dn_expand(ans, end, cp, buf, sizeof(buf)-1)) < 0) { + return false; + } + cp += i; + mxhosts.append(String(buf, CopyString)); + weights.append(weight); + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// socket + +/** + * f_fsockopen() and f_pfsockopen() are implemented in ext_socket.cpp. + */ + +/////////////////////////////////////////////////////////////////////////////// +// http + +void f_header(CStrRef str, bool replace /* = true */, + int http_response_code /* = 0 */) { + Transport *transport = g_context->getTransport(); + if (transport) { + const char *header_line = str->data(); + char *colon_offset = strchr(header_line, ':'); + String newHeader; + if (colon_offset) { + if (!strncasecmp(header_line, "Content-Type", + colon_offset - header_line)) { + char *ptr = colon_offset+1, *mimetype = NULL; + while (*ptr == ' ') ptr++; + mimetype = ptr; + if (strncmp(mimetype, "text/", 5) == 0 && + strstr(mimetype, "charset=") == NULL) { + newHeader = str + ";charset=utf-8"; + } + } + } + if (replace) { + transport->replaceHeader(newHeader.empty() ? str : newHeader); + } else { + transport->addHeader(newHeader.empty() ? str : newHeader); + } + if (http_response_code) { + transport->setResponse(http_response_code); + } + } +} + +Array f_headers_list() { + Transport *transport = g_context->getTransport(); + if (transport) { + HeaderMap headers; + transport->getResponseHeaders(headers); + Array ret; + for (HeaderMap::const_iterator iter = headers.begin(); + iter != headers.end(); ++iter) { + const vector &values = iter->second; + for (unsigned int i = 0; i < values.size(); i++) { + ret.append(String(iter->first + ": " + values[i])); + } + } + return ret; + } + return Array(); +} + +bool f_headers_sent(Variant file /* = null */, Variant line /* = null */) { + Transport *transport = g_context->getTransport(); + if (transport) { + return transport->headersSent(); + } + return false; +} + +bool f_setcookie(CStrRef name, CStrRef value /* = null_string */, + int expire /* = 0 */, CStrRef path /* = null_string */, + CStrRef domain /* = null_string */, bool secure /* = false */, + bool httponly /* = false */) { + Transport *transport = g_context->getTransport(); + if (transport) { + return transport->setCookie(name, value, expire, path, domain, secure, + httponly, true); + } + return false; +} + +bool f_setrawcookie(CStrRef name, CStrRef value /* = null_string */, + int expire /* = 0 */, CStrRef path /* = null_string */, + CStrRef domain /* = null_string */, bool secure /* = false */, + bool httponly /* = false */) { + Transport *transport = g_context->getTransport(); + if (transport) { + return transport->setCookie(name, value, expire, path, domain, secure, + httponly, false); + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_network.h b/src/cpp/ext/ext_network.h new file mode 100644 index 0000000000000..f8bcbc9372d34 --- /dev/null +++ b/src/cpp/ext/ext_network.h @@ -0,0 +1,118 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_NETWORK_H__ +#define __EXT_NETWORK_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// DNS + +Variant f_gethostbyaddr(CStrRef ip_address); +String f_gethostbyname(CStrRef hostname); +Variant f_gethostbynamel(CStrRef hostname); +Variant f_getprotobyname(CStrRef name); +Variant f_getprotobynumber(int number); +Variant f_getservbyname(CStrRef service, CStrRef protocol); +Variant f_getservbyport(int port, CStrRef protocol); +Variant f_inet_ntop(CStrRef in_addr); +Variant f_inet_pton(CStrRef address); +Variant f_ip2long(CStrRef ip_address); +String f_long2ip(int proper_address); + +bool f_dns_check_record(CStrRef host, CStrRef type = null_string); + +inline bool f_checkdnsrr(CStrRef host, CStrRef type = null_string) { + return f_dns_check_record(host, type); +} + +Variant f_dns_get_record(CStrRef hostname, int type = -1, Variant authns = null, + Variant addtl = null); + +bool f_dns_get_mx(CStrRef hostname, Variant mxhosts, Variant weights = null); + +inline bool f_getmxrr(CStrRef hostname, Variant mxhosts, + Variant weight = null) { + return f_dns_get_mx(hostname, ref(mxhosts), weight); +} + +/////////////////////////////////////////////////////////////////////////////// +// socket + +Variant f_fsockopen(CStrRef hostname, int port = -1, Variant errnum = null, + Variant errstr = null, double timeout = 0.0); + +Variant f_pfsockopen(CStrRef hostname, int port = -1, Variant errnum = null, + Variant errstr = null, double timeout = 0.0); + +inline Array f_socket_get_status(CObjRef stream) { + return f_stream_get_meta_data(stream); +} + +inline bool f_socket_set_blocking(CObjRef stream, int mode) { + return f_stream_set_blocking(stream, mode); +} + +inline bool f_socket_set_timeout(CObjRef stream, int seconds, + int microseconds = 0) { + return f_stream_set_timeout(stream, seconds, microseconds); +} + +/////////////////////////////////////////////////////////////////////////////// +// http + +void f_header(CStrRef str, bool replace = true, int http_response_code = 0); + +Array f_headers_list(); + +bool f_headers_sent(Variant file = null, Variant line = null); + +bool f_setcookie(CStrRef name, CStrRef value = null_string, int expire = 0, + CStrRef path = null_string, CStrRef domain = null_string, + bool secure = false, bool httponly = false); + +bool f_setrawcookie(CStrRef name, CStrRef value = null_string, int expire = 0, + CStrRef path = null_string, CStrRef domain = null_string, + bool secure = false, bool httponly = false); + +/////////////////////////////////////////////////////////////////////////////// +// syslog + +inline void f_define_syslog_variables() { + // do nothing, since all variables are defined as constants already +} + +inline void f_openlog(CStrRef ident, int option, int facility) { + openlog(ident.data(), option, facility); +} + +inline void f_closelog() { + closelog(); +} + +inline void f_syslog(int priority, CStrRef message) { + syslog(priority, "%s", message.data()); +} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_NETWORK_H__ diff --git a/src/cpp/ext/ext_openssl.cpp b/src/cpp/ext/ext_openssl.cpp new file mode 100644 index 0000000000000..fd715db53a5ef --- /dev/null +++ b/src/cpp/ext/ext_openssl.cpp @@ -0,0 +1,2284 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { + +#define MIN_KEY_LENGTH 384 + +#define OPENSSL_ALGO_SHA1 1 +#define OPENSSL_ALGO_MD5 2 +#define OPENSSL_ALGO_MD4 3 +#define OPENSSL_ALGO_MD2 4 + +enum php_openssl_key_type { + OPENSSL_KEYTYPE_RSA, + OPENSSL_KEYTYPE_DSA, + OPENSSL_KEYTYPE_DH, + OPENSSL_KEYTYPE_DEFAULT = OPENSSL_KEYTYPE_RSA, +#ifdef EVP_PKEY_EC + OPENSSL_KEYTYPE_EC = OPENSSL_KEYTYPE_DH +1 +#endif +}; +enum php_openssl_cipher_type { + PHP_OPENSSL_CIPHER_RC2_40, + PHP_OPENSSL_CIPHER_RC2_128, + PHP_OPENSSL_CIPHER_RC2_64, + PHP_OPENSSL_CIPHER_DES, + PHP_OPENSSL_CIPHER_3DES, + PHP_OPENSSL_CIPHER_DEFAULT = PHP_OPENSSL_CIPHER_RC2_40 +}; + +static char default_ssl_conf_filename[PATH_MAX]; + +class OpenSSLInitializer { +public: + OpenSSLInitializer() { + SSL_library_init(); + OpenSSL_add_all_ciphers(); + OpenSSL_add_all_digests(); + OpenSSL_add_all_algorithms(); + + ERR_load_ERR_strings(); + ERR_load_crypto_strings(); + ERR_load_EVP_strings(); + + /* Determine default SSL configuration file */ + char *config_filename = getenv("OPENSSL_CONF"); + if (config_filename == NULL) { + config_filename = getenv("SSLEAY_CONF"); + } + + /* default to 'openssl.cnf' if no environment variable is set */ + if (config_filename == NULL) { + snprintf(default_ssl_conf_filename, sizeof(default_ssl_conf_filename), + "%s/%s", X509_get_default_cert_area(), "openssl.cnf"); + } else { + strncpy(default_ssl_conf_filename, config_filename, + sizeof(default_ssl_conf_filename)); + } + } + + ~OpenSSLInitializer() { + EVP_cleanup(); + } +}; +static OpenSSLInitializer s_openssl_initializer; + +/////////////////////////////////////////////////////////////////////////////// +// resource classes + +static BIO *read_data(CVarRef var, bool *file = NULL) { + if (var.isString() || var.isObject()) { + String svar = var.toString(); + if (svar.substr(0, 7) == "file://") { + if (file) *file = true; + BIO *ret = BIO_new_file((char*)svar.substr(7).data(), "r"); + if (ret == NULL) { + Logger::Warning("error opening the file, %s", svar.data()); + } + return ret; + } + + if (file) *file = false; + return BIO_new_mem_buf((char*)svar.data(), svar.size()); + } + return NULL; +} + + +class Certificate : public SweepableResourceData { +public: + X509 *m_cert; + Certificate(X509 *cert) : m_cert(cert) { ASSERT(m_cert);} + ~Certificate() { if (m_cert) X509_free(m_cert);} + + // overriding ResourceData + const char *o_getClassName() const { return "OpenSSL X.509";} + + /** + * Given a variant, coerce it into an X509 object. It can be: + * + * . X509 resource created using openssl_read_x509() + * . if it starts with file:// then it will be interpreted as the path + * to that cert + * . it will be interpreted as the cert data + */ + static Object Get(CVarRef var) { + if (var.isResource()) { + return var.toObject(); + } + if (var.isString() || var.isObject()) { + bool file; + BIO *in = read_data(var, &file); + if (in == NULL) return Object(); + + X509 *cert; + /* + if (file) { + cert = PEM_read_bio_X509(in, NULL, NULL, NULL); + } else { + cert = (X509 *)PEM_ASN1_read_bio + ((char *(*)())d2i_X509, PEM_STRING_X509, in, NULL, NULL, NULL); + } + */ + cert = PEM_read_bio_X509(in, NULL, NULL, NULL); + BIO_free(in); + if (cert) { + return Object(new Certificate(cert)); + } + } + return Object(); + } +}; + +class Key : public SweepableResourceData { +public: + EVP_PKEY *m_key; + Key(EVP_PKEY *key) : m_key(key) { ASSERT(m_key);} + ~Key() { if (m_key) EVP_PKEY_free(m_key);} + + // overriding ResourceData + const char *o_getClassName() const { return "OpenSSL key";} + + bool isPrivate() { + ASSERT(m_key); + switch (m_key->type) { +#ifndef NO_RSA + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: + ASSERT(m_key->pkey.rsa); + if (!m_key->pkey.rsa->p || !m_key->pkey.rsa->q) { + return false; + } + break; +#endif +#ifndef NO_DSA + case EVP_PKEY_DSA: + case EVP_PKEY_DSA1: + case EVP_PKEY_DSA2: + case EVP_PKEY_DSA3: + case EVP_PKEY_DSA4: + ASSERT(m_key->pkey.dsa); + if (!m_key->pkey.dsa->p || !m_key->pkey.dsa->q || + !m_key->pkey.dsa->priv_key) { + return false; + } + break; +#endif +#ifndef NO_DH + case EVP_PKEY_DH: + ASSERT(m_key->pkey.dh); + if (!m_key->pkey.dh->p || !m_key->pkey.dh->priv_key) { + return false; + } + break; +#endif + default: + Logger::Warning("key type not supported in this PHP build!"); + break; + } + return true; + } + + /** + * Given a variant, coerce it into a EVP_PKEY object. It can be: + * + * 1. private key resource from openssl_get_privatekey() + * 2. X509 resource -> public key will be extracted from it + * 3. if it starts with file:// interpreted as path to key file + * 4. interpreted as the data from the cert/key file and interpreted in + * same way as openssl_get_privatekey() + * 5. an array(0 => [items 2..4], 1 => passphrase) + * 6. if val is a string (possibly starting with file:///) and it is not + * an X509 certificate, then interpret as public key + * + * NOTE: If you are requesting a private key but have not specified a + * passphrase, you should use an empty string rather than NULL for the + * passphrase - NULL causes a passphrase prompt to be emitted in + * the Apache error log! + */ + static Object Get(CVarRef var, bool public_key, + const char *passphrase = NULL) { + Object ocert; + EVP_PKEY *key = NULL; + + if (var.isResource()) { + Certificate *cert = var.toObject().getTyped(true, true); + Key *key = var.toObject().getTyped(true, true); + if (cert == NULL && key == NULL) { + return Object(); + } + if (key) { + bool is_priv = key->isPrivate(); + if (!public_key && !is_priv) { + Logger::Warning("supplied key param is a public key"); + return Object(); + } + if (public_key && is_priv) { + Logger::Warning("Don't know how to get public key from " + "this private key"); + return Object(); + } + return var.toObject(); + } + ocert = cert; + } else { + /* it's an X509 file/cert of some kind, and we need to extract + the data from that */ + if (public_key) { + ocert = Certificate::Get(var); + if (ocert.isNull()) { + /* not a X509 certificate, try to retrieve public key */ + BIO *in = read_data(var); + if (in == NULL) return Object(); + key = PEM_read_bio_PUBKEY(in, NULL,NULL, NULL); + BIO_free(in); + } + } else { + String zphrase; + if (var.is(KindOfArray)) { + Array arr = var.toArray(); + if (!arr.exists(0LL) || !arr.exists(1LL)) { + Logger::Warning("key array must be of the form " + "array(0 => key, 1 => phrase)"); + return Object(); + } + zphrase = arr[1].toString(); + passphrase = zphrase.data(); + } + /* we want the private key */ + BIO *in = read_data(var); + if (in == NULL) return Object(); + key = PEM_read_bio_PrivateKey(in, NULL,NULL, (void*)passphrase); + BIO_free(in); + } + } + + if (public_key && !ocert.isNull() && key == NULL) { + /* extract public key from X509 cert */ + key = (EVP_PKEY *)X509_get_pubkey(ocert.getTyped()->m_cert); + } + + if (key) { + return Object(new Key(key)); + } + return Object(); + } +}; + +/** + * Certificate Signing Request + */ +class CSRequest : public SweepableResourceData { +public: + X509_REQ *m_csr; + CSRequest(X509_REQ *csr) : m_csr(csr) { ASSERT(m_csr);} + ~CSRequest() { if (m_csr) X509_REQ_free(m_csr);} + + // overriding ResourceData + const char *o_getClassName() const { return "OpenSSL X.509 CSR";} + + static X509_REQ *Get(CVarRef var, Object &ocsr) { + ocsr = Get(var); + CSRequest *csr = ocsr.getTyped(true); + if (csr == NULL || csr->m_csr == NULL) { + Logger::Warning("cannot get CSR"); + return NULL; + } + return csr->m_csr; + } + + static Object Get(CVarRef var) { + if (var.isResource()) { + return var.toObject(); + } + if (var.isString() || var.isObject()) { + BIO *in = read_data(var); + if (in == NULL) return Object(); + + X509_REQ *csr = PEM_read_bio_X509_REQ(in, NULL,NULL,NULL); + BIO_free(in); + if (csr) { + return Object(new CSRequest(csr)); + } + } + return Object(); + } +}; + +class php_x509_request { +public: + LHASH *global_config; /* Global SSL config */ + LHASH *req_config; /* SSL config for this request */ + const EVP_MD *md_alg; + const EVP_MD *digest; + const char *section_name; + const char *config_filename; + const char *digest_name; + const char *extensions_section; + const char *request_extensions_section; + int priv_key_bits; + int priv_key_type; + int priv_key_encrypt; + EVP_PKEY *priv_key; + + static bool load_rand_file(const char *file, int *egdsocket, int *seeded) { + char buffer[PATH_MAX]; + + *egdsocket = 0; + *seeded = 0; + if (file == NULL) { + file = RAND_file_name(buffer, sizeof(buffer)); + } else if (RAND_egd(file) > 0) { + /* if the given filename is an EGD socket, don't + * write anything back to it */ + *egdsocket = 1; + return true; + } + + if (file == NULL || !RAND_load_file(file, -1)) { + if (RAND_status() == 0) { + Logger::Warning("unable to load random state; not enough data!"); + return false; + } + return false; + } + *seeded = 1; + return true; + } + + static bool write_rand_file(const char *file, int egdsocket, int seeded) { + char buffer[PATH_MAX]; + + if (egdsocket || !seeded) { + /* if we did not manage to read the seed file, we should not write + * a low-entropy seed file back */ + return false; + } + if (file == NULL) { + file = RAND_file_name(buffer, sizeof(buffer)); + } + if (file == NULL || !RAND_write_file(file)) { + Logger::Warning("unable to write random state"); + return false; + } + return true; + } + + bool generatePrivateKey() { + ASSERT(priv_key == NULL); + + if (priv_key_bits < MIN_KEY_LENGTH) { + Logger::Warning("private key length is too short; it needs to be " + "at least %d bits, not %d", + MIN_KEY_LENGTH, priv_key_bits); + return false; + } + + char *randfile = CONF_get_string(req_config, section_name, "RANDFILE"); + int egdsocket, seeded; + load_rand_file(randfile, &egdsocket, &seeded); + + bool ret = false; + if ((priv_key = EVP_PKEY_new()) != NULL) { + switch (priv_key_type) { + case OPENSSL_KEYTYPE_RSA: + if (EVP_PKEY_assign_RSA + (priv_key, RSA_generate_key(priv_key_bits, 0x10001, NULL, NULL))) { + ret = true; + } + break; +#if !defined(NO_DSA) && defined(HAVE_DSA_DEFAULT_METHOD) + case OPENSSL_KEYTYPE_DSA: + { + DSA *dsapar = DSA_generate_parameters(priv_key_bits, NULL, 0, NULL, + NULL, NULL, NULL); + if (dsapar) { + DSA_set_method(dsapar, DSA_get_default_method()); + if (DSA_generate_key(dsapar)) { + if (EVP_PKEY_assign_DSA(priv_key, dsapar)) { + ret = true; + } + } else { + DSA_free(dsapar); + } + } + } + break; +#endif + default: + Logger::Warning("Unsupported private key type"); + } + } + + write_rand_file(randfile, egdsocket, seeded); + return ret; + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// utilities + +static void add_assoc_name_entry(Array &ret, const char *key, + X509_NAME *name, bool shortname) { + Array subitem_data; + Array &subitem = key ? subitem_data : ret; + + for (int i = 0; i < X509_NAME_entry_count(name); i++) { + X509_NAME_ENTRY *ne = X509_NAME_get_entry(name, i); + ASN1_OBJECT *obj = X509_NAME_ENTRY_get_object(ne); + int nid = OBJ_obj2nid(obj); + int obj_cnt = 0; + + char *sname; + if (shortname) { + sname = (char *)OBJ_nid2sn(nid); + } else { + sname = (char *)OBJ_nid2ln(nid); + } + + Array subentries; + int last = -1; + int j; + ASN1_STRING *str = NULL; + unsigned char *to_add = NULL; + int to_add_len = 0; + for (;;) { + j = X509_NAME_get_index_by_OBJ(name, obj, last); + if (j < 0) { + if (last != -1) break; + } else { + obj_cnt++; + ne = X509_NAME_get_entry(name, j); + str = X509_NAME_ENTRY_get_data(ne); + if (ASN1_STRING_type(str) != V_ASN1_UTF8STRING) { + to_add_len = ASN1_STRING_to_UTF8(&to_add, str); + subentries.append(String((char*)to_add, to_add_len, AttachString)); + } else { + to_add = ASN1_STRING_data(str); + to_add_len = ASN1_STRING_length(str); + subentries.append(String((char*)to_add, to_add_len, CopyString)); + } + } + last = j; + } + i = last; + + if (obj_cnt > 1) { + subitem.set(String(sname, CopyString), subentries); + } else if (obj_cnt && str) { + subitem.set(String(sname, CopyString), + String((char*)to_add, to_add_len, CopyString)); + } + } + + if (key) { + ret.set(String(key, CopyString), subitem); + } +} + +static const char *read_string(CArrRef args, const char *key, const char *def, + vector &strings) { + if (args.exists(key)) { + String value = args[key].toString(); + strings.push_back(value); + return (char*)value.data(); + } + return def; +} + +static int64 read_integer(CArrRef args, const char *key, int64 def) { + if (args.exists(key)) { + return args[key].toInt64(); + } + return def; +} + +static bool add_oid_section(struct php_x509_request *req) { + char *str = CONF_get_string(req->req_config, NULL, "oid_section"); + if (str == NULL) { + return true; + } + + STACK_OF(CONF_VALUE) *sktmp = CONF_get_section(req->req_config, str); + if (sktmp == NULL) { + Logger::Warning("problem loading oid section %s", str); + return false; + } + + for (int i = 0; i < sk_CONF_VALUE_num(sktmp); i++) { + CONF_VALUE *cnf = sk_CONF_VALUE_value(sktmp, i); + if (OBJ_create(cnf->value, cnf->name, cnf->name) == NID_undef) { + Logger::Warning("problem creating object %s=%s", cnf->name, cnf->value); + return false; + } + } + return true; +} + +static inline bool php_openssl_config_check_syntax +(const char *section_label, const char *config_filename, const char *section, + LHASH *config) { + X509V3_CTX ctx; + X509V3_set_ctx_test(&ctx); + X509V3_set_conf_lhash(&ctx, config); + if (!X509V3_EXT_add_conf(config, &ctx, (char*)section, NULL)) { + Logger::Warning("Error loading %s section %s of %s", + section_label, section, config_filename); + return false; + } + return true; +} + +static bool php_openssl_parse_config(struct php_x509_request *req, + CArrRef args, vector &strings) { + req->config_filename = + read_string(args, "config", default_ssl_conf_filename, strings); + req->section_name = + read_string(args, "config_section_name", "req", strings); + req->global_config = CONF_load(NULL, default_ssl_conf_filename, NULL); + req->req_config = CONF_load(NULL, req->config_filename, NULL); + if (req->req_config == NULL) { + return false; + } + + /* read in the oids */ + char *str = CONF_get_string(req->req_config, NULL, "oid_file"); + if (str) { + BIO *oid_bio = BIO_new_file(str, "r"); + if (oid_bio) { + OBJ_create_objects(oid_bio); + BIO_free(oid_bio); + } + } + if (!add_oid_section(req)) { + return false; + } + + req->digest_name = + read_string(args, "digest_alg", + CONF_get_string(req->req_config, req->section_name, + "default_md"), + strings); + + req->extensions_section = + read_string(args, "x509_extensions", + CONF_get_string(req->req_config, req->section_name, + "x509_extensions"), + strings); + + req->request_extensions_section = + read_string(args, "req_extensions", + CONF_get_string(req->req_config, req->section_name, + "req_extensions"), + strings); + + req->priv_key_bits = + read_integer(args, "private_key_bits", + CONF_get_number(req->req_config, req->section_name, + "default_bits")); + + req->priv_key_type = + read_integer(args, "private_key_type", OPENSSL_KEYTYPE_DEFAULT); + + if (args.exists("encrypt_key")) { + bool value = args["encrypt_key"].toBoolean(); + req->priv_key_encrypt = value ? 1 : 0; + } else { + str = CONF_get_string(req->req_config, req->section_name, + "encrypt_rsa_key"); + if (str == NULL) { + str = CONF_get_string(req->req_config, req->section_name, "encrypt_key"); + } + if (str && strcmp(str, "no") == 0) { + req->priv_key_encrypt = 0; + } else { + req->priv_key_encrypt = 1; + } + } + + /* digest alg */ + if (req->digest_name == NULL) { + req->digest_name = CONF_get_string(req->req_config, req->section_name, + "default_md"); + } + if (req->digest_name) { + req->digest = req->md_alg = EVP_get_digestbyname(req->digest_name); + } + if (req->md_alg == NULL) { + req->md_alg = req->digest = EVP_md5(); + } + + if (req->extensions_section && + !php_openssl_config_check_syntax + ("extensions_section", req->config_filename, req->extensions_section, + req->req_config)) { + return false; + } + + /* set the string mask */ + str = CONF_get_string(req->req_config, req->section_name, "string_mask"); + if (str && !ASN1_STRING_set_default_mask_asc(str)) { + Logger::Warning("Invalid global string mask setting %s", str); + return false; + } + + if (req->request_extensions_section && + !php_openssl_config_check_syntax + ("request_extensions_section", req->config_filename, + req->request_extensions_section, req->req_config)) { + return false; + } + + return true; +} + +static void php_openssl_dispose_config(struct php_x509_request *req) { + if (req->global_config) { + CONF_free(req->global_config); + req->global_config = NULL; + } + if (req->req_config) { + CONF_free(req->req_config); + req->req_config = NULL; + } +} + +static STACK_OF(X509) *load_all_certs_from_file(const char *certfile) { + STACK_OF(X509_INFO) *sk = NULL; + STACK_OF(X509) *stack = NULL, *ret = NULL; + BIO *in = NULL; + X509_INFO *xi; + + if (!(stack = sk_X509_new_null())) { + Logger::Error("memory allocation failure"); + goto end; + } + + if (!(in = BIO_new_file(certfile, "r"))) { + Logger::Warning("error opening the file, %s", certfile); + sk_X509_free(stack); + goto end; + } + + /* This loads from a file, a stack of x509/crl/pkey sets */ + if (!(sk = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL))) { + Logger::Warning("error reading the file, %s", certfile); + sk_X509_free(stack); + goto end; + } + + /* scan over it and pull out the certs */ + while (sk_X509_INFO_num(sk)) { + xi = sk_X509_INFO_shift(sk); + if (xi->x509 != NULL) { + sk_X509_push(stack, xi->x509); + xi->x509 = NULL; + } + X509_INFO_free(xi); + } + if (!sk_X509_num(stack)) { + Logger::Warning("no certificates in file, %s", certfile); + sk_X509_free(stack); + goto end; + } + ret = stack; + +end: + BIO_free(in); + sk_X509_INFO_free(sk); + + return ret; +} + +/** + * calist is an array containing file and directory names. create a + * certificate store and add those certs to it for use in verification. + */ +static X509_STORE *setup_verify(CArrRef calist) { + X509_STORE *store = X509_STORE_new(); + if (store == NULL) { + return NULL; + } + + X509_LOOKUP *dir_lookup, *file_lookup; + int ndirs = 0, nfiles = 0; + for (ArrayIter iter(calist); iter; ++iter) { + String item = iter.second().toString(); + + struct stat sb; + if (stat(item.data(), &sb) == -1) { + Logger::Warning("unable to stat %s", item.data()); + continue; + } + + if ((sb.st_mode & S_IFREG) == S_IFREG) { + file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file()); + if (file_lookup == NULL || + !X509_LOOKUP_load_file(file_lookup, item.data(), + X509_FILETYPE_PEM)) { + Logger::Warning("error loading file %s", item.data()); + } else { + nfiles++; + } + file_lookup = NULL; + } else { + dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir()); + if (dir_lookup == NULL || + !X509_LOOKUP_add_dir(dir_lookup, item.data(), X509_FILETYPE_PEM)) { + Logger::Warning("error loading directory %s", item.data()); + } else { + ndirs++; + } + dir_lookup = NULL; + } + } + if (nfiles == 0) { + file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file()); + if (file_lookup) { + X509_LOOKUP_load_file(file_lookup, NULL, X509_FILETYPE_DEFAULT); + } + } + if (ndirs == 0) { + dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir()); + if (dir_lookup) { + X509_LOOKUP_add_dir(dir_lookup, NULL, X509_FILETYPE_DEFAULT); + } + } + return store; +} + +/////////////////////////////////////////////////////////////////////////////// + +static bool add_entries(X509_NAME *subj, CArrRef items) { + for (ArrayIter iter(items); iter; ++iter) { + String index = iter.first(); + String item = iter.second(); + int nid = OBJ_txt2nid(index.data()); + if (nid != NID_undef) { + if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_ASC, + (unsigned char*)item.data(), + -1, -1, 0)) { + Logger::Warning("dn: add_entry_by_NID %d -> %s (failed)", + nid, item.data()); + return false; + } + } else { + Logger::Warning("dn: %s is not a recognized name", index.data()); + } + } + return true; +} + +static bool php_openssl_make_REQ(struct php_x509_request *req, X509_REQ *csr, + CArrRef dn, CArrRef attribs) { + char *dn_sect = CONF_get_string(req->req_config, req->section_name, + "distinguished_name"); + if (dn_sect == NULL) return false; + + STACK_OF(CONF_VALUE) *dn_sk = CONF_get_section(req->req_config, dn_sect); + if (dn_sk == NULL) return false; + + char *attr_sect = CONF_get_string(req->req_config, req->section_name, + "attributes"); + STACK_OF(CONF_VALUE) *attr_sk = NULL; + if (attr_sect) { + attr_sk = CONF_get_section(req->req_config, attr_sect); + if (attr_sk == NULL) { + return false; + } + } + + /* setup the version number: version 1 */ + if (X509_REQ_set_version(csr, 0L)) { + X509_NAME *subj = X509_REQ_get_subject_name(csr); + if (!add_entries(subj, dn)) return false; + + /* Finally apply defaults from config file */ + for (int i = 0; i < sk_CONF_VALUE_num(dn_sk); i++) { + CONF_VALUE *v = sk_CONF_VALUE_value(dn_sk, i); + char *type = v->name; + + int len = strlen(type); + if (len < (int)sizeof("_default")) { + continue; + } + len -= sizeof("_default") - 1; + if (strcmp("_default", type + len) != 0) { + continue; + } + if (len > 200) { + len = 200; + } + char buffer[200 + 1]; /*200 + \0 !*/ + memcpy(buffer, type, len); + buffer[len] = '\0'; + type = buffer; + + /* Skip past any leading X. X: X, etc to allow for multiple instances */ + for (char *str = type; *str; str++) { + if (*str == ':' || *str == ',' || *str == '.') { + str++; + if (*str) { + type = str; + } + break; + } + } + /* if it is already set, skip this */ + int nid = OBJ_txt2nid(type); + if (X509_NAME_get_index_by_NID(subj, nid, -1) >= 0) { + continue; + } + if (!X509_NAME_add_entry_by_txt(subj, type, MBSTRING_ASC, + (unsigned char*)v->value, -1, -1, 0)) { + Logger::Warning("add_entry_by_txt %s -> %s (failed)", type, v->value); + return false; + } + if (!X509_NAME_entry_count(subj)) { + Logger::Warning("no objects specified in config file"); + return false; + } + } + + if (!add_entries(subj, attribs)) return false; + + if (attr_sk) { + for (int i = 0; i < sk_CONF_VALUE_num(attr_sk); i++) { + CONF_VALUE *v = sk_CONF_VALUE_value(attr_sk, i); + /* if it is already set, skip this */ + int nid = OBJ_txt2nid(v->name); + if (X509_REQ_get_attr_by_NID(csr, nid, -1) >= 0) { + continue; + } + if (!X509_REQ_add1_attr_by_txt(csr, v->name, MBSTRING_ASC, + (unsigned char*)v->value, -1)) { + /** + * hzhao: mismatched version of conf file may have attributes that + * are not recognizable, and I don't think it should be treated as + * fatal errors. + */ + Logger::Verbose("add1_attr_by_txt %s -> %s (failed)", v->name, + v->value); + // return false; + } + } + } + } + + X509_REQ_set_pubkey(csr, req->priv_key); + return true; +} + +bool f_openssl_csr_export_to_file(CVarRef csr, CStrRef outfilename, + bool notext /* = true */) { + Object ocsr; + X509_REQ *pcsr = CSRequest::Get(csr, ocsr); + if (pcsr == NULL) return false; + + BIO *bio_out = BIO_new_file((char*)outfilename.data(), "w"); + if (bio_out == NULL) { + Logger::Warning("error opening file %s", outfilename.data()); + return false; + } + + if (!notext) { + X509_REQ_print(bio_out, pcsr); + } + PEM_write_bio_X509_REQ(bio_out, pcsr); + BIO_free(bio_out); + return true; +} + +bool f_openssl_csr_export(CVarRef csr, Variant out, bool notext /* = true */) { + Object ocsr; + X509_REQ *pcsr = CSRequest::Get(csr, ocsr); + if (pcsr == NULL) return false; + + BIO *bio_out = BIO_new(BIO_s_mem()); + if (!notext) { + X509_REQ_print(bio_out, pcsr); + } + + if (PEM_write_bio_X509_REQ(bio_out, pcsr)) { + BUF_MEM *bio_buf; + BIO_get_mem_ptr(bio_out, &bio_buf); + out = String((char*)bio_buf->data, bio_buf->length, CopyString); + BIO_free(bio_out); + return true; + } + + BIO_free(bio_out); + return false; +} + +Variant f_openssl_csr_get_public_key(CVarRef csr) { + Object ocsr; + X509_REQ *pcsr = CSRequest::Get(csr, ocsr); + if (pcsr == NULL) return false; + + return Object(new Key(X509_REQ_get_pubkey(pcsr))); +} + +Variant f_openssl_csr_get_subject(CVarRef csr, + bool use_shortnames /* = true */) { + Object ocsr; + X509_REQ *pcsr = CSRequest::Get(csr, ocsr); + if (pcsr == NULL) return false; + + X509_NAME *subject = X509_REQ_get_subject_name(pcsr); + Array ret = Array::Create(); + add_assoc_name_entry(ret, NULL, subject, use_shortnames); + return ret; +} + +Variant f_openssl_csr_new(CArrRef dn, Variant privkey, + CVarRef configargs /* = null_variant */, + CVarRef extraattribs /* = null_variant */) { + Variant ret = false; + struct php_x509_request req; + memset(&req, 0, sizeof(req)); + + Object okey; + X509_REQ *csr = NULL; + vector strings; + if (php_openssl_parse_config(&req, configargs.toArray(), strings)) { + /* Generate or use a private key */ + if (!privkey.isNull()) { + okey = Key::Get(privkey, false); + if (!okey.isNull()) { + req.priv_key = okey.getTyped()->m_key; + } + } + if (req.priv_key == NULL) { + req.generatePrivateKey(); + if (req.priv_key) { + okey = Object(new Key(req.priv_key)); + } + } + if (req.priv_key == NULL) { + Logger::Warning("Unable to generate a private key"); + } else { + csr = X509_REQ_new(); + if (csr && php_openssl_make_REQ(&req, csr, dn, extraattribs.toArray())) { + X509V3_CTX ext_ctx; + X509V3_set_ctx(&ext_ctx, NULL, NULL, csr, NULL, 0); + X509V3_set_conf_lhash(&ext_ctx, req.req_config); + + /* Add extensions */ + if (req.request_extensions_section && + !X509V3_EXT_REQ_add_conf(req.req_config, &ext_ctx, + (char*)req.request_extensions_section, csr)) { + Logger::Warning("Error loading extension section %s", + req.request_extensions_section); + } else { + ret = true; + if (X509_REQ_sign(csr, req.priv_key, req.digest)) { + ret = Object(new CSRequest(csr)); + csr = NULL; + } else { + Logger::Warning("Error signing request"); + } + + privkey = okey; + } + } + } + } + if (csr) { + X509_REQ_free(csr); + } + php_openssl_dispose_config(&req); + return ret; +} + +Variant f_openssl_csr_sign(CVarRef csr, CVarRef cacert, CVarRef priv_key, + int days, CVarRef configargs /* = null_variant */, + int serial /* = 0 */) { + Object ocsr; + X509_REQ *pcsr = CSRequest::Get(csr, ocsr); + if (pcsr == NULL) return false; + + Object ocert; + if (!cacert.isNull()) { + ocert = Certificate::Get(cacert); + if (ocert.isNull()) { + Logger::Warning("cannot get cert from parameter 2"); + return false; + } + } + Object okey = Key::Get(priv_key, false); + if (okey.isNull()) { + Logger::Warning("cannot get private key from parameter 3"); + return false; + } + X509 *cert = NULL; + if (!ocert.isNull()) { + cert = ocert.getTyped()->m_cert; + } + EVP_PKEY *pkey = okey.getTyped()->m_key; + if (cert && !X509_check_private_key(cert, pkey)) { + Logger::Warning("private key does not correspond to signing cert"); + return false; + } + + Object onewcert; + struct php_x509_request req; + memset(&req, 0, sizeof(req)); + Variant ret = false; + vector strings; + if (!php_openssl_parse_config(&req, configargs.toArray(), strings)) { + goto cleanup; + } + + /* Check that the request matches the signature */ + EVP_PKEY *key; + key = X509_REQ_get_pubkey(pcsr); + if (key == NULL) { + Logger::Warning("error unpacking public key"); + goto cleanup; + } + int i; + i = X509_REQ_verify(pcsr, key); + if (i < 0) { + Logger::Warning("Signature verification problems"); + goto cleanup; + } + if (i == 0) { + Logger::Warning("Signature did not match the certificate request"); + goto cleanup; + } + + /* Now we can get on with it */ + X509 *new_cert; + new_cert = X509_new(); + if (new_cert == NULL) { + Logger::Warning("No memory"); + goto cleanup; + } + onewcert = Object(new Certificate(new_cert)); + /* Version 3 cert */ + if (!X509_set_version(new_cert, 2)) { + goto cleanup; + } + ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial); + X509_set_subject_name(new_cert, X509_REQ_get_subject_name(pcsr)); + + if (cert == NULL) { + cert = new_cert; + } + if (!X509_set_issuer_name(new_cert, X509_get_subject_name(cert))) { + goto cleanup; + } + X509_gmtime_adj(X509_get_notBefore(new_cert), 0); + X509_gmtime_adj(X509_get_notAfter(new_cert), (long)60 * 60 * 24 * days); + i = X509_set_pubkey(new_cert, key); + if (!i) { + goto cleanup; + } + if (req.extensions_section) { + X509V3_CTX ctx; + X509V3_set_ctx(&ctx, cert, new_cert, pcsr, NULL, 0); + X509V3_set_conf_lhash(&ctx, req.req_config); + if (!X509V3_EXT_add_conf(req.req_config, &ctx, (char*)req.extensions_section, + new_cert)) { + goto cleanup; + } + } + + /* Now sign it */ + if (!X509_sign(new_cert, pkey, req.digest)) { + Logger::Warning("failed to sign it"); + goto cleanup; + } + + /* Succeeded; lets return the cert */ + ret = onewcert; + + cleanup: + php_openssl_dispose_config(&req); + return ret; +} + +Variant f_openssl_error_string() { + char buf[512]; + unsigned long val = ERR_get_error(); + if (val) { + return String(ERR_error_string(val, buf), CopyString); + } + return false; +} + +void f_openssl_free_key(CObjRef key) { + return f_openssl_pkey_free(key); +} + +bool f_openssl_open(CStrRef sealed_data, Variant open_data, CStrRef env_key, + CVarRef priv_key_id) { + Object okey = Key::Get(priv_key_id, false); + if (okey.isNull()) { + Logger::Warning("unable to coerce parameter 4 into a private key"); + return false; + } + EVP_PKEY *pkey = okey.getTyped()->m_key; + + unsigned char *buf = (unsigned char *)malloc(sealed_data.size() + 1); + + EVP_CIPHER_CTX ctx; + int len1, len2; + if (!EVP_OpenInit(&ctx, EVP_rc4(), (unsigned char *)env_key.data(), + env_key.size(), NULL, pkey) || + !EVP_OpenUpdate(&ctx, buf, &len1, (unsigned char *)sealed_data.data(), + sealed_data.size()) || + !EVP_OpenFinal(&ctx, buf + len1, &len2) || + len1 + len2 == 0) { + free(buf); + return false; + } + buf[len1 + len2] = '\0'; + open_data = String((char*)buf, AttachString); + return true; +} + +static STACK_OF(X509) *php_array_to_X509_sk(CVarRef certs) { + STACK_OF(X509) *pcerts = sk_X509_new_null(); + Array arrCerts; + if (certs.is(KindOfArray)) { + arrCerts = certs.toArray(); + } else { + arrCerts.append(certs); + } + for (ArrayIter iter(arrCerts); iter; ++iter) { + Object ocert = Certificate::Get(iter.second()); + if (ocert.isNull()) { + break; + } + sk_X509_push(pcerts, ocert.getTyped()->m_cert); + } + return pcerts; +} + +static bool openssl_pkcs12_export_impl(CVarRef x509, BIO *bio_out, + CVarRef priv_key, CStrRef pass, + CVarRef args /* = null_variant */) { + Object ocert = Certificate::Get(x509); + if (ocert.isNull()) { + Logger::Warning("cannot get cert from parameter 1"); + return false; + } + Object okey = Key::Get(priv_key, false); + if (okey.isNull()) { + Logger::Warning("cannot get private key from parameter 3"); + return false; + } + X509 *cert = ocert.getTyped()->m_cert; + EVP_PKEY *key = okey.getTyped()->m_key; + if (cert && !X509_check_private_key(cert, key)) { + Logger::Warning("private key does not correspond to cert"); + return false; + } + + Array arrArgs = args.toArray(); + + String friendly_name; + if (arrArgs.exists("friendly_name")) { + friendly_name = arrArgs["friendly_name"].toString(); + } + + STACK_OF(X509) *ca = NULL; + if (arrArgs.exists("extracerts")) { + ca = php_array_to_X509_sk(arrArgs["extracerts"]); + } + + PKCS12 *p12 = PKCS12_create + ((char*)pass.data(), + (char*)(friendly_name.empty() ? NULL : friendly_name.data()), + key, cert, ca, 0, 0, 0, 0, 0); + + ASSERT(bio_out); + bool ret = i2d_PKCS12_bio(bio_out, p12); + PKCS12_free(p12); + sk_X509_free(ca); + return ret; +} + +bool f_openssl_pkcs12_export_to_file(CVarRef x509, CStrRef filename, + CVarRef priv_key, CStrRef pass, + CVarRef args /* = null_variant */) { + BIO *bio_out = BIO_new_file(filename.data(), "w"); + if (bio_out == NULL) { + Logger::Warning("error opening file %s", filename.data()); + return false; + } + bool ret = openssl_pkcs12_export_impl(x509, bio_out, priv_key, pass, args); + BIO_free(bio_out); + return ret; +} + +bool f_openssl_pkcs12_export(CVarRef x509, Variant out, CVarRef priv_key, + CStrRef pass, CVarRef args /* = null_variant */) { + BIO *bio_out = BIO_new(BIO_s_mem()); + bool ret = openssl_pkcs12_export_impl(x509, bio_out, priv_key, pass, args); + if (ret) { + BUF_MEM *bio_buf; + BIO_get_mem_ptr(bio_out, &bio_buf); + out = String((char*)bio_buf->data, bio_buf->length, CopyString); + } + BIO_free(bio_out); + return ret; +} + +bool f_openssl_pkcs12_read(CStrRef pkcs12, Variant certs, CStrRef pass) { + bool ret = false; + PKCS12 *p12 = NULL; + + BIO *bio_in = BIO_new(BIO_s_mem()); + if (!BIO_write(bio_in, pkcs12.data(), pkcs12.size())) { + goto cleanup; + } + + if (d2i_PKCS12_bio(bio_in, &p12)) { + EVP_PKEY *pkey = NULL; + X509 *cert = NULL; + STACK_OF(X509) *ca = NULL; + if (PKCS12_parse(p12, pass.data(), &pkey, &cert, &ca)) { + certs = Array::Create(); + BIO *bio_out = BIO_new(BIO_s_mem()); + if (PEM_write_bio_X509(bio_out, cert)) { + BUF_MEM *bio_buf; + BIO_get_mem_ptr(bio_out, &bio_buf); + certs.set("cert", String((char*)bio_buf->data, bio_buf->length, + CopyString)); + } + BIO_free(bio_out); + + bio_out = BIO_new(BIO_s_mem()); + if (PEM_write_bio_PrivateKey(bio_out, pkey, NULL, NULL, 0, 0, NULL)) { + BUF_MEM *bio_buf; + BIO_get_mem_ptr(bio_out, &bio_buf); + certs.set("pkey", String((char*)bio_buf->data, bio_buf->length, + CopyString)); + } + BIO_free(bio_out); + + Array extracerts; + for (X509 *aCA = sk_X509_pop(ca); aCA; aCA = sk_X509_pop(ca)) { + bio_out = BIO_new(BIO_s_mem()); + if (PEM_write_bio_X509(bio_out, aCA)) { + BUF_MEM *bio_buf; + BIO_get_mem_ptr(bio_out, &bio_buf); + extracerts.append(String((char*)bio_buf->data, bio_buf->length, + CopyString)); + } + BIO_free(bio_out); + X509_free(aCA); + } + if (ca) { + sk_X509_free(ca); + certs.set("extracerts", extracerts); + } + ret = true; + PKCS12_free(p12); + } + } + + cleanup: + if (bio_in) { + BIO_free(bio_in); + } + + return ret; +} + +bool f_openssl_pkcs7_decrypt(CStrRef infilename, CStrRef outfilename, + CVarRef recipcert, + CVarRef recipkey /* = null_variant */) { + bool ret = false; + BIO *in = NULL, *out = NULL, *datain = NULL; + PKCS7 *p7 = NULL; + Object okey; + + Object ocert = Certificate::Get(recipcert); + if (ocert.isNull()) { + Logger::Warning("unable to coerce parameter 3 to x509 cert"); + goto clean_exit; + } + + okey = Key::Get(recipkey.isNull() ? recipcert : recipkey, false); + if (okey.isNull()) { + Logger::Warning("unable to get private key"); + goto clean_exit; + } + + in = BIO_new_file(infilename.data(), "r"); + if (in == NULL) { + Logger::Warning("error opening the file, %s", infilename.data()); + goto clean_exit; + } + out = BIO_new_file(outfilename.data(), "w"); + if (out == NULL) { + Logger::Warning("error opening the file, %s", outfilename.data()); + goto clean_exit; + } + + p7 = SMIME_read_PKCS7(in, &datain); + if (p7 == NULL) { + goto clean_exit; + } + ASSERT(okey.getTyped()->m_key); + ASSERT(ocert.getTyped()->m_cert); + if (PKCS7_decrypt(p7, okey.getTyped()->m_key, + ocert.getTyped()->m_cert, out, + PKCS7_DETACHED)) { + ret = true; + } + + clean_exit: + PKCS7_free(p7); + BIO_free(datain); + BIO_free(in); + BIO_free(out); + + return ret; +} + +static void print_headers(BIO *outfile, CArrRef headers) { + if (!headers.isNull()) { + if (headers->isVectorData()) { + for (ArrayIter iter(headers); iter; ++iter) { + BIO_printf(outfile, "%s\n", iter.second().toString().data()); + } + } else { + for (ArrayIter iter(headers); iter; ++iter) { + BIO_printf(outfile, "%s: %s\n", iter.first().toString().data(), + iter.second().toString().data()); + } + } + } +} + +bool f_openssl_pkcs7_encrypt(CStrRef infilename, CStrRef outfilename, + CVarRef recipcerts, CArrRef headers, + int flags /* = 0 */, + int cipherid /* = k_OPENSSL_CIPHER_RC2_40 */) { + bool ret = false; + BIO *infile = NULL, *outfile = NULL; + STACK_OF(X509) *precipcerts = NULL; + PKCS7 *p7 = NULL; + const EVP_CIPHER *cipher = NULL; + + infile = BIO_new_file(infilename.data(), "r"); + if (infile == NULL) { + Logger::Warning("error opening the file, %s", infilename.data()); + goto clean_exit; + } + outfile = BIO_new_file(outfilename, "w"); + if (outfile == NULL) { + Logger::Warning("error opening the file, %s", outfilename.data()); + goto clean_exit; + } + + precipcerts = php_array_to_X509_sk(recipcerts); + + /* sanity check the cipher */ + switch (cipherid) { +#ifndef OPENSSL_NO_RC2 + case PHP_OPENSSL_CIPHER_RC2_40: cipher = EVP_rc2_40_cbc(); break; + case PHP_OPENSSL_CIPHER_RC2_64: cipher = EVP_rc2_64_cbc(); break; + case PHP_OPENSSL_CIPHER_RC2_128: cipher = EVP_rc2_cbc(); break; +#endif +#ifndef OPENSSL_NO_DES + case PHP_OPENSSL_CIPHER_DES: cipher = EVP_des_cbc(); break; + case PHP_OPENSSL_CIPHER_3DES: cipher = EVP_des_ede3_cbc(); break; +#endif + default: + Logger::Warning("Invalid cipher type `%ld'", cipherid); + goto clean_exit; + } + if (cipher == NULL) { + Logger::Warning("Failed to get cipher"); + goto clean_exit; + } + + p7 = PKCS7_encrypt(precipcerts, infile, (EVP_CIPHER*)cipher, flags); + if (p7 == NULL) goto clean_exit; + + print_headers(outfile, headers); + (void)BIO_reset(infile); + SMIME_write_PKCS7(outfile, p7, infile, flags); + ret = true; + + clean_exit: + PKCS7_free(p7); + BIO_free(infile); + BIO_free(outfile); + sk_X509_free(precipcerts); + return ret; +} + +bool f_openssl_pkcs7_sign(CStrRef infilename, CStrRef outfilename, + CVarRef signcert, CVarRef privkey, CVarRef headers, + int flags /* = k_PKCS7_DETACHED */, + CStrRef extracerts /* = null_string */) { + bool ret = false; + STACK_OF(X509) *others = NULL; + BIO *infile = NULL, *outfile = NULL; + PKCS7 *p7 = NULL; + Object okey, ocert; + + if (!extracerts.empty()) { + others = load_all_certs_from_file(extracerts.data()); + if (others == NULL) { + goto clean_exit; + } + } + + okey = Key::Get(privkey, false); + if (okey.isNull()) { + Logger::Warning("error getting private key"); + goto clean_exit; + } + EVP_PKEY *key; + key = okey.getTyped()->m_key; + + ocert = Certificate::Get(signcert); + if (ocert.isNull()) { + Logger::Warning("error getting cert"); + goto clean_exit; + } + X509 *cert; + cert = ocert.getTyped()->m_cert; + + infile = BIO_new_file(infilename.data(), "r"); + if (infile == NULL) { + Logger::Warning("error opening input file %s!", infilename.data()); + goto clean_exit; + } + + outfile = BIO_new_file(outfilename.data(), "w"); + if (outfile == NULL) { + Logger::Warning("error opening output file %s!", outfilename.data()); + goto clean_exit; + } + + p7 = PKCS7_sign(cert, key, others, infile, flags); + if (p7 == NULL) { + Logger::Warning("error creating PKCS7 structure!"); + goto clean_exit; + } + + print_headers(outfile, headers.toArray()); + (void)BIO_reset(infile); + SMIME_write_PKCS7(outfile, p7, infile, flags); + ret = true; + + clean_exit: + PKCS7_free(p7); + BIO_free(infile); + BIO_free(outfile); + if (others) { + sk_X509_pop_free(others, X509_free); + } + + return ret; +} + +Variant f_openssl_pkcs7_verify(CStrRef filename, int flags, + CStrRef outfilename /* = null_string */, + CArrRef cainfo /* = null_array */, + CStrRef extracerts /* = null_string */, + CStrRef content /* = null_string */) { + Variant ret = -1; + X509_STORE *store = NULL; + BIO *in = NULL; + PKCS7 *p7 = NULL; + BIO *datain = NULL; + BIO *dataout = NULL; + + STACK_OF(X509) *others = NULL; + if (!extracerts.empty()) { + others = load_all_certs_from_file(extracerts.data()); + if (others == NULL) { + goto clean_exit; + } + } + + flags = flags & ~PKCS7_DETACHED; + + store = setup_verify(cainfo); + if (!store) { + goto clean_exit; + } + + in = BIO_new_file(filename.data(), (flags & PKCS7_BINARY) ? "rb" : "r"); + if (in == NULL) { + Logger::Warning("error opening the file, %s", filename.data()); + goto clean_exit; + } + + p7 = SMIME_read_PKCS7(in, &datain); + if (p7 == NULL) { + goto clean_exit; + } + + if (!content.empty()) { + dataout = BIO_new_file(content.data(), "w"); + if (dataout == NULL) { + Logger::Warning("error opening the file, %s", content.data()); + goto clean_exit; + } + } + + if (PKCS7_verify(p7, others, store, datain, dataout, flags)) { + ret = true; + if (!outfilename.empty()) { + BIO *certout = BIO_new_file(outfilename.data(), "w"); + if (certout) { + STACK_OF(X509) *signers = PKCS7_get0_signers(p7, NULL, flags); + for (int i = 0; i < sk_X509_num(signers); i++) { + PEM_write_bio_X509(certout, sk_X509_value(signers, i)); + } + BIO_free(certout); + sk_X509_free(signers); + } else { + Logger::Warning("signature OK, but cannot open %s for writing", + outfilename.data()); + ret = -1; + } + } + goto clean_exit; + } else { + ret = false; + } + + clean_exit: + X509_STORE_free(store); + BIO_free(datain); + BIO_free(in); + BIO_free(dataout); + PKCS7_free(p7); + sk_X509_free(others); + + return ret; +} + +static bool openssl_pkey_export_impl(CVarRef key, BIO *bio_out, + CStrRef passphrase /* = null_string */, + CVarRef configargs /* = null_variant */) { + Object okey = Key::Get(key, false, passphrase.data()); + if (okey.isNull()) { + Logger::Warning("cannot get key from parameter 1"); + return false; + } + EVP_PKEY *pkey = okey.getTyped()->m_key; + + struct php_x509_request req; + memset(&req, 0, sizeof(req)); + vector strings; + bool ret = false; + if (php_openssl_parse_config(&req, configargs.toArray(), strings)) { + const EVP_CIPHER *cipher; + if (!passphrase.empty() && req.priv_key_encrypt) { + cipher = (EVP_CIPHER *)EVP_des_ede3_cbc(); + } else { + cipher = NULL; + } + ASSERT(bio_out); + ret = PEM_write_bio_PrivateKey(bio_out, pkey, cipher, + (unsigned char *)passphrase.data(), + passphrase.size(), NULL, NULL); + } + php_openssl_dispose_config(&req); + return ret; +} + +bool f_openssl_pkey_export_to_file(CVarRef key, + CStrRef outfilename, + CStrRef passphrase /* = null_string */, + CVarRef configargs /* = null_variant */) { + BIO *bio_out = BIO_new_file(outfilename.data(), "w"); + if (bio_out == NULL) { + Logger::Warning("error opening the file, %s", outfilename.data()); + return false; + } + bool ret = openssl_pkey_export_impl(key, bio_out, passphrase, configargs); + BIO_free(bio_out); + return ret; +} + +bool f_openssl_pkey_export(CVarRef key, Variant out, + CStrRef passphrase /* = null_string */, + CVarRef configargs /* = null_variant */) { + BIO *bio_out = BIO_new(BIO_s_mem()); + bool ret = openssl_pkey_export_impl(key, bio_out, passphrase, configargs); + if (ret) { + char *bio_mem_ptr; + long bio_mem_len = BIO_get_mem_data(bio_out, &bio_mem_ptr); + out = String(bio_mem_ptr, bio_mem_len, CopyString); + } + BIO_free(bio_out); + return ret; +} + +void f_openssl_pkey_free(CObjRef key) { + // do nothing +} + +Array f_openssl_pkey_get_details(CObjRef key) { + EVP_PKEY *pkey = key.getTyped()->m_key; + BIO *out = BIO_new(BIO_s_mem()); + PEM_write_bio_PUBKEY(out, pkey); + char *pbio; + unsigned int pbio_len = BIO_get_mem_data(out, &pbio); + + Array ret; + ret.set("bits", EVP_PKEY_bits(pkey)); + ret.set("key", String(pbio, pbio_len, CopyString)); + long ktype = -1; + switch (EVP_PKEY_type(pkey->type)) { + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: ktype = k_OPENSSL_KEYTYPE_RSA; break; + case EVP_PKEY_DSA: + case EVP_PKEY_DSA2: + case EVP_PKEY_DSA3: + case EVP_PKEY_DSA4: ktype = k_OPENSSL_KEYTYPE_DSA; break; + case EVP_PKEY_DH: ktype = k_OPENSSL_KEYTYPE_DH; break; +#ifdef EVP_PKEY_EC + case EVP_PKEY_EC: ktype = k_OPENSSL_KEYTYPE_EC; break; +#endif + } + ret.set("type", ktype); + BIO_free(out); + return ret; +} + +Variant f_openssl_pkey_get_private(CVarRef key, + CStrRef passphrase /* = null_string */) { + Object okey = Key::Get(key, false, passphrase.data()); + if (okey.isNull()) { + return false; + } + return okey; +} + +Variant f_openssl_get_privatekey(CVarRef key, + CStrRef passphrase /* = null_string */) { + return f_openssl_pkey_get_private(key, passphrase); +} + +Variant f_openssl_pkey_get_public(CVarRef certificate) { + Object okey = Key::Get(certificate, true); + if (okey.isNull()) { + return false; + } + return okey; +} + +Variant f_openssl_get_publickey(CVarRef certificate) { + return f_openssl_pkey_get_public(certificate); +} + +Object f_openssl_pkey_new(CVarRef configargs /* = null_variant */) { + struct php_x509_request req; + memset(&req, 0, sizeof(req)); + + Object ret; + vector strings; + if (php_openssl_parse_config(&req, configargs.toArray(), strings) && + req.generatePrivateKey()) { + ret = Object(new Key(req.priv_key)); + } + + php_openssl_dispose_config(&req); + return ret; +} + +bool f_openssl_private_decrypt(CStrRef data, Variant decrypted, CVarRef key, + int padding /* = k_OPENSSL_PKCS1_PADDING */) { + Object okey = Key::Get(key, false); + if (okey.isNull()) { + Logger::Warning("key parameter is not a valid private key"); + return false; + } + EVP_PKEY *pkey = okey.getTyped()->m_key; + int cryptedlen = EVP_PKEY_size(pkey); + unsigned char *cryptedbuf = (unsigned char *)malloc(cryptedlen + 1); + + int successful = 0; + switch (pkey->type) { + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: + cryptedlen = RSA_private_decrypt(data.size(), + (unsigned char *)data.data(), + cryptedbuf, + pkey->pkey.rsa, + padding); + if (cryptedlen != -1) { + successful = 1; + } + break; + + default: + Logger::Warning("key type not supported"); + } + + if (successful) { + cryptedbuf[cryptedlen] = '\0'; + decrypted = String((char*)cryptedbuf, cryptedlen, AttachString); + return true; + } + + free(cryptedbuf); + return false; +} + +bool f_openssl_private_encrypt(CStrRef data, Variant crypted, CVarRef key, + int padding /* = k_OPENSSL_PKCS1_PADDING */) { + Object okey = Key::Get(key, false); + if (okey.isNull()) { + Logger::Warning("key param is not a valid private key"); + return false; + } + EVP_PKEY *pkey = okey.getTyped()->m_key; + int cryptedlen = EVP_PKEY_size(pkey); + unsigned char *cryptedbuf = (unsigned char *)malloc(cryptedlen + 1); + + int successful = 0; + switch (pkey->type) { + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: + successful = (RSA_private_encrypt(data.size(), + (unsigned char *)data.data(), + cryptedbuf, + pkey->pkey.rsa, + padding) == cryptedlen); + break; + default: + Logger::Warning("key type not supported"); + } + + if (successful) { + cryptedbuf[cryptedlen] = '\0'; + crypted = String((char*)cryptedbuf, cryptedlen, AttachString); + return true; + } + + free(cryptedbuf); + return false; +} + +bool f_openssl_public_decrypt(CStrRef data, Variant decrypted, CVarRef key, + int padding /* = k_OPENSSL_PKCS1_PADDING */) { + Object okey = Key::Get(key, true); + if (okey.isNull()) { + Logger::Warning("key parameter is not a valid public key"); + return false; + } + EVP_PKEY *pkey = okey.getTyped()->m_key; + int cryptedlen = EVP_PKEY_size(pkey); + unsigned char *cryptedbuf = (unsigned char *)malloc(cryptedlen + 1); + + int successful = 0; + switch (pkey->type) { + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: + cryptedlen = RSA_public_decrypt(data.size(), + (unsigned char *)data.data(), + cryptedbuf, + pkey->pkey.rsa, + padding); + if (cryptedlen != -1) { + successful = 1; + } + break; + + default: + Logger::Warning("key type not supported"); + } + + if (successful) { + cryptedbuf[cryptedlen] = '\0'; + decrypted = String((char*)cryptedbuf, cryptedlen, AttachString); + return true; + } + + free(cryptedbuf); + return false; +} + +bool f_openssl_public_encrypt(CStrRef data, Variant crypted, CVarRef key, + int padding /* = k_OPENSSL_PKCS1_PADDING */) { + Object okey = Key::Get(key, true); + if (okey.isNull()) { + Logger::Warning("key parameter is not a valid public key"); + return false; + } + EVP_PKEY *pkey = okey.getTyped()->m_key; + int cryptedlen = EVP_PKEY_size(pkey); + unsigned char *cryptedbuf = (unsigned char *)malloc(cryptedlen + 1); + + int successful = 0; + switch (pkey->type) { + case EVP_PKEY_RSA: + case EVP_PKEY_RSA2: + successful = (RSA_public_encrypt(data.size(), + (unsigned char *)data.data(), + cryptedbuf, + pkey->pkey.rsa, + padding) == cryptedlen); + break; + default: + Logger::Warning("key type not supported"); + } + + if (successful) { + cryptedbuf[cryptedlen] = '\0'; + crypted = String((char*)cryptedbuf, cryptedlen, AttachString); + return true; + } + + free(cryptedbuf); + return false; +} + +Variant f_openssl_seal(CStrRef data, Variant sealed_data, Variant env_keys, + CArrRef pub_key_ids) { + int nkeys = pub_key_ids.size(); + if (nkeys == 0) { + Logger::Warning("Fourth argument to openssl_seal() must be " + "a non-empty array"); + return false; + } + + EVP_PKEY **pkeys = (EVP_PKEY**)malloc(nkeys * sizeof(*pkeys)); + int *eksl = (int*)malloc(nkeys * sizeof(*eksl)); + unsigned char **eks = (unsigned char **)malloc(nkeys * sizeof(*eks)); + memset(eks, 0, sizeof(*eks) * nkeys); + vector holder; + + /* get the public keys we are using to seal this data */ + bool ret = true; + int i = 0; + for (ArrayIter iter(pub_key_ids); iter; ++iter, ++i) { + Object okey = Key::Get(iter.second(), true); + if (okey.isNull()) { + Logger::Warning("not a public key (%dth member of pubkeys)", i); + ret = false; + goto clean_exit; + } + holder.push_back(okey); + pkeys[i] = okey.getTyped()->m_key; + eks[i] = (unsigned char *)malloc(EVP_PKEY_size(pkeys[i]) + 1); + } + + EVP_CIPHER_CTX ctx; + if (!EVP_EncryptInit(&ctx, EVP_rc4(), NULL, NULL)) { + ret = false; + goto clean_exit; + } + + int len1, len2; + + unsigned char *buf; + buf = (unsigned char *)malloc(data.size() + EVP_CIPHER_CTX_block_size(&ctx)); + if (!EVP_SealInit(&ctx, EVP_rc4(), eks, eksl, NULL, pkeys, nkeys) || + !EVP_SealUpdate(&ctx, buf, &len1, (unsigned char *)data.data(), + data.size())) { + ret = false; + free(buf); + goto clean_exit; + } + + EVP_SealFinal(&ctx, buf + len1, &len2); + if (len1 + len2 > 0) { + buf[len1 + len2] = '\0'; + sealed_data = String((char*)buf, len1 + len2, AttachString); + + Array ekeys; + for (int i = 0; i < nkeys; i++) { + eks[i][eksl[i]] = '\0'; + ekeys.append(String((char*)eks[i], eksl[i], AttachString)); + eks[i] = NULL; + } + env_keys = ekeys; + + } else { + free(buf); + } + + clean_exit: + for (int i = 0; i < nkeys; i++) { + if (eks[i]) free(eks[i]); + } + free(eks); + free(eksl); + free(pkeys); + + if (ret) return len1 + len2; + return false; +} + +static const EVP_MD *php_openssl_get_evp_md_from_algo(long algo) { + switch (algo) { + case OPENSSL_ALGO_SHA1: return EVP_sha1(); + case OPENSSL_ALGO_MD5: return EVP_md5(); + case OPENSSL_ALGO_MD4: return EVP_md4(); + case OPENSSL_ALGO_MD2: return EVP_md2(); + } + return NULL; +} + +bool f_openssl_sign(CStrRef data, Variant signature, CVarRef priv_key_id, + int signature_alg /* = k_OPENSSL_ALGO_SHA1 */) { + Object okey = Key::Get(priv_key_id, false); + if (okey.isNull()) { + Logger::Warning("supplied key param cannot be coerced into a private key"); + return false; + } + + const EVP_MD *mdtype = php_openssl_get_evp_md_from_algo(signature_alg); + if (!mdtype) { + Logger::Warning("Unknown signature algorithm."); + return false; + } + + EVP_PKEY *pkey = okey.getTyped()->m_key; + int siglen = EVP_PKEY_size(pkey); + unsigned char *sigbuf = (unsigned char *)malloc(siglen + 1); + + EVP_MD_CTX md_ctx; + EVP_SignInit(&md_ctx, mdtype); + EVP_SignUpdate(&md_ctx, (unsigned char *)data.data(), data.size()); + if (EVP_SignFinal(&md_ctx, sigbuf, (unsigned int *)&siglen, pkey)) { + sigbuf[siglen] = '\0'; + signature = String((char*)sigbuf, siglen, AttachString); + return true; + } + + free(sigbuf); + return false; +} + +Variant f_openssl_verify(CStrRef data, CStrRef signature, CVarRef pub_key_id, + int signature_alg /* = k_OPENSSL_ALGO_SHA1 */) { + const EVP_MD *mdtype = php_openssl_get_evp_md_from_algo(signature_alg); + if (!mdtype) { + Logger::Warning("Unknown signature algorithm."); + return false; + } + + Object okey = Key::Get(pub_key_id, true); + if (okey.isNull()) { + Logger::Warning("supplied key param cannot be coerced into a public key"); + return false; + } + + EVP_MD_CTX md_ctx; + EVP_VerifyInit(&md_ctx, mdtype); + EVP_VerifyUpdate(&md_ctx, (unsigned char*)data.data(), data.size()); + return EVP_VerifyFinal(&md_ctx, (unsigned char *)signature.data(), + signature.size(), okey.getTyped()->m_key); +} + +bool f_openssl_x509_check_private_key(CVarRef cert, CVarRef key) { + Object ocert = Certificate::Get(cert); + if (ocert.isNull()) { + return false; + } + Object okey = Key::Get(key, false); + if (okey.isNull()) { + return false; + } + return X509_check_private_key(ocert.getTyped()->m_cert, + okey.getTyped()->m_key); +} + +static int check_cert(X509_STORE *ctx, X509 *x, STACK_OF(X509) *untrustedchain, + int purpose) { + X509_STORE_CTX *csc = X509_STORE_CTX_new(); + if (csc == NULL) { + Logger::Error("memory allocation failure"); + return 0; + } + X509_STORE_CTX_init(csc, ctx, x, untrustedchain); + + if (purpose >= 0) { + X509_STORE_CTX_set_purpose(csc, purpose); + } + + int ret = X509_verify_cert(csc); + X509_STORE_CTX_free(csc); + return ret; +} + +int f_openssl_x509_checkpurpose(CVarRef x509cert, int purpose, + CArrRef cainfo /* = null_array */, + CStrRef untrustedfile /* = null_string */) { + int ret = -1; + STACK_OF(X509) *untrustedchain = NULL; + X509_STORE *pcainfo = NULL; + Object ocert; + + if (!untrustedfile.empty()) { + untrustedchain = load_all_certs_from_file(untrustedfile.data()); + if (untrustedchain == NULL) { + goto clean_exit; + } + } + + pcainfo = setup_verify(cainfo); + if (pcainfo == NULL) { + goto clean_exit; + } + + ocert = Certificate::Get(x509cert); + if (ocert.isNull()) { + Logger::Warning("cannot get cert from parameter 1"); + return false; + } + X509 *cert; + cert = ocert.getTyped()->m_cert; + ASSERT(cert); + + ret = check_cert(pcainfo, cert, untrustedchain, purpose); + + clean_exit: + if (pcainfo) { + X509_STORE_free(pcainfo); + } + if (untrustedchain) { + sk_X509_pop_free(untrustedchain, X509_free); + } + return ret; +} + +static bool openssl_x509_export_impl(CVarRef x509, BIO *bio_out, + bool notext /* = true */) { + Object ocert = Certificate::Get(x509); + if (ocert.isNull()) { + Logger::Warning("cannot get cert from parameter 1"); + return false; + } + X509 *cert = ocert.getTyped()->m_cert; + ASSERT(cert); + + ASSERT(bio_out); + if (!notext) { + X509_print(bio_out, cert); + } + return PEM_write_bio_X509(bio_out, cert); +} + +bool f_openssl_x509_export_to_file(CVarRef x509, CStrRef outfilename, + bool notext /* = true */) { + BIO *bio_out = BIO_new_file((char*)outfilename.data(), "w"); + if (bio_out == NULL) { + Logger::Warning("error opening file %s", outfilename.data()); + return false; + } + bool ret = openssl_x509_export_impl(x509, bio_out, notext); + BIO_free(bio_out); + return ret; +} + +bool f_openssl_x509_export(CVarRef x509, Variant output, + bool notext /* = true */) { + BIO *bio_out = BIO_new(BIO_s_mem()); + bool ret = openssl_x509_export_impl(x509, bio_out, notext); + if (ret) { + BUF_MEM *bio_buf; + BIO_get_mem_ptr(bio_out, &bio_buf); + output = String(bio_buf->data, bio_buf->length, CopyString); + } + BIO_free(bio_out); + return ret; +} + +void f_openssl_x509_free(CObjRef x509cert) { + // do nothing +} + +/** + * This is how the time string is formatted: + * + * snprintf(p, sizeof(p), "%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100, + * ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); + */ +static time_t asn1_time_to_time_t(ASN1_UTCTIME *timestr) { + if (timestr->length < 13) { + Logger::Warning("extension author too lazy to parse %s correctly", + timestr->data); + return (time_t)-1; + } + + char *strbuf = strdup((char*)timestr->data); + + struct tm thetime; + memset(&thetime, 0, sizeof(thetime)); + + /* we work backwards so that we can use atoi more easily */ + char *thestr = strbuf + timestr->length - 3; + thetime.tm_sec = atoi(thestr); *thestr = '\0'; thestr -= 2; + thetime.tm_min = atoi(thestr); *thestr = '\0'; thestr -= 2; + thetime.tm_hour = atoi(thestr); *thestr = '\0'; thestr -= 2; + thetime.tm_mday = atoi(thestr); *thestr = '\0'; thestr -= 2; + thetime.tm_mon = atoi(thestr)-1; *thestr = '\0'; thestr -= 2; + thetime.tm_year = atoi(thestr); + if (thetime.tm_year < 68) { + thetime.tm_year += 100; + } + + thetime.tm_isdst = -1; + time_t ret = mktime(&thetime); + + long gmadjust = 0; +#if HAVE_TM_GMTOFF + gmadjust = thetime.tm_gmtoff; +#else + /** + * If correcting for daylight savings time, we set the adjustment to + * the value of timezone - 3600 seconds. Otherwise, we need to overcorrect + * and set the adjustment to the main timezone + 3600 seconds. + */ + gmadjust = -(thetime.tm_isdst ? + (long)timezone - 3600 : (long)timezone + 3600); +#endif + ret += gmadjust; + free(strbuf); + return ret; +} + +Variant f_openssl_x509_parse(CVarRef x509cert, bool shortnames /* = true */) { + Object ocert = Certificate::Get(x509cert); + if (ocert.isNull()) { + return false; + } + X509 *cert = ocert.getTyped()->m_cert; + ASSERT(cert); + + Array ret; + if (cert->name) { + ret.set("name", String(cert->name, CopyString)); + } + add_assoc_name_entry(ret, "subject", X509_get_subject_name(cert), + shortnames); + /* hash as used in CA directories to lookup cert by subject name */ + { + char buf[32]; + snprintf(buf, sizeof(buf), "%08lx", X509_subject_name_hash(cert)); + ret.set("hash", String(buf, CopyString)); + } + + add_assoc_name_entry(ret, "issuer", X509_get_issuer_name(cert), shortnames); + ret.set("version", X509_get_version(cert)); + + ret.set("serialNumber", String + (i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert)), AttachString)); + + ASN1_STRING *str = X509_get_notBefore(cert); + ret.set("validFrom", String((char*)str->data, str->length, CopyString)); + str = X509_get_notAfter(cert); + ret.set("validTo", String((char*)str->data, str->length, CopyString)); + + ret.set("validFrom_time_t", asn1_time_to_time_t(X509_get_notBefore(cert))); + ret.set("validTo_time_t", asn1_time_to_time_t(X509_get_notAfter(cert))); + + char *tmpstr = (char *)X509_alias_get0(cert, NULL); + if (tmpstr) { + ret.set("alias", String(tmpstr, CopyString)); + } + + /* NOTE: the purposes are added as integer keys - the keys match up to + the X509_PURPOSE_SSL_XXX defines in x509v3.h */ + { + Array subitem; + for (int i = 0; i < X509_PURPOSE_get_count(); i++) { + X509_PURPOSE *purp = X509_PURPOSE_get0(i); + int id = X509_PURPOSE_get_id(purp); + + Array subsub; + subsub.append((bool)X509_check_purpose(cert, id, 0)); + subsub.append((bool)X509_check_purpose(cert, id, 1)); + + char * pname = shortnames ? X509_PURPOSE_get0_sname(purp) : + X509_PURPOSE_get0_name(purp); + subsub.append(String(pname, CopyString)); + + subitem.set(id, subsub); + } + ret.set("purposes", subitem); + } + { + Array subitem; + for (int i = 0; i < X509_get_ext_count(cert); i++) { + X509_EXTENSION *extension = X509_get_ext(cert, i); + char *extname; + char buf[256]; + if (OBJ_obj2nid(X509_EXTENSION_get_object(extension)) != NID_undef) { + extname = (char*)OBJ_nid2sn(OBJ_obj2nid + (X509_EXTENSION_get_object(extension))); + } else { + OBJ_obj2txt(buf, sizeof(buf)-1, X509_EXTENSION_get_object(extension), + 1); + extname = buf; + } + BIO *bio_out = BIO_new(BIO_s_mem()); + if (X509V3_EXT_print(bio_out, extension, 0, 0)) { + BUF_MEM *bio_buf; + BIO_get_mem_ptr(bio_out, &bio_buf); + subitem.set(String(extname, CopyString), + String((char*)bio_buf->data, bio_buf->length, CopyString)); + } else { + ASN1_STRING *str = X509_EXTENSION_get_data(extension); + subitem.set(String(extname, CopyString), + String((char*)str->data, str->length, CopyString)); + } + BIO_free(bio_out); + } + ret.set("extensions", subitem); + } + + return ret; +} + +Variant f_openssl_x509_read(CVarRef x509certdata) { + Object ocert = Certificate::Get(x509certdata); + if (ocert.isNull()) { + Logger::Warning("supplied parameter cannot be coerced into " + "an X509 certificate!"); + return false; + } + return ocert; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_openssl.h b/src/cpp/ext/ext_openssl.h new file mode 100644 index 0000000000000..abd1bb8953e61 --- /dev/null +++ b/src/cpp/ext/ext_openssl.h @@ -0,0 +1,71 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_OPENSSL_H__ +#define __EXT_OPENSSL_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_openssl_csr_export_to_file(CVarRef csr, CStrRef outfilename, bool notext = true); +bool f_openssl_csr_export(CVarRef csr, Variant out, bool notext = true); +Variant f_openssl_csr_get_public_key(CVarRef csr); +Variant f_openssl_csr_get_subject(CVarRef csr, bool use_shortnames = true); +Variant f_openssl_csr_new(CArrRef dn, Variant privkey, CVarRef configargs = null_variant, CVarRef extraattribs = null_variant); +Variant f_openssl_csr_sign(CVarRef csr, CVarRef cacert, CVarRef priv_key, int days, CVarRef configargs = null_variant, int serial = 0); +Variant f_openssl_error_string(); +void f_openssl_free_key(CObjRef key); +bool f_openssl_open(CStrRef sealed_data, Variant open_data, CStrRef env_key, CVarRef priv_key_id); +bool f_openssl_pkcs12_export_to_file(CVarRef x509, CStrRef filename, CVarRef priv_key, CStrRef pass, CVarRef args = null_variant); +bool f_openssl_pkcs12_export(CVarRef x509, Variant out, CVarRef priv_key, CStrRef pass, CVarRef args = null_variant); +bool f_openssl_pkcs12_read(CStrRef pkcs12, Variant certs, CStrRef pass); +bool f_openssl_pkcs7_decrypt(CStrRef infilename, CStrRef outfilename, CVarRef recipcert, CVarRef recipkey = null_variant); +bool f_openssl_pkcs7_encrypt(CStrRef infilename, CStrRef outfilename, CVarRef recipcerts, CArrRef headers, int flags = 0, int cipherid = k_OPENSSL_CIPHER_RC2_40); +bool f_openssl_pkcs7_sign(CStrRef infilename, CStrRef outfilename, CVarRef signcert, CVarRef privkey, CVarRef headers, int flags = k_PKCS7_DETACHED, CStrRef extracerts = null_string); +Variant f_openssl_pkcs7_verify(CStrRef filename, int flags, CStrRef outfilename = null_string, CArrRef cainfo = null_array, CStrRef extracerts = null_string, CStrRef content = null_string); +bool f_openssl_pkey_export_to_file(CVarRef key, CStrRef outfilename, CStrRef passphrase = null_string, CVarRef configargs = null_variant); +bool f_openssl_pkey_export(CVarRef key, Variant out, CStrRef passphrase = null_string, CVarRef configargs = null_variant); +void f_openssl_pkey_free(CObjRef key); +Array f_openssl_pkey_get_details(CObjRef key); +Variant f_openssl_pkey_get_private(CVarRef key, CStrRef passphrase = null_string); +Variant f_openssl_get_privatekey(CVarRef key, CStrRef passphrase = null_string); +Variant f_openssl_pkey_get_public(CVarRef certificate); +Variant f_openssl_get_publickey(CVarRef certificate); +Object f_openssl_pkey_new(CVarRef configargs = null_variant); +bool f_openssl_private_decrypt(CStrRef data, Variant decrypted, CVarRef key, int padding = k_OPENSSL_PKCS1_PADDING); +bool f_openssl_private_encrypt(CStrRef data, Variant crypted, CVarRef key, int padding = k_OPENSSL_PKCS1_PADDING); +bool f_openssl_public_decrypt(CStrRef data, Variant decrypted, CVarRef key, int padding = k_OPENSSL_PKCS1_PADDING); +bool f_openssl_public_encrypt(CStrRef data, Variant crypted, CVarRef key, int padding = k_OPENSSL_PKCS1_PADDING); +Variant f_openssl_seal(CStrRef data, Variant sealed_data, Variant env_keys, CArrRef pub_key_ids); +bool f_openssl_sign(CStrRef data, Variant signature, CVarRef priv_key_id, int signature_alg = k_OPENSSL_ALGO_SHA1); +Variant f_openssl_verify(CStrRef data, CStrRef signature, CVarRef pub_key_id, int signature_alg = k_OPENSSL_ALGO_SHA1); +bool f_openssl_x509_check_private_key(CVarRef cert, CVarRef key); +int f_openssl_x509_checkpurpose(CVarRef x509cert, int purpose, CArrRef cainfo = null_array, CStrRef untrustedfile = null_string); +bool f_openssl_x509_export_to_file(CVarRef x509, CStrRef outfilename, bool notext = true); +bool f_openssl_x509_export(CVarRef x509, Variant output, bool notext = true); +void f_openssl_x509_free(CObjRef x509cert); +Variant f_openssl_x509_parse(CVarRef x509cert, bool shortnames = true); +Variant f_openssl_x509_read(CVarRef x509certdata); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_OPENSSL_H__ diff --git a/src/cpp/ext/ext_options.cpp b/src/cpp/ext/ext_options.cpp new file mode 100644 index 0000000000000..5c8ad5e4c34b0 --- /dev/null +++ b/src/cpp/ext/ext_options.cpp @@ -0,0 +1,586 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class OptionData : public RequestEventHandler { +public: + virtual void requestInit() { + assertActive = RuntimeOption::AssertActive ? 1 : 0; + assertWarning = RuntimeOption::AssertWarning ? 1 : 0; + assertBail = 0; + } + + virtual void requestShutdown() { } + + int assertActive; + int assertWarning; + int assertBail; + Variant assertCallback; +}; + +static RequestLocal s_option_data; + +Variant f_assert_options(int what, CVarRef value /* = null_variant */) { + if (what == k_ASSERT_ACTIVE) { + int oldValue = s_option_data->assertActive; + if (!value.isNull()) s_option_data->assertActive = value.toInt64(); + return oldValue; + } else if (what == k_ASSERT_WARNING) { + int oldValue = s_option_data->assertWarning; + if (!value.isNull()) s_option_data->assertWarning = value.toInt64(); + return oldValue; + } else if (what == k_ASSERT_BAIL) { + int oldValue = s_option_data->assertBail; + if (!value.isNull()) s_option_data->assertBail = value.toInt64(); + return oldValue; + } else if (what == k_ASSERT_CALLBACK) { + Variant oldValue = s_option_data->assertCallback; + if (!value.isNull()) s_option_data->assertCallback = value; + return oldValue; + } else { + throw InvalidArgumentException(0, "assert option %d is not supported", + what); + } + return false; +} + +Variant f_assert(CVarRef assertion) { + if (!s_option_data->assertActive) return true; + if (assertion.isString()) { + throw NotSupportedException(__func__, + "assert cannot take string argument"); + } + if (assertion.toBoolean()) return true; + + // assertion failed + if (!s_option_data->assertCallback.isNull()) { + f_call_user_func(1, s_option_data->assertCallback); + } + + if (s_option_data->assertWarning) { + Logger::Warning("Assertion failed"); + } + if (s_option_data->assertBail) { + throw Assertion(); + } + return null; +} + +int f_dl(CStrRef library) { + return 0; +} + +bool f_extension_loaded(CStrRef name) { + return + !strcasecmp(name, "phpmcc") || + !strcasecmp(name, "bcmath") || + !strcasecmp(name, "spl") || + !strcasecmp(name, "curl") || + !strcasecmp(name, "simplexml"); +} + +Array f_get_loaded_extensions(bool zend_extensions /* = false */) { + throw NotSupportedException(__func__, "extensions are built differently"); +} + +Array f_get_extension_funcs(CStrRef module_name) { + throw NotSupportedException(__func__, "extensions are built differently"); +} + +String f_get_cfg_var(CStrRef option) { + throw NotSupportedException(__func__, "global configurations not used"); +} + +String f_get_current_user() { + int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); + if (pwbuflen < 1) { + return ""; + } + char *pwbuf = (char*)malloc(pwbuflen); + struct passwd pw; + struct passwd *retpwptr = NULL; + if (getpwuid_r(getuid(), &pw, pwbuf, pwbuflen, &retpwptr) != 0) { + free(pwbuf); + return ""; + } + String ret(pw.pw_name, CopyString); + free(pwbuf); + return ret; +} + +Array f_get_defined_constants(CVarRef categorize /* = null_variant */) { + if (categorize) { + throw NotSupportedException(__func__, "constant categization not " + "supported"); + } + return ClassInfo::GetConstants(); +} + +String f_get_include_path() { + return ""; +} + +void f_restore_include_path() { +} + +String f_set_include_path(CStrRef new_include_path) { + return ""; +} + +Array f_get_included_files() { + return Array::Create(); +} + +int f_get_magic_quotes_gpc() { + return 0; +} + +int f_get_magic_quotes_runtime() { + throw NotSupportedException(__func__, "not using magic quotes"); +} + +Array f_get_required_files() { + throw NotSupportedException(__func__, "requires PHP source code"); +} + +Variant f_getenv(CStrRef varname) { + char *value = getenv((const char *)varname); + if (value) { + return String(value, CopyString); + } + return false; +} + +int f_getlastmod() { + throw NotSupportedException(__func__, "page modified time not supported"); +} + +int f_getmygid() { + return getgid(); +} + +int f_getmyinode() { + throw NotSupportedException(__func__, "not exposing operating system info"); +} + +int f_getmypid() { + return getpid(); +} + +int f_getmyuid() { + return getuid(); +} + +Array f_getopt(CStrRef options, CVarRef longopts /* = null_variant */) { + throw NotSupportedException(__func__, "global configurations not used"); +} + +#define PHP_RUSAGE_PARA(a) NEW(ArrayElement)(#a, (int64)usg.a) +Array f_getrusage(int who /* = 0 */) { + struct rusage usg; + memset(&usg, 0, sizeof(struct rusage)); + + if (getrusage(who == 1 ? RUSAGE_CHILDREN : RUSAGE_SELF, &usg) == -1) { + throw SystemCallFailure("getrusage"); + } + + return Array(PHP_RUSAGE_PARA(ru_oublock), + PHP_RUSAGE_PARA(ru_inblock), + PHP_RUSAGE_PARA(ru_msgsnd), + PHP_RUSAGE_PARA(ru_msgrcv), + PHP_RUSAGE_PARA(ru_maxrss), + PHP_RUSAGE_PARA(ru_ixrss), + PHP_RUSAGE_PARA(ru_idrss), + PHP_RUSAGE_PARA(ru_minflt), + PHP_RUSAGE_PARA(ru_majflt), + PHP_RUSAGE_PARA(ru_nsignals), + PHP_RUSAGE_PARA(ru_nvcsw), + PHP_RUSAGE_PARA(ru_nivcsw), + PHP_RUSAGE_PARA(ru_nswap), + PHP_RUSAGE_PARA(ru_utime.tv_usec), + PHP_RUSAGE_PARA(ru_utime.tv_sec), + PHP_RUSAGE_PARA(ru_stime.tv_usec), + PHP_RUSAGE_PARA(ru_stime.tv_sec), + NULL); +} + +bool f_clock_getres(int clk_id, Variant sec, Variant nsec) { + struct timespec ts; + int ret = clock_getres(clk_id, &ts); + sec = (int64)ts.tv_sec; + nsec = (int64)ts.tv_nsec; + return ret == 0; +} + +bool f_clock_gettime(int clk_id, Variant sec, Variant nsec) { + struct timespec ts; + int ret = clock_gettime(clk_id, &ts); + sec = (int64)ts.tv_sec; + nsec = (int64)ts.tv_nsec; + return ret == 0; +} + +bool f_clock_settime(int clk_id, int64 sec, int64 nsec) { + struct timespec ts; + ts.tv_sec = sec; + ts.tv_nsec = nsec; + int ret = clock_settime(clk_id, &ts); + return ret == 0; +} + +String f_ini_alter(CStrRef varname, CStrRef newvalue) { + throw NotSupportedException(__func__, "not using ini"); +} + +Array f_ini_get_all(CStrRef extension /* = null_string */) { + throw NotSupportedException(__func__, "not using ini"); +} + +String f_ini_get(CStrRef varname) { + if (varname == "error_reporting") { + return g_context->getErrorReportingLevel(); + } + if (varname == "memory_limit") { + return (int64)RuntimeOption::RequestMemoryMaxBytes; + } + if (varname == "max_execution_time") { + return (int64)RuntimeOption::RequestTimeoutSeconds; + } + return ""; +} + +void f_ini_restore(CStrRef varname) { +} + +String f_ini_set(CStrRef varname, CStrRef newvalue) { + return ""; +} + +int64 f_memory_get_peak_usage(bool real_usage /* = false */) { + if (RuntimeOption::EnableMemoryManager) { + MemoryManager *mm = MemoryManager::TheMemoryManager().get(); + const MemoryUsageStats &stats = mm->getStats(); + return real_usage ? stats.peakUsage : stats.peakAlloc; + } + return (int64)Process::GetProcessRSS(Process::GetProcessId()) * 1024 * 1024; +} + +int64 f_memory_get_usage(bool real_usage /* = false */) { + if (RuntimeOption::EnableMemoryManager) { + MemoryManager *mm = MemoryManager::TheMemoryManager().get(); + const MemoryUsageStats &stats = mm->getStats(); + return real_usage ? stats.usage : stats.alloc; + } + return (int64)Process::GetProcessRSS(Process::GetProcessId()) * 1024 * 1024; +} + +String f_php_ini_scanned_files() { + throw NotSupportedException(__func__, "not using ini"); +} + +String f_php_logo_guid() { + throw NotSupportedException(__func__, "not PHP anymore"); +} + +String f_php_sapi_name() { + return RuntimeOption::ExecutionMode; +} + +String f_php_uname(CStrRef mode /* = null_string */) { + String ret; + struct utsname buf; + if (uname((struct utsname *)&buf) != -1) { + if (mode == "s") { + ret = String(buf.sysname, CopyString); + } else if (mode == "r") { + ret = String(buf.release, CopyString); + } else if (mode == "n") { + ret = String(buf.nodename, CopyString); + } else if (mode == "v") { + ret = String(buf.version, CopyString); + } else if (mode == "m") { + ret = String(buf.machine, CopyString); + } else { /* assume mode == "a" */ + char tmp_uname[512]; + snprintf(tmp_uname, sizeof(tmp_uname), "%s %s %s %s %s", + buf.sysname, buf.nodename, buf.release, buf.version, + buf.machine); + ret = String(tmp_uname, CopyString); + } + } + return ret; +} + +bool f_phpcredits(int flag /* = 0 */) { + throw NotSupportedException(__func__, "not PHP anymore"); +} + +bool f_phpinfo(int what /* = 0 */) { + echo("HPHP\n"); + return false; +} + +String f_phpversion(CStrRef extension /* = null_string */) { + return "5.2.5.hphp"; +} + +bool f_putenv(CStrRef setting) { + throw NotSupportedException(__func__, "setting environment variables is not a good coding practice in multithreading environment, and we are not supporting it until we find legitimate use cases, then maybe we will have dedicated functions to do them in thread-safe manner"); +} + +bool f_set_magic_quotes_runtime(bool new_setting) { + if (new_setting) { + throw NotSupportedException(__func__, "not using magic quotes"); + } + return true; +} + +void f_set_time_limit(int seconds) { + TimeoutThread::DeferTimeout(seconds); +} + +String f_sys_get_temp_dir() { + char *env = getenv("TMPDIR"); + if (env && *env) return String(env, CopyString); + return "/tmp"; +} + +String f_zend_logo_guid() { + throw NotSupportedException(__func__, "not zend anymore"); +} + +int f_zend_thread_id() { + throw NotSupportedException(__func__, "not zend anymore"); +} + +String f_zend_version() { + throw NotSupportedException(__func__, "not zend anymore"); +} + +/////////////////////////////////////////////////////////////////////////////// + +#define sign(n) ((n)<0?-1:((n)>0?1:0)) + +static char *php_canonicalize_version(const char *version) { + int len = strlen(version); + char *buf = (char*)malloc(len * 2 + 1), *q, lp, lq; + const char *p; + + if (len == 0) { + *buf = '\0'; + return buf; + } + + p = version; + q = buf; + *q++ = lp = *p++; + lq = '\0'; + while (*p) { + /* s/[-_+]/./g; + * s/([^\d\.])([^\D\.])/$1.$2/g; + * s/([^\D\.])([^\d\.])/$1.$2/g; + */ +#define isdig(x) (isdigit(x)&&(x)!='.') +#define isndig(x) (!isdigit(x)&&(x)!='.') +#define isspecialver(x) ((x)=='-'||(x)=='_'||(x)=='+') + + lq = *(q - 1); + if (isspecialver(*p)) { + if (lq != '.') { + lq = *q++ = '.'; + } + } else if ((isndig(lp) && isdig(*p)) || (isdig(lp) && isndig(*p))) { + if (lq != '.') { + *q++ = '.'; + } + lq = *q++ = *p; + } else if (!isalnum(*p)) { + if (lq != '.') { + lq = *q++ = '.'; + } + } else { + lq = *q++ = *p; + } + lp = *p++; + } + *q++ = '\0'; + return buf; +} + +typedef struct { + const char *name; + int order; +} special_forms_t; + +static int compare_special_version_forms(const char *form1, const char *form2) { + int found1 = -1, found2 = -1; + special_forms_t special_forms[11] = { + {"dev", 0}, + {"alpha", 1}, + {"a", 1}, + {"beta", 2}, + {"b", 2}, + {"RC", 3}, + {"rc", 3}, + {"#", 4}, + {"pl", 5}, + {"p", 5}, + {NULL, 0}, + }; + special_forms_t *pp; + + for (pp = special_forms; pp && pp->name; pp++) { + if (strncmp(form1, pp->name, strlen(pp->name)) == 0) { + found1 = pp->order; + break; + } + } + for (pp = special_forms; pp && pp->name; pp++) { + if (strncmp(form2, pp->name, strlen(pp->name)) == 0) { + found2 = pp->order; + break; + } + } + return sign(found1 - found2); +} + +static int php_version_compare(const char *orig_ver1, const char *orig_ver2) { + char *ver1; + char *ver2; + char *p1, *p2, *n1, *n2; + long l1, l2; + int compare = 0; + + if (!*orig_ver1 || !*orig_ver2) { + if (!*orig_ver1 && !*orig_ver2) { + return 0; + } else { + return *orig_ver1 ? 1 : -1; + } + } + if (orig_ver1[0] == '#') { + ver1 = strdup(orig_ver1); + } else { + ver1 = php_canonicalize_version(orig_ver1); + } + if (orig_ver2[0] == '#') { + ver2 = strdup(orig_ver2); + } else { + ver2 = php_canonicalize_version(orig_ver2); + } + p1 = n1 = ver1; + p2 = n2 = ver2; + while (*p1 && *p2 && n1 && n2) { + if ((n1 = strchr(p1, '.')) != NULL) { + *n1 = '\0'; + } + if ((n2 = strchr(p2, '.')) != NULL) { + *n2 = '\0'; + } + if (isdigit(*p1) && isdigit(*p2)) { + /* compare element numerically */ + l1 = strtol(p1, NULL, 10); + l2 = strtol(p2, NULL, 10); + compare = sign(l1 - l2); + } else if (!isdigit(*p1) && !isdigit(*p2)) { + /* compare element names */ + compare = compare_special_version_forms(p1, p2); + } else { + /* mix of names and numbers */ + if (isdigit(*p1)) { + compare = compare_special_version_forms("#N#", p2); + } else { + compare = compare_special_version_forms(p1, "#N#"); + } + } + if (compare != 0) { + break; + } + if (n1 != NULL) { + p1 = n1 + 1; + } + if (n2 != NULL) { + p2 = n2 + 1; + } + } + if (compare == 0) { + if (n1 != NULL) { + if (isdigit(*p1)) { + compare = 1; + } else { + compare = php_version_compare(p1, "#N#"); + } + } else if (n2 != NULL) { + if (isdigit(*p2)) { + compare = -1; + } else { + compare = php_version_compare("#N#", p2); + } + } + } + free(ver1); + free(ver2); + return compare; +} + +Variant f_version_compare(CStrRef version1, CStrRef version2, + CStrRef sop /* = null_string */) { + const char *op = sop.data(); + int op_len = sop.size(); + int compare = php_version_compare(version1.data(), version2.data()); + if (sop.empty()) { + return compare; + } + if (!strncmp(op, "<", op_len) || !strncmp(op, "lt", op_len)) { + return compare == -1; + } + if (!strncmp(op, "<=", op_len) || !strncmp(op, "le", op_len)) { + return compare != 1; + } + if (!strncmp(op, ">", op_len) || !strncmp(op, "gt", op_len)) { + return compare == 1; + } + if (!strncmp(op, ">=", op_len) || !strncmp(op, "ge", op_len)) { + return compare != -1; + } + if (!strncmp(op, "==", op_len) || !strncmp(op, "=", op_len) || + !strncmp(op, "eq", op_len)) { + return compare == 0; + } + if (!strncmp(op, "!=", op_len) || !strncmp(op, "<>", op_len) || + !strncmp(op, "ne", op_len)) { + return compare != 0; + } + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_options.h b/src/cpp/ext/ext_options.h new file mode 100644 index 0000000000000..d133c07126ebe --- /dev/null +++ b/src/cpp/ext/ext_options.h @@ -0,0 +1,81 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_OPTIONS_H__ +#define __EXT_OPTIONS_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_assert_options(int what, CVarRef value = null_variant); +Variant f_assert(CVarRef assertion); +int f_dl(CStrRef library); +bool f_extension_loaded(CStrRef name); +Array f_get_loaded_extensions(bool zend_extensions = false); +Array f_get_extension_funcs(CStrRef module_name); +String f_get_cfg_var(CStrRef option); +String f_get_current_user(); +Array f_get_defined_constants(CVarRef categorize = null_variant); +String f_get_include_path(); +void f_restore_include_path(); +String f_set_include_path(CStrRef new_include_path); +Array f_get_included_files(); +int f_get_magic_quotes_gpc(); +int f_get_magic_quotes_runtime(); +Array f_get_required_files(); +Variant f_getenv(CStrRef varname); +int f_getlastmod(); +int f_getmygid(); +int f_getmyinode(); +int f_getmypid(); +int f_getmyuid(); +Array f_getopt(CStrRef options, CVarRef longopts = null_variant); +Array f_getrusage(int who = 0); +bool f_clock_getres(int clk_id, Variant sec, Variant nsec); +bool f_clock_gettime(int clk_id, Variant sec, Variant nsec); +bool f_clock_settime(int clk_id, int64 sec, int64 nsec); +String f_ini_alter(CStrRef varname, CStrRef newvalue); +Array f_ini_get_all(CStrRef extension = null_string); +String f_ini_get(CStrRef varname); +void f_ini_restore(CStrRef varname); +String f_ini_set(CStrRef varname, CStrRef newvalue); +int64 f_memory_get_peak_usage(bool real_usage = false); +int64 f_memory_get_usage(bool real_usage = false); +String f_php_ini_scanned_files(); +String f_php_logo_guid(); +String f_php_sapi_name(); +String f_php_uname(CStrRef mode = null_string); +bool f_phpcredits(int flag = 0); +bool f_phpinfo(int what = 0); +String f_phpversion(CStrRef extension = null_string); +bool f_putenv(CStrRef setting); +bool f_set_magic_quotes_runtime(bool new_setting); +void f_set_time_limit(int seconds); +String f_sys_get_temp_dir(); +Variant f_version_compare(CStrRef version1, CStrRef version2, CStrRef sop = null_string); +String f_zend_logo_guid(); +int f_zend_thread_id(); +String f_zend_version(); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_OPTIONS_H__ diff --git a/src/cpp/ext/ext_oracle.cpp b/src/cpp/ext/ext_oracle.cpp new file mode 100644 index 0000000000000..7c06ba3c47906 --- /dev/null +++ b/src/cpp/ext/ext_oracle.cpp @@ -0,0 +1,294 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include "crutch.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Object f_oci_connect(CStrRef username, CStrRef password, CStrRef db /* = null_string */, CStrRef charset /* = null_string */, int session_mode /* = 0 */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(username), NEW(ArrayElement)(password), NEW(ArrayElement)(db), NEW(ArrayElement)(charset), NEW(ArrayElement)(session_mode), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_connect", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_oci_new_connect(CStrRef username, CStrRef password, CStrRef db /* = null_string */, CStrRef charset /* = null_string */, int session_mode /* = 0 */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(username), NEW(ArrayElement)(password), NEW(ArrayElement)(db), NEW(ArrayElement)(charset), NEW(ArrayElement)(session_mode), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_new_connect", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_oci_pconnect(CStrRef username, CStrRef password, CStrRef db /* = null_string */, CStrRef charset /* = null_string */, int session_mode /* = 0 */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(username), NEW(ArrayElement)(password), NEW(ArrayElement)(db), NEW(ArrayElement)(charset), NEW(ArrayElement)(session_mode), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_pconnect", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +String f_oci_server_version(CObjRef connection) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(connection)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_server_version", _schema, _params); + return (Variant)_ret[0]; +} + +Variant f_oci_password_change(CVarRef connection, CStrRef username, CStrRef old_password, CStrRef new_password) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(connection), NEW(ArrayElement)(username), NEW(ArrayElement)(old_password), NEW(ArrayElement)(new_password), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_password_change", _schema, _params); + return (Variant)_ret[0]; +} + +Object f_oci_new_cursor(CObjRef connection) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(connection)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_new_cursor", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Object f_oci_new_descriptor(CObjRef connection, int type /* = 0 */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(connection)), NEW(ArrayElement)(type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_new_descriptor", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_oci_close(CObjRef connection) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(connection)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_close", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_oci_commit(CObjRef connection) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(connection)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_commit", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_oci_rollback(CObjRef connection) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(connection)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_rollback", _schema, _params); + return (Variant)_ret[0]; +} + +Array f_oci_error(CObjRef source /* = null */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(source)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_error", _schema, _params); + return (Variant)_ret[0]; +} + +void f_oci_internal_debug(bool onoff) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(onoff), (ArrayElement*)NULL); + Crutch::Invoke("oci_internal_debug", _schema, _params); +} + +Object f_oci_parse(CObjRef connection, CStrRef query) { + Array _schema(NEW(ArrayElement)(-1, "OO"), NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(connection)), NEW(ArrayElement)(query), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_parse", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +String f_oci_statement_type(CObjRef statement) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_statement_type", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_oci_free_statement(CObjRef statement) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_free_statement", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_oci_free_descriptor(CObjRef lob) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(lob)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_free_descriptor", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_oci_bind_array_by_name(CObjRef statement, CStrRef name, Variant var_array, int max_table_length, int max_item_length /* = 0 */, int type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(2, "R"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(name), NEW(ArrayElement)(var_array), NEW(ArrayElement)(max_table_length), NEW(ArrayElement)(max_item_length), NEW(ArrayElement)(type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_bind_array_by_name", _schema, _params); + var_array = ((Variant)_ret[1])[2]; + return (Variant)_ret[0]; +} + +bool f_oci_bind_by_name(CObjRef statement, CStrRef ph_name, Variant variable, int max_length /* = 0 */, int type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(2, "R"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(ph_name), NEW(ArrayElement)(variable), NEW(ArrayElement)(max_length), NEW(ArrayElement)(type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_bind_by_name", _schema, _params); + variable = ((Variant)_ret[1])[2]; + return (Variant)_ret[0]; +} + +bool f_oci_cancel(CObjRef statement) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_cancel", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_oci_define_by_name(CObjRef statement, CStrRef column_name, Variant variable, int type /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(2, "R"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(column_name), NEW(ArrayElement)(variable), NEW(ArrayElement)(type), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_define_by_name", _schema, _params); + variable = ((Variant)_ret[1])[2]; + return (Variant)_ret[0]; +} + +bool f_oci_execute(CObjRef statement, int mode /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(mode), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_execute", _schema, _params); + return (Variant)_ret[0]; +} + +int f_oci_num_fields(CObjRef statement) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_num_fields", _schema, _params); + return (Variant)_ret[0]; +} + +int f_oci_num_rows(CObjRef statement) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_num_rows", _schema, _params); + return (Variant)_ret[0]; +} + +Variant f_oci_result(CObjRef statement, CVarRef field) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(field), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_result", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_oci_set_prefetch(CObjRef statement, int rows) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(rows), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_set_prefetch", _schema, _params); + return (Variant)_ret[0]; +} + +int f_oci_fetch_all(CObjRef statement, Variant output, int skip /* = 0 */, int maxrows /* = 0 */, int flags /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "R"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(output), NEW(ArrayElement)(skip), NEW(ArrayElement)(maxrows), NEW(ArrayElement)(flags), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_fetch_all", _schema, _params); + output = ((Variant)_ret[1])[1]; + return (Variant)_ret[0]; +} + +Variant f_oci_fetch_array(CObjRef statement, int mode /* = 0 */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(mode), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_fetch_array", _schema, _params); + return (Variant)_ret[0]; +} + +Variant f_oci_fetch_assoc(CObjRef statement) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_fetch_assoc", _schema, _params); + return (Variant)_ret[0]; +} + +Variant f_oci_fetch_object(CObjRef statement) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_fetch_object", _schema, _params); + return (Variant)_ret[0]; +} + +Variant f_oci_fetch_row(CObjRef statement) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_fetch_row", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_oci_fetch(CObjRef statement) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_fetch", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_oci_field_is_null(CObjRef statement, CVarRef field) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(field), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_field_is_null", _schema, _params); + return (Variant)_ret[0]; +} + +String f_oci_field_name(CObjRef statement, int field) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(field), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_field_name", _schema, _params); + return (Variant)_ret[0]; +} + +int f_oci_field_precision(CObjRef statement, int field) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(field), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_field_precision", _schema, _params); + return (Variant)_ret[0]; +} + +int f_oci_field_scale(CObjRef statement, int field) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(field), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_field_scale", _schema, _params); + return (Variant)_ret[0]; +} + +int f_oci_field_size(CObjRef statement, CVarRef field) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(field), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_field_size", _schema, _params); + return (Variant)_ret[0]; +} + +int f_oci_field_type_raw(CObjRef statement, int field) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(field), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_field_type_raw", _schema, _params); + return (Variant)_ret[0]; +} + +Variant f_oci_field_type(CObjRef statement, int field) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(statement)), NEW(ArrayElement)(field), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("oci_field_type", _schema, _params); + return (Variant)_ret[0]; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_oracle.h b/src/cpp/ext/ext_oracle.h new file mode 100644 index 0000000000000..91aaa4512f903 --- /dev/null +++ b/src/cpp/ext/ext_oracle.h @@ -0,0 +1,70 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_ORACLE_H__ +#define __EXT_ORACLE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Object f_oci_connect(CStrRef username, CStrRef password, CStrRef db = null_string, CStrRef charset = null_string, int session_mode = 0); +Object f_oci_new_connect(CStrRef username, CStrRef password, CStrRef db = null_string, CStrRef charset = null_string, int session_mode = 0); +Object f_oci_pconnect(CStrRef username, CStrRef password, CStrRef db = null_string, CStrRef charset = null_string, int session_mode = 0); +String f_oci_server_version(CObjRef connection); +Variant f_oci_password_change(CVarRef connection, CStrRef username, CStrRef old_password, CStrRef new_password); +Object f_oci_new_cursor(CObjRef connection); +Object f_oci_new_descriptor(CObjRef connection, int type = 0); +bool f_oci_close(CObjRef connection); +bool f_oci_commit(CObjRef connection); +bool f_oci_rollback(CObjRef connection); +Array f_oci_error(CObjRef source = null); +void f_oci_internal_debug(bool onoff); +Object f_oci_parse(CObjRef connection, CStrRef query); +String f_oci_statement_type(CObjRef statement); +bool f_oci_free_statement(CObjRef statement); +bool f_oci_free_descriptor(CObjRef lob); +bool f_oci_bind_array_by_name(CObjRef statement, CStrRef name, Variant var_array, int max_table_length, int max_item_length = 0, int type = 0); +bool f_oci_bind_by_name(CObjRef statement, CStrRef ph_name, Variant variable, int max_length = 0, int type = 0); +bool f_oci_cancel(CObjRef statement); +bool f_oci_define_by_name(CObjRef statement, CStrRef column_name, Variant variable, int type = 0); +bool f_oci_execute(CObjRef statement, int mode = 0); +int f_oci_num_fields(CObjRef statement); +int f_oci_num_rows(CObjRef statement); +Variant f_oci_result(CObjRef statement, CVarRef field); +bool f_oci_set_prefetch(CObjRef statement, int rows); +int f_oci_fetch_all(CObjRef statement, Variant output, int skip = 0, int maxrows = 0, int flags = 0); +Variant f_oci_fetch_array(CObjRef statement, int mode = 0); +Variant f_oci_fetch_assoc(CObjRef statement); +Variant f_oci_fetch_object(CObjRef statement); +Variant f_oci_fetch_row(CObjRef statement); +bool f_oci_fetch(CObjRef statement); +bool f_oci_field_is_null(CObjRef statement, CVarRef field); +String f_oci_field_name(CObjRef statement, int field); +int f_oci_field_precision(CObjRef statement, int field); +int f_oci_field_scale(CObjRef statement, int field); +int f_oci_field_size(CObjRef statement, CVarRef field); +int f_oci_field_type_raw(CObjRef statement, int field); +Variant f_oci_field_type(CObjRef statement, int field); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_ORACLE_H__ diff --git a/src/cpp/ext/ext_output.cpp b/src/cpp/ext/ext_output.cpp new file mode 100644 index 0000000000000..6150640306f5e --- /dev/null +++ b/src/cpp/ext/ext_output.cpp @@ -0,0 +1,67 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static ReadWriteMutex s_loggers_mutex; +typedef std::map LoggerMap; +static LoggerMap s_loggers; + +bool f_hphp_log(CStrRef filename, CStrRef message) { + if (!RuntimeOption::EnableApplicationLog) { + return false; + } + + FILE *f = NULL; + { + ReadLock lock(s_loggers_mutex); + LoggerMap::const_iterator iter = s_loggers.find(filename.data()); + if (iter != s_loggers.end()) { + f = iter->second; + } + } + if (f == NULL) { + WriteLock lock(s_loggers_mutex); + LoggerMap::const_iterator iter = s_loggers.find(filename.data()); + if (iter != s_loggers.end()) { + f = iter->second; + } else { + if (filename.charAt(0) == '|') { + f = popen(filename.data() + 1, "w"); + } else { + f = fopen(filename.data(), "a"); + } + if (f == NULL) { + return false; + } + s_loggers[filename.data()] = f; + } + } + bool ret = (fwrite(message.data(), message.size(), 1, f) == 1); + if (ret) { + fflush(f); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_output.h b/src/cpp/ext/ext_output.h new file mode 100644 index 0000000000000..a7278d3136f9c --- /dev/null +++ b/src/cpp/ext/ext_output.h @@ -0,0 +1,113 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_OUTPUT_H__ +#define __EXT_OUTPUT_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +inline bool f_ob_start(CVarRef output_callback = null, int chunk_size = 0, + bool erase = true) { + // ignoring chunk_size and erase + g_context->obStart(output_callback); + return true; +} +inline void f_ob_clean() { + g_context->obClean(); +} +inline void f_ob_flush() { + g_context->obFlush(); +} +inline bool f_ob_end_clean() { + g_context->obClean(); + g_context->obEnd(); + return true; +} +inline bool f_ob_end_flush() { + bool ret = g_context->obFlush(); + g_context->obEnd(); + return ret; +} +inline void f_flush() { + g_context->flush(); +} +inline String f_ob_get_contents() { + return g_context->obGetContents(); +} +inline String f_ob_get_clean() { + String output = f_ob_get_contents(); + f_ob_end_clean(); + return output; +} +inline String f_ob_get_flush() { + String output = g_context->obGetContents(); + g_context->obFlush(); + return output; +} +inline int f_ob_get_length() { + return g_context->obGetContentLength(); +} +inline int f_ob_get_level() { + return g_context->obGetLevel(); +} +inline Array f_ob_get_status(bool full_status = false) { + throw NotSupportedException(__func__, "not useful"); +} +inline String f_ob_gzhandler(CStrRef buffer, int mode) { + throw NotSupportedException(__func__, "something that's in transport layer"); +} +inline void f_ob_implicit_flush(bool flag = true) { + g_context->obSetImplicitFlush(flag); +} +inline Array f_ob_list_handlers() { + return g_context->obGetHandlers(); +} +inline bool f_output_add_rewrite_var(CStrRef name, CStrRef value) { + throw NotSupportedException(__func__, "bad coding style"); +} +inline bool f_output_reset_rewrite_vars() { + throw NotSupportedException(__func__, "bad coding style"); +} + +bool f_hphp_log(CStrRef filename, CStrRef message); + +inline void f_hphp_stats(CStrRef name, int64 value) { + ServerStats::Log(name.data(), value); +} +inline int64 f_hphp_get_stats(CStrRef name) { + return ServerStats::Get(name.data()); +} +inline void f_hphp_output_global_state(CStrRef filename = null_string) { + FILE *fp = NULL; + if (!filename.isNull()) { + fp = fopen(filename.c_str(), "w"); + if (!fp) { + throw Exception("failed to open %s for writing", filename.c_str()); + } + } + output_global_state(fp); + if (fp) fclose(fp); +} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_OUTPUT_H__ diff --git a/src/cpp/ext/ext_posix.cpp b/src/cpp/ext/ext_posix.cpp new file mode 100644 index 0000000000000..c0770cd504e10 --- /dev/null +++ b/src/cpp/ext/ext_posix.cpp @@ -0,0 +1,234 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_posix_access(CStrRef file, int mode /* = 0 */) { + String path = File::TranslatePath(file); + if (path.empty()) { + return false; + } + return !access(path.data(), mode); +} + +static Variant php_posix_group_to_array(struct group *g) { + if (!g) { + return false; + } + + Array members; + for (int count=0; g->gr_mem[count] != NULL; count++) { + members.append(String(g->gr_mem[count], AttachLiteral)); + } + + Array ret; + ret.set("name", String(g->gr_name, AttachLiteral)); + ret.set("passwd", String(g->gr_passwd, AttachLiteral)); + ret.set("members", members); + ret.set("gid", (int)g->gr_gid); + return ret; +} + +Variant f_posix_getgrgid(int gid) { + return php_posix_group_to_array(getgrgid(gid)); +} + +Variant f_posix_getgrnam(CStrRef name) { + return php_posix_group_to_array(getgrnam(name.data())); +} + +Variant f_posix_getgroups() { + gid_t gidlist[NGROUPS_MAX]; + int result = getgroups(NGROUPS_MAX, gidlist); + if (result < 0) { + return false; + } + + Array ret; + for (int i = 0; i < result; i++) { + ret.append((int)gidlist[i]); + } + return ret; +} + +static Variant php_posix_passwd_to_array(struct passwd *pw) { + if (!pw) { + return false; + } + + Array ret; + ret.set("name", String(pw->pw_name, AttachLiteral)); + ret.set("passwd", String(pw->pw_passwd, AttachLiteral)); + ret.set("uid", (int)pw->pw_uid); + ret.set("gid", (int)pw->pw_gid); + ret.set("gecos", String(pw->pw_gecos, AttachLiteral)); + ret.set("dir", String(pw->pw_dir, AttachLiteral)); + ret.set("shell", String(pw->pw_shell, AttachLiteral)); + return ret; +} + +Variant f_posix_getpwnam(CStrRef username) { + return php_posix_passwd_to_array(getpwnam(username.data())); +} + +Variant f_posix_getpwuid(int uid) { + return php_posix_passwd_to_array(getpwuid(uid)); +} + +static bool posix_addlimit(int limit, const char *name, Array &ret) { + char hard[80]; snprintf(hard, 80, "hard %s", name); + char soft[80]; snprintf(soft, 80, "soft %s", name); + + struct rlimit rl; + int result = getrlimit(limit, &rl); + if (result < 0) { + return false; + } + + if (rl.rlim_cur == RLIM_INFINITY) { + ret.set(soft, "unlimited"); + } else { + ret.set(soft, (int)rl.rlim_cur); + } + + if (rl.rlim_max == RLIM_INFINITY) { + ret.set(hard, "unlimited"); + } else { + ret.set(hard, (int)rl.rlim_max); + } + + return true; +} + +static struct limitlist { + int limit; + const char *name; +} limits[] = { + { RLIMIT_CORE, "core" }, + { RLIMIT_DATA, "data" }, + { RLIMIT_STACK, "stack" }, + //{ RLIMIT_VMEM, "virtualmem" }, + { RLIMIT_AS, "totalmem" }, + { RLIMIT_RSS, "rss" }, + { RLIMIT_NPROC, "maxproc" }, + { RLIMIT_MEMLOCK, "memlock" }, + { RLIMIT_CPU, "cpu" }, + { RLIMIT_FSIZE, "filesize" }, + { RLIMIT_NOFILE, "openfiles" }, + { RLIMIT_OFILE, "openfiles" }, + { 0, NULL } +}; + +Variant f_posix_getrlimit() { + Array ret; + for (struct limitlist *l = limits; l->name; l++) { + if (!posix_addlimit(l->limit, l->name, ret)) { + return false; + } + } + return ret; +} + +static int php_posix_get_fd(CVarRef fd) { + int nfd; + if (fd.isResource()) { + File *f = fd.toObject().getTyped(); + if (!f) { + return false; + } + nfd = f->fd(); + } else { + nfd = fd.toInt32(); + } + return nfd; +} + +bool f_posix_isatty(CVarRef fd) { + return isatty(php_posix_get_fd(fd)); +} + +bool f_posix_mknod(CStrRef pathname, int mode, int major /* = 0 */, + int minor /* = 0 */) { + dev_t php_dev = 0; + if ((mode & S_IFCHR) || (mode & S_IFBLK)) { + if (major == 0 && minor == 0) { + Logger::Warning("For S_IFCHR and S_IFBLK you need to pass " + "a major device kernel identifier"); + return false; + } + if (major == 0) { + Logger::Warning("Expects argument 3 to be non-zero for " + "POSIX_S_IFCHR and POSIX_S_IFBLK"); + return false; + } + php_dev = makedev(major, minor); + } + + return mknod(pathname.data(), mode, php_dev) >= 0; +} + +Variant f_posix_times() { + struct tms t; + clock_t ticks = times(&t); + if (ticks < 0) { + return false; + } + + Array ret; + ret.set("ticks", (int)ticks); /* clock ticks */ + ret.set("utime", (int)t.tms_utime); /* user time */ + ret.set("stime", (int)t.tms_stime); /* system time */ + ret.set("cutime", (int)t.tms_cutime); /* user time of children */ + ret.set("cstime", (int)t.tms_cstime); /* system time of children */ + return ret; +} + +Variant f_posix_ttyname(CVarRef fd) { + char *p = ttyname(php_posix_get_fd(fd)); + if (!p) { + return false; + } + return String(p, CopyString); +} + +Variant f_posix_uname() { + struct utsname u; + if (uname(&u) < 0) { + return false; + } + + Array ret; + ret.set("sysname", String(u.sysname, CopyString)); + ret.set("nodename", String(u.nodename, CopyString)); + ret.set("release", String(u.release, CopyString)); + ret.set("version", String(u.version, CopyString)); + ret.set("machine", String(u.machine, CopyString)); + ret.set("domainname", String(u.domainname, CopyString)); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_posix.h b/src/cpp/ext/ext_posix.h new file mode 100644 index 0000000000000..d29c26415d2ab --- /dev/null +++ b/src/cpp/ext/ext_posix.h @@ -0,0 +1,158 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_POSIX_H__ +#define __EXT_POSIX_H__ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_posix_access(CStrRef file, int mode = 0); + +inline String f_posix_ctermid() { + char *buffer = (char *)malloc(L_ctermid); + ctermid(buffer); + return String(buffer, AttachString); +} + +inline int f_posix_get_last_error() { + return errno; +} + +inline String f_posix_getcwd() { + char *buffer = (char *)malloc(PATH_MAX); + getcwd(buffer, PATH_MAX); + return String(buffer, AttachString); +} + +inline int f_posix_getegid() { + return getegid(); +} + +inline int f_posix_geteuid() { + return geteuid(); +} + +inline int f_posix_getgid() { + return getgid(); +} + +Variant f_posix_getgrgid(int gid); + +Variant f_posix_getgrnam(CStrRef name); + +Variant f_posix_getgroups(); + +inline Variant f_posix_getlogin() { + char *p = getlogin(); + if (p == NULL) return false; + return String(p, CopyString); +} + +inline Variant f_posix_getpgid(int pid) { + int ret = getpgid(pid); + if (ret < 0) return false; + return ret; +} + +inline int f_posix_getpgrp() { + return getpgrp(); +} + +inline int f_posix_getpid() { + return getpid(); +} + +inline int f_posix_getppid() { + return getppid(); +} + +Variant f_posix_getpwnam(CStrRef username); + +Variant f_posix_getpwuid(int uid); + +Variant f_posix_getrlimit(); + +inline Variant f_posix_getsid(int pid) { + int ret = getsid(pid); + if (ret < 0) return false; + return ret; +} + +inline int f_posix_getuid() { + return getuid(); +} + +inline bool f_posix_initgroups(CStrRef name, int base_group_id) { + return !initgroups(name.data(), base_group_id); +} + +bool f_posix_isatty(CVarRef fd); + +inline bool f_posix_kill(int pid, int sig) { + return kill(pid, sig) >= 0; +} + +inline bool f_posix_mkfifo(CStrRef pathname, int mode) { + return mkfifo(pathname.data(), mode) >= 0; +} + +bool f_posix_mknod(CStrRef pathname, int mode, int major = 0, int minor = 0); + +inline bool f_posix_setegid(int gid) { + return setegid(gid); +} + +inline bool f_posix_seteuid(int uid) { + return seteuid(uid); +} + +inline bool f_posix_setgid(int gid) { + return setgid(gid); +} + +inline bool f_posix_setpgid(int pid, int pgid) { + return setpgid(pid, pgid) >= 0; +} + +inline int f_posix_setsid() { + return setsid(); +} + +inline bool f_posix_setuid(int uid) { + return setuid(uid); +} + +inline String f_posix_strerror(int errnum) { + return String(Util::safe_strerror(errnum)); +} + +Variant f_posix_times(); + +Variant f_posix_ttyname(CVarRef fd); + +Variant f_posix_uname(); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_POSIX_H__ diff --git a/src/cpp/ext/ext_preg.cpp b/src/cpp/ext/ext_preg.cpp new file mode 100644 index 0000000000000..0fb535e26045a --- /dev/null +++ b/src/cpp/ext/ext_preg.cpp @@ -0,0 +1,127 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_preg_grep(CStrRef pattern, CArrRef input, int flags /* = 0 */) { + return preg_grep(pattern, input, flags); +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_preg_match(CStrRef pattern, CStrRef subject, + Variant matches /* = null */, int flags /* = 0 */, + int offset /* = 0 */) { + return preg_match_impl(pattern, subject, matches, flags, offset, false); +} + +Variant f_preg_match_all(CStrRef pattern, CStrRef subject, Variant matches, + int flags /* = 0 */, int offset /* = 0 */) { + return preg_match_impl(pattern, subject, matches, flags, offset, true); +} + +/////////////////////////////////////////////////////////////////////////////// + + +Variant f_preg_replace(CVarRef pattern, CVarRef replacement, CVarRef subject, + int limit /* = -1 */, Variant count /* = null */) { + return preg_replace_impl(pattern, replacement, subject, limit, count, false); +} + +Variant f_preg_replace_callback(CVarRef pattern, CVarRef callback, + CVarRef subject, int limit /* = -1 */, + Variant count /* = null */) { + return preg_replace_impl(pattern, callback, subject, limit, count, true); +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_preg_split(CVarRef pattern, CVarRef subject, int limit /* = -1 */, + int flags /* = 0 */) { + return preg_split(pattern, subject, limit, flags); +} + +/////////////////////////////////////////////////////////////////////////////// + +String f_preg_quote(CStrRef str, CStrRef delimiter /* = null_string */) { + return preg_quote(str, delimiter); +} + +int f_preg_last_error() { + return preg_last_error(); +} + +/////////////////////////////////////////////////////////////////////////////// +// ereg + +String f_ereg_replace(CStrRef pattern, CStrRef replacement, CStrRef str) { + return f_mb_ereg_replace(pattern, replacement, str); +} + +String f_eregi_replace(CStrRef pattern, CStrRef replacement, CStrRef str) { + return f_mb_eregi_replace(pattern, replacement, str); +} + +Variant f_ereg(CStrRef pattern, CStrRef str, Variant regs /* = null */) { + return f_mb_ereg(pattern, str, ref(regs)); +} + +Variant f_eregi(CStrRef pattern, CStrRef str, Variant regs /* = null */) { + return f_mb_eregi(pattern, str, ref(regs)); +} + +/////////////////////////////////////////////////////////////////////////////// +// regexec + +Variant f_split(CStrRef pattern, CStrRef str, int limit /* = -1 */) { + return php_split(pattern, str, limit, true); +} + +Variant f_spliti(CStrRef pattern, CStrRef str, int limit /* = -1 */) { + return php_split(pattern, str, limit, false); +} + +String f_sql_regcase(CStrRef str) { + unsigned char c; + register int i, j; + + char *tmp = (char*)malloc(str.size() * 4 + 1); + for (i = j = 0; i < str.size(); i++) { + c = (unsigned char)str.charAt(i); + if (isalpha(c)) { + tmp[j++] = '['; + tmp[j++] = toupper(c); + tmp[j++] = tolower(c); + tmp[j++] = ']'; + } else { + tmp[j++] = c; + } + } + tmp[j] = 0; + + return String(tmp, j, AttachString); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_preg.h b/src/cpp/ext/ext_preg.h new file mode 100644 index 0000000000000..675ddd04a6875 --- /dev/null +++ b/src/cpp/ext/ext_preg.h @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_PREG_H__ +#define __EXT_PREG_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// pcre + +Variant f_preg_grep(CStrRef pattern, CArrRef input, int flags = 0); + +Variant f_preg_match(CStrRef pattern, CStrRef subject, Variant matches = null, + int flags = 0, int offset = 0); + +Variant f_preg_match_all(CStrRef pattern, CStrRef subject, Variant matches, + int flags = 0, int offset = 0); + +Variant f_preg_replace(CVarRef pattern, CVarRef replacement, CVarRef subject, + int limit = -1, Variant count = null); + +Variant f_preg_replace_callback(CVarRef pattern, CVarRef callback, + CVarRef subject, int limit = -1, + Variant count = null); + +Variant f_preg_split(CVarRef pattern, CVarRef subject, int limit = -1, + int flags = 0); + +String f_preg_quote(CStrRef str, CStrRef delimiter = null_string); + +int f_preg_last_error(); + +/////////////////////////////////////////////////////////////////////////////// +// deprecating these + +String f_ereg_replace(CStrRef pattern, CStrRef replacement, CStrRef str); +String f_eregi_replace(CStrRef pattern, CStrRef replacement, CStrRef str); +Variant f_ereg(CStrRef pattern, CStrRef str, Variant regs = null); +Variant f_eregi(CStrRef pattern, CStrRef str, Variant regs = null); +Variant f_split(CStrRef pattern, CStrRef str, int limit = -1); +Variant f_spliti(CStrRef pattern, CStrRef str, int limit = -1); +String f_sql_regcase(CStrRef str); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_PREG_H__ diff --git a/src/cpp/ext/ext_process.cpp b/src/cpp/ext/ext_process.cpp new file mode 100644 index 0000000000000..5941968184e4d --- /dev/null +++ b/src/cpp/ext/ext_process.cpp @@ -0,0 +1,739 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { + +/////////////////////////////////////////////////////////////////////////////// + +// build environment pair list +static char **build_envp(CArrRef envs, std::vector &senvs) { + char **envp = NULL; + int size = envs.size(); + if (size) { + envp = (char **)malloc((size + 1) * sizeof(char *)); + int i = 0; + for (ArrayIter iter(envs); iter; ++iter, ++i) { + StringBuffer nvpair; + nvpair += iter.first().toString(); + nvpair += '='; + nvpair += iter.second().toString(); + + String env = nvpair.detach(); + senvs.push_back(env); + *(envp + i) = (char *)env.data(); + } + *(envp + i) = NULL; + } + return envp; +} + +/////////////////////////////////////////////////////////////////////////////// +// pcntl + +void f_pcntl_exec(CStrRef path, CArrRef args /* = null_array */, + CArrRef envs /* = null_array */) { + // build argumnent list + std::vector sargs; // holding those char * + int size = args.size(); + char **argv = (char **)malloc((size + 2) * sizeof(char *)); + *argv = (char *)path.data(); + int i = 1; + if (size) { + sargs.reserve(size); + for (ArrayIter iter(args); iter; ++iter, ++i) { + String arg = iter.second().toString(); + sargs.push_back(arg); + *(argv + i) = (char *)arg.data(); + } + } + *(argv + i) = NULL; + + // build environment pair list + std::vector senvs; // holding those char * + char **envp = build_envp(envs, senvs); + if (execve(path, argv, envp) == -1) { + Logger::Warning("Error has occured: (errno %d) %s", + errno, Util::safe_strerror(errno).c_str()); + } + + free(envp); + free(argv); +} + +Variant f_pcntl_getpriority(int pid /* = 0 */, + int process_identifier /* = 0 */) { + if (pid == 0) { + pid = getpid(); + } + if (process_identifier == 0) { + process_identifier = PRIO_PROCESS; + } + + // this isn't thread-safe, but probably not a huge deal + errno = 0; + int pri = getpriority(process_identifier, pid); + if (errno) { + switch (errno) { + case ESRCH: + Logger::Warning("Error %d: No process was located using the given " + "parameters", errno); + break; + case EINVAL: + Logger::Warning("Error %d: Invalid identifier flag", errno); + break; + default: + Logger::Warning("Unknown error %d has occured", errno); + break; + } + return false; + } + return pri; +} + +bool f_pcntl_setpriority(int priority, int pid /* = 0 */, + int process_identifier /* = 0 */) { + if (pid == 0) { + pid = getpid(); + } + if (process_identifier == 0) { + process_identifier = PRIO_PROCESS; + } + + if (setpriority(process_identifier, pid, priority)) { + switch (errno) { + case ESRCH: + Logger::Warning("Error %d: No process was located using the given " + "parameters", errno); + break; + case EINVAL: + Logger::Warning("Error %d: Invalid identifier flag", errno); + break; + case EPERM: + Logger::Warning("Error %d: A process was located, but neither its " + "effective nor real user ID matched the effective " + "user ID of the caller", errno); + break; + case EACCES: + Logger::Warning("Error %d: Only a super user may attempt to increase " + "the process priority", errno); + break; + default: + Logger::Warning("Unknown error %d has occured", errno); + break; + } + return false; + } + return true; +} + +/* php_signal using sigaction is derrived from Advanced Programing + * in the Unix Environment by W. Richard Stevens p 298. */ +typedef void Sigfunc(int); +static Sigfunc *php_signal(int signo, Sigfunc *func, bool restart) { + struct sigaction act,oact; + act.sa_handler = func; + sigemptyset(&act.sa_mask); + act.sa_flags = 0; + if (signo == SIGALRM || (!restart)) { +#ifdef SA_INTERRUPT + act.sa_flags |= SA_INTERRUPT; /* SunOS */ +#endif + } else { +#ifdef SA_RESTART + act.sa_flags |= SA_RESTART; /* SVR4, 4.3+BSD */ +#endif + } + if (sigaction(signo, &act, &oact) < 0) + return SIG_ERR; + + return oact.sa_handler; +} + +/* Our custom signal handler that calls the appropriate php_function */ +class SignalHandlers : public RequestEventHandler { +public: + SignalHandlers() { + memset(signaled, 0, sizeof(signaled)); + } + virtual void requestInit() { + handlers.reset(); + } + virtual void requestShutdown() { + handlers.reset(); + } + + Array handlers; + int signaled[_NSIG]; +}; +static RequestLocal s_signal_handlers; + +static void pcntl_signal_handler(int signo) { + if (signo > 0 && signo < _NSIG) { + s_signal_handlers->signaled[signo] = 1; + RequestInjection::s_reqInjectionData->signaled = true; + } +} + +bool f_pcntl_signal_dispatch() { + RequestInjection::s_reqInjectionData->signaled = false; + int *signaled = s_signal_handlers->signaled; + bool error = false; + for (int i = 0; i < _NSIG; i++) { + if (signaled[i]) { + signaled[i] = 0; + if (s_signal_handlers->handlers.exists(i)) { + try { + f_call_user_func_array(s_signal_handlers->handlers[i], + CREATE_VECTOR1(i)); + } catch (...) { + error = true; + } + } + } + } + return !error; +} + +bool f_pcntl_signal(int signo, CVarRef handler, + bool restart_syscalls /* = true */) { + /* Special long value case for SIG_DFL and SIG_IGN */ + if (handler.isInteger()) { + int64 handle = handler.toInt64(); + if (handle != (long)SIG_DFL && handle != (long)SIG_IGN) { + Logger::Warning("Invalid value for handle argument specified"); + } + if (php_signal(signo, (Sigfunc *)handle, restart_syscalls) == SIG_ERR) { + Logger::Warning("Error assigning signal"); + return false; + } + return true; + } + + if (!f_is_callable(handler)) { + Logger::Warning("%s is not a callable function name error", + handler.toString().data()); + return false; + } + + s_signal_handlers->handlers.set(signo, handler); + + if (php_signal(signo, pcntl_signal_handler, restart_syscalls) == SIG_ERR) { + Logger::Warning("Error assigning signal"); + return false; + } + return true; +} + +int f_pcntl_wait(Variant status, int options /* = 0 */) { + int child_id; + int nstatus = 0; + child_id = LightProcess::pcntl_waitpid(-1, &nstatus, options); +/* if (options) { + child_id = wait3(&nstatus, options, NULL); + } else { + child_id = wait(&nstatus); + }*/ + status = nstatus; + return child_id; +} + +int f_pcntl_waitpid(int pid, Variant status, int options /* = 0 */) { + int nstatus = status.toInt64(); + pid_t child_id = LightProcess::pcntl_waitpid((pid_t)pid, &nstatus, options); + status = nstatus; + return child_id; +} + +/////////////////////////////////////////////////////////////////////////////// +// popen + +#define EXEC_INPUT_BUF 4096 + +class ShellExecContext { +public: + ShellExecContext() : m_proc(NULL) { + m_sig_handler = signal(SIGCHLD, SIG_DFL); + } + + ~ShellExecContext() { + if (m_proc) { + LightProcess::pclose(m_proc); + } + if (m_sig_handler) { + signal(SIGCHLD, m_sig_handler); + } + } + + FILE *exec(const char *cmd) { + ASSERT(m_proc == NULL); + m_proc = LightProcess::popen(cmd, "r"); + if (m_proc == NULL) { + Logger::Warning("Unable to execute '%s'", cmd); + } + return m_proc; + } + + int exit() { + int status = LightProcess::pclose(m_proc); + m_proc = NULL; + return status; + } + +private: + void (*m_sig_handler)(int); + FILE *m_proc; +}; + +String f_shell_exec(CStrRef cmd) { + ShellExecContext ctx; + FILE *fp = ctx.exec(cmd); + StringBuffer sbuf; + sbuf.read(fp); + return sbuf.detach(); +} + +String f_exec(CStrRef command, Variant output /* = null */, + Variant return_var /* = null */) { + ShellExecContext ctx; + FILE *fp = ctx.exec(command); + if (!fp) return ""; + StringBuffer sbuf; + sbuf.read(fp); + + Array lines = StringUtil::Explode(sbuf, "\n"); + return_var = ctx.exit(); + int count = lines.size(); + if (count > 0 && lines[count - 1].toString().empty()) { + count--; // remove explode()'s last empty line + } + for (int i = 0; i < count; i++) { + output.append(lines[i]); + } + + if (lines.empty()) { + return String(); + } + return StringUtil::Trim(lines[count - 1], StringUtil::TrimRight); +} + +void f_passthru(CStrRef command, Variant return_var /* = null */) { + ShellExecContext ctx; + FILE *fp = ctx.exec(command); + + char buffer[1024]; + while (true) { + int len = fread(buffer, 1, sizeof(buffer) - 1, fp); + if (len == 0) break; + buffer[len] = '\0'; + echo(String(buffer, len, AttachLiteral)); + } + return_var = ctx.exit(); +} + +String f_system(CStrRef command, Variant return_var /* = null */) { + ShellExecContext ctx; + FILE *fp = ctx.exec(command); + StringBuffer sbuf; + sbuf.read(fp); + + Array lines = StringUtil::Explode(sbuf, "\n"); + return_var = ctx.exit(); + int count = lines.size(); + if (count > 0 && lines[count - 1].toString().empty()) { + count--; // remove explode()'s last empty line + } + + for (int i = 0; i < count; i++) { + echo(lines[i]); + echo("\n"); + } + if (lines.empty()) { + return String(); + } + return StringUtil::Trim(lines[count - 1], StringUtil::TrimRight); +} + +/////////////////////////////////////////////////////////////////////////////// +// proc + +class ChildProcess : public SweepableResourceData { +public: + DECLARE_OBJECT_ALLOCATION(ChildProcess); + + pid_t child; + Array pipes; + String command; + Variant env; + + // overriding ResourceData + const char *o_getClassName() const { return "Process";} + + int close() { + pid_t wait_pid; + int wstatus; + do { + wait_pid = LightProcess::waitpid(child, &wstatus, 0); + } while (wait_pid == -1 && errno == EINTR); + + if (wait_pid == -1) { + return -1; + } + + if (WIFEXITED(wstatus)) { + wstatus = WEXITSTATUS(wstatus); + } + return wstatus; + } +}; +IMPLEMENT_OBJECT_ALLOCATION_NO_DEFAULT_SWEEP(ChildProcess); +void ChildProcess::sweep() { + // do nothing here, as everything will be collected by SmartAllocator +} + +#define DESC_PIPE 1 +#define DESC_FILE 2 +#define DESC_PARENT_MODE_WRITE 8 + +class DescriptorItem { +public: + DescriptorItem() : + index(-1), parentend(-1), childend(-1), mode(-1), mode_flags(-1) { + } + + ~DescriptorItem() { + } + + void cleanup() { + if (childend >= 0) close(childend); + if (parentend >= 0) close(parentend); + } + + int index; // desired fd number in child process + int parentend, childend; // fds for pipes in parent/child + int mode; // mode for proc_open code + int mode_flags; // mode flags for opening fds + + bool readFile(File *file) { + mode = DESC_FILE; + childend = dup(file->fd()); + if (childend < 0) { + Logger::Warning("unable to dup File-Handle for descriptor %ld - %s", + index, Util::safe_strerror(errno).c_str()); + return false; + } + return true; + } + + bool readPipe(CStrRef zmode) { + mode = DESC_PIPE; + int newpipe[2]; + if (0 != pipe(newpipe)) { + Logger::Warning("unable to create pipe %s", + Util::safe_strerror(errno).c_str()); + return false; + } + + if (zmode != "w") { + parentend = newpipe[1]; + childend = newpipe[0]; + mode |= DESC_PARENT_MODE_WRITE; + } else { + parentend = newpipe[0]; + childend = newpipe[1]; + } + mode_flags = mode & DESC_PARENT_MODE_WRITE ? O_WRONLY : O_RDONLY; + return true; + } + + bool openFile(CStrRef zfile, CStrRef zmode) { + mode = DESC_FILE; + /* try a wrapper */ + FILE *file = fopen(zfile, zmode); + if (!file) { + Logger::Warning("Unable to open specified file: %s (mode %s)", + zfile.data(), zmode.data()); + return false; + } + childend = fileno(file); + return true; + } + + void dupChild() { + if ((mode & ~DESC_PARENT_MODE_WRITE) == DESC_PIPE) { + close(parentend); parentend = -1; + } + if (dup2(childend, index) < 0) { + perror("dup2"); + } + if (childend != index) { + close(childend); childend = -1; + } + } + + /* clean up all the child ends and then open streams on the parent + * ends, where appropriate */ + Object dupParent() { + close(childend); childend = -1; + + if ((mode & ~DESC_PARENT_MODE_WRITE) == DESC_PIPE) { + const char *mode_string = NULL; + switch(mode_flags) { + case O_WRONLY: + mode_string = "w"; + break; + case O_RDONLY: + mode_string = "r"; + break; + case O_RDWR: + mode_string = "r+"; + break; + } + FILE *f = fdopen(parentend, mode_string); + /* mark the descriptor close-on-exec, so that it won't be inherited + by potential other children */ + fcntl(parentend, F_SETFD, FD_CLOEXEC); + return Object(NEW(PlainFile)(f, true)); + } + + return Object(); + } +}; + +Variant f_proc_open(CStrRef cmd, CArrRef descriptorspec, Variant pipes, + CStrRef cwd /* = null_string */, CVarRef env /* = null_variant */, + CVarRef other_options /* = null_variant */) { + /* walk the descriptor spec and set up files/pipes */ + std::vector items; + items.resize(descriptorspec.size()); + int i = 0; + for (ArrayIter iter(descriptorspec); iter; ++iter, ++i) { + DescriptorItem &item = items[i]; + + String index = iter.first(); + if (!index.isNumeric()) { + Logger::Warning("descriptor spec must be an integer indexed array"); + return false; + } + item.index = index.toInt32(); + + Variant descitem = iter.second(); + if (descitem.isResource()) { + File *file = descitem.toObject().getTyped(); + if (!item.readFile(file)) { + return false; + } + } else if (!descitem.is(KindOfArray)) { + Logger::Warning("Descriptor must be either an array or a File-Handle"); + return false; + } else { + Array descarr = descitem.toArray(); + if (!descarr.exists(0LL)) { + Logger::Warning("Missing handle qualifier in array"); + return false; + } + String ztype = descarr[0LL].toString(); + if (ztype == "pipe") { + if (!descarr.exists(1LL)) { + Logger::Warning("Missing mode parameter for 'pipe'"); + return false; + } + if (!item.readPipe(descarr[1LL].toString())) { + return false; + } + } else if (ztype == "file") { + if (!descarr.exists(1LL)) { + Logger::Warning("Missing file name parameter for 'file'"); + return false; + } + if (!descarr.exists(2LL)) { + Logger::Warning("Missing mode parameter for 'file'"); + return false; + } + if (!item.openFile(descarr[1LL].toString(), descarr[2LL].toString())) { + return false; + } + } else { + Logger::Warning("%s is not a valid descriptor spec", ztype.data()); + return false; + } + } + } + + pid_t child; + + if (LightProcess::available()) { + // light-weight process available + std::vector created; + std::vector intended; + for (i = 0; i < (int)items.size(); i++) { + created.push_back(items[i].childend); + intended.push_back(items[i].index); + } + + std::vector envs; + for (ArrayIter iter(env.toArray()); iter; ++iter) { + StringBuffer nvpair; + nvpair += iter.first().toString(); + nvpair += '='; + nvpair += iter.second().toString(); + envs.push_back(nvpair.detach().c_str()); + } + + child = LightProcess::proc_open(cmd.c_str(), created, intended, + cwd.c_str(), envs); + } else { + /* the unix way */ + child = fork(); + if (child == 0) { + /* this is the child process */ + + /* close those descriptors that we just opened for the parent stuff, + * dup new descriptors into required descriptors and close the original + * cruft */ + for (i = 0; i < (int)items.size(); i++) { + items[i].dupChild(); + } + if (!cwd.empty()) { + chdir(cwd); + } + if (!env.isNull()) { + std::vector senvs; // holding those char * + char **envp = build_envp(env.toArray(), senvs); + execle("/bin/sh", "sh", "-c", cmd.data(), NULL, envp); + free(envp); + } else { + execl("/bin/sh", "sh", "-c", cmd.data(), NULL); + } + _exit(127); + + } + } + if (child < 0) { + /* failed to fork() */ + for (i = 0; i < (int)items.size(); i++) { + items[i].cleanup(); + } + Logger::Warning("fork failed - %s", Util::safe_strerror(errno).c_str()); + return false; + } + + /* we forked/spawned and this is the parent */ + ChildProcess *proc = NEW(ChildProcess)(); + proc->command = cmd; + proc->child = child; + proc->env = env; + for (i = 0; i < (int)items.size(); i++) { + Object f = items[i].dupParent(); + proc->pipes.append(f); + pipes.set(items[i].index, f); + } + return Object(proc); +} + +bool f_proc_terminate(CObjRef process, int signal /* = 0 */) { + ChildProcess *proc = process.getTyped(); + return kill(proc->child, signal <= 0 ? SIGTERM : signal) == 0; +} + +int f_proc_close(CObjRef process) { + return process.getTyped()->close(); +} + +Array f_proc_get_status(CObjRef process) { + ChildProcess *proc = process.getTyped(); + + errno = 0; + int wstatus; + pid_t wait_pid = + LightProcess::waitpid(proc->child, &wstatus, WNOHANG|WUNTRACED); + + bool running = true, signaled = false, stopped = false; + int exitcode = -1, termsig = 0, stopsig = 0; + if (wait_pid == proc->child) { + if (WIFEXITED(wstatus)) { + running = false; + exitcode = WEXITSTATUS(wstatus); + } + if (WIFSIGNALED(wstatus)) { + running = false; + signaled = true; + termsig = WTERMSIG(wstatus); + } + if (WIFSTOPPED(wstatus)) { + stopped = true; + stopsig = WSTOPSIG(wstatus); + } + } else if (wait_pid == -1) { + running = false; + } + + Array ret; + ret.set("command", proc->command); + ret.set("pid", proc->child); + ret.set("running", running); + ret.set("signaled", signaled); + ret.set("stopped", stopped); + ret.set("exitcode", exitcode); + ret.set("termsig", termsig); + ret.set("stopsig", stopsig); + return ret; +} + +bool f_proc_nice(int increment) { + errno = 0; + nice(increment); + if (errno) { + Logger::Warning("Only a super user may attempt to increase the " + "priority of a process"); + return false; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// string functions + +String f_escapeshellarg(CStrRef arg) { + if (!arg.empty()) { + char *ret = string_escape_shell_arg(arg); + return String(ret, AttachString); + } + return arg; +} + +String f_escapeshellcmd(CStrRef command) { + if (!command.empty()) { + char *ret = string_escape_shell_cmd(command); + return String(ret, AttachString); + } + return command; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_process.h b/src/cpp/ext/ext_process.h new file mode 100644 index 0000000000000..a3d2b00e14dcb --- /dev/null +++ b/src/cpp/ext/ext_process.h @@ -0,0 +1,87 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_PROCESS_H__ +#define __EXT_PROCESS_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +inline int f_pcntl_alarm(int seconds) { + return alarm(seconds); +} +void f_pcntl_exec(CStrRef path, CArrRef args = null_array, CArrRef envs = null_array); + +inline int f_pcntl_fork() { + return fork(); +} +Variant f_pcntl_getpriority(int pid = 0, int process_identifier = 0); +bool f_pcntl_setpriority(int priority, int pid = 0, + int process_identifier = 0); + +bool f_pcntl_signal(int signo, CVarRef handler, bool restart_syscalls = true); +int f_pcntl_wait(Variant status, int options = 0); +int f_pcntl_waitpid(int pid, Variant status, int options = 0); + +inline int f_pcntl_wexitstatus(int status) { + /* WEXITSTATUS only returns 8 bits so we *MUST* cast this to signed char + if you want to have valid negative exit codes */ + return (signed char)(WEXITSTATUS(status)); +} + +/** + * Process pending signals flagged earlier. + */ +bool f_pcntl_signal_dispatch(); + +// status querying +inline bool f_pcntl_wifexited(int status) { return WIFEXITED(status);} +inline bool f_pcntl_wifsignaled(int status) { return WIFSIGNALED(status);} +inline bool f_pcntl_wifstopped(int status) { return WIFSTOPPED(status);} +inline int f_pcntl_wstopsig(int status) { return WSTOPSIG(status);} +inline int f_pcntl_wtermsig(int status) { return WTERMSIG(status);} + +/////////////////////////////////////////////////////////////////////////////// + +String f_shell_exec(CStrRef cmd); +String f_exec(CStrRef command, Variant output = null, + Variant return_var = null); +void f_passthru(CStrRef command, Variant return_var = null); +String f_system(CStrRef command, Variant return_var = null); + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_proc_open(CStrRef cmd, CArrRef descriptorspec, Variant pipes, + CStrRef cwd = null_string, CVarRef env = null_variant, + CVarRef other_options = null_variant); +bool f_proc_terminate(CObjRef process, int signal = 0); +int f_proc_close(CObjRef process); +Array f_proc_get_status(CObjRef process); +bool f_proc_nice(int increment); + +/////////////////////////////////////////////////////////////////////////////// + +String f_escapeshellarg(CStrRef arg); +String f_escapeshellcmd(CStrRef command); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_PROCESS_H__ diff --git a/src/cpp/ext/ext_reflection.cpp b/src/cpp/ext/ext_reflection.cpp new file mode 100644 index 0000000000000..b40cd26f8f676 --- /dev/null +++ b/src/cpp/ext/ext_reflection.cpp @@ -0,0 +1,321 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Array f_hphp_get_extension_info(CStrRef name) { + Array ret; + + ret.set("name", name); + ret.set("version", ""); + ret.set("info", ""); + ret.set("ini", Array::Create()); + ret.set("constants", Array::Create()); + ret.set("functions", Array::Create()); + ret.set("classes", Array::Create()); + + return ret; +} + +static void set_access(Array &ret, int attribute) { + if (attribute & ClassInfo::IsPublic) { + ret.set("access", "public"); + } else if (attribute & ClassInfo::IsProtected) { + ret.set("access", "protected"); + } else if (attribute & ClassInfo::IsPrivate) { + ret.set("access", "private"); + } else { + ASSERT(false); + } +} + +int get_modifiers(int attribute, bool cls) { + int php_modifier = 0; + if (attribute & ClassInfo::IsAbstract) php_modifier |= cls ? 0x20 : 0x02; + if (attribute & ClassInfo::IsFinal) php_modifier |= cls ? 0x40 : 0x04; + if (attribute & ClassInfo::IsStatic) php_modifier |= 0x01; + if (attribute & ClassInfo::IsPublic) php_modifier |= 0x100; + if (attribute & ClassInfo::IsProtected) php_modifier |= 0x200; + if (attribute & ClassInfo::IsPrivate) php_modifier |= 0x400; + return php_modifier; +} + +static void set_property_info(Array &ret, ClassInfo::PropertyInfo *info, + const ClassInfo *cls) { + ret.set("name", info->name); + set_access(ret, info->attribute); + ret.set("modifiers", get_modifiers(info->attribute, false)); + ret.set("static", (bool)(info->attribute & ClassInfo::IsStatic)); + ret.set("class", cls->getName()); + const char *dc = info->docComment; + if (dc) { + ret.set("doc", dc); + } else { + ret.set("doc", false); + } +} + +static void set_function_info(Array &ret, const ClassInfo::MethodInfo *info, + const char *classname) { + // return type + ret.set("ref", (bool)(info->attribute & ClassInfo::IsReference)); + + const char *dc = info->docComment; + if (dc) { + ret.set("doc", dc); + } else { + ret.set("doc", false); + } + + // parameters + { + Array arr = Array::Create(); + for (unsigned int i = 0; i < info->parameters.size(); i++) { + Array param = Array::Create(); + const ClassInfo::ParameterInfo *p = info->parameters[i]; + param.set("index", (int)i); + param.set("name", p->name); + param.set("type", p->type); + if (classname) { + param.set("class", classname); + } + if (p->type && *p->type) { + param.set("nullable", false); + } else { + param.set("nullable", true); + } + if (p->value && *p->value) { + ASSERT(p->attribute & ClassInfo::IsOptional); + param.set("default", p->value); + } else { + ASSERT((p->attribute & ClassInfo::IsOptional) == 0); + } + param.set("ref", (bool)(p->attribute & ClassInfo::IsReference)); + arr.append(param); + } + ret.set("params", arr); + } + + // static variables + { + Array arr = Array::Create(); + for (unsigned int i = 0; i < info->staticVariables.size(); i++) { + const ClassInfo::ConstantInfo *p = info->staticVariables[i]; + ASSERT(p->valueText && *p->valueText); + arr.set(p->name, p->valueText); + } + ret.set("static_variables", arr); + } +} + +static void set_method_info(Array &ret, ClassInfo::MethodInfo *info, + const ClassInfo *cls) { + ret.set("name", info->name); + set_access(ret, info->attribute); + ret.set("modifiers", get_modifiers(info->attribute, false)); + ret.set("static", (bool)(info->attribute & ClassInfo::IsStatic)); + ret.set("final", (bool)(info->attribute & ClassInfo::IsFinal)); + ret.set("abstract", (bool)(info->attribute & ClassInfo::IsAbstract)); + ret.set("internal", (bool)(cls->getAttribute() & ClassInfo::IsSystem)); + ret.set("class", cls->getName()); + set_function_info(ret, info, cls->getName()); +} + +Array f_hphp_get_class_info(CVarRef name) { + String className; + if (name.isObject()) { + className = name.toObject()->o_getClassName(); + } else { + className = name.toString(); + } + + const ClassInfo *cls = ClassInfo::FindClass(className.data()); + if (cls == NULL) { + cls = ClassInfo::FindInterface(className.data()); + } + + Array ret; + if (cls == NULL) { + return ret; + } + + ret.set("name", cls->getName()); + ret.set("extension", ""); + ret.set("parent", cls->getParentClass()); + + // interfaces + { + Array arr = Array::Create(); + const ClassInfo::InterfaceMap &interfaces = cls->getInterfaces(); + for (ClassInfo::InterfaceMap::const_iterator iter = interfaces.begin(); + iter != interfaces.end(); ++iter) { + arr.set(*iter, 1); + } + ret.set("interfaces", arr); + } + + // attributes + { + int attribute = cls->getAttribute(); + ret.set("internal", (bool)(attribute & ClassInfo::IsSystem)); + ret.set("abstract", (bool)(attribute & ClassInfo::IsAbstract)); + ret.set("interface", (bool)(attribute & ClassInfo::IsInterface)); + ret.set("final", (bool)(attribute & ClassInfo::IsFinal)); + ret.set("modifiers", get_modifiers(attribute, true)); + } + + // methods + { + Array arr = Array::Create(); + const ClassInfo::MethodVec &methods = cls->getMethodsVec(); + for (ClassInfo::MethodVec::const_iterator iter = methods.begin(); + iter != methods.end(); ++iter) { + ClassInfo::MethodInfo *m = *iter; + if ((m->attribute & ClassInfo::IsInherited) == 0) { + Array info = Array::Create(); + set_method_info(info, m, cls); + arr.set(StringUtil::ToLower(m->name), info); + } + } + ret.set("methods", arr); + } + + // properties + { + Array arr = Array::Create(); + const ClassInfo::PropertyMap &properties = cls->getProperties(); + for (ClassInfo::PropertyMap::const_iterator iter = properties.begin(); + iter != properties.end(); ++iter) { + Array info = Array::Create(); + set_property_info(info, iter->second, cls); + arr.set(iter->first, info); + } + ret.set("properties", arr); + } + + // constants + { + Array arr = Array::Create(); + const ClassInfo::ConstantMap &constants = cls->getConstants(); + for (ClassInfo::ConstantMap::const_iterator iter = constants.begin(); + iter != constants.end(); ++iter) { + if (iter->second->valueText && *iter->second->valueText) { + arr.set(iter->second->name, iter->second->value); + } else { + arr.set(iter->second->name, + get_class_constant(className.data(), iter->second->name)); + } + } + ret.set("constants", arr); + } + + { // source info + const char *file = + SourceInfo::TheSourceInfo.getClassDeclaringFile(className.data()); + if (!file) file = ""; + ret.set("file", file); + ret.set("line1", 0); + ret.set("line2", 0); + const char *dc = cls->getDocComment(); + if (dc) { + ret.set("doc", dc); + } else { + ret.set("doc", false); + } + } + + return ret; +} + +Array f_hphp_get_function_info(CStrRef name) { + Array ret; + + const ClassInfo::MethodInfo *info = ClassInfo::FindFunction(name.data()); + if (info == NULL) { + return ret; + } + + ret.set("name", name); + ret.set("internal", (bool)(info->attribute & ClassInfo::IsSystem)); + ret.set("closure", ""); + + // setting parameters and static variables + set_function_info(ret, info, NULL); + + const char *file = + SourceInfo::TheSourceInfo.getFunctionDeclaringFile(name.data()); + if (!file) file = ""; + ret.set("file", file); + ret.set("line1", 0); + ret.set("line2", 0); + const char *dc = info->docComment; + if (dc) { + ret.set("doc", dc); + } else { + ret.set("doc", false); + } + + return ret; +} + +Variant f_hphp_invoke(CStrRef name, CArrRef params) { + return invoke(name.data(), params); +} + +Variant f_hphp_invoke_method(CVarRef obj, CStrRef cls, CStrRef name, + CArrRef params) { + if (!obj.isObject()) { + return invoke_static_method(cls.data(), name.data(), params); + } + return obj.toObject()->o_invoke(name.data(), params, -1); +} + +bool f_hphp_instanceof(CObjRef obj, CStrRef name) { + return obj.instanceof(name.data()); +} + +Object f_hphp_create_object(CStrRef name, CArrRef params) { + return create_object(name.data(), params); +} + +Variant f_hphp_get_property(CObjRef obj, CStrRef cls, CStrRef prop) { + return obj->o_get(prop.data(), -1); +} + +void f_hphp_set_property(CObjRef obj, CStrRef cls, CStrRef prop, + CVarRef value) { + obj->o_set(prop.data(), -1, value); +} + +Variant f_hphp_get_static_property(CStrRef cls, CStrRef prop) { + return get_static_property(cls.data(), prop.data()); +} + +void f_hphp_set_static_property(CStrRef cls, CStrRef prop, CVarRef value) { + throw NotImplementedException(__func__); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_reflection.h b/src/cpp/ext/ext_reflection.h new file mode 100644 index 0000000000000..3679302958cbc --- /dev/null +++ b/src/cpp/ext/ext_reflection.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_REFLECTION_H__ +#define __EXT_REFLECTION_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Array f_hphp_get_extension_info(CStrRef name); +Array f_hphp_get_class_info(CVarRef name); +Array f_hphp_get_function_info(CStrRef name); +Variant f_hphp_invoke(CStrRef name, CArrRef params); +Variant f_hphp_invoke_method(CVarRef obj, CStrRef cls, CStrRef name, CArrRef params); +bool f_hphp_instanceof(CObjRef obj, CStrRef name); +Object f_hphp_create_object(CStrRef name, CArrRef params); +Variant f_hphp_get_property(CObjRef obj, CStrRef cls, CStrRef prop); +void f_hphp_set_property(CObjRef obj, CStrRef cls, CStrRef prop, CVarRef value); +Variant f_hphp_get_static_property(CStrRef cls, CStrRef prop); +void f_hphp_set_static_property(CStrRef cls, CStrRef prop, CVarRef value); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_REFLECTION_H__ diff --git a/src/cpp/ext/ext_server.cpp b/src/cpp/ext/ext_server.cpp new file mode 100644 index 0000000000000..7fa90b9474819 --- /dev/null +++ b/src/cpp/ext/ext_server.cpp @@ -0,0 +1,152 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace boost; + +#define DANGLING_HEADER "HPHP_DANGLING" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// dangling server + +bool f_dangling_server_proxy_old_request() { + static bool s_detected_dangling_server = true; + + if (!s_detected_dangling_server || + SatelliteServerInfo::DanglingServerPort == 0) { + return false; + } + + Transport *transport = g_context->getTransport(); + if (transport == NULL) { + return false; + } + if (!transport->getHeader(DANGLING_HEADER).empty()) { + // if we are processing a dangling server request, do not do it again + return false; + } + + string url = "http://localhost:" + + lexical_cast(SatelliteServerInfo::DanglingServerPort) + + transport->getServerObject(); + + int code = 0; + std::string error; + StringBuffer response; + HeaderMap headers; + headers[DANGLING_HEADER].push_back("1"); + if (!HttpProtocol::ProxyRequest(transport, false, url, code, error, + response, &headers)) { + s_detected_dangling_server = false; + return false; + } + transport->setResponse(code); + echo(response.detach()); + return true; +} + +bool f_dangling_server_proxy_new_request(CStrRef host) { + Transport *transport = g_context->getTransport(); + if (transport == NULL) { + return false; + } + if (!transport->getHeader(DANGLING_HEADER).empty()) { + // if we are processing a dangling server request, do not do it again + return false; + } + + string url = string("http://") + host.data() + ":" + + lexical_cast(RuntimeOption::ServerPort) + + transport->getServerObject(); + + int code = 0; + std::string error; + StringBuffer response; + HeaderMap headers; + headers[DANGLING_HEADER].push_back("1"); + if (!HttpProtocol::ProxyRequest(transport, false, url, code, error, + response, &headers)) { + return false; + } + transport->setResponse(code); + echo(response.detach()); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// Pagelet Server + +Object f_pagelet_server_task_start(CStrRef url, + CArrRef headers /* = null_array */, + CStrRef post_data /* = null_string */) { + String remote_host; + Transport *transport = g_context->getTransport(); + if (transport) { + remote_host = transport->getRemoteHost(); + } + return PageletServer::TaskStart(url, headers, remote_host, post_data); +} + +bool f_pagelet_server_task_status(CObjRef task) { + return PageletServer::TaskStatus(task); +} + +String f_pagelet_server_task_result(CObjRef task, Variant headers, + Variant code) { + Array rheaders; + int rcode; + String response = PageletServer::TaskResult(task, rheaders, rcode); + headers = rheaders; + code = rcode; + return response; +} + +/////////////////////////////////////////////////////////////////////////////// +// xbox + +bool f_xbox_send_message(CStrRef msg, Variant ret, int64 timeout_ms, + CStrRef host /* = "localhost" */) { + return XboxServer::SendMessage(msg, ret, timeout_ms, host); +} + +bool f_xbox_post_message(CStrRef msg, CStrRef host /* = "localhost" */) { + return XboxServer::PostMessage(msg, host); +} + +Object f_xbox_task_start(CStrRef message) { + return XboxServer::TaskStart(message); +} + +bool f_xbox_task_status(CObjRef task) { + return XboxServer::TaskStatus(task); +} + +int64 f_xbox_task_result(CObjRef task, int64 timeout_ms, Variant ret) { + return XboxServer::TaskResult(task, timeout_ms, ret); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_server.h b/src/cpp/ext/ext_server.h new file mode 100644 index 0000000000000..631c4b0e7297c --- /dev/null +++ b/src/cpp/ext/ext_server.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_SERVER_H__ +#define __EXT_SERVER_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_dangling_server_proxy_old_request(); +bool f_dangling_server_proxy_new_request(CStrRef host); +Object f_pagelet_server_task_start(CStrRef url, CArrRef headers = null_array, CStrRef post_data = null_string); +bool f_pagelet_server_task_status(CObjRef task); +String f_pagelet_server_task_result(CObjRef task, Variant headers, Variant code); +bool f_xbox_send_message(CStrRef msg, Variant ret, int64 timeout_ms, CStrRef host = "localhost"); +bool f_xbox_post_message(CStrRef msg, CStrRef host = "localhost"); +Object f_xbox_task_start(CStrRef message); +bool f_xbox_task_status(CObjRef task); +int64 f_xbox_task_result(CObjRef task, int64 timeout_ms, Variant ret); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_SERVER_H__ diff --git a/src/cpp/ext/ext_simplexml.cpp b/src/cpp/ext/ext_simplexml.cpp new file mode 100644 index 0000000000000..ca38970dec95a --- /dev/null +++ b/src/cpp/ext/ext_simplexml.cpp @@ -0,0 +1,773 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// This is to make sure each node holds one reference of m_doc, so not to let +// it go out of scope. +class XmlDocWrapper : public SweepableResourceData { +public: + DECLARE_OBJECT_ALLOCATION(XmlDocWrapper); + + // overriding ResourceData + const char *o_getClassName() const { return "xmlDoc";} + + XmlDocWrapper(xmlDocPtr doc) : m_doc(doc) { + } + + ~XmlDocWrapper() { + if (m_doc) { + xmlFreeDoc(m_doc); + } + } + +private: + xmlDocPtr m_doc; +}; +IMPLEMENT_OBJECT_ALLOCATION(XmlDocWrapper); + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +static inline bool match_ns(xmlNodePtr node, CStrRef ns, bool is_prefix) { + if (ns.empty()) { + return true; + } + if (node->ns == NULL || node->ns->prefix == NULL) { + return false; + } + if (node->ns && !xmlStrcmp(is_prefix ? node->ns->prefix : node->ns->href, + (const xmlChar *)ns.data())) { + return true; + } + return false; +} + +static String node_list_to_string(xmlDocPtr doc, xmlNodePtr list) { + xmlChar *tmp = xmlNodeListGetString(doc, list, 1); + char *res = strdup((char*)tmp); + xmlFree(tmp); + return String((const char *)res, AttachString); +} + +static Array collect_attributes(xmlNodePtr node, CStrRef ns, bool is_prefix) { + ASSERT(node); + Array attributes = Array::Create(); + for (xmlAttrPtr attr = node->properties; attr; attr = attr->next) { + if (match_ns((xmlNodePtr)attr, ns, is_prefix)) { + String n = String((char*)attr->name, xmlStrlen(attr->name), CopyString); + attributes.set(n, node_list_to_string(node->doc, attr->children)); + } + } + return attributes; +} + +static void add_property(Array &properties, xmlNodePtr node, Object value) { + const char *name = (char *)node->name; + if (name) { + int namelen = xmlStrlen(node->name); + String sname(name, namelen, CopyString); + + if (properties.exists(sname)) { + Variant &existing = properties.lval(sname); + if (existing.is(KindOfArray)) { + existing.append(value); + } else { + Array newdata; + newdata.append(existing); + newdata.append(value); + properties.set(sname, newdata); + } + } else { + properties.set(sname, value); + } + } +} + +static c_simplexmlelement *create_text(CObjRef doc, xmlNodePtr node, + CStrRef value, CStrRef ns, + bool is_prefix) { + c_simplexmlelement *elem = NEW(c_simplexmlelement)(); + elem->m_doc = doc; + elem->m_node = node->parent; // assign to parent, not node + elem->ObjectData::o_set(0, -1, value); + elem->m_attributes = collect_attributes(node->parent, ns, is_prefix); + return elem; +} + +static Array create_children(CObjRef doc, xmlNodePtr root, + CStrRef ns, bool is_prefix); + +static c_simplexmlelement *create_element(CObjRef doc, xmlNodePtr node, + CStrRef ns, bool is_prefix) { + c_simplexmlelement *elem = NEW(c_simplexmlelement)(); + elem->m_doc = doc; + elem->m_node = node; + if (node) { + elem->ObjectData::o_set(create_children(doc, node, ns, is_prefix)); + elem->m_attributes = collect_attributes(node, ns, is_prefix); + } + return elem; +} + +static Array create_children(CObjRef doc, xmlNodePtr root, + CStrRef ns, bool is_prefix) { + Array properties = Array::Create(); + for (xmlNodePtr node = root->children; node; node = node->next) { + if (node->children || node->prev || node->next) { + if (node->type == XML_TEXT_NODE) { + // bad node from parser, ignoring it... + continue; + } + } else { + if (node->type == XML_TEXT_NODE) { + if (node->content && *node->content) { + add_property + (properties, root, + create_text(doc, node, node_list_to_string(root->doc, node), + ns, is_prefix)); + } + continue; + } + } + + if (node->type != XML_ELEMENT_NODE || match_ns(node, ns, is_prefix)) { + xmlNodePtr child = node->children; + Object sub; + if (child && child->type == XML_TEXT_NODE && !xmlIsBlankNode(child)) { + sub = create_text(doc, child, node_list_to_string(root->doc, child), + ns, is_prefix); + } else { + sub = create_element(doc, node, ns, is_prefix); + } + add_property(properties, node, sub); + } + } + return properties; +} + +static inline void add_namespace_name(Array &out, xmlNsPtr ns) { + const char *prefix = ns->prefix ? (const char *)ns->prefix : ""; + if (!out.exists(prefix)) { + out.set(String(prefix, CopyString), String((char*)ns->href, CopyString)); + } +} + +static void add_namespaces(Array &out, xmlNodePtr node, bool recursive) { + if (node->ns) { + add_namespace_name(out, node->ns); + } + + for (xmlAttrPtr attr = node->properties; attr; attr = attr->next) { + if (attr->ns) { + add_namespace_name(out, attr->ns); + } + } + + if (recursive) { + for (node = node->children; node; node = node->next) { + if (node->type == XML_ELEMENT_NODE) { + add_namespaces(out, node, true); + } + } + } +} + +static void add_registered_namespaces(Array &out, xmlNodePtr node, + bool recursive) { + if (node->type == XML_ELEMENT_NODE) { + for (xmlNsPtr ns = node->nsDef; ns; ns = ns->next) { + add_namespace_name(out, ns); + } + if (recursive) { + for (node = node->children; node; node = node->next) { + add_registered_namespaces(out, node, true); + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// simplexml + +Variant f_simplexml_load_string(CStrRef data, + CStrRef class_name /* = "SimpleXMLElement" */, + int64 options /* = 0 */, + CStrRef ns /* = "" */, + bool is_prefix /* = false */) { + if (strcasecmp(class_name.data(), "SimpleXMLElement")) { + if (class_name.empty()) { + throw ArgumentMissingException("class_name"); + } + const ClassInfo *cls = ClassInfo::FindClass(class_name); + if (cls == NULL) { + throw InvalidArgumentException("(class not found)", class_name.data()); + } + if (!cls->derivesFrom("simplexmlelement", false)) { + throw InvalidArgumentException("(not subclass of SimpleXMLElement)", + class_name.data()); + } + } + + xmlDocPtr doc = xmlReadMemory(data.data(), data.size(), NULL, NULL, options); + if (!doc) { + return false; + } + return Object(create_element(Object(NEW(XmlDocWrapper)(doc)), + doc->children, ns, is_prefix)); +} + +Variant f_simplexml_load_file(CStrRef filename, + CStrRef class_name /* = "SimpleXMLElement" */, + int64 options /* = 0 */, CStrRef ns /* = "" */, + bool is_prefix /* = false */) { + String str = f_file_get_contents(filename); + return f_simplexml_load_string(str, class_name, options, ns, is_prefix); +} + +/////////////////////////////////////////////////////////////////////////////// +// SimpleXMLElement + +c_simplexmlelement::c_simplexmlelement() + : m_node(NULL), m_is_attribute(false), m_is_children(false), m_xpath(NULL) { +} + +c_simplexmlelement::~c_simplexmlelement() { + if (m_xpath) { + xmlXPathFreeContext(m_xpath); + } +} + +void c_simplexmlelement::t___construct(CStrRef data, int64 options /* = 0 */, + bool data_is_url /* = false */, + CStrRef ns /* = "" */, + bool is_prefix /* = false */) { + String xml = data; + if (data_is_url) { + Variant ret = f_file_get_contents(data); + if (same(ret, false)) { + Logger::Error("Unable to retrieve XML content from %s", data.data()); + return; + } + xml = ret.toString(); + } + + xmlDocPtr doc = xmlReadMemory(xml.data(), xml.size(), NULL, NULL, options); + if (doc) { + m_doc = Object(NEW(XmlDocWrapper)(doc)); + m_node = doc->children; + if (m_node) { + ObjectData::o_set(create_children(m_doc, m_node, ns, is_prefix)); + m_attributes = collect_attributes(m_node, ns, is_prefix); + } + } +} + +Variant c_simplexmlelement::t_xpath(CStrRef path) { + if (m_is_attribute || !m_node) { + return null; + } + + xmlDocPtr doc = m_node->doc; + + int nsnbr = 0; + xmlNsPtr *ns = xmlGetNsList(doc, m_node); + if (ns != NULL) { + while (ns[nsnbr] != NULL) { + nsnbr++; + } + } + + if (m_xpath == NULL) { + m_xpath = xmlXPathNewContext(doc); + } + m_xpath->node = m_node; + m_xpath->namespaces = ns; + m_xpath->nsNr = nsnbr; + + xmlXPathObjectPtr retval = xmlXPathEval((xmlChar *)path.data(), m_xpath); + if (ns != NULL) { + xmlFree(ns); + m_xpath->namespaces = NULL; + m_xpath->nsNr = 0; + } + + if (!retval) { + return false; + } + + xmlNodeSetPtr result = retval->nodesetval; + if (!result) { + xmlXPathFreeObject(retval); + return false; + } + + Array ret = Array::Create(); + for (int i = 0; i < result->nodeNr; ++i) { + xmlNodePtr nodeptr = result->nodeTab[i]; + Object sub; + /** + * Detect the case where the last selector is text(), simplexml + * always accesses the text() child by default, therefore we assign + * to the parent node. + */ + switch (nodeptr->type) { + case XML_TEXT_NODE: + sub = create_element(m_doc, nodeptr->parent, String(), false); + break; + case XML_ELEMENT_NODE: + sub = create_element(m_doc, nodeptr, String(), false); + break; + case XML_ATTRIBUTE_NODE: + sub = create_element(m_doc, nodeptr->parent, String(), false); + break; + default: + break; + } + ret.append(sub); + } + + xmlXPathFreeObject(retval); + return ret; +} + +bool c_simplexmlelement::t_registerxpathnamespace(CStrRef prefix, CStrRef ns) { + if (m_node) { + if (!m_xpath) { + m_xpath = xmlXPathNewContext(m_node->doc); + } + return xmlXPathRegisterNs(m_xpath, (xmlChar *)prefix.data(), + (xmlChar *)ns.data()) == 0; + } + return false; +} + +Variant c_simplexmlelement::t_asxml(CStrRef filename) { + if (!m_node) return false; + + if (!filename.empty()) { + std::string translated = File::TranslatePath(filename).data(); + + if (m_node->parent && m_node->parent->type == XML_DOCUMENT_NODE) { + int bytes = xmlSaveFile(translated.c_str(), (xmlDocPtr)m_node->doc); + return bytes != -1; + } + + xmlOutputBufferPtr outbuf = + xmlOutputBufferCreateFilename(translated.c_str(), NULL, 0); + if (outbuf == NULL) { + return false; + } + xmlNodeDumpOutput(outbuf, m_node->doc, m_node, 0, 0, + (char*)m_node->doc->encoding); + xmlOutputBufferClose(outbuf); + return true; + } + + xmlChar *strval; + int strval_len; + if (m_node->parent && m_node->parent->type == XML_DOCUMENT_NODE) { + xmlDocDumpMemory(m_node->doc, &strval, &strval_len); + String ret((char *)strval, strval_len, CopyString); + xmlFree(strval); + return ret; + } + + xmlOutputBufferPtr outbuf = xmlAllocOutputBuffer(NULL); + if (outbuf == NULL) { + return false; + } + xmlNodeDumpOutput(outbuf, m_node->doc, m_node, 0, 0, + (char*)m_node->doc->encoding); + xmlOutputBufferFlush(outbuf); + String ret((char *)outbuf->buffer->content, outbuf->buffer->use, CopyString); + xmlOutputBufferClose(outbuf); + return ret; +} + +Array c_simplexmlelement::t_getnamespaces(bool recursive /* = false */) { + Array ret = Array::Create(); + if (m_node) { + if (m_node->type == XML_ELEMENT_NODE) { + add_namespaces(ret, m_node, recursive); + } else if (m_node->type == XML_ATTRIBUTE_NODE && m_node->ns) { + add_namespace_name(ret, m_node->ns); + } + } + return ret; +} + +Array c_simplexmlelement::t_getdocnamespaces(bool recursive /* = false */) { + Array ret = Array::Create(); + if (m_node) { + add_registered_namespaces(ret, xmlDocGetRootElement(m_node->doc), + recursive); + } + return ret; +} + +Object c_simplexmlelement::t_children(CStrRef ns /* = "" */, + bool is_prefix /* = false */) { + if (m_is_attribute) { + return Object(); + } + + c_simplexmlelement *elem = NEW(c_simplexmlelement)(); + elem->m_is_children = true; + if (o_properties) { + if (ns.empty()) { + elem->ObjectData::o_set(*o_properties); + } else { + Array props = Array::Create(); + for (ArrayIter iter(*o_properties); iter; ++iter) { + if (iter.second().isObject()) { + c_simplexmlelement *elem = iter.second().toObject(). + getTyped(); + if (elem->m_node && match_ns(elem->m_node, ns, is_prefix)) { + props.set(iter.first(), iter.second()); + } + } else { + Array subnodes; + for (ArrayIter iter2(iter.second()); iter2; ++iter2) { + c_simplexmlelement *elem = iter2.second().toObject(). + getTyped(); + if (elem->m_node && match_ns(elem->m_node, ns, is_prefix)) { + subnodes.append(iter2.second()); + } + } + if (!subnodes.empty()) { + if (subnodes.size() == 1) { + props.set(iter.first(), subnodes[0]); + } else { + props.set(iter.first(), subnodes); + } + } + } + } + elem->ObjectData::o_set(props); + } + } + return elem; +} + +String c_simplexmlelement::t_getname() { + if (m_node) { + int namelen = xmlStrlen(m_node->name); + return String((char*)m_node->name, namelen, CopyString); + } + if (o_properties) { + ArrayIter iter(*o_properties); + if (iter && iter.second().isObject()) { + return iter.second().toObject().getTyped()-> + t_getname(); + } + } + return String(); +} + +Object c_simplexmlelement::t_attributes(CStrRef ns /* = "" */, + bool is_prefix /* = false */) { + if (m_is_attribute) { + return Object(); + } + + c_simplexmlelement *elem = NEW(c_simplexmlelement)(); + elem->m_is_attribute = true; + if (!m_attributes.empty()) { + if (!ns.empty()) { + elem->m_attributes = collect_attributes(m_node, ns, is_prefix); + } else { + elem->m_attributes = m_attributes; + } + elem->o_set("@attributes", -1, elem->m_attributes); + } + return elem; +} + +Variant c_simplexmlelement::t_addchild(CStrRef qname, + CStrRef value /* = null_string */, + CStrRef ns /* = null_string */) { + if (qname.empty()) { + Logger::Warning("Element name is required"); + return null; + } + if (m_is_attribute) { + Logger::Warning("Cannot add element to attributes"); + return null; + } + if (!m_node) { + Logger::Warning("Parent is not a permanent member of the XML tree"); + return null; + } + + xmlChar *prefix = NULL; + xmlChar *localname = xmlSplitQName2((xmlChar *)qname.data(), &prefix); + if (localname == NULL) { + localname = xmlStrdup((xmlChar *)qname.data()); + } + + xmlNsPtr nsptr = NULL; + xmlNodePtr newnode = xmlNewChild(m_node, NULL, localname, + (xmlChar *)value.data()); + if (!ns.isNull()) { + if (ns.empty()) { + newnode->ns = NULL; + nsptr = xmlNewNs(newnode, (xmlChar *)ns.data(), prefix); + } else { + nsptr = xmlSearchNsByHref(m_node->doc, m_node, (xmlChar *)ns.data()); + if (nsptr == NULL) { + nsptr = xmlNewNs(newnode, (xmlChar *)ns.data(), prefix); + } + newnode->ns = nsptr; + } + } + + String newname((char*)localname, CopyString); + String newns((char*)prefix, CopyString); + xmlFree(localname); + if (prefix) { + xmlFree(prefix); + } + + Array newprops = create_children(m_doc, newnode, newns, false); + ObjectData::o_set(newprops); + return newprops[newname]; +} + +void c_simplexmlelement::t_addattribute(CStrRef qname, + CStrRef value /* = null_string */, + CStrRef ns /* = null_string */) { + if (qname.empty()) { + Logger::Warning("Attribute name is required"); + return; + } + + if (m_node && m_node->type != XML_ELEMENT_NODE) { + m_node = m_node->parent; + } + if (!m_node) { + Logger::Warning("Unable to locate parent Element"); + return; + } + + xmlChar *prefix = NULL; + xmlChar *localname = xmlSplitQName2((xmlChar *)qname.data(), &prefix); + if (localname == NULL) { + localname = xmlStrdup((xmlChar *)qname.data()); + } + + xmlAttrPtr attrp = xmlHasNsProp(m_node, localname, (xmlChar *)ns.data()); + if (attrp && attrp->type != XML_ATTRIBUTE_DECL) { + xmlFree(localname); + if (prefix != NULL) { + xmlFree(prefix); + } + Logger::Warning("Attribute already exists"); + return; + } + + xmlNsPtr nsptr = NULL; + if (!ns.isNull()) { + nsptr = xmlSearchNsByHref(m_node->doc, m_node, (xmlChar *)ns.data()); + if (nsptr == NULL) { + nsptr = xmlNewNs(m_node, (xmlChar *)ns.data(), prefix); + } + } + + attrp = xmlNewNsProp(m_node, nsptr, localname, (xmlChar *)value.data()); + m_attributes.set(String((char*)localname, CopyString), value); + + xmlFree(localname); + if (prefix != NULL) { + xmlFree(prefix); + } +} + +String c_simplexmlelement::t___tostring() { + Variant prop; + if (o_properties) { + ArrayIter iter(*o_properties); + if (iter) { + prop = iter.second(); + } + } + return prop.toString(); +} + +Array c_simplexmlelement::o_toIterArray(const char *context) { + if (m_is_attribute) { + return m_attributes; + } + if (!m_is_children) { + return CREATE_VECTOR1(Object(const_cast(this))); + } + + if (o_properties) { + Array objs; + for (ArrayIter iter(*o_properties); iter; ++iter) { + if (iter.second().isObject()) { + objs.append(iter.second()); + } else { + for (ArrayIter iter2(iter.second()); iter2; ++iter2) { + if (iter2.second().isObject()) { + objs.append(iter2.second()); + } + } + } + } + return objs; + } + + return Array(); +} + +Variant c_simplexmlelement::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +// implementing ArrayAccess + +bool c_simplexmlelement::t_offsetexists(CVarRef index) { + if (index.isInteger() && index.toInt64() == 0) { + if (o_properties) { + return o_properties->exists(index); + } + return false; + } + return m_attributes.exists(index); +} + +Variant c_simplexmlelement::t_offsetget(CVarRef index) { + if (index.isInteger() && index.toInt64() == 0) { + if (o_properties) { + return o_properties->rvalAt(index); + } + return null; + } + return m_attributes.rvalAt(index); +} + +void c_simplexmlelement::t_offsetset(CVarRef index, CVarRef newvalue) { + if (index.isInteger() && index.toInt64() == 0) { + o_set(index.toString().data(), -1, newvalue); + return; + } + m_attributes.set(index, newvalue); +} + +void c_simplexmlelement::t_offsetunset(CVarRef index) { + if (index.isInteger() && index.toInt64() == 0) { + if (o_properties) { + o_properties->remove(index); + } + return; + } + m_attributes.remove(index); +} + +/////////////////////////////////////////////////////////////////////////////// +// LibXMLError + +c_libxmlerror::c_libxmlerror() { +} +c_libxmlerror::~c_libxmlerror() { +} +void c_libxmlerror::t___construct() { +} + +Variant c_libxmlerror::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +// libxml + +static ThreadLocal > s_libxml_errors; + +static void libxml_error_handler(void *userData, xmlErrorPtr error) { + std::vector *error_list = s_libxml_errors.get(); + + error_list->resize(error_list->size() + 1); + xmlError &error_copy = error_list->back(); + memset(&error_copy, 0, sizeof(xmlError)); + + if (error) { + xmlCopyError(error, &error_copy); + } else { + error_copy.code = XML_ERR_INTERNAL_ERROR; + error_copy.level = XML_ERR_ERROR; + } +} + +static Object create_libxmlerror(xmlError &error) { + Object ret(NEW(c_libxmlerror)()); + ret->o_set("level", -1, error.level); + ret->o_set("code", -1, error.code); + ret->o_set("column", -1, error.int2); + ret->o_set("message", -1, String(error.message, CopyString)); + ret->o_set("file", -1, String(error.file, CopyString)); + ret->o_set("line", -1, error.line); + return ret; +} + +Variant f_libxml_get_errors() { + std::vector *error_list = s_libxml_errors.get(); + Array ret = Array::Create(); + for (unsigned int i = 0; i < error_list->size(); i++) { + ret.append(create_libxmlerror(error_list->at(i))); + } + return ret; +} + +Variant f_libxml_get_last_error() { + xmlErrorPtr error = xmlGetLastError(); + if (error) { + return create_libxmlerror(*error); + } + return false; +} + +void f_libxml_clear_errors() { + xmlResetLastError(); + s_libxml_errors->clear(); +} + +bool f_libxml_use_internal_errors(CVarRef use_errors /* = null_variant */) { + bool ret = (xmlStructuredError == libxml_error_handler); + if (!use_errors.isNull()) { + if (!use_errors.toBoolean()) { + xmlSetStructuredErrorFunc(NULL, NULL); + s_libxml_errors->clear(); + } else { + xmlSetStructuredErrorFunc(NULL, libxml_error_handler); + } + } + return ret; +} + +void f_libxml_set_streams_context(CObjRef streams_context) { + throw NotImplementedException(__func__); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_simplexml.h b/src/cpp/ext/ext_simplexml.h new file mode 100644 index 0000000000000..847fd3e55face --- /dev/null +++ b/src/cpp/ext/ext_simplexml.h @@ -0,0 +1,99 @@ + +#ifndef __EXT_SIMPLEXML_H__ +#define __EXT_SIMPLEXML_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< +#include + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_simplexml_load_string(CStrRef data, CStrRef class_name = "SimpleXMLElement", int64 options = 0, CStrRef ns = "", bool is_prefix = false); +Variant f_simplexml_load_file(CStrRef filename, CStrRef class_name = "SimpleXMLElement", int64 options = 0, CStrRef ns = "", bool is_prefix = false); +Variant f_libxml_get_errors(); +Variant f_libxml_get_last_error(); +void f_libxml_clear_errors(); +bool f_libxml_use_internal_errors(CVarRef use_errors = null_variant); +void f_libxml_set_streams_context(CObjRef streams_context); + +/////////////////////////////////////////////////////////////////////////////// +// class SimpleXMLElement + +FORWARD_DECLARE_CLASS(simplexmlelement); +class c_simplexmlelement: public c_arrayaccess { + public: + BEGIN_CLASS_MAP(simplexmlelement) + PARENT_CLASS(arrayaccess) + END_CLASS_MAP(simplexmlelement) + DECLARE_CLASS(simplexmlelement, SimpleXMLElement, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_simplexmlelement(); + public: ~c_simplexmlelement(); + public: void t___construct(CStrRef data, int64 options = 0, bool data_is_url = false, CStrRef ns = "", bool is_prefix = false); + public: bool t_offsetexists(CVarRef index); + public: Variant t_offsetget(CVarRef index); + public: void t_offsetset(CVarRef index, CVarRef newvalue); + public: void t_offsetunset(CVarRef index); + public: Variant t_xpath(CStrRef path); + public: bool t_registerxpathnamespace(CStrRef prefix, CStrRef ns); + public: Variant t_asxml(CStrRef filename); + public: Array t_getnamespaces(bool recursive = false); + public: Array t_getdocnamespaces(bool recursive = false); + public: Object t_children(CStrRef ns = "", bool is_prefix = false); + public: String t_getname(); + public: Object t_attributes(CStrRef ns = "", bool is_prefix = false); + public: Variant t_addchild(CStrRef qname, CStrRef value = null_string, CStrRef ns = null_string); + public: void t_addattribute(CStrRef qname, CStrRef value = null_string, CStrRef ns = null_string); + public: String t___tostring(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(String data, int64 options = 0, bool data_is_url = false, String ns = "", bool is_prefix = false); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: + Object m_doc; + xmlNodePtr m_node; + Array m_attributes; + virtual Array o_toIterArray(const char *context); + private: + bool m_is_attribute; + bool m_is_children; + xmlXPathContextPtr m_xpath; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class LibXMLError + +FORWARD_DECLARE_CLASS(libxmlerror); +class c_libxmlerror : public ObjectData { + public: + BEGIN_CLASS_MAP(libxmlerror) + END_CLASS_MAP(libxmlerror) + DECLARE_CLASS(libxmlerror, LibXMLError, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_libxmlerror(); + public: ~c_libxmlerror(); + public: void t___construct(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_SIMPLEXML_H__ diff --git a/src/cpp/ext/ext_simplexml_include.h b/src/cpp/ext/ext_simplexml_include.h new file mode 100644 index 0000000000000..69eccbe20e467 --- /dev/null +++ b/src/cpp/ext/ext_simplexml_include.h @@ -0,0 +1,32 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_SIMPLEXML_INCLUDE_H__ +#define __EXT_SIMPLEXML_INCLUDE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // __EXT_SIMPLEXML_INCLUDE_H__ diff --git a/src/cpp/ext/ext_soap.cpp b/src/cpp/ext/ext_soap.cpp new file mode 100644 index 0000000000000..eb22be4ac5c92 --- /dev/null +++ b/src/cpp/ext/ext_soap.cpp @@ -0,0 +1,2872 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helper classes for setting/resetting globals within a method call + +class SoapScope { +public: + SoapScope() { + USE_SOAP_GLOBAL; + m_old_handler = SOAP_GLOBAL(use_soap_error_handler); + m_old_error_code = SOAP_GLOBAL(error_code); + m_old_error_object = SOAP_GLOBAL(error_object); + m_old_soap_version = SOAP_GLOBAL(soap_version); + + SOAP_GLOBAL(use_soap_error_handler) = true; + } + + ~SoapScope() { + USE_SOAP_GLOBAL; + SOAP_GLOBAL(use_soap_error_handler) = m_old_handler; + SOAP_GLOBAL(error_code) = m_old_error_code; + SOAP_GLOBAL(error_object) = m_old_error_object; + SOAP_GLOBAL(soap_version) = m_old_soap_version; + } + +private: + bool m_old_handler; + const char *m_old_error_code; + Object m_old_error_object; + int m_old_soap_version; +}; + +class SoapServerScope : public SoapScope { +public: + SoapServerScope(c_soapserver *server) { + USE_SOAP_GLOBAL; + SOAP_GLOBAL(error_code) = "Server"; + SOAP_GLOBAL(error_object) = Object(server); + } +}; + +class SoapClientScope : public SoapScope { +public: + SoapClientScope(c_soapclient *client) { + USE_SOAP_GLOBAL; + SOAP_GLOBAL(error_code) = "Client"; + SOAP_GLOBAL(error_object) = Object(client); + } +}; + +class SoapServiceScope { +public: + SoapServiceScope(c_soapserver *server) { + save(); + USE_SOAP_GLOBAL; + SOAP_GLOBAL(soap_version) = server->m_version; + SOAP_GLOBAL(sdl) = server->m_sdl; + SOAP_GLOBAL(encoding) = server->m_encoding; + SOAP_GLOBAL(classmap) = server->m_classmap; + SOAP_GLOBAL(typemap) = server->m_typemap; + SOAP_GLOBAL(features) = server->m_features; + } + + SoapServiceScope(c_soapclient *client) { + save(); + USE_SOAP_GLOBAL; + SOAP_GLOBAL(soap_version) = client->m_soap_version; + SOAP_GLOBAL(sdl) = client->m_sdl; + SOAP_GLOBAL(encoding) = client->m_encoding; + SOAP_GLOBAL(classmap) = client->m_classmap; + SOAP_GLOBAL(typemap) = client->m_typemap; + SOAP_GLOBAL(features) = client->m_features; + } + + ~SoapServiceScope() { + USE_SOAP_GLOBAL; + SOAP_GLOBAL(soap_version) = m_old_soap_version; + SOAP_GLOBAL(encoding) = m_old_encoding; + SOAP_GLOBAL(sdl) = m_old_sdl; + SOAP_GLOBAL(classmap) = m_old_classmap; + SOAP_GLOBAL(typemap) = m_old_typemap; + SOAP_GLOBAL(features) = m_old_features; + } + +private: + sdl *m_old_sdl; + xmlCharEncodingHandlerPtr m_old_encoding; + Array m_old_classmap; + encodeMap *m_old_typemap; + int64 m_old_features; + int m_old_soap_version; + + void save() { + USE_SOAP_GLOBAL; + m_old_soap_version = SOAP_GLOBAL(soap_version); + m_old_sdl = SOAP_GLOBAL(sdl); + m_old_encoding = SOAP_GLOBAL(encoding); + m_old_classmap = SOAP_GLOBAL(classmap); + m_old_typemap = SOAP_GLOBAL(typemap); + m_old_features = SOAP_GLOBAL(features); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// forward declarations + +static void throw_soap_server_fault(litstr code, litstr fault); +static void model_to_string(sdlContentModelPtr model, StringBuffer &buf, + int level); + +/////////////////////////////////////////////////////////////////////////////// +// client helpers + +static Object create_soap_fault(CStrRef code, CStrRef fault) { + return Object((NEW(c_soapfault)())->create(code, fault)); +} + +static sdlParamPtr get_param(sdlFunction *function, const char *param_name, + int index, bool response) { + sdlParamVec *ht; + + if (!function) { + return sdlParamPtr(); + } + + if (!response) { + ht = &function->requestParameters; + } else { + ht = &function->responseParameters; + } + + if (ht->empty()) { + return sdlParamPtr(); + } + + if (param_name) { + for (unsigned int i = 0; i < ht->size(); i++) { + sdlParamPtr p = (*ht)[i]; + if (p->paramName == param_name) return p; + } + } else { + if (index >= 0 && index < (int)ht->size()) { + return (*ht)[index]; + } + } + return sdlParamPtr(); +} + +static xmlNodePtr serialize_zval(CVarRef val, sdlParamPtr param, + const char *paramName, int style, + xmlNodePtr parent) { + xmlNodePtr xmlParam; + encodePtr enc; + + Variant v = val; + if (param != NULL) { + enc = param->encode; + if (val.isNull()) { + if (param->element) { + if (!param->element->fixed.empty()) { + v = String(param->element->fixed); + } else if (!param->element->def.empty() && !param->element->nillable) { + v = String(param->element->def); + } + } + } + } else { + enc = encodePtr(); + } + xmlParam = master_to_xml(enc, val, style, parent); + if (!strcmp((char*)xmlParam->name, "BOGUS")) { + xmlNodeSetName(xmlParam, BAD_CAST(paramName)); + } + return xmlParam; +} + +static xmlNodePtr serialize_parameter(sdlParamPtr param, Variant value, + int index, const char *name, int style, + xmlNodePtr parent) { + if (!value.isNull() && value.isObject()) { + c_soapparam *p = value.toObject().getTyped(); + value = p->m_data; + name = p->m_name.c_str(); + } + + if (param && !param->paramName.empty()) { + name = param->paramName.c_str(); + } else { + if (name == NULL) { + char paramNameBuf[10]; + snprintf(paramNameBuf, sizeof(paramNameBuf), "param%d", index); + name = paramNameBuf; + } + } + + return serialize_zval(value, param, name, style, parent); +} + +static xmlDocPtr serialize_function_call +(c_soapclient *client, sdlFunctionPtr function, const char *function_name, + const char *uri, CArrRef arguments, CArrRef soap_headers) { + xmlNodePtr envelope = NULL, body, method = NULL, head = NULL; + xmlNsPtr ns = NULL; + int style, use; + sdlSoapBindingFunctionHeaderMap *hdrs = NULL; + + encode_reset_ns(); + + xmlDoc *doc = xmlNewDoc(BAD_CAST("1.0")); + doc->encoding = xmlCharStrdup("UTF-8"); + doc->charset = XML_CHAR_ENCODING_UTF8; + if (client->m_soap_version == SOAP_1_1) { + envelope = xmlNewDocNode(doc, NULL, BAD_CAST("Envelope"), NULL); + ns = xmlNewNs(envelope, BAD_CAST(SOAP_1_1_ENV_NAMESPACE), + BAD_CAST(SOAP_1_1_ENV_NS_PREFIX)); + xmlSetNs(envelope, ns); + } else if (client->m_soap_version == SOAP_1_2) { + envelope = xmlNewDocNode(doc, NULL, BAD_CAST("Envelope"), NULL); + ns = xmlNewNs(envelope, BAD_CAST(SOAP_1_2_ENV_NAMESPACE), + BAD_CAST(SOAP_1_2_ENV_NS_PREFIX)); + xmlSetNs(envelope, ns); + } else { + throw SoapException("Unknown SOAP version"); + } + xmlDocSetRootElement(doc, envelope); + + if (!soap_headers.empty()) { + head = xmlNewChild(envelope, ns, BAD_CAST("Header"), NULL); + } + + body = xmlNewChild(envelope, ns, BAD_CAST("Body"), NULL); + + if (function && function->binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = function->bindingAttributes; + + hdrs = &fnb->input.headers; + style = fnb->style; + /*FIXME: how to pass method name if style is SOAP_DOCUMENT */ + /*style = SOAP_RPC;*/ + use = fnb->input.use; + if (style == SOAP_RPC) { + ns = encode_add_ns(body, fnb->input.ns.c_str()); + if (!function->requestName.empty()) { + method = xmlNewChild(body, ns, + BAD_CAST(function->requestName.c_str()), NULL); + } else { + method = xmlNewChild(body, ns, + BAD_CAST(function->functionName.c_str()), NULL); + } + } + } else { + use = client->m_use; + style = client->m_style; + /*FIXME: how to pass method name if style is SOAP_DOCUMENT */ + /*style = SOAP_RPC;*/ + if (style == SOAP_RPC) { + ns = encode_add_ns(body, uri); + if (function_name) { + method = xmlNewChild(body, ns, BAD_CAST(function_name), NULL); + } else if (function && !function->requestName.empty()) { + method = xmlNewChild(body, ns, + BAD_CAST(function->requestName.c_str()), NULL); + } else if (function && !function->functionName.empty()) { + method = xmlNewChild(body, ns, + BAD_CAST(function->functionName.c_str()), NULL); + } else { + method = body; + } + } else { + method = body; + } + } + + int i = 0; + for (ArrayIter iter(arguments); iter; ++iter, ++i) { + xmlNodePtr param; + sdlParamPtr parameter; + if (function) { + parameter = get_param(function.get(), NULL, i, false); + } + + if (style == SOAP_RPC) { + if (parameter) { + param = serialize_parameter(parameter, iter.second(), i, NULL, + use, method); + } + } else if (style == SOAP_DOCUMENT) { + param = serialize_parameter(parameter, iter.second(), i, NULL, + use, body); + if (function && function->binding->bindingType == BINDING_SOAP) { + if (parameter && parameter->element) { + ns = encode_add_ns(param, parameter->element->namens.c_str()); + xmlNodeSetName(param, BAD_CAST(parameter->element->name.c_str())); + xmlSetNs(param, ns); + } + } + } + } + + if (function && !function->requestParameters.empty()) { + int n = function->requestParameters.size(); + if (n > arguments.size()) { + for (i = arguments.size(); i < n; i++) { + xmlNodePtr param; + sdlParamPtr parameter = get_param(function.get(), NULL, i, false); + + if (style == SOAP_RPC) { + param = serialize_parameter(parameter, null, i, NULL, use, method); + } else if (style == SOAP_DOCUMENT) { + param = serialize_parameter(parameter, null, i, NULL, use, body); + if (function && function->binding->bindingType == BINDING_SOAP) { + if (parameter && parameter->element) { + ns = encode_add_ns(param, parameter->element->namens.c_str()); + xmlNodeSetName(param, + BAD_CAST(parameter->element->name.c_str())); + xmlSetNs(param, ns); + } + } + } + } + } + } + + if (head) { + for (ArrayIter iter(soap_headers); iter; ++iter) { + c_soapheader *header = iter.second().toObject().getTyped(); + + xmlNodePtr h; + xmlNsPtr nsptr; + int hdr_use = SOAP_LITERAL; + encodePtr enc; + + if (hdrs) { + string key = header->m_namespace.data(); + key += ':'; + key += header->m_name.data(); + sdlSoapBindingFunctionHeaderMap::iterator iter = hdrs->find(key); + if (iter != hdrs->end()) { + sdlSoapBindingFunctionHeaderPtr hdr = iter->second; + hdr_use = hdr->use; + enc = hdr->encode; + if (hdr_use == SOAP_ENCODED) { + use = SOAP_ENCODED; + } + } + } + + if (!header->m_data.isNull()) { + h = master_to_xml(enc, header->m_data, hdr_use, head); + xmlNodeSetName(h, BAD_CAST(header->m_name.data())); + } else { + h = xmlNewNode(NULL, BAD_CAST(header->m_name.data())); + xmlAddChild(head, h); + } + nsptr = encode_add_ns(h, header->m_namespace.data()); + xmlSetNs(h, nsptr); + + if (header->m_mustUnderstand) { + if (client->m_soap_version == SOAP_1_1) { + xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":mustUnderstand"), + BAD_CAST("1")); + } else { + xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":mustUnderstand"), + BAD_CAST("true")); + } + } + if (!header->m_actor.isNull()) { + if (header->m_actor.isString()) { + if (client->m_soap_version == SOAP_1_1) { + xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), + BAD_CAST(header->m_actor.toString().data())); + } else { + xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), + BAD_CAST(header->m_actor.toString().data())); + } + } else if (header->m_actor.isInteger()) { + int64 actor = header->m_actor.toInt64(); + if (client->m_soap_version == SOAP_1_1) { + if (actor == SOAP_ACTOR_NEXT) { + xmlSetProp(h, BAD_CAST(SOAP_1_1_ENV_NS_PREFIX":actor"), + BAD_CAST(SOAP_1_1_ACTOR_NEXT)); + } + } else { + if (actor == SOAP_ACTOR_NEXT) { + xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), + BAD_CAST(SOAP_1_2_ACTOR_NEXT)); + } else if (actor == SOAP_ACTOR_NONE) { + xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), + BAD_CAST(SOAP_1_2_ACTOR_NONE)); + } else if (actor == SOAP_ACTOR_UNLIMATERECEIVER) { + xmlSetProp(h, BAD_CAST(SOAP_1_2_ENV_NS_PREFIX":role"), + BAD_CAST(SOAP_1_2_ACTOR_UNLIMATERECEIVER)); + } + } + } + } + } + } + + if (use == SOAP_ENCODED) { + xmlNewNs(envelope, BAD_CAST(XSD_NAMESPACE), BAD_CAST(XSD_NS_PREFIX)); + if (client->m_soap_version == SOAP_1_1) { + xmlNewNs(envelope, BAD_CAST(SOAP_1_1_ENC_NAMESPACE), + BAD_CAST(SOAP_1_1_ENC_NS_PREFIX)); + xmlSetNsProp(envelope, envelope->ns, BAD_CAST("encodingStyle"), + BAD_CAST(SOAP_1_1_ENC_NAMESPACE)); + } else if (client->m_soap_version == SOAP_1_2) { + xmlNewNs(envelope, BAD_CAST(SOAP_1_2_ENC_NAMESPACE), + BAD_CAST(SOAP_1_2_ENC_NS_PREFIX)); + if (method) { + xmlSetNsProp(method, envelope->ns, BAD_CAST("encodingStyle"), + BAD_CAST(SOAP_1_2_ENC_NAMESPACE)); + } + } + } + + encode_finish(); + return doc; +} + +static bool do_request(c_soapclient *client, xmlDoc *request, + const char *location, const char *action, int version, + bool one_way, Variant &response) { + char *buf; int buf_size; + xmlDocDumpMemory(request, (xmlChar**)&buf, &buf_size); + if (!buf) { + client->m_soap_fault = + create_soap_fault("HTTP", "Error build soap request"); + return false; + } + + if (client->m_trace) { + client->m_last_request = String((char*)buf, buf_size, CopyString); + } + response = client->t___dorequest(String(buf, buf_size, AttachLiteral), + String(location, AttachLiteral), + String(action, AttachLiteral), + version, one_way); + if (!response.isString()) { + if (client->m_soap_fault.isNull()) { + client->m_soap_fault = + create_soap_fault("Client", "SoapClient::__doRequest() " + "returned non string value"); + } + } else if (client->m_trace) { + client->m_last_response = response; + } + xmlFree(buf); + + return client->m_soap_fault.isNull(); +} + +static void verify_soap_headers_array(Array &headers) { + for (ArrayIter iter(headers); iter; ++iter) { + Variant tmp = iter.second(); + if (!tmp.isObject() || !tmp.toObject().is()) { + throw SoapException("Invalid SOAP header"); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// shared helpers + +static encodeMapPtr soap_create_typemap_impl(sdl *sdl, Array &ht) { + encodeMapPtr typemap(new encodeMap()); + for (ArrayIter iter(ht); iter; ++iter) { + Variant tmp = iter.second(); + if (!tmp.isArray()) { + Logger::Warning("Wrong 'typemap' option"); + return typemap; + } + Array ht2 = tmp.toArray(); + + String type_name, type_ns; + Variant to_xml, to_zval; + for (ArrayIter it(ht2); it; ++it) { + tmp = it.second(); + if (it.first().isString()) { + String name = it.first().toString(); + if (name == "type_name") { + if (tmp.isString()) type_name = tmp.toString(); + } else if (name == "type_ns") { + if (tmp.isString()) type_ns = tmp.toString(); + } else if (name == "to_xml") { + to_xml = tmp; + } else if (name == "from_xml") { + to_zval = tmp; + } + } + } + + encodePtr enc, new_enc; + if (!type_name.empty()) { + if (!type_ns.empty()) { + enc = get_encoder(sdl, type_ns.data(), type_name.data()); + } else { + enc = get_encoder_ex(sdl, type_name.data()); + } + + new_enc = encodePtr(new encode()); + if (enc) { + new_enc->details.type = enc->details.type; + new_enc->details.ns = enc->details.ns; + new_enc->details.type_str = enc->details.type_str; + new_enc->details.sdl_type = enc->details.sdl_type; + } else { + enc = get_conversion(UNKNOWN_TYPE); + new_enc->details.type = enc->details.type; + if (!type_ns.empty()) { + new_enc->details.ns = type_ns.data(); + } + new_enc->details.type_str = type_name.data(); + } + new_enc->to_xml = enc->to_xml; + new_enc->to_zval = enc->to_zval; + new_enc->details.map = soapMappingPtr(new soapMapping()); + if (to_xml) { + new_enc->details.map->to_xml = to_xml; + new_enc->to_xml = to_xml_user; + } else if (enc->details.map && !enc->details.map->to_xml.isNull()) { + new_enc->details.map->to_xml = enc->details.map->to_xml; + } + if (to_zval) { + new_enc->details.map->to_zval = to_zval; + new_enc->to_zval = to_zval_user; + } else if (enc->details.map && !enc->details.map->to_zval.isNull()) { + new_enc->details.map->to_zval = enc->details.map->to_zval; + } + + string nscat; + if (!type_ns.empty()) { + nscat += type_ns.data(); + nscat += ':'; + } + nscat += type_name.data(); + (*typemap)[nscat] = new_enc; + } + } + return typemap; +} + +static encodeMap *soap_create_typemap(sdl *sdl, Array &ht) { + return s_soap_data->register_typemap(soap_create_typemap_impl(sdl, ht)); +} + +static void output_xml_header(int soap_version) { + if (soap_version == SOAP_1_2) { + f_header("Content-Type: application/soap+xml; charset=utf-8"); + } else { + f_header("Content-Type: text/xml; charset=utf-8"); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// server helpers + +static void deserialize_parameters(xmlNodePtr params, sdlFunction *function, + Array ¶meters) { + int num_of_params = 0; + int cur_param = 0; + if (function) { + bool use_names = false; + num_of_params = function->requestParameters.size(); + if (num_of_params == 0) return; + for (int i = 0; i < num_of_params; i++) { + sdlParamPtr param = function->requestParameters[i]; + if (get_node(params, (char*)param->paramName.c_str())) { + use_names = true; + break; + } + } + if (use_names) { + for (int i = 0; i < num_of_params; i++, cur_param++) { + sdlParamPtr param = function->requestParameters[i]; + xmlNodePtr val = get_node(params, (char*)param->paramName.c_str()); + if (val) { + parameters.append(master_to_zval(param->encode, val)); + } + } + return; + } + } + if (params) { + int num_of_params = 0; + xmlNodePtr trav = params; + while (trav != NULL) { + if (trav->type == XML_ELEMENT_NODE) { + num_of_params++; + } + trav = trav->next; + } + + if (num_of_params == 1 && function && function->binding && + function->binding->bindingType == BINDING_SOAP && + function->bindingAttributes->style == SOAP_DOCUMENT && + function->requestParameters.empty() && + strcmp((char*)params->name, function->functionName.c_str()) == 0) { + num_of_params = 0; + } else if (num_of_params > 0) { + trav = params; + while (trav != 0 && cur_param < num_of_params) { + if (trav->type == XML_ELEMENT_NODE) { + encodePtr enc; + sdlParamPtr param; + if (function) { + if (cur_param >= (int)function->requestParameters.size()) { + throw_soap_server_fault("Client","Error cannot find parameter"); + } + param = function->requestParameters[cur_param]; + } + if (param == NULL) { + enc.reset(); + } else { + enc = param->encode; + } + parameters.set(cur_param, master_to_zval(enc, trav)); + cur_param++; + } + trav = trav->next; + } + } + } + if (num_of_params > cur_param) { + throw_soap_server_fault("Client","Missing parameter"); + } +} + +static sdlFunctionPtr get_doc_function(sdl *sdl, xmlNodePtr params) { + if (sdl) { + for (sdlFunctionMap::iterator iter = sdl->functions.begin(); + iter != sdl->functions.end(); ++iter) { + sdlFunctionPtr tmp = iter->second; + if (tmp->binding && tmp->binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = tmp->bindingAttributes; + if (fnb->style == SOAP_DOCUMENT) { + if (params == NULL) { + if (tmp->requestParameters.empty()) { + return tmp; + } + } else if (!tmp->requestParameters.empty()) { + bool ok = true; + xmlNodePtr node = params; + for (unsigned int i = 0; i < tmp->requestParameters.size(); i++) { + sdlParamPtr param = tmp->requestParameters[i]; + if (param->element) { + if (param->element->name != (char*)node->name) { + ok = false; + break; + } + if (!param->element->namens.empty() && node->ns) { + if (param->element->namens != (char*)node->ns->href) { + ok = false; + break; + } + } else if ((param->element->namens.empty() && node->ns) || + (!param->element->namens.empty() && + node->ns == NULL)) { + ok = false; + break; + } + } else if (param->paramName != (char*)node->name) { + ok = false; + break; + } + node = node->next; + } + if (ok /*&& node == NULL*/) { + return tmp; + } + } + } + } + } + } + return sdlFunctionPtr(); +} + +static sdlFunctionPtr get_function(sdl *sdl, const char *function_name) { + if (sdl) { + String lowered = StringUtil::ToLower(function_name); + sdlFunctionMap::iterator iter = sdl->functions.find(lowered.data()); + if (iter == sdl->functions.end()) { + iter = sdl->requests.find(lowered.data()); + if (iter == sdl->requests.end()) { + return sdlFunctionPtr(); + } + } + return iter->second; + } + return sdlFunctionPtr(); +} + +static sdlFunctionPtr find_function(sdl *sdl, xmlNodePtr func, + String &function_name) { + sdlFunctionPtr function = get_function(sdl, (char*)func->name); + if (function && function->binding && + function->binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = function->bindingAttributes; + if (fnb->style == SOAP_DOCUMENT) { + if (func->children != NULL || !function->requestParameters.empty()) { + function.reset(); + } + } + } + if (sdl != NULL && function == NULL) { + function = get_doc_function(sdl, func); + } + + if (function != NULL) { + function_name = String(function->functionName); + } else { + function_name = String((char *)func->name, CopyString); + } + + return function; +} + +static sdlFunctionPtr deserialize_function_call +(sdl *sdl, xmlDocPtr request, const char* actor, String &function_name, + Array ¶meters, int &version, Array &headers) { + USE_SOAP_GLOBAL; + char* envelope_ns = NULL; + xmlNodePtr trav,env,head,body,func; + xmlAttrPtr attr; + sdlFunctionPtr function; + + encode_reset_ns(); + + /* Get element */ + env = NULL; + trav = request->children; + while (trav != NULL) { + if (trav->type == XML_ELEMENT_NODE) { + if (env == NULL && + node_is_equal_ex(trav,"Envelope",SOAP_1_1_ENV_NAMESPACE)) { + env = trav; + version = SOAP_1_1; + envelope_ns = SOAP_1_1_ENV_NAMESPACE; + SOAP_GLOBAL(soap_version) = SOAP_1_1; + } else if (env == NULL && + node_is_equal_ex(trav,"Envelope",SOAP_1_2_ENV_NAMESPACE)) { + env = trav; + version = SOAP_1_2; + envelope_ns = SOAP_1_2_ENV_NAMESPACE; + SOAP_GLOBAL(soap_version) = SOAP_1_2; + } else { + throw_soap_server_fault("VersionMismatch", "Wrong Version"); + } + } + trav = trav->next; + } + if (env == NULL) { + throw_soap_server_fault + ("Client", "looks like we got XML without \"Envelope\" element"); + } + + attr = env->properties; + while (attr != NULL) { + if (attr->ns == NULL) { + throw_soap_server_fault("Client", "A SOAP Envelope element cannot have " + "non Namespace qualified attributes"); + } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) { + if (version == SOAP_1_2) { + throw_soap_server_fault("Client", "encodingStyle cannot be specified " + "on the Envelope"); + } else if (strcmp((char*)attr->children->content, + SOAP_1_1_ENC_NAMESPACE) != 0) { + throw_soap_server_fault("Client", "Unknown data encoding style"); + } + } + attr = attr->next; + } + + /* Get
    element */ + head = NULL; + trav = env->children; + while (trav != NULL && trav->type != XML_ELEMENT_NODE) { + trav = trav->next; + } + if (trav != NULL && node_is_equal_ex(trav,"Header",envelope_ns)) { + head = trav; + trav = trav->next; + } + + /* Get element */ + body = NULL; + while (trav != NULL && trav->type != XML_ELEMENT_NODE) { + trav = trav->next; + } + if (trav != NULL && node_is_equal_ex(trav,"Body",envelope_ns)) { + body = trav; + trav = trav->next; + } + while (trav != NULL && trav->type != XML_ELEMENT_NODE) { + trav = trav->next; + } + if (body == NULL) { + throw_soap_server_fault("Client", "Body must be present in a " + "SOAP envelope"); + } + attr = body->properties; + while (attr != NULL) { + if (attr->ns == NULL) { + if (version == SOAP_1_2) { + throw_soap_server_fault("Client", "A SOAP Body element cannot have non" + " Namespace qualified attributes"); + } + } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) { + if (version == SOAP_1_2) { + throw_soap_server_fault("Client", "encodingStyle cannot be specified " + "on the Body"); + } else if (strcmp((char*)attr->children->content, + SOAP_1_1_ENC_NAMESPACE) != 0) { + throw_soap_server_fault("Client", "Unknown data encoding style"); + } + } + attr = attr->next; + } + + if (trav != NULL && version == SOAP_1_2) { + throw_soap_server_fault("Client", "A SOAP 1.2 envelope can contain only " + "Header and Body"); + } + + func = NULL; + trav = body->children; + while (trav != NULL) { + if (trav->type == XML_ELEMENT_NODE) { +/* + if (func != NULL) { + throw_soap_server_fault("Client", "looks like we got \"Body\" with " + "several functions call", NULL, NULL, NULL); + } +*/ + func = trav; + break; /* FIXME: the rest of body is ignored */ + } + trav = trav->next; + } + if (func == NULL) { + function = get_doc_function(sdl, NULL); + if (function != NULL) { + function_name = String(function->functionName); + } else { + throw_soap_server_fault + ("Client", "looks like we got \"Body\" without function call"); + } + } else { + if (version == SOAP_1_1) { + attr = get_attribute_ex(func->properties,"encodingStyle", + SOAP_1_1_ENV_NAMESPACE); + if (attr && strcmp((char*)attr->children->content, + SOAP_1_1_ENC_NAMESPACE) != 0) { + throw_soap_server_fault("Client","Unknown Data Encoding Style"); + } + } else { + attr = get_attribute_ex(func->properties,"encodingStyle", + SOAP_1_2_ENV_NAMESPACE); + if (attr && strcmp((char*)attr->children->content, + SOAP_1_2_ENC_NAMESPACE) != 0) { + throw_soap_server_fault + ("DataEncodingUnknown","Unknown Data Encoding Style"); + } + } + function = find_function(sdl, func, function_name); + if (sdl != NULL && function == NULL) { + if (version == SOAP_1_2) { + throw_soap_server_fault + ("rpc:ProcedureNotPresent","Procedure not present"); + } else { + throw SoapException("Procedure '%s' not present", func->name); + } + } + } + + headers = Array::Create(); + if (head) { + soapHeader *h = NULL; + attr = head->properties; + while (attr != NULL) { + if (attr->ns == NULL) { + throw_soap_server_fault("Client", "A SOAP Header element cannot have " + "non Namespace qualified attributes"); + } else if (attr_is_equal_ex(attr,"encodingStyle", + SOAP_1_2_ENV_NAMESPACE)) { + if (version == SOAP_1_2) { + throw_soap_server_fault("Client", "encodingStyle cannot be specified" + " on the Header"); + } else if (strcmp((char*)attr->children->content, + SOAP_1_1_ENC_NAMESPACE) != 0) { + throw_soap_server_fault("Client", "Unknown data encoding style"); + } + } + attr = attr->next; + } + trav = head->children; + while (trav != NULL) { + if (trav->type == XML_ELEMENT_NODE) { + xmlNodePtr hdr_func = trav; + xmlAttrPtr attr; + int mustUnderstand = 0; + + if (version == SOAP_1_1) { + attr = get_attribute_ex(hdr_func->properties,"encodingStyle", + SOAP_1_1_ENV_NAMESPACE); + if (attr && strcmp((char*)attr->children->content, + SOAP_1_1_ENC_NAMESPACE) != 0) { + throw_soap_server_fault("Client","Unknown Data Encoding Style"); + } + attr = get_attribute_ex(hdr_func->properties,"actor",envelope_ns); + if (attr != NULL) { + if (strcmp((char*)attr->children->content, + SOAP_1_1_ACTOR_NEXT) != 0 && + (actor == NULL || + strcmp((char*)attr->children->content,actor) != 0)) { + goto ignore_header; + } + } + } else if (version == SOAP_1_2) { + attr = get_attribute_ex(hdr_func->properties,"encodingStyle", + SOAP_1_2_ENV_NAMESPACE); + if (attr && strcmp((char*)attr->children->content, + SOAP_1_2_ENC_NAMESPACE) != 0) { + throw_soap_server_fault + ("DataEncodingUnknown","Unknown Data Encoding Style"); + } + attr = get_attribute_ex(hdr_func->properties,"role",envelope_ns); + if (attr != NULL) { + if (strcmp((char*)attr->children->content, + SOAP_1_2_ACTOR_UNLIMATERECEIVER) != 0 && + strcmp((char*)attr->children->content, + SOAP_1_2_ACTOR_NEXT) != 0 && + (actor == NULL || + strcmp((char*)attr->children->content,actor) != 0)) { + goto ignore_header; + } + } + } + attr = get_attribute_ex(hdr_func->properties,"mustUnderstand", + envelope_ns); + if (attr) { + if (strcmp((char*)attr->children->content,"1") == 0 || + strcmp((char*)attr->children->content,"true") == 0) { + mustUnderstand = 1; + } else if (strcmp((char*)attr->children->content,"0") == 0 || + strcmp((char*)attr->children->content,"false") == 0) { + mustUnderstand = 0; + } else { + throw_soap_server_fault("Client", + "mustUnderstand value is not boolean"); + } + } + h = NEW(soapHeader)(); + Object hobj(h); + h->function = find_function(sdl, hdr_func, h->function_name).get(); + h->mustUnderstand = mustUnderstand; + h->hdr = NULL; + if (!h->function && sdl && function && function->binding && + function->binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = function->bindingAttributes; + if (!fnb->input.headers.empty()) { + string key; + if (hdr_func->ns) { + key += (char*)hdr_func->ns->href; + key += ':'; + } + key += h->function_name; + sdlSoapBindingFunctionHeaderMap::iterator iter = + fnb->input.headers.find(key); + if (iter != fnb->input.headers.end()) { + h->hdr = iter->second.get(); + } + } + } + if (h->hdr) { + h->parameters.append(master_to_zval(h->hdr->encode, hdr_func)); + } else { + if (h->function && h->function->binding && + h->function->binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = h->function->bindingAttributes; + if (fnb->style == SOAP_RPC) { + hdr_func = hdr_func->children; + } + } + deserialize_parameters(hdr_func, h->function, h->parameters); + } + headers.append(hobj); + } +ignore_header: + trav = trav->next; + } + } + + if (function && function->binding && + function->binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = function->bindingAttributes; + if (fnb->style == SOAP_RPC) { + func = func->children; + } + } else { + func = func->children; + } + deserialize_parameters(func, function.get(), parameters); + + encode_finish(); + + return function; +} + +static int serialize_response_call2(xmlNodePtr body, sdlFunction *function, + const char *function_name, const char *uri, + Variant &ret, int version, int main) { + xmlNodePtr method = NULL, param; + sdlParamPtr parameter; + int param_count; + int style, use; + xmlNsPtr ns = NULL; + + if (function && function->binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = function->bindingAttributes; + style = fnb->style; + use = fnb->output.use; + ns = encode_add_ns(body, fnb->output.ns.c_str()); + if (style == SOAP_RPC) { + if (!function->responseName.empty()) { + method = xmlNewChild(body, ns, + BAD_CAST(function->responseName.c_str()), NULL); + } else if (!function->responseParameters.empty()) { + method = xmlNewChild(body, ns, + BAD_CAST(function->functionName.c_str()), NULL); + } + } + } else { + style = main?SOAP_RPC:SOAP_DOCUMENT; + use = main?SOAP_ENCODED:SOAP_LITERAL; + if (style == SOAP_RPC) { + ns = encode_add_ns(body, uri); + method = xmlNewChild(body, ns, BAD_CAST(function_name), NULL); + } + } + + if (function) { + param_count = function->responseParameters.size(); + } else { + param_count = 1; + } + + if (param_count == 1) { + parameter = get_param(function, NULL, 0, true); + + if (style == SOAP_RPC) { + xmlNode *rpc_result; + if (main && version == SOAP_1_2) { + xmlNs *rpc_ns = xmlNewNs(body, BAD_CAST(RPC_SOAP12_NAMESPACE), + BAD_CAST(RPC_SOAP12_NS_PREFIX)); + rpc_result = xmlNewChild(method, rpc_ns, BAD_CAST("result"), NULL); + param = serialize_parameter(parameter, ret, 0, "return", use, method); + xmlNodeSetContent(rpc_result,param->name); + } else { + param = serialize_parameter(parameter, ret, 0, "return", use, method); + } + } else { + param = serialize_parameter(parameter, ret, 0, "return", use, body); + if (function && function->binding->bindingType == BINDING_SOAP) { + if (parameter && parameter->element) { + ns = encode_add_ns(param, parameter->element->namens.c_str()); + xmlNodeSetName(param, BAD_CAST(parameter->element->name.c_str())); + xmlSetNs(param, ns); + } + } else if (strcmp((char*)param->name,"return") == 0) { + ns = encode_add_ns(param, uri); + xmlNodeSetName(param, BAD_CAST(function_name)); + xmlSetNs(param, ns); + } + } + } else if (param_count > 1 && ret.isArray()) { + Array arr = ret.toArray(); + int i = 0; + for (ArrayIter iter(arr); iter; ++iter, ++i) { + Variant data = iter.second(); + Variant key = iter.first(); + String param_name; + int64 param_index = i; + if (key.isString()) { + param_name = key.toString(); + } else { + param_index = key.toInt64(); + } + + parameter = get_param(function, param_name, param_index, true); + if (style == SOAP_RPC) { + param = serialize_parameter(parameter, data, i, param_name.data(), + use, method); + } else { + param = serialize_parameter(parameter, data, i, param_name.data(), + use, body); + if (function && function->binding->bindingType == BINDING_SOAP) { + if (parameter && parameter->element) { + ns = encode_add_ns(param, parameter->element->namens.c_str()); + xmlNodeSetName(param, BAD_CAST(parameter->element->name.c_str())); + xmlSetNs(param, ns); + } + } + } + } + } + if (use == SOAP_ENCODED && version == SOAP_1_2 && method) { + xmlSetNsProp(method, body->ns, BAD_CAST("encodingStyle"), + BAD_CAST(SOAP_1_2_ENC_NAMESPACE)); + } + return use; +} + +static xmlDocPtr serialize_response_call(sdlFunctionPtr function, + const char *function_name, + const char *uri, Variant &ret, + CArrRef headers, int version) { + xmlNodePtr envelope = NULL, body, param; + xmlNsPtr ns = NULL; + int use = SOAP_LITERAL; + xmlNodePtr head = NULL; + + encode_reset_ns(); + + xmlDocPtr doc = xmlNewDoc(BAD_CAST("1.0")); + doc->charset = XML_CHAR_ENCODING_UTF8; + doc->encoding = xmlCharStrdup("UTF-8"); + + if (version == SOAP_1_1) { + envelope = xmlNewDocNode(doc, NULL, BAD_CAST("Envelope"), NULL); + ns = xmlNewNs(envelope, BAD_CAST(SOAP_1_1_ENV_NAMESPACE), + BAD_CAST(SOAP_1_1_ENV_NS_PREFIX)); + xmlSetNs(envelope,ns); + } else if (version == SOAP_1_2) { + envelope = xmlNewDocNode(doc, NULL, BAD_CAST("Envelope"), NULL); + ns = xmlNewNs(envelope, BAD_CAST(SOAP_1_2_ENV_NAMESPACE), + BAD_CAST(SOAP_1_2_ENV_NS_PREFIX)); + xmlSetNs(envelope,ns); + } else { + throw_soap_server_fault("Server", "Unknown SOAP version"); + } + xmlDocSetRootElement(doc, envelope); + + if (ret.isObject() && ret.toObject().is()) { + c_soapfault *obj = ret.toObject().getTyped(); + + char *detail_name; + sdlFaultPtr fault; + string fault_ns; + + if (!headers.empty()) { + xmlNodePtr head; + encodePtr hdr_enc; + int hdr_use = SOAP_LITERAL; + Variant &hdr_ret = obj->m_headerfault; + soapHeader *h = headers[0].toObject().getTyped(); + const char *hdr_ns = h->hdr ? h->hdr->ns.c_str() : NULL; + const char *hdr_name = h->function_name.data(); + + head = xmlNewChild(envelope, ns, BAD_CAST("Header"), NULL); + if (hdr_ret.isObject() && hdr_ret.toObject().is()) { + c_soapheader *ht = hdr_ret.toObject().getTyped(); + + string key; + if (!ht->m_namespace.empty()) { + key += ht->m_namespace.data(); + key += ':'; + hdr_ns = ht->m_namespace.data(); + } + if (!ht->m_name.empty()) { + key += ht->m_name.data(); + hdr_name = ht->m_name.data(); + } + if (h->hdr) { + sdlSoapBindingFunctionHeaderMap::iterator iter = + h->hdr->headerfaults.find(key); + if (iter != h->hdr->headerfaults.end()) { + sdlSoapBindingFunctionHeaderPtr hdr = iter->second; + hdr_enc = hdr->encode; + hdr_use = hdr->use; + } + } + hdr_ret = ht->m_data; + } + + if (h->function) { + if (serialize_response_call2(head, h->function, + h->function_name.data(), uri, + hdr_ret, version, 0) == SOAP_ENCODED) { + use = SOAP_ENCODED; + } + } else { + xmlNodePtr xmlHdr = master_to_xml(hdr_enc, hdr_ret, hdr_use, head); + if (hdr_name) { + xmlNodeSetName(xmlHdr, BAD_CAST(hdr_name)); + } + if (hdr_ns) { + xmlNsPtr nsptr = encode_add_ns(xmlHdr, hdr_ns); + xmlSetNs(xmlHdr, nsptr); + } + } + } + + body = xmlNewChild(envelope, ns, BAD_CAST("Body"), NULL); + param = xmlNewChild(body, ns, BAD_CAST("Fault"), NULL); + + fault_ns = obj->m_faultcodens.data(); + use = SOAP_LITERAL; + if (!obj->m_name.empty()) { + if (function) { + sdlFaultMap::iterator iter = function->faults.find(obj->m_name.data()); + if (iter != function->faults.end()) { + fault = iter->second; + if (function->binding && + function->binding->bindingType == BINDING_SOAP && + fault->bindingAttributes) { + sdlSoapBindingFunctionFaultPtr fb = fault->bindingAttributes; + use = fb->use; + if (fault_ns.empty()) { + fault_ns = fb->ns; + } + } + } + } + } else if (function && function->faults.size() == 1) { + fault = function->faults[0]; + if (function->binding && + function->binding->bindingType == BINDING_SOAP && + fault->bindingAttributes) { + sdlSoapBindingFunctionFaultPtr fb = fault->bindingAttributes; + use = fb->use; + if (fault_ns.empty()) { + fault_ns = fb->ns; + } + } + } + + if (fault_ns.empty() && fault && fault->details.size() == 1) { + sdlParamPtr sparam = fault->details[0]; + if (sparam->element) { + fault_ns = sparam->element->namens; + } + } + + if (version == SOAP_1_1) { + if (!obj->m_faultcode.empty()) { + xmlNodePtr node = xmlNewNode(NULL, BAD_CAST("faultcode")); + String str = StringUtil::HtmlEncode(obj->m_faultcode, + StringUtil::DoubleQuotes); + xmlAddChild(param, node); + if (!fault_ns.empty()) { + xmlNsPtr nsptr = encode_add_ns(node, fault_ns.c_str()); + xmlChar *code = xmlBuildQName(BAD_CAST(str.data()), nsptr->prefix, + NULL, 0); + xmlNodeSetContent(node, code); + xmlFree(code); + } else { + xmlNodeSetContentLen(node, BAD_CAST(str.data()), str.size()); + } + } + if (!obj->m_faultstring.empty()) { + xmlNodePtr node = master_to_xml(get_conversion(KindOfString), + obj->m_faultstring, SOAP_LITERAL, + param); + xmlNodeSetName(node, BAD_CAST("faultstring")); + } + if (!obj->m_faultactor.empty()) { + xmlNodePtr node = master_to_xml(get_conversion(KindOfString), + obj->m_faultactor, SOAP_LITERAL, + param); + xmlNodeSetName(node, BAD_CAST("faultactor")); + } + detail_name = "detail"; + } else { + if (!obj->m_faultcode.empty()) { + xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Code"), NULL); + String str = StringUtil::HtmlEncode(obj->m_faultcode, + StringUtil::DoubleQuotes); + node = xmlNewChild(node, ns, BAD_CAST("Value"), NULL); + if (!fault_ns.empty()) { + xmlNsPtr nsptr = encode_add_ns(node, fault_ns.c_str()); + xmlChar *code = xmlBuildQName(BAD_CAST(str.data()), nsptr->prefix, + NULL, 0); + xmlNodeSetContent(node, code); + xmlFree(code); + } else { + xmlNodeSetContentLen(node, BAD_CAST(str.data()), str.size()); + } + } + if (!obj->m_faultstring.empty()) { + xmlNodePtr node = xmlNewChild(param, ns, BAD_CAST("Reason"), NULL); + node = master_to_xml(get_conversion(KindOfString), obj->m_faultstring, + SOAP_LITERAL, node); + xmlNodeSetName(node, BAD_CAST("Text")); + xmlSetNs(node, ns); + } + detail_name = SOAP_1_2_ENV_NS_PREFIX":Detail"; + } + if (fault && fault->details.size() == 1) { + xmlNodePtr node; + Variant detail; + sdlParamPtr sparam; + xmlNodePtr x; + + if (!obj->m_detail.isNull()) { + detail = obj->m_detail; + } + node = xmlNewNode(NULL, BAD_CAST(detail_name)); + xmlAddChild(param, node); + + sparam = fault->details[0]; + + if (detail.isObject() && sparam->element) { + Variant prop = detail.toObject()->o_get(sparam->element->name.c_str(), + -1); + if (!prop.isNull()) { + detail = prop; + } + } + + x = serialize_parameter(sparam, detail, 1, NULL, use, node); + + if (function && + function->binding && + function->binding->bindingType == BINDING_SOAP && + function->bindingAttributes) { + sdlSoapBindingFunctionPtr fnb = function->bindingAttributes; + if (fnb->style == SOAP_RPC && !sparam->element) { + if (fault->bindingAttributes) { + sdlSoapBindingFunctionFaultPtr fb = fault->bindingAttributes; + if (!fb->ns.empty()) { + xmlNsPtr ns = encode_add_ns(x, fb->ns.c_str()); + xmlSetNs(x, ns); + } + } + } else { + if (sparam->element) { + xmlNsPtr ns = encode_add_ns(x, sparam->element->namens.c_str()); + xmlNodeSetName(x, BAD_CAST(sparam->element->name.c_str())); + xmlSetNs(x, ns); + } + } + } + if (use == SOAP_ENCODED && version == SOAP_1_2) { + xmlSetNsProp(x, envelope->ns, BAD_CAST("encodingStyle"), + BAD_CAST(SOAP_1_2_ENC_NAMESPACE)); + } + } else if (!obj->m_detail.isNull()) { + serialize_zval(obj->m_detail, sdlParamPtr(), detail_name, use, param); + } + } else { + + if (!headers.empty()) { + head = xmlNewChild(envelope, ns, BAD_CAST("Header"), NULL); + for (ArrayIter iter(headers); iter; ++iter) { + soapHeader *h = iter.second().toObject().getTyped(); + if (!h->retval.isNull()) { + encodePtr hdr_enc; + int hdr_use = SOAP_LITERAL; + Variant &hdr_ret = h->retval; + const char *hdr_ns = h->hdr ? h->hdr->ns.c_str() : NULL; + const char *hdr_name = h->function_name.data(); + + if (h->retval.isObject() && + h->retval.toObject().is()) { + c_soapheader *ht = h->retval.toObject().getTyped(); + string key; + if (!ht->m_namespace.empty()) { + key += ht->m_namespace.data(); + key += ':'; + hdr_ns = ht->m_namespace.data(); + } + if (!ht->m_name.empty()) { + key += ht->m_name.data(); + hdr_name = ht->m_name.data(); + } + if (function && function->binding && + function->binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = function->bindingAttributes; + sdlSoapBindingFunctionHeaderMap::iterator iter = + fnb->output.headers.find(key); + if (iter != fnb->output.headers.end()) { + hdr_enc = iter->second->encode; + hdr_use = iter->second->use; + } + } + hdr_ret = ht->m_data; + } + + if (h->function) { + if (serialize_response_call2(head, h->function, + h->function_name.data(), uri, hdr_ret, + version, 0) == SOAP_ENCODED) { + use = SOAP_ENCODED; + } + } else { + xmlNodePtr xmlHdr = master_to_xml(hdr_enc, hdr_ret, hdr_use, head); + if (hdr_name) { + xmlNodeSetName(xmlHdr, BAD_CAST(hdr_name)); + } + if (hdr_ns) { + xmlNsPtr nsptr = encode_add_ns(xmlHdr,hdr_ns); + xmlSetNs(xmlHdr, nsptr); + } + } + } + } + + if (head->children == NULL) { + xmlUnlinkNode(head); + xmlFreeNode(head); + } + } + + body = xmlNewChild(envelope, ns, BAD_CAST("Body"), NULL); + + if (serialize_response_call2(body, function.get(), function_name, uri, ret, + version, 1) == SOAP_ENCODED) { + use = SOAP_ENCODED; + } + } + + if (use == SOAP_ENCODED) { + xmlNewNs(envelope, BAD_CAST(XSD_NAMESPACE), BAD_CAST(XSD_NS_PREFIX)); + if (version == SOAP_1_1) { + xmlNewNs(envelope, BAD_CAST(SOAP_1_1_ENC_NAMESPACE), + BAD_CAST(SOAP_1_1_ENC_NS_PREFIX)); + xmlSetNsProp(envelope, envelope->ns, BAD_CAST("encodingStyle"), + BAD_CAST(SOAP_1_1_ENC_NAMESPACE)); + } else if (version == SOAP_1_2) { + xmlNewNs(envelope, BAD_CAST(SOAP_1_2_ENC_NAMESPACE), + BAD_CAST(SOAP_1_2_ENC_NS_PREFIX)); + } + } + + encode_finish(); + + if (function && function->responseName.empty() && + body->children == NULL && head == NULL) { + xmlFreeDoc(doc); + return NULL; + } + return doc; +} + +static void function_to_string(sdlFunctionPtr function, StringBuffer &sb) { + sdlParamPtr param; + sdlParamVec &res = function->responseParameters; + if (!res.empty()) { + if (res.size() == 1) { + param = res[0]; + if (param->encode && !param->encode->details.type_str.empty()) { + sb.append(param->encode->details.type_str); + sb.append(' '); + } else { + sb.append("UNKNOWN "); + } + } else { + sb.append("list("); + bool started = false; + for (unsigned int i = 0; i < res.size(); i++) { + param = res[i]; + if (started) { + sb.append(", "); + } else { + started = true; + } + if (param->encode && !param->encode->details.type_str.empty()) { + sb.append(param->encode->details.type_str); + } else { + sb.append("UNKNOWN"); + } + sb.append(" $"); + sb.append(param->paramName); + } + sb.append(") "); + } + } else { + sb.append("void "); + } + + sb.append(function->functionName); + + sb.append('('); + sdlParamVec &req = function->requestParameters; + bool started = false; + for (unsigned int i = 0; i < req.size(); i++) { + param = req[i]; + if (started) { + sb.append(", "); + } else { + started = true; + } + + if (param->encode && !param->encode->details.type_str.empty()) { + sb.append(param->encode->details.type_str); + } else { + sb.append("UNKNOWN"); + } + sb.append(" $"); + sb.append(param->paramName); + } + sb.append(')'); +} + +static void type_to_string(sdlType *type, StringBuffer &buf, int level) { + StringBuffer sbspaces; + for (int i = 0; i < level;i++) { + sbspaces.append(' '); + } + String spaces = sbspaces.detach(); + buf.append(spaces); + + switch (type->kind) { + case XSD_TYPEKIND_SIMPLE: + if (type->encode) { + buf.append(type->encode->details.type_str); + buf.append(' '); + } else { + buf.append("anyType "); + } + buf.append(type->name); + break; + case XSD_TYPEKIND_LIST: + buf.append("list "); + buf.append(type->name); + if (!type->elements.empty()) { + buf.append(" {"); + buf.append(type->elements[0]->name); + buf.append('}'); + } + break; + case XSD_TYPEKIND_UNION: + buf.append("union "); + buf.append(type->name); + if (!type->elements.empty()) { + bool first = true; + buf.append(" {"); + for (unsigned int i = 0; i < type->elements.size(); i++) { + if (!first) { + buf.append(','); + first = false; + } + buf.append(type->elements[i]->name); + } + buf.append('}'); + } + break; + case XSD_TYPEKIND_COMPLEX: + case XSD_TYPEKIND_RESTRICTION: + case XSD_TYPEKIND_EXTENSION: + if (type->encode && + (type->encode->details.type == KindOfArray || + type->encode->details.type == SOAP_ENC_ARRAY)) { + sdlAttributeMap::iterator iter; + sdlExtraAttributeMap::iterator iterExtra; + if (!type->attributes.empty() && + ((iter = type->attributes.find(SOAP_1_1_ENC_NAMESPACE":arrayType")) + != type->attributes.end())) { + if ((iterExtra = iter->second->extraAttributes.find + (WSDL_NAMESPACE":arrayType")) + != iter->second->extraAttributes.end()) { + sdlExtraAttributePtr ext = iterExtra->second; + char *end = strchr(ext->val.c_str(), '['); + int len; + if (end == NULL) { + len = ext->val.size(); + } else { + len = end- ext->val.c_str(); + } + if (len == 0) { + buf.append("anyType"); + } else { + buf.append(ext->val.c_str(), len); + } + buf.append(' '); + buf.append(type->name); + if (end) { + buf.append(end); + } + } + } else { + sdlTypePtr elementType; + sdlAttributeMap::iterator iter; + sdlExtraAttributeMap::iterator iterExtra; + if (!type->attributes.empty() && + ((iter = type->attributes.find(SOAP_1_2_ENC_NAMESPACE":itemType")) + != type->attributes.end())) { + if ((iterExtra = iter->second->extraAttributes.find + (WSDL_NAMESPACE":itemType")) + != iter->second->extraAttributes.end()) { + sdlExtraAttributePtr ext = iterExtra->second; + buf.append(ext->val); + buf.append(' '); + } + } else if (type->elements.size() == 1 && + (elementType = type->elements[0]) != NULL && + elementType->encode && + !elementType->encode->details.type_str.empty()) { + buf.append(elementType->encode->details.type_str); + buf.append(' '); + } else { + buf.append("anyType "); + } + buf.append(type->name); + if (!type->attributes.empty() && + ((iter = type->attributes.find(SOAP_1_2_ENC_NAMESPACE":arraySize")) + != type->attributes.end())) { + if ((iterExtra = iter->second->extraAttributes.find + (WSDL_NAMESPACE":itemType")) + != iter->second->extraAttributes.end()) { + sdlExtraAttributePtr ext = iterExtra->second; + buf.append('['); + buf.append(ext->val); + buf.append(']'); + } + } else { + buf.append("[]"); + } + } + } else { + buf.append("struct "); + buf.append(type->name); + buf.append(' '); + buf.append("{\n"); + if ((type->kind == XSD_TYPEKIND_RESTRICTION || + type->kind == XSD_TYPEKIND_EXTENSION) && type->encode) { + encodePtr enc = type->encode; + while (enc && enc->details.sdl_type && + enc != enc->details.sdl_type->encode && + enc->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE && + enc->details.sdl_type->kind != XSD_TYPEKIND_LIST && + enc->details.sdl_type->kind != XSD_TYPEKIND_UNION) { + enc = enc->details.sdl_type->encode; + } + if (enc) { + buf.append(spaces); + buf.append(' '); + buf.append(type->encode->details.type_str); + buf.append(" _;\n"); + } + } + if (type->model) { + model_to_string(type->model, buf, level+1); + } + if (!type->attributes.empty()) { + for (sdlAttributeMap::iterator iter = type->attributes.begin(); + iter != type->attributes.end(); ++iter) { + sdlAttributePtr attr = iter->second; + buf.append(spaces); + buf.append(' '); + if (attr->encode && !attr->encode->details.type_str.empty()) { + buf.append(attr->encode->details.type_str); + buf.append(' '); + } else { + buf.append("UNKNOWN "); + } + buf.append(attr->name); + buf.append(";\n"); + } + } + buf.append(spaces); + buf.append('}'); + } + break; + default: + break; + } +} + +static void model_to_string(sdlContentModelPtr model, StringBuffer &buf, + int level) { + int i; + switch (model->kind) { + case XSD_CONTENT_ELEMENT: + type_to_string(model->u_element, buf, level); + buf.append(";\n"); + break; + case XSD_CONTENT_ANY: + for (i = 0;i < level;i++) { + buf.append(' '); + } + buf.append(" any;\n"); + break; + case XSD_CONTENT_SEQUENCE: + case XSD_CONTENT_ALL: + case XSD_CONTENT_CHOICE: { + for (unsigned int i = 0; i < model->u_content.size(); i++) { + sdlContentModelPtr tmp = model->u_content[i]; + model_to_string(tmp, buf, level); + } + break; + } + case XSD_CONTENT_GROUP: + model_to_string(model->u_group->model, buf, level); + default: + break; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// soap fault functions + +static void send_soap_server_fault(sdlFunctionPtr function, Variant fault, + soapHeader *hdr) { + USE_SOAP_GLOBAL; + bool use_http_error_status = true; + SystemGlobals *g = (SystemGlobals*)get_global_variables(); + if (g->gv__SERVER["HTTP_USER_AGENT"].toString() == "Shockwave Flash") { + use_http_error_status = false; + } + if (use_http_error_status) { + f_header("HTTP/1.1 500 Internal Service Error"); + } + output_xml_header(SOAP_GLOBAL(soap_version)); + + Array headers; + if (hdr) headers.append(Object(hdr)); + xmlDocPtr doc_return = serialize_response_call + (function, NULL, NULL, fault, headers, SOAP_GLOBAL(soap_version)); + + f_ob_end_clean(); // dump all buffered output + + xmlChar *buf; int size; + xmlDocDumpMemory(doc_return, &buf, &size); + if (buf) { + echo(String((const char *)buf, size, AttachLiteral)); + xmlFree(buf); + } + xmlFreeDoc(doc_return); +} + +static void send_soap_server_fault(sdlFunctionPtr function, Exception &e, + soapHeader *hdr) { + USE_SOAP_GLOBAL; + if (SOAP_GLOBAL(use_soap_error_handler)) { + send_soap_server_fault + (sdlFunctionPtr(), create_soap_fault(SOAP_GLOBAL(error_code), + String(e.getMessage())), NULL); + } else { + throw; // assuming we are in "catch" + } +} + +static void throw_soap_server_fault(litstr code, litstr fault) { + send_soap_server_fault(sdlFunctionPtr(), create_soap_fault(code, fault), + NULL); + throw ExitException(1); +} + +bool f_use_soap_error_handler(bool handler /* = true */) { + USE_SOAP_GLOBAL; + bool old = SOAP_GLOBAL(use_soap_error_handler); + SOAP_GLOBAL(use_soap_error_handler) = handler; + return old; +} + +bool f_is_soap_fault(CVarRef fault) { + return fault.isObject() && fault.toObject().is(); +} + +/////////////////////////////////////////////////////////////////////////////// +// class SoapServer + +c_soapserver::c_soapserver() : + m_type(SOAP_FUNCTIONS), + m_version(SOAP_1_1), + m_sdl(NULL), + m_encoding(NULL), + m_typemap(NULL), + m_features(0), + m_send_errors(1) { +} + +c_soapserver::~c_soapserver() { +} + +void c_soapserver::t___construct(CVarRef wsdl, + CArrRef options /* = null_array */) { + USE_SOAP_GLOBAL; + SoapServerScope ss(this); + + if (!wsdl.isString() && !wsdl.isNull()) { + throw SoapException("Invalid parameters"); + } + + m_send_errors = 1; + + int64 cache_wsdl = SOAP_GLOBAL(cache); + + int version = SOAP_1_1; + Array typemap_ht; + if (!options.empty()) { + if (options["soap_version"].isInteger()) { + int64 tmp = options["soap_version"].toInt64(); + if (tmp == SOAP_1_1 || tmp == SOAP_1_2) { + version = tmp; + } + } + + if (options["uri"].isString()) { + m_uri = options["uri"].toString(); + } else if (wsdl.isNull()) { + throw SoapException("'uri' option is required in nonWSDL mode"); + } + + if (options["actor"].isString()) { + m_actor = options["actor"].toString(); + } + + if (options["encoding"].isString()) { + String tmp = options["encoding"].toString(); + m_encoding = xmlFindCharEncodingHandler(tmp.data()); + if (m_encoding == NULL) { + throw SoapException("Invalid 'encoding' option - '%s'", tmp.data()); + } + s_soap_data->register_encoding(m_encoding); + } + + if (options["classmap"].isArray()) { + m_classmap = options["classmap"].toArray(); + } + + if (options["typemap"].isArray()) { + typemap_ht = options["typemap"].toArray(); + } + + if (options["features"].isInteger()) { + m_features = options["features"].toInt64(); + } + + if (options["cache_wsdl"].isInteger()) { + cache_wsdl = options["cache_wsdl"].toInt64(); + } + + if (options["send_errors"].isInteger() || + options["send_errors"].is(KindOfBoolean)) { + m_send_errors = options["send_errors"].toInt64(); + } + + } else if (wsdl.isNull()) { + throw SoapException("'uri' option is required in nonWSDL mode"); + } + + m_version = version; + m_type = SOAP_FUNCTIONS; + m_soap_functions.functions_all = false; + + if (!wsdl.isNull()) { + m_sdl = s_soap_data->get_sdl(wsdl.toString().data(), cache_wsdl); + if (m_uri.isNull()) { + if (!m_sdl->target_ns.empty()) { + m_uri = String(m_sdl->target_ns); + } else { + /*FIXME*/ + m_uri = String("http://unknown-uri/"); + } + } + } + + if (!typemap_ht.empty()) { + m_typemap = soap_create_typemap(m_sdl, typemap_ht); + } +} + +void c_soapserver::t_setclass(int _argc, CStrRef name, + CArrRef _argv /* = null_array */) { + SoapServerScope ss(this); + if (f_class_exists(name, true)) { + m_type = SOAP_CLASS; + m_soap_class.name = name; + m_soap_class.argv = _argv; + m_soap_class.persistance = SOAP_PERSISTENCE_REQUEST; + } else { + Logger::Warning("Tried to set a non existant class (%s)", name.data()); + } +} + +void c_soapserver::t_setobject(CObjRef obj) { + SoapServerScope ss(this); + m_type = SOAP_OBJECT; + m_soap_object = obj; +} + +void c_soapserver::t_addfunction(CVarRef func) { + SoapServerScope ss(this); + + Array funcs; + if (func.isString()) { + funcs.append(func); + } else if (func.isArray()) { + funcs = func.toArray(); + } else if (func.isInteger()) { + if (func.toInt64() == SOAP_FUNCTIONS_ALL) { + m_soap_functions.ft.clear(); + m_soap_functions.ftOriginal.clear(); + m_soap_functions.functions_all = true; + } else { + Logger::Warning("Invalid value passed"); + } + return; + } + + if (m_type == SOAP_FUNCTIONS) { + for (ArrayIter iter(funcs); iter; ++iter) { + if (!iter.second().isString()) { + Logger::Warning("Tried to add a function that isn't a string"); + return; + } + String function_name = iter.second().toString(); + if (!f_function_exists(function_name)) { + Logger::Warning("Tried to add a non existant function '%s'", + function_name.data()); + return; + } + m_soap_functions.ft.set(StringUtil::ToLower(function_name), 1); + m_soap_functions.ftOriginal.set(function_name, 1); + } + } +} + +Variant c_soapserver::t_getfunctions() { + SoapServerScope ss(this); + + String class_name; + if (m_type == SOAP_OBJECT) { + class_name = m_soap_object->o_getClassName(); + } else if (m_type == SOAP_CLASS) { + class_name = m_soap_class.name; + } else if (m_soap_functions.functions_all) { + return ClassInfo::GetSystemFunctions() + ClassInfo::GetUserFunctions(); + } else if (!m_soap_functions.ft.empty()) { + return f_array_keys(m_soap_functions.ftOriginal); + } + + ClassInfo::MethodVec methods; + ClassInfo::GetClassMethods(methods, class_name.data()); + Array ret = Array::Create(); + for (unsigned int i = 0; i < methods.size(); i++) { + ClassInfo::MethodInfo *info = methods[i]; + if (info->attribute & ClassInfo::IsPublic) { + ret.append(info->name); + } + } + return ret; +} + +static bool valid_function(c_soapserver *server, Object &soap_obj, + CStrRef fn_name) { + String class_name; + if (server->m_type == SOAP_OBJECT || server->m_type == SOAP_CLASS) { + class_name = server->m_soap_object->o_getClassName(); + } else if (server->m_soap_functions.functions_all) { + return f_function_exists(fn_name); + } else if (!server->m_soap_functions.ft.empty()) { + return server->m_soap_functions.ft.exists(StringUtil::ToLower(fn_name)); + } + + const ClassInfo *clsInfo = ClassInfo::FindClass(class_name.data()); + if (clsInfo) { + ClassInfo::MethodInfo *info = clsInfo->getMethodInfo(fn_name.data()); + if (info && (info->attribute & ClassInfo::IsPublic)) { + return true; + } + } + return false; +} + +void c_soapserver::t_handle(CStrRef request /* = null_string */) { + USE_SOAP_GLOBAL; + SoapServerScope ss(this); + + SOAP_GLOBAL(soap_version) = m_version; + + // 0. serving WSDL + Transport *transport = g_context->getTransport(); + if (transport && transport->getMethod() == Transport::GET && + transport->getCommand() == "wsdl") { + if (!m_sdl) { + throw_soap_server_fault("Server", "WSDL generation is not supported"); + } + + f_header("Content-Type: text/xml; charset=utf-8"); + Variant ret = f_readfile(m_sdl->source.c_str()); + if (same(ret, false)) { + throw_soap_server_fault("Server", "Couldn't find WSDL"); + } + return; + } + + if (!f_ob_start()) { + throw SoapException("ob_start failed"); + } + + // 1. process request + String req; + if (!request.isNull()) { + req = request; + } else { + int size; + const char *data = NULL; + if (transport) { + data = (const char *)transport->getPostData(size); + } + if (!data || !*data || !size) { + return; + } + req = String(data, size, AttachLiteral); + + SystemGlobals *g = (SystemGlobals*)get_global_variables(); + if (g->gv__SERVER.toArray().exists("HTTP_CONTENT_ENCODING")) { + String encoding = g->gv__SERVER["HTTP_CONTENT_ENCODING"]; + Variant ret; + if (encoding == "gzip" || encoding == "x-gzip") { + ret = f_gzinflate(String(data, size, AttachLiteral)); + } else if (encoding == "deflate") { + ret = f_gzuncompress(String(data, size, AttachLiteral)); + } else { + Logger::Warning("Request is encoded with unknown compression '%s'", + encoding.data()); + return; + } + if (!ret.isString()) { + Logger::Warning("Can't uncompress compressed request"); + return; + } + req = ret.toString(); + } + } + xmlDocPtr doc_request = soap_xmlParseMemory(req.data(), req.size()); + if (doc_request == NULL) { + throw_soap_server_fault("Client", "Bad Request"); + } + if (xmlGetIntSubset(doc_request) != NULL) { + xmlNodePtr env = get_node(doc_request->children,"Envelope"); + if (env && env->ns) { + if (strcmp((char*)env->ns->href, SOAP_1_1_ENV_NAMESPACE) == 0) { + SOAP_GLOBAL(soap_version) = SOAP_1_1; + } else if (strcmp((char*)env->ns->href,SOAP_1_2_ENV_NAMESPACE) == 0) { + SOAP_GLOBAL(soap_version) = SOAP_1_2; + } + } + xmlFreeDoc(doc_request); + throw_soap_server_fault("Server", "DTD are not supported by SOAP"); + } + + // 2. find out which PHP function to call with what params + SoapServiceScope sss(this); + String function_name; + Array params; + int soap_version = 0; + sdlFunctionPtr function; + try { + function = deserialize_function_call + (m_sdl, doc_request, m_actor, function_name, params, soap_version, + m_soap_headers); + } catch (Exception &e) { + send_soap_server_fault(function, e, NULL); + xmlFreeDoc(doc_request); + return; + } + xmlFreeDoc(doc_request); + + // 3. we may need an object + Object soap_obj; + if (m_type == SOAP_OBJECT) { + soap_obj = m_soap_object; + } else if (m_type == SOAP_CLASS) { + try { + soap_obj = create_object(m_soap_class.name.data(), + m_soap_class.argv); + } catch (Exception &e) { + send_soap_server_fault(function, e, NULL); + return; + } + } + + // 4. process soap headers + for (ArrayIter iter(m_soap_headers); iter; ++iter) { + soapHeader *h = iter.second().toObject().getTyped(); + if (m_sdl && !h->function && !h->hdr) { + if (h->mustUnderstand) { + throw_soap_server_fault("MustUnderstand","Header not understood"); + } + continue; + } + + String fn_name = h->function_name; + if (valid_function(this, soap_obj, fn_name)) { + try { + if (m_type == SOAP_CLASS || m_type == SOAP_OBJECT) { + h->retval = f_call_user_func_array + (CREATE_VECTOR2(soap_obj, fn_name), h->parameters); + } else { + h->retval = f_call_user_func_array(fn_name, h->parameters); + } + } catch (Exception &e) { + send_soap_server_fault(function, e, h); + return; + } + if (h->retval.isObject() && h->retval.toObject().is()) { + send_soap_server_fault(function, h->retval, h); + return; + } + } else if (h->mustUnderstand) { + throw_soap_server_fault("MustUnderstand","Header not understood"); + } + } + + // 5. main call + String fn_name = function_name; + Variant retval; + if (valid_function(this, soap_obj, fn_name)) { + try { + if (m_type == SOAP_CLASS || m_type == SOAP_OBJECT) { + retval = f_call_user_func_array + (CREATE_VECTOR2(soap_obj, fn_name), params); + } else { + retval = f_call_user_func_array(fn_name, params); + } + } catch (Exception &e) { + send_soap_server_fault(function, e, NULL); + return; + } + if (retval.isObject() && retval.toObject().is()) { + send_soap_server_fault(function, retval, NULL); + return; + } + } else { + throw SoapException("Function '%s' doesn't exist", fn_name.data()); + } + + // 6. serialize response + String response_name; + if (function && !function->responseName.empty()) { + response_name = function->responseName; + } else { + response_name = function_name + "Response"; + } + xmlDocPtr doc_return = NULL; + try { + doc_return = serialize_response_call(function, response_name.data(), + m_uri.c_str(), retval, m_soap_headers, + soap_version); + } catch (Exception &e) { + send_soap_server_fault(function, e, NULL); + return; + } + + // 7. throw away all buffered output so far, so we can send back a clean + // soap resposne + f_ob_end_clean(); + + // 8. special case + if (doc_return == NULL) { + f_header("HTTP/1.1 202 Accepted"); + f_header("Content-Length: 0"); + return; + } + + // 9. XML response + xmlChar *buf; int size; + xmlDocDumpMemory(doc_return, &buf, &size); + xmlFreeDoc(doc_return); + if (buf == NULL || size == 0) { + if (buf) xmlFree(buf); + throw SoapException("Dump memory failed"); + } + output_xml_header(soap_version); + if (buf) { + echo(String((char*)buf, size, AttachLiteral)); + xmlFree(buf); + } +} + +void c_soapserver::t_setpersistence(int64 mode) { + SoapServerScope ss(this); + if (m_type == SOAP_CLASS) { + if (mode == SOAP_PERSISTENCE_SESSION || mode == SOAP_PERSISTENCE_REQUEST) { + m_soap_class.persistance = mode; + } else { + Logger::Warning("Tried to set persistence with bogus value (%ld)", mode); + } + } else { + Logger::Warning("Tried to set persistence when you are using you " + "SOAP SERVER in function mode, no persistence needed"); + } +} + +void c_soapserver::t_fault(CVarRef code, CStrRef fault, + CStrRef actor /* = null_string */, + CVarRef detail /* = null */, + CStrRef name /* = null_string */) { + SoapServerScope ss(this); + Object obj((NEW(c_soapfault)())->create(code, fault, actor, detail, name)); + send_soap_server_fault(sdlFunctionPtr(), obj, NULL); +} + +void c_soapserver::t_addsoapheader(CObjRef fault) { + SoapServerScope ss(this); + soapHeader *p = NEW(soapHeader)(); + Object obj(p); + p->function = NULL; + p->mustUnderstand = false; + p->retval = fault; + p->hdr = NULL; + m_soap_headers.append(obj); +} + +Variant c_soapserver::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +// class SoapClient + +c_soapclient::c_soapclient() : + m_soap_version(SOAP_1_1), + m_sdl(NULL), + m_encoding(NULL), + m_typemap(NULL), + m_features(0), + m_style(SOAP_RPC), + m_use(SOAP_LITERAL), + m_authentication(SOAP_AUTHENTICATION_BASIC), + m_proxy_port(0), + m_connection_timeout(0), + m_max_redirect(0), + m_use11(true), + m_compression(false), + m_exceptions(true), + m_trace(false) { +} + +c_soapclient::~c_soapclient() { +} + +void c_soapclient::t___construct(CVarRef wsdl, + CArrRef options /* = null_array */) { + USE_SOAP_GLOBAL; + SoapClientScope ss(this); + + if (!wsdl.isString() && !wsdl.isNull()) { + throw SoapException("wsdl must be string or null"); + } + + int64 cache_wsdl = SOAP_GLOBAL(cache); + if (!options.empty()) { + m_location = options["location"]; + + if (wsdl.isNull()) { + /* Fetching non-WSDL mode options */ + m_uri = options["uri"]; + m_style = options["style"].toInt32(); // SOAP_RPC || SOAP_DOCUMENT + m_use = options["use" ].toInt32(); // SOAP_LITERAL || SOAP_ENCODED + + if (m_uri.empty()) { + throw SoapException("'uri' option is required in nonWSDL mode"); + } + if (m_location.empty()) { + throw SoapException("'location' option is required in nonWSDL mode"); + } + } + + if (options.exists("soap_version")) { + m_soap_version = options["soap_version"].toInt32(); + } + + m_login = options["login"].toString(); + m_password = options["password"].toString(); + m_authentication = options["authentication"].toInt32(); + + m_proxy_host = options["proxy_host"].toString(); + m_proxy_port = options["proxy_port"].toInt32(); + m_proxy_login = options["proxy_login"].toString(); + m_proxy_password = options["proxy_password"].toString(); + + m_trace = options["trace"].toBoolean(); + if (options.exists("exceptions")) { + m_exceptions = options["exceptions"].toBoolean(); + } + if (options.exists("compression")) { + m_compression = options["compression"].toBoolean(); + } + + String encoding = options["encoding"].toString(); + if (!encoding.empty()) { + m_encoding = xmlFindCharEncodingHandler(encoding.data()); + if (m_encoding == NULL) { + throw SoapException("Invalid 'encoding' option - '%s'", + encoding.data()); + } + s_soap_data->register_encoding(m_encoding); + } + m_classmap = options["classmap"].toArray(); + m_features = options["features"].toInt32(); + m_connection_timeout = options["connection_timeout"].toInt64(); + m_user_agent = options["user_agent"].toString(); + + if (options.exists("cache_wsdl")) { + cache_wsdl = options["cache_wsdl"].toInt64(); + } + + } else if (wsdl.isNull()) { + throw SoapException("'location' and 'uri' options are required in " + "nonWSDL mode"); + } + + if (!wsdl.isNull()) { + int old_soap_version = SOAP_GLOBAL(soap_version); + SOAP_GLOBAL(soap_version) = m_soap_version; + m_sdl = s_soap_data->get_sdl(wsdl.toString().data(), cache_wsdl); + SOAP_GLOBAL(soap_version) = old_soap_version; + } + + Variant v = options["typemap"]; + if (v.isArray()) { + Array arr = v.toArray(); + if (!arr.empty()) { + m_typemap = soap_create_typemap(m_sdl, arr); + } + } +} + +Variant c_soapclient::t___call(Variant name, Variant args) { + return t___soapcall(name, args); +} + +Variant c_soapclient::t___soapcall(String name, Array args, + Array options /* = null_array */, + Variant input_headers /* = null */, + Variant output_headers /*= null */) { + SoapClientScope ss(this); + + String location, soap_action, uri; + if (!options.isNull()) { + if (options["location"].isString()) { + location = options["location"].toString(); + if (location.isNull()) { + location = m_location; + } + } + if (options["soapaction"].isString()) { + soap_action = options["soapaction"].toString(); + } + if (options["uri"].isString()) { + uri = options["uri"].toString(); + } + } + + Array soap_headers; + if (input_headers.isNull()) { + } else if (input_headers.isArray()) { + Array arr = input_headers.toArray(); + verify_soap_headers_array(arr); + soap_headers = input_headers; + } else if (input_headers.isObject() && + input_headers.toObject().is()) { + soap_headers = CREATE_VECTOR1(input_headers); + } else{ + Logger::Warning("Invalid SOAP header"); + return null; + } + if (!m_default_headers.isNull()) { + soap_headers.merge(m_default_headers); + } + + output_headers = Array::Create(); + + if (m_trace) { + m_last_request.reset(); + m_last_response.reset(); + } + + if (location.empty()) { + location = m_location; + } + + m_soap_fault.reset(); + + SoapServiceScope sss(this); + Variant return_value; + bool ret = false; + xmlDocPtr request = NULL; + if (m_sdl) { + sdlFunctionPtr fn = get_function(m_sdl, name.data()); + if (fn) { + sdlBindingPtr binding = fn->binding; + bool one_way = false; + if (fn->responseName.empty() && fn->responseParameters.empty() && + soap_headers.empty()) { + one_way = true; + } + if (location.empty()) { + location = binding->location; + } + + Variant response; + try { + if (binding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr fnb = fn->bindingAttributes; + request = serialize_function_call + (this, fn, NULL, fnb->input.ns.c_str(), args, soap_headers); + ret = do_request(this, request, location.data(), + fnb->soapAction.c_str(), m_soap_version, one_way, + response); + } else { + request = serialize_function_call + (this, fn, NULL, m_sdl->target_ns.c_str(), args, soap_headers); + ret = do_request(this, request, location.data(), NULL, + m_soap_version, one_way, response); + } + } catch (Exception &e) { + xmlFreeDoc(request); + throw; + } + xmlFreeDoc(request); + + if (ret && response.isString()) { + encode_reset_ns(); + String sresponse = response.toString(); + ret = parse_packet_soap(this, sresponse.data(), sresponse.size(), + fn, NULL, return_value, output_headers); + encode_finish(); + } + } else { + StringBuffer error; + error.append("Function (\""); + error.append(name.data()); + error.append("\") is not a valid method for this service"); + m_soap_fault = create_soap_fault("Client", error.detach()); + } + } else { + string action; + if (m_uri.empty()) { + m_soap_fault = + create_soap_fault("Client", "Error finding \"uri\" property"); + } else if (location.empty()) { + m_soap_fault = + create_soap_fault("Client", "Error could not find \"location\" " + "property"); + } else { + request = serialize_function_call + (this, sdlFunctionPtr(), name.data(), m_uri.data(), args, + soap_headers); + if (soap_action == NULL) { + action += m_uri.data(); + action += '#'; + action += name.data(); + } else { + action += soap_action; + } + Variant response; + try { + ret = do_request(this, request, location, action.c_str(), + m_soap_version, 0, response); + } catch (Exception &e) { + xmlFreeDoc(request); + throw; + } + xmlFreeDoc(request); + if (ret && response.isString()) { + encode_reset_ns(); + String sresponse = response.toString(); + ret = parse_packet_soap(this, sresponse.data(), sresponse.size(), + sdlFunctionPtr(), name.data(), return_value, + output_headers); + encode_finish(); + } + } + } + + if (!ret && m_soap_fault.isNull()) { + m_soap_fault = create_soap_fault("Client", "Unknown Error"); + } + if (!m_soap_fault.isNull()) { + return m_soap_fault; + } + return return_value; +} + +Variant c_soapclient::t___getlastrequest() { + return m_last_request; +} + +Variant c_soapclient::t___getlastresponse() { + return m_last_response; +} + +Variant c_soapclient::t___getlastrequestheaders() { + return m_last_request_headers; +} + +Variant c_soapclient::t___getlastresponseheaders() { + return m_last_response_headers; +} + +Variant c_soapclient::t___getfunctions() { + SoapClientScope ss(this); + + if (m_sdl) { + Array ret = Array::Create(); + for (sdlFunctionMap::iterator iter = m_sdl->functions.begin(); + iter != m_sdl->functions.end(); ++iter) { + StringBuffer sb; + function_to_string(iter->second, sb); + ret.append(sb.detach()); + } + return ret; + } + return null; +} + +Variant c_soapclient::t___gettypes() { + SoapClientScope ss(this); + + if (m_sdl) { + Array ret = Array::Create(); + for (unsigned int i = 0; i < m_sdl->types.size(); i++) { + StringBuffer sb; + type_to_string(m_sdl->types[i].get(), sb, 0); + ret.append(sb.detach()); + } + return ret; + } + return null; +} + +Variant c_soapclient::t___dorequest(String buf, String location, String action, + int64 version, bool oneway /* = false */) { + if (location.empty()) { + m_soap_fault = + Object((NEW(c_soapfault)())->create("HTTP", "Unable to parse URL")); + return null; + } + + USE_SOAP_GLOBAL; + SoapClientScope ss(this); + + HeaderMap headers; + + // compression + if (m_compression > 0) { + if (m_compression & SOAP_COMPRESSION_ACCEPT) { + headers["Accept-Encoding"].push_back("gzip, deflate"); + } + int level = m_compression & 0x0f; + if (level > 9) level = 9; + if (level > 0) { + Variant ret; + if (m_compression & SOAP_COMPRESSION_DEFLATE) { + ret = f_gzcompress(buf, level); + headers["Content-Encoding"].push_back("deflate"); + } else { + ret = f_gzencode(buf, level); + headers["Content-Encoding"].push_back("gzip"); + } + if (!ret.isString()) return null; + buf = ret.toString(); + } + } + + // prepare more headers + if (!m_user_agent.empty()) { + headers["User-Agent"].push_back(m_user_agent.data()); + } + string contentType; + if (version == SOAP_1_2) { + contentType = "application/soap+xml; charset=utf-8"; + if (!action.empty()) { + contentType += "; action=\""; + contentType += action.data(); + contentType += "\""; + } + headers["Content-Type"].push_back(contentType); + } else { + contentType = "text/xml; charset=utf-8"; + headers["Content-Type"].push_back(contentType); + if (!action.empty()) { + headers["SOAPAction"].push_back(string("\"") + action.data() + "\""); + } + } + + // post the request + HttpClient http(m_connection_timeout, m_max_redirect, m_use11, true); + if (!m_proxy_host.empty() && m_proxy_port) { + http.proxy(m_proxy_host.data(), m_proxy_port, m_proxy_login.data(), + m_proxy_password.data()); + } + if (!m_login.empty()) { + http.auth(m_login.data(), m_password.data(), !m_digest); + } + StringBuffer response; + int code = http.post(location.data(), buf.data(), buf.size(), response, + &headers); + if (code == 0) { + m_soap_fault = + Object((NEW(c_soapfault)())->create + ("HTTP", "Failed Sending HTTP SOAP request")); + return null; + } + if (code != 200) { + m_soap_fault = + Object((NEW(c_soapfault)())->create + ("HTTP", HttpProtocol::GetReasonString(code))); + return null; + } + + // return response + if (SOAP_GLOBAL(features) & SOAP_WAIT_ONE_WAY_CALLS) { + oneway = false; + } + if (oneway) { + return ""; + } + return response.detach(); +} + +Variant c_soapclient::t___setcookie(String name, + String value /* = null_string */) { + if (!value.isNull()) { + m_cookies.set(name, CREATE_VECTOR1(value)); + } else if (o_exists("_cookies", -1)) { + m_cookies.remove(name); + } + return null; +} + +Variant c_soapclient::t___setlocation(String new_location /* = null_string */){ + Variant ret = m_location; + m_location = new_location; + return ret; +} + +bool c_soapclient::t___setsoapheaders(Variant headers /* = null */) { + if (headers.isNull()) { + m_default_headers = null; + } else if (headers.isArray()) { + Array arr = headers.toArray(); + verify_soap_headers_array(arr); + m_default_headers = arr; + } else if (headers.isObject() && headers.toObject().is()) { + m_default_headers = CREATE_VECTOR1(headers); + } else { + Logger::Warning("Invalid SOAP header"); + } + return true; +} + +Variant c_soapclient::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +// class SoapVar + +c_soapvar::c_soapvar() { +} + +c_soapvar::~c_soapvar() { +} + +void c_soapvar::t___construct(CVarRef data, CVarRef type, + CStrRef type_name /* = null_string */, + CStrRef type_namespace /* = null_string */, + CStrRef node_name /* = null_string */, + CStrRef node_namespace /* = null_string */) { + USE_SOAP_GLOBAL; + if (type.isNull()) { + m_type = UNKNOWN_TYPE; + } else { + map &defEncIndex = SOAP_GLOBAL(defEncIndex); + int64 ntype = type.toInt64(); + if (defEncIndex.find(ntype) != defEncIndex.end()) { + m_type = ntype; + } else { + Logger::Warning("Invalid type ID"); + return; + } + } + + if (data) m_value = data; + if (!type_name.empty()) m_stype = type_name; + if (!type_namespace.empty()) m_ns = type_namespace; + if (!node_name.empty()) m_name = node_name; + if (!node_namespace.empty()) m_namens = node_namespace; +} + +Variant c_soapvar::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +// class SoapFault + +c_soapfault::c_soapfault() { +} + +c_soapfault::~c_soapfault() { +} + +void c_soapfault::t___construct(CVarRef code, CStrRef message, + CStrRef actor /* = null_string */, + CVarRef detail /* = null */, + CStrRef name /* = null_string */, + CVarRef header /* = null */) { + USE_SOAP_GLOBAL; + Variant fault_ns, fault_code; + if (code.isString()) { + fault_code = code; + } else if (code.isArray() && code.toArray().size() == 2) { + ArrayIter iter(code.toArray()); + fault_ns = iter.second(); + ++iter; + fault_code = iter.second(); + if (!fault_ns.isString() || !fault_code.isString()) { + Logger::Warning("Invalid fault code"); + return; + } + } else { + Logger::Warning("Invalid fault code"); + return; + } + m_faultcodens = fault_ns.toString(); + m_faultcode = fault_code.toString(); + if (m_faultcode.empty()) { + Logger::Warning("Invalid fault code"); + return; + } + + m_faultstring = c_exception::m_message = message; + m_faultactor = actor; + m_detail = detail; + m_name = name; + m_headerfault = header; + + int soap_version = SOAP_GLOBAL(soap_version); + if (m_faultcodens.empty()) { + if (soap_version == SOAP_1_1) { + if (m_faultcode == "Client" || + m_faultcode == "Server" || + m_faultcode == "VersionMismatch" || + m_faultcode == "MustUnderstand") { + m_faultcodens = SOAP_1_1_ENV_NAMESPACE; + } + } else if (soap_version == SOAP_1_2) { + if (m_faultcode == "Client") { + m_faultcode = "Sender"; + m_faultcodens = SOAP_1_2_ENV_NAMESPACE; + } else if (m_faultcode == "Server") { + m_faultcode = "Receiver"; + m_faultcodens = SOAP_1_2_ENV_NAMESPACE; + } else if (m_faultcode == "VersionMismatch" || + m_faultcode == "MustUnderstand" || + m_faultcode == "DataEncodingUnknown") { + m_faultcodens = SOAP_1_2_ENV_NAMESPACE; + } + } + } +} + +String c_soapfault::t___tostring() { + StringBuffer sb; + sb.printf("SoapFault exception: [%s] %s", m_faultcode.data(), + m_faultstring.data()); + return sb.detach(); +} + +Variant c_soapfault::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +// class SoapParam + +c_soapparam::c_soapparam() { +} + +c_soapparam::~c_soapparam() { +} + +void c_soapparam::t___construct(CVarRef data, CStrRef name) { + if (name.empty()) { + Logger::Warning("Invalid parameter name"); + return; + } + m_name = name; + m_data = data; +} + +Variant c_soapparam::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +// class SoapHeader + +c_soapheader::c_soapheader() { +} + +c_soapheader::~c_soapheader() { +} + +void c_soapheader::t___construct(CStrRef ns, CStrRef name, + CVarRef data /* = null */, + bool mustunderstand /* = false */, + CVarRef actor /* = null */) { + if (ns.empty()) { + Logger::Warning("Invalid namespace"); + return; + } + if (name.empty()) { + Logger::Warning("Invalid header name"); + return; + } + + m_namespace = ns; + m_name = name; + m_data = data; + m_mustUnderstand = mustunderstand; + + if (actor.isInteger() && + (actor.toInt64() == SOAP_ACTOR_NEXT || + actor.toInt64() == SOAP_ACTOR_NONE || + actor.toInt64() == SOAP_ACTOR_UNLIMATERECEIVER)) { + m_actor = actor.toInt64(); + } else if (actor.isString() && !actor.toString().empty()) { + m_actor = actor.toString(); + } else if (!actor.isNull()) { + Logger::Warning("Invalid actor"); + } +} + +Variant c_soapheader::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_soap.h b/src/cpp/ext/ext_soap.h new file mode 100644 index 0000000000000..6b27acdf8d80a --- /dev/null +++ b/src/cpp/ext/ext_soap.h @@ -0,0 +1,260 @@ + +#ifndef __EXT_SOAP_H__ +#define __EXT_SOAP_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< +#include +#include + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool f_use_soap_error_handler(bool handler = true); +bool f_is_soap_fault(CVarRef fault); + +/////////////////////////////////////////////////////////////////////////////// +// class SoapServer + +FORWARD_DECLARE_CLASS(soapserver); +class c_soapserver : public ObjectData { + public: + BEGIN_CLASS_MAP(soapserver) + END_CLASS_MAP(soapserver) + DECLARE_CLASS(soapserver, SoapServer, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_soapserver(); + public: ~c_soapserver(); + public: void t___construct(CVarRef wsdl, CArrRef options = null_array); + public: void t_setclass(int _argc, CStrRef name, CArrRef _argv = null_array); + public: void t_setobject(CObjRef obj); + public: void t_addfunction(CVarRef func); + public: Variant t_getfunctions(); + public: void t_handle(CStrRef request = null_string); + public: void t_setpersistence(int64 mode); + public: void t_fault(CVarRef code, CStrRef fault, CStrRef actor = null_string, CVarRef detail = null, CStrRef name = null_string); + public: void t_addsoapheader(CObjRef fault); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant wsdl, Array options = null_array); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: int m_type; + public: soapFunctions m_soap_functions; + public: soapClass m_soap_class; + public: Object m_soap_object; + public: String m_actor; + public: String m_uri; + public: int m_version; + public: sdl *m_sdl; + public: xmlCharEncodingHandlerPtr m_encoding; + public: Array m_classmap; + public: encodeMap *m_typemap; + public: int m_features; + public: Array m_soap_headers; + public: int m_send_errors; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class SoapClient + +FORWARD_DECLARE_CLASS(soapclient); +class c_soapclient : public ObjectData { + public: + BEGIN_CLASS_MAP(soapclient) + END_CLASS_MAP(soapclient) + DECLARE_CLASS(soapclient, SoapClient, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_soapclient(); + public: ~c_soapclient(); + public: void t___construct(CVarRef wsdl, CArrRef options = null_array); + public: Variant t___call(Variant name, Variant args); + public: Variant doCall(Variant v_name, Variant v_arguments, bool fatal); + public: Variant t___soapcall(String name, Array args, Array options = null_array, Variant input_headers = null, Variant output_headers = null); + public: Variant t___getlastrequest(); + public: Variant t___getlastresponse(); + public: Variant t___getlastrequestheaders(); + public: Variant t___getlastresponseheaders(); + public: Variant t___getfunctions(); + public: Variant t___gettypes(); + public: Variant t___dorequest(String buf, String location, String action, int64 version, bool oneway = false); + public: Variant t___setcookie(String name, String value = null_string); + public: Variant t___setlocation(String new_location = null_string); + public: bool t___setsoapheaders(Variant headers = null); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant wsdl, Array options = null_array); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: int m_soap_version; + public: sdl *m_sdl; + public: xmlCharEncodingHandlerPtr m_encoding; + public: encodeMap *m_typemap; + public: Array m_classmap; + public: int m_features; + public: String m_uri; + public: String m_location; + public: int m_style; + public: int m_use; + public: String m_login; + public: String m_password; + public: int m_authentication; + public: bool m_digest; + public: String m_proxy_host; + public: int m_proxy_port; + public: String m_proxy_login; + public: String m_proxy_password; + public: int m_connection_timeout; + public: int m_max_redirect; + public: bool m_use11; + public: String m_user_agent; + public: bool m_compression; + public: Variant m_default_headers; + public: Variant m_cookies; + public: bool m_exceptions; + public: Variant m_soap_fault; + public: bool m_trace; + public: Variant m_last_request; + public: Variant m_last_response; + public: Variant m_last_request_headers; + public: Variant m_last_response_headers; + +}; + +/////////////////////////////////////////////////////////////////////////////// +// class SoapVar + +FORWARD_DECLARE_CLASS(soapvar); +class c_soapvar : public ObjectData { + public: + BEGIN_CLASS_MAP(soapvar) + END_CLASS_MAP(soapvar) + DECLARE_CLASS(soapvar, SoapVar, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_soapvar(); + public: ~c_soapvar(); + public: void t___construct(CVarRef data, CVarRef type, CStrRef type_name = null_string, CStrRef type_namespace = null_string, CStrRef node_name = null_string, CStrRef node_namespace = null_string); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant data, Variant type, String type_name = null_string, String type_namespace = null_string, String node_name = null_string, String node_namespace = null_string); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: Variant m_value; + public: int64 m_type; + public: String m_stype; + public: String m_ns; + public: String m_name; + public: String m_namens; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class SoapFault + +FORWARD_DECLARE_CLASS(soapfault); +class c_soapfault: public c_exception { + public: + BEGIN_CLASS_MAP(soapfault) + PARENT_CLASS(exception) + END_CLASS_MAP(soapfault) + DECLARE_CLASS(soapfault, SoapFault, exception) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_soapfault(); + public: ~c_soapfault(); + public: void t___construct(CVarRef code, CStrRef message, CStrRef actor = null_string, CVarRef detail = null, CStrRef name = null_string, CVarRef header = null); + public: String t___tostring(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant code, String message, String actor = null_string, Variant detail = null, String name = null_string, Variant header = null); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: String m_faultstring; + public: String m_faultcode; + public: String m_faultcodens; + public: String m_faultactor; + public: Variant m_detail; + public: String m_name; + public: Variant m_headerfault; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class SoapParam + +FORWARD_DECLARE_CLASS(soapparam); +class c_soapparam : public ObjectData { + public: + BEGIN_CLASS_MAP(soapparam) + END_CLASS_MAP(soapparam) + DECLARE_CLASS(soapparam, SoapParam, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_soapparam(); + public: ~c_soapparam(); + public: void t___construct(CVarRef data, CStrRef name); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Variant data, String name); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: String m_name; + public: String m_data; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class SoapHeader + +FORWARD_DECLARE_CLASS(soapheader); +class c_soapheader : public ObjectData { + public: + BEGIN_CLASS_MAP(soapheader) + END_CLASS_MAP(soapheader) + DECLARE_CLASS(soapheader, SoapHeader, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_soapheader(); + public: ~c_soapheader(); + public: void t___construct(CStrRef ns, CStrRef name, CVarRef data = null, bool mustunderstand = false, CVarRef actor = null); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(String ns, String name, Variant data = null, bool mustunderstand = false, Variant actor = null); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: String m_namespace; + public: String m_name; + public: Variant m_data; + public: bool m_mustUnderstand; + public: Variant m_actor; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_SOAP_H__ diff --git a/src/cpp/ext/ext_socket.cpp b/src/cpp/ext/ext_socket.cpp new file mode 100644 index 0000000000000..5910952017f9e --- /dev/null +++ b/src/cpp/ext/ext_socket.cpp @@ -0,0 +1,1085 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SOCKET_ERROR(sock, msg, errn) \ + sock->setError(errn); \ + Logger::Warning("%s [%d]: %s", msg, errn, \ + Util::safe_strerror(errn).c_str()) \ + +#define PHP_NORMAL_READ 0x0001 +#define PHP_BINARY_READ 0x0002 + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helpers + +static void check_socket_parameters(int &domain, int &type) { + if (domain != AF_UNIX && domain != AF_INET6 && domain != AF_INET) { + Logger::Warning("invalid socket domain [%ld] specified for argument 1, " + "assuming AF_INET", domain); + domain = AF_INET; + } + + if (type > 10) { + Logger::Warning("invalid socket type [%ld] specified for argument 2, " + "assuming SOCK_STREAM", type); + type = SOCK_STREAM; + } +} + +static bool get_sockaddr(sockaddr *sa, Variant &address, Variant &port) { + switch (sa->sa_family) { + case AF_INET6: + { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; + char addr6[INET6_ADDRSTRLEN+1]; + inet_ntop(AF_INET6, &sin6->sin6_addr, addr6, INET6_ADDRSTRLEN); + address = String(addr6, CopyString); + port = htons(sin6->sin6_port); + } + return true; + case AF_INET: + { + struct sockaddr_in *sin = (struct sockaddr_in *)sa; + address = String(Util::safe_inet_ntoa(sin->sin_addr)); + port = htons(sin->sin_port); + } + return true; + case AF_UNIX: + { + struct sockaddr_un *s_un = (struct sockaddr_un *)sa; + address = String(s_un->sun_path, CopyString); + } + return true; + + default: + break; + } + + Logger::Warning("Unsupported address family %d", sa->sa_family); + return false; +} + +static bool php_set_inet6_addr(struct sockaddr_in6 *sin6, const char *address, + Socket *sock) { + struct in6_addr tmp; + struct addrinfo hints; + struct addrinfo *addrinfo = NULL; + + if (inet_pton(AF_INET6, address, &tmp)) { + memcpy(&(sin6->sin6_addr.s6_addr), &(tmp.s6_addr), + sizeof(struct in6_addr)); + } else { + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = PF_INET6; + getaddrinfo(address, NULL, &hints, &addrinfo); + if (!addrinfo) { + SOCKET_ERROR(sock, "Host lookup failed", (-10000 - h_errno)); + return false; + } + if (addrinfo->ai_family != PF_INET6 || + addrinfo->ai_addrlen != sizeof(struct sockaddr_in6)) { + Logger::Warning("Host lookup failed: Non AF_INET6 domain " + "returned on AF_INET6 socket"); + freeaddrinfo(addrinfo); + return false; + } + + memcpy(&(sin6->sin6_addr.s6_addr), + ((struct sockaddr_in6*)(addrinfo->ai_addr))->sin6_addr.s6_addr, + sizeof(struct in6_addr)); + freeaddrinfo(addrinfo); + } + + return true; +} + +static bool php_set_inet_addr(struct sockaddr_in *sin, const char *address, + Socket *sock) { + struct in_addr tmp; + + if (inet_aton(address, &tmp)) { + sin->sin_addr.s_addr = tmp.s_addr; + } else { + Util::HostEnt result; + if (!Util::safe_gethostbyname(address, result)) { + /* Note: < -10000 indicates a host lookup error */ + SOCKET_ERROR(sock, "Host lookup failed", (-10000 - result.herr)); + return false; + } + if (result.hostbuf.h_addrtype != AF_INET) { + Logger::Warning("Host lookup failed: Non AF_INET domain " + "returned on AF_INET socket"); + return false; + } + memcpy(&(sin->sin_addr.s_addr), result.hostbuf.h_addr_list[0], + result.hostbuf.h_length); + } + + return true; +} + +static bool set_sockaddr(sockaddr_storage &sa_storage, Socket *sock, + const char *addr, int port, + struct sockaddr *&sa_ptr, size_t &sa_size) { + struct sockaddr *sock_type = (struct sockaddr*) &sa_storage; + switch (sock->getType()) { + case AF_UNIX: + { + struct sockaddr_un *sa = (struct sockaddr_un *)sock_type; + memset(sa, 0, sizeof(sa_storage)); + sa->sun_family = AF_UNIX; + snprintf(sa->sun_path, 108, "%s", addr); + sa_ptr = (struct sockaddr *)sa; + sa_size = SUN_LEN(sa); + } + break; + case AF_INET: + { + struct sockaddr_in *sa = (struct sockaddr_in *)sock_type; + memset(sa, 0, sizeof(sa_storage)); /* Apparently, Mac OSX needs this */ + sa->sin_family = AF_INET; + sa->sin_port = htons((unsigned short) port); + if (!php_set_inet_addr(sa, addr, sock)) { + return false; + } + sa_ptr = (struct sockaddr *)sa; + sa_size = sizeof(struct sockaddr_in); + } + break; + case AF_INET6: + { + struct sockaddr_in6 *sa = (struct sockaddr_in6 *)sock_type; + memset(sa, 0, sizeof(sa_storage)); /* Apparently, Mac OSX needs this */ + sa->sin6_family = AF_INET6; + sa->sin6_port = htons((unsigned short) port); + if (!php_set_inet6_addr(sa, addr, sock)) { + return false; + } + sa_ptr = (struct sockaddr *)sa; + sa_size = sizeof(struct sockaddr_in6); + } + break; + default: + Logger::Warning("unsupported socket type '%d', must be " + "AF_UNIX, AF_INET, or AF_INET6", sock->getType()); + return false; + } + return true; +} + +static void sock_array_to_fd_set(CArrRef sockets, pollfd *fds, int &nfds, + short flag) { + ASSERT(fds); + for (ArrayIter iter(sockets); iter; ++iter) { + File *sock = iter.second().toObject().getTyped(); + pollfd &fd = fds[nfds++]; + fd.fd = sock->fd(); + fd.events = flag; + fd.revents = 0; + } +} + +static void sock_array_from_fd_set(Variant &sockets, pollfd *fds, int &nfds, + short flag) { + ASSERT(sockets.is(KindOfArray)); + Array sock_array = sockets.toArray(); + Array ret; + for (ArrayIter iter(sock_array); iter; ++iter) { + pollfd &fd = fds[nfds++]; + ASSERT(fd.fd == iter.second().toObject().getTyped()->fd()); + if (fd.revents & flag) { + ret.append(iter.second()); + } + } + sockets = ret; +} + +static int php_read(Socket *sock, void *buf, int maxlen, int flags) { + int m = fcntl(sock->fd(), F_GETFL); + if (m < 0) { + return m; + } + int nonblock = (m & O_NONBLOCK); + m = 0; + + char *t = (char *)buf; + *t = '\0'; + int n = 0; + int no_read = 0; + while (*t != '\n' && *t != '\r' && n < maxlen) { + if (m > 0) { + t++; + n++; + } else if (m == 0) { + no_read++; + if (nonblock && no_read >= 2) { + return n; + /* The first pass, m always is 0, so no_read becomes 1 + * in the first pass. no_read becomes 2 in the second pass, + * and if this is nonblocking, we should return.. */ + } + + if (no_read > 200) { + errno = ECONNRESET; + return -1; + } + } + + if (n < maxlen) { + m = recv(sock->fd(), (void *)t, 1, flags); + } + + if (errno != 0 && errno != ESPIPE && errno != EAGAIN) { + return -1; + } + errno = 0; + } + + if (n < maxlen) { + n++; + /* The only reasons it makes it to here is + * if '\n' or '\r' are encountered. So, increase + * the return by 1 to make up for the lack of the + * '\n' or '\r' in the count (since read() takes + * place at the end of the loop..) */ + } + + return n; +} + +static bool create_new_socket(const char *&name, int port, Variant &errnum, + Variant &errstr, Object &ret, Socket *&sock) { + int domain = AF_INET; + int type = SOCK_STREAM; + if (strncmp(name, "udp://", 6) == 0 || strncmp(name, "udg://", 6) == 0) { + type = SOCK_DGRAM; + name += 6; + } else if (strncmp(name, "tcp://", 6) == 0) { + name += 6; + } else if (strncmp(name, "unix://", 7) == 0) { + domain = AF_UNIX; + name += 7; + } + + sock = new Socket(socket(domain, type, 0), domain); + ret = Object(sock); + if (!sock->valid()) { + SOCKET_ERROR(sock, "unable to create socket", errno); + errnum = sock->getError(); + errstr = String(Util::safe_strerror(sock->getError())); + return false; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_socket_create(int domain, int type, int protocol) { + check_socket_parameters(domain, type); + + Socket *sock = new Socket(socket(domain, type, protocol), domain); + Object ret(sock); + if (!sock->valid()) { + Logger::Warning("Unable to create socket [%d]: %s", errno, + Util::safe_strerror(errno).c_str()); + return false; + } + + return ret; +} + +Variant f_socket_create_listen(int port, int backlog /* = 128 */) { + Util::HostEnt result; + if (!Util::safe_gethostbyname("0.0.0.0", result)) { + return false; + } + + struct sockaddr_in la; + memcpy((char *) &la.sin_addr, result.hostbuf.h_addr, + result.hostbuf.h_length); + la.sin_family = result.hostbuf.h_addrtype; + la.sin_port = htons((unsigned short)port); + + Socket *sock = new Socket(socket(PF_INET, SOCK_STREAM, 0), PF_INET); + Object ret(sock); + if (!sock->valid()) { + SOCKET_ERROR(sock, "unable to create listening socket", errno); + return false; + } + + if (bind(sock->fd(), (struct sockaddr *)&la, sizeof(la)) < 0) { + SOCKET_ERROR(sock, "unable to bind to given adress", errno); + return false; + } + + if (listen(sock->fd(), backlog) < 0) { + SOCKET_ERROR(sock, "unable to listen on socket", errno); + return false; + } + + return ret; +} + +bool f_socket_create_pair(int domain, int type, int protocol, Variant fd) { + check_socket_parameters(domain, type); + + int fds_array[2]; + if (socketpair(domain, type, protocol, fds_array) != 0) { + Logger::Warning("unable to create socket pair [%d]: %s", errno, + Util::safe_strerror(errno).c_str()); + return false; + } + + Array ret; + ret.set(0, Object(new Socket(fds_array[0], domain))); + ret.set(1, Object(new Socket(fds_array[1], domain))); + fd = ret; + return true; +} + +Variant f_socket_get_option(CObjRef socket, int level, int optname) { + Socket *sock = socket.getTyped(); + Array ret; + socklen_t optlen; + + switch (optname) { + case SO_LINGER: + { + struct linger linger_val; + optlen = sizeof(linger_val); + if (getsockopt(sock->fd(), level, optname, (char*)&linger_val, + &optlen) != 0) { + SOCKET_ERROR(sock, "unable to retrieve socket option", errno); + return false; + } + + ret.set("l_onoff", linger_val.l_onoff); + ret.set("l_linger", linger_val.l_linger); + } + break; + + case SO_RCVTIMEO: + case SO_SNDTIMEO: + { + struct timeval tv; + optlen = sizeof(tv); + if (getsockopt(sock->fd(), level, optname, (char*)&tv, &optlen) != 0) { + SOCKET_ERROR(sock, "unable to retrieve socket option", errno); + return false; + } + ret.set("sec", (int)tv.tv_sec); + ret.set("usec", (int)tv.tv_usec); + } + break; + + default: + { + int other_val; + optlen = sizeof(other_val); + if (getsockopt(sock->fd(), level, optname, (char*)&other_val, &optlen)) { + SOCKET_ERROR(sock, "unable to retrieve socket option", errno); + return false; + } + return other_val; + } + } + return ret; +} + +bool f_socket_getpeername(CObjRef socket, Variant address, + Variant port /* = null */) { + Socket *sock = socket.getTyped(); + + sockaddr_storage sa_storage; + socklen_t salen = sizeof(sockaddr_storage); + struct sockaddr *sa = (struct sockaddr *)&sa_storage; + if (getpeername(sock->fd(), sa, &salen) < 0) { + SOCKET_ERROR(sock, "unable to retrieve peer name", errno); + return false; + } + return get_sockaddr(sa, address, port); +} + +bool f_socket_getsockname(CObjRef socket, Variant address, + Variant port /* = null */) { + Socket *sock = socket.getTyped(); + + sockaddr_storage sa_storage; + socklen_t salen = sizeof(sockaddr_storage); + struct sockaddr *sa = (struct sockaddr *)&sa_storage; + if (getsockname(sock->fd(), sa, &salen) < 0) { + SOCKET_ERROR(sock, "unable to retrieve peer name", errno); + return false; + } + return get_sockaddr(sa, address, port); +} + +bool f_socket_set_block(CObjRef socket) { + Socket *sock = socket.getTyped(); + int flags = fcntl(sock->fd(), F_GETFL, 0); + flags &= ~O_NONBLOCK; + if (fcntl(sock->fd(), F_SETFL, flags) != -1) { + return true; + } + return false; +} + +bool f_socket_set_nonblock(CObjRef socket) { + Socket *sock = socket.getTyped(); + int flags = fcntl(sock->fd(), F_GETFL, 0); + flags |= O_NONBLOCK; + if (fcntl(sock->fd(), F_SETFL, flags) != -1) { + return true; + } + return false; +} + +bool f_socket_set_option(CObjRef socket, int level, int optname, + CVarRef optval) { + Socket *sock = socket.getTyped(); + + struct linger lv; + struct timeval tv; + int ov; + int optlen; + void *opt_ptr; + + switch (optname) { + case SO_LINGER: + { + Array value = optval.toArray(); + if (!value.exists("l_onoff")) { + Logger::Warning("no key \"l_onoff\" passed in optval"); + return false; + } + if (!value.exists("l_linger")) { + Logger::Warning("no key \"l_linger\" passed in optval"); + return false; + } + + lv.l_onoff = (unsigned short)value["l_onoff"].toInt32(); + lv.l_linger = (unsigned short)value["l_linger"].toInt32(); + optlen = sizeof(lv); + opt_ptr = &lv; + } + break; + + case SO_RCVTIMEO: + case SO_SNDTIMEO: + { + Array value = optval.toArray(); + if (!value.exists("sec")) { + Logger::Warning("no key \"sec\" passed in optval"); + return false; + } + if (!value.exists("usec")) { + Logger::Warning("no key \"usec\" passed in optval"); + return false; + } + + tv.tv_sec = value["sec"].toInt32(); + tv.tv_usec = value["usec"].toInt32(); + if (tv.tv_usec >= 1000000) { + tv.tv_sec += tv.tv_usec / 1000000; + tv.tv_usec %= 1000000; + } + optlen = sizeof(tv); + opt_ptr = &tv; + sock->setTimeout(tv); + } + break; + + default: + ov = optval.toInt32(); + optlen = sizeof(ov); + opt_ptr = &ov; + break; + } + + if (setsockopt(sock->fd(), level, optname, opt_ptr, optlen) != 0) { + SOCKET_ERROR(sock, "unable to set socket option", errno); + return false; + } + return true; +} + +bool f_socket_connect(CObjRef socket, CStrRef address, int port /* = 0 */) { + Socket *sock = socket.getTyped(); + + switch (sock->getType()) { + case AF_INET6: + case AF_INET: + if (port == 0) { + Logger::Warning("Socket of type AF_INET/6 requires 3 arguments"); + return false; + } + break; + default: + break; + } + + const char *addr = address.data(); + sockaddr_storage sa_storage; + struct sockaddr *sa_ptr; + size_t sa_size; + if (!set_sockaddr(sa_storage, sock, addr, port, sa_ptr, sa_size)) { + return false; + } + + int retval = connect(sock->fd(), sa_ptr, sa_size); + if (retval != 0) { + std::string msg = "unable to connect to "; + msg += addr; + msg += ":"; + msg += boost::lexical_cast(port); + SOCKET_ERROR(sock, msg.c_str(), errno); + return false; + } + + return true; +} + +bool f_socket_bind(CObjRef socket, CStrRef address, int port /* = 0 */) { + Socket *sock = socket.getTyped(); + + const char *addr = address.data(); + sockaddr_storage sa_storage; + struct sockaddr *sa_ptr; + size_t sa_size; + if (!set_sockaddr(sa_storage, sock, addr, port, sa_ptr, sa_size)) { + return false; + } + + long retval = bind(sock->fd(), sa_ptr, sa_size); + if (retval != 0) { + std::string msg = "unable to bind address"; + msg += addr; + msg += ":"; + msg += boost::lexical_cast(port); + SOCKET_ERROR(sock, msg.c_str(), errno); + return false; + } + + return true; +} + +bool f_socket_listen(CObjRef socket, int backlog /* = 0 */) { + Socket *sock = socket.getTyped(); + if (listen(sock->fd(), backlog) != 0) { + SOCKET_ERROR(sock, "unable to listen on socket", errno); + return false; + } + return true; +} + +Variant f_socket_select(Variant read, Variant write, Variant except, + CVarRef vtv_sec, int tv_usec /* = 0 */) { + int count = 0; + if (!read.isNull()) { + count += read.toArray().size(); + } + if (!write.isNull()) { + count += write.toArray().size(); + } + if (!except.isNull()) { + count += except.toArray().size(); + } + if (!count) { + return false; + } + + struct pollfd *fds = (struct pollfd *)calloc(count, sizeof(struct pollfd)); + count = 0; + if (!read.isNull()) { + sock_array_to_fd_set(read.toArray(), fds, count, POLLIN); + } + if (!write.isNull()) { + sock_array_to_fd_set(write.toArray(), fds, count, POLLOUT); + } + if (!except.isNull()) { + sock_array_to_fd_set(except.toArray(), fds, count, POLLPRI); + } + + int timeout_ms = vtv_sec.toInt32() * 1000 + tv_usec / 1000; + int retval = poll(fds, count, timeout_ms); + if (retval == -1) { + Logger::Warning("unable to select [%d]: %s", errno, + Util::safe_strerror(errno).c_str()); + free(fds); + return false; + } + + count = 0; + if (!read.isNull()) sock_array_from_fd_set(read, fds, count, POLLIN); + if (!write.isNull()) sock_array_from_fd_set(write, fds, count, POLLOUT); + if (!except.isNull()) sock_array_from_fd_set(except, fds, count, POLLPRI); + + free(fds); + return retval; +} + +Variant f_socket_server(CStrRef hostname, int port /* = -1 */, + Variant errnum /* = null */, + Variant errstr /* = null */) { + Object ret; + Socket *sock = NULL; + const char *name = hostname.data(); + if (!create_new_socket(name, port, errnum, errstr, ret, sock)) { + return false; + } + ASSERT(ret.get() && sock); + + sockaddr_storage sa_storage; + struct sockaddr *sa_ptr; + size_t sa_size; + if (!set_sockaddr(sa_storage, sock, name, port, sa_ptr, sa_size)) { + return false; + } + if (bind(sock->fd(), sa_ptr, sa_size) < 0) { + SOCKET_ERROR(sock, "unable to bind to given adress", errno); + return false; + } + if (listen(sock->fd(), 128) < 0) { + SOCKET_ERROR(sock, "unable to listen on socket", errno); + return false; + } + + return ret; +} + +Variant f_socket_accept(CObjRef socket) { + Socket *sock = socket.getTyped(); + struct sockaddr sa; + socklen_t salen = sizeof(sa); + Socket *new_sock = new Socket(accept(sock->fd(), &sa, &salen), + sock->getType()); + if (!new_sock->valid()) { + SOCKET_ERROR(new_sock, "unable to accept incoming connection", errno); + delete new_sock; + return false; + } + return Object(new_sock); +} + +Variant f_socket_read(CObjRef socket, int length, int type /* = 0 */) { + if (length <= 0) { + return false; + } + Socket *sock = socket.getTyped(); + + char *tmpbuf = (char *)malloc(length + 1); + int retval; + if (type == PHP_NORMAL_READ) { + retval = php_read(sock, tmpbuf, length, 0); + } else { + retval = recv(sock->fd(), tmpbuf, length, 0); + } + + if (retval == -1) { + /* if the socket is in non-blocking mode and there's no data to read, + don't output any error, as this is a normal situation, and not an error */ + if (errno == EAGAIN || errno == EWOULDBLOCK) { + sock->setError(errno); + } else { + SOCKET_ERROR(sock, "unable to read from socket", errno); + } + + free(tmpbuf); + return false; + } + + tmpbuf[retval] = '\0' ; + return String(tmpbuf, retval, AttachString); +} + +Variant f_socket_write(CObjRef socket, CStrRef buffer, int length /* = 0 */) { + Socket *sock = socket.getTyped(); + if (length == 0 || length > buffer.size()) { + length = buffer.size(); + } + int retval = write(sock->fd(), buffer.data(), length); + if (retval < 0) { + SOCKET_ERROR(sock, "unable to write to socket", errno); + return false; + } + return retval; +} + +Variant f_socket_send(CObjRef socket, CStrRef buf, int len, int flags) { + Socket *sock = socket.getTyped(); + if (len > buf.size()) { + len = buf.size(); + } + int retval = send(sock->fd(), buf.data(), len, flags); + if (retval == -1) { + SOCKET_ERROR(sock, "unable to write to socket", errno); + return false; + } + return retval; +} + +Variant f_socket_sendto(CObjRef socket, CStrRef buf, int len, int flags, + CStrRef addr, int port /* = 0 */) { + Socket *sock = socket.getTyped(); + if (len > buf.size()) { + len = buf.size(); + } + int retval; + switch (sock->getType()) { + case AF_UNIX: + { + struct sockaddr_un s_un; + memset(&s_un, 0, sizeof(s_un)); + s_un.sun_family = AF_UNIX; + snprintf(s_un.sun_path, 108, "%s", addr.data()); + + retval = sendto(sock->fd(), buf, len, flags, + (struct sockaddr *)&s_un, SUN_LEN(&s_un)); + } + break; + case AF_INET: + { + struct sockaddr_in sin; + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons((unsigned short) port); + if (!php_set_inet_addr(&sin, addr, sock)) { + return false; + } + + retval = sendto(sock->fd(), buf, len, flags, + (struct sockaddr *)&sin, sizeof(sin)); + } + break; + case AF_INET6: + { + struct sockaddr_in6 sin6; + memset(&sin6, 0, sizeof(sin6)); + sin6.sin6_family = AF_INET6; + sin6.sin6_port = htons((unsigned short) port); + + if (!php_set_inet6_addr(&sin6, addr, sock)) { + return false; + } + + retval = sendto(sock->fd(), buf, len, flags, + (struct sockaddr *)&sin6, sizeof(sin6)); + } + break; + default: + Logger::Warning("Unsupported socket type %d", sock->getType()); + return false; + } + + if (retval == -1) { + SOCKET_ERROR(sock, "unable to write to socket", errno); + return false; + } + + return retval; +} + +Variant f_socket_recv(CObjRef socket, Variant buf, int len, int flags) { + if (len <= 0) { + return false; + } + Socket *sock = socket.getTyped(); + + char *recv_buf = (char *)malloc(len + 1); + int retval; + if ((retval = recv(sock->fd(), recv_buf, len, flags)) < 1) { + free(recv_buf); + buf = null; + } else { + recv_buf[retval] = '\0'; + buf = String(recv_buf, retval, AttachString); + } + + if (retval == -1) { + SOCKET_ERROR(sock, "unable to read from socket", errno); + return false; + } + return retval; +} + +Variant f_socket_recvfrom(CObjRef socket, Variant buf, int len, int flags, + Variant name, Variant port /* = 0 */) { + if (len <= 0) { + return false; + } + + Socket *sock = socket.getTyped(); + + char *recv_buf = (char *)malloc(len + 2); + socklen_t slen; + int retval; + + switch (sock->getType()) { + case AF_UNIX: + { + struct sockaddr_un s_un; + slen = sizeof(s_un); + memset(&s_un, 0, slen); + s_un.sun_family = AF_UNIX; + retval = recvfrom(sock->fd(), recv_buf, len, flags, + (struct sockaddr *)&s_un, (socklen_t *)&slen); + if (retval < 0) { + free(recv_buf); + SOCKET_ERROR(sock, "unable to recvfrom", errno); + return false; + } + + recv_buf[retval] = 0; + buf = String(recv_buf, retval, AttachString); + name = String(s_un.sun_path, CopyString); + } + break; + case AF_INET: + { + struct sockaddr_in sin; + slen = sizeof(sin); + memset(&sin, 0, slen); + sin.sin_family = AF_INET; + + retval = recvfrom(sock->fd(), recv_buf, len, flags, + (struct sockaddr *)&sin, (socklen_t *)&slen); + if (retval < 0) { + free(recv_buf); + SOCKET_ERROR(sock, "unable to recvfrom", errno); + return false; + } + recv_buf[retval] = 0; + buf = String(recv_buf, retval, AttachString); + + name = String(Util::safe_inet_ntoa(sin.sin_addr)); + if (name.toString().empty()) { + name = "0.0.0.0"; + } + port = ntohs(sin.sin_port); + } + break; + case AF_INET6: + { + struct sockaddr_in6 sin6; + slen = sizeof(sin6); + memset(&sin6, 0, slen); + sin6.sin6_family = AF_INET6; + + retval = recvfrom(sock->fd(), recv_buf, len, flags, + (struct sockaddr *)&sin6, (socklen_t *)&slen); + if (retval < 0) { + free(recv_buf); + SOCKET_ERROR(sock, "unable to recvfrom", errno); + return false; + } + + char addr6[INET6_ADDRSTRLEN]; + const char* succ = + inet_ntop(AF_INET6, &sin6.sin6_addr, addr6, INET6_ADDRSTRLEN); + + recv_buf[retval] = 0; + buf = String(recv_buf, retval, AttachString); + if (succ) { + name = String(addr6, CopyString); + } else { + name = "::"; + } + port = ntohs(sin6.sin6_port); + } + break; + default: + Logger::Warning("Unsupported socket type %d", sock->getType()); + return false; + } + + return retval; +} + +bool f_socket_shutdown(CObjRef socket, int how /* = 0 */) { + Socket *sock = socket.getTyped(); + if (shutdown(sock->fd(), how) != 0) { + SOCKET_ERROR(sock, "unable to shutdown socket", errno); + return false; + } + return true; +} + +void f_socket_close(CObjRef socket) { + Socket *sock = socket.getTyped(); + sock->close(); +} + +String f_socket_strerror(int errnum) { + return String(Util::safe_strerror(errnum)); +} + +int f_socket_last_error(CObjRef socket /* = null_object */) { + if (!socket.isNull()) { + Socket *sock = socket.getTyped(); + return sock->getError(); + } + return errno; +} + +void f_socket_clear_error(CObjRef socket /* = null_object */) { + if (!socket.isNull()) { + Socket *sock = socket.getTyped(); + sock->setError(0); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// fsock: treating sockets as "file" + +static Variant sockopen_impl(CStrRef hostname, int port, Variant &errnum, + Variant &errstr, double timeout, + bool persistent) { + string key; + if (persistent) { + key = hostname.data(); + key += ":"; + key += boost::lexical_cast(port); + Socket *sock = + dynamic_cast(g_persistentObjects->get("socket", key.c_str())); + if (sock) { + if (sock->getError() == 0) { + return Object(sock); + } + + // socket had an error earlier, we need to remove it from persistent + // storage, and create a new one + g_persistentObjects->remove("socket", key.c_str()); + } + } + + Object ret; + Socket *sock = NULL; + const char *name = hostname.data(); + if (!create_new_socket(name, port, errnum, errstr, ret, sock)) { + return false; + } + ASSERT(ret.get() && sock); + + sockaddr_storage sa_storage; + struct sockaddr *sa_ptr; + size_t sa_size; + if (!set_sockaddr(sa_storage, sock, name, port, sa_ptr, sa_size)) { + return false; + } + + int retval; + int fd = sock->fd(); + if (timeout <= 0) { + retval = connect(fd, sa_ptr, sa_size); + } else { + // set non-blocking so we can do timeouts + long arg = fcntl(fd, F_GETFL, NULL); + fcntl(fd, F_SETFL, arg | O_NONBLOCK); + + retval = connect(fd, sa_ptr, sa_size); + if (retval < 0) { + if (errno == EINPROGRESS) { + struct pollfd fds[1]; + fds[0].fd = fd; + fds[0].events = POLLOUT; + if (poll(fds, 1, (int)(timeout * 1000))) { + socklen_t lon = sizeof(int); + int valopt; + getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon); + if (valopt) { + std::string msg = "failed to connect to "; + msg += name; + msg += ":"; + msg += boost::lexical_cast(port); + SOCKET_ERROR(sock, msg.c_str(), valopt); + errnum = sock->getError(); + errstr = String(Util::safe_strerror(sock->getError())); + return false; + } else { + retval = 0; // success + } + } else { + std::string msg = "timed out after "; + msg += boost::lexical_cast(timeout); + msg += " seconds when connecting to "; + msg += name; + msg += ":"; + msg += boost::lexical_cast(port); + SOCKET_ERROR(sock, msg.c_str(), EAGAIN); + errnum = sock->getError(); + errstr = String(Util::safe_strerror(sock->getError())); + return false; + } + } + } + + // set to blocking mode + arg = fcntl(fd, F_GETFL, NULL); + fcntl(fd, F_SETFL, arg & ~O_NONBLOCK); + } + + if (retval != 0) { + errnum = sock->getError(); + errstr = String(Util::safe_strerror(sock->getError())); + return false; + } + + if (persistent) { + ASSERT(!key.empty()); + g_persistentObjects->set("socket", key.c_str(), sock); + } + + return ret; +} + +Variant f_fsockopen(CStrRef hostname, int port /* = -1 */, + Variant errnum /* = null */, Variant errstr /* = null */, + double timeout /* = 0.0 */) { + return sockopen_impl(hostname, port, errnum, errstr, timeout, false); +} + +Variant f_pfsockopen(CStrRef hostname, int port /* = -1 */, + Variant errnum /* = null */, Variant errstr /* = null */, + double timeout /* = 0.0 */) { + // TODO: persistent socket handling + return sockopen_impl(hostname, port, errnum, errstr, timeout, true); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_socket.h b/src/cpp/ext/ext_socket.h new file mode 100644 index 0000000000000..c6f8bb6d558cf --- /dev/null +++ b/src/cpp/ext/ext_socket.h @@ -0,0 +1,63 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_SOCKET_H__ +#define __EXT_SOCKET_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_socket_create(int domain, int type, int protocol); +Variant f_socket_create_listen(int port, int backlog = 128); +bool f_socket_create_pair(int domain, int type, int protocol, Variant fd); +Variant f_socket_get_option(CObjRef socket, int level, int optname); +bool f_socket_getpeername(CObjRef socket, Variant address, + Variant port = null); +bool f_socket_getsockname(CObjRef socket, Variant address, + Variant port = null); +bool f_socket_set_block(CObjRef socket); +bool f_socket_set_nonblock(CObjRef socket); +bool f_socket_set_option(CObjRef socket, int level, int optname, + CVarRef optval); +bool f_socket_connect(CObjRef socket, CStrRef address, int port = 0); +bool f_socket_bind(CObjRef socket, CStrRef address, int port = 0); +bool f_socket_listen(CObjRef socket, int backlog = 0); +Variant f_socket_select(Variant read, Variant write, Variant except, + CVarRef vtv_sec, int tv_usec = 0); +Variant f_socket_server(CStrRef hostname, int port = -1, Variant errnum = null, + Variant errstr = null); +Variant f_socket_accept(CObjRef socket); +Variant f_socket_read(CObjRef socket, int length, int type = 0); +Variant f_socket_write(CObjRef socket, CStrRef buffer, int length = 0); +Variant f_socket_send(CObjRef socket, CStrRef buf, int len, int flags); +Variant f_socket_sendto(CObjRef socket, CStrRef buf, int len, int flags, + CStrRef addr, int port = 0); +Variant f_socket_recv(CObjRef socket, Variant buf, int len, int flags); +Variant f_socket_recvfrom(CObjRef socket, Variant buf, int len, int flags, + Variant name, Variant port = 0); +bool f_socket_shutdown(CObjRef socket, int how = 0); +void f_socket_close(CObjRef socket); +String f_socket_strerror(int errnum); +int f_socket_last_error(CObjRef socket = null_object); +void f_socket_clear_error(CObjRef socket = null_object); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_SOCKET_H__ diff --git a/src/cpp/ext/ext_sqlite3.cpp b/src/cpp/ext/ext_sqlite3.cpp new file mode 100644 index 0000000000000..7eb5e63a56fed --- /dev/null +++ b/src/cpp/ext/ext_sqlite3.cpp @@ -0,0 +1,664 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#define PHP_SQLITE3_ASSOC 1<<0 +#define PHP_SQLITE3_NUM 1<<1 +#define PHP_SQLITE3_BOTH (PHP_SQLITE3_ASSOC|PHP_SQLITE3_NUM) + +const int64 k_SQLITE3_ASSOC = PHP_SQLITE3_ASSOC; +const int64 k_SQLITE3_NUM = PHP_SQLITE3_NUM; +const int64 k_SQLITE3_BOTH = PHP_SQLITE3_BOTH; +const int64 k_SQLITE3_INTEGER = SQLITE_INTEGER; +const int64 k_SQLITE3_FLOAT = SQLITE_FLOAT; +const int64 k_SQLITE3_TEXT = SQLITE3_TEXT; +const int64 k_SQLITE3_BLOB = SQLITE_BLOB; +const int64 k_SQLITE3_NULL = SQLITE_NULL; +const int64 k_SQLITE3_OPEN_READONLY = SQLITE_OPEN_READONLY; +const int64 k_SQLITE3_OPEN_READWRITE = SQLITE_OPEN_READWRITE; +const int64 k_SQLITE3_OPEN_CREATE = SQLITE_OPEN_CREATE; + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +struct php_sqlite3_agg_context { + Variant context; + int64 row_count; +}; + +static Variant get_column_value(sqlite3_stmt *stmt, int column) { + ASSERT(stmt); + Variant data; + switch (sqlite3_column_type(stmt, column)) { + case SQLITE_INTEGER: + data = (int64)sqlite3_column_int64(stmt, column); + break; + case SQLITE_FLOAT: + data = (double)sqlite3_column_double(stmt, column); + break; + case SQLITE_NULL: + break; + case SQLITE3_TEXT: + data = String((char*)sqlite3_column_text(stmt, column), CopyString); + break; + case SQLITE_BLOB: + default: + data = String((char*)sqlite3_column_blob(stmt, column), + sqlite3_column_bytes(stmt, column), CopyString); + } + return data; +} + +static Variant get_value(sqlite3_value *argv) { + Variant value; + switch (sqlite3_value_type(argv)) { + case SQLITE_INTEGER: + value = (int64)sqlite3_value_int(argv); + break; + case SQLITE_FLOAT: + value = (double)sqlite3_value_double(argv); + break; + case SQLITE_NULL: + break; + case SQLITE_BLOB: + case SQLITE3_TEXT: + default: + value = String((char*)sqlite3_value_text(argv), + sqlite3_value_bytes(argv), CopyString); + break; + } + return value; +} + +static void sqlite3_do_callback(sqlite3_context *context, CVarRef callback, + int argc, sqlite3_value **argv, bool is_agg) { + Array params = Array::Create(); + php_sqlite3_agg_context *agg_context = NULL; + if (is_agg) { + agg_context = (php_sqlite3_agg_context *)sqlite3_aggregate_context + (context, sizeof(php_sqlite3_agg_context)); + params.append(ref(agg_context->context)); + params.append(agg_context->row_count); + } + for (int i = 0; i < argc; i++) { + params.append(get_value(argv[i])); + } + Variant ret = f_call_user_func_array(callback, params); + + if (!is_agg || !argv) { + /* only set the sqlite return value if we are a scalar function, + * or if we are finalizing an aggregate */ + if (ret.isInteger()) { + sqlite3_result_int(context, ret.toInt64()); + } else if (ret.isNull()) { + sqlite3_result_null(context); + } else if (ret.isDouble()) { + sqlite3_result_double(context, ret.toDouble()); + } else { + String sret = ret.toString(); + sqlite3_result_text(context, sret.data(), sret.size(), SQLITE_TRANSIENT); + } + } else { + /* we're stepping in an aggregate; the return value goes into + * the context */ + agg_context->context = ret; + } +} + +static void php_sqlite3_callback_func(sqlite3_context *context, int argc, + sqlite3_value **argv) { + c_sqlite3::UserDefinedFunc *udf = + (c_sqlite3::UserDefinedFunc*)sqlite3_user_data(context); + sqlite3_do_callback(context, udf->func, argc, argv, false); +} + +static void php_sqlite3_callback_step(sqlite3_context *context, int argc, + sqlite3_value **argv) { + php_sqlite3_agg_context *agg_context = + (php_sqlite3_agg_context *)sqlite3_aggregate_context + (context, sizeof(php_sqlite3_agg_context)); + agg_context->row_count++; + + c_sqlite3::UserDefinedFunc *udf = + (c_sqlite3::UserDefinedFunc*)sqlite3_user_data(context); + sqlite3_do_callback(context, udf->step, argc, argv, true); +} + +static void php_sqlite3_callback_final(sqlite3_context *context) { + php_sqlite3_agg_context *agg_context = + (php_sqlite3_agg_context *)sqlite3_aggregate_context + (context, sizeof(php_sqlite3_agg_context)); + agg_context->row_count = 0; + + c_sqlite3::UserDefinedFunc *udf = + (c_sqlite3::UserDefinedFunc*)sqlite3_user_data(context); + sqlite3_do_callback(context, udf->fini, 0, NULL, true); +} + +/////////////////////////////////////////////////////////////////////////////// +// sqlite3 + +c_sqlite3::c_sqlite3() : m_raw_db(NULL) { +} + +c_sqlite3::~c_sqlite3() { + if (m_raw_db) { + sqlite3_close(m_raw_db); + } +} + +void c_sqlite3::t___construct() { +} + +void c_sqlite3::validate() const { + if (!m_raw_db) { + throw Exception("SQLite3 object was not initialized"); + } +} + +void c_sqlite3::t_open(CStrRef filename, + int64 flags /* = k_SQLITE3_OPEN_READWRITE | + k_SQLITE3_OPEN_CREATE */, + CStrRef encryption_key /* = null_string */) { + if (m_raw_db) { + throw Exception("Already initialized DB Object"); + } + + String fname; + if (strncmp(filename.data(), ":memory:", 8) != 0) { + fname = File::TranslatePath(filename); + } else { + fname = filename; // in-memory db + } + + if (sqlite3_open_v2(fname.data(), &m_raw_db, flags, NULL) != SQLITE_OK) { + throw Exception("Unable to open database: %s", sqlite3_errmsg(m_raw_db)); + } + +#ifdef SQLITE_HAS_CODEC + if (!encryption_key.empty() && + sqlite3_key(m_raw_db, encryption_key.data(), encryption_key.size()) + != SQLITE_OK) { + throw Exception("Unable to open database: %s", sqlite3_errmsg(m_raw_db)); + } +#endif +} + +bool c_sqlite3::t_close() { + if (m_raw_db) { + int errcode = sqlite3_close(m_raw_db); + if (errcode != SQLITE_OK) { + Logger::Warning("Unable to close database: %d, %s", errcode, + sqlite3_errmsg(m_raw_db)); + return false; + } + m_raw_db = NULL; + } + return true; +} + +bool c_sqlite3::t_exec(CStrRef sql) { + validate(); + + char *errtext = NULL; + if (sqlite3_exec(m_raw_db, sql.data(), NULL, NULL, &errtext) != SQLITE_OK) { + Logger::Warning("%s", errtext); + sqlite3_free(errtext); + return false; + } + return true; +} + +Array c_sqlite3::t_version() { + Array ret; + ret.set("versionString", String((char*)sqlite3_libversion(), CopyString)); + ret.set("versionNumber", (int64)sqlite3_libversion_number()); + return ret; +} + +int64 c_sqlite3::t_lastinsertrowid() { + validate(); + return sqlite3_last_insert_rowid(m_raw_db); +} + +int64 c_sqlite3::t_lasterrorcode() { + validate(); + return sqlite3_errcode(m_raw_db); +} + +String c_sqlite3::t_lasterrormsg() { + validate(); + return String((char*)sqlite3_errmsg(m_raw_db), CopyString); +} + +bool c_sqlite3::t_loadextension(CStrRef extension) { + validate(); + + String translated = File::TranslatePath(extension); + if (translated.empty()) { + Logger::Warning("Unable to load extension at '%s'", extension.data()); + return false; + } + + char *errtext = NULL; + sqlite3_enable_load_extension(m_raw_db, 1); + if (sqlite3_load_extension(m_raw_db, translated.data(), 0, &errtext) + != SQLITE_OK) { + Logger::Warning("%s", errtext); + sqlite3_free(errtext); + sqlite3_enable_load_extension(m_raw_db, 0); + return false; + } + sqlite3_enable_load_extension(m_raw_db, 0); + return true; +} + +int64 c_sqlite3::t_changes() { + validate(); + return sqlite3_changes(m_raw_db); +} + +String c_sqlite3::t_escapestring(CStrRef sql) { + if (!sql.empty()) { + char *ret = sqlite3_mprintf("%q", sql.data()); + if (ret) { + String sret(ret, CopyString); + sqlite3_free(ret); + return sret; + } + } + return ""; +} + +Variant c_sqlite3::t_prepare(CStrRef sql) { + validate(); + if (!sql.empty()) { + c_sqlite3stmt *stmt = NEW(c_sqlite3stmt)(); + Object ret(stmt); + stmt->t___construct(p_sqlite3(this), sql); + if (stmt->m_raw_stmt) { + return ret; + } + } + return false; +} + +Variant c_sqlite3::t_query(CStrRef sql) { + validate(); + if (!sql.empty()) { + Variant stmt = t_prepare(sql); + if (!same(stmt, false)) { + return stmt.toObject().getTyped()->t_execute(); + } + } + return false; +} + +Variant c_sqlite3::t_querysingle(CStrRef sql, bool entire_row /* = false */) { + validate(); + if (!sql.empty()) { + Variant stmt = t_prepare(sql); + if (!same(stmt, false)) { + sqlite3_stmt *pstmt = + stmt.toObject().getTyped()->m_raw_stmt; + switch (sqlite3_step(pstmt)) { + case SQLITE_ROW: /* Valid Row */ + if (entire_row) { + Array ret = Array::Create(); + for (int i = 0; i < sqlite3_data_count(pstmt); i++) { + ret.set(String((char*)sqlite3_column_name(pstmt, i), CopyString), + get_column_value(pstmt, i)); + } + return ret; + } + return get_column_value(pstmt, 0); + case SQLITE_DONE: /* Valid but no results */ + if (entire_row) { + return Array::Create(); + } else { + return null; + } + default: + Logger::Warning("Unable to execute statement: %s", + sqlite3_errmsg(m_raw_db)); + } + } + } + return false; +} + +bool c_sqlite3::t_createfunction(CStrRef name, CVarRef callback, + int64 argcount /* = -1 */) { + validate(); + if (name.empty()) { + return false; + } + if (!f_is_callable(callback)) { + Logger::Warning("Not a valid callback function %s", + callback.toString().data()); + return false; + } + + UserDefinedFuncPtr udf(new UserDefinedFunc()); + if (sqlite3_create_function(m_raw_db, name.data(), argcount, SQLITE_UTF8, + udf.get(), php_sqlite3_callback_func, + NULL, NULL) == SQLITE_OK) { + udf->func = callback; + udf->argc = argcount; + m_udfs.push_back(udf); + return true; + } + return false; +} + +bool c_sqlite3::t_createaggregate(CStrRef name, CVarRef step, CVarRef final, + int64 argcount /* = -1 */) { + validate(); + if (name.empty()) { + return false; + } + if (!f_is_callable(step)) { + Logger::Warning("Not a valid callback function %s", + step.toString().data()); + return false; + } + if (!f_is_callable(final)) { + Logger::Warning("Not a valid callback function %s", + final.toString().data()); + return false; + } + + UserDefinedFuncPtr udf(new UserDefinedFunc()); + if (sqlite3_create_function(m_raw_db, name.data(), argcount, SQLITE_UTF8, + udf.get(), NULL, + php_sqlite3_callback_step, + php_sqlite3_callback_final) == SQLITE_OK) { + udf->step = step; + udf->fini = final; + udf->argc = argcount; + m_udfs.push_back(udf); + return true; + } + return false; +} + +bool c_sqlite3::t_openblob(CStrRef table, CStrRef column, int64 rowid, + CStrRef dbname /* = null_string */) { + throw NotSupportedException(__func__, "sqlite3 stream"); +} + +Variant c_sqlite3::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// + +c_sqlite3stmt::c_sqlite3stmt() : m_raw_stmt(NULL) { +} + +c_sqlite3stmt::~c_sqlite3stmt() { + if (m_raw_stmt) { + sqlite3_finalize(m_raw_stmt); + } +} + +void c_sqlite3stmt::t___construct(CObjRef dbobject, CStrRef statement) { + if (!statement.empty()) { + c_sqlite3 *db = dbobject.getTyped(); + db->validate(); + m_db = db; + + int errcode = sqlite3_prepare_v2(db->m_raw_db, statement.data(), + statement.size(), &m_raw_stmt, NULL); + if (errcode != SQLITE_OK) { + Logger::Warning("Unable to prepare statement: %d, %s", + errcode, sqlite3_errmsg(db->m_raw_db)); + } + } +} + +void c_sqlite3stmt::validate() const { + if (!m_raw_stmt) { + throw Exception("SQLite3Stmt object was not initialized"); + } +} + +int64 c_sqlite3stmt::t_paramcount() { + validate(); + return sqlite3_bind_parameter_count(m_raw_stmt); +} + +bool c_sqlite3stmt::t_close() { + if (m_raw_stmt) { + sqlite3_finalize(m_raw_stmt); + m_raw_stmt = NULL; + } + return true; +} + +bool c_sqlite3stmt::t_reset() { + validate(); + if (sqlite3_reset(m_raw_stmt) != SQLITE_OK) { + Logger::Warning("Unable to reset statement: %s", + sqlite3_errmsg(sqlite3_db_handle(m_raw_stmt))); + return false; + } + return true; +} + +bool c_sqlite3stmt::t_clear() { + validate(); + if (sqlite3_clear_bindings(m_raw_stmt) != SQLITE_OK) { + Logger::Warning("Unable to clear statement: %s", + sqlite3_errmsg(sqlite3_db_handle(m_raw_stmt))); + return false; + } + m_bound_params.clear(); + return true; +} + +bool c_sqlite3stmt::t_bindparam(CVarRef name, Variant parameter, + int64 type /* = k_SQLITE3_TEXT */) { + BoundParamPtr param(new BoundParam()); + param->type = type; + param->value = ref(parameter); + + if (name.isString()) { + String sname = name.toString(); + if (sname.charAt(0) != ':') { + /* We need a : prefix to resolve a name to a parameter number */ + sname = String(":") + sname; + } + param->index = sqlite3_bind_parameter_index(m_raw_stmt, sname.data()); + } else { + param->index = name.toInt64(); + } + if (param->index < 1) { + return false; + } + + m_bound_params.push_back(param); + return true; +} + +bool c_sqlite3stmt::t_bindvalue(CVarRef name, CVarRef parameter, + int64 type /* = k_SQLITE3_TEXT */) { + Variant v = parameter; + return t_bindparam(name, v, type); +} + +Variant c_sqlite3stmt::t_execute() { + validate(); + + for (unsigned int i = 0; i < m_bound_params.size(); i++) { + BoundParam &p = *m_bound_params[i]; + if (p.value.isNull()) { + sqlite3_bind_null(m_raw_stmt, p.index); + continue; + } + + switch (p.type) { + case SQLITE_INTEGER: + sqlite3_bind_int(m_raw_stmt, p.index, p.value.toInt64()); + break; + case SQLITE_FLOAT: + sqlite3_bind_double(m_raw_stmt, p.index, p.value.toDouble()); + break; + case SQLITE_BLOB: + { + String sblob; + if (p.value.isResource()) { + Variant blob = f_stream_get_contents(p.value); + if (same(blob, false)) { + Logger::Warning("Unable to read stream for parameter %ld", + p.index); + return false; + } + sblob = blob.toString(); + } else { + sblob = p.value.toString(); + } + sqlite3_bind_blob(m_raw_stmt, p.index, sblob.data(), sblob.size(), + SQLITE_TRANSIENT); + break; + } + case SQLITE3_TEXT: + { + String stext = p.value.toString(); + sqlite3_bind_text(m_raw_stmt, p.index, stext.data(), stext.size(), + SQLITE_STATIC); + break; + } + case SQLITE_NULL: + sqlite3_bind_null(m_raw_stmt, p.index); + break; + default: + Logger::Warning("Unknown parameter type: %ld for parameter %ld", + p.type, p.index); + return false; + } + } + + switch (sqlite3_step(m_raw_stmt)) { + case SQLITE_ROW: /* Valid Row */ + case SQLITE_DONE: /* Valid but no results */ + { + sqlite3_reset(m_raw_stmt); + c_sqlite3result *result = NEW(c_sqlite3result)(); + result->m_stmt = p_sqlite3stmt(this); + return Object(result); + } + case SQLITE_ERROR: + sqlite3_reset(m_raw_stmt); + // fall through + default: + Logger::Warning("Unable to execute statement: %s", + sqlite3_errmsg(sqlite3_db_handle(m_raw_stmt))); + } + return false; +} + +Variant c_sqlite3stmt::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// + +c_sqlite3result::c_sqlite3result() { +} + +c_sqlite3result::~c_sqlite3result() { +} + +void c_sqlite3result::t___construct() { +} + +void c_sqlite3result::validate() const { + if (!m_stmt.get()) { + throw Exception("SQLite3Result object was not initialized"); + } + m_stmt->validate(); +} + +int64 c_sqlite3result::t_numcolumns() { + validate(); + return sqlite3_column_count(m_stmt->m_raw_stmt); +} + +String c_sqlite3result::t_columnname(int64 column) { + validate(); + return String((char*)sqlite3_column_name(m_stmt->m_raw_stmt, column), + CopyString); +} + +int64 c_sqlite3result::t_columntype(int64 column) { + validate(); + return sqlite3_column_type(m_stmt->m_raw_stmt, column); +} + +Variant c_sqlite3result::t_fetcharray(int64 mode /* = k_SQLITE3_BOTH */) { + validate(); + + switch (sqlite3_step(m_stmt->m_raw_stmt)) { + case SQLITE_ROW: + if (mode & PHP_SQLITE3_BOTH) { + Array ret = Array::Create(); + for (int i = 0; i < sqlite3_data_count(m_stmt->m_raw_stmt); i++) { + Variant data = get_column_value(m_stmt->m_raw_stmt, i); + if (mode & PHP_SQLITE3_NUM) { + ret.set(i, data); + } + if (mode & PHP_SQLITE3_ASSOC) { + ret.set(t_columnname(i), data); + } + } + return ret; + } + break; + case SQLITE_DONE: + return false; + default: + Logger::Warning("Unable to execute statement: %s", + sqlite3_errmsg(sqlite3_db_handle(m_stmt->m_raw_stmt))); + } + return null; +} + +bool c_sqlite3result::t_reset() { + validate(); + return sqlite3_reset(m_stmt->m_raw_stmt) == SQLITE_OK; +} + +bool c_sqlite3result::t_finalize() { + validate(); + m_stmt.reset(); + return true; +} + +Variant c_sqlite3result::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_sqlite3.h b/src/cpp/ext/ext_sqlite3.h new file mode 100644 index 0000000000000..5b6c554706309 --- /dev/null +++ b/src/cpp/ext/ext_sqlite3.h @@ -0,0 +1,154 @@ + +#ifndef __EXT_SQLITE3_H__ +#define __EXT_SQLITE3_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< +#include + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +extern const int64 k_SQLITE3_ASSOC; +extern const int64 k_SQLITE3_NUM; +extern const int64 k_SQLITE3_BOTH; +extern const int64 k_SQLITE3_INTEGER; +extern const int64 k_SQLITE3_FLOAT; +extern const int64 k_SQLITE3_TEXT; +extern const int64 k_SQLITE3_BLOB; +extern const int64 k_SQLITE3_NULL; +extern const int64 k_SQLITE3_OPEN_READONLY; +extern const int64 k_SQLITE3_OPEN_READWRITE; +extern const int64 k_SQLITE3_OPEN_CREATE; + +/////////////////////////////////////////////////////////////////////////////// +// class sqlite3 + +FORWARD_DECLARE_CLASS(sqlite3); +class c_sqlite3 : public ObjectData { + public: + BEGIN_CLASS_MAP(sqlite3) + END_CLASS_MAP(sqlite3) + DECLARE_CLASS(sqlite3, sqlite3, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_sqlite3(); + public: ~c_sqlite3(); + public: void t___construct(); + public: void t_open(CStrRef filename, int64 flags = k_SQLITE3_OPEN_READWRITE|k_SQLITE3_OPEN_CREATE, CStrRef encryption_key = null_string); + public: bool t_close(); + public: bool t_exec(CStrRef sql); + public: Array t_version(); + public: int64 t_lastinsertrowid(); + public: int64 t_lasterrorcode(); + public: String t_lasterrormsg(); + public: bool t_loadextension(CStrRef extension); + public: int64 t_changes(); + public: String t_escapestring(CStrRef sql); + public: Variant t_prepare(CStrRef sql); + public: Variant t_query(CStrRef sql); + public: Variant t_querysingle(CStrRef sql, bool entire_row = false); + public: bool t_createfunction(CStrRef name, CVarRef callback, int64 argcount = -1); + public: bool t_createaggregate(CStrRef name, CVarRef step, CVarRef final, int64 argcount = -1); + public: bool t_openblob(CStrRef table, CStrRef column, int64 rowid, CStrRef dbname = null_string); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: void validate() const; + public: sqlite3 *m_raw_db; + DECLARE_BOOST_TYPES(UserDefinedFunc); + struct UserDefinedFunc { + int argc; + Variant func; + Variant step; + Variant fini; + }; + public: UserDefinedFuncPtrVec m_udfs; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class sqlite3stmt + +FORWARD_DECLARE_CLASS(sqlite3stmt); +class c_sqlite3stmt : public ObjectData { + public: + BEGIN_CLASS_MAP(sqlite3stmt) + END_CLASS_MAP(sqlite3stmt) + DECLARE_CLASS(sqlite3stmt, sqlite3stmt, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_sqlite3stmt(); + public: ~c_sqlite3stmt(); + public: void t___construct(CObjRef dbobject, CStrRef statement); + public: int64 t_paramcount(); + public: bool t_close(); + public: bool t_reset(); + public: bool t_clear(); + public: bool t_bindparam(CVarRef name, Variant parameter, int64 type = k_SQLITE3_TEXT); + public: bool t_bindvalue(CVarRef name, CVarRef parameter, int64 type = k_SQLITE3_TEXT); + public: Variant t_execute(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(Object dbobject, String statement); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: void validate() const; + public: p_sqlite3 m_db; + public: sqlite3_stmt *m_raw_stmt; + DECLARE_BOOST_TYPES(BoundParam); + struct BoundParam { + int type; + int index; + Variant value; + }; + public: BoundParamPtrVec m_bound_params; +}; + +/////////////////////////////////////////////////////////////////////////////// +// class sqlite3result + +FORWARD_DECLARE_CLASS(sqlite3result); +class c_sqlite3result : public ObjectData { + public: + BEGIN_CLASS_MAP(sqlite3result) + END_CLASS_MAP(sqlite3result) + DECLARE_CLASS(sqlite3result, sqlite3result, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_sqlite3result(); + public: ~c_sqlite3result(); + public: void t___construct(); + public: int64 t_numcolumns(); + public: String t_columnname(int64 column); + public: int64 t_columntype(int64 column); + public: Variant t_fetcharray(int64 mode = k_SQLITE3_BOTH); + public: bool t_reset(); + public: bool t_finalize(); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: void validate() const; + public: p_sqlite3stmt m_stmt; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_SQLITE3_H__ diff --git a/src/cpp/ext/ext_stream.cpp b/src/cpp/ext/ext_stream.cpp new file mode 100644 index 0000000000000..7e1bd3fd83c5f --- /dev/null +++ b/src/cpp/ext/ext_stream.cpp @@ -0,0 +1,237 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PHP_STREAM_BUFFER_NONE 0 /* unbuffered */ +#define PHP_STREAM_BUFFER_LINE 1 /* line buffered */ +#define PHP_STREAM_BUFFER_FULL 2 /* fully buffered */ + +namespace HPHP { + +IMPLEMENT_OBJECT_ALLOCATION(StreamContext); +/////////////////////////////////////////////////////////////////////////////// + +Variant f_stream_copy_to_stream(CObjRef source, CObjRef dest, + int maxlength /* = 0 */, + int offset /* = 0 */) { + Variant ret = f_stream_get_contents(source, maxlength, offset); + if (same(ret, false)) { + return false; + } + + return dest.getTyped()->write(ret.toString()); +} + +Variant f_stream_get_contents(CObjRef handle, int maxlen /* = 0 */, + int offset /* = 0 */) { + if (maxlen < 0) { + throw InvalidArgumentException("maxlen", maxlen); + } + + File *file = handle.getTyped(); + if (offset > 0 && file->seek(offset, SEEK_SET) < 0) { + Logger::Warning("Failed to seek to position %ld in the stream", offset); + return false; + } + + String ret; + if (maxlen) { + char *buf = (char *)malloc(maxlen + 1); + maxlen = file->readImpl(buf, maxlen); + if (maxlen < 0) { + free(buf); + return false; + } + buf[maxlen] = '\0'; + ret = String(buf, maxlen, AttachString); + } else { + StringBuffer sb; + sb.read(file); + ret = sb.detach(); + } + return ret; +} + +Variant f_stream_get_line(CObjRef handle, int length /* = 0 */, + CStrRef ending /* = null_string */) { + File *file = handle.getTyped(); + String record = file->readRecord(ending, length); + if (record.empty()) { + return false; + } + return record; +} + +Variant f_stream_select(Variant read, Variant write, Variant except, + CVarRef vtv_sec, int tv_usec /* = 0 */) { + return f_socket_select(ref(read), ref(write), ref(except), vtv_sec, tv_usec); +} + +bool f_stream_set_blocking(CObjRef stream, int mode) { + File *file = stream.getTyped(); + int flags = fcntl(file->fd(), F_GETFL, 0); + if (mode) { + flags &= ~O_NONBLOCK; + } else { + flags |= O_NONBLOCK; + } + return fcntl(file->fd(), F_SETFL, flags) != -1; +} + +bool f_stream_set_timeout(CObjRef stream, int seconds, + int microseconds /* = 0 */) { + if (stream.getTyped(false, true)) { + return f_socket_set_option + (stream, SOL_SOCKET, SO_RCVTIMEO, + CREATE_MAP2("sec", seconds, "usec", microseconds)); + } + return false; +} + +int f_stream_set_write_buffer(CObjRef stream, int buffer) { + PlainFile *file = stream.getTyped(false, true); + if (file) { + switch (buffer) { + case PHP_STREAM_BUFFER_NONE: + return setvbuf(file->getStream(), NULL, _IONBF, 0); + case PHP_STREAM_BUFFER_LINE: + return setvbuf(file->getStream(), NULL, _IOLBF, BUFSIZ); + case PHP_STREAM_BUFFER_FULL: + return setvbuf(file->getStream(), NULL, _IOFBF, BUFSIZ); + default: + break; + } + } + return -1; +} + +/////////////////////////////////////////////////////////////////////////////// +// stream socket functions + +static void parse_host(CStrRef address, String &host, int &port) { + int pos = address.find(':'); + if (pos >= 0) { + host = address.substr(0, pos); + port = address.substr(pos + 1).toInt16(); + } else { + host = address; + port = 0; + } +} + +static void parse_socket(CStrRef socket, String &protocol, String &host, + int &port) { + String address; + int pos = socket.find("://"); + if (pos >= 0) { + protocol = socket.substr(0, pos); + address = socket.substr(pos + 3); + } else { + protocol = "tcp"; + address = socket; + } + + parse_host(address, host, port); +} + +Variant f_stream_socket_accept(CObjRef server_socket, + double timeout /* = 0.0 */, + Variant peername /* = null */) { + return f_socket_accept(server_socket); +} + +Variant f_stream_socket_server(CStrRef local_socket, + Variant errnum /* = null */, + Variant errstr /* = null */, + int flags /* = 0 */, + CObjRef context /* = null_object */) { + String protocol, host; int port; + parse_socket(local_socket, protocol, host, port); + return f_socket_server(protocol + "://" + host, port, errnum, errstr); +} + +Variant f_stream_socket_client(CStrRef remote_socket, + Variant errnum /* = null */, + Variant errstr /* = null */, + double timeout /* = 0.0 */, + int flags /* = 0 */, + CObjRef context /* = null_object */) { + String protocol, host; int port; + parse_socket(remote_socket, protocol, host, port); + return f_fsockopen(protocol + "://" + host, port, errnum, errstr, timeout); +} + +Variant f_stream_socket_get_name(CObjRef handle, bool want_peer) { + Variant address; + bool ret; + if (want_peer) { + ret = f_socket_getpeername(handle, ref(address)); + } else { + ret = f_socket_getsockname(handle, ref(address)); + } + if (ret) { + return address.toString(); + } + return false; +} + +Variant f_stream_socket_pair(int domain, int type, int protocol) { + Variant fd; + if (!f_socket_create_pair(domain, type, protocol, ref(fd))) { + return false; + } + return fd; +} + +Variant f_stream_socket_recvfrom(CObjRef socket, int length, + int flags /* = 0 */, + CStrRef address /* = null_string */) { + String host; int port; + parse_host(address, host, port); + Variant ret; + Variant retval = f_socket_recvfrom(socket, ref(ret), length, flags, + host, port); + if (!same(retval, false) && retval.toInt64() >= 0) { + return ret.toString(); // watch out, "ret", not "retval" + } + return false; +} + +Variant f_stream_socket_sendto(CObjRef socket, CStrRef data, + int flags /* = 0 */, + CStrRef address /* = null_string */) { + String host; int port; + parse_host(address, host, port); + return f_socket_sendto(socket, data, data.size(), flags, host, port); +} + +bool f_stream_socket_shutdown(CObjRef stream, int how) { + return f_socket_shutdown(stream, how); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_stream.h b/src/cpp/ext/ext_stream.h new file mode 100644 index 0000000000000..65f1e2569f8a9 --- /dev/null +++ b/src/cpp/ext/ext_stream.h @@ -0,0 +1,204 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_STREAM_H__ +#define __EXT_STREAM_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// stream context + +class StreamContext : public ResourceData { +public: + DECLARE_OBJECT_ALLOCATION(StreamContext); + + // overriding ResourceData + virtual const char *o_getClassName() const { return "StreamContext";} + + StreamContext(CArrRef options, CArrRef params) + : m_options(options), m_params(params) { + } + Array m_options; + Array m_params; +}; + +inline Object f_stream_context_create(CArrRef options = null_array, + CArrRef params = null_array) { + return Object(NEW(StreamContext)(options, params)); +} + +inline Object f_stream_context_get_default(CArrRef options = null_array) { + throw NotImplementedException(__func__); +} + +inline Array f_stream_context_get_options(CObjRef stream_or_context) { + throw NotImplementedException(__func__); +} + +inline bool f_stream_context_set_option(CObjRef stream_or_context, + CVarRef wrapper, + CStrRef option = null_string, + CVarRef value = null_variant) { + throw NotImplementedException(__func__); +} + +inline bool f_stream_context_set_param(CObjRef stream_or_context, + CArrRef params) { + throw NotImplementedException(__func__); +} + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_stream_copy_to_stream(CObjRef source, CObjRef dest, + int maxlength = 0, int offset = 0); + +inline bool f_stream_encoding(CObjRef stream, CStrRef encoding = null_string) { + throw NotSupportedException(__func__, "stream filter is not supported"); +} + +inline void f_stream_bucket_append(CObjRef brigade, CObjRef bucket) { + throw NotSupportedException(__func__, "stream bucket is not supported"); +} + +inline void f_stream_bucket_prepend(CObjRef brigade, CObjRef bucket) { + throw NotSupportedException(__func__, "stream bucket is not supported"); +} + +inline Object f_stream_bucket_make_writeable(CObjRef brigade) { + throw NotSupportedException(__func__, "stream bucket is not supported"); +} + +inline Object f_stream_bucket_new(CObjRef stream, CStrRef buffer) { + throw NotSupportedException(__func__, "stream bucket is not supported"); +} + +inline bool f_stream_filter_register(CStrRef filtername, CStrRef classname) { + throw NotSupportedException(__func__, "stream filter is not supported"); +} + +inline bool f_stream_filter_remove(CObjRef stream_filter) { + throw NotSupportedException(__func__, "stream filter is not supported"); +} + +inline Object f_stream_filter_append(CObjRef stream, CStrRef filtername, + int read_write = 0, + CVarRef params = null_variant) { + throw NotSupportedException(__func__, "stream filter is not supported"); +} + +inline Object f_stream_filter_prepend(CObjRef stream, CStrRef filtername, + int read_write = 0, + CVarRef params = null_variant) { + throw NotSupportedException(__func__, "stream filter is not supported"); +} + +Variant f_stream_get_contents(CObjRef handle, int maxlen = 0, + int offset = 0); + +inline Array f_stream_get_filters() { + throw NotSupportedException(__func__, "stream filter is not supported"); +} + +Variant f_stream_get_line(CObjRef handle, int length = 0, + CStrRef ending = null_string); + +inline Array f_stream_get_meta_data(CObjRef stream) { + File *f = stream.getTyped(true); + if (f) return f->getMetaData(); + return Array(); +} + +inline Array f_stream_get_transports() { + return CREATE_VECTOR4("tcp", "udp", "unix", "udg"); +} + +inline Array f_stream_get_wrappers() { + throw NotSupportedException(__func__, "stream protocol is not supported"); +} + +inline bool f_stream_register_wrapper(CStrRef protocol, CStrRef classname) { + throw NotSupportedException(__func__, "stream protocol is not supported"); +} + +inline bool f_stream_wrapper_register(CStrRef protocol, CStrRef classname) { + throw NotSupportedException(__func__, "stream protocol is not supported"); +} + +inline bool f_stream_wrapper_restore(CStrRef protocol) { + throw NotSupportedException(__func__, "stream protocol is not supported"); +} + +inline bool f_stream_wrapper_unregister(CStrRef protocol) { + throw NotSupportedException(__func__, "stream protocol is not supported"); +} + +inline String f_stream_resolve_include_path(CStrRef filename, + CObjRef context = null_object) { + throw NotSupportedException(__func__, "include path is not supported"); +} + +Variant f_stream_select(Variant read, Variant write, Variant except, + CVarRef vtv_sec, int tv_usec = 0); + +bool f_stream_set_blocking(CObjRef stream, int mode); + +bool f_stream_set_timeout(CObjRef stream, int seconds, int microseconds = 0); + +int f_stream_set_write_buffer(CObjRef stream, int buffer); + +inline int f_set_file_buffer(CObjRef stream, int buffer) { + return f_stream_set_write_buffer(stream, buffer); +} + +/////////////////////////////////////////////////////////////////////////////// +// stream sockets: ext_socket has better implementation of socket functions + +Variant f_stream_socket_accept(CObjRef server_socket, double timeout = 0.0, + Variant peername = null); + +Variant f_stream_socket_server(CStrRef local_socket, Variant errnum = null, + Variant errstr = null, + int flags = 0, CObjRef context = null_object); + +Variant f_stream_socket_client(CStrRef remote_socket, Variant errnum = null, + Variant errstr = null, double timeout = 0.0, + int flags = 0, CObjRef context = null_object); + +inline Variant f_stream_socket_enable_crypto(CObjRef stream, bool enable, + int crypto_type = 0, + CObjRef session_stream = null_object) { + throw NotSupportedException(__func__, "no crypto support on sockets"); +} + +Variant f_stream_socket_get_name(CObjRef handle, bool want_peer); + +Variant f_stream_socket_pair(int domain, int type, int protocol); + +Variant f_stream_socket_recvfrom(CObjRef socket, int length, int flags = 0, + CStrRef address = null_string); + +Variant f_stream_socket_sendto(CObjRef socket, CStrRef data, int flags = 0, + CStrRef address = null_string); + +bool f_stream_socket_shutdown(CObjRef stream, int how); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_STREAM_H__ diff --git a/src/cpp/ext/ext_string.cpp b/src/cpp/ext/ext_string.cpp new file mode 100644 index 0000000000000..c7c44ac9c768c --- /dev/null +++ b/src/cpp/ext/ext_string.cpp @@ -0,0 +1,767 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { + +static Mutex s_mutex; +/////////////////////////////////////////////////////////////////////////////// + +String f_implode(CVarRef arg1, CVarRef arg2 /* = null_variant */) { + Array items; + String delim; + if (arg1.is(KindOfArray)) { + items = arg1.toArray(); + delim = arg2.toString(); + } else if (arg2.is(KindOfArray)) { + items = arg2.toArray(); + delim = arg1.toString(); + } else { + throw_bad_type_exception("arguments need at least one array"); + return String(); + } + return StringUtil::Implode(items, delim); +} + +class TokenizerData : public RequestEventHandler { +public: + String str; + int pos; + int mask[256]; + + virtual void requestInit() { + str.reset(); + pos = 0; + memset(&mask, 0, sizeof(mask)); + } + virtual void requestShutdown() { + requestInit(); + } +}; +static RequestLocal s_tokenizer_data; + +Variant f_strtok(CStrRef str, CVarRef token /* = null_variant */) { + String stoken; + if (!token.isNull()) { + s_tokenizer_data->str = str; + s_tokenizer_data->pos = 0; + stoken = token.toString(); + } else { + stoken = str; + } + + String sstr = s_tokenizer_data->str; + int pos = s_tokenizer_data->pos; + if (pos >= sstr.size()) { + return false; + } + + // set up mask + int *mask = s_tokenizer_data->mask; + for (int i = 0; i < stoken.size(); i++) { + mask[(unsigned char)stoken.data()[i]] = 1; + } + + // skip leading delimiters + const char *s0 = sstr.data(); + int i = pos; + for (; i < sstr.size(); i++) { + if (!mask[(unsigned char)s0[i]]) { + break; + } + } + int pos0 = i; + for (; i < sstr.size(); i++) { + if (mask[(unsigned char)s0[i]]) { + break; + } + } + + String ret(s0 + pos0, i - pos0, CopyString); + s_tokenizer_data->pos = i + 1; + + // reset mask + for (int i = 0; i < stoken.size(); i++) { + mask[(unsigned char)stoken.data()[i]] = 0; + } + return ret; +} + +static Variant str_replace(CVarRef search, CVarRef replace, CStrRef subject, + int &count, bool caseSensitive) { + if (search.is(KindOfArray)) { + String ret = subject; + + Array searchArr = search.toArray(); + if (replace.is(KindOfArray)) { + Array replArr = replace.toArray(); + if (searchArr.size() < replArr.size()) { + throw InvalidArgumentException("search and replace", + "(more replacements than searches)"); + } + + ArrayIter replIter(replArr); + for (ArrayIter iter(searchArr); iter; ++iter) { + if (replIter) { + ret = ret.replace(iter.second().toString(), + replIter.second().toString(), count, caseSensitive); + ++replIter; + } else { + ret = ret.replace(iter.second().toString(), + "", count, caseSensitive); + } + } + return ret; + } + + String repl = replace.toString(); + for (ArrayIter iter(searchArr); iter; ++iter) { + ret = ret.replace(iter.second().toString(), repl, count, caseSensitive); + } + return ret; + } + + if (replace.is(KindOfArray)) { + throw InvalidArgumentException("replace", "(array)"); + } + return subject.replace(search.toString(), replace.toString(), count, + caseSensitive); +} + +static Variant str_replace(CVarRef search, CVarRef replace, CVarRef subject, + int &count, bool caseSensitive) { + if (subject.is(KindOfArray)) { + Array arr = subject.toArray(); + Array ret; + for (ArrayIter iter(arr); iter; ++iter) { + String replaced = str_replace(search, replace, iter.second().toString(), + count, caseSensitive); + ret.set(iter.first(), replaced); + } + return ret; + } + return str_replace(search, replace, subject.toString(), count, + caseSensitive); +} + +Variant f_str_replace(CVarRef search, CVarRef replace, CVarRef subject, + Variant count /* = null */) { + int nCount; + Variant ret = str_replace(search, replace, subject, nCount, true); + count = nCount; + return ret; +} + +Variant f_str_ireplace(CVarRef search, CVarRef replace, CVarRef subject, + Variant count /* = null */) { + int nCount; + Variant ret = str_replace(search, replace, subject, nCount, false); + count = nCount; + return ret; +} + +Variant f_substr_replace(CVarRef str, CVarRef replacement, CVarRef start, + CVarRef length /* = 0x7FFFFFFF */) { + if (!str.is(KindOfArray)) { + String repl; + if (replacement.is(KindOfArray)) { + repl = replacement[0].toString(); + } else { + repl = replacement.toString(); + } + if (start.is(KindOfArray)) { + throw InvalidArgumentException("start", "(array)"); + } + return str.toString().replace(start.toInt32(), length.toInt32(), repl); + } + + Array ret; + Array strArr = str.toArray(); + if (start.is(KindOfArray) && length.is(KindOfArray)) { + Array startArr = start.toArray(); + Array lengthArr = length.toArray(); + if (startArr.size() != strArr.size()) { + throw InvalidArgumentException("start and str", + "(different item count)"); + } + if (startArr.size() != lengthArr.size()) { + throw InvalidArgumentException("start and length", + "(different item count)"); + } + ArrayIter startIter(startArr); + ArrayIter lengthIter(lengthArr); + + if (replacement.is(KindOfArray)) { + Array replArr = replacement.toArray(); + if (startArr.size() != replArr.size()) { + throw InvalidArgumentException("start and replacement", + "(different item count)"); + } + + ArrayIter replIter(replArr); + for (ArrayIter iter(strArr); iter; + ++iter, ++replIter, ++startIter, ++lengthIter) { + int nStart = startIter.second().toInt32(); + int nLength = lengthIter.second().toInt32(); + String repl = replIter.second().toString(); + ret.append(iter.second().toString().replace(nStart, nLength, repl)); + } + } else { + String repl = replacement.toString(); + for (ArrayIter iter(strArr); iter; + ++iter, ++startIter, ++lengthIter) { + int nStart = startIter.second().toInt32(); + int nLength = lengthIter.second().toInt32(); + ret.append(iter.second().toString().replace(nStart, nLength, repl)); + } + } + + } else if (!start.is(KindOfArray) && !length.is(KindOfArray)) { + int nStart = start.toInt32(); + int nLength = length.toInt32(); + + if (replacement.is(KindOfArray)) { + Array replArr = replacement.toArray(); + if (replArr.size() != strArr.size()) { + throw InvalidArgumentException("replacement and str", + "(different item count)"); + } + + ArrayIter replIter(replArr); + for (ArrayIter iter(strArr); iter; ++iter, ++replIter) { + String repl = replIter.second().toString(); + ret.append(iter.second().toString().replace(nStart, nLength, repl)); + } + } else { + String repl = replacement.toString(); + for (ArrayIter iter(strArr); iter; ++iter) { + ret.append(iter.second().toString().replace(nStart, nLength, repl)); + } + } + } else { + throw InvalidArgumentException("start and length", + "(not both arrays or both numerics)"); + } + return ret; +} + + +/////////////////////////////////////////////////////////////////////////////// + +Variant f_sscanf(int _argc, CStrRef str, CStrRef format, CArrRef _argv /* = null_array */) { + Array ret; + string_sscanf(str, format, _argv.size(), ret); + if (_argv.empty()) { + return ret; + } + + for (int i = 0; i < ret.size(); i++) { + ((Array&)_argv).lvalAt(i) = ret[i]; + } + return ret.size(); +} + +String f_number_format(double number, int decimals /* = 0 */, + CStrRef dec_point /* = "." */, + CStrRef thousands_sep /* = "," */) { + char ch_dec_point = '.'; + if (!dec_point.isNull()) { + if (dec_point.size() >= 1) { + ch_dec_point = ((const char *)dec_point)[0]; + } else { + ch_dec_point = 0; + } + } + char ch_thousands_sep = ','; + if (!thousands_sep.isNull()) { + if (thousands_sep.size() >= 1) { + ch_thousands_sep = ((const char *)thousands_sep)[0]; + } else { + ch_thousands_sep = 0; + } + } + char *ret = string_number_format(number, decimals, ch_dec_point, + ch_thousands_sep); + return String(ret, AttachString); +} + +Variant f_substr_compare(CStrRef main_str, CStrRef str, int offset, + int length /* = 0 */, + bool case_insensitivity /* = false */) { + int s1_len = main_str.size(); + int s2_len = str.size(); + + if (offset < 0) { + offset = s1_len + offset; + if (offset < 0) offset = 0; + } + if (offset > s1_len || length > s1_len - offset) { + return false; + } + + int cmp_len = length; + if (length == 0) { + cmp_len = s1_len - offset; + if (cmp_len < s2_len) cmp_len = s2_len; + } + + const char *s1 = main_str.data(); + if (case_insensitivity) { + return string_ncasecmp(s1 + offset, str, cmp_len); + } + return string_ncmp(s1 + offset, str, cmp_len); +} + +Variant f_strrchr(CStrRef haystack, CVarRef needle) { + Variant ret = f_strrpos(haystack, needle); + if (same(ret, false)) { + return false; + } + return haystack.substr(ret.toInt32()); +} + +Variant f_strstr(CStrRef haystack, CVarRef needle) { + Variant ret = f_strpos(haystack, needle); + if (same(ret, false)) { + return false; + } + return haystack.substr(ret.toInt32()); +} + +Variant f_stristr(CStrRef haystack, CVarRef needle) { + Variant ret = f_stripos(haystack, needle); + if (same(ret, false)) { + return false; + } + return haystack.substr(ret.toInt32()); +} + +Variant f_strpbrk(CStrRef haystack, CStrRef char_list) { + if (char_list.empty()) { + throw InvalidArgumentException("char_list", "(empty)"); + } + char *p = strpbrk(haystack, char_list); + if (p) { + return String(p, CopyString); + } + return false; +} + +Variant f_strpos(CStrRef haystack, CVarRef needle, int offset /* = 0 */) { + int pos; + if (needle.isString()) { + pos = haystack.find(needle.toString(), offset); + } else { + pos = haystack.find(needle.toByte(), offset); + } + if (pos >= 0) return pos; + return false; +} + +Variant f_stripos(CStrRef haystack, CVarRef needle, int offset /* = 0 */) { + int pos; + if (needle.isString()) { + pos = haystack.find(needle.toString(), offset, false); + } else { + pos = haystack.find(needle.toByte(), offset, false); + } + if (pos >= 0) return pos; + return false; +} + +Variant f_strrpos(CStrRef haystack, CVarRef needle, int offset /* = -1 */) { + if (offset < 0) offset += haystack.size(); + int pos; + if (needle.isString()) { + pos = haystack.rfind(needle.toString(), offset); + } else { + pos = haystack.rfind(needle.toByte(), offset); + } + if (pos >= 0) return pos; + return false; +} + +Variant f_strripos(CStrRef haystack, CVarRef needle, int offset /* = -1 */) { + if (offset < 0) offset += haystack.size(); + int pos; + if (needle.isString()) { + pos = haystack.rfind(needle.toString(), offset, false); + } else { + pos = haystack.rfind(needle.toByte(), offset, false); + } + if (pos >= 0) return pos; + return false; +} + +Variant f_substr_count(CStrRef haystack, CStrRef needle, int offset /* = 0 */, + int length /* = 0x7FFFFFFF */) { + int lenNeedle = needle.size(); + if (lenNeedle == 0) { + throw InvalidArgumentException("needle", "(empty)"); + } + + if (offset < 0 || offset > haystack.size()) { + throw InvalidArgumentException("offset", "(out of range)"); + } + if (length == 0x7FFFFFFF) { + length = haystack.size() - offset; + } else if (length <= 0 || length > haystack.size() - offset) { + throw InvalidArgumentException("length", "(out of range)"); + } + + int count = 0; + int posMax = offset + length - lenNeedle; + for (int pos = haystack.find(needle, offset); + pos != -1 && pos <= posMax; + pos = haystack.find(needle, pos + lenNeedle)) { + ++count; + } + return count; +} + +Variant f_strspn(CStrRef str1, CStrRef str2, int start /* = 0 */, + int length /* = 0x7FFFFFFF */) { + String s = str1.substr(start, length); + if (s.isNull()) return false; + return string_span(s, s.size(), str2, str2.size()); +} + +Variant f_strcspn(CStrRef str1, CStrRef str2, int start /* = 0 */, + int length /* = 0x7FFFFFFF */) { + String s = str1.substr(start, length); + if (s.isNull()) return false; + return string_cspan(s, s.size(), str2, str2.size()); +} + +Variant f_count_chars(CStrRef str, int64 mode /* = 0 */) { + int chars[256]; + memset((void*)chars, 0, sizeof(chars)); + const unsigned char *buf = (const unsigned char *)(const char *)str; + for (int len = str.size(); len > 0; len--) { + chars[*buf++]++; + } + + Array retarr; + char retstr[256]; + int retlen = 0; + switch (mode) { + case 0: + for (int inx = 0; inx < 256; inx++) { + retarr.set(inx, chars[inx]); + } + return retarr; + case 1: + for (int inx = 0; inx < 256; inx++) { + if (chars[inx] != 0) { + retarr.set(inx, chars[inx]); + } + } + return retarr; + case 2: + for (int inx = 0; inx < 256; inx++) { + if (chars[inx] == 0) { + retarr.set(inx, chars[inx]); + } + } + return retarr; + case 3: + for (int inx = 0; inx < 256; inx++) { + if (chars[inx] != 0) { + retstr[retlen++] = inx; + } + } + return String(retstr, retlen, CopyString); + case 4: + for (int inx = 0; inx < 256; inx++) { + if (chars[inx] == 0) { + retstr[retlen++] = inx; + } + } + return String(retstr, retlen, CopyString); + } + + throw InvalidArgumentException("mode", mode); +} + +/** + * Counts the number of words inside a string. If format of 1 is specified, + * then the function will return an array containing all the words + * found inside the string. If format of 2 is specified, then the function + * will return an associated array where the position of the word is the key + * and the word itself is the value. + * + * For the purpose of this function, 'word' is defined as a locale dependent + * string containing alphabetic characters, which also may contain, but not + * start with "'" and "-" characters. + */ +Variant f_str_word_count(CStrRef str, int64 format /* = 0 */, + CStrRef charlist /* = "" */) { + int str_len = str.size(); + switch (format) { + case 1: + case 2: + if (!str_len) { + return Array::Create(); + } + break; + case 0: + if (!str_len) { + return 0LL; + } + break; + default: + throw InvalidArgumentException("format", format); + } + + char ch[256]; + const char *char_list = charlist; + if (*char_list) { + string_charmask(charlist, charlist.size(), ch); + } else { + char_list = NULL; + } + + int word_count = 0; + const char *s0 = str; + const char *p = s0; + const char *e = p + str_len; + + // first character cannot be ' or -, unless explicitly allowed by the user + if ((*p == '\'' && (!char_list || !ch[(int)'\''])) || + (*p == '-' && (!char_list || !ch[(int)'-']))) { + p++; + } + + // last character cannot be -, unless explicitly allowed by the user + if (*(e - 1) == '-' && (!char_list || !ch[(int)'-'])) { + e--; + } + + Array ret; + while (p < e) { + const char *s = p; + while (p < e && + (isalpha(*p) || (char_list && ch[(unsigned char)*p]) || + *p == '\'' || *p == '-')) { + p++; + } + if (p > s) { + switch (format) { + case 1: + ret.append(String(s, p - s, CopyString)); + break; + case 2: + ret.set((int)(s - s0), String(s, p - s, CopyString)); + break; + default: + word_count++; + break; + } + } + p++; + } + + if (!format) { + return word_count; + } + return ret; +} + +String f_strtr(CStrRef str, CVarRef from, CVarRef to /* = null_variant */) { + if (str.empty()) { + return str; + } + + if (!to.isNull()) { + return StringUtil::Translate(str, from.toString(), to.toString()); + } + + if (!from.is(KindOfArray)) { + throw InvalidArgumentException("2nd argument", "(not array)"); + } + + int maxlen = 0; + int minlen = -1; + Array arr = from.toArray(); + for (ArrayIter iter(arr); iter; ++iter) { + String search = iter.first(); + if (search.empty()) { + throw InvalidArgumentException("from", "(empty)"); + } + int len = search.size(); + if (maxlen < len) maxlen = len; + if (minlen == -1 || minlen > len) minlen = len; + } + + const char *s = str.data(); + int slen = str.size(); + char *key = (char *)malloc(maxlen+1); + + StringBuffer result(slen); + for (int pos = 0; pos < slen; ) { + if ((pos + maxlen) > slen) { + maxlen = slen - pos; + } + bool found = false; + memcpy(key, s + pos, maxlen); + for (int len = maxlen; len >= minlen; len--) { + key[len] = 0; + if (arr.exists(key)) { + String replace = arr[key].toString(); + if (!replace.empty()) { + result += replace; + } + pos += len; + found = true; + break; + } + } + if (!found) { + result += s[pos++]; + } + } + free(key); + + return result; +} + +void f_parse_str(CStrRef str, Variant arr /* = null */) { + HttpProtocol::DecodeParameters(arr, str.data(), str.size()); +} + +Variant f_setlocale(int _argc, int category, CVarRef locale, CArrRef _argv /* = null_array */) { + Array argv = _argv; + if (locale.is(KindOfArray)) { + if (!argv.empty()) { + throw InvalidArgumentException("locale", "(not string)"); + } + argv = locale; + } + + for (int i = -1; i < argv.size(); i++) { + String slocale; + if (i == -1) { + if (locale.is(KindOfArray)) continue; + slocale = locale.toString(); + } else { + slocale = argv[i].toString(); + } + + const char *loc = slocale; + if (slocale.size() >= 255) { + throw InvalidArgumentException("locale", loc); + } + if (strcmp("0", loc) == 0) { + loc = NULL; + } + { + Lock lock(s_mutex); + const char *retval = setlocale(category, loc); + if (retval) { + return String(retval, CopyString); + } + } + } + return false; +} + +Array f_localeconv() { + struct lconv currlocdata; + { + Lock lock(s_mutex); + struct lconv *res = localeconv(); + currlocdata = *res; + } + + Array ret; +#define SET_LOCALE_STRING(x) ret.set(#x, String(currlocdata.x, CopyString)) + SET_LOCALE_STRING(decimal_point); + SET_LOCALE_STRING(thousands_sep); + SET_LOCALE_STRING(int_curr_symbol); + SET_LOCALE_STRING(currency_symbol); + SET_LOCALE_STRING(mon_decimal_point); + SET_LOCALE_STRING(mon_thousands_sep); + SET_LOCALE_STRING(positive_sign); + SET_LOCALE_STRING(negative_sign); +#define SET_LOCALE_INTEGER(x) ret.set(#x, currlocdata.x) + SET_LOCALE_INTEGER(int_frac_digits); + SET_LOCALE_INTEGER(frac_digits); + SET_LOCALE_INTEGER(p_cs_precedes); + SET_LOCALE_INTEGER(p_sep_by_space); + SET_LOCALE_INTEGER(n_cs_precedes); + SET_LOCALE_INTEGER(n_sep_by_space); + SET_LOCALE_INTEGER(p_sign_posn); + SET_LOCALE_INTEGER(n_sign_posn); + + Array grouping, mon_grouping; + + /* Grab the grouping data out of the array */ + int len = strlen(currlocdata.grouping); + for (int i = 0; i < len; i++) { + grouping.set(i, currlocdata.grouping[i]); + } + ret.set("grouping", grouping); + + /* Grab the monetary grouping data out of the array */ + len = strlen(currlocdata.mon_grouping); + for (int i = 0; i < len; i++) { + mon_grouping.set(i, currlocdata.mon_grouping[i]); + } + ret.set("mon_grouping", mon_grouping); + + return ret; +} + +String f_convert_cyr_string(CStrRef str, CStrRef from, CStrRef to) { + char ch_from = ((const char *)from)[0]; + char ch_to = ((const char *)to)[0]; + char *ret = string_convert_cyrillic_string(str.data(), str.size(), + ch_from, ch_to); + return String(ret, str.size(), AttachString); +} + +String f_hebrev(CStrRef hebrew_text, int max_chars_per_line /* = 0 */) { + if (hebrew_text.empty()) return hebrew_text; + int len = hebrew_text.size(); + char *ret = string_convert_hebrew_string(hebrew_text.data(), len, + max_chars_per_line, false); + return String(ret, len, AttachString); +} + +String f_hebrevc(CStrRef hebrew_text, int max_chars_per_line /* = 0 */) { + if (hebrew_text.empty()) return hebrew_text; + int len = hebrew_text.size(); + char *ret = string_convert_hebrew_string(hebrew_text.data(), len, + max_chars_per_line, true); + return String(ret, len, AttachString); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_string.h b/src/cpp/ext/ext_string.h new file mode 100644 index 0000000000000..bcee40bc4f4ab --- /dev/null +++ b/src/cpp/ext/ext_string.h @@ -0,0 +1,348 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_STRING_H__ +#define __EXT_STRING_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// transformations and manipulations + +inline String f_addcslashes(CStrRef str, CStrRef charlist) { + return StringUtil::CEncode(str, charlist); +} +inline String f_stripcslashes(CStrRef str) { + return StringUtil::CDecode(str); +} +inline String f_addslashes(CStrRef str) { + return StringUtil::SqlEncode(str); +} +inline String f_stripslashes(CStrRef str) { + return StringUtil::SqlDecode(str); +} +inline String f_bin2hex(CStrRef str) { + return StringUtil::HexEncode(str); +} +inline String f_nl2br(CStrRef str) { + return str.replace("\n", "
    \n"); +} +inline String f_quotemeta(CStrRef str) { + return StringUtil::RegExEncode(str); +} +inline String f_str_shuffle(CStrRef str) { + return StringUtil::Shuffle(str); +} +inline String f_strrev(CStrRef str) { + return StringUtil::Reverse(str); +} +inline String f_strtolower(CStrRef str) { + return StringUtil::ToLower(str); +} +inline String f_strtoupper(CStrRef str) { + return StringUtil::ToUpper(str, StringUtil::ToUpperAll); +} +inline String f_ucfirst(CStrRef str) { + return StringUtil::ToUpper(str, StringUtil::ToUpperFirst); +} +inline String f_ucwords(CStrRef str) { + return StringUtil::ToUpper(str, StringUtil::ToUpperWords); +} +inline String f_strip_tags(CStrRef str, CStrRef allowable_tags = "") { + return StringUtil::StripHTMLTags(str, allowable_tags); +} +inline String f_trim(CStrRef str, CStrRef charlist = k_HPHP_TRIM_CHARLIST) { + return StringUtil::Trim(str, StringUtil::TrimBoth, charlist); +} +inline String f_ltrim(CStrRef str, CStrRef charlist = k_HPHP_TRIM_CHARLIST) { + return StringUtil::Trim(str, StringUtil::TrimLeft, charlist); +} +inline String f_rtrim(CStrRef str, CStrRef charlist = k_HPHP_TRIM_CHARLIST) { + return StringUtil::Trim(str, StringUtil::TrimRight, charlist); +} +inline String f_chop(CStrRef str, CStrRef charlist = k_HPHP_TRIM_CHARLIST) { + return StringUtil::Trim(str, StringUtil::TrimRight, charlist); +} +inline Array f_explode(CStrRef delimiter, CStrRef str, int limit = 0x7FFFFFFF) { + return StringUtil::Explode(str, delimiter, limit); +} + +String f_implode(CVarRef arg1, CVarRef arg2 = null_variant); + +inline String f_join(CVarRef glue, CVarRef pieces = null_variant) { + return f_implode(glue, pieces); +} +inline Array f_str_split(CStrRef str, int split_length = 1) { + return StringUtil::Split(str, split_length); +} +inline String f_chunk_split(CStrRef body, int chunklen = 76, + CStrRef end = "\r\n") { + return StringUtil::ChunkSplit(body, chunklen, end); +} + +Variant f_strtok(CStrRef str, CVarRef token = null_variant); + +Variant f_str_replace(CVarRef search, CVarRef replace, CVarRef subject, + Variant count = null); +Variant f_str_ireplace(CVarRef search, CVarRef replace, CVarRef subject, + Variant count = null); +Variant f_substr_replace(CVarRef str, CVarRef replacement, CVarRef start, + CVarRef length = 0x7FFFFFFF); + +inline Variant f_substr(CStrRef str, int start, int length = 0x7FFFFFFF) { + String ret = str.substr(start, length); + if (ret.isNull()) return false; + return ret; +} +inline String f_str_pad(CStrRef input, int pad_length, CStrRef pad_string = " ", + int pad_type = k_STR_PAD_RIGHT) { + return StringUtil::Pad(input, pad_length, pad_string, + (StringUtil::PadType)pad_type); +} +inline String f_str_repeat(CStrRef input, int multiplier) { + return StringUtil::Repeat(input, multiplier); +} +inline String f_wordwrap(CStrRef str, int width = 75, CStrRef wordbreak = "\n", + bool cut = false) { + return StringUtil::WordWrap(str, width, wordbreak, cut); +} + +/////////////////////////////////////////////////////////////////////////////// +// encoding/decoding + +inline String f_html_entity_decode(CStrRef str, int quote_style = k_ENT_COMPAT, + CStrRef charset = "") { + // dropping quote_style parameter, as I don't see why decoding needs to check + // dropping charset parameter and see cpp/base/zend_html.h + return StringUtil::HtmlDecode(str); +} +inline String f_htmlentities(CStrRef str, int quote_style = k_ENT_COMPAT, + CStrRef charset = "", bool double_encode = true) { + // dropping charset and double_encode parameters and see cpp/base/zend_html.h + return StringUtil::HtmlEncode(str, (StringUtil::QuoteStyle)quote_style); +} +inline String f_htmlspecialchars_decode(CStrRef str, + int quote_style = k_ENT_COMPAT) { + // dropping quote_style parameter, as I don't see why decoding needs to check + return StringUtil::HtmlDecode(str); +} +inline String f_htmlspecialchars(CStrRef str, int quote_style = k_ENT_COMPAT, + CStrRef charset = "", + bool double_encode = true) { + // dropping charset and double_encode parameters and see cpp/base/zend_html.h + return StringUtil::HtmlEncode(str, (StringUtil::QuoteStyle)quote_style); +} +inline String f_quoted_printable_encode(CStrRef str) { + return StringUtil::QuotedPrintableEncode(str); +} +inline String f_quoted_printable_decode(CStrRef str) { + return StringUtil::QuotedPrintableDecode(str); +} +inline Variant f_convert_uudecode(CStrRef data) { + String ret = StringUtil::UUDecode(data); + if (ret.isNull()) { + return false; // bad format + } + return ret; +} +inline Variant f_convert_uuencode(CStrRef data) { + if (data.empty()) return false; + return StringUtil::UUEncode(data); +} +inline String f_str_rot13(CStrRef str) { + return StringUtil::ROT13(str); +} +inline int64 f_crc32(CStrRef str) { + return (uint32)StringUtil::CRC32(str); +} +inline String f_crypt(CStrRef str, CStrRef salt = "") { + return StringUtil::Crypt(str, salt); +} +inline String f_md5(CStrRef str, bool raw_output = false) { + return StringUtil::MD5(str, raw_output); +} +inline String f_sha1(CStrRef str, bool raw_output = false) { + return StringUtil::SHA1(str, raw_output); +} +String f_strtr(CStrRef str, CVarRef from, CVarRef to = null_variant); + +String f_convert_cyr_string(CStrRef str, CStrRef from, CStrRef to); + +inline Array f_get_html_translation_table(int table = 0, + int quote_style = k_ENT_COMPAT) { + return string_get_html_translation_table(table, quote_style); +} + +String f_hebrev(CStrRef hebrew_text, int max_chars_per_line = 0); + +String f_hebrevc(CStrRef hebrew_text, int max_chars_per_line = 0); + +Variant f_setlocale(int _argc, int category, CVarRef locale, CArrRef _argv = null_array); +Array f_localeconv(); + +inline String f_nl_langinfo(int item) { +#ifdef MAC_OS_X + return String(); +#else + return nl_langinfo(item); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// +// input/output + +inline void f_echo(int _argc, CStrRef arg, CArrRef _argv = null_array) { + echo(arg); + for (int i = 0; i < _argv.size(); i++) echo(_argv[i]); +} +inline int f_print(CStrRef arg) { + return print(arg); +} +inline int f_printf(int _argc, CStrRef format, CArrRef _argv = null_array) { + int len = 0; char *output = string_printf(format.data(), format.size(), + _argv, &len); + echo(output); free(output); + return len; +} +inline int f_vprintf(CStrRef format, CArrRef args) { + int len = 0; char *output = string_printf(format.data(), format.size(), + args, &len); + echo(output); free(output); + return len; +} +inline String f_sprintf(int _argc, CStrRef format, CArrRef _argv = null_array) { + char *output = string_printf(format.data(), format.size(), _argv, NULL); + return String(output, AttachString); +} +inline String f_vsprintf(CStrRef format, CArrRef args) { + char *output = string_printf(format.data(), format.size(), args, NULL); + return String(output, AttachString); +} + +Variant f_sscanf(int _argc, CStrRef str, CStrRef format, CArrRef _argv = null_array); + +inline String f_chr(int64 ascii) { + char buf[2]; buf[0] = ascii; buf[1] = 0; + return String(buf, 1, CopyString); +} +inline int64 f_ord(CStrRef str) { + return (int64)(unsigned char)(*((const char *)str)); +} +inline String f_money_format(CStrRef format, double number) { + return StringUtil::MoneyFormat(format, number); +} +String f_number_format(double number, int decimals = 0, CStrRef dec_point = ".", + CStrRef thousands_sep = ","); + +/////////////////////////////////////////////////////////////////////////////// +// analysis + +inline int f_strcmp(CStrRef str1, CStrRef str2) { + return string_strcmp(str1.data(), str1.size(), str2.data(), str2.size()); +} +inline int f_strncmp(CStrRef str1, CStrRef str2, int len) { + return string_strncmp(str1.data(), str1.size(), str2.data(), str2.size(), + len); +} +inline int f_strnatcmp(CStrRef str1, CStrRef str2) { + return string_natural_cmp(str1.data(), str1.size(), str2.data(), str2.size(), + false); +} +inline int f_strcasecmp(CStrRef str1, CStrRef str2) { + return string_strcasecmp(str1.data(), str1.size(), str2.data(), str2.size()); +} +inline int f_strncasecmp(CStrRef str1, CStrRef str2, int len) { + return string_strncasecmp(str1.data(), str1.size(), str2.data(), str2.size(), + len); +} +inline int f_strnatcasecmp(CStrRef str1, CStrRef str2) { + return string_natural_cmp(str1.data(), str1.size(), str2.data(), str2.size(), + true); +} +inline int f_strcoll(CStrRef str1, CStrRef str2) { + return strcoll(str1, str2); +} + +Variant f_substr_compare(CStrRef main_str, CStrRef str, int offset, + int length = 0, bool case_insensitivity = false); + +Variant f_strrchr(CStrRef haystack, CVarRef needle); +Variant f_strstr(CStrRef haystack, CVarRef needle); +Variant f_stristr(CStrRef haystack, CVarRef needle); +Variant f_strpbrk(CStrRef haystack, CStrRef char_list); + +inline Variant f_strchr(CStrRef haystack, CVarRef needle) { + return f_strstr(haystack, needle); +} + +Variant f_strpos(CStrRef haystack, CVarRef needle, int offset = 0); +Variant f_stripos(CStrRef haystack, CVarRef needle, int offset = 0); +Variant f_strrpos(CStrRef haystack, CVarRef needle, int offset = -1); +Variant f_strripos(CStrRef haystack, CVarRef needle, int offset = -1); + +Variant f_substr_count(CStrRef haystack, CStrRef needle, int offset = 0, + int length = 0x7FFFFFFF); +Variant f_strspn(CStrRef str1, CStrRef str2, int start = 0, + int length = 0x7FFFFFFF); +Variant f_strcspn(CStrRef str1, CStrRef str2, int start = 0, + int length = 0x7FFFFFFF); +inline int f_strlen(CStrRef str) { + return str.size(); +} + +Variant f_count_chars(CStrRef str, int64 mode = 0); + +Variant f_str_word_count(CStrRef str, int64 format = 0, CStrRef charlist = ""); + +inline int f_levenshtein(CStrRef str1, CStrRef str2, int cost_ins = 1, + int cost_rep = 1, int cost_del = 1) { + return string_levenshtein(str1, str1.size(), str2, str2.size(), + cost_ins, cost_rep, cost_del); +} +inline int f_similar_text(CStrRef first, CStrRef second, Variant percent = null) { + float p; + int ret = string_similar_text(first, first.size(), second, second.size(), + &p); + percent = p; + return ret; +} +inline Variant f_soundex(CStrRef str) { + if (str.empty()) return false; + return String(string_soundex(str), AttachString); +} +inline Variant f_metaphone(CStrRef str, int phones = 0) { + char *ret = string_metaphone(str, str.size(), 0, 1); + if (ret) { + return String(ret, AttachString); + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// special + +void f_parse_str(CStrRef str, Variant arr = null); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_STRING_H__ diff --git a/src/cpp/ext/ext_thread.cpp b/src/cpp/ext/ext_thread.cpp new file mode 100644 index 0000000000000..25840a6af26e9 --- /dev/null +++ b/src/cpp/ext/ext_thread.cpp @@ -0,0 +1,37 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +void f_hphp_service_thread_started() { + ServiceThread::GetThisThread()->notifyStarted(); +} + +bool f_hphp_thread_is_warmup_enabled() { + return hphp_is_warmup_enabled(); +} + +void f_hphp_thread_set_warmup_enabled() { + hphp_set_warmup_enabled(); +} +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_thread.h b/src/cpp/ext/ext_thread.h new file mode 100644 index 0000000000000..809511223ed25 --- /dev/null +++ b/src/cpp/ext/ext_thread.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_THREAD_H__ +#define __EXT_THREAD_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +void f_hphp_service_thread_started(); +bool f_hphp_thread_is_warmup_enabled(); +void f_hphp_thread_set_warmup_enabled(); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_THREAD_H__ diff --git a/src/cpp/ext/ext_thrift.cpp b/src/cpp/ext/ext_thrift.cpp new file mode 100644 index 0000000000000..f232a90f9ebdf --- /dev/null +++ b/src/cpp/ext/ext_thrift.cpp @@ -0,0 +1,719 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define htonll(x) bswap_64(x) +#define ntohll(x) bswap_64(x) +#else +#define htonll(x) x +#define ntohll(x) x +#endif + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +enum TType { + T_STOP = 0, + T_VOID = 1, + T_BOOL = 2, + T_BYTE = 3, + T_I08 = 3, + T_I16 = 6, + T_I32 = 8, + T_U64 = 9, + T_I64 = 10, + T_DOUBLE = 4, + T_STRING = 11, + T_UTF7 = 11, + T_STRUCT = 12, + T_MAP = 13, + T_SET = 14, + T_LIST = 15, + T_UTF8 = 16, + T_UTF16 = 17 +}; + +const int32_t VERSION_MASK = 0xffff0000; +const int32_t VERSION_1 = 0x80010000; +const int8_t T_CALL = 1; +const int8_t T_REPLY = 2; +const int8_t T_EXCEPTION = 3; +// tprotocolexception +const int INVALID_DATA = 1; +const int BAD_VERSION = 4; + + +class PHPTransport { +public: + Object protocol() { return p; } + Object transport() { return t; } +protected: + PHPTransport() {} + + void construct_with_zval(CObjRef _p, size_t _buffer_size) { + buffer = reinterpret_cast(malloc(_buffer_size)); + buffer_ptr = buffer; + buffer_used = 0; + buffer_size = _buffer_size; + p = _p; + t = p->o_invoke("getTransport", Array(), -1); + } + ~PHPTransport() { + free(buffer); + } + + char* buffer; + char* buffer_ptr; + size_t buffer_used; + size_t buffer_size; + + Object p; + Object t; +}; + + +class PHPOutputTransport : public PHPTransport { +public: + PHPOutputTransport(CObjRef _p, size_t _buffer_size = 8192) { + construct_with_zval(_p, _buffer_size); + } + + ~PHPOutputTransport() { + flush(); + directFlush(); + } + + void write(const char* data, size_t len) { + if ((len + buffer_used) > buffer_size) { + flush(); + } + if (len > buffer_size) { + directWrite(data, len); + } else { + memcpy(buffer_ptr, data, len); + buffer_used += len; + buffer_ptr += len; + } + } + + void writeI64(int64_t i) { + i = htonll(i); + write((const char*)&i, 8); + } + + void writeU32(uint32_t i) { + i = htonl(i); + write((const char*)&i, 4); + } + + void writeI32(int32_t i) { + i = htonl(i); + write((const char*)&i, 4); + } + + void writeI16(int16_t i) { + i = htons(i); + write((const char*)&i, 2); + } + + void writeI8(int8_t i) { + write((const char*)&i, 1); + } + + void writeString(const char* str, size_t len) { + writeU32(len); + write(str, len); + } + + void flush() { + if (buffer_used) { + directWrite(buffer, buffer_used); + buffer_ptr = buffer; + buffer_used = 0; + } + } + +protected: + void directFlush() { + t->o_invoke("flush", Array(), -1); + } + void directWrite(const char* data, size_t len) { + Array args = CREATE_VECTOR1(String(buffer, buffer_used, CopyString)); + t->o_invoke("write", args, -1); + } +}; + +class PHPInputTransport : public PHPTransport { +public: + PHPInputTransport(Object _p, size_t _buffer_size = 8192) { + construct_with_zval(_p, _buffer_size); + } + + ~PHPInputTransport() { + put_back(); + } + + void put_back() { + if (buffer_used) { + t->o_invoke("putBack", + CREATE_VECTOR1(String(buffer_ptr, buffer_used, CopyString)), + -1); + } + buffer_used = 0; + buffer_ptr = buffer; + } + + void skip(size_t len) { + while (len) { + size_t chunk_size = len < buffer_used ? len : buffer_used; + if (chunk_size) { + buffer_ptr = reinterpret_cast(buffer_ptr) + chunk_size; + buffer_used -= chunk_size; + len -= chunk_size; + } + if (! len) break; + refill(); + } + } + + void readBytes(void* buf, size_t len) { + while (len) { + size_t chunk_size = len < buffer_used ? len : buffer_used; + if (chunk_size) { + memcpy(buf, buffer_ptr, chunk_size); + buffer_ptr = reinterpret_cast(buffer_ptr) + chunk_size; + buffer_used -= chunk_size; + buf = reinterpret_cast(buf) + chunk_size; + len -= chunk_size; + } + if (! len) break; + refill(); + } + } + + int8_t readI8() { + int8_t c; + readBytes(&c, 1); + return c; + } + + int16_t readI16() { + int16_t c; + readBytes(&c, 2); + return (int16_t)ntohs(c); + } + + uint32_t readU32() { + uint32_t c; + readBytes(&c, 4); + return (uint32_t)ntohl(c); + } + + int32_t readI32() { + int32_t c; + readBytes(&c, 4); + return (int32_t)ntohl(c); + } + +protected: + void refill() { + ASSERT(buffer_used == 0); + String ret = t->o_invoke("read", + CREATE_VECTOR1((int64)buffer_size), -1).toString(); + buffer_used = ret.size(); + memcpy(buffer, ret.data(), buffer_used); + buffer_ptr = buffer; + } + +}; + +void binary_deserialize_spec(CObjRef zthis, PHPInputTransport& transport, CArrRef spec); +void binary_serialize_spec(CObjRef zthis, PHPOutputTransport& transport, CArrRef spec); +void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, CVarRef value, CArrRef fieldspec); +void skip_element(long thrift_typeID, PHPInputTransport& transport); + +// Create a PHP object given a typename and call the ctor, optionally passing up to 2 arguments +Object createObject(CStrRef obj_typename, int nargs = 0, + CVarRef arg1 = null_variant, CVarRef arg2 = null_variant) { + if (!f_class_exists(obj_typename)) { + Logger::Error("cpp/ext_thrift: Class %s does not exist", + obj_typename.data()); + return Object(); + } + Array args; + if (nargs == 1) { + args = CREATE_VECTOR1(arg1); + } else if (nargs == 2 ) { + args = CREATE_VECTOR2(arg1, arg2); + } + return create_object(obj_typename.data(), args); +} + +void throw_tprotocolexception(CStrRef what, long errorcode) { + Object ex = createObject("TProtocolException", 2, what, errorcode); + throw ex; +} + +Variant binary_deserialize(int8_t thrift_typeID, PHPInputTransport& transport, + CArrRef fieldspec) { + Variant ret; + switch (thrift_typeID) { + case T_STOP: + case T_VOID: + return null; + case T_STRUCT: { + Variant val; + if ((val = fieldspec.rvalAt("class")).isNull()) { + throw_tprotocolexception("no class type in spec", INVALID_DATA); + skip_element(T_STRUCT, transport); + return null; + } + String structType = val.toString(); + ret = createObject(structType); + if (ret.isNull()) { + // unable to create class entry + skip_element(T_STRUCT, transport); + return null; + } + Variant spec = get_static_property(structType, "_TSPEC"); + if (!spec.is(KindOfArray)) { + char errbuf[128]; + snprintf(errbuf, 128, "spec for %s is wrong type: %d\n", + structType.data(), ret.getType()); + throw_tprotocolexception(String(errbuf, CopyString), INVALID_DATA); + return null; + } + binary_deserialize_spec(ret, transport, spec.toArray()); + return ret; + } break; + case T_BOOL: { + uint8_t c; + transport.readBytes(&c, 1); + return c != 0; + } + //case T_I08: // same numeric value as T_BYTE + case T_BYTE: { + uint8_t c; + transport.readBytes(&c, 1); + return c; + } + case T_I16: { + uint16_t c; + transport.readBytes(&c, 2); + return ntohs(c); + } + case T_I32: { + uint32_t c; + transport.readBytes(&c, 4); + return Variant((int)ntohl(c)); + } + case T_U64: + case T_I64: { + uint64_t c; + transport.readBytes(&c, 8); + return Variant((int64)ntohll(c)); + } + case T_DOUBLE: { + union { + uint64_t c; + double d; + } a; + transport.readBytes(&(a.c), 8); + a.c = ntohll(a.c); + return a.d; + } + //case T_UTF7: // aliases T_STRING + case T_UTF8: + case T_UTF16: + case T_STRING: { + uint32_t size = transport.readU32(); + if (size && (size + 1)) { + char* strbuf = (char*) malloc(size + 1); + transport.readBytes(strbuf, size); + strbuf[size] = '\0'; + return String(strbuf, size, AttachString); + } else { + return ""; + } + } + case T_MAP: { // array of key -> value + uint8_t types[2]; + transport.readBytes(types, 2); + uint32_t size = transport.readU32(); + + Array keyspec = fieldspec.rvalAt("key", -1).toArray(); + Array valspec = fieldspec.rvalAt("val", -1).toArray(); + ret = Array::Create(); + + for (uint32_t s = 0; s < size; ++s) { + Variant key = binary_deserialize(types[0], transport, keyspec); + Variant value = binary_deserialize(types[1], transport, valspec); + ret.set(key, value); + } + return ret; // return_value already populated + } + case T_LIST: { // array with autogenerated numeric keys + int8_t type = transport.readI8(); + uint32_t size = transport.readU32(); + Variant elemvar = fieldspec.rvalAt("elem", -1); + Array elemspec = elemvar.toArray(); + ret = Array::Create(); + + for (uint32_t s = 0; s < size; ++s) { + Variant value = binary_deserialize(type, transport, elemspec); + ret.append(value); + } + return ret; + } + case T_SET: { // array of key -> TRUE + uint8_t type; + uint32_t size; + transport.readBytes(&type, 1); + transport.readBytes(&size, 4); + size = ntohl(size); + Variant elemvar = fieldspec.rvalAt("elem", -1); + Array elemspec = elemvar.toArray(); + ret = Array::Create(); + + for (uint32_t s = 0; s < size; ++s) { + Variant key = binary_deserialize(type, transport, elemspec); + + if (key.isInteger()) { + ret.set(key, true); + } else { + ret.set(key.toString(), true); + } + } + return ret; + } + }; + + char errbuf[128]; + sprintf(errbuf, "Unknown thrift typeID %d", thrift_typeID); + throw_tprotocolexception(String(errbuf, CopyString), INVALID_DATA); + return null; +} + +void skip_element(long thrift_typeID, PHPInputTransport& transport) { + switch (thrift_typeID) { + case T_STOP: + case T_VOID: + return; + case T_STRUCT: + while (true) { + int8_t ttype = transport.readI8(); // get field type + if (ttype == T_STOP) break; + transport.skip(2); // skip field number, I16 + skip_element(ttype, transport); // skip field payload + } + return; + case T_BOOL: + case T_BYTE: + transport.skip(1); + return; + case T_I16: + transport.skip(2); + return; + case T_I32: + transport.skip(4); + return; + case T_U64: + case T_I64: + case T_DOUBLE: + transport.skip(8); + return; + //case T_UTF7: // aliases T_STRING + case T_UTF8: + case T_UTF16: + case T_STRING: { + uint32_t len = transport.readU32(); + transport.skip(len); + } return; + case T_MAP: { + int8_t keytype = transport.readI8(); + int8_t valtype = transport.readI8(); + uint32_t size = transport.readU32(); + for (uint32_t i = 0; i < size; ++i) { + skip_element(keytype, transport); + skip_element(valtype, transport); + } + } return; + case T_LIST: + case T_SET: { + int8_t valtype = transport.readI8(); + uint32_t size = transport.readU32(); + for (uint32_t i = 0; i < size; ++i) { + skip_element(valtype, transport); + } + } return; + }; + + char errbuf[128]; + sprintf(errbuf, "Unknown thrift typeID %ld", thrift_typeID); + throw_tprotocolexception(String(errbuf, CopyString), INVALID_DATA); +} + +void binary_serialize_hashtable_key(int8_t keytype, PHPOutputTransport& transport, + Variant key) { + bool keytype_is_numeric = (!((keytype == T_STRING) || (keytype == T_UTF8) || + (keytype == T_UTF16))); + + if (keytype_is_numeric) { + key = key.toInt64(); + } else { + key = key.toString(); + } + binary_serialize(keytype, transport, key, Array()); +} + +inline bool ttype_is_int(int8_t t) { + return ((t == T_BYTE) || ((t >= T_I16) && (t <= T_I64))); +} + +inline bool ttypes_are_compatible(int8_t t1, int8_t t2) { + // Integer types of different widths are considered compatible; + // otherwise the typeID must match. + return ((t1 == t2) || (ttype_is_int(t1) && ttype_is_int(t2))); +} + +void binary_deserialize_spec(CObjRef zthis, PHPInputTransport& transport, + CArrRef spec) { + // SET and LIST have 'elem' => array('type', [optional] 'class') + // MAP has 'val' => array('type', [optiona] 'class') + while (true) { + Variant val; + + int8_t ttype = transport.readI8(); + if (ttype == T_STOP) return; + int16_t fieldno = transport.readI16(); + if (!(val = spec.rvalAt(fieldno)).isNull()) { + Array fieldspec = val.toArray(); + // pull the field name + // zend hash tables use the null at the end in the length... so strlen(hash key) + 1. + String varname = fieldspec.rvalAt("var").toString(); + + // and the type + int8_t expected_ttype = fieldspec.rvalAt("type").toInt64(); + + if (ttypes_are_compatible(ttype, expected_ttype)) { + Variant rv = binary_deserialize(ttype, transport, fieldspec); + zthis->set(varname, rv); + } else { + skip_element(ttype, transport); + } + } else { + skip_element(ttype, transport); + } + } +} + +void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, + CVarRef value, CArrRef fieldspec) { + // At this point the typeID (and field num, if applicable) should've already + // been written to the output so all we need to do is write the payload. + switch (thrift_typeID) { + case T_STOP: + case T_VOID: + return; + case T_STRUCT: { + if (!value.is(KindOfObject)) { + throw_tprotocolexception("Attempt to send non-object " + "type as a T_STRUCT", INVALID_DATA); + } + binary_serialize_spec(value, transport, + get_static_property(toObject(value)-> + o_getClassName(), + "_TSPEC").toArray()); + } return; + case T_BOOL: + transport.writeI8(value.toBoolean() ? 1 : 0); + return; + case T_BYTE: + transport.writeI8(value.toByte()); + return; + case T_I16: + transport.writeI16(value.toInt16()); + return; + case T_I32: + transport.writeI32(value.toInt32()); + return; + case T_I64: + case T_U64: + transport.writeI64(value.toInt64()); + return; + case T_DOUBLE: { + union { + int64_t c; + double d; + } a; + a.d = value.toDouble(); + transport.writeI64(a.c); + } return; + //case T_UTF7: + case T_UTF8: + case T_UTF16: + case T_STRING: { + String sv = value.toString(); + transport.writeString(sv, sv.size()); + } return; + case T_MAP: { + Array ht = value.toArray(); + uint8_t keytype = fieldspec.rvalAt("ktype", -1).toByte(); + transport.writeI8(keytype); + uint8_t valtype = fieldspec.rvalAt("vtype", -1).toByte(); + transport.writeI8(valtype); + + Array valspec = fieldspec.rvalAt("val", -1).toArray(); + + transport.writeI32(ht.size()); + for (ArrayIter key_ptr = ht.begin(); !key_ptr.end(); ++key_ptr) { + binary_serialize_hashtable_key(keytype, transport, key_ptr.first()); + binary_serialize(valtype, transport, key_ptr.second(), valspec); + } + } return; + case T_LIST: { + Array ht = value.toArray(); + Variant val; + + uint8_t valtype = fieldspec.rvalAt("etype", -1).toInt64(); + transport.writeI8(valtype); + Array valspec = fieldspec.rvalAt("elem", -1).toArray(); + transport.writeI32(ht.size()); + for (ArrayIter key_ptr = ht.begin(); !key_ptr.end(); ++key_ptr) { + binary_serialize(valtype, transport, key_ptr.second(), valspec); + } + } return; + case T_SET: { + Array ht = value.toArray(); + + uint8_t keytype = fieldspec.rvalAt("etype", -1).toByte(); + transport.writeI8(keytype); + + transport.writeI32(ht.size()); + for (ArrayIter key_ptr = ht.begin(); !key_ptr.end(); ++key_ptr) { + binary_serialize_hashtable_key(keytype, transport, key_ptr.first()); + } + } return; + }; + char errbuf[128]; + sprintf(errbuf, "Unknown thrift typeID %d", thrift_typeID); + throw_tprotocolexception(String(errbuf, CopyString), INVALID_DATA); +} + + +void binary_serialize_spec(CObjRef zthis, PHPOutputTransport& transport, + CArrRef spec) { + for (ArrayIter key_ptr = spec.begin(); !key_ptr.end(); ++key_ptr) { + Variant key = key_ptr.first(); + if (!key.isInteger()) { + throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA); + return; + } + ulong fieldno = key.toInt64(); + Array fieldspec = key_ptr.second().toArray(); + + // field name + String varname = fieldspec.rvalAt("var", -1).toString(); + + // thrift type + int8_t ttype = fieldspec.rvalAt("type", -1).toByte(); + + Variant prop = zthis->o_get(varname, -1); + if (!prop.isNull()) { + transport.writeI8(ttype); + transport.writeI16(fieldno); + binary_serialize(ttype, transport, prop, fieldspec); + } + } + transport.writeI8(T_STOP); // struct end +} + +void f_thrift_protocol_write_binary(CObjRef transportobj, CStrRef method_name, + int64 msgtype, CObjRef request_struct, + int seqid, bool strict_write) { + + PHPOutputTransport transport(transportobj); + + if (strict_write) { + int32_t version = VERSION_1 | msgtype; + transport.writeI32(version); + transport.writeString(method_name, method_name.size()); + transport.writeI32(seqid); + } else { + transport.writeString(method_name, method_name.size()); + transport.writeI8(msgtype); + transport.writeI32(seqid); + } + + Variant spec = get_static_property(request_struct->o_getClassName(), + "_TSPEC"); + binary_serialize_spec(request_struct, transport, spec.toArray()); +} + +Variant f_thrift_protocol_read_binary(CObjRef transportobj, + CStrRef obj_typename, + bool strict_read) { + PHPInputTransport transport(transportobj); + int8_t messageType = 0; + int32_t sz = transport.readI32(); + + if (sz < 0) { + // Check for correct version number + int32_t version = sz & VERSION_MASK; + if (version != VERSION_1) { + throw_tprotocolexception("Bad version identifier", BAD_VERSION); + } + messageType = (sz & 0x000000ff); + int32_t namelen = transport.readI32(); + // skip the name string and the sequence ID, we don't care about those + transport.skip(namelen + 4); + } else { + if (strict_read) { + throw_tprotocolexception("No version identifier... old protocol client in strict mode?", BAD_VERSION); + } else { + // Handle pre-versioned input + transport.skip(sz); // skip string body + messageType = transport.readI8(); + transport.skip(4); // skip sequence number + } + } + + if (messageType == T_EXCEPTION) { + Object ex = createObject("TApplicationException"); + Variant spec = get_static_property("TApplicationException", "_TSPEC"); + binary_deserialize_spec(ex, transport, spec.toArray()); + throw ex; + } + + Object ret_val = createObject(obj_typename); + Variant spec = get_static_property(obj_typename, "_TSPEC"); + binary_deserialize_spec(ret_val, transport, spec.toArray()); + return ret_val; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_thrift.h b/src/cpp/ext/ext_thrift.h new file mode 100644 index 0000000000000..b5c55991c4e02 --- /dev/null +++ b/src/cpp/ext/ext_thrift.h @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_THRIFT_H__ +#define __EXT_THRIFT_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +void f_thrift_protocol_write_binary(CObjRef transportobj, CStrRef method_name, int64 msgtype, CObjRef request_struct, int seqid, bool strict_write); +Variant f_thrift_protocol_read_binary(CObjRef transportobj, CStrRef obj_typename, bool strict_read); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_THRIFT_H__ diff --git a/src/cpp/ext/ext_url.cpp b/src/cpp/ext/ext_url.cpp new file mode 100644 index 0000000000000..1c37dc6b08c87 --- /dev/null +++ b/src/cpp/ext/ext_url.cpp @@ -0,0 +1,249 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_base64_decode(CStrRef data, bool strict /* = false */) { + String decoded = StringUtil::Base64Decode(data, strict); + if (decoded.isNull()) { + return false; + } + return decoded; +} + +String f_base64_encode(CStrRef data) { + String encoded = StringUtil::Base64Encode(data); + if (encoded.isNull()) { + return false; + } + return encoded; +} + +Variant f_get_headers(CStrRef url, int format /* = 0 */) { + Variant c = f_curl_init(); + f_curl_setopt(c, k_CURLOPT_URL, url); + f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true); + f_curl_setopt(c, k_CURLOPT_HEADER, 1); + Variant res = f_curl_exec(c); + if (same(res, false)) { + return false; + } + + String response = res.toString(); + int pos = response.find("\r\n\r\n"); + if (pos != String::npos) { + response = response.substr(0, pos); + } + + Array ret = f_explode("\r\n", response); + if (!format) { + return ret; + } + + Array assoc; + for (ArrayIter iter(ret); iter; ++iter) { + Array tokens = f_explode(": ", iter.second(), 2); + if (tokens.size() == 2) { + assoc.set(tokens[0], tokens[1]); + } else { + assoc.append(iter.second()); + } + } + return assoc; +} + +static String normalize_variable_name(CStrRef name) { + StringBuffer sb; + for (int i = 0; i < name.size(); i++) { + char ch = name.charAt(i); + if ((i > 0 && ch >= '0' && ch <= '9') || + (ch >= 'a' && ch <= 'z') || + (ch == '_')) { + sb.append(ch); + } else if (ch >= 'A' && ch <= 'Z') { + sb.append((char)(ch + 'a' - 'A')); + } else { + sb.append('_'); + } + } + return sb; +} + +Array f_get_meta_tags(CStrRef filename, bool use_include_path /* = false */) { + String f = f_file_get_contents(filename); + + Variant matches; + f_preg_match_all("//s", + f, ref(matches), k_PREG_SET_ORDER); + + Array ret = Array::Create(); + for (ArrayIter iter(matches); iter; ++iter) { + Array pair = iter.second(); + ret.set(normalize_variable_name(pair[1].toString()), pair[2]); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +static void url_encode_array(StringBuffer &ret, CArrRef arr, + std::set &seen_arrs, + CStrRef num_prefix, CStrRef key_prefix, + CStrRef key_suffix, CStrRef arg_sep) { + if (seen_arrs.find((void*)arr.get()) != seen_arrs.end()) { + return; // recursive + } + seen_arrs.insert((void*)arr.get()); + + for (ArrayIter iter(arr); iter; ++iter) { + Variant data = iter.second(); + if (data.isNull() || data.isResource()) continue; + + String key = iter.first(); + bool numeric = key.isNumeric(); + + if (data.is(KindOfArray) || data.is(KindOfObject)) { + String encoded; + if (numeric) { + encoded = key; + } else { + encoded = StringUtil::UrlEncode(key); + } + StringBuffer new_prefix(key_prefix.size() + num_prefix.size() + + encoded.size() + key_suffix.size() + 4); + new_prefix += key_prefix; + if (numeric) new_prefix += num_prefix; + new_prefix += encoded; + new_prefix += key_suffix; + new_prefix += "%5B"; + url_encode_array(ret, data.toArray(), seen_arrs, String(), new_prefix, + String("%5D", AttachLiteral), arg_sep); + } else { + if (!ret.empty()) { + ret += arg_sep; + } + ret += key_prefix; + if (numeric) { + ret += num_prefix; + ret += key; + } else { + ret += StringUtil::UrlEncode(key); + } + ret += key_suffix; + ret += "="; + if (data.isInteger() || data.is(KindOfBoolean)) { + ret += String(data.toInt64()); + } else if (data.is(KindOfDouble)) { + ret += String(data.toDouble()); + } else { + ret += StringUtil::UrlEncode(data.toString()); + } + } + } +} + +String f_http_build_query(CVarRef formdata, + CStrRef numeric_prefix /* = null_string */, + CStrRef arg_separator /* = "&" */) { + if (!formdata.is(KindOfArray) && !formdata.is(KindOfObject)) { + throw InvalidArgumentException("formdata", "(need Array or Object)"); + } + + StringBuffer ret(1024); + std::set seen_arrs; + url_encode_array(ret, formdata.toArray(), seen_arrs, + numeric_prefix, String(), String(), arg_separator); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +#define RETURN_COMPONENT(name) \ + if (resource.name != NULL) { \ + String ret(resource.name, AttachString); \ + resource.name = NULL; \ + return ret; \ + } \ + +#define SET_COMPONENT(name) \ + if (resource.name != NULL) { \ + ret.set(#name, String(resource.name, AttachString)); \ + resource.name = NULL; \ + } \ + +#define PHP_URL_SCHEME 0 +#define PHP_URL_HOST 1 +#define PHP_URL_PORT 2 +#define PHP_URL_USER 3 +#define PHP_URL_PASS 4 +#define PHP_URL_PATH 5 +#define PHP_URL_QUERY 6 +#define PHP_URL_FRAGMENT 7 + +Variant f_parse_url(CStrRef url, int component /* = -1 */) { + Url resource; + if (!url_parse(resource, url.data(), url.size())) { + Logger::Verbose("invalid url: %s", url.data()); + return false; + } + + if (component > -1) { + switch (component) { + case PHP_URL_SCHEME: RETURN_COMPONENT(scheme); break; + case PHP_URL_HOST: RETURN_COMPONENT(host); break; + case PHP_URL_USER: RETURN_COMPONENT(user); break; + case PHP_URL_PASS: RETURN_COMPONENT(pass); break; + case PHP_URL_PATH: RETURN_COMPONENT(path); break; + case PHP_URL_QUERY: RETURN_COMPONENT(query); break; + case PHP_URL_FRAGMENT: RETURN_COMPONENT(fragment); break; + case PHP_URL_PORT: + if (resource.port) { + return resource.port; + } + break; + default: + throw InvalidArgumentException("component", component); + } + return null; + } + + Array ret; + SET_COMPONENT(scheme); + SET_COMPONENT(host); + SET_COMPONENT(user); + SET_COMPONENT(pass); + SET_COMPONENT(path); + SET_COMPONENT(query); + SET_COMPONENT(fragment); + if (resource.port) { + ret.set("port", (int64)resource.port); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_url.h b/src/cpp/ext/ext_url.h new file mode 100644 index 0000000000000..34dcdff2b2251 --- /dev/null +++ b/src/cpp/ext/ext_url.h @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_URL_H__ +#define __EXT_URL_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_base64_decode(CStrRef data, bool strict = false); +String f_base64_encode(CStrRef data); + +Variant f_get_headers(CStrRef url, int format = 0); +Array f_get_meta_tags(CStrRef filename, bool use_include_path = false); + +String f_http_build_query(CVarRef formdata, CStrRef numeric_prefix = null_string, + CStrRef arg_separator = "&"); +Variant f_parse_url(CStrRef url, int component = -1); + +inline String f_rawurldecode(CStrRef str) { + return StringUtil::UrlDecode(str, false); +} + +inline String f_rawurlencode(CStrRef str) { + return StringUtil::UrlEncode(str, false); +} + +inline String f_urldecode(CStrRef str) { + return StringUtil::UrlDecode(str, true); +} + +inline String f_urlencode(CStrRef str) { + return StringUtil::UrlEncode(str, true); +} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_URL_H__ diff --git a/src/cpp/ext/ext_variable.cpp b/src/cpp/ext/ext_variable.cpp new file mode 100644 index 0000000000000..8b18e1919ab97 --- /dev/null +++ b/src/cpp/ext/ext_variable.cpp @@ -0,0 +1,167 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +String f_gettype(CVarRef v) { + switch (v.getType()) { + case KindOfNull: return "NULL"; + case KindOfBoolean: return "boolean"; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: return "integer"; + case KindOfDouble: return "double"; + case LiteralString: + case KindOfString: return "string"; + case KindOfArray: return "array"; + case KindOfObject: return "object"; + default: + ASSERT(false); + break; + } + return ""; +} + +String f_get_resource_type(CObjRef handle) { + if (handle.isResource()) { + return handle->o_getClassName(); + } + return ""; +} + +bool f_settype(Variant var, CStrRef type) { + if (type == "boolean") var = var.toBoolean(); + else if (type == "bool" ) var = var.toBoolean(); + else if (type == "integer") var = var.toInt64(); + else if (type == "int" ) var = var.toInt64(); + else if (type == "float" ) var = var.toDouble(); + else if (type == "string" ) var = var.toString(); + else if (type == "array" ) var = var.toArray(); + else if (type == "object" ) var = var.toObject(); + else if (type == "null" ) var = null; + else return false; + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// input/output + +Variant f_print_r(CVarRef expression, bool ret /* = false */) { + VariableSerializer vs(VariableSerializer::PrintR); + return vs.serialize(expression, ret); +} + +Variant f_var_export(CVarRef expression, bool ret /* = false */) { + VariableSerializer vs(VariableSerializer::VarExport); + return vs.serialize(expression, ret); +} + +void f_var_dump(CVarRef v) { + VariableSerializer vs(VariableSerializer::VarDump); + // manipulate maxCount to match PHP behavior + if (v.isContagious()) { + if (!v.isReferenced()) vs.incMaxCount(); + vs.serialize(v, false); + v.clearContagious(); + } else { + if (v.isReferenced()) vs.incMaxCount(); + vs.serialize(v, false); + } +} + +void f_var_dump(int _argc, CVarRef expression, CArrRef _argv /* = null_array */) { + f_var_dump(expression); + for (int i = 0; i < _argv.size(); i++) { + f_var_dump(_argv[i]); + } +} + +void f_debug_zval_dump(CVarRef variable) { + VariableSerializer vs(VariableSerializer::DebugDump); + vs.serialize(variable, false); +} + +/////////////////////////////////////////////////////////////////////////////// +// variable table + +Array f_get_defined_vars() { + throw NotSupportedException(__func__, "Although this is theoretically possible to implement, having such a function requires a VariableTable to be constructed in current scope and every parent scope. Maybe VariableTable should be chained together anyway, but this is the only place that needs it."); +} + +bool f_import_request_variables(CStrRef types, CStrRef prefix /* = "" */) { + throw NotSupportedException(__func__, "It is bad coding practice to remove scoping of variables just to achieve coding convenience, esp. in a language that encourages global variables. This is possible to implement though, by declaring those global variables beforehand and assign with scoped ones when this function is called."); +} + +int f_extract(CArrRef var_array, int extract_type /* = EXTR_OVERWRITE */, + CStrRef prefix /* = "" */) { + throw FatalErrorException("bad HPHP code generation"); +} +int extract(LVariableTable *variables, CArrRef var_array, + int extract_type /* = EXTR_OVERWRITE */, + String prefix /* = "" */) { + FUNCTION_INJECTION(extract); + + bool reference = extract_type & EXTR_REFS; + extract_type &= ~EXTR_REFS; + + int count = 0; + for (ArrayIter iter(var_array); iter; ++iter) { + String name = iter.first(); + + switch (extract_type) { + case EXTR_SKIP: + if (variables->exists(name)) continue; + break; + case EXTR_IF_EXISTS: + if (!variables->exists(name)) continue; + break; + case EXTR_PREFIX_SAME: + if (variables->exists(name)) name = prefix + "_" + name; + break; + case EXTR_PREFIX_ALL: + name = prefix + "_" + name; + break; + case EXTR_PREFIX_INVALID: + if (!name.isValidVariableName()) name = prefix + "_" + name; + break; + case EXTR_PREFIX_IF_EXISTS: + if (!variables->exists(name)) continue; + name = prefix + "_" + name; + break; + default: + break; + } + + if (reference) { + variables->get(name) = ref(iter.secondRef()); + } else { + variables->get(name) = iter.second(); + } + count++; + } + return count; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_variable.h b/src/cpp/ext/ext_variable.h new file mode 100644 index 0000000000000..20d581dcc2e25 --- /dev/null +++ b/src/cpp/ext/ext_variable.h @@ -0,0 +1,255 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_VARIABLE_H__ +#define __HPHP_VARIABLE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// type testing + +inline bool f_is_bool(bool v) { return true;} +inline bool f_is_bool(char v) { return false;} +inline bool f_is_bool(short v) { return false;} +inline bool f_is_bool(int v) { return false;} +inline bool f_is_bool(int64 v) { return false;} +inline bool f_is_bool(double v) { return false;} +inline bool f_is_bool(litstr v) { return false;} +inline bool f_is_bool(CStrRef v) { return false;} +inline bool f_is_bool(CArrRef v) { return false;} +inline bool f_is_bool(CObjRef v) { return false;} +inline bool f_is_bool(CVarRef v) { return v.is(KindOfBoolean);} + +inline bool f_is_int(bool v) { return false;} +inline bool f_is_int(char v) { return true;} +inline bool f_is_int(short v) { return true;} +inline bool f_is_int(int v) { return true;} +inline bool f_is_int(int64 v) { return true;} +inline bool f_is_int(double v) { return false;} +inline bool f_is_int(litstr v) { return false;} +inline bool f_is_int(CStrRef v) { return false;} +inline bool f_is_int(CArrRef v) { return false;} +inline bool f_is_int(CObjRef v) { return false;} +inline bool f_is_int(CVarRef v) { return v.isInteger();} + +inline bool f_is_integer(bool v) { return false;} +inline bool f_is_integer(char v) { return true;} +inline bool f_is_integer(short v) { return true;} +inline bool f_is_integer(int v) { return true;} +inline bool f_is_integer(int64 v) { return true;} +inline bool f_is_integer(double v) { return false;} +inline bool f_is_integer(litstr v) { return false;} +inline bool f_is_integer(CStrRef v) { return false;} +inline bool f_is_integer(CArrRef v) { return false;} +inline bool f_is_integer(CObjRef v) { return false;} +inline bool f_is_integer(CVarRef v) { return v.isInteger();} + +inline bool f_is_long(bool v) { return false;} +inline bool f_is_long(char v) { return true;} +inline bool f_is_long(short v) { return true;} +inline bool f_is_long(int v) { return true;} +inline bool f_is_long(int64 v) { return true;} +inline bool f_is_long(double v) { return false;} +inline bool f_is_long(litstr v) { return false;} +inline bool f_is_long(CStrRef v) { return false;} +inline bool f_is_long(CArrRef v) { return false;} +inline bool f_is_long(CObjRef v) { return false;} +inline bool f_is_long(CVarRef v) { return v.isInteger();} + +inline bool f_is_double(bool v) { return false;} +inline bool f_is_double(char v) { return false;} +inline bool f_is_double(short v) { return false;} +inline bool f_is_double(int v) { return false;} +inline bool f_is_double(int64 v) { return false;} +inline bool f_is_double(double v) { return true;} +inline bool f_is_double(litstr v) { return false;} +inline bool f_is_double(CStrRef v) { return false;} +inline bool f_is_double(CArrRef v) { return false;} +inline bool f_is_double(CObjRef v) { return false;} +inline bool f_is_double(CVarRef v) { return v.is(KindOfDouble);} + +inline bool f_is_float(bool v) { return false;} +inline bool f_is_float(char v) { return false;} +inline bool f_is_float(short v) { return false;} +inline bool f_is_float(int v) { return false;} +inline bool f_is_float(int64 v) { return false;} +inline bool f_is_float(double v) { return true;} +inline bool f_is_float(litstr v) { return false;} +inline bool f_is_float(CStrRef v) { return false;} +inline bool f_is_float(CArrRef v) { return false;} +inline bool f_is_float(CObjRef v) { return false;} +inline bool f_is_float(CVarRef v) { return v.is(KindOfDouble);} + +inline bool f_is_numeric(bool v) { return false;} +inline bool f_is_numeric(char v) { return true;} +inline bool f_is_numeric(short v) { return true;} +inline bool f_is_numeric(int v) { return true;} +inline bool f_is_numeric(int64 v) { return true;} +inline bool f_is_numeric(double v) { return true;} +inline bool f_is_numeric(litstr v) { return String(v).isNumeric();} +inline bool f_is_numeric(CStrRef v) { return v.isNumeric();} +inline bool f_is_numeric(CArrRef v) { return false;} +inline bool f_is_numeric(CObjRef v) { return false;} +inline bool f_is_numeric(CVarRef v) { return v.isNumeric(true);} + +inline bool f_is_real(bool v) { return false;} +inline bool f_is_real(char v) { return false;} +inline bool f_is_real(short v) { return false;} +inline bool f_is_real(int v) { return false;} +inline bool f_is_real(int64 v) { return false;} +inline bool f_is_real(double v) { return true;} +inline bool f_is_real(litstr v) { return false;} +inline bool f_is_real(CStrRef v) { return false;} +inline bool f_is_real(CArrRef v) { return false;} +inline bool f_is_real(CObjRef v) { return false;} +inline bool f_is_real(CVarRef v) { return v.is(KindOfDouble);} + +inline bool f_is_string(bool v) { return false;} +inline bool f_is_string(char v) { return false;} +inline bool f_is_string(short v) { return false;} +inline bool f_is_string(int v) { return false;} +inline bool f_is_string(int64 v) { return false;} +inline bool f_is_string(double v) { return false;} +inline bool f_is_string(litstr v) { return true;} +inline bool f_is_string(CStrRef v) { return true;} +inline bool f_is_string(CArrRef v) { return false;} +inline bool f_is_string(CObjRef v) { return false;} +inline bool f_is_string(CVarRef v) { return v.isString();} + +inline bool f_is_scalar(bool v) { return true;} +inline bool f_is_scalar(char v) { return true;} +inline bool f_is_scalar(short v) { return true;} +inline bool f_is_scalar(int v) { return true;} +inline bool f_is_scalar(int64 v) { return true;} +inline bool f_is_scalar(double v) { return true;} +inline bool f_is_scalar(litstr v) { return true;} +inline bool f_is_scalar(CStrRef v) { return true;} +inline bool f_is_scalar(CArrRef v) { return false;} +inline bool f_is_scalar(CObjRef v) { return false;} +inline bool f_is_scalar(CVarRef v) { return v.isScalar();} + +inline bool f_is_array(bool v) { return false;} +inline bool f_is_array(char v) { return false;} +inline bool f_is_array(short v) { return false;} +inline bool f_is_array(int v) { return false;} +inline bool f_is_array(int64 v) { return false;} +inline bool f_is_array(double v) { return false;} +inline bool f_is_array(litstr v) { return false;} +inline bool f_is_array(CStrRef v) { return false;} +inline bool f_is_array(CArrRef v) { return true;} +inline bool f_is_array(CObjRef v) { return false;} +inline bool f_is_array(CVarRef v) { return v.is(KindOfArray);} + +inline bool f_is_object(bool v) { return false;} +inline bool f_is_object(char v) { return false;} +inline bool f_is_object(short v) { return false;} +inline bool f_is_object(int v) { return false;} +inline bool f_is_object(int64 v) { return false;} +inline bool f_is_object(double v) { return false;} +inline bool f_is_object(litstr v) { return false;} +inline bool f_is_object(CStrRef v) { return false;} +inline bool f_is_object(CArrRef v) { return false;} +inline bool f_is_object(CObjRef v) { return true;} +inline bool f_is_object(CVarRef v) { return v.is(KindOfObject);} + +inline bool f_is_resource(bool v) { return false;} +inline bool f_is_resource(char v) { return false;} +inline bool f_is_resource(short v) { return false;} +inline bool f_is_resource(int v) { return false;} +inline bool f_is_resource(int64 v) { return false;} +inline bool f_is_resource(double v) { return false;} +inline bool f_is_resource(litstr v) { return false;} +inline bool f_is_resource(CStrRef v) { return false;} +inline bool f_is_resource(CArrRef v) { return false;} +inline bool f_is_resource(CObjRef v) { return v.isResource();} +inline bool f_is_resource(CVarRef v) { return v.isResource();} + +inline bool f_is_null(bool v) { return false;} +inline bool f_is_null(char v) { return false;} +inline bool f_is_null(short v) { return false;} +inline bool f_is_null(int v) { return false;} +inline bool f_is_null(int64 v) { return false;} +inline bool f_is_null(double v) { return false;} +inline bool f_is_null(litstr v) { return false;} +inline bool f_is_null(CStrRef v) { return v.isNull();} +inline bool f_is_null(CArrRef v) { return v.isNull();} +inline bool f_is_null(CObjRef v) { return v.isNull();} +inline bool f_is_null(CVarRef v) { return v.isNull();} + +inline String f_gettype(bool v) { return "boolean";} +inline String f_gettype(char v) { return "integer";} +inline String f_gettype(short v) { return "integer";} +inline String f_gettype(int v) { return "integer";} +inline String f_gettype(int64 v) { return "integer";} +inline String f_gettype(double v) { return "double";} +inline String f_gettype(litstr v) { return "string";} +inline String f_gettype(CStrRef v) { return "string";} +inline String f_gettype(CArrRef v) { return "array";} +inline String f_gettype(CObjRef v) { return "object";} +String f_gettype(CVarRef v); +String f_get_resource_type(CObjRef handle); + +/////////////////////////////////////////////////////////////////////////////// +// type conversion + +inline int64 f_intval(CVarRef v, int64 base = 10) { return v.toInt64(base);} +inline double f_doubleval(CVarRef v) { return v.toDouble();} +inline double f_floatval(CVarRef v) { return v.toDouble();} +inline String f_strval(CVarRef v) { return v.toString();} + +bool f_settype(Variant var, CStrRef type); + +/////////////////////////////////////////////////////////////////////////////// +// input/output + +Variant f_print_r(CVarRef expression, bool ret = false); +Variant f_var_export(CVarRef expression, bool ret = false); +void f_var_dump(CVarRef v); +void f_var_dump(int _argc, CVarRef expression, CArrRef _argv = null_array); +void f_debug_zval_dump(CVarRef variable); +String f_serialize(CVarRef value); +Variant f_unserialize(CStrRef str); + +/////////////////////////////////////////////////////////////////////////////// +// variable table + +Array f_get_defined_vars(); +bool f_import_request_variables(CStrRef types, CStrRef prefix = ""); + +#define EXTR_OVERWRITE 0 +#define EXTR_SKIP 1 +#define EXTR_PREFIX_SAME 2 +#define EXTR_PREFIX_ALL 3 +#define EXTR_PREFIX_INVALID 4 +#define EXTR_PREFIX_IF_EXISTS 5 +#define EXTR_IF_EXISTS 6 +#define EXTR_REFS 0x100 + +/** + * LVariableTable parameter is added by HPHP. + */ +int f_extract(CArrRef var_array, int extract_type = EXTR_OVERWRITE, + CStrRef prefix = ""); +int extract(LVariableTable *variables, CArrRef var_array, + int extract_type = EXTR_OVERWRITE, String prefix = ""); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_VARIABLE_H__ diff --git a/src/cpp/ext/ext_xml.cpp b/src/cpp/ext/ext_xml.cpp new file mode 100644 index 0000000000000..0509988a24bc7 --- /dev/null +++ b/src/cpp/ext/ext_xml.cpp @@ -0,0 +1,251 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include "crutch.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Object f_xml_parser_create(CStrRef encoding /* = null_string */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(encoding), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_parser_create", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +bool f_xml_parser_free(CObjRef parser) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_parser_free", _schema, _params); + return (Variant)_ret[0]; +} + +int f_xml_parse(CObjRef parser, CStrRef data, bool is_final /* = true */) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(data), NEW(ArrayElement)(is_final), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_parse", _schema, _params); + return (Variant)_ret[0]; +} + +int f_xml_parse_into_struct(CObjRef parser, CStrRef data, Variant values, Variant index /* = null */) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(2, "R"), NEW(ArrayElement)(3, "R"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(data), NEW(ArrayElement)(values), NEW(ArrayElement)(index), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_parse_into_struct", _schema, _params); + values = ((Variant)_ret[1])[2]; + index = ((Variant)_ret[1])[3]; + return (Variant)_ret[0]; +} + +Object f_xml_parser_create_ns(CStrRef encoding /* = null_string */, CStrRef separator /* = null_string */) { + Array _schema(NEW(ArrayElement)(-1, "OO"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(encoding), NEW(ArrayElement)(separator), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_parser_create_ns", _schema, _params); + return OpaqueObject::GetObject((Variant)_ret[0]); +} + +Variant f_xml_parser_get_option(CObjRef parser, int option) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(option), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_parser_get_option", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_parser_set_option(CObjRef parser, int option, CVarRef value) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(option), NEW(ArrayElement)(value), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_parser_set_option", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_set_character_data_handler(CObjRef parser, CStrRef handler) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(handler), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_set_character_data_handler", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_set_default_handler(CObjRef parser, CStrRef handler) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(handler), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_set_default_handler", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_set_element_handler(CObjRef parser, CStrRef start_element_handler, CStrRef end_element_handler) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(start_element_handler), NEW(ArrayElement)(end_element_handler), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_set_element_handler", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_set_processing_instruction_handler(CObjRef parser, CStrRef handler) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(handler), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_set_processing_instruction_handler", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_set_start_namespace_decl_handler(CObjRef parser, CStrRef handler) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(handler), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_set_start_namespace_decl_handler", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_set_end_namespace_decl_handler(CObjRef parser, CStrRef handler) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(handler), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_set_end_namespace_decl_handler", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_set_unparsed_entity_decl_handler(CObjRef parser, CStrRef handler) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(handler), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_set_unparsed_entity_decl_handler", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_set_external_entity_ref_handler(CObjRef parser, CStrRef handler) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(handler), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_set_external_entity_ref_handler", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_set_notation_decl_handler(CObjRef parser, CStrRef handler) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(handler), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_set_notation_decl_handler", _schema, _params); + return (Variant)_ret[0]; +} + +bool f_xml_set_object(CObjRef parser, Variant object) { + Array _schema(NEW(ArrayElement)(0, "O"), NEW(ArrayElement)(1, "R"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), NEW(ArrayElement)(object), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_set_object", _schema, _params); + object = ((Variant)_ret[1])[1]; + return (Variant)_ret[0]; +} + +int f_xml_get_current_byte_index(CObjRef parser) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_get_current_byte_index", _schema, _params); + return (Variant)_ret[0]; +} + +int f_xml_get_current_column_number(CObjRef parser) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_get_current_column_number", _schema, _params); + return (Variant)_ret[0]; +} + +int f_xml_get_current_line_number(CObjRef parser) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_get_current_line_number", _schema, _params); + return (Variant)_ret[0]; +} + +int f_xml_get_error_code(CObjRef parser) { + Array _schema(NEW(ArrayElement)(0, "O"), (ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(OpaqueObject::GetIndex(parser)), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_get_error_code", _schema, _params); + return (Variant)_ret[0]; +} + +String f_xml_error_string(int code) { + Array _schema((ArrayElement*)NULL); + Array _params(NEW(ArrayElement)(code), (ArrayElement*)NULL); + Array _ret = Crutch::Invoke("xml_error_string", _schema, _params); + return (Variant)_ret[0]; +} + +/////////////////////////////////////////////////////////////////////////////// + +String f_utf8_decode(CStrRef data) { + char *newbuf = (char*)malloc(data.size() + 1); + int newlen = 0; + const char *s = data.data(); + for (int pos = data.size(); pos > 0; ) { + unsigned short c = (unsigned char)(*s); + if (c >= 0xf0) { /* four bytes encoded, 21 bits */ + if (pos-4 >= 0) { + c = ((s[0]&7)<<18) | ((s[1]&63)<<12) | ((s[2]&63)<<6) | (s[3]&63); + } else { + c = '?'; + } + s += 4; + pos -= 4; + } else if (c >= 0xe0) { /* three bytes encoded, 16 bits */ + if (pos-3 >= 0) { + c = ((s[0]&63)<<12) | ((s[1]&63)<<6) | (s[2]&63); + } else { + c = '?'; + } + s += 3; + pos -= 3; + } else if (c >= 0xc0) { /* two bytes encoded, 11 bits */ + if (pos-2 >= 0) { + c = ((s[0]&63)<<6) | (s[1]&63); + } else { + c = '?'; + } + s += 2; + pos -= 2; + } else { + s++; + pos--; + } + newbuf[newlen] = (char)(c > 0xff ? '?' : c); + ++newlen; + } + newbuf[newlen] = '\0'; + return String(newbuf, newlen, AttachString); +} + +String f_utf8_encode(CStrRef data) { + char *newbuf = (char*)malloc(data.size() * 4 + 1); + int newlen = 0; + const char *s = data.data(); + for (int pos = data.size(); pos > 0; pos--, s++) { + unsigned int c = (unsigned char)(*s); + if (c < 0x80) { + newbuf[newlen++] = (char) c; + } else if (c < 0x800) { + newbuf[newlen++] = (0xc0 | (c >> 6)); + newbuf[newlen++] = (0x80 | (c & 0x3f)); + } else if (c < 0x10000) { + newbuf[newlen++] = (0xe0 | (c >> 12)); + newbuf[newlen++] = (0xc0 | ((c >> 6) & 0x3f)); + newbuf[newlen++] = (0x80 | (c & 0x3f)); + } else if (c < 0x200000) { + newbuf[newlen++] = (0xf0 | (c >> 18)); + newbuf[newlen++] = (0xe0 | ((c >> 12) & 0x3f)); + newbuf[newlen++] = (0xc0 | ((c >> 6) & 0x3f)); + newbuf[newlen++] = (0x80 | (c & 0x3f)); + } + } + newbuf[newlen] = '\0'; + return String(newbuf, newlen, AttachString); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_xml.h b/src/cpp/ext/ext_xml.h new file mode 100644 index 0000000000000..5099df327a774 --- /dev/null +++ b/src/cpp/ext/ext_xml.h @@ -0,0 +1,56 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_XML_H__ +#define __EXT_XML_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Object f_xml_parser_create(CStrRef encoding = null_string); +bool f_xml_parser_free(CObjRef parser); +int f_xml_parse(CObjRef parser, CStrRef data, bool is_final = true); +int f_xml_parse_into_struct(CObjRef parser, CStrRef data, Variant values, Variant index = null); +Object f_xml_parser_create_ns(CStrRef encoding = null_string, CStrRef separator = null_string); +Variant f_xml_parser_get_option(CObjRef parser, int option); +bool f_xml_parser_set_option(CObjRef parser, int option, CVarRef value); +bool f_xml_set_character_data_handler(CObjRef parser, CStrRef handler); +bool f_xml_set_default_handler(CObjRef parser, CStrRef handler); +bool f_xml_set_element_handler(CObjRef parser, CStrRef start_element_handler, CStrRef end_element_handler); +bool f_xml_set_processing_instruction_handler(CObjRef parser, CStrRef handler); +bool f_xml_set_start_namespace_decl_handler(CObjRef parser, CStrRef handler); +bool f_xml_set_end_namespace_decl_handler(CObjRef parser, CStrRef handler); +bool f_xml_set_unparsed_entity_decl_handler(CObjRef parser, CStrRef handler); +bool f_xml_set_external_entity_ref_handler(CObjRef parser, CStrRef handler); +bool f_xml_set_notation_decl_handler(CObjRef parser, CStrRef handler); +bool f_xml_set_object(CObjRef parser, Variant object); +int f_xml_get_current_byte_index(CObjRef parser); +int f_xml_get_current_column_number(CObjRef parser); +int f_xml_get_current_line_number(CObjRef parser); +int f_xml_get_error_code(CObjRef parser); +String f_xml_error_string(int code); +String f_utf8_decode(CStrRef data); +String f_utf8_encode(CStrRef data); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_XML_H__ diff --git a/src/cpp/ext/ext_xmlwriter.cpp b/src/cpp/ext/ext_xmlwriter.cpp new file mode 100644 index 0000000000000..74076be54a6e9 --- /dev/null +++ b/src/cpp/ext/ext_xmlwriter.cpp @@ -0,0 +1,766 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// functions are just wrappers of object methods + +Variant f_xmlwriter_open_memory() { + c_xmlwriter *x = NEW(c_xmlwriter)(); + Object ret(x); + if (x->t_openmemory()) { + return ret; + } + return false; +} + +Object f_xmlwriter_open_uri(CStrRef uri) { + c_xmlwriter *x = NEW(c_xmlwriter)(); + Object ret(x); + if (x->t_openuri(uri)) { + return ret; + } + return false; +} + +bool f_xmlwriter_set_indent_string(CObjRef xmlwriter, CStrRef indentstring) { + return xmlwriter.getTyped()-> + t_setindentstring(indentstring); +} + +bool f_xmlwriter_set_indent(CObjRef xmlwriter, bool indent) { + return xmlwriter.getTyped()-> + t_setindent(indent); +} + +bool f_xmlwriter_start_document(CObjRef xmlwriter, + CStrRef version /* = "1.0" */, + CStrRef encoding /* = null_string */, + CStrRef standalone /* = null_string */) { + return xmlwriter.getTyped()-> + t_startdocument(version, encoding, standalone); +} + +bool f_xmlwriter_start_element(CObjRef xmlwriter, CStrRef name) { + return xmlwriter.getTyped()-> + t_startelement(name); +} + +bool f_xmlwriter_start_element_ns(CObjRef xmlwriter, CStrRef prefix, + CStrRef name, CStrRef uri) { + return xmlwriter.getTyped()-> + t_startelementns(prefix, name, uri); +} + +bool f_xmlwriter_write_element_ns(CObjRef xmlwriter, CStrRef prefix, + CStrRef name, CStrRef uri, + CStrRef content /* = null_string */) { + return xmlwriter.getTyped()-> + t_writeelementns(prefix, name, uri, content); +} + +bool f_xmlwriter_write_element(CObjRef xmlwriter, CStrRef name, + CStrRef content /* = null_string */) { + return xmlwriter.getTyped()-> + t_writeelement(name, content); +} + +bool f_xmlwriter_end_element(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_endelement(); +} + +bool f_xmlwriter_full_end_element(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_fullendelement(); +} + +bool f_xmlwriter_start_attribute_ns(CObjRef xmlwriter, CStrRef prefix, + CStrRef name, CStrRef uri) { + return xmlwriter.getTyped()-> + t_startattributens(prefix, name, uri); +} + +bool f_xmlwriter_start_attribute(CObjRef xmlwriter, CStrRef name) { + return xmlwriter.getTyped()-> + t_startattribute(name); +} + +bool f_xmlwriter_write_attribute_ns(CObjRef xmlwriter, CStrRef prefix, + CStrRef name, CStrRef uri, + CStrRef content) { + return xmlwriter.getTyped()-> + t_writeattributens(prefix, name, uri, content); +} + +bool f_xmlwriter_write_attribute(CObjRef xmlwriter, CStrRef name, + CStrRef value) { + return xmlwriter.getTyped()-> + t_writeattribute(name, value); +} + +bool f_xmlwriter_end_attribute(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_endattribute(); +} + +bool f_xmlwriter_start_cdata(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_startcdata(); +} + +bool f_xmlwriter_write_cdata(CObjRef xmlwriter, CStrRef content) { + return xmlwriter.getTyped()-> + t_writecdata(content); +} + +bool f_xmlwriter_end_cdata(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_endcdata(); +} + +bool f_xmlwriter_start_comment(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_startcomment(); +} + +bool f_xmlwriter_write_comment(CObjRef xmlwriter, CStrRef content) { + return xmlwriter.getTyped()-> + t_writecomment(content); +} + +bool f_xmlwriter_end_comment(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_endcomment(); +} + +bool f_xmlwriter_end_document(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_enddocument(); +} + +bool f_xmlwriter_start_pi(CObjRef xmlwriter, CStrRef target) { + return xmlwriter.getTyped()-> + t_startpi(target); +} + +bool f_xmlwriter_write_pi(CObjRef xmlwriter, CStrRef target, CStrRef content) { + return xmlwriter.getTyped()-> + t_writepi(target, content); +} + +bool f_xmlwriter_end_pi(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_endpi(); +} + +bool f_xmlwriter_text(CObjRef xmlwriter, CStrRef content) { + return xmlwriter.getTyped()-> + t_text(content); +} + +bool f_xmlwriter_write_raw(CObjRef xmlwriter, CStrRef content) { + return xmlwriter.getTyped()-> + t_writeraw(content); +} + +bool f_xmlwriter_start_dtd(CObjRef xmlwriter, CStrRef qualifiedname, + CStrRef publicid /* = null_string */, + CStrRef systemid /* = null_string */) { + return xmlwriter.getTyped()-> + t_startdtd(qualifiedname, publicid, systemid); +} + +bool f_xmlwriter_write_dtd(CObjRef xmlwriter, CStrRef name, + CStrRef publicid /* = null_string */, + CStrRef systemid /* = null_string */, + CStrRef subset /* = null_string */) { + return xmlwriter.getTyped()-> + t_writedtd(name, publicid, systemid, subset); +} + +bool f_xmlwriter_start_dtd_element(CObjRef xmlwriter, CStrRef qualifiedname) { + return xmlwriter.getTyped()-> + t_startdtdelement(qualifiedname); +} + +bool f_xmlwriter_write_dtd_element(CObjRef xmlwriter, CStrRef name, + CStrRef content) { + return xmlwriter.getTyped()-> + t_writedtdelement(name, content); +} + +bool f_xmlwriter_end_dtd_element(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_enddtdelement(); +} + +bool f_xmlwriter_start_dtd_attlist(CObjRef xmlwriter, CStrRef name) { + return xmlwriter.getTyped()-> + t_startdtdattlist(name); +} + +bool f_xmlwriter_write_dtd_attlist(CObjRef xmlwriter, CStrRef name, + CStrRef content) { + return xmlwriter.getTyped()-> + t_writedtdattlist(name, content); +} + +bool f_xmlwriter_end_dtd_attlist(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_enddtdattlist(); +} + +bool f_xmlwriter_start_dtd_entity(CObjRef xmlwriter, CStrRef name, + bool isparam) { + return xmlwriter.getTyped()-> + t_startdtdentity(name, isparam); +} + +bool f_xmlwriter_write_dtd_entity(CObjRef xmlwriter, CStrRef name, + CStrRef content, bool pe /* = false */, + CStrRef publicid /* = null_string */, + CStrRef systemid /* = null_string */, + CStrRef ndataid /* = null_string */) { + return xmlwriter.getTyped()-> + t_writedtdentity(name, content); +} + +bool f_xmlwriter_end_dtd_entity(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_enddtdentity(); +} + +bool f_xmlwriter_end_dtd(CObjRef xmlwriter) { + return xmlwriter.getTyped()-> + t_enddtd(); +} + +Variant f_xmlwriter_flush(CObjRef xmlwriter, bool empty /* = true */) { + return xmlwriter.getTyped()-> + t_flush(empty); +} + +String f_xmlwriter_output_memory(CObjRef xmlwriter, bool flush /* = true */) { + return xmlwriter.getTyped()-> + t_outputmemory(flush); +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +static int write_file(void *context, const char *buffer, int len) { + return ((c_xmlwriter*)context)->m_uri->writeImpl(buffer, len); +} + +static int close_file(void *context) { + return 0; +} + +static xmlChar *xmls(CStrRef s) { + return s.isNull() ? NULL : (xmlChar*)s.data(); +} + +/////////////////////////////////////////////////////////////////////////////// + +c_xmlwriter::c_xmlwriter() : m_ptr(NULL), m_output(NULL), m_uri_output(NULL) { +} + +c_xmlwriter::~c_xmlwriter() { + if (m_ptr) { + xmlFreeTextWriter(m_ptr); + } + if (m_output) { + xmlBufferFree(m_output); + } + if (m_uri_output) { + xmlOutputBufferClose(m_uri_output); + } +} + +void c_xmlwriter::t___construct() { +} + +bool c_xmlwriter::t_openmemory() { + m_output = xmlBufferCreate(); + if (m_output == NULL) { + Logger::Warning("Unable to create output buffer"); + return false; + } + return m_ptr = xmlNewTextWriterMemory(m_output, 0); +} + +bool c_xmlwriter::t_openuri(CStrRef uri) { + Variant file = File::Open(uri, "wb"); + if (same(file, false)) { + return false; + } + m_uri = file.toObject().getTyped(); + + m_uri_output = xmlOutputBufferCreateIO(write_file, close_file, this, NULL); + if (m_uri_output == NULL) { + Logger::Warning("Unable to create output buffer"); + return false; + } + m_ptr = xmlNewTextWriter(m_uri_output); + return true; +} + +bool c_xmlwriter::t_setindentstring(CStrRef indentstring) { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterSetIndentString(m_ptr, (xmlChar*)indentstring.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_setindent(bool indent) { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterSetIndent(m_ptr, indent); + } + return ret != -1; +} + +bool c_xmlwriter::t_startdocument(CStrRef version /* = "1.0" */, + CStrRef encoding /* = null_string */, + CStrRef standalone /* = null_string */) { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartDocument(m_ptr, (const char *)xmls(version), + (const char *)xmls(encoding), + (const char *)xmls(standalone)); + } + return ret != -1; +} + +bool c_xmlwriter::t_startelement(CStrRef name) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid element name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartElement(m_ptr, (xmlChar*)name.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_startelementns(CStrRef prefix, CStrRef name, CStrRef uri) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid element name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartElementNS(m_ptr, (xmlChar*)prefix.data(), + (xmlChar*)name.data(), + (xmlChar*)uri.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_writeelementns(CStrRef prefix, CStrRef name, CStrRef uri, + CStrRef content /* = null_string */) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid element name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + if (content.isNull()) { + ret = xmlTextWriterStartElementNS(m_ptr, (xmlChar*)prefix.data(), + (xmlChar*)name.data(), + (xmlChar*)uri.data()); + if (ret == -1) return false; + ret = xmlTextWriterEndElement(m_ptr); + if (ret == -1) return false; + } else { + ret = xmlTextWriterWriteElementNS(m_ptr, (xmlChar*)prefix.data(), + (xmlChar*)name.data(), + (xmlChar*)uri.data(), + (xmlChar*)content.data()); + } + } + return ret != -1; +} + +bool c_xmlwriter::t_writeelement(CStrRef name, + CStrRef content /* = null_string */) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid element name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + if (content.isNull()) { + ret = xmlTextWriterStartElement(m_ptr, (xmlChar*)name.data()); + if (ret == -1) return false; + ret = xmlTextWriterEndElement(m_ptr); + if (ret == -1) return false; + } else { + ret = xmlTextWriterWriteElement(m_ptr, (xmlChar*)name.data(), + (xmlChar*)content.data()); + } + } + return ret != -1; +} + +bool c_xmlwriter::t_endelement() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterEndElement(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_fullendelement() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterFullEndElement(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_startattributens(CStrRef prefix, CStrRef name, + CStrRef uri) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid attribute name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartAttributeNS(m_ptr, (xmlChar*)prefix.data(), + (xmlChar*)name.data(), + (xmlChar*)uri.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_startattribute(CStrRef name) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid attribute name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartAttribute(m_ptr, (xmlChar*)name.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_writeattributens(CStrRef prefix, CStrRef name, CStrRef uri, + CStrRef content) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid attribute name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWriteAttributeNS(m_ptr, (xmlChar*)prefix.data(), + (xmlChar*)name.data(), + (xmlChar*)uri.data(), + (xmlChar*)content.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_writeattribute(CStrRef name, CStrRef value) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid attribute name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWriteAttribute(m_ptr, (xmlChar*)name.data(), + (xmlChar*)value.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_endattribute() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterEndAttribute(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_startcdata() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartCDATA(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_writecdata(CStrRef content) { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWriteCDATA(m_ptr, (xmlChar*)content.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_endcdata() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterEndCDATA(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_startcomment() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartComment(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_writecomment(CStrRef content) { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWriteComment(m_ptr, (xmlChar*)content.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_endcomment() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterEndComment(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_enddocument() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterEndDocument(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_startpi(CStrRef target) { + if (xmlValidateName((xmlChar*)target.data(), 0)) { + Logger::Warning("invalid PI target: %s", target.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartPI(m_ptr, (xmlChar*)target.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_writepi(CStrRef target, CStrRef content) { + if (xmlValidateName((xmlChar*)target.data(), 0)) { + Logger::Warning("invalid PI target: %s", target.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWritePI(m_ptr, (xmlChar*)target.data(), + (xmlChar*)content.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_endpi() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterEndPI(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_text(CStrRef content) { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWriteString(m_ptr, (xmlChar*)content.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_writeraw(CStrRef content) { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWriteRaw(m_ptr, (xmlChar*)content.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_startdtd(CStrRef qualifiedname, + CStrRef publicid /* = null_string */, + CStrRef systemid /* = null_string */) { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartDTD(m_ptr, (xmlChar*)qualifiedname.data(), + xmls(publicid), xmls(systemid)); + } + return ret != -1; +} + +bool c_xmlwriter::t_writedtd(CStrRef name, + CStrRef publicid /* = null_string */, + CStrRef systemid /* = null_string */, + CStrRef subset /* = null_string */) { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWriteDTD(m_ptr, (xmlChar*)name.data(), + xmls(publicid), xmls(systemid), xmls(subset)); + } + return ret != -1; +} + +bool c_xmlwriter::t_startdtdelement(CStrRef qualifiedname) { + if (xmlValidateName((xmlChar*)qualifiedname.data(), 0)) { + Logger::Warning("invalid element name: %s", qualifiedname.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartDTDElement(m_ptr, (xmlChar*)qualifiedname.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_writedtdelement(CStrRef name, CStrRef content) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid element name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWriteDTDElement(m_ptr, (xmlChar*)name.data(), + (xmlChar*)content.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_enddtdelement() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterEndDTDElement(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_startdtdattlist(CStrRef name) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid element name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartDTDAttlist(m_ptr, (xmlChar*)name.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_writedtdattlist(CStrRef name, CStrRef content) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid element name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWriteDTDAttlist(m_ptr, (xmlChar*)name.data(), + (xmlChar*)content.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_enddtdattlist() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterEndDTDAttlist(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_startdtdentity(CStrRef name, bool isparam) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid attribute name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterStartDTDEntity(m_ptr, isparam, (xmlChar*)name.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_writedtdentity(CStrRef name, CStrRef content, + bool pe /* = false */, + CStrRef publicid /* = null_string */, + CStrRef systemid /* = null_string */, + CStrRef ndataid /* = null_string */) { + if (xmlValidateName((xmlChar*)name.data(), 0)) { + Logger::Warning("invalid element name: %s", name.data()); + return false; + } + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterWriteDTDEntity(m_ptr, pe, (xmlChar*)name.data(), + xmls(publicid), xmls(systemid), + xmls(ndataid), (xmlChar*)content.data()); + } + return ret != -1; +} + +bool c_xmlwriter::t_enddtdentity() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterEndDTDEntity(m_ptr); + } + return ret != -1; +} + +bool c_xmlwriter::t_enddtd() { + int ret = -1; + if (m_ptr) { + ret = xmlTextWriterEndDTD(m_ptr); + } + return ret != -1; +} + +Variant c_xmlwriter::t_flush(bool empty /* = true */) { + if (m_ptr && m_output) { + xmlTextWriterFlush(m_ptr); + String ret((char*)m_output->content, CopyString); + if (empty) { + xmlBufferEmpty(m_output); + } + return ret; + } + return ""; +} + +String c_xmlwriter::t_outputmemory(bool flush /* = true */) { + return t_flush(flush); +} + +Variant c_xmlwriter::t___destruct() { + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_xmlwriter.h b/src/cpp/ext/ext_xmlwriter.h new file mode 100644 index 0000000000000..6b7f36f2f9596 --- /dev/null +++ b/src/cpp/ext/ext_xmlwriter.h @@ -0,0 +1,135 @@ + +#ifndef __EXT_XMLWRITER_H__ +#define __EXT_XMLWRITER_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< +#include +#include +#include +#include + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant f_xmlwriter_open_memory(); +Object f_xmlwriter_open_uri(CStrRef uri); +bool f_xmlwriter_set_indent_string(CObjRef xmlwriter, CStrRef indentstring); +bool f_xmlwriter_set_indent(CObjRef xmlwriter, bool indent); +bool f_xmlwriter_start_document(CObjRef xmlwriter, CStrRef version = "1.0", CStrRef encoding = null_string, CStrRef standalone = null_string); +bool f_xmlwriter_start_element(CObjRef xmlwriter, CStrRef name); +bool f_xmlwriter_start_element_ns(CObjRef xmlwriter, CStrRef prefix, CStrRef name, CStrRef uri); +bool f_xmlwriter_write_element_ns(CObjRef xmlwriter, CStrRef prefix, CStrRef name, CStrRef uri, CStrRef content = null_string); +bool f_xmlwriter_write_element(CObjRef xmlwriter, CStrRef name, CStrRef content = null_string); +bool f_xmlwriter_end_element(CObjRef xmlwriter); +bool f_xmlwriter_full_end_element(CObjRef xmlwriter); +bool f_xmlwriter_start_attribute_ns(CObjRef xmlwriter, CStrRef prefix, CStrRef name, CStrRef uri); +bool f_xmlwriter_start_attribute(CObjRef xmlwriter, CStrRef name); +bool f_xmlwriter_write_attribute_ns(CObjRef xmlwriter, CStrRef prefix, CStrRef name, CStrRef uri, CStrRef content); +bool f_xmlwriter_write_attribute(CObjRef xmlwriter, CStrRef name, CStrRef value); +bool f_xmlwriter_end_attribute(CObjRef xmlwriter); +bool f_xmlwriter_start_cdata(CObjRef xmlwriter); +bool f_xmlwriter_write_cdata(CObjRef xmlwriter, CStrRef content); +bool f_xmlwriter_end_cdata(CObjRef xmlwriter); +bool f_xmlwriter_start_comment(CObjRef xmlwriter); +bool f_xmlwriter_write_comment(CObjRef xmlwriter, CStrRef content); +bool f_xmlwriter_end_comment(CObjRef xmlwriter); +bool f_xmlwriter_end_document(CObjRef xmlwriter); +bool f_xmlwriter_start_pi(CObjRef xmlwriter, CStrRef target); +bool f_xmlwriter_write_pi(CObjRef xmlwriter, CStrRef target, CStrRef content); +bool f_xmlwriter_end_pi(CObjRef xmlwriter); +bool f_xmlwriter_text(CObjRef xmlwriter, CStrRef content); +bool f_xmlwriter_write_raw(CObjRef xmlwriter, CStrRef content); +bool f_xmlwriter_start_dtd(CObjRef xmlwriter, CStrRef qualifiedname, CStrRef publicid = null_string, CStrRef systemid = null_string); +bool f_xmlwriter_write_dtd(CObjRef xmlwriter, CStrRef name, CStrRef publicid = null_string, CStrRef systemid = null_string, CStrRef subset = null_string); +bool f_xmlwriter_start_dtd_element(CObjRef xmlwriter, CStrRef qualifiedname); +bool f_xmlwriter_write_dtd_element(CObjRef xmlwriter, CStrRef name, CStrRef content); +bool f_xmlwriter_end_dtd_element(CObjRef xmlwriter); +bool f_xmlwriter_start_dtd_attlist(CObjRef xmlwriter, CStrRef name); +bool f_xmlwriter_write_dtd_attlist(CObjRef xmlwriter, CStrRef name, CStrRef content); +bool f_xmlwriter_end_dtd_attlist(CObjRef xmlwriter); +bool f_xmlwriter_start_dtd_entity(CObjRef xmlwriter, CStrRef name, bool isparam); +bool f_xmlwriter_write_dtd_entity(CObjRef xmlwriter, CStrRef name, CStrRef content, bool pe = false, CStrRef publicid = null_string, CStrRef systemid = null_string, CStrRef ndataid = null_string); +bool f_xmlwriter_end_dtd_entity(CObjRef xmlwriter); +bool f_xmlwriter_end_dtd(CObjRef xmlwriter); +Variant f_xmlwriter_flush(CObjRef xmlwriter, bool empty = true); +String f_xmlwriter_output_memory(CObjRef xmlwriter, bool flush = true); + +/////////////////////////////////////////////////////////////////////////////// +// class xmlwriter + +FORWARD_DECLARE_CLASS(xmlwriter); +class c_xmlwriter : public ObjectData { + public: + BEGIN_CLASS_MAP(xmlwriter) + END_CLASS_MAP(xmlwriter) + DECLARE_CLASS(xmlwriter, xmlwriter, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_xmlwriter(); + public: ~c_xmlwriter(); + public: void t___construct(); + public: bool t_openmemory(); + public: bool t_openuri(CStrRef uri); + public: bool t_setindentstring(CStrRef indentstring); + public: bool t_setindent(bool indent); + public: bool t_startdocument(CStrRef version = "1.0", CStrRef encoding = null_string, CStrRef standalone = null_string); + public: bool t_startelement(CStrRef name); + public: bool t_startelementns(CStrRef prefix, CStrRef name, CStrRef uri); + public: bool t_writeelementns(CStrRef prefix, CStrRef name, CStrRef uri, CStrRef content = null_string); + public: bool t_writeelement(CStrRef name, CStrRef content = null_string); + public: bool t_endelement(); + public: bool t_fullendelement(); + public: bool t_startattributens(CStrRef prefix, CStrRef name, CStrRef uri); + public: bool t_startattribute(CStrRef name); + public: bool t_writeattributens(CStrRef prefix, CStrRef name, CStrRef uri, CStrRef content); + public: bool t_writeattribute(CStrRef name, CStrRef value); + public: bool t_endattribute(); + public: bool t_startcdata(); + public: bool t_writecdata(CStrRef content); + public: bool t_endcdata(); + public: bool t_startcomment(); + public: bool t_writecomment(CStrRef content); + public: bool t_endcomment(); + public: bool t_enddocument(); + public: bool t_startpi(CStrRef target); + public: bool t_writepi(CStrRef target, CStrRef content); + public: bool t_endpi(); + public: bool t_text(CStrRef content); + public: bool t_writeraw(CStrRef content); + public: bool t_startdtd(CStrRef qualifiedname, CStrRef publicid = null_string, CStrRef systemid = null_string); + public: bool t_writedtd(CStrRef name, CStrRef publicid = null_string, CStrRef systemid = null_string, CStrRef subset = null_string); + public: bool t_startdtdelement(CStrRef qualifiedname); + public: bool t_writedtdelement(CStrRef name, CStrRef content); + public: bool t_enddtdelement(); + public: bool t_startdtdattlist(CStrRef name); + public: bool t_writedtdattlist(CStrRef name, CStrRef content); + public: bool t_enddtdattlist(); + public: bool t_startdtdentity(CStrRef name, bool isparam); + public: bool t_writedtdentity(CStrRef name, CStrRef content, bool pe = false, CStrRef publicid = null_string, CStrRef systemid = null_string, CStrRef ndataid = null_string); + public: bool t_enddtdentity(); + public: bool t_enddtd(); + public: Variant t_flush(bool empty = true); + public: String t_outputmemory(bool flush = true); + public: Variant t___destruct(); + + // implemented by HPHP + public: ObjectData *create(); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: + SmartObject m_uri; + private: + xmlTextWriterPtr m_ptr; + xmlBufferPtr m_output; + xmlOutputBufferPtr m_uri_output; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_XMLWRITER_H__ diff --git a/src/cpp/ext/ext_zlib.cpp b/src/cpp/ext/ext_zlib.cpp new file mode 100644 index 0000000000000..7569c19d0ab57 --- /dev/null +++ b/src/cpp/ext/ext_zlib.cpp @@ -0,0 +1,127 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +#define PHP_ZLIB_MODIFIER 1000 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// zlib functions + +Variant f_readgzfile(CStrRef filename, bool use_include_path /* = false */) { + Object stream = f_gzopen(filename, "rb", use_include_path); + if (stream.isNull()) { + return false; + } + return f_gzpassthru(stream); +} + +Variant f_gzfile(CStrRef filename, bool use_include_path /* = false */) { + Object stream = f_gzopen(filename, "rb", use_include_path); + if (stream.isNull()) { + return false; + } + + Array ret; + String line; + while (!(line = f_gzgets(stream)).isNull()) { + ret.append(line); + } + return ret; +} + +Variant f_gzcompress(CStrRef data, int level /* = -1 */) { + if (level < -1 || level > 9) { + throw InvalidArgumentException("level", level); + } + int len = data.size(); + char *ret = gzcompress(data.data(), len, level); + if (ret == NULL) { + return false; + } + return String(ret, len, AttachString); +} + +Variant f_gzuncompress(CStrRef data, int limit /* = 0 */) { + int len = data.size(); + char *ret = gzuncompress(data.data(), len, limit); + if (ret == NULL) { + return false; + } + return String(ret, len, AttachString); +} + +Variant f_gzdeflate(CStrRef data, int level /* = -1 */) { + if (level < -1 || level > 9) { + throw InvalidArgumentException("level", level); + } + int len = data.size(); + char *ret = gzdeflate(data.data(), len, level); + if (ret == NULL) { + return false; + } + return String(ret, len, AttachString); +} + +Variant f_gzinflate(CStrRef data, int limit /* = 0 */) { + int len = data.size(); + char *ret = gzinflate(data.data(), len, limit); + if (ret == NULL) { + return false; + } + return String(ret, len, AttachString); +} + +Variant f_gzencode(CStrRef data, int level /* = -1 */, + int encoding_mode /* = k_FORCE_GZIP */) { + int len = data.size(); + char *ret = gzencode(data.data(), len, level, encoding_mode); + if (ret == NULL) { + return false; + } + return String(ret, len, AttachString); +} + +Variant f_gzdecode(CStrRef data) { + int len = data.size(); + char *ret = gzdecode(data.data(), len); + if (ret == NULL) { + return false; + } + return String(ret, len, AttachString); +} + +/////////////////////////////////////////////////////////////////////////////// +// stream functions + +Object f_gzopen(CStrRef filename, CStrRef mode, + bool use_include_path /* = false */) { + File *file = NEW(ZipFile)(); + Object handle(file); + bool ret = file->open(File::TranslatePath(filename), mode); + if (!ret) { + Logger::Warning("%s",Util::safe_strerror(errno).c_str()); + return false; + } + return handle; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/ext_zlib.h b/src/cpp/ext/ext_zlib.h new file mode 100644 index 0000000000000..8465036523cbd --- /dev/null +++ b/src/cpp/ext/ext_zlib.h @@ -0,0 +1,87 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_ZLIB_H__ +#define __EXT_ZLIB_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// zlib functions + +Variant f_readgzfile(CStrRef filename, bool use_include_path = false); +Variant f_gzfile(CStrRef filename, bool use_include_path = false); +Variant f_gzcompress(CStrRef data, int level = -1); +Variant f_gzuncompress(CStrRef data, int limit = 0); +Variant f_gzdeflate(CStrRef data, int level = -1); +Variant f_gzinflate(CStrRef data, int limit = 0); +Variant f_gzencode(CStrRef data, int level = -1, + int encoding_mode = k_FORCE_GZIP); +Variant f_gzdecode(CStrRef data); +inline String f_zlib_get_coding_type() { + throw NotSupportedException(__func__, "no use"); +} + +/////////////////////////////////////////////////////////////////////////////// +// stream functions + +Object f_gzopen(CStrRef filename, CStrRef mode, bool use_include_path = false); + +inline bool f_gzclose(CObjRef zp) { + return f_fclose(zp); +} +inline Variant f_gzread(CObjRef zp, int64 length = 0) { + return f_fread(zp, length); +} +inline Variant f_gzseek(CObjRef zp, int64 offset, int64 whence = SEEK_SET) { + return f_fseek(zp, offset, whence); +} +inline Variant f_gztell(CObjRef zp) { + return f_ftell(zp); +} +inline bool f_gzeof(CObjRef zp) { + return f_feof(zp); +} +inline bool f_gzrewind(CObjRef zp) { + return f_rewind(zp); +} +inline Variant f_gzgetc(CObjRef zp) { + return f_fgetc(zp); +} +inline String f_gzgets(CObjRef zp, int64 length = 1024) { + return f_fgets(zp, length); +} +inline String f_gzgetss(CObjRef zp, int64 length = 0, + CStrRef allowable_tags = null_string) { + return f_fgetss(zp, length, allowable_tags); +} +inline Variant f_gzpassthru(CObjRef zp) { + return f_fpassthru(zp); +} +inline Variant f_gzputs(CObjRef zp, CStrRef str, int64 length = 0) { + return f_fwrite(zp, str, length); +} +inline Variant f_gzwrite(CObjRef zp, CStrRef str, int64 length = 0) { + return f_fwrite(zp, str, length); +} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_ZLIB_H__ diff --git a/src/cpp/ext/fql/fql.cpp b/src/cpp/ext/fql/fql.cpp new file mode 100644 index 0000000000000..9dad81fca6583 --- /dev/null +++ b/src/cpp/ext/fql/fql.cpp @@ -0,0 +1,1577 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +/* Driver template for the LEMON parser generator. +** The author disclaims copyright to this source code. +*/ +/* First off, code is included that follows the "include" declaration +** in the input grammar file. */ +#include +#include +#include +#line 1 "fql.y" + +#include +#include +#include "fqlnode.h" +#include "fql.h" + +#line 15 "fql.c" +/* Next is all token values, in a form suitable for use by makeheaders. +** This section will be null unless lemon is run with the -m switch. +*/ +/* +** These constants (all generated automatically by the parser generator) +** specify the various kinds of tokens (terminals) that the parser +** understands. +** +** Each symbol here is a terminal symbol in the grammar. +*/ +/* Make sure the INTERFACE macro is defined. +*/ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/* The next thing included is series of defines which control +** various aspects of the generated parser. +** YYCODETYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 terminals +** and nonterminals. "int" is used otherwise. +** YYNOCODE is a number of type YYCODETYPE which corresponds +** to no legal terminal or nonterminal number. This +** number is used to fill in empty slots of the hash +** table. +** YYFALLBACK If defined, this indicates that one or more tokens +** have fall-back values which should be used if the +** original value of the token will not parse. +** YYACTIONTYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 rules and +** states combined. "int" is used otherwise. +** ParseTOKENTYPE is the data type used for minor tokens given +** directly to the parser from the tokenizer. +** YYMINORTYPE is the data type used for all minor tokens. +** This is typically a union of many types, one of +** which is ParseTOKENTYPE. The entry in the union +** for base tokens is called "yy0". +** YYSTACKDEPTH is the maximum depth of the parser's stack. If +** zero the stack is dynamically sized using realloc() +** ParseARG_SDECL A static variable declaration for the %extra_argument +** ParseARG_PDECL A parameter declaration for the %extra_argument +** ParseARG_STORE Code to store %extra_argument into yypParser +** ParseARG_FETCH Code to extract %extra_argument from yypParser +** YYNSTATE the combined number of states. +** YYNRULE the number of rules in the grammar +** YYERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +*/ +#define YYCODETYPE unsigned char +#define YYNOCODE 49 +#define YYACTIONTYPE unsigned char +#define ParseTOKENTYPE FQLToken +typedef union { + int yyinit; + ParseTOKENTYPE yy0; + FQLOrderByNode * yy7; + int yy28; + FQLLimitNode * yy43; + FQLStatementNode * yy45; + FQLConstantNode * yy46; + FQLExpressionListNode * yy72; + FQLExpressionNode * yy88; + bool yy89; +} YYMINORTYPE; +#ifndef YYSTACKDEPTH +#define YYSTACKDEPTH 100 +#endif +#define ParseARG_SDECL FQLParserState * __attribute__((unused)) state ; +#define ParseARG_PDECL , FQLParserState * __attribute__((unused)) state +#define ParseARG_FETCH FQLParserState * __attribute__((unused)) state = yypParser->state +#define ParseARG_STORE yypParser->state = state +#define YYNSTATE 87 +#define YYNRULE 51 +#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) +#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) +#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) + +/* The yyzerominor constant is used to initialize instances of +** YYMINORTYPE objects to zero. */ +static const YYMINORTYPE yyzerominor = { 0 }; + + +/* Next are the tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** +** N == YYNSTATE+YYNRULE A syntax error has occurred. +** +** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** +** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused +** slots in the yy_action[] table. +** +** The action table is constructed as a single large table named yy_action[]. +** Given state S and lookahead X, the action is computed as +** +** yy_action[ yy_shift_ofst[S] + X ] +** +** If the index value yy_shift_ofst[S]+X is out of range or if the value +** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] +** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table +** and that yy_default[S] should be used instead. +** +** The formula above is for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the yy_reduce_ofst[] array is used in place of +** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of +** YY_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** yy_action[] A single table containing all actions. +** yy_lookahead[] A table containing the lookahead for each entry in +** yy_action. Used to detect hash collisions. +** yy_shift_ofst[] For each state, the offset into yy_action for +** shifting terminals. +** yy_reduce_ofst[] For each state, the offset into yy_action for +** shifting non-terminals after a reduce. +** yy_default[] Default action for each state. +*/ +static const YYACTIONTYPE yy_action[] = { + /* 0 */ 32, 75, 39, 40, 50, 58, 59, 75, 47, 43, + /* 10 */ 49, 31, 33, 73, 74, 27, 2, 75, 29, 73, + /* 20 */ 74, 15, 16, 75, 56, 43, 49, 31, 33, 73, + /* 30 */ 74, 34, 75, 42, 33, 73, 74, 75, 28, 47, + /* 40 */ 43, 49, 31, 33, 73, 74, 35, 75, 5, 73, + /* 50 */ 67, 22, 58, 59, 47, 43, 49, 31, 33, 73, + /* 60 */ 74, 2, 139, 75, 52, 62, 23, 54, 64, 75, + /* 70 */ 57, 78, 19, 31, 33, 73, 74, 45, 6, 79, + /* 80 */ 80, 73, 71, 65, 66, 17, 26, 75, 37, 75, + /* 90 */ 41, 13, 24, 75, 55, 43, 49, 31, 33, 73, + /* 100 */ 74, 73, 72, 10, 75, 81, 18, 14, 8, 83, + /* 110 */ 75, 36, 43, 49, 31, 33, 73, 74, 75, 44, + /* 120 */ 31, 33, 73, 74, 25, 51, 43, 49, 31, 33, + /* 130 */ 73, 74, 75, 38, 60, 87, 84, 20, 61, 53, + /* 140 */ 43, 49, 31, 33, 73, 74, 75, 11, 63, 12, + /* 150 */ 14, 13, 30, 21, 43, 49, 31, 33, 73, 74, + /* 160 */ 52, 41, 46, 52, 10, 69, 3, 78, 9, 10, + /* 170 */ 78, 140, 140, 45, 6, 79, 45, 6, 79, 86, + /* 180 */ 52, 17, 85, 52, 17, 140, 140, 78, 140, 140, + /* 190 */ 78, 140, 140, 45, 6, 79, 77, 6, 79, 140, + /* 200 */ 75, 17, 140, 140, 17, 140, 140, 52, 48, 49, + /* 210 */ 31, 33, 73, 74, 78, 140, 52, 140, 4, 140, + /* 220 */ 45, 6, 79, 78, 140, 7, 68, 7, 17, 140, + /* 230 */ 1, 79, 7, 70, 140, 76, 140, 140, 140, 140, + /* 240 */ 82, +}; +static const YYCODETYPE yy_lookahead[] = { + /* 0 */ 31, 32, 13, 14, 35, 36, 37, 32, 39, 40, + /* 10 */ 41, 42, 43, 44, 45, 30, 2, 32, 43, 44, + /* 20 */ 45, 24, 25, 32, 39, 40, 41, 42, 43, 44, + /* 30 */ 45, 31, 32, 42, 43, 44, 45, 32, 3, 39, + /* 40 */ 40, 41, 42, 43, 44, 45, 31, 32, 13, 44, + /* 50 */ 45, 35, 36, 37, 39, 40, 41, 42, 43, 44, + /* 60 */ 45, 2, 46, 32, 5, 29, 4, 5, 28, 32, + /* 70 */ 1, 12, 41, 42, 43, 44, 45, 18, 19, 20, + /* 80 */ 21, 44, 45, 9, 10, 26, 34, 32, 47, 32, + /* 90 */ 7, 17, 38, 32, 39, 40, 41, 42, 43, 44, + /* 100 */ 45, 44, 45, 15, 32, 44, 22, 23, 6, 21, + /* 110 */ 32, 39, 40, 41, 42, 43, 44, 45, 32, 41, + /* 120 */ 42, 43, 44, 45, 34, 39, 40, 41, 42, 43, + /* 130 */ 44, 45, 32, 11, 33, 0, 33, 12, 12, 39, + /* 140 */ 40, 41, 42, 43, 44, 45, 32, 8, 12, 16, + /* 150 */ 23, 17, 20, 39, 40, 41, 42, 43, 44, 45, + /* 160 */ 5, 7, 19, 5, 15, 21, 19, 12, 6, 15, + /* 170 */ 12, 48, 48, 18, 19, 20, 18, 19, 20, 24, + /* 180 */ 5, 26, 24, 5, 26, 48, 48, 12, 48, 48, + /* 190 */ 12, 48, 48, 18, 19, 20, 21, 19, 20, 48, + /* 200 */ 32, 26, 48, 48, 26, 48, 48, 5, 40, 41, + /* 210 */ 42, 43, 44, 45, 12, 48, 5, 48, 13, 48, + /* 220 */ 18, 19, 20, 12, 48, 13, 21, 13, 26, 48, + /* 230 */ 19, 20, 13, 21, 48, 21, 48, 48, 48, 48, + /* 240 */ 21, +}; +#define YY_SHIFT_USE_DFLT (-12) +#define YY_SHIFT_MAX 56 +static const short yy_shift_ofst[] = { + /* 0 */ 14, 59, 155, 175, 202, 158, 202, 202, 202, 202, + /* 10 */ 202, 202, 202, 178, 178, 178, 178, 178, 211, 74, + /* 20 */ -11, 154, 69, 102, 83, 122, 122, 35, 62, -3, + /* 30 */ 205, 84, 212, -3, 214, 219, 88, 135, 125, 126, + /* 40 */ 136, 139, 127, 133, 134, 143, 132, 149, 133, 134, + /* 50 */ 144, 149, 147, 149, 162, 149, 149, +}; +#define YY_REDUCE_USE_DFLT (-32) +#define YY_REDUCE_MAX 26 +static const short yy_reduce_ofst[] = { + /* 0 */ 16, -31, -15, 0, 15, 55, 72, 86, 100, 114, + /* 10 */ 168, 31, 78, -9, -25, 5, 37, 57, 61, 40, + /* 20 */ 36, 52, 41, 54, 90, 101, 103, +}; +static const YYACTIONTYPE yy_default[] = { + /* 0 */ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, + /* 10 */ 138, 138, 138, 138, 138, 138, 138, 138, 138, 100, + /* 20 */ 105, 97, 91, 94, 97, 103, 103, 138, 138, 118, + /* 30 */ 138, 117, 138, 119, 138, 138, 138, 138, 138, 138, + /* 40 */ 138, 138, 110, 106, 109, 138, 138, 132, 107, 108, + /* 50 */ 138, 133, 126, 95, 138, 137, 136, 90, 88, 89, + /* 60 */ 92, 101, 102, 104, 96, 98, 99, 120, 111, 113, + /* 70 */ 114, 121, 124, 125, 122, 127, 128, 129, 130, 131, + /* 80 */ 115, 116, 112, 123, 93, 135, 134, +}; +#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0])) + +/* The next table maps tokens into fallback tokens. If a construct +** like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammar, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +*/ +#ifdef YYFALLBACK +static const YYCODETYPE yyFallback[] = { +}; +#endif /* YYFALLBACK */ + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +*/ +struct yyStackEntry { + YYACTIONTYPE stateno; /* The state-number */ + YYCODETYPE major; /* The major token value. This is the code + ** number for the token at this stack level */ + YYMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ +}; +typedef struct yyStackEntry yyStackEntry; + +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct yyParser { + int yyidx; /* Index of top element in stack */ +#ifdef YYTRACKMAXSTACKDEPTH + int yyidxMax; /* Maximum value of yyidx */ +#endif + int yyerrcnt; /* Shifts left before out of the error */ + ParseARG_SDECL /* A place to hold %extra_argument */ +#if YYSTACKDEPTH<=0 + int yystksz; /* Current side of the stack */ + yyStackEntry *yystack; /* The parser's stack */ +#else + yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ +#endif +}; +typedef struct yyParser yyParser; + +#ifndef NDEBUG +#include +static FILE *yyTraceFILE = 0; +static char *yyTracePrompt = 0; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* +** Turn parser tracing on by giving a stream to which to write the trace +** and a prompt to preface each trace message. Tracing is turned off +** by making either argument NULL +** +** Inputs: +**
      +**
    • A FILE* to which trace output should be written. +** If NULL, then tracing is turned off. +**
    • A prefix string written at the beginning of every +** line of trace output. If NULL, then tracing is +** turned off. +**
    +** +** Outputs: +** None. +*/ +void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ + yyTraceFILE = TraceFILE; + yyTracePrompt = zTracePrompt; + if( yyTraceFILE==0 ) yyTracePrompt = 0; + else if( yyTracePrompt==0 ) yyTraceFILE = 0; +} +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *const yyTokenName[] = { + "$", "SEMICOLON", "SELECT", "FROM", + "VIRT_TABLE", "IDENT", "WHERE", "ORDER", + "BY", "DESC", "ASC", "LIMIT", + "INT", "COMMA", "OFFSET", "OR", + "AND", "CMP", "CONTAINS", "OPEN_PAREN", + "STRING", "CLOSE_PAREN", "IN", "ADD_OP", + "STAR", "SLASH", "NOT", "error", + "opt_desc", "opt_offset", "star_catching_expr_list", "expression_list", + "constant", "opt_limit", "opt_order", "statement", + "virt_statement", "native_statement", "opt_where", "disjunction", + "conjunction", "expression", "sum", "prod", + "term", "big_term", "start", "opt_semicolon", +}; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. +*/ +static const char *const yyRuleName[] = { + /* 0 */ "start ::= statement opt_semicolon", + /* 1 */ "statement ::= virt_statement", + /* 2 */ "statement ::= native_statement", + /* 3 */ "opt_semicolon ::= SEMICOLON", + /* 4 */ "opt_semicolon ::=", + /* 5 */ "virt_statement ::= SELECT star_catching_expr_list FROM VIRT_TABLE opt_where opt_order opt_limit", + /* 6 */ "native_statement ::= SELECT star_catching_expr_list FROM IDENT WHERE disjunction opt_order opt_limit", + /* 7 */ "opt_where ::=", + /* 8 */ "opt_where ::= WHERE disjunction", + /* 9 */ "opt_order ::= ORDER BY expression opt_desc", + /* 10 */ "opt_order ::=", + /* 11 */ "opt_desc ::= DESC", + /* 12 */ "opt_desc ::= ASC", + /* 13 */ "opt_desc ::=", + /* 14 */ "opt_limit ::= LIMIT INT COMMA INT", + /* 15 */ "opt_limit ::= LIMIT INT opt_offset", + /* 16 */ "opt_limit ::=", + /* 17 */ "opt_offset ::= OFFSET INT", + /* 18 */ "opt_offset ::=", + /* 19 */ "disjunction ::= conjunction", + /* 20 */ "disjunction ::= disjunction OR conjunction", + /* 21 */ "conjunction ::= expression", + /* 22 */ "conjunction ::= conjunction AND expression", + /* 23 */ "expression ::= expression CMP sum", + /* 24 */ "expression ::= CONTAINS OPEN_PAREN STRING CLOSE_PAREN", + /* 25 */ "expression ::= CONTAINS OPEN_PAREN STRING COMMA expression_list CLOSE_PAREN", + /* 26 */ "expression ::= sum IN OPEN_PAREN statement CLOSE_PAREN", + /* 27 */ "expression ::= sum IN OPEN_PAREN expression_list CLOSE_PAREN", + /* 28 */ "expression ::= sum IN OPEN_PAREN CLOSE_PAREN", + /* 29 */ "expression ::= sum IN term", + /* 30 */ "expression ::= sum", + /* 31 */ "sum ::= sum ADD_OP prod", + /* 32 */ "sum ::= prod", + /* 33 */ "prod ::= prod STAR big_term", + /* 34 */ "prod ::= prod SLASH big_term", + /* 35 */ "prod ::= big_term", + /* 36 */ "big_term ::= OPEN_PAREN disjunction CLOSE_PAREN", + /* 37 */ "big_term ::= NOT big_term", + /* 38 */ "big_term ::= term", + /* 39 */ "term ::= IDENT", + /* 40 */ "term ::= constant", + /* 41 */ "term ::= IDENT OPEN_PAREN expression_list CLOSE_PAREN", + /* 42 */ "term ::= IDENT OPEN_PAREN CLOSE_PAREN", + /* 43 */ "constant ::= INT", + /* 44 */ "constant ::= STRING", + /* 45 */ "expression_list ::= disjunction", + /* 46 */ "expression_list ::= expression_list COMMA disjunction", + /* 47 */ "star_catching_expr_list ::= STAR", + /* 48 */ "star_catching_expr_list ::= star_catching_expr_list COMMA STAR", + /* 49 */ "star_catching_expr_list ::= disjunction", + /* 50 */ "star_catching_expr_list ::= star_catching_expr_list COMMA disjunction", +}; +#endif /* NDEBUG */ + + +#if YYSTACKDEPTH<=0 +/* +** Try to increase the size of the parser stack. +*/ +static void yyGrowStack(yyParser *p){ + int newSize; + yyStackEntry *pNew; + + newSize = p->yystksz*2 + 100; + pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + if( pNew ){ + p->yystack = pNew; + p->yystksz = newSize; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack grows to %d entries!\n", + yyTracePrompt, p->yystksz); + } +#endif + } +} +#endif + +/* +** This function allocates a new parser. +** The only argument is a pointer to a function which works like +** malloc. +** +** Inputs: +** A pointer to the function used to allocate memory. +** +** Outputs: +** A pointer to a parser. This pointer is used in subsequent calls +** to Parse and ParseFree. +*/ +void *ParseAlloc(void *(*mallocProc)(size_t)){ + yyParser *pParser; + pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); + if( pParser ){ + pParser->yyidx = -1; +#ifdef YYTRACKMAXSTACKDEPTH + pParser->yyidxMax = 0; +#endif +#if YYSTACKDEPTH<=0 + pParser->yystack = NULL; + pParser->yystksz = 0; + yyGrowStack(pParser); +#endif + } + return pParser; +} + +/* The following function deletes the value associated with a +** symbol. The symbol can be either a terminal or nonterminal. +** "yymajor" is the symbol code, and "yypminor" is a pointer to +** the value. +*/ +static void yy_destructor( + yyParser *yypParser, /* The parser */ + YYCODETYPE yymajor, /* Type code for object to destroy */ + YYMINORTYPE *yypminor /* The object to be destroyed */ +){ + ParseARG_FETCH; + switch( yymajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are not used + ** inside the C code. + */ + /* TERMINAL Destructor */ + case 1: /* SEMICOLON */ + case 2: /* SELECT */ + case 3: /* FROM */ + case 4: /* VIRT_TABLE */ + case 5: /* IDENT */ + case 6: /* WHERE */ + case 7: /* ORDER */ + case 8: /* BY */ + case 9: /* DESC */ + case 10: /* ASC */ + case 11: /* LIMIT */ + case 12: /* INT */ + case 13: /* COMMA */ + case 14: /* OFFSET */ + case 15: /* OR */ + case 16: /* AND */ + case 17: /* CMP */ + case 18: /* CONTAINS */ + case 19: /* OPEN_PAREN */ + case 20: /* STRING */ + case 21: /* CLOSE_PAREN */ + case 22: /* IN */ + case 23: /* ADD_OP */ + case 24: /* STAR */ + case 25: /* SLASH */ + case 26: /* NOT */ +{ +#line 29 "fql.y" + + if ((yypminor->yy0).token) { + free((yypminor->yy0).token); + (yypminor->yy0).token = NULL; + } + +#line 503 "fql.c" +} + break; + case 30: /* star_catching_expr_list */ + case 31: /* expression_list */ +{ +#line 36 "fql.y" + + if ((yypminor->yy72)) { + delete (yypminor->yy72); + } + +#line 515 "fql.c" +} + break; + case 32: /* constant */ +{ +#line 46 "fql.y" + + if ((yypminor->yy46)) { + delete (yypminor->yy46); + } + +#line 526 "fql.c" +} + break; + case 33: /* opt_limit */ +{ +#line 51 "fql.y" + + if ((yypminor->yy43)) { + delete (yypminor->yy43); + } + +#line 537 "fql.c" +} + break; + case 34: /* opt_order */ +{ +#line 56 "fql.y" + + if ((yypminor->yy7)) { + delete (yypminor->yy7); + } + +#line 548 "fql.c" +} + break; + case 35: /* statement */ +{ +#line 66 "fql.y" + + if ((yypminor->yy45)) { + delete (yypminor->yy45); + } + +#line 559 "fql.c" +} + break; + case 38: /* opt_where */ + case 39: /* disjunction */ + case 40: /* conjunction */ + case 41: /* expression */ + case 42: /* sum */ + case 43: /* prod */ + case 44: /* term */ + case 45: /* big_term */ +{ +#line 61 "fql.y" + + if ((yypminor->yy88)) { + delete (yypminor->yy88); + } + +#line 577 "fql.c" +} + break; + default: break; /* If no destructor action specified: do nothing */ + } +} + +/* +** Pop the parser's stack once. +** +** If there is a destructor routine associated with the token which +** is popped from the stack, then call it. +** +** Return the major token number for the symbol popped. +*/ +static int yy_pop_parser_stack(yyParser *pParser){ + YYCODETYPE yymajor; + yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; + + if( pParser->yyidx<0 ) return 0; +#ifndef NDEBUG + if( yyTraceFILE && pParser->yyidx>=0 ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + yymajor = yytos->major; + yy_destructor(pParser, yymajor, &yytos->minor); + pParser->yyidx--; + return yymajor; +} + +/* +** Deallocate and destroy a parser. Destructors are all called for +** all stack elements before shutting the parser down. +** +** Inputs: +**
      +**
    • A pointer to the parser. This should be a pointer +** obtained from ParseAlloc. +**
    • A pointer to a function used to reclaim memory obtained +** from malloc. +**
    +*/ +void ParseFree( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ + yyParser *pParser = (yyParser*)p; + if( pParser==0 ) return; + while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); +#if YYSTACKDEPTH<=0 + free(pParser->yystack); +#endif + (*freeProc)((void*)pParser); +} + +/* +** Return the peak depth of the stack for a parser. +*/ +#ifdef YYTRACKMAXSTACKDEPTH +int ParseStackPeak(void *p){ + yyParser *pParser = (yyParser*)p; + return pParser->yyidxMax; +} +#endif + +/* +** Find the appropriate action for a parser given the terminal +** look-ahead token iLookAhead. +** +** If the look-ahead token is YYNOCODE, then check to see if the action is +** independent of the look-ahead. If it is, return the action, otherwise +** return YY_NO_ACTION. +*/ +static int yy_find_shift_action( + yyParser *pParser, /* The parser */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; + int stateno = pParser->yystack[pParser->yyidx].stateno; + + if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){ + return yy_default[stateno]; + } + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; + if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ + if( iLookAhead>0 ){ +#ifdef YYFALLBACK + YYCODETYPE iFallback; /* Fallback token */ + if( iLookAhead %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + } +#endif + return yy_find_shift_action(pParser, iFallback); + } +#endif +#ifdef YYWILDCARD + { + int j = i - iLookAhead + YYWILDCARD; + if( j>=0 && j %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]); + } +#endif /* NDEBUG */ + return yy_action[j]; + } + } +#endif /* YYWILDCARD */ + } + return yy_default[stateno]; + }else{ + return yy_action[i]; + } +} + +/* +** Find the appropriate action for a parser given the non-terminal +** look-ahead token iLookAhead. +** +** If the look-ahead token is YYNOCODE, then check to see if the action is +** independent of the look-ahead. If it is, return the action, otherwise +** return YY_NO_ACTION. +*/ +static int yy_find_reduce_action( + int stateno, /* Current state number */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; +#ifdef YYERRORSYMBOL + if( stateno>YY_REDUCE_MAX ){ + return yy_default[stateno]; + } +#else + assert( stateno<=YY_REDUCE_MAX ); +#endif + i = yy_reduce_ofst[stateno]; + assert( i!=YY_REDUCE_USE_DFLT ); + assert( iLookAhead!=YYNOCODE ); + i += iLookAhead; +#ifdef YYERRORSYMBOL + if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ + return yy_default[stateno]; + } +#else + assert( i>=0 && iyyidx--; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ + ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ +} + +/* +** Perform a shift action. +*/ +static void yy_shift( + yyParser *yypParser, /* The parser to be shifted */ + int yyNewState, /* The new state to shift in */ + int yyMajor, /* The major token to shift in */ + YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */ +){ + yyStackEntry *yytos; + yypParser->yyidx++; +#ifdef YYTRACKMAXSTACKDEPTH + if( yypParser->yyidx>yypParser->yyidxMax ){ + yypParser->yyidxMax = yypParser->yyidx; + } +#endif +#if YYSTACKDEPTH>0 + if( yypParser->yyidx>=YYSTACKDEPTH ){ + yyStackOverflow(yypParser, yypMinor); + return; + } +#else + if( yypParser->yyidx>=yypParser->yystksz ){ + yyGrowStack(yypParser); + if( yypParser->yyidx>=yypParser->yystksz ){ + yyStackOverflow(yypParser, yypMinor); + return; + } + } +#endif + yytos = &yypParser->yystack[yypParser->yyidx]; + yytos->stateno = (YYACTIONTYPE)yyNewState; + yytos->major = (YYCODETYPE)yyMajor; + yytos->minor = *yypMinor; +#ifndef NDEBUG + if( yyTraceFILE && yypParser->yyidx>0 ){ + int i; + fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); + fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); + for(i=1; i<=yypParser->yyidx; i++) + fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); + fprintf(yyTraceFILE,"\n"); + } +#endif +} + +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static const struct { + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + unsigned char nrhs; /* Number of right-hand side symbols in the rule */ +} yyRuleInfo[] = { + { 46, 2 }, + { 35, 1 }, + { 35, 1 }, + { 47, 1 }, + { 47, 0 }, + { 36, 7 }, + { 37, 8 }, + { 38, 0 }, + { 38, 2 }, + { 34, 4 }, + { 34, 0 }, + { 28, 1 }, + { 28, 1 }, + { 28, 0 }, + { 33, 4 }, + { 33, 3 }, + { 33, 0 }, + { 29, 2 }, + { 29, 0 }, + { 39, 1 }, + { 39, 3 }, + { 40, 1 }, + { 40, 3 }, + { 41, 3 }, + { 41, 4 }, + { 41, 6 }, + { 41, 5 }, + { 41, 5 }, + { 41, 4 }, + { 41, 3 }, + { 41, 1 }, + { 42, 3 }, + { 42, 1 }, + { 43, 3 }, + { 43, 3 }, + { 43, 1 }, + { 45, 3 }, + { 45, 2 }, + { 45, 1 }, + { 44, 1 }, + { 44, 1 }, + { 44, 4 }, + { 44, 3 }, + { 32, 1 }, + { 32, 1 }, + { 31, 1 }, + { 31, 3 }, + { 30, 1 }, + { 30, 3 }, + { 30, 1 }, + { 30, 3 }, +}; + +static void yy_accept(yyParser*); /* Forward Declaration */ + +/* +** Perform a reduce action and the shift that must immediately +** follow the reduce. +*/ +static void yy_reduce( + yyParser *yypParser, /* The parser */ + int yyruleno /* Number of the rule by which to reduce */ +){ + int yygoto; /* The next state */ + int yyact; /* The next action */ + YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ + yyStackEntry *yymsp; /* The top of the parser's stack */ + int yysize; /* Amount to pop the stack */ + ParseARG_FETCH; + yymsp = &yypParser->yystack[yypParser->yyidx]; +#ifndef NDEBUG + if( yyTraceFILE && yyruleno>=0 + && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt, + yyRuleName[yyruleno]); + } +#endif /* NDEBUG */ + + /* Silence complaints from purify about yygotominor being uninitialized + ** in some cases when it is copied into the stack after the following + ** switch. yygotominor is uninitialized when a rule reduces that does + ** not set the value of its left-hand side nonterminal. Leaving the + ** value of the nonterminal uninitialized is utterly harmless as long + ** as the value is never used. So really the only thing this code + ** accomplishes is to quieten purify. + ** + ** 2007-01-16: The wireshark project (www.wireshark.org) reports that + ** without this code, their parser segfaults. I'm not sure what there + ** parser is doing to make this happen. This is the second bug report + ** from wireshark this week. Clearly they are stressing Lemon in ways + ** that it has not been previously stressed... (SQLite ticket #2172) + */ + /*memset(&yygotominor, 0, sizeof(yygotominor));*/ + yygotominor = yyzerominor; + + + switch( yyruleno ){ + /* Beginning here are the reduction cases. A typical example + ** follows: + ** case 0: + ** #line + ** { ... } // User supplied code + ** #line + ** break; + */ + case 0: /* start ::= statement opt_semicolon */ +#line 120 "fql.y" +{ + state->stmt = yymsp[-1].minor.yy45; +} +#line 916 "fql.c" + break; + case 1: /* statement ::= virt_statement */ + case 2: /* statement ::= native_statement */ +#line 124 "fql.y" +{ + yygotominor.yy45 = yymsp[0].minor.yy45; +} +#line 924 "fql.c" + break; + case 3: /* opt_semicolon ::= SEMICOLON */ +#line 130 "fql.y" +{ + yy_destructor(yypParser,1,&yymsp[0].minor); +} +#line 931 "fql.c" + break; + case 4: /* opt_semicolon ::= */ + case 7: /* opt_where ::= */ + case 10: /* opt_order ::= */ + case 16: /* opt_limit ::= */ +#line 131 "fql.y" +{ +} +#line 940 "fql.c" + break; + case 5: /* virt_statement ::= SELECT star_catching_expr_list FROM VIRT_TABLE opt_where opt_order opt_limit */ +#line 132 "fql.y" +{ + state->dependencies.insert(yymsp[-3].minor.yy0.token+1); + yygotominor.yy45 = new FQLStatementNode(yymsp[-5].minor.yy72, yymsp[-3].minor.yy0.token+1, yymsp[-2].minor.yy88, yymsp[-1].minor.yy7, yymsp[0].minor.yy43, false); + free(yymsp[-3].minor.yy0.token); + yymsp[-3].minor.yy0.token = NULL; + yy_destructor(yypParser,2,&yymsp[-6].minor); + yy_destructor(yypParser,3,&yymsp[-4].minor); +} +#line 952 "fql.c" + break; + case 6: /* native_statement ::= SELECT star_catching_expr_list FROM IDENT WHERE disjunction opt_order opt_limit */ +#line 138 "fql.y" +{ + fql_validate_table_name(yymsp[-4].minor.yy0.token, state); + yygotominor.yy45 = new FQLStatementNode(yymsp[-6].minor.yy72, yymsp[-4].minor.yy0.token, yymsp[-2].minor.yy88, yymsp[-1].minor.yy7, yymsp[0].minor.yy43, true); + free(yymsp[-4].minor.yy0.token); + yymsp[-4].minor.yy0.token = NULL; + yy_destructor(yypParser,2,&yymsp[-7].minor); + yy_destructor(yypParser,3,&yymsp[-5].minor); + yy_destructor(yypParser,6,&yymsp[-3].minor); +} +#line 965 "fql.c" + break; + case 8: /* opt_where ::= WHERE disjunction */ +#line 147 "fql.y" +{ + yygotominor.yy88 = yymsp[0].minor.yy88; + yy_destructor(yypParser,6,&yymsp[-1].minor); +} +#line 973 "fql.c" + break; + case 9: /* opt_order ::= ORDER BY expression opt_desc */ +#line 151 "fql.y" +{ + yygotominor.yy7 = new FQLOrderByNode(yymsp[-1].minor.yy88, yymsp[0].minor.yy89); + yy_destructor(yypParser,7,&yymsp[-3].minor); + yy_destructor(yypParser,8,&yymsp[-2].minor); +} +#line 982 "fql.c" + break; + case 11: /* opt_desc ::= DESC */ +#line 156 "fql.y" +{ + yygotominor.yy89 = true; + yy_destructor(yypParser,9,&yymsp[0].minor); +} +#line 990 "fql.c" + break; + case 12: /* opt_desc ::= ASC */ +#line 159 "fql.y" +{ yygotominor.yy89 = false; yy_destructor(yypParser,10,&yymsp[0].minor); +} +#line 996 "fql.c" + break; + case 13: /* opt_desc ::= */ +#line 160 "fql.y" +{ yygotominor.yy89 = false; } +#line 1001 "fql.c" + break; + case 14: /* opt_limit ::= LIMIT INT COMMA INT */ +#line 162 "fql.y" +{ + yygotominor.yy43 = new FQLLimitNode(atoi(yymsp[0].minor.yy0.token), atoi(yymsp[-2].minor.yy0.token)); + free(yymsp[0].minor.yy0.token); + free(yymsp[-2].minor.yy0.token); + yymsp[0].minor.yy0.token = NULL; + yymsp[-2].minor.yy0.token = NULL; + yy_destructor(yypParser,11,&yymsp[-3].minor); + yy_destructor(yypParser,13,&yymsp[-1].minor); +} +#line 1014 "fql.c" + break; + case 15: /* opt_limit ::= LIMIT INT opt_offset */ +#line 169 "fql.y" +{ + yygotominor.yy43 = new FQLLimitNode(atoi(yymsp[-1].minor.yy0.token), yymsp[0].minor.yy28); + free(yymsp[-1].minor.yy0.token); + yymsp[-1].minor.yy0.token = NULL; + yy_destructor(yypParser,11,&yymsp[-2].minor); +} +#line 1024 "fql.c" + break; + case 17: /* opt_offset ::= OFFSET INT */ +#line 175 "fql.y" +{ + yygotominor.yy28 = atoi(yymsp[0].minor.yy0.token); + free(yymsp[0].minor.yy0.token); + yymsp[0].minor.yy0.token = NULL; + yy_destructor(yypParser,14,&yymsp[-1].minor); +} +#line 1034 "fql.c" + break; + case 18: /* opt_offset ::= */ +#line 180 "fql.y" +{ yygotominor.yy28 = 0; } +#line 1039 "fql.c" + break; + case 19: /* disjunction ::= conjunction */ + case 21: /* conjunction ::= expression */ + case 30: /* expression ::= sum */ + case 32: /* sum ::= prod */ + case 35: /* prod ::= big_term */ + case 38: /* big_term ::= term */ +#line 182 "fql.y" +{ + yygotominor.yy88 = yymsp[0].minor.yy88; +} +#line 1051 "fql.c" + break; + case 20: /* disjunction ::= disjunction OR conjunction */ +#line 185 "fql.y" +{ + if (yymsp[-2].minor.yy88->nodeType() == FQL_DISJUNCTION) { + ((FQLDisjunctionNode *)yymsp[-2].minor.yy88)->append(yymsp[0].minor.yy88); + yygotominor.yy88 = yymsp[-2].minor.yy88; + } else { + FQLDisjunctionNode *node = new FQLDisjunctionNode(); + node->append(yymsp[-2].minor.yy88); + node->append(yymsp[0].minor.yy88); + yygotominor.yy88 = node; + } + yy_destructor(yypParser,15,&yymsp[-1].minor); +} +#line 1067 "fql.c" + break; + case 22: /* conjunction ::= conjunction AND expression */ +#line 200 "fql.y" +{ + if (yymsp[-2].minor.yy88->nodeType() == FQL_CONJUNCTION) { + ((FQLConjunctionNode *)yymsp[-2].minor.yy88)->append(yymsp[0].minor.yy88); + yygotominor.yy88 = yymsp[-2].minor.yy88; + } else { + FQLConjunctionNode *node = new FQLConjunctionNode(); + node->append(yymsp[-2].minor.yy88); + node->append(yymsp[0].minor.yy88); + yygotominor.yy88 = node; + } + yy_destructor(yypParser,16,&yymsp[-1].minor); +} +#line 1083 "fql.c" + break; + case 23: /* expression ::= expression CMP sum */ +#line 212 "fql.y" +{ + yygotominor.yy88 = new FQLComparisonExpressionNode(yymsp[-1].minor.yy0.token, yymsp[-2].minor.yy88, yymsp[0].minor.yy88); + free(yymsp[-1].minor.yy0.token); + yymsp[-1].minor.yy0.token = NULL; +} +#line 1092 "fql.c" + break; + case 24: /* expression ::= CONTAINS OPEN_PAREN STRING CLOSE_PAREN */ +#line 218 "fql.y" +{ + FQLExpressionListNode *empty = new FQLExpressionListNode(); + yygotominor.yy88 = new FQLContainsExpressionNode(std::string(yymsp[-1].minor.yy0.token+1, strlen(yymsp[-1].minor.yy0.token)-2), + empty); + free(yymsp[-1].minor.yy0.token); + yymsp[-1].minor.yy0.token = NULL; + yy_destructor(yypParser,18,&yymsp[-3].minor); + yy_destructor(yypParser,19,&yymsp[-2].minor); + yy_destructor(yypParser,21,&yymsp[0].minor); +} +#line 1106 "fql.c" + break; + case 25: /* expression ::= CONTAINS OPEN_PAREN STRING COMMA expression_list CLOSE_PAREN */ +#line 226 "fql.y" +{ + yygotominor.yy88 = new FQLContainsExpressionNode(std::string(yymsp[-3].minor.yy0.token+1, strlen(yymsp[-3].minor.yy0.token)-2), yymsp[-1].minor.yy72); + free(yymsp[-3].minor.yy0.token); + yymsp[-3].minor.yy0.token = NULL; + yy_destructor(yypParser,18,&yymsp[-5].minor); + yy_destructor(yypParser,19,&yymsp[-4].minor); + yy_destructor(yypParser,13,&yymsp[-2].minor); + yy_destructor(yypParser,21,&yymsp[0].minor); +} +#line 1119 "fql.c" + break; + case 26: /* expression ::= sum IN OPEN_PAREN statement CLOSE_PAREN */ +#line 232 "fql.y" +{ + yygotominor.yy88 = new FQLInStatementNode(yymsp[-4].minor.yy88, yymsp[-1].minor.yy45); + yy_destructor(yypParser,22,&yymsp[-3].minor); + yy_destructor(yypParser,19,&yymsp[-2].minor); + yy_destructor(yypParser,21,&yymsp[0].minor); +} +#line 1129 "fql.c" + break; + case 27: /* expression ::= sum IN OPEN_PAREN expression_list CLOSE_PAREN */ +#line 235 "fql.y" +{ + yygotominor.yy88 = new FQLInArrayNode(yymsp[-4].minor.yy88, yymsp[-1].minor.yy72); + yy_destructor(yypParser,22,&yymsp[-3].minor); + yy_destructor(yypParser,19,&yymsp[-2].minor); + yy_destructor(yypParser,21,&yymsp[0].minor); +} +#line 1139 "fql.c" + break; + case 28: /* expression ::= sum IN OPEN_PAREN CLOSE_PAREN */ +#line 238 "fql.y" +{ + yygotominor.yy88 = new FQLInArrayNode(yymsp[-3].minor.yy88, new FQLExpressionListNode()); + yy_destructor(yypParser,22,&yymsp[-2].minor); + yy_destructor(yypParser,19,&yymsp[-1].minor); + yy_destructor(yypParser,21,&yymsp[0].minor); +} +#line 1149 "fql.c" + break; + case 29: /* expression ::= sum IN term */ +#line 241 "fql.y" +{ + // make a list + FQLExpressionListNode *node = new FQLExpressionListNode(yymsp[0].minor.yy88); + yygotominor.yy88 = new FQLInArrayNode(yymsp[-2].minor.yy88, node); + yy_destructor(yypParser,22,&yymsp[-1].minor); +} +#line 1159 "fql.c" + break; + case 31: /* sum ::= sum ADD_OP prod */ +#line 250 "fql.y" +{ + yygotominor.yy88 = new FQLArithmeticExpressionNode(yymsp[-1].minor.yy0.token, yymsp[-2].minor.yy88, yymsp[0].minor.yy88); + free(yymsp[-1].minor.yy0.token); + yymsp[-1].minor.yy0.token = NULL; +} +#line 1168 "fql.c" + break; + case 33: /* prod ::= prod STAR big_term */ +#line 258 "fql.y" +{ + yygotominor.yy88 = new FQLArithmeticExpressionNode("*", yymsp[-2].minor.yy88, yymsp[0].minor.yy88); + yy_destructor(yypParser,24,&yymsp[-1].minor); +} +#line 1176 "fql.c" + break; + case 34: /* prod ::= prod SLASH big_term */ +#line 261 "fql.y" +{ + yygotominor.yy88 = new FQLArithmeticExpressionNode("/", yymsp[-2].minor.yy88, yymsp[0].minor.yy88); + yy_destructor(yypParser,25,&yymsp[-1].minor); +} +#line 1184 "fql.c" + break; + case 36: /* big_term ::= OPEN_PAREN disjunction CLOSE_PAREN */ +#line 268 "fql.y" +{ + yygotominor.yy88 = yymsp[-1].minor.yy88; + yy_destructor(yypParser,19,&yymsp[-2].minor); + yy_destructor(yypParser,21,&yymsp[0].minor); +} +#line 1193 "fql.c" + break; + case 37: /* big_term ::= NOT big_term */ +#line 271 "fql.y" +{ + yygotominor.yy88 = new FQLNotExpressionNode(yymsp[0].minor.yy88); + yy_destructor(yypParser,26,&yymsp[-1].minor); +} +#line 1201 "fql.c" + break; + case 39: /* term ::= IDENT */ +#line 278 "fql.y" +{ + yygotominor.yy88 = new FQLFieldExpressionNode(yymsp[0].minor.yy0.token); + free(yymsp[0].minor.yy0.token); + yymsp[0].minor.yy0.token = NULL; +} +#line 1210 "fql.c" + break; + case 40: /* term ::= constant */ +#line 283 "fql.y" +{ + yygotominor.yy88 = yymsp[0].minor.yy46; +} +#line 1217 "fql.c" + break; + case 41: /* term ::= IDENT OPEN_PAREN expression_list CLOSE_PAREN */ +#line 286 "fql.y" +{ + try { + fql_validate_function_data(yymsp[-3].minor.yy0.token, yymsp[-1].minor.yy72); + } catch (FQLParserException e) { + state->errors.push_back(e); + } + yygotominor.yy88 = new FQLFunctionExpressionNode(yymsp[-3].minor.yy0.token, yymsp[-1].minor.yy72); + free(yymsp[-3].minor.yy0.token); + yymsp[-3].minor.yy0.token = NULL; + yy_destructor(yypParser,19,&yymsp[-2].minor); + yy_destructor(yypParser,21,&yymsp[0].minor); +} +#line 1233 "fql.c" + break; + case 42: /* term ::= IDENT OPEN_PAREN CLOSE_PAREN */ +#line 297 "fql.y" +{ + try { + fql_validate_function_data(yymsp[-2].minor.yy0.token, NULL); + } catch (FQLParserException e) { + state->errors.push_back(e); + } + FQLExpressionListNode *empty = new FQLExpressionListNode(); + yygotominor.yy88 = new FQLFunctionExpressionNode(yymsp[-2].minor.yy0.token, empty); + free(yymsp[-2].minor.yy0.token); + yymsp[-2].minor.yy0.token = NULL; + yy_destructor(yypParser,19,&yymsp[-1].minor); + yy_destructor(yypParser,21,&yymsp[0].minor); +} +#line 1250 "fql.c" + break; + case 43: /* constant ::= INT */ +#line 309 "fql.y" +{ + yygotominor.yy46 = new FQLConstantNode(yymsp[0].minor.yy0.token); + free(yymsp[0].minor.yy0.token); + yymsp[0].minor.yy0.token = NULL; +} +#line 1259 "fql.c" + break; + case 44: /* constant ::= STRING */ +#line 314 "fql.y" +{ + yygotominor.yy46 = new FQLConstantNode(std::string(yymsp[0].minor.yy0.token+1, strlen(yymsp[0].minor.yy0.token)-2)); + free(yymsp[0].minor.yy0.token); + yymsp[0].minor.yy0.token = NULL; +} +#line 1268 "fql.c" + break; + case 45: /* expression_list ::= disjunction */ + case 49: /* star_catching_expr_list ::= disjunction */ +#line 320 "fql.y" +{ + yygotominor.yy72 = new FQLExpressionListNode(); + yygotominor.yy72->append(yymsp[0].minor.yy88); +} +#line 1277 "fql.c" + break; + case 46: /* expression_list ::= expression_list COMMA disjunction */ + case 50: /* star_catching_expr_list ::= star_catching_expr_list COMMA disjunction */ +#line 324 "fql.y" +{ + yygotominor.yy72 = yymsp[-2].minor.yy72; + yygotominor.yy72->append(yymsp[0].minor.yy88); + yy_destructor(yypParser,13,&yymsp[-1].minor); +} +#line 1287 "fql.c" + break; + case 47: /* star_catching_expr_list ::= STAR */ +#line 329 "fql.y" +{ + yygotominor.yy72 = NULL; + throw FQLParserException("SELECT * is not supported. Please manually list the columns you are interested in."); + yy_destructor(yypParser,24,&yymsp[0].minor); +} +#line 1296 "fql.c" + break; + case 48: /* star_catching_expr_list ::= star_catching_expr_list COMMA STAR */ +#line 333 "fql.y" +{ + yygotominor.yy72 = NULL; + throw FQLParserException("SELECT * is not supported. Please manually list the columns you are interested in."); + yy_destructor(yypParser,30,&yymsp[-2].minor); + yy_destructor(yypParser,13,&yymsp[-1].minor); + yy_destructor(yypParser,24,&yymsp[0].minor); +} +#line 1307 "fql.c" + break; + }; + yygoto = yyRuleInfo[yyruleno].lhs; + yysize = yyRuleInfo[yyruleno].nrhs; + yypParser->yyidx -= yysize; + yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); + if( yyact < YYNSTATE ){ +#ifdef NDEBUG + /* If we are not debugging and the reduce action popped at least + ** one element off the stack, then we can push the new element back + ** onto the stack here, and skip the stack overflow test in yy_shift(). + ** That gives a significant speed improvement. */ + if( yysize ){ + yypParser->yyidx++; + yymsp -= yysize-1; + yymsp->stateno = (YYACTIONTYPE)yyact; + yymsp->major = (YYCODETYPE)yygoto; + yymsp->minor = yygotominor; + }else +#endif + { + yy_shift(yypParser,yyact,yygoto,&yygotominor); + } + }else{ + assert( yyact == YYNSTATE + YYNRULE + 1 ); + yy_accept(yypParser); + } +} + +/* +** The following code executes when the parse fails +*/ +static void yy_parse_failed( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following code executes when a syntax error first occurs. +*/ +static void yy_syntax_error( + yyParser *yypParser, /* The parser */ + int yymajor, /* The major type of the error token */ + YYMINORTYPE yyminor /* The minor type of the error token */ +){ + ParseARG_FETCH; +#define TOKEN (yyminor.yy0) +#line 107 "fql.y" + + if (yymajor == 0) { + throw FQLParserException("unexpected end of query."); + } else { + std::stringstream ss; + std::string token_text; + token_text = FQLParserException::getTokenText(yymajor, TOKEN); + ss << "unexpected '" << token_text << + "' at position " << TOKEN.pos - token_text.length() << "."; + state->errors.push_back(FQLParserException(ss.str())); + } + +#line 1378 "fql.c" + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following is executed when the parser accepts +*/ +static void yy_accept( + yyParser *yypParser /* The parser */ +){ + ParseARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ +#line 26 "fql.y" + + +#line 1400 "fql.c" + ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "ParseAlloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
      +**
    • A pointer to the parser (an opaque structure.) +**
    • The major token number. +**
    • The minor token number. +**
    • An option argument of a grammar-specified type. +**
    +** +** Outputs: +** None. +*/ +void Parse( + void *yyp, /* The parser */ + int yymajor, /* The major token code number */ + ParseTOKENTYPE yyminor /* The value for the token */ + ParseARG_PDECL /* Optional %extra_argument parameter */ +){ + YYMINORTYPE yyminorunion; + int yyact; /* The parser action. */ + int yyendofinput; /* True if we are at the end of input */ +#ifdef YYERRORSYMBOL + int yyerrorhit = 0; /* True if yymajor has invoked an error */ +#endif + yyParser *yypParser; /* The parser */ + + /* (re)initialize the parser, if necessary */ + yypParser = (yyParser*)yyp; + if( yypParser->yyidx<0 ){ +#if YYSTACKDEPTH<=0 + if( yypParser->yystksz <=0 ){ + /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/ + yyminorunion = yyzerominor; + yyStackOverflow(yypParser, &yyminorunion); + return; + } +#endif + yypParser->yyidx = 0; + yypParser->yyerrcnt = -1; + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; + } + yyminorunion.yy0 = yyminor; + yyendofinput = (yymajor==0); + ParseARG_STORE; + +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + } +#endif + + do{ + yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); + if( yyactyyerrcnt--; + yymajor = YYNOCODE; + }else if( yyact < YYNSTATE + YYNRULE ){ + yy_reduce(yypParser,yyact-YYNSTATE); + }else{ + assert( yyact == YY_ERROR_ACTION ); +#ifdef YYERRORSYMBOL + int yymx; +#endif +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + } +#endif +#ifdef YYERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( yypParser->yyerrcnt<0 ){ + yy_syntax_error(yypParser,yymajor,yyminorunion); + } + yymx = yypParser->yystack[yypParser->yyidx].major; + if( yymx==YYERRORSYMBOL || yyerrorhit ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sDiscard input token %s\n", + yyTracePrompt,yyTokenName[yymajor]); + } +#endif + yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion); + yymajor = YYNOCODE; + }else{ + while( + yypParser->yyidx >= 0 && + yymx != YYERRORSYMBOL && + (yyact = yy_find_reduce_action( + yypParser->yystack[yypParser->yyidx].stateno, + YYERRORSYMBOL)) >= YYNSTATE + ){ + yy_pop_parser_stack(yypParser); + } + if( yypParser->yyidx < 0 || yymajor==0 ){ + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + yy_parse_failed(yypParser); + yymajor = YYNOCODE; + }else if( yymx!=YYERRORSYMBOL ){ + YYMINORTYPE u2; + u2.YYERRSYMDT = 0; + yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + } + } + yypParser->yyerrcnt = 3; + yyerrorhit = 1; +#else /* YYERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( yypParser->yyerrcnt<=0 ){ + yy_syntax_error(yypParser,yymajor,yyminorunion); + } + yypParser->yyerrcnt = 3; + yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); + if( yyendofinput ){ + yy_parse_failed(yypParser); + } + yymajor = YYNOCODE; +#endif + } + }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + return; +} diff --git a/src/cpp/ext/fql/fql.h b/src/cpp/ext/fql/fql.h new file mode 100644 index 0000000000000..b649a60b7789b --- /dev/null +++ b/src/cpp/ext/fql/fql.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +#define TOK_SEMICOLON 1 +#define TOK_SELECT 2 +#define TOK_FROM 3 +#define TOK_VIRT_TABLE 4 +#define TOK_IDENT 5 +#define TOK_WHERE 6 +#define TOK_ORDER 7 +#define TOK_BY 8 +#define TOK_DESC 9 +#define TOK_ASC 10 +#define TOK_LIMIT 11 +#define TOK_INT 12 +#define TOK_COMMA 13 +#define TOK_OFFSET 14 +#define TOK_OR 15 +#define TOK_AND 16 +#define TOK_CMP 17 +#define TOK_CONTAINS 18 +#define TOK_OPEN_PAREN 19 +#define TOK_STRING 20 +#define TOK_CLOSE_PAREN 21 +#define TOK_IN 22 +#define TOK_ADD_OP 23 +#define TOK_STAR 24 +#define TOK_SLASH 25 +#define TOK_NOT 26 diff --git a/src/cpp/ext/fql/fql_multiparse.cpp b/src/cpp/ext/fql/fql_multiparse.cpp new file mode 100644 index 0000000000000..cf0e94b7d7693 --- /dev/null +++ b/src/cpp/ext/fql/fql_multiparse.cpp @@ -0,0 +1,77 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +#include "fqlnode.h" +#include +#include +#include +#include + +using namespace std; + +vector > +fql_multiparse(const map &query_set) { + set query_keys; + set reused; + vector query_results; + map::const_iterator it = query_set.begin(); + vector > all_results; + while (it != query_set.end()) { + string key = (*it).first; + string query = (*it).second; + try { + FQLParserState state = fql_parse_query(query.c_str(), key); + reused.insert(state.dependencies.begin(), state.dependencies.end()); + query_results.push_back(state); + it++; + } catch (FQLParserException &e) { + FQLParserState::deleteStmtList(query_results); + throw; + } + } + while (!query_results.empty()) { + vector round_results; + vector::iterator results_it = query_results.begin(); + set new_query_keys; + while (results_it != query_results.end()) { + FQLParserState state = *results_it; + state.reused = (reused.find(state.name) != reused.end()); + if (includes(query_keys.begin(), + query_keys.end(), + state.dependencies.begin(), + state.dependencies.end())) { + new_query_keys.insert(state.name); + round_results.push_back(state); + results_it = query_results.erase(results_it); + } else { + results_it++; + } + } + if (round_results.empty() && !query_results.empty()) { + FQLParserState state = query_results.front(); + FQLParserState::deleteStmtList(query_results); + for (unsigned int i = 0; i < all_results.size(); i++) { + FQLParserState::deleteStmtList(all_results[i]); + } + throw FQLParserException("Unresolved dependency detected for query named: '" + +state.name + "'", + FQL_EC_UNRESOLVED_DEPENDENCY); + } + query_keys.insert(new_query_keys.begin(), new_query_keys.end()); + all_results.push_back(round_results); + } + return all_results; +} diff --git a/src/cpp/ext/fql/fql_parser.cpp b/src/cpp/ext/fql/fql_parser.cpp new file mode 100644 index 0000000000000..7869559406b36 --- /dev/null +++ b/src/cpp/ext/fql/fql_parser.cpp @@ -0,0 +1,150 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include "fqlnode.h" + +using namespace std; + +// LEXER function prototypes +typedef void *yyscan_t; +typedef struct yy_buffer_state *YY_BUFFER_STATE; +int yylex_init (yyscan_t* scanner); +int yylex_destroy (yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string (const char *yy_str ,yyscan_t yyscanner ); +int yylex(YYSTYPE *yylval, yyscan_t scanner); + +// static data for the parser +static bool g_fql_static_data_set = false; +static set fql_table_names; +static map fql_function_names; + +FQLParserState fql_parse_query(const char *query, string name = ""); + +int fql_static_data_set() { + return g_fql_static_data_set ? 1 : 0; +} + +void fql_set_static_data(set table_names, + map function_names) { + fql_table_names = table_names; + fql_function_names = function_names; + g_fql_static_data_set = true; +} + +bool fql_validate_table_name(string table_name, FQLParserState *state) { + if (!strchr(table_name.c_str(), '.')) { + set::const_iterator it = fql_table_names.find(table_name); + if (it == fql_table_names.end()) { + throw FQLParserException("Unknown table: " + table_name, + FQL_EC_UNKNOWN_TABLE); + return false; + } + } + return true; +} + +bool fql_validate_function_data(string fnName, + FQLExpressionListNode *args) { + map::const_iterator it = + fql_function_names.find(fnName); + if (it == fql_function_names.end()) { + throw FQLParserException(fnName + " is not a valid function name.", + FQL_EC_UNKNOWN_FUNCTION); + } + int num_given_params = 0; + if (args) { + num_given_params = args->length(); + } + int num_required_params = (*it).second.num_params; + if (num_required_params >= 0 && + num_required_params != num_given_params) { + stringstream msg; + msg << fnName << " function expects " << num_required_params << + " parameters; " << num_given_params << " given."; + throw FQLParserException(msg.str(), FQL_EC_INVALID_PARAM); + } + return true; +} + +void *ParseAlloc(void *(*mallocProc)(size_t)); +void Parse(void *, int, FQLToken, FQLParserState *); +void ParseFree(void *, void (*freeProc)(void*)); +void ParseTrace(FILE *, char *); + +FQLStatementNode *fql_parse(const char *query) { + FQLParserState state = fql_parse_query(query); + if (!state.dependencies.empty()) { + set::iterator it = state.dependencies.begin(); + string table = *it; + delete state.stmt; + throw FQLParserException("Unknown table: #" + table, FQL_EC_UNKNOWN_TABLE); + } + return state.stmt; +} + +FQLParserState fql_parse_query(const char *query, string name) { + FQLParserState state(name); + void *pParser = ParseAlloc(malloc); + int token_type; + FQLToken curr_token; + curr_token.token = NULL; + curr_token.pos = 0; + yyscan_t scanner; + yylex_init(&scanner); + yy_scan_string(query, scanner); + //ParseTrace(stdout, "<<"); + try { + while ((token_type = yylex(&curr_token, scanner)) != 0) { + switch (token_type) { + case TOK_UNKNOWN: { + // throw error + stringstream ss; + ss << "unexpected '" << curr_token.token << "' at position " << + curr_token.pos - strlen(curr_token.token) << "."; + free(curr_token.token); + throw FQLParserException(ss.str()); + } + case TOK_WHITESPACE: + // skip over whitespace + break; + default: + Parse(pParser, token_type, curr_token, &state); + } + if (!state.errors.empty()) { + throw (state.errors.front()); + } + } + Parse(pParser, 0, curr_token, &state); + if (!state.errors.empty()) { + throw (state.errors.front()); + } + } catch (FQLParserException e) { + if (state.stmt) { + delete state.stmt; + } + yylex_destroy(scanner); + ParseFree(pParser, free); + throw; + } + yylex_destroy(scanner); + ParseFree(pParser, free); + return state; +} + diff --git a/src/cpp/ext/fql/fqlnode.cpp b/src/cpp/ext/fql/fqlnode.cpp new file mode 100644 index 0000000000000..ee740bec5a9ad --- /dev/null +++ b/src/cpp/ext/fql/fqlnode.cpp @@ -0,0 +1,173 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include "fqlnode.h" +#include "fql.h" + +using namespace std; + +FQLStatementNode::FQLStatementNode(FQLExpressionListNode *select, + string from, + FQLExpressionNode *where, + FQLOrderByNode *orderby, + FQLLimitNode *limit, + bool native) : + select(select), + from(from), + where(where), + orderby(orderby), + limit(limit), + native(native) { } + +bool FQLConstantNode::operator==(const FQLExpressionNode &rhs) const { + if (!checkType(rhs)) { + return false; + } + const FQLConstantNode *rhsPtr = + static_cast(&rhs); + return (value == rhsPtr->value); +} + +bool FQLBinOpExpressionNode::operator==(const FQLExpressionNode &rhs) const { + if (!checkType(rhs)) { + return false; + } + const FQLBinOpExpressionNode *rhsPtr = + static_cast(&rhs); + return ((op == rhsPtr->op) && + (*left == *(rhsPtr->left)) && + (*right == *(rhsPtr->right))); +} + +bool FQLFunctionExpressionNode::operator==(const FQLExpressionNode &rhs) const { + if (!checkType(rhs)) { + return false; + } + const FQLFunctionExpressionNode *rhsPtr = + static_cast(&rhs); + return ((fnName == rhsPtr->fnName) && + ((args == NULL && rhsPtr->args == NULL) || + (*args == *(rhsPtr->args)))); +} + +bool FQLContainsExpressionNode::operator==(const FQLExpressionNode &rhs) const { + if (!checkType(rhs)) { + return false; + } + const FQLContainsExpressionNode *rhsPtr = + static_cast(&rhs); + return ((query == rhsPtr->query) && + ((searchCols == NULL && rhsPtr->searchCols == NULL) || + (*searchCols == *(rhsPtr->searchCols)))); +} + +FQLFunctionExpressionNode::FQLFunctionExpressionNode(string fn_name, + FQLExpressionListNode *args) : + fnName(fn_name), + args(args) { +} + +bool FQLExpressionListNode::operator==(const FQLExpressionListNode &rhs) const { + if (list.size() != rhs.list.size()) { + return false; + } + for (unsigned int i = 0; i < list.size(); i++) { + if (!(*(list[i]) == *(rhs.list[i]))) { + return false; + } + } + return true; +} + +bool FQLMultiOpExpressionNode::operator==(const FQLExpressionNode &rhs) const { + if (!checkType(rhs)) { + return false; + } + const FQLMultiOpExpressionNode *rhsPtr = + static_cast(&rhs); + if (operands.size() != rhsPtr->operands.size()) { + return false; + } + for (unsigned int i = 0; i < operands.size(); i++) { + if (!(*(operands[i]) == *(rhsPtr->operands[i]))) { + return false; + } + } + return true; +} + +bool FQLInArrayNode::operator==(const FQLExpressionNode &rhs) const { + if (!checkType(rhs)) { + return false; + } + const FQLInArrayNode *rhsPtr = + static_cast(&rhs); + return ((*expr == *(rhsPtr->expr)) && (*list == *(rhsPtr->list))); +} + +bool FQLFieldExpressionNode::operator==(const FQLExpressionNode &rhs) const { + if (!checkType(rhs)) { + return false; + } + const FQLFieldExpressionNode *rhsPtr = + static_cast(&rhs); + return (field == rhsPtr->field); +} + +bool FQLNotExpressionNode::operator==(const FQLExpressionNode &rhs) const { + if (!checkType(rhs)) { + return false; + } + const FQLNotExpressionNode *rhsPtr = + static_cast(&rhs); + return (*expr == *(rhsPtr->expr)); +} + +bool FQLOrderByNode::operator==(const FQLOrderByNode &rhs) const { + return (*orderby == *(rhs.orderby) && desc == rhs.desc); +} + +bool FQLLimitNode::operator==(const FQLLimitNode &rhs) const { + return (limit == rhs.limit && offset == rhs.offset); +} + +bool FQLStatementNode::operator==(const FQLStatementNode &rhs) const { + return ((*select == *(rhs.select)) && + (from == rhs.from) && + (*where == *(rhs.where)) && + ((orderby == NULL && rhs.orderby == NULL) || + (*orderby == *(rhs.orderby))) && + ((limit == NULL && rhs.limit == NULL) || + (*limit == *(rhs.limit)))); +} + +bool FQLInStatementNode::operator==(const FQLExpressionNode &rhs) const { + if (!checkType(rhs)) { + return false; + } + const FQLInStatementNode *rhsPtr = + static_cast(&rhs); + return (*expr == *(rhsPtr->expr) && *statement == *(rhsPtr->statement)); +} + +void FQLParserState::deleteStmtList(vector states) { + for (unsigned int i = 0; i < states.size(); i++) { + if (states[i].stmt) { + delete states[i].stmt; + } + } +} diff --git a/src/cpp/ext/fql/fqlnode.h b/src/cpp/ext/fql/fqlnode.h new file mode 100644 index 0000000000000..38dafa7b6c023 --- /dev/null +++ b/src/cpp/ext/fql/fqlnode.h @@ -0,0 +1,491 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +// Copyright 2004-2009 Facebook. All Rights Reserved. + +#ifndef __FQLNODE_H__ +#define __FQLNODE_H__ + +#include +#include +#include +#include +#include "fql.h" +#include +#include + +#define YYSTYPE FQLToken +#define FQL_EC_PARSER_ERROR 601 +#define FQL_EC_UNKNOWN_TABLE 603 +#define FQL_EC_UNKNOWN_FUNCTION 605 +#define FQL_EC_INVALID_PARAM 606 +#define FQL_EC_UNRESOLVED_DEPENDENCY 614 + +#define TOK_WHITESPACE 1000 +#define TOK_UNKNOWN 1001 + +#define FQL_EXPRESSION_LIST 1 +#define FQL_CONSTANT_EXPRESSION 2 +#define FQL_ARITHMETIC_EXPRESSION 3 +#define FQL_COMPARISON_EXPRESSION 4 +#define FQL_FUNCTION_EXPRESSION 5 +#define FQL_CONJUNCTION 6 +#define FQL_DISJUNCTION 7 +#define FQL_IN_ARRAY 8 +#define FQL_FIELD_EXPRESSION 9 +#define FQL_NOT_EXPRESSION 10 +#define FQL_ORDER_BY 11 +#define FQL_LIMIT 12 +#define FQL_STATEMENT 13 +#define FQL_IN_STATEMENT 14 +#define FQL_CONTAINS_EXPRESSION 15 + +struct fql_function_data { + int num_params; +}; + +int fql_static_data_set(); +void fql_set_static_data(std::set table_names, + std::map function_names); + +class FQLNode { + public: + FQLNode() {} + virtual ~FQLNode() { } + virtual unsigned int nodeType() const = 0; +}; + +class FQLExpressionNode : public FQLNode { + public: + virtual bool operator==(const FQLExpressionNode &rhs) const { + return false; + } + virtual ~FQLExpressionNode() {} + bool checkType(const FQLExpressionNode &rhs) const { + return (nodeType() == rhs.nodeType()); + } +}; + +class FQLExpressionListNode : public FQLNode { + public: + FQLExpressionListNode(FQLExpressionNode *first = NULL) { + if (first) { + list.push_back(first); + } + } + ~FQLExpressionListNode() { + for (unsigned int i = 0; i < list.size(); i++) { + if (list[i]) { + delete list[i]; + } + } + } + bool operator==(const FQLExpressionListNode &rhs) const; + unsigned int nodeType() const { return FQL_EXPRESSION_LIST; }; + + int length() const { return list.size(); } + void append(FQLExpressionNode *next) { + list.push_back(next); + } + std::vector&getList() { return list; } + + protected: + std::vector list; +}; + +class FQLConstantNode : public FQLExpressionNode { + public: + FQLConstantNode(std::string value) : + value(value) { } + bool operator==(const FQLExpressionNode &rhs) const; + unsigned int nodeType() const { return FQL_CONSTANT_EXPRESSION; }; + std::string getValue() { return value; } + private: + std::string value; +}; + +class FQLBinOpExpressionNode : public FQLExpressionNode { + public: + FQLBinOpExpressionNode(std::string op, FQLExpressionNode *left, + FQLExpressionNode *right) : + op(op), + left(left), + right(right) { } + ~FQLBinOpExpressionNode() { + delete left; + delete right; + } + bool operator==(const FQLExpressionNode &rhs) const; + std::string getOp() { return op; } + FQLExpressionNode *getLeft() { return left; } + FQLExpressionNode *getRight() { return right; } + protected: + std::string op; + FQLExpressionNode *left; + FQLExpressionNode *right; +}; + +class FQLArithmeticExpressionNode : public FQLBinOpExpressionNode { + public: + FQLArithmeticExpressionNode(std::string op, FQLExpressionNode *left, + FQLExpressionNode *right) : + FQLBinOpExpressionNode(op, left, right) { } + + unsigned int nodeType() const { return FQL_ARITHMETIC_EXPRESSION; }; +}; + +class FQLComparisonExpressionNode : public FQLBinOpExpressionNode { + public: + FQLComparisonExpressionNode(std::string op, FQLExpressionNode *left, + FQLExpressionNode *right) : + FQLBinOpExpressionNode(op, left, right) { } + + unsigned int nodeType() const { return FQL_COMPARISON_EXPRESSION; }; +}; + +class FQLFunctionExpressionNode : public FQLExpressionNode { + public: + FQLFunctionExpressionNode(std::string fn_name, + FQLExpressionListNode *args); + ~FQLFunctionExpressionNode() { + if (args) { + delete args; + } + } + bool operator==(const FQLExpressionNode &rhs) const; + unsigned int nodeType() const { return FQL_FUNCTION_EXPRESSION; }; + std::string getFnName() { return fnName; } + FQLExpressionListNode *getArgs() { return args; } + protected: + std::string fnName; + FQLExpressionListNode *args; +}; + +class FQLMultiOpExpressionNode : public FQLExpressionNode { + public: + void append(FQLExpressionNode *node) { + operands.push_back(node); + } + ~FQLMultiOpExpressionNode() { + for (unsigned int i = 0; i < operands.size(); i++) { + delete operands[i]; + } + } + bool operator==(const FQLExpressionNode &rhs) const; + std::vector& getOperands() { return operands; } + protected: + std::vector operands; +}; + +class FQLConjunctionNode : public FQLMultiOpExpressionNode { + public: + FQLConjunctionNode() {} + FQLConjunctionNode(FQLExpressionNode *left, + FQLExpressionNode *right) { + operands.push_back(left); + operands.push_back(right); + } + unsigned int nodeType() const { return FQL_CONJUNCTION; }; +}; + +class FQLDisjunctionNode : public FQLMultiOpExpressionNode { + public: + FQLDisjunctionNode() {} + FQLDisjunctionNode(FQLExpressionNode *left, + FQLExpressionNode *right) { + operands.push_back(left); + operands.push_back(right); + } + unsigned int nodeType() const { return FQL_DISJUNCTION; }; +}; + +class FQLInArrayNode : public FQLExpressionNode { + public: + FQLInArrayNode(FQLExpressionNode *expr, FQLExpressionListNode *list) : + expr(expr), + list(list) { } + ~FQLInArrayNode() { + delete expr; + delete list; + } + unsigned int nodeType() const { return FQL_IN_ARRAY; }; + bool operator==(const FQLExpressionNode &rhs) const; + FQLExpressionNode *getExpr() { return expr; } + FQLExpressionListNode *getList() { return list; } + protected: + FQLExpressionNode *expr; + FQLExpressionListNode *list; +}; + +class FQLFieldExpressionNode : public FQLExpressionNode { + public: + FQLFieldExpressionNode(std::string field) : field(field) { } + ~FQLFieldExpressionNode() { } + unsigned int nodeType() const { return FQL_FIELD_EXPRESSION; }; + bool operator==(const FQLExpressionNode &rhs) const; + std::string getField() { return field; } + + std::string field; +}; + +class FQLNotExpressionNode : public FQLExpressionNode { + public: + FQLNotExpressionNode(FQLExpressionNode *expr) : + expr(expr) { } + ~FQLNotExpressionNode() { delete expr; } + unsigned int nodeType() const { return FQL_NOT_EXPRESSION; } + bool operator==(const FQLExpressionNode &rhs) const; + FQLExpressionNode *getExpr() { return expr; } + protected: + FQLExpressionNode *expr; +}; + +class FQLContainsExpressionNode : public FQLExpressionNode { + public: + FQLContainsExpressionNode(std::string query, FQLExpressionListNode *search_cols) : + query(query), + searchCols(search_cols) { } + ~FQLContainsExpressionNode() { + if (searchCols) { + delete searchCols; + } + } + unsigned int nodeType() const { return FQL_CONTAINS_EXPRESSION; } + bool operator==(const FQLExpressionNode &rhs) const; + std::string getQuery() { return query; } + FQLExpressionListNode *getSearchCols() { return searchCols; } + + protected: + std::string query; + FQLExpressionListNode *searchCols; +}; + +class FQLOrderByNode : public FQLNode { + public: + FQLOrderByNode(FQLExpressionNode *orderby, bool desc) : + orderby(orderby), + desc(desc) { } + ~FQLOrderByNode() { delete orderby; } + + unsigned int nodeType() const { return FQL_ORDER_BY; }; + bool operator==(const FQLOrderByNode &rhs) const; + FQLExpressionNode *getOrderby() { return orderby; } + bool getDesc() { return desc; } + + protected: + FQLExpressionNode *orderby; + bool desc; +}; + +class FQLLimitNode : public FQLNode { + public: + FQLLimitNode(int limit, int offset) : + limit(limit), + offset(offset) { } + + unsigned int nodeType() const { return FQL_LIMIT; }; + bool operator==(const FQLLimitNode &rhs) const; + int getLimit() { return limit; } + int getOffset() { return offset; } + + protected: + int limit; + int offset; +}; + +class FQLStatementNode : public FQLNode { + public: + FQLStatementNode(FQLExpressionListNode *select, + std::string from, + FQLExpressionNode *where, + FQLOrderByNode *orderby = NULL, + FQLLimitNode *limit = NULL, + bool native = true); + ~FQLStatementNode() { + if (select) { + delete select; + } + if (where) { + delete where; + } + if (orderby) { + delete orderby; + } + if (limit) { + delete limit; + } + } + bool validate() const; + unsigned int nodeType() const { return FQL_STATEMENT; } + bool operator==(const FQLStatementNode &rhs) const; + + void setSelect(FQLExpressionListNode *select) { + if (this->select) { + delete this->select; + } + this->select = select; + } + void setFrom(std::string from) { + this->from = from; + } + void setWhere(FQLExpressionNode *where) { + if (this->where) { + delete this->where; + } + this->where = where; + } + void setOrderBy(FQLOrderByNode *orderby) { + if (this->orderby) { + delete this->orderby; + } + this->orderby = orderby; + } + void setLimit(FQLLimitNode *limit) { + if (this->limit) { + delete this->limit; + } + this->limit = limit; + } + FQLExpressionListNode *getSelect() { return select; } + std::string getFrom() { return from; } + FQLExpressionNode *getWhere() { return where; } + FQLOrderByNode *getOrderBy() { return orderby; } + FQLLimitNode *getLimit() { return limit; } + bool isNative() { return native; } + private: + FQLExpressionListNode *select; + std::string from; + FQLExpressionNode *where; + FQLOrderByNode *orderby; + FQLLimitNode *limit; + bool native; +}; + +class FQLInStatementNode : public FQLExpressionNode { + public: + FQLInStatementNode(FQLExpressionNode *expr, FQLStatementNode *statement) : + expr(expr), + statement(statement) { } + ~FQLInStatementNode() { + if (expr) { + delete expr; + } + if (statement) { + delete statement; + } + } + unsigned int nodeType() const { return FQL_IN_STATEMENT; }; + bool operator==(const FQLExpressionNode &rhs) const; + FQLExpressionNode *getExpr() { return expr; } + FQLStatementNode *getStatement() { return statement; } + protected: + FQLExpressionNode *expr; + FQLStatementNode *statement; +}; + +typedef struct { + char *token; + unsigned int pos; +} FQLToken; + +class FQLParserException : public std::exception { + public: + FQLParserException(std::string msg, int code=FQL_EC_PARSER_ERROR) : + error(msg), + errorCode(code) { } + ~FQLParserException() throw() { } + virtual const char *what() const throw() { + return error.c_str(); + } + + int getErrorCode() { + return errorCode; + } + + static std::string getTokenText(int tokenType, FQLToken token) { + switch (tokenType) { + case TOK_SEMICOLON: + return ";"; + case TOK_SELECT: + return "SELECT"; + case TOK_CONTAINS: + return "CONTAINS"; + case TOK_FROM: + return "FROM"; + case TOK_WHERE: + return "WHERE"; + case TOK_ORDER: + return "ORDER"; + case TOK_BY: + return "BY"; + case TOK_DESC: + return "ASC"; + case TOK_LIMIT: + return "LIMIT"; + case TOK_COMMA: + return ","; + case TOK_OFFSET: + return "OFFSET"; + case TOK_OR: + return "OR"; + case TOK_AND: + return "AND"; + case TOK_IN: + return "IN"; + case TOK_OPEN_PAREN: + return "("; + case TOK_CLOSE_PAREN: + return ")"; + case TOK_STAR: + return "*"; + case TOK_SLASH: + return "/"; + case TOK_NOT: + return "NOT"; + default: + return token.token; + } + } + + private: + std::string error; + int errorCode; +}; + +class FQLParserState { + public: + FQLParserState(std::string name) { + stmt = NULL; + this->name = name; + reused = false; + } + static void deleteStmtList(std::vector states); + std::set dependencies; + + bool reused; + std::string name; + FQLStatementNode *stmt; + std::vector errors; +}; + +std::vector > +fql_multiparse(const std::map &query_set); +FQLStatementNode *fql_parse(const char *query); +FQLParserState fql_parse_query(const char *query, std::string name); +bool fql_validate_table_name(std::string table_name, FQLParserState *state); +bool fql_validate_function_data(std::string fnName, FQLExpressionListNode *args); + +#endif diff --git a/src/cpp/ext/fql/lexer.cpp b/src/cpp/ext/fql/lexer.cpp new file mode 100644 index 0000000000000..bb78af203cbf4 --- /dev/null +++ b/src/cpp/ext/fql/lexer.cpp @@ -0,0 +1,2212 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +#line 2 "lex.yy.cpp" + +#line 4 "lex.yy.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void yyrestart (FILE *input_file ,yyscan_t yyscanner ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void yypop_buffer_state (yyscan_t yyscanner ); + +static void yyensure_buffer_stack (yyscan_t yyscanner ); +static void yy_load_buffer_state (yyscan_t yyscanner ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); + +void *yyalloc (yy_size_t ,yyscan_t yyscanner ); +void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); +void yyfree (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap(n) 1 +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 30 +#define YY_END_OF_BUFFER 31 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[96] = + { 0, + 0, 0, 31, 29, 1, 1, 4, 29, 29, 29, + 8, 9, 6, 5, 10, 7, 28, 11, 4, 4, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 29, 1, 4, 0, 2, 0, 26, 0, + 3, 0, 28, 0, 27, 27, 27, 19, 27, 27, + 27, 25, 27, 27, 27, 24, 27, 27, 0, 26, + 27, 23, 21, 27, 27, 27, 27, 22, 27, 27, + 27, 27, 26, 27, 27, 20, 14, 27, 27, 27, + 27, 27, 26, 27, 16, 27, 18, 27, 15, 27, + 17, 13, 27, 12, 0 + + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 4, 5, 6, 1, 1, 1, 7, 8, + 9, 10, 11, 12, 11, 13, 14, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 1, 16, 17, + 18, 19, 1, 1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 26, 26, 29, 30, 31, 32, 26, + 26, 33, 34, 35, 26, 26, 36, 26, 37, 26, + 1, 38, 1, 39, 26, 1, 40, 41, 42, 43, + + 44, 45, 26, 46, 47, 26, 26, 48, 49, 50, + 51, 26, 26, 52, 53, 54, 26, 26, 55, 26, + 56, 26, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[57] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 1, 2, 1, 1, 1, 1, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 1, 1, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3 + } ; + +static yyconst flex_int16_t yy_base[105] = + { 0, + 0, 0, 231, 249, 55, 57, 43, 57, 0, 56, + 249, 249, 249, 249, 249, 249, 215, 249, 46, 211, + 53, 54, 56, 55, 215, 57, 58, 64, 61, 72, + 89, 73, 208, 70, 249, 76, 249, 222, 211, 89, + 249, 220, 207, 0, 208, 102, 107, 206, 85, 70, + 105, 205, 108, 109, 115, 118, 117, 123, 0, 203, + 199, 198, 196, 119, 126, 113, 138, 193, 121, 140, + 145, 139, 192, 191, 157, 190, 186, 146, 158, 162, + 165, 166, 183, 170, 179, 173, 175, 180, 137, 163, + 129, 88, 167, 67, 249, 234, 75, 237, 239, 241, + + 73, 72, 243, 245 + } ; + +static yyconst flex_int16_t yy_def[105] = + { 0, + 95, 1, 95, 95, 95, 95, 95, 96, 97, 98, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 95, 95, 95, 96, 95, 96, 100, 98, + 95, 98, 95, 101, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 102, 100, + 103, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 104, 103, 99, 99, 99, 99, 99, 99, + 99, 99, 104, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 0, 95, 95, 95, 95, 95, + + 95, 95, 95, 95 + } ; + +static yyconst flex_int16_t yy_nxt[306] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 4, 16, 17, 18, 19, 20, 20, 21, + 22, 23, 24, 25, 26, 25, 25, 27, 28, 25, + 29, 30, 25, 31, 25, 32, 25, 4, 33, 21, + 22, 23, 24, 25, 26, 25, 27, 28, 25, 29, + 30, 25, 31, 25, 32, 25, 34, 34, 34, 34, + 35, 37, 41, 35, 35, 44, 44, 44, 44, 44, + 44, 34, 34, 44, 73, 61, 44, 39, 50, 44, + 37, 35, 44, 46, 44, 44, 47, 49, 52, 51, + 48, 53, 54, 42, 38, 41, 55, 44, 50, 58, + + 44, 44, 46, 65, 56, 47, 49, 52, 51, 48, + 53, 54, 57, 38, 44, 64, 55, 44, 58, 44, + 44, 44, 65, 56, 62, 44, 42, 44, 63, 44, + 44, 44, 57, 44, 64, 44, 66, 67, 44, 69, + 70, 44, 77, 68, 62, 71, 72, 76, 63, 44, + 44, 44, 44, 75, 79, 66, 67, 44, 44, 69, + 70, 77, 68, 80, 71, 78, 72, 76, 81, 44, + 44, 82, 75, 79, 44, 44, 84, 44, 44, 44, + 85, 86, 44, 80, 78, 44, 88, 44, 81, 89, + 82, 44, 44, 93, 87, 59, 84, 90, 44, 85, + + 94, 86, 44, 44, 59, 44, 88, 91, 44, 89, + 44, 44, 93, 87, 92, 59, 90, 44, 44, 94, + 44, 43, 95, 59, 95, 35, 91, 44, 35, 43, + 95, 95, 95, 92, 36, 36, 36, 40, 40, 40, + 45, 45, 60, 60, 74, 74, 83, 83, 3, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + + 95, 95, 95, 95, 95 + } ; + +static yyconst flex_int16_t yy_chk[306] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 5, 5, 6, 6, + 7, 8, 10, 19, 19, 21, 22, 24, 23, 26, + 27, 34, 34, 29, 102, 101, 28, 97, 24, 94, + 36, 7, 50, 21, 30, 32, 21, 23, 27, 26, + 22, 28, 29, 10, 8, 40, 30, 49, 24, 32, + + 92, 31, 21, 50, 30, 21, 23, 27, 26, 22, + 28, 29, 31, 36, 46, 49, 30, 51, 32, 47, + 53, 54, 50, 30, 46, 66, 40, 55, 47, 57, + 56, 64, 31, 69, 49, 58, 51, 53, 65, 55, + 56, 91, 66, 54, 46, 57, 58, 65, 47, 89, + 67, 72, 70, 64, 69, 51, 53, 71, 78, 55, + 56, 66, 54, 70, 57, 67, 58, 65, 71, 75, + 79, 72, 64, 69, 80, 90, 75, 81, 82, 93, + 78, 79, 84, 70, 67, 86, 81, 87, 71, 82, + 72, 85, 88, 90, 80, 83, 75, 84, 77, 78, + + 93, 79, 76, 74, 73, 68, 81, 86, 63, 82, + 62, 61, 90, 80, 88, 60, 84, 52, 48, 93, + 45, 43, 42, 39, 38, 33, 86, 25, 20, 17, + 3, 0, 0, 88, 96, 96, 96, 98, 98, 98, + 99, 99, 100, 100, 103, 103, 104, 104, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, + + 95, 95, 95, 95, 95 + } ; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "lexer.l" +#line 6 "lexer.l" + +#include "fqlnode.h" +#include "fql.h" +#include +#include +#include + +using namespace std; + +#define YY_USER_ACTION yylval->token = NULL; yylval->pos += yyleng; +#line 546 "lex.yy.cpp" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* Holds the entire state of the reentrant scanner. */ +struct yyguts_t + { + + /* User-defined. Not touched by flex. */ + YY_EXTRA_TYPE yyextra_r; + + /* The rest are the same as the globals declared in the non-reentrant scanner. */ + FILE *yyin_r, *yyout_r; + size_t yy_buffer_stack_top; /**< index of top of stack. */ + size_t yy_buffer_stack_max; /**< capacity of stack. */ + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ + char yy_hold_char; + int yy_n_chars; + int yyleng_r; + char *yy_c_buf_p; + int yy_init; + int yy_start; + int yy_did_buffer_switch_on_eof; + int yy_start_stack_ptr; + int yy_start_stack_depth; + int *yy_start_stack; + yy_state_type yy_last_accepting_state; + char* yy_last_accepting_cpos; + + int yylineno_r; + int yy_flex_debug_r; + + char *yytext_r; + int yy_more_flag; + int yy_more_len; + + YYSTYPE * yylval_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + +int yylex_init (yyscan_t* scanner); + +int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (yyscan_t yyscanner ); + +int yyget_debug (yyscan_t yyscanner ); + +void yyset_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *yyget_in (yyscan_t yyscanner ); + +void yyset_in (FILE * in_str ,yyscan_t yyscanner ); + +FILE *yyget_out (yyscan_t yyscanner ); + +void yyset_out (FILE * out_str ,yyscan_t yyscanner ); + +int yyget_leng (yyscan_t yyscanner ); + +char *yyget_text (yyscan_t yyscanner ); + +int yyget_lineno (yyscan_t yyscanner ); + +void yyset_lineno (int line_number ,yyscan_t yyscanner ); + +YYSTYPE * yyget_lval (yyscan_t yyscanner ); + +void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (yyscan_t yyscanner ); +#else +extern int yywrap (yyscan_t yyscanner ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + unsigned n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex \ + (YYSTYPE * yylval_param ,yyscan_t yyscanner); + +#define YY_DECL int yylex \ + (YYSTYPE * yylval_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + +#line 18 "lexer.l" + +#line 781 "lex.yy.cpp" + + yylval = yylval_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_load_buffer_state(yyscanner ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 96 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 249 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + +case 1: +/* rule 1 can match eol */ +YY_RULE_SETUP +#line 19 "lexer.l" +{ return TOK_WHITESPACE; } + YY_BREAK +case 2: +/* rule 2 can match eol */ +YY_RULE_SETUP +#line 20 "lexer.l" +{ yylval->token = strdup(yytext); return TOK_STRING; } + YY_BREAK +case 3: +/* rule 3 can match eol */ +YY_RULE_SETUP +#line 21 "lexer.l" +{ yylval->token = strdup(yytext); return TOK_STRING; } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 22 "lexer.l" +{ yylval->token = strdup(yytext); return TOK_CMP; } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 23 "lexer.l" +{ yylval->token = strdup(yytext); return TOK_ADD_OP; } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 24 "lexer.l" +{ return TOK_STAR; } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 25 "lexer.l" +{ return TOK_SLASH; } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 26 "lexer.l" +{ return TOK_OPEN_PAREN; } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 27 "lexer.l" +{ return TOK_CLOSE_PAREN; } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 28 "lexer.l" +{ return TOK_COMMA; } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 29 "lexer.l" +{ return TOK_SEMICOLON; } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 30 "lexer.l" +{ return TOK_CONTAINS; } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 31 "lexer.l" +{ return TOK_SELECT; } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 32 "lexer.l" +{ return TOK_FROM; } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 33 "lexer.l" +{ return TOK_WHERE; } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 34 "lexer.l" +{ return TOK_LIMIT; } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 35 "lexer.l" +{ return TOK_OFFSET; } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 36 "lexer.l" +{ return TOK_ORDER; } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 37 "lexer.l" +{ return TOK_BY; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 38 "lexer.l" +{ return TOK_DESC; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 39 "lexer.l" +{ return TOK_ASC; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 40 "lexer.l" +{ return TOK_NOT; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 41 "lexer.l" +{ return TOK_AND; } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 42 "lexer.l" +{ return TOK_OR; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 43 "lexer.l" +{ return TOK_IN; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 44 "lexer.l" +{ yylval->token = strdup(yytext); return TOK_VIRT_TABLE; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 45 "lexer.l" +{ yylval->token = strdup(yytext); return TOK_IDENT; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 46 "lexer.l" +{ yylval->token = strdup(yytext); return TOK_INT; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 47 "lexer.l" +{ yylval->token = strdup(yytext); return TOK_UNKNOWN; } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 48 "lexer.l" +ECHO; + YY_BREAK +#line 1019 "lex.yy.cpp" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yyg->yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_END_OF_FILE: + { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( yywrap(yyscanner ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + + yy_current_state = yy_get_previous_state( yyscanner ); + + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + yyg->yy_n_chars, (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 96 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + register int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + register char *yy_cp = yyg->yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yyg->yy_last_accepting_state = yy_current_state; + yyg->yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 96 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 95); + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) +{ + register char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_cp = yyg->yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yyg->yy_hold_char; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yyg->yy_n_chars + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + yyg->yytext_ptr = yy_bp; + yyg->yy_hold_char = *yy_cp; + yyg->yy_c_buf_p = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + *yyg->yy_c_buf_p = yyg->yy_hold_char; + + if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + ++yyg->yy_c_buf_p; + + switch ( yy_get_next_buffer( yyscanner ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = yyg->yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ + *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ + yyg->yy_hold_char = *++yyg->yy_c_buf_p; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + yy_load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void yy_load_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * @param yyscanner The scanner object. + */ + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ,yyscanner ); + + yyfree((void *) b ,yyscanner ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(yyscanner); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *yyg->yy_c_buf_p = yyg->yy_hold_char; + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void yypop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (yyscan_t yyscanner) +{ + int num_to_alloc; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (!yyg->yy_buffer_stack) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + yyg->yy_buffer_stack_max = num_to_alloc; + yyg->yy_buffer_stack_top = 0; + return; + } + + if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc + (yyg->yy_buffer_stack, + num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int yyget_lineno (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yylineno; +} + +/** Get the current column number. + * @param yyscanner The scanner object. + */ +int yyget_column (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if (! YY_CURRENT_BUFFER) + return 0; + + return yycolumn; +} + +/** Get the input stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_in (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyin; +} + +/** Get the output stream. + * @param yyscanner The scanner object. + */ +FILE *yyget_out (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyout; +} + +/** Get the length of the current token. + * @param yyscanner The scanner object. + */ +int yyget_leng (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyleng; +} + +/** Get the current token. + * @param yyscanner The scanner object. + */ + +char *yyget_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_lineno (int line_number , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* lineno is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner); + + yylineno = line_number; +} + +/** Set the current column. + * @param line_number + * @param yyscanner The scanner object. + */ +void yyset_column (int column_no , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* column is only valid if an input buffer exists. */ + if (! YY_CURRENT_BUFFER ) + yy_fatal_error( "yyset_column called with no buffer" , yyscanner); + + yycolumn = column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * @param yyscanner The scanner object. + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = in_str ; +} + +void yyset_out (FILE * out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = out_str ; +} + +int yyget_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void yyset_debug (int bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * yyget_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +/* User-visible API */ + +/* yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int yylex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* yylex_init_extra has the same functionality as yylex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to yyalloc in + * the yyextra field. + */ + +int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + yyset_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + /* By setting to 0xAA, we expose bugs in + yy_init_globals. Leave at 0x00 for releases. */ + memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); + + yyset_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +static int yy_init_globals (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack_top = 0; + yyg->yy_buffer_stack_max = 0; + yyg->yy_c_buf_p = (char *) 0; + yyg->yy_init = 0; + yyg->yy_start = 0; + + yyg->yy_start_stack_ptr = 0; + yyg->yy_start_stack_depth = 0; + yyg->yy_start_stack = NULL; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + yyfree(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + yyfree(yyg->yy_start_stack ,yyscanner ); + yyg->yy_start_stack = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + yyfree ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size , yyscan_t yyscanner) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr , yyscan_t yyscanner) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 48 "lexer.l" + + + +void yyerror(char *s) { +printf("error: %s\n", s); +} + +void suppress_defined_but_not_used_warnings_fql() { +yyunput(0, 0, 0); +} + diff --git a/src/cpp/ext/hash/hash_adler32.cpp b/src/cpp/ext/hash/hash_adler32.cpp new file mode 100644 index 0000000000000..9b04c2caa3dc5 --- /dev/null +++ b/src/cpp/ext/hash/hash_adler32.cpp @@ -0,0 +1,58 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state; +} PHP_ADLER32_CTX; + +hash_adler32::hash_adler32() : HashEngine(4, 4, sizeof(PHP_ADLER32_CTX)) { +} + +void hash_adler32::hash_init(void *context) { + unsigned int &state = ((PHP_ADLER32_CTX *)context)->state; + state = 1; +} + +void hash_adler32::hash_update(void *context, const unsigned char *buf, + unsigned int count) { + unsigned int &state = ((PHP_ADLER32_CTX *)context)->state; + unsigned int s[2]; + s[0] = state & 0xffff; + s[1] = (state >> 16) & 0xffff; + for (unsigned int i = 0; i < count; ++i) { + s[0] = (s[0] + buf[i]) % 65521; + s[1] = (s[1] + s[0]) % 65521; + } + state = s[0] + (s[1] << 16); +} + +void hash_adler32::hash_final(unsigned char *digest, void *context) { + unsigned int &state = ((PHP_ADLER32_CTX *)context)->state; + digest[3] = (unsigned char)((state >> 24) & 0xff); + digest[2] = (unsigned char)((state >> 16) & 0xff); + digest[1] = (unsigned char)((state >> 8) & 0xff); + digest[0] = (unsigned char)(state & 0xff); + state = 0; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_adler32.h b/src/cpp/ext/hash/hash_adler32.h new file mode 100644 index 0000000000000..654221096e7cb --- /dev/null +++ b/src/cpp/ext/hash/hash_adler32.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_ADLER32_H__ +#define __EXT_HASH_ADLER32_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_adler32 : public HashEngine { +public: + hash_adler32(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_ADLER32_H__ diff --git a/src/cpp/ext/hash/hash_crc32.cpp b/src/cpp/ext/hash/hash_crc32.cpp new file mode 100644 index 0000000000000..e87482c853bc6 --- /dev/null +++ b/src/cpp/ext/hash/hash_crc32.cpp @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state; +} PHP_CRC32_CTX; + +hash_crc32::hash_crc32(bool b) + : HashEngine(4, 4, sizeof(PHP_CRC32_CTX)), m_b(b) { +} + +void hash_crc32::hash_init(void *context_) { + PHP_CRC32_CTX *context = (PHP_CRC32_CTX*)context_; + context->state = ~0; +} + +void hash_crc32::hash_update(void *context_, const unsigned char *input, + unsigned int len) { + PHP_CRC32_CTX *context = (PHP_CRC32_CTX*)context_; + size_t i; + if (m_b) { + for (i = 0; i < len; ++i) { + context->state = (context->state >> 8) ^ + crc32b_table[(context->state ^ input[i]) & 0xff]; + } + } else { + for (i = 0; i < len; ++i) { + context->state = (context->state << 8) ^ + crc32_table[(context->state >> 24) ^ (input[i] & 0xff)]; + } + } +} + +void hash_crc32::hash_final(unsigned char *digest, void *context_) { + PHP_CRC32_CTX *context = (PHP_CRC32_CTX*)context_; + context->state=~context->state; + digest[3] = (unsigned char) ((context->state >> 24) & 0xff); + digest[2] = (unsigned char) ((context->state >> 16) & 0xff); + digest[1] = (unsigned char) ((context->state >> 8) & 0xff); + digest[0] = (unsigned char) (context->state & 0xff); + context->state = 0; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_crc32.h b/src/cpp/ext/hash/hash_crc32.h new file mode 100644 index 0000000000000..5759d0607c79b --- /dev/null +++ b/src/cpp/ext/hash/hash_crc32.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_CRC32_H__ +#define __EXT_HASH_CRC32_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_crc32 : public HashEngine { +public: + hash_crc32(bool b); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); + +private: + bool m_b; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_CRC32_H__ diff --git a/src/cpp/ext/hash/hash_engine.h b/src/cpp/ext/hash/hash_engine.h new file mode 100644 index 0000000000000..6512708719b91 --- /dev/null +++ b/src/cpp/ext/hash/hash_engine.h @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_ENGINE_H__ +#define __EXT_HASH_ENGINE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#define L64(x) x + +DECLARE_BOOST_TYPES(HashEngine); +class HashEngine { +public: + HashEngine(int digest_size_, int block_size_, int context_size_) + : digest_size(digest_size_), block_size(block_size_), + context_size(context_size_) {} + virtual ~HashEngine() {} + + virtual void hash_init(void *context) = 0; + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count) = 0; + virtual void hash_final(unsigned char *digest, void *context) = 0; + + int digest_size; + int block_size; + int context_size; +}; + +typedef std::map HashEngineMap; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_ENGINE_H__ diff --git a/src/cpp/ext/hash/hash_gost.cpp b/src/cpp/ext/hash/hash_gost.cpp new file mode 100644 index 0000000000000..29617d6211036 --- /dev/null +++ b/src/cpp/ext/hash/hash_gost.cpp @@ -0,0 +1,317 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state[16]; + unsigned int count[2]; + unsigned char length; + unsigned char buffer[32]; +} PHP_GOST_CTX; + +hash_gost::hash_gost() + : HashEngine(32, 32, sizeof(PHP_GOST_CTX)) { +} + +/* + * derived from gost_compress() by Markku-Juhani Saarinen + */ + +#define round(k1, k2) \ + t = (k1) + r; \ + l ^= tables[0][t & 0xff] ^ tables[1][(t >> 8) & 0xff] ^ \ + tables[2][(t >> 16) & 0xff] ^ tables[3][t >> 24]; \ + t = (k2) + l; \ + r ^= tables[0][t & 0xff] ^ tables[1][(t >> 8) & 0xff] ^ \ + tables[2][(t >> 16) & 0xff] ^ tables[3][t >> 24]; + +#define R(key, h, i, t, l, r) \ + r = h[i]; \ + l = h[i + 1]; \ + round(key[0], key[1]); \ + round(key[2], key[3]); \ + round(key[4], key[5]); \ + round(key[6], key[7]); \ + round(key[0], key[1]); \ + round(key[2], key[3]); \ + round(key[4], key[5]); \ + round(key[6], key[7]); \ + round(key[0], key[1]); \ + round(key[2], key[3]); \ + round(key[4], key[5]); \ + round(key[6], key[7]); \ + round(key[7], key[6]); \ + round(key[5], key[4]); \ + round(key[3], key[2]); \ + round(key[1], key[0]); \ + t = r; \ + r = l; \ + l = t; \ + +#define X(w, u, v) \ + w[0] = u[0] ^ v[0]; \ + w[1] = u[1] ^ v[1]; \ + w[2] = u[2] ^ v[2]; \ + w[3] = u[3] ^ v[3]; \ + w[4] = u[4] ^ v[4]; \ + w[5] = u[5] ^ v[5]; \ + w[6] = u[6] ^ v[6]; \ + w[7] = u[7] ^ v[7]; + +#define P(key, w) \ + key[0] = (w[0] & 0x000000ff) | ((w[2] & 0x000000ff) << 8) | \ + ((w[4] & 0x000000ff) << 16) | ((w[6] & 0x000000ff) << 24); \ + key[1] = ((w[0] & 0x0000ff00) >> 8) | (w[2] & 0x0000ff00) | \ + ((w[4] & 0x0000ff00) << 8) | ((w[6] & 0x0000ff00) << 16); \ + key[2] = ((w[0] & 0x00ff0000) >> 16) | ((w[2] & 0x00ff0000) >> 8) | \ + (w[4] & 0x00ff0000) | ((w[6] & 0x00ff0000) << 8); \ + key[3] = ((w[0] & 0xff000000) >> 24) | ((w[2] & 0xff000000) >> 16) | \ + ((w[4] & 0xff000000) >> 8) | (w[6] & 0xff000000); \ + key[4] = (w[1] & 0x000000ff) | ((w[3] & 0x000000ff) << 8) | \ + ((w[5] & 0x000000ff) << 16) | ((w[7] & 0x000000ff) << 24); \ + key[5] = ((w[1] & 0x0000ff00) >> 8) | (w[3] & 0x0000ff00) | \ + ((w[5] & 0x0000ff00) << 8) | ((w[7] & 0x0000ff00) << 16); \ + key[6] = ((w[1] & 0x00ff0000) >> 16) | ((w[3] & 0x00ff0000) >> 8) | \ + (w[5] & 0x00ff0000) | ((w[7] & 0x00ff0000) << 8); \ + key[7] = ((w[1] & 0xff000000) >> 24) | ((w[3] & 0xff000000) >> 16) | \ + ((w[5] & 0xff000000) >> 8) | (w[7] & 0xff000000); + +#define A(x, l, r) \ + l = x[0] ^ x[2]; \ + r = x[1] ^ x[3]; \ + x[0] = x[2]; \ + x[1] = x[3]; \ + x[2] = x[4]; \ + x[3] = x[5]; \ + x[4] = x[6]; \ + x[5] = x[7]; \ + x[6] = l; \ + x[7] = r; + +#define AA(x, l, r) \ + l = x[0]; \ + r = x[2]; \ + x[0] = x[4]; \ + x[2] = x[6]; \ + x[4] = l ^ r; \ + x[6] = x[0] ^ r; \ + l = x[1]; \ + r = x[3]; \ + x[1] = x[5]; \ + x[3] = x[7]; \ + x[5] = l ^ r; \ + x[7] = x[1] ^ r; + +#define C(x) \ + x[0] ^= 0xff00ff00; \ + x[1] ^= 0xff00ff00; \ + x[2] ^= 0x00ff00ff; \ + x[3] ^= 0x00ff00ff; \ + x[4] ^= 0x00ffff00; \ + x[5] ^= 0xff0000ff; \ + x[6] ^= 0x000000ff; \ + x[7] ^= 0xff00ffff; + +#define S(s, l, r) \ + s[i] = r; \ + s[i + 1] = l; + +#define SHIFT12(u, m, s) \ + u[0] = m[0] ^ s[6]; \ + u[1] = m[1] ^ s[7]; \ + u[2] = m[2] ^ (s[0] << 16) ^ (s[0] >> 16) ^ (s[0] & 0xffff) ^ \ + (s[1] & 0xffff) ^ (s[1] >> 16) ^ (s[2] << 16) ^ s[6] ^ (s[6] << 16) ^ \ + (s[7] & 0xffff0000) ^ (s[7] >> 16); \ + u[3] = m[3] ^ (s[0] & 0xffff) ^ (s[0] << 16) ^ (s[1] & 0xffff) ^ \ + (s[1] << 16) ^ (s[1] >> 16) ^ (s[2] << 16) ^ (s[2] >> 16) ^ \ + (s[3] << 16) ^ s[6] ^ (s[6] << 16) ^ (s[6] >> 16) ^ (s[7] & 0xffff) ^ \ + (s[7] << 16) ^ (s[7] >> 16); \ + u[4] = m[4] ^ \ + (s[0] & 0xffff0000) ^ (s[0] << 16) ^ (s[0] >> 16) ^ \ + (s[1] & 0xffff0000) ^ (s[1] >> 16) ^ (s[2] << 16) ^ (s[2] >> 16) ^ \ + (s[3] << 16) ^ (s[3] >> 16) ^ (s[4] << 16) ^ (s[6] << 16) ^ \ + (s[6] >> 16) ^(s[7] & 0xffff) ^ (s[7] << 16) ^ (s[7] >> 16); \ + u[5] = m[5] ^ (s[0] << 16) ^ (s[0] >> 16) ^ (s[0] & 0xffff0000) ^ \ + (s[1] & 0xffff) ^ s[2] ^ (s[2] >> 16) ^ (s[3] << 16) ^ (s[3] >> 16) ^ \ + (s[4] << 16) ^ (s[4] >> 16) ^ (s[5] << 16) ^ (s[6] << 16) ^ \ + (s[6] >> 16) ^ (s[7] & 0xffff0000) ^ (s[7] << 16) ^ (s[7] >> 16); \ + u[6] = m[6] ^ s[0] ^ (s[1] >> 16) ^ (s[2] << 16) ^ s[3] ^ (s[3] >> 16) ^ \ + (s[4] << 16) ^ (s[4] >> 16) ^ (s[5] << 16) ^ (s[5] >> 16) ^ s[6] ^ \ + (s[6] << 16) ^ (s[6] >> 16) ^ (s[7] << 16); \ + u[7] = m[7] ^ (s[0] & 0xffff0000) ^ (s[0] << 16) ^ (s[1] & 0xffff) ^ \ + (s[1] << 16) ^ (s[2] >> 16) ^ (s[3] << 16) ^ s[4] ^ (s[4] >> 16) ^ \ + (s[5] << 16) ^ (s[5] >> 16) ^ (s[6] >> 16) ^ (s[7] & 0xffff) ^ \ + (s[7] << 16) ^ (s[7] >> 16); + +#define SHIFT16(h, v, u) \ + v[0] = h[0] ^ (u[1] << 16) ^ (u[0] >> 16); \ + v[1] = h[1] ^ (u[2] << 16) ^ (u[1] >> 16); \ + v[2] = h[2] ^ (u[3] << 16) ^ (u[2] >> 16); \ + v[3] = h[3] ^ (u[4] << 16) ^ (u[3] >> 16); \ + v[4] = h[4] ^ (u[5] << 16) ^ (u[4] >> 16); \ + v[5] = h[5] ^ (u[6] << 16) ^ (u[5] >> 16); \ + v[6] = h[6] ^ (u[7] << 16) ^ (u[6] >> 16); \ + v[7] = h[7] ^ (u[0] & 0xffff0000) ^ (u[0] << 16) ^ (u[7] >> 16) ^ \ + (u[1] & 0xffff0000) ^ (u[1] << 16) ^ (u[6] << 16) ^ (u[7] & 0xffff0000); + +#define SHIFT61(h, v) \ +h[0] = (v[0] & 0xffff0000) ^ (v[0] << 16) ^ (v[0] >> 16) ^ (v[1] >> 16) ^ \ + (v[1] & 0xffff0000) ^ (v[2] << 16) ^ (v[3] >> 16) ^ (v[4] << 16) ^ \ + (v[5] >> 16) ^ v[5] ^ (v[6] >> 16) ^ (v[7] << 16) ^ (v[7] >> 16) ^ \ + (v[7] & 0xffff); \ +h[1] = (v[0] << 16) ^ (v[0] >> 16) ^ (v[0] & 0xffff0000) ^ (v[1] & 0xffff) ^ \ +v[2] ^ (v[2] >> 16) ^ (v[3] << 16) ^ (v[4] >> 16) ^ (v[5] << 16) ^ \ + (v[6] << 16) ^ v[6] ^ (v[7] & 0xffff0000) ^ (v[7] >> 16); \ +h[2] = (v[0] & 0xffff) ^ (v[0] << 16) ^ (v[1] << 16) ^ (v[1] >> 16) ^ \ + (v[1] & 0xffff0000) ^ (v[2] << 16) ^ (v[3] >> 16) ^ v[3] ^ (v[4] << 16) ^ \ + (v[5] >> 16) ^ v[6] ^ (v[6] >> 16) ^ (v[7] & 0xffff) ^ (v[7] << 16) ^ \ + (v[7] >> 16); \ +h[3] = (v[0] << 16) ^ (v[0] >> 16) ^ (v[0] & 0xffff0000) ^ \ + (v[1] & 0xffff0000) ^ (v[1] >> 16) ^ (v[2] << 16) ^ (v[2] >> 16) ^ v[2] ^ \ + (v[3] << 16) ^ (v[4] >> 16) ^ v[4] ^ (v[5] << 16) ^ (v[6] << 16) ^ \ + (v[7] & 0xffff) ^ (v[7] >> 16); \ +h[4] = (v[0] >> 16) ^ (v[1] << 16) ^ v[1] ^ (v[2] >> 16) ^ v[2] ^ \ + (v[3] << 16) ^ (v[3] >> 16) ^ v[3] ^ (v[4] << 16) ^ (v[5] >> 16) ^ \ +v[5] ^ (v[6] << 16) ^ (v[6] >> 16) ^ (v[7] << 16); \ +h[5] = (v[0] << 16) ^ (v[0] & 0xffff0000) ^ (v[1] << 16) ^ (v[1] >> 16) ^ \ + (v[1] & 0xffff0000) ^ (v[2] << 16) ^ v[2] ^ (v[3] >> 16) ^ v[3] ^ \ + (v[4] << 16) ^ (v[4] >> 16) ^ v[4] ^ (v[5] << 16) ^ (v[6] << 16) ^ \ + (v[6] >> 16) ^ v[6] ^ (v[7] << 16) ^ (v[7] >> 16) ^ (v[7] & 0xffff0000); \ +h[6] = v[0] ^ v[2] ^ (v[2] >> 16) ^ v[3] ^ (v[3] << 16) ^ v[4] ^ \ + (v[4] >> 16) ^ (v[5] << 16) ^ (v[5] >> 16) ^ v[5] ^ (v[6] << 16) ^ \ + (v[6] >> 16) ^ v[6] ^ (v[7] << 16) ^ v[7]; \ +h[7] = v[0] ^ (v[0] >> 16) ^ (v[1] << 16) ^ (v[1] >> 16) ^ (v[2] << 16) ^ \ + (v[3] >> 16) ^ v[3] ^ (v[4] << 16) ^ v[4] ^ (v[5] >> 16) ^ v[5] ^ \ + (v[6] << 16) ^ (v[6] >> 16) ^ (v[7] << 16) ^ v[7]; + +#define PASS \ + X(w, u, v); \ + P(key, w); \ + R(key, h, i, t, l, r); \ + S(s, l, r); \ + if (i != 6) { \ + A(u, l, r); \ + if (i == 2) { \ + C(u); \ + } \ + AA(v, l, r); \ + } + +static inline void Gost(unsigned int state[8], unsigned int data[8]) { + int i; + unsigned int l, r, t, key[8], u[8], v[8], w[8], s[8], *h = state, *m = data; + + memcpy(u, state, sizeof(u)); + memcpy(v, data, sizeof(v)); + + for (i = 0; i < 8; i += 2) { + PASS; + } + SHIFT12(u, m, s); + SHIFT16(h, v, u); + SHIFT61(h, v); +} + +static inline void GostTransform(PHP_GOST_CTX *context, + const unsigned char input[32]) { + int i, j; + unsigned int data[8], temp = 0, save = 0; + + for (i = 0, j = 0; i < 8; ++i, j += 4) { + data[i] = ((unsigned int) input[j]) | + (((unsigned int) input[j + 1]) << 8) | + (((unsigned int) input[j + 2]) << 16) | + (((unsigned int) input[j + 3]) << 24); + save = context->state[i + 8]; + context->state[i + 8] += data[i] + temp; + temp = ((context->state[i + 8] < data[i]) || + (context->state[i + 8] < save)) ? 1 : 0; + } + + Gost(context->state, data); +} + +void hash_gost::hash_init(void *context_) { + PHP_GOST_CTX *context = (PHP_GOST_CTX*)context_; + memset(context, 0, sizeof(*context)); +} + +static const unsigned int MAX32 = 0xffffffffLU; + +void hash_gost::hash_update(void *context_, const unsigned char *input, + unsigned int len) { + PHP_GOST_CTX *context = (PHP_GOST_CTX*)context_; + if ((MAX32 - context->count[0]) < (len * 8)) { + context->count[1]++; + context->count[0] = MAX32 - context->count[0]; + context->count[0] = (len * 8) - context->count[0]; + } else { + context->count[0] += len * 8; + } + + if (context->length + len < 32) { + memcpy(&context->buffer[context->length], input, len); + context->length += len; + } else { + size_t i = 0, r = (context->length + len) % 32; + + if (context->length) { + i = 32 - context->length; + memcpy(&context->buffer[context->length], input, i); + GostTransform(context, context->buffer); + } + + for (; i + 32 <= len; i += 32) { + GostTransform(context, input + i); + } + + memcpy(context->buffer, input + i, r); + memset(&context->buffer[r], 0, 32 - r); + context->length = r; + } +} + +void hash_gost::hash_final(unsigned char *digest, void *context_) { + PHP_GOST_CTX *context = (PHP_GOST_CTX*)context_; + unsigned int i, j, l[8] = {0}; + + if (context->length) { + GostTransform(context, context->buffer); + } + + memcpy(l, context->count, sizeof(context->count)); + Gost(context->state, l); + memcpy(l, &context->state[8], sizeof(l)); + Gost(context->state, l); + + for (i = 0, j = 0; j < 32; i++, j += 4) { + digest[j] = (unsigned char) (context->state[i] & 0xff); + digest[j + 1] = (unsigned char) ((context->state[i] >> 8) & 0xff); + digest[j + 2] = (unsigned char) ((context->state[i] >> 16) & 0xff); + digest[j + 3] = (unsigned char) ((context->state[i] >> 24) & 0xff); + } + + memset(context, 0, sizeof(*context)); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_gost.h b/src/cpp/ext/hash/hash_gost.h new file mode 100644 index 0000000000000..cb62d2e90b3e5 --- /dev/null +++ b/src/cpp/ext/hash/hash_gost.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_GOST_H__ +#define __EXT_HASH_GOST_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_gost : public HashEngine { +public: + hash_gost(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_GOST_H__ diff --git a/src/cpp/ext/hash/hash_haval.cpp b/src/cpp/ext/hash/hash_haval.cpp new file mode 100644 index 0000000000000..704df6e6c59a4 --- /dev/null +++ b/src/cpp/ext/hash/hash_haval.cpp @@ -0,0 +1,551 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state[8]; + unsigned int count[2]; + unsigned char buffer[128]; + + char passes; + short output; + void (*Transform)(unsigned int state[8], const unsigned char block[128]); +} PHP_HAVAL_CTX; + +static const unsigned char PADDING[128] ={ + 1, 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 }; + +static const unsigned int D0[8] = { + 0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89 }; + +static const unsigned int K2[32] = { + 0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917, + 0x9216D5D9, 0x8979FB1B, 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7, 0xB8E1AFED, 0x6A267E96, + 0xBA7C9045, 0xF12C7F99, 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16, 0x636920D8, 0x71574E69, + 0xA458FEA3, 0xF4933D7E, 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE, 0x7B54A41D, 0xC25A59B5 }; + +static const unsigned int K3[32] = { + 0x9C30D539, 0x2AF26013, 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF, 0x8E79DCB0, 0x603A180E, + 0x6C9E0E8B, 0xB01E8A3E, 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60, 0xE65525F3, 0xAA55AB94, + 0x57489862, 0x63E81440, 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE, 0xA15486AF, 0x7C72E993, + 0xB3EE1411, 0x636FBC2A, 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E, 0xAFD6BA33, 0x6C24CF5C }; + +static const unsigned int K4[32] = { + 0x7A325381, 0x28958677, 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193, 0x61D809CC, 0xFB21A991, + 0x487CAC60, 0x5DEC8032, 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88, 0x23893E81, 0xD396ACC5, + 0x0F6D6FF3, 0x83F44239, 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E, 0x21C66842, 0xF6E96C9A, + 0x670C9C61, 0xABD388F0, 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3, 0x6EEF0B6C, 0x137A3BE4 }; + +static const unsigned int K5[32] = { + 0xBA3BF050, 0x7EFB2A98, 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88, 0x8CEE8619, 0x456F9FB4, + 0x7D84A5C3, 0x3B8B5EBE, 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6, 0x4ED3AA62, 0x363F7706, + 0x1BFEDF72, 0x429B023D, 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B, 0x075372C9, 0x80991B7B, + 0x25D479D8, 0xF6E8DEF7, 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA, 0xC1A94FB6, 0x409F60C4 }; + +static const short I2[32] = { + 5, 14, 26, 18, 11, 28, 7, 16, 0, 23, 20, 22, 1, 10, 4, 8, + 30, 3, 21, 9, 17, 24, 29, 6, 19, 12, 15, 13, 2, 25, 31, 27 }; + +static const short I3[32] = { + 19, 9, 4, 20, 28, 17, 8, 22, 29, 14, 25, 12, 24, 30, 16, 26, + 31, 15, 7, 3, 1, 0, 18, 27, 13, 6, 21, 10, 23, 11, 5, 2 }; + +static const short I4[32] = { + 24, 4, 0, 14, 2, 7, 28, 23, 26, 6, 30, 20, 18, 25, 19, 3, + 22, 11, 31, 21, 8, 27, 12, 9, 1, 29, 5, 15, 17, 10, 16, 13 }; + +static const short I5[32] = { + 27, 3, 21, 26, 17, 11, 20, 29, 19, 0, 12, 7, 13, 8, 31, 10, + 5, 9, 14, 30, 18, 6, 28, 24, 2, 23, 16, 22, 4, 1, 25, 15 }; + +static const short M0[32] = { + 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, + 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1 }; + +static const short M1[32] = { + 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, + 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2 }; + +static const short M2[32] = { + 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, + 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3 }; + +static const short M3[32] = { + 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, + 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4 }; + +static const short M4[32] = { + 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, + 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5 }; + +static const short M5[32] = { + 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, + 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6 }; + +static const short M6[32] = { + 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, + 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7 }; + +static const short M7[32] = { + 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, + 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0 }; + +/* + Encodes input (unsigned int) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void Encode(unsigned char *output, unsigned int *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char) (input[i] & 0xff); + output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff); + output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff); + output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff); + } +} + +/* + Decodes input (unsigned char) into output (unsigned int). Assumes len is + a multiple of 4. + */ +static void Decode(unsigned int *output, const unsigned char *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[i] = ((unsigned int) input[j]) | + (((unsigned int) input[j + 1]) << 8) | + (((unsigned int) input[j + 2]) << 16) | + (((unsigned int) input[j + 3]) << 24); + } +} + +#define F1(x6,x5,x4,x3,x2,x1,x0) \ + ( ((x1) & (x4)) ^ ((x2) & (x5)) ^ ((x3) & (x6)) ^ ((x0) & (x1)) ^ (x0) ) +#define F2(x6,x5,x4,x3,x2,x1,x0) \ + ( ((x1) & (x2) & (x3)) ^ ((x2) & (x4) & (x5)) ^ \ + ((x1) & (x2)) ^ ((x1) & (x4)) ^ \ + ((x2) & (x6)) ^ ((x3) & (x5)) ^ ((x4) & (x5)) ^ ((x0) & (x2)) ^ (x0) ) +#define F3(x6,x5,x4,x3,x2,x1,x0) \ + ( ((x1) & (x2) & (x3)) ^ ((x1) & (x4)) ^ \ + ((x2) & (x5)) ^ ((x3) & (x6)) ^ ((x0) & (x3)) ^ (x0) ) +#define F4(x6,x5,x4,x3,x2,x1,x0) \ + ( ((x1) & (x2) & (x3)) ^ ((x2) & (x4) & (x5)) ^ ((x3) & (x4) & (x6)) ^ \ + ((x1) & (x4)) ^ ((x2) & (x6)) ^ ((x3) & (x4)) ^ ((x3) & (x5)) ^ \ + ((x3) & (x6)) ^ ((x4) & (x5)) ^ ((x4) & (x6)) ^ ((x0) & (x4)) ^ (x0) ) +#define F5(x6,x5,x4,x3,x2,x1,x0) \ + ( ((x1) & (x4)) ^ ((x2) & (x5)) ^ ((x3) & (x6)) ^ \ + ((x0) & (x1) & (x2) & (x3)) ^ ((x0) & (x5)) ^ (x0) ) + +#define ROTR(x,n) (((x) >> (n)) | ((x) << (32 - (n)))) + + +static void PHP_3HAVALTransform(unsigned int state[8], + const unsigned char block[128]) { + unsigned int E[8]; + unsigned int x[32]; + int i; + + Decode(x, block, 128); + + for(i = 0; i < 8; i++) { + E[i] = state[i]; + } + + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F1(E[M1[i]],E[M0[i]],E[M3[i]],E[M5[i]],E[M6[i]],E[M2[i]],E[M4[i]]),7) + ROTR(E[M7[i]],11) + x[i]; + } + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F2(E[M4[i]],E[M2[i]],E[M1[i]],E[M0[i]],E[M5[i]],E[M3[i]],E[M6[i]]),7) + ROTR(E[M7[i]],11) + x[I2[i]] + K2[i]; + } + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F3(E[M6[i]],E[M1[i]],E[M2[i]],E[M3[i]],E[M4[i]],E[M5[i]],E[M0[i]]),7) + ROTR(E[M7[i]],11) + x[I3[i]] + K3[i]; + } + + /* Update digest */ + for(i = 0; i < 8; i++) { + state[i] += E[i]; + } + + /* Zeroize sensitive information. */ + memset((unsigned char*) x, 0, sizeof(x)); +} + +static void PHP_4HAVALTransform(unsigned int state[8], + const unsigned char block[128]) { + unsigned int E[8]; + unsigned int x[32]; + int i; + + Decode(x, block, 128); + + for(i = 0; i < 8; i++) { + E[i] = state[i]; + } + + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F1(E[M2[i]],E[M6[i]],E[M1[i]],E[M4[i]],E[M5[i]],E[M3[i]],E[M0[i]]),7) + ROTR(E[M7[i]],11) + x[i]; + } + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F2(E[M3[i]],E[M5[i]],E[M2[i]],E[M0[i]],E[M1[i]],E[M6[i]],E[M4[i]]),7) + ROTR(E[M7[i]],11) + x[I2[i]] + K2[i]; + } + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F3(E[M1[i]],E[M4[i]],E[M3[i]],E[M6[i]],E[M0[i]],E[M2[i]],E[M5[i]]),7) + ROTR(E[M7[i]],11) + x[I3[i]] + K3[i]; + } + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F4(E[M6[i]],E[M4[i]],E[M0[i]],E[M5[i]],E[M2[i]],E[M1[i]],E[M3[i]]),7) + ROTR(E[M7[i]],11) + x[I4[i]] + K4[i]; + } + + /* Update digest */ + for(i = 0; i < 8; i++) { + state[i] += E[i]; + } + + /* Zeroize sensitive information. */ + memset((unsigned char*) x, 0, sizeof(x)); +} + +static void PHP_5HAVALTransform(unsigned int state[8], + const unsigned char block[128]) { + unsigned int E[8]; + unsigned int x[32]; + int i; + + Decode(x, block, 128); + + for(i = 0; i < 8; i++) { + E[i] = state[i]; + } + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F1(E[M3[i]],E[M4[i]],E[M1[i]],E[M0[i]],E[M5[i]],E[M2[i]],E[M6[i]]),7) + ROTR(E[M7[i]],11) + x[i]; + } + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F2(E[M6[i]],E[M2[i]],E[M1[i]],E[M0[i]],E[M3[i]],E[M4[i]],E[M5[i]]),7) + ROTR(E[M7[i]],11) + x[I2[i]] + K2[i]; + } + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F3(E[M2[i]],E[M6[i]],E[M0[i]],E[M4[i]],E[M3[i]],E[M1[i]],E[M5[i]]),7) + ROTR(E[M7[i]],11) + x[I3[i]] + K3[i]; + } + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F4(E[M1[i]],E[M5[i]],E[M3[i]],E[M2[i]],E[M0[i]],E[M4[i]],E[M6[i]]),7) + ROTR(E[M7[i]],11) + x[I4[i]] + K4[i]; + } + for(i = 0; i < 32; i++) { + E[7 - (i % 8)] = ROTR(F5(E[M2[i]],E[M5[i]],E[M0[i]],E[M6[i]],E[M4[i]],E[M3[i]],E[M1[i]]),7) + ROTR(E[M7[i]],11) + x[I5[i]] + K5[i]; + } + + /* Update digest */ + for(i = 0; i < 8; i++) { + state[i] += E[i]; + } + + /* Zeroize sensitive information. */ + memset((unsigned char*) x, 0, sizeof(x)); +} + +hash_haval::hash_haval(int type, int digest) + : HashEngine(digest/8, 128, sizeof(PHP_HAVAL_CTX)), + m_type(type), m_digest(digest) { +} + +void hash_haval::hash_init(void *context_) { + PHP_HAVAL_CTX *context = (PHP_HAVAL_CTX*)context_; + context->count[0] = context->count[1] = 0; + for (int i = 0; i < 8; i++) context->state[i] = D0[i]; + context->passes = m_type; + context->output = m_digest; + switch (m_type) { + case 3: context->Transform = PHP_3HAVALTransform; break; + case 4: context->Transform = PHP_4HAVALTransform; break; + case 5: context->Transform = PHP_5HAVALTransform; break; + default: + ASSERT(false); + } +} + +static void PHP_HAVALUpdate(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_HAVAL_CTX *context = (PHP_HAVAL_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 128 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x7F); + /* Update number of bits */ + if ((context->count[0] += + ((unsigned int) inputLen << 3)) < ((unsigned int) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((unsigned int) inputLen >> 29); + + partLen = 128 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + context->Transform(context->state, context->buffer); + + for (i = partLen; i + 127 < inputLen; i += 128) { + context->Transform(context->state, &input[i]); + } + + index = 0; + } else { + i = 0; + } + + /* Buffer remaining input */ + memcpy((unsigned char*) &context->buffer[index], + (unsigned char*) &input[i], inputLen - i); +} + +void hash_haval::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_HAVALUpdate(context_, input, inputLen); +} + +#define PHP_HASH_HAVAL_VERSION 0x01 + +static void PHP_HAVAL128Final(unsigned char *digest, PHP_HAVAL_CTX * context) { + unsigned char bits[10]; + unsigned int index, padLen; + + /* Version, Passes, and Digest Length */ + bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) | + ((context->passes & 0x07) << 3) | + ((context->output & 0x03) << 6); + bits[1] = (context->output >> 2); + + /* Save number of bits */ + Encode(bits + 2, context->count, 8); + + /* Pad out to 118 mod 128. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 118) ? (118 - index) : (246 - index); + PHP_HAVALUpdate(context, PADDING, padLen); + + /* Append version, passes, digest length, and message length */ + PHP_HAVALUpdate(context, bits, 10); + + /* Store state in digest */ + context->state[3] += (context->state[7] & 0xFF000000) | + (context->state[6] & 0x00FF0000) | + (context->state[5] & 0x0000FF00) | + (context->state[4] & 0x000000FF); + + context->state[2] += (((context->state[7] & 0x00FF0000) | + (context->state[6] & 0x0000FF00) | + (context->state[5] & 0x000000FF)) << 8) | + ((context->state[4] & 0xFF000000) >> 24); + + context->state[1] += (((context->state[7] & 0x0000FF00) | + (context->state[6] & 0x000000FF)) << 16) | + (((context->state[5] & 0xFF000000) | + (context->state[4] & 0x00FF0000)) >> 16); + + context->state[0] += ((context->state[7] & 0x000000FF) << 24) | + (((context->state[6] & 0xFF000000) | + (context->state[5] & 0x00FF0000) | + (context->state[4] & 0x0000FF00)) >> 8); + + Encode(digest, context->state, 16); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +static void PHP_HAVAL160Final(unsigned char *digest, PHP_HAVAL_CTX * context) { + unsigned char bits[10]; + unsigned int index, padLen; + + /* Version, Passes, and Digest Length */ + bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) | + ((context->passes & 0x07) << 3) | + ((context->output & 0x03) << 6); + bits[1] = (context->output >> 2); + + /* Save number of bits */ + Encode(bits + 2, context->count, 8); + + /* Pad out to 118 mod 128. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 118) ? (118 - index) : (246 - index); + PHP_HAVALUpdate(context, PADDING, padLen); + + /* Append version, passes, digest length, and message length */ + PHP_HAVALUpdate(context, bits, 10); + + /* Store state in digest */ + context->state[4] += ((context->state[7] & 0xFE000000) | + (context->state[6] & 0x01F80000) | + (context->state[5] & 0x0007F000)) >> 12; + + context->state[3] += ((context->state[7] & 0x01F80000) | + (context->state[6] & 0x0007F000) | + (context->state[5] & 0x00000FC0)) >> 6; + + context->state[2] += (context->state[7] & 0x0007F000) | + (context->state[6] & 0x00000FC0) | + (context->state[5] & 0x0000003F); + + context->state[1] += ROTR((context->state[7] & 0x00000FC0) | + (context->state[6] & 0x0000003F) | + (context->state[5] & 0xFE000000), 25); + + context->state[0] += ROTR((context->state[7] & 0x0000003F) | + (context->state[6] & 0xFE000000) | + (context->state[5] & 0x01F80000), 19); + + Encode(digest, context->state, 20); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +static void PHP_HAVAL192Final(unsigned char *digest, PHP_HAVAL_CTX * context) { + unsigned char bits[10]; + unsigned int index, padLen; + + /* Version, Passes, and Digest Length */ + bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) | + ((context->passes & 0x07) << 3) | + ((context->output & 0x03) << 6); + bits[1] = (context->output >> 2); + + /* Save number of bits */ + Encode(bits + 2, context->count, 8); + + /* Pad out to 118 mod 128. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 118) ? (118 - index) : (246 - index); + PHP_HAVALUpdate(context, PADDING, padLen); + + /* Append version, passes, digest length, and message length */ + PHP_HAVALUpdate(context, bits, 10); + + /* Store state in digest */ + context->state[5] += ((context->state[7] & 0xFC000000) | (context->state[6] & 0x03E00000)) >> 21; + context->state[4] += ((context->state[7] & 0x03E00000) | (context->state[6] & 0x001F0000)) >> 16; + context->state[3] += ((context->state[7] & 0x001F0000) | (context->state[6] & 0x0000FC00)) >> 10; + context->state[2] += ((context->state[7] & 0x0000FC00) | (context->state[6] & 0x000003E0)) >> 5; + context->state[1] += (context->state[7] & 0x000003E0) | (context->state[6] & 0x0000001F); + context->state[0] += ROTR((context->state[7] & 0x0000001F) | (context->state[6] & 0xFC000000), 26); + Encode(digest, context->state, 24); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +static void PHP_HAVAL224Final(unsigned char *digest, PHP_HAVAL_CTX * context) { + unsigned char bits[10]; + unsigned int index, padLen; + + /* Version, Passes, and Digest Length */ + bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) | + ((context->passes & 0x07) << 3) | + ((context->output & 0x03) << 6); + bits[1] = (context->output >> 2); + + /* Save number of bits */ + Encode(bits + 2, context->count, 8); + + /* Pad out to 118 mod 128. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 118) ? (118 - index) : (246 - index); + PHP_HAVALUpdate(context, PADDING, padLen); + + /* Append version, passes, digest length, and message length */ + PHP_HAVALUpdate(context, bits, 10); + + /* Store state in digest */ + context->state[6] += context->state[7] & 0x0000000F; + context->state[5] += (context->state[7] >> 4) & 0x0000001F; + context->state[4] += (context->state[7] >> 9) & 0x0000000F; + context->state[3] += (context->state[7] >> 13) & 0x0000001F; + context->state[2] += (context->state[7] >> 18) & 0x0000000F; + context->state[1] += (context->state[7] >> 22) & 0x0000001F; + context->state[0] += (context->state[7] >> 27) & 0x0000001F; + Encode(digest, context->state, 28); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +static void PHP_HAVAL256Final(unsigned char *digest, PHP_HAVAL_CTX * context) { + unsigned char bits[10]; + unsigned int index, padLen; + + /* Version, Passes, and Digest Length */ + bits[0] = (PHP_HASH_HAVAL_VERSION & 0x07) | + ((context->passes & 0x07) << 3) | + ((context->output & 0x03) << 6); + bits[1] = (context->output >> 2); + + /* Save number of bits */ + Encode(bits + 2, context->count, 8); + + /* Pad out to 118 mod 128. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 118) ? (118 - index) : (246 - index); + PHP_HAVALUpdate(context, PADDING, padLen); + + /* Append version, passes, digest length, and message length */ + PHP_HAVALUpdate(context, bits, 10); + + /* Store state in digest */ + Encode(digest, context->state, 32); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +void hash_haval::hash_final(unsigned char *digest, void *context) { + switch (m_digest) { + case 128: PHP_HAVAL128Final(digest, (PHP_HAVAL_CTX *)context); break; + case 160: PHP_HAVAL160Final(digest, (PHP_HAVAL_CTX *)context); break; + case 192: PHP_HAVAL192Final(digest, (PHP_HAVAL_CTX *)context); break; + case 224: PHP_HAVAL224Final(digest, (PHP_HAVAL_CTX *)context); break; + case 256: PHP_HAVAL256Final(digest, (PHP_HAVAL_CTX *)context); break; + default: + ASSERT(false); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_haval.h b/src/cpp/ext/hash/hash_haval.h new file mode 100644 index 0000000000000..13a47400bcdc7 --- /dev/null +++ b/src/cpp/ext/hash/hash_haval.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_HAVAL_H__ +#define __EXT_HASH_HAVAL_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_haval : public HashEngine { +public: + hash_haval(int type, int digest); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); + +private: + int m_type; + int m_digest; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_HAVAL_H__ diff --git a/src/cpp/ext/hash/hash_md.cpp b/src/cpp/ext/hash/hash_md.cpp new file mode 100644 index 0000000000000..7de562fa83b4d --- /dev/null +++ b/src/cpp/ext/hash/hash_md.cpp @@ -0,0 +1,606 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state[4]; /* state (ABCD) */ + unsigned int count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} PHP_MD5_CTX; + +hash_md5::hash_md5() : HashEngine(16, 64, sizeof(PHP_MD5_CTX)) { +} + +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state[4]; + unsigned int count[2]; + unsigned char buffer[64]; +} PHP_MD4_CTX; + +hash_md4::hash_md4() : HashEngine(16, 64, sizeof(PHP_MD4_CTX)) { +} + +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned char state[48]; + unsigned char checksum[16]; + unsigned char buffer[16]; + char in_buffer; +} PHP_MD2_CTX; + +hash_md2::hash_md2() : HashEngine(16, 16, sizeof(PHP_MD2_CTX)) { +} + +static const unsigned char PADDING[64] = { + 0x80, 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 +}; + +/* + Encodes input (unsigned int) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void Encode(unsigned char *output, unsigned int *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char) (input[i] & 0xff); + output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff); + output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff); + output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff); + } +} + +/* + Decodes input (unsigned char) into output (unsigned int). Assumes len is + a multiple of 4. + */ +static void Decode(unsigned int *output, const unsigned char *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((unsigned int) input[j]) | + (((unsigned int) input[j + 1]) << 8) | + (((unsigned int) input[j + 2]) << 16) | + (((unsigned int) input[j + 3]) << 24); +} + +/* MD5 */ + +/* + * The remaining code is the reference MD5 code (md5c.c) from rfc1321 + */ +/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD5 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD5 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + */ + +/* Constants for MD5Transform routine. + */ + +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + +static void MD5Transform(unsigned int[4], const unsigned char[64]); + +/* F, G, H and I are basic MD5 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. + Rotation is separate from addition to prevent recomputation. + */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (unsigned int)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (unsigned int)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (unsigned int)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (unsigned int)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + +/* + * MD5 initialization. Begins an MD5 operation, writing a new context. + */ +void hash_md5::hash_init(void *context_) { + PHP_MD5_CTX *context = (PHP_MD5_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* + MD5 block update operation. Continues an MD5 message-digest + operation, processing another message block, and updating the + context. + */ +void hash_md5::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_MD5_CTX *context = (PHP_MD5_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((unsigned int) inputLen << 3)) + < ((unsigned int) inputLen << 3)) + context->count[1]++; + context->count[1] += ((unsigned int) inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + MD5Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform(context->state, &input[i]); + + index = 0; + } else + i = 0; + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], + inputLen - i); +} + +/* + MD5 finalization. Ends an MD5 message-digest operation, writing the + the message digest and zeroizing the context. + */ +void hash_md5::hash_final(unsigned char *digest, void *context_) { + PHP_MD5_CTX *context = (PHP_MD5_CTX*)context_; + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + Encode(bits, context->count, 8); + + /* Pad out to 56 mod 64. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + hash_update(context, PADDING, padLen); + + /* Append length (before padding) */ + hash_update(context, bits, 8); + + /* Store state in digest */ + Encode(digest, context->state, 16); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/* + * MD5 basic transformation. Transforms state based on block. + */ +static void MD5Transform(unsigned int state[4], + const unsigned char block[64]) { + unsigned int a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode(x, block, 64); + + /* Round 1 */ + FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */ + FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */ + FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */ + FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */ + FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */ + FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */ + FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */ + FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */ + FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */ + FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */ + FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */ + GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */ + GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */ + GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */ + GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */ + GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */ + GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */ + GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */ + GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */ + GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */ + GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */ + HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */ + HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */ + HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */ + HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */ + HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */ + HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */ + HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */ + HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */ + HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */ + II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */ + II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */ + II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */ + II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */ + II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */ + II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */ + II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */ + II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */ + II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. */ + memset((unsigned char*) x, 0, sizeof(x)); +} + +/* MD4 */ + +#define MD4_F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) +#define MD4_G(x,y,z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) +#define MD4_H(x,y,z) ((x) ^ (y) ^ (z)) + +#define ROTL32(s,v) (((v) << (s)) | ((v) >> (32 - (s)))) + +#define MD4_R1(a,b,c,d,k,s) a = ROTL32(s, a + MD4_F(b,c,d) + x[k]) +#define MD4_R2(a,b,c,d,k,s) a = ROTL32(s, a + MD4_G(b,c,d) + x[k] + 0x5A827999) +#define MD4_R3(a,b,c,d,k,s) a = ROTL32(s, a + MD4_H(b,c,d) + x[k] + 0x6ED9EBA1) + +static void MD4Transform(unsigned int state[4], + const unsigned char block[64]) { + unsigned int a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode(x, block, 64); + + /* Round 1 */ + MD4_R1(a,b,c,d, 0, 3); + MD4_R1(d,a,b,c, 1, 7); + MD4_R1(c,d,a,b, 2,11); + MD4_R1(b,c,d,a, 3,19); + MD4_R1(a,b,c,d, 4, 3); + MD4_R1(d,a,b,c, 5, 7); + MD4_R1(c,d,a,b, 6,11); + MD4_R1(b,c,d,a, 7,19); + MD4_R1(a,b,c,d, 8, 3); + MD4_R1(d,a,b,c, 9, 7); + MD4_R1(c,d,a,b,10,11); + MD4_R1(b,c,d,a,11,19); + MD4_R1(a,b,c,d,12, 3); + MD4_R1(d,a,b,c,13, 7); + MD4_R1(c,d,a,b,14,11); + MD4_R1(b,c,d,a,15,19); + + /* Round 2 */ + MD4_R2(a,b,c,d, 0, 3); + MD4_R2(d,a,b,c, 4, 5); + MD4_R2(c,d,a,b, 8, 9); + MD4_R2(b,c,d,a,12,13); + MD4_R2(a,b,c,d, 1, 3); + MD4_R2(d,a,b,c, 5, 5); + MD4_R2(c,d,a,b, 9, 9); + MD4_R2(b,c,d,a,13,13); + MD4_R2(a,b,c,d, 2, 3); + MD4_R2(d,a,b,c, 6, 5); + MD4_R2(c,d,a,b,10, 9); + MD4_R2(b,c,d,a,14,13); + MD4_R2(a,b,c,d, 3, 3); + MD4_R2(d,a,b,c, 7, 5); + MD4_R2(c,d,a,b,11, 9); + MD4_R2(b,c,d,a,15,13); + + /* Round 3 */ + MD4_R3(a,b,c,d, 0, 3); + MD4_R3(d,a,b,c, 8, 9); + MD4_R3(c,d,a,b, 4,11); + MD4_R3(b,c,d,a,12,15); + MD4_R3(a,b,c,d, 2, 3); + MD4_R3(d,a,b,c,10, 9); + MD4_R3(c,d,a,b, 6,11); + MD4_R3(b,c,d,a,14,15); + MD4_R3(a,b,c,d, 1, 3); + MD4_R3(d,a,b,c, 9, 9); + MD4_R3(c,d,a,b, 5,11); + MD4_R3(b,c,d,a,13,15); + MD4_R3(a,b,c,d, 3, 3); + MD4_R3(d,a,b,c,11, 9); + MD4_R3(c,d,a,b, 7,11); + MD4_R3(b,c,d,a,15,15); + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; +} + +/* + MD4 block update operation. Continues an MD5 message-digest + operation, processing another message block, and updating the + context. + */ + +void hash_md4::hash_init(void *context_) { + PHP_MD4_CTX *context = (PHP_MD4_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +void hash_md4::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_MD4_CTX *context = (PHP_MD4_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((unsigned int) inputLen << 3)) + < ((unsigned int) inputLen << 3)) + context->count[1]++; + context->count[1] += ((unsigned int) inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + MD4Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) { + MD4Transform(context->state, &input[i]); + } + + index = 0; + } else { + i = 0; + } + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +/* + MD4 finalization. Ends an MD4 message-digest operation, writing the + the message digest and zeroizing the context. + */ +void hash_md4::hash_final(unsigned char *digest, void *context_) { + PHP_MD4_CTX *context = (PHP_MD4_CTX*)context_; + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + Encode(bits, context->count, 8); + + /* Pad out to 56 mod 64. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + hash_update(context, PADDING, padLen); + + /* Append length (before padding) */ + hash_update(context, bits, 8); + + /* Store state in digest */ + Encode(digest, context->state, 16); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/* MD2 */ + +static const unsigned char MD2_S[256] = { +41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19, +98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 76, 130, 202, +30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, 138, 23, 229, 18, +190, 78, 196, 214, 218, 158, 222, 73, 160, 251, 245, 142, 187, 47, 238, 122, +169, 104, 121, 145, 21, 178, 7, 63, 148, 194, 16, 137, 11, 34, 95, 33, +128, 127, 93, 154, 90, 144, 50, 39, 53, 62, 204, 231, 191, 247, 151, 3, +255, 25, 48, 179, 72, 165, 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, +79, 184, 56, 210, 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, +69, 157, 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, +27, 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, +85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, 234, 38, +44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, 129, 77, 82, +106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, 8, 12, 189, 177, 74, +120, 136, 149, 139, 227, 99, 232, 109, 233, 203, 213, 254, 59, 0, 29, 57, +242, 239, 183, 14, 102, 88, 208, 228, 166, 119, 114, 248, 235, 117, 75, 10, +49, 68, 80, 180, 143, 237, 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 +}; + +void hash_md2::hash_init(void *context_) { + PHP_MD2_CTX *context = (PHP_MD2_CTX*)context_; + memset(context, 0, sizeof(PHP_MD2_CTX)); +} + +static void MD2_Transform(PHP_MD2_CTX *context, const unsigned char *block) { + unsigned char i,j,t = 0; + + for(i = 0; i < 16; i++) { + context->state[16+i] = block[i]; + context->state[32+i] = (context->state[16+i] ^ context->state[i]); + } + + for(i = 0; i < 18; i++) { + for(j = 0; j < 48; j++) { + t = context->state[j] = context->state[j] ^ MD2_S[t]; + } + t += i; + } + + /* Update checksum -- must be after transform to avoid fouling up + last message block */ + t = context->checksum[15]; + for(i = 0; i < 16; i++) { + t = context->checksum[i] ^= MD2_S[block[i] ^ t]; + } +} + +void hash_md2::hash_update(void *context_, const unsigned char *buf, + unsigned int len) { + PHP_MD2_CTX *context = (PHP_MD2_CTX*)context_; + const unsigned char *p = buf, *e = buf + len; + + if (context->in_buffer) { + if (context->in_buffer + len < 16) { + /* Not enough for block, just pass into buffer */ + memcpy(context->buffer + context->in_buffer, p, len); + context->in_buffer += len; + return; + } + /* Put buffered data together with inbound for a single block */ + memcpy(context->buffer + context->in_buffer, p, 16 - context->in_buffer); + MD2_Transform(context, context->buffer); + p += 16 - context->in_buffer; + context->in_buffer = 0; + } + + /* Process as many whole blocks as remain */ + while ((p + 16) <= e) { + MD2_Transform(context, p); + p += 16; + } + + /* Copy remaining data to buffer */ + if (p < e) { + memcpy(context->buffer, p, e - p); + context->in_buffer = e - p; + } +} + +void hash_md2::hash_final(unsigned char *digest, void *context_) { + PHP_MD2_CTX *context = (PHP_MD2_CTX*)context_; + memset(context->buffer + context->in_buffer, 16 - context->in_buffer, + 16 - context->in_buffer); + MD2_Transform(context, context->buffer); + MD2_Transform(context, context->checksum); + + memcpy(digest, context->state, 16); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_md.h b/src/cpp/ext/hash/hash_md.h new file mode 100644 index 0000000000000..e3ebba0085b34 --- /dev/null +++ b/src/cpp/ext/hash/hash_md.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_MD_H__ +#define __EXT_HASH_MD_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_md5 : public HashEngine { +public: + hash_md5(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +class hash_md4 : public HashEngine { +public: + hash_md4(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +class hash_md2 : public HashEngine { +public: + hash_md2(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_MD_H__ diff --git a/src/cpp/ext/hash/hash_ripemd.cpp b/src/cpp/ext/hash/hash_ripemd.cpp new file mode 100644 index 0000000000000..3f565ddcfd252 --- /dev/null +++ b/src/cpp/ext/hash/hash_ripemd.cpp @@ -0,0 +1,775 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +/* Heavily borrowed from md5.c & sha1.c of PHP archival fame + Note that ripemd laughs in the face of logic and uses + little endian byte ordering */ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state[4]; /* state (ABCD) */ + unsigned int count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} PHP_RIPEMD128_CTX; + +typedef struct { + unsigned int state[5]; /* state (ABCD) */ + unsigned int count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} PHP_RIPEMD160_CTX; + +typedef struct { + unsigned int state[8]; /* state (ABCD) */ + unsigned int count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} PHP_RIPEMD256_CTX; + +typedef struct { + unsigned int state[10]; /* state (ABCD) */ + unsigned int count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} PHP_RIPEMD320_CTX; + +hash_ripemd128::hash_ripemd128() + : HashEngine(16, 64, sizeof(PHP_RIPEMD128_CTX)) { +} + +hash_ripemd160::hash_ripemd160() + : HashEngine(20, 64, sizeof(PHP_RIPEMD160_CTX)) { +} + +hash_ripemd256::hash_ripemd256() + : HashEngine(32, 64, sizeof(PHP_RIPEMD256_CTX)) { +} + +hash_ripemd320::hash_ripemd320() + : HashEngine(40, 64, sizeof(PHP_RIPEMD320_CTX)) { +} + +/* + * ripemd128 initialization. Begins a ripemd128 operation, writing + * a new context. + */ +void hash_ripemd128::hash_init(void *context_) { + PHP_RIPEMD128_CTX * context = (PHP_RIPEMD128_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xEFCDAB89; + context->state[2] = 0x98BADCFE; + context->state[3] = 0x10325476; +} + +/* + * ripemd256 initialization. Begins a ripemd256 operation, + * writing a new context. + */ +void hash_ripemd256::hash_init(void *context_) { + PHP_RIPEMD256_CTX * context = (PHP_RIPEMD256_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xEFCDAB89; + context->state[2] = 0x98BADCFE; + context->state[3] = 0x10325476; + context->state[4] = 0x76543210; + context->state[5] = 0xFEDCBA98; + context->state[6] = 0x89ABCDEF; + context->state[7] = 0x01234567; +} + +/* + * ripemd160 initialization. Begins a ripemd160 operation, + * writing a new context. + */ +void hash_ripemd160::hash_init(void *context_) { + PHP_RIPEMD160_CTX * context = (PHP_RIPEMD160_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xEFCDAB89; + context->state[2] = 0x98BADCFE; + context->state[3] = 0x10325476; + context->state[4] = 0xC3D2E1F0; +} + +/* + * ripemd320 initialization. Begins a ripemd320 operation, + * writing a new context. + */ +void hash_ripemd320::hash_init(void *context_) { + PHP_RIPEMD320_CTX * context = (PHP_RIPEMD320_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xEFCDAB89; + context->state[2] = 0x98BADCFE; + context->state[3] = 0x10325476; + context->state[4] = 0xC3D2E1F0; + context->state[5] = 0x76543210; + context->state[6] = 0xFEDCBA98; + context->state[7] = 0x89ABCDEF; + context->state[8] = 0x01234567; + context->state[9] = 0x3C2D1E0F; +} + +/* Basic ripemd function */ +#define F0(x,y,z) ((x) ^ (y) ^ (z)) +#define F1(x,y,z) (((x) & (y)) | ((~(x)) & (z))) +#define F2(x,y,z) (((x) | (~(y))) ^ (z)) +#define F3(x,y,z) (((x) & (z)) | ((y) & (~(z)))) +#define F4(x,y,z) ((x) ^ ((y) | (~(z)))) + +static const unsigned int K_values[5] = { 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E }; /* 128, 256, 160, 320 */ +static const unsigned int KK_values[4] = { 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x00000000 }; /* 128 & 256 */ +static const unsigned int KK160_values[5] = { 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000 }; /* 160 & 320 */ + +#define K(n) K_values[ (n) >> 4] +#define KK(n) KK_values[(n) >> 4] +#define KK160(n) KK160_values[(n) >> 4] + +static const unsigned char R[80] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 }; + +static const unsigned char RR[80] = { + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 }; + +static const unsigned char S[80] = { + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 }; + +static const unsigned char SS[80] = { + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 }; + +#define ROLS(j, x) (((x) << S[j]) | ((x) >> (32 - S[j]))) +#define ROLSS(j, x) (((x) << SS[j]) | ((x) >> (32 - SS[j]))) +#define ROL(n, x) (((x) << n) | ((x) >> (32 - n))) + +/* + Decodes input (unsigned char) into output (unsigned int). Assumes len is + a multiple of 4. + */ +static void RIPEMDDecode(unsigned int *output, const unsigned char *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((unsigned int) input[j + 0]) | + (((unsigned int) input[j + 1]) << 8) | + (((unsigned int) input[j + 2]) << 16) | + (((unsigned int) input[j + 3]) << 24); +} + +/* + * ripemd128 basic transformation. Transforms state based on block. + */ +static void RIPEMD128Transform(unsigned int state[4], + const unsigned char block[64]) { + unsigned int a = state[0], b = state[1], c = state[2], d = state[3]; + unsigned int aa = state[0], bb = state[1], cc = state[2], dd = state[3]; + unsigned int tmp, x[16]; + int j; + + RIPEMDDecode(x, block, 64); + + for(j = 0; j < 16; j++) { + tmp = ROLS( j, a + F0(b, c, d) + x[R[j]] + K(j)); + a = d; d = c; c = b; b = tmp; + tmp = ROLSS(j, aa + F3(bb, cc, dd) + x[RR[j]] + KK(j)); + aa = dd; dd = cc; cc = bb; bb = tmp; + } + + for(j = 16; j < 32; j++) { + tmp = ROLS( j, a + F1(b, c, d) + x[R[j]] + K(j)); + a = d; d = c; c = b; b = tmp; + tmp = ROLSS(j, aa + F2(bb, cc, dd) + x[RR[j]] + KK(j)); + aa = dd; dd = cc; cc = bb; bb = tmp; + } + + for(j = 32; j < 48; j++) { + tmp = ROLS( j, a + F2(b, c, d) + x[R[j]] + K(j)); + a = d; d = c; c = b; b = tmp; + tmp = ROLSS(j, aa + F1(bb, cc, dd) + x[RR[j]] + KK(j)); + aa = dd; dd = cc; cc = bb; bb = tmp; + } + + for(j = 48; j < 64; j++) { + tmp = ROLS( j, a + F3(b, c, d) + x[R[j]] + K(j)); + a = d; d = c; c = b; b = tmp; + tmp = ROLSS(j, aa + F0(bb, cc, dd) + x[RR[j]] + KK(j)); + aa = dd; dd = cc; cc = bb; bb = tmp; + } + + tmp = state[1] + c + dd; + state[1] = state[2] + d + aa; + state[2] = state[3] + a + bb; + state[3] = state[0] + b + cc; + state[0] = tmp; + + tmp = 0; + memset(x, 0, sizeof(x)); +} + +/* + ripemd128 block update operation. Continues a ripemd128 message-digest + operation, processing another message block, and updating the + context. + */ +void hash_ripemd128::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_RIPEMD128_CTX * context = (PHP_RIPEMD128_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += + ((unsigned int) inputLen << 3)) < ((unsigned int) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((unsigned int) inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + RIPEMD128Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) { + RIPEMD128Transform(context->state, &input[i]); + } + + index = 0; + } else { + i = 0; + } + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +/* + * ripemd256 basic transformation. Transforms state based on block. + */ +static void RIPEMD256Transform(unsigned int state[8], + const unsigned char block[64]) { + unsigned int a = state[0], b = state[1], c = state[2], d = state[3]; + unsigned int aa = state[4], bb = state[5], cc = state[6], dd = state[7]; + unsigned int tmp, x[16]; + int j; + + RIPEMDDecode(x, block, 64); + + for(j = 0; j < 16; j++) { + tmp = ROLS( j, a + F0(b, c, d) + x[R[j]] + K(j)); + a = d; d = c; c = b; b = tmp; + tmp = ROLSS(j, aa + F3(bb, cc, dd) + x[RR[j]] + KK(j)); + aa = dd; dd = cc; cc = bb; bb = tmp; + } + tmp = a; a = aa; aa = tmp; + + for(j = 16; j < 32; j++) { + tmp = ROLS( j, a + F1(b, c, d) + x[R[j]] + K(j)); + a = d; d = c; c = b; b = tmp; + tmp = ROLSS(j, aa + F2(bb, cc, dd) + x[RR[j]] + KK(j)); + aa = dd; dd = cc; cc = bb; bb = tmp; + } + tmp = b; b = bb; bb = tmp; + + for(j = 32; j < 48; j++) { + tmp = ROLS( j, a + F2(b, c, d) + x[R[j]] + K(j)); + a = d; d = c; c = b; b = tmp; + tmp = ROLSS(j, aa + F1(bb, cc, dd) + x[RR[j]] + KK(j)); + aa = dd; dd = cc; cc = bb; bb = tmp; + } + tmp = c; c = cc; cc = tmp; + + for(j = 48; j < 64; j++) { + tmp = ROLS( j, a + F3(b, c, d) + x[R[j]] + K(j)); + a = d; d = c; c = b; b = tmp; + tmp = ROLSS(j, aa + F0(bb, cc, dd) + x[RR[j]] + KK(j)); + aa = dd; dd = cc; cc = bb; bb = tmp; + } + tmp = d; d = dd; dd = tmp; + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += aa; + state[5] += bb; + state[6] += cc; + state[7] += dd; + + tmp = 0; + memset(x, 0, sizeof(x)); +} + +/* + ripemd256 block update operation. Continues a ripemd256 message-digest + operation, processing another message block, and updating the + context. + */ +void hash_ripemd256::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_RIPEMD256_CTX * context = (PHP_RIPEMD256_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += + ((unsigned int) inputLen << 3)) < ((unsigned int) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((unsigned int) inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + RIPEMD256Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) { + RIPEMD256Transform(context->state, &input[i]); + } + + index = 0; + } else { + i = 0; + } + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +/* + * ripemd160 basic transformation. Transforms state based on block. + */ +static void RIPEMD160Transform(unsigned int state[5], + const unsigned char block[64]) { + unsigned int a = state[0], b = state[1], c = state[2], + d = state[3], e = state[4]; + unsigned int aa = state[0], bb = state[1], cc = state[2], + dd = state[3], ee = state[4]; + unsigned int tmp, x[16]; + int j; + + RIPEMDDecode(x, block, 64); + + for(j = 0; j < 16; j++) { + tmp = ROLS( j, a + F0(b, c, d) + x[R[j]] + K(j)) + e; + a = e; e = d; d = ROL(10, c); c = b; b = tmp; + tmp = ROLSS(j, aa + F4(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee; + aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp; + } + + for(j = 16; j < 32; j++) { + tmp = ROLS( j, a + F1(b, c, d) + x[R[j]] + K(j)) + e; + a = e; e = d; d = ROL(10, c); c = b; b = tmp; + tmp = ROLSS(j, aa + F3(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee; + aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp; + } + + for(j = 32; j < 48; j++) { + tmp = ROLS( j, a + F2(b, c, d) + x[R[j]] + K(j)) + e; + a = e; e = d; d = ROL(10, c); c = b; b = tmp; + tmp = ROLSS(j, aa + F2(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee; + aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp; + } + + for(j = 48; j < 64; j++) { + tmp = ROLS( j, a + F3(b, c, d) + x[R[j]] + K(j)) + e; + a = e; e = d; d = ROL(10, c); c = b; b = tmp; + tmp = ROLSS(j, aa + F1(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee; + aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp; + } + + for(j = 64; j < 80; j++) { + tmp = ROLS( j, a + F4(b, c, d) + x[R[j]] + K(j)) + e; + a = e; e = d; d = ROL(10, c); c = b; b = tmp; + tmp = ROLSS(j, aa + F0(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee; + aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp; + } + + tmp = state[1] + c + dd; + state[1] = state[2] + d + ee; + state[2] = state[3] + e + aa; + state[3] = state[4] + a + bb; + state[4] = state[0] + b + cc; + state[0] = tmp; + + tmp = 0; + memset(x, 0, sizeof(x)); +} + +/* + ripemd160 block update operation. Continues a ripemd160 message-digest + operation, processing another message block, and updating the + context. + */ +void hash_ripemd160::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_RIPEMD160_CTX * context = (PHP_RIPEMD160_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += + ((unsigned int) inputLen << 3)) < ((unsigned int) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((unsigned int) inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + RIPEMD160Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) { + RIPEMD160Transform(context->state, &input[i]); + } + + index = 0; + } else { + i = 0; + } + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +/* + * ripemd320 basic transformation. Transforms state based on block. + */ +static void RIPEMD320Transform(unsigned int state[10], + const unsigned char block[64]) { + unsigned int a = state[0], b = state[1], c = state[2], + d = state[3], e = state[4]; + unsigned int aa = state[5], bb = state[6], cc = state[7], + dd = state[8], ee = state[9]; + unsigned int tmp, x[16]; + int j; + + RIPEMDDecode(x, block, 64); + + for(j = 0; j < 16; j++) { + tmp = ROLS( j, a + F0(b, c, d) + x[R[j]] + K(j)) + e; + a = e; e = d; d = ROL(10, c); c = b; b = tmp; + tmp = ROLSS(j, aa + F4(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee; + aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp; + } + tmp = b; b = bb; bb = tmp; + + for(j = 16; j < 32; j++) { + tmp = ROLS( j, a + F1(b, c, d) + x[R[j]] + K(j)) + e; + a = e; e = d; d = ROL(10, c); c = b; b = tmp; + tmp = ROLSS(j, aa + F3(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee; + aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp; + } + tmp = d; d = dd; dd = tmp; + + for(j = 32; j < 48; j++) { + tmp = ROLS( j, a + F2(b, c, d) + x[R[j]] + K(j)) + e; + a = e; e = d; d = ROL(10, c); c = b; b = tmp; + tmp = ROLSS(j, aa + F2(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee; + aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp; + } + tmp = a; a = aa; aa = tmp; + + for(j = 48; j < 64; j++) { + tmp = ROLS( j, a + F3(b, c, d) + x[R[j]] + K(j)) + e; + a = e; e = d; d = ROL(10, c); c = b; b = tmp; + tmp = ROLSS(j, aa + F1(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee; + aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp; + } + tmp = c; c = cc; cc = tmp; + + for(j = 64; j < 80; j++) { + tmp = ROLS( j, a + F4(b, c, d) + x[R[j]] + K(j)) + e; + a = e; e = d; d = ROL(10, c); c = b; b = tmp; + tmp = ROLSS(j, aa + F0(bb, cc, dd) + x[RR[j]] + KK160(j)) + ee; + aa = ee; ee = dd; dd = ROL(10, cc); cc = bb; bb = tmp; + } + tmp = e; e = ee; ee = tmp; + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += aa; + state[6] += bb; + state[7] += cc; + state[8] += dd; + state[9] += ee; + + tmp = 0; + memset(x, 0, sizeof(x)); +} + +/* + ripemd320 block update operation. Continues a ripemd320 message-digest + operation, processing another message block, and updating the + context. + */ +void hash_ripemd320::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_RIPEMD320_CTX * context = (PHP_RIPEMD320_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += + ((unsigned int) inputLen << 3)) < ((unsigned int) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((unsigned int) inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + RIPEMD320Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) { + RIPEMD320Transform(context->state, &input[i]); + } + + index = 0; + } else { + i = 0; + } + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +static const unsigned char PADDING[64] = { + 0x80, 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 +}; + +/* + Encodes input (unsigned int) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void RIPEMDEncode(unsigned char *output, unsigned int *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff); + output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff); + output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff); + output[j + 0] = (unsigned char) (input[i] & 0xff); + } +} + +/* + ripemd128 finalization. Ends a ripemd128 message-digest operation, + writing the message digest and zeroizing the context. + */ +void hash_ripemd128::hash_final(unsigned char *digest, void *context_) { + PHP_RIPEMD128_CTX * context = (PHP_RIPEMD128_CTX*)context_; + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + bits[0] = (unsigned char) (context->count[0] & 0xFF); + bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF); + bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF); + bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF); + bits[4] = (unsigned char) (context->count[1] & 0xFF); + bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF); + bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF); + bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF); + + /* Pad out to 56 mod 64. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + hash_update(context, PADDING, padLen); + + /* Append length (before padding) */ + hash_update(context, bits, 8); + + /* Store state in digest */ + RIPEMDEncode(digest, context->state, 16); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/* + ripemd256 finalization. Ends a ripemd256 message-digest operation, + writing the message digest and zeroizing the context. + */ +void hash_ripemd256::hash_final(unsigned char *digest, void *context_) { + PHP_RIPEMD256_CTX * context = (PHP_RIPEMD256_CTX*)context_; + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + bits[0] = (unsigned char) (context->count[0] & 0xFF); + bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF); + bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF); + bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF); + bits[4] = (unsigned char) (context->count[1] & 0xFF); + bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF); + bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF); + bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF); + + /* Pad out to 56 mod 64. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + hash_update(context, PADDING, padLen); + + /* Append length (before padding) */ + hash_update(context, bits, 8); + + /* Store state in digest */ + RIPEMDEncode(digest, context->state, 32); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/* + ripemd160 finalization. Ends a ripemd160 message-digest operation, + writing the message digest and zeroizing the context. + */ +void hash_ripemd160::hash_final(unsigned char *digest, void *context_) { + PHP_RIPEMD160_CTX * context = (PHP_RIPEMD160_CTX*)context_; + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + bits[0] = (unsigned char) (context->count[0] & 0xFF); + bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF); + bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF); + bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF); + bits[4] = (unsigned char) (context->count[1] & 0xFF); + bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF); + bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF); + bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF); + + /* Pad out to 56 mod 64. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + hash_update(context, PADDING, padLen); + + /* Append length (before padding) */ + hash_update(context, bits, 8); + + /* Store state in digest */ + RIPEMDEncode(digest, context->state, 20); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/* + ripemd320 finalization. Ends a ripemd320 message-digest operation, + writing the message digest and zeroizing the context. + */ +void hash_ripemd320::hash_final(unsigned char *digest, void *context_) { + PHP_RIPEMD320_CTX * context = (PHP_RIPEMD320_CTX*)context_; + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + bits[0] = (unsigned char) (context->count[0] & 0xFF); + bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF); + bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF); + bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF); + bits[4] = (unsigned char) (context->count[1] & 0xFF); + bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF); + bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF); + bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF); + + /* Pad out to 56 mod 64. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + hash_update(context, PADDING, padLen); + + /* Append length (before padding) */ + hash_update(context, bits, 8); + + /* Store state in digest */ + RIPEMDEncode(digest, context->state, 40); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_ripemd.h b/src/cpp/ext/hash/hash_ripemd.h new file mode 100644 index 0000000000000..54a8a02c24e19 --- /dev/null +++ b/src/cpp/ext/hash/hash_ripemd.h @@ -0,0 +1,69 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_RIPEMD_H__ +#define __EXT_HASH_RIPEMD_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_ripemd128 : public HashEngine { +public: + hash_ripemd128(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +class hash_ripemd160 : public HashEngine { +public: + hash_ripemd160(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +class hash_ripemd256 : public HashEngine { +public: + hash_ripemd256(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +class hash_ripemd320 : public HashEngine { +public: + hash_ripemd320(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_RIPEMD_H__ diff --git a/src/cpp/ext/hash/hash_salsa.cpp b/src/cpp/ext/hash/hash_salsa.cpp new file mode 100644 index 0000000000000..026c80cd85bbd --- /dev/null +++ b/src/cpp/ext/hash/hash_salsa.cpp @@ -0,0 +1,200 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state[16]; + unsigned char init:1; + unsigned char length:7; + unsigned char buffer[64]; + void (*Transform)(unsigned int state[16], unsigned int data[16]); +} PHP_SALSA_CTX; + +hash_salsa::hash_salsa(bool salsa10) + : HashEngine(64, 64, sizeof(PHP_SALSA_CTX)), m_salsa10(salsa10) { +} + +#define R(a,b) (((a) << (b)) | ((a) >> (32 - (b)))) + +/* + The 64-byte input x to Salsa10 is viewed in little-endian form as 16 integers + x0, x1, x2, ..., x15 in {0,1,...,2^32-1}. These 16 integers are fed through + 320 invertible modifications, where each modification changes one integer. + The modifications involve, overall, + + * 10 additions of constants modulo 2^32; + * 320 more additions modulo 2^32; + * 80 ``or'' operations; + * 240 ``xor'' operations; and + * 320 constant-distance rotations. + + The resulting 16 integers are added to the original x0, x1, x2, ..., x15 + respectively modulo 2^32, producing, in little-endian form, the 64-byte output + Salsa10(x). + + D.J.Bernstein +*/ +static void Salsa10(unsigned int x[16], unsigned int in[16]) { + int i; + + for (i = 10; i > 0; --i) { + x[ 4] ^= R(x[ 0]+x[12], 6); x[ 8] ^= R(x[ 4]+x[ 0],17); + x[12] += R(x[ 8]|x[ 4],16); x[ 0] += R(x[12]^x[ 8], 5); + x[ 9] += R(x[ 5]|x[ 1], 8); x[13] += R(x[ 9]|x[ 5], 7); + x[ 1] ^= R(x[13]+x[ 9],17); x[ 5] += R(x[ 1]^x[13],12); + x[14] ^= R(x[10]+x[ 6], 7); x[ 2] += R(x[14]^x[10],15); + x[ 6] ^= R(x[ 2]+x[14],13); x[10] ^= R(x[ 6]+x[ 2],15); + x[ 3] += R(x[15]|x[11],20); x[ 7] ^= R(x[ 3]+x[15],16); + x[11] += R(x[ 7]^x[ 3], 7); x[15] += R(x[11]^x[ 7], 8); + x[ 1] += R(x[ 0]|x[ 3], 8)^i;x[ 2] ^= R(x[ 1]+x[ 0],14); + x[ 3] ^= R(x[ 2]+x[ 1], 6); x[ 0] += R(x[ 3]^x[ 2],18); + x[ 6] += R(x[ 5]^x[ 4], 8); x[ 7] += R(x[ 6]^x[ 5],12); + x[ 4] += R(x[ 7]|x[ 6],13); x[ 5] ^= R(x[ 4]+x[ 7],15); + x[11] ^= R(x[10]+x[ 9],18); x[ 8] += R(x[11]^x[10],11); + x[ 9] ^= R(x[ 8]+x[11], 8); x[10] += R(x[ 9]|x[ 8], 6); + x[12] += R(x[15]^x[14],17); x[13] ^= R(x[12]+x[15],15); + x[14] += R(x[13]|x[12], 9); x[15] += R(x[14]^x[13], 7); + } + for (i = 0; i < 16; ++i) { + x[i] += in[i]; + } +} + +/* + The 64-byte input x to Salsa20 is viewed in little-endian form as 16 words + x0, x1, x2, ..., x15 in {0,1,...,2^32-1}. These 16 words are fed through 320 + invertible modifications, where each modification changes one word. The + resulting 16 words are added to the original x0, x1, x2, ..., x15 respectively + modulo 2^32, producing, in little-endian form, the 64-byte output Salsa20(x). + + Each modification involves xor'ing into one word a rotated version of the sum + of two other words modulo 2^32. Thus the 320 modifications involve, overall, + 320 additions, 320 xor's, and 320 rotations. The rotations are all by constant + distances. + + The entire series of modifications is a series of 10 identical double-rounds. + Each double-round is a series of 2 rounds. Each round is a set of 4 parallel + quarter-rounds. Each quarter-round modifies 4 words. + + D.J.Bernstein +*/ +static void Salsa20(unsigned int x[16], unsigned int in[16]) { + int i; + + for (i = 20; i > 0; i -= 2) { + x[ 4] ^= R(x[ 0]+x[12], 7); x[ 8] ^= R(x[ 4]+x[ 0], 9); + x[12] ^= R(x[ 8]+x[ 4],13); x[ 0] ^= R(x[12]+x[ 8],18); + x[ 9] ^= R(x[ 5]+x[ 1], 7); x[13] ^= R(x[ 9]+x[ 5], 9); + x[ 1] ^= R(x[13]+x[ 9],13); x[ 5] ^= R(x[ 1]+x[13],18); + x[14] ^= R(x[10]+x[ 6], 7); x[ 2] ^= R(x[14]+x[10], 9); + x[ 6] ^= R(x[ 2]+x[14],13); x[10] ^= R(x[ 6]+x[ 2],18); + x[ 3] ^= R(x[15]+x[11], 7); x[ 7] ^= R(x[ 3]+x[15], 9); + x[11] ^= R(x[ 7]+x[ 3],13); x[15] ^= R(x[11]+x[ 7],18); + x[ 1] ^= R(x[ 0]+x[ 3], 7); x[ 2] ^= R(x[ 1]+x[ 0], 9); + x[ 3] ^= R(x[ 2]+x[ 1],13); x[ 0] ^= R(x[ 3]+x[ 2],18); + x[ 6] ^= R(x[ 5]+x[ 4], 7); x[ 7] ^= R(x[ 6]+x[ 5], 9); + x[ 4] ^= R(x[ 7]+x[ 6],13); x[ 5] ^= R(x[ 4]+x[ 7],18); + x[11] ^= R(x[10]+x[ 9], 7); x[ 8] ^= R(x[11]+x[10], 9); + x[ 9] ^= R(x[ 8]+x[11],13); x[10] ^= R(x[ 9]+x[ 8],18); + x[12] ^= R(x[15]+x[14], 7); x[13] ^= R(x[12]+x[15], 9); + x[14] ^= R(x[13]+x[12],13); x[15] ^= R(x[14]+x[13],18); + } + for (i = 0; i < 16; ++i) { + x[i] += in[i]; + } +} + +static inline void SalsaTransform(PHP_SALSA_CTX *context, + const unsigned char input[64]) { + unsigned int i, j, a[16]; + +#if 0 + fprintf(stderr, "> INPUT: %.*s\n", 64, input); +#endif + + for (i = 0, j = 0; j < 64; i++, j += 4) { + a[i] = ((unsigned int) input[j + 3]) | + (((unsigned int) input[j + 2]) << 8) | + (((unsigned int) input[j + 1]) << 16) | + (((unsigned int) input[j]) << 24); + } + + if (!context->init) { + memcpy(context->state, a, sizeof(a)); + context->init = 1; + } + + context->Transform(context->state, a); + memset(a, 0, sizeof(a)); +} + +void hash_salsa::hash_init(void *context_) { + PHP_SALSA_CTX *context = (PHP_SALSA_CTX*)context_; + memset(context, 0, sizeof(*context)); + context->Transform = m_salsa10 ? Salsa10 : Salsa20; +} + +void hash_salsa::hash_update(void *context_, const unsigned char *input, + unsigned int len) { + PHP_SALSA_CTX *context = (PHP_SALSA_CTX*)context_; + if (context->length + len < 64) { + memcpy(&context->buffer[context->length], input, len); + context->length += len; + } else { + size_t i = 0, r = (context->length + len) % 64; + + if (context->length) { + i = 64 - context->length; + memcpy(&context->buffer[context->length], input, i); + SalsaTransform(context, context->buffer); + memset(context->buffer, 0, 64); + } + + for (; i + 64 <= len; i += 64) { + SalsaTransform(context, input + i); + } + + memcpy(context->buffer, input + i, r); + context->length = r; + } + +} + +void hash_salsa::hash_final(unsigned char *digest, void *context_) { + PHP_SALSA_CTX *context = (PHP_SALSA_CTX*)context_; + unsigned int i, j; + + if (context->length) { + SalsaTransform(context, context->buffer); + } + + for (i = 0, j = 0; j < 64; i++, j += 4) { + digest[j] = (unsigned char) ((context->state[i] >> 24) & 0xff); + digest[j + 1] = (unsigned char) ((context->state[i] >> 16) & 0xff); + digest[j + 2] = (unsigned char) ((context->state[i] >> 8) & 0xff); + digest[j + 3] = (unsigned char) (context->state[i] & 0xff); + } + + memset(context, 0, sizeof(*context)); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_salsa.h b/src/cpp/ext/hash/hash_salsa.h new file mode 100644 index 0000000000000..2b5e75eb1e232 --- /dev/null +++ b/src/cpp/ext/hash/hash_salsa.h @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_SALSA_H__ +#define __EXT_HASH_SALSA_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_salsa : public HashEngine { +public: + hash_salsa(bool salsa10); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); + +private: + bool m_salsa10; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_SALSA_H__ diff --git a/src/cpp/ext/hash/hash_sha.cpp b/src/cpp/ext/hash/hash_sha.cpp new file mode 100644 index 0000000000000..ddd90de673e66 --- /dev/null +++ b/src/cpp/ext/hash/hash_sha.cpp @@ -0,0 +1,841 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state[5]; /* state (ABCD) */ + unsigned int count[2]; /* number of bits, modulo 2^64 */ + unsigned char buffer[64]; /* input buffer */ +} PHP_SHA1_CTX; + +hash_sha1::hash_sha1() : HashEngine(20, 64, sizeof(PHP_SHA1_CTX)) { +} + +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state[8]; /* state */ + unsigned int count[2]; /* number of bits, modulo 2^64 */ + unsigned char buffer[64]; /* input buffer */ +} PHP_SHA256_CTX; + +hash_sha256::hash_sha256() : HashEngine(32, 64, sizeof(PHP_SHA256_CTX)) { +} + +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned long state[8]; /* state */ + unsigned long count[2]; /* number of bits, modulo 2^128 */ + unsigned char buffer[128]; /* input buffer */ +} PHP_SHA384_CTX; + +hash_sha384::hash_sha384() : HashEngine(48, 128, sizeof(PHP_SHA384_CTX)) { +} + +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned long state[8]; /* state */ + unsigned long count[2]; /* number of bits, modulo 2^128 */ + unsigned char buffer[128]; /* input buffer */ +} PHP_SHA512_CTX; + +hash_sha512::hash_sha512() : HashEngine(64, 128, sizeof(PHP_SHA512_CTX)) { +} + +/////////////////////////////////////////////////////////////////////////////// + +static const unsigned char PADDING[128] = { + 0x80, 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 +}; + +/* + Encodes input (unsigned int) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void SHAEncode32(unsigned char *output, unsigned int *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char) ((input[i] >> 24) & 0xff); + output[j + 1] = (unsigned char) ((input[i] >> 16) & 0xff); + output[j + 2] = (unsigned char) ((input[i] >> 8) & 0xff); + output[j + 3] = (unsigned char) (input[i] & 0xff); + } +} + +/* + Decodes input (unsigned char) into output (unsigned int). Assumes len is + a multiple of 4. +*/ +static void SHADecode32(unsigned int *output, const unsigned char *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((unsigned int) input[j + 3]) | + (((unsigned int) input[j + 2]) << 8) | + (((unsigned int) input[j + 1]) << 16) | + (((unsigned int) input[j]) << 24); +} + +/* F, G, H and I are basic SHA1 functions. + */ +#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define G(x, y, z) ((x) ^ (y) ^ (z)) +#define H(x, y, z) (((x) & (y)) | ((z) & ((x) | (y)))) +#define I(x, y, z) ((x) ^ (y) ^ (z)) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* W[i] + */ +#define W(i) ( tmp=x[(i-3)&15]^x[(i-8)&15]^x[(i-14)&15]^x[i&15], \ + (x[i&15]=ROTATE_LEFT(tmp, 1)) ) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. + */ +#define FF(a, b, c, d, e, w) { \ + (e) += F ((b), (c), (d)) + (w) + (unsigned int)(0x5A827999); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } +#define GG(a, b, c, d, e, w) { \ + (e) += G ((b), (c), (d)) + (w) + (unsigned int)(0x6ED9EBA1); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } +#define HH(a, b, c, d, e, w) { \ + (e) += H ((b), (c), (d)) + (w) + (unsigned int)(0x8F1BBCDC); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } +#define II(a, b, c, d, e, w) { \ + (e) += I ((b), (c), (d)) + (w) + (unsigned int)(0xCA62C1D6); \ + (e) += ROTATE_LEFT ((a), 5); \ + (b) = ROTATE_LEFT((b), 30); \ + } + +/* + * SHA1 initialization. Begins an SHA1 operation, writing a new context. + */ +void hash_sha1::hash_init(void *context_) { + PHP_SHA1_CTX * context = (PHP_SHA1_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; + context->state[4] = 0xc3d2e1f0; +} + +/* + * SHA1 basic transformation. Transforms state based on block. + */ +static void SHA1Transform(unsigned int state[5], + const unsigned char block[64]) { + unsigned int a = state[0], b = state[1], c = state[2]; + unsigned int d = state[3], e = state[4], x[16], tmp; + + SHADecode32(x, block, 64); + + /* Round 1 */ + FF(a, b, c, d, e, x[0]); /* 1 */ + FF(e, a, b, c, d, x[1]); /* 2 */ + FF(d, e, a, b, c, x[2]); /* 3 */ + FF(c, d, e, a, b, x[3]); /* 4 */ + FF(b, c, d, e, a, x[4]); /* 5 */ + FF(a, b, c, d, e, x[5]); /* 6 */ + FF(e, a, b, c, d, x[6]); /* 7 */ + FF(d, e, a, b, c, x[7]); /* 8 */ + FF(c, d, e, a, b, x[8]); /* 9 */ + FF(b, c, d, e, a, x[9]); /* 10 */ + FF(a, b, c, d, e, x[10]); /* 11 */ + FF(e, a, b, c, d, x[11]); /* 12 */ + FF(d, e, a, b, c, x[12]); /* 13 */ + FF(c, d, e, a, b, x[13]); /* 14 */ + FF(b, c, d, e, a, x[14]); /* 15 */ + FF(a, b, c, d, e, x[15]); /* 16 */ + FF(e, a, b, c, d, W(16)); /* 17 */ + FF(d, e, a, b, c, W(17)); /* 18 */ + FF(c, d, e, a, b, W(18)); /* 19 */ + FF(b, c, d, e, a, W(19)); /* 20 */ + + /* Round 2 */ + GG(a, b, c, d, e, W(20)); /* 21 */ + GG(e, a, b, c, d, W(21)); /* 22 */ + GG(d, e, a, b, c, W(22)); /* 23 */ + GG(c, d, e, a, b, W(23)); /* 24 */ + GG(b, c, d, e, a, W(24)); /* 25 */ + GG(a, b, c, d, e, W(25)); /* 26 */ + GG(e, a, b, c, d, W(26)); /* 27 */ + GG(d, e, a, b, c, W(27)); /* 28 */ + GG(c, d, e, a, b, W(28)); /* 29 */ + GG(b, c, d, e, a, W(29)); /* 30 */ + GG(a, b, c, d, e, W(30)); /* 31 */ + GG(e, a, b, c, d, W(31)); /* 32 */ + GG(d, e, a, b, c, W(32)); /* 33 */ + GG(c, d, e, a, b, W(33)); /* 34 */ + GG(b, c, d, e, a, W(34)); /* 35 */ + GG(a, b, c, d, e, W(35)); /* 36 */ + GG(e, a, b, c, d, W(36)); /* 37 */ + GG(d, e, a, b, c, W(37)); /* 38 */ + GG(c, d, e, a, b, W(38)); /* 39 */ + GG(b, c, d, e, a, W(39)); /* 40 */ + + /* Round 3 */ + HH(a, b, c, d, e, W(40)); /* 41 */ + HH(e, a, b, c, d, W(41)); /* 42 */ + HH(d, e, a, b, c, W(42)); /* 43 */ + HH(c, d, e, a, b, W(43)); /* 44 */ + HH(b, c, d, e, a, W(44)); /* 45 */ + HH(a, b, c, d, e, W(45)); /* 46 */ + HH(e, a, b, c, d, W(46)); /* 47 */ + HH(d, e, a, b, c, W(47)); /* 48 */ + HH(c, d, e, a, b, W(48)); /* 49 */ + HH(b, c, d, e, a, W(49)); /* 50 */ + HH(a, b, c, d, e, W(50)); /* 51 */ + HH(e, a, b, c, d, W(51)); /* 52 */ + HH(d, e, a, b, c, W(52)); /* 53 */ + HH(c, d, e, a, b, W(53)); /* 54 */ + HH(b, c, d, e, a, W(54)); /* 55 */ + HH(a, b, c, d, e, W(55)); /* 56 */ + HH(e, a, b, c, d, W(56)); /* 57 */ + HH(d, e, a, b, c, W(57)); /* 58 */ + HH(c, d, e, a, b, W(58)); /* 59 */ + HH(b, c, d, e, a, W(59)); /* 60 */ + + /* Round 4 */ + II(a, b, c, d, e, W(60)); /* 61 */ + II(e, a, b, c, d, W(61)); /* 62 */ + II(d, e, a, b, c, W(62)); /* 63 */ + II(c, d, e, a, b, W(63)); /* 64 */ + II(b, c, d, e, a, W(64)); /* 65 */ + II(a, b, c, d, e, W(65)); /* 66 */ + II(e, a, b, c, d, W(66)); /* 67 */ + II(d, e, a, b, c, W(67)); /* 68 */ + II(c, d, e, a, b, W(68)); /* 69 */ + II(b, c, d, e, a, W(69)); /* 70 */ + II(a, b, c, d, e, W(70)); /* 71 */ + II(e, a, b, c, d, W(71)); /* 72 */ + II(d, e, a, b, c, W(72)); /* 73 */ + II(c, d, e, a, b, W(73)); /* 74 */ + II(b, c, d, e, a, W(74)); /* 75 */ + II(a, b, c, d, e, W(75)); /* 76 */ + II(e, a, b, c, d, W(76)); /* 77 */ + II(d, e, a, b, c, W(77)); /* 78 */ + II(c, d, e, a, b, W(78)); /* 79 */ + II(b, c, d, e, a, W(79)); /* 80 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + + /* Zeroize sensitive information. */ + memset((unsigned char*) x, 0, sizeof(x)); +} + +/* + SHA1 block update operation. Continues an SHA1 message-digest + operation, processing another message block, and updating the + context. + */ +void hash_sha1::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_SHA1_CTX *context = (PHP_SHA1_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((unsigned int) inputLen << 3)) + < ((unsigned int) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((unsigned int) inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], (unsigned char*) input, + partLen); + SHA1Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + SHA1Transform(context->state, &input[i]); + + index = 0; + } else + i = 0; + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +/* + SHA1 finalization. Ends an SHA1 message-digest operation, writing the + the message digest and zeroizing the context. +*/ +void hash_sha1::hash_final(unsigned char *digest, void *context_) { + PHP_SHA1_CTX *context = (PHP_SHA1_CTX*)context_; + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + bits[7] = context->count[0] & 0xFF; + bits[6] = (context->count[0] >> 8) & 0xFF; + bits[5] = (context->count[0] >> 16) & 0xFF; + bits[4] = (context->count[0] >> 24) & 0xFF; + bits[3] = context->count[1] & 0xFF; + bits[2] = (context->count[1] >> 8) & 0xFF; + bits[1] = (context->count[1] >> 16) & 0xFF; + bits[0] = (context->count[1] >> 24) & 0xFF; + + /* Pad out to 56 mod 64. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + hash_update(context, PADDING, padLen); + + /* Append length (before padding) */ + hash_update(context, bits, 8); + + /* Store state in digest */ + SHAEncode32(digest, context->state, 20); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/////////////////////////////////////////////////////////////////////////////// + +#define ROTR32(b,x) ((x >> b) | (x << (32 - b))) +#define ROTR64(b,x) ((x >> b) | (x << (64 - b))) +#define SHR(b, x) (x >> b) + +/* Ch */ +#define SHA256_F0(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) +/* Maj */ +#define SHA256_F1(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) +/* SUM0 */ +#define SHA256_F2(x) (ROTR32( 2,(x)) ^ ROTR32(13,(x)) ^ ROTR32(22,(x))) +/* SUM1 */ +#define SHA256_F3(x) (ROTR32( 6,(x)) ^ ROTR32(11,(x)) ^ ROTR32(25,(x))) +/* OM0 */ +#define SHA256_F4(x) (ROTR32( 7,(x)) ^ ROTR32(18,(x)) ^ SHR( 3,(x))) +/* OM1 */ +#define SHA256_F5(x) (ROTR32(17,(x)) ^ ROTR32(19,(x)) ^ SHR(10,(x))) + +static const unsigned int SHA256_K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 }; + +/* + * SHA256 initialization. Begins an SHA256 operation, writing a new context. + */ +void hash_sha256::hash_init(void *context_) { + PHP_SHA256_CTX *context = (PHP_SHA256_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = 0x6a09e667; + context->state[1] = 0xbb67ae85; + context->state[2] = 0x3c6ef372; + context->state[3] = 0xa54ff53a; + context->state[4] = 0x510e527f; + context->state[5] = 0x9b05688c; + context->state[6] = 0x1f83d9ab; + context->state[7] = 0x5be0cd19; +} + +/* + * SHA256 basic transformation. Transforms state based on block. + */ +static void SHA256Transform(unsigned int state[8], + const unsigned char block[64]) { + unsigned int a = state[0], b = state[1], c = state[2], d = state[3]; + unsigned int e = state[4], f = state[5], g = state[6], h = state[7]; + unsigned int x[16], T1, T2, W[64]; + int i; + + SHADecode32(x, block, 64); + + /* Schedule */ + for(i = 0; i < 16; i++) { + W[i] = x[i]; + } + for(i = 16; i < 64; i++) { + W[i] = SHA256_F5(W[i-2]) + W[i-7] + SHA256_F4(W[i-15]) + W[i-16]; + } + + for (i = 0; i < 64; i++) { + T1 = h + SHA256_F3(e) + SHA256_F0(e,f,g) + SHA256_K[i] + W[i]; + T2 = SHA256_F2(a) + SHA256_F1(a,b,c); + h = g; g = f; f = e; e = d + T1; + d = c; c = b; b = a; a = T1 + T2; + } + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += f; + state[6] += g; + state[7] += h; + + /* Zeroize sensitive information. */ + memset((unsigned char*) x, 0, sizeof(x)); +} + +/* + SHA256 block update operation. Continues an SHA256 message-digest + operation, processing another message block, and updating the + context. +*/ +void hash_sha256::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_SHA256_CTX *context = (PHP_SHA256_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += + ((unsigned int) inputLen << 3)) < ((unsigned int) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((unsigned int) inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + SHA256Transform(context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) { + SHA256Transform(context->state, &input[i]); + } + + index = 0; + } else { + i = 0; + } + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +/* + SHA256 finalization. Ends an SHA256 message-digest operation, writing the + the message digest and zeroizing the context. +*/ +void hash_sha256::hash_final(unsigned char *digest, void *context_) { + PHP_SHA256_CTX *context = (PHP_SHA256_CTX*)context_; + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + bits[7] = (unsigned char) (context->count[0] & 0xFF); + bits[6] = (unsigned char) ((context->count[0] >> 8) & 0xFF); + bits[5] = (unsigned char) ((context->count[0] >> 16) & 0xFF); + bits[4] = (unsigned char) ((context->count[0] >> 24) & 0xFF); + bits[3] = (unsigned char) (context->count[1] & 0xFF); + bits[2] = (unsigned char) ((context->count[1] >> 8) & 0xFF); + bits[1] = (unsigned char) ((context->count[1] >> 16) & 0xFF); + bits[0] = (unsigned char) ((context->count[1] >> 24) & 0xFF); + + /* Pad out to 56 mod 64. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + hash_update(context, PADDING, padLen); + + /* Append length (before padding) */ + hash_update(context, bits, 8); + + /* Store state in digest */ + SHAEncode32(digest, context->state, 32); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/////////////////////////////////////////////////////////////////////////////// +/* sha384/sha512 */ + +/* Ch */ +#define SHA512_F0(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) +/* Maj */ +#define SHA512_F1(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) +/* SUM0 */ +#define SHA512_F2(x) (ROTR64(28, x) ^ ROTR64(34, x) ^ ROTR64(39, x)) +/* SUM1 */ +#define SHA512_F3(x) (ROTR64(14, x) ^ ROTR64(18, x) ^ ROTR64(41, x)) +/* OM0 */ +#define SHA512_F4(x) (ROTR64( 1, x) ^ ROTR64( 8, x) ^ SHR(7, x)) +/* OM1 */ +#define SHA512_F5(x) (ROTR64(19, x) ^ ROTR64(61, x) ^ SHR(6, x)) + +static const unsigned long SHA512_K[128] = { + L64(0x428a2f98d728ae22), L64(0x7137449123ef65cd), L64(0xb5c0fbcfec4d3b2f), L64(0xe9b5dba58189dbbc), + L64(0x3956c25bf348b538), L64(0x59f111f1b605d019), L64(0x923f82a4af194f9b), L64(0xab1c5ed5da6d8118), + L64(0xd807aa98a3030242), L64(0x12835b0145706fbe), L64(0x243185be4ee4b28c), L64(0x550c7dc3d5ffb4e2), + L64(0x72be5d74f27b896f), L64(0x80deb1fe3b1696b1), L64(0x9bdc06a725c71235), L64(0xc19bf174cf692694), + L64(0xe49b69c19ef14ad2), L64(0xefbe4786384f25e3), L64(0x0fc19dc68b8cd5b5), L64(0x240ca1cc77ac9c65), + L64(0x2de92c6f592b0275), L64(0x4a7484aa6ea6e483), L64(0x5cb0a9dcbd41fbd4), L64(0x76f988da831153b5), + L64(0x983e5152ee66dfab), L64(0xa831c66d2db43210), L64(0xb00327c898fb213f), L64(0xbf597fc7beef0ee4), + L64(0xc6e00bf33da88fc2), L64(0xd5a79147930aa725), L64(0x06ca6351e003826f), L64(0x142929670a0e6e70), + L64(0x27b70a8546d22ffc), L64(0x2e1b21385c26c926), L64(0x4d2c6dfc5ac42aed), L64(0x53380d139d95b3df), + L64(0x650a73548baf63de), L64(0x766a0abb3c77b2a8), L64(0x81c2c92e47edaee6), L64(0x92722c851482353b), + L64(0xa2bfe8a14cf10364), L64(0xa81a664bbc423001), L64(0xc24b8b70d0f89791), L64(0xc76c51a30654be30), + L64(0xd192e819d6ef5218), L64(0xd69906245565a910), L64(0xf40e35855771202a), L64(0x106aa07032bbd1b8), + L64(0x19a4c116b8d2d0c8), L64(0x1e376c085141ab53), L64(0x2748774cdf8eeb99), L64(0x34b0bcb5e19b48a8), + L64(0x391c0cb3c5c95a63), L64(0x4ed8aa4ae3418acb), L64(0x5b9cca4f7763e373), L64(0x682e6ff3d6b2b8a3), + L64(0x748f82ee5defb2fc), L64(0x78a5636f43172f60), L64(0x84c87814a1f0ab72), L64(0x8cc702081a6439ec), + L64(0x90befffa23631e28), L64(0xa4506cebde82bde9), L64(0xbef9a3f7b2c67915), L64(0xc67178f2e372532b), + L64(0xca273eceea26619c), L64(0xd186b8c721c0c207), L64(0xeada7dd6cde0eb1e), L64(0xf57d4f7fee6ed178), + L64(0x06f067aa72176fba), L64(0x0a637dc5a2c898a6), L64(0x113f9804bef90dae), L64(0x1b710b35131c471b), + L64(0x28db77f523047d84), L64(0x32caab7b40c72493), L64(0x3c9ebe0a15c9bebc), L64(0x431d67c49c100d4c), + L64(0x4cc5d4becb3e42b6), L64(0x597f299cfc657e2a), L64(0x5fcb6fab3ad6faec), L64(0x6c44198c4a475817) }; + +/* + Encodes input (unsigned long) into output (unsigned char). Assumes len is + a multiple of 8. +*/ +static void SHAEncode64(unsigned char *output, unsigned long *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 8) { + output[j] = (unsigned char) ((input[i] >> 56) & 0xff); + output[j + 1] = (unsigned char) ((input[i] >> 48) & 0xff); + output[j + 2] = (unsigned char) ((input[i] >> 40) & 0xff); + output[j + 3] = (unsigned char) ((input[i] >> 32) & 0xff); + output[j + 4] = (unsigned char) ((input[i] >> 24) & 0xff); + output[j + 5] = (unsigned char) ((input[i] >> 16) & 0xff); + output[j + 6] = (unsigned char) ((input[i] >> 8) & 0xff); + output[j + 7] = (unsigned char) (input[i] & 0xff); + } +} + +/* + Decodes input (unsigned char) into output (unsigned long). Assumes len is + a multiple of 8. +*/ +static void SHADecode64(unsigned long *output, const unsigned char *input, + unsigned int len) { + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 8) + output[i] = + ((unsigned long) input[j + 7]) | + (((unsigned long) input[j + 6]) << 8) | + (((unsigned long) input[j + 5]) << 16) | + (((unsigned long) input[j + 4]) << 24) | + (((unsigned long) input[j + 3]) << 32) | + (((unsigned long) input[j + 2]) << 40) | + (((unsigned long) input[j + 1]) << 48) | + (((unsigned long) input[j]) << 56); +} + +/* + * SHA384 initialization. Begins an SHA384 operation, writing a new context. + */ +void hash_sha384::hash_init(void *context_) { + PHP_SHA384_CTX * context = (PHP_SHA384_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = L64(0xcbbb9d5dc1059ed8); + context->state[1] = L64(0x629a292a367cd507); + context->state[2] = L64(0x9159015a3070dd17); + context->state[3] = L64(0x152fecd8f70e5939); + context->state[4] = L64(0x67332667ffc00b31); + context->state[5] = L64(0x8eb44a8768581511); + context->state[6] = L64(0xdb0c2e0d64f98fa7); + context->state[7] = L64(0x47b5481dbefa4fa4); +} + +/* + * SHA512 basic transformation. Transforms state based on block. + * SHA384 uses the exact same algorithm + */ +static void SHA512Transform(unsigned long state[8], + const unsigned char block[128]) { + unsigned long a = state[0], b = state[1], c = state[2], d = state[3]; + unsigned long e = state[4], f = state[5], g = state[6], h = state[7]; + unsigned long x[16], T1, T2, W[80]; + int i; + + SHADecode64(x, block, 128); + + /* Schedule */ + for(i = 0; i < 16; i++) { + W[i] = x[i]; + } + for(i = 16; i < 80; i++) { + W[i] = SHA512_F5(W[i-2]) + W[i-7] + SHA512_F4(W[i-15]) + W[i-16]; + } + + for (i = 0; i < 80; i++) { + T1 = h + SHA512_F3(e) + SHA512_F0(e,f,g) + SHA512_K[i] + W[i]; + T2 = SHA512_F2(a) + SHA512_F1(a,b,c); + h = g; g = f; f = e; e = d + T1; + d = c; c = b; b = a; a = T1 + T2; + } + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += f; + state[6] += g; + state[7] += h; + + /* Zeroize sensitive information. */ + memset((unsigned char*) x, 0, sizeof(x)); +} + +/* + SHA384 block update operation. Continues an SHA384 message-digest + operation, processing another message block, and updating the + context. + */ +void hash_sha384::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_SHA384_CTX * context = (PHP_SHA384_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 128 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x7F); + + /* Update number of bits */ + if ((context->count[0] += + ((unsigned long) inputLen << 3)) < ((unsigned long) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((unsigned long) inputLen >> 61); + + partLen = 128 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + SHA512Transform(context->state, context->buffer); + + for (i = partLen; i + 127 < inputLen; i += 128) { + SHA512Transform(context->state, &input[i]); + } + + index = 0; + } else { + i = 0; + } + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +/* + SHA384 finalization. Ends an SHA384 message-digest operation, writing the + the message digest and zeroizing the context. +*/ +void hash_sha384::hash_final(unsigned char *digest, void *context_) { + PHP_SHA384_CTX * context = (PHP_SHA384_CTX*)context_; + unsigned char bits[16]; + unsigned int index, padLen; + + /* Save number of bits */ + bits[15] = (unsigned char) (context->count[0] & 0xFF); + bits[14] = (unsigned char) ((context->count[0] >> 8) & 0xFF); + bits[13] = (unsigned char) ((context->count[0] >> 16) & 0xFF); + bits[12] = (unsigned char) ((context->count[0] >> 24) & 0xFF); + bits[11] = (unsigned char) ((context->count[0] >> 32) & 0xFF); + bits[10] = (unsigned char) ((context->count[0] >> 40) & 0xFF); + bits[9] = (unsigned char) ((context->count[0] >> 48) & 0xFF); + bits[8] = (unsigned char) ((context->count[0] >> 56) & 0xFF); + bits[7] = (unsigned char) (context->count[1] & 0xFF); + bits[6] = (unsigned char) ((context->count[1] >> 8) & 0xFF); + bits[5] = (unsigned char) ((context->count[1] >> 16) & 0xFF); + bits[4] = (unsigned char) ((context->count[1] >> 24) & 0xFF); + bits[3] = (unsigned char) ((context->count[1] >> 32) & 0xFF); + bits[2] = (unsigned char) ((context->count[1] >> 40) & 0xFF); + bits[1] = (unsigned char) ((context->count[1] >> 48) & 0xFF); + bits[0] = (unsigned char) ((context->count[1] >> 56) & 0xFF); + + /* Pad out to 112 mod 128. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x7f); + padLen = (index < 112) ? (112 - index) : (240 - index); + hash_update(context, PADDING, padLen); + + /* Append length (before padding) */ + hash_update(context, bits, 16); + + /* Store state in digest */ + SHAEncode64(digest, context->state, 48); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +void hash_sha512::hash_init(void *context_) { + PHP_SHA512_CTX * context = (PHP_SHA512_CTX*)context_; + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. + */ + context->state[0] = L64(0x6a09e667f3bcc908); + context->state[1] = L64(0xbb67ae8584caa73b); + context->state[2] = L64(0x3c6ef372fe94f82b); + context->state[3] = L64(0xa54ff53a5f1d36f1); + context->state[4] = L64(0x510e527fade682d1); + context->state[5] = L64(0x9b05688c2b3e6c1f); + context->state[6] = L64(0x1f83d9abfb41bd6b); + context->state[7] = L64(0x5be0cd19137e2179); +} + +/* + SHA512 block update operation. Continues an SHA512 message-digest + operation, processing another message block, and updating the + context. + */ +void hash_sha512::hash_update(void *context_, const unsigned char *input, + unsigned int inputLen) { + PHP_SHA512_CTX * context = (PHP_SHA512_CTX*)context_; + unsigned int i, index, partLen; + + /* Compute number of bytes mod 128 */ + index = (unsigned int) ((context->count[0] >> 3) & 0x7F); + + /* Update number of bits */ + if ((context->count[0] += + ((unsigned long) inputLen << 3)) < ((unsigned long) inputLen << 3)) { + context->count[1]++; + } + context->count[1] += ((unsigned long) inputLen >> 61); + + partLen = 128 - index; + + /* Transform as many times as possible. + */ + if (inputLen >= partLen) { + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) input, partLen); + SHA512Transform(context->state, context->buffer); + + for (i = partLen; i + 127 < inputLen; i += 128) { + SHA512Transform(context->state, &input[i]); + } + + index = 0; + } else { + i = 0; + } + + /* Buffer remaining input */ + memcpy((unsigned char*) & context->buffer[index], + (unsigned char*) & input[i], inputLen - i); +} + +/* + SHA512 finalization. Ends an SHA384 message-digest operation, writing the + the message digest and zeroizing the context. + */ +void hash_sha512::hash_final(unsigned char *digest, void *context_) { + PHP_SHA512_CTX * context = (PHP_SHA512_CTX*)context_; + unsigned char bits[16]; + unsigned int index, padLen; + + /* Save number of bits */ + bits[15] = (unsigned char) (context->count[0] & 0xFF); + bits[14] = (unsigned char) ((context->count[0] >> 8) & 0xFF); + bits[13] = (unsigned char) ((context->count[0] >> 16) & 0xFF); + bits[12] = (unsigned char) ((context->count[0] >> 24) & 0xFF); + bits[11] = (unsigned char) ((context->count[0] >> 32) & 0xFF); + bits[10] = (unsigned char) ((context->count[0] >> 40) & 0xFF); + bits[9] = (unsigned char) ((context->count[0] >> 48) & 0xFF); + bits[8] = (unsigned char) ((context->count[0] >> 56) & 0xFF); + bits[7] = (unsigned char) (context->count[1] & 0xFF); + bits[6] = (unsigned char) ((context->count[1] >> 8) & 0xFF); + bits[5] = (unsigned char) ((context->count[1] >> 16) & 0xFF); + bits[4] = (unsigned char) ((context->count[1] >> 24) & 0xFF); + bits[3] = (unsigned char) ((context->count[1] >> 32) & 0xFF); + bits[2] = (unsigned char) ((context->count[1] >> 40) & 0xFF); + bits[1] = (unsigned char) ((context->count[1] >> 48) & 0xFF); + bits[0] = (unsigned char) ((context->count[1] >> 56) & 0xFF); + + /* Pad out to 112 mod 128. + */ + index = (unsigned int) ((context->count[0] >> 3) & 0x7f); + padLen = (index < 112) ? (112 - index) : (240 - index); + hash_update(context, PADDING, padLen); + + /* Append length (before padding) */ + hash_update(context, bits, 16); + + /* Store state in digest */ + SHAEncode64(digest, context->state, 64); + + /* Zeroize sensitive information. + */ + memset((unsigned char*) context, 0, sizeof(*context)); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_sha.h b/src/cpp/ext/hash/hash_sha.h new file mode 100644 index 0000000000000..61fd6eb24e4db --- /dev/null +++ b/src/cpp/ext/hash/hash_sha.h @@ -0,0 +1,69 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_SHA_H__ +#define __EXT_HASH_SHA_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_sha1 : public HashEngine { +public: + hash_sha1(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +class hash_sha256 : public HashEngine { +public: + hash_sha256(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +class hash_sha384 : public HashEngine { +public: + hash_sha384(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +class hash_sha512 : public HashEngine { +public: + hash_sha512(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_SHA_H__ diff --git a/src/cpp/ext/hash/hash_snefru.cpp b/src/cpp/ext/hash/hash_snefru.cpp new file mode 100644 index 0000000000000..5d6cd1d4cdd05 --- /dev/null +++ b/src/cpp/ext/hash/hash_snefru.cpp @@ -0,0 +1,191 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned int state[16]; + unsigned int count[2]; + unsigned char length; + unsigned char buffer[32]; +} PHP_SNEFRU_CTX; + +hash_snefru::hash_snefru() : HashEngine(32, 32, sizeof(PHP_SNEFRU_CTX)) { +} + +#define round(L, C, N, SB) \ + SBE = SB[C & 0xff]; \ + L ^= SBE; \ + N ^= SBE + +static inline void Snefru(unsigned int input[16]) { + static int shifts[4] = {16, 8, 16, 24}; + int b, index, rshift, lshift; + const unsigned int *t0,*t1; + unsigned int SBE,B00,B01,B02,B03,B04,B05,B06,B07,B08,B09,B10, + B11,B12,B13,B14,B15; + + B00 = input[0]; + B01 = input[1]; + B02 = input[2]; + B03 = input[3]; + B04 = input[4]; + B05 = input[5]; + B06 = input[6]; + B07 = input[7]; + B08 = input[8]; + B09 = input[9]; + B10 = input[10]; + B11 = input[11]; + B12 = input[12]; + B13 = input[13]; + B14 = input[14]; + B15 = input[15]; + + for (index = 0; index < 8; index++) { + t0 = tables[2*index+0]; + t1 = tables[2*index+1]; + for (b = 0; b < 4; b++) { + round(B15, B00, B01, t0); + round(B00, B01, B02, t0); + round(B01, B02, B03, t1); + round(B02, B03, B04, t1); + round(B03, B04, B05, t0); + round(B04, B05, B06, t0); + round(B05, B06, B07, t1); + round(B06, B07, B08, t1); + round(B07, B08, B09, t0); + round(B08, B09, B10, t0); + round(B09, B10, B11, t1); + round(B10, B11, B12, t1); + round(B11, B12, B13, t0); + round(B12, B13, B14, t0); + round(B13, B14, B15, t1); + round(B14, B15, B00, t1); + + rshift = shifts[b]; + lshift = 32-rshift; + + B00 = (B00 >> rshift) | (B00 << lshift); + B01 = (B01 >> rshift) | (B01 << lshift); + B02 = (B02 >> rshift) | (B02 << lshift); + B03 = (B03 >> rshift) | (B03 << lshift); + B04 = (B04 >> rshift) | (B04 << lshift); + B05 = (B05 >> rshift) | (B05 << lshift); + B06 = (B06 >> rshift) | (B06 << lshift); + B07 = (B07 >> rshift) | (B07 << lshift); + B08 = (B08 >> rshift) | (B08 << lshift); + B09 = (B09 >> rshift) | (B09 << lshift); + B10 = (B10 >> rshift) | (B10 << lshift); + B11 = (B11 >> rshift) | (B11 << lshift); + B12 = (B12 >> rshift) | (B12 << lshift); + B13 = (B13 >> rshift) | (B13 << lshift); + B14 = (B14 >> rshift) | (B14 << lshift); + B15 = (B15 >> rshift) | (B15 << lshift); + } + } + input[0] ^= B15; + input[1] ^= B14; + input[2] ^= B13; + input[3] ^= B12; + input[4] ^= B11; + input[5] ^= B10; + input[6] ^= B09; + input[7] ^= B08; +} + +static inline void SnefruTransform(PHP_SNEFRU_CTX *context, + const unsigned char input[32]) { + int i, j; + + for (i = 0, j = 0; i < 32; i += 4, ++j) { + context->state[8+j] = + ((input[i] & 0xff) << 24) | ((input[i+1] & 0xff) << 16) | + ((input[i+2] & 0xff) << 8) | (input[i+3] & 0xff); + } + Snefru(context->state); + memset(&context->state[8], 0, sizeof(unsigned int) * 8); +} + +void hash_snefru::hash_init(void *context_) { + PHP_SNEFRU_CTX *context = (PHP_SNEFRU_CTX*)context_; + memset(context, 0, sizeof(*context)); +} + +static const unsigned int MAX32 = 0xffffffffLU; + +void hash_snefru::hash_update(void *context_, const unsigned char *input, + unsigned int len) { + PHP_SNEFRU_CTX *context = (PHP_SNEFRU_CTX*)context_; + if ((MAX32 - context->count[1]) < (len * 8)) { + context->count[0]++; + context->count[1] = MAX32 - context->count[1]; + context->count[1] = (len * 8) - context->count[1]; + } else { + context->count[1] += len * 8; + } + + if (context->length + len < 32) { + memcpy(&context->buffer[context->length], input, len); + context->length += len; + } else { + size_t i = 0, r = (context->length + len) % 32; + + if (context->length) { + i = 32 - context->length; + memcpy(&context->buffer[context->length], input, i); + SnefruTransform(context, context->buffer); + } + + for (; i + 32 <= len; i += 32) { + SnefruTransform(context, input + i); + } + + memcpy(context->buffer, input + i, r); + memset(&context->buffer[r], 0, 32 - r); + context->length = r; + } +} + +void hash_snefru::hash_final(unsigned char *digest, void *context_) { + PHP_SNEFRU_CTX *context = (PHP_SNEFRU_CTX*)context_; + unsigned int i, j; + + if (context->length) { + SnefruTransform(context, context->buffer); + } + + context->state[14] = context->count[0]; + context->state[15] = context->count[1]; + Snefru(context->state); + + for (i = 0, j = 0; j < 32; i++, j += 4) { + digest[j] = (unsigned char) ((context->state[i] >> 24) & 0xff); + digest[j + 1] = (unsigned char) ((context->state[i] >> 16) & 0xff); + digest[j + 2] = (unsigned char) ((context->state[i] >> 8) & 0xff); + digest[j + 3] = (unsigned char) (context->state[i] & 0xff); + } + + memset(context, 0, sizeof(*context)); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_snefru.h b/src/cpp/ext/hash/hash_snefru.h new file mode 100644 index 0000000000000..3a2819d617288 --- /dev/null +++ b/src/cpp/ext/hash/hash_snefru.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_SNEFRU_H__ +#define __EXT_HASH_SNEFRU_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_snefru : public HashEngine { +public: + hash_snefru(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_SNEFRU_H__ diff --git a/src/cpp/ext/hash/hash_tiger.cpp b/src/cpp/ext/hash/hash_tiger.cpp new file mode 100644 index 0000000000000..4d0f50124a6e3 --- /dev/null +++ b/src/cpp/ext/hash/hash_tiger.cpp @@ -0,0 +1,265 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) +# if defined(__LITTLE_ENDIAN__) +# undef WORDS_BIGENDIAN +# else +# if defined(__BIG_ENDIAN__) +# define WORDS_BIGENDIAN +# endif +# endif +#endif + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + unsigned long state[3]; + unsigned long passed; + unsigned char passes:1; + unsigned char length:7; + unsigned char buffer[64]; +} PHP_TIGER_CTX; + +hash_tiger::hash_tiger(bool tiger3, int digest) + : HashEngine(digest / 8, 64, sizeof(PHP_TIGER_CTX)), + m_tiger3(tiger3), m_digest(digest) { +} + +#define save_abc \ + aa = a; \ + bb = b; \ + cc = c; + +#define round(a,b,c,x,mul) \ + c ^= x; \ + a -= t1[(unsigned char)(c)] ^ \ + t2[(unsigned char)(((unsigned int)(c))>>(2*8))] ^ \ + t3[(unsigned char)((c)>>(4*8))] ^ \ + t4[(unsigned char)(((unsigned int)((c)>>(4*8)))>>(2*8))] ; \ + b += t4[(unsigned char)(((unsigned int)(c))>>(1*8))] ^ \ + t3[(unsigned char)(((unsigned int)(c))>>(3*8))] ^ \ + t2[(unsigned char)(((unsigned int)((c)>>(4*8)))>>(1*8))] ^ \ + t1[(unsigned char)(((unsigned int)((c)>>(4*8)))>>(3*8))]; \ + b *= mul; + +#define pass(a,b,c,mul) \ + round(a,b,c,x0,mul); \ + round(b,c,a,x1,mul); \ + round(c,a,b,x2,mul); \ + round(a,b,c,x3,mul); \ + round(b,c,a,x4,mul); \ + round(c,a,b,x5,mul); \ + round(a,b,c,x6,mul); \ + round(b,c,a,x7,mul); + +#define key_schedule \ + x0 -= x7 ^ L64(0xA5A5A5A5A5A5A5A5); \ + x1 ^= x0; \ + x2 += x1; \ + x3 -= x2 ^ ((~x1)<<19); \ + x4 ^= x3; \ + x5 += x4; \ + x6 -= x5 ^ ((~x4)>>23); \ + x7 ^= x6; \ + x0 += x7; \ + x1 -= x0 ^ ((~x7)<<19); \ + x2 ^= x1; \ + x3 += x2; \ + x4 -= x3 ^ ((~x2)>>23); \ + x5 ^= x4; \ + x6 += x5; \ + x7 -= x6 ^ L64(0x0123456789ABCDEF); + +#define feedforward \ + a ^= aa; \ + b -= bb; \ + c += cc; + +#define compress(passes) \ + save_abc; \ + pass(a,b,c,5); \ + key_schedule; \ + pass(c,a,b,7); \ + key_schedule; \ + pass(b,c,a,9); \ + for(pass_no=0; pass_nopassed += (unsigned long) context->length << 3; + + context->buffer[context->length++] = 0x1; + if (context->length % 8) { + memset(&context->buffer[context->length], 0, 8-context->length%8); + context->length += 8-context->length%8; + } + + if (context->length > 56) { + memset(&context->buffer[context->length], 0, 64 - context->length); + tiger_compress(context->passes, ((unsigned long *) context->buffer), + context->state); + memset(context->buffer, 0, 56); + } else { + memset(&context->buffer[context->length], 0, 56 - context->length); + } + +#ifndef WORDS_BIGENDIAN + memcpy(&context->buffer[56], &context->passed, sizeof(unsigned long)); +#else + context->buffer[56] = (unsigned char) (context->passed & 0xff); + context->buffer[57] = (unsigned char) ((context->passed >> 8) & 0xff); + context->buffer[58] = (unsigned char) ((context->passed >> 16) & 0xff); + context->buffer[59] = (unsigned char) ((context->passed >> 24) & 0xff); + context->buffer[60] = (unsigned char) ((context->passed >> 32) & 0xff); + context->buffer[61] = (unsigned char) ((context->passed >> 40) & 0xff); + context->buffer[62] = (unsigned char) ((context->passed >> 48) & 0xff); + context->buffer[63] = (unsigned char) ((context->passed >> 56) & 0xff); +#endif + tiger_compress(context->passes, ((unsigned long *) context->buffer), + context->state); +} + +void hash_tiger::hash_init(void *context_) { + PHP_TIGER_CTX *context = (PHP_TIGER_CTX*)context_; + memset(context, 0, sizeof(*context)); + if (!m_tiger3) { + context->passes = 1; + } + context->state[0] = L64(0x0123456789ABCDEF); + context->state[1] = L64(0xFEDCBA9876543210); + context->state[2] = L64(0xF096A5B4C3B2E187); +} + +void hash_tiger::hash_update(void *context_, const unsigned char *input, + unsigned int len) { + PHP_TIGER_CTX *context = (PHP_TIGER_CTX*)context_; + + if (context->length + len < 64) { + memcpy(&context->buffer[context->length], input, len); + context->length += len; + } else { + size_t i = 0, r = (context->length + len) % 64; + + if (context->length) { + i = 64 - context->length; + memcpy(&context->buffer[context->length], input, i); + tiger_compress(context->passes, + ((const unsigned long *) context->buffer), + context->state); + memset(context->buffer, 0, 64); + context->passed += 512; + } + + for (; i + 64 <= len; i += 64) { + memcpy(context->buffer, &input[i], 64); + tiger_compress(context->passes, + ((const unsigned long *) context->buffer), + context->state); + context->passed += 512; + } + memset(&context->buffer[r], 0, 64-r); + memcpy(context->buffer, &input[i], r); + context->length = r; + } +} + +void hash_tiger::hash_final(unsigned char *digest, void *context_) { + PHP_TIGER_CTX *context = (PHP_TIGER_CTX*)context_; + + TigerFinalize(context); + + switch (m_digest) { + case 192: + digest[20] = (unsigned char) ((context->state[2] >> 24) & 0xff); + digest[21] = (unsigned char) ((context->state[2] >> 16) & 0xff); + digest[22] = (unsigned char) ((context->state[2] >> 8) & 0xff); + digest[23] = (unsigned char) (context->state[2] & 0xff); + case 160: + digest[16] = (unsigned char) ((context->state[2] >> 56) & 0xff); + digest[17] = (unsigned char) ((context->state[2] >> 48) & 0xff); + digest[18] = (unsigned char) ((context->state[2] >> 40) & 0xff); + digest[19] = (unsigned char) ((context->state[2] >> 32) & 0xff); + case 128: + digest[0] = (unsigned char) ((context->state[0] >> 56) & 0xff); + digest[1] = (unsigned char) ((context->state[0] >> 48) & 0xff); + digest[2] = (unsigned char) ((context->state[0] >> 40) & 0xff); + digest[3] = (unsigned char) ((context->state[0] >> 32) & 0xff); + digest[4] = (unsigned char) ((context->state[0] >> 24) & 0xff); + digest[5] = (unsigned char) ((context->state[0] >> 16) & 0xff); + digest[6] = (unsigned char) ((context->state[0] >> 8) & 0xff); + digest[7] = (unsigned char) (context->state[0] & 0xff); + digest[8] = (unsigned char) ((context->state[1] >> 56) & 0xff); + digest[9] = (unsigned char) ((context->state[1] >> 48) & 0xff); + digest[10] = (unsigned char) ((context->state[1] >> 40) & 0xff); + digest[11] = (unsigned char) ((context->state[1] >> 32) & 0xff); + digest[12] = (unsigned char) ((context->state[1] >> 24) & 0xff); + digest[13] = (unsigned char) ((context->state[1] >> 16) & 0xff); + digest[14] = (unsigned char) ((context->state[1] >> 8) & 0xff); + digest[15] = (unsigned char) (context->state[1] & 0xff); + } + + memset(context, 0, sizeof(*context)); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_tiger.h b/src/cpp/ext/hash/hash_tiger.h new file mode 100644 index 0000000000000..a3127f6ae33d9 --- /dev/null +++ b/src/cpp/ext/hash/hash_tiger.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_TIGER_H__ +#define __EXT_HASH_TIGER_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_tiger : public HashEngine { +public: + hash_tiger(bool tiger3, int digest); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); + +private: + bool m_tiger3; + int m_digest; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_TIGER_H__ diff --git a/src/cpp/ext/hash/hash_whirlpool.cpp b/src/cpp/ext/hash/hash_whirlpool.cpp new file mode 100644 index 0000000000000..fc1c047d1f515 --- /dev/null +++ b/src/cpp/ext/hash/hash_whirlpool.cpp @@ -0,0 +1,450 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef struct { + uint64 state[8]; + unsigned char bitlength[32]; + struct { + int pos; + int bits; + unsigned char data[64]; + } buffer; +} PHP_WHIRLPOOL_CTX; + +hash_whirlpool::hash_whirlpool() : + HashEngine(64, 64, sizeof(PHP_WHIRLPOOL_CTX)) { +}; + +#define DIGESTBYTES 64 +#define DIGESTBITS (8*DIGESTBYTES) /* 512 */ + +#define WBLOCKBYTES 64 +#define WBLOCKBITS (8*WBLOCKBYTES) /* 512 */ + +#define LENGTHBYTES 32 +#define LENGTHBITS (8*LENGTHBYTES) /* 256 */ + +static void WhirlpoolTransform(PHP_WHIRLPOOL_CTX *context) { + int i, r; + unsigned long K[8]; /* the round key */ + unsigned long block[8]; /* mu(buffer) */ + unsigned long state[8]; /* the cipher state */ + unsigned long L[8]; + unsigned char *buffer = context->buffer.data; + + /* + * map the buffer to a block: + */ + for (i = 0; i < 8; i++, buffer += 8) { + block[i] = + (((unsigned long)buffer[0] ) << 56) ^ + (((unsigned long)buffer[1] & 0xffL) << 48) ^ + (((unsigned long)buffer[2] & 0xffL) << 40) ^ + (((unsigned long)buffer[3] & 0xffL) << 32) ^ + (((unsigned long)buffer[4] & 0xffL) << 24) ^ + (((unsigned long)buffer[5] & 0xffL) << 16) ^ + (((unsigned long)buffer[6] & 0xffL) << 8) ^ + (((unsigned long)buffer[7] & 0xffL) ); + } + /* + * compute and apply K^0 to the cipher state: + */ + state[0] = block[0] ^ (K[0] = context->state[0]); + state[1] = block[1] ^ (K[1] = context->state[1]); + state[2] = block[2] ^ (K[2] = context->state[2]); + state[3] = block[3] ^ (K[3] = context->state[3]); + state[4] = block[4] ^ (K[4] = context->state[4]); + state[5] = block[5] ^ (K[5] = context->state[5]); + state[6] = block[6] ^ (K[6] = context->state[6]); + state[7] = block[7] ^ (K[7] = context->state[7]); + /* + * iterate over all rounds: + */ + for (r = 1; r <= R; r++) { + /* + * compute K^r from K^{r-1}: + */ + L[0] = + C0[(int)(K[0] >> 56) ] ^ + C1[(int)(K[7] >> 48) & 0xff] ^ + C2[(int)(K[6] >> 40) & 0xff] ^ + C3[(int)(K[5] >> 32) & 0xff] ^ + C4[(int)(K[4] >> 24) & 0xff] ^ + C5[(int)(K[3] >> 16) & 0xff] ^ + C6[(int)(K[2] >> 8) & 0xff] ^ + C7[(int)(K[1] ) & 0xff] ^ + rc[r]; + L[1] = + C0[(int)(K[1] >> 56) ] ^ + C1[(int)(K[0] >> 48) & 0xff] ^ + C2[(int)(K[7] >> 40) & 0xff] ^ + C3[(int)(K[6] >> 32) & 0xff] ^ + C4[(int)(K[5] >> 24) & 0xff] ^ + C5[(int)(K[4] >> 16) & 0xff] ^ + C6[(int)(K[3] >> 8) & 0xff] ^ + C7[(int)(K[2] ) & 0xff]; + L[2] = + C0[(int)(K[2] >> 56) ] ^ + C1[(int)(K[1] >> 48) & 0xff] ^ + C2[(int)(K[0] >> 40) & 0xff] ^ + C3[(int)(K[7] >> 32) & 0xff] ^ + C4[(int)(K[6] >> 24) & 0xff] ^ + C5[(int)(K[5] >> 16) & 0xff] ^ + C6[(int)(K[4] >> 8) & 0xff] ^ + C7[(int)(K[3] ) & 0xff]; + L[3] = + C0[(int)(K[3] >> 56) ] ^ + C1[(int)(K[2] >> 48) & 0xff] ^ + C2[(int)(K[1] >> 40) & 0xff] ^ + C3[(int)(K[0] >> 32) & 0xff] ^ + C4[(int)(K[7] >> 24) & 0xff] ^ + C5[(int)(K[6] >> 16) & 0xff] ^ + C6[(int)(K[5] >> 8) & 0xff] ^ + C7[(int)(K[4] ) & 0xff]; + L[4] = + C0[(int)(K[4] >> 56) ] ^ + C1[(int)(K[3] >> 48) & 0xff] ^ + C2[(int)(K[2] >> 40) & 0xff] ^ + C3[(int)(K[1] >> 32) & 0xff] ^ + C4[(int)(K[0] >> 24) & 0xff] ^ + C5[(int)(K[7] >> 16) & 0xff] ^ + C6[(int)(K[6] >> 8) & 0xff] ^ + C7[(int)(K[5] ) & 0xff]; + L[5] = + C0[(int)(K[5] >> 56) ] ^ + C1[(int)(K[4] >> 48) & 0xff] ^ + C2[(int)(K[3] >> 40) & 0xff] ^ + C3[(int)(K[2] >> 32) & 0xff] ^ + C4[(int)(K[1] >> 24) & 0xff] ^ + C5[(int)(K[0] >> 16) & 0xff] ^ + C6[(int)(K[7] >> 8) & 0xff] ^ + C7[(int)(K[6] ) & 0xff]; + L[6] = + C0[(int)(K[6] >> 56) ] ^ + C1[(int)(K[5] >> 48) & 0xff] ^ + C2[(int)(K[4] >> 40) & 0xff] ^ + C3[(int)(K[3] >> 32) & 0xff] ^ + C4[(int)(K[2] >> 24) & 0xff] ^ + C5[(int)(K[1] >> 16) & 0xff] ^ + C6[(int)(K[0] >> 8) & 0xff] ^ + C7[(int)(K[7] ) & 0xff]; + L[7] = + C0[(int)(K[7] >> 56) ] ^ + C1[(int)(K[6] >> 48) & 0xff] ^ + C2[(int)(K[5] >> 40) & 0xff] ^ + C3[(int)(K[4] >> 32) & 0xff] ^ + C4[(int)(K[3] >> 24) & 0xff] ^ + C5[(int)(K[2] >> 16) & 0xff] ^ + C6[(int)(K[1] >> 8) & 0xff] ^ + C7[(int)(K[0] ) & 0xff]; + K[0] = L[0]; + K[1] = L[1]; + K[2] = L[2]; + K[3] = L[3]; + K[4] = L[4]; + K[5] = L[5]; + K[6] = L[6]; + K[7] = L[7]; + /* + * apply the r-th round transformation: + */ + L[0] = + C0[(int)(state[0] >> 56) ] ^ + C1[(int)(state[7] >> 48) & 0xff] ^ + C2[(int)(state[6] >> 40) & 0xff] ^ + C3[(int)(state[5] >> 32) & 0xff] ^ + C4[(int)(state[4] >> 24) & 0xff] ^ + C5[(int)(state[3] >> 16) & 0xff] ^ + C6[(int)(state[2] >> 8) & 0xff] ^ + C7[(int)(state[1] ) & 0xff] ^ + K[0]; + L[1] = + C0[(int)(state[1] >> 56) ] ^ + C1[(int)(state[0] >> 48) & 0xff] ^ + C2[(int)(state[7] >> 40) & 0xff] ^ + C3[(int)(state[6] >> 32) & 0xff] ^ + C4[(int)(state[5] >> 24) & 0xff] ^ + C5[(int)(state[4] >> 16) & 0xff] ^ + C6[(int)(state[3] >> 8) & 0xff] ^ + C7[(int)(state[2] ) & 0xff] ^ + K[1]; + L[2] = + C0[(int)(state[2] >> 56) ] ^ + C1[(int)(state[1] >> 48) & 0xff] ^ + C2[(int)(state[0] >> 40) & 0xff] ^ + C3[(int)(state[7] >> 32) & 0xff] ^ + C4[(int)(state[6] >> 24) & 0xff] ^ + C5[(int)(state[5] >> 16) & 0xff] ^ + C6[(int)(state[4] >> 8) & 0xff] ^ + C7[(int)(state[3] ) & 0xff] ^ + K[2]; + L[3] = + C0[(int)(state[3] >> 56) ] ^ + C1[(int)(state[2] >> 48) & 0xff] ^ + C2[(int)(state[1] >> 40) & 0xff] ^ + C3[(int)(state[0] >> 32) & 0xff] ^ + C4[(int)(state[7] >> 24) & 0xff] ^ + C5[(int)(state[6] >> 16) & 0xff] ^ + C6[(int)(state[5] >> 8) & 0xff] ^ + C7[(int)(state[4] ) & 0xff] ^ + K[3]; + L[4] = + C0[(int)(state[4] >> 56) ] ^ + C1[(int)(state[3] >> 48) & 0xff] ^ + C2[(int)(state[2] >> 40) & 0xff] ^ + C3[(int)(state[1] >> 32) & 0xff] ^ + C4[(int)(state[0] >> 24) & 0xff] ^ + C5[(int)(state[7] >> 16) & 0xff] ^ + C6[(int)(state[6] >> 8) & 0xff] ^ + C7[(int)(state[5] ) & 0xff] ^ + K[4]; + L[5] = + C0[(int)(state[5] >> 56) ] ^ + C1[(int)(state[4] >> 48) & 0xff] ^ + C2[(int)(state[3] >> 40) & 0xff] ^ + C3[(int)(state[2] >> 32) & 0xff] ^ + C4[(int)(state[1] >> 24) & 0xff] ^ + C5[(int)(state[0] >> 16) & 0xff] ^ + C6[(int)(state[7] >> 8) & 0xff] ^ + C7[(int)(state[6] ) & 0xff] ^ + K[5]; + L[6] = + C0[(int)(state[6] >> 56) ] ^ + C1[(int)(state[5] >> 48) & 0xff] ^ + C2[(int)(state[4] >> 40) & 0xff] ^ + C3[(int)(state[3] >> 32) & 0xff] ^ + C4[(int)(state[2] >> 24) & 0xff] ^ + C5[(int)(state[1] >> 16) & 0xff] ^ + C6[(int)(state[0] >> 8) & 0xff] ^ + C7[(int)(state[7] ) & 0xff] ^ + K[6]; + L[7] = + C0[(int)(state[7] >> 56) ] ^ + C1[(int)(state[6] >> 48) & 0xff] ^ + C2[(int)(state[5] >> 40) & 0xff] ^ + C3[(int)(state[4] >> 32) & 0xff] ^ + C4[(int)(state[3] >> 24) & 0xff] ^ + C5[(int)(state[2] >> 16) & 0xff] ^ + C6[(int)(state[1] >> 8) & 0xff] ^ + C7[(int)(state[0] ) & 0xff] ^ + K[7]; + state[0] = L[0]; + state[1] = L[1]; + state[2] = L[2]; + state[3] = L[3]; + state[4] = L[4]; + state[5] = L[5]; + state[6] = L[6]; + state[7] = L[7]; + } + /* + * apply the Miyaguchi-Preneel compression function: + */ + context->state[0] ^= state[0] ^ block[0]; + context->state[1] ^= state[1] ^ block[1]; + context->state[2] ^= state[2] ^ block[2]; + context->state[3] ^= state[3] ^ block[3]; + context->state[4] ^= state[4] ^ block[4]; + 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)); +} + +void hash_whirlpool::hash_init(void *context_) { + PHP_WHIRLPOOL_CTX *context = (PHP_WHIRLPOOL_CTX*)context_; + memset(context, 0, sizeof(*context)); +} + +void hash_whirlpool::hash_update(void *context_, const unsigned char *input, + unsigned int len) { + PHP_WHIRLPOOL_CTX *context = (PHP_WHIRLPOOL_CTX*)context_; + + unsigned long sourceBits = len * 8; + /* index of leftmost source unsigned char containing data (1 to 8 bits). */ + int sourcePos = 0; + /* space on source[sourcePos]. */ + int sourceGap = (8 - ((int)sourceBits & 7)) & 7; + /* occupied bits on buffer[bufferPos]. */ + int bufferRem = context->buffer.bits & 7; + const unsigned char *source = input; + unsigned char *buffer = context->buffer.data; + unsigned char *bitLength = context->bitlength; + int bufferBits = context->buffer.bits; + int bufferPos = context->buffer.pos; + unsigned int b, carry; + int i; + + /* + * tally the length of the added data: + */ + unsigned long value = sourceBits; + for (i = 31, carry = 0; i >= 0 && (carry != 0 || value != L64(0)); i--) { + carry += bitLength[i] + ((unsigned int)value & 0xff); + bitLength[i] = (unsigned char)carry; + carry >>= 8; + value >>= 8; + } + /* + * process data in chunks of 8 bits (a more efficient approach would be to + * take whole-word chunks): + */ + while (sourceBits > 8) { + /* N.B. at least source[sourcePos] and source[sourcePos+1] contain data. */ + /* + * take a byte from the source: + */ + b = ((source[sourcePos] << sourceGap) & 0xff) | + ((source[sourcePos + 1] & 0xff) >> (8 - sourceGap)); + /* + * process this byte: + */ + buffer[bufferPos++] |= (unsigned char)(b >> bufferRem); + bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */ + if (bufferBits == DIGESTBITS) { + /* + * process data block: + */ + WhirlpoolTransform(context); + /* + * reset buffer: + */ + bufferBits = bufferPos = 0; + } + buffer[bufferPos] = (unsigned char) (b << (8 - bufferRem)); + bufferBits += bufferRem; + /* + * proceed to remaining data: + */ + sourceBits -= 8; + sourcePos++; + } + /* now 0 <= sourceBits <= 8; + * furthermore, all data (if any is left) is in source[sourcePos]. + */ + if (sourceBits > 0) { + /* bits are left-justified on b. */ + b = (source[sourcePos] << sourceGap) & 0xff; + /* + * process the remaining bits: + */ + buffer[bufferPos] |= b >> bufferRem; + } else { + b = 0; + } + if (bufferRem + sourceBits < 8) { + /* + * all remaining data fits on buffer[bufferPos], + * and there still remains some space. + */ + bufferBits += (int) sourceBits; + } else { + /* + * buffer[bufferPos] is full: + */ + bufferPos++; + bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */ + sourceBits -= 8 - bufferRem; + /* now 0 <= sourceBits < 8; + * furthermore, all data (if any is left) is in source[sourcePos]. + */ + if (bufferBits == DIGESTBITS) { + /* + * process data block: + */ + WhirlpoolTransform(context); + /* + * reset buffer: + */ + bufferBits = bufferPos = 0; + } + buffer[bufferPos] = (unsigned char) (b << (8 - bufferRem)); + bufferBits += (int)sourceBits; + } + context->buffer.bits = bufferBits; + context->buffer.pos = bufferPos; +} + +void hash_whirlpool::hash_final(unsigned char *digest, void *context_) { + PHP_WHIRLPOOL_CTX *context = (PHP_WHIRLPOOL_CTX*)context_; + + int i; + unsigned char *buffer = context->buffer.data; + unsigned char *bitLength = context->bitlength; + int bufferBits = context->buffer.bits; + int bufferPos = context->buffer.pos; + + /* + * append a '1'-bit: + */ + buffer[bufferPos] |= 0x80U >> (bufferBits & 7); + /* all remaining bits on the current unsigned char are set to zero. */ + bufferPos++; + /* + * pad with zero bits to complete (N*WBLOCKBITS - LENGTHBITS) bits: + */ + if (bufferPos > WBLOCKBYTES - LENGTHBYTES) { + if (bufferPos < WBLOCKBYTES) { + memset(&buffer[bufferPos], 0, WBLOCKBYTES - bufferPos); + } + /* + * process data block: + */ + WhirlpoolTransform(context); + /* + * reset buffer: + */ + bufferPos = 0; + } + if (bufferPos < WBLOCKBYTES - LENGTHBYTES) { + memset(&buffer[bufferPos], 0, (WBLOCKBYTES - LENGTHBYTES) - bufferPos); + } + bufferPos = WBLOCKBYTES - LENGTHBYTES; + /* + * append bit length of hashed data: + */ + memcpy(&buffer[WBLOCKBYTES - LENGTHBYTES], bitLength, LENGTHBYTES); + /* + * process data block: + */ + WhirlpoolTransform(context); + /* + * return the completed message digest: + */ + for (i = 0; i < DIGESTBYTES/8; i++) { + digest[0] = (unsigned char)(context->state[i] >> 56); + digest[1] = (unsigned char)(context->state[i] >> 48); + digest[2] = (unsigned char)(context->state[i] >> 40); + digest[3] = (unsigned char)(context->state[i] >> 32); + digest[4] = (unsigned char)(context->state[i] >> 24); + digest[5] = (unsigned char)(context->state[i] >> 16); + digest[6] = (unsigned char)(context->state[i] >> 8); + digest[7] = (unsigned char)(context->state[i] ); + digest += 8; + } + + memset(context, 0, sizeof(*context)); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/hash/hash_whirlpool.h b/src/cpp/ext/hash/hash_whirlpool.h new file mode 100644 index 0000000000000..94edfcf6dc25e --- /dev/null +++ b/src/cpp/ext/hash/hash_whirlpool.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_HASH_WHIRLPOOL_H__ +#define __EXT_HASH_WHIRLPOOL_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class hash_whirlpool : public HashEngine { +public: + hash_whirlpool(); + + virtual void hash_init(void *context); + virtual void hash_update(void *context, const unsigned char *buf, + unsigned int count); + virtual void hash_final(unsigned char *digest, void *context); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_HASH_WHIRLPOOL_H__ diff --git a/src/cpp/ext/hash/php_hash_crc32_tables.h b/src/cpp/ext/hash/php_hash_crc32_tables.h new file mode 100644 index 0000000000000..e737c6997275e --- /dev/null +++ b/src/cpp/ext/hash/php_hash_crc32_tables.h @@ -0,0 +1,148 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +/* $Id: php_hash_crc32_tables.h,v 1.2.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */ + +static const unsigned int crc32_table[] = { 0x0, + 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, + 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, + 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, + 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, + 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, + 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, + 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, + 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, + 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, + 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, + 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, + 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, + 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, + 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, + 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, + 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, + 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, + 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, + 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, + 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, + 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, + 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, + 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, + 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, + 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, + 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, + 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, + 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, + 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, + 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, + 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, + 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, + 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, + 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, + 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, + 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, + 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, + 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, + 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, + 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, + 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, + 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, + 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, + 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, + 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, + 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, + 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, + 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, + 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, + 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 +}; + +static const unsigned int crc32b_table[] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, +}; + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/src/cpp/ext/hash/php_hash_gost_tables.h b/src/cpp/ext/hash/php_hash_gost_tables.h new file mode 100644 index 0000000000000..8c28580bdd2d7 --- /dev/null +++ b/src/cpp/ext/hash/php_hash_gost_tables.h @@ -0,0 +1,154 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +static const unsigned int tables[4][256] = { + { /* table 1 */ + 0x00072000LU, 0x00075000LU, 0x00074800LU, 0x00071000LU, 0x00076800LU, 0x00074000LU, 0x00070000LU, 0x00077000LU, + 0x00073000LU, 0x00075800LU, 0x00070800LU, 0x00076000LU, 0x00073800LU, 0x00077800LU, 0x00072800LU, 0x00071800LU, + 0x0005A000LU, 0x0005D000LU, 0x0005C800LU, 0x00059000LU, 0x0005E800LU, 0x0005C000LU, 0x00058000LU, 0x0005F000LU, + 0x0005B000LU, 0x0005D800LU, 0x00058800LU, 0x0005E000LU, 0x0005B800LU, 0x0005F800LU, 0x0005A800LU, 0x00059800LU, + 0x00022000LU, 0x00025000LU, 0x00024800LU, 0x00021000LU, 0x00026800LU, 0x00024000LU, 0x00020000LU, 0x00027000LU, + 0x00023000LU, 0x00025800LU, 0x00020800LU, 0x00026000LU, 0x00023800LU, 0x00027800LU, 0x00022800LU, 0x00021800LU, + 0x00062000LU, 0x00065000LU, 0x00064800LU, 0x00061000LU, 0x00066800LU, 0x00064000LU, 0x00060000LU, 0x00067000LU, + 0x00063000LU, 0x00065800LU, 0x00060800LU, 0x00066000LU, 0x00063800LU, 0x00067800LU, 0x00062800LU, 0x00061800LU, + 0x00032000LU, 0x00035000LU, 0x00034800LU, 0x00031000LU, 0x00036800LU, 0x00034000LU, 0x00030000LU, 0x00037000LU, + 0x00033000LU, 0x00035800LU, 0x00030800LU, 0x00036000LU, 0x00033800LU, 0x00037800LU, 0x00032800LU, 0x00031800LU, + 0x0006A000LU, 0x0006D000LU, 0x0006C800LU, 0x00069000LU, 0x0006E800LU, 0x0006C000LU, 0x00068000LU, 0x0006F000LU, + 0x0006B000LU, 0x0006D800LU, 0x00068800LU, 0x0006E000LU, 0x0006B800LU, 0x0006F800LU, 0x0006A800LU, 0x00069800LU, + 0x0007A000LU, 0x0007D000LU, 0x0007C800LU, 0x00079000LU, 0x0007E800LU, 0x0007C000LU, 0x00078000LU, 0x0007F000LU, + 0x0007B000LU, 0x0007D800LU, 0x00078800LU, 0x0007E000LU, 0x0007B800LU, 0x0007F800LU, 0x0007A800LU, 0x00079800LU, + 0x00052000LU, 0x00055000LU, 0x00054800LU, 0x00051000LU, 0x00056800LU, 0x00054000LU, 0x00050000LU, 0x00057000LU, + 0x00053000LU, 0x00055800LU, 0x00050800LU, 0x00056000LU, 0x00053800LU, 0x00057800LU, 0x00052800LU, 0x00051800LU, + 0x00012000LU, 0x00015000LU, 0x00014800LU, 0x00011000LU, 0x00016800LU, 0x00014000LU, 0x00010000LU, 0x00017000LU, + 0x00013000LU, 0x00015800LU, 0x00010800LU, 0x00016000LU, 0x00013800LU, 0x00017800LU, 0x00012800LU, 0x00011800LU, + 0x0001A000LU, 0x0001D000LU, 0x0001C800LU, 0x00019000LU, 0x0001E800LU, 0x0001C000LU, 0x00018000LU, 0x0001F000LU, + 0x0001B000LU, 0x0001D800LU, 0x00018800LU, 0x0001E000LU, 0x0001B800LU, 0x0001F800LU, 0x0001A800LU, 0x00019800LU, + 0x00042000LU, 0x00045000LU, 0x00044800LU, 0x00041000LU, 0x00046800LU, 0x00044000LU, 0x00040000LU, 0x00047000LU, + 0x00043000LU, 0x00045800LU, 0x00040800LU, 0x00046000LU, 0x00043800LU, 0x00047800LU, 0x00042800LU, 0x00041800LU, + 0x0000A000LU, 0x0000D000LU, 0x0000C800LU, 0x00009000LU, 0x0000E800LU, 0x0000C000LU, 0x00008000LU, 0x0000F000LU, + 0x0000B000LU, 0x0000D800LU, 0x00008800LU, 0x0000E000LU, 0x0000B800LU, 0x0000F800LU, 0x0000A800LU, 0x00009800LU, + 0x00002000LU, 0x00005000LU, 0x00004800LU, 0x00001000LU, 0x00006800LU, 0x00004000LU, 0x00000000LU, 0x00007000LU, + 0x00003000LU, 0x00005800LU, 0x00000800LU, 0x00006000LU, 0x00003800LU, 0x00007800LU, 0x00002800LU, 0x00001800LU, + 0x0003A000LU, 0x0003D000LU, 0x0003C800LU, 0x00039000LU, 0x0003E800LU, 0x0003C000LU, 0x00038000LU, 0x0003F000LU, + 0x0003B000LU, 0x0003D800LU, 0x00038800LU, 0x0003E000LU, 0x0003B800LU, 0x0003F800LU, 0x0003A800LU, 0x00039800LU, + 0x0002A000LU, 0x0002D000LU, 0x0002C800LU, 0x00029000LU, 0x0002E800LU, 0x0002C000LU, 0x00028000LU, 0x0002F000LU, + 0x0002B000LU, 0x0002D800LU, 0x00028800LU, 0x0002E000LU, 0x0002B800LU, 0x0002F800LU, 0x0002A800LU, 0x00029800LU, + 0x0004A000LU, 0x0004D000LU, 0x0004C800LU, 0x00049000LU, 0x0004E800LU, 0x0004C000LU, 0x00048000LU, 0x0004F000LU, + 0x0004B000LU, 0x0004D800LU, 0x00048800LU, 0x0004E000LU, 0x0004B800LU, 0x0004F800LU, 0x0004A800LU, 0x00049800LU, + }, + { /* table 2 */ + 0x03A80000LU, 0x03C00000LU, 0x03880000LU, 0x03E80000LU, 0x03D00000LU, 0x03980000LU, 0x03A00000LU, 0x03900000LU, + 0x03F00000LU, 0x03F80000LU, 0x03E00000LU, 0x03B80000LU, 0x03B00000LU, 0x03800000LU, 0x03C80000LU, 0x03D80000LU, + 0x06A80000LU, 0x06C00000LU, 0x06880000LU, 0x06E80000LU, 0x06D00000LU, 0x06980000LU, 0x06A00000LU, 0x06900000LU, + 0x06F00000LU, 0x06F80000LU, 0x06E00000LU, 0x06B80000LU, 0x06B00000LU, 0x06800000LU, 0x06C80000LU, 0x06D80000LU, + 0x05280000LU, 0x05400000LU, 0x05080000LU, 0x05680000LU, 0x05500000LU, 0x05180000LU, 0x05200000LU, 0x05100000LU, + 0x05700000LU, 0x05780000LU, 0x05600000LU, 0x05380000LU, 0x05300000LU, 0x05000000LU, 0x05480000LU, 0x05580000LU, + 0x00A80000LU, 0x00C00000LU, 0x00880000LU, 0x00E80000LU, 0x00D00000LU, 0x00980000LU, 0x00A00000LU, 0x00900000LU, + 0x00F00000LU, 0x00F80000LU, 0x00E00000LU, 0x00B80000LU, 0x00B00000LU, 0x00800000LU, 0x00C80000LU, 0x00D80000LU, + 0x00280000LU, 0x00400000LU, 0x00080000LU, 0x00680000LU, 0x00500000LU, 0x00180000LU, 0x00200000LU, 0x00100000LU, + 0x00700000LU, 0x00780000LU, 0x00600000LU, 0x00380000LU, 0x00300000LU, 0x00000000LU, 0x00480000LU, 0x00580000LU, + 0x04280000LU, 0x04400000LU, 0x04080000LU, 0x04680000LU, 0x04500000LU, 0x04180000LU, 0x04200000LU, 0x04100000LU, + 0x04700000LU, 0x04780000LU, 0x04600000LU, 0x04380000LU, 0x04300000LU, 0x04000000LU, 0x04480000LU, 0x04580000LU, + 0x04A80000LU, 0x04C00000LU, 0x04880000LU, 0x04E80000LU, 0x04D00000LU, 0x04980000LU, 0x04A00000LU, 0x04900000LU, + 0x04F00000LU, 0x04F80000LU, 0x04E00000LU, 0x04B80000LU, 0x04B00000LU, 0x04800000LU, 0x04C80000LU, 0x04D80000LU, + 0x07A80000LU, 0x07C00000LU, 0x07880000LU, 0x07E80000LU, 0x07D00000LU, 0x07980000LU, 0x07A00000LU, 0x07900000LU, + 0x07F00000LU, 0x07F80000LU, 0x07E00000LU, 0x07B80000LU, 0x07B00000LU, 0x07800000LU, 0x07C80000LU, 0x07D80000LU, + 0x07280000LU, 0x07400000LU, 0x07080000LU, 0x07680000LU, 0x07500000LU, 0x07180000LU, 0x07200000LU, 0x07100000LU, + 0x07700000LU, 0x07780000LU, 0x07600000LU, 0x07380000LU, 0x07300000LU, 0x07000000LU, 0x07480000LU, 0x07580000LU, + 0x02280000LU, 0x02400000LU, 0x02080000LU, 0x02680000LU, 0x02500000LU, 0x02180000LU, 0x02200000LU, 0x02100000LU, + 0x02700000LU, 0x02780000LU, 0x02600000LU, 0x02380000LU, 0x02300000LU, 0x02000000LU, 0x02480000LU, 0x02580000LU, + 0x03280000LU, 0x03400000LU, 0x03080000LU, 0x03680000LU, 0x03500000LU, 0x03180000LU, 0x03200000LU, 0x03100000LU, + 0x03700000LU, 0x03780000LU, 0x03600000LU, 0x03380000LU, 0x03300000LU, 0x03000000LU, 0x03480000LU, 0x03580000LU, + 0x06280000LU, 0x06400000LU, 0x06080000LU, 0x06680000LU, 0x06500000LU, 0x06180000LU, 0x06200000LU, 0x06100000LU, + 0x06700000LU, 0x06780000LU, 0x06600000LU, 0x06380000LU, 0x06300000LU, 0x06000000LU, 0x06480000LU, 0x06580000LU, + 0x05A80000LU, 0x05C00000LU, 0x05880000LU, 0x05E80000LU, 0x05D00000LU, 0x05980000LU, 0x05A00000LU, 0x05900000LU, + 0x05F00000LU, 0x05F80000LU, 0x05E00000LU, 0x05B80000LU, 0x05B00000LU, 0x05800000LU, 0x05C80000LU, 0x05D80000LU, + 0x01280000LU, 0x01400000LU, 0x01080000LU, 0x01680000LU, 0x01500000LU, 0x01180000LU, 0x01200000LU, 0x01100000LU, + 0x01700000LU, 0x01780000LU, 0x01600000LU, 0x01380000LU, 0x01300000LU, 0x01000000LU, 0x01480000LU, 0x01580000LU, + 0x02A80000LU, 0x02C00000LU, 0x02880000LU, 0x02E80000LU, 0x02D00000LU, 0x02980000LU, 0x02A00000LU, 0x02900000LU, + 0x02F00000LU, 0x02F80000LU, 0x02E00000LU, 0x02B80000LU, 0x02B00000LU, 0x02800000LU, 0x02C80000LU, 0x02D80000LU, + 0x01A80000LU, 0x01C00000LU, 0x01880000LU, 0x01E80000LU, 0x01D00000LU, 0x01980000LU, 0x01A00000LU, 0x01900000LU, + 0x01F00000LU, 0x01F80000LU, 0x01E00000LU, 0x01B80000LU, 0x01B00000LU, 0x01800000LU, 0x01C80000LU, 0x01D80000LU, + }, + { /* table 3 */ + 0x30000002LU, 0x60000002LU, 0x38000002LU, 0x08000002LU, 0x28000002LU, 0x78000002LU, 0x68000002LU, 0x40000002LU, + 0x20000002LU, 0x50000002LU, 0x48000002LU, 0x70000002LU, 0x00000002LU, 0x18000002LU, 0x58000002LU, 0x10000002LU, + 0xB0000005LU, 0xE0000005LU, 0xB8000005LU, 0x88000005LU, 0xA8000005LU, 0xF8000005LU, 0xE8000005LU, 0xC0000005LU, + 0xA0000005LU, 0xD0000005LU, 0xC8000005LU, 0xF0000005LU, 0x80000005LU, 0x98000005LU, 0xD8000005LU, 0x90000005LU, + 0x30000005LU, 0x60000005LU, 0x38000005LU, 0x08000005LU, 0x28000005LU, 0x78000005LU, 0x68000005LU, 0x40000005LU, + 0x20000005LU, 0x50000005LU, 0x48000005LU, 0x70000005LU, 0x00000005LU, 0x18000005LU, 0x58000005LU, 0x10000005LU, + 0x30000000LU, 0x60000000LU, 0x38000000LU, 0x08000000LU, 0x28000000LU, 0x78000000LU, 0x68000000LU, 0x40000000LU, + 0x20000000LU, 0x50000000LU, 0x48000000LU, 0x70000000LU, 0x00000000LU, 0x18000000LU, 0x58000000LU, 0x10000000LU, + 0xB0000003LU, 0xE0000003LU, 0xB8000003LU, 0x88000003LU, 0xA8000003LU, 0xF8000003LU, 0xE8000003LU, 0xC0000003LU, + 0xA0000003LU, 0xD0000003LU, 0xC8000003LU, 0xF0000003LU, 0x80000003LU, 0x98000003LU, 0xD8000003LU, 0x90000003LU, + 0x30000001LU, 0x60000001LU, 0x38000001LU, 0x08000001LU, 0x28000001LU, 0x78000001LU, 0x68000001LU, 0x40000001LU, + 0x20000001LU, 0x50000001LU, 0x48000001LU, 0x70000001LU, 0x00000001LU, 0x18000001LU, 0x58000001LU, 0x10000001LU, + 0xB0000000LU, 0xE0000000LU, 0xB8000000LU, 0x88000000LU, 0xA8000000LU, 0xF8000000LU, 0xE8000000LU, 0xC0000000LU, + 0xA0000000LU, 0xD0000000LU, 0xC8000000LU, 0xF0000000LU, 0x80000000LU, 0x98000000LU, 0xD8000000LU, 0x90000000LU, + 0xB0000006LU, 0xE0000006LU, 0xB8000006LU, 0x88000006LU, 0xA8000006LU, 0xF8000006LU, 0xE8000006LU, 0xC0000006LU, + 0xA0000006LU, 0xD0000006LU, 0xC8000006LU, 0xF0000006LU, 0x80000006LU, 0x98000006LU, 0xD8000006LU, 0x90000006LU, + 0xB0000001LU, 0xE0000001LU, 0xB8000001LU, 0x88000001LU, 0xA8000001LU, 0xF8000001LU, 0xE8000001LU, 0xC0000001LU, + 0xA0000001LU, 0xD0000001LU, 0xC8000001LU, 0xF0000001LU, 0x80000001LU, 0x98000001LU, 0xD8000001LU, 0x90000001LU, + 0x30000003LU, 0x60000003LU, 0x38000003LU, 0x08000003LU, 0x28000003LU, 0x78000003LU, 0x68000003LU, 0x40000003LU, + 0x20000003LU, 0x50000003LU, 0x48000003LU, 0x70000003LU, 0x00000003LU, 0x18000003LU, 0x58000003LU, 0x10000003LU, + 0x30000004LU, 0x60000004LU, 0x38000004LU, 0x08000004LU, 0x28000004LU, 0x78000004LU, 0x68000004LU, 0x40000004LU, + 0x20000004LU, 0x50000004LU, 0x48000004LU, 0x70000004LU, 0x00000004LU, 0x18000004LU, 0x58000004LU, 0x10000004LU, + 0xB0000002LU, 0xE0000002LU, 0xB8000002LU, 0x88000002LU, 0xA8000002LU, 0xF8000002LU, 0xE8000002LU, 0xC0000002LU, + 0xA0000002LU, 0xD0000002LU, 0xC8000002LU, 0xF0000002LU, 0x80000002LU, 0x98000002LU, 0xD8000002LU, 0x90000002LU, + 0xB0000004LU, 0xE0000004LU, 0xB8000004LU, 0x88000004LU, 0xA8000004LU, 0xF8000004LU, 0xE8000004LU, 0xC0000004LU, + 0xA0000004LU, 0xD0000004LU, 0xC8000004LU, 0xF0000004LU, 0x80000004LU, 0x98000004LU, 0xD8000004LU, 0x90000004LU, + 0x30000006LU, 0x60000006LU, 0x38000006LU, 0x08000006LU, 0x28000006LU, 0x78000006LU, 0x68000006LU, 0x40000006LU, + 0x20000006LU, 0x50000006LU, 0x48000006LU, 0x70000006LU, 0x00000006LU, 0x18000006LU, 0x58000006LU, 0x10000006LU, + 0xB0000007LU, 0xE0000007LU, 0xB8000007LU, 0x88000007LU, 0xA8000007LU, 0xF8000007LU, 0xE8000007LU, 0xC0000007LU, + 0xA0000007LU, 0xD0000007LU, 0xC8000007LU, 0xF0000007LU, 0x80000007LU, 0x98000007LU, 0xD8000007LU, 0x90000007LU, + 0x30000007LU, 0x60000007LU, 0x38000007LU, 0x08000007LU, 0x28000007LU, 0x78000007LU, 0x68000007LU, 0x40000007LU, + 0x20000007LU, 0x50000007LU, 0x48000007LU, 0x70000007LU, 0x00000007LU, 0x18000007LU, 0x58000007LU, 0x10000007LU, + }, + { /* table 4 */ + 0x000000E8LU, 0x000000D8LU, 0x000000A0LU, 0x00000088LU, 0x00000098LU, 0x000000F8LU, 0x000000A8LU, 0x000000C8LU, + 0x00000080LU, 0x000000D0LU, 0x000000F0LU, 0x000000B8LU, 0x000000B0LU, 0x000000C0LU, 0x00000090LU, 0x000000E0LU, + 0x000007E8LU, 0x000007D8LU, 0x000007A0LU, 0x00000788LU, 0x00000798LU, 0x000007F8LU, 0x000007A8LU, 0x000007C8LU, + 0x00000780LU, 0x000007D0LU, 0x000007F0LU, 0x000007B8LU, 0x000007B0LU, 0x000007C0LU, 0x00000790LU, 0x000007E0LU, + 0x000006E8LU, 0x000006D8LU, 0x000006A0LU, 0x00000688LU, 0x00000698LU, 0x000006F8LU, 0x000006A8LU, 0x000006C8LU, + 0x00000680LU, 0x000006D0LU, 0x000006F0LU, 0x000006B8LU, 0x000006B0LU, 0x000006C0LU, 0x00000690LU, 0x000006E0LU, + 0x00000068LU, 0x00000058LU, 0x00000020LU, 0x00000008LU, 0x00000018LU, 0x00000078LU, 0x00000028LU, 0x00000048LU, + 0x00000000LU, 0x00000050LU, 0x00000070LU, 0x00000038LU, 0x00000030LU, 0x00000040LU, 0x00000010LU, 0x00000060LU, + 0x000002E8LU, 0x000002D8LU, 0x000002A0LU, 0x00000288LU, 0x00000298LU, 0x000002F8LU, 0x000002A8LU, 0x000002C8LU, + 0x00000280LU, 0x000002D0LU, 0x000002F0LU, 0x000002B8LU, 0x000002B0LU, 0x000002C0LU, 0x00000290LU, 0x000002E0LU, + 0x000003E8LU, 0x000003D8LU, 0x000003A0LU, 0x00000388LU, 0x00000398LU, 0x000003F8LU, 0x000003A8LU, 0x000003C8LU, + 0x00000380LU, 0x000003D0LU, 0x000003F0LU, 0x000003B8LU, 0x000003B0LU, 0x000003C0LU, 0x00000390LU, 0x000003E0LU, + 0x00000568LU, 0x00000558LU, 0x00000520LU, 0x00000508LU, 0x00000518LU, 0x00000578LU, 0x00000528LU, 0x00000548LU, + 0x00000500LU, 0x00000550LU, 0x00000570LU, 0x00000538LU, 0x00000530LU, 0x00000540LU, 0x00000510LU, 0x00000560LU, + 0x00000268LU, 0x00000258LU, 0x00000220LU, 0x00000208LU, 0x00000218LU, 0x00000278LU, 0x00000228LU, 0x00000248LU, + 0x00000200LU, 0x00000250LU, 0x00000270LU, 0x00000238LU, 0x00000230LU, 0x00000240LU, 0x00000210LU, 0x00000260LU, + 0x000004E8LU, 0x000004D8LU, 0x000004A0LU, 0x00000488LU, 0x00000498LU, 0x000004F8LU, 0x000004A8LU, 0x000004C8LU, + 0x00000480LU, 0x000004D0LU, 0x000004F0LU, 0x000004B8LU, 0x000004B0LU, 0x000004C0LU, 0x00000490LU, 0x000004E0LU, + 0x00000168LU, 0x00000158LU, 0x00000120LU, 0x00000108LU, 0x00000118LU, 0x00000178LU, 0x00000128LU, 0x00000148LU, + 0x00000100LU, 0x00000150LU, 0x00000170LU, 0x00000138LU, 0x00000130LU, 0x00000140LU, 0x00000110LU, 0x00000160LU, + 0x000001E8LU, 0x000001D8LU, 0x000001A0LU, 0x00000188LU, 0x00000198LU, 0x000001F8LU, 0x000001A8LU, 0x000001C8LU, + 0x00000180LU, 0x000001D0LU, 0x000001F0LU, 0x000001B8LU, 0x000001B0LU, 0x000001C0LU, 0x00000190LU, 0x000001E0LU, + 0x00000768LU, 0x00000758LU, 0x00000720LU, 0x00000708LU, 0x00000718LU, 0x00000778LU, 0x00000728LU, 0x00000748LU, + 0x00000700LU, 0x00000750LU, 0x00000770LU, 0x00000738LU, 0x00000730LU, 0x00000740LU, 0x00000710LU, 0x00000760LU, + 0x00000368LU, 0x00000358LU, 0x00000320LU, 0x00000308LU, 0x00000318LU, 0x00000378LU, 0x00000328LU, 0x00000348LU, + 0x00000300LU, 0x00000350LU, 0x00000370LU, 0x00000338LU, 0x00000330LU, 0x00000340LU, 0x00000310LU, 0x00000360LU, + 0x000005E8LU, 0x000005D8LU, 0x000005A0LU, 0x00000588LU, 0x00000598LU, 0x000005F8LU, 0x000005A8LU, 0x000005C8LU, + 0x00000580LU, 0x000005D0LU, 0x000005F0LU, 0x000005B8LU, 0x000005B0LU, 0x000005C0LU, 0x00000590LU, 0x000005E0LU, + 0x00000468LU, 0x00000458LU, 0x00000420LU, 0x00000408LU, 0x00000418LU, 0x00000478LU, 0x00000428LU, 0x00000448LU, + 0x00000400LU, 0x00000450LU, 0x00000470LU, 0x00000438LU, 0x00000430LU, 0x00000440LU, 0x00000410LU, 0x00000460LU, + 0x00000668LU, 0x00000658LU, 0x00000620LU, 0x00000608LU, 0x00000618LU, 0x00000678LU, 0x00000628LU, 0x00000648LU, + 0x00000600LU, 0x00000650LU, 0x00000670LU, 0x00000638LU, 0x00000630LU, 0x00000640LU, 0x00000610LU, 0x00000660LU, + }, +}; diff --git a/src/cpp/ext/hash/php_hash_snefru_tables.h b/src/cpp/ext/hash/php_hash_snefru_tables.h new file mode 100644 index 0000000000000..8a9daa56b62a4 --- /dev/null +++ b/src/cpp/ext/hash/php_hash_snefru_tables.h @@ -0,0 +1,941 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +/* $Id: php_hash_snefru_tables.h,v 1.3.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */ + +static const unsigned int tables[16][256]= { + + { /* Start of S Box 0 */ + +/* 0*/ 0x64f9001bL,0xfeddcdf6L,0x7c8ff1e2L,0x11d71514L,0x8b8c18d3L, +/* 5*/ 0xdddf881eL,0x6eab5056L,0x88ced8e1L,0x49148959L,0x69c56fd5L, +/* 10*/ 0xb7994f03L,0x0fbcee3eL,0x3c264940L,0x21557e58L,0xe14b3fc2L, +/* 15*/ 0x2e5cf591L,0xdceff8ceL,0x092a1648L,0xbe812936L,0xff7b0c6aL, +/* 20*/ 0xd5251037L,0xafa448f1L,0x7dafc95aL,0x1ea69c3fL,0xa417abe7L, +/* 25*/ 0x5890e423L,0xb0cb70c0L,0xc85025f7L,0x244d97e3L,0x1ff3595fL, +/* 30*/ 0xc4ec6396L,0x59181e17L,0xe635b477L,0x354e7dbfL,0x796f7753L, +/* 35*/ 0x66eb52ccL,0x77c3f995L,0x32e3a927L,0x80ccaed6L,0x4e2be89dL, +/* 40*/ 0x375bbd28L,0xad1a3d05L,0x2b1b42b3L,0x16c44c71L,0x4d54bfa8L, +/* 45*/ 0xe57ddc7aL,0xec6d8144L,0x5a71046bL,0xd8229650L,0x87fc8f24L, +/* 50*/ 0xcbc60e09L,0xb6390366L,0xd9f76092L,0xd393a70bL,0x1d31a08aL, +/* 55*/ 0x9cd971c9L,0x5c1ef445L,0x86fab694L,0xfdb44165L,0x8eaafcbeL, +/* 60*/ 0x4bcac6ebL,0xfb7a94e5L,0x5789d04eL,0xfa13cf35L,0x236b8da9L, +/* 65*/ 0x4133f000L,0x6224261cL,0xf412f23bL,0xe75e56a4L,0x30022116L, +/* 70*/ 0xbaf17f1fL,0xd09872f9L,0xc1a3699cL,0xf1e802aaL,0x0dd145dcL, +/* 75*/ 0x4fdce093L,0x8d8412f0L,0x6cd0f376L,0x3de6b73dL,0x84ba737fL, +/* 80*/ 0xb43a30f2L,0x44569f69L,0x00e4eacaL,0xb58de3b0L,0x959113c8L, +/* 85*/ 0xd62efee9L,0x90861f83L,0xced69874L,0x2f793ceeL,0xe8571c30L, +/* 90*/ 0x483665d1L,0xab07b031L,0x914c844fL,0x15bf3be8L,0x2c3f2a9aL, +/* 95*/ 0x9eb95fd4L,0x92e7472dL,0x2297cc5bL,0xee5f2782L,0x5377b562L, +/* 100*/ 0xdb8ebbcfL,0xf961deddL,0xc59b5c60L,0x1bd3910dL,0x26d206adL, +/* 105*/ 0xb28514d8L,0x5ecf6b52L,0x7fea78bbL,0x504879acL,0xed34a884L, +/* 110*/ 0x36e51d3cL,0x1753741dL,0x8c47caedL,0x9d0a40efL,0x3145e221L, +/* 115*/ 0xda27eb70L,0xdf730ba3L,0x183c8789L,0x739ac0a6L,0x9a58dfc6L, +/* 120*/ 0x54b134c1L,0xac3e242eL,0xcc493902L,0x7b2dda99L,0x8f15bc01L, +/* 125*/ 0x29fd38c7L,0x27d5318fL,0x604aaff5L,0xf29c6818L,0xc38aa2ecL, +/* 130*/ 0x1019d4c3L,0xa8fb936eL,0x20ed7b39L,0x0b686119L,0x89a0906fL, +/* 135*/ 0x1cc7829eL,0x9952ef4bL,0x850e9e8cL,0xcd063a90L,0x67002f8eL, +/* 140*/ 0xcfac8cb7L,0xeaa24b11L,0x988b4e6cL,0x46f066dfL,0xca7eec08L, +/* 145*/ 0xc7bba664L,0x831d17bdL,0x63f575e6L,0x9764350eL,0x47870d42L, +/* 150*/ 0x026ca4a2L,0x8167d587L,0x61b6adabL,0xaa6564d2L,0x70da237bL, +/* 155*/ 0x25e1c74aL,0xa1c901a0L,0x0eb0a5daL,0x7670f741L,0x51c05aeaL, +/* 160*/ 0x933dfa32L,0x0759ff1aL,0x56010ab8L,0x5fdecb78L,0x3f32edf8L, +/* 165*/ 0xaebedbb9L,0x39f8326dL,0xd20858c5L,0x9b638be4L,0xa572c80aL, +/* 170*/ 0x28e0a19fL,0x432099fcL,0x3a37c3cdL,0xbf95c585L,0xb392c12aL, +/* 175*/ 0x6aa707d7L,0x52f66a61L,0x12d483b1L,0x96435b5eL,0x3e75802bL, +/* 180*/ 0x3ba52b33L,0xa99f51a5L,0xbda1e157L,0x78c2e70cL,0xfcae7ce0L, +/* 185*/ 0xd1602267L,0x2affac4dL,0x4a510947L,0x0ab2b83aL,0x7a04e579L, +/* 190*/ 0x340dfd80L,0xb916e922L,0xe29d5e9bL,0xf5624af4L,0x4ca9d9afL, +/* 195*/ 0x6bbd2cfeL,0xe3b7f620L,0xc2746e07L,0x5b42b9b6L,0xa06919bcL, +/* 200*/ 0xf0f2c40fL,0x72217ab5L,0x14c19df3L,0xf3802daeL,0xe094beb4L, +/* 205*/ 0xa2101affL,0x0529575dL,0x55cdb27cL,0xa33bddb2L,0x6528b37dL, +/* 210*/ 0x740c05dbL,0xe96a62c4L,0x40782846L,0x6d30d706L,0xbbf48e2cL, +/* 215*/ 0xbce2d3deL,0x049e37faL,0x01b5e634L,0x2d886d8dL,0x7e5a2e7eL, +/* 220*/ 0xd7412013L,0x06e90f97L,0xe45d3ebaL,0xb8ad3386L,0x13051b25L, +/* 225*/ 0x0c035354L,0x71c89b75L,0xc638fbd0L,0x197f11a1L,0xef0f08fbL, +/* 230*/ 0xf8448651L,0x38409563L,0x452f4443L,0x5d464d55L,0x03d8764cL, +/* 235*/ 0xb1b8d638L,0xa70bba2fL,0x94b3d210L,0xeb6692a7L,0xd409c2d9L, +/* 240*/ 0x68838526L,0xa6db8a15L,0x751f6c98L,0xde769a88L,0xc9ee4668L, +/* 245*/ 0x1a82a373L,0x0896aa49L,0x42233681L,0xf62c55cbL,0x9f1c5404L, +/* 250*/ 0xf74fb15cL,0xc06e4312L,0x6ffe5d72L,0x8aa8678bL,0x337cd129L, +/* 255*/ 0x8211cefdL + /* End of S Box 0 */ }, + + + { /* Start of S Box 1 */ + +/* 0*/ 0x074a1d09L,0x52a10e5aL,0x9275a3f8L,0x4b82506cL,0x37df7e1bL, +/* 5*/ 0x4c78b3c5L,0xcefab1daL,0xf472267eL,0xb63045f6L,0xd66a1fc0L, +/* 10*/ 0x400298e3L,0x27e60c94L,0x87d2f1b8L,0xdf9e56ccL,0x45cd1803L, +/* 15*/ 0x1d35e098L,0xcce7c736L,0x03483bf1L,0x1f7307d7L,0xc6e8f948L, +/* 20*/ 0xe613c111L,0x3955c6ffL,0x1170ed7cL,0x8e95da41L,0x99c31bf4L, +/* 25*/ 0xa4da8021L,0x7b5f94fbL,0xdd0da51fL,0x6562aa77L,0x556bcb23L, +/* 30*/ 0xdb1bacc6L,0x798040b9L,0xbfe5378fL,0x731d55e6L,0xdaa5bfeeL, +/* 35*/ 0x389bbc60L,0x1b33fba4L,0x9c567204L,0x36c26c68L,0x77ee9d69L, +/* 40*/ 0x8aeb3e88L,0x2d50b5ceL,0x9579e790L,0x42b13cfcL,0x33fbd32bL, +/* 45*/ 0xee0503a7L,0xb5862824L,0x15e41eadL,0xc8412ef7L,0x9d441275L, +/* 50*/ 0x2fcec582L,0x5ff483b7L,0x8f3931dfL,0x2e5d2a7bL,0x49467bf9L, +/* 55*/ 0x0653dea9L,0x2684ce35L,0x7e655e5cL,0xf12771d8L,0xbb15cc67L, +/* 60*/ 0xab097ca1L,0x983dcf52L,0x10ddf026L,0x21267f57L,0x2c58f6b4L, +/* 65*/ 0x31043265L,0x0bab8c01L,0xd5492099L,0xacaae619L,0x944ce54aL, +/* 70*/ 0xf2d13d39L,0xadd3fc32L,0xcda08a40L,0xe2b0d451L,0x9efe08aeL, +/* 75*/ 0xb9d50fd2L,0xea5cd7fdL,0xc9a749ddL,0x13ea2253L,0x832debaaL, +/* 80*/ 0x24be640fL,0xe03e926aL,0x29e01cdeL,0x8bf59f18L,0x0f9d00b6L, +/* 85*/ 0xe1238b46L,0x1e7d8e34L,0x93619adbL,0x76b32f9fL,0xbd972cecL, +/* 90*/ 0xe31fa976L,0xa68fbb10L,0xfb3ba49dL,0x8587c41dL,0xa5add1d0L, +/* 95*/ 0xf3cf84bfL,0xd4e11150L,0xd9ffa6bcL,0xc3f6018cL,0xaef10572L, +/* 100*/ 0x74a64b2fL,0xe7dc9559L,0x2aae35d5L,0x5b6f587fL,0xa9e353feL, +/* 105*/ 0xca4fb674L,0x04ba24a8L,0xe5c6875fL,0xdcbc6266L,0x6bc5c03fL, +/* 110*/ 0x661eef02L,0xed740babL,0x058e34e4L,0xb7e946cfL,0x88698125L, +/* 115*/ 0x72ec48edL,0xb11073a3L,0xa13485ebL,0xa2a2429cL,0xfa407547L, +/* 120*/ 0x50b76713L,0x5418c37dL,0x96192da5L,0x170bb04bL,0x518a021eL, +/* 125*/ 0xb0ac13d1L,0x0963fa2aL,0x4a6e10e1L,0x58472bdcL,0xf7f8d962L, +/* 130*/ 0x979139eaL,0x8d856538L,0xc0997042L,0x48324d7aL,0x447623cbL, +/* 135*/ 0x8cbbe364L,0x6e0c6b0eL,0xd36d63b0L,0x3f244c84L,0x3542c971L, +/* 140*/ 0x2b228dc1L,0xcb0325bbL,0xf8c0d6e9L,0xde11066bL,0xa8649327L, +/* 145*/ 0xfc31f83eL,0x7dd80406L,0xf916dd61L,0xd89f79d3L,0x615144c2L, +/* 150*/ 0xebb45d31L,0x28002958L,0x56890a37L,0xf05b3808L,0x123ae844L, +/* 155*/ 0x86839e16L,0x914b0d83L,0xc506b43cL,0xcf3cba5eL,0x7c60f5c9L, +/* 160*/ 0x22deb2a0L,0x5d9c2715L,0xc77ba0efL,0x4f45360bL,0xc1017d8bL, +/* 165*/ 0xe45adc29L,0xa759909bL,0x412cd293L,0xd7d796b1L,0x00c8ff30L, +/* 170*/ 0x23a34a80L,0x4ec15c91L,0x714e78b5L,0x47b9e42eL,0x78f3ea4dL, +/* 175*/ 0x7f078f5bL,0x346c593aL,0xa3a87a1aL,0x9bcbfe12L,0x3d439963L, +/* 180*/ 0xb2ef6d8eL,0xb8d46028L,0x6c2fd5caL,0x62675256L,0x01f2a2f3L, +/* 185*/ 0xbc96ae0aL,0x709a8920L,0xb4146e87L,0x6308b9e2L,0x64bda7baL, +/* 190*/ 0xafed6892L,0x6037f2a2L,0xf52969e0L,0x0adb43a6L,0x82811400L, +/* 195*/ 0x90d0bdf0L,0x19c9549eL,0x203f6a73L,0x1accaf4fL,0x89714e6dL, +/* 200*/ 0x164d4705L,0x67665f07L,0xec206170L,0x0c2182b2L,0xa02b9c81L, +/* 205*/ 0x53289722L,0xf6a97686L,0x140e4179L,0x9f778849L,0x9a88e15dL, +/* 210*/ 0x25cadb54L,0xd157f36fL,0x32a421c3L,0xb368e98aL,0x5a92cd0dL, +/* 215*/ 0x757aa8d4L,0xc20ac278L,0x08b551c7L,0x849491e8L,0x4dc75ad6L, +/* 220*/ 0x697c33beL,0xbaf0ca33L,0x46125b4eL,0x59d677b3L,0x30d9c8f2L, +/* 225*/ 0xd0af860cL,0x1c7fd0faL,0xfe0ff72cL,0x5c8d6f43L,0x57fdec3bL, +/* 230*/ 0x6ab6ad97L,0xd22adf89L,0x18171785L,0x02bfe22dL,0x6db80917L, +/* 235*/ 0x80b216afL,0xe85e4f9aL,0x7a1c306eL,0x6fc49bf5L,0x3af7a11cL, +/* 240*/ 0x81e215e7L,0x68363fcdL,0x3e9357c8L,0xef52fd55L,0x3b8bab4cL, +/* 245*/ 0x3c8cf495L,0xbefceebdL,0xfd25b714L,0xc498d83dL,0x0d2e1a8dL, +/* 250*/ 0xe9f966acL,0x0e387445L,0x435419e5L,0x5e7ebec4L,0xaa90b8d9L, +/* 255*/ 0xff1a3a96L + /* End of S Box 1 */ }, + + + { /* Start of S Box 2 */ + +/* 0*/ 0x4a8fe4e3L,0xf27d99cdL,0xd04a40caL,0xcb5ff194L,0x3668275aL, +/* 5*/ 0xff4816beL,0xa78b394cL,0x4c6be9dbL,0x4eec38d2L,0x4296ec80L, +/* 10*/ 0xcdce96f8L,0x888c2f38L,0xe75508f5L,0x7b916414L,0x060aa14aL, +/* 15*/ 0xa214f327L,0xbe608dafL,0x1ebbdec2L,0x61f98ce9L,0xe92156feL, +/* 20*/ 0x4f22d7a3L,0x3f76a8d9L,0x559a4b33L,0x38ad2959L,0xf3f17e9eL, +/* 25*/ 0x85e1ba91L,0xe5eba6fbL,0x73dcd48cL,0xf5c3ff78L,0x481b6058L, +/* 30*/ 0x8a3297f7L,0x8f1f3bf4L,0x93785ab2L,0x477a4a5bL,0x6334eb5dL, +/* 35*/ 0x6d251b2eL,0x74a9102dL,0x07e38ffaL,0x915c9c62L,0xccc275eaL, +/* 40*/ 0x6be273ecL,0x3ebddd70L,0xd895796cL,0xdc54a91bL,0xc9afdf81L, +/* 45*/ 0x23633f73L,0x275119b4L,0xb19f6b67L,0x50756e22L,0x2bb152e2L, +/* 50*/ 0x76ea46a2L,0xa353e232L,0x2f596ad6L,0x0b1edb0bL,0x02d3d9a4L, +/* 55*/ 0x78b47843L,0x64893e90L,0x40f0caadL,0xf68d3ad7L,0x46fd1707L, +/* 60*/ 0x1c9c67efL,0xb5e086deL,0x96ee6ca6L,0x9aa34774L,0x1ba4f48aL, +/* 65*/ 0x8d01abfdL,0x183ee1f6L,0x5ff8aa7aL,0x17e4faaeL,0x303983b0L, +/* 70*/ 0x6c08668bL,0xd4ac4382L,0xe6c5849fL,0x92fefb53L,0xc1cac4ceL, +/* 75*/ 0x43501388L,0x441118cfL,0xec4fb308L,0x53a08e86L,0x9e0fe0c5L, +/* 80*/ 0xf91c1525L,0xac45be05L,0xd7987cb5L,0x49ba1487L,0x57938940L, +/* 85*/ 0xd5877648L,0xa958727fL,0x58dfe3c3L,0xf436cf77L,0x399e4d11L, +/* 90*/ 0xf0a5bfa9L,0xef61a33bL,0xa64cac60L,0x04a8d0baL,0x030dd572L, +/* 95*/ 0xb83d320fL,0xcab23045L,0xe366f2f0L,0x815d008dL,0xc897a43aL, +/* 100*/ 0x1d352df3L,0xb9cc571dL,0x8bf38744L,0x72209092L,0xeba124ebL, +/* 105*/ 0xfb99ce5eL,0x3bb94293L,0x28da549cL,0xaab8a228L,0xa4197785L, +/* 110*/ 0x33c70296L,0x25f6259bL,0x5c85da21L,0xdf15bdeeL,0x15b7c7e8L, +/* 115*/ 0xe2abef75L,0xfcc19bc1L,0x417ff868L,0x14884434L,0x62825179L, +/* 120*/ 0xc6d5c11cL,0x0e4705dcL,0x22700de0L,0xd3d2af18L,0x9be822a0L, +/* 125*/ 0x35b669f1L,0xc42bb55cL,0x0a801252L,0x115bf0fcL,0x3cd7d856L, +/* 130*/ 0xb43f5f9dL,0xc2306516L,0xa1231c47L,0xf149207eL,0x5209a795L, +/* 135*/ 0x34b3ccd8L,0x67aefe54L,0x2c83924eL,0x6662cbacL,0x5eedd161L, +/* 140*/ 0x84e681aaL,0x5d57d26bL,0xfa465cc4L,0x7e3ac3a8L,0xbf7c0cc6L, +/* 145*/ 0xe18a9aa1L,0xc32f0a6fL,0xb22cc00dL,0x3d280369L,0x994e554fL, +/* 150*/ 0x68f480d3L,0xadcff5e6L,0x3a8eb265L,0x83269831L,0xbd568a09L, +/* 155*/ 0x4bc8ae6aL,0x69f56d2bL,0x0f17eac8L,0x772eb6c7L,0x9f41343cL, +/* 160*/ 0xab1d0742L,0x826a6f50L,0xfea2097cL,0x1912c283L,0xce185899L, +/* 165*/ 0xe4444839L,0x2d8635d5L,0x65d0b1ffL,0x865a7f17L,0x326d9fb1L, +/* 170*/ 0x59e52820L,0x0090ade1L,0x753c7149L,0x9ddd8b98L,0xa5a691daL, +/* 175*/ 0x0d0382bbL,0x8904c930L,0x086cb000L,0x6e69d3bdL,0x24d4e7a7L, +/* 180*/ 0x05244fd0L,0x101a5e0cL,0x6a947dcbL,0xe840f77bL,0x7d0c5003L, +/* 185*/ 0x7c370f1fL,0x805245edL,0xe05e3d3fL,0x7906880eL,0xbabfcd35L, +/* 190*/ 0x1a7ec697L,0x8c052324L,0x0c6ec8dfL,0xd129a589L,0xc7a75b02L, +/* 195*/ 0x12d81de7L,0xd9be2a66L,0x1f4263abL,0xde73fdb6L,0x2a00680aL, +/* 200*/ 0x56649e36L,0x3133ed55L,0x90fa0bf2L,0x2910a02aL,0x949d9d46L, +/* 205*/ 0xa0d1dcddL,0xcfc9b7d4L,0xd2677be5L,0x95cb36b3L,0x13cd9410L, +/* 210*/ 0xdbf73313L,0xb7c6e8c0L,0xf781414bL,0x510b016dL,0xb0de1157L, +/* 215*/ 0xd6b0f62cL,0xbb074eccL,0x7f1395b7L,0xee792cf9L,0xea6fd63eL, +/* 220*/ 0x5bd6938eL,0xaf02fc64L,0xdab57ab8L,0x8edb3784L,0x8716318fL, +/* 225*/ 0x164d1a01L,0x26f26141L,0xb372e6b9L,0xf8fc2b06L,0x7ac00e04L, +/* 230*/ 0x3727b89aL,0x97e9bca5L,0x9c2a742fL,0xbc3b1f7dL,0x7165b471L, +/* 235*/ 0x609b4c29L,0x20925351L,0x5ae72112L,0x454be5d1L,0xc0ffb95fL, +/* 240*/ 0xdd0ef919L,0x6f2d70c9L,0x0974c5bfL,0x98aa6263L,0x01d91e4dL, +/* 245*/ 0x2184bb6eL,0x70c43c1eL,0x4d435915L,0xae7b8523L,0xb6fb06bcL, +/* 250*/ 0x5431ee76L,0xfdbc5d26L,0xed77493dL,0xc5712ee4L,0xa8380437L, +/* 255*/ 0x2eef261aL + /* End of S Box 2 */ }, + + + { /* Start of S Box 3 */ + +/* 0*/ 0x5a79392bL,0xb8af32c2L,0x41f7720aL,0x833a61ecL,0x13dfedacL, +/* 5*/ 0xc4990bc4L,0xdc0f54bcL,0xfedd5e88L,0x80da1881L,0x4dea1afdL, +/* 10*/ 0xfd402cc6L,0xae67cc7aL,0xc5238525L,0x8ea01254L,0xb56b9bd5L, +/* 15*/ 0x862fbd6dL,0xac8575d3L,0x6fba3714L,0xda7ebf46L,0x59cd5238L, +/* 20*/ 0x8ac9dbfeL,0x353729fcL,0xe497d7f2L,0xc3ab84e0L,0xf05a114bL, +/* 25*/ 0x7b887a75L,0xedc603ddL,0x5e6fe680L,0x2c84b399L,0x884eb1daL, +/* 30*/ 0x1cb8c8bfL,0xaa51098aL,0xc862231cL,0x8bac2221L,0x21b387e5L, +/* 35*/ 0x208a430dL,0x2a3f0f8bL,0xa5ff9cd2L,0x6012a2eaL,0x147a9ee7L, +/* 40*/ 0xf62a501dL,0xb4b2e51aL,0x3ef3484cL,0xc0253c59L,0x2b82b536L, +/* 45*/ 0x0aa9696bL,0xbe0c109bL,0xc70b7929L,0xce3e8a19L,0x2f66950eL, +/* 50*/ 0x459f1c2cL,0xe68fb93dL,0xa3c3ff3eL,0x62b45c62L,0x300991cbL, +/* 55*/ 0x01914c57L,0x7f7bc06aL,0x182831f5L,0xe7b74bcaL,0xfa50f6d0L, +/* 60*/ 0x523caa61L,0xe3a7cf05L,0xe9e41311L,0x280a21d1L,0x6a4297e1L, +/* 65*/ 0xf24dc67eL,0xfc3189e6L,0xb72bf34fL,0x4b1e67afL,0x543402ceL, +/* 70*/ 0x79a59867L,0x0648e02aL,0x00a3ac17L,0xc6208d35L,0x6e7f5f76L, +/* 75*/ 0xa45bb4beL,0xf168fa63L,0x3f4125f3L,0xf311406fL,0x02706565L, +/* 80*/ 0xbfe58022L,0x0cfcfdd9L,0x0735a7f7L,0x8f049092L,0xd98edc27L, +/* 85*/ 0xf5c5d55cL,0xe0f201dbL,0x0dcafc9aL,0x7727fb79L,0xaf43abf4L, +/* 90*/ 0x26e938c1L,0x401b26a6L,0x900720faL,0x2752d97bL,0xcff1d1b3L, +/* 95*/ 0xa9d9e424L,0x42db99abL,0x6cf8be5fL,0xe82cebe3L,0x3afb733bL, +/* 100*/ 0x6b734eb6L,0x1036414aL,0x975f667cL,0x049d6377L,0xba587c60L, +/* 105*/ 0xb1d10483L,0xde1aefccL,0x1129d055L,0x72051e91L,0x6946d623L, +/* 110*/ 0xf9e86ea7L,0x48768c00L,0xb0166c93L,0x9956bbf0L,0x1f1f6d84L, +/* 115*/ 0xfb15e18eL,0x033b495dL,0x56e3362eL,0x4f44c53cL,0x747cba51L, +/* 120*/ 0x89d37872L,0x5d9c331bL,0xd2ef9fa8L,0x254917f8L,0x1b106f47L, +/* 125*/ 0x37d75553L,0xb3f053b0L,0x7dccd8efL,0xd30eb802L,0x5889f42dL, +/* 130*/ 0x610206d7L,0x1a7d34a1L,0x92d87dd8L,0xe5f4a315L,0xd1cf0e71L, +/* 135*/ 0xb22dfe45L,0xb901e8ebL,0x0fc0ce5eL,0x2efa60c9L,0x2de74290L, +/* 140*/ 0x36d0c906L,0x381c70e4L,0x4c6da5b5L,0x3d81a682L,0x7e381f34L, +/* 145*/ 0x396c4f52L,0x95ad5901L,0x1db50c5aL,0x29982e9eL,0x1557689fL, +/* 150*/ 0x3471ee42L,0xd7e2f7c0L,0x8795a1e2L,0xbc324d8dL,0xe224c3c8L, +/* 155*/ 0x12837e39L,0xcdee3d74L,0x7ad2143fL,0x0e13d40cL,0x78bd4a68L, +/* 160*/ 0xa2eb194dL,0xdb9451f9L,0x859b71dcL,0x5c4f5b89L,0xca14a8a4L, +/* 165*/ 0xef92f003L,0x16741d98L,0x33aa4444L,0x9e967fbbL,0x092e3020L, +/* 170*/ 0xd86a35b8L,0x8cc17b10L,0xe1bf08aeL,0x55693fc5L,0x7680ad13L, +/* 175*/ 0x1e6546e8L,0x23b6e7b9L,0xee77a4b2L,0x08ed0533L,0x44fd2895L, +/* 180*/ 0xb6393b69L,0x05d6cacfL,0x9819b209L,0xecbbb72fL,0x9a75779cL, +/* 185*/ 0xeaec0749L,0x94a65aeeL,0xbdf52dc3L,0xd6a25d04L,0x82008e4eL, +/* 190*/ 0xa6de160fL,0x9b036afbL,0x228b3a66L,0x5fb10a70L,0xcc338b58L, +/* 195*/ 0x5378a9dfL,0xc908bca9L,0x4959e25bL,0x46909a97L,0x66ae8f6eL, +/* 200*/ 0xdd0683e9L,0x65f994b4L,0x6426cda5L,0xc24b8840L,0x32539da0L, +/* 205*/ 0x63175650L,0xd0c815ffL,0x50cbc41eL,0xf7c774a3L,0x31b0c231L, +/* 210*/ 0x8d0d8116L,0x24bef16cL,0xd555d256L,0xdf47ea8cL,0x6d21eccdL, +/* 215*/ 0xa887a012L,0x84542aedL,0xa7b9c1bdL,0x914c1bb1L,0xa0d5b67dL, +/* 220*/ 0x438ce937L,0x7030f873L,0x71f6b0c7L,0x574576baL,0xf8bc4541L, +/* 225*/ 0x9c61d348L,0x1960579dL,0x17c4daadL,0x96a4cb0bL,0xc193f2f6L, +/* 230*/ 0x756eafa2L,0x7c1d2f94L,0xf4fe2b43L,0xcb86e33aL,0xebd4c728L, +/* 235*/ 0x9d18ae64L,0x9fe13e30L,0x3ce0f5deL,0xaba1f985L,0xaddc2718L, +/* 240*/ 0x68ce6278L,0xd45e241fL,0xa15c82b7L,0x3b2293d4L,0x739edd32L, +/* 245*/ 0x674a6bf1L,0x5b5d587fL,0x4772deaaL,0x4a63968fL,0x0be68686L, +/* 250*/ 0x513d6426L,0x939a4787L,0xbba89296L,0x4ec20007L,0x818d0d08L, +/* 255*/ 0xff64dfd6L + /* End of S Box 3 */ }, + + + { /* Start of S Box 4 */ + +/* 0*/ 0xcb2297cbL,0xdb48a144L,0xa16cbe4bL,0xbbea1d6cL,0x5af6b6b7L, +/* 5*/ 0x8a8110b6L,0xf9236ef9L,0xc98f83e6L,0x0f9c65b8L,0x252d4a89L, +/* 10*/ 0xa497f068L,0xa5d7ed2dL,0x94c22845L,0x9da1c8c4L,0xe27c2e2eL, +/* 15*/ 0x6e8ba2b4L,0xc3dd17fbL,0x498cd482L,0x0dfe6a9fL,0xb0705829L, +/* 20*/ 0x9a1e6dc1L,0xf829717cL,0x07bb8e3aL,0xda3c0b02L,0x1af82fc7L, +/* 25*/ 0x73b70955L,0x7a04379cL,0x5ee20a28L,0x83712ae5L,0xf4c47c6dL, +/* 30*/ 0xdf72ba56L,0xd794858dL,0x8c0cf709L,0x18f0f390L,0xb6c69b35L, +/* 35*/ 0xbf2f01dbL,0x2fa74dcaL,0xd0cd9127L,0xbde66cecL,0x3deebd46L, +/* 40*/ 0x57c88fc3L,0xcee1406fL,0x0066385aL,0xf3c3444fL,0x3a79d5d5L, +/* 45*/ 0x75751eb9L,0x3e7f8185L,0x521c2605L,0xe1aaab6eL,0x38ebb80fL, +/* 50*/ 0xbee7e904L,0x61cb9647L,0xea54904eL,0x05ae00e4L,0x2d7ac65fL, +/* 55*/ 0x087751a1L,0xdcd82915L,0x0921ee16L,0xdd86d33bL,0xd6bd491aL, +/* 60*/ 0x40fbadf0L,0x4232cbd2L,0x33808d10L,0x39098c42L,0x193f3199L, +/* 65*/ 0x0bc1e47aL,0x4a82b149L,0x02b65a8aL,0x104cdc8eL,0x24a8f52cL, +/* 70*/ 0x685c6077L,0xc79f95c9L,0x1d11fe50L,0xc08dafcdL,0x7b1a9a03L, +/* 75*/ 0x1c1f11d8L,0x84250e7fL,0x979db248L,0xebdc0501L,0xb9553395L, +/* 80*/ 0xe3c05ea8L,0xb1e51c4cL,0x13b0e681L,0x3b407766L,0x36db3087L, +/* 85*/ 0xee17c9fcL,0x6c53ecf2L,0xadccc58fL,0xc427660bL,0xefd5867dL, +/* 90*/ 0x9b6d54a5L,0x6ff1aeffL,0x8e787952L,0x9e2bffe0L,0x8761d034L, +/* 95*/ 0xe00bdbadL,0xae99a8d3L,0xcc03f6e2L,0xfd0ed807L,0x0e508ae3L, +/* 100*/ 0xb74182abL,0x4349245dL,0xd120a465L,0xb246a641L,0xaf3b7ab0L, +/* 105*/ 0x2a6488bbL,0x4b3a0d1fL,0xe7c7e58cL,0x3faff2ebL,0x90445ffdL, +/* 110*/ 0xcf38c393L,0x995d07e7L,0xf24f1b36L,0x356f6891L,0x6d6ebcbeL, +/* 115*/ 0x8da9e262L,0x50fd520eL,0x5bca9e1eL,0x37472cf3L,0x69075057L, +/* 120*/ 0x7ec5fdedL,0x0cab892aL,0xfb2412baL,0x1728debfL,0xa000a988L, +/* 125*/ 0xd843ce79L,0x042e20ddL,0x4fe8f853L,0x56659c3cL,0x2739d119L, +/* 130*/ 0xa78a6120L,0x80960375L,0x70420611L,0x85e09f78L,0xabd17e96L, +/* 135*/ 0x1b513eafL,0x1e01eb63L,0x26ad2133L,0xa890c094L,0x7613cf60L, +/* 140*/ 0x817e781bL,0xa39113d7L,0xe957fa58L,0x4131b99eL,0x28b1efdaL, +/* 145*/ 0x66acfba7L,0xff68944aL,0x77a44fd1L,0x7f331522L,0x59ffb3faL, +/* 150*/ 0xa6df935bL,0xfa12d9dfL,0xc6bf6f3fL,0x89520cf6L,0x659edd6aL, +/* 155*/ 0x544da739L,0x8b052538L,0x7c30ea21L,0xc2345525L,0x15927fb2L, +/* 160*/ 0x144a436bL,0xba107b8bL,0x1219ac97L,0x06730432L,0x31831ab3L, +/* 165*/ 0xc55a5c24L,0xaa0fcd3eL,0xe5606be8L,0x5c88f19bL,0x4c0841eeL, +/* 170*/ 0x1fe37267L,0x11f9c4f4L,0x9f1b9daeL,0x864e76d0L,0xe637c731L, +/* 175*/ 0xd97d23a6L,0x32f53d5cL,0xb8161980L,0x93fa0f84L,0xcaef0870L, +/* 180*/ 0x8874487eL,0x98f2cc73L,0x645fb5c6L,0xcd853659L,0x2062470dL, +/* 185*/ 0x16ede8e9L,0x6b06dab5L,0x78b43900L,0xfc95b786L,0x5d8e7de1L, +/* 190*/ 0x465b5954L,0xfe7ba014L,0xf7d23f7bL,0x92bc8b18L,0x03593592L, +/* 195*/ 0x55cef4f7L,0x74b27317L,0x79de1fc2L,0xc8a0bfbdL,0x229398ccL, +/* 200*/ 0x62a602ceL,0xbcb94661L,0x5336d206L,0xd2a375feL,0x6a6ab483L, +/* 205*/ 0x4702a5a4L,0xa2e9d73dL,0x23a2e0f1L,0x9189140aL,0x581d18dcL, +/* 210*/ 0xb39a922bL,0x82356212L,0xd5f432a9L,0xd356c2a3L,0x5f765b4dL, +/* 215*/ 0x450afcc8L,0x4415e137L,0xe8ecdfbcL,0xed0de3eaL,0x60d42b13L, +/* 220*/ 0xf13df971L,0x71fc5da2L,0xc1455340L,0xf087742fL,0xf55e5751L, +/* 225*/ 0x67b3c1f8L,0xac6b8774L,0x7dcfaaacL,0x95983bc0L,0x489bb0b1L, +/* 230*/ 0x2c184223L,0x964b6726L,0x2bd3271cL,0x72266472L,0xded64530L, +/* 235*/ 0x0a2aa343L,0xd4f716a0L,0xb4dad6d9L,0x2184345eL,0x512c990cL, +/* 240*/ 0x29d92d08L,0x2ebe709aL,0x01144c69L,0x34584b9dL,0xe4634ed6L, +/* 245*/ 0xecc963cfL,0x3c6984aaL,0x4ed056efL,0x9ca56976L,0x8f3e80d4L, +/* 250*/ 0xb5bae7c5L,0x30b5caf5L,0x63f33a64L,0xa9e4bbdeL,0xf6b82298L, +/* 255*/ 0x4d673c1dL + /* End of S Box 4 */ }, + + + { /* Start of S Box 5 */ + +/* 0*/ 0x4b4f1121L,0xba183081L,0xc784f41fL,0xd17d0bacL,0x083d2267L, +/* 5*/ 0x37b1361eL,0x3581ad05L,0xfda2f6bcL,0x1e892cddL,0xb56d3c3aL, +/* 10*/ 0x32140e46L,0x138d8aabL,0xe14773d4L,0x5b0e71dfL,0x5d1fe055L, +/* 15*/ 0x3fb991d3L,0xf1f46c71L,0xa325988cL,0x10f66e80L,0xb1006348L, +/* 20*/ 0x726a9f60L,0x3b67f8baL,0x4e114ef4L,0x05c52115L,0x4c5ca11cL, +/* 25*/ 0x99e1efd8L,0x471b83b3L,0xcbf7e524L,0x43ad82f5L,0x690ca93bL, +/* 30*/ 0xfaa61bb2L,0x12a832b5L,0xb734f943L,0xbd22aea7L,0x88fec626L, +/* 35*/ 0x5e80c3e7L,0xbe3eaf5eL,0x44617652L,0xa5724475L,0xbb3b9695L, +/* 40*/ 0x7f3fee8fL,0x964e7debL,0x518c052dL,0x2a0bbc2bL,0xc2175f5cL, +/* 45*/ 0x9a7b3889L,0xa70d8d0cL,0xeaccdd29L,0xcccd6658L,0x34bb25e6L, +/* 50*/ 0xb8391090L,0xf651356fL,0x52987c9eL,0x0c16c1cdL,0x8e372d3cL, +/* 55*/ 0x2fc6ebbdL,0x6e5da3e3L,0xb0e27239L,0x5f685738L,0x45411786L, +/* 60*/ 0x067f65f8L,0x61778b40L,0x81ab2e65L,0x14c8f0f9L,0xa6b7b4ceL, +/* 65*/ 0x4036eaecL,0xbf62b00aL,0xecfd5e02L,0x045449a6L,0xb20afd28L, +/* 70*/ 0x2166d273L,0x0d13a863L,0x89508756L,0xd51a7530L,0x2d653f7aL, +/* 75*/ 0x3cdbdbc3L,0x80c9df4fL,0x3d5812d9L,0x53fbb1f3L,0xc0f185c0L, +/* 80*/ 0x7a3c3d7eL,0x68646410L,0x857607a0L,0x1d12622eL,0x97f33466L, +/* 85*/ 0xdb4c9917L,0x6469607cL,0x566e043dL,0x79ef1edbL,0x2c05898dL, +/* 90*/ 0xc9578e25L,0xcd380101L,0x46e04377L,0x7d1cc7a9L,0x6552b837L, +/* 95*/ 0x20192608L,0xb97500c5L,0xed296b44L,0x368648b4L,0x62995cd5L, +/* 100*/ 0x82731400L,0xf9aebd8bL,0x3844c0c7L,0x7c2de794L,0x33a1a770L, +/* 105*/ 0x8ae528c2L,0x5a2be812L,0x1f8f4a07L,0x2b5ed7caL,0x937eb564L, +/* 110*/ 0x6fda7e11L,0xe49b5d6cL,0xb4b3244eL,0x18aa53a4L,0x3a061334L, +/* 115*/ 0x4d6067a3L,0x83ba5868L,0x9bdf4dfeL,0x7449f261L,0x709f8450L, +/* 120*/ 0xcad133cbL,0xde941c3fL,0xf52ae484L,0x781d77edL,0x7e4395f0L, +/* 125*/ 0xae103b59L,0x922331bbL,0x42ce50c8L,0xe6f08153L,0xe7d941d0L, +/* 130*/ 0x5028ed6bL,0xb3d2c49bL,0xad4d9c3eL,0xd201fb6eL,0xa45bd5beL, +/* 135*/ 0xffcb7f4bL,0x579d7806L,0xf821bb5bL,0x59d592adL,0xd0be0c31L, +/* 140*/ 0xd4e3b676L,0x0107165aL,0x0fe939d2L,0x49bcaafdL,0x55ffcfe5L, +/* 145*/ 0x2ec1f783L,0xf39a09a5L,0x3eb42772L,0x19b55a5dL,0x024a0679L, +/* 150*/ 0x8c83b3f7L,0x8642ba1dL,0xacacd9eaL,0x87d352c4L,0x60931f45L, +/* 155*/ 0xa05f97d7L,0x1cecd42cL,0xe2fcc87bL,0xb60f94e2L,0x67a34b0bL, +/* 160*/ 0xfcdd40c9L,0x0b150a27L,0xd3ee9e04L,0x582e29e9L,0x4ac22b41L, +/* 165*/ 0x6ac4e1b8L,0xbccaa51aL,0x237af30eL,0xebc3b709L,0xc4a59d19L, +/* 170*/ 0x284bc98aL,0xe9d41a93L,0x6bfa2018L,0x73b2d651L,0x11f9a2faL, +/* 175*/ 0xce09bff1L,0x41a470aaL,0x25888f22L,0x77e754e8L,0xf7330d8eL, +/* 180*/ 0x158eab16L,0xc5d68842L,0xc685a6f6L,0xe5b82fdeL,0x09ea3a96L, +/* 185*/ 0x6dde1536L,0x4fa919daL,0x26c0be9fL,0x9eed6f69L,0xf05555f2L, +/* 190*/ 0xe06fc285L,0x9cd76d23L,0xaf452a92L,0xefc74cb7L,0x9d6b4732L, +/* 195*/ 0x8be408eeL,0x22401d0dL,0xee6c459dL,0x7587cb82L,0xe8746862L, +/* 200*/ 0x5cbdde87L,0x98794278L,0x31afb94dL,0xc11e0f2fL,0x30e8fc2aL, +/* 205*/ 0xcf3261efL,0x1a3023e1L,0xaa2f86cfL,0xf202e24aL,0x8d08dcffL, +/* 210*/ 0x764837c6L,0xa26374ccL,0x9f7c3e88L,0x949cc57dL,0xdd26a07fL, +/* 215*/ 0xc39efab0L,0xc8f879a1L,0xdce67bb9L,0xf4b0a435L,0x912c9ae0L, +/* 220*/ 0xd85603e4L,0x953a9bbfL,0xfb8290d6L,0x0aebcd5fL,0x16206a9aL, +/* 225*/ 0x6c787a14L,0xd9a0f16aL,0x29bf4f74L,0x8f8bce91L,0x0e5a9354L, +/* 230*/ 0xab038cb1L,0x1b8ad11bL,0xe327ff49L,0x0053da20L,0x90cf51dcL, +/* 235*/ 0xda92fe6dL,0x0390ca47L,0xa8958097L,0xa9dc5bafL,0x3931e3c1L, +/* 240*/ 0x840446b6L,0x63d069fbL,0xd7460299L,0x7124ecd1L,0x0791e613L, +/* 245*/ 0x485918fcL,0xd635d04cL,0xdf96ac33L,0x66f2d303L,0x247056aeL, +/* 250*/ 0xa1a7b2a8L,0x27d8cc9cL,0x17b6e998L,0x7bf5590fL,0xfe97f557L, +/* 255*/ 0x5471d8a2L + /* End of S Box 5 */ }, + + + { /* Start of S Box 6 */ + +/* 0*/ 0x83a327a1L,0x9f379f51L,0x40a7d007L,0x11307423L,0x224587c1L, +/* 5*/ 0xac27d63bL,0x3b7e64eaL,0x2e1cbfa6L,0x09996000L,0x03bc0e2cL, +/* 10*/ 0xd4c4478aL,0x4542e0abL,0xfeda26d4L,0xc1d10fcbL,0x8252f596L, +/* 15*/ 0x4494eb5cL,0xa362f314L,0xf5ba81fdL,0x75c3a376L,0x4ca214caL, +/* 20*/ 0xe164deddL,0x5088fa97L,0x4b0930e0L,0x2fcfb7e8L,0x33a6f4b2L, +/* 25*/ 0xc7e94211L,0x2d66c774L,0x43be8baeL,0xc663d445L,0x908eb130L, +/* 30*/ 0xf4e3be15L,0x63b9d566L,0x529396b5L,0x1e1be743L,0x4d5ff63fL, +/* 35*/ 0x985e4a83L,0x71ab9df7L,0xc516c6f5L,0x85c19ab4L,0x1f4daee4L, +/* 40*/ 0xf2973431L,0xb713dc5eL,0x3f2e159aL,0xc824da16L,0x06bf376aL, +/* 45*/ 0xb2fe23ecL,0xe39b1c22L,0xf1eecb5fL,0x08e82d52L,0x565686c2L, +/* 50*/ 0xab0aea93L,0xfd47219fL,0xebdbabd7L,0x2404a185L,0x8c7312b9L, +/* 55*/ 0xa8f2d828L,0x0c8902daL,0x65b42b63L,0xc0bbef62L,0x4e3e4cefL, +/* 60*/ 0x788f8018L,0xee1ebab7L,0x93928f9dL,0x683d2903L,0xd3b60689L, +/* 65*/ 0xafcb0ddcL,0x88a4c47aL,0xf6dd9c3dL,0x7ea5fca0L,0x8a6d7244L, +/* 70*/ 0xbe11f120L,0x04ff91b8L,0x8d2dc8c0L,0x27f97fdbL,0x7f9e1f47L, +/* 75*/ 0x1734f0c7L,0x26f3ed8eL,0x0df8f2bfL,0xb0833d9eL,0xe420a4e5L, +/* 80*/ 0xa423cae6L,0x95616772L,0x9ae6c049L,0x075941f2L,0xd8e12812L, +/* 85*/ 0x000f6f4fL,0x3c0d6b05L,0x6cef921cL,0xb82bc264L,0x396cb008L, +/* 90*/ 0x5d608a6fL,0x6d7782c8L,0x186550aaL,0x6b6fec09L,0x28e70b13L, +/* 95*/ 0x57ce5688L,0xecd3af84L,0x23335a95L,0x91f40cd2L,0x7b6a3b26L, +/* 100*/ 0xbd32b3b6L,0x3754a6fbL,0x8ed088f0L,0xf867e87cL,0x20851746L, +/* 105*/ 0x6410f9c6L,0x35380442L,0xc2ca10a7L,0x1adea27fL,0x76bddd79L, +/* 110*/ 0x92742cf4L,0x0e98f7eeL,0x164e931dL,0xb9c835b3L,0x69060a99L, +/* 115*/ 0xb44c531eL,0xfa7b66feL,0xc98a5b53L,0x7d95aae9L,0x302f467bL, +/* 120*/ 0x74b811deL,0xf3866abdL,0xb5b3d32dL,0xfc3157a4L,0xd251fe19L, +/* 125*/ 0x0b5d8eacL,0xda71ffd5L,0x47ea05a3L,0x05c6a9e1L,0xca0ee958L, +/* 130*/ 0x9939034dL,0x25dc5edfL,0x79083cb1L,0x86768450L,0xcf757d6dL, +/* 135*/ 0x5972b6bcL,0xa78d59c9L,0xc4ad8d41L,0x2a362ad3L,0xd1179991L, +/* 140*/ 0x601407ffL,0xdcf50917L,0x587069d0L,0xe0821ed6L,0xdbb59427L, +/* 145*/ 0x73911a4bL,0x7c904fc3L,0x844afb92L,0x6f8c955dL,0xe8c0c5bbL, +/* 150*/ 0xb67ab987L,0xa529d96cL,0xf91f7181L,0x618b1b06L,0xe718bb0cL, +/* 155*/ 0x8bd7615bL,0xd5a93a59L,0x54aef81bL,0x772136e3L,0xce44fd9cL, +/* 160*/ 0x10cda57eL,0x87d66e0bL,0x3d798967L,0x1b2c1804L,0x3edfbd68L, +/* 165*/ 0x15f6e62bL,0xef68b854L,0x3896db35L,0x12b7b5e2L,0xcb489029L, +/* 170*/ 0x9e4f98a5L,0x62eb77a8L,0x217c24a2L,0x964152f6L,0x49b2080aL, +/* 175*/ 0x53d23ee7L,0x48fb6d69L,0x1903d190L,0x9449e494L,0xbf6e7886L, +/* 180*/ 0xfb356cfaL,0x3a261365L,0x424bc1ebL,0xa1192570L,0x019ca782L, +/* 185*/ 0x9d3f7e0eL,0x9c127575L,0xedf02039L,0xad57bcceL,0x5c153277L, +/* 190*/ 0x81a84540L,0xbcaa7356L,0xccd59b60L,0xa62a629bL,0xa25ccd10L, +/* 195*/ 0x2b5b65cfL,0x1c535832L,0x55fd4e3aL,0x31d9790dL,0xf06bc37dL, +/* 200*/ 0x4afc1d71L,0xaeed5533L,0xba461634L,0xbb694b78L,0x5f3a5c73L, +/* 205*/ 0x6a3c764aL,0x8fb0cca9L,0xf725684cL,0x4fe5382fL,0x1d0163afL, +/* 210*/ 0x5aa07a8fL,0xe205a8edL,0xc30bad38L,0xff22cf1fL,0x72432e2eL, +/* 215*/ 0x32c2518bL,0x3487ce4eL,0x7ae0ac02L,0x709fa098L,0x0a3b395aL, +/* 220*/ 0x5b4043f8L,0xa9e48c36L,0x149a8521L,0xd07dee6bL,0x46acd2f3L, +/* 225*/ 0x8958dffcL,0xb3a1223cL,0xb11d31c4L,0xcd7f4d3eL,0x0f28e3adL, +/* 230*/ 0xe5b100beL,0xaac54824L,0xe9c9d7baL,0x9bd47001L,0x80f149b0L, +/* 235*/ 0x66022f0fL,0x020c4048L,0x6efa192aL,0x67073f8dL,0x13ec7bf9L, +/* 240*/ 0x3655011aL,0xe6afe157L,0xd9845f6eL,0xdecc4425L,0x511ae2ccL, +/* 245*/ 0xdf81b4d8L,0xd7809e55L,0xd6d883d9L,0x2cc7978cL,0x5e787cc5L, +/* 250*/ 0xdd0033d1L,0xa050c937L,0x97f75dcdL,0x299de580L,0x41e2b261L, +/* 255*/ 0xea5a54f1L + /* End of S Box 6 */ }, + + + { /* Start of S Box 7 */ + +/* 0*/ 0x7e672590L,0xbea513bbL,0x2c906fe6L,0x86029c2bL,0x55dc4f74L, +/* 5*/ 0x0553398eL,0x63e09647L,0xcafd0babL,0x264c37dfL,0x8272210fL, +/* 10*/ 0x67afa669L,0x12d98a5fL,0x8cab23c4L,0x75c68bd1L,0xc3370470L, +/* 15*/ 0x33f37f4eL,0x283992ffL,0xe73a3a67L,0x1032f283L,0xf5ad9fc2L, +/* 20*/ 0x963f0c5dL,0x664fbc45L,0x202ba41cL,0xc7c02d80L,0x54731e84L, +/* 25*/ 0x8a1085f5L,0x601d80fbL,0x2f968e55L,0x35e96812L,0xe45a8f78L, +/* 30*/ 0xbd7de662L,0x3b6e6eadL,0x8097c5efL,0x070b6781L,0xb1e508f3L, +/* 35*/ 0x24e4fae3L,0xb81a7805L,0xec0fc918L,0x43c8774bL,0x9b2512a9L, +/* 40*/ 0x2b05ad04L,0x32c2536fL,0xedf236e0L,0x8bc4b0cfL,0xbaceb837L, +/* 45*/ 0x4535b289L,0x0d0e94c3L,0xa5a371d0L,0xad695a58L,0x39e3437dL, +/* 50*/ 0x9186bffcL,0x21038c3bL,0x0aa9dff9L,0x5d1f06ceL,0x62def8a4L, +/* 55*/ 0xf740a2b4L,0xa2575868L,0x682683c1L,0xdbb30facL,0x61fe1928L, +/* 60*/ 0x468a6511L,0xc61cd5f4L,0xe54d9800L,0x6b98d7f7L,0x8418b6a5L, +/* 65*/ 0x5f09a5d2L,0x90b4e80bL,0x49b2c852L,0x69f11c77L,0x17412b7eL, +/* 70*/ 0x7f6fc0edL,0x56838dccL,0x6e9546a2L,0xd0758619L,0x087b9b9aL, +/* 75*/ 0xd231a01dL,0xaf46d415L,0x097060fdL,0xd920f657L,0x882d3f9fL, +/* 80*/ 0x3ae7c3c9L,0xe8a00d9bL,0x4fe67ebeL,0x2ef80eb2L,0xc1916b0cL, +/* 85*/ 0xf4dffea0L,0xb97eb3ebL,0xfdff84ddL,0xff8b14f1L,0xe96b0572L, +/* 90*/ 0xf64b508cL,0xae220a6eL,0x4423ae5aL,0xc2bece5eL,0xde27567cL, +/* 95*/ 0xfc935c63L,0x47075573L,0xe65b27f0L,0xe121fd22L,0xf2668753L, +/* 100*/ 0x2debf5d7L,0x8347e08dL,0xac5eda03L,0x2a7cebe9L,0x3fe8d92eL, +/* 105*/ 0x23542fe4L,0x1fa7bd50L,0xcf9b4102L,0x9d0dba39L,0x9cb8902aL, +/* 110*/ 0xa7249d8bL,0x0f6d667aL,0x5ebfa9ecL,0x6a594df2L,0x79600938L, +/* 115*/ 0x023b7591L,0xea2c79c8L,0xc99d07eaL,0x64cb5ee1L,0x1a9cab3dL, +/* 120*/ 0x76db9527L,0xc08e012fL,0x3dfb481aL,0x872f22e7L,0x2948d15cL, +/* 125*/ 0xa4782c79L,0x6f50d232L,0x78f0728aL,0x5a87aab1L,0xc4e2c19cL, +/* 130*/ 0xee767387L,0x1b2a1864L,0x7b8d10d3L,0xd1713161L,0x0eeac456L, +/* 135*/ 0xd8799e06L,0xb645b548L,0x4043cb65L,0xa874fb29L,0x4b12d030L, +/* 140*/ 0x7d687413L,0x18ef9a1fL,0xd7631d4cL,0x5829c7daL,0xcdfa30faL, +/* 145*/ 0xc5084bb0L,0x92cd20e2L,0xd4c16940L,0x03283ec0L,0xa917813fL, +/* 150*/ 0x9a587d01L,0x70041f8fL,0xdc6ab1dcL,0xddaee3d5L,0x31829742L, +/* 155*/ 0x198c022dL,0x1c9eafcbL,0x5bbc6c49L,0xd3d3293aL,0x16d50007L, +/* 160*/ 0x04bb8820L,0x3c5c2a41L,0x37ee7af8L,0x8eb04025L,0x9313ecbaL, +/* 165*/ 0xbffc4799L,0x8955a744L,0xef85d633L,0x504499a7L,0xa6ca6a86L, +/* 170*/ 0xbb3d3297L,0xb34a8236L,0x6dccbe4fL,0x06143394L,0xce19fc7bL, +/* 175*/ 0xccc3c6c6L,0xe36254aeL,0x77b7eda1L,0xa133dd9eL,0xebf9356aL, +/* 180*/ 0x513ccf88L,0xe2a1b417L,0x972ee5bdL,0x853824cdL,0x5752f4eeL, +/* 185*/ 0x6c1142e8L,0x3ea4f309L,0xb2b5934aL,0xdfd628aaL,0x59acea3eL, +/* 190*/ 0xa01eb92cL,0x389964bcL,0xda305dd4L,0x019a59b7L,0x11d2ca93L, +/* 195*/ 0xfaa6d3b9L,0x4e772ecaL,0x72651776L,0xfb4e5b0eL,0xa38f91a8L, +/* 200*/ 0x1d0663b5L,0x30f4f192L,0xb50051b6L,0xb716ccb3L,0x4abd1b59L, +/* 205*/ 0x146c5f26L,0xf134e2deL,0x00f67c6cL,0xb0e1b795L,0x98aa4ec7L, +/* 210*/ 0x0cc73b34L,0x654276a3L,0x8d1ba871L,0x740a5216L,0xe0d01a23L, +/* 215*/ 0x9ed161d6L,0x9f36a324L,0x993ebb7fL,0xfeb9491bL,0x365ddcdbL, +/* 220*/ 0x810cffc5L,0x71ec0382L,0x2249e7bfL,0x48817046L,0xf3a24a5bL, +/* 225*/ 0x4288e4d9L,0x0bf5c243L,0x257fe151L,0x95b64c0dL,0x4164f066L, +/* 230*/ 0xaaf7db08L,0x73b1119dL,0x8f9f7bb8L,0xd6844596L,0xf07a34a6L, +/* 235*/ 0x53943d0aL,0xf9dd166dL,0x7a8957afL,0xf8ba3ce5L,0x27c9621eL, +/* 240*/ 0x5cdae910L,0xc8518998L,0x941538feL,0x136115d8L,0xaba8443cL, +/* 245*/ 0x4d01f931L,0x34edf760L,0xb45f266bL,0xd5d4de14L,0x52d8ac35L, +/* 250*/ 0x15cfd885L,0xcbc5cd21L,0x4cd76d4dL,0x7c80ef54L,0xbc92ee75L, +/* 255*/ 0x1e56a1f6L + /* End of S Box 7 */ }, + + + { /* Start of S Box 8 */ + +/* 0*/ 0xbaa20b6cL,0x9ffbad26L,0xe1f7d738L,0x794aec8dL,0xc9e9cf3cL, +/* 5*/ 0x8a9a7846L,0xc57c4685L,0xb9a92fedL,0x29cb141fL,0x52f9ddb7L, +/* 10*/ 0xf68ba6bcL,0x19ccc020L,0x4f584aaaL,0x3bf6a596L,0x003b7cf7L, +/* 15*/ 0x54f0ce9aL,0xa7ec4303L,0x46cf0077L,0x78d33aa1L,0x215247d9L, +/* 20*/ 0x74bcdf91L,0x08381d30L,0xdac43e40L,0x64872531L,0x0beffe5fL, +/* 25*/ 0xb317f457L,0xaebb12daL,0xd5d0d67bL,0x7d75c6b4L,0x42a6d241L, +/* 30*/ 0x1502d0a9L,0x3fd97fffL,0xc6c3ed28L,0x81868d0aL,0x92628bc5L, +/* 35*/ 0x86679544L,0xfd1867afL,0x5ca3ea61L,0x568d5578L,0x4a2d71f4L, +/* 40*/ 0x43c9d549L,0x8d95de2bL,0x6e5c74a0L,0x9120ffc7L,0x0d05d14aL, +/* 45*/ 0xa93049d3L,0xbfa80e17L,0xf4096810L,0x043f5ef5L,0xa673b4f1L, +/* 50*/ 0x6d780298L,0xa4847783L,0x5ee726fbL,0x9934c281L,0x220a588cL, +/* 55*/ 0x384e240fL,0x933d5c69L,0x39e5ef47L,0x26e8b8f3L,0x4c1c6212L, +/* 60*/ 0x8040f75dL,0x074b7093L,0x6625a8d7L,0x36298945L,0x76285088L, +/* 65*/ 0x651d37c3L,0x24f5274dL,0xdbca3dabL,0x186b7ee1L,0xd80f8182L, +/* 70*/ 0x14210c89L,0x943a3075L,0x4e6e11c4L,0x4d7e6badL,0xf05064c8L, +/* 75*/ 0x025dcd97L,0x4bc10302L,0x7cede572L,0x8f90a970L,0xab88eebaL, +/* 80*/ 0xb5998029L,0x5124d839L,0xb0eeb6a3L,0x89ddabdcL,0xe8074d76L, +/* 85*/ 0xa1465223L,0x32518cf2L,0x9d39d4ebL,0xc0d84524L,0xe35e6ea8L, +/* 90*/ 0x7abf3804L,0x113e2348L,0x9ae6069dL,0xb4dfdabbL,0xa8c5313fL, +/* 95*/ 0x23ea3f79L,0x530e36a2L,0xa5fd228bL,0x95d1d350L,0x2b14cc09L, +/* 100*/ 0x40042956L,0x879d05ccL,0x2064b9caL,0xacaca40eL,0xb29c846eL, +/* 105*/ 0x9676c9e3L,0x752b7b8aL,0x7be2bcc2L,0x6bd58f5eL,0xd48f4c32L, +/* 110*/ 0x606835e4L,0x9cd7c364L,0x2c269b7aL,0x3a0d079cL,0x73b683feL, +/* 115*/ 0x45374f1eL,0x10afa242L,0x577f8666L,0xddaa10f6L,0xf34f561cL, +/* 120*/ 0x3d355d6bL,0xe47048aeL,0xaa13c492L,0x050344fdL,0x2aab5151L, +/* 125*/ 0xf5b26ae5L,0xed919a59L,0x5ac67900L,0xf1cde380L,0x0c79a11bL, +/* 130*/ 0x351533fcL,0xcd4d8e36L,0x1f856005L,0x690b9fddL,0xe736dccfL, +/* 135*/ 0x1d47bf6aL,0x7f66c72aL,0x85f21b7fL,0x983cbdb6L,0x01ebbebfL, +/* 140*/ 0x035f3b99L,0xeb111f34L,0x28cefdc6L,0x5bfc9ecdL,0xf22eacb0L, +/* 145*/ 0x9e41cbb2L,0xe0f8327cL,0x82e3e26fL,0xfc43fc86L,0xd0ba66dfL, +/* 150*/ 0x489ef2a7L,0xd9e0c81dL,0x68690d52L,0xcc451367L,0xc2232e16L, +/* 155*/ 0xe95a7335L,0x0fdae19bL,0xff5b962cL,0x97596527L,0xc46db333L, +/* 160*/ 0x3ed4c562L,0xc14c9d9eL,0x5d6faa21L,0x638e940dL,0xf9316d58L, +/* 165*/ 0x47b3b0eaL,0x30ffcad2L,0xce1bba7dL,0x1e6108e6L,0x2e1ea33dL, +/* 170*/ 0x507bf05bL,0xfafef94bL,0xd17de8e2L,0x5598b214L,0x1663f813L, +/* 175*/ 0x17d25a2dL,0xeefa5ff9L,0x582f4e37L,0x12128773L,0xfef17ab8L, +/* 180*/ 0x06005322L,0xbb32bbc9L,0x8c898508L,0x592c15f0L,0xd38a4054L, +/* 185*/ 0x4957b7d6L,0xd2b891dbL,0x37bd2d3eL,0x34ad20cbL,0x622288e9L, +/* 190*/ 0x2dc7345aL,0xafb416c0L,0x1cf459b1L,0xdc7739faL,0x0a711a25L, +/* 195*/ 0x13e18a0cL,0x5f72af4cL,0x6ac8db11L,0xbe53c18eL,0x1aa569b9L, +/* 200*/ 0xef551ea4L,0xa02a429fL,0xbd16e790L,0x7eb9171aL,0x77d693d8L, +/* 205*/ 0x8e06993aL,0x9bde7560L,0xe5801987L,0xc37a09beL,0xb8db76acL, +/* 210*/ 0xe2087294L,0x6c81616dL,0xb7f30fe7L,0xbc9b82bdL,0xfba4e4d4L, +/* 215*/ 0xc7b1012fL,0xa20c043bL,0xde9febd0L,0x2f9297ceL,0xe610aef8L, +/* 220*/ 0x70b06f19L,0xc86ae00bL,0x0e01988fL,0x41192ae0L,0x448c1cb5L, +/* 225*/ 0xadbe92eeL,0x7293a007L,0x1b54b5b3L,0xd61f63d1L,0xeae40a74L, +/* 230*/ 0x61a72b55L,0xec83a7d5L,0x88942806L,0x90a07da5L,0xd7424b95L, +/* 235*/ 0x67745b4eL,0xa31a1853L,0xca6021efL,0xdfb56c4fL,0xcbc2d915L, +/* 240*/ 0x3c48e918L,0x8bae3c63L,0x6f659c71L,0xf8b754c1L,0x2782f3deL, +/* 245*/ 0xf796f168L,0x71492c84L,0x33c0f5a6L,0x3144f6ecL,0x25dc412eL, +/* 250*/ 0xb16c5743L,0x83a1fa7eL,0x0997b101L,0xb627e6e8L,0xcf33905cL, +/* 255*/ 0x8456fb65L + /* End of S Box 8 */ }, + + + { /* Start of S Box 9 */ + +/* 0*/ 0xb29bea74L,0xc35da605L,0x305c1ca3L,0xd2e9f5bcL,0x6fd5bff4L, +/* 5*/ 0xff347703L,0xfc45b163L,0xf498e068L,0xb71229fcL,0x81acc3fbL, +/* 10*/ 0x78538a8bL,0x984ecf81L,0xa5da47a4L,0x8f259eefL,0x6475dc65L, +/* 15*/ 0x081865b9L,0x49e14a3cL,0x19e66079L,0xd382e91bL,0x5b109794L, +/* 20*/ 0x3f9f81e1L,0x4470a388L,0x41601abeL,0xaaf9f407L,0x8e175ef6L, +/* 25*/ 0xed842297L,0x893a4271L,0x1790839aL,0xd566a99eL,0x6b417deeL, +/* 30*/ 0x75c90d23L,0x715edb31L,0x723553f7L,0x9afb50c9L,0xfbc5f600L, +/* 35*/ 0xcd3b6a4eL,0x97ed0fbaL,0x29689aecL,0x63135c8eL,0xf0e26c7eL, +/* 40*/ 0x0692ae7fL,0xdbb208ffL,0x2ede3e9bL,0x6a65bebdL,0xd40867e9L, +/* 45*/ 0xc954afc5L,0x73b08201L,0x7ffdf809L,0x1195c24fL,0x1ca5adcaL, +/* 50*/ 0x74bd6d1fL,0xb393c455L,0xcadfd3faL,0x99f13011L,0x0ebca813L, +/* 55*/ 0x60e791b8L,0x6597ac7aL,0x18a7e46bL,0x09cb49d3L,0x0b27df6dL, +/* 60*/ 0xcfe52f87L,0xcef66837L,0xe6328035L,0xfa87c592L,0x37baff93L, +/* 65*/ 0xd71fcc99L,0xdcab205cL,0x4d7a5638L,0x48012510L,0x62797558L, +/* 70*/ 0xb6cf1fe5L,0xbc311834L,0x9c2373acL,0x14ec6175L,0xa439cbdfL, +/* 75*/ 0x54afb0eaL,0xd686960bL,0xfdd0d47bL,0x7b063902L,0x8b78bac3L, +/* 80*/ 0x26c6a4d5L,0x5c0055b6L,0x2376102eL,0x0411783eL,0x2aa3f1cdL, +/* 85*/ 0x51fc6ea8L,0x701ce243L,0x9b2a0abbL,0x0ad93733L,0x6e80d03dL, +/* 90*/ 0xaf6295d1L,0xf629896fL,0xa30b0648L,0x463d8dd4L,0x963f84cbL, +/* 95*/ 0x01ff94f8L,0x8d7fefdcL,0x553611c0L,0xa97c1719L,0xb96af759L, +/* 100*/ 0xe0e3c95eL,0x0528335bL,0x21fe5925L,0x821a5245L,0x807238b1L, +/* 105*/ 0x67f23db5L,0xea6b4eabL,0x0da6f985L,0xab1bc85aL,0xef8c90e4L, +/* 110*/ 0x4526230eL,0x38eb8b1cL,0x1b91cd91L,0x9fce5f0cL,0xf72cc72bL, +/* 115*/ 0xc64f2617L,0xdaf7857dL,0x7d373cf1L,0x28eaedd7L,0x203887d0L, +/* 120*/ 0xc49a155fL,0xa251b3b0L,0xf2d47ae3L,0x3d9ef267L,0x4a94ab2fL, +/* 125*/ 0x7755a222L,0x0205e329L,0xc28fa7a7L,0xaec1fe51L,0x270f164cL, +/* 130*/ 0x8c6d01bfL,0x53b5bc98L,0xc09d3febL,0x834986ccL,0x4309a12cL, +/* 135*/ 0x578b2a96L,0x3bb74b86L,0x69561b4aL,0x037e32f3L,0xde335b08L, +/* 140*/ 0xc5156be0L,0xe7ef09adL,0x93b834c7L,0xa7719352L,0x59302821L, +/* 145*/ 0xe3529d26L,0xf961da76L,0xcb142c44L,0xa0f3b98dL,0x76502457L, +/* 150*/ 0x945a414bL,0x078eeb12L,0xdff8de69L,0xeb6c8c2dL,0xbda90c4dL, +/* 155*/ 0xe9c44d16L,0x168dfd66L,0xad64763bL,0xa65fd764L,0x95a29c06L, +/* 160*/ 0x32d7713fL,0x40f0b277L,0x224af08fL,0x004cb5e8L,0x92574814L, +/* 165*/ 0x8877d827L,0x3e5b2d04L,0x68c2d5f2L,0x86966273L,0x1d433adaL, +/* 170*/ 0x8774988aL,0x3c0e0bfeL,0xddad581dL,0x2fd654edL,0x0f4769fdL, +/* 175*/ 0xc181ee9dL,0x5fd88f61L,0x341dbb3aL,0x528543f9L,0xd92235cfL, +/* 180*/ 0x1ea82eb4L,0xb5cd790fL,0x91d24f1eL,0xa869e6c2L,0x61f474d2L, +/* 185*/ 0xcc205addL,0x0c7bfba9L,0xbf2b0489L,0xb02d72d8L,0x2b46ece6L, +/* 190*/ 0xe4dcd90aL,0xb8a11440L,0xee8a63b7L,0x854dd1a1L,0xd1e00583L, +/* 195*/ 0x42b40e24L,0x9e8964deL,0xb4b35d78L,0xbec76f6eL,0x24b9c620L, +/* 200*/ 0xd8d399a6L,0x5adb2190L,0x2db12730L,0x3a5866afL,0x58c8fadbL, +/* 205*/ 0x5d8844e7L,0x8a4bf380L,0x15a01d70L,0x79f5c028L,0x66be3b8cL, +/* 210*/ 0xf3e42b53L,0x56990039L,0x2c0c3182L,0x5e16407cL,0xecc04515L, +/* 215*/ 0x6c440284L,0x4cb6701aL,0x13bfc142L,0x9d039f6aL,0x4f6e92c8L, +/* 220*/ 0xa1407c62L,0x8483a095L,0xc70ae1c4L,0xe20213a2L,0xbacafc41L, +/* 225*/ 0x4ecc12b3L,0x4bee3646L,0x1fe807aeL,0x25217f9cL,0x35dde5f5L, +/* 230*/ 0x7a7dd6ceL,0xf89cce50L,0xac07b718L,0x7e73d2c6L,0xe563e76cL, +/* 235*/ 0x123ca536L,0x3948ca56L,0x9019dd49L,0x10aa88d9L,0xc82451e2L, +/* 240*/ 0x473eb6d6L,0x506fe854L,0xe8bb03a5L,0x332f4c32L,0xfe1e1e72L, +/* 245*/ 0xb1ae572aL,0x7c0d7bc1L,0xe1c37eb2L,0xf542aa60L,0xf1a48ea0L, +/* 250*/ 0xd067b89fL,0xbbfa195dL,0x1a049b0dL,0x315946aaL,0x36d1b447L, +/* 255*/ 0x6d2ebdf0L + /* End of S Box 9 */ }, + + + { /* Start of S Box 10 */ + +/* 0*/ 0x0d188a6dL,0x12cea0dbL,0x7e63740eL,0x6a444821L,0x253d234fL, +/* 5*/ 0x6ffc6597L,0x94a6bdefL,0x33ee1b2fL,0x0a6c00c0L,0x3aa336b1L, +/* 10*/ 0x5af55d17L,0x265fb3dcL,0x0e89cf4dL,0x0786b008L,0xc80055b8L, +/* 15*/ 0x6b17c3ceL,0x72b05a74L,0xd21a8d78L,0xa6b70840L,0xfe8eae77L, +/* 20*/ 0xed69565cL,0x55e1bcf4L,0x585c2f60L,0xe06f1a62L,0xad67c0cdL, +/* 25*/ 0x7712af88L,0x9cc26acaL,0x1888053dL,0x37eb853eL,0x9215abd7L, +/* 30*/ 0xde30adfcL,0x1f1038e6L,0x70c51c8aL,0x8d586c26L,0xf72bdd90L, +/* 35*/ 0x4dc3ce15L,0x68eaeefaL,0xd0e9c8b9L,0x200f9c44L,0xddd141baL, +/* 40*/ 0x024bf1d3L,0x0f64c9d4L,0xc421e9e9L,0x9d11c14cL,0x9a0dd9e4L, +/* 45*/ 0x5f92ec19L,0x1b980df0L,0x1dcc4542L,0xb8fe8c56L,0x0c9c9167L, +/* 50*/ 0x4e81eb49L,0xca368f27L,0xe3603b37L,0xea08acccL,0xac516992L, +/* 55*/ 0xc34f513bL,0x804d100dL,0x6edca4c4L,0xfc912939L,0x29d219b0L, +/* 60*/ 0x278aaa3cL,0x4868da7dL,0x54e890b7L,0xb46d735aL,0x514589aaL, +/* 65*/ 0xd6c630afL,0x4980dfe8L,0xbe3ccc55L,0x59d41202L,0x650c078bL, +/* 70*/ 0xaf3a9e7bL,0x3ed9827aL,0x9e79fc6eL,0xaadbfbaeL,0xc5f7d803L, +/* 75*/ 0x3daf7f50L,0x67b4f465L,0x73406e11L,0x39313f8cL,0x8a6e6686L, +/* 80*/ 0xd8075f1fL,0xd3cbfed1L,0x69c7e49cL,0x930581e0L,0xe4b1a5a8L, +/* 85*/ 0xbbc45472L,0x09ddbf58L,0xc91d687eL,0xbdbffda5L,0x88c08735L, +/* 90*/ 0xe9e36bf9L,0xdb5ea9b6L,0x95559404L,0x08f432fbL,0xe24ea281L, +/* 95*/ 0x64663579L,0x000b8010L,0x7914e7d5L,0x32fd0473L,0xd1a7f0a4L, +/* 100*/ 0x445ab98eL,0xec72993fL,0xa29a4d32L,0xb77306d8L,0xc7c97cf6L, +/* 105*/ 0x7b6ab645L,0xf5ef7adfL,0xfb2e15f7L,0xe747f757L,0x5e944354L, +/* 110*/ 0x234a2669L,0x47e46359L,0x9b9d11a9L,0x40762cedL,0x56f1de98L, +/* 115*/ 0x11334668L,0x890a9a70L,0x1a296113L,0xb3bd4af5L,0x163b7548L, +/* 120*/ 0xd51b4f84L,0xb99b2abcL,0x3cc1dc30L,0xa9f0b56cL,0x812272b2L, +/* 125*/ 0x0b233a5fL,0xb650dbf2L,0xf1a0771bL,0x36562b76L,0xdc037b0fL, +/* 130*/ 0x104c97ffL,0xc2ec98d2L,0x90596f22L,0x28b6620bL,0xdf42b212L, +/* 135*/ 0xfdbc4243L,0xf3fb175eL,0x4a2d8b00L,0xe8f3869bL,0x30d69bc3L, +/* 140*/ 0x853714c8L,0xa7751d2eL,0x31e56deaL,0xd4840b0cL,0x9685d783L, +/* 145*/ 0x068c9333L,0x8fba032cL,0x76d7bb47L,0x6d0ee22bL,0xb546794bL, +/* 150*/ 0xd971b894L,0x8b09d253L,0xa0ad5761L,0xee77ba06L,0x46359f31L, +/* 155*/ 0x577cc7ecL,0x52825efdL,0xa4beed95L,0x9825c52aL,0xeb48029aL, +/* 160*/ 0xbaae59f8L,0xcf490ee1L,0xbc990164L,0x8ca49dfeL,0x4f38a6e7L, +/* 165*/ 0x2ba98389L,0x8228f538L,0x199f64acL,0x01a1cac5L,0xa8b51641L, +/* 170*/ 0x5ce72d01L,0x8e5df26bL,0x60f28e1eL,0xcd5be125L,0xe5b376bfL, +/* 175*/ 0x1c8d3116L,0x7132cbb3L,0xcb7ae320L,0xc0fa5366L,0xd7653e34L, +/* 180*/ 0x971c88c2L,0xc62c7dd0L,0x34d0a3daL,0x868f6709L,0x7ae6fa8fL, +/* 185*/ 0x22bbd523L,0x66cd3d5bL,0x1ef9288dL,0xf9cf58c1L,0x5b784e80L, +/* 190*/ 0x7439a191L,0xae134c36L,0x9116c463L,0x2e9e1396L,0xf8611f3aL, +/* 195*/ 0x2d2f3307L,0x247f37ddL,0xc1e2ff9dL,0x43c821e5L,0x05ed5cabL, +/* 200*/ 0xef74e80aL,0x4cca6028L,0xf0ac3cbdL,0x5d874b29L,0x6c62f6a6L, +/* 205*/ 0x4b2a2ef3L,0xb1aa2087L,0x62a5d0a3L,0x0327221cL,0xb096b4c6L, +/* 210*/ 0x417ec693L,0xaba840d6L,0x789725ebL,0xf4b9e02dL,0xe6e00975L, +/* 215*/ 0xcc04961aL,0x63f624bbL,0x7fa21ecbL,0x2c01ea7fL,0xb2415005L, +/* 220*/ 0x2a8bbeb5L,0x83b2b14eL,0xa383d1a7L,0x5352f96aL,0x043ecdadL, +/* 225*/ 0xce1918a1L,0xfa6be6c9L,0x50def36fL,0xf6b80ce2L,0x4543ef7cL, +/* 230*/ 0x9953d651L,0xf257955dL,0x87244914L,0xda1e0a24L,0xffda4785L, +/* 235*/ 0x14d327a2L,0x3b93c29fL,0x840684b4L,0x61ab71a0L,0x9f7b784aL, +/* 240*/ 0x2fd570cfL,0x15955bdeL,0x38f8d471L,0x3534a718L,0x133fb71dL, +/* 245*/ 0x3fd80f52L,0x4290a8beL,0x75ff44c7L,0xa554e546L,0xe1023499L, +/* 250*/ 0xbf2652e3L,0x7d20399eL,0xa1df7e82L,0x177092eeL,0x217dd3f1L, +/* 255*/ 0x7c1ff8d9L + /* End of S Box 10 */ }, + + + { /* Start of S Box 11 */ + +/* 0*/ 0x12113f2eL,0xbfbd0785L,0xf11793fbL,0xa5bff566L,0x83c7b0e5L, +/* 5*/ 0x72fb316bL,0x75526a9aL,0x41e0e612L,0x7156ba09L,0x53ce7deeL, +/* 10*/ 0x0aa26881L,0xa43e0d7dL,0x3da73ca3L,0x182761edL,0xbd5077ffL, +/* 15*/ 0x56db4aa0L,0xe792711cL,0xf0a4eb1dL,0x7f878237L,0xec65c4e8L, +/* 20*/ 0x08dc8d43L,0x0f8ce142L,0x8258abdaL,0xf4154e16L,0x49dec2fdL, +/* 25*/ 0xcd8d5705L,0x6c2c3a0fL,0x5c12bb88L,0xeff3cdb6L,0x2c89ed8cL, +/* 30*/ 0x7beba967L,0x2a142157L,0xc6d0836fL,0xb4f97e96L,0x6931e969L, +/* 35*/ 0x514e6c7cL,0xa7792600L,0x0bbbf780L,0x59671bbdL,0x0707b676L, +/* 40*/ 0x37482d93L,0x80af1479L,0x3805a60dL,0xe1f4cac1L,0x580b3074L, +/* 45*/ 0x30b8d6ceL,0x05a304beL,0xd176626dL,0xebca97f3L,0xbb201f11L, +/* 50*/ 0x6a1afe23L,0xffaa86e4L,0x62b4da49L,0x1b6629f5L,0xf5d9e092L, +/* 55*/ 0xf37f3dd1L,0x619bd45bL,0xa6ec8e4fL,0x29c80939L,0x0c7c0c34L, +/* 60*/ 0x9cfe6e48L,0xe65fd3acL,0x73613b65L,0xb3c669f9L,0xbe2e8a9eL, +/* 65*/ 0x286f9678L,0x5797fd13L,0x99805d75L,0xcfb641c5L,0xa91074baL, +/* 70*/ 0x6343af47L,0x6403cb46L,0x8894c8dbL,0x2663034cL,0x3c40dc5eL, +/* 75*/ 0x00995231L,0x96789aa2L,0x2efde4b9L,0x7dc195e1L,0x547dadd5L, +/* 80*/ 0x06a8ea04L,0xf2347a63L,0x5e0dc6f7L,0x8462dfc2L,0x1e6b2c3cL, +/* 85*/ 0x9bd275b3L,0x91d419e2L,0xbcefd17eL,0xb9003924L,0xd07e7320L, +/* 90*/ 0xdef0495cL,0xc36ad00eL,0x1785b1abL,0x92e20bcfL,0xb139f0e9L, +/* 95*/ 0x675bb9a1L,0xaecfa4afL,0x132376cbL,0xe84589d3L,0x79a05456L, +/* 100*/ 0xa2f860bcL,0x1ae4f8b5L,0x20df4db4L,0xa1e1428bL,0x3bf60a1aL, +/* 105*/ 0x27ff7bf1L,0xcb44c0e7L,0xf7f587c4L,0x1f3b9b21L,0x94368f01L, +/* 110*/ 0x856e23a4L,0x6f93de3fL,0x773f5bbfL,0x8b22056eL,0xdf41f654L, +/* 115*/ 0xb8246ff4L,0x8d57bff2L,0xd57167eaL,0xc5699f22L,0x40734ba7L, +/* 120*/ 0x5d5c2772L,0x033020a8L,0xe30a7c4dL,0xadc40fd6L,0x76353441L, +/* 125*/ 0x5aa5229bL,0x81516590L,0xda49f14eL,0x4fa672a5L,0x4d9fac5fL, +/* 130*/ 0x154be230L,0x8a7a5cc0L,0xce3d2f84L,0xcca15514L,0x5221360cL, +/* 135*/ 0xaf0fb81eL,0x5bdd5873L,0xf6825f8fL,0x1113d228L,0x70ad996cL, +/* 140*/ 0x93320051L,0x60471c53L,0xe9ba567bL,0x3a462ae3L,0x5f55e72dL, +/* 145*/ 0x1d3c5ad7L,0xdcfc45ecL,0x34d812efL,0xfa96ee1bL,0x369d1ef8L, +/* 150*/ 0xc9b1a189L,0x7c1d3555L,0x50845edcL,0x4bb31877L,0x8764a060L, +/* 155*/ 0x8c9a9415L,0x230e1a3aL,0xb05e9133L,0x242b9e03L,0xa3b99db7L, +/* 160*/ 0xc2d7fb0aL,0x3333849dL,0xd27278d4L,0xb5d3efa6L,0x78ac28adL, +/* 165*/ 0xc7b2c135L,0x0926ecf0L,0xc1374c91L,0x74f16d98L,0x2274084aL, +/* 170*/ 0x3f6d9cfaL,0x7ac0a383L,0xb73aff1fL,0x3909a23dL,0x9f1653aeL, +/* 175*/ 0x4e2f3e71L,0xca5ab22aL,0xe01e3858L,0x90c5a7ebL,0x3e4a17dfL, +/* 180*/ 0xaa987fb0L,0x488bbd62L,0xb625062bL,0x2d776bb8L,0x43b5fc08L, +/* 185*/ 0x1490d532L,0xd6d12495L,0x44e89845L,0x2fe60118L,0x9d9ef950L, +/* 190*/ 0xac38133eL,0xd3864329L,0x017b255aL,0xfdc2dd26L,0x256851e6L, +/* 195*/ 0x318e7086L,0x2bfa4861L,0x89eac706L,0xee5940c6L,0x68c3bc2fL, +/* 200*/ 0xe260334bL,0x98da90bbL,0xf818f270L,0x4706d897L,0x212d3799L, +/* 205*/ 0x4cf7e5d0L,0xd9c9649fL,0xa85db5cdL,0x35e90e82L,0x6b881152L, +/* 210*/ 0xab1c02c7L,0x46752b02L,0x664f598eL,0x45ab2e64L,0xc4cdb4b2L, +/* 215*/ 0xba42107fL,0xea2a808aL,0x971bf3deL,0x4a54a836L,0x4253aeccL, +/* 220*/ 0x1029be68L,0x6dcc9225L,0xe4bca56aL,0xc0ae50b1L,0x7e011d94L, +/* 225*/ 0xe59c162cL,0xd8e5c340L,0xd470fa0bL,0xb2be79ddL,0xd783889cL, +/* 230*/ 0x1cede8f6L,0x8f4c817aL,0xddb785c9L,0x860232d8L,0x198aaad9L, +/* 235*/ 0xa0814738L,0x3219cffcL,0x169546d2L,0xfc0cb759L,0x55911510L, +/* 240*/ 0x04d5cec3L,0xed08cc3bL,0x0d6cf427L,0xc8e38ccaL,0x0eeee3feL, +/* 245*/ 0x9ee7d7c8L,0xf9f24fa9L,0xdb04b35dL,0x9ab0c9e0L,0x651f4417L, +/* 250*/ 0x028f8b07L,0x6e28d9aaL,0xfba96319L,0x8ed66687L,0xfecbc58dL, +/* 255*/ 0x954ddb44L + /* End of S Box 11 */ }, + + + { /* Start of S Box 12 */ + +/* 0*/ 0x7b0bdffeL,0x865d16b1L,0x49a058c0L,0x97abaa3fL,0xcaacc75dL, +/* 5*/ 0xaba6c17dL,0xf8746f92L,0x6f48aeedL,0x8841d4b5L,0xf36a146aL, +/* 10*/ 0x73c390abL,0xe6fb558fL,0x87b1019eL,0x26970252L,0x246377b2L, +/* 15*/ 0xcbf676aeL,0xf923db06L,0xf7389116L,0x14c81a90L,0x83114eb4L, +/* 20*/ 0x8b137559L,0x95a86a7aL,0xd5b8da8cL,0xc4df780eL,0x5a9cb3e2L, +/* 25*/ 0xe44d4062L,0xe8dc8ef6L,0x9d180845L,0x817ad18bL,0xc286c85bL, +/* 30*/ 0x251f20deL,0xee6d5933L,0xf6edef81L,0xd4d16c1eL,0xc94a0c32L, +/* 35*/ 0x8437fd22L,0x3271ee43L,0x42572aeeL,0x5f91962aL,0x1c522d98L, +/* 40*/ 0x59b23f0cL,0xd86b8804L,0x08c63531L,0x2c0d7a40L,0xb97c4729L, +/* 45*/ 0x04964df9L,0x13c74a17L,0x5878362fL,0x4c808cd6L,0x092cb1e0L, +/* 50*/ 0x6df02885L,0xa0c2105eL,0x8aba9e68L,0x64e03057L,0xe5d61325L, +/* 55*/ 0x0e43a628L,0x16dbd62bL,0x2733d90bL,0x3ae57283L,0xc0c1052cL, +/* 60*/ 0x4b6fb620L,0x37513953L,0xfc898bb3L,0x471b179fL,0xdf6e66b8L, +/* 65*/ 0xd32142f5L,0x9b30fafcL,0x4ed92549L,0x105c6d99L,0x4acd69ffL, +/* 70*/ 0x2b1a27d3L,0x6bfcc067L,0x6301a278L,0xad36e6f2L,0xef3ff64eL, +/* 75*/ 0x56b3cadbL,0x0184bb61L,0x17beb9fdL,0xfaec6109L,0xa2e1ffa1L, +/* 80*/ 0x2fd224f8L,0x238f5be6L,0x8f8570cfL,0xaeb5f25aL,0x4f1d3e64L, +/* 85*/ 0x4377eb24L,0x1fa45346L,0xb2056386L,0x52095e76L,0xbb7b5adcL, +/* 90*/ 0x3514e472L,0xdde81e6eL,0x7acea9c4L,0xac15cc48L,0x71c97d93L, +/* 95*/ 0x767f941cL,0x911052a2L,0xffea09bfL,0xfe3ddcf0L,0x15ebf3aaL, +/* 100*/ 0x9235b8bcL,0x75408615L,0x9a723437L,0xe1a1bd38L,0x33541b7eL, +/* 105*/ 0x1bdd6856L,0xb307e13eL,0x90814bb0L,0x51d7217bL,0x0bb92219L, +/* 110*/ 0x689f4500L,0xc568b01fL,0x5df3d2d7L,0x3c0ecd0dL,0x2a0244c8L, +/* 115*/ 0x852574e8L,0xe72f23a9L,0x8e26ed02L,0x2d92cbddL,0xdabc0458L, +/* 120*/ 0xcdf5feb6L,0x9e4e8dccL,0xf4f1e344L,0x0d8c436dL,0x4427603bL, +/* 125*/ 0xbdd37fdaL,0x80505f26L,0x8c7d2b8eL,0xb73273c5L,0x397362eaL, +/* 130*/ 0x618a3811L,0x608bfb88L,0x06f7d714L,0x212e4677L,0x28efceadL, +/* 135*/ 0x076c0371L,0x36a3a4d9L,0x5487b455L,0x3429a365L,0x65d467acL, +/* 140*/ 0x78ee7eebL,0x99bf12b7L,0x4d129896L,0x772a5601L,0xcce284c7L, +/* 145*/ 0x2ed85c21L,0xd099e8a4L,0xa179158aL,0x6ac0ab1aL,0x299a4807L, +/* 150*/ 0xbe67a58dL,0xdc19544aL,0xb8949b54L,0x8d315779L,0xb6f849c1L, +/* 155*/ 0x53c5ac34L,0x66de92a5L,0xf195dd13L,0x318d3a73L,0x301ec542L, +/* 160*/ 0x0cc40da6L,0xf253ade4L,0x467ee566L,0xea5585ecL,0x3baf19bbL, +/* 165*/ 0x7de9f480L,0x79006e7cL,0xa9b7a197L,0xa44bd8f1L,0xfb2ba739L, +/* 170*/ 0xec342fd4L,0xed4fd32dL,0x3d1789baL,0x400f5d7fL,0xc798f594L, +/* 175*/ 0x4506a847L,0x034c0a95L,0xe2162c9dL,0x55a9cfd0L,0x692d832eL, +/* 180*/ 0xcf9db2caL,0x5e2287e9L,0xd2610ef3L,0x1ae7ecc2L,0x48399ca0L, +/* 185*/ 0xa7e4269bL,0x6ee3a0afL,0x7065bfe1L,0xa6ffe708L,0x2256804cL, +/* 190*/ 0x7476e21bL,0x41b0796cL,0x7c243b05L,0x000a950fL,0x1858416bL, +/* 195*/ 0xf5a53c89L,0xe9fef823L,0x3f443275L,0xe0cbf091L,0x0af27b84L, +/* 200*/ 0x3ebb0f27L,0x1de6f7f4L,0xc31c29f7L,0xb166de3dL,0x12932ec3L, +/* 205*/ 0x9c0c0674L,0x5cda81b9L,0xd1bd9d12L,0xaffd7c82L,0x8962bca7L, +/* 210*/ 0xa342c4a8L,0x62457151L,0x82089f03L,0xeb49c670L,0x5b5f6530L, +/* 215*/ 0x7e28bad2L,0x20880ba3L,0xf0faafcdL,0xce82b56fL,0x0275335cL, +/* 220*/ 0xc18e8afbL,0xde601d69L,0xba9b820aL,0xc8a2be4fL,0xd7cac335L, +/* 225*/ 0xd9a73741L,0x115e974dL,0x7f5ac21dL,0x383bf9c6L,0xbcaeb75fL, +/* 230*/ 0xfd0350ceL,0xb5d06b87L,0x9820e03cL,0x72d5f163L,0xe3644fc9L, +/* 235*/ 0xa5464c4bL,0x57048fcbL,0x9690c9dfL,0xdbf9eafaL,0xbff4649aL, +/* 240*/ 0x053c00e3L,0xb4b61136L,0x67593dd1L,0x503ee960L,0x9fb4993aL, +/* 245*/ 0x19831810L,0xc670d518L,0xb05b51d8L,0x0f3a1ce5L,0x6caa1f9cL, +/* 250*/ 0xaacc31beL,0x949ed050L,0x1ead07e7L,0xa8479abdL,0xd6cffcd5L, +/* 255*/ 0x936993efL + /* End of S Box 12 */ }, + + + { /* Start of S Box 13 */ + +/* 0*/ 0x472e91cbL,0x5444b5b6L,0x62be5861L,0x1be102c7L,0x63e4b31eL, +/* 5*/ 0xe81f71b7L,0x9e2317c9L,0x39a408aeL,0x518024f4L,0x1731c66fL, +/* 10*/ 0x68cbc918L,0x71fb0c9eL,0xd03b7fddL,0x7d6222ebL,0x9057eda3L, +/* 15*/ 0x1a34a407L,0x8cc2253dL,0xb6f6979dL,0x835675dcL,0xf319be9fL, +/* 20*/ 0xbe1cd743L,0x4d32fee4L,0x77e7d887L,0x37e9ebfdL,0x15f851e8L, +/* 25*/ 0x23dc3706L,0x19d78385L,0xbd506933L,0xa13ad4a6L,0x913f1a0eL, +/* 30*/ 0xdde560b9L,0x9a5f0996L,0xa65a0435L,0x48d34c4dL,0xe90839a7L, +/* 35*/ 0x8abba54eL,0x6fd13ce1L,0xc7eebd3cL,0x0e297602L,0x58b9bbb4L, +/* 40*/ 0xef7901e6L,0x64a28a62L,0xa509875aL,0xf8834442L,0x2702c709L, +/* 45*/ 0x07353f31L,0x3b39f665L,0xf5b18b49L,0x4010ae37L,0x784de00bL, +/* 50*/ 0x7a1121e9L,0xde918ed3L,0xc8529dcdL,0x816a5d05L,0x02ed8298L, +/* 55*/ 0x04e3dd84L,0xfd2bc3e2L,0xaf167089L,0x96af367eL,0xa4da6232L, +/* 60*/ 0x18ff7325L,0x05f9a9f1L,0x4fefb9f9L,0xcd94eaa5L,0xbfaa5069L, +/* 65*/ 0xa0b8c077L,0x60d86f57L,0xfe71c813L,0x29ebd2c8L,0x4ca86538L, +/* 70*/ 0x6bf1a030L,0xa237b88aL,0xaa8af41dL,0xe1f7b6ecL,0xe214d953L, +/* 75*/ 0x33057879L,0x49caa736L,0xfa45cff3L,0xc063b411L,0xba7e27d0L, +/* 80*/ 0x31533819L,0x2a004ac1L,0x210efc3fL,0x2646885eL,0x66727dcfL, +/* 85*/ 0x9d7fbf54L,0xa8dd0ea8L,0x3447caceL,0x3f0c14dbL,0xb8382aacL, +/* 90*/ 0x4ace3539L,0x0a518d51L,0x95178981L,0x35aee2caL,0x73f0f7e3L, +/* 95*/ 0x94281140L,0x59d0e523L,0xd292cb88L,0x565d1b27L,0x7ec8fbafL, +/* 100*/ 0x069af08dL,0xc127fd24L,0x0bc77b10L,0x5f03e7efL,0x453e99baL, +/* 105*/ 0xeed9ff7fL,0x87b55215L,0x7915ab4cL,0xd389a358L,0x5e75ce6dL, +/* 110*/ 0x28d655c0L,0xdad26c73L,0x2e2510ffL,0x9fa7eeccL,0x1d0629c3L, +/* 115*/ 0xdc9c9c46L,0x2d67ecd7L,0xe75e94bdL,0x3d649e2aL,0x6c413a2bL, +/* 120*/ 0x706f0d7cL,0xdfb0127bL,0x4e366b55L,0x2c825650L,0x24205720L, +/* 125*/ 0xb5c998f7L,0x3e95462cL,0x756e5c72L,0x3259488fL,0x11e8771aL, +/* 130*/ 0xa7c0a617L,0x577663e5L,0x089b6401L,0x8eab1941L,0xae55ef8cL, +/* 135*/ 0x3aac5460L,0xd4e6262fL,0x5d979a47L,0xb19823b0L,0x7f8d6a0cL, +/* 140*/ 0xffa08683L,0x0170cd0fL,0x858cd5d8L,0x53961c90L,0xc4c61556L, +/* 145*/ 0x41f2f226L,0xcfcd062dL,0xf24c03b8L,0xea81df5bL,0x7be2fa52L, +/* 150*/ 0xb361f98bL,0xc2901316L,0x55ba4bbcL,0x93b234a9L,0x0fbc6603L, +/* 155*/ 0x80a96822L,0x6d60491fL,0x22bd00f8L,0xbcad5aadL,0x52f3f13bL, +/* 160*/ 0x42fd2b28L,0xb41dd01cL,0xc52c93bfL,0xfc663094L,0x8f58d100L, +/* 165*/ 0x43fecc08L,0xc6331e5dL,0xe6480f66L,0xca847204L,0x4bdf1da0L, +/* 170*/ 0x30cc2efbL,0x13e02deaL,0xfb49ac45L,0xf9d4434fL,0xf47c5b9cL, +/* 175*/ 0x148879c2L,0x039fc234L,0xa3db9bfcL,0xd1a1dc5cL,0x763d7cd4L, +/* 180*/ 0xed6d2f93L,0xab13af6eL,0x1e8e054aL,0xd68f4f9aL,0xc30484b3L, +/* 185*/ 0xd7d50afaL,0x6930855fL,0xcc07db95L,0xce746db1L,0x744e967dL, +/* 190*/ 0xf16cf575L,0x8643e8b5L,0xf0eae38eL,0xe52de1d1L,0x6587dae0L, +/* 195*/ 0x0c4b8121L,0x1c7ac567L,0xac0db20aL,0x36c3a812L,0x5b1a4514L, +/* 200*/ 0xa9a3f868L,0xb9263baaL,0xcb3ce9d2L,0xe44fb1a4L,0x9221bc82L, +/* 205*/ 0xb29390feL,0x6ab41863L,0x974a3e2eL,0x89f531c5L,0x255ca13eL, +/* 210*/ 0x8b65d348L,0xec248f78L,0xd8fc16f0L,0x50ecdeeeL,0x09010792L, +/* 215*/ 0x3c7d1fb2L,0xeba5426bL,0x847b417aL,0x468b40d9L,0x8dc4e680L, +/* 220*/ 0x7cc1f391L,0x2f1eb086L,0x6e5baa6aL,0xe0b395daL,0xe31b2cf6L, +/* 225*/ 0xd9690b0dL,0x729ec464L,0x38403ddeL,0x610b80a2L,0x5cf433abL, +/* 230*/ 0xb0785fc4L,0xd512e4c6L,0xbbb7d699L,0x5a86591bL,0x10cf5376L, +/* 235*/ 0x12bf9f4bL,0x980fbaa1L,0x992a4e70L,0x20fa7ae7L,0xf7996ebbL, +/* 240*/ 0xc918a2beL,0x82de74f2L,0xad54209bL,0xf66b4d74L,0x1fc5b771L, +/* 245*/ 0x169d9229L,0x887761dfL,0x00b667d5L,0xdb425e59L,0xb72f2844L, +/* 250*/ 0x9b0ac1f5L,0x9c737e3aL,0x2b85476cL,0x6722add6L,0x44a63297L, +/* 255*/ 0x0d688cedL + /* End of S Box 13 */ }, + + + { /* Start of S Box 14 */ + +/* 0*/ 0xabc59484L,0x4107778aL,0x8ad94c6fL,0xfe83df90L,0x0f64053fL, +/* 5*/ 0xd1292e9dL,0xc5744356L,0x8dd1abb4L,0x4c4e7667L,0xfb4a7fc1L, +/* 10*/ 0x74f402cbL,0x70f06afdL,0xa82286f2L,0x918dd076L,0x7a97c5ceL, +/* 15*/ 0x48f7bde3L,0x6a04d11dL,0xac243ef7L,0x33ac10caL,0x2f7a341eL, +/* 20*/ 0x5f75157aL,0xf4773381L,0x591c870eL,0x78df8cc8L,0x22f3adb0L, +/* 25*/ 0x251a5993L,0x09fbef66L,0x796942a8L,0x97541d2eL,0x2373daa9L, +/* 30*/ 0x1bd2f142L,0xb57e8eb2L,0xe1a5bfdbL,0x7d0efa92L,0xb3442c94L, +/* 35*/ 0xd2cb6447L,0x386ac97eL,0x66d61805L,0xbdada15eL,0x11bc1aa7L, +/* 40*/ 0x14e9f6eaL,0xe533a0c0L,0xf935ee0aL,0x8fee8a04L,0x810d6d85L, +/* 45*/ 0x7c68b6d6L,0x4edc9aa2L,0x956e897dL,0xed87581aL,0x264be9d7L, +/* 50*/ 0xff4ddb29L,0x823857c2L,0xe005a9a0L,0xf1cc2450L,0x6f9951e1L, +/* 55*/ 0xaade2310L,0xe70c75f5L,0x83e1a31fL,0x4f7dde8eL,0xf723b563L, +/* 60*/ 0x368e0928L,0x86362b71L,0x21e8982dL,0xdfb3f92bL,0x44676352L, +/* 65*/ 0x99efba31L,0x2eab4e1cL,0xfc6ca5e7L,0x0ebe5d4eL,0xa0717d0cL, +/* 70*/ 0xb64f8199L,0x946b31a1L,0x5656cbc6L,0xcffec3efL,0x622766c9L, +/* 75*/ 0xfa211e35L,0x52f98b89L,0x6d01674bL,0x4978a802L,0xf651f701L, +/* 80*/ 0x15b0d43dL,0xd6ff4683L,0x3463855fL,0x672ba29cL,0xbc128312L, +/* 85*/ 0x4626a70dL,0xc8927a5aL,0xb8481cf9L,0x1c962262L,0xa21196baL, +/* 90*/ 0xbaba5ee9L,0x5bb162d0L,0x69943bd1L,0x0c47e35cL,0x8cc9619aL, +/* 95*/ 0xe284d948L,0x271bf264L,0xc27fb398L,0x4bc70897L,0x60cf202cL, +/* 100*/ 0x7f42d6aaL,0xa5a13506L,0x5d3e8860L,0xcea63d3cL,0x63bf0a8fL, +/* 105*/ 0xf02e9efaL,0xb17b0674L,0xb072b1d3L,0x06e5723bL,0x3737e436L, +/* 110*/ 0x24aa49c7L,0x0ded0d18L,0xdb256b14L,0x58b27877L,0xecb49f54L, +/* 115*/ 0x6c40256aL,0x6ea92ffbL,0x3906aa4cL,0xc9866fd5L,0x4549323eL, +/* 120*/ 0xa7b85fabL,0x1918cc27L,0x7308d7b5L,0x1e16c7adL,0x71850b37L, +/* 125*/ 0x3095fd78L,0xa63b70e6L,0xd880e2aeL,0x3e282769L,0xa39ba6bcL, +/* 130*/ 0x98700fa3L,0xf34c53e8L,0x288af426L,0xb99d930fL,0xf5b99df1L, +/* 135*/ 0xe9d0c8cfL,0x5ac8405dL,0x50e7217bL,0x511fbbbeL,0x2ca2e639L, +/* 140*/ 0xc020301bL,0x356dbc00L,0x8e43ddb9L,0x4d327b4aL,0xf20ff3edL, +/* 145*/ 0x1dbb29bdL,0x43d44779L,0xa1b68f70L,0x6114455bL,0xe63d280bL, +/* 150*/ 0x6bf6ff65L,0x10fc39e5L,0x3dae126eL,0xc1d7cf11L,0xcb60b795L, +/* 155*/ 0x1789d5b3L,0x9bca36b7L,0x08306075L,0x84615608L,0x8b3a0186L, +/* 160*/ 0xe88fbecdL,0x7ba47c4dL,0x2de44dacL,0x653fe58dL,0xcca0b968L, +/* 165*/ 0xd7fa0e72L,0x93901780L,0x1f2c26ccL,0xae595b6bL,0xa9ecea9bL, +/* 170*/ 0xe3dbf8c4L,0x319cc130L,0x12981196L,0x01a3a4deL,0x32c454b6L, +/* 175*/ 0x755bd817L,0x3cd871e4L,0xa48bb8daL,0x02fdec09L,0xfd2dc2e2L, +/* 180*/ 0x9e578088L,0x9a9f916dL,0x4065fe6cL,0x1853999eL,0xc7793f23L, +/* 185*/ 0xdc1016bbL,0x969355ffL,0x7ef292f6L,0xcdce4adcL,0x05e24416L, +/* 190*/ 0x85c16c46L,0xd441d37fL,0x57bd6855L,0x8746f54fL,0x9ca773dfL, +/* 195*/ 0x770bae22L,0x54828413L,0xb75e4b19L,0x04c35c03L,0xbf7cca07L, +/* 200*/ 0x2955c4ddL,0x721db041L,0xb2394f33L,0x03f51387L,0x89b73c9fL, +/* 205*/ 0x0b1737f3L,0x07e69024L,0x9231d245L,0x76193861L,0x88159c15L, +/* 210*/ 0xdeb552d9L,0xd9767e40L,0x20c6c0c3L,0x4281977cL,0xf8afe1e0L, +/* 215*/ 0xd32a0751L,0x3fc27432L,0xddf1dcc5L,0x68581f34L,0x3bcd5025L, +/* 220*/ 0x0091b2eeL,0x4aeb6944L,0x1602e743L,0xea09eb58L,0xef0a2a8bL, +/* 225*/ 0x641e03a5L,0xeb50e021L,0x5c8ccef8L,0x802ff0b8L,0xd5e3edfeL, +/* 230*/ 0xc4dd1b49L,0x5334cd2aL,0x13f82d2fL,0x47450c20L,0x55dafbd2L, +/* 235*/ 0xbec0c6f4L,0xb45d7959L,0x3ad36e8cL,0x0aa8ac57L,0x1a3c8d73L, +/* 240*/ 0xe45aafb1L,0x9f664838L,0xc6880053L,0xd0039bbfL,0xee5f19ebL, +/* 245*/ 0xca0041d8L,0xbbea3aafL,0xda628291L,0x9d5c95d4L,0xadd504a6L, +/* 250*/ 0xc39ab482L,0x5e9e14a4L,0x2be065f0L,0x2a13fc3aL,0x9052e8ecL, +/* 255*/ 0xaf6f5afcL + /* End of S Box 14 */ }, + + + { /* Start of S Box 15 */ + +/* 0*/ 0x519aa8b5L,0xbb303da9L,0xe00e2b10L,0xdfa6c1dbL,0x2e6b952eL, +/* 5*/ 0xee10dc23L,0x37936d09L,0x1fc42e92L,0x39b25a9fL,0x13ff89f4L, +/* 10*/ 0xc8f53feaL,0x18500bc7L,0x95a0379dL,0x98f751c2L,0x2289c42fL, +/* 15*/ 0xa21e4098L,0x6f391f41L,0xf27e7e58L,0x0d0df887L,0x4b79d540L, +/* 20*/ 0x8e8409aaL,0x71fe46f8L,0x688a9b29L,0x3f08b548L,0x84abe03aL, +/* 25*/ 0x5e91b6c1L,0xfde4c2aeL,0x251d0e72L,0x92d4fee5L,0xf9371967L, +/* 30*/ 0x9175108fL,0xe6e81835L,0x8c8cb8eeL,0xb55a67b3L,0xcef138ccL, +/* 35*/ 0x8b256268L,0x00d815f5L,0xe8810812L,0x77826189L,0xea73267dL, +/* 40*/ 0x19b90f8dL,0x45c33bb4L,0x82477056L,0xe1770075L,0x09467aa6L, +/* 45*/ 0xa7c6f54aL,0x79768742L,0x61b86bcaL,0xd6644a44L,0xe33f0171L, +/* 50*/ 0xc229fbcdL,0x41b08febL,0xd1903e30L,0x65ec9080L,0x563d6fbdL, +/* 55*/ 0xf56da488L,0xebf64cd8L,0x4934426bL,0x7c8592fcL,0x6aca8cf2L, +/* 60*/ 0x1cea111bL,0x3a57ee7aL,0xace11c0dL,0x9942d85eL,0xc4613407L, +/* 65*/ 0xfa8e643bL,0x327fc701L,0x4ca9be82L,0x3352526dL,0x2c047f63L, +/* 70*/ 0xf3a8f7ddL,0x1a4a98a8L,0x762ed4d1L,0x27c75008L,0xbdf497c0L, +/* 75*/ 0x7a7b84dfL,0x315c28abL,0x801f93e3L,0xf19b0ca1L,0x8f14e46aL, +/* 80*/ 0xe48ba333L,0x9605e625L,0xf03ecb60L,0x60385f2dL,0x902845baL, +/* 85*/ 0x7f96d66fL,0x24bff05cL,0x2820730bL,0x947133cbL,0xd444828aL, +/* 90*/ 0xb343f6f1L,0x0bef4705L,0x8da574f9L,0x01e25d6cL,0x1732793eL, +/* 95*/ 0x4f0f7b27L,0x364b7117L,0xb2d1da77L,0xa6c5f1e9L,0x574ca5b1L, +/* 100*/ 0x386a3076L,0xad6894d6L,0x1156d7faL,0xa48d1d9aL,0x4794c0afL, +/* 105*/ 0x150c0aa0L,0x26d348acL,0x29fdeabeL,0xa5dede53L,0x81671e8eL, +/* 110*/ 0x594ee3bfL,0xa96c56e6L,0x3426a726L,0xc5976579L,0xbc22e5e4L, +/* 115*/ 0xc1006319L,0xdaafdd2aL,0xa1a1aa83L,0x3badd0e7L,0xc3b14981L, +/* 120*/ 0xd770b155L,0xccd7c693L,0x42e944c5L,0x03e0064fL,0xca95b4efL, +/* 125*/ 0x3dee81c3L,0xfbbcd98cL,0x1e07e15bL,0x667ce949L,0xe7d6773fL, +/* 130*/ 0x21b6124bL,0x6b2a6ef7L,0xd3278a9cL,0x9a988304L,0x75d2ae9bL, +/* 135*/ 0xfe49e2ffL,0x9bc24f46L,0x74cc2cf6L,0xa3139f36L,0x6c9ef35aL, +/* 140*/ 0x9fc1dffeL,0x9e5facdcL,0xaadc8bbbL,0x5abdbc5fL,0x44b3b390L, +/* 145*/ 0xf754efa7L,0x5fe3bdb7L,0x4e59c886L,0x06a4c984L,0xa0338878L, +/* 150*/ 0xcd513cd7L,0x63ebd27eL,0x8aba80adL,0x50da144eL,0x5d9f4e97L, +/* 155*/ 0x025b751cL,0x2d580200L,0xb6c05837L,0x580aa15dL,0x54022a6eL, +/* 160*/ 0xb41a5415L,0x4863fab6L,0xb0b79957L,0x46d0d159L,0xdc2b8650L, +/* 165*/ 0x20a7bb0cL,0x4a032974L,0xec8636a2L,0x8548f24cL,0xf6a2bf16L, +/* 170*/ 0x1088f4b0L,0x0c2f3a94L,0x525dc396L,0x14065785L,0x2b4dca52L, +/* 175*/ 0x08aeed39L,0xabedfc99L,0xb1dbcf18L,0x87f85bbcL,0xae3aff61L, +/* 180*/ 0x433ccd70L,0x5b23cc64L,0x7b453213L,0x5355c545L,0x9318ec0aL, +/* 185*/ 0x78692d31L,0x0a21693dL,0xd5666814L,0x05fb59d9L,0xc71985b2L, +/* 190*/ 0x2abb8e0eL,0xcf6e6c91L,0xd9cfe7c6L,0xefe7132cL,0x9711ab28L, +/* 195*/ 0x3ce52732L,0x12d516d2L,0x7209a0d0L,0xd278d306L,0x70fa4b7bL, +/* 200*/ 0x1d407dd3L,0xdb0beba4L,0xbfd97621L,0xa8be21e1L,0x1b6f1b66L, +/* 205*/ 0x30650ddaL,0xba7ddbb9L,0x7df953fbL,0x9d1c3902L,0xedf0e8d5L, +/* 210*/ 0xb8741ae0L,0x0f240565L,0x62cd438bL,0xc616a924L,0xaf7a96a3L, +/* 215*/ 0x35365538L,0xe583af4dL,0x73415eb8L,0x23176a47L,0xfc9ccee8L, +/* 220*/ 0x7efc9de2L,0x695e03cfL,0xf8ce66d4L,0x88b4781dL,0x67dd9c03L, +/* 225*/ 0x3e8f9e73L,0xc0c95c51L,0xbe314d22L,0x55aa0795L,0xcb1bb011L, +/* 230*/ 0xe980fdc8L,0x9c62b7ceL,0xde2d239eL,0x042cadf3L,0xffdf04deL, +/* 235*/ 0x5ce6a60fL,0xd8c831edL,0xb7b5b9ecL,0xb9cbf962L,0xe253b254L, +/* 240*/ 0x0735ba1fL,0x16ac917fL,0xdd607c2bL,0x64a335c4L,0x40159a7cL, +/* 245*/ 0x869222f0L,0x6ef21769L,0x839d20a5L,0xd03b24c9L,0xf412601eL, +/* 250*/ 0x6d72a243L,0x0e018dfdL,0x89f3721aL,0xc94f4134L,0x2f992f20L, +/* 255*/ 0x4d87253cL + /* End of S Box 15 */ } +}; + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/src/cpp/ext/hash/php_hash_tiger_tables.h b/src/cpp/ext/hash/php_hash_tiger_tables.h new file mode 100644 index 0000000000000..c8672cf72e0b7 --- /dev/null +++ b/src/cpp/ext/hash/php_hash_tiger_tables.h @@ -0,0 +1,547 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +/* $Id: php_hash_tiger_tables.h,v 1.2.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */ + +#define t1 (table) +#define t2 (table+256) +#define t3 (table+256*2) +#define t4 (table+256*3) + +static const unsigned long table[4*256] = { + L64(0x02AAB17CF7E90C5E) /* 0 */, L64(0xAC424B03E243A8EC) /* 1 */, + L64(0x72CD5BE30DD5FCD3) /* 2 */, L64(0x6D019B93F6F97F3A) /* 3 */, + L64(0xCD9978FFD21F9193) /* 4 */, L64(0x7573A1C9708029E2) /* 5 */, + L64(0xB164326B922A83C3) /* 6 */, L64(0x46883EEE04915870) /* 7 */, + L64(0xEAACE3057103ECE6) /* 8 */, L64(0xC54169B808A3535C) /* 9 */, + L64(0x4CE754918DDEC47C) /* 10 */, L64(0x0AA2F4DFDC0DF40C) /* 11 */, + L64(0x10B76F18A74DBEFA) /* 12 */, L64(0xC6CCB6235AD1AB6A) /* 13 */, + L64(0x13726121572FE2FF) /* 14 */, L64(0x1A488C6F199D921E) /* 15 */, + L64(0x4BC9F9F4DA0007CA) /* 16 */, L64(0x26F5E6F6E85241C7) /* 17 */, + L64(0x859079DBEA5947B6) /* 18 */, L64(0x4F1885C5C99E8C92) /* 19 */, + L64(0xD78E761EA96F864B) /* 20 */, L64(0x8E36428C52B5C17D) /* 21 */, + L64(0x69CF6827373063C1) /* 22 */, L64(0xB607C93D9BB4C56E) /* 23 */, + L64(0x7D820E760E76B5EA) /* 24 */, L64(0x645C9CC6F07FDC42) /* 25 */, + L64(0xBF38A078243342E0) /* 26 */, L64(0x5F6B343C9D2E7D04) /* 27 */, + L64(0xF2C28AEB600B0EC6) /* 28 */, L64(0x6C0ED85F7254BCAC) /* 29 */, + L64(0x71592281A4DB4FE5) /* 30 */, L64(0x1967FA69CE0FED9F) /* 31 */, + L64(0xFD5293F8B96545DB) /* 32 */, L64(0xC879E9D7F2A7600B) /* 33 */, + L64(0x860248920193194E) /* 34 */, L64(0xA4F9533B2D9CC0B3) /* 35 */, + L64(0x9053836C15957613) /* 36 */, L64(0xDB6DCF8AFC357BF1) /* 37 */, + L64(0x18BEEA7A7A370F57) /* 38 */, L64(0x037117CA50B99066) /* 39 */, + L64(0x6AB30A9774424A35) /* 40 */, L64(0xF4E92F02E325249B) /* 41 */, + L64(0x7739DB07061CCAE1) /* 42 */, L64(0xD8F3B49CECA42A05) /* 43 */, + L64(0xBD56BE3F51382F73) /* 44 */, L64(0x45FAED5843B0BB28) /* 45 */, + L64(0x1C813D5C11BF1F83) /* 46 */, L64(0x8AF0E4B6D75FA169) /* 47 */, + L64(0x33EE18A487AD9999) /* 48 */, L64(0x3C26E8EAB1C94410) /* 49 */, + L64(0xB510102BC0A822F9) /* 50 */, L64(0x141EEF310CE6123B) /* 51 */, + L64(0xFC65B90059DDB154) /* 52 */, L64(0xE0158640C5E0E607) /* 53 */, + L64(0x884E079826C3A3CF) /* 54 */, L64(0x930D0D9523C535FD) /* 55 */, + L64(0x35638D754E9A2B00) /* 56 */, L64(0x4085FCCF40469DD5) /* 57 */, + L64(0xC4B17AD28BE23A4C) /* 58 */, L64(0xCAB2F0FC6A3E6A2E) /* 59 */, + L64(0x2860971A6B943FCD) /* 60 */, L64(0x3DDE6EE212E30446) /* 61 */, + L64(0x6222F32AE01765AE) /* 62 */, L64(0x5D550BB5478308FE) /* 63 */, + L64(0xA9EFA98DA0EDA22A) /* 64 */, L64(0xC351A71686C40DA7) /* 65 */, + L64(0x1105586D9C867C84) /* 66 */, L64(0xDCFFEE85FDA22853) /* 67 */, + L64(0xCCFBD0262C5EEF76) /* 68 */, L64(0xBAF294CB8990D201) /* 69 */, + L64(0xE69464F52AFAD975) /* 70 */, L64(0x94B013AFDF133E14) /* 71 */, + L64(0x06A7D1A32823C958) /* 72 */, L64(0x6F95FE5130F61119) /* 73 */, + L64(0xD92AB34E462C06C0) /* 74 */, L64(0xED7BDE33887C71D2) /* 75 */, + L64(0x79746D6E6518393E) /* 76 */, L64(0x5BA419385D713329) /* 77 */, + L64(0x7C1BA6B948A97564) /* 78 */, L64(0x31987C197BFDAC67) /* 79 */, + L64(0xDE6C23C44B053D02) /* 80 */, L64(0x581C49FED002D64D) /* 81 */, + L64(0xDD474D6338261571) /* 82 */, L64(0xAA4546C3E473D062) /* 83 */, + L64(0x928FCE349455F860) /* 84 */, L64(0x48161BBACAAB94D9) /* 85 */, + L64(0x63912430770E6F68) /* 86 */, L64(0x6EC8A5E602C6641C) /* 87 */, + L64(0x87282515337DDD2B) /* 88 */, L64(0x2CDA6B42034B701B) /* 89 */, + L64(0xB03D37C181CB096D) /* 90 */, L64(0xE108438266C71C6F) /* 91 */, + L64(0x2B3180C7EB51B255) /* 92 */, L64(0xDF92B82F96C08BBC) /* 93 */, + L64(0x5C68C8C0A632F3BA) /* 94 */, L64(0x5504CC861C3D0556) /* 95 */, + L64(0xABBFA4E55FB26B8F) /* 96 */, L64(0x41848B0AB3BACEB4) /* 97 */, + L64(0xB334A273AA445D32) /* 98 */, L64(0xBCA696F0A85AD881) /* 99 */, + L64(0x24F6EC65B528D56C) /* 100 */, L64(0x0CE1512E90F4524A) /* 101 */, + L64(0x4E9DD79D5506D35A) /* 102 */, L64(0x258905FAC6CE9779) /* 103 */, + L64(0x2019295B3E109B33) /* 104 */, L64(0xF8A9478B73A054CC) /* 105 */, + L64(0x2924F2F934417EB0) /* 106 */, L64(0x3993357D536D1BC4) /* 107 */, + L64(0x38A81AC21DB6FF8B) /* 108 */, L64(0x47C4FBF17D6016BF) /* 109 */, + L64(0x1E0FAADD7667E3F5) /* 110 */, L64(0x7ABCFF62938BEB96) /* 111 */, + L64(0xA78DAD948FC179C9) /* 112 */, L64(0x8F1F98B72911E50D) /* 113 */, + L64(0x61E48EAE27121A91) /* 114 */, L64(0x4D62F7AD31859808) /* 115 */, + L64(0xECEBA345EF5CEAEB) /* 116 */, L64(0xF5CEB25EBC9684CE) /* 117 */, + L64(0xF633E20CB7F76221) /* 118 */, L64(0xA32CDF06AB8293E4) /* 119 */, + L64(0x985A202CA5EE2CA4) /* 120 */, L64(0xCF0B8447CC8A8FB1) /* 121 */, + L64(0x9F765244979859A3) /* 122 */, L64(0xA8D516B1A1240017) /* 123 */, + L64(0x0BD7BA3EBB5DC726) /* 124 */, L64(0xE54BCA55B86ADB39) /* 125 */, + L64(0x1D7A3AFD6C478063) /* 126 */, L64(0x519EC608E7669EDD) /* 127 */, + L64(0x0E5715A2D149AA23) /* 128 */, L64(0x177D4571848FF194) /* 129 */, + L64(0xEEB55F3241014C22) /* 130 */, L64(0x0F5E5CA13A6E2EC2) /* 131 */, + L64(0x8029927B75F5C361) /* 132 */, L64(0xAD139FABC3D6E436) /* 133 */, + L64(0x0D5DF1A94CCF402F) /* 134 */, L64(0x3E8BD948BEA5DFC8) /* 135 */, + L64(0xA5A0D357BD3FF77E) /* 136 */, L64(0xA2D12E251F74F645) /* 137 */, + L64(0x66FD9E525E81A082) /* 138 */, L64(0x2E0C90CE7F687A49) /* 139 */, + L64(0xC2E8BCBEBA973BC5) /* 140 */, L64(0x000001BCE509745F) /* 141 */, + L64(0x423777BBE6DAB3D6) /* 142 */, L64(0xD1661C7EAEF06EB5) /* 143 */, + L64(0xA1781F354DAACFD8) /* 144 */, L64(0x2D11284A2B16AFFC) /* 145 */, + L64(0xF1FC4F67FA891D1F) /* 146 */, L64(0x73ECC25DCB920ADA) /* 147 */, + L64(0xAE610C22C2A12651) /* 148 */, L64(0x96E0A810D356B78A) /* 149 */, + L64(0x5A9A381F2FE7870F) /* 150 */, L64(0xD5AD62EDE94E5530) /* 151 */, + L64(0xD225E5E8368D1427) /* 152 */, L64(0x65977B70C7AF4631) /* 153 */, + L64(0x99F889B2DE39D74F) /* 154 */, L64(0x233F30BF54E1D143) /* 155 */, + L64(0x9A9675D3D9A63C97) /* 156 */, L64(0x5470554FF334F9A8) /* 157 */, + L64(0x166ACB744A4F5688) /* 158 */, L64(0x70C74CAAB2E4AEAD) /* 159 */, + L64(0xF0D091646F294D12) /* 160 */, L64(0x57B82A89684031D1) /* 161 */, + L64(0xEFD95A5A61BE0B6B) /* 162 */, L64(0x2FBD12E969F2F29A) /* 163 */, + L64(0x9BD37013FEFF9FE8) /* 164 */, L64(0x3F9B0404D6085A06) /* 165 */, + L64(0x4940C1F3166CFE15) /* 166 */, L64(0x09542C4DCDF3DEFB) /* 167 */, + L64(0xB4C5218385CD5CE3) /* 168 */, L64(0xC935B7DC4462A641) /* 169 */, + L64(0x3417F8A68ED3B63F) /* 170 */, L64(0xB80959295B215B40) /* 171 */, + L64(0xF99CDAEF3B8C8572) /* 172 */, L64(0x018C0614F8FCB95D) /* 173 */, + L64(0x1B14ACCD1A3ACDF3) /* 174 */, L64(0x84D471F200BB732D) /* 175 */, + L64(0xC1A3110E95E8DA16) /* 176 */, L64(0x430A7220BF1A82B8) /* 177 */, + L64(0xB77E090D39DF210E) /* 178 */, L64(0x5EF4BD9F3CD05E9D) /* 179 */, + L64(0x9D4FF6DA7E57A444) /* 180 */, L64(0xDA1D60E183D4A5F8) /* 181 */, + L64(0xB287C38417998E47) /* 182 */, L64(0xFE3EDC121BB31886) /* 183 */, + L64(0xC7FE3CCC980CCBEF) /* 184 */, L64(0xE46FB590189BFD03) /* 185 */, + L64(0x3732FD469A4C57DC) /* 186 */, L64(0x7EF700A07CF1AD65) /* 187 */, + L64(0x59C64468A31D8859) /* 188 */, L64(0x762FB0B4D45B61F6) /* 189 */, + L64(0x155BAED099047718) /* 190 */, L64(0x68755E4C3D50BAA6) /* 191 */, + L64(0xE9214E7F22D8B4DF) /* 192 */, L64(0x2ADDBF532EAC95F4) /* 193 */, + L64(0x32AE3909B4BD0109) /* 194 */, L64(0x834DF537B08E3450) /* 195 */, + L64(0xFA209DA84220728D) /* 196 */, L64(0x9E691D9B9EFE23F7) /* 197 */, + L64(0x0446D288C4AE8D7F) /* 198 */, L64(0x7B4CC524E169785B) /* 199 */, + L64(0x21D87F0135CA1385) /* 200 */, L64(0xCEBB400F137B8AA5) /* 201 */, + L64(0x272E2B66580796BE) /* 202 */, L64(0x3612264125C2B0DE) /* 203 */, + L64(0x057702BDAD1EFBB2) /* 204 */, L64(0xD4BABB8EACF84BE9) /* 205 */, + L64(0x91583139641BC67B) /* 206 */, L64(0x8BDC2DE08036E024) /* 207 */, + L64(0x603C8156F49F68ED) /* 208 */, L64(0xF7D236F7DBEF5111) /* 209 */, + L64(0x9727C4598AD21E80) /* 210 */, L64(0xA08A0896670A5FD7) /* 211 */, + L64(0xCB4A8F4309EBA9CB) /* 212 */, L64(0x81AF564B0F7036A1) /* 213 */, + L64(0xC0B99AA778199ABD) /* 214 */, L64(0x959F1EC83FC8E952) /* 215 */, + L64(0x8C505077794A81B9) /* 216 */, L64(0x3ACAAF8F056338F0) /* 217 */, + L64(0x07B43F50627A6778) /* 218 */, L64(0x4A44AB49F5ECCC77) /* 219 */, + L64(0x3BC3D6E4B679EE98) /* 220 */, L64(0x9CC0D4D1CF14108C) /* 221 */, + L64(0x4406C00B206BC8A0) /* 222 */, L64(0x82A18854C8D72D89) /* 223 */, + L64(0x67E366B35C3C432C) /* 224 */, L64(0xB923DD61102B37F2) /* 225 */, + L64(0x56AB2779D884271D) /* 226 */, L64(0xBE83E1B0FF1525AF) /* 227 */, + L64(0xFB7C65D4217E49A9) /* 228 */, L64(0x6BDBE0E76D48E7D4) /* 229 */, + L64(0x08DF828745D9179E) /* 230 */, L64(0x22EA6A9ADD53BD34) /* 231 */, + L64(0xE36E141C5622200A) /* 232 */, L64(0x7F805D1B8CB750EE) /* 233 */, + L64(0xAFE5C7A59F58E837) /* 234 */, L64(0xE27F996A4FB1C23C) /* 235 */, + L64(0xD3867DFB0775F0D0) /* 236 */, L64(0xD0E673DE6E88891A) /* 237 */, + L64(0x123AEB9EAFB86C25) /* 238 */, L64(0x30F1D5D5C145B895) /* 239 */, + L64(0xBB434A2DEE7269E7) /* 240 */, L64(0x78CB67ECF931FA38) /* 241 */, + L64(0xF33B0372323BBF9C) /* 242 */, L64(0x52D66336FB279C74) /* 243 */, + L64(0x505F33AC0AFB4EAA) /* 244 */, L64(0xE8A5CD99A2CCE187) /* 245 */, + L64(0x534974801E2D30BB) /* 246 */, L64(0x8D2D5711D5876D90) /* 247 */, + L64(0x1F1A412891BC038E) /* 248 */, L64(0xD6E2E71D82E56648) /* 249 */, + L64(0x74036C3A497732B7) /* 250 */, L64(0x89B67ED96361F5AB) /* 251 */, + L64(0xFFED95D8F1EA02A2) /* 252 */, L64(0xE72B3BD61464D43D) /* 253 */, + L64(0xA6300F170BDC4820) /* 254 */, L64(0xEBC18760ED78A77A) /* 255 */, + L64(0xE6A6BE5A05A12138) /* 256 */, L64(0xB5A122A5B4F87C98) /* 257 */, + L64(0x563C6089140B6990) /* 258 */, L64(0x4C46CB2E391F5DD5) /* 259 */, + L64(0xD932ADDBC9B79434) /* 260 */, L64(0x08EA70E42015AFF5) /* 261 */, + L64(0xD765A6673E478CF1) /* 262 */, L64(0xC4FB757EAB278D99) /* 263 */, + L64(0xDF11C6862D6E0692) /* 264 */, L64(0xDDEB84F10D7F3B16) /* 265 */, + L64(0x6F2EF604A665EA04) /* 266 */, L64(0x4A8E0F0FF0E0DFB3) /* 267 */, + L64(0xA5EDEEF83DBCBA51) /* 268 */, L64(0xFC4F0A2A0EA4371E) /* 269 */, + L64(0xE83E1DA85CB38429) /* 270 */, L64(0xDC8FF882BA1B1CE2) /* 271 */, + L64(0xCD45505E8353E80D) /* 272 */, L64(0x18D19A00D4DB0717) /* 273 */, + L64(0x34A0CFEDA5F38101) /* 274 */, L64(0x0BE77E518887CAF2) /* 275 */, + L64(0x1E341438B3C45136) /* 276 */, L64(0xE05797F49089CCF9) /* 277 */, + L64(0xFFD23F9DF2591D14) /* 278 */, L64(0x543DDA228595C5CD) /* 279 */, + L64(0x661F81FD99052A33) /* 280 */, L64(0x8736E641DB0F7B76) /* 281 */, + L64(0x15227725418E5307) /* 282 */, L64(0xE25F7F46162EB2FA) /* 283 */, + L64(0x48A8B2126C13D9FE) /* 284 */, L64(0xAFDC541792E76EEA) /* 285 */, + L64(0x03D912BFC6D1898F) /* 286 */, L64(0x31B1AAFA1B83F51B) /* 287 */, + L64(0xF1AC2796E42AB7D9) /* 288 */, L64(0x40A3A7D7FCD2EBAC) /* 289 */, + L64(0x1056136D0AFBBCC5) /* 290 */, L64(0x7889E1DD9A6D0C85) /* 291 */, + L64(0xD33525782A7974AA) /* 292 */, L64(0xA7E25D09078AC09B) /* 293 */, + L64(0xBD4138B3EAC6EDD0) /* 294 */, L64(0x920ABFBE71EB9E70) /* 295 */, + L64(0xA2A5D0F54FC2625C) /* 296 */, L64(0xC054E36B0B1290A3) /* 297 */, + L64(0xF6DD59FF62FE932B) /* 298 */, L64(0x3537354511A8AC7D) /* 299 */, + L64(0xCA845E9172FADCD4) /* 300 */, L64(0x84F82B60329D20DC) /* 301 */, + L64(0x79C62CE1CD672F18) /* 302 */, L64(0x8B09A2ADD124642C) /* 303 */, + L64(0xD0C1E96A19D9E726) /* 304 */, L64(0x5A786A9B4BA9500C) /* 305 */, + L64(0x0E020336634C43F3) /* 306 */, L64(0xC17B474AEB66D822) /* 307 */, + L64(0x6A731AE3EC9BAAC2) /* 308 */, L64(0x8226667AE0840258) /* 309 */, + L64(0x67D4567691CAECA5) /* 310 */, L64(0x1D94155C4875ADB5) /* 311 */, + L64(0x6D00FD985B813FDF) /* 312 */, L64(0x51286EFCB774CD06) /* 313 */, + L64(0x5E8834471FA744AF) /* 314 */, L64(0xF72CA0AEE761AE2E) /* 315 */, + L64(0xBE40E4CDAEE8E09A) /* 316 */, L64(0xE9970BBB5118F665) /* 317 */, + L64(0x726E4BEB33DF1964) /* 318 */, L64(0x703B000729199762) /* 319 */, + L64(0x4631D816F5EF30A7) /* 320 */, L64(0xB880B5B51504A6BE) /* 321 */, + L64(0x641793C37ED84B6C) /* 322 */, L64(0x7B21ED77F6E97D96) /* 323 */, + L64(0x776306312EF96B73) /* 324 */, L64(0xAE528948E86FF3F4) /* 325 */, + L64(0x53DBD7F286A3F8F8) /* 326 */, L64(0x16CADCE74CFC1063) /* 327 */, + L64(0x005C19BDFA52C6DD) /* 328 */, L64(0x68868F5D64D46AD3) /* 329 */, + L64(0x3A9D512CCF1E186A) /* 330 */, L64(0x367E62C2385660AE) /* 331 */, + L64(0xE359E7EA77DCB1D7) /* 332 */, L64(0x526C0773749ABE6E) /* 333 */, + L64(0x735AE5F9D09F734B) /* 334 */, L64(0x493FC7CC8A558BA8) /* 335 */, + L64(0xB0B9C1533041AB45) /* 336 */, L64(0x321958BA470A59BD) /* 337 */, + L64(0x852DB00B5F46C393) /* 338 */, L64(0x91209B2BD336B0E5) /* 339 */, + L64(0x6E604F7D659EF19F) /* 340 */, L64(0xB99A8AE2782CCB24) /* 341 */, + L64(0xCCF52AB6C814C4C7) /* 342 */, L64(0x4727D9AFBE11727B) /* 343 */, + L64(0x7E950D0C0121B34D) /* 344 */, L64(0x756F435670AD471F) /* 345 */, + L64(0xF5ADD442615A6849) /* 346 */, L64(0x4E87E09980B9957A) /* 347 */, + L64(0x2ACFA1DF50AEE355) /* 348 */, L64(0xD898263AFD2FD556) /* 349 */, + L64(0xC8F4924DD80C8FD6) /* 350 */, L64(0xCF99CA3D754A173A) /* 351 */, + L64(0xFE477BACAF91BF3C) /* 352 */, L64(0xED5371F6D690C12D) /* 353 */, + L64(0x831A5C285E687094) /* 354 */, L64(0xC5D3C90A3708A0A4) /* 355 */, + L64(0x0F7F903717D06580) /* 356 */, L64(0x19F9BB13B8FDF27F) /* 357 */, + L64(0xB1BD6F1B4D502843) /* 358 */, L64(0x1C761BA38FFF4012) /* 359 */, + L64(0x0D1530C4E2E21F3B) /* 360 */, L64(0x8943CE69A7372C8A) /* 361 */, + L64(0xE5184E11FEB5CE66) /* 362 */, L64(0x618BDB80BD736621) /* 363 */, + L64(0x7D29BAD68B574D0B) /* 364 */, L64(0x81BB613E25E6FE5B) /* 365 */, + L64(0x071C9C10BC07913F) /* 366 */, L64(0xC7BEEB7909AC2D97) /* 367 */, + L64(0xC3E58D353BC5D757) /* 368 */, L64(0xEB017892F38F61E8) /* 369 */, + L64(0xD4EFFB9C9B1CC21A) /* 370 */, L64(0x99727D26F494F7AB) /* 371 */, + L64(0xA3E063A2956B3E03) /* 372 */, L64(0x9D4A8B9A4AA09C30) /* 373 */, + L64(0x3F6AB7D500090FB4) /* 374 */, L64(0x9CC0F2A057268AC0) /* 375 */, + L64(0x3DEE9D2DEDBF42D1) /* 376 */, L64(0x330F49C87960A972) /* 377 */, + L64(0xC6B2720287421B41) /* 378 */, L64(0x0AC59EC07C00369C) /* 379 */, + L64(0xEF4EAC49CB353425) /* 380 */, L64(0xF450244EEF0129D8) /* 381 */, + L64(0x8ACC46E5CAF4DEB6) /* 382 */, L64(0x2FFEAB63989263F7) /* 383 */, + L64(0x8F7CB9FE5D7A4578) /* 384 */, L64(0x5BD8F7644E634635) /* 385 */, + L64(0x427A7315BF2DC900) /* 386 */, L64(0x17D0C4AA2125261C) /* 387 */, + L64(0x3992486C93518E50) /* 388 */, L64(0xB4CBFEE0A2D7D4C3) /* 389 */, + L64(0x7C75D6202C5DDD8D) /* 390 */, L64(0xDBC295D8E35B6C61) /* 391 */, + L64(0x60B369D302032B19) /* 392 */, L64(0xCE42685FDCE44132) /* 393 */, + L64(0x06F3DDB9DDF65610) /* 394 */, L64(0x8EA4D21DB5E148F0) /* 395 */, + L64(0x20B0FCE62FCD496F) /* 396 */, L64(0x2C1B912358B0EE31) /* 397 */, + L64(0xB28317B818F5A308) /* 398 */, L64(0xA89C1E189CA6D2CF) /* 399 */, + L64(0x0C6B18576AAADBC8) /* 400 */, L64(0xB65DEAA91299FAE3) /* 401 */, + L64(0xFB2B794B7F1027E7) /* 402 */, L64(0x04E4317F443B5BEB) /* 403 */, + L64(0x4B852D325939D0A6) /* 404 */, L64(0xD5AE6BEEFB207FFC) /* 405 */, + L64(0x309682B281C7D374) /* 406 */, L64(0xBAE309A194C3B475) /* 407 */, + L64(0x8CC3F97B13B49F05) /* 408 */, L64(0x98A9422FF8293967) /* 409 */, + L64(0x244B16B01076FF7C) /* 410 */, L64(0xF8BF571C663D67EE) /* 411 */, + L64(0x1F0D6758EEE30DA1) /* 412 */, L64(0xC9B611D97ADEB9B7) /* 413 */, + L64(0xB7AFD5887B6C57A2) /* 414 */, L64(0x6290AE846B984FE1) /* 415 */, + L64(0x94DF4CDEACC1A5FD) /* 416 */, L64(0x058A5BD1C5483AFF) /* 417 */, + L64(0x63166CC142BA3C37) /* 418 */, L64(0x8DB8526EB2F76F40) /* 419 */, + L64(0xE10880036F0D6D4E) /* 420 */, L64(0x9E0523C9971D311D) /* 421 */, + L64(0x45EC2824CC7CD691) /* 422 */, L64(0x575B8359E62382C9) /* 423 */, + L64(0xFA9E400DC4889995) /* 424 */, L64(0xD1823ECB45721568) /* 425 */, + L64(0xDAFD983B8206082F) /* 426 */, L64(0xAA7D29082386A8CB) /* 427 */, + L64(0x269FCD4403B87588) /* 428 */, L64(0x1B91F5F728BDD1E0) /* 429 */, + L64(0xE4669F39040201F6) /* 430 */, L64(0x7A1D7C218CF04ADE) /* 431 */, + L64(0x65623C29D79CE5CE) /* 432 */, L64(0x2368449096C00BB1) /* 433 */, + L64(0xAB9BF1879DA503BA) /* 434 */, L64(0xBC23ECB1A458058E) /* 435 */, + L64(0x9A58DF01BB401ECC) /* 436 */, L64(0xA070E868A85F143D) /* 437 */, + L64(0x4FF188307DF2239E) /* 438 */, L64(0x14D565B41A641183) /* 439 */, + L64(0xEE13337452701602) /* 440 */, L64(0x950E3DCF3F285E09) /* 441 */, + L64(0x59930254B9C80953) /* 442 */, L64(0x3BF299408930DA6D) /* 443 */, + L64(0xA955943F53691387) /* 444 */, L64(0xA15EDECAA9CB8784) /* 445 */, + L64(0x29142127352BE9A0) /* 446 */, L64(0x76F0371FFF4E7AFB) /* 447 */, + L64(0x0239F450274F2228) /* 448 */, L64(0xBB073AF01D5E868B) /* 449 */, + L64(0xBFC80571C10E96C1) /* 450 */, L64(0xD267088568222E23) /* 451 */, + L64(0x9671A3D48E80B5B0) /* 452 */, L64(0x55B5D38AE193BB81) /* 453 */, + L64(0x693AE2D0A18B04B8) /* 454 */, L64(0x5C48B4ECADD5335F) /* 455 */, + L64(0xFD743B194916A1CA) /* 456 */, L64(0x2577018134BE98C4) /* 457 */, + L64(0xE77987E83C54A4AD) /* 458 */, L64(0x28E11014DA33E1B9) /* 459 */, + L64(0x270CC59E226AA213) /* 460 */, L64(0x71495F756D1A5F60) /* 461 */, + L64(0x9BE853FB60AFEF77) /* 462 */, L64(0xADC786A7F7443DBF) /* 463 */, + L64(0x0904456173B29A82) /* 464 */, L64(0x58BC7A66C232BD5E) /* 465 */, + L64(0xF306558C673AC8B2) /* 466 */, L64(0x41F639C6B6C9772A) /* 467 */, + L64(0x216DEFE99FDA35DA) /* 468 */, L64(0x11640CC71C7BE615) /* 469 */, + L64(0x93C43694565C5527) /* 470 */, L64(0xEA038E6246777839) /* 471 */, + L64(0xF9ABF3CE5A3E2469) /* 472 */, L64(0x741E768D0FD312D2) /* 473 */, + L64(0x0144B883CED652C6) /* 474 */, L64(0xC20B5A5BA33F8552) /* 475 */, + L64(0x1AE69633C3435A9D) /* 476 */, L64(0x97A28CA4088CFDEC) /* 477 */, + L64(0x8824A43C1E96F420) /* 478 */, L64(0x37612FA66EEEA746) /* 479 */, + L64(0x6B4CB165F9CF0E5A) /* 480 */, L64(0x43AA1C06A0ABFB4A) /* 481 */, + L64(0x7F4DC26FF162796B) /* 482 */, L64(0x6CBACC8E54ED9B0F) /* 483 */, + L64(0xA6B7FFEFD2BB253E) /* 484 */, L64(0x2E25BC95B0A29D4F) /* 485 */, + L64(0x86D6A58BDEF1388C) /* 486 */, L64(0xDED74AC576B6F054) /* 487 */, + L64(0x8030BDBC2B45805D) /* 488 */, L64(0x3C81AF70E94D9289) /* 489 */, + L64(0x3EFF6DDA9E3100DB) /* 490 */, L64(0xB38DC39FDFCC8847) /* 491 */, + L64(0x123885528D17B87E) /* 492 */, L64(0xF2DA0ED240B1B642) /* 493 */, + L64(0x44CEFADCD54BF9A9) /* 494 */, L64(0x1312200E433C7EE6) /* 495 */, + L64(0x9FFCC84F3A78C748) /* 496 */, L64(0xF0CD1F72248576BB) /* 497 */, + L64(0xEC6974053638CFE4) /* 498 */, L64(0x2BA7B67C0CEC4E4C) /* 499 */, + L64(0xAC2F4DF3E5CE32ED) /* 500 */, L64(0xCB33D14326EA4C11) /* 501 */, + L64(0xA4E9044CC77E58BC) /* 502 */, L64(0x5F513293D934FCEF) /* 503 */, + L64(0x5DC9645506E55444) /* 504 */, L64(0x50DE418F317DE40A) /* 505 */, + L64(0x388CB31A69DDE259) /* 506 */, L64(0x2DB4A83455820A86) /* 507 */, + L64(0x9010A91E84711AE9) /* 508 */, L64(0x4DF7F0B7B1498371) /* 509 */, + L64(0xD62A2EABC0977179) /* 510 */, L64(0x22FAC097AA8D5C0E) /* 511 */, + L64(0xF49FCC2FF1DAF39B) /* 512 */, L64(0x487FD5C66FF29281) /* 513 */, + L64(0xE8A30667FCDCA83F) /* 514 */, L64(0x2C9B4BE3D2FCCE63) /* 515 */, + L64(0xDA3FF74B93FBBBC2) /* 516 */, L64(0x2FA165D2FE70BA66) /* 517 */, + L64(0xA103E279970E93D4) /* 518 */, L64(0xBECDEC77B0E45E71) /* 519 */, + L64(0xCFB41E723985E497) /* 520 */, L64(0xB70AAA025EF75017) /* 521 */, + L64(0xD42309F03840B8E0) /* 522 */, L64(0x8EFC1AD035898579) /* 523 */, + L64(0x96C6920BE2B2ABC5) /* 524 */, L64(0x66AF4163375A9172) /* 525 */, + L64(0x2174ABDCCA7127FB) /* 526 */, L64(0xB33CCEA64A72FF41) /* 527 */, + L64(0xF04A4933083066A5) /* 528 */, L64(0x8D970ACDD7289AF5) /* 529 */, + L64(0x8F96E8E031C8C25E) /* 530 */, L64(0xF3FEC02276875D47) /* 531 */, + L64(0xEC7BF310056190DD) /* 532 */, L64(0xF5ADB0AEBB0F1491) /* 533 */, + L64(0x9B50F8850FD58892) /* 534 */, L64(0x4975488358B74DE8) /* 535 */, + L64(0xA3354FF691531C61) /* 536 */, L64(0x0702BBE481D2C6EE) /* 537 */, + L64(0x89FB24057DEDED98) /* 538 */, L64(0xAC3075138596E902) /* 539 */, + L64(0x1D2D3580172772ED) /* 540 */, L64(0xEB738FC28E6BC30D) /* 541 */, + L64(0x5854EF8F63044326) /* 542 */, L64(0x9E5C52325ADD3BBE) /* 543 */, + L64(0x90AA53CF325C4623) /* 544 */, L64(0xC1D24D51349DD067) /* 545 */, + L64(0x2051CFEEA69EA624) /* 546 */, L64(0x13220F0A862E7E4F) /* 547 */, + L64(0xCE39399404E04864) /* 548 */, L64(0xD9C42CA47086FCB7) /* 549 */, + L64(0x685AD2238A03E7CC) /* 550 */, L64(0x066484B2AB2FF1DB) /* 551 */, + L64(0xFE9D5D70EFBF79EC) /* 552 */, L64(0x5B13B9DD9C481854) /* 553 */, + L64(0x15F0D475ED1509AD) /* 554 */, L64(0x0BEBCD060EC79851) /* 555 */, + L64(0xD58C6791183AB7F8) /* 556 */, L64(0xD1187C5052F3EEE4) /* 557 */, + L64(0xC95D1192E54E82FF) /* 558 */, L64(0x86EEA14CB9AC6CA2) /* 559 */, + L64(0x3485BEB153677D5D) /* 560 */, L64(0xDD191D781F8C492A) /* 561 */, + L64(0xF60866BAA784EBF9) /* 562 */, L64(0x518F643BA2D08C74) /* 563 */, + L64(0x8852E956E1087C22) /* 564 */, L64(0xA768CB8DC410AE8D) /* 565 */, + L64(0x38047726BFEC8E1A) /* 566 */, L64(0xA67738B4CD3B45AA) /* 567 */, + L64(0xAD16691CEC0DDE19) /* 568 */, L64(0xC6D4319380462E07) /* 569 */, + L64(0xC5A5876D0BA61938) /* 570 */, L64(0x16B9FA1FA58FD840) /* 571 */, + L64(0x188AB1173CA74F18) /* 572 */, L64(0xABDA2F98C99C021F) /* 573 */, + L64(0x3E0580AB134AE816) /* 574 */, L64(0x5F3B05B773645ABB) /* 575 */, + L64(0x2501A2BE5575F2F6) /* 576 */, L64(0x1B2F74004E7E8BA9) /* 577 */, + L64(0x1CD7580371E8D953) /* 578 */, L64(0x7F6ED89562764E30) /* 579 */, + L64(0xB15926FF596F003D) /* 580 */, L64(0x9F65293DA8C5D6B9) /* 581 */, + L64(0x6ECEF04DD690F84C) /* 582 */, L64(0x4782275FFF33AF88) /* 583 */, + L64(0xE41433083F820801) /* 584 */, L64(0xFD0DFE409A1AF9B5) /* 585 */, + L64(0x4325A3342CDB396B) /* 586 */, L64(0x8AE77E62B301B252) /* 587 */, + L64(0xC36F9E9F6655615A) /* 588 */, L64(0x85455A2D92D32C09) /* 589 */, + L64(0xF2C7DEA949477485) /* 590 */, L64(0x63CFB4C133A39EBA) /* 591 */, + L64(0x83B040CC6EBC5462) /* 592 */, L64(0x3B9454C8FDB326B0) /* 593 */, + L64(0x56F56A9E87FFD78C) /* 594 */, L64(0x2DC2940D99F42BC6) /* 595 */, + L64(0x98F7DF096B096E2D) /* 596 */, L64(0x19A6E01E3AD852BF) /* 597 */, + L64(0x42A99CCBDBD4B40B) /* 598 */, L64(0xA59998AF45E9C559) /* 599 */, + L64(0x366295E807D93186) /* 600 */, L64(0x6B48181BFAA1F773) /* 601 */, + L64(0x1FEC57E2157A0A1D) /* 602 */, L64(0x4667446AF6201AD5) /* 603 */, + L64(0xE615EBCACFB0F075) /* 604 */, L64(0xB8F31F4F68290778) /* 605 */, + L64(0x22713ED6CE22D11E) /* 606 */, L64(0x3057C1A72EC3C93B) /* 607 */, + L64(0xCB46ACC37C3F1F2F) /* 608 */, L64(0xDBB893FD02AAF50E) /* 609 */, + L64(0x331FD92E600B9FCF) /* 610 */, L64(0xA498F96148EA3AD6) /* 611 */, + L64(0xA8D8426E8B6A83EA) /* 612 */, L64(0xA089B274B7735CDC) /* 613 */, + L64(0x87F6B3731E524A11) /* 614 */, L64(0x118808E5CBC96749) /* 615 */, + L64(0x9906E4C7B19BD394) /* 616 */, L64(0xAFED7F7E9B24A20C) /* 617 */, + L64(0x6509EADEEB3644A7) /* 618 */, L64(0x6C1EF1D3E8EF0EDE) /* 619 */, + L64(0xB9C97D43E9798FB4) /* 620 */, L64(0xA2F2D784740C28A3) /* 621 */, + L64(0x7B8496476197566F) /* 622 */, L64(0x7A5BE3E6B65F069D) /* 623 */, + L64(0xF96330ED78BE6F10) /* 624 */, L64(0xEEE60DE77A076A15) /* 625 */, + L64(0x2B4BEE4AA08B9BD0) /* 626 */, L64(0x6A56A63EC7B8894E) /* 627 */, + L64(0x02121359BA34FEF4) /* 628 */, L64(0x4CBF99F8283703FC) /* 629 */, + L64(0x398071350CAF30C8) /* 630 */, L64(0xD0A77A89F017687A) /* 631 */, + L64(0xF1C1A9EB9E423569) /* 632 */, L64(0x8C7976282DEE8199) /* 633 */, + L64(0x5D1737A5DD1F7ABD) /* 634 */, L64(0x4F53433C09A9FA80) /* 635 */, + L64(0xFA8B0C53DF7CA1D9) /* 636 */, L64(0x3FD9DCBC886CCB77) /* 637 */, + L64(0xC040917CA91B4720) /* 638 */, L64(0x7DD00142F9D1DCDF) /* 639 */, + L64(0x8476FC1D4F387B58) /* 640 */, L64(0x23F8E7C5F3316503) /* 641 */, + L64(0x032A2244E7E37339) /* 642 */, L64(0x5C87A5D750F5A74B) /* 643 */, + L64(0x082B4CC43698992E) /* 644 */, L64(0xDF917BECB858F63C) /* 645 */, + L64(0x3270B8FC5BF86DDA) /* 646 */, L64(0x10AE72BB29B5DD76) /* 647 */, + L64(0x576AC94E7700362B) /* 648 */, L64(0x1AD112DAC61EFB8F) /* 649 */, + L64(0x691BC30EC5FAA427) /* 650 */, L64(0xFF246311CC327143) /* 651 */, + L64(0x3142368E30E53206) /* 652 */, L64(0x71380E31E02CA396) /* 653 */, + L64(0x958D5C960AAD76F1) /* 654 */, L64(0xF8D6F430C16DA536) /* 655 */, + L64(0xC8FFD13F1BE7E1D2) /* 656 */, L64(0x7578AE66004DDBE1) /* 657 */, + L64(0x05833F01067BE646) /* 658 */, L64(0xBB34B5AD3BFE586D) /* 659 */, + L64(0x095F34C9A12B97F0) /* 660 */, L64(0x247AB64525D60CA8) /* 661 */, + L64(0xDCDBC6F3017477D1) /* 662 */, L64(0x4A2E14D4DECAD24D) /* 663 */, + L64(0xBDB5E6D9BE0A1EEB) /* 664 */, L64(0x2A7E70F7794301AB) /* 665 */, + L64(0xDEF42D8A270540FD) /* 666 */, L64(0x01078EC0A34C22C1) /* 667 */, + L64(0xE5DE511AF4C16387) /* 668 */, L64(0x7EBB3A52BD9A330A) /* 669 */, + L64(0x77697857AA7D6435) /* 670 */, L64(0x004E831603AE4C32) /* 671 */, + L64(0xE7A21020AD78E312) /* 672 */, L64(0x9D41A70C6AB420F2) /* 673 */, + L64(0x28E06C18EA1141E6) /* 674 */, L64(0xD2B28CBD984F6B28) /* 675 */, + L64(0x26B75F6C446E9D83) /* 676 */, L64(0xBA47568C4D418D7F) /* 677 */, + L64(0xD80BADBFE6183D8E) /* 678 */, L64(0x0E206D7F5F166044) /* 679 */, + L64(0xE258A43911CBCA3E) /* 680 */, L64(0x723A1746B21DC0BC) /* 681 */, + L64(0xC7CAA854F5D7CDD3) /* 682 */, L64(0x7CAC32883D261D9C) /* 683 */, + L64(0x7690C26423BA942C) /* 684 */, L64(0x17E55524478042B8) /* 685 */, + L64(0xE0BE477656A2389F) /* 686 */, L64(0x4D289B5E67AB2DA0) /* 687 */, + L64(0x44862B9C8FBBFD31) /* 688 */, L64(0xB47CC8049D141365) /* 689 */, + L64(0x822C1B362B91C793) /* 690 */, L64(0x4EB14655FB13DFD8) /* 691 */, + L64(0x1ECBBA0714E2A97B) /* 692 */, L64(0x6143459D5CDE5F14) /* 693 */, + L64(0x53A8FBF1D5F0AC89) /* 694 */, L64(0x97EA04D81C5E5B00) /* 695 */, + L64(0x622181A8D4FDB3F3) /* 696 */, L64(0xE9BCD341572A1208) /* 697 */, + L64(0x1411258643CCE58A) /* 698 */, L64(0x9144C5FEA4C6E0A4) /* 699 */, + L64(0x0D33D06565CF620F) /* 700 */, L64(0x54A48D489F219CA1) /* 701 */, + L64(0xC43E5EAC6D63C821) /* 702 */, L64(0xA9728B3A72770DAF) /* 703 */, + L64(0xD7934E7B20DF87EF) /* 704 */, L64(0xE35503B61A3E86E5) /* 705 */, + L64(0xCAE321FBC819D504) /* 706 */, L64(0x129A50B3AC60BFA6) /* 707 */, + L64(0xCD5E68EA7E9FB6C3) /* 708 */, L64(0xB01C90199483B1C7) /* 709 */, + L64(0x3DE93CD5C295376C) /* 710 */, L64(0xAED52EDF2AB9AD13) /* 711 */, + L64(0x2E60F512C0A07884) /* 712 */, L64(0xBC3D86A3E36210C9) /* 713 */, + L64(0x35269D9B163951CE) /* 714 */, L64(0x0C7D6E2AD0CDB5FA) /* 715 */, + L64(0x59E86297D87F5733) /* 716 */, L64(0x298EF221898DB0E7) /* 717 */, + L64(0x55000029D1A5AA7E) /* 718 */, L64(0x8BC08AE1B5061B45) /* 719 */, + L64(0xC2C31C2B6C92703A) /* 720 */, L64(0x94CC596BAF25EF42) /* 721 */, + L64(0x0A1D73DB22540456) /* 722 */, L64(0x04B6A0F9D9C4179A) /* 723 */, + L64(0xEFFDAFA2AE3D3C60) /* 724 */, L64(0xF7C8075BB49496C4) /* 725 */, + L64(0x9CC5C7141D1CD4E3) /* 726 */, L64(0x78BD1638218E5534) /* 727 */, + L64(0xB2F11568F850246A) /* 728 */, L64(0xEDFABCFA9502BC29) /* 729 */, + L64(0x796CE5F2DA23051B) /* 730 */, L64(0xAAE128B0DC93537C) /* 731 */, + L64(0x3A493DA0EE4B29AE) /* 732 */, L64(0xB5DF6B2C416895D7) /* 733 */, + L64(0xFCABBD25122D7F37) /* 734 */, L64(0x70810B58105DC4B1) /* 735 */, + L64(0xE10FDD37F7882A90) /* 736 */, L64(0x524DCAB5518A3F5C) /* 737 */, + L64(0x3C9E85878451255B) /* 738 */, L64(0x4029828119BD34E2) /* 739 */, + L64(0x74A05B6F5D3CECCB) /* 740 */, L64(0xB610021542E13ECA) /* 741 */, + L64(0x0FF979D12F59E2AC) /* 742 */, L64(0x6037DA27E4F9CC50) /* 743 */, + L64(0x5E92975A0DF1847D) /* 744 */, L64(0xD66DE190D3E623FE) /* 745 */, + L64(0x5032D6B87B568048) /* 746 */, L64(0x9A36B7CE8235216E) /* 747 */, + L64(0x80272A7A24F64B4A) /* 748 */, L64(0x93EFED8B8C6916F7) /* 749 */, + L64(0x37DDBFF44CCE1555) /* 750 */, L64(0x4B95DB5D4B99BD25) /* 751 */, + L64(0x92D3FDA169812FC0) /* 752 */, L64(0xFB1A4A9A90660BB6) /* 753 */, + L64(0x730C196946A4B9B2) /* 754 */, L64(0x81E289AA7F49DA68) /* 755 */, + L64(0x64669A0F83B1A05F) /* 756 */, L64(0x27B3FF7D9644F48B) /* 757 */, + L64(0xCC6B615C8DB675B3) /* 758 */, L64(0x674F20B9BCEBBE95) /* 759 */, + L64(0x6F31238275655982) /* 760 */, L64(0x5AE488713E45CF05) /* 761 */, + L64(0xBF619F9954C21157) /* 762 */, L64(0xEABAC46040A8EAE9) /* 763 */, + L64(0x454C6FE9F2C0C1CD) /* 764 */, L64(0x419CF6496412691C) /* 765 */, + L64(0xD3DC3BEF265B0F70) /* 766 */, L64(0x6D0E60F5C3578A9E) /* 767 */, + L64(0x5B0E608526323C55) /* 768 */, L64(0x1A46C1A9FA1B59F5) /* 769 */, + L64(0xA9E245A17C4C8FFA) /* 770 */, L64(0x65CA5159DB2955D7) /* 771 */, + L64(0x05DB0A76CE35AFC2) /* 772 */, L64(0x81EAC77EA9113D45) /* 773 */, + L64(0x528EF88AB6AC0A0D) /* 774 */, L64(0xA09EA253597BE3FF) /* 775 */, + L64(0x430DDFB3AC48CD56) /* 776 */, L64(0xC4B3A67AF45CE46F) /* 777 */, + L64(0x4ECECFD8FBE2D05E) /* 778 */, L64(0x3EF56F10B39935F0) /* 779 */, + L64(0x0B22D6829CD619C6) /* 780 */, L64(0x17FD460A74DF2069) /* 781 */, + L64(0x6CF8CC8E8510ED40) /* 782 */, L64(0xD6C824BF3A6ECAA7) /* 783 */, + L64(0x61243D581A817049) /* 784 */, L64(0x048BACB6BBC163A2) /* 785 */, + L64(0xD9A38AC27D44CC32) /* 786 */, L64(0x7FDDFF5BAAF410AB) /* 787 */, + L64(0xAD6D495AA804824B) /* 788 */, L64(0xE1A6A74F2D8C9F94) /* 789 */, + L64(0xD4F7851235DEE8E3) /* 790 */, L64(0xFD4B7F886540D893) /* 791 */, + L64(0x247C20042AA4BFDA) /* 792 */, L64(0x096EA1C517D1327C) /* 793 */, + L64(0xD56966B4361A6685) /* 794 */, L64(0x277DA5C31221057D) /* 795 */, + L64(0x94D59893A43ACFF7) /* 796 */, L64(0x64F0C51CCDC02281) /* 797 */, + L64(0x3D33BCC4FF6189DB) /* 798 */, L64(0xE005CB184CE66AF1) /* 799 */, + L64(0xFF5CCD1D1DB99BEA) /* 800 */, L64(0xB0B854A7FE42980F) /* 801 */, + L64(0x7BD46A6A718D4B9F) /* 802 */, L64(0xD10FA8CC22A5FD8C) /* 803 */, + L64(0xD31484952BE4BD31) /* 804 */, L64(0xC7FA975FCB243847) /* 805 */, + L64(0x4886ED1E5846C407) /* 806 */, L64(0x28CDDB791EB70B04) /* 807 */, + L64(0xC2B00BE2F573417F) /* 808 */, L64(0x5C9590452180F877) /* 809 */, + L64(0x7A6BDDFFF370EB00) /* 810 */, L64(0xCE509E38D6D9D6A4) /* 811 */, + L64(0xEBEB0F00647FA702) /* 812 */, L64(0x1DCC06CF76606F06) /* 813 */, + L64(0xE4D9F28BA286FF0A) /* 814 */, L64(0xD85A305DC918C262) /* 815 */, + L64(0x475B1D8732225F54) /* 816 */, L64(0x2D4FB51668CCB5FE) /* 817 */, + L64(0xA679B9D9D72BBA20) /* 818 */, L64(0x53841C0D912D43A5) /* 819 */, + L64(0x3B7EAA48BF12A4E8) /* 820 */, L64(0x781E0E47F22F1DDF) /* 821 */, + L64(0xEFF20CE60AB50973) /* 822 */, L64(0x20D261D19DFFB742) /* 823 */, + L64(0x16A12B03062A2E39) /* 824 */, L64(0x1960EB2239650495) /* 825 */, + L64(0x251C16FED50EB8B8) /* 826 */, L64(0x9AC0C330F826016E) /* 827 */, + L64(0xED152665953E7671) /* 828 */, L64(0x02D63194A6369570) /* 829 */, + L64(0x5074F08394B1C987) /* 830 */, L64(0x70BA598C90B25CE1) /* 831 */, + L64(0x794A15810B9742F6) /* 832 */, L64(0x0D5925E9FCAF8C6C) /* 833 */, + L64(0x3067716CD868744E) /* 834 */, L64(0x910AB077E8D7731B) /* 835 */, + L64(0x6A61BBDB5AC42F61) /* 836 */, L64(0x93513EFBF0851567) /* 837 */, + L64(0xF494724B9E83E9D5) /* 838 */, L64(0xE887E1985C09648D) /* 839 */, + L64(0x34B1D3C675370CFD) /* 840 */, L64(0xDC35E433BC0D255D) /* 841 */, + L64(0xD0AAB84234131BE0) /* 842 */, L64(0x08042A50B48B7EAF) /* 843 */, + L64(0x9997C4EE44A3AB35) /* 844 */, L64(0x829A7B49201799D0) /* 845 */, + L64(0x263B8307B7C54441) /* 846 */, L64(0x752F95F4FD6A6CA6) /* 847 */, + L64(0x927217402C08C6E5) /* 848 */, L64(0x2A8AB754A795D9EE) /* 849 */, + L64(0xA442F7552F72943D) /* 850 */, L64(0x2C31334E19781208) /* 851 */, + L64(0x4FA98D7CEAEE6291) /* 852 */, L64(0x55C3862F665DB309) /* 853 */, + L64(0xBD0610175D53B1F3) /* 854 */, L64(0x46FE6CB840413F27) /* 855 */, + L64(0x3FE03792DF0CFA59) /* 856 */, L64(0xCFE700372EB85E8F) /* 857 */, + L64(0xA7BE29E7ADBCE118) /* 858 */, L64(0xE544EE5CDE8431DD) /* 859 */, + L64(0x8A781B1B41F1873E) /* 860 */, L64(0xA5C94C78A0D2F0E7) /* 861 */, + L64(0x39412E2877B60728) /* 862 */, L64(0xA1265EF3AFC9A62C) /* 863 */, + L64(0xBCC2770C6A2506C5) /* 864 */, L64(0x3AB66DD5DCE1CE12) /* 865 */, + L64(0xE65499D04A675B37) /* 866 */, L64(0x7D8F523481BFD216) /* 867 */, + L64(0x0F6F64FCEC15F389) /* 868 */, L64(0x74EFBE618B5B13C8) /* 869 */, + L64(0xACDC82B714273E1D) /* 870 */, L64(0xDD40BFE003199D17) /* 871 */, + L64(0x37E99257E7E061F8) /* 872 */, L64(0xFA52626904775AAA) /* 873 */, + L64(0x8BBBF63A463D56F9) /* 874 */, L64(0xF0013F1543A26E64) /* 875 */, + L64(0xA8307E9F879EC898) /* 876 */, L64(0xCC4C27A4150177CC) /* 877 */, + L64(0x1B432F2CCA1D3348) /* 878 */, L64(0xDE1D1F8F9F6FA013) /* 879 */, + L64(0x606602A047A7DDD6) /* 880 */, L64(0xD237AB64CC1CB2C7) /* 881 */, + L64(0x9B938E7225FCD1D3) /* 882 */, L64(0xEC4E03708E0FF476) /* 883 */, + L64(0xFEB2FBDA3D03C12D) /* 884 */, L64(0xAE0BCED2EE43889A) /* 885 */, + L64(0x22CB8923EBFB4F43) /* 886 */, L64(0x69360D013CF7396D) /* 887 */, + L64(0x855E3602D2D4E022) /* 888 */, L64(0x073805BAD01F784C) /* 889 */, + L64(0x33E17A133852F546) /* 890 */, L64(0xDF4874058AC7B638) /* 891 */, + L64(0xBA92B29C678AA14A) /* 892 */, L64(0x0CE89FC76CFAADCD) /* 893 */, + L64(0x5F9D4E0908339E34) /* 894 */, L64(0xF1AFE9291F5923B9) /* 895 */, + L64(0x6E3480F60F4A265F) /* 896 */, L64(0xEEBF3A2AB29B841C) /* 897 */, + L64(0xE21938A88F91B4AD) /* 898 */, L64(0x57DFEFF845C6D3C3) /* 899 */, + L64(0x2F006B0BF62CAAF2) /* 900 */, L64(0x62F479EF6F75EE78) /* 901 */, + L64(0x11A55AD41C8916A9) /* 902 */, L64(0xF229D29084FED453) /* 903 */, + L64(0x42F1C27B16B000E6) /* 904 */, L64(0x2B1F76749823C074) /* 905 */, + L64(0x4B76ECA3C2745360) /* 906 */, L64(0x8C98F463B91691BD) /* 907 */, + L64(0x14BCC93CF1ADE66A) /* 908 */, L64(0x8885213E6D458397) /* 909 */, + L64(0x8E177DF0274D4711) /* 910 */, L64(0xB49B73B5503F2951) /* 911 */, + L64(0x10168168C3F96B6B) /* 912 */, L64(0x0E3D963B63CAB0AE) /* 913 */, + L64(0x8DFC4B5655A1DB14) /* 914 */, L64(0xF789F1356E14DE5C) /* 915 */, + L64(0x683E68AF4E51DAC1) /* 916 */, L64(0xC9A84F9D8D4B0FD9) /* 917 */, + L64(0x3691E03F52A0F9D1) /* 918 */, L64(0x5ED86E46E1878E80) /* 919 */, + L64(0x3C711A0E99D07150) /* 920 */, L64(0x5A0865B20C4E9310) /* 921 */, + L64(0x56FBFC1FE4F0682E) /* 922 */, L64(0xEA8D5DE3105EDF9B) /* 923 */, + L64(0x71ABFDB12379187A) /* 924 */, L64(0x2EB99DE1BEE77B9C) /* 925 */, + L64(0x21ECC0EA33CF4523) /* 926 */, L64(0x59A4D7521805C7A1) /* 927 */, + L64(0x3896F5EB56AE7C72) /* 928 */, L64(0xAA638F3DB18F75DC) /* 929 */, + L64(0x9F39358DABE9808E) /* 930 */, L64(0xB7DEFA91C00B72AC) /* 931 */, + L64(0x6B5541FD62492D92) /* 932 */, L64(0x6DC6DEE8F92E4D5B) /* 933 */, + L64(0x353F57ABC4BEEA7E) /* 934 */, L64(0x735769D6DA5690CE) /* 935 */, + L64(0x0A234AA642391484) /* 936 */, L64(0xF6F9508028F80D9D) /* 937 */, + L64(0xB8E319A27AB3F215) /* 938 */, L64(0x31AD9C1151341A4D) /* 939 */, + L64(0x773C22A57BEF5805) /* 940 */, L64(0x45C7561A07968633) /* 941 */, + L64(0xF913DA9E249DBE36) /* 942 */, L64(0xDA652D9B78A64C68) /* 943 */, + L64(0x4C27A97F3BC334EF) /* 944 */, L64(0x76621220E66B17F4) /* 945 */, + L64(0x967743899ACD7D0B) /* 946 */, L64(0xF3EE5BCAE0ED6782) /* 947 */, + L64(0x409F753600C879FC) /* 948 */, L64(0x06D09A39B5926DB6) /* 949 */, + L64(0x6F83AEB0317AC588) /* 950 */, L64(0x01E6CA4A86381F21) /* 951 */, + L64(0x66FF3462D19F3025) /* 952 */, L64(0x72207C24DDFD3BFB) /* 953 */, + L64(0x4AF6B6D3E2ECE2EB) /* 954 */, L64(0x9C994DBEC7EA08DE) /* 955 */, + L64(0x49ACE597B09A8BC4) /* 956 */, L64(0xB38C4766CF0797BA) /* 957 */, + L64(0x131B9373C57C2A75) /* 958 */, L64(0xB1822CCE61931E58) /* 959 */, + L64(0x9D7555B909BA1C0C) /* 960 */, L64(0x127FAFDD937D11D2) /* 961 */, + L64(0x29DA3BADC66D92E4) /* 962 */, L64(0xA2C1D57154C2ECBC) /* 963 */, + L64(0x58C5134D82F6FE24) /* 964 */, L64(0x1C3AE3515B62274F) /* 965 */, + L64(0xE907C82E01CB8126) /* 966 */, L64(0xF8ED091913E37FCB) /* 967 */, + L64(0x3249D8F9C80046C9) /* 968 */, L64(0x80CF9BEDE388FB63) /* 969 */, + L64(0x1881539A116CF19E) /* 970 */, L64(0x5103F3F76BD52457) /* 971 */, + L64(0x15B7E6F5AE47F7A8) /* 972 */, L64(0xDBD7C6DED47E9CCF) /* 973 */, + L64(0x44E55C410228BB1A) /* 974 */, L64(0xB647D4255EDB4E99) /* 975 */, + L64(0x5D11882BB8AAFC30) /* 976 */, L64(0xF5098BBB29D3212A) /* 977 */, + L64(0x8FB5EA14E90296B3) /* 978 */, L64(0x677B942157DD025A) /* 979 */, + L64(0xFB58E7C0A390ACB5) /* 980 */, L64(0x89D3674C83BD4A01) /* 981 */, + L64(0x9E2DA4DF4BF3B93B) /* 982 */, L64(0xFCC41E328CAB4829) /* 983 */, + L64(0x03F38C96BA582C52) /* 984 */, L64(0xCAD1BDBD7FD85DB2) /* 985 */, + L64(0xBBB442C16082AE83) /* 986 */, L64(0xB95FE86BA5DA9AB0) /* 987 */, + L64(0xB22E04673771A93F) /* 988 */, L64(0x845358C9493152D8) /* 989 */, + L64(0xBE2A488697B4541E) /* 990 */, L64(0x95A2DC2DD38E6966) /* 991 */, + L64(0xC02C11AC923C852B) /* 992 */, L64(0x2388B1990DF2A87B) /* 993 */, + L64(0x7C8008FA1B4F37BE) /* 994 */, L64(0x1F70D0C84D54E503) /* 995 */, + L64(0x5490ADEC7ECE57D4) /* 996 */, L64(0x002B3C27D9063A3A) /* 997 */, + L64(0x7EAEA3848030A2BF) /* 998 */, L64(0xC602326DED2003C0) /* 999 */, + L64(0x83A7287D69A94086) /* 1000 */, L64(0xC57A5FCB30F57A8A) /* 1001 */, + L64(0xB56844E479EBE779) /* 1002 */, L64(0xA373B40F05DCBCE9) /* 1003 */, + L64(0xD71A786E88570EE2) /* 1004 */, L64(0x879CBACDBDE8F6A0) /* 1005 */, + L64(0x976AD1BCC164A32F) /* 1006 */, L64(0xAB21E25E9666D78B) /* 1007 */, + L64(0x901063AAE5E5C33C) /* 1008 */, L64(0x9818B34448698D90) /* 1009 */, + L64(0xE36487AE3E1E8ABB) /* 1010 */, L64(0xAFBDF931893BDCB4) /* 1011 */, + L64(0x6345A0DC5FBBD519) /* 1012 */, L64(0x8628FE269B9465CA) /* 1013 */, + L64(0x1E5D01603F9C51EC) /* 1014 */, L64(0x4DE44006A15049B7) /* 1015 */, + L64(0xBF6C70E5F776CBB1) /* 1016 */, L64(0x411218F2EF552BED) /* 1017 */, + L64(0xCB0C0708705A36A3) /* 1018 */, L64(0xE74D14754F986044) /* 1019 */, + L64(0xCD56D9430EA8280E) /* 1020 */, L64(0xC12591D7535F5065) /* 1021 */, + L64(0xC83223F1720AEF96) /* 1022 */, L64(0xC3A0396F7363A51F) /* 1023 */, +}; + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/src/cpp/ext/hash/php_hash_whirlpool_tables.h b/src/cpp/ext/hash/php_hash_whirlpool_tables.h new file mode 100644 index 0000000000000..1fb733d159d99 --- /dev/null +++ b/src/cpp/ext/hash/php_hash_whirlpool_tables.h @@ -0,0 +1,584 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +/* $Id: php_hash_whirlpool_tables.h,v 1.1.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */ + +#ifndef PHP_HASH_WHIRLPOOL_TABLES_H +#define PHP_HASH_WHIRLPOOL_TABLES_H + +#define R 10 + +static const unsigned long rc[R + 1] = { + L64(0x0000000000000000), + L64(0x1823c6e887b8014f), + L64(0x36a6d2f5796f9152), + L64(0x60bc9b8ea30c7b35), + L64(0x1de0d7c22e4bfe57), + L64(0x157737e59ff04ada), + L64(0x58c9290ab1a06b85), + L64(0xbd5d10f4cb3e0567), + L64(0xe427418ba77d95d8), + L64(0xfbee7c66dd17479e), + L64(0xca2dbf07ad5a8333), +}; + +static const unsigned long C0[256] = { + L64(0x18186018c07830d8), L64(0x23238c2305af4626), L64(0xc6c63fc67ef991b8), L64(0xe8e887e8136fcdfb), + L64(0x878726874ca113cb), L64(0xb8b8dab8a9626d11), L64(0x0101040108050209), L64(0x4f4f214f426e9e0d), + L64(0x3636d836adee6c9b), L64(0xa6a6a2a6590451ff), L64(0xd2d26fd2debdb90c), L64(0xf5f5f3f5fb06f70e), + L64(0x7979f979ef80f296), L64(0x6f6fa16f5fcede30), L64(0x91917e91fcef3f6d), L64(0x52525552aa07a4f8), + L64(0x60609d6027fdc047), L64(0xbcbccabc89766535), L64(0x9b9b569baccd2b37), L64(0x8e8e028e048c018a), + L64(0xa3a3b6a371155bd2), L64(0x0c0c300c603c186c), L64(0x7b7bf17bff8af684), L64(0x3535d435b5e16a80), + L64(0x1d1d741de8693af5), L64(0xe0e0a7e05347ddb3), L64(0xd7d77bd7f6acb321), L64(0xc2c22fc25eed999c), + L64(0x2e2eb82e6d965c43), L64(0x4b4b314b627a9629), L64(0xfefedffea321e15d), L64(0x575741578216aed5), + L64(0x15155415a8412abd), L64(0x7777c1779fb6eee8), L64(0x3737dc37a5eb6e92), L64(0xe5e5b3e57b56d79e), + L64(0x9f9f469f8cd92313), L64(0xf0f0e7f0d317fd23), L64(0x4a4a354a6a7f9420), L64(0xdada4fda9e95a944), + L64(0x58587d58fa25b0a2), L64(0xc9c903c906ca8fcf), L64(0x2929a429558d527c), L64(0x0a0a280a5022145a), + L64(0xb1b1feb1e14f7f50), L64(0xa0a0baa0691a5dc9), L64(0x6b6bb16b7fdad614), L64(0x85852e855cab17d9), + L64(0xbdbdcebd8173673c), L64(0x5d5d695dd234ba8f), L64(0x1010401080502090), L64(0xf4f4f7f4f303f507), + L64(0xcbcb0bcb16c08bdd), L64(0x3e3ef83eedc67cd3), L64(0x0505140528110a2d), L64(0x676781671fe6ce78), + L64(0xe4e4b7e47353d597), L64(0x27279c2725bb4e02), L64(0x4141194132588273), L64(0x8b8b168b2c9d0ba7), + L64(0xa7a7a6a7510153f6), L64(0x7d7de97dcf94fab2), L64(0x95956e95dcfb3749), L64(0xd8d847d88e9fad56), + L64(0xfbfbcbfb8b30eb70), L64(0xeeee9fee2371c1cd), L64(0x7c7ced7cc791f8bb), L64(0x6666856617e3cc71), + L64(0xdddd53dda68ea77b), L64(0x17175c17b84b2eaf), L64(0x4747014702468e45), L64(0x9e9e429e84dc211a), + L64(0xcaca0fca1ec589d4), L64(0x2d2db42d75995a58), L64(0xbfbfc6bf9179632e), L64(0x07071c07381b0e3f), + L64(0xadad8ead012347ac), L64(0x5a5a755aea2fb4b0), L64(0x838336836cb51bef), L64(0x3333cc3385ff66b6), + L64(0x636391633ff2c65c), L64(0x02020802100a0412), L64(0xaaaa92aa39384993), L64(0x7171d971afa8e2de), + L64(0xc8c807c80ecf8dc6), L64(0x19196419c87d32d1), L64(0x494939497270923b), L64(0xd9d943d9869aaf5f), + L64(0xf2f2eff2c31df931), L64(0xe3e3abe34b48dba8), L64(0x5b5b715be22ab6b9), L64(0x88881a8834920dbc), + L64(0x9a9a529aa4c8293e), L64(0x262698262dbe4c0b), L64(0x3232c8328dfa64bf), L64(0xb0b0fab0e94a7d59), + L64(0xe9e983e91b6acff2), L64(0x0f0f3c0f78331e77), L64(0xd5d573d5e6a6b733), L64(0x80803a8074ba1df4), + L64(0xbebec2be997c6127), L64(0xcdcd13cd26de87eb), L64(0x3434d034bde46889), L64(0x48483d487a759032), + L64(0xffffdbffab24e354), L64(0x7a7af57af78ff48d), L64(0x90907a90f4ea3d64), L64(0x5f5f615fc23ebe9d), + L64(0x202080201da0403d), L64(0x6868bd6867d5d00f), L64(0x1a1a681ad07234ca), L64(0xaeae82ae192c41b7), + L64(0xb4b4eab4c95e757d), L64(0x54544d549a19a8ce), L64(0x93937693ece53b7f), L64(0x222288220daa442f), + L64(0x64648d6407e9c863), L64(0xf1f1e3f1db12ff2a), L64(0x7373d173bfa2e6cc), L64(0x12124812905a2482), + L64(0x40401d403a5d807a), L64(0x0808200840281048), L64(0xc3c32bc356e89b95), L64(0xecec97ec337bc5df), + L64(0xdbdb4bdb9690ab4d), L64(0xa1a1bea1611f5fc0), L64(0x8d8d0e8d1c830791), L64(0x3d3df43df5c97ac8), + L64(0x97976697ccf1335b), L64(0x0000000000000000), L64(0xcfcf1bcf36d483f9), L64(0x2b2bac2b4587566e), + L64(0x7676c57697b3ece1), L64(0x8282328264b019e6), L64(0xd6d67fd6fea9b128), L64(0x1b1b6c1bd87736c3), + L64(0xb5b5eeb5c15b7774), L64(0xafaf86af112943be), L64(0x6a6ab56a77dfd41d), L64(0x50505d50ba0da0ea), + L64(0x45450945124c8a57), L64(0xf3f3ebf3cb18fb38), L64(0x3030c0309df060ad), L64(0xefef9bef2b74c3c4), + L64(0x3f3ffc3fe5c37eda), L64(0x55554955921caac7), L64(0xa2a2b2a2791059db), L64(0xeaea8fea0365c9e9), + L64(0x656589650fecca6a), L64(0xbabad2bab9686903), L64(0x2f2fbc2f65935e4a), L64(0xc0c027c04ee79d8e), + L64(0xdede5fdebe81a160), L64(0x1c1c701ce06c38fc), L64(0xfdfdd3fdbb2ee746), L64(0x4d4d294d52649a1f), + L64(0x92927292e4e03976), L64(0x7575c9758fbceafa), L64(0x06061806301e0c36), L64(0x8a8a128a249809ae), + L64(0xb2b2f2b2f940794b), L64(0xe6e6bfe66359d185), L64(0x0e0e380e70361c7e), L64(0x1f1f7c1ff8633ee7), + L64(0x6262956237f7c455), L64(0xd4d477d4eea3b53a), L64(0xa8a89aa829324d81), L64(0x96966296c4f43152), + L64(0xf9f9c3f99b3aef62), L64(0xc5c533c566f697a3), L64(0x2525942535b14a10), L64(0x59597959f220b2ab), + L64(0x84842a8454ae15d0), L64(0x7272d572b7a7e4c5), L64(0x3939e439d5dd72ec), L64(0x4c4c2d4c5a619816), + L64(0x5e5e655eca3bbc94), L64(0x7878fd78e785f09f), L64(0x3838e038ddd870e5), L64(0x8c8c0a8c14860598), + L64(0xd1d163d1c6b2bf17), L64(0xa5a5aea5410b57e4), L64(0xe2e2afe2434dd9a1), L64(0x616199612ff8c24e), + L64(0xb3b3f6b3f1457b42), L64(0x2121842115a54234), L64(0x9c9c4a9c94d62508), L64(0x1e1e781ef0663cee), + L64(0x4343114322528661), L64(0xc7c73bc776fc93b1), L64(0xfcfcd7fcb32be54f), L64(0x0404100420140824), + L64(0x51515951b208a2e3), L64(0x99995e99bcc72f25), L64(0x6d6da96d4fc4da22), L64(0x0d0d340d68391a65), + L64(0xfafacffa8335e979), L64(0xdfdf5bdfb684a369), L64(0x7e7ee57ed79bfca9), L64(0x242490243db44819), + L64(0x3b3bec3bc5d776fe), L64(0xabab96ab313d4b9a), L64(0xcece1fce3ed181f0), L64(0x1111441188552299), + L64(0x8f8f068f0c890383), L64(0x4e4e254e4a6b9c04), L64(0xb7b7e6b7d1517366), L64(0xebeb8beb0b60cbe0), + L64(0x3c3cf03cfdcc78c1), L64(0x81813e817cbf1ffd), L64(0x94946a94d4fe3540), L64(0xf7f7fbf7eb0cf31c), + L64(0xb9b9deb9a1676f18), L64(0x13134c13985f268b), L64(0x2c2cb02c7d9c5851), L64(0xd3d36bd3d6b8bb05), + L64(0xe7e7bbe76b5cd38c), L64(0x6e6ea56e57cbdc39), L64(0xc4c437c46ef395aa), L64(0x03030c03180f061b), + L64(0x565645568a13acdc), L64(0x44440d441a49885e), L64(0x7f7fe17fdf9efea0), L64(0xa9a99ea921374f88), + L64(0x2a2aa82a4d825467), L64(0xbbbbd6bbb16d6b0a), L64(0xc1c123c146e29f87), L64(0x53535153a202a6f1), + L64(0xdcdc57dcae8ba572), L64(0x0b0b2c0b58271653), L64(0x9d9d4e9d9cd32701), L64(0x6c6cad6c47c1d82b), + L64(0x3131c43195f562a4), L64(0x7474cd7487b9e8f3), L64(0xf6f6fff6e309f115), L64(0x464605460a438c4c), + L64(0xacac8aac092645a5), L64(0x89891e893c970fb5), L64(0x14145014a04428b4), L64(0xe1e1a3e15b42dfba), + L64(0x16165816b04e2ca6), L64(0x3a3ae83acdd274f7), L64(0x6969b9696fd0d206), L64(0x09092409482d1241), + L64(0x7070dd70a7ade0d7), L64(0xb6b6e2b6d954716f), L64(0xd0d067d0ceb7bd1e), L64(0xeded93ed3b7ec7d6), + L64(0xcccc17cc2edb85e2), L64(0x424215422a578468), L64(0x98985a98b4c22d2c), L64(0xa4a4aaa4490e55ed), + L64(0x2828a0285d885075), L64(0x5c5c6d5cda31b886), L64(0xf8f8c7f8933fed6b), L64(0x8686228644a411c2), +}; + +static const unsigned long C1[256] = { + L64(0xd818186018c07830), L64(0x2623238c2305af46), L64(0xb8c6c63fc67ef991), L64(0xfbe8e887e8136fcd), + L64(0xcb878726874ca113), L64(0x11b8b8dab8a9626d), L64(0x0901010401080502), L64(0x0d4f4f214f426e9e), + L64(0x9b3636d836adee6c), L64(0xffa6a6a2a6590451), L64(0x0cd2d26fd2debdb9), L64(0x0ef5f5f3f5fb06f7), + L64(0x967979f979ef80f2), L64(0x306f6fa16f5fcede), L64(0x6d91917e91fcef3f), L64(0xf852525552aa07a4), + L64(0x4760609d6027fdc0), L64(0x35bcbccabc897665), L64(0x379b9b569baccd2b), L64(0x8a8e8e028e048c01), + L64(0xd2a3a3b6a371155b), L64(0x6c0c0c300c603c18), L64(0x847b7bf17bff8af6), L64(0x803535d435b5e16a), + L64(0xf51d1d741de8693a), L64(0xb3e0e0a7e05347dd), L64(0x21d7d77bd7f6acb3), L64(0x9cc2c22fc25eed99), + L64(0x432e2eb82e6d965c), L64(0x294b4b314b627a96), L64(0x5dfefedffea321e1), L64(0xd5575741578216ae), + L64(0xbd15155415a8412a), L64(0xe87777c1779fb6ee), L64(0x923737dc37a5eb6e), L64(0x9ee5e5b3e57b56d7), + L64(0x139f9f469f8cd923), L64(0x23f0f0e7f0d317fd), L64(0x204a4a354a6a7f94), L64(0x44dada4fda9e95a9), + L64(0xa258587d58fa25b0), L64(0xcfc9c903c906ca8f), L64(0x7c2929a429558d52), L64(0x5a0a0a280a502214), + L64(0x50b1b1feb1e14f7f), L64(0xc9a0a0baa0691a5d), L64(0x146b6bb16b7fdad6), L64(0xd985852e855cab17), + L64(0x3cbdbdcebd817367), L64(0x8f5d5d695dd234ba), L64(0x9010104010805020), L64(0x07f4f4f7f4f303f5), + L64(0xddcbcb0bcb16c08b), L64(0xd33e3ef83eedc67c), L64(0x2d0505140528110a), L64(0x78676781671fe6ce), + L64(0x97e4e4b7e47353d5), L64(0x0227279c2725bb4e), L64(0x7341411941325882), L64(0xa78b8b168b2c9d0b), + L64(0xf6a7a7a6a7510153), L64(0xb27d7de97dcf94fa), L64(0x4995956e95dcfb37), L64(0x56d8d847d88e9fad), + L64(0x70fbfbcbfb8b30eb), L64(0xcdeeee9fee2371c1), L64(0xbb7c7ced7cc791f8), L64(0x716666856617e3cc), + L64(0x7bdddd53dda68ea7), L64(0xaf17175c17b84b2e), L64(0x454747014702468e), L64(0x1a9e9e429e84dc21), + L64(0xd4caca0fca1ec589), L64(0x582d2db42d75995a), L64(0x2ebfbfc6bf917963), L64(0x3f07071c07381b0e), + L64(0xacadad8ead012347), L64(0xb05a5a755aea2fb4), L64(0xef838336836cb51b), L64(0xb63333cc3385ff66), + L64(0x5c636391633ff2c6), L64(0x1202020802100a04), L64(0x93aaaa92aa393849), L64(0xde7171d971afa8e2), + L64(0xc6c8c807c80ecf8d), L64(0xd119196419c87d32), L64(0x3b49493949727092), L64(0x5fd9d943d9869aaf), + L64(0x31f2f2eff2c31df9), L64(0xa8e3e3abe34b48db), L64(0xb95b5b715be22ab6), L64(0xbc88881a8834920d), + L64(0x3e9a9a529aa4c829), L64(0x0b262698262dbe4c), L64(0xbf3232c8328dfa64), L64(0x59b0b0fab0e94a7d), + L64(0xf2e9e983e91b6acf), L64(0x770f0f3c0f78331e), L64(0x33d5d573d5e6a6b7), L64(0xf480803a8074ba1d), + L64(0x27bebec2be997c61), L64(0xebcdcd13cd26de87), L64(0x893434d034bde468), L64(0x3248483d487a7590), + L64(0x54ffffdbffab24e3), L64(0x8d7a7af57af78ff4), L64(0x6490907a90f4ea3d), L64(0x9d5f5f615fc23ebe), + L64(0x3d202080201da040), L64(0x0f6868bd6867d5d0), L64(0xca1a1a681ad07234), L64(0xb7aeae82ae192c41), + L64(0x7db4b4eab4c95e75), L64(0xce54544d549a19a8), L64(0x7f93937693ece53b), L64(0x2f222288220daa44), + L64(0x6364648d6407e9c8), L64(0x2af1f1e3f1db12ff), L64(0xcc7373d173bfa2e6), L64(0x8212124812905a24), + L64(0x7a40401d403a5d80), L64(0x4808082008402810), L64(0x95c3c32bc356e89b), L64(0xdfecec97ec337bc5), + L64(0x4ddbdb4bdb9690ab), L64(0xc0a1a1bea1611f5f), L64(0x918d8d0e8d1c8307), L64(0xc83d3df43df5c97a), + L64(0x5b97976697ccf133), L64(0x0000000000000000), L64(0xf9cfcf1bcf36d483), L64(0x6e2b2bac2b458756), + L64(0xe17676c57697b3ec), L64(0xe68282328264b019), L64(0x28d6d67fd6fea9b1), L64(0xc31b1b6c1bd87736), + L64(0x74b5b5eeb5c15b77), L64(0xbeafaf86af112943), L64(0x1d6a6ab56a77dfd4), L64(0xea50505d50ba0da0), + L64(0x5745450945124c8a), L64(0x38f3f3ebf3cb18fb), L64(0xad3030c0309df060), L64(0xc4efef9bef2b74c3), + L64(0xda3f3ffc3fe5c37e), L64(0xc755554955921caa), L64(0xdba2a2b2a2791059), L64(0xe9eaea8fea0365c9), + L64(0x6a656589650fecca), L64(0x03babad2bab96869), L64(0x4a2f2fbc2f65935e), L64(0x8ec0c027c04ee79d), + L64(0x60dede5fdebe81a1), L64(0xfc1c1c701ce06c38), L64(0x46fdfdd3fdbb2ee7), L64(0x1f4d4d294d52649a), + L64(0x7692927292e4e039), L64(0xfa7575c9758fbcea), L64(0x3606061806301e0c), L64(0xae8a8a128a249809), + L64(0x4bb2b2f2b2f94079), L64(0x85e6e6bfe66359d1), L64(0x7e0e0e380e70361c), L64(0xe71f1f7c1ff8633e), + L64(0x556262956237f7c4), L64(0x3ad4d477d4eea3b5), L64(0x81a8a89aa829324d), L64(0x5296966296c4f431), + L64(0x62f9f9c3f99b3aef), L64(0xa3c5c533c566f697), L64(0x102525942535b14a), L64(0xab59597959f220b2), + L64(0xd084842a8454ae15), L64(0xc57272d572b7a7e4), L64(0xec3939e439d5dd72), L64(0x164c4c2d4c5a6198), + L64(0x945e5e655eca3bbc), L64(0x9f7878fd78e785f0), L64(0xe53838e038ddd870), L64(0x988c8c0a8c148605), + L64(0x17d1d163d1c6b2bf), L64(0xe4a5a5aea5410b57), L64(0xa1e2e2afe2434dd9), L64(0x4e616199612ff8c2), + L64(0x42b3b3f6b3f1457b), L64(0x342121842115a542), L64(0x089c9c4a9c94d625), L64(0xee1e1e781ef0663c), + L64(0x6143431143225286), L64(0xb1c7c73bc776fc93), L64(0x4ffcfcd7fcb32be5), L64(0x2404041004201408), + L64(0xe351515951b208a2), L64(0x2599995e99bcc72f), L64(0x226d6da96d4fc4da), L64(0x650d0d340d68391a), + L64(0x79fafacffa8335e9), L64(0x69dfdf5bdfb684a3), L64(0xa97e7ee57ed79bfc), L64(0x19242490243db448), + L64(0xfe3b3bec3bc5d776), L64(0x9aabab96ab313d4b), L64(0xf0cece1fce3ed181), L64(0x9911114411885522), + L64(0x838f8f068f0c8903), L64(0x044e4e254e4a6b9c), L64(0x66b7b7e6b7d15173), L64(0xe0ebeb8beb0b60cb), + L64(0xc13c3cf03cfdcc78), L64(0xfd81813e817cbf1f), L64(0x4094946a94d4fe35), L64(0x1cf7f7fbf7eb0cf3), + L64(0x18b9b9deb9a1676f), L64(0x8b13134c13985f26), L64(0x512c2cb02c7d9c58), L64(0x05d3d36bd3d6b8bb), + L64(0x8ce7e7bbe76b5cd3), L64(0x396e6ea56e57cbdc), L64(0xaac4c437c46ef395), L64(0x1b03030c03180f06), + L64(0xdc565645568a13ac), L64(0x5e44440d441a4988), L64(0xa07f7fe17fdf9efe), L64(0x88a9a99ea921374f), + L64(0x672a2aa82a4d8254), L64(0x0abbbbd6bbb16d6b), L64(0x87c1c123c146e29f), L64(0xf153535153a202a6), + L64(0x72dcdc57dcae8ba5), L64(0x530b0b2c0b582716), L64(0x019d9d4e9d9cd327), L64(0x2b6c6cad6c47c1d8), + L64(0xa43131c43195f562), L64(0xf37474cd7487b9e8), L64(0x15f6f6fff6e309f1), L64(0x4c464605460a438c), + L64(0xa5acac8aac092645), L64(0xb589891e893c970f), L64(0xb414145014a04428), L64(0xbae1e1a3e15b42df), + L64(0xa616165816b04e2c), L64(0xf73a3ae83acdd274), L64(0x066969b9696fd0d2), L64(0x4109092409482d12), + L64(0xd77070dd70a7ade0), L64(0x6fb6b6e2b6d95471), L64(0x1ed0d067d0ceb7bd), L64(0xd6eded93ed3b7ec7), + L64(0xe2cccc17cc2edb85), L64(0x68424215422a5784), L64(0x2c98985a98b4c22d), L64(0xeda4a4aaa4490e55), + L64(0x752828a0285d8850), L64(0x865c5c6d5cda31b8), L64(0x6bf8f8c7f8933fed), L64(0xc28686228644a411), +}; + +static const unsigned long C2[256] = { + L64(0x30d818186018c078), L64(0x462623238c2305af), L64(0x91b8c6c63fc67ef9), L64(0xcdfbe8e887e8136f), + L64(0x13cb878726874ca1), L64(0x6d11b8b8dab8a962), L64(0x0209010104010805), L64(0x9e0d4f4f214f426e), + L64(0x6c9b3636d836adee), L64(0x51ffa6a6a2a65904), L64(0xb90cd2d26fd2debd), L64(0xf70ef5f5f3f5fb06), + L64(0xf2967979f979ef80), L64(0xde306f6fa16f5fce), L64(0x3f6d91917e91fcef), L64(0xa4f852525552aa07), + L64(0xc04760609d6027fd), L64(0x6535bcbccabc8976), L64(0x2b379b9b569baccd), L64(0x018a8e8e028e048c), + L64(0x5bd2a3a3b6a37115), L64(0x186c0c0c300c603c), L64(0xf6847b7bf17bff8a), L64(0x6a803535d435b5e1), + L64(0x3af51d1d741de869), L64(0xddb3e0e0a7e05347), L64(0xb321d7d77bd7f6ac), L64(0x999cc2c22fc25eed), + L64(0x5c432e2eb82e6d96), L64(0x96294b4b314b627a), L64(0xe15dfefedffea321), L64(0xaed5575741578216), + L64(0x2abd15155415a841), L64(0xeee87777c1779fb6), L64(0x6e923737dc37a5eb), L64(0xd79ee5e5b3e57b56), + L64(0x23139f9f469f8cd9), L64(0xfd23f0f0e7f0d317), L64(0x94204a4a354a6a7f), L64(0xa944dada4fda9e95), + L64(0xb0a258587d58fa25), L64(0x8fcfc9c903c906ca), L64(0x527c2929a429558d), L64(0x145a0a0a280a5022), + L64(0x7f50b1b1feb1e14f), L64(0x5dc9a0a0baa0691a), L64(0xd6146b6bb16b7fda), L64(0x17d985852e855cab), + L64(0x673cbdbdcebd8173), L64(0xba8f5d5d695dd234), L64(0x2090101040108050), L64(0xf507f4f4f7f4f303), + L64(0x8bddcbcb0bcb16c0), L64(0x7cd33e3ef83eedc6), L64(0x0a2d050514052811), L64(0xce78676781671fe6), + L64(0xd597e4e4b7e47353), L64(0x4e0227279c2725bb), L64(0x8273414119413258), L64(0x0ba78b8b168b2c9d), + L64(0x53f6a7a7a6a75101), L64(0xfab27d7de97dcf94), L64(0x374995956e95dcfb), L64(0xad56d8d847d88e9f), + L64(0xeb70fbfbcbfb8b30), L64(0xc1cdeeee9fee2371), L64(0xf8bb7c7ced7cc791), L64(0xcc716666856617e3), + L64(0xa77bdddd53dda68e), L64(0x2eaf17175c17b84b), L64(0x8e45474701470246), L64(0x211a9e9e429e84dc), + L64(0x89d4caca0fca1ec5), L64(0x5a582d2db42d7599), L64(0x632ebfbfc6bf9179), L64(0x0e3f07071c07381b), + L64(0x47acadad8ead0123), L64(0xb4b05a5a755aea2f), L64(0x1bef838336836cb5), L64(0x66b63333cc3385ff), + L64(0xc65c636391633ff2), L64(0x041202020802100a), L64(0x4993aaaa92aa3938), L64(0xe2de7171d971afa8), + L64(0x8dc6c8c807c80ecf), L64(0x32d119196419c87d), L64(0x923b494939497270), L64(0xaf5fd9d943d9869a), + L64(0xf931f2f2eff2c31d), L64(0xdba8e3e3abe34b48), L64(0xb6b95b5b715be22a), L64(0x0dbc88881a883492), + L64(0x293e9a9a529aa4c8), L64(0x4c0b262698262dbe), L64(0x64bf3232c8328dfa), L64(0x7d59b0b0fab0e94a), + L64(0xcff2e9e983e91b6a), L64(0x1e770f0f3c0f7833), L64(0xb733d5d573d5e6a6), L64(0x1df480803a8074ba), + L64(0x6127bebec2be997c), L64(0x87ebcdcd13cd26de), L64(0x68893434d034bde4), L64(0x903248483d487a75), + L64(0xe354ffffdbffab24), L64(0xf48d7a7af57af78f), L64(0x3d6490907a90f4ea), L64(0xbe9d5f5f615fc23e), + L64(0x403d202080201da0), L64(0xd00f6868bd6867d5), L64(0x34ca1a1a681ad072), L64(0x41b7aeae82ae192c), + L64(0x757db4b4eab4c95e), L64(0xa8ce54544d549a19), L64(0x3b7f93937693ece5), L64(0x442f222288220daa), + L64(0xc86364648d6407e9), L64(0xff2af1f1e3f1db12), L64(0xe6cc7373d173bfa2), L64(0x248212124812905a), + L64(0x807a40401d403a5d), L64(0x1048080820084028), L64(0x9b95c3c32bc356e8), L64(0xc5dfecec97ec337b), + L64(0xab4ddbdb4bdb9690), L64(0x5fc0a1a1bea1611f), L64(0x07918d8d0e8d1c83), L64(0x7ac83d3df43df5c9), + L64(0x335b97976697ccf1), L64(0x0000000000000000), L64(0x83f9cfcf1bcf36d4), L64(0x566e2b2bac2b4587), + L64(0xece17676c57697b3), L64(0x19e68282328264b0), L64(0xb128d6d67fd6fea9), L64(0x36c31b1b6c1bd877), + L64(0x7774b5b5eeb5c15b), L64(0x43beafaf86af1129), L64(0xd41d6a6ab56a77df), L64(0xa0ea50505d50ba0d), + L64(0x8a5745450945124c), L64(0xfb38f3f3ebf3cb18), L64(0x60ad3030c0309df0), L64(0xc3c4efef9bef2b74), + L64(0x7eda3f3ffc3fe5c3), L64(0xaac755554955921c), L64(0x59dba2a2b2a27910), L64(0xc9e9eaea8fea0365), + L64(0xca6a656589650fec), L64(0x6903babad2bab968), L64(0x5e4a2f2fbc2f6593), L64(0x9d8ec0c027c04ee7), + L64(0xa160dede5fdebe81), L64(0x38fc1c1c701ce06c), L64(0xe746fdfdd3fdbb2e), L64(0x9a1f4d4d294d5264), + L64(0x397692927292e4e0), L64(0xeafa7575c9758fbc), L64(0x0c3606061806301e), L64(0x09ae8a8a128a2498), + L64(0x794bb2b2f2b2f940), L64(0xd185e6e6bfe66359), L64(0x1c7e0e0e380e7036), L64(0x3ee71f1f7c1ff863), + L64(0xc4556262956237f7), L64(0xb53ad4d477d4eea3), L64(0x4d81a8a89aa82932), L64(0x315296966296c4f4), + L64(0xef62f9f9c3f99b3a), L64(0x97a3c5c533c566f6), L64(0x4a102525942535b1), L64(0xb2ab59597959f220), + L64(0x15d084842a8454ae), L64(0xe4c57272d572b7a7), L64(0x72ec3939e439d5dd), L64(0x98164c4c2d4c5a61), + L64(0xbc945e5e655eca3b), L64(0xf09f7878fd78e785), L64(0x70e53838e038ddd8), L64(0x05988c8c0a8c1486), + L64(0xbf17d1d163d1c6b2), L64(0x57e4a5a5aea5410b), L64(0xd9a1e2e2afe2434d), L64(0xc24e616199612ff8), + L64(0x7b42b3b3f6b3f145), L64(0x42342121842115a5), L64(0x25089c9c4a9c94d6), L64(0x3cee1e1e781ef066), + L64(0x8661434311432252), L64(0x93b1c7c73bc776fc), L64(0xe54ffcfcd7fcb32b), L64(0x0824040410042014), + L64(0xa2e351515951b208), L64(0x2f2599995e99bcc7), L64(0xda226d6da96d4fc4), L64(0x1a650d0d340d6839), + L64(0xe979fafacffa8335), L64(0xa369dfdf5bdfb684), L64(0xfca97e7ee57ed79b), L64(0x4819242490243db4), + L64(0x76fe3b3bec3bc5d7), L64(0x4b9aabab96ab313d), L64(0x81f0cece1fce3ed1), L64(0x2299111144118855), + L64(0x03838f8f068f0c89), L64(0x9c044e4e254e4a6b), L64(0x7366b7b7e6b7d151), L64(0xcbe0ebeb8beb0b60), + L64(0x78c13c3cf03cfdcc), L64(0x1ffd81813e817cbf), L64(0x354094946a94d4fe), L64(0xf31cf7f7fbf7eb0c), + L64(0x6f18b9b9deb9a167), L64(0x268b13134c13985f), L64(0x58512c2cb02c7d9c), L64(0xbb05d3d36bd3d6b8), + L64(0xd38ce7e7bbe76b5c), L64(0xdc396e6ea56e57cb), L64(0x95aac4c437c46ef3), L64(0x061b03030c03180f), + L64(0xacdc565645568a13), L64(0x885e44440d441a49), L64(0xfea07f7fe17fdf9e), L64(0x4f88a9a99ea92137), + L64(0x54672a2aa82a4d82), L64(0x6b0abbbbd6bbb16d), L64(0x9f87c1c123c146e2), L64(0xa6f153535153a202), + L64(0xa572dcdc57dcae8b), L64(0x16530b0b2c0b5827), L64(0x27019d9d4e9d9cd3), L64(0xd82b6c6cad6c47c1), + L64(0x62a43131c43195f5), L64(0xe8f37474cd7487b9), L64(0xf115f6f6fff6e309), L64(0x8c4c464605460a43), + L64(0x45a5acac8aac0926), L64(0x0fb589891e893c97), L64(0x28b414145014a044), L64(0xdfbae1e1a3e15b42), + L64(0x2ca616165816b04e), L64(0x74f73a3ae83acdd2), L64(0xd2066969b9696fd0), L64(0x124109092409482d), + L64(0xe0d77070dd70a7ad), L64(0x716fb6b6e2b6d954), L64(0xbd1ed0d067d0ceb7), L64(0xc7d6eded93ed3b7e), + L64(0x85e2cccc17cc2edb), L64(0x8468424215422a57), L64(0x2d2c98985a98b4c2), L64(0x55eda4a4aaa4490e), + L64(0x50752828a0285d88), L64(0xb8865c5c6d5cda31), L64(0xed6bf8f8c7f8933f), L64(0x11c28686228644a4), +}; + +static const unsigned long C3[256] = { + L64(0x7830d818186018c0), L64(0xaf462623238c2305), L64(0xf991b8c6c63fc67e), L64(0x6fcdfbe8e887e813), + L64(0xa113cb878726874c), L64(0x626d11b8b8dab8a9), L64(0x0502090101040108), L64(0x6e9e0d4f4f214f42), + L64(0xee6c9b3636d836ad), L64(0x0451ffa6a6a2a659), L64(0xbdb90cd2d26fd2de), L64(0x06f70ef5f5f3f5fb), + L64(0x80f2967979f979ef), L64(0xcede306f6fa16f5f), L64(0xef3f6d91917e91fc), L64(0x07a4f852525552aa), + L64(0xfdc04760609d6027), L64(0x766535bcbccabc89), L64(0xcd2b379b9b569bac), L64(0x8c018a8e8e028e04), + L64(0x155bd2a3a3b6a371), L64(0x3c186c0c0c300c60), L64(0x8af6847b7bf17bff), L64(0xe16a803535d435b5), + L64(0x693af51d1d741de8), L64(0x47ddb3e0e0a7e053), L64(0xacb321d7d77bd7f6), L64(0xed999cc2c22fc25e), + L64(0x965c432e2eb82e6d), L64(0x7a96294b4b314b62), L64(0x21e15dfefedffea3), L64(0x16aed55757415782), + L64(0x412abd15155415a8), L64(0xb6eee87777c1779f), L64(0xeb6e923737dc37a5), L64(0x56d79ee5e5b3e57b), + L64(0xd923139f9f469f8c), L64(0x17fd23f0f0e7f0d3), L64(0x7f94204a4a354a6a), L64(0x95a944dada4fda9e), + L64(0x25b0a258587d58fa), L64(0xca8fcfc9c903c906), L64(0x8d527c2929a42955), L64(0x22145a0a0a280a50), + L64(0x4f7f50b1b1feb1e1), L64(0x1a5dc9a0a0baa069), L64(0xdad6146b6bb16b7f), L64(0xab17d985852e855c), + L64(0x73673cbdbdcebd81), L64(0x34ba8f5d5d695dd2), L64(0x5020901010401080), L64(0x03f507f4f4f7f4f3), + L64(0xc08bddcbcb0bcb16), L64(0xc67cd33e3ef83eed), L64(0x110a2d0505140528), L64(0xe6ce78676781671f), + L64(0x53d597e4e4b7e473), L64(0xbb4e0227279c2725), L64(0x5882734141194132), L64(0x9d0ba78b8b168b2c), + L64(0x0153f6a7a7a6a751), L64(0x94fab27d7de97dcf), L64(0xfb374995956e95dc), L64(0x9fad56d8d847d88e), + L64(0x30eb70fbfbcbfb8b), L64(0x71c1cdeeee9fee23), L64(0x91f8bb7c7ced7cc7), L64(0xe3cc716666856617), + L64(0x8ea77bdddd53dda6), L64(0x4b2eaf17175c17b8), L64(0x468e454747014702), L64(0xdc211a9e9e429e84), + L64(0xc589d4caca0fca1e), L64(0x995a582d2db42d75), L64(0x79632ebfbfc6bf91), L64(0x1b0e3f07071c0738), + L64(0x2347acadad8ead01), L64(0x2fb4b05a5a755aea), L64(0xb51bef838336836c), L64(0xff66b63333cc3385), + L64(0xf2c65c636391633f), L64(0x0a04120202080210), L64(0x384993aaaa92aa39), L64(0xa8e2de7171d971af), + L64(0xcf8dc6c8c807c80e), L64(0x7d32d119196419c8), L64(0x70923b4949394972), L64(0x9aaf5fd9d943d986), + L64(0x1df931f2f2eff2c3), L64(0x48dba8e3e3abe34b), L64(0x2ab6b95b5b715be2), L64(0x920dbc88881a8834), + L64(0xc8293e9a9a529aa4), L64(0xbe4c0b262698262d), L64(0xfa64bf3232c8328d), L64(0x4a7d59b0b0fab0e9), + L64(0x6acff2e9e983e91b), L64(0x331e770f0f3c0f78), L64(0xa6b733d5d573d5e6), L64(0xba1df480803a8074), + L64(0x7c6127bebec2be99), L64(0xde87ebcdcd13cd26), L64(0xe468893434d034bd), L64(0x75903248483d487a), + L64(0x24e354ffffdbffab), L64(0x8ff48d7a7af57af7), L64(0xea3d6490907a90f4), L64(0x3ebe9d5f5f615fc2), + L64(0xa0403d202080201d), L64(0xd5d00f6868bd6867), L64(0x7234ca1a1a681ad0), L64(0x2c41b7aeae82ae19), + L64(0x5e757db4b4eab4c9), L64(0x19a8ce54544d549a), L64(0xe53b7f93937693ec), L64(0xaa442f222288220d), + L64(0xe9c86364648d6407), L64(0x12ff2af1f1e3f1db), L64(0xa2e6cc7373d173bf), L64(0x5a24821212481290), + L64(0x5d807a40401d403a), L64(0x2810480808200840), L64(0xe89b95c3c32bc356), L64(0x7bc5dfecec97ec33), + L64(0x90ab4ddbdb4bdb96), L64(0x1f5fc0a1a1bea161), L64(0x8307918d8d0e8d1c), L64(0xc97ac83d3df43df5), + L64(0xf1335b97976697cc), L64(0x0000000000000000), L64(0xd483f9cfcf1bcf36), L64(0x87566e2b2bac2b45), + L64(0xb3ece17676c57697), L64(0xb019e68282328264), L64(0xa9b128d6d67fd6fe), L64(0x7736c31b1b6c1bd8), + L64(0x5b7774b5b5eeb5c1), L64(0x2943beafaf86af11), L64(0xdfd41d6a6ab56a77), L64(0x0da0ea50505d50ba), + L64(0x4c8a574545094512), L64(0x18fb38f3f3ebf3cb), L64(0xf060ad3030c0309d), L64(0x74c3c4efef9bef2b), + L64(0xc37eda3f3ffc3fe5), L64(0x1caac75555495592), L64(0x1059dba2a2b2a279), L64(0x65c9e9eaea8fea03), + L64(0xecca6a656589650f), L64(0x686903babad2bab9), L64(0x935e4a2f2fbc2f65), L64(0xe79d8ec0c027c04e), + L64(0x81a160dede5fdebe), L64(0x6c38fc1c1c701ce0), L64(0x2ee746fdfdd3fdbb), L64(0x649a1f4d4d294d52), + L64(0xe0397692927292e4), L64(0xbceafa7575c9758f), L64(0x1e0c360606180630), L64(0x9809ae8a8a128a24), + L64(0x40794bb2b2f2b2f9), L64(0x59d185e6e6bfe663), L64(0x361c7e0e0e380e70), L64(0x633ee71f1f7c1ff8), + L64(0xf7c4556262956237), L64(0xa3b53ad4d477d4ee), L64(0x324d81a8a89aa829), L64(0xf4315296966296c4), + L64(0x3aef62f9f9c3f99b), L64(0xf697a3c5c533c566), L64(0xb14a102525942535), L64(0x20b2ab59597959f2), + L64(0xae15d084842a8454), L64(0xa7e4c57272d572b7), L64(0xdd72ec3939e439d5), L64(0x6198164c4c2d4c5a), + L64(0x3bbc945e5e655eca), L64(0x85f09f7878fd78e7), L64(0xd870e53838e038dd), L64(0x8605988c8c0a8c14), + L64(0xb2bf17d1d163d1c6), L64(0x0b57e4a5a5aea541), L64(0x4dd9a1e2e2afe243), L64(0xf8c24e616199612f), + L64(0x457b42b3b3f6b3f1), L64(0xa542342121842115), L64(0xd625089c9c4a9c94), L64(0x663cee1e1e781ef0), + L64(0x5286614343114322), L64(0xfc93b1c7c73bc776), L64(0x2be54ffcfcd7fcb3), L64(0x1408240404100420), + L64(0x08a2e351515951b2), L64(0xc72f2599995e99bc), L64(0xc4da226d6da96d4f), L64(0x391a650d0d340d68), + L64(0x35e979fafacffa83), L64(0x84a369dfdf5bdfb6), L64(0x9bfca97e7ee57ed7), L64(0xb44819242490243d), + L64(0xd776fe3b3bec3bc5), L64(0x3d4b9aabab96ab31), L64(0xd181f0cece1fce3e), L64(0x5522991111441188), + L64(0x8903838f8f068f0c), L64(0x6b9c044e4e254e4a), L64(0x517366b7b7e6b7d1), L64(0x60cbe0ebeb8beb0b), + L64(0xcc78c13c3cf03cfd), L64(0xbf1ffd81813e817c), L64(0xfe354094946a94d4), L64(0x0cf31cf7f7fbf7eb), + L64(0x676f18b9b9deb9a1), L64(0x5f268b13134c1398), L64(0x9c58512c2cb02c7d), L64(0xb8bb05d3d36bd3d6), + L64(0x5cd38ce7e7bbe76b), L64(0xcbdc396e6ea56e57), L64(0xf395aac4c437c46e), L64(0x0f061b03030c0318), + L64(0x13acdc565645568a), L64(0x49885e44440d441a), L64(0x9efea07f7fe17fdf), L64(0x374f88a9a99ea921), + L64(0x8254672a2aa82a4d), L64(0x6d6b0abbbbd6bbb1), L64(0xe29f87c1c123c146), L64(0x02a6f153535153a2), + L64(0x8ba572dcdc57dcae), L64(0x2716530b0b2c0b58), L64(0xd327019d9d4e9d9c), L64(0xc1d82b6c6cad6c47), + L64(0xf562a43131c43195), L64(0xb9e8f37474cd7487), L64(0x09f115f6f6fff6e3), L64(0x438c4c464605460a), + L64(0x2645a5acac8aac09), L64(0x970fb589891e893c), L64(0x4428b414145014a0), L64(0x42dfbae1e1a3e15b), + L64(0x4e2ca616165816b0), L64(0xd274f73a3ae83acd), L64(0xd0d2066969b9696f), L64(0x2d12410909240948), + L64(0xade0d77070dd70a7), L64(0x54716fb6b6e2b6d9), L64(0xb7bd1ed0d067d0ce), L64(0x7ec7d6eded93ed3b), + L64(0xdb85e2cccc17cc2e), L64(0x578468424215422a), L64(0xc22d2c98985a98b4), L64(0x0e55eda4a4aaa449), + L64(0x8850752828a0285d), L64(0x31b8865c5c6d5cda), L64(0x3fed6bf8f8c7f893), L64(0xa411c28686228644), +}; + +static const unsigned long C4[256] = { + L64(0xc07830d818186018), L64(0x05af462623238c23), L64(0x7ef991b8c6c63fc6), L64(0x136fcdfbe8e887e8), + L64(0x4ca113cb87872687), L64(0xa9626d11b8b8dab8), L64(0x0805020901010401), L64(0x426e9e0d4f4f214f), + L64(0xadee6c9b3636d836), L64(0x590451ffa6a6a2a6), L64(0xdebdb90cd2d26fd2), L64(0xfb06f70ef5f5f3f5), + L64(0xef80f2967979f979), L64(0x5fcede306f6fa16f), L64(0xfcef3f6d91917e91), L64(0xaa07a4f852525552), + L64(0x27fdc04760609d60), L64(0x89766535bcbccabc), L64(0xaccd2b379b9b569b), L64(0x048c018a8e8e028e), + L64(0x71155bd2a3a3b6a3), L64(0x603c186c0c0c300c), L64(0xff8af6847b7bf17b), L64(0xb5e16a803535d435), + L64(0xe8693af51d1d741d), L64(0x5347ddb3e0e0a7e0), L64(0xf6acb321d7d77bd7), L64(0x5eed999cc2c22fc2), + L64(0x6d965c432e2eb82e), L64(0x627a96294b4b314b), L64(0xa321e15dfefedffe), L64(0x8216aed557574157), + L64(0xa8412abd15155415), L64(0x9fb6eee87777c177), L64(0xa5eb6e923737dc37), L64(0x7b56d79ee5e5b3e5), + L64(0x8cd923139f9f469f), L64(0xd317fd23f0f0e7f0), L64(0x6a7f94204a4a354a), L64(0x9e95a944dada4fda), + L64(0xfa25b0a258587d58), L64(0x06ca8fcfc9c903c9), L64(0x558d527c2929a429), L64(0x5022145a0a0a280a), + L64(0xe14f7f50b1b1feb1), L64(0x691a5dc9a0a0baa0), L64(0x7fdad6146b6bb16b), L64(0x5cab17d985852e85), + L64(0x8173673cbdbdcebd), L64(0xd234ba8f5d5d695d), L64(0x8050209010104010), L64(0xf303f507f4f4f7f4), + L64(0x16c08bddcbcb0bcb), L64(0xedc67cd33e3ef83e), L64(0x28110a2d05051405), L64(0x1fe6ce7867678167), + L64(0x7353d597e4e4b7e4), L64(0x25bb4e0227279c27), L64(0x3258827341411941), L64(0x2c9d0ba78b8b168b), + L64(0x510153f6a7a7a6a7), L64(0xcf94fab27d7de97d), L64(0xdcfb374995956e95), L64(0x8e9fad56d8d847d8), + L64(0x8b30eb70fbfbcbfb), L64(0x2371c1cdeeee9fee), L64(0xc791f8bb7c7ced7c), L64(0x17e3cc7166668566), + L64(0xa68ea77bdddd53dd), L64(0xb84b2eaf17175c17), L64(0x02468e4547470147), L64(0x84dc211a9e9e429e), + L64(0x1ec589d4caca0fca), L64(0x75995a582d2db42d), L64(0x9179632ebfbfc6bf), L64(0x381b0e3f07071c07), + L64(0x012347acadad8ead), L64(0xea2fb4b05a5a755a), L64(0x6cb51bef83833683), L64(0x85ff66b63333cc33), + L64(0x3ff2c65c63639163), L64(0x100a041202020802), L64(0x39384993aaaa92aa), L64(0xafa8e2de7171d971), + L64(0x0ecf8dc6c8c807c8), L64(0xc87d32d119196419), L64(0x7270923b49493949), L64(0x869aaf5fd9d943d9), + L64(0xc31df931f2f2eff2), L64(0x4b48dba8e3e3abe3), L64(0xe22ab6b95b5b715b), L64(0x34920dbc88881a88), + L64(0xa4c8293e9a9a529a), L64(0x2dbe4c0b26269826), L64(0x8dfa64bf3232c832), L64(0xe94a7d59b0b0fab0), + L64(0x1b6acff2e9e983e9), L64(0x78331e770f0f3c0f), L64(0xe6a6b733d5d573d5), L64(0x74ba1df480803a80), + L64(0x997c6127bebec2be), L64(0x26de87ebcdcd13cd), L64(0xbde468893434d034), L64(0x7a75903248483d48), + L64(0xab24e354ffffdbff), L64(0xf78ff48d7a7af57a), L64(0xf4ea3d6490907a90), L64(0xc23ebe9d5f5f615f), + L64(0x1da0403d20208020), L64(0x67d5d00f6868bd68), L64(0xd07234ca1a1a681a), L64(0x192c41b7aeae82ae), + L64(0xc95e757db4b4eab4), L64(0x9a19a8ce54544d54), L64(0xece53b7f93937693), L64(0x0daa442f22228822), + L64(0x07e9c86364648d64), L64(0xdb12ff2af1f1e3f1), L64(0xbfa2e6cc7373d173), L64(0x905a248212124812), + L64(0x3a5d807a40401d40), L64(0x4028104808082008), L64(0x56e89b95c3c32bc3), L64(0x337bc5dfecec97ec), + L64(0x9690ab4ddbdb4bdb), L64(0x611f5fc0a1a1bea1), L64(0x1c8307918d8d0e8d), L64(0xf5c97ac83d3df43d), + L64(0xccf1335b97976697), L64(0x0000000000000000), L64(0x36d483f9cfcf1bcf), L64(0x4587566e2b2bac2b), + L64(0x97b3ece17676c576), L64(0x64b019e682823282), L64(0xfea9b128d6d67fd6), L64(0xd87736c31b1b6c1b), + L64(0xc15b7774b5b5eeb5), L64(0x112943beafaf86af), L64(0x77dfd41d6a6ab56a), L64(0xba0da0ea50505d50), + L64(0x124c8a5745450945), L64(0xcb18fb38f3f3ebf3), L64(0x9df060ad3030c030), L64(0x2b74c3c4efef9bef), + L64(0xe5c37eda3f3ffc3f), L64(0x921caac755554955), L64(0x791059dba2a2b2a2), L64(0x0365c9e9eaea8fea), + L64(0x0fecca6a65658965), L64(0xb9686903babad2ba), L64(0x65935e4a2f2fbc2f), L64(0x4ee79d8ec0c027c0), + L64(0xbe81a160dede5fde), L64(0xe06c38fc1c1c701c), L64(0xbb2ee746fdfdd3fd), L64(0x52649a1f4d4d294d), + L64(0xe4e0397692927292), L64(0x8fbceafa7575c975), L64(0x301e0c3606061806), L64(0x249809ae8a8a128a), + L64(0xf940794bb2b2f2b2), L64(0x6359d185e6e6bfe6), L64(0x70361c7e0e0e380e), L64(0xf8633ee71f1f7c1f), + L64(0x37f7c45562629562), L64(0xeea3b53ad4d477d4), L64(0x29324d81a8a89aa8), L64(0xc4f4315296966296), + L64(0x9b3aef62f9f9c3f9), L64(0x66f697a3c5c533c5), L64(0x35b14a1025259425), L64(0xf220b2ab59597959), + L64(0x54ae15d084842a84), L64(0xb7a7e4c57272d572), L64(0xd5dd72ec3939e439), L64(0x5a6198164c4c2d4c), + L64(0xca3bbc945e5e655e), L64(0xe785f09f7878fd78), L64(0xddd870e53838e038), L64(0x148605988c8c0a8c), + L64(0xc6b2bf17d1d163d1), L64(0x410b57e4a5a5aea5), L64(0x434dd9a1e2e2afe2), L64(0x2ff8c24e61619961), + L64(0xf1457b42b3b3f6b3), L64(0x15a5423421218421), L64(0x94d625089c9c4a9c), L64(0xf0663cee1e1e781e), + L64(0x2252866143431143), L64(0x76fc93b1c7c73bc7), L64(0xb32be54ffcfcd7fc), L64(0x2014082404041004), + L64(0xb208a2e351515951), L64(0xbcc72f2599995e99), L64(0x4fc4da226d6da96d), L64(0x68391a650d0d340d), + L64(0x8335e979fafacffa), L64(0xb684a369dfdf5bdf), L64(0xd79bfca97e7ee57e), L64(0x3db4481924249024), + L64(0xc5d776fe3b3bec3b), L64(0x313d4b9aabab96ab), L64(0x3ed181f0cece1fce), L64(0x8855229911114411), + L64(0x0c8903838f8f068f), L64(0x4a6b9c044e4e254e), L64(0xd1517366b7b7e6b7), L64(0x0b60cbe0ebeb8beb), + L64(0xfdcc78c13c3cf03c), L64(0x7cbf1ffd81813e81), L64(0xd4fe354094946a94), L64(0xeb0cf31cf7f7fbf7), + L64(0xa1676f18b9b9deb9), L64(0x985f268b13134c13), L64(0x7d9c58512c2cb02c), L64(0xd6b8bb05d3d36bd3), + L64(0x6b5cd38ce7e7bbe7), L64(0x57cbdc396e6ea56e), L64(0x6ef395aac4c437c4), L64(0x180f061b03030c03), + L64(0x8a13acdc56564556), L64(0x1a49885e44440d44), L64(0xdf9efea07f7fe17f), L64(0x21374f88a9a99ea9), + L64(0x4d8254672a2aa82a), L64(0xb16d6b0abbbbd6bb), L64(0x46e29f87c1c123c1), L64(0xa202a6f153535153), + L64(0xae8ba572dcdc57dc), L64(0x582716530b0b2c0b), L64(0x9cd327019d9d4e9d), L64(0x47c1d82b6c6cad6c), + L64(0x95f562a43131c431), L64(0x87b9e8f37474cd74), L64(0xe309f115f6f6fff6), L64(0x0a438c4c46460546), + L64(0x092645a5acac8aac), L64(0x3c970fb589891e89), L64(0xa04428b414145014), L64(0x5b42dfbae1e1a3e1), + L64(0xb04e2ca616165816), L64(0xcdd274f73a3ae83a), L64(0x6fd0d2066969b969), L64(0x482d124109092409), + L64(0xa7ade0d77070dd70), L64(0xd954716fb6b6e2b6), L64(0xceb7bd1ed0d067d0), L64(0x3b7ec7d6eded93ed), + L64(0x2edb85e2cccc17cc), L64(0x2a57846842421542), L64(0xb4c22d2c98985a98), L64(0x490e55eda4a4aaa4), + L64(0x5d8850752828a028), L64(0xda31b8865c5c6d5c), L64(0x933fed6bf8f8c7f8), L64(0x44a411c286862286), +}; + +static const unsigned long C5[256] = { + L64(0x18c07830d8181860), L64(0x2305af462623238c), L64(0xc67ef991b8c6c63f), L64(0xe8136fcdfbe8e887), + L64(0x874ca113cb878726), L64(0xb8a9626d11b8b8da), L64(0x0108050209010104), L64(0x4f426e9e0d4f4f21), + L64(0x36adee6c9b3636d8), L64(0xa6590451ffa6a6a2), L64(0xd2debdb90cd2d26f), L64(0xf5fb06f70ef5f5f3), + L64(0x79ef80f2967979f9), L64(0x6f5fcede306f6fa1), L64(0x91fcef3f6d91917e), L64(0x52aa07a4f8525255), + L64(0x6027fdc04760609d), L64(0xbc89766535bcbcca), L64(0x9baccd2b379b9b56), L64(0x8e048c018a8e8e02), + L64(0xa371155bd2a3a3b6), L64(0x0c603c186c0c0c30), L64(0x7bff8af6847b7bf1), L64(0x35b5e16a803535d4), + L64(0x1de8693af51d1d74), L64(0xe05347ddb3e0e0a7), L64(0xd7f6acb321d7d77b), L64(0xc25eed999cc2c22f), + L64(0x2e6d965c432e2eb8), L64(0x4b627a96294b4b31), L64(0xfea321e15dfefedf), L64(0x578216aed5575741), + L64(0x15a8412abd151554), L64(0x779fb6eee87777c1), L64(0x37a5eb6e923737dc), L64(0xe57b56d79ee5e5b3), + L64(0x9f8cd923139f9f46), L64(0xf0d317fd23f0f0e7), L64(0x4a6a7f94204a4a35), L64(0xda9e95a944dada4f), + L64(0x58fa25b0a258587d), L64(0xc906ca8fcfc9c903), L64(0x29558d527c2929a4), L64(0x0a5022145a0a0a28), + L64(0xb1e14f7f50b1b1fe), L64(0xa0691a5dc9a0a0ba), L64(0x6b7fdad6146b6bb1), L64(0x855cab17d985852e), + L64(0xbd8173673cbdbdce), L64(0x5dd234ba8f5d5d69), L64(0x1080502090101040), L64(0xf4f303f507f4f4f7), + L64(0xcb16c08bddcbcb0b), L64(0x3eedc67cd33e3ef8), L64(0x0528110a2d050514), L64(0x671fe6ce78676781), + L64(0xe47353d597e4e4b7), L64(0x2725bb4e0227279c), L64(0x4132588273414119), L64(0x8b2c9d0ba78b8b16), + L64(0xa7510153f6a7a7a6), L64(0x7dcf94fab27d7de9), L64(0x95dcfb374995956e), L64(0xd88e9fad56d8d847), + L64(0xfb8b30eb70fbfbcb), L64(0xee2371c1cdeeee9f), L64(0x7cc791f8bb7c7ced), L64(0x6617e3cc71666685), + L64(0xdda68ea77bdddd53), L64(0x17b84b2eaf17175c), L64(0x4702468e45474701), L64(0x9e84dc211a9e9e42), + L64(0xca1ec589d4caca0f), L64(0x2d75995a582d2db4), L64(0xbf9179632ebfbfc6), L64(0x07381b0e3f07071c), + L64(0xad012347acadad8e), L64(0x5aea2fb4b05a5a75), L64(0x836cb51bef838336), L64(0x3385ff66b63333cc), + L64(0x633ff2c65c636391), L64(0x02100a0412020208), L64(0xaa39384993aaaa92), L64(0x71afa8e2de7171d9), + L64(0xc80ecf8dc6c8c807), L64(0x19c87d32d1191964), L64(0x497270923b494939), L64(0xd9869aaf5fd9d943), + L64(0xf2c31df931f2f2ef), L64(0xe34b48dba8e3e3ab), L64(0x5be22ab6b95b5b71), L64(0x8834920dbc88881a), + L64(0x9aa4c8293e9a9a52), L64(0x262dbe4c0b262698), L64(0x328dfa64bf3232c8), L64(0xb0e94a7d59b0b0fa), + L64(0xe91b6acff2e9e983), L64(0x0f78331e770f0f3c), L64(0xd5e6a6b733d5d573), L64(0x8074ba1df480803a), + L64(0xbe997c6127bebec2), L64(0xcd26de87ebcdcd13), L64(0x34bde468893434d0), L64(0x487a75903248483d), + L64(0xffab24e354ffffdb), L64(0x7af78ff48d7a7af5), L64(0x90f4ea3d6490907a), L64(0x5fc23ebe9d5f5f61), + L64(0x201da0403d202080), L64(0x6867d5d00f6868bd), L64(0x1ad07234ca1a1a68), L64(0xae192c41b7aeae82), + L64(0xb4c95e757db4b4ea), L64(0x549a19a8ce54544d), L64(0x93ece53b7f939376), L64(0x220daa442f222288), + L64(0x6407e9c86364648d), L64(0xf1db12ff2af1f1e3), L64(0x73bfa2e6cc7373d1), L64(0x12905a2482121248), + L64(0x403a5d807a40401d), L64(0x0840281048080820), L64(0xc356e89b95c3c32b), L64(0xec337bc5dfecec97), + L64(0xdb9690ab4ddbdb4b), L64(0xa1611f5fc0a1a1be), L64(0x8d1c8307918d8d0e), L64(0x3df5c97ac83d3df4), + L64(0x97ccf1335b979766), L64(0x0000000000000000), L64(0xcf36d483f9cfcf1b), L64(0x2b4587566e2b2bac), + L64(0x7697b3ece17676c5), L64(0x8264b019e6828232), L64(0xd6fea9b128d6d67f), L64(0x1bd87736c31b1b6c), + L64(0xb5c15b7774b5b5ee), L64(0xaf112943beafaf86), L64(0x6a77dfd41d6a6ab5), L64(0x50ba0da0ea50505d), + L64(0x45124c8a57454509), L64(0xf3cb18fb38f3f3eb), L64(0x309df060ad3030c0), L64(0xef2b74c3c4efef9b), + L64(0x3fe5c37eda3f3ffc), L64(0x55921caac7555549), L64(0xa2791059dba2a2b2), L64(0xea0365c9e9eaea8f), + L64(0x650fecca6a656589), L64(0xbab9686903babad2), L64(0x2f65935e4a2f2fbc), L64(0xc04ee79d8ec0c027), + L64(0xdebe81a160dede5f), L64(0x1ce06c38fc1c1c70), L64(0xfdbb2ee746fdfdd3), L64(0x4d52649a1f4d4d29), + L64(0x92e4e03976929272), L64(0x758fbceafa7575c9), L64(0x06301e0c36060618), L64(0x8a249809ae8a8a12), + L64(0xb2f940794bb2b2f2), L64(0xe66359d185e6e6bf), L64(0x0e70361c7e0e0e38), L64(0x1ff8633ee71f1f7c), + L64(0x6237f7c455626295), L64(0xd4eea3b53ad4d477), L64(0xa829324d81a8a89a), L64(0x96c4f43152969662), + L64(0xf99b3aef62f9f9c3), L64(0xc566f697a3c5c533), L64(0x2535b14a10252594), L64(0x59f220b2ab595979), + L64(0x8454ae15d084842a), L64(0x72b7a7e4c57272d5), L64(0x39d5dd72ec3939e4), L64(0x4c5a6198164c4c2d), + L64(0x5eca3bbc945e5e65), L64(0x78e785f09f7878fd), L64(0x38ddd870e53838e0), L64(0x8c148605988c8c0a), + L64(0xd1c6b2bf17d1d163), L64(0xa5410b57e4a5a5ae), L64(0xe2434dd9a1e2e2af), L64(0x612ff8c24e616199), + L64(0xb3f1457b42b3b3f6), L64(0x2115a54234212184), L64(0x9c94d625089c9c4a), L64(0x1ef0663cee1e1e78), + L64(0x4322528661434311), L64(0xc776fc93b1c7c73b), L64(0xfcb32be54ffcfcd7), L64(0x0420140824040410), + L64(0x51b208a2e3515159), L64(0x99bcc72f2599995e), L64(0x6d4fc4da226d6da9), L64(0x0d68391a650d0d34), + L64(0xfa8335e979fafacf), L64(0xdfb684a369dfdf5b), L64(0x7ed79bfca97e7ee5), L64(0x243db44819242490), + L64(0x3bc5d776fe3b3bec), L64(0xab313d4b9aabab96), L64(0xce3ed181f0cece1f), L64(0x1188552299111144), + L64(0x8f0c8903838f8f06), L64(0x4e4a6b9c044e4e25), L64(0xb7d1517366b7b7e6), L64(0xeb0b60cbe0ebeb8b), + L64(0x3cfdcc78c13c3cf0), L64(0x817cbf1ffd81813e), L64(0x94d4fe354094946a), L64(0xf7eb0cf31cf7f7fb), + L64(0xb9a1676f18b9b9de), L64(0x13985f268b13134c), L64(0x2c7d9c58512c2cb0), L64(0xd3d6b8bb05d3d36b), + L64(0xe76b5cd38ce7e7bb), L64(0x6e57cbdc396e6ea5), L64(0xc46ef395aac4c437), L64(0x03180f061b03030c), + L64(0x568a13acdc565645), L64(0x441a49885e44440d), L64(0x7fdf9efea07f7fe1), L64(0xa921374f88a9a99e), + L64(0x2a4d8254672a2aa8), L64(0xbbb16d6b0abbbbd6), L64(0xc146e29f87c1c123), L64(0x53a202a6f1535351), + L64(0xdcae8ba572dcdc57), L64(0x0b582716530b0b2c), L64(0x9d9cd327019d9d4e), L64(0x6c47c1d82b6c6cad), + L64(0x3195f562a43131c4), L64(0x7487b9e8f37474cd), L64(0xf6e309f115f6f6ff), L64(0x460a438c4c464605), + L64(0xac092645a5acac8a), L64(0x893c970fb589891e), L64(0x14a04428b4141450), L64(0xe15b42dfbae1e1a3), + L64(0x16b04e2ca6161658), L64(0x3acdd274f73a3ae8), L64(0x696fd0d2066969b9), L64(0x09482d1241090924), + L64(0x70a7ade0d77070dd), L64(0xb6d954716fb6b6e2), L64(0xd0ceb7bd1ed0d067), L64(0xed3b7ec7d6eded93), + L64(0xcc2edb85e2cccc17), L64(0x422a578468424215), L64(0x98b4c22d2c98985a), L64(0xa4490e55eda4a4aa), + L64(0x285d8850752828a0), L64(0x5cda31b8865c5c6d), L64(0xf8933fed6bf8f8c7), L64(0x8644a411c2868622), +}; + +static const unsigned long C6[256] = { + L64(0x6018c07830d81818), L64(0x8c2305af46262323), L64(0x3fc67ef991b8c6c6), L64(0x87e8136fcdfbe8e8), + L64(0x26874ca113cb8787), L64(0xdab8a9626d11b8b8), L64(0x0401080502090101), L64(0x214f426e9e0d4f4f), + L64(0xd836adee6c9b3636), L64(0xa2a6590451ffa6a6), L64(0x6fd2debdb90cd2d2), L64(0xf3f5fb06f70ef5f5), + L64(0xf979ef80f2967979), L64(0xa16f5fcede306f6f), L64(0x7e91fcef3f6d9191), L64(0x5552aa07a4f85252), + L64(0x9d6027fdc0476060), L64(0xcabc89766535bcbc), L64(0x569baccd2b379b9b), L64(0x028e048c018a8e8e), + L64(0xb6a371155bd2a3a3), L64(0x300c603c186c0c0c), L64(0xf17bff8af6847b7b), L64(0xd435b5e16a803535), + L64(0x741de8693af51d1d), L64(0xa7e05347ddb3e0e0), L64(0x7bd7f6acb321d7d7), L64(0x2fc25eed999cc2c2), + L64(0xb82e6d965c432e2e), L64(0x314b627a96294b4b), L64(0xdffea321e15dfefe), L64(0x41578216aed55757), + L64(0x5415a8412abd1515), L64(0xc1779fb6eee87777), L64(0xdc37a5eb6e923737), L64(0xb3e57b56d79ee5e5), + L64(0x469f8cd923139f9f), L64(0xe7f0d317fd23f0f0), L64(0x354a6a7f94204a4a), L64(0x4fda9e95a944dada), + L64(0x7d58fa25b0a25858), L64(0x03c906ca8fcfc9c9), L64(0xa429558d527c2929), L64(0x280a5022145a0a0a), + L64(0xfeb1e14f7f50b1b1), L64(0xbaa0691a5dc9a0a0), L64(0xb16b7fdad6146b6b), L64(0x2e855cab17d98585), + L64(0xcebd8173673cbdbd), L64(0x695dd234ba8f5d5d), L64(0x4010805020901010), L64(0xf7f4f303f507f4f4), + L64(0x0bcb16c08bddcbcb), L64(0xf83eedc67cd33e3e), L64(0x140528110a2d0505), L64(0x81671fe6ce786767), + L64(0xb7e47353d597e4e4), L64(0x9c2725bb4e022727), L64(0x1941325882734141), L64(0x168b2c9d0ba78b8b), + L64(0xa6a7510153f6a7a7), L64(0xe97dcf94fab27d7d), L64(0x6e95dcfb37499595), L64(0x47d88e9fad56d8d8), + L64(0xcbfb8b30eb70fbfb), L64(0x9fee2371c1cdeeee), L64(0xed7cc791f8bb7c7c), L64(0x856617e3cc716666), + L64(0x53dda68ea77bdddd), L64(0x5c17b84b2eaf1717), L64(0x014702468e454747), L64(0x429e84dc211a9e9e), + L64(0x0fca1ec589d4caca), L64(0xb42d75995a582d2d), L64(0xc6bf9179632ebfbf), L64(0x1c07381b0e3f0707), + L64(0x8ead012347acadad), L64(0x755aea2fb4b05a5a), L64(0x36836cb51bef8383), L64(0xcc3385ff66b63333), + L64(0x91633ff2c65c6363), L64(0x0802100a04120202), L64(0x92aa39384993aaaa), L64(0xd971afa8e2de7171), + L64(0x07c80ecf8dc6c8c8), L64(0x6419c87d32d11919), L64(0x39497270923b4949), L64(0x43d9869aaf5fd9d9), + L64(0xeff2c31df931f2f2), L64(0xabe34b48dba8e3e3), L64(0x715be22ab6b95b5b), L64(0x1a8834920dbc8888), + L64(0x529aa4c8293e9a9a), L64(0x98262dbe4c0b2626), L64(0xc8328dfa64bf3232), L64(0xfab0e94a7d59b0b0), + L64(0x83e91b6acff2e9e9), L64(0x3c0f78331e770f0f), L64(0x73d5e6a6b733d5d5), L64(0x3a8074ba1df48080), + L64(0xc2be997c6127bebe), L64(0x13cd26de87ebcdcd), L64(0xd034bde468893434), L64(0x3d487a7590324848), + L64(0xdbffab24e354ffff), L64(0xf57af78ff48d7a7a), L64(0x7a90f4ea3d649090), L64(0x615fc23ebe9d5f5f), + L64(0x80201da0403d2020), L64(0xbd6867d5d00f6868), L64(0x681ad07234ca1a1a), L64(0x82ae192c41b7aeae), + L64(0xeab4c95e757db4b4), L64(0x4d549a19a8ce5454), L64(0x7693ece53b7f9393), L64(0x88220daa442f2222), + L64(0x8d6407e9c8636464), L64(0xe3f1db12ff2af1f1), L64(0xd173bfa2e6cc7373), L64(0x4812905a24821212), + L64(0x1d403a5d807a4040), L64(0x2008402810480808), L64(0x2bc356e89b95c3c3), L64(0x97ec337bc5dfecec), + L64(0x4bdb9690ab4ddbdb), L64(0xbea1611f5fc0a1a1), L64(0x0e8d1c8307918d8d), L64(0xf43df5c97ac83d3d), + L64(0x6697ccf1335b9797), L64(0x0000000000000000), L64(0x1bcf36d483f9cfcf), L64(0xac2b4587566e2b2b), + L64(0xc57697b3ece17676), L64(0x328264b019e68282), L64(0x7fd6fea9b128d6d6), L64(0x6c1bd87736c31b1b), + L64(0xeeb5c15b7774b5b5), L64(0x86af112943beafaf), L64(0xb56a77dfd41d6a6a), L64(0x5d50ba0da0ea5050), + L64(0x0945124c8a574545), L64(0xebf3cb18fb38f3f3), L64(0xc0309df060ad3030), L64(0x9bef2b74c3c4efef), + L64(0xfc3fe5c37eda3f3f), L64(0x4955921caac75555), L64(0xb2a2791059dba2a2), L64(0x8fea0365c9e9eaea), + L64(0x89650fecca6a6565), L64(0xd2bab9686903baba), L64(0xbc2f65935e4a2f2f), L64(0x27c04ee79d8ec0c0), + L64(0x5fdebe81a160dede), L64(0x701ce06c38fc1c1c), L64(0xd3fdbb2ee746fdfd), L64(0x294d52649a1f4d4d), + L64(0x7292e4e039769292), L64(0xc9758fbceafa7575), L64(0x1806301e0c360606), L64(0x128a249809ae8a8a), + L64(0xf2b2f940794bb2b2), L64(0xbfe66359d185e6e6), L64(0x380e70361c7e0e0e), L64(0x7c1ff8633ee71f1f), + L64(0x956237f7c4556262), L64(0x77d4eea3b53ad4d4), L64(0x9aa829324d81a8a8), L64(0x6296c4f431529696), + L64(0xc3f99b3aef62f9f9), L64(0x33c566f697a3c5c5), L64(0x942535b14a102525), L64(0x7959f220b2ab5959), + L64(0x2a8454ae15d08484), L64(0xd572b7a7e4c57272), L64(0xe439d5dd72ec3939), L64(0x2d4c5a6198164c4c), + L64(0x655eca3bbc945e5e), L64(0xfd78e785f09f7878), L64(0xe038ddd870e53838), L64(0x0a8c148605988c8c), + L64(0x63d1c6b2bf17d1d1), L64(0xaea5410b57e4a5a5), L64(0xafe2434dd9a1e2e2), L64(0x99612ff8c24e6161), + L64(0xf6b3f1457b42b3b3), L64(0x842115a542342121), L64(0x4a9c94d625089c9c), L64(0x781ef0663cee1e1e), + L64(0x1143225286614343), L64(0x3bc776fc93b1c7c7), L64(0xd7fcb32be54ffcfc), L64(0x1004201408240404), + L64(0x5951b208a2e35151), L64(0x5e99bcc72f259999), L64(0xa96d4fc4da226d6d), L64(0x340d68391a650d0d), + L64(0xcffa8335e979fafa), L64(0x5bdfb684a369dfdf), L64(0xe57ed79bfca97e7e), L64(0x90243db448192424), + L64(0xec3bc5d776fe3b3b), L64(0x96ab313d4b9aabab), L64(0x1fce3ed181f0cece), L64(0x4411885522991111), + L64(0x068f0c8903838f8f), L64(0x254e4a6b9c044e4e), L64(0xe6b7d1517366b7b7), L64(0x8beb0b60cbe0ebeb), + L64(0xf03cfdcc78c13c3c), L64(0x3e817cbf1ffd8181), L64(0x6a94d4fe35409494), L64(0xfbf7eb0cf31cf7f7), + L64(0xdeb9a1676f18b9b9), L64(0x4c13985f268b1313), L64(0xb02c7d9c58512c2c), L64(0x6bd3d6b8bb05d3d3), + L64(0xbbe76b5cd38ce7e7), L64(0xa56e57cbdc396e6e), L64(0x37c46ef395aac4c4), L64(0x0c03180f061b0303), + L64(0x45568a13acdc5656), L64(0x0d441a49885e4444), L64(0xe17fdf9efea07f7f), L64(0x9ea921374f88a9a9), + L64(0xa82a4d8254672a2a), L64(0xd6bbb16d6b0abbbb), L64(0x23c146e29f87c1c1), L64(0x5153a202a6f15353), + L64(0x57dcae8ba572dcdc), L64(0x2c0b582716530b0b), L64(0x4e9d9cd327019d9d), L64(0xad6c47c1d82b6c6c), + L64(0xc43195f562a43131), L64(0xcd7487b9e8f37474), L64(0xfff6e309f115f6f6), L64(0x05460a438c4c4646), + L64(0x8aac092645a5acac), L64(0x1e893c970fb58989), L64(0x5014a04428b41414), L64(0xa3e15b42dfbae1e1), + L64(0x5816b04e2ca61616), L64(0xe83acdd274f73a3a), L64(0xb9696fd0d2066969), L64(0x2409482d12410909), + L64(0xdd70a7ade0d77070), L64(0xe2b6d954716fb6b6), L64(0x67d0ceb7bd1ed0d0), L64(0x93ed3b7ec7d6eded), + L64(0x17cc2edb85e2cccc), L64(0x15422a5784684242), L64(0x5a98b4c22d2c9898), L64(0xaaa4490e55eda4a4), + L64(0xa0285d8850752828), L64(0x6d5cda31b8865c5c), L64(0xc7f8933fed6bf8f8), L64(0x228644a411c28686), +}; + +static const unsigned long C7[256] = { + L64(0x186018c07830d818), L64(0x238c2305af462623), L64(0xc63fc67ef991b8c6), L64(0xe887e8136fcdfbe8), + L64(0x8726874ca113cb87), L64(0xb8dab8a9626d11b8), L64(0x0104010805020901), L64(0x4f214f426e9e0d4f), + L64(0x36d836adee6c9b36), L64(0xa6a2a6590451ffa6), L64(0xd26fd2debdb90cd2), L64(0xf5f3f5fb06f70ef5), + L64(0x79f979ef80f29679), L64(0x6fa16f5fcede306f), L64(0x917e91fcef3f6d91), L64(0x525552aa07a4f852), + L64(0x609d6027fdc04760), L64(0xbccabc89766535bc), L64(0x9b569baccd2b379b), L64(0x8e028e048c018a8e), + L64(0xa3b6a371155bd2a3), L64(0x0c300c603c186c0c), L64(0x7bf17bff8af6847b), L64(0x35d435b5e16a8035), + L64(0x1d741de8693af51d), L64(0xe0a7e05347ddb3e0), L64(0xd77bd7f6acb321d7), L64(0xc22fc25eed999cc2), + L64(0x2eb82e6d965c432e), L64(0x4b314b627a96294b), L64(0xfedffea321e15dfe), L64(0x5741578216aed557), + L64(0x155415a8412abd15), L64(0x77c1779fb6eee877), L64(0x37dc37a5eb6e9237), L64(0xe5b3e57b56d79ee5), + L64(0x9f469f8cd923139f), L64(0xf0e7f0d317fd23f0), L64(0x4a354a6a7f94204a), L64(0xda4fda9e95a944da), + L64(0x587d58fa25b0a258), L64(0xc903c906ca8fcfc9), L64(0x29a429558d527c29), L64(0x0a280a5022145a0a), + L64(0xb1feb1e14f7f50b1), L64(0xa0baa0691a5dc9a0), L64(0x6bb16b7fdad6146b), L64(0x852e855cab17d985), + L64(0xbdcebd8173673cbd), L64(0x5d695dd234ba8f5d), L64(0x1040108050209010), L64(0xf4f7f4f303f507f4), + L64(0xcb0bcb16c08bddcb), L64(0x3ef83eedc67cd33e), L64(0x05140528110a2d05), L64(0x6781671fe6ce7867), + L64(0xe4b7e47353d597e4), L64(0x279c2725bb4e0227), L64(0x4119413258827341), L64(0x8b168b2c9d0ba78b), + L64(0xa7a6a7510153f6a7), L64(0x7de97dcf94fab27d), L64(0x956e95dcfb374995), L64(0xd847d88e9fad56d8), + L64(0xfbcbfb8b30eb70fb), L64(0xee9fee2371c1cdee), L64(0x7ced7cc791f8bb7c), L64(0x66856617e3cc7166), + L64(0xdd53dda68ea77bdd), L64(0x175c17b84b2eaf17), L64(0x47014702468e4547), L64(0x9e429e84dc211a9e), + L64(0xca0fca1ec589d4ca), L64(0x2db42d75995a582d), L64(0xbfc6bf9179632ebf), L64(0x071c07381b0e3f07), + L64(0xad8ead012347acad), L64(0x5a755aea2fb4b05a), L64(0x8336836cb51bef83), L64(0x33cc3385ff66b633), + L64(0x6391633ff2c65c63), L64(0x020802100a041202), L64(0xaa92aa39384993aa), L64(0x71d971afa8e2de71), + L64(0xc807c80ecf8dc6c8), L64(0x196419c87d32d119), L64(0x4939497270923b49), L64(0xd943d9869aaf5fd9), + L64(0xf2eff2c31df931f2), L64(0xe3abe34b48dba8e3), L64(0x5b715be22ab6b95b), L64(0x881a8834920dbc88), + L64(0x9a529aa4c8293e9a), L64(0x2698262dbe4c0b26), L64(0x32c8328dfa64bf32), L64(0xb0fab0e94a7d59b0), + L64(0xe983e91b6acff2e9), L64(0x0f3c0f78331e770f), L64(0xd573d5e6a6b733d5), L64(0x803a8074ba1df480), + L64(0xbec2be997c6127be), L64(0xcd13cd26de87ebcd), L64(0x34d034bde4688934), L64(0x483d487a75903248), + L64(0xffdbffab24e354ff), L64(0x7af57af78ff48d7a), L64(0x907a90f4ea3d6490), L64(0x5f615fc23ebe9d5f), + L64(0x2080201da0403d20), L64(0x68bd6867d5d00f68), L64(0x1a681ad07234ca1a), L64(0xae82ae192c41b7ae), + L64(0xb4eab4c95e757db4), L64(0x544d549a19a8ce54), L64(0x937693ece53b7f93), L64(0x2288220daa442f22), + L64(0x648d6407e9c86364), L64(0xf1e3f1db12ff2af1), L64(0x73d173bfa2e6cc73), L64(0x124812905a248212), + L64(0x401d403a5d807a40), L64(0x0820084028104808), L64(0xc32bc356e89b95c3), L64(0xec97ec337bc5dfec), + L64(0xdb4bdb9690ab4ddb), L64(0xa1bea1611f5fc0a1), L64(0x8d0e8d1c8307918d), L64(0x3df43df5c97ac83d), + L64(0x976697ccf1335b97), L64(0x0000000000000000), L64(0xcf1bcf36d483f9cf), L64(0x2bac2b4587566e2b), + L64(0x76c57697b3ece176), L64(0x82328264b019e682), L64(0xd67fd6fea9b128d6), L64(0x1b6c1bd87736c31b), + L64(0xb5eeb5c15b7774b5), L64(0xaf86af112943beaf), L64(0x6ab56a77dfd41d6a), L64(0x505d50ba0da0ea50), + L64(0x450945124c8a5745), L64(0xf3ebf3cb18fb38f3), L64(0x30c0309df060ad30), L64(0xef9bef2b74c3c4ef), + L64(0x3ffc3fe5c37eda3f), L64(0x554955921caac755), L64(0xa2b2a2791059dba2), L64(0xea8fea0365c9e9ea), + L64(0x6589650fecca6a65), L64(0xbad2bab9686903ba), L64(0x2fbc2f65935e4a2f), L64(0xc027c04ee79d8ec0), + L64(0xde5fdebe81a160de), L64(0x1c701ce06c38fc1c), L64(0xfdd3fdbb2ee746fd), L64(0x4d294d52649a1f4d), + L64(0x927292e4e0397692), L64(0x75c9758fbceafa75), L64(0x061806301e0c3606), L64(0x8a128a249809ae8a), + L64(0xb2f2b2f940794bb2), L64(0xe6bfe66359d185e6), L64(0x0e380e70361c7e0e), L64(0x1f7c1ff8633ee71f), + L64(0x62956237f7c45562), L64(0xd477d4eea3b53ad4), L64(0xa89aa829324d81a8), L64(0x966296c4f4315296), + L64(0xf9c3f99b3aef62f9), L64(0xc533c566f697a3c5), L64(0x25942535b14a1025), L64(0x597959f220b2ab59), + L64(0x842a8454ae15d084), L64(0x72d572b7a7e4c572), L64(0x39e439d5dd72ec39), L64(0x4c2d4c5a6198164c), + L64(0x5e655eca3bbc945e), L64(0x78fd78e785f09f78), L64(0x38e038ddd870e538), L64(0x8c0a8c148605988c), + L64(0xd163d1c6b2bf17d1), L64(0xa5aea5410b57e4a5), L64(0xe2afe2434dd9a1e2), L64(0x6199612ff8c24e61), + L64(0xb3f6b3f1457b42b3), L64(0x21842115a5423421), L64(0x9c4a9c94d625089c), L64(0x1e781ef0663cee1e), + L64(0x4311432252866143), L64(0xc73bc776fc93b1c7), L64(0xfcd7fcb32be54ffc), L64(0x0410042014082404), + L64(0x515951b208a2e351), L64(0x995e99bcc72f2599), L64(0x6da96d4fc4da226d), L64(0x0d340d68391a650d), + L64(0xfacffa8335e979fa), L64(0xdf5bdfb684a369df), L64(0x7ee57ed79bfca97e), L64(0x2490243db4481924), + L64(0x3bec3bc5d776fe3b), L64(0xab96ab313d4b9aab), L64(0xce1fce3ed181f0ce), L64(0x1144118855229911), + L64(0x8f068f0c8903838f), L64(0x4e254e4a6b9c044e), L64(0xb7e6b7d1517366b7), L64(0xeb8beb0b60cbe0eb), + L64(0x3cf03cfdcc78c13c), L64(0x813e817cbf1ffd81), L64(0x946a94d4fe354094), L64(0xf7fbf7eb0cf31cf7), + L64(0xb9deb9a1676f18b9), L64(0x134c13985f268b13), L64(0x2cb02c7d9c58512c), L64(0xd36bd3d6b8bb05d3), + L64(0xe7bbe76b5cd38ce7), L64(0x6ea56e57cbdc396e), L64(0xc437c46ef395aac4), L64(0x030c03180f061b03), + L64(0x5645568a13acdc56), L64(0x440d441a49885e44), L64(0x7fe17fdf9efea07f), L64(0xa99ea921374f88a9), + L64(0x2aa82a4d8254672a), L64(0xbbd6bbb16d6b0abb), L64(0xc123c146e29f87c1), L64(0x535153a202a6f153), + L64(0xdc57dcae8ba572dc), L64(0x0b2c0b582716530b), L64(0x9d4e9d9cd327019d), L64(0x6cad6c47c1d82b6c), + L64(0x31c43195f562a431), L64(0x74cd7487b9e8f374), L64(0xf6fff6e309f115f6), L64(0x4605460a438c4c46), + L64(0xac8aac092645a5ac), L64(0x891e893c970fb589), L64(0x145014a04428b414), L64(0xe1a3e15b42dfbae1), + L64(0x165816b04e2ca616), L64(0x3ae83acdd274f73a), L64(0x69b9696fd0d20669), L64(0x092409482d124109), + L64(0x70dd70a7ade0d770), L64(0xb6e2b6d954716fb6), L64(0xd067d0ceb7bd1ed0), L64(0xed93ed3b7ec7d6ed), + L64(0xcc17cc2edb85e2cc), L64(0x4215422a57846842), L64(0x985a98b4c22d2c98), L64(0xa4aaa4490e55eda4), + L64(0x28a0285d88507528), L64(0x5c6d5cda31b8865c), L64(0xf8c7f8933fed6bf8), L64(0x86228644a411c286), +}; + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */ diff --git a/src/cpp/ext/php_unicode.h b/src/cpp/ext/php_unicode.h new file mode 100644 index 0000000000000..b2c4c804837f0 --- /dev/null +++ b/src/cpp/ext/php_unicode.h @@ -0,0 +1,192 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2007 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: Wez Furlong (wez@thebrainroom.com) | + +----------------------------------------------------------------------+ + + Based on code from ucdata-2.5, which has the following Copyright: + + Copyright 2001 Computing Research Labs, New Mexico State University + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. +*/ + +#ifndef PHP_UNICODE_H +#define PHP_UNICODE_H + +/* + * Values that can appear in the `mask1' parameter of the php_unicode_is_prop() + * function. + */ +#define UC_MN 0x00000001 /* Mark, Non-Spacing */ +#define UC_MC 0x00000002 /* Mark, Spacing Combining */ +#define UC_ME 0x00000004 /* Mark, Enclosing */ +#define UC_ND 0x00000008 /* Number, Decimal Digit */ +#define UC_NL 0x00000010 /* Number, Letter */ +#define UC_NO 0x00000020 /* Number, Other */ +#define UC_ZS 0x00000040 /* Separator, Space */ +#define UC_ZL 0x00000080 /* Separator, Line */ +#define UC_ZP 0x00000100 /* Separator, Paragraph */ +#define UC_CC 0x00000200 /* Other, Control */ +#define UC_CF 0x00000400 /* Other, Format */ +#define UC_OS 0x00000800 /* Other, Surrogate */ +#define UC_CO 0x00001000 /* Other, Private Use */ +#define UC_CN 0x00002000 /* Other, Not Assigned */ +#define UC_LU 0x00004000 /* Letter, Uppercase */ +#define UC_LL 0x00008000 /* Letter, Lowercase */ +#define UC_LT 0x00010000 /* Letter, Titlecase */ +#define UC_LM 0x00020000 /* Letter, Modifier */ +#define UC_LO 0x00040000 /* Letter, Other */ +#define UC_PC 0x00080000 /* Punctuation, Connector */ +#define UC_PD 0x00100000 /* Punctuation, Dash */ +#define UC_PS 0x00200000 /* Punctuation, Open */ +#define UC_PE 0x00400000 /* Punctuation, Close */ +#define UC_PO 0x00800000 /* Punctuation, Other */ +#define UC_SM 0x01000000 /* Symbol, Math */ +#define UC_SC 0x02000000 /* Symbol, Currency */ +#define UC_SK 0x04000000 /* Symbol, Modifier */ +#define UC_SO 0x08000000 /* Symbol, Other */ +#define UC_L 0x10000000 /* Left-To-Right */ +#define UC_R 0x20000000 /* Right-To-Left */ +#define UC_EN 0x40000000 /* European Number */ +#define UC_ES 0x80000000 /* European Number Separator */ + +/* + * Values that can appear in the `mask2' parameter of the php_unicode_is_prop() + * function. + */ +#define UC_ET 0x00000001 /* European Number Terminator */ +#define UC_AN 0x00000002 /* Arabic Number */ +#define UC_CS 0x00000004 /* Common Number Separator */ +#define UC_B 0x00000008 /* Block Separator */ +#define UC_S 0x00000010 /* Segment Separator */ +#define UC_WS 0x00000020 /* Whitespace */ +#define UC_ON 0x00000040 /* Other Neutrals */ +/* + * Implementation specific character properties. + */ +#define UC_CM 0x00000080 /* Composite */ +#define UC_NB 0x00000100 /* Non-Breaking */ +#define UC_SY 0x00000200 /* Symmetric */ +#define UC_HD 0x00000400 /* Hex Digit */ +#define UC_QM 0x00000800 /* Quote Mark */ +#define UC_MR 0x00001000 /* Mirroring */ +#define UC_SS 0x00002000 /* Space, other */ + +#define UC_CP 0x00004000 /* Defined */ + +/* + * Added for UnicodeData-2.1.3. + */ +#define UC_PI 0x00008000 /* Punctuation, Initial */ +#define UC_PF 0x00010000 /* Punctuation, Final */ + +#define PHP_UNICODE_CASE_UPPER 0 +#define PHP_UNICODE_CASE_LOWER 1 +#define PHP_UNICODE_CASE_TITLE 2 + +#define php_unicode_is_alpha(cc) php_unicode_is_prop(cc, UC_LU|UC_LL|UC_LM|UC_LO|UC_LT, 0) +#define php_unicode_is_digit(cc) php_unicode_is_prop(cc, UC_ND, 0) +#define php_unicode_is_alnum(cc) php_unicode_is_prop(cc, UC_LU|UC_LL|UC_LM|UC_LO|UC_LT|UC_ND, 0) +#define php_unicode_is_cntrl(cc) php_unicode_is_prop(cc, UC_CC|UC_CF, 0) +#define php_unicode_is_space(cc) php_unicode_is_prop(cc, UC_ZS|UC_SS, 0) +#define php_unicode_is_blank(cc) php_unicode_is_prop(cc, UC_ZS, 0) +#define php_unicode_is_punct(cc) php_unicode_is_prop(cc, UC_PD|UC_PS|UC_PE|UC_PO, UC_PI|UC_PF) +#define php_unicode_is_graph(cc) php_unicode_is_prop(cc, UC_MN|UC_MC|UC_ME|UC_ND|UC_NL|UC_NO|\ + UC_LU|UC_LL|UC_LT|UC_LM|UC_LO|UC_PC|UC_PD|\ + UC_PS|UC_PE|UC_PO|UC_SM|UC_SM|UC_SC|UC_SK|\ + UC_SO, UC_PI|UC_PF) +#define php_unicode_is_print(cc) php_unicode_is_prop(cc, UC_MN|UC_MC|UC_ME|UC_ND|UC_NL|UC_NO|\ + UC_LU|UC_LL|UC_LT|UC_LM|UC_LO|UC_PC|UC_PD|\ + UC_PS|UC_PE|UC_PO|UC_SM|UC_SM|UC_SC|UC_SK|\ + UC_SO|UC_ZS, UC_PI|UC_PF) +#define php_unicode_is_upper(cc) php_unicode_is_prop(cc, UC_LU, 0) +#define php_unicode_is_lower(cc) php_unicode_is_prop(cc, UC_LL, 0) +#define php_unicode_is_title(cc) php_unicode_is_prop(cc, UC_LT, 0) +#define php_unicode_is_xdigit(cc) php_unicode_is_prop(cc, 0, UC_HD) + +#define php_unicode_is_isocntrl(cc) php_unicode_is_prop(cc, UC_CC, 0) +#define php_unicode_is_fmtcntrl(cc) php_unicode_is_prop(cc, UC_CF, 0) + +#define php_unicode_is_symbol(cc) php_unicode_is_prop(cc, UC_SM|UC_SC|UC_SO|UC_SK, 0) +#define php_unicode_is_number(cc) php_unicode_is_prop(cc, UC_ND|UC_NO|UC_NL, 0) +#define php_unicode_is_nonspacing(cc) php_unicode_is_prop(cc, UC_MN, 0) +#define php_unicode_is_openpunct(cc) php_unicode_is_prop(cc, UC_PS, 0) +#define php_unicode_is_closepunct(cc) php_unicode_is_prop(cc, UC_PE, 0) +#define php_unicode_is_initialpunct(cc) php_unicode_is_prop(cc, 0, UC_PI) +#define php_unicode_is_finalpunct(cc) php_unicode_is_prop(cc, 0, UC_PF) + +#define php_unicode_is_composite(cc) php_unicode_is_prop(cc, 0, UC_CM) +#define php_unicode_is_hex(cc) php_unicode_is_prop(cc, 0, UC_HD) +#define php_unicode_is_quote(cc) php_unicode_is_prop(cc, 0, UC_QM) +#define php_unicode_is_symmetric(cc) php_unicode_is_prop(cc, 0, UC_SY) +#define php_unicode_is_mirroring(cc) php_unicode_is_prop(cc, 0, UC_MR) +#define php_unicode_is_nonbreaking(cc) php_unicode_is_prop(cc, 0, UC_NB) + +/* + * Directionality macros. + */ +#define php_unicode_is_rtl(cc) php_unicode_is_prop(cc, UC_R, 0) +#define php_unicode_is_ltr(cc) php_unicode_is_prop(cc, UC_L, 0) +#define php_unicode_is_strong(cc) php_unicode_is_prop(cc, UC_L|UC_R, 0) +#define php_unicode_is_weak(cc) php_unicode_is_prop(cc, UC_EN|UC_ES, UC_ET|UC_AN|UC_CS) +#define php_unicode_is_neutral(cc) php_unicode_is_prop(cc, 0, UC_B|UC_S|UC_WS|UC_ON) +#define php_unicode_is_separator(cc) php_unicode_is_prop(cc, 0, UC_B|UC_S) + +/* + * Other macros inspired by John Cowan. + */ +#define php_unicode_is_mark(cc) php_unicode_is_prop(cc, UC_MN|UC_MC|UC_ME, 0) +#define php_unicode_is_modif(cc) php_unicode_is_prop(cc, UC_LM, 0) +#define php_unicode_is_letnum(cc) php_unicode_is_prop(cc, UC_NL, 0) +#define php_unicode_is_connect(cc) php_unicode_is_prop(cc, UC_PC, 0) +#define php_unicode_is_dash(cc) php_unicode_is_prop(cc, UC_PD, 0) +#define php_unicode_is_math(cc) php_unicode_is_prop(cc, UC_SM, 0) +#define php_unicode_is_currency(cc) php_unicode_is_prop(cc, UC_SC, 0) +#define php_unicode_is_modifsymbol(cc) php_unicode_is_prop(cc, UC_SK, 0) +#define php_unicode_is_nsmark(cc) php_unicode_is_prop(cc, UC_MN, 0) +#define php_unicode_is_spmark(cc) php_unicode_is_prop(cc, UC_MC, 0) +#define php_unicode_is_enclosing(cc) php_unicode_is_prop(cc, UC_ME, 0) +#define php_unicode_is_private(cc) php_unicode_is_prop(cc, UC_CO, 0) +#define php_unicode_is_surrogate(cc) php_unicode_is_prop(cc, UC_OS, 0) +#define php_unicode_is_lsep(cc) php_unicode_is_prop(cc, UC_ZL, 0) +#define php_unicode_is_psep(cc) php_unicode_is_prop(cc, UC_ZP, 0) + +#define php_unicode_is_identstart(cc) php_unicode_is_prop(cc, UC_LU|UC_LL|UC_LT|UC_LO|UC_NL, 0) +#define php_unicode_is_identpart(cc) php_unicode_is_prop(cc, UC_LU|UC_LL|UC_LT|UC_LO|UC_NL|\ + UC_MN|UC_MC|UC_ND|UC_PC|UC_CF, 0) + +#define php_unicode_is_defined(cc) php_unicode_is_prop(cc, 0, UC_CP) +#define php_unicode_is_undefined(cc) !php_unicode_is_prop(cc, 0, UC_CP) + +/* + * Other miscellaneous character property macros. + */ +#define php_unicode_is_han(cc) (((cc) >= 0x4e00 && (cc) <= 0x9fff) ||\ + ((cc) >= 0xf900 && (cc) <= 0xfaff)) +#define php_unicode_is_hangul(cc) ((cc) >= 0xac00 && (cc) <= 0xd7ff) + + +#endif /* PHP_UNICODE_H */ + + + diff --git a/src/cpp/ext/phpmcc/Makefile b/src/cpp/ext/phpmcc/Makefile new file mode 100644 index 0000000000000..54308c5749aa6 --- /dev/null +++ b/src/cpp/ext/phpmcc/Makefile @@ -0,0 +1,20 @@ + +PROJECT_ROOT = ../../../.. +PROJECT_NAME = hphp_cpp_ext_phpmcc + +AUTO_SOURCES = 1 +ifdef HPHP_DEV + SOURCE_SUBDIRS = release +else + SOURCE_SUBDIRS = beta +endif + +include $(PROJECT_ROOT)/src/rules.mk + +ifdef MAC_OS_X +TARGETS = $(STATIC_LIB) +else +TARGETS = $(STATIC_LIB) $(SHARED_LIB) +endif + +all: $(TARGETS) diff --git a/src/cpp/ext/phpmcc/ext_php_mcc.h b/src/cpp/ext/phpmcc/ext_php_mcc.h new file mode 100644 index 0000000000000..50be947660bb6 --- /dev/null +++ b/src/cpp/ext/phpmcc/ext_php_mcc.h @@ -0,0 +1,22 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +// when building beta, should pick up the correct .h file. +#if defined(HPHP_DEV) +#include +#else +#include +#endif /* #if defined(HPHP_DEV) */ diff --git a/src/cpp/ext/phpmcc/release/Makefile b/src/cpp/ext/phpmcc/release/Makefile new file mode 100644 index 0000000000000..fa3d85ade9d93 --- /dev/null +++ b/src/cpp/ext/phpmcc/release/Makefile @@ -0,0 +1,16 @@ + +PROJECT_ROOT = ../../../../.. +PROJECT_NAME = hphp_cpp_ext_phpmcc_release + +AUTO_SOURCES = 1 +SOURCE_SUBDIRS = + +include $(PROJECT_ROOT)/src/rules.mk + +ifdef MAC_OS_X +TARGETS = $(STATIC_LIB) +else +TARGETS = $(STATIC_LIB) $(SHARED_LIB) +endif + +all: $(TARGETS) diff --git a/src/cpp/ext/phpmcc/release/ext_php_mcc.cpp b/src/cpp/ext/phpmcc/release/ext_php_mcc.cpp new file mode 100644 index 0000000000000..99a13c105c5ea --- /dev/null +++ b/src/cpp/ext/phpmcc/release/ext_php_mcc.cpp @@ -0,0 +1,3568 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ext_php_mcc.h" +#include "ext_php_mcc_impl.h" + +using namespace HPHP; +using namespace boost; +using namespace std; + +#define PHPMCC_LOG_MAX 1024 + +namespace HPHP { + +/////////////////////////////////////////////////////////////////////////////// + +class MccExtension : public RequestEventHandler { +public: + void registerPersistentObject(const std::string &name) { + m_persistentObjects.insert(name); + } + + virtual void requestInit() {} + virtual void requestShutdown() { + // listeners have "context" that are request specific + for (set::const_iterator iter = m_persistentObjects.begin(); + iter != m_persistentObjects.end(); ++iter) { + ResourceData *res = g_persistentObjects->get("php_mcc::resources", + iter->c_str()); + if (res) { + MccResource *mcc = dynamic_cast(res); + ASSERT(mcc); + if (mcc) { + mcc->m_nreqs++; + mcc->removeListeners(); + mcc_clear_err(mcc->m_mcc, NULL); + } + } + } + m_persistentObjects.clear(); + } + +public: + set m_persistentObjects; +}; + +static RequestLocal s_mcc_extension; + +/////////////////////////////////////////////////////////////////////////////// +// constants + +const int64 k_MCC_IPPROTO_TCP = IPPROTO_TCP; +const int64 k_MCC_IPPROTO_UDP = IPPROTO_UDP; +const int64 k_MCC_SERVER_UP = MCC_SERVER_UP; +const int64 k_MCC_SERVER_DOWN = MCC_SERVER_DOWN; +const int64 k_MCC_SERVER_DISABLED = MCC_SERVER_DISABLED; +const int64 k_MCC_SERVER_RETRY_TMO_MS = MCC_SERVER_RETRY_TMO_MS_DEFAULT; +const int64 k_MCC_DGRAM_TMO_THRESHOLD = MCC_DGRAM_TMO_THRESHOLD_DEFAULT; +const int64 k_MCC_PORT_DEFAULT = MCC_PORT_DEFAULT; +const int64 k_MCC_POOLPREFIX_LEN = MCC_POOLPREFIX_LEN_DEFAULT; +const int64 k_MCC_MTU = MCC_MTU_DEFAULT; +const int64 k_MCC_RXDGRAM_MAX = MCC_RXDGRAM_MAX_DEFAULT; +const int64 k_MCC_CONN_TMO_MS = MCC_CONN_TMO_MS_DEFAULT; +const int64 k_MCC_CONN_NTRIES = MCC_CONN_NTRIES_DEFAULT; +const int64 k_MCC_DGRAM_NTRIES = MCC_DGRAM_NTRIES_DEFAULT; +const double k_MCC_DGRAM_TMO_WEIGHT = MCC_DGRAM_TMO_WEIGHT_DEFAULT; +const int64 k_MCC_NODELAY = MCC_NODELAY_DEFAULT; +const int64 k_MCC_POLL_TMO_US = MCC_POLL_TMO_US_DEFAULT; +const int64 k_MCC_PROXY_DELETE_OP = mcc_proxy_delete_op; // HPHP wut +const int64 k_MCC_PROXY_UPDATE_OP = mcc_proxy_update_op; +const int64 k_MCC_PROXY_ARITH_OP = mcc_proxy_arith_op; +const int64 k_MCC_PROXY_GET_OP = mcc_proxy_get_op; +const int64 k_MCC_TMO_MS = MCC_TMO_MS_DEFAULT; +const int64 k_MCC_UDP_REPLY_PORTS = MCC_UDP_REPLY_PORTS_DEFAULT; +const int64 k_MCC_WINDOW_MAX = MCC_WINDOW_MAX_DEFAULT; +const int64 k_MCC_HAVE_FB_SERIALIZATION = 1; +const StaticString k_MCC_ARG_FB_SERIALIZE_ENABLED = + PHPMCC_ARG_FB_SERIALIZE_ENABLED; +const StaticString k_MCC_ARG_CONSISTENT_HASHING_PREFIXES = + PHPMCC_ARG_CONSISTENT_HASHING_PREFIXES; +#if defined(HAVE_DEBUG_LOG) +const int64 k_MCC_HAVE_DEBUG_LOG = 1; +#else /* defined(HAVE_DEBUG_LOG) */ +const int64 k_MCC_HAVE_DEBUG_LOG = 0; +#endif /* defined(HAVE_DEBUG_LOG) */ +const StaticString k_MCC_ARG_DEBUG = + PHPMCC_ARG_DEBUG; +const StaticString k_MCC_ARG_DEBUG_LOGFILE = + PHPMCC_ARG_DEBUG_LOGFILE; +const int64 k_MCC_HAVE_ZLIB_COMPRESSION = 1; +const int64 k_MCC_COMPRESSION_THRESHHOLD = + PHPMCC_COMPRESSION_THRESHOLD_DEFAULT; +/* configuration arg members */ +const StaticString k_MCC_ARG_SERVERS = PHPMCC_ARG_SERVERS; +const StaticString k_MCC_ARG_MIRROR_CFG = PHPMCC_ARG_MIRROR_CFG; +const StaticString k_MCC_ARG_MIRROR_CFG_NAME = PHPMCC_ARG_MIRROR_CFG_NAME; +const StaticString k_MCC_ARG_MIRROR_CFG_MODEL = PHPMCC_ARG_MIRROR_CFG_MODEL; +const StaticString k_MCC_ARG_MIRROR_CFG_SERVERPOOLS = + PHPMCC_ARG_MIRROR_CFG_SERVERPOOLS; +const StaticString k_MCC_ARG_COMPRESSION_THRESHOLD = + PHPMCC_ARG_COMPRESSION_THRESHOLD; +const StaticString k_MCC_ARG_NZLIB_COMPRESSION = PHPMCC_ARG_NZLIB_COMPRESSION; +const StaticString k_MCC_ARG_CONN_TMO = PHPMCC_ARG_CONN_TMO; +const StaticString k_MCC_ARG_CONN_NTRIES = PHPMCC_ARG_CONN_NTRIES; +const StaticString k_MCC_ARG_DEFAULT_PREFIX = PHPMCC_ARG_DEFAULT_PREFIX; +/* Alias args delete_proxy key to proxy so old clients still see the expected + key. */ +const StaticString k_MCC_ARG_DELETE_PROXY = PHPMCC_ARG_PROXY; +const StaticString k_MCC_ARG_DGRAM_NTRIES = PHPMCC_ARG_DGRAM_NTRIES; +const StaticString k_MCC_ARG_DGRAM_TMO_WEIGHT = PHPMCC_ARG_DGRAM_TMO_WEIGHT; +const StaticString k_MCC_ARG_NODELAY = PHPMCC_ARG_NODELAY; +const StaticString k_MCC_ARG_PERSISTENT = PHPMCC_ARG_PERSISTENT; +const StaticString k_MCC_ARG_POLL_TMO = PHPMCC_ARG_POLL_TMO; +const StaticString k_MCC_ARG_PROXY = PHPMCC_ARG_PROXY; +const StaticString k_MCC_ARG_PROXY_OPS = PHPMCC_ARG_PROXY_OPS; +const StaticString k_MCC_ARG_TMO = PHPMCC_ARG_TMO; +const StaticString k_MCC_ARG_TCP_INACTIVITY_TIME = + PHPMCC_ARG_TCP_INACTIVITY_TIME; +const StaticString k_MCC_ARG_NPOOLPREFIX = PHPMCC_ARG_NPOOLPREFIX; +const int64 k_MCC_TCP_INACTIVITY_TMO_DEFAULT = + MCC_TCP_INACTIVITY_TMO_MS_DEFAULT; +const StaticString k_MCC_ARG_UDP_REPLY_PORTS = PHPMCC_ARG_UDP_REPLY_PORTS; +const StaticString k_MCC_ARG_WINDOW_MAX = PHPMCC_ARG_WINDOW_MAX; +const int64 k_MCC_CONSISTENCY_IGNORE = + MccMirrorMcc::CONSISTENCY_IGNORE; +const int64 k_MCC_CONSISTENCY_MATCH_ALL = + MccMirrorMcc::CONSISTENCY_MATCH_ALL; +const int64 k_MCC_CONSISTENCY_MATCH_HITS = + MccMirrorMcc::CONSISTENCY_MATCH_HITS; +const int64 k_MCC_CONSISTENCY_MATCH_HITS_SUPERCEDES = + MccMirrorMcc::CONSISTENCY_MATCH_HITS_SUPERCEDES; +const StaticString k_MCC_ARG_SERVER_RETRY_TMO_MS = + PHPMCC_ARG_SERVER_RETRY_TMO_MS; +const StaticString k_MCC_ARG_DGRAM_TMO_THRESHOLD = + PHPMCC_ARG_DGRAM_TMO_THRESHOLD; +const int64 k_MCC_GET_RECORD_ERRORS = PHPMCC_GET_RECORD_ERRORS; +const int64 k_MCC_DELETE_DELETED = PHPMCC_DELETE_DELETED; +const int64 k_MCC_DELETE_NOTFOUND = PHPMCC_DELETE_NOTFOUND; +const int64 k_MCC_DELETE_ERROR_LOG = PHPMCC_DELETE_ERROR_LOG; +const int64 k_MCC_DELETE_ERROR_NOLOG = PHPMCC_DELETE_ERROR_NOLOG; + +const int64 k_PHPMCC_NEW_HANDLE = (int64)MccResource::PHPMCC_NEW_HANDLE; +const int64 k_PHPMCC_USED_FAST_PATH = (int64)MccResource::PHPMCC_USED_FAST_PATH; +const int64 k_PHPMCC_USED_SLOW_PATH = (int64)MccResource::PHPMCC_USED_SLOW_PATH; + +const StaticString k_PHPMCC_VERSION = "1.6.2"; +const int64 q_phpmcc_IPPROTO_TCP = IPPROTO_TCP; +const int64 q_phpmcc_IPPROTO_UDP = IPPROTO_UDP; + +/////////////////////////////////////////////////////////////////////////////// +// crc32 + +/* The crc32 functions and data was originally written by Spencer + * Garrett and was cleaned from the PostgreSQL source + * tree via the files contrib/ltree/crc32.[ch]. No license was + * included, therefore it is assumed that this code is public + * domain. Attribution still noted. */ + +static const uint32 crc32tab[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, +}; + +static inline uint32 phpmcc_crc32(const char* data, const size_t ndata) { + uint32 result; + size_t ix; + + result = ~0; + for (ix = 0; ix < ndata; ix++) + result = (result >> 8) ^ crc32tab[(result ^ data[ix]) & 0xff]; + + //result = (~result >> 16) & 0x7fff; + result = (~result) & 0x7fffffff; + + return result == 0 ? 1 : result; +} + +/////////////////////////////////////////////////////////////////////////////// +// nstring + +static inline void phpstring_to_nstring(nstring_t &nstring, std::string s) { + nstring.str = const_cast(s.data()); + nstring.len = s.size(); +} + +static inline void phpstring_to_nstring(nstring_t &nstring, CStrRef s) { + nstring.str = const_cast(s.data()); + nstring.len = s.size(); +} + +static inline void phpstring_to_nstring(nstring_t &nstring, Variant var) { + if (var.isString()) { + String s = var.toString(); + nstring.str = const_cast(s.data()); + nstring.len = s.size(); + } else { + nstring.str = NULL; + nstring.len = 0; + } +} + +/** Converts PHP assoc array of string to a malloced array of nstrings. Note, + this method references the string data in the PHP array. It does not make + a separate copy. */ +static inline nstring_t* nstring_array_new(nstring_t* &resultp, + size_t &countp, CVarRef values) { + nstring_t* result; + size_t count; + size_t ix = 0; + + if (values.is(KindOfArray)) { + Array ht = values.toArray(); + count = ht.size(); + + if ((result = (nstring_t*)malloc(sizeof(nstring_t) * count)) == NULL) { + return result; + } + + for (ArrayIter it = ht.begin(); !it.end(); ++it) { + Variant key = it.first(); + Variant value = it.second(); + if (key.isString()) { + String s = key.toString(); + result[ix].str = const_cast(s.data()); + result[ix].len = s.size(); + ix++; + } else if (value.isString()) { + String s = value.toString(); + result[ix].str = const_cast(s.data()); + result[ix].len = s.size(); + ix++; + } + } + } else if (values.isString()) { + if ((result = (nstring_t*)malloc(sizeof(nstring_t))) == NULL) { + return result; + } + String s = values.toString(); + result->str = const_cast(s.data()); + result->len = s.size(); + ix = 1; + } else { + result = NULL; + } + + resultp = result; + countp = ix; + return result; +} + +static inline void nstring_array_del(nstring_t* nstring_array) { + free(nstring_array); +} + +/** Converts PHP assoc array of string to a malloced array of nstrings. Note, + this method references the string data in the PHP array. It does not make + a separate copy. */ +static inline uint32 nstring_dict_new(MccResourcePtr &phpmcc, + CArrRef input, + nstring_t*& ret_keys, + nstring_t*& ret_values) { + nstring_t* keys = NULL, * values = NULL; + size_t count; + count = input.size(); + uint32 ix = 0; + + if ((keys = (nstring_t*)malloc(sizeof(nstring_t) * count)) == NULL) { + goto epilogue; + } + if ((values = (nstring_t*)malloc(sizeof(nstring_t) * count)) == NULL) { + goto epilogue; + } + + for (ArrayIter it = input.begin(); !it.end(); ++it) { + CVarRef key = it.first(); + ASSERT(key.isString()); + String skey = key.toString(); + keys[ix].str = const_cast(skey.data()); + keys[ix].len = skey.size(); + Variant value = it.second(); + ASSERT(value.isString()); + String sval = value.toString(); + values[ix].str = const_cast(sval.data()); + values[ix].len = sval.size(); + + // at this point, if we've made it here, keys[ix] points to the key and + // values[ix] points to the string-ified version of the value. + ix++; + } + + ret_keys = keys; + ret_values = values; + + epilogue: + if (ix == 0) { + if (keys != NULL) { + free(keys); + } + if (values != NULL) { + free(values); + } + } + return ix; +} + +/////////////////////////////////////////////////////////////////////////////// +// errors + +static const char *error_types[MCC_UNKNOWN_ERROR + 1] = { + /* [MCC_NO_ERROR] = */ "ok", + /* [MCC_SYS_ERROR] = */ "system_error", + /* [MCC_APP_ERROR] = */ "application_error", + /* [MCC_REMOTE_ERROR] = */ "remote_error", + /* [MCC_UNKNOWN_ERROR] = */ "unknown_error" +}; + +static inline const char* phpmcc_errtype_to_string(mcc_errtype_t type) { + return error_types[type <= MCC_UNKNOWN_ERROR ? type : MCC_UNKNOWN_ERROR]; +} + +static void phpmcc_call_error_listeners(MccResourcePtr &phpmcc, + CVarRef error_list) { + ListenerIt listener; + Array params; + params.set(0, null); + params.set(1, error_list); + + for (listener = phpmcc->m_error_listeners.begin(); + listener != phpmcc->m_error_listeners.end(); ++listener) { + CStrRef function = (*listener)->m_function; + params.set(0, ref((*listener)->m_context)); + if (f_function_exists(function)) { + f_call_user_func_array(function, params); + } else { + Logger::Warning("[php_mcc] in %s on line %d error listener call back " + "failed for %s %p", __FILE__, __LINE__, + (*listener)->m_function.data(), &(*listener)->m_context); + } + } +} + +static Array phpmcc_err_to_phparray(const mcc_errtype_t type, + const timeval_t timestamp, const int code, + const char* source, const int lineno, + const nstring_t message) { + Array phperr; + phperr.set("type", String(phpmcc_errtype_to_string(type), AttachLiteral)); + phperr.set("timestamp", timestamp.tv_sec * 1000 + timestamp.tv_usec / 1000); + phperr.set("code", code); + phperr.set("source", String(source, CopyString)); + phperr.set("line", lineno); + if (message.len > 1) { + phperr.set("message", String(message.str, message.len, CopyString)); + } else { + phperr.set("message", String("")); + } + return phperr; +} + +static Array phpmcc_errlist_to_phparray(const mcc_handle_t memcache) { + Array errlist; + const mcc_err_t* err = mcc_get_last_err(memcache); + while ((err = mcc_get_last_err(memcache)) != NULL) { + Array phperr = phpmcc_err_to_phparray + (err->type, err->timestamp, err->code, err->source, err->lineno, + err->message); + errlist.append(phperr); + mcc_clear_err(memcache, err); + } + return errlist; +} + +static void phpmcc_log(MccResourcePtr &phpmcc, const mcc_errtype_t type, + const int code, const char* source, const int lineno, + const char* format, ...) { + va_list ap; + va_start(ap, format); + + timeval_t timestamp; + gettimeofday(×tamp, NULL); + + nstring_t message; + char buf[PHPMCC_LOG_MAX]; + message.str = buf; + if ((message.len = vsnprintf(buf, PHPMCC_LOG_MAX, format, ap)) > + PHPMCC_LOG_MAX) { + /* truncated message, just set length to everything but the null + terminator */ + message.len = PHPMCC_LOG_MAX - 1; + } + + Array err = phpmcc_err_to_phparray(type, timestamp, code, + source, lineno, message); + Array errlist; + errlist.append(err); + + phpmcc_call_error_listeners(phpmcc, errlist); +} + +static inline int mcc_log_if_error(MccResourcePtr &phpmcc) { + const mcc_err_t* err = mcc_get_last_err(phpmcc->m_mcc); + if (err == NULL) { + return 0; + } + + Array errlist = phpmcc_errlist_to_phparray(phpmcc->m_mcc); + phpmcc_call_error_listeners(phpmcc, errlist); + return 1; +} + +/////////////////////////////////////////////////////////////////////////////// +// serialization + +static bool phpmcc_fb_serialize_value(MccResourcePtr &phpmcc, + CStrRef key, + phpmcc_flags_t& flags, + CVarRef unserialized_value, + String& serialized_value) { + bool result = false; + + /* Quick check for object - which are not handled by fb serialization. */ + if (unserialized_value.is(KindOfObject)) { + return result; + } + + bool use_fb = phpmcc->m_fb_serialize_enabled && + phpmcc->m_fb_serialize_available; + + if (use_fb) { + Variant sval = f_fb_thrift_serialize(unserialized_value); + if (sval.isNull()) { + result = false; + } else { + serialized_value = sval; + flags = (phpmcc_flags_t)(flags | phpmcc_fb_serialized); + result = true; + } + } + return result; +} + +static inline bool phpmcc_php_serialize_value(MccResourcePtr &phpmcc, + CStrRef key, + phpmcc_flags_t& flags, + CVarRef unserialized_value, + String& serialized_value) { + Variant v = f_serialize(unserialized_value); + if (v.isString()) { + serialized_value = v.toString(); + flags = (phpmcc_flags_t) (flags | phpmcc_serialized); + return true; + } + return false; +} + +static inline int phpmcc_unserialize_value(MccResourcePtr &phpmcc, + const phpmcc_flags_t flags, + const char *serialized_value, + int serialized_len, + Variant& unserialized_value) { + // 0 is fail, 1 is success + if (serialized_len == 0) { + unserialized_value = null; + return 0; + } + + if (flags & phpmcc_fb_serialized) { + int pos = 0; + if ((fb_unserialize_from_buffer(unserialized_value, + serialized_value, + serialized_len, + &pos))) { + return 0; + } + return 1; + } + + if (flags & phpmcc_serialized) { + std::istringstream in(std::string(serialized_value, serialized_len)); + VariableUnserializer vu(in); + try { + unserialized_value = vu.unserialize(); + } catch (Exception &e) { + return 0; + } + return 1; + } + + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// +// compression + +#define NZLIB_MAGIC 0x6e7a6c69 /* nzli */ +/* The new compression format stores a magic number and the size + of the uncompressed object. The magic number is stored to make sure + bad values do not cause us to allocate bogus or extremely large amounts + of memory when encountering an object with the new format. */ +typedef struct _nzlib_format { + uint32_t magic; + uint32_t uncompressed_sz; + Bytef buf[0]; +} nzlib_format; + +static int phpmcc_zlib_compress_value(MccResourcePtr &phpmcc, + phpmcc_flags_t& flags, + CStrRef uncompressed_value, + String& compressed_value) { + int result = 0; + + if (phpmcc->m_zlib_compression_enabled) { + nzlib_format *compressed_object = NULL; + uLong compressed_len; + uLong internal_compressed_len; + int status; + char* compressed_buf; + + /* room for \0 and our header. taken from php_zlib */ + compressed_len = uncompressed_value.size() + + (uncompressed_value.size() / 1000) + 15 + 5; + compressed_object = (nzlib_format *)malloc(compressed_len); + if (!compressed_object) + goto epilogue; + + /* We want to steal the allocated compressed_value buf for the returned + compressed_value zval, so compress into the compressed_object buf for + nzlib compression or at the beginning of compressed_object itself if + we aren't going to prepend a header. */ + + if (phpmcc->m_nzlib_compression) { + compressed_object->magic = htonl(NZLIB_MAGIC); + compressed_object->uncompressed_sz = htonl(uncompressed_value.size()); + compressed_buf = (char*)compressed_object->buf; + compressed_len -= sizeof(nzlib_format); + } else { + compressed_buf = (char*)compressed_object; + } + + status = compress((Bytef*)compressed_buf, (uLongf *)&compressed_len, + (Bytef*)uncompressed_value.data(), + uncompressed_value.size()); + if (status != Z_OK) { + goto epilogue; + } + + /* XXX: Should we check for error? php_zlib does not. */ + internal_compressed_len = compressed_len + + (phpmcc->m_nzlib_compression ? sizeof(*compressed_object) : 0); + compressed_object = (nzlib_format*)realloc(compressed_object, + internal_compressed_len + 1); + ((char*)compressed_object)[internal_compressed_len] = '\0'; + compressed_value = String((char*)compressed_object, + internal_compressed_len, AttachString); + flags = + (phpmcc_flags_t)(flags | + ((phpmcc->m_nzlib_compression ? phpmcc_nzlib_compressed + : phpmcc_compressed))); + + /* We stole the buf from compressed object for compressed_value, + so null it out so we don't attempt to free it. */ + + compressed_object = NULL; + + result = 1; + + epilogue: + + if (!result) { + if (compressed_object != NULL) { + free(compressed_object); + } + } + } + + return result; +} + +static inline int phpmcc_zlib_uncompress_value(MccResourcePtr &phpmcc, + uint32_t flags, + const char *compressed_value, + int compressed_len, + String& uncompressed_value) { + int result = 1; + nzlib_format *nzlib_object; + Bytef *compressed = NULL; + Bytef *uncompressed = NULL; + uint32_t factor = 1; + uint32_t maxfactor = 16; + uLong compressed_sz; + uLong uncompressed_sz = 0; + uLong length; + int status = 0; + + if (flags & phpmcc_nzlib_compressed) { + nzlib_object = (nzlib_format *) compressed_value; + + if (ntohl(nzlib_object->magic) != NZLIB_MAGIC) { + result = 0; + goto epilogue; + } + compressed = nzlib_object->buf; + compressed_sz = compressed_len - sizeof(*nzlib_object); + uncompressed_sz = ntohl(nzlib_object->uncompressed_sz); + } else { + compressed = (Bytef *)compressed_value; + compressed_sz = compressed_len; + } + + /* Taken from php/ext/zlib/zlib.c + zlib::uncompress() wants to know the output data length + if none was given as a parameter + we try from input length * 2 up to input length 2^15 + doubling it whenever it wasn't big enough + that should be enough for all real life cases */ + do { + length = uncompressed_sz ? uncompressed_sz : + compressed_sz * (1 << factor++); + uncompressed = (Bytef*)realloc(uncompressed, length); + status = uncompress(uncompressed, &length, compressed, compressed_sz); + } while (status == Z_BUF_ERROR && !uncompressed_sz && factor < maxfactor); + if (status != Z_OK) { + result = 0; + goto epilogue; + } + /* Make sure the uncompressed_sz matches the length returned by zlib */ + if (uncompressed_sz != 0 && uncompressed_sz != length) { + result = 0; + goto epilogue; + } + + /* XXX: Should we check for error? php_zlib does not. */ + uncompressed = (Bytef*)realloc(uncompressed, length + 1); /* space for \0 */ + uncompressed[length] = '\0'; + + if (uncompressed != NULL) { + uncompressed_value = String((char *)uncompressed, length, AttachString); + uncompressed = NULL; + } + + epilogue: + if (!result) { + /* Free the uncompressed if it exists */ + if (uncompressed != NULL) { + free(uncompressed); + } + } + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +// transformation + +/** Converts a PHP value into a string, performing all the necessary + transformations. + + @param phpmcc - php mcc handle. + @param key - a pointer to the key. + @param object - the object to transform. + @param value - where to store the resulting object. + @param flags - flags indicating the transformations completed is + written to this address. + @param compress - if nonzero, compression is applied to the object. + @param proxy_replicate - if nonzero, the proxy-replicate flag is set. + @param async_set - if nonzero, the async-set flag is set. + additional php objects (zvals), the address of the + zvals is written to this address. the caller must + free it when it is done with the value pointer. + + @return 0 if no error occured, nonzero otherwise. +*/ +static int phpmcc_transform_value(MccResourcePtr &phpmcc, + CStrRef key, + CVarRef object, + String& value, + phpmcc_flags_t& flags, + const bool compress, + int64 proxy_replicate, + int64 async_set) { + String serialized, compressed; + + flags = (phpmcc_flags_t)0; + if (!object.isString()) { + if (!phpmcc_fb_serialize_value(phpmcc, key, flags, object, serialized) && + !phpmcc_php_serialize_value(phpmcc, key, flags, object, serialized)) { + return -1; + } + } else { + serialized = object.toString(); + } + + /* If compression fails or if result is greater than original, just send + the uncompressed original. */ + if (compress && phpmcc->m_compression_threshold != 0 && + (size_t)serialized.size() >= phpmcc->m_compression_threshold) { + + if (!phpmcc_zlib_compress_value(phpmcc, flags, serialized, compressed) || + serialized.size() <= compressed.size()) { + flags = (phpmcc_flags_t) + (flags & ~(phpmcc_compressed | phpmcc_nzlib_compressed)); + } else { + serialized = compressed; + } + } + + value = serialized; + + if (async_set) { + flags = (phpmcc_flags_t)(flags | phpmcc_async_set); + } + if (proxy_replicate) { + flags = (phpmcc_flags_t)(flags | phpmcc_proxy_replicate); + } + return 0; +} + +static inline uint32 phpmcc_transform_values(MccResourcePtr &phpmcc, + CArrRef input, + Array& result, + phpmcc_flags_t*& ret_flagss, + bool compress, + int64 proxy_replicate, + int64 async_set) { + phpmcc_flags_t* flagss = NULL; + size_t count = input.size(); + uint32 ix = 0; + + if ((flagss = + (phpmcc_flags_t*) malloc(sizeof(phpmcc_flags_t) * count)) == NULL) { + return 0; + } + + for (ArrayIter it = input.begin(); !it.end(); ++it) { + CVarRef key = it.first(); + if (!key.isString()) continue; + Variant value = it.second(); + // now examine the value. + if (value.isNull()) { + // no value? + continue; + } + String res; + if (phpmcc_transform_value(phpmcc, key.toString(), value, res, flagss[ix], + compress, proxy_replicate, async_set) != 0) { + /* error has occured */ + continue; + } + result.set(key, res); + + ix++; + } + ret_flagss = flagss; + return ix; +} + +/////////////////////////////////////////////////////////////////////////////// +// servers + +static Array get_accesspoints(mcc_handle_t mcc, const nstring_t* server) { + size_t naccesspoint; + const nstring_t* accesspoints = + mcc_server_get_accesspoints(mcc, server, &naccesspoint); + + Array aplist; + if (accesspoints != NULL) { + for (uint aix = 0; aix < naccesspoint; aix++) { + aplist.append(String(accesspoints[aix].str, accesspoints[aix].len, + CopyString)); + } + mcc_server_free_accesspoint_list(mcc, accesspoints, naccesspoint); + } + return aplist; +} + +static Array get_serverpool_servers(mcc_handle_t mcc, + const nstring_t* serverpool, + bool is_mirror) { + size_t nserver; + const nstring_t* servers = + mcc_serverpool_get_servers(mcc, serverpool, &nserver); + + Array slist = Array::Create(); + if (servers != NULL) { + for (uint six = 0; six < nserver; six++) { + Variant aplist = get_accesspoints(mcc, &servers[six]); + if (is_mirror && aplist.isNull()) { + continue; + } + slist.set(String(servers[six].str, servers[six].len, CopyString), + aplist); + } + mcc_serverpool_free_server_list(mcc, servers, nserver); + } + return slist; +} + +static Array get_serverpools(mcc_handle_t mcc, bool is_mirror) { + size_t nserverpool; + const nstring_t* serverpools = mcc_get_serverpools(mcc, &nserverpool); + + Array splist; + if (serverpools != NULL) { + for (uint spix = 0; spix < nserverpool; spix++) { + Array slist = get_serverpool_servers(mcc, &serverpools[spix], is_mirror); + splist.set(String(serverpools[spix].str, serverpools[spix].len, + CopyString), slist); + } + mcc_free_serverpool_list(mcc, serverpools, nserverpool); + } + return splist; +} + +static Array get_mirror_cfg(MccResourcePtr &phpmcc) { + Array mlist = Array::Create(); + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + Array mirror_cfg; + mirror_cfg.set(PHPMCC_ARG_MIRROR_CFG_NAME, String((*mirror)->m_name)); + mirror_cfg.set(PHPMCC_ARG_MIRROR_CFG_MODEL, (*mirror)->m_model); + Variant serverpools; + if (!(serverpools = get_serverpools((*mirror)->m_mcc, 1)).isNull()) { + mirror_cfg.set(PHPMCC_ARG_MIRROR_CFG_SERVERPOOLS, serverpools); + } + mlist.append(mirror_cfg); + } + return mlist; +} + +/* XXX revert to bool once support for libch 2.0.0 is dropped. */ +/** + * Presently, the consistent hashing prefixes array stores a flag corresponding + * to the last digit of the port on which the corresponding memcached instance + * is running. This flag is decoded as: + * 0: inconsistent hashing + * 1: consistent hashing v2 + * 2: consistent hashing v3 + */ +static Array get_consistent_hashing_prefixes(MccResourcePtr &phpmcc) { + size_t nserverpool; + const nstring_t* serverpools = + mcc_get_serverpools(phpmcc->m_mcc, &nserverpool); + + Array splist = Array::Create(); + if (serverpools != NULL) { + for (uint spix = 0; spix < nserverpool; spix++) { + const nstring_t* const pool_name = &serverpools[spix]; + uint8_t version = mcc_serverpool_get_consistent_hashing_version + (phpmcc->m_mcc, pool_name); + if (version != 0) { + /* Translates from version to version flag. */ + splist.set(String(serverpools[spix].str, serverpools[spix].len, + CopyString), (int64)(version - 1)); + } + } + mcc_free_serverpool_list(phpmcc->m_mcc, serverpools, nserverpool); + } + return splist; +} + +static int64 phpmcc_addremove_server_helper(MccResourcePtr &phpmcc, + CStrRef server, + CStrRef mirrorname, + bool is_add) { + nstring_t nserver; + phpstring_to_nstring(nserver, server); + + int64 retval; + if (is_add) { + retval = (long) mcc_add_server(phpmcc->m_mcc, &nserver); + if (retval != 0) { + phpmcc->m_server_count ++; + } + } else { + retval = mcc_remove_server(phpmcc->m_mcc, &nserver); + if (retval == 0) { + phpmcc->m_server_count --; + } + } + + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + if (is_add) { + mcc_add_server((*mirror)->m_mcc, &nserver); + } else { + mcc_remove_server((*mirror)->m_mcc, &nserver); + } + } + + return retval; +} + +static int64 phpmcc_add_mirror_helper(MccResourcePtr &phpmcc, + CStrRef mirrorname, + MccMirrorMcc::ConsistencyModel model) { + if (phpmcc->m_serverpool_count != 0) { + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_MIRROR_EXISTS, + __FILE__, __LINE__, + "cannot add mirror when serverpools exist."); + return -1; + } + + if (phpmcc->m_server_count != 0) { + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_MIRROR_EXISTS, + __FILE__, __LINE__, + "cannot add mirror when servers exist."); + return -1; + } + + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + if ((*mirror)->m_name == mirrorname.data()) { + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_MIRROR_EXISTS, + __FILE__, __LINE__, + "attempted to add mirror %.*s that already exists", + mirrorname.size(), mirrorname.data()); + return -2; + } + } + MccMirrorMcc* mirr = new MccMirrorMcc(mirrorname, model, phpmcc); + if (!mirr || mirr->m_mcc == NULL) { + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_MIRROR_CREATE, + __FILE__, __LINE__, + "failed to create mirror mcc object"); + if (mirr && mirr->m_mcc == NULL) { + delete mirr; + } + return 3; + } + + phpmcc->m_mirror_mccs.push_back(mirr); + return 0; +} + +static int64 phpmcc_remove_mirror_helper(MccResourcePtr &phpmcc, + CStrRef mirrorname) { + MirrorIt mirror; + for (mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + if ((*mirror)->m_name == mirrorname.data()) { + break; + } + } + + if (mirror != phpmcc->m_mirror_mccs.end()) { + /* clean up mirror */ + MccMirrorMcc* mirr = *mirror; + phpmcc->m_mirror_mccs.erase(mirror); + delete mirr; + return 0; + } else { + /* trying to remove a mirror that doesn't exist! */ + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_MIRROR_NOT_FOUND, + __FILE__, __LINE__, + "attempted to remove mirror %.*s that doesn't exist", + mirrorname.size(), mirrorname.data()); + return 1; + } +} + +static int64 +phpmcc_addremove_mirror_accesspoint_helper(MccResourcePtr &phpmcc, + CStrRef mirrorname, + CStrRef server, + CStrRef host, + CStrRef port, + int32 protocol, + bool is_add) { + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + if ((*mirror)->m_name == mirrorname.data()) { + nstring_t nhost, nserver, nport; + phpstring_to_nstring(nhost, host); + phpstring_to_nstring(nserver, server); + phpstring_to_nstring(nport, port); + if (is_add) { + return (long) mcc_add_accesspoint((*mirror)->m_mcc, &nserver, + &nhost, &nport, + protocol, + MCC_ASCII_PROTOCOL); + } else { + mcc_remove_accesspoint((*mirror)->m_mcc, &nserver, + &nhost, &nport, + protocol, + MCC_ASCII_PROTOCOL); + return 1; + } + } + } + + // mirror not found. + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_MIRROR_NOT_FOUND, + __FILE__, __LINE__, + "failed to find mirror %s", mirrorname.data()); + + return 0; +} + +static int64 phpmcc_add_serverpool_helper(MccResourcePtr &phpmcc, + CStrRef sp_name, + int64 consistent_hashing_enabled, + int64 consistent_hashing_version) { + mcc_sphandle_t sp_handle; + nstring_t nsp; + phpstring_to_nstring(nsp, sp_name); + sp_handle = mcc_add_serverpool(phpmcc->m_mcc, &nsp, + consistent_hashing_enabled, + consistent_hashing_version); + if (sp_handle != NULL) { + phpmcc->m_serverpool_count ++; + + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_handle_t mcch = (*mirror)->m_mcc; + mcc_sphandle_t mirror_sp_handle; + mirror_sp_handle = mcc_add_serverpool(mcch, &nsp, + consistent_hashing_enabled, + consistent_hashing_version); + ASSERT(mirror_sp_handle != NULL); + } + } + + return (long) sp_handle; +} + +static void phpmcc_remove_serverpool_helper(MccResourcePtr &phpmcc, + CStrRef sp_name) { + nstring_t nsp; + phpstring_to_nstring(nsp, sp_name); + if (mcc_remove_serverpool(phpmcc->m_mcc, &nsp) == 0) { + ASSERT(phpmcc->m_serverpool_count > 0); + phpmcc->m_serverpool_count--; + + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + int retval; + retval = mcc_remove_serverpool((*mirror)->m_mcc, &nsp); + ASSERT(retval == 0); + } + } +} + +static int64 +phpmcc_serverpool_addremove_server_helper(MccResourcePtr &phpmcc, + CStrRef sp_name, + CStrRef server_name, + CStrRef mirrorname, + int is_add) { + int64 retval; + typedef int (*add_remove_funcptr_t) (mcc_handle_t mcc, + const nstring_t* serverpool, + const nstring_t* server); + + add_remove_funcptr_t op; + + /* adding or removing? */ + if (is_add) { + op = mcc_serverpool_add_server; + } else { + op = mcc_serverpool_remove_server; + } + nstring_t nsp, nsn; + phpstring_to_nstring(nsp, sp_name); + phpstring_to_nstring(nsn, server_name); + retval = op(phpmcc->m_mcc, &nsp, &nsn); + if (retval) { + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + int retval; + retval = op((*mirror)->m_mcc, &nsp, &nsn); + ASSERT(retval); + } + } + return retval; +} + +static void phpmcc_apevent_dispatcher(MccResourcePtr &phpmcc) { + ApEventIt event; + ListenerIt listener; + + for (event = phpmcc->m_events.begin(); + event != phpmcc->m_events.end(); ++event) { + Array params; + params.append(null); + params.append(String(event->m_server)); + params.append(String(event->m_host)); + params.append(String(event->m_port)); + params.append(event->m_protocol); + params.append(event->m_presentation_protocol); + params.append(event->m_id); + + Array se_params; + se_params.append(null); + ostringstream ss; + ss << event->m_server << "[" << + (event->m_protocol == IPPROTO_TCP ? "tcp" : "udp") << ":" << + event->m_host << ":" << event->m_port << "]"; + se_params.append(String(ss.str().c_str(), CopyString)); + params.append(event->m_id == MCC_AP_UP ? MCC_SERVER_UP : MCC_SERVER_DOWN); + + for (listener = phpmcc->m_ap_listeners.begin(); + listener != phpmcc->m_ap_listeners.end(); ++listener) { + CStrRef function = (*listener)->m_function; + Variant & con = (*listener)->m_context; + params.set(0, ref(con)); + if (f_function_exists(function)) { + f_call_user_func_array(function, params); + } else { + Logger::Warning("[php_mcc] in %s on line %d accesspoint listener " + "call back failed for %s %p", __FILE__, __LINE__, + (*listener)->m_function.data(), + &(*listener)->m_context); + } + } + + for (listener = phpmcc->m_server_listeners.begin(); + listener != phpmcc->m_server_listeners.end(); ++listener) { + CStrRef function = (*listener)->m_function; + Variant & con = (*listener)->m_context; + se_params.set(0, ref(con)); + if (f_function_exists(function)) { + f_call_user_func_array(function, se_params); + } else { + Logger::Warning("[php_mcc] in %s on line %d server listener call back " + "failed for %s %p", __FILE__, __LINE__, + (*listener)->m_function.data(), + &(*listener)->m_context); + } + } + } + phpmcc->m_events.clear(); +} + +/////////////////////////////////////////////////////////////////////////////// +// listeners + +static bool same_context(CVarRef context1, CVarRef context2) { + if (context1.isArray() && context2.isArray()) { + return (context1.getArrayData() == context2.getArrayData()); + } + if (context1.isObject() && context2.isObject()) { + return (context1.getObjectData() == context2.getObjectData()); + } + if (context1.getType() == KindOfString && + context2.getType() == KindOfString) { + return (context1.getStringData() == context2.getStringData()); + } + return (context1.same(context2)); +} + +static bool zim_phpmcc_add_listener(MccResourcePtr &phpmcc, + CStrRef function, + CVarRef context, + MccListener::ListenerType type) { + if (!phpmcc.get()) { + return false; + } + + ListenerIt listener; + deque* listeners = + type == MccListener::AccessPointListener ? &phpmcc->m_ap_listeners : + type == MccListener::ServerListener ? &phpmcc->m_server_listeners : + &phpmcc->m_error_listeners; + for (listener = listeners->begin(); listener != listeners->end(); + ++listener) { + if (same_context(context, (*listener)->m_context)) { + Logger::Warning("[php_mcc] in %s on line %d " + "server listener %p already exists", + __FILE__, __LINE__, &context); + return false; + } + } + + MccListener* list = new MccListener(type, function, context); + if (!list) return false; + listeners->push_back(list); + return true; +} + +static bool zim_phpmcc_remove_listener(MccResourcePtr &phpmcc, + CStrRef function, + CVarRef context, + MccListener::ListenerType type) { + if (!phpmcc.get()) { + return false; + } + + ListenerIt listener; + bool found = false; + + deque* listeners = + type == MccListener::AccessPointListener ? &phpmcc->m_ap_listeners : + type == MccListener::ServerListener ? &phpmcc->m_server_listeners : + &phpmcc->m_error_listeners; + for (listener = listeners->begin(); listener != listeners->end(); + ++listener) { + if (same_context(context, (*listener)->m_context)) { + found = true; + break; + } + } + + if (found) { + MccListener* l = *listener; + listeners->erase(listener); + delete l; + return true; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// updates + +static Variant phpmcc_update(MccResourcePtr &phpmcc, + CStrRef key, + CVarRef object, + int64 exptime, + bool compress, + int64 proxy_replicate, + int64 async_set, + mcc_cmdtype_t cmd) { + String value; + phpmcc_flags_t flags = (phpmcc_flags_t)0; + mcc_res_t result = mcc_res_local_error; + mcc_req_t* req = NULL; + typedef mcc_req_t* (*update_funcptr_t) (mcc_handle_t, const nstring_t* const, + const uint32_t, const uint32_t, + const nstring_t* const, + const size_t); + update_funcptr_t update_op; + + if (phpmcc_transform_value(phpmcc, key, object, value, flags, + compress, proxy_replicate, async_set) == 0) { + if (RuntimeOption::MemcacheReadOnly) { + return true; + } + /* get the function pointer for the command type so we don't have to keep + * on switching on cmd. this is in theory taken care of by CSE, but we'll + * do it also for readability. */ + bool ok = true; + switch (cmd) { + case mcc_set_cmd: + update_op = mcc_set; + break; + case mcc_add_cmd: + update_op = mcc_add; + break; + case mcc_replace_cmd: + update_op = mcc_replace; + break; + default: + result = mcc_res_local_error; + ASSERT(0); + ok = false; + } + if (ok) { + /* make the request on the primary. */ + nstring_t nvalue, nkey; + phpstring_to_nstring(nvalue, value); + phpstring_to_nstring(nkey, key); + req = update_op(phpmcc->m_mcc, &nkey, flags, exptime, &nvalue, 1); + /* propagation to mirrors for update might be handled by mcproxy. if a + * update proxy has not been set, then propagate it ourselves. */ + if ((phpmcc->m_proxy_ops & mcc_proxy_update_op) == 0) { + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_req_t* mirror_req = + update_op((*mirror)->m_mcc, &nkey, flags, exptime, &nvalue, 1); + if (mirror_req != NULL) { + mcc_req_del(mirror_req); + } + mcc_clear_err(phpmcc->m_mcc, NULL); + } + } + + if (req != NULL) { + result = req->result; + mcc_req_del(req); + } + } + } + + Variant retval; + if (result == mcc_res_stored) { + retval = true; + } else if (result == mcc_res_notstored) { + retval = false; + } else { + mcc_log_if_error(phpmcc); + retval = null; + } + if (phpmcc->m_events.size() > 0) { + phpmcc_apevent_dispatcher(phpmcc); + } + return retval; +} + +/* todo work out these optional args */ +static Variant zim_phpmcc_update(MccResourcePtr &phpmcc, + CVarRef phpkey, + CVarRef value, + int64 exptime /* = 0 */, + bool compress /* = 1 */, + int64 proxy_replicate /* = 0 */, + int64 async_set /* = 0 */, + mcc_cmdtype_t cmd) { + if (!phpmcc.get()) { + return null; + } + + if (!phpkey.isString()) { + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_MISSINGS_REQS, + __FILE__, __LINE__, "key must be a string"); + return null; + } + + return phpmcc_update(phpmcc, phpkey.toString(), value, + exptime, compress, proxy_replicate, async_set, cmd); +} + +static Variant phpmcc_multi_update(MccResourcePtr &phpmcc, + mcc_cmdtype_t cmd, CArrRef keys_values, + uint32_t exptime, bool compress, + int64 proxy_replicate, int64 async_set) { + nstring_t* keys = NULL, * values = NULL; + phpmcc_flags_t* flagss = NULL; + unsigned npairs; + mcc_req_t* reqs, * current; + int log_errors = 0; + + Array transformed; + if (!phpmcc_transform_values(phpmcc, keys_values, transformed, flagss, + compress, proxy_replicate, async_set)) { + return null; + } + ASSERT(flagss); + + if ((npairs = nstring_dict_new(phpmcc, transformed, keys, values)) == 0) { + return null; + } + + current = reqs = mcc_update_generic + (phpmcc->m_mcc, cmd, keys, (uint32_t*)flagss, + &exptime, values, npairs, 1 /* unique flags */, + 0 /* shared expiration times */); + Array retval; + while (current != NULL) { + nstring_t* key = ¤t->u.getreq.key; + Variant phpvalue; + + if (current->result == mcc_res_stored) { + phpvalue = true; + } else if (current->result == mcc_res_notstored) { + phpvalue = false; + } else { + log_errors = 1; + phpvalue = null; + } + retval.set(String(key->str, key->len, CopyString), phpvalue); + + current = current->item.tqe_next; + } + + if (reqs != NULL) { + mcc_req_del(reqs); + } + + /* propagation to mirrors for update might be handled by mcproxy. if a + * update proxy has not been set, then propagate it ourselves. */ + if ((phpmcc->m_proxy_ops & mcc_proxy_update_op) == 0) { + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_req_t* mirror_reqs = + mcc_update_generic((*mirror)->m_mcc, cmd, keys, (uint32_t*)flagss, + &exptime, values, npairs, + 1 /* unique flags */, + 0 /* shared expiration times */); + + if (mirror_reqs != NULL) { + mcc_req_del(mirror_reqs); + } + mcc_clear_err(phpmcc->m_mcc, NULL); + } + } + + if (keys != NULL) { + nstring_array_del(keys); + } + if (values != NULL) { + nstring_array_del(values); + } + if (flagss != NULL) { + free(flagss); + } + if (log_errors == 1) { + mcc_log_if_error(phpmcc); + } + + /* If we didn't get any results, check for errors */ + if (phpmcc->m_events.size() > 0) { + phpmcc_apevent_dispatcher(phpmcc); + } + return retval; +} + +static Variant zim_phpmcc_multi_update(MccResourcePtr &phpmcc, + CArrRef keys_values, + int64 exptime /* = 0 */, + int64 compress /* = 1 */, + int64 proxy_replicate /* = 0 */, + int64 async_set /* = 0 */, + mcc_cmdtype_t cmd) { + if (!phpmcc.get()) { + return null; + } + return phpmcc_multi_update(phpmcc, cmd, keys_values, exptime, + compress, proxy_replicate, async_set); +} + +static Variant zim_phpmcc_arith_update(MccResourcePtr &phpmcc, + CStrRef key, + int64 value /* = 1 */, + mcc_cmdtype_t cmd) { + if (!phpmcc.get()) { + return null; + } + + Variant retval; + int64 result = 0; + mcc_res_t status; + typedef uint32_t (*arith_funcptr_t) (mcc_handle_t, const nstring_t* const, + const int, mcc_res_t*); + arith_funcptr_t op; + + switch(cmd) { + case mcc_incr_cmd: + op = mcc_incr_ex; + break; + case mcc_decr_cmd: + op = mcc_decr_ex; + break; + default: + ASSERT(0); + return 0; + } + nstring_t nkey; + phpstring_to_nstring(nkey, key); + result = op(phpmcc->m_mcc, &nkey, value, &status); + + if (status != mcc_res_stored) { + mcc_log_if_error(phpmcc); + retval = false; + } else { + retval = result; + } + + /* propagation to mirrors for increment/decrement might be handled by + * mcproxy. if a delete proxy has not been set, then propagate it + * ourselves. */ + if ((phpmcc->m_proxy_ops & mcc_proxy_arith_op) == 0) { + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + result = op((*mirror)->m_mcc, &nkey, value, &status); + } + } + + if (phpmcc->m_events.size() > 0) { + phpmcc_apevent_dispatcher(phpmcc); + } + return retval; +} + +static Variant phpmcc_delete(MccResourcePtr &phpmcc, CVarRef phpkeys, + int64 exptime, bool with_details) { + nstring_t* keys; + size_t nkeys; + if (nstring_array_new(keys, nkeys, phpkeys) == NULL) { + return null; + } + + mcc_req_t* reqs = mcc_delete(phpmcc->m_mcc, keys, nkeys, exptime); + mcc_req_t* current = reqs; + + Variant retval; + if (phpkeys.is(KindOfArray)) { + while (current != NULL) { + nstring_t* key = ¤t->u.getreq.key; + String skey(key->str, key->len, CopyString); + switch(current->result) { + case mcc_res_deleted: + case mcc_res_notfound: + if (with_details) { + retval.set(skey, (current->result == mcc_res_deleted) ? + PHPMCC_DELETE_DELETED : PHPMCC_DELETE_NOTFOUND); + } else { + retval.set(skey, current->result == mcc_res_deleted); + } + break; + case mcc_res_bad_key: + if (with_details) { + retval.set(skey, PHPMCC_DELETE_ERROR_NOLOG); + } else { + retval.set(skey, null); + } + break; + default: + if (with_details) { + retval.set(skey, PHPMCC_DELETE_ERROR_LOG); + } else { + retval.set(skey, null); + } + break; + } + + current = current->item.tqe_next; + } + } else if (phpkeys.isString()) { + if (current != NULL) { + switch(current->result) { + case mcc_res_deleted: + case mcc_res_notfound: + if (with_details) { + retval = (current->result == mcc_res_deleted) ? + PHPMCC_DELETE_DELETED : PHPMCC_DELETE_NOTFOUND; + } else { + retval = current->result == mcc_res_deleted; + } + break; + case mcc_res_bad_key: + if (with_details) { + retval = PHPMCC_DELETE_ERROR_NOLOG; + } else { + retval = null; + } + break; + default: + Logger::Error("php_mcc: Failed to delete key %s with result %d", + phpkeys.toString().data(), (int)current->result); + if (with_details) { + retval = PHPMCC_DELETE_ERROR_LOG; + } else { + retval = null; + } + break; + } + } + } + + mcc_req_del(reqs); + + /* propagation to mirrors for delete might be handled by mcproxy. if a + * delete proxy has not been set, then propagate it ourselves. */ + if ((phpmcc->m_proxy_ops & mcc_proxy_delete_op) == 0) { + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + reqs = mcc_delete((*mirror)->m_mcc, keys, nkeys, exptime); + mcc_req_del(reqs); + } + } + + nstring_array_del(keys); + if (phpmcc->m_events.size() > 0) { + phpmcc_apevent_dispatcher(phpmcc); + } + return retval; +} + +/////////////////////////////////////////////////////////////////////////////// +// processors + +/* + phpmcc_get works with a callback setup. phpmcc_get(..) sets up the keys and + the callback context structure. Then it calls phpmcc_get_helper(..), which + retrieves the values from the primary group and the mirrors. Once it has + resolved the return values from the primary group and the mirrors, it + post-processes the values into php zvals and calls the callback functions. + + There are two callback functions currently defined. One handles multiget + requests, and places each zval into a dictionary. The other handles single + get requests, and places the zval into the return value. +*/ +static void +phpmcc_multiget_processor(const nstring_t search_key, + mcc_res_t result, CVarRef value, + phpmcc_get_processor_context_t* context) { + Variant& hashtable = *(context->results); + if (result == mcc_res_found) { + context->hits ++; + String skey(search_key.str, search_key.len, CopyString); + hashtable.set(skey, value); + } else if (mcc_res_is_err(result)) { + context->errors ++; + } +} + +static void +phpmcc_multiget_record_errors_processor(const nstring_t search_key, + mcc_res_t result, + CVarRef value, + phpmcc_get_processor_context_t* context) { + Variant& hashtable = *(context->results); + Variant& error_keys = *(context->additional_context); + String skey(search_key.str, search_key.len, CopyString); + if (result == mcc_res_found) { + context->hits ++; + if (!value.isNull()) { + hashtable.set(skey, value); + } + } else { + if (mcc_res_is_err(result)) { + error_keys.set(skey, true); + context->errors ++; + } + } +} + +static void phpmcc_get_processor(const nstring_t search_key, + mcc_res_t result, + CVarRef value, + phpmcc_get_processor_context_t* context) { + Variant& retval = *(context->results); + + if (result == mcc_res_found) { + context->hits ++; + if (!value.isNull()) { + retval = value; + return; + } + } + + if (mcc_res_is_err(result)) { + context->errors ++; + } + + retval = null; +} + +/////////////////////////////////////////////////////////////////////////////// +// results + +static void process_mirror_results(MccResourcePtr &phpmcc, + const nstring_t& key, + mcc_res_t* const result_ptr, + nstring_t* const value_ptr, + uint32_t* const flags_ptr, + MccMirrorMcc::ConsistencyModel model, + const mcc_req_t* mirror_result) { + switch (model) { + case MccMirrorMcc::CONSISTENCY_IGNORE: + return; + + case MccMirrorMcc::CONSISTENCY_MATCH_ALL: + /* check for a mismatch of return status (hit vs miss). then + * fallthrough and check the actual return values if they are both + * hits. */ + if (*result_ptr != mirror_result->result) { + /* the only case we permit the status to mismatch is + * mcc_res_local_error, because that's how libmcc signals that + * the server has no access points. this is unfortunately + * rather crude, as mcc_res_local_error is also returned when + * the server has access points but they are all down. */ + if (mirror_result->result == mcc_res_local_error) { + return; + } + + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_MIRROR_CONSISTENCY, + __FILE__, __LINE__, + "CONSISTENCY_MATCH_ALL result comparison failed " + "(key = \"%.*s\").", key.len, key.str); + *result_ptr = mcc_res_remote_error; + } + + if (*result_ptr != mcc_res_found) { + return; + } + break; + + case MccMirrorMcc::CONSISTENCY_MATCH_HITS: + /* if either is a miss, don't compare. */ + if (*result_ptr != mcc_res_found || + mirror_result->result != mcc_res_found) { + return; + } + break; + + case MccMirrorMcc::CONSISTENCY_MATCH_HITS_SUPERCEDES: + /* if we miss in the primary and hit in the mirror, replace the + * result with the mirror's result. immediately return because + * there's no need to do any checking. */ + if (*result_ptr != mcc_res_found && + mirror_result->result == mcc_res_found) { + *result_ptr = mcc_res_found; + *value_ptr = mirror_result->u.getreq.value; + *flags_ptr = mirror_result->u.getreq.flags; + return; + } + + /* if either is a miss, don't compare. */ + if (*result_ptr != mcc_res_found || + mirror_result->result != mcc_res_found) { + return; + } + break; + } + + /* both the primary and the mirror hit. compare the results. */ + ASSERT(*result_ptr == mcc_res_found); + ASSERT(mirror_result->result == mcc_res_found); + + if (*flags_ptr != mirror_result->u.getreq.flags || + nstring_cmp(value_ptr, &mirror_result->u.getreq.value) != 0) { + /* the results mismatched in some way, flag the error. */ + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_MIRROR_CONSISTENCY, + __FILE__, __LINE__, + "result comparison failed (key = \"%.*s\").", + key.len, key.str); + + /* squash the hit */ + *result_ptr = mcc_res_remote_error; + } +} + +/* given a key, and the result from the primary server, determine the final + * value to return to the client. this must take into account the mirrors and + * their results as well as deserializing and decompressing. */ +static mcc_res_t resolve_value(MccResourcePtr &phpmcc, + const nstring_t& key, mcc_res_t result, + nstring_t value, uint32 flags, + mcc_req_t* const * const mirror_reqs, + Variant& php_value) { + /* first, evaluate the mirrors. */ + int i = 0; + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_req_t* iterator = mirror_reqs[i]; + if (iterator == NULL) { + continue; + } + + ASSERT(nstring_cmp(&key, &iterator->u.getreq.key) == 0); + + /* found our key */ + process_mirror_results(phpmcc, key, &result, &value, &flags, + (*mirror)->m_model, iterator); + i++; + } + + if (result == mcc_res_found) { + int valid = 1; + const char *val = value.str; + int len = value.len; + String php_uncompressedvalue; + if (flags & (phpmcc_compressed | phpmcc_nzlib_compressed)) { + if ((valid = phpmcc_zlib_uncompress_value(phpmcc, flags, val, len, + php_uncompressedvalue))) { + val = php_uncompressedvalue.data(); + len = php_uncompressedvalue.size(); + } else { + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_UNCOMPRESS, + __FILE__, __LINE__, "failed to uncompress key %s", + key.str); + } + } + + if (valid) { + if (flags & (phpmcc_serialized | phpmcc_fb_serialized)) { + if (!(valid = phpmcc_unserialize_value(phpmcc, (phpmcc_flags_t)flags, + val, len, php_value))) { + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_UNSERIALIZE, + __FILE__, __LINE__, "failed to unserialize key %s", + key.str); + } + } else { + if (val == value.str) { + php_value = String(val, len, CopyString); + } else { + ASSERT(val == php_uncompressedvalue.data()); + php_value = php_uncompressedvalue; + } + } + } + + /* Only add value if we successful */ + if (!valid) { + php_value = null; + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_BAD_VALUE, + __FILE__, __LINE__, "invalid value for %s %u %u", + key.str, flags, len); + } + } + return result; +} + +/* phpmcc_get_helper retrieves the values from memcache.*/ +static int phpmcc_get_helper(MccResourcePtr &phpmcc, nstring_t* keys, + unsigned int nkeys, + phpmcc_get_processor_funcptr_t func, + phpmcc_get_processor_context_t* context) { + mcc_req_t** mirror_reqs = NULL, ** mirror_current = NULL; + mcc_req_t* reqs = NULL, * current; + unsigned int mirror_index; + unsigned int reqs_returned = 0; + + reqs = mcc_get(phpmcc->m_mcc, keys, nkeys); + size_t mirr_ct = phpmcc->m_mirror_mccs.size(); + /* propagate to mirrors */ + if (mirr_ct > 0) { + mirror_reqs = (mcc_req_t**)malloc(sizeof(mcc_req_t*) * mirr_ct * 2); + if (mirror_reqs == NULL) { + free(mirror_reqs); + return -1; + } + mirror_current = &mirror_reqs[mirr_ct]; + + mirror_index = 0; + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mirror_current[mirror_index] = mirror_reqs[mirror_index] = + mcc_get((*mirror)->m_mcc, keys, nkeys); + + mcc_clear_err((*mirror)->m_mcc, NULL); + mirror_index ++; + } + } + + for (current = reqs; current != NULL; current = TAILQ_NEXT(current, item), + reqs_returned ++) { + const nstring_t search_key = current->u.getreq.key; + mcc_res_t primary_result = current->result; + nstring_t primary_value = current->u.getreq.value; + uint32_t primary_flags = current->u.getreq.flags; + mcc_res_t final_result; + Variant result; + + for (mirror_index = 0; mirror_index < mirr_ct; mirror_index ++) { + for (mirror_current[mirror_index] = mirror_reqs[mirror_index]; + mirror_current[mirror_index] != NULL; + mirror_current[mirror_index] = + TAILQ_NEXT(mirror_current[mirror_index], item)) { + if (nstring_cmp(&search_key, + &(mirror_current[mirror_index]->u.getreq.key)) == 0) { + break; + } + } + } + + final_result = resolve_value(phpmcc, search_key, + primary_result, primary_value, primary_flags, + mirror_current, result); + func(search_key, final_result, result, context); + } + + if (reqs_returned != nkeys) { + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_MISSINGS_REQS, + __FILE__, __LINE__, + "executed gets on %d keys but only received %d reqs", + nkeys, reqs_returned); + } + + if (reqs != NULL) { + mcc_req_del(reqs); + } + + for (mirror_index = 0; mirror_index < mirr_ct; mirror_index ++) { + if (mirror_reqs[mirror_index] != NULL) { + mcc_req_del(mirror_reqs[mirror_index]); + } + } + if (mirror_reqs != NULL) { + free(mirror_reqs); + } + + return 0; +} + +static void phpmcc_get(MccResourcePtr &phpmcc, Variant& retval, + CVarRef phpkeys, + phpmcc_get_details_t detailed_info_mode, + Variant& detailed_info) { + nstring_t* keys = NULL; + size_t nkeys = 0; + + phpmcc_get_processor_context_t context; + phpmcc_get_processor_funcptr_t processor; + + if (nstring_array_new(keys, nkeys, phpkeys) == NULL) { + goto epilogue; + } + + context.hits = 0; + context.errors = 0; + if (phpkeys.is(KindOfArray)) { + retval = Array::Create(); + context.results = &retval; + + // check to see if we have what we need to proceed. if the arguments + // do not check out, revert to normal multiget. + switch (detailed_info_mode) { + case PHPMCC_GET_RECORD_ERRORS: + // if the variable is a null, then let's make it a value. + if (detailed_info.isNull()) { + detailed_info = Array::Create(); + } + + if (!detailed_info.is(KindOfArray)) { + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_DETAILED_BAD_ARG, + __FILE__, __LINE__, + "detailed info argument must be an array"); + detailed_info_mode = PHPMCC_GET_DEFAULT; + break; + } + break; + + case PHPMCC_GET_DEFAULT: + /* no special condition */ + break; + + default: + phpmcc_log(phpmcc, MCC_APP_ERROR, PHPMCC_ERR_DETAILED_BAD_ARG, + __FILE__, __LINE__, + "detailed info mode is unknown (%d)", detailed_info_mode); + detailed_info_mode = PHPMCC_GET_DEFAULT; + break; + } + + // if there was a problem with the arguments, we revert to a normal + // multiget. actually do the work here. + switch (detailed_info_mode) { + case PHPMCC_GET_RECORD_ERRORS: + processor = phpmcc_multiget_record_errors_processor; + context.additional_context = &detailed_info; + break; + + case PHPMCC_GET_DEFAULT: + default: + processor = phpmcc_multiget_processor; + context.additional_context = NULL; + break; + } + } else { + context.results = &retval; + processor = phpmcc_get_processor; + } + + if (phpmcc_get_helper(phpmcc, keys, nkeys, processor, &context) != 0) { + goto epilogue; + } + + epilogue: + if (keys != NULL) { + nstring_array_del(keys); + } + + /* If we didn't get any results, check for errors */ + if ((context.errors > 0) || (context.hits == 0 && nkeys != 0)) { + mcc_log_if_error(phpmcc); + } + + if (phpmcc->m_events.size() > 0) { + phpmcc_apevent_dispatcher(phpmcc); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// stats + +typedef struct stat_map_s { + const char* name; + size_t off; +} stat_map_t; + +static stat_map_t stat_map[] = { + {"ntx_msgs", offsetof(mcc_stats_t, ntx_msgs)}, + {"ntx_dgmsgs", offsetof(mcc_stats_t, ntx_dgmsgs)}, + {"ntx_errs", offsetof(mcc_stats_t, ntx_errs)}, + {"ntx_dgerrs", offsetof(mcc_stats_t, ntx_dgerrs)}, + {"ntx_dgtmos", offsetof(mcc_stats_t, ntx_dgtmos)}, + {"ntx_tmos", offsetof(mcc_stats_t, ntx_tmos)}, + + {"nrx_msgs", offsetof(mcc_stats_t, nrx_msgs)}, + {"nrx_dgmsgs", offsetof(mcc_stats_t, nrx_dgmsgs)}, + {"nrx_errs", offsetof(mcc_stats_t, nrx_errs)}, + {"nrx_dgerrs", offsetof(mcc_stats_t, nrx_dgerrs)}, + {"nrx_dgooos", offsetof(mcc_stats_t, nrx_dgooos)}, + {"nrx_dgtmos", offsetof(mcc_stats_t, nrx_dgtmos)}, + + {"nrx_tmos", offsetof(mcc_stats_t, nrx_tmos)}, + {"nrx_aborts", offsetof(mcc_stats_t, nrx_aborts)}, + + {"ntx_gets", offsetof(mcc_stats_t, ntx_gets)}, + {"nrx_hits", offsetof(mcc_stats_t, nrx_hits)}, + {"nrx_misses", offsetof(mcc_stats_t, nrx_misses)}, + + {"ntx_deletes", offsetof(mcc_stats_t, ntx_deletes)}, + {"nrx_deletes", offsetof(mcc_stats_t, nrx_deletes)}, + + {"ntx_adds", offsetof(mcc_stats_t, ntx_adds)}, + {"nrx_adds", offsetof(mcc_stats_t, nrx_adds)}, + + {"ntx_replaces", offsetof(mcc_stats_t, ntx_replaces)}, + {"nrx_replaces", offsetof(mcc_stats_t, nrx_replaces)}, + + {"ntx_sets", offsetof(mcc_stats_t, ntx_sets)}, + {"nrx_sets", offsetof(mcc_stats_t, nrx_sets)}, + + {"ntx_decrs", offsetof(mcc_stats_t, ntx_decrs)}, + {"nrx_decrs", offsetof(mcc_stats_t, nrx_decrs)}, + + {"ntx_incrs", offsetof(mcc_stats_t, ntx_incrs)}, + {"nrx_incrs", offsetof(mcc_stats_t, nrx_incrs)}, + + {"nrx_nostores", offsetof(mcc_stats_t, nrx_nostores)}, + + {"nrx_notfounds", offsetof(mcc_stats_t, nrx_notfounds)}, + + {"nrx_failures", offsetof(mcc_stats_t, nrx_failures)}, + + {"ntx_flushalls", offsetof(mcc_stats_t, ntx_flushalls)}, + {"nrx_flushalls", offsetof(mcc_stats_t, nrx_flushalls)}, + + {"nopens", offsetof(mcc_stats_t, nopens)}, + {"ncloses", offsetof(mcc_stats_t, ncloses)}, + {"nconn_tmos", offsetof(mcc_stats_t, nconn_tmos)}, + {"nconn_errs", offsetof(mcc_stats_t, nconn_errs)}, + + {"rtt", offsetof(mcc_stats_t, rtt)}, + + {"nsys_errs", offsetof(mcc_stats_t, nsys_errs)}, + {"napp_errs", offsetof(mcc_stats_t, napp_errs)}, + {"nremote_errs", offsetof(mcc_stats_t, nremote_errs)}, + {"nunknown_errs", offsetof(mcc_stats_t, nunknown_errs)}, +}; + +static Array phpmcc_stats(MccResourcePtr &phpmcc, int clear) { + mcc_stats_t stats; + mcc_get_stats(phpmcc->m_mcc, &stats, clear); + + char* sp = (char*)&stats; + Array retval; + for (uint ix = 0; ix < sizeof(stat_map)/sizeof(stat_map_t); ix++) { + retval.set(String(stat_map[ix].name, AttachLiteral), + (int64)(*((size_t*)(sp+stat_map[ix].off)))); + } + return retval; +} + +/////////////////////////////////////////////////////////////////////////////// +// MccMirrorMcc + +MccMirrorMcc::MccMirrorMcc(CStrRef name, ConsistencyModel model, + MccResourcePtr &phpmcc) + : m_name(name.data(), name.size()), m_model(model) { + nstring_t nname; + phpstring_to_nstring(nname, m_name); + m_mcc = mcc_new_ex(&nname, + mcc_get_npoolprefix(phpmcc->m_mcc), + phpmcc->m_mtu, + phpmcc->m_rxdgram_max, + phpmcc->m_nodelay, + mcc_get_conn_tmo(phpmcc->m_mcc), + mcc_get_conn_ntries(phpmcc->m_mcc), + mcc_get_tmo(phpmcc->m_mcc), + mcc_get_dgram_ntries(phpmcc->m_mcc), + mcc_get_dgram_tmo_weight(phpmcc->m_mcc), + mcc_get_window_max(phpmcc->m_mcc), + mcc_get_server_retry_tmo(phpmcc->m_mcc), + mcc_get_dgram_tmo_threshold(phpmcc->m_mcc)); +} + +MccMirrorMcc::~MccMirrorMcc() { + if (m_mcc) { + mcc_del(m_mcc); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// MccResource + +MccResourcePtr MccResource::GetPersistent(CStrRef name) { + ResourceData *mcc = g_persistentObjects->get("php_mcc::resources", + name.data()); + if (mcc) { + s_mcc_extension->registerPersistentObject(name.data()); + return MccResourcePtr(dynamic_cast(mcc)); + } + return MccResourcePtr(); +} + +MccResource::MccResource(CStrRef name, bool persistent, int64 mtu, + int64 rxdgram_max, int64 nodelay) + : m_name(name.data(), name.size()), m_persistent(persistent), m_mcc(NULL), + m_compressed(0), m_nreqs(0), + m_mtu(mtu), m_rxdgram_max(rxdgram_max), m_nodelay(nodelay), + m_server_count(0), m_serverpool_count(0), m_handle_status(PHPMCC_NEW_HANDLE), + m_fast_path_eligible(true), m_sitevar_version(0), m_proxy_ops(0) { + struct timeval creation_time; + if (gettimeofday(&creation_time, NULL) == 0){ + m_creation_time = creation_time.tv_sec; + } else { + m_creation_time = 0; + } + if (persistent) { + g_persistentObjects->set("php_mcc::resources", name.c_str(), this); + s_mcc_extension->registerPersistentObject(m_name); + } + m_zlib_compression_enabled = 1; + m_nzlib_compression = 0; + m_compression_threshold = PHPMCC_COMPRESSION_THRESHOLD_DEFAULT; + + m_fb_serialize_enabled = true; + m_fb_serialize_available = true; +} + +static void phpmcc_accesspoint_listener(void* context, + const nstring_t* server, + const nstring_t* host, + const nstring_t* port, + const int protocol, + const mcc_presentation_protocol_t pres, + const mcc_apstate_t event_id) { + MccResource* resource = (MccResource*)context; + MccApEvent event(string(server->str, server->len), + string(host->str, host->len), + string(port->str, port->len), protocol, pres, event_id); + resource->m_events.push_back(event); +} + +bool MccResource::init_mcc(int64 npoolprefix, int64 conn_tmo, + int64 conn_ntries, int64 tmo, int64 dgram_ntries, + double dgram_tmo_weight, int64 window_max, + int64 server_retry_tmo, int64 dgram_tmo_threshold) { + nstring_t nname; + phpstring_to_nstring(nname, m_name); + m_mcc = mcc_new_ex(&nname, npoolprefix, m_mtu, m_rxdgram_max, m_nodelay, + conn_tmo, conn_ntries, tmo, dgram_ntries, + dgram_tmo_weight, window_max, server_retry_tmo, + dgram_tmo_threshold); + if (!m_mcc) return false; + mcc_add_accesspoint_listener(m_mcc, phpmcc_accesspoint_listener, this); + return true; +} + +MccResource::~MccResource() { + for (MirrorIt mirror = m_mirror_mccs.begin(); + mirror != m_mirror_mccs.end(); ++mirror) { + delete *mirror; + } + removeListeners(); + if (m_mcc) mcc_del(m_mcc); +} + +void MccResource::sweep() { + for (ListenerIt listener = m_error_listeners.begin(); + listener != m_error_listeners.end(); ++listener) { + (*listener)->onSweep(); + } + for (ListenerIt listener = m_server_listeners.begin(); + listener != m_server_listeners.end(); ++listener) { + (*listener)->onSweep(); + } + for (ListenerIt listener = m_ap_listeners.begin(); + listener != m_ap_listeners.end(); ++listener) { + (*listener)->onSweep(); + } + delete this; +} + +void MccResource::removeListeners() { + for (ListenerIt listener = m_error_listeners.begin(); + listener != m_error_listeners.end(); ++listener) { + delete *listener; + } + for (ListenerIt listener = m_server_listeners.begin(); + listener != m_server_listeners.end(); ++listener) { + delete *listener; + } + for (ListenerIt listener = m_ap_listeners.begin(); + listener != m_ap_listeners.end(); ++listener) { + delete *listener; + } + m_error_listeners.clear(); + m_server_listeners.clear(); + m_ap_listeners.clear(); +} + +bool MccResource::close() { + if (m_persistent) { + g_persistentObjects->remove("php_mcc::resources", m_name.c_str()); + return true; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// properties + +static void phpmcc_get_compression_threshold(MccResourcePtr &phpmcc, + Variant& retval) { + retval = (int64)phpmcc->m_compression_threshold; +} + +static void phpmcc_set_compression_threshold(MccResourcePtr &phpmcc, + CVarRef value) { + if (value.isInteger()) { + phpmcc->m_compression_threshold = (size_t)value.toInt64(); + } else if (value.is(KindOfBoolean)) { + phpmcc->m_compression_threshold = value ? 1 : 0; + } +} + +static void phpmcc_get_nzlib_compression(MccResourcePtr &phpmcc, + Variant& retval) { + retval = (int64)phpmcc->m_nzlib_compression; +} + +static void phpmcc_set_nzlib_compression(MccResourcePtr &phpmcc, + CVarRef value) { + if (value.isInteger()) { + phpmcc->m_nzlib_compression = value; + } else if (value.is(KindOfBoolean)) { + phpmcc->m_nzlib_compression = value.toBoolean() ? 1 : 0 ; + } +} + +static void phpmcc_get_conn_tmo(MccResourcePtr &phpmcc, Variant& retval) { + retval = (int64)mcc_get_conn_tmo(phpmcc->m_mcc); +} + +static void phpmcc_set_conn_tmo(MccResourcePtr &phpmcc, CVarRef value) { + if (value.isInteger()) { + int64 tmo = value; + + mcc_set_conn_tmo(phpmcc->m_mcc, tmo); + + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_set_conn_tmo((*mirror)->m_mcc, tmo); + } + } +} + +static void phpmcc_get_conn_ntries(MccResourcePtr &phpmcc, Variant& retval) { + retval = (int64)mcc_get_conn_ntries(phpmcc->m_mcc); +} + +static void phpmcc_set_conn_ntries(MccResourcePtr &phpmcc, CVarRef value) { + if (value.isInteger()) { + int64 ntries = value; + + mcc_set_conn_ntries(phpmcc->m_mcc, ntries); + + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_set_conn_ntries((*mirror)->m_mcc, ntries); + } + } +} + +#if defined(HAVE_DEBUG_LOG) +static void phpmcc_get_debug(MccResourcePtr &phpmcc, Variant& retval) { + retval = mcc_get_debug(phpmcc->m_mcc)); +} + +static void phpmcc_set_debug(MccResourcePtr &phpmcc, CVarRef value) { + if (value.isInteger()) { + mcc_set_debug(phpmcc->m_mcc, value); + } +} + +static void phpmcc_get_debug_logfile(MccResourcePtr &phpmcc, Variant& retval) { + const nstring_t* result = mcc_get_debug_logfile(phpmcc->m_mcc); + if (result != NULL) { + retval = String(result->str, result->len, CopyString); + } else { + retval = null; + } +} + +static void phpmcc_set_debug_logfile(MccResourcePtr &phpmcc, CVarRef value) { + nstring_t svalue; + phpstring_to_nstring(svalue, value); + mcc_set_debug_logfile(phpmcc->m_mcc, &svalue); +} +#endif /* defined(HAVE_DEBUG_LOG) */ + +static void phpmcc_get_delproxy(MccResourcePtr &phpmcc, Variant& retval) { + const nstring_t* proxy; + if ((proxy = mcc_get_delproxy(phpmcc->m_mcc)) == NULL) { + retval = null; + } else { + Variant accesspoints; + String prox(proxy->str, proxy->len, CopyString); + accesspoints = get_accesspoints(phpmcc->m_mcc, + proxy); + if (!accesspoints.isNull()) { + retval.set(prox, accesspoints); + } else { + retval.set(prox, null); + } + } +} + +static void phpmcc_set_delproxy(MccResourcePtr &phpmcc, CVarRef value) { + nstring_t host; + nstring_t default_port = + NSTRING_CONST(const_cast("PHPMCC_PROXY_PORT_DEFAULT")); + nstring_t port; + + phpstring_to_nstring(host, value.toString()); + + port.len = 0; + port.str = (char*)memchr(host.str, ':', host.len); + + if (port.str != NULL) { + port.str++; + port.len = host.str + host.len - port.str; + host.len-= port.len + 1; + } + if (port.len == 0) { + port = default_port; + } + if (mcc_set_delproxy(phpmcc->m_mcc, &host, &port) != NULL) { + phpmcc->m_proxy_ops = mcc_get_proxy_ops(phpmcc->m_mcc); + } else { + phpmcc->m_proxy_ops = 0; + } +} + +static void phpmcc_get_default_serverpool(MccResourcePtr &phpmcc, + Variant& retval) { + const nstring_t* name = mcc_get_default_serverpool(phpmcc->m_mcc); + if (name != NULL) { + retval = String(name->str, name->len, CopyString); + } else { + retval = null; + } +} + +static void phpmcc_set_default_serverpool(MccResourcePtr &phpmcc, + CVarRef value) { + nstring_t name; + phpstring_to_nstring(name, value); + + mcc_set_default_serverpool(phpmcc->m_mcc, &name); + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_set_default_serverpool((*mirror)->m_mcc, &name); + } +} + +static void phpmcc_get_dgram_ntries(MccResourcePtr &phpmcc, Variant& retval) { + retval = (int64)mcc_get_dgram_ntries(phpmcc->m_mcc); +} + +static void phpmcc_set_dgram_ntries(MccResourcePtr &phpmcc, CVarRef value) { + if (value.isInteger()) { + int64 ntries = value; + + mcc_set_dgram_ntries(phpmcc->m_mcc, ntries); + + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_set_dgram_ntries((*mirror)->m_mcc, ntries); + } + } +} + +static void phpmcc_get_dgram_tmo_weight(MccResourcePtr &phpmcc, + Variant& retval) { + retval = mcc_get_dgram_tmo_weight(phpmcc->m_mcc); +} + +static void phpmcc_set_dgram_tmo_weight(MccResourcePtr &phpmcc, + CVarRef value) { + double tmo_weight = 0; + + if (value.is(KindOfDouble)) { + tmo_weight = value.toDouble(); + } else if (value.isInteger()) { + tmo_weight = (double)value.toInt64(); + } else { + return; + } + + mcc_set_dgram_tmo_weight(phpmcc->m_mcc, tmo_weight); + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_set_dgram_tmo_weight((*mirror)->m_mcc, tmo_weight); + } +} + +static void phpmcc_get_fb_serialize_enabled(MccResourcePtr &phpmcc, + Variant& retval) { + retval = phpmcc->m_fb_serialize_enabled; +} + +static void phpmcc_set_fb_serialize_enabled(MccResourcePtr &phpmcc, + CVarRef value) { + if (value.is(KindOfBoolean)) { + phpmcc->m_fb_serialize_enabled = value.toBoolean(); + } else if (value.isInteger()) { + phpmcc->m_fb_serialize_enabled = value.toInt64() != 0; + } +} + +static void phpmcc_get_name(MccResourcePtr &phpmcc, Variant& retval) { + retval = String(phpmcc->m_name); +} + +static void phpmcc_get_nodelay(MccResourcePtr &phpmcc, Variant& retval) { + retval = mcc_get_nodelay(phpmcc->m_mcc); +} + +static void phpmcc_set_nodelay(MccResourcePtr &phpmcc, CVarRef value) { + if (value.is(KindOfBoolean)) { + mcc_set_nodelay(phpmcc->m_mcc, value.toBoolean()); + } else if (value.isInteger()) { + mcc_set_nodelay(phpmcc->m_mcc, value.toInt64() != 0); + } +} + +static void phpmcc_get_persistent(MccResourcePtr &phpmcc, + Variant& retval) { + retval = phpmcc->m_persistent; +} + +static void phpmcc_get_poll_tmo(MccResourcePtr &phpmcc, + Variant& retval) { + retval = (int64)mcc_get_poll_tmo(phpmcc->m_mcc); +} + +static void phpmcc_set_poll_tmo(MccResourcePtr &phpmcc, CVarRef value) { + if (value.isInteger()) { + mcc_set_poll_tmo(phpmcc->m_mcc, value.toInt64()); + } +} + +static void phpmcc_get_proxy(MccResourcePtr &phpmcc, Variant& retval) { + const nstring_t* proxy; + + if ((proxy = mcc_get_proxy(phpmcc->m_mcc)) == NULL) { + retval = null; + } else { + Array accesspoints; + accesspoints = get_accesspoints(phpmcc->m_mcc, proxy); + String s(proxy->str, proxy->len, CopyString); + if (!accesspoints.empty()) { + retval.set(s, accesspoints); + } else { + retval.set(s, null); + } + } +} + +static void phpmcc_set_proxy(MccResourcePtr &phpmcc, CVarRef value) { + nstring_t host; + nstring_t default_port = + NSTRING_CONST(const_cast("PHPMCC_PROXY_PORT_DEFAULT")); + nstring_t port; + + phpstring_to_nstring(host, value); + + port.len = 0; + port.str = (char*)memchr(host.str, ':', host.len); + + if (port.str != NULL) { + port.str++; + port.len = host.str + host.len - port.str; + host.len-= port.len + 1; + } + if (port.len == 0) { + port = default_port; + } + if (mcc_set_proxy(phpmcc->m_mcc, &host, &port, + (mcc_proxy_op_t)(mcc_proxy_delete_op | mcc_proxy_arith_op)) + != NULL) { + phpmcc->m_proxy_ops = mcc_get_proxy_ops(phpmcc->m_mcc); + } else { + phpmcc->m_proxy_ops = 0; + } +} + +static void phpmcc_get_proxy_ops(MccResourcePtr &phpmcc, Variant& retval) { + retval = mcc_get_proxy_ops(phpmcc->m_mcc); +} + +static void phpmcc_set_proxy_ops(MccResourcePtr &phpmcc, CVarRef value) { + if (value.isInteger()) { + phpmcc->m_proxy_ops = (mcc_proxy_op_t)value.toInt64(); + mcc_set_proxy_ops(phpmcc->m_mcc, (mcc_proxy_op_t)value.toInt64()); + } +} + +static void phpmcc_get_server_retry_tmo(MccResourcePtr &phpmcc, + Variant& retval) { + retval = (int64)mcc_get_server_retry_tmo(phpmcc->m_mcc); +} + +static void phpmcc_set_server_retry_tmo(MccResourcePtr &phpmcc, + CVarRef value) { + if (value.isInteger()) { + int64 tmo = value.toInt64(); + mcc_set_server_retry_tmo(phpmcc->m_mcc, tmo); + + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_set_server_retry_tmo((*mirror)->m_mcc, tmo); + } + } +} + +static void phpmcc_get_dgram_tmo_threshold(MccResourcePtr &phpmcc, + Variant& retval) { + retval = (int64)mcc_get_dgram_tmo_threshold(phpmcc->m_mcc); +} + +static void phpmcc_set_dgram_tmo_threshold(MccResourcePtr &phpmcc, + CVarRef value) { + if (value.isInteger()) { + int64 tmo = value.toInt64(); + mcc_set_dgram_tmo_threshold(phpmcc->m_mcc, tmo); + + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_set_dgram_tmo_threshold((*mirror)->m_mcc, tmo); + } + } +} + +static void phpmcc_get_tcp_inactivity_time(MccResourcePtr &phpmcc, + Variant& retval) { + retval = (int64)mcc_get_tcp_inactivity_time(phpmcc->m_mcc); +} + +static void phpmcc_set_tcp_inactivity_time(MccResourcePtr &phpmcc, + CVarRef value) { + if (value.isInteger()) { + mcc_set_tcp_inactivity_time(phpmcc->m_mcc, value.toInt64()); + } +} + +static void phpmcc_get_serverpools(MccResourcePtr &phpmcc, Variant& retval) { + retval = get_serverpools(phpmcc->m_mcc, false); +} + +static void phpmcc_get_tmo(MccResourcePtr &phpmcc, Variant& retval) { + retval = (int64)mcc_get_tmo(phpmcc->m_mcc); +} + +static void phpmcc_set_tmo(MccResourcePtr &phpmcc, CVarRef value) { + if (value.isInteger()) { + int64 tmo = value.toInt64(); + mcc_set_tmo(phpmcc->m_mcc, tmo); + + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_set_tmo((*mirror)->m_mcc, tmo); + } + } +} + +static void phpmcc_get_nphpreqs(MccResourcePtr &phpmcc, Variant& retval) { + retval = (int64)phpmcc->m_nreqs; +} + +static void phpmcc_get_udp_reply_ports(MccResourcePtr &phpmcc, + Variant& retval) { + retval = (int64)mcc_get_udp_reply_ports(phpmcc->m_mcc); +} + +static void phpmcc_set_udp_reply_ports(MccResourcePtr &phpmcc, + CVarRef value) { + if (value.isInteger()) { + int64 tmo = value.toInt64(); + mcc_set_udp_reply_ports(phpmcc->m_mcc, value.toInt64()); + + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_set_udp_reply_ports((*mirror)->m_mcc, tmo); + } + } +} + +static void phpmcc_get_window_max(MccResourcePtr &phpmcc, Variant& retval) { + retval = (int64)mcc_get_window_max(phpmcc->m_mcc); +} + +static void phpmcc_set_window_max(MccResourcePtr &phpmcc, CVarRef value) { + if (value.isInteger()) { + int64 tmo = value.toInt64(); + mcc_set_window_max(phpmcc->m_mcc, value.toInt64()); + + /* propagate to mirrors */ + for (MirrorIt mirror = phpmcc->m_mirror_mccs.begin(); + mirror != phpmcc->m_mirror_mccs.end(); ++mirror) { + mcc_set_window_max((*mirror)->m_mcc, tmo); + } + } +} + +/* XXX deleteme once support for libch 2.0.0 is dropped. */ +static void phpmcc_get_consistent_hashing_maximum_pool_size(MccResourcePtr &phpmcc, + Variant& retval) { + retval = (int64)mcc_get_consistent_hashing_maximum_pool_size(2); +} + +static void phpmcc_get_handle_status(MccResourcePtr &phpmcc, Variant& retval) { + retval = (int64)phpmcc->m_handle_status; +} + +static void phpmcc_set_handle_status(MccResourcePtr &phpmcc, CVarRef value) { + if(value.isInteger()) { + phpmcc->m_handle_status = (MccResource::HandleStatus)value.toInt64(); + } +} + +static void phpmcc_get_fast_path_eligible(MccResourcePtr &phpmcc, Variant& retval) { + retval = phpmcc->m_fast_path_eligible; +} + +static void phpmcc_set_fast_path_eligible(MccResourcePtr &phpmcc, CVarRef value) { + if(value.is(KindOfBoolean)) { + phpmcc->m_fast_path_eligible = value.toBoolean(); + } +} + +static void phpmcc_get_sitevar_version(MccResourcePtr &phpmcc, Variant& retval) { + retval = phpmcc->m_sitevar_version; +} + +static void phpmcc_set_sitevar_version(MccResourcePtr &phpmcc, CVarRef value) { + if(value.isInteger()) { + phpmcc->m_sitevar_version = value.toInt64(); + } +} + +static void phpmcc_get_creation_time(MccResourcePtr &phpmcc, Variant& retval) { + retval = (int64)phpmcc->m_creation_time; +} + +static void phpmcc_get_args(MccResourcePtr &phpmcc, Variant& retval) { + Array serverpools, mirror_cfg, consistent_hashing_prefixes; + + const nstring_t* name; + + serverpools = get_serverpools(phpmcc->m_mcc, false); + + if (!serverpools.empty()) { + retval.set(PHPMCC_ARG_SERVERS, serverpools); + } + + mirror_cfg = get_mirror_cfg(phpmcc); + retval.set(PHPMCC_ARG_MIRROR_CFG, mirror_cfg); + + consistent_hashing_prefixes = get_consistent_hashing_prefixes(phpmcc); + retval.set(PHPMCC_ARG_CONSISTENT_HASHING_PREFIXES, + consistent_hashing_prefixes); + + retval.set(PHPMCC_ARG_COMPRESSION_THRESHOLD, + (int64)phpmcc->m_compression_threshold); + retval.set(PHPMCC_ARG_NZLIB_COMPRESSION, (int64)phpmcc->m_nzlib_compression); + retval.set(PHPMCC_ARG_CONN_TMO, (int64)mcc_get_conn_tmo(phpmcc->m_mcc)); + retval.set(PHPMCC_ARG_CONN_NTRIES, + (int64)mcc_get_conn_ntries(phpmcc->m_mcc)); + retval.set(PHPMCC_ARG_DGRAM_NTRIES, + (int64)mcc_get_dgram_ntries(phpmcc->m_mcc)); + retval.set(PHPMCC_ARG_DGRAM_TMO_WEIGHT, + mcc_get_dgram_tmo_weight(phpmcc->m_mcc)); + retval.set(PHPMCC_ARG_NODELAY, (bool)mcc_get_nodelay(phpmcc->m_mcc)); + retval.set(PHPMCC_ARG_TMO, (int64)mcc_get_tmo(phpmcc->m_mcc)); + retval.set(PHPMCC_ARG_TCP_INACTIVITY_TIME, + (int64)mcc_get_tcp_inactivity_time(phpmcc->m_mcc)); + + if ((name = mcc_get_default_serverpool(phpmcc->m_mcc)) != NULL) { + retval.set(PHPMCC_ARG_DEFAULT_PREFIX, + String(name->str, name->len, CopyString)); + } + + retval.set(PHPMCC_ARG_PERSISTENT, phpmcc->m_persistent); + retval.set(PHPMCC_ARG_POLL_TMO, (int64)mcc_get_poll_tmo(phpmcc->m_mcc)); + + retval.set(PHPMCC_ARG_NPOOLPREFIX, (int64)mcc_get_npoolprefix(phpmcc->m_mcc)); + + if ((name = mcc_get_proxy(phpmcc->m_mcc)) != NULL) { + size_t naccesspoint; + mcc_proxy_op_t proxy_ops; + const nstring_t* accesspoints; + + proxy_ops = mcc_get_proxy_ops(phpmcc->m_mcc); + retval.set(PHPMCC_ARG_PROXY_OPS, proxy_ops); + + if ((accesspoints = mcc_server_get_accesspoints(phpmcc->m_mcc, + name, + &naccesspoint)) != NULL) { + /* Verify there's at least one accesspoint, and verify it's a tcp ap. + Strip off the 'tcp:' prefix it's not used for the delete-proxy */ + + if (naccesspoint > 0 && memcmp(accesspoints[0].str, "tcp:", 4) == 0) { + char* ap = accesspoints[0].str + 4; + int aplen = accesspoints[0].len - 4; + retval.set(PHPMCC_ARG_PROXY, String(ap, aplen, CopyString)); + } + mcc_server_free_accesspoint_list(phpmcc->m_mcc, accesspoints, + naccesspoint); + } + } + + retval.set(PHPMCC_ARG_FB_SERIALIZE_ENABLED, + (bool)phpmcc->m_fb_serialize_enabled); + +#if defined(HAVE_DEBUG_LOG) + { + const nstring_t* logfile = mcc_get_debug_logfile(phpmcc->m_mcc); + retval.set(PHPMCC_ARG_DEBUG, mcc_get_debug(phpmcc->m_mcc)); + + if (logfile != NULL && logfile->len > 0) { + retval.set(PHPMCC_ARG_DEBUG_LOGFILE, + String(logfile->str, logfile->len, CopyString)); + + } else { + retval.set(PHPMCC_ARG_DEBUG_LOGFILE, null); + } + } +#endif /* defined(HAVE_DEBUG_LOG) */ + + retval.set(PHPMCC_ARG_UDP_REPLY_PORTS, + (int64)mcc_get_udp_reply_ports(phpmcc->m_mcc)); + retval.set(PHPMCC_ARG_WINDOW_MAX, (int64)mcc_get_window_max(phpmcc->m_mcc)); + retval.set(PHPMCC_ARG_SERVER_RETRY_TMO_MS, + (int64)mcc_get_server_retry_tmo(phpmcc->m_mcc)); + retval.set(PHPMCC_ARG_DGRAM_TMO_THRESHOLD, + (int64)mcc_get_dgram_tmo_threshold(phpmcc->m_mcc)); +} + +typedef struct member_accessor_s { + nstring_t name; + void (*getter)(MccResourcePtr&, Variant&); + void (*setter)(MccResourcePtr&, CVarRef); +} member_accessor_t; + + +#define MEMBER_RO_ACCESSOR(public_name, getter) \ + {{(char*)public_name, sizeof(public_name) - 1}, \ + getter, NULL}, +#define MEMBER_RW_ACCESSOR(public_name, getter, setter) \ + {{(char*)public_name, sizeof(public_name) - 1}, \ + getter, setter}, + +static member_accessor_t member_accessors[] = { + MEMBER_RO_ACCESSOR("args", phpmcc_get_args) + MEMBER_RW_ACCESSOR("conn_tmo", phpmcc_get_conn_tmo, phpmcc_set_conn_tmo) + MEMBER_RW_ACCESSOR("conn_ntries", phpmcc_get_conn_ntries, + phpmcc_set_conn_ntries) + MEMBER_RW_ACCESSOR("compression_threshold", phpmcc_get_compression_threshold, + phpmcc_set_compression_threshold) + MEMBER_RW_ACCESSOR("nzlib_compression", phpmcc_get_nzlib_compression, + phpmcc_set_nzlib_compression) + MEMBER_RW_ACCESSOR("default_serverpool", phpmcc_get_default_serverpool, + phpmcc_set_default_serverpool) +#if defined(HAVE_DEBUG_LOG) + MEMBER_RW_ACCESSOR("debug", phpmcc_get_debug, phpmcc_set_debug) + MEMBER_RW_ACCESSOR("debug_logfile", phpmcc_get_debug_logfile, + phpmcc_set_debug_logfile) +#endif /* defined(HAVE_DEBUG_LOG) */ + MEMBER_RW_ACCESSOR("delproxy", phpmcc_get_delproxy, phpmcc_set_delproxy) + MEMBER_RW_ACCESSOR("dgram_ntries", phpmcc_get_dgram_ntries, + phpmcc_set_dgram_ntries) + MEMBER_RW_ACCESSOR("dgram_tmo_weight", phpmcc_get_dgram_tmo_weight, + phpmcc_set_dgram_tmo_weight) + MEMBER_RW_ACCESSOR("fb_serialize_enabled", phpmcc_get_fb_serialize_enabled, + phpmcc_set_fb_serialize_enabled) + MEMBER_RO_ACCESSOR("name", phpmcc_get_name) + MEMBER_RW_ACCESSOR("nodelay", phpmcc_get_nodelay, phpmcc_set_nodelay) + MEMBER_RO_ACCESSOR("nphpreqs", phpmcc_get_nphpreqs) + MEMBER_RO_ACCESSOR("persistent", phpmcc_get_persistent) + MEMBER_RW_ACCESSOR("poll_tmo", phpmcc_get_poll_tmo, phpmcc_set_poll_tmo) + MEMBER_RW_ACCESSOR("proxy", phpmcc_get_proxy, phpmcc_set_proxy) + MEMBER_RW_ACCESSOR("proxy_ops", phpmcc_get_proxy_ops, phpmcc_set_proxy_ops) + MEMBER_RW_ACCESSOR("server_retry_tmo", phpmcc_get_server_retry_tmo, + phpmcc_set_server_retry_tmo) + MEMBER_RW_ACCESSOR("dgram_tmo_threshold", phpmcc_get_dgram_tmo_threshold, + phpmcc_set_dgram_tmo_threshold) + MEMBER_RW_ACCESSOR("tcp_inactivity_time", phpmcc_get_tcp_inactivity_time, + phpmcc_set_tcp_inactivity_time) + MEMBER_RO_ACCESSOR("serverpools", phpmcc_get_serverpools) + MEMBER_RW_ACCESSOR("tmo", phpmcc_get_tmo, phpmcc_set_tmo) + MEMBER_RW_ACCESSOR("udp_reply_ports", phpmcc_get_udp_reply_ports, + phpmcc_set_udp_reply_ports) + MEMBER_RW_ACCESSOR("window_max", phpmcc_get_window_max, phpmcc_set_window_max) + MEMBER_RO_ACCESSOR("consistent_hashing_maximum_pool_size", + phpmcc_get_consistent_hashing_maximum_pool_size) + + MEMBER_RW_ACCESSOR("handle_status", + phpmcc_get_handle_status, + phpmcc_set_handle_status) + MEMBER_RW_ACCESSOR("fast_path_eligible", + phpmcc_get_fast_path_eligible, + phpmcc_set_fast_path_eligible) + MEMBER_RW_ACCESSOR("sitevar_version", + phpmcc_get_sitevar_version, + phpmcc_set_sitevar_version) + MEMBER_RO_ACCESSOR("creation_time", + phpmcc_get_creation_time) +}; +#undef MEMBER_RO_ACCESSOR +#undef MEMBER_RW_ACCESSOR + +static Variant phpmcc_read_property(MccResourcePtr &phpmcc, CVarRef member) { + nstring_t member_name; + member_accessor_t* accessor; + int found = 0; + Variant retval; + + if (!member.isString()) { + goto epilogue; + } + if (!phpmcc.get()) { + goto epilogue; + } + + phpstring_to_nstring(member_name, member); + + for (accessor = &member_accessors[0]; + accessor < &member_accessors[sizeof(member_accessors)/ + sizeof(member_accessor_t)]; + accessor++) { + if (nstring_cmp(&member_name, &accessor->name) == 0) { + found = 1; + break; + } + } + + if (!found || accessor->getter == NULL) { + Logger::Error("Property %s of class mcc cannot be read", member_name.str); + goto epilogue; + } + + accessor->getter(phpmcc, retval); + + epilogue: + return retval; +} + +static void phpmcc_write_property(MccResourcePtr &phpmcc, CVarRef member, + CVarRef value) { + nstring_t member_name; + member_accessor_t* accessor; + int found = 0; + + if (!member.isString()) { + return; + } + + if (!phpmcc.get()) { + return; + } + + phpstring_to_nstring(member_name, member); + + for (accessor = &member_accessors[0]; + accessor < &member_accessors[sizeof(member_accessors)/ + sizeof(member_accessor_t)]; + accessor++) { + if (nstring_cmp(&member_name, &accessor->name) == 0) { + found = 1; + break; + } + } + + if (!found || accessor->setter == NULL) { + Logger::Error("Property %s of class mcc cannot be updated", + member_name.str); + return; + } + + accessor->setter(phpmcc, value); +} + +/////////////////////////////////////////////////////////////////////////////// +// methods + +c_phpmcc::c_phpmcc() { +} +c_phpmcc::~c_phpmcc() { +} + +void c_phpmcc::t___construct +(CStrRef name, + bool persistent/* = true */, + int64 npoolprefix/* = MCC_POOLPREFIX_LEN_DEFAULT */, + int64 mtu/* = MCC_MTU_DEFAULT */, + int64 rxdgram_max/* = MCC_RXDGRAM_MAX_DEFAULT */, + int64 nodelay/* = MCC_NODELAY_DEFAULT */, + int64 conn_tmo/* = MCC_CONN_TMO_MS_DEFAULT */, + int64 conn_ntries/* = MCC_CONN_NTRIES_DEFAULT */, + int64 tmo/* = MCC_TMO_MS_DEFAULT */, + int64 dgram_ntries/* = MCC_DGRAM_NTRIES_DEFAULT */, + double dgram_tmo_weight/* = MCC_DGRAM_TMO_WEIGHT_DEFAULT */, + int64 server_retry_tmo/* = MCC_SERVER_RETRY_TMO_MS_DEFAULT */, + int64 dgram_tmo_threshold/* = MCC_DGRAM_TMO_THRESHOLD_DEFAULT */, + int64 window_max/* = MCC_WINDOW_MAX_DEFAULT */) { + FUNCTION_INJECTION(phpmcc::__construct); + + bool success = false; + MccResourcePtr mcc_r; + if (persistent) { + mcc_r = MccResource::GetPersistent(name); + if (mcc_r.get() != NULL) { + success = true; + } + } + + if (!success && + (mcc_r = MccResourcePtr(new MccResource + (name, persistent, mtu, rxdgram_max, + nodelay))).get() && + mcc_r->init_mcc(npoolprefix, conn_tmo, conn_ntries, + tmo, dgram_ntries, dgram_tmo_weight, + window_max, server_retry_tmo, + dgram_tmo_threshold)) { + success = true; + } + + if (success) { + m_mcc = mcc_r; + } +} + +Variant c_phpmcc::t___destruct() { + FUNCTION_INJECTION(phpmcc::__destruct); + return null; +} + +String c_phpmcc::t___tostring() { + FUNCTION_INJECTION(phpmcc::__tostring); + return m_mcc->m_name; +} + +Variant c_phpmcc::t___set(Variant name, Variant val) { + FUNCTION_INJECTION(phpmcc::__set); + phpmcc_write_property(m_mcc, name, val); + return null; +} + +Variant c_phpmcc::t___get(Variant name) { + FUNCTION_INJECTION(phpmcc::__get); + return phpmcc_read_property(m_mcc, name); +} + +bool c_phpmcc::t_close() { + FUNCTION_INJECTION(phpmcc::close); + return m_mcc->close(); +} + +bool c_phpmcc::t_del() { + FUNCTION_INJECTION(phpmcc::del); + return t_close(); +} + +int64 c_phpmcc::t_add_accesspoint(CStrRef server, CStrRef host, + CStrRef port /* = 11211 */, + int64 protocol /* = IPPROTO_TCP */) { + FUNCTION_INJECTION(phpmcc::add_accesspoint); + if (!m_mcc.get()) { + return 0; + } + /* hmmm */ + nstring_t nserv, nhost, nport; + String sport(port); + phpstring_to_nstring(nserv, server); + phpstring_to_nstring(nhost, host); + phpstring_to_nstring(nport, sport); + return (int64)mcc_add_accesspoint(m_mcc->m_mcc, &nserv, &nhost, + &nport, protocol, MCC_ASCII_PROTOCOL); +} + +void c_phpmcc::t_remove_accesspoint(CStrRef server, CStrRef host, + CStrRef port /* = 11211 */, + int64 protocol /* = IPPROTO_TCP */) { + FUNCTION_INJECTION(phpmcc::remove_accesspoint); + if (!m_mcc.get()) { + return; + } + /* hmm */ + String sport(port); + nstring_t nserv, nhost, nport; + phpstring_to_nstring(nserv, server); + phpstring_to_nstring(nhost, host); + phpstring_to_nstring(nport, sport); + mcc_remove_accesspoint(m_mcc->m_mcc, &nserv, + &nhost, &nport, protocol, MCC_ASCII_PROTOCOL); +} + +Variant c_phpmcc::t_get_accesspoints(CStrRef server) { + FUNCTION_INJECTION(phpmcc::get_accesspoint); + if (!m_mcc.get()) { + return null; + } + nstring_t nserv; + phpstring_to_nstring(nserv, server); + return get_accesspoints(m_mcc->m_mcc, &nserv); +} + +Variant c_phpmcc::t_get_server(CStrRef server) { + FUNCTION_INJECTION(phpmcc::get_server); + return t_get_accesspoints(server); +} + +Variant +c_phpmcc::t_add_mirror_accesspoint(CStrRef mirrorname, + CStrRef server, + CStrRef host, + CStrRef port /* = 11211 */, + int64 protocol /* = IPPROTO_TCP */) { + FUNCTION_INJECTION(phpmcc::add_mirror_accesspoint); + + if (!m_mcc.get()) { + return null; + } + + // phpmcc_addremove_mirror_accesspoint_helper returns 0 on error, but we're + // returning 0 on success. + return (int64)(0 == + phpmcc_addremove_mirror_accesspoint_helper(m_mcc, + mirrorname, + server, + host, + port, + protocol, true)); +} + +void +c_phpmcc::t_remove_mirror_accesspoint(CStrRef mirrorname, + CStrRef server, + CStrRef host, + CStrRef port /* = 11211 */, + int64 protocol /* = IPPROTO_TCP */) { + FUNCTION_INJECTION(phpmcc::remove_mirror_accesspoint); + if (m_mcc.get()) { + phpmcc_addremove_mirror_accesspoint_helper + (m_mcc, mirrorname, server, host, port, protocol, false); + } +} + +int64 c_phpmcc::t_add_server(CStrRef server, CStrRef mirror) { + FUNCTION_INJECTION(phpmcc::add_server); + String serverToAdd = server; + if (RuntimeOption::LocalMemcache) { + serverToAdd = "127.0.0.1"; + } + if (!m_mcc.get()) { + return 0; + } + return phpmcc_addremove_server_helper(m_mcc, serverToAdd, mirror, true); +} + +void c_phpmcc::t_remove_server(CStrRef server, CStrRef mirror) { + FUNCTION_INJECTION(phpmcc::remove_server); + if (m_mcc.get()) { + phpmcc_addremove_server_helper(m_mcc, server, mirror, false); + } +} + +bool c_phpmcc::t_server_flush(CStrRef server, int64 exptime /* = 0 */) { + FUNCTION_INJECTION(phpmcc::server_flush); + if (!m_mcc.get()) { + return false; + } + nstring_t nserv; + phpstring_to_nstring(nserv, server); + int64 result = mcc_server_flush(m_mcc->m_mcc, &nserv, exptime); + return result == 1; +} + +Variant c_phpmcc::t_server_version(CStrRef server /* = "" */) { + FUNCTION_INJECTION(phpmcc::server_version); + const nstring_t* version; + + if (!m_mcc.get()) { + return null; + } + nstring_t nserv; + phpstring_to_nstring(nserv, server); + version = mcc_server_get_version(m_mcc->m_mcc, &nserv); + Variant return_value; + if (version != NULL) { + return_value = String(version->str, version->len, CopyString); + mcc_free_version(m_mcc->m_mcc, version); + } else { + return_value = null; + } + return return_value; +} + +bool c_phpmcc::t_server_is_alive(CStrRef server /* = "" */) { + FUNCTION_INJECTION(phpmcc::server_is_alive); + const nstring_t* version; + + if (!m_mcc.get()) { + return null; + } + nstring_t nserv; + phpstring_to_nstring(nserv, server); + version = mcc_server_get_version(m_mcc->m_mcc, &nserv); + + bool return_value = version != NULL; + + if (version != NULL) { + mcc_free_version(m_mcc->m_mcc, version); + } + return return_value; +} + +bool c_phpmcc::t_test_proxy(CStrRef server /* = "" */) { + FUNCTION_INJECTION(phpmcc::test_proxy); + return t_server_is_alive(server); +} + +Variant c_phpmcc::t_add_mirror(CStrRef mirrorname, int64 model) { + FUNCTION_INJECTION(phpmcc::add_mirror); + if (!m_mcc.get()) { + return null; + } + return phpmcc_add_mirror_helper(m_mcc, mirrorname, + (MccMirrorMcc::ConsistencyModel)model); +} + +Variant c_phpmcc::t_remove_mirror(CStrRef mirrorname) { + FUNCTION_INJECTION(phpmcc::remove_mirror); + if (!m_mcc.get()) { + return null; + } + return phpmcc_remove_mirror_helper(m_mcc, mirrorname); +} + +Variant c_phpmcc::t_add_serverpool(CStrRef serverpool, + bool consistent_hashing_enabled /* = 0 */) { + FUNCTION_INJECTION(phpmcc::add_serverpool); + if (!m_mcc.get()) { + return null; + } + return phpmcc_add_serverpool_helper(m_mcc, serverpool, + consistent_hashing_enabled, 2); +} + +Variant c_phpmcc::t_add_serverpool_ex(CStrRef serverpool, + int64 consistent_hashing_flag) { + FUNCTION_INJECTION(phpmcc::add_serverpool); + if (!m_mcc.get()) { + return null; + } + return phpmcc_add_serverpool_helper(m_mcc, serverpool, + consistent_hashing_flag != 0, + consistent_hashing_flag + 1); +} + +bool c_phpmcc::t_add_accesspoint_listener(CStrRef function, Variant context) { + FUNCTION_INJECTION(phpmcc::add_accesspoint_listener); + return zim_phpmcc_add_listener(m_mcc, function, context, + MccListener::AccessPointListener); +} + +bool c_phpmcc::t_remove_accesspoint_listener(CStrRef function, Variant context) { + FUNCTION_INJECTION(phpmcc::remove_accesspoint_listener); + return zim_phpmcc_remove_listener(m_mcc, function, context, + MccListener::AccessPointListener); +} + +bool c_phpmcc::t_add_server_listener(CStrRef function, Variant context) { + FUNCTION_INJECTION(phpmcc::add_server_listener); + return zim_phpmcc_add_listener(m_mcc, function, context, + MccListener::ServerListener); +} + +bool c_phpmcc::t_remove_server_listener(CStrRef function, Variant context) { + FUNCTION_INJECTION(phpmcc::remove_server_listener); + return zim_phpmcc_remove_listener(m_mcc, function, context, + MccListener::ServerListener); +} + +bool c_phpmcc::t_add_error_listener(CStrRef function, Variant context) { + FUNCTION_INJECTION(phpmcc::add_error_listener); + return zim_phpmcc_add_listener(m_mcc, function, context, + MccListener::ErrorListener); +} + +bool c_phpmcc::t_remove_error_listener(CStrRef function, Variant context) { + FUNCTION_INJECTION(phpmcc::remove_error_listener); + return zim_phpmcc_remove_listener(m_mcc, function, context, + MccListener::ErrorListener); +} + +void c_phpmcc::t_remove_serverpool(CStrRef serverpool) { + FUNCTION_INJECTION(phpmcc::remove_serverpool); + if (!m_mcc.get()) { + return; + } + phpmcc_remove_serverpool_helper(m_mcc, serverpool); +} + +Variant c_phpmcc::t_get_server_by_key(CStrRef key) { + FUNCTION_INJECTION(phpmcc::get_server_by_key); + if (!m_mcc.get()) { + return null; + } + + const nstring_t* server; + + nstring_t nkey; + phpstring_to_nstring(nkey, key); + if ((server = mcc_get_server_by_key(m_mcc->m_mcc, &nkey)) != NULL) { + return String(server->str, server->len, CopyString); + } + return null; +} + +Variant c_phpmcc::t_get_host(CStrRef key) { + FUNCTION_INJECTION(phpmcc::get_host); + return t_get_server_by_key(key); +} + +Variant c_phpmcc::t_get_serverpool_by_key(CStrRef key) { + FUNCTION_INJECTION(phpmcc::get_serverpool_by_key); + if (!m_mcc.get()) { + return null; + } + + const nstring_t* serverpool; + nstring_t nkey; + phpstring_to_nstring(nkey, key); + if ((serverpool = mcc_get_serverpool_by_key(m_mcc->m_mcc, &nkey)) != NULL) { + return String(serverpool->str, serverpool->len, CopyString); + } + return null; +} + +Variant c_phpmcc::t_serverpool_add_server(CStrRef serverpool, + CStrRef server, + CStrRef mirrorname /* = "" */) { + FUNCTION_INJECTION(phpmcc::get_serverpool_add_server); + String serverToAdd = server; + if (RuntimeOption::LocalMemcache) { + serverToAdd = "127.0.0.1"; + } + + if (!m_mcc.get()) { + return null; + } + return phpmcc_serverpool_addremove_server_helper(m_mcc, serverpool, + serverToAdd, mirrorname, + true); +} + +Variant c_phpmcc::t_serverpool_remove_server(CStrRef serverpool, + CStrRef server, + CStrRef mirrorname /* = "" */) { + FUNCTION_INJECTION(phpmcc::get_serverpool_remove_server); + if (!m_mcc.get()) { + return null; + } + return phpmcc_serverpool_addremove_server_helper(m_mcc, serverpool, + server, mirrorname, false); +} + +Variant c_phpmcc::t_serverpool_get_servers(CStrRef serverpool) { + FUNCTION_INJECTION(phpmcc::get_serverpool_get_servers); + if (!m_mcc.get()) { + return null; + } + nstring_t nsp; + phpstring_to_nstring(nsp, serverpool); + return get_serverpool_servers(m_mcc->m_mcc, &nsp, false); +} + +Variant +c_phpmcc::t_serverpool_get_consistent_hashing_enabled(CStrRef serverpool) { + FUNCTION_INJECTION(phpmcc::get_serverpool_get_consistent_hashing_enabled); + if (!m_mcc.get()) { + return null; + } + nstring_t nsp; + phpstring_to_nstring(nsp, serverpool); + return (bool)mcc_serverpool_get_consistent_hashing_enabled(m_mcc->m_mcc, + &nsp); +} + +Variant +c_phpmcc::t_serverpool_get_consistent_hashing_version(CStrRef serverpool) { + FUNCTION_INJECTION(phpmcc::get_serverpool_get_consistent_hashing_enabled); + if (!m_mcc.get()) { + return null; + } + nstring_t nsp; + phpstring_to_nstring(nsp, serverpool); + return (int64)mcc_serverpool_get_consistent_hashing_version(m_mcc->m_mcc, + &nsp); +} + +Variant c_phpmcc::t_multi_add(CArrRef keys_values, + int64 exptime /* = 0 */, + int64 compress /* = 1 */, + int64 proxy_replicate /* = 0 */, + int64 async_set /* = 0 */) { + FUNCTION_INJECTION(phpmcc::multi_add); + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.madd", 1); + ServerStats::Log("mcc.madd.count", keys_values.size()); + } + return zim_phpmcc_multi_update(m_mcc, keys_values, exptime, compress, + proxy_replicate, async_set, mcc_add_cmd); +} + +Variant c_phpmcc::t_multi_replace(CArrRef keys_values, + int64 exptime /* = 0 */, + int64 compress /* = 1 */, + int64 proxy_replicate /* = 0 */, + int64 async_set /* = 0 */) { + FUNCTION_INJECTION(phpmcc::multi_replace); + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.mreplace", 1); + ServerStats::Log("mcc.mreplace.count", keys_values.size()); + } + return zim_phpmcc_multi_update(m_mcc, keys_values, exptime, compress, + proxy_replicate, async_set, mcc_replace_cmd); +} + +Variant c_phpmcc::t_multi_set(CArrRef keys_values, + int64 exptime /* = 0 */, + int64 compress /* = 1 */, + int64 proxy_replicate /* = 0 */, + int64 async_set /* = 0 */) { + FUNCTION_INJECTION(phpmcc::multi_set); + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.set", 1); + } + return zim_phpmcc_multi_update(m_mcc, keys_values, exptime, compress, + proxy_replicate, async_set, mcc_set_cmd); +} + +Variant c_phpmcc::t_add(CVarRef key, + CVarRef value, + int64 exptime /* = 0 */, + bool compress /* = 1 */, + int64 proxy_replicate /* = 0 */, + int64 async_set /* = 0 */) { + FUNCTION_INJECTION(phpmcc::add); + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.add", 1); + } + return zim_phpmcc_update(m_mcc, key, value, exptime, + compress, proxy_replicate, async_set, + mcc_add_cmd); +} + +Variant c_phpmcc::t_decr(CStrRef key, int64 value /* = 1 */) { + FUNCTION_INJECTION(phpmcc::decr); + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.decr", 1); + } + return zim_phpmcc_arith_update(m_mcc, key, value, mcc_decr_cmd); +} + +Variant c_phpmcc::t_incr(CStrRef key, int64 value /* = 1 */) { + FUNCTION_INJECTION(phpmcc::incr); + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.incr", 1); + } + return zim_phpmcc_arith_update(m_mcc, key, value, mcc_incr_cmd); +} + +Variant c_phpmcc::t_delete(CVarRef keys, int64 exptime /* = 0 */) { + FUNCTION_INJECTION(phpmcc::delete); + if (!m_mcc.get()) { + return null; + } + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.delete", 1); + } + return phpmcc_delete(m_mcc, keys, exptime, false); +} + +Variant c_phpmcc::t_delete_details(CVarRef keys, int64 exptime /* = 0 */) { + FUNCTION_INJECTION(phpmcc::delete_details); + if (!m_mcc.get()) { + return null; + } + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.delete_details", 1); + } + return phpmcc_delete(m_mcc, keys, exptime, true); +} + +Variant c_phpmcc::t_get(CVarRef keys, int64 detailed_info_mode /* = 0 */, + Variant detailed_info /* = null */) { + FUNCTION_INJECTION(phpmcc::get); + if (!m_mcc.get()) { + return null; + } + if (detailed_info_mode == 0) detailed_info_mode = PHPMCC_GET_DEFAULT; + Variant return_value; + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.get", 1); + } + phpmcc_get(m_mcc, return_value, keys, + (phpmcc_get_details_t)detailed_info_mode, detailed_info); + return return_value; +} + +Variant c_phpmcc::t_get_multi(CVarRef keys, int64 detailed_info_mode /* = 0 */, + Variant detailed_info /* = null */) { + FUNCTION_INJECTION(phpmcc::get_multi); + if (!m_mcc.get()) { + return null; + } + if (detailed_info_mode == 0) detailed_info_mode = PHPMCC_GET_DEFAULT; + Variant return_value; + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.mget", 1); + ServerStats::Log("mcc.mget.count", keys.toArray().size()); + } + phpmcc_get(m_mcc, return_value, keys, + (phpmcc_get_details_t)detailed_info_mode, detailed_info); + return return_value; +} + +Variant c_phpmcc::t_replace(CVarRef key, + CVarRef value, + int64 exptime /* = 0 */, + bool compress /* = 1 */, + int64 proxy_replicate /* = 0 */, + int64 async_set /* = 0 */) { + FUNCTION_INJECTION(phpmcc::replace); + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.replace", 1); + } + return zim_phpmcc_update(m_mcc, key, value, exptime, + compress, proxy_replicate, async_set, + mcc_replace_cmd); +} + +Variant c_phpmcc::t_set(CVarRef key, + CVarRef value, + int64 exptime /* = 0 */, + bool compress /* = 1 */, + int64 proxy_replicate /* = 0 */, + int64 async_set /* = 0 */) { + FUNCTION_INJECTION(phpmcc::set); + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.set", 1); + } + return zim_phpmcc_update(m_mcc, key, value, exptime, + compress, proxy_replicate, async_set, + mcc_set_cmd); +} + +Variant c_phpmcc::t_stats(int64 clear /* = 0 */) { + FUNCTION_INJECTION(phpmcc::stats); + if (!m_mcc.get()) { + return null; + } + if (RuntimeOption::EnableStats && RuntimeOption::EnableMemcacheStats) { + ServerStats::Log("mcc.stats", 1); + } + return phpmcc_stats(m_mcc, clear); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/phpmcc/release/ext_php_mcc.h b/src/cpp/ext/phpmcc/release/ext_php_mcc.h new file mode 100644 index 0000000000000..8e2527c57dcc1 --- /dev/null +++ b/src/cpp/ext/phpmcc/release/ext_php_mcc.h @@ -0,0 +1,165 @@ + +#ifndef __EXT_PHP_MCC_H__ +#define __EXT_PHP_MCC_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< +#include "ext_php_mcc_resource.h" + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +extern const int64 k_MCC_IPPROTO_TCP; +extern const int64 k_MCC_IPPROTO_UDP; +extern const int64 k_MCC_SERVER_UP; +extern const int64 k_MCC_SERVER_DOWN; +extern const int64 k_MCC_SERVER_DISABLED; +extern const int64 k_MCC_SERVER_RETRY_TMO_MS; +extern const int64 k_MCC_DGRAM_TMO_THRESHOLD; +extern const int64 k_MCC_PORT_DEFAULT; +extern const int64 k_MCC_POOLPREFIX_LEN; +extern const int64 k_MCC_MTU; +extern const int64 k_MCC_RXDGRAM_MAX; +extern const int64 k_MCC_CONN_TMO_MS; +extern const int64 k_MCC_CONN_NTRIES; +extern const int64 k_MCC_DGRAM_NTRIES; +extern const double k_MCC_DGRAM_TMO_WEIGHT; +extern const int64 k_MCC_NODELAY; +extern const int64 k_MCC_POLL_TMO_US; +extern const int64 k_MCC_PROXY_DELETE_OP; +extern const int64 k_MCC_PROXY_UPDATE_OP; +extern const int64 k_MCC_PROXY_ARITH_OP; +extern const int64 k_MCC_PROXY_GET_OP; +extern const int64 k_MCC_TMO_MS; +extern const int64 k_MCC_UDP_REPLY_PORTS; +extern const int64 k_MCC_WINDOW_MAX; +extern const int64 k_MCC_HAVE_FB_SERIALIZATION; +extern const StaticString k_MCC_ARG_FB_SERIALIZE_ENABLED; +extern const StaticString k_MCC_ARG_CONSISTENT_HASHING_PREFIXES; +extern const int64 k_MCC_HAVE_DEBUG_LOG; +extern const StaticString k_MCC_ARG_DEBUG; +extern const StaticString k_MCC_ARG_DEBUG_LOGFILE; +extern const int64 k_MCC_HAVE_ZLIB_COMPRESSION; +extern const int64 k_MCC_COMPRESSION_THRESHHOLD; +extern const StaticString k_MCC_ARG_SERVERS; +extern const StaticString k_MCC_ARG_MIRROR_CFG; +extern const StaticString k_MCC_ARG_MIRROR_CFG_NAME; +extern const StaticString k_MCC_ARG_MIRROR_CFG_MODEL; +extern const StaticString k_MCC_ARG_MIRROR_CFG_SERVERPOOLS; +extern const StaticString k_MCC_ARG_COMPRESSION_THRESHOLD; +extern const StaticString k_MCC_ARG_NZLIB_COMPRESSION; +extern const StaticString k_MCC_ARG_CONN_TMO; +extern const StaticString k_MCC_ARG_CONN_NTRIES; +extern const StaticString k_MCC_ARG_DEFAULT_PREFIX; +extern const StaticString k_MCC_ARG_DELETE_PROXY; +extern const StaticString k_MCC_ARG_DGRAM_NTRIES; +extern const StaticString k_MCC_ARG_DGRAM_TMO_WEIGHT; +extern const StaticString k_MCC_ARG_NODELAY; +extern const StaticString k_MCC_ARG_PERSISTENT; +extern const StaticString k_MCC_ARG_POLL_TMO; +extern const StaticString k_MCC_ARG_PROXY; +extern const StaticString k_MCC_ARG_PROXY_OPS; +extern const StaticString k_MCC_ARG_TMO; +extern const StaticString k_MCC_ARG_TCP_INACTIVITY_TIME; +extern const StaticString k_MCC_ARG_NPOOLPREFIX; +extern const int64 k_MCC_TCP_INACTIVITY_TMO_DEFAULT; +extern const StaticString k_MCC_ARG_UDP_REPLY_PORTS; +extern const StaticString k_MCC_ARG_WINDOW_MAX; +extern const int64 k_MCC_CONSISTENCY_IGNORE; +extern const int64 k_MCC_CONSISTENCY_MATCH_ALL; +extern const int64 k_MCC_CONSISTENCY_MATCH_HITS; +extern const int64 k_MCC_CONSISTENCY_MATCH_HITS_SUPERCEDES; +extern const StaticString k_MCC_ARG_SERVER_RETRY_TMO_MS; +extern const StaticString k_MCC_ARG_DGRAM_TMO_THRESHOLD; +extern const int64 k_MCC_GET_RECORD_ERRORS; +extern const int64 k_MCC_DELETE_DELETED; +extern const int64 k_MCC_DELETE_NOTFOUND; +extern const int64 k_MCC_DELETE_ERROR_LOG; +extern const int64 k_MCC_DELETE_ERROR_NOLOG; +extern const int64 k_PHPMCC_NEW_HANDLE; +extern const int64 k_PHPMCC_USED_FAST_PATH; +extern const int64 k_PHPMCC_USED_SLOW_PATH; +extern const StaticString k_PHPMCC_VERSION; +extern const int64 q_phpmcc_IPPROTO_TCP; +extern const int64 q_phpmcc_IPPROTO_UDP; + +/////////////////////////////////////////////////////////////////////////////// +// class phpmcc + +FORWARD_DECLARE_CLASS(phpmcc); +class c_phpmcc : public ObjectData { + public: + BEGIN_CLASS_MAP(phpmcc) + END_CLASS_MAP(phpmcc) + DECLARE_CLASS(phpmcc, phpmcc, ObjectData) + DECLARE_INVOKES_FROM_EVAL + ObjectData* dynCreate(CArrRef params, bool init = true); + + // need to implement + public: c_phpmcc(); + public: ~c_phpmcc(); + public: void t___construct(CStrRef name, bool persistent = true, int64 npoolprefix = k_MCC_POOLPREFIX_LEN, int64 mtu = k_MCC_MTU, int64 rxdgram_max = k_MCC_NODELAY, int64 nodelay = k_MCC_CONN_TMO_MS, int64 conn_tmo = k_MCC_CONN_TMO_MS, int64 conn_ntries = k_MCC_CONN_NTRIES, int64 tmo = k_MCC_TMO_MS, int64 dgram_ntries = k_MCC_DGRAM_NTRIES, double dgram_tmo_weight = k_MCC_DGRAM_TMO_WEIGHT, int64 server_retry_tmo = k_MCC_SERVER_RETRY_TMO_MS, int64 dgram_tmo_threshold = k_MCC_DGRAM_TMO_THRESHOLD, int64 window_max = k_MCC_WINDOW_MAX); + public: Variant t___destruct(); + public: String t___tostring(); + public: Variant t___set(Variant name, Variant val); + public: Variant t___get(Variant name); + public: bool t_close(); + public: bool t_del(); + public: int64 t_add_accesspoint(CStrRef server, CStrRef host, CStrRef port = "11211", int64 protocol = k_MCC_IPPROTO_TCP); + public: void t_remove_accesspoint(CStrRef server, CStrRef host, CStrRef port = "11211", int64 protocol = k_MCC_IPPROTO_TCP); + public: Variant t_get_accesspoints(CStrRef server); + public: Variant t_get_server(CStrRef server); + public: Variant t_add_mirror_accesspoint(CStrRef mirrorname, CStrRef server, CStrRef host, CStrRef port = "11211", int64 protocol = k_MCC_IPPROTO_TCP); + public: void t_remove_mirror_accesspoint(CStrRef mirrorname, CStrRef server, CStrRef host, CStrRef port = "11211", int64 protocol = k_MCC_IPPROTO_TCP); + public: int64 t_add_server(CStrRef server, CStrRef mirror = ""); + public: void t_remove_server(CStrRef server, CStrRef mirror = ""); + public: bool t_server_flush(CStrRef server, int64 exptime = 0); + public: Variant t_server_version(CStrRef server); + public: bool t_server_is_alive(CStrRef server = ""); + public: bool t_test_proxy(CStrRef server = ""); + public: Variant t_add_mirror(CStrRef mirrorname, int64 model); + public: Variant t_remove_mirror(CStrRef mirrorname); + public: Variant t_add_serverpool(CStrRef serverpool, bool consistent_hashing_enabled = false); + public: Variant t_add_serverpool_ex(CStrRef serverpool, int64 version_flag); + public: void t_remove_serverpool(CStrRef serverpool); + public: bool t_add_accesspoint_listener(CStrRef function, Variant context); + public: bool t_remove_accesspoint_listener(CStrRef function, Variant context); + public: bool t_add_server_listener(CStrRef function, Variant context); + public: bool t_remove_server_listener(CStrRef function, Variant context); + public: bool t_add_error_listener(CStrRef function, Variant context); + public: bool t_remove_error_listener(CStrRef function, Variant context); + public: Variant t_get_server_by_key(CStrRef key); + public: Variant t_get_host(CStrRef key); + public: Variant t_get_serverpool_by_key(CStrRef key); + public: Variant t_serverpool_add_server(CStrRef serverpool, CStrRef server, CStrRef mirrorname = ""); + public: Variant t_serverpool_remove_server(CStrRef serverpool, CStrRef server, CStrRef mirrorname = ""); + public: Variant t_serverpool_get_servers(CStrRef serverpool); + public: Variant t_serverpool_get_consistent_hashing_enabled(CStrRef serverpool); + public: Variant t_serverpool_get_consistent_hashing_version(CStrRef serverpool); + public: Variant t_multi_add(CArrRef keys_values, int64 exptime = 0, int64 compress = 1, int64 proxy_replicate = 0, int64 async_set = 0); + public: Variant t_multi_replace(CArrRef keys_values, int64 exptime = 0, int64 compress = 1, int64 proxy_replicate = 0, int64 async_set = 0); + public: Variant t_multi_set(CArrRef keys_values, int64 exptime = 0, int64 compress = 1, int64 proxy_replicate = 0, int64 async_set = 0); + public: Variant t_add(CVarRef key, CVarRef value, int64 exptime = 0, bool compress = true, int64 proxy_replicate = 0, int64 async_set = 0); + public: Variant t_decr(CStrRef key, int64 value = 1); + public: Variant t_incr(CStrRef key, int64 value = 1); + public: Variant t_delete(CVarRef keys, int64 exptime = 0); + public: Variant t_delete_details(CVarRef keys, int64 exptime = 0); + public: Variant t_get(CVarRef keys, int64 detailed_info_mode = 0, Variant detailed_info = null); + public: Variant t_get_multi(CVarRef keys, int64 detailed_info_mode = 0, Variant detailed_info = null); + public: Variant t_replace(CVarRef key, CVarRef value, int64 exptime = 0, bool compress = true, int64 proxy_replicate = 0, int64 async_set = 0); + public: Variant t_set(CVarRef key, CVarRef value, int64 exptime = 0, bool compress = true, int64 proxy_replicate = 0, int64 async_set = 0); + public: Variant t_stats(int64 clear = 0); + + // implemented by HPHP + public: ObjectData *create(String name, bool persistent = true, int64 npoolprefix = k_MCC_POOLPREFIX_LEN, int64 mtu = k_MCC_MTU, int64 rxdgram_max = k_MCC_NODELAY, int64 nodelay = k_MCC_CONN_TMO_MS, int64 conn_tmo = k_MCC_CONN_TMO_MS, int64 conn_ntries = k_MCC_CONN_NTRIES, int64 tmo = k_MCC_TMO_MS, int64 dgram_ntries = k_MCC_DGRAM_NTRIES, double dgram_tmo_weight = k_MCC_DGRAM_TMO_WEIGHT, int64 server_retry_tmo = k_MCC_SERVER_RETRY_TMO_MS, int64 dgram_tmo_threshold = k_MCC_DGRAM_TMO_THRESHOLD, int64 window_max = k_MCC_WINDOW_MAX); + public: void dynConstruct(CArrRef Params); + public: virtual void destruct(); + + public: MccResourcePtr m_mcc; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_PHP_MCC_H__ diff --git a/src/cpp/ext/phpmcc/release/ext_php_mcc_impl.h b/src/cpp/ext/phpmcc/release/ext_php_mcc_impl.h new file mode 100644 index 0000000000000..a45f780ce7961 --- /dev/null +++ b/src/cpp/ext/phpmcc/release/ext_php_mcc_impl.h @@ -0,0 +1,126 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_PHP_MCC_IMPL_H__ +#define __EXT_PHP_MCC_IMPL_H__ + +#include + +#include "ext_php_mcc.h" +#include "ext_php_mcc_resource.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// defines + +#define PHPMCC_RESOURCE_HANDLE_NAME "phpmcc" +#define PHPMCC_ARG_COMPRESSION_THRESHOLD "compression_threshold" +#define PHPMCC_ARG_CONN_TMO "conn_tmo" +#define PHPMCC_ARG_CONN_NTRIES "conn_ntries" +#define PHPMCC_ARG_DEBUG "debug" +#define PHPMCC_ARG_DEBUG_LOGFILE "debug_logfile" +#define PHPMCC_ARG_DEFAULT_PREFIX "default_prefix" +#define PHPMCC_ARG_DELETE_PROXY "delete_proxy" +#define PHPMCC_ARG_DGRAM_TMO "dgram_tmo" +#define PHPMCC_ARG_DGRAM_NTRIES "dgram_ntries" +#define PHPMCC_ARG_DGRAM_TMO_WEIGHT "dgram_tmo_weight" +#define PHPMCC_ARG_FB_SERIALIZE_ENABLED "fb_serialize_enabled" +#define PHPMCC_ARG_CONSISTENT_HASHING_PREFIXES "consistent_hashing_prefixes" +#define PHPMCC_ARG_NODELAY "nodelay" +#define PHPMCC_ARG_PERSISTENT "persistent" +#define PHPMCC_ARG_POLL_TMO "poll_tmo" +#define PHPMCC_ARG_PROXY "proxy" +#define PHPMCC_ARG_PROXY_OPS "proxy_ops" +#define PHPMCC_ARG_SERVERS "servers" +#define PHPMCC_ARG_MIRROR_CFG "mirror_cfg" +#define PHPMCC_ARG_MIRROR_CFG_NAME "name" +#define PHPMCC_ARG_MIRROR_CFG_MODEL "model" +#define PHPMCC_ARG_MIRROR_CFG_SERVERPOOLS "serverpools" +#define PHPMCC_ARG_TMO "tmo" +#define PHPMCC_ARG_TCP_INACTIVITY_TIME "tcp_inactivity_time" +#define PHPMCC_ARG_UDP_REPLY_PORTS "udp_reply_ports" +#define PHPMCC_ARG_WINDOW_MAX "window_max" +#define PHPMCC_ARG_NZLIB_COMPRESSION "nzlib_compression" +#define PHPMCC_ARG_SERVER_RETRY_TMO_MS "server_retry_tmo" +#define PHPMCC_ARG_DGRAM_TMO_THRESHOLD "dgram_tmo_threshold" +#define PHPMCC_ARG_NPOOLPREFIX "npoolprefix" + +#define PHPMCC_COMPRESSION_THRESHOLD_DEFAULT 100 * 1024 + +#define PHPMCC_ERR_UNCOMPRESS 0x1001 +#define PHPMCC_ERR_UNSERIALIZE 0x1002 +#define PHPMCC_ERR_FB_UNSERIALIZE 0x1003 +#define PHPMCC_ERR_BAD_VALUE 0x1004 +#define PHPMCC_ERR_MIRROR_CREATE 0x1010 +#define PHPMCC_ERR_MIRROR_EXISTS 0x1011 +#define PHPMCC_ERR_MIRROR_NOT_FOUND 0x1012 +#define PHPMCC_ERR_MIRROR_CONSISTENCY 0x1013 +#define PHPMCC_ERR_MISSINGS_REQS 0x1014 +#define PHPMCC_ERR_DETAILED_BAD_ARG 0x1015 + +/////////////////////////////////////////////////////////////////////////////// +// types + +enum phpmcc_flags_t { + phpmcc_serialized = 0x1, + phpmcc_compressed = 0x2, + phpmcc_fb_serialized = 0x4, + phpmcc_proxy_replicate = 0x400, + phpmcc_nzlib_compressed = 0x800, + phpmcc_async_set = 0x1000, +}; + +enum phpmcc_get_details_t { + PHPMCC_GET_DEFAULT, /* default mode of operation. */ + PHPMCC_GET_RECORD_ERRORS, /* record the keys that caused errors */ +}; + +enum phpmcc_delete_details_t { + PHPMCC_DELETE_DELETED, /* deleted from cache */ + PHPMCC_DELETE_NOTFOUND, /* not found in cache */ + PHPMCC_DELETE_ERROR_LOG, /* delete error should be logged */ + PHPMCC_DELETE_ERROR_NOLOG, /* delete error should not be logged */ +}; + +typedef std::deque::iterator ListenerIt; +typedef std::deque::iterator ApEventIt; +typedef std::deque::iterator MirrorIt; + +/* + The context structure used to communicate between phpmcc_get(..) and the + callback functions. +*/ +typedef struct phpmcc_get_processor_context_s { + Variant* results; + Variant* additional_context; + int hits; + int errors; +} phpmcc_get_processor_context_t; + +/* + The type definition for the callbacks and the actual callback functions. +*/ +typedef void (*phpmcc_get_processor_funcptr_t) + (const nstring_t search_key, + mcc_res_t final_result, + CVarRef result, + phpmcc_get_processor_context_t* context); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_PHP_MCC_IMPL_H__ diff --git a/src/cpp/ext/phpmcc/release/ext_php_mcc_resource.h b/src/cpp/ext/phpmcc/release/ext_php_mcc_resource.h new file mode 100644 index 0000000000000..d3ebfa58d0cf5 --- /dev/null +++ b/src/cpp/ext/phpmcc/release/ext_php_mcc_resource.h @@ -0,0 +1,189 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXT_PHP_MCC_RESOURCE_H__ +#define __EXT_PHP_MCC_RESOURCE_H__ + +#include + +#define HAVE_UDP_REPLY_PORTS 1 +#include + +namespace HPHP { + +class MccResource; +typedef SmartPtr MccResourcePtr; +/////////////////////////////////////////////////////////////////////////////// +// MccListener + +class MccListener { +public: + enum ListenerType { + ErrorListener = 1, + AccessPointListener = 2, + ServerListener = 3 + }; + +public: + MccListener(ListenerType type, CStrRef function, CVarRef context) + : m_type(type), m_function(function) { + m_context = ref(context); + } + + ListenerType m_type; + String m_function; + Variant m_context; + + void onSweep() { + m_function.reset(); + m_context.reset(); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// MccApEvent + +class MccApEvent { +public: + MccApEvent(const std::string &server, const std::string &host, + const std::string &port, int protocol, + mcc_presentation_protocol_t presentation_pro, + mcc_apstate_t id) + : m_server(server), m_host(host), m_port(port), m_protocol(protocol), + m_presentation_protocol(presentation_pro), m_id(id) {} + std::string m_server; + std::string m_host; + std::string m_port; + int m_protocol; + mcc_presentation_protocol_t m_presentation_protocol; + mcc_apstate_t m_id; +}; + +/////////////////////////////////////////////////////////////////////////////// +// MccMirrorMcc + +class MccMirrorMcc { +public: + enum ConsistencyModel { + /* return values from this mcc are ignored. */ + CONSISTENCY_IGNORE, + + /* return values from this mcc must match the return value from the + * primary mcc. if the primary mcc hits, this should hit as well. if + * the primary mcc misses, this should miss as well. if there is a + * mismatch, flag a warning and return a miss. */ + CONSISTENCY_MATCH_ALL, + + /* return values from this mcc are compared with the return values from + * the primary mcc only when both hit. if there is a mismatch, flag a + * warning and return a miss. */ + CONSISTENCY_MATCH_HITS, + + /* return values from this mcc are compared with the return values from + * the primary mcc only when both hit. if there is a mismatch, flag a + * warning and return a miss. if the primary mcc misses and this mcc + * hits, then this result supercedes the primary mcc's miss. */ + CONSISTENCY_MATCH_HITS_SUPERCEDES, + }; + +public: + MccMirrorMcc(CStrRef name, ConsistencyModel model, MccResourcePtr &mcc); + ~MccMirrorMcc(); + + std::string m_name; + ConsistencyModel m_model; + mcc_handle_t m_mcc; +}; + +/////////////////////////////////////////////////////////////////////////////// +// MccResource + +class MccResource : public SweepableResourceData { +public: + static MccResourcePtr GetPersistent(CStrRef name); + +public: + MccResource(CStrRef name, bool persistent, int64 mtu, + int64 rxdgram_max, int64 nodelay); + ~MccResource(); + + bool init_mcc(int64 npoolprefix, int64 conn_tmo, int64 conn_ntries, + int64 tmo, int64 dgram_ntries, double dgram_tmo_weight, + int64 window_max, int64 server_retry_tmo, + int64 dgram_tmo_threshold); + + void removeListeners(); + bool close(); + + // overriding ResourceData + const char *o_getClassName() const { return "MccResource";} + + // overriding Sweepable + virtual void sweep(); + +public: + enum HandleStatus { + PHPMCC_NEW_HANDLE, + PHPMCC_USED_FAST_PATH, + PHPMCC_USED_SLOW_PATH, + }; + + std::string m_name; + bool m_persistent; + mcc_handle_t m_mcc; + + int m_compressed; + size_t m_nreqs; + + bool m_fb_serialize_available; + bool m_fb_serialize_enabled; + + int m_zlib_compression_enabled; + int m_nzlib_compression; + size_t m_compression_threshold; + + std::deque m_error_listeners; + std::deque m_server_listeners; + std::deque m_ap_listeners; + + std::deque m_events; + std::deque m_mirror_mccs; + + /* these are not stored in the mcc object itself, or have no accessors, so + * we have to copy them locally. */ + int64 m_mtu; + int64 m_rxdgram_max; + int32 m_nodelay; + + /* variables used by mirroring code: counts of mirrors and serverpools, + * whether or not a proxy has been set. */ + uint32 m_server_count; + uint32 m_serverpool_count; + HandleStatus m_handle_status; + bool m_fast_path_eligible; /* if this handle was created with + * different parameters, we have to + * always do the full comparison. */ + int64 m_sitevar_version; /* the sitevar version this handle was + * created with */ + time_t m_creation_time; /* time that this handle was created. */ + int64 m_proxy_ops; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXT_PHP_MCC_RESOURCE_H__ diff --git a/src/cpp/ext/profile/extprofile_apache.h b/src/cpp/ext/profile/extprofile_apache.h new file mode 100644 index 0000000000000..04c0fa8908d9e --- /dev/null +++ b/src/cpp/ext/profile/extprofile_apache.h @@ -0,0 +1,185 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_APACHE_H__ +#define __EXTPROFILE_APACHE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_apache_child_terminate f_apache_child_terminate +#else +inline bool x_apache_child_terminate() { + FUNCTION_INJECTION(apache_child_terminate); + return f_apache_child_terminate(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_get_modules f_apache_get_modules +#else +inline Array x_apache_get_modules() { + FUNCTION_INJECTION(apache_get_modules); + return f_apache_get_modules(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_get_version f_apache_get_version +#else +inline String x_apache_get_version() { + FUNCTION_INJECTION(apache_get_version); + return f_apache_get_version(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_getenv f_apache_getenv +#else +inline String x_apache_getenv(CStrRef variable, bool walk_to_top = false) { + FUNCTION_INJECTION(apache_getenv); + return f_apache_getenv(variable, walk_to_top); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_lookup_uri f_apache_lookup_uri +#else +inline Object x_apache_lookup_uri(CStrRef filename) { + FUNCTION_INJECTION(apache_lookup_uri); + return f_apache_lookup_uri(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_note f_apache_note +#else +inline Variant x_apache_note(CStrRef note_name, CStrRef note_value = null_string) { + FUNCTION_INJECTION(apache_note); + return f_apache_note(note_name, note_value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_request_headers f_apache_request_headers +#else +inline Array x_apache_request_headers() { + FUNCTION_INJECTION(apache_request_headers); + return f_apache_request_headers(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_reset_timeout f_apache_reset_timeout +#else +inline bool x_apache_reset_timeout() { + FUNCTION_INJECTION(apache_reset_timeout); + return f_apache_reset_timeout(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_response_headers f_apache_response_headers +#else +inline Array x_apache_response_headers() { + FUNCTION_INJECTION(apache_response_headers); + return f_apache_response_headers(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_setenv f_apache_setenv +#else +inline bool x_apache_setenv(CStrRef variable, CStrRef value, bool walk_to_top = false) { + FUNCTION_INJECTION(apache_setenv); + return f_apache_setenv(variable, value, walk_to_top); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ascii2ebcdic f_ascii2ebcdic +#else +inline int x_ascii2ebcdic(CStrRef ascii_str) { + FUNCTION_INJECTION(ascii2ebcdic); + return f_ascii2ebcdic(ascii_str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ebcdic2ascii f_ebcdic2ascii +#else +inline int x_ebcdic2ascii(CStrRef ebcdic_str) { + FUNCTION_INJECTION(ebcdic2ascii); + return f_ebcdic2ascii(ebcdic_str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getallheaders f_getallheaders +#else +inline Array x_getallheaders() { + FUNCTION_INJECTION(getallheaders); + return f_getallheaders(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_virtual f_virtual +#else +inline bool x_virtual(CStrRef filename) { + FUNCTION_INJECTION(virtual); + return f_virtual(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_get_config f_apache_get_config +#else +inline Variant x_apache_get_config() { + FUNCTION_INJECTION(apache_get_config); + return f_apache_get_config(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_get_scoreboard f_apache_get_scoreboard +#else +inline Variant x_apache_get_scoreboard() { + FUNCTION_INJECTION(apache_get_scoreboard); + return f_apache_get_scoreboard(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apache_get_rewrite_rules f_apache_get_rewrite_rules +#else +inline Variant x_apache_get_rewrite_rules() { + FUNCTION_INJECTION(apache_get_rewrite_rules); + return f_apache_get_rewrite_rules(); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_APACHE_H__ diff --git a/src/cpp/ext/profile/extprofile_apc.h b/src/cpp/ext/profile/extprofile_apc.h new file mode 100644 index 0000000000000..c8f0cafaf80d8 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_apc.h @@ -0,0 +1,203 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_APC_H__ +#define __EXTPROFILE_APC_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_apc_add f_apc_add +#else +inline bool x_apc_add(CStrRef key, CVarRef var, int64 ttl = 0, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_add); + return f_apc_add(key, var, ttl, cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_store f_apc_store +#else +inline bool x_apc_store(CStrRef key, CVarRef var, int64 ttl = 0, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_store); + return f_apc_store(key, var, ttl, cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_fetch f_apc_fetch +#else +inline Variant x_apc_fetch(CVarRef key, Variant success = null, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_fetch); + return f_apc_fetch(key, ref(success), cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_delete f_apc_delete +#else +inline Variant x_apc_delete(CVarRef key, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_delete); + return f_apc_delete(key, cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_compile_file f_apc_compile_file +#else +inline bool x_apc_compile_file(CStrRef filename, bool atomic = true, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_compile_file); + return f_apc_compile_file(filename, atomic, cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_cache_info f_apc_cache_info +#else +inline Variant x_apc_cache_info(int64 cache_id = 0, bool limited = false) { + FUNCTION_INJECTION(apc_cache_info); + return f_apc_cache_info(cache_id, limited); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_clear_cache f_apc_clear_cache +#else +inline bool x_apc_clear_cache(int64 cache_id = 0) { + FUNCTION_INJECTION(apc_clear_cache); + return f_apc_clear_cache(cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_define_constants f_apc_define_constants +#else +inline bool x_apc_define_constants(CStrRef key, CStrRef constants, bool case_sensitive = true, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_define_constants); + return f_apc_define_constants(key, constants, case_sensitive, cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_load_constants f_apc_load_constants +#else +inline bool x_apc_load_constants(CStrRef key, bool case_sensitive = true, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_load_constants); + return f_apc_load_constants(key, case_sensitive, cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_sma_info f_apc_sma_info +#else +inline Array x_apc_sma_info(bool limited = false) { + FUNCTION_INJECTION(apc_sma_info); + return f_apc_sma_info(limited); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_filehits f_apc_filehits +#else +inline Array x_apc_filehits() { + FUNCTION_INJECTION(apc_filehits); + return f_apc_filehits(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_delete_file f_apc_delete_file +#else +inline Variant x_apc_delete_file(CVarRef keys, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_delete_file); + return f_apc_delete_file(keys, cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_inc f_apc_inc +#else +inline Variant x_apc_inc(CStrRef key, int64 step = 1, Variant success = null, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_inc); + return f_apc_inc(key, step, ref(success), cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_dec f_apc_dec +#else +inline Variant x_apc_dec(CStrRef key, int64 step = 1, Variant success = null, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_dec); + return f_apc_dec(key, step, ref(success), cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_cas f_apc_cas +#else +inline bool x_apc_cas(CStrRef key, int64 old_cas, int64 new_cas, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_cas); + return f_apc_cas(key, old_cas, new_cas, cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_bin_dump f_apc_bin_dump +#else +inline Variant x_apc_bin_dump(int64 cache_id = 0, CVarRef filter = null_variant) { + FUNCTION_INJECTION(apc_bin_dump); + return f_apc_bin_dump(cache_id, filter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_bin_load f_apc_bin_load +#else +inline bool x_apc_bin_load(CStrRef data, int64 flags = 0, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_bin_load); + return f_apc_bin_load(data, flags, cache_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_bin_dumpfile f_apc_bin_dumpfile +#else +inline Variant x_apc_bin_dumpfile(int64 cache_id, CVarRef filter, CStrRef filename, int64 flags = 0, CObjRef context = null) { + FUNCTION_INJECTION(apc_bin_dumpfile); + return f_apc_bin_dumpfile(cache_id, filter, filename, flags, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apc_bin_loadfile f_apc_bin_loadfile +#else +inline bool x_apc_bin_loadfile(CStrRef filename, CObjRef context = null, int64 flags = 0, int64 cache_id = 0) { + FUNCTION_INJECTION(apc_bin_loadfile); + return f_apc_bin_loadfile(filename, context, flags, cache_id); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_APC_H__ diff --git a/src/cpp/ext/profile/extprofile_apd.h b/src/cpp/ext/profile/extprofile_apd.h new file mode 100644 index 0000000000000..41e7a822b57d9 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_apd.h @@ -0,0 +1,113 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_APD_H__ +#define __EXTPROFILE_APD_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_override_function f_override_function +#else +inline bool x_override_function(CStrRef name, CStrRef args, CStrRef code) { + FUNCTION_INJECTION(override_function); + return f_override_function(name, args, code); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rename_function f_rename_function +#else +inline bool x_rename_function(CStrRef orig_name, CStrRef new_name) { + FUNCTION_INJECTION(rename_function); + return f_rename_function(orig_name, new_name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apd_set_browser_trace f_apd_set_browser_trace +#else +inline void x_apd_set_browser_trace() { + FUNCTION_INJECTION(apd_set_browser_trace); + f_apd_set_browser_trace(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apd_set_pprof_trace f_apd_set_pprof_trace +#else +inline String x_apd_set_pprof_trace(CStrRef dumpdir = null_string, CStrRef frament = null_string) { + FUNCTION_INJECTION(apd_set_pprof_trace); + return f_apd_set_pprof_trace(dumpdir, frament); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apd_set_session_trace_socket f_apd_set_session_trace_socket +#else +inline bool x_apd_set_session_trace_socket(CStrRef ip_or_filename, int domain, int port, int mask) { + FUNCTION_INJECTION(apd_set_session_trace_socket); + return f_apd_set_session_trace_socket(ip_or_filename, domain, port, mask); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apd_stop_trace f_apd_stop_trace +#else +inline void x_apd_stop_trace() { + FUNCTION_INJECTION(apd_stop_trace); + f_apd_stop_trace(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apd_breakpoint f_apd_breakpoint +#else +inline bool x_apd_breakpoint() { + FUNCTION_INJECTION(apd_breakpoint); + return f_apd_breakpoint(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apd_continue f_apd_continue +#else +inline bool x_apd_continue() { + FUNCTION_INJECTION(apd_continue); + return f_apd_continue(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_apd_echo f_apd_echo +#else +inline bool x_apd_echo(CStrRef output) { + FUNCTION_INJECTION(apd_echo); + return f_apd_echo(output); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_APD_H__ diff --git a/src/cpp/ext/profile/extprofile_array.h b/src/cpp/ext/profile/extprofile_array.h new file mode 100644 index 0000000000000..6307aafbf6bcc --- /dev/null +++ b/src/cpp/ext/profile/extprofile_array.h @@ -0,0 +1,725 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_ARRAY_H__ +#define __EXTPROFILE_ARRAY_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_array_change_key_case f_array_change_key_case +#else +inline Variant x_array_change_key_case(CVarRef input, bool upper = false) { + FUNCTION_INJECTION(array_change_key_case); + return f_array_change_key_case(input, upper); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_chunk f_array_chunk +#else +inline Variant x_array_chunk(CVarRef input, int size, bool preserve_keys = false) { + FUNCTION_INJECTION(array_chunk); + return f_array_chunk(input, size, preserve_keys); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_combine f_array_combine +#else +inline Variant x_array_combine(CVarRef keys, CVarRef values) { + FUNCTION_INJECTION(array_combine); + return f_array_combine(keys, values); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_count_values f_array_count_values +#else +inline Variant x_array_count_values(CVarRef input) { + FUNCTION_INJECTION(array_count_values); + return f_array_count_values(input); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_fill_keys f_array_fill_keys +#else +inline Variant x_array_fill_keys(CVarRef keys, CVarRef value) { + FUNCTION_INJECTION(array_fill_keys); + return f_array_fill_keys(keys, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_fill f_array_fill +#else +inline Array x_array_fill(int start_index, int num, CVarRef value) { + FUNCTION_INJECTION(array_fill); + return f_array_fill(start_index, num, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_filter f_array_filter +#else +inline Variant x_array_filter(CVarRef input, CVarRef callback = null_variant) { + FUNCTION_INJECTION(array_filter); + return f_array_filter(input, callback); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_flip f_array_flip +#else +inline Variant x_array_flip(CVarRef trans) { + FUNCTION_INJECTION(array_flip); + return f_array_flip(trans); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_key_exists f_array_key_exists +#else +inline bool x_array_key_exists(CVarRef key, CVarRef search) { + FUNCTION_INJECTION(array_key_exists); + return f_array_key_exists(key, search); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_keys f_array_keys +#else +inline Variant x_array_keys(CVarRef input, CVarRef search_value = null_variant, bool strict = false) { + FUNCTION_INJECTION(array_keys); + return f_array_keys(input, search_value, strict); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_map f_array_map +#else +inline Variant x_array_map(int _argc, CVarRef callback, CVarRef arr1, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_map); + return f_array_map(_argc, callback, arr1, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_merge_recursive f_array_merge_recursive +#else +inline Variant x_array_merge_recursive(int _argc, CVarRef array1, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_merge_recursive); + return f_array_merge_recursive(_argc, array1, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_merge f_array_merge +#else +inline Variant x_array_merge(int _argc, CVarRef array1, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_merge); + return f_array_merge(_argc, array1, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_multisort f_array_multisort +#else +inline bool x_array_multisort(int _argc, Variant ar1, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_multisort); + return f_array_multisort(_argc, ref(ar1), _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_pad f_array_pad +#else +inline Variant x_array_pad(CVarRef input, int pad_size, CVarRef pad_value) { + FUNCTION_INJECTION(array_pad); + return f_array_pad(input, pad_size, pad_value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_pop f_array_pop +#else +inline Variant x_array_pop(Variant array) { + FUNCTION_INJECTION(array_pop); + return f_array_pop(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_product f_array_product +#else +inline Variant x_array_product(CVarRef array) { + FUNCTION_INJECTION(array_product); + return f_array_product(array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_push f_array_push +#else +inline Variant x_array_push(int _argc, Variant array, CVarRef var, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_push); + return f_array_push(_argc, ref(array), var, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_rand f_array_rand +#else +inline Variant x_array_rand(CVarRef input, int num_req = 1) { + FUNCTION_INJECTION(array_rand); + return f_array_rand(input, num_req); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_reduce f_array_reduce +#else +inline Variant x_array_reduce(CVarRef input, CVarRef callback, CVarRef initial = null_variant) { + FUNCTION_INJECTION(array_reduce); + return f_array_reduce(input, callback, initial); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_reverse f_array_reverse +#else +inline Variant x_array_reverse(CVarRef array, bool preserve_keys = false) { + FUNCTION_INJECTION(array_reverse); + return f_array_reverse(array, preserve_keys); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_search f_array_search +#else +inline Variant x_array_search(CVarRef needle, CVarRef haystack, bool strict = false) { + FUNCTION_INJECTION(array_search); + return f_array_search(needle, haystack, strict); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_shift f_array_shift +#else +inline Variant x_array_shift(Variant array) { + FUNCTION_INJECTION(array_shift); + return f_array_shift(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_slice f_array_slice +#else +inline Variant x_array_slice(CVarRef array, int offset, CVarRef length = null_variant, bool preserve_keys = false) { + FUNCTION_INJECTION(array_slice); + return f_array_slice(array, offset, length, preserve_keys); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_splice f_array_splice +#else +inline Variant x_array_splice(Variant input, int offset, CVarRef length = null_variant, CVarRef replacement = null_variant) { + FUNCTION_INJECTION(array_splice); + return f_array_splice(ref(input), offset, length, replacement); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_sum f_array_sum +#else +inline Variant x_array_sum(CVarRef array) { + FUNCTION_INJECTION(array_sum); + return f_array_sum(array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_unique f_array_unique +#else +inline Variant x_array_unique(CVarRef array) { + FUNCTION_INJECTION(array_unique); + return f_array_unique(array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_unshift f_array_unshift +#else +inline int x_array_unshift(int _argc, Variant array, CVarRef var, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_unshift); + return f_array_unshift(_argc, ref(array), var, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_values f_array_values +#else +inline Variant x_array_values(CVarRef input) { + FUNCTION_INJECTION(array_values); + return f_array_values(input); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_walk_recursive f_array_walk_recursive +#else +inline bool x_array_walk_recursive(Variant input, CVarRef funcname, CVarRef userdata = null_variant) { + FUNCTION_INJECTION(array_walk_recursive); + return f_array_walk_recursive(ref(input), funcname, userdata); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_walk f_array_walk +#else +inline bool x_array_walk(Variant input, CVarRef funcname, CVarRef userdata = null_variant) { + FUNCTION_INJECTION(array_walk); + return f_array_walk(ref(input), funcname, userdata); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_compact f_compact +#else +inline Array x_compact(int _argc, CVarRef varname, CArrRef _argv = null_array) { + FUNCTION_INJECTION(compact); + return f_compact(_argc, varname, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_shuffle f_shuffle +#else +inline bool x_shuffle(Variant array) { + FUNCTION_INJECTION(shuffle); + return f_shuffle(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_count f_count +#else +inline int x_count(CVarRef var, bool recursive = false) { + FUNCTION_INJECTION(count); + return f_count(var, recursive); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sizeof f_sizeof +#else +inline int x_sizeof(CVarRef var, bool recursive = false) { + FUNCTION_INJECTION(sizeof); + return f_sizeof(var, recursive); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_each f_each +#else +inline Variant x_each(Variant array) { + FUNCTION_INJECTION(each); + return f_each(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_current f_current +#else +inline Variant x_current(Variant array) { + FUNCTION_INJECTION(current); + return f_current(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_next f_next +#else +inline Variant x_next(Variant array) { + FUNCTION_INJECTION(next); + return f_next(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pos f_pos +#else +inline Variant x_pos(Variant array) { + FUNCTION_INJECTION(pos); + return f_pos(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_prev f_prev +#else +inline Variant x_prev(Variant array) { + FUNCTION_INJECTION(prev); + return f_prev(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_reset f_reset +#else +inline Variant x_reset(Variant array) { + FUNCTION_INJECTION(reset); + return f_reset(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_end f_end +#else +inline Variant x_end(Variant array) { + FUNCTION_INJECTION(end); + return f_end(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_in_array f_in_array +#else +inline bool x_in_array(CVarRef needle, CVarRef haystack, bool strict = false) { + FUNCTION_INJECTION(in_array); + return f_in_array(needle, haystack, strict); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_key f_key +#else +inline Variant x_key(Variant array) { + FUNCTION_INJECTION(key); + return f_key(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_range f_range +#else +inline Array x_range(CVarRef low, CVarRef high, CVarRef step = 1) { + FUNCTION_INJECTION(range); + return f_range(low, high, step); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_diff f_array_diff +#else +inline Variant x_array_diff(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_diff); + return f_array_diff(_argc, array1, array2, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_udiff f_array_udiff +#else +inline Variant x_array_udiff(int _argc, CVarRef array1, CVarRef array2, CVarRef data_compare_func, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_udiff); + return f_array_udiff(_argc, array1, array2, data_compare_func, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_diff_assoc f_array_diff_assoc +#else +inline Variant x_array_diff_assoc(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_diff_assoc); + return f_array_diff_assoc(_argc, array1, array2, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_diff_uassoc f_array_diff_uassoc +#else +inline Variant x_array_diff_uassoc(int _argc, CVarRef array1, CVarRef array2, CVarRef key_compare_func, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_diff_uassoc); + return f_array_diff_uassoc(_argc, array1, array2, key_compare_func, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_udiff_assoc f_array_udiff_assoc +#else +inline Variant x_array_udiff_assoc(int _argc, CVarRef array1, CVarRef array2, CVarRef data_compare_func, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_udiff_assoc); + return f_array_udiff_assoc(_argc, array1, array2, data_compare_func, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_udiff_uassoc f_array_udiff_uassoc +#else +inline Variant x_array_udiff_uassoc(int _argc, CVarRef array1, CVarRef array2, CVarRef data_compare_func, CVarRef key_compare_func, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_udiff_uassoc); + return f_array_udiff_uassoc(_argc, array1, array2, data_compare_func, key_compare_func, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_diff_key f_array_diff_key +#else +inline Variant x_array_diff_key(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_diff_key); + return f_array_diff_key(_argc, array1, array2, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_diff_ukey f_array_diff_ukey +#else +inline Variant x_array_diff_ukey(int _argc, CVarRef array1, CVarRef array2, CVarRef key_compare_func, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_diff_ukey); + return f_array_diff_ukey(_argc, array1, array2, key_compare_func, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_intersect f_array_intersect +#else +inline Variant x_array_intersect(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_intersect); + return f_array_intersect(_argc, array1, array2, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_uintersect f_array_uintersect +#else +inline Variant x_array_uintersect(int _argc, CVarRef array1, CVarRef array2, CVarRef data_compare_func, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_uintersect); + return f_array_uintersect(_argc, array1, array2, data_compare_func, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_intersect_assoc f_array_intersect_assoc +#else +inline Variant x_array_intersect_assoc(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_intersect_assoc); + return f_array_intersect_assoc(_argc, array1, array2, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_intersect_uassoc f_array_intersect_uassoc +#else +inline Variant x_array_intersect_uassoc(int _argc, CVarRef array1, CVarRef array2, CVarRef key_compare_func, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_intersect_uassoc); + return f_array_intersect_uassoc(_argc, array1, array2, key_compare_func, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_uintersect_assoc f_array_uintersect_assoc +#else +inline Variant x_array_uintersect_assoc(int _argc, CVarRef array1, CVarRef array2, CVarRef data_compare_func, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_uintersect_assoc); + return f_array_uintersect_assoc(_argc, array1, array2, data_compare_func, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_uintersect_uassoc f_array_uintersect_uassoc +#else +inline Variant x_array_uintersect_uassoc(int _argc, CVarRef array1, CVarRef array2, CVarRef data_compare_func, CVarRef key_compare_func, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_uintersect_uassoc); + return f_array_uintersect_uassoc(_argc, array1, array2, data_compare_func, key_compare_func, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_intersect_key f_array_intersect_key +#else +inline Variant x_array_intersect_key(int _argc, CVarRef array1, CVarRef array2, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_intersect_key); + return f_array_intersect_key(_argc, array1, array2, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_array_intersect_ukey f_array_intersect_ukey +#else +inline Variant x_array_intersect_ukey(int _argc, CVarRef array1, CVarRef array2, CVarRef key_compare_func, CArrRef _argv = null_array) { + FUNCTION_INJECTION(array_intersect_ukey); + return f_array_intersect_ukey(_argc, array1, array2, key_compare_func, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sort f_sort +#else +inline bool x_sort(Variant array, int sort_flags = 0, bool use_collator = false) { + FUNCTION_INJECTION(sort); + return f_sort(ref(array), sort_flags, use_collator); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rsort f_rsort +#else +inline bool x_rsort(Variant array, int sort_flags = 0, bool use_collator = false) { + FUNCTION_INJECTION(rsort); + return f_rsort(ref(array), sort_flags, use_collator); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_asort f_asort +#else +inline bool x_asort(Variant array, int sort_flags = 0, bool use_collator = false) { + FUNCTION_INJECTION(asort); + return f_asort(ref(array), sort_flags, use_collator); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_arsort f_arsort +#else +inline bool x_arsort(Variant array, int sort_flags = 0, bool use_collator = false) { + FUNCTION_INJECTION(arsort); + return f_arsort(ref(array), sort_flags, use_collator); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ksort f_ksort +#else +inline bool x_ksort(Variant array, int sort_flags = 0) { + FUNCTION_INJECTION(ksort); + return f_ksort(ref(array), sort_flags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_krsort f_krsort +#else +inline bool x_krsort(Variant array, int sort_flags = 0) { + FUNCTION_INJECTION(krsort); + return f_krsort(ref(array), sort_flags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_usort f_usort +#else +inline bool x_usort(Variant array, CVarRef cmp_function) { + FUNCTION_INJECTION(usort); + return f_usort(ref(array), cmp_function); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_uasort f_uasort +#else +inline bool x_uasort(Variant array, CVarRef cmp_function) { + FUNCTION_INJECTION(uasort); + return f_uasort(ref(array), cmp_function); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_uksort f_uksort +#else +inline bool x_uksort(Variant array, CVarRef cmp_function) { + FUNCTION_INJECTION(uksort); + return f_uksort(ref(array), cmp_function); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_natsort f_natsort +#else +inline Variant x_natsort(Variant array) { + FUNCTION_INJECTION(natsort); + return f_natsort(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_natcasesort f_natcasesort +#else +inline Variant x_natcasesort(Variant array) { + FUNCTION_INJECTION(natcasesort); + return f_natcasesort(ref(array)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_i18n_loc_get_default f_i18n_loc_get_default +#else +inline String x_i18n_loc_get_default() { + FUNCTION_INJECTION(i18n_loc_get_default); + return f_i18n_loc_get_default(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_i18n_loc_set_default f_i18n_loc_set_default +#else +inline bool x_i18n_loc_set_default(CStrRef locale) { + FUNCTION_INJECTION(i18n_loc_set_default); + return f_i18n_loc_set_default(locale); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_i18n_loc_set_attribute f_i18n_loc_set_attribute +#else +inline bool x_i18n_loc_set_attribute(int64 attr, int64 val) { + FUNCTION_INJECTION(i18n_loc_set_attribute); + return f_i18n_loc_set_attribute(attr, val); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_i18n_loc_set_strength f_i18n_loc_set_strength +#else +inline bool x_i18n_loc_set_strength(int64 strength) { + FUNCTION_INJECTION(i18n_loc_set_strength); + return f_i18n_loc_set_strength(strength); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_i18n_loc_get_error_code f_i18n_loc_get_error_code +#else +inline Variant x_i18n_loc_get_error_code() { + FUNCTION_INJECTION(i18n_loc_get_error_code); + return f_i18n_loc_get_error_code(); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_ARRAY_H__ diff --git a/src/cpp/ext/profile/extprofile_bcmath.h b/src/cpp/ext/profile/extprofile_bcmath.h new file mode 100644 index 0000000000000..36a8abc0cc12c --- /dev/null +++ b/src/cpp/ext/profile/extprofile_bcmath.h @@ -0,0 +1,122 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_BCMATH_H__ +#define __EXTPROFILE_BCMATH_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_bcscale f_bcscale +#else +inline bool x_bcscale(int64 scale) { + FUNCTION_INJECTION(bcscale); + return f_bcscale(scale); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bcadd f_bcadd +#else +inline String x_bcadd(CStrRef left, CStrRef right, int64 scale = -1) { + FUNCTION_INJECTION(bcadd); + return f_bcadd(left, right, scale); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bcsub f_bcsub +#else +inline String x_bcsub(CStrRef left, CStrRef right, int64 scale = -1) { + FUNCTION_INJECTION(bcsub); + return f_bcsub(left, right, scale); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bccomp f_bccomp +#else +inline int64 x_bccomp(CStrRef left, CStrRef right, int64 scale = -1) { + FUNCTION_INJECTION(bccomp); + return f_bccomp(left, right, scale); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bcmul f_bcmul +#else +inline String x_bcmul(CStrRef left, CStrRef right, int64 scale = -1) { + FUNCTION_INJECTION(bcmul); + return f_bcmul(left, right, scale); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bcdiv f_bcdiv +#else +inline String x_bcdiv(CStrRef left, CStrRef right, int64 scale = -1) { + FUNCTION_INJECTION(bcdiv); + return f_bcdiv(left, right, scale); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bcmod f_bcmod +#else +inline String x_bcmod(CStrRef left, CStrRef right) { + FUNCTION_INJECTION(bcmod); + return f_bcmod(left, right); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bcpow f_bcpow +#else +inline String x_bcpow(CStrRef left, CStrRef right, int64 scale = -1) { + FUNCTION_INJECTION(bcpow); + return f_bcpow(left, right, scale); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bcpowmod f_bcpowmod +#else +inline Variant x_bcpowmod(CStrRef left, CStrRef right, CStrRef modulus, int64 scale = -1) { + FUNCTION_INJECTION(bcpowmod); + return f_bcpowmod(left, right, modulus, scale); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bcsqrt f_bcsqrt +#else +inline Variant x_bcsqrt(CStrRef operand, int64 scale = -1) { + FUNCTION_INJECTION(bcsqrt); + return f_bcsqrt(operand, scale); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_BCMATH_H__ diff --git a/src/cpp/ext/profile/extprofile_class.h b/src/cpp/ext/profile/extprofile_class.h new file mode 100644 index 0000000000000..a083acfb223ef --- /dev/null +++ b/src/cpp/ext/profile/extprofile_class.h @@ -0,0 +1,167 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_CLASS_H__ +#define __EXTPROFILE_CLASS_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_get_declared_classes f_get_declared_classes +#else +inline Array x_get_declared_classes() { + FUNCTION_INJECTION(get_declared_classes); + return f_get_declared_classes(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_declared_interfaces f_get_declared_interfaces +#else +inline Array x_get_declared_interfaces() { + FUNCTION_INJECTION(get_declared_interfaces); + return f_get_declared_interfaces(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_class_exists f_class_exists +#else +inline bool x_class_exists(CStrRef class_name, bool autoload = false) { + FUNCTION_INJECTION(class_exists); + return f_class_exists(class_name, autoload); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_interface_exists f_interface_exists +#else +inline bool x_interface_exists(CStrRef interface_name, bool autoload = false) { + FUNCTION_INJECTION(interface_exists); + return f_interface_exists(interface_name, autoload); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_class_methods f_get_class_methods +#else +inline Array x_get_class_methods(CVarRef class_or_object) { + FUNCTION_INJECTION(get_class_methods); + return f_get_class_methods(class_or_object); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_class_vars f_get_class_vars +#else +inline Array x_get_class_vars(CStrRef class_name) { + FUNCTION_INJECTION(get_class_vars); + return f_get_class_vars(class_name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_class f_get_class +#else +inline Variant x_get_class(CVarRef object = null_variant) { + FUNCTION_INJECTION(get_class); + return f_get_class(object); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_parent_class f_get_parent_class +#else +inline Variant x_get_parent_class(CVarRef object = null_variant) { + FUNCTION_INJECTION(get_parent_class); + return f_get_parent_class(object); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_a f_is_a +#else +inline bool x_is_a(CObjRef object, CStrRef class_name) { + FUNCTION_INJECTION(is_a); + return f_is_a(object, class_name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_subclass_of f_is_subclass_of +#else +inline bool x_is_subclass_of(CVarRef class_or_object, CStrRef class_name) { + FUNCTION_INJECTION(is_subclass_of); + return f_is_subclass_of(class_or_object, class_name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_method_exists f_method_exists +#else +inline bool x_method_exists(CVarRef class_or_object, CStrRef method_name) { + FUNCTION_INJECTION(method_exists); + return f_method_exists(class_or_object, method_name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_property_exists f_property_exists +#else +inline bool x_property_exists(CVarRef class_or_object, CStrRef property) { + FUNCTION_INJECTION(property_exists); + return f_property_exists(class_or_object, property); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_object_vars f_get_object_vars +#else +inline Array x_get_object_vars(CObjRef object) { + FUNCTION_INJECTION(get_object_vars); + return f_get_object_vars(object); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_call_user_method_array f_call_user_method_array +#else +inline Variant x_call_user_method_array(CStrRef method_name, Variant obj, CArrRef paramarr) { + FUNCTION_INJECTION(call_user_method_array); + return f_call_user_method_array(method_name, ref(obj), paramarr); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_call_user_method f_call_user_method +#else +inline Variant x_call_user_method(int _argc, CStrRef method_name, Variant obj, CArrRef _argv = null_array) { + FUNCTION_INJECTION(call_user_method); + return f_call_user_method(_argc, method_name, ref(obj), _argv); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_CLASS_H__ diff --git a/src/cpp/ext/profile/extprofile_ctype.h b/src/cpp/ext/profile/extprofile_ctype.h new file mode 100644 index 0000000000000..32e62f321de4b --- /dev/null +++ b/src/cpp/ext/profile/extprofile_ctype.h @@ -0,0 +1,131 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_CTYPE_H__ +#define __EXTPROFILE_CTYPE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_ctype_alnum f_ctype_alnum +#else +inline bool x_ctype_alnum(CVarRef text) { + FUNCTION_INJECTION(ctype_alnum); + return f_ctype_alnum(text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ctype_alpha f_ctype_alpha +#else +inline bool x_ctype_alpha(CVarRef text) { + FUNCTION_INJECTION(ctype_alpha); + return f_ctype_alpha(text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ctype_cntrl f_ctype_cntrl +#else +inline bool x_ctype_cntrl(CVarRef text) { + FUNCTION_INJECTION(ctype_cntrl); + return f_ctype_cntrl(text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ctype_digit f_ctype_digit +#else +inline bool x_ctype_digit(CVarRef text) { + FUNCTION_INJECTION(ctype_digit); + return f_ctype_digit(text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ctype_graph f_ctype_graph +#else +inline bool x_ctype_graph(CVarRef text) { + FUNCTION_INJECTION(ctype_graph); + return f_ctype_graph(text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ctype_lower f_ctype_lower +#else +inline bool x_ctype_lower(CVarRef text) { + FUNCTION_INJECTION(ctype_lower); + return f_ctype_lower(text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ctype_print f_ctype_print +#else +inline bool x_ctype_print(CVarRef text) { + FUNCTION_INJECTION(ctype_print); + return f_ctype_print(text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ctype_punct f_ctype_punct +#else +inline bool x_ctype_punct(CVarRef text) { + FUNCTION_INJECTION(ctype_punct); + return f_ctype_punct(text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ctype_space f_ctype_space +#else +inline bool x_ctype_space(CVarRef text) { + FUNCTION_INJECTION(ctype_space); + return f_ctype_space(text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ctype_upper f_ctype_upper +#else +inline bool x_ctype_upper(CVarRef text) { + FUNCTION_INJECTION(ctype_upper); + return f_ctype_upper(text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ctype_xdigit f_ctype_xdigit +#else +inline bool x_ctype_xdigit(CVarRef text) { + FUNCTION_INJECTION(ctype_xdigit); + return f_ctype_xdigit(text); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_CTYPE_H__ diff --git a/src/cpp/ext/profile/extprofile_curl.h b/src/cpp/ext/profile/extprofile_curl.h new file mode 100644 index 0000000000000..dfd74ff2738c5 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_curl.h @@ -0,0 +1,248 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_CURL_H__ +#define __EXTPROFILE_CURL_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_curl_init f_curl_init +#else +inline Variant x_curl_init(CStrRef url = null_string) { + FUNCTION_INJECTION(curl_init); + return f_curl_init(url); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_copy_handle f_curl_copy_handle +#else +inline Object x_curl_copy_handle(CObjRef ch) { + FUNCTION_INJECTION(curl_copy_handle); + return f_curl_copy_handle(ch); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_version f_curl_version +#else +inline Variant x_curl_version(int uversion = CURLVERSION_NOW) { + FUNCTION_INJECTION(curl_version); + return f_curl_version(uversion); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_setopt f_curl_setopt +#else +inline bool x_curl_setopt(CObjRef ch, int option, CVarRef value) { + FUNCTION_INJECTION(curl_setopt); + return f_curl_setopt(ch, option, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_setopt_array f_curl_setopt_array +#else +inline bool x_curl_setopt_array(CObjRef ch, CArrRef options) { + FUNCTION_INJECTION(curl_setopt_array); + return f_curl_setopt_array(ch, options); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_exec f_curl_exec +#else +inline Variant x_curl_exec(CObjRef ch) { + FUNCTION_INJECTION(curl_exec); + return f_curl_exec(ch); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_getinfo f_curl_getinfo +#else +inline Variant x_curl_getinfo(CObjRef ch, int opt = 0) { + FUNCTION_INJECTION(curl_getinfo); + return f_curl_getinfo(ch, opt); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_errno f_curl_errno +#else +inline int x_curl_errno(CObjRef ch) { + FUNCTION_INJECTION(curl_errno); + return f_curl_errno(ch); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_error f_curl_error +#else +inline String x_curl_error(CObjRef ch) { + FUNCTION_INJECTION(curl_error); + return f_curl_error(ch); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_close f_curl_close +#else +inline void x_curl_close(CObjRef ch) { + FUNCTION_INJECTION(curl_close); + f_curl_close(ch); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_multi_init f_curl_multi_init +#else +inline Object x_curl_multi_init() { + FUNCTION_INJECTION(curl_multi_init); + return f_curl_multi_init(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_multi_add_handle f_curl_multi_add_handle +#else +inline int x_curl_multi_add_handle(CObjRef mh, CObjRef ch) { + FUNCTION_INJECTION(curl_multi_add_handle); + return f_curl_multi_add_handle(mh, ch); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_multi_remove_handle f_curl_multi_remove_handle +#else +inline int x_curl_multi_remove_handle(CObjRef mh, CObjRef ch) { + FUNCTION_INJECTION(curl_multi_remove_handle); + return f_curl_multi_remove_handle(mh, ch); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_multi_exec f_curl_multi_exec +#else +inline int x_curl_multi_exec(CObjRef mh, Variant still_running) { + FUNCTION_INJECTION(curl_multi_exec); + return f_curl_multi_exec(mh, ref(still_running)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_multi_select f_curl_multi_select +#else +inline int x_curl_multi_select(CObjRef mh, double timeout = 1.0) { + FUNCTION_INJECTION(curl_multi_select); + return f_curl_multi_select(mh, timeout); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_multi_getcontent f_curl_multi_getcontent +#else +inline String x_curl_multi_getcontent(CObjRef ch) { + FUNCTION_INJECTION(curl_multi_getcontent); + return f_curl_multi_getcontent(ch); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_multi_info_read f_curl_multi_info_read +#else +inline Variant x_curl_multi_info_read(CObjRef mh, Variant msgs_in_queue = null) { + FUNCTION_INJECTION(curl_multi_info_read); + return f_curl_multi_info_read(mh, ref(msgs_in_queue)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_curl_multi_close f_curl_multi_close +#else +inline void x_curl_multi_close(CObjRef mh) { + FUNCTION_INJECTION(curl_multi_close); + f_curl_multi_close(mh); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_evhttp_set_cache f_evhttp_set_cache +#else +inline void x_evhttp_set_cache(CStrRef address, int max_conn, int port = 80) { + FUNCTION_INJECTION(evhttp_set_cache); + f_evhttp_set_cache(address, max_conn, port); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_evhttp_get f_evhttp_get +#else +inline Variant x_evhttp_get(CStrRef url, CArrRef headers = null_array, int timeout = 5) { + FUNCTION_INJECTION(evhttp_get); + return f_evhttp_get(url, headers, timeout); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_evhttp_post f_evhttp_post +#else +inline Variant x_evhttp_post(CStrRef url, CStrRef data, CArrRef headers = null_array, int timeout = 5) { + FUNCTION_INJECTION(evhttp_post); + return f_evhttp_post(url, data, headers, timeout); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_evhttp_async_get f_evhttp_async_get +#else +inline Variant x_evhttp_async_get(CStrRef url, CArrRef headers = null_array, int timeout = 5) { + FUNCTION_INJECTION(evhttp_async_get); + return f_evhttp_async_get(url, headers, timeout); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_evhttp_async_post f_evhttp_async_post +#else +inline Variant x_evhttp_async_post(CStrRef url, CStrRef data, CArrRef headers = null_array, int timeout = 5) { + FUNCTION_INJECTION(evhttp_async_post); + return f_evhttp_async_post(url, data, headers, timeout); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_evhttp_recv f_evhttp_recv +#else +inline Variant x_evhttp_recv(CObjRef handle) { + FUNCTION_INJECTION(evhttp_recv); + return f_evhttp_recv(handle); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_CURL_H__ diff --git a/src/cpp/ext/profile/extprofile_datetime.h b/src/cpp/ext/profile/extprofile_datetime.h new file mode 100644 index 0000000000000..57041df049b88 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_datetime.h @@ -0,0 +1,349 @@ + +#ifndef __EXTPROFILE_DATETIME_H__ +#define __EXTPROFILE_DATETIME_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_checkdate f_checkdate +#else +inline bool x_checkdate(int month, int day, int year) { + FUNCTION_INJECTION(checkdate); + return f_checkdate(month, day, year); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_create f_date_create +#else +inline Object x_date_create(CStrRef time = null_string, CObjRef timezone = null_object) { + FUNCTION_INJECTION(date_create); + return f_date_create(time, timezone); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_date_set f_date_date_set +#else +inline void x_date_date_set(CObjRef object, int year, int month, int day) { + FUNCTION_INJECTION(date_date_set); + f_date_date_set(object, year, month, day); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_default_timezone_get f_date_default_timezone_get +#else +inline String x_date_default_timezone_get() { + FUNCTION_INJECTION(date_default_timezone_get); + return f_date_default_timezone_get(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_default_timezone_set f_date_default_timezone_set +#else +inline bool x_date_default_timezone_set(CStrRef name) { + FUNCTION_INJECTION(date_default_timezone_set); + return f_date_default_timezone_set(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_format f_date_format +#else +inline String x_date_format(CObjRef object, CStrRef format) { + FUNCTION_INJECTION(date_format); + return f_date_format(object, format); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_isodate_set f_date_isodate_set +#else +inline void x_date_isodate_set(CObjRef object, int year, int week, int day = 1) { + FUNCTION_INJECTION(date_isodate_set); + f_date_isodate_set(object, year, week, day); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_modify f_date_modify +#else +inline void x_date_modify(CObjRef object, CStrRef modify) { + FUNCTION_INJECTION(date_modify); + f_date_modify(object, modify); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_offset_get f_date_offset_get +#else +inline int x_date_offset_get(CObjRef object) { + FUNCTION_INJECTION(date_offset_get); + return f_date_offset_get(object); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_parse f_date_parse +#else +inline Variant x_date_parse(CStrRef date) { + FUNCTION_INJECTION(date_parse); + return f_date_parse(date); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_sun_info f_date_sun_info +#else +inline Array x_date_sun_info(int64 ts, double latitude, double longitude) { + FUNCTION_INJECTION(date_sun_info); + return f_date_sun_info(ts, latitude, longitude); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_sunrise f_date_sunrise +#else +inline Variant x_date_sunrise(int64 timestamp, int format = 0, double latitude = 0.0, double longitude = 0.0, double zenith = 0.0, double gmt_offset = 99999.0) { + FUNCTION_INJECTION(date_sunrise); + return f_date_sunrise(timestamp, format, latitude, longitude, zenith, gmt_offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_sunset f_date_sunset +#else +inline Variant x_date_sunset(int64 timestamp, int format = 0, double latitude = 0.0, double longitude = 0.0, double zenith = 0.0, double gmt_offset = 99999.0) { + FUNCTION_INJECTION(date_sunset); + return f_date_sunset(timestamp, format, latitude, longitude, zenith, gmt_offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_time_set f_date_time_set +#else +inline void x_date_time_set(CObjRef object, int hour, int minute, int second = 0) { + FUNCTION_INJECTION(date_time_set); + f_date_time_set(object, hour, minute, second); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_timezone_get f_date_timezone_get +#else +inline Variant x_date_timezone_get(CObjRef object) { + FUNCTION_INJECTION(date_timezone_get); + return f_date_timezone_get(object); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date_timezone_set f_date_timezone_set +#else +inline void x_date_timezone_set(CObjRef object, CObjRef timezone) { + FUNCTION_INJECTION(date_timezone_set); + f_date_timezone_set(object, timezone); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_date f_date +#else +inline String x_date(CStrRef format, int64 timestamp = TimeStamp::Current()) { + FUNCTION_INJECTION(date); + return f_date(format, timestamp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getdate f_getdate +#else +inline Array x_getdate(int64 timestamp = TimeStamp::Current()) { + FUNCTION_INJECTION(getdate); + return f_getdate(timestamp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gettimeofday f_gettimeofday +#else +inline Variant x_gettimeofday(bool return_float = false) { + FUNCTION_INJECTION(gettimeofday); + return f_gettimeofday(return_float); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gmdate f_gmdate +#else +inline String x_gmdate(CStrRef format, int64 timestamp = TimeStamp::Current()) { + FUNCTION_INJECTION(gmdate); + return f_gmdate(format, timestamp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gmmktime f_gmmktime +#else +inline Variant x_gmmktime(int hour = -1, int minute = -1, int second = -1, int month = -1, int day = -1, int year = -1) { + FUNCTION_INJECTION(gmmktime); + return f_gmmktime(hour, minute, second, month, day, year); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gmstrftime f_gmstrftime +#else +inline String x_gmstrftime(CStrRef format, int64 timestamp = TimeStamp::Current()) { + FUNCTION_INJECTION(gmstrftime); + return f_gmstrftime(format, timestamp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_idate f_idate +#else +inline int64 x_idate(CStrRef format, int64 timestamp = TimeStamp::Current()) { + FUNCTION_INJECTION(idate); + return f_idate(format, timestamp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_localtime f_localtime +#else +inline Array x_localtime(int64 timestamp = TimeStamp::Current(), bool is_associative = false) { + FUNCTION_INJECTION(localtime); + return f_localtime(timestamp, is_associative); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_microtime f_microtime +#else +inline Variant x_microtime(bool get_as_float = false) { + FUNCTION_INJECTION(microtime); + return f_microtime(get_as_float); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mktime f_mktime +#else +inline Variant x_mktime(int hour = -1, int minute = -1, int second = -1, int month = -1, int day = -1, int year = -1) { + FUNCTION_INJECTION(mktime); + return f_mktime(hour, minute, second, month, day, year); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strftime f_strftime +#else +inline String x_strftime(CStrRef format, int64 timestamp = TimeStamp::Current()) { + FUNCTION_INJECTION(strftime); + return f_strftime(format, timestamp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strptime f_strptime +#else +inline Variant x_strptime(CStrRef date, CStrRef format) { + FUNCTION_INJECTION(strptime); + return f_strptime(date, format); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strtotime f_strtotime +#else +inline Variant x_strtotime(CStrRef input, int64 timestamp = TimeStamp::Current()) { + FUNCTION_INJECTION(strtotime); + return f_strtotime(input, timestamp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_time f_time +#else +inline int x_time() { + FUNCTION_INJECTION(time); + return f_time(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_timezone_abbreviations_list f_timezone_abbreviations_list +#else +inline Array x_timezone_abbreviations_list() { + FUNCTION_INJECTION(timezone_abbreviations_list); + return f_timezone_abbreviations_list(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_timezone_identifiers_list f_timezone_identifiers_list +#else +inline Array x_timezone_identifiers_list() { + FUNCTION_INJECTION(timezone_identifiers_list); + return f_timezone_identifiers_list(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_timezone_name_from_abbr f_timezone_name_from_abbr +#else +inline Variant x_timezone_name_from_abbr(CStrRef abbr, int gmtoffset = -1, bool isdst = true) { + FUNCTION_INJECTION(timezone_name_from_abbr); + return f_timezone_name_from_abbr(abbr, gmtoffset, isdst); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_timezone_name_get f_timezone_name_get +#else +inline String x_timezone_name_get(CObjRef object) { + FUNCTION_INJECTION(timezone_name_get); + return f_timezone_name_get(object); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_timezone_offset_get f_timezone_offset_get +#else +inline int x_timezone_offset_get(CObjRef object, CObjRef dt) { + FUNCTION_INJECTION(timezone_offset_get); + return f_timezone_offset_get(object, dt); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_timezone_open f_timezone_open +#else +inline Object x_timezone_open(CStrRef timezone) { + FUNCTION_INJECTION(timezone_open); + return f_timezone_open(timezone); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_timezone_transitions_get f_timezone_transitions_get +#else +inline Array x_timezone_transitions_get(CObjRef object) { + FUNCTION_INJECTION(timezone_transitions_get); + return f_timezone_transitions_get(object); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_DATETIME_H__ diff --git a/src/cpp/ext/profile/extprofile_domdocument.h b/src/cpp/ext/profile/extprofile_domdocument.h new file mode 100644 index 0000000000000..5b9b973d89dd9 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_domdocument.h @@ -0,0 +1,16 @@ + +#ifndef __EXTPROFILE_DOMDOCUMENT_H__ +#define __EXTPROFILE_DOMDOCUMENT_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_DOMDOCUMENT_H__ diff --git a/src/cpp/ext/profile/extprofile_error.h b/src/cpp/ext/profile/extprofile_error.h new file mode 100644 index 0000000000000..73fb95a6a1d7b --- /dev/null +++ b/src/cpp/ext/profile/extprofile_error.h @@ -0,0 +1,131 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_ERROR_H__ +#define __EXTPROFILE_ERROR_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_debug_backtrace f_debug_backtrace +#else +inline Array x_debug_backtrace() { + FUNCTION_INJECTION(debug_backtrace); + return f_debug_backtrace(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_debug_print_backtrace f_debug_print_backtrace +#else +inline void x_debug_print_backtrace() { + FUNCTION_INJECTION(debug_print_backtrace); + f_debug_print_backtrace(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_error_get_last f_error_get_last +#else +inline Array x_error_get_last() { + FUNCTION_INJECTION(error_get_last); + return f_error_get_last(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_error_log f_error_log +#else +inline bool x_error_log(CStrRef message, int message_type = 0, CStrRef destination = null_string, CStrRef extra_headers = null_string) { + FUNCTION_INJECTION(error_log); + return f_error_log(message, message_type, destination, extra_headers); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_error_reporting f_error_reporting +#else +inline int x_error_reporting(int level = 0) { + FUNCTION_INJECTION(error_reporting); + return f_error_reporting(level); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_restore_error_handler f_restore_error_handler +#else +inline bool x_restore_error_handler() { + FUNCTION_INJECTION(restore_error_handler); + return f_restore_error_handler(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_restore_exception_handler f_restore_exception_handler +#else +inline bool x_restore_exception_handler() { + FUNCTION_INJECTION(restore_exception_handler); + return f_restore_exception_handler(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_set_error_handler f_set_error_handler +#else +inline Variant x_set_error_handler(CStrRef error_handler, int error_types = 0) { + FUNCTION_INJECTION(set_error_handler); + return f_set_error_handler(error_handler, error_types); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_set_exception_handler f_set_exception_handler +#else +inline String x_set_exception_handler(CStrRef exception_handler) { + FUNCTION_INJECTION(set_exception_handler); + return f_set_exception_handler(exception_handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_trigger_error f_trigger_error +#else +inline bool x_trigger_error(CStrRef error_msg, int error_type = k_E_USER_NOTICE) { + FUNCTION_INJECTION(trigger_error); + return f_trigger_error(error_msg, error_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_user_error f_user_error +#else +inline bool x_user_error(CStrRef error_msg, int error_type = k_E_USER_NOTICE) { + FUNCTION_INJECTION(user_error); + return f_user_error(error_msg, error_type); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_ERROR_H__ diff --git a/src/cpp/ext/profile/extprofile_fbml.h b/src/cpp/ext/profile/extprofile_fbml.h new file mode 100644 index 0000000000000..5e811862d39a1 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_fbml.h @@ -0,0 +1,212 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_FBML_H__ +#define __EXTPROFILE_FBML_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_fbml_tag_list_expanded_11 f_fbml_tag_list_expanded_11 +#else +inline bool x_fbml_tag_list_expanded_11() { + FUNCTION_INJECTION(fbml_tag_list_expanded_11); + return f_fbml_tag_list_expanded_11(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_complex_expand_tag_list_11 f_fbml_complex_expand_tag_list_11 +#else +inline void x_fbml_complex_expand_tag_list_11(CArrRef new_tags, CArrRef new_attrs, CArrRef special_html, CArrRef precache, CArrRef style, CArrRef style_attrs, CArrRef script_attrs, CArrRef rewrite_attrs, CArrRef special_attrs, CArrRef schema) { + FUNCTION_INJECTION(fbml_complex_expand_tag_list_11); + f_fbml_complex_expand_tag_list_11(new_tags, new_attrs, special_html, precache, style, style_attrs, script_attrs, rewrite_attrs, special_attrs, schema); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_parse_opaque_11 f_fbml_parse_opaque_11 +#else +inline Array x_fbml_parse_opaque_11(CStrRef unsanitized_fbml, bool body_only, bool preserve_comment, bool internal_mode = false, CVarRef css_sanitizer = null_variant, CVarRef js_sanitizer = null_variant, CVarRef attr_rewriter = null_variant) { + FUNCTION_INJECTION(fbml_parse_opaque_11); + return f_fbml_parse_opaque_11(unsanitized_fbml, body_only, preserve_comment, internal_mode, css_sanitizer, js_sanitizer, attr_rewriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_sanitize_css_11 f_fbml_sanitize_css_11 +#else +inline Array x_fbml_sanitize_css_11(CStrRef unsanitized_css, bool decl_only, int line_number, CArrRef css_sanitizer) { + FUNCTION_INJECTION(fbml_sanitize_css_11); + return f_fbml_sanitize_css_11(unsanitized_css, decl_only, line_number, css_sanitizer); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_sanitize_js_11 f_fbml_sanitize_js_11 +#else +inline Array x_fbml_sanitize_js_11(CStrRef unsanitized_js, int line_number, CArrRef js_sanitizer) { + FUNCTION_INJECTION(fbml_sanitize_js_11); + return f_fbml_sanitize_js_11(unsanitized_js, line_number, js_sanitizer); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_get_tag_name_11 f_fbml_get_tag_name_11 +#else +inline String x_fbml_get_tag_name_11(CObjRef node) { + FUNCTION_INJECTION(fbml_get_tag_name_11); + return f_fbml_get_tag_name_11(node); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_get_children_11 f_fbml_get_children_11 +#else +inline Array x_fbml_get_children_11(CObjRef node) { + FUNCTION_INJECTION(fbml_get_children_11); + return f_fbml_get_children_11(node); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_get_children_count_11 f_fbml_get_children_count_11 +#else +inline int x_fbml_get_children_count_11(CObjRef node) { + FUNCTION_INJECTION(fbml_get_children_count_11); + return f_fbml_get_children_count_11(node); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_get_children_by_name_11 f_fbml_get_children_by_name_11 +#else +inline Array x_fbml_get_children_by_name_11(CObjRef node, CStrRef tag) { + FUNCTION_INJECTION(fbml_get_children_by_name_11); + return f_fbml_get_children_by_name_11(node, tag); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_get_attributes_11 f_fbml_get_attributes_11 +#else +inline Array x_fbml_get_attributes_11(CObjRef node) { + FUNCTION_INJECTION(fbml_get_attributes_11); + return f_fbml_get_attributes_11(node); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_get_attribute_11 f_fbml_get_attribute_11 +#else +inline String x_fbml_get_attribute_11(CObjRef node, CStrRef name) { + FUNCTION_INJECTION(fbml_get_attribute_11); + return f_fbml_get_attribute_11(node, name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_attr_to_bool_11 f_fbml_attr_to_bool_11 +#else +inline Variant x_fbml_attr_to_bool_11(CStrRef name) { + FUNCTION_INJECTION(fbml_attr_to_bool_11); + return f_fbml_attr_to_bool_11(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_attr_to_color_11 f_fbml_attr_to_color_11 +#else +inline String x_fbml_attr_to_color_11(CStrRef name) { + FUNCTION_INJECTION(fbml_attr_to_color_11); + return f_fbml_attr_to_color_11(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_get_text_11 f_fbml_get_text_11 +#else +inline String x_fbml_get_text_11(CObjRef node) { + FUNCTION_INJECTION(fbml_get_text_11); + return f_fbml_get_text_11(node); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_precache_11 f_fbml_precache_11 +#else +inline void x_fbml_precache_11(CObjRef node, CVarRef data, CStrRef callback) { + FUNCTION_INJECTION(fbml_precache_11); + f_fbml_precache_11(node, data, callback); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_batch_precache_11 f_fbml_batch_precache_11 +#else +inline Array x_fbml_batch_precache_11(CObjRef node) { + FUNCTION_INJECTION(fbml_batch_precache_11); + return f_fbml_batch_precache_11(node); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_render_children_11 f_fbml_render_children_11 +#else +inline String x_fbml_render_children_11(CObjRef node, CVarRef data, CStrRef html_callback, CStrRef fb_callback, int internal_mode = 0) { + FUNCTION_INJECTION(fbml_render_children_11); + return f_fbml_render_children_11(node, data, html_callback, fb_callback, internal_mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbml_flatten_11 f_fbml_flatten_11 +#else +inline String x_fbml_flatten_11(CObjRef node) { + FUNCTION_INJECTION(fbml_flatten_11); + return f_fbml_flatten_11(node); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_html_profile f_html_profile +#else +inline String x_html_profile(CStrRef html) { + FUNCTION_INJECTION(html_profile); + return f_html_profile(html); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fbjsparse f_fbjsparse +#else +inline String x_fbjsparse(CStrRef input) { + FUNCTION_INJECTION(fbjsparse); + return f_fbjsparse(input); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_FBML_H__ diff --git a/src/cpp/ext/profile/extprofile_file.h b/src/cpp/ext/profile/extprofile_file.h new file mode 100644 index 0000000000000..8178100d2455c --- /dev/null +++ b/src/cpp/ext/profile/extprofile_file.h @@ -0,0 +1,833 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_FILE_H__ +#define __EXTPROFILE_FILE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_fopen f_fopen +#else +inline Variant x_fopen(CStrRef filename, CStrRef mode, bool use_include_path = false, CObjRef context = null_object) { + FUNCTION_INJECTION(fopen); + return f_fopen(filename, mode, use_include_path, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_popen f_popen +#else +inline Variant x_popen(CStrRef command, CStrRef mode) { + FUNCTION_INJECTION(popen); + return f_popen(command, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fclose f_fclose +#else +inline bool x_fclose(CObjRef handle) { + FUNCTION_INJECTION(fclose); + return f_fclose(handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pclose f_pclose +#else +inline int x_pclose(CObjRef handle) { + FUNCTION_INJECTION(pclose); + return f_pclose(handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fseek f_fseek +#else +inline Variant x_fseek(CObjRef handle, int64 offset, int64 whence = SEEK_SET) { + FUNCTION_INJECTION(fseek); + return f_fseek(handle, offset, whence); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rewind f_rewind +#else +inline bool x_rewind(CObjRef handle) { + FUNCTION_INJECTION(rewind); + return f_rewind(handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ftell f_ftell +#else +inline Variant x_ftell(CObjRef handle) { + FUNCTION_INJECTION(ftell); + return f_ftell(handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_feof f_feof +#else +inline bool x_feof(CObjRef handle) { + FUNCTION_INJECTION(feof); + return f_feof(handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fstat f_fstat +#else +inline Variant x_fstat(CObjRef handle) { + FUNCTION_INJECTION(fstat); + return f_fstat(handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fread f_fread +#else +inline Variant x_fread(CObjRef handle, int64 length) { + FUNCTION_INJECTION(fread); + return f_fread(handle, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fgetc f_fgetc +#else +inline Variant x_fgetc(CObjRef handle) { + FUNCTION_INJECTION(fgetc); + return f_fgetc(handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fgets f_fgets +#else +inline String x_fgets(CObjRef handle, int64 length = 1024) { + FUNCTION_INJECTION(fgets); + return f_fgets(handle, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fgetss f_fgetss +#else +inline String x_fgetss(CObjRef handle, int64 length = 0, CStrRef allowable_tags = null_string) { + FUNCTION_INJECTION(fgetss); + return f_fgetss(handle, length, allowable_tags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fscanf f_fscanf +#else +inline Variant x_fscanf(int _argc, CObjRef handle, CStrRef format, CArrRef _argv = null_array) { + FUNCTION_INJECTION(fscanf); + return f_fscanf(_argc, handle, format, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fpassthru f_fpassthru +#else +inline Variant x_fpassthru(CObjRef handle) { + FUNCTION_INJECTION(fpassthru); + return f_fpassthru(handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fwrite f_fwrite +#else +inline int64 x_fwrite(CObjRef handle, CStrRef data, int64 length = 0) { + FUNCTION_INJECTION(fwrite); + return f_fwrite(handle, data, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fputs f_fputs +#else +inline int64 x_fputs(CObjRef handle, CStrRef data, int64 length = 0) { + FUNCTION_INJECTION(fputs); + return f_fputs(handle, data, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fprintf f_fprintf +#else +inline Variant x_fprintf(int _argc, CObjRef handle, CStrRef format, CArrRef _argv = null_array) { + FUNCTION_INJECTION(fprintf); + return f_fprintf(_argc, handle, format, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_vfprintf f_vfprintf +#else +inline Variant x_vfprintf(CObjRef handle, CStrRef format, CArrRef args) { + FUNCTION_INJECTION(vfprintf); + return f_vfprintf(handle, format, args); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fflush f_fflush +#else +inline bool x_fflush(CObjRef handle) { + FUNCTION_INJECTION(fflush); + return f_fflush(handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ftruncate f_ftruncate +#else +inline bool x_ftruncate(CObjRef handle, int64 size) { + FUNCTION_INJECTION(ftruncate); + return f_ftruncate(handle, size); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_flock f_flock +#else +inline bool x_flock(CObjRef handle, int operation, Variant wouldblock = null) { + FUNCTION_INJECTION(flock); + return f_flock(handle, operation, ref(wouldblock)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fputcsv f_fputcsv +#else +inline Variant x_fputcsv(CObjRef handle, CArrRef fields, CStrRef delimiter = ",", CStrRef enclosure = "\"") { + FUNCTION_INJECTION(fputcsv); + return f_fputcsv(handle, fields, delimiter, enclosure); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fgetcsv f_fgetcsv +#else +inline Variant x_fgetcsv(CObjRef handle, int64 length = 0, CStrRef delimiter = ",", CStrRef enclosure = "\"") { + FUNCTION_INJECTION(fgetcsv); + return f_fgetcsv(handle, length, delimiter, enclosure); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_file_get_contents f_file_get_contents +#else +inline Variant x_file_get_contents(CStrRef filename, bool use_include_path = false, CObjRef context = null_object, int64 offset = 0, int64 maxlen = 0) { + FUNCTION_INJECTION(file_get_contents); + return f_file_get_contents(filename, use_include_path, context, offset, maxlen); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_file_put_contents f_file_put_contents +#else +inline Variant x_file_put_contents(CStrRef filename, CVarRef data, int flags = 0, CObjRef context = null_object) { + FUNCTION_INJECTION(file_put_contents); + return f_file_put_contents(filename, data, flags, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_file f_file +#else +inline Variant x_file(CStrRef filename, int flags = 0, CObjRef context = null_object) { + FUNCTION_INJECTION(file); + return f_file(filename, flags, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_readfile f_readfile +#else +inline Variant x_readfile(CStrRef filename, bool use_include_path = false, CObjRef context = null_object) { + FUNCTION_INJECTION(readfile); + return f_readfile(filename, use_include_path, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_move_uploaded_file f_move_uploaded_file +#else +inline bool x_move_uploaded_file(CStrRef filename, CStrRef destination) { + FUNCTION_INJECTION(move_uploaded_file); + return f_move_uploaded_file(filename, destination); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_parse_ini_file f_parse_ini_file +#else +inline Variant x_parse_ini_file(CStrRef filename, bool process_sections = false) { + FUNCTION_INJECTION(parse_ini_file); + return f_parse_ini_file(filename, process_sections); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_md5_file f_md5_file +#else +inline Variant x_md5_file(CStrRef filename, bool raw_output = false) { + FUNCTION_INJECTION(md5_file); + return f_md5_file(filename, raw_output); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sha1_file f_sha1_file +#else +inline Variant x_sha1_file(CStrRef filename, bool raw_output = false) { + FUNCTION_INJECTION(sha1_file); + return f_sha1_file(filename, raw_output); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_chmod f_chmod +#else +inline bool x_chmod(CStrRef filename, int64 mode) { + FUNCTION_INJECTION(chmod); + return f_chmod(filename, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_chown f_chown +#else +inline bool x_chown(CStrRef filename, CVarRef user) { + FUNCTION_INJECTION(chown); + return f_chown(filename, user); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_lchown f_lchown +#else +inline bool x_lchown(CStrRef filename, CVarRef user) { + FUNCTION_INJECTION(lchown); + return f_lchown(filename, user); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_chgrp f_chgrp +#else +inline bool x_chgrp(CStrRef filename, CVarRef group) { + FUNCTION_INJECTION(chgrp); + return f_chgrp(filename, group); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_lchgrp f_lchgrp +#else +inline bool x_lchgrp(CStrRef filename, CVarRef group) { + FUNCTION_INJECTION(lchgrp); + return f_lchgrp(filename, group); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_touch f_touch +#else +inline bool x_touch(CStrRef filename, int64 mtime = 0, int64 atime = 0) { + FUNCTION_INJECTION(touch); + return f_touch(filename, mtime, atime); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_copy f_copy +#else +inline bool x_copy(CStrRef source, CStrRef dest, CObjRef context = null_object) { + FUNCTION_INJECTION(copy); + return f_copy(source, dest, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rename f_rename +#else +inline bool x_rename(CStrRef oldname, CStrRef newname, CObjRef context = null_object) { + FUNCTION_INJECTION(rename); + return f_rename(oldname, newname, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_umask f_umask +#else +inline int x_umask(CVarRef mask = null_variant) { + FUNCTION_INJECTION(umask); + return f_umask(mask); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_unlink f_unlink +#else +inline bool x_unlink(CStrRef filename, CObjRef context = null_object) { + FUNCTION_INJECTION(unlink); + return f_unlink(filename, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_link f_link +#else +inline bool x_link(CStrRef target, CStrRef link) { + FUNCTION_INJECTION(link); + return f_link(target, link); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_symlink f_symlink +#else +inline bool x_symlink(CStrRef target, CStrRef link) { + FUNCTION_INJECTION(symlink); + return f_symlink(target, link); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_basename f_basename +#else +inline String x_basename(CStrRef path, CStrRef suffix = null_string) { + FUNCTION_INJECTION(basename); + return f_basename(path, suffix); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fnmatch f_fnmatch +#else +inline bool x_fnmatch(CStrRef pattern, CStrRef filename, int flags = 0) { + FUNCTION_INJECTION(fnmatch); + return f_fnmatch(pattern, filename, flags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_glob f_glob +#else +inline Variant x_glob(CStrRef pattern, int flags = 0) { + FUNCTION_INJECTION(glob); + return f_glob(pattern, flags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_tempnam f_tempnam +#else +inline Variant x_tempnam(CStrRef dir, CStrRef prefix) { + FUNCTION_INJECTION(tempnam); + return f_tempnam(dir, prefix); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_tmpfile f_tmpfile +#else +inline Variant x_tmpfile() { + FUNCTION_INJECTION(tmpfile); + return f_tmpfile(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fileperms f_fileperms +#else +inline Variant x_fileperms(CStrRef filename) { + FUNCTION_INJECTION(fileperms); + return f_fileperms(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fileinode f_fileinode +#else +inline Variant x_fileinode(CStrRef filename) { + FUNCTION_INJECTION(fileinode); + return f_fileinode(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_filesize f_filesize +#else +inline Variant x_filesize(CStrRef filename) { + FUNCTION_INJECTION(filesize); + return f_filesize(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fileowner f_fileowner +#else +inline Variant x_fileowner(CStrRef filename) { + FUNCTION_INJECTION(fileowner); + return f_fileowner(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_filegroup f_filegroup +#else +inline Variant x_filegroup(CStrRef filename) { + FUNCTION_INJECTION(filegroup); + return f_filegroup(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fileatime f_fileatime +#else +inline Variant x_fileatime(CStrRef filename) { + FUNCTION_INJECTION(fileatime); + return f_fileatime(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_filemtime f_filemtime +#else +inline Variant x_filemtime(CStrRef filename) { + FUNCTION_INJECTION(filemtime); + return f_filemtime(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_filectime f_filectime +#else +inline Variant x_filectime(CStrRef filename) { + FUNCTION_INJECTION(filectime); + return f_filectime(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_filetype f_filetype +#else +inline Variant x_filetype(CStrRef filename) { + FUNCTION_INJECTION(filetype); + return f_filetype(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_linkinfo f_linkinfo +#else +inline Variant x_linkinfo(CStrRef filename) { + FUNCTION_INJECTION(linkinfo); + return f_linkinfo(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_writable f_is_writable +#else +inline bool x_is_writable(CStrRef filename) { + FUNCTION_INJECTION(is_writable); + return f_is_writable(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_writeable f_is_writeable +#else +inline bool x_is_writeable(CStrRef filename) { + FUNCTION_INJECTION(is_writeable); + return f_is_writeable(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_readable f_is_readable +#else +inline bool x_is_readable(CStrRef filename) { + FUNCTION_INJECTION(is_readable); + return f_is_readable(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_executable f_is_executable +#else +inline bool x_is_executable(CStrRef filename) { + FUNCTION_INJECTION(is_executable); + return f_is_executable(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_file f_is_file +#else +inline bool x_is_file(CStrRef filename) { + FUNCTION_INJECTION(is_file); + return f_is_file(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_dir f_is_dir +#else +inline bool x_is_dir(CStrRef filename) { + FUNCTION_INJECTION(is_dir); + return f_is_dir(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_link f_is_link +#else +inline bool x_is_link(CStrRef filename) { + FUNCTION_INJECTION(is_link); + return f_is_link(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_uploaded_file f_is_uploaded_file +#else +inline bool x_is_uploaded_file(CStrRef filename) { + FUNCTION_INJECTION(is_uploaded_file); + return f_is_uploaded_file(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_file_exists f_file_exists +#else +inline bool x_file_exists(CStrRef filename) { + FUNCTION_INJECTION(file_exists); + return f_file_exists(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stat f_stat +#else +inline Variant x_stat(CStrRef filename) { + FUNCTION_INJECTION(stat); + return f_stat(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_lstat f_lstat +#else +inline Variant x_lstat(CStrRef filename) { + FUNCTION_INJECTION(lstat); + return f_lstat(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_clearstatcache f_clearstatcache +#else +inline void x_clearstatcache() { + FUNCTION_INJECTION(clearstatcache); + f_clearstatcache(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_readlink f_readlink +#else +inline Variant x_readlink(CStrRef path) { + FUNCTION_INJECTION(readlink); + return f_readlink(path); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_realpath f_realpath +#else +inline Variant x_realpath(CStrRef path) { + FUNCTION_INJECTION(realpath); + return f_realpath(path); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pathinfo f_pathinfo +#else +inline Variant x_pathinfo(CStrRef path, int opt = 15) { + FUNCTION_INJECTION(pathinfo); + return f_pathinfo(path, opt); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_disk_free_space f_disk_free_space +#else +inline Variant x_disk_free_space(CStrRef directory) { + FUNCTION_INJECTION(disk_free_space); + return f_disk_free_space(directory); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_diskfreespace f_diskfreespace +#else +inline Variant x_diskfreespace(CStrRef directory) { + FUNCTION_INJECTION(diskfreespace); + return f_diskfreespace(directory); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_disk_total_space f_disk_total_space +#else +inline Variant x_disk_total_space(CStrRef directory) { + FUNCTION_INJECTION(disk_total_space); + return f_disk_total_space(directory); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mkdir f_mkdir +#else +inline bool x_mkdir(CStrRef pathname, int64 mode = 0, bool recursive = false, CObjRef context = null_object) { + FUNCTION_INJECTION(mkdir); + return f_mkdir(pathname, mode, recursive, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rmdir f_rmdir +#else +inline bool x_rmdir(CStrRef dirname, CObjRef context = null_object) { + FUNCTION_INJECTION(rmdir); + return f_rmdir(dirname, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_dirname f_dirname +#else +inline String x_dirname(CStrRef path) { + FUNCTION_INJECTION(dirname); + return f_dirname(path); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getcwd f_getcwd +#else +inline Variant x_getcwd() { + FUNCTION_INJECTION(getcwd); + return f_getcwd(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_chdir f_chdir +#else +inline bool x_chdir(CStrRef directory) { + FUNCTION_INJECTION(chdir); + return f_chdir(directory); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_chroot f_chroot +#else +inline bool x_chroot(CStrRef directory) { + FUNCTION_INJECTION(chroot); + return f_chroot(directory); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_dir f_dir +#else +inline Variant x_dir(CStrRef directory) { + FUNCTION_INJECTION(dir); + return f_dir(directory); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_opendir f_opendir +#else +inline Variant x_opendir(CStrRef path, CObjRef context = null) { + FUNCTION_INJECTION(opendir); + return f_opendir(path, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_readdir f_readdir +#else +inline Variant x_readdir(CObjRef dir_handle) { + FUNCTION_INJECTION(readdir); + return f_readdir(dir_handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rewinddir f_rewinddir +#else +inline void x_rewinddir(CObjRef dir_handle) { + FUNCTION_INJECTION(rewinddir); + f_rewinddir(dir_handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_scandir f_scandir +#else +inline Variant x_scandir(CStrRef directory, bool descending = false, CObjRef context = null) { + FUNCTION_INJECTION(scandir); + return f_scandir(directory, descending, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_closedir f_closedir +#else +inline void x_closedir(CObjRef dir_handle) { + FUNCTION_INJECTION(closedir); + f_closedir(dir_handle); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_FILE_H__ diff --git a/src/cpp/ext/profile/extprofile_function.h b/src/cpp/ext/profile/extprofile_function.h new file mode 100644 index 0000000000000..b42c28a2576d4 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_function.h @@ -0,0 +1,158 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_FUNCTION_H__ +#define __EXTPROFILE_FUNCTION_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_get_defined_functions f_get_defined_functions +#else +inline Array x_get_defined_functions() { + FUNCTION_INJECTION(get_defined_functions); + return f_get_defined_functions(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_function_exists f_function_exists +#else +inline bool x_function_exists(CStrRef function_name) { + FUNCTION_INJECTION(function_exists); + return f_function_exists(function_name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_callable f_is_callable +#else +inline bool x_is_callable(CVarRef v, bool syntax = false, Variant name = null) { + FUNCTION_INJECTION(is_callable); + return f_is_callable(v, syntax, ref(name)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_call_user_func_array f_call_user_func_array +#else +inline Variant x_call_user_func_array(CVarRef function, CArrRef params) { + FUNCTION_INJECTION(call_user_func_array); + return f_call_user_func_array(function, params); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_call_user_func f_call_user_func +#else +inline Variant x_call_user_func(int _argc, CVarRef function, CArrRef _argv = null_array) { + FUNCTION_INJECTION(call_user_func); + return f_call_user_func(_argc, function, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_create_function f_create_function +#else +inline String x_create_function(CStrRef args, CStrRef code) { + FUNCTION_INJECTION(create_function); + return f_create_function(args, code); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_func_get_arg f_func_get_arg +#else +inline Variant x_func_get_arg(int arg_num) { + FUNCTION_INJECTION(func_get_arg); + return f_func_get_arg(arg_num); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_func_get_args f_func_get_args +#else +inline Array x_func_get_args() { + FUNCTION_INJECTION(func_get_args); + return f_func_get_args(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_func_num_args f_func_num_args +#else +inline int x_func_num_args() { + FUNCTION_INJECTION(func_num_args); + return f_func_num_args(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_register_postsend_function f_register_postsend_function +#else +inline void x_register_postsend_function(int _argc, CVarRef function, CArrRef _argv = null_array) { + FUNCTION_INJECTION(register_postsend_function); + f_register_postsend_function(_argc, function, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_register_shutdown_function f_register_shutdown_function +#else +inline void x_register_shutdown_function(int _argc, CVarRef function, CArrRef _argv = null_array) { + FUNCTION_INJECTION(register_shutdown_function); + f_register_shutdown_function(_argc, function, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_register_cleanup_function f_register_cleanup_function +#else +inline void x_register_cleanup_function(int _argc, CVarRef function, CArrRef _argv = null_array) { + FUNCTION_INJECTION(register_cleanup_function); + f_register_cleanup_function(_argc, function, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_register_tick_function f_register_tick_function +#else +inline bool x_register_tick_function(int _argc, CVarRef function, CArrRef _argv = null_array) { + FUNCTION_INJECTION(register_tick_function); + return f_register_tick_function(_argc, function, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_unregister_tick_function f_unregister_tick_function +#else +inline void x_unregister_tick_function(CVarRef function_name) { + FUNCTION_INJECTION(unregister_tick_function); + f_unregister_tick_function(function_name); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_FUNCTION_H__ diff --git a/src/cpp/ext/profile/extprofile_hash.h b/src/cpp/ext/profile/extprofile_hash.h new file mode 100644 index 0000000000000..152f990a976f3 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_hash.h @@ -0,0 +1,122 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_HASH_H__ +#define __EXTPROFILE_HASH_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_hash f_hash +#else +inline Variant x_hash(CStrRef algo, CStrRef data, bool raw_output = false) { + FUNCTION_INJECTION(hash); + return f_hash(algo, data, raw_output); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hash_algos f_hash_algos +#else +inline Array x_hash_algos() { + FUNCTION_INJECTION(hash_algos); + return f_hash_algos(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hash_init f_hash_init +#else +inline Variant x_hash_init(CStrRef algo, int options = 0, CStrRef key = null_string) { + FUNCTION_INJECTION(hash_init); + return f_hash_init(algo, options, key); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hash_file f_hash_file +#else +inline Variant x_hash_file(CStrRef algo, CStrRef filename, bool raw_output = false) { + FUNCTION_INJECTION(hash_file); + return f_hash_file(algo, filename, raw_output); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hash_final f_hash_final +#else +inline String x_hash_final(CObjRef context, bool raw_output = false) { + FUNCTION_INJECTION(hash_final); + return f_hash_final(context, raw_output); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hash_hmac_file f_hash_hmac_file +#else +inline Variant x_hash_hmac_file(CStrRef algo, CStrRef filename, CStrRef key, bool raw_output = false) { + FUNCTION_INJECTION(hash_hmac_file); + return f_hash_hmac_file(algo, filename, key, raw_output); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hash_hmac f_hash_hmac +#else +inline Variant x_hash_hmac(CStrRef algo, CStrRef data, CStrRef key, bool raw_output = false) { + FUNCTION_INJECTION(hash_hmac); + return f_hash_hmac(algo, data, key, raw_output); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hash_update_file f_hash_update_file +#else +inline bool x_hash_update_file(CObjRef init_context, CStrRef filename, CObjRef stream_context = null) { + FUNCTION_INJECTION(hash_update_file); + return f_hash_update_file(init_context, filename, stream_context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hash_update_stream f_hash_update_stream +#else +inline int x_hash_update_stream(CObjRef context, CObjRef handle, int length = -1) { + FUNCTION_INJECTION(hash_update_stream); + return f_hash_update_stream(context, handle, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hash_update f_hash_update +#else +inline bool x_hash_update(CObjRef context, CStrRef data) { + FUNCTION_INJECTION(hash_update); + return f_hash_update(context, data); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_HASH_H__ diff --git a/src/cpp/ext/profile/extprofile_iconv.h b/src/cpp/ext/profile/extprofile_iconv.h new file mode 100644 index 0000000000000..f34928fc909c4 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_iconv.h @@ -0,0 +1,131 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_ICONV_H__ +#define __EXTPROFILE_ICONV_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_iconv_mime_encode f_iconv_mime_encode +#else +inline Variant x_iconv_mime_encode(CStrRef field_name, CStrRef field_value, CVarRef preferences = null_variant) { + FUNCTION_INJECTION(iconv_mime_encode); + return f_iconv_mime_encode(field_name, field_value, preferences); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iconv_mime_decode f_iconv_mime_decode +#else +inline Variant x_iconv_mime_decode(CStrRef encoded_string, int mode = 0, CStrRef charset = null_string) { + FUNCTION_INJECTION(iconv_mime_decode); + return f_iconv_mime_decode(encoded_string, mode, charset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iconv_mime_decode_headers f_iconv_mime_decode_headers +#else +inline Variant x_iconv_mime_decode_headers(CStrRef encoded_headers, int mode = 0, CStrRef charset = null_string) { + FUNCTION_INJECTION(iconv_mime_decode_headers); + return f_iconv_mime_decode_headers(encoded_headers, mode, charset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iconv_get_encoding f_iconv_get_encoding +#else +inline Variant x_iconv_get_encoding(CStrRef type = "all") { + FUNCTION_INJECTION(iconv_get_encoding); + return f_iconv_get_encoding(type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iconv_set_encoding f_iconv_set_encoding +#else +inline bool x_iconv_set_encoding(CStrRef type, CStrRef charset) { + FUNCTION_INJECTION(iconv_set_encoding); + return f_iconv_set_encoding(type, charset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iconv f_iconv +#else +inline Variant x_iconv(CStrRef in_charset, CStrRef out_charset, CStrRef str) { + FUNCTION_INJECTION(iconv); + return f_iconv(in_charset, out_charset, str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iconv_strlen f_iconv_strlen +#else +inline Variant x_iconv_strlen(CStrRef str, CStrRef charset = null_string) { + FUNCTION_INJECTION(iconv_strlen); + return f_iconv_strlen(str, charset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iconv_strpos f_iconv_strpos +#else +inline Variant x_iconv_strpos(CStrRef haystack, CStrRef needle, int offset = 0, CStrRef charset = null_string) { + FUNCTION_INJECTION(iconv_strpos); + return f_iconv_strpos(haystack, needle, offset, charset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iconv_strrpos f_iconv_strrpos +#else +inline Variant x_iconv_strrpos(CStrRef haystack, CStrRef needle, CStrRef charset = null_string) { + FUNCTION_INJECTION(iconv_strrpos); + return f_iconv_strrpos(haystack, needle, charset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iconv_substr f_iconv_substr +#else +inline Variant x_iconv_substr(CStrRef str, int offset, int length = 0, CStrRef charset = null_string) { + FUNCTION_INJECTION(iconv_substr); + return f_iconv_substr(str, offset, length, charset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_iconv_handler f_ob_iconv_handler +#else +inline String x_ob_iconv_handler(CStrRef contents, int status) { + FUNCTION_INJECTION(ob_iconv_handler); + return f_ob_iconv_handler(contents, status); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_ICONV_H__ diff --git a/src/cpp/ext/profile/extprofile_icu.h b/src/cpp/ext/profile/extprofile_icu.h new file mode 100644 index 0000000000000..c81909befaccb --- /dev/null +++ b/src/cpp/ext/profile/extprofile_icu.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_ICU_H__ +#define __EXTPROFILE_ICU_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_icu_transliterate f_icu_transliterate +#else +inline String x_icu_transliterate(CStrRef str, bool remove_accents) { + FUNCTION_INJECTION(icu_transliterate); + return f_icu_transliterate(str, remove_accents); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_ICU_H__ diff --git a/src/cpp/ext/profile/extprofile_idn.h b/src/cpp/ext/profile/extprofile_idn.h new file mode 100644 index 0000000000000..647bef425cd68 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_idn.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_IDN_H__ +#define __EXTPROFILE_IDN_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_idn_to_ascii f_idn_to_ascii +#else +inline Variant x_idn_to_ascii(CStrRef domain, Variant errorcode = null) { + FUNCTION_INJECTION(idn_to_ascii); + return f_idn_to_ascii(domain, ref(errorcode)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_idn_to_unicode f_idn_to_unicode +#else +inline Variant x_idn_to_unicode(CStrRef domain, Variant errorcode = null) { + FUNCTION_INJECTION(idn_to_unicode); + return f_idn_to_unicode(domain, ref(errorcode)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_idn_to_utf8 f_idn_to_utf8 +#else +inline Variant x_idn_to_utf8(CStrRef domain, Variant errorcode = null) { + FUNCTION_INJECTION(idn_to_utf8); + return f_idn_to_utf8(domain, ref(errorcode)); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_IDN_H__ diff --git a/src/cpp/ext/profile/extprofile_image.h b/src/cpp/ext/profile/extprofile_image.h new file mode 100644 index 0000000000000..f6eeb2d1c7d9a --- /dev/null +++ b/src/cpp/ext/profile/extprofile_image.h @@ -0,0 +1,995 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_IMAGE_H__ +#define __EXTPROFILE_IMAGE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_gd_info f_gd_info +#else +inline Array x_gd_info() { + FUNCTION_INJECTION(gd_info); + return f_gd_info(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getimagesize f_getimagesize +#else +inline Variant x_getimagesize(CStrRef filename, Variant imageinfo = null) { + FUNCTION_INJECTION(getimagesize); + return f_getimagesize(filename, ref(imageinfo)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_image_type_to_extension f_image_type_to_extension +#else +inline String x_image_type_to_extension(int imagetype, bool include_dot = true) { + FUNCTION_INJECTION(image_type_to_extension); + return f_image_type_to_extension(imagetype, include_dot); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_image_type_to_mime_type f_image_type_to_mime_type +#else +inline String x_image_type_to_mime_type(int imagetype) { + FUNCTION_INJECTION(image_type_to_mime_type); + return f_image_type_to_mime_type(imagetype); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_image2wbmp f_image2wbmp +#else +inline bool x_image2wbmp(CObjRef image, CStrRef filename = null_string, int threshold = -1) { + FUNCTION_INJECTION(image2wbmp); + return f_image2wbmp(image, filename, threshold); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagealphablending f_imagealphablending +#else +inline bool x_imagealphablending(CObjRef image, bool blendmode) { + FUNCTION_INJECTION(imagealphablending); + return f_imagealphablending(image, blendmode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imageantialias f_imageantialias +#else +inline bool x_imageantialias(CObjRef image, bool on) { + FUNCTION_INJECTION(imageantialias); + return f_imageantialias(image, on); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagearc f_imagearc +#else +inline bool x_imagearc(CObjRef image, int cx, int cy, int width, int height, int start, int end, int color) { + FUNCTION_INJECTION(imagearc); + return f_imagearc(image, cx, cy, width, height, start, end, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagechar f_imagechar +#else +inline bool x_imagechar(CObjRef image, int font, int x, int y, CStrRef c, int color) { + FUNCTION_INJECTION(imagechar); + return f_imagechar(image, font, x, y, c, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecharup f_imagecharup +#else +inline bool x_imagecharup(CObjRef image, int font, int x, int y, CStrRef c, int color) { + FUNCTION_INJECTION(imagecharup); + return f_imagecharup(image, font, x, y, c, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorallocate f_imagecolorallocate +#else +inline Variant x_imagecolorallocate(CObjRef image, int red, int green, int blue) { + FUNCTION_INJECTION(imagecolorallocate); + return f_imagecolorallocate(image, red, green, blue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorallocatealpha f_imagecolorallocatealpha +#else +inline Variant x_imagecolorallocatealpha(CObjRef image, int red, int green, int blue, int alpha) { + FUNCTION_INJECTION(imagecolorallocatealpha); + return f_imagecolorallocatealpha(image, red, green, blue, alpha); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorat f_imagecolorat +#else +inline Variant x_imagecolorat(CObjRef image, int x, int y) { + FUNCTION_INJECTION(imagecolorat); + return f_imagecolorat(image, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorclosest f_imagecolorclosest +#else +inline Variant x_imagecolorclosest(CObjRef image, int red, int green, int blue) { + FUNCTION_INJECTION(imagecolorclosest); + return f_imagecolorclosest(image, red, green, blue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorclosestalpha f_imagecolorclosestalpha +#else +inline Variant x_imagecolorclosestalpha(CObjRef image, int red, int green, int blue, int alpha) { + FUNCTION_INJECTION(imagecolorclosestalpha); + return f_imagecolorclosestalpha(image, red, green, blue, alpha); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorclosesthwb f_imagecolorclosesthwb +#else +inline Variant x_imagecolorclosesthwb(CObjRef image, int red, int green, int blue) { + FUNCTION_INJECTION(imagecolorclosesthwb); + return f_imagecolorclosesthwb(image, red, green, blue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolordeallocate f_imagecolordeallocate +#else +inline bool x_imagecolordeallocate(CObjRef image, int color) { + FUNCTION_INJECTION(imagecolordeallocate); + return f_imagecolordeallocate(image, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorexact f_imagecolorexact +#else +inline Variant x_imagecolorexact(CObjRef image, int red, int green, int blue) { + FUNCTION_INJECTION(imagecolorexact); + return f_imagecolorexact(image, red, green, blue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorexactalpha f_imagecolorexactalpha +#else +inline Variant x_imagecolorexactalpha(CObjRef image, int red, int green, int blue, int alpha) { + FUNCTION_INJECTION(imagecolorexactalpha); + return f_imagecolorexactalpha(image, red, green, blue, alpha); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolormatch f_imagecolormatch +#else +inline Variant x_imagecolormatch(CObjRef image1, CObjRef image2) { + FUNCTION_INJECTION(imagecolormatch); + return f_imagecolormatch(image1, image2); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorresolve f_imagecolorresolve +#else +inline Variant x_imagecolorresolve(CObjRef image, int red, int green, int blue) { + FUNCTION_INJECTION(imagecolorresolve); + return f_imagecolorresolve(image, red, green, blue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorresolvealpha f_imagecolorresolvealpha +#else +inline Variant x_imagecolorresolvealpha(CObjRef image, int red, int green, int blue, int alpha) { + FUNCTION_INJECTION(imagecolorresolvealpha); + return f_imagecolorresolvealpha(image, red, green, blue, alpha); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorset f_imagecolorset +#else +inline Variant x_imagecolorset(CObjRef image, int index, int red, int green, int blue) { + FUNCTION_INJECTION(imagecolorset); + return f_imagecolorset(image, index, red, green, blue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorsforindex f_imagecolorsforindex +#else +inline Variant x_imagecolorsforindex(CObjRef image, int index) { + FUNCTION_INJECTION(imagecolorsforindex); + return f_imagecolorsforindex(image, index); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolorstotal f_imagecolorstotal +#else +inline Variant x_imagecolorstotal(CObjRef image) { + FUNCTION_INJECTION(imagecolorstotal); + return f_imagecolorstotal(image); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecolortransparent f_imagecolortransparent +#else +inline Variant x_imagecolortransparent(CObjRef image, int color = -1) { + FUNCTION_INJECTION(imagecolortransparent); + return f_imagecolortransparent(image, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imageconvolution f_imageconvolution +#else +inline bool x_imageconvolution(CObjRef image, CArrRef matrix, double div, double offset) { + FUNCTION_INJECTION(imageconvolution); + return f_imageconvolution(image, matrix, div, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecopy f_imagecopy +#else +inline bool x_imagecopy(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h) { + FUNCTION_INJECTION(imagecopy); + return f_imagecopy(dst_im, src_im, dst_x, dst_y, src_x, src_y, src_w, src_h); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecopymerge f_imagecopymerge +#else +inline bool x_imagecopymerge(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct) { + FUNCTION_INJECTION(imagecopymerge); + return f_imagecopymerge(dst_im, src_im, dst_x, dst_y, src_x, src_y, src_w, src_h, pct); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecopymergegray f_imagecopymergegray +#else +inline bool x_imagecopymergegray(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h, int pct) { + FUNCTION_INJECTION(imagecopymergegray); + return f_imagecopymergegray(dst_im, src_im, dst_x, dst_y, src_x, src_y, src_w, src_h, pct); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecopyresampled f_imagecopyresampled +#else +inline bool x_imagecopyresampled(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h) { + FUNCTION_INJECTION(imagecopyresampled); + return f_imagecopyresampled(dst_im, src_im, dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecopyresized f_imagecopyresized +#else +inline bool x_imagecopyresized(CObjRef dst_im, CObjRef src_im, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h) { + FUNCTION_INJECTION(imagecopyresized); + return f_imagecopyresized(dst_im, src_im, dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreate f_imagecreate +#else +inline Variant x_imagecreate(int width, int height) { + FUNCTION_INJECTION(imagecreate); + return f_imagecreate(width, height); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatefromgd2part f_imagecreatefromgd2part +#else +inline Variant x_imagecreatefromgd2part(CStrRef filename, int srcx, int srcy, int width, int height) { + FUNCTION_INJECTION(imagecreatefromgd2part); + return f_imagecreatefromgd2part(filename, srcx, srcy, width, height); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatefromgd f_imagecreatefromgd +#else +inline Variant x_imagecreatefromgd(CStrRef filename) { + FUNCTION_INJECTION(imagecreatefromgd); + return f_imagecreatefromgd(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatefromgd2 f_imagecreatefromgd2 +#else +inline Variant x_imagecreatefromgd2(CStrRef filename) { + FUNCTION_INJECTION(imagecreatefromgd2); + return f_imagecreatefromgd2(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatefromgif f_imagecreatefromgif +#else +inline Variant x_imagecreatefromgif(CStrRef filename) { + FUNCTION_INJECTION(imagecreatefromgif); + return f_imagecreatefromgif(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatefromjpeg f_imagecreatefromjpeg +#else +inline Variant x_imagecreatefromjpeg(CStrRef filename) { + FUNCTION_INJECTION(imagecreatefromjpeg); + return f_imagecreatefromjpeg(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatefrompng f_imagecreatefrompng +#else +inline Variant x_imagecreatefrompng(CStrRef filename) { + FUNCTION_INJECTION(imagecreatefrompng); + return f_imagecreatefrompng(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatefromstring f_imagecreatefromstring +#else +inline Variant x_imagecreatefromstring(CStrRef data) { + FUNCTION_INJECTION(imagecreatefromstring); + return f_imagecreatefromstring(data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatefromwbmp f_imagecreatefromwbmp +#else +inline Variant x_imagecreatefromwbmp(CStrRef filename) { + FUNCTION_INJECTION(imagecreatefromwbmp); + return f_imagecreatefromwbmp(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatefromxbm f_imagecreatefromxbm +#else +inline Variant x_imagecreatefromxbm(CStrRef filename) { + FUNCTION_INJECTION(imagecreatefromxbm); + return f_imagecreatefromxbm(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatefromxpm f_imagecreatefromxpm +#else +inline Variant x_imagecreatefromxpm(CStrRef filename) { + FUNCTION_INJECTION(imagecreatefromxpm); + return f_imagecreatefromxpm(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagecreatetruecolor f_imagecreatetruecolor +#else +inline Variant x_imagecreatetruecolor(int width, int height) { + FUNCTION_INJECTION(imagecreatetruecolor); + return f_imagecreatetruecolor(width, height); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagedashedline f_imagedashedline +#else +inline bool x_imagedashedline(CObjRef image, int x1, int y1, int x2, int y2, int color) { + FUNCTION_INJECTION(imagedashedline); + return f_imagedashedline(image, x1, y1, x2, y2, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagedestroy f_imagedestroy +#else +inline bool x_imagedestroy(CObjRef image) { + FUNCTION_INJECTION(imagedestroy); + return f_imagedestroy(image); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imageellipse f_imageellipse +#else +inline bool x_imageellipse(CObjRef image, int cx, int cy, int width, int height, int color) { + FUNCTION_INJECTION(imageellipse); + return f_imageellipse(image, cx, cy, width, height, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagefill f_imagefill +#else +inline bool x_imagefill(CObjRef image, int x, int y, int color) { + FUNCTION_INJECTION(imagefill); + return f_imagefill(image, x, y, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagefilledarc f_imagefilledarc +#else +inline bool x_imagefilledarc(CObjRef image, int cx, int cy, int width, int height, int start, int end, int color, int style) { + FUNCTION_INJECTION(imagefilledarc); + return f_imagefilledarc(image, cx, cy, width, height, start, end, color, style); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagefilledellipse f_imagefilledellipse +#else +inline bool x_imagefilledellipse(CObjRef image, int cx, int cy, int width, int height, int color) { + FUNCTION_INJECTION(imagefilledellipse); + return f_imagefilledellipse(image, cx, cy, width, height, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagefilledpolygon f_imagefilledpolygon +#else +inline bool x_imagefilledpolygon(CObjRef image, CArrRef points, int num_points, int color) { + FUNCTION_INJECTION(imagefilledpolygon); + return f_imagefilledpolygon(image, points, num_points, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagefilledrectangle f_imagefilledrectangle +#else +inline bool x_imagefilledrectangle(CObjRef image, int x1, int y1, int x2, int y2, int color) { + FUNCTION_INJECTION(imagefilledrectangle); + return f_imagefilledrectangle(image, x1, y1, x2, y2, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagefilltoborder f_imagefilltoborder +#else +inline bool x_imagefilltoborder(CObjRef image, int x, int y, int border, int color) { + FUNCTION_INJECTION(imagefilltoborder); + return f_imagefilltoborder(image, x, y, border, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagefilter f_imagefilter +#else +inline bool x_imagefilter(CObjRef image, int filtertype, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0) { + FUNCTION_INJECTION(imagefilter); + return f_imagefilter(image, filtertype, arg1, arg2, arg3, arg4); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagefontheight f_imagefontheight +#else +inline int x_imagefontheight(int font) { + FUNCTION_INJECTION(imagefontheight); + return f_imagefontheight(font); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagefontwidth f_imagefontwidth +#else +inline int x_imagefontwidth(int font) { + FUNCTION_INJECTION(imagefontwidth); + return f_imagefontwidth(font); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imageftbbox f_imageftbbox +#else +inline Variant x_imageftbbox(double size, double angle, CStrRef font_file, CStrRef text, CArrRef extrainfo = null) { + FUNCTION_INJECTION(imageftbbox); + return f_imageftbbox(size, angle, font_file, text, extrainfo); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagefttext f_imagefttext +#else +inline Variant x_imagefttext(CObjRef image, double size, double angle, int x, int y, int col, CStrRef font_file, CStrRef text, CArrRef extrainfo = null) { + FUNCTION_INJECTION(imagefttext); + return f_imagefttext(image, size, angle, x, y, col, font_file, text, extrainfo); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagegammacorrect f_imagegammacorrect +#else +inline bool x_imagegammacorrect(CObjRef image, double inputgamma, double outputgamma) { + FUNCTION_INJECTION(imagegammacorrect); + return f_imagegammacorrect(image, inputgamma, outputgamma); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagegd2 f_imagegd2 +#else +inline bool x_imagegd2(CObjRef image, CStrRef filename = null_string, int chunk_size = 0, int type = 0) { + FUNCTION_INJECTION(imagegd2); + return f_imagegd2(image, filename, chunk_size, type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagegd f_imagegd +#else +inline bool x_imagegd(CObjRef image, CStrRef filename = null_string) { + FUNCTION_INJECTION(imagegd); + return f_imagegd(image, filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagegif f_imagegif +#else +inline bool x_imagegif(CObjRef image, CStrRef filename = null_string) { + FUNCTION_INJECTION(imagegif); + return f_imagegif(image, filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagegrabscreen f_imagegrabscreen +#else +inline Variant x_imagegrabscreen() { + FUNCTION_INJECTION(imagegrabscreen); + return f_imagegrabscreen(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagegrabwindow f_imagegrabwindow +#else +inline Variant x_imagegrabwindow(int window, int client_area = 0) { + FUNCTION_INJECTION(imagegrabwindow); + return f_imagegrabwindow(window, client_area); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imageinterlace f_imageinterlace +#else +inline Variant x_imageinterlace(CObjRef image, int interlace = 0) { + FUNCTION_INJECTION(imageinterlace); + return f_imageinterlace(image, interlace); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imageistruecolor f_imageistruecolor +#else +inline bool x_imageistruecolor(CObjRef image) { + FUNCTION_INJECTION(imageistruecolor); + return f_imageistruecolor(image); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagejpeg f_imagejpeg +#else +inline bool x_imagejpeg(CObjRef image, CStrRef filename = null_string, int quality = -1) { + FUNCTION_INJECTION(imagejpeg); + return f_imagejpeg(image, filename, quality); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagelayereffect f_imagelayereffect +#else +inline bool x_imagelayereffect(CObjRef image, int effect) { + FUNCTION_INJECTION(imagelayereffect); + return f_imagelayereffect(image, effect); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imageline f_imageline +#else +inline bool x_imageline(CObjRef image, int x1, int y1, int x2, int y2, int color) { + FUNCTION_INJECTION(imageline); + return f_imageline(image, x1, y1, x2, y2, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imageloadfont f_imageloadfont +#else +inline Variant x_imageloadfont(CStrRef file) { + FUNCTION_INJECTION(imageloadfont); + return f_imageloadfont(file); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagepalettecopy f_imagepalettecopy +#else +inline void x_imagepalettecopy(CObjRef destination, CObjRef source) { + FUNCTION_INJECTION(imagepalettecopy); + f_imagepalettecopy(destination, source); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagepng f_imagepng +#else +inline bool x_imagepng(CObjRef image, CStrRef filename = null_string, int quality = -1, int filters = -1) { + FUNCTION_INJECTION(imagepng); + return f_imagepng(image, filename, quality, filters); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagepolygon f_imagepolygon +#else +inline bool x_imagepolygon(CObjRef image, CArrRef points, int num_points, int color) { + FUNCTION_INJECTION(imagepolygon); + return f_imagepolygon(image, points, num_points, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagepsbbox f_imagepsbbox +#else +inline Array x_imagepsbbox(CStrRef text, int font, int size, int space = 0, int tightness = 0, double angle = 0.0) { + FUNCTION_INJECTION(imagepsbbox); + return f_imagepsbbox(text, font, size, space, tightness, angle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagepsencodefont f_imagepsencodefont +#else +inline bool x_imagepsencodefont(CObjRef font_index, CStrRef encodingfile) { + FUNCTION_INJECTION(imagepsencodefont); + return f_imagepsencodefont(font_index, encodingfile); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagepsextendfont f_imagepsextendfont +#else +inline bool x_imagepsextendfont(int font_index, double extend) { + FUNCTION_INJECTION(imagepsextendfont); + return f_imagepsextendfont(font_index, extend); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagepsfreefont f_imagepsfreefont +#else +inline bool x_imagepsfreefont(CObjRef fontindex) { + FUNCTION_INJECTION(imagepsfreefont); + return f_imagepsfreefont(fontindex); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagepsloadfont f_imagepsloadfont +#else +inline Object x_imagepsloadfont(CStrRef filename) { + FUNCTION_INJECTION(imagepsloadfont); + return f_imagepsloadfont(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagepsslantfont f_imagepsslantfont +#else +inline bool x_imagepsslantfont(CObjRef font_index, double slant) { + FUNCTION_INJECTION(imagepsslantfont); + return f_imagepsslantfont(font_index, slant); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagepstext f_imagepstext +#else +inline Array x_imagepstext(CObjRef image, CStrRef text, CObjRef font, int size, int foreground, int background, int x, int y, int space = 0, int tightness = 0, double angle = 0.0, int antialias_steps = 0) { + FUNCTION_INJECTION(imagepstext); + return f_imagepstext(image, text, font, size, foreground, background, x, y, space, tightness, angle, antialias_steps); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagerectangle f_imagerectangle +#else +inline bool x_imagerectangle(CObjRef image, int x1, int y1, int x2, int y2, int color) { + FUNCTION_INJECTION(imagerectangle); + return f_imagerectangle(image, x1, y1, x2, y2, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagerotate f_imagerotate +#else +inline Variant x_imagerotate(CObjRef source_image, double angle, int bgd_color, int ignore_transparent = 0) { + FUNCTION_INJECTION(imagerotate); + return f_imagerotate(source_image, angle, bgd_color, ignore_transparent); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagesavealpha f_imagesavealpha +#else +inline bool x_imagesavealpha(CObjRef image, bool saveflag) { + FUNCTION_INJECTION(imagesavealpha); + return f_imagesavealpha(image, saveflag); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagesetbrush f_imagesetbrush +#else +inline bool x_imagesetbrush(CObjRef image, CObjRef brush) { + FUNCTION_INJECTION(imagesetbrush); + return f_imagesetbrush(image, brush); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagesetpixel f_imagesetpixel +#else +inline bool x_imagesetpixel(CObjRef image, int x, int y, int color) { + FUNCTION_INJECTION(imagesetpixel); + return f_imagesetpixel(image, x, y, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagesetstyle f_imagesetstyle +#else +inline bool x_imagesetstyle(CObjRef image, CArrRef style) { + FUNCTION_INJECTION(imagesetstyle); + return f_imagesetstyle(image, style); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagesetthickness f_imagesetthickness +#else +inline bool x_imagesetthickness(CObjRef image, int thickness) { + FUNCTION_INJECTION(imagesetthickness); + return f_imagesetthickness(image, thickness); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagesettile f_imagesettile +#else +inline bool x_imagesettile(CObjRef image, CObjRef tile) { + FUNCTION_INJECTION(imagesettile); + return f_imagesettile(image, tile); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagestring f_imagestring +#else +inline bool x_imagestring(CObjRef image, int font, int x, int y, CStrRef str, int color) { + FUNCTION_INJECTION(imagestring); + return f_imagestring(image, font, x, y, str, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagestringup f_imagestringup +#else +inline bool x_imagestringup(CObjRef image, int font, int x, int y, CStrRef str, int color) { + FUNCTION_INJECTION(imagestringup); + return f_imagestringup(image, font, x, y, str, color); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagesx f_imagesx +#else +inline Variant x_imagesx(CObjRef image) { + FUNCTION_INJECTION(imagesx); + return f_imagesx(image); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagesy f_imagesy +#else +inline Variant x_imagesy(CObjRef image) { + FUNCTION_INJECTION(imagesy); + return f_imagesy(image); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagetruecolortopalette f_imagetruecolortopalette +#else +inline Variant x_imagetruecolortopalette(CObjRef image, bool dither, int ncolors) { + FUNCTION_INJECTION(imagetruecolortopalette); + return f_imagetruecolortopalette(image, dither, ncolors); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagettfbbox f_imagettfbbox +#else +inline Variant x_imagettfbbox(double size, double angle, CStrRef fontfile, CStrRef text) { + FUNCTION_INJECTION(imagettfbbox); + return f_imagettfbbox(size, angle, fontfile, text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagettftext f_imagettftext +#else +inline Variant x_imagettftext(CObjRef image, double size, double angle, int x, int y, int color, CStrRef fontfile, CStrRef text) { + FUNCTION_INJECTION(imagettftext); + return f_imagettftext(image, size, angle, x, y, color, fontfile, text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagetypes f_imagetypes +#else +inline int x_imagetypes() { + FUNCTION_INJECTION(imagetypes); + return f_imagetypes(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagewbmp f_imagewbmp +#else +inline bool x_imagewbmp(CObjRef image, CStrRef filename = null_string, int foreground = -1) { + FUNCTION_INJECTION(imagewbmp); + return f_imagewbmp(image, filename, foreground); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_imagexbm f_imagexbm +#else +inline bool x_imagexbm(CObjRef image, CStrRef filename = null_string, int foreground = -1) { + FUNCTION_INJECTION(imagexbm); + return f_imagexbm(image, filename, foreground); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iptcembed f_iptcembed +#else +inline Variant x_iptcembed(CStrRef iptcdata, CStrRef jpeg_file_name, int spool = 0) { + FUNCTION_INJECTION(iptcembed); + return f_iptcembed(iptcdata, jpeg_file_name, spool); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_iptcparse f_iptcparse +#else +inline Variant x_iptcparse(CStrRef iptcblock) { + FUNCTION_INJECTION(iptcparse); + return f_iptcparse(iptcblock); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_jpeg2wbmp f_jpeg2wbmp +#else +inline bool x_jpeg2wbmp(CStrRef jpegname, CStrRef wbmpname, int dest_height, int dest_width, int threshold) { + FUNCTION_INJECTION(jpeg2wbmp); + return f_jpeg2wbmp(jpegname, wbmpname, dest_height, dest_width, threshold); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_png2wbmp f_png2wbmp +#else +inline bool x_png2wbmp(CStrRef pngname, CStrRef wbmpname, int dest_height, int dest_width, int threshold) { + FUNCTION_INJECTION(png2wbmp); + return f_png2wbmp(pngname, wbmpname, dest_height, dest_width, threshold); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_exif_imagetype f_exif_imagetype +#else +inline Variant x_exif_imagetype(CStrRef filename) { + FUNCTION_INJECTION(exif_imagetype); + return f_exif_imagetype(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_exif_read_data f_exif_read_data +#else +inline Variant x_exif_read_data(CStrRef filename, CStrRef sections = null_string, bool arrays = false, bool thumbnail = false) { + FUNCTION_INJECTION(exif_read_data); + return f_exif_read_data(filename, sections, arrays, thumbnail); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_read_exif_data f_read_exif_data +#else +inline Variant x_read_exif_data(CStrRef filename, CStrRef sections = null_string, bool arrays = false, bool thumbnail = false) { + FUNCTION_INJECTION(read_exif_data); + return f_read_exif_data(filename, sections, arrays, thumbnail); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_exif_tagname f_exif_tagname +#else +inline Variant x_exif_tagname(int index) { + FUNCTION_INJECTION(exif_tagname); + return f_exif_tagname(index); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_exif_thumbnail f_exif_thumbnail +#else +inline Variant x_exif_thumbnail(CStrRef filename, Variant width = null, Variant height = null, Variant imagetype = null) { + FUNCTION_INJECTION(exif_thumbnail); + return f_exif_thumbnail(filename, ref(width), ref(height), ref(imagetype)); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_IMAGE_H__ diff --git a/src/cpp/ext/profile/extprofile_ipc.h b/src/cpp/ext/profile/extprofile_ipc.h new file mode 100644 index 0000000000000..491ea01d819f5 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_ipc.h @@ -0,0 +1,185 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_IPC_H__ +#define __EXTPROFILE_IPC_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_ftok f_ftok +#else +inline int64 x_ftok(CStrRef pathname, CStrRef proj) { + FUNCTION_INJECTION(ftok); + return f_ftok(pathname, proj); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_msg_get_queue f_msg_get_queue +#else +inline Variant x_msg_get_queue(int64 key, int64 perms = 0666) { + FUNCTION_INJECTION(msg_get_queue); + return f_msg_get_queue(key, perms); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_msg_send f_msg_send +#else +inline bool x_msg_send(CObjRef queue, int64 msgtype, CVarRef message, bool serialize = true, bool blocking = true, Variant errorcode = null) { + FUNCTION_INJECTION(msg_send); + return f_msg_send(queue, msgtype, message, serialize, blocking, ref(errorcode)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_msg_receive f_msg_receive +#else +inline bool x_msg_receive(CObjRef queue, int64 desiredmsgtype, Variant msgtype, int64 maxsize, Variant message, bool unserialize = true, int64 flags = 0, Variant errorcode = null) { + FUNCTION_INJECTION(msg_receive); + return f_msg_receive(queue, desiredmsgtype, ref(msgtype), maxsize, ref(message), unserialize, flags, ref(errorcode)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_msg_remove_queue f_msg_remove_queue +#else +inline bool x_msg_remove_queue(CObjRef queue) { + FUNCTION_INJECTION(msg_remove_queue); + return f_msg_remove_queue(queue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_msg_set_queue f_msg_set_queue +#else +inline bool x_msg_set_queue(CObjRef queue, CArrRef data) { + FUNCTION_INJECTION(msg_set_queue); + return f_msg_set_queue(queue, data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_msg_stat_queue f_msg_stat_queue +#else +inline Array x_msg_stat_queue(CObjRef queue) { + FUNCTION_INJECTION(msg_stat_queue); + return f_msg_stat_queue(queue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sem_acquire f_sem_acquire +#else +inline bool x_sem_acquire(CObjRef sem_identifier) { + FUNCTION_INJECTION(sem_acquire); + return f_sem_acquire(sem_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sem_get f_sem_get +#else +inline Variant x_sem_get(int64 key, int64 max_acquire = 1, int64 perm = 0666, bool auto_release = true) { + FUNCTION_INJECTION(sem_get); + return f_sem_get(key, max_acquire, perm, auto_release); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sem_release f_sem_release +#else +inline bool x_sem_release(CObjRef sem_identifier) { + FUNCTION_INJECTION(sem_release); + return f_sem_release(sem_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sem_remove f_sem_remove +#else +inline bool x_sem_remove(CObjRef sem_identifier) { + FUNCTION_INJECTION(sem_remove); + return f_sem_remove(sem_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_shm_attach f_shm_attach +#else +inline Variant x_shm_attach(int64 shm_key, int64 shm_size = 10000, int64 shm_flag = 0666) { + FUNCTION_INJECTION(shm_attach); + return f_shm_attach(shm_key, shm_size, shm_flag); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_shm_detach f_shm_detach +#else +inline bool x_shm_detach(int64 shm_identifier) { + FUNCTION_INJECTION(shm_detach); + return f_shm_detach(shm_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_shm_remove f_shm_remove +#else +inline bool x_shm_remove(int64 shm_identifier) { + FUNCTION_INJECTION(shm_remove); + return f_shm_remove(shm_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_shm_get_var f_shm_get_var +#else +inline Variant x_shm_get_var(int64 shm_identifier, int64 variable_key) { + FUNCTION_INJECTION(shm_get_var); + return f_shm_get_var(shm_identifier, variable_key); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_shm_put_var f_shm_put_var +#else +inline bool x_shm_put_var(int64 shm_identifier, int64 variable_key, CVarRef variable) { + FUNCTION_INJECTION(shm_put_var); + return f_shm_put_var(shm_identifier, variable_key, variable); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_shm_remove_var f_shm_remove_var +#else +inline bool x_shm_remove_var(int64 shm_identifier, int64 variable_key) { + FUNCTION_INJECTION(shm_remove_var); + return f_shm_remove_var(shm_identifier, variable_key); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_IPC_H__ diff --git a/src/cpp/ext/profile/extprofile_json.h b/src/cpp/ext/profile/extprofile_json.h new file mode 100644 index 0000000000000..5518ffbef24f0 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_json.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_JSON_H__ +#define __EXTPROFILE_JSON_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_json_encode f_json_encode +#else +inline String x_json_encode(CVarRef value, bool loose = false) { + FUNCTION_INJECTION(json_encode); + return f_json_encode(value, loose); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_json_decode f_json_decode +#else +inline Variant x_json_decode(CStrRef json, bool assoc = false, bool loose = false) { + FUNCTION_INJECTION(json_decode); + return f_json_decode(json, assoc, loose); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_JSON_H__ diff --git a/src/cpp/ext/profile/extprofile_ldap.h b/src/cpp/ext/profile/extprofile_ldap.h new file mode 100644 index 0000000000000..3b31b71bef913 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_ldap.h @@ -0,0 +1,419 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_LDAP_H__ +#define __EXTPROFILE_LDAP_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_ldap_connect f_ldap_connect +#else +inline Object x_ldap_connect(CStrRef hostname = null_string, int port = 389) { + FUNCTION_INJECTION(ldap_connect); + return f_ldap_connect(hostname, port); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_explode_dn f_ldap_explode_dn +#else +inline Array x_ldap_explode_dn(CStrRef dn, int with_attrib) { + FUNCTION_INJECTION(ldap_explode_dn); + return f_ldap_explode_dn(dn, with_attrib); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_dn2ufn f_ldap_dn2ufn +#else +inline String x_ldap_dn2ufn(CStrRef db) { + FUNCTION_INJECTION(ldap_dn2ufn); + return f_ldap_dn2ufn(db); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_err2str f_ldap_err2str +#else +inline String x_ldap_err2str(int errnum) { + FUNCTION_INJECTION(ldap_err2str); + return f_ldap_err2str(errnum); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_8859_to_t61 f_ldap_8859_to_t61 +#else +inline String x_ldap_8859_to_t61(CStrRef value) { + FUNCTION_INJECTION(ldap_8859_to_t61); + return f_ldap_8859_to_t61(value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_t61_to_8859 f_ldap_t61_to_8859 +#else +inline String x_ldap_t61_to_8859(CStrRef value) { + FUNCTION_INJECTION(ldap_t61_to_8859); + return f_ldap_t61_to_8859(value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_add f_ldap_add +#else +inline bool x_ldap_add(CObjRef link_identifier, CStrRef dn, CArrRef entry) { + FUNCTION_INJECTION(ldap_add); + return f_ldap_add(link_identifier, dn, entry); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_mod_add f_ldap_mod_add +#else +inline bool x_ldap_mod_add(CObjRef link_identifier, CStrRef dn, CArrRef entry) { + FUNCTION_INJECTION(ldap_mod_add); + return f_ldap_mod_add(link_identifier, dn, entry); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_mod_del f_ldap_mod_del +#else +inline bool x_ldap_mod_del(CObjRef link_identifier, CStrRef dn, CArrRef entry) { + FUNCTION_INJECTION(ldap_mod_del); + return f_ldap_mod_del(link_identifier, dn, entry); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_mod_replace f_ldap_mod_replace +#else +inline bool x_ldap_mod_replace(CObjRef link_identifier, CStrRef dn, CArrRef entry) { + FUNCTION_INJECTION(ldap_mod_replace); + return f_ldap_mod_replace(link_identifier, dn, entry); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_modify f_ldap_modify +#else +inline bool x_ldap_modify(CObjRef link_identifier, CStrRef dn, CArrRef entry) { + FUNCTION_INJECTION(ldap_modify); + return f_ldap_modify(link_identifier, dn, entry); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_bind f_ldap_bind +#else +inline bool x_ldap_bind(CObjRef link_identifier, CStrRef bind_rdn = null_string, CStrRef bind_password = null_string) { + FUNCTION_INJECTION(ldap_bind); + return f_ldap_bind(link_identifier, bind_rdn, bind_password); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_sasl_bind f_ldap_sasl_bind +#else +inline bool x_ldap_sasl_bind(CObjRef link, CStrRef binddn = null_string, CStrRef password = null_string, CStrRef sasl_mech = null_string, CStrRef sasl_realm = null_string, CStrRef sasl_authz_id = null_string, CStrRef props = null_string) { + FUNCTION_INJECTION(ldap_sasl_bind); + return f_ldap_sasl_bind(link, binddn, password, sasl_mech, sasl_realm, sasl_authz_id, props); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_set_rebind_proc f_ldap_set_rebind_proc +#else +inline bool x_ldap_set_rebind_proc(CObjRef link, CStrRef callback) { + FUNCTION_INJECTION(ldap_set_rebind_proc); + return f_ldap_set_rebind_proc(link, callback); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_sort f_ldap_sort +#else +inline bool x_ldap_sort(CObjRef link, CObjRef result, CStrRef sortfilter) { + FUNCTION_INJECTION(ldap_sort); + return f_ldap_sort(link, result, sortfilter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_start_tls f_ldap_start_tls +#else +inline bool x_ldap_start_tls(CObjRef link) { + FUNCTION_INJECTION(ldap_start_tls); + return f_ldap_start_tls(link); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_unbind f_ldap_unbind +#else +inline bool x_ldap_unbind(CObjRef link_identifier) { + FUNCTION_INJECTION(ldap_unbind); + return f_ldap_unbind(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_get_option f_ldap_get_option +#else +inline bool x_ldap_get_option(CObjRef link_identifier, int option, Variant retval) { + FUNCTION_INJECTION(ldap_get_option); + return f_ldap_get_option(link_identifier, option, ref(retval)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_set_option f_ldap_set_option +#else +inline bool x_ldap_set_option(CObjRef link_identifier, int option, CVarRef newval) { + FUNCTION_INJECTION(ldap_set_option); + return f_ldap_set_option(link_identifier, option, newval); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_close f_ldap_close +#else +inline bool x_ldap_close(CObjRef link_identifier) { + FUNCTION_INJECTION(ldap_close); + return f_ldap_close(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_list f_ldap_list +#else +inline Object x_ldap_list(CObjRef link_identifier, CStrRef base_dn, CStrRef filter, CArrRef attributes = null, int attrsonly = 0, int sizelimit = 0, int timelimit = 0, int deref = 0) { + FUNCTION_INJECTION(ldap_list); + return f_ldap_list(link_identifier, base_dn, filter, attributes, attrsonly, sizelimit, timelimit, deref); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_read f_ldap_read +#else +inline Object x_ldap_read(CObjRef link_identifier, CStrRef base_dn, CStrRef filter, CArrRef attributes = null, int attrsonly = 0, int sizelimit = 0, int timelimit = 0, int deref = 0) { + FUNCTION_INJECTION(ldap_read); + return f_ldap_read(link_identifier, base_dn, filter, attributes, attrsonly, sizelimit, timelimit, deref); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_search f_ldap_search +#else +inline Object x_ldap_search(CObjRef link_identifier, CStrRef base_dn, CStrRef filter, CArrRef attributes = null, int attrsonly = 0, int sizelimit = 0, int timelimit = 0, int deref = 0) { + FUNCTION_INJECTION(ldap_search); + return f_ldap_search(link_identifier, base_dn, filter, attributes, attrsonly, sizelimit, timelimit, deref); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_rename f_ldap_rename +#else +inline bool x_ldap_rename(CObjRef link_identifier, CStrRef dn, CStrRef newrdn, CStrRef newparent, bool deleteoldrdn) { + FUNCTION_INJECTION(ldap_rename); + return f_ldap_rename(link_identifier, dn, newrdn, newparent, deleteoldrdn); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_delete f_ldap_delete +#else +inline bool x_ldap_delete(CObjRef link_identifier, CStrRef dn) { + FUNCTION_INJECTION(ldap_delete); + return f_ldap_delete(link_identifier, dn); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_compare f_ldap_compare +#else +inline Variant x_ldap_compare(CObjRef link_identifier, CStrRef dn, CStrRef attribute, CStrRef value) { + FUNCTION_INJECTION(ldap_compare); + return f_ldap_compare(link_identifier, dn, attribute, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_errno f_ldap_errno +#else +inline int x_ldap_errno(CObjRef link_identifier) { + FUNCTION_INJECTION(ldap_errno); + return f_ldap_errno(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_error f_ldap_error +#else +inline String x_ldap_error(CObjRef link_identifier) { + FUNCTION_INJECTION(ldap_error); + return f_ldap_error(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_get_dn f_ldap_get_dn +#else +inline String x_ldap_get_dn(CObjRef link_identifier, CObjRef result_entry_identifier) { + FUNCTION_INJECTION(ldap_get_dn); + return f_ldap_get_dn(link_identifier, result_entry_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_count_entries f_ldap_count_entries +#else +inline int x_ldap_count_entries(CObjRef link_identifier, CObjRef result_identifier) { + FUNCTION_INJECTION(ldap_count_entries); + return f_ldap_count_entries(link_identifier, result_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_get_entries f_ldap_get_entries +#else +inline Array x_ldap_get_entries(CObjRef link_identifier, CObjRef result_identifier) { + FUNCTION_INJECTION(ldap_get_entries); + return f_ldap_get_entries(link_identifier, result_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_first_entry f_ldap_first_entry +#else +inline Object x_ldap_first_entry(CObjRef link_identifier, CObjRef result_identifier) { + FUNCTION_INJECTION(ldap_first_entry); + return f_ldap_first_entry(link_identifier, result_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_next_entry f_ldap_next_entry +#else +inline Object x_ldap_next_entry(CObjRef link_identifier, CObjRef result_identifier) { + FUNCTION_INJECTION(ldap_next_entry); + return f_ldap_next_entry(link_identifier, result_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_get_attributes f_ldap_get_attributes +#else +inline Array x_ldap_get_attributes(CObjRef link_identifier, CObjRef result_entry_identifier) { + FUNCTION_INJECTION(ldap_get_attributes); + return f_ldap_get_attributes(link_identifier, result_entry_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_first_attribute f_ldap_first_attribute +#else +inline String x_ldap_first_attribute(CObjRef link_identifier, CObjRef result_identifier) { + FUNCTION_INJECTION(ldap_first_attribute); + return f_ldap_first_attribute(link_identifier, result_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_next_attribute f_ldap_next_attribute +#else +inline String x_ldap_next_attribute(CObjRef link_identifier, CObjRef result_entry_identifier) { + FUNCTION_INJECTION(ldap_next_attribute); + return f_ldap_next_attribute(link_identifier, result_entry_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_first_reference f_ldap_first_reference +#else +inline Object x_ldap_first_reference(CObjRef link_identifier, CObjRef result_identifier) { + FUNCTION_INJECTION(ldap_first_reference); + return f_ldap_first_reference(link_identifier, result_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_next_reference f_ldap_next_reference +#else +inline Object x_ldap_next_reference(CObjRef link_identifier, CObjRef result_identifier) { + FUNCTION_INJECTION(ldap_next_reference); + return f_ldap_next_reference(link_identifier, result_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_parse_reference f_ldap_parse_reference +#else +inline bool x_ldap_parse_reference(CObjRef link_identifier, CObjRef result_identifier, Variant referrals) { + FUNCTION_INJECTION(ldap_parse_reference); + return f_ldap_parse_reference(link_identifier, result_identifier, ref(referrals)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_parse_result f_ldap_parse_result +#else +inline bool x_ldap_parse_result(CObjRef link_identifier, CObjRef result_entry_identifier, Variant errcode, Variant matcheddn = null, Variant errmsg = null, Variant referrals = null) { + FUNCTION_INJECTION(ldap_parse_result); + return f_ldap_parse_result(link_identifier, result_entry_identifier, ref(errcode), ref(matcheddn), ref(errmsg), ref(referrals)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_free_result f_ldap_free_result +#else +inline bool x_ldap_free_result(CObjRef result_identifier) { + FUNCTION_INJECTION(ldap_free_result); + return f_ldap_free_result(result_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_get_values_len f_ldap_get_values_len +#else +inline Array x_ldap_get_values_len(CObjRef link_identifier, CObjRef result_entry_identifier, CStrRef attribute) { + FUNCTION_INJECTION(ldap_get_values_len); + return f_ldap_get_values_len(link_identifier, result_entry_identifier, attribute); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ldap_get_values f_ldap_get_values +#else +inline Array x_ldap_get_values(CObjRef link_identifier, CObjRef result_entry_identifier, CStrRef attribute) { + FUNCTION_INJECTION(ldap_get_values); + return f_ldap_get_values(link_identifier, result_entry_identifier, attribute); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_LDAP_H__ diff --git a/src/cpp/ext/profile/extprofile_magick.h b/src/cpp/ext/profile/extprofile_magick.h new file mode 100644 index 0000000000000..25cdde34b839b --- /dev/null +++ b/src/cpp/ext/profile/extprofile_magick.h @@ -0,0 +1,3884 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_MAGICK_H__ +#define __EXTPROFILE_MAGICK_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_magickgetcopyright f_magickgetcopyright +#else +inline String x_magickgetcopyright() { + FUNCTION_INJECTION(magickgetcopyright); + return f_magickgetcopyright(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgethomeurl f_magickgethomeurl +#else +inline String x_magickgethomeurl() { + FUNCTION_INJECTION(magickgethomeurl); + return f_magickgethomeurl(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetpackagename f_magickgetpackagename +#else +inline String x_magickgetpackagename() { + FUNCTION_INJECTION(magickgetpackagename); + return f_magickgetpackagename(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetquantumdepth f_magickgetquantumdepth +#else +inline double x_magickgetquantumdepth() { + FUNCTION_INJECTION(magickgetquantumdepth); + return f_magickgetquantumdepth(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetreleasedate f_magickgetreleasedate +#else +inline String x_magickgetreleasedate() { + FUNCTION_INJECTION(magickgetreleasedate); + return f_magickgetreleasedate(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetresourcelimit f_magickgetresourcelimit +#else +inline double x_magickgetresourcelimit(int resource_type) { + FUNCTION_INJECTION(magickgetresourcelimit); + return f_magickgetresourcelimit(resource_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetversion f_magickgetversion +#else +inline Array x_magickgetversion() { + FUNCTION_INJECTION(magickgetversion); + return f_magickgetversion(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetversionnumber f_magickgetversionnumber +#else +inline int x_magickgetversionnumber() { + FUNCTION_INJECTION(magickgetversionnumber); + return f_magickgetversionnumber(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetversionstring f_magickgetversionstring +#else +inline String x_magickgetversionstring() { + FUNCTION_INJECTION(magickgetversionstring); + return f_magickgetversionstring(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickqueryconfigureoption f_magickqueryconfigureoption +#else +inline String x_magickqueryconfigureoption(CStrRef option) { + FUNCTION_INJECTION(magickqueryconfigureoption); + return f_magickqueryconfigureoption(option); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickqueryconfigureoptions f_magickqueryconfigureoptions +#else +inline Array x_magickqueryconfigureoptions(CStrRef pattern) { + FUNCTION_INJECTION(magickqueryconfigureoptions); + return f_magickqueryconfigureoptions(pattern); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickqueryfonts f_magickqueryfonts +#else +inline Array x_magickqueryfonts(CStrRef pattern) { + FUNCTION_INJECTION(magickqueryfonts); + return f_magickqueryfonts(pattern); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickqueryformats f_magickqueryformats +#else +inline Array x_magickqueryformats(CStrRef pattern) { + FUNCTION_INJECTION(magickqueryformats); + return f_magickqueryformats(pattern); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetresourcelimit f_magicksetresourcelimit +#else +inline bool x_magicksetresourcelimit(int resource_type, double limit) { + FUNCTION_INJECTION(magicksetresourcelimit); + return f_magicksetresourcelimit(resource_type, limit); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_newdrawingwand f_newdrawingwand +#else +inline Object x_newdrawingwand() { + FUNCTION_INJECTION(newdrawingwand); + return f_newdrawingwand(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_newmagickwand f_newmagickwand +#else +inline Object x_newmagickwand() { + FUNCTION_INJECTION(newmagickwand); + return f_newmagickwand(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_newpixeliterator f_newpixeliterator +#else +inline Object x_newpixeliterator(CObjRef mgck_wnd) { + FUNCTION_INJECTION(newpixeliterator); + return f_newpixeliterator(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_newpixelregioniterator f_newpixelregioniterator +#else +inline Object x_newpixelregioniterator(CObjRef mgck_wnd, int x, int y, int columns, int rows) { + FUNCTION_INJECTION(newpixelregioniterator); + return f_newpixelregioniterator(mgck_wnd, x, y, columns, rows); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_newpixelwand f_newpixelwand +#else +inline Object x_newpixelwand(CStrRef imagemagick_col_str = null_string) { + FUNCTION_INJECTION(newpixelwand); + return f_newpixelwand(imagemagick_col_str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_newpixelwandarray f_newpixelwandarray +#else +inline Array x_newpixelwandarray(int num_pxl_wnds) { + FUNCTION_INJECTION(newpixelwandarray); + return f_newpixelwandarray(num_pxl_wnds); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_newpixelwands f_newpixelwands +#else +inline Array x_newpixelwands(int num_pxl_wnds) { + FUNCTION_INJECTION(newpixelwands); + return f_newpixelwands(num_pxl_wnds); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_destroydrawingwand f_destroydrawingwand +#else +inline void x_destroydrawingwand(CObjRef drw_wnd) { + FUNCTION_INJECTION(destroydrawingwand); + f_destroydrawingwand(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_destroymagickwand f_destroymagickwand +#else +inline void x_destroymagickwand(CObjRef mgck_wnd) { + FUNCTION_INJECTION(destroymagickwand); + f_destroymagickwand(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_destroypixeliterator f_destroypixeliterator +#else +inline void x_destroypixeliterator(CObjRef pxl_iter) { + FUNCTION_INJECTION(destroypixeliterator); + f_destroypixeliterator(pxl_iter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_destroypixelwand f_destroypixelwand +#else +inline void x_destroypixelwand(CObjRef pxl_wnd) { + FUNCTION_INJECTION(destroypixelwand); + f_destroypixelwand(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_destroypixelwandarray f_destroypixelwandarray +#else +inline void x_destroypixelwandarray(CArrRef pxl_wnd_array) { + FUNCTION_INJECTION(destroypixelwandarray); + f_destroypixelwandarray(pxl_wnd_array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_destroypixelwands f_destroypixelwands +#else +inline void x_destroypixelwands(CArrRef pxl_wnd_array) { + FUNCTION_INJECTION(destroypixelwands); + f_destroypixelwands(pxl_wnd_array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_isdrawingwand f_isdrawingwand +#else +inline bool x_isdrawingwand(CVarRef var) { + FUNCTION_INJECTION(isdrawingwand); + return f_isdrawingwand(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ismagickwand f_ismagickwand +#else +inline bool x_ismagickwand(CVarRef var) { + FUNCTION_INJECTION(ismagickwand); + return f_ismagickwand(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ispixeliterator f_ispixeliterator +#else +inline bool x_ispixeliterator(CVarRef var) { + FUNCTION_INJECTION(ispixeliterator); + return f_ispixeliterator(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ispixelwand f_ispixelwand +#else +inline bool x_ispixelwand(CVarRef var) { + FUNCTION_INJECTION(ispixelwand); + return f_ispixelwand(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_cleardrawingwand f_cleardrawingwand +#else +inline void x_cleardrawingwand(CObjRef drw_wnd) { + FUNCTION_INJECTION(cleardrawingwand); + f_cleardrawingwand(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_clearmagickwand f_clearmagickwand +#else +inline void x_clearmagickwand(CObjRef mgck_wnd) { + FUNCTION_INJECTION(clearmagickwand); + f_clearmagickwand(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_clearpixeliterator f_clearpixeliterator +#else +inline void x_clearpixeliterator(CObjRef pxl_iter) { + FUNCTION_INJECTION(clearpixeliterator); + f_clearpixeliterator(pxl_iter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_clearpixelwand f_clearpixelwand +#else +inline void x_clearpixelwand(CObjRef pxl_wnd) { + FUNCTION_INJECTION(clearpixelwand); + f_clearpixelwand(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_clonedrawingwand f_clonedrawingwand +#else +inline Object x_clonedrawingwand(CObjRef drw_wnd) { + FUNCTION_INJECTION(clonedrawingwand); + return f_clonedrawingwand(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_clonemagickwand f_clonemagickwand +#else +inline Object x_clonemagickwand(CObjRef mgck_wnd) { + FUNCTION_INJECTION(clonemagickwand); + return f_clonemagickwand(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_wandgetexception f_wandgetexception +#else +inline Array x_wandgetexception(CObjRef wnd) { + FUNCTION_INJECTION(wandgetexception); + return f_wandgetexception(wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_wandgetexceptionstring f_wandgetexceptionstring +#else +inline String x_wandgetexceptionstring(CObjRef wnd) { + FUNCTION_INJECTION(wandgetexceptionstring); + return f_wandgetexceptionstring(wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_wandgetexceptiontype f_wandgetexceptiontype +#else +inline int x_wandgetexceptiontype(CObjRef wnd) { + FUNCTION_INJECTION(wandgetexceptiontype); + return f_wandgetexceptiontype(wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_wandhasexception f_wandhasexception +#else +inline bool x_wandhasexception(CObjRef wnd) { + FUNCTION_INJECTION(wandhasexception); + return f_wandhasexception(wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawaffine f_drawaffine +#else +inline void x_drawaffine(CObjRef drw_wnd, double sx, double sy, double rx, double ry, double tx, double ty) { + FUNCTION_INJECTION(drawaffine); + f_drawaffine(drw_wnd, sx, sy, rx, ry, tx, ty); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawannotation f_drawannotation +#else +inline void x_drawannotation(CObjRef drw_wnd, double x, double y, CStrRef text) { + FUNCTION_INJECTION(drawannotation); + f_drawannotation(drw_wnd, x, y, text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawarc f_drawarc +#else +inline void x_drawarc(CObjRef drw_wnd, double sx, double sy, double ex, double ey, double sd, double ed) { + FUNCTION_INJECTION(drawarc); + f_drawarc(drw_wnd, sx, sy, ex, ey, sd, ed); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawbezier f_drawbezier +#else +inline void x_drawbezier(CObjRef drw_wnd, CArrRef x_y_points_array) { + FUNCTION_INJECTION(drawbezier); + f_drawbezier(drw_wnd, x_y_points_array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawcircle f_drawcircle +#else +inline void x_drawcircle(CObjRef drw_wnd, double ox, double oy, double px, double py) { + FUNCTION_INJECTION(drawcircle); + f_drawcircle(drw_wnd, ox, oy, px, py); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawcolor f_drawcolor +#else +inline void x_drawcolor(CObjRef drw_wnd, double x, double y, int paint_method) { + FUNCTION_INJECTION(drawcolor); + f_drawcolor(drw_wnd, x, y, paint_method); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawcomment f_drawcomment +#else +inline void x_drawcomment(CObjRef drw_wnd, CStrRef comment) { + FUNCTION_INJECTION(drawcomment); + f_drawcomment(drw_wnd, comment); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawcomposite f_drawcomposite +#else +inline bool x_drawcomposite(CObjRef drw_wnd, int composite_operator, double x, double y, double width, double height, CObjRef mgck_wnd) { + FUNCTION_INJECTION(drawcomposite); + return f_drawcomposite(drw_wnd, composite_operator, x, y, width, height, mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawellipse f_drawellipse +#else +inline void x_drawellipse(CObjRef drw_wnd, double ox, double oy, double rx, double ry, double start, double end) { + FUNCTION_INJECTION(drawellipse); + f_drawellipse(drw_wnd, ox, oy, rx, ry, start, end); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetclippath f_drawgetclippath +#else +inline String x_drawgetclippath(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetclippath); + return f_drawgetclippath(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetcliprule f_drawgetcliprule +#else +inline int x_drawgetcliprule(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetcliprule); + return f_drawgetcliprule(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetclipunits f_drawgetclipunits +#else +inline int x_drawgetclipunits(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetclipunits); + return f_drawgetclipunits(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetexception f_drawgetexception +#else +inline Array x_drawgetexception(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetexception); + return f_drawgetexception(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetexceptionstring f_drawgetexceptionstring +#else +inline String x_drawgetexceptionstring(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetexceptionstring); + return f_drawgetexceptionstring(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetexceptiontype f_drawgetexceptiontype +#else +inline int x_drawgetexceptiontype(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetexceptiontype); + return f_drawgetexceptiontype(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetfillalpha f_drawgetfillalpha +#else +inline double x_drawgetfillalpha(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetfillalpha); + return f_drawgetfillalpha(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetfillcolor f_drawgetfillcolor +#else +inline Object x_drawgetfillcolor(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetfillcolor); + return f_drawgetfillcolor(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetfillopacity f_drawgetfillopacity +#else +inline double x_drawgetfillopacity(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetfillopacity); + return f_drawgetfillopacity(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetfillrule f_drawgetfillrule +#else +inline int x_drawgetfillrule(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetfillrule); + return f_drawgetfillrule(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetfont f_drawgetfont +#else +inline String x_drawgetfont(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetfont); + return f_drawgetfont(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetfontfamily f_drawgetfontfamily +#else +inline String x_drawgetfontfamily(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetfontfamily); + return f_drawgetfontfamily(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetfontsize f_drawgetfontsize +#else +inline double x_drawgetfontsize(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetfontsize); + return f_drawgetfontsize(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetfontstretch f_drawgetfontstretch +#else +inline int x_drawgetfontstretch(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetfontstretch); + return f_drawgetfontstretch(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetfontstyle f_drawgetfontstyle +#else +inline int x_drawgetfontstyle(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetfontstyle); + return f_drawgetfontstyle(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetfontweight f_drawgetfontweight +#else +inline double x_drawgetfontweight(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetfontweight); + return f_drawgetfontweight(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetgravity f_drawgetgravity +#else +inline int x_drawgetgravity(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetgravity); + return f_drawgetgravity(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetstrokealpha f_drawgetstrokealpha +#else +inline double x_drawgetstrokealpha(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetstrokealpha); + return f_drawgetstrokealpha(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetstrokeantialias f_drawgetstrokeantialias +#else +inline bool x_drawgetstrokeantialias(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetstrokeantialias); + return f_drawgetstrokeantialias(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetstrokecolor f_drawgetstrokecolor +#else +inline Object x_drawgetstrokecolor(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetstrokecolor); + return f_drawgetstrokecolor(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetstrokedasharray f_drawgetstrokedasharray +#else +inline Array x_drawgetstrokedasharray(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetstrokedasharray); + return f_drawgetstrokedasharray(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetstrokedashoffset f_drawgetstrokedashoffset +#else +inline double x_drawgetstrokedashoffset(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetstrokedashoffset); + return f_drawgetstrokedashoffset(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetstrokelinecap f_drawgetstrokelinecap +#else +inline int x_drawgetstrokelinecap(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetstrokelinecap); + return f_drawgetstrokelinecap(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetstrokelinejoin f_drawgetstrokelinejoin +#else +inline int x_drawgetstrokelinejoin(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetstrokelinejoin); + return f_drawgetstrokelinejoin(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetstrokemiterlimit f_drawgetstrokemiterlimit +#else +inline double x_drawgetstrokemiterlimit(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetstrokemiterlimit); + return f_drawgetstrokemiterlimit(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetstrokeopacity f_drawgetstrokeopacity +#else +inline double x_drawgetstrokeopacity(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetstrokeopacity); + return f_drawgetstrokeopacity(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetstrokewidth f_drawgetstrokewidth +#else +inline double x_drawgetstrokewidth(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetstrokewidth); + return f_drawgetstrokewidth(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgettextalignment f_drawgettextalignment +#else +inline int x_drawgettextalignment(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgettextalignment); + return f_drawgettextalignment(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgettextantialias f_drawgettextantialias +#else +inline bool x_drawgettextantialias(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgettextantialias); + return f_drawgettextantialias(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgettextdecoration f_drawgettextdecoration +#else +inline int x_drawgettextdecoration(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgettextdecoration); + return f_drawgettextdecoration(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgettextencoding f_drawgettextencoding +#else +inline String x_drawgettextencoding(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgettextencoding); + return f_drawgettextencoding(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgettextundercolor f_drawgettextundercolor +#else +inline Object x_drawgettextundercolor(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgettextundercolor); + return f_drawgettextundercolor(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawgetvectorgraphics f_drawgetvectorgraphics +#else +inline String x_drawgetvectorgraphics(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawgetvectorgraphics); + return f_drawgetvectorgraphics(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawline f_drawline +#else +inline void x_drawline(CObjRef drw_wnd, double sx, double sy, double ex, double ey) { + FUNCTION_INJECTION(drawline); + f_drawline(drw_wnd, sx, sy, ex, ey); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawmatte f_drawmatte +#else +inline void x_drawmatte(CObjRef drw_wnd, double x, double y, int paint_method) { + FUNCTION_INJECTION(drawmatte); + f_drawmatte(drw_wnd, x, y, paint_method); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathclose f_drawpathclose +#else +inline void x_drawpathclose(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawpathclose); + f_drawpathclose(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathcurvetoabsolute f_drawpathcurvetoabsolute +#else +inline void x_drawpathcurvetoabsolute(CObjRef drw_wnd, double x1, double y1, double x2, double y2, double x, double y) { + FUNCTION_INJECTION(drawpathcurvetoabsolute); + f_drawpathcurvetoabsolute(drw_wnd, x1, y1, x2, y2, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathcurvetoquadraticbezierabsolute f_drawpathcurvetoquadraticbezierabsolute +#else +inline void x_drawpathcurvetoquadraticbezierabsolute(CObjRef drw_wnd, double x1, double y1, double x, double y) { + FUNCTION_INJECTION(drawpathcurvetoquadraticbezierabsolute); + f_drawpathcurvetoquadraticbezierabsolute(drw_wnd, x1, y1, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathcurvetoquadraticbezierrelative f_drawpathcurvetoquadraticbezierrelative +#else +inline void x_drawpathcurvetoquadraticbezierrelative(CObjRef drw_wnd, double x1, double y1, double x, double y) { + FUNCTION_INJECTION(drawpathcurvetoquadraticbezierrelative); + f_drawpathcurvetoquadraticbezierrelative(drw_wnd, x1, y1, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathcurvetoquadraticbeziersmoothabsolute f_drawpathcurvetoquadraticbeziersmoothabsolute +#else +inline void x_drawpathcurvetoquadraticbeziersmoothabsolute(CObjRef drw_wnd, double x, double y) { + FUNCTION_INJECTION(drawpathcurvetoquadraticbeziersmoothabsolute); + f_drawpathcurvetoquadraticbeziersmoothabsolute(drw_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathcurvetoquadraticbeziersmoothrelative f_drawpathcurvetoquadraticbeziersmoothrelative +#else +inline void x_drawpathcurvetoquadraticbeziersmoothrelative(CObjRef drw_wnd, double x, double y) { + FUNCTION_INJECTION(drawpathcurvetoquadraticbeziersmoothrelative); + f_drawpathcurvetoquadraticbeziersmoothrelative(drw_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathcurvetorelative f_drawpathcurvetorelative +#else +inline void x_drawpathcurvetorelative(CObjRef drw_wnd, double x1, double y1, double x2, double y2, double x, double y) { + FUNCTION_INJECTION(drawpathcurvetorelative); + f_drawpathcurvetorelative(drw_wnd, x1, y1, x2, y2, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathcurvetosmoothabsolute f_drawpathcurvetosmoothabsolute +#else +inline void x_drawpathcurvetosmoothabsolute(CObjRef drw_wnd, double x2, double y2, double x, double y) { + FUNCTION_INJECTION(drawpathcurvetosmoothabsolute); + f_drawpathcurvetosmoothabsolute(drw_wnd, x2, y2, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathcurvetosmoothrelative f_drawpathcurvetosmoothrelative +#else +inline void x_drawpathcurvetosmoothrelative(CObjRef drw_wnd, double x2, double y2, double x, double y) { + FUNCTION_INJECTION(drawpathcurvetosmoothrelative); + f_drawpathcurvetosmoothrelative(drw_wnd, x2, y2, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathellipticarcabsolute f_drawpathellipticarcabsolute +#else +inline void x_drawpathellipticarcabsolute(CObjRef drw_wnd, double rx, double ry, double x_axis_rotation, bool large_arc_flag, bool sweep_flag, double x, double y) { + FUNCTION_INJECTION(drawpathellipticarcabsolute); + f_drawpathellipticarcabsolute(drw_wnd, rx, ry, x_axis_rotation, large_arc_flag, sweep_flag, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathellipticarcrelative f_drawpathellipticarcrelative +#else +inline void x_drawpathellipticarcrelative(CObjRef drw_wnd, double rx, double ry, double x_axis_rotation, bool large_arc_flag, bool sweep_flag, double x, double y) { + FUNCTION_INJECTION(drawpathellipticarcrelative); + f_drawpathellipticarcrelative(drw_wnd, rx, ry, x_axis_rotation, large_arc_flag, sweep_flag, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathfinish f_drawpathfinish +#else +inline void x_drawpathfinish(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawpathfinish); + f_drawpathfinish(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathlinetoabsolute f_drawpathlinetoabsolute +#else +inline void x_drawpathlinetoabsolute(CObjRef drw_wnd, double x, double y) { + FUNCTION_INJECTION(drawpathlinetoabsolute); + f_drawpathlinetoabsolute(drw_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathlinetohorizontalabsolute f_drawpathlinetohorizontalabsolute +#else +inline void x_drawpathlinetohorizontalabsolute(CObjRef drw_wnd, double x) { + FUNCTION_INJECTION(drawpathlinetohorizontalabsolute); + f_drawpathlinetohorizontalabsolute(drw_wnd, x); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathlinetohorizontalrelative f_drawpathlinetohorizontalrelative +#else +inline void x_drawpathlinetohorizontalrelative(CObjRef drw_wnd, double x) { + FUNCTION_INJECTION(drawpathlinetohorizontalrelative); + f_drawpathlinetohorizontalrelative(drw_wnd, x); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathlinetorelative f_drawpathlinetorelative +#else +inline void x_drawpathlinetorelative(CObjRef drw_wnd, double x, double y) { + FUNCTION_INJECTION(drawpathlinetorelative); + f_drawpathlinetorelative(drw_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathlinetoverticalabsolute f_drawpathlinetoverticalabsolute +#else +inline void x_drawpathlinetoverticalabsolute(CObjRef drw_wnd, double y) { + FUNCTION_INJECTION(drawpathlinetoverticalabsolute); + f_drawpathlinetoverticalabsolute(drw_wnd, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathlinetoverticalrelative f_drawpathlinetoverticalrelative +#else +inline void x_drawpathlinetoverticalrelative(CObjRef drw_wnd, double y) { + FUNCTION_INJECTION(drawpathlinetoverticalrelative); + f_drawpathlinetoverticalrelative(drw_wnd, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathmovetoabsolute f_drawpathmovetoabsolute +#else +inline void x_drawpathmovetoabsolute(CObjRef drw_wnd, double x, double y) { + FUNCTION_INJECTION(drawpathmovetoabsolute); + f_drawpathmovetoabsolute(drw_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathmovetorelative f_drawpathmovetorelative +#else +inline void x_drawpathmovetorelative(CObjRef drw_wnd, double x, double y) { + FUNCTION_INJECTION(drawpathmovetorelative); + f_drawpathmovetorelative(drw_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpathstart f_drawpathstart +#else +inline void x_drawpathstart(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawpathstart); + f_drawpathstart(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpoint f_drawpoint +#else +inline void x_drawpoint(CObjRef drw_wnd, double x, double y) { + FUNCTION_INJECTION(drawpoint); + f_drawpoint(drw_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpolygon f_drawpolygon +#else +inline void x_drawpolygon(CObjRef drw_wnd, CArrRef x_y_points_array) { + FUNCTION_INJECTION(drawpolygon); + f_drawpolygon(drw_wnd, x_y_points_array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpolyline f_drawpolyline +#else +inline void x_drawpolyline(CObjRef drw_wnd, CArrRef x_y_points_array) { + FUNCTION_INJECTION(drawpolyline); + f_drawpolyline(drw_wnd, x_y_points_array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawrectangle f_drawrectangle +#else +inline void x_drawrectangle(CObjRef drw_wnd, double x1, double y1, double x2, double y2) { + FUNCTION_INJECTION(drawrectangle); + f_drawrectangle(drw_wnd, x1, y1, x2, y2); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawrender f_drawrender +#else +inline bool x_drawrender(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawrender); + return f_drawrender(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawrotate f_drawrotate +#else +inline void x_drawrotate(CObjRef drw_wnd, double degrees) { + FUNCTION_INJECTION(drawrotate); + f_drawrotate(drw_wnd, degrees); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawroundrectangle f_drawroundrectangle +#else +inline void x_drawroundrectangle(CObjRef drw_wnd, double x1, double y1, double x2, double y2, double rx, double ry) { + FUNCTION_INJECTION(drawroundrectangle); + f_drawroundrectangle(drw_wnd, x1, y1, x2, y2, rx, ry); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawscale f_drawscale +#else +inline void x_drawscale(CObjRef drw_wnd, double x, double y) { + FUNCTION_INJECTION(drawscale); + f_drawscale(drw_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetclippath f_drawsetclippath +#else +inline bool x_drawsetclippath(CObjRef drw_wnd, CStrRef clip_path) { + FUNCTION_INJECTION(drawsetclippath); + return f_drawsetclippath(drw_wnd, clip_path); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetcliprule f_drawsetcliprule +#else +inline void x_drawsetcliprule(CObjRef drw_wnd, int fill_rule) { + FUNCTION_INJECTION(drawsetcliprule); + f_drawsetcliprule(drw_wnd, fill_rule); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetclipunits f_drawsetclipunits +#else +inline void x_drawsetclipunits(CObjRef drw_wnd, int clip_path_units) { + FUNCTION_INJECTION(drawsetclipunits); + f_drawsetclipunits(drw_wnd, clip_path_units); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfillalpha f_drawsetfillalpha +#else +inline void x_drawsetfillalpha(CObjRef drw_wnd, double fill_opacity) { + FUNCTION_INJECTION(drawsetfillalpha); + f_drawsetfillalpha(drw_wnd, fill_opacity); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfillcolor f_drawsetfillcolor +#else +inline void x_drawsetfillcolor(CObjRef drw_wnd, CObjRef fill_pxl_wnd) { + FUNCTION_INJECTION(drawsetfillcolor); + f_drawsetfillcolor(drw_wnd, fill_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfillopacity f_drawsetfillopacity +#else +inline void x_drawsetfillopacity(CObjRef drw_wnd, double fill_opacity) { + FUNCTION_INJECTION(drawsetfillopacity); + f_drawsetfillopacity(drw_wnd, fill_opacity); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfillpatternurl f_drawsetfillpatternurl +#else +inline bool x_drawsetfillpatternurl(CObjRef drw_wnd, CStrRef fill_url) { + FUNCTION_INJECTION(drawsetfillpatternurl); + return f_drawsetfillpatternurl(drw_wnd, fill_url); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfillrule f_drawsetfillrule +#else +inline void x_drawsetfillrule(CObjRef drw_wnd, int fill_rule) { + FUNCTION_INJECTION(drawsetfillrule); + f_drawsetfillrule(drw_wnd, fill_rule); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfont f_drawsetfont +#else +inline bool x_drawsetfont(CObjRef drw_wnd, CStrRef font_file) { + FUNCTION_INJECTION(drawsetfont); + return f_drawsetfont(drw_wnd, font_file); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfontfamily f_drawsetfontfamily +#else +inline bool x_drawsetfontfamily(CObjRef drw_wnd, CStrRef font_family) { + FUNCTION_INJECTION(drawsetfontfamily); + return f_drawsetfontfamily(drw_wnd, font_family); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfontsize f_drawsetfontsize +#else +inline void x_drawsetfontsize(CObjRef drw_wnd, double pointsize) { + FUNCTION_INJECTION(drawsetfontsize); + f_drawsetfontsize(drw_wnd, pointsize); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfontstretch f_drawsetfontstretch +#else +inline void x_drawsetfontstretch(CObjRef drw_wnd, int stretch_type) { + FUNCTION_INJECTION(drawsetfontstretch); + f_drawsetfontstretch(drw_wnd, stretch_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfontstyle f_drawsetfontstyle +#else +inline void x_drawsetfontstyle(CObjRef drw_wnd, int style_type) { + FUNCTION_INJECTION(drawsetfontstyle); + f_drawsetfontstyle(drw_wnd, style_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetfontweight f_drawsetfontweight +#else +inline void x_drawsetfontweight(CObjRef drw_wnd, double font_weight) { + FUNCTION_INJECTION(drawsetfontweight); + f_drawsetfontweight(drw_wnd, font_weight); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetgravity f_drawsetgravity +#else +inline void x_drawsetgravity(CObjRef drw_wnd, int gravity_type) { + FUNCTION_INJECTION(drawsetgravity); + f_drawsetgravity(drw_wnd, gravity_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokealpha f_drawsetstrokealpha +#else +inline void x_drawsetstrokealpha(CObjRef drw_wnd, double stroke_opacity) { + FUNCTION_INJECTION(drawsetstrokealpha); + f_drawsetstrokealpha(drw_wnd, stroke_opacity); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokeantialias f_drawsetstrokeantialias +#else +inline void x_drawsetstrokeantialias(CObjRef drw_wnd, bool stroke_antialias = true) { + FUNCTION_INJECTION(drawsetstrokeantialias); + f_drawsetstrokeantialias(drw_wnd, stroke_antialias); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokecolor f_drawsetstrokecolor +#else +inline void x_drawsetstrokecolor(CObjRef drw_wnd, CObjRef strokecolor_pxl_wnd) { + FUNCTION_INJECTION(drawsetstrokecolor); + f_drawsetstrokecolor(drw_wnd, strokecolor_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokedasharray f_drawsetstrokedasharray +#else +inline void x_drawsetstrokedasharray(CObjRef drw_wnd, CArrRef dash_array = null_array) { + FUNCTION_INJECTION(drawsetstrokedasharray); + f_drawsetstrokedasharray(drw_wnd, dash_array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokedashoffset f_drawsetstrokedashoffset +#else +inline void x_drawsetstrokedashoffset(CObjRef drw_wnd, double dash_offset) { + FUNCTION_INJECTION(drawsetstrokedashoffset); + f_drawsetstrokedashoffset(drw_wnd, dash_offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokelinecap f_drawsetstrokelinecap +#else +inline void x_drawsetstrokelinecap(CObjRef drw_wnd, int line_cap) { + FUNCTION_INJECTION(drawsetstrokelinecap); + f_drawsetstrokelinecap(drw_wnd, line_cap); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokelinejoin f_drawsetstrokelinejoin +#else +inline void x_drawsetstrokelinejoin(CObjRef drw_wnd, int line_join) { + FUNCTION_INJECTION(drawsetstrokelinejoin); + f_drawsetstrokelinejoin(drw_wnd, line_join); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokemiterlimit f_drawsetstrokemiterlimit +#else +inline void x_drawsetstrokemiterlimit(CObjRef drw_wnd, double miterlimit) { + FUNCTION_INJECTION(drawsetstrokemiterlimit); + f_drawsetstrokemiterlimit(drw_wnd, miterlimit); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokeopacity f_drawsetstrokeopacity +#else +inline void x_drawsetstrokeopacity(CObjRef drw_wnd, double stroke_opacity) { + FUNCTION_INJECTION(drawsetstrokeopacity); + f_drawsetstrokeopacity(drw_wnd, stroke_opacity); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokepatternurl f_drawsetstrokepatternurl +#else +inline bool x_drawsetstrokepatternurl(CObjRef drw_wnd, CStrRef stroke_url) { + FUNCTION_INJECTION(drawsetstrokepatternurl); + return f_drawsetstrokepatternurl(drw_wnd, stroke_url); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetstrokewidth f_drawsetstrokewidth +#else +inline void x_drawsetstrokewidth(CObjRef drw_wnd, double stroke_width) { + FUNCTION_INJECTION(drawsetstrokewidth); + f_drawsetstrokewidth(drw_wnd, stroke_width); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsettextalignment f_drawsettextalignment +#else +inline void x_drawsettextalignment(CObjRef drw_wnd, int align_type) { + FUNCTION_INJECTION(drawsettextalignment); + f_drawsettextalignment(drw_wnd, align_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsettextantialias f_drawsettextantialias +#else +inline void x_drawsettextantialias(CObjRef drw_wnd, bool text_antialias = true) { + FUNCTION_INJECTION(drawsettextantialias); + f_drawsettextantialias(drw_wnd, text_antialias); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsettextdecoration f_drawsettextdecoration +#else +inline void x_drawsettextdecoration(CObjRef drw_wnd, int decoration_type) { + FUNCTION_INJECTION(drawsettextdecoration); + f_drawsettextdecoration(drw_wnd, decoration_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsettextencoding f_drawsettextencoding +#else +inline void x_drawsettextencoding(CObjRef drw_wnd, CStrRef encoding) { + FUNCTION_INJECTION(drawsettextencoding); + f_drawsettextencoding(drw_wnd, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsettextundercolor f_drawsettextundercolor +#else +inline void x_drawsettextundercolor(CObjRef drw_wnd, CObjRef undercolor_pxl_wnd) { + FUNCTION_INJECTION(drawsettextundercolor); + f_drawsettextundercolor(drw_wnd, undercolor_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetvectorgraphics f_drawsetvectorgraphics +#else +inline bool x_drawsetvectorgraphics(CObjRef drw_wnd, CStrRef vector_graphics) { + FUNCTION_INJECTION(drawsetvectorgraphics); + return f_drawsetvectorgraphics(drw_wnd, vector_graphics); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawsetviewbox f_drawsetviewbox +#else +inline void x_drawsetviewbox(CObjRef drw_wnd, double x1, double y1, double x2, double y2) { + FUNCTION_INJECTION(drawsetviewbox); + f_drawsetviewbox(drw_wnd, x1, y1, x2, y2); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawskewx f_drawskewx +#else +inline void x_drawskewx(CObjRef drw_wnd, double degrees) { + FUNCTION_INJECTION(drawskewx); + f_drawskewx(drw_wnd, degrees); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawskewy f_drawskewy +#else +inline void x_drawskewy(CObjRef drw_wnd, double degrees) { + FUNCTION_INJECTION(drawskewy); + f_drawskewy(drw_wnd, degrees); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawtranslate f_drawtranslate +#else +inline void x_drawtranslate(CObjRef drw_wnd, double x, double y) { + FUNCTION_INJECTION(drawtranslate); + f_drawtranslate(drw_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pushdrawingwand f_pushdrawingwand +#else +inline void x_pushdrawingwand(CObjRef drw_wnd) { + FUNCTION_INJECTION(pushdrawingwand); + f_pushdrawingwand(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpushclippath f_drawpushclippath +#else +inline void x_drawpushclippath(CObjRef drw_wnd, CStrRef clip_path_id) { + FUNCTION_INJECTION(drawpushclippath); + f_drawpushclippath(drw_wnd, clip_path_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpushdefs f_drawpushdefs +#else +inline void x_drawpushdefs(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawpushdefs); + f_drawpushdefs(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpushpattern f_drawpushpattern +#else +inline void x_drawpushpattern(CObjRef drw_wnd, CStrRef pattern_id, double x, double y, double width, double height) { + FUNCTION_INJECTION(drawpushpattern); + f_drawpushpattern(drw_wnd, pattern_id, x, y, width, height); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_popdrawingwand f_popdrawingwand +#else +inline void x_popdrawingwand(CObjRef drw_wnd) { + FUNCTION_INJECTION(popdrawingwand); + f_popdrawingwand(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpopclippath f_drawpopclippath +#else +inline void x_drawpopclippath(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawpopclippath); + f_drawpopclippath(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpopdefs f_drawpopdefs +#else +inline void x_drawpopdefs(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawpopdefs); + f_drawpopdefs(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_drawpoppattern f_drawpoppattern +#else +inline void x_drawpoppattern(CObjRef drw_wnd) { + FUNCTION_INJECTION(drawpoppattern); + f_drawpoppattern(drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickadaptivethresholdimage f_magickadaptivethresholdimage +#else +inline bool x_magickadaptivethresholdimage(CObjRef mgck_wnd, double width, double height, double offset) { + FUNCTION_INJECTION(magickadaptivethresholdimage); + return f_magickadaptivethresholdimage(mgck_wnd, width, height, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickaddimage f_magickaddimage +#else +inline bool x_magickaddimage(CObjRef mgck_wnd, CObjRef add_wand) { + FUNCTION_INJECTION(magickaddimage); + return f_magickaddimage(mgck_wnd, add_wand); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickaddnoiseimage f_magickaddnoiseimage +#else +inline bool x_magickaddnoiseimage(CObjRef mgck_wnd, int noise_type) { + FUNCTION_INJECTION(magickaddnoiseimage); + return f_magickaddnoiseimage(mgck_wnd, noise_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickaffinetransformimage f_magickaffinetransformimage +#else +inline bool x_magickaffinetransformimage(CObjRef mgck_wnd, CObjRef drw_wnd) { + FUNCTION_INJECTION(magickaffinetransformimage); + return f_magickaffinetransformimage(mgck_wnd, drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickannotateimage f_magickannotateimage +#else +inline bool x_magickannotateimage(CObjRef mgck_wnd, CObjRef drw_wnd, double x, double y, double angle, CStrRef text) { + FUNCTION_INJECTION(magickannotateimage); + return f_magickannotateimage(mgck_wnd, drw_wnd, x, y, angle, text); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickappendimages f_magickappendimages +#else +inline Object x_magickappendimages(CObjRef mgck_wnd, bool stack_vertical = false) { + FUNCTION_INJECTION(magickappendimages); + return f_magickappendimages(mgck_wnd, stack_vertical); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickaverageimages f_magickaverageimages +#else +inline Object x_magickaverageimages(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickaverageimages); + return f_magickaverageimages(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickblackthresholdimage f_magickblackthresholdimage +#else +inline bool x_magickblackthresholdimage(CObjRef mgck_wnd, CObjRef threshold_pxl_wnd) { + FUNCTION_INJECTION(magickblackthresholdimage); + return f_magickblackthresholdimage(mgck_wnd, threshold_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickblurimage f_magickblurimage +#else +inline bool x_magickblurimage(CObjRef mgck_wnd, double radius, double sigma, int channel_type = 0) { + FUNCTION_INJECTION(magickblurimage); + return f_magickblurimage(mgck_wnd, radius, sigma, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickborderimage f_magickborderimage +#else +inline bool x_magickborderimage(CObjRef mgck_wnd, CObjRef bordercolor, double width, double height) { + FUNCTION_INJECTION(magickborderimage); + return f_magickborderimage(mgck_wnd, bordercolor, width, height); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcharcoalimage f_magickcharcoalimage +#else +inline bool x_magickcharcoalimage(CObjRef mgck_wnd, double radius, double sigma) { + FUNCTION_INJECTION(magickcharcoalimage); + return f_magickcharcoalimage(mgck_wnd, radius, sigma); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickchopimage f_magickchopimage +#else +inline bool x_magickchopimage(CObjRef mgck_wnd, double width, double height, int x, int y) { + FUNCTION_INJECTION(magickchopimage); + return f_magickchopimage(mgck_wnd, width, height, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickclipimage f_magickclipimage +#else +inline bool x_magickclipimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickclipimage); + return f_magickclipimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickclippathimage f_magickclippathimage +#else +inline bool x_magickclippathimage(CObjRef mgck_wnd, CStrRef pathname, bool inside) { + FUNCTION_INJECTION(magickclippathimage); + return f_magickclippathimage(mgck_wnd, pathname, inside); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcoalesceimages f_magickcoalesceimages +#else +inline Object x_magickcoalesceimages(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickcoalesceimages); + return f_magickcoalesceimages(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcolorfloodfillimage f_magickcolorfloodfillimage +#else +inline bool x_magickcolorfloodfillimage(CObjRef mgck_wnd, CObjRef fillcolor_pxl_wnd, double fuzz, CObjRef bordercolor_pxl_wnd, int x, int y) { + FUNCTION_INJECTION(magickcolorfloodfillimage); + return f_magickcolorfloodfillimage(mgck_wnd, fillcolor_pxl_wnd, fuzz, bordercolor_pxl_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcolorizeimage f_magickcolorizeimage +#else +inline bool x_magickcolorizeimage(CObjRef mgck_wnd, CObjRef colorize, CObjRef opacity_pxl_wnd) { + FUNCTION_INJECTION(magickcolorizeimage); + return f_magickcolorizeimage(mgck_wnd, colorize, opacity_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcombineimages f_magickcombineimages +#else +inline Object x_magickcombineimages(CObjRef mgck_wnd, int channel_type) { + FUNCTION_INJECTION(magickcombineimages); + return f_magickcombineimages(mgck_wnd, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcommentimage f_magickcommentimage +#else +inline bool x_magickcommentimage(CObjRef mgck_wnd, CStrRef comment) { + FUNCTION_INJECTION(magickcommentimage); + return f_magickcommentimage(mgck_wnd, comment); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcompareimages f_magickcompareimages +#else +inline Array x_magickcompareimages(CObjRef mgck_wnd, CObjRef reference_wnd, int metric_type, int channel_type = 0) { + FUNCTION_INJECTION(magickcompareimages); + return f_magickcompareimages(mgck_wnd, reference_wnd, metric_type, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcompositeimage f_magickcompositeimage +#else +inline bool x_magickcompositeimage(CObjRef mgck_wnd, CObjRef composite_wnd, int composite_operator, int x, int y) { + FUNCTION_INJECTION(magickcompositeimage); + return f_magickcompositeimage(mgck_wnd, composite_wnd, composite_operator, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickconstituteimage f_magickconstituteimage +#else +inline bool x_magickconstituteimage(CObjRef mgck_wnd, double columns, double rows, CStrRef smap, int storage_type, CArrRef pixel_array) { + FUNCTION_INJECTION(magickconstituteimage); + return f_magickconstituteimage(mgck_wnd, columns, rows, smap, storage_type, pixel_array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcontrastimage f_magickcontrastimage +#else +inline bool x_magickcontrastimage(CObjRef mgck_wnd, bool sharpen) { + FUNCTION_INJECTION(magickcontrastimage); + return f_magickcontrastimage(mgck_wnd, sharpen); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickconvolveimage f_magickconvolveimage +#else +inline bool x_magickconvolveimage(CObjRef mgck_wnd, CArrRef kernel_array, int channel_type = 0) { + FUNCTION_INJECTION(magickconvolveimage); + return f_magickconvolveimage(mgck_wnd, kernel_array, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcropimage f_magickcropimage +#else +inline bool x_magickcropimage(CObjRef mgck_wnd, double width, double height, int x, int y) { + FUNCTION_INJECTION(magickcropimage); + return f_magickcropimage(mgck_wnd, width, height, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickcyclecolormapimage f_magickcyclecolormapimage +#else +inline bool x_magickcyclecolormapimage(CObjRef mgck_wnd, int num_positions) { + FUNCTION_INJECTION(magickcyclecolormapimage); + return f_magickcyclecolormapimage(mgck_wnd, num_positions); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickdeconstructimages f_magickdeconstructimages +#else +inline Object x_magickdeconstructimages(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickdeconstructimages); + return f_magickdeconstructimages(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickdescribeimage f_magickdescribeimage +#else +inline String x_magickdescribeimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickdescribeimage); + return f_magickdescribeimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickdespeckleimage f_magickdespeckleimage +#else +inline bool x_magickdespeckleimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickdespeckleimage); + return f_magickdespeckleimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickdrawimage f_magickdrawimage +#else +inline bool x_magickdrawimage(CObjRef mgck_wnd, CObjRef drw_wnd) { + FUNCTION_INJECTION(magickdrawimage); + return f_magickdrawimage(mgck_wnd, drw_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickechoimageblob f_magickechoimageblob +#else +inline bool x_magickechoimageblob(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickechoimageblob); + return f_magickechoimageblob(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickechoimagesblob f_magickechoimagesblob +#else +inline bool x_magickechoimagesblob(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickechoimagesblob); + return f_magickechoimagesblob(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickedgeimage f_magickedgeimage +#else +inline bool x_magickedgeimage(CObjRef mgck_wnd, double radius) { + FUNCTION_INJECTION(magickedgeimage); + return f_magickedgeimage(mgck_wnd, radius); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickembossimage f_magickembossimage +#else +inline bool x_magickembossimage(CObjRef mgck_wnd, double radius, double sigma) { + FUNCTION_INJECTION(magickembossimage); + return f_magickembossimage(mgck_wnd, radius, sigma); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickenhanceimage f_magickenhanceimage +#else +inline bool x_magickenhanceimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickenhanceimage); + return f_magickenhanceimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickequalizeimage f_magickequalizeimage +#else +inline bool x_magickequalizeimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickequalizeimage); + return f_magickequalizeimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickevaluateimage f_magickevaluateimage +#else +inline bool x_magickevaluateimage(CObjRef mgck_wnd, int evaluate_op, double constant, int channel_type = 0) { + FUNCTION_INJECTION(magickevaluateimage); + return f_magickevaluateimage(mgck_wnd, evaluate_op, constant, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickflattenimages f_magickflattenimages +#else +inline Object x_magickflattenimages(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickflattenimages); + return f_magickflattenimages(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickflipimage f_magickflipimage +#else +inline bool x_magickflipimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickflipimage); + return f_magickflipimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickflopimage f_magickflopimage +#else +inline bool x_magickflopimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickflopimage); + return f_magickflopimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickframeimage f_magickframeimage +#else +inline bool x_magickframeimage(CObjRef mgck_wnd, CObjRef matte_color, double width, double height, int inner_bevel, int outer_bevel) { + FUNCTION_INJECTION(magickframeimage); + return f_magickframeimage(mgck_wnd, matte_color, width, height, inner_bevel, outer_bevel); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickfximage f_magickfximage +#else +inline Object x_magickfximage(CObjRef mgck_wnd, CStrRef expression, int channel_type = 0) { + FUNCTION_INJECTION(magickfximage); + return f_magickfximage(mgck_wnd, expression, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgammaimage f_magickgammaimage +#else +inline bool x_magickgammaimage(CObjRef mgck_wnd, double gamma, int channel_type = 0) { + FUNCTION_INJECTION(magickgammaimage); + return f_magickgammaimage(mgck_wnd, gamma, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgaussianblurimage f_magickgaussianblurimage +#else +inline bool x_magickgaussianblurimage(CObjRef mgck_wnd, double radius, double sigma, int channel_type = 0) { + FUNCTION_INJECTION(magickgaussianblurimage); + return f_magickgaussianblurimage(mgck_wnd, radius, sigma, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetcharheight f_magickgetcharheight +#else +inline double x_magickgetcharheight(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false) { + FUNCTION_INJECTION(magickgetcharheight); + return f_magickgetcharheight(mgck_wnd, drw_wnd, txt, multiline); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetcharwidth f_magickgetcharwidth +#else +inline double x_magickgetcharwidth(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false) { + FUNCTION_INJECTION(magickgetcharwidth); + return f_magickgetcharwidth(mgck_wnd, drw_wnd, txt, multiline); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetexception f_magickgetexception +#else +inline Array x_magickgetexception(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetexception); + return f_magickgetexception(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetexceptionstring f_magickgetexceptionstring +#else +inline String x_magickgetexceptionstring(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetexceptionstring); + return f_magickgetexceptionstring(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetexceptiontype f_magickgetexceptiontype +#else +inline int x_magickgetexceptiontype(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetexceptiontype); + return f_magickgetexceptiontype(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetfilename f_magickgetfilename +#else +inline String x_magickgetfilename(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetfilename); + return f_magickgetfilename(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetformat f_magickgetformat +#else +inline String x_magickgetformat(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetformat); + return f_magickgetformat(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimage f_magickgetimage +#else +inline Object x_magickgetimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimage); + return f_magickgetimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagebackgroundcolor f_magickgetimagebackgroundcolor +#else +inline Object x_magickgetimagebackgroundcolor(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagebackgroundcolor); + return f_magickgetimagebackgroundcolor(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageblob f_magickgetimageblob +#else +inline String x_magickgetimageblob(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimageblob); + return f_magickgetimageblob(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageblueprimary f_magickgetimageblueprimary +#else +inline Array x_magickgetimageblueprimary(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimageblueprimary); + return f_magickgetimageblueprimary(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagebordercolor f_magickgetimagebordercolor +#else +inline Object x_magickgetimagebordercolor(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagebordercolor); + return f_magickgetimagebordercolor(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagechannelmean f_magickgetimagechannelmean +#else +inline Array x_magickgetimagechannelmean(CObjRef mgck_wnd, int channel_type) { + FUNCTION_INJECTION(magickgetimagechannelmean); + return f_magickgetimagechannelmean(mgck_wnd, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagecolormapcolor f_magickgetimagecolormapcolor +#else +inline Object x_magickgetimagecolormapcolor(CObjRef mgck_wnd, double index) { + FUNCTION_INJECTION(magickgetimagecolormapcolor); + return f_magickgetimagecolormapcolor(mgck_wnd, index); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagecolors f_magickgetimagecolors +#else +inline double x_magickgetimagecolors(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagecolors); + return f_magickgetimagecolors(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagecolorspace f_magickgetimagecolorspace +#else +inline int x_magickgetimagecolorspace(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagecolorspace); + return f_magickgetimagecolorspace(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagecompose f_magickgetimagecompose +#else +inline int x_magickgetimagecompose(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagecompose); + return f_magickgetimagecompose(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagecompression f_magickgetimagecompression +#else +inline int x_magickgetimagecompression(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagecompression); + return f_magickgetimagecompression(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagecompressionquality f_magickgetimagecompressionquality +#else +inline double x_magickgetimagecompressionquality(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagecompressionquality); + return f_magickgetimagecompressionquality(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagedelay f_magickgetimagedelay +#else +inline double x_magickgetimagedelay(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagedelay); + return f_magickgetimagedelay(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagedepth f_magickgetimagedepth +#else +inline double x_magickgetimagedepth(CObjRef mgck_wnd, int channel_type = 0) { + FUNCTION_INJECTION(magickgetimagedepth); + return f_magickgetimagedepth(mgck_wnd, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagedispose f_magickgetimagedispose +#else +inline int x_magickgetimagedispose(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagedispose); + return f_magickgetimagedispose(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageextrema f_magickgetimageextrema +#else +inline Array x_magickgetimageextrema(CObjRef mgck_wnd, int channel_type = 0) { + FUNCTION_INJECTION(magickgetimageextrema); + return f_magickgetimageextrema(mgck_wnd, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagefilename f_magickgetimagefilename +#else +inline String x_magickgetimagefilename(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagefilename); + return f_magickgetimagefilename(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageformat f_magickgetimageformat +#else +inline String x_magickgetimageformat(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimageformat); + return f_magickgetimageformat(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagegamma f_magickgetimagegamma +#else +inline double x_magickgetimagegamma(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagegamma); + return f_magickgetimagegamma(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagegreenprimary f_magickgetimagegreenprimary +#else +inline Array x_magickgetimagegreenprimary(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagegreenprimary); + return f_magickgetimagegreenprimary(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageheight f_magickgetimageheight +#else +inline double x_magickgetimageheight(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimageheight); + return f_magickgetimageheight(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagehistogram f_magickgetimagehistogram +#else +inline Array x_magickgetimagehistogram(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagehistogram); + return f_magickgetimagehistogram(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageindex f_magickgetimageindex +#else +inline int x_magickgetimageindex(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimageindex); + return f_magickgetimageindex(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageinterlacescheme f_magickgetimageinterlacescheme +#else +inline int x_magickgetimageinterlacescheme(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimageinterlacescheme); + return f_magickgetimageinterlacescheme(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageiterations f_magickgetimageiterations +#else +inline double x_magickgetimageiterations(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimageiterations); + return f_magickgetimageiterations(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagemattecolor f_magickgetimagemattecolor +#else +inline Object x_magickgetimagemattecolor(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagemattecolor); + return f_magickgetimagemattecolor(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagemimetype f_magickgetimagemimetype +#else +inline String x_magickgetimagemimetype(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagemimetype); + return f_magickgetimagemimetype(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagepixels f_magickgetimagepixels +#else +inline Array x_magickgetimagepixels(CObjRef mgck_wnd, int x_offset, int y_offset, double columns, double rows, CStrRef smap, int storage_type) { + FUNCTION_INJECTION(magickgetimagepixels); + return f_magickgetimagepixels(mgck_wnd, x_offset, y_offset, columns, rows, smap, storage_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageprofile f_magickgetimageprofile +#else +inline String x_magickgetimageprofile(CObjRef mgck_wnd, CStrRef name) { + FUNCTION_INJECTION(magickgetimageprofile); + return f_magickgetimageprofile(mgck_wnd, name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageredprimary f_magickgetimageredprimary +#else +inline Array x_magickgetimageredprimary(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimageredprimary); + return f_magickgetimageredprimary(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagerenderingintent f_magickgetimagerenderingintent +#else +inline int x_magickgetimagerenderingintent(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagerenderingintent); + return f_magickgetimagerenderingintent(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageresolution f_magickgetimageresolution +#else +inline Array x_magickgetimageresolution(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimageresolution); + return f_magickgetimageresolution(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagescene f_magickgetimagescene +#else +inline double x_magickgetimagescene(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagescene); + return f_magickgetimagescene(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagesignature f_magickgetimagesignature +#else +inline String x_magickgetimagesignature(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagesignature); + return f_magickgetimagesignature(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagesize f_magickgetimagesize +#else +inline int x_magickgetimagesize(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagesize); + return f_magickgetimagesize(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagetype f_magickgetimagetype +#else +inline int x_magickgetimagetype(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagetype); + return f_magickgetimagetype(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimageunits f_magickgetimageunits +#else +inline int x_magickgetimageunits(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimageunits); + return f_magickgetimageunits(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagevirtualpixelmethod f_magickgetimagevirtualpixelmethod +#else +inline int x_magickgetimagevirtualpixelmethod(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagevirtualpixelmethod); + return f_magickgetimagevirtualpixelmethod(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagewhitepoint f_magickgetimagewhitepoint +#else +inline Array x_magickgetimagewhitepoint(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagewhitepoint); + return f_magickgetimagewhitepoint(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagewidth f_magickgetimagewidth +#else +inline double x_magickgetimagewidth(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagewidth); + return f_magickgetimagewidth(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetimagesblob f_magickgetimagesblob +#else +inline String x_magickgetimagesblob(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetimagesblob); + return f_magickgetimagesblob(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetinterlacescheme f_magickgetinterlacescheme +#else +inline int x_magickgetinterlacescheme(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetinterlacescheme); + return f_magickgetinterlacescheme(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetmaxtextadvance f_magickgetmaxtextadvance +#else +inline double x_magickgetmaxtextadvance(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false) { + FUNCTION_INJECTION(magickgetmaxtextadvance); + return f_magickgetmaxtextadvance(mgck_wnd, drw_wnd, txt, multiline); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetmimetype f_magickgetmimetype +#else +inline String x_magickgetmimetype(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetmimetype); + return f_magickgetmimetype(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetnumberimages f_magickgetnumberimages +#else +inline double x_magickgetnumberimages(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetnumberimages); + return f_magickgetnumberimages(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetsamplingfactors f_magickgetsamplingfactors +#else +inline Array x_magickgetsamplingfactors(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetsamplingfactors); + return f_magickgetsamplingfactors(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetsize f_magickgetsize +#else +inline Array x_magickgetsize(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetsize); + return f_magickgetsize(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetstringheight f_magickgetstringheight +#else +inline double x_magickgetstringheight(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false) { + FUNCTION_INJECTION(magickgetstringheight); + return f_magickgetstringheight(mgck_wnd, drw_wnd, txt, multiline); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetstringwidth f_magickgetstringwidth +#else +inline double x_magickgetstringwidth(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false) { + FUNCTION_INJECTION(magickgetstringwidth); + return f_magickgetstringwidth(mgck_wnd, drw_wnd, txt, multiline); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgettextascent f_magickgettextascent +#else +inline double x_magickgettextascent(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false) { + FUNCTION_INJECTION(magickgettextascent); + return f_magickgettextascent(mgck_wnd, drw_wnd, txt, multiline); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgettextdescent f_magickgettextdescent +#else +inline double x_magickgettextdescent(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false) { + FUNCTION_INJECTION(magickgettextdescent); + return f_magickgettextdescent(mgck_wnd, drw_wnd, txt, multiline); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickgetwandsize f_magickgetwandsize +#else +inline Array x_magickgetwandsize(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickgetwandsize); + return f_magickgetwandsize(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickhasnextimage f_magickhasnextimage +#else +inline bool x_magickhasnextimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickhasnextimage); + return f_magickhasnextimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickhaspreviousimage f_magickhaspreviousimage +#else +inline bool x_magickhaspreviousimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickhaspreviousimage); + return f_magickhaspreviousimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickimplodeimage f_magickimplodeimage +#else +inline bool x_magickimplodeimage(CObjRef mgck_wnd, double amount) { + FUNCTION_INJECTION(magickimplodeimage); + return f_magickimplodeimage(mgck_wnd, amount); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicklabelimage f_magicklabelimage +#else +inline bool x_magicklabelimage(CObjRef mgck_wnd, CStrRef label) { + FUNCTION_INJECTION(magicklabelimage); + return f_magicklabelimage(mgck_wnd, label); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicklevelimage f_magicklevelimage +#else +inline bool x_magicklevelimage(CObjRef mgck_wnd, double black_point, double gamma, double white_point, int channel_type = 0) { + FUNCTION_INJECTION(magicklevelimage); + return f_magicklevelimage(mgck_wnd, black_point, gamma, white_point, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickmagnifyimage f_magickmagnifyimage +#else +inline bool x_magickmagnifyimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickmagnifyimage); + return f_magickmagnifyimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickmapimage f_magickmapimage +#else +inline bool x_magickmapimage(CObjRef mgck_wnd, CObjRef map_wand, bool dither) { + FUNCTION_INJECTION(magickmapimage); + return f_magickmapimage(mgck_wnd, map_wand, dither); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickmattefloodfillimage f_magickmattefloodfillimage +#else +inline bool x_magickmattefloodfillimage(CObjRef mgck_wnd, double opacity, double fuzz, CObjRef bordercolor_pxl_wnd, int x, int y) { + FUNCTION_INJECTION(magickmattefloodfillimage); + return f_magickmattefloodfillimage(mgck_wnd, opacity, fuzz, bordercolor_pxl_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickmedianfilterimage f_magickmedianfilterimage +#else +inline bool x_magickmedianfilterimage(CObjRef mgck_wnd, double radius) { + FUNCTION_INJECTION(magickmedianfilterimage); + return f_magickmedianfilterimage(mgck_wnd, radius); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickminifyimage f_magickminifyimage +#else +inline bool x_magickminifyimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickminifyimage); + return f_magickminifyimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickmodulateimage f_magickmodulateimage +#else +inline bool x_magickmodulateimage(CObjRef mgck_wnd, double brightness, double saturation, double hue) { + FUNCTION_INJECTION(magickmodulateimage); + return f_magickmodulateimage(mgck_wnd, brightness, saturation, hue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickmontageimage f_magickmontageimage +#else +inline Object x_magickmontageimage(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef tile_geometry, CStrRef thumbnail_geometry, int montage_mode, CStrRef frame) { + FUNCTION_INJECTION(magickmontageimage); + return f_magickmontageimage(mgck_wnd, drw_wnd, tile_geometry, thumbnail_geometry, montage_mode, frame); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickmorphimages f_magickmorphimages +#else +inline Object x_magickmorphimages(CObjRef mgck_wnd, double number_frames) { + FUNCTION_INJECTION(magickmorphimages); + return f_magickmorphimages(mgck_wnd, number_frames); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickmosaicimages f_magickmosaicimages +#else +inline Object x_magickmosaicimages(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickmosaicimages); + return f_magickmosaicimages(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickmotionblurimage f_magickmotionblurimage +#else +inline bool x_magickmotionblurimage(CObjRef mgck_wnd, double radius, double sigma, double angle) { + FUNCTION_INJECTION(magickmotionblurimage); + return f_magickmotionblurimage(mgck_wnd, radius, sigma, angle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicknegateimage f_magicknegateimage +#else +inline bool x_magicknegateimage(CObjRef mgck_wnd, bool only_the_gray = false, int channel_type = 0) { + FUNCTION_INJECTION(magicknegateimage); + return f_magicknegateimage(mgck_wnd, only_the_gray, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicknewimage f_magicknewimage +#else +inline bool x_magicknewimage(CObjRef mgck_wnd, double width, double height, CStrRef imagemagick_col_str = null_string) { + FUNCTION_INJECTION(magicknewimage); + return f_magicknewimage(mgck_wnd, width, height, imagemagick_col_str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicknextimage f_magicknextimage +#else +inline bool x_magicknextimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magicknextimage); + return f_magicknextimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicknormalizeimage f_magicknormalizeimage +#else +inline bool x_magicknormalizeimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magicknormalizeimage); + return f_magicknormalizeimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickoilpaintimage f_magickoilpaintimage +#else +inline bool x_magickoilpaintimage(CObjRef mgck_wnd, double radius) { + FUNCTION_INJECTION(magickoilpaintimage); + return f_magickoilpaintimage(mgck_wnd, radius); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickpaintopaqueimage f_magickpaintopaqueimage +#else +inline bool x_magickpaintopaqueimage(CObjRef mgck_wnd, CObjRef target_pxl_wnd, CObjRef fill_pxl_wnd, double fuzz = 0.0) { + FUNCTION_INJECTION(magickpaintopaqueimage); + return f_magickpaintopaqueimage(mgck_wnd, target_pxl_wnd, fill_pxl_wnd, fuzz); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickpainttransparentimage f_magickpainttransparentimage +#else +inline bool x_magickpainttransparentimage(CObjRef mgck_wnd, CObjRef target, double opacity = k_MW_TransparentOpacity, double fuzz = 0.0) { + FUNCTION_INJECTION(magickpainttransparentimage); + return f_magickpainttransparentimage(mgck_wnd, target, opacity, fuzz); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickpingimage f_magickpingimage +#else +inline bool x_magickpingimage(CObjRef mgck_wnd, CStrRef filename) { + FUNCTION_INJECTION(magickpingimage); + return f_magickpingimage(mgck_wnd, filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickposterizeimage f_magickposterizeimage +#else +inline bool x_magickposterizeimage(CObjRef mgck_wnd, double levels, bool dither) { + FUNCTION_INJECTION(magickposterizeimage); + return f_magickposterizeimage(mgck_wnd, levels, dither); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickpreviewimages f_magickpreviewimages +#else +inline Object x_magickpreviewimages(CObjRef mgck_wnd, int preview) { + FUNCTION_INJECTION(magickpreviewimages); + return f_magickpreviewimages(mgck_wnd, preview); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickpreviousimage f_magickpreviousimage +#else +inline bool x_magickpreviousimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickpreviousimage); + return f_magickpreviousimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickprofileimage f_magickprofileimage +#else +inline bool x_magickprofileimage(CObjRef mgck_wnd, CStrRef name, CStrRef profile = null_string) { + FUNCTION_INJECTION(magickprofileimage); + return f_magickprofileimage(mgck_wnd, name, profile); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickquantizeimage f_magickquantizeimage +#else +inline bool x_magickquantizeimage(CObjRef mgck_wnd, double number_colors, int colorspace_type, double treedepth, bool dither, bool measure_error) { + FUNCTION_INJECTION(magickquantizeimage); + return f_magickquantizeimage(mgck_wnd, number_colors, colorspace_type, treedepth, dither, measure_error); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickquantizeimages f_magickquantizeimages +#else +inline bool x_magickquantizeimages(CObjRef mgck_wnd, double number_colors, int colorspace_type, double treedepth, bool dither, bool measure_error) { + FUNCTION_INJECTION(magickquantizeimages); + return f_magickquantizeimages(mgck_wnd, number_colors, colorspace_type, treedepth, dither, measure_error); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickqueryfontmetrics f_magickqueryfontmetrics +#else +inline Array x_magickqueryfontmetrics(CObjRef mgck_wnd, CObjRef drw_wnd, CStrRef txt, bool multiline = false) { + FUNCTION_INJECTION(magickqueryfontmetrics); + return f_magickqueryfontmetrics(mgck_wnd, drw_wnd, txt, multiline); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickradialblurimage f_magickradialblurimage +#else +inline bool x_magickradialblurimage(CObjRef mgck_wnd, double angle) { + FUNCTION_INJECTION(magickradialblurimage); + return f_magickradialblurimage(mgck_wnd, angle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickraiseimage f_magickraiseimage +#else +inline bool x_magickraiseimage(CObjRef mgck_wnd, double width, double height, int x, int y, bool raise) { + FUNCTION_INJECTION(magickraiseimage); + return f_magickraiseimage(mgck_wnd, width, height, x, y, raise); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickreadimage f_magickreadimage +#else +inline bool x_magickreadimage(CObjRef mgck_wnd, CStrRef filename) { + FUNCTION_INJECTION(magickreadimage); + return f_magickreadimage(mgck_wnd, filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickreadimageblob f_magickreadimageblob +#else +inline bool x_magickreadimageblob(CObjRef mgck_wnd, CStrRef blob) { + FUNCTION_INJECTION(magickreadimageblob); + return f_magickreadimageblob(mgck_wnd, blob); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickreadimagefile f_magickreadimagefile +#else +inline bool x_magickreadimagefile(CObjRef mgck_wnd, CObjRef handle) { + FUNCTION_INJECTION(magickreadimagefile); + return f_magickreadimagefile(mgck_wnd, handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickreadimages f_magickreadimages +#else +inline bool x_magickreadimages(CObjRef mgck_wnd, CArrRef img_filenames_array) { + FUNCTION_INJECTION(magickreadimages); + return f_magickreadimages(mgck_wnd, img_filenames_array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickreducenoiseimage f_magickreducenoiseimage +#else +inline bool x_magickreducenoiseimage(CObjRef mgck_wnd, double radius) { + FUNCTION_INJECTION(magickreducenoiseimage); + return f_magickreducenoiseimage(mgck_wnd, radius); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickremoveimage f_magickremoveimage +#else +inline bool x_magickremoveimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickremoveimage); + return f_magickremoveimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickremoveimageprofile f_magickremoveimageprofile +#else +inline String x_magickremoveimageprofile(CObjRef mgck_wnd, CStrRef name) { + FUNCTION_INJECTION(magickremoveimageprofile); + return f_magickremoveimageprofile(mgck_wnd, name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickremoveimageprofiles f_magickremoveimageprofiles +#else +inline bool x_magickremoveimageprofiles(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickremoveimageprofiles); + return f_magickremoveimageprofiles(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickresampleimage f_magickresampleimage +#else +inline bool x_magickresampleimage(CObjRef mgck_wnd, double x_resolution, double y_resolution, int filter_type, double blur) { + FUNCTION_INJECTION(magickresampleimage); + return f_magickresampleimage(mgck_wnd, x_resolution, y_resolution, filter_type, blur); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickresetiterator f_magickresetiterator +#else +inline void x_magickresetiterator(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickresetiterator); + f_magickresetiterator(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickresizeimage f_magickresizeimage +#else +inline bool x_magickresizeimage(CObjRef mgck_wnd, double columns, double rows, int filter_type, double blur) { + FUNCTION_INJECTION(magickresizeimage); + return f_magickresizeimage(mgck_wnd, columns, rows, filter_type, blur); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickrollimage f_magickrollimage +#else +inline bool x_magickrollimage(CObjRef mgck_wnd, int x_offset, int y_offset) { + FUNCTION_INJECTION(magickrollimage); + return f_magickrollimage(mgck_wnd, x_offset, y_offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickrotateimage f_magickrotateimage +#else +inline bool x_magickrotateimage(CObjRef mgck_wnd, CObjRef background, double degrees) { + FUNCTION_INJECTION(magickrotateimage); + return f_magickrotateimage(mgck_wnd, background, degrees); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksampleimage f_magicksampleimage +#else +inline bool x_magicksampleimage(CObjRef mgck_wnd, double columns, double rows) { + FUNCTION_INJECTION(magicksampleimage); + return f_magicksampleimage(mgck_wnd, columns, rows); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickscaleimage f_magickscaleimage +#else +inline bool x_magickscaleimage(CObjRef mgck_wnd, double columns, double rows) { + FUNCTION_INJECTION(magickscaleimage); + return f_magickscaleimage(mgck_wnd, columns, rows); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickseparateimagechannel f_magickseparateimagechannel +#else +inline bool x_magickseparateimagechannel(CObjRef mgck_wnd, int channel_type) { + FUNCTION_INJECTION(magickseparateimagechannel); + return f_magickseparateimagechannel(mgck_wnd, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetcompressionquality f_magicksetcompressionquality +#else +inline bool x_magicksetcompressionquality(CObjRef mgck_wnd, double quality) { + FUNCTION_INJECTION(magicksetcompressionquality); + return f_magicksetcompressionquality(mgck_wnd, quality); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetfilename f_magicksetfilename +#else +inline bool x_magicksetfilename(CObjRef mgck_wnd, CStrRef filename = null_string) { + FUNCTION_INJECTION(magicksetfilename); + return f_magicksetfilename(mgck_wnd, filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetfirstiterator f_magicksetfirstiterator +#else +inline void x_magicksetfirstiterator(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magicksetfirstiterator); + f_magicksetfirstiterator(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetformat f_magicksetformat +#else +inline bool x_magicksetformat(CObjRef mgck_wnd, CStrRef format) { + FUNCTION_INJECTION(magicksetformat); + return f_magicksetformat(mgck_wnd, format); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimage f_magicksetimage +#else +inline bool x_magicksetimage(CObjRef mgck_wnd, CObjRef replace_wand) { + FUNCTION_INJECTION(magicksetimage); + return f_magicksetimage(mgck_wnd, replace_wand); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagebackgroundcolor f_magicksetimagebackgroundcolor +#else +inline bool x_magicksetimagebackgroundcolor(CObjRef mgck_wnd, CObjRef background_pxl_wnd) { + FUNCTION_INJECTION(magicksetimagebackgroundcolor); + return f_magicksetimagebackgroundcolor(mgck_wnd, background_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagebias f_magicksetimagebias +#else +inline bool x_magicksetimagebias(CObjRef mgck_wnd, double bias) { + FUNCTION_INJECTION(magicksetimagebias); + return f_magicksetimagebias(mgck_wnd, bias); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimageblueprimary f_magicksetimageblueprimary +#else +inline bool x_magicksetimageblueprimary(CObjRef mgck_wnd, double x, double y) { + FUNCTION_INJECTION(magicksetimageblueprimary); + return f_magicksetimageblueprimary(mgck_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagebordercolor f_magicksetimagebordercolor +#else +inline bool x_magicksetimagebordercolor(CObjRef mgck_wnd, CObjRef border_pxl_wnd) { + FUNCTION_INJECTION(magicksetimagebordercolor); + return f_magicksetimagebordercolor(mgck_wnd, border_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagecolormapcolor f_magicksetimagecolormapcolor +#else +inline bool x_magicksetimagecolormapcolor(CObjRef mgck_wnd, double index, CObjRef mapcolor_pxl_wnd) { + FUNCTION_INJECTION(magicksetimagecolormapcolor); + return f_magicksetimagecolormapcolor(mgck_wnd, index, mapcolor_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagecolorspace f_magicksetimagecolorspace +#else +inline bool x_magicksetimagecolorspace(CObjRef mgck_wnd, int colorspace_type) { + FUNCTION_INJECTION(magicksetimagecolorspace); + return f_magicksetimagecolorspace(mgck_wnd, colorspace_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagecompose f_magicksetimagecompose +#else +inline bool x_magicksetimagecompose(CObjRef mgck_wnd, int composite_operator) { + FUNCTION_INJECTION(magicksetimagecompose); + return f_magicksetimagecompose(mgck_wnd, composite_operator); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagecompression f_magicksetimagecompression +#else +inline bool x_magicksetimagecompression(CObjRef mgck_wnd, int compression_type) { + FUNCTION_INJECTION(magicksetimagecompression); + return f_magicksetimagecompression(mgck_wnd, compression_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagecompressionquality f_magicksetimagecompressionquality +#else +inline bool x_magicksetimagecompressionquality(CObjRef mgck_wnd, double quality) { + FUNCTION_INJECTION(magicksetimagecompressionquality); + return f_magicksetimagecompressionquality(mgck_wnd, quality); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagedelay f_magicksetimagedelay +#else +inline bool x_magicksetimagedelay(CObjRef mgck_wnd, double delay) { + FUNCTION_INJECTION(magicksetimagedelay); + return f_magicksetimagedelay(mgck_wnd, delay); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagedepth f_magicksetimagedepth +#else +inline bool x_magicksetimagedepth(CObjRef mgck_wnd, int depth, int channel_type = 0) { + FUNCTION_INJECTION(magicksetimagedepth); + return f_magicksetimagedepth(mgck_wnd, depth, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagedispose f_magicksetimagedispose +#else +inline bool x_magicksetimagedispose(CObjRef mgck_wnd, int dispose_type) { + FUNCTION_INJECTION(magicksetimagedispose); + return f_magicksetimagedispose(mgck_wnd, dispose_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagefilename f_magicksetimagefilename +#else +inline bool x_magicksetimagefilename(CObjRef mgck_wnd, CStrRef filename = null_string) { + FUNCTION_INJECTION(magicksetimagefilename); + return f_magicksetimagefilename(mgck_wnd, filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimageformat f_magicksetimageformat +#else +inline bool x_magicksetimageformat(CObjRef mgck_wnd, CStrRef format) { + FUNCTION_INJECTION(magicksetimageformat); + return f_magicksetimageformat(mgck_wnd, format); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagegamma f_magicksetimagegamma +#else +inline bool x_magicksetimagegamma(CObjRef mgck_wnd, double gamma) { + FUNCTION_INJECTION(magicksetimagegamma); + return f_magicksetimagegamma(mgck_wnd, gamma); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagegreenprimary f_magicksetimagegreenprimary +#else +inline bool x_magicksetimagegreenprimary(CObjRef mgck_wnd, double x, double y) { + FUNCTION_INJECTION(magicksetimagegreenprimary); + return f_magicksetimagegreenprimary(mgck_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimageindex f_magicksetimageindex +#else +inline bool x_magicksetimageindex(CObjRef mgck_wnd, int index) { + FUNCTION_INJECTION(magicksetimageindex); + return f_magicksetimageindex(mgck_wnd, index); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimageinterlacescheme f_magicksetimageinterlacescheme +#else +inline bool x_magicksetimageinterlacescheme(CObjRef mgck_wnd, int interlace_type) { + FUNCTION_INJECTION(magicksetimageinterlacescheme); + return f_magicksetimageinterlacescheme(mgck_wnd, interlace_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimageiterations f_magicksetimageiterations +#else +inline bool x_magicksetimageiterations(CObjRef mgck_wnd, double iterations) { + FUNCTION_INJECTION(magicksetimageiterations); + return f_magicksetimageiterations(mgck_wnd, iterations); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagemattecolor f_magicksetimagemattecolor +#else +inline bool x_magicksetimagemattecolor(CObjRef mgck_wnd, CObjRef matte_pxl_wnd) { + FUNCTION_INJECTION(magicksetimagemattecolor); + return f_magicksetimagemattecolor(mgck_wnd, matte_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimageoption f_magicksetimageoption +#else +inline bool x_magicksetimageoption(CObjRef mgck_wnd, CStrRef format, CStrRef key, CStrRef value) { + FUNCTION_INJECTION(magicksetimageoption); + return f_magicksetimageoption(mgck_wnd, format, key, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagepixels f_magicksetimagepixels +#else +inline bool x_magicksetimagepixels(CObjRef mgck_wnd, int x_offset, int y_offset, double columns, double rows, CStrRef smap, int storage_type, CArrRef pixel_array) { + FUNCTION_INJECTION(magicksetimagepixels); + return f_magicksetimagepixels(mgck_wnd, x_offset, y_offset, columns, rows, smap, storage_type, pixel_array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimageprofile f_magicksetimageprofile +#else +inline bool x_magicksetimageprofile(CObjRef mgck_wnd, CStrRef name, CStrRef profile) { + FUNCTION_INJECTION(magicksetimageprofile); + return f_magicksetimageprofile(mgck_wnd, name, profile); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimageredprimary f_magicksetimageredprimary +#else +inline bool x_magicksetimageredprimary(CObjRef mgck_wnd, double x, double y) { + FUNCTION_INJECTION(magicksetimageredprimary); + return f_magicksetimageredprimary(mgck_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagerenderingintent f_magicksetimagerenderingintent +#else +inline bool x_magicksetimagerenderingintent(CObjRef mgck_wnd, int rendering_intent) { + FUNCTION_INJECTION(magicksetimagerenderingintent); + return f_magicksetimagerenderingintent(mgck_wnd, rendering_intent); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimageresolution f_magicksetimageresolution +#else +inline bool x_magicksetimageresolution(CObjRef mgck_wnd, double x_resolution, double y_resolution) { + FUNCTION_INJECTION(magicksetimageresolution); + return f_magicksetimageresolution(mgck_wnd, x_resolution, y_resolution); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagescene f_magicksetimagescene +#else +inline bool x_magicksetimagescene(CObjRef mgck_wnd, double scene) { + FUNCTION_INJECTION(magicksetimagescene); + return f_magicksetimagescene(mgck_wnd, scene); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagetype f_magicksetimagetype +#else +inline bool x_magicksetimagetype(CObjRef mgck_wnd, int image_type) { + FUNCTION_INJECTION(magicksetimagetype); + return f_magicksetimagetype(mgck_wnd, image_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimageunits f_magicksetimageunits +#else +inline bool x_magicksetimageunits(CObjRef mgck_wnd, int resolution_type) { + FUNCTION_INJECTION(magicksetimageunits); + return f_magicksetimageunits(mgck_wnd, resolution_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagevirtualpixelmethod f_magicksetimagevirtualpixelmethod +#else +inline bool x_magicksetimagevirtualpixelmethod(CObjRef mgck_wnd, int virtual_pixel_method) { + FUNCTION_INJECTION(magicksetimagevirtualpixelmethod); + return f_magicksetimagevirtualpixelmethod(mgck_wnd, virtual_pixel_method); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetimagewhitepoint f_magicksetimagewhitepoint +#else +inline bool x_magicksetimagewhitepoint(CObjRef mgck_wnd, double x, double y) { + FUNCTION_INJECTION(magicksetimagewhitepoint); + return f_magicksetimagewhitepoint(mgck_wnd, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetinterlacescheme f_magicksetinterlacescheme +#else +inline bool x_magicksetinterlacescheme(CObjRef mgck_wnd, int interlace_type) { + FUNCTION_INJECTION(magicksetinterlacescheme); + return f_magicksetinterlacescheme(mgck_wnd, interlace_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetlastiterator f_magicksetlastiterator +#else +inline void x_magicksetlastiterator(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magicksetlastiterator); + f_magicksetlastiterator(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetpassphrase f_magicksetpassphrase +#else +inline bool x_magicksetpassphrase(CObjRef mgck_wnd, CStrRef passphrase) { + FUNCTION_INJECTION(magicksetpassphrase); + return f_magicksetpassphrase(mgck_wnd, passphrase); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetresolution f_magicksetresolution +#else +inline bool x_magicksetresolution(CObjRef mgck_wnd, double x_resolution, double y_resolution) { + FUNCTION_INJECTION(magicksetresolution); + return f_magicksetresolution(mgck_wnd, x_resolution, y_resolution); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetsamplingfactors f_magicksetsamplingfactors +#else +inline bool x_magicksetsamplingfactors(CObjRef mgck_wnd, double number_factors, CArrRef sampling_factors) { + FUNCTION_INJECTION(magicksetsamplingfactors); + return f_magicksetsamplingfactors(mgck_wnd, number_factors, sampling_factors); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetsize f_magicksetsize +#else +inline bool x_magicksetsize(CObjRef mgck_wnd, int columns, int rows) { + FUNCTION_INJECTION(magicksetsize); + return f_magicksetsize(mgck_wnd, columns, rows); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksetwandsize f_magicksetwandsize +#else +inline bool x_magicksetwandsize(CObjRef mgck_wnd, int columns, int rows) { + FUNCTION_INJECTION(magicksetwandsize); + return f_magicksetwandsize(mgck_wnd, columns, rows); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksharpenimage f_magicksharpenimage +#else +inline bool x_magicksharpenimage(CObjRef mgck_wnd, double radius, double sigma, int channel_type = 0) { + FUNCTION_INJECTION(magicksharpenimage); + return f_magicksharpenimage(mgck_wnd, radius, sigma, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickshaveimage f_magickshaveimage +#else +inline bool x_magickshaveimage(CObjRef mgck_wnd, int columns, int rows) { + FUNCTION_INJECTION(magickshaveimage); + return f_magickshaveimage(mgck_wnd, columns, rows); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickshearimage f_magickshearimage +#else +inline bool x_magickshearimage(CObjRef mgck_wnd, CObjRef background, double x_shear, double y_shear) { + FUNCTION_INJECTION(magickshearimage); + return f_magickshearimage(mgck_wnd, background, x_shear, y_shear); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksolarizeimage f_magicksolarizeimage +#else +inline bool x_magicksolarizeimage(CObjRef mgck_wnd, double threshold) { + FUNCTION_INJECTION(magicksolarizeimage); + return f_magicksolarizeimage(mgck_wnd, threshold); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickspliceimage f_magickspliceimage +#else +inline bool x_magickspliceimage(CObjRef mgck_wnd, double width, double height, int x, int y) { + FUNCTION_INJECTION(magickspliceimage); + return f_magickspliceimage(mgck_wnd, width, height, x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickspreadimage f_magickspreadimage +#else +inline bool x_magickspreadimage(CObjRef mgck_wnd, double radius) { + FUNCTION_INJECTION(magickspreadimage); + return f_magickspreadimage(mgck_wnd, radius); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicksteganoimage f_magicksteganoimage +#else +inline Object x_magicksteganoimage(CObjRef mgck_wnd, CObjRef watermark_wand, int offset) { + FUNCTION_INJECTION(magicksteganoimage); + return f_magicksteganoimage(mgck_wnd, watermark_wand, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickstereoimage f_magickstereoimage +#else +inline bool x_magickstereoimage(CObjRef mgck_wnd, CObjRef offset_wand) { + FUNCTION_INJECTION(magickstereoimage); + return f_magickstereoimage(mgck_wnd, offset_wand); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickstripimage f_magickstripimage +#else +inline bool x_magickstripimage(CObjRef mgck_wnd) { + FUNCTION_INJECTION(magickstripimage); + return f_magickstripimage(mgck_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickswirlimage f_magickswirlimage +#else +inline bool x_magickswirlimage(CObjRef mgck_wnd, double degrees) { + FUNCTION_INJECTION(magickswirlimage); + return f_magickswirlimage(mgck_wnd, degrees); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicktextureimage f_magicktextureimage +#else +inline Object x_magicktextureimage(CObjRef mgck_wnd, CObjRef texture_wand) { + FUNCTION_INJECTION(magicktextureimage); + return f_magicktextureimage(mgck_wnd, texture_wand); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickthresholdimage f_magickthresholdimage +#else +inline bool x_magickthresholdimage(CObjRef mgck_wnd, double threshold, int channel_type = 0) { + FUNCTION_INJECTION(magickthresholdimage); + return f_magickthresholdimage(mgck_wnd, threshold, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicktintimage f_magicktintimage +#else +inline bool x_magicktintimage(CObjRef mgck_wnd, int tint_pxl_wnd, CObjRef opacity_pxl_wnd) { + FUNCTION_INJECTION(magicktintimage); + return f_magicktintimage(mgck_wnd, tint_pxl_wnd, opacity_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicktransformimage f_magicktransformimage +#else +inline Object x_magicktransformimage(CObjRef mgck_wnd, CStrRef crop, CStrRef geometry) { + FUNCTION_INJECTION(magicktransformimage); + return f_magicktransformimage(mgck_wnd, crop, geometry); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magicktrimimage f_magicktrimimage +#else +inline bool x_magicktrimimage(CObjRef mgck_wnd, double fuzz) { + FUNCTION_INJECTION(magicktrimimage); + return f_magicktrimimage(mgck_wnd, fuzz); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickunsharpmaskimage f_magickunsharpmaskimage +#else +inline bool x_magickunsharpmaskimage(CObjRef mgck_wnd, double radius, double sigma, double amount, double threshold, int channel_type = 0) { + FUNCTION_INJECTION(magickunsharpmaskimage); + return f_magickunsharpmaskimage(mgck_wnd, radius, sigma, amount, threshold, channel_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickwaveimage f_magickwaveimage +#else +inline bool x_magickwaveimage(CObjRef mgck_wnd, double amplitude, double wave_length) { + FUNCTION_INJECTION(magickwaveimage); + return f_magickwaveimage(mgck_wnd, amplitude, wave_length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickwhitethresholdimage f_magickwhitethresholdimage +#else +inline bool x_magickwhitethresholdimage(CObjRef mgck_wnd, CObjRef threshold_pxl_wnd) { + FUNCTION_INJECTION(magickwhitethresholdimage); + return f_magickwhitethresholdimage(mgck_wnd, threshold_pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickwriteimage f_magickwriteimage +#else +inline bool x_magickwriteimage(CObjRef mgck_wnd, CStrRef filename) { + FUNCTION_INJECTION(magickwriteimage); + return f_magickwriteimage(mgck_wnd, filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickwriteimagefile f_magickwriteimagefile +#else +inline bool x_magickwriteimagefile(CObjRef mgck_wnd, CObjRef handle) { + FUNCTION_INJECTION(magickwriteimagefile); + return f_magickwriteimagefile(mgck_wnd, handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickwriteimages f_magickwriteimages +#else +inline bool x_magickwriteimages(CObjRef mgck_wnd, CStrRef filename = "", bool join_images = false) { + FUNCTION_INJECTION(magickwriteimages); + return f_magickwriteimages(mgck_wnd, filename, join_images); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_magickwriteimagesfile f_magickwriteimagesfile +#else +inline bool x_magickwriteimagesfile(CObjRef mgck_wnd, CObjRef handle) { + FUNCTION_INJECTION(magickwriteimagesfile); + return f_magickwriteimagesfile(mgck_wnd, handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetalpha f_pixelgetalpha +#else +inline double x_pixelgetalpha(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetalpha); + return f_pixelgetalpha(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetalphaquantum f_pixelgetalphaquantum +#else +inline double x_pixelgetalphaquantum(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetalphaquantum); + return f_pixelgetalphaquantum(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetblack f_pixelgetblack +#else +inline double x_pixelgetblack(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetblack); + return f_pixelgetblack(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetblackquantum f_pixelgetblackquantum +#else +inline double x_pixelgetblackquantum(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetblackquantum); + return f_pixelgetblackquantum(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetblue f_pixelgetblue +#else +inline double x_pixelgetblue(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetblue); + return f_pixelgetblue(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetbluequantum f_pixelgetbluequantum +#else +inline double x_pixelgetbluequantum(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetbluequantum); + return f_pixelgetbluequantum(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetcolorasstring f_pixelgetcolorasstring +#else +inline String x_pixelgetcolorasstring(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetcolorasstring); + return f_pixelgetcolorasstring(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetcolorcount f_pixelgetcolorcount +#else +inline double x_pixelgetcolorcount(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetcolorcount); + return f_pixelgetcolorcount(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetcyan f_pixelgetcyan +#else +inline double x_pixelgetcyan(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetcyan); + return f_pixelgetcyan(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetcyanquantum f_pixelgetcyanquantum +#else +inline double x_pixelgetcyanquantum(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetcyanquantum); + return f_pixelgetcyanquantum(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetexception f_pixelgetexception +#else +inline Array x_pixelgetexception(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetexception); + return f_pixelgetexception(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetexceptionstring f_pixelgetexceptionstring +#else +inline String x_pixelgetexceptionstring(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetexceptionstring); + return f_pixelgetexceptionstring(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetexceptiontype f_pixelgetexceptiontype +#else +inline int x_pixelgetexceptiontype(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetexceptiontype); + return f_pixelgetexceptiontype(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetgreen f_pixelgetgreen +#else +inline double x_pixelgetgreen(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetgreen); + return f_pixelgetgreen(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetgreenquantum f_pixelgetgreenquantum +#else +inline double x_pixelgetgreenquantum(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetgreenquantum); + return f_pixelgetgreenquantum(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetindex f_pixelgetindex +#else +inline double x_pixelgetindex(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetindex); + return f_pixelgetindex(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetmagenta f_pixelgetmagenta +#else +inline double x_pixelgetmagenta(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetmagenta); + return f_pixelgetmagenta(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetmagentaquantum f_pixelgetmagentaquantum +#else +inline double x_pixelgetmagentaquantum(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetmagentaquantum); + return f_pixelgetmagentaquantum(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetopacity f_pixelgetopacity +#else +inline double x_pixelgetopacity(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetopacity); + return f_pixelgetopacity(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetopacityquantum f_pixelgetopacityquantum +#else +inline double x_pixelgetopacityquantum(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetopacityquantum); + return f_pixelgetopacityquantum(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetquantumcolor f_pixelgetquantumcolor +#else +inline Array x_pixelgetquantumcolor(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetquantumcolor); + return f_pixelgetquantumcolor(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetred f_pixelgetred +#else +inline double x_pixelgetred(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetred); + return f_pixelgetred(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetredquantum f_pixelgetredquantum +#else +inline double x_pixelgetredquantum(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetredquantum); + return f_pixelgetredquantum(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetyellow f_pixelgetyellow +#else +inline double x_pixelgetyellow(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetyellow); + return f_pixelgetyellow(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetyellowquantum f_pixelgetyellowquantum +#else +inline double x_pixelgetyellowquantum(CObjRef pxl_wnd) { + FUNCTION_INJECTION(pixelgetyellowquantum); + return f_pixelgetyellowquantum(pxl_wnd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetalpha f_pixelsetalpha +#else +inline void x_pixelsetalpha(CObjRef pxl_wnd, double alpha) { + FUNCTION_INJECTION(pixelsetalpha); + f_pixelsetalpha(pxl_wnd, alpha); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetalphaquantum f_pixelsetalphaquantum +#else +inline void x_pixelsetalphaquantum(CObjRef pxl_wnd, double alpha) { + FUNCTION_INJECTION(pixelsetalphaquantum); + f_pixelsetalphaquantum(pxl_wnd, alpha); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetblack f_pixelsetblack +#else +inline void x_pixelsetblack(CObjRef pxl_wnd, double black) { + FUNCTION_INJECTION(pixelsetblack); + f_pixelsetblack(pxl_wnd, black); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetblackquantum f_pixelsetblackquantum +#else +inline void x_pixelsetblackquantum(CObjRef pxl_wnd, double black) { + FUNCTION_INJECTION(pixelsetblackquantum); + f_pixelsetblackquantum(pxl_wnd, black); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetblue f_pixelsetblue +#else +inline void x_pixelsetblue(CObjRef pxl_wnd, double blue) { + FUNCTION_INJECTION(pixelsetblue); + f_pixelsetblue(pxl_wnd, blue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetbluequantum f_pixelsetbluequantum +#else +inline void x_pixelsetbluequantum(CObjRef pxl_wnd, double blue) { + FUNCTION_INJECTION(pixelsetbluequantum); + f_pixelsetbluequantum(pxl_wnd, blue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetcolor f_pixelsetcolor +#else +inline void x_pixelsetcolor(CObjRef pxl_wnd, CStrRef imagemagick_col_str) { + FUNCTION_INJECTION(pixelsetcolor); + f_pixelsetcolor(pxl_wnd, imagemagick_col_str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetcolorcount f_pixelsetcolorcount +#else +inline void x_pixelsetcolorcount(CObjRef pxl_wnd, int count) { + FUNCTION_INJECTION(pixelsetcolorcount); + f_pixelsetcolorcount(pxl_wnd, count); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetcyan f_pixelsetcyan +#else +inline void x_pixelsetcyan(CObjRef pxl_wnd, double cyan) { + FUNCTION_INJECTION(pixelsetcyan); + f_pixelsetcyan(pxl_wnd, cyan); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetcyanquantum f_pixelsetcyanquantum +#else +inline void x_pixelsetcyanquantum(CObjRef pxl_wnd, double cyan) { + FUNCTION_INJECTION(pixelsetcyanquantum); + f_pixelsetcyanquantum(pxl_wnd, cyan); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetgreen f_pixelsetgreen +#else +inline void x_pixelsetgreen(CObjRef pxl_wnd, double green) { + FUNCTION_INJECTION(pixelsetgreen); + f_pixelsetgreen(pxl_wnd, green); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetgreenquantum f_pixelsetgreenquantum +#else +inline void x_pixelsetgreenquantum(CObjRef pxl_wnd, double green) { + FUNCTION_INJECTION(pixelsetgreenquantum); + f_pixelsetgreenquantum(pxl_wnd, green); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetindex f_pixelsetindex +#else +inline void x_pixelsetindex(CObjRef pxl_wnd, double index) { + FUNCTION_INJECTION(pixelsetindex); + f_pixelsetindex(pxl_wnd, index); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetmagenta f_pixelsetmagenta +#else +inline void x_pixelsetmagenta(CObjRef pxl_wnd, double magenta) { + FUNCTION_INJECTION(pixelsetmagenta); + f_pixelsetmagenta(pxl_wnd, magenta); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetmagentaquantum f_pixelsetmagentaquantum +#else +inline void x_pixelsetmagentaquantum(CObjRef pxl_wnd, double magenta) { + FUNCTION_INJECTION(pixelsetmagentaquantum); + f_pixelsetmagentaquantum(pxl_wnd, magenta); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetopacity f_pixelsetopacity +#else +inline void x_pixelsetopacity(CObjRef pxl_wnd, double opacity) { + FUNCTION_INJECTION(pixelsetopacity); + f_pixelsetopacity(pxl_wnd, opacity); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetopacityquantum f_pixelsetopacityquantum +#else +inline void x_pixelsetopacityquantum(CObjRef pxl_wnd, double opacity) { + FUNCTION_INJECTION(pixelsetopacityquantum); + f_pixelsetopacityquantum(pxl_wnd, opacity); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetquantumcolor f_pixelsetquantumcolor +#else +inline void x_pixelsetquantumcolor(CObjRef pxl_wnd, double red, double green, double blue, double opacity = 0.0) { + FUNCTION_INJECTION(pixelsetquantumcolor); + f_pixelsetquantumcolor(pxl_wnd, red, green, blue, opacity); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetred f_pixelsetred +#else +inline void x_pixelsetred(CObjRef pxl_wnd, double red) { + FUNCTION_INJECTION(pixelsetred); + f_pixelsetred(pxl_wnd, red); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetredquantum f_pixelsetredquantum +#else +inline void x_pixelsetredquantum(CObjRef pxl_wnd, double red) { + FUNCTION_INJECTION(pixelsetredquantum); + f_pixelsetredquantum(pxl_wnd, red); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetyellow f_pixelsetyellow +#else +inline void x_pixelsetyellow(CObjRef pxl_wnd, double yellow) { + FUNCTION_INJECTION(pixelsetyellow); + f_pixelsetyellow(pxl_wnd, yellow); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetyellowquantum f_pixelsetyellowquantum +#else +inline void x_pixelsetyellowquantum(CObjRef pxl_wnd, double yellow) { + FUNCTION_INJECTION(pixelsetyellowquantum); + f_pixelsetyellowquantum(pxl_wnd, yellow); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetiteratorexception f_pixelgetiteratorexception +#else +inline Array x_pixelgetiteratorexception(CObjRef pxl_iter) { + FUNCTION_INJECTION(pixelgetiteratorexception); + return f_pixelgetiteratorexception(pxl_iter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetiteratorexceptionstring f_pixelgetiteratorexceptionstring +#else +inline String x_pixelgetiteratorexceptionstring(CObjRef pxl_iter) { + FUNCTION_INJECTION(pixelgetiteratorexceptionstring); + return f_pixelgetiteratorexceptionstring(pxl_iter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetiteratorexceptiontype f_pixelgetiteratorexceptiontype +#else +inline int x_pixelgetiteratorexceptiontype(CObjRef pxl_iter) { + FUNCTION_INJECTION(pixelgetiteratorexceptiontype); + return f_pixelgetiteratorexceptiontype(pxl_iter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelgetnextiteratorrow f_pixelgetnextiteratorrow +#else +inline Array x_pixelgetnextiteratorrow(CObjRef pxl_iter) { + FUNCTION_INJECTION(pixelgetnextiteratorrow); + return f_pixelgetnextiteratorrow(pxl_iter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelresetiterator f_pixelresetiterator +#else +inline void x_pixelresetiterator(CObjRef pxl_iter) { + FUNCTION_INJECTION(pixelresetiterator); + f_pixelresetiterator(pxl_iter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsetiteratorrow f_pixelsetiteratorrow +#else +inline bool x_pixelsetiteratorrow(CObjRef pxl_iter, int row) { + FUNCTION_INJECTION(pixelsetiteratorrow); + return f_pixelsetiteratorrow(pxl_iter, row); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pixelsynciterator f_pixelsynciterator +#else +inline bool x_pixelsynciterator(CObjRef pxl_iter) { + FUNCTION_INJECTION(pixelsynciterator); + return f_pixelsynciterator(pxl_iter); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_MAGICK_H__ diff --git a/src/cpp/ext/profile/extprofile_mailparse.h b/src/cpp/ext/profile/extprofile_mailparse.h new file mode 100644 index 0000000000000..742501e6bd394 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_mailparse.h @@ -0,0 +1,176 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_MAILPARSE_H__ +#define __EXTPROFILE_MAILPARSE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_mail f_mail +#else +inline bool x_mail(CStrRef to, CStrRef subject, CStrRef message, CStrRef additional_headers = null_string, CStrRef additional_parameters = null_string) { + FUNCTION_INJECTION(mail); + return f_mail(to, subject, message, additional_headers, additional_parameters); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ezmlm_hash f_ezmlm_hash +#else +inline int x_ezmlm_hash(CStrRef addr) { + FUNCTION_INJECTION(ezmlm_hash); + return f_ezmlm_hash(addr); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_msg_create f_mailparse_msg_create +#else +inline Object x_mailparse_msg_create() { + FUNCTION_INJECTION(mailparse_msg_create); + return f_mailparse_msg_create(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_msg_free f_mailparse_msg_free +#else +inline bool x_mailparse_msg_free(CObjRef mimemail) { + FUNCTION_INJECTION(mailparse_msg_free); + return f_mailparse_msg_free(mimemail); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_msg_parse_file f_mailparse_msg_parse_file +#else +inline Object x_mailparse_msg_parse_file(CStrRef filename) { + FUNCTION_INJECTION(mailparse_msg_parse_file); + return f_mailparse_msg_parse_file(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_msg_parse f_mailparse_msg_parse +#else +inline bool x_mailparse_msg_parse(CObjRef mimemail, CStrRef data) { + FUNCTION_INJECTION(mailparse_msg_parse); + return f_mailparse_msg_parse(mimemail, data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_msg_extract_part_file f_mailparse_msg_extract_part_file +#else +inline String x_mailparse_msg_extract_part_file(CObjRef mimemail, CStrRef filename, CStrRef callbackfunc = null_string) { + FUNCTION_INJECTION(mailparse_msg_extract_part_file); + return f_mailparse_msg_extract_part_file(mimemail, filename, callbackfunc); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_msg_extract_whole_part_file f_mailparse_msg_extract_whole_part_file +#else +inline String x_mailparse_msg_extract_whole_part_file(CObjRef mimemail, CStrRef filename, CStrRef callbackfunc = null_string) { + FUNCTION_INJECTION(mailparse_msg_extract_whole_part_file); + return f_mailparse_msg_extract_whole_part_file(mimemail, filename, callbackfunc); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_msg_extract_part f_mailparse_msg_extract_part +#else +inline void x_mailparse_msg_extract_part(CObjRef mimemail, CStrRef msgbody, CStrRef callbackfunc = null_string) { + FUNCTION_INJECTION(mailparse_msg_extract_part); + f_mailparse_msg_extract_part(mimemail, msgbody, callbackfunc); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_msg_get_part_data f_mailparse_msg_get_part_data +#else +inline Array x_mailparse_msg_get_part_data(CObjRef mimemail) { + FUNCTION_INJECTION(mailparse_msg_get_part_data); + return f_mailparse_msg_get_part_data(mimemail); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_msg_get_part f_mailparse_msg_get_part +#else +inline Object x_mailparse_msg_get_part(CObjRef mimemail, CStrRef mimesection) { + FUNCTION_INJECTION(mailparse_msg_get_part); + return f_mailparse_msg_get_part(mimemail, mimesection); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_msg_get_structure f_mailparse_msg_get_structure +#else +inline Array x_mailparse_msg_get_structure(CObjRef mimemail) { + FUNCTION_INJECTION(mailparse_msg_get_structure); + return f_mailparse_msg_get_structure(mimemail); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_rfc822_parse_addresses f_mailparse_rfc822_parse_addresses +#else +inline Array x_mailparse_rfc822_parse_addresses(CStrRef addresses) { + FUNCTION_INJECTION(mailparse_rfc822_parse_addresses); + return f_mailparse_rfc822_parse_addresses(addresses); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_stream_encode f_mailparse_stream_encode +#else +inline bool x_mailparse_stream_encode(CObjRef sourcefp, CObjRef destfp, CStrRef encoding) { + FUNCTION_INJECTION(mailparse_stream_encode); + return f_mailparse_stream_encode(sourcefp, destfp, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_uudecode_all f_mailparse_uudecode_all +#else +inline Array x_mailparse_uudecode_all(CObjRef fp) { + FUNCTION_INJECTION(mailparse_uudecode_all); + return f_mailparse_uudecode_all(fp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mailparse_determine_best_xfer_encoding f_mailparse_determine_best_xfer_encoding +#else +inline String x_mailparse_determine_best_xfer_encoding(CObjRef fp) { + FUNCTION_INJECTION(mailparse_determine_best_xfer_encoding); + return f_mailparse_determine_best_xfer_encoding(fp); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_MAILPARSE_H__ diff --git a/src/cpp/ext/profile/extprofile_math.h b/src/cpp/ext/profile/extprofile_math.h new file mode 100644 index 0000000000000..57572e65d35ac --- /dev/null +++ b/src/cpp/ext/profile/extprofile_math.h @@ -0,0 +1,464 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_MATH_H__ +#define __EXTPROFILE_MATH_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_pi f_pi +#else +inline double x_pi() { + FUNCTION_INJECTION(pi); + return f_pi(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_min f_min +#else +inline Variant x_min(int _argc, CVarRef value, CArrRef _argv = null_array) { + FUNCTION_INJECTION(min); + return f_min(_argc, value, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_max f_max +#else +inline Variant x_max(int _argc, CVarRef value, CArrRef _argv = null_array) { + FUNCTION_INJECTION(max); + return f_max(_argc, value, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_abs f_abs +#else +inline Variant x_abs(CVarRef number) { + FUNCTION_INJECTION(abs); + return f_abs(number); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_finite f_is_finite +#else +inline bool x_is_finite(double val) { + FUNCTION_INJECTION(is_finite); + return f_is_finite(val); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_infinite f_is_infinite +#else +inline bool x_is_infinite(double val) { + FUNCTION_INJECTION(is_infinite); + return f_is_infinite(val); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_nan f_is_nan +#else +inline bool x_is_nan(double val) { + FUNCTION_INJECTION(is_nan); + return f_is_nan(val); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ceil f_ceil +#else +inline double x_ceil(double value) { + FUNCTION_INJECTION(ceil); + return f_ceil(value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_floor f_floor +#else +inline double x_floor(double value) { + FUNCTION_INJECTION(floor); + return f_floor(value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_round f_round +#else +inline double x_round(CVarRef val, int64 precision = 0) { + FUNCTION_INJECTION(round); + return f_round(val, precision); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_deg2rad f_deg2rad +#else +inline double x_deg2rad(double number) { + FUNCTION_INJECTION(deg2rad); + return f_deg2rad(number); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rad2deg f_rad2deg +#else +inline double x_rad2deg(double number) { + FUNCTION_INJECTION(rad2deg); + return f_rad2deg(number); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_decbin f_decbin +#else +inline String x_decbin(int64 number) { + FUNCTION_INJECTION(decbin); + return f_decbin(number); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_dechex f_dechex +#else +inline String x_dechex(int64 number) { + FUNCTION_INJECTION(dechex); + return f_dechex(number); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_decoct f_decoct +#else +inline String x_decoct(int64 number) { + FUNCTION_INJECTION(decoct); + return f_decoct(number); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bindec f_bindec +#else +inline Variant x_bindec(CStrRef binary_string) { + FUNCTION_INJECTION(bindec); + return f_bindec(binary_string); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hexdec f_hexdec +#else +inline Variant x_hexdec(CStrRef hex_string) { + FUNCTION_INJECTION(hexdec); + return f_hexdec(hex_string); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_octdec f_octdec +#else +inline Variant x_octdec(CStrRef octal_string) { + FUNCTION_INJECTION(octdec); + return f_octdec(octal_string); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_base_convert f_base_convert +#else +inline String x_base_convert(CStrRef number, int64 frombase, int64 tobase) { + FUNCTION_INJECTION(base_convert); + return f_base_convert(number, frombase, tobase); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pow f_pow +#else +inline Numeric x_pow(CVarRef base, CVarRef exp) { + FUNCTION_INJECTION(pow); + return f_pow(base, exp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_exp f_exp +#else +inline double x_exp(double arg) { + FUNCTION_INJECTION(exp); + return f_exp(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_expm1 f_expm1 +#else +inline double x_expm1(double arg) { + FUNCTION_INJECTION(expm1); + return f_expm1(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_log10 f_log10 +#else +inline double x_log10(double arg) { + FUNCTION_INJECTION(log10); + return f_log10(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_log1p f_log1p +#else +inline double x_log1p(double number) { + FUNCTION_INJECTION(log1p); + return f_log1p(number); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_log f_log +#else +inline double x_log(double arg, double base = 0) { + FUNCTION_INJECTION(log); + return f_log(arg, base); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_cos f_cos +#else +inline double x_cos(double arg) { + FUNCTION_INJECTION(cos); + return f_cos(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_cosh f_cosh +#else +inline double x_cosh(double arg) { + FUNCTION_INJECTION(cosh); + return f_cosh(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sin f_sin +#else +inline double x_sin(double arg) { + FUNCTION_INJECTION(sin); + return f_sin(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sinh f_sinh +#else +inline double x_sinh(double arg) { + FUNCTION_INJECTION(sinh); + return f_sinh(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_tan f_tan +#else +inline double x_tan(double arg) { + FUNCTION_INJECTION(tan); + return f_tan(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_tanh f_tanh +#else +inline double x_tanh(double arg) { + FUNCTION_INJECTION(tanh); + return f_tanh(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_acos f_acos +#else +inline double x_acos(double arg) { + FUNCTION_INJECTION(acos); + return f_acos(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_acosh f_acosh +#else +inline double x_acosh(double arg) { + FUNCTION_INJECTION(acosh); + return f_acosh(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_asin f_asin +#else +inline double x_asin(double arg) { + FUNCTION_INJECTION(asin); + return f_asin(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_asinh f_asinh +#else +inline double x_asinh(double arg) { + FUNCTION_INJECTION(asinh); + return f_asinh(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_atan f_atan +#else +inline double x_atan(double arg) { + FUNCTION_INJECTION(atan); + return f_atan(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_atanh f_atanh +#else +inline double x_atanh(double arg) { + FUNCTION_INJECTION(atanh); + return f_atanh(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_atan2 f_atan2 +#else +inline double x_atan2(double y, double x) { + FUNCTION_INJECTION(atan2); + return f_atan2(y, x); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hypot f_hypot +#else +inline double x_hypot(double x, double y) { + FUNCTION_INJECTION(hypot); + return f_hypot(x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fmod f_fmod +#else +inline double x_fmod(double x, double y) { + FUNCTION_INJECTION(fmod); + return f_fmod(x, y); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sqrt f_sqrt +#else +inline double x_sqrt(double arg) { + FUNCTION_INJECTION(sqrt); + return f_sqrt(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getrandmax f_getrandmax +#else +inline int64 x_getrandmax() { + FUNCTION_INJECTION(getrandmax); + return f_getrandmax(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_srand f_srand +#else +inline void x_srand(CVarRef seed = null_variant) { + FUNCTION_INJECTION(srand); + f_srand(seed); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rand f_rand +#else +inline int64 x_rand(int64 min = 0, int64 max = RAND_MAX) { + FUNCTION_INJECTION(rand); + return f_rand(min, max); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mt_getrandmax f_mt_getrandmax +#else +inline int64 x_mt_getrandmax() { + FUNCTION_INJECTION(mt_getrandmax); + return f_mt_getrandmax(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mt_srand f_mt_srand +#else +inline void x_mt_srand(CVarRef seed = null_variant) { + FUNCTION_INJECTION(mt_srand); + f_mt_srand(seed); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mt_rand f_mt_rand +#else +inline int64 x_mt_rand(int64 min = 0, int64 max = RAND_MAX) { + FUNCTION_INJECTION(mt_rand); + return f_mt_rand(min, max); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_lcg_value f_lcg_value +#else +inline double x_lcg_value() { + FUNCTION_INJECTION(lcg_value); + return f_lcg_value(); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_MATH_H__ diff --git a/src/cpp/ext/profile/extprofile_mb.h b/src/cpp/ext/profile/extprofile_mb.h new file mode 100644 index 0000000000000..ce7d649acea20 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_mb.h @@ -0,0 +1,527 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_MB_H__ +#define __EXTPROFILE_MB_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_mb_list_encodings f_mb_list_encodings +#else +inline Array x_mb_list_encodings() { + FUNCTION_INJECTION(mb_list_encodings); + return f_mb_list_encodings(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_list_encodings_alias_names f_mb_list_encodings_alias_names +#else +inline Variant x_mb_list_encodings_alias_names(CStrRef name = null_string) { + FUNCTION_INJECTION(mb_list_encodings_alias_names); + return f_mb_list_encodings_alias_names(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_list_mime_names f_mb_list_mime_names +#else +inline Variant x_mb_list_mime_names(CStrRef name = null_string) { + FUNCTION_INJECTION(mb_list_mime_names); + return f_mb_list_mime_names(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_check_encoding f_mb_check_encoding +#else +inline bool x_mb_check_encoding(CStrRef var = null_string, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_check_encoding); + return f_mb_check_encoding(var, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_convert_case f_mb_convert_case +#else +inline Variant x_mb_convert_case(CStrRef str, int mode, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_convert_case); + return f_mb_convert_case(str, mode, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_convert_encoding f_mb_convert_encoding +#else +inline Variant x_mb_convert_encoding(CStrRef str, CStrRef to_encoding, CVarRef from_encoding = null_variant) { + FUNCTION_INJECTION(mb_convert_encoding); + return f_mb_convert_encoding(str, to_encoding, from_encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_convert_kana f_mb_convert_kana +#else +inline Variant x_mb_convert_kana(CStrRef str, CStrRef option = null_string, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_convert_kana); + return f_mb_convert_kana(str, option, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_convert_variables f_mb_convert_variables +#else +inline Variant x_mb_convert_variables(int _argc, CStrRef to_encoding, CVarRef from_encoding, Variant vars, CArrRef _argv = null_array) { + FUNCTION_INJECTION(mb_convert_variables); + return f_mb_convert_variables(_argc, to_encoding, from_encoding, ref(vars), _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_decode_mimeheader f_mb_decode_mimeheader +#else +inline Variant x_mb_decode_mimeheader(CStrRef str) { + FUNCTION_INJECTION(mb_decode_mimeheader); + return f_mb_decode_mimeheader(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_decode_numericentity f_mb_decode_numericentity +#else +inline Variant x_mb_decode_numericentity(CStrRef str, CVarRef convmap, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_decode_numericentity); + return f_mb_decode_numericentity(str, convmap, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_detect_encoding f_mb_detect_encoding +#else +inline Variant x_mb_detect_encoding(CStrRef str, CVarRef encoding_list = null_variant, CVarRef strict = null_variant) { + FUNCTION_INJECTION(mb_detect_encoding); + return f_mb_detect_encoding(str, encoding_list, strict); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_detect_order f_mb_detect_order +#else +inline Variant x_mb_detect_order(CVarRef encoding_list = null_variant) { + FUNCTION_INJECTION(mb_detect_order); + return f_mb_detect_order(encoding_list); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_encode_mimeheader f_mb_encode_mimeheader +#else +inline Variant x_mb_encode_mimeheader(CStrRef str, CStrRef charset = null_string, CStrRef transfer_encoding = null_string, CStrRef linefeed = "\r\n", int indent = 0) { + FUNCTION_INJECTION(mb_encode_mimeheader); + return f_mb_encode_mimeheader(str, charset, transfer_encoding, linefeed, indent); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_encode_numericentity f_mb_encode_numericentity +#else +inline Variant x_mb_encode_numericentity(CStrRef str, CVarRef convmap, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_encode_numericentity); + return f_mb_encode_numericentity(str, convmap, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_ereg_match f_mb_ereg_match +#else +inline bool x_mb_ereg_match(CStrRef pattern, CStrRef str, CStrRef option = null_string) { + FUNCTION_INJECTION(mb_ereg_match); + return f_mb_ereg_match(pattern, str, option); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_ereg_replace f_mb_ereg_replace +#else +inline Variant x_mb_ereg_replace(CVarRef pattern, CStrRef replacement, CStrRef str, CStrRef option = null_string) { + FUNCTION_INJECTION(mb_ereg_replace); + return f_mb_ereg_replace(pattern, replacement, str, option); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_ereg_search_getpos f_mb_ereg_search_getpos +#else +inline int x_mb_ereg_search_getpos() { + FUNCTION_INJECTION(mb_ereg_search_getpos); + return f_mb_ereg_search_getpos(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_ereg_search_getregs f_mb_ereg_search_getregs +#else +inline Variant x_mb_ereg_search_getregs() { + FUNCTION_INJECTION(mb_ereg_search_getregs); + return f_mb_ereg_search_getregs(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_ereg_search_init f_mb_ereg_search_init +#else +inline bool x_mb_ereg_search_init(CStrRef str, CStrRef pattern = null_string, CStrRef option = null_string) { + FUNCTION_INJECTION(mb_ereg_search_init); + return f_mb_ereg_search_init(str, pattern, option); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_ereg_search_pos f_mb_ereg_search_pos +#else +inline Variant x_mb_ereg_search_pos(CStrRef pattern = null_string, CStrRef option = null_string) { + FUNCTION_INJECTION(mb_ereg_search_pos); + return f_mb_ereg_search_pos(pattern, option); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_ereg_search_regs f_mb_ereg_search_regs +#else +inline Variant x_mb_ereg_search_regs(CStrRef pattern = null_string, CStrRef option = null_string) { + FUNCTION_INJECTION(mb_ereg_search_regs); + return f_mb_ereg_search_regs(pattern, option); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_ereg_search_setpos f_mb_ereg_search_setpos +#else +inline bool x_mb_ereg_search_setpos(int position) { + FUNCTION_INJECTION(mb_ereg_search_setpos); + return f_mb_ereg_search_setpos(position); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_ereg_search f_mb_ereg_search +#else +inline Variant x_mb_ereg_search(CStrRef pattern = null_string, CStrRef option = null_string) { + FUNCTION_INJECTION(mb_ereg_search); + return f_mb_ereg_search(pattern, option); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_ereg f_mb_ereg +#else +inline Variant x_mb_ereg(CVarRef pattern, CStrRef str, Variant regs = null) { + FUNCTION_INJECTION(mb_ereg); + return f_mb_ereg(pattern, str, ref(regs)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_eregi_replace f_mb_eregi_replace +#else +inline Variant x_mb_eregi_replace(CVarRef pattern, CStrRef replacement, CStrRef str, CStrRef option = null_string) { + FUNCTION_INJECTION(mb_eregi_replace); + return f_mb_eregi_replace(pattern, replacement, str, option); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_eregi f_mb_eregi +#else +inline Variant x_mb_eregi(CVarRef pattern, CStrRef str, Variant regs = null) { + FUNCTION_INJECTION(mb_eregi); + return f_mb_eregi(pattern, str, ref(regs)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_get_info f_mb_get_info +#else +inline Variant x_mb_get_info(CStrRef type = null_string) { + FUNCTION_INJECTION(mb_get_info); + return f_mb_get_info(type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_http_input f_mb_http_input +#else +inline Variant x_mb_http_input(CStrRef type = null_string) { + FUNCTION_INJECTION(mb_http_input); + return f_mb_http_input(type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_http_output f_mb_http_output +#else +inline Variant x_mb_http_output(CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_http_output); + return f_mb_http_output(encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_internal_encoding f_mb_internal_encoding +#else +inline Variant x_mb_internal_encoding(CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_internal_encoding); + return f_mb_internal_encoding(encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_language f_mb_language +#else +inline Variant x_mb_language(CStrRef language = null_string) { + FUNCTION_INJECTION(mb_language); + return f_mb_language(language); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_output_handler f_mb_output_handler +#else +inline String x_mb_output_handler(CStrRef contents, int status) { + FUNCTION_INJECTION(mb_output_handler); + return f_mb_output_handler(contents, status); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_parse_str f_mb_parse_str +#else +inline bool x_mb_parse_str(CStrRef encoded_string, Variant result = null) { + FUNCTION_INJECTION(mb_parse_str); + return f_mb_parse_str(encoded_string, ref(result)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_preferred_mime_name f_mb_preferred_mime_name +#else +inline Variant x_mb_preferred_mime_name(CStrRef encoding) { + FUNCTION_INJECTION(mb_preferred_mime_name); + return f_mb_preferred_mime_name(encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_regex_encoding f_mb_regex_encoding +#else +inline Variant x_mb_regex_encoding(CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_regex_encoding); + return f_mb_regex_encoding(encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_regex_set_options f_mb_regex_set_options +#else +inline String x_mb_regex_set_options(CStrRef options = null_string) { + FUNCTION_INJECTION(mb_regex_set_options); + return f_mb_regex_set_options(options); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_send_mail f_mb_send_mail +#else +inline bool x_mb_send_mail(CStrRef to, CStrRef subject, CStrRef message, CStrRef headers = null_string, CStrRef extra_cmd = null_string) { + FUNCTION_INJECTION(mb_send_mail); + return f_mb_send_mail(to, subject, message, headers, extra_cmd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_split f_mb_split +#else +inline Variant x_mb_split(CStrRef pattern, CStrRef str, int count = -1) { + FUNCTION_INJECTION(mb_split); + return f_mb_split(pattern, str, count); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strcut f_mb_strcut +#else +inline Variant x_mb_strcut(CStrRef str, int start, int length = 0x7FFFFFFF, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strcut); + return f_mb_strcut(str, start, length, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strimwidth f_mb_strimwidth +#else +inline Variant x_mb_strimwidth(CStrRef str, int start, int width, CStrRef trimmarker = null_string, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strimwidth); + return f_mb_strimwidth(str, start, width, trimmarker, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_stripos f_mb_stripos +#else +inline Variant x_mb_stripos(CStrRef haystack, CStrRef needle, int offset = 0, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_stripos); + return f_mb_stripos(haystack, needle, offset, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_stristr f_mb_stristr +#else +inline Variant x_mb_stristr(CStrRef haystack, CStrRef needle, bool part = false, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_stristr); + return f_mb_stristr(haystack, needle, part, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strlen f_mb_strlen +#else +inline Variant x_mb_strlen(CStrRef str, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strlen); + return f_mb_strlen(str, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strpos f_mb_strpos +#else +inline Variant x_mb_strpos(CStrRef haystack, CStrRef needle, int offset = 0, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strpos); + return f_mb_strpos(haystack, needle, offset, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strrchr f_mb_strrchr +#else +inline Variant x_mb_strrchr(CStrRef haystack, CStrRef needle, bool part = false, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strrchr); + return f_mb_strrchr(haystack, needle, part, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strrichr f_mb_strrichr +#else +inline Variant x_mb_strrichr(CStrRef haystack, CStrRef needle, bool part = false, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strrichr); + return f_mb_strrichr(haystack, needle, part, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strripos f_mb_strripos +#else +inline Variant x_mb_strripos(CStrRef haystack, CStrRef needle, int offset = 0, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strripos); + return f_mb_strripos(haystack, needle, offset, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strrpos f_mb_strrpos +#else +inline Variant x_mb_strrpos(CStrRef haystack, CStrRef needle, CVarRef offset = 0LL, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strrpos); + return f_mb_strrpos(haystack, needle, offset, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strstr f_mb_strstr +#else +inline Variant x_mb_strstr(CStrRef haystack, CStrRef needle, bool part = false, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strstr); + return f_mb_strstr(haystack, needle, part, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strtolower f_mb_strtolower +#else +inline Variant x_mb_strtolower(CStrRef str, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strtolower); + return f_mb_strtolower(str, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strtoupper f_mb_strtoupper +#else +inline Variant x_mb_strtoupper(CStrRef str, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strtoupper); + return f_mb_strtoupper(str, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_strwidth f_mb_strwidth +#else +inline Variant x_mb_strwidth(CStrRef str, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_strwidth); + return f_mb_strwidth(str, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_substitute_character f_mb_substitute_character +#else +inline Variant x_mb_substitute_character(CVarRef substrchar = null_variant) { + FUNCTION_INJECTION(mb_substitute_character); + return f_mb_substitute_character(substrchar); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_substr_count f_mb_substr_count +#else +inline Variant x_mb_substr_count(CStrRef haystack, CStrRef needle, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_substr_count); + return f_mb_substr_count(haystack, needle, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mb_substr f_mb_substr +#else +inline Variant x_mb_substr(CStrRef str, int start, int length = 0x7FFFFFFF, CStrRef encoding = null_string) { + FUNCTION_INJECTION(mb_substr); + return f_mb_substr(str, start, length, encoding); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_MB_H__ diff --git a/src/cpp/ext/profile/extprofile_mcrypt.h b/src/cpp/ext/profile/extprofile_mcrypt.h new file mode 100644 index 0000000000000..6fcf86bf9060d --- /dev/null +++ b/src/cpp/ext/profile/extprofile_mcrypt.h @@ -0,0 +1,365 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_MCRYPT_H__ +#define __EXTPROFILE_MCRYPT_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_module_open f_mcrypt_module_open +#else +inline Variant x_mcrypt_module_open(CStrRef algorithm, CStrRef algorithm_directory, CStrRef mode, CStrRef mode_directory) { + FUNCTION_INJECTION(mcrypt_module_open); + return f_mcrypt_module_open(algorithm, algorithm_directory, mode, mode_directory); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_module_close f_mcrypt_module_close +#else +inline bool x_mcrypt_module_close(CObjRef td) { + FUNCTION_INJECTION(mcrypt_module_close); + return f_mcrypt_module_close(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_list_algorithms f_mcrypt_list_algorithms +#else +inline Array x_mcrypt_list_algorithms(CStrRef lib_dir = null_string) { + FUNCTION_INJECTION(mcrypt_list_algorithms); + return f_mcrypt_list_algorithms(lib_dir); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_list_modes f_mcrypt_list_modes +#else +inline Array x_mcrypt_list_modes(CStrRef lib_dir = null_string) { + FUNCTION_INJECTION(mcrypt_list_modes); + return f_mcrypt_list_modes(lib_dir); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_module_get_algo_block_size f_mcrypt_module_get_algo_block_size +#else +inline int x_mcrypt_module_get_algo_block_size(CStrRef algorithm, CStrRef lib_dir = null_string) { + FUNCTION_INJECTION(mcrypt_module_get_algo_block_size); + return f_mcrypt_module_get_algo_block_size(algorithm, lib_dir); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_module_get_algo_key_size f_mcrypt_module_get_algo_key_size +#else +inline int x_mcrypt_module_get_algo_key_size(CStrRef algorithm, CStrRef lib_dir = null_string) { + FUNCTION_INJECTION(mcrypt_module_get_algo_key_size); + return f_mcrypt_module_get_algo_key_size(algorithm, lib_dir); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_module_get_supported_key_sizes f_mcrypt_module_get_supported_key_sizes +#else +inline Array x_mcrypt_module_get_supported_key_sizes(CStrRef algorithm, CStrRef lib_dir = null_string) { + FUNCTION_INJECTION(mcrypt_module_get_supported_key_sizes); + return f_mcrypt_module_get_supported_key_sizes(algorithm, lib_dir); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_module_is_block_algorithm_mode f_mcrypt_module_is_block_algorithm_mode +#else +inline bool x_mcrypt_module_is_block_algorithm_mode(CStrRef mode, CStrRef lib_dir = null_string) { + FUNCTION_INJECTION(mcrypt_module_is_block_algorithm_mode); + return f_mcrypt_module_is_block_algorithm_mode(mode, lib_dir); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_module_is_block_algorithm f_mcrypt_module_is_block_algorithm +#else +inline bool x_mcrypt_module_is_block_algorithm(CStrRef algorithm, CStrRef lib_dir = null_string) { + FUNCTION_INJECTION(mcrypt_module_is_block_algorithm); + return f_mcrypt_module_is_block_algorithm(algorithm, lib_dir); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_module_is_block_mode f_mcrypt_module_is_block_mode +#else +inline bool x_mcrypt_module_is_block_mode(CStrRef mode, CStrRef lib_dir = null_string) { + FUNCTION_INJECTION(mcrypt_module_is_block_mode); + return f_mcrypt_module_is_block_mode(mode, lib_dir); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_module_self_test f_mcrypt_module_self_test +#else +inline bool x_mcrypt_module_self_test(CStrRef algorithm, CStrRef lib_dir = null_string) { + FUNCTION_INJECTION(mcrypt_module_self_test); + return f_mcrypt_module_self_test(algorithm, lib_dir); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_create_iv f_mcrypt_create_iv +#else +inline Variant x_mcrypt_create_iv(int size, int source = 0) { + FUNCTION_INJECTION(mcrypt_create_iv); + return f_mcrypt_create_iv(size, source); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_encrypt f_mcrypt_encrypt +#else +inline Variant x_mcrypt_encrypt(CStrRef cipher, CStrRef key, CStrRef data, CStrRef mode, CStrRef iv = null_string) { + FUNCTION_INJECTION(mcrypt_encrypt); + return f_mcrypt_encrypt(cipher, key, data, mode, iv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_decrypt f_mcrypt_decrypt +#else +inline Variant x_mcrypt_decrypt(CStrRef cipher, CStrRef key, CStrRef data, CStrRef mode, CStrRef iv = null_string) { + FUNCTION_INJECTION(mcrypt_decrypt); + return f_mcrypt_decrypt(cipher, key, data, mode, iv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_cbc f_mcrypt_cbc +#else +inline Variant x_mcrypt_cbc(CStrRef cipher, CStrRef key, CStrRef data, int mode, CStrRef iv = null_string) { + FUNCTION_INJECTION(mcrypt_cbc); + return f_mcrypt_cbc(cipher, key, data, mode, iv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_cfb f_mcrypt_cfb +#else +inline Variant x_mcrypt_cfb(CStrRef cipher, CStrRef key, CStrRef data, int mode, CStrRef iv = null_string) { + FUNCTION_INJECTION(mcrypt_cfb); + return f_mcrypt_cfb(cipher, key, data, mode, iv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_ecb f_mcrypt_ecb +#else +inline Variant x_mcrypt_ecb(CStrRef cipher, CStrRef key, CStrRef data, int mode, CStrRef iv = null_string) { + FUNCTION_INJECTION(mcrypt_ecb); + return f_mcrypt_ecb(cipher, key, data, mode, iv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_ofb f_mcrypt_ofb +#else +inline Variant x_mcrypt_ofb(CStrRef cipher, CStrRef key, CStrRef data, int mode, CStrRef iv = null_string) { + FUNCTION_INJECTION(mcrypt_ofb); + return f_mcrypt_ofb(cipher, key, data, mode, iv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_get_block_size f_mcrypt_get_block_size +#else +inline Variant x_mcrypt_get_block_size(CStrRef cipher, CStrRef module = null_string) { + FUNCTION_INJECTION(mcrypt_get_block_size); + return f_mcrypt_get_block_size(cipher, module); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_get_cipher_name f_mcrypt_get_cipher_name +#else +inline Variant x_mcrypt_get_cipher_name(CStrRef cipher) { + FUNCTION_INJECTION(mcrypt_get_cipher_name); + return f_mcrypt_get_cipher_name(cipher); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_get_iv_size f_mcrypt_get_iv_size +#else +inline Variant x_mcrypt_get_iv_size(CStrRef cipher, CStrRef mode) { + FUNCTION_INJECTION(mcrypt_get_iv_size); + return f_mcrypt_get_iv_size(cipher, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_get_key_size f_mcrypt_get_key_size +#else +inline int x_mcrypt_get_key_size(CStrRef cipher, CStrRef module) { + FUNCTION_INJECTION(mcrypt_get_key_size); + return f_mcrypt_get_key_size(cipher, module); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_enc_get_algorithms_name f_mcrypt_enc_get_algorithms_name +#else +inline String x_mcrypt_enc_get_algorithms_name(CObjRef td) { + FUNCTION_INJECTION(mcrypt_enc_get_algorithms_name); + return f_mcrypt_enc_get_algorithms_name(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_enc_get_block_size f_mcrypt_enc_get_block_size +#else +inline int x_mcrypt_enc_get_block_size(CObjRef td) { + FUNCTION_INJECTION(mcrypt_enc_get_block_size); + return f_mcrypt_enc_get_block_size(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_enc_get_iv_size f_mcrypt_enc_get_iv_size +#else +inline int x_mcrypt_enc_get_iv_size(CObjRef td) { + FUNCTION_INJECTION(mcrypt_enc_get_iv_size); + return f_mcrypt_enc_get_iv_size(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_enc_get_key_size f_mcrypt_enc_get_key_size +#else +inline int x_mcrypt_enc_get_key_size(CObjRef td) { + FUNCTION_INJECTION(mcrypt_enc_get_key_size); + return f_mcrypt_enc_get_key_size(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_enc_get_modes_name f_mcrypt_enc_get_modes_name +#else +inline String x_mcrypt_enc_get_modes_name(CObjRef td) { + FUNCTION_INJECTION(mcrypt_enc_get_modes_name); + return f_mcrypt_enc_get_modes_name(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_enc_get_supported_key_sizes f_mcrypt_enc_get_supported_key_sizes +#else +inline Array x_mcrypt_enc_get_supported_key_sizes(CObjRef td) { + FUNCTION_INJECTION(mcrypt_enc_get_supported_key_sizes); + return f_mcrypt_enc_get_supported_key_sizes(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_enc_is_block_algorithm_mode f_mcrypt_enc_is_block_algorithm_mode +#else +inline bool x_mcrypt_enc_is_block_algorithm_mode(CObjRef td) { + FUNCTION_INJECTION(mcrypt_enc_is_block_algorithm_mode); + return f_mcrypt_enc_is_block_algorithm_mode(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_enc_is_block_algorithm f_mcrypt_enc_is_block_algorithm +#else +inline bool x_mcrypt_enc_is_block_algorithm(CObjRef td) { + FUNCTION_INJECTION(mcrypt_enc_is_block_algorithm); + return f_mcrypt_enc_is_block_algorithm(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_enc_is_block_mode f_mcrypt_enc_is_block_mode +#else +inline bool x_mcrypt_enc_is_block_mode(CObjRef td) { + FUNCTION_INJECTION(mcrypt_enc_is_block_mode); + return f_mcrypt_enc_is_block_mode(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_enc_self_test f_mcrypt_enc_self_test +#else +inline int x_mcrypt_enc_self_test(CObjRef td) { + FUNCTION_INJECTION(mcrypt_enc_self_test); + return f_mcrypt_enc_self_test(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_generic f_mcrypt_generic +#else +inline Variant x_mcrypt_generic(CObjRef td, CStrRef data) { + FUNCTION_INJECTION(mcrypt_generic); + return f_mcrypt_generic(td, data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_generic_init f_mcrypt_generic_init +#else +inline int x_mcrypt_generic_init(CObjRef td, CStrRef key, CStrRef iv) { + FUNCTION_INJECTION(mcrypt_generic_init); + return f_mcrypt_generic_init(td, key, iv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mdecrypt_generic f_mdecrypt_generic +#else +inline Variant x_mdecrypt_generic(CObjRef td, CStrRef data) { + FUNCTION_INJECTION(mdecrypt_generic); + return f_mdecrypt_generic(td, data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_generic_deinit f_mcrypt_generic_deinit +#else +inline bool x_mcrypt_generic_deinit(CObjRef td) { + FUNCTION_INJECTION(mcrypt_generic_deinit); + return f_mcrypt_generic_deinit(td); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mcrypt_generic_end f_mcrypt_generic_end +#else +inline bool x_mcrypt_generic_end(CObjRef td) { + FUNCTION_INJECTION(mcrypt_generic_end); + return f_mcrypt_generic_end(td); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_MCRYPT_H__ diff --git a/src/cpp/ext/profile/extprofile_misc.h b/src/cpp/ext/profile/extprofile_misc.h new file mode 100644 index 0000000000000..7d05d95537763 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_misc.h @@ -0,0 +1,275 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_MISC_H__ +#define __EXTPROFILE_MISC_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_connection_aborted f_connection_aborted +#else +inline int x_connection_aborted() { + FUNCTION_INJECTION(connection_aborted); + return f_connection_aborted(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_connection_status f_connection_status +#else +inline int x_connection_status() { + FUNCTION_INJECTION(connection_status); + return f_connection_status(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_connection_timeout f_connection_timeout +#else +inline int x_connection_timeout() { + FUNCTION_INJECTION(connection_timeout); + return f_connection_timeout(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_constant f_constant +#else +inline Variant x_constant(CStrRef name) { + FUNCTION_INJECTION(constant); + return f_constant(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_define f_define +#else +inline bool x_define(CStrRef name, CVarRef value, bool case_insensitive = false) { + FUNCTION_INJECTION(define); + return f_define(name, value, case_insensitive); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_defined f_defined +#else +inline bool x_defined(CStrRef name) { + FUNCTION_INJECTION(defined); + return f_defined(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_die f_die +#else +inline Variant x_die(CVarRef status = null_variant) { + FUNCTION_INJECTION(die); + return f_die(status); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_exit f_exit +#else +inline Variant x_exit(CVarRef status = null_variant) { + FUNCTION_INJECTION(exit); + return f_exit(status); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_eval f_eval +#else +inline Variant x_eval(CStrRef code_str) { + FUNCTION_INJECTION(eval); + return f_eval(code_str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_browser f_get_browser +#else +inline Variant x_get_browser(CStrRef user_agent = null_string, bool return_array = false) { + FUNCTION_INJECTION(get_browser); + return f_get_browser(user_agent, return_array); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x___halt_compiler f___halt_compiler +#else +inline void x___halt_compiler() { + FUNCTION_INJECTION(__halt_compiler); + f___halt_compiler(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_highlight_file f_highlight_file +#else +inline Variant x_highlight_file(CStrRef filename, bool ret = false) { + FUNCTION_INJECTION(highlight_file); + return f_highlight_file(filename, ret); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_show_source f_show_source +#else +inline Variant x_show_source(CStrRef filename, bool ret = false) { + FUNCTION_INJECTION(show_source); + return f_show_source(filename, ret); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_highlight_string f_highlight_string +#else +inline Variant x_highlight_string(CStrRef str, bool ret = false) { + FUNCTION_INJECTION(highlight_string); + return f_highlight_string(str, ret); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ignore_user_abort f_ignore_user_abort +#else +inline int x_ignore_user_abort(bool setting = false) { + FUNCTION_INJECTION(ignore_user_abort); + return f_ignore_user_abort(setting); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pack f_pack +#else +inline String x_pack(int _argc, CStrRef format, CArrRef _argv = null_array) { + FUNCTION_INJECTION(pack); + return f_pack(_argc, format, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_php_check_syntax f_php_check_syntax +#else +inline bool x_php_check_syntax(CStrRef filename, Variant error_message = null) { + FUNCTION_INJECTION(php_check_syntax); + return f_php_check_syntax(filename, ref(error_message)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_php_strip_whitespace f_php_strip_whitespace +#else +inline String x_php_strip_whitespace(CStrRef filename) { + FUNCTION_INJECTION(php_strip_whitespace); + return f_php_strip_whitespace(filename); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sleep f_sleep +#else +inline int x_sleep(int seconds) { + FUNCTION_INJECTION(sleep); + return f_sleep(seconds); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_usleep f_usleep +#else +inline void x_usleep(int micro_seconds) { + FUNCTION_INJECTION(usleep); + f_usleep(micro_seconds); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_time_nanosleep f_time_nanosleep +#else +inline Variant x_time_nanosleep(int seconds, int nanoseconds) { + FUNCTION_INJECTION(time_nanosleep); + return f_time_nanosleep(seconds, nanoseconds); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_time_sleep_until f_time_sleep_until +#else +inline bool x_time_sleep_until(double timestamp) { + FUNCTION_INJECTION(time_sleep_until); + return f_time_sleep_until(timestamp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_uniqid f_uniqid +#else +inline String x_uniqid(CStrRef prefix = null_string, bool more_entropy = false) { + FUNCTION_INJECTION(uniqid); + return f_uniqid(prefix, more_entropy); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_unpack f_unpack +#else +inline Array x_unpack(CStrRef format, CStrRef data) { + FUNCTION_INJECTION(unpack); + return f_unpack(format, data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sys_getloadavg f_sys_getloadavg +#else +inline Array x_sys_getloadavg() { + FUNCTION_INJECTION(sys_getloadavg); + return f_sys_getloadavg(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_token_get_all f_token_get_all +#else +inline Array x_token_get_all(CStrRef source) { + FUNCTION_INJECTION(token_get_all); + return f_token_get_all(source); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_token_name f_token_name +#else +inline String x_token_name(int64 token) { + FUNCTION_INJECTION(token_name); + return f_token_name(token); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_MISC_H__ diff --git a/src/cpp/ext/profile/extprofile_mysql.h b/src/cpp/ext/profile/extprofile_mysql.h new file mode 100644 index 0000000000000..d88a9c3ecc037 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_mysql.h @@ -0,0 +1,473 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_MYSQL_H__ +#define __EXTPROFILE_MYSQL_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_mysql_connect f_mysql_connect +#else +inline Variant x_mysql_connect(CStrRef server = null_string, CStrRef username = null_string, CStrRef password = null_string, bool new_link = false, int client_flags = 0, int connect_timeout_ms = -1, int query_timeout_ms = -1) { + FUNCTION_INJECTION(mysql_connect); + return f_mysql_connect(server, username, password, new_link, client_flags, connect_timeout_ms, query_timeout_ms); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_pconnect f_mysql_pconnect +#else +inline Variant x_mysql_pconnect(CStrRef server = null_string, CStrRef username = null_string, CStrRef password = null_string, int client_flags = 0, int connect_timeout_ms = -1, int query_timeout_ms = -1) { + FUNCTION_INJECTION(mysql_pconnect); + return f_mysql_pconnect(server, username, password, client_flags, connect_timeout_ms, query_timeout_ms); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_set_charset f_mysql_set_charset +#else +inline Variant x_mysql_set_charset(CStrRef charset, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_set_charset); + return f_mysql_set_charset(charset, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_ping f_mysql_ping +#else +inline Variant x_mysql_ping(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_ping); + return f_mysql_ping(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_escape_string f_mysql_escape_string +#else +inline String x_mysql_escape_string(CStrRef unescaped_string) { + FUNCTION_INJECTION(mysql_escape_string); + return f_mysql_escape_string(unescaped_string); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_real_escape_string f_mysql_real_escape_string +#else +inline Variant x_mysql_real_escape_string(CStrRef unescaped_string, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_real_escape_string); + return f_mysql_real_escape_string(unescaped_string, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_client_encoding f_mysql_client_encoding +#else +inline Variant x_mysql_client_encoding(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_client_encoding); + return f_mysql_client_encoding(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_close f_mysql_close +#else +inline Variant x_mysql_close(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_close); + return f_mysql_close(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_errno f_mysql_errno +#else +inline Variant x_mysql_errno(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_errno); + return f_mysql_errno(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_error f_mysql_error +#else +inline Variant x_mysql_error(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_error); + return f_mysql_error(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_get_client_info f_mysql_get_client_info +#else +inline String x_mysql_get_client_info() { + FUNCTION_INJECTION(mysql_get_client_info); + return f_mysql_get_client_info(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_get_host_info f_mysql_get_host_info +#else +inline Variant x_mysql_get_host_info(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_get_host_info); + return f_mysql_get_host_info(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_get_proto_info f_mysql_get_proto_info +#else +inline Variant x_mysql_get_proto_info(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_get_proto_info); + return f_mysql_get_proto_info(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_get_server_info f_mysql_get_server_info +#else +inline Variant x_mysql_get_server_info(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_get_server_info); + return f_mysql_get_server_info(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_info f_mysql_info +#else +inline Variant x_mysql_info(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_info); + return f_mysql_info(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_insert_id f_mysql_insert_id +#else +inline Variant x_mysql_insert_id(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_insert_id); + return f_mysql_insert_id(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_stat f_mysql_stat +#else +inline Variant x_mysql_stat(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_stat); + return f_mysql_stat(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_thread_id f_mysql_thread_id +#else +inline Variant x_mysql_thread_id(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_thread_id); + return f_mysql_thread_id(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_create_db f_mysql_create_db +#else +inline Variant x_mysql_create_db(CStrRef db, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_create_db); + return f_mysql_create_db(db, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_select_db f_mysql_select_db +#else +inline Variant x_mysql_select_db(CStrRef db, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_select_db); + return f_mysql_select_db(db, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_drop_db f_mysql_drop_db +#else +inline Variant x_mysql_drop_db(CStrRef db, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_drop_db); + return f_mysql_drop_db(db, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_affected_rows f_mysql_affected_rows +#else +inline Variant x_mysql_affected_rows(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_affected_rows); + return f_mysql_affected_rows(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_set_timeout f_mysql_set_timeout +#else +inline bool x_mysql_set_timeout(int query_timeout_ms = -1, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_set_timeout); + return f_mysql_set_timeout(query_timeout_ms, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_query f_mysql_query +#else +inline Variant x_mysql_query(CStrRef query, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_query); + return f_mysql_query(query, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_unbuffered_query f_mysql_unbuffered_query +#else +inline Variant x_mysql_unbuffered_query(CStrRef query, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_unbuffered_query); + return f_mysql_unbuffered_query(query, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_db_query f_mysql_db_query +#else +inline Variant x_mysql_db_query(CStrRef database, CStrRef query, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_db_query); + return f_mysql_db_query(database, query, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_list_dbs f_mysql_list_dbs +#else +inline Variant x_mysql_list_dbs(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_list_dbs); + return f_mysql_list_dbs(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_list_tables f_mysql_list_tables +#else +inline Variant x_mysql_list_tables(CStrRef database, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_list_tables); + return f_mysql_list_tables(database, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_list_fields f_mysql_list_fields +#else +inline Variant x_mysql_list_fields(CStrRef database_name, CStrRef table_name, CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_list_fields); + return f_mysql_list_fields(database_name, table_name, link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_list_processes f_mysql_list_processes +#else +inline Variant x_mysql_list_processes(CVarRef link_identifier = null) { + FUNCTION_INJECTION(mysql_list_processes); + return f_mysql_list_processes(link_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_db_name f_mysql_db_name +#else +inline Variant x_mysql_db_name(CVarRef result, int row, CVarRef field = null_variant) { + FUNCTION_INJECTION(mysql_db_name); + return f_mysql_db_name(result, row, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_tablename f_mysql_tablename +#else +inline Variant x_mysql_tablename(CVarRef result, int i) { + FUNCTION_INJECTION(mysql_tablename); + return f_mysql_tablename(result, i); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_num_fields f_mysql_num_fields +#else +inline Variant x_mysql_num_fields(CVarRef result) { + FUNCTION_INJECTION(mysql_num_fields); + return f_mysql_num_fields(result); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_num_rows f_mysql_num_rows +#else +inline Variant x_mysql_num_rows(CVarRef result) { + FUNCTION_INJECTION(mysql_num_rows); + return f_mysql_num_rows(result); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_free_result f_mysql_free_result +#else +inline Variant x_mysql_free_result(CVarRef result) { + FUNCTION_INJECTION(mysql_free_result); + return f_mysql_free_result(result); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_data_seek f_mysql_data_seek +#else +inline bool x_mysql_data_seek(CVarRef result, int row) { + FUNCTION_INJECTION(mysql_data_seek); + return f_mysql_data_seek(result, row); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_fetch_row f_mysql_fetch_row +#else +inline Variant x_mysql_fetch_row(CVarRef result) { + FUNCTION_INJECTION(mysql_fetch_row); + return f_mysql_fetch_row(result); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_fetch_assoc f_mysql_fetch_assoc +#else +inline Variant x_mysql_fetch_assoc(CVarRef result) { + FUNCTION_INJECTION(mysql_fetch_assoc); + return f_mysql_fetch_assoc(result); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_fetch_array f_mysql_fetch_array +#else +inline Variant x_mysql_fetch_array(CVarRef result, int result_type = 3) { + FUNCTION_INJECTION(mysql_fetch_array); + return f_mysql_fetch_array(result, result_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_fetch_lengths f_mysql_fetch_lengths +#else +inline Variant x_mysql_fetch_lengths(CVarRef result) { + FUNCTION_INJECTION(mysql_fetch_lengths); + return f_mysql_fetch_lengths(result); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_fetch_object f_mysql_fetch_object +#else +inline Variant x_mysql_fetch_object(CVarRef result, CStrRef class_name = "stdClass", CArrRef params = null) { + FUNCTION_INJECTION(mysql_fetch_object); + return f_mysql_fetch_object(result, class_name, params); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_result f_mysql_result +#else +inline Variant x_mysql_result(CVarRef result, int row, CVarRef field = null_variant) { + FUNCTION_INJECTION(mysql_result); + return f_mysql_result(result, row, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_fetch_field f_mysql_fetch_field +#else +inline Variant x_mysql_fetch_field(CVarRef result, int field = -1) { + FUNCTION_INJECTION(mysql_fetch_field); + return f_mysql_fetch_field(result, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_field_seek f_mysql_field_seek +#else +inline bool x_mysql_field_seek(CVarRef result, int field = 0) { + FUNCTION_INJECTION(mysql_field_seek); + return f_mysql_field_seek(result, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_field_name f_mysql_field_name +#else +inline Variant x_mysql_field_name(CVarRef result, int field = 0) { + FUNCTION_INJECTION(mysql_field_name); + return f_mysql_field_name(result, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_field_table f_mysql_field_table +#else +inline Variant x_mysql_field_table(CVarRef result, int field = 0) { + FUNCTION_INJECTION(mysql_field_table); + return f_mysql_field_table(result, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_field_len f_mysql_field_len +#else +inline Variant x_mysql_field_len(CVarRef result, int field = 0) { + FUNCTION_INJECTION(mysql_field_len); + return f_mysql_field_len(result, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_field_type f_mysql_field_type +#else +inline Variant x_mysql_field_type(CVarRef result, int field = 0) { + FUNCTION_INJECTION(mysql_field_type); + return f_mysql_field_type(result, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_mysql_field_flags f_mysql_field_flags +#else +inline Variant x_mysql_field_flags(CVarRef result, int field = 0) { + FUNCTION_INJECTION(mysql_field_flags); + return f_mysql_field_flags(result, field); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_MYSQL_H__ diff --git a/src/cpp/ext/profile/extprofile_network.h b/src/cpp/ext/profile/extprofile_network.h new file mode 100644 index 0000000000000..97be630a2d12e --- /dev/null +++ b/src/cpp/ext/profile/extprofile_network.h @@ -0,0 +1,302 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_NETWORK_H__ +#define __EXTPROFILE_NETWORK_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_gethostbyaddr f_gethostbyaddr +#else +inline Variant x_gethostbyaddr(CStrRef ip_address) { + FUNCTION_INJECTION(gethostbyaddr); + return f_gethostbyaddr(ip_address); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gethostbyname f_gethostbyname +#else +inline String x_gethostbyname(CStrRef hostname) { + FUNCTION_INJECTION(gethostbyname); + return f_gethostbyname(hostname); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gethostbynamel f_gethostbynamel +#else +inline Variant x_gethostbynamel(CStrRef hostname) { + FUNCTION_INJECTION(gethostbynamel); + return f_gethostbynamel(hostname); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getprotobyname f_getprotobyname +#else +inline Variant x_getprotobyname(CStrRef name) { + FUNCTION_INJECTION(getprotobyname); + return f_getprotobyname(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getprotobynumber f_getprotobynumber +#else +inline Variant x_getprotobynumber(int number) { + FUNCTION_INJECTION(getprotobynumber); + return f_getprotobynumber(number); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getservbyname f_getservbyname +#else +inline Variant x_getservbyname(CStrRef service, CStrRef protocol) { + FUNCTION_INJECTION(getservbyname); + return f_getservbyname(service, protocol); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getservbyport f_getservbyport +#else +inline Variant x_getservbyport(int port, CStrRef protocol) { + FUNCTION_INJECTION(getservbyport); + return f_getservbyport(port, protocol); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_inet_ntop f_inet_ntop +#else +inline Variant x_inet_ntop(CStrRef in_addr) { + FUNCTION_INJECTION(inet_ntop); + return f_inet_ntop(in_addr); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_inet_pton f_inet_pton +#else +inline Variant x_inet_pton(CStrRef address) { + FUNCTION_INJECTION(inet_pton); + return f_inet_pton(address); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ip2long f_ip2long +#else +inline Variant x_ip2long(CStrRef ip_address) { + FUNCTION_INJECTION(ip2long); + return f_ip2long(ip_address); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_long2ip f_long2ip +#else +inline String x_long2ip(int proper_address) { + FUNCTION_INJECTION(long2ip); + return f_long2ip(proper_address); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_dns_check_record f_dns_check_record +#else +inline bool x_dns_check_record(CStrRef host, CStrRef type = null_string) { + FUNCTION_INJECTION(dns_check_record); + return f_dns_check_record(host, type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_checkdnsrr f_checkdnsrr +#else +inline bool x_checkdnsrr(CStrRef host, CStrRef type = null_string) { + FUNCTION_INJECTION(checkdnsrr); + return f_checkdnsrr(host, type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_dns_get_record f_dns_get_record +#else +inline Variant x_dns_get_record(CStrRef hostname, int type = -1, Variant authns = null, Variant addtl = null) { + FUNCTION_INJECTION(dns_get_record); + return f_dns_get_record(hostname, type, ref(authns), ref(addtl)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_dns_get_mx f_dns_get_mx +#else +inline bool x_dns_get_mx(CStrRef hostname, Variant mxhosts, Variant weights = null) { + FUNCTION_INJECTION(dns_get_mx); + return f_dns_get_mx(hostname, ref(mxhosts), ref(weights)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getmxrr f_getmxrr +#else +inline bool x_getmxrr(CStrRef hostname, Variant mxhosts, Variant weight = null) { + FUNCTION_INJECTION(getmxrr); + return f_getmxrr(hostname, ref(mxhosts), ref(weight)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_fsockopen f_fsockopen +#else +inline Variant x_fsockopen(CStrRef hostname, int port = -1, Variant errnum = null, Variant errstr = null, double timeout = 0.0) { + FUNCTION_INJECTION(fsockopen); + return f_fsockopen(hostname, port, ref(errnum), ref(errstr), timeout); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pfsockopen f_pfsockopen +#else +inline Variant x_pfsockopen(CStrRef hostname, int port = -1, Variant errnum = null, Variant errstr = null, double timeout = 0.0) { + FUNCTION_INJECTION(pfsockopen); + return f_pfsockopen(hostname, port, ref(errnum), ref(errstr), timeout); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_get_status f_socket_get_status +#else +inline Array x_socket_get_status(CObjRef stream) { + FUNCTION_INJECTION(socket_get_status); + return f_socket_get_status(stream); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_set_blocking f_socket_set_blocking +#else +inline bool x_socket_set_blocking(CObjRef stream, int mode) { + FUNCTION_INJECTION(socket_set_blocking); + return f_socket_set_blocking(stream, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_set_timeout f_socket_set_timeout +#else +inline bool x_socket_set_timeout(CObjRef stream, int seconds, int microseconds = 0) { + FUNCTION_INJECTION(socket_set_timeout); + return f_socket_set_timeout(stream, seconds, microseconds); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_header f_header +#else +inline void x_header(CStrRef str, bool replace = true, int http_response_code = 0) { + FUNCTION_INJECTION(header); + f_header(str, replace, http_response_code); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_headers_list f_headers_list +#else +inline Array x_headers_list() { + FUNCTION_INJECTION(headers_list); + return f_headers_list(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_headers_sent f_headers_sent +#else +inline bool x_headers_sent(Variant file = null, Variant line = null) { + FUNCTION_INJECTION(headers_sent); + return f_headers_sent(ref(file), ref(line)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_setcookie f_setcookie +#else +inline bool x_setcookie(CStrRef name, CStrRef value = null_string, int expire = 0, CStrRef path = null_string, CStrRef domain = null_string, bool secure = false, bool httponly = false) { + FUNCTION_INJECTION(setcookie); + return f_setcookie(name, value, expire, path, domain, secure, httponly); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_setrawcookie f_setrawcookie +#else +inline bool x_setrawcookie(CStrRef name, CStrRef value = null_string, int expire = 0, CStrRef path = null_string, CStrRef domain = null_string, bool secure = false, bool httponly = false) { + FUNCTION_INJECTION(setrawcookie); + return f_setrawcookie(name, value, expire, path, domain, secure, httponly); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_define_syslog_variables f_define_syslog_variables +#else +inline void x_define_syslog_variables() { + FUNCTION_INJECTION(define_syslog_variables); + f_define_syslog_variables(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openlog f_openlog +#else +inline void x_openlog(CStrRef ident, int option, int facility) { + FUNCTION_INJECTION(openlog); + f_openlog(ident, option, facility); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_closelog f_closelog +#else +inline void x_closelog() { + FUNCTION_INJECTION(closelog); + f_closelog(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_syslog f_syslog +#else +inline void x_syslog(int priority, CStrRef message) { + FUNCTION_INJECTION(syslog); + f_syslog(priority, message); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_NETWORK_H__ diff --git a/src/cpp/ext/profile/extprofile_openssl.h b/src/cpp/ext/profile/extprofile_openssl.h new file mode 100644 index 0000000000000..722ae436bb687 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_openssl.h @@ -0,0 +1,383 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_OPENSSL_H__ +#define __EXTPROFILE_OPENSSL_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_openssl_csr_export_to_file f_openssl_csr_export_to_file +#else +inline bool x_openssl_csr_export_to_file(CVarRef csr, CStrRef outfilename, bool notext = true) { + FUNCTION_INJECTION(openssl_csr_export_to_file); + return f_openssl_csr_export_to_file(csr, outfilename, notext); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_csr_export f_openssl_csr_export +#else +inline bool x_openssl_csr_export(CVarRef csr, Variant out, bool notext = true) { + FUNCTION_INJECTION(openssl_csr_export); + return f_openssl_csr_export(csr, ref(out), notext); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_csr_get_public_key f_openssl_csr_get_public_key +#else +inline Variant x_openssl_csr_get_public_key(CVarRef csr) { + FUNCTION_INJECTION(openssl_csr_get_public_key); + return f_openssl_csr_get_public_key(csr); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_csr_get_subject f_openssl_csr_get_subject +#else +inline Variant x_openssl_csr_get_subject(CVarRef csr, bool use_shortnames = true) { + FUNCTION_INJECTION(openssl_csr_get_subject); + return f_openssl_csr_get_subject(csr, use_shortnames); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_csr_new f_openssl_csr_new +#else +inline Variant x_openssl_csr_new(CArrRef dn, Variant privkey, CVarRef configargs = null_variant, CVarRef extraattribs = null_variant) { + FUNCTION_INJECTION(openssl_csr_new); + return f_openssl_csr_new(dn, ref(privkey), configargs, extraattribs); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_csr_sign f_openssl_csr_sign +#else +inline Variant x_openssl_csr_sign(CVarRef csr, CVarRef cacert, CVarRef priv_key, int days, CVarRef configargs = null_variant, int serial = 0) { + FUNCTION_INJECTION(openssl_csr_sign); + return f_openssl_csr_sign(csr, cacert, priv_key, days, configargs, serial); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_error_string f_openssl_error_string +#else +inline Variant x_openssl_error_string() { + FUNCTION_INJECTION(openssl_error_string); + return f_openssl_error_string(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_open f_openssl_open +#else +inline bool x_openssl_open(CStrRef sealed_data, Variant open_data, CStrRef env_key, CVarRef priv_key_id) { + FUNCTION_INJECTION(openssl_open); + return f_openssl_open(sealed_data, ref(open_data), env_key, priv_key_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkcs12_export_to_file f_openssl_pkcs12_export_to_file +#else +inline bool x_openssl_pkcs12_export_to_file(CVarRef x509, CStrRef filename, CVarRef priv_key, CStrRef pass, CVarRef args = null_variant) { + FUNCTION_INJECTION(openssl_pkcs12_export_to_file); + return f_openssl_pkcs12_export_to_file(x509, filename, priv_key, pass, args); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkcs12_export f_openssl_pkcs12_export +#else +inline bool x_openssl_pkcs12_export(CVarRef x509, Variant out, CVarRef priv_key, CStrRef pass, CVarRef args = null_variant) { + FUNCTION_INJECTION(openssl_pkcs12_export); + return f_openssl_pkcs12_export(x509, ref(out), priv_key, pass, args); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkcs12_read f_openssl_pkcs12_read +#else +inline bool x_openssl_pkcs12_read(CStrRef pkcs12, Variant certs, CStrRef pass) { + FUNCTION_INJECTION(openssl_pkcs12_read); + return f_openssl_pkcs12_read(pkcs12, ref(certs), pass); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkcs7_decrypt f_openssl_pkcs7_decrypt +#else +inline bool x_openssl_pkcs7_decrypt(CStrRef infilename, CStrRef outfilename, CVarRef recipcert, CVarRef recipkey = null_variant) { + FUNCTION_INJECTION(openssl_pkcs7_decrypt); + return f_openssl_pkcs7_decrypt(infilename, outfilename, recipcert, recipkey); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkcs7_encrypt f_openssl_pkcs7_encrypt +#else +inline bool x_openssl_pkcs7_encrypt(CStrRef infilename, CStrRef outfilename, CVarRef recipcerts, CArrRef headers, int flags = 0, int cipherid = k_OPENSSL_CIPHER_RC2_40) { + FUNCTION_INJECTION(openssl_pkcs7_encrypt); + return f_openssl_pkcs7_encrypt(infilename, outfilename, recipcerts, headers, flags, cipherid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkcs7_sign f_openssl_pkcs7_sign +#else +inline bool x_openssl_pkcs7_sign(CStrRef infilename, CStrRef outfilename, CVarRef signcert, CVarRef privkey, CVarRef headers, int flags = k_PKCS7_DETACHED, CStrRef extracerts = null_string) { + FUNCTION_INJECTION(openssl_pkcs7_sign); + return f_openssl_pkcs7_sign(infilename, outfilename, signcert, privkey, headers, flags, extracerts); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkcs7_verify f_openssl_pkcs7_verify +#else +inline Variant x_openssl_pkcs7_verify(CStrRef filename, int flags, CStrRef outfilename = null_string, CArrRef cainfo = null_array, CStrRef extracerts = null_string, CStrRef content = null_string) { + FUNCTION_INJECTION(openssl_pkcs7_verify); + return f_openssl_pkcs7_verify(filename, flags, outfilename, cainfo, extracerts, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkey_export_to_file f_openssl_pkey_export_to_file +#else +inline bool x_openssl_pkey_export_to_file(CVarRef key, CStrRef outfilename, CStrRef passphrase = null_string, CVarRef configargs = null_variant) { + FUNCTION_INJECTION(openssl_pkey_export_to_file); + return f_openssl_pkey_export_to_file(key, outfilename, passphrase, configargs); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkey_export f_openssl_pkey_export +#else +inline bool x_openssl_pkey_export(CVarRef key, Variant out, CStrRef passphrase = null_string, CVarRef configargs = null_variant) { + FUNCTION_INJECTION(openssl_pkey_export); + return f_openssl_pkey_export(key, ref(out), passphrase, configargs); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkey_free f_openssl_pkey_free +#else +inline void x_openssl_pkey_free(CObjRef key) { + FUNCTION_INJECTION(openssl_pkey_free); + f_openssl_pkey_free(key); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_free_key f_openssl_free_key +#else +inline void x_openssl_free_key(CObjRef key) { + FUNCTION_INJECTION(openssl_free_key); + f_openssl_free_key(key); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkey_get_details f_openssl_pkey_get_details +#else +inline Array x_openssl_pkey_get_details(CObjRef key) { + FUNCTION_INJECTION(openssl_pkey_get_details); + return f_openssl_pkey_get_details(key); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkey_get_private f_openssl_pkey_get_private +#else +inline Variant x_openssl_pkey_get_private(CVarRef key, CStrRef passphrase = null_string) { + FUNCTION_INJECTION(openssl_pkey_get_private); + return f_openssl_pkey_get_private(key, passphrase); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_get_privatekey f_openssl_get_privatekey +#else +inline Variant x_openssl_get_privatekey(CVarRef key, CStrRef passphrase = null_string) { + FUNCTION_INJECTION(openssl_get_privatekey); + return f_openssl_get_privatekey(key, passphrase); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkey_get_public f_openssl_pkey_get_public +#else +inline Variant x_openssl_pkey_get_public(CVarRef certificate) { + FUNCTION_INJECTION(openssl_pkey_get_public); + return f_openssl_pkey_get_public(certificate); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_get_publickey f_openssl_get_publickey +#else +inline Variant x_openssl_get_publickey(CVarRef certificate) { + FUNCTION_INJECTION(openssl_get_publickey); + return f_openssl_get_publickey(certificate); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_pkey_new f_openssl_pkey_new +#else +inline Object x_openssl_pkey_new(CVarRef configargs = null_variant) { + FUNCTION_INJECTION(openssl_pkey_new); + return f_openssl_pkey_new(configargs); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_private_decrypt f_openssl_private_decrypt +#else +inline bool x_openssl_private_decrypt(CStrRef data, Variant decrypted, CVarRef key, int padding = k_OPENSSL_PKCS1_PADDING) { + FUNCTION_INJECTION(openssl_private_decrypt); + return f_openssl_private_decrypt(data, ref(decrypted), key, padding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_private_encrypt f_openssl_private_encrypt +#else +inline bool x_openssl_private_encrypt(CStrRef data, Variant crypted, CVarRef key, int padding = k_OPENSSL_PKCS1_PADDING) { + FUNCTION_INJECTION(openssl_private_encrypt); + return f_openssl_private_encrypt(data, ref(crypted), key, padding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_public_decrypt f_openssl_public_decrypt +#else +inline bool x_openssl_public_decrypt(CStrRef data, Variant decrypted, CVarRef key, int padding = k_OPENSSL_PKCS1_PADDING) { + FUNCTION_INJECTION(openssl_public_decrypt); + return f_openssl_public_decrypt(data, ref(decrypted), key, padding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_public_encrypt f_openssl_public_encrypt +#else +inline bool x_openssl_public_encrypt(CStrRef data, Variant crypted, CVarRef key, int padding = k_OPENSSL_PKCS1_PADDING) { + FUNCTION_INJECTION(openssl_public_encrypt); + return f_openssl_public_encrypt(data, ref(crypted), key, padding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_seal f_openssl_seal +#else +inline Variant x_openssl_seal(CStrRef data, Variant sealed_data, Variant env_keys, CArrRef pub_key_ids) { + FUNCTION_INJECTION(openssl_seal); + return f_openssl_seal(data, ref(sealed_data), ref(env_keys), pub_key_ids); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_sign f_openssl_sign +#else +inline bool x_openssl_sign(CStrRef data, Variant signature, CVarRef priv_key_id, int signature_alg = k_OPENSSL_ALGO_SHA1) { + FUNCTION_INJECTION(openssl_sign); + return f_openssl_sign(data, ref(signature), priv_key_id, signature_alg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_verify f_openssl_verify +#else +inline Variant x_openssl_verify(CStrRef data, CStrRef signature, CVarRef pub_key_id, int signature_alg = k_OPENSSL_ALGO_SHA1) { + FUNCTION_INJECTION(openssl_verify); + return f_openssl_verify(data, signature, pub_key_id, signature_alg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_x509_check_private_key f_openssl_x509_check_private_key +#else +inline bool x_openssl_x509_check_private_key(CVarRef cert, CVarRef key) { + FUNCTION_INJECTION(openssl_x509_check_private_key); + return f_openssl_x509_check_private_key(cert, key); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_x509_checkpurpose f_openssl_x509_checkpurpose +#else +inline int x_openssl_x509_checkpurpose(CVarRef x509cert, int purpose, CArrRef cainfo = null_array, CStrRef untrustedfile = null_string) { + FUNCTION_INJECTION(openssl_x509_checkpurpose); + return f_openssl_x509_checkpurpose(x509cert, purpose, cainfo, untrustedfile); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_x509_export_to_file f_openssl_x509_export_to_file +#else +inline bool x_openssl_x509_export_to_file(CVarRef x509, CStrRef outfilename, bool notext = true) { + FUNCTION_INJECTION(openssl_x509_export_to_file); + return f_openssl_x509_export_to_file(x509, outfilename, notext); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_x509_export f_openssl_x509_export +#else +inline bool x_openssl_x509_export(CVarRef x509, Variant output, bool notext = true) { + FUNCTION_INJECTION(openssl_x509_export); + return f_openssl_x509_export(x509, ref(output), notext); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_x509_free f_openssl_x509_free +#else +inline void x_openssl_x509_free(CObjRef x509cert) { + FUNCTION_INJECTION(openssl_x509_free); + f_openssl_x509_free(x509cert); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_x509_parse f_openssl_x509_parse +#else +inline Variant x_openssl_x509_parse(CVarRef x509cert, bool shortnames = true) { + FUNCTION_INJECTION(openssl_x509_parse); + return f_openssl_x509_parse(x509cert, shortnames); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_openssl_x509_read f_openssl_x509_read +#else +inline Variant x_openssl_x509_read(CVarRef x509certdata) { + FUNCTION_INJECTION(openssl_x509_read); + return f_openssl_x509_read(x509certdata); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_OPENSSL_H__ diff --git a/src/cpp/ext/profile/extprofile_options.h b/src/cpp/ext/profile/extprofile_options.h new file mode 100644 index 0000000000000..352d382196d85 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_options.h @@ -0,0 +1,473 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_OPTIONS_H__ +#define __EXTPROFILE_OPTIONS_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_assert_options f_assert_options +#else +inline Variant x_assert_options(int what, CVarRef value = null_variant) { + FUNCTION_INJECTION(assert_options); + return f_assert_options(what, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_assert f_assert +#else +inline Variant x_assert(CVarRef assertion) { + FUNCTION_INJECTION(assert); + return f_assert(assertion); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_dl f_dl +#else +inline int x_dl(CStrRef library) { + FUNCTION_INJECTION(dl); + return f_dl(library); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_extension_loaded f_extension_loaded +#else +inline bool x_extension_loaded(CStrRef name) { + FUNCTION_INJECTION(extension_loaded); + return f_extension_loaded(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_loaded_extensions f_get_loaded_extensions +#else +inline Array x_get_loaded_extensions(bool zend_extensions = false) { + FUNCTION_INJECTION(get_loaded_extensions); + return f_get_loaded_extensions(zend_extensions); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_extension_funcs f_get_extension_funcs +#else +inline Array x_get_extension_funcs(CStrRef module_name) { + FUNCTION_INJECTION(get_extension_funcs); + return f_get_extension_funcs(module_name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_cfg_var f_get_cfg_var +#else +inline String x_get_cfg_var(CStrRef option) { + FUNCTION_INJECTION(get_cfg_var); + return f_get_cfg_var(option); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_current_user f_get_current_user +#else +inline String x_get_current_user() { + FUNCTION_INJECTION(get_current_user); + return f_get_current_user(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_defined_constants f_get_defined_constants +#else +inline Array x_get_defined_constants(CVarRef categorize = null_variant) { + FUNCTION_INJECTION(get_defined_constants); + return f_get_defined_constants(categorize); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_include_path f_get_include_path +#else +inline String x_get_include_path() { + FUNCTION_INJECTION(get_include_path); + return f_get_include_path(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_restore_include_path f_restore_include_path +#else +inline void x_restore_include_path() { + FUNCTION_INJECTION(restore_include_path); + f_restore_include_path(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_set_include_path f_set_include_path +#else +inline String x_set_include_path(CStrRef new_include_path) { + FUNCTION_INJECTION(set_include_path); + return f_set_include_path(new_include_path); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_included_files f_get_included_files +#else +inline Array x_get_included_files() { + FUNCTION_INJECTION(get_included_files); + return f_get_included_files(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_magic_quotes_gpc f_get_magic_quotes_gpc +#else +inline int x_get_magic_quotes_gpc() { + FUNCTION_INJECTION(get_magic_quotes_gpc); + return f_get_magic_quotes_gpc(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_magic_quotes_runtime f_get_magic_quotes_runtime +#else +inline int x_get_magic_quotes_runtime() { + FUNCTION_INJECTION(get_magic_quotes_runtime); + return f_get_magic_quotes_runtime(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_required_files f_get_required_files +#else +inline Array x_get_required_files() { + FUNCTION_INJECTION(get_required_files); + return f_get_required_files(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getenv f_getenv +#else +inline Variant x_getenv(CStrRef varname) { + FUNCTION_INJECTION(getenv); + return f_getenv(varname); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getlastmod f_getlastmod +#else +inline int x_getlastmod() { + FUNCTION_INJECTION(getlastmod); + return f_getlastmod(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getmygid f_getmygid +#else +inline int x_getmygid() { + FUNCTION_INJECTION(getmygid); + return f_getmygid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getmyinode f_getmyinode +#else +inline int x_getmyinode() { + FUNCTION_INJECTION(getmyinode); + return f_getmyinode(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getmypid f_getmypid +#else +inline int x_getmypid() { + FUNCTION_INJECTION(getmypid); + return f_getmypid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getmyuid f_getmyuid +#else +inline int x_getmyuid() { + FUNCTION_INJECTION(getmyuid); + return f_getmyuid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getopt f_getopt +#else +inline Array x_getopt(CStrRef options, CVarRef longopts = null_variant) { + FUNCTION_INJECTION(getopt); + return f_getopt(options, longopts); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_getrusage f_getrusage +#else +inline Array x_getrusage(int who = 0) { + FUNCTION_INJECTION(getrusage); + return f_getrusage(who); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_clock_getres f_clock_getres +#else +inline bool x_clock_getres(int clk_id, Variant sec, Variant nsec) { + FUNCTION_INJECTION(clock_getres); + return f_clock_getres(clk_id, ref(sec), ref(nsec)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_clock_gettime f_clock_gettime +#else +inline bool x_clock_gettime(int clk_id, Variant sec, Variant nsec) { + FUNCTION_INJECTION(clock_gettime); + return f_clock_gettime(clk_id, ref(sec), ref(nsec)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_clock_settime f_clock_settime +#else +inline bool x_clock_settime(int clk_id, int64 sec, int64 nsec) { + FUNCTION_INJECTION(clock_settime); + return f_clock_settime(clk_id, sec, nsec); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ini_alter f_ini_alter +#else +inline String x_ini_alter(CStrRef varname, CStrRef newvalue) { + FUNCTION_INJECTION(ini_alter); + return f_ini_alter(varname, newvalue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ini_get_all f_ini_get_all +#else +inline Array x_ini_get_all(CStrRef extension = null_string) { + FUNCTION_INJECTION(ini_get_all); + return f_ini_get_all(extension); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ini_get f_ini_get +#else +inline String x_ini_get(CStrRef varname) { + FUNCTION_INJECTION(ini_get); + return f_ini_get(varname); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ini_restore f_ini_restore +#else +inline void x_ini_restore(CStrRef varname) { + FUNCTION_INJECTION(ini_restore); + f_ini_restore(varname); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ini_set f_ini_set +#else +inline String x_ini_set(CStrRef varname, CStrRef newvalue) { + FUNCTION_INJECTION(ini_set); + return f_ini_set(varname, newvalue); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_memory_get_peak_usage f_memory_get_peak_usage +#else +inline int64 x_memory_get_peak_usage(bool real_usage = false) { + FUNCTION_INJECTION(memory_get_peak_usage); + return f_memory_get_peak_usage(real_usage); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_memory_get_usage f_memory_get_usage +#else +inline int64 x_memory_get_usage(bool real_usage = false) { + FUNCTION_INJECTION(memory_get_usage); + return f_memory_get_usage(real_usage); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_php_ini_scanned_files f_php_ini_scanned_files +#else +inline String x_php_ini_scanned_files() { + FUNCTION_INJECTION(php_ini_scanned_files); + return f_php_ini_scanned_files(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_php_logo_guid f_php_logo_guid +#else +inline String x_php_logo_guid() { + FUNCTION_INJECTION(php_logo_guid); + return f_php_logo_guid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_php_sapi_name f_php_sapi_name +#else +inline String x_php_sapi_name() { + FUNCTION_INJECTION(php_sapi_name); + return f_php_sapi_name(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_php_uname f_php_uname +#else +inline String x_php_uname(CStrRef mode = null_string) { + FUNCTION_INJECTION(php_uname); + return f_php_uname(mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_phpcredits f_phpcredits +#else +inline bool x_phpcredits(int flag = 0) { + FUNCTION_INJECTION(phpcredits); + return f_phpcredits(flag); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_phpinfo f_phpinfo +#else +inline bool x_phpinfo(int what = 0) { + FUNCTION_INJECTION(phpinfo); + return f_phpinfo(what); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_phpversion f_phpversion +#else +inline String x_phpversion(CStrRef extension = null_string) { + FUNCTION_INJECTION(phpversion); + return f_phpversion(extension); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_putenv f_putenv +#else +inline bool x_putenv(CStrRef setting) { + FUNCTION_INJECTION(putenv); + return f_putenv(setting); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_set_magic_quotes_runtime f_set_magic_quotes_runtime +#else +inline bool x_set_magic_quotes_runtime(bool new_setting) { + FUNCTION_INJECTION(set_magic_quotes_runtime); + return f_set_magic_quotes_runtime(new_setting); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_set_time_limit f_set_time_limit +#else +inline void x_set_time_limit(int seconds) { + FUNCTION_INJECTION(set_time_limit); + f_set_time_limit(seconds); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sys_get_temp_dir f_sys_get_temp_dir +#else +inline String x_sys_get_temp_dir() { + FUNCTION_INJECTION(sys_get_temp_dir); + return f_sys_get_temp_dir(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_version_compare f_version_compare +#else +inline Variant x_version_compare(CStrRef version1, CStrRef version2, CStrRef sop = null_string) { + FUNCTION_INJECTION(version_compare); + return f_version_compare(version1, version2, sop); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_zend_logo_guid f_zend_logo_guid +#else +inline String x_zend_logo_guid() { + FUNCTION_INJECTION(zend_logo_guid); + return f_zend_logo_guid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_zend_thread_id f_zend_thread_id +#else +inline int x_zend_thread_id() { + FUNCTION_INJECTION(zend_thread_id); + return f_zend_thread_id(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_zend_version f_zend_version +#else +inline String x_zend_version() { + FUNCTION_INJECTION(zend_version); + return f_zend_version(); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_OPTIONS_H__ diff --git a/src/cpp/ext/profile/extprofile_oracle.h b/src/cpp/ext/profile/extprofile_oracle.h new file mode 100644 index 0000000000000..5498c959a4ca9 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_oracle.h @@ -0,0 +1,374 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_ORACLE_H__ +#define __EXTPROFILE_ORACLE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_oci_connect f_oci_connect +#else +inline Object x_oci_connect(CStrRef username, CStrRef password, CStrRef db = null_string, CStrRef charset = null_string, int session_mode = 0) { + FUNCTION_INJECTION(oci_connect); + return f_oci_connect(username, password, db, charset, session_mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_new_connect f_oci_new_connect +#else +inline Object x_oci_new_connect(CStrRef username, CStrRef password, CStrRef db = null_string, CStrRef charset = null_string, int session_mode = 0) { + FUNCTION_INJECTION(oci_new_connect); + return f_oci_new_connect(username, password, db, charset, session_mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_pconnect f_oci_pconnect +#else +inline Object x_oci_pconnect(CStrRef username, CStrRef password, CStrRef db = null_string, CStrRef charset = null_string, int session_mode = 0) { + FUNCTION_INJECTION(oci_pconnect); + return f_oci_pconnect(username, password, db, charset, session_mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_server_version f_oci_server_version +#else +inline String x_oci_server_version(CObjRef connection) { + FUNCTION_INJECTION(oci_server_version); + return f_oci_server_version(connection); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_password_change f_oci_password_change +#else +inline Variant x_oci_password_change(CVarRef connection, CStrRef username, CStrRef old_password, CStrRef new_password) { + FUNCTION_INJECTION(oci_password_change); + return f_oci_password_change(connection, username, old_password, new_password); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_new_cursor f_oci_new_cursor +#else +inline Object x_oci_new_cursor(CObjRef connection) { + FUNCTION_INJECTION(oci_new_cursor); + return f_oci_new_cursor(connection); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_new_descriptor f_oci_new_descriptor +#else +inline Object x_oci_new_descriptor(CObjRef connection, int type = 0) { + FUNCTION_INJECTION(oci_new_descriptor); + return f_oci_new_descriptor(connection, type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_close f_oci_close +#else +inline bool x_oci_close(CObjRef connection) { + FUNCTION_INJECTION(oci_close); + return f_oci_close(connection); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_commit f_oci_commit +#else +inline bool x_oci_commit(CObjRef connection) { + FUNCTION_INJECTION(oci_commit); + return f_oci_commit(connection); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_rollback f_oci_rollback +#else +inline bool x_oci_rollback(CObjRef connection) { + FUNCTION_INJECTION(oci_rollback); + return f_oci_rollback(connection); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_error f_oci_error +#else +inline Array x_oci_error(CObjRef source = null) { + FUNCTION_INJECTION(oci_error); + return f_oci_error(source); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_internal_debug f_oci_internal_debug +#else +inline void x_oci_internal_debug(bool onoff) { + FUNCTION_INJECTION(oci_internal_debug); + f_oci_internal_debug(onoff); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_parse f_oci_parse +#else +inline Object x_oci_parse(CObjRef connection, CStrRef query) { + FUNCTION_INJECTION(oci_parse); + return f_oci_parse(connection, query); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_statement_type f_oci_statement_type +#else +inline String x_oci_statement_type(CObjRef statement) { + FUNCTION_INJECTION(oci_statement_type); + return f_oci_statement_type(statement); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_free_statement f_oci_free_statement +#else +inline bool x_oci_free_statement(CObjRef statement) { + FUNCTION_INJECTION(oci_free_statement); + return f_oci_free_statement(statement); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_free_descriptor f_oci_free_descriptor +#else +inline bool x_oci_free_descriptor(CObjRef lob) { + FUNCTION_INJECTION(oci_free_descriptor); + return f_oci_free_descriptor(lob); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_bind_array_by_name f_oci_bind_array_by_name +#else +inline bool x_oci_bind_array_by_name(CObjRef statement, CStrRef name, Variant var_array, int max_table_length, int max_item_length = 0, int type = 0) { + FUNCTION_INJECTION(oci_bind_array_by_name); + return f_oci_bind_array_by_name(statement, name, ref(var_array), max_table_length, max_item_length, type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_bind_by_name f_oci_bind_by_name +#else +inline bool x_oci_bind_by_name(CObjRef statement, CStrRef ph_name, Variant variable, int max_length = 0, int type = 0) { + FUNCTION_INJECTION(oci_bind_by_name); + return f_oci_bind_by_name(statement, ph_name, ref(variable), max_length, type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_cancel f_oci_cancel +#else +inline bool x_oci_cancel(CObjRef statement) { + FUNCTION_INJECTION(oci_cancel); + return f_oci_cancel(statement); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_define_by_name f_oci_define_by_name +#else +inline bool x_oci_define_by_name(CObjRef statement, CStrRef column_name, Variant variable, int type = 0) { + FUNCTION_INJECTION(oci_define_by_name); + return f_oci_define_by_name(statement, column_name, ref(variable), type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_execute f_oci_execute +#else +inline bool x_oci_execute(CObjRef statement, int mode = 0) { + FUNCTION_INJECTION(oci_execute); + return f_oci_execute(statement, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_num_fields f_oci_num_fields +#else +inline int x_oci_num_fields(CObjRef statement) { + FUNCTION_INJECTION(oci_num_fields); + return f_oci_num_fields(statement); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_num_rows f_oci_num_rows +#else +inline int x_oci_num_rows(CObjRef statement) { + FUNCTION_INJECTION(oci_num_rows); + return f_oci_num_rows(statement); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_result f_oci_result +#else +inline Variant x_oci_result(CObjRef statement, CVarRef field) { + FUNCTION_INJECTION(oci_result); + return f_oci_result(statement, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_set_prefetch f_oci_set_prefetch +#else +inline bool x_oci_set_prefetch(CObjRef statement, int rows) { + FUNCTION_INJECTION(oci_set_prefetch); + return f_oci_set_prefetch(statement, rows); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_fetch_all f_oci_fetch_all +#else +inline int x_oci_fetch_all(CObjRef statement, Variant output, int skip = 0, int maxrows = 0, int flags = 0) { + FUNCTION_INJECTION(oci_fetch_all); + return f_oci_fetch_all(statement, ref(output), skip, maxrows, flags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_fetch_array f_oci_fetch_array +#else +inline Variant x_oci_fetch_array(CObjRef statement, int mode = 0) { + FUNCTION_INJECTION(oci_fetch_array); + return f_oci_fetch_array(statement, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_fetch_assoc f_oci_fetch_assoc +#else +inline Variant x_oci_fetch_assoc(CObjRef statement) { + FUNCTION_INJECTION(oci_fetch_assoc); + return f_oci_fetch_assoc(statement); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_fetch_object f_oci_fetch_object +#else +inline Variant x_oci_fetch_object(CObjRef statement) { + FUNCTION_INJECTION(oci_fetch_object); + return f_oci_fetch_object(statement); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_fetch_row f_oci_fetch_row +#else +inline Variant x_oci_fetch_row(CObjRef statement) { + FUNCTION_INJECTION(oci_fetch_row); + return f_oci_fetch_row(statement); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_fetch f_oci_fetch +#else +inline bool x_oci_fetch(CObjRef statement) { + FUNCTION_INJECTION(oci_fetch); + return f_oci_fetch(statement); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_field_is_null f_oci_field_is_null +#else +inline bool x_oci_field_is_null(CObjRef statement, CVarRef field) { + FUNCTION_INJECTION(oci_field_is_null); + return f_oci_field_is_null(statement, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_field_name f_oci_field_name +#else +inline String x_oci_field_name(CObjRef statement, int field) { + FUNCTION_INJECTION(oci_field_name); + return f_oci_field_name(statement, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_field_precision f_oci_field_precision +#else +inline int x_oci_field_precision(CObjRef statement, int field) { + FUNCTION_INJECTION(oci_field_precision); + return f_oci_field_precision(statement, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_field_scale f_oci_field_scale +#else +inline int x_oci_field_scale(CObjRef statement, int field) { + FUNCTION_INJECTION(oci_field_scale); + return f_oci_field_scale(statement, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_field_size f_oci_field_size +#else +inline int x_oci_field_size(CObjRef statement, CVarRef field) { + FUNCTION_INJECTION(oci_field_size); + return f_oci_field_size(statement, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_field_type_raw f_oci_field_type_raw +#else +inline int x_oci_field_type_raw(CObjRef statement, int field) { + FUNCTION_INJECTION(oci_field_type_raw); + return f_oci_field_type_raw(statement, field); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_oci_field_type f_oci_field_type +#else +inline Variant x_oci_field_type(CObjRef statement, int field) { + FUNCTION_INJECTION(oci_field_type); + return f_oci_field_type(statement, field); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_ORACLE_H__ diff --git a/src/cpp/ext/profile/extprofile_output.h b/src/cpp/ext/profile/extprofile_output.h new file mode 100644 index 0000000000000..a032b3a370cd4 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_output.h @@ -0,0 +1,221 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_OUTPUT_H__ +#define __EXTPROFILE_OUTPUT_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_ob_start f_ob_start +#else +inline bool x_ob_start(CVarRef output_callback = null, int chunk_size = 0, bool erase = true) { + FUNCTION_INJECTION(ob_start); + return f_ob_start(output_callback, chunk_size, erase); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_clean f_ob_clean +#else +inline void x_ob_clean() { + FUNCTION_INJECTION(ob_clean); + f_ob_clean(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_flush f_ob_flush +#else +inline void x_ob_flush() { + FUNCTION_INJECTION(ob_flush); + f_ob_flush(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_end_clean f_ob_end_clean +#else +inline bool x_ob_end_clean() { + FUNCTION_INJECTION(ob_end_clean); + return f_ob_end_clean(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_end_flush f_ob_end_flush +#else +inline bool x_ob_end_flush() { + FUNCTION_INJECTION(ob_end_flush); + return f_ob_end_flush(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_flush f_flush +#else +inline void x_flush() { + FUNCTION_INJECTION(flush); + f_flush(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_get_clean f_ob_get_clean +#else +inline String x_ob_get_clean() { + FUNCTION_INJECTION(ob_get_clean); + return f_ob_get_clean(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_get_contents f_ob_get_contents +#else +inline String x_ob_get_contents() { + FUNCTION_INJECTION(ob_get_contents); + return f_ob_get_contents(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_get_flush f_ob_get_flush +#else +inline String x_ob_get_flush() { + FUNCTION_INJECTION(ob_get_flush); + return f_ob_get_flush(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_get_length f_ob_get_length +#else +inline int x_ob_get_length() { + FUNCTION_INJECTION(ob_get_length); + return f_ob_get_length(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_get_level f_ob_get_level +#else +inline int x_ob_get_level() { + FUNCTION_INJECTION(ob_get_level); + return f_ob_get_level(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_get_status f_ob_get_status +#else +inline Array x_ob_get_status(bool full_status = false) { + FUNCTION_INJECTION(ob_get_status); + return f_ob_get_status(full_status); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_gzhandler f_ob_gzhandler +#else +inline String x_ob_gzhandler(CStrRef buffer, int mode) { + FUNCTION_INJECTION(ob_gzhandler); + return f_ob_gzhandler(buffer, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_implicit_flush f_ob_implicit_flush +#else +inline void x_ob_implicit_flush(bool flag = true) { + FUNCTION_INJECTION(ob_implicit_flush); + f_ob_implicit_flush(flag); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ob_list_handlers f_ob_list_handlers +#else +inline Array x_ob_list_handlers() { + FUNCTION_INJECTION(ob_list_handlers); + return f_ob_list_handlers(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_output_add_rewrite_var f_output_add_rewrite_var +#else +inline bool x_output_add_rewrite_var(CStrRef name, CStrRef value) { + FUNCTION_INJECTION(output_add_rewrite_var); + return f_output_add_rewrite_var(name, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_output_reset_rewrite_vars f_output_reset_rewrite_vars +#else +inline bool x_output_reset_rewrite_vars() { + FUNCTION_INJECTION(output_reset_rewrite_vars); + return f_output_reset_rewrite_vars(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_log f_hphp_log +#else +inline bool x_hphp_log(CStrRef filename, CStrRef message) { + FUNCTION_INJECTION(hphp_log); + return f_hphp_log(filename, message); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_stats f_hphp_stats +#else +inline void x_hphp_stats(CStrRef name, int64 value) { + FUNCTION_INJECTION(hphp_stats); + f_hphp_stats(name, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_get_stats f_hphp_get_stats +#else +inline int64 x_hphp_get_stats(CStrRef name) { + FUNCTION_INJECTION(hphp_get_stats); + return f_hphp_get_stats(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_output_global_state f_hphp_output_global_state +#else +inline void x_hphp_output_global_state(CStrRef filename = null_string) { + FUNCTION_INJECTION(hphp_output_global_state); + f_hphp_output_global_state(filename); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_OUTPUT_H__ diff --git a/src/cpp/ext/profile/extprofile_php_mcc.h b/src/cpp/ext/profile/extprofile_php_mcc.h new file mode 100644 index 0000000000000..f6c283098b40e --- /dev/null +++ b/src/cpp/ext/profile/extprofile_php_mcc.h @@ -0,0 +1,16 @@ + +#ifndef __EXTPROFILE_PHP_MCC_H__ +#define __EXTPROFILE_PHP_MCC_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_PHP_MCC_H__ diff --git a/src/cpp/ext/profile/extprofile_posix.h b/src/cpp/ext/profile/extprofile_posix.h new file mode 100644 index 0000000000000..0e4fcf537a2c8 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_posix.h @@ -0,0 +1,347 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_POSIX_H__ +#define __EXTPROFILE_POSIX_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_posix_access f_posix_access +#else +inline bool x_posix_access(CStrRef file, int mode = 0) { + FUNCTION_INJECTION(posix_access); + return f_posix_access(file, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_ctermid f_posix_ctermid +#else +inline String x_posix_ctermid() { + FUNCTION_INJECTION(posix_ctermid); + return f_posix_ctermid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_get_last_error f_posix_get_last_error +#else +inline int x_posix_get_last_error() { + FUNCTION_INJECTION(posix_get_last_error); + return f_posix_get_last_error(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getcwd f_posix_getcwd +#else +inline String x_posix_getcwd() { + FUNCTION_INJECTION(posix_getcwd); + return f_posix_getcwd(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getegid f_posix_getegid +#else +inline int x_posix_getegid() { + FUNCTION_INJECTION(posix_getegid); + return f_posix_getegid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_geteuid f_posix_geteuid +#else +inline int x_posix_geteuid() { + FUNCTION_INJECTION(posix_geteuid); + return f_posix_geteuid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getgid f_posix_getgid +#else +inline int x_posix_getgid() { + FUNCTION_INJECTION(posix_getgid); + return f_posix_getgid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getgrgid f_posix_getgrgid +#else +inline Variant x_posix_getgrgid(int gid) { + FUNCTION_INJECTION(posix_getgrgid); + return f_posix_getgrgid(gid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getgrnam f_posix_getgrnam +#else +inline Variant x_posix_getgrnam(CStrRef name) { + FUNCTION_INJECTION(posix_getgrnam); + return f_posix_getgrnam(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getgroups f_posix_getgroups +#else +inline Variant x_posix_getgroups() { + FUNCTION_INJECTION(posix_getgroups); + return f_posix_getgroups(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getlogin f_posix_getlogin +#else +inline Variant x_posix_getlogin() { + FUNCTION_INJECTION(posix_getlogin); + return f_posix_getlogin(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getpgid f_posix_getpgid +#else +inline Variant x_posix_getpgid(int pid) { + FUNCTION_INJECTION(posix_getpgid); + return f_posix_getpgid(pid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getpgrp f_posix_getpgrp +#else +inline int x_posix_getpgrp() { + FUNCTION_INJECTION(posix_getpgrp); + return f_posix_getpgrp(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getpid f_posix_getpid +#else +inline int x_posix_getpid() { + FUNCTION_INJECTION(posix_getpid); + return f_posix_getpid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getppid f_posix_getppid +#else +inline int x_posix_getppid() { + FUNCTION_INJECTION(posix_getppid); + return f_posix_getppid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getpwnam f_posix_getpwnam +#else +inline Variant x_posix_getpwnam(CStrRef username) { + FUNCTION_INJECTION(posix_getpwnam); + return f_posix_getpwnam(username); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getpwuid f_posix_getpwuid +#else +inline Variant x_posix_getpwuid(int uid) { + FUNCTION_INJECTION(posix_getpwuid); + return f_posix_getpwuid(uid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getrlimit f_posix_getrlimit +#else +inline Variant x_posix_getrlimit() { + FUNCTION_INJECTION(posix_getrlimit); + return f_posix_getrlimit(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getsid f_posix_getsid +#else +inline Variant x_posix_getsid(int pid) { + FUNCTION_INJECTION(posix_getsid); + return f_posix_getsid(pid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_getuid f_posix_getuid +#else +inline int x_posix_getuid() { + FUNCTION_INJECTION(posix_getuid); + return f_posix_getuid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_initgroups f_posix_initgroups +#else +inline bool x_posix_initgroups(CStrRef name, int base_group_id) { + FUNCTION_INJECTION(posix_initgroups); + return f_posix_initgroups(name, base_group_id); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_isatty f_posix_isatty +#else +inline bool x_posix_isatty(CVarRef fd) { + FUNCTION_INJECTION(posix_isatty); + return f_posix_isatty(fd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_kill f_posix_kill +#else +inline bool x_posix_kill(int pid, int sig) { + FUNCTION_INJECTION(posix_kill); + return f_posix_kill(pid, sig); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_mkfifo f_posix_mkfifo +#else +inline bool x_posix_mkfifo(CStrRef pathname, int mode) { + FUNCTION_INJECTION(posix_mkfifo); + return f_posix_mkfifo(pathname, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_mknod f_posix_mknod +#else +inline bool x_posix_mknod(CStrRef pathname, int mode, int major = 0, int minor = 0) { + FUNCTION_INJECTION(posix_mknod); + return f_posix_mknod(pathname, mode, major, minor); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_setegid f_posix_setegid +#else +inline bool x_posix_setegid(int gid) { + FUNCTION_INJECTION(posix_setegid); + return f_posix_setegid(gid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_seteuid f_posix_seteuid +#else +inline bool x_posix_seteuid(int uid) { + FUNCTION_INJECTION(posix_seteuid); + return f_posix_seteuid(uid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_setgid f_posix_setgid +#else +inline bool x_posix_setgid(int gid) { + FUNCTION_INJECTION(posix_setgid); + return f_posix_setgid(gid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_setpgid f_posix_setpgid +#else +inline bool x_posix_setpgid(int pid, int pgid) { + FUNCTION_INJECTION(posix_setpgid); + return f_posix_setpgid(pid, pgid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_setsid f_posix_setsid +#else +inline int x_posix_setsid() { + FUNCTION_INJECTION(posix_setsid); + return f_posix_setsid(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_setuid f_posix_setuid +#else +inline bool x_posix_setuid(int uid) { + FUNCTION_INJECTION(posix_setuid); + return f_posix_setuid(uid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_strerror f_posix_strerror +#else +inline String x_posix_strerror(int errnum) { + FUNCTION_INJECTION(posix_strerror); + return f_posix_strerror(errnum); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_times f_posix_times +#else +inline Variant x_posix_times() { + FUNCTION_INJECTION(posix_times); + return f_posix_times(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_ttyname f_posix_ttyname +#else +inline Variant x_posix_ttyname(CVarRef fd) { + FUNCTION_INJECTION(posix_ttyname); + return f_posix_ttyname(fd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_posix_uname f_posix_uname +#else +inline Variant x_posix_uname() { + FUNCTION_INJECTION(posix_uname); + return f_posix_uname(); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_POSIX_H__ diff --git a/src/cpp/ext/profile/extprofile_preg.h b/src/cpp/ext/profile/extprofile_preg.h new file mode 100644 index 0000000000000..ce44b2da29eb7 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_preg.h @@ -0,0 +1,167 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_PREG_H__ +#define __EXTPROFILE_PREG_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_preg_grep f_preg_grep +#else +inline Variant x_preg_grep(CStrRef pattern, CArrRef input, int flags = 0) { + FUNCTION_INJECTION(preg_grep); + return f_preg_grep(pattern, input, flags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_preg_match f_preg_match +#else +inline Variant x_preg_match(CStrRef pattern, CStrRef subject, Variant matches = null, int flags = 0, int offset = 0) { + FUNCTION_INJECTION(preg_match); + return f_preg_match(pattern, subject, ref(matches), flags, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_preg_match_all f_preg_match_all +#else +inline Variant x_preg_match_all(CStrRef pattern, CStrRef subject, Variant matches, int flags = 0, int offset = 0) { + FUNCTION_INJECTION(preg_match_all); + return f_preg_match_all(pattern, subject, ref(matches), flags, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_preg_replace f_preg_replace +#else +inline Variant x_preg_replace(CVarRef pattern, CVarRef replacement, CVarRef subject, int limit = -1, Variant count = null) { + FUNCTION_INJECTION(preg_replace); + return f_preg_replace(pattern, replacement, subject, limit, ref(count)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_preg_replace_callback f_preg_replace_callback +#else +inline Variant x_preg_replace_callback(CVarRef pattern, CVarRef callback, CVarRef subject, int limit = -1, Variant count = null) { + FUNCTION_INJECTION(preg_replace_callback); + return f_preg_replace_callback(pattern, callback, subject, limit, ref(count)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_preg_split f_preg_split +#else +inline Variant x_preg_split(CVarRef pattern, CVarRef subject, int limit = -1, int flags = 0) { + FUNCTION_INJECTION(preg_split); + return f_preg_split(pattern, subject, limit, flags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_preg_quote f_preg_quote +#else +inline String x_preg_quote(CStrRef str, CStrRef delimiter = null_string) { + FUNCTION_INJECTION(preg_quote); + return f_preg_quote(str, delimiter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_preg_last_error f_preg_last_error +#else +inline int x_preg_last_error() { + FUNCTION_INJECTION(preg_last_error); + return f_preg_last_error(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ereg_replace f_ereg_replace +#else +inline String x_ereg_replace(CStrRef pattern, CStrRef replacement, CStrRef str) { + FUNCTION_INJECTION(ereg_replace); + return f_ereg_replace(pattern, replacement, str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_eregi_replace f_eregi_replace +#else +inline String x_eregi_replace(CStrRef pattern, CStrRef replacement, CStrRef str) { + FUNCTION_INJECTION(eregi_replace); + return f_eregi_replace(pattern, replacement, str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ereg f_ereg +#else +inline Variant x_ereg(CStrRef pattern, CStrRef str, Variant regs = null) { + FUNCTION_INJECTION(ereg); + return f_ereg(pattern, str, ref(regs)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_eregi f_eregi +#else +inline Variant x_eregi(CStrRef pattern, CStrRef str, Variant regs = null) { + FUNCTION_INJECTION(eregi); + return f_eregi(pattern, str, ref(regs)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_split f_split +#else +inline Variant x_split(CStrRef pattern, CStrRef str, int limit = -1) { + FUNCTION_INJECTION(split); + return f_split(pattern, str, limit); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_spliti f_spliti +#else +inline Variant x_spliti(CStrRef pattern, CStrRef str, int limit = -1) { + FUNCTION_INJECTION(spliti); + return f_spliti(pattern, str, limit); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sql_regcase f_sql_regcase +#else +inline String x_sql_regcase(CStrRef str) { + FUNCTION_INJECTION(sql_regcase); + return f_sql_regcase(str); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_PREG_H__ diff --git a/src/cpp/ext/profile/extprofile_process.h b/src/cpp/ext/profile/extprofile_process.h new file mode 100644 index 0000000000000..ee3d457d34fa9 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_process.h @@ -0,0 +1,266 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_PROCESS_H__ +#define __EXTPROFILE_PROCESS_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_pcntl_alarm f_pcntl_alarm +#else +inline int x_pcntl_alarm(int seconds) { + FUNCTION_INJECTION(pcntl_alarm); + return f_pcntl_alarm(seconds); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_exec f_pcntl_exec +#else +inline void x_pcntl_exec(CStrRef path, CArrRef args = null_array, CArrRef envs = null_array) { + FUNCTION_INJECTION(pcntl_exec); + f_pcntl_exec(path, args, envs); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_fork f_pcntl_fork +#else +inline int x_pcntl_fork() { + FUNCTION_INJECTION(pcntl_fork); + return f_pcntl_fork(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_getpriority f_pcntl_getpriority +#else +inline Variant x_pcntl_getpriority(int pid = 0, int process_identifier = 0) { + FUNCTION_INJECTION(pcntl_getpriority); + return f_pcntl_getpriority(pid, process_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_setpriority f_pcntl_setpriority +#else +inline bool x_pcntl_setpriority(int priority, int pid = 0, int process_identifier = 0) { + FUNCTION_INJECTION(pcntl_setpriority); + return f_pcntl_setpriority(priority, pid, process_identifier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_signal f_pcntl_signal +#else +inline bool x_pcntl_signal(int signo, CVarRef handler, bool restart_syscalls = true) { + FUNCTION_INJECTION(pcntl_signal); + return f_pcntl_signal(signo, handler, restart_syscalls); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_wait f_pcntl_wait +#else +inline int x_pcntl_wait(Variant status, int options = 0) { + FUNCTION_INJECTION(pcntl_wait); + return f_pcntl_wait(ref(status), options); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_waitpid f_pcntl_waitpid +#else +inline int x_pcntl_waitpid(int pid, Variant status, int options = 0) { + FUNCTION_INJECTION(pcntl_waitpid); + return f_pcntl_waitpid(pid, ref(status), options); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_wexitstatus f_pcntl_wexitstatus +#else +inline int x_pcntl_wexitstatus(int status) { + FUNCTION_INJECTION(pcntl_wexitstatus); + return f_pcntl_wexitstatus(status); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_wifexited f_pcntl_wifexited +#else +inline bool x_pcntl_wifexited(int status) { + FUNCTION_INJECTION(pcntl_wifexited); + return f_pcntl_wifexited(status); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_wifsignaled f_pcntl_wifsignaled +#else +inline bool x_pcntl_wifsignaled(int status) { + FUNCTION_INJECTION(pcntl_wifsignaled); + return f_pcntl_wifsignaled(status); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_wifstopped f_pcntl_wifstopped +#else +inline bool x_pcntl_wifstopped(int status) { + FUNCTION_INJECTION(pcntl_wifstopped); + return f_pcntl_wifstopped(status); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_wstopsig f_pcntl_wstopsig +#else +inline int x_pcntl_wstopsig(int status) { + FUNCTION_INJECTION(pcntl_wstopsig); + return f_pcntl_wstopsig(status); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_wtermsig f_pcntl_wtermsig +#else +inline int x_pcntl_wtermsig(int status) { + FUNCTION_INJECTION(pcntl_wtermsig); + return f_pcntl_wtermsig(status); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pcntl_signal_dispatch f_pcntl_signal_dispatch +#else +inline bool x_pcntl_signal_dispatch() { + FUNCTION_INJECTION(pcntl_signal_dispatch); + return f_pcntl_signal_dispatch(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_shell_exec f_shell_exec +#else +inline String x_shell_exec(CStrRef cmd) { + FUNCTION_INJECTION(shell_exec); + return f_shell_exec(cmd); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_exec f_exec +#else +inline String x_exec(CStrRef command, Variant output = null, Variant return_var = null) { + FUNCTION_INJECTION(exec); + return f_exec(command, ref(output), ref(return_var)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_passthru f_passthru +#else +inline void x_passthru(CStrRef command, Variant return_var = null) { + FUNCTION_INJECTION(passthru); + f_passthru(command, ref(return_var)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_system f_system +#else +inline String x_system(CStrRef command, Variant return_var = null) { + FUNCTION_INJECTION(system); + return f_system(command, ref(return_var)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_proc_open f_proc_open +#else +inline Variant x_proc_open(CStrRef cmd, CArrRef descriptorspec, Variant pipes, CStrRef cwd = null_string, CVarRef env = null_variant, CVarRef other_options = null_variant) { + FUNCTION_INJECTION(proc_open); + return f_proc_open(cmd, descriptorspec, ref(pipes), cwd, env, other_options); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_proc_terminate f_proc_terminate +#else +inline bool x_proc_terminate(CObjRef process, int signal = 0) { + FUNCTION_INJECTION(proc_terminate); + return f_proc_terminate(process, signal); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_proc_close f_proc_close +#else +inline int x_proc_close(CObjRef process) { + FUNCTION_INJECTION(proc_close); + return f_proc_close(process); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_proc_get_status f_proc_get_status +#else +inline Array x_proc_get_status(CObjRef process) { + FUNCTION_INJECTION(proc_get_status); + return f_proc_get_status(process); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_proc_nice f_proc_nice +#else +inline bool x_proc_nice(int increment) { + FUNCTION_INJECTION(proc_nice); + return f_proc_nice(increment); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_escapeshellarg f_escapeshellarg +#else +inline String x_escapeshellarg(CStrRef arg) { + FUNCTION_INJECTION(escapeshellarg); + return f_escapeshellarg(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_escapeshellcmd f_escapeshellcmd +#else +inline String x_escapeshellcmd(CStrRef command) { + FUNCTION_INJECTION(escapeshellcmd); + return f_escapeshellcmd(command); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_PROCESS_H__ diff --git a/src/cpp/ext/profile/extprofile_reflection.h b/src/cpp/ext/profile/extprofile_reflection.h new file mode 100644 index 0000000000000..86983b6d0bdcc --- /dev/null +++ b/src/cpp/ext/profile/extprofile_reflection.h @@ -0,0 +1,131 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_REFLECTION_H__ +#define __EXTPROFILE_REFLECTION_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_hphp_get_extension_info f_hphp_get_extension_info +#else +inline Array x_hphp_get_extension_info(CStrRef name) { + FUNCTION_INJECTION(hphp_get_extension_info); + return f_hphp_get_extension_info(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_get_class_info f_hphp_get_class_info +#else +inline Array x_hphp_get_class_info(CVarRef name) { + FUNCTION_INJECTION(hphp_get_class_info); + return f_hphp_get_class_info(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_get_function_info f_hphp_get_function_info +#else +inline Array x_hphp_get_function_info(CStrRef name) { + FUNCTION_INJECTION(hphp_get_function_info); + return f_hphp_get_function_info(name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_invoke f_hphp_invoke +#else +inline Variant x_hphp_invoke(CStrRef name, CArrRef params) { + FUNCTION_INJECTION(hphp_invoke); + return f_hphp_invoke(name, params); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_invoke_method f_hphp_invoke_method +#else +inline Variant x_hphp_invoke_method(CVarRef obj, CStrRef cls, CStrRef name, CArrRef params) { + FUNCTION_INJECTION(hphp_invoke_method); + return f_hphp_invoke_method(obj, cls, name, params); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_instanceof f_hphp_instanceof +#else +inline bool x_hphp_instanceof(CObjRef obj, CStrRef name) { + FUNCTION_INJECTION(hphp_instanceof); + return f_hphp_instanceof(obj, name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_create_object f_hphp_create_object +#else +inline Object x_hphp_create_object(CStrRef name, CArrRef params) { + FUNCTION_INJECTION(hphp_create_object); + return f_hphp_create_object(name, params); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_get_property f_hphp_get_property +#else +inline Variant x_hphp_get_property(CObjRef obj, CStrRef cls, CStrRef prop) { + FUNCTION_INJECTION(hphp_get_property); + return f_hphp_get_property(obj, cls, prop); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_set_property f_hphp_set_property +#else +inline void x_hphp_set_property(CObjRef obj, CStrRef cls, CStrRef prop, CVarRef value) { + FUNCTION_INJECTION(hphp_set_property); + f_hphp_set_property(obj, cls, prop, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_get_static_property f_hphp_get_static_property +#else +inline Variant x_hphp_get_static_property(CStrRef cls, CStrRef prop) { + FUNCTION_INJECTION(hphp_get_static_property); + return f_hphp_get_static_property(cls, prop); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_set_static_property f_hphp_set_static_property +#else +inline void x_hphp_set_static_property(CStrRef cls, CStrRef prop, CVarRef value) { + FUNCTION_INJECTION(hphp_set_static_property); + f_hphp_set_static_property(cls, prop, value); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_REFLECTION_H__ diff --git a/src/cpp/ext/profile/extprofile_server.h b/src/cpp/ext/profile/extprofile_server.h new file mode 100644 index 0000000000000..4b76b5f18ba81 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_server.h @@ -0,0 +1,122 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_SERVER_H__ +#define __EXTPROFILE_SERVER_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_dangling_server_proxy_old_request f_dangling_server_proxy_old_request +#else +inline bool x_dangling_server_proxy_old_request() { + FUNCTION_INJECTION(dangling_server_proxy_old_request); + return f_dangling_server_proxy_old_request(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_dangling_server_proxy_new_request f_dangling_server_proxy_new_request +#else +inline bool x_dangling_server_proxy_new_request(CStrRef host) { + FUNCTION_INJECTION(dangling_server_proxy_new_request); + return f_dangling_server_proxy_new_request(host); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pagelet_server_task_start f_pagelet_server_task_start +#else +inline Object x_pagelet_server_task_start(CStrRef url, CArrRef headers = null_array, CStrRef post_data = null_string) { + FUNCTION_INJECTION(pagelet_server_task_start); + return f_pagelet_server_task_start(url, headers, post_data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pagelet_server_task_status f_pagelet_server_task_status +#else +inline bool x_pagelet_server_task_status(CObjRef task) { + FUNCTION_INJECTION(pagelet_server_task_status); + return f_pagelet_server_task_status(task); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_pagelet_server_task_result f_pagelet_server_task_result +#else +inline String x_pagelet_server_task_result(CObjRef task, Variant headers, Variant code) { + FUNCTION_INJECTION(pagelet_server_task_result); + return f_pagelet_server_task_result(task, ref(headers), ref(code)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xbox_send_message f_xbox_send_message +#else +inline bool x_xbox_send_message(CStrRef msg, Variant ret, int64 timeout_ms, CStrRef host = "localhost") { + FUNCTION_INJECTION(xbox_send_message); + return f_xbox_send_message(msg, ref(ret), timeout_ms, host); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xbox_post_message f_xbox_post_message +#else +inline bool x_xbox_post_message(CStrRef msg, CStrRef host = "localhost") { + FUNCTION_INJECTION(xbox_post_message); + return f_xbox_post_message(msg, host); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xbox_task_start f_xbox_task_start +#else +inline Object x_xbox_task_start(CStrRef message) { + FUNCTION_INJECTION(xbox_task_start); + return f_xbox_task_start(message); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xbox_task_status f_xbox_task_status +#else +inline bool x_xbox_task_status(CObjRef task) { + FUNCTION_INJECTION(xbox_task_status); + return f_xbox_task_status(task); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xbox_task_result f_xbox_task_result +#else +inline int64 x_xbox_task_result(CObjRef task, int64 timeout_ms, Variant ret) { + FUNCTION_INJECTION(xbox_task_result); + return f_xbox_task_result(task, timeout_ms, ref(ret)); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_SERVER_H__ diff --git a/src/cpp/ext/profile/extprofile_simplexml.h b/src/cpp/ext/profile/extprofile_simplexml.h new file mode 100644 index 0000000000000..c4f9b5dbbeff2 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_simplexml.h @@ -0,0 +1,79 @@ + +#ifndef __EXTPROFILE_SIMPLEXML_H__ +#define __EXTPROFILE_SIMPLEXML_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_simplexml_load_string f_simplexml_load_string +#else +inline Variant x_simplexml_load_string(CStrRef data, CStrRef class_name = "SimpleXMLElement", int64 options = 0, CStrRef ns = "", bool is_prefix = false) { + FUNCTION_INJECTION(simplexml_load_string); + return f_simplexml_load_string(data, class_name, options, ns, is_prefix); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_simplexml_load_file f_simplexml_load_file +#else +inline Variant x_simplexml_load_file(CStrRef filename, CStrRef class_name = "SimpleXMLElement", int64 options = 0, CStrRef ns = "", bool is_prefix = false) { + FUNCTION_INJECTION(simplexml_load_file); + return f_simplexml_load_file(filename, class_name, options, ns, is_prefix); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_libxml_get_errors f_libxml_get_errors +#else +inline Variant x_libxml_get_errors() { + FUNCTION_INJECTION(libxml_get_errors); + return f_libxml_get_errors(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_libxml_get_last_error f_libxml_get_last_error +#else +inline Variant x_libxml_get_last_error() { + FUNCTION_INJECTION(libxml_get_last_error); + return f_libxml_get_last_error(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_libxml_clear_errors f_libxml_clear_errors +#else +inline void x_libxml_clear_errors() { + FUNCTION_INJECTION(libxml_clear_errors); + f_libxml_clear_errors(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_libxml_use_internal_errors f_libxml_use_internal_errors +#else +inline bool x_libxml_use_internal_errors(CVarRef use_errors = null_variant) { + FUNCTION_INJECTION(libxml_use_internal_errors); + return f_libxml_use_internal_errors(use_errors); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_libxml_set_streams_context f_libxml_set_streams_context +#else +inline void x_libxml_set_streams_context(CObjRef streams_context) { + FUNCTION_INJECTION(libxml_set_streams_context); + f_libxml_set_streams_context(streams_context); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_SIMPLEXML_H__ diff --git a/src/cpp/ext/profile/extprofile_soap.h b/src/cpp/ext/profile/extprofile_soap.h new file mode 100644 index 0000000000000..9001dfc22a7da --- /dev/null +++ b/src/cpp/ext/profile/extprofile_soap.h @@ -0,0 +1,34 @@ + +#ifndef __EXTPROFILE_SOAP_H__ +#define __EXTPROFILE_SOAP_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_use_soap_error_handler f_use_soap_error_handler +#else +inline bool x_use_soap_error_handler(bool handler = true) { + FUNCTION_INJECTION(use_soap_error_handler); + return f_use_soap_error_handler(handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_soap_fault f_is_soap_fault +#else +inline bool x_is_soap_fault(CVarRef fault) { + FUNCTION_INJECTION(is_soap_fault); + return f_is_soap_fault(fault); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_SOAP_H__ diff --git a/src/cpp/ext/profile/extprofile_socket.h b/src/cpp/ext/profile/extprofile_socket.h new file mode 100644 index 0000000000000..d87c05a6d867e --- /dev/null +++ b/src/cpp/ext/profile/extprofile_socket.h @@ -0,0 +1,266 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_SOCKET_H__ +#define __EXTPROFILE_SOCKET_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_socket_create f_socket_create +#else +inline Variant x_socket_create(int domain, int type, int protocol) { + FUNCTION_INJECTION(socket_create); + return f_socket_create(domain, type, protocol); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_create_listen f_socket_create_listen +#else +inline Variant x_socket_create_listen(int port, int backlog = 128) { + FUNCTION_INJECTION(socket_create_listen); + return f_socket_create_listen(port, backlog); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_create_pair f_socket_create_pair +#else +inline bool x_socket_create_pair(int domain, int type, int protocol, Variant fd) { + FUNCTION_INJECTION(socket_create_pair); + return f_socket_create_pair(domain, type, protocol, ref(fd)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_get_option f_socket_get_option +#else +inline Variant x_socket_get_option(CObjRef socket, int level, int optname) { + FUNCTION_INJECTION(socket_get_option); + return f_socket_get_option(socket, level, optname); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_getpeername f_socket_getpeername +#else +inline bool x_socket_getpeername(CObjRef socket, Variant address, Variant port = null) { + FUNCTION_INJECTION(socket_getpeername); + return f_socket_getpeername(socket, ref(address), ref(port)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_getsockname f_socket_getsockname +#else +inline bool x_socket_getsockname(CObjRef socket, Variant address, Variant port = null) { + FUNCTION_INJECTION(socket_getsockname); + return f_socket_getsockname(socket, ref(address), ref(port)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_set_block f_socket_set_block +#else +inline bool x_socket_set_block(CObjRef socket) { + FUNCTION_INJECTION(socket_set_block); + return f_socket_set_block(socket); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_set_nonblock f_socket_set_nonblock +#else +inline bool x_socket_set_nonblock(CObjRef socket) { + FUNCTION_INJECTION(socket_set_nonblock); + return f_socket_set_nonblock(socket); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_set_option f_socket_set_option +#else +inline bool x_socket_set_option(CObjRef socket, int level, int optname, CVarRef optval) { + FUNCTION_INJECTION(socket_set_option); + return f_socket_set_option(socket, level, optname, optval); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_connect f_socket_connect +#else +inline bool x_socket_connect(CObjRef socket, CStrRef address, int port = 0) { + FUNCTION_INJECTION(socket_connect); + return f_socket_connect(socket, address, port); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_bind f_socket_bind +#else +inline bool x_socket_bind(CObjRef socket, CStrRef address, int port = 0) { + FUNCTION_INJECTION(socket_bind); + return f_socket_bind(socket, address, port); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_listen f_socket_listen +#else +inline bool x_socket_listen(CObjRef socket, int backlog = 0) { + FUNCTION_INJECTION(socket_listen); + return f_socket_listen(socket, backlog); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_select f_socket_select +#else +inline Variant x_socket_select(Variant read, Variant write, Variant except, CVarRef vtv_sec, int tv_usec = 0) { + FUNCTION_INJECTION(socket_select); + return f_socket_select(ref(read), ref(write), ref(except), vtv_sec, tv_usec); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_server f_socket_server +#else +inline Variant x_socket_server(CStrRef hostname, int port = -1, Variant errnum = null, Variant errstr = null) { + FUNCTION_INJECTION(socket_server); + return f_socket_server(hostname, port, ref(errnum), ref(errstr)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_accept f_socket_accept +#else +inline Variant x_socket_accept(CObjRef socket) { + FUNCTION_INJECTION(socket_accept); + return f_socket_accept(socket); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_read f_socket_read +#else +inline Variant x_socket_read(CObjRef socket, int length, int type = 0) { + FUNCTION_INJECTION(socket_read); + return f_socket_read(socket, length, type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_write f_socket_write +#else +inline Variant x_socket_write(CObjRef socket, CStrRef buffer, int length = 0) { + FUNCTION_INJECTION(socket_write); + return f_socket_write(socket, buffer, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_send f_socket_send +#else +inline Variant x_socket_send(CObjRef socket, CStrRef buf, int len, int flags) { + FUNCTION_INJECTION(socket_send); + return f_socket_send(socket, buf, len, flags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_sendto f_socket_sendto +#else +inline Variant x_socket_sendto(CObjRef socket, CStrRef buf, int len, int flags, CStrRef addr, int port = 0) { + FUNCTION_INJECTION(socket_sendto); + return f_socket_sendto(socket, buf, len, flags, addr, port); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_recv f_socket_recv +#else +inline Variant x_socket_recv(CObjRef socket, Variant buf, int len, int flags) { + FUNCTION_INJECTION(socket_recv); + return f_socket_recv(socket, ref(buf), len, flags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_recvfrom f_socket_recvfrom +#else +inline Variant x_socket_recvfrom(CObjRef socket, Variant buf, int len, int flags, Variant name, Variant port = 0) { + FUNCTION_INJECTION(socket_recvfrom); + return f_socket_recvfrom(socket, ref(buf), len, flags, ref(name), ref(port)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_shutdown f_socket_shutdown +#else +inline bool x_socket_shutdown(CObjRef socket, int how = 0) { + FUNCTION_INJECTION(socket_shutdown); + return f_socket_shutdown(socket, how); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_close f_socket_close +#else +inline void x_socket_close(CObjRef socket) { + FUNCTION_INJECTION(socket_close); + f_socket_close(socket); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_strerror f_socket_strerror +#else +inline String x_socket_strerror(int errnum) { + FUNCTION_INJECTION(socket_strerror); + return f_socket_strerror(errnum); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_last_error f_socket_last_error +#else +inline int x_socket_last_error(CObjRef socket = null_object) { + FUNCTION_INJECTION(socket_last_error); + return f_socket_last_error(socket); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_socket_clear_error f_socket_clear_error +#else +inline void x_socket_clear_error(CObjRef socket = null_object) { + FUNCTION_INJECTION(socket_clear_error); + f_socket_clear_error(socket); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_SOCKET_H__ diff --git a/src/cpp/ext/profile/extprofile_sqlite3.h b/src/cpp/ext/profile/extprofile_sqlite3.h new file mode 100644 index 0000000000000..b91dfb1119812 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_sqlite3.h @@ -0,0 +1,16 @@ + +#ifndef __EXTPROFILE_SQLITE3_H__ +#define __EXTPROFILE_SQLITE3_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_SQLITE3_H__ diff --git a/src/cpp/ext/profile/extprofile_stream.h b/src/cpp/ext/profile/extprofile_stream.h new file mode 100644 index 0000000000000..2690b6c6141f0 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_stream.h @@ -0,0 +1,392 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_STREAM_H__ +#define __EXTPROFILE_STREAM_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_stream_context_create f_stream_context_create +#else +inline Object x_stream_context_create(CArrRef options = null_array, CArrRef params = null_array) { + FUNCTION_INJECTION(stream_context_create); + return f_stream_context_create(options, params); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_context_get_default f_stream_context_get_default +#else +inline Object x_stream_context_get_default(CArrRef options = null_array) { + FUNCTION_INJECTION(stream_context_get_default); + return f_stream_context_get_default(options); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_context_get_options f_stream_context_get_options +#else +inline Array x_stream_context_get_options(CObjRef stream_or_context) { + FUNCTION_INJECTION(stream_context_get_options); + return f_stream_context_get_options(stream_or_context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_context_set_option f_stream_context_set_option +#else +inline bool x_stream_context_set_option(CObjRef stream_or_context, CVarRef wrapper, CStrRef option = null_string, CVarRef value = null_variant) { + FUNCTION_INJECTION(stream_context_set_option); + return f_stream_context_set_option(stream_or_context, wrapper, option, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_context_set_param f_stream_context_set_param +#else +inline bool x_stream_context_set_param(CObjRef stream_or_context, CArrRef params) { + FUNCTION_INJECTION(stream_context_set_param); + return f_stream_context_set_param(stream_or_context, params); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_copy_to_stream f_stream_copy_to_stream +#else +inline Variant x_stream_copy_to_stream(CObjRef source, CObjRef dest, int maxlength = 0, int offset = 0) { + FUNCTION_INJECTION(stream_copy_to_stream); + return f_stream_copy_to_stream(source, dest, maxlength, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_encoding f_stream_encoding +#else +inline bool x_stream_encoding(CObjRef stream, CStrRef encoding = null_string) { + FUNCTION_INJECTION(stream_encoding); + return f_stream_encoding(stream, encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_bucket_append f_stream_bucket_append +#else +inline void x_stream_bucket_append(CObjRef brigade, CObjRef bucket) { + FUNCTION_INJECTION(stream_bucket_append); + f_stream_bucket_append(brigade, bucket); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_bucket_prepend f_stream_bucket_prepend +#else +inline void x_stream_bucket_prepend(CObjRef brigade, CObjRef bucket) { + FUNCTION_INJECTION(stream_bucket_prepend); + f_stream_bucket_prepend(brigade, bucket); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_bucket_make_writeable f_stream_bucket_make_writeable +#else +inline Object x_stream_bucket_make_writeable(CObjRef brigade) { + FUNCTION_INJECTION(stream_bucket_make_writeable); + return f_stream_bucket_make_writeable(brigade); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_bucket_new f_stream_bucket_new +#else +inline Object x_stream_bucket_new(CObjRef stream, CStrRef buffer) { + FUNCTION_INJECTION(stream_bucket_new); + return f_stream_bucket_new(stream, buffer); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_filter_register f_stream_filter_register +#else +inline bool x_stream_filter_register(CStrRef filtername, CStrRef classname) { + FUNCTION_INJECTION(stream_filter_register); + return f_stream_filter_register(filtername, classname); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_filter_remove f_stream_filter_remove +#else +inline bool x_stream_filter_remove(CObjRef stream_filter) { + FUNCTION_INJECTION(stream_filter_remove); + return f_stream_filter_remove(stream_filter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_filter_append f_stream_filter_append +#else +inline Object x_stream_filter_append(CObjRef stream, CStrRef filtername, int read_write = 0, CVarRef params = null_variant) { + FUNCTION_INJECTION(stream_filter_append); + return f_stream_filter_append(stream, filtername, read_write, params); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_filter_prepend f_stream_filter_prepend +#else +inline Object x_stream_filter_prepend(CObjRef stream, CStrRef filtername, int read_write = 0, CVarRef params = null_variant) { + FUNCTION_INJECTION(stream_filter_prepend); + return f_stream_filter_prepend(stream, filtername, read_write, params); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_get_contents f_stream_get_contents +#else +inline Variant x_stream_get_contents(CObjRef handle, int maxlen = 0, int offset = 0) { + FUNCTION_INJECTION(stream_get_contents); + return f_stream_get_contents(handle, maxlen, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_get_filters f_stream_get_filters +#else +inline Array x_stream_get_filters() { + FUNCTION_INJECTION(stream_get_filters); + return f_stream_get_filters(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_get_line f_stream_get_line +#else +inline Variant x_stream_get_line(CObjRef handle, int length = 0, CStrRef ending = null_string) { + FUNCTION_INJECTION(stream_get_line); + return f_stream_get_line(handle, length, ending); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_get_meta_data f_stream_get_meta_data +#else +inline Array x_stream_get_meta_data(CObjRef stream) { + FUNCTION_INJECTION(stream_get_meta_data); + return f_stream_get_meta_data(stream); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_get_transports f_stream_get_transports +#else +inline Array x_stream_get_transports() { + FUNCTION_INJECTION(stream_get_transports); + return f_stream_get_transports(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_get_wrappers f_stream_get_wrappers +#else +inline Array x_stream_get_wrappers() { + FUNCTION_INJECTION(stream_get_wrappers); + return f_stream_get_wrappers(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_register_wrapper f_stream_register_wrapper +#else +inline bool x_stream_register_wrapper(CStrRef protocol, CStrRef classname) { + FUNCTION_INJECTION(stream_register_wrapper); + return f_stream_register_wrapper(protocol, classname); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_wrapper_register f_stream_wrapper_register +#else +inline bool x_stream_wrapper_register(CStrRef protocol, CStrRef classname) { + FUNCTION_INJECTION(stream_wrapper_register); + return f_stream_wrapper_register(protocol, classname); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_wrapper_restore f_stream_wrapper_restore +#else +inline bool x_stream_wrapper_restore(CStrRef protocol) { + FUNCTION_INJECTION(stream_wrapper_restore); + return f_stream_wrapper_restore(protocol); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_wrapper_unregister f_stream_wrapper_unregister +#else +inline bool x_stream_wrapper_unregister(CStrRef protocol) { + FUNCTION_INJECTION(stream_wrapper_unregister); + return f_stream_wrapper_unregister(protocol); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_resolve_include_path f_stream_resolve_include_path +#else +inline String x_stream_resolve_include_path(CStrRef filename, CObjRef context = null_object) { + FUNCTION_INJECTION(stream_resolve_include_path); + return f_stream_resolve_include_path(filename, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_select f_stream_select +#else +inline Variant x_stream_select(Variant read, Variant write, Variant except, CVarRef vtv_sec, int tv_usec = 0) { + FUNCTION_INJECTION(stream_select); + return f_stream_select(ref(read), ref(write), ref(except), vtv_sec, tv_usec); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_set_blocking f_stream_set_blocking +#else +inline bool x_stream_set_blocking(CObjRef stream, int mode) { + FUNCTION_INJECTION(stream_set_blocking); + return f_stream_set_blocking(stream, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_set_timeout f_stream_set_timeout +#else +inline bool x_stream_set_timeout(CObjRef stream, int seconds, int microseconds = 0) { + FUNCTION_INJECTION(stream_set_timeout); + return f_stream_set_timeout(stream, seconds, microseconds); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_set_write_buffer f_stream_set_write_buffer +#else +inline int x_stream_set_write_buffer(CObjRef stream, int buffer) { + FUNCTION_INJECTION(stream_set_write_buffer); + return f_stream_set_write_buffer(stream, buffer); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_set_file_buffer f_set_file_buffer +#else +inline int x_set_file_buffer(CObjRef stream, int buffer) { + FUNCTION_INJECTION(set_file_buffer); + return f_set_file_buffer(stream, buffer); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_socket_accept f_stream_socket_accept +#else +inline Variant x_stream_socket_accept(CObjRef server_socket, double timeout = 0.0, Variant peername = null) { + FUNCTION_INJECTION(stream_socket_accept); + return f_stream_socket_accept(server_socket, timeout, ref(peername)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_socket_server f_stream_socket_server +#else +inline Variant x_stream_socket_server(CStrRef local_socket, Variant errnum = null, Variant errstr = null, int flags = 0, CObjRef context = null_object) { + FUNCTION_INJECTION(stream_socket_server); + return f_stream_socket_server(local_socket, ref(errnum), ref(errstr), flags, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_socket_client f_stream_socket_client +#else +inline Variant x_stream_socket_client(CStrRef remote_socket, Variant errnum = null, Variant errstr = null, double timeout = 0.0, int flags = 0, CObjRef context = null_object) { + FUNCTION_INJECTION(stream_socket_client); + return f_stream_socket_client(remote_socket, ref(errnum), ref(errstr), timeout, flags, context); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_socket_enable_crypto f_stream_socket_enable_crypto +#else +inline Variant x_stream_socket_enable_crypto(CObjRef stream, bool enable, int crypto_type = 0, CObjRef session_stream = null_object) { + FUNCTION_INJECTION(stream_socket_enable_crypto); + return f_stream_socket_enable_crypto(stream, enable, crypto_type, session_stream); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_socket_get_name f_stream_socket_get_name +#else +inline Variant x_stream_socket_get_name(CObjRef handle, bool want_peer) { + FUNCTION_INJECTION(stream_socket_get_name); + return f_stream_socket_get_name(handle, want_peer); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_socket_pair f_stream_socket_pair +#else +inline Variant x_stream_socket_pair(int domain, int type, int protocol) { + FUNCTION_INJECTION(stream_socket_pair); + return f_stream_socket_pair(domain, type, protocol); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_socket_recvfrom f_stream_socket_recvfrom +#else +inline Variant x_stream_socket_recvfrom(CObjRef socket, int length, int flags = 0, CStrRef address = null_string) { + FUNCTION_INJECTION(stream_socket_recvfrom); + return f_stream_socket_recvfrom(socket, length, flags, address); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_socket_sendto f_stream_socket_sendto +#else +inline Variant x_stream_socket_sendto(CObjRef socket, CStrRef data, int flags = 0, CStrRef address = null_string) { + FUNCTION_INJECTION(stream_socket_sendto); + return f_stream_socket_sendto(socket, data, flags, address); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stream_socket_shutdown f_stream_socket_shutdown +#else +inline bool x_stream_socket_shutdown(CObjRef stream, int how) { + FUNCTION_INJECTION(stream_socket_shutdown); + return f_stream_socket_shutdown(stream, how); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_STREAM_H__ diff --git a/src/cpp/ext/profile/extprofile_string.h b/src/cpp/ext/profile/extprofile_string.h new file mode 100644 index 0000000000000..87081e3617003 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_string.h @@ -0,0 +1,851 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_STRING_H__ +#define __EXTPROFILE_STRING_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_addcslashes f_addcslashes +#else +inline String x_addcslashes(CStrRef str, CStrRef charlist) { + FUNCTION_INJECTION(addcslashes); + return f_addcslashes(str, charlist); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stripcslashes f_stripcslashes +#else +inline String x_stripcslashes(CStrRef str) { + FUNCTION_INJECTION(stripcslashes); + return f_stripcslashes(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_addslashes f_addslashes +#else +inline String x_addslashes(CStrRef str) { + FUNCTION_INJECTION(addslashes); + return f_addslashes(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stripslashes f_stripslashes +#else +inline String x_stripslashes(CStrRef str) { + FUNCTION_INJECTION(stripslashes); + return f_stripslashes(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_bin2hex f_bin2hex +#else +inline String x_bin2hex(CStrRef str) { + FUNCTION_INJECTION(bin2hex); + return f_bin2hex(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_nl2br f_nl2br +#else +inline String x_nl2br(CStrRef str) { + FUNCTION_INJECTION(nl2br); + return f_nl2br(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_quotemeta f_quotemeta +#else +inline String x_quotemeta(CStrRef str) { + FUNCTION_INJECTION(quotemeta); + return f_quotemeta(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_str_shuffle f_str_shuffle +#else +inline String x_str_shuffle(CStrRef str) { + FUNCTION_INJECTION(str_shuffle); + return f_str_shuffle(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strrev f_strrev +#else +inline String x_strrev(CStrRef str) { + FUNCTION_INJECTION(strrev); + return f_strrev(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strtolower f_strtolower +#else +inline String x_strtolower(CStrRef str) { + FUNCTION_INJECTION(strtolower); + return f_strtolower(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strtoupper f_strtoupper +#else +inline String x_strtoupper(CStrRef str) { + FUNCTION_INJECTION(strtoupper); + return f_strtoupper(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ucfirst f_ucfirst +#else +inline String x_ucfirst(CStrRef str) { + FUNCTION_INJECTION(ucfirst); + return f_ucfirst(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ucwords f_ucwords +#else +inline String x_ucwords(CStrRef str) { + FUNCTION_INJECTION(ucwords); + return f_ucwords(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strip_tags f_strip_tags +#else +inline String x_strip_tags(CStrRef str, CStrRef allowable_tags = "") { + FUNCTION_INJECTION(strip_tags); + return f_strip_tags(str, allowable_tags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_trim f_trim +#else +inline String x_trim(CStrRef str, CStrRef charlist = k_HPHP_TRIM_CHARLIST) { + FUNCTION_INJECTION(trim); + return f_trim(str, charlist); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ltrim f_ltrim +#else +inline String x_ltrim(CStrRef str, CStrRef charlist = k_HPHP_TRIM_CHARLIST) { + FUNCTION_INJECTION(ltrim); + return f_ltrim(str, charlist); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rtrim f_rtrim +#else +inline String x_rtrim(CStrRef str, CStrRef charlist = k_HPHP_TRIM_CHARLIST) { + FUNCTION_INJECTION(rtrim); + return f_rtrim(str, charlist); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_chop f_chop +#else +inline String x_chop(CStrRef str, CStrRef charlist = k_HPHP_TRIM_CHARLIST) { + FUNCTION_INJECTION(chop); + return f_chop(str, charlist); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_explode f_explode +#else +inline Array x_explode(CStrRef delimiter, CStrRef str, int limit = 0x7FFFFFFF) { + FUNCTION_INJECTION(explode); + return f_explode(delimiter, str, limit); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_implode f_implode +#else +inline String x_implode(CVarRef arg1, CVarRef arg2 = null_variant) { + FUNCTION_INJECTION(implode); + return f_implode(arg1, arg2); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_join f_join +#else +inline String x_join(CVarRef glue, CVarRef pieces = null_variant) { + FUNCTION_INJECTION(join); + return f_join(glue, pieces); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_str_split f_str_split +#else +inline Array x_str_split(CStrRef str, int split_length = 1) { + FUNCTION_INJECTION(str_split); + return f_str_split(str, split_length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_chunk_split f_chunk_split +#else +inline String x_chunk_split(CStrRef body, int chunklen = 76, CStrRef end = "\r\n") { + FUNCTION_INJECTION(chunk_split); + return f_chunk_split(body, chunklen, end); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strtok f_strtok +#else +inline Variant x_strtok(CStrRef str, CVarRef token = null_variant) { + FUNCTION_INJECTION(strtok); + return f_strtok(str, token); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_str_replace f_str_replace +#else +inline Variant x_str_replace(CVarRef search, CVarRef replace, CVarRef subject, Variant count = null) { + FUNCTION_INJECTION(str_replace); + return f_str_replace(search, replace, subject, ref(count)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_str_ireplace f_str_ireplace +#else +inline Variant x_str_ireplace(CVarRef search, CVarRef replace, CVarRef subject, Variant count = null) { + FUNCTION_INJECTION(str_ireplace); + return f_str_ireplace(search, replace, subject, ref(count)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_substr_replace f_substr_replace +#else +inline Variant x_substr_replace(CVarRef str, CVarRef replacement, CVarRef start, CVarRef length = 0x7FFFFFFF) { + FUNCTION_INJECTION(substr_replace); + return f_substr_replace(str, replacement, start, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_substr f_substr +#else +inline Variant x_substr(CStrRef str, int start, int length = 0x7FFFFFFF) { + FUNCTION_INJECTION(substr); + return f_substr(str, start, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_str_pad f_str_pad +#else +inline String x_str_pad(CStrRef input, int pad_length, CStrRef pad_string = " ", int pad_type = k_STR_PAD_RIGHT) { + FUNCTION_INJECTION(str_pad); + return f_str_pad(input, pad_length, pad_string, pad_type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_str_repeat f_str_repeat +#else +inline String x_str_repeat(CStrRef input, int multiplier) { + FUNCTION_INJECTION(str_repeat); + return f_str_repeat(input, multiplier); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_wordwrap f_wordwrap +#else +inline String x_wordwrap(CStrRef str, int width = 75, CStrRef wordbreak = "\n", bool cut = false) { + FUNCTION_INJECTION(wordwrap); + return f_wordwrap(str, width, wordbreak, cut); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_html_entity_decode f_html_entity_decode +#else +inline String x_html_entity_decode(CStrRef str, int quote_style = k_ENT_COMPAT, CStrRef charset = "") { + FUNCTION_INJECTION(html_entity_decode); + return f_html_entity_decode(str, quote_style, charset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_htmlentities f_htmlentities +#else +inline String x_htmlentities(CStrRef str, int quote_style = k_ENT_COMPAT, CStrRef charset = "", bool double_encode = true) { + FUNCTION_INJECTION(htmlentities); + return f_htmlentities(str, quote_style, charset, double_encode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_htmlspecialchars_decode f_htmlspecialchars_decode +#else +inline String x_htmlspecialchars_decode(CStrRef str, int quote_style = k_ENT_COMPAT) { + FUNCTION_INJECTION(htmlspecialchars_decode); + return f_htmlspecialchars_decode(str, quote_style); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_htmlspecialchars f_htmlspecialchars +#else +inline String x_htmlspecialchars(CStrRef str, int quote_style = k_ENT_COMPAT, CStrRef charset = "", bool double_encode = true) { + FUNCTION_INJECTION(htmlspecialchars); + return f_htmlspecialchars(str, quote_style, charset, double_encode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_quoted_printable_encode f_quoted_printable_encode +#else +inline String x_quoted_printable_encode(CStrRef str) { + FUNCTION_INJECTION(quoted_printable_encode); + return f_quoted_printable_encode(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_quoted_printable_decode f_quoted_printable_decode +#else +inline String x_quoted_printable_decode(CStrRef str) { + FUNCTION_INJECTION(quoted_printable_decode); + return f_quoted_printable_decode(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_convert_uudecode f_convert_uudecode +#else +inline Variant x_convert_uudecode(CStrRef data) { + FUNCTION_INJECTION(convert_uudecode); + return f_convert_uudecode(data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_convert_uuencode f_convert_uuencode +#else +inline Variant x_convert_uuencode(CStrRef data) { + FUNCTION_INJECTION(convert_uuencode); + return f_convert_uuencode(data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_str_rot13 f_str_rot13 +#else +inline String x_str_rot13(CStrRef str) { + FUNCTION_INJECTION(str_rot13); + return f_str_rot13(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_crc32 f_crc32 +#else +inline int64 x_crc32(CStrRef str) { + FUNCTION_INJECTION(crc32); + return f_crc32(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_crypt f_crypt +#else +inline String x_crypt(CStrRef str, CStrRef salt = "") { + FUNCTION_INJECTION(crypt); + return f_crypt(str, salt); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_md5 f_md5 +#else +inline String x_md5(CStrRef str, bool raw_output = false) { + FUNCTION_INJECTION(md5); + return f_md5(str, raw_output); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sha1 f_sha1 +#else +inline String x_sha1(CStrRef str, bool raw_output = false) { + FUNCTION_INJECTION(sha1); + return f_sha1(str, raw_output); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strtr f_strtr +#else +inline String x_strtr(CStrRef str, CVarRef from, CVarRef to = null_variant) { + FUNCTION_INJECTION(strtr); + return f_strtr(str, from, to); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_convert_cyr_string f_convert_cyr_string +#else +inline String x_convert_cyr_string(CStrRef str, CStrRef from, CStrRef to) { + FUNCTION_INJECTION(convert_cyr_string); + return f_convert_cyr_string(str, from, to); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_html_translation_table f_get_html_translation_table +#else +inline Array x_get_html_translation_table(int table = 0, int quote_style = k_ENT_COMPAT) { + FUNCTION_INJECTION(get_html_translation_table); + return f_get_html_translation_table(table, quote_style); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hebrev f_hebrev +#else +inline String x_hebrev(CStrRef hebrew_text, int max_chars_per_line = 0) { + FUNCTION_INJECTION(hebrev); + return f_hebrev(hebrew_text, max_chars_per_line); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hebrevc f_hebrevc +#else +inline String x_hebrevc(CStrRef hebrew_text, int max_chars_per_line = 0) { + FUNCTION_INJECTION(hebrevc); + return f_hebrevc(hebrew_text, max_chars_per_line); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_setlocale f_setlocale +#else +inline Variant x_setlocale(int _argc, int category, CVarRef locale, CArrRef _argv = null_array) { + FUNCTION_INJECTION(setlocale); + return f_setlocale(_argc, category, locale, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_localeconv f_localeconv +#else +inline Array x_localeconv() { + FUNCTION_INJECTION(localeconv); + return f_localeconv(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_nl_langinfo f_nl_langinfo +#else +inline String x_nl_langinfo(int item) { + FUNCTION_INJECTION(nl_langinfo); + return f_nl_langinfo(item); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_echo f_echo +#else +inline void x_echo(int _argc, CStrRef arg, CArrRef _argv = null_array) { + FUNCTION_INJECTION(echo); + f_echo(_argc, arg, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_print f_print +#else +inline int x_print(CStrRef arg) { + FUNCTION_INJECTION(print); + return f_print(arg); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_printf f_printf +#else +inline int x_printf(int _argc, CStrRef format, CArrRef _argv = null_array) { + FUNCTION_INJECTION(printf); + return f_printf(_argc, format, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_vprintf f_vprintf +#else +inline int x_vprintf(CStrRef format, CArrRef args) { + FUNCTION_INJECTION(vprintf); + return f_vprintf(format, args); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sprintf f_sprintf +#else +inline String x_sprintf(int _argc, CStrRef format, CArrRef _argv = null_array) { + FUNCTION_INJECTION(sprintf); + return f_sprintf(_argc, format, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_vsprintf f_vsprintf +#else +inline String x_vsprintf(CStrRef format, CArrRef args) { + FUNCTION_INJECTION(vsprintf); + return f_vsprintf(format, args); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_sscanf f_sscanf +#else +inline Variant x_sscanf(int _argc, CStrRef str, CStrRef format, CArrRef _argv = null_array) { + FUNCTION_INJECTION(sscanf); + return f_sscanf(_argc, str, format, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_chr f_chr +#else +inline String x_chr(int64 ascii) { + FUNCTION_INJECTION(chr); + return f_chr(ascii); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_ord f_ord +#else +inline int64 x_ord(CStrRef str) { + FUNCTION_INJECTION(ord); + return f_ord(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_money_format f_money_format +#else +inline String x_money_format(CStrRef format, double number) { + FUNCTION_INJECTION(money_format); + return f_money_format(format, number); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_number_format f_number_format +#else +inline String x_number_format(double number, int decimals = 0, CStrRef dec_point = ".", CStrRef thousands_sep = ",") { + FUNCTION_INJECTION(number_format); + return f_number_format(number, decimals, dec_point, thousands_sep); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strcmp f_strcmp +#else +inline int x_strcmp(CStrRef str1, CStrRef str2) { + FUNCTION_INJECTION(strcmp); + return f_strcmp(str1, str2); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strncmp f_strncmp +#else +inline int x_strncmp(CStrRef str1, CStrRef str2, int len) { + FUNCTION_INJECTION(strncmp); + return f_strncmp(str1, str2, len); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strnatcmp f_strnatcmp +#else +inline int x_strnatcmp(CStrRef str1, CStrRef str2) { + FUNCTION_INJECTION(strnatcmp); + return f_strnatcmp(str1, str2); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strcasecmp f_strcasecmp +#else +inline int x_strcasecmp(CStrRef str1, CStrRef str2) { + FUNCTION_INJECTION(strcasecmp); + return f_strcasecmp(str1, str2); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strncasecmp f_strncasecmp +#else +inline int x_strncasecmp(CStrRef str1, CStrRef str2, int len) { + FUNCTION_INJECTION(strncasecmp); + return f_strncasecmp(str1, str2, len); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strnatcasecmp f_strnatcasecmp +#else +inline int x_strnatcasecmp(CStrRef str1, CStrRef str2) { + FUNCTION_INJECTION(strnatcasecmp); + return f_strnatcasecmp(str1, str2); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strcoll f_strcoll +#else +inline int x_strcoll(CStrRef str1, CStrRef str2) { + FUNCTION_INJECTION(strcoll); + return f_strcoll(str1, str2); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_substr_compare f_substr_compare +#else +inline Variant x_substr_compare(CStrRef main_str, CStrRef str, int offset, int length = 0, bool case_insensitivity = false) { + FUNCTION_INJECTION(substr_compare); + return f_substr_compare(main_str, str, offset, length, case_insensitivity); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strchr f_strchr +#else +inline Variant x_strchr(CStrRef haystack, CVarRef needle) { + FUNCTION_INJECTION(strchr); + return f_strchr(haystack, needle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strrchr f_strrchr +#else +inline Variant x_strrchr(CStrRef haystack, CVarRef needle) { + FUNCTION_INJECTION(strrchr); + return f_strrchr(haystack, needle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strstr f_strstr +#else +inline Variant x_strstr(CStrRef haystack, CVarRef needle) { + FUNCTION_INJECTION(strstr); + return f_strstr(haystack, needle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stristr f_stristr +#else +inline Variant x_stristr(CStrRef haystack, CVarRef needle) { + FUNCTION_INJECTION(stristr); + return f_stristr(haystack, needle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strpbrk f_strpbrk +#else +inline Variant x_strpbrk(CStrRef haystack, CStrRef char_list) { + FUNCTION_INJECTION(strpbrk); + return f_strpbrk(haystack, char_list); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strpos f_strpos +#else +inline Variant x_strpos(CStrRef haystack, CVarRef needle, int offset = 0) { + FUNCTION_INJECTION(strpos); + return f_strpos(haystack, needle, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_stripos f_stripos +#else +inline Variant x_stripos(CStrRef haystack, CVarRef needle, int offset = 0) { + FUNCTION_INJECTION(stripos); + return f_stripos(haystack, needle, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strrpos f_strrpos +#else +inline Variant x_strrpos(CStrRef haystack, CVarRef needle, int offset = -1) { + FUNCTION_INJECTION(strrpos); + return f_strrpos(haystack, needle, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strripos f_strripos +#else +inline Variant x_strripos(CStrRef haystack, CVarRef needle, int offset = -1) { + FUNCTION_INJECTION(strripos); + return f_strripos(haystack, needle, offset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_substr_count f_substr_count +#else +inline Variant x_substr_count(CStrRef haystack, CStrRef needle, int offset = 0, int length = 0x7FFFFFFF) { + FUNCTION_INJECTION(substr_count); + return f_substr_count(haystack, needle, offset, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strspn f_strspn +#else +inline Variant x_strspn(CStrRef str1, CStrRef str2, int start = 0, int length = 0x7FFFFFFF) { + FUNCTION_INJECTION(strspn); + return f_strspn(str1, str2, start, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strcspn f_strcspn +#else +inline Variant x_strcspn(CStrRef str1, CStrRef str2, int start = 0, int length = 0x7FFFFFFF) { + FUNCTION_INJECTION(strcspn); + return f_strcspn(str1, str2, start, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strlen f_strlen +#else +inline int x_strlen(CStrRef str) { + FUNCTION_INJECTION(strlen); + return f_strlen(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_count_chars f_count_chars +#else +inline Variant x_count_chars(CStrRef str, int64 mode = 0) { + FUNCTION_INJECTION(count_chars); + return f_count_chars(str, mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_str_word_count f_str_word_count +#else +inline Variant x_str_word_count(CStrRef str, int64 format = 0, CStrRef charlist = "") { + FUNCTION_INJECTION(str_word_count); + return f_str_word_count(str, format, charlist); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_levenshtein f_levenshtein +#else +inline int x_levenshtein(CStrRef str1, CStrRef str2, int cost_ins = 1, int cost_rep = 1, int cost_del = 1) { + FUNCTION_INJECTION(levenshtein); + return f_levenshtein(str1, str2, cost_ins, cost_rep, cost_del); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_similar_text f_similar_text +#else +inline int x_similar_text(CStrRef first, CStrRef second, Variant percent = null) { + FUNCTION_INJECTION(similar_text); + return f_similar_text(first, second, ref(percent)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_soundex f_soundex +#else +inline Variant x_soundex(CStrRef str) { + FUNCTION_INJECTION(soundex); + return f_soundex(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_metaphone f_metaphone +#else +inline Variant x_metaphone(CStrRef str, int phones = 0) { + FUNCTION_INJECTION(metaphone); + return f_metaphone(str, phones); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_parse_str f_parse_str +#else +inline void x_parse_str(CStrRef str, Variant arr = null) { + FUNCTION_INJECTION(parse_str); + f_parse_str(str, ref(arr)); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_STRING_H__ diff --git a/src/cpp/ext/profile/extprofile_thread.h b/src/cpp/ext/profile/extprofile_thread.h new file mode 100644 index 0000000000000..38ac1fc2f18fb --- /dev/null +++ b/src/cpp/ext/profile/extprofile_thread.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_THREAD_H__ +#define __EXTPROFILE_THREAD_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_hphp_service_thread_started f_hphp_service_thread_started +#else +inline void x_hphp_service_thread_started() { + FUNCTION_INJECTION(hphp_service_thread_started); + f_hphp_service_thread_started(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_thread_is_warmup_enabled f_hphp_thread_is_warmup_enabled +#else +inline bool x_hphp_thread_is_warmup_enabled() { + FUNCTION_INJECTION(hphp_thread_is_warmup_enabled); + return f_hphp_thread_is_warmup_enabled(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_hphp_thread_set_warmup_enabled f_hphp_thread_set_warmup_enabled +#else +inline void x_hphp_thread_set_warmup_enabled() { + FUNCTION_INJECTION(hphp_thread_set_warmup_enabled); + f_hphp_thread_set_warmup_enabled(); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_THREAD_H__ diff --git a/src/cpp/ext/profile/extprofile_thrift.h b/src/cpp/ext/profile/extprofile_thrift.h new file mode 100644 index 0000000000000..32014d9cd8607 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_thrift.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_THRIFT_H__ +#define __EXTPROFILE_THRIFT_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_thrift_protocol_write_binary f_thrift_protocol_write_binary +#else +inline void x_thrift_protocol_write_binary(CObjRef transportobj, CStrRef method_name, int64 msgtype, CObjRef request_struct, int seqid, bool strict_write) { + FUNCTION_INJECTION(thrift_protocol_write_binary); + f_thrift_protocol_write_binary(transportobj, method_name, msgtype, request_struct, seqid, strict_write); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_thrift_protocol_read_binary f_thrift_protocol_read_binary +#else +inline Variant x_thrift_protocol_read_binary(CObjRef transportobj, CStrRef obj_typename, bool strict_read) { + FUNCTION_INJECTION(thrift_protocol_read_binary); + return f_thrift_protocol_read_binary(transportobj, obj_typename, strict_read); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_THRIFT_H__ diff --git a/src/cpp/ext/profile/extprofile_url.h b/src/cpp/ext/profile/extprofile_url.h new file mode 100644 index 0000000000000..b7a5aad009412 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_url.h @@ -0,0 +1,122 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_URL_H__ +#define __EXTPROFILE_URL_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_base64_decode f_base64_decode +#else +inline Variant x_base64_decode(CStrRef data, bool strict = false) { + FUNCTION_INJECTION(base64_decode); + return f_base64_decode(data, strict); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_base64_encode f_base64_encode +#else +inline String x_base64_encode(CStrRef data) { + FUNCTION_INJECTION(base64_encode); + return f_base64_encode(data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_headers f_get_headers +#else +inline Variant x_get_headers(CStrRef url, int format = 0) { + FUNCTION_INJECTION(get_headers); + return f_get_headers(url, format); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_meta_tags f_get_meta_tags +#else +inline Array x_get_meta_tags(CStrRef filename, bool use_include_path = false) { + FUNCTION_INJECTION(get_meta_tags); + return f_get_meta_tags(filename, use_include_path); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_http_build_query f_http_build_query +#else +inline String x_http_build_query(CVarRef formdata, CStrRef numeric_prefix = null_string, CStrRef arg_separator = "&") { + FUNCTION_INJECTION(http_build_query); + return f_http_build_query(formdata, numeric_prefix, arg_separator); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_parse_url f_parse_url +#else +inline Variant x_parse_url(CStrRef url, int component = -1) { + FUNCTION_INJECTION(parse_url); + return f_parse_url(url, component); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rawurldecode f_rawurldecode +#else +inline String x_rawurldecode(CStrRef str) { + FUNCTION_INJECTION(rawurldecode); + return f_rawurldecode(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_rawurlencode f_rawurlencode +#else +inline String x_rawurlencode(CStrRef str) { + FUNCTION_INJECTION(rawurlencode); + return f_rawurlencode(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_urldecode f_urldecode +#else +inline String x_urldecode(CStrRef str) { + FUNCTION_INJECTION(urldecode); + return f_urldecode(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_urlencode f_urlencode +#else +inline String x_urlencode(CStrRef str) { + FUNCTION_INJECTION(urlencode); + return f_urlencode(str); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_URL_H__ diff --git a/src/cpp/ext/profile/extprofile_variable.h b/src/cpp/ext/profile/extprofile_variable.h new file mode 100644 index 0000000000000..162c638f12918 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_variable.h @@ -0,0 +1,302 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_VARIABLE_H__ +#define __EXTPROFILE_VARIABLE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_is_bool f_is_bool +#else +inline bool x_is_bool(CVarRef var) { + FUNCTION_INJECTION(is_bool); + return f_is_bool(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_int f_is_int +#else +inline bool x_is_int(CVarRef var) { + FUNCTION_INJECTION(is_int); + return f_is_int(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_integer f_is_integer +#else +inline bool x_is_integer(CVarRef var) { + FUNCTION_INJECTION(is_integer); + return f_is_integer(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_long f_is_long +#else +inline bool x_is_long(CVarRef var) { + FUNCTION_INJECTION(is_long); + return f_is_long(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_double f_is_double +#else +inline bool x_is_double(CVarRef var) { + FUNCTION_INJECTION(is_double); + return f_is_double(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_float f_is_float +#else +inline bool x_is_float(CVarRef var) { + FUNCTION_INJECTION(is_float); + return f_is_float(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_numeric f_is_numeric +#else +inline bool x_is_numeric(CVarRef var) { + FUNCTION_INJECTION(is_numeric); + return f_is_numeric(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_real f_is_real +#else +inline bool x_is_real(CVarRef var) { + FUNCTION_INJECTION(is_real); + return f_is_real(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_string f_is_string +#else +inline bool x_is_string(CVarRef var) { + FUNCTION_INJECTION(is_string); + return f_is_string(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_scalar f_is_scalar +#else +inline bool x_is_scalar(CVarRef var) { + FUNCTION_INJECTION(is_scalar); + return f_is_scalar(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_array f_is_array +#else +inline bool x_is_array(CVarRef var) { + FUNCTION_INJECTION(is_array); + return f_is_array(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_object f_is_object +#else +inline bool x_is_object(CVarRef var) { + FUNCTION_INJECTION(is_object); + return f_is_object(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_resource f_is_resource +#else +inline bool x_is_resource(CVarRef var) { + FUNCTION_INJECTION(is_resource); + return f_is_resource(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_is_null f_is_null +#else +inline bool x_is_null(CVarRef var) { + FUNCTION_INJECTION(is_null); + return f_is_null(var); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gettype f_gettype +#else +inline String x_gettype(CVarRef v) { + FUNCTION_INJECTION(gettype); + return f_gettype(v); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_resource_type f_get_resource_type +#else +inline String x_get_resource_type(CObjRef handle) { + FUNCTION_INJECTION(get_resource_type); + return f_get_resource_type(handle); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_intval f_intval +#else +inline int64 x_intval(CVarRef v, int64 base = 10) { + FUNCTION_INJECTION(intval); + return f_intval(v, base); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_doubleval f_doubleval +#else +inline double x_doubleval(CVarRef v) { + FUNCTION_INJECTION(doubleval); + return f_doubleval(v); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_floatval f_floatval +#else +inline double x_floatval(CVarRef v) { + FUNCTION_INJECTION(floatval); + return f_floatval(v); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_strval f_strval +#else +inline String x_strval(CVarRef v) { + FUNCTION_INJECTION(strval); + return f_strval(v); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_settype f_settype +#else +inline bool x_settype(Variant var, CStrRef type) { + FUNCTION_INJECTION(settype); + return f_settype(ref(var), type); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_print_r f_print_r +#else +inline Variant x_print_r(CVarRef expression, bool ret = false) { + FUNCTION_INJECTION(print_r); + return f_print_r(expression, ret); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_var_export f_var_export +#else +inline Variant x_var_export(CVarRef expression, bool ret = false) { + FUNCTION_INJECTION(var_export); + return f_var_export(expression, ret); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_var_dump f_var_dump +#else +inline void x_var_dump(int _argc, CVarRef expression, CArrRef _argv = null_array) { + FUNCTION_INJECTION(var_dump); + f_var_dump(_argc, expression, _argv); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_debug_zval_dump f_debug_zval_dump +#else +inline void x_debug_zval_dump(CVarRef variable) { + FUNCTION_INJECTION(debug_zval_dump); + f_debug_zval_dump(variable); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_serialize f_serialize +#else +inline String x_serialize(CVarRef value) { + FUNCTION_INJECTION(serialize); + return f_serialize(value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_unserialize f_unserialize +#else +inline Variant x_unserialize(CStrRef str) { + FUNCTION_INJECTION(unserialize); + return f_unserialize(str); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_get_defined_vars f_get_defined_vars +#else +inline Array x_get_defined_vars() { + FUNCTION_INJECTION(get_defined_vars); + return f_get_defined_vars(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_import_request_variables f_import_request_variables +#else +inline bool x_import_request_variables(CStrRef types, CStrRef prefix = "") { + FUNCTION_INJECTION(import_request_variables); + return f_import_request_variables(types, prefix); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_extract f_extract +#else +inline int x_extract(CArrRef var_array, int extract_type = EXTR_OVERWRITE, CStrRef prefix = "") { + FUNCTION_INJECTION(extract); + return f_extract(var_array, extract_type, prefix); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_VARIABLE_H__ diff --git a/src/cpp/ext/profile/extprofile_xml.h b/src/cpp/ext/profile/extprofile_xml.h new file mode 100644 index 0000000000000..f52173901c3dc --- /dev/null +++ b/src/cpp/ext/profile/extprofile_xml.h @@ -0,0 +1,248 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_XML_H__ +#define __EXTPROFILE_XML_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_xml_parser_create f_xml_parser_create +#else +inline Object x_xml_parser_create(CStrRef encoding = null_string) { + FUNCTION_INJECTION(xml_parser_create); + return f_xml_parser_create(encoding); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_parser_free f_xml_parser_free +#else +inline bool x_xml_parser_free(CObjRef parser) { + FUNCTION_INJECTION(xml_parser_free); + return f_xml_parser_free(parser); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_parse f_xml_parse +#else +inline int x_xml_parse(CObjRef parser, CStrRef data, bool is_final = true) { + FUNCTION_INJECTION(xml_parse); + return f_xml_parse(parser, data, is_final); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_parse_into_struct f_xml_parse_into_struct +#else +inline int x_xml_parse_into_struct(CObjRef parser, CStrRef data, Variant values, Variant index = null) { + FUNCTION_INJECTION(xml_parse_into_struct); + return f_xml_parse_into_struct(parser, data, ref(values), ref(index)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_parser_create_ns f_xml_parser_create_ns +#else +inline Object x_xml_parser_create_ns(CStrRef encoding = null_string, CStrRef separator = null_string) { + FUNCTION_INJECTION(xml_parser_create_ns); + return f_xml_parser_create_ns(encoding, separator); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_parser_get_option f_xml_parser_get_option +#else +inline Variant x_xml_parser_get_option(CObjRef parser, int option) { + FUNCTION_INJECTION(xml_parser_get_option); + return f_xml_parser_get_option(parser, option); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_parser_set_option f_xml_parser_set_option +#else +inline bool x_xml_parser_set_option(CObjRef parser, int option, CVarRef value) { + FUNCTION_INJECTION(xml_parser_set_option); + return f_xml_parser_set_option(parser, option, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_set_character_data_handler f_xml_set_character_data_handler +#else +inline bool x_xml_set_character_data_handler(CObjRef parser, CStrRef handler) { + FUNCTION_INJECTION(xml_set_character_data_handler); + return f_xml_set_character_data_handler(parser, handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_set_default_handler f_xml_set_default_handler +#else +inline bool x_xml_set_default_handler(CObjRef parser, CStrRef handler) { + FUNCTION_INJECTION(xml_set_default_handler); + return f_xml_set_default_handler(parser, handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_set_element_handler f_xml_set_element_handler +#else +inline bool x_xml_set_element_handler(CObjRef parser, CStrRef start_element_handler, CStrRef end_element_handler) { + FUNCTION_INJECTION(xml_set_element_handler); + return f_xml_set_element_handler(parser, start_element_handler, end_element_handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_set_processing_instruction_handler f_xml_set_processing_instruction_handler +#else +inline bool x_xml_set_processing_instruction_handler(CObjRef parser, CStrRef handler) { + FUNCTION_INJECTION(xml_set_processing_instruction_handler); + return f_xml_set_processing_instruction_handler(parser, handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_set_start_namespace_decl_handler f_xml_set_start_namespace_decl_handler +#else +inline bool x_xml_set_start_namespace_decl_handler(CObjRef parser, CStrRef handler) { + FUNCTION_INJECTION(xml_set_start_namespace_decl_handler); + return f_xml_set_start_namespace_decl_handler(parser, handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_set_end_namespace_decl_handler f_xml_set_end_namespace_decl_handler +#else +inline bool x_xml_set_end_namespace_decl_handler(CObjRef parser, CStrRef handler) { + FUNCTION_INJECTION(xml_set_end_namespace_decl_handler); + return f_xml_set_end_namespace_decl_handler(parser, handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_set_unparsed_entity_decl_handler f_xml_set_unparsed_entity_decl_handler +#else +inline bool x_xml_set_unparsed_entity_decl_handler(CObjRef parser, CStrRef handler) { + FUNCTION_INJECTION(xml_set_unparsed_entity_decl_handler); + return f_xml_set_unparsed_entity_decl_handler(parser, handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_set_external_entity_ref_handler f_xml_set_external_entity_ref_handler +#else +inline bool x_xml_set_external_entity_ref_handler(CObjRef parser, CStrRef handler) { + FUNCTION_INJECTION(xml_set_external_entity_ref_handler); + return f_xml_set_external_entity_ref_handler(parser, handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_set_notation_decl_handler f_xml_set_notation_decl_handler +#else +inline bool x_xml_set_notation_decl_handler(CObjRef parser, CStrRef handler) { + FUNCTION_INJECTION(xml_set_notation_decl_handler); + return f_xml_set_notation_decl_handler(parser, handler); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_set_object f_xml_set_object +#else +inline bool x_xml_set_object(CObjRef parser, Variant object) { + FUNCTION_INJECTION(xml_set_object); + return f_xml_set_object(parser, ref(object)); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_get_current_byte_index f_xml_get_current_byte_index +#else +inline int x_xml_get_current_byte_index(CObjRef parser) { + FUNCTION_INJECTION(xml_get_current_byte_index); + return f_xml_get_current_byte_index(parser); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_get_current_column_number f_xml_get_current_column_number +#else +inline int x_xml_get_current_column_number(CObjRef parser) { + FUNCTION_INJECTION(xml_get_current_column_number); + return f_xml_get_current_column_number(parser); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_get_current_line_number f_xml_get_current_line_number +#else +inline int x_xml_get_current_line_number(CObjRef parser) { + FUNCTION_INJECTION(xml_get_current_line_number); + return f_xml_get_current_line_number(parser); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_get_error_code f_xml_get_error_code +#else +inline int x_xml_get_error_code(CObjRef parser) { + FUNCTION_INJECTION(xml_get_error_code); + return f_xml_get_error_code(parser); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xml_error_string f_xml_error_string +#else +inline String x_xml_error_string(int code) { + FUNCTION_INJECTION(xml_error_string); + return f_xml_error_string(code); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_utf8_decode f_utf8_decode +#else +inline String x_utf8_decode(CStrRef data) { + FUNCTION_INJECTION(utf8_decode); + return f_utf8_decode(data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_utf8_encode f_utf8_encode +#else +inline String x_utf8_encode(CStrRef data) { + FUNCTION_INJECTION(utf8_encode); + return f_utf8_encode(data); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_XML_H__ diff --git a/src/cpp/ext/profile/extprofile_xmlwriter.h b/src/cpp/ext/profile/extprofile_xmlwriter.h new file mode 100644 index 0000000000000..7c19704db8d59 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_xmlwriter.h @@ -0,0 +1,394 @@ + +#ifndef __EXTPROFILE_XMLWRITER_H__ +#define __EXTPROFILE_XMLWRITER_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_open_memory f_xmlwriter_open_memory +#else +inline Variant x_xmlwriter_open_memory() { + FUNCTION_INJECTION(xmlwriter_open_memory); + return f_xmlwriter_open_memory(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_open_uri f_xmlwriter_open_uri +#else +inline Object x_xmlwriter_open_uri(CStrRef uri) { + FUNCTION_INJECTION(xmlwriter_open_uri); + return f_xmlwriter_open_uri(uri); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_set_indent_string f_xmlwriter_set_indent_string +#else +inline bool x_xmlwriter_set_indent_string(CObjRef xmlwriter, CStrRef indentstring) { + FUNCTION_INJECTION(xmlwriter_set_indent_string); + return f_xmlwriter_set_indent_string(xmlwriter, indentstring); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_set_indent f_xmlwriter_set_indent +#else +inline bool x_xmlwriter_set_indent(CObjRef xmlwriter, bool indent) { + FUNCTION_INJECTION(xmlwriter_set_indent); + return f_xmlwriter_set_indent(xmlwriter, indent); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_document f_xmlwriter_start_document +#else +inline bool x_xmlwriter_start_document(CObjRef xmlwriter, CStrRef version = "1.0", CStrRef encoding = null_string, CStrRef standalone = null_string) { + FUNCTION_INJECTION(xmlwriter_start_document); + return f_xmlwriter_start_document(xmlwriter, version, encoding, standalone); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_element f_xmlwriter_start_element +#else +inline bool x_xmlwriter_start_element(CObjRef xmlwriter, CStrRef name) { + FUNCTION_INJECTION(xmlwriter_start_element); + return f_xmlwriter_start_element(xmlwriter, name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_element_ns f_xmlwriter_start_element_ns +#else +inline bool x_xmlwriter_start_element_ns(CObjRef xmlwriter, CStrRef prefix, CStrRef name, CStrRef uri) { + FUNCTION_INJECTION(xmlwriter_start_element_ns); + return f_xmlwriter_start_element_ns(xmlwriter, prefix, name, uri); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_element_ns f_xmlwriter_write_element_ns +#else +inline bool x_xmlwriter_write_element_ns(CObjRef xmlwriter, CStrRef prefix, CStrRef name, CStrRef uri, CStrRef content = null_string) { + FUNCTION_INJECTION(xmlwriter_write_element_ns); + return f_xmlwriter_write_element_ns(xmlwriter, prefix, name, uri, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_element f_xmlwriter_write_element +#else +inline bool x_xmlwriter_write_element(CObjRef xmlwriter, CStrRef name, CStrRef content = null_string) { + FUNCTION_INJECTION(xmlwriter_write_element); + return f_xmlwriter_write_element(xmlwriter, name, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_end_element f_xmlwriter_end_element +#else +inline bool x_xmlwriter_end_element(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_end_element); + return f_xmlwriter_end_element(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_full_end_element f_xmlwriter_full_end_element +#else +inline bool x_xmlwriter_full_end_element(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_full_end_element); + return f_xmlwriter_full_end_element(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_attribute_ns f_xmlwriter_start_attribute_ns +#else +inline bool x_xmlwriter_start_attribute_ns(CObjRef xmlwriter, CStrRef prefix, CStrRef name, CStrRef uri) { + FUNCTION_INJECTION(xmlwriter_start_attribute_ns); + return f_xmlwriter_start_attribute_ns(xmlwriter, prefix, name, uri); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_attribute f_xmlwriter_start_attribute +#else +inline bool x_xmlwriter_start_attribute(CObjRef xmlwriter, CStrRef name) { + FUNCTION_INJECTION(xmlwriter_start_attribute); + return f_xmlwriter_start_attribute(xmlwriter, name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_attribute_ns f_xmlwriter_write_attribute_ns +#else +inline bool x_xmlwriter_write_attribute_ns(CObjRef xmlwriter, CStrRef prefix, CStrRef name, CStrRef uri, CStrRef content) { + FUNCTION_INJECTION(xmlwriter_write_attribute_ns); + return f_xmlwriter_write_attribute_ns(xmlwriter, prefix, name, uri, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_attribute f_xmlwriter_write_attribute +#else +inline bool x_xmlwriter_write_attribute(CObjRef xmlwriter, CStrRef name, CStrRef value) { + FUNCTION_INJECTION(xmlwriter_write_attribute); + return f_xmlwriter_write_attribute(xmlwriter, name, value); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_end_attribute f_xmlwriter_end_attribute +#else +inline bool x_xmlwriter_end_attribute(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_end_attribute); + return f_xmlwriter_end_attribute(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_cdata f_xmlwriter_start_cdata +#else +inline bool x_xmlwriter_start_cdata(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_start_cdata); + return f_xmlwriter_start_cdata(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_cdata f_xmlwriter_write_cdata +#else +inline bool x_xmlwriter_write_cdata(CObjRef xmlwriter, CStrRef content) { + FUNCTION_INJECTION(xmlwriter_write_cdata); + return f_xmlwriter_write_cdata(xmlwriter, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_end_cdata f_xmlwriter_end_cdata +#else +inline bool x_xmlwriter_end_cdata(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_end_cdata); + return f_xmlwriter_end_cdata(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_comment f_xmlwriter_start_comment +#else +inline bool x_xmlwriter_start_comment(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_start_comment); + return f_xmlwriter_start_comment(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_comment f_xmlwriter_write_comment +#else +inline bool x_xmlwriter_write_comment(CObjRef xmlwriter, CStrRef content) { + FUNCTION_INJECTION(xmlwriter_write_comment); + return f_xmlwriter_write_comment(xmlwriter, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_end_comment f_xmlwriter_end_comment +#else +inline bool x_xmlwriter_end_comment(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_end_comment); + return f_xmlwriter_end_comment(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_end_document f_xmlwriter_end_document +#else +inline bool x_xmlwriter_end_document(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_end_document); + return f_xmlwriter_end_document(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_pi f_xmlwriter_start_pi +#else +inline bool x_xmlwriter_start_pi(CObjRef xmlwriter, CStrRef target) { + FUNCTION_INJECTION(xmlwriter_start_pi); + return f_xmlwriter_start_pi(xmlwriter, target); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_pi f_xmlwriter_write_pi +#else +inline bool x_xmlwriter_write_pi(CObjRef xmlwriter, CStrRef target, CStrRef content) { + FUNCTION_INJECTION(xmlwriter_write_pi); + return f_xmlwriter_write_pi(xmlwriter, target, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_end_pi f_xmlwriter_end_pi +#else +inline bool x_xmlwriter_end_pi(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_end_pi); + return f_xmlwriter_end_pi(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_text f_xmlwriter_text +#else +inline bool x_xmlwriter_text(CObjRef xmlwriter, CStrRef content) { + FUNCTION_INJECTION(xmlwriter_text); + return f_xmlwriter_text(xmlwriter, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_raw f_xmlwriter_write_raw +#else +inline bool x_xmlwriter_write_raw(CObjRef xmlwriter, CStrRef content) { + FUNCTION_INJECTION(xmlwriter_write_raw); + return f_xmlwriter_write_raw(xmlwriter, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_dtd f_xmlwriter_start_dtd +#else +inline bool x_xmlwriter_start_dtd(CObjRef xmlwriter, CStrRef qualifiedname, CStrRef publicid = null_string, CStrRef systemid = null_string) { + FUNCTION_INJECTION(xmlwriter_start_dtd); + return f_xmlwriter_start_dtd(xmlwriter, qualifiedname, publicid, systemid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_dtd f_xmlwriter_write_dtd +#else +inline bool x_xmlwriter_write_dtd(CObjRef xmlwriter, CStrRef name, CStrRef publicid = null_string, CStrRef systemid = null_string, CStrRef subset = null_string) { + FUNCTION_INJECTION(xmlwriter_write_dtd); + return f_xmlwriter_write_dtd(xmlwriter, name, publicid, systemid, subset); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_dtd_element f_xmlwriter_start_dtd_element +#else +inline bool x_xmlwriter_start_dtd_element(CObjRef xmlwriter, CStrRef qualifiedname) { + FUNCTION_INJECTION(xmlwriter_start_dtd_element); + return f_xmlwriter_start_dtd_element(xmlwriter, qualifiedname); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_dtd_element f_xmlwriter_write_dtd_element +#else +inline bool x_xmlwriter_write_dtd_element(CObjRef xmlwriter, CStrRef name, CStrRef content) { + FUNCTION_INJECTION(xmlwriter_write_dtd_element); + return f_xmlwriter_write_dtd_element(xmlwriter, name, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_end_dtd_element f_xmlwriter_end_dtd_element +#else +inline bool x_xmlwriter_end_dtd_element(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_end_dtd_element); + return f_xmlwriter_end_dtd_element(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_dtd_attlist f_xmlwriter_start_dtd_attlist +#else +inline bool x_xmlwriter_start_dtd_attlist(CObjRef xmlwriter, CStrRef name) { + FUNCTION_INJECTION(xmlwriter_start_dtd_attlist); + return f_xmlwriter_start_dtd_attlist(xmlwriter, name); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_dtd_attlist f_xmlwriter_write_dtd_attlist +#else +inline bool x_xmlwriter_write_dtd_attlist(CObjRef xmlwriter, CStrRef name, CStrRef content) { + FUNCTION_INJECTION(xmlwriter_write_dtd_attlist); + return f_xmlwriter_write_dtd_attlist(xmlwriter, name, content); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_end_dtd_attlist f_xmlwriter_end_dtd_attlist +#else +inline bool x_xmlwriter_end_dtd_attlist(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_end_dtd_attlist); + return f_xmlwriter_end_dtd_attlist(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_start_dtd_entity f_xmlwriter_start_dtd_entity +#else +inline bool x_xmlwriter_start_dtd_entity(CObjRef xmlwriter, CStrRef name, bool isparam) { + FUNCTION_INJECTION(xmlwriter_start_dtd_entity); + return f_xmlwriter_start_dtd_entity(xmlwriter, name, isparam); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_write_dtd_entity f_xmlwriter_write_dtd_entity +#else +inline bool x_xmlwriter_write_dtd_entity(CObjRef xmlwriter, CStrRef name, CStrRef content, bool pe = false, CStrRef publicid = null_string, CStrRef systemid = null_string, CStrRef ndataid = null_string) { + FUNCTION_INJECTION(xmlwriter_write_dtd_entity); + return f_xmlwriter_write_dtd_entity(xmlwriter, name, content, pe, publicid, systemid, ndataid); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_end_dtd_entity f_xmlwriter_end_dtd_entity +#else +inline bool x_xmlwriter_end_dtd_entity(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_end_dtd_entity); + return f_xmlwriter_end_dtd_entity(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_end_dtd f_xmlwriter_end_dtd +#else +inline bool x_xmlwriter_end_dtd(CObjRef xmlwriter) { + FUNCTION_INJECTION(xmlwriter_end_dtd); + return f_xmlwriter_end_dtd(xmlwriter); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_flush f_xmlwriter_flush +#else +inline Variant x_xmlwriter_flush(CObjRef xmlwriter, bool empty = true) { + FUNCTION_INJECTION(xmlwriter_flush); + return f_xmlwriter_flush(xmlwriter, empty); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_xmlwriter_output_memory f_xmlwriter_output_memory +#else +inline String x_xmlwriter_output_memory(CObjRef xmlwriter, bool flush = true) { + FUNCTION_INJECTION(xmlwriter_output_memory); + return f_xmlwriter_output_memory(xmlwriter, flush); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_XMLWRITER_H__ diff --git a/src/cpp/ext/profile/extprofile_zlib.h b/src/cpp/ext/profile/extprofile_zlib.h new file mode 100644 index 0000000000000..aef77f18bdd89 --- /dev/null +++ b/src/cpp/ext/profile/extprofile_zlib.h @@ -0,0 +1,230 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXTPROFILE_ZLIB_H__ +#define __EXTPROFILE_ZLIB_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +#ifndef PROFILE_BUILTIN +#define x_readgzfile f_readgzfile +#else +inline Variant x_readgzfile(CStrRef filename, bool use_include_path = false) { + FUNCTION_INJECTION(readgzfile); + return f_readgzfile(filename, use_include_path); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzfile f_gzfile +#else +inline Variant x_gzfile(CStrRef filename, bool use_include_path = false) { + FUNCTION_INJECTION(gzfile); + return f_gzfile(filename, use_include_path); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzcompress f_gzcompress +#else +inline Variant x_gzcompress(CStrRef data, int level = -1) { + FUNCTION_INJECTION(gzcompress); + return f_gzcompress(data, level); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzuncompress f_gzuncompress +#else +inline Variant x_gzuncompress(CStrRef data, int limit = 0) { + FUNCTION_INJECTION(gzuncompress); + return f_gzuncompress(data, limit); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzdeflate f_gzdeflate +#else +inline Variant x_gzdeflate(CStrRef data, int level = -1) { + FUNCTION_INJECTION(gzdeflate); + return f_gzdeflate(data, level); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzinflate f_gzinflate +#else +inline Variant x_gzinflate(CStrRef data, int limit = 0) { + FUNCTION_INJECTION(gzinflate); + return f_gzinflate(data, limit); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzencode f_gzencode +#else +inline Variant x_gzencode(CStrRef data, int level = -1, int encoding_mode = k_FORCE_GZIP) { + FUNCTION_INJECTION(gzencode); + return f_gzencode(data, level, encoding_mode); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzdecode f_gzdecode +#else +inline Variant x_gzdecode(CStrRef data) { + FUNCTION_INJECTION(gzdecode); + return f_gzdecode(data); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_zlib_get_coding_type f_zlib_get_coding_type +#else +inline String x_zlib_get_coding_type() { + FUNCTION_INJECTION(zlib_get_coding_type); + return f_zlib_get_coding_type(); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzopen f_gzopen +#else +inline Object x_gzopen(CStrRef filename, CStrRef mode, bool use_include_path = false) { + FUNCTION_INJECTION(gzopen); + return f_gzopen(filename, mode, use_include_path); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzclose f_gzclose +#else +inline bool x_gzclose(CObjRef zp) { + FUNCTION_INJECTION(gzclose); + return f_gzclose(zp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzrewind f_gzrewind +#else +inline bool x_gzrewind(CObjRef zp) { + FUNCTION_INJECTION(gzrewind); + return f_gzrewind(zp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzeof f_gzeof +#else +inline bool x_gzeof(CObjRef zp) { + FUNCTION_INJECTION(gzeof); + return f_gzeof(zp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzgetc f_gzgetc +#else +inline Variant x_gzgetc(CObjRef zp) { + FUNCTION_INJECTION(gzgetc); + return f_gzgetc(zp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzgets f_gzgets +#else +inline String x_gzgets(CObjRef zp, int64 length = 1024) { + FUNCTION_INJECTION(gzgets); + return f_gzgets(zp, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzgetss f_gzgetss +#else +inline String x_gzgetss(CObjRef zp, int64 length = 0, CStrRef allowable_tags = null_string) { + FUNCTION_INJECTION(gzgetss); + return f_gzgetss(zp, length, allowable_tags); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzread f_gzread +#else +inline Variant x_gzread(CObjRef zp, int64 length = 0) { + FUNCTION_INJECTION(gzread); + return f_gzread(zp, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzpassthru f_gzpassthru +#else +inline Variant x_gzpassthru(CObjRef zp) { + FUNCTION_INJECTION(gzpassthru); + return f_gzpassthru(zp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzseek f_gzseek +#else +inline Variant x_gzseek(CObjRef zp, int64 offset, int64 whence = SEEK_SET) { + FUNCTION_INJECTION(gzseek); + return f_gzseek(zp, offset, whence); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gztell f_gztell +#else +inline Variant x_gztell(CObjRef zp) { + FUNCTION_INJECTION(gztell); + return f_gztell(zp); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzwrite f_gzwrite +#else +inline Variant x_gzwrite(CObjRef zp, CStrRef str, int64 length = 0) { + FUNCTION_INJECTION(gzwrite); + return f_gzwrite(zp, str, length); +} +#endif + +#ifndef PROFILE_BUILTIN +#define x_gzputs f_gzputs +#else +inline Variant x_gzputs(CObjRef zp, CStrRef str, int64 length = 0) { + FUNCTION_INJECTION(gzputs); + return f_gzputs(zp, str, length); +} +#endif + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXTPROFILE_ZLIB_H__ diff --git a/src/cpp/ext/soap/encoding.cpp b/src/cpp/ext/soap/encoding.cpp new file mode 100644 index 0000000000000..bf9617c8f0602 --- /dev/null +++ b/src/cpp/ext/soap/encoding.cpp @@ -0,0 +1,3309 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace std; +using namespace boost; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +bool php_libxml_xmlCheckUTF8(const unsigned char *s) { + int i; + unsigned char c; + + for (i = 0; (c = s[i++]);) { + if ((c & 0x80) == 0) { + } else if ((c & 0xe0) == 0xc0) { + if ((s[i++] & 0xc0) != 0x80) { + return false; + } + } else if ((c & 0xf0) == 0xe0) { + if ((s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80) { + return false; + } + } else if ((c & 0xf8) == 0xf0) { + if ((s[i++] & 0xc0) != 0x80 || (s[i++] & 0xc0) != 0x80 || + (s[i++] & 0xc0) != 0x80) { + return false; + } + } else { + return false; + } + } + return true; +} + +static int zend_strnlen(const char* s, int maxlen) { + int len = 0; + while (*s++ && maxlen--) len++; + return len; +} + +static bool zend_unmangle_property_name(const char *mangled_property, int len, + const char **class_name, + const char **prop_name) { + int class_name_len; + *class_name = NULL; + + if (mangled_property[0]!=0) { + *prop_name = mangled_property; + return true; + } + if (len < 3 || mangled_property[1]==0) { + Logger::Warning("Illegal member variable name"); + *prop_name = mangled_property; + return false; + } + + class_name_len = zend_strnlen(mangled_property+1, --len - 1) + 1; + if (class_name_len >= len || mangled_property[class_name_len]!=0) { + Logger::Warning("Corrupt member variable name"); + *prop_name = mangled_property; + return false; + } + *class_name = mangled_property+1; + *prop_name = (*class_name)+class_name_len; + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +static Variant to_zval_double (encodeTypePtr type, xmlNodePtr data); +static Variant to_zval_long (encodeTypePtr type, xmlNodePtr data); +static Variant to_zval_bool (encodeTypePtr type, xmlNodePtr data); +static Variant to_zval_string (encodeTypePtr type, xmlNodePtr data); +static Variant to_zval_stringr (encodeTypePtr type, xmlNodePtr data); +static Variant to_zval_stringc (encodeTypePtr type, xmlNodePtr data); +static Variant to_zval_map (encodeTypePtr type, xmlNodePtr data); +static Variant to_zval_null (encodeTypePtr type, xmlNodePtr data); +static Variant to_zval_base64 (encodeTypePtr type, xmlNodePtr data); +static Variant to_zval_hexbin (encodeTypePtr type, xmlNodePtr data); + +static xmlNodePtr to_xml_long +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_double +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_bool +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); + +/* String encode */ +static xmlNodePtr to_xml_string +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_base64 +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_hexbin +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); + +/* Null encode */ +static xmlNodePtr to_xml_null +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); + +/* Array encode */ +static xmlNodePtr guess_array_map +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_map +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); + +static xmlNodePtr to_xml_list +(encodeTypePtr enc, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_list1 +(encodeTypePtr enc, CVarRef data, int style, xmlNodePtr parent); + +/* Datetime encode/decode */ +static xmlNodePtr to_xml_datetime_ex +(encodeTypePtr type, CVarRef data, const char *format, int style, + xmlNodePtr parent); +static xmlNodePtr to_xml_datetime +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_time +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_date +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_gyearmonth +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_gyear +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_gmonthday +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_gday +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_gmonth +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_duration +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); + +static Variant to_zval_object(encodeTypePtr type, xmlNodePtr data); +static Variant to_zval_array(encodeTypePtr type, xmlNodePtr data); + +static xmlNodePtr to_xml_object +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); +static xmlNodePtr to_xml_array +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); + +static Variant to_zval_any +(encodeTypePtr type, xmlNodePtr data); +static xmlNodePtr to_xml_any +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); + +/* Try and guess for non-wsdl clients and servers */ +static Variant guess_zval_convert +(encodeTypePtr type, xmlNodePtr data); +static xmlNodePtr guess_xml_convert +(encodeTypePtr type, CVarRef data, int style, xmlNodePtr parent); + +static encodePtr get_array_type +(xmlNodePtr node, CVarRef array, string &out_type); + +static xmlNodePtr check_and_resolve_href(xmlNodePtr data); + +static void set_ns_prop(xmlNodePtr node, const char *ns, const char *name, + const char *val); +static void set_xsi_nil(xmlNodePtr node); +static void set_xsi_type(xmlNodePtr node, const char *type); + +static void get_type_str +(xmlNodePtr node, const char* ns, const char* type, string &ret); +static void set_ns_and_type_ex(xmlNodePtr node, const char *ns, + const char *type); + +static void set_ns_and_type(xmlNodePtr node, encodeTypePtr type); + +#define FIND_XML_NULL(xml, v) \ + { \ + if (!xml) { \ + v.reset(); \ + return v; \ + } \ + if (xml->properties) { \ + xmlAttrPtr n = get_attribute(xml->properties, "nil"); \ + if (n) { \ + v.reset(); \ + return v; \ + } \ + } \ + } + +#define FIND_ZVAL_NULL(v, xml, style) \ + { \ + if (v.isNull()) { \ + if (style == SOAP_ENCODED) { \ + set_xsi_nil(xml); \ + } \ + return xml; \ + } \ + } + +/////////////////////////////////////////////////////////////////////////////// + +encodeStatic s_defaultEncoding[] = { + {UNKNOWN_TYPE, "", "", guess_zval_convert, guess_xml_convert}, + + {KindOfNull, "nil", XSI_NAMESPACE, + to_zval_null, to_xml_null}, + {KindOfBoolean, XSD_BOOLEAN_STRING, XSD_NAMESPACE, + to_zval_bool, to_xml_bool}, + {KindOfByte, XSD_INT_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {KindOfInt16, XSD_INT_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {KindOfInt32, XSD_INT_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {KindOfInt64, XSD_INT_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {KindOfDouble, XSD_FLOAT_STRING, XSD_NAMESPACE, + to_zval_double, to_xml_double}, + {LiteralString, XSD_STRING_STRING, XSD_NAMESPACE, + to_zval_string, to_xml_string}, + {KindOfString, XSD_STRING_STRING, XSD_NAMESPACE, + to_zval_string, to_xml_string}, + {KindOfArray, SOAP_ENC_ARRAY_STRING, SOAP_1_1_ENC_NAMESPACE, + to_zval_array, guess_array_map}, + {KindOfObject, SOAP_ENC_OBJECT_STRING, SOAP_1_1_ENC_NAMESPACE, + to_zval_object, to_xml_object}, + {KindOfArray, SOAP_ENC_ARRAY_STRING, SOAP_1_2_ENC_NAMESPACE, + to_zval_array, guess_array_map}, + {KindOfObject, SOAP_ENC_OBJECT_STRING, SOAP_1_2_ENC_NAMESPACE, + to_zval_object, to_xml_object}, + + {XSD_STRING, XSD_STRING_STRING, XSD_NAMESPACE, + to_zval_string, to_xml_string}, + {XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_NAMESPACE, + to_zval_bool, to_xml_bool}, + {XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_FLOAT, XSD_FLOAT_STRING, XSD_NAMESPACE, + to_zval_double, to_xml_double}, + {XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_NAMESPACE, + to_zval_double, to_xml_double}, + + {XSD_DATETIME, XSD_DATETIME_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_datetime}, + {XSD_TIME, XSD_TIME_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_time}, + {XSD_DATE, XSD_DATE_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_date}, + {XSD_GYEARMONTH, XSD_GYEARMONTH_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_gyearmonth}, + {XSD_GYEAR, XSD_GYEAR_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_gyear}, + {XSD_GMONTHDAY, XSD_GMONTHDAY_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_gmonthday}, + {XSD_GDAY, XSD_GDAY_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_gday}, + {XSD_GMONTH, XSD_GMONTH_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_gmonth}, + {XSD_DURATION, XSD_DURATION_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_duration}, + + {XSD_HEXBINARY, XSD_HEXBINARY_STRING, XSD_NAMESPACE, + to_zval_hexbin, to_xml_hexbin}, + {XSD_BASE64BINARY, XSD_BASE64BINARY_STRING, XSD_NAMESPACE, + to_zval_base64, to_xml_base64}, + + {XSD_LONG, XSD_LONG_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_INT, XSD_INT_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_SHORT, XSD_SHORT_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_BYTE, XSD_BYTE_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_NONPOSITIVEINTEGER,XSD_NONPOSITIVEINTEGER_STRING,XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_POSITIVEINTEGER, XSD_POSITIVEINTEGER_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_NONNEGATIVEINTEGER,XSD_NONNEGATIVEINTEGER_STRING,XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_NEGATIVEINTEGER, XSD_NEGATIVEINTEGER_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_UNSIGNEDBYTE, XSD_UNSIGNEDBYTE_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_UNSIGNEDSHORT, XSD_UNSIGNEDSHORT_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_UNSIGNEDINT, XSD_UNSIGNEDINT_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_UNSIGNEDLONG, XSD_UNSIGNEDLONG_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_INTEGER, XSD_INTEGER_STRING, XSD_NAMESPACE, + to_zval_long, to_xml_long}, + + {XSD_ANYTYPE, XSD_ANYTYPE_STRING, XSD_NAMESPACE, + guess_zval_convert, guess_xml_convert}, + {XSD_UR_TYPE, XSD_UR_TYPE_STRING, XSD_NAMESPACE, + guess_zval_convert, guess_xml_convert}, + {XSD_ANYURI, XSD_ANYURI_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_QNAME, XSD_QNAME_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_NOTATION, XSD_NOTATION_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_NORMALIZEDSTRING, XSD_NORMALIZEDSTRING_STRING, XSD_NAMESPACE, + to_zval_stringr, to_xml_string}, + {XSD_TOKEN, XSD_TOKEN_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_LANGUAGE, XSD_LANGUAGE_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_NMTOKEN, XSD_NMTOKEN_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_NMTOKENS, XSD_NMTOKENS_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_list1}, + {XSD_NAME, XSD_NAME_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_NCNAME, XSD_NCNAME_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_ID, XSD_ID_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_IDREF, XSD_IDREF_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_IDREFS, XSD_IDREFS_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_list1}, + {XSD_ENTITY, XSD_ENTITY_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_ENTITIES, XSD_ENTITIES_STRING, XSD_NAMESPACE, + to_zval_stringc, to_xml_list1}, + + {APACHE_MAP, APACHE_MAP_STRING, APACHE_NAMESPACE, + to_zval_map, to_xml_map}, + + {SOAP_ENC_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_1_1_ENC_NAMESPACE, + to_zval_object, to_xml_object}, + {SOAP_ENC_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_1_ENC_NAMESPACE, + to_zval_array, to_xml_array}, + {SOAP_ENC_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_1_2_ENC_NAMESPACE, + to_zval_object, to_xml_object}, + {SOAP_ENC_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_1_2_ENC_NAMESPACE, + to_zval_array, to_xml_array}, + + /* support some of the 1999 data types */ + {XSD_STRING, XSD_STRING_STRING, XSD_1999_NAMESPACE, + to_zval_string, to_xml_string}, + {XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_1999_NAMESPACE, + to_zval_bool, to_xml_bool}, + {XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, + to_zval_stringc, to_xml_string}, + {XSD_FLOAT, XSD_FLOAT_STRING, XSD_1999_NAMESPACE, + to_zval_double, to_xml_double}, + {XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_1999_NAMESPACE, + to_zval_double, to_xml_double}, + + {XSD_LONG, XSD_LONG_STRING, XSD_1999_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_INT, XSD_INT_STRING, XSD_1999_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_SHORT, XSD_SHORT_STRING, XSD_1999_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_BYTE, XSD_BYTE_STRING, XSD_1999_NAMESPACE, + to_zval_long, to_xml_long}, + {XSD_1999_TIMEINSTANT,XSD_1999_TIMEINSTANT_STRING,XSD_1999_NAMESPACE, + to_zval_stringc, to_xml_string}, + + {XSD_ANYXML, "", "", to_zval_any, to_xml_any}, + + {END_KNOWN_TYPES, NULL, NULL, guess_zval_convert, guess_xml_convert}, +}; + +/////////////////////////////////////////////////////////////////////////////// + +static string get_full_typename(const char *ns, const char *type) { + string nscat; + if (ns && *ns) { + nscat = ns; + nscat += ':'; + } + if (type) { + nscat += type; + } + return nscat; +} + +static encodePtr get_typemap_type(const char *ns, const char *type) { + USE_SOAP_GLOBAL; + string nscat = get_full_typename(ns, type); + if (SOAP_GLOBAL(typemap)) { + encodeMap::const_iterator iter = SOAP_GLOBAL(typemap)->find(nscat); + if (iter != SOAP_GLOBAL(typemap)->end()) { + return iter->second; + } + } + return encodePtr(); +} + +void whiteSpace_replace(xmlChar* str) { + while (*str != '\0') { + if (*str == '\x9' || *str == '\xA' || *str == '\xD') { + *str = ' '; + } + str++; + } +} + +void whiteSpace_collapse(xmlChar* str) { + xmlChar *pos; + xmlChar old; + + pos = str; + whiteSpace_replace(str); + while (*str == ' ') { + str++; + } + old = '\0'; + while (*str != '\0') { + if (*str != ' ' || old != ' ') { + *pos = *str; + pos++; + } + old = *str; + str++; + } + if (old == ' ') { + --pos; + } + *pos = '\0'; +} + +static encodePtr find_encoder_by_type_name(sdl *sdl, const char *type) { + if (sdl) { + encodeMap::const_iterator iter = sdl->encoders.find(type); + if (iter != sdl->encoders.end()) { + return iter->second; + } + } + return encodePtr(); +} + +static bool soap_check_zval_ref(CVarRef data, xmlNodePtr node) { + USE_SOAP_GLOBAL; + int64 hash = 0; + if (data.isObject()) { + hash = (int64)data.getObjectData(); + } else if (data.isReferenced()) { + hash = (int64)data.getVariantData(); + } + if (hash) { + Array &ref_map = SOAP_GLOBAL(ref_map); + xmlNodePtr node_ptr = (xmlNodePtr)ref_map[hash].toInt64(); + if (node_ptr) { + if (node_ptr == node) { + return false; + } + xmlNodeSetName(node, node_ptr->name); + xmlSetNs(node, node_ptr->ns); + xmlAttrPtr attr = node_ptr->properties; + const char *id; + string prefix; + if (SOAP_GLOBAL(soap_version) == SOAP_1_1) { + while (1) { + attr = get_attribute(attr, "id"); + if (attr == NULL || attr->ns == NULL) { + break; + } + attr = attr->next; + } + if (attr) { + prefix = '#'; + prefix += (char*)attr->children->content; + id = prefix.c_str(); + } else { + SOAP_GLOBAL(cur_uniq_ref)++; + prefix = "#ref"; + prefix += lexical_cast(SOAP_GLOBAL(cur_uniq_ref)); + id = prefix.c_str(); + xmlSetProp(node_ptr, BAD_CAST("id"), BAD_CAST(id+1)); + } + xmlSetProp(node, BAD_CAST("href"), BAD_CAST(id)); + } else { + attr = get_attribute_ex(attr, "id", SOAP_1_2_ENC_NAMESPACE); + if (attr) { + prefix = '#'; + prefix += (char*)attr->children->content; + id = prefix.c_str(); + } else { + SOAP_GLOBAL(cur_uniq_ref)++; + prefix = "#ref"; + prefix += lexical_cast(SOAP_GLOBAL(cur_uniq_ref)); + id = prefix.c_str(); + set_ns_prop(node_ptr, SOAP_1_2_ENC_NAMESPACE, "id", id+1); + } + set_ns_prop(node, SOAP_1_2_ENC_NAMESPACE, "ref", id); + } + return true; + } + ref_map.set(hash, (int64)node); + } + return false; +} + +static bool soap_check_xml_ref(Variant &data, xmlNodePtr node) { + USE_SOAP_GLOBAL; + Array &ref_map = SOAP_GLOBAL(ref_map); + if (ref_map.exists((int64)node)) { + Variant &data2 = ref_map.lvalAt((int64)node); + if (!(data.isObject() && data2.isObject() && + data.getObjectData() == data2.getObjectData()) && + !(data.isReferenced() && data2.isReferenced() && + data.getVariantData() == data2.getVariantData())) { + data = ref(data2); + return true; + } + } else { + ref_map.set((int64)node, ref(data)); + } + return false; +} + +static xmlNodePtr master_to_xml_int(encodePtr encode, CVarRef data, int style, + xmlNodePtr parent, bool check_class_map) { + USE_SOAP_GLOBAL; + xmlNodePtr node = NULL; + bool add_type = false; + + /* Special handling of class SoapVar */ + if (data.isObject() && data.toObject().instanceof("SoapVar")) { + encodePtr enc; + c_soapvar *p = data.toObject().getTyped(); + if (!p->m_ns.empty()) { + enc = get_encoder(SOAP_GLOBAL(sdl), p->m_ns.data(), p->m_stype.data()); + } else { + enc = get_encoder_ex(SOAP_GLOBAL(sdl), p->m_stype.data()); + } + if (!enc && SOAP_GLOBAL(typemap)) { + enc = get_typemap_type(p->m_ns.c_str(), p->m_stype.c_str()); + } + if (!enc) { + enc = get_conversion(p->m_type); + } + if (!enc) { + enc = encode; + } + + node = master_to_xml(enc, p->m_value, style, parent); + + if (style == SOAP_ENCODED || (SOAP_GLOBAL(sdl) && encode != enc)) { + if (!p->m_stype.empty()) { + set_ns_and_type_ex(node, p->m_ns, p->m_stype); + } + } + + if (!p->m_name.empty()) { + xmlNodeSetName(node, BAD_CAST(p->m_name.data())); + } + if (!p->m_namens.empty()) { + xmlNsPtr nsp = encode_add_ns(node, p->m_namens.data()); + xmlSetNs(node, nsp); + } + } else { + if (check_class_map && !SOAP_GLOBAL(classmap).empty() && + data.isString() && !data.toString().empty()) { + String clsname = data.toString(); + for (ArrayIter iter(SOAP_GLOBAL(classmap)); iter; ++iter) { + if (same(iter.second(), clsname)) { + /* TODO: namespace isn't stored */ + encodePtr enc; + if (SOAP_GLOBAL(sdl)) { + enc = get_encoder(SOAP_GLOBAL(sdl), + SOAP_GLOBAL(sdl)->target_ns.c_str(), + iter.first().toString().data()); + if (!enc) { + enc = find_encoder_by_type_name(SOAP_GLOBAL(sdl), + iter.first().toString().data()); + } + } + if (enc) { + if (encode != enc && style == SOAP_LITERAL) { + add_type = true; + } + encode = enc; + } + break; + } + } + } + + if (encode == NULL) { + encode = get_conversion(UNKNOWN_TYPE); + } + if (SOAP_GLOBAL(typemap) && !encode->details.type_str.empty()) { + encodePtr enc = get_typemap_type(encode->details.ns.c_str(), + encode->details.type_str.c_str()); + if (enc) encode = enc; + } + if (encode->to_xml) { + node = encode->to_xml(&encode->details, data, style, parent); + if (add_type) { + set_ns_and_type(node, &encode->details); + } + } + } + return node; +} + +xmlNodePtr master_to_xml(encodePtr encode, CVarRef data, int style, + xmlNodePtr parent) { + return master_to_xml_int(encode, data, style, parent, true); +} + +static Variant master_to_zval_int(encodePtr encode, xmlNodePtr data) { + USE_SOAP_GLOBAL; + Variant ret; + if (SOAP_GLOBAL(typemap)) { + if (!encode->details.type_str.empty()) { + encodePtr enc = get_typemap_type(encode->details.ns.c_str(), + encode->details.type_str.c_str()); + if (enc) encode = enc; + } else { + xmlAttrPtr type_attr = get_attribute_ex(data->properties, "type", + XSI_NAMESPACE); + if (type_attr) { + string ns, cptype; + parse_namespace(type_attr->children->content, cptype, ns); + xmlNsPtr nsptr = xmlSearchNs(data->doc, data, BAD_CAST(ns.data())); + string nscat; + if (nsptr) { + nscat = (char*)nsptr->href; + nscat += ':'; + } + nscat += cptype.data(); + encodeMap::const_iterator iter = SOAP_GLOBAL(typemap)->find(nscat); + if (iter != SOAP_GLOBAL(typemap)->end()) { + encode = iter->second; + } + } + } + } + if (encode->to_zval) { + ret = encode->to_zval(&encode->details, data); + } + return ret; +} + +Variant master_to_zval(encodePtr encode, xmlNodePtr data) { + USE_SOAP_GLOBAL; + data = check_and_resolve_href(data); + + if (encode == NULL) { + encode = get_conversion(UNKNOWN_TYPE); + } else { + /* Use xsi:type if it is defined */ + xmlAttrPtr type_attr = get_attribute_ex(data->properties, "type", + XSI_NAMESPACE); + if (type_attr) { + encodePtr enc = get_encoder_from_prefix(SOAP_GLOBAL(sdl), data, + type_attr->children->content); + if (enc && enc != encode) { + encodePtr tmp = enc; + while (tmp && tmp->details.sdl_type && + tmp->details.sdl_type->kind != XSD_TYPEKIND_COMPLEX) { + if (enc == tmp->details.sdl_type->encode || + tmp == tmp->details.sdl_type->encode) { + enc.reset(); + break; + } + tmp = tmp->details.sdl_type->encode; + } + if (enc) { + encode = enc; + } + } + } + } + return master_to_zval_int(encode, data); +} + +xmlNodePtr to_xml_user(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + xmlNodePtr ret = NULL; + if (type && type->map && !type->map->to_xml.isNull()) { + Variant return_value = f_call_user_func_array(type->map->to_xml, + CREATE_VECTOR1(data)); + if (return_value.isString()) { + String sdoc = return_value.toString(); + xmlDocPtr doc = soap_xmlParseMemory(sdoc.data(), sdoc.size()); + if (doc && doc->children) { + ret = xmlDocCopyNode(doc->children, parent->doc, 1); + } + xmlFreeDoc(doc); + } + } + if (!ret) { + ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); + } + xmlAddChild(parent, ret); + if (style == SOAP_ENCODED) { + set_ns_and_type(ret, type); + } + return ret; +} + +Variant to_zval_user(encodeTypePtr type, xmlNodePtr node) { + Variant return_value; + if (type && type->map && !type->map->to_zval.isNull()) { + xmlNodePtr copy = xmlCopyNode(node, 1); + xmlBufferPtr buf = xmlBufferCreate(); + xmlNodeDump(buf, NULL, copy, 0, 0); + String data((char*)xmlBufferContent(buf), CopyString); + xmlBufferFree(buf); + xmlFreeNode(copy); + + return_value = f_call_user_func_array(type->map->to_zval, + CREATE_VECTOR1(data)); + } + return return_value; +} + +/* TODO: get rid of "bogus".. ither by passing in the already created xmlnode + or passing in the node name */ +/* String encode/decode */ +static Variant to_zval_string(encodeTypePtr type, xmlNodePtr data) { + USE_SOAP_GLOBAL; + Variant ret; + FIND_XML_NULL(data, ret); + if (data && data->children) { + if (data->children->type == XML_TEXT_NODE && + data->children->next == NULL) { + if (SOAP_GLOBAL(encoding) != NULL) { + xmlBufferPtr in = + xmlBufferCreateStatic(data->children->content, + xmlStrlen(data->children->content)); + xmlBufferPtr out = xmlBufferCreate(); + int n = xmlCharEncOutFunc(SOAP_GLOBAL(encoding), out, in); + if (n >= 0) { + ret = String((char*)xmlBufferContent(out), CopyString); + } else { + ret = String((char*)data->children->content, CopyString); + } + xmlBufferFree(out); + xmlBufferFree(in); + } else { + ret = String((char*)data->children->content, CopyString); + } + } else if (data->children->type == XML_CDATA_SECTION_NODE && + data->children->next == NULL) { + ret = String((char*)data->children->content, CopyString); + } else { + throw SoapException("Encoding: Violation of encoding rules"); + } + } else { + ret = String(""); + } + return ret; +} + +static Variant to_zval_stringr(encodeTypePtr type, xmlNodePtr data) { + USE_SOAP_GLOBAL; + Variant ret; + FIND_XML_NULL(data, ret); + if (data && data->children) { + if (data->children->type == XML_TEXT_NODE && + data->children->next == NULL) { + whiteSpace_replace(data->children->content); + if (SOAP_GLOBAL(encoding) != NULL) { + xmlBufferPtr in = + xmlBufferCreateStatic(data->children->content, + xmlStrlen(data->children->content)); + xmlBufferPtr out = xmlBufferCreate(); + int n = xmlCharEncOutFunc(SOAP_GLOBAL(encoding), out, in); + if (n >= 0) { + ret = String((char*)xmlBufferContent(out), CopyString); + } else { + ret = String((char*)data->children->content, CopyString); + } + xmlBufferFree(out); + xmlBufferFree(in); + } else { + ret = String((char*)data->children->content, CopyString); + } + } else if (data->children->type == XML_CDATA_SECTION_NODE && + data->children->next == NULL) { + ret = String((char*)data->children->content, CopyString); + } else { + throw SoapException("Encoding: Violation of encoding rules"); + } + } else { + ret = String(""); + } + return ret; +} + +static Variant to_zval_stringc(encodeTypePtr type, xmlNodePtr data) { + USE_SOAP_GLOBAL; + Variant ret; + FIND_XML_NULL(data, ret); + if (data && data->children) { + if (data->children->type == XML_TEXT_NODE && + data->children->next == NULL) { + whiteSpace_collapse(data->children->content); + if (SOAP_GLOBAL(encoding) != NULL) { + xmlBufferPtr in = + xmlBufferCreateStatic(data->children->content, + xmlStrlen(data->children->content)); + xmlBufferPtr out = xmlBufferCreate(); + int n = xmlCharEncOutFunc(SOAP_GLOBAL(encoding), out, in); + if (n >= 0) { + ret = String((char*)xmlBufferContent(out), CopyString); + } else { + ret = String((char*)data->children->content, CopyString); + } + xmlBufferFree(out); + xmlBufferFree(in); + } else { + ret = String((char*)data->children->content, CopyString); + } + } else if (data->children->type == XML_CDATA_SECTION_NODE && + data->children->next == NULL) { + ret = String((char*)data->children->content, CopyString); + } else { + throw SoapException("Encoding: Violation of encoding rules"); + } + } else { + ret = String(""); + } + return ret; +} + +static Variant to_zval_base64(encodeTypePtr type, xmlNodePtr data) { + Variant ret; + FIND_XML_NULL(data, ret); + if (data && data->children) { + if (data->children->type == XML_TEXT_NODE && + data->children->next == NULL) { + whiteSpace_collapse(data->children->content); + String str = + StringUtil::Base64Decode(String((const char*)data->children->content)); + if (str.isNull()) { + throw SoapException("Encoding: Violation of encoding rules"); + } + ret = str; + } else if (data->children->type == XML_CDATA_SECTION_NODE && + data->children->next == NULL) { + String str = + StringUtil::Base64Decode(String((const char*)data->children->content)); + if (str.isNull()) { + throw SoapException("Encoding: Violation of encoding rules"); + } + ret = str; + } else { + throw SoapException("Encoding: Violation of encoding rules"); + } + } else { + ret = String(""); + } + return ret; +} + +static Variant to_zval_hexbin(encodeTypePtr type, xmlNodePtr data) { + Variant ret; + FIND_XML_NULL(data, ret); + if (data && data->children) { + if (data->children->type == XML_TEXT_NODE && + data->children->next == NULL) { + whiteSpace_collapse(data->children->content); + } else if (data->children->type != XML_CDATA_SECTION_NODE || + data->children->next != NULL) { + throw SoapException("Encoding: Violation of encoding rules"); + } + String str = + StringUtil::HexDecode(String((const char*)data->children->content)); + if (str.isNull()) { + throw SoapException("Encoding: Violation of encoding rules"); + } + ret = str; + } else { + ret = String(""); + } + return ret; +} + +static xmlNodePtr to_xml_string(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + USE_SOAP_GLOBAL; + xmlNodePtr ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, ret); + FIND_ZVAL_NULL(data, ret, style); + + String str = data.toString(); + if (SOAP_GLOBAL(encoding) != NULL) { + xmlBufferPtr in = xmlBufferCreateStatic((void*)str.data(), str.size()); + xmlBufferPtr out = xmlBufferCreate(); + int n = xmlCharEncInFunc(SOAP_GLOBAL(encoding), out, in); + if (n >= 0) { + str = String((char*)xmlBufferContent(out), n, CopyString); + } + xmlBufferFree(out); + xmlBufferFree(in); + } + + if (!php_libxml_xmlCheckUTF8(BAD_CAST(str.data()))) { + char *err = (char*)malloc(str.size() + 8); + char c; + memcpy(err, str.data(), str.size() + 1); + int i = 0; + while ((c = err[i++])) { + if ((c & 0x80) == 0) { + } else if ((c & 0xe0) == 0xc0) { + if ((err[i] & 0xc0) != 0x80) { + break; + } + i++; + } else if ((c & 0xf0) == 0xe0) { + if ((err[i] & 0xc0) != 0x80 || (err[i+1] & 0xc0) != 0x80) { + break; + } + i += 2; + } else if ((c & 0xf8) == 0xf0) { + if ((err[i] & 0xc0) != 0x80 || + (err[i+1] & 0xc0) != 0x80 || (err[i+2] & 0xc0) != 0x80) { + break; + } + i += 3; + } else { + break; + } + } + if (c) { + err[i-1] = '\\'; + err[i++] = 'x'; + err[i++] = ((unsigned char)c >> 4) + + ((((unsigned char)c >> 4) > 9) ? ('a' - 10) : '0'); + err[i++] = (c & 15) + (((c & 15) > 9) ? ('a' - 10) : '0'); + err[i++] = '.'; + err[i++] = '.'; + err[i++] = '.'; + err[i++] = 0; + } + string serr = err; + free(err); + throw SoapException("Encoding: string '%s' is not a valid utf-8 string", + serr.c_str()); + } + + xmlNodePtr text = xmlNewTextLen(BAD_CAST(str.data()), str.size()); + xmlAddChild(ret, text); + + if (style == SOAP_ENCODED) { + set_ns_and_type(ret, type); + } + return ret; +} + +static xmlNodePtr to_xml_base64(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + xmlNodePtr ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, ret); + FIND_ZVAL_NULL(data, ret, style); + + String str = StringUtil::Base64Encode(data.toString()); + xmlAddChild(ret, xmlNewTextLen(BAD_CAST(str.data()), str.size())); + + if (style == SOAP_ENCODED) { + set_ns_and_type(ret, type); + } + return ret; +} + +static xmlNodePtr to_xml_hexbin(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + xmlNodePtr ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, ret); + FIND_ZVAL_NULL(data, ret, style); + + String str = StringUtil::HexEncode(data.toString()); + xmlAddChild(ret, xmlNewTextLen(BAD_CAST(str.data()), str.size())); + + if (style == SOAP_ENCODED) { + set_ns_and_type(ret, type); + } + return ret; +} + +static Variant to_zval_double(encodeTypePtr type, xmlNodePtr data) { + Variant ret; + FIND_XML_NULL(data, ret); + if (data && data->children) { + if (data->children->type == XML_TEXT_NODE && + data->children->next == NULL) { + int64 lval; double dval; + whiteSpace_collapse(data->children->content); + String content((char*)data->children->content, CopyString); + switch (is_numeric_string(content.data(), content.size(), + &lval, &dval, 0)) { + case KindOfInt64: ret = lval; break; + case KindOfDouble: ret = dval; break; + default: + if (strcasecmp(content.data(), "NaN") == 0) { + ret = atof("nan"); + } else if (strcasecmp(content.data(), "INF") == 0) { + ret = atof("inf"); + } else if (strcasecmp(content.data(), "-INF") == 0) { + ret = -atof("inf"); + } else { + throw SoapException("Encoding: Violation of encoding rules"); + } + } + } else { + throw SoapException("Encoding: Violation of encoding rules"); + } + } + return ret; +} + +static Variant to_zval_long(encodeTypePtr type, xmlNodePtr data) { + Variant ret; + FIND_XML_NULL(data, ret); + if (data && data->children) { + if (data->children->type == XML_TEXT_NODE && + data->children->next == NULL) { + int64 lval; double dval; + whiteSpace_collapse(data->children->content); + switch (is_numeric_string((const char *)data->children->content, + strlen((char*)data->children->content), + &lval, &dval, 0)) { + case KindOfInt64: ret = (int64)lval; break; + case KindOfDouble: ret = dval; break; + default: + throw SoapException("Encoding: Violation of encoding rules"); + } + } else { + throw SoapException("Encoding: Violation of encoding rules"); + } + } + return ret; +} + +static xmlNodePtr to_xml_long(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + xmlNodePtr ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, ret); + FIND_ZVAL_NULL(data, ret, style); + + if (data.isDouble()) { + char s[256]; + snprintf(s, sizeof(s), "%0.0F", floor(data.toDouble())); + xmlNodeSetContent(ret, BAD_CAST(s)); + } else { + Variant d = data.toInt64(); + String sd = d.toString(); + xmlNodeSetContentLen(ret, BAD_CAST(sd.data()), sd.size()); + } + + if (style == SOAP_ENCODED) { + set_ns_and_type(ret, type); + } + return ret; +} + +static xmlNodePtr to_xml_double(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + xmlNodePtr ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, ret); + FIND_ZVAL_NULL(data, ret, style); + + Variant d = data.toDouble(); + String sd = d.toString(); + xmlNodeSetContentLen(ret, BAD_CAST(sd.data()), sd.size()); + + if (style == SOAP_ENCODED) { + set_ns_and_type(ret, type); + } + return ret; +} + +static Variant to_zval_bool(encodeTypePtr type, xmlNodePtr data) { + Variant ret; + FIND_XML_NULL(data, ret); + if (data && data->children) { + if (data->children->type == XML_TEXT_NODE && + data->children->next == NULL) { + whiteSpace_collapse(data->children->content); + const char *content = (const char *)data->children->content; + if (strcasecmp((char*)content, "true") == 0 || + strcasecmp((char*)content, "t") == 0 || + strcmp((char*)content, "1") == 0) { + ret = true; + } else if (strcasecmp((char*)content, "false") == 0 || + strcasecmp((char*)content, "f") == 0 || + strcmp((char*)content, "0") == 0) { + ret = false; + } else { + ret = String((char*)content, CopyString).toBoolean(); + } + } else { + throw SoapException("Encoding: Violation of encoding rules"); + } + } + return ret; +} + +static xmlNodePtr to_xml_bool(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + xmlNodePtr ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, ret); + FIND_ZVAL_NULL(data, ret, style); + + if (data.toBoolean()) { + xmlNodeSetContent(ret, BAD_CAST("true")); + } else { + xmlNodeSetContent(ret, BAD_CAST("false")); + } + + if (style == SOAP_ENCODED) { + set_ns_and_type(ret, type); + } + return ret; +} + +/* Null encode/decode */ +static Variant to_zval_null(encodeTypePtr type, xmlNodePtr data) { + return null; +} + +static xmlNodePtr to_xml_null(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + xmlNodePtr ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, ret); + if (style == SOAP_ENCODED) { + set_xsi_nil(ret); + } + return ret; +} + +static bool get_zval_property(Variant &object, const char* name, + Variant *ret = NULL) { + if (object.isObject()) { + Object obj = object.toObject(); + if (!obj->o_exists(name, -1)) { + return false; + } + if (ret) *ret = ref(obj->o_lval(name, -1)); + return true; + } + if (object.isArray()) { + Array arr = object.toArray(); + if (!arr.exists(name)) { + return false; + } + if (ret) *ret = ref(object.lvalAt(name)); + return true; + } + return false; +} + +static void model_to_zval_any(Variant &ret, xmlNodePtr node) { + const char* name = NULL; + Variant any; + while (node != NULL) { + if (!get_zval_property(ret, (const char *)node->name)) { + Variant val = master_to_zval(get_conversion(XSD_ANYXML), node); + + if (!any.isNull() && !any.isArray()) { + Array arr = Array::Create(); + if (name) { + arr.set(name, any); + } else { + arr.append(any); + } + any = arr; + } + + if (val.isString() && val.toString().charAt(0) == '<') { + name = NULL; + while (node->next != NULL) { + Variant val2 = master_to_zval(get_conversion(XSD_ANYXML), + node->next); + if (!val2.isString()) { + break; + } + concat_assign(val, val2); + node = node->next; + } + } else { + name = (const char*)node->name; + } + + if (any.isNull()) { + if (name) { + Array arr = Array::Create(); + arr.set(String(name, CopyString), val); + any = arr; + name = NULL; + } else { + any = val; + } + } else { + /* Add array element */ + if (name) { + if (any.toArray().exists(name)) { + Variant &el = any.lvalAt(name); + if (!el.isArray()) { + /* Convert into array */ + Array arr = Array::Create(); + arr.append(el); + el = arr; + } + el.append(val); + } else { + any.set(name, val); + } + } else { + any.append(val); + } + name = NULL; + } + } + node = node->next; + } + if (any) { + ret.set(name ? name : "any", any); + } +} + +static void model_to_zval_object(Variant &ret, sdlContentModelPtr model, + xmlNodePtr data, sdl *sdl) { + USE_SOAP_GLOBAL; + switch (model->kind) { + case XSD_CONTENT_ELEMENT: + if (!model->u_element->name.empty()) { + xmlNodePtr node = get_node(data->children, + (char*)model->u_element->name.c_str()); + if (node) { + Variant val; + xmlNodePtr r_node = check_and_resolve_href(node); + if (r_node && r_node->children && r_node->children->content) { + if (!model->u_element->fixed.empty() && + model->u_element->fixed != (char*)r_node->children->content) { + throw SoapException("Encoding: Element '%s' has fixed value '%s' " + "(value '%s' is not allowed)", + model->u_element->name.c_str(), + model->u_element->fixed.c_str(), + r_node->children->content); + } + val = master_to_zval(model->u_element->encode, r_node); + } else if (!model->u_element->fixed.empty()) { + xmlNodePtr dummy = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlNodeSetContent(dummy, BAD_CAST(model->u_element->fixed.c_str())); + val = master_to_zval(model->u_element->encode, dummy); + xmlFreeNode(dummy); + } else if (!model->u_element->def.empty() && + !model->u_element->nillable) { + xmlNodePtr dummy = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlNodeSetContent(dummy, + BAD_CAST(model->u_element->def.c_str())); + val = master_to_zval(model->u_element->encode, dummy); + xmlFreeNode(dummy); + } else { + val = master_to_zval(model->u_element->encode, r_node); + } + if ((node = get_node(node->next, + (char*)model->u_element->name.c_str())) != NULL) { + Array array = Array::Create(); + array.append(val); + do { + if (node && node->children && node->children->content) { + if (!model->u_element->fixed.empty() && + model->u_element->fixed != (char*)node->children->content) { + throw SoapException("Encoding: Element '%s' has fixed value " + "'%s' (value '%s' is not allowed)", + model->u_element->name.c_str(), + model->u_element->fixed.c_str(), + node->children->content); + } + val = master_to_zval(model->u_element->encode, node); + } else if (!model->u_element->fixed.empty()) { + xmlNodePtr dummy = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlNodeSetContent(dummy, + BAD_CAST(model->u_element->fixed.c_str())); + val = master_to_zval(model->u_element->encode, dummy); + xmlFreeNode(dummy); + } else if (!model->u_element->def.empty() && + !model->u_element->nillable) { + xmlNodePtr dummy = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlNodeSetContent(dummy, + BAD_CAST(model->u_element->def.c_str())); + val = master_to_zval(model->u_element->encode, dummy); + xmlFreeNode(dummy); + } else { + val = master_to_zval(model->u_element->encode, node); + } + array.append(val); + } while ((node = get_node + (node->next, + (char*)model->u_element->name.c_str())) != NULL); + val = array; + } else if ((!val.isNull() || !model->u_element->nillable) && + (SOAP_GLOBAL(features) & SOAP_SINGLE_ELEMENT_ARRAYS) && + (model->max_occurs == -1 || model->max_occurs > 1)) { + Array array = Array::Create(); + array.append(val); + val = array; + } + ret.toObject()->set(String(model->u_element->name), val); + } + } + break; + case XSD_CONTENT_ALL: + case XSD_CONTENT_SEQUENCE: + case XSD_CONTENT_CHOICE: { + sdlContentModelPtr any; + for (unsigned int i = 0; i < model->u_content.size(); i++) { + sdlContentModelPtr content = model->u_content[i]; + if (content->kind == XSD_CONTENT_ANY) { + any = content; + } else { + model_to_zval_object(ret, content, data, sdl); + } + } + if (any) { + model_to_zval_any(ret, data->children); + } + break; + } + case XSD_CONTENT_GROUP: + model_to_zval_object(ret, model->u_group->model, data, sdl); + break; + default: + break; + } +} + +/* Struct encode/decode */ +static Variant to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, + const char *pce) { + USE_SOAP_GLOBAL; + const char *ce = "stdClass"; + String clsname; + if (pce) { + ce = pce; + } else if (!SOAP_GLOBAL(classmap).empty() && !type->type_str.empty() && + SOAP_GLOBAL(classmap).exists(String(type->type_str))) { + clsname = SOAP_GLOBAL(classmap)[type->type_str.c_str()].toString(); + ce = clsname.data(); + } + + Variant ret; + bool redo_any = false; + sdlType *sdlType = type->sdl_type; + sdl *sdl = SOAP_GLOBAL(sdl); + if (sdlType) { + if (sdlType->kind == XSD_TYPEKIND_RESTRICTION && + sdlType->encode && type != &sdlType->encode->details) { + encodePtr enc = sdlType->encode; + while (enc && enc->details.sdl_type && + enc->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE && + enc->details.sdl_type->kind != XSD_TYPEKIND_LIST && + enc->details.sdl_type->kind != XSD_TYPEKIND_UNION) { + enc = enc->details.sdl_type->encode; + } + if (enc) { + if (soap_check_xml_ref(ret, data)) { + return ret; + } + ret = create_object(ce, Array()); + ret.toObject()->set("_", master_to_zval_int(enc, data)); + } else { + FIND_XML_NULL(data, ret); + if (soap_check_xml_ref(ret, data)) { + return ret; + } + ret = create_object(ce, Array()); + } + } else if (sdlType->kind == XSD_TYPEKIND_EXTENSION && + sdlType->encode && + type != &sdlType->encode->details) { + encodeType &details = sdlType->encode->details; + if (details.sdl_type && + details.sdl_type->kind != XSD_TYPEKIND_SIMPLE && + details.sdl_type->kind != XSD_TYPEKIND_LIST && + details.sdl_type->kind != XSD_TYPEKIND_UNION) { + + if (strcasecmp(ce, "stdClass") != 0 && + sdlType->encode->to_zval == sdl_guess_convert_zval && + details.sdl_type != NULL && + (details.sdl_type->kind == XSD_TYPEKIND_COMPLEX || + details.sdl_type->kind == XSD_TYPEKIND_RESTRICTION || + details.sdl_type->kind == XSD_TYPEKIND_EXTENSION) && + (details.sdl_type->encode == NULL || + (details.sdl_type->encode->details.type != KindOfArray && + details.sdl_type->encode->details.type != SOAP_ENC_ARRAY))) { + ret = to_zval_object_ex(&sdlType->encode->details, data, ce); + } else { + ret = master_to_zval_int(sdlType->encode, data); + } + FIND_XML_NULL(data, ret); + if (soap_check_xml_ref(ret, data)) { + return ret; + } + redo_any = get_zval_property(ret, "any"); + } else { + if (soap_check_xml_ref(ret, data)) { + return ret; + } + ret = create_object(ce, Array()); + ret.toObject()->set("_", master_to_zval_int(sdlType->encode, data)); + } + } else { + FIND_XML_NULL(data, ret); + if (soap_check_xml_ref(ret, data)) { + return ret; + } + ret = create_object(ce, Array()); + } + if (sdlType->model) { + if (redo_any) { + ret.toObject()->set("any", null); + } + model_to_zval_object(ret, sdlType->model, data, sdl); + if (redo_any) { + if (!get_zval_property(ret, "any")) { + model_to_zval_any(ret, data->children); + } + } + } + if (!sdlType->attributes.empty()) { + for (sdlAttributeMap::const_iterator iter = sdlType->attributes.begin(); + iter != sdlType->attributes.end(); ++iter) { + sdlAttributePtr attr = iter->second; + if (!attr->name.empty()) { + xmlAttrPtr val = get_attribute(data->properties, + (char*)attr->name.c_str()); + const char *str_val = NULL; + if (val && val->children && val->children->content) { + str_val = (char*)val->children->content; + if (!attr->fixed.empty() && attr->fixed != str_val) { + throw SoapException("Encoding: Attribute '%s' has fixed value" + " '%s' (value '%s' is not allowed)", + attr->name.c_str(), attr->fixed.c_str(), + str_val); + } + } else if (!attr->fixed.empty()) { + str_val = attr->fixed.c_str(); + } else if (!attr->def.empty()) { + str_val = attr->def.c_str(); + } + if (str_val) { + xmlNodePtr dummy = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlNodePtr text = xmlNewText(BAD_CAST(str_val)); + xmlAddChild(dummy, text); + Variant data = master_to_zval(attr->encode, dummy); + xmlFreeNode(dummy); + ret.toObject()->set(String(attr->name), data); + } + } + } + } + } else { + FIND_XML_NULL(data, ret); + if (soap_check_xml_ref(ret, data)) { + return ret; + } + + ret = create_object(ce, Array()); + xmlNodePtr trav = data->children; + while (trav != NULL) { + if (trav->type == XML_ELEMENT_NODE) { + Variant tmpVal = master_to_zval(encodePtr(), trav); + Variant prop; + if (!get_zval_property(ret, (char*)trav->name, &prop)) { + if (!trav->next || !get_node(trav->next, (char*)trav->name)) { + ret.toObject()->set(String((char*)trav->name, CopyString), tmpVal); + } else { + Array arr = Array::Create(); + arr.append(tmpVal); + ret.toObject()->set(String((char*)trav->name, CopyString), arr); + } + } else { + /* Property already exist - make array */ + if (!prop.isArray()) { + /* Convert into array */ + Array arr = Array::Create(); + arr.append(prop); + ret.toObject()->set(String((char*)trav->name, CopyString), arr); + prop = arr; + } + /* Add array element */ + prop.append(tmpVal); + } + } + trav = trav->next; + } + } + return ret; +} + +static Variant to_zval_object(encodeTypePtr type, xmlNodePtr data) { + return to_zval_object_ex(type, data, NULL); +} + +static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, + Variant &object, int style, int strict) { + switch (model->kind) { + case XSD_CONTENT_ELEMENT: { + xmlNodePtr property; + encodePtr enc; + + Variant data; + if (get_zval_property(object, model->u_element->name.c_str(), &data) && + data.isNull() && !model->u_element->nillable && + model->min_occurs > 0 && !strict) { + return 0; + } + if (data) { + enc = model->u_element->encode; + if ((model->max_occurs == -1 || model->max_occurs > 1) && + data.isArray() && data.toArray()->isVectorData()) { + for (ArrayIter iter(data.toArray()); iter; ++iter) { + Variant val = iter.second(); + if (val.isNull() && model->u_element->nillable) { + property = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(node, property); + set_xsi_nil(property); + } else { + property = master_to_xml(enc, val, style, node); + if (property->children && property->children->content && + !model->u_element->fixed.empty() && + model->u_element->fixed != (char*)property->children->content){ + throw SoapException("Encoding: Element '%s' has fixed value " + "'%s' (value '%s' is not allowed)", + model->u_element->name.c_str(), + model->u_element->fixed.c_str(), + property->children->content); + } + } + xmlNodeSetName(property, BAD_CAST(model->u_element->name.c_str())); + if (style == SOAP_LITERAL && + !model->u_element->namens.empty() && + model->u_element->form == XSD_FORM_QUALIFIED) { + xmlNsPtr nsp = encode_add_ns(property, + model->u_element->namens.c_str()); + xmlSetNs(property, nsp); + } + } + } else { + if (data.isNull() && model->u_element->nillable) { + property = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(node, property); + set_xsi_nil(property); + } else if (data.isNull() && model->min_occurs == 0) { + return 1; + } else { + property = master_to_xml(enc, data, style, node); + if (property->children && property->children->content && + !model->u_element->fixed.empty() && + model->u_element->fixed != (char*)property->children->content) { + throw SoapException("Encoding: Element '%s' has fixed value '%s' " + "(value '%s' is not allowed)", + model->u_element->name.c_str(), + model->u_element->fixed.c_str(), + property->children->content); + } + } + xmlNodeSetName(property, BAD_CAST(model->u_element->name.c_str())); + if (style == SOAP_LITERAL && + !model->u_element->namens.empty() && + model->u_element->form == XSD_FORM_QUALIFIED) { + xmlNsPtr nsp = encode_add_ns(property, + model->u_element->namens.c_str()); + xmlSetNs(property, nsp); + } + } + return 1; + } else if (strict && model->u_element->nillable && model->min_occurs > 0) { + property = xmlNewNode(NULL, BAD_CAST(model->u_element->name.c_str())); + xmlAddChild(node, property); + set_xsi_nil(property); + if (style == SOAP_LITERAL && + model->u_element->form == XSD_FORM_QUALIFIED) { + xmlNsPtr nsp = encode_add_ns(property, + model->u_element->namens.c_str()); + xmlSetNs(property, nsp); + } + return 1; + } else if (model->min_occurs == 0) { + return 2; + } else { + if (strict) { + throw SoapException("Encoding: object hasn't '%s' property", + model->u_element->name.c_str()); + } + return 0; + } + break; + } + case XSD_CONTENT_ANY: { + xmlNodePtr property; + encodePtr enc; + + Variant data; + if (get_zval_property(object, "any", &data)) { + enc = get_conversion(XSD_ANYXML); + if ((model->max_occurs == -1 || model->max_occurs > 1) && + data.isArray() && data.toArray()->isVectorData()) { + for (ArrayIter iter(data.toArray()); iter; ++iter) { + property = master_to_xml(enc, iter.second(), style, node); + } + } else { + property = master_to_xml(enc, data, style, node); + } + return 1; + } else if (model->min_occurs == 0) { + return 2; + } else { + if (strict) { + throw SoapException( "Encoding: object hasn't 'any' property"); + } + return 0; + } + break; + } + case XSD_CONTENT_SEQUENCE: + case XSD_CONTENT_ALL: + for (unsigned int i = 0; i < model->u_content.size(); i++) { + sdlContentModelPtr tmp = model->u_content[i]; + if (!model_to_xml_object(node,tmp,object,style,tmp->min_occurs > 0) && + tmp->min_occurs > 0) { + return 0; + } + } + return 1; + case XSD_CONTENT_CHOICE: { + int ret = 0; + for (unsigned int i = 0; i < model->u_content.size(); i++) { + sdlContentModelPtr tmp = model->u_content[i]; + int tmp_ret = model_to_xml_object(node, tmp, object, style, 0); + if (tmp_ret == 1) { + return 1; + } else if (tmp_ret != 0) { + ret = 1; + } + } + return ret; + } + case XSD_CONTENT_GROUP: + return model_to_xml_object(node, model->u_group->model, object, style, + model->min_occurs > 0); + default: + break; + } + return 1; +} + +static sdlTypePtr model_array_element(sdlContentModelPtr model) { + switch (model->kind) { + case XSD_CONTENT_ELEMENT: { + if (model->max_occurs == -1 || model->max_occurs > 1) { + return sdlTypePtr(model->u_element, null_deleter()); + } else { + return sdlTypePtr(); + } + } + case XSD_CONTENT_SEQUENCE: + case XSD_CONTENT_ALL: + case XSD_CONTENT_CHOICE: { + if (model->u_content.size() != 1) { + return sdlTypePtr(); + } + return model_array_element(model->u_content[0]); + } + case XSD_CONTENT_GROUP: + return model_array_element(model->u_group->model); + default: + break; + } + return sdlTypePtr(); +} + +static xmlNodePtr to_xml_object(encodeTypePtr type, CVarRef data_, int style, + xmlNodePtr parent) { + xmlNodePtr xmlParam; + sdlType *sdlType = type->sdl_type; + Variant data = data_; + + if (!data || data.isNull()) { + xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, xmlParam); + if (style == SOAP_ENCODED) { + set_xsi_nil(xmlParam); + set_ns_and_type(xmlParam, type); + } + return xmlParam; + } + + Array prop; + if (data.isObject() || data.isArray()) { + prop = data.toArray(); + } + + if (sdlType) { + if (sdlType->kind == XSD_TYPEKIND_RESTRICTION && + sdlType->encode && type != &sdlType->encode->details) { + encodePtr enc = sdlType->encode; + while (enc && enc->details.sdl_type && + enc->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE && + enc->details.sdl_type->kind != XSD_TYPEKIND_LIST && + enc->details.sdl_type->kind != XSD_TYPEKIND_UNION) { + enc = enc->details.sdl_type->encode; + } + if (enc) { + Variant tmp; + if (get_zval_property(data, "_", &tmp)) { + xmlParam = master_to_xml(enc, tmp, style, parent); + } else if (prop.isNull()) { + xmlParam = master_to_xml(enc, data, style, parent); + } else { + xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, xmlParam); + } + } else { + xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, xmlParam); + } + } else if (sdlType->kind == XSD_TYPEKIND_EXTENSION && + sdlType->encode && type != &sdlType->encode->details) { + if (sdlType->encode->details.sdl_type && + sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_SIMPLE && + sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_LIST && + sdlType->encode->details.sdl_type->kind != XSD_TYPEKIND_UNION) { + xmlParam = master_to_xml(sdlType->encode, data, style, parent); + } else { + Variant tmp; + if (get_zval_property(data, "_", &tmp)) { + xmlParam = master_to_xml(sdlType->encode, tmp, style, parent); + } else if (prop.isNull()) { + xmlParam = master_to_xml(sdlType->encode, data, style, parent); + } else { + xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, xmlParam); + } + } + } else { + xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, xmlParam); + } + + if (soap_check_zval_ref(data, xmlParam)) { + return xmlParam; + } + if (!prop.isNull()) { + sdlTypePtr array_el; + + if (data.isArray() && data.toArray()->isVectorData() && + !sdlType->attributes.empty() && sdlType->model != NULL && + (array_el = model_array_element(sdlType->model)) != NULL) { + for (ArrayIter iter(prop); iter; ++iter) { + Variant val = iter.second(); + xmlNodePtr property; + if (val.isNull() && array_el->nillable) { + property = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(xmlParam, property); + set_xsi_nil(property); + } else { + property = master_to_xml(array_el->encode, val, style, xmlParam); + } + xmlNodeSetName(property, BAD_CAST(array_el->name.c_str())); + if (style == SOAP_LITERAL && !array_el->namens.empty() && + array_el->form == XSD_FORM_QUALIFIED) { + xmlNsPtr nsp = encode_add_ns(property, array_el->namens.c_str()); + xmlSetNs(property, nsp); + } + } + } else if (sdlType->model) { + model_to_xml_object(xmlParam, sdlType->model, data, style, 1); + } + if (!sdlType->attributes.empty()) { + for (sdlAttributeMap::const_iterator iter = + sdlType->attributes.begin(); iter != sdlType->attributes.end(); + ++iter) { + sdlAttributePtr attr = iter->second; + if (!attr->name.empty()) { + Variant zattr; + if (get_zval_property(data, attr->name.c_str(), &zattr)) { + xmlNodePtr dummy = master_to_xml(attr->encode, zattr, + SOAP_LITERAL, xmlParam); + if (dummy->children && dummy->children->content) { + if (!attr->fixed.empty() && + attr->fixed != (char*)dummy->children->content) { + throw SoapException("Encoding: Attribute '%s' has fixed " + "value '%s' (value '%s' is not allowed)", + attr->name.c_str(), attr->fixed.c_str(), + dummy->children->content); + } + /* we need to handle xml: namespace specially, since it is + an implicit schema. Otherwise, use form. */ + if (!strncmp(attr->namens.c_str(), XML_NAMESPACE, + sizeof(XML_NAMESPACE)) || + attr->form == XSD_FORM_QUALIFIED) { + xmlNsPtr nsp = encode_add_ns(xmlParam, attr->namens.c_str()); + xmlSetNsProp(xmlParam, nsp, BAD_CAST(attr->name.c_str()), + dummy->children->content); + } else { + xmlSetProp(xmlParam, BAD_CAST(attr->name.c_str()), + dummy->children->content); + } + } + xmlUnlinkNode(dummy); + xmlFreeNode(dummy); + } + } + } + } + } + if (style == SOAP_ENCODED) { + set_ns_and_type(xmlParam, type); + } + } else { + xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, xmlParam); + + if (soap_check_zval_ref(data, xmlParam)) { + return xmlParam; + } + if (!prop.isNull()) { + for (ArrayIter iter(prop); iter; ++iter) { + Variant key = iter.first(); + Variant zprop = iter.second(); + xmlNodePtr property = master_to_xml(get_conversion(zprop.getType()), + zprop, style, xmlParam); + if (key.isString()) { + String skey = key.toString(); + const char *prop_name; + if (data.isObject()) { + const char *class_name; + zend_unmangle_property_name(skey.data(), skey.size(), + &class_name, &prop_name); + } else { + prop_name = skey.data(); + } + if (prop_name) { + xmlNodeSetName(property, BAD_CAST(prop_name)); + } + } + } + } + if (style == SOAP_ENCODED) { + set_ns_and_type(xmlParam, type); + } + } + return xmlParam; +} + +/* Array encode/decode */ +static xmlNodePtr guess_array_map(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + encodePtr enc; + + if (data.isArray()) { + if (!data.toArray()->isVectorData()) { + enc = get_conversion(APACHE_MAP); + } else { + enc = get_conversion(SOAP_ENC_ARRAY); + } + } + if (!enc) { + enc = get_conversion(KindOfNull); + } + + return master_to_xml(enc, data, style, parent); +} + +static int calc_dimension_12(const char* str) { + int i = 0, flag = 0; + while (*str != '\0' && (*str < '0' || *str > '9') && (*str != '*')) { + str++; + } + if (*str == '*') { + i++; + str++; + } + while (*str != '\0') { + if (*str >= '0' && *str <= '9') { + if (flag == 0) { + i++; + flag = 1; + } + } else if (*str == '*') { + throw SoapException("Encoding: '*' may only be first arraySize value" + " in list"); + } else { + flag = 0; + } + str++; + } + return i; +} + +static int* get_position_12(int dimension, const char* str) { + int *pos; + int i = -1, flag = 0; + + pos = (int*)calloc(dimension, sizeof(int)); + while (*str != '\0' && (*str < '0' || *str > '9') && (*str != '*')) { + str++; + } + if (*str == '*') { + str++; + i++; + } + while (*str != '\0') { + if (*str >= '0' && *str <= '9') { + if (flag == 0) { + i++; + flag = 1; + } + pos[i] = (pos[i]*10)+(*str-'0'); + } else if (*str == '*') { + throw SoapException("Encoding: '*' may only be first arraySize value in list"); + } else { + flag = 0; + } + str++; + } + return pos; +} + +static int calc_dimension(const char* str) { + int i = 1; + while (*str != ']' && *str != '\0') { + if (*str == ',') { + i++; + } + str++; + } + return i; +} + +static void get_position_ex(int dimension, const char* str, int** pos) { + int i = 0; + + memset(*pos,0,sizeof(int)*dimension); + while (*str != ']' && *str != '\0' && i < dimension) { + if (*str >= '0' && *str <= '9') { + (*pos)[i] = ((*pos)[i]*10)+(*str-'0'); + } else if (*str == ',') { + i++; + } + str++; + } +} + +static int* get_position(int dimension, const char* str) { + int *pos = (int*)malloc(sizeof(int) * dimension); + get_position_ex(dimension, str, &pos); + return pos; +} + +static void add_xml_array_elements(xmlNodePtr xmlParam, + sdlTypePtr type, + encodePtr enc, + xmlNsPtr ns, + int dimension , + int* dims, + CVarRef data, + int style) { + if (data.isArray()) { + Array arr = data.toArray(); + ArrayIter iter(arr); + for (int j=0; jname.c_str())); + } else if (style == SOAP_LITERAL && enc && + !enc->details.type_str.empty()) { + xmlNodeSetName(xparam, BAD_CAST(enc->details.type_str.c_str())); + xmlSetNs(xparam, ns); + } else { + xmlNodeSetName(xparam, BAD_CAST("item")); + } + } else { + if (!zdata.isNull()) { + add_xml_array_elements(xmlParam, type, enc, ns, dimension-1, dims+1, + zdata, style); + } else { + add_xml_array_elements(xmlParam, type, enc, ns, dimension-1, dims+1, + null, style); + } + } + } + } else { + for (int j=0; jname.c_str())); + } else if (style == SOAP_LITERAL && enc && + !enc->details.type_str.empty()) { + xmlNodeSetName(xparam, BAD_CAST(enc->details.type_str.c_str())); + xmlSetNs(xparam, ns); + } else { + xmlNodeSetName(xparam, BAD_CAST("item")); + } + } else { + add_xml_array_elements(xmlParam, type, enc, ns, dimension-1, dims+1, + null, style); + } + } + } +} + +static sdlExtraAttributePtr get_extra_attributes(sdlType *sdl_type, + const char *type, + const char *wsdl_type) { + if (sdl_type) { + sdlAttributeMap::const_iterator iterAttributes = + sdl_type->attributes.find(type); + if (iterAttributes != sdl_type->attributes.end()) { + sdlExtraAttributeMap::const_iterator iterExtraAttributes = + iterAttributes->second->extraAttributes.find(wsdl_type); + if (iterExtraAttributes != + iterAttributes->second->extraAttributes.end()) { + return iterExtraAttributes->second; + } + } + } + return sdlExtraAttributePtr(); +} + +static xmlNodePtr to_xml_array(encodeTypePtr type, CVarRef data_, int style, + xmlNodePtr parent) { + USE_SOAP_GLOBAL; + sdlType *sdl_type = type->sdl_type; + sdlTypePtr element_type; + string array_type, array_size; + int i; + xmlNodePtr xmlParam; + encodePtr enc; + int dimension = 1; + int* dims = NULL; + int soap_version; + Variant array_copy; + Variant data = data_; + + soap_version = SOAP_GLOBAL(soap_version); + + xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, xmlParam); + + if (data.isNull()) { + if (style == SOAP_ENCODED) { + set_xsi_nil(xmlParam); + if (SOAP_GLOBAL(features) & SOAP_USE_XSI_ARRAY_TYPE) { + set_ns_and_type_ex(xmlParam, (soap_version == SOAP_1_1) ? + SOAP_1_1_ENC_NAMESPACE : SOAP_1_2_ENC_NAMESPACE, + "Array"); + } else { + set_ns_and_type(xmlParam, type); + } + } + return xmlParam; + } + + if (data.isObject() && data.toObject().instanceof("iterator")) { + array_copy = Array::Create(); + for (ObjectArrayIter iter(data.toObject().get()); iter; ++iter) { + if (!iter.first().isNull() && iter.first().isString()) { + array_copy.set(iter.first(), iter.second()); + } else { + array_copy.append(iter.second()); + } + } + data = array_copy; + } + + if (data.isArray()) { + sdlExtraAttributePtr ext; + sdlTypeMap::const_iterator iterElements; + sdlAttributeMap::const_iterator iterAttributes; + sdlExtraAttributeMap::const_iterator iterExtraAttributes; + sdlTypePtr elementType; + + i = data.toArray().size(); + + if ((ext = get_extra_attributes(sdl_type, + SOAP_1_1_ENC_NAMESPACE":arrayType", + WSDL_NAMESPACE":arrayType"))) { + String value(ext->val); + char *end = strrchr(value.data(), '['); + if (end) { + *end = '\0'; + end++; + dimension = calc_dimension(end); + } + if (!ext->ns.empty()) { + enc = get_encoder(SOAP_GLOBAL(sdl), ext->ns.c_str(), value.data()); + get_type_str(xmlParam, ext->ns.c_str(), value.data(), array_type); + } else { + array_type += value.data(); + } + + dims = (int*)malloc(sizeof(int) * dimension); + dims[0] = i; + Array el = data.toArray(); + for (i = 1; i < dimension; i++) { + if (!el.empty()) { + ArrayIter iter(el); + Variant tmp = iter.second(); + if (tmp.isArray()) { + dims[i] = tmp.toArray().size(); + } else { + dims[i] = 0; + } + } + } + + array_size += lexical_cast(dims[0]); + for (i=1; i(dims[i]); + } + + } else if ((ext = get_extra_attributes + (sdl_type, + SOAP_1_2_ENC_NAMESPACE":itemType", + WSDL_NAMESPACE":itemType"))) { + if (!ext->ns.empty()) { + enc = get_encoder(SOAP_GLOBAL(sdl), ext->ns.c_str(), ext->val.c_str()); + get_type_str(xmlParam, ext->ns.c_str(), ext->val.c_str(), array_type); + } else { + array_type += ext->val; + } + if ((iterAttributes = + sdl_type->attributes.find(SOAP_1_2_ENC_NAMESPACE":arraySize")) != + sdl_type->attributes.end()) { + if ((iterExtraAttributes = + iterAttributes->second->extraAttributes.find + (WSDL_NAMESPACE":arraySize")) != + iterAttributes->second->extraAttributes.end()) { + sdlExtraAttributePtr ext = iterExtraAttributes->second; + dimension = calc_dimension_12(ext->val.c_str()); + dims = get_position_12(dimension, ext->val.c_str()); + if (dims[0] == 0) {dims[0] = i;} + + array_size += lexical_cast(dims[0]); + for (i=1; i(dims[i]); + } + } + } else { + dims = (int*)malloc(sizeof(int)); + *dims = 0; + array_size += lexical_cast(i); + } + } else if ((ext = get_extra_attributes + (sdl_type, + SOAP_1_2_ENC_NAMESPACE":arraySize", + WSDL_NAMESPACE":arraySize"))) { + dimension = calc_dimension_12(ext->val.c_str()); + dims = get_position_12(dimension, ext->val.c_str()); + if (dims[0] == 0) {dims[0] = i;} + + array_size += lexical_cast(dims[0]); + for (i=1; i(dims[i]); + } + + if (sdl_type && sdl_type->elements.size() == 1 && + (elementType = sdl_type->elements[0]) != NULL && + elementType->encode && + !elementType->encode->details.type_str.empty()) { + elementType = sdl_type->elements[0]; + element_type = elementType; + enc = elementType->encode; + get_type_str(xmlParam, elementType->encode->details.ns.c_str(), + elementType->encode->details.type_str.c_str(), + array_type); + } else { + enc = get_array_type(xmlParam, data, array_type); + } + } else if + (sdl_type && sdl_type->elements.size() == 1 && + (elementType = sdl_type->elements[0]) != NULL && + elementType->encode && + !elementType->encode->details.type_str.empty()) { + element_type = elementType; + enc = elementType->encode; + get_type_str(xmlParam, elementType->encode->details.ns.c_str(), + elementType->encode->details.type_str.c_str(), array_type); + + array_size += lexical_cast(i); + dims = (int*)malloc(sizeof(int) * dimension); + dims[0] = i; + } else { + + enc = get_array_type(xmlParam, data, array_type); + array_size += lexical_cast(i); + dims = (int*)malloc(sizeof(int) * dimension); + dims[0] = i; + } + + if (style == SOAP_ENCODED) { + if (soap_version == SOAP_1_1) { + if (array_type == "xsd:anyType") { + array_type = "xsd:ur-type"; + } + array_type += '['; + array_type += array_size; + array_type += ']'; + set_ns_prop(xmlParam, SOAP_1_1_ENC_NAMESPACE, "arrayType", + array_type.c_str()); + } else { + string replaced; + replaced.reserve(array_size.size()); + for (int i = 0; i < (int)array_size.size(); i++) { + char ch = array_size[i]; + if (ch == ',') { + replaced += ' '; + } else { + replaced += ch; + } + } + set_ns_prop(xmlParam, SOAP_1_2_ENC_NAMESPACE, "itemType", + replaced.c_str()); + set_ns_prop(xmlParam, SOAP_1_2_ENC_NAMESPACE, "arraySize", + replaced.c_str()); + } + } + add_xml_array_elements(xmlParam, element_type, enc, + enc ? encode_add_ns(xmlParam, + enc->details.ns.c_str()) : NULL, + dimension, dims, data, style); + free(dims); + } + if (style == SOAP_ENCODED) { + if (SOAP_GLOBAL(features) & SOAP_USE_XSI_ARRAY_TYPE) { + set_ns_and_type_ex + (xmlParam, (soap_version == SOAP_1_1) ? + SOAP_1_1_ENC_NAMESPACE : SOAP_1_2_ENC_NAMESPACE, "Array"); + } else { + set_ns_and_type(xmlParam, type); + } + } + + return xmlParam; +} + +static Variant to_zval_array(encodeTypePtr type, xmlNodePtr data) { + USE_SOAP_GLOBAL; + Variant ret; + xmlNodePtr trav; + encodePtr enc; + int dimension = 1; + int* dims = NULL; + int* pos = NULL; + xmlAttrPtr attr; + sdl *sdl; + sdlAttributePtr arrayType; + sdlExtraAttributePtr ext; + sdlTypePtr elementType; + + FIND_XML_NULL(data, ret); + sdl = SOAP_GLOBAL(sdl); + + if (data && + (attr = get_attribute(data->properties,"arrayType")) && + attr->children && attr->children->content) { + xmlNsPtr nsptr; + string type, ns; + parse_namespace(attr->children->content, type, ns); + nsptr = xmlSearchNs(attr->doc, attr->parent, BAD_CAST(ns.data())); + + char *end = strrchr(type.data(), '['); + if (end) { + *end = '\0'; + dimension = calc_dimension(end+1); + dims = get_position(dimension, end+1); + } + if (nsptr != NULL) { + enc = get_encoder(SOAP_GLOBAL(sdl), (char*)nsptr->href, type.data()); + } + + } else if ((attr = get_attribute(data->properties,"itemType")) && + attr->children && + attr->children->content) { + string type, ns; + parse_namespace(attr->children->content, type, ns); + xmlNsPtr nsptr; + nsptr = xmlSearchNs(attr->doc, attr->parent, BAD_CAST(ns.data())); + if (nsptr != NULL) { + enc = get_encoder(SOAP_GLOBAL(sdl), (char*)nsptr->href, type.data()); + } + + if ((attr = get_attribute(data->properties,"arraySize")) && + attr->children && attr->children->content) { + dimension = calc_dimension_12((char*)attr->children->content); + dims = get_position_12(dimension, (char*)attr->children->content); + } else { + dims = (int*)malloc(sizeof(int)); + *dims = 0; + } + + } else if ((attr = get_attribute(data->properties,"arraySize")) && + attr->children && attr->children->content) { + + dimension = calc_dimension_12((char*)attr->children->content); + dims = get_position_12(dimension, (char*)attr->children->content); + + } else if ((ext = get_extra_attributes + (type->sdl_type, + SOAP_1_1_ENC_NAMESPACE":arrayType", + WSDL_NAMESPACE":arrayType"))) { + String type(ext->val); + char *end = strrchr(type.data(), '['); + if (end) { + *end = '\0'; + } + if (!ext->ns.empty()) { + enc = get_encoder(SOAP_GLOBAL(sdl), ext->ns.c_str(), type.data()); + } + + dims = (int*)malloc(sizeof(int)); + *dims = 0; + + } else if ((ext = get_extra_attributes + (type->sdl_type, + SOAP_1_2_ENC_NAMESPACE":itemType", + WSDL_NAMESPACE":itemType"))) { + if (!ext->ns.empty()) { + enc = get_encoder(SOAP_GLOBAL(sdl), ext->ns.c_str(), ext->val.c_str()); + } + + if ((ext = get_extra_attributes + (type->sdl_type, + SOAP_1_2_ENC_NAMESPACE":arraySize", + WSDL_NAMESPACE":arraySize"))) { + dimension = calc_dimension_12(ext->val.c_str()); + dims = get_position_12(dimension, ext->val.c_str()); + } else { + dims = (int*)malloc(sizeof(int)); + *dims = 0; + } + } else if ((ext = get_extra_attributes + (type->sdl_type, + SOAP_1_2_ENC_NAMESPACE":arraySize", + WSDL_NAMESPACE":arraySize"))) { + dimension = calc_dimension_12(ext->val.c_str()); + dims = get_position_12(dimension, ext->val.c_str()); + if (type->sdl_type && type->sdl_type->elements.size() == 1 && + (elementType = type->sdl_type->elements[0]) != NULL && + elementType->encode) { + enc = elementType->encode; + } + } else if (type->sdl_type && type->sdl_type->elements.size() == 1 && + (elementType = type->sdl_type->elements[0]) != NULL && + elementType->encode) { + enc = elementType->encode; + } + if (dims == NULL) { + dimension = 1; + dims = (int*)malloc(sizeof(int)); + *dims = 0; + } + pos = (int*)calloc(sizeof(int), dimension); + if (data && (attr = get_attribute(data->properties,"offset")) && + attr->children && attr->children->content) { + char* tmp = strrchr((char*)attr->children->content,'['); + if (tmp == NULL) { + tmp = (char*)attr->children->content; + } + get_position_ex(dimension, tmp, &pos); + } + + ret = Array::Create(); + trav = data->children; + while (trav) { + if (trav->type == XML_ELEMENT_NODE) { + int i; + xmlAttrPtr position = get_attribute(trav->properties,"position"); + + Variant tmpVal = master_to_zval(enc, trav); + if (position != NULL && position->children && + position->children->content) { + char* tmp = strrchr((char*)position->children->content, '['); + if (tmp == NULL) { + tmp = (char*)position->children->content; + } + get_position_ex(dimension, tmp, &pos); + } + + /* Get/Create intermediate arrays for multidimensional arrays */ + i = 0; + Variant *ar = &ret; + while (i < dimension-1) { + if (!ar->toArray().exists(pos[i])) { + ar->set(pos[i], Array::Create()); + } + ar = &ar->lvalAt(pos[i]); + i++; + } + ar->set(pos[i], tmpVal); + + /* Increment position */ + i = dimension; + while (i > 0) { + i--; + pos[i]++; + if (pos[i] >= dims[i]) { + if (i > 0) { + pos[i] = 0; + } else { + /* TODO: Array index overflow */ + } + } else { + break; + } + } + } + trav = trav->next; + } + free(dims); + free(pos); + return ret; +} + +/* Map encode/decode */ +static xmlNodePtr to_xml_map(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + xmlNodePtr xmlParam; + int i; + + xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, xmlParam); + FIND_ZVAL_NULL(data, xmlParam, style); + + if (data.isArray()) { + Array arr = data.toArray(); + i = arr.size(); + ArrayIter iter(arr); + for (;i > 0;i--) { + xmlNodePtr xparam, item; + xmlNodePtr key; + Variant temp_key = iter.first(); + Variant temp_data = iter.second(); + ++iter; + + item = xmlNewNode(NULL, BAD_CAST("item")); + xmlAddChild(xmlParam, item); + key = xmlNewNode(NULL, BAD_CAST("key")); + xmlAddChild(item,key); + if (temp_key.isString()) { + if (style == SOAP_ENCODED) { + set_xsi_type(key, "xsd:string"); + } + xmlNodeSetContent(key, BAD_CAST(temp_key.toString().data())); + } else { + if (style == SOAP_ENCODED) { + set_xsi_type(key, "xsd:int"); + } + String skey = temp_key.toString(); + xmlNodeSetContentLen(key, BAD_CAST(skey.data()), skey.size()); + } + + xparam = master_to_xml(get_conversion(temp_data.getType()), temp_data, + style, item); + xmlNodeSetName(xparam, BAD_CAST("value")); + } + } + if (style == SOAP_ENCODED) { + set_ns_and_type(xmlParam, type); + } + + return xmlParam; +} + +static Variant to_zval_map(encodeTypePtr type, xmlNodePtr data) { + Variant ret, key, value; + xmlNodePtr trav, item, xmlKey, xmlValue; + + FIND_XML_NULL(data, ret); + + if (data && data->children) { + ret = Array::Create(); + trav = data->children; + + FOREACHNODE(trav, "item", item) { + xmlKey = get_node(item->children, "key"); + if (!xmlKey) { + throw SoapException( "Encoding: Can't decode map, missing key"); + } + + xmlValue = get_node(item->children, "value"); + if (!xmlKey) { + throw SoapException( "Encoding: Can't decode map, missing value"); + } + + key = master_to_zval(encodePtr(), xmlKey); + value = master_to_zval(encodePtr(), xmlValue); + + if (key.isString() || key.isInteger()) { + ret.set(key, value); + } else { + throw SoapException( "Encoding: Can't decode map, only Strings or " + "Longs are allowd as keys"); + } + } + ENDFOREACH(trav); + } + return ret; +} + +/* Unknown encode/decode */ +static xmlNodePtr guess_xml_convert(encodeTypePtr type, CVarRef data, + int style, xmlNodePtr parent) { + encodePtr enc = get_conversion(data.getType()); + xmlNodePtr ret = master_to_xml_int(enc, data, style, parent, false); +/* + if (style == SOAP_LITERAL && SOAP_GLOBAL(sdl)) { + set_ns_and_type(ret, &enc->details); + } +*/ + return ret; +} + +static Variant guess_zval_convert(encodeTypePtr type, xmlNodePtr data) { + USE_SOAP_GLOBAL; + encodePtr enc; + xmlAttrPtr tmpattr; + xmlChar *type_name = NULL; + Variant ret; + + data = check_and_resolve_href(data); + + if (data == NULL) { + enc = get_conversion(KindOfNull); + } else if (data->properties && + get_attribute_ex(data->properties, "nil", XSI_NAMESPACE)) { + enc = get_conversion(KindOfNull); + } else { + tmpattr = get_attribute_ex(data->properties,"type", XSI_NAMESPACE); + if (tmpattr != NULL) { + type_name = tmpattr->children->content; + enc = get_encoder_from_prefix(SOAP_GLOBAL(sdl), data, + tmpattr->children->content); + if (enc && type == &enc->details) { + enc.reset(); + } + if (enc) { + encodePtr tmp = enc; + while (tmp && tmp->details.sdl_type != NULL && + tmp->details.sdl_type->kind != XSD_TYPEKIND_COMPLEX) { + if (enc == tmp->details.sdl_type->encode || + tmp == tmp->details.sdl_type->encode) { + enc.reset(); + break; + } + tmp = tmp->details.sdl_type->encode; + } + } + } + + if (!enc) { + /* Didn't have a type, totally guess here */ + /* Logic: has children = IS_OBJECT else IS_STRING */ + xmlNodePtr trav; + + if (get_attribute(data->properties, "arrayType") || + get_attribute(data->properties, "itemType") || + get_attribute(data->properties, "arraySize")) { + enc = get_conversion(SOAP_ENC_ARRAY); + } else { + enc = get_conversion(XSD_STRING); + trav = data->children; + while (trav != NULL) { + if (trav->type == XML_ELEMENT_NODE) { + enc = get_conversion(SOAP_ENC_OBJECT); + break; + } + trav = trav->next; + } + } + } + } + ret = master_to_zval_int(enc, data); + if (SOAP_GLOBAL(sdl) && type_name && enc->details.sdl_type) { + c_soapvar *soapvar = NEW(c_soapvar)(); + soapvar->m_type = enc->details.type; + soapvar->m_value = ret; + + string ns, cptype; + parse_namespace(type_name, cptype, ns); + + xmlNsPtr nsptr = xmlSearchNs(data->doc, data, BAD_CAST(ns.data())); + soapvar->m_stype = cptype; + if (nsptr) { + soapvar->m_ns = String((char*)nsptr->href, CopyString); + } + ret = Object(soapvar); + } + return ret; +} + +/* Time encode/decode */ +static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, CVarRef data, + const char *format, int style, + xmlNodePtr parent) { + /* logic hacked from ext/standard/datetime.c */ + struct tm *ta, tmbuf; + time_t timestamp; + int max_reallocs = 5; + size_t buf_len=64, real_len; + char *buf; + char tzbuf[8]; + + xmlNodePtr xmlParam = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, xmlParam); + FIND_ZVAL_NULL(data, xmlParam, style); + + if (data.isInteger()) { + timestamp = data.toInt64(); + ta = localtime_r(×tamp, &tmbuf); + /*ta = php_gmtime_r(×tamp, &tmbuf);*/ + + buf = (char *)malloc(buf_len); + while ((real_len = strftime(buf, buf_len, format, ta)) == buf_len || + real_len == 0) { + buf_len *= 2; + buf = (char *)realloc(buf, buf_len); + if (!--max_reallocs) break; + } + + /* Time zone support */ + snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", + (ta->tm_gmtoff < 0) ? '-' : '+', (int)abs(ta->tm_gmtoff / 3600), + (int)abs( (ta->tm_gmtoff % 3600) / 60 )); + if (strcmp(tzbuf,"+00:00") == 0) { + strcpy(tzbuf,"Z"); + real_len++; + } else { + real_len += 6; + } + if (real_len >= buf_len) { + buf = (char *)realloc(buf, real_len+1); + } + strcat(buf, tzbuf); + + xmlNodeSetContent(xmlParam, BAD_CAST(buf)); + free(buf); + } else if (data.isString()) { + String sdata = data.toString(); + xmlNodeSetContentLen(xmlParam, BAD_CAST(sdata.data()), sdata.size()); + } + + if (style == SOAP_ENCODED) { + set_ns_and_type(xmlParam, type); + } + return xmlParam; +} + +static xmlNodePtr to_xml_duration(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + // TODO: '-'?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T([0-9]+H)?([0-9]+M)?([0-9]+S)? + return to_xml_string(type, data, style, parent); +} + +static xmlNodePtr to_xml_datetime(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + return to_xml_datetime_ex(type, data, "%Y-%m-%dT%H:%M:%S", style, parent); +} + +static xmlNodePtr to_xml_time(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + /* TODO: microsecconds */ + return to_xml_datetime_ex(type, data, "%H:%M:%S", style, parent); +} + +static xmlNodePtr to_xml_date(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + return to_xml_datetime_ex(type, data, "%Y-%m-%d", style, parent); +} + +static xmlNodePtr to_xml_gyearmonth(encodeTypePtr type, CVarRef data, + int style, xmlNodePtr parent) { + return to_xml_datetime_ex(type, data, "%Y-%m", style, parent); +} + +static xmlNodePtr to_xml_gyear(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + return to_xml_datetime_ex(type, data, "%Y", style, parent); +} + +static xmlNodePtr to_xml_gmonthday(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + return to_xml_datetime_ex(type, data, "--%m-%d", style, parent); +} + +static xmlNodePtr to_xml_gday(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + return to_xml_datetime_ex(type, data, "---%d", style, parent); +} + +static xmlNodePtr to_xml_gmonth(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + return to_xml_datetime_ex(type, data, "--%m--", style, parent); +} + +static Variant to_zval_list(encodeTypePtr enc, xmlNodePtr data) { + /*FIXME*/ + return to_zval_stringc(enc, data); +} + +static xmlNodePtr to_xml_list(encodeTypePtr enc, CVarRef data, int style, + xmlNodePtr parent) { + encodePtr list_enc; + if (enc->sdl_type && enc->sdl_type->kind == XSD_TYPEKIND_LIST && + !enc->sdl_type->elements.empty()) { + list_enc = enc->sdl_type->elements[0]->encode; + } + + xmlNodePtr ret = xmlNewNode(NULL, BAD_CAST("BOGUS")); + xmlAddChild(parent, ret); + FIND_ZVAL_NULL(data, ret, style); + if (data.isArray()) { + Variant tmp; + string list; + Array ht = data.toArray(); + for (ArrayIter iter(ht); iter; ++iter) { + xmlNodePtr dummy = master_to_xml(list_enc, tmp, SOAP_LITERAL, ret); + if (dummy && dummy->children && dummy->children->content) { + if (!list.empty()) { + list += ' '; + } + list += (char*)dummy->children->content; + } else { + throw SoapException("Encoding: Violation of encoding rules"); + } + xmlUnlinkNode(dummy); + xmlFreeNode(dummy); + } + xmlNodeSetContentLen(ret, BAD_CAST(list.c_str()), list.size()); + } else { + String sdata = data.toString(); + char *str = strndup(sdata.data(), sdata.size()); + whiteSpace_collapse(BAD_CAST(str)); + char *start = str; + char *next; + string list; + while (start != NULL && *start != '\0') { + xmlNodePtr dummy; + Variant dummy_zval; + + next = strchr(start,' '); + if (next != NULL) { + *next = '\0'; + next++; + } + dummy_zval = String(start); + dummy = master_to_xml(list_enc, dummy_zval, SOAP_LITERAL, ret); + if (dummy && dummy->children && dummy->children->content) { + if (!list.empty()) { + list += ' '; + } + list += (char*)dummy->children->content; + } else { + throw SoapException("Encoding: Violation of encoding rules"); + } + xmlUnlinkNode(dummy); + xmlFreeNode(dummy); + + start = next; + } + xmlNodeSetContentLen(ret, BAD_CAST(list.c_str()), list.size()); + free(str); + } + return ret; +} + +static xmlNodePtr to_xml_list1(encodeTypePtr enc, CVarRef data, int style, + xmlNodePtr parent) { + /*FIXME: minLength=1 */ + return to_xml_list(enc,data,style, parent); +} + +static Variant to_zval_union(encodeTypePtr enc, xmlNodePtr data) { + /*FIXME*/ + return to_zval_list(enc, data); +} + +static xmlNodePtr to_xml_union(encodeTypePtr enc, CVarRef data, int style, + xmlNodePtr parent) { + /*FIXME*/ + return to_xml_list(enc,data,style, parent); +} + +static Variant to_zval_any(encodeTypePtr type, xmlNodePtr data) { + USE_SOAP_GLOBAL; + xmlBufferPtr buf; + Variant ret; + + if (SOAP_GLOBAL(sdl) && !SOAP_GLOBAL(sdl)->elements.empty() && data->name) { + string nscat; + if (data->ns && data->ns->href) { + nscat += (char*)data->ns->href; + nscat += ':'; + } + nscat += (char*)data->name; + + sdlTypeMap::const_iterator iter = SOAP_GLOBAL(sdl)->elements.find(nscat); + if (iter != SOAP_GLOBAL(sdl)->elements.end() && iter->second->encode) { + return master_to_zval_int(iter->second->encode, data); + } + } + + buf = xmlBufferCreate(); + xmlNodeDump(buf, NULL, data, 0, 0); + ret = String((char*)xmlBufferContent(buf), CopyString); + xmlBufferFree(buf); + return ret; +} + +static xmlNodePtr to_xml_any(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent) { + xmlNodePtr ret = NULL; + + if (data.isArray()) { + encodePtr enc = get_conversion(XSD_ANYXML); + Array arr = data.toArray(); + for (ArrayIter iter(arr); iter; ++iter) { + ret = master_to_xml(enc, iter.second(), style, parent); + if (ret && ret->name != xmlStringTextNoenc && + iter.first().isString()) { + xmlNodeSetName(ret, BAD_CAST(iter.first().toString().data())); + } + } + return ret; + } + String sdata = data.toString(); + ret = xmlNewTextLen(BAD_CAST(sdata.data()), sdata.size()); + ret->name = xmlStringTextNoenc; + ret->parent = parent; + ret->doc = parent->doc; + ret->prev = parent->last; + ret->next = NULL; + if (parent->last) { + parent->last->next = ret; + } else { + parent->children = ret; + } + parent->last = ret; + + return ret; +} + +Variant sdl_guess_convert_zval(encodeTypePtr enc, xmlNodePtr data) { + sdlType *type; + + type = enc->sdl_type; + if (type == NULL) { + return guess_zval_convert(enc, data); + } +/*FIXME: restriction support + if (type && type->restrictions && + data && data->children && data->children->content) { + if (type->restrictions->whiteSpace && type->restrictions->whiteSpace->value) { + if (strcmp(type->restrictions->whiteSpace->value,"replace") == 0) { + whiteSpace_replace(data->children->content); + } else if (strcmp(type->restrictions->whiteSpace->value,"collapse") == 0) { + whiteSpace_collapse(data->children->content); + } + } + if (type->restrictions->enumeration) { + if (!zend_hash_exists(type->restrictions->enumeration,data->children->content,strlen(data->children->content)+1)) { + soap_error1(E_WARNING, "Encoding: Restriction: invalid enumeration value \"%s\"", data->children->content); + } + } + if (type->restrictions->minLength && + strlen(data->children->content) < type->restrictions->minLength->value) { + soap_error0(E_WARNING, "Encoding: Restriction: length less than 'minLength'"); + } + if (type->restrictions->maxLength && + strlen(data->children->content) > type->restrictions->maxLength->value) { + soap_error0(E_WARNING, "Encoding: Restriction: length greater than 'maxLength'"); + } + if (type->restrictions->length && + strlen(data->children->content) != type->restrictions->length->value) { + soap_error0(E_WARNING, "Encoding: Restriction: length is not equal to 'length'"); + } + } +*/ + switch (type->kind) { + case XSD_TYPEKIND_SIMPLE: + if (type->encode && enc != &type->encode->details) { + return master_to_zval_int(type->encode, data); + } else { + return guess_zval_convert(enc, data); + } + break; + case XSD_TYPEKIND_LIST: + return to_zval_list(enc, data); + case XSD_TYPEKIND_UNION: + return to_zval_union(enc, data); + case XSD_TYPEKIND_COMPLEX: + case XSD_TYPEKIND_RESTRICTION: + case XSD_TYPEKIND_EXTENSION: + if (type->encode && + (type->encode->details.type == KindOfArray || + type->encode->details.type == SOAP_ENC_ARRAY)) { + return to_zval_array(enc, data); + } + return to_zval_object(enc, data); + default: + throw SoapException("Encoding: Internal Error"); + } + return guess_zval_convert(enc, data); +} + +xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, CVarRef data, int style, + xmlNodePtr parent) { + sdlType *type; + xmlNodePtr ret = NULL; + + type = enc->sdl_type; + + if (type == NULL) { + ret = guess_xml_convert(enc, data, style, parent); + if (style == SOAP_ENCODED) { + set_ns_and_type(ret, enc); + } + return ret; + } +/*FIXME: restriction support + 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_STRLEN_P(data)+1)) { + soap_error1(E_WARNING, "Encoding: Restriction: invalid enumeration value \"%s\".", Z_STRVAL_P(data)); + } + } + if (type->restrictions->minLength && + Z_STRLEN_P(data) < type->restrictions->minLength->value) { + soap_error0(E_WARNING, "Encoding: Restriction: length less than 'minLength'"); + } + if (type->restrictions->maxLength && + Z_STRLEN_P(data) > type->restrictions->maxLength->value) { + soap_error0(E_WARNING, "Encoding: Restriction: length greater than 'maxLength'"); + } + if (type->restrictions->length && + Z_STRLEN_P(data) != type->restrictions->length->value) { + soap_error0(E_WARNING, "Encoding: Restriction: length is not equal to 'length'"); + } + } + } +*/ + switch(type->kind) { + case XSD_TYPEKIND_SIMPLE: + if (type->encode && enc != &type->encode->details) { + ret = master_to_xml(type->encode, data, style, parent); + } else { + ret = guess_xml_convert(enc, data, style, parent); + } + break; + case XSD_TYPEKIND_LIST: + ret = to_xml_list(enc, data, style, parent); + break; + case XSD_TYPEKIND_UNION: + ret = to_xml_union(enc, data, style, parent); + break; + case XSD_TYPEKIND_COMPLEX: + case XSD_TYPEKIND_RESTRICTION: + case XSD_TYPEKIND_EXTENSION: + if (type->encode && + (type->encode->details.type == KindOfArray || + type->encode->details.type == SOAP_ENC_ARRAY)) { + return to_xml_array(enc, data, style, parent); + } else { + return to_xml_object(enc, data, style, parent); + } + break; + default: + throw SoapException("Encoding: Internal Error"); + break; + } + if (style == SOAP_ENCODED) { + set_ns_and_type(ret, enc); + } + return ret; +} + +static xmlNodePtr check_and_resolve_href(xmlNodePtr data) { + if (data && data->properties) { + xmlAttrPtr href; + + href = data->properties; + while (1) { + href = get_attribute(href, "href"); + if (href == NULL || href->ns == NULL) {break;} + href = href->next; + } + if (href) { + /* Internal href try and find node */ + if (href->children->content[0] == '#') { + xmlNodePtr ret = get_node_with_attribute_recursive + (data->doc->children, NULL, "id", + (char*)&href->children->content[1]); + if (!ret) { + throw SoapException("Encoding: Unresolved reference '%s'", + href->children->content); + } + return ret; + } else { + /* TODO: External href....? */ + throw SoapException("Encoding: External reference '%s'", + href->children->content); + } + } + /* SOAP 1.2 enc:id enc:ref */ + href = get_attribute_ex(data->properties, "ref", SOAP_1_2_ENC_NAMESPACE); + if (href) { + xmlChar* id; + xmlNodePtr ret; + + if (href->children->content[0] == '#') { + id = href->children->content+1; + } else { + id = href->children->content; + } + ret = get_node_with_attribute_recursive_ex + (data->doc->children, NULL, NULL, "id", (char*)id, + SOAP_1_2_ENC_NAMESPACE); + if (!ret) { + throw SoapException("Encoding: Unresolved reference '%s'", + href->children->content); + } else if (ret == data) { + throw SoapException("Encoding: Violation of id and ref information " + "items '%s'", href->children->content); + } + return ret; + } + } + return data; +} + +static void set_ns_and_type(xmlNodePtr node, encodeTypePtr type) { + set_ns_and_type_ex(node, type->ns.c_str(), type->type_str.c_str()); +} + +static void set_ns_and_type_ex(xmlNodePtr node, const char *ns, + const char *type) { + string nstype; + get_type_str(node, ns, type, nstype); + set_xsi_type(node, nstype.c_str()); +} + +static xmlNsPtr xmlSearchNsPrefixByHref(xmlDocPtr doc, xmlNodePtr node, + const xmlChar * href) { + xmlNsPtr cur; + xmlNodePtr orig = node; + + while (node) { + if (node->type == XML_ENTITY_REF_NODE || + node->type == XML_ENTITY_NODE || + node->type == XML_ENTITY_DECL) { + return NULL; + } + if (node->type == XML_ELEMENT_NODE) { + cur = node->nsDef; + while (cur != NULL) { + if (cur->prefix && cur->href && xmlStrEqual(cur->href, href)) { + if (xmlSearchNs(doc, node, cur->prefix) == cur) { + return cur; + } + } + cur = cur->next; + } + if (orig != node) { + cur = node->ns; + if (cur != NULL) { + if (cur->prefix && cur->href && xmlStrEqual(cur->href, href)) { + if (xmlSearchNs(doc, node, cur->prefix) == cur) { + return cur; + } + } + } + } + } + node = node->parent; + } + return NULL; +} + +xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns) { + USE_SOAP_GLOBAL; + xmlNsPtr xmlns; + + if (ns == NULL) { + return NULL; + } + + xmlns = xmlSearchNsByHref(node->doc, node, BAD_CAST(ns)); + if (xmlns != NULL && xmlns->prefix == NULL) { + xmlns = xmlSearchNsPrefixByHref(node->doc, node, BAD_CAST(ns)); + } + if (xmlns == NULL) { + map::const_iterator iter = + SOAP_GLOBAL(defEncNs).find(ns); + if (iter != SOAP_GLOBAL(defEncNs).end()) { + xmlns = xmlNewNs(node->doc->children, BAD_CAST(ns), + (xmlChar*)iter->second.c_str()); + } else { + int num = ++SOAP_GLOBAL(cur_uniq_ns); + + string prefix; + while (1) { + prefix = "ns"; + prefix += lexical_cast(num); + if (xmlSearchNs(node->doc, node, BAD_CAST(prefix.c_str())) == NULL) { + break; + } + num = ++SOAP_GLOBAL(cur_uniq_ns); + } + + xmlns = xmlNewNs(node->doc->children, BAD_CAST(ns), + BAD_CAST(prefix.c_str())); + } + } + return xmlns; +} + +static void set_ns_prop(xmlNodePtr node, const char *ns, const char *name, + const char *val) { + xmlSetNsProp(node, encode_add_ns(node, ns), BAD_CAST(name), BAD_CAST(val)); +} + +static void set_xsi_nil(xmlNodePtr node) { + set_ns_prop(node, XSI_NAMESPACE, "nil", "true"); +} + +static void set_xsi_type(xmlNodePtr node, const char *type) { + set_ns_prop(node, XSI_NAMESPACE, "type", type); +} + +void encode_reset_ns() { + USE_SOAP_GLOBAL; + SOAP_GLOBAL(cur_uniq_ns) = 0; + SOAP_GLOBAL(cur_uniq_ref) = 0; + SOAP_GLOBAL(ref_map).clear(); +} + +void encode_finish() { + USE_SOAP_GLOBAL; + SOAP_GLOBAL(cur_uniq_ns) = 0; + SOAP_GLOBAL(cur_uniq_ref) = 0; + SOAP_GLOBAL(ref_map).clear(); +} + +encodePtr get_conversion(int encode) { + USE_SOAP_GLOBAL; + map::const_iterator iter = + SOAP_GLOBAL(defEncIndex).find(encode); + if (iter != SOAP_GLOBAL(defEncIndex).end()) { + return iter->second; + } + throw SoapException( "Encoding: Cannot find encoding"); +} + +static encodePtr get_array_type(xmlNodePtr node, CVarRef array, + string &type) { + USE_SOAP_GLOBAL; + int i, count, cur_type, prev_type; + bool different; + const char *prev_stype = NULL, *cur_stype = NULL, *prev_ns = NULL, + *cur_ns = NULL; + + if (!array.isArray()) { + type += "xsd:anyType"; + return get_conversion(XSD_ANYTYPE); + } + Array ht = array.toArray(); + + different = false; + cur_type = prev_type = 0; + count = ht.size(); + + ArrayIter iter(ht); + for (i = 0;i < count;i++) { + Variant tmp = iter.second(); + + if (tmp.isObject() && tmp.toObject().instanceof("SoapVar")) { + c_soapvar *var = tmp.toObject().getTyped(); + cur_type = var->m_type; + if (!var->m_stype.empty()) { + cur_stype = var->m_stype.c_str(); + } else { + cur_stype = NULL; + } + if (!var->m_ns.empty()) { + cur_ns = var->m_ns.c_str(); + } else { + cur_ns = NULL; + } + } else if (tmp.isArray() && !tmp.toArray()->isVectorData()) { + cur_type = APACHE_MAP; + cur_stype = NULL; + cur_ns = NULL; + } else { + cur_type = tmp.getType(); + cur_stype = NULL; + cur_ns = NULL; + } + + if (i > 0) { + if ((cur_type != prev_type) || + (cur_stype != NULL && prev_stype != NULL && + strcmp(cur_stype,prev_stype) != 0) || + (cur_stype == NULL && cur_stype != prev_stype) || + (cur_ns != NULL && prev_ns != NULL && strcmp(cur_ns,prev_ns) != 0) || + (cur_ns == NULL && cur_ns != prev_ns)) { + different = true; + break; + } + } + + prev_type = cur_type; + prev_stype = cur_stype; + prev_ns = cur_ns; + ++iter; + } + + if (different || count == 0) { + type += "xsd:anyType"; + return get_conversion(XSD_ANYTYPE); + } + + encodePtr enc; + if (cur_stype != NULL) { + string array_type; + + if (cur_ns) { + xmlNsPtr ns = encode_add_ns(node,cur_ns); + + type += (char*)ns->prefix; + type += ':'; + array_type += cur_ns; + array_type += ':'; + } + type += cur_stype; + array_type += cur_stype; + + enc = get_encoder_ex(SOAP_GLOBAL(sdl), array_type); + } else { + enc = get_conversion(cur_type); + get_type_str(node, enc->details.ns.c_str(), + enc->details.type_str.c_str(), type); + } + return enc; +} + +static void get_type_str(xmlNodePtr node, const char* ns, const char* type, + string &ret) { + USE_SOAP_GLOBAL; + if (ns) { + xmlNsPtr xmlns; + if (SOAP_GLOBAL(soap_version) == SOAP_1_2 && + strcmp(ns,SOAP_1_1_ENC_NAMESPACE) == 0) { + ns = SOAP_1_2_ENC_NAMESPACE; + } else if (SOAP_GLOBAL(soap_version) == SOAP_1_1 && + strcmp(ns,SOAP_1_2_ENC_NAMESPACE) == 0) { + ns = SOAP_1_1_ENC_NAMESPACE; + } + xmlns = encode_add_ns(node,ns); + ret += (char*)xmlns->prefix; + ret += ':'; + } + ret += type; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/soap/encoding.h b/src/cpp/ext/soap/encoding.h new file mode 100644 index 0000000000000..068069f570a42 --- /dev/null +++ b/src/cpp/ext/soap/encoding.h @@ -0,0 +1,254 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_ENCODING_H +#define PHP_ENCODING_H + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// defines + +#define XSD_1999_NAMESPACE "http://www.w3.org/1999/XMLSchema" +#define XSD_1999_TIMEINSTANT 401 +#define XSD_1999_TIMEINSTANT_STRING "timeInstant" + +#define SOAP_1_1_ENV_NAMESPACE "http://schemas.xmlsoap.org/soap/envelope/" +#define SOAP_1_1_ENV_NS_PREFIX "SOAP-ENV" + +#define SOAP_1_2_ENV_NAMESPACE "http://www.w3.org/2003/05/soap-envelope" +#define SOAP_1_2_ENV_NS_PREFIX "env" + +#define SOAP_1_1_ENC_NAMESPACE "http://schemas.xmlsoap.org/soap/encoding/" +#define SOAP_1_1_ENC_NS_PREFIX "SOAP-ENC" + +#define SOAP_1_2_ENC_NAMESPACE "http://www.w3.org/2003/05/soap-encoding" +#define SOAP_1_2_ENC_NS_PREFIX "enc" + +#define SCHEMA_NAMESPACE "http://www.w3.org/2001/XMLSchema" +#define XSD_NAMESPACE "http://www.w3.org/2001/XMLSchema" +#define XSD_NS_PREFIX "xsd" +#define XSI_NAMESPACE "http://www.w3.org/2001/XMLSchema-instance" +#define XSI_NS_PREFIX "xsi" +#define XML_NAMESPACE "http://www.w3.org/XML/1998/namespace" +#define XML_NS_PREFIX "xml" + +#define XSD_STRING 101 +#define XSD_STRING_STRING "string" +#define XSD_BOOLEAN 102 +#define XSD_BOOLEAN_STRING "boolean" +#define XSD_DECIMAL 103 +#define XSD_DECIMAL_STRING "decimal" +#define XSD_FLOAT 104 +#define XSD_FLOAT_STRING "float" +#define XSD_DOUBLE 105 +#define XSD_DOUBLE_STRING "double" +#define XSD_DURATION 106 +#define XSD_DURATION_STRING "duration" +#define XSD_DATETIME 107 +#define XSD_DATETIME_STRING "dateTime" +#define XSD_TIME 108 +#define XSD_TIME_STRING "time" +#define XSD_DATE 109 +#define XSD_DATE_STRING "date" +#define XSD_GYEARMONTH 110 +#define XSD_GYEARMONTH_STRING "gYearMonth" +#define XSD_GYEAR 111 +#define XSD_GYEAR_STRING "gYear" +#define XSD_GMONTHDAY 112 +#define XSD_GMONTHDAY_STRING "gMonthDay" +#define XSD_GDAY 113 +#define XSD_GDAY_STRING "gDay" +#define XSD_GMONTH 114 +#define XSD_GMONTH_STRING "gMonth" +#define XSD_HEXBINARY 115 +#define XSD_HEXBINARY_STRING "hexBinary" +#define XSD_BASE64BINARY 116 +#define XSD_BASE64BINARY_STRING "base64Binary" +#define XSD_ANYURI 117 +#define XSD_ANYURI_STRING "anyURI" +#define XSD_QNAME 118 +#define XSD_QNAME_STRING "QName" +#define XSD_NOTATION 119 +#define XSD_NOTATION_STRING "NOTATION" +#define XSD_NORMALIZEDSTRING 120 +#define XSD_NORMALIZEDSTRING_STRING "normalizedString" +#define XSD_TOKEN 121 +#define XSD_TOKEN_STRING "token" +#define XSD_LANGUAGE 122 +#define XSD_LANGUAGE_STRING "language" +#define XSD_NMTOKEN 123 +#define XSD_NMTOKEN_STRING "NMTOKEN" +#define XSD_NAME 124 +#define XSD_NAME_STRING "Name" +#define XSD_NCNAME 125 +#define XSD_NCNAME_STRING "NCName" +#define XSD_ID 126 +#define XSD_ID_STRING "ID" +#define XSD_IDREF 127 +#define XSD_IDREF_STRING "IDREF" +#define XSD_IDREFS 128 +#define XSD_IDREFS_STRING "IDREFS" +#define XSD_ENTITY 129 +#define XSD_ENTITY_STRING "ENTITY" +#define XSD_ENTITIES 130 +#define XSD_ENTITIES_STRING "ENTITIES" +#define XSD_INTEGER 131 +#define XSD_INTEGER_STRING "integer" +#define XSD_NONPOSITIVEINTEGER 132 +#define XSD_NONPOSITIVEINTEGER_STRING "nonPositiveInteger" +#define XSD_NEGATIVEINTEGER 133 +#define XSD_NEGATIVEINTEGER_STRING "negativeInteger" +#define XSD_LONG 134 +#define XSD_LONG_STRING "long" +#define XSD_INT 135 +#define XSD_INT_STRING "int" +#define XSD_SHORT 136 +#define XSD_SHORT_STRING "short" +#define XSD_BYTE 137 +#define XSD_BYTE_STRING "byte" +#define XSD_NONNEGATIVEINTEGER 138 +#define XSD_NONNEGATIVEINTEGER_STRING "nonNegativeInteger" +#define XSD_UNSIGNEDLONG 139 +#define XSD_UNSIGNEDLONG_STRING "unsignedLong" +#define XSD_UNSIGNEDINT 140 +#define XSD_UNSIGNEDINT_STRING "unsignedInt" +#define XSD_UNSIGNEDSHORT 141 +#define XSD_UNSIGNEDSHORT_STRING "unsignedShort" +#define XSD_UNSIGNEDBYTE 142 +#define XSD_UNSIGNEDBYTE_STRING "unsignedByte" +#define XSD_POSITIVEINTEGER 143 +#define XSD_POSITIVEINTEGER_STRING "positiveInteger" +#define XSD_NMTOKENS 144 +#define XSD_NMTOKENS_STRING "NMTOKENS" +#define XSD_ANYTYPE 145 +#define XSD_ANYTYPE_STRING "anyType" +#define XSD_UR_TYPE 146 +#define XSD_UR_TYPE_STRING "ur-type" + +#define XSD_ANYXML 147 + +#define APACHE_NAMESPACE "http://xml.apache.org/xml-soap" +#define APACHE_MAP 200 +#define APACHE_MAP_STRING "Map" + +#define SOAP_ENC_ARRAY 300 +#define SOAP_ENC_ARRAY_STRING "Array" +#define SOAP_ENC_OBJECT 301 +#define SOAP_ENC_OBJECT_STRING "Struct" + +#define WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/" +#define WSDL_NS_PREFIX "wsdl" + +#define WSDL_SOAP11_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/" +#define WSDL_SOAP12_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap12/" +#define RPC_SOAP12_NAMESPACE "http://www.w3.org/2003/05/soap-rpc" +#define RPC_SOAP12_NS_PREFIX "rpc" + +#define WSDL_HTTP11_NAMESPACE "http://schemas.xmlsoap.org/wsdl/http/" +#define WSDL_HTTP12_NAMESPACE "http://www.w3.org/2003/05/soap/bindings/HTTP/" +#define WSDL_HTTP_NS_PREFIX "http" + +#define WSDL_HTTP_TRANSPORT "http://schemas.xmlsoap.org/soap/http" + +#define WSDL_MIME_NAMESPACE "http://schemas.xmlsoap.org/wsdl/mime/" + +#define WSDL_DIME_NAMESPACE "http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/" +#define WSDL_DIME_OPEN \ + "http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout" +#define WSDL_DIME_CLOSED \ + "http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout" + +#define UNKNOWN_TYPE 999998 +#define END_KNOWN_TYPES 999999 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(soapMapping); +struct soapMapping { + Variant to_xml; + Variant to_zval; +}; + +class sdlType; +class encodeType { +public: + encodeType() : type(0), sdl_type(NULL) {} + + int type; + std::string type_str; + std::string ns; + sdlType *sdl_type; // weak pointer + soapMappingPtr map; +}; +typedef encodeType* encodeTypePtr; + +DECLARE_BOOST_TYPES(encode); +typedef StringToencodePtrMap encodeMap; +typedef boost::shared_ptr encodeMapPtr; +struct encode { + encodeType details; + Variant (*to_zval)(encodeTypePtr type, xmlNodePtr data); + xmlNodePtr (*to_xml)(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent); +}; + +struct encodeStatic { + int type; + const char *type_str; + const char *ns; + Variant (*to_zval)(encodeTypePtr type, xmlNodePtr data); + xmlNodePtr (*to_xml)(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent); +}; + +/////////////////////////////////////////////////////////////////////////////// + +/* Master functions all encode/decode should be called thur these functions */ +xmlNodePtr master_to_xml(encodePtr encode, CVarRef data, int style, + xmlNodePtr parent); +Variant master_to_zval(encodePtr encode, xmlNodePtr data); + +/* user defined mapping */ +xmlNodePtr to_xml_user(encodeTypePtr type, CVarRef data, int style, + xmlNodePtr parent); +Variant to_zval_user(encodeTypePtr type, xmlNodePtr node); + +void whiteSpace_replace(xmlChar* str); +void whiteSpace_collapse(xmlChar* str); + +xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, CVarRef data, + int style, xmlNodePtr parent); +Variant sdl_guess_convert_zval(encodeTypePtr enc, xmlNodePtr data); + +void encode_finish(); +void encode_reset_ns(); +xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns); + +encodePtr get_conversion(int encode); + +/////////////////////////////////////////////////////////////////////////////// + +// used by soap.cpp +extern encodeStatic s_defaultEncoding[]; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif diff --git a/src/cpp/ext/soap/packet.cpp b/src/cpp/ext/soap/packet.cpp new file mode 100644 index 0000000000000..e2d2618e6484c --- /dev/null +++ b/src/cpp/ext/soap/packet.cpp @@ -0,0 +1,424 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static void add_soap_fault(c_soapclient *client, CStrRef code, CStrRef fault) { + client->m_soap_fault = + Object((NEW(c_soapfault)())->create(String(code, CopyString), fault)); +} + +/* SOAP client calls this function to parse response from SOAP server */ +bool parse_packet_soap(c_soapclient *obj, const char *buffer, + int buffer_size, sdlFunctionPtr fn, const char *fn_name, + Variant &return_value, Variant &soap_headers) { + char* envelope_ns = NULL; + xmlNodePtr trav, env, head, body, resp, cur, fault; + xmlAttrPtr attr; + int param_count = 0; + int soap_version = SOAP_1_1; + sdlSoapBindingFunctionHeaderMap *hdrs = NULL; + + return_value.reset(); + + /* Response for one-way opearation */ + if (buffer_size == 0) { + return true; + } + + /* Parse XML packet */ + xmlDocPtr response = soap_xmlParseMemory(buffer, buffer_size); + if (!response) { + add_soap_fault(obj, "Client", "looks like we got no XML document"); + return false; + } + if (xmlGetIntSubset(response) != NULL) { + add_soap_fault(obj, "Client", "DTD are not supported by SOAP"); + xmlFreeDoc(response); + return false; + } + + /* Get element */ + env = NULL; + trav = response->children; + while (trav != NULL) { + if (trav->type == XML_ELEMENT_NODE) { + if (!env && node_is_equal_ex(trav,"Envelope", SOAP_1_1_ENV_NAMESPACE)) { + env = trav; + envelope_ns = SOAP_1_1_ENV_NAMESPACE; + soap_version = SOAP_1_1; + } else if (!env && + node_is_equal_ex(trav, "Envelope", SOAP_1_2_ENV_NAMESPACE)) { + env = trav; + envelope_ns = SOAP_1_2_ENV_NAMESPACE; + soap_version = SOAP_1_2; + } else { + add_soap_fault(obj, "VersionMismatch", "Wrong Version"); + xmlFreeDoc(response); + return false; + } + } + trav = trav->next; + } + if (env == NULL) { + add_soap_fault(obj, "Client", + "looks like we got XML without \"Envelope\" element"); + xmlFreeDoc(response); + return false; + } + + attr = env->properties; + while (attr != NULL) { + if (attr->ns == NULL) { + add_soap_fault(obj, "Client", + "A SOAP Envelope element cannot have non Namespace " + "qualified attributes"); + xmlFreeDoc(response); + return false; + } + if (attr_is_equal_ex(attr, "encodingStyle", SOAP_1_2_ENV_NAMESPACE)) { + if (soap_version == SOAP_1_2) { + add_soap_fault(obj, "Client", + "encodingStyle cannot be specified on the Envelope"); + xmlFreeDoc(response); + return false; + } + if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE)) { + add_soap_fault(obj, "Client", "Unknown data encoding style"); + xmlFreeDoc(response); + return false; + } + } + attr = attr->next; + } + + /* Get
    element */ + head = NULL; + trav = env->children; + while (trav != NULL && trav->type != XML_ELEMENT_NODE) { + trav = trav->next; + } + if (trav != NULL && node_is_equal_ex(trav,"Header",envelope_ns)) { + head = trav; + trav = trav->next; + } + + /* Get element */ + body = NULL; + while (trav != NULL && trav->type != XML_ELEMENT_NODE) { + trav = trav->next; + } + if (trav != NULL && node_is_equal_ex(trav,"Body",envelope_ns)) { + body = trav; + trav = trav->next; + } + while (trav != NULL && trav->type != XML_ELEMENT_NODE) { + trav = trav->next; + } + if (body == NULL) { + add_soap_fault(obj, "Client", "Body must be present in a SOAP envelope"); + xmlFreeDoc(response); + return false; + } + attr = body->properties; + while (attr != NULL) { + if (attr->ns == NULL) { + if (soap_version == SOAP_1_2) { + add_soap_fault(obj, "Client", + "A SOAP Body element cannot have non Namespace " + "qualified attributes"); + xmlFreeDoc(response); + return false; + } + } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) { + if (soap_version == SOAP_1_2) { + add_soap_fault(obj, "Client", + "encodingStyle cannot be specified on the Body"); + xmlFreeDoc(response); + return false; + } + if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE)) { + add_soap_fault(obj, "Client", "Unknown data encoding style"); + xmlFreeDoc(response); + return false; + } + } + attr = attr->next; + } + if (trav != NULL && soap_version == SOAP_1_2) { + add_soap_fault(obj, "Client", + "A SOAP 1.2 envelope can contain only Header and Body"); + xmlFreeDoc(response); + return false; + } + + if (head != NULL) { + attr = head->properties; + while (attr != NULL) { + if (attr->ns == NULL) { + add_soap_fault(obj, "Client", + "A SOAP Header element cannot have non Namespace " + "qualified attributes"); + xmlFreeDoc(response); + return false; + } + if (attr_is_equal_ex(attr, "encodingStyle", SOAP_1_2_ENV_NAMESPACE)) { + if (soap_version == SOAP_1_2) { + add_soap_fault(obj, "Client", + "encodingStyle cannot be specified on the Header"); + xmlFreeDoc(response); + return false; + } + if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE)) { + add_soap_fault(obj, "Client", "Unknown data encoding style"); + xmlFreeDoc(response); + return false; + } + } + attr = attr->next; + } + } + + /* Check if contains element */ + fault = get_node_ex(body->children,"Fault",envelope_ns); + if (fault != NULL) { + char *faultcode = NULL; + String faultstring, faultactor; + Variant details; + xmlNodePtr tmp; + + if (soap_version == SOAP_1_1) { + tmp = get_node(fault->children, "faultcode"); + if (tmp != NULL && tmp->children != NULL) { + faultcode = (char*)tmp->children->content; + } + + tmp = get_node(fault->children, "faultstring"); + if (tmp != NULL && tmp->children != NULL) { + Variant zv = master_to_zval(get_conversion(KindOfString), tmp); + faultstring = zv.toString(); + } + + tmp = get_node(fault->children, "faultactor"); + if (tmp != NULL && tmp->children != NULL) { + Variant zv = master_to_zval(get_conversion(KindOfString), tmp); + faultactor = zv.toString(); + } + + tmp = get_node(fault->children, "detail"); + if (tmp != NULL) { + details = master_to_zval(encodePtr(), tmp); + } + } else { + tmp = get_node(fault->children, "Code"); + if (tmp != NULL && tmp->children != NULL) { + tmp = get_node(tmp->children, "Value"); + if (tmp != NULL && tmp->children != NULL) { + faultcode = (char*)tmp->children->content; + } + } + + tmp = get_node(fault->children,"Reason"); + if (tmp != NULL && tmp->children != NULL) { + /* TODO: lang attribute */ + tmp = get_node(tmp->children,"Text"); + if (tmp != NULL && tmp->children != NULL) { + Variant zv = master_to_zval(get_conversion(KindOfString), tmp); + faultstring = zv.toString(); + } + } + + tmp = get_node(fault->children,"Detail"); + if (tmp != NULL) { + details = master_to_zval(encodePtr(), tmp); + } + } + obj->m_soap_fault = + Object((NEW(c_soapfault)())->create(String(faultcode, CopyString), + faultstring, faultactor, details)); + xmlFreeDoc(response); + return false; + } + + /* Parse content of element */ + return_value = Array::Create(); + resp = body->children; + while (resp != NULL && resp->type != XML_ELEMENT_NODE) { + resp = resp->next; + } + if (resp != NULL) { + if (fn && fn->binding && fn->binding->bindingType == BINDING_SOAP) { + /* Function has WSDL description */ + sdlParamPtr h_param, param; + xmlNodePtr val = NULL; + const char *name, *ns = NULL; + Variant tmp; + sdlSoapBindingFunctionPtr fnb = + (sdlSoapBindingFunctionPtr)fn->bindingAttributes; + int res_count; + + hdrs = &fnb->output.headers; + + if (!fn->responseParameters.empty()) { + res_count = fn->responseParameters.size(); + for (unsigned int i = 0; i < fn->responseParameters.size(); i++) { + h_param = fn->responseParameters[i]; + param = h_param; + if (fnb->style == SOAP_DOCUMENT) { + if (param->element) { + name = param->element->name.c_str(); + ns = param->element->namens.c_str(); +/* + name = param->encode->details.type_str; + ns = param->encode->details.ns; +*/ + } else { + name = param->paramName.c_str(); + } + } else { + name = fn->responseName.c_str(); + /* ns = ? */ + } + + /* Get value of parameter */ + cur = get_node_ex(resp, (char*)name, (char*)ns); + if (!cur) { + cur = get_node(resp, (char*)name); + /* TODO: produce warning invalid ns */ + } + if (!cur && fnb->style == SOAP_RPC) { + cur = resp; + } + if (cur) { + if (fnb->style == SOAP_DOCUMENT) { + val = cur; + } else { + val = get_node(cur->children, (char*)param->paramName.c_str()); + if (res_count == 1) { + if (val == NULL) { + val = get_node(cur->children, "return"); + } + if (val == NULL) { + val = get_node(cur->children, "result"); + } + if (val == NULL && cur->children && !cur->children->next) { + val = cur->children; + } + } + } + } + + if (!val) { + /* TODO: may be "nil" is not OK? */ + tmp.reset(); +/* + add_soap_fault(obj, "Client", "Can't find response data"); + xmlFreeDoc(response); + return false; +*/ + } else { + /* Decoding value of parameter */ + if (param != NULL) { + tmp = master_to_zval(param->encode, val); + } else { + tmp = master_to_zval(encodePtr(), val); + } + } + return_value.set(String(param->paramName), tmp); + param_count++; + } + } + } else { + /* Function hasn't WSDL description */ + xmlNodePtr val; + val = resp->children; + while (val != NULL) { + while (val && val->type != XML_ELEMENT_NODE) { + val = val->next; + } + if (val != NULL) { + if (!node_is_equal_ex(val,"result",RPC_SOAP12_NAMESPACE)) { + Variant tmp = master_to_zval(encodePtr(), val); + if (val->name) { + String key((char*)val->name, CopyString); + if (return_value.toArray().exists(key)) { + return_value.lvalAt(key).append(tmp); + } else if (val->next && get_node(val->next, (char*)val->name)) { + Array arr = Array::Create(); + arr.append(tmp); + return_value.set(key, arr); + } else { + return_value.set(key, tmp); + } + } else { + return_value.append(tmp); + } + ++param_count; + } + val = val->next; + } + } + } + } + + if (return_value.isArray()) { + if (param_count == 0) { + return_value.reset(); + } else if (param_count == 1) { + Array arr = return_value.toArray(); + ArrayIter iter(arr); + return_value = iter.second(); + } + } + + if (head) { + trav = head->children; + while (trav) { + if (trav->type == XML_ELEMENT_NODE) { + encodePtr enc; + if (hdrs && !hdrs->empty()) { + string key; + if (trav->ns) { + key += (char*)trav->ns->href; + key += ':'; + } + key += (char*)trav->name; + sdlSoapBindingFunctionHeaderMap::const_iterator iter = + hdrs->find(key); + if (iter != hdrs->end()) { + enc = iter->second->encode; + } + } + soap_headers.set(String((char*)trav->name, CopyString), + master_to_zval(enc, trav)); + } + trav = trav->next; + } + } + + xmlFreeDoc(response); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/soap/packet.h b/src/cpp/ext/soap/packet.h new file mode 100644 index 0000000000000..9e995e7b4c0e3 --- /dev/null +++ b/src/cpp/ext/soap/packet.h @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_PACKET_SOAP_H +#define PHP_PACKET_SOAP_H + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class c_soapclient; +bool parse_packet_soap(c_soapclient *client, const char *buffer, + int buffer_size, sdlFunctionPtr fn, const char *fn_name, + Variant &return_value, Variant &soap_headers); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif diff --git a/src/cpp/ext/soap/schema.cpp b/src/cpp/ext/soap/schema.cpp new file mode 100644 index 0000000000000..023a476596fd0 --- /dev/null +++ b/src/cpp/ext/soap/schema.cpp @@ -0,0 +1,2004 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; +using namespace boost; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static bool schema_simpleType +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpleType, sdlTypePtr cur_type); +static bool schema_complexType +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compType, sdlTypePtr cur_type); +static bool schema_list +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypePtr cur_type); +static bool schema_union +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTypePtr cur_type); +static bool schema_simpleContent +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpCompType, sdlTypePtr cur_type); +static bool schema_restriction_simpleContent +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr restType, sdlTypePtr cur_type, + int simpleType); +static bool schema_restriction_complexContent +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr restType, sdlTypePtr cur_type); +static bool schema_extension_simpleContent +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr extType, sdlTypePtr cur_type); +static bool schema_extension_complexContent +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr extType, sdlTypePtr cur_type); +static bool schema_sequence +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr seqType, sdlTypePtr cur_type, + sdlContentModelPtr model); +static bool schema_all +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr extType, sdlTypePtr cur_type, + sdlContentModelPtr model); +static bool schema_choice +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr choiceType, sdlTypePtr cur_type, + sdlContentModelPtr model); +static bool schema_group +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, sdlTypePtr cur_type, + sdlContentModelPtr model); +static bool schema_any +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr extType, sdlTypePtr cur_type, + sdlContentModelPtr model); +static bool schema_element +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTypePtr cur_type, + sdlContentModelPtr model); +static bool schema_attribute +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdlTypePtr cur_type, + sdlCtx *ctx); +static bool schema_attributeGroup +(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdlTypePtr cur_type, + sdlCtx *ctx); + +static bool schema_restriction_var_int +(xmlNodePtr val, sdlRestrictionIntPtr &valptr); + +static bool schema_restriction_var_char +(xmlNodePtr val, sdlRestrictionCharPtr &valptr); + +static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type); + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +static encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, + const xmlChar *ns, const xmlChar *type) { + string nscat = (char*)ns; + nscat += ':'; + nscat += (char*)type; + + encodeMap::iterator iter = sdl->encoders.find(nscat); + encodePtr enc; + if (iter != sdl->encoders.end()) { + enc = iter->second; + } else { + enc = encodePtr(new encode()); + } + + enc->details.type = 0; + enc->details.ns = (char*)ns; + enc->details.type_str = (char*)type; + enc->details.sdl_type = cur_type.get(); + enc->to_xml = sdl_guess_convert_xml; + enc->to_zval = sdl_guess_convert_zval; + + if (iter == sdl->encoders.end()) { + sdl->encoders[nscat] = enc; + } + return enc; +} + +static encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, + const xmlChar *ns, const xmlChar *type) { + encodePtr enc = get_encoder(sdl.get(), (char*)ns, (char*)type); + if (!enc) { + enc = create_encoder(sdl, cur_type, ns, type); + } + return enc; +} + +static void schema_load_file(sdlCtx *ctx, xmlAttrPtr ns, xmlChar *location, + xmlAttrPtr tns, bool import) { + if (location && ctx->docs.find((char*)location) == ctx->docs.end()) { + xmlDocPtr doc = soap_xmlParseFile((char*)location); + if (!doc) { + throw SoapException("Parsing Schema: can't import schema from '%s'", + location); + } + xmlNodePtr schema = get_node(doc->children, "schema"); + if (!schema) { + xmlFreeDoc(doc); + throw SoapException("Parsing Schema: can't import schema from '%s'", + location); + } + xmlAttrPtr new_tns = get_attribute(schema->properties, "targetNamespace"); + if (import) { + if (ns && (!new_tns || xmlStrcmp(ns->children->content, + new_tns->children->content))) { + xmlFreeDoc(doc); + throw SoapException("Parsing Schema: can't import schema from '%s', " + "unexpected 'targetNamespace'='%s'", + location, ns->children->content); + } + if (!ns && new_tns) { + xmlFreeDoc(doc); + throw SoapException("Parsing Schema: can't import schema from '%s', " + "unexpected 'targetNamespace'='%s'", + location, new_tns->children->content); + } + } else { + new_tns = get_attribute(schema->properties, "targetNamespace"); + if (!new_tns) { + if (tns) { + xmlSetProp(schema, BAD_CAST("targetNamespace"), + tns->children->content); + } + } else if (tns && xmlStrcmp(tns->children->content, + new_tns->children->content)) { + xmlFreeDoc(doc); + throw SoapException("Parsing Schema: can't include schema from '%s', " + "different 'targetNamespace'", location); + } + } + ctx->docs[(char*)location] = doc; + load_schema(ctx, schema); + } +} + +bool checkBaseAttribute(sdlPtr sdl, xmlNodePtr extType, sdlTypePtr cur_type, + bool logError = true) { + xmlAttrPtr base = get_attribute(extType->properties, "base"); + if (base) { + string type, ns; + parse_namespace(base->children->content, type, ns); + xmlNsPtr nsptr = xmlSearchNs(extType->doc, extType, BAD_CAST(ns.c_str())); + if (nsptr) { + cur_type->encode = get_create_encoder(sdl, cur_type, nsptr->href, + BAD_CAST(type.c_str())); + } + return true; + } + if (logError) { + throw SoapException("Parsing Schema: restriction has no 'base' attribute"); + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// load_schema + +/* +2.6.1 xsi:type +2.6.2 xsi:nil +2.6.3 xsi:schemaLocation, xsi:noNamespaceSchemaLocation +*/ + +/* + + Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*) + +*/ +bool load_schema(sdlCtx *ctx, xmlNodePtr schema) { + xmlAttrPtr tns = get_attribute(schema->properties, "targetNamespace"); + if (!tns) { + tns = xmlSetProp(schema, BAD_CAST("targetNamespace"), BAD_CAST("")); + xmlNewNs(schema, BAD_CAST(""), NULL); + } + + xmlNodePtr trav = schema->children; + while (trav) { + if (node_is_equal(trav,"include")) { + xmlAttrPtr location = get_attribute(trav->properties, "schemaLocation"); + if (!location) { + throw SoapException("Parsing Schema: include has no 'schemaLocation' " + "attribute"); + } else { + xmlChar *uri; + xmlChar *base = xmlNodeGetBase(trav->doc, trav); + if (!base) { + uri = xmlBuildURI(location->children->content, trav->doc->URL); + } else { + uri = xmlBuildURI(location->children->content, base); + xmlFree(base); + } + schema_load_file(ctx, NULL, uri, tns, 0); + xmlFree(uri); + } + + } else if (node_is_equal(trav,"redefine")) { + xmlAttrPtr location = get_attribute(trav->properties, "schemaLocation"); + if (!location) { + throw SoapException("Parsing Schema: redefine has no 'schemaLocation' " + "attribute"); + } else { + xmlChar *uri; + xmlChar *base = xmlNodeGetBase(trav->doc, trav); + if (!base) { + uri = xmlBuildURI(location->children->content, trav->doc->URL); + } else { + uri = xmlBuildURI(location->children->content, base); + xmlFree(base); + } + schema_load_file(ctx, NULL, uri, tns, 0); + xmlFree(uri); + /* TODO: support */ + } + + } else if (node_is_equal(trav,"import")) { + xmlChar *uri = NULL; + + xmlAttrPtr ns = get_attribute(trav->properties, "namespace"); + xmlAttrPtr location = get_attribute(trav->properties, "schemaLocation"); + + if (ns && tns && xmlStrcmp(ns->children->content, + tns->children->content) == 0) { + if (location) { + throw SoapException("Parsing Schema: can't import schema from '%s', " + "namespace must not match the enclosing schema " + "'targetNamespace'", + location->children->content); + } else { + throw SoapException("Parsing Schema: can't import schema. Namespace" + " must not match the enclosing schema " + "'targetNamespace'"); + } + } + if (location) { + xmlChar *base = xmlNodeGetBase(trav->doc, trav); + if (!base) { + uri = xmlBuildURI(location->children->content, trav->doc->URL); + } else { + uri = xmlBuildURI(location->children->content, base); + xmlFree(base); + } + } + schema_load_file(ctx, ns, uri, tns, 1); + if (uri) {xmlFree(uri);} + } else if (node_is_equal(trav,"annotation")) { + /* TODO: support */ +/* annotation cleanup + xmlNodePtr tmp = trav; + trav = trav->next; + xmlUnlinkNode(tmp); + xmlFreeNode(tmp); + continue; +*/ + } else { + break; + } + trav = trav->next; + } + + while (trav) { + if (node_is_equal(trav,"simpleType")) { + schema_simpleType(ctx->sdl, tns, trav, sdlTypePtr()); + } else if (node_is_equal(trav,"complexType")) { + schema_complexType(ctx->sdl, tns, trav, sdlTypePtr()); + } else if (node_is_equal(trav,"group")) { + schema_group(ctx->sdl, tns, trav, sdlTypePtr(), sdlContentModelPtr()); + } else if (node_is_equal(trav,"attributeGroup")) { + schema_attributeGroup(ctx->sdl, tns, trav, sdlTypePtr(), ctx); + } else if (node_is_equal(trav,"element")) { + schema_element(ctx->sdl, tns, trav, sdlTypePtr(), sdlContentModelPtr()); + } else if (node_is_equal(trav,"attribute")) { + schema_attribute(ctx->sdl, tns, trav, sdlTypePtr(), ctx); + } else if (node_is_equal(trav,"notation")) { + /* TODO: support */ + } else if (node_is_equal(trav,"annotation")) { + /* TODO: support */ + } else { + throw SoapException("Parsing Schema: unexpected <%s> in schema", + trav->name); + } + trav = trav->next; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// XSD types + +/* + + Content: (annotation?, (restriction | list | union)) + +*/ +static bool schema_simpleType(sdlPtr sdl, xmlAttrPtr tns, + xmlNodePtr simpleType, sdlTypePtr cur_type) { + xmlAttrPtr ns = get_attribute(simpleType->properties, "targetNamespace"); + if (!ns) { + ns = tns; + } + + xmlAttrPtr name = get_attribute(simpleType->properties, "name"); + + sdlTypePtr newType(new sdlType()); + if (cur_type) { + /* Anonymous type inside or */ + if (name) { + newType->name = (char*)name->children->content; + newType->namens = (char*)ns->children->content; + } else { + newType->name = cur_type->name; + newType->namens = cur_type->namens; + } + sdl->types.push_back(newType); + + cur_type->encode = encodePtr(new encode()); + cur_type->encode->details.ns = newType->namens; + cur_type->encode->details.type_str = newType->name; + cur_type->encode->details.sdl_type = newType.get(); + cur_type->encode->to_xml = sdl_guess_convert_xml; + cur_type->encode->to_zval = sdl_guess_convert_zval; + sdl->encoders[lexical_cast(sdl->encoders.size())] = + cur_type->encode; + + cur_type = newType; + + } else if (name) { + if (!cur_type) { + sdl->types.push_back(newType); + } else { + cur_type->elements.push_back(newType); + } + cur_type = newType; + create_encoder(sdl, cur_type, ns->children->content, + name->children->content); + } else { + throw SoapException("Parsing Schema: simpleType has no 'name' attribute"); + } + + xmlNodePtr trav = simpleType->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav) { + if (node_is_equal(trav,"restriction")) { + schema_restriction_simpleContent(sdl, tns, trav, cur_type, 1); + trav = trav->next; + } else if (node_is_equal(trav,"list")) { + cur_type->kind = XSD_TYPEKIND_LIST; + schema_list(sdl, tns, trav, cur_type); + trav = trav->next; + } else if (node_is_equal(trav,"union")) { + cur_type->kind = XSD_TYPEKIND_UNION; + schema_union(sdl, tns, trav, cur_type); + trav = trav->next; + } else { + throw SoapException("Parsing Schema: unexpected <%s> in simpleType", + trav->name); + } + } else { + throw SoapException("Parsing Schema: expected , or " + " in simpleType"); + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in simpleType", + trav->name); + } + + return true; +} + +/* + + Content: (annotation?, (simpleType?)) + +*/ +static bool schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, + sdlTypePtr cur_type) { + xmlAttrPtr itemType = get_attribute(listType->properties, "itemType"); + if (itemType) { + string type, ns; + parse_namespace(itemType->children->content, type, ns); + xmlNsPtr nsptr = xmlSearchNs(listType->doc, listType, + BAD_CAST(ns.c_str())); + if (nsptr) { + sdlTypePtr newType(new sdlType()); + newType->name = type; + newType->namens = (char*)nsptr->href; + newType->encode = get_create_encoder(sdl, newType, nsptr->href, + BAD_CAST(type.c_str())); + cur_type->elements.push_back(newType); + } + } + + xmlNodePtr trav = listType->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav && node_is_equal(trav,"simpleType")) { + if (itemType) { + throw SoapException("Parsing Schema: element has both 'itemType' " + "attribute and subtype"); + } + sdlTypePtr newType(new sdlType()); + newType->name = "anonymous" + lexical_cast(sdl->types.size()); + newType->namens = (char*)tns->children->content; + cur_type->elements.push_back(newType); + + schema_simpleType(sdl, tns, trav, newType); + + trav = trav->next; + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in list", trav->name); + } + return true; +} + +/* + + Content: (annotation?, (simpleType*)) + +*/ +static bool schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, + sdlTypePtr cur_type) { + xmlAttrPtr memberTypes = get_attribute(unionType->properties, "memberTypes"); + if (memberTypes) { + char *str, *start, *end, *next; + string type, ns; + xmlNsPtr nsptr; + + str = strdup((char*)memberTypes->children->content); + whiteSpace_collapse(BAD_CAST(str)); + start = str; + while (start && *start != '\0') { + end = strchr(start,' '); + if (end == NULL) { + next = NULL; + } else { + *end = '\0'; + next = end+1; + } + + parse_namespace(BAD_CAST(start), type, ns); + nsptr = xmlSearchNs(unionType->doc, unionType, BAD_CAST(ns.c_str())); + if (nsptr) { + sdlTypePtr newType(new sdlType()); + newType->name = type; + newType->namens = (char*)nsptr->href; + newType->encode = get_create_encoder(sdl, newType, nsptr->href, + BAD_CAST(type.c_str())); + cur_type->elements.push_back(newType); + } + start = next; + } + free(str); + } + + xmlNodePtr trav = unionType->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + while (trav) { + if (node_is_equal(trav,"simpleType")) { + sdlTypePtr newType(new sdlType()); + newType->name = "anonymous" + lexical_cast(sdl->types.size()); + newType->namens = (char*)tns->children->content; + cur_type->elements.push_back(newType); + schema_simpleType(sdl, tns, trav, newType); + } else { + throw SoapException("Parsing Schema: unexpected <%s> in union", + trav->name); + } + trav = trav->next; + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in union", + trav->name); + } + return true; +} + +/* + + Content: (annotation?, (restriction | extension)) + +*/ +static bool schema_simpleContent(sdlPtr sdl, xmlAttrPtr tns, + xmlNodePtr simpCompType, + sdlTypePtr cur_type) { + xmlNodePtr trav = simpCompType->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav) { + if (node_is_equal(trav, "restriction")) { + cur_type->kind = XSD_TYPEKIND_RESTRICTION; + schema_restriction_simpleContent(sdl, tns, trav, cur_type, 0); + trav = trav->next; + } else if (node_is_equal(trav, "extension")) { + cur_type->kind = XSD_TYPEKIND_EXTENSION; + schema_extension_simpleContent(sdl, tns, trav, cur_type); + trav = trav->next; + } else { + throw SoapException("Parsing Schema: unexpected <%s> in simpleContent", + trav->name); + } + } else { + throw SoapException("Parsing Schema: expected or " + " in simpleContent"); + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in simpleContent", + trav->name); + } + return true; +} + +/* +simpleType: + Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)?) + +simpleContent: + Content: (annotation?, (simpleType?, (minExclusive | minInclusive | maxExclusive | maxInclusive | totalDigits | fractionDigits | length | minLength | maxLength | enumeration | whiteSpace | pattern)*)?, ((attribute | attributeGroup)*, anyAttribute?)) + +*/ +static bool schema_restriction_simpleContent(sdlPtr sdl, xmlAttrPtr tns, + xmlNodePtr restType, + sdlTypePtr cur_type, + int simpleType) { + checkBaseAttribute(sdl, restType, cur_type, !simpleType); + + if (cur_type->restrictions == NULL) { + cur_type->restrictions = sdlRestrictionsPtr(new sdlRestrictions()); + } + + xmlNodePtr trav = restType->children; + if (trav && node_is_equal(trav, "annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav && node_is_equal(trav, "simpleType")) { + schema_simpleType(sdl, tns, trav, cur_type); + trav = trav->next; + } + while (trav) { + if (node_is_equal(trav, "minExclusive")) { + schema_restriction_var_int(trav, cur_type->restrictions->minExclusive); + } else if (node_is_equal(trav, "minInclusive")) { + schema_restriction_var_int(trav, cur_type->restrictions->minInclusive); + } else if (node_is_equal(trav, "maxExclusive")) { + schema_restriction_var_int(trav, cur_type->restrictions->maxExclusive); + } else if (node_is_equal(trav, "maxInclusive")) { + schema_restriction_var_int(trav, cur_type->restrictions->maxInclusive); + } else if (node_is_equal(trav, "totalDigits")) { + schema_restriction_var_int(trav, cur_type->restrictions->totalDigits); + } else if (node_is_equal(trav, "fractionDigits")) { + schema_restriction_var_int(trav, + cur_type->restrictions->fractionDigits); + } else if (node_is_equal(trav, "length")) { + schema_restriction_var_int(trav, cur_type->restrictions->length); + } else if (node_is_equal(trav, "minLength")) { + schema_restriction_var_int(trav, cur_type->restrictions->minLength); + } else if (node_is_equal(trav, "maxLength")) { + schema_restriction_var_int(trav, cur_type->restrictions->maxLength); + } else if (node_is_equal(trav, "whiteSpace")) { + schema_restriction_var_char(trav, cur_type->restrictions->whiteSpace); + } else if (node_is_equal(trav, "pattern")) { + schema_restriction_var_char(trav, cur_type->restrictions->pattern); + } else if (node_is_equal(trav, "enumeration")) { + sdlRestrictionCharPtr enumval; + schema_restriction_var_char(trav, enumval); + cur_type->restrictions->enumeration.push_back(enumval); + } else { + break; + } + trav = trav->next; + } + if (!simpleType) { + while (trav) { + if (node_is_equal(trav,"attribute")) { + schema_attribute(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"attributeGroup")) { + schema_attributeGroup(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"anyAttribute")) { + /* TODO: support */ + trav = trav->next; + break; + } else { + throw SoapException("Parsing Schema: unexpected <%s> in restriction", + trav->name); + } + trav = trav->next; + } + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in restriction", + trav->name); + } + + return true; +} + +/* + + Content: (annotation?, (group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)) + +*/ +static bool schema_restriction_complexContent(sdlPtr sdl, xmlAttrPtr tns, + xmlNodePtr restType, + sdlTypePtr cur_type) { + checkBaseAttribute(sdl, restType, cur_type); + + xmlNodePtr trav = restType->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav) { + if (node_is_equal(trav,"group")) { + schema_group(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } else if (node_is_equal(trav,"all")) { + schema_all(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } else if (node_is_equal(trav,"choice")) { + schema_choice(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } else if (node_is_equal(trav,"sequence")) { + schema_sequence(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } + } + while (trav) { + if (node_is_equal(trav,"attribute")) { + schema_attribute(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"attributeGroup")) { + schema_attributeGroup(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"anyAttribute")) { + /* TODO: support */ + trav = trav->next; + break; + } else { + throw SoapException("Parsing Schema: unexpected <%s> in restriction", + trav->name); + } + trav = trav->next; + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in restriction", + trav->name); + } + + return true; +} + +static bool schema_restriction_var_int(xmlNodePtr val, + sdlRestrictionIntPtr &valptr) { + valptr = sdlRestrictionIntPtr(new sdlRestrictionInt()); + + xmlAttrPtr fixed = get_attribute(val->properties, "fixed"); + valptr->fixed = false; + if (fixed) { + if (!strncmp((char*)fixed->children->content, "true", sizeof("true")) || + !strncmp((char*)fixed->children->content, "1", sizeof("1"))) { + valptr->fixed = true; + } + } + + xmlAttrPtr value = get_attribute(val->properties, "value"); + if (value == NULL) { + throw SoapException("Parsing Schema: missing restriction value"); + } else { + valptr->value = atoi((char*)value->children->content); + } + + return true; +} + +static bool schema_restriction_var_char(xmlNodePtr val, + sdlRestrictionCharPtr &valptr) { + valptr = sdlRestrictionCharPtr(new sdlRestrictionChar()); + + xmlAttrPtr fixed = get_attribute(val->properties, "fixed"); + valptr->fixed = false; + if (fixed) { + if (!strncmp((char*)fixed->children->content, "true", sizeof("true")) || + !strncmp((char*)fixed->children->content, "1", sizeof("1"))) { + valptr->fixed = true; + } + } + + xmlAttrPtr value = get_attribute(val->properties, "value"); + if (value == NULL) { + throw SoapException("Parsing Schema: missing restriction value"); + } else { + valptr->value = (char*)value->children->content; + } + + return true; +} + +/* +From simpleContent (not supported): + + Content: (annotation?, ((attribute | attributeGroup)*, anyAttribute?)) + +*/ +static bool schema_extension_simpleContent(sdlPtr sdl, xmlAttrPtr tns, + xmlNodePtr extType, + sdlTypePtr cur_type) { + checkBaseAttribute(sdl, extType, cur_type); + + xmlNodePtr trav = extType->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + while (trav) { + if (node_is_equal(trav,"attribute")) { + schema_attribute(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"attributeGroup")) { + schema_attributeGroup(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"anyAttribute")) { + /* TODO: support */ + trav = trav->next; + break; + } else { + throw SoapException("Parsing Schema: unexpected <%s> in extension", + trav->name); + } + trav = trav->next; + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in extension", + trav->name); + } + return true; +} + +/* +From complexContent: + + Content: (annotation?, ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))) + +*/ +static bool schema_extension_complexContent(sdlPtr sdl, xmlAttrPtr tns, + xmlNodePtr extType, + sdlTypePtr cur_type) { + checkBaseAttribute(sdl, extType, cur_type); + + xmlNodePtr trav = extType->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav) { + if (node_is_equal(trav,"group")) { + schema_group(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } else if (node_is_equal(trav,"all")) { + schema_all(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } else if (node_is_equal(trav,"choice")) { + schema_choice(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } else if (node_is_equal(trav,"sequence")) { + schema_sequence(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } + } + while (trav) { + if (node_is_equal(trav,"attribute")) { + schema_attribute(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"attributeGroup")) { + schema_attributeGroup(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"anyAttribute")) { + /* TODO: support */ + trav = trav->next; + break; + } else { + throw SoapException("Parsing Schema: unexpected <%s> in extension", + trav->name); + } + trav = trav->next; + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in extension", + trav->name); + } + return true; +} + +void schema_min_max(xmlNodePtr node, sdlContentModelPtr model) { + xmlAttrPtr attr = get_attribute(node->properties, "minOccurs"); + if (attr) { + model->min_occurs = atoi((char*)attr->children->content); + } else { + model->min_occurs = 1; + } + + attr = get_attribute(node->properties, "maxOccurs"); + if (attr) { + if (!strncmp((char*)attr->children->content, "unbounded", + sizeof("unbounded"))) { + model->max_occurs = -1; + } else { + model->max_occurs = atoi((char*)attr->children->content); + } + } else { + model->max_occurs = 1; + } +} + +/* + + Content: (annotation?, element*) + +*/ +static bool schema_all(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr all, + sdlTypePtr cur_type, sdlContentModelPtr model) { + sdlContentModelPtr newModel(new sdlContentModel()); + newModel->kind = XSD_CONTENT_ALL; + if (model) { + model->u_content.push_back(newModel); + } else { + cur_type->model = newModel; + } + schema_min_max(all, newModel); + + xmlNodePtr trav = all->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + while (trav) { + if (node_is_equal(trav,"element")) { + schema_element(sdl, tns, trav, cur_type, newModel); + } else { + throw SoapException("Parsing Schema: unexpected <%s> in all", + trav->name); + } + trav = trav->next; + } + return true; +} + +/* + + + Content: (annotation?) + +*/ +static bool schema_group(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, + sdlTypePtr cur_type, sdlContentModelPtr model) { + xmlAttrPtr ns = get_attribute(groupType->properties, "targetNamespace"); + if (ns == NULL) { + ns = tns; + } + + xmlAttrPtr ref = NULL; + xmlAttrPtr name = get_attribute(groupType->properties, "name"); + if (name == NULL) { + name = ref = get_attribute(groupType->properties, "ref"); + } + + sdlContentModelPtr newModel; + if (name) { + string key; + if (ref) { + string type, ns; + parse_namespace(ref->children->content, type, ns); + xmlNsPtr nsptr = xmlSearchNs(groupType->doc, groupType, + BAD_CAST(ns.c_str())); + if (nsptr) { + key += (char*)nsptr->href; + key += ':'; + } + key += type; + + newModel = sdlContentModelPtr(new sdlContentModel()); + newModel->kind = XSD_CONTENT_GROUP_REF; + newModel->u_group_ref = key; + } else { + newModel = sdlContentModelPtr(new sdlContentModel()); + newModel->kind = XSD_CONTENT_SEQUENCE; /* will be redefined */ + + key += (char*)ns->children->content; + key += ':'; + key += (char*)name->children->content; + } + + if (cur_type == NULL) { + sdlTypePtr &newType = sdl->groups[key]; + if (newType) { + throw SoapException("Parsing Schema: group '%s' already defined", + key.c_str()); + } + cur_type = newType = sdlTypePtr(new sdlType()); + } + + if (model == NULL) { + cur_type->model = newModel; + } else { + model->u_content.push_back(newModel); + } + } else { + throw SoapException("Parsing Schema: group has no 'name' nor 'ref'" + " attributes"); + } + + schema_min_max(groupType, newModel); + + xmlNodePtr trav = groupType->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav) { + if (node_is_equal(trav,"choice")) { + if (ref) { + throw SoapException("Parsing Schema: group has both 'ref' attribute" + " and subcontent"); + } + newModel->kind = XSD_CONTENT_CHOICE; + schema_choice(sdl, tns, trav, cur_type, newModel); + trav = trav->next; + } else if (node_is_equal(trav,"sequence")) { + if (ref) { + throw SoapException("Parsing Schema: group has both 'ref' attribute" + " and subcontent"); + } + newModel->kind = XSD_CONTENT_SEQUENCE; + schema_sequence(sdl, tns, trav, cur_type, newModel); + trav = trav->next; + } else if (node_is_equal(trav,"all")) { + if (ref) { + throw SoapException("Parsing Schema: group has both 'ref' attribute" + " and subcontent"); + } + newModel->kind = XSD_CONTENT_ALL; + schema_all(sdl, tns, trav, cur_type, newModel); + trav = trav->next; + } else { + throw SoapException("Parsing Schema: unexpected <%s> in group", + trav->name); + } + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in group", + trav->name); + } + return true; +} + +/* + + Content: (annotation?, (element | group | choice | sequence | any)*) + +*/ +static bool schema_choice(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr choiceType, + sdlTypePtr cur_type, sdlContentModelPtr model) { + sdlContentModelPtr newModel(new sdlContentModel()); + newModel->kind = XSD_CONTENT_CHOICE; + if (model) { + model->u_content.push_back(newModel); + } else { + cur_type->model = newModel; + } + schema_min_max(choiceType, newModel); + + xmlNodePtr trav = choiceType->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + while (trav) { + if (node_is_equal(trav,"element")) { + schema_element(sdl, tns, trav, cur_type, newModel); + } else if (node_is_equal(trav,"group")) { + schema_group(sdl, tns, trav, cur_type, newModel); + } else if (node_is_equal(trav,"choice")) { + schema_choice(sdl, tns, trav, cur_type, newModel); + } else if (node_is_equal(trav,"sequence")) { + schema_sequence(sdl, tns, trav, cur_type, newModel); + } else if (node_is_equal(trav,"any")) { + schema_any(sdl, tns, trav, cur_type, newModel); + } else { + throw SoapException("Parsing Schema: unexpected <%s> in choice", + trav->name); + } + trav = trav->next; + } + return true; +} + +/* + + Content: (annotation?, (element | group | choice | sequence | any)*) + +*/ +static bool schema_sequence(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr seqType, + sdlTypePtr cur_type, sdlContentModelPtr model) { + sdlContentModelPtr newModel(new sdlContentModel()); + newModel->kind = XSD_CONTENT_SEQUENCE; + if (model) { + model->u_content.push_back(newModel); + } else { + cur_type->model = newModel; + } + schema_min_max(seqType, newModel); + + xmlNodePtr trav = seqType->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + while (trav) { + if (node_is_equal(trav,"element")) { + schema_element(sdl, tns, trav, cur_type, newModel); + } else if (node_is_equal(trav,"group")) { + schema_group(sdl, tns, trav, cur_type, newModel); + } else if (node_is_equal(trav,"choice")) { + schema_choice(sdl, tns, trav, cur_type, newModel); + } else if (node_is_equal(trav,"sequence")) { + schema_sequence(sdl, tns, trav, cur_type, newModel); + } else if (node_is_equal(trav,"any")) { + schema_any(sdl, tns, trav, cur_type, newModel); + } else { + throw SoapException("Parsing Schema: unexpected <%s> in sequence", + trav->name); + } + trav = trav->next; + } + return true; +} + +/* + + Content: (annotation?) + +*/ +static bool schema_any(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr anyType, + sdlTypePtr cur_type, sdlContentModelPtr model) { + if (model) { + sdlContentModelPtr newModel(new sdlContentModel()); + newModel->kind = XSD_CONTENT_ANY; + schema_min_max(anyType, newModel); + model->u_content.push_back(newModel); + } + return true; +} + +/* + + Content: (annotation?, (restriction | extension)) + +*/ +static bool schema_complexContent(sdlPtr sdl, xmlAttrPtr tns, + xmlNodePtr compCont, sdlTypePtr cur_type) { + xmlNodePtr trav = compCont->children; + if (trav && node_is_equal(trav,"annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav) { + if (node_is_equal(trav, "restriction")) { + cur_type->kind = XSD_TYPEKIND_RESTRICTION; + schema_restriction_complexContent(sdl, tns, trav, cur_type); + trav = trav->next; + } else if (node_is_equal(trav, "extension")) { + cur_type->kind = XSD_TYPEKIND_EXTENSION; + schema_extension_complexContent(sdl, tns, trav, cur_type); + trav = trav->next; + } else { + throw SoapException("Parsing Schema: unexpected <%s> in complexContent", + trav->name); + } + } else { + throw SoapException("Parsing Schema: or expected" + " in complexContent"); + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in complexContent", + trav->name); + } + + return true; +} + +/* + + Content: (annotation?, (simpleContent | complexContent | ((group | all | choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?)))) + +*/ +static bool schema_complexType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compType, + sdlTypePtr cur_type) { + xmlAttrPtr attrs = compType->properties; + xmlAttrPtr ns = get_attribute(attrs, "targetNamespace"); + if (ns == NULL) { + ns = tns; + } + + xmlAttrPtr name = get_attribute(attrs, "name"); + if (cur_type) { + /* Anonymous type inside */ + sdlTypePtr newType(new sdlType()); + newType->kind = XSD_TYPEKIND_COMPLEX; + if (name) { + newType->name = (char*)name->children->content; + newType->namens = (char*)ns->children->content; + } else { + newType->name = cur_type->name; + newType->namens = cur_type->namens; + } + sdl->types.push_back(newType); + + cur_type->encode = encodePtr(new encode()); + cur_type->encode->details.ns = newType->namens; + cur_type->encode->details.type_str = newType->name; + cur_type->encode->details.sdl_type = newType.get(); + cur_type->encode->to_xml = sdl_guess_convert_xml; + cur_type->encode->to_zval = sdl_guess_convert_zval; + sdl->encoders[lexical_cast(sdl->encoders.size())] = + cur_type->encode; + + cur_type = newType; + + } else if (name) { + sdlTypePtr newType(new sdlType()); + newType->kind = XSD_TYPEKIND_COMPLEX; + newType->name = (char*)name->children->content; + newType->namens = (char*)ns->children->content; + sdl->types.push_back(newType); + cur_type = newType; + create_encoder(sdl, cur_type, ns->children->content, + name->children->content); + } else { + throw SoapException("Parsing Schema: complexType has no 'name' attribute"); + } + + xmlNodePtr trav = compType->children; + if (trav && node_is_equal(trav, "annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav) { + if (node_is_equal(trav,"simpleContent")) { + schema_simpleContent(sdl, tns, trav, cur_type); + trav = trav->next; + } else if (node_is_equal(trav,"complexContent")) { + schema_complexContent(sdl, tns, trav, cur_type); + trav = trav->next; + } else { + if (node_is_equal(trav,"group")) { + schema_group(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } else if (node_is_equal(trav,"all")) { + schema_all(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } else if (node_is_equal(trav,"choice")) { + schema_choice(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } else if (node_is_equal(trav,"sequence")) { + schema_sequence(sdl, tns, trav, cur_type, sdlContentModelPtr()); + trav = trav->next; + } + while (trav) { + if (node_is_equal(trav,"attribute")) { + schema_attribute(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"attributeGroup")) { + schema_attributeGroup(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"anyAttribute")) { + /* TODO: support */ + trav = trav->next; + break; + } else { + throw SoapException("Parsing Schema: unexpected <%s> in complexType", + trav->name); + } + trav = trav->next; + } + } + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in complexType", + trav->name); + } + return true; +} + +/* + + Content: (annotation?, ((simpleType | complexType)?, (unique | key | keyref)*)) + +*/ +static bool schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, + sdlTypePtr cur_type, sdlContentModelPtr model) { + xmlAttrPtr attrs = element->properties; + xmlAttrPtr ns = get_attribute(attrs, "targetNamespace"); + if (ns == NULL) { + ns = tns; + } + + xmlAttrPtr ref = NULL; + xmlAttrPtr name = get_attribute(attrs, "name"); + if (name == NULL) { + name = ref = get_attribute(attrs, "ref"); + } + + if (name) { + sdlTypePtr newType(new sdlType()); + if (ref) { + string type, ns; + parse_namespace(ref->children->content, type, ns); + xmlNsPtr nsptr = xmlSearchNs(element->doc, element, + BAD_CAST(ns.c_str())); + string nscat; + if (nsptr) { + nscat += (char*)nsptr->href; + nscat += ':'; + newType->namens = (char*)nsptr->href; + } + nscat += type; + newType->name = type; + newType->ref = nscat; + } else { + newType->name = (char*)name->children->content; + newType->namens = (char*)ns->children->content; + } + + if (cur_type == NULL) { + string key = newType->namens; + key += ':'; + key += newType->name; + + sdlTypePtr &type = sdl->elements[key]; + if (type) { + throw SoapException("Parsing Schema: element '%s' already defined", + key.c_str()); + } + type = newType; + } else { + cur_type->elements.push_back(newType); + } + + if (model) { + sdlContentModelPtr newModel(new sdlContentModel()); + newModel->kind = XSD_CONTENT_ELEMENT; + newModel->u_element = newType.get(); + schema_min_max(element, newModel); + model->u_content.push_back(newModel); + } + cur_type = newType; + } else { + throw SoapException("Parsing Schema: element has no 'name' nor 'ref' " + "attributes"); + } + + /* nillable = boolean : false */ + attrs = element->properties; + xmlAttrPtr attr = get_attribute(attrs, "nillable"); + if (attr) { + if (ref) { + throw SoapException("Parsing Schema: element has both 'ref' and " + "'nillable' attributes"); + } + if (!strcmp((char*)attr->children->content, "true") || + !strcmp((char*)attr->children->content, "1")) { + cur_type->nillable = true; + } else { + cur_type->nillable = false; + } + } else { + cur_type->nillable = false; + } + + attr = get_attribute(attrs, "fixed"); + if (attr) { + if (ref) { + throw SoapException("Parsing Schema: element has both 'ref' and 'fixed' " + "attributes"); + } + cur_type->fixed = (char*)attr->children->content; + } + + attr = get_attribute(attrs, "default"); + if (attr) { + if (ref) { + throw SoapException("Parsing Schema: element has both 'ref' and 'fixed' " + "attributes"); + } else if (ref) { + throw SoapException("Parsing Schema: element has both 'default' and " + "'fixed' attributes"); + } + cur_type->def = (char*)attr->children->content; + } + + /* form */ + attr = get_attribute(attrs, "form"); + if (attr) { + if (strncmp((char*)attr->children->content, "qualified", + sizeof("qualified")) == 0) { + cur_type->form = XSD_FORM_QUALIFIED; + } else if (strncmp((char*)attr->children->content, "unqualified", + sizeof("unqualified")) == 0) { + cur_type->form = XSD_FORM_UNQUALIFIED; + } else { + cur_type->form = XSD_FORM_DEFAULT; + } + } else { + cur_type->form = XSD_FORM_DEFAULT; + } + if (cur_type->form == XSD_FORM_DEFAULT) { + xmlNodePtr parent = element->parent; + while (parent) { + if (node_is_equal_ex(parent, "schema", SCHEMA_NAMESPACE)) { + xmlAttrPtr def = get_attribute(parent->properties, + "elementFormDefault"); + if (def == NULL || + strncmp((char*)def->children->content, "qualified", + sizeof("qualified"))) { + cur_type->form = XSD_FORM_UNQUALIFIED; + } else { + cur_type->form = XSD_FORM_QUALIFIED; + } + break; + } + parent = parent->parent; + } + if (parent == NULL) { + cur_type->form = XSD_FORM_UNQUALIFIED; + } + } + + /* type = QName */ + xmlAttrPtr type = get_attribute(attrs, "type"); + if (type) { + string cptype, str_ns; + if (ref) { + throw SoapException("Parsing Schema: element has both 'ref' and 'type' " + "attributes"); + } + parse_namespace(type->children->content, cptype, str_ns); + xmlNsPtr nsptr = xmlSearchNs(element->doc, element, + BAD_CAST(str_ns.c_str())); + if (nsptr) { + cur_type->encode = get_create_encoder(sdl, cur_type, nsptr->href, + BAD_CAST(cptype.c_str())); + } + } + + xmlNodePtr trav = element->children; + if (trav && node_is_equal(trav, "annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav) { + if (node_is_equal(trav,"simpleType")) { + if (ref) { + throw SoapException("Parsing Schema: element has both 'ref' " + "attribute and subtype"); + } else if (type) { + throw SoapException("Parsing Schema: element has both 'type' " + "attribute and subtype"); + } + schema_simpleType(sdl, tns, trav, cur_type); + trav = trav->next; + } else if (node_is_equal(trav,"complexType")) { + if (ref) { + throw SoapException("Parsing Schema: element has both 'ref' " + "attribute and subtype"); + } else if (type) { + throw SoapException("Parsing Schema: element has both 'type' " + "attribute and subtype"); + } + schema_complexType(sdl, tns, trav, cur_type); + trav = trav->next; + } + } + while (trav) { + if (node_is_equal(trav,"unique")) { + /* TODO: support */ + } else if (node_is_equal(trav,"key")) { + /* TODO: support */ + } else if (node_is_equal(trav,"keyref")) { + /* TODO: support */ + } else { + throw SoapException("Parsing Schema: unexpected <%s> in element", + trav->name); + } + trav = trav->next; + } + + return true; +} + +/* + + Content: (annotation?, (simpleType?)) + +*/ +static bool schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, + sdlTypePtr cur_type, sdlCtx *ctx) { + sdlAttributePtr newAttr; + xmlAttrPtr attr, ref = NULL, type = NULL; + + xmlAttrPtr name = get_attribute(attrType->properties, "name"); + if (name == NULL) { + name = ref = get_attribute(attrType->properties, "ref"); + } + if (name) { + newAttr = sdlAttributePtr(new sdlAttribute()); + + string key; + if (ref) { + string attr_name, ns; + parse_namespace(ref->children->content, attr_name, ns); + xmlNsPtr nsptr = xmlSearchNs(attrType->doc, attrType, + BAD_CAST(ns.c_str())); + if (nsptr) { + key += (char*)nsptr->href; + key += ':'; + newAttr->namens = (char*)nsptr->href; + } + key += attr_name; + newAttr->ref = key; + } else { + xmlAttrPtr ns = get_attribute(attrType->properties, "targetNamespace"); + if (ns == NULL) { + ns = tns; + } + if (ns) { + key += (char*)ns->children->content; + key += ':'; + newAttr->namens = (char*)ns->children->content; + } + key += (char*)name->children->content; + } + + sdlAttributeMap *addHash; + if (cur_type == NULL) { + addHash = &ctx->attributes; + } else { + addHash = &cur_type->attributes; + } + + sdlAttributePtr &rattr = (*addHash)[key]; + if (rattr) { + throw SoapException("Parsing Schema: attribute '%s' already defined", + key.c_str()); + } + rattr = newAttr; + } else{ + throw SoapException("Parsing Schema: attribute has no 'name' nor 'ref' " + "attributes"); + } + + /* type = QName */ + type = get_attribute(attrType->properties, "type"); + if (type) { + if (ref) { + throw SoapException("Parsing Schema: attribute has both 'ref' and " + "'type' attributes"); + } + string cptype, str_ns; + parse_namespace(type->children->content, cptype, str_ns); + xmlNsPtr nsptr = xmlSearchNs(attrType->doc, attrType, + BAD_CAST(str_ns.c_str())); + if (nsptr) { + newAttr->encode = get_create_encoder(sdl, cur_type, nsptr->href, + BAD_CAST(cptype.c_str())); + } + } + + attr = attrType->properties; + while (attr) { + if (attr_is_equal_ex(attr, "default", SCHEMA_NAMESPACE)) { + newAttr->def = (char*)attr->children->content; + } else if (attr_is_equal_ex(attr, "fixed", SCHEMA_NAMESPACE)) { + newAttr->fixed = (char*)attr->children->content; + } else if (attr_is_equal_ex(attr, "form", SCHEMA_NAMESPACE)) { + if (strncmp((char*)attr->children->content, "qualified", + sizeof("qualified")) == 0) { + newAttr->form = XSD_FORM_QUALIFIED; + } else if (strncmp((char*)attr->children->content, "unqualified", + sizeof("unqualified")) == 0) { + newAttr->form = XSD_FORM_UNQUALIFIED; + } else { + newAttr->form = XSD_FORM_DEFAULT; + } + } else if (attr_is_equal_ex(attr, "id", SCHEMA_NAMESPACE)) { + /* skip */ + } else if (attr_is_equal_ex(attr, "name", SCHEMA_NAMESPACE)) { + newAttr->name = (char*)attr->children->content; + } else if (attr_is_equal_ex(attr, "ref", SCHEMA_NAMESPACE)) { + /* already processed */ + } else if (attr_is_equal_ex(attr, "type", SCHEMA_NAMESPACE)) { + /* already processed */ + } else if (attr_is_equal_ex(attr, "use", SCHEMA_NAMESPACE)) { + if (strncmp((char*)attr->children->content, "prohibited", + sizeof("prohibited")) == 0) { + newAttr->use = XSD_USE_PROHIBITED; + } else if (strncmp((char*)attr->children->content, "required", + sizeof("required")) == 0) { + newAttr->use = XSD_USE_REQUIRED; + } else if (strncmp((char*)attr->children->content, "optional", + sizeof("optional")) == 0) { + newAttr->use = XSD_USE_OPTIONAL; + } else { + newAttr->use = XSD_USE_DEFAULT; + } + } else { + xmlNsPtr nsPtr = attr_find_ns(attr); + if (strncmp((char*)nsPtr->href, SCHEMA_NAMESPACE, + sizeof(SCHEMA_NAMESPACE))) { + sdlExtraAttributePtr ext(new sdlExtraAttribute()); + string value, ns; + parse_namespace(attr->children->content, value, ns); + xmlNsPtr nsptr = xmlSearchNs(attr->doc, attr->parent, + BAD_CAST(ns.c_str())); + if (nsptr) { + ext->ns = (char*)nsptr->href; + ext->val = value; + } else { + ext->val = (char*)attr->children->content; + } + + string key2; + key2 += (char*)nsPtr->href; + key2 += ':'; + key2 += (char*)attr->name; + newAttr->extraAttributes[key2] = ext; + } + } + attr = attr->next; + } + if (newAttr->form == XSD_FORM_DEFAULT) { + xmlNodePtr parent = attrType->parent; + while (parent) { + if (node_is_equal_ex(parent, "schema", SCHEMA_NAMESPACE)) { + xmlAttrPtr def = get_attribute(parent->properties, + "attributeFormDefault"); + if (def == NULL || + strncmp((char*)def->children->content, "qualified", + sizeof("qualified"))) { + newAttr->form = XSD_FORM_UNQUALIFIED; + } else { + newAttr->form = XSD_FORM_QUALIFIED; + } + break; + } + parent = parent->parent; + } + if (parent == NULL) { + newAttr->form = XSD_FORM_UNQUALIFIED; + } + } + + xmlNodePtr trav = attrType->children; + if (trav && node_is_equal(trav, "annotation")) { + /* TODO: support */ + trav = trav->next; + } + if (trav) { + if (node_is_equal(trav,"simpleType")) { + if (ref) { + throw SoapException("Parsing Schema: attribute has both 'ref' " + "attribute and subtype"); + } else if (type) { + throw SoapException("Parsing Schema: attribute has both 'type' " + "attribute and subtype"); + } + sdlTypePtr dummy_type(new sdlType()); + dummy_type->name = string("anonymous") + + lexical_cast(sdl->types.size()); + dummy_type->namens = (char*)tns->children->content; + schema_simpleType(sdl, tns, trav, dummy_type); + newAttr->encode = dummy_type->encode; + trav = trav->next; + } + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in attribute", + trav->name); + } + return true; +} + +static bool schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tns, + xmlNodePtr attrGroup, sdlTypePtr cur_type, + sdlCtx *ctx) { + xmlAttrPtr ref = NULL; + xmlAttrPtr name = get_attribute(attrGroup->properties, "name"); + if (name == NULL) { + name = ref = get_attribute(attrGroup->properties, "ref"); + } + if (name) { + if (!cur_type) { + xmlAttrPtr ns = get_attribute(attrGroup->properties, "targetNamespace"); + if (ns == NULL) { + ns = tns; + } + sdlTypePtr newType(new sdlType()); + newType->name = (char*)name->children->content; + newType->namens = (char*)ns->children->content; + + string key; + key += newType->namens; + key += ':'; + key += newType->name; + + sdlTypePtr &type = ctx->attributeGroups[key]; + if (type) { + throw SoapException("Parsing Schema: attributeGroup '%s' already" + " defined", key.c_str()); + } else { + type = newType; + } + cur_type = newType; + } else if (ref) { + sdlAttributePtr newAttr(new sdlAttribute()); + string group_name, ns; + parse_namespace(ref->children->content, group_name, ns); + xmlNsPtr nsptr = xmlSearchNs(attrGroup->doc, attrGroup, + BAD_CAST(ns.c_str())); + string key; + if (nsptr) { + key += (char*)nsptr->href; + key += ':'; + } + key += group_name; + newAttr->ref = key; + cur_type->attributes[lexical_cast(cur_type->attributes.size())] = + newAttr; + cur_type = sdlTypePtr(); + } + } else{ + throw SoapException("Parsing Schema: attributeGroup has no 'name' nor" + " 'ref' attributes"); + } + + xmlNodePtr trav = attrGroup->children; + if (trav && node_is_equal(trav, "annotation")) { + /* TODO: support */ + trav = trav->next; + } + while (trav) { + if (node_is_equal(trav,"attribute")) { + if (ref) { + throw SoapException("Parsing Schema: attributeGroup has both 'ref' " + "attribute and subattribute"); + } + schema_attribute(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"attributeGroup")) { + if (ref) { + throw SoapException("Parsing Schema: attributeGroup has both 'ref' " + "attribute and subattribute"); + } + schema_attributeGroup(sdl, tns, trav, cur_type, NULL); + } else if (node_is_equal(trav,"anyAttribute")) { + if (ref) { + throw SoapException("Parsing Schema: attributeGroup has both 'ref' " + "attribute and subattribute"); + } + /* TODO: support */ + trav = trav->next; + break; + } else { + throw SoapException("Parsing Schema: unexpected <%s> in attributeGroup", + trav->name); + } + trav = trav->next; + } + if (trav) { + throw SoapException("Parsing Schema: unexpected <%s> in attributeGroup", + trav->name); + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// schema_pass2 + +static void copy_extra_attributes(sdlAttributePtr dest, sdlAttributePtr src) { + for (sdlExtraAttributeMap::const_iterator iter = + src->extraAttributes.begin(); iter != src->extraAttributes.end(); + ++iter) { + sdlExtraAttributePtr eattr(new sdlExtraAttribute()); + eattr->ns = iter->second->ns; + eattr->val = iter->second->val; + dest->extraAttributes[iter->first] = eattr; + } +} + +static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr) { + if (!attr->ref.empty()) { + sdlAttributeMap::const_iterator iter = ctx->attributes.find(attr->ref); + if (iter != ctx->attributes.end()) { + sdlAttributePtr tmp = iter->second; + schema_attribute_fixup(ctx, tmp); + if (!tmp->name.empty() && attr->name.empty()) { + attr->name = tmp->name; + } + if (!tmp->namens.empty() && attr->namens.empty()) { + attr->namens = tmp->namens; + } + if (!tmp->def.empty() && attr->def.empty()) { + attr->def = tmp->def; + } + if (!tmp->fixed.empty() && attr->fixed.empty()) { + attr->fixed = tmp->fixed; + } + if (attr->form == XSD_FORM_DEFAULT) { + attr->form = tmp->form; + } + if (attr->use == XSD_USE_DEFAULT) { + attr->use = tmp->use; + } + copy_extra_attributes(attr, tmp); + attr->encode = tmp->encode; + } + if (attr->name.empty() && !attr->ref.empty()) { + const char *name = strrchr(attr->ref.c_str(), ':'); + if (name) { + attr->name = name+1; + } else{ + attr->name = attr->ref; + } + } + attr->ref.clear(); + } +} + +static bool schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, + sdlAttributeMap &fixed) { + if (!attr->ref.empty()) { + sdlTypeMap::iterator iter = ctx->attributeGroups.find(attr->ref); + if (iter != ctx->attributeGroups.end()) { + sdlAttributeMap &attributes = iter->second->attributes; + for (sdlAttributeMap::iterator it = attributes.begin(); + it != attributes.end(); ++it) { + if (isdigit(it->first[0])) { + if (!schema_attributegroup_fixup(ctx, it->second, fixed)) { + fixed[it->first] = it->second; + } + } else { + schema_attribute_fixup(ctx, it->second); + sdlAttributePtr newAttr(new sdlAttribute()); + *newAttr = *it->second; + copy_extra_attributes(newAttr, it->second); + fixed[it->first] = newAttr; + } + } + attr->ref.clear(); + return true; + } + attr->ref.clear(); + } + return false; +} + +static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model) { + switch (model->kind) { + case XSD_CONTENT_GROUP_REF: { + sdlTypeMap::iterator iter = ctx->sdl->groups.find(model->u_group_ref); + if (iter != ctx->sdl->groups.end()) { + schema_type_fixup(ctx, iter->second); + model->u_group_ref.clear(); + model->kind = XSD_CONTENT_GROUP; + model->u_group = iter->second.get(); + } else { + throw SoapException("Parsing Schema: unresolved group 'ref' attribute"); + } + break; + } + case XSD_CONTENT_CHOICE: + if (model->max_occurs != 1) { + for (unsigned int i = 0; i < model->u_content.size(); i++) { + sdlContentModelPtr tmp = model->u_content[i]; + tmp->min_occurs = 0; + tmp->max_occurs = model->max_occurs; + } + model->kind = XSD_CONTENT_ALL; + model->min_occurs = 1; + model->max_occurs = 1; + } + // fall through + case XSD_CONTENT_SEQUENCE: + case XSD_CONTENT_ALL: + for (unsigned int i = 0; i < model->u_content.size(); i++) { + sdlContentModelPtr tmp = model->u_content[i]; + schema_content_model_fixup(ctx, tmp); + } + break; + default: + break; + } +} + +static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type) { + if (!type->ref.empty()) { + sdlTypeMap::const_iterator iter = ctx->sdl->elements.find(type->ref); + if (iter != ctx->sdl->elements.end()) { + const sdlTypePtr src = iter->second; + type->kind = src->kind; + type->encode = src->encode; + if (src->nillable) { + type->nillable = true; + } + if (!src->fixed.empty()) { + type->fixed = src->fixed; + } + if (!src->def.empty()) { + type->def = src->def; + } + type->form = src->form; + } else if (type->ref == SCHEMA_NAMESPACE ":schema") { + type->encode = get_conversion(XSD_ANYXML); + } else { + throw SoapException("Parsing Schema: unresolved element 'ref' " + "attribute"); + } + type->ref.clear(); + } + + for (unsigned int i = 0; i < type->elements.size(); i++) { + schema_type_fixup(ctx, type->elements[i]); + } + + if (type->model) { + schema_content_model_fixup(ctx, type->model); + } + + sdlAttributeMap fixed; + for (sdlAttributeMap::iterator iter = type->attributes.begin(); + iter != type->attributes.end(); ++iter) { + if (isdigit(iter->first[0])) { + if (!schema_attributegroup_fixup(ctx, iter->second, fixed)) { + fixed[iter->first] = iter->second; + } + } else { + schema_attribute_fixup(ctx, iter->second); + fixed[iter->first] = iter->second; + } + } + type->attributes = fixed; +} + +void schema_pass2(sdlCtx *ctx) { + for (sdlAttributeMap::iterator iter = ctx->attributes.begin(); + iter != ctx->attributes.end(); ++iter) { + schema_attribute_fixup(ctx, iter->second); + } + for (sdlTypeMap::iterator iter = ctx->attributeGroups.begin(); + iter != ctx->attributeGroups.end(); ++iter) { + schema_type_fixup(ctx, iter->second); + } + + sdlPtr sdl = ctx->sdl; + for (sdlTypeMap::iterator iter = sdl->elements.begin(); + iter != sdl->elements.end(); ++iter) { + schema_type_fixup(ctx, iter->second); + } + for (sdlTypeMap::iterator iter = sdl->groups.begin(); + iter != sdl->groups.end(); ++iter) { + schema_type_fixup(ctx, iter->second); + } + for (unsigned int i = 0; i < sdl->types.size(); i++) { + schema_type_fixup(ctx, sdl->types[i]); + } + + ctx->attributes.clear(); + ctx->attributeGroups.clear(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/soap/sdl.cpp b/src/cpp/ext/soap/sdl.cpp new file mode 100644 index 0000000000000..044caaa45caca --- /dev/null +++ b/src/cpp/ext/soap/sdl.cpp @@ -0,0 +1,983 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +encodePtr get_encoder_from_prefix(sdl *sdl, xmlNodePtr node, + const xmlChar *type) { + string ns, cptype; + parse_namespace(type, cptype, ns); + xmlNsPtr nsptr = xmlSearchNs(node->doc, node, BAD_CAST(ns.c_str())); + encodePtr enc; + if (nsptr) { + enc = get_encoder(sdl, (char*)nsptr->href, cptype.c_str()); + if (enc == NULL) { + enc = get_encoder_ex(sdl, cptype); + } + } else { + enc = get_encoder_ex(sdl, (char*)type); + } + return enc; +} + +static sdlTypePtr get_element(sdl *sdl, xmlNodePtr node, const xmlChar *type) { + sdlTypePtr ret; + if (!sdl->elements.empty()) { + string ns, cptype; + parse_namespace(type, cptype, ns); + xmlNsPtr nsptr = xmlSearchNs(node->doc, node, BAD_CAST(ns.c_str())); + if (nsptr) { + string nscat = (char*)nsptr->href; + nscat += ':'; + nscat += cptype; + sdlTypeMap::iterator iter = sdl->elements.find(nscat); + if (iter != sdl->elements.end()) { + ret = iter->second; + } else { + iter = sdl->elements.find((char*)type); + if (iter != sdl->elements.end()) { + ret = iter->second; + } + } + } else { + sdlTypeMap::iterator iter = sdl->elements.find((char*)type); + if (iter != sdl->elements.end()) { + ret = iter->second; + } + } + } + return ret; +} + +encodePtr get_encoder(sdl *sdl, const char *ns, const char *type) { + string nscat = ns; + nscat += ':'; + nscat += type; + encodePtr enc = get_encoder_ex(sdl, nscat); + + if (!enc && + (strcmp(ns, SOAP_1_1_ENC_NAMESPACE) == 0 || + strcmp(ns, SOAP_1_2_ENC_NAMESPACE) == 0)) { + string enc_nscat = XSD_NAMESPACE; + enc_nscat += ':'; + enc_nscat += type; + enc = get_encoder_ex(NULL, enc_nscat); + if (enc && sdl) { + encodePtr new_enc(new encode()); + *new_enc = *enc; + sdl->encoders[nscat] = new_enc; + enc = new_enc; + } + } + return enc; +} + +encodePtr get_encoder_ex(sdl *sdl, const std::string &nscat) { + USE_SOAP_GLOBAL; + encodeMap::iterator iter = SOAP_GLOBAL(defEnc).find(nscat); + if (iter != SOAP_GLOBAL(defEnc).end()) { + return iter->second; + } + if (sdl) { + iter = sdl->encoders.find(nscat); + if (iter != sdl->encoders.end()) { + return iter->second; + } + } + return encodePtr(); +} + +sdlBindingPtr get_binding_from_type(sdl *sdl, int type) { + if (sdl) { + for (sdlBindingMap::iterator iter = sdl->bindings.begin(); + iter != sdl->bindings.end(); ++iter) { + if (iter->second->bindingType == type) { + return iter->second; + } + } + } + return sdlBindingPtr(); +} + +sdlBindingPtr get_binding_from_name(sdl *sdl, char *name, char *ns) { + string key = ns; + key += ':'; + key += name; + sdlBindingMap::iterator iter = sdl->bindings.find(key); + if (iter != sdl->bindings.end()) { + return iter->second; + } + return sdlBindingPtr(); +} + +static bool is_wsdl_element(xmlNodePtr node) { + if (node->ns && strcmp((char*)node->ns->href, WSDL_NAMESPACE) != 0) { + xmlAttrPtr attr = get_attribute_ex(node->properties, "required", + WSDL_NAMESPACE); + if (attr && attr->children && attr->children->content && + (strcmp((char*)attr->children->content, "1") == 0 || + strcmp((char*)attr->children->content, "true") == 0)) { + throw SoapException("Parsing WSDL: Unknown required WSDL extension '%s'", + node->ns->href); + } + return false; + } + return true; +} + +static void load_wsdl_ex(char *struri, sdlCtx *ctx, bool include) { + if (ctx->docs.find(struri) != ctx->docs.end()) { + return; + } + + xmlDocPtr wsdl = soap_xmlParseFile(struri); + if (!wsdl) { + xmlErrorPtr xmlErrorPtr = xmlGetLastError(); + if (xmlErrorPtr) { + throw SoapException("Parsing WSDL: Couldn't load from '%s' : %s", + struri, xmlErrorPtr->message); + } else { + throw SoapException("Parsing WSDL: Couldn't load from '%s'", struri); + } + } + + sdlPtr tmpsdl = ctx->sdl; + ctx->docs[struri] = wsdl; + + xmlNodePtr root = wsdl->children; + xmlNodePtr definitions = get_node_ex(root, "definitions", WSDL_NAMESPACE); + if (!definitions) { + if (include) { + xmlNodePtr schema = get_node_ex(root, "schema", XSD_NAMESPACE); + if (schema) { + load_schema(ctx, schema); + return; + } + } + throw SoapException("Parsing WSDL: Couldn't find in '%s'", + struri); + } + + xmlAttrPtr targetNamespace; + if (!include) { + targetNamespace = get_attribute(definitions->properties, + "targetNamespace"); + if (targetNamespace) { + tmpsdl->target_ns = (char*)targetNamespace->children->content; + } + } + + xmlNodePtr trav = definitions->children; + while (trav) { + if (!is_wsdl_element(trav)) { + trav = trav->next; + continue; + } + if (node_is_equal(trav,"types")) { + /* TODO: Only one "types" is allowed */ + xmlNodePtr trav2 = trav->children; + while (trav2) { + if (node_is_equal_ex(trav2, "schema", XSD_NAMESPACE)) { + load_schema(ctx, trav2); + } else if (is_wsdl_element(trav2) && + !node_is_equal(trav2,"documentation")) { + throw SoapException("Parsing WSDL: Unexpected WSDL element <%s>", + trav2->name); + } + trav2 = trav2->next; + } + } else if (node_is_equal(trav,"import")) { + /* TODO: namespace ??? */ + xmlAttrPtr tmp = get_attribute(trav->properties, "location"); + if (tmp) { + xmlChar *uri; + xmlChar *base = xmlNodeGetBase(trav->doc, trav); + if (base == NULL) { + uri = xmlBuildURI(tmp->children->content, trav->doc->URL); + } else { + uri = xmlBuildURI(tmp->children->content, base); + xmlFree(base); + } + load_wsdl_ex((char*)uri, ctx, true); + xmlFree(uri); + } + + } else if (node_is_equal(trav,"message")) { + xmlAttrPtr name = get_attribute(trav->properties, "name"); + if (name && name->children && name->children->content) { + char *content = (char*)name->children->content; + if (ctx->messages.find(content) != ctx->messages.end()) { + throw SoapException("Parsing WSDL: '%s' already defined", + content); + } else { + ctx->messages[content] = trav; + } + } else { + throw SoapException("Parsing WSDL: hasn't name attribute"); + } + + } else if (node_is_equal(trav,"portType")) { + xmlAttrPtr name = get_attribute(trav->properties, "name"); + if (name && name->children && name->children->content) { + char *content = (char*)name->children->content; + if (ctx->portTypes.find(content) != ctx->portTypes.end()) { + throw SoapException("Parsing WSDL: '%s' already defined", + content); + } else { + ctx->portTypes[content] = trav; + } + } else { + throw SoapException("Parsing WSDL: hasn't name attribute"); + } + + } else if (node_is_equal(trav,"binding")) { + xmlAttrPtr name = get_attribute(trav->properties, "name"); + if (name && name->children && name->children->content) { + char *content = (char*)name->children->content; + if (ctx->bindings.find(content) != ctx->bindings.end()) { + throw SoapException("Parsing WSDL: '%s' already defined", + content); + } else { + ctx->bindings[content] = trav; + } + } else { + throw SoapException("Parsing WSDL: hasn't name attribute"); + } + + } else if (node_is_equal(trav,"service")) { + xmlAttrPtr name = get_attribute(trav->properties, "name"); + if (name && name->children && name->children->content) { + char *content = (char*)name->children->content; + if (ctx->services.find(content) != ctx->services.end()) { + throw SoapException("Parsing WSDL: '%s' already defined", + content); + } else { + ctx->services[content] = trav; + } + } else { + throw SoapException("Parsing WSDL: hasn't name attribute"); + } + } else if (!node_is_equal(trav,"documentation")) { + throw SoapException("Parsing WSDL: Unexpected WSDL element <%s>", + trav->name); + } + trav = trav->next; + } +} + +static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header +(sdlCtx* ctx, xmlNodePtr header, char* wsdl_soap_namespace, bool fault) { + xmlAttrPtr tmp = get_attribute(header->properties, "message"); + if (!tmp) { + throw SoapException("Parsing WSDL: Missing message attribute for
    "); + } + + char *ctype = strrchr((char*)tmp->children->content,':'); + if (ctype == NULL) { + ctype = (char*)tmp->children->content; + } else { + ++ctype; + } + xmlNodeMap::iterator iter = ctx->messages.find(ctype); + if (iter == ctx->messages.end()) { + throw SoapException("Parsing WSDL: Missing with name '%s'", + tmp->children->content); + } + xmlNodePtr message = iter->second; + + tmp = get_attribute(header->properties, "part"); + if (!tmp) { + throw SoapException("Parsing WSDL: Missing part attribute for
    "); + } + xmlNodePtr part = get_node_with_attribute_ex + (message->children, "part", WSDL_NAMESPACE, "name", + (char*)tmp->children->content, NULL); + if (!part) { + throw SoapException("Parsing WSDL: Missing part '%s' in ", + tmp->children->content); + } + + sdlSoapBindingFunctionHeaderPtr h(new sdlSoapBindingFunctionHeader()); + h->name = (char*)tmp->children->content; + + tmp = get_attribute(header->properties, "use"); + if (tmp && + !strncmp((char*)tmp->children->content, "encoded", sizeof("encoded"))) { + h->use = SOAP_ENCODED; + } else { + h->use = SOAP_LITERAL; + } + + tmp = get_attribute(header->properties, "namespace"); + if (tmp) { + h->ns = (char*)tmp->children->content; + } + + if (h->use == SOAP_ENCODED) { + tmp = get_attribute(header->properties, "encodingStyle"); + if (tmp) { + if (strncmp((char*)tmp->children->content, SOAP_1_1_ENC_NAMESPACE, + sizeof(SOAP_1_1_ENC_NAMESPACE)) == 0) { + h->encodingStyle = SOAP_ENCODING_1_1; + } else if (strncmp((char*)tmp->children->content, SOAP_1_2_ENC_NAMESPACE, + sizeof(SOAP_1_2_ENC_NAMESPACE)) == 0) { + h->encodingStyle = SOAP_ENCODING_1_2; + } else { + throw SoapException("Parsing WSDL: Unknown encodingStyle '%s'", + tmp->children->content); + } + } else { + throw SoapException("Parsing WSDL: Unspecified encodingStyle"); + } + } + + tmp = get_attribute(part->properties, "type"); + if (tmp) { + h->encode = get_encoder_from_prefix(ctx->sdl.get(), part, + tmp->children->content); + } else { + tmp = get_attribute(part->properties, "element"); + if (tmp) { + h->element = get_element(ctx->sdl.get(), part, tmp->children->content); + if (h->element) { + h->encode = h->element->encode; + if (h->ns.empty() && !h->element->namens.empty()) { + h->ns = h->element->namens; + } + if (!h->element->name.empty()) { + h->name = h->element->name; + } + } + } + } + if (!fault) { + xmlNodePtr trav = header->children; + while (trav) { + if (node_is_equal_ex(trav, "headerfault", wsdl_soap_namespace)) { + sdlSoapBindingFunctionHeaderPtr hf = + wsdl_soap_binding_header(ctx, trav, wsdl_soap_namespace, true); + string key; + if (!hf->ns.empty()) { + key += hf->ns; + key += ':'; + } + key += hf->name; + h->headerfaults[key] = hf; + } else if (is_wsdl_element(trav) && + !node_is_equal(trav,"documentation")) { + throw SoapException("Parsing WSDL: Unexpected WSDL element <%s>", + trav->name); + } + trav = trav->next; + } + } + return h; +} + +static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, + char* wsdl_soap_namespace, + sdlSoapBindingFunctionBody *binding, + sdlParamVec ¶ms) { + xmlNodePtr body; + xmlAttrPtr tmp; + xmlNodePtr trav = node->children; + while (trav) { + if (node_is_equal_ex(trav, "body", wsdl_soap_namespace)) { + body = trav; + tmp = get_attribute(body->properties, "use"); + if (tmp && + !strncmp((char*)tmp->children->content, "literal", + sizeof("literal"))) { + binding->use = SOAP_LITERAL; + } else { + binding->use = SOAP_ENCODED; + } + + tmp = get_attribute(body->properties, "namespace"); + if (tmp) { + binding->ns = (char*)tmp->children->content; + } + + tmp = get_attribute(body->properties, "parts"); + if (tmp) { + sdlParamVec ht; + char *parts = (char*)tmp->children->content; + + /* Delete all parts those are not in the "parts" attribute */ + while (*parts) { + bool found = false; + while (*parts == ' ') ++parts; + if (*parts == '\0') break; + char *end = strchr(parts, ' '); + if (end) *end = '\0'; + for (unsigned int i = 0; i < params.size(); i++) { + sdlParamPtr param = params[i]; + if (param->paramName == parts) { + sdlParamPtr x_param(new sdlParam); + *x_param = *param; + ht.push_back(x_param); + found = true; + break; + } + } + if (!found) { + throw SoapException("Parsing WSDL: Missing part '%s' in ", + parts); + } + parts += strlen(parts); + if (end) *end = ' '; + } + params = ht; + } + + if (binding->use == SOAP_ENCODED) { + tmp = get_attribute(body->properties, "encodingStyle"); + if (tmp) { + if (strncmp((char*)tmp->children->content, SOAP_1_1_ENC_NAMESPACE, + sizeof(SOAP_1_1_ENC_NAMESPACE)) == 0) { + binding->encodingStyle = SOAP_ENCODING_1_1; + } else if (strncmp((char*)tmp->children->content, + SOAP_1_2_ENC_NAMESPACE, + sizeof(SOAP_1_2_ENC_NAMESPACE)) == 0) { + binding->encodingStyle = SOAP_ENCODING_1_2; + } else { + throw SoapException("Parsing WSDL: Unknown encodingStyle '%s'", + tmp->children->content); + } + } else { + throw SoapException("Parsing WSDL: Unspecified encodingStyle"); + } + } + } else if (node_is_equal_ex(trav, "header", wsdl_soap_namespace)) { + sdlSoapBindingFunctionHeaderPtr h = + wsdl_soap_binding_header(ctx, trav, wsdl_soap_namespace, false); + string key; + if (!h->ns.empty()) { + key += h->ns; + key += ':'; + } + key += h->name; + binding->headers[key] = h; + } else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) { + throw SoapException("Parsing WSDL: Unexpected WSDL element <%s>", + trav->name); + } + trav = trav->next; + } +} + +static void wsdl_message(sdlCtx *ctx, sdlParamVec ¶meters, + xmlChar* message_name) { + char *ctype = strrchr((char*)message_name,':'); + if (ctype == NULL) { + ctype = (char*)message_name; + } else { + ++ctype; + } + xmlNodeMap::iterator iter = ctx->messages.find(ctype); + if (iter == ctx->messages.end()) { + throw SoapException("Parsing WSDL: Missing with name '%s'", + message_name); + } + + xmlNodePtr part; + xmlNodePtr message = iter->second; + xmlNodePtr trav = message->children; + while (trav) { + if (trav->ns && strcmp((char*)trav->ns->href, WSDL_NAMESPACE) != 0) { + throw SoapException("Parsing WSDL: Unexpected extensibility " + "element <%s>", trav->name); + } + if (node_is_equal(trav,"documentation")) { + trav = trav->next; + continue; + } + if (!node_is_equal(trav,"part")) { + throw SoapException("Parsing WSDL: Unexpected WSDL element <%s>", + trav->name); + } + part = trav; + sdlParamPtr param(new sdlParam); + param->order = 0; + xmlAttrPtr name = get_attribute(part->properties, "name"); + if (name == NULL) { + throw SoapException("Parsing WSDL: No name associated with '%s'", + message->name); + } + + param->paramName = (char*)name->children->content; + xmlAttrPtr type = get_attribute(part->properties, "type"); + if (type) { + param->encode = get_encoder_from_prefix(ctx->sdl.get(), part, + type->children->content); + } else { + xmlAttrPtr element = get_attribute(part->properties, "element"); + if (element) { + param->element = get_element(ctx->sdl.get(), part, + element->children->content); + if (param->element) { + param->encode = param->element->encode; + } + } + } + + parameters.push_back(param); + trav = trav->next; + } +} + +sdlPtr load_wsdl(char *struri) { + sdlCtx ctx; + ctx.sdl = sdlPtr(new sdl()); + ctx.sdl->source = struri; + + load_wsdl_ex(struri, &ctx, false); + schema_pass2(&ctx); + + int i = 0; + for (xmlNodeMap::iterator iter = ctx.services.begin(); + iter != ctx.services.end(); ++iter, ++i) { + xmlNodePtr service = iter->second; + xmlNodePtr port; + bool has_soap_port = false; + xmlNodePtr trav = service->children; + while (trav) { + if (!is_wsdl_element(trav) || node_is_equal(trav,"documentation")) { + trav = trav->next; + continue; + } + if (!node_is_equal(trav,"port")) { + throw SoapException("Parsing WSDL: Unexpected WSDL element <%s>", + trav->name); + } + + port = trav; + + sdlBindingPtr tmpbinding(new sdlBinding()); + xmlAttrPtr bindingAttr = get_attribute(port->properties, "binding"); + if (bindingAttr == NULL) { + throw SoapException("Parsing WSDL: No binding associated with "); + } + + char *wsdl_soap_namespace = NULL; + + /* find address and figure out binding type */ + xmlNodePtr address = NULL; + xmlNodePtr trav2 = port->children; + while (trav2) { + if (node_is_equal(trav2,"address") && trav2->ns) { + if (!strncmp((char*)trav2->ns->href, WSDL_SOAP11_NAMESPACE, + sizeof(WSDL_SOAP11_NAMESPACE))) { + address = trav2; + wsdl_soap_namespace = WSDL_SOAP11_NAMESPACE; + tmpbinding->bindingType = BINDING_SOAP; + } else if (!strncmp((char*)trav2->ns->href, WSDL_SOAP12_NAMESPACE, + sizeof(WSDL_SOAP12_NAMESPACE))) { + address = trav2; + wsdl_soap_namespace = WSDL_SOAP12_NAMESPACE; + tmpbinding->bindingType = BINDING_SOAP; + } else if (!strncmp((char*)trav2->ns->href, RPC_SOAP12_NAMESPACE, + sizeof(RPC_SOAP12_NAMESPACE))) { + address = trav2; + wsdl_soap_namespace = RPC_SOAP12_NAMESPACE; + tmpbinding->bindingType = BINDING_SOAP; + } else if (!strncmp((char*)trav2->ns->href, WSDL_HTTP11_NAMESPACE, + sizeof(WSDL_HTTP11_NAMESPACE))) { + address = trav2; + tmpbinding->bindingType = BINDING_HTTP; + } else if (!strncmp((char*)trav2->ns->href, WSDL_HTTP12_NAMESPACE, + sizeof(WSDL_HTTP12_NAMESPACE))) { + address = trav2; + tmpbinding->bindingType = BINDING_HTTP; + } + } + if (trav2 != address && is_wsdl_element(trav2) && + !node_is_equal(trav2,"documentation")) { + throw SoapException("Parsing WSDL: Unexpected WSDL element <%s>", + trav2->name); + } + trav2 = trav2->next; + } + if (!address || tmpbinding->bindingType == BINDING_HTTP) { + if (has_soap_port || trav->next || i < (int)ctx.services.size() - 1) { + trav = trav->next; + continue; + } else if (!address) { + throw SoapException("Parsing WSDL: No address associated " + "with "); + } + } + has_soap_port = true; + + xmlAttrPtr location = get_attribute(address->properties, "location"); + if (!location) { + throw SoapException("Parsing WSDL: No location associated " + "with "); + } + tmpbinding->location = (char*)location->children->content; + + char *ctype = strrchr((char*)bindingAttr->children->content,':'); + if (ctype == NULL) { + ctype = (char*)bindingAttr->children->content; + } else { + ++ctype; + } + xmlNodeMap::iterator iterBinding = ctx.bindings.find(ctype); + if (iterBinding == ctx.bindings.end()) { + throw SoapException("Parsing WSDL: No element " + "with name '%s'", ctype); + } + xmlNodePtr binding = iterBinding->second; + + if (tmpbinding->bindingType == BINDING_SOAP) { + xmlAttrPtr tmp; + + sdlSoapBindingPtr soapBinding(new sdlSoapBinding()); + soapBinding->style = SOAP_DOCUMENT; + xmlNodePtr soapBindingNode = get_node_ex(binding->children, "binding", + wsdl_soap_namespace); + if (soapBindingNode) { + tmp = get_attribute(soapBindingNode->properties, "style"); + if (tmp && + !strncmp((char*)tmp->children->content, "rpc", sizeof("rpc"))) { + soapBinding->style = SOAP_RPC; + } + + tmp = get_attribute(soapBindingNode->properties, "transport"); + if (tmp) { + if (strncmp((char*)tmp->children->content, WSDL_HTTP_TRANSPORT, + sizeof(WSDL_HTTP_TRANSPORT)) == 0) { + soapBinding->transport = SOAP_TRANSPORT_HTTP; + } else { + throw SoapException("Parsing WSDL: PHP-SOAP doesn't support " + "transport '%s'", tmp->children->content); + } + } + } + tmpbinding->bindingAttributes = soapBinding; + } + + xmlAttrPtr name = get_attribute(binding->properties, "name"); + if (name == NULL) { + throw SoapException("Parsing WSDL: Missing 'name' attribute " + "for "); + } + tmpbinding->name = (char*)name->children->content; + + xmlAttrPtr type = get_attribute(binding->properties, "type"); + if (type == NULL) { + throw SoapException("Parsing WSDL: Missing 'type' attribute " + "for "); + } + + xmlNodePtr portType, operation; + ctype = strrchr((char*)type->children->content,':'); + if (ctype == NULL) { + ctype = (char*)type->children->content; + } else { + ++ctype; + } + xmlNodeMap::iterator iter = ctx.portTypes.find(ctype); + if (iter == ctx.portTypes.end()) { + throw SoapException("Parsing WSDL: Missing with name '%s'", + name->children->content); + } + portType = iter->second; + + trav2 = binding->children; + while (trav2) { + if ((tmpbinding->bindingType == BINDING_SOAP && + node_is_equal_ex(trav2, "binding", wsdl_soap_namespace)) || + !is_wsdl_element(trav2) || + node_is_equal(trav2,"documentation")) { + trav2 = trav2->next; + continue; + } + if (!node_is_equal(trav2,"operation")) { + throw SoapException("Parsing WSDL: Unexpected WSDL element <%s>", + trav2->name); + } + + operation = trav2; + xmlAttrPtr op_name = get_attribute(operation->properties, "name"); + if (op_name == NULL) { + throw SoapException("Parsing WSDL: Missing 'name' attribute " + "for "); + } + + xmlNodePtr trav3 = operation->children; + while (trav3) { + if (tmpbinding->bindingType == BINDING_SOAP && + node_is_equal_ex(trav3, "operation", wsdl_soap_namespace)) { + } else if (is_wsdl_element(trav3) && + !node_is_equal(trav3,"input") && + !node_is_equal(trav3,"output") && + !node_is_equal(trav3,"fault") && + !node_is_equal(trav3,"documentation")) { + throw SoapException("Parsing WSDL: Unexpected WSDL element <%s>", + trav3->name); + } + trav3 = trav3->next; + } + + xmlNodePtr portTypeOperation = + get_node_with_attribute_ex(portType->children, "operation", + WSDL_NAMESPACE, "name", + (char*)op_name->children->content, NULL); + if (portTypeOperation == NULL) { + throw SoapException("Parsing WSDL: Missing / " + "with name '%s'", op_name->children->content); + } + + xmlNodePtr input, output, fault; + xmlAttrPtr paramOrder; + + sdlFunctionPtr function(new sdlFunction()); + function->functionName = (char*)op_name->children->content; + + if (tmpbinding->bindingType == BINDING_SOAP) { + sdlSoapBindingFunctionPtr soapFunctionBinding + (new sdlSoapBindingFunction()); + sdlSoapBindingPtr soapBinding = tmpbinding->bindingAttributes; + soapFunctionBinding->style = soapBinding->style; + + xmlNodePtr soapOperation = get_node_ex + (operation->children, "operation", wsdl_soap_namespace); + xmlAttrPtr tmp; + if (soapOperation) { + tmp = get_attribute(soapOperation->properties, "soapAction"); + if (tmp) { + soapFunctionBinding->soapAction = (char*)tmp->children->content; + } + + tmp = get_attribute(soapOperation->properties, "style"); + if (tmp) { + if (!strncmp((char*)tmp->children->content, "rpc", + sizeof("rpc"))) { + soapFunctionBinding->style = SOAP_RPC; + } else { + soapFunctionBinding->style = SOAP_DOCUMENT; + } + } else { + soapFunctionBinding->style = soapBinding->style; + } + } + + function->bindingAttributes = soapFunctionBinding; + } + + input = get_node_ex(portTypeOperation->children, "input", + WSDL_NAMESPACE); + if (input) { + xmlAttrPtr message = get_attribute(input->properties, "message"); + if (message == NULL) { + throw SoapException("Parsing WSDL: Missing name for " + "of '%s'", op_name->children->content); + } + wsdl_message(&ctx, function->requestParameters, + message->children->content); +/* FIXME + xmlAttrPtr name = get_attribute(input->properties, "name"); + if (name) { + function->requestName = estrdup(name->children->content); + } else { +*/ + { + function->requestName = function->functionName; + } + + if (tmpbinding->bindingType == BINDING_SOAP) { + input = get_node_ex(operation->children, "input", WSDL_NAMESPACE); + if (input) { + sdlSoapBindingFunctionPtr soapFunctionBinding = + function->bindingAttributes; + wsdl_soap_binding_body(&ctx, input, wsdl_soap_namespace, + &soapFunctionBinding->input, + function->requestParameters); + } + } + } + + output = get_node_ex(portTypeOperation->children, "output", + WSDL_NAMESPACE); + if (output) { + xmlAttrPtr message = get_attribute(output->properties, "message"); + if (message == NULL) { + throw SoapException("Parsing WSDL: Missing name for " + "of '%s'", op_name->children->content); + } + wsdl_message(&ctx, function->responseParameters, + message->children->content); + +/* FIXME + xmlAttrPtr name = get_attribute(output->properties, "name"); + if (name) { + function->responseName = estrdup(name->children->content); + } else if (input == NULL) { + function->responseName = estrdup(function->functionName); + } else { +*/ + { + function->responseName = function->functionName + "Response"; + } + + if (tmpbinding->bindingType == BINDING_SOAP) { + output = get_node_ex(operation->children, "output", + WSDL_NAMESPACE); + if (output) { + sdlSoapBindingFunctionPtr soapFunctionBinding = + function->bindingAttributes; + wsdl_soap_binding_body(&ctx, output, wsdl_soap_namespace, + &soapFunctionBinding->output, + function->responseParameters); + } + } + } + + paramOrder = get_attribute(portTypeOperation->properties, + "parameterOrder"); + if (paramOrder) { + /* FIXME: */ + } + + fault = portTypeOperation->children; + while (fault) { + if (node_is_equal_ex(fault, "fault", WSDL_NAMESPACE)) { + xmlAttrPtr name = get_attribute(fault->properties, "name"); + if (name == NULL) { + throw SoapException("Parsing WSDL: Missing name for " + "of '%s'", op_name->children->content); + } + xmlAttrPtr message = get_attribute(fault->properties, "message"); + if (message == NULL) { + throw SoapException("Parsing WSDL: Missing name for " + "of '%s'", op_name->children->content); + } + + sdlFaultPtr f(new sdlFault()); + f->name = (char*)name->children->content; + wsdl_message(&ctx, f->details, message->children->content); + if (f->details.size() != 1) { + throw SoapException("Parsing WSDL: The fault message '%s' must " + "have a single part", + message->children->content); + } + + if (tmpbinding->bindingType == BINDING_SOAP) { + xmlNodePtr soap_fault = + get_node_with_attribute_ex(operation->children, "fault", + WSDL_NAMESPACE, "name", + (char*)f->name.c_str(), NULL); + if (soap_fault) { + xmlNodePtr trav = soap_fault->children; + while (trav) { + if (node_is_equal_ex(trav, "fault", wsdl_soap_namespace)) { + sdlSoapBindingFunctionFaultPtr binding = + f->bindingAttributes = sdlSoapBindingFunctionFaultPtr + (new sdlSoapBindingFunctionFault()); + xmlAttrPtr tmp = get_attribute(trav->properties, "use"); + if (tmp && !strncmp((char*)tmp->children->content, + "encoded", sizeof("encoded"))) { + binding->use = SOAP_ENCODED; + } else { + binding->use = SOAP_LITERAL; + } + + tmp = get_attribute(trav->properties, "namespace"); + if (tmp) { + binding->ns = (char*)tmp->children->content; + } + + if (binding->use == SOAP_ENCODED) { + tmp = get_attribute(trav->properties, "encodingStyle"); + if (tmp) { + if (strncmp((char*)tmp->children->content, + SOAP_1_1_ENC_NAMESPACE, + sizeof(SOAP_1_1_ENC_NAMESPACE)) == 0) { + binding->encodingStyle = SOAP_ENCODING_1_1; + } else if (strncmp((char*)tmp->children->content, + SOAP_1_2_ENC_NAMESPACE, + sizeof(SOAP_1_2_ENC_NAMESPACE)) + == 0) { + binding->encodingStyle = SOAP_ENCODING_1_2; + } else { + throw SoapException("Parsing WSDL: Unknown " + "encodingStyle '%s'", + tmp->children->content); + } + } else { + throw SoapException("Parsing WSDL: Unspecified " + "encodingStyle"); + } + } + } else if (is_wsdl_element(trav) && + !node_is_equal(trav,"documentation")) { + throw SoapException("Parsing WSDL: Unexpected WSDL " + "element <%s>", trav->name); + } + trav = trav->next; + } + } + } + sdlFaultMap::iterator iter = function->faults.find(f->name); + if (iter != function->faults.end()) { + throw SoapException("Parsing WSDL: with name '%s' " + "already defined in '%s'", f->name.c_str(), + op_name->children->content); + } + function->faults[f->name] = f; + } + fault = fault->next; + } + + function->binding = tmpbinding; + + { + string tmp = Util::toLower(function->functionName); + sdlFunctionMap::iterator iter = ctx.sdl->functions.find(tmp); + if (iter != ctx.sdl->functions.end()) { + ctx.sdl->functions[boost::lexical_cast + (ctx.sdl->functions.size())] = function; + } else { + ctx.sdl->functions[tmp] = function; + } + if (function->requestName != function->functionName) { + ctx.sdl->requests[Util::toLower(function->requestName)] = function; + } + } + trav2 = trav2->next; + } + + ctx.sdl->bindings[tmpbinding->name] = tmpbinding; + trav= trav->next; + } + } + + if (i == 0) { + throw SoapException("Parsing WSDL: Couldn't bind to service"); + } + return ctx.sdl; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/soap/sdl.h b/src/cpp/ext/soap/sdl.h new file mode 100644 index 0000000000000..99fb527f3c202 --- /dev/null +++ b/src/cpp/ext/soap/sdl.h @@ -0,0 +1,319 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_SDL_H +#define PHP_SDL_H + +#include + +/////////////////////////////////////////////////////////////////////////////// +// defines + +#define XSD_WHITESPACE_COLLAPSE 1 +#define XSD_WHITESPACE_PRESERVE 1 +#define XSD_WHITESPACE_REPLACE 1 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// XSD enums + +enum sdlContentKind { + XSD_CONTENT_ELEMENT, + XSD_CONTENT_SEQUENCE, + XSD_CONTENT_ALL, + XSD_CONTENT_CHOICE, + XSD_CONTENT_GROUP_REF, + XSD_CONTENT_GROUP, + XSD_CONTENT_ANY +}; + +enum sdlTypeKind { + XSD_TYPEKIND_SIMPLE, + XSD_TYPEKIND_LIST, + XSD_TYPEKIND_UNION, + XSD_TYPEKIND_COMPLEX, + XSD_TYPEKIND_RESTRICTION, + XSD_TYPEKIND_EXTENSION +}; + +enum sdlUse { + XSD_USE_DEFAULT, + XSD_USE_OPTIONAL, + XSD_USE_PROHIBITED, + XSD_USE_REQUIRED +}; + +enum sdlForm { + XSD_FORM_DEFAULT, + XSD_FORM_QUALIFIED, + XSD_FORM_UNQUALIFIED +}; + +/////////////////////////////////////////////////////////////////////////////// +// XSD types + +DECLARE_BOOST_TYPES(sdlType); +DECLARE_BOOST_TYPES(sdlContentModel); +DECLARE_BOOST_TYPES(sdlAttribute); +DECLARE_BOOST_TYPES(sdlExtraAttribute); +DECLARE_BOOST_TYPES(sdlRestrictions); +DECLARE_BOOST_TYPES(sdlRestrictionChar); +DECLARE_BOOST_TYPES(sdlRestrictionInt); + +typedef StringTosdlTypePtrMap sdlTypeMap; +typedef sdlTypePtrVec sdlTypeVec; +typedef StringTosdlAttributePtrMap sdlAttributeMap; +typedef StringTosdlExtraAttributePtrMap sdlExtraAttributeMap; + +struct sdlRestrictionInt { + int value; + bool fixed; +}; + +struct sdlRestrictionChar { + std::string value; + bool fixed; +}; + +struct sdlRestrictions { + sdlRestrictionCharPtrVec enumeration; + sdlRestrictionIntPtr minExclusive; + sdlRestrictionIntPtr minInclusive; + sdlRestrictionIntPtr maxExclusive; + sdlRestrictionIntPtr maxInclusive; + sdlRestrictionIntPtr totalDigits; + sdlRestrictionIntPtr fractionDigits; + sdlRestrictionIntPtr length; + sdlRestrictionIntPtr minLength; + sdlRestrictionIntPtr maxLength; + sdlRestrictionCharPtr whiteSpace; + sdlRestrictionCharPtr pattern; +}; + +struct sdlContentModel { + sdlContentKind kind; + int min_occurs; + int max_occurs; + + // only one of these is effective, depending on "kind" + sdlType *u_element; // pointer to element + sdlType *u_group; // pointer to group + sdlContentModelPtrVec u_content; // array of sequnce,all,choice + std::string u_group_ref; // reference to group +}; + +struct sdlExtraAttribute { + std::string ns; + std::string val; +}; + +struct sdlAttribute { + std::string name; + std::string namens; + std::string ref; + std::string def; + std::string fixed; + sdlForm form; + sdlUse use; + sdlExtraAttributeMap extraAttributes; + encodePtr encode; +}; + +struct sdlType { + sdlType() : kind(XSD_TYPEKIND_SIMPLE), nillable(false), + form(XSD_FORM_DEFAULT) {} + + sdlTypeKind kind; + std::string name; + std::string namens; + bool nillable; + sdlTypeVec elements; + sdlAttributeMap attributes; + sdlRestrictionsPtr restrictions; + encodePtr encode; + sdlContentModelPtr model; + std::string def; + std::string fixed; + std::string ref; + sdlForm form; +}; + +/////////////////////////////////////////////////////////////////////////////// +// SOAP enums + +enum sdlBindingType { + BINDING_SOAP = 1, + BINDING_HTTP = 2 +}; + +enum sdlEncodingStyle { + SOAP_RPC = 1, + SOAP_DOCUMENT = 2 +}; + +enum sdlRpcEncodingStyle { + SOAP_ENCODING_DEFAULT = 0, + SOAP_ENCODING_1_1 = 1, + SOAP_ENCODING_1_2 = 2 +}; + +enum sdlEncodingUse { + SOAP_ENCODED = 1, + SOAP_LITERAL = 2 +}; + +enum sdlTransport { + SOAP_TRANSPORT_HTTP = 1 +}; + +/////////////////////////////////////////////////////////////////////////////// +// SOAP types + +/* Soap Binding Specfic stuff */ +DECLARE_BOOST_TYPES(sdl); +DECLARE_BOOST_TYPES(sdlSoapBinding); +DECLARE_BOOST_TYPES(sdlBinding); +DECLARE_BOOST_TYPES(sdlSoapBindingFunctionHeader); +DECLARE_BOOST_TYPES(sdlSoapBindingFunctionFault); +DECLARE_BOOST_TYPES(sdlSoapBindingFunction); +DECLARE_BOOST_TYPES(sdlParam); +DECLARE_BOOST_TYPES(sdlFault); +DECLARE_BOOST_TYPES(sdlFunction); + +typedef sdlTypePtrVec sdlTypeVec; +typedef StringTosdlBindingPtrMap sdlBindingMap; +typedef StringTosdlSoapBindingFunctionHeaderPtrMap \ + sdlSoapBindingFunctionHeaderMap; +typedef sdlParamPtrVec sdlParamVec; +typedef StringTosdlFaultPtrMap sdlFaultMap; +typedef StringTosdlFunctionPtrMap sdlFunctionMap; + +struct sdlSoapBinding { + sdlEncodingStyle style; + sdlTransport transport; /* not implemented yet */ +}; + +struct sdlBinding { + std::string name; + std::string location; + sdlBindingType bindingType; + sdlSoapBindingPtr bindingAttributes; +}; + +struct sdlSoapBindingFunctionHeader { + std::string name; + std::string ns; + sdlEncodingUse use; + sdlTypePtr element; + encodePtr encode; + sdlRpcEncodingStyle encodingStyle; /* not implemented yet */ + sdlSoapBindingFunctionHeaderMap headerfaults; +}; + +struct sdlSoapBindingFunctionFault { + std::string ns; + sdlEncodingUse use; + sdlRpcEncodingStyle encodingStyle; /* not implemented yet */ +}; + +struct sdlSoapBindingFunctionBody { + std::string ns; + sdlEncodingUse use; + sdlRpcEncodingStyle encodingStyle; /* not implemented yet */ + sdlSoapBindingFunctionHeaderMap headers; +}; + +struct sdlSoapBindingFunction { + std::string soapAction; + sdlEncodingStyle style; + + sdlSoapBindingFunctionBody input; + sdlSoapBindingFunctionBody output; +}; + +struct sdlParam { + int order; + sdlTypePtr element; + encodePtr encode; + std::string paramName; +}; + +struct sdlFault { + std::string name; + sdlParamVec details; + sdlSoapBindingFunctionFaultPtr bindingAttributes; +}; + +struct sdlFunction { + std::string functionName; + std::string requestName; + std::string responseName; + sdlParamVec requestParameters; + sdlParamVec responseParameters; + sdlBindingPtr binding; + sdlSoapBindingFunctionPtr bindingAttributes; + sdlFaultMap faults; +}; + +/////////////////////////////////////////////////////////////////////////////// +// top level data structures + +struct sdl { + sdlTypeMap elements; + sdlTypeMap groups; + sdlTypeVec types; + + encodeMap encoders; + + sdlFunctionMap functions; + sdlBindingMap bindings; + sdlFunctionMap requests; + std::string target_ns; + std::string source; +}; + +struct sdlCtx { + sdlPtr sdl; + sdlAttributeMap attributes; + sdlTypeMap attributeGroups; + + xmlDocMap docs; + xmlNodeMap messages; + xmlNodeMap portTypes; + xmlNodeMap bindings; + xmlNodeMap services; +}; + +/////////////////////////////////////////////////////////////////////////////// +// top level functions + +encodePtr get_encoder_from_prefix(sdl *sdl, xmlNodePtr data, + const xmlChar *type); +encodePtr get_encoder(sdl *sdl, const char *ns, const char *type); +encodePtr get_encoder_ex(sdl *sdl, const std::string &nscat); + +sdlBindingPtr get_binding_from_type(sdl *sdl, int type); +sdlBindingPtr get_binding_from_name(sdl *sdl, char *name, char *ns); + +sdlPtr load_wsdl(char *struri); +bool load_schema(sdlCtx *ctx, xmlNodePtr schema); +void schema_pass2(sdlCtx *ctx); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif diff --git a/src/cpp/ext/soap/soap.cpp b/src/cpp/ext/soap/soap.cpp new file mode 100644 index 0000000000000..51e6b581b3603 --- /dev/null +++ b/src/cpp/ext/soap/soap.cpp @@ -0,0 +1,151 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +SoapData::SoapData() : m_cache(WSDL_CACHE_MEMORY), m_cache_ttl(86400) { + for (int i = 0; s_defaultEncoding[i].type != END_KNOWN_TYPES; ++i){ + encodeStatic &e = s_defaultEncoding[i]; + + encodePtr enc(new encode()); + enc->details.type = e.type; + enc->details.type_str = e.type_str; + enc->details.ns = e.ns; + enc->to_zval = e.to_zval; + enc->to_xml = e.to_xml; + + const encodeType &details = enc->details; + if (!details.type_str.empty()) { + string name = details.type_str; + if (!details.ns.empty()) { + name = string(details.ns) + ':' + name; + } + m_defEnc[name] = enc; + } + + if (m_defEncIndex.find(details.type) == m_defEncIndex.end()) { + m_defEncIndex[details.type] = enc; + } + } + + m_defEncNs[XSD_1999_NAMESPACE] = XSD_NS_PREFIX; + m_defEncNs[XSD_NAMESPACE] = XSD_NS_PREFIX; + m_defEncNs[XSI_NAMESPACE] = XSI_NS_PREFIX; + m_defEncNs[XML_NAMESPACE] = XML_NS_PREFIX; + m_defEncNs[SOAP_1_1_ENC_NAMESPACE] = SOAP_1_1_ENC_NS_PREFIX; + m_defEncNs[SOAP_1_2_ENC_NAMESPACE] = SOAP_1_2_ENC_NS_PREFIX; +} + +sdl *SoapData::get_sdl(const char *uri, long cache_wsdl) { + sdlPtr sdl = get_sdl_impl(uri, cache_wsdl); + if (sdl) { + // holding it for the entire request life time, so soapserver and + // soapclient can use sdl* without being deleted + m_sdls.push_back(sdl); + return sdl.get(); + } + return NULL; +} + +encodeMap *SoapData::register_typemap(encodeMapPtr typemap) { + if (typemap) { + // holding it for the entire request life time, so soapserver and + // soapclient can use encodeMap* without being deleted + m_typemaps.push_back(typemap); + return typemap.get(); + } + return NULL; +} + +void SoapData::register_encoding(xmlCharEncodingHandlerPtr encoding) { + if (encoding) { + m_encodings.push_back(encoding); + } +} + +sdlPtr SoapData::get_sdl_impl(const char *uri, long cache_wsdl) { + if (cache_wsdl & WSDL_CACHE_MEMORY) { + sdlCache::iterator iter = m_mem_cache.find(uri); + if (iter != m_mem_cache.end()) { + sdlCacheBucketPtr p = iter->second; + if (p->time >= time(0) - m_cache_ttl) { + return p->sdl; + } + /* in-memory cache entry is expired */ + m_mem_cache.erase(iter); + } + } + + const char *old = m_error_code; + m_error_code = "WSDL"; + sdlPtr sdl = load_wsdl((char*)uri); + m_error_code = old; + + if (sdl && (cache_wsdl & WSDL_CACHE_MEMORY)) { + sdlCacheBucketPtr p(new sdlCacheBucket()); + p->sdl = sdl; + p->time = time(0); + m_mem_cache[uri] = p; + } + + return sdl; +} + +void SoapData::reset() { + m_soap_version = SOAP_1_1; + m_sdl = NULL; + m_encoding = NULL; + m_classmap.reset(); + m_typemap = NULL; + m_features = 0; + + m_use_soap_error_handler = false; + m_error_code = NULL; + m_error_object.reset(); + + m_cur_uniq_ns = 0; + m_cur_uniq_ref = 0; + m_ref_map.reset(); + + m_sdls.clear(); + m_typemaps.clear(); + + for (unsigned int i = 0; i < m_encodings.size(); i++) { + xmlCharEncCloseFunc(m_encodings[i]); + } + m_encodings.clear(); +} + +RequestLocal s_soap_data; +IMPLEMENT_OBJECT_ALLOCATION(soapHeader); +/////////////////////////////////////////////////////////////////////////////// + +SoapException::SoapException(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + format((std::string("SOAP_ERROR: ") + fmt).c_str(), ap); + va_end(ap); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/soap/soap.h b/src/cpp/ext/soap/soap.h new file mode 100644 index 0000000000000..b8600c2d6fc01 --- /dev/null +++ b/src/cpp/ext/soap/soap.h @@ -0,0 +1,182 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_SOAP_H +#define PHP_SOAP_H + +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// defines + +#define SOAP_CLASS 1 +#define SOAP_FUNCTIONS 2 +#define SOAP_OBJECT 3 +#define SOAP_FUNCTIONS_ALL 999 + +#define SOAP_MAP_FUNCTION 1 +#define SOAP_MAP_CLASS 2 + +#define SOAP_PERSISTENCE_SESSION 1 +#define SOAP_PERSISTENCE_REQUEST 2 + +#define SOAP_1_1 1 +#define SOAP_1_2 2 + +#define SOAP_ACTOR_NEXT 1 +#define SOAP_ACTOR_NONE 2 +#define SOAP_ACTOR_UNLIMATERECEIVER 3 + +#define SOAP_1_1_ACTOR_NEXT \ + "http://schemas.xmlsoap.org/soap/actor/next" +#define SOAP_1_2_ACTOR_NEXT \ + "http://www.w3.org/2003/05/soap-envelope/role/next" +#define SOAP_1_2_ACTOR_NONE \ + "http://www.w3.org/2003/05/soap-envelope/role/none" +#define SOAP_1_2_ACTOR_UNLIMATERECEIVER \ + "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" + +#define SOAP_COMPRESSION_ACCEPT 0x20 +#define SOAP_COMPRESSION_GZIP 0x00 +#define SOAP_COMPRESSION_DEFLATE 0x10 + +#define SOAP_AUTHENTICATION_BASIC 0 +#define SOAP_AUTHENTICATION_DIGEST 1 + +#define SOAP_SINGLE_ELEMENT_ARRAYS (1<<0) +#define SOAP_WAIT_ONE_WAY_CALLS (1<<1) +#define SOAP_USE_XSI_ARRAY_TYPE (1<<2) + +#define WSDL_CACHE_NONE 0x0 +#define WSDL_CACHE_DISK 0x1 +#define WSDL_CACHE_MEMORY 0x2 +#define WSDL_CACHE_BOTH 0x3 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class SoapData : public RequestEventHandler { +private: + // SDL cache + DECLARE_BOOST_TYPES(sdlCacheBucket); + struct sdlCacheBucket { + sdlPtr sdl; + time_t time; + }; + typedef StringTosdlCacheBucketPtrMap sdlCache; + +public: + int64 m_cache; + +private: + int64 m_cache_ttl; + sdlCache m_mem_cache; // URL => sdl + +public: + sdl *get_sdl(const char *uri, long cache_wsdl); + encodeMap *register_typemap(encodeMapPtr typemap); + void register_encoding(xmlCharEncodingHandlerPtr encoding); + +public: + SoapData(); + + // globals that live across requests + encodeMap m_defEnc; // name => encode + std::map m_defEncIndex; // type => encode + std::map m_defEncNs; // namespaces => prefixes + +public: + // request scope globals to avoid passing them between functions + int m_soap_version; + sdl *m_sdl; + xmlCharEncodingHandlerPtr m_encoding; + Array m_classmap; // typename => class name + encodeMap *m_typemap; // typename => encode + int m_features; + + // error handling + bool m_use_soap_error_handler; + const char *m_error_code; + Object m_error_object; + + // misc + int m_cur_uniq_ns; + int m_cur_uniq_ref; + Array m_ref_map; // reference handling + +public: + virtual void requestInit() { reset();} + virtual void requestShutdown() { reset();} + +private: + sdlPtrVec m_sdls; + std::vector m_typemaps; + std::vector m_encodings; + + sdlPtr get_sdl_impl(const char *uri, long cache_wsdl); + void reset(); +}; + +#define USE_SOAP_GLOBAL SoapData *__sg__ = s_soap_data.get(); +#define SOAP_GLOBAL(name) __sg__->m_##name +extern RequestLocal s_soap_data; + +/////////////////////////////////////////////////////////////////////////////// +// types used by SoapServer + +struct soapFunctions { + Array ft; + Array ftOriginal; + bool functions_all; +}; + +struct soapClass { + String name; + Array argv; + int persistance; +}; + +class soapHeader : public ResourceData { +public: + DECLARE_OBJECT_ALLOCATION(soapHeader); + + // overriding ResourceData + virtual const char *o_getClassName() const { return "soapHeader";} + + sdlFunction *function; + String function_name; + bool mustUnderstand; + Array parameters; + Variant retval; + sdlSoapBindingFunctionHeader *hdr; +}; + +/////////////////////////////////////////////////////////////////////////////// + +class SoapException : public ExtendedException { +public: + SoapException(const char *fmt, ...); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif diff --git a/src/cpp/ext/soap/xml.cpp b/src/cpp/ext/soap/xml.cpp new file mode 100644 index 0000000000000..f324e9149f90f --- /dev/null +++ b/src/cpp/ext/soap/xml.cpp @@ -0,0 +1,295 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static bool is_blank(const xmlChar* str) { + while (*str != '\0') { + if (*str != ' ' && *str != 0x9 && *str != 0xa && *str != 0xd) { + return false; + } + str++; + } + return true; +} + +/* removes all empty text, comments and other insignoficant nodes */ +static void cleanup_xml_node(xmlNodePtr node) { + xmlNodePtr trav; + xmlNodePtr del = NULL; + + trav = node->children; + while (trav != NULL) { + if (del != NULL) { + xmlUnlinkNode(del); + xmlFreeNode(del); + del = NULL; + } + if (trav->type == XML_TEXT_NODE) { + if (is_blank(trav->content)) { + del = trav; + } + } else if ((trav->type != XML_ELEMENT_NODE) && + (trav->type != XML_CDATA_SECTION_NODE)) { + del = trav; + } else if (trav->children != NULL) { + cleanup_xml_node(trav); + } + trav = trav->next; + } + if (del != NULL) { + xmlUnlinkNode(del); + xmlFreeNode(del); + } +} + +static void soap_ignorableWhitespace(void *ctx, const xmlChar *ch, int len) { +} + +static void soap_Comment(void *ctx, const xmlChar *value) { +} + +xmlDocPtr soap_xmlParseFile(const char *filename) { + char *url = strstr(filename, "://"); + if (url) { + xmlDocPtr ret; + xmlParserCtxtPtr ctxt = xmlCreateFileParserCtxt(filename); + if (ctxt) { + ctxt->keepBlanks = 0; + ctxt->sax->ignorableWhitespace = soap_ignorableWhitespace; + ctxt->sax->comment = soap_Comment; + ctxt->sax->warning = NULL; + ctxt->sax->error = NULL; + /*ctxt->sax->fatalError = NULL;*/ + xmlParseDocument(ctxt); + if (ctxt->wellFormed) { + ret = ctxt->myDoc; + if (ret->URL == NULL && ctxt->directory != NULL) { + ret->URL = xmlCharStrdup(ctxt->directory); + } + } else { + ret = NULL; + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = NULL; + } + xmlFreeParserCtxt(ctxt); + } else { + ret = NULL; + } + if (ret) { + cleanup_xml_node((xmlNodePtr)ret); + } + return ret; + } + + Variant content = f_file_get_contents(filename); + if (!same(content, false)) { + String scontent = content.toString(); + return soap_xmlParseMemory(scontent.data(), scontent.size()); + } + return NULL; +} + +xmlDocPtr soap_xmlParseMemory(const void *buf, size_t buf_size) { + xmlParserCtxtPtr ctxt = NULL; + xmlDocPtr ret; + +/* + xmlInitParser(); +*/ + ctxt = xmlCreateMemoryParserCtxt((const char *)buf, buf_size); + if (ctxt) { + ctxt->keepBlanks = 0; + ctxt->sax->ignorableWhitespace = soap_ignorableWhitespace; + ctxt->sax->comment = soap_Comment; + ctxt->sax->warning = NULL; + ctxt->sax->error = NULL; + /*ctxt->sax->fatalError = NULL;*/ + xmlParseDocument(ctxt); + if (ctxt->wellFormed) { + ret = ctxt->myDoc; + if (ret->URL == NULL && ctxt->directory != NULL) { + ret->URL = xmlCharStrdup(ctxt->directory); + } + } else { + ret = NULL; + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = NULL; + } + xmlFreeParserCtxt(ctxt); + } else { + ret = NULL; + } + +/* + xmlCleanupParser(); +*/ + +/* + if (ret) { + cleanup_xml_node((xmlNodePtr)ret); + } +*/ + return ret; +} + +xmlNsPtr attr_find_ns(xmlAttrPtr node) { + if (node->ns) { + return node->ns; + } else if (node->parent->ns) { + return node->parent->ns; + } else { + return xmlSearchNs(node->doc, node->parent, NULL); + } +} + +xmlNsPtr node_find_ns(xmlNodePtr node) { + if (node->ns) { + return node->ns; + } else { + return xmlSearchNs(node->doc, node, NULL); + } +} + +bool attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns) { + if (name == NULL || strcmp((char*)node->name, name) == 0) { + if (ns) { + xmlNsPtr nsPtr = attr_find_ns(node); + if (nsPtr) { + return (strcmp((char*)nsPtr->href, ns) == 0); + } else { + return false; + } + } + return true; + } + return false; +} + +bool node_is_equal_ex(xmlNodePtr node, char *name, char *ns) { + if (name == NULL || strcmp((char*)node->name, name) == 0) { + if (ns) { + xmlNsPtr nsPtr = node_find_ns(node); + if (nsPtr) { + return (strcmp((char*)nsPtr->href, ns) == 0); + } else { + return false; + } + } + return true; + } + return false; +} + + +xmlAttrPtr get_attribute_ex(xmlAttrPtr node, char *name, char *ns) { + while (node!=NULL) { + if (attr_is_equal_ex(node, name, ns)) { + return node; + } + node = node->next; + } + return NULL; +} + +xmlNodePtr get_node_ex(xmlNodePtr node, char *name, char *ns) { + while (node!=NULL) { + if (node_is_equal_ex(node, name, ns)) { + return node; + } + node = node->next; + } + return NULL; +} + +xmlNodePtr get_node_recurisve_ex(xmlNodePtr node, char *name, char *ns) { + while (node != NULL) { + if (node_is_equal_ex(node, name, ns)) { + return node; + } else if (node->children != NULL) { + xmlNodePtr tmp = get_node_recurisve_ex(node->children, name, ns); + if (tmp) { + return tmp; + } + } + node = node->next; + } + return NULL; +} + +xmlNodePtr get_node_with_attribute_ex(xmlNodePtr node, char *name, + char *name_ns, char *attribute, + char *value, char *attr_ns) { + xmlAttrPtr attr; + while (node != NULL) { + if (name != NULL) { + node = get_node_ex(node, name, name_ns); + if (node==NULL) { + return NULL; + } + } + + attr = get_attribute_ex(node->properties, attribute, attr_ns); + if (attr != NULL && strcmp((char*)attr->children->content, value) == 0) { + return node; + } + node = node->next; + } + return NULL; +} + +xmlNodePtr get_node_with_attribute_recursive_ex +(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, + char *attr_ns) { + while (node != NULL) { + if (node_is_equal_ex(node, name, name_ns)) { + xmlAttrPtr attr = get_attribute_ex(node->properties, attribute, attr_ns); + if (attr != NULL && strcmp((char*)attr->children->content, value) == 0) { + return node; + } + } + if (node->children != NULL) { + xmlNodePtr tmp = get_node_with_attribute_recursive_ex + (node->children, name, name_ns, attribute, value, attr_ns); + if (tmp) { + return tmp; + } + } + node = node->next; + } + return NULL; +} + +void parse_namespace(const xmlChar *inval, std::string &value, + std::string &ns) { + char *found = strrchr((char*)inval, ':'); + + if (found && found != (char*)inval) { + ns = std::string((char*)inval, found - (char*)inval); + value = ++found; + } else { + value = (char*)inval; + ns.clear(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/cpp/ext/soap/xml.h b/src/cpp/ext/soap/xml.h new file mode 100644 index 0000000000000..459e905f5ee25 --- /dev/null +++ b/src/cpp/ext/soap/xml.h @@ -0,0 +1,94 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_SOAP_XML_H +#define PHP_SOAP_XML_H + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +typedef std::map xmlDocMap; +typedef std::map xmlNodeMap; + +#define get_attribute(node, name) get_attribute_ex(node, name, NULL) +#define get_node(node, name) get_node_ex(node, name, NULL) +#define get_node_recursive(node, name) get_node_recursive_ex(node, name, NULL) +#define get_node_with_attribute(node, name, attr, val) \ + get_node_with_attribute_ex(node, name, NULL, attr, val, NULL) +#define get_node_with_attribute_recursive(node, name, attr, val) \ + get_node_with_attribute_recursive_ex(node, name, NULL, attr, val, NULL) +#define node_is_equal(node, name) node_is_equal_ex(node, name, NULL) +#define attr_is_equal(node, name) attr_is_equal_ex(node, name, NULL) + +xmlDocPtr soap_xmlParseFile(const char *filename); +xmlDocPtr soap_xmlParseMemory(const void *buf, size_t size); + +xmlNsPtr attr_find_ns(xmlAttrPtr node); +xmlNsPtr node_find_ns(xmlNodePtr node); +bool attr_is_equal_ex(xmlAttrPtr node, char *name, char *ns); +bool node_is_equal_ex(xmlNodePtr node, char *name, char *ns); +xmlAttrPtr get_attribute_ex(xmlAttrPtr node,char *name, char *ns); +xmlNodePtr get_node_ex(xmlNodePtr node,char *name, char *ns); +xmlNodePtr get_node_recursive_ex(xmlNodePtr node,char *name, char *ns); +xmlNodePtr get_node_with_attribute_ex +(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, + char *attr_ns); +xmlNodePtr get_node_with_attribute_recursive_ex +(xmlNodePtr node, char *name, char *name_ns, char *attribute, char *value, + char *attr_ns); +void parse_namespace(const xmlChar *inval, std::string &value, + std::string &ns); + +#define FOREACHATTRNODE(n,c,i) FOREACHATTRNODEEX(n,c,NULL,i) +#define FOREACHATTRNODEEX(n,c,ns,i) \ + do { \ + if (n == NULL) { \ + break; \ + } \ + if (c) { \ + i = get_attribute_ex(n,c,ns); \ + } else { \ + i = n; \ + } \ + if (i != NULL) { \ + n = i; + +#define FOREACHNODE(n,c,i) FOREACHNODEEX(n,c,NULL,i) +#define FOREACHNODEEX(n,c,ns,i) \ + do { \ + if (n == NULL) { \ + break; \ + } \ + if (c) { \ + i = get_node_ex(n,c,NULL); \ + } else { \ + i = n; \ + } \ + if (i != NULL) { \ + n = i; + +#define ENDFOREACH(n) \ + } \ +} while ((n = n->next)); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif diff --git a/src/cpp/ext/unicode_data.h b/src/cpp/ext/unicode_data.h new file mode 100644 index 0000000000000..a799aad9f8c8a --- /dev/null +++ b/src/cpp/ext/unicode_data.h @@ -0,0 +1,2754 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ +/* This file holds unicode properties and case folding information. + * It was generated by a modified version of ucgendat, part of the ucdata-2.5 package */ + +/* {{{ ctype data */ +static unsigned short _ucprop_size = 0x0032; +static unsigned short _ucprop_offsets[] = { +0x0000, 0x00d0, 0x0138, 0x0140, 0x016a, 0x0176, 0x019e, +0x01ac, 0x01ae, 0x01b0, 0x01b4, 0x01cc, 0x01ce, 0xffff, 0x01d8, +0x051e, 0x0866, 0x087a, 0x08a2, 0x0a3a, 0x0a48, 0x0a60, 0x0ae0, +0x0b5c, 0x0be8, 0x0c5c, 0x0c72, 0x0c9e, 0x0d6e, 0x0ff2, 0x100e, +0x1024, 0x1028, 0x1058, 0x105c, 0x1072, 0x107c, 0x1082, 0x1092, +0x1244, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x13ec, +0x16f4, 0x16fe, 0x1706, 0x1730, 0x0000, }; +static unsigned long _ucprop_ranges[] = { +0x00000300, 0x0000034f, 0x00000360, 0x0000036f, +0x00000483, 0x00000486, 0x00000591, 0x000005a1, 0x000005a3, +0x000005b9, 0x000005bb, 0x000005bd, 0x000005bf, 0x000005bf, +0x000005c1, 0x000005c2, 0x000005c4, 0x000005c4, 0x0000064b, +0x00000655, 0x00000670, 0x00000670, 0x000006d6, 0x000006dc, +0x000006df, 0x000006e4, 0x000006e7, 0x000006e8, 0x000006ea, +0x000006ed, 0x00000711, 0x00000711, 0x00000730, 0x0000074a, +0x000007a6, 0x000007b0, 0x00000901, 0x00000902, 0x0000093c, +0x0000093c, 0x00000941, 0x00000948, 0x0000094d, 0x0000094d, +0x00000951, 0x00000954, 0x00000962, 0x00000963, 0x00000981, +0x00000981, 0x000009bc, 0x000009bc, 0x000009c1, 0x000009c4, +0x000009cd, 0x000009cd, 0x000009e2, 0x000009e3, 0x00000a02, +0x00000a02, 0x00000a3c, 0x00000a3c, 0x00000a41, 0x00000a42, +0x00000a47, 0x00000a48, 0x00000a4b, 0x00000a4d, 0x00000a70, +0x00000a71, 0x00000a81, 0x00000a82, 0x00000abc, 0x00000abc, +0x00000ac1, 0x00000ac5, 0x00000ac7, 0x00000ac8, 0x00000acd, +0x00000acd, 0x00000b01, 0x00000b01, 0x00000b3c, 0x00000b3c, +0x00000b3f, 0x00000b3f, 0x00000b41, 0x00000b43, 0x00000b4d, +0x00000b4d, 0x00000b56, 0x00000b56, 0x00000b82, 0x00000b82, +0x00000bc0, 0x00000bc0, 0x00000bcd, 0x00000bcd, 0x00000c3e, +0x00000c40, 0x00000c46, 0x00000c48, 0x00000c4a, 0x00000c4d, +0x00000c55, 0x00000c56, 0x00000cbf, 0x00000cbf, 0x00000cc6, +0x00000cc6, 0x00000ccc, 0x00000ccd, 0x00000d41, 0x00000d43, +0x00000d4d, 0x00000d4d, 0x00000dca, 0x00000dca, 0x00000dd2, +0x00000dd4, 0x00000dd6, 0x00000dd6, 0x00000e31, 0x00000e31, +0x00000e34, 0x00000e3a, 0x00000e47, 0x00000e4e, 0x00000eb1, +0x00000eb1, 0x00000eb4, 0x00000eb9, 0x00000ebb, 0x00000ebc, +0x00000ec8, 0x00000ecd, 0x00000f18, 0x00000f19, 0x00000f35, +0x00000f35, 0x00000f37, 0x00000f37, 0x00000f39, 0x00000f39, +0x00000f71, 0x00000f7e, 0x00000f80, 0x00000f84, 0x00000f86, +0x00000f87, 0x00000f90, 0x00000f97, 0x00000f99, 0x00000fbc, +0x00000fc6, 0x00000fc6, 0x0000102d, 0x00001030, 0x00001032, +0x00001032, 0x00001036, 0x00001037, 0x00001039, 0x00001039, +0x00001058, 0x00001059, 0x00001712, 0x00001714, 0x00001732, +0x00001734, 0x00001752, 0x00001753, 0x00001772, 0x00001773, +0x000017b7, 0x000017bd, 0x000017c6, 0x000017c6, 0x000017c9, +0x000017d3, 0x0000180b, 0x0000180d, 0x000018a9, 0x000018a9, +0x000020d0, 0x000020dc, 0x000020e1, 0x000020e1, 0x000020e5, +0x000020ea, 0x0000302a, 0x0000302f, 0x00003099, 0x0000309a, +0x0000fb1e, 0x0000fb1e, 0x0000fe00, 0x0000fe0f, 0x0000fe20, +0x0000fe23, 0x0001d167, 0x0001d169, 0x0001d17b, 0x0001d182, +0x0001d185, 0x0001d18b, 0x0001d1aa, 0x0001d1ad, +0x00000903, 0x00000903, 0x0000093e, 0x00000940, +0x00000949, 0x0000094c, 0x00000982, 0x00000983, 0x000009be, +0x000009c0, 0x000009c7, 0x000009c8, 0x000009cb, 0x000009cc, +0x000009d7, 0x000009d7, 0x00000a3e, 0x00000a40, 0x00000a83, +0x00000a83, 0x00000abe, 0x00000ac0, 0x00000ac9, 0x00000ac9, +0x00000acb, 0x00000acc, 0x00000b02, 0x00000b03, 0x00000b3e, +0x00000b3e, 0x00000b40, 0x00000b40, 0x00000b47, 0x00000b48, +0x00000b4b, 0x00000b4c, 0x00000b57, 0x00000b57, 0x00000bbe, +0x00000bbf, 0x00000bc1, 0x00000bc2, 0x00000bc6, 0x00000bc8, +0x00000bca, 0x00000bcc, 0x00000bd7, 0x00000bd7, 0x00000c01, +0x00000c03, 0x00000c41, 0x00000c44, 0x00000c82, 0x00000c83, +0x00000cbe, 0x00000cbe, 0x00000cc0, 0x00000cc4, 0x00000cc7, +0x00000cc8, 0x00000cca, 0x00000ccb, 0x00000cd5, 0x00000cd6, +0x00000d02, 0x00000d03, 0x00000d3e, 0x00000d40, 0x00000d46, +0x00000d48, 0x00000d4a, 0x00000d4c, 0x00000d57, 0x00000d57, +0x00000d82, 0x00000d83, 0x00000dcf, 0x00000dd1, 0x00000dd8, +0x00000ddf, 0x00000df2, 0x00000df3, 0x00000f3e, 0x00000f3f, +0x00000f7f, 0x00000f7f, 0x0000102c, 0x0000102c, 0x00001031, +0x00001031, 0x00001038, 0x00001038, 0x00001056, 0x00001057, +0x000017b4, 0x000017b6, 0x000017be, 0x000017c5, 0x000017c7, +0x000017c8, 0x0001d165, 0x0001d166, 0x0001d16d, 0x0001d172, +0x00000488, 0x00000489, 0x000006de, 0x000006de, +0x000020dd, 0x000020e0, 0x000020e2, 0x000020e4, +0x00000030, 0x00000039, 0x00000660, 0x00000669, +0x000006f0, 0x000006f9, 0x00000966, 0x0000096f, 0x000009e6, +0x000009ef, 0x00000a66, 0x00000a6f, 0x00000ae6, 0x00000aef, +0x00000b66, 0x00000b6f, 0x00000be7, 0x00000bef, 0x00000c66, +0x00000c6f, 0x00000ce6, 0x00000cef, 0x00000d66, 0x00000d6f, +0x00000e50, 0x00000e59, 0x00000ed0, 0x00000ed9, 0x00000f20, +0x00000f29, 0x00001040, 0x00001049, 0x00001369, 0x00001371, +0x000017e0, 0x000017e9, 0x00001810, 0x00001819, 0x0000ff10, +0x0000ff19, 0x0001d7ce, 0x0001d7ff, +0x000016ee, 0x000016f0, 0x00002160, 0x00002183, +0x00003007, 0x00003007, 0x00003021, 0x00003029, 0x00003038, +0x0000303a, 0x0001034a, 0x0001034a, +0x000000b2, 0x000000b3, 0x000000b9, 0x000000b9, +0x000000bc, 0x000000be, 0x000009f4, 0x000009f9, 0x00000bf0, +0x00000bf2, 0x00000f2a, 0x00000f33, 0x00001372, 0x0000137c, +0x00002070, 0x00002070, 0x00002074, 0x00002079, 0x00002080, +0x00002089, 0x00002153, 0x0000215f, 0x00002460, 0x0000249b, +0x000024ea, 0x000024fe, 0x00002776, 0x00002793, 0x00003192, +0x00003195, 0x00003220, 0x00003229, 0x00003251, 0x0000325f, +0x00003280, 0x00003289, 0x000032b1, 0x000032bf, 0x00010320, +0x00010323, +0x00000020, 0x00000020, 0x000000a0, 0x000000a0, +0x00001680, 0x00001680, 0x00002000, 0x0000200b, 0x0000202f, +0x0000202f, 0x0000205f, 0x0000205f, 0x00003000, 0x00003000, +0x00002028, 0x00002028, +0x00002029, 0x00002029, +0x00000000, 0x0000001f, 0x0000007f, 0x0000009f, +0x000006dd, 0x000006dd, 0x0000070f, 0x0000070f, +0x0000180e, 0x0000180e, 0x0000200c, 0x0000200f, 0x0000202a, +0x0000202e, 0x00002060, 0x00002063, 0x0000206a, 0x0000206f, +0x0000feff, 0x0000feff, 0x0000fff9, 0x0000fffb, 0x0001d173, +0x0001d17a, 0x000e0001, 0x000e0001, 0x000e0020, 0x000e007f, +0x00010000, 0x0010ffff, +0x0000e000, 0x0000f8ff, 0x000f0000, 0x000f0000, +0x000ffffd, 0x000ffffd, 0x00100000, 0x00100000, 0x0010fffd, +0x0010fffd, +0x00000041, 0x0000005a, 0x000000c0, 0x000000d6, +0x000000d8, 0x000000de, 0x00000100, 0x00000100, 0x00000102, +0x00000102, 0x00000104, 0x00000104, 0x00000106, 0x00000106, +0x00000108, 0x00000108, 0x0000010a, 0x0000010a, 0x0000010c, +0x0000010c, 0x0000010e, 0x0000010e, 0x00000110, 0x00000110, +0x00000112, 0x00000112, 0x00000114, 0x00000114, 0x00000116, +0x00000116, 0x00000118, 0x00000118, 0x0000011a, 0x0000011a, +0x0000011c, 0x0000011c, 0x0000011e, 0x0000011e, 0x00000120, +0x00000120, 0x00000122, 0x00000122, 0x00000124, 0x00000124, +0x00000126, 0x00000126, 0x00000128, 0x00000128, 0x0000012a, +0x0000012a, 0x0000012c, 0x0000012c, 0x0000012e, 0x0000012e, +0x00000130, 0x00000130, 0x00000132, 0x00000132, 0x00000134, +0x00000134, 0x00000136, 0x00000136, 0x00000139, 0x00000139, +0x0000013b, 0x0000013b, 0x0000013d, 0x0000013d, 0x0000013f, +0x0000013f, 0x00000141, 0x00000141, 0x00000143, 0x00000143, +0x00000145, 0x00000145, 0x00000147, 0x00000147, 0x0000014a, +0x0000014a, 0x0000014c, 0x0000014c, 0x0000014e, 0x0000014e, +0x00000150, 0x00000150, 0x00000152, 0x00000152, 0x00000154, +0x00000154, 0x00000156, 0x00000156, 0x00000158, 0x00000158, +0x0000015a, 0x0000015a, 0x0000015c, 0x0000015c, 0x0000015e, +0x0000015e, 0x00000160, 0x00000160, 0x00000162, 0x00000162, +0x00000164, 0x00000164, 0x00000166, 0x00000166, 0x00000168, +0x00000168, 0x0000016a, 0x0000016a, 0x0000016c, 0x0000016c, +0x0000016e, 0x0000016e, 0x00000170, 0x00000170, 0x00000172, +0x00000172, 0x00000174, 0x00000174, 0x00000176, 0x00000176, +0x00000178, 0x00000179, 0x0000017b, 0x0000017b, 0x0000017d, +0x0000017d, 0x00000181, 0x00000182, 0x00000184, 0x00000184, +0x00000186, 0x00000187, 0x00000189, 0x0000018b, 0x0000018e, +0x00000191, 0x00000193, 0x00000194, 0x00000196, 0x00000198, +0x0000019c, 0x0000019d, 0x0000019f, 0x000001a0, 0x000001a2, +0x000001a2, 0x000001a4, 0x000001a4, 0x000001a6, 0x000001a7, +0x000001a9, 0x000001a9, 0x000001ac, 0x000001ac, 0x000001ae, +0x000001af, 0x000001b1, 0x000001b3, 0x000001b5, 0x000001b5, +0x000001b7, 0x000001b8, 0x000001bc, 0x000001bc, 0x000001c4, +0x000001c4, 0x000001c7, 0x000001c7, 0x000001ca, 0x000001ca, +0x000001cd, 0x000001cd, 0x000001cf, 0x000001cf, 0x000001d1, +0x000001d1, 0x000001d3, 0x000001d3, 0x000001d5, 0x000001d5, +0x000001d7, 0x000001d7, 0x000001d9, 0x000001d9, 0x000001db, +0x000001db, 0x000001de, 0x000001de, 0x000001e0, 0x000001e0, +0x000001e2, 0x000001e2, 0x000001e4, 0x000001e4, 0x000001e6, +0x000001e6, 0x000001e8, 0x000001e8, 0x000001ea, 0x000001ea, +0x000001ec, 0x000001ec, 0x000001ee, 0x000001ee, 0x000001f1, +0x000001f1, 0x000001f4, 0x000001f4, 0x000001f6, 0x000001f8, +0x000001fa, 0x000001fa, 0x000001fc, 0x000001fc, 0x000001fe, +0x000001fe, 0x00000200, 0x00000200, 0x00000202, 0x00000202, +0x00000204, 0x00000204, 0x00000206, 0x00000206, 0x00000208, +0x00000208, 0x0000020a, 0x0000020a, 0x0000020c, 0x0000020c, +0x0000020e, 0x0000020e, 0x00000210, 0x00000210, 0x00000212, +0x00000212, 0x00000214, 0x00000214, 0x00000216, 0x00000216, +0x00000218, 0x00000218, 0x0000021a, 0x0000021a, 0x0000021c, +0x0000021c, 0x0000021e, 0x0000021e, 0x00000220, 0x00000220, +0x00000222, 0x00000222, 0x00000224, 0x00000224, 0x00000226, +0x00000226, 0x00000228, 0x00000228, 0x0000022a, 0x0000022a, +0x0000022c, 0x0000022c, 0x0000022e, 0x0000022e, 0x00000230, +0x00000230, 0x00000232, 0x00000232, 0x00000386, 0x00000386, +0x00000388, 0x0000038a, 0x0000038c, 0x0000038c, 0x0000038e, +0x0000038f, 0x00000391, 0x000003a1, 0x000003a3, 0x000003ab, +0x000003d2, 0x000003d4, 0x000003d8, 0x000003d8, 0x000003da, +0x000003da, 0x000003dc, 0x000003dc, 0x000003de, 0x000003de, +0x000003e0, 0x000003e0, 0x000003e2, 0x000003e2, 0x000003e4, +0x000003e4, 0x000003e6, 0x000003e6, 0x000003e8, 0x000003e8, +0x000003ea, 0x000003ea, 0x000003ec, 0x000003ec, 0x000003ee, +0x000003ee, 0x000003f4, 0x000003f4, 0x00000400, 0x0000042f, +0x00000460, 0x00000460, 0x00000462, 0x00000462, 0x00000464, +0x00000464, 0x00000466, 0x00000466, 0x00000468, 0x00000468, +0x0000046a, 0x0000046a, 0x0000046c, 0x0000046c, 0x0000046e, +0x0000046e, 0x00000470, 0x00000470, 0x00000472, 0x00000472, +0x00000474, 0x00000474, 0x00000476, 0x00000476, 0x00000478, +0x00000478, 0x0000047a, 0x0000047a, 0x0000047c, 0x0000047c, +0x0000047e, 0x0000047e, 0x00000480, 0x00000480, 0x0000048a, +0x0000048a, 0x0000048c, 0x0000048c, 0x0000048e, 0x0000048e, +0x00000490, 0x00000490, 0x00000492, 0x00000492, 0x00000494, +0x00000494, 0x00000496, 0x00000496, 0x00000498, 0x00000498, +0x0000049a, 0x0000049a, 0x0000049c, 0x0000049c, 0x0000049e, +0x0000049e, 0x000004a0, 0x000004a0, 0x000004a2, 0x000004a2, +0x000004a4, 0x000004a4, 0x000004a6, 0x000004a6, 0x000004a8, +0x000004a8, 0x000004aa, 0x000004aa, 0x000004ac, 0x000004ac, +0x000004ae, 0x000004ae, 0x000004b0, 0x000004b0, 0x000004b2, +0x000004b2, 0x000004b4, 0x000004b4, 0x000004b6, 0x000004b6, +0x000004b8, 0x000004b8, 0x000004ba, 0x000004ba, 0x000004bc, +0x000004bc, 0x000004be, 0x000004be, 0x000004c0, 0x000004c1, +0x000004c3, 0x000004c3, 0x000004c5, 0x000004c5, 0x000004c7, +0x000004c7, 0x000004c9, 0x000004c9, 0x000004cb, 0x000004cb, +0x000004cd, 0x000004cd, 0x000004d0, 0x000004d0, 0x000004d2, +0x000004d2, 0x000004d4, 0x000004d4, 0x000004d6, 0x000004d6, +0x000004d8, 0x000004d8, 0x000004da, 0x000004da, 0x000004dc, +0x000004dc, 0x000004de, 0x000004de, 0x000004e0, 0x000004e0, +0x000004e2, 0x000004e2, 0x000004e4, 0x000004e4, 0x000004e6, +0x000004e6, 0x000004e8, 0x000004e8, 0x000004ea, 0x000004ea, +0x000004ec, 0x000004ec, 0x000004ee, 0x000004ee, 0x000004f0, +0x000004f0, 0x000004f2, 0x000004f2, 0x000004f4, 0x000004f4, +0x000004f8, 0x000004f8, 0x00000500, 0x00000500, 0x00000502, +0x00000502, 0x00000504, 0x00000504, 0x00000506, 0x00000506, +0x00000508, 0x00000508, 0x0000050a, 0x0000050a, 0x0000050c, +0x0000050c, 0x0000050e, 0x0000050e, 0x00000531, 0x00000556, +0x000010a0, 0x000010c5, 0x00001e00, 0x00001e00, 0x00001e02, +0x00001e02, 0x00001e04, 0x00001e04, 0x00001e06, 0x00001e06, +0x00001e08, 0x00001e08, 0x00001e0a, 0x00001e0a, 0x00001e0c, +0x00001e0c, 0x00001e0e, 0x00001e0e, 0x00001e10, 0x00001e10, +0x00001e12, 0x00001e12, 0x00001e14, 0x00001e14, 0x00001e16, +0x00001e16, 0x00001e18, 0x00001e18, 0x00001e1a, 0x00001e1a, +0x00001e1c, 0x00001e1c, 0x00001e1e, 0x00001e1e, 0x00001e20, +0x00001e20, 0x00001e22, 0x00001e22, 0x00001e24, 0x00001e24, +0x00001e26, 0x00001e26, 0x00001e28, 0x00001e28, 0x00001e2a, +0x00001e2a, 0x00001e2c, 0x00001e2c, 0x00001e2e, 0x00001e2e, +0x00001e30, 0x00001e30, 0x00001e32, 0x00001e32, 0x00001e34, +0x00001e34, 0x00001e36, 0x00001e36, 0x00001e38, 0x00001e38, +0x00001e3a, 0x00001e3a, 0x00001e3c, 0x00001e3c, 0x00001e3e, +0x00001e3e, 0x00001e40, 0x00001e40, 0x00001e42, 0x00001e42, +0x00001e44, 0x00001e44, 0x00001e46, 0x00001e46, 0x00001e48, +0x00001e48, 0x00001e4a, 0x00001e4a, 0x00001e4c, 0x00001e4c, +0x00001e4e, 0x00001e4e, 0x00001e50, 0x00001e50, 0x00001e52, +0x00001e52, 0x00001e54, 0x00001e54, 0x00001e56, 0x00001e56, +0x00001e58, 0x00001e58, 0x00001e5a, 0x00001e5a, 0x00001e5c, +0x00001e5c, 0x00001e5e, 0x00001e5e, 0x00001e60, 0x00001e60, +0x00001e62, 0x00001e62, 0x00001e64, 0x00001e64, 0x00001e66, +0x00001e66, 0x00001e68, 0x00001e68, 0x00001e6a, 0x00001e6a, +0x00001e6c, 0x00001e6c, 0x00001e6e, 0x00001e6e, 0x00001e70, +0x00001e70, 0x00001e72, 0x00001e72, 0x00001e74, 0x00001e74, +0x00001e76, 0x00001e76, 0x00001e78, 0x00001e78, 0x00001e7a, +0x00001e7a, 0x00001e7c, 0x00001e7c, 0x00001e7e, 0x00001e7e, +0x00001e80, 0x00001e80, 0x00001e82, 0x00001e82, 0x00001e84, +0x00001e84, 0x00001e86, 0x00001e86, 0x00001e88, 0x00001e88, +0x00001e8a, 0x00001e8a, 0x00001e8c, 0x00001e8c, 0x00001e8e, +0x00001e8e, 0x00001e90, 0x00001e90, 0x00001e92, 0x00001e92, +0x00001e94, 0x00001e94, 0x00001ea0, 0x00001ea0, 0x00001ea2, +0x00001ea2, 0x00001ea4, 0x00001ea4, 0x00001ea6, 0x00001ea6, +0x00001ea8, 0x00001ea8, 0x00001eaa, 0x00001eaa, 0x00001eac, +0x00001eac, 0x00001eae, 0x00001eae, 0x00001eb0, 0x00001eb0, +0x00001eb2, 0x00001eb2, 0x00001eb4, 0x00001eb4, 0x00001eb6, +0x00001eb6, 0x00001eb8, 0x00001eb8, 0x00001eba, 0x00001eba, +0x00001ebc, 0x00001ebc, 0x00001ebe, 0x00001ebe, 0x00001ec0, +0x00001ec0, 0x00001ec2, 0x00001ec2, 0x00001ec4, 0x00001ec4, +0x00001ec6, 0x00001ec6, 0x00001ec8, 0x00001ec8, 0x00001eca, +0x00001eca, 0x00001ecc, 0x00001ecc, 0x00001ece, 0x00001ece, +0x00001ed0, 0x00001ed0, 0x00001ed2, 0x00001ed2, 0x00001ed4, +0x00001ed4, 0x00001ed6, 0x00001ed6, 0x00001ed8, 0x00001ed8, +0x00001eda, 0x00001eda, 0x00001edc, 0x00001edc, 0x00001ede, +0x00001ede, 0x00001ee0, 0x00001ee0, 0x00001ee2, 0x00001ee2, +0x00001ee4, 0x00001ee4, 0x00001ee6, 0x00001ee6, 0x00001ee8, +0x00001ee8, 0x00001eea, 0x00001eea, 0x00001eec, 0x00001eec, +0x00001eee, 0x00001eee, 0x00001ef0, 0x00001ef0, 0x00001ef2, +0x00001ef2, 0x00001ef4, 0x00001ef4, 0x00001ef6, 0x00001ef6, +0x00001ef8, 0x00001ef8, 0x00001f08, 0x00001f0f, 0x00001f18, +0x00001f1d, 0x00001f28, 0x00001f2f, 0x00001f38, 0x00001f3f, +0x00001f48, 0x00001f4d, 0x00001f59, 0x00001f59, 0x00001f5b, +0x00001f5b, 0x00001f5d, 0x00001f5d, 0x00001f5f, 0x00001f5f, +0x00001f68, 0x00001f6f, 0x00001fb8, 0x00001fbb, 0x00001fc8, +0x00001fcb, 0x00001fd8, 0x00001fdb, 0x00001fe8, 0x00001fec, +0x00001ff8, 0x00001ffb, 0x00002102, 0x00002102, 0x00002107, +0x00002107, 0x0000210b, 0x0000210d, 0x00002110, 0x00002112, +0x00002115, 0x00002115, 0x00002119, 0x0000211d, 0x00002124, +0x00002124, 0x00002126, 0x00002126, 0x00002128, 0x00002128, +0x0000212a, 0x0000212d, 0x00002130, 0x00002131, 0x00002133, +0x00002133, 0x0000213e, 0x0000213f, 0x00002145, 0x00002145, +0x0000ff21, 0x0000ff3a, 0x00010400, 0x00010425, 0x0001d400, +0x0001d419, 0x0001d434, 0x0001d44d, 0x0001d468, 0x0001d481, +0x0001d49c, 0x0001d49c, 0x0001d49e, 0x0001d49f, 0x0001d4a2, +0x0001d4a2, 0x0001d4a5, 0x0001d4a6, 0x0001d4a9, 0x0001d4ac, +0x0001d4ae, 0x0001d4b5, 0x0001d4d0, 0x0001d4e9, 0x0001d504, +0x0001d505, 0x0001d507, 0x0001d50a, 0x0001d50d, 0x0001d514, +0x0001d516, 0x0001d51c, 0x0001d538, 0x0001d539, 0x0001d53b, +0x0001d53e, 0x0001d540, 0x0001d544, 0x0001d546, 0x0001d546, +0x0001d54a, 0x0001d550, 0x0001d56c, 0x0001d585, 0x0001d5a0, +0x0001d5b9, 0x0001d5d4, 0x0001d5ed, 0x0001d608, 0x0001d621, +0x0001d63c, 0x0001d655, 0x0001d670, 0x0001d689, 0x0001d6a8, +0x0001d6c0, 0x0001d6e2, 0x0001d6fa, 0x0001d71c, 0x0001d734, +0x0001d756, 0x0001d76e, 0x0001d790, 0x0001d7a8, +0x00000061, 0x0000007a, 0x000000aa, 0x000000aa, +0x000000b5, 0x000000b5, 0x000000ba, 0x000000ba, 0x000000df, +0x000000f6, 0x000000f8, 0x000000ff, 0x00000101, 0x00000101, +0x00000103, 0x00000103, 0x00000105, 0x00000105, 0x00000107, +0x00000107, 0x00000109, 0x00000109, 0x0000010b, 0x0000010b, +0x0000010d, 0x0000010d, 0x0000010f, 0x0000010f, 0x00000111, +0x00000111, 0x00000113, 0x00000113, 0x00000115, 0x00000115, +0x00000117, 0x00000117, 0x00000119, 0x00000119, 0x0000011b, +0x0000011b, 0x0000011d, 0x0000011d, 0x0000011f, 0x0000011f, +0x00000121, 0x00000121, 0x00000123, 0x00000123, 0x00000125, +0x00000125, 0x00000127, 0x00000127, 0x00000129, 0x00000129, +0x0000012b, 0x0000012b, 0x0000012d, 0x0000012d, 0x0000012f, +0x0000012f, 0x00000131, 0x00000131, 0x00000133, 0x00000133, +0x00000135, 0x00000135, 0x00000137, 0x00000138, 0x0000013a, +0x0000013a, 0x0000013c, 0x0000013c, 0x0000013e, 0x0000013e, +0x00000140, 0x00000140, 0x00000142, 0x00000142, 0x00000144, +0x00000144, 0x00000146, 0x00000146, 0x00000148, 0x00000149, +0x0000014b, 0x0000014b, 0x0000014d, 0x0000014d, 0x0000014f, +0x0000014f, 0x00000151, 0x00000151, 0x00000153, 0x00000153, +0x00000155, 0x00000155, 0x00000157, 0x00000157, 0x00000159, +0x00000159, 0x0000015b, 0x0000015b, 0x0000015d, 0x0000015d, +0x0000015f, 0x0000015f, 0x00000161, 0x00000161, 0x00000163, +0x00000163, 0x00000165, 0x00000165, 0x00000167, 0x00000167, +0x00000169, 0x00000169, 0x0000016b, 0x0000016b, 0x0000016d, +0x0000016d, 0x0000016f, 0x0000016f, 0x00000171, 0x00000171, +0x00000173, 0x00000173, 0x00000175, 0x00000175, 0x00000177, +0x00000177, 0x0000017a, 0x0000017a, 0x0000017c, 0x0000017c, +0x0000017e, 0x00000180, 0x00000183, 0x00000183, 0x00000185, +0x00000185, 0x00000188, 0x00000188, 0x0000018c, 0x0000018d, +0x00000192, 0x00000192, 0x00000195, 0x00000195, 0x00000199, +0x0000019b, 0x0000019e, 0x0000019e, 0x000001a1, 0x000001a1, +0x000001a3, 0x000001a3, 0x000001a5, 0x000001a5, 0x000001a8, +0x000001a8, 0x000001aa, 0x000001ab, 0x000001ad, 0x000001ad, +0x000001b0, 0x000001b0, 0x000001b4, 0x000001b4, 0x000001b6, +0x000001b6, 0x000001b9, 0x000001ba, 0x000001bd, 0x000001bf, +0x000001c6, 0x000001c6, 0x000001c9, 0x000001c9, 0x000001cc, +0x000001cc, 0x000001ce, 0x000001ce, 0x000001d0, 0x000001d0, +0x000001d2, 0x000001d2, 0x000001d4, 0x000001d4, 0x000001d6, +0x000001d6, 0x000001d8, 0x000001d8, 0x000001da, 0x000001da, +0x000001dc, 0x000001dd, 0x000001df, 0x000001df, 0x000001e1, +0x000001e1, 0x000001e3, 0x000001e3, 0x000001e5, 0x000001e5, +0x000001e7, 0x000001e7, 0x000001e9, 0x000001e9, 0x000001eb, +0x000001eb, 0x000001ed, 0x000001ed, 0x000001ef, 0x000001f0, +0x000001f3, 0x000001f3, 0x000001f5, 0x000001f5, 0x000001f9, +0x000001f9, 0x000001fb, 0x000001fb, 0x000001fd, 0x000001fd, +0x000001ff, 0x000001ff, 0x00000201, 0x00000201, 0x00000203, +0x00000203, 0x00000205, 0x00000205, 0x00000207, 0x00000207, +0x00000209, 0x00000209, 0x0000020b, 0x0000020b, 0x0000020d, +0x0000020d, 0x0000020f, 0x0000020f, 0x00000211, 0x00000211, +0x00000213, 0x00000213, 0x00000215, 0x00000215, 0x00000217, +0x00000217, 0x00000219, 0x00000219, 0x0000021b, 0x0000021b, +0x0000021d, 0x0000021d, 0x0000021f, 0x0000021f, 0x00000223, +0x00000223, 0x00000225, 0x00000225, 0x00000227, 0x00000227, +0x00000229, 0x00000229, 0x0000022b, 0x0000022b, 0x0000022d, +0x0000022d, 0x0000022f, 0x0000022f, 0x00000231, 0x00000231, +0x00000233, 0x00000233, 0x00000250, 0x000002ad, 0x00000390, +0x00000390, 0x000003ac, 0x000003ce, 0x000003d0, 0x000003d1, +0x000003d5, 0x000003d7, 0x000003d9, 0x000003d9, 0x000003db, +0x000003db, 0x000003dd, 0x000003dd, 0x000003df, 0x000003df, +0x000003e1, 0x000003e1, 0x000003e3, 0x000003e3, 0x000003e5, +0x000003e5, 0x000003e7, 0x000003e7, 0x000003e9, 0x000003e9, +0x000003eb, 0x000003eb, 0x000003ed, 0x000003ed, 0x000003ef, +0x000003f3, 0x000003f5, 0x000003f5, 0x00000430, 0x0000045f, +0x00000461, 0x00000461, 0x00000463, 0x00000463, 0x00000465, +0x00000465, 0x00000467, 0x00000467, 0x00000469, 0x00000469, +0x0000046b, 0x0000046b, 0x0000046d, 0x0000046d, 0x0000046f, +0x0000046f, 0x00000471, 0x00000471, 0x00000473, 0x00000473, +0x00000475, 0x00000475, 0x00000477, 0x00000477, 0x00000479, +0x00000479, 0x0000047b, 0x0000047b, 0x0000047d, 0x0000047d, +0x0000047f, 0x0000047f, 0x00000481, 0x00000481, 0x0000048b, +0x0000048b, 0x0000048d, 0x0000048d, 0x0000048f, 0x0000048f, +0x00000491, 0x00000491, 0x00000493, 0x00000493, 0x00000495, +0x00000495, 0x00000497, 0x00000497, 0x00000499, 0x00000499, +0x0000049b, 0x0000049b, 0x0000049d, 0x0000049d, 0x0000049f, +0x0000049f, 0x000004a1, 0x000004a1, 0x000004a3, 0x000004a3, +0x000004a5, 0x000004a5, 0x000004a7, 0x000004a7, 0x000004a9, +0x000004a9, 0x000004ab, 0x000004ab, 0x000004ad, 0x000004ad, +0x000004af, 0x000004af, 0x000004b1, 0x000004b1, 0x000004b3, +0x000004b3, 0x000004b5, 0x000004b5, 0x000004b7, 0x000004b7, +0x000004b9, 0x000004b9, 0x000004bb, 0x000004bb, 0x000004bd, +0x000004bd, 0x000004bf, 0x000004bf, 0x000004c2, 0x000004c2, +0x000004c4, 0x000004c4, 0x000004c6, 0x000004c6, 0x000004c8, +0x000004c8, 0x000004ca, 0x000004ca, 0x000004cc, 0x000004cc, +0x000004ce, 0x000004ce, 0x000004d1, 0x000004d1, 0x000004d3, +0x000004d3, 0x000004d5, 0x000004d5, 0x000004d7, 0x000004d7, +0x000004d9, 0x000004d9, 0x000004db, 0x000004db, 0x000004dd, +0x000004dd, 0x000004df, 0x000004df, 0x000004e1, 0x000004e1, +0x000004e3, 0x000004e3, 0x000004e5, 0x000004e5, 0x000004e7, +0x000004e7, 0x000004e9, 0x000004e9, 0x000004eb, 0x000004eb, +0x000004ed, 0x000004ed, 0x000004ef, 0x000004ef, 0x000004f1, +0x000004f1, 0x000004f3, 0x000004f3, 0x000004f5, 0x000004f5, +0x000004f9, 0x000004f9, 0x00000501, 0x00000501, 0x00000503, +0x00000503, 0x00000505, 0x00000505, 0x00000507, 0x00000507, +0x00000509, 0x00000509, 0x0000050b, 0x0000050b, 0x0000050d, +0x0000050d, 0x0000050f, 0x0000050f, 0x00000561, 0x00000587, +0x00001e01, 0x00001e01, 0x00001e03, 0x00001e03, 0x00001e05, +0x00001e05, 0x00001e07, 0x00001e07, 0x00001e09, 0x00001e09, +0x00001e0b, 0x00001e0b, 0x00001e0d, 0x00001e0d, 0x00001e0f, +0x00001e0f, 0x00001e11, 0x00001e11, 0x00001e13, 0x00001e13, +0x00001e15, 0x00001e15, 0x00001e17, 0x00001e17, 0x00001e19, +0x00001e19, 0x00001e1b, 0x00001e1b, 0x00001e1d, 0x00001e1d, +0x00001e1f, 0x00001e1f, 0x00001e21, 0x00001e21, 0x00001e23, +0x00001e23, 0x00001e25, 0x00001e25, 0x00001e27, 0x00001e27, +0x00001e29, 0x00001e29, 0x00001e2b, 0x00001e2b, 0x00001e2d, +0x00001e2d, 0x00001e2f, 0x00001e2f, 0x00001e31, 0x00001e31, +0x00001e33, 0x00001e33, 0x00001e35, 0x00001e35, 0x00001e37, +0x00001e37, 0x00001e39, 0x00001e39, 0x00001e3b, 0x00001e3b, +0x00001e3d, 0x00001e3d, 0x00001e3f, 0x00001e3f, 0x00001e41, +0x00001e41, 0x00001e43, 0x00001e43, 0x00001e45, 0x00001e45, +0x00001e47, 0x00001e47, 0x00001e49, 0x00001e49, 0x00001e4b, +0x00001e4b, 0x00001e4d, 0x00001e4d, 0x00001e4f, 0x00001e4f, +0x00001e51, 0x00001e51, 0x00001e53, 0x00001e53, 0x00001e55, +0x00001e55, 0x00001e57, 0x00001e57, 0x00001e59, 0x00001e59, +0x00001e5b, 0x00001e5b, 0x00001e5d, 0x00001e5d, 0x00001e5f, +0x00001e5f, 0x00001e61, 0x00001e61, 0x00001e63, 0x00001e63, +0x00001e65, 0x00001e65, 0x00001e67, 0x00001e67, 0x00001e69, +0x00001e69, 0x00001e6b, 0x00001e6b, 0x00001e6d, 0x00001e6d, +0x00001e6f, 0x00001e6f, 0x00001e71, 0x00001e71, 0x00001e73, +0x00001e73, 0x00001e75, 0x00001e75, 0x00001e77, 0x00001e77, +0x00001e79, 0x00001e79, 0x00001e7b, 0x00001e7b, 0x00001e7d, +0x00001e7d, 0x00001e7f, 0x00001e7f, 0x00001e81, 0x00001e81, +0x00001e83, 0x00001e83, 0x00001e85, 0x00001e85, 0x00001e87, +0x00001e87, 0x00001e89, 0x00001e89, 0x00001e8b, 0x00001e8b, +0x00001e8d, 0x00001e8d, 0x00001e8f, 0x00001e8f, 0x00001e91, +0x00001e91, 0x00001e93, 0x00001e93, 0x00001e95, 0x00001e9b, +0x00001ea1, 0x00001ea1, 0x00001ea3, 0x00001ea3, 0x00001ea5, +0x00001ea5, 0x00001ea7, 0x00001ea7, 0x00001ea9, 0x00001ea9, +0x00001eab, 0x00001eab, 0x00001ead, 0x00001ead, 0x00001eaf, +0x00001eaf, 0x00001eb1, 0x00001eb1, 0x00001eb3, 0x00001eb3, +0x00001eb5, 0x00001eb5, 0x00001eb7, 0x00001eb7, 0x00001eb9, +0x00001eb9, 0x00001ebb, 0x00001ebb, 0x00001ebd, 0x00001ebd, +0x00001ebf, 0x00001ebf, 0x00001ec1, 0x00001ec1, 0x00001ec3, +0x00001ec3, 0x00001ec5, 0x00001ec5, 0x00001ec7, 0x00001ec7, +0x00001ec9, 0x00001ec9, 0x00001ecb, 0x00001ecb, 0x00001ecd, +0x00001ecd, 0x00001ecf, 0x00001ecf, 0x00001ed1, 0x00001ed1, +0x00001ed3, 0x00001ed3, 0x00001ed5, 0x00001ed5, 0x00001ed7, +0x00001ed7, 0x00001ed9, 0x00001ed9, 0x00001edb, 0x00001edb, +0x00001edd, 0x00001edd, 0x00001edf, 0x00001edf, 0x00001ee1, +0x00001ee1, 0x00001ee3, 0x00001ee3, 0x00001ee5, 0x00001ee5, +0x00001ee7, 0x00001ee7, 0x00001ee9, 0x00001ee9, 0x00001eeb, +0x00001eeb, 0x00001eed, 0x00001eed, 0x00001eef, 0x00001eef, +0x00001ef1, 0x00001ef1, 0x00001ef3, 0x00001ef3, 0x00001ef5, +0x00001ef5, 0x00001ef7, 0x00001ef7, 0x00001ef9, 0x00001ef9, +0x00001f00, 0x00001f07, 0x00001f10, 0x00001f15, 0x00001f20, +0x00001f27, 0x00001f30, 0x00001f37, 0x00001f40, 0x00001f45, +0x00001f50, 0x00001f57, 0x00001f60, 0x00001f67, 0x00001f70, +0x00001f7d, 0x00001f80, 0x00001f87, 0x00001f90, 0x00001f97, +0x00001fa0, 0x00001fa7, 0x00001fb0, 0x00001fb4, 0x00001fb6, +0x00001fb7, 0x00001fbe, 0x00001fbe, 0x00001fc2, 0x00001fc4, +0x00001fc6, 0x00001fc7, 0x00001fd0, 0x00001fd3, 0x00001fd6, +0x00001fd7, 0x00001fe0, 0x00001fe7, 0x00001ff2, 0x00001ff4, +0x00001ff6, 0x00001ff7, 0x00002071, 0x00002071, 0x0000207f, +0x0000207f, 0x0000210a, 0x0000210a, 0x0000210e, 0x0000210f, +0x00002113, 0x00002113, 0x0000212f, 0x0000212f, 0x00002134, +0x00002134, 0x00002139, 0x00002139, 0x0000213d, 0x0000213d, +0x00002146, 0x00002149, 0x0000fb00, 0x0000fb06, 0x0000fb13, +0x0000fb17, 0x0000ff41, 0x0000ff5a, 0x00010428, 0x0001044d, +0x0001d41a, 0x0001d433, 0x0001d44e, 0x0001d454, 0x0001d456, +0x0001d467, 0x0001d482, 0x0001d49b, 0x0001d4b6, 0x0001d4b9, +0x0001d4bb, 0x0001d4bb, 0x0001d4bd, 0x0001d4c0, 0x0001d4c2, +0x0001d4c3, 0x0001d4c5, 0x0001d4cf, 0x0001d4ea, 0x0001d503, +0x0001d51e, 0x0001d537, 0x0001d552, 0x0001d56b, 0x0001d586, +0x0001d59f, 0x0001d5ba, 0x0001d5d3, 0x0001d5ee, 0x0001d607, +0x0001d622, 0x0001d63b, 0x0001d656, 0x0001d66f, 0x0001d68a, +0x0001d6a3, 0x0001d6c2, 0x0001d6da, 0x0001d6dc, 0x0001d6e1, +0x0001d6fc, 0x0001d714, 0x0001d716, 0x0001d71b, 0x0001d736, +0x0001d74e, 0x0001d750, 0x0001d755, 0x0001d770, 0x0001d788, +0x0001d78a, 0x0001d78f, 0x0001d7aa, 0x0001d7c2, 0x0001d7c4, +0x0001d7c9, +0x000001c5, 0x000001c5, 0x000001c8, 0x000001c8, +0x000001cb, 0x000001cb, 0x000001f2, 0x000001f2, 0x00001f88, +0x00001f8f, 0x00001f98, 0x00001f9f, 0x00001fa8, 0x00001faf, +0x00001fbc, 0x00001fbc, 0x00001fcc, 0x00001fcc, 0x00001ffc, +0x00001ffc, +0x000002b0, 0x000002b8, 0x000002bb, 0x000002c1, +0x000002d0, 0x000002d1, 0x000002e0, 0x000002e4, 0x000002ee, +0x000002ee, 0x0000037a, 0x0000037a, 0x00000559, 0x00000559, +0x00000640, 0x00000640, 0x000006e5, 0x000006e6, 0x00000e46, +0x00000e46, 0x00000ec6, 0x00000ec6, 0x000017d7, 0x000017d7, +0x00001843, 0x00001843, 0x00003005, 0x00003005, 0x00003031, +0x00003035, 0x0000303b, 0x0000303b, 0x0000309d, 0x0000309e, +0x000030fc, 0x000030fe, 0x0000ff70, 0x0000ff70, 0x0000ff9e, +0x0000ff9f, +0x000001bb, 0x000001bb, 0x000001c0, 0x000001c3, +0x000005d0, 0x000005ea, 0x000005f0, 0x000005f2, 0x00000621, +0x0000063a, 0x00000641, 0x0000064a, 0x0000066e, 0x0000066f, +0x00000671, 0x000006d3, 0x000006d5, 0x000006d5, 0x000006fa, +0x000006fc, 0x00000710, 0x00000710, 0x00000712, 0x0000072c, +0x00000780, 0x000007a5, 0x000007b1, 0x000007b1, 0x00000905, +0x00000939, 0x0000093d, 0x0000093d, 0x00000950, 0x00000950, +0x00000958, 0x00000961, 0x00000985, 0x0000098c, 0x0000098f, +0x00000990, 0x00000993, 0x000009a8, 0x000009aa, 0x000009b0, +0x000009b2, 0x000009b2, 0x000009b6, 0x000009b9, 0x000009dc, +0x000009dd, 0x000009df, 0x000009e1, 0x000009f0, 0x000009f1, +0x00000a05, 0x00000a0a, 0x00000a0f, 0x00000a10, 0x00000a13, +0x00000a28, 0x00000a2a, 0x00000a30, 0x00000a32, 0x00000a33, +0x00000a35, 0x00000a36, 0x00000a38, 0x00000a39, 0x00000a59, +0x00000a5c, 0x00000a5e, 0x00000a5e, 0x00000a72, 0x00000a74, +0x00000a85, 0x00000a8b, 0x00000a8d, 0x00000a8d, 0x00000a8f, +0x00000a91, 0x00000a93, 0x00000aa8, 0x00000aaa, 0x00000ab0, +0x00000ab2, 0x00000ab3, 0x00000ab5, 0x00000ab9, 0x00000abd, +0x00000abd, 0x00000ad0, 0x00000ad0, 0x00000ae0, 0x00000ae0, +0x00000b05, 0x00000b0c, 0x00000b0f, 0x00000b10, 0x00000b13, +0x00000b28, 0x00000b2a, 0x00000b30, 0x00000b32, 0x00000b33, +0x00000b36, 0x00000b39, 0x00000b3d, 0x00000b3d, 0x00000b5c, +0x00000b5d, 0x00000b5f, 0x00000b61, 0x00000b83, 0x00000b83, +0x00000b85, 0x00000b8a, 0x00000b8e, 0x00000b90, 0x00000b92, +0x00000b95, 0x00000b99, 0x00000b9a, 0x00000b9c, 0x00000b9c, +0x00000b9e, 0x00000b9f, 0x00000ba3, 0x00000ba4, 0x00000ba8, +0x00000baa, 0x00000bae, 0x00000bb5, 0x00000bb7, 0x00000bb9, +0x00000c05, 0x00000c0c, 0x00000c0e, 0x00000c10, 0x00000c12, +0x00000c28, 0x00000c2a, 0x00000c33, 0x00000c35, 0x00000c39, +0x00000c60, 0x00000c61, 0x00000c85, 0x00000c8c, 0x00000c8e, +0x00000c90, 0x00000c92, 0x00000ca8, 0x00000caa, 0x00000cb3, +0x00000cb5, 0x00000cb9, 0x00000cde, 0x00000cde, 0x00000ce0, +0x00000ce1, 0x00000d05, 0x00000d0c, 0x00000d0e, 0x00000d10, +0x00000d12, 0x00000d28, 0x00000d2a, 0x00000d39, 0x00000d60, +0x00000d61, 0x00000d85, 0x00000d96, 0x00000d9a, 0x00000db1, +0x00000db3, 0x00000dbb, 0x00000dbd, 0x00000dbd, 0x00000dc0, +0x00000dc6, 0x00000e01, 0x00000e30, 0x00000e32, 0x00000e33, +0x00000e40, 0x00000e45, 0x00000e81, 0x00000e82, 0x00000e84, +0x00000e84, 0x00000e87, 0x00000e88, 0x00000e8a, 0x00000e8a, +0x00000e8d, 0x00000e8d, 0x00000e94, 0x00000e97, 0x00000e99, +0x00000e9f, 0x00000ea1, 0x00000ea3, 0x00000ea5, 0x00000ea5, +0x00000ea7, 0x00000ea7, 0x00000eaa, 0x00000eab, 0x00000ead, +0x00000eb0, 0x00000eb2, 0x00000eb3, 0x00000ebd, 0x00000ebd, +0x00000ec0, 0x00000ec4, 0x00000edc, 0x00000edd, 0x00000f00, +0x00000f00, 0x00000f40, 0x00000f47, 0x00000f49, 0x00000f6a, +0x00000f88, 0x00000f8b, 0x00001000, 0x00001021, 0x00001023, +0x00001027, 0x00001029, 0x0000102a, 0x00001050, 0x00001055, +0x000010d0, 0x000010f8, 0x00001100, 0x00001159, 0x0000115f, +0x000011a2, 0x000011a8, 0x000011f9, 0x00001200, 0x00001206, +0x00001208, 0x00001246, 0x00001248, 0x00001248, 0x0000124a, +0x0000124d, 0x00001250, 0x00001256, 0x00001258, 0x00001258, +0x0000125a, 0x0000125d, 0x00001260, 0x00001286, 0x00001288, +0x00001288, 0x0000128a, 0x0000128d, 0x00001290, 0x000012ae, +0x000012b0, 0x000012b0, 0x000012b2, 0x000012b5, 0x000012b8, +0x000012be, 0x000012c0, 0x000012c0, 0x000012c2, 0x000012c5, +0x000012c8, 0x000012ce, 0x000012d0, 0x000012d6, 0x000012d8, +0x000012ee, 0x000012f0, 0x0000130e, 0x00001310, 0x00001310, +0x00001312, 0x00001315, 0x00001318, 0x0000131e, 0x00001320, +0x00001346, 0x00001348, 0x0000135a, 0x000013a0, 0x000013f4, +0x00001401, 0x0000166c, 0x0000166f, 0x00001676, 0x00001681, +0x0000169a, 0x000016a0, 0x000016ea, 0x00001700, 0x0000170c, +0x0000170e, 0x00001711, 0x00001720, 0x00001731, 0x00001740, +0x00001751, 0x00001760, 0x0000176c, 0x0000176e, 0x00001770, +0x00001780, 0x000017b3, 0x000017dc, 0x000017dc, 0x00001820, +0x00001842, 0x00001844, 0x00001877, 0x00001880, 0x000018a8, +0x00002135, 0x00002138, 0x00003006, 0x00003006, 0x0000303c, +0x0000303c, 0x00003041, 0x00003096, 0x0000309f, 0x0000309f, +0x000030a1, 0x000030fa, 0x000030ff, 0x000030ff, 0x00003105, +0x0000312c, 0x00003131, 0x0000318e, 0x000031a0, 0x000031b7, +0x000031f0, 0x000031ff, 0x00003400, 0x00003400, 0x00004db5, +0x00004db5, 0x00004e00, 0x0000a48c, 0x0000ac00, 0x0000d7a3, +0x0000f900, 0x0000faff, 0x0000fb1d, 0x0000fb1d, 0x0000fb1f, +0x0000fb28, 0x0000fb2a, 0x0000fb36, 0x0000fb38, 0x0000fb3c, +0x0000fb3e, 0x0000fb3e, 0x0000fb40, 0x0000fb41, 0x0000fb43, +0x0000fb44, 0x0000fb46, 0x0000fbb1, 0x0000fbd3, 0x0000fd3d, +0x0000fd50, 0x0000fd8f, 0x0000fd92, 0x0000fdc7, 0x0000fdf0, +0x0000fdfb, 0x0000fe70, 0x0000fe74, 0x0000fe76, 0x0000fefc, +0x0000ff66, 0x0000ff6f, 0x0000ff71, 0x0000ff9d, 0x0000ffa0, +0x0000ffbe, 0x0000ffc2, 0x0000ffc7, 0x0000ffca, 0x0000ffcf, +0x0000ffd2, 0x0000ffd7, 0x0000ffda, 0x0000ffdc, 0x00010300, +0x0001031e, 0x00010330, 0x00010349, 0x00020000, 0x00020000, +0x0002a6d6, 0x0002a6d6, 0x0002f800, 0x0002fa1d, +0x0000005f, 0x0000005f, 0x0000203f, 0x00002040, +0x000030fb, 0x000030fb, 0x0000fe33, 0x0000fe34, 0x0000fe4d, +0x0000fe4f, 0x0000ff3f, 0x0000ff3f, 0x0000ff65, 0x0000ff65, +0x0000002d, 0x0000002d, 0x000000ad, 0x000000ad, +0x0000058a, 0x0000058a, 0x00001806, 0x00001806, 0x00002010, +0x00002015, 0x0000301c, 0x0000301c, 0x00003030, 0x00003030, +0x000030a0, 0x000030a0, 0x0000fe31, 0x0000fe32, 0x0000fe58, +0x0000fe58, 0x0000fe63, 0x0000fe63, 0x0000ff0d, 0x0000ff0d, +0x00000028, 0x00000028, 0x0000005b, 0x0000005b, +0x0000007b, 0x0000007b, 0x00000f3a, 0x00000f3a, 0x00000f3c, +0x00000f3c, 0x0000169b, 0x0000169b, 0x0000201a, 0x0000201a, +0x0000201e, 0x0000201e, 0x00002045, 0x00002045, 0x0000207d, +0x0000207d, 0x0000208d, 0x0000208d, 0x00002329, 0x00002329, +0x000023b4, 0x000023b4, 0x00002768, 0x00002768, 0x0000276a, +0x0000276a, 0x0000276c, 0x0000276c, 0x0000276e, 0x0000276e, +0x00002770, 0x00002770, 0x00002772, 0x00002772, 0x00002774, +0x00002774, 0x000027e6, 0x000027e6, 0x000027e8, 0x000027e8, +0x000027ea, 0x000027ea, 0x00002983, 0x00002983, 0x00002985, +0x00002985, 0x00002987, 0x00002987, 0x00002989, 0x00002989, +0x0000298b, 0x0000298b, 0x0000298d, 0x0000298d, 0x0000298f, +0x0000298f, 0x00002991, 0x00002991, 0x00002993, 0x00002993, +0x00002995, 0x00002995, 0x00002997, 0x00002997, 0x000029d8, +0x000029d8, 0x000029da, 0x000029da, 0x000029fc, 0x000029fc, +0x00003008, 0x00003008, 0x0000300a, 0x0000300a, 0x0000300c, +0x0000300c, 0x0000300e, 0x0000300e, 0x00003010, 0x00003010, +0x00003014, 0x00003014, 0x00003016, 0x00003016, 0x00003018, +0x00003018, 0x0000301a, 0x0000301a, 0x0000301d, 0x0000301d, +0x0000fd3e, 0x0000fd3e, 0x0000fe35, 0x0000fe35, 0x0000fe37, +0x0000fe37, 0x0000fe39, 0x0000fe39, 0x0000fe3b, 0x0000fe3b, +0x0000fe3d, 0x0000fe3d, 0x0000fe3f, 0x0000fe3f, 0x0000fe41, +0x0000fe41, 0x0000fe43, 0x0000fe43, 0x0000fe59, 0x0000fe59, +0x0000fe5b, 0x0000fe5b, 0x0000fe5d, 0x0000fe5d, 0x0000ff08, +0x0000ff08, 0x0000ff3b, 0x0000ff3b, 0x0000ff5b, 0x0000ff5b, +0x0000ff5f, 0x0000ff5f, 0x0000ff62, 0x0000ff62, +0x00000029, 0x00000029, 0x0000005d, 0x0000005d, +0x0000007d, 0x0000007d, 0x00000f3b, 0x00000f3b, 0x00000f3d, +0x00000f3d, 0x0000169c, 0x0000169c, 0x00002046, 0x00002046, +0x0000207e, 0x0000207e, 0x0000208e, 0x0000208e, 0x0000232a, +0x0000232a, 0x000023b5, 0x000023b5, 0x00002769, 0x00002769, +0x0000276b, 0x0000276b, 0x0000276d, 0x0000276d, 0x0000276f, +0x0000276f, 0x00002771, 0x00002771, 0x00002773, 0x00002773, +0x00002775, 0x00002775, 0x000027e7, 0x000027e7, 0x000027e9, +0x000027e9, 0x000027eb, 0x000027eb, 0x00002984, 0x00002984, +0x00002986, 0x00002986, 0x00002988, 0x00002988, 0x0000298a, +0x0000298a, 0x0000298c, 0x0000298c, 0x0000298e, 0x0000298e, +0x00002990, 0x00002990, 0x00002992, 0x00002992, 0x00002994, +0x00002994, 0x00002996, 0x00002996, 0x00002998, 0x00002998, +0x000029d9, 0x000029d9, 0x000029db, 0x000029db, 0x000029fd, +0x000029fd, 0x00003009, 0x00003009, 0x0000300b, 0x0000300b, +0x0000300d, 0x0000300d, 0x0000300f, 0x0000300f, 0x00003011, +0x00003011, 0x00003015, 0x00003015, 0x00003017, 0x00003017, +0x00003019, 0x00003019, 0x0000301b, 0x0000301b, 0x0000301e, +0x0000301f, 0x0000fd3f, 0x0000fd3f, 0x0000fe36, 0x0000fe36, +0x0000fe38, 0x0000fe38, 0x0000fe3a, 0x0000fe3a, 0x0000fe3c, +0x0000fe3c, 0x0000fe3e, 0x0000fe3e, 0x0000fe40, 0x0000fe40, +0x0000fe42, 0x0000fe42, 0x0000fe44, 0x0000fe44, 0x0000fe5a, +0x0000fe5a, 0x0000fe5c, 0x0000fe5c, 0x0000fe5e, 0x0000fe5e, +0x0000ff09, 0x0000ff09, 0x0000ff3d, 0x0000ff3d, 0x0000ff5d, +0x0000ff5d, 0x0000ff60, 0x0000ff60, 0x0000ff63, 0x0000ff63, +0x00000021, 0x00000023, 0x00000025, 0x00000027, +0x0000002a, 0x0000002a, 0x0000002c, 0x0000002c, 0x0000002e, +0x0000002f, 0x0000003a, 0x0000003b, 0x0000003f, 0x00000040, +0x0000005c, 0x0000005c, 0x000000a1, 0x000000a1, 0x000000b7, +0x000000b7, 0x000000bf, 0x000000bf, 0x0000037e, 0x0000037e, +0x00000387, 0x00000387, 0x0000055a, 0x0000055f, 0x00000589, +0x00000589, 0x000005be, 0x000005be, 0x000005c0, 0x000005c0, +0x000005c3, 0x000005c3, 0x000005f3, 0x000005f4, 0x0000060c, +0x0000060c, 0x0000061b, 0x0000061b, 0x0000061f, 0x0000061f, +0x0000066a, 0x0000066d, 0x000006d4, 0x000006d4, 0x00000700, +0x0000070d, 0x00000964, 0x00000965, 0x00000970, 0x00000970, +0x00000df4, 0x00000df4, 0x00000e4f, 0x00000e4f, 0x00000e5a, +0x00000e5b, 0x00000f04, 0x00000f12, 0x00000f85, 0x00000f85, +0x0000104a, 0x0000104f, 0x000010fb, 0x000010fb, 0x00001361, +0x00001368, 0x0000166d, 0x0000166e, 0x000016eb, 0x000016ed, +0x00001735, 0x00001736, 0x000017d4, 0x000017d6, 0x000017d8, +0x000017da, 0x00001800, 0x00001805, 0x00001807, 0x0000180a, +0x00002016, 0x00002017, 0x00002020, 0x00002027, 0x00002030, +0x00002038, 0x0000203b, 0x0000203e, 0x00002041, 0x00002043, +0x00002047, 0x00002051, 0x00002057, 0x00002057, 0x000023b6, +0x000023b6, 0x00003001, 0x00003003, 0x0000303d, 0x0000303d, +0x0000fe30, 0x0000fe30, 0x0000fe45, 0x0000fe46, 0x0000fe49, +0x0000fe4c, 0x0000fe50, 0x0000fe52, 0x0000fe54, 0x0000fe57, +0x0000fe5f, 0x0000fe61, 0x0000fe68, 0x0000fe68, 0x0000fe6a, +0x0000fe6b, 0x0000ff01, 0x0000ff03, 0x0000ff05, 0x0000ff07, +0x0000ff0a, 0x0000ff0a, 0x0000ff0c, 0x0000ff0c, 0x0000ff0e, +0x0000ff0f, 0x0000ff1a, 0x0000ff1b, 0x0000ff1f, 0x0000ff20, +0x0000ff3c, 0x0000ff3c, 0x0000ff61, 0x0000ff61, 0x0000ff64, +0x0000ff64, +0x0000002b, 0x0000002b, 0x0000003c, 0x0000003e, +0x0000007c, 0x0000007c, 0x0000007e, 0x0000007e, 0x000000ac, +0x000000ac, 0x000000b1, 0x000000b1, 0x000000d7, 0x000000d7, +0x000000f7, 0x000000f7, 0x000003f6, 0x000003f6, 0x00002044, +0x00002044, 0x00002052, 0x00002052, 0x0000207a, 0x0000207c, +0x0000208a, 0x0000208c, 0x00002140, 0x00002144, 0x0000214b, +0x0000214b, 0x00002190, 0x00002194, 0x0000219a, 0x0000219b, +0x000021a0, 0x000021a0, 0x000021a3, 0x000021a3, 0x000021a6, +0x000021a6, 0x000021ae, 0x000021ae, 0x000021ce, 0x000021cf, +0x000021d2, 0x000021d2, 0x000021d4, 0x000021d4, 0x000021f4, +0x000022ff, 0x00002308, 0x0000230b, 0x00002320, 0x00002321, +0x0000237c, 0x0000237c, 0x0000239b, 0x000023b3, 0x000025b7, +0x000025b7, 0x000025c1, 0x000025c1, 0x000025f8, 0x000025ff, +0x0000266f, 0x0000266f, 0x000027d0, 0x000027e5, 0x000027f0, +0x000027ff, 0x00002900, 0x00002982, 0x00002999, 0x000029d7, +0x000029dc, 0x000029fb, 0x000029fe, 0x00002aff, 0x0000fb29, +0x0000fb29, 0x0000fe62, 0x0000fe62, 0x0000fe64, 0x0000fe66, +0x0000ff0b, 0x0000ff0b, 0x0000ff1c, 0x0000ff1e, 0x0000ff5c, +0x0000ff5c, 0x0000ff5e, 0x0000ff5e, 0x0000ffe2, 0x0000ffe2, +0x0000ffe9, 0x0000ffec, 0x0001d6c1, 0x0001d6c1, 0x0001d6db, +0x0001d6db, 0x0001d6fb, 0x0001d6fb, 0x0001d715, 0x0001d715, +0x0001d735, 0x0001d735, 0x0001d74f, 0x0001d74f, 0x0001d76f, +0x0001d76f, 0x0001d789, 0x0001d789, 0x0001d7a9, 0x0001d7a9, +0x0001d7c3, 0x0001d7c3, +0x00000024, 0x00000024, 0x000000a2, 0x000000a5, +0x000009f2, 0x000009f3, 0x00000e3f, 0x00000e3f, 0x000017db, +0x000017db, 0x000020a0, 0x000020b1, 0x0000fdfc, 0x0000fdfc, +0x0000fe69, 0x0000fe69, 0x0000ff04, 0x0000ff04, 0x0000ffe0, +0x0000ffe1, 0x0000ffe5, 0x0000ffe6, +0x0000005e, 0x0000005e, 0x00000060, 0x00000060, +0x000000a8, 0x000000a8, 0x000000af, 0x000000af, 0x000000b4, +0x000000b4, 0x000000b8, 0x000000b8, 0x000002b9, 0x000002ba, +0x000002c2, 0x000002cf, 0x000002d2, 0x000002df, 0x000002e5, +0x000002ed, 0x00000374, 0x00000375, 0x00000384, 0x00000385, +0x00001fbd, 0x00001fbd, 0x00001fbf, 0x00001fc1, 0x00001fcd, +0x00001fcf, 0x00001fdd, 0x00001fdf, 0x00001fed, 0x00001fef, +0x00001ffd, 0x00001ffe, 0x0000309b, 0x0000309c, 0x0000ff3e, +0x0000ff3e, 0x0000ff40, 0x0000ff40, 0x0000ffe3, 0x0000ffe3, +0x000000a6, 0x000000a7, 0x000000a9, 0x000000a9, +0x000000ae, 0x000000ae, 0x000000b0, 0x000000b0, 0x000000b6, +0x000000b6, 0x00000482, 0x00000482, 0x000006e9, 0x000006e9, +0x000006fd, 0x000006fe, 0x000009fa, 0x000009fa, 0x00000b70, +0x00000b70, 0x00000f01, 0x00000f03, 0x00000f13, 0x00000f17, +0x00000f1a, 0x00000f1f, 0x00000f34, 0x00000f34, 0x00000f36, +0x00000f36, 0x00000f38, 0x00000f38, 0x00000fbe, 0x00000fc5, +0x00000fc7, 0x00000fcc, 0x00000fcf, 0x00000fcf, 0x00002100, +0x00002101, 0x00002103, 0x00002106, 0x00002108, 0x00002109, +0x00002114, 0x00002114, 0x00002116, 0x00002118, 0x0000211e, +0x00002123, 0x00002125, 0x00002125, 0x00002127, 0x00002127, +0x00002129, 0x00002129, 0x0000212e, 0x0000212e, 0x00002132, +0x00002132, 0x0000213a, 0x0000213a, 0x0000214a, 0x0000214a, +0x00002195, 0x00002199, 0x0000219c, 0x0000219f, 0x000021a1, +0x000021a2, 0x000021a4, 0x000021a5, 0x000021a7, 0x000021ad, +0x000021af, 0x000021cd, 0x000021d0, 0x000021d1, 0x000021d3, +0x000021d3, 0x000021d5, 0x000021f3, 0x00002300, 0x00002307, +0x0000230c, 0x0000231f, 0x00002322, 0x00002328, 0x0000232b, +0x0000237b, 0x0000237d, 0x0000239a, 0x000023b7, 0x000023ce, +0x00002400, 0x00002426, 0x00002440, 0x0000244a, 0x0000249c, +0x000024e9, 0x00002500, 0x000025b6, 0x000025b8, 0x000025c0, +0x000025c2, 0x000025f7, 0x00002600, 0x00002613, 0x00002616, +0x00002617, 0x00002619, 0x0000266e, 0x00002670, 0x0000267d, +0x00002680, 0x00002689, 0x00002701, 0x00002704, 0x00002706, +0x00002709, 0x0000270c, 0x00002727, 0x00002729, 0x0000274b, +0x0000274d, 0x0000274d, 0x0000274f, 0x00002752, 0x00002756, +0x00002756, 0x00002758, 0x0000275e, 0x00002761, 0x00002767, +0x00002794, 0x00002794, 0x00002798, 0x000027af, 0x000027b1, +0x000027be, 0x00002800, 0x000028ff, 0x00002e80, 0x00002e99, +0x00002e9b, 0x00002ef3, 0x00002f00, 0x00002fd5, 0x00002ff0, +0x00002ffb, 0x00003004, 0x00003004, 0x00003012, 0x00003013, +0x00003020, 0x00003020, 0x00003036, 0x00003037, 0x0000303e, +0x0000303f, 0x00003190, 0x00003191, 0x00003196, 0x0000319f, +0x00003200, 0x0000321c, 0x0000322a, 0x00003243, 0x00003260, +0x0000327b, 0x0000327f, 0x0000327f, 0x0000328a, 0x000032b0, +0x000032c0, 0x000032cb, 0x000032d0, 0x000032fe, 0x00003300, +0x00003376, 0x0000337b, 0x000033dd, 0x000033e0, 0x000033fe, +0x0000a490, 0x0000a4c6, 0x0000ffe4, 0x0000ffe4, 0x0000ffe8, +0x0000ffe8, 0x0000ffed, 0x0000ffee, 0x0000fffc, 0x0000fffd, +0x0001d000, 0x0001d0f5, 0x0001d100, 0x0001d126, 0x0001d12a, +0x0001d164, 0x0001d16a, 0x0001d16c, 0x0001d183, 0x0001d184, +0x0001d18c, 0x0001d1a9, 0x0001d1ae, 0x0001d1dd, +0x00000041, 0x0000005a, 0x00000061, 0x0000007a, +0x000000aa, 0x000000aa, 0x000000b5, 0x000000b5, 0x000000ba, +0x000000ba, 0x000000c0, 0x000000d6, 0x000000d8, 0x000000f6, +0x000000f8, 0x00000220, 0x00000222, 0x00000233, 0x00000250, +0x000002ad, 0x000002b0, 0x000002b8, 0x000002bb, 0x000002c1, +0x000002d0, 0x000002d1, 0x000002e0, 0x000002e4, 0x000002ee, +0x000002ee, 0x0000037a, 0x0000037a, 0x00000386, 0x00000386, +0x00000388, 0x0000038a, 0x0000038c, 0x0000038c, 0x0000038e, +0x000003a1, 0x000003a3, 0x000003ce, 0x000003d0, 0x000003f5, +0x00000400, 0x00000482, 0x0000048a, 0x000004ce, 0x000004d0, +0x000004f5, 0x000004f8, 0x000004f9, 0x00000500, 0x0000050f, +0x00000531, 0x00000556, 0x00000559, 0x0000055f, 0x00000561, +0x00000587, 0x00000589, 0x00000589, 0x00000903, 0x00000903, +0x00000905, 0x00000939, 0x0000093d, 0x00000940, 0x00000949, +0x0000094c, 0x00000950, 0x00000950, 0x00000958, 0x00000961, +0x00000964, 0x00000970, 0x00000982, 0x00000983, 0x00000985, +0x0000098c, 0x0000098f, 0x00000990, 0x00000993, 0x000009a8, +0x000009aa, 0x000009b0, 0x000009b2, 0x000009b2, 0x000009b6, +0x000009b9, 0x000009be, 0x000009c0, 0x000009c7, 0x000009c8, +0x000009cb, 0x000009cc, 0x000009d7, 0x000009d7, 0x000009dc, +0x000009dd, 0x000009df, 0x000009e1, 0x000009e6, 0x000009f1, +0x000009f4, 0x000009fa, 0x00000a05, 0x00000a0a, 0x00000a0f, +0x00000a10, 0x00000a13, 0x00000a28, 0x00000a2a, 0x00000a30, +0x00000a32, 0x00000a33, 0x00000a35, 0x00000a36, 0x00000a38, +0x00000a39, 0x00000a3e, 0x00000a40, 0x00000a59, 0x00000a5c, +0x00000a5e, 0x00000a5e, 0x00000a66, 0x00000a6f, 0x00000a72, +0x00000a74, 0x00000a83, 0x00000a83, 0x00000a85, 0x00000a8b, +0x00000a8d, 0x00000a8d, 0x00000a8f, 0x00000a91, 0x00000a93, +0x00000aa8, 0x00000aaa, 0x00000ab0, 0x00000ab2, 0x00000ab3, +0x00000ab5, 0x00000ab9, 0x00000abd, 0x00000ac0, 0x00000ac9, +0x00000ac9, 0x00000acb, 0x00000acc, 0x00000ad0, 0x00000ad0, +0x00000ae0, 0x00000ae0, 0x00000ae6, 0x00000aef, 0x00000b02, +0x00000b03, 0x00000b05, 0x00000b0c, 0x00000b0f, 0x00000b10, +0x00000b13, 0x00000b28, 0x00000b2a, 0x00000b30, 0x00000b32, +0x00000b33, 0x00000b36, 0x00000b39, 0x00000b3d, 0x00000b3e, +0x00000b40, 0x00000b40, 0x00000b47, 0x00000b48, 0x00000b4b, +0x00000b4c, 0x00000b57, 0x00000b57, 0x00000b5c, 0x00000b5d, +0x00000b5f, 0x00000b61, 0x00000b66, 0x00000b70, 0x00000b83, +0x00000b83, 0x00000b85, 0x00000b8a, 0x00000b8e, 0x00000b90, +0x00000b92, 0x00000b95, 0x00000b99, 0x00000b9a, 0x00000b9c, +0x00000b9c, 0x00000b9e, 0x00000b9f, 0x00000ba3, 0x00000ba4, +0x00000ba8, 0x00000baa, 0x00000bae, 0x00000bb5, 0x00000bb7, +0x00000bb9, 0x00000bbe, 0x00000bbf, 0x00000bc1, 0x00000bc2, +0x00000bc6, 0x00000bc8, 0x00000bca, 0x00000bcc, 0x00000bd7, +0x00000bd7, 0x00000be7, 0x00000bf2, 0x00000c01, 0x00000c03, +0x00000c05, 0x00000c0c, 0x00000c0e, 0x00000c10, 0x00000c12, +0x00000c28, 0x00000c2a, 0x00000c33, 0x00000c35, 0x00000c39, +0x00000c41, 0x00000c44, 0x00000c60, 0x00000c61, 0x00000c66, +0x00000c6f, 0x00000c82, 0x00000c83, 0x00000c85, 0x00000c8c, +0x00000c8e, 0x00000c90, 0x00000c92, 0x00000ca8, 0x00000caa, +0x00000cb3, 0x00000cb5, 0x00000cb9, 0x00000cbe, 0x00000cbe, +0x00000cc0, 0x00000cc4, 0x00000cc7, 0x00000cc8, 0x00000cca, +0x00000ccb, 0x00000cd5, 0x00000cd6, 0x00000cde, 0x00000cde, +0x00000ce0, 0x00000ce1, 0x00000ce6, 0x00000cef, 0x00000d02, +0x00000d03, 0x00000d05, 0x00000d0c, 0x00000d0e, 0x00000d10, +0x00000d12, 0x00000d28, 0x00000d2a, 0x00000d39, 0x00000d3e, +0x00000d40, 0x00000d46, 0x00000d48, 0x00000d4a, 0x00000d4c, +0x00000d57, 0x00000d57, 0x00000d60, 0x00000d61, 0x00000d66, +0x00000d6f, 0x00000d82, 0x00000d83, 0x00000d85, 0x00000d96, +0x00000d9a, 0x00000db1, 0x00000db3, 0x00000dbb, 0x00000dbd, +0x00000dbd, 0x00000dc0, 0x00000dc6, 0x00000dcf, 0x00000dd1, +0x00000dd8, 0x00000ddf, 0x00000df2, 0x00000df4, 0x00000e01, +0x00000e30, 0x00000e32, 0x00000e33, 0x00000e40, 0x00000e46, +0x00000e4f, 0x00000e5b, 0x00000e81, 0x00000e82, 0x00000e84, +0x00000e84, 0x00000e87, 0x00000e88, 0x00000e8a, 0x00000e8a, +0x00000e8d, 0x00000e8d, 0x00000e94, 0x00000e97, 0x00000e99, +0x00000e9f, 0x00000ea1, 0x00000ea3, 0x00000ea5, 0x00000ea5, +0x00000ea7, 0x00000ea7, 0x00000eaa, 0x00000eab, 0x00000ead, +0x00000eb0, 0x00000eb2, 0x00000eb3, 0x00000ebd, 0x00000ebd, +0x00000ec0, 0x00000ec4, 0x00000ec6, 0x00000ec6, 0x00000ed0, +0x00000ed9, 0x00000edc, 0x00000edd, 0x00000f00, 0x00000f17, +0x00000f1a, 0x00000f34, 0x00000f36, 0x00000f36, 0x00000f38, +0x00000f38, 0x00000f3e, 0x00000f47, 0x00000f49, 0x00000f6a, +0x00000f7f, 0x00000f7f, 0x00000f85, 0x00000f85, 0x00000f88, +0x00000f8b, 0x00000fbe, 0x00000fc5, 0x00000fc7, 0x00000fcc, +0x00000fcf, 0x00000fcf, 0x00001000, 0x00001021, 0x00001023, +0x00001027, 0x00001029, 0x0000102a, 0x0000102c, 0x0000102c, +0x00001031, 0x00001031, 0x00001038, 0x00001038, 0x00001040, +0x00001057, 0x000010a0, 0x000010c5, 0x000010d0, 0x000010f8, +0x000010fb, 0x000010fb, 0x00001100, 0x00001159, 0x0000115f, +0x000011a2, 0x000011a8, 0x000011f9, 0x00001200, 0x00001206, +0x00001208, 0x00001246, 0x00001248, 0x00001248, 0x0000124a, +0x0000124d, 0x00001250, 0x00001256, 0x00001258, 0x00001258, +0x0000125a, 0x0000125d, 0x00001260, 0x00001286, 0x00001288, +0x00001288, 0x0000128a, 0x0000128d, 0x00001290, 0x000012ae, +0x000012b0, 0x000012b0, 0x000012b2, 0x000012b5, 0x000012b8, +0x000012be, 0x000012c0, 0x000012c0, 0x000012c2, 0x000012c5, +0x000012c8, 0x000012ce, 0x000012d0, 0x000012d6, 0x000012d8, +0x000012ee, 0x000012f0, 0x0000130e, 0x00001310, 0x00001310, +0x00001312, 0x00001315, 0x00001318, 0x0000131e, 0x00001320, +0x00001346, 0x00001348, 0x0000135a, 0x00001361, 0x0000137c, +0x000013a0, 0x000013f4, 0x00001401, 0x00001676, 0x00001681, +0x0000169a, 0x000016a0, 0x000016f0, 0x00001700, 0x0000170c, +0x0000170e, 0x00001711, 0x00001720, 0x00001731, 0x00001735, +0x00001736, 0x00001740, 0x00001751, 0x00001760, 0x0000176c, +0x0000176e, 0x00001770, 0x00001780, 0x000017b6, 0x000017be, +0x000017c5, 0x000017c7, 0x000017c8, 0x000017d4, 0x000017da, +0x000017dc, 0x000017dc, 0x000017e0, 0x000017e9, 0x00001810, +0x00001819, 0x00001820, 0x00001877, 0x00001880, 0x000018a8, +0x00001e00, 0x00001e9b, 0x00001ea0, 0x00001ef9, 0x00001f00, +0x00001f15, 0x00001f18, 0x00001f1d, 0x00001f20, 0x00001f45, +0x00001f48, 0x00001f4d, 0x00001f50, 0x00001f57, 0x00001f59, +0x00001f59, 0x00001f5b, 0x00001f5b, 0x00001f5d, 0x00001f5d, +0x00001f5f, 0x00001f7d, 0x00001f80, 0x00001fb4, 0x00001fb6, +0x00001fbc, 0x00001fbe, 0x00001fbe, 0x00001fc2, 0x00001fc4, +0x00001fc6, 0x00001fcc, 0x00001fd0, 0x00001fd3, 0x00001fd6, +0x00001fdb, 0x00001fe0, 0x00001fec, 0x00001ff2, 0x00001ff4, +0x00001ff6, 0x00001ffc, 0x0000200e, 0x0000200e, 0x00002071, +0x00002071, 0x0000207f, 0x0000207f, 0x00002102, 0x00002102, +0x00002107, 0x00002107, 0x0000210a, 0x00002113, 0x00002115, +0x00002115, 0x00002119, 0x0000211d, 0x00002124, 0x00002124, +0x00002126, 0x00002126, 0x00002128, 0x00002128, 0x0000212a, +0x0000212d, 0x0000212f, 0x00002131, 0x00002133, 0x00002139, +0x0000213d, 0x0000213f, 0x00002145, 0x00002149, 0x00002160, +0x00002183, 0x00002336, 0x0000237a, 0x00002395, 0x00002395, +0x0000249c, 0x000024e9, 0x00003005, 0x00003007, 0x00003021, +0x00003029, 0x00003031, 0x00003035, 0x00003038, 0x0000303c, +0x00003041, 0x00003096, 0x0000309d, 0x0000309f, 0x000030a1, +0x000030fa, 0x000030fc, 0x000030ff, 0x00003105, 0x0000312c, +0x00003131, 0x0000318e, 0x00003190, 0x000031b7, 0x000031f0, +0x0000321c, 0x00003220, 0x00003243, 0x00003260, 0x0000327b, +0x0000327f, 0x000032b0, 0x000032c0, 0x000032cb, 0x000032d0, +0x000032fe, 0x00003300, 0x00003376, 0x0000337b, 0x000033dd, +0x000033e0, 0x000033fe, 0x00003400, 0x00003400, 0x00004db5, +0x00004db5, 0x00004e00, 0x0000a48c, 0x0000ac00, 0x0000d7a3, +0x0000e000, 0x0000fb06, 0x0000fb13, 0x0000fb17, 0x0000ff21, +0x0000ff3a, 0x0000ff41, 0x0000ff5a, 0x0000ff66, 0x0000ffbe, +0x0000ffc2, 0x0000ffc7, 0x0000ffca, 0x0000ffcf, 0x0000ffd2, +0x0000ffd7, 0x0000ffda, 0x0000ffdc, 0x00010000, 0x0010ffff, +0x000005be, 0x000005be, 0x000005c0, 0x000005c0, +0x000005c3, 0x000005c3, 0x000005d0, 0x000005ea, 0x000005f0, +0x000005f4, 0x0000200f, 0x0000200f, 0x0000fb1d, 0x0000fb1d, +0x0000fb1f, 0x0000fb28, 0x0000fb2a, 0x0000fb36, 0x0000fb38, +0x0000fb3c, 0x0000fb3e, 0x0000fb3e, 0x0000fb40, 0x0000fb41, +0x0000fb43, 0x0000fb44, 0x0000fb46, 0x0000fb4f, +0x00000030, 0x00000039, 0x000000b2, 0x000000b3, +0x000000b9, 0x000000b9, 0x000006f0, 0x000006f9, 0x00002070, +0x00002070, 0x00002074, 0x00002079, 0x00002080, 0x00002089, +0x00002460, 0x0000249b, 0x000024ea, 0x000024ea, 0x0000ff10, +0x0000ff19, 0x0001d7ce, 0x0001d7ff, +0x0000002f, 0x0000002f, 0x0000ff0f, 0x0000ff0f, +0x00000023, 0x00000025, 0x0000002b, 0x0000002b, +0x0000002d, 0x0000002d, 0x000000a2, 0x000000a5, 0x000000b0, +0x000000b1, 0x0000066a, 0x0000066a, 0x000009f2, 0x000009f3, +0x00000e3f, 0x00000e3f, 0x000017db, 0x000017db, 0x00002030, +0x00002034, 0x0000207a, 0x0000207b, 0x0000208a, 0x0000208b, +0x000020a0, 0x000020b1, 0x0000212e, 0x0000212e, 0x00002212, +0x00002213, 0x0000fb29, 0x0000fb29, 0x0000fe5f, 0x0000fe5f, +0x0000fe62, 0x0000fe63, 0x0000fe69, 0x0000fe6a, 0x0000ff03, +0x0000ff05, 0x0000ff0b, 0x0000ff0b, 0x0000ff0d, 0x0000ff0d, +0x0000ffe0, 0x0000ffe1, 0x0000ffe5, 0x0000ffe6, +0x00000660, 0x00000669, 0x0000066b, 0x0000066c, +0x0000002c, 0x0000002c, 0x0000002e, 0x0000002e, +0x0000003a, 0x0000003a, 0x000000a0, 0x000000a0, 0x0000060c, +0x0000060c, 0x0000fe50, 0x0000fe50, 0x0000fe52, 0x0000fe52, +0x0000fe55, 0x0000fe55, 0x0000ff0c, 0x0000ff0c, 0x0000ff0e, +0x0000ff0e, 0x0000ff1a, 0x0000ff1a, +0x0000000a, 0x0000000a, 0x0000000d, 0x0000000d, +0x0000001c, 0x0000001e, 0x00000085, 0x00000085, 0x00002029, +0x00002029, +0x00000009, 0x00000009, 0x0000000b, 0x0000000b, +0x0000001f, 0x0000001f, +0x0000000c, 0x0000000c, 0x00000020, 0x00000020, +0x00001680, 0x00001680, 0x00002000, 0x0000200a, 0x00002028, +0x00002028, 0x0000202f, 0x0000202f, 0x0000205f, 0x0000205f, +0x00003000, 0x00003000, +0x00000000, 0x00000008, 0x0000000e, 0x0000001b, +0x00000021, 0x00000022, 0x00000026, 0x0000002a, 0x0000003b, +0x00000040, 0x0000005b, 0x00000060, 0x0000007b, 0x00000084, +0x00000086, 0x0000009f, 0x000000a1, 0x000000a1, 0x000000a6, +0x000000a9, 0x000000ab, 0x000000af, 0x000000b4, 0x000000b4, +0x000000b6, 0x000000b8, 0x000000bb, 0x000000bf, 0x000000d7, +0x000000d7, 0x000000f7, 0x000000f7, 0x000002b9, 0x000002ba, +0x000002c2, 0x000002cf, 0x000002d2, 0x000002df, 0x000002e5, +0x000002ed, 0x00000300, 0x0000034f, 0x00000360, 0x0000036f, +0x00000374, 0x00000375, 0x0000037e, 0x0000037e, 0x00000384, +0x00000385, 0x00000387, 0x00000387, 0x000003f6, 0x000003f6, +0x00000483, 0x00000486, 0x00000488, 0x00000489, 0x0000058a, +0x0000058a, 0x00000591, 0x000005a1, 0x000005a3, 0x000005b9, +0x000005bb, 0x000005bd, 0x000005bf, 0x000005bf, 0x000005c1, +0x000005c2, 0x000005c4, 0x000005c4, 0x0000064b, 0x00000655, +0x00000670, 0x00000670, 0x000006d6, 0x000006dc, 0x000006de, +0x000006e4, 0x000006e7, 0x000006ed, 0x0000070f, 0x0000070f, +0x00000711, 0x00000711, 0x00000730, 0x0000074a, 0x000007a6, +0x000007b0, 0x00000901, 0x00000902, 0x0000093c, 0x0000093c, +0x00000941, 0x00000948, 0x0000094d, 0x0000094d, 0x00000951, +0x00000954, 0x00000962, 0x00000963, 0x00000981, 0x00000981, +0x000009bc, 0x000009bc, 0x000009c1, 0x000009c4, 0x000009cd, +0x000009cd, 0x000009e2, 0x000009e3, 0x00000a02, 0x00000a02, +0x00000a3c, 0x00000a3c, 0x00000a41, 0x00000a42, 0x00000a47, +0x00000a48, 0x00000a4b, 0x00000a4d, 0x00000a70, 0x00000a71, +0x00000a81, 0x00000a82, 0x00000abc, 0x00000abc, 0x00000ac1, +0x00000ac5, 0x00000ac7, 0x00000ac8, 0x00000acd, 0x00000acd, +0x00000b01, 0x00000b01, 0x00000b3c, 0x00000b3c, 0x00000b3f, +0x00000b3f, 0x00000b41, 0x00000b43, 0x00000b4d, 0x00000b4d, +0x00000b56, 0x00000b56, 0x00000b82, 0x00000b82, 0x00000bc0, +0x00000bc0, 0x00000bcd, 0x00000bcd, 0x00000c3e, 0x00000c40, +0x00000c46, 0x00000c48, 0x00000c4a, 0x00000c4d, 0x00000c55, +0x00000c56, 0x00000cbf, 0x00000cbf, 0x00000cc6, 0x00000cc6, +0x00000ccc, 0x00000ccd, 0x00000d41, 0x00000d43, 0x00000d4d, +0x00000d4d, 0x00000dca, 0x00000dca, 0x00000dd2, 0x00000dd4, +0x00000dd6, 0x00000dd6, 0x00000e31, 0x00000e31, 0x00000e34, +0x00000e3a, 0x00000e47, 0x00000e4e, 0x00000eb1, 0x00000eb1, +0x00000eb4, 0x00000eb9, 0x00000ebb, 0x00000ebc, 0x00000ec8, +0x00000ecd, 0x00000f18, 0x00000f19, 0x00000f35, 0x00000f35, +0x00000f37, 0x00000f37, 0x00000f39, 0x00000f3d, 0x00000f71, +0x00000f7e, 0x00000f80, 0x00000f84, 0x00000f86, 0x00000f87, +0x00000f90, 0x00000f97, 0x00000f99, 0x00000fbc, 0x00000fc6, +0x00000fc6, 0x0000102d, 0x00001030, 0x00001032, 0x00001032, +0x00001036, 0x00001037, 0x00001039, 0x00001039, 0x00001058, +0x00001059, 0x0000169b, 0x0000169c, 0x00001712, 0x00001714, +0x00001732, 0x00001734, 0x00001752, 0x00001753, 0x00001772, +0x00001773, 0x000017b7, 0x000017bd, 0x000017c6, 0x000017c6, +0x000017c9, 0x000017d3, 0x00001800, 0x0000180e, 0x000018a9, +0x000018a9, 0x00001fbd, 0x00001fbd, 0x00001fbf, 0x00001fc1, +0x00001fcd, 0x00001fcf, 0x00001fdd, 0x00001fdf, 0x00001fed, +0x00001fef, 0x00001ffd, 0x00001ffe, 0x0000200b, 0x0000200d, +0x00002010, 0x00002027, 0x0000202a, 0x0000202e, 0x00002035, +0x00002052, 0x00002057, 0x00002057, 0x00002060, 0x00002063, +0x0000206a, 0x0000206f, 0x0000207c, 0x0000207e, 0x0000208c, +0x0000208e, 0x000020d0, 0x000020ea, 0x00002100, 0x00002101, +0x00002103, 0x00002106, 0x00002108, 0x00002109, 0x00002114, +0x00002114, 0x00002116, 0x00002118, 0x0000211e, 0x00002123, +0x00002125, 0x00002125, 0x00002127, 0x00002127, 0x00002129, +0x00002129, 0x00002132, 0x00002132, 0x0000213a, 0x0000213a, +0x00002140, 0x00002144, 0x0000214a, 0x0000214b, 0x00002153, +0x0000215f, 0x00002190, 0x00002211, 0x00002214, 0x00002335, +0x0000237b, 0x00002394, 0x00002396, 0x000023ce, 0x00002400, +0x00002426, 0x00002440, 0x0000244a, 0x000024eb, 0x000024fe, +0x00002500, 0x00002613, 0x00002616, 0x00002617, 0x00002619, +0x0000267d, 0x00002680, 0x00002689, 0x00002701, 0x00002704, +0x00002706, 0x00002709, 0x0000270c, 0x00002727, 0x00002729, +0x0000274b, 0x0000274d, 0x0000274d, 0x0000274f, 0x00002752, +0x00002756, 0x00002756, 0x00002758, 0x0000275e, 0x00002761, +0x00002794, 0x00002798, 0x000027af, 0x000027b1, 0x000027be, +0x000027d0, 0x000027eb, 0x000027f0, 0x00002aff, 0x00002e80, +0x00002e99, 0x00002e9b, 0x00002ef3, 0x00002f00, 0x00002fd5, +0x00002ff0, 0x00002ffb, 0x00003001, 0x00003004, 0x00003008, +0x00003020, 0x0000302a, 0x00003030, 0x00003036, 0x00003037, +0x0000303d, 0x0000303f, 0x00003099, 0x0000309c, 0x000030a0, +0x000030a0, 0x000030fb, 0x000030fb, 0x00003251, 0x0000325f, +0x000032b1, 0x000032bf, 0x0000a490, 0x0000a4c6, 0x0000fb1e, +0x0000fb1e, 0x0000fd3e, 0x0000fd3f, 0x0000fe00, 0x0000fe0f, +0x0000fe20, 0x0000fe23, 0x0000fe30, 0x0000fe46, 0x0000fe49, +0x0000fe4f, 0x0000fe51, 0x0000fe51, 0x0000fe54, 0x0000fe54, +0x0000fe56, 0x0000fe5e, 0x0000fe60, 0x0000fe61, 0x0000fe64, +0x0000fe66, 0x0000fe68, 0x0000fe68, 0x0000fe6b, 0x0000fe6b, +0x0000feff, 0x0000feff, 0x0000ff01, 0x0000ff02, 0x0000ff06, +0x0000ff0a, 0x0000ff1b, 0x0000ff20, 0x0000ff3b, 0x0000ff40, +0x0000ff5b, 0x0000ff65, 0x0000ffe2, 0x0000ffe4, 0x0000ffe8, +0x0000ffee, 0x0000fff9, 0x0000fffd, 0x0001d167, 0x0001d169, +0x0001d173, 0x0001d182, 0x0001d185, 0x0001d18b, 0x0001d1aa, +0x0001d1ad, 0x000e0001, 0x000e0001, 0x000e0020, 0x000e007f, +0x000000c0, 0x000000c5, 0x000000c7, 0x000000cf, +0x000000d1, 0x000000d6, 0x000000d9, 0x000000dd, 0x000000e0, +0x000000e5, 0x000000e7, 0x000000ef, 0x000000f1, 0x000000f6, +0x000000f9, 0x000000fd, 0x000000ff, 0x0000010f, 0x00000112, +0x00000125, 0x00000128, 0x00000130, 0x00000134, 0x00000137, +0x00000139, 0x0000013e, 0x00000143, 0x00000148, 0x0000014c, +0x00000151, 0x00000154, 0x00000165, 0x00000168, 0x0000017e, +0x000001a0, 0x000001a1, 0x000001af, 0x000001b0, 0x000001cd, +0x000001dc, 0x000001de, 0x000001e3, 0x000001e6, 0x000001f0, +0x000001f4, 0x000001f5, 0x000001f8, 0x0000021b, 0x0000021e, +0x0000021f, 0x00000226, 0x00000233, 0x00000340, 0x00000341, +0x00000343, 0x00000344, 0x00000374, 0x00000374, 0x0000037e, +0x0000037e, 0x00000385, 0x0000038a, 0x0000038c, 0x0000038c, +0x0000038e, 0x00000390, 0x000003aa, 0x000003b0, 0x000003ca, +0x000003ce, 0x000003d3, 0x000003d4, 0x00000400, 0x00000401, +0x00000403, 0x00000403, 0x00000407, 0x00000407, 0x0000040c, +0x0000040e, 0x00000419, 0x00000419, 0x00000439, 0x00000439, +0x00000450, 0x00000451, 0x00000453, 0x00000453, 0x00000457, +0x00000457, 0x0000045c, 0x0000045e, 0x00000476, 0x00000477, +0x000004c1, 0x000004c2, 0x000004d0, 0x000004d3, 0x000004d6, +0x000004d7, 0x000004da, 0x000004df, 0x000004e2, 0x000004e7, +0x000004ea, 0x000004f5, 0x000004f8, 0x000004f9, 0x00000622, +0x00000626, 0x000006c0, 0x000006c0, 0x000006c2, 0x000006c2, +0x000006d3, 0x000006d3, 0x00000929, 0x00000929, 0x00000931, +0x00000931, 0x00000934, 0x00000934, 0x00000958, 0x0000095f, +0x000009cb, 0x000009cc, 0x000009dc, 0x000009dd, 0x000009df, +0x000009df, 0x00000a33, 0x00000a33, 0x00000a36, 0x00000a36, +0x00000a59, 0x00000a5b, 0x00000a5e, 0x00000a5e, 0x00000b48, +0x00000b48, 0x00000b4b, 0x00000b4c, 0x00000b5c, 0x00000b5d, +0x00000b94, 0x00000b94, 0x00000bca, 0x00000bcc, 0x00000c48, +0x00000c48, 0x00000cc0, 0x00000cc0, 0x00000cc7, 0x00000cc8, +0x00000cca, 0x00000ccb, 0x00000d4a, 0x00000d4c, 0x00000dda, +0x00000dda, 0x00000ddc, 0x00000dde, 0x00000f43, 0x00000f43, +0x00000f4d, 0x00000f4d, 0x00000f52, 0x00000f52, 0x00000f57, +0x00000f57, 0x00000f5c, 0x00000f5c, 0x00000f69, 0x00000f69, +0x00000f73, 0x00000f73, 0x00000f75, 0x00000f76, 0x00000f78, +0x00000f78, 0x00000f81, 0x00000f81, 0x00000f93, 0x00000f93, +0x00000f9d, 0x00000f9d, 0x00000fa2, 0x00000fa2, 0x00000fa7, +0x00000fa7, 0x00000fac, 0x00000fac, 0x00000fb9, 0x00000fb9, +0x00001026, 0x00001026, 0x00001e00, 0x00001e99, 0x00001e9b, +0x00001e9b, 0x00001ea0, 0x00001ef9, 0x00001f00, 0x00001f15, +0x00001f18, 0x00001f1d, 0x00001f20, 0x00001f45, 0x00001f48, +0x00001f4d, 0x00001f50, 0x00001f57, 0x00001f59, 0x00001f59, +0x00001f5b, 0x00001f5b, 0x00001f5d, 0x00001f5d, 0x00001f5f, +0x00001f7d, 0x00001f80, 0x00001fb4, 0x00001fb6, 0x00001fbc, +0x00001fbe, 0x00001fbe, 0x00001fc1, 0x00001fc4, 0x00001fc6, +0x00001fd3, 0x00001fd6, 0x00001fdb, 0x00001fdd, 0x00001fef, +0x00001ff2, 0x00001ff4, 0x00001ff6, 0x00001ffd, 0x00002000, +0x00002001, 0x00002126, 0x00002126, 0x0000212a, 0x0000212b, +0x0000219a, 0x0000219b, 0x000021ae, 0x000021ae, 0x000021cd, +0x000021cf, 0x00002204, 0x00002204, 0x00002209, 0x00002209, +0x0000220c, 0x0000220c, 0x00002224, 0x00002224, 0x00002226, +0x00002226, 0x00002241, 0x00002241, 0x00002244, 0x00002244, +0x00002247, 0x00002247, 0x00002249, 0x00002249, 0x00002260, +0x00002260, 0x00002262, 0x00002262, 0x0000226d, 0x00002271, +0x00002274, 0x00002275, 0x00002278, 0x00002279, 0x00002280, +0x00002281, 0x00002284, 0x00002285, 0x00002288, 0x00002289, +0x000022ac, 0x000022af, 0x000022e0, 0x000022e3, 0x000022ea, +0x000022ed, 0x00002329, 0x0000232a, 0x00002adc, 0x00002adc, +0x0000304c, 0x0000304c, 0x0000304e, 0x0000304e, 0x00003050, +0x00003050, 0x00003052, 0x00003052, 0x00003054, 0x00003054, +0x00003056, 0x00003056, 0x00003058, 0x00003058, 0x0000305a, +0x0000305a, 0x0000305c, 0x0000305c, 0x0000305e, 0x0000305e, +0x00003060, 0x00003060, 0x00003062, 0x00003062, 0x00003065, +0x00003065, 0x00003067, 0x00003067, 0x00003069, 0x00003069, +0x00003070, 0x00003071, 0x00003073, 0x00003074, 0x00003076, +0x00003077, 0x00003079, 0x0000307a, 0x0000307c, 0x0000307d, +0x00003094, 0x00003094, 0x0000309e, 0x0000309e, 0x000030ac, +0x000030ac, 0x000030ae, 0x000030ae, 0x000030b0, 0x000030b0, +0x000030b2, 0x000030b2, 0x000030b4, 0x000030b4, 0x000030b6, +0x000030b6, 0x000030b8, 0x000030b8, 0x000030ba, 0x000030ba, +0x000030bc, 0x000030bc, 0x000030be, 0x000030be, 0x000030c0, +0x000030c0, 0x000030c2, 0x000030c2, 0x000030c5, 0x000030c5, +0x000030c7, 0x000030c7, 0x000030c9, 0x000030c9, 0x000030d0, +0x000030d1, 0x000030d3, 0x000030d4, 0x000030d6, 0x000030d7, +0x000030d9, 0x000030da, 0x000030dc, 0x000030dd, 0x000030f4, +0x000030f4, 0x000030f7, 0x000030fa, 0x000030fe, 0x000030fe, +0x0000f902, 0x0000fa0d, 0x0000fa10, 0x0000fa10, 0x0000fa12, +0x0000fa12, 0x0000fa15, 0x0000fa1e, 0x0000fa20, 0x0000fa20, +0x0000fa22, 0x0000fa22, 0x0000fa25, 0x0000fa26, 0x0000fa2a, +0x0000fa2d, 0x0000fa30, 0x0000fa6a, 0x0000fb1d, 0x0000fb1d, +0x0000fb1f, 0x0000fb1f, 0x0000fb2a, 0x0000fb36, 0x0000fb38, +0x0000fb3c, 0x0000fb3e, 0x0000fb3e, 0x0000fb40, 0x0000fb41, +0x0000fb43, 0x0000fb44, 0x0000fb46, 0x0000fb4e, 0x0001d15e, +0x0001d164, 0x0001d1bb, 0x0001d1c0, 0x0002f800, 0x0002fa1d, +0x00000000, 0x00000220, 0x00000222, 0x00000233, +0x00000250, 0x000002ad, 0x000002b0, 0x000002ee, 0x00000300, +0x0000034f, 0x00000360, 0x0000036f, 0x00000374, 0x00000375, +0x0000037a, 0x0000037a, 0x0000037e, 0x0000037e, 0x00000384, +0x0000038a, 0x0000038c, 0x0000038c, 0x0000038e, 0x000003a1, +0x000003a3, 0x000003ce, 0x000003d0, 0x000003f6, 0x00000400, +0x00000486, 0x00000488, 0x000004ce, 0x000004d0, 0x000004f5, +0x000004f8, 0x000004f9, 0x00000500, 0x0000050f, 0x00000531, +0x00000556, 0x00000559, 0x0000055f, 0x00000561, 0x00000587, +0x00000589, 0x0000058a, 0x00000591, 0x000005a1, 0x000005a3, +0x000005b9, 0x000005bb, 0x000005c4, 0x000005d0, 0x000005ea, +0x000005f0, 0x000005f4, 0x0000060c, 0x0000060c, 0x0000061b, +0x0000061b, 0x0000061f, 0x0000061f, 0x00000621, 0x0000063a, +0x00000640, 0x00000655, 0x00000660, 0x000006ed, 0x000006f0, +0x000006fe, 0x00000700, 0x0000070d, 0x0000070f, 0x0000072c, +0x00000730, 0x0000074a, 0x00000780, 0x000007b1, 0x00000901, +0x00000903, 0x00000905, 0x00000939, 0x0000093c, 0x0000094d, +0x00000950, 0x00000954, 0x00000958, 0x00000970, 0x00000981, +0x00000983, 0x00000985, 0x0000098c, 0x0000098f, 0x00000990, +0x00000993, 0x000009a8, 0x000009aa, 0x000009b0, 0x000009b2, +0x000009b2, 0x000009b6, 0x000009b9, 0x000009bc, 0x000009bc, +0x000009be, 0x000009c4, 0x000009c7, 0x000009c8, 0x000009cb, +0x000009cd, 0x000009d7, 0x000009d7, 0x000009dc, 0x000009dd, +0x000009df, 0x000009e3, 0x000009e6, 0x000009fa, 0x00000a02, +0x00000a02, 0x00000a05, 0x00000a0a, 0x00000a0f, 0x00000a10, +0x00000a13, 0x00000a28, 0x00000a2a, 0x00000a30, 0x00000a32, +0x00000a33, 0x00000a35, 0x00000a36, 0x00000a38, 0x00000a39, +0x00000a3c, 0x00000a3c, 0x00000a3e, 0x00000a42, 0x00000a47, +0x00000a48, 0x00000a4b, 0x00000a4d, 0x00000a59, 0x00000a5c, +0x00000a5e, 0x00000a5e, 0x00000a66, 0x00000a74, 0x00000a81, +0x00000a83, 0x00000a85, 0x00000a8b, 0x00000a8d, 0x00000a8d, +0x00000a8f, 0x00000a91, 0x00000a93, 0x00000aa8, 0x00000aaa, +0x00000ab0, 0x00000ab2, 0x00000ab3, 0x00000ab5, 0x00000ab9, +0x00000abc, 0x00000ac5, 0x00000ac7, 0x00000ac9, 0x00000acb, +0x00000acd, 0x00000ad0, 0x00000ad0, 0x00000ae0, 0x00000ae0, +0x00000ae6, 0x00000aef, 0x00000b01, 0x00000b03, 0x00000b05, +0x00000b0c, 0x00000b0f, 0x00000b10, 0x00000b13, 0x00000b28, +0x00000b2a, 0x00000b30, 0x00000b32, 0x00000b33, 0x00000b36, +0x00000b39, 0x00000b3c, 0x00000b43, 0x00000b47, 0x00000b48, +0x00000b4b, 0x00000b4d, 0x00000b56, 0x00000b57, 0x00000b5c, +0x00000b5d, 0x00000b5f, 0x00000b61, 0x00000b66, 0x00000b70, +0x00000b82, 0x00000b83, 0x00000b85, 0x00000b8a, 0x00000b8e, +0x00000b90, 0x00000b92, 0x00000b95, 0x00000b99, 0x00000b9a, +0x00000b9c, 0x00000b9c, 0x00000b9e, 0x00000b9f, 0x00000ba3, +0x00000ba4, 0x00000ba8, 0x00000baa, 0x00000bae, 0x00000bb5, +0x00000bb7, 0x00000bb9, 0x00000bbe, 0x00000bc2, 0x00000bc6, +0x00000bc8, 0x00000bca, 0x00000bcd, 0x00000bd7, 0x00000bd7, +0x00000be7, 0x00000bf2, 0x00000c01, 0x00000c03, 0x00000c05, +0x00000c0c, 0x00000c0e, 0x00000c10, 0x00000c12, 0x00000c28, +0x00000c2a, 0x00000c33, 0x00000c35, 0x00000c39, 0x00000c3e, +0x00000c44, 0x00000c46, 0x00000c48, 0x00000c4a, 0x00000c4d, +0x00000c55, 0x00000c56, 0x00000c60, 0x00000c61, 0x00000c66, +0x00000c6f, 0x00000c82, 0x00000c83, 0x00000c85, 0x00000c8c, +0x00000c8e, 0x00000c90, 0x00000c92, 0x00000ca8, 0x00000caa, +0x00000cb3, 0x00000cb5, 0x00000cb9, 0x00000cbe, 0x00000cc4, +0x00000cc6, 0x00000cc8, 0x00000cca, 0x00000ccd, 0x00000cd5, +0x00000cd6, 0x00000cde, 0x00000cde, 0x00000ce0, 0x00000ce1, +0x00000ce6, 0x00000cef, 0x00000d02, 0x00000d03, 0x00000d05, +0x00000d0c, 0x00000d0e, 0x00000d10, 0x00000d12, 0x00000d28, +0x00000d2a, 0x00000d39, 0x00000d3e, 0x00000d43, 0x00000d46, +0x00000d48, 0x00000d4a, 0x00000d4d, 0x00000d57, 0x00000d57, +0x00000d60, 0x00000d61, 0x00000d66, 0x00000d6f, 0x00000d82, +0x00000d83, 0x00000d85, 0x00000d96, 0x00000d9a, 0x00000db1, +0x00000db3, 0x00000dbb, 0x00000dbd, 0x00000dbd, 0x00000dc0, +0x00000dc6, 0x00000dca, 0x00000dca, 0x00000dcf, 0x00000dd4, +0x00000dd6, 0x00000dd6, 0x00000dd8, 0x00000ddf, 0x00000df2, +0x00000df4, 0x00000e01, 0x00000e3a, 0x00000e3f, 0x00000e5b, +0x00000e81, 0x00000e82, 0x00000e84, 0x00000e84, 0x00000e87, +0x00000e88, 0x00000e8a, 0x00000e8a, 0x00000e8d, 0x00000e8d, +0x00000e94, 0x00000e97, 0x00000e99, 0x00000e9f, 0x00000ea1, +0x00000ea3, 0x00000ea5, 0x00000ea5, 0x00000ea7, 0x00000ea7, +0x00000eaa, 0x00000eab, 0x00000ead, 0x00000eb9, 0x00000ebb, +0x00000ebd, 0x00000ec0, 0x00000ec4, 0x00000ec6, 0x00000ec6, +0x00000ec8, 0x00000ecd, 0x00000ed0, 0x00000ed9, 0x00000edc, +0x00000edd, 0x00000f00, 0x00000f47, 0x00000f49, 0x00000f6a, +0x00000f71, 0x00000f8b, 0x00000f90, 0x00000f97, 0x00000f99, +0x00000fbc, 0x00000fbe, 0x00000fcc, 0x00000fcf, 0x00000fcf, +0x00001000, 0x00001021, 0x00001023, 0x00001027, 0x00001029, +0x0000102a, 0x0000102c, 0x00001032, 0x00001036, 0x00001039, +0x00001040, 0x00001059, 0x000010a0, 0x000010c5, 0x000010d0, +0x000010f8, 0x000010fb, 0x000010fb, 0x00001100, 0x00001159, +0x0000115f, 0x000011a2, 0x000011a8, 0x000011f9, 0x00001200, +0x00001206, 0x00001208, 0x00001246, 0x00001248, 0x00001248, +0x0000124a, 0x0000124d, 0x00001250, 0x00001256, 0x00001258, +0x00001258, 0x0000125a, 0x0000125d, 0x00001260, 0x00001286, +0x00001288, 0x00001288, 0x0000128a, 0x0000128d, 0x00001290, +0x000012ae, 0x000012b0, 0x000012b0, 0x000012b2, 0x000012b5, +0x000012b8, 0x000012be, 0x000012c0, 0x000012c0, 0x000012c2, +0x000012c5, 0x000012c8, 0x000012ce, 0x000012d0, 0x000012d6, +0x000012d8, 0x000012ee, 0x000012f0, 0x0000130e, 0x00001310, +0x00001310, 0x00001312, 0x00001315, 0x00001318, 0x0000131e, +0x00001320, 0x00001346, 0x00001348, 0x0000135a, 0x00001361, +0x0000137c, 0x000013a0, 0x000013f4, 0x00001401, 0x00001676, +0x00001680, 0x0000169c, 0x000016a0, 0x000016f0, 0x00001700, +0x0000170c, 0x0000170e, 0x00001714, 0x00001720, 0x00001736, +0x00001740, 0x00001753, 0x00001760, 0x0000176c, 0x0000176e, +0x00001770, 0x00001772, 0x00001773, 0x00001780, 0x000017dc, +0x000017e0, 0x000017e9, 0x00001800, 0x0000180e, 0x00001810, +0x00001819, 0x00001820, 0x00001877, 0x00001880, 0x000018a9, +0x00001e00, 0x00001e9b, 0x00001ea0, 0x00001ef9, 0x00001f00, +0x00001f15, 0x00001f18, 0x00001f1d, 0x00001f20, 0x00001f45, +0x00001f48, 0x00001f4d, 0x00001f50, 0x00001f57, 0x00001f59, +0x00001f59, 0x00001f5b, 0x00001f5b, 0x00001f5d, 0x00001f5d, +0x00001f5f, 0x00001f7d, 0x00001f80, 0x00001fb4, 0x00001fb6, +0x00001fc4, 0x00001fc6, 0x00001fd3, 0x00001fd6, 0x00001fdb, +0x00001fdd, 0x00001fef, 0x00001ff2, 0x00001ff4, 0x00001ff6, +0x00001ffe, 0x00002000, 0x00002052, 0x00002057, 0x00002057, +0x0000205f, 0x00002063, 0x0000206a, 0x00002071, 0x00002074, +0x0000208e, 0x000020a0, 0x000020b1, 0x000020d0, 0x000020ea, +0x00002100, 0x0000213a, 0x0000213d, 0x0000214b, 0x00002153, +0x00002183, 0x00002190, 0x000023ce, 0x00002400, 0x00002426, +0x00002440, 0x0000244a, 0x00002460, 0x000024fe, 0x00002500, +0x00002613, 0x00002616, 0x00002617, 0x00002619, 0x0000267d, +0x00002680, 0x00002689, 0x00002701, 0x00002704, 0x00002706, +0x00002709, 0x0000270c, 0x00002727, 0x00002729, 0x0000274b, +0x0000274d, 0x0000274d, 0x0000274f, 0x00002752, 0x00002756, +0x00002756, 0x00002758, 0x0000275e, 0x00002761, 0x00002794, +0x00002798, 0x000027af, 0x000027b1, 0x000027be, 0x000027d0, +0x000027eb, 0x000027f0, 0x00002aff, 0x00002e80, 0x00002e99, +0x00002e9b, 0x00002ef3, 0x00002f00, 0x00002fd5, 0x00002ff0, +0x00002ffb, 0x00003000, 0x0000303f, 0x00003041, 0x00003096, +0x00003099, 0x000030ff, 0x00003105, 0x0000312c, 0x00003131, +0x0000318e, 0x00003190, 0x000031b7, 0x000031f0, 0x0000321c, +0x00003220, 0x00003243, 0x00003251, 0x0000327b, 0x0000327f, +0x000032cb, 0x000032d0, 0x000032fe, 0x00003300, 0x00003376, +0x0000337b, 0x000033dd, 0x000033e0, 0x000033fe, 0x00003400, +0x00003400, 0x00004db5, 0x00004db5, 0x00004e00, 0x00009fa5, +0x0000a000, 0x0000a48c, 0x0000a490, 0x0000a4c6, 0x0000ac00, +0x0000d7a3, 0x0000f900, 0x0000fb06, 0x0000fb13, 0x0000fb17, +0x0000fb1d, 0x0000fb36, 0x0000fb38, 0x0000fb3c, 0x0000fb3e, +0x0000fb3e, 0x0000fb40, 0x0000fb41, 0x0000fb43, 0x0000fb44, +0x0000fb46, 0x0000fbb1, 0x0000fbd3, 0x0000fd3f, 0x0000fd50, +0x0000fd8f, 0x0000fd92, 0x0000fdc7, 0x0000fdf0, 0x0000fdfc, +0x0000fe00, 0x0000fe0f, 0x0000fe20, 0x0000fe23, 0x0000fe30, +0x0000fe46, 0x0000fe49, 0x0000fe52, 0x0000fe54, 0x0000fe66, +0x0000fe68, 0x0000fe6b, 0x0000fe70, 0x0000fe74, 0x0000fe76, +0x0000fefc, 0x0000feff, 0x0000feff, 0x0000ff01, 0x0000ffbe, +0x0000ffc2, 0x0000ffc7, 0x0000ffca, 0x0000ffcf, 0x0000ffd2, +0x0000ffd7, 0x0000ffda, 0x0000ffdc, 0x0000ffe0, 0x0000ffe6, +0x0000ffe8, 0x0000ffee, 0x0000fff9, 0x0000fffd, 0x00010300, +0x0001031e, 0x00010320, 0x00010323, 0x00010330, 0x0001034a, +0x00010400, 0x00010425, 0x00010428, 0x0001044d, 0x0001d000, +0x0001d0f5, 0x0001d100, 0x0001d126, 0x0001d12a, 0x0001d1dd, +0x0001d400, 0x0001d454, 0x0001d456, 0x0001d49c, 0x0001d49e, +0x0001d49f, 0x0001d4a2, 0x0001d4a2, 0x0001d4a5, 0x0001d4a6, +0x0001d4a9, 0x0001d4ac, 0x0001d4ae, 0x0001d4b9, 0x0001d4bb, +0x0001d4bb, 0x0001d4bd, 0x0001d4c0, 0x0001d4c2, 0x0001d4c3, +0x0001d4c5, 0x0001d505, 0x0001d507, 0x0001d50a, 0x0001d50d, +0x0001d514, 0x0001d516, 0x0001d51c, 0x0001d51e, 0x0001d539, +0x0001d53b, 0x0001d53e, 0x0001d540, 0x0001d544, 0x0001d546, +0x0001d546, 0x0001d54a, 0x0001d550, 0x0001d552, 0x0001d6a3, +0x0001d6a8, 0x0001d7c9, 0x0001d7ce, 0x0001d7ff, 0x00020000, +0x00020000, 0x0002a6d6, 0x0002a6d6, 0x0002f800, 0x0002fa1d, +0x000e0001, 0x000e0001, 0x000e0020, 0x000e007f, 0x000f0000, +0x000f0000, 0x000ffffd, 0x000ffffd, 0x00100000, 0x00100000, +0x0010fffd, 0x0010fffd, +0x000000ab, 0x000000ab, 0x00002018, 0x00002018, +0x0000201b, 0x0000201c, 0x0000201f, 0x0000201f, 0x00002039, +0x00002039, +0x000000bb, 0x000000bb, 0x00002019, 0x00002019, +0x0000201d, 0x0000201d, 0x0000203a, 0x0000203a, +0x0000061b, 0x0000061b, 0x0000061f, 0x0000061f, +0x00000621, 0x0000063a, 0x00000640, 0x0000064a, 0x0000066d, +0x0000066f, 0x00000671, 0x000006d5, 0x000006dd, 0x000006dd, +0x000006e5, 0x000006e6, 0x000006fa, 0x000006fe, 0x00000700, +0x0000070d, 0x00000710, 0x00000710, 0x00000712, 0x0000072c, +0x00000780, 0x000007a5, 0x000007b1, 0x000007b1, 0x0000fb50, +0x0000fbb1, 0x0000fbd3, 0x0000fd3d, 0x0000fd50, 0x0000fd8f, +0x0000fd92, 0x0000fdc7, 0x0000fdf0, 0x0000fdfc, 0x0000fe70, +0x0000fe74, 0x0000fe76, 0x0000fefc, +}; +/* }}} */ +/* {{{ case data */ +static unsigned short _uccase_size = 0x05e0; +static unsigned short _uccase_len[2] = { 0x08bb, 0x08d9 }; +static unsigned long _uccase_map[] = { +/* upper */ +0x00000041, 0x00000061, 0x00000041, +0x00000042, 0x00000062, 0x00000042, +0x00000043, 0x00000063, 0x00000043, +0x00000044, 0x00000064, 0x00000044, +0x00000045, 0x00000065, 0x00000045, +0x00000046, 0x00000066, 0x00000046, +0x00000047, 0x00000067, 0x00000047, +0x00000048, 0x00000068, 0x00000048, +0x00000049, 0x00000069, 0x00000049, +0x0000004a, 0x0000006a, 0x0000004a, +0x0000004b, 0x0000006b, 0x0000004b, +0x0000004c, 0x0000006c, 0x0000004c, +0x0000004d, 0x0000006d, 0x0000004d, +0x0000004e, 0x0000006e, 0x0000004e, +0x0000004f, 0x0000006f, 0x0000004f, +0x00000050, 0x00000070, 0x00000050, +0x00000051, 0x00000071, 0x00000051, +0x00000052, 0x00000072, 0x00000052, +0x00000053, 0x00000073, 0x00000053, +0x00000054, 0x00000074, 0x00000054, +0x00000055, 0x00000075, 0x00000055, +0x00000056, 0x00000076, 0x00000056, +0x00000057, 0x00000077, 0x00000057, +0x00000058, 0x00000078, 0x00000058, +0x00000059, 0x00000079, 0x00000059, +0x0000005a, 0x0000007a, 0x0000005a, +0x000000c0, 0x000000e0, 0x000000c0, +0x000000c1, 0x000000e1, 0x000000c1, +0x000000c2, 0x000000e2, 0x000000c2, +0x000000c3, 0x000000e3, 0x000000c3, +0x000000c4, 0x000000e4, 0x000000c4, +0x000000c5, 0x000000e5, 0x000000c5, +0x000000c6, 0x000000e6, 0x000000c6, +0x000000c7, 0x000000e7, 0x000000c7, +0x000000c8, 0x000000e8, 0x000000c8, +0x000000c9, 0x000000e9, 0x000000c9, +0x000000ca, 0x000000ea, 0x000000ca, +0x000000cb, 0x000000eb, 0x000000cb, +0x000000cc, 0x000000ec, 0x000000cc, +0x000000cd, 0x000000ed, 0x000000cd, +0x000000ce, 0x000000ee, 0x000000ce, +0x000000cf, 0x000000ef, 0x000000cf, +0x000000d0, 0x000000f0, 0x000000d0, +0x000000d1, 0x000000f1, 0x000000d1, +0x000000d2, 0x000000f2, 0x000000d2, +0x000000d3, 0x000000f3, 0x000000d3, +0x000000d4, 0x000000f4, 0x000000d4, +0x000000d5, 0x000000f5, 0x000000d5, +0x000000d6, 0x000000f6, 0x000000d6, +0x000000d8, 0x000000f8, 0x000000d8, +0x000000d9, 0x000000f9, 0x000000d9, +0x000000da, 0x000000fa, 0x000000da, +0x000000db, 0x000000fb, 0x000000db, +0x000000dc, 0x000000fc, 0x000000dc, +0x000000dd, 0x000000fd, 0x000000dd, +0x000000de, 0x000000fe, 0x000000de, +0x00000100, 0x00000101, 0x00000100, +0x00000102, 0x00000103, 0x00000102, +0x00000104, 0x00000105, 0x00000104, +0x00000106, 0x00000107, 0x00000106, +0x00000108, 0x00000109, 0x00000108, +0x0000010a, 0x0000010b, 0x0000010a, +0x0000010c, 0x0000010d, 0x0000010c, +0x0000010e, 0x0000010f, 0x0000010e, +0x00000110, 0x00000111, 0x00000110, +0x00000112, 0x00000113, 0x00000112, +0x00000114, 0x00000115, 0x00000114, +0x00000116, 0x00000117, 0x00000116, +0x00000118, 0x00000119, 0x00000118, +0x0000011a, 0x0000011b, 0x0000011a, +0x0000011c, 0x0000011d, 0x0000011c, +0x0000011e, 0x0000011f, 0x0000011e, +0x00000120, 0x00000121, 0x00000120, +0x00000122, 0x00000123, 0x00000122, +0x00000124, 0x00000125, 0x00000124, +0x00000126, 0x00000127, 0x00000126, +0x00000128, 0x00000129, 0x00000128, +0x0000012a, 0x0000012b, 0x0000012a, +0x0000012c, 0x0000012d, 0x0000012c, +0x0000012e, 0x0000012f, 0x0000012e, +0x00000130, 0x00000069, 0x00000130, +0x00000132, 0x00000133, 0x00000132, +0x00000134, 0x00000135, 0x00000134, +0x00000136, 0x00000137, 0x00000136, +0x00000139, 0x0000013a, 0x00000139, +0x0000013b, 0x0000013c, 0x0000013b, +0x0000013d, 0x0000013e, 0x0000013d, +0x0000013f, 0x00000140, 0x0000013f, +0x00000141, 0x00000142, 0x00000141, +0x00000143, 0x00000144, 0x00000143, +0x00000145, 0x00000146, 0x00000145, +0x00000147, 0x00000148, 0x00000147, +0x0000014a, 0x0000014b, 0x0000014a, +0x0000014c, 0x0000014d, 0x0000014c, +0x0000014e, 0x0000014f, 0x0000014e, +0x00000150, 0x00000151, 0x00000150, +0x00000152, 0x00000153, 0x00000152, +0x00000154, 0x00000155, 0x00000154, +0x00000156, 0x00000157, 0x00000156, +0x00000158, 0x00000159, 0x00000158, +0x0000015a, 0x0000015b, 0x0000015a, +0x0000015c, 0x0000015d, 0x0000015c, +0x0000015e, 0x0000015f, 0x0000015e, +0x00000160, 0x00000161, 0x00000160, +0x00000162, 0x00000163, 0x00000162, +0x00000164, 0x00000165, 0x00000164, +0x00000166, 0x00000167, 0x00000166, +0x00000168, 0x00000169, 0x00000168, +0x0000016a, 0x0000016b, 0x0000016a, +0x0000016c, 0x0000016d, 0x0000016c, +0x0000016e, 0x0000016f, 0x0000016e, +0x00000170, 0x00000171, 0x00000170, +0x00000172, 0x00000173, 0x00000172, +0x00000174, 0x00000175, 0x00000174, +0x00000176, 0x00000177, 0x00000176, +0x00000178, 0x000000ff, 0x00000178, +0x00000179, 0x0000017a, 0x00000179, +0x0000017b, 0x0000017c, 0x0000017b, +0x0000017d, 0x0000017e, 0x0000017d, +0x00000181, 0x00000253, 0x00000181, +0x00000182, 0x00000183, 0x00000182, +0x00000184, 0x00000185, 0x00000184, +0x00000186, 0x00000254, 0x00000186, +0x00000187, 0x00000188, 0x00000187, +0x00000189, 0x00000256, 0x00000189, +0x0000018a, 0x00000257, 0x0000018a, +0x0000018b, 0x0000018c, 0x0000018b, +0x0000018e, 0x000001dd, 0x0000018e, +0x0000018f, 0x00000259, 0x0000018f, +0x00000190, 0x0000025b, 0x00000190, +0x00000191, 0x00000192, 0x00000191, +0x00000193, 0x00000260, 0x00000193, +0x00000194, 0x00000263, 0x00000194, +0x00000196, 0x00000269, 0x00000196, +0x00000197, 0x00000268, 0x00000197, +0x00000198, 0x00000199, 0x00000198, +0x0000019c, 0x0000026f, 0x0000019c, +0x0000019d, 0x00000272, 0x0000019d, +0x0000019f, 0x00000275, 0x0000019f, +0x000001a0, 0x000001a1, 0x000001a0, +0x000001a2, 0x000001a3, 0x000001a2, +0x000001a4, 0x000001a5, 0x000001a4, +0x000001a6, 0x00000280, 0x000001a6, +0x000001a7, 0x000001a8, 0x000001a7, +0x000001a9, 0x00000283, 0x000001a9, +0x000001ac, 0x000001ad, 0x000001ac, +0x000001ae, 0x00000288, 0x000001ae, +0x000001af, 0x000001b0, 0x000001af, +0x000001b1, 0x0000028a, 0x000001b1, +0x000001b2, 0x0000028b, 0x000001b2, +0x000001b3, 0x000001b4, 0x000001b3, +0x000001b5, 0x000001b6, 0x000001b5, +0x000001b7, 0x00000292, 0x000001b7, +0x000001b8, 0x000001b9, 0x000001b8, +0x000001bc, 0x000001bd, 0x000001bc, +0x000001c4, 0x000001c6, 0x000001c5, +0x000001c7, 0x000001c9, 0x000001c8, +0x000001ca, 0x000001cc, 0x000001cb, +0x000001cd, 0x000001ce, 0x000001cd, +0x000001cf, 0x000001d0, 0x000001cf, +0x000001d1, 0x000001d2, 0x000001d1, +0x000001d3, 0x000001d4, 0x000001d3, +0x000001d5, 0x000001d6, 0x000001d5, +0x000001d7, 0x000001d8, 0x000001d7, +0x000001d9, 0x000001da, 0x000001d9, +0x000001db, 0x000001dc, 0x000001db, +0x000001de, 0x000001df, 0x000001de, +0x000001e0, 0x000001e1, 0x000001e0, +0x000001e2, 0x000001e3, 0x000001e2, +0x000001e4, 0x000001e5, 0x000001e4, +0x000001e6, 0x000001e7, 0x000001e6, +0x000001e8, 0x000001e9, 0x000001e8, +0x000001ea, 0x000001eb, 0x000001ea, +0x000001ec, 0x000001ed, 0x000001ec, +0x000001ee, 0x000001ef, 0x000001ee, +0x000001f1, 0x000001f3, 0x000001f2, +0x000001f4, 0x000001f5, 0x000001f4, +0x000001f6, 0x00000195, 0x000001f6, +0x000001f7, 0x000001bf, 0x000001f7, +0x000001f8, 0x000001f9, 0x000001f8, +0x000001fa, 0x000001fb, 0x000001fa, +0x000001fc, 0x000001fd, 0x000001fc, +0x000001fe, 0x000001ff, 0x000001fe, +0x00000200, 0x00000201, 0x00000200, +0x00000202, 0x00000203, 0x00000202, +0x00000204, 0x00000205, 0x00000204, +0x00000206, 0x00000207, 0x00000206, +0x00000208, 0x00000209, 0x00000208, +0x0000020a, 0x0000020b, 0x0000020a, +0x0000020c, 0x0000020d, 0x0000020c, +0x0000020e, 0x0000020f, 0x0000020e, +0x00000210, 0x00000211, 0x00000210, +0x00000212, 0x00000213, 0x00000212, +0x00000214, 0x00000215, 0x00000214, +0x00000216, 0x00000217, 0x00000216, +0x00000218, 0x00000219, 0x00000218, +0x0000021a, 0x0000021b, 0x0000021a, +0x0000021c, 0x0000021d, 0x0000021c, +0x0000021e, 0x0000021f, 0x0000021e, +0x00000220, 0x0000019e, 0x00000220, +0x00000222, 0x00000223, 0x00000222, +0x00000224, 0x00000225, 0x00000224, +0x00000226, 0x00000227, 0x00000226, +0x00000228, 0x00000229, 0x00000228, +0x0000022a, 0x0000022b, 0x0000022a, +0x0000022c, 0x0000022d, 0x0000022c, +0x0000022e, 0x0000022f, 0x0000022e, +0x00000230, 0x00000231, 0x00000230, +0x00000232, 0x00000233, 0x00000232, +0x00000386, 0x000003ac, 0x00000386, +0x00000388, 0x000003ad, 0x00000388, +0x00000389, 0x000003ae, 0x00000389, +0x0000038a, 0x000003af, 0x0000038a, +0x0000038c, 0x000003cc, 0x0000038c, +0x0000038e, 0x000003cd, 0x0000038e, +0x0000038f, 0x000003ce, 0x0000038f, +0x00000391, 0x000003b1, 0x00000391, +0x00000392, 0x000003b2, 0x00000392, +0x00000393, 0x000003b3, 0x00000393, +0x00000394, 0x000003b4, 0x00000394, +0x00000395, 0x000003b5, 0x00000395, +0x00000396, 0x000003b6, 0x00000396, +0x00000397, 0x000003b7, 0x00000397, +0x00000398, 0x000003b8, 0x00000398, +0x00000399, 0x000003b9, 0x00000399, +0x0000039a, 0x000003ba, 0x0000039a, +0x0000039b, 0x000003bb, 0x0000039b, +0x0000039c, 0x000003bc, 0x0000039c, +0x0000039d, 0x000003bd, 0x0000039d, +0x0000039e, 0x000003be, 0x0000039e, +0x0000039f, 0x000003bf, 0x0000039f, +0x000003a0, 0x000003c0, 0x000003a0, +0x000003a1, 0x000003c1, 0x000003a1, +0x000003a3, 0x000003c3, 0x000003a3, +0x000003a4, 0x000003c4, 0x000003a4, +0x000003a5, 0x000003c5, 0x000003a5, +0x000003a6, 0x000003c6, 0x000003a6, +0x000003a7, 0x000003c7, 0x000003a7, +0x000003a8, 0x000003c8, 0x000003a8, +0x000003a9, 0x000003c9, 0x000003a9, +0x000003aa, 0x000003ca, 0x000003aa, +0x000003ab, 0x000003cb, 0x000003ab, +0x000003d8, 0x000003d9, 0x000003d8, +0x000003da, 0x000003db, 0x000003da, +0x000003dc, 0x000003dd, 0x000003dc, +0x000003de, 0x000003df, 0x000003de, +0x000003e0, 0x000003e1, 0x000003e0, +0x000003e2, 0x000003e3, 0x000003e2, +0x000003e4, 0x000003e5, 0x000003e4, +0x000003e6, 0x000003e7, 0x000003e6, +0x000003e8, 0x000003e9, 0x000003e8, +0x000003ea, 0x000003eb, 0x000003ea, +0x000003ec, 0x000003ed, 0x000003ec, +0x000003ee, 0x000003ef, 0x000003ee, +0x000003f4, 0x000003b8, 0x000003f4, +0x00000400, 0x00000450, 0x00000400, +0x00000401, 0x00000451, 0x00000401, +0x00000402, 0x00000452, 0x00000402, +0x00000403, 0x00000453, 0x00000403, +0x00000404, 0x00000454, 0x00000404, +0x00000405, 0x00000455, 0x00000405, +0x00000406, 0x00000456, 0x00000406, +0x00000407, 0x00000457, 0x00000407, +0x00000408, 0x00000458, 0x00000408, +0x00000409, 0x00000459, 0x00000409, +0x0000040a, 0x0000045a, 0x0000040a, +0x0000040b, 0x0000045b, 0x0000040b, +0x0000040c, 0x0000045c, 0x0000040c, +0x0000040d, 0x0000045d, 0x0000040d, +0x0000040e, 0x0000045e, 0x0000040e, +0x0000040f, 0x0000045f, 0x0000040f, +0x00000410, 0x00000430, 0x00000410, +0x00000411, 0x00000431, 0x00000411, +0x00000412, 0x00000432, 0x00000412, +0x00000413, 0x00000433, 0x00000413, +0x00000414, 0x00000434, 0x00000414, +0x00000415, 0x00000435, 0x00000415, +0x00000416, 0x00000436, 0x00000416, +0x00000417, 0x00000437, 0x00000417, +0x00000418, 0x00000438, 0x00000418, +0x00000419, 0x00000439, 0x00000419, +0x0000041a, 0x0000043a, 0x0000041a, +0x0000041b, 0x0000043b, 0x0000041b, +0x0000041c, 0x0000043c, 0x0000041c, +0x0000041d, 0x0000043d, 0x0000041d, +0x0000041e, 0x0000043e, 0x0000041e, +0x0000041f, 0x0000043f, 0x0000041f, +0x00000420, 0x00000440, 0x00000420, +0x00000421, 0x00000441, 0x00000421, +0x00000422, 0x00000442, 0x00000422, +0x00000423, 0x00000443, 0x00000423, +0x00000424, 0x00000444, 0x00000424, +0x00000425, 0x00000445, 0x00000425, +0x00000426, 0x00000446, 0x00000426, +0x00000427, 0x00000447, 0x00000427, +0x00000428, 0x00000448, 0x00000428, +0x00000429, 0x00000449, 0x00000429, +0x0000042a, 0x0000044a, 0x0000042a, +0x0000042b, 0x0000044b, 0x0000042b, +0x0000042c, 0x0000044c, 0x0000042c, +0x0000042d, 0x0000044d, 0x0000042d, +0x0000042e, 0x0000044e, 0x0000042e, +0x0000042f, 0x0000044f, 0x0000042f, +0x00000460, 0x00000461, 0x00000460, +0x00000462, 0x00000463, 0x00000462, +0x00000464, 0x00000465, 0x00000464, +0x00000466, 0x00000467, 0x00000466, +0x00000468, 0x00000469, 0x00000468, +0x0000046a, 0x0000046b, 0x0000046a, +0x0000046c, 0x0000046d, 0x0000046c, +0x0000046e, 0x0000046f, 0x0000046e, +0x00000470, 0x00000471, 0x00000470, +0x00000472, 0x00000473, 0x00000472, +0x00000474, 0x00000475, 0x00000474, +0x00000476, 0x00000477, 0x00000476, +0x00000478, 0x00000479, 0x00000478, +0x0000047a, 0x0000047b, 0x0000047a, +0x0000047c, 0x0000047d, 0x0000047c, +0x0000047e, 0x0000047f, 0x0000047e, +0x00000480, 0x00000481, 0x00000480, +0x0000048a, 0x0000048b, 0x0000048a, +0x0000048c, 0x0000048d, 0x0000048c, +0x0000048e, 0x0000048f, 0x0000048e, +0x00000490, 0x00000491, 0x00000490, +0x00000492, 0x00000493, 0x00000492, +0x00000494, 0x00000495, 0x00000494, +0x00000496, 0x00000497, 0x00000496, +0x00000498, 0x00000499, 0x00000498, +0x0000049a, 0x0000049b, 0x0000049a, +0x0000049c, 0x0000049d, 0x0000049c, +0x0000049e, 0x0000049f, 0x0000049e, +0x000004a0, 0x000004a1, 0x000004a0, +0x000004a2, 0x000004a3, 0x000004a2, +0x000004a4, 0x000004a5, 0x000004a4, +0x000004a6, 0x000004a7, 0x000004a6, +0x000004a8, 0x000004a9, 0x000004a8, +0x000004aa, 0x000004ab, 0x000004aa, +0x000004ac, 0x000004ad, 0x000004ac, +0x000004ae, 0x000004af, 0x000004ae, +0x000004b0, 0x000004b1, 0x000004b0, +0x000004b2, 0x000004b3, 0x000004b2, +0x000004b4, 0x000004b5, 0x000004b4, +0x000004b6, 0x000004b7, 0x000004b6, +0x000004b8, 0x000004b9, 0x000004b8, +0x000004ba, 0x000004bb, 0x000004ba, +0x000004bc, 0x000004bd, 0x000004bc, +0x000004be, 0x000004bf, 0x000004be, +0x000004c1, 0x000004c2, 0x000004c1, +0x000004c3, 0x000004c4, 0x000004c3, +0x000004c5, 0x000004c6, 0x000004c5, +0x000004c7, 0x000004c8, 0x000004c7, +0x000004c9, 0x000004ca, 0x000004c9, +0x000004cb, 0x000004cc, 0x000004cb, +0x000004cd, 0x000004ce, 0x000004cd, +0x000004d0, 0x000004d1, 0x000004d0, +0x000004d2, 0x000004d3, 0x000004d2, +0x000004d4, 0x000004d5, 0x000004d4, +0x000004d6, 0x000004d7, 0x000004d6, +0x000004d8, 0x000004d9, 0x000004d8, +0x000004da, 0x000004db, 0x000004da, +0x000004dc, 0x000004dd, 0x000004dc, +0x000004de, 0x000004df, 0x000004de, +0x000004e0, 0x000004e1, 0x000004e0, +0x000004e2, 0x000004e3, 0x000004e2, +0x000004e4, 0x000004e5, 0x000004e4, +0x000004e6, 0x000004e7, 0x000004e6, +0x000004e8, 0x000004e9, 0x000004e8, +0x000004ea, 0x000004eb, 0x000004ea, +0x000004ec, 0x000004ed, 0x000004ec, +0x000004ee, 0x000004ef, 0x000004ee, +0x000004f0, 0x000004f1, 0x000004f0, +0x000004f2, 0x000004f3, 0x000004f2, +0x000004f4, 0x000004f5, 0x000004f4, +0x000004f8, 0x000004f9, 0x000004f8, +0x00000500, 0x00000501, 0x00000500, +0x00000502, 0x00000503, 0x00000502, +0x00000504, 0x00000505, 0x00000504, +0x00000506, 0x00000507, 0x00000506, +0x00000508, 0x00000509, 0x00000508, +0x0000050a, 0x0000050b, 0x0000050a, +0x0000050c, 0x0000050d, 0x0000050c, +0x0000050e, 0x0000050f, 0x0000050e, +0x00000531, 0x00000561, 0x00000531, +0x00000532, 0x00000562, 0x00000532, +0x00000533, 0x00000563, 0x00000533, +0x00000534, 0x00000564, 0x00000534, +0x00000535, 0x00000565, 0x00000535, +0x00000536, 0x00000566, 0x00000536, +0x00000537, 0x00000567, 0x00000537, +0x00000538, 0x00000568, 0x00000538, +0x00000539, 0x00000569, 0x00000539, +0x0000053a, 0x0000056a, 0x0000053a, +0x0000053b, 0x0000056b, 0x0000053b, +0x0000053c, 0x0000056c, 0x0000053c, +0x0000053d, 0x0000056d, 0x0000053d, +0x0000053e, 0x0000056e, 0x0000053e, +0x0000053f, 0x0000056f, 0x0000053f, +0x00000540, 0x00000570, 0x00000540, +0x00000541, 0x00000571, 0x00000541, +0x00000542, 0x00000572, 0x00000542, +0x00000543, 0x00000573, 0x00000543, +0x00000544, 0x00000574, 0x00000544, +0x00000545, 0x00000575, 0x00000545, +0x00000546, 0x00000576, 0x00000546, +0x00000547, 0x00000577, 0x00000547, +0x00000548, 0x00000578, 0x00000548, +0x00000549, 0x00000579, 0x00000549, +0x0000054a, 0x0000057a, 0x0000054a, +0x0000054b, 0x0000057b, 0x0000054b, +0x0000054c, 0x0000057c, 0x0000054c, +0x0000054d, 0x0000057d, 0x0000054d, +0x0000054e, 0x0000057e, 0x0000054e, +0x0000054f, 0x0000057f, 0x0000054f, +0x00000550, 0x00000580, 0x00000550, +0x00000551, 0x00000581, 0x00000551, +0x00000552, 0x00000582, 0x00000552, +0x00000553, 0x00000583, 0x00000553, +0x00000554, 0x00000584, 0x00000554, +0x00000555, 0x00000585, 0x00000555, +0x00000556, 0x00000586, 0x00000556, +0x00001e00, 0x00001e01, 0x00001e00, +0x00001e02, 0x00001e03, 0x00001e02, +0x00001e04, 0x00001e05, 0x00001e04, +0x00001e06, 0x00001e07, 0x00001e06, +0x00001e08, 0x00001e09, 0x00001e08, +0x00001e0a, 0x00001e0b, 0x00001e0a, +0x00001e0c, 0x00001e0d, 0x00001e0c, +0x00001e0e, 0x00001e0f, 0x00001e0e, +0x00001e10, 0x00001e11, 0x00001e10, +0x00001e12, 0x00001e13, 0x00001e12, +0x00001e14, 0x00001e15, 0x00001e14, +0x00001e16, 0x00001e17, 0x00001e16, +0x00001e18, 0x00001e19, 0x00001e18, +0x00001e1a, 0x00001e1b, 0x00001e1a, +0x00001e1c, 0x00001e1d, 0x00001e1c, +0x00001e1e, 0x00001e1f, 0x00001e1e, +0x00001e20, 0x00001e21, 0x00001e20, +0x00001e22, 0x00001e23, 0x00001e22, +0x00001e24, 0x00001e25, 0x00001e24, +0x00001e26, 0x00001e27, 0x00001e26, +0x00001e28, 0x00001e29, 0x00001e28, +0x00001e2a, 0x00001e2b, 0x00001e2a, +0x00001e2c, 0x00001e2d, 0x00001e2c, +0x00001e2e, 0x00001e2f, 0x00001e2e, +0x00001e30, 0x00001e31, 0x00001e30, +0x00001e32, 0x00001e33, 0x00001e32, +0x00001e34, 0x00001e35, 0x00001e34, +0x00001e36, 0x00001e37, 0x00001e36, +0x00001e38, 0x00001e39, 0x00001e38, +0x00001e3a, 0x00001e3b, 0x00001e3a, +0x00001e3c, 0x00001e3d, 0x00001e3c, +0x00001e3e, 0x00001e3f, 0x00001e3e, +0x00001e40, 0x00001e41, 0x00001e40, +0x00001e42, 0x00001e43, 0x00001e42, +0x00001e44, 0x00001e45, 0x00001e44, +0x00001e46, 0x00001e47, 0x00001e46, +0x00001e48, 0x00001e49, 0x00001e48, +0x00001e4a, 0x00001e4b, 0x00001e4a, +0x00001e4c, 0x00001e4d, 0x00001e4c, +0x00001e4e, 0x00001e4f, 0x00001e4e, +0x00001e50, 0x00001e51, 0x00001e50, +0x00001e52, 0x00001e53, 0x00001e52, +0x00001e54, 0x00001e55, 0x00001e54, +0x00001e56, 0x00001e57, 0x00001e56, +0x00001e58, 0x00001e59, 0x00001e58, +0x00001e5a, 0x00001e5b, 0x00001e5a, +0x00001e5c, 0x00001e5d, 0x00001e5c, +0x00001e5e, 0x00001e5f, 0x00001e5e, +0x00001e60, 0x00001e61, 0x00001e60, +0x00001e62, 0x00001e63, 0x00001e62, +0x00001e64, 0x00001e65, 0x00001e64, +0x00001e66, 0x00001e67, 0x00001e66, +0x00001e68, 0x00001e69, 0x00001e68, +0x00001e6a, 0x00001e6b, 0x00001e6a, +0x00001e6c, 0x00001e6d, 0x00001e6c, +0x00001e6e, 0x00001e6f, 0x00001e6e, +0x00001e70, 0x00001e71, 0x00001e70, +0x00001e72, 0x00001e73, 0x00001e72, +0x00001e74, 0x00001e75, 0x00001e74, +0x00001e76, 0x00001e77, 0x00001e76, +0x00001e78, 0x00001e79, 0x00001e78, +0x00001e7a, 0x00001e7b, 0x00001e7a, +0x00001e7c, 0x00001e7d, 0x00001e7c, +0x00001e7e, 0x00001e7f, 0x00001e7e, +0x00001e80, 0x00001e81, 0x00001e80, +0x00001e82, 0x00001e83, 0x00001e82, +0x00001e84, 0x00001e85, 0x00001e84, +0x00001e86, 0x00001e87, 0x00001e86, +0x00001e88, 0x00001e89, 0x00001e88, +0x00001e8a, 0x00001e8b, 0x00001e8a, +0x00001e8c, 0x00001e8d, 0x00001e8c, +0x00001e8e, 0x00001e8f, 0x00001e8e, +0x00001e90, 0x00001e91, 0x00001e90, +0x00001e92, 0x00001e93, 0x00001e92, +0x00001e94, 0x00001e95, 0x00001e94, +0x00001ea0, 0x00001ea1, 0x00001ea0, +0x00001ea2, 0x00001ea3, 0x00001ea2, +0x00001ea4, 0x00001ea5, 0x00001ea4, +0x00001ea6, 0x00001ea7, 0x00001ea6, +0x00001ea8, 0x00001ea9, 0x00001ea8, +0x00001eaa, 0x00001eab, 0x00001eaa, +0x00001eac, 0x00001ead, 0x00001eac, +0x00001eae, 0x00001eaf, 0x00001eae, +0x00001eb0, 0x00001eb1, 0x00001eb0, +0x00001eb2, 0x00001eb3, 0x00001eb2, +0x00001eb4, 0x00001eb5, 0x00001eb4, +0x00001eb6, 0x00001eb7, 0x00001eb6, +0x00001eb8, 0x00001eb9, 0x00001eb8, +0x00001eba, 0x00001ebb, 0x00001eba, +0x00001ebc, 0x00001ebd, 0x00001ebc, +0x00001ebe, 0x00001ebf, 0x00001ebe, +0x00001ec0, 0x00001ec1, 0x00001ec0, +0x00001ec2, 0x00001ec3, 0x00001ec2, +0x00001ec4, 0x00001ec5, 0x00001ec4, +0x00001ec6, 0x00001ec7, 0x00001ec6, +0x00001ec8, 0x00001ec9, 0x00001ec8, +0x00001eca, 0x00001ecb, 0x00001eca, +0x00001ecc, 0x00001ecd, 0x00001ecc, +0x00001ece, 0x00001ecf, 0x00001ece, +0x00001ed0, 0x00001ed1, 0x00001ed0, +0x00001ed2, 0x00001ed3, 0x00001ed2, +0x00001ed4, 0x00001ed5, 0x00001ed4, +0x00001ed6, 0x00001ed7, 0x00001ed6, +0x00001ed8, 0x00001ed9, 0x00001ed8, +0x00001eda, 0x00001edb, 0x00001eda, +0x00001edc, 0x00001edd, 0x00001edc, +0x00001ede, 0x00001edf, 0x00001ede, +0x00001ee0, 0x00001ee1, 0x00001ee0, +0x00001ee2, 0x00001ee3, 0x00001ee2, +0x00001ee4, 0x00001ee5, 0x00001ee4, +0x00001ee6, 0x00001ee7, 0x00001ee6, +0x00001ee8, 0x00001ee9, 0x00001ee8, +0x00001eea, 0x00001eeb, 0x00001eea, +0x00001eec, 0x00001eed, 0x00001eec, +0x00001eee, 0x00001eef, 0x00001eee, +0x00001ef0, 0x00001ef1, 0x00001ef0, +0x00001ef2, 0x00001ef3, 0x00001ef2, +0x00001ef4, 0x00001ef5, 0x00001ef4, +0x00001ef6, 0x00001ef7, 0x00001ef6, +0x00001ef8, 0x00001ef9, 0x00001ef8, +0x00001f08, 0x00001f00, 0x00001f08, +0x00001f09, 0x00001f01, 0x00001f09, +0x00001f0a, 0x00001f02, 0x00001f0a, +0x00001f0b, 0x00001f03, 0x00001f0b, +0x00001f0c, 0x00001f04, 0x00001f0c, +0x00001f0d, 0x00001f05, 0x00001f0d, +0x00001f0e, 0x00001f06, 0x00001f0e, +0x00001f0f, 0x00001f07, 0x00001f0f, +0x00001f18, 0x00001f10, 0x00001f18, +0x00001f19, 0x00001f11, 0x00001f19, +0x00001f1a, 0x00001f12, 0x00001f1a, +0x00001f1b, 0x00001f13, 0x00001f1b, +0x00001f1c, 0x00001f14, 0x00001f1c, +0x00001f1d, 0x00001f15, 0x00001f1d, +0x00001f28, 0x00001f20, 0x00001f28, +0x00001f29, 0x00001f21, 0x00001f29, +0x00001f2a, 0x00001f22, 0x00001f2a, +0x00001f2b, 0x00001f23, 0x00001f2b, +0x00001f2c, 0x00001f24, 0x00001f2c, +0x00001f2d, 0x00001f25, 0x00001f2d, +0x00001f2e, 0x00001f26, 0x00001f2e, +0x00001f2f, 0x00001f27, 0x00001f2f, +0x00001f38, 0x00001f30, 0x00001f38, +0x00001f39, 0x00001f31, 0x00001f39, +0x00001f3a, 0x00001f32, 0x00001f3a, +0x00001f3b, 0x00001f33, 0x00001f3b, +0x00001f3c, 0x00001f34, 0x00001f3c, +0x00001f3d, 0x00001f35, 0x00001f3d, +0x00001f3e, 0x00001f36, 0x00001f3e, +0x00001f3f, 0x00001f37, 0x00001f3f, +0x00001f48, 0x00001f40, 0x00001f48, +0x00001f49, 0x00001f41, 0x00001f49, +0x00001f4a, 0x00001f42, 0x00001f4a, +0x00001f4b, 0x00001f43, 0x00001f4b, +0x00001f4c, 0x00001f44, 0x00001f4c, +0x00001f4d, 0x00001f45, 0x00001f4d, +0x00001f59, 0x00001f51, 0x00001f59, +0x00001f5b, 0x00001f53, 0x00001f5b, +0x00001f5d, 0x00001f55, 0x00001f5d, +0x00001f5f, 0x00001f57, 0x00001f5f, +0x00001f68, 0x00001f60, 0x00001f68, +0x00001f69, 0x00001f61, 0x00001f69, +0x00001f6a, 0x00001f62, 0x00001f6a, +0x00001f6b, 0x00001f63, 0x00001f6b, +0x00001f6c, 0x00001f64, 0x00001f6c, +0x00001f6d, 0x00001f65, 0x00001f6d, +0x00001f6e, 0x00001f66, 0x00001f6e, +0x00001f6f, 0x00001f67, 0x00001f6f, +0x00001f88, 0x00001f80, 0x00001f88, +0x00001f89, 0x00001f81, 0x00001f89, +0x00001f8a, 0x00001f82, 0x00001f8a, +0x00001f8b, 0x00001f83, 0x00001f8b, +0x00001f8c, 0x00001f84, 0x00001f8c, +0x00001f8d, 0x00001f85, 0x00001f8d, +0x00001f8e, 0x00001f86, 0x00001f8e, +0x00001f8f, 0x00001f87, 0x00001f8f, +0x00001f98, 0x00001f90, 0x00001f98, +0x00001f99, 0x00001f91, 0x00001f99, +0x00001f9a, 0x00001f92, 0x00001f9a, +0x00001f9b, 0x00001f93, 0x00001f9b, +0x00001f9c, 0x00001f94, 0x00001f9c, +0x00001f9d, 0x00001f95, 0x00001f9d, +0x00001f9e, 0x00001f96, 0x00001f9e, +0x00001f9f, 0x00001f97, 0x00001f9f, +0x00001fa8, 0x00001fa0, 0x00001fa8, +0x00001fa9, 0x00001fa1, 0x00001fa9, +0x00001faa, 0x00001fa2, 0x00001faa, +0x00001fab, 0x00001fa3, 0x00001fab, +0x00001fac, 0x00001fa4, 0x00001fac, +0x00001fad, 0x00001fa5, 0x00001fad, +0x00001fae, 0x00001fa6, 0x00001fae, +0x00001faf, 0x00001fa7, 0x00001faf, +0x00001fb8, 0x00001fb0, 0x00001fb8, +0x00001fb9, 0x00001fb1, 0x00001fb9, +0x00001fba, 0x00001f70, 0x00001fba, +0x00001fbb, 0x00001f71, 0x00001fbb, +0x00001fbc, 0x00001fb3, 0x00001fbc, +0x00001fc8, 0x00001f72, 0x00001fc8, +0x00001fc9, 0x00001f73, 0x00001fc9, +0x00001fca, 0x00001f74, 0x00001fca, +0x00001fcb, 0x00001f75, 0x00001fcb, +0x00001fcc, 0x00001fc3, 0x00001fcc, +0x00001fd8, 0x00001fd0, 0x00001fd8, +0x00001fd9, 0x00001fd1, 0x00001fd9, +0x00001fda, 0x00001f76, 0x00001fda, +0x00001fdb, 0x00001f77, 0x00001fdb, +0x00001fe8, 0x00001fe0, 0x00001fe8, +0x00001fe9, 0x00001fe1, 0x00001fe9, +0x00001fea, 0x00001f7a, 0x00001fea, +0x00001feb, 0x00001f7b, 0x00001feb, +0x00001fec, 0x00001fe5, 0x00001fec, +0x00001ff8, 0x00001f78, 0x00001ff8, +0x00001ff9, 0x00001f79, 0x00001ff9, +0x00001ffa, 0x00001f7c, 0x00001ffa, +0x00001ffb, 0x00001f7d, 0x00001ffb, +0x00001ffc, 0x00001ff3, 0x00001ffc, +0x00002126, 0x000003c9, 0x00002126, +0x0000212a, 0x0000006b, 0x0000212a, +0x0000212b, 0x000000e5, 0x0000212b, +0x00002160, 0x00002170, 0x00002160, +0x00002161, 0x00002171, 0x00002161, +0x00002162, 0x00002172, 0x00002162, +0x00002163, 0x00002173, 0x00002163, +0x00002164, 0x00002174, 0x00002164, +0x00002165, 0x00002175, 0x00002165, +0x00002166, 0x00002176, 0x00002166, +0x00002167, 0x00002177, 0x00002167, +0x00002168, 0x00002178, 0x00002168, +0x00002169, 0x00002179, 0x00002169, +0x0000216a, 0x0000217a, 0x0000216a, +0x0000216b, 0x0000217b, 0x0000216b, +0x0000216c, 0x0000217c, 0x0000216c, +0x0000216d, 0x0000217d, 0x0000216d, +0x0000216e, 0x0000217e, 0x0000216e, +0x0000216f, 0x0000217f, 0x0000216f, +0x000024b6, 0x000024d0, 0x000024b6, +0x000024b7, 0x000024d1, 0x000024b7, +0x000024b8, 0x000024d2, 0x000024b8, +0x000024b9, 0x000024d3, 0x000024b9, +0x000024ba, 0x000024d4, 0x000024ba, +0x000024bb, 0x000024d5, 0x000024bb, +0x000024bc, 0x000024d6, 0x000024bc, +0x000024bd, 0x000024d7, 0x000024bd, +0x000024be, 0x000024d8, 0x000024be, +0x000024bf, 0x000024d9, 0x000024bf, +0x000024c0, 0x000024da, 0x000024c0, +0x000024c1, 0x000024db, 0x000024c1, +0x000024c2, 0x000024dc, 0x000024c2, +0x000024c3, 0x000024dd, 0x000024c3, +0x000024c4, 0x000024de, 0x000024c4, +0x000024c5, 0x000024df, 0x000024c5, +0x000024c6, 0x000024e0, 0x000024c6, +0x000024c7, 0x000024e1, 0x000024c7, +0x000024c8, 0x000024e2, 0x000024c8, +0x000024c9, 0x000024e3, 0x000024c9, +0x000024ca, 0x000024e4, 0x000024ca, +0x000024cb, 0x000024e5, 0x000024cb, +0x000024cc, 0x000024e6, 0x000024cc, +0x000024cd, 0x000024e7, 0x000024cd, +0x000024ce, 0x000024e8, 0x000024ce, +0x000024cf, 0x000024e9, 0x000024cf, +0x0000ff21, 0x0000ff41, 0x0000ff21, +0x0000ff22, 0x0000ff42, 0x0000ff22, +0x0000ff23, 0x0000ff43, 0x0000ff23, +0x0000ff24, 0x0000ff44, 0x0000ff24, +0x0000ff25, 0x0000ff45, 0x0000ff25, +0x0000ff26, 0x0000ff46, 0x0000ff26, +0x0000ff27, 0x0000ff47, 0x0000ff27, +0x0000ff28, 0x0000ff48, 0x0000ff28, +0x0000ff29, 0x0000ff49, 0x0000ff29, +0x0000ff2a, 0x0000ff4a, 0x0000ff2a, +0x0000ff2b, 0x0000ff4b, 0x0000ff2b, +0x0000ff2c, 0x0000ff4c, 0x0000ff2c, +0x0000ff2d, 0x0000ff4d, 0x0000ff2d, +0x0000ff2e, 0x0000ff4e, 0x0000ff2e, +0x0000ff2f, 0x0000ff4f, 0x0000ff2f, +0x0000ff30, 0x0000ff50, 0x0000ff30, +0x0000ff31, 0x0000ff51, 0x0000ff31, +0x0000ff32, 0x0000ff52, 0x0000ff32, +0x0000ff33, 0x0000ff53, 0x0000ff33, +0x0000ff34, 0x0000ff54, 0x0000ff34, +0x0000ff35, 0x0000ff55, 0x0000ff35, +0x0000ff36, 0x0000ff56, 0x0000ff36, +0x0000ff37, 0x0000ff57, 0x0000ff37, +0x0000ff38, 0x0000ff58, 0x0000ff38, +0x0000ff39, 0x0000ff59, 0x0000ff39, +0x0000ff3a, 0x0000ff5a, 0x0000ff3a, +0x00010400, 0x00010428, 0x00010400, +0x00010401, 0x00010429, 0x00010401, +0x00010402, 0x0001042a, 0x00010402, +0x00010403, 0x0001042b, 0x00010403, +0x00010404, 0x0001042c, 0x00010404, +0x00010405, 0x0001042d, 0x00010405, +0x00010406, 0x0001042e, 0x00010406, +0x00010407, 0x0001042f, 0x00010407, +0x00010408, 0x00010430, 0x00010408, +0x00010409, 0x00010431, 0x00010409, +0x0001040a, 0x00010432, 0x0001040a, +0x0001040b, 0x00010433, 0x0001040b, +0x0001040c, 0x00010434, 0x0001040c, +0x0001040d, 0x00010435, 0x0001040d, +0x0001040e, 0x00010436, 0x0001040e, +0x0001040f, 0x00010437, 0x0001040f, +0x00010410, 0x00010438, 0x00010410, +0x00010411, 0x00010439, 0x00010411, +0x00010412, 0x0001043a, 0x00010412, +0x00010413, 0x0001043b, 0x00010413, +0x00010414, 0x0001043c, 0x00010414, +0x00010415, 0x0001043d, 0x00010415, +0x00010416, 0x0001043e, 0x00010416, +0x00010417, 0x0001043f, 0x00010417, +0x00010418, 0x00010440, 0x00010418, +0x00010419, 0x00010441, 0x00010419, +0x0001041a, 0x00010442, 0x0001041a, +0x0001041b, 0x00010443, 0x0001041b, +0x0001041c, 0x00010444, 0x0001041c, +0x0001041d, 0x00010445, 0x0001041d, +0x0001041e, 0x00010446, 0x0001041e, +0x0001041f, 0x00010447, 0x0001041f, +0x00010420, 0x00010448, 0x00010420, +0x00010421, 0x00010449, 0x00010421, +0x00010422, 0x0001044a, 0x00010422, +0x00010423, 0x0001044b, 0x00010423, +0x00010424, 0x0001044c, 0x00010424, +0x00010425, 0x0001044d, 0x00010425, +/* lower */ +0x00000061, 0x00000041, 0x00000041, +0x00000062, 0x00000042, 0x00000042, +0x00000063, 0x00000043, 0x00000043, +0x00000064, 0x00000044, 0x00000044, +0x00000065, 0x00000045, 0x00000045, +0x00000066, 0x00000046, 0x00000046, +0x00000067, 0x00000047, 0x00000047, +0x00000068, 0x00000048, 0x00000048, +0x00000069, 0x00000049, 0x00000049, +0x0000006a, 0x0000004a, 0x0000004a, +0x0000006b, 0x0000004b, 0x0000004b, +0x0000006c, 0x0000004c, 0x0000004c, +0x0000006d, 0x0000004d, 0x0000004d, +0x0000006e, 0x0000004e, 0x0000004e, +0x0000006f, 0x0000004f, 0x0000004f, +0x00000070, 0x00000050, 0x00000050, +0x00000071, 0x00000051, 0x00000051, +0x00000072, 0x00000052, 0x00000052, +0x00000073, 0x00000053, 0x00000053, +0x00000074, 0x00000054, 0x00000054, +0x00000075, 0x00000055, 0x00000055, +0x00000076, 0x00000056, 0x00000056, +0x00000077, 0x00000057, 0x00000057, +0x00000078, 0x00000058, 0x00000058, +0x00000079, 0x00000059, 0x00000059, +0x0000007a, 0x0000005a, 0x0000005a, +0x000000b5, 0x0000039c, 0x0000039c, +0x000000e0, 0x000000c0, 0x000000c0, +0x000000e1, 0x000000c1, 0x000000c1, +0x000000e2, 0x000000c2, 0x000000c2, +0x000000e3, 0x000000c3, 0x000000c3, +0x000000e4, 0x000000c4, 0x000000c4, +0x000000e5, 0x000000c5, 0x000000c5, +0x000000e6, 0x000000c6, 0x000000c6, +0x000000e7, 0x000000c7, 0x000000c7, +0x000000e8, 0x000000c8, 0x000000c8, +0x000000e9, 0x000000c9, 0x000000c9, +0x000000ea, 0x000000ca, 0x000000ca, +0x000000eb, 0x000000cb, 0x000000cb, +0x000000ec, 0x000000cc, 0x000000cc, +0x000000ed, 0x000000cd, 0x000000cd, +0x000000ee, 0x000000ce, 0x000000ce, +0x000000ef, 0x000000cf, 0x000000cf, +0x000000f0, 0x000000d0, 0x000000d0, +0x000000f1, 0x000000d1, 0x000000d1, +0x000000f2, 0x000000d2, 0x000000d2, +0x000000f3, 0x000000d3, 0x000000d3, +0x000000f4, 0x000000d4, 0x000000d4, +0x000000f5, 0x000000d5, 0x000000d5, +0x000000f6, 0x000000d6, 0x000000d6, +0x000000f8, 0x000000d8, 0x000000d8, +0x000000f9, 0x000000d9, 0x000000d9, +0x000000fa, 0x000000da, 0x000000da, +0x000000fb, 0x000000db, 0x000000db, +0x000000fc, 0x000000dc, 0x000000dc, +0x000000fd, 0x000000dd, 0x000000dd, +0x000000fe, 0x000000de, 0x000000de, +0x000000ff, 0x00000178, 0x00000178, +0x00000101, 0x00000100, 0x00000100, +0x00000103, 0x00000102, 0x00000102, +0x00000105, 0x00000104, 0x00000104, +0x00000107, 0x00000106, 0x00000106, +0x00000109, 0x00000108, 0x00000108, +0x0000010b, 0x0000010a, 0x0000010a, +0x0000010d, 0x0000010c, 0x0000010c, +0x0000010f, 0x0000010e, 0x0000010e, +0x00000111, 0x00000110, 0x00000110, +0x00000113, 0x00000112, 0x00000112, +0x00000115, 0x00000114, 0x00000114, +0x00000117, 0x00000116, 0x00000116, +0x00000119, 0x00000118, 0x00000118, +0x0000011b, 0x0000011a, 0x0000011a, +0x0000011d, 0x0000011c, 0x0000011c, +0x0000011f, 0x0000011e, 0x0000011e, +0x00000121, 0x00000120, 0x00000120, +0x00000123, 0x00000122, 0x00000122, +0x00000125, 0x00000124, 0x00000124, +0x00000127, 0x00000126, 0x00000126, +0x00000129, 0x00000128, 0x00000128, +0x0000012b, 0x0000012a, 0x0000012a, +0x0000012d, 0x0000012c, 0x0000012c, +0x0000012f, 0x0000012e, 0x0000012e, +0x00000131, 0x00000049, 0x00000049, +0x00000133, 0x00000132, 0x00000132, +0x00000135, 0x00000134, 0x00000134, +0x00000137, 0x00000136, 0x00000136, +0x0000013a, 0x00000139, 0x00000139, +0x0000013c, 0x0000013b, 0x0000013b, +0x0000013e, 0x0000013d, 0x0000013d, +0x00000140, 0x0000013f, 0x0000013f, +0x00000142, 0x00000141, 0x00000141, +0x00000144, 0x00000143, 0x00000143, +0x00000146, 0x00000145, 0x00000145, +0x00000148, 0x00000147, 0x00000147, +0x0000014b, 0x0000014a, 0x0000014a, +0x0000014d, 0x0000014c, 0x0000014c, +0x0000014f, 0x0000014e, 0x0000014e, +0x00000151, 0x00000150, 0x00000150, +0x00000153, 0x00000152, 0x00000152, +0x00000155, 0x00000154, 0x00000154, +0x00000157, 0x00000156, 0x00000156, +0x00000159, 0x00000158, 0x00000158, +0x0000015b, 0x0000015a, 0x0000015a, +0x0000015d, 0x0000015c, 0x0000015c, +0x0000015f, 0x0000015e, 0x0000015e, +0x00000161, 0x00000160, 0x00000160, +0x00000163, 0x00000162, 0x00000162, +0x00000165, 0x00000164, 0x00000164, +0x00000167, 0x00000166, 0x00000166, +0x00000169, 0x00000168, 0x00000168, +0x0000016b, 0x0000016a, 0x0000016a, +0x0000016d, 0x0000016c, 0x0000016c, +0x0000016f, 0x0000016e, 0x0000016e, +0x00000171, 0x00000170, 0x00000170, +0x00000173, 0x00000172, 0x00000172, +0x00000175, 0x00000174, 0x00000174, +0x00000177, 0x00000176, 0x00000176, +0x0000017a, 0x00000179, 0x00000179, +0x0000017c, 0x0000017b, 0x0000017b, +0x0000017e, 0x0000017d, 0x0000017d, +0x0000017f, 0x00000053, 0x00000053, +0x00000183, 0x00000182, 0x00000182, +0x00000185, 0x00000184, 0x00000184, +0x00000188, 0x00000187, 0x00000187, +0x0000018c, 0x0000018b, 0x0000018b, +0x00000192, 0x00000191, 0x00000191, +0x00000195, 0x000001f6, 0x000001f6, +0x00000199, 0x00000198, 0x00000198, +0x0000019e, 0x00000220, 0x00000220, +0x000001a1, 0x000001a0, 0x000001a0, +0x000001a3, 0x000001a2, 0x000001a2, +0x000001a5, 0x000001a4, 0x000001a4, +0x000001a8, 0x000001a7, 0x000001a7, +0x000001ad, 0x000001ac, 0x000001ac, +0x000001b0, 0x000001af, 0x000001af, +0x000001b4, 0x000001b3, 0x000001b3, +0x000001b6, 0x000001b5, 0x000001b5, +0x000001b9, 0x000001b8, 0x000001b8, +0x000001bd, 0x000001bc, 0x000001bc, +0x000001bf, 0x000001f7, 0x000001f7, +0x000001c6, 0x000001c4, 0x000001c5, +0x000001c9, 0x000001c7, 0x000001c8, +0x000001cc, 0x000001ca, 0x000001cb, +0x000001ce, 0x000001cd, 0x000001cd, +0x000001d0, 0x000001cf, 0x000001cf, +0x000001d2, 0x000001d1, 0x000001d1, +0x000001d4, 0x000001d3, 0x000001d3, +0x000001d6, 0x000001d5, 0x000001d5, +0x000001d8, 0x000001d7, 0x000001d7, +0x000001da, 0x000001d9, 0x000001d9, +0x000001dc, 0x000001db, 0x000001db, +0x000001dd, 0x0000018e, 0x0000018e, +0x000001df, 0x000001de, 0x000001de, +0x000001e1, 0x000001e0, 0x000001e0, +0x000001e3, 0x000001e2, 0x000001e2, +0x000001e5, 0x000001e4, 0x000001e4, +0x000001e7, 0x000001e6, 0x000001e6, +0x000001e9, 0x000001e8, 0x000001e8, +0x000001eb, 0x000001ea, 0x000001ea, +0x000001ed, 0x000001ec, 0x000001ec, +0x000001ef, 0x000001ee, 0x000001ee, +0x000001f3, 0x000001f1, 0x000001f2, +0x000001f5, 0x000001f4, 0x000001f4, +0x000001f9, 0x000001f8, 0x000001f8, +0x000001fb, 0x000001fa, 0x000001fa, +0x000001fd, 0x000001fc, 0x000001fc, +0x000001ff, 0x000001fe, 0x000001fe, +0x00000201, 0x00000200, 0x00000200, +0x00000203, 0x00000202, 0x00000202, +0x00000205, 0x00000204, 0x00000204, +0x00000207, 0x00000206, 0x00000206, +0x00000209, 0x00000208, 0x00000208, +0x0000020b, 0x0000020a, 0x0000020a, +0x0000020d, 0x0000020c, 0x0000020c, +0x0000020f, 0x0000020e, 0x0000020e, +0x00000211, 0x00000210, 0x00000210, +0x00000213, 0x00000212, 0x00000212, +0x00000215, 0x00000214, 0x00000214, +0x00000217, 0x00000216, 0x00000216, +0x00000219, 0x00000218, 0x00000218, +0x0000021b, 0x0000021a, 0x0000021a, +0x0000021d, 0x0000021c, 0x0000021c, +0x0000021f, 0x0000021e, 0x0000021e, +0x00000223, 0x00000222, 0x00000222, +0x00000225, 0x00000224, 0x00000224, +0x00000227, 0x00000226, 0x00000226, +0x00000229, 0x00000228, 0x00000228, +0x0000022b, 0x0000022a, 0x0000022a, +0x0000022d, 0x0000022c, 0x0000022c, +0x0000022f, 0x0000022e, 0x0000022e, +0x00000231, 0x00000230, 0x00000230, +0x00000233, 0x00000232, 0x00000232, +0x00000253, 0x00000181, 0x00000181, +0x00000254, 0x00000186, 0x00000186, +0x00000256, 0x00000189, 0x00000189, +0x00000257, 0x0000018a, 0x0000018a, +0x00000259, 0x0000018f, 0x0000018f, +0x0000025b, 0x00000190, 0x00000190, +0x00000260, 0x00000193, 0x00000193, +0x00000263, 0x00000194, 0x00000194, +0x00000268, 0x00000197, 0x00000197, +0x00000269, 0x00000196, 0x00000196, +0x0000026f, 0x0000019c, 0x0000019c, +0x00000272, 0x0000019d, 0x0000019d, +0x00000275, 0x0000019f, 0x0000019f, +0x00000280, 0x000001a6, 0x000001a6, +0x00000283, 0x000001a9, 0x000001a9, +0x00000288, 0x000001ae, 0x000001ae, +0x0000028a, 0x000001b1, 0x000001b1, +0x0000028b, 0x000001b2, 0x000001b2, +0x00000292, 0x000001b7, 0x000001b7, +0x00000345, 0x00000399, 0x00000399, +0x000003ac, 0x00000386, 0x00000386, +0x000003ad, 0x00000388, 0x00000388, +0x000003ae, 0x00000389, 0x00000389, +0x000003af, 0x0000038a, 0x0000038a, +0x000003b1, 0x00000391, 0x00000391, +0x000003b2, 0x00000392, 0x00000392, +0x000003b3, 0x00000393, 0x00000393, +0x000003b4, 0x00000394, 0x00000394, +0x000003b5, 0x00000395, 0x00000395, +0x000003b6, 0x00000396, 0x00000396, +0x000003b7, 0x00000397, 0x00000397, +0x000003b8, 0x00000398, 0x00000398, +0x000003b9, 0x00000399, 0x00000399, +0x000003ba, 0x0000039a, 0x0000039a, +0x000003bb, 0x0000039b, 0x0000039b, +0x000003bc, 0x0000039c, 0x0000039c, +0x000003bd, 0x0000039d, 0x0000039d, +0x000003be, 0x0000039e, 0x0000039e, +0x000003bf, 0x0000039f, 0x0000039f, +0x000003c0, 0x000003a0, 0x000003a0, +0x000003c1, 0x000003a1, 0x000003a1, +0x000003c2, 0x000003a3, 0x000003a3, +0x000003c3, 0x000003a3, 0x000003a3, +0x000003c4, 0x000003a4, 0x000003a4, +0x000003c5, 0x000003a5, 0x000003a5, +0x000003c6, 0x000003a6, 0x000003a6, +0x000003c7, 0x000003a7, 0x000003a7, +0x000003c8, 0x000003a8, 0x000003a8, +0x000003c9, 0x000003a9, 0x000003a9, +0x000003ca, 0x000003aa, 0x000003aa, +0x000003cb, 0x000003ab, 0x000003ab, +0x000003cc, 0x0000038c, 0x0000038c, +0x000003cd, 0x0000038e, 0x0000038e, +0x000003ce, 0x0000038f, 0x0000038f, +0x000003d0, 0x00000392, 0x00000392, +0x000003d1, 0x00000398, 0x00000398, +0x000003d5, 0x000003a6, 0x000003a6, +0x000003d6, 0x000003a0, 0x000003a0, +0x000003d9, 0x000003d8, 0x000003d8, +0x000003db, 0x000003da, 0x000003da, +0x000003dd, 0x000003dc, 0x000003dc, +0x000003df, 0x000003de, 0x000003de, +0x000003e1, 0x000003e0, 0x000003e0, +0x000003e3, 0x000003e2, 0x000003e2, +0x000003e5, 0x000003e4, 0x000003e4, +0x000003e7, 0x000003e6, 0x000003e6, +0x000003e9, 0x000003e8, 0x000003e8, +0x000003eb, 0x000003ea, 0x000003ea, +0x000003ed, 0x000003ec, 0x000003ec, +0x000003ef, 0x000003ee, 0x000003ee, +0x000003f0, 0x0000039a, 0x0000039a, +0x000003f1, 0x000003a1, 0x000003a1, +0x000003f2, 0x000003a3, 0x000003a3, +0x000003f5, 0x00000395, 0x00000395, +0x00000430, 0x00000410, 0x00000410, +0x00000431, 0x00000411, 0x00000411, +0x00000432, 0x00000412, 0x00000412, +0x00000433, 0x00000413, 0x00000413, +0x00000434, 0x00000414, 0x00000414, +0x00000435, 0x00000415, 0x00000415, +0x00000436, 0x00000416, 0x00000416, +0x00000437, 0x00000417, 0x00000417, +0x00000438, 0x00000418, 0x00000418, +0x00000439, 0x00000419, 0x00000419, +0x0000043a, 0x0000041a, 0x0000041a, +0x0000043b, 0x0000041b, 0x0000041b, +0x0000043c, 0x0000041c, 0x0000041c, +0x0000043d, 0x0000041d, 0x0000041d, +0x0000043e, 0x0000041e, 0x0000041e, +0x0000043f, 0x0000041f, 0x0000041f, +0x00000440, 0x00000420, 0x00000420, +0x00000441, 0x00000421, 0x00000421, +0x00000442, 0x00000422, 0x00000422, +0x00000443, 0x00000423, 0x00000423, +0x00000444, 0x00000424, 0x00000424, +0x00000445, 0x00000425, 0x00000425, +0x00000446, 0x00000426, 0x00000426, +0x00000447, 0x00000427, 0x00000427, +0x00000448, 0x00000428, 0x00000428, +0x00000449, 0x00000429, 0x00000429, +0x0000044a, 0x0000042a, 0x0000042a, +0x0000044b, 0x0000042b, 0x0000042b, +0x0000044c, 0x0000042c, 0x0000042c, +0x0000044d, 0x0000042d, 0x0000042d, +0x0000044e, 0x0000042e, 0x0000042e, +0x0000044f, 0x0000042f, 0x0000042f, +0x00000450, 0x00000400, 0x00000400, +0x00000451, 0x00000401, 0x00000401, +0x00000452, 0x00000402, 0x00000402, +0x00000453, 0x00000403, 0x00000403, +0x00000454, 0x00000404, 0x00000404, +0x00000455, 0x00000405, 0x00000405, +0x00000456, 0x00000406, 0x00000406, +0x00000457, 0x00000407, 0x00000407, +0x00000458, 0x00000408, 0x00000408, +0x00000459, 0x00000409, 0x00000409, +0x0000045a, 0x0000040a, 0x0000040a, +0x0000045b, 0x0000040b, 0x0000040b, +0x0000045c, 0x0000040c, 0x0000040c, +0x0000045d, 0x0000040d, 0x0000040d, +0x0000045e, 0x0000040e, 0x0000040e, +0x0000045f, 0x0000040f, 0x0000040f, +0x00000461, 0x00000460, 0x00000460, +0x00000463, 0x00000462, 0x00000462, +0x00000465, 0x00000464, 0x00000464, +0x00000467, 0x00000466, 0x00000466, +0x00000469, 0x00000468, 0x00000468, +0x0000046b, 0x0000046a, 0x0000046a, +0x0000046d, 0x0000046c, 0x0000046c, +0x0000046f, 0x0000046e, 0x0000046e, +0x00000471, 0x00000470, 0x00000470, +0x00000473, 0x00000472, 0x00000472, +0x00000475, 0x00000474, 0x00000474, +0x00000477, 0x00000476, 0x00000476, +0x00000479, 0x00000478, 0x00000478, +0x0000047b, 0x0000047a, 0x0000047a, +0x0000047d, 0x0000047c, 0x0000047c, +0x0000047f, 0x0000047e, 0x0000047e, +0x00000481, 0x00000480, 0x00000480, +0x0000048b, 0x0000048a, 0x0000048a, +0x0000048d, 0x0000048c, 0x0000048c, +0x0000048f, 0x0000048e, 0x0000048e, +0x00000491, 0x00000490, 0x00000490, +0x00000493, 0x00000492, 0x00000492, +0x00000495, 0x00000494, 0x00000494, +0x00000497, 0x00000496, 0x00000496, +0x00000499, 0x00000498, 0x00000498, +0x0000049b, 0x0000049a, 0x0000049a, +0x0000049d, 0x0000049c, 0x0000049c, +0x0000049f, 0x0000049e, 0x0000049e, +0x000004a1, 0x000004a0, 0x000004a0, +0x000004a3, 0x000004a2, 0x000004a2, +0x000004a5, 0x000004a4, 0x000004a4, +0x000004a7, 0x000004a6, 0x000004a6, +0x000004a9, 0x000004a8, 0x000004a8, +0x000004ab, 0x000004aa, 0x000004aa, +0x000004ad, 0x000004ac, 0x000004ac, +0x000004af, 0x000004ae, 0x000004ae, +0x000004b1, 0x000004b0, 0x000004b0, +0x000004b3, 0x000004b2, 0x000004b2, +0x000004b5, 0x000004b4, 0x000004b4, +0x000004b7, 0x000004b6, 0x000004b6, +0x000004b9, 0x000004b8, 0x000004b8, +0x000004bb, 0x000004ba, 0x000004ba, +0x000004bd, 0x000004bc, 0x000004bc, +0x000004bf, 0x000004be, 0x000004be, +0x000004c2, 0x000004c1, 0x000004c1, +0x000004c4, 0x000004c3, 0x000004c3, +0x000004c6, 0x000004c5, 0x000004c5, +0x000004c8, 0x000004c7, 0x000004c7, +0x000004ca, 0x000004c9, 0x000004c9, +0x000004cc, 0x000004cb, 0x000004cb, +0x000004ce, 0x000004cd, 0x000004cd, +0x000004d1, 0x000004d0, 0x000004d0, +0x000004d3, 0x000004d2, 0x000004d2, +0x000004d5, 0x000004d4, 0x000004d4, +0x000004d7, 0x000004d6, 0x000004d6, +0x000004d9, 0x000004d8, 0x000004d8, +0x000004db, 0x000004da, 0x000004da, +0x000004dd, 0x000004dc, 0x000004dc, +0x000004df, 0x000004de, 0x000004de, +0x000004e1, 0x000004e0, 0x000004e0, +0x000004e3, 0x000004e2, 0x000004e2, +0x000004e5, 0x000004e4, 0x000004e4, +0x000004e7, 0x000004e6, 0x000004e6, +0x000004e9, 0x000004e8, 0x000004e8, +0x000004eb, 0x000004ea, 0x000004ea, +0x000004ed, 0x000004ec, 0x000004ec, +0x000004ef, 0x000004ee, 0x000004ee, +0x000004f1, 0x000004f0, 0x000004f0, +0x000004f3, 0x000004f2, 0x000004f2, +0x000004f5, 0x000004f4, 0x000004f4, +0x000004f9, 0x000004f8, 0x000004f8, +0x00000501, 0x00000500, 0x00000500, +0x00000503, 0x00000502, 0x00000502, +0x00000505, 0x00000504, 0x00000504, +0x00000507, 0x00000506, 0x00000506, +0x00000509, 0x00000508, 0x00000508, +0x0000050b, 0x0000050a, 0x0000050a, +0x0000050d, 0x0000050c, 0x0000050c, +0x0000050f, 0x0000050e, 0x0000050e, +0x00000561, 0x00000531, 0x00000531, +0x00000562, 0x00000532, 0x00000532, +0x00000563, 0x00000533, 0x00000533, +0x00000564, 0x00000534, 0x00000534, +0x00000565, 0x00000535, 0x00000535, +0x00000566, 0x00000536, 0x00000536, +0x00000567, 0x00000537, 0x00000537, +0x00000568, 0x00000538, 0x00000538, +0x00000569, 0x00000539, 0x00000539, +0x0000056a, 0x0000053a, 0x0000053a, +0x0000056b, 0x0000053b, 0x0000053b, +0x0000056c, 0x0000053c, 0x0000053c, +0x0000056d, 0x0000053d, 0x0000053d, +0x0000056e, 0x0000053e, 0x0000053e, +0x0000056f, 0x0000053f, 0x0000053f, +0x00000570, 0x00000540, 0x00000540, +0x00000571, 0x00000541, 0x00000541, +0x00000572, 0x00000542, 0x00000542, +0x00000573, 0x00000543, 0x00000543, +0x00000574, 0x00000544, 0x00000544, +0x00000575, 0x00000545, 0x00000545, +0x00000576, 0x00000546, 0x00000546, +0x00000577, 0x00000547, 0x00000547, +0x00000578, 0x00000548, 0x00000548, +0x00000579, 0x00000549, 0x00000549, +0x0000057a, 0x0000054a, 0x0000054a, +0x0000057b, 0x0000054b, 0x0000054b, +0x0000057c, 0x0000054c, 0x0000054c, +0x0000057d, 0x0000054d, 0x0000054d, +0x0000057e, 0x0000054e, 0x0000054e, +0x0000057f, 0x0000054f, 0x0000054f, +0x00000580, 0x00000550, 0x00000550, +0x00000581, 0x00000551, 0x00000551, +0x00000582, 0x00000552, 0x00000552, +0x00000583, 0x00000553, 0x00000553, +0x00000584, 0x00000554, 0x00000554, +0x00000585, 0x00000555, 0x00000555, +0x00000586, 0x00000556, 0x00000556, +0x00001e01, 0x00001e00, 0x00001e00, +0x00001e03, 0x00001e02, 0x00001e02, +0x00001e05, 0x00001e04, 0x00001e04, +0x00001e07, 0x00001e06, 0x00001e06, +0x00001e09, 0x00001e08, 0x00001e08, +0x00001e0b, 0x00001e0a, 0x00001e0a, +0x00001e0d, 0x00001e0c, 0x00001e0c, +0x00001e0f, 0x00001e0e, 0x00001e0e, +0x00001e11, 0x00001e10, 0x00001e10, +0x00001e13, 0x00001e12, 0x00001e12, +0x00001e15, 0x00001e14, 0x00001e14, +0x00001e17, 0x00001e16, 0x00001e16, +0x00001e19, 0x00001e18, 0x00001e18, +0x00001e1b, 0x00001e1a, 0x00001e1a, +0x00001e1d, 0x00001e1c, 0x00001e1c, +0x00001e1f, 0x00001e1e, 0x00001e1e, +0x00001e21, 0x00001e20, 0x00001e20, +0x00001e23, 0x00001e22, 0x00001e22, +0x00001e25, 0x00001e24, 0x00001e24, +0x00001e27, 0x00001e26, 0x00001e26, +0x00001e29, 0x00001e28, 0x00001e28, +0x00001e2b, 0x00001e2a, 0x00001e2a, +0x00001e2d, 0x00001e2c, 0x00001e2c, +0x00001e2f, 0x00001e2e, 0x00001e2e, +0x00001e31, 0x00001e30, 0x00001e30, +0x00001e33, 0x00001e32, 0x00001e32, +0x00001e35, 0x00001e34, 0x00001e34, +0x00001e37, 0x00001e36, 0x00001e36, +0x00001e39, 0x00001e38, 0x00001e38, +0x00001e3b, 0x00001e3a, 0x00001e3a, +0x00001e3d, 0x00001e3c, 0x00001e3c, +0x00001e3f, 0x00001e3e, 0x00001e3e, +0x00001e41, 0x00001e40, 0x00001e40, +0x00001e43, 0x00001e42, 0x00001e42, +0x00001e45, 0x00001e44, 0x00001e44, +0x00001e47, 0x00001e46, 0x00001e46, +0x00001e49, 0x00001e48, 0x00001e48, +0x00001e4b, 0x00001e4a, 0x00001e4a, +0x00001e4d, 0x00001e4c, 0x00001e4c, +0x00001e4f, 0x00001e4e, 0x00001e4e, +0x00001e51, 0x00001e50, 0x00001e50, +0x00001e53, 0x00001e52, 0x00001e52, +0x00001e55, 0x00001e54, 0x00001e54, +0x00001e57, 0x00001e56, 0x00001e56, +0x00001e59, 0x00001e58, 0x00001e58, +0x00001e5b, 0x00001e5a, 0x00001e5a, +0x00001e5d, 0x00001e5c, 0x00001e5c, +0x00001e5f, 0x00001e5e, 0x00001e5e, +0x00001e61, 0x00001e60, 0x00001e60, +0x00001e63, 0x00001e62, 0x00001e62, +0x00001e65, 0x00001e64, 0x00001e64, +0x00001e67, 0x00001e66, 0x00001e66, +0x00001e69, 0x00001e68, 0x00001e68, +0x00001e6b, 0x00001e6a, 0x00001e6a, +0x00001e6d, 0x00001e6c, 0x00001e6c, +0x00001e6f, 0x00001e6e, 0x00001e6e, +0x00001e71, 0x00001e70, 0x00001e70, +0x00001e73, 0x00001e72, 0x00001e72, +0x00001e75, 0x00001e74, 0x00001e74, +0x00001e77, 0x00001e76, 0x00001e76, +0x00001e79, 0x00001e78, 0x00001e78, +0x00001e7b, 0x00001e7a, 0x00001e7a, +0x00001e7d, 0x00001e7c, 0x00001e7c, +0x00001e7f, 0x00001e7e, 0x00001e7e, +0x00001e81, 0x00001e80, 0x00001e80, +0x00001e83, 0x00001e82, 0x00001e82, +0x00001e85, 0x00001e84, 0x00001e84, +0x00001e87, 0x00001e86, 0x00001e86, +0x00001e89, 0x00001e88, 0x00001e88, +0x00001e8b, 0x00001e8a, 0x00001e8a, +0x00001e8d, 0x00001e8c, 0x00001e8c, +0x00001e8f, 0x00001e8e, 0x00001e8e, +0x00001e91, 0x00001e90, 0x00001e90, +0x00001e93, 0x00001e92, 0x00001e92, +0x00001e95, 0x00001e94, 0x00001e94, +0x00001e9b, 0x00001e60, 0x00001e60, +0x00001ea1, 0x00001ea0, 0x00001ea0, +0x00001ea3, 0x00001ea2, 0x00001ea2, +0x00001ea5, 0x00001ea4, 0x00001ea4, +0x00001ea7, 0x00001ea6, 0x00001ea6, +0x00001ea9, 0x00001ea8, 0x00001ea8, +0x00001eab, 0x00001eaa, 0x00001eaa, +0x00001ead, 0x00001eac, 0x00001eac, +0x00001eaf, 0x00001eae, 0x00001eae, +0x00001eb1, 0x00001eb0, 0x00001eb0, +0x00001eb3, 0x00001eb2, 0x00001eb2, +0x00001eb5, 0x00001eb4, 0x00001eb4, +0x00001eb7, 0x00001eb6, 0x00001eb6, +0x00001eb9, 0x00001eb8, 0x00001eb8, +0x00001ebb, 0x00001eba, 0x00001eba, +0x00001ebd, 0x00001ebc, 0x00001ebc, +0x00001ebf, 0x00001ebe, 0x00001ebe, +0x00001ec1, 0x00001ec0, 0x00001ec0, +0x00001ec3, 0x00001ec2, 0x00001ec2, +0x00001ec5, 0x00001ec4, 0x00001ec4, +0x00001ec7, 0x00001ec6, 0x00001ec6, +0x00001ec9, 0x00001ec8, 0x00001ec8, +0x00001ecb, 0x00001eca, 0x00001eca, +0x00001ecd, 0x00001ecc, 0x00001ecc, +0x00001ecf, 0x00001ece, 0x00001ece, +0x00001ed1, 0x00001ed0, 0x00001ed0, +0x00001ed3, 0x00001ed2, 0x00001ed2, +0x00001ed5, 0x00001ed4, 0x00001ed4, +0x00001ed7, 0x00001ed6, 0x00001ed6, +0x00001ed9, 0x00001ed8, 0x00001ed8, +0x00001edb, 0x00001eda, 0x00001eda, +0x00001edd, 0x00001edc, 0x00001edc, +0x00001edf, 0x00001ede, 0x00001ede, +0x00001ee1, 0x00001ee0, 0x00001ee0, +0x00001ee3, 0x00001ee2, 0x00001ee2, +0x00001ee5, 0x00001ee4, 0x00001ee4, +0x00001ee7, 0x00001ee6, 0x00001ee6, +0x00001ee9, 0x00001ee8, 0x00001ee8, +0x00001eeb, 0x00001eea, 0x00001eea, +0x00001eed, 0x00001eec, 0x00001eec, +0x00001eef, 0x00001eee, 0x00001eee, +0x00001ef1, 0x00001ef0, 0x00001ef0, +0x00001ef3, 0x00001ef2, 0x00001ef2, +0x00001ef5, 0x00001ef4, 0x00001ef4, +0x00001ef7, 0x00001ef6, 0x00001ef6, +0x00001ef9, 0x00001ef8, 0x00001ef8, +0x00001f00, 0x00001f08, 0x00001f08, +0x00001f01, 0x00001f09, 0x00001f09, +0x00001f02, 0x00001f0a, 0x00001f0a, +0x00001f03, 0x00001f0b, 0x00001f0b, +0x00001f04, 0x00001f0c, 0x00001f0c, +0x00001f05, 0x00001f0d, 0x00001f0d, +0x00001f06, 0x00001f0e, 0x00001f0e, +0x00001f07, 0x00001f0f, 0x00001f0f, +0x00001f10, 0x00001f18, 0x00001f18, +0x00001f11, 0x00001f19, 0x00001f19, +0x00001f12, 0x00001f1a, 0x00001f1a, +0x00001f13, 0x00001f1b, 0x00001f1b, +0x00001f14, 0x00001f1c, 0x00001f1c, +0x00001f15, 0x00001f1d, 0x00001f1d, +0x00001f20, 0x00001f28, 0x00001f28, +0x00001f21, 0x00001f29, 0x00001f29, +0x00001f22, 0x00001f2a, 0x00001f2a, +0x00001f23, 0x00001f2b, 0x00001f2b, +0x00001f24, 0x00001f2c, 0x00001f2c, +0x00001f25, 0x00001f2d, 0x00001f2d, +0x00001f26, 0x00001f2e, 0x00001f2e, +0x00001f27, 0x00001f2f, 0x00001f2f, +0x00001f30, 0x00001f38, 0x00001f38, +0x00001f31, 0x00001f39, 0x00001f39, +0x00001f32, 0x00001f3a, 0x00001f3a, +0x00001f33, 0x00001f3b, 0x00001f3b, +0x00001f34, 0x00001f3c, 0x00001f3c, +0x00001f35, 0x00001f3d, 0x00001f3d, +0x00001f36, 0x00001f3e, 0x00001f3e, +0x00001f37, 0x00001f3f, 0x00001f3f, +0x00001f40, 0x00001f48, 0x00001f48, +0x00001f41, 0x00001f49, 0x00001f49, +0x00001f42, 0x00001f4a, 0x00001f4a, +0x00001f43, 0x00001f4b, 0x00001f4b, +0x00001f44, 0x00001f4c, 0x00001f4c, +0x00001f45, 0x00001f4d, 0x00001f4d, +0x00001f51, 0x00001f59, 0x00001f59, +0x00001f53, 0x00001f5b, 0x00001f5b, +0x00001f55, 0x00001f5d, 0x00001f5d, +0x00001f57, 0x00001f5f, 0x00001f5f, +0x00001f60, 0x00001f68, 0x00001f68, +0x00001f61, 0x00001f69, 0x00001f69, +0x00001f62, 0x00001f6a, 0x00001f6a, +0x00001f63, 0x00001f6b, 0x00001f6b, +0x00001f64, 0x00001f6c, 0x00001f6c, +0x00001f65, 0x00001f6d, 0x00001f6d, +0x00001f66, 0x00001f6e, 0x00001f6e, +0x00001f67, 0x00001f6f, 0x00001f6f, +0x00001f70, 0x00001fba, 0x00001fba, +0x00001f71, 0x00001fbb, 0x00001fbb, +0x00001f72, 0x00001fc8, 0x00001fc8, +0x00001f73, 0x00001fc9, 0x00001fc9, +0x00001f74, 0x00001fca, 0x00001fca, +0x00001f75, 0x00001fcb, 0x00001fcb, +0x00001f76, 0x00001fda, 0x00001fda, +0x00001f77, 0x00001fdb, 0x00001fdb, +0x00001f78, 0x00001ff8, 0x00001ff8, +0x00001f79, 0x00001ff9, 0x00001ff9, +0x00001f7a, 0x00001fea, 0x00001fea, +0x00001f7b, 0x00001feb, 0x00001feb, +0x00001f7c, 0x00001ffa, 0x00001ffa, +0x00001f7d, 0x00001ffb, 0x00001ffb, +0x00001f80, 0x00001f88, 0x00001f88, +0x00001f81, 0x00001f89, 0x00001f89, +0x00001f82, 0x00001f8a, 0x00001f8a, +0x00001f83, 0x00001f8b, 0x00001f8b, +0x00001f84, 0x00001f8c, 0x00001f8c, +0x00001f85, 0x00001f8d, 0x00001f8d, +0x00001f86, 0x00001f8e, 0x00001f8e, +0x00001f87, 0x00001f8f, 0x00001f8f, +0x00001f90, 0x00001f98, 0x00001f98, +0x00001f91, 0x00001f99, 0x00001f99, +0x00001f92, 0x00001f9a, 0x00001f9a, +0x00001f93, 0x00001f9b, 0x00001f9b, +0x00001f94, 0x00001f9c, 0x00001f9c, +0x00001f95, 0x00001f9d, 0x00001f9d, +0x00001f96, 0x00001f9e, 0x00001f9e, +0x00001f97, 0x00001f9f, 0x00001f9f, +0x00001fa0, 0x00001fa8, 0x00001fa8, +0x00001fa1, 0x00001fa9, 0x00001fa9, +0x00001fa2, 0x00001faa, 0x00001faa, +0x00001fa3, 0x00001fab, 0x00001fab, +0x00001fa4, 0x00001fac, 0x00001fac, +0x00001fa5, 0x00001fad, 0x00001fad, +0x00001fa6, 0x00001fae, 0x00001fae, +0x00001fa7, 0x00001faf, 0x00001faf, +0x00001fb0, 0x00001fb8, 0x00001fb8, +0x00001fb1, 0x00001fb9, 0x00001fb9, +0x00001fb3, 0x00001fbc, 0x00001fbc, +0x00001fbe, 0x00000399, 0x00000399, +0x00001fc3, 0x00001fcc, 0x00001fcc, +0x00001fd0, 0x00001fd8, 0x00001fd8, +0x00001fd1, 0x00001fd9, 0x00001fd9, +0x00001fe0, 0x00001fe8, 0x00001fe8, +0x00001fe1, 0x00001fe9, 0x00001fe9, +0x00001fe5, 0x00001fec, 0x00001fec, +0x00001ff3, 0x00001ffc, 0x00001ffc, +0x00002170, 0x00002160, 0x00002160, +0x00002171, 0x00002161, 0x00002161, +0x00002172, 0x00002162, 0x00002162, +0x00002173, 0x00002163, 0x00002163, +0x00002174, 0x00002164, 0x00002164, +0x00002175, 0x00002165, 0x00002165, +0x00002176, 0x00002166, 0x00002166, +0x00002177, 0x00002167, 0x00002167, +0x00002178, 0x00002168, 0x00002168, +0x00002179, 0x00002169, 0x00002169, +0x0000217a, 0x0000216a, 0x0000216a, +0x0000217b, 0x0000216b, 0x0000216b, +0x0000217c, 0x0000216c, 0x0000216c, +0x0000217d, 0x0000216d, 0x0000216d, +0x0000217e, 0x0000216e, 0x0000216e, +0x0000217f, 0x0000216f, 0x0000216f, +0x000024d0, 0x000024b6, 0x000024b6, +0x000024d1, 0x000024b7, 0x000024b7, +0x000024d2, 0x000024b8, 0x000024b8, +0x000024d3, 0x000024b9, 0x000024b9, +0x000024d4, 0x000024ba, 0x000024ba, +0x000024d5, 0x000024bb, 0x000024bb, +0x000024d6, 0x000024bc, 0x000024bc, +0x000024d7, 0x000024bd, 0x000024bd, +0x000024d8, 0x000024be, 0x000024be, +0x000024d9, 0x000024bf, 0x000024bf, +0x000024da, 0x000024c0, 0x000024c0, +0x000024db, 0x000024c1, 0x000024c1, +0x000024dc, 0x000024c2, 0x000024c2, +0x000024dd, 0x000024c3, 0x000024c3, +0x000024de, 0x000024c4, 0x000024c4, +0x000024df, 0x000024c5, 0x000024c5, +0x000024e0, 0x000024c6, 0x000024c6, +0x000024e1, 0x000024c7, 0x000024c7, +0x000024e2, 0x000024c8, 0x000024c8, +0x000024e3, 0x000024c9, 0x000024c9, +0x000024e4, 0x000024ca, 0x000024ca, +0x000024e5, 0x000024cb, 0x000024cb, +0x000024e6, 0x000024cc, 0x000024cc, +0x000024e7, 0x000024cd, 0x000024cd, +0x000024e8, 0x000024ce, 0x000024ce, +0x000024e9, 0x000024cf, 0x000024cf, +0x0000ff41, 0x0000ff21, 0x0000ff21, +0x0000ff42, 0x0000ff22, 0x0000ff22, +0x0000ff43, 0x0000ff23, 0x0000ff23, +0x0000ff44, 0x0000ff24, 0x0000ff24, +0x0000ff45, 0x0000ff25, 0x0000ff25, +0x0000ff46, 0x0000ff26, 0x0000ff26, +0x0000ff47, 0x0000ff27, 0x0000ff27, +0x0000ff48, 0x0000ff28, 0x0000ff28, +0x0000ff49, 0x0000ff29, 0x0000ff29, +0x0000ff4a, 0x0000ff2a, 0x0000ff2a, +0x0000ff4b, 0x0000ff2b, 0x0000ff2b, +0x0000ff4c, 0x0000ff2c, 0x0000ff2c, +0x0000ff4d, 0x0000ff2d, 0x0000ff2d, +0x0000ff4e, 0x0000ff2e, 0x0000ff2e, +0x0000ff4f, 0x0000ff2f, 0x0000ff2f, +0x0000ff50, 0x0000ff30, 0x0000ff30, +0x0000ff51, 0x0000ff31, 0x0000ff31, +0x0000ff52, 0x0000ff32, 0x0000ff32, +0x0000ff53, 0x0000ff33, 0x0000ff33, +0x0000ff54, 0x0000ff34, 0x0000ff34, +0x0000ff55, 0x0000ff35, 0x0000ff35, +0x0000ff56, 0x0000ff36, 0x0000ff36, +0x0000ff57, 0x0000ff37, 0x0000ff37, +0x0000ff58, 0x0000ff38, 0x0000ff38, +0x0000ff59, 0x0000ff39, 0x0000ff39, +0x0000ff5a, 0x0000ff3a, 0x0000ff3a, +0x00010428, 0x00010400, 0x00010400, +0x00010429, 0x00010401, 0x00010401, +0x0001042a, 0x00010402, 0x00010402, +0x0001042b, 0x00010403, 0x00010403, +0x0001042c, 0x00010404, 0x00010404, +0x0001042d, 0x00010405, 0x00010405, +0x0001042e, 0x00010406, 0x00010406, +0x0001042f, 0x00010407, 0x00010407, +0x00010430, 0x00010408, 0x00010408, +0x00010431, 0x00010409, 0x00010409, +0x00010432, 0x0001040a, 0x0001040a, +0x00010433, 0x0001040b, 0x0001040b, +0x00010434, 0x0001040c, 0x0001040c, +0x00010435, 0x0001040d, 0x0001040d, +0x00010436, 0x0001040e, 0x0001040e, +0x00010437, 0x0001040f, 0x0001040f, +0x00010438, 0x00010410, 0x00010410, +0x00010439, 0x00010411, 0x00010411, +0x0001043a, 0x00010412, 0x00010412, +0x0001043b, 0x00010413, 0x00010413, +0x0001043c, 0x00010414, 0x00010414, +0x0001043d, 0x00010415, 0x00010415, +0x0001043e, 0x00010416, 0x00010416, +0x0001043f, 0x00010417, 0x00010417, +0x00010440, 0x00010418, 0x00010418, +0x00010441, 0x00010419, 0x00010419, +0x00010442, 0x0001041a, 0x0001041a, +0x00010443, 0x0001041b, 0x0001041b, +0x00010444, 0x0001041c, 0x0001041c, +0x00010445, 0x0001041d, 0x0001041d, +0x00010446, 0x0001041e, 0x0001041e, +0x00010447, 0x0001041f, 0x0001041f, +0x00010448, 0x00010420, 0x00010420, +0x00010449, 0x00010421, 0x00010421, +0x0001044a, 0x00010422, 0x00010422, +0x0001044b, 0x00010423, 0x00010423, +0x0001044c, 0x00010424, 0x00010424, +0x0001044d, 0x00010425, 0x00010425, +/* title */ +0x000001c5, 0x000001c4, 0x000001c6, +0x000001c8, 0x000001c7, 0x000001c9, +0x000001cb, 0x000001ca, 0x000001cc, +0x000001f2, 0x000001f1, 0x000001f3, +}; diff --git a/src/cpp/makeall.sh b/src/cpp/makeall.sh new file mode 100755 index 0000000000000..387e0a9d963b7 --- /dev/null +++ b/src/cpp/makeall.sh @@ -0,0 +1,3 @@ +#/bin/sh +# called by src/ +make -j -C cpp/tmp diff --git a/src/cpp/tmp/Makefile b/src/cpp/tmp/Makefile new file mode 100644 index 0000000000000..ef209e89d8360 --- /dev/null +++ b/src/cpp/tmp/Makefile @@ -0,0 +1,17 @@ + +PROJECT_NAME = test +PROJECT_ROOT = ../../.. + +AUTO_SOURCES_RECURSIVE = 1 +INTERMEDIATE_FILES = main.cpp main.php +INTERMEDIATE_DIRS += cls php sys + +CPPFLAGS += -I. +LIBS = \ + $(LIB_DIR)/libhphp_runtime.a \ + $(ALL_LIBS) + +include $(PROJECT_ROOT)/src/rules.mk +TARGETS = $(APP_TARGET) + +all: $(TARGETS) diff --git a/src/cpp/tmp/README b/src/cpp/tmp/README new file mode 100644 index 0000000000000..4e2b9730ee350 --- /dev/null +++ b/src/cpp/tmp/README @@ -0,0 +1,2 @@ + +Do not manually add any files in this directory. This is for holding generated .cpp files, compiling them and linking with hphp_cpp_base.so. diff --git a/src/cpp/tmp/cleanup.sh b/src/cpp/tmp/cleanup.sh new file mode 100755 index 0000000000000..c4279d8c954b2 --- /dev/null +++ b/src/cpp/tmp/cleanup.sh @@ -0,0 +1,4 @@ +#/bin/sh +# called by src/ +cd cpp/tmp +rm -fR -- *.php *.cpp *.d *.o *.h test php sys cls diff --git a/src/crutch.php b/src/crutch.php new file mode 100755 index 0000000000000..e9c4f57fc6c54 --- /dev/null +++ b/src/crutch.php @@ -0,0 +1,72 @@ +#!/usr/local/bin/php + $param) { + if ($index >= 0 && $param[0] == 'O' && $args[$index]) { + $original_msg[$index] = $args[$index]; + $args[$index] = $Objects[$args[$index]]; + } + } + } + + $expr = '$ret = $func('; + for ($i = 0; $i < $count; $i++) { + if ($i > 0) $expr .= ','; + $expr .= '$args['.$i.']'; + } + $expr .= ');'; + eval($expr); + + if ($schema) { + $refs = array(); + foreach ($schema as $index => $param) { + if ($param == 'R' /* Reference */) { + $refs[$index] = $args[$index]; + } else if ($param == 'OO' /* Object/Resource Output */) { + if ($index < 0) { + if ($ret) { + $Objects[$ObjectIndex] = $ret; + $ret = $ObjectIndex++; + } + } else { + $newobj = $args[$index]; + $oldobj = $Objects[$original_msg[$index]]; + if ($newobj && $newobj !== $oldobj) { + $Objects[$ObjectIndex] = $newobj; + $refs[$index] = $ObjectIndex++; + } + } + } + } + } + + $response = array($ret, $refs); + if (!msg_send($q, 2, $response)) break; + } +} diff --git a/src/default.mk b/src/default.mk new file mode 100644 index 0000000000000..40755bcfa4f00 --- /dev/null +++ b/src/default.mk @@ -0,0 +1,60 @@ +############################################################################### +# +# Predefined Targets +# +# Author: hzhao (09/2007) +# +############################################################################### +# +# This file is included as sub-make in rules.mk. It is slower than defining +# these targets inline in each Makefile, but it just saves a lot of work +# preparing these targets for each directory. + +unexport SUB_CLEAN_DIRS + +# delete all intermediate files and built targets +.PHONY: clobber +clobber: + @$(RM) $(SUB_INTERMEDIATE_FILES) $(SUB_OBJECTS) + @$(RM) *.merge-left.* *.merge-right.* *.working + @$(RM) lib$(PROJECT_NAME).so lib$(PROJECT_NAME).a *~ $(OBJECTS:.o=) + @$(RM) $(filter-out $(SUB_PROGRAMS) $(SUB_LIB_TARGETS), $(TARGETS)) + @$(RM) $(shell echo `find . -name "*.o"`) + @$(RM) $(shell echo `find . -name "*.d"`) + @$(RM) $(shell echo `find . -name "*~"`) + @$(RMDIR) gen-cpp + @for mdir in $(SUB_CLEAN_DIRS); do $(MAKE) -C $$mdir clobber; done + @for mdir in $(SUB_PROGRAMS); do $(MAKE) -C $$mdir clobber; done + @for mdir in $(SUB_LIB_TARGETS); do $(MAKE) -C $$mdir clobber; done + @for mdir in $(INTERMEDIATE_DIRS); do rm -fR $$mdir; done + +.PHONY: clean +clean: clobber + +# delete targets only +.PHONY: clear-targets +cleartargets: + @$(RM) $(TARGETS) + @for mdir in $(SUB_PROGRAMS); do $(MAKE) -C $$mdir cleartargets; done + @for mdir in $(SUB_LIB_TARGETS); do $(MAKE) -C $$mdir cleartargets; done + +# default no-op "make install" +.PHONY: install +install: + @for mdir in $(SUB_PROGRAMS); do $(MAKE) -C $$mdir install; done + @for mdir in $(SUB_LIB_TARGETS); do $(MAKE) -C $$mdir install; done + +.PHONY: list-targets +list-targets: + @echo $(TARGETS) | tr ' ' '\n' + @for mdir in $(SUB_PROGRAMS); do $(MAKE) -C $$mdir list-targets; done + @for mdir in $(SUB_LIB_TARGETS); do $(MAKE) -C $$mdir list-targets; done + +.PHONY: list-sources +list-sources: + @echo $(SOURCES) | tr ' ' '\n' + @for mdir in $(SUB_PROGRAMS); do $(MAKE) -C $$mdir list-sources; done + @for mdir in $(SUB_LIB_TARGETS); do $(MAKE) -C $$mdir list-sources; done + +.EXPORT_ALL_VARIABLES:; +unexport SUB_PROGRAMS SUB_LIB_TARGETS diff --git a/src/droptables.sql b/src/droptables.sql new file mode 100644 index 0000000000000..804a51d3ea103 --- /dev/null +++ b/src/droptables.sql @@ -0,0 +1,3 @@ +drop table run; +drop table dep; +drop table err; diff --git a/src/ffi/hs/HphpFFI.hs b/src/ffi/hs/HphpFFI.hs new file mode 100644 index 0000000000000..d0afd3ad9818d --- /dev/null +++ b/src/ffi/hs/HphpFFI.hs @@ -0,0 +1,294 @@ +{-# INCLUDE "hphp_ffi.h" #-} +{-# LANGUAGE ForeignFunctionInterface #-} +module HphpFFI (Variant, VariantOrd, VariantAble(..), VariantOrdAble(..), + vToMap, vToInt, vToDouble, vToString, vToBool, vIsNull, + withExportedVariant, HphpVariantPtr, buildVariant, PtrPtr, + hphpIncludeFile, hphpFfiInit, hphpFreeGlobals, + withVParamList, fullyLocalize) where +import Utils +import Data.Int +import Foreign.C +import Foreign.ForeignPtr +import Foreign.Ptr +import Foreign.Storable (peek) +import Foreign.Marshal.Alloc (alloca) +import Data.Maybe (fromJust) +import qualified Data.ByteString.Char8 as B +import qualified Data.Map as M + + +-- Raw pointers to hphp data +data ArrayData = ArrayData +data StringData = StringData +data ObjectData = ObjectData +data HphpVariant = HphpVariant +type HphpVariantPtr = Ptr HphpVariant + +type ArrayDataPtr = Ptr ArrayData +type StringDataPtr = Ptr StringData +type ObjectDataPtr = Ptr ObjectData + +type PtrPtr a = Ptr (Ptr a) + +-- Foreign pointers for hphp data pointers +type ArrayDataHnd = ForeignPtr ArrayData +type StringDataHnd = ForeignPtr StringData +type ObjectDataHnd = ForeignPtr ObjectData + + +-- Using foreign ptrs for hooking into hphp's ref counting +foreign import ccall "hphp_ffi.h &ArrayData_decRef" arrayData_decRef + :: FunPtr (ArrayDataPtr -> IO ()) +foreign import ccall "hphp_ffi.h &StringData_decRef" stringData_decRef + :: FunPtr (StringDataPtr -> IO ()) +foreign import ccall "hphp_ffi.h &ObjectData_decRef" objectData_decRef + :: FunPtr(ObjectDataPtr -> IO ()) + +introduceArrayData :: Ptr ArrayData -> IO ArrayDataHnd +introduceArrayData ad = newForeignPtr arrayData_decRef ad +introduceStringData :: Ptr StringData -> IO StringDataHnd +introduceStringData ad = newForeignPtr stringData_decRef ad +introduceObjectData :: Ptr ObjectData -> IO ObjectDataHnd +introduceObjectData ad = newForeignPtr objectData_decRef ad + + +-- Various utility ccalls +foreign import ccall "hphp_ffi.h buildVariant" buildHphpVariant + :: CInt -> Ptr a -> CInt -> IO HphpVariantPtr +foreign import ccall "hphp_ffi.h freeVariant" freeHphpVariant + :: HphpVariantPtr -> IO () + +foreign import ccall "hphp_ffi.h addMapItem" addHphpMapItem + :: HphpVariantPtr -> HphpVariantPtr -> HphpVariantPtr -> IO () + +foreign import ccall "hphp_ffi.h iter_begin" adIterBegin + :: ArrayDataPtr -> IO CLLong +foreign import ccall "hphp_ffi.h iter_advance" adIterAdvance + :: ArrayDataPtr -> CLLong -> IO CLLong +foreign import ccall "hphp_ffi.h iter_end" adIterEnd + :: ArrayDataPtr -> IO CLLong +foreign import ccall "hphp_ffi.h iter_invalid" _adIterInvalid + :: CLLong -> IO CInt +adIterInvalid :: CLLong -> IO Bool +adIterInvalid p = do + r <- _adIterInvalid p + return $ r == 1 +foreign import ccall "hphp_ffi.h iter_getKey" adIterGetKey + :: ArrayDataPtr -> CLLong -> PtrPtr a -> IO CInt +foreign import ccall "hphp_ffi.h iter_getValue" adIterGetValue + :: ArrayDataPtr -> CLLong -> PtrPtr a -> IO CInt + +foreign import ccall "hphp_ffi.h string_data" sdGetData + :: StringDataPtr -> Ptr CString -> IO CInt + +foreign import ccall "hphp_ffi.h include_file" _hphpIncludeFile + :: CString -> IO () + +foreign import ccall "hphp_ffi.h ffi_init" hphpFfiInit + :: IO () +foreign import ccall "hphp_ffi.h ffi_free_globals" hphpFreeGlobals + :: IO () + +hphpIncludeFile f = do + s <- newCString f + _hphpIncludeFile s + +-- Variant type +data VariantOrd = VOInt Int64 + | VOString B.ByteString + deriving (Eq, Ord, Show) + +data Variant = VNull + | VInt Int64 + | VDbl Double + | VBool Bool + | VBString B.ByteString + | VMap (M.Map VariantOrd Variant) + | VLitStr CString + | VString StringDataHnd + | VArray ArrayDataHnd + | VObject ObjectDataHnd + deriving Show + +ptrToInt :: Ptr a -> Int64 +ptrToInt p = fromIntegral . ptrToIntPtr $ p + +ptrToDbl :: Ptr a -> Double +ptrToDbl p = floatOfBits (fromIntegral . ptrToIntPtr $ p) + +buildVariant :: Int -> Ptr a -> IO Variant +buildVariant typ ptr = + case typ of + 0 -> return VNull + 1 -> return $ VBool ((ptrToInt ptr) /= 0) + 2 -> return $ VInt (ptrToInt ptr) + 3 -> return $ VDbl (ptrToDbl ptr) + 4 -> return $ VLitStr (castPtr ptr) + 5 -> (return . VString) =<< + (introduceStringData (castPtr ptr)) + 6 -> (return . VArray) =<< + (introduceArrayData (castPtr ptr)) + 7 -> (return . VObject) =<< + (introduceObjectData (castPtr ptr)) + +sdToBs :: StringDataHnd -> IO B.ByteString +sdToBs sd = alloca $ \pd -> do + len <- withForeignPtr sd (\psd -> sdGetData psd pd) + cs <- peek pd + B.packCStringLen (cs, fromIntegral len) + + +foldAd :: ArrayDataHnd -> CLLong -> (VariantOrd -> Variant -> b -> b) + -> b -> IO b +foldAd ad pos f init = do + inv <- adIterInvalid pos + if inv then return init else do + k <- alloca $ \pk -> do + tk <- withForeignPtr ad (\adp -> + adIterGetKey adp pos pk) + pkv <- peek pk + vk <- buildVariant (fromIntegral tk) pkv + fromJust $ variantToVariantOrd vk + v <- alloca $ \pv -> do + tv <- withForeignPtr ad (\adp -> + adIterGetValue adp pos pv) + pvv <- peek pv + buildVariant (fromIntegral tv) pvv + npos <- withForeignPtr ad (\adp -> adIterAdvance adp pos) + foldAd ad npos f (f k v init) + +adToDm :: ArrayDataHnd -> IO (M.Map VariantOrd Variant) +adToDm ad = do + beg <- withForeignPtr ad (\adp -> adIterBegin adp) + foldAd ad beg M.insert M.empty + +variantToVariantOrd :: Variant -> Maybe (IO VariantOrd) +variantToVariantOrd (VBString b) = Just . return $ VOString b +variantToVariantOrd (VInt i) = Just . return $ VOInt i +variantToVariantOrd (VString s) = Just $ do + bs <- sdToBs s + return (VOString bs) +variantToVariantOrd _ = Nothing + +class VariantAble a where + toVariant :: a -> Variant +class VariantOrdAble a where + toVariantOrd :: a -> VariantOrd + +instance VariantAble () where + toVariant () = VNull +instance VariantAble Bool where + toVariant b = VBool b +instance VariantAble Int where + toVariant i = VInt (fromIntegral i) +instance VariantAble Int64 where + toVariant i = VInt i +instance VariantAble String where + toVariant s = VBString (B.pack s) +instance VariantAble Double where + toVariant d = VDbl d +instance VariantAble B.ByteString where + toVariant b = VBString b +instance (VariantOrdAble k, VariantAble v) => VariantAble (M.Map k v) where + toVariant m = VMap $ M.map toVariant (M.mapKeys toVariantOrd m) +instance VariantAble VariantOrd where + toVariant (VOInt i) = VInt i + toVariant (VOString bs) = VBString bs +instance VariantAble Variant where + toVariant v = v + +instance VariantOrdAble Int where + toVariantOrd i = VOInt (fromIntegral i) +instance VariantOrdAble Int64 where + toVariantOrd i = VOInt i +instance VariantOrdAble String where + toVariantOrd s = VOString (B.pack s) +instance VariantOrdAble B.ByteString where + toVariantOrd b = VOString b + + +intToVp :: Integral a => a -> Ptr b +intToVp i = intPtrToPtr (fromIntegral i) + +dblToVp :: Double -> Ptr a +dblToVp d = intToVp (floatBits d) + +exportVariant :: Variant -> IO HphpVariantPtr +exportVariant VNull = buildHphpVariant 0 nullPtr 0 +exportVariant (VBool v) = buildHphpVariant 1 (intToVp (if v then 1 else 0)) 0 +exportVariant (VInt i) = buildHphpVariant 2 (intToVp i) 0 +exportVariant (VDbl d) = buildHphpVariant 3 (dblToVp d) 0 +exportVariant (VLitStr cs) = buildHphpVariant 4 cs 0 +exportVariant (VString s) = withForeignPtr s (\p -> buildHphpVariant 5 p 0) +exportVariant (VBString bs) = B.useAsCStringLen bs + (\(cs, l) -> + buildHphpVariant 6 cs (fromIntegral l)) +exportVariant (VArray a) = withForeignPtr a (\p -> buildHphpVariant 7 p 0) +exportVariant (VObject o) = withForeignPtr o (\p -> buildHphpVariant 8 p 0) +exportVariant (VMap m) = do + p <- buildHphpVariant 0 nullPtr 0 + M.foldWithKey (adder p) (return ()) m + return p + where + adder p k v _ = do + kv <- exportVariant (toVariant k) + vv <- exportVariant v + addHphpMapItem p kv vv + freeHphpVariant kv + freeHphpVariant vv + +withExportedVariant :: VariantAble v => v -> (HphpVariantPtr -> IO a) -> IO a +withExportedVariant v f = do + vp <- exportVariant (toVariant v) + r <- f vp + freeHphpVariant vp + return r + +withVParamList :: [Variant] -> (HphpVariantPtr -> IO a) -> IO a +withVParamList params = withExportedVariant + (VMap . M.mapKeys toVariantOrd . M.fromList $ + zip [(0 :: Int64)..] params) + +-- Variant Conversions + +vToMap :: Variant -> Maybe (IO (M.Map VariantOrd Variant)) +vToMap (VMap m) = Just (return m) +vToMap (VArray ad) = Just $ adToDm ad +vToMap _ = Nothing + +vToInt :: Variant -> Maybe Int64 +vToInt (VInt i) = Just i +vToInt _ = Nothing + +vToDouble :: Variant -> Maybe Double +vToDouble (VDbl d) = Just d +vToDouble _ = Nothing + +vToString :: Variant -> Maybe (IO B.ByteString) +vToString (VBString bs) = Just . return $ bs +vToString (VLitStr cs) = Just (B.packCString cs) +vToString (VString sd) = Just $ sdToBs sd +vToString _ = Nothing + +vToBool :: Variant -> Maybe Bool +vToBool (VBool b) = Just b +vToBool _ = Nothing + +vIsNull :: Variant -> Bool +vIsNull VNull = True +vIsNull _ = False + +fullyLocalize :: Variant -> IO Variant +fullyLocalize (VString sd) = do + bs <- sdToBs sd + return $ VBString bs +fullyLocalize (VArray ad) = do + dm <- adToDm ad + dm2 <- M.foldWithKey (\k v mm -> do + m <- mm + vl <- fullyLocalize v + return $ M.insert k vl m) + (return M.empty) dm + return $ VMap dm2 +fullyLocalize v = return v + diff --git a/src/ffi/hs/Utils.hs b/src/ffi/hs/Utils.hs new file mode 100644 index 0000000000000..843d9cb49ae1f --- /dev/null +++ b/src/ffi/hs/Utils.hs @@ -0,0 +1,13 @@ +module Utils (floatOfBits, floatBits) where + +import Data.Int +import Data.Word +import GHC.Exts +import GHC.Prim +import GHC.Word + +floatBits :: Double -> Word64 +floatBits (D# d#) = W64# (unsafeCoerce# d#) + +floatOfBits :: Word64 -> Double +floatOfBits (W64# b#) = D# (unsafeCoerce# b#) diff --git a/src/ffi/java/Makefile b/src/ffi/java/Makefile new file mode 100644 index 0000000000000..b8e3472b47e1e --- /dev/null +++ b/src/ffi/java/Makefile @@ -0,0 +1,37 @@ +PROJECT_ROOT = ../../../ + +PROJECT_NAME = hphp_java + +SRC = $(shell echo `find hphp -name '*.java'`) + +CLS = $(shell echo $(patsubst %.java, %.class, $(SRC)) \ + | sed -e "s/hphp/classes\/hphp/g") + +HEADER = hphp_ffi_java.h + +AUTO_SOURCES = 1 + +include $(PROJECT_ROOT)/src/rules.mk + +EXTERNAL += $(PROJECT_ROOT)/bin/libhphp_runtime.so + +TARGETS = $(SHARED_LIB) + +all : $(CLS) $(HEADER) $(TARGETS) + +$(OBJECTS) : $(HEADER) + +JAVA_PATH = /usr/local/jdk-6u7-64 + +CPPFLAGS += -I $(JAVA_PATH)/include -I $(JAVA_PATH)/include/linux \ + +$(CLS) : $(SRC) + @mkdir -p classes + @$(JAVA_PATH)/bin/javac -sourcepath . -d classes $^ + +${HEADER} : ${CLS} + @$(JAVA_PATH)/bin/javah -classpath classes -o ${HEADER} \ + `echo ${CLS} | sed -e 's/classes\///g' -e 's/\.class//g' -e 's/\//\./g'` + +clobber : clean + @rm -rf $(SHARED_LIB) classes $(HEADER) diff --git a/src/ffi/java/hphp/Hphp.java b/src/ffi/java/hphp/Hphp.java new file mode 100644 index 0000000000000..65c440a8d864c --- /dev/null +++ b/src/ffi/java/hphp/Hphp.java @@ -0,0 +1,133 @@ +package hphp; + +/** + * The class that handles HPHP system calls. + * + * @author qixin + */ +public class Hphp { + public static native void includeFile(String file); + + /** + * Invokes a top-level PHP function. + */ + public static HphpVariant invoke(String func, HphpArray args) { + return invokeFunction(func, args.ptr); + } + + /** + * Invokes a static class method. + */ + public static HphpVariant invoke(String cls, String func, HphpArray args) { + return invokeStaticMethod(cls, func, args.ptr); + } + + /** + * Creates an object. + */ + public static HphpObject createObject(String cls, HphpArray args) { + return (HphpObject)createObject(cls, args.ptr); + } + +//////////////////////////////////////////////////////////////////////////////// + + private static boolean hphpInitialized = false; + private static HphpSession session = null; + + protected static synchronized void startHphp() { + if (!hphpInitialized) { + hphpInitialized = true; + ffiProcessInit(); + } + } + + /** + * Starts an hphp session, which is itself a thread. + */ + protected static synchronized void startSession() throws RuntimeException { + if (session != null) { + // There can only be one session at a time. + throw new RuntimeException("Cannot start a second Hphp session."); + } + ffiSessionInit(); + session = (HphpSession)Thread.currentThread(); + } + + /** + * Finishes an hphp session. + */ + protected static synchronized void finishSession() { + System.gc(); + System.runFinalization(); + ffiSessionExit(); + session = null; + } + + protected static HphpSession getSession() { + return session; + } + + protected static HphpNull createHphpNull(long ptr) { + return new HphpNull(ptr); + } + + protected static HphpBoolean createHphpBoolean(long ptr, boolean value) { + return new HphpBoolean(ptr, value); + } + + protected static HphpInt64 createHphpInt64(long ptr, long value) { + return new HphpInt64(ptr, value); + } + + protected static HphpDouble createHphpDouble(long ptr, double value) { + return new HphpDouble(ptr, value); + } + + protected static HphpString createHphpString(long ptr) { + return new HphpString(ptr); + } + + protected static HphpArray createHphpArray(long ptr) { + return new HphpArray(ptr); + } + + protected static HphpObject createHphpObject(long ptr) { + return new HphpObject(ptr); + } + + protected static native long buildVariant(int kind, long v, int len); + + protected static native void freeVariant(long ptr); + + protected static native long getIterBegin(long ptr); + + protected static native long getIterAdvanced(long ptr, long pos); + + protected static native boolean isIterValid(long ptr, long pos); + + protected static native HphpVariant getKey(long arrPtr, long pos); + + protected static native HphpVariant getValue(long arrPtr, long pos); + + protected static native HphpVariant invokeFunction(String func, + long argsPtr); + + protected static native HphpVariant invokeStaticMethod(String cls, + String func, + long argsPtr); + + protected static native HphpVariant invokeMethod(long targetPtr, String func, + long argsPtr); + + protected static native HphpVariant createObject(String cls, long argsPtr); + + protected static native void set(long map, long key, long value); + + protected static native HphpVariant get(long map, long key); + + protected static native long createHphpString(String str); + + protected static native void ffiProcessInit(); + protected static native void ffiSessionInit(); + protected static native void ffiSessionExit(); +} diff --git a/src/ffi/java/hphp/HphpArray.java b/src/ffi/java/hphp/HphpArray.java new file mode 100644 index 0000000000000..3e795b50841cb --- /dev/null +++ b/src/ffi/java/hphp/HphpArray.java @@ -0,0 +1,73 @@ +package hphp; + +public class HphpArray extends HphpVariant { + protected HphpArray(long ptr) { + super(ptr); + } + + public HphpArray() { + super(Hphp.buildVariant(HPHP_EMPTY_ARRAY, 0, 0)); + } + + public HphpArray(HphpVariant[] arr) { + this(); + for (HphpVariant v : arr) { + append(v); + } + } + + public HphpArray(HphpVariant v0) { + this(); + append(v0); + } + + public HphpArray(HphpVariant v0, HphpVariant v1) { + this(v0); + append(v1); + } + + public HphpArray(HphpVariant v0, HphpVariant v1, HphpVariant v2) { + this(v0, v1); + append(v2); + } + + public HphpArray(HphpVariant v0, HphpVariant v1, HphpVariant v2, + HphpVariant v3) { + this(v0, v1, v2); + append(v3); + } + + public HphpArray(HphpVariant v0, HphpVariant v1, HphpVariant v2, + HphpVariant v3, HphpVariant v4) { + this(v0, v1, v2, v3); + append(v4); + } + + public HphpArray(HphpVariant v0, HphpVariant v1, HphpVariant v2, + HphpVariant v3, HphpVariant v4, HphpVariant v5) { + this(v0, v1, v2, v3, v4); + append(v5); + } + + public void set(HphpVariant key, HphpVariant value) { + Hphp.set(this.ptr, key.ptr, value.ptr); + } + + public HphpVariant get(HphpVariant key) { + return Hphp.get(this.ptr, key.ptr); + } + + /** + * $arr[] = $v + */ + public HphpArray append(HphpVariant value) { + append(ptr, value.ptr); + return this; + } + + protected native void append(long arrPtr, long valPtr); + + public HphpArrayIterator iterator() { + return new HphpArrayIterator(this); + } +} diff --git a/src/ffi/java/hphp/HphpArrayIterator.java b/src/ffi/java/hphp/HphpArrayIterator.java new file mode 100644 index 0000000000000..ff7d5263dc612 --- /dev/null +++ b/src/ffi/java/hphp/HphpArrayIterator.java @@ -0,0 +1,51 @@ +package hphp; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +public class HphpArrayIterator implements Iterator { + private HphpArray arr; + private long pos; + + public HphpArrayIterator(HphpArray arr) { + this.arr = arr; + this.pos = Hphp.getIterBegin(arr.ptr); + } + + @Override + public boolean hasNext() { + return Hphp.isIterValid(arr.ptr, pos); + } + + @Override + public HphpVariant next() { + if (Hphp.isIterValid(arr.ptr, pos)) { + HphpVariant result = Hphp.getValue(arr.ptr, pos); + pos = Hphp.getIterAdvanced(arr.ptr, pos); + return result; + } + + throw new NoSuchElementException(); + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + public HphpVariant getNextKey() { + if (Hphp.isIterValid(arr.ptr, pos)) { + return Hphp.getKey(arr.ptr, pos); + } + + throw new NoSuchElementException(); + } + + public HphpVariant getNextValue() { + if (Hphp.isIterValid(arr.ptr, pos)) { + return Hphp.getValue(arr.ptr, pos); + } + + throw new NoSuchElementException(); + } +} diff --git a/src/ffi/java/hphp/HphpBoolean.java b/src/ffi/java/hphp/HphpBoolean.java new file mode 100644 index 0000000000000..a2066641d0aae --- /dev/null +++ b/src/ffi/java/hphp/HphpBoolean.java @@ -0,0 +1,40 @@ +package hphp; + +public class HphpBoolean extends HphpVariant { + private static HphpBoolean phpTrue = null; + private static HphpBoolean phpFalse = null; + + public static HphpBoolean phpTrue() { + if (phpTrue == null) { + phpTrue = new HphpBoolean(true); + } + return phpTrue; + } + + public static HphpBoolean phpFalse() { + if (phpFalse == null) { + phpFalse = new HphpBoolean(false); + } + return phpFalse; + } + + protected boolean value; + + public HphpBoolean(boolean value) { + super(Hphp.buildVariant(HPHP_BOOLEAN, value ? 1 : 0, 0)); + this.value = value; + } + + protected HphpBoolean(long ptr, boolean value) { + super(ptr); + this.value = value; + } + + public boolean getValue() { + return this.value; + } + + public String toString() { + return Boolean.toString(this.value); + } +} diff --git a/src/ffi/java/hphp/HphpDouble.java b/src/ffi/java/hphp/HphpDouble.java new file mode 100644 index 0000000000000..1464f86f7ad4c --- /dev/null +++ b/src/ffi/java/hphp/HphpDouble.java @@ -0,0 +1,24 @@ +package hphp; + +public class HphpDouble extends HphpVariant { + protected double value; + + public HphpDouble(double value) { + super(Hphp.buildVariant(HPHP_DOUBLE, + Double.doubleToRawLongBits(value), 0)); + this.value = value; + } + + protected HphpDouble(long ptr, double value) { + super(ptr); + this.value = value; + } + + public double getValue() { + return value; + } + + public String toString() { + return Double.toString(this.value); + } +} diff --git a/src/ffi/java/hphp/HphpInt64.java b/src/ffi/java/hphp/HphpInt64.java new file mode 100644 index 0000000000000..b1060a0ccd3d3 --- /dev/null +++ b/src/ffi/java/hphp/HphpInt64.java @@ -0,0 +1,23 @@ +package hphp; + +public class HphpInt64 extends HphpVariant { + protected long value; + + public HphpInt64(long value) { + super(Hphp.buildVariant(HPHP_INT64, value, 0)); + this.value = value; + } + + protected HphpInt64(long ptr, long value) { + super(ptr); + this.value = value; + } + + public long getValue() { + return this.value; + } + + public String toString() { + return Long.toString(this.value); + } +} diff --git a/src/ffi/java/hphp/HphpNull.java b/src/ffi/java/hphp/HphpNull.java new file mode 100644 index 0000000000000..c8530d5e70677 --- /dev/null +++ b/src/ffi/java/hphp/HphpNull.java @@ -0,0 +1,24 @@ +package hphp; + +public class HphpNull extends HphpVariant { + private static HphpNull phpNull = null; + + public static HphpNull phpNull() { + if (phpNull == null) { + phpNull = new HphpNull(); + } + return phpNull; + } + + public HphpNull() { + super(Hphp.buildVariant(HPHP_NULL, 0, 0)); + } + + protected HphpNull(long ptr) { + super(ptr); + } + + public String toString() { + return "null"; + } +} diff --git a/src/ffi/java/hphp/HphpObject.java b/src/ffi/java/hphp/HphpObject.java new file mode 100644 index 0000000000000..ecf905f810c08 --- /dev/null +++ b/src/ffi/java/hphp/HphpObject.java @@ -0,0 +1,15 @@ +package hphp; + +public class HphpObject extends HphpVariant { + protected HphpObject(long ptr) { + super(ptr); + } + + public HphpVariant invoke(String func, HphpArray args) { + return Hphp.invokeMethod(this.ptr, func, args.ptr); + } + + public HphpVariant get(HphpVariant key) { + return Hphp.get(this.ptr, key.ptr); + } +} diff --git a/src/ffi/java/hphp/HphpSession.java b/src/ffi/java/hphp/HphpSession.java new file mode 100644 index 0000000000000..ac51999a9c32c --- /dev/null +++ b/src/ffi/java/hphp/HphpSession.java @@ -0,0 +1,26 @@ +package hphp; + +public class HphpSession extends Thread { + private Runnable work; + + public HphpSession(Runnable work) { + this.work = work; + // In case it is not called already. + Hphp.startHphp(); + } + + public void run() { + Hphp.startSession(); + work.run(); + Hphp.finishSession(); + } + + public void start() { + super.start(); + try { + // Let the main thread wait for the current session to finish. + this.join(); + } catch (InterruptedException e) { + } + } +} diff --git a/src/ffi/java/hphp/HphpString.java b/src/ffi/java/hphp/HphpString.java new file mode 100644 index 0000000000000..c2600c5051ecf --- /dev/null +++ b/src/ffi/java/hphp/HphpString.java @@ -0,0 +1,26 @@ +package hphp; + +/** + * Wrapper of an HPHP string. + */ +public class HphpString extends HphpVariant { + protected String str; + + public HphpString(String str) { + super(Hphp.createHphpString(str)); + this.str = str; + } + + protected HphpString(long ptr) { + super(ptr); + this.str = getHphpString(ptr); + } + +// protected static native long createHphpString(String str); + + protected native String getHphpString(long ptr); + + public String toString() { + return str; + } +} diff --git a/src/ffi/java/hphp/HphpVariant.java b/src/ffi/java/hphp/HphpVariant.java new file mode 100644 index 0000000000000..0802aedcdca3b --- /dev/null +++ b/src/ffi/java/hphp/HphpVariant.java @@ -0,0 +1,24 @@ +package hphp; + +public abstract class HphpVariant { + final protected static int HPHP_NULL = 0; + final protected static int HPHP_BOOLEAN = 1; + final protected static int HPHP_INT64 = 2; + final protected static int HPHP_DOUBLE = 3; + final protected static int HPHP_STRING = 5; + final protected static int HPHP_ARRAY = 7; + final protected static int HPHP_OBJECT = 8; + final protected static int HPHP_EMPTY_ARRAY = 9; + + protected long ptr; // pointer value to the underlying hphp variant + protected HphpSession session; + + protected HphpVariant(long ptr) { + this.session = Hphp.getSession(); + this.ptr = ptr; + } + + public long getVariantPtr() { + return this.ptr; + } +} diff --git a/src/ffi/java/hphp_ffi_java.cpp b/src/ffi/java/hphp_ffi_java.cpp new file mode 100644 index 0000000000000..9bc8f295e292d --- /dev/null +++ b/src/ffi/java/hphp_ffi_java.cpp @@ -0,0 +1,403 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +/* + * hphp_ffi_java.cpp + * + * Created on: Sep 13, 2009 + * Author: qixin + */ + +#include +#include +#include +#include +#include +#include +#include +#include "hphp_ffi_java.h" + +using namespace HPHP; +using namespace std; + +ExecutionContext *context = NULL; +vector pointers; + +/** + * Helper function that creates HphpVariant objects in Java. + */ +jobject exportVariantToJava(JNIEnv *env, jclass hphp, void *value, int kind) { + Variant *result; + switch (kind) { + case 0: + static jmethodID null_init = + env->GetStaticMethodID(hphp, "createHphpNull", + "(J)Lhphp/HphpNull;"); + result = hphp_ffi_buildVariant(0, 0, 0); + pointers.push_back(result); + return env->CallStaticObjectMethod(hphp, null_init, (jlong)result); + case 1: + static jmethodID boolean_init = + env->GetStaticMethodID(hphp, "createHphpBoolean", + "(JZ)Lhphp/HphpBoolean;"); + result = hphp_ffi_buildVariant(1, value, 0); + pointers.push_back(result); + return env->CallStaticObjectMethod(hphp, boolean_init, (jlong)result, + value != NULL); + case 2: + static jmethodID int64_init = + env->GetStaticMethodID(hphp, "createHphpInt64", + "(JJ)Lhphp/HphpInt64;"); + result = hphp_ffi_buildVariant(2, value, 0); + pointers.push_back(result); + return env->CallStaticObjectMethod(hphp, int64_init, (jlong)result, + (jlong)value); + case 3: + static jmethodID double_init = + env->GetStaticMethodID(hphp, "createHphpDouble", + "(JD)Lhphp/HphpDouble;"); + result = hphp_ffi_buildVariant(3, value, 0); + pointers.push_back(result); + union { + double d; + void *p; + } u; + u.p = value; + return env->CallStaticObjectMethod(hphp, double_init, (jlong)result, + u.d); + case 4: + value = NEW(StringData)((const char *)value, CopyString); + case 5: + static jmethodID string_init = + env->GetStaticMethodID(hphp, "createHphpString", + "(J)Lhphp/HphpString;"); + result = hphp_ffi_buildVariant(5, value, 0); + pointers.push_back(result); + return env->CallStaticObjectMethod(hphp, string_init, (jlong)result); + case 6: + static jmethodID array_init = + env->GetStaticMethodID(hphp, "createHphpArray", + "(J)Lhphp/HphpArray;"); + result = hphp_ffi_buildVariant(7, value, 0); + pointers.push_back(result); + return env->CallStaticObjectMethod(hphp, array_init, (jlong)result); + case 7: + static jmethodID object_init = + env->GetStaticMethodID(hphp, "createHphpObject", + "(J)Lhphp/HphpObject;"); + result = hphp_ffi_buildVariant(8, value, 0); + pointers.push_back(result); + return env->CallStaticObjectMethod(hphp, object_init, (jlong)result); + default: + return NULL; + } +} + +extern "C" { + +/* Header for class hphp_Hphp */ + +/* + * Class: hphp_Hphp + * Method: buildVariant + * Signature: (IJI)J + */ +JNIEXPORT jlong JNICALL +Java_hphp_Hphp_buildVariant(JNIEnv *env, jclass hphp, + jint kind, jlong v, jint len) { +// Variant *result = buildAndStoreVariant(env, hphp, kind, (void *)v, len); + Variant *result = hphp_ffi_buildVariant(kind, (void *)v, len); + pointers.push_back(result); +// ((JavaFFISession *)session)->pointers.push_back(result); + return (jlong)result; +} + +/* + * Class: hphp_Hphp + * Method: freeVariant + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hphp_Hphp_freeVariant(JNIEnv *env, jclass hphp, jlong v) { + hphp_ffi_freeVariant((Variant *)v); +} + +/* + * Class: hphp_Hphp + * Method: getIterBegin + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hphp_Hphp_getIterBegin(JNIEnv *env, jclass hphp, jlong ptr) { + return hphp_ffi_iter_begin(((Variant *)ptr)->getArrayData()); +} + +/* + * Class: hphp_Hphp + * Method: getIterAdvanced + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL +Java_hphp_Hphp_getIterAdvanced(JNIEnv *env, jclass hphp, jlong ptr, + jlong pos) { + return hphp_ffi_iter_advance(((Variant *)ptr)->getArrayData(), pos); +} + +/* + * Class: hphp_Hphp + * Method: isIterValid + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL +Java_hphp_Hphp_isIterValid(JNIEnv *env, jclass hphp, jlong ptr, jlong pos) { + return !(hphp_ffi_iter_invalid(pos)); +} + +/* + * Class: hphp_Hphp + * Method: getKey + * Signature: (JJ)Lhphp/HphpVariant; + */ +JNIEXPORT jobject JNICALL +Java_hphp_Hphp_getKey(JNIEnv *env, jclass hphp, jlong arrPtr, jlong pos) { + void *result; + int kind = hphp_ffi_iter_getKey(((Variant *)arrPtr)->getArrayData(), pos, + &result); + return exportVariantToJava(env, hphp, result, kind); +} + +/* + * Class: hphp_Hphp + * Method: getValue + * Signature: (JJ)Lhphp/HphpVariant; + */ +JNIEXPORT jobject JNICALL +Java_hphp_Hphp_getValue(JNIEnv *env, jclass hphp, jlong arrPtr, jlong pos) { + void *result; + int kind = hphp_ffi_iter_getValue(((Variant *)arrPtr)->getArrayData(), pos, + &result); + return exportVariantToJava(env, hphp, result, kind); +} + +/* + * Class: hphp_Hphp + * Method: includeFile + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hphp_Hphp_includeFile(JNIEnv *env, jclass hphp, jstring file) { + const char *fstr = env->GetStringUTFChars(file, NULL); + hphp_ffi_include_file(fstr); + env->ReleaseStringUTFChars(file, fstr); +} + +/* + * Class: hphp_Hphp + * Method: invokeFunction + * Signature: (Ljava/lang/String;J)Lhphp/HphpVariant; + */ +JNIEXPORT jobject JNICALL +Java_hphp_Hphp_invokeFunction(JNIEnv *env, jclass hphp, jstring func, + jlong argsPtr) { + const char *fstr = env->GetStringUTFChars(func, NULL); + void *result; + int kind = + hphp_ffi_invoke_function(&result, fstr, + ((Variant *)argsPtr)->getArrayData()); + env->ReleaseStringUTFChars(func, fstr); + return exportVariantToJava(env, hphp, result, kind); +} + +/* + * Class: hphp_Hphp + * Method: invokeStaticMethod + * Signature: (Ljava/lang/String;Ljava/lang/String;J)Lhphp/HphpVariant; + */ +JNIEXPORT jobject JNICALL +Java_hphp_Hphp_invokeStaticMethod(JNIEnv *env, jclass hphp, jstring cls, + jstring func, jlong argsPtr) { + const char *cstr = env->GetStringUTFChars(cls, NULL); + const char *fstr = env->GetStringUTFChars(func, NULL); + void *result; + int kind = + hphp_ffi_invoke_static_method(&result, cstr, fstr, + ((Variant *)argsPtr)->getArrayData()); + env->ReleaseStringUTFChars(cls, cstr); + env->ReleaseStringUTFChars(func, fstr); + return exportVariantToJava(env, hphp, result, kind); +} + +/* + * Class: hphp_Hphp + * Method: invokeMethod + * Signature: (JLjava/lang/String;J)Lhphp/HphpVariant; + */ +JNIEXPORT jobject JNICALL +Java_hphp_Hphp_invokeMethod(JNIEnv *env, jclass hphp, jlong targetPtr, + jstring func, jlong argsPtr) { + const char *fstr = env->GetStringUTFChars(func, NULL); + void *result; + int kind = + hphp_ffi_invoke_object_method(&result, + ((Variant *)targetPtr)->getObjectData(), + fstr, + ((Variant *)argsPtr)->getArrayData()); + env->ReleaseStringUTFChars(func, fstr); + return exportVariantToJava(env, hphp, result, kind); +} + +/* + * Class: hphp_Hphp + * Method: createObject + * Signature: (Ljava/lang/String;J)Lhphp/HphpVariant; + */ +JNIEXPORT jobject JNICALL +Java_hphp_Hphp_createObject(JNIEnv *env, jclass hphp, jstring cls, + jlong argsPtr) { + const char *cstr = env->GetStringUTFChars(cls, NULL); + void *result; + int kind = + hphp_ffi_create_object(&result, cstr, + ((Variant *)argsPtr)->getArrayData()); + env->ReleaseStringUTFChars(cls, cstr); + return exportVariantToJava(env, hphp, result, kind); +} + +/* + * Class: hphp_Hphp + * Method: set + * Signature: (JIJIJI)V + */ +JNIEXPORT void JNICALL +Java_hphp_Hphp_set(JNIEnv *env, jclass hphp, jlong map, jlong key, + jlong value) { + hphp_ffi_addMapItem((Variant *)map, (Variant *)key, (Variant *)value); +} + +/* + * Class: hphp_Hphp + * Method: get + * Signature: (JJ)Lhphp/HphpVariant; + */ +JNIEXPORT jobject JNICALL +Java_hphp_Hphp_get(JNIEnv *env, jclass hphp, jlong map, jlong key) { + void *result; + int kind = hphp_ffi_getMapItem(&result, (Variant *)map, (Variant *)key); + return exportVariantToJava(env, hphp, result, kind); +} + +/* + * Class: hphp_Hphp + * Method: createHphpString + * Signature: (Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hphp_Hphp_createHphpString(JNIEnv *env, jclass hphp, jstring str) { + const char *s = env->GetStringUTFChars(str, NULL); + jsize len = env->GetStringUTFLength(str); + + // make a copy of the underlying string to avoid GC issue + Variant *result = hphp_ffi_buildVariant(6, (void *)s, len); + pointers.push_back(result); + + env->ReleaseStringUTFChars(str, s); + + return (jlong)result; +} + +/* + * Class: hphp_Hphp + * Method: ffiProcessInit + * Signature: ()V + */ +JNIEXPORT void JNICALL +Java_hphp_Hphp_ffiProcessInit(JNIEnv *env, jclass hphp) { + hphp_ffi_init(); +} + +/* + * Class: hphp_Hphp + * Method: ffiSessionInit + * Signature: ()V + */ +JNIEXPORT void JNICALL +Java_hphp_Hphp_ffiSessionInit(JNIEnv *env, jclass hphp) { + hphp_ffi_session_init(); + context = hphp_ffi_context_init(); +} + +/* + * Class: hphp_Hphp + * Method: ffiSessionExit + * Signature: ()V + */ +JNIEXPORT void JNICALL +Java_hphp_Hphp_ffiSessionExit(JNIEnv *env, jclass hphp) { + for (typeof(pointers.begin()) it = pointers.begin(); it != pointers.end(); it++) { + hphp_ffi_freeVariant(*it); + } + pointers.clear(); + hphp_ffi_context_exit(context); + context = NULL; + hphp_ffi_session_exit(); +} + +/* + * Class: hphp_Hphp + * Method: ffiContextInit + * Signature: ()J + */ +/*JNIEXPORT jlong JNICALL +Java_hphp_Hphp_ffiContextInit(JNIEnv *env, jclass hphp) { + ExecutionContext *context = hphp_ffi_context_init(); + return (jlong)context; +}*/ + +/* + * Class: hphp_Hphp + * Method: ffiContextExit + * Signature: (J)V + */ +/*JNIEXPORT void JNICALL +Java_hphp_Hphp_ffiContextExit(JNIEnv * env, jclass hphp, jlong context) { + hphp_ffi_context_exit((ExecutionContext *)context); +}*/ + +/* Header for class hphp_HphpString */ + +/* + * Class: hphp_HphpString + * Method: getHphpString + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hphp_HphpString_getHphpString(JNIEnv *env, jobject str, jlong ptr) { + const char *cstr; + hphp_ffi_string_data(((Variant *)ptr)->getStringData(), &cstr); + return env->NewStringUTF(cstr); +} + +/* + * Class: hphp_HphpArray + * Method: append + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hphp_HphpArray_append(JNIEnv *env, jobject arr, jlong arrPtr, + jlong valPtr) { + ((Variant *)arrPtr)->append(*(Variant *)valPtr); +} + +} diff --git a/src/ffi/swig/swig.h b/src/ffi/swig/swig.h new file mode 100644 index 0000000000000..229853e69554e --- /dev/null +++ b/src/ffi/swig/swig.h @@ -0,0 +1,340 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +#ifndef __HPHP_SWIG_H__ +#define __HPHP_SWIG_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define SWIG_NO_LLONG_MAX 1 + +/////////////////////////////////////////////////////////////////////////////// +// helpers, not exposed + +namespace HPHP { + +class HphpSession { +public: + HphpSession() { + hphp_ffi_session_init(); + context = hphp_ffi_context_init(); + } + + ~HphpSession() { + for (typeof(pointers.begin()) it = pointers.begin(); it != pointers.end(); + it++) { + hphp_ffi_freeVariant(*it); + } + pointers.clear(); + hphp_ffi_context_exit(context); + context = NULL; + hphp_ffi_session_exit(); + } + + void addVariant(HPHP::Variant *v) { + pointers.push_back(v); + } + +private: + HPHP::ExecutionContext *context; + std::vector pointers; +}; + +} + +HPHP::Variant *hphpBuildVariant(int kind, void *v) { + switch (kind) { + case 0: + case 1: + case 2: + case 3: + return hphp_ffi_buildVariant(kind, v, 0); + case 4: + v = NEW(HPHP::StringData)((const char *)v, HPHP::CopyString); + case 5: + return hphp_ffi_buildVariant(5, v, 0); + case 6: + return hphp_ffi_buildVariant(7, v, 0); + case 7: + return hphp_ffi_buildVariant(8, v, 0); + default: + // impossible + return NULL; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// initialization and session management + +void hphpStart() { + hphp_ffi_init(); +} + +HPHP::HphpSession *hphpStartSession() { + return new HPHP::HphpSession(); +} + +void hphpFinishSession(HPHP::HphpSession *session) { + delete session; +} + +/////////////////////////////////////////////////////////////////////////////// +// value manipulation and type inspection + +#define TypeNull 0 +#define TypeBoolean 1 +#define TypeInt 2 +#define TypeDouble 3 +#define TypeString 4 +#define TypeArray 5 +#define TypeObject 6 + +HPHP::Variant *hphpNull(HPHP::HphpSession *s) { + HPHP::Variant *ret = hphp_ffi_buildVariant(0, 0, 0); + s->addVariant(ret); + return ret; +} + +HPHP::Variant *hphpBoolean(HPHP::HphpSession *s, bool value) { + HPHP::Variant *ret = hphp_ffi_buildVariant(1, (void *)value, 0); + s->addVariant(ret); + return ret; +} + +HPHP::Variant *hphpInt(HPHP::HphpSession *s, long long value) { + HPHP::Variant *ret = hphp_ffi_buildVariant(2, (void *)value, 0); + s->addVariant(ret); + return ret; +} + +HPHP::Variant *hphpDouble(HPHP::HphpSession *s, double value) { + union { + double d; + void *p; + } u; + u.d = value; + HPHP::Variant *ret = hphp_ffi_buildVariant(3, u.p, 0); + s->addVariant(ret); + return ret; +} + +HPHP::Variant *hphpString(HPHP::HphpSession *s, const char *value) { + HPHP::Variant *ret = hphp_ffi_buildVariant(6, (void *)value, strlen(value)); + s->addVariant(ret); + return ret; +} + +HPHP::Variant *hphpArray(HPHP::HphpSession *s) { + HPHP::Variant *ret = hphp_ffi_buildVariant(9, 0, 0); + s->addVariant(ret); + return ret; +} + +int hphpGetType(HPHP::HphpSession *s, HPHP::Variant *v) { + switch (v->getType()) { + case HPHP::KindOfNull: + return TypeNull; + case HPHP::KindOfBoolean: + return TypeBoolean; + case HPHP::KindOfByte: + case HPHP::KindOfInt16: + case HPHP::KindOfInt32: + case HPHP::KindOfInt64: + return TypeInt; + case HPHP::KindOfDouble: + return TypeDouble; + case HPHP::LiteralString: + case HPHP::KindOfString: + return TypeString; + case HPHP::KindOfArray: + return TypeArray; + case HPHP::KindOfObject: + return TypeObject; + default: + // impossible + return -1; + } +} + +bool hphpGetBoolean(HPHP::HphpSession *s, HPHP::Variant *v) { + return v->toBoolean(); +} + +long long hphpGetInt(HPHP::HphpSession *s, HPHP::Variant *v) { + return v->toInt64(); +} + +double hphpGetDouble(HPHP::HphpSession *s, HPHP::Variant *v) { + return v->toDouble(); +} + +const char *hphpGetString(HPHP::HphpSession *s, HPHP::Variant *v) { + return v->toString().data(); +} + +/////////////////////////////////////////////////////////////////////////////// +// array operations + +void hphpSet(HPHP::HphpSession *s, HPHP::Variant *map, HPHP::Variant *key, + HPHP::Variant *value) { + hphp_ffi_addMapItem(map, key, value); +} + +HPHP::Variant *hphpGet(HPHP::HphpSession *s, HPHP::Variant *map, + HPHP::Variant *key) { + void *result; + int kind = hphp_ffi_getMapItem(&result, map, key); + HPHP::Variant *ret = hphpBuildVariant(kind, result); + s->addVariant(ret); + return ret; +} + +void hphpAppend(HPHP::HphpSession *s, HPHP::Variant *arr, + HPHP::Variant *value) { + arr->append(*value); +} + +long long hphpIterBegin(HPHP::HphpSession *s, HPHP::Variant *arr) { + return hphp_ffi_iter_begin(arr->getArrayData()); +} + +long long hphpIterAdvance(HPHP::HphpSession *s, HPHP::Variant *arr, + long long iter) { + return hphp_ffi_iter_advance(arr->getArrayData(), iter); +} + +bool hphpIterValid(HPHP::HphpSession *s, long long iter) { + return !hphp_ffi_iter_invalid(iter); +} + +HPHP::Variant *hphpIterGetKey(HPHP::HphpSession *s, HPHP::Variant *arr, + long long iter) { + void *result; + int kind = hphp_ffi_iter_getKey(arr->getArrayData(), iter, &result); + HPHP::Variant *ret = hphpBuildVariant(kind, result); + s->addVariant(ret); + return ret; +} + +HPHP::Variant *hphpIterGetValue(HPHP::HphpSession *s, HPHP::Variant *arr, + long long iter) { + void *result; + int kind = hphp_ffi_iter_getValue(arr->getArrayData(), iter, &result); + HPHP::Variant *ret = hphpBuildVariant(kind, result); + s->addVariant(ret); + return ret; +} + +int hphpCount(HPHP::HphpSession *s, HPHP::Variant *arr) { + return (int)arr->getArrayData()->size(); +} + +void hphpUnset(HPHP::HphpSession *s, HPHP::Variant *arr, HPHP::Variant *key) { + arr->weakRemove(*key); +} + +bool hphpIsset(HPHP::HphpSession *s, HPHP::Variant *arr, HPHP::Variant *key) { + return HPHP::isset(*arr, *key); +} + +/////////////////////////////////////////////////////////////////////////////// +// dynamic invocation of files and functions + +void hphpIncludeFile(HPHP::HphpSession *s, const char *file) { + hphp_ffi_include_file(file); +} + +HPHP::Variant *hphpInvoke(HPHP::HphpSession *s, const char *func, + HPHP::Variant *args) { + void *result; + int kind = hphp_ffi_invoke_function(&result, func, args->getArrayData()); + HPHP::Variant *ret = hphpBuildVariant(kind, result); + s->addVariant(ret); + return ret; +} + +HPHP::Variant *hphpInvokeMethod(HPHP::HphpSession *s, HPHP::Variant *target, + const char *func, HPHP::Variant *args) { + void *result; + int kind = hphp_ffi_invoke_object_method(&result, target->getObjectData(), + func, args->getArrayData()); + HPHP::Variant *ret = hphpBuildVariant(kind, result); + s->addVariant(ret); + return ret; +} + +HPHP::Variant *hphpInvokeStaticMethod(HPHP::HphpSession *s, const char *cls, + const char *func, HPHP::Variant *args) { + void *result; + int kind = hphp_ffi_invoke_static_method(&result, cls, func, + args->getArrayData()); + HPHP::Variant *ret = hphpBuildVariant(kind, result); + s->addVariant(ret); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// object operations + +HPHP::Variant *hphpNewObject(HPHP::HphpSession *s, const char *cls, + HPHP::Variant *args) { + void *result; + int kind = hphp_ffi_create_object(&result, cls, args->getArrayData()); + HPHP::Variant *ret = hphpBuildVariant(kind, result); + s->addVariant(ret); + return ret; +} + +HPHP::Variant *hphpGetField(HPHP::HphpSession *s, HPHP::Variant *obj, + const char *field) { + HPHP::Variant value = obj->getObjectData()->o_get(field, -1); + void *result; + int kind = hphp_ffi_exportVariant(value, &result); + HPHP::Variant *ret = hphpBuildVariant(kind, result); + s->addVariant(ret); + return ret; +} + +void hphpSetField(HPHP::HphpSession *s, HPHP::Variant *obj, const char *field, + HPHP::Variant *value) { + obj->getObjectData()->o_set(field, -1, *value); +} + +void hphpUnsetField(HPHP::HphpSession *s, HPHP::Variant *obj, + const char *field) { + toObject(*obj)->t___unset(field); +} + +bool hphpIssetField(HPHP::HphpSession *s, HPHP::Variant *obj, + const char *field) { + return toObject(*obj)->t___isset(field); +} + +/////////////////////////////////////////////////////////////////////////////// +// for debugging + +void hphpDump(HPHP::HphpSession *s, HPHP::Variant *v) { + v->dump(); +} + +/////////////////////////////////////////////////////////////////////////////// +#endif /* __HPHP_SWIG_H__ */ diff --git a/src/ffi/swig/swig.i b/src/ffi/swig/swig.i new file mode 100644 index 0000000000000..dd25d35cd0954 --- /dev/null +++ b/src/ffi/swig/swig.i @@ -0,0 +1,78 @@ +#define TypeNull 0 +#define TypeBoolean 1 +#define TypeInt 2 +#define TypeDouble 3 +#define TypeString 4 +#define TypeArray 5 +#define TypeObject 6 + +void hphpStart(); + +HphpSession *hphpStartSession(); + +void hphpFinishSession(HphpSession *); + +Variant *hphpNull(HphpSession *); + +Variant *hphpBoolean(HphpSession *, bool); + +Variant *hphpInt(HphpSession *, long long); + +Variant *hphpDouble(HphpSession *, double); + +Variant *hphpString(HphpSession *, const char *); + +Variant *hphpArray(HphpSession *); + +int hphpGetType(HphpSession *, Variant *); + +bool hphpGetBoolean(HphpSession *, Variant *); + +long long hphpGetInt(HphpSession *, Variant *); + +double hphpGetDouble(HphpSession *, Variant *); + +const char *hphpGetString(HphpSession *, Variant *); + +void hphpSet(HphpSession *, Variant *, Variant *, Variant *); + +Variant *hphpGet(HphpSession *, Variant *, Variant *); + +void hphpAppend(HphpSession *, Variant *, Variant *); + +void hphpIncludeFile(HphpSession *, const char *); + +Variant *hphpInvoke(HphpSession *, const char *, Variant *); + +Variant *hphpInvokeMethod(HphpSession *, Variant *, const char *, Variant *); + +Variant *hphpInvokeStaticMethod(HphpSession *, const char *, const char *, + Variant *); + +Variant *hphpNewObject(HphpSession *, const char *, Variant *); + +long long hphpIterBegin(HphpSession *, Variant *); + +long long hphpIterAdvance(HphpSession *, Variant *, long long); + +bool hphpIterValid(HphpSession *, long long); + +Variant *hphpIterGetKey(HphpSession *, Variant *, long long); + +Variant *hphpIterGetValue(HphpSession *, Variant *, long long); + +int hphpCount(HphpSession *, Variant *); + +void hphpUnset(HphpSession *, Variant *, Variant *); + +bool hphpIsset(HphpSession *, Variant *, Variant *); + +Variant *hphpGetField(HphpSession *, Variant *, const char *); + +void hphpSetField(HphpSession *, Variant *, const char *, Variant *); + +void hphpUnsetField(HphpSession *, Variant *, const char *); + +bool hphpIssetField(HphpSession *, Variant *, const char *); + +void hphpDump(HphpSession *, Variant *); diff --git a/src/hphp/Makefile b/src/hphp/Makefile new file mode 100644 index 0000000000000..d492289fcc77e --- /dev/null +++ b/src/hphp/Makefile @@ -0,0 +1,20 @@ + +PROJECT_ROOT = ../.. +PROJECT_NAME = hphp + +AUTO_SOURCES = 1 + +LIBS = \ + $(LIB_DIR)/libhphp_analysis.a \ + $(LIB_DIR)/libhphp_runtime.a \ + $(ALL_LIBS) + +include $(PROJECT_ROOT)/src/rules.mk +TARGETS = $(APP_TARGET) + +HOOK_RULE_FILE = $(wildcard hook.mk) +ifneq ($(strip $(HOOK_RULE_FILE)),) + include hook.mk +endif + +all: $(TARGETS) diff --git a/src/hphp/hook.mk b/src/hphp/hook.mk new file mode 100644 index 0000000000000..96ef68a36b1a5 --- /dev/null +++ b/src/hphp/hook.mk @@ -0,0 +1,14 @@ + +CXX_SOURCES += fb_lib_hooks.cpp +INTERMEDIATE_FILES += fb_lib_hooks.cpp fb_lib_hooks.h + +fb_lib_hooks.cpp: \ + ../../facebook/src/lib/fb_lib_hooks.cpp \ + fb_lib_hooks.h + @cp $< $@ + +fb_lib_hooks.h: \ + ../../facebook/src/lib/fb_lib_hooks.h + @cp $< $@ + +hphp: fb_lib_hooks.o diff --git a/src/hphp/main.cpp b/src/hphp/main.cpp new file mode 100644 index 0000000000000..081b2b08df294 --- /dev/null +++ b/src/hphp/main.cpp @@ -0,0 +1,789 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost::program_options; + +struct ProgramOptions { + string target; + string format; + string outputDir; + string syncDir; + string config; + string dbConfig; + string configDir; + vector confStrings; + string inputDir; + vector inputs; + string inputList; + vector modules; + vector excludeDirs; + vector fmodules; + vector ffiles; + vector excludeFiles; + vector excludePatterns; + vector cfiles; + vector cmodules; + bool parseOnDemand; + string program; + string programArgs; + string branch; + int revision; + bool genStats; + bool keepTempDir; + bool staticMethodAutoFix; + string dbStats; + bool noTypeInference; + bool noMinInclude; + bool noMetaInfo; + int logLevel; + bool force; + int clusterCount; + int optimizeLevel; + string filecache; + string rttiDirectory; + string javaRoot; + bool generateFFI; +}; + +int prepareOptions(ProgramOptions &po, int argc, char **argv); +void createOutputDirectory(ProgramOptions &po); +int process(const ProgramOptions &po); +int lintTarget(const ProgramOptions &po); +int analyzeTarget(const ProgramOptions &po, AnalysisResultPtr ar); +int phpTarget(const ProgramOptions &po, AnalysisResultPtr ar); +int cppTarget(const ProgramOptions &po, AnalysisResultPtr ar, + bool allowSys = true); +int runTargetCheck(const ProgramOptions &po, AnalysisResultPtr ar); +int buildTarget(const ProgramOptions &po); +int runTarget(const ProgramOptions &po); + +/////////////////////////////////////////////////////////////////////////////// + +int main(int argc, char **argv) { + try { + ProgramOptions po; + void (*lib_hook_initialize)(); + lib_hook_initialize = + (void (*)())dlsym(NULL, "lib_hook_initialize"); + if (lib_hook_initialize) lib_hook_initialize(); + int ret = prepareOptions(po, argc, argv); + Timer totalTimer(Timer::WallTime, "running hphp"); + createOutputDirectory(po); + if (ret == 0) { +// This forking is needed, if parser holds large amount of memory and later +// Process::Exec() will try to fork with failures. +#if 1 + int pid = fork(); + if (pid == 0) { + ret = process(po); + _exit(ret); + } + wait(&ret); + ret = WEXITSTATUS(ret); +#else + ret = process(po); +#endif + } + if (ret == 0) { + if (po.target == "cpp") { + if (po.format == "exe" || po.format == "lib") { + ret = buildTarget(po); + } + } else if (po.target == "run") { + ret = runTarget(po); + } + } + if (ret) { + Logger::Error("hphp failed"); + } + return ret; + } catch (Exception &e) { + cerr << "Exception: " << e.getMessage() << "\n"; + } catch (std::exception &e) { + cerr << "std::exception: " << e.what() << "\n"; + } catch (...) { + cerr << "(unknown exception was thrown)\n"; + } + return -1; +} + +/////////////////////////////////////////////////////////////////////////////// + +int prepareOptions(ProgramOptions &po, int argc, char **argv) { + options_description desc("HipHop Compiler for PHP Usage:\n\n" + "\thphp \n\n" + "Options"); + desc.add_options() + ("help", "display this message") + ("target,t", value(&po.target)->default_value("run"), + "lint | " + "analyze | " + "php | " + "cpp | " + "filecache | " + "run (default)") + ("format,f", value(&po.format), + "lint: (none); \n" + "analyze: (none); \n" + "php: trimmed (default) | inlined | pickled | typeinfo |" + " ; \n" + "cpp: cluster (default) | file | sys | exe | lib; \n" + "run: cluster (default) | file") + ("cluster-count", value(&po.clusterCount)->default_value(0), + "Cluster by file sizes and output roughly these many number of files. " + "Use 0 for no clustering.") + ("input-dir", value(&po.inputDir), "input directory") + ("program", value(&po.program)->default_value("program"), + "final program name to use") + ("args", value(&po.programArgs), "program arguments") + ("inputs,i", value >(&po.inputs), "input file names") + ("input-list", value(&po.inputList), + "file containing list of file names, one per line") + ("module", value >(&po.modules)->composing(), + "directories containing all input files") + ("exclude-dir", value >(&po.excludeDirs)->composing(), + "directories to exclude from the input") + ("fmodule", value >(&po.fmodules)->composing(), + "same with module, except no exclusion checking is performed, so these " + "modules are forced to be included") + ("ffile", value >(&po.ffiles)->composing(), + "extra PHP files forced to include without exclusion checking") + ("exclude-file", value >(&po.excludeFiles)->composing(), + "files to exclude from the input, even if parse-on-demand finds it") + ("exclude-pattern", + value >(&po.excludePatterns)->composing(), + "regex (in 'find' command's regex command line option format) of files " + "or directories to exclude from the input, even if parse-on-demand finds " + "it") + ("cfile", value >(&po.cfiles)->composing(), + "extra static files forced to include without exclusion checking") + ("cmodule", value >(&po.cmodules)->composing(), + "extra directories for static files without exclusion checking") + ("parse-on-demand", value(&po.parseOnDemand)->default_value(true), + "whether to parse files that are not specified from command line") + ("branch", value(&po.branch), "SVN branch") + ("revision", value(&po.revision), "SVN revision") + ("output-dir,o", value(&po.outputDir), "output directory") + ("sync-dir", value(&po.syncDir), + "Files will be created in this directory first, then sync with output " + "directory without overwriting identical files. Great for incremental " + "compilation and build.") + ("optimize-level", value(&po.optimizeLevel)->default_value(1), + "optimization level") + ("gen-stats", value(&po.genStats)->default_value(false), + "whether to generate dependency graphs and code errors") + ("keep-tempdir", value(&po.keepTempDir)->default_value(false), + "whether to keep the temporary directory") + ("static-method-autofix", + value(&po.staticMethodAutoFix)->default_value(true), + "whether to change a method to static if it is called statically") + ("db-stats", value(&po.dbStats), + "database connection string to save dependency graphs and code errors: " + ":@:/") + ("no-type-inference", + value(&po.noTypeInference)->default_value(false), + "turn off type inference for C++ code generation") + ("no-min-include", + value(&po.noMinInclude)->default_value(false), + "turn off minimium include analysis when target is \"analyze\"") + ("no-meta-info", + value(&po.noMetaInfo)->default_value(false), + "do not generate class map, function jump table and macros " + "when generating code; good for demo purposes") + ("config", value(&po.config), "config file name") + ("db-config", value(&po.dbConfig), + "database connection string to read configurable options from: " + ":@:/") + ("config-dir", value(&po.configDir), + "root directory configuration is based on (for example, " + "excluded directories may be relative path in configuration.") + ("config-value,v", value >(&po.confStrings)->composing(), + "individual configuration string in a format of name=value, where " + "name can be any valid configuration for a config file") + ("log", + value(&po.logLevel)->default_value(-1), + "-1: (default); 0: no logging; 1: errors only; 2: warnings and errors; " + "3: informational as well; 4: really verbose.") + ("force", + value(&po.force)->default_value(false), + "force to ignore code generation errors and continue compilations") + ("file-cache", + value(&po.filecache), + "if specified, generate a static file cache with this file name") + ("rtti-directory", value(&po.rttiDirectory)->default_value(""), + "the directory of rtti profiling data") + ("java-root", + value(&po.javaRoot)->default_value("php"), + "the root package of generated Java FFI classes") + ("generate-ffi", + value(&po.generateFFI)->default_value(false), + "generate ffi stubs") + ; + + positional_options_description p; + p.add("inputs", -1); + variables_map vm; + try { + store(command_line_parser(argc, argv).options(desc).positional(p).run(), + vm); + notify(vm); + } catch (unknown_option e) { + cerr << "Error in command line: " << e.what() << "\n\n"; + cout << desc << "\n"; + return 1; + } + if (argc <= 1 || vm.count("help")) { + cout << desc << "\n"; + return 1; + } + + // log level + if (po.logLevel != -1) { + Logger::LogLevel = (Logger::LogLevelType)po.logLevel; + } else if (po.target == "run") { + Logger::LogLevel = Logger::LogNone; + } else { + Logger::LogLevel = Logger::LogInfo; + } + + // config and system + Option::GenerateCPPMain = true; + if (po.noMetaInfo) { + Option::GenerateCPPMetaInfo = false; + Option::GenerateCPPMacros = false; + } + if (po.config.empty() || + (po.config.size() > 4 && + po.config.substr(po.config.size() - 4) == ".hdf")) { + Hdf config; + if (!po.config.empty()) { + config.open(po.config); + } + for (unsigned int i = 0; i < po.confStrings.size(); i++) { + config.fromString(po.confStrings[i].c_str()); + } + Option::Load(config); + } else if (!po.config.empty() && !Option::Load(po.config.c_str())) { + return 1; + } + if (!po.dbConfig.empty()) { + try { + Option::Load(ServerData::Create(po.dbConfig)); + } catch (DatabaseException e) { + Logger::Error("%s", e.what()); + return 1; + } + } + if (po.inputDir.empty()) { + po.inputDir = '.'; + } + if (po.inputDir[po.inputDir.size() - 1] != '/') { + po.inputDir += '/'; + } + if (po.configDir.empty()) { + po.configDir = po.inputDir; + } + if (!po.configDir.empty() && po.configDir[po.configDir.size() - 1] != '/') { + po.configDir += '/'; + } + Option::RootDirectory = po.configDir; + + for (unsigned int i = 0; i < po.excludeDirs.size(); i++) { + Option::PackageExcludeDirs.insert(po.excludeDirs[i]); + } + for (unsigned int i = 0; i < po.excludeFiles.size(); i++) { + Option::PackageExcludeFiles.insert(po.excludeFiles[i]); + } + for (unsigned int i = 0; i < po.excludePatterns.size(); i++) { + const char *argv[] = {"", "-L", (char*)po.inputDir.c_str(), + "-type", "f", + "-regex", po.excludePatterns[i].c_str(), + NULL}; + string files; vector out; + Process::Exec("find", argv, NULL, files); + Util::split('\n', files.c_str(), out, true); + for (unsigned int j = 0; j < out.size(); j++) { + string file = out[j].substr(po.inputDir.size()); + Option::PackageExcludeFiles.insert(file); + } + } + + if (po.target == "cpp" && po.format == "sys") { + BuiltinSymbols::NoSuperGlobals = true; // so to generate super globals + } + + Option::ProgramName = po.program; + + if (po.target == "cpp") { + if (po.format.empty()) po.format = "cluster"; + } else if (po.target == "php") { + if (po.format.empty()) po.format = "trimmed"; + } else if (po.target == "run") { + if (po.format.empty()) po.format = "cluster"; + } + + if (po.optimizeLevel > 0) { + Option::PreOptimization = true; + Option::PostOptimization = true; + } + + if (po.staticMethodAutoFix) { + Option::StaticMethodAutoFix = true; + } + + if (po.generateFFI) { + Option::GenerateFFI = true; + Option::JavaFFIRootPackage = po.javaRoot; + } + + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +int process(const ProgramOptions &po) { + // lint doesn't need analysis + if (po.target == "lint") { + return lintTarget(po); + } + + Timer timer(Timer::WallTime); + AnalysisResultPtr ar; + + // prepare a package + Package package(po.inputDir.c_str()); + ar = package.getAnalysisResult(); + if (po.target != "php" || po.format != "pickled") { + BuiltinSymbols::load(ar, po.target == "cpp" && po.format == "sys"); + ar->loadBuiltins(); + } + + { + Timer timer(Timer::WallTime, "parsing inputs"); + if (!po.inputs.empty() && po.target == "php" && po.format == "pickled") { + for (unsigned int i = 0; i < po.inputs.size(); i++) { + package.addSourceFile(po.inputs[i].c_str()); + } + if (!package.parse()) { + return 1; + } + } else { + ar->setPackage(&package); + ar->setParseOnDemand(po.parseOnDemand); + if (po.modules.empty() && po.fmodules.empty() && + po.ffiles.empty() && po.inputs.empty() && po.inputList.empty()) { + package.addAllFiles(false); + } else { + for (unsigned int i = 0; i < po.modules.size(); i++) { + package.addDirectory(po.modules[i], false); + } + for (unsigned int i = 0; i < po.fmodules.size(); i++) { + package.addDirectory(po.fmodules[i], true); + } + for (unsigned int i = 0; i < po.ffiles.size(); i++) { + package.addSourceFile(po.ffiles[i].c_str()); + } + for (unsigned int i = 0; i < po.cmodules.size(); i++) { + package.addStaticDirectory(po.cmodules[i].c_str()); + } + for (unsigned int i = 0; i < po.cfiles.size(); i++) { + package.addStaticFile(po.cfiles[i].c_str()); + } + for (unsigned int i = 0; i < po.inputs.size(); i++) { + package.addSourceFile(po.inputs[i].c_str()); + } + if (!po.inputList.empty()) { + package.addListFiles(po.inputList.c_str()); + } + } + } + if (po.target != "filecache") { + if (!package.parse()) { + return 1; + } + ar->analyzeProgram(); + } + } + + // saving file cache + if (!po.filecache.empty()) { + Logger::Info("saving file cache..."); + package.getFileCache()->save(po.filecache.c_str()); + + struct stat sb; + stat(po.filecache.c_str(), &sb); + Logger::Info("%dMB %s saved", (int64)sb.st_size/(1024*1024), + po.filecache.c_str()); + } + + int ret = 0; + bool fatalErrorOnly = false; + if (po.target == "analyze") { + ret = analyzeTarget(po, ar); + } else if (po.target == "php") { + ret = phpTarget(po, ar); + } else if (po.target == "cpp") { + ret = cppTarget(po, ar); + fatalErrorOnly = true; + } else if (po.target == "run") { + ret = runTargetCheck(po, ar); + fatalErrorOnly = true; + } else if (po.target == "filecache") { + // do nothing + } else { + Logger::Error("Unknown target: %s", po.target.c_str()); + return 1; + } + + // saving stats + if (po.target == "analyze" || po.genStats || !po.dbStats.empty()) { + int seconds = timer.getMicroSeconds() / 1000000; + + Logger::Info("saving code errors, dependency graph and stats..."); + if (!po.dbStats.empty()) { + try { + ServerDataPtr server = ServerData::Create(po.dbStats); + int runId = package.saveStatsToDB(server, seconds, po.branch, + po.revision); + if (runId) { + ar->getCodeError()->saveToDB(server, runId); + ar->getDependencyGraph()->saveToDB(server, runId); + } + package.commitStats(server, runId); + } catch (DatabaseException e) { + Logger::Error("%s", e.what()); + } + } else { + ar->getCodeError()->saveToFile((po.outputDir + "/CodeError.js").c_str(), + !fatalErrorOnly); + package.saveStatsToFile((po.outputDir + "/Stats.js").c_str(), seconds); + mkdir((po.outputDir + "/dep").c_str(), 0777); + ar->getDependencyGraph()->saveToFiles((po.outputDir + "/dep").c_str()); + } + } else { + if (ar->getCodeError()->exists(false)) { + Logger::Info("saving code errors..."); + ar->getCodeError()->saveToFile((po.outputDir + "/CodeError.js").c_str(), + !fatalErrorOnly); + } + } + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +int lintTarget(const ProgramOptions &po) { + int ret = 0; + for (unsigned int i = 0; i < po.inputs.size(); i++) { + AnalysisResultPtr ar(new AnalysisResult()); + string filename = po.inputDir + "/" + po.inputs[i]; + try { + Scanner scanner(new ylmm::basic_buffer(filename.c_str()), true, false); + ParserPtr parser(new Parser(scanner, filename.c_str(), 0, ar)); + if (parser->parse()) { + Logger::Error("Unable to parse file %s: %s", filename.c_str(), + parser->getMessage().c_str()); + ret = 1; + } else { + Logger::Info("%s parsed successfully...", filename.c_str()); + } + } catch (std::runtime_error) { + Logger::Error("Unable to open file %s", filename.c_str()); + ret = 1; + } + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +int analyzeTarget(const ProgramOptions &po, AnalysisResultPtr ar) { + int ret = 0; + + if (!po.noTypeInference) { + Option::GenerateInferredTypes = true; + } + if (Option::GenerateInferredTypes) { + Timer timer(Timer::WallTime, "inferring types"); + ar->inferTypes(); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +int phpTarget(const ProgramOptions &po, AnalysisResultPtr ar) { + int ret = 0; + + // format + int formatCount = 0; + if (po.format.find("pickled") != string::npos) { + Option::GeneratePickledPHP = true; + formatCount++; + } + if (po.format.find("inlined") != string::npos) { + Option::GenerateInlinedPHP = true; + formatCount++; + } + if (po.format.find("trimmed") != string::npos) { + Option::GenerateTrimmedPHP = true; + formatCount++; + } + if (po.format.find("typeinfo") != string::npos) { + Option::GenerateInferredTypes = true; + } + if (formatCount == 0) { + Logger::Error("Unknown format for PHP target: %s", po.format.c_str()); + return 1; + } + + // analyze + if (Option::GenerateInferredTypes || Option::ConvertSuperGlobals) { + Logger::Info("inferring types..."); + ar->inferTypes(); + } + + // generate + ar->setOutputPath(po.outputDir); + if (Option::GeneratePickledPHP) { + Logger::Info("creating pickled PHP files..."); + string outputDir = po.outputDir; + if (formatCount > 1) outputDir += "/pickled"; + mkdir(outputDir.c_str(), 0777); + ar->outputAllPHP(CodeGenerator::PickledPHP); + } + if (Option::GenerateInlinedPHP) { + Logger::Info("creating inlined PHP files..."); + string outputDir = po.outputDir; + if (formatCount > 1) outputDir += "/inlined"; + mkdir(outputDir.c_str(), 0777); + if (!ar->outputAllPHP(CodeGenerator::InlinedPHP)) { + ret = -1; + } + } + if (Option::GenerateTrimmedPHP) { + Logger::Info("creating trimmed PHP files..."); + string outputDir = po.outputDir; + if (formatCount > 1) outputDir += "/trimmed"; + mkdir(outputDir.c_str(), 0777); + if (!ar->outputAllPHP(CodeGenerator::TrimmedPHP)) { + ret = -1; + } + } + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +int cppTarget(const ProgramOptions &po, AnalysisResultPtr ar, + bool allowSys /* = true */) { + int ret = 0; + int clusterCount = po.clusterCount; + // format + CodeGenerator::Output format = CodeGenerator::InvalidOutput; + if (po.format == "file") { + clusterCount = 0; + format = CodeGenerator::FileCPP; + } else if (po.format == "cluster") { + format = CodeGenerator::ClusterCPP; + } else if (po.format == "sys" && allowSys) { + clusterCount = 0; + format = CodeGenerator::SystemCPP; + } else if (po.format == "exe" || po.format == "lib") { + format = CodeGenerator::ClusterCPP; + } + + if (format == CodeGenerator::InvalidOutput) { + Logger::Error("Unknown format for CPP target: %s", po.format.c_str()); + return 1; + } + + if (!po.noTypeInference) { + Option::GenerateInferredTypes = true; + } + if (Option::PreOptimization) { + Timer timer(Timer::WallTime, "pre-optimizing"); + ar->preOptimize(); + } + + + if (!Option::RTTIOutputFile.empty()) { + if (!po.rttiDirectory.empty()) { + Option::UseRTTIProfileData = true; + ar->cloneRTTIFuncs(po.rttiDirectory.c_str()); + } else { + Option::GenRTTIProfileData = true; + } + } + + if (Option::GenerateInferredTypes) { + Timer timer(Timer::WallTime, "inferring types"); + ar->inferTypes(); + } + if (Option::PostOptimization) { + Timer timer(Timer::WallTime, "post-optimizing"); + ar->postOptimize(); + } + ar->analyzeProgramFinal(); + + { + Timer timer(Timer::WallTime, "creating CPP files"); + if (po.syncDir.empty()) { + ar->setOutputPath(po.outputDir); + ar->outputAllCPP(format, clusterCount, NULL); + } else { + ar->setOutputPath(po.syncDir); + ar->outputAllCPP(format, clusterCount, &po.outputDir); + Util::syncdir(po.outputDir, po.syncDir); + boost::filesystem::remove_all(po.syncDir); + } + } + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +int buildTarget(const ProgramOptions &po) { + const char *HPHP_HOME = getenv("HPHP_HOME"); + if (!HPHP_HOME || !*HPHP_HOME) { + throw Exception("Environment variable HPHP_HOME is not set."); + } + string cmd = string(HPHP_HOME) + "/bin/run.sh"; + string flags; + if (getenv("RELEASE")) flags += "RELEASE=1 "; + if (getenv("SHOW_LINK")) flags += "SHOW_LINK=1 "; + if (getenv("SHOW_COMPILE")) flags += "SHOW_COMPILE=1 "; + if (po.format == "lib") flags += "HPHP_BUILD_LIBRARY=1 "; + if (Option::GenerateFFI) flags += "HPHP_BUILD_FFI=1 "; + const char *argv[] = {"", po.outputDir.c_str(), + po.program.c_str(), flags.c_str(), NULL}; + + if (getenv("SHOW_COMPILE")) { + Logger::Info ("Compile command: %s %s %s", po.outputDir.c_str(), + po.program.c_str(), flags.c_str()); + } + Timer timer(Timer::WallTime, "compiling and linking CPP files"); + string out, err; + bool ret = Process::Exec(cmd.c_str(), argv, NULL, out, &err); + if (getenv("SHOW_COMPILE")) { + Logger::Info("%s", out.c_str()); + } else { + Logger::Verbose("%s", out.c_str()); + } + Logger::Error("%s", err.c_str()); + if (!ret) { + return 1; + } + + return 0; +} + +int runTargetCheck(const ProgramOptions &po, AnalysisResultPtr ar) { + // generate code + if (po.format != "sep" && cppTarget(po, ar, false)) { + return 1; + } + + // check error + if (ar->getCodeError()->exists(false) && !po.force) { + ar->getCodeError()->dump(false); + return 1; + } + + return 0; +} + +int runTarget(const ProgramOptions &po) { + int ret = buildTarget(po); + if (ret) { + return ret; + } + + // If there are more than one input files, we need one extra arg to run. + // If it's missing, we will stop right here, with compiled code. + if (po.inputs.size() > 1 && po.programArgs.empty() || + !po.inputList.empty()) { + return 0; + } + + // run the executable + string cmd = po.outputDir + '/' + po.program + ' ' + "--file " + + (po.inputs.size() == 1 ? po.inputs[0] : "") + po.programArgs; + Logger::Info("running executable %s...", cmd.c_str()); + Util::ssystem(cmd.c_str()); + + // delete the temporary directory if not needed + if (!po.keepTempDir) { + Logger::Info("deleting temporary directory %s...", po.outputDir.c_str()); + boost::filesystem::remove_all(po.outputDir); + } + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +void createOutputDirectory(ProgramOptions &po) { + if (po.outputDir.empty()) { + string temp = po.outputDir; + if (temp.empty()) { + temp = "/tmp"; + } + temp += "/hphp_XXXXXX"; + char path[PATH_MAX + 1]; + strncpy(path, temp.c_str(), sizeof(path)); + path[temp.size()] = '\0'; + po.outputDir = mkdtemp(path); + Logger::Info("generating temporary directory %s...", po.outputDir.c_str()); + } + mkdir(po.outputDir.c_str(), 0777); + + if (!po.syncDir.empty()) { + Logger::Info("re-creating sync directory %s...", po.syncDir.c_str()); + boost::filesystem::remove_all(po.syncDir); + mkdir(po.syncDir.c_str(), 0777); + } +} diff --git a/src/hphp/makefile_mono b/src/hphp/makefile_mono new file mode 100644 index 0000000000000..910ea30093eaf --- /dev/null +++ b/src/hphp/makefile_mono @@ -0,0 +1,21 @@ + +HPHP_ROOT = /usr/local/bin/hphp/ +PROJECT_NAME = program +PROJECT_ROOT = $(HPHP_ROOT)/ + +AUTO_SOURCES = 1 + +SYSTEM=$(PROJECT_ROOT)/src/lib/system/ +CXXFLAGS += -I../../util -I../../zend -I../base -I../ext -I$(SYSTEM) + +LIBS = \ + $(LIB_DIR)/libhphp_cpp_ext.a \ + $(LIB_DIR)/libhphp_cpp_base.a \ + $(LIB_DIR)/libzend.a \ + $(LIB_DIR)/libutil.a \ + -lcrypt + +include $(PROJECT_ROOT)/src/rules.mk +TARGETS = $(APP_TARGET) + +all: $(TARGETS) diff --git a/src/hphpi/Makefile b/src/hphpi/Makefile new file mode 100644 index 0000000000000..98aaf2e19beaa --- /dev/null +++ b/src/hphpi/Makefile @@ -0,0 +1,16 @@ + +PROJECT_ROOT = ../.. + +HPHP = $(PROJECT_ROOT)/src/hphp/hphp +PHP_FILES = hphpi.php + +all: hphpi + +hphpi: $(HPHP) $(PHP_FILES) hphpi_build.hdf + @echo "Compiling hphpi..." + @$(HPHP) -t cpp -f exe --input-dir . -i $(PHP_FILES) -o gen \ + --config hphpi_build.hdf --log=1 + @mv gen/program hphpi + +clobber: + @rm -rf gen hphpi diff --git a/src/hphpi/hphpi.php b/src/hphpi/hphpi.php new file mode 100644 index 0000000000000..c7dc4344215bc --- /dev/null +++ b/src/hphpi/hphpi.php @@ -0,0 +1,8 @@ + 1) { + $argc--; + array_shift($argv); + include $argv[0]; +} else { + echo "Give me a file\n"; +} diff --git a/src/hphpi/hphpi_build.hdf b/src/hphpi/hphpi_build.hdf new file mode 100644 index 0000000000000..3fc00f217a994 --- /dev/null +++ b/src/hphpi/hphpi_build.hdf @@ -0,0 +1 @@ +EnableEval = 2 diff --git a/src/idl/Makefile b/src/idl/Makefile new file mode 100644 index 0000000000000..73b9141291c7c --- /dev/null +++ b/src/idl/Makefile @@ -0,0 +1,61 @@ + +IDL_PHPS = $(wildcard *.idl.php) +LIBRARIES = $(patsubst %.idl.php, %, $(IDL_PHPS)) +UPDATES = $(patsubst %.idl.php, %.update, $(IDL_PHPS)) +TARGETS = $(LIBRARIES) + +all: $(TARGETS) + +updateall: $(UPDATES) + +lists: ../lib/system/ext.inc ../test/test_ext.h ../test/test_ext.inc ../cpp/ext/ext.h + +../lib/system/ext.inc: idl_list.php $(IDL_PHPS) + @echo 'Generating $@' + @php idl_list.php inc $@ + @touch ../lib/system/builtin_symbols.cpp + +../test/test_ext.h: idl_list.php $(IDL_PHPS) + @echo 'Generating $@' + @php idl_list.php test_ext $@ + +../test/test_ext.inc: idl_list.php $(IDL_PHPS) + @echo 'Generating $@' + @php idl_list.php test_suites $@ + @touch ../test/test.cpp + +../cpp/ext/ext.h: idl_list.php $(IDL_PHPS) + @echo 'Generating $@' + @php idl_list.php ext $@ + +%: %.idl.php idl.php base.php + @echo 'Generating files from $<...' + @echo ' --> ext_$@.h ext_$@.cpp' + @php idl.php cpp $< ext_$@.h ext_$@.cpp + @echo ' --> $@.inc' + @php idl.php inc $< $@.inc + @echo ' --> test_ext_$@.h test_ext_$@.cpp' + @php idl.php test $< test_ext_$@.h test_ext_$@.cpp + @echo ' --> ../cpp/ext/ext_$@.h ../cpp/ext/ext_$@.cpp' + @php idl.php param $< ../cpp/ext/ext_$@.h ../cpp/ext/ext_$@.cpp + @echo ' --> ../cpp/ext/profile/extprofile_$@.h' + @php idl.php profile $< ../cpp/ext/profile/extprofile_$@.h + +# run this for a newly prepared idl file +%.install: % lists + cp ext_$<.h ext_$<.cpp ../cpp/ext/ + svn add ../cpp/ext/ext_$<.h ../cpp/ext/ext_$<.cpp + svn add ../cpp/ext/profile/extprofile_$<.h + cp $<.inc ../lib/system/ + svn add ../lib/system/$<.inc + touch ../lib/system/builtin_symbols.cpp + cp test_ext_$<.h test_ext_$<.cpp ../test/ + svn add ../test/test_ext_$<.h ../test/test_ext_$<.cpp + +# run this to add or remove a function from an existing idl file +%.update: % lists + cp $<.inc ../lib/system/ + touch ../lib/system/builtin_symbols.cpp + +clobber: + @rm -f *~ $(patsubst %.idl.php, %, $(IDL_PHPS)) $(patsubst %.idl.php, ext_%.h, $(IDL_PHPS)) $(patsubst %.idl.php, ext_%.cpp, $(IDL_PHPS)) $(patsubst %.idl.php, %.inc, $(IDL_PHPS)) $(patsubst %.idl.php, test_ext_%.h, $(IDL_PHPS)) $(patsubst %.idl.php, test_ext_%.cpp, $(IDL_PHPS)) diff --git a/src/idl/apache.idl.php b/src/idl/apache.idl.php new file mode 100644 index 0000000000000..5da6183c945c6 --- /dev/null +++ b/src/idl/apache.idl.php @@ -0,0 +1,35 @@ + String, + 'walk_to_top' => array(Boolean, 'false'))); +f('apache_lookup_uri', Object, + array('filename' => String)); +f('apache_note', Variant, + array('note_name' => String, + 'note_value' => array(String, 'null_string'))); +f('apache_request_headers', StringVec); +f('apache_reset_timeout', Boolean); +f('apache_response_headers', StringVec); +f('apache_setenv', Boolean, + array('variable' => String, + 'value' => String, + 'walk_to_top' => array(Boolean, 'false'))); +f('ascii2ebcdic', Int32, + array('ascii_str' => String)); +f('ebcdic2ascii', Int32, + array('ebcdic_str' => String)); +f('getallheaders', StringVec); +f('virtual', Boolean, + array('filename' => String)); + +f('apache_get_config', Variant); +f('apache_get_scoreboard', Variant); +f('apache_get_rewrite_rules', Variant); diff --git a/src/idl/apc.idl.php b/src/idl/apc.idl.php new file mode 100644 index 0000000000000..631d5f16f1167 --- /dev/null +++ b/src/idl/apc.idl.php @@ -0,0 +1,98 @@ + String, + 'var' => Variant, + 'ttl' => array(Int64, '0'), + 'cache_id' => array(Int64, '0'))); + +f('apc_store', Boolean, + array('key' => String, + 'var' => Variant, + 'ttl' => array(Int64, '0'), + 'cache_id' => array(Int64, '0'))); + +f('apc_fetch', Variant, + array('key' => Variant, + 'success' => array(Boolean | Reference, 'null'), + 'cache_id' => array(Int64, '0'))); + +f('apc_delete', Variant, + array('key' => Variant, + 'cache_id' => array(Int64, '0'))); + +f('apc_compile_file', Boolean, + array('filename' => String, + 'atomic' => array(Boolean, 'true'), + 'cache_id' => array(Int64, '0'))); + +f('apc_cache_info', Variant, + array('cache_id' => array(Int64, '0'), + 'limited' => array(Boolean, 'false'))); + +f('apc_clear_cache', Boolean, + array('cache_id' => array(Int64, '0'))); + +f('apc_define_constants', Boolean, + array('key' => String, + 'constants' => String, + 'case_sensitive' => array(Boolean, 'true'), + 'cache_id' => array(Int64, '0'))); + +f('apc_load_constants', Boolean, + array('key' => String, + 'case_sensitive' => array(Boolean, 'true'), + 'cache_id' => array(Int64, '0'))); + +f('apc_sma_info', VariantMap, + array('limited' => array(Boolean, 'false'))); + +f('apc_filehits', StringVec); + +f('apc_delete_file', Variant, + array('keys' => Variant, + 'cache_id' => array(Int64, '0'))); + +f('apc_inc', Variant, + array('key' => String, + 'step' => array(Int64, '1'), + 'success' => array(Boolean | Reference, 'null'), + 'cache_id' => array(Int64, '0'))); + +f('apc_dec', Variant, + array('key' => String, + 'step' => array(Int64, '1'), + 'success' => array(Boolean | Reference, 'null'), + 'cache_id' => array(Int64, '0'))); + +f('apc_cas', Boolean, + array('key' => String, + 'old_cas' => Int64, + 'new_cas' => Int64, + 'cache_id' => array(Int64, '0'))); + +f('apc_bin_dump', Variant, + array('cache_id' => array(Int64, '0'), + 'filter' => array(Variant, 'null_variant'))); + +f('apc_bin_load', Boolean, + array('data' => String, + 'flags' => array(Int64, '0'), + 'cache_id' => array(Int64, '0'))); + +f('apc_bin_dumpfile', Variant, + array('cache_id' => Int64, + 'filter' => Variant, + 'filename' => String, + 'flags' => array(Int64, '0'), + 'context' => array(Resource, 'null'))); + +f('apc_bin_loadfile', Boolean, + array('filename' => String, + 'context' => array(Resource, 'null'), + 'flags' => array(Int64, '0'), + 'cache_id' => array(Int64, '0'))); diff --git a/src/idl/apd.idl.php b/src/idl/apd.idl.php new file mode 100644 index 0000000000000..7347d53860c68 --- /dev/null +++ b/src/idl/apd.idl.php @@ -0,0 +1,35 @@ + String, + 'args' => String, + 'code' => String)); + +f('rename_function', Boolean, + array('orig_name' => String, + 'new_name' => String)); + +f('apd_set_browser_trace', NULL); + +f('apd_set_pprof_trace', String, + array('dumpdir' => array(String, 'null_string'), + 'frament' => array(String, 'null_string'))); + +f('apd_set_session_trace_socket', Boolean, + array('ip_or_filename' => String, + 'domain' => Int32, + 'port' => Int32, + 'mask' => Int32)); + +f('apd_stop_trace', NULL); + +f('apd_breakpoint', Boolean); + +f('apd_continue', Boolean); + +f('apd_echo', Boolean, + array('output' => String)); diff --git a/src/idl/array.idl.php b/src/idl/array.idl.php new file mode 100644 index 0000000000000..7f85af98aa18b --- /dev/null +++ b/src/idl/array.idl.php @@ -0,0 +1,364 @@ + Variant, + 'upper' => array(Boolean, 'false'))); + +f('array_chunk', Variant, + array('input' => Variant, + 'size' => Int32, + 'preserve_keys' => array(Boolean, 'false'))); + +f('array_combine', Variant, + array('keys' => Variant, + 'values' => Variant)); + +f('array_count_values', Variant, + array('input' => Variant)); + +f('array_fill_keys', Variant, + array('keys' => Variant, + 'value' => Variant)); + +f('array_fill', VariantMap, + array('start_index' => Int32, + 'num' => Int32, + 'value' => Variant)); + +f('array_filter', Variant, + array('input' => Variant, + 'callback' => array(Variant, 'null_variant'))); + +f('array_flip', Variant, + array('trans' => Variant)); + +f('array_key_exists', Boolean, + array('key' => Variant, + 'search' => Variant)); + +f('array_keys', Variant, + array('input' => Variant, + 'search_value' => array(Variant, 'null_variant'), + 'strict' => array(Boolean, 'false'))); + +f('array_map', Variant, + array('callback' => Variant, + 'arr1' => Variant), + VariableArguments); + +f('array_merge_recursive', Variant, + array('array1' => Variant), + VariableArguments); + +f('array_merge', Variant, + array('array1' => Variant), + VariableArguments); + +f('array_multisort', Boolean, + array('ar1' => Variant | Reference), + ReferenceVariableArguments); + +f('array_pad', Variant, + array('input' => Variant, + 'pad_size' => Int32, + 'pad_value' => Variant)); + +f('array_pop', Variant, + array('array' => VariantMap | Reference)); + +f('array_product', Variant, + array('array' => Variant)); + +f('array_push', Variant, + array('array' => VariantMap | Reference, + 'var' => Variant), + VariableArguments); + +f('array_rand', Variant, + array('input' => Variant, + 'num_req' => array(Int32, '1'))); + +f('array_reduce', Variant, + array('input' => Variant, + 'callback' => Variant, + 'initial' => array(Variant, 'null_variant'))); + +f('array_reverse', Variant, + array('array' => Variant, + 'preserve_keys' => array(Boolean, 'false'))); + +f('array_search', Variant, + array('needle' => Variant, + 'haystack' => Variant, + 'strict' => array(Boolean, 'false'))); + +f('array_shift', Variant, + array('array' => VariantMap | Reference)); + +f('array_slice', Variant, + array('array' => Variant, + 'offset' => Int32, + 'length' => array(Variant, 'null_variant'), + 'preserve_keys' => array(Boolean, 'false'))); + +f('array_splice', Variant, + array('input' => VariantMap | Reference, + 'offset' => Int32, + 'length' => array(Variant, 'null_variant'), + 'replacement' => array(Variant, 'null_variant'))); + +f('array_sum', Variant, + array('array' => Variant)); + +f('array_unique', Variant, + array('array' => Variant)); + +f('array_unshift', Int32, + array('array' => VariantMap | Reference, + 'var' => Variant), + VariableArguments); + +f('array_values', Variant, + array('input' => Variant)); + +f('array_walk_recursive', Boolean, + array('input' => VariantMap | Reference, + 'funcname' => Variant, + 'userdata' => array(Variant, 'null_variant'))); + +f('array_walk', Boolean, + array('input' => VariantMap | Reference, + 'funcname' => Variant, + 'userdata' => array(Variant, 'null_variant'))); + +f('compact', VariantMap, + array('varname' => Variant), + VariableArguments); + +f('shuffle', Boolean, + array('array' => VariantMap | Reference)); + +f('count', Int32, + array('var' => Variant, + 'recursive' => array(Boolean, 'false'))); + +f('sizeof', Int32, + array('var' => Variant, + 'recursive' => array(Boolean, 'false'))); + +f('each', Variant, + array('array' => VariantMap | Reference)); + +f('current', Variant, + array('array' => VariantMap | Reference)); + +f('next', Variant, + array('array' => VariantMap | Reference)); + +f('pos', Variant, + array('array' => VariantMap | Reference)); + +f('prev', Variant, + array('array' => VariantMap | Reference)); + +f('reset', Variant, + array('array' => VariantMap | Reference)); + +f('end', Variant, + array('array' => VariantMap | Reference)); + +f('in_array', Boolean, + array('needle' => Variant, + 'haystack' => Variant, + 'strict' => array(Boolean, 'false'))); + +f('key', Variant, + array('array' => VariantMap | Reference)); + +f('range', VariantMap, + array('low' => Variant, + 'high' => Variant, + 'step' => array(Variant, '1'))); + +/////////////////////////////////////////////////////////////////////////////// + +f('array_diff', Variant, + array('array1' => Variant, + 'array2' => Variant), + VariableArguments); + +f('array_udiff', Variant, + array('array1' => Variant, + 'array2' => Variant, + 'data_compare_func' => Variant), + VariableArguments); + +f('array_diff_assoc', Variant, + array('array1' => Variant, + 'array2' => Variant), + VariableArguments); + +f('array_diff_uassoc', Variant, + array('array1' => Variant, + 'array2' => Variant, + 'key_compare_func' => Variant), + VariableArguments); + +f('array_udiff_assoc', Variant, + array('array1' => Variant, + 'array2' => Variant, + 'data_compare_func' => Variant), + VariableArguments); + +f('array_udiff_uassoc', Variant, + array('array1' => Variant, + 'array2' => Variant, + 'data_compare_func' => Variant, + 'key_compare_func' => Variant), + VariableArguments); + +f('array_diff_key', Variant, + array('array1' => Variant, + 'array2' => Variant), + VariableArguments); + +f('array_diff_ukey', Variant, + array('array1' => Variant, + 'array2' => Variant, + 'key_compare_func' => Variant), + VariableArguments); + +f('array_intersect', Variant, + array('array1' => Variant, + 'array2' => Variant), + VariableArguments); + +f('array_uintersect', Variant, + array('array1' => Variant, + 'array2' => Variant, + 'data_compare_func' => Variant), + VariableArguments); + +f('array_intersect_assoc', Variant, + array('array1' => Variant, + 'array2' => Variant), + VariableArguments); + +f('array_intersect_uassoc', Variant, + array('array1' => Variant, + 'array2' => Variant, + 'key_compare_func' => Variant), + VariableArguments); + +f('array_uintersect_assoc', Variant, + array('array1' => Variant, + 'array2' => Variant, + 'data_compare_func' => Variant), + VariableArguments); + +f('array_uintersect_uassoc', Variant, + array('array1' => Variant, + 'array2' => Variant, + 'data_compare_func' => Variant, + 'key_compare_func' => Variant), + VariableArguments); + +f('array_intersect_key', Variant, + array('array1' => Variant, + 'array2' => Variant), + VariableArguments); + +f('array_intersect_ukey', Variant, + array('array1' => Variant, + 'array2' => Variant, + 'key_compare_func' => Variant), + VariableArguments); + +/////////////////////////////////////////////////////////////////////////////// + +f('sort', Boolean, + array('array' => VariantMap | Reference, + 'sort_flags' => array(Int32, '0'), + 'use_collator' => array(Boolean, 'false'))); + +f('rsort', Boolean, + array('array' => VariantMap | Reference, + 'sort_flags' => array(Int32, '0'), + 'use_collator' => array(Boolean, 'false'))); + +f('asort', Boolean, + array('array' => VariantMap | Reference, + 'sort_flags' => array(Int32, '0'), + 'use_collator' => array(Boolean, 'false'))); + +f('arsort', Boolean, + array('array' => VariantMap | Reference, + 'sort_flags' => array(Int32, '0'), + 'use_collator' => array(Boolean, 'false'))); + +f('ksort', Boolean, + array('array' => VariantMap | Reference, + 'sort_flags' => array(Int32, '0'))); + +f('krsort', Boolean, + array('array' => VariantMap | Reference, + 'sort_flags' => array(Int32, '0'))); + +f('usort', Boolean, + array('array' => VariantMap | Reference, + 'cmp_function' => Variant)); + +f('uasort', Boolean, + array('array' => VariantMap | Reference, + 'cmp_function' => Variant)); + +f('uksort', Boolean, + array('array' => VariantMap | Reference, + 'cmp_function' => Variant)); + +f('natsort', Variant, + array('array' => VariantMap | Reference)); + +f('natcasesort', Variant, + array('array' => VariantMap | Reference)); + +f('i18n_loc_get_default', String); +f('i18n_loc_set_default', Boolean, + array('locale' => String)); +f('i18n_loc_set_attribute', Boolean, + array('attr' => Int64, 'val' => Int64)); +f('i18n_loc_set_strength', Boolean, + array('strength' => Int64)); +f('i18n_loc_get_error_code', Variant); diff --git a/src/idl/base.php b/src/idl/base.php new file mode 100644 index 0000000000000..e16a72cad8c6b --- /dev/null +++ b/src/idl/base.php @@ -0,0 +1,850 @@ + array('name' => 'bool', 'enum' => 'Boolean', ), + //Byte => array('name' => 'char', 'enum' => 'Byte', ), + //Int16 => array('name' => 'short', 'enum' => 'Int16', ), + Int32 => array('name' => 'int', 'enum' => 'Int32', ), + Int64 => array('name' => 'int64', 'enum' => 'Int64', ), + Double => array('name' => 'double', 'enum' => 'Double', ), + String => array('name' => 'String', 'enum' => 'String', ), + Int64Vec => array('name' => 'Array', 'enum' => 'Array', ), + StringVec => array('name' => 'Array', 'enum' => 'Array', ), + VariantVec => array('name' => 'Array', 'enum' => 'Array', ), + Int64Map => array('name' => 'Array', 'enum' => 'Array', ), + StringMap => array('name' => 'Array', 'enum' => 'Array', ), + VariantMap => array('name' => 'Array', 'enum' => 'Array', ), + Object => array('name' => 'Object', 'enum' => 'Object', ), + Resource => array('name' => 'Object', 'enum' => 'Object', ), + Variant => array('name' => 'Variant', 'enum' => 'Variant', ), + Numeric => array('name' => 'Numeric', 'enum' => 'Numeric', ), + Primitive => array('name' => 'Primitive', 'enum' => 'Primitive', ), + PlusOperand => array('name' => 'PlusOperand', 'enum' => 'PlusOperand',), + Sequence => array('name' => 'Sequence', 'enum' => 'Sequence', ), + Any => array('name' => 'Variant', 'enum' => 'Some' ), + ); + +$REFNAMES = array('String' => 'CStrRef', + 'Array' => 'CArrRef', + 'Object' => 'CObjRef', + 'Variant' => 'CVarRef', + 'Numeric' => 'CVarRef', + 'Primitive' => 'CVarRef', + 'PlusOperand' => 'CVarRef', + 'Sequence' => 'CVarRef', + ); + +// Flags for functions (used in "lib/system/builtin_symbols.cpp") +define('DefaultFlags', 0); +define('VariableArguments', 1); +define('ReferenceVariableArguments', 2); +define('NoEffect', 4); +define('NoInjection', 8); + +// Mask for checking the flags related to variable arguments +define('VarArgsMask', (VariableArguments | ReferenceVariableArguments)); + +function escape_value($val) { + $val = preg_replace("/\\\\/", "\\\\\\\\", $val); + $val = preg_replace("/\\\"/", "\\\\\"", $val); + return $val; +} + +function idx($arr, $idx, $default=null) { + if ($idx === null) { + return $default; + } + if (isset($arr[$idx])) { + return $arr[$idx]; + } + return $default; +} + +/////////////////////////////////////////////////////////////////////////////// +// CPP header preamble +function p($p) { + global $preamble; + if (!isset($preamble)) $preamble = ""; + $preamble .= $p . "\n"; +} + +/////////////////////////////////////////////////////////////////////////////// +// dynamic declarations +function dyn() { + global $dyns; + if (!isset($dyns)) $dyns = array(); + $dyns += func_get_args(); +} + +/////////////////////////////////////////////////////////////////////////////// +// function definition + +function build_function_def($name, + $return, + $args, + $flags = DefaultFlags) { + $fargs = array(); + $have_first_optional = false; + $required_arg_count = 0; + foreach ($args as $arg_name => $arg) { + $farg = array('name' => strtolower($arg_name)); + if (is_array($arg)) { + $farg['type'] = $arg[0]; + if (!is_string($arg[1]) || $arg[1] === '') { + die('default value needs to be a non-empty string for '.$name.'(..'. + $arg_name.'..)'); + } + $default = $arg[1]; + $farg['default'] = $default; + $default = escape_value($default); + $farg['default_escaped'] = $default; + } else { + $farg['type'] = $arg; + } + if ($farg['type'] & Optional) { + $have_first_optional = true; + } else { + ++$required_arg_count; + if ($have_first_optional) { + die('Required parameters cannot follow optional parameters (function '.$name.', param '.$arg_name.')'); + } + } + if ($farg['type'] & Reference) { + $farg['ref'] = true; + $farg['type'] = Variant | ($farg['type'] & (~TypeMask)); + } + $fargs[] = $farg; + } + $func = array('name' => strtolower($name), + 'return' => $return, + 'args' => $fargs, + 'required_args' => $required_arg_count, + 'flags' => $flags); + if ($return & Reference) { + $func['ref'] = true; + $func['return'] = Variant; + } + return $func; +} + +$funcs = array(); +function f($name, + $return = null, + $args = array(), + $flags = DefaultFlags) { + global $funcs; + $funcs[] = build_function_def($name, $return, $args, $flags); +} + +/////////////////////////////////////////////////////////////////////////////// +// class definition + +function m($flags, + $name, + $return = null, + $args = array(), + $func_flags = DefaultFlags) { + $ret = build_function_def($name, $return, $args, $func_flags); + if ($flags & AbstractMethod) $ret['abstract'] = true; + $ret['visibility'] = $flags & VisibilityMask; + $ret['static'] = $flags & StaticMethod; + return $ret; //build_function_def($name, $return, $args, $func_flags); +} +function ck($name, $type) { + return array('type' => $type, + 'name' => $name); +} +$classes = array(); +function c($name, $parent = null, $interfaces = array(), + $methods = array(), $consts = array(), $footer = "") { + global $classes; + + $have_ctor = false; + $have_dtor = false; + foreach ($methods as $method) { + if ($method['name'] == '__construct') $have_ctor = true; + if ($method['name'] == '__destruct') $have_dtor = true; + } + + // We don't have the information to autogenerate a ctor def, so make the user do it. + if (! $have_ctor) { + printf("ERROR: No constructor defined in IDL for class %s.\n", $name); + exit(-1); + } + // Generate the appropriate IDL for the dtor, if it doesn't exist. + if (!$have_dtor) { + $methods[] = m(PublicMethod, '__destruct', Variant); + } + + $classes[] = array('name' => $name, + 'parent' => $parent, + 'interfaces' => $interfaces, + 'consts' => $consts, + 'methods' => $methods, + 'footer' => $footer); + +} + +/////////////////////////////////////////////////////////////////////////////// +// constant definition + +$constants = array(); +function k($name, $type) { + global $constants; + $constants[] = array('type' => $type, + 'name' => $name); +} + +/////////////////////////////////////////////////////////////////////////////// +// global variable binding (bridge module only) +$global_bindings = array(); +function g($name) { + global $global_bindings; + $global_bindings[] = $name; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation + +function typename($type) { + global $TYPENAMES; + $type = $type & TypeMask; + if ($type !== 0) { + if (!isset($TYPENAMES[$type])) { + exit("Unknown type $type\n"); + } + return $TYPENAMES[$type]['name']; + } + return 'void'; +} + +function param_typename($type, $ref) { + global $REFNAMES; + $name = typename($type); + if ($ref || !isset($REFNAMES[$name])) { + return $name; + } + return $REFNAMES[$name]; +} + +function typeenum($type) { + global $TYPENAMES; + $type = $type & TypeMask; + if ($type !== 0) { + return $TYPENAMES[$type]['enum']; + } + return 'Void'; +} + +function generateFuncCPPInclude($func, $f, $newline = true) { + fprintf($f, '"%s", T(%s), ', $func['name'], + typeenum($func['return'])); + fprintf($f, 'S(%d), ', idx($func, 'ref') ? 1 : 0); + for ($i = 0; $i < count($func['args']); $i++) { + $arg = $func['args'][$i]; + fprintf($f, '"%s", T(%s), ', $arg['name'], typeenum($arg['type'])); + if (isset($arg['default'])) { + fprintf($f, '"%s", ', $arg['default_escaped']); + } else { + fprintf($f, 'NULL, '); + } + fprintf($f, 'S(%d), ', idx($arg, 'ref') ? 1 : 0); + } + fprintf($f, "NULL, "); + fprintf($f, 'S(%d), ', $func['flags']); + if ($newline) fprintf($f, "\n"); +} + +function generateConstCPPInclude($const, $f) { + fprintf($f, '"%s", T(%s),'. "\n", $const['name'], typeenum($const['type'])); +} + +function generateClassCPPInclude($class, $f) { + fprintf($f, '"%s", "%s", ', strtolower($class['name']), + strtolower($class['parent'])); + foreach ($class['interfaces'] as $if) { + fprintf($f, '"%s",', strtolower($if)); + } + fprintf($f, 'NULL, '); + foreach ($class['methods'] as $m) { + generateMethodCPPInclude($m, $f); + fprintf($f, ","); + } + fprintf($f, "NULL,"); + foreach ($class['consts'] as $k) { + fprintf($f, '"%s", T(%s),', $k['name'], typeenum($k['type'])); + } + fprintf($f, "NULL,\n"); +} + +function generateMethodCPPInclude($method, $f) { + generateFuncCPPInclude($method, $f, false, 'G'); + fprintf($f, "S(%d), S(%d), S(%d)", + intval(idx($method, 'abstract') == AbstractMethod), + intval($method['visibility']), + intval($method['static'] == StaticMethod)); +} + +function generateFuncArgsCPPHeader($func, $f, $forceRef = false) { + $var_arg = ($func['flags'] & VarArgsMask); + $args = $func['args']; + fprintf($f, "("); + if ($var_arg) fprintf($f, 'int _argc, '); + for ($i = 0; $i < count($args); $i++) { + $arg = $args[$i]; + if ($i > 0) fprintf($f, ', '); + fprintf($f, '%s %s', param_typename($arg['type'], + idx($arg, 'ref') || $forceRef), + $arg['name']); + if (isset($arg['default'])) { + fprintf($f, ' = %s', $arg['default']); + } + } + if ($var_arg) { + fprintf($f, ', CArrRef _argv = null_array'); + } + fprintf($f, ")"); +} + +function generateFuncCPPHeader($func, $f, $method = false, $forceref = false) { + fprintf($f, '%s %s_%s', typename($func['return']), $method ? "t" : "f", + $func['name']); + generateFuncArgsCPPHeader($func, $f, $forceref); + fprintf($f, ";\n"); +} + +function generateFuncProfileHeader($func, $f) { + $var_arg = ($func['flags'] & VarArgsMask); + $args = $func['args']; + + fprintf($f, "#ifndef PROFILE_BUILTIN\n#define x_%s f_%s\n#else\n", + $func['name'], $func['name']); + fprintf($f, 'inline %s x_%s', typename($func['return']), $func['name']); + generateFuncArgsCPPHeader($func, $f, false); + fprintf($f, " {\n"); + + if (!($func['flags'] & NoInjection)) { + fprintf($f, " FUNCTION_INJECTION(%s);\n", $func['name']); + } + fprintf($f, " "); + + if (typename($func['return']) !== 'void') { + fprintf($f, "return "); + } + fprintf($f, "f_%s(", $func['name']); + + if ($var_arg) fprintf($f, '_argc, '); + for ($i = 0; $i < count($args); $i++) { + $arg = $args[$i]; + if ($i > 0) fprintf($f, ', '); + fprintf($f, idx($arg, 'ref') ? 'ref(%s)' : '%s', $arg['name']); + } + if ($var_arg) { + fprintf($f, ', _argv'); + } + fprintf($f, ");\n"); + + fprintf($f, "}\n#endif\n\n"); +} + +function generateConstCPPHeader($const, $f) { + $name = typename($const['type']); + if ($name == 'String') { + $name = 'StaticString'; + } + fprintf($f, "extern const %s k_%s;\n", $name, $const['name']); +} + +function generateClassCPPHeader($class, $f) { + foreach ($class['consts'] as $k) { + $name = typename($k['type']); + if ($name == 'String') { + $name = 'StaticString'; + } + fprintf($f, "extern const %s q_%s_%s;\n", $name, $class['name'], + $k['name']); + } + $lowername = strtolower($class['name']); + + fprintf($f, + << 0) fprintf($f, ', '); + fprintf($f, '%s %s', param_typename($arg['type'], idx($arg, 'ref')), + $arg['name']); + if (isset($arg['default'])) { + fprintf($f, ' /* = %s */', $arg['default']); + } + + if ($arg['type'] == Object || $arg['type'] == Resource) { + $params .= 'NEW(ArrayElement)(OpaqueObject::GetIndex('.$arg['name']. + ')), '; + } else { + $params .= 'NEW(ArrayElement)('.$arg['name'].'), '; + } + + if ($arg['type'] == Object || $arg['type'] == Resource) { + if (idx($arg, 'ref')) { + $schema .= 'NEW(ArrayElement)('.$i.', "OO"), '; + } else { + $schema .= 'NEW(ArrayElement)('.$i.', "O"), '; + } + } else if (idx($arg, 'ref')) { + $schema .= 'NEW(ArrayElement)('.$i.', "R"), '; + } + + if (idx($arg, 'ref')) { + $need_ret = true; + $output .= ' '.$arg['name'].' = ((Variant)_ret[1])['.$i.'];'."\n"; + } + } + if ($var_arg) { + fprintf($f, ', CArrRef _argv /* = null_array */'); + } + fprintf($f, ") {\n"); + + /** commenting out Crutch code generation + fprintf($f, " %s(ArrayElement*)NULL);\n", $schema); + fprintf($f, " %s(ArrayElement*)NULL);\n", $params); + + fprintf($f, " "); + if ($func['return'] !== null || $need_ret) { + fprintf($f, "Array _ret = "); + } + fprintf($f, "Crutch::Invoke(\"%s\", _schema, _params);\n", $func['name']); + if ($output) { + fprintf($f, $output); + } + if ($func['return'] !== null) { + if ($func['return'] == Object || $func['return'] == Resource) { + fprintf($f, " return OpaqueObject::GetObject((Variant)_ret[0]);\n"); + } else { + fprintf($f, " return (Variant)_ret[0];\n"); + } + } + */ + fprintf($f, " throw NotImplementedException(__func__);\n"); + fprintf($f, "}\n\n"); +} + +function generateZValToHPHPConversion($arg, $argrval) { + global $TYPENAMES; + if (idx($arg, 'ref')) { + return 'ref(zval_to_variant('.$argrval.'))'; + } + + return 'zval_to_'.strtolower($TYPENAMES[($arg['type'] & TypeMask)]['name']).'('.$argrval.')'; +} + +function generateHPHPToZValConversion($argtype, $zvalp, $argrval) { + global $TYPENAMES; + $conv_fn = strtolower($TYPENAMES[$argtype]['name']).'_to_zval'; + if ($conv_fn == 'variant_to_zval' || $conv_fn == 'array_to_zval') return sprintf('%s(%s, %s);', $conv_fn, $argrval, $zvalp); + return sprintf('%s(%s, *%s);', $conv_fn, $argrval, $zvalp); +} + +function generatePHPBridgeImplementation($func, $f, $classname = NULL, $static = false) { + if ($classname) { + fprintf($f, "PHP_METHOD(%s, %s) {\n", $classname, $func['name']); + if (!$static) { + if ($func['name'] == '__construct') { + // create the object, and store objptr in the newly constructed class's properties + fprintf($f, " c_%s* objptr = new c_%s();\n", $classname, $classname); + fprintf($f, " objptr->incRefCount();\n"); + fprintf($f, " set_objptr_for_zobject(getThis(), objptr, %s_objptr_propname, %s_objptr_propname_len, %s_objptr_propname_hash);\n", $classname, $classname, $classname); + } else { + // retrieve the objptr from the class properties + fprintf($f, " c_%s* objptr = reinterpret_cast(get_objptr_for_zobject(getThis(), %s_objptr_propname, %s_objptr_propname_len, %s_objptr_propname_hash));\n", $classname, $classname, $classname, $classname, $classname); + } + } + } else { + fprintf($f, "PHP_FUNCTION(%s) {\n", $func['name']); + } + fprintf($f, " if (ht < %d) ZEND_WRONG_PARAM_COUNT();\n", $func['required_args']); + fprintf($f, " try {\n"); + fprintf($f, " resolve_zval_references();\n"); + fprintf($f, " boost::scoped_array args(new zval**[ht]);\n"); + fprintf($f, " zend_get_parameters_array_ex(ht, args.get());\n"); + + $argc = count($func['args']); + $argnames = array(); + for ($i = 0; $i < $argc; ++$i) { + $arg = $func['args'][$i]; + $argname = 'a_'.$arg['name']; + $arg_decl = typename($arg['type']).' '.$argname; + if ($arg['type'] & Optional) { + fprintf($f, " %s;\n", $arg_decl); + fprintf($f, " if (ht >= %d) %s = %s;\n", $i+1, $argname, generateZValToHPHPConversion($arg, '*args['.$i.']'), $i); + } else { + fprintf($f, " %s = %s;\n", $arg_decl, generateZValToHPHPConversion($arg, '*args['.$i.']'), $i); + } + if (!empty($arg['ref'])) fprintf($f, " %s.setContagious();\n", $argname); + $argnames[] = $argname; + } + $var_arg = ($func['flags'] & VarArgsMask); + if ($var_arg) { + fprintf($f, + " Array va_params;\n". + " for (int i = %d; i < ht; ++i) {\n". + " va_params.append(zval_to_variant(*(args.get()[i])));\n". + " }\n", $argc); + $argnames[] = 'ht'; // num_args + $argnames[] = 'va_params'; + } + + if ($func['name'] == '__destruct') { + // The __destruct function only gets called via bridged_object_del_ref, which checks the c++ refcount too + // We are guaranteed to go into this with refcount == 0. + fprintf($f, " assert(objptr->getCount() == 0);\n"); + fprintf($f, " objptr->t___destruct();\n"); + fprintf($f, " delete objptr;\n"); + } else { + if ($func['return'] !== null) { + fprintf($f, " %s rv;\n", typename($func['return'])); + } + + if (count($func['args']) == $func['required_args']) { + fprintf($f, " "); + if ($func['return'] !== null) { + fprintf($f, "rv = "); + } + if ($classname && !$static) { + fprintf($f, "objptr->"); + } + fprintf($f, "%s(%s);\n", ($classname ? 't_' : 'f_') . $func['name'], implode(',',$argnames)); + } else { + fprintf($f, " switch (ht) {\n"); + for ($i = $func['required_args']; $i <= count($func['args']); ++$i) { + fprintf($f, " case %d:", $i); + if ($i == count($func['args'])) fprintf($f, "\n default:"); + if ($func['return'] !== null) fprintf($f, ' rv ='); + if ($classname && !$static) { + fprintf($f, ' objptr->'); + } + fprintf($f, " %s(%s); break;\n", ($classname ? 't_' : 'f_') . $func['name'], implode(',',array_slice($argnames, 0, $i))); + } + fprintf($f, " };\n"); + } + } + if ($func['return'] !== null) { + fprintf($f, " if (!return_value_ptr) return_value_ptr = &return_value;\n"); + fprintf($f, " if (return_value_used) { %s }\n", generateHPHPToZValConversion($func['return'], 'return_value_ptr', 'rv')); + fprintf($f, " else ZVAL_NULL(return_value);\n"); + } else { + fprintf($f, " ZVAL_NULL(return_value);\n"); + } + + fprintf($f, << Int64)); + +f('bcadd', String, + array('left' => String, + 'right' => String, + 'scale' => array(Int64, '-1'))); + +f('bcsub', String, + array('left' => String, + 'right' => String, + 'scale' => array(Int64, '-1'))); + +f('bccomp', Int64, + array('left' => String, + 'right' => String, + 'scale' => array(Int64, '-1'))); + +f('bcmul', String, + array('left' => String, + 'right' => String, + 'scale' => array(Int64, '-1'))); + +f('bcdiv', String, + array('left' => String, + 'right' => String, + 'scale' => array(Int64, '-1'))); + +f('bcmod', String, + array('left' => String, + 'right' => String)); + +f('bcpow', String, + array('left' => String, + 'right' => String, + 'scale' => array(Int64, '-1'))); + +f('bcpowmod', Variant, + array('left' => String, + 'right' => String, + 'modulus' => String, + 'scale' => array(Int64, '-1'))); + +f('bcsqrt', Variant, + array('operand' => String, + 'scale' => array(Int64, '-1'))); diff --git a/src/idl/class.idl.php b/src/idl/class.idl.php new file mode 100644 index 0000000000000..bb6ac40ed2656 --- /dev/null +++ b/src/idl/class.idl.php @@ -0,0 +1,61 @@ + String, + 'autoload' => array(Boolean, 'false'))); + +f('interface_exists', Boolean, + array('interface_name' => String, + 'autoload' => array(Boolean, 'false'))); + +f('get_class_methods', VariantMap, + array('class_or_object' => Variant)); + +f('get_class_vars', VariantMap, + array('class_name' => String)); + +/////////////////////////////////////////////////////////////////////////////// + +f('get_class', Variant, + array('object' => array(Variant, 'null_variant'))); + +f('get_parent_class', Variant, + array('object' => array(Variant, 'null_variant'))); + +f('is_a', Boolean, + array('object' => Object, + 'class_name' => String)); + +f('is_subclass_of', Boolean, + array('class_or_object' => Variant, + 'class_name' => String)); + +f('method_exists', Boolean, + array('class_or_object' => Variant, + 'method_name' => String)); + +f('property_exists', Boolean, + array('class_or_object' => Variant, + 'property' => String)); + +f('get_object_vars', VariantMap, + array('object' => Object)); + +/////////////////////////////////////////////////////////////////////////////// + +f('call_user_method_array', Variant, + array('method_name' => String, + 'obj' => Object | Reference, + 'paramarr' => VariantVec)); + +f('call_user_method', Variant, + array('method_name' => String, + 'obj' => Object | Reference), + VariableArguments); diff --git a/src/idl/ctype.idl.php b/src/idl/ctype.idl.php new file mode 100644 index 0000000000000..9848797a540bf --- /dev/null +++ b/src/idl/ctype.idl.php @@ -0,0 +1,18 @@ + Variant)); +f('ctype_alpha', Boolean, array('text' => Variant)); +f('ctype_cntrl', Boolean, array('text' => Variant)); +f('ctype_digit', Boolean, array('text' => Variant)); +f('ctype_graph', Boolean, array('text' => Variant)); +f('ctype_lower', Boolean, array('text' => Variant)); +f('ctype_print', Boolean, array('text' => Variant)); +f('ctype_punct', Boolean, array('text' => Variant)); +f('ctype_space', Boolean, array('text' => Variant)); +f('ctype_upper', Boolean, array('text' => Variant)); +f('ctype_xdigit', Boolean, array('text' => Variant)); diff --git a/src/idl/curl.idl.php b/src/idl/curl.idl.php new file mode 100644 index 0000000000000..a549a9c068ba9 --- /dev/null +++ b/src/idl/curl.idl.php @@ -0,0 +1,109 @@ + +#include +#include +END +); + +/////////////////////////////////////////////////////////////////////////////// + +f('curl_init', Variant, + array('url' => array(String, 'null_string'))); + +f('curl_copy_handle', Resource, + array('ch' => Resource)); + +f('curl_version', Variant, + array('uversion' => array(Int32, 'CURLVERSION_NOW'))); + +f('curl_setopt', Boolean, + array('ch' => Resource, + 'option' => Int32, + 'value' => Variant)); + +f('curl_setopt_array', Boolean, + array('ch' => Resource, + 'options' => VariantVec)); + +f('curl_exec', Variant, + array('ch' => Resource)); + +f('curl_getinfo', Variant, + array('ch' => Resource, + 'opt' => array(Int32, '0'))); + +f('curl_errno', Int32, + array('ch' => Resource)); + +f('curl_error', String, + array('ch' => Resource)); + +f('curl_close', NULL, + array('ch' => Resource)); + +/////////////////////////////////////////////////////////////////////////////// + +f('curl_multi_init', Resource); + +f('curl_multi_add_handle', Int32, + array('mh' => Resource, + 'ch' => Resource)); + +f('curl_multi_remove_handle', Int32, + array('mh' => Resource, + 'ch' => Resource)); + +f('curl_multi_exec', Int32, + array('mh' => Resource, + 'still_running' => Int32 | Reference)); + +f('curl_multi_select', Int32, + array('mh' => Resource, + 'timeout' => array(Double, '1.0'))); + +f('curl_multi_getcontent', String, + array('ch' => Resource)); + +f('curl_multi_info_read', Variant, + array('mh' => Resource, + 'msgs_in_queue' => array(Int32 | Reference, 'null'))); + +f('curl_multi_close', NULL, + array('mh' => Resource)); + +/////////////////////////////////////////////////////////////////////////////// + +f('evhttp_set_cache', NULL, + array('address' => String, + 'max_conn' => Int32, + 'port' => array(Int32, '80'))); + +f('evhttp_get', Variant, + array('url' => String, + 'headers' => array(StringVec, 'null_array'), + 'timeout' => array(Int32, '5'))); + +f('evhttp_post', Variant, + array('url' => String, + 'data' => String, + 'headers' => array(StringVec, 'null_array'), + 'timeout' => array(Int32, '5'))); + +f('evhttp_async_get', Variant, + array('url' => String, + 'headers' => array(StringVec, 'null_array'), + 'timeout' => array(Int32, '5'))); + +f('evhttp_async_post', Variant, + array('url' => String, + 'data' => String, + 'headers' => array(StringVec, 'null_array'), + 'timeout' => array(Int32, '5'))); + +f('evhttp_recv', Variant, + array('handle' => Object)); diff --git a/src/idl/datetime.idl.php b/src/idl/datetime.idl.php new file mode 100644 index 0000000000000..d70cfd2fee037 --- /dev/null +++ b/src/idl/datetime.idl.php @@ -0,0 +1,237 @@ + Int32, + 'day' => Int32, + 'year' => Int32)); + +f('date_create', Object, + array('time' => array(String, 'null_string'), + 'timezone' => array(Object, 'null_object'))); + +f('date_date_set', NULL, + array('object' => Object, + 'year' => Int32, + 'month' => Int32, + 'day' => Int32)); + +f('date_default_timezone_get', String); + +f('date_default_timezone_set', Boolean, + array('name' => String)); + +f('date_format', String, + array('object' => Object, + 'format' => String)); + +f('date_isodate_set', NULL, + array('object' => Object, + 'year' => Int32, + 'week' => Int32, + 'day' => array(Int32, '1'))); + +f('date_modify', NULL, + array('object' => Object, + 'modify' => String)); + +f('date_offset_get', Int32, + array('object' => Object)); + +f('date_parse', Variant, + array('date' => String)); + +f('date_sun_info', VariantMap, + array('ts' => Int64, + 'latitude' => Double, + 'longitude' => Double)); + +f('date_sunrise', Variant, + array('timestamp' => Int64, + 'format' => array(Int32, '0'), + 'latitude' => array(Double, '0.0'), + 'longitude' => array(Double, '0.0'), + 'zenith' => array(Double, '0.0'), + 'gmt_offset' => array(Double, '99999.0'))); + +f('date_sunset', Variant, + array('timestamp' => Int64, + 'format' => array(Int32, '0'), + 'latitude' => array(Double, '0.0'), + 'longitude' => array(Double, '0.0'), + 'zenith' => array(Double, '0.0'), + 'gmt_offset' => array(Double, '99999.0'))); + +f('date_time_set', NULL, + array('object' => Object, + 'hour' => Int32, + 'minute' => Int32, + 'second' => array(Int32, '0'))); + +f('date_timezone_get', Variant, + array('object' => Object)); + +f('date_timezone_set', NULL, + array('object' => Object, + 'timezone' => Object)); + +f('date', String, + array('format' => String, + 'timestamp' => array(Int64, 'TimeStamp::Current()'))); + +f('getdate', VariantMap, + array('timestamp' => array(Int64, 'TimeStamp::Current()'))); + +f('gettimeofday', Variant, + array('return_float' => array(Boolean, 'false'))); + +f('gmdate', String, + array('format' => String, + 'timestamp' => array(Int64, 'TimeStamp::Current()'))); + +f('gmmktime', Variant, + array('hour' => array(Int32, '-1'), + 'minute' => array(Int32, '-1'), + 'second' => array(Int32, '-1'), + 'month' => array(Int32, '-1'), + 'day' => array(Int32, '-1'), + 'year' => array(Int32, '-1'))); + +f('gmstrftime', String, + array('format' => String, + 'timestamp' => array(Int64, 'TimeStamp::Current()'))); + +f('idate', Int64, + array('format' => String, + 'timestamp' => array(Int64, 'TimeStamp::Current()'))); + +f('localtime', VariantMap, + array('timestamp' => array(Int64, 'TimeStamp::Current()'), + 'is_associative' => array(Boolean, 'false'))); + +f('microtime', Variant, + array('get_as_float' => array(Boolean, 'false'))); + +f('mktime', Variant, + array('hour' => array(Int32, '-1'), + 'minute' => array(Int32, '-1'), + 'second' => array(Int32, '-1'), + 'month' => array(Int32, '-1'), + 'day' => array(Int32, '-1'), + 'year' => array(Int32, '-1'))); + +f('strftime', String, + array('format' => String, + 'timestamp' => array(Int64, 'TimeStamp::Current()'))); + +f('strptime', Variant, + array('date' => String, + 'format' => String)); + +f('strtotime', Variant, + array('input' => String, + 'timestamp' => array(Int64, 'TimeStamp::Current()'))); + +f('time', Int32); + +f('timezone_abbreviations_list', StringVec); + +f('timezone_identifiers_list', StringVec); + +f('timezone_name_from_abbr', Variant, + array('abbr' => String, + 'gmtOffset' => array(Int32, '-1'), + 'isdst' => array(Boolean, 'true'))); + +f('timezone_name_get', String, + array('object' => Object)); + +f('timezone_offset_get', Int32, + array('object' => Object, + 'dt' => Object)); + +f('timezone_open', Object, + array('timezone' => String)); + +f('timezone_transitions_get', VariantVec, + array('object' => Object)); + +c('DateTime', null, array(), + array( + m(PublicMethod, '__construct', null, + array('time' => array(String, '"now"'), + 'timezone' => array(Object, 'null_object'))), + m(PublicMethod, 'format', String, + array('format' => String)), + m(PublicMethod, 'getOffset', Int64), + m(PublicMethod, 'getTimezone', Variant), + m(PublicMethod, 'modify', Object, + array('modify' => String)), + m(PublicMethod, 'setDate', Object, + array('year' => Int64, + 'month' => Int64, + 'day' => Int64)), + m(PublicMethod, 'setISODate', Object, + array('year' => Int64, + 'week' => Int64, + 'day' => array(Int64, '1'))), + m(PublicMethod, 'setTime', Object, + array('hour' => Int64, + 'minute' => Int64, + 'second' => array(Int64, '0'))), + m(PublicMethod, 'setTimezone', Object, + array('timezone' => Object)) + ), + array( + ck("ATOM", String), + ck("COOKIE", String), + ck("ISO8601", String), + ck("RFC822", String), + ck("RFC850", String), + ck("RFC1036", String), + ck("RFC1123", String), + ck("RFC2822", String), + ck("RFC3339", String), + ck("RSS", String), + ck("W3C", String) + ), + "\n". + " private:\n". + " SmartObject m_dt;" + ); + +c('DateTimeZone', null, array(), + array( + m(PublicMethod, '__construct', null, + array('timezone' => String)), + m(PublicMethod, 'getName', String), + m(PublicMethod, 'getOffset', Int64, + array('datetime' => Object)), + m(PublicMethod, 'getTransitions', VariantMap), + m(PublicMethod | StaticMethod, 'listAbbreviations', VariantMap), + m(PublicMethod | StaticMethod, 'listIdentifiers', VariantMap) + ), + array( + ck("AFRICA", Int64), + ck("AMERICA", Int64), + ck("ANTARCTICA", Int64), + ck("ARCTIC", Int64), + ck("ASIA", Int64), + ck("ATLANTIC", Int64), + ck("AUSTRALIA", Int64), + ck("EUROPE", Int64), + ck("INDIAN", Int64), + ck("PACIFIC", Int64), + ck("UTC", Int64), + ck("ALL", Int64), + ck("ALL_WITH_BC", Int64), + ck("PER_COUNTRY", Int64) + ), + "\n". + " private:\n". + " SmartObject m_tz;" + ); + diff --git a/src/idl/domdocument.idl.php b/src/idl/domdocument.idl.php new file mode 100644 index 0000000000000..6af55dc9bff0e --- /dev/null +++ b/src/idl/domdocument.idl.php @@ -0,0 +1,461 @@ +"); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); +p("#include "); + + +/////////////////////////////////////////////////////////////////////////////// +// object methods + +c('DOMNode', null, array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array()), + m(PublicMethod, 'appendChild', Variant, + array('newnode' => Object)), + m(PublicMethod, 'cloneNode', Variant, + array('deep' => array(Boolean, 'false'))), + m(PublicMethod, 'getLineNo', Int64), + m(PublicMethod, 'hasAttributes', Boolean), + m(PublicMethod, 'hasChildNodes', Boolean), + m(PublicMethod, 'insertBefore', Variant, + array('newnode' => Object, + 'refnode' => array(Object, 'null'))), + m(PublicMethod, 'isDefaultNamespace', Boolean, + array('namespaceURI' => String)), + m(PublicMethod, 'isSameNode', Boolean, + array('node' => Object)), + m(PublicMethod, 'isSupported', Boolean, + array('feature' => String, + 'version' => String)), + m(PublicMethod, 'lookupNamespaceURI', Variant, + array('namespaceURI' => String)), + m(PublicMethod, 'lookupPrefix', Variant, + array('prefix' => String)), + m(PublicMethod, 'normalize', null), + m(PublicMethod, 'removeChild', Variant, + array('node' => Object)), + m(PublicMethod, 'replaceChild', Variant, + array('newChildObj' => Object, + 'oldChildObj' => Object)), + m(PublicMethod, 'C14N', Variant, + array('exclusive' => array(Boolean, 'false'), + 'with_comments' => array(Boolean, 'false'), + 'xpath' => array(Variant, 'null'), + 'ns_prefixes' => array(Variant, 'null'))), + m(PublicMethod, 'C14NFile', Variant, + array('uri' => String, + 'exclusive' => array(Boolean, 'false'), + 'with_comments' => array(Boolean, 'false'), + 'xpath' => array(Variant, 'null'), + 'ns_prefixes' => array(Variant, 'null'))), + m(PublicMethod, 'getNodePath', Variant) + ), + // Constants + array(), + // Internal fields + "\n". + " public:\n". + " xmlNodePtr m_node;" + ); + +c('DOMAttr', 'DOMNode', array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array('name' => Variant, + 'value' => Variant)), + m(PublicMethod, 'isId', Boolean), + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMCharacterData', 'DOMNode', array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array('value' => Variant)), + m(PublicMethod, 'appendData', Boolean, + array('arg' => String)), + m(PublicMethod, 'deleteData', Boolean, + array('offset' => Int64, + 'count' => Int64)), + m(PublicMethod, 'insertData', Boolean, + array('offset' => Int64, + 'data' => String)), + m(PublicMethod, 'replaceData', Boolean, + array('offset' => Int64, + 'count' => Int64, + 'data' => String)), + m(PublicMethod, 'substringData', String, + array('offset' => Int64, + 'count' => Int64)) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMComment', 'DOMCharacterData', array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array('value' => Variant)) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMText', 'DOMCharacterData', array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array('value' => Variant)), + m(PublicMethod, 'isWhitespaceInElementContent', Boolean), + m(PublicMethod, 'splitText', Variant, + array('offset' => Int64)) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMCdataSection', 'DOMText', array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array('value' => Variant)) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMDocument', 'DOMNode', array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array('version' => String, + 'encoding' => String)), + m(PublicMethod, 'createAttribute', Variant, + array('name' => String)), + m(PublicMethod, 'createAttributeNS', Variant, + array('namespaceURI' => String, + 'qualifiedName' => String)), + m(PublicMethod, 'createCDATASection', Variant, + array('data' => String)), + m(PublicMethod, 'createComment', Variant, + array('data' => String)), + m(PublicMethod, 'createDocumentFragment', Variant), + m(PublicMethod, 'createElement', Variant, + array('name' => String, + 'value' => array(String, 'null_string'))), + m(PublicMethod, 'createElementNS', Variant, + array('namespaceURI' => String, + 'qualifiedName' => String, + 'value' => array(String, 'null_string'))), + m(PublicMethod, 'createEntityReference', Variant, + array('name' => String)), + m(PublicMethod, 'createProcessingInstruction', Variant, + array('target' => String, + 'data' => array(String, 'null_string'))), + m(PublicMethod, 'createTextNode', Variant, + array('data' => String)), + m(PublicMethod, 'getElementById', Variant, + array('elementId' => String)), + m(PublicMethod, 'getElementsByTagName', Variant, + array('name' => String)), + m(PublicMethod, 'getElementsByTagNameNS', Variant, + array('namespaceURI' => String, + 'localName' => String)), + m(PublicMethod, 'importNode', Variant, + array('importedNode' => Object, + 'deep' => array(Boolean, 'false'))), + m(PublicMethod, 'load', Variant, + array('filename' => String, + 'options' => array(Int64, '0'))), + m(PublicMethod, 'loadHTML', Variant, + array('source' => String)), + m(PublicMethod, 'loadHTMLFile', Variant, + array('filename' => String)), + m(PublicMethod, 'loadXML', Variant, + array('source' => String, + 'options' => array(Int64, '0'))), + m(PublicMethod, 'normalizeDocument', null), + m(PublicMethod, 'registerNodeClass', Boolean, + array('baseclass' => String, + 'extendedclass' => String)), + m(PublicMethod, 'relaxNGValidate', Boolean, + array('filename' => String)), + m(PublicMethod, 'relaxNGValidateSource', Boolean, + array('source' => String)), + m(PublicMethod, 'save', Variant, + array('file' => String, + 'options' => array(Int64, '0'))), + m(PublicMethod, 'saveHTML', Variant), + m(PublicMethod, 'saveHTMLFile', Variant, + array('file' => String)), + m(PublicMethod, 'saveXML', Variant, + array('node' => array(Object, 'null_object'), + 'options' => array(Int64, '0'))), + m(PublicMethod, 'schemaValidate', Boolean, + array('filename' => String)), + m(PublicMethod, 'schemaValidateSource', Boolean, + array('source' => String)), + m(PublicMethod, 'validate', Boolean), + m(PublicMethod, 'xinclude', Variant, + array('options' => array(Int64, '0'))) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMDocumentFragment', 'DOMNode', array(), + // Methods + array( + m(PublicMethod, '__construct', null), + m(PublicMethod, 'appendXML', Boolean, + array('data' => String)) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMDocumentType', 'DOMNode', array(), + // Methods + array( + m(PublicMethod, '__construct', null) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMElement', 'DOMNode', array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array('name' => Variant, + 'value' => Variant, + 'namespaceURI' => Variant)), + m(PublicMethod, 'getAttribute', String, + array('name' => String)), + m(PublicMethod, 'getAttributeNode', Variant, + array('name' => String)), + m(PublicMethod, 'getAttributeNodeNS', Object, + array('namespaceURI' => String, + 'localName' => String)), + m(PublicMethod, 'getAttributeNS', String, + array('namespaceURI' => String, + 'localName' => String)), + m(PublicMethod, 'getElementsByTagName', Object, + array('name' => String)), + m(PublicMethod, 'getElementsByTagNameNS', Object, + array('namespaceURI' => String, + 'localName' => String)), + m(PublicMethod, 'hasAttribute', Boolean, + array('name' => String)), + m(PublicMethod, 'hasAttributeNS', Boolean, + array('namespaceURI' => String, + 'localName' => String)), + m(PublicMethod, 'removeAttribute', Boolean, + array('name' => String)), + m(PublicMethod, 'removeAttributeNode', Variant, + array('oldAttr' => Object)), + m(PublicMethod, 'removeAttributeNS', Variant, + array('namespaceURI' => String, + 'localName' => String)), + m(PublicMethod, 'setAttribute', Variant, + array('name' => String, + 'value' => String)), + m(PublicMethod, 'setAttributeNode', Variant, + array('newAttr' => Object)), + m(PublicMethod, 'setAttributeNodeNS', Variant, + array('newAttr' => Object)), + m(PublicMethod, 'setAttributeNS', Variant, + array('namespaceURI' => String, + 'name' => String, + 'value' => String)), + m(PublicMethod, 'setIdAttribute', Variant, + array('name' => String, + 'isId' => Boolean)), + m(PublicMethod, 'setIdAttributeNode', Variant, + array('idAttr' => Object, + 'isId' => Boolean)), + m(PublicMethod, 'setIdAttributeNS', Variant, + array('namespaceURI' => String, + 'localName' => String, + 'isId' => Boolean)) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMEntity', 'DOMNode', array(), + // Methods + array( + m(PublicMethod, '__construct', null) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMEntityReference', 'DOMNode', array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array('name' => Variant)) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMNotation', 'DOMNode', array(), + // Methods + array( + m(PublicMethod, '__construct', null) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMProcessingInstruction', 'DOMNode', array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array('name' => Variant, + 'value' => array(Variant, 'null_variant'))) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMNamedNodeMap', null, array(), + // Methods + array( + m(PublicMethod, '__construct', null), + m(PublicMethod, 'getNamedItem', Variant, + array('name' => String)), + m(PublicMethod, 'getNamedItemNS', Variant, + array('namespaceURI' => String, + 'localName' => String)), + m(PublicMethod, 'item', Object, + array('index' => Int64)) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMNodeList', null, array(), + // Methods + array( + m(PublicMethod, '__construct', null), + m(PublicMethod, 'item', Object, + array('index' => Int64)) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMException', 'Exception', array(), + // Methods + array( + m(PublicMethod, '__construct', null) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMImplementation', null, array(), + // Methods + array( + m(PublicMethod, '__construct', null), + m(PublicMethod, 'createDocument', Variant, + array('namespaceURI' => array(String, 'null_string'), + 'qualifiedName' => array(String, 'null_string'), + 'doctypeObj' => array(Object, 'null_object'))), + m(PublicMethod, 'createDocumentType', Variant, + array('qualifiedName' => array(String, 'null_string'), + 'publicId' => array(String, 'null_string'), + 'systemId' => array(String, 'null_string'))), + m(PublicMethod, 'hasFeature', Boolean, + array('feature' => String, + 'version' => String)) + ), + // Constants + array(), + // Internal fields + "" + ); + +c('DOMXPath', null, array(), + // Methods + array( + m(PublicMethod, '__construct', null, + array('doc' => Variant)), + m(PublicMethod, 'evaluate', Variant, + array('expr' => String, + 'context' => array(Object, 'null_object'))), + m(PublicMethod, 'query', Variant, + array('expr' => String, + 'context' => array(Object, 'null_object'))), + m(PublicMethod, 'registerNamespace', Boolean, + array('prefix' => String, + 'uri' => String)), + m(PublicMethod, 'registerPhpFunctions', Variant, + array('funcs' => array(Variant, 'null'))) + ), + // Constants + array(), + // Internal fields + "\n". + " public:\n". + " xmlNodePtr m_node;" + ); + diff --git a/src/idl/error.idl.php b/src/idl/error.idl.php new file mode 100644 index 0000000000000..eb20529e8ba69 --- /dev/null +++ b/src/idl/error.idl.php @@ -0,0 +1,39 @@ + String, + 'message_type' => array(Int32, '0'), + 'destination' => array(String, 'null_string'), + 'extra_headers' => array(String, 'null_string'))); + +f('error_reporting', Int32, + array('level' => array(Int32, '0'))); + +f('restore_error_handler', Boolean); + +f('restore_exception_handler', Boolean); + +f('set_error_handler', Variant, + array('error_handler' => String, + 'error_types' => array(Int32, '0'))); + +f('set_exception_handler', String, + array('exception_handler' => String)); + +f('trigger_error', Boolean, + array('error_msg' => String, + 'error_type' => array(Int32, 'k_E_USER_NOTICE'))); + +f('user_error', Boolean, + array('error_msg' => String, + 'error_type' => array(Int32, 'k_E_USER_NOTICE'))); diff --git a/src/idl/fbml.idl.php b/src/idl/fbml.idl.php new file mode 100644 index 0000000000000..0495066163664 --- /dev/null +++ b/src/idl/fbml.idl.php @@ -0,0 +1,92 @@ + VariantMap, + 'new_attrs' => VariantMap, + 'special_html' => VariantMap, + 'precache' => VariantMap, + 'style' => VariantMap, + 'style_attrs' => VariantMap, + 'script_attrs' => VariantMap, + 'rewrite_attrs' => VariantMap, + 'special_attrs' => VariantMap, + 'schema' => VariantMap)); + +f('fbml_parse_opaque_11', VariantMap, + array('unsanitized_fbml' => String, + 'body_only' => Boolean, + 'preserve_comment' => Boolean, + 'internal_mode' => array(Boolean, 'false'), + 'css_sanitizer' => array(Variant, 'null_variant'), + 'js_sanitizer' => array(Variant, 'null_variant'), + 'attr_rewriter' => array(Variant, 'null_variant'))); + +f('fbml_sanitize_css_11', VariantMap, + array('unsanitized_css' => String, + 'decl_only' => Boolean, + 'line_number' => Int32, + 'css_sanitizer' => StringVec)); + +f('fbml_sanitize_js_11', VariantMap, + array('unsanitized_js' => String, + 'line_number' => Int32, + 'js_sanitizer' => StringVec)); + +f('fbml_get_tag_name_11', String, + array('node' => Resource)); + +f('fbml_get_children_11', VariantVec, + array('node' => Resource)); + +f('fbml_get_children_count_11', Int32, + array('node' => Resource)); + +f('fbml_get_children_by_name_11', VariantVec, + array('node' => Resource, + 'tag' => String)); + +f('fbml_get_attributes_11', StringMap, + array('node' => Resource)); + +f('fbml_get_attribute_11', String, + array('node' => Resource, + 'name' => String)); + +f('fbml_attr_to_bool_11', Variant, + array('name' => String)); + +f('fbml_attr_to_color_11', String, + array('name' => String)); + +f('fbml_get_text_11', String, + array('node' => Resource)); + +f('fbml_precache_11', NULL, + array('node' => Resource, + 'data' => Variant, + 'callback' => String)); + +f('fbml_batch_precache_11', VariantMap, + array('node' => Resource)); + +f('fbml_render_children_11', String, + array('node' => Resource, + 'data' => Variant, + 'html_callback' => String, + 'fb_callback' => String, + 'internal_mode' => array(Int32, '0'))); + +f('fbml_flatten_11', String, + array('node' => Resource)); + +f('html_profile', String, + array('html' => String)); + +f('fbjsparse', String, + array('input' => String)); diff --git a/src/idl/file.idl.php b/src/idl/file.idl.php new file mode 100644 index 0000000000000..530c2d34ec02f --- /dev/null +++ b/src/idl/file.idl.php @@ -0,0 +1,299 @@ + String, + 'mode' => String, + 'use_include_path' => array(Boolean, 'false'), + 'context' => array(Resource, 'null_object'))); + +f('popen', Variant, + array('command' => String, + 'mode' => String)); + +f('fclose', Boolean, + array('handle' => Resource)); + +f('pclose', Int32, + array('handle' => Resource)); + +f('fseek', Variant, + array('handle' => Resource, + 'offset' => Int64, + 'whence' => array(Int64, 'SEEK_SET'))); + +f('rewind', Boolean, + array('handle' => Resource)); + +f('ftell', Variant, + array('handle' => Resource)); + +f('feof', Boolean, + array('handle' => Resource)); + +f('fstat', Variant, + array('handle' => Resource)); + +f('fread', Variant, + array('handle' => Resource, + 'length' => Int64)); + +f('fgetc', Variant, + array('handle' => Resource)); + +f('fgets', String, + array('handle' => Resource, + 'length' => array(Int64, '1024'))); + +f('fgetss', String, + array('handle' => Resource, + 'length' => array(Int64, '0'), + 'allowable_tags' => array(String, 'null_string'))); + +f('fscanf', Variant, + array('handle' => Resource, + 'format' => String), + ReferenceVariableArguments); + +f('fpassthru', Variant, + array('handle' => Resource)); + +f('fwrite', Int64, + array('handle' => Resource, + 'data' => String, + 'length' => array(Int64, '0'))); + +f('fputs', Int64, + array('handle' => Resource, + 'data' => String, + 'length' => array(Int64, '0'))); + +f('fprintf', Variant, + array('handle' => Resource, + 'format' => String), + VariableArguments); + +f('vfprintf', Variant, + array('handle' => Resource, + 'format' => String, + 'args' => VariantVec)); + +f('fflush', Boolean, + array('handle' => Resource)); + +f('ftruncate', Boolean, + array('handle' => Resource, + 'size' => Int64)); + +f('flock', Boolean, + array('handle' => Resource, + 'operation' => Int32, + 'wouldblock' => array(Boolean | Reference, 'null'))); + +f('fputcsv', Variant, + array('handle' => Resource, + 'fields' => VariantVec, + 'delimiter' => array(String, '","'), + 'enclosure' => array(String, '"\""'))); + +f('fgetcsv', Variant, + array('handle' => Resource, + 'length' => array(Int64, '0'), + 'delimiter' => array(String, '","'), + 'enclosure' => array(String, '"\""'))); + +/////////////////////////////////////////////////////////////////////////////// +// file name based file operations + +f('file_get_contents', Variant, + array('filename' => String, + 'use_include_path' => array(Boolean, 'false'), + 'context' => array(Resource, 'null_object'), + 'offset' => array(Int64, '0'), + 'maxlen' => array(Int64, '0'))); + +f('file_put_contents', Variant, + array('filename' => String, + 'data' => Variant, + 'flags' => array(Int32, '0'), + 'context' => array(Resource, 'null_object'))); + +f('file', Variant, + array('filename' => String, + 'flags' => array(Int32, '0'), + 'context' => array(Resource, 'null_object'))); + +f('readfile', Variant, + array('filename' => String, + 'use_include_path' => array(Boolean, 'false'), + 'context' => array(Resource, 'null_object'))); + +f('move_uploaded_file', Boolean, + array('filename' => String, + 'destination' => String)); + +f('parse_ini_file', Variant, + array('filename' => String, + 'process_sections' => array(Boolean, 'false'))); + +f('md5_file', Variant, + array('filename' => String, + 'raw_output' => array(Boolean, 'false'))); + +f('sha1_file', Variant, + array('filename' => String, + 'raw_output' => array(Boolean, 'false'))); + +/////////////////////////////////////////////////////////////////////////////// +// shell commands + +f('chmod', Boolean, + array('filename' => String, + 'mode' => Int64)); + +f('chown', Boolean, + array('filename' => String, + 'user' => Primitive)); + +f('lchown', Boolean, + array('filename' => String, + 'user' => Variant)); + +f('chgrp', Boolean, + array('filename' => String, + 'group' => Primitive)); + +f('lchgrp', Boolean, + array('filename' => String, + 'group' => Variant)); + +f('touch', Boolean, + array('filename' => String, + 'mtime' => array(Int64, '0'), + 'atime' => array(Int64, '0'))); + +f('copy', Boolean, + array('source' => String, + 'dest' => String, + 'context' => array(Resource, 'null_object'))); + +f('rename', Boolean, + array('oldname' => String, + 'newname' => String, + 'context' => array(Resource, 'null_object'))); + +f('umask', Int32, + array('mask' => array(Variant, 'null_variant'))); + +f('unlink', Boolean, + array('filename' => String, + 'context' => array(Resource, 'null_object'))); + +f('link', Boolean, + array('target' => String, + 'link' => String)); + +f('symlink', Boolean, + array('target' => String, + 'link' => String)); + +f('basename', String, + array('path' => String, + 'suffix' => array(String, 'null_string'))); + +f('fnmatch', Boolean, + array('pattern' => String, + 'filename' => String, + 'flags' => array(Int32, '0'))); + +f('glob', Variant, + array('pattern' => String, + 'flags' => array(Int32, '0'))); + +f('tempnam', Variant, + array('dir' => String, + 'prefix' => String)); + +f('tmpfile', Variant); + +/////////////////////////////////////////////////////////////////////////////// +// stats functions + +f('fileperms', Variant, array('filename' => String)); +f('fileinode', Variant, array('filename' => String)); +f('filesize', Variant, array('filename' => String)); +f('fileowner', Variant, array('filename' => String)); +f('filegroup', Variant, array('filename' => String)); +f('fileatime', Variant, array('filename' => String)); +f('filemtime', Variant, array('filename' => String)); +f('filectime', Variant, array('filename' => String)); +f('filetype', Variant, array('filename' => String)); +f('linkinfo', Variant, array('filename' => String)); +f('is_writable', Boolean, array('filename' => String)); +f('is_writeable', Boolean, array('filename' => String)); +f('is_readable', Boolean, array('filename' => String)); +f('is_executable', Boolean, array('filename' => String)); +f('is_file', Boolean, array('filename' => String)); +f('is_dir', Boolean, array('filename' => String)); +f('is_link', Boolean, array('filename' => String)); +f('is_uploaded_file', Boolean, array('filename' => String)); +f('file_exists', Boolean, array('filename' => String)); +f('stat', Variant, array('filename' => String)); +f('lstat', Variant, array('filename' => String)); +f('clearstatcache'); +f('readlink', Variant, array('path' => String)); +f('realpath', Variant, array('path' => String)); +f('pathinfo', Variant, array('path' => String, + 'opt' => array(Int32, '15'))); +f('disk_free_space', Variant, array('directory' => String)); +f('diskfreespace', Variant, array('directory' => String)); +f('disk_total_space', Variant, array('directory' => String)); + +/////////////////////////////////////////////////////////////////////////////// +// directory functions + +f('mkdir', Boolean, + array('pathname' => String, + 'mode' => array(Int64, '0'), + 'recursive' => array(Boolean, 'false'), + 'context' => array(Resource, 'null_object'))); + +f('rmdir', Boolean, + array('dirname' => String, + 'context' => array(Resource, 'null_object'))); + +f('dirname', String, + array('path' => String)); + +f('getcwd', Variant); + +f('chdir', Boolean, + array('directory' => String)); + +f('chroot', Boolean, + array('directory' => String)); + +f('dir', Variant, + array('directory' => String)); + +f('opendir', Variant, + array('path' => String, + 'context' => array(Resource, 'null'))); + +f('readdir', Variant, + array('dir_handle' => Resource)); + +f('rewinddir', NULL, + array('dir_handle' => Resource)); + +f('scandir', Variant, + array('directory' => String, + 'descending' => array(Boolean, 'false'), + 'context' => array(Resource, 'null'))); + +f('closedir', NULL, + array('dir_handle' => Resource)); diff --git a/src/idl/function.idl.php b/src/idl/function.idl.php new file mode 100644 index 0000000000000..42b0cc209b8a5 --- /dev/null +++ b/src/idl/function.idl.php @@ -0,0 +1,57 @@ + String)); + +f('is_callable', Boolean, + array('v' => Any, + 'syntax' => array(Boolean, 'false'), + 'name' => array(String | Reference, 'null'))); + +f('call_user_func_array', Variant, + array('function' => Variant, + 'params' => VariantVec)); + +f('call_user_func', Variant, + array('function' => Variant), + VariableArguments); + +f('create_function', String, + array('args' => String, + 'code' => String)); + +/////////////////////////////////////////////////////////////////////////////// + +f('func_get_arg', Variant, + array('arg_num' => Int32)); + +f('func_get_args', VariantVec); + +f('func_num_args', Int32); + +/////////////////////////////////////////////////////////////////////////////// + +f('register_postsend_function', NULL, + array('function' => Variant), + VariableArguments); + +f('register_shutdown_function', NULL, + array('function' => Variant), + VariableArguments); + +f('register_cleanup_function', NULL, + array('function' => Variant), + VariableArguments); + +f('register_tick_function', Boolean, + array('function' => Variant), + VariableArguments); + +f('unregister_tick_function', NULL, + array('function_name' => Variant)); diff --git a/src/idl/hash.idl.php b/src/idl/hash.idl.php new file mode 100644 index 0000000000000..3d6ce8108a535 --- /dev/null +++ b/src/idl/hash.idl.php @@ -0,0 +1,53 @@ + String, + 'data' => String, + 'raw_output' => array(Boolean, 'false'))); + +f('hash_algos', StringVec); + +f('hash_init', Variant, + array('algo' => String, + 'options' => array(Int32, '0'), + 'key' => array(String, 'null_string'))); + +f('hash_file', Variant, + array('algo' => String, + 'filename' => String, + 'raw_output' => array(Boolean, 'false'))); + +f('hash_final', String, + array('context' => Resource, + 'raw_output' => array(Boolean, 'false'))); + +f('hash_hmac_file', Variant, + array('algo' => String, + 'filename' => String, + 'key' => String, + 'raw_output' => array(Boolean, 'false'))); + +f('hash_hmac', Variant, + array('algo' => String, + 'data' => String, + 'key' => String, + 'raw_output' => array(Boolean, 'false'))); + +f('hash_update_file', Boolean, + array('init_context' => Resource, + 'filename' => String, + 'stream_context' => array(Resource, 'null'))); + +f('hash_update_stream', Int32, + array('context' => Resource, + 'handle' => Resource, + 'length' => array(Int32, '-1'))); + +f('hash_update', Boolean, + array('context' => Resource, + 'data' => String)); + diff --git a/src/idl/iconv.idl.php b/src/idl/iconv.idl.php new file mode 100644 index 0000000000000..bc8cb733dfafe --- /dev/null +++ b/src/idl/iconv.idl.php @@ -0,0 +1,57 @@ + String, + 'field_value' => String, + 'preferences' => array(Variant, 'null_variant'))); + +f('iconv_mime_decode', Variant, + array('encoded_string' => String, + 'mode' => array(Int32, '0'), + 'charset' => array(String, 'null_string'))); + +f('iconv_mime_decode_headers', Variant, + array('encoded_headers' => String, + 'mode' => array(Int32, '0'), + 'charset' => array(String, 'null_string'))); + +f('iconv_get_encoding', Variant, + array('type' => array(String, '"all"'))); + +f('iconv_set_encoding', Boolean, + array('type' => String, + 'charset' => String)); + +f('iconv', Variant, + array('in_charset' => String, + 'out_charset' => String, + 'str' => String)); + +f('iconv_strlen', Variant, + array('str' => String, + 'charset' => array(String, 'null_string'))); + +f('iconv_strpos', Variant, + array('haystack' => String, + 'needle' => String, + 'offset' => array(Int32, '0'), + 'charset' => array(String, 'null_string'))); + +f('iconv_strrpos', Variant, + array('haystack' => String, + 'needle' => String, + 'charset' => array(String, 'null_string'))); + +f('iconv_substr', Variant, + array('str' => String, + 'offset' => Int32, + 'length' => array(Int32, '0'), + 'charset' => array(String, 'null_string'))); + +f('ob_iconv_handler', String, + array('contents' => String, + 'status' => Int32)); diff --git a/src/idl/icu.idl.php b/src/idl/icu.idl.php new file mode 100644 index 0000000000000..aa5a81d75f1a3 --- /dev/null +++ b/src/idl/icu.idl.php @@ -0,0 +1,9 @@ + String, + 'remove_accents' => Boolean)); diff --git a/src/idl/idl.php b/src/idl/idl.php new file mode 100644 index 0000000000000..5c787f6bbc2df --- /dev/null +++ b/src/idl/idl.php @@ -0,0 +1,337 @@ +>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +EOT + ); + + if (isset($preamble)) { + fprintf($f, $preamble); + } + + fprintf($f, + << + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +EOT + ); + + foreach ($funcs as $func) { + generateFuncCPPHeader($func, $f); + } + foreach ($constants as $const) { + generateConstCPPHeader($const, $f); + } + foreach ($classes as $class) { + generateClassCPPHeader($class, $f); + } + fprintf($f, + << + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +EOT + ); + foreach ($funcs as $func) { + generateFuncCPPImplementation($func, $f); + } + fprintf($f, + <<>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExt${Name} : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + +EOT + ); + foreach ($funcs as $func) { + fprintf($f, " bool test_".$func['name']."();\n"); + } + foreach ($classes as $class) { + fprintf($f, " bool test_".$class['name']."();\n"); + } + fprintf($f, + << +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExt${Name}::RunTests(const std::string &which) { + bool ret = true; + + +EOT + ); + + foreach ($funcs as $func) { + fprintf($f, " RUN_TEST(test_".$func['name'].");\n"); + } + foreach ($classes as $class) { + fprintf($f, " RUN_TEST(test_".$class['name'].");\n"); + } + fprintf($f, << +#include "type_string.h" +#include "type_array.h" +#include "type_object.h" +#include +#include +// Avoid duplicate definition warnings in the PHP headers +#undef PHP_ROUND_FUZZ +#undef PHP_BUILD_DATE +#undef PHP_UNAME +#undef ZEND_DEBUG + // These PHP includes need to come after the HPHP ones, since they define some + // macros that we don't want (like isset()) +#include "php.h" +#include "zend_interfaces.h" +#include "zval.h" +#include "invoke.h" +#include "zend_API.h" + +EOT + ); + fprintf($f, "using namespace HPHP;\n\n"); + + generatePHPBridgeModuleHeader($name, $f); + + foreach ($funcs as $func) { + generatePHPBridgeImplementation($func, $f); + } + foreach ($classes as $class) { + foreach ($class['methods'] as $method) { + generatePHPBridgeImplementation($method, $f, $class['name'], $method['static']); + } + } +} + +/*****************************************************************************/ +if ($format == 'param') { + replaceParams($param_header, true); + replaceParams($param_impl, false); +} + +/*****************************************************************************/ +if ($format == 'profile') { + $header = $argv[3]; + ($f = fopen($header, 'w')) || die("cannot open $header"); + + fprintf($f, + <<>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +EOT + ); + + fprintf($f, + << + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +EOT + ); + + foreach ($funcs as $func) { + generateFuncProfileHeader($func, $f); + } + fprintf($f, + <<\n"); + break; +} + +exec('ls *.idl.php', $files); +foreach ($files as $file) { + preg_match('/^(.*)\.idl\.php$/', $file, $matches); + $name = $matches[1]; + $ucname = ucfirst($name); + + switch ($format) { + case 'inc': + fwrite($f, "#include \"$name.inc\"\n"); + break; + case 'test_ext': + fwrite($f, "#include \n"); + break; + case 'test_suites': + fwrite($f, "RUN_TESTSUITE(TestExt$ucname);\n"); + break; + case 'ext': + fwrite($f, "#include \n"); + break; + } +} + +fclose($f); diff --git a/src/idl/idn.idl.php b/src/idl/idn.idl.php new file mode 100644 index 0000000000000..e348d20be227f --- /dev/null +++ b/src/idl/idn.idl.php @@ -0,0 +1,17 @@ + String, + 'errorcode' => array(Variant | Reference, 'null'))); + +f('idn_to_unicode', Variant, + array('domain' => String, + 'errorcode' => array(Variant | Reference, 'null'))); + +f('idn_to_utf8', Variant, + array('domain' => String, + 'errorcode' => array(Variant | Reference, 'null'))); diff --git a/src/idl/image.idl.php b/src/idl/image.idl.php new file mode 100644 index 0000000000000..73ce5bd0c1f63 --- /dev/null +++ b/src/idl/image.idl.php @@ -0,0 +1,582 @@ + String, + 'imageinfo' => array(VariantMap | Reference, 'null'))); + +f('image_type_to_extension', String, + array('imagetype' => Int32, + 'include_dot' => array(Boolean, 'true'))); + +f('image_type_to_mime_type', String, + array('imagetype' => Int32)); + +f('image2wbmp', Boolean, + array('image' => Resource, + 'filename' => array(String, 'null_string'), + 'threshold' => array(Int32, '-1'))); + +f('imagealphablending', Boolean, + array('image' => Resource, + 'blendmode' => Boolean)); + +f('imageantialias', Boolean, + array('image' => Resource, + 'on' => Boolean)); + +f('imagearc', Boolean, + array('image' => Resource, + 'cx' => Int32, + 'cy' => Int32, + 'width' => Int32, + 'height' => Int32, + 'start' => Int32, + 'end' => Int32, + 'color' => Int32)); + +f('imagechar', Boolean, + array('image' => Resource, + 'font' => Int32, + 'x' => Int32, + 'y' => Int32, + 'c' => String, + 'color' => Int32)); + +f('imagecharup', Boolean, + array('image' => Resource, + 'font' => Int32, + 'x' => Int32, + 'y' => Int32, + 'c' => String, + 'color' => Int32)); + +f('imagecolorallocate', Variant, + array('image' => Resource, + 'red' => Int32, + 'green' => Int32, + 'blue' => Int32)); + +f('imagecolorallocatealpha', Variant, + array('image' => Resource, + 'red' => Int32, + 'green' => Int32, + 'blue' => Int32, + 'alpha' => Int32)); + +f('imagecolorat', Variant, + array('image' => Resource, + 'x' => Int32, + 'y' => Int32)); + +f('imagecolorclosest', Variant, + array('image' => Resource, + 'red' => Int32, + 'green' => Int32, + 'blue' => Int32)); + +f('imagecolorclosestalpha', Variant, + array('image' => Resource, + 'red' => Int32, + 'green' => Int32, + 'blue' => Int32, + 'alpha' => Int32)); + +f('imagecolorclosesthwb', Variant, + array('image' => Resource, + 'red' => Int32, + 'green' => Int32, + 'blue' => Int32)); + +f('imagecolordeallocate', Boolean, + array('image' => Resource, + 'color' => Int32)); + +f('imagecolorexact', Variant, + array('image' => Resource, + 'red' => Int32, + 'green' => Int32, + 'blue' => Int32)); + +f('imagecolorexactalpha', Variant, + array('image' => Resource, + 'red' => Int32, + 'green' => Int32, + 'blue' => Int32, + 'alpha' => Int32)); + +f('imagecolormatch', Variant, + array('image1' => Resource, + 'image2' => Resource)); + +f('imagecolorresolve', Variant, + array('image' => Resource, + 'red' => Int32, + 'green' => Int32, + 'blue' => Int32)); + +f('imagecolorresolvealpha', Variant, + array('image' => Resource, + 'red' => Int32, + 'green' => Int32, + 'blue' => Int32, + 'alpha' => Int32)); + +f('imagecolorset', Variant, + array('image' => Resource, + 'index' => Int32, + 'red' => Int32, + 'green' => Int32, + 'blue' => Int32)); + +f('imagecolorsforindex', Variant, + array('image' => Resource, + 'index' => Int32)); + +f('imagecolorstotal', Variant, + array('image' => Resource)); + +f('imagecolortransparent', Variant, + array('image' => Resource, + 'color' => array(Int32, '-1'))); + +f('imageconvolution', Boolean, + array('image' => Resource, + 'matrix' => Int64Map, + 'div' => Double, + 'offset' => Double)); + +f('imagecopy', Boolean, + array('dst_im' => Resource, + 'src_im' => Resource, + 'dst_x' => Int32, + 'dst_y' => Int32, + 'src_x' => Int32, + 'src_y' => Int32, + 'src_w' => Int32, + 'src_h' => Int32)); + +f('imagecopymerge', Boolean, + array('dst_im' => Resource, + 'src_im' => Resource, + 'dst_x' => Int32, + 'dst_y' => Int32, + 'src_x' => Int32, + 'src_y' => Int32, + 'src_w' => Int32, + 'src_h' => Int32, + 'pct' => Int32)); + +f('imagecopymergegray', Boolean, + array('dst_im' => Resource, + 'src_im' => Resource, + 'dst_x' => Int32, + 'dst_y' => Int32, + 'src_x' => Int32, + 'src_y' => Int32, + 'src_w' => Int32, + 'src_h' => Int32, + 'pct' => Int32)); + +f('imagecopyresampled', Boolean, + array('dst_im' => Resource, + 'src_im' => Resource, + 'dst_x' => Int32, + 'dst_y' => Int32, + 'src_x' => Int32, + 'src_y' => Int32, + 'dst_w' => Int32, + 'dst_h' => Int32, + 'src_w' => Int32, + 'src_h' => Int32)); + +f('imagecopyresized', Boolean, + array('dst_im' => Resource, + 'src_im' => Resource, + 'dst_x' => Int32, + 'dst_y' => Int32, + 'src_x' => Int32, + 'src_y' => Int32, + 'dst_w' => Int32, + 'dst_h' => Int32, + 'src_w' => Int32, + 'src_h' => Int32)); + +f('imagecreate', Variant, + array('width' => Int32, + 'height' => Int32)); + +f('imagecreatefromgd2part', Variant, + array('filename' => String, + 'srcX' => Int32, + 'srcY' => Int32, + 'width' => Int32, + 'height' => Int32)); + +f('imagecreatefromgd', Variant, array('filename' => String)); +f('imagecreatefromgd2', Variant, array('filename' => String)); +f('imagecreatefromgif', Variant, array('filename' => String)); +f('imagecreatefromjpeg', Variant, array('filename' => String)); +f('imagecreatefrompng', Variant, array('filename' => String)); +f('imagecreatefromstring', Variant, array('data' => String)); +f('imagecreatefromwbmp', Variant, array('filename' => String)); +f('imagecreatefromxbm', Variant, array('filename' => String)); +f('imagecreatefromxpm', Variant, array('filename' => String)); +f('imagecreatetruecolor', Variant, + array('width' => Int32, + 'height' => Int32)); + +f('imagedashedline', Boolean, + array('image' => Resource, + 'x1' => Int32, + 'y1' => Int32, + 'x2' => Int32, + 'y2' => Int32, + 'color' => Int32)); + +f('imagedestroy', Boolean, + array('image' => Resource)); + +f('imageellipse', Boolean, + array('image' => Resource, + 'cx' => Int32, + 'cy' => Int32, + 'width' => Int32, + 'height' => Int32, + 'color' => Int32)); + +f('imagefill', Boolean, + array('image' => Resource, + 'x' => Int32, + 'y' => Int32, + 'color' => Int32)); + +f('imagefilledarc', Boolean, + array('image' => Resource, + 'cx' => Int32, + 'cy' => Int32, + 'width' => Int32, + 'height' => Int32, + 'start' => Int32, + 'end' => Int32, + 'color' => Int32, + 'style' => Int32)); + +f('imagefilledellipse', Boolean, + array('image' => Resource, + 'cx' => Int32, + 'cy' => Int32, + 'width' => Int32, + 'height' => Int32, + 'color' => Int32)); + +f('imagefilledpolygon', Boolean, + array('image' => Resource, + 'points' => VariantVec, + 'num_points' => Int32, + 'color' => Int32)); + +f('imagefilledrectangle', Boolean, + array('image' => Resource, + 'x1' => Int32, + 'y1' => Int32, + 'x2' => Int32, + 'y2' => Int32, + 'color' => Int32)); + +f('imagefilltoborder', Boolean, + array('image' => Resource, + 'x' => Int32, + 'y' => Int32, + 'border' => Int32, + 'color' => Int32)); + +f('imagefilter', Boolean, + array('image' => Resource, + 'filtertype' => Int32, + 'arg1' => array(Int32, '0'), + 'arg2' => array(Int32, '0'), + 'arg3' => array(Int32, '0'), + 'arg4' => array(Int32, '0'))); + +f('imagefontheight', Int32, + array('font' => Int32)); + +f('imagefontwidth', Int32, + array('font' => Int32)); + +f('imageftbbox', Variant, + array('size' => Double, + 'angle' => Double, + 'font_file' => String, + 'text' => String, + 'extrainfo' => array(VariantMap, 'null'))); + +f('imagefttext', Variant, + array('image' => Resource, + 'size' => Double, + 'angle' => Double, + 'x' => Int32, + 'y' => Int32, + 'col' => Int32, + 'font_file' => String, + 'text' => String, + 'extrainfo' => array(VariantMap, 'null'))); + +f('imagegammacorrect', Boolean, + array('image' => Resource, + 'inputgamma' => Double, + 'outputgamma' => Double)); + +f('imagegd2', Boolean, + array('image' => Resource, + 'filename' => array(String, 'null_string'), + 'chunk_size' => array(Int32, '0'), + 'type' => array(Int32, '0'))); + +f('imagegd', Boolean, + array('image' => Resource, + 'filename' => array(String, 'null_string'))); + +f('imagegif', Boolean, + array('image' => Resource, + 'filename' => array(String, 'null_string'))); + +f('imagegrabscreen', Variant); + +f('imagegrabwindow', Variant, + array('window' => Int32, + 'client_area' => array(Int32, '0'))); + +f('imageinterlace', Variant, + array('image' => Resource, + 'interlace' => array(Int32, '0'))); + +f('imageistruecolor', Boolean, + array('image' => Resource)); + +f('imagejpeg', Boolean, + array('image' => Resource, + 'filename' => array(String, 'null_string'), + 'quality' => array(Int32, '-1'))); + +f('imagelayereffect', Boolean, + array('image' => Resource, + 'effect' => Int32)); + +f('imageline', Boolean, + array('image' => Resource, + 'x1' => Int32, + 'y1' => Int32, + 'x2' => Int32, + 'y2' => Int32, + 'color' => Int32)); + +f('imageloadfont', Variant, + array('file' => String)); + +f('imagepalettecopy', NULL, + array('destination' => Resource, + 'source' => Resource)); + +f('imagepng', Boolean, + array('image' => Resource, + 'filename' => array(String, 'null_string'), + 'quality' => array(Int32, '-1'), + 'filters' => array(Int32, '-1'))); + +f('imagepolygon', Boolean, + array('image' => Resource, + 'points' => VariantVec, + 'num_points' => Int32, + 'color' => Int32)); + +f('imagepsbbox', Int64Vec, + array('text' => String, + 'font' => Int32, + 'size' => Int32, + 'space' => array(Int32, '0'), + 'tightness' => array(Int32, '0'), + 'angle' => array(Double, '0.0'))); + +f('imagepsencodefont', Boolean, + array('font_index' => Resource, + 'encodingfile' => String)); + +f('imagepsextendfont', Boolean, + array('font_index' => Int32, + 'extend' => Double)); + +f('imagepsfreefont', Boolean, + array('fontindex' => Resource)); + +f('imagepsloadfont', Resource, + array('filename' => String)); + +f('imagepsslantfont', Boolean, + array('font_index' => Resource, + 'slant' => Double)); + +f('imagepstext', StringVec, + array('image' => Resource, + 'text' => String, + 'font' => Resource, + 'size' => Int32, + 'foreground' => Int32, + 'background' => Int32, + 'x' => Int32, + 'y' => Int32, + 'space' => array(Int32, '0'), + 'tightness' => array(Int32, '0'), + 'angle' => array(Double, '0.0'), + 'antialias_steps' => array(Int32, '0'))); + +f('imagerectangle', Boolean, + array('image' => Resource, + 'x1' => Int32, + 'y1' => Int32, + 'x2' => Int32, + 'y2' => Int32, + 'color' => Int32)); + +f('imagerotate', Variant, + array('source_image' => Resource, + 'angle' => Double, + 'bgd_color' => Int32, + 'ignore_transparent' => array(Int32, '0'))); + +f('imagesavealpha', Boolean, + array('image' => Resource, + 'saveflag' => Boolean)); + +f('imagesetbrush', Boolean, + array('image' => Resource, + 'brush' => Resource)); + +f('imagesetpixel', Boolean, + array('image' => Resource, + 'x' => Int32, + 'y' => Int32, + 'color' => Int32)); + +f('imagesetstyle', Boolean, + array('image' => Resource, + 'style' => VariantMap)); + +f('imagesetthickness', Boolean, + array('image' => Resource, + 'thickness' => Int32)); + +f('imagesettile', Boolean, + array('image' => Resource, + 'tile' => Resource)); + +f('imagestring', Boolean, + array('image' => Resource, + 'font' => Int32, + 'x' => Int32, + 'y' => Int32, + 'str' => String, + 'color' => Int32)); + +f('imagestringup', Boolean, + array('image' => Resource, + 'font' => Int32, + 'x' => Int32, + 'y' => Int32, + 'str' => String, + 'color' => Int32)); + +f('imagesx', Variant, + array('image' => Resource)); + +f('imagesy', Variant, + array('image' => Resource)); + +f('imagetruecolortopalette', Variant, + array('image' => Resource, + 'dither' => Boolean, + 'ncolors' => Int32)); + +f('imagettfbbox', Variant, + array('size' => Double, + 'angle' => Double, + 'fontfile' => String, + 'text' => String)); + +f('imagettftext', Variant, + array('image' => Resource, + 'size' => Double, + 'angle' => Double, + 'x' => Int32, + 'y' => Int32, + 'color' => Int32, + 'fontfile' => String, + 'text' => String)); + +f('imagetypes', Int32); + +f('imagewbmp', Boolean, + array('image' => Resource, + 'filename' => array(String, 'null_string'), + 'foreground' => array(Int32, '-1'))); + +f('imagexbm', Boolean, + array('image' => Resource, + 'filename' => array(String, 'null_string'), + 'foreground' => array(Int32, '-1'))); + +f('iptcembed', Variant, + array('iptcdata' => String, + 'jpeg_file_name' => String, + 'spool' => array(Int32, '0'))); + +f('iptcparse', Variant, + array('iptcblock' => String)); + +f('jpeg2wbmp', Boolean, + array('jpegname' => String, + 'wbmpname' => String, + 'dest_height' => Int32, + 'dest_width' => Int32, + 'threshold' => Int32)); + +f('png2wbmp', Boolean, + array('pngname' => String, + 'wbmpname' => String, + 'dest_height' => Int32, + 'dest_width' => Int32, + 'threshold' => Int32)); + +/////////////////////////////////////////////////////////////////////////////// +// exif + +f('exif_imagetype', Variant, + array('filename' => String)); + +f('exif_read_data', Variant, + array('filename' => String, + 'sections' => array(String, 'null_string'), + 'arrays' => array(Boolean, 'false'), + 'thumbnail' => array(Boolean, 'false'))); + +f('read_exif_data', Variant, + array('filename' => String, + 'sections' => array(String, 'null_string'), + 'arrays' => array(Boolean, 'false'), + 'thumbnail' => array(Boolean, 'false'))); + +f('exif_tagname', Variant, + array('index' => Int32)); + +f('exif_thumbnail', Variant, + array('filename' => String, + 'width' => array(Int32 | Reference, 'null'), + 'height' => array(Int32 | Reference, 'null'), + 'imagetype' => array(Int32 | Reference, 'null'))); diff --git a/src/idl/ipc.idl.php b/src/idl/ipc.idl.php new file mode 100644 index 0000000000000..df1b7f8b22fd8 --- /dev/null +++ b/src/idl/ipc.idl.php @@ -0,0 +1,87 @@ + String, + 'proj' => String)); + +f('msg_get_queue', Variant, + array('key' => Int64, + 'perms' => array(Int64, '0666'))); + +f('msg_send', Boolean, + array('queue' => Resource, + 'msgtype' => Int64, + 'message' => Variant, + 'serialize' => array(Boolean, 'true'), + 'blocking' => array(Boolean, 'true'), + 'errorcode' => array(Variant | Reference, 'null'))); + +f('msg_receive', Boolean, + array('queue' => Resource, + 'desiredmsgtype' => Int64, + 'msgtype' => Int64 | Reference, + 'maxsize' => Int64, + 'message' => Variant | Reference, + 'unserialize' => array(Boolean, 'true'), + 'flags' => array(Int64, '0'), + 'errorcode' => array(Variant | Reference, 'null'))); + +f('msg_remove_queue', Boolean, + array('queue' => Resource)); + +f('msg_set_queue', Boolean, + array('queue' => Resource, + 'data' => Int64Map)); + +f('msg_stat_queue', Int64Map, + array('queue' => Resource)); + +/////////////////////////////////////////////////////////////////////////////// +// semaphore + +f('sem_acquire', Boolean, + array('sem_identifier' => Resource)); + +f('sem_get', Variant, + array('key' => Int64, + 'max_acquire' => array(Int64, '1'), + 'perm' => array(Int64, '0666'), + 'auto_release' => array(Boolean, 'true'))); + +f('sem_release', Boolean, + array('sem_identifier' => Resource)); + +f('sem_remove', Boolean, + array('sem_identifier' => Resource)); + +/////////////////////////////////////////////////////////////////////////////// +// shared memory + +f('shm_attach', Variant, + array('shm_key' => Int64, + 'shm_size' => array(Int64, '10000'), + 'shm_flag' => array(Int64, '0666'))); + +f('shm_detach', Boolean, + array('shm_identifier' => Int64)); + +f('shm_remove', Boolean, + array('shm_identifier' => Int64)); + +f('shm_get_var', Variant, + array('shm_identifier' => Int64, + 'variable_key' => Int64)); + +f('shm_put_var', Boolean, + array('shm_identifier' => Int64, + 'variable_key' => Int64, + 'variable' => Any)); + +f('shm_remove_var', Boolean, + array('shm_identifier' => Int64, + 'variable_key' => Int64)); diff --git a/src/idl/json.idl.php b/src/idl/json.idl.php new file mode 100644 index 0000000000000..46c94872570f0 --- /dev/null +++ b/src/idl/json.idl.php @@ -0,0 +1,9 @@ + Variant, + 'loose' => array(Boolean, 'false'))); +f('json_decode', Variant, array('json' => String, + 'assoc' => array(Boolean, 'false'), + 'loose' => array(Boolean, 'false'))); diff --git a/src/idl/ldap.idl.php b/src/idl/ldap.idl.php new file mode 100644 index 0000000000000..112292992a242 --- /dev/null +++ b/src/idl/ldap.idl.php @@ -0,0 +1,211 @@ + array(String, 'null_string'), + 'port' => array(Int32, '389'))); + +f('ldap_explode_dn', VariantVec, + array('dn' => String, + 'with_attrib' => Int32)); + +f('ldap_dn2ufn', String, + array('db' => String)); + +f('ldap_err2str', String, + array('errnum' => Int32)); + +f('ldap_8859_to_t61', String, + array('value' => String)); + +f('ldap_t61_to_8859', String, + array('value' => String)); + +f('ldap_add', Boolean, + array('link_identifier' => Resource, + 'dn' => String, + 'entry' => VariantVec)); + +f('ldap_mod_add', Boolean, + array('link_identifier' => Resource, + 'dn' => String, + 'entry' => VariantVec)); + +f('ldap_mod_del', Boolean, + array('link_identifier' => Resource, + 'dn' => String, + 'entry' => VariantVec)); + +f('ldap_mod_replace', Boolean, + array('link_identifier' => Resource, + 'dn' => String, + 'entry' => VariantVec)); + +f('ldap_modify', Boolean, + array('link_identifier' => Resource, + 'dn' => String, + 'entry' => VariantVec)); + +f('ldap_bind', Boolean, + array('link_identifier' => Resource, + 'bind_rdn' => array(String, 'null_string'), + 'bind_password' => array(String, 'null_string'))); + +f('ldap_sasl_bind', Boolean, + array('link' => Resource, + 'binddn' => array(String, 'null_string'), + 'password' => array(String, 'null_string'), + 'sasl_mech' => array(String, 'null_string'), + 'sasl_realm' => array(String, 'null_string'), + 'sasl_authz_id' => array(String, 'null_string'), + 'props' => array(String, 'null_string'))); + +f('ldap_set_rebind_proc', Boolean, + array('link' => Resource, + 'callback' => String)); + +f('ldap_sort', Boolean, + array('link' => Resource, + 'result' => Resource, + 'sortfilter' => String)); + +f('ldap_start_tls', Boolean, + array('link' => Resource)); + +f('ldap_unbind', Boolean, + array('link_identifier' => Resource)); + +f('ldap_get_option', Boolean, + array('link_identifier' => Resource, + 'option' => Int32, + 'retval' => Variant | Reference)); + +f('ldap_set_option', Boolean, + array('link_identifier' => Resource, + 'option' => Int32, + 'newval' => Variant)); + +f('ldap_close', Boolean, + array('link_identifier' => Resource)); + +f('ldap_list', Resource, + array('link_identifier' => Resource, + 'base_dn' => String, + 'filter' => String, + 'attributes' => array(StringVec, 'null'), + 'attrsonly' => array(Int32, '0'), + 'sizelimit' => array(Int32, '0'), + 'timelimit' => array(Int32, '0'), + 'deref' => array(Int32, '0'))); + +f('ldap_read', Resource, + array('link_identifier' => Resource, + 'base_dn' => String, + 'filter' => String, + 'attributes' => array(StringVec, 'null'), + 'attrsonly' => array(Int32, '0'), + 'sizelimit' => array(Int32, '0'), + 'timelimit' => array(Int32, '0'), + 'deref' => array(Int32, '0'))); + +f('ldap_search', Resource, + array('link_identifier' => Resource, + 'base_dn' => String, + 'filter' => String, + 'attributes' => array(StringVec, 'null'), + 'attrsonly' => array(Int32, '0'), + 'sizelimit' => array(Int32, '0'), + 'timelimit' => array(Int32, '0'), + 'deref' => array(Int32, '0'))); + +f('ldap_rename', Boolean, + array('link_identifier' => Resource, + 'dn' => String, + 'newrdn' => String, + 'newparent' => String, + 'deleteoldrdn' => Boolean)); + +f('ldap_delete', Boolean, + array('link_identifier' => Resource, + 'dn' => String)); + +f('ldap_compare', Variant, + array('link_identifier' => Resource, + 'dn' => String, + 'attribute' => String, + 'value' => String)); + +f('ldap_errno', Int32, + array('link_identifier' => Resource)); + +f('ldap_error', String, + array('link_identifier' => Resource)); + +f('ldap_get_dn', String, + array('link_identifier' => Resource, + 'result_entry_identifier' => Resource)); + +f('ldap_count_entries', Int32, + array('link_identifier' => Resource, + 'result_identifier' => Resource)); + +f('ldap_get_entries', StringVec, + array('link_identifier' => Resource, + 'result_identifier' => Resource)); + +f('ldap_first_entry', Resource, + array('link_identifier' => Resource, + 'result_identifier' => Resource)); + +f('ldap_next_entry', Resource, + array('link_identifier' => Resource, + 'result_identifier' => Resource)); + +f('ldap_get_attributes', StringVec, + array('link_identifier' => Resource, + 'result_entry_identifier' => Resource)); + +f('ldap_first_attribute', String, + array('link_identifier' => Resource, + 'result_identifier' => Resource)); + +f('ldap_next_attribute', String, + array('link_identifier' => Resource, + 'result_entry_identifier' => Resource)); + +f('ldap_first_reference', Resource, + array('link_identifier' => Resource, + 'result_identifier' => Resource)); + +f('ldap_next_reference', Resource, + array('link_identifier' => Resource, + 'result_identifier' => Resource)); + +f('ldap_parse_reference', Boolean, + array('link_identifier' => Resource, + 'result_identifier' => Resource, + 'referrals' => StringVec | Reference)); + +f('ldap_parse_result', Boolean, + array('link_identifier' => Resource, + 'result_entry_identifier' => Resource, + 'errcode' => Int32 | Reference, + 'matcheddn' => array(String | Reference, 'null'), + 'errmsg' => array(String | Reference, 'null'), + 'referrals' => array(StringVec | Reference, 'null'))); + +f('ldap_free_result', Boolean, + array('result_identifier' => Resource)); + +f('ldap_get_values_len', StringVec, + array('link_identifier' => Resource, + 'result_entry_identifier' => Resource, + 'attribute' => String)); + +f('ldap_get_values', StringVec, + array('link_identifier' => Resource, + 'result_entry_identifier' => Resource, + 'attribute' => String)); diff --git a/src/idl/magick.idl.php b/src/idl/magick.idl.php new file mode 100644 index 0000000000000..f01ffbdff42c4 --- /dev/null +++ b/src/idl/magick.idl.php @@ -0,0 +1,1599 @@ + Int32)); +f('MagickGetVersion', VariantVec); +f('MagickGetVersionNumber', Int32); +f('MagickGetVersionString', String); +f('MagickQueryConfigureOption', String, array('option' => String)); +f('MagickQueryConfigureOptions', StringVec, array('pattern' => String)); +f('MagickQueryFonts', VariantVec, array('pattern' => String)); +f('MagickQueryFormats', VariantVec, array('pattern' => String)); + +f('MagickSetResourceLimit', Boolean, + array('resource_type' => Int32, + 'limit' => Double)); + +f('NewDrawingWand', Resource); +f('NewMagickWand', Resource); +f('NewPixelIterator', Resource, array('mgck_wnd' => Resource)); +f('NewPixelRegionIterator', Resource, + array('mgck_wnd' => Resource, + 'x' => Int32, + 'y' => Int32, + 'columns' => Int32, + 'rows' => Int32)); +f('NewPixelWand', Resource, + array('imagemagick_col_str' => array(String, 'null_string'))); +f('NewPixelWandArray', VariantVec, array('num_pxl_wnds' => Int32)); +f('NewPixelWands', VariantVec, array('num_pxl_wnds' => Int32)); + +f('DestroyDrawingWand', NULL, array('drw_wnd' => Resource)); +f('DestroyMagickWand', NULL, array('mgck_wnd' => Resource)); +f('DestroyPixelIterator', NULL, array('pxl_iter' => Resource)); +f('DestroyPixelWand', NULL, array('pxl_wnd' => Resource)); +f('DestroyPixelWandArray', NULL, array('pxl_wnd_array' => VariantVec)); +f('DestroyPixelWands', NULL, array('pxl_wnd_array' => VariantVec)); + +f('IsDrawingWand', Boolean, array('var' => Variant)); +f('IsMagickWand', Boolean, array('var' => Variant)); +f('IsPixelIterator', Boolean, array('var' => Variant)); +f('IsPixelWand', Boolean, array('var' => Variant)); + +f('ClearDrawingWand', NULL, array('drw_wnd' => Resource)); +f('ClearMagickWand', NULL, array('mgck_wnd' => Resource)); +f('ClearPixelIterator', NULL, array('pxl_iter' => Resource)); +f('ClearPixelWand', NULL, array('pxl_wnd' => Resource)); + +f('CloneDrawingWand', Resource, array('drw_wnd' => Resource)); +f('CloneMagickWand', Resource, array('mgck_wnd' => Resource)); + +f('WandGetException', VariantVec, array('wnd' => Resource)); +f('WandGetExceptionString', String, array('wnd' => Resource)); +f('WandGetExceptionType', Int32, array('wnd' => Resource)); +f('WandHasException', Boolean, array('wnd' => Resource)); + +/////////////////////////////////////////////////////////////////////////////// +// Draw Functions + +f('DrawAffine', NULL, + array('drw_wnd' => Resource, + 'sx' => Double, + 'sy' => Double, + 'rx' => Double, + 'ry' => Double, + 'tx' => Double, + 'ty' => Double)); + +f('DrawAnnotation', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double, + 'text' => String)); + +f('DrawArc', NULL, + array('drw_wnd' => Resource, + 'sx' => Double, + 'sy' => Double, + 'ex' => Double, + 'ey' => Double, + 'sd' => Double, + 'ed' => Double)); + +f('DrawBezier', NULL, + array('drw_wnd' => Resource, + 'x_y_points_array' => VariantVec)); + +f('DrawCircle', NULL, + array('drw_wnd' => Resource, + 'ox' => Double, + 'oy' => Double, + 'px' => Double, + 'py' => Double)); + +f('DrawColor', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double, + 'paint_method' => Int32)); + +f('DrawComment', NULL, + array('drw_wnd' => Resource, + 'comment' => String)); + +f('DrawComposite', Boolean, + array('drw_wnd' => Resource, + 'composite_operator' => Int32, + 'x' => Double, + 'y' => Double, + 'width' => Double, + 'height' => Double, + 'mgck_wnd' => Resource)); + +f('DrawEllipse', NULL, + array('drw_wnd' => Resource, + 'ox' => Double, + 'oy' => Double, + 'rx' => Double, + 'ry' => Double, + 'start' => Double, + 'end' => Double)); + +f('DrawGetClipPath', String, array('drw_wnd' => Resource)); +f('DrawGetClipRule', Int32, array('drw_wnd' => Resource)); +f('DrawGetClipUnits', Int32, array('drw_wnd' => Resource)); +f('DrawGetException', VariantVec, array('drw_wnd' => Resource)); +f('DrawGetExceptionString', String, array('drw_wnd' => Resource)); +f('DrawGetExceptionType', Int32, array('drw_wnd' => Resource)); +f('DrawGetFillAlpha', Double, array('drw_wnd' => Resource)); +f('DrawGetFillColor', Resource, array('drw_wnd' => Resource)); +f('DrawGetFillOpacity', Double, array('drw_wnd' => Resource)); +f('DrawGetFillRule', Int32, array('drw_wnd' => Resource)); +f('DrawGetFont', String, array('drw_wnd' => Resource)); +f('DrawGetFontFamily', String, array('drw_wnd' => Resource)); +f('DrawGetFontSize', Double, array('drw_wnd' => Resource)); +f('DrawGetFontStretch', Int32, array('drw_wnd' => Resource)); +f('DrawGetFontStyle', Int32, array('drw_wnd' => Resource)); +f('DrawGetFontWeight', Double, array('drw_wnd' => Resource)); +f('DrawGetGravity', Int32, array('drw_wnd' => Resource)); +f('DrawGetStrokeAlpha', Double, array('drw_wnd' => Resource)); +f('DrawGetStrokeAntialias', Boolean, array('drw_wnd' => Resource)); +f('DrawGetStrokeColor', Resource, array('drw_wnd' => Resource)); +f('DrawGetStrokeDashArray', VariantVec, array('drw_wnd' => Resource)); +f('DrawGetStrokeDashOffset', Double, array('drw_wnd' => Resource)); +f('DrawGetStrokeLineCap', Int32, array('drw_wnd' => Resource)); +f('DrawGetStrokeLineJoin', Int32, array('drw_wnd' => Resource)); +f('DrawGetStrokeMiterLimit', Double, array('drw_wnd' => Resource)); +f('DrawGetStrokeOpacity', Double, array('drw_wnd' => Resource)); +f('DrawGetStrokeWidth', Double, array('drw_wnd' => Resource)); +f('DrawGetTextAlignment', Int32, array('drw_wnd' => Resource)); +f('DrawGetTextAntialias', Boolean, array('drw_wnd' => Resource)); +f('DrawGetTextDecoration', Int32, array('drw_wnd' => Resource)); +f('DrawGetTextEncoding', String, array('drw_wnd' => Resource)); +f('DrawGetTextUnderColor', Resource, array('drw_wnd' => Resource)); +f('DrawGetVectorGraphics', String, array('drw_wnd' => Resource)); + +f('DrawLine', NULL, + array('drw_wnd' => Resource, + 'sx' => Double, + 'sy' => Double, + 'ex' => Double, + 'ey' => Double)); + +f('DrawMatte', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double, + 'paint_method' => Int32)); + +f('DrawPathClose', NULL, + array('drw_wnd' => Resource)); + +f('DrawPathCurveToAbsolute', NULL, + array('drw_wnd' => Resource, + 'x1' => Double, + 'y1' => Double, + 'x2' => Double, + 'y2' => Double, + 'x' => Double, + 'y' => Double)); + +f('DrawPathCurveToQuadraticBezierAbsolute', NULL, + array('drw_wnd' => Resource, + 'x1' => Double, + 'y1' => Double, + 'x' => Double, + 'y' => Double)); + +f('DrawPathCurveToQuadraticBezierRelative', NULL, + array('drw_wnd' => Resource, + 'x1' => Double, + 'y1' => Double, + 'x' => Double, + 'y' => Double)); + +f('DrawPathCurveToQuadraticBezierSmoothAbsolute', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('DrawPathCurveToQuadraticBezierSmoothRelative', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('DrawPathCurveToRelative', NULL, + array('drw_wnd' => Resource, + 'x1' => Double, + 'y1' => Double, + 'x2' => Double, + 'y2' => Double, + 'x' => Double, + 'y' => Double)); + +f('DrawPathCurveToSmoothAbsolute', NULL, + array('drw_wnd' => Resource, + 'x2' => Double, + 'y2' => Double, + 'x' => Double, + 'y' => Double)); + +f('DrawPathCurveToSmoothRelative', NULL, + array('drw_wnd' => Resource, + 'x2' => Double, + 'y2' => Double, + 'x' => Double, + 'y' => Double)); + +f('DrawPathEllipticArcAbsolute', NULL, + array('drw_wnd' => Resource, + 'rx' => Double, + 'ry' => Double, + 'x_axis_rotation' => Double, + 'large_arc_flag' => Boolean, + 'sweep_flag' => Boolean, + 'x' => Double, + 'y' => Double)); + +f('DrawPathEllipticArcRelative', NULL, + array('drw_wnd' => Resource, + 'rx' => Double, + 'ry' => Double, + 'x_axis_rotation' => Double, + 'large_arc_flag' => Boolean, + 'sweep_flag' => Boolean, + 'x' => Double, + 'y' => Double)); + +f('DrawPathFinish', NULL, + array('drw_wnd' => Resource)); + +f('DrawPathLineToAbsolute', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('DrawPathLineToHorizontalAbsolute', NULL, + array('drw_wnd' => Resource, + 'x' => Double)); + +f('DrawPathLineToHorizontalRelative', NULL, + array('drw_wnd' => Resource, + 'x' => Double)); + +f('DrawPathLineToRelative', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('DrawPathLineToVerticalAbsolute', NULL, + array('drw_wnd' => Resource, + 'y' => Double)); + +f('DrawPathLineToVerticalRelative', NULL, + array('drw_wnd' => Resource, + 'y' => Double)); + +f('DrawPathMoveToAbsolute', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('DrawPathMoveToRelative', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('DrawPathStart', NULL, + array('drw_wnd' => Resource)); + +f('DrawPoint', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('DrawPolygon', NULL, + array('drw_wnd' => Resource, + 'x_y_points_array' => VariantVec)); + +f('DrawPolyline', NULL, + array('drw_wnd' => Resource, + 'x_y_points_array' => VariantVec)); + +f('DrawRectangle', NULL, + array('drw_wnd' => Resource, + 'x1' => Double, + 'y1' => Double, + 'x2' => Double, + 'y2' => Double)); + +f('DrawRender', Boolean, + array('drw_wnd' => Resource)); + +f('DrawRotate', NULL, + array('drw_wnd' => Resource, + 'degrees' => Double)); + +f('DrawRoundRectangle', NULL, + array('drw_wnd' => Resource, + 'x1' => Double, + 'y1' => Double, + 'x2' => Double, + 'y2' => Double, + 'rx' => Double, + 'ry' => Double)); + +f('DrawScale', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('DrawSetClipPath', Boolean, + array('drw_wnd' => Resource, + 'clip_path' => String)); + +f('DrawSetClipRule', NULL, + array('drw_wnd' => Resource, + 'fill_rule' => Int32)); + +f('DrawSetClipUnits', NULL, + array('drw_wnd' => Resource, + 'clip_path_units' => Int32)); + +f('DrawSetFillAlpha', NULL, + array('drw_wnd' => Resource, + 'fill_opacity' => Double)); + +f('DrawSetFillColor', NULL, + array('drw_wnd' => Resource, + 'fill_pxl_wnd' => Resource)); + +f('DrawSetFillOpacity', NULL, + array('drw_wnd' => Resource, + 'fill_opacity' => Double)); + +f('DrawSetFillPatternURL', Boolean, + array('drw_wnd' => Resource, + 'fill_url' => String)); + +f('DrawSetFillRule', NULL, + array('drw_wnd' => Resource, + 'fill_rule' => Int32)); + +f('DrawSetFont', Boolean, + array('drw_wnd' => Resource, + 'font_file' => String)); + +f('DrawSetFontFamily', Boolean, + array('drw_wnd' => Resource, + 'font_family' => String)); + +f('DrawSetFontSize', NULL, + array('drw_wnd' => Resource, + 'pointsize' => Double)); + +f('DrawSetFontStretch', NULL, + array('drw_wnd' => Resource, + 'stretch_type' => Int32)); + +f('DrawSetFontStyle', NULL, + array('drw_wnd' => Resource, + 'style_type' => Int32)); + +f('DrawSetFontWeight', NULL, + array('drw_wnd' => Resource, + 'font_weight' => Double)); + +f('DrawSetGravity', NULL, + array('drw_wnd' => Resource, + 'gravity_type' => Int32)); + +f('DrawSetStrokeAlpha', NULL, + array('drw_wnd' => Resource, + 'stroke_opacity' => Double)); + +f('DrawSetStrokeAntialias', NULL, + array('drw_wnd' => Resource, + 'stroke_antialias' => array(Boolean, 'true'))); + +f('DrawSetStrokeColor', NULL, + array('drw_wnd' => Resource, + 'strokecolor_pxl_wnd' => Resource)); + +f('DrawSetStrokeDashArray', NULL, + array('drw_wnd' => Resource, + 'dash_array' => array(VariantVec, 'null_array'))); + +f('DrawSetStrokeDashOffset', NULL, + array('drw_wnd' => Resource, + 'dash_offset' => Double)); + +f('DrawSetStrokeLineCap', NULL, + array('drw_wnd' => Resource, + 'line_cap' => Int32)); + +f('DrawSetStrokeLineJoin', NULL, + array('drw_wnd' => Resource, + 'line_join' => Int32)); + +f('DrawSetStrokeMiterLimit', NULL, + array('drw_wnd' => Resource, + 'miterlimit' => Double)); + +f('DrawSetStrokeOpacity', NULL, + array('drw_wnd' => Resource, + 'stroke_opacity' => Double)); + +f('DrawSetStrokePatternURL', Boolean, + array('drw_wnd' => Resource, + 'stroke_url' => String)); + +f('DrawSetStrokeWidth', NULL, + array('drw_wnd' => Resource, + 'stroke_width' => Double)); + +f('DrawSetTextAlignment', NULL, + array('drw_wnd' => Resource, + 'align_type' => Int32)); + +f('DrawSetTextAntialias', NULL, + array('drw_wnd' => Resource, + 'text_antialias' => array(Boolean, 'true'))); + +f('DrawSetTextDecoration', NULL, + array('drw_wnd' => Resource, + 'decoration_type' => Int32)); + +f('DrawSetTextEncoding', NULL, + array('drw_wnd' => Resource, + 'encoding' => String)); + +f('DrawSetTextUnderColor', NULL, + array('drw_wnd' => Resource, + 'undercolor_pxl_wnd' => Resource)); + +f('DrawSetVectorGraphics', Boolean, + array('drw_wnd' => Resource, + 'vector_graphics' => String)); + +f('DrawSetViewbox', NULL, + array('drw_wnd' => Resource, + 'x1' => Double, + 'y1' => Double, + 'x2' => Double, + 'y2' => Double)); + +f('DrawSkewX', NULL, + array('drw_wnd' => Resource, + 'degrees' => Double)); + +f('DrawSkewY', NULL, + array('drw_wnd' => Resource, + 'degrees' => Double)); + +f('DrawTranslate', NULL, + array('drw_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('PushDrawingWand', NULL, + array('drw_wnd' => Resource)); + +f('DrawPushClipPath', NULL, + array('drw_wnd' => Resource, + 'clip_path_id' => String)); + +f('DrawPushDefs', NULL, + array('drw_wnd' => Resource)); + +f('DrawPushPattern', NULL, + array('drw_wnd' => Resource, + 'pattern_id' => String, + 'x' => Double, + 'y' => Double, + 'width' => Double, + 'height' => Double)); + +f('PopDrawingWand', NULL, + array('drw_wnd' => Resource)); + +f('DrawPopClipPath', NULL, + array('drw_wnd' => Resource)); + +f('DrawPopDefs', NULL, + array('drw_wnd' => Resource)); + +f('DrawPopPattern', NULL, + array('drw_wnd' => Resource)); + +/////////////////////////////////////////////////////////////////////////////// +// Magick Functions + +f('MagickAdaptiveThresholdImage', Boolean, + array('mgck_wnd' => Resource, + 'width' => Double, + 'height' => Double, + 'offset' => Double)); + +f('MagickAddImage', Boolean, + array('mgck_wnd' => Resource, + 'add_wand' => Resource)); + +f('MagickAddNoiseImage', Boolean, + array('mgck_wnd' => Resource, + 'noise_type' => Int32)); + +f('MagickAffineTransformImage', Boolean, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource)); + +f('MagickAnnotateImage', Boolean, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource, + 'x' => Double, + 'y' => Double, + 'angle' => Double, + 'text' => String)); + +f('MagickAppendImages', Resource, + array('mgck_wnd' => Resource, + 'stack_vertical' => array(Boolean, 'false'))); + +f('MagickAverageImages', Resource, + array('mgck_wnd' => Resource)); + +f('MagickBlackThresholdImage', Boolean, + array('mgck_wnd' => Resource, + 'threshold_pxl_wnd' => Resource)); + +f('MagickBlurImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double, + 'sigma' => Double, + 'channel_type' => array(Int32, '0'))); + +f('MagickBorderImage', Boolean, + array('mgck_wnd' => Resource, + 'bordercolor' => Resource, + 'width' => Double, + 'height' => Double)); + +f('MagickCharcoalImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double, + 'sigma' => Double)); + +f('MagickChopImage', Boolean, + array('mgck_wnd' => Resource, + 'width' => Double, + 'height' => Double, + 'x' => Int32, + 'y' => Int32)); + +f('MagickClipImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickClipPathImage', Boolean, + array('mgck_wnd' => Resource, + 'pathname' => String, + 'inside' => Boolean)); + +f('MagickCoalesceImages', Resource, + array('mgck_wnd' => Resource)); + +f('MagickColorFloodfillImage', Boolean, + array('mgck_wnd' => Resource, + 'fillcolor_pxl_wnd' => Resource, + 'fuzz' => Double, + 'bordercolor_pxl_wnd' => Resource, + 'x' => Int32, + 'y' => Int32)); + +f('MagickColorizeImage', Boolean, + array('mgck_wnd' => Resource, + 'colorize' => Resource, + 'opacity_pxl_wnd' => Resource)); + +f('MagickCombineImages', Resource, + array('mgck_wnd' => Resource, + 'channel_type' => Int32)); + +f('MagickCommentImage', Boolean, + array('mgck_wnd' => Resource, + 'comment' => String)); + +f('MagickCompareImages', VariantVec, + array('mgck_wnd' => Resource, + 'reference_wnd' => Resource, + 'metric_type' => Int32, + 'channel_type' => array(Int32, '0'))); + +f('MagickCompositeImage', Boolean, + array('mgck_wnd' => Resource, + 'composite_wnd' => Resource, + 'composite_operator' => Int32, + 'x' => Int32, + 'y' => Int32)); + +f('MagickConstituteImage', Boolean, + array('mgck_wnd' => Resource, + 'columns' => Double, + 'rows' => Double, + 'smap' => String, + 'storage_type' => Int32, + 'pixel_array' => VariantVec)); + +f('MagickContrastImage', Boolean, + array('mgck_wnd' => Resource, + 'sharpen' => Boolean)); + +f('MagickConvolveImage', Boolean, + array('mgck_wnd' => Resource, + 'kernel_array' => VariantVec, + 'channel_type' => array(Int32, '0'))); + +f('MagickCropImage', Boolean, + array('mgck_wnd' => Resource, + 'width' => Double, + 'height' => Double, + 'x' => Int32, + 'y' => Int32)); + +f('MagickCycleColormapImage', Boolean, + array('mgck_wnd' => Resource, + 'num_positions' => Int32)); + +f('MagickDeconstructImages', Resource, + array('mgck_wnd' => Resource)); + +f('MagickDescribeImage', String, + array('mgck_wnd' => Resource)); + +f('MagickDespeckleImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickDrawImage', Boolean, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource)); + +f('MagickEchoImageBlob', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickEchoImagesBlob', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickEdgeImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double)); + +f('MagickEmbossImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double, + 'sigma' => Double)); + +f('MagickEnhanceImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickEqualizeImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickEvaluateImage', Boolean, + array('mgck_wnd' => Resource, + 'evaluate_op' => Int32, + 'constant' => Double, + 'channel_type' => array(Int32, '0'))); + +f('MagickFlattenImages', Resource, + array('mgck_wnd' => Resource)); + +f('MagickFlipImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickFlopImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickFrameImage', Boolean, + array('mgck_wnd' => Resource, + 'matte_color' => Resource, + 'width' => Double, + 'height' => Double, + 'inner_bevel' => Int32, + 'outer_bevel' => Int32)); + +f('MagickFxImage', Resource, + array('mgck_wnd' => Resource, + 'expression' => String, + 'channel_type' => array(Int32, '0'))); + +f('MagickGammaImage', Boolean, + array('mgck_wnd' => Resource, + 'gamma' => Double, + 'channel_type' => array(Int32, '0'))); + +f('MagickGaussianBlurImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double, + 'sigma' => Double, + 'channel_type' => array(Int32, '0'))); + +f('MagickGetCharHeight', Double, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource, + 'txt' => String, + 'multiline' => array(Boolean, 'false'))); + +f('MagickGetCharWidth', Double, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource, + 'txt' => String, + 'multiline' => array(Boolean, 'false'))); + +f('MagickGetException', VariantVec, + array('mgck_wnd' => Resource)); + +f('MagickGetExceptionString', String, + array('mgck_wnd' => Resource)); + +f('MagickGetExceptionType', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetFilename', String, + array('mgck_wnd' => Resource)); + +f('MagickGetFormat', String, + array('mgck_wnd' => Resource)); + +f('MagickGetImage', Resource, + array('mgck_wnd' => Resource)); + +f('MagickGetImageBackgroundColor', Resource, + array('mgck_wnd' => Resource)); + +f('MagickGetImageBlob', String, + array('mgck_wnd' => Resource)); + +f('MagickGetImageBluePrimary', VariantVec, + array('mgck_wnd' => Resource)); + +f('MagickGetImageBorderColor', Resource, + array('mgck_wnd' => Resource)); + +f('MagickGetImageChannelMean', VariantVec, + array('mgck_wnd' => Resource, + 'channel_type' => Int32)); + +f('MagickGetImageColormapColor', Resource, + array('mgck_wnd' => Resource, + 'index' => Double)); + +f('MagickGetImageColors', Double, + array('mgck_wnd' => Resource)); + +f('MagickGetImageColorspace', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageCompose', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageCompression', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageCompressionQuality', Double, + array('mgck_wnd' => Resource)); + +f('MagickGetImageDelay', Double, + array('mgck_wnd' => Resource)); + +f('MagickGetImageDepth', Double, + array('mgck_wnd' => Resource, + 'channel_type' => array(Int32, '0'))); + +f('MagickGetImageDispose', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageExtrema', VariantVec, + array('mgck_wnd' => Resource, + 'channel_type' => array(Int32, '0'))); + +f('MagickGetImageFilename', String, + array('mgck_wnd' => Resource)); + +f('MagickGetImageFormat', String, + array('mgck_wnd' => Resource)); + +f('MagickGetImageGamma', Double, + array('mgck_wnd' => Resource)); + +f('MagickGetImageGreenPrimary', VariantVec, + array('mgck_wnd' => Resource)); + +f('MagickGetImageHeight', Double, + array('mgck_wnd' => Resource)); + +f('MagickGetImageHistogram', VariantVec, + array('mgck_wnd' => Resource)); + +f('MagickGetImageIndex', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageInterlaceScheme', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageIterations', Double, + array('mgck_wnd' => Resource)); + +f('MagickGetImageMatteColor', Resource, + array('mgck_wnd' => Resource)); + +f('MagickGetImageMimeType', String, + array('mgck_wnd' => Resource)); + +f('MagickGetImagePixels', VariantVec, + array('mgck_wnd' => Resource, + 'x_offset' => Int32, + 'y_offset' => Int32, + 'columns' => Double, + 'rows' => Double, + 'smap' => String, + 'storage_type' => Int32)); + +f('MagickGetImageProfile', String, + array('mgck_wnd' => Resource, + 'name' => String)); + +f('MagickGetImageRedPrimary', VariantVec, + array('mgck_wnd' => Resource)); + +f('MagickGetImageRenderingIntent', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageResolution', VariantVec, + array('mgck_wnd' => Resource)); + +f('MagickGetImageScene', Double, + array('mgck_wnd' => Resource)); + +f('MagickGetImageSignature', String, + array('mgck_wnd' => Resource)); + +f('MagickGetImageSize', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageType', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageUnits', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageVirtualPixelMethod', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetImageWhitePoint', VariantVec, + array('mgck_wnd' => Resource)); + +f('MagickGetImageWidth', Double, + array('mgck_wnd' => Resource)); + +f('MagickGetImagesBlob', String, + array('mgck_wnd' => Resource)); + +f('MagickGetInterlaceScheme', Int32, + array('mgck_wnd' => Resource)); + +f('MagickGetMaxTextAdvance', Double, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource, + 'txt' => String, + 'multiline' => array(Boolean, 'false'))); + +f('MagickGetMimeType', String, + array('mgck_wnd' => Resource)); + +f('MagickGetNumberImages', Double, + array('mgck_wnd' => Resource)); + +f('MagickGetSamplingFactors', VariantVec, + array('mgck_wnd' => Resource)); + +f('MagickGetSize', VariantVec, + array('mgck_wnd' => Resource)); + +f('MagickGetStringHeight', Double, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource, + 'txt' => String, + 'multiline' => array(Boolean, 'false'))); + +f('MagickGetStringWidth', Double, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource, + 'txt' => String, + 'multiline' => array(Boolean, 'false'))); + +f('MagickGetTextAscent', Double, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource, + 'txt' => String, + 'multiline' => array(Boolean, 'false'))); + +f('MagickGetTextDescent', Double, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource, + 'txt' => String, + 'multiline' => array(Boolean, 'false'))); + +f('MagickGetWandSize', VariantVec, + array('mgck_wnd' => Resource)); + +f('MagickHasNextImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickHasPreviousImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickImplodeImage', Boolean, + array('mgck_wnd' => Resource, + 'amount' => Double)); + +f('MagickLabelImage', Boolean, + array('mgck_wnd' => Resource, + 'label' => String)); + +f('MagickLevelImage', Boolean, + array('mgck_wnd' => Resource, + 'black_point' => Double, + 'gamma' => Double, + 'white_point' => Double, + 'channel_type' => array(Int32, '0'))); + +f('MagickMagnifyImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickMapImage', Boolean, + array('mgck_wnd' => Resource, + 'map_wand' => Resource, + 'dither' => Boolean)); + +f('MagickMatteFloodfillImage', Boolean, + array('mgck_wnd' => Resource, + 'opacity' => Double, + 'fuzz' => Double, + 'bordercolor_pxl_wnd' => Resource, + 'x' => Int32, + 'y' => Int32)); + +f('MagickMedianFilterImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double)); + +f('MagickMinifyImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickModulateImage', Boolean, + array('mgck_wnd' => Resource, + 'brightness' => Double, + 'saturation' => Double, + 'hue' => Double)); + +f('MagickMontageImage', Resource, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource, + 'tile_geometry' => String, + 'thumbnail_geometry' => String, + 'montage_mode' => Int32, + 'frame' => String)); + +f('MagickMorphImages', Resource, + array('mgck_wnd' => Resource, + 'number_frames' => Double)); + +f('MagickMosaicImages', Resource, + array('mgck_wnd' => Resource)); + +f('MagickMotionBlurImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double, + 'sigma' => Double, + 'angle' => Double)); + +f('MagickNegateImage', Boolean, + array('mgck_wnd' => Resource, + 'only_the_gray' => array(Boolean, 'false'), + 'channel_type' => array(Int32, '0'))); + +f('MagickNewImage', Boolean, + array('mgck_wnd' => Resource, + 'width' => Double, + 'height' => Double, + 'imagemagick_col_str' => array(String, 'null_string'))); + +f('MagickNextImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickNormalizeImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickOilPaintImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double)); + +f('MagickPaintOpaqueImage', Boolean, + array('mgck_wnd' => Resource, + 'target_pxl_wnd' => Resource, + 'fill_pxl_wnd' => Resource, + 'fuzz' => array(Double, '0.0'))); + +f('MagickPaintTransparentImage', Boolean, + array('mgck_wnd' => Resource, + 'target' => Resource, + 'opacity' => array(Double, 'k_MW_TransparentOpacity'), + 'fuzz' => array(Double, '0.0'))); + +f('MagickPingImage', Boolean, + array('mgck_wnd' => Resource, + 'filename' => String)); + +f('MagickPosterizeImage', Boolean, + array('mgck_wnd' => Resource, + 'levels' => Double, + 'dither' => Boolean)); + +f('MagickPreviewImages', Resource, + array('mgck_wnd' => Resource, + 'preview' => Int32)); + +f('MagickPreviousImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickProfileImage', Boolean, + array('mgck_wnd' => Resource, + 'name' => String, + 'profile' => array(String, 'null_string'))); + +f('MagickQuantizeImage', Boolean, + array('mgck_wnd' => Resource, + 'number_colors' => Double, + 'colorspace_type' => Int32, + 'treedepth' => Double, + 'dither' => Boolean, + 'measure_error' => Boolean)); + +f('MagickQuantizeImages', Boolean, + array('mgck_wnd' => Resource, + 'number_colors' => Double, + 'colorspace_type' => Int32, + 'treedepth' => Double, + 'dither' => Boolean, + 'measure_error' => Boolean)); + +f('MagickQueryFontMetrics', VariantVec, + array('mgck_wnd' => Resource, + 'drw_wnd' => Resource, + 'txt' => String, + 'multiline' => array(Boolean, 'false'))); + +f('MagickRadialBlurImage', Boolean, + array('mgck_wnd' => Resource, + 'angle' => Double)); + +f('MagickRaiseImage', Boolean, + array('mgck_wnd' => Resource, + 'width' => Double, + 'height' => Double, + 'x' => Int32, + 'y' => Int32, + 'raise' => Boolean)); + +f('MagickReadImage', Boolean, + array('mgck_wnd' => Resource, + 'filename' => String)); + +f('MagickReadImageBlob', Boolean, + array('mgck_wnd' => Resource, + 'blob' => String)); + +f('MagickReadImageFile', Boolean, + array('mgck_wnd' => Resource, + 'handle' => Resource)); + +f('MagickReadImages', Boolean, + array('mgck_wnd' => Resource, + 'img_filenames_array' => StringVec)); + +f('MagickReduceNoiseImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double)); + +f('MagickRemoveImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickRemoveImageProfile', String, + array('mgck_wnd' => Resource, + 'name' => String)); + +f('MagickRemoveImageProfiles', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickResampleImage', Boolean, + array('mgck_wnd' => Resource, + 'x_resolution' => Double, + 'y_resolution' => Double, + 'filter_type' => Int32, + 'blur' => Double)); + +f('MagickResetIterator', NULL, + array('mgck_wnd' => Resource)); + +f('MagickResizeImage', Boolean, + array('mgck_wnd' => Resource, + 'columns' => Double, + 'rows' => Double, + 'filter_type' => Int32, + 'blur' => Double)); + +f('MagickRollImage', Boolean, + array('mgck_wnd' => Resource, + 'x_offset' => Int32, + 'y_offset' => Int32)); + +f('MagickRotateImage', Boolean, + array('mgck_wnd' => Resource, + 'background' => Resource, + 'degrees' => Double)); + +f('MagickSampleImage', Boolean, + array('mgck_wnd' => Resource, + 'columns' => Double, + 'rows' => Double)); + +f('MagickScaleImage', Boolean, + array('mgck_wnd' => Resource, + 'columns' => Double, + 'rows' => Double)); + +f('MagickSeparateImageChannel', Boolean, + array('mgck_wnd' => Resource, + 'channel_type' => Int32)); + +f('MagickSetCompressionQuality', Boolean, + array('mgck_wnd' => Resource, + 'quality' => Double)); + +f('MagickSetFilename', Boolean, + array('mgck_wnd' => Resource, + 'filename' => array(String, 'null_string'))); + +f('MagickSetFirstIterator', NULL, + array('mgck_wnd' => Resource)); + +f('MagickSetFormat', Boolean, + array('mgck_wnd' => Resource, + 'format' => String)); + +f('MagickSetImage', Boolean, + array('mgck_wnd' => Resource, + 'replace_wand' => Resource)); + +f('MagickSetImageBackgroundColor', Boolean, + array('mgck_wnd' => Resource, + 'background_pxl_wnd' => Resource)); + +f('MagickSetImageBias', Boolean, + array('mgck_wnd' => Resource, + 'bias' => Double)); + +f('MagickSetImageBluePrimary', Boolean, + array('mgck_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('MagickSetImageBorderColor', Boolean, + array('mgck_wnd' => Resource, + 'border_pxl_wnd' => Resource)); + +f('MagickSetImageColormapColor', Boolean, + array('mgck_wnd' => Resource, + 'index' => Double, + 'mapcolor_pxl_wnd' => Resource)); + +f('MagickSetImageColorspace', Boolean, + array('mgck_wnd' => Resource, + 'colorspace_type' => Int32)); + +f('MagickSetImageCompose', Boolean, + array('mgck_wnd' => Resource, + 'composite_operator' => Int32)); + +f('MagickSetImageCompression', Boolean, + array('mgck_wnd' => Resource, + 'compression_type' => Int32)); + +f('MagickSetImageCompressionQuality', Boolean, + array('mgck_wnd' => Resource, + 'quality' => Double)); + +f('MagickSetImageDelay', Boolean, + array('mgck_wnd' => Resource, + 'delay' => Double)); + +f('MagickSetImageDepth', Boolean, + array('mgck_wnd' => Resource, + 'depth' => Int32, + 'channel_type' => array(Int32, '0'))); + +f('MagickSetImageDispose', Boolean, + array('mgck_wnd' => Resource, + 'dispose_type' => Int32)); + +f('MagickSetImageFilename', Boolean, + array('mgck_wnd' => Resource, + 'filename' => array(String, 'null_string'))); + +f('MagickSetImageFormat', Boolean, + array('mgck_wnd' => Resource, + 'format' => String)); + +f('MagickSetImageGamma', Boolean, + array('mgck_wnd' => Resource, + 'gamma' => Double)); + +f('MagickSetImageGreenPrimary', Boolean, + array('mgck_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('MagickSetImageIndex', Boolean, + array('mgck_wnd' => Resource, + 'index' => Int32)); + +f('MagickSetImageInterlaceScheme', Boolean, + array('mgck_wnd' => Resource, + 'interlace_type' => Int32)); + +f('MagickSetImageIterations', Boolean, + array('mgck_wnd' => Resource, + 'iterations' => Double)); + +f('MagickSetImageMatteColor', Boolean, + array('mgck_wnd' => Resource, + 'matte_pxl_wnd' => Resource)); + +f('MagickSetImageOption', Boolean, + array('mgck_wnd' => Resource, + 'format' => String, + 'key' => String, + 'value' => String)); + +f('MagickSetImagePixels', Boolean, + array('mgck_wnd' => Resource, + 'x_offset' => Int32, + 'y_offset' => Int32, + 'columns' => Double, + 'rows' => Double, + 'smap' => String, + 'storage_type' => Int32, + 'pixel_array' => VariantVec)); + +f('MagickSetImageProfile', Boolean, + array('mgck_wnd' => Resource, + 'name' => String, + 'profile' => String)); + +f('MagickSetImageRedPrimary', Boolean, + array('mgck_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('MagickSetImageRenderingIntent', Boolean, + array('mgck_wnd' => Resource, + 'rendering_intent' => Int32)); + +f('MagickSetImageResolution', Boolean, + array('mgck_wnd' => Resource, + 'x_resolution' => Double, + 'y_resolution' => Double)); + +f('MagickSetImageScene', Boolean, + array('mgck_wnd' => Resource, + 'scene' => Double)); + +f('MagickSetImageType', Boolean, + array('mgck_wnd' => Resource, + 'image_type' => Int32)); + +f('MagickSetImageUnits', Boolean, + array('mgck_wnd' => Resource, + 'resolution_type' => Int32)); + +f('MagickSetImageVirtualPixelMethod', Boolean, + array('mgck_wnd' => Resource, + 'virtual_pixel_method' => Int32)); + +f('MagickSetImageWhitePoint', Boolean, + array('mgck_wnd' => Resource, + 'x' => Double, + 'y' => Double)); + +f('MagickSetInterlaceScheme', Boolean, + array('mgck_wnd' => Resource, + 'interlace_type' => Int32)); + +f('MagickSetLastIterator', NULL, + array('mgck_wnd' => Resource)); + +f('MagickSetPassphrase', Boolean, + array('mgck_wnd' => Resource, + 'passphrase' => String)); + +f('MagickSetResolution', Boolean, + array('mgck_wnd' => Resource, + 'x_resolution' => Double, + 'y_resolution' => Double)); + +f('MagickSetSamplingFactors', Boolean, + array('mgck_wnd' => Resource, + 'number_factors' => Double, + 'sampling_factors' => VariantVec)); + +f('MagickSetSize', Boolean, + array('mgck_wnd' => Resource, + 'columns' => Int32, + 'rows' => Int32)); + +f('MagickSetWandSize', Boolean, + array('mgck_wnd' => Resource, + 'columns' => Int32, + 'rows' => Int32)); + +f('MagickSharpenImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double, + 'sigma' => Double, + 'channel_type' => array(Int32, '0'))); + +f('MagickShaveImage', Boolean, + array('mgck_wnd' => Resource, + 'columns' => Int32, + 'rows' => Int32)); + +f('MagickShearImage', Boolean, + array('mgck_wnd' => Resource, + 'background' => Resource, + 'x_shear' => Double, + 'y_shear' => Double)); + +f('MagickSolarizeImage', Boolean, + array('mgck_wnd' => Resource, + 'threshold' => Double)); + +f('MagickSpliceImage', Boolean, + array('mgck_wnd' => Resource, + 'width' => Double, + 'height' => Double, + 'x' => Int32, + 'y' => Int32)); + +f('MagickSpreadImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double)); + +f('MagickSteganoImage', Resource, + array('mgck_wnd' => Resource, + 'watermark_wand' => Resource, + 'offset' => Int32)); + +f('MagickStereoImage', Boolean, + array('mgck_wnd' => Resource, + 'offset_wand' => Resource)); + +f('MagickStripImage', Boolean, + array('mgck_wnd' => Resource)); + +f('MagickSwirlImage', Boolean, + array('mgck_wnd' => Resource, + 'degrees' => Double)); + +f('MagickTextureImage', Resource, + array('mgck_wnd' => Resource, + 'texture_wand' => Resource)); + +f('MagickThresholdImage', Boolean, + array('mgck_wnd' => Resource, + 'threshold' => Double, + 'channel_type' => array(Int32, '0'))); + +f('MagickTintImage', Boolean, + array('mgck_wnd' => Resource, + 'tint_pxl_wnd' => Int32, + 'opacity_pxl_wnd' => Resource)); + +f('MagickTransformImage', Resource, + array('mgck_wnd' => Resource, + 'crop' => String, + 'geometry' => String)); + +f('MagickTrimImage', Boolean, + array('mgck_wnd' => Resource, + 'fuzz' => Double)); + +f('MagickUnsharpMaskImage', Boolean, + array('mgck_wnd' => Resource, + 'radius' => Double, + 'sigma' => Double, + 'amount' => Double, + 'threshold' => Double, + 'channel_type' => array(Int32, '0'))); + +f('MagickWaveImage', Boolean, + array('mgck_wnd' => Resource, + 'amplitude' => Double, + 'wave_length' => Double)); + +f('MagickWhiteThresholdImage', Boolean, + array('mgck_wnd' => Resource, + 'threshold_pxl_wnd' => Resource)); + +f('MagickWriteImage', Boolean, + array('mgck_wnd' => Resource, + 'filename' => String)); + +f('MagickWriteImageFile', Boolean, + array('mgck_wnd' => Resource, + 'handle' => Resource)); + +f('MagickWriteImages', Boolean, + array('mgck_wnd' => Resource, + 'filename' => array(String, '""'), + 'join_images' => array(Boolean, 'false'))); + +f('MagickWriteImagesFile', Boolean, + array('mgck_wnd' => Resource, + 'handle' => Resource)); + +/////////////////////////////////////////////////////////////////////////////// +// Pixel Functions + +f('PixelGetAlpha', Double, array('pxl_wnd' => Resource)); +f('PixelGetAlphaQuantum', Double, array('pxl_wnd' => Resource)); +f('PixelGetBlack', Double, array('pxl_wnd' => Resource)); +f('PixelGetBlackQuantum', Double, array('pxl_wnd' => Resource)); +f('PixelGetBlue', Double, array('pxl_wnd' => Resource)); +f('PixelGetBlueQuantum', Double, array('pxl_wnd' => Resource)); +f('PixelGetColorAsString', String, array('pxl_wnd' => Resource)); +f('PixelGetColorCount', Double, array('pxl_wnd' => Resource)); +f('PixelGetCyan', Double, array('pxl_wnd' => Resource)); +f('PixelGetCyanQuantum', Double, array('pxl_wnd' => Resource)); +f('PixelGetException', VariantVec, array('pxl_wnd' => Resource)); +f('PixelGetExceptionString', String, array('pxl_wnd' => Resource)); +f('PixelGetExceptionType', Int32, array('pxl_wnd' => Resource)); +f('PixelGetGreen', Double, array('pxl_wnd' => Resource)); +f('PixelGetGreenQuantum', Double, array('pxl_wnd' => Resource)); +f('PixelGetIndex', Double, array('pxl_wnd' => Resource)); +f('PixelGetMagenta', Double, array('pxl_wnd' => Resource)); +f('PixelGetMagentaQuantum', Double, array('pxl_wnd' => Resource)); +f('PixelGetOpacity', Double, array('pxl_wnd' => Resource)); +f('PixelGetOpacityQuantum', Double, array('pxl_wnd' => Resource)); +f('PixelGetQuantumColor', VariantMap, array('pxl_wnd' => Resource)); +f('PixelGetRed', Double, array('pxl_wnd' => Resource)); +f('PixelGetRedQuantum', Double, array('pxl_wnd' => Resource)); +f('PixelGetYellow', Double, array('pxl_wnd' => Resource)); +f('PixelGetYellowQuantum', Double, array('pxl_wnd' => Resource)); + +f('PixelSetAlpha', NULL, + array('pxl_wnd' => Resource, + 'alpha' => Double)); + +f('PixelSetAlphaQuantum', NULL, + array('pxl_wnd' => Resource, + 'alpha' => Double)); + +f('PixelSetBlack', NULL, + array('pxl_wnd' => Resource, + 'black' => Double)); + +f('PixelSetBlackQuantum', NULL, + array('pxl_wnd' => Resource, + 'black' => Double)); + +f('PixelSetBlue', NULL, + array('pxl_wnd' => Resource, + 'blue' => Double)); + +f('PixelSetBlueQuantum', NULL, + array('pxl_wnd' => Resource, + 'blue' => Double)); + +f('PixelSetColor', NULL, + array('pxl_wnd' => Resource, + 'imagemagick_col_str' => String)); + +f('PixelSetColorCount', NULL, + array('pxl_wnd' => Resource, + 'count' => Int32)); + +f('PixelSetCyan', NULL, + array('pxl_wnd' => Resource, + 'cyan' => Double)); + +f('PixelSetCyanQuantum', NULL, + array('pxl_wnd' => Resource, + 'cyan' => Double)); + +f('PixelSetGreen', NULL, + array('pxl_wnd' => Resource, + 'green' => Double)); + +f('PixelSetGreenQuantum', NULL, + array('pxl_wnd' => Resource, + 'green' => Double)); + +f('PixelSetIndex', NULL, + array('pxl_wnd' => Resource, + 'index' => Double)); + +f('PixelSetMagenta', NULL, + array('pxl_wnd' => Resource, + 'magenta' => Double)); + +f('PixelSetMagentaQuantum', NULL, + array('pxl_wnd' => Resource, + 'magenta' => Double)); + +f('PixelSetOpacity', NULL, + array('pxl_wnd' => Resource, + 'opacity' => Double)); + +f('PixelSetOpacityQuantum', NULL, + array('pxl_wnd' => Resource, + 'opacity' => Double)); + +f('PixelSetQuantumColor', NULL, + array('pxl_wnd' => Resource, + 'red' => Double, + 'green' => Double, + 'blue' => Double, + 'opacity' => array(Double, '0.0'))); + +f('PixelSetRed', NULL, + array('pxl_wnd' => Resource, + 'red' => Double)); + +f('PixelSetRedQuantum', NULL, + array('pxl_wnd' => Resource, + 'red' => Double)); + +f('PixelSetYellow', NULL, + array('pxl_wnd' => Resource, + 'yellow' => Double)); + +f('PixelSetYellowQuantum', NULL, + array('pxl_wnd' => Resource, + 'yellow' => Double)); + +/////////////////////////////////////////////////////////////////////////////// +// Pixel Iterator Functions + +f('PixelGetIteratorException', VariantVec, + array('pxl_iter' => Resource)); +f('PixelGetIteratorExceptionString', String, + array('pxl_iter' => Resource)); +f('PixelGetIteratorExceptionType', Int32, + array('pxl_iter' => Resource)); +f('PixelGetNextIteratorRow', VariantVec, + array('pxl_iter' => Resource)); +f('PixelResetIterator', NULL, + array('pxl_iter' => Resource)); +f('PixelSetIteratorRow', Boolean, + array('pxl_iter' => Resource, + 'row' => Int32)); +f('PixelSyncIterator', Boolean, + array('pxl_iter' => Resource)); diff --git a/src/idl/mailparse.idl.php b/src/idl/mailparse.idl.php new file mode 100644 index 0000000000000..ff3d51f66f5cc --- /dev/null +++ b/src/idl/mailparse.idl.php @@ -0,0 +1,70 @@ + String, + 'subject' => String, + 'message' => String, + 'additional_headers' => array(String, 'null_string'), + 'additional_parameters' => array(String, 'null_string'))); + +f('ezmlm_hash', Int32, + array('addr' => String)); + +/////////////////////////////////////////////////////////////////////////////// +// mailparse + +f('mailparse_msg_create', Resource); + +f('mailparse_msg_free', Boolean, + array('mimemail' => Resource)); + +f('mailparse_msg_parse_file', Resource, + array('filename' => String)); + +f('mailparse_msg_parse', Boolean, + array('mimemail' => Resource, + 'data' => String)); + +f('mailparse_msg_extract_part_file', String, + array('mimemail' => Resource, + 'filename' => String, + 'callbackfunc' => array(String, 'null_string'))); + +f('mailparse_msg_extract_whole_part_file', String, + array('mimemail' => Resource, + 'filename' => String, + 'callbackfunc' => array(String, 'null_string'))); + +f('mailparse_msg_extract_part', NULL, + array('mimemail' => Resource, + 'msgbody' => String, + 'callbackfunc' => array(String, 'null_string'))); + +f('mailparse_msg_get_part_data', VariantMap, + array('mimemail' => Resource)); + +f('mailparse_msg_get_part', Resource, + array('mimemail' => Resource, + 'mimesection' => String)); + +f('mailparse_msg_get_structure', VariantMap, + array('mimemail' => Resource)); + +f('mailparse_rfc822_parse_addresses', StringVec, + array('addresses' => String)); + +f('mailparse_stream_encode', Boolean, + array('sourcefp' => Resource, + 'destfp' => Resource, + 'encoding' => String)); + +f('mailparse_uudecode_all', StringVec, + array('fp' => Resource)); + +f('mailparse_determine_best_xfer_encoding', String, + array('fp' => Resource)); diff --git a/src/idl/math.idl.php b/src/idl/math.idl.php new file mode 100644 index 0000000000000..615020743aee7 --- /dev/null +++ b/src/idl/math.idl.php @@ -0,0 +1,79 @@ + Variant), VariableArguments); +f('max', Variant, array('value' => Variant), VariableArguments); +f('abs', Variant, array('number' => Variant)); +f('is_finite', Boolean, array('val' => Double)); +f('is_infinite', Boolean, array('val' => Double)); +f('is_nan', Boolean, array('val' => Double)); + +f('ceil', Double, array('value' => Double)); +f('floor', Double, array('value' => Double)); +f('round', Double, array('val' => Variant, + 'precision' => array(Int64, '0'))); +f('deg2rad', Double, array('number' => Double)); +f('rad2deg', Double, array('number' => Double)); +f('decbin', String, array('number' => Int64)); +f('dechex', String, array('number' => Int64)); +f('decoct', String, array('number' => Int64)); +f('bindec', Variant, array('binary_string' => String)); +f('hexdec', Variant, array('hex_string' => String)); +f('octdec', Variant, array('octal_string' => String)); + +f('base_convert', String, + array('number' => String, + 'frombase' => Int64, + 'tobase' => Int64)); + +f('pow', Numeric, array('base' => Variant, 'exp' => Variant)); +f('exp', Double, array('arg' => Double)); +f('expm1', Double, array('arg' => Double)); +f('log10', Double, array('arg' => Double)); +f('log1p', Double, array('number' => Double)); +f('log', Double, array('arg' => Double, 'base' => array(Double, '0'))); + +f('cos', Double, array('arg' => Double)); +f('cosh', Double, array('arg' => Double)); +f('sin', Double, array('arg' => Double)); +f('sinh', Double, array('arg' => Double)); +f('tan', Double, array('arg' => Double)); +f('tanh', Double, array('arg' => Double)); +f('acos', Double, array('arg' => Double)); +f('acosh', Double, array('arg' => Double)); +f('asin', Double, array('arg' => Double)); +f('asinh', Double, array('arg' => Double)); +f('atan', Double, array('arg' => Double)); +f('atanh', Double, array('arg' => Double)); +f('atan2', Double, array('y' => Double, 'x' => Double)); +f('hypot', Double, array('x' => Double, 'y' => Double)); +f('fmod', Double, array('x' => Double, 'y' => Double)); +f('sqrt', Double, array('arg' => Double)); + +/////////////////////////////////////////////////////////////////////////////// +// randomization + +f('getrandmax', Int64); + +f('srand', Null, + array('seed' => array(Variant, 'null_variant'))); + +f('rand', Int64, + array('min' => array(Int64, '0'), + 'max' => array(Int64, 'RAND_MAX'))); + +f('mt_getrandmax', Int64); + +f('mt_srand', Null, + array('seed' => array(Variant, 'null_variant'))); + +f('mt_rand', Int64, + array('min' => array(Int64, '0'), + 'max' => array(Int64, 'RAND_MAX'))); + +f('lcg_value', Double); diff --git a/src/idl/mb.idl.php b/src/idl/mb.idl.php new file mode 100644 index 0000000000000..b0056d1e755bf --- /dev/null +++ b/src/idl/mb.idl.php @@ -0,0 +1,253 @@ + array(String, 'null_string'))); + +f('mb_list_mime_names', Variant, + array('name' => array(String, 'null_string'))); + +f('mb_check_encoding', Boolean, + array('var' => array(String, 'null_string'), + 'encoding' => array(String, 'null_string'))); + +f('mb_convert_case', Variant, + array('str' => String, + 'mode' => Int32, + 'encoding' => array(String, 'null_string'))); + +f('mb_convert_encoding', Variant, + array('str' => String, + 'to_encoding' => String, + 'from_encoding' => array(Variant, 'null_variant'))); + +f('mb_convert_kana', Variant, + array('str' => String, + 'option' => array(String, 'null_string'), + 'encoding' => array(String, 'null_string'))); + +f('mb_convert_variables', Variant, + array('to_encoding' => String, + 'from_encoding' => Variant, + 'vars' => Variant | Reference), + VariableArguments); + +f('mb_decode_mimeheader', Variant, + array('str' => String)); + +f('mb_decode_numericentity', Variant, + array('str' => String, + 'convmap' => Variant, + 'encoding' => array(String, 'null_string'))); + +f('mb_detect_encoding', Variant, + array('str' => String, + 'encoding_list' => array(Variant, 'null_variant'), + 'strict' => array(Variant, 'null_variant'))); + +f('mb_detect_order', Variant, + array('encoding_list' => array(Variant, 'null_variant'))); + +f('mb_encode_mimeheader', Variant, + array('str' => String, + 'charset' => array(String, 'null_string'), + 'transfer_encoding' => array(String, 'null_string'), + 'linefeed' => array(String, '"\r\n"'), + 'indent' => array(Int32, '0'))); + +f('mb_encode_numericentity', Variant, + array('str' => String, + 'convmap' => Variant, + 'encoding' => array(String, 'null_string'))); + +f('mb_ereg_match', Boolean, + array('pattern' => String, + 'str' => String, + 'option' => array(String, 'null_string'))); + +f('mb_ereg_replace', Variant, + array('pattern' => Variant, + 'replacement' => String, + 'str' => String, + 'option' => array(String, 'null_string'))); + +f('mb_ereg_search_getpos', Int32); + +f('mb_ereg_search_getregs', Variant); + +f('mb_ereg_search_init', Boolean, + array('str' => String, + 'pattern' => array(String, 'null_string'), + 'option' => array(String, 'null_string'))); + +f('mb_ereg_search_pos', Variant, + array('pattern' => array(String, 'null_string'), + 'option' => array(String, 'null_string'))); + +f('mb_ereg_search_regs', Variant, + array('pattern' => array(String, 'null_string'), + 'option' => array(String, 'null_string'))); + +f('mb_ereg_search_setpos', Boolean, + array('position' => Int32)); + +f('mb_ereg_search', Variant, + array('pattern' => array(String, 'null_string'), + 'option' => array(String, 'null_string'))); + +f('mb_ereg', Variant, + array('pattern' => Variant, + 'str' => String, + 'regs' => array(Variant | Reference, 'null'))); + +f('mb_eregi_replace', Variant, + array('pattern' => Variant, + 'replacement' => String, + 'str' => String, + 'option' => array(String, 'null_string'))); + +f('mb_eregi', Variant, + array('pattern' => Variant, + 'str' => String, + 'regs' => array(Variant | Reference, 'null'))); + +f('mb_get_info', Variant, + array('type' => array(String, 'null_string'))); + +f('mb_http_input', Variant, + array('type' => array(String, 'null_string'))); + +f('mb_http_output', Variant, + array('encoding' => array(String, 'null_string'))); + +f('mb_internal_encoding', Variant, + array('encoding' => array(String, 'null_string'))); + +f('mb_language', Variant, + array('language' => array(String, 'null_string'))); + +f('mb_output_handler', String, + array('contents' => String, + 'status' => Int32)); + +f('mb_parse_str', Boolean, + array('encoded_string' => String, + 'result' => array(StringVec | Reference, 'null'))); + +f('mb_preferred_mime_name', Variant, + array('encoding' => String)); + +f('mb_regex_encoding', Variant, + array('encoding' => array(String, 'null_string'))); + +f('mb_regex_set_options', String, + array('options' => array(String, 'null_string'))); + +f('mb_send_mail', Boolean, + array('to' => String, + 'subject' => String, + 'message' => String, + 'headers' => array(String, 'null_string'), + 'extra_cmd' => array(String, 'null_string'))); + +f('mb_split', Variant, + array('pattern' => String, + 'str' => String, + 'count' => array(Int32, '-1'))); + +f('mb_strcut', Variant, + array('str' => String, + 'start' => Int32, + 'length' => array(Int32, '0x7FFFFFFF'), + 'encoding' => array(String, 'null_string'))); + +f('mb_strimwidth', Variant, + array('str' => String, + 'start' => Int32, + 'width' => Int32, + 'trimmarker' => array(String, 'null_string'), + 'encoding' => array(String, 'null_string'))); + +f('mb_stripos', Variant, + array('haystack' => String, + 'needle' => String, + 'offset' => array(Int32, '0'), + 'encoding' => array(String, 'null_string'))); + +f('mb_stristr', Variant, + array('haystack' => String, + 'needle' => String, + 'part' => array(Boolean, 'false'), + 'encoding' => array(String, 'null_string'))); + +f('mb_strlen', Variant, + array('str' => String, + 'encoding' => array(String, 'null_string'))); + +f('mb_strpos', Variant, + array('haystack' => String, + 'needle' => String, + 'offset' => array(Int32, '0'), + 'encoding' => array(String, 'null_string'))); + +f('mb_strrchr', Variant, + array('haystack' => String, + 'needle' => String, + 'part' => array(Boolean, 'false'), + 'encoding' => array(String, 'null_string'))); + +f('mb_strrichr', Variant, + array('haystack' => String, + 'needle' => String, + 'part' => array(Boolean, 'false'), + 'encoding' => array(String, 'null_string'))); + +f('mb_strripos', Variant, + array('haystack' => String, + 'needle' => String, + 'offset' => array(Int32, '0'), + 'encoding' => array(String, 'null_string'))); + +f('mb_strrpos', Variant, + array('haystack' => String, + 'needle' => String, + 'offset' => array(Variant, '0LL'), + 'encoding' => array(String, 'null_string'))); + +f('mb_strstr', Variant, + array('haystack' => String, + 'needle' => String, + 'part' => array(Boolean, 'false'), + 'encoding' => array(String, 'null_string'))); + +f('mb_strtolower', Variant, + array('str' => String, + 'encoding' => array(String, 'null_string'))); + +f('mb_strtoupper', Variant, + array('str' => String, + 'encoding' => array(String, 'null_string'))); + +f('mb_strwidth', Variant, + array('str' => String, + 'encoding' => array(String, 'null_string'))); + +f('mb_substitute_character', Variant, + array('substrchar' => array(Variant, 'null_variant'))); + +f('mb_substr_count', Variant, + array('haystack' => String, + 'needle' => String, + 'encoding' => array(String, 'null_string'))); + +f('mb_substr', Variant, + array('str' => String, + 'start' => Int32, + 'length' => array(Int32, '0x7FFFFFFF'), + 'encoding' => array(String, 'null_string'))); diff --git a/src/idl/mcrypt.idl.php b/src/idl/mcrypt.idl.php new file mode 100644 index 0000000000000..b69f87af398bd --- /dev/null +++ b/src/idl/mcrypt.idl.php @@ -0,0 +1,141 @@ + String, + 'algorithm_directory' => String, + 'mode' => String, + 'mode_directory' => String)); + +f('mcrypt_module_close', Boolean, + array('td' => Resource)); + +f('mcrypt_list_algorithms', StringVec, + array('lib_dir' => array(String, 'null_string'))); + +f('mcrypt_list_modes', StringVec, + array('lib_dir' => array(String, 'null_string'))); + +f('mcrypt_module_get_algo_block_size', Int32, + array('algorithm' => String, + 'lib_dir' => array(String, 'null_string'))); + +f('mcrypt_module_get_algo_key_size', Int32, + array('algorithm' => String, + 'lib_dir' => array(String, 'null_string'))); + +f('mcrypt_module_get_supported_key_sizes', Int64Vec, + array('algorithm' => String, + 'lib_dir' => array(String, 'null_string'))); + +f('mcrypt_module_is_block_algorithm_mode', Boolean, + array('mode' => String, + 'lib_dir' => array(String, 'null_string'))); + +f('mcrypt_module_is_block_algorithm', Boolean, + array('algorithm' => String, + 'lib_dir' => array(String, 'null_string'))); + +f('mcrypt_module_is_block_mode', Boolean, + array('mode' => String, + 'lib_dir' => array(String, 'null_string'))); + +f('mcrypt_module_self_test', Boolean, + array('algorithm' => String, + 'lib_dir' => array(String, 'null_string'))); + +f('mcrypt_create_iv', Variant, + array('size' => Int32, + 'source' => array(Int32, '0'))); + +f('mcrypt_encrypt', Variant, + array('cipher' => String, + 'key' => String, + 'data' => String, + 'mode' => String, + 'iv' => array(String, 'null_string'))); + +f('mcrypt_decrypt', Variant, + array('cipher' => String, + 'key' => String, + 'data' => String, + 'mode' => String, + 'iv' => array(String, 'null_string'))); + +f('mcrypt_cbc', Variant, + array('cipher' => String, + 'key' => String, + 'data' => String, + 'mode' => Int32, + 'iv' => array(String, 'null_string'))); + +f('mcrypt_cfb', Variant, + array('cipher' => String, + 'key' => String, + 'data' => String, + 'mode' => Int32, + 'iv' => array(String, 'null_string'))); + +f('mcrypt_ecb', Variant, + array('cipher' => String, + 'key' => String, + 'data' => String, + 'mode' => Int32, + 'iv' => array(String, 'null_string'))); + +f('mcrypt_ofb', Variant, + array('cipher' => String, + 'key' => String, + 'data' => String, + 'mode' => Int32, + 'iv' => array(String, 'null_string'))); + +f('mcrypt_get_block_size', Variant, + array('cipher' => String, + 'module' => array(String, 'null_string'))); + +f('mcrypt_get_cipher_name', Variant, + array('cipher' => String)); + +f('mcrypt_get_iv_size', Variant, + array('cipher' => String, + 'mode' => String)); + +f('mcrypt_get_key_size', Int32, + array('cipher' => String, + 'module' => String)); + +f('mcrypt_enc_get_algorithms_name', String, array('td' => Resource)); +f('mcrypt_enc_get_block_size', Int32, array('td' => Resource)); +f('mcrypt_enc_get_iv_size', Int32, array('td' => Resource)); +f('mcrypt_enc_get_key_size', Int32, array('td' => Resource)); +f('mcrypt_enc_get_modes_name', String, array('td' => Resource)); +f('mcrypt_enc_get_supported_key_sizes', Int64Vec, array('td' => Resource)); +f('mcrypt_enc_is_block_algorithm_mode', Boolean, array('td' => Resource)); +f('mcrypt_enc_is_block_algorithm', Boolean, array('td' => Resource)); +f('mcrypt_enc_is_block_mode', Boolean, array('td' => Resource)); +f('mcrypt_enc_self_test', Int32, array('td' => Resource)); + +f('mcrypt_generic', Variant, + array('td' => Resource, + 'data' => String)); + +f('mcrypt_generic_init', Int32, + array('td' => Resource, + 'key' => String, + 'iv' => String)); + +f('mdecrypt_generic', Variant, + array('td' => Resource, + 'data' => String)); + +f('mcrypt_generic_deinit', Boolean, + array('td' => Resource)); + +f('mcrypt_generic_end', Boolean, + array('td' => Resource)); + + diff --git a/src/idl/misc.idl.php b/src/idl/misc.idl.php new file mode 100644 index 0000000000000..47468e6469e6d --- /dev/null +++ b/src/idl/misc.idl.php @@ -0,0 +1,92 @@ + String)); + +f('define', Boolean, + array('name' => String, + 'value' => Variant, + 'case_insensitive' => array(Boolean, 'false'))); + +f('defined', Boolean, + array('name' => String)); + +f('die', Variant, + array('status' => array(Variant, 'null_variant'))); + +f('exit', Variant, + array('status' => array(Variant, 'null_variant'))); + +f('eval', Variant, + array('code_str' => String)); + +f('get_browser', Variant, + array('user_agent' => array(String, 'null_string'), + 'return_array' => array(Boolean, 'false'))); + +f('__halt_compiler'); + +f('highlight_file', Variant, + array('filename' => String, + 'ret' => array(Boolean, 'false'))); + +f('show_source', Variant, + array('filename' => String, + 'ret' => array(Boolean, 'false'))); + +f('highlight_string', Variant, + array('str' => String, + 'ret' => array(Boolean, 'false'))); + +f('ignore_user_abort', Int32, + array('setting' => array(Boolean, 'false'))); + +f('pack', String, + array('format' => String), + VariableArguments); + +f('php_check_syntax', Boolean, + array('filename' => String, + 'error_message' => array(String | Reference, 'null'))); + +f('php_strip_whitespace', String, + array('filename' => String)); + +f('sleep', Int32, + array('seconds' => Int32)); + +f('usleep', NULL, + array('micro_seconds' => Int32)); + +f('time_nanosleep', Variant, + array('seconds' => Int32, + 'nanoseconds' => Int32)); + +f('time_sleep_until', Boolean, + array('timestamp' => Double)); + +f('uniqid', String, + array('prefix' => array(String, 'null_string'), + 'more_entropy' => array(Boolean, 'false'))); + +f('unpack', VariantMap, + array('format' => String, + 'data' => String)); + +f('sys_getloadavg', VariantMap); + +f('token_get_all', VariantMap, + array('source' => String)); + +f('token_name', String, + array('token' => Int64)); + + diff --git a/src/idl/mysql.idl.php b/src/idl/mysql.idl.php new file mode 100644 index 0000000000000..38c1c6811d85b --- /dev/null +++ b/src/idl/mysql.idl.php @@ -0,0 +1,203 @@ + array(String, 'null_string'), + 'username' => array(String, 'null_string'), + 'password' => array(String, 'null_string'), + 'new_link' => array(Boolean, 'false'), + 'client_flags' => array(Int32, '0'), + 'connect_timeout_ms' => array(Int32, '-1'), + 'query_timeout_ms' => array(Int32, '-1'))); + +f('mysql_pconnect', Variant, + array('server' => array(String, 'null_string'), + 'username' => array(String, 'null_string'), + 'password' => array(String, 'null_string'), + 'client_flags' => array(Int32, '0'), + 'connect_timeout_ms' => array(Int32, '-1'), + 'query_timeout_ms' => array(Int32, '-1'))); + +f('mysql_set_charset', Variant, + array('charset' => String, + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_ping', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_escape_string', String, + array('unescaped_string' => String)); + +f('mysql_real_escape_string', Variant, + array('unescaped_string' => String, + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_client_encoding', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_close', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_errno', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_error', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_get_client_info', String); + +f('mysql_get_host_info', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_get_proto_info', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_get_server_info', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_info', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_insert_id', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_stat', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_thread_id', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_create_db', Variant, + array('db' => String, + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_select_db', Variant, + array('db' => String, + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_drop_db', Variant, + array('db' => String, + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_affected_rows', Variant, + array('link_identifier' => array(Variant, 'null'))); + +/////////////////////////////////////////////////////////////////////////////// +// query functions + +f('mysql_set_timeout', Boolean, + array('query_timeout_ms' => array(Int32, '-1'), + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_query', Variant, + array('query' => String, + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_unbuffered_query', Variant, + array('query' => String, + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_db_query', Variant, + array('database' => String, + 'query' => String, + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_list_dbs', Variant, + array('link_identifier' => array(Variant, 'null'))); + +f('mysql_list_tables', Variant, + array('database' => String, + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_list_fields', Variant, + array('database_name' => String, + 'table_name' => String, + 'link_identifier' => array(Variant, 'null'))); + +f('mysql_list_processes', Variant, + array('link_identifier' => array(Variant, 'null'))); + +/////////////////////////////////////////////////////////////////////////////// +// result functions + +f('mysql_db_name', Variant, + array('result' => Variant, + 'row' => Int32, + 'field' => array(Variant, 'null_variant'))); + +f('mysql_tablename', Variant, + array('result' => Variant, + 'i' => Int32)); + +f('mysql_num_fields', Variant, + array('result' => Variant)); + +f('mysql_num_rows', Variant, + array('result' => Variant)); + +f('mysql_free_result', Variant, + array('result' => Variant)); + +/////////////////////////////////////////////////////////////////////////////// +// row operations + +f('mysql_data_seek', Boolean, + array('result' => Variant, + 'row' => Int32)); + +f('mysql_fetch_row', Variant, + array('result' => Variant)); + +f('mysql_fetch_assoc', Variant, + array('result' => Variant)); + +f('mysql_fetch_array', Variant, + array('result' => Variant, + 'result_type' => array(Int32, '3'))); + +f('mysql_fetch_lengths', Variant, + array('result' => Variant)); + +f('mysql_fetch_object', Variant, + array('result' => Variant, + 'class_name' => array(String, '"stdClass"'), + 'params' => array(VariantVec, 'null'))); + +f('mysql_result', Variant, + array('result' => Variant, + 'row' => Int32, + 'field' => array(Variant, 'null_variant'))); + +/////////////////////////////////////////////////////////////////////////////// +// field info + +f('mysql_fetch_field', Variant, + array('result' => Variant, + 'field' => array(Int32, '-1'))); + +f('mysql_field_seek', Boolean, + array('result' => Variant, + 'field' => array(Int32, '0'))); + +f('mysql_field_name', Variant, + array('result' => Variant, + 'field' => array(Int32, '0'))); + +f('mysql_field_table', Variant, + array('result' => Variant, + 'field' => array(Int32, '0'))); + +f('mysql_field_len', Variant, + array('result' => Variant, + 'field' => array(Int32, '0'))); + +f('mysql_field_type', Variant, + array('result' => Variant, + 'field' => array(Int32, '0'))); + +f('mysql_field_flags', Variant, + array('result' => Variant, + 'field' => array(Int32, '0'))); diff --git a/src/idl/network.idl.php b/src/idl/network.idl.php new file mode 100644 index 0000000000000..e058ec022442c --- /dev/null +++ b/src/idl/network.idl.php @@ -0,0 +1,142 @@ + String)); + +f('gethostbyname', String, + array('hostname' => String)); + +f('gethostbynamel', Variant, + array('hostname' => String)); + +f('getprotobyname', Variant, + array('name' => String)); + +f('getprotobynumber', Variant, + array('number' => Int32)); + +f('getservbyname', Variant, + array('service' => String, + 'protocol' => String)); + +f('getservbyport', Variant, + array('port' => Int32, + 'protocol' => String)); + +f('inet_ntop', Variant, + array('in_addr' => String)); + +f('inet_pton', Variant, + array('address' => String)); + +f('ip2long', Variant, + array('ip_address' => String)); + +f('long2ip', String, + array('proper_address' => Int32)); + +f('dns_check_record', Boolean, + array('host' => String, + 'type' => array(String, 'null_string'))); + +f('checkdnsrr', Boolean, + array('host' => String, + 'type' => array(String, 'null_string'))); + +f('dns_get_record', Variant, + array('hostname' => String, + 'type' => array(Int32, '-1'), + 'authns' => array(VariantMap | Reference, 'null'), + 'addtl' => array(VariantMap | Reference, 'null'))); + +f('dns_get_mx', Boolean, + array('hostname' => String, + 'mxhosts' => VariantMap | Reference, + 'weights' => array(VariantMap | Reference, 'null'))); + +f('getmxrr', Boolean, + array('hostname' => String, + 'mxhosts' => VariantMap | Reference, + 'weight' => array(VariantMap | Reference, 'null'))); + +/////////////////////////////////////////////////////////////////////////////// +// socket + +f('fsockopen', Variant, + array('hostname' => String, + 'port' => array(Int32, '-1'), + 'errnum' => array(Int32 | Reference, 'null'), + 'errstr' => array(String | Reference, 'null'), + 'timeout' => array(Double, '0.0'))); + +f('pfsockopen', Variant, + array('hostname' => String, + 'port' => array(Int32, '-1'), + 'errnum' => array(Int32 | Reference, 'null'), + 'errstr' => array(String | Reference, 'null'), + 'timeout' => array(Double, '0.0'))); + +f('socket_get_status', VariantMap, + array('stream' => Resource)); + +f('socket_set_blocking', Boolean, + array('stream' => Resource, + 'mode' => Int32)); + +f('socket_set_timeout', Boolean, + array('stream' => Resource, + 'seconds' => Int32, + 'microseconds' => array(Int32, '0'))); + +/////////////////////////////////////////////////////////////////////////////// +// http + +f('header', NULL, + array('str' => String, + 'replace' => array(Boolean, 'true'), + 'http_response_code' => array(Int32, '0'))); + +f('headers_list', StringVec); + +f('headers_sent', Boolean, + array('file' => array(String | Reference, 'null'), + 'line' => array(Int32 | Reference, 'null'))); + +f('setcookie', Boolean, + array('name' => String, + 'value' => array(String, 'null_string'), + 'expire' => array(Int32, '0'), + 'path' => array(String, 'null_string'), + 'domain' => array(String, 'null_string'), + 'secure' => array(Boolean, 'false'), + 'httponly' => array(Boolean, 'false'))); + +f('setrawcookie', Boolean, + array('name' => String, + 'value' => array(String, 'null_string'), + 'expire' => array(Int32, '0'), + 'path' => array(String, 'null_string'), + 'domain' => array(String, 'null_string'), + 'secure' => array(Boolean, 'false'), + 'httponly' => array(Boolean, 'false'))); + +/////////////////////////////////////////////////////////////////////////////// +// syslog + +f('define_syslog_variables'); + +f('openlog', NULL, + array('ident' => String, + 'option' => Int32, + 'facility' => Int32)); + +f('closelog'); + +f('syslog', NULL, + array('priority' => Int32, + 'message' => String)); diff --git a/src/idl/openssl.idl.php b/src/idl/openssl.idl.php new file mode 100644 index 0000000000000..9a9816a38e97e --- /dev/null +++ b/src/idl/openssl.idl.php @@ -0,0 +1,204 @@ + Variant, + 'outfilename' => String, + 'notext' => array(Boolean, 'true'))); + +f('openssl_csr_export', Boolean, + array('csr' => Variant, + 'out' => String | Reference, + 'notext' => array(Boolean, 'true'))); + +f('openssl_csr_get_public_key', Variant, + array('csr' => Variant)); + +f('openssl_csr_get_subject', Variant, + array('csr' => Variant, + 'use_shortnames' => array(Boolean, 'true'))); + +f('openssl_csr_new', Variant, + array('dn' => StringMap, + 'privkey' => Object | Reference, + 'configargs' => array(Variant, 'null_variant'), + 'extraattribs' => array(Variant, 'null_variant'))); + +f('openssl_csr_sign', Variant, + array('csr' => Variant, + 'cacert' => Variant, + 'priv_key' => Variant, + 'days' => Int32, + 'configargs' => array(Variant, 'null_variant'), + 'serial' => array(Int32, '0'))); + +f('openssl_error_string', Variant); + +f('openssl_open', Boolean, + array('sealed_data' => String, + 'open_data' => String | Reference, + 'env_key' => String, + 'priv_key_id' => Variant)); + +f('openssl_pkcs12_export_to_file', Boolean, + array('x509' => Variant, + 'filename' => String, + 'priv_key' => Variant, + 'pass' => String, + 'args' => array(Variant, 'null_variant'))); + +f('openssl_pkcs12_export', Boolean, + array('x509' => Variant, + 'out' => String | Reference, + 'priv_key' => Variant, + 'pass' => String, + 'args' => array(Variant, 'null_variant'))); + +f('openssl_pkcs12_read', Boolean, + array('pkcs12' => String, + 'certs' => StringVec | Reference, + 'pass' => String)); + +f('openssl_pkcs7_decrypt', Boolean, + array('infilename' => String, + 'outfilename' => String, + 'recipcert' => Variant, + 'recipkey' => array(Variant, 'null_variant'))); + +f('openssl_pkcs7_encrypt', Boolean, + array('infilename' => String, + 'outfilename' => String, + 'recipcerts' => Variant, + 'headers' => StringVec, + 'flags' => array(Int32, '0'), + 'cipherid' => array(Int32, 'k_OPENSSL_CIPHER_RC2_40'))); + +f('openssl_pkcs7_sign', Boolean, + array('infilename' => String, + 'outfilename' => String, + 'signcert' => Variant, + 'privkey' => Variant, + 'headers' => Variant, + 'flags' => array(Int32, 'k_PKCS7_DETACHED'), + 'extracerts' => array(String, 'null_string'))); + +f('openssl_pkcs7_verify', Variant, + array('filename' => String, + 'flags' => Int32, + 'outfilename' => array(String, 'null_string'), + 'cainfo' => array(StringVec, 'null_array'), + 'extracerts' => array(String, 'null_string'), + 'content' => array(String, 'null_string'))); + +f('openssl_pkey_export_to_file', Boolean, + array('key' => Variant, + 'outfilename' => String, + 'passphrase' => array(String, 'null_string'), + 'configargs' => array(Variant, 'null_variant'))); + +f('openssl_pkey_export', Boolean, + array('key' => Variant, + 'out' => String | Reference, + 'passphrase' => array(String, 'null_string'), + 'configargs' => array(Variant, 'null_variant'))); + +f('openssl_pkey_free', NULL, + array('key' => Object)); + +f('openssl_free_key', NULL, + array('key' => Object)); + +f('openssl_pkey_get_details', VariantMap, + array('key' => Object)); + +f('openssl_pkey_get_private', Variant, + array('key' => Variant, + 'passphrase' => array(String, 'null_string'))); + +f('openssl_get_privatekey', Variant, + array('key' => Variant, + 'passphrase' => array(String, 'null_string'))); + +f('openssl_pkey_get_public', Variant, + array('certificate' => Variant)); + +f('openssl_get_publickey', Variant, + array('certificate' => Variant)); + +f('openssl_pkey_new', Object, + array('configargs' => array(Variant, 'null_variant'))); + +f('openssl_private_decrypt', Boolean, + array('data' => String, + 'decrypted' => String | Reference, + 'key' => Variant, + 'padding' => array(Int32, 'k_OPENSSL_PKCS1_PADDING'))); + +f('openssl_private_encrypt', Boolean, + array('data' => String, + 'crypted' => String | Reference, + 'key' => Variant, + 'padding' => array(Int32, 'k_OPENSSL_PKCS1_PADDING'))); + +f('openssl_public_decrypt', Boolean, + array('data' => String, + 'decrypted' => String | Reference, + 'key' => Variant, + 'padding' => array(Int32, 'k_OPENSSL_PKCS1_PADDING'))); + +f('openssl_public_encrypt', Boolean, + array('data' => String, + 'crypted' => String | Reference, + 'key' => Variant, + 'padding' => array(Int32, 'k_OPENSSL_PKCS1_PADDING'))); + +f('openssl_seal', Variant, + array('data' => String, + 'sealed_data' => String | Reference, + 'env_keys' => StringVec | Reference, + 'pub_key_ids' => StringVec)); + +f('openssl_sign', Boolean, + array('data' => String, + 'signature' => String | Reference, + 'priv_key_id' => Variant, + 'signature_alg' => array(Int32, 'k_OPENSSL_ALGO_SHA1'))); + +f('openssl_verify', Variant, + array('data' => String, + 'signature' => String, + 'pub_key_id' => Variant, + 'signature_alg' => array(Int32, 'k_OPENSSL_ALGO_SHA1'))); + +f('openssl_x509_check_private_key', Boolean, + array('cert' => Variant, + 'key' => Variant)); + +f('openssl_x509_checkpurpose', Int32, + array('x509cert' => Variant, + 'purpose' => Int32, + 'cainfo' => array(StringVec, 'null_array'), + 'untrustedfile' => array(String, 'null_string'))); + +f('openssl_x509_export_to_file', Boolean, + array('x509' => Variant, + 'outfilename' => String, + 'notext' => array(Boolean, 'true'))); + +f('openssl_x509_export', Boolean, + array('x509' => Variant, + 'output' => String | Reference, + 'notext' => array(Boolean, 'true'))); + +f('openssl_x509_free', NULL, + array('x509cert' => Object)); + +f('openssl_x509_parse', Variant, + array('x509cert' => Variant, + 'shortnames' => array(Boolean, 'true'))); + +f('openssl_x509_read', Variant, + array('x509certdata' => Variant)); diff --git a/src/idl/options.idl.php b/src/idl/options.idl.php new file mode 100644 index 0000000000000..545bf5680b3ac --- /dev/null +++ b/src/idl/options.idl.php @@ -0,0 +1,145 @@ + Int32, + 'value' => array(Variant, 'null_variant'))); + +f('assert', Variant, + array('assertion' => Variant)); + +f('dl', Int32, + array('library' => String)); + +f('extension_loaded', Boolean, + array('name' => String)); + +f('get_loaded_extensions', StringVec, + array('zend_extensions' => array(Boolean, 'false'))); + +f('get_extension_funcs', VariantMap, + array('module_name' => String)); + +f('get_cfg_var', String, + array('option' => String)); + +f('get_current_user', String); + +f('get_defined_constants', VariantMap, + array('categorize' => array(Variant, 'null_variant'))); + +f('get_include_path', String); + +f('restore_include_path'); + +f('set_include_path', String, + array('new_include_path' => String)); + +f('get_included_files', StringVec); + +f('get_magic_quotes_gpc', Int32); + +f('get_magic_quotes_runtime', Int32); + +f('get_required_files', StringVec); + +f('getenv', Variant, + array('varname' => String)); + +f('getlastmod', Int32); + +f('getmygid', Int32); + +f('getmyinode', Int32); + +f('getmypid', Int32); + +f('getmyuid', Int32); + +f('getopt', VariantMap, + array('options' => String, + 'longopts' => array(Variant, 'null_variant'))); + +f('getrusage', VariantMap, + array('who' => array(Int32, '0'))); + +f('clock_getres', Boolean, + array('clk_id' => Int32, + 'sec' => Int64 | Reference, + 'nsec' => Int64 | Reference)); + +f('clock_gettime', Boolean, + array('clk_id' => Int32, + 'sec' => Int64 | Reference, + 'nsec' => Int64 | Reference)); + +f('clock_settime', Boolean, + array('clk_id' => Int32, + 'sec' => Int64, + 'nsec' => Int64)); + +f('ini_alter', String, + array('varname' => String, + 'newvalue' => String)); + +f('ini_get_all', VariantMap, + array('extension' => array(String, 'null_string'))); + +f('ini_get', String, + array('varname' => String)); + +f('ini_restore', NULL, + array('varname' => String)); + +f('ini_set', String, + array('varname' => String, + 'newvalue' => String)); + +f('memory_get_peak_usage', Int64, + array('real_usage' => array(Boolean, 'false'))); + +f('memory_get_usage', Int64, + array('real_usage' => array(Boolean, 'false'))); + +f('php_ini_scanned_files', String); + +f('php_logo_guid', String); + +f('php_sapi_name', String); + +f('php_uname', String, + array('mode' => array(String, 'null_string'))); + +f('phpcredits', Boolean, + array('flag' => array(Int32, '0'))); + +f('phpinfo', Boolean, + array('what' => array(Int32, '0'))); + +f('phpversion', String, + array('extension' => array(String, 'null_string'))); + +f('putenv', Boolean, + array('setting' => String)); + +f('set_magic_quotes_runtime', Boolean, + array('new_setting' => Boolean)); + +f('set_time_limit', NULL, + array('seconds' => Int32)); + +f('sys_get_temp_dir', String); + +f('version_compare', Variant, + array('version1' => String, + 'version2' => String, + 'sop' => array(String, 'null_string'))); + +f('zend_logo_guid', String); + +f('zend_thread_id', Int32); + +f('zend_version', String); diff --git a/src/idl/oracle.idl.php b/src/idl/oracle.idl.php new file mode 100644 index 0000000000000..baeb426adb708 --- /dev/null +++ b/src/idl/oracle.idl.php @@ -0,0 +1,163 @@ + String, + 'password' => String, + 'db' => array(String, 'null_string'), + 'charset' => array(String, 'null_string'), + 'session_mode' => array(Int32, '0'))); + +f('oci_new_connect', Resource, + array('username' => String, + 'password' => String, + 'db' => array(String, 'null_string'), + 'charset' => array(String, 'null_string'), + 'session_mode' => array(Int32, '0'))); + +f('oci_pconnect', Resource, + array('username' => String, + 'password' => String, + 'db' => array(String, 'null_string'), + 'charset' => array(String, 'null_string'), + 'session_mode' => array(Int32, '0'))); + +f('oci_server_version', String, + array('connection' => Resource)); + +f('oci_password_change', Variant, + array('connection' => Variant, + 'username' => String, + 'old_password' => String, + 'new_password' => String)); + +f('oci_new_cursor', Resource, + array('connection' => Resource)); + +f('oci_new_descriptor', Resource, + array('connection' => Resource, + 'type' => array(Int32, '0'))); + +f('oci_close', Boolean, + array('connection' => Resource)); + +f('oci_commit', Boolean, + array('connection' => Resource)); + +f('oci_rollback', Boolean, + array('connection' => Resource)); + +f('oci_error', VariantMap, + array('source' => array(Resource, 'null'))); + +f('oci_internal_debug', NULL, + array('onoff' => Boolean)); + +f('oci_parse', Resource, + array('connection' => Resource, + 'query' => String)); + +f('oci_statement_type', String, + array('statement' => Resource)); + +f('oci_free_statement', Boolean, + array('statement' => Resource)); + +f('oci_free_descriptor', Boolean, + array('lob' => Resource)); + +f('oci_bind_array_by_name', Boolean, + array('statement' => Resource, + 'name' => String, + 'var_array' => VariantMap | Reference, + 'max_table_length' => Int32, + 'max_item_length' => array(Int32, '0'), + 'type' => array(Int32, '0'))); + +f('oci_bind_by_name', Boolean, + array('statement' => Resource, + 'ph_name' => String, + 'variable' => Variant | Reference, + 'max_length' => array(Int32, '0'), + 'type' => array(Int32, '0'))); + +f('oci_cancel', Boolean, + array('statement' => Resource)); + +f('oci_define_by_name', Boolean, + array('statement' => Resource, + 'column_name' => String, + 'variable' => Variant | Reference, + 'type' => array(Int32, '0'))); + +f('oci_execute', Boolean, + array('statement' => Resource, + 'mode' => array(Int32, '0'))); + +f('oci_num_fields', Int32, + array('statement' => Resource)); + +f('oci_num_rows', Int32, + array('statement' => Resource)); + +f('oci_result', Variant, + array('statement' => Resource, + 'field' => Variant)); + +f('oci_set_prefetch', Boolean, + array('statement' => Resource, + 'rows' => Int32)); + +f('oci_fetch_all', Int32, + array('statement' => Resource, + 'output' => VariantMap | Reference, + 'skip' => array(Int32, '0'), + 'maxrows' => array(Int32, '0'), + 'flags' => array(Int32, '0'))); + +f('oci_fetch_array', Variant, + array('statement' => Resource, + 'mode' => array(Int32, '0'))); + +f('oci_fetch_assoc', Variant, + array('statement' => Resource)); + +f('oci_fetch_object', Variant, + array('statement' => Resource)); + +f('oci_fetch_row', Variant, + array('statement' => Resource)); + +f('oci_fetch', Boolean, + array('statement' => Resource)); + +f('oci_field_is_null', Boolean, + array('statement' => Resource, + 'field' => Variant)); + +f('oci_field_name', String, + array('statement' => Resource, + 'field' => Int32)); + +f('oci_field_precision', Int32, + array('statement' => Resource, + 'field' => Int32)); + +f('oci_field_scale', Int32, + array('statement' => Resource, + 'field' => Int32)); + +f('oci_field_size', Int32, + array('statement' => Resource, + 'field' => Variant)); + +f('oci_field_type_raw', Int32, + array('statement' => Resource, + 'field' => Int32)); + +f('oci_field_type', Variant, + array('statement' => Resource, + 'field' => Int32)); diff --git a/src/idl/output.idl.php b/src/idl/output.idl.php new file mode 100644 index 0000000000000..6c39f9ed8b78b --- /dev/null +++ b/src/idl/output.idl.php @@ -0,0 +1,57 @@ + array(Variant, 'null'), + 'chunk_size' => array(Int32, '0'), + 'erase' => array(Boolean, 'true'))); + +f('ob_clean'); + +f('ob_flush'); + +f('ob_end_clean', Boolean); + +f('ob_end_flush', Boolean); + +f('flush'); + +f('ob_get_clean', String); +f('ob_get_contents', String); +f('ob_get_flush', String); +f('ob_get_length', Int32); +f('ob_get_level', Int32); +f('ob_get_status', VariantMap, + array('full_status' => array(Boolean, 'false'))); + +f('ob_gzhandler', String, + array('buffer' => String, + 'mode' => Int32)); + +f('ob_implicit_flush', NULL, + array('flag' => array(Boolean, 'true'))); + +f('ob_list_handlers', StringVec); + +f('output_add_rewrite_var', Boolean, + array('name' => String, + 'value' => String)); + +f('output_reset_rewrite_vars', Boolean); + +f('hphp_log', Boolean, + array('filename' => String, + 'message' =>String)); + +f('hphp_stats', NULL, + array('name' => String, + 'value' => Int64)); + +f('hphp_get_stats', Int64, + array('name' => String)); + +f('hphp_output_global_state', NULL, + array('filename' => array(String, 'null_string'))); diff --git a/src/idl/php_mcc.idl.php b/src/idl/php_mcc.idl.php new file mode 100644 index 0000000000000..b3ccbe3f6ea30 --- /dev/null +++ b/src/idl/php_mcc.idl.php @@ -0,0 +1,269 @@ + String, + 'persistent' => array(Boolean, 'true'), + 'npoolprefix' => array(Int64, 'k_MCC_POOLPREFIX_LEN'), + 'mtu' => array(Int64, 'k_MCC_MTU'), + 'rxdgram_max' => array(Int64, 'k_MCC_NODELAY'), + 'nodelay' => array(Int64, 'k_MCC_CONN_TMO_MS'), + 'conn_tmo' => array(Int64, 'k_MCC_CONN_TMO_MS'), + 'conn_ntries' => array(Int64, 'k_MCC_CONN_NTRIES'), + 'tmo' => array(Int64, 'k_MCC_TMO_MS'), + 'dgram_ntries' => array(Int64, 'k_MCC_DGRAM_NTRIES'), + 'dgram_tmo_weight' => array(Double, 'k_MCC_DGRAM_TMO_WEIGHT'), + 'server_retry_tmo' => array(Int64, 'k_MCC_SERVER_RETRY_TMO_MS'), + 'dgram_tmo_threshold' => array(Int64, 'k_MCC_DGRAM_TMO_THRESHOLD'), + 'window_max' => array(Int64, 'k_MCC_WINDOW_MAX'))), + m(PublicMethod, "__destruct", Variant), + m(PublicMethod, "__toString", String), + m(PublicMethod, "__set", Variant, + array('name' => Variant, + 'val' => Variant)), + m(PublicMethod, "__get", Variant, + array('name' => Variant)), + m(PublicMethod, "close", Boolean), + m(PublicMethod, "del", Boolean), + m(PublicMethod, "add_accesspoint", Int64, + array('server' => String, + 'host' => String, + 'port' => array(String, '"11211"'), + 'protocol' => array(Int64, 'k_MCC_IPPROTO_TCP'))), + m(PublicMethod, "remove_accesspoint", null, + array('server' => String, + 'host' => String, + 'port' => array(String, '"11211"'), + 'protocol' => array(Int64, 'k_MCC_IPPROTO_TCP'))), + m(PublicMethod, "get_accesspoints", Variant, + array('server' => String)), + m(PublicMethod, "get_server", Variant, + array('server' => String)), + m(PublicMethod, "add_mirror_accesspoint", Variant, + array('mirrorname' => String, + 'server' => String, + 'host' => String, + 'port' => array(String, '"11211"'), + 'protocol' => array(Int64, 'k_MCC_IPPROTO_TCP'))), + m(PublicMethod, "remove_mirror_accesspoint", null, + array('mirrorname' => String, + 'server' => String, + 'host' => String, + 'port' => array(String, '"11211"'), + 'protocol' => array(Int64, 'k_MCC_IPPROTO_TCP'))), + m(PublicMethod, "add_server", Int64, + array('server' => String, + 'mirror' => array(String, '""'))), + m(PublicMethod, "remove_server", null, + array('server' => String, + 'mirror' => array(String, '""'))), + m(PublicMethod, "server_flush", Boolean, + array('server' => String, + 'exptime' => array(Int64, '0'))), + m(PublicMethod, "server_version", Variant, + array('server' => String)), + m(PublicMethod, "server_is_alive", Boolean, + array('server' => array(String, '""'))), + m(PublicMethod, "test_proxy", Boolean, + array('server' => array(String, '""'))), + m(PublicMethod, "add_mirror", Variant, + array('mirrorname' => String, + 'model' => Int64)), + m(PublicMethod, "remove_mirror", Variant, + array('mirrorname' => String)), + m(PublicMethod, "add_serverpool", Variant, + array('serverpool' => String, + 'consistent_hashing_enabled' => array(Boolean, 'false'))), + m(PublicMethod, "add_serverpool_ex", Variant, + array('serverpool' => String, + 'version_flag' => Int64)), + m(PublicMethod, "remove_serverpool", null, + array('serverpool' => String)), + m(PublicMethod, "add_accesspoint_listener", Boolean, + array('function' => String, + 'context' => Variant | Reference)), + m(PublicMethod, "remove_accesspoint_listener", Boolean, + array('function' => String, + 'context' => Variant | Reference)), + m(PublicMethod, "add_server_listener", Boolean, + array('function' => String, + 'context' => Variant | Reference)), + m(PublicMethod, "remove_server_listener", Boolean, + array('function' => String, + 'context' => Variant | Reference)), + m(PublicMethod, "add_error_listener", Boolean, + array('function' => String, + 'context' => Variant | Reference)), + m(PublicMethod, "remove_error_listener", Boolean, + array('function' => String, + 'context' => Variant | Reference)), + m(PublicMethod, "get_server_by_key", Variant, + array('key' => String)), + m(PublicMethod, "get_host", Variant, + array('key' => String)), + m(PublicMethod, "get_serverpool_by_key", Variant, + array('key' => String)), + m(PublicMethod, "serverpool_add_server", Variant, + array('serverpool' => String, + 'server' => String, + 'mirrorname' => array(String, '""'))), + m(PublicMethod, "serverpool_remove_server", Variant, + array('serverpool' => String, + 'server' => String, + 'mirrorname' => array(String, '""'))), + m(PublicMethod, "serverpool_get_servers", Variant, + array('serverpool' => String)), + m(PublicMethod, "serverpool_get_consistent_hashing_enabled", Variant, + array('serverpool' => String)), + m(PublicMethod, "serverpool_get_consistent_hashing_version", Variant, + array('serverpool' => String)), + m(PublicMethod, "multi_add", Variant, + array('keys_values' => StringMap, + 'exptime' => array(Int64, '0'), + 'compress' => array(Int64, '1'), + 'proxy_replicate' => array(Int64, '0'), + 'async_set' => array(Int64, '0'))), + m(PublicMethod, "multi_replace", Variant, + array('keys_values' => StringMap, + 'exptime' => array(Int64, '0'), + 'compress' => array(Int64, '1'), + 'proxy_replicate' => array(Int64, '0'), + 'async_set' => array(Int64, '0'))), + m(PublicMethod, "multi_set", Variant, + array('keys_values' => StringMap, + 'exptime' => array(Int64, '0'), + 'compress' => array(Int64, '1'), + 'proxy_replicate' => array(Int64, '0'), + 'async_set' => array(Int64, '0'))), + m(PublicMethod, "add", Variant, + array('key' => Variant, + 'value' => Variant, + 'exptime' => array(Int64, '0'), + 'compress' => array(Boolean, 'true'), + 'proxy_replicate' => array(Int64, '0'), + 'async_set' => array(Int64, '0'))), + m(PublicMethod, "decr", Variant, + array('key' => String, + 'value' => array(Int64, '1'))), + m(PublicMethod, "incr", Variant, + array('key' => String, + 'value' => array(Int64, '1'))), + m(PublicMethod, "delete", Variant, + array('keys' => Variant, + 'exptime' => array(Int64, '0'))), + m(PublicMethod, "delete_details", Variant, + array('keys' => Variant, + 'exptime' => array(Int64, '0'))), + m(PublicMethod, "get", Variant, + array('keys' => Variant, + 'detailed_info_mode' => array(Int64, '0'), + 'detailed_info' => array(Variant | Reference, 'null'))), + m(PublicMethod, "get_multi", Variant, + array('keys' => Variant, + 'detailed_info_mode' => array(Int64, '0'), + 'detailed_info' => array(Variant | Reference, 'null'))), + m(PublicMethod, "replace", Variant, + array('key' => Variant, + 'value' => Variant, + 'exptime' => array(Int64, '0'), + 'compress' => array(Boolean, 'true'), + 'proxy_replicate' => array(Int64, '0'), + 'async_set' => array(Int64, '0'))), + m(PublicMethod, "set", Variant, + array('key' => Variant, + 'value' => Variant, + 'exptime' => array(Int64, '0'), + 'compress' => array(Boolean, 'true'), + 'proxy_replicate' => array(Int64, '0'), + 'async_set' => array(Int64, '0'))), + m(PublicMethod, "stats", Variant, + array('clear' => array(Int64, '0')))), + array(ck("IPPROTO_TCP", Int64), + ck("IPPROTO_UDP", Int64)), + "\n public: MccResourcePtr m_mcc;"); diff --git a/src/idl/posix.idl.php b/src/idl/posix.idl.php new file mode 100644 index 0000000000000..164a63a0f8984 --- /dev/null +++ b/src/idl/posix.idl.php @@ -0,0 +1,55 @@ + String, + 'mode' => array(Int32, '0'))); + +f('posix_ctermid', String); +f('posix_get_last_error', Int32); +f('posix_getcwd', String); +f('posix_getegid', Int32); +f('posix_geteuid', Int32); +f('posix_getgid', Int32); +f('posix_getgrgid', Variant, array('gid' => Int32)); +f('posix_getgrnam', Variant, array('name' => String)); +f('posix_getgroups', Variant); +f('posix_getlogin', Variant); +f('posix_getpgid', Variant, array('pid' => Int32)); +f('posix_getpgrp', Int32); +f('posix_getpid', Int32); +f('posix_getppid', Int32); +f('posix_getpwnam', Variant, array('username' => String)); +f('posix_getpwuid', Variant, array('uid' => Int32)); +f('posix_getrlimit', Variant); +f('posix_getsid', Variant, array('pid' => Int32)); +f('posix_getuid', Int32); +f('posix_initgroups', Boolean, + array('name' => String, + 'base_group_id' => Int32)); + +f('posix_isatty', Boolean, array('fd' => Variant)); +f('posix_kill', Boolean, array('pid' => Int32, 'sig' => Int32)); +f('posix_mkfifo', Boolean, + array('pathname' => String, + 'mode' => Int32)); + +f('posix_mknod', Boolean, + array('pathname' => String, + 'mode' => Int32, + 'major' => array(Int32, '0'), + 'minor' => array(Int32, '0'))); + +f('posix_setegid', Boolean, array('gid' => Int32)); +f('posix_seteuid', Boolean, array('uid' => Int32)); +f('posix_setgid', Boolean, array('gid' => Int32)); +f('posix_setpgid', Boolean, array('pid' => Int32, 'pgid' => Int32)); +f('posix_setsid', Int32); +f('posix_setuid', Boolean, array('uid' => Int32)); +f('posix_strerror', String, array('errnum' => Int32)); +f('posix_times', Variant); +f('posix_ttyname', Variant, array('fd' => Variant)); +f('posix_uname', Variant); diff --git a/src/idl/preg.idl.php b/src/idl/preg.idl.php new file mode 100644 index 0000000000000..a6bdfee28eb37 --- /dev/null +++ b/src/idl/preg.idl.php @@ -0,0 +1,87 @@ + String, + 'input' => VariantMap, + 'flags' => array(Int32, '0'))); + +f('preg_match', Variant, + array('pattern' => String, + 'subject' => String, + 'matches' => array(StringVec | Reference, 'null'), + 'flags' => array(Int32, '0'), + 'offset' => array(Int32, '0'))); + +f('preg_match_all', Variant, + array('pattern' => String, + 'subject' => String, + 'matches' => StringVec | Reference, + 'flags' => array(Int32, '0'), + 'offset' => array(Int32, '0'))); + +f('preg_replace', Variant, + array('pattern' => Variant, + 'replacement' => Variant, + 'subject' => Variant, + 'limit' => array(Int32, '-1'), + 'count' => array(Int32 | Reference, 'null'))); + +f('preg_replace_callback', Variant, + array('pattern' => Variant, + 'callback' => Variant, + 'subject' => Variant, + 'limit' => array(Int32, '-1'), + 'count' => array(Int32 | Reference, 'null'))); + +f('preg_split', Variant, + array('pattern' => Variant, + 'subject' => Variant, + 'limit' => array(Int32, '-1'), + 'flags' => array(Int32, '0'))); + +f('preg_quote', String, + array('str' => String, + 'delimiter' => array(String, 'null_string'))); + +f('preg_last_error', Int32); + +/////////////////////////////////////////////////////////////////////////////// +// ereg + +f('ereg_replace', String, + array('pattern' => String, + 'replacement' => String, + 'str' => String)); + +f('eregi_replace', String, + array('pattern' => String, + 'replacement' => String, + 'str' => String)); + +f('ereg', Variant, + array('pattern' => String, + 'str' => String, + 'regs' => array(StringVec | Reference, 'null'))); + +f('eregi', Variant, + array('pattern' => String, + 'str' => String, + 'regs' => array(StringVec | Reference, 'null'))); + +f('split', Variant, + array('pattern' => String, + 'str' => String, + 'limit' => array(Int32, '-1'))); + +f('spliti', Variant, + array('pattern' => String, + 'str' => String, + 'limit' => array(Int32, '-1'))); + +f('sql_regcase', String, + array('str' => String)); diff --git a/src/idl/process.idl.php b/src/idl/process.idl.php new file mode 100644 index 0000000000000..d66d828ee4259 --- /dev/null +++ b/src/idl/process.idl.php @@ -0,0 +1,95 @@ + Int32)); + +f('pcntl_exec', NULL, + array('path' => String, + 'args' => array(StringVec, 'null_array'), + 'envs' => array(StringVec, 'null_array'))); + +f('pcntl_fork', Int32); + +f('pcntl_getpriority', Variant, + array('pid' => array(Int32, '0'), + 'process_identifier' => array(Int32, '0'))); + +f('pcntl_setpriority', Boolean, + array('priority' => Int32, + 'pid' => array(Int32, '0'), + 'process_identifier' => array(Int32, '0'))); + +f('pcntl_signal', Boolean, + array('signo' => Int32, + 'handler' => Variant, + 'restart_syscalls' => array(Boolean, 'true'))); + +f('pcntl_wait', Int32, + array('status' => Int32 | Reference, + 'options' => array(Int32, '0'))); + +f('pcntl_waitpid', Int32, + array('pid' => Int32, + 'status' => Int32 | Reference, + 'options' => array(Int32, '0'))); + +f('pcntl_wexitstatus', Int32, array('status' => Int32)); +f('pcntl_wifexited', Boolean, array('status' => Int32)); +f('pcntl_wifsignaled', Boolean, array('status' => Int32)); +f('pcntl_wifstopped', Boolean, array('status' => Int32)); +f('pcntl_wstopsig', Int32, array('status' => Int32)); +f('pcntl_wtermsig', Int32, array('status' => Int32)); + +// added in PHP 5.3.0 +f('pcntl_signal_dispatch', Boolean, array()); + +/////////////////////////////////////////////////////////////////////////////// +// program execution functions + +f('shell_exec', String, + array('cmd' => String)); + +f('exec', String, + array('command' => String, + 'output' => array(VariantMap | Reference, 'null'), + 'return_var' => array(Int32 | Reference, 'null'))); + +f('passthru', NULL, + array('command' => String, + 'return_var' => array(Int32 | Reference, 'null'))); + +f('system', String, + array('command' => String, + 'return_var' => array(Int32 | Reference, 'null'))); + +f('proc_open', Variant, + array('cmd' => String, + 'descriptorspec' => VariantVec, + 'pipes' => VariantVec | Reference, + 'cwd' => array(String, 'null_string'), + 'env' => array(Variant, 'null_variant'), + 'other_options' => array(Variant, 'null_variant'))); + +f('proc_terminate', Boolean, + array('process' => Resource, + 'signal' => array(Int32, '0'))); + +f('proc_close', Int32, + array('process' => Resource)); + +f('proc_get_status', VariantMap, + array('process' => Resource)); + +f('proc_nice', Boolean, + array('increment' => Int32)); + +f('escapeshellarg', String, + array('arg' => String)); + +f('escapeshellcmd', String, + array('command' => String)); diff --git a/src/idl/reflection.idl.php b/src/idl/reflection.idl.php new file mode 100644 index 0000000000000..575b9f543bbea --- /dev/null +++ b/src/idl/reflection.idl.php @@ -0,0 +1,52 @@ + String)); + +f('hphp_get_class_info', VariantMap, + array('name' => Variant)); + +f('hphp_get_function_info', VariantMap, + array('name' => String)); + +f('hphp_invoke', Variant, + array('name' => String, + 'params' => VariantVec)); + +f('hphp_invoke_method', Variant, + array('obj' => Variant, + 'cls' => String, + 'name' => String, + 'params' => VariantVec)); + +f('hphp_instanceof', Boolean, + array('obj' => Object, + 'name' => String)); + +f('hphp_create_object', Object, + array('name' => String, + 'params' => VariantVec)); + +f('hphp_get_property', Variant, + array('obj' => Object, + 'cls' => String, + 'prop' => String)); + +f('hphp_set_property', NULL, + array('obj' => Object, + 'cls' => String, + 'prop' => String, + 'value' => Variant)); + +f('hphp_get_static_property', Variant, + array('cls' => String, + 'prop' => String)); + +f('hphp_set_static_property', NULL, + array('cls' => String, + 'prop' => String, + 'value' => Variant)); diff --git a/src/idl/server.idl.php b/src/idl/server.idl.php new file mode 100644 index 0000000000000..f7a955dd7e164 --- /dev/null +++ b/src/idl/server.idl.php @@ -0,0 +1,48 @@ + String)); + +/////////////////////////////////////////////////////////////////////////////// + +f('pagelet_server_task_start', Resource, + array('url' => String, + 'headers' => array(StringMap, 'null_array'), + 'post_data' => array(String, 'null_string'))); + +f('pagelet_server_task_status', Boolean, + array('task' => Resource)); + +f('pagelet_server_task_result', String, + array('task' => Resource, + 'headers' => StringVec | Reference, + 'code' => Int64 | Reference)); + +/////////////////////////////////////////////////////////////////////////////// + +f('xbox_send_message', Boolean, + array('msg' => String, + 'ret' => Variant | Reference, + 'timeout_ms' => Int64, + 'host' => array(String, '"localhost"'))); + +f('xbox_post_message', Boolean, + array('msg' => String, + 'host' => array(String, '"localhost"'))); + +f('xbox_task_start', Resource, + array('message' => String)); + +f('xbox_task_status', Boolean, + array('task' => Resource)); + +f('xbox_task_result', Int64, + array('task' => Resource, + 'timeout_ms' => Int64, + 'ret' => Variant | Reference)); diff --git a/src/idl/simplexml.idl.php b/src/idl/simplexml.idl.php new file mode 100644 index 0000000000000..04e40d2d194a4 --- /dev/null +++ b/src/idl/simplexml.idl.php @@ -0,0 +1,95 @@ +"); + +/////////////////////////////////////////////////////////////////////////////// + +f('simplexml_load_string', Variant, + array('data' => String, + 'class_name' => array(String, '"SimpleXMLElement"'), + 'options' => array(Int64, '0'), + 'ns' => array(String, '""'), + 'is_prefix' => array(Boolean, 'false'))); + +f('simplexml_load_file', Variant, + array('filename' => String, + 'class_name' => array(String, '"SimpleXMLElement"'), + 'options' => array(Int64, '0'), + 'ns' => array(String, '""'), + 'is_prefix' => array(Boolean, 'false'))); + +f('libxml_get_errors', Variant); +f('libxml_get_last_error', Variant); +f('libxml_clear_errors'); +f('libxml_use_internal_errors', Boolean, + array('use_errors' => array(Variant, 'null_variant'))); +f('libxml_set_streams_context', NULL, + array('streams_context' => Resource)); + +/////////////////////////////////////////////////////////////////////////////// + +c('SimpleXMLElement', null, array('ArrayAccess'), + array( + m(PublicMethod, '__construct', NULL, + array('data' => String, + 'options' => array(Int64, '0'), + 'data_is_url' => array(Boolean, 'false'), + 'ns' => array(String, '""'), + 'is_prefix' => array(Boolean, 'false'))), + m(PublicMethod, 'offsetExists', Boolean, + array('index' => Variant)), + m(PublicMethod, 'offsetGet', Variant, + array('index' => Variant)), + m(PublicMethod, 'offsetSet', NULL, + array('index' => Variant, + 'newvalue' => Variant)), + m(PublicMethod, 'offsetUnset', NULL, + array('index' => Variant)), + m(PublicMethod, 'xpath', Variant, + array('path' => String)), + m(PublicMethod, 'registerXPathNamespace', Boolean, + array('prefix' => String, + 'ns' => String)), + m(PublicMethod, 'asXML', Variant, + array('filename' => String)), + m(PublicMethod, 'getNamespaces', StringMap, + array('recursive' => array(Boolean, 'false'))), + m(PublicMethod, 'getDocNamespaces', StringMap, + array('recursive' => array(Boolean, 'false'))), + m(PublicMethod, 'children', Object, + array('ns' => array(String, '""'), + 'is_prefix' => array(Boolean, 'false'))), + m(PublicMethod, 'getName', String), + m(PublicMethod, 'attributes', Object, + array('ns' => array(String, '""'), + 'is_prefix' => array(Boolean, 'false'))), + m(PublicMethod, 'addChild', Variant, + array('qName' => String, + 'value' => array(String, 'null_string'), + 'ns' => array(String, 'null_string'))), + m(PublicMethod, 'addAttribute', NULL, + array('qName' => String, + 'value' => array(String, 'null_string'), + 'ns' => array(String, 'null_string'))), + m(PublicMethod, '__toString', String), + ), + + array(), // constants + "\n". + " public:\n". + " Object m_doc;\n". + " xmlNodePtr m_node;\n". + " Array m_attributes;\n". + " virtual Array o_toIterArray(const char *context);\n". + " private:\n". + " bool m_is_attribute;\n". + " bool m_is_children;\n". + " xmlXPathContextPtr m_xpath;" + ); + +c('LibXMLError', null, array(), + array(m(PublicMethod, '__construct')), + array(), // constants + ""); diff --git a/src/idl/soap.idl.php b/src/idl/soap.idl.php new file mode 100644 index 0000000000000..65fe8124b79ce --- /dev/null +++ b/src/idl/soap.idl.php @@ -0,0 +1,212 @@ + +#include +END +); + +f('use_soap_error_handler', Boolean, + array('handler' => array(Boolean, 'true'))); +f('is_soap_fault', Boolean, + array('fault' => Variant)); + +c('SoapServer', null, array(), + array( + m(PublicMethod, "__construct", null, + array("wsdl" => Variant, + "options" => array(VariantMap, "null_array"))), + m(PublicMethod, "setClass", null, + array("name" => String), + VariableArguments), + m(PublicMethod, "setObject", null, + array("obj" => Object)), + m(PublicMethod, "addFunction", null, + array("func" => Variant)), + m(PublicMethod, "getFunctions", Variant), + m(PublicMethod, "handle", null, + array("request" => array(String, "null_string"))), + m(PublicMethod, "setPersistence", null, + array("mode" => Int64)), + m(PublicMethod, "fault", null, + array("code" => Variant, + "fault" => String, + "actor" => array(String, "null_string"), + "detail" => array(Variant, "null"), + "name" => array(String, "null_string"))), + m(PublicMethod, "addSoapHeader", null, + array("fault" => Object)), + ), + array(), + "\n public: int m_type;". + "\n public: soapFunctions m_soap_functions;". + "\n public: soapClass m_soap_class;". + "\n public: Object m_soap_object;". + + "\n public: String m_actor;". + "\n public: String m_uri;". + + "\n public: int m_version;". + "\n public: sdl *m_sdl;". + "\n public: xmlCharEncodingHandlerPtr m_encoding;". + "\n public: Array m_classmap;". + "\n public: encodeMap *m_typemap;". + "\n public: int m_features;". + + "\n public: Array m_soap_headers;". + "\n public: int m_send_errors;". + + "" + ); + +c('SoapClient', null, array(), + array( + m(PublicMethod, "__construct", null, + array("wsdl" => Variant, + "options" => array(VariantMap, "null_array"))), + m(PublicMethod, "__call", Variant, + array("name" => Variant, + "args" => Variant)), + m(PublicMethod, "__soapCall", Variant, + array("name" => String, + "args" => VariantMap, + "options" => array(VariantMap, "null_array"), + "input_headers" => array(Variant, "null"), + "output_headers" => array(Variant | Reference, "null"))), + m(PublicMethod, "__getLastRequest", Variant), + m(PublicMethod, "__getLastResponse", Variant), + m(PublicMethod, "__getLastRequestHeaders", Variant), + m(PublicMethod, "__getLastResponseHeaders", Variant), + m(PublicMethod, "__getFunctions", Variant), + m(PublicMethod, "__getTypes", Variant), + m(PublicMethod, "__doRequest", Variant, + array("buf" => String, + "location" => String, + "action" => String, + "version" => Int64, + "oneway" => array(Boolean, "false"))), + m(PublicMethod, "__setCookie", Variant, + array("name" => String, + "value" => array(String, "null_string"))), + m(PublicMethod, "__setLocation", Variant, + array("new_location" => array(String, "null_string"))), + m(PublicMethod, "__setSoapHeaders", Boolean, + array("headers" => array(Variant, "null"))), + ), + array(), + "\n public: int m_soap_version;". + "\n public: sdl *m_sdl;". + "\n public: xmlCharEncodingHandlerPtr m_encoding;". + "\n public: encodeMap *m_typemap;". + "\n public: Array m_classmap;". + "\n public: int m_features;". + + "\n public: String m_uri;". + "\n public: String m_location;". + "\n public: int m_style;". + "\n public: int m_use;". + + "\n public: String m_login;". + "\n public: String m_password;". + "\n public: int m_authentication;". + "\n public: bool m_digest;". + + "\n public: String m_proxy_host;". + "\n public: int m_proxy_port;". + "\n public: String m_proxy_login;". + "\n public: String m_proxy_password;". + + "\n public: int m_connection_timeout;". + "\n public: int m_max_redirect;". + "\n public: bool m_use11;". + "\n public: String m_user_agent;". + "\n public: bool m_compression;". + + "\n public: Variant m_default_headers;". + "\n public: Variant m_cookies;". + + "\n public: bool m_exceptions;". + "\n public: Variant m_soap_fault;". + + "\n public: bool m_trace;". + "\n public: Variant m_last_request;". + "\n public: Variant m_last_response;". + "\n public: Variant m_last_request_headers;". + "\n public: Variant m_last_response_headers;". + + "\n" + ); + +c('SoapVar', null, array(), + array( + m(PublicMethod, '__construct', null, + array("data" => Variant, + "type" => Variant, + "type_name" => array(String, "null_string"), + "type_namespace" => array(String, "null_string"), + "node_name" => array(String, "null_string"), + "node_namespace" => array(String, "null_string"), + )), + ), + array(), + "\n public: Variant m_value;". + "\n public: int64 m_type;". + "\n public: String m_stype;". + "\n public: String m_ns;". + "\n public: String m_name;". + "\n public: String m_namens;" + ); + +c('SoapFault', 'exception', array(), + array( + m(PublicMethod, '__construct', null, + array("code" => Variant, + "message" => String, + "actor" => array(String, "null_string"), + "detail" => array(Variant, "null"), + "name" => array(String, "null_string"), + "header" => array(Variant, "null"))), + m(PublicMethod, '__toString', String), + ), + array(), + "\n public: String m_faultstring;". + "\n public: String m_faultcode;". + "\n public: String m_faultcodens;". + "\n public: String m_faultactor;". + "\n public: Variant m_detail;". + "\n public: String m_name;". + "\n public: Variant m_headerfault;" + ); + +c('SoapParam', null, array(), + array( + m(PublicMethod, '__construct', null, + array("data" => Variant, + "name" => String)), + ), + array(), + "\n public: String m_name;". + "\n public: String m_data;" + ); + +c('SoapHeader', null, array(), + array( + m(PublicMethod, '__construct', null, + array("ns" => String, + "name" => String, + "data" => array(Variant, "null"), + "mustUnderstand" => array(Boolean, "false"), + "actor" => array(Variant, "null"))), + ), + array(), + "\n public: String m_namespace;". + "\n public: String m_name;". + "\n public: Variant m_data;". + "\n public: bool m_mustUnderstand;". + "\n public: Variant m_actor;" + ); diff --git a/src/idl/socket.idl.php b/src/idl/socket.idl.php new file mode 100644 index 0000000000000..42287796f349d --- /dev/null +++ b/src/idl/socket.idl.php @@ -0,0 +1,132 @@ + Int32, + 'type' => Int32, + 'protocol' => Int32)); + +f('socket_create_listen', Variant, + array('port' => Int32, + 'backlog' => array(Int32, '128'))); + +f('socket_create_pair', Boolean, + array('domain' => Int32, + 'type' => Int32, + 'protocol' => Int32, + 'fd' => Int64Vec | Reference)); + +f('socket_get_option', Variant, + array('socket' => Resource, + 'level' => Int32, + 'optname' => Int32)); + +f('socket_getpeername', Boolean, + array('socket' => Resource, + 'address' => String | Reference, + 'port' => array(Int32 | Reference, 'null'))); + +f('socket_getsockname', Boolean, + array('socket' => Resource, + 'address' => String | Reference, + 'port' => array(Int32 | Reference, 'null'))); + +f('socket_set_block', Boolean, + array('socket' => Resource)); + +f('socket_set_nonblock', Boolean, + array('socket' => Resource)); + +f('socket_set_option', Boolean, + array('socket' => Resource, + 'level' => Int32, + 'optname' => Int32, + 'optval' => Variant)); + +f('socket_connect', Boolean, + array('socket' => Resource, + 'address' => String, + 'port' => array(Int32, '0'))); + +f('socket_bind', Boolean, + array('socket' => Resource, + 'address' => String, + 'port' => array(Int32, '0'))); + +f('socket_listen', Boolean, + array('socket' => Resource, + 'backlog' => array(Int32, '0'))); + +f('socket_select', Variant, + array('read' => VariantVec | Reference, + 'write' => VariantVec | Reference, + 'except' => VariantVec | Reference, + 'vtv_sec' => Variant, + 'tv_usec' => array(Int32, '0'))); + +f('socket_server', Variant, + array('hostname' => String, + 'port' => array(Int32, '-1'), + 'errnum' => array(Int32 | Reference, 'null'), + 'errstr' => array(String | Reference, 'null'))); + +f('socket_accept', Variant, + array('socket' => Resource)); + +f('socket_read', Variant, + array('socket' => Resource, + 'length' => Int32, + 'type' => array(Int32, '0'))); + +f('socket_write', Variant, + array('socket' => Resource, + 'buffer' => String, + 'length' => array(Int32, '0'))); + +f('socket_send', Variant, + array('socket' => Resource, + 'buf' => String, + 'len' => Int32, + 'flags' => Int32)); + +f('socket_sendto', Variant, + array('socket' => Resource, + 'buf' => String, + 'len' => Int32, + 'flags' => Int32, + 'addr' => String, + 'port' => array(Int32, '0'))); + +f('socket_recv', Variant, + array('socket' => Resource, + 'buf' => String | Reference, + 'len' => Int32, + 'flags' => Int32)); + +f('socket_recvfrom', Variant, + array('socket' => Resource, + 'buf' => String | Reference, + 'len' => Int32, + 'flags' => Int32, + 'name' => String | Reference, + 'port' => array(Int32 | Reference, '0'))); + +f('socket_shutdown', Boolean, + array('socket' => Resource, + 'how' => array(Int32, '0'))); + +f('socket_close', NULL, + array('socket' => Resource)); + +f('socket_strerror', String, + array('errnum' => Int32)); + +f('socket_last_error', Int32, + array('socket' => array(Resource, 'null_object'))); + +f('socket_clear_error', NULL, + array('socket' => array(Resource, 'null_object'))); + diff --git a/src/idl/sqlite3.idl.php b/src/idl/sqlite3.idl.php new file mode 100644 index 0000000000000..55c5e174df8c7 --- /dev/null +++ b/src/idl/sqlite3.idl.php @@ -0,0 +1,128 @@ + +END +); + +k("SQLITE3_ASSOC", Int64); +k("SQLITE3_NUM", Int64); +k("SQLITE3_BOTH", Int64); +k("SQLITE3_INTEGER", Int64); +k("SQLITE3_FLOAT", Int64); +k("SQLITE3_TEXT", Int64); +k("SQLITE3_BLOB", Int64); +k("SQLITE3_NULL", Int64); +k("SQLITE3_OPEN_READONLY", Int64); +k("SQLITE3_OPEN_READWRITE", Int64); +k("SQLITE3_OPEN_CREATE", Int64); + +c('sqlite3', null, array(), + array( + m(PublicMethod, "__construct", null), + m(PublicMethod, "open", null, + array("filename" => String, + "flags" => array(Int64, + "k_SQLITE3_OPEN_READWRITE|k_SQLITE3_OPEN_CREATE"), + "encryption_key" => array(String, "null_string"))), + m(PublicMethod, "close", Boolean), + m(PublicMethod, "exec", Boolean, + array("sql" => String)), + m(PublicMethod, "version", VariantMap), + m(PublicMethod, "lastInsertRowID", Int64), + m(PublicMethod, "lastErrorCode", Int64), + m(PublicMethod, "lastErrorMsg", String), + m(PublicMethod, "loadExtension", Boolean, + array("extension" => String)), + m(PublicMethod, "changes", Int64), + m(PublicMethod, "escapeString", String, + array("sql" => String)), + m(PublicMethod, "prepare", Variant, + array("sql" => String)), + m(PublicMethod, "query", Variant, + array("sql" => String)), + m(PublicMethod, "querySingle", Variant, + array("sql" => String, + "entire_row" => array(Boolean, "false"))), + m(PublicMethod, "createFunction", Boolean, + array("name" => String, + "callback" => Variant, + "argcount" => array(Int64, "-1"))), + m(PublicMethod, "createAggregate", Boolean, + array("name" => String, + "step" => Variant, + "final" => Variant, + "argcount" => array(Int64, "-1"))), + m(PublicMethod, "openBlob", Boolean, + array("table" => String, + "column" => String, + "rowid" => Int64, + "dbname" => array(String, "null_string"))), + ), + array(), + "\n public: void validate() const;". + "\n public: sqlite3 *m_raw_db;". + "\n DECLARE_BOOST_TYPES(UserDefinedFunc);". + "\n struct UserDefinedFunc {". + "\n int argc;". + "\n Variant func;". + "\n Variant step;". + "\n Variant fini;". + "\n };". + "\n public: UserDefinedFuncPtrVec m_udfs;" + ); + +c('sqlite3stmt', null, array(), + array( + m(PublicMethod, "__construct", null, + array("dbobject" => Object, + "statement" => String)), + m(PublicMethod, "paramCount", Int64), + m(PublicMethod, "close", Boolean), + m(PublicMethod, "reset", Boolean), + m(PublicMethod, "clear", Boolean), + m(PublicMethod, "bindParam", Boolean, + array("name" => Variant, + "parameter" => Variant | Reference, + "type" => array(Int64, "k_SQLITE3_TEXT"))), + m(PublicMethod, "bindValue", Boolean, + array("name" => Variant, + "parameter" => Variant, + "type" => array(Int64, "k_SQLITE3_TEXT"))), + m(PublicMethod, "execute", Variant), + ), + array(), + "\n public: void validate() const;". + "\n public: p_sqlite3 m_db;". + "\n public: sqlite3_stmt *m_raw_stmt;". + "\n DECLARE_BOOST_TYPES(BoundParam);". + "\n struct BoundParam {". + "\n int type;". + "\n int index;". + "\n Variant value;". + "\n };". + "\n public: BoundParamPtrVec m_bound_params;" + ); + +c('sqlite3result', null, array(), + array( + m(PublicMethod, "__construct", null), + m(PublicMethod, "numColumns", Int64), + m(PublicMethod, "columnName", String, + array("column" => Int64)), + m(PublicMethod, "columnType", Int64, + array("column" => Int64)), + m(PublicMethod, "fetchArray", Variant, + array("mode" => array(Int64, "k_SQLITE3_BOTH"))), + m(PublicMethod, "reset", Boolean), + m(PublicMethod, "finalize", Boolean), + ), + array(), + "\n public: void validate() const;". + "\n public: p_sqlite3stmt m_stmt;" + ); diff --git a/src/idl/stream.idl.php b/src/idl/stream.idl.php new file mode 100644 index 0000000000000..86a8468a8e000 --- /dev/null +++ b/src/idl/stream.idl.php @@ -0,0 +1,186 @@ + array(VariantMap, 'null_array'), + 'params' => array(VariantMap, 'null_array'))); + +f('stream_context_get_default', Resource, + array('options' => array(VariantMap, 'null_array'))); + +f('stream_context_get_options', VariantMap, + array('stream_or_context' => Resource)); + +f('stream_context_set_option', Boolean, + array('stream_or_context' => Resource, + 'wrapper' => Variant, + 'option' => array(String, 'null_string'), + 'value' => array(Variant, 'null_variant'))); + +f('stream_context_set_param', Boolean, + array('stream_or_context' => Resource, + 'params' => VariantMap)); + +f('stream_copy_to_stream', Variant, + array('source' => Resource, + 'dest' => Resource, + 'maxlength' => array(Int32, '0'), + 'offset' => array(Int32, '0'))); + +f('stream_encoding', Boolean, + array('stream' => Resource, + 'encoding' => array(String, 'null_string'))); + +f('stream_bucket_append', NULL, + array('brigade' => Resource, + 'bucket' => Resource)); + +f('stream_bucket_prepend', NULL, + array('brigade' => Resource, + 'bucket' => Resource)); + +f('stream_bucket_make_writeable', Resource, + array('brigade' => Resource)); + +f('stream_bucket_new', Resource, + array('stream' => Resource, + 'buffer' => String)); + +f('stream_filter_register', Boolean, + array('filtername' => String, + 'classname' => String)); + +f('stream_filter_remove', Boolean, + array('stream_filter' => Resource)); + +f('stream_filter_append', Resource, + array('stream' => Resource, + 'filtername' => String, + 'read_write' => array(Int32, '0'), + 'params' => array(Variant, 'null_variant'))); + +f('stream_filter_prepend', Resource, + array('stream' => Resource, + 'filtername' => String, + 'read_write' => array(Int32, '0'), + 'params' => array(Variant, 'null_variant'))); + +f('stream_get_contents', Variant, + array('handle' => Resource, + 'maxlen' => array(Int32, '0'), + 'offset' => array(Int32, '0'))); + +f('stream_get_filters', StringVec); + +f('stream_get_line', Variant, + array('handle' => Resource, + 'length' => array(Int32, '0'), + 'ending' => array(String, 'null_string'))); + +f('stream_get_meta_data', VariantMap, + array('stream' => Resource)); + +f('stream_get_transports', StringVec); + +f('stream_get_wrappers', StringVec); + +f('stream_register_wrapper', Boolean, + array('protocol' => String, + 'classname' => String)); + +f('stream_wrapper_register', Boolean, + array('protocol' => String, + 'classname' => String)); + +f('stream_wrapper_restore', Boolean, + array('protocol' => String)); + +f('stream_wrapper_unregister', Boolean, + array('protocol' => String)); + +f('stream_resolve_include_path', String, + array('filename' => String, + 'context' => array(Resource, 'null_object'))); + +f('stream_select', Variant, + array('read' => VariantVec | Reference, + 'write' => VariantVec | Reference, + 'except' => VariantVec | Reference, + 'vtv_sec' => Variant, + 'tv_usec' => array(Int32, '0'))); + +f('stream_set_blocking', Boolean, + array('stream' => Resource, + 'mode' => Int32)); + +f('stream_set_timeout', Boolean, + array('stream' => Resource, + 'seconds' => Int32, + 'microseconds' => array(Int32, '0'))); + +f('stream_set_write_buffer', Int32, + array('stream' => Resource, + 'buffer' => Int32)); + +f('set_file_buffer', Int32, + array('stream' => Resource, + 'buffer' => Int32)); + +/////////////////////////////////////////////////////////////////////////////// +// socket functions + +f('stream_socket_accept', Variant, + array('server_socket' => Resource, + 'timeout' => array(Double, '0.0'), + 'peername' => array(String | Reference, 'null'))); + +f('stream_socket_server', Variant, + array('local_socket' => String, + 'errnum' => array(Int32 | Reference, 'null'), + 'errstr' => array(String | Reference, 'null'), + 'flags' => array(Int32, '0'), + 'context' => array(Resource, 'null_object'))); + +f('stream_socket_client', Variant, + array('remote_socket' => String, + 'errnum' => array(Int32 | Reference, 'null'), + 'errstr' => array(String | Reference, 'null'), + 'timeout' => array(Double, '0.0'), + 'flags' => array(Int32, '0'), + 'context' => array(Resource, 'null_object'))); + +f('stream_socket_enable_crypto', Variant, + array('stream' => Resource, + 'enable' => Boolean, + 'crypto_type' => array(Int32, '0'), + 'session_stream' => array(Resource, 'null_object'))); + +f('stream_socket_get_name', Variant, + array('handle' => Resource, + 'want_peer' => Boolean)); + +f('stream_socket_pair', Variant, + array('domain' => Int32, + 'type' => Int32, + 'protocol' => Int32)); + +f('stream_socket_recvfrom', Variant, + array('socket' => Resource, + 'length' => Int32, + 'flags' => array(Int32, '0'), + 'address' => array(String, 'null_string'))); + +f('stream_socket_sendto', Variant, + array('socket' => Resource, + 'data' => String, + 'flags' => array(Int32, '0'), + 'address' => array(String, 'null_string'))); + +f('stream_socket_shutdown', Boolean, + array('stream' => Resource, + 'how' => Int32)); + diff --git a/src/idl/string.idl.php b/src/idl/string.idl.php new file mode 100644 index 0000000000000..5cd6208b7559b --- /dev/null +++ b/src/idl/string.idl.php @@ -0,0 +1,369 @@ + String, 'charlist' => String)); +f('stripcslashes', String, array('str' => String)); +f('addslashes', String, array('str' => String)); +f('stripslashes', String, array('str' => String)); +f('bin2hex', String, array('str' => String)); +f('nl2br', String, array('str' => String)); +f('quotemeta', String, array('str' => String)); +f('str_shuffle', String, array('str' => String)); +f('strrev', String, array('str' => String)); +f('strtolower', String, array('str' => String)); +f('strtoupper', String, array('str' => String)); +f('ucfirst', String, array('str' => String)); +f('ucwords', String, array('str' => String)); + +f('strip_tags', String, + array('str' => String, + 'allowable_tags' => array(String, '""'))); + +f('trim', String, + array('str' => String, + 'charlist' => array(String, 'k_HPHP_TRIM_CHARLIST'))); + +f('ltrim', String, + array('str' => String, + 'charlist' => array(String, 'k_HPHP_TRIM_CHARLIST'))); + +f('rtrim', String, + array('str' => String, + 'charlist' => array(String, 'k_HPHP_TRIM_CHARLIST'))); + +f('chop', String, + array('str' => String, + 'charlist' => array(String, 'k_HPHP_TRIM_CHARLIST'))); + +f('explode', StringVec, + array('delimiter' => String, + 'str' => String, + 'limit' => array(Int32, '0x7FFFFFFF'))); + +f('implode', String, + array('arg1' => Variant, + 'arg2' => array(Variant, 'null_variant'))); + +f('join', String, + array('glue' => Variant, + 'pieces' => array(Variant, 'null_variant'))); + +f('str_split', StringVec, + array('str' => String, + 'split_length' => array(Int32, '1'))); + +f('chunk_split', String, + array('body' => String, + 'chunklen' => array(Int32, '76'), + 'end' => array(String, '"\r\n"'))); + +f('strtok', Variant, + array('str' => String, + 'token' => array(Variant, 'null_variant'))); + +f('str_replace', Variant, + array('search' => Variant, + 'replace' => Variant, + 'subject' => Variant, + 'count' => array(Int32 | Reference, 'null'))); + +f('str_ireplace', Variant, + array('search' => Variant, + 'replace' => Variant, + 'subject' => Variant, + 'count' => array(Int32 | Reference, 'null'))); + +f('substr_replace', Variant, + array('str' => Variant, + 'replacement' => Variant, + 'start' => Variant, + 'length' => array(Variant, '0x7FFFFFFF'))); + +f('substr', Variant, + array('str' => String, + 'start' => Int32, + 'length' => array(Int32, '0x7FFFFFFF'))); + +f('str_pad', String, + array('input' => String, + 'pad_length' => Int32, + 'pad_string' => array(String, '" "'), + 'pad_type' => array(Int32, 'k_STR_PAD_RIGHT'))); + +f('str_repeat', String, + array('input' => String, + 'multiplier' => Int32)); + +f('wordwrap', String, + array('str' => String, + 'width' => array(Int32, '75'), + 'wordbreak' => array(String, '"\n"'), + 'cut' => array(Boolean, 'false'))); + +/////////////////////////////////////////////////////////////////////////////// +// encoding/decoding + +f('html_entity_decode', String, + array('str' => String, + 'quote_style' => array(Int32, 'k_ENT_COMPAT'), + 'charset' => array(String, '""'))); + +f('htmlentities', String, + array('str' => String, + 'quote_style' => array(Int32, 'k_ENT_COMPAT'), + 'charset' => array(String, '""'), + 'double_encode' => array(Boolean, 'true'))); + +f('htmlspecialchars_decode', String, + array('str' => String, + 'quote_style' => array(Int32, 'k_ENT_COMPAT'))); + +f('htmlspecialchars', String, + array('str' => String, + 'quote_style' => array(Int32, 'k_ENT_COMPAT'), + 'charset' => array(String, '""'), + 'double_encode' => array(Boolean, 'true'))); + +f('quoted_printable_encode', String, + array('str' => String)); + +f('quoted_printable_decode', String, + array('str' => String)); + +f('convert_uudecode', Variant, + array('data' => String)); + +f('convert_uuencode', Variant, + array('data' => String)); + +f('str_rot13', String, + array('str' => String)); + +f('crc32', Int64, + array('str' => String)); + +f('crypt', String, + array('str' => String, + 'salt' => array(String, '""'))); + +f('md5', String, + array('str' => String, + 'raw_output' => array(Boolean, 'false'))); + +f('sha1', String, + array('str' => String, + 'raw_output' => array(Boolean, 'false'))); + +f('strtr', String, + array('str' => String, + 'from' => Variant, + 'to' => array(Variant, 'null_variant'))); + +f('convert_cyr_string', String, + array('str' => String, + 'from' => String, + 'to' => String)); + +f('get_html_translation_table', StringMap, + array('table' => array(Int32, '0'), + 'quote_style' => array(Int32, 'k_ENT_COMPAT'))); + +f('hebrev', String, + array('hebrew_text' => String, + 'max_chars_per_line' => array(Int32, '0'))); + +f('hebrevc', String, + array('hebrew_text' => String, + 'max_chars_per_line' => array(Int32, '0'))); + +f('setlocale', Variant, + array('category' => Int32, + 'locale' => Variant), + VariableArguments); + +f('localeconv', VariantMap); + +f('nl_langinfo', String, + array('item' => Int32)); + +/////////////////////////////////////////////////////////////////////////////// +// input/output + +f('echo', NULL, + array('arg' => String), VariableArguments); + +f('print', Int32, + array('arg' => String)); + +f('printf', Int32, + array('format' => String), VariableArguments); + +f('vprintf', Int32, + array('format' => String, + 'args' => VariantVec)); + +f('sprintf', String, + array('format' => String), VariableArguments); + +f('vsprintf', String, + array('format' => String, + 'args' => VariantVec)); + +f('sscanf', Variant, + array('str' => String, + 'format' => String), + ReferenceVariableArguments); + +f('chr', String, array('ascii' => Int64)); +f('ord', Int64, array('str' => String)); + +f('money_format', String, + array('format' => String, + 'number' => Double)); + +f('number_format', String, + array('number' => Double, + 'decimals' => array(Int32, '0'), + 'dec_point' => array(String, '"."'), + 'thousands_sep' => array(String, '","'))); + +/////////////////////////////////////////////////////////////////////////////// +// analysis + +f('strcmp', Int32, + array('str1' => String, + 'str2' => String)); + +f('strncmp', Int32, + array('str1' => String, + 'str2' => String, + 'len' => Int32)); + +f('strnatcmp', Int32, + array('str1' => String, + 'str2' => String)); + +f('strcasecmp', Int32, + array('str1' => String, + 'str2' => String)); + +f('strncasecmp', Int32, + array('str1' => String, + 'str2' => String, + 'len' => Int32)); + +f('strnatcasecmp', Int32, + array('str1' => String, + 'str2' => String)); + +f('strcoll', Int32, + array('str1' => String, + 'str2' => String)); + +f('substr_compare', Variant, + array('main_str' => String, + 'str' => String, + 'offset' => Int32, + 'length' => array(Int32, '0'), + 'case_insensitivity' => array(Boolean, 'false'))); + +f('strchr', Variant, + array('haystack' => String, + 'needle' => Variant)); + +f('strrchr', Variant, + array('haystack' => String, + 'needle' => Variant)); + +f('strstr', Variant, + array('haystack' => String, + 'needle' => Variant)); + +f('stristr', Variant, + array('haystack' => String, + 'needle' => Variant)); + +f('strpbrk', Variant, + array('haystack' => String, + 'char_list' => String)); + +f('strpos', Variant, + array('haystack' => String, + 'needle' => Variant, + 'offset' => array(Int32, '0'))); + +f('stripos', Variant, + array('haystack' => String, + 'needle' => Variant, + 'offset' => array(Int32, '0'))); + +f('strrpos', Variant, + array('haystack' => String, + 'needle' => Variant, + 'offset' => array(Int32, '-1'))); + +f('strripos', Variant, + array('haystack' => String, + 'needle' => Variant, + 'offset' => array(Int32, '-1'))); + +f('substr_count', Variant, + array('haystack' => String, + 'needle' => String, + 'offset' => array(Int32, '0'), + 'length' => array(Int32, '0x7FFFFFFF'))); + +f('strspn', Variant, + array('str1' => String, + 'str2' => String, + 'start' => array(Int32, '0'), + 'length' => array(Int32, '0x7FFFFFFF'))); + +f('strcspn', Variant, + array('str1' => String, + 'str2' => String, + 'start' => array(Int32, '0'), + 'length' => array(Int32, '0x7FFFFFFF'))); + +f('strlen', Int32, + array('str' => String)); + +f('count_chars', Variant, + array('str' => String, + 'mode' => array(Int64, '0'))); + +f('str_word_count', Variant, + array('str' => String, + 'format' => array(Int64, '0'), + 'charlist' => array(String, '""'))); + +f('levenshtein', Int32, + array('str1' => String, + 'str2' => String, + 'cost_ins' => array(Int32, '1'), + 'cost_rep' => array(Int32, '1'), + 'cost_del' => array(Int32, '1'))); + +f('similar_text', Int32, + array('first' => String, + 'second' => String, + 'percent' => array(Double | Reference, 'null'))); + +f('soundex', Variant, + array('str' => String)); + +f('metaphone', Variant, + array('str' => String, + 'phones' => array(Int32, '0'))); + +/////////////////////////////////////////////////////////////////////////////// +// special + +f('parse_str', NULL, + array('str' => String, + 'arr' => array(VariantMap | Reference, 'null'))); + diff --git a/src/idl/thread.idl.php b/src/idl/thread.idl.php new file mode 100644 index 0000000000000..b7bfb585d2c56 --- /dev/null +++ b/src/idl/thread.idl.php @@ -0,0 +1,12 @@ + Object, + 'method_name' => String, + 'msgtype' => Int64, + 'request_struct' => Object, + 'seqid' => Int32, + 'strict_write' => Boolean)); + +f('thrift_protocol_read_binary', Variant, + array('transportObj' => Object, + 'obj_typename' => String, + 'strict_read' => Boolean)); + +dyn('getTransport', 'flush', 'write', 'read'); diff --git a/src/idl/url.idl.php b/src/idl/url.idl.php new file mode 100644 index 0000000000000..baa0d825b0790 --- /dev/null +++ b/src/idl/url.idl.php @@ -0,0 +1,34 @@ + String, + 'strict' => array(Boolean, 'false'))); + +f('base64_encode', String, + array('data' => String)); + +f('get_headers', Variant, + array('url' => String, + 'format' => array(Int32, '0'))); + +f('get_meta_tags', StringVec, + array('filename' => String, + 'use_include_path' => array(Boolean, 'false'))); + +f('http_build_query', String, + array('formdata' => Variant, + 'numeric_prefix' => array(String, 'null_string'), + 'arg_separator' => array(String, '"&"'))); + +f('parse_url', Variant, + array('url' => String, + 'component' => array(Int32, '-1'))); + +f('rawurldecode', String, array('str' => String)); +f('rawurlencode', String, array('str' => String)); +f('urldecode', String, array('str' => String)); +f('urlencode', String, array('str' => String)); diff --git a/src/idl/variable.idl.php b/src/idl/variable.idl.php new file mode 100644 index 0000000000000..9f9d4cef61401 --- /dev/null +++ b/src/idl/variable.idl.php @@ -0,0 +1,65 @@ + Any), NoEffect); +f('is_int', Boolean, array('var' => Any), NoEffect); +f('is_integer', Boolean, array('var' => Any), NoEffect); +f('is_long', Boolean, array('var' => Any), NoEffect); +f('is_double', Boolean, array('var' => Any), NoEffect); +f('is_float', Boolean, array('var' => Any), NoEffect); +f('is_numeric', Boolean, array('var' => Any), NoEffect); +f('is_real', Boolean, array('var' => Any), NoEffect); +f('is_string', Boolean, array('var' => Any), NoEffect); +f('is_scalar', Boolean, array('var' => Any), NoEffect); +f('is_array', Boolean, array('var' => Any), NoEffect); +f('is_object', Boolean, array('var' => Any), NoEffect); +f('is_resource', Boolean, array('var' => Any), NoEffect); +f('is_null', Boolean, array('var' => Any), NoEffect); + +f('gettype', String, array('v' => Any)); +f('get_resource_type', String, array('handle' => Resource)); + +/////////////////////////////////////////////////////////////////////////////// +// type conversion + +f('intval', Int64, array('v' => Any, 'base' => array(Int64, '10'))); +f('doubleval', Double, array('v' => Any)); +f('floatval', Double, array('v' => Any)); +f('strval', String, array('v' => Any)); + +f('settype', Boolean, + array('var' => Variant | Reference, + 'type' => String)); + +/////////////////////////////////////////////////////////////////////////////// +// input/output + +f('print_r', Variant, + array('expression' => Any, + 'ret' => array(Boolean, 'false'))); +f('var_export', Variant, + array('expression' => Any, + 'ret' => array(Boolean, 'false'))); +f('var_dump', NULL, array('expression' => Any), VariableArguments); +f('debug_zval_dump', NULL, array('variable' => Any)); + +f('serialize', String, array('value' => Any)); +f('unserialize', Variant, array('str' => String)); + +/////////////////////////////////////////////////////////////////////////////// +// variable table + +f('get_defined_vars', VariantMap); + +f('import_request_variables', Boolean, + array('types' => String, + 'prefix' => array(String, '""'))); + +f('extract', Int32, + array('var_array' => VariantMap, + 'extract_type' => array(Int32, 'EXTR_OVERWRITE'), + 'prefix' => array(String, '""'))); diff --git a/src/idl/xml.idl.php b/src/idl/xml.idl.php new file mode 100644 index 0000000000000..176fed9914e32 --- /dev/null +++ b/src/idl/xml.idl.php @@ -0,0 +1,100 @@ + array(String, 'null_string'))); + +f('xml_parser_free', Boolean, + array('parser' => Resource)); + +f('xml_parse', Int32, + array('parser' => Resource, + 'data' => String, + 'is_final' => array(Boolean, 'true'))); + +f('xml_parse_into_struct', Int32, + array('parser' => Resource, + 'data' => String, + 'values' => StringVec | Reference, + 'index' => array(StringVec | Reference, 'null'))); + +f('xml_parser_create_ns', Resource, + array('encoding' => array(String, 'null_string'), + 'separator' => array(String, 'null_string'))); + +f('xml_parser_get_option', Variant, + array('parser' => Resource, + 'option' => Int32)); + +f('xml_parser_set_option', Boolean, + array('parser' => Resource, + 'option' => Int32, + 'value' => Variant)); + +f('xml_set_character_data_handler', Boolean, + array('parser' => Resource, + 'handler' => String)); + +f('xml_set_default_handler', Boolean, + array('parser' => Resource, + 'handler' => String)); + +f('xml_set_element_handler', Boolean, + array('parser' => Resource, + 'start_element_handler' => String, + 'end_element_handler' => String)); + +f('xml_set_processing_instruction_handler', Boolean, + array('parser' => Resource, + 'handler' => String)); + +f('xml_set_start_namespace_decl_handler', Boolean, + array('parser' => Resource, + 'handler' => String)); + +f('xml_set_end_namespace_decl_handler', Boolean, + array('parser' => Resource, + 'handler' => String)); + +f('xml_set_unparsed_entity_decl_handler', Boolean, + array('parser' => Resource, + 'handler' => String)); + +f('xml_set_external_entity_ref_handler', Boolean, + array('parser' => Resource, + 'handler' => String)); + +f('xml_set_notation_decl_handler', Boolean, + array('parser' => Resource, + 'handler' => String)); + +f('xml_set_object', Boolean, + array('parser' => Resource, + 'object' => Object | Reference)); + +f('xml_get_current_byte_index', Int32, + array('parser' => Resource)); + +f('xml_get_current_column_number', Int32, + array('parser' => Resource)); + +f('xml_get_current_line_number', Int32, + array('parser' => Resource)); + +f('xml_get_error_code', Int32, + array('parser' => Resource)); + +f('xml_error_string', String, + array('code' => Int32)); + +/////////////////////////////////////////////////////////////////////////////// +// utf8 + +f('utf8_decode', String, + array('data' => String)); + +f('utf8_encode', String, + array('data' => String)); diff --git a/src/idl/xmlwriter.idl.php b/src/idl/xmlwriter.idl.php new file mode 100644 index 0000000000000..069128f2de823 --- /dev/null +++ b/src/idl/xmlwriter.idl.php @@ -0,0 +1,309 @@ +"); +p("#include "); +p("#include "); +p("#include "); + +/////////////////////////////////////////////////////////////////////////////// +// function style + +f('xmlwriter_open_memory', Variant); + +f('xmlwriter_open_uri', Resource, + array('uri' => String)); + +f('xmlwriter_set_indent_string', Boolean, + array('xmlwriter' => Resource, + 'indentString' => String)); + +f('xmlwriter_set_indent', Boolean, + array('xmlwriter' => Resource, + 'indent' => Boolean)); + +f('xmlwriter_start_document', Boolean, + array('xmlwriter' => Resource, + 'version' => array(String, '"1.0"'), + 'encoding' => array(String, 'null_string'), + 'standalone' => array(String, 'null_string'))); + +f('xmlwriter_start_element', Boolean, + array('xmlwriter' => Resource, + 'name' => String)); + +f('xmlwriter_start_element_ns', Boolean, + array('xmlwriter' => Resource, + 'prefix' => String, + 'name' => String, + 'uri' => String)); + +f('xmlwriter_write_element_ns', Boolean, + array('xmlwriter' => Resource, + 'prefix' => String, + 'name' => String, + 'uri' => String, + 'content' => array(String, 'null_string'))); + +f('xmlwriter_write_element', Boolean, + array('xmlwriter' => Resource, + 'name' => String, + 'content' => array(String, 'null_string'))); + +f('xmlwriter_end_element', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_full_end_element', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_start_attribute_ns', Boolean, + array('xmlwriter' => Resource, + 'prefix' => String, + 'name' => String, + 'uri' => String)); + +f('xmlwriter_start_attribute', Boolean, + array('xmlwriter' => Resource, + 'name' => String)); + +f('xmlwriter_write_attribute_ns', Boolean, + array('xmlwriter' => Resource, + 'prefix' => String, + 'name' => String, + 'uri' => String, + 'content' => String)); + +f('xmlwriter_write_attribute', Boolean, + array('xmlwriter' => Resource, + 'name' => String, + 'value' => String)); + +f('xmlwriter_end_attribute', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_start_cdata', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_write_cdata', Boolean, + array('xmlwriter' => Resource, + 'content' => String)); + +f('xmlwriter_end_cdata', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_start_comment', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_write_comment', Boolean, + array('xmlwriter' => Resource, + 'content' => String)); + +f('xmlwriter_end_comment', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_end_document', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_start_pi', Boolean, + array('xmlwriter' => Resource, + 'target' => String)); + +f('xmlwriter_write_pi', Boolean, + array('xmlwriter' => Resource, + 'target' => String, + 'content' => String)); + +f('xmlwriter_end_pi', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_text', Boolean, + array('xmlwriter' => Resource, + 'content' => String)); + +f('xmlwriter_write_raw', Boolean, + array('xmlwriter' => Resource, + 'content' => String)); + +f('xmlwriter_start_dtd', Boolean, + array('xmlwriter' => Resource, + 'qualifiedName' => String, + 'publicId' => array(String, 'null_string'), + 'systemId' => array(String, 'null_string'))); + +f('xmlwriter_write_dtd', Boolean, + array('xmlwriter' => Resource, + 'name' => String, + 'publicId' => array(String, 'null_string'), + 'systemId' => array(String, 'null_string'), + 'subset' => array(String, 'null_string'))); + +f('xmlwriter_start_dtd_element', Boolean, + array('xmlwriter' => Resource, + 'qualifiedName' => String)); + +f('xmlwriter_write_dtd_element', Boolean, + array('xmlwriter' => Resource, + 'name' => String, + 'content' => String)); + +f('xmlwriter_end_dtd_element', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_start_dtd_attlist', Boolean, + array('xmlwriter' => Resource, + 'name' => String)); + +f('xmlwriter_write_dtd_attlist', Boolean, + array('xmlwriter' => Resource, + 'name' => String, + 'content' => String)); + +f('xmlwriter_end_dtd_attlist', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_start_dtd_entity', Boolean, + array('xmlwriter' => Resource, + 'name' => String, + 'isparam' => Boolean)); + +f('xmlwriter_write_dtd_entity', Boolean, + array('xmlwriter' => Resource, + 'name' => String, + 'content' => String, + 'pe' => array(Boolean, 'false'), + 'publicId' => array(String, 'null_string'), + 'systemId' => array(String, 'null_string'), + 'ndataid' => array(String, 'null_string'))); + +f('xmlwriter_end_dtd_entity', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_end_dtd', Boolean, + array('xmlwriter' => Resource)); + +f('xmlwriter_flush', Variant, + array('xmlwriter' => Resource, + 'empty' => array(Boolean, 'true'))); + +f('xmlwriter_output_memory', String, + array('xmlwriter' => Resource, + 'flush' => array(Boolean, 'true'))); + +/////////////////////////////////////////////////////////////////////////////// +// class style + +c('xmlwriter', null, array(), + array( + m(PublicMethod, "__construct"), + + m(PublicMethod, 'openMemory', Boolean), + m(PublicMethod, 'openURI', Boolean, + array('uri' => String)), + m(PublicMethod, 'setIndentString', Boolean, + array('indentString' => String)), + m(PublicMethod, 'setIndent', Boolean, + array('indent' => Boolean)), + m(PublicMethod, 'startDocument', Boolean, + array('version' => array(String, '"1.0"'), + 'encoding' => array(String, 'null_string'), + 'standalone' => array(String, 'null_string'))), + m(PublicMethod, 'startElement', Boolean, + array('name' => String)), + m(PublicMethod, 'startElementNS', Boolean, + array('prefix' => String, + 'name' => String, + 'uri' => String)), + m(PublicMethod, 'writeElementNS', Boolean, + array('prefix' => String, + 'name' => String, + 'uri' => String, + 'content' => array(String, 'null_string'))), + m(PublicMethod, 'writeElement', Boolean, + array('name' => String, + 'content' => array(String, 'null_string'))), + m(PublicMethod, 'endElement', Boolean), + m(PublicMethod, 'fullEndElement', Boolean), + m(PublicMethod, 'startAttributeNS', Boolean, + array('prefix' => String, + 'name' => String, + 'uri' => String)), + m(PublicMethod, 'startAttribute', Boolean, + array('name' => String)), + m(PublicMethod, 'writeAttributeNS', Boolean, + array('prefix' => String, + 'name' => String, + 'uri' => String, + 'content' => String)), + m(PublicMethod, 'writeAttribute', Boolean, + array('name' => String, + 'value' => String)), + m(PublicMethod, 'endAttribute', Boolean), + m(PublicMethod, 'startCData', Boolean), + m(PublicMethod, 'writeCData', Boolean, + array('content' => String)), + m(PublicMethod, 'endCData', Boolean), + m(PublicMethod, 'startComment', Boolean), + m(PublicMethod, 'writeComment', Boolean, + array('content' => String)), + m(PublicMethod, 'endComment', Boolean), + m(PublicMethod, 'endDocument', Boolean), + m(PublicMethod, 'startPI', Boolean, + array('target' => String)), + m(PublicMethod, 'writePI', Boolean, + array('target' => String, + 'content' => String)), + m(PublicMethod, 'endPI', Boolean), + m(PublicMethod, 'text', Boolean, + array('content' => String)), + m(PublicMethod, 'writeRaw', Boolean, + array('content' => String)), + m(PublicMethod, 'startDTD', Boolean, + array('qualifiedName' => String, + 'publicId' => array(String, 'null_string'), + 'systemId' => array(String, 'null_string'))), + m(PublicMethod, 'writeDTD', Boolean, + array('name' => String, + 'publicId' => array(String, 'null_string'), + 'systemId' => array(String, 'null_string'), + 'subset' => array(String, 'null_string'))), + m(PublicMethod, 'startDTDElement', Boolean, + array('qualifiedName' => String)), + m(PublicMethod, 'writeDTDElement', Boolean, + array('name' => String, + 'content' => String)), + m(PublicMethod, 'endDTDElement', Boolean), + m(PublicMethod, 'startDTDAttlist', Boolean, + array('name' => String)), + m(PublicMethod, 'writeDTDAttlist', Boolean, + array('name' => String, + 'content' => String)), + m(PublicMethod, 'endDTDAttlist', Boolean), + m(PublicMethod, 'startDTDEntity', Boolean, + array('name' => String, + 'isparam' => Boolean)), + m(PublicMethod, 'writeDTDEntity', Boolean, + array('name' => String, + 'content' => String, + 'pe' => array(Boolean, 'false'), + 'publicId' => array(String, 'null_string'), + 'systemId' => array(String, 'null_string'), + 'ndataid' => array(String, 'null_string'))), + m(PublicMethod, 'endDTDEntity', Boolean), + m(PublicMethod, 'endDTD', Boolean), + m(PublicMethod, 'flush', Variant, + array('empty' => array(Boolean, 'true'))), + m(PublicMethod, 'outputMemory', String, + array('flush' => array(Boolean, 'true'))), + ), + + array(), // constants + "\n public:". + "\n SmartObject m_uri;". + "\n private:". + "\n xmlTextWriterPtr m_ptr;". + "\n xmlBufferPtr m_output;". + "\n xmlOutputBufferPtr m_uri_output;" + ); + +/////////////////////////////////////////////////////////////////////////////// diff --git a/src/idl/zlib.idl.php b/src/idl/zlib.idl.php new file mode 100644 index 0000000000000..ef5c3fef93c71 --- /dev/null +++ b/src/idl/zlib.idl.php @@ -0,0 +1,94 @@ + String, + 'use_include_path' => array(Boolean, 'false'))); + +f('gzfile', Variant, + array('filename' => String, + 'use_include_path' => array(Boolean, 'false'))); + +f('gzcompress', Variant, + array('data' => String, + 'level' => array(Int32, '-1'))); + +f('gzuncompress', Variant, + array('data' => String, + 'limit' => array(Int32, '0'))); + +f('gzdeflate', Variant, + array('data' => String, + 'level' => array(Int32, '-1'))); + +f('gzinflate', Variant, + array('data' => String, + 'limit' => array(Int32, '0'))); + +f('gzencode', Variant, + array('data' => String, + 'level' => array(Int32, '-1'), + 'encoding_mode' => array(Int32, 'k_FORCE_GZIP'))); + +f('gzdecode', Variant, + array('data' => String)); + +f('zlib_get_coding_type', String); + +/////////////////////////////////////////////////////////////////////////////// +// stream functions + +f('gzopen', Resource, + array('filename' => String, + 'mode' => String, + 'use_include_path' => array(Boolean, 'false'))); + +f('gzclose', Boolean, + array('zp' => Resource)); + +f('gzrewind', Boolean, + array('zp' => Resource)); + +f('gzeof', Boolean, + array('zp' => Resource)); + +f('gzgetc', Variant, + array('zp' => Resource)); + +f('gzgets', String, + array('zp' => Resource, + 'length' => array(Int64, '1024'))); + +f('gzgetss', String, + array('zp' => Resource, + 'length' => array(Int64, '0'), + 'allowable_tags' => array(String, 'null_string'))); + +f('gzread', Variant, + array('zp' => Resource, + 'length' => array(Int64, '0'))); + +f('gzpassthru', Variant, + array('zp' => Resource)); + +f('gzseek', Variant, + array('zp' => Resource, + 'offset' => Int64, + 'whence' => array(Int64, 'SEEK_SET'))); + +f('gztell', Variant, + array('zp' => Resource)); + +f('gzwrite', Variant, + array('zp' => Resource, + 'str' => String, + 'length' => array(Int64, '0'))); + +f('gzputs', Variant, + array('zp' => Resource, + 'str' => String, + 'length' => array(Int64, '0'))); diff --git a/src/java.mk b/src/java.mk new file mode 100644 index 0000000000000..f257e5d3c596d --- /dev/null +++ b/src/java.mk @@ -0,0 +1,14 @@ +JAVA_PATH = /usr/local/jdk-6u7-64 +JAVA_FFI_CP = $(HPHP_HOME)/src/ffi/java/classes + +JAVA_CLASSES = \ + $(shell find ffi -name '*.java' | sed -e 's/\.java/\.class/g') + +#include $(HPHP_HOME)/src/rules.mk + +all : $(JAVA_CLASSES) + +%.class: %.java + cd ffi && \ + $(JAVA_PATH)/bin/javac -cp $(JAVA_FFI_CP):. -sourcepath . \ + $(patsubst ffi/%, %, $^) diff --git a/src/lib/Makefile b/src/lib/Makefile new file mode 100644 index 0000000000000..973e2fb3f8c33 --- /dev/null +++ b/src/lib/Makefile @@ -0,0 +1,53 @@ + +PROJECT_ROOT = ../.. +PROJECT_NAME = hphp_analysis + +AUTO_SOURCES = 1 +SOURCE_SUBDIRS = expression statement analysis system util + +GENERATED_CPP_SOURCES = parser/lex.yy.c parser/hphp.tab.c +CXX_SOURCES = $(wildcard parser/*.cpp) +INTERMEDIATE_FILES = $(wildcard parser/*~) $(wildcard parser/*.d) \ + parser/hphp.tab.h parser/hphp.tab.c parser/lex.yy.c + +include $(PROJECT_ROOT)/src/rules.mk +TARGETS = $(STATIC_LIB) +all: $(TARGETS) + +parser/lex.yy.c: parser/hphp.x parser/hphp.tab.c + @echo "Generating scanner code..." + @cd parser && flex -w -i hphp.x + +parser/hphp.tab.c: parser/hphp.y + @echo "Generating parser code..." + @cd parser && bison -d hphp.y + +parser/ylmm/basic_scanner.hh: \ + parser/ylmm/basic_buffer.hh \ + parser/ylmm/basic_location.hh \ + parser/ylmm/basic_messenger.hh \ + +parser/ylmm/basic_parser.hh: \ + parser/ylmm/basic_location.hh \ + parser/ylmm/basic_messenger.hh \ + +ERROR_INC := analysis/core_code_error.inc +DEPENDENCY_INC := analysis/core_dependency.inc +HOOK_RULE_FILE = $(wildcard hook.mk) +ifneq ($(strip $(HOOK_RULE_FILE)),) + include hook.mk +endif + +$(PROJECT_ROOT)/src/lib/analysis/code_error.inc: $(ERROR_INC) + @cat $^ > $@ + +$(PROJECT_ROOT)/src/lib/analysis/dependency.inc: $(DEPENDENCY_INC) + @cat $^ > $@ + +$(OBJECTS): $(PROJECT_ROOT)/src/lib/analysis/code_error.inc +$(OBJECTS): $(PROJECT_ROOT)/src/lib/analysis/dependency.inc + +clobber: + @rm -f analysis/code_error.inc + @rm -f analysis/dependency.inc + @rm -f $(INTERMEDIATE_FILES) diff --git a/src/lib/analysis/analysis_result.cpp b/src/lib/analysis/analysis_result.cpp new file mode 100644 index 0000000000000..77a727cfcb80e --- /dev/null +++ b/src/lib/analysis/analysis_result.cpp @@ -0,0 +1,2741 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// initialization + +AnalysisResult::AnalysisResult() + : BlockScope("Root", StatementPtr(), BlockScope::ProgramScope), + m_package(NULL), m_parseOnDemand(false), m_phase(AnalyzeInclude), + m_newlyInferred(0), m_dynamicClass(false), m_dynamicFunction(false), + m_classForcedVariants(false), m_optCounter(0), + m_scalarArraysCounter(0), m_paramRTTICounter(0), + m_scalarArraySortedAvgLen(0), m_scalarArraySortedIndex(0), + m_scalarArraySortedSumLen(0), m_scalarArrayCompressedTextSize(0) { + m_dependencyGraph = DependencyGraphPtr(new DependencyGraph()); + m_insideScalarArray = false; +} + +void AnalysisResult::appendExtraCode(const std::string &code) { + if (m_extraCode.empty()) { + m_extraCode = "getName()); + ASSERT(iter == m_files.end()); + m_files[fileScope->getName()] = fileScope; + vertex_descriptor vertex = add_vertex(m_depGraph); + fileScope->setVertex(vertex); + m_fileVertMap[vertex] = fileScope; + m_fileScopes.push_back(fileScope); +} + +FileScopePtr AnalysisResult::findFileScope(const std::string &name, + bool parseOnDemand) { + StringToFileScopePtrMap::const_iterator iter = m_files.find(name); + if (iter != m_files.end()) return iter->second; + + if (parseOnDemand && + Option::PackageExcludeFiles.find(name) != + Option::PackageExcludeFiles.end()) { + return FileScopePtr(); + } + + FileScopePtr curr = m_file; + if (parseOnDemand && m_parseOnDemand && + m_package && m_package->parse(name.c_str())) { + m_file = curr; + iter = m_files.find(name); + ASSERT(iter != m_files.end()); + return iter->second; + } + return FileScopePtr(); +} + +void AnalysisResult::pushScope(BlockScopePtr scope) { + m_scope = scope; + m_scopes.push_back(scope); + if (scope->is(BlockScope::FileScope)) { + m_file = dynamic_pointer_cast(scope); + } +} + +void AnalysisResult::popScope() { + ASSERT(!m_scopes.empty()); + m_scopes.pop_back(); + if (m_scopes.empty()) { + m_scope.reset(); + } else { + m_scope = m_scopes.back(); + } +} + +ClassScopePtr AnalysisResult::getClassScope() const { + for (int i = m_scopes.size() - 1; i >= 0; i--) { + ClassScopePtr classScope = + dynamic_pointer_cast(m_scopes[i]); + if (classScope) return classScope; + } + return ClassScopePtr(); +} + +FunctionScopePtr AnalysisResult::getFunctionScope() const { + return dynamic_pointer_cast(getScope()); +} + +ClassScopePtr AnalysisResult::resolveClass(std::string &className) { + // resolving self and parent + if (className == "self") { + ClassScopePtr cls = getClassScope(); + if (cls) className = cls->getName(); + } else if (className == "parent") { + ClassScopePtr cls = getClassScope(); + if (cls && !cls->getParent().empty()) { + className = cls->getParent(); + } + } + return findClass(className); +} + +FunctionScopePtr AnalysisResult::findFunction(const std::string &funcName) { + StringToFunctionScopePtrVecMap::const_iterator bit = + m_functions.find(funcName); + if (bit != m_functions.end()) { + return bit->second[0]; + } + StringToFunctionScopePtrVecMap::const_iterator iter = + m_functionDecs.find(funcName); + if (iter != m_functionDecs.end()) { + return iter->second.back(); + } + return FunctionScopePtr(); +} + +FunctionScopePtr AnalysisResult::findHelperFunction(const std::string &funcName) { + StringToFunctionScopePtrVecMap::const_iterator bit = + m_helperFunctions.find(funcName); + if (bit != m_helperFunctions.end()) { + return bit->second[0]; + } + return FunctionScopePtr(); +} + +BlockScopePtr AnalysisResult::findConstantDeclarer(const std::string &name) { + if (getConstants()->isPresent(name)) return shared_from_this(); + StringToFileScopePtrMap::const_iterator iter = m_constDecs.find(name); + if (iter != m_constDecs.end()) return iter->second; + return BlockScopePtr(); +} + +ClassScopePtr AnalysisResult::findClass(const std::string &name, + FindClassBy by /* = ClassName */) { + AnalysisResultPtr ar = shared_from_this(); + if (by == PropertyName) return ClassScopePtr(); + + if (by == MethodName) { + StringToClassScopePtrVecMap::iterator iter = + m_methodToClassDecs.find(name); + if (iter != m_methodToClassDecs.end()) { + if (iter->second.size() == 1) { + iter->second[0]->findFunction(ar, name, true)->setDynamic(); + return ClassScopePtr(); + } else { + // The call to findClass by method name means all these + // same-named methods should be dynamic since there will + // be an invoke to call one of them. + BOOST_FOREACH(ClassScopePtr cls, iter->second) { + FunctionScopePtr func = cls->findFunction(ar, name, true); + // Something fishy here + if (func) { + func->setDynamic(); + } + } + iter->second.clear(); + } + } + } else { + StringToClassScopePtrMap::const_iterator sysIter = + m_systemClasses.find(name); + if (sysIter != m_systemClasses.end()) return sysIter->second; + + StringToClassScopePtrVecMap::const_iterator iter = m_classDecs.find(name); + if (iter != m_classDecs.end()) { + return iter->second.back(); + } + } + return ClassScopePtr(); +} + +const ClassScopePtrVec &AnalysisResult::findClasses(const std::string &name) { + return m_classDecs[name]; +} + +bool AnalysisResult::classMemberExists(const std::string &name, + FindClassBy by) { + if (by == MethodName) { + return m_methodToClassDecs.find(name) != m_methodToClassDecs.end(); + } + return m_classDecs.find(name) != m_classDecs.end(); +} + +FunctionContainerPtr AnalysisResult::getFunctionContainer() { + ClassScopePtr cls = getClassScope(); + if (cls) return cls; + return getFileScope(); +} + +int AnalysisResult::getFunctionCount() const { + int total = 0; + for (StringToFileScopePtrMap::const_iterator iter = m_files.begin(); + iter != m_files.end(); ++iter) { + total += iter->second->getFunctionCount(); + } + return total; +} + +int AnalysisResult::getClassCount() const { + int total = 0; + for (StringToFileScopePtrMap::const_iterator iter = m_files.begin(); + iter != m_files.end(); ++iter) { + total += iter->second->getClassCount(); + } + return total; +} + +void AnalysisResult::countReturnTypes(std::map &counts) { + for (StringToFileScopePtrMap::const_iterator iter = m_files.begin(); + iter != m_files.end(); ++iter) { + iter->second->countReturnTypes(counts); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +bool AnalysisResult::declareFunction(FunctionScopePtr funcScope) { + string fname = funcScope->getName(); + // System functions override + if (m_functions.find(fname) != m_functions.end()) { + return false; + } + + FunctionScopePtrVec &funcs = m_functionDecs[fname]; + if (funcs.size() == 1) { + funcs[0]->setRedeclaring(0); + getCodeError()->record(CodeError::DeclaredFunctionTwice, + funcs[0]->getStmt(), + funcScope->getStmt()); + } + if (funcs.size() > 0 || + Option::DynamicInvokeFunctions.find(fname) != + Option::DynamicInvokeFunctions.end()) { + funcScope->setRedeclaring(funcs.size()); + } + funcs.push_back(funcScope); + return true; +} + +bool AnalysisResult::declareClass(ClassScopePtr classScope) { + string cname = classScope->getName(); + // System classes override + if (m_systemClasses.find(cname) != m_systemClasses.end()) { + return false; + } + AnalysisResultPtr ar = shared_from_this(); + ClassScopePtrVec &classes = m_classDecs[cname]; + if (classes.size() == 1) { + classes[0]->setRedeclaring(ar, 0); + getCodeError()->record(CodeError::DeclaredClassTwice, + classScope->getStmt(), + classes[0]->getStmt(), + classScope->getName().c_str()); + } + if (classes.size() > 0) { + classScope->setRedeclaring(ar, classes.size()); + } + if (m_classForcedVariants) { + classScope->getVariables()->forceVariants(ar); + } + classes.push_back(classScope); + return true; +} + +bool AnalysisResult::declareConst(FileScopePtr fs, const string& name) { + if (getConstants()->isPresent(name) || + m_constDecs.find(name) != m_constDecs.end()) { + m_constRedeclared.insert(name); + return false; + } else { + m_constDecs[name] = fs; + return true; + } +} + +////// Dependencies ///////////////////////////////////// + +void AnalysisResult::link(FileScopePtr user, FileScopePtr provider) { + if (user != provider) { + add_edge(user->vertex(), provider->vertex(), m_depGraph); + } +} + +bool AnalysisResult::addClassDependency(FileScopePtr usingFile, + const std::string &className) { + if (BuiltinSymbols::s_classes.find(className) != + BuiltinSymbols::s_classes.end()) + return true; + + StringToClassScopePtrVecMap::const_iterator iter = + m_classDecs.find(className); + if (iter == m_classDecs.end() || iter->second.size() != 1) return false; + ClassScopePtr classScope = iter->second[0]; + FileScopePtr fileScope = classScope->getFileScope(); + link(usingFile, fileScope); + return true; +} +bool AnalysisResult::addFunctionDependency(FileScopePtr usingFile, + const std::string &functionName) { + if (BuiltinSymbols::s_functions.find(functionName) != + BuiltinSymbols::s_functions.end()) + return true; + StringToFunctionScopePtrVecMap::const_iterator iter = + m_functionDecs.find(functionName); + if (iter == m_functionDecs.end() || + iter->second.size() != 1) return false; + FunctionScopePtr functionScope = iter->second[0]; + FileScopePtr fileScope = functionScope->getFileScope(); + link(usingFile, fileScope); + return true; +} +bool AnalysisResult::addIncludeDependency(FileScopePtr usingFile, + const std::string &includeFilename) { + ASSERT(!includeFilename.empty()); + FileScopePtr fileScope = findFileScope(includeFilename, true); + if (fileScope) { + link(usingFile, fileScope); + return true; + } else { + return false; + } +} +bool AnalysisResult::addConstantDependency(FileScopePtr usingFile, + const std::string &constantName) { + if (m_constants->isPresent(constantName)) + return true; + + StringToFileScopePtrMap::const_iterator iter = m_constDecs.find(constantName); + if (iter == m_constDecs.end()) return false; + FileScopePtr fileScope = iter->second; + link(usingFile, fileScope); + return true; +} + +bool AnalysisResult::isConstantDeclared(const std::string &constName) { + if (m_constants->isPresent(constName)) return true; + StringToFileScopePtrMap::const_iterator iter = m_constDecs.find(constName); + if (iter == m_constDecs.end()) return false; + FileScopePtr fileScope = iter->second; + ConstantTablePtr constants = fileScope->getConstants(); + ConstructPtr decl = constants->getValue(constName); + if (decl) return true; + return false; +} + +bool AnalysisResult::isConstantRedeclared(const std::string &constName) { + return m_constRedeclared.find(constName) != m_constRedeclared.end(); +} + +void AnalysisResult::addCallee(StatementPtr stmt) { + if (m_calleesAdded.find(stmt) == m_calleesAdded.end()) { + m_callees.push_back(stmt); + m_calleesAdded.insert(stmt); + } +} + +///// Program //////////////////////////// + +void AnalysisResult::loadBuiltins() { + AnalysisResultPtr ar = shared_from_this(); + BuiltinSymbols::loadFunctions(ar, m_functions); + BuiltinSymbols::loadHelperFunctions(ar, m_helperFunctions); + BuiltinSymbols::loadClasses(ar, m_systemClasses); + BuiltinSymbols::loadVariables(ar, m_variables); + BuiltinSymbols::loadConstants(ar, m_constants); +} + +void AnalysisResult::analyzeProgram() { + AnalysisResultPtr ar = shared_from_this(); + + getVariables()->forceVariants(ar); + getVariables()->setAttribute(VariableTable::ContainsLDynamicVariable); + getVariables()->setAttribute(VariableTable::ContainsExtract); + pushScope(ar); + + // Analyze Includes + Logger::Verbose("Analyzing Includes"); + setPhase(AnalysisResult::AnalyzeInclude); + unsigned int i; + for (i = 0; i < m_fileScopes.size(); i++) { + m_fileScopes[i]->analyzeProgram(ar); + } + if (!m_extraCode.empty()) { + string filename = Option::LambdaPrefix + "lambda"; + Parser::parseString(m_extraCode.c_str(), ar, filename.c_str()); + } + for (; i < m_fileScopes.size(); i++) { + m_fileScopes[i]->analyzeProgram(ar); + } + + // Analyze All + Logger::Verbose("Analyzing All"); + setPhase(AnalysisResult::AnalyzeAll); + for (i = 0; i < m_fileScopes.size(); i++) { + m_fileScopes[i]->analyzeProgram(ar); + } + + // Collect methods + string cname; + ClassScopePtr cls; + for (StringToClassScopePtrVecMap::const_iterator iter = m_classDecs.begin(); + iter != m_classDecs.end(); ++iter) { + BOOST_FOREACH(cls, iter->second) { + if (cls->isRedeclaring()) { + cls->setStaticDynamic(ar); + } + StringToFunctionScopePtrMap methods; + cls->collectMethods(ar, methods); + bool needAbstractMethodImpl = + (!cls->isAbstract() && !cls->isInterface()); + for (StringToFunctionScopePtrMap::const_iterator iterMethod = + methods.begin(); iterMethod != methods.end(); ++iterMethod) { + FunctionScopePtr func = iterMethod->second; + if (!func->hasImpl() && needAbstractMethodImpl) { + FunctionScopePtr tmpFunc = + cls->findFunction(ar, func->getName(), true, true); + if (!tmpFunc || !tmpFunc->hasImpl()) { + getCodeError()->record(CodeError::MissingAbstractMethodImpl, + cls->getStmt(), func->getStmt()); + } + } + m_methodToClassDecs[iterMethod->first].push_back(cls); + } + } + } + BOOST_FOREACH(tie(cname, cls), m_systemClasses) { + StringToFunctionScopePtrMap methods; + cls->collectMethods(ar, methods); + for (StringToFunctionScopePtrMap::const_iterator iterMethod = + methods.begin(); iterMethod != methods.end(); ++iterMethod) { + m_methodToClassDecs[iterMethod->first].push_back(cls); + } + } +} + + +void AnalysisResult::analyzeProgramFinal() { + AnalysisResultPtr ar = shared_from_this(); + setPhase(AnalysisResult::AnalyzeFinal); + for (uint i = 0; i < m_fileScopes.size(); i++) { + m_fileScopes[i]->analyzeProgram(ar); + } +} + +void AnalysisResult::inferTypes(int maxPass /* = 100 */) { + AnalysisResultPtr ar = shared_from_this(); + setPhase(FirstInference); + int lastInferred = 0; + bool lastInference = false; + for (int i = 0; i < maxPass; i++) { + m_newlyInferred = 0; + for (StringToFileScopePtrMap::const_iterator iter = m_files.begin(); + iter != m_files.end(); ++iter) { + FileScopePtr file = iter->second; + pushScope(file); + file->inferTypes(ar); + popScope(); + } + if (lastInference) { + return; + } + if (i > 1 && m_newlyInferred == 0 /* lastInferred */) { + lastInference = true; + } + lastInferred = m_newlyInferred; + Logger::Verbose("newly inferred types: %d", m_newlyInferred); + if (lastInference) { + setPhase(LastInference); + } else { + setPhase(i == 0 ? SecondInference : MoreInference); + } + } + ASSERT(false); +} + +/////////////////////////////////////////////////////////////////////////////// +// optimization functions + +void AnalysisResult::preOptimize(int maxPass /* = 100 */) { + AnalysisResultPtr ar = shared_from_this(); + int lastOptCounter; + int i; + setPhase(FirstPreOptimize); + while (true) { + for (i = 0; i < maxPass; i++) { + lastOptCounter = m_optCounter; + for (StringToFileScopePtrMap::const_iterator iter = m_files.begin(); + iter != m_files.end(); ++iter) { + FileScopePtr file = iter->second; + pushScope(file); + file->preOptimize(ar); + popScope(); + } + if (lastOptCounter == m_optCounter) break; + } + ASSERT(i <= 2); + if (m_phase == FirstPreOptimize) { + setPhase(SecondPreOptimize); + } else { + break; + } + } +} + +void AnalysisResult::postOptimize(int maxPass /* = 100 */) { + AnalysisResultPtr ar = shared_from_this(); + setPhase(AnalysisResult::PostOptimize); + int lastOptCounter; + int i; + for (i = 0; i < maxPass; i++) { + lastOptCounter = m_optCounter; + for (StringToFileScopePtrMap::const_iterator iter = m_files.begin(); + iter != m_files.end(); ++iter) { + FileScopePtr file = iter->second; + pushScope(file); + file->postOptimize(ar); + popScope(); + } + if (lastOptCounter == m_optCounter) break; + } + ASSERT(i <= 100); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +int AnalysisResult::registerScalarArray(ExpressionPtr pairs) { + if (!Option::ScalarArrayOptimization || m_insideScalarArray) { + return -1; + } + + string text; + if (pairs) { + text = pairs->getText(); + } + std::map::const_iterator iter = m_scalarArrays.find(text); + if (iter != m_scalarArrays.end()) return iter->second; + int id = m_scalarArraysCounter++; + m_scalarArrays[text] = id; + m_scalarArrayIds.push_back(pairs); + return id; +} + +bool AnalysisResult::getInsideScalarArray() { + return m_insideScalarArray; +} + +void AnalysisResult::setInsideScalarArray(bool flag) { + m_insideScalarArray = flag; +} + +string AnalysisResult::prepareFile(const char *root, const string &fileName, + bool chop) { + string fullPath = root; + if (!fullPath.empty() && fullPath[fullPath.size() - 1] != '/') { + fullPath += "/"; + } + + string file = fileName; + size_t npos = file.rfind('/'); + if (npos != string::npos) { + file = file.substr(npos + 1); + } + + if (chop && file.size() > 4 && file.substr(file.length() - 4) == ".php") { + fullPath += file.substr(0, file.length() - 4); + } else { + fullPath += file; + } + for (int pos = strlen(root); pos < (int)fullPath.size(); pos++) { + if (fullPath[pos] == '/') { + mkdir(fullPath.substr(0, pos).c_str(), 0777); + } + } + return fullPath; +} + +void AnalysisResult::forceClassVariants() { + if (m_classForcedVariants) { + return; + } + m_classForcedVariants = true; + + AnalysisResultPtr ar = shared_from_this(); + for (StringToClassScopePtrVecMap::const_iterator iter = m_classDecs.begin(); + iter != m_classDecs.end(); ++iter) { + BOOST_FOREACH(ClassScopePtr cls, iter->second) { + cls->getVariables()->forceVariants(ar); + } + } +} + +void AnalysisResult::forceClassVariants(const std::string &name) { + if (m_classForcedVariants) { + return; + } + + AnalysisResultPtr ar = shared_from_this(); + for (StringToClassScopePtrVecMap::const_iterator iter = m_classDecs.begin(); + iter != m_classDecs.end(); ++iter) { + BOOST_FOREACH(ClassScopePtr cls, iter->second) { + cls->getVariables()->forceVariant(ar, name); + } + } +} + +bool AnalysisResult::outputAllPHP(CodeGenerator::Output output) { + AnalysisResultPtr ar = shared_from_this(); + switch (output) { + case CodeGenerator::PickledPHP: + for (StringToFileScopePtrMap::const_iterator iter = m_files.begin(); + iter != m_files.end(); ++iter) { + string fullPath = prepareFile(m_outputPath.c_str(), iter->first, false); + ofstream f(fullPath.c_str()); + if (f) { + CodeGenerator cg(&f, output); + cg.printf("second->getStmt()->outputPHP(cg, ar); + f.close(); + } else { + Logger::Error("Unable to open %s for write", fullPath.c_str()); + } + } + return true; // we are done + default: + ASSERT(false); + } + + CodeErrorPtr codeError = getCodeError(); + if (codeError->exists(CodeError::DeclaredFunctionTwice)) { + Logger::Error("Same function was declared twice." + "\nCheck CodeError.js under DeclaredFunctionTwice."); + return false; + } + if (codeError->exists(CodeError::DeclaredClassTwice)) { + Logger::Error("Same class was declared twice." + "\nCheck CodeError.js under DeclaredClassTwice."); + return false; + } + if (codeError->exists(CodeError::BadPHPIncludeFile)) { + Logger::Error("There are some bad include_once or require_once statements." + "\nCheck CodeError.js under BadPHPIncludeFile."); + return false; + } + + return true; +} + +void AnalysisResult::getTrueDeps(FileScopePtr f, + map &trueDeps) { + adjacency_iterator adj, adjEnd; + for (tie(adj, adjEnd) = adjacent_vertices(f->vertex(), m_depGraph); + adj != adjEnd; adj++) { + VertexToFileScopePtrMap::const_iterator iter = m_fileVertMap.find(*adj); + ASSERT(iter != m_fileVertMap.end()); + trueDeps[iter->second->getName()] = iter->second; + } +} + +void AnalysisResult::clusterByFileSizes(StringToFileScopePtrVecMap &clusters, + int clusterCount) { + ASSERT(clusterCount > 0); + + std::map sortedFiles; + long totalSize = 0; + BOOST_FOREACH(FileScopePtr f, m_fileScopes) { + totalSize += f->getSize(); + sortedFiles[f->getName()] = f; + } + + const int FUZZYNESS = 1024; // 1kB + + int clusterSize = totalSize / clusterCount; + int size = 0; + int count = 1; + string clusterName = Option::FormatClusterFile(count); + FileScopePtrVec largeFiles; + for (std::map::const_iterator iter = + sortedFiles.begin(); iter != sortedFiles.end(); ++iter) { + FileScopePtr f = iter->second; + if (f->getSize() > clusterSize) { + largeFiles.push_back(f); + } else { + size += f->getSize(); + if ((size / FUZZYNESS) > (clusterSize / FUZZYNESS)) { + clusterName = Option::FormatClusterFile(++count); + size = f->getSize(); + } + clusters[clusterName].push_back(f); + } + } + for (unsigned int i = 0; i < largeFiles.size(); i++) { + clusters[Option::FormatClusterFile(++count)].push_back(largeFiles[i]); + } +} + +void AnalysisResult::repartitionCPP(const string &filename, int64 targetSize, + bool insideHPHP) { + struct stat results; + if (stat(filename.c_str(), &results)) { + // error, shouldn't happen + return; + } + int64 size = (int64)results.st_size; + if (size <= targetSize * 2) { + // tolerable size + return; + } + + vector includes; + vector preface; + bool inPreface = false; + string line; + int64 current = 0; + int seq = 0; + ifstream fin(filename.c_str()); + string base = filename.substr(0, filename.length() - 4); + char foutName[PATH_MAX]; + snprintf(foutName, sizeof(foutName), "%s-%d.cpp", base.c_str(), seq); + ofstream fout(foutName); + while (getline(fin, line)) { + fout << line << endl; + current += line.length() + 1; + if (inPreface) preface.push_back(line); + + if (line[0] == '#') { + includes.push_back(line); + } else if (line == "/* preface starts */") { + inPreface = true; + preface.clear(); + preface.push_back(line); + } else if (line == "/* preface finishes */") { + inPreface = false; + } else if (line == "} /* function */") { + // a possible cut point + if (current > targetSize) { + if (insideHPHP) { + // namespace HPHP + fout << "}" << endl; + } + + fout.close(); + snprintf(foutName, sizeof(foutName), + "%s-%d.cpp", base.c_str(), ++seq); + fout.open(foutName); + current = 0; + for (unsigned int j = 0; j < includes.size(); j++) { + fout << includes[j] << endl; + } + if (insideHPHP) { + fout << "namespace HPHP {" << endl; + } + for (unsigned int j = 0; j < preface.size(); j++) { + fout << preface[j] << endl; + } + } + } + } + fout.close(); + + fin.close(); + remove(filename.c_str()); +} + +void AnalysisResult::repartitionLargeCPP(const vector &filenames, + const vector &additionals) { + int64 totalSize = 0; + int count = 0; + for (unsigned int i = 0; i < filenames.size(); i++) { + struct stat results; + if (stat(filenames[i].c_str(), &results) == 0) { + totalSize += results.st_size; + count++; + } + } + int64 averageSize = totalSize / count; + for (unsigned int i = 0; i < filenames.size(); i++) { + repartitionCPP(filenames[i], averageSize, true); + } + for (unsigned int i = 0; i < additionals.size(); i++) { + repartitionCPP(additionals[i], averageSize, false); + } +} + +void AnalysisResult::outputAllCPP(CodeGenerator::Output output, + int clusterCount, + const std::string *compileDir) { + if (output == CodeGenerator::SystemCPP) { + Option::GenerateCPPMain = false; + outputCPPSystem(); + } + + FileScopePtrVec trueDeps; + StringToFileScopePtrVecMap clusters; + if (clusterCount > 0) { + clusterByFileSizes(clusters, clusterCount); + } else { + BOOST_FOREACH(FileScopePtr f, m_fileScopes) { + clusters[f->outputFilebase()].push_back(f); + } + } + + if (Option::GenerateCPPMacros && output != CodeGenerator::SystemCPP) { + // system functions are currently unchanged + createGlobalFuncTable(); + } + + vector filenames; + + AnalysisResultPtr ar = shared_from_this(); + string root = getOutputPath() + "/"; + for (StringToFileScopePtrVecMap::const_iterator iter = clusters.begin(); + iter != clusters.end(); ++iter) { + // for each cluster, generate one implementation file + Util::mkdir(root + iter->first); + string filename = root + iter->first + ".cpp"; + filenames.push_back(filename); + ofstream f(filename.c_str()); + if (compileDir) { + // this is the file that will be compiled, so we need to use this + // for source info: + filename = *compileDir + "/" + iter->first + ".cpp"; + } + CodeGenerator cg(&f, output, &filename); + outputCPPClusterImpl(cg, iter->second); + f.close(); + + // for each file, generate one header and a list of class headers + BOOST_FOREACH(FileScopePtr fs, iter->second) { + string fileBase = fs->outputFilebase(); + Util::mkdir(root + fileBase); + string header = fileBase + ".h"; + string fwheader = fileBase + ".fw.h"; + string fileHeader = root + header; + string fwFileHeader = root + fwheader; + { + ofstream f(fwFileHeader.c_str()); + CodeGenerator cg(&f, output); + fs->outputCPPForwardDeclHeader(cg, ar); + f.close(); + } + { + ofstream f(fileHeader.c_str()); + CodeGenerator cg(&f, output); + fs->outputCPPDeclHeader(cg, ar); + f.close(); + } + } + + // for each file, generate one list of class headers + BOOST_FOREACH(FileScopePtr fs, iter->second) { + fs->outputCPPClassHeaders(ar, output); + } + } + + if (Option::GenerateCPPMacros) { + outputCPPDynamicTables(output); + } + if (Option::GenerateCPPMain) { + outputCPPGlobalDeclarations(); + outputCPPMain(); + outputCPPScalarArrays(false); + outputCPPGlobalVariablesMethods(1); + outputCPPGlobalVariablesMethods(2); + outputCPPGlobalVariablesMethods(3); + outputCPPGlobalVariablesMethods(4); + if (Option::PrecomputeLiteralStrings && m_stringLiterals.size() > 0) { + outputCPPLiteralStringPrecomputation(); + } + outputCPPGlobalState(); + } + if (Option::GenerateCPPMacros && output != CodeGenerator::SystemCPP) { + outputCPPClassMapFile(); + outputCPPSourceInfos(); + outputCPPNameMaps(); + } + + vector additionalCPPs; + if (Option::GenerateFFI) { + outputCPPFFIStubs(); + additionalCPPs.push_back(m_outputPath + "/" + Option::FFIFilePrefix + + "stubs.cpp"); + outputHSFFIStubs(); + outputJavaFFIStubs(); + outputJavaFFICppImpl(); + additionalCPPs.push_back(m_outputPath + "/" + Option::FFIFilePrefix + + "java_stubs.cpp"); + outputJavaFFICppDecl(); + outputSwigFFIStubs(); + } + + if (clusterCount > 0) repartitionLargeCPP(filenames, additionalCPPs); + + if (Option::GenRTTIProfileData) { + outputRTTIMetaData(Option::RTTIOutputFile.c_str()); + } +} + +void AnalysisResult::outputAllCPP(CodeGenerator &cg) { + AnalysisResultPtr ar = shared_from_this(); + cg.setOutput(CodeGenerator::MonoCPP); + cg.setContext(CodeGenerator::CppImplementation); + + if (Option::GenerateCPPMain) { + cg.printf("\n"); + cg.printInclude(""); + cg.printInclude(string(Option::SystemFilePrefix) + "global_variables.h"); + cg.printf("\n"); + } + + cg.namespaceBegin(); + getVariables()->setAttribute(VariableTable::ForceGlobal); + getVariables()->outputCPP(cg, ar); + getVariables()->clearAttribute(VariableTable::ForceGlobal); + + cg.setContext(CodeGenerator::CppForwardDeclaration); + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputCPPForwardDeclarations(cg, ar); + popScope(); + } + cg.setContext(CodeGenerator::CppDeclaration); + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputCPPDeclarations(cg, ar); + popScope(); + } + cg.setContext(CodeGenerator::CppImplementation); + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputCPPImpl(cg, ar); + popScope(); + } + cg.setContext(CodeGenerator::CppPseudoMain); + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputCPPPseudoMain(cg, ar); + popScope(); + } + cg.namespaceEnd(); + + if (Option::GenerateCPPMain) { + cg.printf("#ifndef HPHP_BUILD_LIBRARY\n"); + cg.indentBegin("int main(int argc, char** argv) {\n"); + cg.printf("return HPHP::execute_program(argc, argv);\n"); + cg.indentEnd("}\n"); + cg.printf("#endif\n"); + } +} + +void AnalysisResult::outputCPPExtClassImpl(CodeGenerator &cg) { + AnalysisResultPtr ar = shared_from_this(); + + // output create proxies + vector classes; + StringToClassScopePtrVecMap merged(m_classDecs); + for (StringToClassScopePtrMap::const_iterator iter = m_systemClasses.begin(); + iter != m_systemClasses.end(); ++iter) { + ClassScopePtr cls = iter->second; + bool extension = cls->getAttribute(ClassScope::Extension); + if (cls->isInterface()) + continue; + const char *clsName = cls->getName().c_str(); + classes.push_back(clsName); + merged[cls->getName()].push_back(cls); + cls->outputCPPDynamicClassImpl(cg, ar); + if (extension) { + pushScope(cls); + cls->outputCPPSupportMethodsImpl(cg, ar); + popScope(); + } + } + for (StringToClassScopePtrVecMap::const_iterator iter = + m_classDecs.begin(); + iter != m_classDecs.end(); + ++iter) { + ClassScopePtr cls = iter->second[0]; + if (cls->isInterface()) + continue; + classes.push_back(cls->getName().c_str()); + } + ClassScope::outputCPPDynamicClassCreateImpl(cg, merged, classes); + ClassScope::outputCPPInvokeStaticMethodImpl(cg, merged, classes); + ClassScope::outputCPPGetStaticPropertyImpl(cg, merged, classes); + ClassScope::outputCPPGetClassConstantImpl(cg, merged, classes); +} + +void AnalysisResult::outputCPPClassMapFile() { + string filename = m_outputPath + "/" + Option::SystemFilePrefix + + "class_map.cpp"; + Util::mkdir(filename); + ofstream f(filename.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + cg.printf("\n"); + cg.printInclude(""); + cg.printInclude(string(Option::SystemFilePrefix) + "global_variables.h"); + cg.printf("\n"); + cg.printf("using namespace std;\n"); + + cg.namespaceBegin(); + outputCPPClassMap(cg); + cg.namespaceEnd(); + f.close(); +} + +void AnalysisResult::recordSourceInfo(const std::string &fileline, + LocationPtr loc) { + // we only need one to one mapping, and there doesn't seem to be a need + // to display multiple PHP file locations for one C++ frame + m_sourceInfos[fileline] = loc; +} + +void AnalysisResult::recordClassSource(const std::string &clsname, + const std::string &filename) { + m_clsNameMap[clsname].insert(filename); +} + +void AnalysisResult::recordFunctionSource(const std::string &funcname, + const std::string &filename) { + m_funcNameMap[funcname].insert(filename); +} + +void AnalysisResult::outputCPPSourceInfos() { + string filename = m_outputPath + "/" + Option::SystemFilePrefix + + "source_info.cpp"; + Util::mkdir(filename); + ofstream f(filename.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + cg.printf("\n"); + cg.printInclude(""); + + cg.namespaceBegin(); + cg.printf("const char *g_source_root = \"%s\";\n", + (Process::GetCurrentDirectory() + '/').c_str()); + cg.indentBegin("const char *g_source_info[] = {\n"); + + for (map::const_iterator + iter = m_sourceInfos.begin(); iter != m_sourceInfos.end(); ++iter) { + LocationPtr loc = iter->second; + cg.printf("\"%s\", \"%s\", (const char *)%d,\n", + iter->first.c_str(), loc->file, loc->line1); + } + + cg.printf("NULL\n"); + cg.indentEnd("};\n"); + cg.namespaceEnd(); + f.close(); +} + +void AnalysisResult::outputCPPNameMaps() { + string filename = m_outputPath + "/" + Option::SystemFilePrefix + + "name_maps.cpp"; + Util::mkdir(filename); + ofstream f(filename.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + cg.printf("\n"); + cg.printInclude(""); + + cg.namespaceBegin(); + + cg.printSection("Class -> File"); + cg.indentBegin("const char *g_source_cls2file[] = {\n"); + for (map >::const_iterator + iter = m_clsNameMap.begin(); iter != m_clsNameMap.end(); ++iter) { + for (set::const_iterator iterInner = iter->second.begin(); + iterInner != iter->second.end(); ++iterInner) { + cg.printf("\"%s\", \"%s\",\n", iter->first.c_str(), iterInner->c_str()); + } + } + cg.printf("NULL\n"); + cg.indentEnd("};\n"); + + + cg.printSection("Function -> File"); + cg.indentBegin("const char *g_source_func2file[] = {\n"); + for (map >::const_iterator + iter = m_funcNameMap.begin(); iter != m_funcNameMap.end(); ++iter) { + for (set::const_iterator iterInner = iter->second.begin(); + iterInner != iter->second.end(); ++iterInner) { + cg.printf("\"%s\", \"%s\",\n", iter->first.c_str(), iterInner->c_str()); + } + } + cg.printf("NULL\n"); + cg.indentEnd("};\n"); + + cg.printSection("Param RTTI Id -> Name"); + cg.indentBegin("const char *g_paramrtti_map[] = {\n"); + if (Option::GenRTTIProfileData) { + char **params = (char **)calloc(m_paramRTTICounter, sizeof(char*)); + for (map::const_iterator + iter = m_paramRTTIs.begin(); iter != m_paramRTTIs.end(); ++iter) { + ASSERT(params[iter->second] == NULL); + params[iter->second] = (char *)iter->first.c_str(); + } + for (int i = 0; i < m_paramRTTICounter; i++) { + ASSERT(params[i]); + cg.printf("\"%s\", // %d\n", params[i], i); + } + free(params); + } + cg.printf("NULL\n"); + cg.indentEnd("};\n"); + + cg.namespaceEnd(); + f.close(); +} + +void AnalysisResult::outputRTTIMetaData(const char *filename) { + ASSERT(filename && *filename); + FILE *f = fopen(filename, "w"); + if (f == NULL) { + throw Exception("Unable to open %s: %s", filename, + Util::safe_strerror(errno).c_str()); + } + fprintf(f, "%d\n", m_paramRTTICounter); + for (set::const_iterator + iter = m_rttiFuncs.begin(); iter != m_rttiFuncs.end(); ++iter) { + fprintf(f, "%s\n", iter->c_str()); + } + fclose(f); +} + +void AnalysisResult::outputCPPDynamicTablesHeader + (CodeGenerator &cg, + bool includeGlobalVars /* = true*/, bool includes /* = true */) { + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + if (system) { + cg.printf("\n"); + cg.printInclude(""); + cg.printInclude(""); + cg.printInclude(""); + cg.printf("\n"); + } else { + cg.printf("\n"); + cg.printInclude(""); + if (includeGlobalVars) { + cg.printInclude(string(Option::SystemFilePrefix) + "global_variables.h"); + } + if (Option::EnableEval >= Option::LimitedEval) { + cg.printInclude(""); + } + cg.printf("\n"); + } + if (includes) { + string n; + FileScopePtr f; + BOOST_FOREACH(tie(n, f), m_files) { + cg.printInclude(f->outputFilebase()); + } + } + cg.printf("\n"); + cg.printf("using namespace std;\n"); + + cg.namespaceBegin(); + +} + +void AnalysisResult::createGlobalFuncTable() { + vector funcs; + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functionDecs.begin(); iter != m_functionDecs.end(); ++iter) { + FunctionScopePtr func = iter->second[0]; + if (func->isDynamic() || func->isRedeclaring()) { + funcs.push_back(iter->second[0]->name().c_str()); + } + } + if (funcs.size() > 0) { + m_funcTableSize = Util::roundUpToPowerOfTwo(funcs.size() * 2); + CodeGenerator::BuildJumpTable(funcs, m_funcTable, m_funcTableSize, true); + } else { + m_funcTableSize = 0; + } +} + +vector &AnalysisResult::getFuncTableBucket(FunctionScopePtr func) +{ + string name = Util::toLower(func->getOriginalName()); + int64 hash = hash_string_i(name.c_str()); + int64 index = hash % m_funcTableSize; + return m_funcTable[index]; +} + +void AnalysisResult::outputCPPDynamicTables(CodeGenerator::Output output) { + AnalysisResultPtr ar = shared_from_this(); + bool system = output == CodeGenerator::SystemCPP; + { + string tablePath = m_outputPath + "/" + Option::SystemFilePrefix + + "dynamic_table_func.no.cpp"; + Util::mkdir(tablePath); + ofstream fTable(tablePath.c_str()); + CodeGenerator cg(&fTable, output); + + outputCPPDynamicTablesHeader(cg, false, false); + + cg.printSection("Function Invoke Proxies", false); + for (CodeGenerator::MapIntToStringVec::const_iterator it = + m_funcTable.begin(); it != m_funcTable.end(); it++) { + if (it->second.size() == 1 && + !findFunction(it->second[0])->isRedeclaring()) { + // no conflict + cg.printf("Variant %s%s(const char *s, CArrRef params, int64 hash, " + "bool fatal);\n", + Option::InvokePrefix, it->second.front()); + } else { + for (unsigned int i = 0; i < it->second.size(); i++) { + const char *name = it->second.at(i); + StringToFunctionScopePtrVecMap::const_iterator iterFunc = + m_functionDecs.find(name); + ASSERT(iterFunc != m_functionDecs.end()); + cg.printf("Variant %s%s(CArrRef params);\n", Option::InvokePrefix, + name); + } + cg.indentBegin("static Variant invoke_case_%d(const char *s, " + "CArrRef params, int64 hash, bool fatal) {\n", + it->first); + for (unsigned int i = 0; i < it->second.size(); i++) { + const char *name = it->second.at(i); + StringToFunctionScopePtrVecMap::const_iterator iterFuncs = + m_functionDecs.find(name); + cg.printf("HASH_INVOKE(0x%016llXLL, %s);\n", + hash_string_i(name), name); + } + cg.printf("return invoke_builtin(s, params, hash, fatal);\n"); + cg.indentEnd("}\n"); + } + } + + cg.printSection("Function Invoke Table"); + if (system) { + outputCPPJumpTable(cg, ar); + outputCPPEvalInvokeTable(cg, ar); + } else { + if (m_funcTableSize > 0) { + // initializes the function pointer array + cg.printf("static Variant (*funcTable[%d])" + "(const char *, CArrRef, int64, bool);\n", m_funcTableSize); + cg.indentBegin("static class FuncTableInitializer {\n"); + cg.indentBegin("public: FuncTableInitializer() {\n"); + cg.printf("for (int i = 0; i < %d; i++) " + "funcTable[i] = &invoke_builtin;\n", m_funcTableSize); + for (CodeGenerator::MapIntToStringVec::const_iterator it = + m_funcTable.begin(); it != m_funcTable.end(); it++) { + if (it->second.size() == 1 && + !findFunction(it->second[0])->isRedeclaring()) { + cg.printf("funcTable[%d] = &%s%s;\n", it->first, + Option::InvokePrefix, it->second.front()); + } else { + cg.printf("funcTable[%d] = &invoke_case_%d;\n", + it->first, it->first); + } + } + cg.indentEnd("}\n"); + cg.indentEnd("} func_table_initializer;\n"); + } + + cg.indentBegin("Variant invoke(const char *s, CArrRef params," + " int64 hash, bool tryInterp /* = true */, " + "bool fatal /* = true */) {\n"); + + if (!Option::DynamicInvokeFunctions.empty() || + Option::EnableEval == Option::FullEval) { + cg.printf("hphp_const_char_map &funcs = " + "get_renamed_functions();\n"); + cg.printf("hphp_const_char_map::const_iterator iter =" + " funcs.find(s);\n"); + cg.indentBegin("if (iter != funcs.end()) {\n"); + cg.printf("s = iter->second;\n"); + cg.printf("hash = -1;\n"); + cg.indentEnd("}\n"); + } + // Eval invoke hook + if (!system && Option::EnableEval == Option::FullEval) { + // See if there's an eval'd version + cg.indentBegin("if (tryInterp) {\n"); + cg.printf("Variant r;\n"); + cg.printf("if (eval_invoke_hook(r, s, params, hash)) " + "return r;\n"); + cg.indentEnd("}\n"); + } + + if (m_funcTableSize > 0) { + cg.printf("if (hash < 0) hash = hash_string_i(s);\n"); + cg.printf("return funcTable[hash & %d](s, params, hash, fatal);\n", + m_funcTableSize - 1); + } else { + cg.printf("return invoke_builtin(s, params, hash, fatal);\n"); + } + cg.indentEnd("}\n"); + + outputCPPEvalInvokeTable(cg, ar); + } + cg.namespaceEnd(); + fTable.close(); + } + { + string n; + string tablePath = m_outputPath + "/" + Option::SystemFilePrefix + + "dynamic_table_class.no.cpp"; + Util::mkdir(tablePath); + ofstream fTable(tablePath.c_str()); + CodeGenerator cg(&fTable, output); + + outputCPPDynamicTablesHeader(cg, true, false); + cg.printSection("Class Invoke Tables"); + vector classes; + ClassScopePtr cls; + for (StringToClassScopePtrVecMap::const_iterator iter = + m_classDecs.begin(); + iter != m_classDecs.end(); + ++iter) { + cls = iter->second[0]; + if (!cls->isUserClass() || cls->isInterface()) continue; + classes.push_back(cls->getName().c_str()); + if (!system) { + cls->outputCPPDynamicClassDecl(cg); + } + cls->outputCPPGlobalTableWrappersDecl(cg, ar); + } + if (system) { + BOOST_FOREACH(tie(n, cls), m_systemClasses) { + if (!cls->isInterface()) { + classes.push_back(cls->getName().c_str()); + } + } + outputCPPExtClassImpl(cg); + } else { + ClassScope::outputCPPDynamicClassCreateImpl(cg, m_classDecs, classes); + ClassScope::outputCPPInvokeStaticMethodImpl(cg, m_classDecs, classes); + ClassScope::outputCPPGetStaticPropertyImpl(cg, m_classDecs, classes); + ClassScope::outputCPPGetClassConstantImpl(cg, m_classDecs, classes); + } + cg.namespaceEnd(); + fTable.close(); + } + { + string tablePath = m_outputPath + "/" + Option::SystemFilePrefix + + "dynamic_table_constant.no.cpp"; + Util::mkdir(tablePath); + ofstream fTable(tablePath.c_str()); + CodeGenerator cg(&fTable, output); + + outputCPPDynamicTablesHeader(cg, true, false); + + vector strings; + hphp_const_char_map dyns; + if (system) { + ConstantTablePtr ct = getConstants(); + vector syms; + ct->getSymbols(syms); + BOOST_FOREACH(string sym, syms) { + strings.push_back(sym.c_str()); + } + } + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + ConstantTablePtr ct = fs->getConstants(); + vector syms; + ct->getSymbols(syms); + BOOST_FOREACH(string sym, syms) { + if (ct->isSystem(sym) && !system) continue; + strings.push_back(sym.c_str()); + dyns[sym.c_str()] = ct->isDynamic(sym); + } + ct->outputCPP(cg, ar); + } + + cg.printSection("Get Constant Table"); + cg.indentBegin("Variant get_%sconstant(CStrRef name) {\n", + system ? "builtin_" : ""); + cg.printDeclareGlobals(); + + if (!system && Option::EnableEval == Option::FullEval) { + // See if there's an eval'd version + cg.indentBegin("{\n"); + cg.printf("Variant r;\n"); + cg.printf("if (eval_constant_hook(r, name)) return r;\n"); + cg.indentEnd("}\n"); + } + + if (strings.size() > 0) { + cg.printf("const char* s = name.data();\n"); + for (JumpTable jt(cg, strings, false, false, false); jt.ready(); + jt.next()) { + const char *name = jt.key(); + string varName = string(Option::ConstantPrefix) + name; + hphp_const_char_map::const_iterator it = dyns.find(name); + bool dyn = it != dyns.end() && it->second; + if (dyn) { + cg.printf("HASH_RETURN(0x%016llXLL, g->%s, %s);\n", + hash_string(name), varName.c_str(), name); + } else { + cg.printf("HASH_RETURN(0x%016llXLL, %s, %s);\n", + hash_string(name), varName.c_str(), name); + } + } + } + + if (system) { + cg.printf("return name;\n"); + } else { + cg.printf("return get_builtin_constant(name);\n"); + } + cg.indentEnd("}\n"); + cg.namespaceEnd(); + fTable.close(); + } + { + string tablePath = m_outputPath + "/" + Option::SystemFilePrefix + + "dynamic_table_file.no.cpp"; + Util::mkdir(tablePath); + ofstream fTable(tablePath.c_str()); + CodeGenerator cg(&fTable, output); + + outputCPPDynamicTablesHeader(cg, false, false); + if (output != CodeGenerator::SystemCPP) { + cg.printSection("File Invoke Table"); + vector entries; + BOOST_FOREACH(FileScopePtr f, m_fileScopes) { + entries.push_back(f->getName().c_str()); + cg.printf("Variant %s%s(bool incOnce = false, LVariableTable* variables" + " = NULL);\n", Option::PseudoMainPrefix, + Option::mangleFilename(f->getName(), true).c_str()); + } + + cg.printf("\n"); + cg.indentBegin("Variant invoke_file(CStrRef path, " + "bool once /* = false */, " + "LVariableTable* variables /* = NULL */," + "const char *currentDir /* = NULL */) {\n"); + if (!system && Option::EnableEval == Option::FullEval) { + // See if there's an eval'd version + cg.indentBegin("{\n"); + cg.printf("Variant r;\n"); + cg.printf("if (eval_invoke_file_hook(r, path, once, variables, " + "currentDir)) " + "return r;\n"); + cg.indentEnd("}\n"); + } + + string root; + cg.printf("String s = canonicalize_path(path, \"%s\", %d);\n", + root.c_str(), root.size()); + + for (JumpTable jt(cg, entries, false, false, true); jt.ready(); + jt.next()) { + const char *file = jt.key(); + cg.printf("HASH_INCLUDE(0x%016llXLL, \"%s\", %s);\n", + hash_string(file), file, + Option::mangleFilename(file, true).c_str()); + } + + + // when we only have one file, we default to running the file + if (entries.size() == 1) { + cg.printf("if (s.empty()) return %s%s(once, variables);\n", + Option::PseudoMainPrefix, + Option::mangleFilename(entries[0], true).c_str()); + } + cg.printf("Logger::Verbose(\"Tried to invoke %%s but file not found.\", " + "s.data());\n"); + cg.printf("return throw_missing_file(s.data());\n"); + cg.indentEnd("}\n"); + } + + cg.namespaceEnd(); + fTable.close(); + } +} + +void AnalysisResult::outputCPPSystem() { + string filename = string(Option::SystemFilePrefix) + "system_globals.h"; + + string headerPath = m_outputPath + "/" + filename; + Util::mkdir(headerPath); + ofstream fSystem(headerPath.c_str()); + CodeGenerator cg(&fSystem, CodeGenerator::SystemCPP); + + string implPath = m_outputPath + "/" + Option::SystemFilePrefix + + "system_globals.cpp"; + ofstream fSystemImpl(implPath.c_str()); + cg.setStream(CodeGenerator::ImplFile, &fSystemImpl); + + cg.headerBegin(filename.c_str()); + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + cg.printInclude(fs->outputFilebase()); + } + + cg.namespaceBegin(); + AnalysisResultPtr ar = shared_from_this(); + getVariables()->setAttribute(VariableTable::ForceGlobal); + getVariables()->outputCPP(cg, ar); + getVariables()->clearAttribute(VariableTable::ForceGlobal); + getConstants()->outputCPP(cg, ar); + cg.namespaceEnd(); + + cg.headerEnd(filename.c_str()); + + cg.setContext(CodeGenerator::CppImplementation); + cg.useStream(CodeGenerator::ImplFile); + cg.printf("\n"); + cg.printInclude(filename.c_str()); + cg.namespaceBegin(); + outputCPPGlobalImplementations(cg); + cg.namespaceEnd(); + + fSystemImpl.close(); + fSystem.close(); + + outputCPPScalarArrays(true); +} + +void AnalysisResult::outputCPPRedeclaredFunctionDecl(CodeGenerator &cg) { + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functionDecs.begin(); iter != m_functionDecs.end(); ++iter) { + const char *name = iter->first.c_str(); + if (iter->second[0]->isRedeclaring()) { + cg.printf("Variant (*%s%s)(CArrRef params);\n", + Option::InvokePrefix, name); + } + } +} + +void AnalysisResult::outputCPPRedeclaredFunctionImpl(CodeGenerator &cg) { + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functionDecs.begin(); iter != m_functionDecs.end(); ++iter) { + if (iter->second[0]->isRedeclaring()) { + const char *name = iter->first.c_str(); + cg.printf("%s%s = invoke_failed_%s;\n", Option::InvokePrefix, + name, name); + } + } +} + +void AnalysisResult::outputCPPRedeclaredClassDecl(CodeGenerator &cg) { + for (StringToClassScopePtrVecMap::const_iterator iter = + m_classDecs.begin(); iter != m_classDecs.end(); ++iter) { + const char *name = iter->first.c_str(); + if (iter->second[0]->isRedeclaring()) { + cg.printf("ClassStaticsPtr %s%s;\n", Option::ClassStaticsObjectPrefix, + name); + } + } +} + +void AnalysisResult::outputCPPRedeclaredClassImpl(CodeGenerator &cg) { + for (StringToClassScopePtrVecMap::const_iterator iter = + m_classDecs.begin(); iter != m_classDecs.end(); ++iter) { + if (iter->second[0]->isRedeclaring()) { + const char *name = iter->first.c_str(); + cg.printf("%s%s = ClassStaticsPtr(NEW(ClassStatics)(\"%s\"));\n", + Option::ClassStaticsObjectPrefix, name, name); + } + } +} + +void AnalysisResult::outputCPPDynamicConstantDecl(CodeGenerator &cg) { + AnalysisResultPtr ar = shared_from_this(); + getConstants()->outputCPPDynamicDecl(cg, ar); + for (StringToFileScopePtrMap::const_iterator iter = m_files.begin(); + iter != m_files.end(); ++iter) { + iter->second->getConstants()->outputCPPDynamicDecl(cg, ar); + } + for (StringToClassScopePtrVecMap::const_iterator iter = m_classDecs.begin(); + iter != m_classDecs.end(); ++iter) { + for (vector::const_iterator viter = iter->second.begin(); + viter != iter->second.end(); ++viter) { + const ClassScopePtr &cls = *viter; + pushScope(cls); + cls->getConstants()->outputCPPDynamicDecl(cg, ar); + popScope(); + } + } +} + +void AnalysisResult::outputCPPDynamicConstantImpl(CodeGenerator &cg) { + AnalysisResultPtr ar = shared_from_this(); + getConstants()->outputCPPDynamicImpl(cg, ar); + for (StringToFileScopePtrMap::const_iterator iter = m_files.begin(); + iter != m_files.end(); ++iter) { + iter->second->getConstants()->outputCPPDynamicImpl(cg, ar); + } +} + +void AnalysisResult::outputCPPScalarArrayDecl(CodeGenerator &cg) { + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + const char *prefix = system ? Option::SystemScalarArrayName : + Option::ScalarArrayName; + if (m_scalarArrayIds.size() > 0) { + cg.printf("static StaticArray %s[%d];\n", prefix, m_scalarArrayIds.size()); + } +} + +void AnalysisResult::outputHexBuffer(CodeGenerator &cg, const char *name, + const char *buf, int len) { + cg.printf("static const char %s[%d] = {\n", name, len); + for (int i = 0; i < len; i++) { + if (i % 10 == 0) cg.printf(" "); + cg.printf("0x%02x, ", (unsigned char)buf[i]); + if (i % 10 == 9) cg.printf("\n"); + } + cg.printf("};\n\n"); +} + +string AnalysisResult::getScalarArrayCompressedText() { + Array arrs; + for (unsigned int i = 0; i < m_scalarArrayIds.size(); i++) { + ExpressionPtr exp = m_scalarArrayIds[i]; + if (exp) { + Variant value; + bool ret = exp->getScalarValue(value); + if (!ret) ASSERT(false); + if (!value.isArray()) ASSERT(false); + arrs.append(value); + } else { + arrs.append(StaticArray((ArrayElement*)NULL)); + } + } + String s = f_serialize(arrs); + int len = s.size(); + char *zd = gzencode(s.data(), len, 9, CODING_GZIP); + m_scalarArrayCompressedTextSize = len; + return string(zd, len); +} + +void AnalysisResult::getLiteralStringCompressed(std::string &zsdata, + std::string &zldata) { + int nstrings = m_stringLiterals.size(); + ASSERT(nstrings > 0); + string *sortedById = new string[nstrings]; + for (map >::const_iterator it = + m_stringLiterals.begin(); it != m_stringLiterals.end(); ++it) { + int index = it->second.first; + ASSERT(0 <= index && index < nstrings); + sortedById[index] = it->first; + } + string sdata; + string ldata; + for (int i = 0; i < nstrings; i++) { + sdata += sortedById[i]; + sdata += string("\0", 1); + + int size = sortedById[i].size(); + char buf[sizeof(size)]; + memcpy(buf, &size, sizeof(size)); + ldata += string(buf, sizeof(size)); + } + int sdlen = sdata.size(); + char *zsd = gzencode(sdata.data(), sdlen, 9, CODING_GZIP); + int ldlen = ldata.size(); + char *zld = gzencode(ldata.data(), ldlen, 9, CODING_GZIP); + zsdata = string(zsd, sdlen); + zldata = string(zld, ldlen); +} + +void AnalysisResult::outputCPPScalarArrayImpl(CodeGenerator &cg) { + if (m_scalarArrayIds.size() == 0) return; + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + AnalysisResultPtr ar = shared_from_this(); + if (Option::ScalarArrayCompression && !system) { + string s = getScalarArrayCompressedText(); + outputHexBuffer(cg, "sa_cdata", s.data(), s.size()); + } + const char *clsname = system ? "SystemScalarArrays" : "ScalarArrays"; + const char *prefix = system ? Option::SystemScalarArrayName : + Option::ScalarArrayName; + + cg.printf("StaticArray %s::%s[%d];\n", + clsname, prefix, m_scalarArrayIds.size()); +} + +static bool SortByExpressionLength(const AnalysisResult::ScalarArrayExp &p1, + const AnalysisResult::ScalarArrayExp &p2) { + return p1.len < p2.len; +} + +void AnalysisResult::outputCPPScalarArrayInit(CodeGenerator &cg, int fileCount, + int part) { + if (part == 0) { + int sumLen = 0; + m_scalarArraySorted.clear(); + if (m_scalarArrayIds.size() > 0) { + m_scalarArraySorted.resize(m_scalarArrayIds.size()); + for (unsigned int i = 0; i < m_scalarArrayIds.size(); i++) { + ScalarArrayExp &exp = m_scalarArraySorted[i]; + exp.id = i; + exp.len = m_scalarArrayIds[i] ? + m_scalarArrayIds[i]->getText(true).size() : 0; + exp.exp = m_scalarArrayIds[i]; + sumLen += exp.len; + } + sort(m_scalarArraySorted.begin(), m_scalarArraySorted.end(), + SortByExpressionLength); + } + m_scalarArraySortedAvgLen = sumLen / fileCount; + } + + if (m_scalarArraySorted.empty()) return; + AnalysisResultPtr ar = shared_from_this(); + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + const char *prefix = system ? Option::SystemScalarArrayName : + Option::ScalarArrayName; + + bool nonEmpty = false; + while (m_scalarArraySortedIndex < (int)m_scalarArraySorted.size()) { + ScalarArrayExp &exp = m_scalarArraySorted[m_scalarArraySortedIndex++]; + m_scalarArraySortedSumLen += exp.len; + // In case we hit a huge scalar array, leave it for the next file unless + // the current file is still empty. + if ((m_scalarArraySortedSumLen > (part + 1) * m_scalarArraySortedAvgLen) + && (part < fileCount - 1) && nonEmpty) { + m_scalarArraySortedIndex--; + break; + } + nonEmpty = true; + cg.printf("%s[%d] = StaticArray(", prefix, exp.id); + if (exp.exp) { + ExpressionListPtr expList = + dynamic_pointer_cast(exp.exp); + int numElems = expList->getCount(); + if (numElems <= Option::ScalarArrayOverflowLimit) { + expList->outputCPP(cg, ar); + cg.printf(", NULL);\n"); + } else { + ExpressionListPtr subExpList = + dynamic_pointer_cast(expList->clone()); + for (int i = Option::ScalarArrayOverflowLimit; i < numElems; i++) { + subExpList->removeElement(Option::ScalarArrayOverflowLimit); + } + ar->setInsideScalarArray(true); + subExpList->outputCPP(cg, ar); + ar->setInsideScalarArray(false); + cg.printf(", NULL);\n"); + for (int i = Option::ScalarArrayOverflowLimit; i < numElems; i++) { + ExpressionPtr elemExp = (*expList)[i]; + ArrayPairExpressionPtr pair = + dynamic_pointer_cast(elemExp); + ExpressionPtr name = pair->getName(); + ExpressionPtr value = pair->getValue(); + if (name) { + cg.printf("%s[%d].set(", prefix, exp.id); + name->outputCPP(cg, ar); + cg.printf(", "); + value->outputCPP(cg, ar); + ScalarExpressionPtr sc = + dynamic_pointer_cast(name); + if (sc) { + int64 hash = sc->getHash(); + if (hash >= 0) { + cg.printf(", 0x%016llXLL", hash); + } + } + cg.printf(");"); + } else { + cg.printf("%s[%d].append(", prefix, exp.id); + value->outputCPP(cg, ar); + cg.printf(");"); + } + cg.printf("\n"); + } + cg.printf("%s[%d].setStatic();\n", prefix, exp.id); + } + } else { + cg.printf("(ArrayElement*)NULL);\n"); + } + } +} + +void AnalysisResult::outputCPPGlobalDeclarations() { + string filename = string(Option::SystemFilePrefix) + "global_variables.h"; + + string headerPath = m_outputPath + "/" + filename; + Util::mkdir(headerPath); + ofstream f(headerPath.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + + cg.headerBegin(filename.c_str()); + cg.printInclude(""); + cg.namespaceBegin(); + + AnalysisResultPtr ar = shared_from_this(); + getVariables()->setAttribute(VariableTable::ForceGlobal); + getVariables()->outputCPP(cg, ar); + getVariables()->clearAttribute(VariableTable::ForceGlobal); + + cg.printf("\n"); + if (getVariables()->getAttribute(VariableTable::ContainsLDynamicVariable)) { + cg.printf("LVariableTable *get_variable_table();\n"); + } else if (getVariables()-> + getAttribute(VariableTable::ContainsDynamicVariable)) { + cg.printf("RVariableTable *get_variable_table();\n"); + } + + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functionDecs.begin(); iter != m_functionDecs.end(); ++iter) { + const char *name = iter->first.c_str(); + if (iter->second[0]->isRedeclaring()) { + cg.printf("extern Variant invoke_failed_%s(CArrRef params);\n", + name); + } + } + for (StringToClassScopePtrVecMap::const_iterator iter = + m_classDecs.begin(); iter != m_classDecs.end(); ++iter) { + if (iter->second[0]->isRedeclaring()) { + cg.printf("int %s%s();\n", Option::ClassStaticsIdGetterPrefix, + iter->first.c_str()); + } + } + cg.namespaceEnd(); + cg.headerEnd(filename.c_str()); + f.close(); +} + +void AnalysisResult::outputCPPGlobalImplementations(CodeGenerator &cg) { + AnalysisResultPtr ar = shared_from_this(); + CodeGenerator::Context con = cg.getContext(); + cg.setContext(CodeGenerator::CppImplementation); + getVariables()->setAttribute(VariableTable::ForceGlobal); + getVariables()->outputCPP(cg, ar); + getVariables()->clearAttribute(VariableTable::ForceGlobal); + + // Function pointers for redeclared funcs + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functionDecs.begin(); iter != m_functionDecs.end(); ++iter) { + if (iter->second[0]->isRedeclaring()) { + const char *name = iter->first.c_str(); + cg.indentBegin("Variant invoke_failed_%s(CArrRef params) {\n", + name); + cg.printf("return invoke_failed(\"%s\", params, -1);\n", name); + cg.indentEnd("}\n"); + } + } + + for (StringToClassScopePtrVecMap::const_iterator iter = + m_classDecs.begin(); iter != m_classDecs.end(); ++iter) { + if (iter->second[0]->isRedeclaring()) { + cg.indentBegin("int %s%s() {\n", Option::ClassStaticsIdGetterPrefix, + iter->first.c_str()); + cg.printDeclareGlobals(); + cg.printf("return g->%s%s->getRedeclaringId();\n", + Option::ClassStaticsObjectPrefix, iter->first.c_str()); + cg.indentEnd("}\n"); + } + } + cg.setContext(con); +} + +void AnalysisResult::outputCPPSystemImplementations(CodeGenerator &cg) { + BOOST_FOREACH(FileScopePtr f, m_fileScopes) { + if (f->hasImpl(shared_from_this())) { + cg.printf("%s%s(false);\n", Option::PseudoMainPrefix, + f->pseudoMainName().c_str()); + } + } +} + +void AnalysisResult::outputCPPFileRunDecls(CodeGenerator &cg) { + BOOST_FOREACH(FileScopePtr f, m_fileScopes) { + cg.printf("bool run_%s%s;\n", Option::PseudoMainPrefix, + f->pseudoMainName().c_str()); + } +} + +void AnalysisResult::outputCPPFileRunImpls(CodeGenerator &cg) { + BOOST_FOREACH(FileScopePtr f, m_fileScopes) { + cg.printf(",\n run_%s%s(false)", Option::PseudoMainPrefix, + f->pseudoMainName().c_str()); + } +} + +void AnalysisResult::outputCPPClassStaticInitializerDecls(CodeGenerator &cg) { + for (StringToClassScopePtrVecMap::const_iterator iter = m_classDecs.begin(); + iter != m_classDecs.end(); ++iter) { + BOOST_FOREACH(ClassScopePtr cls, iter->second) { + cls->outputCPPStaticInitializerDecl(cg); + } + } +} + +void AnalysisResult::outputCPPClassStaticInitializerFlags(CodeGenerator &cg, + bool constructor) { + const char *fmt = constructor ? ",\n %s%s(false)" : "bool %s%s;\n"; + for (StringToClassScopePtrVecMap::const_iterator iter = m_classDecs.begin(); + iter != m_classDecs.end(); ++iter) { + BOOST_FOREACH(ClassScopePtr cls, iter->second) { + if (cls->needLazyStaticInitializer()) { + cg.printf(fmt, Option::ClassStaticInitializerFlagPrefix, + cls->getId().c_str()); + } + } + } +} + +void AnalysisResult::outputCPPScalarArrays(bool system) { + setInsideScalarArray(true); + + int fileCount = system ? 1 : Option::ScalarArrayFileCount; + if (system) { + fileCount = 1; + } else if ((m_scalarArrayIds.size() / Option::ScalarArrayFileCount) == 0) { + fileCount = 1; + } else { + fileCount = Option::ScalarArrayFileCount; + } + if (Option::ScalarArrayCompression && !system) fileCount = 1; + for (int i = 0; i < fileCount; i++) { + string filename = m_outputPath + "/" + Option::SystemFilePrefix + + "scalar_arrays_" + lexical_cast(i) + ".no.cpp"; + Util::mkdir(filename); + ofstream f(filename.c_str()); + CodeGenerator cg(&f, system ? CodeGenerator::SystemCPP : + CodeGenerator::ClusterCPP); + + cg.printf("\n"); + cg.printInclude(""); + cg.printInclude(string(Option::SystemFilePrefix) + + (system ? "system_globals.h" : "global_variables.h")); + + cg.printf("\n"); + cg.namespaceBegin(); + + AnalysisResultPtr ar = shared_from_this(); + CodeGenerator::Context con = cg.getContext(); + cg.setContext(CodeGenerator::CppImplementation); + getVariables()->setAttribute(VariableTable::ForceGlobal); + outputCPPScalarArrays(cg, fileCount, i); + getVariables()->clearAttribute(VariableTable::ForceGlobal); + cg.setContext(con); + + cg.namespaceEnd(); + f.close(); + } + + setInsideScalarArray(false); +} + +void AnalysisResult::outputCPPScalarArrays(CodeGenerator &cg, int fileCount, + int part) { + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + const char *clsname = system ? "SystemScalarArrays" : "ScalarArrays"; + const char *prefix = system ? Option::SystemScalarArrayName : + Option::ScalarArrayName; + + if (fileCount == 1) { + outputCPPScalarArrayImpl(cg); + cg.printf("\n"); + cg.indentBegin("void %s::initialize() {\n", clsname); + if (!system) { + cg.printf("SystemScalarArrays::initialize();\n"); + } + if (m_scalarArrayIds.size() > 0) { + if (Option::ScalarArrayCompression && !system) { + ASSERT(m_scalarArrayCompressedTextSize > 0); + cg.printf("ArrayUtil::InitScalarArrays(%s, %d, sa_cdata, %d);\n", + prefix, m_scalarArrayIds.size(), + m_scalarArrayCompressedTextSize); + } else { + outputCPPScalarArrayInit(cg, 1, 0); + } + } + cg.indentEnd("}\n"); + return; + } + + if (part == 0) { + ASSERT(!(Option::ScalarArrayCompression && !system)); + outputCPPScalarArrayImpl(cg); + cg.printf("\n"); + cg.indentBegin("void %s::initialize() {\n", clsname); + if (!system) { + cg.printf("SystemScalarArrays::initialize();\n"); + } + for (int i = 0; i < fileCount; i++) { + cg.printf("initialize_%d();\n", i); + } + cg.indentEnd("}\n"); + } + + cg.printf("\n"); + cg.indentBegin("void %s::initialize_%d() {\n", clsname, part); + outputCPPScalarArrayInit(cg, fileCount, part); + cg.indentEnd("}\n"); +} + +void AnalysisResult::outputCPPGlobalVariablesMethods(int part) { + string filename = m_outputPath + "/" + Option::SystemFilePrefix + + "global_variables_" + lexical_cast(part) + ".no.cpp"; + Util::mkdir(filename); + ofstream f(filename.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + AnalysisResultPtr ar = shared_from_this(); + + cg.printf("\n"); + cg.printInclude(""); + cg.printInclude(string(Option::SystemFilePrefix) + "global_variables.h"); + if (part == 1) { + getVariables()->outputCPPGlobalVariablesDtorIncludes(cg, ar); + } + cg.printf("\n"); + cg.printf("using namespace std;\n"); + cg.namespaceBegin(); + + CodeGenerator::Context con = cg.getContext(); + cg.setContext(CodeGenerator::CppImplementation); + getVariables()->setAttribute(VariableTable::ForceGlobal); + switch (part) { + case 1: + getVariables()->outputCPPGlobalVariablesDtor(cg); + getVariables()->outputCPPGlobalVariablesGetImpl (cg, ar); + break; + case 2: getVariables()->outputCPPGlobalVariablesExists (cg, ar); break; + case 3: getVariables()->outputCPPGlobalVariablesGetIndex(cg, ar); break; + case 4: getVariables()->outputCPPGlobalVariablesMethods (cg, ar); break; + default: ASSERT(false); + } + getVariables()->clearAttribute(VariableTable::ForceGlobal); + cg.setContext(con); + + cg.namespaceEnd(); + + f.close(); +} + +void AnalysisResult::outputCPPGlobalStateBegin(CodeGenerator &cg, + const char *section) { + cg.indentBegin("static void output_%s(FILE *fp) {\n", section); + cg.printf("DECLARE_GLOBAL_VARIABLES(g);\n"); + cg.printf("print(fp, \"\\n$%s = json_decode('\");\n", section); + cg.printf("Array %s;\n", section); +} + +void AnalysisResult::outputCPPGlobalStateEnd(CodeGenerator &cg, + const char *section) { + cg.printf("String s = f_json_encode(%s);\n", section); + cg.printf("s = StringUtil::CEncode(s, \"\\\\\\\'\");\n"); + cg.printf("print(fp, s);\n"); + cg.printf("print(fp, \"', true);\\n\");\n"); + cg.indentEnd("}\n\n"); +} + +void AnalysisResult::outputCPPGlobalStateDynamicConstants +(CodeGenerator &cg) { + AnalysisResultPtr ar = shared_from_this(); + const char *section = "dynamic_constants"; + outputCPPGlobalStateBegin(cg, section); + getConstants()->outputCPPGlobalState(cg, ar); + for (StringToFileScopePtrMap::const_iterator iter = m_files.begin(); + iter != m_files.end(); ++iter) { + iter->second->getConstants()->outputCPPGlobalState(cg, ar); + } + outputCPPGlobalStateEnd(cg, section); +} + +void AnalysisResult::outputCPPGlobalStatePseudoMainVariables +(CodeGenerator &cg) { + const char *section = "pseudomain_variables"; + outputCPPGlobalStateBegin(cg, section); + BOOST_FOREACH(FileScopePtr f, m_fileScopes) { + cg.printf("%s.set(\"run_%s%s\", g->run_%s%s);\n", section, + Option::PseudoMainPrefix, f->pseudoMainName().c_str(), + Option::PseudoMainPrefix, f->pseudoMainName().c_str()); + } + outputCPPGlobalStateEnd(cg, section); +} + +void AnalysisResult::outputCPPGlobalStateRedeclaredFunctions +(CodeGenerator &cg) { + const char *section = "redeclared_functions"; + outputCPPGlobalStateBegin(cg, section); + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functionDecs.begin(); iter != m_functionDecs.end(); ++iter) { + const char *name = iter->first.c_str(); + if (iter->second[0]->isRedeclaring()) { + cg.printf("%s.set(\"%s%s\", (int64)g->%s%s);\n", section, + Option::InvokePrefix, name, Option::InvokePrefix, name); + } + } + outputCPPGlobalStateEnd(cg, section); +} + +void AnalysisResult::outputCPPGlobalStateRedeclaredClasses +(CodeGenerator &cg) { + const char *section = "redeclared_classes"; + outputCPPGlobalStateBegin(cg, section); + for (StringToClassScopePtrVecMap::const_iterator iter = + m_classDecs.begin(); iter != m_classDecs.end(); ++iter) { + const char *name = iter->first.c_str(); + if (iter->second[0]->isRedeclaring()) { + cg.printf("%s.set(\"%s%s\", g->%s%s->getRedeclaringId());\n", + section, + Option::ClassStaticsObjectPrefix, name, + Option::ClassStaticsObjectPrefix, name); + } + } + outputCPPGlobalStateEnd(cg, section); +} + +void AnalysisResult::outputCPPGlobalState() { + string filename = m_outputPath + "/" + Option::SystemFilePrefix + + "global_state.no.cpp"; + Util::mkdir(filename); + ofstream f(filename.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + AnalysisResultPtr ar = shared_from_this(); + + cg.printf("\n"); + cg.printInclude(""); + cg.printInclude(string(Option::SystemFilePrefix) + "global_variables.h"); + cg.printf("\n"); + cg.printf("using namespace std;\n"); + cg.namespaceBegin(); + + cg.indentBegin("static void print(FILE *fp, String s) {\n"); + cg.indentBegin("if (fp) {\n"); + cg.printf("fwrite(s.c_str(), 1, s.size(), fp);\n"); + cg.printf("return;\n"); + cg.indentEnd("}\n"); + cg.printf("echo(s);\n"); + cg.indentEnd("}\n"); + + outputCPPGlobalStateDynamicConstants(cg); + getVariables()->outputCPPGlobalState(cg, ar); + outputCPPGlobalStatePseudoMainVariables(cg); + outputCPPGlobalStateRedeclaredFunctions(cg); + outputCPPGlobalStateRedeclaredClasses(cg); + + cg.indentBegin("void output_global_state(FILE *fp) {\n"); + cg.printf("output_static_global_variables(fp);\n"); + cg.printf("output_dynamic_global_variables(fp);\n"); + cg.printf("output_dynamic_constants(fp);\n"); + cg.printf("output_method_static_variables(fp);\n"); + cg.printf("output_method_static_inited(fp);\n"); + cg.printf("output_class_static_variables(fp);\n"); + cg.printf("output_pseudomain_variables(fp);\n"); + cg.printf("output_redeclared_functions(fp);\n"); + cg.printf("output_redeclared_classes(fp);\n"); + cg.indentEnd("}\n\n"); + + cg.namespaceEnd(); + f.close(); +} + +void AnalysisResult::outputCPPMain() { + string mainPath = m_outputPath + "/" + Option::SystemFilePrefix + + "main.no.cpp"; + Util::mkdir(mainPath); + ofstream fMain(mainPath.c_str()); + CodeGenerator cg(&fMain, CodeGenerator::ClusterCPP); + + cg.printf("\n"); + cg.printInclude(""); + cg.printInclude(""); + cg.printInclude(string(Option::SystemFilePrefix) + "global_variables.h"); + + cg.printf("\n"); + cg.printf("using namespace std;\n"); + cg.namespaceBegin(); + outputCPPClassStaticInitializerDecls(cg); + cg.printf("\n"); + outputCPPGlobalImplementations(cg); + cg.namespaceEnd(); + + cg.printf("\n"); + cg.printf("#ifndef HPHP_BUILD_LIBRARY\n"); + cg.indentBegin("int main(int argc, char** argv) {\n"); + cg.printf("return HPHP::execute_program(argc, argv);\n"); + cg.indentEnd("}\n"); + cg.printf("#endif\n"); + + fMain.close(); +} + +void AnalysisResult::outputCPPClassMap(CodeGenerator &cg) { + AnalysisResultPtr ar = shared_from_this(); + + if (!Option::GenerateCPPMetaInfo) return; + cg.indentBegin("const char *g_class_map[] = {\n"); + + // system functions + cg.printf("(const char *)ClassInfo::IsSystem, NULL, \"\",\n"); + cg.printf("NULL,\n"); // interfaces + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + FunctionScopePtr func = iter->second[0]; + ASSERT(!func->isUserFunction()); + func->outputCPPClassMap(cg, ar); + } + cg.printf("NULL,\n"); // methods + cg.printf("NULL,\n"); // properties + // system constants + m_constants->outputCPPClassMap(cg, ar); + + // user functions + cg.printf("(const char *)ClassInfo::IsNothing, NULL, \"\",\n"); + cg.printf("NULL,\n"); // interfaces + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functionDecs.begin(); iter != m_functionDecs.end(); ++iter) { + FunctionScopePtr func = iter->second[0]; + if (func->isUserFunction()) { + func->outputCPPClassMap(cg, ar); + } + } + cg.printf("NULL,\n"); // methods + cg.printf("NULL,\n"); // properties + + // user defined constants + for (int i = 0; i < (int)m_fileScopes.size(); i++) { + ConstantTablePtr constants = m_fileScopes[i]->getConstants(); + constants->outputCPPClassMap(cg, ar, (i == (int)m_fileScopes.size() - 1)); + } + + // system classes + for (StringToClassScopePtrMap::const_iterator iter = m_systemClasses.begin(); + iter != m_systemClasses.end(); ++iter) { + iter->second->outputCPPClassMap(cg, ar); + } + + // user classes + for (StringToClassScopePtrVecMap::const_iterator iter = m_classDecs.begin(); + iter != m_classDecs.end(); ++iter) { + bool redec = iter->second[0]->isRedeclaring(); + if (redec) { + cg.printf("(const char *)ClassInfo::IsRedeclared, \"%s\", " + "(const char *)%s%s,\n", iter->first.c_str(), + Option::ClassStaticsIdGetterPrefix, iter->first.c_str()); + } + BOOST_FOREACH(ClassScopePtr cls, iter->second) { + cls->outputCPPClassMap(cg, ar); + } + if (redec) { + cg.printf("NULL,\n"); + } + } + + cg.printf("NULL\n"); + cg.indentEnd("};\n"); +} + +void AnalysisResult::outputCPPClusterImpl(CodeGenerator &cg, + const FileScopePtrVec &files) { + AnalysisResultPtr ar = shared_from_this(); + cg.printf("\n"); + + // includes + map toInclude; + BOOST_FOREACH(FileScopePtr fs, files) { + getTrueDeps(fs, toInclude); + toInclude[fs->getName()] = fs; + } + for (map::const_iterator iter = toInclude.begin(); + iter != toInclude.end(); ++iter) { + FileScopePtr fs = iter->second; + cg.printInclude(fs->outputFilebase()); + } + cg.printInclude(""); + if (Option::EnableEval >= Option::LimitedEval || + cg.getOutput() == CodeGenerator::SystemCPP) { + cg.printInclude(""); + } + + // implementations + cg.namespaceBegin(); + BOOST_FOREACH(FileScopePtr fs, files) { + pushScope(fs); + cg.setContext(CodeGenerator::CppImplementation); + fs->outputCPPImpl(cg, ar); + cg.setContext(CodeGenerator::CppPseudoMain); + fs->outputCPPPseudoMain(cg, ar); + popScope(); + } + cg.namespaceEnd(); +} + + +void AnalysisResult::outputCPPFFIStubs() { + AnalysisResultPtr ar = shared_from_this(); + string iPath = m_outputPath + "/" + Option::FFIFilePrefix + + "stubs.cpp"; + string hPath = m_outputPath + "/" + Option::FFIFilePrefix + + "stubs.h"; + Util::mkdir(iPath); + ofstream fi(iPath.c_str()); + ofstream fh(hPath.c_str()); + CodeGenerator cg(&fh, CodeGenerator::ClusterCPP); + cg.printInclude(""); + cg.printf("using namespace HPHP;\n"); + cg.printf("extern \"C\" {\n"); + + cg.setStream(CodeGenerator::ImplFile, &fi); + cg.useStream(CodeGenerator::ImplFile); + cg.printInclude("\"stubs.h\""); + cg.printf("/* preface starts */\n"); + cg.printf("using namespace HPHP;\n\n"); + cg.printf("/* preface finishes */\n"); + + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputCPPFFI(cg, ar); + popScope(); + } + + cg.useStream(CodeGenerator::PrimaryStream); + cg.printf("}\n"); + fi.close(); + fh.close(); +} +void AnalysisResult::outputHSFFIStubs() { + AnalysisResultPtr ar = shared_from_this(); + string path = m_outputPath + "/" + Option::FFIFilePrefix + + "HphpStubs.hs"; + Util::mkdir(path); + ofstream f(path.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + cg.printf("{-# INCLUDE \"stubs.h\" #-}\n"); + cg.printf("{-# LANGUAGE ForeignFunctionInterface #-}\n"); + cg.printf("module HphpStubs ("); + bool first = true; + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + const StringToFunctionScopePtrVecMap &fns = fs->getFunctions(); + for (StringToFunctionScopePtrVecMap::const_iterator it = fns.begin(); + it != fns.end(); ++it) { + BOOST_FOREACH(FunctionScopePtr func, it->second) { + if (func->inPseudoMain()) continue; + if (first) { + first = false; + } else { + cg.printf(", "); + } + cg.printf("f_%s", func->getId().c_str()); + } + } + } + cg.printf(") where\n"); + cg.printf("import HphpFFI\n"); + cg.printf("import Foreign.C\n"); + cg.printf("import Foreign.Ptr\n"); + cg.printf("import Foreign.Marshal.Alloc (alloca)\n"); + cg.printf("import Foreign.Storable (peek)\n"); + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputHSFFI(cg, ar); + popScope(); + } + f.close(); +} + +void AnalysisResult::outputJavaFFIStubs() { + AnalysisResultPtr ar = shared_from_this(); + + string packageName = Option::JavaFFIRootPackage; + string packageDir = packageName; + Util::replaceAll(packageDir, ".", "/"); + + string outputDir = ar->getOutputPath() + "/" + Option::FFIFilePrefix + + packageDir + "/"; + Util::mkdir(outputDir); + + string mainFile = outputDir + "HphpMain.java"; + ofstream fmain(mainFile.c_str()); + CodeGenerator cg(&fmain, CodeGenerator::FileCPP); + cg.setContext(CodeGenerator::JavaFFI); + + cg.printf("package %s;\n\n", packageName.c_str()); + cg.printf("import hphp.*;\n\n"); + + cg.indentBegin("public class HphpMain extends Hphp {\n"); + + // generate an "identify" method that identifies the exact class type + // of an HphpObject. + cg.indentBegin("public static HphpVariant identify(HphpVariant v) {\n"); + cg.indentBegin("try {if (v instanceof HphpObject) {\n"); + cg.printf("return identify(v.getVariantPtr());\n"); + cg.indentEnd("} } catch (NoClassDefFoundError e) { }\n"); + cg.printf("return v;\n"); + cg.indentEnd("}\n\n"); + + cg.printf("public static native HphpVariant identify(long ptr);\n\n"); + + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputJavaFFI(cg, ar); + popScope(); + } + + cg.indentEnd("}\n"); + fmain.close(); +} + +void AnalysisResult::outputJavaFFICppDecl() { + AnalysisResultPtr ar = shared_from_this(); + string path = m_outputPath + "/" + Option::FFIFilePrefix + + "java_stubs.h"; + Util::mkdir(path); + ofstream f(path.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + cg.setContext(CodeGenerator::JavaFFICppDecl); + + cg.printf("extern \"C\" {\n\n"); + + // the native signature of "identify" + string packageName = Option::JavaFFIRootPackage; + string mangledName = "Java_" + packageName + "_HphpMain_identify"; + Util::replaceAll(mangledName, ".", "_"); + cg.printf("JNIEXPORT jobject JNICALL\n"); + cg.printf("%s(JNIEnv *env, jclass main, jlong ptr);\n\n", + mangledName.c_str()); + + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputJavaFFICPPStub(cg, ar); + popScope(); + } + + cg.printf("}\n"); + + f.close(); +} + +void AnalysisResult::outputJavaFFICppImpl() { + AnalysisResultPtr ar = shared_from_this(); + string path = m_outputPath + "/" + Option::FFIFilePrefix + + "java_stubs.cpp"; + Util::mkdir(path); + ofstream f(path.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + cg.setContext(CodeGenerator::JavaFFICppImpl); + + cg.printInclude(""); + cg.printInclude(""); + cg.printInclude(""); + cg.printInclude(""); + cg.printInclude(""); + cg.printInclude("\"stubs.h\""); + cg.printInclude("\"java_stubs.h\""); + + cg.printf("/* preface starts */\n"); + + cg.printf("\nusing namespace HPHP;\n\n"); + + // forward declaration of exportVariantToJava + cg.printf("jobject exportVariantToJava(JNIEnv *, jclass, void *, int);\n\n"); + + cg.printf("/* preface finishes */\n"); + + // the native implementation of "identify" + string packageName = Option::JavaFFIRootPackage; + string mangledName = "Java_" + packageName + "_HphpMain_identify"; + Util::replaceAll(mangledName, ".", "_"); + cg.printf("JNIEXPORT jobject JNICALL\n"); + cg.indentBegin("%s(JNIEnv *env, jclass main, jlong ptr) {\n", + mangledName.c_str()); + Util::replaceAll(packageName, ".", "/"); + cg.printf("String clsName = concat(\"%s/\", " + "toString(x_get_class((Variant *)ptr)));\n", + packageName.c_str()); + cg.printf("jclass cls = env->FindClass(clsName.c_str());\n"); + cg.printf("jmethodID init = env->GetMethodID(cls, \"\", \"(J)V\");\n"); + cg.printf("return env->NewObject(cls, init, ptr);\n"); + cg.indentEnd("}\n\n"); + + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputJavaFFICPPStub(cg, ar); + popScope(); + } + + f.close(); +} + +void AnalysisResult::outputSwigFFIStubs() { + AnalysisResultPtr ar = shared_from_this(); + string path = m_outputPath + "/" + Option::FFIFilePrefix + + Option::ProgramName + ".i"; + Util::mkdir(path); + ofstream f(path.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + + cg.printf("%%module %s\n%%{\n", Option::ProgramName.c_str()); + cg.printInclude(""); + cg.printInclude("\"stubs.h\""); + cg.printf("using namespace HPHP;\n"); + + cg.setContext(CodeGenerator::SwigFFIImpl); + + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputSwigFFIStubs(cg, ar); + popScope(); + } + + cg.printf("%%}\n\n"); + + cg.printf("/////////////////////\n"); + cg.printf("// system definitions\n"); + cg.printf("/////////////////////\n\n"); + + cg.printf("%%include swig.i\n"); + + cg.printf("\n/////////////////\n"); + cg.printf( "// user functions\n"); + cg.printf( "/////////////////\n\n"); + + cg.setContext(CodeGenerator::SwigFFIDecl); + + BOOST_FOREACH(FileScopePtr fs, m_fileScopes) { + pushScope(fs); + fs->outputSwigFFIStubs(cg, ar); + popScope(); + } + + f.close(); +} + +/** + * Literal string to String precomputation + */ +void AnalysisResult::addLiteralString(const std::string s, + ScalarExpressionPtr sc) { + map >::const_iterator it = + m_stringLiterals.find(s); + if (it == m_stringLiterals.end()) { + int ct = m_stringLiterals.size(); + m_stringLiterals[s] = pair(ct, sc); + } +} +int AnalysisResult::getLiteralStringId(const std::string &s) { + map >::const_iterator it = + m_stringLiterals.find(s); + if (it != m_stringLiterals.end()) { + return it->second.first; + } + return -1; +} + +string AnalysisResult::getFuncId(ClassScopePtr cls, FunctionScopePtr func) { + if (cls) { + return cls->getId() + "::" + func->getId(); + } + return func->getId(); +} + +string AnalysisResult::getParamRTTIEntryKey(ClassScopePtr cls, + FunctionScopePtr func, + const std::string ¶mName) { + return getFuncId(cls, func) + "::" + paramName; +} + +void AnalysisResult::addParamRTTIEntry(ClassScopePtr cls, + FunctionScopePtr func, + const std::string ¶mName) { + string key = getParamRTTIEntryKey(cls, func, paramName); + m_paramRTTIs[key] = m_paramRTTICounter++; +} + +int AnalysisResult::getParamRTTIEntryId(ClassScopePtr cls, + FunctionScopePtr func, + const std::string ¶mName) { + string key = getParamRTTIEntryKey(cls, func, paramName); + map::const_iterator it = m_paramRTTIs.find(key); + if (it == m_paramRTTIs.end()) return -1; + return it->second; +} + +void AnalysisResult::addRTTIFunction(const std::string &id) { + m_rttiFuncs.insert(id); +} + +void AnalysisResult::cloneRTTIFuncs +(ClassScopePtr cls, const StringToFunctionScopePtrVecMap &functions) { + for (StringToFunctionScopePtrVecMap::const_iterator iter = + functions.begin(); iter != functions.end(); ++iter) { + for (unsigned int j = 0; j < iter->second.size(); j++) { + FunctionScopePtr func = iter->second[j]; + const string funcId = getFuncId(cls, func); + if (RTTIInfo::TheRTTIInfo.exists(funcId.c_str())) { + StatementPtr stmt = func->getStmt(); + func->setStmtCloned(stmt->clone()); + } + } + } +} + +void AnalysisResult::cloneRTTIFuncs(const char *RTTIDirectory) { + RTTIInfo::TheRTTIInfo.loadMetaData(Option::RTTIOutputFile.c_str()); + RTTIInfo::TheRTTIInfo.loadProfData(RTTIDirectory); + + for (unsigned int i = 0; i < m_fileScopes.size(); i++) { + // standalone rtti functions + cloneRTTIFuncs(ClassScopePtr(), m_fileScopes[i]->getFunctions()); + + // class rtti methods + for (StringToClassScopePtrVecMap::const_iterator iter = + m_fileScopes[i]->getClasses().begin(); + iter != m_fileScopes[i]->getClasses().end(); ++iter) { + for (unsigned int j = 0; j < iter->second.size(); j++) { + ClassScopePtr cls = iter->second[j]; + cloneRTTIFuncs(cls, cls->getFunctions()); + } + } + } +} + +void AnalysisResult::outputCPPLiteralStringPrecomputation() { + + ASSERT(m_stringLiterals.size() > 0); + AnalysisResultPtr self = shared_from_this(); + int bucketSize = m_stringLiterals.size() / Option::LiteralStringFileCount; + if (bucketSize < 500) bucketSize = 500; + uint bucketCount = m_stringLiterals.size() / bucketSize; + if (bucketCount * bucketSize != m_stringLiterals.size()) { + bucketCount++; + } + if (Option::LiteralStringCompression) bucketCount = 1; + + { + string filename = m_outputPath + "/" + Option::SystemFilePrefix + + "literal_strings.h"; + Util::mkdir(filename); + ofstream f(filename.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + + cg.printf("\n"); + cg.printInclude(""); + cg.printf("\n"); + cg.namespaceBegin(); + cg.indentBegin("class LiteralStringInitializer {\n"); + cg.printf("public:\n"); + cg.indentBegin("LiteralStringInitializer() {\n"); + for (uint i = 0; i < bucketCount; i++) { + cg.printf("init_%d();\n", i); + } + cg.indentEnd("}\n"); + map >::const_iterator it = + m_stringLiterals.begin(); + for (uint i = 0; i < bucketCount; i++) { + cg.printf("void init_%d();\n", i); + } + cg.indentEnd("};\n"); + cg.namespaceEnd(); + f.close(); + } + map >::const_iterator it = + m_stringLiterals.begin(); + const char *lsname = "literalStrings"; + for (uint i = 0; i < bucketCount; i++) { + stringstream filenames; + filenames << m_outputPath << "/" << Option::SystemFilePrefix << + "literal_strings_" << i << ".cpp"; + string filename = filenames.str(); + Util::mkdir(filename); + ofstream f(filename.c_str()); + CodeGenerator cg(&f, CodeGenerator::ClusterCPP); + cg.printf("\n"); + cg.printInclude("\"literal_strings.h\""); + cg.namespaceBegin(); + int sdataLen = 0; + int ldataLen = 0; + if (i == 0) { + if (Option::LiteralStringCompression) { + string zsdata; + string zldata; + getLiteralStringCompressed(zsdata, zldata); + const char *sdata = zsdata.data(); + sdataLen = zsdata.size(); + const char *ldata = zldata.data(); + ldataLen = zldata.size(); + ASSERT(sdataLen > 0 && ldataLen > 0); + outputHexBuffer(cg, "ls_csdata", sdata, sdataLen); + outputHexBuffer(cg, "ls_cldata", ldata, ldataLen); + } + cg.printf("StaticString %s[%d];\n", lsname, m_stringLiterals.size()); + cg.printf("static LiteralStringInitializer literalStringInitializer;\n"); + } + + cg.indentBegin("void LiteralStringInitializer::init_%d() {\n", i); + if (Option::LiteralStringCompression) { + cg.printf("StringUtil::InitLiteralStrings" + "(%s, %d, ls_csdata, %d, ls_cldata, %d);\n", + lsname, m_stringLiterals.size(), sdataLen, ldataLen); + } else { + for (int j = 0; j < bucketSize && + it != m_stringLiterals.end(); ++it, ++j) { + cg.printf("%s[%d] = ", lsname, it->second.first); + it->second.second->outputCPPString(cg, self); + cg.printf(";\n"); + } + } + cg.indentEnd("}\n"); + cg.namespaceEnd(); + f.close(); + } +} diff --git a/src/lib/analysis/analysis_result.h b/src/lib/analysis/analysis_result.h new file mode 100644 index 0000000000000..b9ee0ce44a859 --- /dev/null +++ b/src/lib/analysis/analysis_result.h @@ -0,0 +1,464 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __ANALYSIS_RESULT_H__ +#define __ANALYSIS_RESULT_H__ + +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +DECLARE_BOOST_TYPES(ClassScope); +DECLARE_BOOST_TYPES(FileScope); +DECLARE_BOOST_TYPES(FunctionScope); +DECLARE_BOOST_TYPES(DependencyGraph); +DECLARE_BOOST_TYPES(CodeError); +DECLARE_BOOST_TYPES(Location); +DECLARE_BOOST_TYPES(AnalysisResult); +DECLARE_BOOST_TYPES(ScalarExpression); + +class AnalysisResult : public BlockScope, public FunctionContainer { +public: + /** + * There are multiple passes over our syntax trees. This lists all of them. + */ + enum Phase { + // analyzeProgram + AnalyzeInclude, + AnalyzeTopLevel, + AnalyzeAll, + AnalyzeFinal, + + // pre-optimize + FirstPreOptimize, + SecondPreOptimize, + + // inferTypes + FirstInference, + SecondInference, + MoreInference, + LastInference, + + // post-optimize + PostOptimize, + }; + + enum FindClassBy { + ClassName, + MethodName, + PropertyName + }; + +public: + AnalysisResult(); + AnalysisResult(FileScopePtr file); + + void setPackage(Package *package) { m_package = package;} + void setParseOnDemand(bool v) { m_parseOnDemand = v;} + bool isParseOnDemand() { return m_package && m_parseOnDemand;} + + /** + * create_function() generates extra PHP code that defines the lambda. + * Stores the code in a temporary string, so we can parse this as an + * extra file appended to parsed code. + */ + void appendExtraCode(const std::string &code); + + Phase getPhase() const { return m_phase;} + void setPhase(Phase phase) { m_phase = phase;} + bool isFirstPass() const { + return m_phase == AnalyzeInclude || m_phase == FirstInference; + } + bool isSecondPass() const { + return m_phase == SecondInference; + } + + DependencyGraphPtr getDependencyGraph() { + return m_dependencyGraph; + } + CodeErrorPtr getCodeError() { + if (!m_codeError) { + m_codeError = CodeErrorPtr(new CodeError(shared_from_this())); + } + return m_codeError; + } + int getFunctionCount() const; + int getClassCount() const; + void countReturnTypes(std::map &counts); + + void addEntryPoint(const std::string &name); + void addEntryPoints(const std::vector &names); + + void loadBuiltins(); + void analyzeProgram(); + void analyzeProgramFinal(); + void inferTypes(int maxPass = 100); + void preOptimize(int maxPass = 100); + void postOptimize(int maxPass = 100); + void incOptCounter() { m_optCounter++; } + template + bool preOptimize(boost::shared_ptr &before) { + if (before) { + boost::shared_ptr after = boost::dynamic_pointer_cast + (before->preOptimize(shared_from_this())); + if (after) { + before = after; + m_optCounter++; + return true; + } + } + return false; + } + template + bool postOptimize(boost::shared_ptr &before) { + if (before) { + boost::shared_ptr after = boost::dynamic_pointer_cast + (before->postOptimize(shared_from_this())); + if (after) { + before = after; + m_optCounter++; + return true; + } + } + return false; + } + + /** + * When types are newly inferred, we need more passes, until no new types + * are inferred. + */ + void incNewlyInferred() { + m_newlyInferred++; + } + + void containsDynamicFunctionCall() { m_dynamicFunction = true;} + void containsDynamicClass() { m_dynamicClass = true;} + + /** + * Scalar array handling. + */ + int registerScalarArray(ExpressionPtr pairs); + + void setInsideScalarArray(bool flag); + bool getInsideScalarArray(); + std::string getScalarArrayCompressedText(); + + /** + * Force all class variables to be variants, since l-val or reference + * of dynamic properties are used. + */ + void forceClassVariants(); + + /** + * Force specified variable of all classes to be variants. + */ + void forceClassVariants(const std::string &name); + + /** + * Code generation functions. + */ + bool outputAllPHP(CodeGenerator::Output output); + void outputAllCPP(CodeGenerator::Output output, int clusterCount, + const std::string *compileDir); + void outputAllCPP(CodeGenerator &cg); // mainly for unit test + + void outputCPPSystemImplementations(CodeGenerator &cg); + void outputCPPFileRunDecls(CodeGenerator &cg); + void outputCPPFileRunImpls(CodeGenerator &cg); + void outputCPPRedeclaredFunctionDecl(CodeGenerator &cg); + void outputCPPRedeclaredFunctionImpl(CodeGenerator &cg); + void outputCPPRedeclaredClassDecl(CodeGenerator &cg); + void outputCPPRedeclaredClassImpl(CodeGenerator &cg); + void outputCPPDynamicConstantDecl(CodeGenerator &cg); + void outputCPPDynamicConstantImpl(CodeGenerator &cg); + void outputCPPScalarArrayDecl(CodeGenerator &cg); + void outputCPPScalarArrayImpl(CodeGenerator &cg); + void outputCPPScalarArrayInit(CodeGenerator &cg, int fileCount, int part); + void outputCPPClassStaticInitializerFlags(CodeGenerator &cg, + bool constructor); + + /** + * Parser creates a FileScope upon parsing a new file. + */ + void setFileScope(FileScopePtr fileScope); + FileScopePtr getFileScope() { return m_file;} + FileScopePtr findFileScope(const std::string &name, bool parseOnDemand); + const StringToFileScopePtrMap &getAllFiles() { return m_files;} + const std::vector &getAllFilesVector() { + return m_fileScopes; + } + + /** + * When inferring types, it's important to push/pop correct a BlockScope + * that has the right variable and constant symbol tables to look up and + * check their types. + */ + void pushScope(BlockScopePtr scope); + void popScope(); + BlockScopePtr getScope() const { return m_scope;} + ClassScopePtr getClassScope() const; + FunctionScopePtr getFunctionScope() const; + + /** + * Declarations + */ + bool declareFunction(FunctionScopePtr funcScope); + bool declareClass(ClassScopePtr classScope); + bool declareConst(FileScopePtr fs, const std::string& name); + + /** + * Dependencies + */ + bool addClassDependency(FileScopePtr usingFile, + const std::string &className); + bool addFunctionDependency(FileScopePtr usingFile, + const std::string &functionName); + bool addIncludeDependency(FileScopePtr usingFile, + const std::string &includeFilename); + bool addConstantDependency(FileScopePtr usingFile, + const std::string &constantName); + void addCallee(StatementPtr stmt); + + /** + * Find class by that name, and update class name if it's "self" or + * "parent". + */ + ClassScopePtr resolveClass(std::string &className); + ClassScopePtr findClass(const std::string &className, + FindClassBy by = ClassName); + const ClassScopePtrVec &findClasses(const std::string &className); + bool classMemberExists(const std::string &name, FindClassBy by); + FunctionScopePtr findFunction(const std::string &funcName); + FunctionScopePtr findHelperFunction(const std::string &funcName); + BlockScopePtr findConstantDeclarer(const std::string &constName); + bool isConstantDeclared(const std::string &constName); + bool isConstantRedeclared(const std::string &constName); + + /** + * For function declaration parsing. + */ + FunctionContainerPtr getFunctionContainer(); + static std::string prepareFile(const char *root, + const std::string &fileName, bool chop); + + void setOutputPath(const std::string &path) { + m_outputPath = path; + } + const std::string &getOutputPath() { + return m_outputPath; + } + + /** + * PHP source info functions. + */ + void recordSourceInfo(const std::string &fileline, LocationPtr loc); + void recordClassSource(const std::string &clsname, + const std::string &filename); + void recordFunctionSource(const std::string &funcname, + const std::string &filename); + + /** + * Literal string to String precomputation + */ + void addLiteralString(const std::string s, ScalarExpressionPtr sc); + int getLiteralStringId(const std::string &s); + void getLiteralStringCompressed(std::string &zsdata, std::string &zldata); + + /** + * Profiling runtime parameter type + */ + std::string getFuncId(ClassScopePtr cls, FunctionScopePtr func); + std::string getParamRTTIEntryKey(ClassScopePtr cls, + FunctionScopePtr func, + const std::string ¶mName); + void addParamRTTIEntry(ClassScopePtr cls, + FunctionScopePtr func, + const std::string ¶mName); + int getParamRTTIEntryId(ClassScopePtr cls, + FunctionScopePtr func, + const std::string ¶mName); + void addRTTIFunction(const std::string &id); + void cloneRTTIFuncs(const char *RTTIDirectory); + + /** + * For global state output + */ + void outputCPPGlobalStateBegin(CodeGenerator &cg, const char *section); + void outputCPPGlobalStateEnd(CodeGenerator &cg, const char *section); + + std::vector &getFuncTableBucket(FunctionScopePtr func); + +private: + Package *m_package; + bool m_parseOnDemand; + Phase m_phase; + int m_newlyInferred; + DependencyGraphPtr m_dependencyGraph; + CodeErrorPtr m_codeError; + StringToFileScopePtrMap m_files; + FileScopePtrVec m_fileScopes; + FileScopePtr m_file; + std::string m_extraCode; + + StringToClassScopePtrMap m_systemClasses; + StringToFunctionScopePtrVecMap m_functionDecs; + StringToClassScopePtrVecMap m_classDecs; + StringToClassScopePtrVecMap m_methodToClassDecs; + StringToFileScopePtrMap m_constDecs; + std::set m_constRedeclared; + + bool m_dynamicClass; + bool m_dynamicFunction; + bool m_classForcedVariants; + + BlockScopePtrVec m_scopes; + BlockScopePtr m_scope; + + StatementPtrVec m_callees; + StatementPtrSet m_calleesAdded; + std::string m_outputPath; + int m_optCounter; + + std::map m_scalarArrays; + int m_scalarArraysCounter; + std::vector m_scalarArrayIds; + std::map m_paramRTTIs; + std::set m_rttiFuncs; + int m_paramRTTICounter; + + bool m_insideScalarArray; + +public: + struct ScalarArrayExp { + int id; + int len; + ExpressionPtr exp; + }; +private: + int m_scalarArraySortedAvgLen; + int m_scalarArraySortedIndex; + int m_scalarArraySortedSumLen; + std::vector m_scalarArraySorted; + int m_scalarArrayCompressedTextSize; + + typedef boost::adjacency_list Graph; + typedef boost::graph_traits::vertex_descriptor vertex_descriptor; + typedef boost::graph_traits::adjacency_iterator adjacency_iterator; + Graph m_depGraph; + typedef std::map VertexToFileScopePtrMap; + VertexToFileScopePtrMap m_fileVertMap; + void link(FileScopePtr user, FileScopePtr provider); + void getTrueDeps(FileScopePtr f, + std::map &trueDeps); + void clusterByFileSizes(StringToFileScopePtrVecMap &clusters, + int clusterCount); + + std::map m_sourceInfos; + std::map > m_clsNameMap; + std::map > m_funcNameMap; + + std::map > m_stringLiterals; + + int m_funcTableSize; + CodeGenerator::MapIntToStringVec m_funcTable; + + /** + * Creates the global function table. Needs to be called before generating + * cpp code for each toplevel function. + */ + void createGlobalFuncTable(); + + void outputCPPGlobalDeclarations(); + void outputCPPMain(); + void outputCPPScalarArrays(bool system); + void outputCPPScalarArrays(CodeGenerator &cg, int fileCount, int part); + void outputCPPGlobalVariablesMethods(int part); + void outputCPPGlobalStateDynamicConstants(CodeGenerator &cg); + void outputCPPGlobalStatePseudoMainVariables(CodeGenerator &cg); + void outputCPPGlobalStateRedeclaredFunctions(CodeGenerator &cg); + void outputCPPGlobalStateRedeclaredClasses(CodeGenerator &cg); + void outputCPPGlobalState(); + void outputCPPClassStaticInitializerDecls(CodeGenerator &cg); + void outputCPPClassIncludes(CodeGenerator &cg); + void outputCPPExtClassImpl(CodeGenerator &cg); + void outputCPPDynamicTables(CodeGenerator::Output output); + void outputCPPDynamicTablesHeader(CodeGenerator &cg, + bool includeGlobalVars = true, + bool includes = true); + void outputCPPClassMapFile(); + void outputCPPSourceInfos(); + void outputCPPNameMaps(); + void outputRTTIMetaData(const char *filename); + void outputCPPClassMap(CodeGenerator &cg); + void outputCPPSystem(); + void outputCPPGlobalImplementations(CodeGenerator &cg); + void outputCPPClusterImpl(CodeGenerator &cg, const FileScopePtrVec &files); + + void repartitionCPP(const std::string &filename, int64 targetSize, + bool insideHPHP); + void repartitionLargeCPP(const std::vector &filenames, + const std::vector &additionals); + + void outputCPPFFIStubs(); + void outputHSFFIStubs(); + + /** + * Outputs Java stubs. + * + * Each PHP file becomes a Java package, in which the HphpMain class + * contains all the toplevel function definitions, and the rest of the + * classes are one-to-one corresponding to the php classes declared in + * that file. + */ + void outputJavaFFIStubs(); + /** + * Outputs one .h file that declares all the Java native method stubs, + * avoiding javah for performance reason. + */ + void outputJavaFFICppDecl(); + /** + * Outputs one .cpp file that implements all the native methods declared + * in the Java classes generated by outputJavaFFIStubs(). + */ + void outputJavaFFICppImpl(); + + void outputSwigFFIStubs(); + + void outputHexBuffer(CodeGenerator &cg, const char *name, + const char *buf, int len); + void outputCPPLiteralStringPrecomputation(); + + void cloneRTTIFuncs(ClassScopePtr cls, + const StringToFunctionScopePtrVecMap &functions); + + AnalysisResultPtr shared_from_this() { + return boost::static_pointer_cast + (BlockScope::shared_from_this()); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __ANALYSIS_RESULT_H__ diff --git a/src/lib/analysis/block_scope.cpp b/src/lib/analysis/block_scope.cpp new file mode 100644 index 0000000000000..a6a8c207779c5 --- /dev/null +++ b/src/lib/analysis/block_scope.cpp @@ -0,0 +1,77 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace HPHP; + +/////////////////////////////////////////////////////////////////////////////// + +BlockScope::BlockScope(const std::string &name, StatementPtr stmt, KindOf kind) + : m_casedName(name), m_stmt(stmt), m_kind(kind), + m_loopNestedLevel(0), m_incLevel(0) { + m_name = Util::toLower(name); + m_variables = VariableTablePtr(new VariableTable(*this)); + m_constants = ConstantTablePtr(new ConstantTable(*this)); + SymbolTable::AllSymbolTables.push_back(m_variables); + SymbolTable::AllSymbolTables.push_back(m_constants); +} + +void BlockScope::incLoopNestedLevel() { + m_loopNestedLevel++; +} + +void BlockScope::decLoopNestedLevel() { + ASSERT(m_loopNestedLevel > 0); + m_loopNestedLevel--; +} + +ModifierExpressionPtr +BlockScope::setModifiers(ModifierExpressionPtr modifiers) { + ModifierExpressionPtr oldModifiers = m_modifiers; + m_modifiers = modifiers; + return oldModifiers; +} + +void BlockScope::addMovableInclude(StatementPtr include) { + if (!m_includes) { + m_includes = StatementListPtr + (new StatementList(LocationPtr(), Statement::KindOfStatementList)); + } + m_includes->addElement(include); +} + +void BlockScope::inferTypes(AnalysisResultPtr ar) { + if (m_stmt) { + ar->pushScope(shared_from_this()); + m_stmt->inferTypes(ar); + ar->popScope(); + } +} + +void BlockScope::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + m_constants->outputPHP(cg, ar); + m_variables->outputPHP(cg, ar); +} + +void BlockScope::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + m_constants->outputCPP(cg, ar); + m_variables->outputCPP(cg, ar); +} diff --git a/src/lib/analysis/block_scope.h b/src/lib/analysis/block_scope.h new file mode 100644 index 0000000000000..cbd4b77119623 --- /dev/null +++ b/src/lib/analysis/block_scope.h @@ -0,0 +1,119 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __BLOCK_SCOPE_H__ +#define __BLOCK_SCOPE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class CodeGenerator; +DECLARE_BOOST_TYPES(Statement); +DECLARE_BOOST_TYPES(AnalysisResult); +DECLARE_BOOST_TYPES(VariableTable); +DECLARE_BOOST_TYPES(ConstantTable); +DECLARE_BOOST_TYPES(ModifierExpression); +DECLARE_BOOST_TYPES(IncludeExpression); +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(BlockScope); +DECLARE_BOOST_TYPES(ClassScope); + +/** + * Base class of ClassScope and FunctionScope. + */ +class BlockScope : public boost::enable_shared_from_this { +public: + enum KindOf { + ClassScope, + FunctionScope, + FileScope, + ProgramScope, + }; + + BlockScope(const std::string &name, StatementPtr stmt, KindOf kind); + virtual ~BlockScope() {} + bool is(KindOf kind) const { return kind == m_kind;} + const std::string &getName() const { return m_name;} + const std::string &getCasedName() const { return m_casedName;} + void setName(const std::string name) { m_name = name;} + virtual std::string getId() const { return getName(); } + StatementPtr getStmt() { return m_stmt;} + VariableTablePtr getVariables() { return m_variables;} + ConstantTablePtr getConstants() { return m_constants;} + + /** + * Helpers for keeping track of break/continue nested level. + */ + void incLoopNestedLevel(); + void decLoopNestedLevel(); + int getLoopNestedLevel() const { return m_loopNestedLevel;} + + /** + * Helpers for conditional includes. + */ + void setIncludeLevel(int incLevel) { m_incLevel = incLevel;} + int getIncludeLevel() const { return m_incLevel;} + + /** + * Helpers for parsing class functions and variables. + */ + ModifierExpressionPtr setModifiers(ModifierExpressionPtr modifiers); + ModifierExpressionPtr getModifiers() { return m_modifiers;} + + /** + * Movable includes. + */ + void addMovableInclude(StatementPtr include); + StatementListPtr getMovableIncludes() { return m_includes;} + + /** + * Triggers type inference of all statements inside this block. + */ + void inferTypes(AnalysisResultPtr ar); + + /** + * Generate constant and variable declarations. + */ + virtual void outputPHP(CodeGenerator &cg, AnalysisResultPtr ar); + virtual void outputCPP(CodeGenerator &cg, AnalysisResultPtr ar); + + virtual bool inPseudoMain() { + return false; + } + + virtual ClassScopePtr getParentScope(AnalysisResultPtr ar) { + return ClassScopePtr(); + } + +protected: + std::string m_name; + std::string m_casedName; + StatementPtr m_stmt; + KindOf m_kind; + VariableTablePtr m_variables; + ConstantTablePtr m_constants; + + int m_loopNestedLevel; + int m_incLevel; + ModifierExpressionPtr m_modifiers; + StatementListPtr m_includes; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __BLOCK_SCOPE_H__ diff --git a/src/lib/analysis/class_scope.cpp b/src/lib/analysis/class_scope.cpp new file mode 100644 index 0000000000000..421f232d945a7 --- /dev/null +++ b/src/lib/analysis/class_scope.cpp @@ -0,0 +1,1032 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// + +ClassScope::ClassScope(KindOf kindOf, const std::string &name, + const std::string &parent, + const vector &bases, StatementPtr stmt, + FileScopePtr file) + : BlockScope(name, stmt, BlockScope::ClassScope), m_file(file), + m_kindOf(kindOf), m_parent(parent), m_bases(bases), m_attribute(0), + m_redeclaring(-1), m_volatile(false), m_needStaticInitializer(false), + m_derivesFromRedeclaring(FromNormal) { + m_dynamic = Option::isDynamicClass(m_name); + m_volatile = m_dynamic; // dynamic class is also volatile + + ASSERT(m_parent.empty() || (!m_bases.empty() && m_bases[0] == m_parent)); +} + +ClassScope::ClassScope(AnalysisResultPtr ar, + const std::string &name, const std::string &parent, + const std::vector &bases, + const std::vector &methods) + : BlockScope(name, StatementPtr(), BlockScope::ClassScope), + m_kindOf(KindOfObjectClass), m_parent(parent), m_bases(bases), + m_attribute(0), m_redeclaring(-1), m_volatile(false), + m_needStaticInitializer(false), + m_derivesFromRedeclaring(FromNormal) { + BOOST_FOREACH(FunctionScopePtr f, methods) { + if (f->getName() == "__construct") setAttribute(HasConstructor); + else if (f->getName() == "__destruct") setAttribute(HasDestructor); + else if (f->getName() == "__call") setAttribute(HasUnknownMethodHandler); + addFunction(ar, f); + } + setAttribute(Extension); + setAttribute(System); + + ASSERT(m_parent.empty() || (!m_bases.empty() && m_bases[0] == m_parent)); +} + +const char *ClassScope::getOriginalName() const { + if (m_stmt) { + return dynamic_pointer_cast(m_stmt)-> + getOriginalName().c_str(); + } + return m_name.c_str(); +} + +/////////////////////////////////////////////////////////////////////////////// + +void ClassScope::collectMethods(AnalysisResultPtr ar, + StringToFunctionScopePtrMap &funcs, + bool collectPrivate /* = true */, + bool forInvoke /* = false */) { + // add all functions this class has + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + if (!collectPrivate && iter->second.back()->isPrivate()) continue; + + StringToFunctionScopePtrMap::const_iterator iterFuncs = + funcs.find(iter->first); + if (iterFuncs == funcs.end()) { + funcs[iter->first] = iter->second.back(); + } else { + iterFuncs->second->setVirtual(); + iter->second.back()->setVirtual(); + } + } + + BOOST_FOREACH(string miss, m_missingMethods) { + StringToFunctionScopePtrMap::const_iterator iterFuncs = + funcs.find(miss); + if (iterFuncs != funcs.end()) { + iterFuncs->second->setVirtual(); + } + } + + set seen; + seen.insert(m_name); + + // walk up + for (int i = m_bases.size() - 1; i >= 0; i--) { + const string &base = m_bases[i]; + if (seen.find(base) != seen.end()) { + ar->getCodeError()->record(CodeError::InvalidDerivation, m_stmt, + ConstructPtr(), base.c_str()); + m_bases.erase(m_bases.begin() + i); + continue; + } + seen.insert(base); + if (forInvoke && base != m_parent) { + continue; + } + ClassScopePtr super = ar->findClass(base); + if (super) { + if (super->isRedeclaring() && base == m_parent) { + if (forInvoke) continue; + const ClassScopePtrVec &classes = ar->findClasses(m_parent); + StringToFunctionScopePtrMap pristine(funcs); + BOOST_FOREACH(ClassScopePtr cls, classes) { + StringToFunctionScopePtrMap cur(pristine); + cls->collectMethods(ar, cur, false, forInvoke); + funcs.insert(cur.begin(), cur.end()); + } + m_derivesFromRedeclaring = DirectFromRedeclared; + getVariables()->forceVariants(ar); + + } else { + super->collectMethods(ar, funcs, false, forInvoke); + if (super->derivesFromRedeclaring() && base == m_parent) { + m_derivesFromRedeclaring = IndirectFromRedeclared; + getVariables()->forceVariants(ar); + } + } + } else { + ar->getCodeError()->record(CodeError::UnknownBaseClass, m_stmt, + ConstructPtr(), base.c_str()); + m_bases.erase(m_bases.begin() + i); + } + } +} + +bool ClassScope::derivesFrom(AnalysisResultPtr ar, + const std::string &base) const { + BOOST_FOREACH(std::string base_i, m_bases) { + if (base_i == base) return true; + } + BOOST_FOREACH(std::string base_i, m_bases) { + ClassScopePtr cl = ar->findClass(base_i); + ASSERT(cl); + if (cl->derivesFrom(ar, base)) return true; + } + return false; +} + +FunctionScopePtr ClassScope::findFunction(AnalysisResultPtr ar, + const std::string &name, + bool recursive, + bool exclIntfBase /*= false */) { + ASSERT(Util::toLower(name) == name); + StringToFunctionScopePtrVecMap::const_iterator iter; + iter = m_functions.find(name); + if (iter != m_functions.end()) { + ASSERT(iter->second.back()); + return iter->second.back(); + } + + // walk up + if (recursive && derivesFromRedeclaring() != DirectFromRedeclared) { + for (int i = m_bases.size() - 1; i >= 0; i--) { + const string &base = m_bases[i]; + ClassScopePtr super = ar->findClass(base); + if (!super || (super->isInterface() && exclIntfBase)) continue; + FunctionScopePtr func = + super->findFunction(ar, name, true, exclIntfBase); + if (func) return func; + } + } + if (derivesFromRedeclaring() == DirectFromRedeclared) { + setDynamic(ar, name); + } + + return FunctionScopePtr(); +} + +FunctionScopePtr ClassScope::findConstructor(AnalysisResultPtr ar, + bool recursive) { + StringToFunctionScopePtrVecMap::const_iterator iter; + string name; + if (classNameCtor()) { + name = getName(); + } + else { + name = "__construct"; + } + iter = m_functions.find(name); + if (iter != m_functions.end()) { + ASSERT(iter->second.back()); + return iter->second.back(); + } + + // walk up + if (recursive && derivesFromRedeclaring() != DirectFromRedeclared) { + ClassScopePtr super = ar->findClass(m_parent); + if (super) { + FunctionScopePtr func = + super->findConstructor(ar, true); + if (func) return func; + } + } + if (derivesFromRedeclaring() == DirectFromRedeclared) { + setDynamic(ar, name); + } + + return FunctionScopePtr(); +} + +void ClassScope::setStaticDynamic(AnalysisResultPtr ar) { + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + BOOST_FOREACH(FunctionScopePtr fs, iter->second) { + if (fs->isStatic()) fs->setDynamic(); + } + } + if (!m_parent.empty()) { + if (derivesFromRedeclaring() == DirectFromRedeclared) { + ClassScopePtrVec parents = ar->findClasses(m_parent); + BOOST_FOREACH(ClassScopePtr cl, parents) { + cl->setStaticDynamic(ar); + } + } else { + ClassScopePtr parent = ar->findClass(m_parent); + if (parent) { + parent->setStaticDynamic(ar); + } + } + } +} + +void ClassScope::setDynamic(AnalysisResultPtr ar, const std::string &name) { + StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.find(name); + if (iter != m_functions.end()) { + BOOST_FOREACH(FunctionScopePtr fs, iter->second) { + fs->setDynamic(); + } + } else if (!m_parent.empty()) { + if (derivesFromRedeclaring() == DirectFromRedeclared) { + ClassScopePtrVec parents = ar->findClasses(m_parent); + BOOST_FOREACH(ClassScopePtr cl, parents) { + cl->setDynamic(ar, name); + } + } else { + ClassScopePtr parent = ar->findClass(m_parent); + if (parent) { + parent->setDynamic(ar, name); + } + } + } +} + +void ClassScope::setSystem() { + setAttribute(ClassScope::System); + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + iter->second[0]->setSystem(); + } +} + +bool ClassScope::needLazyStaticInitializer() { + return getVariables()->getAttribute(VariableTable::ContainsDynamicStatic) || + getConstants()->hasDynamic(); +} + +bool ClassScope::hasAttribute(ClassScope::Attribute attr, + AnalysisResultPtr ar) const { + if (getAttribute(attr)) return true; + + if (!m_parent.empty()) { + ClassScopePtr super = ar->findClass(m_parent); + if (super) return super->hasAttribute(attr, ar); + } + + return false; +} + +void ClassScope::outputCPPClassMap(CodeGenerator &cg, AnalysisResultPtr ar) { + // header + int attribute = ClassInfo::IsNothing; + if (!isUserClass()) attribute |= ClassInfo::IsSystem; + if (isRedeclaring()) attribute |= ClassInfo::IsRedeclared; + if (isVolatile()) attribute |= ClassInfo::IsVolatile; + if (isInterface()) attribute |= ClassInfo::IsInterface; + if (m_kindOf & KindOfAbstractClass) attribute |= ClassInfo::IsAbstract; + if (m_kindOf & KindOfFinalClass) attribute |= ClassInfo::IsFinal; + cg.printf("(const char *)0x%04X, \"%s\", \"%s\",\n", attribute, + getCasedName().c_str(), m_parent.c_str()); + + // parent interfaces + for (unsigned int i = 0; i < m_bases.size(); i++) { + cg.printf("\"%s\", ", m_bases[i].c_str()); + } + cg.printf("NULL,\n"); + + // methods + std::map sortedMethods; // by source line number + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + FunctionScopePtr func = iter->second.back(); + int index = 0; + if (func->getStmt()) { + LocationPtr loc = func->getStmt()->getLocation(); + if (loc) { + index = loc->line1 * 1000 + loc->char1; + } + } + sortedMethods[index].push_back(func); + } + for (std::map::const_iterator iter = + sortedMethods.begin(); iter != sortedMethods.end(); ++iter) { + for (unsigned int i = 0; i < iter->second.size(); i++) { + iter->second[i]->outputCPPClassMap(cg, ar); + } + } + cg.printf("NULL,\n"); + + // properties && constants + ar->pushScope(shared_from_this()); + m_variables->outputCPPClassMap(cg, ar); + m_constants->outputCPPClassMap(cg, ar); + ar->popScope(); +} + +bool ClassScope::hasConst(const string &name) { + return m_constants->isPresent(name); +} + +TypePtr ClassScope::checkProperty(const std::string &name, TypePtr type, + bool coerce, AnalysisResultPtr ar, + ConstructPtr construct, int &properties) { + return getVariables()->checkProperty(name, type, coerce, + ar, construct, properties); +} + +TypePtr ClassScope::checkStatic(const std::string &name, TypePtr type, + bool coerce, AnalysisResultPtr ar, + ConstructPtr construct, int &properties) { + ar->pushScope(shared_from_this()); + TypePtr ret = getVariables()->checkVariable(name, type, coerce, + ar, construct, properties); + ar->popScope(); + return ret; +} + +TypePtr ClassScope::checkConst(const std::string &name, TypePtr type, + bool coerce, AnalysisResultPtr ar, + ConstructPtr construct, bool &present) { + return getConstants()->check(name, type, coerce, + ar, construct, present); +} + +ClassScopePtr ClassScope::getParentScope(AnalysisResultPtr ar) { + if (m_parent.empty()) return ClassScopePtr(); + return ar->findClass(m_parent); +} + +void ClassScope::serialize(JSON::OutputStream &out) const { + JSON::MapStream ms(out); + map propMap; + set names; + m_variables->getNames(names); + BOOST_FOREACH(string name, names) { + int pm = 0; + if (m_variables->isPublic(name)) pm |= ClassScope::Public; + else if (m_variables->isPrivate(name)) pm |= ClassScope::Private; + else if (m_variables->isProtected(name)) pm |= ClassScope::Protected; + if (m_variables->isStatic(name)) pm |= ClassScope::Static; + propMap[name] = pm; + } + names.clear(); + vector cnames; + m_constants->getSymbols(cnames); + + // What's a mod again? + ms.add("attributes", m_attribute) + .add("kind", m_kindOf) + .add("parent", m_parent) + .add("bases", m_bases) + .add("properties", propMap) + .add("functions", m_functions); + + /* Super Sad */ + out.raw() << ","; + out << JSON::Name("consts"); + JSON::MapStream cs(out); + BOOST_FOREACH(string cname, cnames) { + TypePtr type = m_constants->getType(cname, true); + if (!type) { + cs.add(cname, -1); + } else if (type->isSpecificObject()) { + cs.add(cname, type->getName()); + } else { + cs.add(cname, type->getKindOf()); + } + } + cs.done(); + ms.done(); +} + +void ClassScope::outputCPPDynamicClassDecl(CodeGenerator &cg) { + string clsStr = getId(); + const char *clsName = clsStr.c_str(); + cg.printf("Object %s%s(CArrRef params, bool init = true);\n", + Option::CreateObjectPrefix, clsName); +} + +void ClassScope::outputCPPDynamicClassCreateDecl(CodeGenerator &cg) { + cg.printf("Object create_object(const char *s, CArrRef params, " + "bool init = true, ObjectData *root);\n"); +} + +void ClassScope::outputCPPDynamicClassImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + string clsStr = getId(); + const char *clsName = clsStr.c_str(); + cg.indentBegin("Object %s%s(CArrRef params, bool init /* = true */) {\n", + Option::CreateObjectPrefix, clsName); + cg.printf("return Object(%s%s(NEW(%s%s)())->dynCreate(params, init));\n", + Option::SmartPtrPrefix, clsName, Option::ClassPrefix, clsName); + cg.indentEnd("}\n"); +} + +void ClassScope::outputCPPClassJumpTable +(CodeGenerator &cg, + const StringToClassScopePtrVecMap &classScopes, + const vector &classes, const char* macro) { + cg.printDeclareGlobals(); + for (JumpTable jt(cg, classes, true, false, false); jt.ready(); jt.next()) { + const char *clsName = jt.key(); + StringToClassScopePtrVecMap::const_iterator iterClasses = + classScopes.find(clsName); + if (iterClasses != classScopes.end()) { + if (iterClasses->second[0]->isRedeclaring()) { + cg.printf("%s_REDECLARED(0x%016llXLL, %s);\n", macro, + hash_string_i(clsName), clsName); + } else { + cg.printf("%s(0x%016llXLL, %s);\n", macro, + hash_string_i(clsName), clsName); + } + } + } +} + + +void ClassScope::outputCPPDynamicClassCreateImpl +(CodeGenerator &cg, const StringToClassScopePtrVecMap &classScopes, + const vector &classes) { + // output create_object() + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + cg.indentBegin("Object create%s_object(const char *s, " + "CArrRef params, bool init /* = true */," + "ObjectData* root /* = NULL*/) {\n", system ? + "_builtin" : ""); + bool withEval = !system && Option::EnableEval == Option::FullEval; + if (withEval) { + // See if there's an eval'd version + cg.indentBegin("{\n"); + cg.printf("Variant r;\n"); + cg.printf("if ((ClassInfo::HasClass(s) || (eval_try_autoload(s) && " + "ClassInfo::HasClass(s))) && " + "eval_create_object_hook(r, s, params, init, root)) " + "return r;\n"); + cg.indentEnd("}\n"); + } + outputCPPClassJumpTable(cg, classScopes, classes, "HASH_CREATE_OBJECT"); + if (!system) { + cg.printf("return create_builtin_object(s, params, init, root);\n"); + } else { + cg.printf("return throw_missing_class(s);\n"); + } + cg.indentEnd("}\n"); +} + +void ClassScope::outputCPPInvokeStaticMethodImpl +(CodeGenerator &cg, const StringToClassScopePtrVecMap &classScopes, + const vector &classes) { + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + cg.indentBegin("Variant invoke%s_static_method(const char *s, " + "const char *method, CArrRef params, bool fatal) {\n", + system ? "_builtin" : ""); + if (!system && Option::EnableEval == Option::FullEval) { + // See if there's an eval'd version + cg.printf("bool foundClass = false;\n"); + cg.indentBegin("{\n"); + cg.printf("Variant r;\n"); + cg.printf("if (eval_invoke_static_method_hook(r, s, method, params, " + "foundClass)) return r;\n"); + cg.indentBegin("else if (foundClass) {\n"); + cg.printf("return o_invoke_failed(s, method, fatal);\n"); + cg.indentEnd("}\n"); + cg.indentEnd("}\n"); + } + outputCPPClassJumpTable(cg, classScopes, classes, "HASH_INVOKE_STATIC_METHOD"); + + // There should be invoke_failed for static methods... + if (!system) { + bool withEval = !system && Option::EnableEval == Option::FullEval; + if (withEval) { + cg.indentBegin("try {\n"); + } + cg.printf("return invoke_builtin_static_method(s, method, params, fatal);" + "\n"); + if (withEval) { + cg.indentEnd(""); + cg.indentBegin("} catch (ClassNotFoundException &e) {\n"); + cg.indentBegin("if (eval_try_autoload(s)) {\n"); + cg.printf("Variant r;\n"); + cg.printf("if (eval_invoke_static_method_hook(r, s, method, params, " + "foundClass)) return r;\n"); + cg.indentBegin("else if (foundClass) {\n"); + cg.printf("return o_invoke_failed(s, method, fatal);\n"); + cg.indentEnd("}\n"); + cg.indentEnd("}\n"); + cg.printf("throw e;\n"); + cg.indentEnd("}\n"); + } + } else { + cg.indentBegin("if (fatal) {\n"); + cg.printf("return throw_missing_class(s);\n"); + cg.indentEnd(""); + cg.indentBegin("} else {\n"); + cg.printf("Logger::Warning(\"call_user_func to non-existent class's method" + " %%s::%%s\", s, method);\n"); + cg.printf("return false;\n"); + cg.indentEnd("}\n"); + } + cg.indentEnd("}\n"); +} + +void ClassScope::outputCPPGetStaticPropertyImpl +(CodeGenerator &cg, const StringToClassScopePtrVecMap &classScopes, + const vector &classes) { + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + cg.indentBegin("Variant get%s_static_property(const char *s, " + "const char *prop) {\n", + system ? "_builtin" : ""); + if (!system && Option::EnableEval == Option::FullEval) { + // See if there's an eval'd version + cg.indentBegin("{\n"); + cg.printf("Variant r;\n"); + cg.printf("if (eval_get_static_property_hook(r, s, prop)) " + "return r;\n"); + cg.indentEnd("}\n"); + } + outputCPPClassJumpTable(cg, classScopes, classes, "HASH_GET_STATIC_PROPERTY"); + if (!system) { + cg.printf("return get_builtin_static_property(s, prop);\n"); + } else { + cg.printf("return null;\n"); + } + cg.indentEnd("}\n"); + + cg.indentBegin("Variant *get%s_static_property_lv(const char *s, " + "const char *prop) {\n", + system ? "_builtin" : ""); + if (!system && Option::EnableEval == Option::FullEval) { + // See if there's an eval'd version + cg.indentBegin("{\n"); + cg.printf("Variant *r;\n"); + cg.printf("if (eval_get_static_property_lv_hook(r, s, prop)) " + "return r;\n"); + cg.indentEnd("}\n"); + } + outputCPPClassJumpTable(cg, classScopes, classes, "HASH_GET_STATIC_PROPERTY_LV"); + if (!system) { + cg.printf("return get_builtin_static_property_lv(s, prop);\n"); + } else { + cg.printf("return NULL;\n"); + } + cg.indentEnd("}\n"); +} + +void ClassScope::outputCPPGetClassConstantImpl +(CodeGenerator &cg, const StringToClassScopePtrVecMap &classScopes, + const vector &classes) { + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + cg.indentBegin("Variant get%s_class_constant(const char *s, " + "const char *constant) {\n", system ? + "_builtin" : ""); + if (!system && Option::EnableEval == Option::FullEval) { + // See if there's an eval'd version + cg.indentBegin("{\n"); + cg.printf("Variant r;\n"); + cg.printf("if (eval_get_class_constant_hook(r, s, constant)) " + "return r;\n"); + cg.indentEnd("}\n"); + } + outputCPPClassJumpTable(cg, classScopes, classes, "HASH_GET_CLASS_CONSTANT"); + if (!system) { + cg.printf("return get_builtin_class_constant(s, constant);\n"); + } else { + cg.printf("return null;\n"); + } + cg.indentEnd("}\n"); +} + +bool ClassScope::hasProperty(const string &name) { + return m_variables->isPresent(name); +} + +void ClassScope::setRedeclaring(AnalysisResultPtr ar, int redecId) { + m_redeclaring = redecId; + setVolatile(); // redeclared class is also volatile + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + BOOST_FOREACH(FunctionScopePtr fs, iter->second) { + fs->setDynamic(); + } + } + m_variables->forceVariants(ar); +} + +string ClassScope::getHeaderFilename() { + FileScopePtr file = getFileScope(); + ASSERT(file); + string fileBase = file->outputFilebase(); + string headerFile = Option::ClassHeaderPrefix; + headerFile += getId() + ".h"; + return headerFile; +} + +void ClassScope::outputCPPHeader(AnalysisResultPtr ar, + CodeGenerator::Output output) { + string filename = getHeaderFilename(); + string root = ar->getOutputPath() + "/"; + Util::mkdir(root + filename); + ofstream f((root + filename).c_str()); + CodeGenerator cg(&f, output); + + cg.headerBegin(filename); + + // 1. includes + BOOST_FOREACH(string base, m_bases) { + ClassScopePtr cls = ar->findClass(base); + if (cls && cls->isUserClass()) { + cg.printInclude(cls->getHeaderFilename()); + } + } + + // 2. Declarations + cg.namespaceBegin(); + ar->pushScope(shared_from_this()); + cg.setContext(CodeGenerator::CppDeclaration); + getStmt()->outputCPP(cg, ar); + ar->popScope(); + cg.namespaceEnd(); + + cg.headerEnd(filename); +} + +void ClassScope::outputCPPSupportMethodsImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + string clsNameStr = getId(); + const char *clsName = clsNameStr.c_str(); + bool dynamicObject = derivesFromRedeclaring() == DirectFromRedeclared; + const char *parent = "ObjectData"; + if (!getParent().empty()) parent = getParent().c_str(); + + if (Option::GenerateCPPMacros) { + // Constant Lookup Table + getVariables()->outputCPPPropertyTable(cg, ar, parent, + derivesFromRedeclaring()); + cg.indentBegin("Variant %s%s::%sconstant(const char *s) {\n", + Option::ClassPrefix, clsName, Option::ObjectStaticPrefix); + getConstants()->outputCPPJumpTable(cg, ar, false); + // If parent is redeclared, you have to go to their class statics object. + if (dynamicObject) { + cg.printf("return %s->%s%s->%sconstant(s);\n", cg.getGlobals(), + Option::ClassStaticsObjectPrefix, parent, + Option::ObjectStaticPrefix); + } else { + cg.printf("return %s%s::%sconstant(s);\n", Option::ClassPrefix, parent, + Option::ObjectStaticPrefix); + } + cg.indentEnd("}\n"); + + cg.printf("IMPLEMENT_CLASS(%s)\n", clsName); + } + + // Create method + if (getAttribute(ClassScope::HasConstructor) + || getAttribute(ClassScope::classNameConstructor)) { + FunctionScopePtr func = findConstructor(ar, false); + if (func && !func->isAbstract() && !isInterface()) { + // abstract methods are not generated, neither should the create method + // for an abstract constructor + ar->pushScope(func); + func->outputCPPCreateImpl(cg, ar); + ar->popScope(); + } + } + + // Destruct method + if (getAttribute(ClassScope::HasDestructor)) { + cg.indentBegin("void %s%s::destruct() {\n", Option::ClassPrefix, clsName); + cg.indentBegin("if (!inCtorDtor()) {\n"); + cg.printf("incRefCount();\n"); + cg.indentBegin("try {\n"); + cg.printf("%s__destruct();\n", Option::MethodPrefix); + cg.indentEnd("} catch (...) { handle_destructor_exception();}\n"); + cg.indentEnd("}\n"); + cg.indentEnd("}\n"); + } + + // Cloning + cg.indentBegin("ObjectData *%s%s::cloneImpl() {\n", + Option::ClassPrefix, clsName); + cg.printf("%s%s *obj = NEW(%s%s)();\n", Option::ClassPrefix, clsName, + Option::ClassPrefix, clsName); + cg.printf("cloneSet(obj);\n"); + cg.printf("return obj;\n"); + cg.indentEnd("}\n"); + cg.indentBegin("void %s%s::cloneSet(%s%s *clone) {\n", + Option::ClassPrefix, clsName, Option::ClassPrefix, clsName); + getVariables()->outputCPPPropertyClone(cg, ar, derivesFromRedeclaring()); + if (derivesFromRedeclaring()) { + cg.printf("clone->setParent(parent->clone());\n"); + } else if(!getParent().empty()) { + cg.printf("%s%s::cloneSet(clone);\n", Option::ClassPrefix, parent); + } else { + cg.printf("ObjectData::cloneSet(clone);\n"); + } + cg.indentEnd("}\n"); + + // doCall + if (getAttribute(ClassScope::HasUnknownMethodHandler)) { + cg.indentBegin("Variant %s%s::doCall(Variant v_name, Variant " + "v_arguments, bool fatal) {\n", + Option::ClassPrefix, clsName); + cg.printf("return t___call(v_name, v_arguments);\n"); + cg.indentEnd("}\n"); + } + + // Invoke tables + if (Option::GenerateCPPMacros) { + outputCPPJumpTable(cg, ar, false, dynamicObject); + outputCPPJumpTable(cg, ar, true, dynamicObject); + if (cg.getOutput() == CodeGenerator::SystemCPP || + Option::EnableEval >= Option::LimitedEval) { + outputCPPJumpTable(cg, ar, false, dynamicObject, true); + outputCPPJumpTable(cg, ar, true, dynamicObject, true); + } + } + outputCPPGlobalTableWrappersImpl(cg, ar); +} + +void ClassScope::outputCPPStaticInitializerDecl(CodeGenerator &cg) { + if (needStaticInitializer()) { + cg.printf("void %s%s();\n", Option::ClassStaticInitializerPrefix, + getId().c_str()); + } +} + +void ClassScope::outputCPPStaticMethodWrappers(CodeGenerator &cg, + AnalysisResultPtr ar, + set &done, + const char *cls) { + const StringToFunctionScopePtrVecMap &fmap = getFunctions(); + for (StringToFunctionScopePtrVecMap::const_iterator it = fmap.begin(); + it != fmap.end(); ++it) { + if (done.find(it->first) != done.end()) continue; + MethodStatementPtr m = dynamic_pointer_cast(it->second[0]-> + getStmt()); + if (!m) continue; // system classes + m->outputCPPStaticMethodWrapper(cg, ar, cls); + done.insert(it->first); + } + if (derivesFromRedeclaring() != DirectFromRedeclared) { + ClassScopePtr par = getParentScope(ar); + if (par) par->outputCPPStaticMethodWrappers(cg, ar, done, cls); + } +} + +void ClassScope::outputCPPGlobalTableWrappersDecl(CodeGenerator &cg, + AnalysisResultPtr ar) { + string id = getId(); + cg.printf("Variant %s%s$os_get(const char *s);\n", + Option::ClassWrapperFunctionPrefix, id.c_str()); + cg.printf("Variant &%s%s$os_lval(const char *s);\n", + Option::ClassWrapperFunctionPrefix, id.c_str()); + cg.printf("Variant %s%s$os_constant(const char *s);\n", + Option::ClassWrapperFunctionPrefix, id.c_str()); + cg.printf("Variant %s%s$os_invoke(const char *c, const char *s, " + "CArrRef params, bool fatal = true);\n", + Option::ClassWrapperFunctionPrefix, id.c_str()); +} + +void ClassScope::outputCPPGlobalTableWrappersImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { +string id = getId(); + cg.indentBegin("Variant %s%s$os_get(const char *s) {\n", + Option::ClassWrapperFunctionPrefix, id.c_str()); + cg.printf("return %s%s::os_get(s, -1);\n", Option::ClassPrefix, id.c_str()); + cg.indentEnd("}\n"); + + cg.indentBegin("Variant &%s%s$os_lval(const char *s) {\n", + Option::ClassWrapperFunctionPrefix, id.c_str()); + cg.printf("return %s%s::os_lval(s, -1);\n", Option::ClassPrefix, id.c_str()); + cg.indentEnd("}\n"); + + cg.indentBegin("Variant %s%s$os_constant(const char *s) {\n", + Option::ClassWrapperFunctionPrefix, id.c_str()); + cg.printf("return %s%s::os_constant(s);\n", Option::ClassPrefix, id.c_str()); + cg.indentEnd("}\n"); + + cg.indentBegin("Variant %s%s$os_invoke(const char *c, const char *s, " + "CArrRef params, bool fatal /* = true */) {\n", + Option::ClassWrapperFunctionPrefix, id.c_str()); + cg.printf("return %s%s::os_invoke(c, s, params, -1, fatal);\n", + Option::ClassPrefix, id.c_str()); + cg.indentEnd("}\n"); +} + +void ClassScope::addFunction(AnalysisResultPtr ar, FunctionScopePtr funcScope) { + FunctionScopePtrVec &funcs = m_functions[funcScope->getName()]; + if (funcs.size() == 1) { + funcs[0]->setRedeclaring(0); + ar->getCodeError()->record(CodeError::DeclaredFunctionTwice, + funcScope->getStmt(), + funcs[0]->getStmt()); + } + if (funcs.size() > 0) { + funcScope->setRedeclaring(funcs.size()); + } + funcs.push_back(funcScope); +} + +void ClassScope::findJumpTableMethods(CodeGenerator &cg, AnalysisResultPtr ar, + bool staticOnly, + vector &funcs) { + bool systemcpp = cg.getOutput() == CodeGenerator::SystemCPP; + // output invoke support methods + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + if (!iter->second[0]->isRedeclaring()) { + FunctionScopePtr func = iter->second[0]; + if (func->isAbstract() || + (staticOnly && !func->isStatic()) || + !(systemcpp || func->isDynamic() || func->isVirtual())) continue; + const char *name = iter->first.c_str(); + funcs.push_back(name); + } + } +} + +void ClassScope:: +outputCPPMethodInvokeTable(CodeGenerator &cg, AnalysisResultPtr ar, + const vector &keys, + const StringToFunctionScopePtrVecMap &funcScopes, + bool fewArgs, bool staticOnly, bool forEval) { + for (JumpTable jt(cg, keys, true, true, false); jt.ready(); jt.next()) { + const char *name = jt.key(); + StringToFunctionScopePtrVecMap::const_iterator iterFuncs; + iterFuncs = funcScopes.find(name); + ASSERT(iterFuncs != funcScopes.end()); + FunctionScopePtr func = iterFuncs->second[0]; + if (fewArgs && + func->getMinParamCount() > Option::InvokeFewArgsCount) + continue; + cg.indentBegin("HASH_GUARD(0x%016llXLL, %s) {\n", + hash_string_i(name), name); + const char *extra = NULL; + const char *prefix = Option::MethodPrefix; + if (func->isStatic()) { + prefix = Option::MethodImplPrefix; + if (staticOnly) { + extra = "c"; + } else { + extra = "o_getClassName()"; + } + } + if (forEval) { + func->outputCPPEvalInvoke(cg, ar, prefix, name, false, extra); + } else { + func->outputCPPDynamicInvoke(cg, ar, prefix, name, false, fewArgs, + true, extra); + } + cg.indentEnd("}\n"); + } +} + +void ClassScope::outputCPPJumpTable(CodeGenerator &cg, + AnalysisResultPtr ar, + bool staticOnly, + bool dynamicObject /* = false */, + bool forEval /* = false */) { + + string scope; + scope += Option::ClassPrefix; + scope += getId(); + scope += "::"; + string parent; + string parentName = m_parent.empty() ? string("ObjectData") : m_parent; + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + bool needGlobals = false; + if (dynamicObject) { + if (staticOnly) { + needGlobals = true; + parent = string("g->") + Option::ClassStaticsObjectPrefix + + parentName + "->"; + } else { + parent = string("parent->"); + } + } else { + parent = string(Option::ClassPrefix) + parentName + "::"; + } + string invokeName; + invokeName += staticOnly ? Option::ObjectStaticPrefix : Option::ObjectPrefix; + invokeName += "invoke"; + + if (forEval) { + invokeName += "_from_eval"; + } + + parent += invokeName; + StringToFunctionScopePtrVecMap funcScopes; + if (Option::FlattenInvoke) { + StringToFunctionScopePtrMap fss; + collectMethods(ar, fss, true, true); + for (StringToFunctionScopePtrMap::const_iterator it = fss.begin(); + it != fss.end(); ++it) { + funcScopes[it->first].push_back(it->second); + } + } + + vector funcs; + findJumpTableMethods(cg, ar, staticOnly, funcs); + + if (Option::FlattenInvoke) { + funcs.clear(); + for (StringToFunctionScopePtrVecMap::const_iterator iter = + funcScopes.begin(); iter != funcScopes.end(); ++iter) { + FunctionScopePtr func = iter->second[0]; + if (func->isAbstract() || func->inPseudoMain() || + (staticOnly && !func->isStatic()) || + !(system || func->isDynamic() || func->isVirtual())) continue; + funcs.push_back(iter->first.c_str()); + } + } + + if (forEval) { + if (staticOnly) { // os_invoke + cg.indentBegin("Variant %s%s" + "(const char *c, const char *s, " + "Eval::VariableEnvironment &env, " + "const Eval::FunctionCallExpression *caller, " + "int64 hash, bool fatal) {\n", scope.c_str(), + invokeName.c_str()); + } else { + cg.indentBegin("Variant %s%s" + "(const char *s, " + "Eval::VariableEnvironment &env, " + "const Eval::FunctionCallExpression *caller, " + "int64 hash, bool fatal) {\n", scope.c_str(), + invokeName.c_str()); + } + } else { + // output invoke() + if (staticOnly) { // os_invoke + cg.indentBegin("Variant %s%s" + "(const char *c, const char *s, CArrRef params," + " int64 hash, bool fatal) {\n", scope.c_str(), + invokeName.c_str()); + } else { + cg.indentBegin("Variant %s%s" + "(const char *s, CArrRef params," + " int64 hash, bool fatal) {\n", scope.c_str(), + invokeName.c_str()); + } + } + if (needGlobals) cg.printDeclareGlobals(); + outputCPPMethodInvokeTable(cg, ar, funcs, funcScopes, false, staticOnly, + forEval); + if (forEval) { + if (staticOnly) { + cg.printf("return %s(c, s, env, caller, hash, fatal);\n", parent.c_str()); + } else { + cg.printf("return %s(s, env, caller, hash, fatal);\n", parent.c_str()); + } + } else { + if (staticOnly) { + cg.printf("return %s(c, s, params, hash, fatal);\n", parent.c_str()); + } else { + cg.printf("return %s(s, params, hash, fatal);\n", parent.c_str()); + } + } + cg.indentEnd("}\n"); + + if (!staticOnly && !forEval) { + cg.indentBegin("Variant %s%s_few_args(const char *s, int64 hash, " + "int count", + scope.c_str(), invokeName.c_str()); + for (int i = 0; i < Option::InvokeFewArgsCount; i++) { + cg.printf(", CVarRef a%d", i); + } + cg.printf(") {\n"); + if (needGlobals) cg.printDeclareGlobals(); + outputCPPMethodInvokeTable(cg, ar, funcs, funcScopes, true, staticOnly, + false); + cg.printf("return %s_few_args(s, hash, count", parent.c_str()); + for (int i = 0; i < Option::InvokeFewArgsCount; i++) { + cg.printf(", a%d", i); + } + cg.printf(");\n"); + cg.indentEnd("}\n"); + } +} diff --git a/src/lib/analysis/class_scope.h b/src/lib/analysis/class_scope.h new file mode 100644 index 0000000000000..3aa2ca3e6163d --- /dev/null +++ b/src/lib/analysis/class_scope.h @@ -0,0 +1,312 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CLASS_SCOPE_H__ +#define __CLASS_SCOPE_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(FunctionScope); +DECLARE_BOOST_TYPES(ClassScope); +DECLARE_BOOST_TYPES(FileScope); + +/** + * A class scope corresponds to a class declaration. We store all + * inferred types and analyzed results here, so not to pollute syntax trees. + */ +class ClassScope : public BlockScope, public FunctionContainer, + public JSON::ISerializable { + +public: + enum KindOf { + KindOfObjectClass, + KindOfAbstractClass, + KindOfFinalClass, + KindOfInterface, + }; + + enum Attribute { + HasConstructor = 1, // set iff there is a __construct method. + // check classNameConstructor if you want to know + // whether there is a class-name constructor. + HasDestructor = 2, + HasUnknownMethodHandler = 4, + System = 8, + Extension = 16, + classNameConstructor = 32, + }; + enum Modifier { + Public = 1, + Protected = 2, + Private = 4, + Static = 8, + Abstract = 16, + Final = 32 + }; + enum Derivation { + FromNormal = 0, + DirectFromRedeclared, + IndirectFromRedeclared + }; + +public: + ClassScope(KindOf kindOf, const std::string &name, + const std::string &parent, + const std::vector &bases, StatementPtr stmt, + FileScopePtr file); + + + /** + * Special constructor for extension classes. + */ + ClassScope(AnalysisResultPtr ar, + const std::string &name, const std::string &parent, + const std::vector &bases, + const std::vector &methods); + + bool classNameCtor() const { + return getAttribute(classNameConstructor); + } + const char *getOriginalName() const; + + + std::string getId() const { + if (m_redeclaring < 0) { + return getName(); + } + return getName() + Option::IdPrefix + + boost::lexical_cast(m_redeclaring); + } + + const std::string &getParent() const { return m_parent;} + std::string getHeaderFilename(); + + /** + * Whether this is a user-defined class. + */ + bool isUserClass() const { return !getAttribute(System);} + bool isExtensionClass() const { return getAttribute(Extension); } + bool isDynamic() const { return m_dynamic; } + + /** + * Whether this class name was declared twice or more. + */ + void setRedeclaring(AnalysisResultPtr ar, int redecId); + bool isRedeclaring() const { return m_redeclaring >= 0;} + int getRedeclaringId() { return m_redeclaring; } + + void setStaticDynamic(AnalysisResultPtr ar); + void setDynamic(AnalysisResultPtr ar, const std::string &name); + + /* For class_exists */ + void setVolatile() { m_volatile = true;} + bool isVolatile() { return m_volatile;} + + /* For code generation of os_static_initializer */ + void setNeedStaticInitializer() { m_needStaticInitializer = true;} + bool needStaticInitializer() { return m_needStaticInitializer;} + + bool needLazyStaticInitializer(); + + Derivation derivesFromRedeclaring() const { + return m_derivesFromRedeclaring; + } + + /** + * Get/set attributes. + */ + void setSystem(); + void setAttribute(Attribute attr) { m_attribute |= attr;} + void clearAttribute(Attribute attr) { m_attribute &= ~attr;} + bool getAttribute(Attribute attr) const { + return m_attribute & attr; + } + bool hasAttribute(Attribute attr, + AnalysisResultPtr ar) const; // recursive + + void addMissingMethod(const std::string &name) { + m_missingMethods.insert(name); + } + + /** + * Called by ClassScope to prepare name => method/property map. + */ + void collectMethods(AnalysisResultPtr ar, + StringToFunctionScopePtrMap &func, + bool collectPrivate = true, + bool forInvoke = false); + /* + void collectProperties(AnalysisResultPtr ar, + std::set &names, + bool collectPrivate = true) const; + + */ + /** + * Testing whether this class derives from another. + */ + bool derivesFrom(AnalysisResultPtr ar, const std::string &base) const; + + /** + * Look up function by name. + */ + FunctionScopePtr findFunction(AnalysisResultPtr ar, + const std::string &name, + bool recursive, + bool exclIntfBase = false); + + /** + * Look up constructor, both __construct and class-name constructor. + */ + FunctionScopePtr findConstructor(AnalysisResultPtr ar, + bool recursive); + + TypePtr checkProperty(const std::string &name, TypePtr type, + bool coerce, AnalysisResultPtr ar, + ConstructPtr construct, int &properties); + TypePtr checkStatic(const std::string &name, TypePtr type, + bool coerce, AnalysisResultPtr ar, + ConstructPtr construct, int &properties); + TypePtr checkConst(const std::string &name, TypePtr type, + bool coerce, AnalysisResultPtr ar, + ConstructPtr construct, bool &present); + + /** + * Collect parent class names. + */ + void getAllParents(AnalysisResultPtr ar, + std::vector &names) { + if (m_stmt) { + if (isInterface()) { + boost::dynamic_pointer_cast + (m_stmt)->getAllParents(ar, names); + } else { + boost::dynamic_pointer_cast + (m_stmt)->getAllParents(ar, names); + } + } + } + + FileScopePtr getFileScope() { + FileScopePtr fs = m_file.lock(); + return fs; + } + + ClassScopePtr getParentScope(AnalysisResultPtr ar); + + /** + * Output class meta info for g_class_map. + */ + void outputCPPClassMap(CodeGenerator &cg, AnalysisResultPtr ar); + + /** + * Serialize the iface, not everything. + */ + void serialize(JSON::OutputStream &out) const; + + void outputCPPDynamicClassDecl(CodeGenerator &cg); + void outputCPPDynamicClassImpl(CodeGenerator &cg, AnalysisResultPtr ar); + static void outputCPPDynamicClassCreateDecl(CodeGenerator &cg); + static void outputCPPDynamicClassCreateImpl + (CodeGenerator &cg, const StringToClassScopePtrVecMap &classScopes, + const std::vector &classes); + static void outputCPPInvokeStaticMethodImpl + (CodeGenerator &cg, const StringToClassScopePtrVecMap &classScopes, + const std::vector &classes); + static void outputCPPGetStaticPropertyImpl + (CodeGenerator &cg, const StringToClassScopePtrVecMap &classScopes, + const std::vector &classes); + static void outputCPPGetClassConstantImpl + (CodeGenerator &cg, const StringToClassScopePtrVecMap &classScopes, + const std::vector &classes); + void outputCPPStaticInitializerDecl(CodeGenerator &cg); + bool isInterface() { return m_kindOf == KindOfInterface; } + bool isFinal() { return m_kindOf == KindOfFinalClass; } + bool isAbstract() { return m_kindOf == KindOfAbstractClass; } + bool hasProperty(const std::string &name); + bool hasConst(const std::string &name); + void outputCPPHeader(AnalysisResultPtr ar, + CodeGenerator::Output output); + + /** + * This prints out all the support methods (invoke, create, destructor, + * etc.) + * This is here instead of ClassStatement because I want to be able to call + * these for extension classes that don't have a statement. + */ + void outputCPPSupportMethodsImpl(CodeGenerator &cg, AnalysisResultPtr ar); + + /** + * These output wrappers for class methods so that class definitions don't + * have to be used in generating global jump tables. + */ + void outputCPPGlobalTableWrappersDecl(CodeGenerator &cg, + AnalysisResultPtr ar); + void outputCPPGlobalTableWrappersImpl(CodeGenerator &cg, + AnalysisResultPtr ar); + + + void clearBases() { + m_bases.clear(); + m_parent = ""; + } + + void outputCPPStaticMethodWrappers(CodeGenerator &cg, AnalysisResultPtr ar, + std::set &done, + const char *cls); + /** + * Override function container + */ + virtual void addFunction(AnalysisResultPtr ar, FunctionScopePtr funcScope); + void outputCPPJumpTable(CodeGenerator &cg, AnalysisResultPtr ar, + bool staticOnly, bool dynamicObject = false, + bool forEval = false); +protected: + void findJumpTableMethods(CodeGenerator &cg, AnalysisResultPtr ar, + bool staticOnly, std::vector &funcs); +private: + FileScopeWeakPtr m_file; + KindOf m_kindOf; + std::string m_parent; + mutable std::vector m_bases; + mutable int m_attribute; + bool m_dynamic; + int m_redeclaring; // multiple definition of the same class + bool m_volatile; // for class_exists + bool m_needStaticInitializer; // for os_static_initializer + Derivation m_derivesFromRedeclaring; + std::set m_missingMethods; + + static void outputCPPClassJumpTable + (CodeGenerator &cg, const StringToClassScopePtrVecMap &classScopes, + const std::vector &classes, const char* macro); + void outputCPPMethodInvokeTable + (CodeGenerator &cg, AnalysisResultPtr ar, + const std::vector &keys, + const StringToFunctionScopePtrVecMap &funcScopes, bool fewArgs, + bool staticOnly, bool forEval); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CLASS_SCOPE_H__ diff --git a/src/lib/analysis/code_error.cpp b/src/lib/analysis/code_error.cpp new file mode 100644 index 0000000000000..8072529e0c1bb --- /dev/null +++ b/src/lib/analysis/code_error.cpp @@ -0,0 +1,305 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace HPHP::JSON; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// class ErrorInfo + +ErrorInfo::ErrorInfo() + : m_expected(Type::KindOfAny), m_actual(Type::KindOfAny), + m_suppressed(false) { +} + +/////////////////////////////////////////////////////////////////////////////// +// class CodeError + +CodeError::CodeError(AnalysisResultPtr ar) + : m_ar(ar), m_verbose(true) { + m_errors.resize(ErrorCount); +} + +void CodeError::record(ConstructPtr self, ErrorType error, + ConstructPtr construct1, + ConstructPtr construct2 /* = ConstructPtr() */, + const char *data /* = NULL */) { + record(error, construct1, construct2, data, self->isErrorSuppressed(error)); +} + +void CodeError::record(ErrorType error, ConstructPtr construct1, + ConstructPtr construct2 /* = ConstructPtr() */, + const char *data /* = NULL */, + bool suppressed /* = false */) { + if (!suppressed) { + AnalysisResultPtr ar = m_ar.lock(); + if (ar && construct1) { + const char *file = construct1->getLocation()->file; + FileScopePtr fileScope = ar->findFileScope(file, false); + if (fileScope) { + suppressed = fileScope->isErrorSuppressed(error); + } + } + } + + ErrorInfoPtr errorInfo(new ErrorInfo()); + errorInfo->m_error = error; + errorInfo->m_construct1 = construct1; + errorInfo->m_construct2 = construct2; + if (data) { + errorInfo->m_data = data; + } else { + errorInfo->m_data += construct1->getText(); + } + errorInfo->m_suppressed = suppressed; + record(errorInfo); +} + +void CodeError::record(ConstructPtr construct, Type::KindOf expected, + Type::KindOf actual) { + ErrorInfoPtr errorInfo(new ErrorInfo()); + errorInfo->m_error = BadTypeConversion; + errorInfo->m_construct1 = construct; + errorInfo->m_expected = expected; + errorInfo->m_actual = actual; + errorInfo->m_data = construct->getText(); + errorInfo->m_suppressed = construct->isErrorSuppressed(BadTypeConversion); + record(errorInfo); +} + +void CodeError::record(ErrorInfoPtr errorInfo) { + ASSERT(errorInfo->m_error >= 0 && errorInfo->m_error < ErrorCount); + + ErrorInfoMap &errorMap = m_errors[errorInfo->m_error]; + ErrorInfoMap::const_iterator iter = errorMap.find(errorInfo->m_construct1); + if (iter == errorMap.end()) { + errorMap[errorInfo->m_construct1] = errorInfo; + return; + } +} + +bool CodeError::exists(ErrorType type) const { + const ErrorInfoMap &errors = m_errors[type]; + for (ErrorInfoMap::const_iterator iter = errors.begin(); + iter != errors.end(); ++iter) { + if (!iter->second->m_suppressed) { + return true; + } + } + return false; +} + +bool CodeError::exists(bool verbose) const { + m_verbose = verbose; + for (unsigned int i = 0; i < m_errors.size(); i++) { + const ErrorInfoMap &errorMap = m_errors[i]; + if (errorMap.empty()) continue; + if (filtered(i)) continue; + m_verbose = true; + return true; + } + m_verbose = true; + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +std::vector CodeError::ErrorTexts; +std::vector &CodeError::getErrorTexts() { + if (ErrorTexts.empty()) { + ErrorTexts.resize(ErrorCount); +#define CODE_ERROR_ENTRY(x) ErrorTexts[x] = #x; +#include "code_error.inc" +#undef CODE_ERROR_ENTRY + } + return ErrorTexts; +} + +void ErrorInfo::serialize(JSON::OutputStream &out) const { + out.raw() << "{"; + if (m_construct1) { + out << Name("c1") << m_construct1; out.raw() << ','; + } + if (m_construct2) { + out << Name("c2") << m_construct2; out.raw() << ','; + } + if (m_expected != Type::KindOfSome && m_expected != Type::KindOfAny) { + out << Name("et") << m_expected; out.raw() << ','; + } + if (m_actual != Type::KindOfSome && m_actual != Type::KindOfAny) { + out << Name("at") << m_actual; out.raw() << ','; + } + if (!m_data.empty()) { + out << Name("d") << m_data; out.raw() << ','; + } + out << Name("s") << m_suppressed; out.raw() << ','; + out.raw() << "}\n"; +} + +void CodeError::serialize(JSON::OutputStream &out) const { + vector errorTexts = getErrorTexts(); + + unsigned int total = 0; + for (unsigned int i = 0; i < m_errors.size(); i++) { + total += m_errors[i].size(); + } + + out.raw() << "["; out << total; out.raw() << ", {\n"; + bool comma = false; + for (unsigned int i = 0; i < m_errors.size(); i++) { + const ErrorInfoMap &errorMap = m_errors[i]; + if (errorMap.empty()) continue; + if (filtered(i)) continue; + + if (comma) { + out.raw() << ','; + } else { + comma = true; + } + out << Name(errorTexts[i]); + out.raw() << "\n["; + for (ErrorInfoMap::const_iterator iter = errorMap.begin(); + iter != errorMap.end(); ++iter) { + if (iter != errorMap.begin()) out.raw() << ','; + out << iter->second; + } + out.raw() << "]\n"; + } + out.raw() << "}]\n"; +} + +void CodeError::dump(bool verbose) const { + m_verbose = verbose; + JSON::OutputStream o(cerr); + serialize(o); + m_verbose = true; +} + +void CodeError::saveToFile(const char *filename, bool verbose, + bool varWrapper /* = false */) const { + ofstream f(filename); + if (f) { + m_verbose = verbose; + JSON::OutputStream o(f); + if (varWrapper) f << "var CodeErrors = "; + serialize(o); + if (varWrapper) f << ";\n\n"; + f.close(); + m_verbose = true; + } +} + +void CodeError::saveToDB(ServerDataPtr server, int runId) const { + vector errorTexts = getErrorTexts(); + + DBConn conn; + conn.open(server); + + const char *sql = "INSERT INTO hphp_err (run, program, kind, construct, " + "file1, line1, file2, line2, expected_type, actual_type, data, " + "suppressed)"; + DBQueryPtr q(new DBQuery(&conn, sql)); + int count = 0; + const int MAX_COUNT = 1000; + + for (unsigned int i = 0; i < m_errors.size(); i++) { + const ErrorInfoMap &errorMap = m_errors[i]; + for (ErrorInfoMap::const_iterator iter = errorMap.begin(); + iter != errorMap.end(); ++iter) { + ErrorInfo &err = *iter->second; + + const char *file1 = ""; + const char *file2 = ""; + int line1 = 0; + int line2 = 0; + if (err.m_construct1) { + file1 = err.m_construct1->getLocation()->file; + line1 = err.m_construct1->getLocation()->line1; + } + if (err.m_construct2) { + file2 = err.m_construct2->getLocation()->file; + line2 = err.m_construct2->getLocation()->line1; + } + + q->insert("%d,'%s','%s', %p, '%s',%d,'%s',%d, %d,%d,'%s', %d", + runId, "", errorTexts[i], + err.m_construct1.get(), file1, line1, file2, line2, + err.m_expected, err.m_actual, err.m_data.c_str(), + (err.m_suppressed ? 1 : 0)); + if (++count >= MAX_COUNT) { + count = 0; + q->execute(); + q = DBQueryPtr(new DBQuery(&conn, sql)); + } + } + } + + if (count) q->execute(); +} + +bool CodeError::lookupErrorType(std::string error, ErrorType &r) { +#define CODE_ERROR_ENTRY(x) \ + if(error == #x) { \ + r = x; \ + return true; \ + } else +#include +#undef CODE_ERROR_ENTRY + { + return false; + } +} + +bool CodeError::filtered(int error) const { + if (!m_verbose) { + switch (error) { + case BadDefine: + case BadPHPIncludeFile: + case PHPIncludeFileNotFound: + case UseEvaluation: + case UnknownClass: + case UnknownBaseClass: + case UnknownFunction: + case DeclaredClassTwice: + case DeclaredFunctionTwice: + case DeclaredStaticVariableTwice: + case DeclaredVariableTwice: + case RedundantParameter: + case StatementHasNoEffect: + case InvalidArrayElement: + case InvalidDerivation: + case MissingAbstractMethodImpl: + case ReassignThis: + return false; + default: + return true; + } + } + return false; +} diff --git a/src/lib/analysis/code_error.h b/src/lib/analysis/code_error.h new file mode 100644 index 0000000000000..d674c879741ab --- /dev/null +++ b/src/lib/analysis/code_error.h @@ -0,0 +1,126 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CODE_ERROR_H__ +#define __CODE_ERROR_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ServerData); +DECLARE_BOOST_TYPES(Construct); +DECLARE_BOOST_TYPES(ErrorInfo); +DECLARE_BOOST_TYPES(CodeError); + +class CodeError : public JSON::ISerializable { +public: + enum ErrorType { +#define CODE_ERROR_ENTRY(x) x, +#include "code_error.inc" +#undef CODE_ERROR_ENTRY + ErrorCount + }; + +public: + CodeError(AnalysisResultPtr ar); + + /** + * Record a coding error within the AST + */ + void record(ConstructPtr self, ErrorType error, ConstructPtr construct1, + ConstructPtr construct2 = ConstructPtr(), + const char *data = NULL); + /** + * Record a coding error outside the AST + */ + void record(ErrorType error, ConstructPtr construct1, + ConstructPtr construct2 = ConstructPtr(), + const char *data = NULL, + bool suppressed = false); + + /** + * Record a BadTypeConversion error. + */ + void record(ConstructPtr construct, Type::KindOf expected, + Type::KindOf actual); + + /** + * Implements JSON::ISerializable. + */ + virtual void serialize(JSON::OutputStream &out) const; + + /** + * Dump JavaScript output to stderr. + */ + void dump(bool verbose) const; + + /** + * Save JavaScript output to specified file. + */ + void saveToFile(const char *filename, bool verbose, + bool varWrapper = false) const; + + /** + * Save code error to a database. + */ + void saveToDB(ServerDataPtr server, int runId) const; + + /** + * Whether specified type of error is present. Written for unit test. + */ + bool exists(ErrorType type) const; + bool exists(bool verbose) const; // any error + + static bool lookupErrorType(std::string error, ErrorType &result); + +private: + boost::weak_ptr m_ar; + static std::vector ErrorTexts; + static std::vector &getErrorTexts(); + + typedef std::map ErrorInfoMap; + std::vector m_errors; + mutable bool m_verbose; + + void record(ErrorInfoPtr errorInfo); + bool filtered(int error) const; +}; + +class ErrorInfo : public JSON::ISerializable { +public: + ErrorInfo(); + + CodeError::ErrorType m_error; + ConstructPtr m_construct1; + ConstructPtr m_construct2; + Type::KindOf m_expected; + Type::KindOf m_actual; + std::string m_data; + bool m_suppressed; + + /** + * Implements JSON::ISerializable. + */ + virtual void serialize(JSON::OutputStream &out) const; +}; +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __CODE_ERROR_H__ diff --git a/src/lib/analysis/constant_table.cpp b/src/lib/analysis/constant_table.cpp new file mode 100644 index 0000000000000..ecb3c579ab4dd --- /dev/null +++ b/src/lib/analysis/constant_table.cpp @@ -0,0 +1,314 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// + +ConstantTable::ConstantTable(BlockScope &blockScope) + : SymbolTable(blockScope) { +} + +/////////////////////////////////////////////////////////////////////////////// + +TypePtr ConstantTable::add(const std::string &name, TypePtr type, + ExpressionPtr exp, AnalysisResultPtr ar, + ConstructPtr construct) { + + if (name == "true" || name == "false") { + return Type::Boolean; + } + + StringToConstructPtrMap::const_iterator iter = m_values.find(name); + if (iter == m_values.end()) { + setType(ar, name, type, true); + m_declarations[name] = construct; + m_values[name] = exp; + return type; + } + + if (ar->isFirstPass()) { + if (exp != iter->second) { + ar->getCodeError()->record(CodeError::DeclaredConstantTwice, construct, + m_declarations[name]); + m_dynamic.insert(name); + type = Type::Variant; + } + setType(ar, name, type, true); + } + + return type; +} + +void ConstantTable::setDynamic(AnalysisResultPtr ar, const std::string &name) { + m_dynamic.insert(name); + setType(ar, name, Type::Variant, true); +} + +void ConstantTable::setValue(AnalysisResultPtr ar, const std::string &name, + ExpressionPtr value) { + ASSERT(m_values.find(name) != m_values.end()); + m_values[name] = value; +} + +TypePtr ConstantTable::check(const std::string &name, TypePtr type, + bool coerce, AnalysisResultPtr ar, + ConstructPtr construct, bool &present) { + TypePtr actualType; + present = true; + if (name == "true" || name == "false") { + actualType = Type::Boolean; + } else if (!ar->isFirstPass() && m_values.find(name) == m_values.end()) { + ClassScopePtr parent = findParent(ar, name); + if (parent) { + return parent->checkConst(name, type, coerce, ar, + construct, present); + } + ar->getCodeError()->record(CodeError::UseUndeclaredConstant, + construct); + if (m_blockScope.is(BlockScope::ClassScope)) { + actualType = Type::Variant; + } else { + actualType = Type::String; + } + setType(ar, name, actualType, true); + present = false; + } else { + StringToTypePtrMap::const_iterator iter = m_coerced.find(name); + if (iter != m_coerced.end()) { + actualType = iter->second; + if (actualType->is(Type::KindOfSome) || + actualType->is(Type::KindOfAny)) { + setType(ar, name, type, true); + return type; + } + } else { + ClassScopePtr parent = findParent(ar, name); + if (parent) { + return parent->checkConst(name, type, coerce, ar, + construct, present); + } + present = false; + actualType = NEW_TYPE(Some); + setType(ar, name, actualType, true); + m_declarations[name] = construct; + } + } + + if (Type::IsBadTypeConversion(ar, actualType, type, coerce)) { + ar->getCodeError()->record(construct, type->getKindOf(), + actualType->getKindOf()); + } + return actualType; +} + +ClassScopePtr ConstantTable::findParent(AnalysisResultPtr ar, + const std::string &name) { + for (ClassScopePtr parent = m_blockScope.getParentScope(ar); + parent; parent = parent->getParentScope(ar)) { + if (parent->hasConst(name)) { + return parent; + } + } + return ClassScopePtr(); +} + +/////////////////////////////////////////////////////////////////////////////// + +void ConstantTable::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (Option::GenerateInferredTypes) { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + if (isSystem(name)) continue; + + cg.printf("// @const %s\t$%s\n", + getFinalType(name)->toString().c_str(), name.c_str()); + } + } +} + +void ConstantTable::outputCPPDynamicDecl(CodeGenerator &cg, + AnalysisResultPtr ar) { + const char *prefix = Option::ConstantPrefix; + string classId; + const char *fmt = "Variant %s%s%s;\n"; + ClassScopePtr scope = ar->getClassScope(); + if (scope) { + prefix = Option::ClassConstantPrefix; + classId = scope->getId(); + fmt = "Variant %s%s_%s;\n"; + } + + for (StringToConstructPtrMap::const_iterator iter = m_declarations.begin(); + iter != m_declarations.end(); ++iter) { + const string &name = iter->first; + if (isDynamic(name)) { + cg.printf(fmt, prefix, classId.c_str(), name.c_str()); + } + } +} + +void ConstantTable::outputCPPDynamicImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + for (StringToConstructPtrMap::const_iterator iter = m_declarations.begin(); + iter != m_declarations.end(); ++iter) { + const string &name = iter->first; + if (isDynamic(name)) { + const char *nameStr = name.c_str(); + cg.printf("%s%s = \"%s\";\n", Option::ConstantPrefix, nameStr, nameStr); + } + } +} + +void ConstantTable::outputCPPGlobalState(CodeGenerator &cg, + AnalysisResultPtr ar) { + for (StringToConstructPtrMap::const_iterator iter = m_declarations.begin(); + iter != m_declarations.end(); ++iter) { + const string &name = iter->first; + if (isDynamic(name)) { + cg.printf("dynamic_constants.set(\"%s%s\", g->%s%s);\n", + Option::ConstantPrefix, name.c_str(), + Option::ConstantPrefix, name.c_str()); + } + } +} + +void ConstantTable::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + bool decl = true; + if (cg.getContext() == CodeGenerator::CppConstantsDecl) { + decl = false; + } + + bool printed = false; + for (StringToConstructPtrMap::const_iterator iter = m_declarations.begin(); + iter != m_declarations.end(); ++iter) { + const string &name = iter->first; + if (isSystem(name) && cg.getOutput() != CodeGenerator::SystemCPP) continue; + + ConstructPtr value = getValue(name); + if (isDynamic(name)) continue; + printed = true; + + cg.printf(decl ? "extern const " : "const "); + TypePtr type = getFinalType(name); + if (type->is(Type::KindOfString)) { + cg.printf("StaticString"); + } else { + type->outputCPPDecl(cg, ar); + } + const char *nameStr = name.c_str(); + if (decl) { + cg.printf(" %s%s", Option::ConstantPrefix, nameStr); + } else { + cg.printf(" %s%s = ", Option::ConstantPrefix, nameStr); + if (value) { + ExpressionPtr exp = dynamic_pointer_cast(value); + ASSERT(!exp->getExpectedType()); + exp->outputCPP(cg, ar); + } else { + cg.printf("\"%s\"", nameStr); + } + } + cg.printf(";\n"); + } + if (printed) { + cg.printf("\n"); + } +} + +void ConstantTable::outputCPPJumpTable(CodeGenerator &cg, + AnalysisResultPtr ar, + bool ret /* = true */) { + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + bool hasDynamic = m_dynamic.size() > 0; + vector strings; + if (!m_symbols.empty()) { + strings.reserve(m_symbols.size()); + BOOST_FOREACH(string s, m_symbols) { + // Extension defined constants have no value but we are sure they exist + if (!system && !getValue(s)) continue; + strings.push_back(s.c_str()); + } + } + if (!strings.empty()) { + if (hasDynamic) { + cg.printDeclareGlobals(); + ClassScopePtr cls = ar->getClassScope(); + if (cls && cls->needLazyStaticInitializer()) { + cg.printf("lazy_initializer(g);\n"); + } + } + for (JumpTable jt(cg, strings, false, false, false); jt.ready(); + jt.next()) { + const char *name = jt.key(); + string varName = string(Option::ClassConstantPrefix) + + getScope()->getId() + "_" + name; + if (isDynamic(name)) { + varName = string("g->") + varName; + } + cg.printf("HASH_RETURN(0x%016llXLL, %s, %s);\n", + hash_string(name), varName.c_str(), name); + } + } + if (ret) { + // TODO this is wrong + cg.printf("return s;\n"); + } +} + +void ConstantTable::outputCPPConstantSymbol(CodeGenerator &cg, + AnalysisResultPtr ar, + const std::string &name) { + bool cls = ar->getClassScope(); + StringToConstructPtrMap::const_iterator iter = m_values.find(name); + if (iter != m_values.end() && + (!isDynamic(name) || cls) && + !ar->isConstantRedeclared(name)) { + ExpressionPtr value = dynamic_pointer_cast(iter->second); + Variant v; + if (value && value->getScalarValue(v)) { + int len; + string output = getEscapedText(v, len); + cg.printf("\"%s\", (const char *)%d, \"%s\",\n", name.c_str(), + len, output.c_str()); + } else { + cg.printf("\"%s\", (const char *)0, NULL,\n", name.c_str()); + } + } +} + +void ConstantTable::outputCPPClassMap(CodeGenerator &cg, + AnalysisResultPtr ar, + bool last /* = true */) { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + outputCPPConstantSymbol(cg, ar, m_symbols[i]); + } + if (last) cg.printf("NULL,\n"); +} diff --git a/src/lib/analysis/constant_table.h b/src/lib/analysis/constant_table.h new file mode 100644 index 0000000000000..f8b190bcff5aa --- /dev/null +++ b/src/lib/analysis/constant_table.h @@ -0,0 +1,107 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CONSTANT_TABLE_H__ +#define __CONSTANT_TABLE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(Expression); +DECLARE_BOOST_TYPES(CodeError); +DECLARE_BOOST_TYPES(ConstantTable); +DECLARE_BOOST_TYPES(ClassScope); + +/** + * These are the only places that a new constant can be declared: + * + * class_constant_declaration: class { const T_STRING = static_scalar,...} + * define('NAME', static_scalar) + */ +class ConstantTable : public SymbolTable { +public: + ConstantTable(BlockScope &blockScope); + + /** + * Whether defining something to be non-scalar value or redeclared, or + * marked up by "Dynamic" note. + */ + bool isDynamic(const std::string &name) const { + return m_dynamic.find(name) != m_dynamic.end(); + } + bool hasDynamic() const { + return !m_dynamic.empty(); + } + + /** + * Explicitly setting a constant to be dynamic, mainly for "Dynamic" note. + */ + void setDynamic(AnalysisResultPtr ar, const std::string &name); + + /** + * Called when a constant is declared (l-value). + */ + TypePtr add(const std::string &name, TypePtr type, ExpressionPtr exp, + AnalysisResultPtr ar, ConstructPtr construct); + + /** + * Called after a constant is type-inferred + */ + void setValue(AnalysisResultPtr ar, const std::string &name, + ExpressionPtr value); + + /** + * Called when a constant is used or being evaluated (r-value). + */ + TypePtr check(const std::string &name, TypePtr type, bool coerce, + AnalysisResultPtr ar, ConstructPtr construct, + bool &present); + + /** + * Generate all constant declarations for this symbol table. + */ + void outputPHP(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPP(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPDynamicDecl(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPDynamicImpl(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPGlobalState(CodeGenerator &cg, AnalysisResultPtr ar); + + /** + * Only used by redeclared classes + */ + void outputCPPJumpTable(CodeGenerator &cg, AnalysisResultPtr ar, + bool ret = true); + + /** + * Generate all class constants in class info map. + */ + void outputCPPClassMap(CodeGenerator &cg, AnalysisResultPtr ar, + bool last = true); + +protected: + std::set m_dynamic; // non-scalar or redeclared or marked up + +private: + ClassScopePtr findParent(AnalysisResultPtr ar, const std::string &name); + void outputCPPConstantSymbol(CodeGenerator &cg, AnalysisResultPtr ar, + const std::string &name); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CONSTANT_TABLE_H__ diff --git a/src/lib/analysis/core_code_error.inc b/src/lib/analysis/core_code_error.inc new file mode 100644 index 0000000000000..6e8cea625a035 --- /dev/null +++ b/src/lib/analysis/core_code_error.inc @@ -0,0 +1,51 @@ + +CODE_ERROR_ENTRY(BadPHPIncludeFile) +CODE_ERROR_ENTRY(RedundantInclude) +CODE_ERROR_ENTRY(PHPIncludeFileNotFound) +CODE_ERROR_ENTRY(PHPIncludeFileNotInLib) +CODE_ERROR_ENTRY(UseDynamicInclude) +CODE_ERROR_ENTRY(UseInclude) +CODE_ERROR_ENTRY(UseLDynamicVariable) +CODE_ERROR_ENTRY(UseRDynamicVariable) +CODE_ERROR_ENTRY(UseDynamicFunction) +CODE_ERROR_ENTRY(UseDynamicClass) +CODE_ERROR_ENTRY(UseDynamicProperty) +CODE_ERROR_ENTRY(UseDynamicMethod) +CODE_ERROR_ENTRY(UseDynamicGlobal) +CODE_ERROR_ENTRY(UseEvaluation) +CODE_ERROR_ENTRY(UseExtract) +CODE_ERROR_ENTRY(UseShellExec) +CODE_ERROR_ENTRY(UseNotSupportedUnset) +CODE_ERROR_ENTRY(UseUndeclaredVariable) +CODE_ERROR_ENTRY(PossibleUndeclaredVariable) +CODE_ERROR_ENTRY(UseUndeclaredConstant) +CODE_ERROR_ENTRY(UnknownClass) +CODE_ERROR_ENTRY(UnknownBaseClass) +CODE_ERROR_ENTRY(UnknownObjectMethod) +CODE_ERROR_ENTRY(DerivedObjectMethod) +CODE_ERROR_ENTRY(UnknownMagicMethod) +CODE_ERROR_ENTRY(InvalidMagicMethod) +CODE_ERROR_ENTRY(UnknownFunction) +CODE_ERROR_ENTRY(BadConstructorCall) +CODE_ERROR_ENTRY(DeclaredClassTwice) +CODE_ERROR_ENTRY(DeclaredFunctionTwice) +CODE_ERROR_ENTRY(DeclaredVariableTwice) +CODE_ERROR_ENTRY(DeclaredConstantTwice) +CODE_ERROR_ENTRY(DeclaredStaticVariableTwice) +CODE_ERROR_ENTRY(BadDefine) +CODE_ERROR_ENTRY(RequiredAfterOptionalParam) +CODE_ERROR_ENTRY(RedundantParameter) +CODE_ERROR_ENTRY(TooFewArgument) +CODE_ERROR_ENTRY(TooManyArgument) +CODE_ERROR_ENTRY(BadTypeConversion) +CODE_ERROR_ENTRY(ComplexForEach) +CODE_ERROR_ENTRY(StatementHasNoEffect) +CODE_ERROR_ENTRY(BadReturnStatement) +CODE_ERROR_ENTRY(UseVoidReturn) +CODE_ERROR_ENTRY(MissingObjectContext) +CODE_ERROR_ENTRY(CaseAfterDefault) +CODE_ERROR_ENTRY(MoreThanOneDefault) +CODE_ERROR_ENTRY(InvalidArrayElement) +CODE_ERROR_ENTRY(InvalidDerivation) +CODE_ERROR_ENTRY(ReassignThis) +CODE_ERROR_ENTRY(MissingAbstractMethodImpl) diff --git a/src/lib/analysis/core_dependency.inc b/src/lib/analysis/core_dependency.inc new file mode 100644 index 0000000000000..fd992ae0223eb --- /dev/null +++ b/src/lib/analysis/core_dependency.inc @@ -0,0 +1,10 @@ + +DEPENDENCY_ENTRY(PHPInclude) /* PHP File -> Container */ +DEPENDENCY_ENTRY(ClassDerivation) /* Base Class -> Derived Class */ +DEPENDENCY_ENTRY(FunctionCall) /* Declaration -> Function Call */ +DEPENDENCY_ENTRY(GlobalVariable) /* Declaration -> Usage */ +DEPENDENCY_ENTRY(Constant) /* Declaration -> Usage */ +DEPENDENCY_ENTRY(ProgramMaxInclude) /* PHP/PHPT File -> Program */ +DEPENDENCY_ENTRY(ProgramMinInclude) /* PHP/PHPT File -> Program */ +DEPENDENCY_ENTRY(ProgramUserFunction) /* Function -> Program */ +DEPENDENCY_ENTRY(ProgramUserClass) /* Class -> Program */ diff --git a/src/lib/analysis/dependency_graph.cpp b/src/lib/analysis/dependency_graph.cpp new file mode 100644 index 0000000000000..07eb49ec84b84 --- /dev/null +++ b/src/lib/analysis/dependency_graph.cpp @@ -0,0 +1,548 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace HPHP::JSON; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// statics + +bool (*DependencyGraph::m_hookHandler) + (DependencyGraph *depGraph, KindOf kindOf, + ConstructPtr childExp, ExpressionPtr parentExp, + CodeErrorPtr codeError, bool documentRoot, + std::string &child, std::string &parent, + HphpHookUniqueId id); + +/////////////////////////////////////////////////////////////////////////////// +// class Dependency + +Dependency::Dependency() : m_programCount(0) { +} + +/////////////////////////////////////////////////////////////////////////////// +// class DependencyGraph + +DependencyGraph::DependencyGraph() : m_total(0) { + m_forwards.resize(KindOfCount); + m_reverses.resize(KindOfCount); + m_parents.resize(KindOfCount); + m_allChildren.resize(KindOfCount); + m_allParents.resize(KindOfCount); +} + +void DependencyGraph::clearCache(KindOf kindOf) { + m_allChildren[kindOf].clear(); + m_allParents[kindOf].clear(); +} + +/////////////////////////////////////////////////////////////////////////////// + +string DependencyGraph::getIncludeFilePath(const string &source, + string expText, bool documentRoot) { + if (expText.size() <= 2) return ""; + + char first = expText[0]; + char last = expText[expText.size() - 1]; + + // (exp) + if (first == '(' && last == ')') { + expText = expText.substr(1, expText.size() - 2); + return getIncludeFilePath(source, expText, documentRoot); + } + + // 'string' + if ((first == '\'' && last == '\'') || (first == '"' && last == '"')) { + expText = expText.substr(1, expText.size() - 2); + + // absolute path + if (!expText.empty() && expText[0] == '/') { + return expText; + } + + // relative path to document root + if (documentRoot) { + return expText; + } + + // relative path to containing file's directory + ASSERT(source.size() > 1); + int pos = source.size() - 1; + for (; pos >= 0; pos--) { + if (source[pos] == '/') { + return source.substr(0, pos + 1) + expText; + } + } + return expText; + } + + // [IncludeRoot] . 'string' + for (map::const_iterator iter = Option::IncludeRoots.begin(); + iter != Option::IncludeRoots.end(); iter++) { + string rootExp = iter->first + " . "; + int rootLen = rootExp.size(); + if (expText.substr(0, rootLen) == rootExp && + (int)expText.length() > rootLen + 2 && + ((expText[rootLen] == '\'' && last == '\'') || + (expText[rootLen] == '"' && last == '"'))) { + expText = expText.substr(rootLen + 1, expText.length() - rootLen - 2); + + string includeRoot = iter->second; + if (!includeRoot.empty()) { + if (includeRoot[0] == '/') includeRoot = includeRoot.substr(1); + if (includeRoot.empty() || + includeRoot[includeRoot.size()-1] != '/') { + includeRoot += "/"; + } + } + if (!expText.empty() && expText[0] == '/') { + expText = expText.substr(1); + } + expText = includeRoot + expText; + return expText; + } + } + return ""; +} + +string DependencyGraph::parseInclude(const string &source, + ExpressionPtr parentExp, + bool documentRoot /* = false */) { + string included = parentExp->getText(); + string parent = getIncludeFilePath(source, included, documentRoot); + return Util::canonicalize(parent); +} + +bool DependencyGraph::checkInclude(ConstructPtr childExp, + ExpressionPtr parentExp, + CodeErrorPtr codeError, + bool documentRoot, + string &child, + string &parent) { + child = childExp->getLocation()->file; + parent = parseInclude(child, parentExp, documentRoot); + if ((parent.empty() || parent == child) && + Option::AllowedBadPHPIncludes.find(parentExp->getText()) == + Option::AllowedBadPHPIncludes.end()) { + if (codeError) { + codeError->record(CodeError::BadPHPIncludeFile, childExp); + } + return false; + } + if (parent.empty()) return false; + return true; +} + +string DependencyGraph::add(KindOf kindOf, ConstructPtr childExp, + ExpressionPtr parentExp, CodeErrorPtr codeError, + bool documentRoot /* = false */) { + string child = childExp->getLocation()->file; + string parent; + + switch (kindOf) { + case KindOfPHPInclude: + if (!checkInclude(childExp, parentExp, codeError, + documentRoot, child, parent)) { + return ""; + } + break; + default: + if (!m_hookHandler || + !m_hookHandler(this, kindOf, childExp, parentExp, codeError, + documentRoot, child, parent, beforeDependencyGraphAdd)) { + return ""; + } + break; + } + + string program; // no program is associated + add(kindOf, program, child, childExp, parent, ConstructPtr(), codeError); + + if (m_hookHandler) { + m_hookHandler(this, kindOf, childExp, parentExp, codeError, + documentRoot, child, parent, afterDependencyGraphAdd); + } + return parent; +} + +void DependencyGraph::add(KindOf kindOf, const string &childName, + ConstructPtr child, const string &parentName) { + ASSERT(kindOf == KindOfClassDerivation || kindOf == KindOfFunctionCall); + string program; // no program is associated yet + add(kindOf, program, childName, child, parentName, ConstructPtr()); +} + +void DependencyGraph::add(KindOf kindOf, const std::string &program, + const std::string &parent, StatementPtr stmt) { + ASSERT(kindOf == KindOfProgramMaxInclude || + kindOf == KindOfProgramMinInclude || + kindOf == KindOfProgramUserFunction || + kindOf == KindOfProgramUserClass); + add(kindOf, program, program, ConstructPtr(), parent, ConstructPtr()); + if ((kindOf == KindOfProgramUserFunction || + kindOf == KindOfProgramUserClass) && *stmt->getLocation()->file) { + add(KindOfProgramMinInclude, program, program, ConstructPtr(), + stmt->getLocation()->file, ConstructPtr()); + } +} + +void DependencyGraph::add(KindOf kindOf, const string &program, + const string &childName, ConstructPtr child, + const string &parentName, ConstructPtr parent, + CodeErrorPtr codeError /* = CodeErrorPtr() */) { + ASSERT(kindOf >= 0 && kindOf < KindOfCount); + ASSERT(!childName.empty()); + ASSERT(!parentName.empty()); + clearCache(kindOf); + + DependencyPtrVecPtr &dependencies = + m_forwards[kindOf][parentName][childName]; + if (!dependencies) { + dependencies = DependencyPtrVecPtr(new DependencyPtrVec()); + m_forwards[kindOf][parentName][childName] = dependencies; + m_reverses[kindOf][childName][parentName] = dependencies; + } else if (codeError) { + // two identical file includes + codeError->record(CodeError::RedundantInclude, child, + (*dependencies)[0]->m_child); + } + + bool found = false; + for (unsigned int i = 0; i < dependencies->size(); i++) { + DependencyPtr dep = dependencies->at(i); + if (dep->m_child != child) continue; + + // completing unresolved dependency + if (!dep->m_parent && parent) { + dep->m_parent = parent; + if (Option::DependencyMaxProgram && !program.empty()) { + dep->m_programs.push_back(program); + } + found = true; + break; + } + + // comparing fully resolved dependencies + if (dep->m_parent == parent) { + dep->m_programCount++; + if ((int)dep->m_programs.size() < Option::DependencyMaxProgram) { + dep->m_programs.push_back(program); + } + found = true; + break; + } + } + + // adding new dependency + if (!found) { + DependencyPtr dep = DependencyPtr(new Dependency()); + dep->m_parent = parent; + dep->m_child = child; + dep->m_programCount = 1; + if (Option::DependencyMaxProgram && !program.empty()) { + dep->m_programs.push_back(program); + } + dependencies->push_back(dep); + m_total++; + } +} + +void DependencyGraph::addParent(KindOf kindOf, const std::string &program, + const std::string &parentName, + ConstructPtr parent) { + ASSERT(kindOf >= 0 && kindOf < KindOfCount); + ASSERT(!parentName.empty()); + + DependencyPtr &dep = m_parents[kindOf][parentName]; + if (!dep) { + dep = DependencyPtr(new Dependency()); + dep->m_parent = parent; + dep->m_programCount = 1; + if (Option::DependencyMaxProgram && !program.empty()) { + dep->m_programs.push_back(program); + } + m_parents[kindOf][parentName] = dep; + } else if (parent && parent->hasHphpNote("MasterCopy")) { + dep->m_parent = parent; + } +} + +ConstructPtr DependencyGraph::getParent(KindOf kindOf, + const std::string &name) const { + const StringToDependencyPtrMap &parents = m_parents[kindOf]; + StringToDependencyPtrMap::const_iterator iter = parents.find(name); + if (iter != parents.end()) { + return iter->second->m_parent; + } + return ConstructPtr(); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool DependencyGraph::hasAnyChildren(KindOf kindOf, + const std::string &parent) const { + ASSERT(kindOf >= 0 && kindOf < KindOfCount); + const DependencyMapMap &childMapMap = m_forwards[kindOf]; + MapMapConstIter iter = childMapMap.find(parent); + return iter != childMapMap.end(); +} + +const StringToConstructPtrMap& +DependencyGraph::getAllChildren(KindOf kindOf, const string &parent) const { + ASSERT(kindOf >= 0 && kindOf < KindOfCount); + StringConstructMapMap &childMap = m_allChildren[kindOf]; + + StringConstructMapMap::const_iterator iter = childMap.find(parent); + if (iter != childMap.end()) return iter->second; + + StringToConstructPtrMap &children = childMap[parent]; + const DependencyMapMap &childMapMap = m_forwards[kindOf]; + MapMapConstIter iterMapMap = childMapMap.find(parent); + if (iterMapMap != childMapMap.end()) { + for (MapConstIter iterMap = iterMapMap->second.begin(); + iterMap != iterMapMap->second.end(); ++iterMap) { + const string &child = iterMap->first; + children[child] = iterMap->second->at(0)->m_child; + + // this is recursively done so children can have theirs cached as well + const StringToConstructPtrMap &grandChildren = + getAllChildren(kindOf, child); + children.insert(grandChildren.begin(), grandChildren.end()); + } + } + return children; +} + +const StringToConstructPtrMap& +DependencyGraph::getAllParents(KindOf kindOf, const std::string &child) const { + ASSERT(kindOf >= 0 && kindOf < KindOfCount); + StringConstructMapMap &parentMap = m_allParents[kindOf]; + + StringConstructMapMap::const_iterator iter = parentMap.find(child); + if (iter != parentMap.end()) return iter->second; + + StringToConstructPtrMap &parents = parentMap[child]; + const DependencyMapMap &parentMapMap = m_reverses[kindOf]; + MapMapConstIter iterMapMap = parentMapMap.find(child); + if (iterMapMap != parentMapMap.end()) { + for (MapConstIter iterMap = iterMapMap->second.begin(); + iterMap != iterMapMap->second.end(); ++iterMap) { + const string &parent = iterMap->first; + parents[parent] = iterMap->second->at(0)->m_parent; + + // this is recursively done so parents can have theirs cached as well + const StringToConstructPtrMap &grandParents = + getAllParents(kindOf, parent); + parents.insert(grandParents.begin(), grandParents.end()); + } + } + return parents; +} + +void DependencyGraph::getChildren(KindOf kindOf, const std::string &parent, + DependencyPtrVec &children) const { + ASSERT(kindOf >= 0 && kindOf < KindOfCount); + MapMapConstIter iterMapMap = m_forwards[kindOf].find(parent); + if (iterMapMap != m_forwards[kindOf].end()) { + const DependencyMap &depMap = iterMapMap->second; + for (MapConstIter iter = depMap.begin(); iter != depMap.end(); ++iter) { + children.insert(children.end(), iter->second->begin(), + iter->second->end()); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +std::vector DependencyGraph::DependencyTexts; +std::vector &DependencyGraph::getDependencyTexts() { + if (DependencyTexts.empty()) { + DependencyTexts.resize(KindOfCount); +#define DEPENDENCY_ENTRY(x) DependencyTexts[KindOf ## x] = #x; +#include "dependency.inc" +#undef DEPENDENCY_ENTRY + } + return DependencyTexts; +} + +void Dependency::serialize(JSON::OutputStream &out) const { + out.raw() << "{"; + if (m_parent) { + out << Name("p") << m_parent; out.raw() << ','; + } + if (m_child) { + out << Name("c") << m_child; out.raw() << ','; + } + out << Name("c") << m_programCount; out.raw() << ','; + out << Name("f") << m_programs; + out.raw() << "}\n"; +} + +void DependencyGraph::serialize(JSON::OutputStream &out) const { + out.raw() << "{"; + out << Name("Count") << m_total; out.raw() << ','; + out << Name("ParentToChildren") << m_forwards; out.raw() << ','; + out << Name("ChildToParents") << m_reverses; out.raw() << ','; + out.raw() << "}\n"; +} + +void DependencyGraph::saveToFiles(const char *dir) const { + vector &dependencyTexts = getDependencyTexts(); + for (int i = 0; i < KindOfCount; i++) { + string file = dir; + file += "/"; + file += dependencyTexts[i]; + file += ".js"; + + ofstream f(file.c_str()); + if (f) { + JSON::OutputStream o(f); + f << "{"; + o << Name("ParentToChildren") << m_forwards[i]; f << ','; + o << Name("ChildToParents") << m_reverses[i]; f << ','; + f << "}\n"; + f.close(); + } + } +} + +void DependencyGraph::saveToDB(ServerDataPtr server, int runId) const { + vector &dependencyTexts = getDependencyTexts(); + + DBConn conn; + conn.open(server); + + const char *sql = "INSERT INTO hphp_dep (run, program, kind, parent, " + "parent_file, parent_line, child, child_file, child_line)"; + DBQueryPtr q(new DBQuery(&conn, sql)); + int count = 0; + const int MAX_COUNT = 1000; + + for (int kindOf = 0; kindOf < KindOfCount; kindOf++) { + const DependencyMapMap &mapmap = m_forwards[kindOf]; + const char *depText = dependencyTexts[kindOf]; + + int k = kindOf; + if (k == KindOfProgramMaxInclude) { + k = KindOfPHPInclude; // all three share the same list of parents + } else if (k == KindOfProgramUserFunction) { + k = KindOfFunctionCall; // both share the same list of parents + } + const StringToDependencyPtrMap &parents = m_parents[k]; + + // non-orphaned parents + for (MapMapConstIter iterParent = mapmap.begin(); + iterParent != mapmap.end(); ++iterParent) { + const std::string &parent = iterParent->first; + const DependencyMap &depMap = iterParent->second; + for (MapConstIter iterChild = depMap.begin(); + iterChild != depMap.end(); ++iterChild) { + const std::string &child = iterChild->first; + const DependencyPtrVec &deps = *iterChild->second; + for (unsigned int i = 0; i < deps.size(); i++) { + Dependency &dep = *deps[i]; + + const char *parentFile = ""; + const char *childFile = ""; + int parentLine = 0; + int childLine = 0; + StringToDependencyPtrMap::const_iterator iter = + parents.find(parent); + if (iter != parents.end()) { + if (iter->second->m_parent) { + parentFile = iter->second->m_parent->getLocation()->file; + parentLine = iter->second->m_parent->getLocation()->line1; + } + } else if (dep.m_parent) { + parentFile = dep.m_parent->getLocation()->file; + parentLine = dep.m_parent->getLocation()->line1; + } + if (dep.m_child) { + childFile = dep.m_child->getLocation()->file; + childLine = dep.m_child->getLocation()->line1; + } + + vector programs = dep.m_programs; + if (programs.empty()) programs.push_back(""); + for (unsigned int p = 0; p < programs.size(); p++) { + q->insert("%d,'%s','%s', '%s','%s',%d, '%s','%s',%d", + runId, programs[p].c_str(), depText, + parent.c_str(), parentFile, parentLine, + child.c_str(), childFile, childLine); + if (++count >= MAX_COUNT) { + count = 0; + q->execute(); + q = DBQueryPtr(new DBQuery(&conn, sql)); + } + } + } + } + } + + // orphaned parents + for (StringToDependencyPtrMap::const_iterator iter = parents.begin(); + iter != parents.end(); ++iter) { + if (mapmap.find(iter->first) == mapmap.end()) { + Dependency &dep = *iter->second; + + const char *parentFile = ""; + int parentLine = 0; + if (dep.m_parent && dep.m_parent->getLocation()) { + parentFile = dep.m_parent->getLocation()->file; + parentLine = dep.m_parent->getLocation()->line1; + } + + vector programs = dep.m_programs; + if (programs.empty()) programs.push_back(""); + for (unsigned int p = 0; p < programs.size(); p++) { + q->insert("%d,'%s','%s', '%s','%s',%d, '','',0", + runId, programs[p].c_str(), depText, + iter->first.c_str(), parentFile, parentLine); + if (++count >= MAX_COUNT) { + count = 0; + q->execute(); + q = DBQueryPtr(new DBQuery(&conn, sql)); + } + } + } + } + } + + if (count) q->execute(); +} + +bool DependencyGraph::checkCircle(KindOf kindOf, + const std::string &childName, + const std::string &parentName) +{ + ASSERT(kindOf >= 0 && kindOf < KindOfCount); + clearCache(kindOf); + + const StringToConstructPtrMap &parents = getAllParents(kindOf, parentName); + return (parents.find(childName) != parents.end()); +} diff --git a/src/lib/analysis/dependency_graph.h b/src/lib/analysis/dependency_graph.h new file mode 100644 index 0000000000000..844e006805d8f --- /dev/null +++ b/src/lib/analysis/dependency_graph.h @@ -0,0 +1,222 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __DEPENDENCY_GRAPH_H__ +#define __DEPENDENCY_GRAPH_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ServerData); +DECLARE_BOOST_TYPES(Expression); +DECLARE_BOOST_TYPES(Construct); +DECLARE_BOOST_TYPES(Statement); +DECLARE_BOOST_TYPES(CodeError); +DECLARE_BOOST_TYPES(Dependency); +DECLARE_BOOST_TYPES(DependencyGraph); + +class Dependency : public JSON::ISerializable { +public: + /** + * Implements JSON::ISerializable. + */ + virtual void serialize(JSON::OutputStream &out) const; + +public: + Dependency(); + + int m_programCount; + std::vector m_programs; + ConstructPtr m_parent; + ConstructPtr m_child; +}; + +/** + * Some dependencies are added during parse (phase 1). + * Some dependencies are added independent of programs (phase 2). + * Some dependencies are added under context of programs (phase 3). + * Phase 2 dependencies are resolved in phase 3. + * Phase 1 dependencies don't need resolution at all, as they are file level + * ones. + */ +class DependencyGraph : public JSON::ISerializable { + friend class DependencyGraphHook; +public: + enum KindOf { +#define DEPENDENCY_ENTRY(x) KindOf ## x, +#include "dependency.inc" +#undef DEPENDENCY_ENTRY + KindOfCount + }; + +public: + DependencyGraph(); + + /** + * Add file dependencies: PHP, CSS or JS. + * + * Returns the PHP file name it's being included, if any. + */ + std::string add(KindOf kindOf, ConstructPtr childExp, + ExpressionPtr parentExp, CodeErrorPtr codeError, + bool documentRoot = false); + + /** + * Add unresolved KindOfClassDerivation or KindOfFunctionCall. + */ + void add(KindOf kindOf, + const std::string &childName, ConstructPtr child, + const std::string &parentName); + + /** + * Add Program dependencies: PrgramMaxInclude, ProgramMinInclude, + * ProgramUserFunction or ProgramUserClass + */ + void add(KindOf kindOf, const std::string &program, + const std::string &parent, StatementPtr stmt); + + /** + * Add fully resolved dependencies. Returns true if newly added, + * false if it's there already. + */ + void add(KindOf kindOf, const std::string &program, + const std::string &childName, ConstructPtr child, + const std::string &parentName, ConstructPtr parent, + CodeErrorPtr codeError = CodeErrorPtr()); + + /** + * These are all potential parents. With this list, we can then build + * list of orphaned parents. + */ + void addParent(KindOf kindOf, const std::string &program, + const std::string &parentName, ConstructPtr parent); + + /** + * Whether there are any dependents. + */ + bool hasAnyChildren(KindOf kindOf, const std::string &parent) const; + + /** + * This will get all children (not just direct ones) of a parent + * recursively. + */ + const StringToConstructPtrMap& + getAllChildren(KindOf kindOf, const std::string &parent) const; + + /** + * This will get all parents (not just direct ones) of a child + * recursively. + */ + const StringToConstructPtrMap& + getAllParents(KindOf kindOf, const std::string &child) const; + + /** + * Get direct children. + */ + void getChildren(KindOf kindOf, const std::string &parent, + DependencyPtrVec &children) const; + + /** + * Look up a parent. + */ + ConstructPtr getParent(KindOf kindOf, const std::string &name) const; + + /** + * Implements JSON::ISerializable. + */ + virtual void serialize(JSON::OutputStream &out) const; + + /** + * Save one type of dependency as one .js file. + */ + void saveToFiles(const char *dir) const; + + /** + * Save dependency data to a database. + */ + void saveToDB(ServerDataPtr server, int runId) const; + + bool checkCircle(KindOf kindOf, + const std::string &childName, + const std::string &parentName); + + static std::string parseInclude(const std::string &source, + ExpressionPtr exp, + bool documentRoot = false); + + static void setHookHandler(bool (*hookHandler)(DependencyGraph *depGraph, + KindOf kindOf, + ConstructPtr childExp, + ExpressionPtr parentExp, + CodeErrorPtr codeError, + bool documentRoot, + std::string &child, + std::string &parent, + HphpHookUniqueId id)) { + m_hookHandler = hookHandler; + } + +private: + static std::vector DependencyTexts; + static std::vector &getDependencyTexts(); + + typedef boost::shared_ptr DependencyPtrVecPtr; + typedef std::map DependencyMap; + typedef std::map DependencyMapMap; + typedef DependencyMap::const_iterator MapConstIter; + typedef DependencyMapMap::const_iterator MapMapConstIter; + typedef std::map + StringConstructMapMap; + + std::vector m_forwards; // parent -> child + std::vector m_reverses; // child -> parent + std::vector m_parents; + int m_total; + + // cached recursive children + mutable std::vector m_allChildren; + mutable std::vector m_allParents; + + static std::string getIncludeFilePath(const std::string &source, + std::string expText, + bool documentRoot); + static void dumpMapMap(std::string &out, + const std::vector &dmms); + + void clearCache(KindOf kindOf); + + bool checkInclude(ConstructPtr childExp, ExpressionPtr parentExp, + CodeErrorPtr codeError, bool documentRoot, + std::string &child, std::string &parent); + + + // hook + static bool (*m_hookHandler)(DependencyGraph *depGraph, KindOf kindOf, + ConstructPtr childExp, ExpressionPtr parentExp, + CodeErrorPtr codeError, bool documentRoot, + std::string &child, std::string &parent, + HphpHookUniqueId id); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __DEPENDENCY_GRAPH_H__ diff --git a/src/lib/analysis/file_scope.cpp b/src/lib/analysis/file_scope.cpp new file mode 100644 index 0000000000000..494bb366fbf7b --- /dev/null +++ b/src/lib/analysis/file_scope.cpp @@ -0,0 +1,538 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace boost; +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +FileScope::FileScope(const string &fileName, int fileSize) + : BlockScope("", StatementPtr(), BlockScope::FileScope), + m_size(fileSize), m_fileName(fileName) { + pushAttribute(); // for global scope +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void FileScope::setTree(StatementListPtr tree) { + m_tree = tree; + + for (int i = 0; i < tree->getCount(); i++) { + StatementPtr stmt = (*tree)[i]; + stmt->setFileLevel(); + if (stmt->is(Statement::KindOfExpStatement)) { + ExpStatementPtr expStmt = dynamic_pointer_cast(stmt); + ExpressionPtr exp = expStmt->getExpression(); + exp->setFileLevel(); + } + } +} + +void FileScope::addClass(AnalysisResultPtr ar, ClassScopePtr classScope) { + if (ar->declareClass(classScope)) { + m_classes[classScope->getName()].push_back(classScope); + } else { + m_ignoredClasses.push_back(classScope); + } +} + +ClassScopePtr FileScope::getClass(const char *name) { + StringToClassScopePtrVecMap::const_iterator iter = m_classes.find(name); + if (iter == m_classes.end()) return ClassScopePtr(); + return iter->second.back(); +} + + +int FileScope::getFunctionCount() const { + int total = FunctionContainer::getFunctionCount(); + for (StringToClassScopePtrVecMap::const_iterator iter = m_classes.begin(); + iter != m_classes.end(); ++iter) { + BOOST_FOREACH(ClassScopePtr cls, iter->second) { + total += cls->getFunctionCount(); + } + } + return total; +} + +void FileScope::countReturnTypes(std::map &counts) { + FunctionContainer::countReturnTypes(counts); + for (StringToClassScopePtrVecMap::const_iterator iter = m_classes.begin(); + iter != m_classes.end(); ++iter) { + BOOST_FOREACH(ClassScopePtr cls, iter->second) { + cls->countReturnTypes(counts); + } + } +} + +void FileScope::pushAttribute() { + m_attributes.push_back(0); +} + +void FileScope::setAttribute(Attribute attr) { + ASSERT(!m_attributes.empty()); + m_attributes.back() |= attr; +} + +int FileScope::popAttribute() { + ASSERT(!m_attributes.empty()); + int ret = m_attributes.back(); + m_attributes.pop_back(); + return ret; +} + +int FileScope::getGlobalAttribute() const { + ASSERT(m_attributes.size() == 1); + return m_attributes.back(); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool FileScope::hasImpl(AnalysisResultPtr ar) const { + return m_tree && m_tree->hasImpl(); +} + +bool FileScope::isErrorSuppressed(CodeError::ErrorType e) { + for (unsigned int i = 0; i < m_suppressedErrors.size(); i++) { + if (m_suppressedErrors[i] == e) { + return true; + } + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +void FileScope::declareConstant(AnalysisResultPtr ar, const string &name) { + if (!ar->declareConst(shared_from_this(), name)) { + addConstantDependency(ar, name); + } +} + +void FileScope::addConstant(const string &name, TypePtr type, ExpressionPtr value, + AnalysisResultPtr ar, ConstructPtr con) { + BlockScopePtr f = ar->findConstantDeclarer(name); + cout << "Add constant " << name << " in " << f->getName() << endl; + f->getConstants()->add(name, type, value, ar, con); +} + +void FileScope::addIncludeDependency(AnalysisResultPtr ar, + const string &file, bool byInlined) { + ar->addIncludeDependency(shared_from_this(), file); + if (byInlined) m_usedIncludesInline.insert(file); +} +void FileScope::addClassDependency(AnalysisResultPtr ar, + const string &classname) { + if (m_usedClasses.find(classname) == m_usedClasses.end()) { + m_usedClasses.insert(classname); + ar->addClassDependency(shared_from_this(), classname); + } +} +void FileScope::addFunctionDependency(AnalysisResultPtr ar, + const string &funcname, bool byInlined) { + ar->addFunctionDependency(shared_from_this(), funcname); + if (byInlined) m_usedFuncsInline.insert(funcname); +} +void FileScope::addConstantDependency(AnalysisResultPtr ar, + const string &decname) { + if (m_usedConsts.find(decname) == m_usedConsts.end()) { + m_usedConsts.insert(decname); + ar->addConstantDependency(shared_from_this(), decname); + } +} + +void FileScope::analyzeProgram(AnalysisResultPtr ar) { + if (ar->getPhase() == AnalysisResult::AnalyzeInclude) + createPseudoMain(ar); + + ar->pushScope(shared_from_this()); + for (StringToFunctionScopePtrVecMap::iterator it = m_functions.begin(); + it != m_functions.end(); ++it) { + if (it->second[0]->inPseudoMain()) { + it->second[0]->getStmt()->analyzeProgram(ar); + break; + } + } + ar->popScope(); +} + +void FileScope::preOptimize(AnalysisResultPtr ar) { + for (StringToFunctionScopePtrVecMap::iterator it = m_functions.begin(); + it != m_functions.end(); ++it) { + if (it->second[0]->inPseudoMain()) { + it->second[0]->getStmt()->preOptimize(ar); + break; + } + } +} + +void FileScope::postOptimize(AnalysisResultPtr ar) { + for (StringToFunctionScopePtrVecMap::iterator it = m_functions.begin(); + it != m_functions.end(); ++it) { + if (it->second[0]->inPseudoMain()) { + it->second[0]->getStmt()->postOptimize(ar); + break; + } + } +} + +void FileScope::inferTypes(AnalysisResultPtr ar) { + for (StringToFunctionScopePtrVecMap::iterator it = m_functions.begin(); + it != m_functions.end(); ++it) { + if (it->second[0]->inPseudoMain()) { + it->second[0]->getStmt()->inferTypes(ar); + break; + } + } +} + +const string &FileScope::pseudoMainName() { + if (m_pseudoMainName.empty()) { + m_pseudoMainName = Option::mangleFilename(m_fileName, true); + } + return m_pseudoMainName; +} + +void FileScope::createPseudoMain(AnalysisResultPtr ar) { + StatementListPtr st = m_tree; + FunctionStatementPtr f + (new FunctionStatement(LocationPtr(), + Statement::KindOfFunctionStatement, + false, pseudoMainName(), + ExpressionListPtr(), st, 0)); + f->setFileLevel(); + FunctionScopePtr pseudoMain + (new HPHP::FunctionScope(ar, true, + pseudoMainName().c_str(), + f, false, 0, 0, + ModifierExpressionPtr(), + m_attributes[0], + shared_from_this(), + true)); + f->setFunctionScope(pseudoMain); + m_functions[pseudoMainName()].push_back(pseudoMain); +} + +string FileScope::outputFilebase() { + string file = m_fileName; + string out; + if (file.size() > 4 && file.substr(file.length() - 4) == ".php") { + out = file.substr(0, file.length() - 4); + } else { + out = file + ".nophp"; + } + return Option::mangleFilename(out, false); +} + +void FileScope::outputCPPHelper(CodeGenerator &cg, AnalysisResultPtr ar, + bool classes /* = true */) { + if (classes) { + for (StringToClassScopePtrVecMap::iterator it = m_classes.begin(); + it != m_classes.end(); ++it) { + BOOST_FOREACH(ClassScopePtr cls, it->second) { + ar->pushScope(cls); + cls->getStmt()->outputCPP(cg, ar); + ar->popScope(); + } + } + } + for (StringToFunctionScopePtrVecMap::iterator it = m_functions.begin(); + it != m_functions.end(); ++it) { + BOOST_FOREACH(FunctionScopePtr func, it->second) { + ar->pushScope(func); + func->getStmt()->outputCPP(cg, ar); + ar->popScope(); + } + } +} + +void FileScope::outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) { + ASSERT(cg.getContext() == CodeGenerator::CppImplementation); + + cg.setContext(CodeGenerator::CppConstantsDecl); + getConstants()->outputCPP(cg, ar); + + cg.setContext(CodeGenerator::CppImplementation); + cg.printf("/* preface starts */\n"); + for (vector::const_iterator it = m_lambdas.begin(); + it != m_lambdas.end(); ++it) { + cg.indentBegin("inline %s %s(%s) {\n", it->rt.c_str(), it->name.c_str(), + it->args.c_str()); + cg.printf("%s\n", it->body.c_str()); + cg.indentEnd("}\n"); + } + cg.printf("/* preface finishes */\n"); + + outputCPPHelper(cg, ar); + + if (Option::GenerateCPPMacros) { + bool hasRedec; + outputCPPJumpTableSupport(cg, ar, hasRedec); + for (StringToClassScopePtrVecMap::iterator it = m_classes.begin(); + it != m_classes.end(); ++it) { + BOOST_FOREACH(ClassScopePtr cls, it->second) { + if (!cls->isInterface()) { + cls->outputCPPDynamicClassImpl(cg, ar); + } + } + } + } +} + +void FileScope::outputCPPPseudoMain(CodeGenerator &cg, AnalysisResultPtr ar) { + ASSERT(cg.getContext() == CodeGenerator::CppPseudoMain); + outputCPPHelper(cg, ar, false); +} + +void FileScope::outputCPPForwardDeclarations(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.printSection("Forward Declarations"); + cg.setContext(CodeGenerator::CppForwardDeclaration); + + string name; + ClassScopePtr cls; + + map extraIncs; + BOOST_FOREACH(name, m_usedClasses) { + cls = ar->findClass(name, AnalysisResult::ClassName); + if (cls && cls->isUserClass()) { + FileScopePtr fs = cls->getFileScope(); + if (fs) { + extraIncs[fs->getName()] = fs; + } + } + } + BOOST_FOREACH(name, m_usedConsts) { + BlockScopePtr block = ar->findConstantDeclarer(name); + if (block && block->is(BlockScope::FileScope)) { + FileScopePtr fs = dynamic_pointer_cast(block); + extraIncs[fs->getName()] = fs; + } + } + + cg.namespaceBegin(); + cg.printSection("1. Constants", false); + if (cg.getOutput() != CodeGenerator::MonoCPP) { + getConstants()->outputCPP(cg, ar); + } else { + cg.printf("// (omitted in MonoCPP mode)\n"); + } + + cg.printSection("2. Classes"); + for (StringToClassScopePtrVecMap::iterator it = m_classes.begin(); + it != m_classes.end(); ++it) { + BOOST_FOREACH(ClassScopePtr cls, it->second) { + ar->pushScope(cls); + cls->getStmt()->outputCPP(cg, ar); + ar->popScope(); + } + } + + cg.namespaceEnd(); + // Includes must come after classes and constants + for (map::const_iterator iter = extraIncs.begin(); + iter != extraIncs.end(); ++iter) { + FileScopePtr fs = iter->second; + if (fs != shared_from_this()) { + cg.printInclude(fs->outputFilebase() + ".fw.h"); + } + } +} + +void FileScope::outputCPPDeclarations(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.printSection("Declarations"); + cg.setContext(CodeGenerator::CppDeclaration); + + if (cg.getOutput() == CodeGenerator::MonoCPP) { + cg.namespaceBegin(); + outputCPPHelper(cg, ar); + cg.namespaceEnd(); + } else { + set done; + done.insert(shared_from_this()); + + // Class declarations cunningly expressed as includes so I don't + // have to worry about inheritance dependencies. + for (StringToClassScopePtrVecMap::iterator it = m_classes.begin(); + it != m_classes.end(); ++it) { + BOOST_FOREACH(ClassScopePtr cls, it->second) { + cg.printInclude(cls->getHeaderFilename()); + } + } + + BOOST_FOREACH(string name, m_usedClasses) { + ClassScopePtr cls = ar->findClass(name, AnalysisResult::ClassName); + if (cls && cls->isUserClass()) { + FileScopePtr fs = cls->getFileScope(); + if (fs && done.find(fs) == done.end()) { + done.insert(fs); + cg.printInclude(fs->outputFilebase()); + } + } + } + + BOOST_FOREACH(string name, m_usedFuncsInline) { + FunctionScopePtr func = ar->findFunction(name); + if (func) { + FileScopePtr fs = func->getFileScope(); + if (fs && done.find(fs) == done.end()) { + done.insert(fs); + cg.printInclude(fs->outputFilebase()); + } + } + } + BOOST_FOREACH(string name, m_usedIncludesInline) { + FileScopePtr fs = ar->findFileScope(name, false); + if (fs && done.find(fs) == done.end()) { + done.insert(fs); + cg.printInclude(fs->outputFilebase()); + } + } + + cg.namespaceBegin(); + cg.setContext(CodeGenerator::CppForwardDeclaration); + outputCPPHelper(cg, ar, false); // function forward declarations + cg.setContext(CodeGenerator::CppDeclaration); + outputCPPHelper(cg, ar, false); // function declarations (only inline) + + outputCPPJumpTableDecl(cg, ar); + + + for (StringToClassScopePtrVecMap::iterator it = m_classes.begin(); + it != m_classes.end(); ++it) { + BOOST_FOREACH(ClassScopePtr cls, it->second) { + if (!cls->isInterface()) { + cls->outputCPPDynamicClassDecl(cg); + } + } + } + cg.namespaceEnd(); + } +} + +void FileScope::outputCPPForwardDeclHeader(CodeGenerator &cg, + AnalysisResultPtr ar) { + string header = outputFilebase() + ".fw.h"; + cg.headerBegin(header); + if (Option::GenerateCPPMain) { + cg.printInclude(""); + cg.printInclude(string(Option::SystemFilePrefix) + "global_variables.h"); + } else if (cg.getOutput() == CodeGenerator::SystemCPP) { + cg.printInclude(""); + } + outputCPPForwardDeclarations(cg, ar); + cg.headerEnd(header); +} + +void FileScope::outputCPPDeclHeader(CodeGenerator &cg, AnalysisResultPtr ar) { + string fwheader = outputFilebase() + ".fw.h"; + string header = outputFilebase() + ".h"; + cg.headerBegin(header); + if (Option::GenerateCPPMain) { + cg.printInclude(""); + cg.printInclude(string(Option::SystemFilePrefix) + "global_variables.h"); + } else if (cg.getOutput() == CodeGenerator::SystemCPP) { + cg.printInclude(""); + } + cg.printInclude(fwheader); + outputCPPDeclarations(cg, ar); + cg.headerEnd(header); +} + +void FileScope::outputCPPClassHeaders(AnalysisResultPtr ar, + CodeGenerator::Output output) { + string name; + ClassScopePtr cls; + for (StringToClassScopePtrVecMap::iterator it = m_classes.begin(); + it != m_classes.end(); ++it) { + BOOST_FOREACH(ClassScopePtr cls, it->second) { + cls->outputCPPHeader(ar, output); + } + } +} + +void FileScope::outputCPPFFI(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.setContext(CodeGenerator::CppFFIDecl); + cg.useStream(CodeGenerator::PrimaryStream); + outputCPPHelper(cg, ar, true); + cg.useStream(CodeGenerator::ImplFile); + cg.setContext(CodeGenerator::CppFFIImpl); + cg.printInclude(outputFilebase() + ".h"); + outputCPPHelper(cg, ar, true); +} + +void FileScope::outputHSFFI(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.setContext(CodeGenerator::HsFFI); + outputCPPHelper(cg, ar, false); +} + +void FileScope::outputJavaFFI(CodeGenerator &cg, AnalysisResultPtr ar) { + // first, generate methods in HphpMain.java + for (StringToFunctionScopePtrVecMap::iterator it = m_functions.begin(); + it != m_functions.end(); ++it) { + BOOST_FOREACH(FunctionScopePtr func, it->second) { + ar->pushScope(func); + func->getStmt()->outputCPP(cg, ar); + ar->popScope(); + } + } + + // for each php class or interface, generate a Java file + for (StringToClassScopePtrVecMap::iterator it = m_classes.begin(); + it != m_classes.end(); ++it) { + BOOST_FOREACH(ClassScopePtr cls, it->second) { + ar->pushScope(cls); + cls->getStmt()->outputCPP(cg, ar); + ar->popScope(); + } + } +} + +void FileScope::outputJavaFFICPPStub(CodeGenerator &cg, + AnalysisResultPtr ar) { + if (cg.getContext() == CodeGenerator::JavaFFICppImpl) { + // java_stubs.h doesn't need the extra include + cg.printInclude(outputFilebase() + ".h"); + } + outputCPPHelper(cg, ar, true); +} + +void FileScope::outputSwigFFIStubs(CodeGenerator &cg, AnalysisResultPtr ar) { + // currently only support toplevel functions + outputCPPHelper(cg, ar, false); +} diff --git a/src/lib/analysis/file_scope.h b/src/lib/analysis/file_scope.h new file mode 100644 index 0000000000000..f8480cf6fdd54 --- /dev/null +++ b/src/lib/analysis/file_scope.h @@ -0,0 +1,218 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __FILE_SCOPE_H__ +#define __FILE_SCOPE_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class CodeGenerator; +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(ClassScope); +DECLARE_BOOST_TYPES(Location); +DECLARE_BOOST_TYPES(FileScope); +DECLARE_BOOST_TYPES(FunctionScope); + +/** + * A FileScope stores what's parsed from one single source file. It's up to + * AnalysisResult objects to grab statements, functions and classes from + * FileScope objects to form execution paths. + */ +class FileScope : public BlockScope, public FunctionContainer { +public: + enum Attribute { + ContainsDynamicVariable = 0x1, + ContainsLDynamicVariable = 0x2, + VariableArgument = 0x4, + ContainsExtract = 0x8, // need special VariableTable + ContainsCompact = 0x10, // need RVariableTable + exists() + ContainsReference = 0x20, // either returning ref or with ref parameters + ReferenceVariableArgument = 0x40, // like sscanf or fscanf + ContainsUnset = 0x80, // need special handling + NoEffect = 0x100, // does not side effect + HelperFunction = 0x200 // runtime helper function + }; + + typedef boost::adjacency_list Graph; + typedef boost::graph_traits::vertex_descriptor vertex_descriptor; + +public: + FileScope(const std::string &fileName, int fileSize); + int getSize() const { return m_size;} + + // implementing FunctionContainer + virtual std::string getParentName() const { ASSERT(false); return "";} + + const std::string &getName() const { return m_fileName;} + StatementListPtr getStmt() const { return m_tree;} + const StringToClassScopePtrVecMap &getClasses() const { + return m_classes; + } + ClassScopePtr getClass(const char *name); + + virtual int getFunctionCount() const; + virtual void countReturnTypes(std::map &counts); + int getClassCount() const { return m_classes.size();} + + void pushAttribute(); + void setAttribute(Attribute attr); + int getGlobalAttribute() const; + int popAttribute(); + + + /** + * Whether this file has top level non-declaration statements that + * have CPP implementation. + */ + bool hasImpl(AnalysisResultPtr ar) const; + + /** + * Parser functions. Parser only deals with a FileScope object, and these + * are the only functions a parser calls upon analysis results. + */ + void setTree(StatementListPtr tree); + void addClass(AnalysisResultPtr ar, ClassScopePtr classScope); + + void addDeclare(std::string d) { m_declares.push_back(d); } + void addSuppressError(CodeError::ErrorType e) { + m_suppressedErrors.push_back(e); + } + bool isErrorSuppressed(CodeError::ErrorType e); + + /** + * For separate compilation + * These add edges between filescopes in the other dep graph and + * save the symbols for our iface. + * This stuff only happens in the filechanged state. + */ + void addConstant(const std::string &name, TypePtr type, ExpressionPtr value, + AnalysisResultPtr ar, ConstructPtr con); + void declareConstant(AnalysisResultPtr ar, const std::string &name); + void getConstantNames(std::vector &names); + TypePtr getConstantType(const std::string &name); + + void addIncludeDependency(AnalysisResultPtr ar, const std::string &file, + bool byInlined); + void addClassDependency(AnalysisResultPtr ar, + const std::string &classname); + void addFunctionDependency(AnalysisResultPtr ar, + const std::string &funcname, bool byInlined); + void addConstantDependency(AnalysisResultPtr ar, + const std::string &decname); + + /** + * Called only by World + */ + vertex_descriptor vertex() { return m_vertex; } + void setVertex(vertex_descriptor vertex) { + m_vertex = vertex; + } + + void analyzeProgram(AnalysisResultPtr ar); + void inferTypes(AnalysisResultPtr ar); + void preOptimize(AnalysisResultPtr ar); + void postOptimize(AnalysisResultPtr ar); + const std::string &pseudoMainName(); + void outputFileCPP(AnalysisResultPtr ar, CodeGenerator &cg); + bool load(); + + std::string outputFilebase(); + + void addPseudoMainVariable(const std::string &name) { + m_pseudoMainVariables.insert(name); + } + std::set &getPseudoMainVariables() { + return m_pseudoMainVariables; + } + + void outputCPPForwardDeclHeader(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPDeclHeader(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPForwardDeclarations(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPDeclarations(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPClassHeaders(AnalysisResultPtr ar, + CodeGenerator::Output output); + void outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPPseudoMain(CodeGenerator &cg, AnalysisResultPtr ar); + + void outputCPPFFI(CodeGenerator &cg, AnalysisResultPtr ar); + void outputHSFFI(CodeGenerator &cg, AnalysisResultPtr ar); + + void outputJavaFFI(CodeGenerator &cg, AnalysisResultPtr ar); + void outputJavaFFICPPStub(CodeGenerator &cg, AnalysisResultPtr ar); + + void outputSwigFFIStubs(CodeGenerator &cg, AnalysisResultPtr ar); + + std::string addLambda(const std::string &rt, const std::string &args, + const std::string &body) { + lambda l; + l.name = CodeGenerator::GetNewLambda(); + l.rt = rt; + l.args = args; + l.body = body; + m_lambdas.push_back(l); + return l.name; + } + +private: + int m_size; + std::vector m_attributes; + std::string m_fileName; + StatementListPtr m_tree; + StringToClassScopePtrVecMap m_classes; // name => class + ClassScopePtrVec m_ignoredClasses; + + std::vector m_declares; + std::vector m_suppressedErrors; + + vertex_descriptor m_vertex; + + std::set m_usedFuncsInline; + std::set m_usedClasses; + std::set m_usedConsts; + std::set m_usedIncludesInline; + std::string m_pseudoMainName; + std::set m_pseudoMainVariables; + + struct lambda { + std::string rt; + std::string name; + std::string args; + std::string body; + }; + + std::vector m_lambdas; + + void createPseudoMain(AnalysisResultPtr ar); + void outputCPPHelper(CodeGenerator &cg, AnalysisResultPtr ar, + bool classes = true); + + FileScopePtr shared_from_this() { + return boost::static_pointer_cast + (BlockScope::shared_from_this()); + } + +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __FILE_SCOPE_H__ diff --git a/src/lib/analysis/function_container.cpp b/src/lib/analysis/function_container.cpp new file mode 100644 index 0000000000000..f2aa4845f2159 --- /dev/null +++ b/src/lib/analysis/function_container.cpp @@ -0,0 +1,243 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// + +FunctionContainer::FunctionContainer() { +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void FunctionContainer::addFunction(AnalysisResultPtr ar, + FunctionScopePtr funcScope) { + if (ar->declareFunction(funcScope)) { + m_functions[funcScope->getName()].push_back(funcScope); + } else { + m_ignoredFunctions.push_back(funcScope); + funcScope->setIgnored(); + } +} + +void FunctionContainer::countReturnTypes(std::map &counts) { + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + BOOST_FOREACH(FunctionScopePtr f, iter->second) { + TypePtr type = f->getReturnType(); + if (type) { + type->count(counts); + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void FunctionContainer::outputCPPJumpTableDecl(CodeGenerator &cg, + AnalysisResultPtr ar) { + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + if (iter->second[0]->isRedeclaring()) { + BOOST_FOREACH(FunctionScopePtr func, iter->second) { + cg.printf("Variant %s%s(CArrRef params);\n", + Option::InvokePrefix, func->getId().c_str()); + } + } + } +} + +void FunctionContainer::outputCPPJumpTableSupport +(CodeGenerator &cg, AnalysisResultPtr ar, bool &hasRedeclared, + vector *funcs /* = NULL */) { + bool systemcpp = cg.getOutput() == CodeGenerator::SystemCPP; + bool profile = systemcpp; + const char *funcPrefix = Option::FunctionPrefix; + // output invoke support methods + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + if (!iter->second[0]->isRedeclaring()) { + FunctionScopePtr func = iter->second[0]; + if (func->inPseudoMain() || !(systemcpp || func->isDynamic())) continue; + const char *name = iter->first.c_str(); + if (funcs) funcs->push_back(name); + + if (!systemcpp) { + vector &bucket = ar->getFuncTableBucket(func); + if (bucket.size() == 1) { + // no conflict in the function table + cg.indentBegin("Variant %s%s(const char *s, CArrRef params, " + "int64 hash, bool fatal) {\n", + Option::InvokePrefix, name); + cg.indentBegin("HASH_GUARD(0x%016llXLL, %s) {\n", + hash_string_i(name), name); + func->outputCPPDynamicInvoke(cg, ar, funcPrefix, name); + cg.indentEnd("}\n"); + cg.printf("return invoke_builtin(s, params, hash, fatal);\n"); + cg.indentEnd("}\n"); + continue; + } + } + cg.indentBegin("Variant %s%s(CArrRef params) {\n", + Option::InvokePrefix, name); + if (profile) { + cg.printf("FUNCTION_INJECTION(%s);\n", name); + } + func->outputCPPDynamicInvoke(cg, ar, funcPrefix, name); + cg.indentEnd("}\n"); + } else { + hasRedeclared = true; + if (funcs) funcs->push_back(iter->first.c_str()); + BOOST_FOREACH(FunctionScopePtr func, iter->second) { + string prefix = Option::InvokePrefix; + string name = func->getId(); + cg.indentBegin("Variant %s%s(CArrRef params) {\n", + prefix.c_str(), name.c_str()); + func->outputCPPDynamicInvoke(cg, ar, funcPrefix, name.c_str()); + cg.indentEnd("}\n"); + if (func->getRedeclaringId() == 0) { + cg.indentBegin("Variant %s%s(CArrRef params) {\n", + prefix.c_str(), func->getName().c_str()); + cg.printf("DECLARE_GLOBAL_VARIABLES(g);\n"); + cg.printf("return g->%s%s(params);\n", + prefix.c_str(), func->getName().c_str()); + cg.indentEnd("}\n"); + } + } + } + } +} + +void FunctionContainer::outputCPPJumpTableEvalSupport +(CodeGenerator &cg, AnalysisResultPtr ar, bool &hasRedeclared, + vector *funcs /* = NULL */) { + bool systemcpp = cg.getOutput() == CodeGenerator::SystemCPP; + bool profile = systemcpp; + const char *funcPrefix = Option::FunctionPrefix; + // output invoke support methods + for (StringToFunctionScopePtrVecMap::const_iterator iter = + m_functions.begin(); iter != m_functions.end(); ++iter) { + if (!iter->second[0]->isRedeclaring()) { + FunctionScopePtr func = iter->second[0]; + if (func->inPseudoMain() || !(systemcpp || func->isDynamic())) continue; + const char *name = iter->first.c_str(); + if (funcs) funcs->push_back(name); + + cg.indentBegin("Variant %s%s(Eval::VariableEnvironment &env, " + "const Eval::FunctionCallExpression *caller) {\n", + Option::EvalInvokePrefix, name); + func->outputCPPEvalInvoke(cg, ar, funcPrefix, name, profile); + cg.indentEnd("}\n"); + } else { + hasRedeclared = true; + if (funcs) funcs->push_back(iter->first.c_str()); + BOOST_FOREACH(FunctionScopePtr func, iter->second) { + string prefix = Option::EvalInvokePrefix; + string name = func->getId(); + cg.indentBegin("Variant %s%s(CArrRef params) {\n", + Option::EvalInvokePrefix, name.c_str()); + func->outputCPPEvalInvoke(cg, ar, funcPrefix, name.c_str(), profile); + cg.indentEnd("}\n"); + } + } + } +} + +void FunctionContainer::outputCPPJumpTable(CodeGenerator &cg, + AnalysisResultPtr ar) { + string parent = "invoke_failed"; + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + + vector funcs; + bool needGlobals = false; + outputCPPJumpTableSupport(cg, ar, needGlobals, &funcs); + + // output invoke() + cg.indentBegin("Variant invoke%s" + "(const char *s, CArrRef params, int64 hash, bool fatal) {\n", + system ? "_builtin" : ""); + if (needGlobals) cg.printDeclareGlobals(); + + for (JumpTable fit(cg, funcs, true, true, false); fit.ready(); fit.next()) { + const char *name = fit.key(); + StringToFunctionScopePtrVecMap::const_iterator iterFuncs = + m_functions.find(name); + ASSERT(iterFuncs != m_functions.end()); + if (iterFuncs->second[0]->isRedeclaring()) { + cg.printf("HASH_INVOKE_REDECLARED(0x%016llXLL, %s);\n", + hash_string_i(name), name); + } else { + cg.printf("HASH_INVOKE(0x%016llXLL, %s);\n", + hash_string_i(name), name); + } + } + + cg.printf("return %s(s, params, hash, fatal);\n", parent.c_str()); + cg.indentEnd("}\n"); +} + +void FunctionContainer::outputCPPEvalInvokeTable(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool system = cg.getOutput() == CodeGenerator::SystemCPP; + bool generate = Option::EnableEval >= Option::LimitedEval || system; + vector funcs; + bool needGlobals = false; + if (generate) outputCPPJumpTableEvalSupport(cg, ar, needGlobals, &funcs); + // output invoke() + cg.indentBegin("Variant Eval::invoke_from_eval%s" + "(const char *s, Eval::VariableEnvironment &env, " + "const Eval::FunctionCallExpression *caller, int64 hash, " + "bool fatal) {\n", + system ? "_builtin" : ""); + if (generate) { + if (needGlobals) cg.printDeclareGlobals(); + + for (JumpTable fit(cg, funcs, true, true, false); fit.ready(); fit.next()) { + const char *name = fit.key(); + StringToFunctionScopePtrVecMap::const_iterator iterFuncs = + m_functions.find(name); + ASSERT(iterFuncs != m_functions.end()); + if (iterFuncs->second[0]->isRedeclaring()) { + cg.printf("HASH_INVOKE_REDECLARED_FROM_EVAL(0x%016llXLL, %s);\n", + hash_string_i(name), name); + } else { + cg.printf("HASH_INVOKE_FROM_EVAL(0x%016llXLL, %s);\n", + hash_string_i(name), name); + } + } + } + if (system) { + cg.printf("return invoke_failed(s, Array(), -1, fatal);\n"); + } else { + cg.printf("return invoke_from_eval_builtin(s, env, caller, hash, " + "fatal);\n"); + } + cg.indentEnd("}\n"); +} diff --git a/src/lib/analysis/function_container.h b/src/lib/analysis/function_container.h new file mode 100644 index 0000000000000..4d057a87e3fe2 --- /dev/null +++ b/src/lib/analysis/function_container.h @@ -0,0 +1,77 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __FUNCTION_CONTAINER_H__ +#define __FUNCTION_CONTAINER_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class CodeGenerator; +DECLARE_BOOST_TYPES(AnalysisResult); +DECLARE_BOOST_TYPES(FunctionScope); +DECLARE_BOOST_TYPES(ClassScope); +DECLARE_BOOST_TYPES(FunctionContainer); + +/** + * Base class of both FileScope and ClassScope that can contain functions. + */ +class FunctionContainer { +public: + FunctionContainer(); + virtual ~FunctionContainer() {} + + /** + * Functions this container has. + */ + virtual int getFunctionCount() const { return m_functions.size();} + virtual void countReturnTypes(std::map &counts); + + /** + * Called by parser to add a new function. + */ + virtual void addFunction(AnalysisResultPtr ar, FunctionScopePtr funcScope); + + /** + * Code generation functions. + */ + void outputCPPJumpTableDecl(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPJumpTable(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPEvalInvokeTable(CodeGenerator &cg, AnalysisResultPtr ar); + const StringToFunctionScopePtrVecMap &getFunctions() const { + return m_functions; + } + +protected: + // name => functions. Order of declaration + StringToFunctionScopePtrVecMap m_functions; + StringToFunctionScopePtrVecMap m_helperFunctions; + FunctionScopePtrVec m_ignoredFunctions; + void outputCPPJumpTableSupport(CodeGenerator &cg, AnalysisResultPtr ar, + bool &hasRedeclared, + std::vector *funcs = NULL); + void outputCPPJumpTableEvalSupport(CodeGenerator &cg, AnalysisResultPtr ar, + bool &hasRedeclared, + std::vector *funcs = NULL); + +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __FUNCTION_CONTAINER_H__ diff --git a/src/lib/analysis/function_scope.cpp b/src/lib/analysis/function_scope.cpp new file mode 100644 index 0000000000000..94698afb08d6a --- /dev/null +++ b/src/lib/analysis/function_scope.cpp @@ -0,0 +1,930 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// + +FunctionScope::FunctionScope(AnalysisResultPtr ar, bool method, + const std::string &name, StatementPtr stmt, + bool reference, int minParam, int maxParam, + ModifierExpressionPtr modifiers, + int attribute, FileScopePtr file, + bool inPseudoMain /* = false */) + : BlockScope(name, stmt, BlockScope::FunctionScope), + m_method(method), m_file(file), m_minParam(0), m_maxParam(0), + m_attribute(attribute), m_refReturn(reference), m_modifiers(modifiers), + m_virtual(false), m_overriding(false), m_redeclaring(-1), + m_volatile(false), m_ignored(false), m_pseudoMain(inPseudoMain), + m_magicMethod(false), m_system(false), m_inlineable(false), + m_containsThis(false), m_callTempCountMax(0), m_callTempCountCurrent(0) { + bool canInline = true; + if (inPseudoMain) { + canInline = false; + m_variables->forceVariants(ar); + setReturnType(ar, Type::Variant); + } + setParamCounts(minParam, maxParam); + + if (m_refReturn) { + m_returnType = Type::Variant; + } + + // FileScope's flags are from parser, but VariableTable has more flags + // coming from type inference phase. So we are tranferring these two + // flags just for better modularization between FileScope and VariableTable. + if (m_attribute & FileScope::ContainsDynamicVariable) { + m_variables->setAttribute(VariableTable::ContainsDynamicVariable); + } + if (m_attribute & FileScope::ContainsLDynamicVariable) { + m_variables->setAttribute(VariableTable::ContainsLDynamicVariable); + } + if (m_attribute & FileScope::ContainsExtract) { + m_variables->setAttribute(VariableTable::ContainsExtract); + } + if (m_attribute & FileScope::ContainsCompact) { + m_variables->setAttribute(VariableTable::ContainsCompact); + } + if (m_attribute & FileScope::ContainsUnset) { + m_variables->setAttribute(VariableTable::ContainsUnset); + } + + m_dynamic = Option::isDynamicFunction(method, m_name) || + Option::EnableEval == Option::FullEval; + if (modifiers) { + m_virtual = modifiers->isAbstract(); + } + + if (m_stmt) { + MethodStatementPtr stmt = dynamic_pointer_cast(m_stmt); + StatementListPtr stmts = stmt->getStmts(); + if (stmts) { + if (stmts->getRecursiveCount() > Option::InlineFunctionThreshold) + canInline = false; + for (int i = 0; i < stmts->getCount(); i++) { + StatementPtr stmt = (*stmts)[i]; + stmt->setFileLevel(); + if (stmt->is(Statement::KindOfExpStatement)) { + ExpStatementPtr expStmt = dynamic_pointer_cast(stmt); + ExpressionPtr exp = expStmt->getExpression(); + exp->setTopLevel(); + } + } + } + } else { + canInline = false; + } + m_inlineable = canInline; +} + +FunctionScope::FunctionScope(bool method, const std::string &name, + bool reference) + : BlockScope(name, StatementPtr(), BlockScope::FunctionScope), + m_method(method), m_minParam(0), m_maxParam(0), + m_attribute(0), m_refReturn(reference), + m_modifiers(ModifierExpressionPtr()), + m_virtual(false), m_overriding(false), m_redeclaring(-1), + m_volatile(false), m_ignored(false), + m_pseudoMain(false), m_magicMethod(false), m_system(true), + m_inlineable(false), m_callTempCountMax(0), m_callTempCountCurrent(0) { + m_dynamic = Option::isDynamicFunction(method, m_name); +} + +void FunctionScope::setParamCounts(int minParam, int maxParam) { + m_minParam = minParam; + m_maxParam = maxParam; + ASSERT(m_minParam >= 0 && m_maxParam >= m_minParam); + if (m_maxParam > 0) { + m_paramNames.resize(m_maxParam); + m_paramTypes.resize(m_maxParam); + m_refs.resize(m_maxParam); + + if (m_stmt) { + MethodStatementPtr stmt = dynamic_pointer_cast(m_stmt); + ExpressionListPtr params = stmt->getParams(); + + for (int i = 0; i < m_maxParam; i++) { + if (stmt->isRef(i)) m_refs[i] = true; + + ParameterExpressionPtr param = + dynamic_pointer_cast((*params)[i]); + m_paramNames[i] = param->getName(); + } + } + } +} + +bool FunctionScope::isPublic() const { + return m_modifiers && m_modifiers->isPublic(); +} + +bool FunctionScope::isProtected() const { + return m_modifiers && m_modifiers->isProtected(); +} + +bool FunctionScope::isPrivate() const { + return m_modifiers && m_modifiers->isPrivate(); +} + +bool FunctionScope::isStatic() const { + return m_modifiers && m_modifiers->isStatic(); +} + +bool FunctionScope::isAbstract() const { + return m_modifiers && m_modifiers->isAbstract(); +} + +bool FunctionScope::isFinal() const { + return m_modifiers && m_modifiers->isFinal(); +} + +bool FunctionScope::isVariableArgument() const { + return m_attribute & FileScope::VariableArgument; +} + +bool FunctionScope::isReferenceVariableArgument() const { + return m_attribute & FileScope::ReferenceVariableArgument; +} + +void FunctionScope::setVariableArgument(bool reference) { + m_attribute |= FileScope::VariableArgument; + if (reference) { + m_attribute |= FileScope::ReferenceVariableArgument; + } +} + +bool FunctionScope::hasEffect() const { + return (m_attribute & FileScope::NoEffect) == 0; +} + +void FunctionScope::setNoEffect() { + m_attribute |= FileScope::NoEffect; +} + +bool FunctionScope::isHelperFunction() const { + return m_attribute & FileScope::HelperFunction; +} + +void FunctionScope::setHelperFunction() { + m_attribute |= FileScope::HelperFunction; +} + +bool FunctionScope::containsReference() const { + return m_attribute & FileScope::ContainsReference; +} + +bool FunctionScope::hasImpl() const { + if (!isUserFunction()) { + return !isAbstract(); + } + if (m_stmt) { + MethodStatementPtr stmt = dynamic_pointer_cast(m_stmt); + return stmt->getStmts(); + } + return false; +} + +bool FunctionScope::isConstructor(ClassScopePtr cls) const { + return m_stmt && cls + && (getName() == "__construct" + || cls->classNameCtor() && getName() == cls->getName()); +} + +std::string FunctionScope::getOriginalName() const { + if (m_pseudoMain) return ""; + if (m_stmt) { + MethodStatementPtr stmt = dynamic_pointer_cast(m_stmt); + return stmt->getOriginalName(); + } + return m_name; +} + +std::string FunctionScope::getFullName() const { + if (m_stmt) { + MethodStatementPtr stmt = dynamic_pointer_cast(m_stmt); + return stmt->getFullName(); + } + return m_name; +} + +/////////////////////////////////////////////////////////////////////////////// + + +int FunctionScope::inferParamTypes(AnalysisResultPtr ar, ConstructPtr exp, + ExpressionListPtr params, bool &valid) { + valid = true; + + if (!params) { + if (m_minParam > 0) { + if (ar->isFirstPass()) { + ar->getCodeError()->record(CodeError::TooFewArgument, exp, m_stmt); + } + valid = false; + } + return 0; + } + + int ret = 0; + if (params->getCount() < m_minParam) { + if (ar->isFirstPass()) { + ar->getCodeError()->record(CodeError::TooFewArgument, exp, m_stmt); + } + valid = false; + } + if (params->getCount() > m_maxParam) { + if (isVariableArgument()) { + ret = params->getCount() - m_maxParam; + } else { + if (ar->isFirstPass()) { + ar->getCodeError()->record(CodeError::TooManyArgument, exp, m_stmt); + } + params->setOutputCount(m_maxParam); + } + } + + bool canSetParamType = isUserFunction() && !m_overriding; + for (int i = 0; i < params->getCount(); i++) { + ExpressionPtr param = (*params)[i]; + param->clearContext(Expression::InvokeArgument); + TypePtr expType; + if (!canSetParamType && i < m_maxParam) { + expType = param->inferAndCheck(ar, getParamType(i), false); + } else { + expType = param->inferAndCheck(ar, NEW_TYPE(Some), false); + } + if ((i < m_maxParam && isRefParam(i)) || + (i >= m_maxParam && isReferenceVariableArgument())) { + param->setContext(Expression::LValue); + param->setContext(Expression::RefValue); + param->inferAndCheck(ar, Type::Variant, true); + } else if (!(param->getContext() & Expression::RefParameter)) { + param->clearContext(Expression::LValue); + param->clearContext(Expression::RefValue); + } + if (i < m_maxParam) { + TypePtr paramType = getParamType(i); + if (canSetParamType) { + paramType = setParamType(ar, i, expType); + } + if (!Type::IsLegalCast(ar, expType, paramType) && + paramType->isNonConvertibleType()) { + param->inferAndCheck(ar, paramType, true); + } + param->setExpectedType(paramType); + } + } + return ret; +} + +TypePtr FunctionScope::setParamType(AnalysisResultPtr ar, int index, + TypePtr type) { + ASSERT(index >= 0 && index < (int)m_paramTypes.size()); + TypePtr paramType = m_paramTypes[index]; + if (!paramType) paramType = NEW_TYPE(Some); + type = Type::Coerce(ar, paramType, type); + if (type && !Type::SameType(paramType, type)) { + ar->incNewlyInferred(); + if (!ar->isFirstPass()) { + Logger::Verbose("Corrected paramter type %s -> %s", + paramType->toString().c_str(), type->toString().c_str()); + } + } + m_paramTypes[index] = type; + return type; +} + +TypePtr FunctionScope::getParamType(int index) { + ASSERT(index >= 0 && index < (int)m_paramTypes.size()); + TypePtr paramType = m_paramTypes[index]; + if (!paramType) { + paramType = NEW_TYPE(Some); + m_paramTypes[index] = paramType; + } + return paramType; +} + +bool FunctionScope::isRefParam(int index) const { + ASSERT(index >= 0 && index < (int)m_refs.size()); + return m_refs[index]; +} + +void FunctionScope::setRefParam(int index) { + ASSERT(index >= 0 && index < (int)m_refs.size()); + m_refs[index] = true; +} + +const std::string &FunctionScope::getParamName(int index) const { + ASSERT(index >= 0 && index < (int)m_paramNames.size()); + return m_paramNames[index]; +} + +void FunctionScope::setParamName(int index, const std::string &name) { + ASSERT(index >= 0 && index < (int)m_paramNames.size()); + m_paramNames[index] = name; +} + +void FunctionScope::addModifier(int mod) { + if (!m_modifiers) { + m_modifiers = + ModifierExpressionPtr(new ModifierExpression(LocationPtr(), + Expression::KindOfModifierExpression)); + } + m_modifiers->add(mod); +} + +void FunctionScope::setStatic() { + if (!isStatic()) { + addModifier(T_STATIC); + } +} + +void FunctionScope::setReturnType(AnalysisResultPtr ar, TypePtr type) { + // no change can be made to virtual function's prototype + if (m_overriding) return; + + if (m_returnType) { + type = Type::Coerce(ar, m_returnType, type); + if (type && !Type::SameType(m_returnType, type)) { + ar->incNewlyInferred(); + if (!ar->isFirstPass()) { + Logger::Verbose("Corrected function return type %s -> %s", + m_returnType->toString().c_str(), + type->toString().c_str()); + } + } + } + if (!type->getName().empty()) { + FileScopePtr fs = getFileScope(); + if (fs) fs->addClassDependency(ar, type->getName()); + } + m_returnType = type; +} + +void FunctionScope::setOverriding(TypePtr returnType, + TypePtr param1 /* = TypePtr() */, + TypePtr param2 /* = TypePtr() */) { + m_returnType = returnType; + m_overriding = true; + + if (param1 && m_paramTypes.size() >= 1) m_paramTypes[0] = param1; + if (param2 && m_paramTypes.size() >= 2) m_paramTypes[1] = param2; + + // TODO: remove this block and replace with stronger typing + // Right now, we have to avoid a situation where a parameter is assigned + // with different values, making them a Variant. + for (unsigned int i = 0; i < m_paramTypes.size(); i++) { + m_paramTypes[i] = Type::Variant; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void FunctionScope::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (Option::GenerateInferredTypes && m_returnType) { + cg.printf("// @return %s\n", m_returnType->toString().c_str()); + } + + BlockScope::outputPHP(cg, ar); +} + +void FunctionScope::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + for (int i = 0; i < m_callTempCountMax; i++) { + cg.printf("Variant %s%d;\n", Option::EvalOrderTempPrefix, i); + } + BlockScope::outputCPP(cg, ar); +} + +void FunctionScope::outputCPPParamsDecl(CodeGenerator &cg, + AnalysisResultPtr ar, + ExpressionListPtr params, + bool showDefault) { + if (isVariableArgument()) { + cg.printf("int num_args, "); + if (params) { + params->outputCPP(cg, ar); + cg.printf(", "); + } + if (showDefault) { + cg.printf("Array args = Array()"); + } else { + cg.printf("Array args /* = Array() */"); + } + } else if (m_pseudoMain) { + if (showDefault) { + cg.printf("bool incOnce = false, LVariableTable* variables = NULL"); + } else { + cg.printf("bool incOnce /* = false */, " + "LVariableTable* variables /* = NULL */"); + } + } else if (params) { + params->outputCPP(cg, ar); + } +} + + +void FunctionScope::outputCPPParamsImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + int paramcount = getMaxParamCount(); + if (isUserFunction()) { + outputCPPParamsDecl(cg, ar, dynamic_pointer_cast(getStmt()) + ->getParams(), false); + return; + } + bool first = true; + if (isVariableArgument()) { + cg.printf("int num_args"); + first = false; + } + + for (int i = 0; i < paramcount; i++) { + if (first) { + first = false; + } else { + cg.printf(", "); + } + TypePtr type = getParamType(i); + type->outputCPPDecl(cg, ar); + cg.printf(" a%d", i); + } + + if (isVariableArgument()) { + cg.printf(", Array args /* = Array() */"); + } +} + +void FunctionScope::outputCPPParamsCall(CodeGenerator &cg, + AnalysisResultPtr ar, + bool aggregateParams) { + if (isVariableArgument()) { + cg.printf("num_args, "); + } + bool userFunc = isUserFunction(); + ExpressionListPtr params; + if (userFunc) { + MethodStatementPtr stmt = dynamic_pointer_cast(m_stmt); + params = stmt->getParams(); + } + if (aggregateParams) { + cg.printf("Array("); + if (m_maxParam) cg.printf("ArrayInit(%d).", m_maxParam); + } + for (int i = 0; i < m_maxParam; i++) { + if (i > 0) cg.printf(aggregateParams ? "." : ", "); + if (aggregateParams) { + cg.printf("set(%d, ", i); + } + bool isRef; + if (userFunc) { + ParameterExpressionPtr param = + dynamic_pointer_cast((*params)[i]); + isRef = param->isRef(); + cg.printf(aggregateParams ? "ArrayElement(%sv_%s%s)" : "%sv_%s%s", + isRef ? "ref(" : "", param->getName().c_str(), + isRef ? ")" : ""); + } else { + isRef = isRefParam(i); + cg.printf(aggregateParams ? "ArrayElement(%sa%d%s)" : "%sa%d%s", + isRef ? "ref(" : "", i, isRef ? ")" : ""); + } + if (aggregateParams) cg.printf(")"); + } + if (aggregateParams) { + if (m_maxParam) cg.printf(".create()"); + cg.printf(")"); + } + if (isVariableArgument()) { + if (aggregateParams || m_maxParam > 0) cg.printf(","); + cg.printf("args"); + } +} + +void FunctionScope::outputCPPArguments(ExpressionListPtr params, + CodeGenerator &cg, + AnalysisResultPtr ar, int extraArg, + bool variableArgument) { + int paramCount = params ? params->getOutputCount() : 0; + ASSERT(extraArg <= paramCount); + int iMax = paramCount - extraArg; + bool extra = false; + + if (variableArgument) { + if (paramCount == 0) { + cg.printf("0"); + } else { + cg.printf("%d, ", paramCount); + } + } + bool hasEffect = params && params->controllingOrder(); + int tempOffset = params ? params->tempOffset() : 0; + int firstExtra = 0; + for (int i = 0; i < paramCount; i++) { + ExpressionPtr param = (*params)[i]; + cg.setItemIndex(i); + if (i > 0) cg.printf(extra ? "." : ", "); + if (!extra && (i == iMax || extraArg < 0)) { + extra = true; + cg.printf("Array(ArrayInit(%d).", paramCount - i); + firstExtra = i; + } + if (extra) { + cg.printf("set(%d, ArrayElement(", i - firstExtra); + if (hasEffect && !param->isScalar()) { + cg.printf("%s%d", Option::EvalOrderTempPrefix, tempOffset + i); + } else { + param->outputCPP(cg, ar); + } + cg.printf("))"); + } else { + if (hasEffect && !param->isScalar()) { + cg.printf("%s%d", Option::EvalOrderTempPrefix, tempOffset + i); + } else { + param->outputCPP(cg, ar); + } + } + } + if (extra) { + cg.printf(".create())"); + } +} + +void FunctionScope::outputCPPEffectiveArguments(ExpressionListPtr params, + CodeGenerator &cg, + AnalysisResultPtr ar) { + int paramCount = params ? params->getCount() : 0; + for (int i = 0; i < paramCount; i++) { + ExpressionPtr param = (*params)[i]; + if (param->hasEffect()) { + param->outputCPP(cg, ar); + cg.printf(", "); + } + } +} + +void FunctionScope::outputCPPDynamicInvoke(CodeGenerator &cg, + AnalysisResultPtr ar, + const char *funcPrefix, + const char *name, + bool voidWrapperOff /* = false */, + bool fewArgs /* = false */, + bool ret /* = true */, + const char *extraArg /* = NULL */) { + const char *voidWrapper = (m_returnType || voidWrapperOff) ? "" : ", null"; + const char *retrn = ret ? "return " : ""; + int maxParam = fewArgs ? (m_maxParam > Option::InvokeFewArgsCount ? + Option::InvokeFewArgsCount : m_maxParam) + : m_maxParam; + bool variable = isVariableArgument(); + if (variable || getOptionalParamCount()) { + if (!fewArgs) { + cg.printf("int count = params.size();\n"); + } + cg.printf("if (count <= %d) ", m_minParam); + } + + stringstream callss; + callss << retrn << (m_refReturn ? "ref(" : "(") << funcPrefix << name << "("; + if (extraArg) { + callss << extraArg; + if (variable) { + callss << ","; + } + } + if (variable) { + callss << "count"; + } + bool preArgs = variable || extraArg; + string call = callss.str(); + + cg.printf("%s", call.c_str()); + for (int i = 0; i < m_minParam; i++) { + if (preArgs || i > 0) cg.printf(", "); + if (isRefParam(i)) { + if (fewArgs) { + cg.printf("ref(a%d)", i); + } else { + cg.printf("ref(const_cast(params).lvalAt(%d))", i); + } + } else { + if (fewArgs) { + cg.printf("a%d", i); + } else { + cg.printf("params.rvalAt(%d)", i); + } + } + } + cg.printf(")%s);\n", voidWrapper); + + for (int iMax = m_minParam + 1; iMax <= maxParam; iMax++) { + if (iMax < maxParam || variable) { + cg.printf("if (count == %d) ", iMax); + } + cg.printf("%s", call.c_str()); + for (int i = 0; i < iMax; i++) { + if (preArgs || i > 0) cg.printf(", "); + if (isRefParam(i)) { + if (fewArgs) { + cg.printf("ref(a%d)", i); + } else { + cg.printf("ref(const_cast(params).lvalAt(%d))", i); + } + } else { + if (fewArgs) { + cg.printf("a%d", i); + } else { + cg.printf("params.rvalAt(%d)", i); + } + } + } + cg.printf(")%s);\n", voidWrapper); + } + + if (variable) { + if (fewArgs) { + if (maxParam == Option::InvokeFewArgsCount) return; + cg.printf("Array params;\n"); + for (int i = maxParam; i < Option::InvokeFewArgsCount; i++) { + cg.printf( + "if (count >= %d) params.append(a%d);\n", i + 1, i); + } + } + cg.printf("%s,", call.c_str()); + for (int i = 0; i < maxParam; i++) { + if (isRefParam(i)) { + if (fewArgs) { + cg.printf("ref(a%d), ", i); + } else { + cg.printf("ref(const_cast(params).lvalAt(%d)), ", i); + } + } else { + if (fewArgs) { + cg.printf("a%d, ", i); + } else { + cg.printf("params.rvalAt(%d), ", i); + } + } + } + if (fewArgs) { + cg.printf("params)%s);\n", voidWrapper); + } + else { + cg.printf("params.slice(%d, count - %d, false))%s);\n", + maxParam, maxParam, voidWrapper); + } + } +} + +void FunctionScope::outputCPPEvalInvoke(CodeGenerator &cg, + AnalysisResultPtr ar, + const char *funcPrefix, + const char *name, + bool profile, + const char *extraArg /* = NULL */) { + const char *voidWrapper = m_returnType ? "" : ", null"; + const char *retrn = "return "; + int maxParam = m_maxParam; + bool variable = isVariableArgument(); + + stringstream callss; + callss << retrn << (m_refReturn ? "ref(" : "(") << funcPrefix << name << "("; + if (extraArg) { + callss << extraArg; + if (variable) { + callss << ","; + } + } + if (variable) { + callss << "count"; + } + bool preArgs = variable || extraArg; + // Build temps + for (int i = 0; i < m_maxParam; i++) { + cg.printf("Variant a%d;\n", i); + } + cg.printf("const std::vector ¶ms = " + "caller->params();\n"); + cg.printf("std::vector::const_iterator it = " + "params.begin();\n"); + cg.indentBegin("do {\n"); + for (int i = 0; i < m_maxParam; i++) { + cg.printf("if (it == params.end()) break;\n"); + if (i < m_minParam && (preArgs || i > 0)) { + callss << ", "; + } + if (isRefParam(i)) { + if (i < m_minParam) callss << "ref(a" << i << ")"; + cg.printf("a%d = ref((*it)->refval(env));\n", i); + } else { + if (i < m_minParam) callss << "a" << i; + cg.printf("a%d = (*it)->eval(env);\n", i); + } + cg.printf("it++;\n"); + } + cg.indentEnd("} while(false);\n"); + // Put extra args into vargs or just eval them + if (variable) { + cg.printf("Array vargs;\n"); + } + cg.indentBegin("for (; it != params.end(); ++it) {\n"); + const char *paramEval = "(*it)->eval(env)"; + if (isReferenceVariableArgument()) { + paramEval = "ref((*it)->refval(env))"; + } + if (variable) cg.printf("vargs.append("); + cg.printf(paramEval); + if (variable) cg.printf(")"); + cg.printf(";\n"); + cg.indentEnd("}\n"); + + if (profile) { + cg.printf("FUNCTION_INJECTION(%s);\n", name); + } + + if (variable || getOptionalParamCount()) { + cg.printf("int count = params.size();\n"); + cg.printf("if (count <= %d) ", m_minParam); + } + + // No optional args + string call = callss.str(); + cg.printf("%s", call.c_str()); + cg.printf(")%s);\n", voidWrapper); + + // Optional args + for (int iMax = m_minParam + 1; iMax <= maxParam; iMax++) { + if (iMax < maxParam || variable) { + cg.printf("if (count == %d) ", iMax); + } + cg.printf("%s", call.c_str()); + for (int i = m_minParam; i < iMax; i++) { + if (i > 0 || preArgs) cg.printf(", "); + if (isRefParam(i)) { + cg.printf("ref(a%d)", i); + } else { + cg.printf("a%d", i); + } + } + cg.printf(")%s);\n", voidWrapper); + } + + // Var args + if (variable) { + cg.printf("%s,", call.c_str()); + for (int i = m_minParam; i < maxParam; i++) { + if (isRefParam(i)) { + cg.printf("ref(a%d), ", i); + } else { + cg.printf("a%d, ", i); + } + } + cg.printf("vargs)%s);\n", voidWrapper); + } +} + +void FunctionScope::serialize(JSON::OutputStream &out) const { + JSON::MapStream ms(out); + int vis = 0; + if (isPublic()) vis = ClassScope::Public; + else if (isProtected()) vis = ClassScope::Protected; + else if (isPrivate()) vis = ClassScope::Protected; + + int mod = 0; + if (isAbstract()) mod = ClassScope::Abstract; + else if (isFinal()) mod = ClassScope::Final; + + if (!m_returnType) { + ms.add("retTp", -1); + } else if (m_returnType->isSpecificObject()) { + ms.add("retTp", m_returnType->getName()); + } else { + ms.add("retTp", m_returnType->getKindOf()); + } + ms.add("minArgs", m_minParam) + .add("maxArgs", m_maxParam) + .add("varArgs", isVariableArgument()) + .add("static", isStatic()) + .add("modifier", mod) + .add("visibility", vis) + .add("argIsRef", m_refs) + .done(); +} + + + +void FunctionScope::outputCPPCreateDecl(CodeGenerator &cg, + AnalysisResultPtr ar) { + ClassScopePtr scope = ar->getClassScope(); + + cg.printf("public: ObjectData *create("); + outputCPPParamsDecl(cg, ar, + dynamic_pointer_cast(getStmt()) + ->getParams(), true); + cg.printf(");\n"); + cg.printf("public: ObjectData *dynCreate(CArrRef params, bool init = true);\n"); + if (isDynamic()) + cg.printf("public: void dynConstruct(CArrRef params);\n"); +} + +void FunctionScope::outputCPPCreateImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + ClassScopePtr scope = ar->getClassScope(); + string clsNameStr = scope->getId(); + const char *clsName = clsNameStr.c_str(); + const char *consName = scope->classNameCtor() ? scope->getName().c_str() + : "__construct"; + + cg.printf("ObjectData *%s%s::create(", + Option::ClassPrefix, clsName); + outputCPPParamsImpl(cg, ar); + cg.indentBegin(") {\n"); + cg.printf("init();\n"); + cg.printf("%s%s(", Option::MethodPrefix, consName); + outputCPPParamsCall(cg, ar, false); + cg.printf(");\n"); + cg.printf("return this;\n"); + cg.indentEnd("}\n"); + cg.indentBegin("ObjectData *%s%s::dynCreate(CArrRef params, " + "bool init /* = true */) {\n", + Option::ClassPrefix, clsName); + cg.indentBegin("if (init) {\n"); + outputCPPDynamicInvoke(cg, ar, "","create", + true); + cg.indentEnd("} else return this;\n"); + cg.indentEnd("}\n"); + if (isDynamic()) { + cg.indentBegin("void %s%s::dynConstruct(CArrRef params) {\n", + Option::ClassPrefix, clsName); + outputCPPDynamicInvoke(cg, ar, Option::MethodPrefix, + consName, true, false, false); + cg.indentEnd("}\n"); + } +} + +void FunctionScope::outputCPPClassMap(CodeGenerator &cg, AnalysisResultPtr ar){ + int attribute = ClassInfo::IsNothing; + if (!isUserFunction()) attribute |= ClassInfo::IsSystem; + if (isRedeclaring()) attribute |= ClassInfo::IsRedeclared; + if (isVolatile()) attribute |= ClassInfo::IsVolatile; + if (isRefReturn()) attribute |= ClassInfo::IsReference; + + if (isProtected()) { + attribute |= ClassInfo::IsProtected; + } else if (isPrivate()) { + attribute |= ClassInfo::IsPrivate; + } else { + attribute |= ClassInfo::IsPublic; + } + if (isAbstract()) attribute |= ClassInfo::IsAbstract; + if (isStatic()) attribute |= ClassInfo::IsStatic; + if (isFinal()) attribute |= ClassInfo::IsFinal; + + cg.printf("(const char *)0x%04X, \"%s\", NULL, NULL,\n", attribute, + m_name.c_str()); + + for (int i = 0; i < m_maxParam; i++) { + int attr = ClassInfo::IsNothing; + if (i >= m_minParam) attr |= ClassInfo::IsOptional; + if (isRefParam(i)) attr |= ClassInfo::IsReference; + + cg.printf("(const char *)0x%04X, \"%s\", \"%s\", \"%s\",\n", + attr, m_paramNames[i].c_str(), + Util::toLower(m_paramTypes[i]->getPHPName()).c_str(), + (i >= m_minParam ? "1" : "")); + + } + cg.printf("NULL,\n"); + + m_variables->outputCPPStaticVariables(cg, ar); +} diff --git a/src/lib/analysis/function_scope.h b/src/lib/analysis/function_scope.h new file mode 100644 index 0000000000000..6c0666db0ddf5 --- /dev/null +++ b/src/lib/analysis/function_scope.h @@ -0,0 +1,341 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __FUNCTION_SCOPE_H__ +#define __FUNCTION_SCOPE_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(Type); +DECLARE_BOOST_TYPES(Construct); +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(FileScope); +DECLARE_BOOST_TYPES(AnalysisResult); +DECLARE_BOOST_TYPES(FunctionScope); + +/** + * A FunctionScope corresponds to a function declaration. We store all + * inferred types and analyzed results here, so not to pollute syntax trees. + */ +class FunctionScope : public BlockScope, + public JSON::ISerializable { +public: + /** + * User defined functions. + */ + FunctionScope(AnalysisResultPtr ar, bool method, + const std::string &name, StatementPtr stmt, + bool reference, int minParam, int maxParam, + ModifierExpressionPtr modifiers, int attribute, + FileScopePtr file, + bool inPseudoMain = false); + + /** + * System functions. + */ + FunctionScope(bool method, const std::string &name, bool reference); + void setParamCounts(int minParam, int maxParam); + void setParamName(int index, const std::string &name); + void setRefParam(int index); + void addModifier(int mod); + + /** + * What kind of function this is. + */ + bool isUserFunction() const { return !m_system;} + bool isDynamic() const { return m_dynamic; } + bool isPublic() const; + bool isProtected() const; + bool isPrivate() const; + bool isStatic() const; + bool isAbstract() const; + bool isFinal() const; + bool isRefParam(int index) const; + bool isRefReturn() const { return m_refReturn;} + bool hasImpl() const; + + /** + * Either __construct or a class-name constructor. + */ + bool isConstructor(ClassScopePtr cls) const; + + const std::string &getParamName(int index) const; + + const std::string &name() const { + return getName(); + } + + std::string getId() const { + if (m_redeclaring < 0) { + return getName(); + } + return getName() + Option::IdPrefix + + boost::lexical_cast(m_redeclaring); + } + + int getRedeclaringId() const { + return m_redeclaring; + } + + void setDynamic() { + m_dynamic = true; + } + + void setSystem() { + m_system = true; + } + + void setStatic(); + + /** + * Get original name of the function, without case being lowered. + */ + std::string getOriginalName() const; + + /** + * If class method, returns class::name, otherwise just name. + */ + std::string getFullName() const; + + /** + * Whether this function can take variable number of arguments. + */ + bool isVariableArgument() const; + bool isReferenceVariableArgument() const; + void setVariableArgument(bool reference); + + /** + * Whether this function has no side effects + */ + bool hasEffect() const; + void setNoEffect(); + + /** + * Whether this function is a runtime helper function + */ + bool isHelperFunction() const; + void setHelperFunction(); + + /** + * Whether this function returns reference or has reference parameters. + */ + bool containsReference() const; + + /** + * Whether this function contains a usage of $this + */ + bool containsThis() const { return m_containsThis;} + void setContainsThis() { m_containsThis = true;} + + /** + * How many parameters a caller should provide. + */ + int getMinParamCount() const { return m_minParam;} + int getMaxParamCount() const { return m_maxParam;} + int getOptionalParamCount() const { return m_maxParam - m_minParam;} + + /** + * What is the inferred type of this function's return. + */ + void setReturnType(AnalysisResultPtr ar, TypePtr type); + TypePtr getReturnType() const { return m_returnType;} + + /** + * Whether this is a virtual function. + */ + void setVirtual() { m_virtual = true;} + bool isVirtual() const { return m_virtual;} + void setOverriding(TypePtr returnType, TypePtr param1 = TypePtr(), + TypePtr param2 = TypePtr()); + bool isOverriding() const { return m_overriding;} + + /** + * Whether same function name was declared twice or more. + */ + void setRedeclaring(int redecId) { + m_redeclaring = redecId; + setVolatile(); // redeclared function is also volatile + } + bool isRedeclaring() const { return m_redeclaring >= 0;} + + /* For function_exists */ + void setVolatile() { m_volatile = true;} + bool isVolatile() const { return m_volatile;} + + bool isInlined() const { return m_inlineable; } + void disableInline() { m_inlineable = false; } + + /** + * What is the inferred type of this function's parameter at specified + * index. Returns number of extra arguments to put into ArgumentArray. + */ + int inferParamTypes(AnalysisResultPtr ar, ConstructPtr exp, + ExpressionListPtr params, bool &valid); + TypePtr setParamType(AnalysisResultPtr ar, int index, TypePtr type); + TypePtr getParamType(int index); + + int requireCallTemps(int count) { + int ret = m_callTempCountCurrent; + m_callTempCountCurrent += count; + if (m_callTempCountMax < m_callTempCountCurrent) { + m_callTempCountMax = m_callTempCountCurrent; + } + return ret; + } + void endRequireCallTemps(int old) { + m_callTempCountCurrent = old; + } + + /** + * Override BlockScope::outputPHP() to generate return type. + */ + virtual void outputPHP(CodeGenerator &cg, AnalysisResultPtr ar); + + /** + * Override to preface with call temps. + */ + virtual void outputCPP(CodeGenerator &cg, AnalysisResultPtr ar); + /** + * Generate parameter declaration. + */ + void outputCPPParamsDecl(CodeGenerator &cg, AnalysisResultPtr ar, + ExpressionListPtr params, bool showDefault); + /** + * This one is a special version that doesn't require a params expression. + * It's for use with extension functions. It only works for the + * implementation since it ignores optional arguments. + */ + void outputCPPParamsImpl(CodeGenerator &cg, AnalysisResultPtr ar); + /** + * If inside this function, we have to make a call to an implementation + * function that has the same signature, how does the parameter list + * look like? + */ + void outputCPPParamsCall(CodeGenerator &cg, AnalysisResultPtr ar, + bool aggregateParams); + + /** + * How does a caller prepare parameters. + */ + static void outputCPPArguments(ExpressionListPtr params, + CodeGenerator &cg, AnalysisResultPtr ar, + int extraArg, bool variableArgument); + + /** + * Only generate arguments that have effects. This is for keeping those + * parameters around when generating a error-raising function call, so to + * avoid "unused" variable compiler warnings. + */ + static void outputCPPEffectiveArguments(ExpressionListPtr params, + CodeGenerator &cg, + AnalysisResultPtr ar); + + /** + * Generate invoke proxy. + */ + void outputCPPDynamicInvoke(CodeGenerator &cg, AnalysisResultPtr ar, + const char *funcPrefix, + const char *name, + bool voidWrapperOff = false, + bool fewArgs = false, + bool ret = true, + const char *extraArg = NULL); + void outputCPPEvalInvoke(CodeGenerator &cg, AnalysisResultPtr ar, + const char *funcPrefix, const char *name, + bool profile, const char *extraArg = NULL); + + /** + * ...so ClassStatement can call them for classes that don't have + * constructors defined + */ + void outputCPPCreateDecl(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPCreateImpl(CodeGenerator &cg, AnalysisResultPtr ar); + + /** + * Output ClassInfo entry of this function. + */ + void outputCPPClassMap(CodeGenerator &cg, AnalysisResultPtr ar); + + FileScopePtr getFileScope() { + FileScopePtr fs = m_file.lock(); + return fs; + } + + /** + * Serialize the iface, not everything. + */ + void serialize(JSON::OutputStream &out) const; + bool inPseudoMain() { + return m_pseudoMain; + } + void setFileScope(FileScopePtr fs) { + m_file = fs; + } + + void setMagicMethod() { + m_magicMethod = true; + } + bool isMagicMethod() const { + return m_magicMethod; + } + + void setIgnored() { + m_ignored = true; + } + bool isIgnored() const { + return m_ignored; + } + + void setStmtCloned(StatementPtr stmt) { + m_stmtCloned = stmt; + } + +private: + bool m_method; + FileScopeWeakPtr m_file; + int m_minParam; + int m_maxParam; + int m_attribute; + std::vector m_paramNames; + TypePtrVec m_paramTypes; + bool m_refReturn; // whether it's "function &get_reference()" + std::vector m_refs; + TypePtr m_returnType; + ModifierExpressionPtr m_modifiers; + bool m_virtual; + bool m_dynamic; + bool m_overriding; // overriding a virtual function + int m_redeclaring; // multiple definition of the same function + bool m_volatile; // for function_exists + bool m_ignored; // redeclared system functions are ignored automatically + bool m_pseudoMain; + bool m_magicMethod; + bool m_system; + bool m_inlineable; + bool m_containsThis; // contains a usage of $this? + int m_callTempCountMax; + int m_callTempCountCurrent; + StatementPtr m_stmtCloned; // cloned method body stmt +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __FUNCTION_SCOPE_H__ diff --git a/src/lib/analysis/symbol_table.cpp b/src/lib/analysis/symbol_table.cpp new file mode 100644 index 0000000000000..f512d5ce69c87 --- /dev/null +++ b/src/lib/analysis/symbol_table.cpp @@ -0,0 +1,201 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace HPHP; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// statics + +SymbolTablePtrVec SymbolTable::AllSymbolTables; + +void SymbolTable::CountTypes(std::map &counts) { + for (unsigned int i = 0; i < AllSymbolTables.size(); i++) { + AllSymbolTables[i]->countTypes(counts); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +SymbolTable::SymbolTable(BlockScope &blockScope) : m_blockScope(blockScope) { +} + +SymbolTable::~SymbolTable() { +} + +void SymbolTable::import(SymbolTablePtr src) { + ASSERT(m_symbols.empty()); + + m_symbols = src->m_symbols; + m_declarations = src->m_declarations; + m_values = src->m_values; + m_coerced = src->m_coerced; + m_rtypes = src->m_rtypes; + for (unsigned int i = 0; i < m_symbols.size(); i++) { + m_system.insert(m_symbols[i]); + } +} + +bool SymbolTable::isPresent(const std::string &name) const { + return m_declarations.find(name) != m_declarations.end(); +} + +bool SymbolTable::isSystem(const std::string &name) const { + return m_system.find(name) != m_system.end(); +} + +/////////////////////////////////////////////////////////////////////////////// + +TypePtr SymbolTable::getType(const std::string &name, bool coerced) { + if (coerced) { + StringToTypePtrMap::const_iterator iter = m_coerced.find(name); + if (iter != m_coerced.end()) return iter->second; + } else { + StringToTypePtrMap::const_iterator iter = m_rtypes.find(name); + if (iter != m_rtypes.end()) return iter->second; + } + return TypePtr(); +} + +TypePtr SymbolTable::getFinalType(const std::string &name) { + TypePtr coerced = getType(name, true); + if (coerced && + !coerced->is(Type::KindOfSome) && !coerced->is(Type::KindOfAny)) { + return coerced; + } + return Type::Variant; +} + +bool SymbolTable::isExplicitlyDeclared(const std::string &name) const { + return m_values.find(name) != m_values.end(); +} + +ConstructPtr SymbolTable::getDeclaration(const std::string &name) { + StringToConstructPtrMap::const_iterator iter = m_declarations.find(name); + if (iter == m_declarations.end()) { + return ConstructPtr(); + } + return iter->second; +} + +ConstructPtr SymbolTable::getValue(const std::string &name) { + StringToConstructPtrMap::const_iterator iter = m_values.find(name); + if (iter == m_values.end()) { + return ConstructPtr(); + } + return iter->second; +} + +TypePtr SymbolTable::coerceTo(AnalysisResultPtr ar, + StringToTypePtrMap &typeMap, + const std::string &name, TypePtr type) { + StringToTypePtrMap::iterator iter = typeMap.find(name); + if (iter == typeMap.end()) { + typeMap[name] = type; + return type; + } + + TypePtr newType = Type::Coerce(ar, iter->second, type); + if (!Type::SameType(iter->second, newType)) { + iter->second = newType; + } + return newType; +} + +TypePtr SymbolTable::setType(AnalysisResultPtr ar, const std::string &name, + TypePtr type, bool coerced) { + TypePtr oldType = getType(name, true); + if (!oldType) oldType = NEW_TYPE(Some); + + if (m_declarations.find(name) == m_declarations.end()) { + m_symbols.push_back(name); + m_declarations[name] = ConstructPtr(); + } + if (type) { + TypePtr ret = coerceTo(ar, coerced? m_coerced : m_rtypes, name, type); + TypePtr newType = getType(name, true); + if (!newType) newType = NEW_TYPE(Some); + if (!Type::SameType(oldType, newType)) { + ar->incNewlyInferred(); + } + return newType; + } + return type; +} + +void SymbolTable::getSymbols(vector &syms) { + BOOST_FOREACH(string sym, m_symbols) { + syms.push_back(sym); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void SymbolTable::serialize(JSON::OutputStream &out) const { + out << m_symbols << m_coerced << m_rtypes; +} + +void SymbolTable::countTypes(std::map &counts) { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + if (!isInherited(name)) { + getFinalType(name)->count(counts); + } + } +} + +string SymbolTable::getEscapedText(Variant v, int &len) { + VariableSerializer vs(VariableSerializer::Serialize); + String str = vs.serialize(v, true); + string output; + for (int64 i = 0; i < str.length(); i++) { + unsigned char ch = str.charAt(i); + switch (ch) { + case '\n': output += "\\n"; break; + case '\r': output += "\\r"; break; + case '\t': output += "\\t"; break; + case '\a': output += "\\a"; break; + case '\b': output += "\\b"; break; + case '\f': output += "\\f"; break; + case '\v': output += "\\v"; break; + case '\0': output += "\\0"; break; + case '\"': output += "\\\""; break; + case '\\': output += "\\\\"; break; + case '?': output += "\\?"; break; + default: + if (isprint(ch)) { + output += ch; + } else { + // output in octal notation + char buf[10]; + snprintf(buf, sizeof(buf), "\\%03o", ch); + output += buf; + } + } + } + len = str.length(); + return output; +} diff --git a/src/lib/analysis/symbol_table.h b/src/lib/analysis/symbol_table.h new file mode 100644 index 0000000000000..1b1e7252e9a40 --- /dev/null +++ b/src/lib/analysis/symbol_table.h @@ -0,0 +1,120 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __SYMBOL_TABLE_H__ +#define __SYMBOL_TABLE_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class BlockScope; +class CodeGenerator; +class Variant; +DECLARE_BOOST_TYPES(Construct); +DECLARE_BOOST_TYPES(Type); +DECLARE_BOOST_TYPES(AnalysisResult); +DECLARE_BOOST_TYPES(SymbolTable); + +/** + * Base class of VariableTable and ConstantTable. + */ +class SymbolTable : public boost::enable_shared_from_this, + public JSON::ISerializable { +public: + static SymbolTablePtrVec AllSymbolTables; // for stats purpose + static void CountTypes(std::map &counts); + BlockScope *getScope() const { return &m_blockScope; } + +public: + SymbolTable(BlockScope &blockScope); + SymbolTable(); + virtual ~SymbolTable(); + + /** + * Import system symbols into this. + */ + void import(SymbolTablePtr src); + + /** + * Whether it's defined. + */ + bool isPresent(const std::string &name) const; + + /** + * Whether a symbol is a system symbol. + */ + bool isSystem(const std::string &name) const; + + /** + * Whether or not this is inherited from a parent scope. For examples, + * properties from base classes or a global variable. + */ + virtual bool isInherited(const std::string &name) const { + return isSystem(name); + } + + /** + * Implements JSON::ISerializable. + */ + virtual void serialize(JSON::OutputStream &out) const; + + /** + * Find a symbol's inferred type. + */ + TypePtr getType(const std::string &name, bool coerced); + TypePtr getFinalType(const std::string &name); + + /** + * Find declaration construct. + */ + bool isExplicitlyDeclared(const std::string &name) const; + ConstructPtr getDeclaration(const std::string &name); + ConstructPtr getValue(const std::string &name); + + /** + * How big of a hash table for generate C++ switch statements. + */ + int getJumpTableSize() const { + return Util::roundUpToPowerOfTwo(m_symbols.size() * 2); + } + + void getSymbols(std::vector &syms); + + virtual TypePtr setType(AnalysisResultPtr ar, const std::string &name, + TypePtr type, bool coerced); +protected: + BlockScope &m_blockScope; // parent + std::vector m_symbols; // in declaration order + std::set m_system; + StringToConstructPtrMap m_declarations; // declarations + StringToConstructPtrMap m_values; // explicit declarations + StringToTypePtrMap m_coerced; // symbols that have been coerced + StringToTypePtrMap m_rtypes; // r-value types for m_symbols + + TypePtr coerceTo(AnalysisResultPtr ar, StringToTypePtrMap &typeMap, + const std::string &name, TypePtr type); + void countTypes(std::map &counts); + std::string getEscapedText(Variant v, int &len); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __SYMBOL_TABLE_H__ diff --git a/src/lib/analysis/type.cpp b/src/lib/analysis/type.cpp new file mode 100644 index 0000000000000..466f6e8591e75 --- /dev/null +++ b/src/lib/analysis/type.cpp @@ -0,0 +1,634 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// +// statics + +TypePtr Type::Boolean(new Type(Type::KindOfBoolean )); +TypePtr Type::Byte (new Type(Type::KindOfByte )); +TypePtr Type::Int16 (new Type(Type::KindOfInt16 )); +TypePtr Type::Int32 (new Type(Type::KindOfInt32 )); +TypePtr Type::Int64 (new Type(Type::KindOfInt64 )); +TypePtr Type::Double (new Type(Type::KindOfDouble )); +TypePtr Type::String (new Type(Type::KindOfString )); +TypePtr Type::Array (new Type(Type::KindOfArray )); +TypePtr Type::Variant(new Type(Type::KindOfVariant )); + +TypePtr Type::CreateType(KindOf uncertain) { + switch (uncertain) { + case KindOfObject: + case KindOfNumeric: + case KindOfPrimitive: + case KindOfPlusOperand: + case KindOfSequence: + case KindOfSome: + case KindOfAny: + return TypePtr(new Type(uncertain)); + default: + ASSERT(false); + } + return TypePtr(); +} + +TypePtr Type::CreateObjectType(const std::string &classname) { + return TypePtr(new Type(KindOfObject, classname)); +} + +TypePtr Type::GetType(KindOf kindOf) { + switch (kindOf) { + case KindOfBoolean: return Type::Boolean; + case KindOfByte: return Type::Byte; + case KindOfInt16: return Type::Int16; + case KindOfInt32: return Type::Int32; + case KindOfInt64: return Type::Int64; + case KindOfDouble: return Type::Double; + case KindOfString: return Type::String; + case KindOfArray: return Type::Array; + case KindOfVariant: return Type::Variant; + case KindOfObject: + case KindOfNumeric: + case KindOfPrimitive: + case KindOfPlusOperand: + case KindOfSequence: + case KindOfSome: + case KindOfAny: return CreateType(kindOf); + default: + ASSERT(false); + break; + } + return TypePtr(); +} + +bool Type::IsLegalCast(AnalysisResultPtr ar, TypePtr from, TypePtr to) { + if (from->m_kindOf == to->m_kindOf || + from->m_kindOf == KindOfVariant || + from->m_kindOf == KindOfSome || + from->m_kindOf == KindOfAny) return true; + + switch (to->m_kindOf) { + case KindOfBoolean: + return true; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + switch (from->m_kindOf) { + case KindOfArray: + case KindOfObject: + case KindOfSequence: + return false; + default: + return true; + } + case KindOfString: + switch (from->m_kindOf) { + case KindOfArray: + return false; + case KindOfObject: + if (!from->m_name.empty()) { + ClassScopePtr cls = ar->findClass(from->m_name); + if (cls) { + return cls->findFunction(ar, "__tostring", true); + } + } + return true; // we can't really be sure + default: + return true; + } + case KindOfArray: + return false; + case KindOfObject: + switch (from->m_kindOf) { + case KindOfObject: + if (!to->m_name.empty() && !from->m_name.empty() && + to->m_name != from->m_name) { + ClassScopePtr cls = ar->findClass(from->m_name); + if (cls) { + return cls->derivesFrom(ar, to->m_name); + } + } + return true; // we can't really be sure + default: + return false; + } + case KindOfVariant: + return true; + case KindOfNumeric: + switch (from->m_kindOf) { + case KindOfBoolean: + case KindOfString: + case KindOfArray: + case KindOfObject: + case KindOfSequence: + return false; + default: + return true; + } + case KindOfPrimitive: + switch (from->m_kindOf) { + case KindOfBoolean: + case KindOfArray: + return false; + case KindOfObject: + if (!from->m_name.empty()) { + ClassScopePtr cls = ar->findClass(from->m_name); + if (cls) { + return cls->findFunction(ar, "__tostring", true); + } + } + return true; // we can't really be sure + default: + return true; + } + case KindOfPlusOperand: + switch (from->m_kindOf) { + case KindOfBoolean: + case KindOfString: + case KindOfObject: + return false; + default: + return true; + } + case KindOfSequence: + switch (from->m_kindOf) { + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + case KindOfObject: + return false; + default: + return true; + } + case KindOfSome: + case KindOfAny: + return true; + default: + ASSERT(false); + } + return false; +} + +TypePtr Type::Cast(AnalysisResultPtr ar, TypePtr from, TypePtr to) { + switch (to->m_kindOf) { + case KindOfObject: + if (from->m_kindOf == KindOfObject && to->m_name.empty() && + !from->m_name.empty()) return from; + return to; + case KindOfNumeric: + switch (from->m_kindOf) { + case KindOfBoolean: return Type::Byte; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + case KindOfString: + case KindOfSequence: return from; + case KindOfArray: + case KindOfObject: return Type::Byte; + case KindOfVariant: return from; + case KindOfNumeric: + case KindOfPrimitive: + case KindOfPlusOperand: + case KindOfSome: + case KindOfAny: return to; + default: + ASSERT(false); + break; + } + case KindOfPrimitive: + switch (from->m_kindOf) { + case KindOfBoolean: return Type::Byte; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + case KindOfString: return from; + case KindOfArray: return Type::Byte; + case KindOfObject: + if (!from->m_name.empty()) { + ClassScopePtr cls = ar->findClass(from->m_name); + if (cls && cls->findFunction(ar, "__tostring", true)) { + return Type::String; + } + } + return Type::Byte; + case KindOfVariant: return from; + case KindOfNumeric: return from; + case KindOfPrimitive: return to; + case KindOfPlusOperand: return CreateType(KindOfNumeric); + case KindOfSequence: return Type::String; + case KindOfSome: + case KindOfAny: return to; + default: + ASSERT(false); + break; + } + case KindOfPlusOperand: + switch (from->m_kindOf) { + case KindOfBoolean: return Type::Byte; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + case KindOfString: + case KindOfArray: return from; + case KindOfObject: return Type::Array; + case KindOfVariant: return from; + case KindOfNumeric: return from; + case KindOfPrimitive: return CreateType(KindOfNumeric); + case KindOfPlusOperand: return to; + case KindOfSequence: return Type::Array; + case KindOfSome: + case KindOfAny: return to; + default: + ASSERT(false); + break; + } + case KindOfSome: + case KindOfAny: + return from; + default: + return to; + } +} + +bool Type::IsCastNeeded(AnalysisResultPtr ar, TypePtr from, TypePtr to) { + if (SameType(from, to)) return false; + + switch (to->m_kindOf) { + case KindOfVariant: + case KindOfNumeric: + case KindOfPrimitive: + case KindOfPlusOperand: + case KindOfSequence: + case KindOfSome: + case KindOfAny: + // Currently these types are all mapped to Variant in cpp/base, and + // that's why these casting are not needed. + return false; + case KindOfObject: + if (from->m_kindOf == KindOfObject && to->m_name.empty() && + !from->m_name.empty()) return false; + default: + break; + } + + // All Sequence operations are implemented on String and Array classes, and + // vice versa, therefore no need to cast between these types. + switch (from->m_kindOf) { + case KindOfString: + case KindOfArray: + if (to->m_kindOf == KindOfSequence) { + return false; + } + break; + case KindOfSequence: + switch (to->m_kindOf) { + case KindOfString: + case KindOfArray: + return false; + default: + break; + } + break; + default: + break; + } + + return true; +} + +bool Type::IsCoercionNeeded(AnalysisResultPtr ar, TypePtr t1, TypePtr t2) { + if (t1->m_kindOf == KindOfSome || + t1->m_kindOf == KindOfAny || + t2->m_kindOf == KindOfSome || + t2->m_kindOf == KindOfAny) return true; + + // special case: we always coerce to a specific object type so we can + // type checking properties and methods + if (t1->m_kindOf == KindOfObject && !t1->m_name.empty() && + t2->m_kindOf == KindOfObject && t2->m_name.empty()) { + return true; + } + + return !Type::IsLegalCast(ar, t1, t2); +} + +TypePtr Type::Coerce(AnalysisResultPtr ar, TypePtr type1, TypePtr type2) { + if (SameType(type1, type2)) return type1; + if (type1->m_kindOf == KindOfVariant || + type2->m_kindOf == KindOfVariant) return Type::Variant; + if (type1->m_kindOf > type2->m_kindOf) return Coerce(ar, type2, type1); + if (type2->m_kindOf == KindOfSome || + type2->m_kindOf == KindOfAny) return type1; + + switch (type1->m_kindOf) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + switch (type2->m_kindOf) { + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + case KindOfNumeric: return type2; + default: + break; + } + break; + case KindOfObject: + if (type2->m_kindOf == KindOfObject) { + if (type1->m_name.empty()) return type2; + if (type2->m_name.empty()) return type1; + ClassScopePtr cls1 = ar->findClass(type1->m_name); + if (cls1 && cls1->derivesFrom(ar, type2->m_name)) { + return type2; + } + ClassScopePtr cls2 = ar->findClass(type2->m_name); + if (cls2 && cls2->derivesFrom(ar, type1->m_name)) { + return type1; + } + } + break; + default: + break; + } + return Type::Variant; +} + +bool Type::SameType(TypePtr type1, TypePtr type2) { + if (type1->m_kindOf == type2->m_kindOf) { + if (type1->m_kindOf == KindOfObject && + type1->m_name != type2->m_name) return false; + return true; + } + return false; +} + +bool Type::IsBadTypeConversion(AnalysisResultPtr ar, TypePtr from, + TypePtr to, bool coercing) { + if (!coercing) { + return !Type::IsLegalCast(ar, from, to); + } + if (Type::SameType(from, to)) { + return false; + } + if (from->m_kindOf == KindOfSome || + from->m_kindOf == KindOfAny || + from->m_kindOf == KindOfVariant) { + return false; + } + if (to->m_kindOf == KindOfSome || + to->m_kindOf == KindOfAny || + to->m_kindOf == KindOfVariant) { + return false; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +Type::Type(KindOf kindOf) : m_kindOf(kindOf) { +} + +Type::Type(KindOf kindOf, const std::string &name) + : m_kindOf(kindOf), m_name(name) { +} + +bool Type::isInteger() const { + switch (m_kindOf) { + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + return true; + default: + break; + } + return false; +} + +bool Type::isSpecificObject() const { + return m_kindOf == KindOfObject && !m_name.empty(); +} + +bool Type::isNonConvertibleType() const { + return m_kindOf == KindOfObject || m_kindOf == KindOfArray; +} + +bool Type::isNoObjectInvolved() const { + switch (m_kindOf) { + case KindOfVoid: + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + case KindOfString: + case KindOfNumeric: + case KindOfPrimitive: + return true; + default: + break; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +string Type::getCPPDecl() { + switch (m_kindOf) { + case KindOfBoolean: return "bool"; + case KindOfByte: return "char"; + case KindOfInt16: return "short"; + case KindOfInt32: return "int"; + case KindOfInt64: return "int64"; + case KindOfDouble: return "double"; + case KindOfString: return "String"; + case KindOfArray: return "Array"; + case KindOfVariant: + case KindOfSome: + case KindOfAny: return "Variant"; + case KindOfNumeric: return "Numeric"; + case KindOfPrimitive: return "Primitive"; + case KindOfPlusOperand: return "PlusOperand"; + case KindOfSequence: return "Sequence"; + case KindOfObject: + if (m_name.empty()) return "Object"; + return string("p_") + m_name; + default: + ASSERT(false); + } + return ""; +} + +void Type::outputCPPDecl(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf(getCPPDecl().c_str()); +} + +void Type::outputCPPCast(CodeGenerator &cg, AnalysisResultPtr ar) { + switch (m_kindOf) { + case KindOfBoolean: cg.printf("toBoolean"); break; + case KindOfByte: cg.printf("toByte"); break; + case KindOfInt16: cg.printf("toInt16"); break; + case KindOfInt32: cg.printf("toInt32"); break; + case KindOfInt64: cg.printf("toInt64"); break; + case KindOfDouble: cg.printf("toDouble"); break; + case KindOfString: cg.printf("toString"); break; + case KindOfArray: cg.printf("toArray"); break; + case KindOfVariant: cg.printf("Variant"); break; + case KindOfNumeric: cg.printf("Numeric"); break; + case KindOfPrimitive: cg.printf("Primitive"); break; + case KindOfPlusOperand: cg.printf("PlusOperand"); break; + case KindOfSequence: cg.printf("Sequence"); break; + case KindOfObject: + if (m_name.empty()) { + cg.printf("toObject"); + } else { + cg.printf("p_%s", m_name.c_str()); + } + break; + default: + ASSERT(false); + } +} + +const char *Type::getCPPInitializer() { + switch (m_kindOf) { + case KindOfBoolean: return "false"; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: return "0"; + case KindOfDouble: return "0.0"; + case KindOfString: + case KindOfArray: + case KindOfSequence: + case KindOfVariant: + case KindOfSome: + case KindOfAny: + case KindOfObject: return NULL; + case KindOfNumeric: + case KindOfPrimitive: + case KindOfPlusOperand: return "0"; + default: + ASSERT(false); + } + return NULL; +} + +std::string Type::getPHPName() { + switch (m_kindOf) { + case KindOfArray: return "array"; + case KindOfObject: return m_name; + default: break; + } + return ""; +} + +std::string Type::toString() const { + switch (m_kindOf) { + case KindOfBoolean: return "Boolean"; + case KindOfByte: return "Byte"; + case KindOfInt16: return "Int16"; + case KindOfInt32: return "Int32"; + case KindOfInt64: return "Int64"; + case KindOfDouble: return "Double"; + case KindOfString: return "String"; + case KindOfArray: return "Array"; + case KindOfVariant: return "Variant"; + case KindOfSome: + case KindOfAny: return "Any"; + case KindOfObject: return string("Object - ") + m_name; + case KindOfNumeric: return "Numeric"; + case KindOfPrimitive: return "Primitive"; + case KindOfPlusOperand: return "PlusOperand"; + case KindOfSequence: return "Sequence"; + default: + ASSERT(false); + } + return "(unknown)"; +} + +void Type::Dump(TypePtr type, const char *fmt /* = "%s" */) { + printf(fmt, type ? type->toString().c_str() : "(null)"); +} + +void Type::Dump(ExpressionPtr exp) { + Dump(exp->getExpectedType(), "Expected: %s\t"); + Dump(exp->getActualType(), "Actual: %s\n"); +} + +void Type::serialize(JSON::OutputStream &out) const { + out << toString(); +} + +void Type::count(std::map &counts) { + if (is(Type::KindOfObject)) { + if (isSpecificObject()) { + counts["Object - Specific"]++; + } else { + counts["Object"]++; + } + } else { + counts[toString()]++; + } + + switch (m_kindOf) { + case KindOfBoolean: + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + case KindOfDouble: + case KindOfString: + case KindOfArray: + case KindOfObject: + counts["_strong"]++; + break; + case KindOfVariant: + case KindOfSome: + case KindOfAny: + case KindOfNumeric: + case KindOfPrimitive: + case KindOfPlusOperand: + case KindOfSequence: + counts["_weak"]++; + break; + default: + ASSERT(false); + } + counts["_all"]++; +} diff --git a/src/lib/analysis/type.h b/src/lib/analysis/type.h new file mode 100644 index 0000000000000..146d1fe137688 --- /dev/null +++ b/src/lib/analysis/type.h @@ -0,0 +1,183 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TYPE_H__ +#define __TYPE_H__ + +#include +#include + +#define NEW_TYPE(s) Type::CreateType(Type::KindOf ## s) + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class CodeGenerator; +DECLARE_BOOST_TYPES(Expression); +DECLARE_BOOST_TYPES(AnalysisResult); +DECLARE_BOOST_TYPES(Type); + +class Type : public JSON::ISerializable { +public: + enum KindOf { + KindOfVoid = -1, + + KindOfBoolean, + KindOfByte, + KindOfInt16, + KindOfInt32, + KindOfInt64, + KindOfDouble, + KindOfString, + KindOfArray, + KindOfObject, // with classname + KindOfVariant, + + KindOfNumeric, // Byte, Int16, Int32, Int64 or Double + KindOfPrimitive, // Numeric or String + KindOfPlusOperand, // Numeric or Array + KindOfSequence, // String or Array + KindOfSome, // any type except void + KindOfAny, // any type including void + }; + + /** + * Inferred types: types that a variable or a constant is sure to be. + */ + static TypePtr Boolean; + static TypePtr Byte; + static TypePtr Int16; + static TypePtr Int32; + static TypePtr Int64; + static TypePtr Double; + static TypePtr String; + static TypePtr Array; + static TypePtr Variant; + + /** + * Uncertain types: types that are ambiguous yet. + */ + static TypePtr CreateType(KindOf uncertain); + static TypePtr CreateObjectType(const std::string &classname); + + /** + * For inferred, return static type objects; for uncertain, create new + * ones. + */ + static TypePtr GetType(KindOf kindOf); + + /** + * Whether a type can be used as another type. + */ + static bool IsLegalCast(AnalysisResultPtr ar, TypePtr from, TypePtr to); + + /** + * Get one single type that both types can convert to. + */ + static TypePtr Cast(AnalysisResultPtr ar, TypePtr from, TypePtr to); + + /** + * Whether or not a cast is needed during code generation. + */ + static bool IsCastNeeded(AnalysisResultPtr ar, TypePtr from, TypePtr to); + + /** + * When a variable's type is t1, and it's used as t2, do we need to + * coerce variable's type? Normally, if t2 can be legally casted to t1, + * this returns false. + */ + static bool IsCoercionNeeded(AnalysisResultPtr ar, TypePtr t1, TypePtr t2); + + /** + * When a variable is assigned with two types, what type a variable + * should be? + */ + static TypePtr Coerce(AnalysisResultPtr ar, TypePtr type1, TypePtr type2); + + /** + * Whether or not two types are the same. + */ + static bool SameType(TypePtr type1, TypePtr type2); + + /** + * Testing type conversion for constants. + */ + static bool IsBadTypeConversion(AnalysisResultPtr ar, TypePtr from, + TypePtr to, bool coercing); + +private: + Type(KindOf kindOf); + Type(KindOf kindOf, const std::string &name); + +public: + /** + * KindOf testing. + */ + bool is(KindOf kindOf) const { return m_kindOf == kindOf;} + KindOf getKindOf() const { return m_kindOf;} + bool isInteger() const; + bool isSpecificObject() const; + bool isNonConvertibleType() const; // other types cannot convert to them + bool isPrimitive() const { return m_kindOf <= KindOfDouble;} + bool isNoObjectInvolved() const; + const std::string &getName() const { return m_name;} + + /** + * Generate type specifier in C++. + */ + std::string getCPPDecl(); + void outputCPPDecl(CodeGenerator &cg, AnalysisResultPtr ar); + + /** + * Generate type conversion in C++. + */ + void outputCPPCast(CodeGenerator &cg, AnalysisResultPtr ar); + + /** + * Generate variable initialization code. + */ + const char *getCPPInitializer(); + + /** + * Type hint names in PHP. + */ + std::string getPHPName(); + + /** + * Debug dump. + */ + std::string toString() const; + static void Dump(TypePtr type, const char *fmt = "%s"); + static void Dump(ExpressionPtr exp); + + /** + * Implements JSON::ISerializable. + */ + virtual void serialize(JSON::OutputStream &out) const; + + /** + * For stats reporting. + */ + void count(std::map &counts); + +private: + KindOf m_kindOf; + std::string m_name; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __TYPE_H__ diff --git a/src/lib/analysis/variable_table.cpp b/src/lib/analysis/variable_table.cpp new file mode 100644 index 0000000000000..615607515fdbd --- /dev/null +++ b/src/lib/analysis/variable_table.cpp @@ -0,0 +1,1500 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +void (*VariableTable::m_hookHandler)(AnalysisResultPtr ar, + VariableTable *variables, + ExpressionPtr variable, + HphpHookUniqueId id); + +/////////////////////////////////////////////////////////////////////////////// +// StaticGlobalInfo + +string VariableTable::StaticGlobalInfo::getId +(ClassScopePtr cls, FunctionScopePtr func, const string &name) { + ASSERT(cls || func); + + // format: $$$$name + string id; + if (cls) { + id += cls->getId(); + id += Option::IdPrefix; + } + if (func) { + id += func->getId(); + id += Option::IdPrefix; + } + id += name; + + return id; +} + +/////////////////////////////////////////////////////////////////////////////// + +VariableTable::VariableTable(BlockScope &blockScope) + : SymbolTable(blockScope), m_attribute(0), m_allVariants(false), + m_hookData(NULL) { +} + +VariableTable::~VariableTable() { + if (m_hookData) { + ASSERT(m_hookHandler); + m_hookHandler(AnalysisResultPtr(), this, ExpressionPtr(), hphpUniqueDtor); + } +} + +void VariableTable::getNames(std::set &names, + bool collectPrivate /* = true */) const { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + if (collectPrivate || !isPrivate(m_symbols[i])) { + names.insert(m_symbols[i]); + } + } +} + +bool VariableTable::isParameter(const string &name) const { + return m_parameters.find(name) != m_parameters.end(); +} + +bool VariableTable::isPublic(const string &name) const { + return !isProtected(name) && !isPrivate(name); +} + +bool VariableTable::isProtected(const string &name) const { + return m_protected.find(name) != m_protected.end(); +} + +bool VariableTable::isPrivate(const string &name) const { + return m_private.find(name) != m_private.end(); +} + +bool VariableTable::isStatic(const string &name) const { + return m_static.find(name) != m_static.end(); +} + +bool VariableTable::isGlobal(const string &name) const { + return m_global.find(name) != m_global.end(); +} + +bool VariableTable::isRedeclared(const string &name) const { + return m_redeclared.find(name) != m_redeclared.end(); +} + +bool VariableTable::isNestedGlobal(const string &name) const { + return m_nestedGlobal.find(name) != m_nestedGlobal.end(); +} + +bool VariableTable::isNestedStatic(const string &name) const { + return m_nestedStatic.find(name) != m_nestedStatic.end(); +} + +bool VariableTable::isLvalParam(const string &name) const { + return m_lvalParam.find(name) != m_lvalParam.end(); +} + +bool VariableTable::isReferenced(const string &name) const { + return m_referenced.find(name) != m_referenced.end(); +} + +bool VariableTable::isUnused(const string &name) const { + return m_unused.find(name) != m_unused.end(); +} + +bool VariableTable::isSuperGlobal(const string &name) const { + return m_superGlobals.find(name) != m_superGlobals.end(); +} + +bool VariableTable::isLocal(const string &name) const { + FunctionScope *func = dynamic_cast(getScope()); + if (func) { + return (!isStatic(name) && + !isGlobal(name) && + !isSuperGlobal(name) && + !isParameter(name)); + } else { + return false; + } +} + +bool VariableTable::needLocalCopy(const string &name) const { + return (isGlobal(name) || isStatic(name)) && + (isRedeclared(name) || + isNestedStatic(name) || + isNestedGlobal(name) || + getAttribute(ContainsDynamicVariable) || + getAttribute(ContainsExtract) || + getAttribute(ContainsUnset)); +} + +bool VariableTable::needGlobalPointer() const { + return !m_global.empty() || + !m_static.empty() || + getAttribute(ContainsDynamicVariable) || + getAttribute(ContainsExtract) || + getAttribute(ContainsUnset) || + getAttribute(NeedGlobalPointer); +} + +bool VariableTable::isInherited(const string &name) const { + return !isGlobal(name) && !isSystem(name) && + m_declarations.find(name) == m_declarations.end(); +} + +const char *VariableTable::getVariablePrefix(AnalysisResultPtr ar, + const string &name) const { + if (isStatic(name)) { + if (!needLocalCopy(name)) { + return Option::StaticVariablePrefix; + } + return Option::VariablePrefix; + } + + if (getAttribute(ForceGlobal)) { + return Option::GlobalVariablePrefix; + } + + if (isGlobal(name)) { + if (!needLocalCopy(name)) { + return Option::GlobalVariablePrefix; + } + } + return Option::VariablePrefix; +} + +string VariableTable::getVariableName(AnalysisResultPtr ar, + const string &name) const { + if (isStatic(name)) { + if (!needLocalCopy(name)) { + return string(Option::StaticVariablePrefix) + name; + } + return string(Option::VariablePrefix) + name; + } + + if (getAttribute(ForceGlobal)) { + return getGlobalVariableName(ar, name); + } + + if (isGlobal(name)) { + if (!needLocalCopy(name)) { + return getGlobalVariableName(ar, name); + } + } + return string(Option::VariablePrefix) + name; +} + +string +VariableTable::getGlobalVariableName(AnalysisResultPtr ar, + const string &name) const { + if (ar->getVariables()->isSystem(name)) { + return string(Option::GlobalVariablePrefix) + name; + } + return string("GV(") + name + ")"; +} + +ConstructPtr VariableTable::getStaticInitVal(string varName) { + StringToConstructPtrMap::const_iterator iter = m_staticInitVal.find(varName); + if (iter != m_staticInitVal.end()) return iter->second; + return ConstructPtr(); +} + +bool VariableTable::setStaticInitVal(string varName, + ConstructPtr value) { + bool exists = (m_staticInitVal.find(varName) != m_staticInitVal.end()); + m_staticInitVal[varName] = value; + return exists; +} + +/////////////////////////////////////////////////////////////////////////////// + +TypePtr VariableTable::addParam(const string &name, TypePtr type, + AnalysisResultPtr ar, ConstructPtr construct) { + if (m_parameters.find(name) == m_parameters.end()) { + int index = m_parameters.size(); + m_parameters[name] = index; + } + return add(name, type, false, ar, construct, ModifierExpressionPtr()); +} + +void VariableTable::addStaticVariable(const string &name, + AnalysisResultPtr ar, + bool member /* = false */) { + if (isGlobalTable(ar)) { + return; // a static variable at global scope is the same as non-static + } + + // redeclaring the same static variable twice + if (m_static.find(name) != m_static.end()) { + return; + } + + m_static.insert(name); + + VariableTablePtr globalVariables = ar->getVariables(); + StaticGlobalInfoPtr sgi(new StaticGlobalInfo()); + sgi->name = name; + sgi->variables = this; + sgi->cls = ar->getClassScope(); + sgi->func = member ? FunctionScopePtr() : ar->getFunctionScope(); + + string id = StaticGlobalInfo::getId(sgi->cls, sgi->func, name); + ASSERT(globalVariables->m_staticGlobals.find(id) == + globalVariables->m_staticGlobals.end()); + globalVariables->m_staticGlobals[id] = sgi; +} + +TypePtr VariableTable::add(const string &name, TypePtr type, + bool implicit, AnalysisResultPtr ar, + ConstructPtr construct, + ModifierExpressionPtr modifiers, + bool checkError /* = true */) { + ASSERT(construct); + + if (getAttribute(InsideStaticStatement)) { + addStaticVariable(name, ar); + if (ar->getClassScope()) { + forceVariant(ar, name); + } + } else if (getAttribute(InsideGlobalStatement)) { + m_global.insert(name); + if (!isGlobalTable(ar)) { + ar->getVariables()->add(name, type, implicit, ar, construct, modifiers, + false); + } + ASSERT(type->is(Type::KindOfSome) || type->is(Type::KindOfAny)); + TypePtr varType = ar->getVariables()->getFinalType(name); + if (varType) { + type = varType; + } else { + ar->getVariables()->setType(ar, name, type, true); + } + } else if (ar->getPhase() == AnalysisResult::FirstInference && + isPseudoMainTable()) { + // A variable used in a pseudomain + ar->getVariables()->add(name, type, implicit, ar, + construct, modifiers, + checkError); + } + + if (modifiers) { + if (modifiers->isProtected()) { + m_protected.insert(name); + } else if (modifiers->isPrivate()) { + m_private.insert(name); + } + if (modifiers->isStatic()) { + addStaticVariable(name, ar); + } + } + type = setType(ar, name, type, true); + m_declarations[name] = construct; + + if (!implicit && ar->isFirstPass()) { + StringToConstructPtrMap::const_iterator iter = m_values.find(name); + if (iter == m_values.end()) { + m_values[name] = construct; + } else if (construct != iter->second && checkError && !isGlobalTable(ar)) { + ar->getCodeError()->record(CodeError::DeclaredVariableTwice, construct, + iter->second); + } + } + return type; +} + +TypePtr VariableTable::checkVariable(const string &name, TypePtr type, + bool coerce, AnalysisResultPtr ar, + ConstructPtr construct, int &properties) { + properties = 0; + + // Variable used in pseudomain + if (ar->getPhase() == AnalysisResult::FirstInference && + isPseudoMainTable()) { + ar->getVariables()->checkVariable(name, type, + coerce, ar, construct, properties); + } + + if (m_declarations.find(name) == m_declarations.end()) { + ClassScopePtr parent = findParent(ar, name); + if (parent) { + return parent->checkStatic(name, type, coerce, ar, + construct, properties); + } + + bool isLocal = !isGlobal(name) && !isSystem(name); + if (isLocal && !getAttribute(ContainsLDynamicVariable) && + ar->isFirstPass()) { + CodeError::ErrorType error = (ar->getScope()->getLoopNestedLevel() == 0 ? + CodeError::UseUndeclaredVariable : + CodeError::PossibleUndeclaredVariable); + ar->getCodeError()->record(error, construct); + type = Type::Variant; + coerce = true; + } + + type = setType(ar, name, type, coerce); + m_declarations[name] = construct; + return type; + } + + properties = VariablePresent; + if (isStatic(name)) { + properties |= VariableStatic; + } + return setType(ar, name, type, coerce); +} + +TypePtr VariableTable::checkProperty(const string &name, TypePtr type, + bool coerce, AnalysisResultPtr ar, + ConstructPtr construct, int &properties) { + properties = VariablePresent; + if (m_declarations.find(name) == m_declarations.end()) { + ClassScopePtr parent = findParent(ar, name); + if (parent) { + return parent->checkProperty(name, type, coerce, ar, construct, + properties); + } + if (ar->isFirstPass()) { + ar->getCodeError()->record(CodeError::UseUndeclaredVariable, construct); + } + properties = 0; + return type; + } + + TypePtr ret = setType(ar, name, type, coerce); + + // walk up to make sure all parents are happy with this type + ClassScopePtr parent = findParent(ar, name); + if (parent) { + return parent->checkProperty(name, type, coerce, ar, construct, + properties); + } + if (isStatic(name)) { + properties |= VariableStatic; + } + return ret; +} + +bool VariableTable::checkRedeclared(const string &name, + Statement::KindOf kindOf) +{ + ASSERT(kindOf == Statement::KindOfStaticStatement || + kindOf == Statement::KindOfGlobalStatement); + if (kindOf == Statement::KindOfStaticStatement && isPresent(name)) { + if (isStatic(name)) { + return true; + } else if (!isRedeclared(name)) { + m_redeclared.insert(name); + return true; + } else { + return false; + } + } else if (kindOf == Statement::KindOfGlobalStatement && + isPresent(name) && !isGlobal(name) && !isRedeclared(name)) { + m_redeclared.insert(name); + return true; + } else { + return false; + } +} + +void VariableTable::addNestedGlobal(const string &name) +{ + m_nestedGlobal.insert(name); +} + +void VariableTable::addNestedStatic(const string &name) +{ + m_nestedStatic.insert(name); +} + +void VariableTable::addLvalParam(const string &name) +{ + m_lvalParam.insert(name); +} + +void VariableTable::addReferenced(const string &name) +{ + m_referenced.insert(name); +} + +void VariableTable::addUnused(const string &name) +{ + m_unused.insert(name); +} + +void VariableTable::forceVariants(AnalysisResultPtr ar) { + if (!m_allVariants) { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + setType(ar, m_symbols[i], Type::Variant, true); + } + m_allVariants = true; + + ClassScopePtr parent = m_blockScope.getParentScope(ar); + if (parent) { + parent->getVariables()->forceVariants(ar); + } + } +} + +void VariableTable::forceVariant(AnalysisResultPtr ar, + const string &name) { + if (m_declarations.find(name) != m_declarations.end()) { + setType(ar, name, Type::Variant, true); + } +} + +TypePtr VariableTable::setType(AnalysisResultPtr ar, const string &name, + TypePtr type, bool coerce) { + if (m_allVariants) type = Type::Variant; + TypePtr ret = SymbolTable::setType(ar, name, type, coerce || m_allVariants); + if (!ret) return ret; + + if (isGlobal(name)) { + VariableTablePtr v = ar->getVariables(); + if (v.get() != this) { + v->setType(ar, name, type, coerce); + } + } + + if (coerce) { + std::map::const_iterator iter = m_parameters.find(name); + if (iter != m_parameters.end()) { + FunctionScope *func = dynamic_cast(&m_blockScope); + ASSERT(func); + TypePtr paramType = func->setParamType(ar, iter->second, type); + if (!Type::SameType(paramType, type)) { + return setType(ar, name, paramType, true); // recursively + } + } + } + return ret; +} + +void VariableTable::dumpStats(std::map &typeCounts) { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + if (isGlobal(m_symbols[i])) continue; + typeCounts[getFinalType(m_symbols[i])->toString()]++; + } +} + +void VariableTable::addSuperGlobal(const string &name) { + m_superGlobals.insert(name); +} + +bool VariableTable::isConvertibleSuperGlobal(const string &name) const { + return !getAttribute(ContainsDynamicVariable) && isSuperGlobal(name); +} + + +ClassScopePtr VariableTable::findParent(AnalysisResultPtr ar, + const string &name) { + for (ClassScopePtr parent = m_blockScope.getParentScope(ar); + parent; parent = parent->getParentScope(ar)) { + if (parent->hasProperty(name)) { + return parent; + } + } + return ClassScopePtr(); +} + +bool VariableTable::isGlobalTable(AnalysisResultPtr ar) const { + return ar->getVariables().get() == this; +} +bool VariableTable::isPseudoMainTable() const { + return m_blockScope.inPseudoMain(); +} + +void VariableTable::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (Option::GenerateInferredTypes) { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + if (isInherited(name)) continue; + + if (isParameter(name)) { + cg.printf("// @param "); + } else if (isGlobal(name)) { + cg.printf("// @global "); + } else if (isStatic(name)) { + cg.printf("// @static "); + } else { + cg.printf("// @local "); + } + cg.printf("%s\t$%s\n", getFinalType(name)->toString().c_str(), + name.c_str()); + } + } + if (Option::ConvertSuperGlobals && !getAttribute(ContainsDynamicVariable)) { + set convertibles; + for (set::const_iterator iter = m_superGlobals.begin(); + iter != m_superGlobals.end(); ++iter) { + if (m_declarations.find(*iter) == m_declarations.end()) { + convertibles.insert(*iter); + } + } + m_superGlobals = convertibles; + if (!m_superGlobals.empty()) { + cg.printf("/* converted super globals */ global "); + for (set::const_iterator iter = m_superGlobals.begin(); + iter != m_superGlobals.end(); ++iter) { + if (iter != m_superGlobals.begin()) cg.printf(","); + cg.printf("$%s", iter->c_str()); + } + cg.printf(";\n"); + } + } +} + +void VariableTable::outputCPPGlobalVariablesHeader(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.printSection("Class Forward Declarations\n"); + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + StaticGlobalInfoPtr sgi = iter->second; + if (!sgi->func) { + TypePtr varType = sgi->variables->getFinalType(sgi->name); + if (varType->isSpecificObject()) { + cg.printf("FORWARD_DECLARE_CLASS(%s);\n", varType->getName().c_str()); + } + } + } + + if (cg.getOutput() == CodeGenerator::SystemCPP) { + cg.printf("class SystemGlobals : public Globals {\n"); + cg.indentBegin("public:\n"); + cg.printf("SystemGlobals();\n"); + } else { + cg.printf("class GlobalVariables : public SystemGlobals {\n"); + cg.printf("DECLARE_SMART_ALLOCATION_NOCALLBACKS(GlobalVariables);\n"); + cg.indentBegin("public:\n"); + cg.printf("GlobalVariables();\n"); + cg.printf("~GlobalVariables();\n"); + cg.printf("static GlobalVariables *Create() " + "{ return NEW(GlobalVariables)(); }\n"); + cg.printf("static void Delete(GlobalVariables *p) " + "{ DELETE(GlobalVariables)(p); }\n"); + } + cg.printf("static void initialize();\n"); + + cg.printf("\n"); + cg.printf("bool dummy; // for easier constructor initializer output\n"); + + cg.printSection("Global Variables"); + if (cg.getOutput() != CodeGenerator::SystemCPP) { + cg.printf("BEGIN_GVS()\n"); + int count = 0; + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + if (!isSystem(name)) { + count++; + cg.printf(" GVS(%s)\n", name.c_str()); + } + } + cg.printf("END_GVS(%d)\n", count); + } else { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + TypePtr type = getFinalType(name); + type->outputCPPDecl(cg, ar); + cg.printf(" %s%s;\n", Option::GlobalVariablePrefix, name.c_str()); + } + } + + cg.printSection("Dynamic Constants"); + ar->outputCPPDynamicConstantDecl(cg); + + cg.printSection("Function/Method Static Variables"); + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + const string &id = iter->first; + StaticGlobalInfoPtr sgi = iter->second; + if (sgi->func) { + TypePtr varType = sgi->variables->getFinalType(sgi->name); + varType->outputCPPDecl(cg, ar); + cg.printf(" %s%s;\n", Option::StaticVariablePrefix, id.c_str()); + } + } + + cg.printSection("Function/Method Static Variable Initialization Booleans"); + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + const string &id = iter->first; + StaticGlobalInfoPtr sgi = iter->second; + if (sgi->func) { + if (sgi->cls) { + cg.printf("Variant %s%s%s;\n", Option::InitPrefix, + Option::StaticVariablePrefix, id.c_str()); + } else { + cg.printf("bool %s%s%s;\n", Option::InitPrefix, + Option::StaticVariablePrefix, id.c_str()); + } + } + } + + cg.printSection("Class Static Variables"); + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + StaticGlobalInfoPtr sgi = iter->second; + // id can change if we discover it is redeclared + const string &id = StaticGlobalInfo::getId(sgi->cls, sgi->func, + sgi->name); + if (!sgi->func) { + TypePtr varType = sgi->variables->getFinalType(sgi->name); + varType->outputCPPDecl(cg, ar); + cg.printf(" %s%s;\n", Option::StaticPropertyPrefix, id.c_str()); + } + } + + cg.printSection("Class Static Initializer Flags"); + ar->outputCPPClassStaticInitializerFlags(cg, false); + + cg.printSection("PseudoMain Variables"); + ar->outputCPPFileRunDecls(cg); + + cg.printSection("Redeclared Functions"); + ar->outputCPPRedeclaredFunctionDecl(cg); + + cg.printSection("Redeclared Classes"); + ar->outputCPPRedeclaredClassDecl(cg); + + if (cg.getOutput() != CodeGenerator::SystemCPP) { + cg.printSection("Global Array Wrapper Methods"); + cg.indentBegin("virtual ssize_t staticSize() const {\n"); + cg.printf("return %d;\n", m_symbols.size()); + cg.indentEnd("}\n"); + + cg.printSection("LVariableTable Methods"); + cg.printf("virtual CVarRef getRefByIdx(ssize_t idx, Variant &k);\n"); + cg.printf("virtual ssize_t getIndex(const char *s, int64 prehash)" + " const;\n"); + cg.printf("virtual Variant &getImpl(CStrRef s, int64 hash);\n"); + cg.printf("virtual bool exists(const char *s, int64 hash = -1) const;\n"); + + } + cg.indentEnd("};\n"); + + // generating scalar arrays + cg.printSection("Scalar Arrays"); + if (cg.getOutput() == CodeGenerator::SystemCPP) { + cg.printf("class SystemScalarArrays {\n"); + } else { + cg.printf("class ScalarArrays : public SystemScalarArrays {\n"); + } + cg.indentBegin("public:\n"); + cg.printf("static void initialize();\n"); + if (cg.getOutput() != CodeGenerator::SystemCPP && + Option::ScalarArrayFileCount > 1) { + for (int i = 0; i < Option::ScalarArrayFileCount; i++) { + cg.printf("static void initialize_%d();\n", i); + } + } + cg.printf("\n"); + ar->outputCPPScalarArrayDecl(cg); + cg.indentEnd("};\n"); + cg.printf("\n"); +} + +void VariableTable::outputCPPGlobalState(CodeGenerator &cg, + AnalysisResultPtr ar) { + const char *section = "static_global_variables"; + ar->outputCPPGlobalStateBegin(cg, section); + int maxIdx = m_symbols.size(); + for (int i = 0; i < maxIdx; i++) { + const string &name = m_symbols[i]; + cg.printf("%s.set(\"%s%s\", g->get(\"%s\"));\n", section, + Option::GlobalVariablePrefix, name.c_str(), name.c_str()); + } + ar->outputCPPGlobalStateEnd(cg, section); + + section = "dynamic_global_variables"; + ar->outputCPPGlobalStateBegin(cg, section); + cg.printf("%s = *get_variable_table();\n", section); + ar->outputCPPGlobalStateEnd(cg, section); + + section = "method_static_variables"; + ar->outputCPPGlobalStateBegin(cg, section); + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + const string &id = iter->first; + StaticGlobalInfoPtr sgi = iter->second; + if (sgi->func) { + cg.printf("%s.set(\"%s%s\", g->%s%s);\n", section, + Option::StaticVariablePrefix, id.c_str(), + Option::StaticVariablePrefix, id.c_str()); + } + } + ar->outputCPPGlobalStateEnd(cg, section); + + section = "method_static_inited"; + ar->outputCPPGlobalStateBegin(cg, section); + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + const string &id = iter->first; + StaticGlobalInfoPtr sgi = iter->second; + if (sgi->func) { + cg.printf("%s.set(\"%s%s%s\", g->%s%s%s);\n", section, + Option::InitPrefix, Option::StaticVariablePrefix, id.c_str(), + Option::InitPrefix, Option::StaticVariablePrefix, id.c_str()); + } + } + ar->outputCPPGlobalStateEnd(cg, section); + + section = "class_static_variables"; + ar->outputCPPGlobalStateBegin(cg, section); + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + StaticGlobalInfoPtr sgi = iter->second; + // id can change if we discover it is redeclared + const string &id = StaticGlobalInfo::getId(sgi->cls, sgi->func, + sgi->name); + if (!sgi->func) { + TypePtr varType = sgi->variables->getFinalType(sgi->name); + cg.printf("%s.set(\"%s%s\", g->%s%s);\n", section, + Option::StaticPropertyPrefix, id.c_str(), + Option::StaticPropertyPrefix, id.c_str()); + } + } + ar->outputCPPGlobalStateEnd(cg, section); +} + +void VariableTable::outputCPPGlobalVariablesImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool system = (cg.getOutput() == CodeGenerator::SystemCPP); + + if (!system) { + cg.printf("IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS(GlobalVariables);\n"); + } + + const char *clsname = system ? "SystemGlobals" : "GlobalVariables"; + cg.printf("%s::%s() : dummy(false)", clsname, clsname); + + set classes; + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + const string &id = iter->first; + StaticGlobalInfoPtr sgi = iter->second; + if (sgi->func) { + if (sgi->cls) { + cg.printf(",\n %s%s%s()", Option::InitPrefix, + Option::StaticVariablePrefix, id.c_str()); + } else { + cg.printf(",\n %s%s%s(false)", Option::InitPrefix, + Option::StaticVariablePrefix, id.c_str()); + } + } else if (sgi->cls->needStaticInitializer()) { + classes.insert(sgi->cls->getId()); + } + } + ar->outputCPPClassStaticInitializerFlags(cg, true); + ar->outputCPPFileRunImpls(cg); + + cg.indentBegin(" {\n"); + + cg.printSection("Dynamic Constants"); + ar->outputCPPDynamicConstantImpl(cg); + + cg.printSection("Primitive Function/Method Static Variables"); + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + StaticGlobalInfoPtr sgi = iter->second; + if (sgi->func) { + TypePtr varType = sgi->variables->getFinalType(sgi->name); + if (varType->isPrimitive()) { + const string &id = iter->first; + const char *initializer = varType->getCPPInitializer(); + ASSERT(initializer); + cg.printf("%s%s = %s;\n", + Option::StaticVariablePrefix, id.c_str(), initializer); + } + } + } + + cg.printSection("Primitive Class Static Variables"); + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + StaticGlobalInfoPtr sgi = iter->second; + // id can change if we discover it is redeclared + if (!sgi->func) { + TypePtr varType = sgi->variables->getFinalType(sgi->name); + if (varType->isPrimitive()) { + const string &id = StaticGlobalInfo::getId(sgi->cls, sgi->func, + sgi->name); + const char *initializer = varType->getCPPInitializer(); + ASSERT(initializer); + cg.printf("%s%s = %s;\n", + Option::StaticPropertyPrefix, id.c_str(), initializer); + } + } + } + + cg.printSection("Redeclared Functions"); + ar->outputCPPRedeclaredFunctionImpl(cg); + + cg.printSection("Redeclared Classes"); + ar->outputCPPRedeclaredClassImpl(cg); + + cg.indentEnd("}\n"); + + cg.printf("\n"); + // generating top level statements in system PHP files + if (system) { + cg.indentBegin("void SystemGlobals::initialize() {\n"); + ar->outputCPPSystemImplementations(cg); + } else { + cg.indentBegin("void GlobalVariables::initialize() {\n"); + cg.printf("SystemGlobals::initialize();\n"); + } + for (set::const_iterator iter = classes.begin(); + iter != classes.end(); ++iter) { + cg.printf("%s%s();\n", Option::ClassStaticInitializerPrefix, + iter->c_str()); + } + cg.indentEnd("}\n"); + + if (!system) { + cg.printf("\n"); + cg.printf("void init_static_variables() { ScalarArrays::initialize();}\n"); + cg.printf("static ThreadLocalStatic g_variables;\n"); + + cg.printf("static IMPLEMENT_THREAD_LOCAL" + "(GlobalArrayWrapper, g_array_wrapper);\n"); + cg.indentBegin("GlobalVariables *get_global_variables() {\n"); + cg.printf("return g_variables.get();\n"); + cg.indentEnd("}\n"); + cg.printf("void init_global_variables() " + "{ GlobalVariables::initialize();}\n"); + cg.indentBegin("void free_global_variables() {\n"); + cg.printf("g_variables.reset();\n"); + cg.printf("g_array_wrapper.reset();\n"); + cg.indentEnd("}\n"); + cg.printf("LVariableTable *get_variable_table() " + "{ return (LVariableTable*)get_global_variables();}\n"); + cg.printf("Globals *get_globals() " + "{ return (Globals*)get_global_variables();}\n"); + cg.printf("SystemGlobals *get_system_globals() " + "{ return (SystemGlobals*)get_global_variables();}\n"); + cg.printf("Array get_global_array_wrapper()"); + cg.printf("{ return g_array_wrapper.get();}\n"); + } +} + +void VariableTable::outputCPPGlobalVariablesDtorIncludes(CodeGenerator &cg, + AnalysisResultPtr ar) { + std::set dtorIncludes; + for (StringToStaticGlobalInfoPtrMap::const_iterator iter = + m_staticGlobals.begin(); iter != m_staticGlobals.end(); ++iter) { + StaticGlobalInfoPtr sgi = iter->second; + if (!sgi->func) { + TypePtr varType = sgi->variables->getFinalType(sgi->name); + if (varType->isSpecificObject()) { + ClassScopePtr cls = ar->findClass(varType->getName()); + ASSERT(cls && !cls->isRedeclaring()); + if (cls->isUserClass()) { + const string fileBase = cls->getFileScope()->outputFilebase(); + if (dtorIncludes.find(fileBase) == dtorIncludes.end()) { + cg.printInclude(fileBase + ".h"); + dtorIncludes.insert(fileBase); + } + } + } + } + } +} + +void VariableTable::outputCPPGlobalVariablesDtor(CodeGenerator &cg) { + cg.printf("GlobalVariables::~GlobalVariables() {}\n"); +} + +void VariableTable::outputCPPGlobalVariablesGetImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.indentBegin("Variant &GlobalVariables::getImpl(CStrRef str, " + "int64 hash) {\n"); + cg.printDeclareGlobals(); + cg.printf("const char *s __attribute__((__unused__)) = str.data();\n"); + outputCPPJumpTable(cg, ar, NULL, false, true, EitherStatic); + cg.printf("return lvalAt(str, hash);\n"); + cg.indentEnd("}\n"); +} + +void VariableTable::outputCPPGlobalVariablesExists(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.indentBegin("bool GlobalVariables::exists(const char *s, " + "int64 hash /* = -1 */) const {\n"); + cg.printDeclareGlobals(); + outputCPPJumpTable(cg, ar, NULL, false, false, + EitherStatic, JumpInitialized); + cg.printf("return LVariableTable::exists(s, hash);\n"); + cg.indentEnd("}\n"); +} + +void VariableTable::outputCPPGlobalVariablesGetIndex(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.indentBegin("ssize_t GlobalVariables::getIndex(const char* s, " + "int64 prehash) const {\n"); + cg.printDeclareGlobals(); + outputCPPJumpTable(cg, ar, NULL, true, true, EitherStatic, JumpIndex); + cg.printf("return m_px ? (m_px->getIndex(s, prehash) + %d) : %d;\n", + m_symbols.size(), ArrayData::invalid_index); + cg.indentEnd("}\n"); +} + +void VariableTable::outputCPPGlobalVariablesMethods(CodeGenerator &cg, + AnalysisResultPtr ar) { + int maxIdx = m_symbols.size(); + + cg.indentBegin("CVarRef GlobalVariables::getRefByIdx(ssize_t idx, " + "Variant &k) {\n"); + cg.printDeclareGlobals(); + cg.indentBegin("static const char *names[] = {\n"); + for (int i = 0; i < maxIdx; i++) { + const string &name = m_symbols[i]; + cg.printf("\"%s\",\n", name.c_str()); + } + cg.indentEnd("};\n"); + cg.indentBegin("if (idx >= 0 && idx < %d) {\n", maxIdx); + cg.printf("k = names[idx];\n"); + cg.printf("switch (idx) {\n"); + for (int i = 0; i < maxIdx; i++) { + const string &name = m_symbols[i]; + cg.printf("case %d: return %s;\n", i, + getGlobalVariableName(ar, name).c_str()); + } + cg.printf("}\n"); + cg.indentEnd("}\n"); + cg.printf("return Globals::getRefByIdx(idx, k);\n"); + cg.indentEnd("}\n"); +} + +void VariableTable::outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) { + bool inPseudoMain = isPseudoMainTable(); + if (inPseudoMain || needGlobalPointer()) { + cg.printDeclareGlobals(); + } + if (inPseudoMain) { + if (m_allVariants) { + cg.printf("LVariableTable *gVariables __attribute__((__unused__)) = " + "get_variable_table();\n"); + } else { + ASSERT(false); + cg.printf("RVariableTable *gVariables __attribute__((__unused__)) = " + "get_variable_table();\n"); + } + } + + bool declared = false; + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + if (isSystem(name) && cg.getOutput() != CodeGenerator::SystemCPP) { + continue; + } + + if (isStatic(name)) { + string id = StaticGlobalInfo::getId + (ar->getClassScope(), ar->getFunctionScope(), name); + + TypePtr type = getFinalType(name); + type->outputCPPDecl(cg, ar); + if (ar->getClassScope()) { + const char *cname = ar->getFunctionScope()->isStatic() ? "cls" : + "this->o_getClassName()"; + cg.printf(" &%s%s __attribute__((__unused__)) = " + "g->%s%s.lvalAt(%s);\n", + Option::StaticVariablePrefix, name.c_str(), + Option::StaticVariablePrefix, id.c_str(), cname); + cg.printf("Variant &%s%s%s __attribute__((__unused__)) = " + "g->%s%s%s.lvalAt(%s);\n", + Option::InitPrefix, Option::StaticVariablePrefix, + name.c_str(), + Option::InitPrefix, Option::StaticVariablePrefix, id.c_str(), + cname); + } else { + cg.printf(" &%s%s __attribute__((__unused__)) = g->%s%s;\n", + Option::StaticVariablePrefix, name.c_str(), + Option::StaticVariablePrefix, id.c_str()); + cg.printf("bool &%s%s%s __attribute__((__unused__)) = g->%s%s%s;\n", + Option::InitPrefix, Option::StaticVariablePrefix, + name.c_str(), + Option::InitPrefix, Option::StaticVariablePrefix, + id.c_str()); + } + + if (needLocalCopy(name) && !isParameter(name)) { + type->outputCPPDecl(cg, ar); + cg.printf(" %s%s;\n", Option::VariablePrefix, name.c_str()); + declared = true; + } + continue; + } + + if (isParameter(name)) continue; + + const char* prefix = ""; + string init = ""; + if (inPseudoMain) { + prefix = "&"; + init = " __attribute__((__unused__)) = "; + if (cg.getOutput() != CodeGenerator::SystemCPP) { + init += string("(variables != gVariables) ? " + "variables->get(\"") + name + "\") : "; + } + init += "g->"; + if (cg.getOutput() != CodeGenerator::SystemCPP) { + init += getGlobalVariableName(ar, name); + } else { + init += Option::GlobalVariablePrefix; + init += name; + } + } + + if (isGlobal(name)) { + TypePtr type = getFinalType(name); + type->outputCPPDecl(cg, ar); + cg.printf(" &%s%s __attribute__((__unused__)) = g->%s;\n", + Option::GlobalVariablePrefix, name.c_str(), + getGlobalVariableName(ar, name).c_str()); + + if (needLocalCopy(name)) { + type->outputCPPDecl(cg, ar); + cg.printf(" %s%s%s%s;\n", prefix, Option::VariablePrefix, + name.c_str(), init.c_str()); + declared = true; + } + continue; + } + + // local variables + if (!isUnused(name)) { + TypePtr type = getFinalType(name); + type->outputCPPDecl(cg, ar); + cg.printf(" %s%s%s", prefix, getVariablePrefix(ar, name), name.c_str()); + if (inPseudoMain) { + cg.printf("%s", init.c_str()); + } else { + const char *initializer = type->getCPPInitializer(); + if (initializer) { + cg.printf(" = %s", initializer); + } + } + cg.printf(";\n"); + declared = true; + } + } + + if (declared) { + cg.printf("\n"); + } + + if (Option::GenerateCPPMacros && getAttribute(ContainsDynamicVariable) && + cg.getOutput() != CodeGenerator::SystemCPP && !inPseudoMain) { + outputCPPVariableTable(cg, ar); + } +} + +void VariableTable::outputCPPVariableTable(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool inGlobalScope = isGlobalTable(ar); + + string varDecl, initializer, memDecl, params; + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + string varName = string(getVariablePrefix(ar, name)) + name; + TypePtr type = getFinalType(name); + if (!inGlobalScope) { + if (!varDecl.empty()) { + varDecl += ", "; + initializer += ", "; + memDecl += "; "; + params += ", "; + } + varDecl += type->getCPPDecl() + " &" + Option::TempVariablePrefix + name; + initializer += varName + "(" + Option::TempVariablePrefix + name + ")"; + memDecl += type->getCPPDecl() + " &" + varName; + params += varName; + } + } + + cg.printf("\n"); + if (m_allVariants) { + cg.printf("class VariableTable : public LVariableTable {\n"); + } else { + cg.printf("class VariableTable : public RVariableTable {\n"); + } + cg.indentBegin("public:\n"); + if (!inGlobalScope) { + cg.printf("%s;\n", memDecl.c_str()); + if (!initializer.empty()) { + cg.printf("VariableTable(%s) : %s {}\n", varDecl.c_str(), + initializer.c_str()); + } else { + cg.printf("VariableTable(%s) {}\n", varDecl.c_str()); + } + } + + if (m_allVariants) { + cg.indentBegin("virtual Variant &getImpl(CStrRef str, int64 hash) {\n"); + cg.printf("const char *s __attribute__((__unused__)) = str.data();\n"); + outputCPPJumpTable(cg, ar, NULL, false, true, EitherStatic); + cg.printf("return lvalAt(str, hash);\n"); + cg.indentEnd("}\n"); + + if (getAttribute(ContainsExtract)) { + cg.indentBegin("virtual bool exists(const char *s, int64 hash /* = -1 */)" + " const {\n"); + outputCPPJumpTable(cg, ar, NULL, false, false, + EitherStatic, JumpInitialized); + cg.printf("return LVariableTable::exists(s, hash);\n"); + cg.indentEnd("}\n"); + } + } else { + cg.indentBegin("virtual Variant getImpl(const char *s) {\n"); + outputCPPJumpTable(cg, ar, NULL, true, false, EitherStatic); + cg.printf("return rvalAt(s);\n"); + cg.indentEnd("}\n"); + + if (getAttribute(ContainsCompact)) { + cg.indentBegin("virtual bool exists(const char *s) const {\n"); + outputCPPJumpTable(cg, ar, NULL, true, false, + EitherStatic, JumpInitialized); + cg.printf("return RVariableTable::exists(s);\n"); + cg.indentEnd("}\n"); + } + } + + if (!inGlobalScope) { + if (!params.empty()) { + cg.indentEnd("} variableTable(%s);\n", params.c_str()); + } else { + cg.indentEnd("} variableTable;\n"); + } + cg.printf("%sVariableTable* __attribute__((__unused__)) " + "variables = &variableTable;\n", + m_allVariants ? "L" : "R"); + } else { + cg.indentEnd("};\n"); + cg.printf("static ThreadLocal g_variable_tables;\n"); + if (m_allVariants) { + cg.printf("LVariableTable *get_variable_table() " + "{ return g_variable_tables.get();}\n"); + } else { + cg.printf("RVariableTable *get_variable_table() " + "{ return g_variable_tables.get();}\n"); + } + } +} + +void VariableTable::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (isGlobalTable(ar)) { + if (cg.getContext() == CodeGenerator::CppImplementation || + cg.getContext() == CodeGenerator::CppPseudoMain) { + outputCPPGlobalVariablesImpl(cg, ar); + } else { + outputCPPGlobalVariablesHeader(cg, ar); + } + } else { + outputCPPImpl(cg, ar); + } +} + +void VariableTable::outputCPPPropertyDecl(CodeGenerator &cg, + AnalysisResultPtr ar) { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + + // we don't redefine a property that's already defined by a parent class + if (isStatic(name) || findParent(ar, name)) continue; + + cg.printf("public: "); + getFinalType(name)->outputCPPDecl(cg, ar); + cg.printf(" %s%s;\n", Option::PropertyPrefix, name.c_str()); + } +} + +void VariableTable::outputCPPPropertyClone(CodeGenerator &cg, + AnalysisResultPtr ar, + bool dynamicObject /* = false */) { + + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + if (isStatic(name)) continue; + if (getFinalType(name)->is(Type::KindOfVariant)) { + if (!dynamicObject) { + cg.printf("clone->%s%s = %s%s.isReferenced() ? ref(%s%s) : %s%s;\n", + Option::PropertyPrefix, name.c_str(), + Option::PropertyPrefix, name.c_str(), + Option::PropertyPrefix, name.c_str(), + Option::PropertyPrefix, name.c_str()); + } else { + cg.printf("clone->o_set(\"%s\", -1, o_get(\"%s\", -1).isReferenced() ? " + "ref(o_get(\"%s\", -1)) : o_get(\"%s\",-1));\n", + name.c_str(), + name.c_str(), + name.c_str(), + name.c_str()); + } + } else { + cg.printf("clone->%s%s = %s%s;\n", + Option::PropertyPrefix, name.c_str(), + Option::PropertyPrefix, name.c_str()); + } + } +} + +void VariableTable::outputCPPPropertyTable(CodeGenerator &cg, + AnalysisResultPtr ar, + const char *parent, + int dynamicObject /* = 0 */) { + string clsStr = m_blockScope.getId(); + const char *cls = clsStr.c_str(); + + const char *cprefix = Option::ClassPrefix; + const char *op = "::"; + const char *gl = ""; + if (dynamicObject == 1) { + cprefix = Option::ClassStaticsObjectPrefix; + op = "->"; + gl = "g->"; + } + // Statics + bool gdec = false; + cg.indentBegin("Variant %s%s::%sget(const char *s, int64 hash) {\n", + Option::ClassPrefix, cls, Option::ObjectStaticPrefix); + gdec = outputCPPJumpTable(cg, ar, Option::StaticPropertyPrefix, false, + false, Static, JumpReturn); + if (!gdec && dynamicObject == 1) cg.printDeclareGlobals(); + cg.printf("return %s%s%s%s%sget(s, hash);\n", gl, cprefix, + parent, op, Option::ObjectStaticPrefix); + cg.indentEnd("}\n"); + + cg.indentBegin("Variant &%s%s::%slval(const char *s, int64 hash) {\n", + Option::ClassPrefix, cls, Option::ObjectStaticPrefix); + gdec = outputCPPJumpTable(cg, ar, Option::StaticPropertyPrefix, false, + true, Static, JumpReturn); + if (!gdec && dynamicObject == 1) cg.printDeclareGlobals(); + cg.printf("return %s%s%s%s%slval(s, hash);\n", gl, cprefix, + parent, op, Option::ObjectStaticPrefix); + cg.indentEnd("}\n"); + + // All dynamic object needs + if (dynamicObject) return; + + cg.indentBegin("void %s%s::%sget(ArrayElementVec &props) const {\n", + Option::ClassPrefix, cls, Option::ObjectPrefix); + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const char *s = m_symbols[i].c_str(); + if (!isStatic(s)) { + if (getFinalType(s)->is(Type::KindOfVariant)) { + cg.printf("props.push_back(NEW(ArrayElement)(\"%s\", " + "%s%s.isReferenced() ? ref(%s%s) : %s%s));\n", s, + Option::PropertyPrefix, s, Option::PropertyPrefix, s, + Option::PropertyPrefix, s); + } else { + cg.printf("props.push_back(NEW(ArrayElement)(\"%s\", %s%s));\n", s, + Option::PropertyPrefix, s); + } + } + } + cg.printf("%s%s::%sget(props);\n", Option::ClassPrefix, parent, + Option::ObjectPrefix); + cg.indentEnd("}\n"); + + cg.indentBegin("bool %s%s::%sexists(CStrRef s, int64 hash) const {\n", + Option::ClassPrefix, cls, Option::ObjectPrefix); + outputCPPJumpTable(cg, ar, Option::PropertyPrefix, false, false, NonStatic, + JumpExists); + cg.printf("return %s%s::%sexists(s, hash);\n", Option::ClassPrefix, + parent, Option::ObjectPrefix); + cg.indentEnd("}\n"); + + cg.indentBegin("Variant %s%s::%sget(CStrRef s, int64 hash) {\n", + Option::ClassPrefix, cls, Option::ObjectPrefix); + outputCPPJumpTable(cg, ar, Option::PropertyPrefix, false, false, NonStatic, + JumpReturnString); + cg.printf("return %s%s::%sget(s, hash);\n", Option::ClassPrefix, + parent, Option::ObjectPrefix); + cg.indentEnd("}\n"); + + cg.indentBegin("Variant %s%s::%sset(CStrRef s, int64 hash, CVarRef v," + "bool forInit /* = false */) {\n", + Option::ClassPrefix, cls, Option::ObjectPrefix); + outputCPPJumpTable(cg, ar, Option::PropertyPrefix, false, false, NonStatic, + JumpSet); + cg.printf("return %s%s::%sset(s, hash, v, forInit);\n", Option::ClassPrefix, + parent, Option::ObjectPrefix); + cg.indentEnd("}\n"); + + cg.indentBegin("Variant &%s%s::%slval(CStrRef s, int64 hash) {\n", + Option::ClassPrefix, cls, Option::ObjectPrefix); + outputCPPJumpTable(cg, ar, Option::PropertyPrefix, false, true, NonStatic, + JumpReturnString); + cg.printf("return %s%s::%slval(s, hash);\n", Option::ClassPrefix, + parent, Option::ObjectPrefix); + cg.indentEnd("}\n"); +} + +bool VariableTable::outputCPPJumpTable(CodeGenerator &cg, AnalysisResultPtr ar, + const char *prefix, bool defineHash, + bool variantOnly, + StaticSelection staticVar, + JumpTableType type /* = JumpReturn */) { + vector strings; + hphp_const_char_map varIdx; + strings.reserve(m_symbols.size()); + bool hasStatic = false; + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + bool stat = isStatic(name); + if (!stat && (isInherited(name) || findParent(ar, name))) continue; + + if ((!variantOnly || Type::SameType(getFinalType(name), Type::Variant)) && + (staticVar & (stat ? Static : NonStatic))) { + hasStatic |= stat; + if (type == JumpIndex) varIdx[name.c_str()] = strings.size(); + strings.push_back(name.c_str()); + } + } + if (strings.empty()) return false; + + bool res = false; + if (hasStatic) { + cg.printDeclareGlobals(); + ClassScopePtr cls = ar->getClassScope(); + if (cls && cls->needLazyStaticInitializer()) { + cg.printf("lazy_initializer(g);\n"); + } + res = true; + } + + bool useString = (type == JumpExists) || (type == JumpSet) || + (type == JumpReturnString); + + for (JumpTable jt(cg, strings, false, !defineHash, useString); jt.ready(); + jt.next()) { + const char *name = jt.key(); + const char *symbol_prefix = + prefix ? prefix : getVariablePrefix(ar, name); + string varName; + if (prefix == Option::StaticPropertyPrefix) { + varName = string(prefix) + ar->getClassScope()->getId() + + Option::IdPrefix + name; + } else { + varName = string(symbol_prefix) + name; + } + if (symbol_prefix == Option::GlobalVariablePrefix) { + varName = string("g->") + getGlobalVariableName(ar, name); + } else if (symbol_prefix != Option::VariablePrefix && + symbol_prefix != Option::PropertyPrefix) { + varName = string("g->") + varName; + } + switch (type) { + case VariableTable::JumpExists: + cg.printf("HASH_EXISTS_STRING(0x%016llXLL, %s, %d);\n", + hash_string(name), name, strlen(name)); + break; + case VariableTable::JumpReturn: + cg.printf("HASH_RETURN(0x%016llXLL, %s,\n", + hash_string(name), varName.c_str()); + cg.printf(" %s);\n", name); + break; + case VariableTable::JumpSet: + cg.printf("HASH_SET_STRING(0x%016llXLL, %s,\n", + hash_string(name), varName.c_str()); + cg.printf(" %s, %d);\n", name, strlen(name)); + break; + case VariableTable::JumpInitialized: + cg.printf("HASH_INITIALIZED(0x%016llXLL, %s,\n", + hash_string(name), varName.c_str()); + cg.printf(" %s);\n", name); + break; + case VariableTable::JumpIndex: + { + hphp_const_char_map::const_iterator it = varIdx.find(name); + ASSERT(it != varIdx.end()); + ssize_t idx = it->second; + cg.printf("HASH_INDEX(0x%016llXLL, %s, %d);\n", + hash_string(name), name, idx); + } + break; + case VariableTable::JumpReturnString: + cg.printf("HASH_RETURN_STRING(0x%016llXLL, %s,\n", + hash_string(name), varName.c_str()); + cg.printf(" %s, %d);\n", name, strlen(name)); + break; + } + } + + return res; +} + +void VariableTable::outputCPPClassMap(CodeGenerator &cg, + AnalysisResultPtr ar) { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + + int attribute = ClassInfo::IsNothing; + if (isProtected(name)) { + attribute |= ClassInfo::IsProtected; + } else if (isPrivate(name)) { + attribute |= ClassInfo::IsPrivate; + } else { + attribute |= ClassInfo::IsPublic; + } + if (isStatic(name)) { + attribute |= ClassInfo::IsStatic; + } + + cg.printf("(const char *)0x%04X, \"%s\",\n", attribute, name.c_str()); + } + cg.printf("NULL,\n"); +} + +void VariableTable::outputCPPStaticVariables(CodeGenerator &cg, + AnalysisResultPtr ar) { + for (unsigned int i = 0; i < m_symbols.size(); i++) { + const string &name = m_symbols[i]; + if (isStatic(name)) { + ExpressionPtr initValue = + dynamic_pointer_cast(getStaticInitVal(name)); + Variant v; + if (initValue->getScalarValue(v)) { + int len; + string output = getEscapedText(v, len); + // This isn't right, we should store the location of the + // static variable in order to get the current value (as opposed to + // the initial value) at runtime + cg.printf("\"%s\", (const char *)%d, \"%s\",\n", name.c_str(), + len, output.c_str()); + } + } + } + cg.printf("NULL,\n"); +} diff --git a/src/lib/analysis/variable_table.h b/src/lib/analysis/variable_table.h new file mode 100644 index 0000000000000..9ccf7e093f732 --- /dev/null +++ b/src/lib/analysis/variable_table.h @@ -0,0 +1,300 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __VARIABLE_TABLE_H__ +#define __VARIABLE_TABLE_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ModifierExpression); +DECLARE_BOOST_TYPES(CodeError); +DECLARE_BOOST_TYPES(VariableTable); +DECLARE_BOOST_TYPES(Expression); +DECLARE_BOOST_TYPES(ClassScope); +DECLARE_BOOST_TYPES(FunctionScope); + +/** + * These are the only places that a new variable can be declared: + * + * variable = expr|variable|new obj(...) + * static_var_list: T_STATIC T_VARIABLE = static_scalar,... + * class_variable_declaration: class { T_VARIABLE = static_scalar,...} + * T_LIST (variable, T_LIST(...), ...) = ... + * try {...} catch (T obj) {...} + * extract(name_value_pair) + */ +class VariableTable : public SymbolTable { + friend class VariableTableHook; + friend class AssignmentExpression; +public: + enum Attribute { + ContainsDynamicVariable = 1, + ContainsLDynamicVariable = ContainsDynamicVariable | 2, + ContainsExtract = 4, + ContainsCompact = 8, + InsideStaticStatement = 16, + InsideGlobalStatement = 32, + ForceGlobal = 64, + ContainsUnset = 128, + NeedGlobalPointer = 256, + ContainsDynamicStatic = 512, + }; + + enum VariableProperty { + VariablePresent = 1, + VariableStatic = 2 + }; + + enum JumpTableType { + JumpReturn, + JumpExists, + JumpSet, + JumpInitialized, + JumpIndex, + JumpReturnString + }; + +public: + VariableTable(BlockScope &blockScope); + ~VariableTable(); + + /** + * Get/set attributes. + */ + void setAttribute(Attribute attr) { m_attribute |= attr;} + void clearAttribute(Attribute attr) { m_attribute &= ~attr;} + bool getAttribute(Attribute attr) const { + return (m_attribute & attr) == attr; + } + + bool isParameter(const std::string &name) const; + bool isPublic(const std::string &name) const; + bool isProtected(const std::string &name) const; + bool isPrivate(const std::string &name) const; + bool isStatic(const std::string &name) const; + bool isGlobal(const std::string &name) const; + bool isSuperGlobal(const std::string &name) const; + bool isLocal(const std::string &name) const; + bool isRedeclared(const std::string &name) const; + bool isNestedGlobal(const std::string &name) const; + bool isNestedStatic(const std::string &name) const; + bool isLvalParam(const std::string &name) const; + bool isReferenced(const std::string &name) const; + bool isUnused(const std::string &name) const; + + bool needLocalCopy(const std::string &name) const; + bool needGlobalPointer() const; + bool isPseudoMainTable() const; + + virtual bool isInherited(const std::string &name) const; + + const char *getVariablePrefix(AnalysisResultPtr ar, + const std::string &name) const; + std::string getVariableName(AnalysisResultPtr ar, + const std::string &name) const; + std::string getGlobalVariableName(AnalysisResultPtr ar, + const std::string &name) const; + + /** + * Get all variable's names. + */ + void getNames(std::set &names, + bool collectPrivate = true) const; + + /** + * Add a function's parameter to this table. + */ + TypePtr addParam(const std::string &name, TypePtr type, + AnalysisResultPtr ar, ConstructPtr construct); + + /** + * Called when a variable is declared or being assigned (l-value). + */ + TypePtr add(const std::string &name, TypePtr type, bool implicit, + AnalysisResultPtr ar, ConstructPtr construct, + ModifierExpressionPtr modifiers, bool checkError = true); + + /** + * Called when a variable is used or being evaluated (r-value). + */ + TypePtr checkVariable(const std::string &name, TypePtr type, bool coerce, + AnalysisResultPtr ar, ConstructPtr construct, + int &properties); + + /** + * Called when a property is used or being evaluated (r-value). + */ + TypePtr checkProperty(const std::string &name, TypePtr type, bool coerce, + AnalysisResultPtr ar, ConstructPtr construct, + int &properties); + + /** + * Walk up to find first parent that has the specified symbol. + */ + ClassScopePtr findParent(AnalysisResultPtr ar, const std::string &name); + + /** + * Called when analyze global and static statement. + */ + bool checkRedeclared(const std::string &name, Statement::KindOf kindOf); + void addNestedGlobal(const std::string &name); + void addNestedStatic(const std::string &name); + + /** + * Helper for static variable default value + */ + ConstructPtr getStaticInitVal(std::string varName); + bool setStaticInitVal(std::string varName, ConstructPtr value); + + /** + * Called when analyze simple variable + */ + void addLvalParam(const std::string &name); + void addReferenced(const std::string &name); + void addUnused(const std::string &name); + + /** + * Set all variables to variants, since l-dynamic value was used. + */ + void forceVariants(AnalysisResultPtr ar); + + /** + * Set one variable to be Type::Variant. + */ + void forceVariant(AnalysisResultPtr ar, const std::string &name); + + /** + * Keep track of $GLOBALS['var']. + */ + void addSuperGlobal(const std::string &name); + bool isConvertibleSuperGlobal(const std::string &name) const; + + /** + * Generate all variable declarations for this symbol table. + */ + void outputPHP(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPP(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPPropertyDecl(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPPropertyClone(CodeGenerator &cg, AnalysisResultPtr ar, + bool dynamicObject = false); + void outputCPPPropertyTable(CodeGenerator &cg, AnalysisResultPtr ar, + const char *parent, int dynamicObject = 0); + void outputCPPClassMap(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPStaticVariables(CodeGenerator &cg, AnalysisResultPtr ar); + + void outputCPPGlobalVariablesDtorIncludes(CodeGenerator &cg, + AnalysisResultPtr ar); + void outputCPPGlobalVariablesDtor(CodeGenerator &cg); + void outputCPPGlobalVariablesGetImpl(CodeGenerator &cg, + AnalysisResultPtr ar); + void outputCPPGlobalVariablesExists(CodeGenerator &cg, + AnalysisResultPtr ar); + void outputCPPGlobalVariablesGetIndex(CodeGenerator &cg, + AnalysisResultPtr ar); + void outputCPPGlobalVariablesMethods(CodeGenerator &cg, + AnalysisResultPtr ar); + void outputCPPGlobalState(CodeGenerator &cg, AnalysisResultPtr ar); + + void *getHookData() { return m_hookData;} + static void setHookHandler(void (*hookHandler)(AnalysisResultPtr ar, + VariableTable *variables, + ExpressionPtr variable, + HphpHookUniqueId id)) { + m_hookHandler = hookHandler; + } + +private: + enum StaticSelection { + NonStatic = 1, + Static = 2, + EitherStatic = 3 + }; + + int m_attribute; + std::map m_parameters; + std::set m_protected; + std::set m_private; + std::set m_static; + std::set m_global; + std::set m_superGlobals; + std::set m_redeclared; + std::set m_nestedGlobal; // the name occurred in a + // nested global statement + std::set m_nestedStatic; // the name occurred in a + // nested static statement + std::set m_lvalParam; // the non-readonly parameters + std::set m_referenced; // the referenced variables + std::set m_unused; // unused local variables + StringToConstructPtrMap m_staticInitVal; // static stmt variable init value + + /** + * These are static variables collected from different local scopes, + * as they have to be turned into global variables defined in + * GlobalVariables class to make ThreadLocal work. + * This data structure is only needed by global scope. + */ + DECLARE_BOOST_TYPES(StaticGlobalInfo); + struct StaticGlobalInfo { + std::string name; + VariableTable *variables; // where this variable was from + ClassScopePtr cls; + FunctionScopePtr func; + + // get unique identifier for this variable + static std::string getId(ClassScopePtr cls, FunctionScopePtr func, + const std::string &name); + }; + StringToStaticGlobalInfoPtrMap m_staticGlobals; + + bool m_allVariants; + + bool isGlobalTable(AnalysisResultPtr ar) const; + + void addStaticVariable(const std::string &name, AnalysisResultPtr ar, + bool member = false); + + virtual TypePtr setType(AnalysisResultPtr ar, const std::string &name, + TypePtr type, bool coerce); + virtual void dumpStats(std::map &typeCounts); + + + void outputCPPGlobalVariablesHeader(CodeGenerator &cg, + AnalysisResultPtr ar); + void outputCPPGlobalVariablesImpl(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPVariableTable(CodeGenerator &cg, AnalysisResultPtr ar); + bool outputCPPJumpTable(CodeGenerator &cg, AnalysisResultPtr ar, + const char *prefix, bool defineHash, + bool variantOnly, StaticSelection staticVar, + JumpTableType type = JumpReturn); + + // hook + static void (*m_hookHandler)(AnalysisResultPtr ar, + VariableTable *variables, + ExpressionPtr variable, + HphpHookUniqueId id); + void *m_hookData; +}; +} + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __VARIABLE_TABLE_H__ diff --git a/src/lib/code_generator.cpp b/src/lib/code_generator.cpp new file mode 100644 index 0000000000000..40563a837f308 --- /dev/null +++ b/src/lib/code_generator.cpp @@ -0,0 +1,326 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// +// statics + +void CodeGenerator::BuildJumpTable(const std::vector &strings, + MapIntToStringVec &out, int tableSize, + bool caseInsensitive) { + ASSERT(!strings.empty()); + ASSERT(out.empty()); + ASSERT(tableSize > 0); + + for (unsigned int i = 0; i < strings.size(); i++) { + const char *s = strings[i]; + int hash = (caseInsensitive ? hash_string_i(s) : hash_string(s)) % + tableSize; + out[hash].push_back(s); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +CodeGenerator::CodeGenerator(std::ostream *primary, + Output output /* = PickledPHP */, + std::string *filename /* = NULL */) + : m_out(NULL), m_output(output), m_context(NoContext), m_itemIndex(-1) { + for (int i = 0; i < StreamCount; i++) { + m_streams[i] = NULL; + m_indentation[i] = 0; + m_indentPending[i] = false; + m_lineNo[i] = 1; + m_inComments[i] = 0; + } + setStream(PrimaryStream, primary); + useStream(PrimaryStream); + + if (filename) m_filename = *filename; +} + +void CodeGenerator::useStream(Stream stream) { + ASSERT(stream >= NullStream && stream < StreamCount); + m_curStream = stream; + if (stream == NullStream) { + m_out = NULL; + } else { + m_out = m_streams[stream]; + } +} + +bool CodeGenerator::usingStream(Stream stream) { + ASSERT(stream >= 0 && stream < StreamCount); + return m_out == m_streams[stream]; +} + +std::ostream *CodeGenerator::getStream(Stream stream) const { + ASSERT(stream >= 0 && stream < StreamCount); + return m_streams[stream]; +} + +void CodeGenerator::setStream(Stream stream, std::ostream *out) { + ASSERT(out); + ASSERT(stream >= 0 && stream < StreamCount); + m_streams[stream] = out; +} + +int CodeGenerator::getLineNo(Stream stream) const { + ASSERT(stream >= 0 && stream < StreamCount); + return m_lineNo[stream]; +} + +/////////////////////////////////////////////////////////////////////////////// + +void CodeGenerator::printf(const char *fmt, ...) { + va_list ap; va_start(ap, fmt); print(fmt, ap); va_end(ap); +} + +void CodeGenerator::indentBegin(const char *fmt, ...) { + va_list ap; va_start(ap, fmt); print(fmt, ap); va_end(ap); + m_indentation[m_curStream]++; +} + +void CodeGenerator::indentEnd(const char *fmt, ...) { + ASSERT(m_indentation[m_curStream]); + m_indentation[m_curStream]--; + va_list ap; va_start(ap, fmt); print(fmt, ap); va_end(ap); +} + +bool CodeGenerator::inComments() const { + return m_inComments[m_curStream] > 0; +} + +void CodeGenerator::startComments() { + m_inComments[m_curStream]++; + printf(" /*"); +} + +void CodeGenerator::endComments() { + ASSERT(m_inComments[m_curStream] > 0); + m_inComments[m_curStream]--; + printf(" */"); +} + +void CodeGenerator::printSection(const char *name, bool newline /* = true */) { + if (newline) printf("\n"); + printf("// %s\n", name); +} + +void CodeGenerator::printSeparator() { + printf("///////////////////////////////////////" + "////////////////////////////////////////\n"); +} + +void CodeGenerator::namespaceBegin() { + printf("\n"); + printf("namespace HPHP {\n"); + printSeparator(); + printf("\n"); +} + +void CodeGenerator::namespaceEnd() { + printf("\n"); + printSeparator(); + printf("}\n"); +} + +void CodeGenerator::headerBegin(const std::string &file) { + string formatted = file; + Util::replaceAll(formatted, ".", "_"); + Util::replaceAll(formatted, "/", "_"); + Util::replaceAll(formatted, "-", "_"); + Util::replaceAll(formatted, "$", "_"); + string id = Util::toUpper(formatted); + + printf("\n"); + printf("#ifndef __GENERATED_%s__\n", id.c_str()); + printf("#define __GENERATED_%s__\n", id.c_str()); + printf("\n"); +} + +void CodeGenerator::headerEnd(const std::string &file) { + string formatted = file; + Util::replaceAll(formatted, ".", "_"); + Util::replaceAll(formatted, "/", "_"); + Util::replaceAll(formatted, "-", "_"); + Util::replaceAll(formatted, "$", "_"); + string id = Util::toUpper(formatted); + + printf("\n"); + printf("#endif // __GENERATED_%s__\n", id.c_str()); +} + +void CodeGenerator::printInclude(const std::string &file) { + ASSERT(!file.empty()); + + string formatted = file; + if (file[0] != '"' && file[0] != '<') { + if (file.substr(file.length() - 2) != ".h") { + formatted += ".h"; + } + formatted = string("<") + formatted + '>'; + } + printf("#include %s\n", formatted.c_str()); +} + +void CodeGenerator::printDeclareGlobals() { + if (getOutput() == SystemCPP) { + printf("DECLARE_SYSTEM_GLOBALS(g);\n"); + } else { + printf("DECLARE_GLOBAL_VARIABLES(g);\n"); + } +} + +void CodeGenerator::printStartOfJumpTable(int tableSize) { + if (Util::isPowerOfTwo(tableSize)) { + indentBegin("switch (hash & %d) {\n", tableSize-1); + } else { + indentBegin("switch (hash %% %d) {\n", tableSize); + } +} + +const char *CodeGenerator::getGlobals() { + return getOutput() == CodeGenerator::SystemCPP ? + "get_system_globals()" : "get_global_variables()"; +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +void CodeGenerator::print(const char *fmt, va_list ap) { + string msg; + bool done = false; + for (int len = 1024; !done; len <<= 1) { + va_list v; + va_copy(v, ap); + + char *buf = (char*)malloc(len); + if (vsnprintf(buf, len, fmt, v) < len) { + msg = buf; + done = true; + } + free(buf); + + va_end(v); + } + if (m_out) { + print(msg); + } +} + +void CodeGenerator::print(const std::string &msg) { + // empty line doesn't need indentation + if (msg.size() == 1 && msg[0] == '\n') { + *m_out << '\n'; + m_lineNo[m_curStream]++; + m_indentPending[m_curStream] = true; + return; + } + + if (m_indentPending[m_curStream]) { + m_indentPending[m_curStream] = false; + for (int i = 0; i < m_indentation[m_curStream]; i++) { + *m_out << Option::Tab; + } + } + for (unsigned int i = 0; i < msg.length(); i++) { + unsigned char ch = msg[i]; + *m_out << ch; + if (ch == '\n') { + m_lineNo[m_curStream]++; + if (m_indentPending[m_curStream]) { + for (int i = 0; i < m_indentation[m_curStream]; i++) { + *m_out << Option::Tab; + } + } + m_indentPending[m_curStream] = true; + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +int CodeGenerator::s_idLambda = 0; +string CodeGenerator::GetNewLambda() { + return Option::LambdaPrefix + "lambda_" + + boost::lexical_cast(++s_idLambda); +} + +void CodeGenerator::resetIdCount(const std::string &key) { + m_idCounters[key] = 0; +} + +int CodeGenerator::createNewId(const std::string &key) { + return ++m_idCounters[key]; +} + +int CodeGenerator::createNewId(AnalysisResultPtr ar) { + FileScopePtr fs = ar->getFileScope(); + if (fs) { + return createNewId(fs->getName()); + } + return createNewId(""); +} + +void CodeGenerator::pushBreakScope(int labelId, + bool loopCounter /* = true */) { + m_breakScopes.push_back(labelId); + if (loopCounter) { + printf("LOOP_COUNTER(%d);\n", labelId); + } +} + +void CodeGenerator::popBreakScope() { + m_breakScopes.pop_back(); + if (m_breakScopes.size() == 0) { + m_breakLabelIds.clear(); + m_contLabelIds.clear(); + } +} + +void CodeGenerator::addLabelId(const char *name, int labelId) { + if (!strcmp(name, "break")) { + m_breakLabelIds.insert(labelId); + } else if (!strcmp(name, "continue")) { + m_contLabelIds.insert(labelId); + } else { + ASSERT(false); + } +} + +bool CodeGenerator::findLabelId(const char *name, int labelId) { + if (!strcmp(name, "break")) { + return m_breakLabelIds.find(labelId) != m_breakLabelIds.end(); + } else if (!strcmp(name, "continue")) { + return m_contLabelIds.find(labelId) != m_contLabelIds.end(); + } else { + ASSERT(false); + } + return false; +} diff --git a/src/lib/code_generator.h b/src/lib/code_generator.h new file mode 100644 index 0000000000000..620902ecb2a07 --- /dev/null +++ b/src/lib/code_generator.h @@ -0,0 +1,213 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CODE_GENERATOR_H__ +#define __CODE_GENERATOR_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(AnalysisResult); +DECLARE_BOOST_TYPES(Statement); + +class CodeGenerator { +public: + enum Output { + InvalidOutput, + + PickledPHP, // stripped comments, etc. but 1 to 1 file to file + InlinedPHP, // all includes are inlined + TrimmedPHP, // unreferenced functions and classes are removed + MonoCPP, // All in one file. Left in for test. Not fully correct. + FileCPP, // 1 to 1 from php to cpp file + ClusterCPP, // each directory up to a certain depth to a cpp file + SystemCPP, // special mode for generating builtin classes + }; + + enum Stream { + NullStream = -1, // suppress output + PrimaryStream, // main output + ImplFile, // C++ implementation file + FatFile = ImplFile, // trimmed functions and classes + MapFile, // lineno mapping between trimmed and original + + StreamCount + }; + + enum Context { + NoContext, + + CppForwardDeclaration, + CppDeclaration, // functions and classes + CppImplementation, // other statements than declarations + CppPseudoMain, // pseudo mains + CppConstructor, // we are generating class constructor + CppStaticInitializer, // we are genearting static initializer + CppLazyStaticInitializer, // lazy initializer for dynamic statics + CppClassConstantsDecl, + CppClassConstantsImpl, + CppConstantsDecl, // we are generating constant declarations + CppStaticMethodWrapper, // Only used to force parameters to use C*Ref + CppParameterDefaultValueDecl, + CppParameterDefaultValueImpl, + CppFFIDecl, + CppFFIImpl, + HsFFI, + JavaFFI, + JavaFFIInterface, // for translating interfaces + JavaFFICppDecl, // javah is too slow, generate .h ourselves + JavaFFICppImpl, + SwigFFIDecl, + SwigFFIImpl, + + PhpDeclaration, + PhpImplementation, + }; + + enum BreakScopeBit { + InsideSwitch = 0x80000000, + StaticCases = 0x40000000, + BreakScopeBitMask = InsideSwitch | StaticCases + }; + +public: + /** + * Hash strings to numbers so we can build a switch statement. + */ + typedef std::map > MapIntToStringVec; + static void BuildJumpTable(const std::vector &strings, + MapIntToStringVec &out, int tableSize, + bool caseInsensitive); + +public: + CodeGenerator(std::ostream *primary, Output output = PickledPHP, + std::string *filename = NULL); + + /** + * ...if it was passed in from constructor. + */ + std::string getFileName() const { return m_filename;} + + /** + * What kind of program are we generating? + */ + Output getOutput() const { return m_output;} + void setOutput(Output output) { m_output = output;} + + /** + * Stream functions. + */ + void useStream(Stream stream); + bool usingStream(Stream stream); + std::ostream *getStream() const { return m_out;} + std::ostream *getStream(Stream stream) const; + void setStream(Stream stream, std::ostream *out); + + /** + * Output strings. + */ + void printf(const char *fmt, ...); + void indentBegin(const char *fmt, ...); + void indentEnd(const char *fmt, ...); + + /** + * Pre-formatted outputs. + */ + void printSection(const char *name, bool newline = true); + void printSeparator(); + void namespaceBegin(); + void namespaceEnd(); + void headerBegin(const std::string &file); + void headerEnd(const std::string &file); + void printInclude(const std::string &file); + void printDeclareGlobals(); + void printStartOfJumpTable(int tableSize); + const char *getGlobals(); + + /** + * Make sure PHP variables, functions and typenames are unique and + * different from C's built-in keywords and HPHP's. + */ + void resetIdCount(const std::string &key); + int createNewId(const std::string &key); + int createNewId(AnalysisResultPtr ar); + static std::string GetNewLambda(); // for create_function() + + /** + * Contexts allow one construct generates more than one kind of source. + * For example, a ClassStatement generates different source code, depending + * on whether we are generating a header file or an implementation file. + */ + void setContext(Context context) { m_context = context;} + Context getContext() const { return m_context;} + + /** + * Remember comment nested level to avoid double comments. + */ + bool inComments() const; + void startComments(); + void endComments(); + + /** + * Helpers for break/continue scopes. + */ + void pushBreakScope(int labelId, bool loopCounter = true); + void popBreakScope(); + const std::vector &getBreakScopes() const { return m_breakScopes;} + void addLabelId(const char *name, int labelId); + bool findLabelId(const char *name, int labelId); + + /** + * Helpers for keeping track of index in an ExpressionList. + */ + void setItemIndex(int index) { m_itemIndex = index;} + int getItemIndex() { return m_itemIndex;} + + /** + * Get current line number of primary stream. + */ + int getLineNo(Stream stream) const; + +private: + std::string m_filename; + Stream m_curStream; + std::ostream *m_streams[StreamCount]; + std::ostream *m_out; + Output m_output; + bool m_verbose; + + int m_indentation[StreamCount]; + bool m_indentPending[StreamCount]; + int m_lineNo[StreamCount]; + int m_inComments[StreamCount]; + + static int s_idLambda; + std::map m_idCounters; + Context m_context; + std::vector m_breakScopes; + std::set m_breakLabelIds; // break labels referenced + std::set m_contLabelIds; // continue labels referenced + int m_itemIndex; + + void print(const char *fmt, va_list ap); + void print(const std::string &msg); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CODE_GENERATOR_H__ diff --git a/src/lib/construct.cpp b/src/lib/construct.cpp new file mode 100644 index 0000000000000..b6a4805357d14 --- /dev/null +++ b/src/lib/construct.cpp @@ -0,0 +1,112 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +Construct::Construct(LocationPtr loc) + : m_extra(NULL), m_loc(loc), m_fileLevel(false), m_topLevel(false) { +} + +std::string Construct::getText(bool useCache /* = false */) { + std::string &text = m_text; + if (useCache && !text.empty()) return text; + ostringstream o; + CodeGenerator cg(&o, CodeGenerator::PickledPHP); + outputPHP(cg, AnalysisResultPtr()); // we knew PickledPHP won't use ar + text = o.str(); + return text; +} + +void Construct::serialize(JSON::OutputStream &out) const { + out.raw() << "[\"" << m_loc->file << "\"," << + m_loc->line0 << "," << m_loc->char0 << "," << + m_loc->line1 << "," << m_loc->char1 << "]"; +} + +void Construct::addUserFunction(AnalysisResultPtr ar, + const std::string &name, + bool strong /* = true */) { + if (!name.empty()) { + FunctionScopePtr func = ar->findFunction(name); + if (func && func->isUserFunction()) { + ar->getDependencyGraph()->add + (DependencyGraph::KindOfProgramUserFunction, + ar->getName(), func->getName(), func->getStmt()); + ar->addCallee(func->getStmt()); + } + if (strong && ar->getPhase() == AnalysisResult::AnalyzeAll) { + FunctionScopePtr func = ar->getFunctionScope(); + ar->getFileScope()->addFunctionDependency(ar, name, func && + func->isInlined()); + } + } +} + +void Construct::addUserClass(AnalysisResultPtr ar, + const std::string &name, + bool strong /* = true */) { + if (!name.empty()) { + ClassScopePtr cls = ar->findClass(name); + if (cls && cls->isUserClass()) { + ar->getDependencyGraph()->add(DependencyGraph::KindOfProgramUserClass, + ar->getName(), + cls->getName(), cls->getStmt()); + ar->addCallee(cls->getStmt()); + } + if (strong && !ar->isFirstPass()) { + ar->getFileScope()->addClassDependency(ar, name); + } + } +} + +bool Construct::isErrorSuppressed(CodeError::ErrorType e) const { + std::vector &suppressedErrors = + getExtra()->suppressedErrors; + for (unsigned int i = 0; i < suppressedErrors.size(); i++) { + if (suppressedErrors[i] == e) { + return true; + } + } + return false; +} + +void Construct::addHphpNote(const std::string &s) { + ExtraData *extra = getExtra(); + if (s.find("C++") == 0) { + extra->embedded += s.substr(3); + extra->hphpNotes.insert("C++"); + } else { + extra->hphpNotes.insert(s); + } +} + +void Construct::printSource(CodeGenerator &cg) { + if (m_loc) { + cg.printf("/* SRC: %s line %d */\n", m_loc->file, m_loc->line1); + } +} diff --git a/src/lib/construct.h b/src/lib/construct.h new file mode 100644 index 0000000000000..39b24217b3947 --- /dev/null +++ b/src/lib/construct.h @@ -0,0 +1,138 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CONSTRUCT_H__ +#define __CONSTRUCT_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(IParseHandler); +DECLARE_BOOST_TYPES(Location); +DECLARE_BOOST_TYPES(AnalysisResult); + +class IParseHandler { +public: + virtual ~IParseHandler() {} + + /** + * To avoid iteration of parse tree, we move any work that can be done + * in parse phase into this function, so to speed up static analysis. + */ + virtual void onParse(AnalysisResultPtr ar) = 0; +}; + +/** + * Base class of Expression and Statement. + */ +class Construct : public boost::enable_shared_from_this, + public JSON::ISerializable { +public: + Construct(LocationPtr loc); + virtual ~Construct() {} + + LocationPtr getLocation() { return m_loc;} + void setFileLevel() { m_topLevel = m_fileLevel = true;} + void setTopLevel() { m_topLevel = true;} + bool isFileLevel() const { return m_fileLevel;} + bool isTopLevel() const { return m_topLevel;} + virtual bool hasEffect() const { return true;} + + template + static boost::shared_ptr Clone(boost::shared_ptr &constr) { + if (constr) { + return boost::dynamic_pointer_cast(constr->clone()); + } + return boost::shared_ptr(); + } + + /** + * Called when we analyze a program, which file it includes, which function + * and class it uses, etc. + */ + virtual void analyzeProgram(AnalysisResultPtr ar) = 0; + + /** + * Called when generating code. + */ + virtual void outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) = 0; + virtual void outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) = 0; + + /** + * Implements JSON::ISerializable. + */ + virtual void serialize(JSON::OutputStream &out) const; + + /** + * Get canonicalized PHP source code for this construct. + */ + std::string getText(bool useCache = false); + + void addHphpNote(const std::string &s); + bool hasHphpNote(const std::string &s) const { + return m_extra && m_extra->hphpNotes.find(s) != m_extra->hphpNotes.end(); + } + const std::string &getEmbedded() const { + return getExtra()->embedded; + } + void addSuppressError(CodeError::ErrorType e) { + getExtra()->suppressedErrors.push_back(e); + } + bool isErrorSuppressed(CodeError::ErrorType e) const; + +private: + struct ExtraData { + std::set hphpNotes; + std::string embedded; + std::vector suppressedErrors; + }; + mutable ExtraData *m_extra; + std::string m_text; + ExtraData *getExtra() const { + if (m_extra == NULL) { + m_extra = new ExtraData(); + } + return m_extra; + } + +protected: + LocationPtr m_loc; + bool m_fileLevel; // whether or not this is at top level of a file + bool m_topLevel; // whether or not this is at top level of a scope + + /** + * Called by analyzeProgram() to add a reference to a user class or + * function. + */ + void addUserFunction(AnalysisResultPtr ar, const std::string &name, + bool strong = true); + void addUserClass(AnalysisResultPtr ar, const std::string &name, + bool strong = true); + + /** + * Write where this construct was in PHP files. + */ + void printSource(CodeGenerator &cg); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CONSTRUCT_H__ diff --git a/src/lib/expression/array_element_expression.cpp b/src/lib/expression/array_element_expression.cpp new file mode 100644 index 0000000000000..b30d2bd4adf94 --- /dev/null +++ b/src/lib/expression/array_element_expression.cpp @@ -0,0 +1,346 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ArrayElementExpression::ArrayElementExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr variable, ExpressionPtr offset) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_variable(variable), m_offset(offset), m_global(false), + m_dynamicGlobal(false) { +} + +ExpressionPtr ArrayElementExpression::clone() { + ArrayElementExpressionPtr exp(new ArrayElementExpression(*this)); + Expression::deepCopy(exp); + exp->m_variable = Clone(m_variable); + exp->m_offset = Clone(m_offset); + return exp; +} + +void ArrayElementExpression::setContext(Context context) { + m_context |= context; + if (context == Expression::LValue) { + m_variable->setContext(Expression::LValue); + if (m_variable->is(Expression::KindOfObjectPropertyExpression)) { + m_variable->clearContext(Expression::NoLValueWrapper); + } + // special case for $GLOBALS[], see the if (m_global) check in + // ArrayElementExpression::outputCPPImpl, we do not need lvalue wrapper + if (m_variable->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = + dynamic_pointer_cast(m_variable); + if (var->getName() == "GLOBALS") { + m_context |= Expression::NoLValueWrapper; + } + } + } else if (context == Expression::DeepAssignmentLHS || + context == Expression::UnsetContext) { + m_variable->setContext(context); + } +} + +void ArrayElementExpression::clearContext(Context context) { + m_context &= ~context; + if (context == Expression::LValue || context == Expression::DeepAssignmentLHS + || context == Expression::UnsetContext) { + m_variable->clearContext(Expression::LValue); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +bool ArrayElementExpression::appendClassName(const std::string &name) { + if (m_variable->is(Expression::KindOfArrayElementExpression)) { + return dynamic_pointer_cast(m_variable) + ->appendClassName(name); + } + if (m_variable->is(Expression::KindOfSimpleVariable)) { + m_variable = StaticMemberExpressionPtr + (new StaticMemberExpression(m_variable->getLocation(), + Expression::KindOfStaticMemberExpression, + name, m_variable)); + return true; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ArrayElementExpression::analyzeProgram(AnalysisResultPtr ar) { + m_variable->analyzeProgram(ar); + if (m_offset) m_offset->analyzeProgram(ar); +} + +ExpressionPtr ArrayElementExpression::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_variable); + ar->preOptimize(m_offset); + return ExpressionPtr(); +} + +ExpressionPtr ArrayElementExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_variable); + ar->postOptimize(m_offset); + return ExpressionPtr(); +} + +/** + * ArrayElementExpression comes from: + * + * reference_variable[|expr] + * ->object_dim_list[|expr] + * encaps T_VARIABLE[expr] + * encaps ${T_STRING[expr]} + */ +TypePtr ArrayElementExpression::inferTypes(AnalysisResultPtr ar, + TypePtr type, bool coerce) { + ConstructPtr self = shared_from_this(); + + // handling $GLOBALS[...] + if (m_variable->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = + dynamic_pointer_cast(m_variable); + if (var->getName() == "GLOBALS") { + m_global = true; + m_dynamicGlobal = true; + ar->getScope()->getVariables()-> + setAttribute(VariableTable::NeedGlobalPointer); + VariableTablePtr vars = ar->getVariables(); + + + if (m_offset && m_offset->is(Expression::KindOfScalarExpression)) { + ScalarExpressionPtr offset = + dynamic_pointer_cast(m_offset); + + if (offset->isLiteralString()) { + m_globalName = offset->getIdentifier(); + if (!m_globalName.empty()) { + m_dynamicGlobal = false; + ar->getScope()->getVariables()-> + setAttribute(VariableTable::NeedGlobalPointer); + TypePtr ret; + ConstructPtr decl = vars->getDeclaration(m_globalName); + if (decl) { + ar->getDependencyGraph()-> + add(DependencyGraph::KindOfGlobalVariable, + ar->getName(), + m_globalName, self, m_globalName, decl); + } + if (coerce) { + ret = vars->add(m_globalName, type, true, ar, self, + ModifierExpressionPtr()); + } else { + int p; + ret = vars->checkVariable(m_globalName, type, coerce, ar, self, p); + } + ar->getScope()->getVariables()->addSuperGlobal(m_globalName); + return ret; + } + } + } else { + vars->setAttribute(VariableTable::ContainsDynamicVariable); + } + + + if (hasContext(LValue) || hasContext(RefValue)) { + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UseLDynamicVariable, + self); + } + ar->getVariables()->forceVariants(ar); + ar->getVariables()-> + setAttribute(VariableTable::ContainsLDynamicVariable); + } else { + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UseRDynamicVariable, + self); + } + } + if (m_offset) { + m_offset->inferAndCheck(ar, NEW_TYPE(Primitive), false); + } + return Type::Variant; // so not to lose values + } + } + if (hasContext(LValue) || hasContext(RefValue)) { + m_variable->setContext(LValue); + } + + TypePtr varType; + if (m_offset) { + varType = m_variable->inferAndCheck(ar, NEW_TYPE(Sequence), false); + m_offset->inferAndCheck(ar, NEW_TYPE(Any), false); + } else { + if (hasContext(IssetContext) || hasContext(UnsetContext)) { + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::InvalidArrayElement, + self); + } + } + m_variable->inferAndCheck(ar, Type::Array, true); + } + if (varType && Type::SameType(varType, Type::String)) { + return Type::String; + } + return Type::Variant; // so not to lose values +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ArrayElementExpression::outputPHP(CodeGenerator &cg, + AnalysisResultPtr ar) { + if (Option::ConvertSuperGlobals && m_global && !m_dynamicGlobal && + ar && (ar->getScope() == ar || ar->getScope()-> + getVariables()->isConvertibleSuperGlobal(m_globalName))) { + cg.printf("$%s", m_globalName.c_str()); + } else { + m_variable->outputPHP(cg, ar); + cg.printf("["); + if (m_offset) m_offset->outputPHP(cg, ar); + cg.printf("]"); + } +} + +void ArrayElementExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + if (m_global) { + if (!m_globalName.empty()) { + VariableTablePtr variables = ar->getScope()->getVariables(); + cg.printf("g->%s", + variables->getGlobalVariableName(ar, m_globalName).c_str()); + } else { + cg.printf("get_variable_table()->get("); + m_offset->outputCPP(cg, ar); + cg.printf(")"); + } + } else { + TypePtr type = m_variable->getActualType(); + if (hasContext(UnsetContext)) { + cg.printf("unsetLval("); + m_variable->outputCPP(cg, ar); + cg.printf(", "); + } else { + if (type && (type->isInteger() || + type->is(Type::KindOfDouble) || + type->is(Type::KindOfObject) || + type->is(Type::KindOfBoolean))) { + cg.printf("((Variant)"); + m_variable->outputCPP(cg, ar); + cg.printf(")"); + } else { + m_variable->outputCPP(cg, ar); + } + } + if (m_offset) { + if (hasContext(UnsetContext)) { + // do nothing + } else if (m_context & InvokeArgument) { + cg.printf(".refvalAt("); + } else if (m_context & (LValue|RefValue)) { + cg.printf(".lvalAt("); + } else { + cg.printf(".rvalAt("); + } + m_offset->outputCPP(cg, ar); + if (!type || !type->is(Type::KindOfString)) { + ScalarExpressionPtr sc = + dynamic_pointer_cast(m_offset); + if (sc) { + int64 hash = sc->getHash(); + if (hash >= 0) { + cg.printf(", 0x%016llXLL", hash); + } + } + } + cg.printf(")"); + } else { + cg.printf(".lvalAt()"); + } + } +} + +void ArrayElementExpression::outputCPPExistTest(CodeGenerator &cg, + AnalysisResultPtr ar, int op) { + switch (op) { + case T_ISSET: cg.printf("isset("); break; + case T_EMPTY: cg.printf("empty("); break; + default: ASSERT(false); + } + + if (m_global) { + if (!m_globalName.empty()) { + VariableTablePtr variables = ar->getScope()->getVariables(); + cg.printf("g->%s", + variables->getGlobalVariableName(ar, m_globalName).c_str()); + } else { + cg.printf("get_variable_table()->get("); + m_offset->outputCPP(cg, ar); + cg.printf(")"); + } + } else { + m_variable->outputCPP(cg, ar); + cg.printf(", "); + m_offset->outputCPP(cg, ar); + ScalarExpressionPtr sc = + dynamic_pointer_cast(m_offset); + if (sc) { + int64 hash = sc->getHash(); + if (hash >= 0) { + cg.printf(", 0x%016llXLL", hash); + } + } + } + cg.printf(")"); +} +void ArrayElementExpression::outputCPPUnset(CodeGenerator &cg, + AnalysisResultPtr ar) { + if (isSuperGlobal()) { + Expression::outputCPPUnset(cg, ar); + } else { + m_variable->outputCPP(cg, ar); + cg.printf(".weakRemove("); + m_offset->outputCPP(cg, ar); + ScalarExpressionPtr sc = + dynamic_pointer_cast(m_offset); + if (sc) { + int64 hash = sc->getHash(); + if (hash >= 0) { + cg.printf(", 0x%016llXLL", hash); + } + } + cg.printf(");\n"); + } +} diff --git a/src/lib/expression/array_element_expression.h b/src/lib/expression/array_element_expression.h new file mode 100644 index 0000000000000..646a5f6531e78 --- /dev/null +++ b/src/lib/expression/array_element_expression.h @@ -0,0 +1,70 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __ARRAY_ELEMENT_EXPRESSION_H__ +#define __ARRAY_ELEMENT_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ArrayElementExpression); + +class ArrayElementExpression : public Expression { +public: + ArrayElementExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr variable, ExpressionPtr offset); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool hasEffect() const { + return m_variable->hasEffect() + || (m_offset && m_offset->hasEffect()); + } + virtual bool isRefable() const { return true;} + + ExpressionPtr getVariable() const { return m_variable;} + ExpressionPtr getOffset() const { return m_offset;} + virtual void setContext(Context context); + virtual void clearContext(Context context); + + bool isSuperGlobal() const { return m_global;} + bool isDynamicGlobal() const { return m_dynamicGlobal;} + const std::string &getGlobalName() const { return m_globalName;} + + /** + * This is purely for resolving a nasty case of intepreting + * self::$a[1][2] correctly. + */ + bool appendClassName(const std::string &name); + + virtual void outputCPPExistTest(CodeGenerator &cg, AnalysisResultPtr ar, + int op); + virtual void outputCPPUnset(CodeGenerator &cg, AnalysisResultPtr ar); + +private: + ExpressionPtr m_variable; + ExpressionPtr m_offset; + bool m_global; + bool m_dynamicGlobal; + std::string m_globalName; + std::string m_text; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __ARRAY_ELEMENT_EXPRESSION_H__ diff --git a/src/lib/expression/array_pair_expression.cpp b/src/lib/expression/array_pair_expression.cpp new file mode 100644 index 0000000000000..9105a7fa9612d --- /dev/null +++ b/src/lib/expression/array_pair_expression.cpp @@ -0,0 +1,119 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace HPHP; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ArrayPairExpression::ArrayPairExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr name, ExpressionPtr value, bool ref) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_name(name), m_value(value), m_ref(ref) { + if (m_ref) { + m_value->setContext(Expression::RefValue); + } +} + +ExpressionPtr ArrayPairExpression::clone() { + ArrayPairExpressionPtr exp(new ArrayPairExpression(*this)); + Expression::deepCopy(exp); + exp->m_name = Clone(m_name); + exp->m_value = Clone(m_value); + return exp; +} + +bool ArrayPairExpression::isScalar() const { + return (!m_name || m_name->isScalar()) && m_value->isScalar(); +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +bool ArrayPairExpression::isScalarArrayPair() const { + return (!m_name || m_name->isScalar()) && m_value->isScalar(); +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +bool ArrayPairExpression::containsDynamicConstant(AnalysisResultPtr ar) const { + return (m_name && m_name->containsDynamicConstant(ar)) || + m_value->containsDynamicConstant(ar); +} + +void ArrayPairExpression::analyzeProgram(AnalysisResultPtr ar) { + if (m_name) m_name->analyzeProgram(ar); + m_value->analyzeProgram(ar); +} + +ExpressionPtr ArrayPairExpression::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_name); + ar->preOptimize(m_value); + return ExpressionPtr(); +} + +ExpressionPtr ArrayPairExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_name); + ar->postOptimize(m_value); + return ExpressionPtr(); +} + +TypePtr ArrayPairExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + if (m_name) { + m_name->inferAndCheck(ar, NEW_TYPE(Primitive), false); + } + m_value->inferAndCheck(ar, NEW_TYPE(Some), false); + return type; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ArrayPairExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_name) { + m_name->outputPHP(cg, ar); + cg.printf(" => "); + } + if (m_ref) cg.printf("&"); + m_value->outputPHP(cg, ar); +} + +void ArrayPairExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.printf("ArrayElement("); + if (m_name) { + m_name->outputCPP(cg, ar); + cg.printf(", "); + } + m_value->outputCPP(cg, ar); + if (m_name) { + ScalarExpressionPtr sc = dynamic_pointer_cast(m_name); + if (sc) { + int64 hash = sc->getHash(); + if (hash >= 0) { + cg.printf(", 0x%016llXLL", hash); + } + } + } + cg.printf(")"); +} diff --git a/src/lib/expression/array_pair_expression.h b/src/lib/expression/array_pair_expression.h new file mode 100644 index 0000000000000..70b955a9e5f72 --- /dev/null +++ b/src/lib/expression/array_pair_expression.h @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __ARRAY_PAIR_EXPRESSION_H__ +#define __ARRAY_PAIR_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ArrayPairExpression); + +class ArrayPairExpression : public Expression { +public: + ArrayPairExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr name, ExpressionPtr value, bool ref); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool containsDynamicConstant(AnalysisResultPtr ar) const; + virtual bool isScalar() const; + + ExpressionPtr getName() { return m_name;} + ExpressionPtr getValue() { return m_value;} + + bool hasEffect() const { return m_value->hasEffect(); } + bool isScalarArrayPair() const; + +private: + ExpressionPtr m_name; + ExpressionPtr m_value; + bool m_ref; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __ARRAY_PAIR_EXPRESSION_H__ diff --git a/src/lib/expression/assignment_expression.cpp b/src/lib/expression/assignment_expression.cpp new file mode 100644 index 0000000000000..9c40b03b45dd0 --- /dev/null +++ b/src/lib/expression/assignment_expression.cpp @@ -0,0 +1,344 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +AssignmentExpression::AssignmentExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr variable, ExpressionPtr value, bool ref) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_variable(variable), m_value(value), m_ref(ref) { + m_variable->setContext(Expression::DeepAssignmentLHS); + m_variable->setContext(Expression::AssignmentLHS); + m_variable->setContext(Expression::LValue); + m_variable->setContext(Expression::NoLValueWrapper); + if (ref) { + m_value->setContext(Expression::RefValue); + + // we have &new special case that's handled in this class + m_value->setContext(Expression::NoRefWrapper); + } + // The assignment expression itself must always be handled in + // a by-value fashion even when it is passed to a function that + // expects an argument by reference. + setContext(Expression::NoRefWrapper); +} + +ExpressionPtr AssignmentExpression::clone() { + AssignmentExpressionPtr exp(new AssignmentExpression(*this)); + Expression::deepCopy(exp); + exp->m_variable = Clone(m_variable); + exp->m_value = Clone(m_value); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void AssignmentExpression::onParse(AnalysisResultPtr ar) { + BlockScopePtr scope = ar->getScope(); + + // This is that much we can do during parse phase. + TypePtr type; + if (m_value->is(Expression::KindOfScalarExpression)) { + type = m_value->inferAndCheck(ar, NEW_TYPE(Some), false); + } else if (m_value->is(Expression::KindOfUnaryOpExpression)) { + UnaryOpExpressionPtr uexp = + dynamic_pointer_cast(m_value); + if (uexp->getOp() == T_ARRAY) { + type = Type::Array; + } + } + if (!type) type = NEW_TYPE(Some); + + if (m_variable->is(Expression::KindOfConstantExpression)) { + // ...as in ClassConstant statement + // We are handling this one here, not in ClassConstant, purely because + // we need "value" to store in constant table. + ConstantExpressionPtr exp = + dynamic_pointer_cast(m_variable); + scope->getConstants()->add(exp->getName(), type, m_value, ar, m_variable); + + string name = ar->getClassScope()->getName() + "::" + exp->getName(); + ar->getDependencyGraph()-> + addParent(DependencyGraph::KindOfConstant, "", name, exp); + } else if (m_variable->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = dynamic_pointer_cast(m_variable); + scope->getVariables()->add(var->getName(), type, true, ar, + shared_from_this(), scope->getModifiers()); + var->clearContext(Declaration); // to avoid wrong CodeError + } else { + ASSERT(false); // parse phase shouldn't handle anything else + } +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void AssignmentExpression::analyzeProgram(AnalysisResultPtr ar) { + m_variable->analyzeProgram(ar); + m_value->analyzeProgram(ar); + if (ar->getPhase() == AnalysisResult::AnalyzeAll) { + if (m_ref && m_variable->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = + dynamic_pointer_cast(m_variable); + const std::string &name = var->getName(); + VariableTablePtr variables = ar->getScope()->getVariables(); + variables->addReferenced(name); + } + if (m_variable->is(Expression::KindOfConstantExpression)) { + ConstantExpressionPtr exp = + dynamic_pointer_cast(m_variable); + if (!m_value->isScalar()) { + ar->getScope()->getConstants()->setDynamic(ar, exp->getName()); + } + } + } +} + +ExpressionPtr AssignmentExpression::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_variable); + ar->preOptimize(m_value); + return ExpressionPtr(); +} + +ExpressionPtr AssignmentExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_variable); + ar->postOptimize(m_value); + if (m_variable->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = + dynamic_pointer_cast(m_variable); + const std::string &name = var->getName(); + VariableTablePtr variables = ar->getScope()->getVariables(); + if (!variables->isPseudoMainTable() && + !variables->getAttribute(VariableTable::ContainsDynamicVariable) && + !variables->isReferenced(name) && + variables->isLocal(name)) { + variables->addUnused(name); + if (m_value->isScalar()) { + m_value->setExpectedType(m_expectedType); + return m_value; + } else { + return makeIdCall(ar); + } + } + } + return ExpressionPtr(); +} + +ExpressionPtr AssignmentExpression::makeIdCall(AnalysisResultPtr ar) { + ExpressionListPtr arg = + ExpressionListPtr(new ExpressionList(getLocation(), + Expression::KindOfExpressionList)); + arg->insertElement(m_value); + SimpleFunctionCallPtr result = + SimpleFunctionCallPtr( + new SimpleFunctionCall(getLocation(), + Expression::KindOfSimpleFunctionCall, + "id", arg, NULL)); + result->setFunctionAndClassScope(ar->findHelperFunction("id"), + ClassScopePtr()); + result->setValid(); + result->setNoPrefix(); + result->setActualType(m_value->getActualType()); + result->setExpectedType(m_expectedType); + return result; +} + +TypePtr AssignmentExpression:: +inferTypesImpl(AnalysisResultPtr ar, TypePtr type, bool coerce, + ExpressionPtr variable, + ExpressionPtr value /* = ExpressionPtr() */) { + TypePtr ret = type; + if (value) { + if (coerce) { + ret = value->inferAndCheck(ar, type, coerce); + } else { + ret = value->inferAndCheck(ar, NEW_TYPE(Some), coerce); + } + } + + BlockScopePtr scope = ar->getScope(); + if (variable->is(Expression::KindOfConstantExpression)) { + // ...as in ClassConstant statement + ConstantExpressionPtr exp = + dynamic_pointer_cast(variable); + bool p; + scope->getConstants()->check(exp->getName(), ret, true, ar, variable, p); + } else if (variable->is(Expression::KindOfDynamicVariable)) { + // simptodo: not too sure about this + ar->getFileScope()->setAttribute(FileScope::ContainsLDynamicVariable); + } else if (variable->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = dynamic_pointer_cast(variable); + if (var->getName() == "this" && ar->getClassScope()) { + if (ar->isFirstPass()) { + ar->getCodeError()->record(variable, CodeError::ReassignThis, + variable); + } + } + if (ar->getPhase() == AnalysisResult::LastInference && value) { + if (!value->getExpectedType()) { + value->setExpectedType(variable->getActualType()); + } + } + } + // if the value may involve object, consider the variable as "referenced" + // so that objects are not destructed prematurely. + bool referenced = true; + if (value && value->isScalar()) referenced = false; + if (ret && ret->isNoObjectInvolved()) referenced = false; + if (referenced && variable->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = + dynamic_pointer_cast(variable); + const std::string &name = var->getName(); + VariableTablePtr variables = ar->getScope()->getVariables(); + variables->addReferenced(name); + } + return variable->inferAndCheck(ar, ret, true); +} + +TypePtr AssignmentExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + + if (VariableTable::m_hookHandler) { + VariableTable::m_hookHandler(ar, ar->getScope()->getVariables().get(), + m_variable, + beforeAssignmentExpressionInferTypes); + } + + TypePtr ret = inferTypesImpl(ar, type, coerce, m_variable, m_value); + + if (VariableTable::m_hookHandler) { + VariableTable::m_hookHandler(ar, ar->getScope()->getVariables().get(), + m_variable, + afterAssignmentExpressionInferTypes); + } + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void AssignmentExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + m_variable->outputPHP(cg, ar); + cg.printf(" = "); + if (m_ref) cg.printf("&"); + m_value->outputPHP(cg, ar); +} + +void AssignmentExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + BlockScopePtr scope = ar->getScope(); + bool ref = (m_ref && !m_value->is(Expression::KindOfNewObjectExpression)); + + bool setElement = false; // turning $a['elem'] = $b into $a.set('elem', $b); + bool type_cast = false; + bool setNull = false; + TypePtr m_actualType; + + if (m_variable->is(Expression::KindOfArrayElementExpression)) { + ArrayElementExpressionPtr exp = + dynamic_pointer_cast(m_variable); + m_actualType = m_variable->getActualType(); + if (m_actualType && m_actualType->getKindOf() == Type::KindOfVariant + && !ref) { + //type_cast = true; + } + if (!exp->isSuperGlobal() && !exp->isDynamicGlobal()) { + exp->getVariable()->outputCPP(cg, ar); + if (exp->getOffset()) { + cg.printf(".set("); + exp->getOffset()->outputCPP(cg, ar); + cg.printf(", ("); + } else { + cg.printf(".append(("); + } + if (type_cast) { + m_actualType->outputCPPCast(cg, ar); + cg.printf("("); + } + if (ref && m_value->isRefable()) cg.printf("ref("); + m_value->outputCPP(cg, ar); + if (ref && m_value->isRefable()) cg.printf(")"); + if (type_cast) cg.printf(")"); + cg.printf(")"); + ExpressionPtr off = exp->getOffset(); + if (off) { + ScalarExpressionPtr sc = + dynamic_pointer_cast(off); + if (sc) { + int64 hash = sc->getHash(); + if (hash >= 0) { + cg.printf(", 0x%016llXLL", hash); + } + } + } + cg.printf(")"); + setElement = true; + } + } + if (m_variable->is(Expression::KindOfSimpleVariable) && + m_value->is(Expression::KindOfConstantExpression)) { + ConstantExpressionPtr exp = + dynamic_pointer_cast(m_value); + if (exp->isNull()) setNull = true; + } + + if (!setElement) { + if (setNull) { + cg.printf("setNull("); + m_variable->outputCPP(cg, ar); + cg.printf(")"); + } else { + m_variable->outputCPP(cg, ar); + cg.printf(" = "); + + if (type_cast) { + m_actualType->outputCPPCast(cg, ar); + cg.printf("("); + } + if (ref && m_value->isRefable()) cg.printf("ref("); + m_value->outputCPP(cg, ar); + if (ref && m_value->isRefable()) cg.printf(")"); + if (type_cast) cg.printf(")"); + } + } +} diff --git a/src/lib/expression/assignment_expression.h b/src/lib/expression/assignment_expression.h new file mode 100644 index 0000000000000..345f22d51ef91 --- /dev/null +++ b/src/lib/expression/assignment_expression.h @@ -0,0 +1,56 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __ASSIGNMENT_EXPRESSION_H__ +#define __ASSIGNMENT_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(AssignmentExpression); + +class AssignmentExpression : public Expression, public IParseHandler { +public: + AssignmentExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr variable, ExpressionPtr value, + bool ref); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + + // implementing IParseHandler + virtual void onParse(AnalysisResultPtr ar); + + static TypePtr inferTypesImpl(AnalysisResultPtr ar, TypePtr type, + bool coerce, ExpressionPtr variable, + ExpressionPtr value = ExpressionPtr()); + + ExpressionPtr getVariable() { return m_variable;} + ExpressionPtr getValue() { return m_value;} + +private: + ExpressionPtr makeIdCall(AnalysisResultPtr ar); + + ExpressionPtr m_variable; + ExpressionPtr m_value; + bool m_ref; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __ASSIGNMENT_EXPRESSION_H__ diff --git a/src/lib/expression/binary_op_expression.cpp b/src/lib/expression/binary_op_expression.cpp new file mode 100644 index 0000000000000..be8e2ce5d76d4 --- /dev/null +++ b/src/lib/expression/binary_op_expression.cpp @@ -0,0 +1,854 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +BinaryOpExpression::BinaryOpExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr exp1, ExpressionPtr exp2, int op) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_exp1(exp1), m_exp2(exp2), m_op(op), m_effect(false) { + switch (m_op) { + case T_PLUS_EQUAL: + case T_MINUS_EQUAL: + case T_MUL_EQUAL: + case T_DIV_EQUAL: + case T_CONCAT_EQUAL: + case T_MOD_EQUAL: + case T_AND_EQUAL: + case T_OR_EQUAL: + case T_XOR_EQUAL: + case T_SL_EQUAL: + case T_SR_EQUAL: + m_effect = true; + m_exp1->setContext(Expression::LValue); + if (m_exp1->is(Expression::KindOfObjectPropertyExpression)) { + m_exp1->setContext(Expression::NoLValueWrapper); + } + // The binary op expression itself must always be handled in + // a by-value fashion, even when it is passed to a function that + // expects an argument by reference. + setContext(Expression::NoRefWrapper); + break; + case T_INSTANCEOF: + //m_exp1->setContext(Expression::ObjectContext); + // Fall through + default: + m_effect = (m_exp1->hasEffect() || m_exp2->hasEffect()); + break; + } +} + +ExpressionPtr BinaryOpExpression::clone() { + BinaryOpExpressionPtr exp(new BinaryOpExpression(*this)); + Expression::deepCopy(exp); + exp->m_exp1 = Clone(m_exp1); + exp->m_exp2 = Clone(m_exp2); + return exp; +} + +bool BinaryOpExpression::isLiteralString() const { + if (m_op == '.') { + return m_exp1->isLiteralString() && m_exp2->isLiteralString(); + } + return false; +} + +std::string BinaryOpExpression::getLiteralString() const { + if (m_op == '.') { + return m_exp1->getLiteralString() + m_exp2->getLiteralString(); + } + return ""; +} + +bool BinaryOpExpression::isShortCircuitOperator() const { + switch (m_op) { + case T_BOOLEAN_OR: + case T_BOOLEAN_AND: + case T_LOGICAL_OR: + case T_LOGICAL_AND: + return true; + default: + break; + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void BinaryOpExpression::analyzeProgram(AnalysisResultPtr ar) { + if (m_op == T_INSTANCEOF && m_exp2->is(Expression::KindOfScalarExpression)) { + ScalarExpressionPtr s = dynamic_pointer_cast(m_exp2); + addUserClass(ar, s->getString()); + } + m_exp1->analyzeProgram(ar); + m_exp2->analyzeProgram(ar); +} + +ExpressionPtr BinaryOpExpression::simplifyLogical(AnalysisResultPtr ar) { + if (m_exp1->is(Expression::KindOfConstantExpression)) { + ConstantExpressionPtr con = + dynamic_pointer_cast(m_exp1); + if (con->isBoolean()) { + if (con->getBooleanValue()) { + if (ar->getPhase() >= AnalysisResult::PostOptimize) { + // true && v (true AND v) => v + ASSERT(m_exp2->getType()->is(Type::KindOfBoolean)); + if (m_op == T_BOOLEAN_AND || m_op == T_LOGICAL_AND) return m_exp2; + } + // true || v (true OR v) => true + if (m_op == T_BOOLEAN_OR || m_op == T_LOGICAL_OR) { + return CONSTANT("true"); + } + } else { + if (ar->getPhase() >= AnalysisResult::PostOptimize) { + ASSERT(m_exp2->getType()->is(Type::KindOfBoolean)); + // false || v (false OR v) => v + if (m_op == T_BOOLEAN_OR || m_op == T_LOGICAL_OR) return m_exp2; + } + // false && v (false AND v) => false + if (m_op == T_BOOLEAN_AND || m_op == T_LOGICAL_AND) { + return CONSTANT("false"); + } + } + } + } + if (m_exp2->is(Expression::KindOfConstantExpression)) { + ConstantExpressionPtr con = + dynamic_pointer_cast(m_exp2); + if (con->isBoolean()) { + if (con->getBooleanValue()) { + if (ar->getPhase() >= AnalysisResult::PostOptimize) { + ASSERT(m_exp1->getType()->is(Type::KindOfBoolean)); + // v && true (v AND true) => v + if (m_op == T_BOOLEAN_AND || m_op == T_LOGICAL_AND) return m_exp1; + } + // v || true (v OR true) => true when v does not have effect + if (m_op == T_BOOLEAN_OR || m_op == T_LOGICAL_OR) { + if (!m_exp1->hasEffect()) return CONSTANT("true"); + } + } else { + if (ar->getPhase() >= AnalysisResult::PostOptimize) { + ASSERT(m_exp1->getType()->is(Type::KindOfBoolean)); + // v || false (v OR false) => v + if (m_op == T_BOOLEAN_OR || m_op == T_LOGICAL_OR) return m_exp1; + } + // v && false (v AND false) => false when v does not have effect + if (m_op == T_BOOLEAN_AND || m_op == T_LOGICAL_AND) { + if (!m_exp1->hasEffect()) return CONSTANT("false"); + } + } + } + } + return ExpressionPtr(); +} + +ExpressionPtr BinaryOpExpression::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp1); + ar->preOptimize(m_exp2); + if (!m_exp2->isScalar()) { + if (!m_exp1->isScalar()) return ExpressionPtr(); + } + ExpressionPtr optExp = foldConst(ar); + if (optExp) return optExp; + if (isShortCircuitOperator()) return simplifyLogical(ar); + return ExpressionPtr(); +} + +ExpressionPtr BinaryOpExpression::simplifyArithmetic(AnalysisResultPtr ar) { + Variant v1; + Variant v2; + if (m_exp1->getScalarValue(v1)) { + if (v1.isInteger()) { + int64 ival1 = v1.toInt64(); + // 1 * $a => $a, 0 + $a => $a + if ((ival1 == 1 && m_op == '*') || (ival1 == 0 && m_op == '+')) { + TypePtr actType2 = m_exp2->getActualType(); + TypePtr expType2 = m_exp2->getExpectedType(); + if ((actType2->isInteger() || actType2->is(Type::KindOfDouble)) || + (expType2 && expType2->is(Type::KindOfNumeric) && + Type::IsCastNeeded(ar, actType2, expType2))) { + return m_exp2; + } + } + } else if (v1.isString()) { + String sval1 = v1.toString(); + if ((sval1.empty() && m_op == '.')) { + TypePtr actType2 = m_exp2->getActualType(); + TypePtr expType2 = m_exp2->getExpectedType(); + // '' . $a => $a + if (actType2->is(Type::KindOfString) || + (expType2 && expType2->is(Type::KindOfString) && + Type::IsCastNeeded(ar, actType2, expType2))) { + return m_exp2; + } + } + } + } + if (m_exp2->getScalarValue(v2)) { + if (v2.isInteger()) { + int64 ival2 = v2.toInt64(); + // $a * 1 => $a, $a + 0 => $a + if ((ival2 == 1 && m_op == '*') || (ival2 == 0 && m_op == '+')) { + TypePtr actType1 = m_exp1->getActualType(); + TypePtr expType1 = m_exp1->getExpectedType(); + if ((actType1->isInteger() || actType1->is(Type::KindOfDouble)) || + (expType1 && expType1->is(Type::KindOfNumeric) && + Type::IsCastNeeded(ar, actType1, expType1))) { + return m_exp1; + } + } + } else if (v2.isString()) { + String sval2 = v2.toString(); + if ((sval2.empty() && m_op == '.')) { + TypePtr actType1 = m_exp1->getActualType(); + TypePtr expType1 = m_exp1->getExpectedType(); + // $a . '' => $a + if (actType1->is(Type::KindOfString) || + (expType1 && expType1->is(Type::KindOfString) && + Type::IsCastNeeded(ar, actType1, expType1))) { + return m_exp1; + } + } + } + } + return ExpressionPtr(); +} + +ExpressionPtr BinaryOpExpression::makeConcatCall(AnalysisResultPtr ar, + int count, + ExpressionListPtr expList) { + if (count <= MAX_CONCAT_ARGS) { + if (count > 2) { + char fname[20]; + snprintf(fname, sizeof(fname), "concat%d", count); + SimpleFunctionCallPtr call = + SimpleFunctionCallPtr(new SimpleFunctionCall(getLocation(), + Expression::KindOfSimpleFunctionCall, fname, expList, NULL)); + call->setValid(); + call->setNoPrefix(); + call->setActualType(Type::String); + return call; + } else if (count == 2) { + BinaryOpExpressionPtr result = + BinaryOpExpressionPtr(new BinaryOpExpression(getLocation(), + Expression::KindOfBinaryOpExpression, + (*expList)[0], (*expList)[1], '.')); + result->setActualType(Type::String); + return result; + } else { + return (*expList)[0]; + } + } else { + ExpressionListPtr segList = + ExpressionListPtr(new ExpressionList(getLocation(), + Expression::KindOfExpressionList)); + for (int i = 0; i < MAX_CONCAT_ARGS; i++) { + segList->addElement((*expList)[count - MAX_CONCAT_ARGS + i]); + } + for (int i = 0; i < MAX_CONCAT_ARGS; i++) { + expList->removeElement(count - MAX_CONCAT_ARGS); + } + ExpressionPtr call2 = makeConcatCall(ar, MAX_CONCAT_ARGS, segList); + ExpressionPtr call1 = makeConcatCall(ar, count - MAX_CONCAT_ARGS, expList); + BinaryOpExpressionPtr result = + BinaryOpExpressionPtr(new BinaryOpExpression(getLocation(), + Expression::KindOfBinaryOpExpression, + call1, call2, '.')); + call1->setExpectedType(Type::String); + call2->setExpectedType(Type::String); + result->setActualType(Type::String); + return result; + } +} + +ExpressionPtr BinaryOpExpression::mergeConcat(AnalysisResultPtr ar) { + ExpressionPtr exp1 = m_exp1; + ExpressionListPtr expList = + ExpressionListPtr(new ExpressionList(getLocation(), + Expression::KindOfExpressionList)); + expList->insertElement(m_exp2); + do { + if (!exp1->is(Expression::KindOfBinaryOpExpression)) break; + BinaryOpExpressionPtr binOpExp = + dynamic_pointer_cast(exp1); + if (binOpExp->m_op == '.') { + expList->insertElement(binOpExp->m_exp2); + } else { + break; + } + exp1 = binOpExp->m_exp1; + } while (true); + expList->insertElement(exp1); + int count = expList->getCount(); + ASSERT(count >= 2); + if (count == 2) return ExpressionPtr(); + // work around g++ function arguments evaluation order (right to left), + // cannot have two arguments with side effect. + bool seenEffect = false; + for (int i = 0; i < count; i++) { + if ((*expList)[i]->hasEffect()) { + if (seenEffect) return ExpressionPtr(); + seenEffect = true; + } + } + ExpressionPtr result = makeConcatCall(ar, count, expList); + result->setActualType(getActualType()); + result->setExpectedType(getExpectedType()); + return result; +} + +ExpressionPtr BinaryOpExpression::postOptimize(AnalysisResultPtr ar) { + ExpressionPtr optExp; + if (m_op == '.') { + optExp = mergeConcat(ar); + if (optExp) return optExp; + } + ar->postOptimize(m_exp1); + ar->postOptimize(m_exp2); + optExp = simplifyArithmetic(ar); + if (optExp) return optExp; + if (isShortCircuitOperator()) return simplifyLogical(ar); + return ExpressionPtr(); +} + +ExpressionPtr BinaryOpExpression::foldConst(AnalysisResultPtr ar) { + ExpressionPtr optExp; + Variant v1; + Variant v2; + + if (!m_exp2->getScalarValue(v2)) return ExpressionPtr(); + + if (m_exp1->isScalar()) { + if (!m_exp1->getScalarValue(v1)) return ExpressionPtr(); + Variant result; + switch (m_op) { + case T_LOGICAL_XOR: + result = logical_xor(v1, v2); break; + case '|': + result = bitwise_or(v1, v2); break; + case '&': + result = bitwise_and(v1, v2); break; + case '^': + result = bitwise_xor(v1, v2); break; + case '.': + result = concat(v1, v2); break; + case T_IS_IDENTICAL: + result = same(v1, v2); break; + case T_IS_NOT_IDENTICAL: + result = !same(v1, v2); break; + case T_IS_EQUAL: + result = equal(v1, v2); break; + case T_IS_NOT_EQUAL: + result = !equal(v1, v2); break; + case '<': + result = less(v1, v2); break; + case T_IS_SMALLER_OR_EQUAL: + result = not_more(v1, v2); break; + case '>': + result = more(v1, v2); break; + case T_IS_GREATER_OR_EQUAL: + result = not_less(v1, v2); break; + case '+': + result = plus(v1, v2); break; + case '-': + result = minus(v1, v2); break; + case '*': + result = multiply(v1, v2); break; + case '/': + if ((v2.isIntVal() && v2.toInt64() == 0) || v2.toDouble() == 0.0) { + return ExpressionPtr(); + } + result = divide(v1, v2); break; + case '%': + if ((v2.isIntVal() && v2.toInt64() == 0) || v2.toDouble() == 0.0) { + return ExpressionPtr(); + } + result = modulo(v1, v2); break; + case T_SL: + result = shift_left(v1, v2); break; + case T_SR: + result = shift_right(v1, v2); break; + case T_BOOLEAN_OR: + result = v1 || v2; break; + case T_BOOLEAN_AND: + result = v1 && v2; break; + case T_LOGICAL_OR: + result = v1 || v2; break; + case T_LOGICAL_AND: + result = v1 && v2; break; + default: + break; + } + if (result.isNull()) { + return CONSTANT("null"); + } else if (result.isBoolean()) { + return CONSTANT(result ? "true" : "false"); + } else if (result.isDouble() && !finite(result.getDouble())) { + return ExpressionPtr(); + } else { + return ScalarExpressionPtr + (new ScalarExpression(getLocation(), + Expression::KindOfScalarExpression, + result)); + } + } else { + switch (m_op) { + case T_LOGICAL_XOR: + case '|': + case '&': + case '^': + case '.': + case '+': + case '*': + case T_BOOLEAN_OR: + case T_BOOLEAN_AND: + case T_LOGICAL_OR: + case T_LOGICAL_AND: + optExp = foldConstRightAssoc(ar); + if (optExp) return optExp; + default: + break; + } + } + return ExpressionPtr(); +} + +ExpressionPtr +BinaryOpExpression::foldConstRightAssoc(AnalysisResultPtr ar) { + ExpressionPtr optExp1; + switch (m_op) { + case '.': + case '+': + case '*': + if (m_exp1->is(Expression::KindOfBinaryOpExpression)) { + BinaryOpExpressionPtr binOpExp = + dynamic_pointer_cast(m_exp1); + if (binOpExp->m_op == m_op) { + // turn a Op b Op c, namely (a Op b) Op c into a Op (b Op c) + ExpressionPtr aExp = binOpExp->m_exp1; + ExpressionPtr bExp = binOpExp->m_exp2; + ExpressionPtr cExp = m_exp2; + BinaryOpExpressionPtr bcExp = + BinaryOpExpressionPtr(new BinaryOpExpression(getLocation(), + Expression::KindOfBinaryOpExpression, + bExp, cExp, m_op)); + ExpressionPtr optExp = bcExp->foldConst(ar); + if (optExp) { + BinaryOpExpressionPtr a_bcExp + (new BinaryOpExpression(getLocation(), + Expression::KindOfBinaryOpExpression, + aExp, optExp, m_op)); + optExp = a_bcExp->foldConstRightAssoc(ar); + if (optExp) return optExp; + else return a_bcExp; + } + } + } + break; + default: + break; + } + return ExpressionPtr(); +} + +TypePtr BinaryOpExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + TypePtr et1; // expected m_exp1's type + bool coerce1 = false; // whether m_exp1 needs to coerce to et1 + TypePtr et2; // expected m_exp2's type + bool coerce2 = false; // whether m_exp2 needs to coerce to et2 + TypePtr rt; // return type + + switch (m_op) { + case '+': + case T_PLUS_EQUAL: + if (coerce && Type::SameType(type, Type::Array)) { + et1 = et2 = Type::Array; + coerce1 = coerce2 = true; + rt = Type::Array; + } else { + et1 = NEW_TYPE(PlusOperand); + et2 = NEW_TYPE(PlusOperand); + rt = NEW_TYPE(PlusOperand); + } + break; + case '-': + case '*': + case T_MINUS_EQUAL: + case T_MUL_EQUAL: + case '/': + case T_DIV_EQUAL: + et1 = NEW_TYPE(Numeric); + et2 = NEW_TYPE(Numeric); + rt = NEW_TYPE(Numeric); + break; + case '.': + case T_CONCAT_EQUAL: + et1 = et2 = rt = Type::String; + break; + case '%': + et1 = et2 = Type::Int64; + rt = NEW_TYPE(Numeric); + break; + case T_MOD_EQUAL: + et1 = NEW_TYPE(Numeric); + et2 = Type::Int64; + rt = NEW_TYPE(Numeric); + break; + case '|': + case '&': + case '^': + case T_AND_EQUAL: + case T_OR_EQUAL: + case T_XOR_EQUAL: + et1 = NEW_TYPE(Primitive); + et2 = NEW_TYPE(Primitive); + rt = NEW_TYPE(Primitive); + break; + case T_SL: + case T_SR: + case T_SL_EQUAL: + case T_SR_EQUAL: + et1 = et2 = rt = Type::Int64; + break; + case T_BOOLEAN_OR: + case T_BOOLEAN_AND: + case T_LOGICAL_OR: + case T_LOGICAL_AND: + case T_LOGICAL_XOR: + et1 = et2 = rt = Type::Boolean; + break; + case '<': + case T_IS_SMALLER_OR_EQUAL: + case '>': + case T_IS_GREATER_OR_EQUAL: + case T_IS_IDENTICAL: + case T_IS_NOT_IDENTICAL: + case T_IS_EQUAL: + case T_IS_NOT_EQUAL: + et1 = NEW_TYPE(Some); + et2 = NEW_TYPE(Some); + rt = Type::Boolean; + break; + + case T_INSTANCEOF: + et1 = Type::CreateType(Type::KindOfAny); + et2 = Type::String; + rt = Type::Boolean; + break; + default: + ASSERT(false); + } + + switch (m_op) { + case T_PLUS_EQUAL: + case T_MINUS_EQUAL: + case T_MUL_EQUAL: + case T_DIV_EQUAL: + case T_CONCAT_EQUAL: + case T_MOD_EQUAL: + case T_AND_EQUAL: + case T_OR_EQUAL: + case T_XOR_EQUAL: + case T_SL_EQUAL: + case T_SR_EQUAL: + { + TypePtr ret = m_exp2->inferAndCheck(ar, et2, coerce2); + m_exp1->inferAndCheck(ar, ret, true); + } + break; + case '+': + case '-': + case '*': + { + m_exp1->inferAndCheck(ar, et1, coerce1); + m_exp2->inferAndCheck(ar, et2, coerce2); + TypePtr act1 = m_exp1->getActualType(); + TypePtr act2 = m_exp2->getActualType(); + bool bothEffect = m_exp1->hasEffect() && m_exp2->hasEffect(); + if (act1 && act1->isInteger() && act2 && act2->isInteger() && + !bothEffect) { + rt = Type::Int64; + } + } + break; + default: + m_exp1->inferAndCheck(ar, et1, coerce1); + m_exp2->inferAndCheck(ar, et2, coerce2); + break; + } + return rt; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void BinaryOpExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + m_exp1->outputPHP(cg, ar); + + switch (m_op) { + case T_PLUS_EQUAL: cg.printf(" += "); break; + case T_MINUS_EQUAL: cg.printf(" -= "); break; + case T_MUL_EQUAL: cg.printf(" *= "); break; + case T_DIV_EQUAL: cg.printf(" /= "); break; + case T_CONCAT_EQUAL: cg.printf(" .= "); break; + case T_MOD_EQUAL: cg.printf(" %%= "); break; + case T_AND_EQUAL: cg.printf(" &= "); break; + case T_OR_EQUAL: cg.printf(" |= "); break; + case T_XOR_EQUAL: cg.printf(" ^= "); break; + case T_SL_EQUAL: cg.printf(" <<= "); break; + case T_SR_EQUAL: cg.printf(" >>= "); break; + case T_BOOLEAN_OR: cg.printf(" || "); break; + case T_BOOLEAN_AND: cg.printf(" && "); break; + case T_LOGICAL_OR: cg.printf(" or "); break; + case T_LOGICAL_AND: cg.printf(" and "); break; + case T_LOGICAL_XOR: cg.printf(" xor "); break; + case '|': cg.printf(" | "); break; + case '&': cg.printf(" & "); break; + case '^': cg.printf(" ^ "); break; + case '.': cg.printf(" . "); break; + case '+': cg.printf(" + "); break; + case '-': cg.printf(" - "); break; + case '*': cg.printf(" * "); break; + case '/': cg.printf(" / "); break; + case '%': cg.printf(" %% "); break; + case T_SL: cg.printf(" << "); break; + case T_SR: cg.printf(" >> "); break; + case T_IS_IDENTICAL: cg.printf(" === "); break; + case T_IS_NOT_IDENTICAL: cg.printf(" !== "); break; + case T_IS_EQUAL: cg.printf(" == "); break; + case T_IS_NOT_EQUAL: cg.printf(" != "); break; + case '<': cg.printf(" < "); break; + case T_IS_SMALLER_OR_EQUAL: cg.printf(" <= "); break; + case '>': cg.printf(" > "); break; + case T_IS_GREATER_OR_EQUAL: cg.printf(" >= "); break; + case T_INSTANCEOF: cg.printf(" instanceof "); break; + default: + ASSERT(false); + } + + m_exp2->outputPHP(cg, ar); +} + +void BinaryOpExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool bothEffect = m_exp1->hasEffect() && m_exp2->hasEffect(); + // Reverse exceptions + if (bothEffect) { + switch (m_op) { + case T_PLUS_EQUAL: + case T_MINUS_EQUAL: + case T_MUL_EQUAL: + case T_DIV_EQUAL: + case T_MOD_EQUAL: + case T_AND_EQUAL: + case T_OR_EQUAL: + case T_XOR_EQUAL: + case T_SL_EQUAL: + case T_SR_EQUAL: + case T_BOOLEAN_OR: + case T_BOOLEAN_AND: + case T_LOGICAL_OR: + case T_LOGICAL_AND: + case T_INSTANCEOF: + bothEffect = false; + default: + break; + } + } + + bool wrapped = true; + switch (m_op) { + case T_CONCAT_EQUAL: cg.printf("concat_assign"); break; + case T_LOGICAL_XOR: cg.printf("logical_xor"); break; + case '|': cg.printf("bitwise_or"); break; + case '&': cg.printf("bitwise_and"); break; + case '^': cg.printf("bitwise_xor"); break; + case '.': cg.printf("concat"); break; + case T_IS_IDENTICAL: cg.printf("same"); break; + case T_IS_NOT_IDENTICAL: cg.printf("!same"); break; + case T_IS_EQUAL: cg.printf("equal"); break; + case T_IS_NOT_EQUAL: cg.printf("!equal"); break; + case '<': cg.printf("less"); break; + case T_IS_SMALLER_OR_EQUAL: cg.printf("not_more"); break; + case '>': cg.printf("more"); break; + case T_IS_GREATER_OR_EQUAL: cg.printf("not_less"); break; + case '/': cg.printf("divide"); break; + case '%': cg.printf("modulo"); break; + case T_INSTANCEOF: cg.printf("instanceOf"); break; + default: + if (bothEffect) { + switch (m_op) { + case '+': cg.printf("plus"); break; + case '-': cg.printf("minus"); break; + case '*': cg.printf("multiply"); break; + case T_SL: cg.printf("shift_left"); break; + case T_SR: cg.printf("shift_right"); break; + default: + wrapped = false; + break; + } + } else { + wrapped = false; + } + break; + } + if (bothEffect) { + cg.printf("_rev"); + } + + if (wrapped) cg.printf("("); + + ExpressionPtr first = m_exp1; + ExpressionPtr second = m_exp2; + if (bothEffect) { + first = m_exp2; + second = m_exp1; + } + + // we could implement these functions natively on String and Array classes + switch (m_op) { + case '+': + case '-': + case '*': + case '/': { + TypePtr actualType = first->getActualType(); + + if (actualType && + (actualType->is(Type::KindOfString) || + actualType->is(Type::KindOfArray))) { + cg.printf("(Variant)("); + first->outputCPP(cg, ar); + cg.printf(")"); + } else { + first->outputCPP(cg, ar); + } + break; + } + case T_SL: + case T_SR: + cg.printf("toInt64("); + first->outputCPP(cg, ar); + cg.printf(")"); + break; + default: + first->outputCPP(cg, ar); + break; + } + + switch (m_op) { + case T_PLUS_EQUAL: cg.printf(" += "); break; + case T_MINUS_EQUAL: cg.printf(" -= "); break; + case T_MUL_EQUAL: cg.printf(" *= "); break; + case T_DIV_EQUAL: cg.printf(" /= "); break; + case T_MOD_EQUAL: cg.printf(" %%= "); break; + case T_AND_EQUAL: cg.printf(" &= "); break; + case T_OR_EQUAL: cg.printf(" |= "); break; + case T_XOR_EQUAL: cg.printf(" ^= "); break; + case T_SL_EQUAL: cg.printf(" <<= "); break; + case T_SR_EQUAL: cg.printf(" >>= "); break; + case T_BOOLEAN_OR: cg.printf(" || "); break; + case T_BOOLEAN_AND: cg.printf(" && "); break; + case T_LOGICAL_OR: cg.printf(" || "); break; + case T_LOGICAL_AND: cg.printf(" && "); break; + default: + if (!bothEffect) { + switch (m_op) { + case '+': cg.printf(" + "); break; + case '-': cg.printf(" - "); break; + case '*': cg.printf(" * "); break; + case T_SL: cg.printf(" << "); break; + case T_SR: cg.printf(" >> "); break; + default: + cg.printf(", "); + break; + } + } else { + cg.printf(", "); + } + break; + } + + switch (m_op) { + case '+': + case '-': + case '*': + case '/': { + TypePtr actualType = second->getActualType(); + + if (actualType && + (actualType->is(Type::KindOfString) || + actualType->is(Type::KindOfArray))) { + cg.printf("(Variant)("); + second->outputCPP(cg, ar); + cg.printf(")"); + } else { + second->outputCPP(cg, ar); + } + break; + } + case T_INSTANCEOF: + { + if (second->is(Expression::KindOfScalarExpression)) { + cg.printf("\""); + second->outputCPP(cg, ar); + cg.printf("\""); + } else { + second->outputCPP(cg, ar); + } + break; + } + case T_PLUS_EQUAL: + case T_MINUS_EQUAL: + case T_MUL_EQUAL: + { + TypePtr t1 = first->getActualType(); + TypePtr t2 = second->getActualType(); + if (t1 && t2 && Type::IsCastNeeded(ar, t2, t1)) { + t1->outputCPPCast(cg, ar); + cg.printf("("); + second->outputCPP(cg, ar); + cg.printf(")"); + } else { + second->outputCPP(cg, ar); + } + break; + } + default: + second->outputCPP(cg, ar); + } + + if (wrapped) cg.printf(")"); +} diff --git a/src/lib/expression/binary_op_expression.h b/src/lib/expression/binary_op_expression.h new file mode 100644 index 0000000000000..3b44ea6cd0a71 --- /dev/null +++ b/src/lib/expression/binary_op_expression.h @@ -0,0 +1,61 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __BINARY_OP_EXPRESSION_H__ +#define __BINARY_OP_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(BinaryOpExpression); + +class BinaryOpExpression : public Expression { +public: + BinaryOpExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr exp1, ExpressionPtr exp2, int op); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool hasEffect() const { return m_effect;} + virtual bool isLiteralString() const; + virtual std::string getLiteralString() const; + + bool isShortCircuitOperator() const; + ExpressionPtr getExp1() { return m_exp1;} + ExpressionPtr getExp2() { return m_exp2;} + int getOp() { return m_op;} + + ExpressionPtr foldConst(AnalysisResultPtr ar); + ExpressionPtr foldConstRightAssoc(AnalysisResultPtr ar); + +private: + ExpressionPtr simplifyLogical(AnalysisResultPtr ar); + ExpressionPtr simplifyArithmetic(AnalysisResultPtr ar); + ExpressionPtr mergeConcat(AnalysisResultPtr ar); + ExpressionPtr makeConcatCall(AnalysisResultPtr ar, int count, + ExpressionListPtr expList); + + ExpressionPtr m_exp1; + ExpressionPtr m_exp2; + int m_op; + bool m_effect; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __BINARY_OP_EXPRESSION_H__ diff --git a/src/lib/expression/class_constant_expression.cpp b/src/lib/expression/class_constant_expression.cpp new file mode 100644 index 0000000000000..d8a10064fcafd --- /dev/null +++ b/src/lib/expression/class_constant_expression.cpp @@ -0,0 +1,197 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// + +// constructors/destructors + +ClassConstantExpression::ClassConstantExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + const std::string &className, const std::string &varName) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_varName(varName), m_valid(false), m_redeclared(false), + m_visited(false) { + m_className = Util::toLower(className); +} + +ExpressionPtr ClassConstantExpression::clone() { + ClassConstantExpressionPtr exp(new ClassConstantExpression(*this)); + Expression::deepCopy(exp); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ClassConstantExpression::analyzeProgram(AnalysisResultPtr ar) { + addUserClass(ar, m_className); +} + +ExpressionPtr ClassConstantExpression::preOptimize(AnalysisResultPtr ar) { + if (ar->getPhase() < AnalysisResult::FirstPreOptimize) { + return ExpressionPtr(); + } + if (m_redeclared) return ExpressionPtr(); + ClassScopePtr cls = ar->resolveClass(m_className); + if (!cls || cls->isRedeclaring()) return ExpressionPtr(); + ConstantTablePtr constants = cls->getConstants(); + if (constants->isExplicitlyDeclared(m_varName)) { + ConstructPtr decl = constants->getValue(m_varName); + if (decl) { + ExpressionPtr value = dynamic_pointer_cast(decl); + if (!m_visited) { + m_visited = true; + ar->pushScope(cls); + ExpressionPtr optExp = value->preOptimize(ar); + ar->popScope(); + m_visited = false; + if (optExp) value = optExp; + } + if (value->isScalar()) { + // inline the value + if (value->is(Expression::KindOfScalarExpression)) { + ScalarExpressionPtr exp = + dynamic_pointer_cast(Clone(value)); + exp->setComment(getText()); + return exp; + } else if (value->is(Expression::KindOfConstantExpression)) { + // inline the value + ConstantExpressionPtr exp = + dynamic_pointer_cast(Clone(value)); + exp->setComment(getText()); + return exp; + } + } + } + } + return ExpressionPtr(); +} + +ExpressionPtr ClassConstantExpression::postOptimize(AnalysisResultPtr ar) { + return ExpressionPtr(); +} + +TypePtr ClassConstantExpression::inferTypes(AnalysisResultPtr ar, + TypePtr type, bool coerce) { + m_valid = false; + ConstructPtr self = shared_from_this(); + ClassScopePtr cls = ar->resolveClass(m_className); + if (!cls || cls->isRedeclaring()) { + if (cls) { + m_redeclared = true; + ar->getScope()->getVariables()-> + setAttribute(VariableTable::NeedGlobalPointer); + } + if (!cls && ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UnknownClass, self); + } + return type; + } + if (cls->getConstants()->isDynamic(m_varName)) { + ar->getScope()->getVariables()-> + setAttribute(VariableTable::NeedGlobalPointer); + } + if (cls->getConstants()->isExplicitlyDeclared(m_varName)) { + string name = m_className + "::" + m_varName; + ConstructPtr decl = cls->getConstants()->getDeclaration(m_varName); + if (decl) { // No decl means an extension class. + ar->getDependencyGraph()->add(DependencyGraph::KindOfConstant, + ar->getName(), + name, shared_from_this(), name, decl); + } + m_valid = true; + } + bool present; + TypePtr t = cls->checkConst(m_varName, type, coerce, ar, + shared_from_this(), present); + if (present) { + m_valid = true; + } + + return t; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ClassConstantExpression::outputPHP(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.printf("%s::%s", m_className.c_str(), m_varName.c_str()); +} + +void ClassConstantExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + const char *globals = "g"; + if (cg.getContext() == CodeGenerator::CppParameterDefaultValueDecl || + cg.getContext() == CodeGenerator::CppParameterDefaultValueImpl) { + globals = cg.getGlobals(); + } + if (m_valid) { + ClassScopePtr foundCls; + string trueClassName; + for (ClassScopePtr cls = ar->findClass(m_className); + cls; cls = cls->getParentScope(ar)) { + if (cls->getConstants()->isPresent(m_varName)) { + foundCls = cls; + trueClassName = cls->getName(); + break; + } + } + ASSERT(!trueClassName.empty()); + ConstructPtr decl = foundCls->getConstants()->getValue(m_varName); + if (decl) { + decl->outputCPP(cg, ar); + if (cg.getContext() == CodeGenerator::CppImplementation || + cg.getContext() == CodeGenerator::CppParameterDefaultValueImpl) { + cg.printf("(%s::%s)", m_className.c_str(), m_varName.c_str()); + } else { + cg.printf("/* %s::%s */", m_className.c_str(), m_varName.c_str()); + } + } else { + if (foundCls->getConstants()->isDynamic(m_varName)) { + cg.printf("%s%s::lazy_initializer(%s)->", Option::ClassPrefix, + trueClassName.c_str(), globals); + } + cg.printf("%s%s_%s", Option::ClassConstantPrefix, trueClassName.c_str(), + m_varName.c_str()); + } + } else if (m_redeclared) { + cg.printf("%s->%s%s->os_constant(\"%s\")", globals, + Option::ClassStaticsObjectPrefix, + m_className.c_str(), m_varName.c_str()); + } else { + cg.printf("throw_fatal(\"unknown class constant %s::%s\")", + m_className.c_str(), m_varName.c_str()); + } +} diff --git a/src/lib/expression/class_constant_expression.h b/src/lib/expression/class_constant_expression.h new file mode 100644 index 0000000000000..a8c1d30c29bc9 --- /dev/null +++ b/src/lib/expression/class_constant_expression.h @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CLASS_CONSTANT_EXPRESSION_H__ +#define __CLASS_CONSTANT_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ClassConstantExpression); + +class ClassConstantExpression : public Expression { +public: + ClassConstantExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + const std::string &className, + const std::string &varName); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool hasEffect() const { return false;} + +private: + std::string m_className; + std::string m_varName; + bool m_valid; + bool m_redeclared; + bool m_visited; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CLASS_CONSTANT_EXPRESSION_H__ diff --git a/src/lib/expression/constant_expression.cpp b/src/lib/expression/constant_expression.cpp new file mode 100644 index 0000000000000..759ccd7681613 --- /dev/null +++ b/src/lib/expression/constant_expression.cpp @@ -0,0 +1,218 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// + +// constructors/destructors + +ConstantExpression::ConstantExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, const string &name) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_name(name), m_valid(true), m_dynamic(false), m_visited(false) { +} + +ExpressionPtr ConstantExpression::clone() { + ConstantExpressionPtr exp(new ConstantExpression(*this)); + Expression::deepCopy(exp); + return exp; +} + +bool ConstantExpression::isScalar() const { + string lower = Util::toLower(m_name); + return lower == "true" || lower == "false" || lower == "null"; +} + +bool ConstantExpression::isBoolean() const { + string lower = Util::toLower(m_name); + return (lower == "true" || lower == "false"); +} + +bool ConstantExpression::isNull() const { + string lower = Util::toLower(m_name); + return (lower == "null"); +} + +bool ConstantExpression::getBooleanValue() const { + string lower = Util::toLower(m_name); + ASSERT(lower == "true" || lower == "false"); + return lower == "true"; +} + +bool ConstantExpression::getScalarValue(Variant &value) { + if (!isScalar()) return false; + if (isBoolean()) { + value = getBooleanValue(); + } else { + value.unset(); + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ConstantExpression::analyzeProgram(AnalysisResultPtr ar) { + if (ar->getPhase() == AnalysisResult::AnalyzeAll && + !(m_context & LValue)) { + ar->getFileScope()->addConstantDependency(ar, m_name); + if (!m_dynamic) { + ConstantTablePtr constants = ar->getConstants(); + if (!constants->getValue(m_name)) { + BlockScopePtr block = ar->findConstantDeclarer(m_name); + if (block) { + constants = block->getConstants(); + if (constants->isDynamic(m_name)) m_dynamic = true; + } + } + } + } +} + +ExpressionPtr ConstantExpression::preOptimize(AnalysisResultPtr ar) { + if (ar->getPhase() < AnalysisResult::FirstPreOptimize) { + return ExpressionPtr(); + } + ConstructPtr decl; + if (!isScalar() && !m_dynamic && !(m_context & LValue)) { + ConstantTablePtr constants = ar->getConstants(); + decl = constants->getValue(m_name); + if (!decl) { + BlockScopePtr block = ar->findConstantDeclarer(m_name); + if (block) { + constants = block->getConstants(); + if (!constants->isDynamic(m_name)) decl = constants->getValue(m_name); + } + } + if (decl) { + ExpressionPtr value = dynamic_pointer_cast(decl); + if (!m_visited) { + m_visited = true; + ExpressionPtr optExp = value->preOptimize(ar); + m_visited = false; + if (optExp) value = optExp; + } + if (value->isScalar()) { + // inline the value + if (value->is(Expression::KindOfScalarExpression)) { + ScalarExpressionPtr exp = + dynamic_pointer_cast(Clone(value)); + exp->setComment(getText()); + return exp; + } else if (value->is(Expression::KindOfConstantExpression)) { + // inline the value + ConstantExpressionPtr exp = + dynamic_pointer_cast(Clone(value)); + exp->setComment(getText()); + return exp; + } + } + } + } + return ExpressionPtr(); +} + +ExpressionPtr ConstantExpression::postOptimize(AnalysisResultPtr ar) { + return ExpressionPtr(); +} + +TypePtr ConstantExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + if (m_context & LValue) return type; // ClassConstantExpression statement + + // special cases: STDIN, STDOUT, STDERR + if (m_name == "STDIN" || m_name == "STDOUT" || m_name == "STDERR") { + return Type::Variant; + } + + string lower = Util::toLower(m_name); + TypePtr actualType; + ConstructPtr self = shared_from_this(); + if (lower == "true" || lower == "false") { + actualType = Type::Boolean; + } else if (lower == "null") { + actualType = Type::Variant; + } else { + BlockScopePtr scope = ar->findConstantDeclarer(m_name); + if (!scope) { + scope = ar->getFileScope(); + ar->getFileScope()->declareConstant(ar, m_name); + } + ConstantTablePtr constants = scope->getConstants(); + ConstructPtr decl = constants->getDeclaration(m_name); + if (decl) { + ar->getDependencyGraph()->add(DependencyGraph::KindOfConstant, "", + m_name, self, m_name, decl); + } + bool p; + actualType = constants->check(m_name, type, coerce, ar, self, p); + if (!m_dynamic && constants->isDynamic(m_name)) { + m_dynamic = true; + actualType = Type::Variant; + } + } + + return actualType; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ConstantExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("%s", m_name.c_str()); +} + +void ConstantExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + // special cases: STDIN, STDOUT, STDERR + if (m_name == "STDIN" || m_name == "STDOUT" || m_name == "STDERR") { + cg.printf("%s", m_name.c_str()); + return; + } + + string lower = Util::toLower(m_name); + if (lower == "true" || lower == "false" || lower == "null") { + cg.printf("%s", lower.c_str()); + } else if (m_valid) { + if (m_dynamic) { + cg.printf("%s->%s%s", cg.getGlobals(), Option::ConstantPrefix, + m_name.c_str()); + } else { + cg.printf("%s%s", Option::ConstantPrefix, m_name.c_str()); + } + } else { + cg.printf("\"%s\"", m_name.c_str()); + } +} diff --git a/src/lib/expression/constant_expression.h b/src/lib/expression/constant_expression.h new file mode 100644 index 0000000000000..68af363c87272 --- /dev/null +++ b/src/lib/expression/constant_expression.h @@ -0,0 +1,63 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CONSTANT_EXPRESSION_H__ +#define __CONSTANT_EXPRESSION_H__ + +#include + +#define CONSTANT(value) \ + (Expression::makeConstant(ar, getLocation(), value)) + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ConstantExpression); + +class ConstantExpression : public Expression { +public: + ConstantExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + const std::string &name); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool isScalar() const; + virtual bool hasEffect() const { return false;} + virtual bool getScalarValue(Variant &value); + virtual bool containsDynamicConstant(AnalysisResultPtr ar) const { + return m_dynamic; + } + + const std::string &getName() const { return m_name;} + bool isBoolean() const; + bool isNull() const; + bool getBooleanValue() const; + void pushConst(const std::string &name); + void popConst(); + void setComment(const std::string comment) { m_comment = comment;} + const std::string getComment() { return m_comment;} + +private: + std::string m_name; + bool m_valid; + bool m_dynamic; + bool m_visited; + std::string m_comment; // for inlined constant name +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __CONSTANT_EXPRESSION_H__ diff --git a/src/lib/expression/dynamic_function_call.cpp b/src/lib/expression/dynamic_function_call.cpp new file mode 100644 index 0000000000000..c7b7386a124a0 --- /dev/null +++ b/src/lib/expression/dynamic_function_call.cpp @@ -0,0 +1,171 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +DynamicFunctionCall::DynamicFunctionCall +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr name, ExpressionListPtr params, const std::string *classname) + : FunctionCall(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES, + name, "", params, classname) { +} + +ExpressionPtr DynamicFunctionCall::clone() { + DynamicFunctionCallPtr exp(new DynamicFunctionCall(*this)); + FunctionCall::deepCopy(exp); + exp->m_params = Clone(m_params); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void DynamicFunctionCall::analyzeProgram(AnalysisResultPtr ar) { + addUserClass(ar, m_className); + m_nameExp->analyzeProgram(ar); + if (m_params) { + m_params->controlOrder(); + m_params->analyzeProgram(ar); + } +} + +ExpressionPtr DynamicFunctionCall::preOptimize(AnalysisResultPtr ar) { + return FunctionCall::preOptimize(ar); +} + +ExpressionPtr DynamicFunctionCall::postOptimize(AnalysisResultPtr ar) { + return FunctionCall::postOptimize(ar); +} + +TypePtr DynamicFunctionCall::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + reset(); + ConstructPtr self = shared_from_this(); + if (!m_className.empty()) { + ClassScopePtr cls = ar->resolveClass(m_className); + if (!cls || cls->isRedeclaring()) { + if (cls) { + m_redeclared = true; + ar->getScope()->getVariables()-> + setAttribute(VariableTable::NeedGlobalPointer); + } + if (!cls && ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UnknownClass, self); + } + } else { + m_validClass = true; + } + } + + ar->containsDynamicFunctionCall(); + + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UseDynamicFunction, self); + } + m_nameExp->inferAndCheck(ar, Type::String, false); + if (m_params) { + for (int i = 0; i < m_params->getCount(); i++) { + (*m_params)[i]->setContext(Expression::RefValue); + (*m_params)[i]->setContext(Expression::InvokeArgument); + (*m_params)[i]->inferAndCheck(ar, Type::Variant, true); + } + } + return Type::Variant; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void DynamicFunctionCall::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + outputLineMap(cg, ar); + + if (!m_className.empty()) { + cg.printf("%s::", m_className.c_str()); + m_nameExp->outputPHP(cg, ar); + } else { + const char *prefix = Option::IdPrefix.c_str(); + if (cg.getOutput() == CodeGenerator::TrimmedPHP && + cg.usingStream(CodeGenerator::PrimaryStream) && + !m_nameExp->is(Expression::KindOfScalarExpression)) { + cg.printf("${%sdynamic_load($%stmp = (", prefix, prefix); + m_nameExp->outputPHP(cg, ar); + cg.printf("), '%stmp'", prefix); + cg.printf(")}"); + } else { + m_nameExp->outputPHP(cg, ar); + } + } + + cg.printf("("); + if (m_params) m_params->outputPHP(cg, ar); + cg.printf(")"); +} + +void DynamicFunctionCall::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool linemap = outputLineMap(cg, ar); + if (m_params) m_params->outputCPPControlledEvalOrderPre(cg, ar); + if (!m_className.empty()) { + if (m_validClass) { + cg.printf("%s%s::%sinvoke(\"%s\", ", Option::ClassPrefix, + m_className.c_str(), Option::ObjectStaticPrefix, + m_className.c_str()); + } else if (m_redeclared) { + cg.printf("g->%s%s->%sinvoke(\"%s\", ", Option::ClassStaticsObjectPrefix, + m_className.c_str(), Option::ObjectStaticPrefix, + m_className.c_str()); + } else { + cg.printf("throw_fatal(\"unknown class %s\")", m_className.c_str()); + cg.printf(")"); + return; + } + } else { + cg.printf("invoke("); + } + if (m_nameExp->is(Expression::KindOfSimpleVariable)) { + m_nameExp->outputCPP(cg, ar); + } else { + cg.printf("("); + m_nameExp->outputCPP(cg, ar); + cg.printf(")"); + } + cg.printf(", "); + if (m_params && m_params->getCount() > 0) { + FunctionScope::outputCPPArguments(m_params, cg, ar, -1, false); + } else { + cg.printf("Array()"); + } + cg.printf(", -1)"); + if (m_params) m_params->outputCPPControlledEvalOrderPost(cg, ar); + if (linemap) cg.printf(")"); +} diff --git a/src/lib/expression/dynamic_function_call.h b/src/lib/expression/dynamic_function_call.h new file mode 100644 index 0000000000000..81016d45b7ad1 --- /dev/null +++ b/src/lib/expression/dynamic_function_call.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __DYNAMIC_FUNCTION_CALL_H__ +#define __DYNAMIC_FUNCTION_CALL_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(DynamicFunctionCall); + +class DynamicFunctionCall : public FunctionCall { +public: + DynamicFunctionCall(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr name, ExpressionListPtr params, + const std::string *classname); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __DYNAMIC_FUNCTION_CALL_H__ diff --git a/src/lib/expression/dynamic_variable.cpp b/src/lib/expression/dynamic_variable.cpp new file mode 100644 index 0000000000000..48ca07ec71f93 --- /dev/null +++ b/src/lib/expression/dynamic_variable.cpp @@ -0,0 +1,95 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +DynamicVariable::DynamicVariable +(EXPRESSION_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), m_exp(exp) { +} + +ExpressionPtr DynamicVariable::clone() { + DynamicVariablePtr exp(new DynamicVariable(*this)); + Expression::deepCopy(exp); + exp->m_exp = Clone(m_exp); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void DynamicVariable::analyzeProgram(AnalysisResultPtr ar) { + m_exp->analyzeProgram(ar); +} + +ExpressionPtr DynamicVariable::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + return ExpressionPtr(); +} + +ExpressionPtr DynamicVariable::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return ExpressionPtr(); +} + +TypePtr DynamicVariable::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + ConstructPtr self = shared_from_this(); + if (m_context & (LValue | RefValue)) { + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UseLDynamicVariable, self); + } + ar->getScope()->getVariables()->forceVariants(ar); + ar->getScope()-> + getVariables()->setAttribute(VariableTable::ContainsLDynamicVariable); + } else { + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UseRDynamicVariable, self); + } + } + + m_exp->inferAndCheck(ar, Type::String, false); + return Type::Variant; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void DynamicVariable::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("${"); + m_exp->outputPHP(cg, ar); + cg.printf("}"); +} + +void DynamicVariable::outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("variables->get("); + m_exp->outputCPP(cg, ar); + cg.printf(")"); +} diff --git a/src/lib/expression/dynamic_variable.h b/src/lib/expression/dynamic_variable.h new file mode 100644 index 0000000000000..8a5732e907fe6 --- /dev/null +++ b/src/lib/expression/dynamic_variable.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __DYNAMIC_VARIABLE_H__ +#define __DYNAMIC_VARIABLE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(DynamicVariable); + +class DynamicVariable : public Expression { +public: + DynamicVariable(EXPRESSION_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool hasEffect() const { return false;} + virtual bool isRefable() const { return true;} + + ExpressionPtr getSubExpression() const { return m_exp; } +private: + ExpressionPtr m_exp; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __DYNAMIC_VARIABLE_H__ diff --git a/src/lib/expression/encaps_list_expression.cpp b/src/lib/expression/encaps_list_expression.cpp new file mode 100644 index 0000000000000..543b449b5a346 --- /dev/null +++ b/src/lib/expression/encaps_list_expression.cpp @@ -0,0 +1,138 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +EncapsListExpression::EncapsListExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, int type, ExpressionListPtr expList) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_type(type), m_exps(expList) { +} + +ExpressionPtr EncapsListExpression::clone() { + EncapsListExpressionPtr exp(new EncapsListExpression(*this)); + Expression::deepCopy(exp); + exp->m_exps = Clone(m_exps); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void EncapsListExpression::analyzeProgram(AnalysisResultPtr ar) { + if (m_exps) { + for (int i = 0; i < m_exps->getCount(); i++) { + (*m_exps)[i]->analyzeProgram(ar); + } + } +} + +ExpressionPtr EncapsListExpression::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exps); + if (m_type != '`' && m_type != '\'' && m_exps) { + int count = m_exps->getCount(); + // turn into cascaded concat + if (count > 2) { + ExpressionPtr exp = + BinaryOpExpressionPtr(new BinaryOpExpression(getLocation(), + Expression::KindOfBinaryOpExpression, + (*m_exps)[0], (*m_exps)[1], '.')); + for (int i = 2; i < count; i++) { + exp = + BinaryOpExpressionPtr(new BinaryOpExpression(getLocation(), + Expression::KindOfBinaryOpExpression, + exp, (*m_exps)[i], '.')); + } + return exp; + } + } + return ExpressionPtr(); +} + +ExpressionPtr EncapsListExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exps); + return ExpressionPtr(); +} + +TypePtr EncapsListExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + if (m_exps) { + for (int i = 0; i < m_exps->getCount(); i++) { + (*m_exps)[i]->inferAndCheck(ar, Type::String, false); + } + } + + if (ar->isFirstPass() && m_type == '`') { + ConstructPtr self = shared_from_this(); + ar->getCodeError()->record(self, CodeError::UseShellExec, self); + } + + return Type::String; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void EncapsListExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_type == '`') cg.printf("shell_exec("); + + if (m_exps) { + for (int i = 0; i < m_exps->getCount(); i++) { + if (i > 0) cg.printf(" . "); + (*m_exps)[i]->outputPHP(cg, ar); + } + } else { + cg.printf("''"); + } + + if (m_type == '`') cg.printf(")"); +} + +void EncapsListExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + if (m_type == '`') cg.printf("f_shell_exec("); + + if (m_exps) { + for (int i = 0; i < m_exps->getCount(); i++) { + ExpressionPtr exp = (*m_exps)[i]; + if (i > 0) cg.printf(" + "); + if (exp->is(Expression::KindOfScalarExpression)) { + cg.printf("toString("); + exp->outputCPP(cg, ar); + cg.printf(")"); + } else { + exp->outputCPP(cg, ar); + } + } + } else { + cg.printf("\"\""); + } + + if (m_type == '`') cg.printf(")"); +} diff --git a/src/lib/expression/encaps_list_expression.h b/src/lib/expression/encaps_list_expression.h new file mode 100644 index 0000000000000..a778a36f469a5 --- /dev/null +++ b/src/lib/expression/encaps_list_expression.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __ENCAPS_LIST_EXPRESSION_H__ +#define __ENCAPS_LIST_EXPRESSION_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(EncapsListExpression); + +class EncapsListExpression : public Expression { +public: + EncapsListExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + int type, ExpressionListPtr expList); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool hasEffect() const { return m_type == '`';} + +private: + int m_type; + ExpressionListPtr m_exps; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __ENCAPS_LIST_EXPRESSION_H__ diff --git a/src/lib/expression/expression.cpp b/src/lib/expression/expression.cpp new file mode 100644 index 0000000000000..658892bce3d2a --- /dev/null +++ b/src/lib/expression/expression.cpp @@ -0,0 +1,291 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// + +Expression::Expression(LocationPtr loc, KindOf kindOf) + : Construct(loc), m_kindOf(kindOf), m_context(RValue) { +} + +void Expression::deepCopy(ExpressionPtr exp) { + exp->m_actualType = m_actualType; + exp->m_expectedType = m_expectedType; +}; + +void Expression::addElement(ExpressionPtr exp) { + ASSERT(false); +} + +void Expression::insertElement(ExpressionPtr exp, int index /* = 0 */) { + ASSERT(false); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Expression::isIdentifier(const string &value) { + for (unsigned int i = 0; i < value.size(); i++) { + char ch = value[i]; + if ((i == 0 && ch >= '0' && ch <= '9') || + ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z') && + (ch < '0' || ch > '9') && (ch != '_'))) { + return false; + } + } + return true; +} + +TypePtr Expression::getType() { + if (m_expectedType) return m_expectedType; + if (m_actualType) return m_actualType; + return NEW_TYPE(Any); +} + +TypePtr Expression::inferAndCheck(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + TypePtr actualType = inferTypes(ar, type, coerce); + if (type->is(Type::KindOfSome) || type->is(Type::KindOfAny)) { + m_actualType = actualType; + return actualType; + } + return checkTypesImpl(ar, type, actualType, coerce); +} + +TypePtr Expression::checkTypesImpl(AnalysisResultPtr ar, TypePtr expectedType, + TypePtr actualType, bool coerce) { + TypePtr ret; + if (coerce) { + ret = Type::Coerce(ar, expectedType, actualType); + setTypes(actualType, expectedType); + } else { + if (!Type::IsLegalCast(ar, actualType, expectedType)) { + ar->getCodeError()->record(shared_from_this(), expectedType->getKindOf(), + actualType->getKindOf()); + } + ret = Type::Cast(ar, actualType, expectedType); + setTypes(actualType, ret); + } + return ret; +} + +void Expression::setTypes(TypePtr actualType, TypePtr expectedType) { + m_actualType = actualType; + if (!Type::SameType(expectedType, actualType)) { + m_expectedType = expectedType; + } else { + // Clear expected type since expectedType == actualType + m_expectedType.reset(); + } + + // This is a special case where Type::KindOfObject means any object. + if (m_expectedType && m_expectedType->is(Type::KindOfObject) && + !m_expectedType->isSpecificObject() && + m_actualType->isSpecificObject()) { + m_expectedType.reset(); + } +} + +void Expression::setDynamicByIdentifier(AnalysisResultPtr ar, + const std::string &value) { + string id = Util::toLower(value); + size_t c = id.find("::"); + FunctionScopePtr fi; + ClassScopePtr ci; + if (c != 0 && c != string::npos && c+2 < id.size()) { + string cl = id.substr(0, c); + string fn = id.substr(c+2); + if (isIdentifier(cl) && isIdentifier(fn)) { + ci = ar->findClass(cl); + if (ci) { + fi = ci->findFunction(ar, fn, false); + if (fi) fi->setDynamic(); + } + } + } else if (isIdentifier(id)) { + fi = ar->findFunction(id); + if (fi) { + fi->setDynamic(); + } + ClassScopePtr ci = ar->findClass(id, AnalysisResult::MethodName); + if (ci) { + fi = ci->findFunction(ar, id, false); + if (fi) { + fi->setDynamic(); + } + } + } +} + +ExpressionPtr Expression::makeConstant(AnalysisResultPtr ar, + LocationPtr loc, + const std::string &value) { + ConstantExpressionPtr exp(new ConstantExpression(loc, + Expression::KindOfConstantExpression, + value)); + if (value == "true" || value == "false") { + if (ar->getPhase() >= AnalysisResult::PostOptimize) { + exp->m_actualType = Type::Boolean; + } + } else if (value == "null") { + if (ar->getPhase() >= AnalysisResult::PostOptimize) { + exp->m_actualType = Type::Variant; + } + } else { + ASSERT(false); + } + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Expression::outputLineMap(CodeGenerator &cg, AnalysisResultPtr ar) { + switch (cg.getOutput()) { + case CodeGenerator::TrimmedPHP: + if (cg.getStream(CodeGenerator::MapFile) && + cg.usingStream(CodeGenerator::PrimaryStream)) { + cg.useStream(CodeGenerator::MapFile); + cg.printf("%d => '%s:%d',", cg.getLineNo(CodeGenerator::PrimaryStream), + getLocation()->file, getLocation()->line1); + cg.useStream(CodeGenerator::PrimaryStream); + } + break; + case CodeGenerator::ClusterCPP: + { + int line = cg.getLineNo(CodeGenerator::PrimaryStream); + string fileline = cg.getFileName() + ":" + lexical_cast(line); + LocationPtr loc = getLocation(); + ar->recordSourceInfo(fileline, loc); + cg.printf("LINE(%d,", loc->line1); + return true; + } + break; + default: + break; + } + return false; +} + +void Expression::outputCPPCast(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_expectedType) { + m_expectedType->outputCPPCast(cg, ar); + } +} + +void Expression::outputCPPDecl(CodeGenerator &cg, AnalysisResultPtr ar) { + TypePtr type = m_actualType; + if (!type) type = Type::Variant; + type->outputCPPDecl(cg, ar); +} + +void Expression::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + // When p_ types are used as r-value, we cast it to Object so not to define + // every function with SmartObject template functions + bool castToObject = false; + if ((m_context & (LValue|RefValue|ObjectContext)) == 0 && + m_actualType && m_actualType->isSpecificObject() && + !is(Expression::KindOfParameterExpression)) { + castToObject = true; + } + + if (m_expectedType && m_actualType && ((m_context & LValue) == 0) && + Type::IsCastNeeded(ar, m_actualType, m_expectedType)) { + m_expectedType->outputCPPCast(cg, ar); + if (m_expectedType->isSpecificObject()) castToObject = false; + cg.printf("("); + if (castToObject) { + cg.printf("((Object)("); + outputCPPImpl(cg, ar); + cg.printf("))"); + } else { + outputCPPImpl(cg, ar); + } + cg.printf(")"); + } else { + int closeParan = 0; + if (((m_context & RefValue) != 0) && ((m_context & NoRefWrapper) == 0) && + isRefable()) { + cg.printf("ref("); + closeParan++; + } + if (((((m_context & LValue) != 0) && + ((m_context & NoLValueWrapper) == 0)) || + ((m_context & RefValue) != 0) && + ((m_context & InvokeArgument) == 0)) && + (is(Expression::KindOfArrayElementExpression) || + is(Expression::KindOfObjectPropertyExpression))) { + cg.printf("lval("); + closeParan++; + } + if (castToObject) { + cg.printf("((Object)("); + outputCPPImpl(cg, ar); + cg.printf("))"); + } else { + outputCPPImpl(cg, ar); + } + for (int i = 0; i < closeParan; i++) { + cg.printf(")"); + } + } + + string comment; + if (is(Expression::KindOfScalarExpression)) { + ScalarExpressionPtr exp = + dynamic_pointer_cast(shared_from_this()); + comment = exp->getComment(); + } else if (is(Expression::KindOfConstantExpression)) { + ConstantExpressionPtr exp = + dynamic_pointer_cast(shared_from_this()); + comment = exp->getComment(); + } + + if (!comment.empty()) { + if (cg.inComments()) { + cg.printf(" (%s)", comment.c_str()); + } else { + cg.printf(" /* %s */", comment.c_str()); + } + } +} + +void Expression::outputCPPExistTest(CodeGenerator &cg, AnalysisResultPtr ar, + int op) { + switch (op) { + case T_ISSET: cg.printf("isset("); break; + case T_EMPTY: cg.printf("empty("); break; + default: ASSERT(false); + } + outputCPP(cg, ar); + cg.printf(")"); +} +void Expression::outputCPPUnset(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("unset("); + outputCPP(cg, ar); + cg.printf(");\n"); +} diff --git a/src/lib/expression/expression.h b/src/lib/expression/expression.h new file mode 100644 index 0000000000000..0a1b1b0dfbcc2 --- /dev/null +++ b/src/lib/expression/expression.h @@ -0,0 +1,223 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXPRESSION_H__ +#define __EXPRESSION_H__ + +#include +#include +#include + +#define EXPRESSION_CONSTRUCTOR_PARAMETERS \ + LocationPtr loc, Expression::KindOf kindOf +#define EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES \ + loc, kindOf +#define DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS \ + virtual void analyzeProgram(AnalysisResultPtr ar); \ + virtual ExpressionPtr clone(); \ + virtual ExpressionPtr preOptimize(AnalysisResultPtr ar); \ + virtual ExpressionPtr postOptimize(AnalysisResultPtr ar); \ + virtual TypePtr inferTypes(AnalysisResultPtr ar, TypePtr type, \ + bool coerce); \ + virtual void outputPHP(CodeGenerator &cg, AnalysisResultPtr ar); \ + virtual void outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(Statement); +DECLARE_BOOST_TYPES(Expression); +class Variant; + +class Expression : public Construct { +public: + enum KindOf { + KindOfExpressionList, + KindOfAssignmentExpression, + KindOfSimpleVariable, + KindOfDynamicVariable, + KindOfStaticMemberExpression, + KindOfArrayElementExpression, + KindOfDynamicFunctionCall, + KindOfSimpleFunctionCall, + KindOfScalarExpression, + KindOfObjectPropertyExpression, + KindOfObjectMethodExpression, + KindOfListAssignment, + KindOfNewObjectExpression, + KindOfUnaryOpExpression, + KindOfIncludeExpression, + KindOfBinaryOpExpression, + KindOfQOpExpression, + KindOfArrayPairExpression, + KindOfClassConstantExpression, + KindOfParameterExpression, + KindOfModifierExpression, + KindOfConstantExpression, + KindOfEncapsListExpression, + /* KindOfCount = 22 */ + }; + + enum Context { + RValue = 0, + LValue = 1, // assignment exp; foreach stmt + Declaration = LValue | 2, // global or static stmt + NoLValueWrapper = 4, // ok to not have lval() wrapper + RefValue = 8, // &exp + NoRefWrapper = 16, // ok to not have ref() wrapper + ObjectContext = 32, // $obj-> + InParameterExpression = 64, // for default value expression + IssetContext = 128, // isset(...) + AssignmentLHS = 256, // LHS in assignment + DeepAssignmentLHS = 512, // LHS in assignment, deep + UnsetContext = 1024, // Within unset(...), arr el recursively + InvokeArgument = 2048, // Invoke arguments + RefParameter = 4096 // eg f(&$x) + }; + +public: + Expression(EXPRESSION_CONSTRUCTOR_PARAMETERS); + + /** + * Set this expression's context. + */ + virtual void setContext(Context context) { m_context |= context;} + virtual void clearContext(Context context) { m_context &= ~context;} + int getContext() const { return m_context;} + bool hasContext(Context context) const { return m_context & context; } + + /** + * Implementing Construct. + */ + virtual void outputCPP(CodeGenerator &cg, AnalysisResultPtr ar); + virtual void outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) = 0; + void outputCPPCast(CodeGenerator &cg, AnalysisResultPtr ar); + virtual void outputCPPDecl(CodeGenerator &cg, AnalysisResultPtr ar); + + virtual void outputCPPExistTest(CodeGenerator &cg, AnalysisResultPtr ar, + int op); + virtual void outputCPPUnset(CodeGenerator &cg, AnalysisResultPtr ar); + + /** + * Type checking without RTTI. + */ + bool is(KindOf kindOf) const { return m_kindOf == kindOf;} + KindOf getKindOf() const { return m_kindOf;} + virtual bool isScalar() const { return false;} + virtual bool isRefable() const { return false;} + virtual bool getScalarValue(Variant &value) { return false;} + virtual ExpressionPtr clone() { + ASSERT(false); + return ExpressionPtr(); + } + virtual bool isThis() const { return false;} + virtual bool isLiteralString() const { return false;} + virtual std::string getLiteralString() const { return "";} + virtual bool containsDynamicConstant(AnalysisResultPtr ar) const { + return false; + } + void deepCopy(ExpressionPtr exp); + + /** + * This is to avoid dynamic casting to ExpressionList in Parser. + */ + virtual void addElement(ExpressionPtr exp); + virtual void insertElement(ExpressionPtr exp, int index = 0); + + /** + * Called before type inference. + */ + virtual ExpressionPtr preOptimize(AnalysisResultPtr ar) = 0; + + /** + * Called after type inference. + */ + virtual ExpressionPtr postOptimize(AnalysisResultPtr ar) = 0; + + /** + * Called when types need to be inferred inside this expression. + * + * When coerce is true, it means this expression will have to be able to + * hold that type of data. When it's false, it means as long as this + * expression can be converted to the type, we are fine. + * + * This is the key function to understand in order to understand type + * inference. Basically, "type" parameter is "expected" type, under + * either l-value context, when coerce == true, or r-value context, when + * coerce == false. But it's not always l-value context that "coerce" can + * be set to true, since for example, there are cases like foreach ($a ...) + * that we know $a needs to be an Array for sure. Some l-value context + * cannot set "coerce" to true, for example $a++, which doesn't actually + * change $a's type to anything new. + * + * Return type is ALWAYS an r-value type that this expression is evaluated + * to. It's always up to this expression's parent to determine whether this + * returned type is used as a "coerce"-d one or not onto another + * expression. + * + * @param type This expression is evaluated as this type. + * @coerce Whether to force this expression to be that type. + * @return What type this expression is evaluated to. + */ + virtual TypePtr inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) = 0; + + /** + * Call inferTypes() and check to make sure return type is convertible + * to specified type. If not, raise a CodeError. + */ + virtual TypePtr inferAndCheck(AnalysisResultPtr ar, TypePtr type, + bool coerce); + + /** + * Check to make sure return type is convertible to specified type. + * If not, raise a CodeError. + */ + TypePtr checkTypesImpl(AnalysisResultPtr ar, TypePtr expectedType, + TypePtr actualType, bool coerce); + + TypePtr getActualType() { return m_actualType;} + TypePtr getExpectedType() { return m_expectedType;} + void setActualType(TypePtr actualType) { + m_actualType = actualType; + } + void setExpectedType(TypePtr expectedType) { + m_expectedType = expectedType; + } + TypePtr getType(); + + static ExpressionPtr makeConstant(AnalysisResultPtr ar, + LocationPtr loc, + const std::string &value); + +protected: + static bool isIdentifier(const std::string &value); + + KindOf m_kindOf; + int m_context; + TypePtr m_actualType; + TypePtr m_expectedType; // null if the same as m_actualType + + void setTypes(TypePtr actualType, TypePtr expectedType); + void setDynamicByIdentifier(AnalysisResultPtr ar, + const std::string &value); + bool outputLineMap(CodeGenerator &cg, AnalysisResultPtr ar); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXPRESSION_H__ diff --git a/src/lib/expression/expression_list.cpp b/src/lib/expression/expression_list.cpp new file mode 100644 index 0000000000000..fc03c0e180f99 --- /dev/null +++ b/src/lib/expression/expression_list.cpp @@ -0,0 +1,331 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ExpressionList::ExpressionList +(EXPRESSION_CONSTRUCTOR_PARAMETERS) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), m_outputCount(-1), + m_controlOrder(0), m_tempStart(0), m_arrayElements(false) { +} + +ExpressionPtr ExpressionList::clone() { + ExpressionListPtr exp(new ExpressionList(*this)); + Expression::deepCopy(exp); + exp->m_exps.clear(); + for (unsigned int i = 0; i < m_exps.size(); i++) { + exp->m_exps.push_back(Clone(m_exps[i])); + } + return exp; +} + +void ExpressionList::toLower() { + for (unsigned int i = 0; i < m_exps.size(); i++) { + ScalarExpressionPtr s = dynamic_pointer_cast(m_exps[i]); + s->toLower(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void ExpressionList::addElement(ExpressionPtr exp) { + ArrayPairExpressionPtr ap = dynamic_pointer_cast(exp); + if (ap) { + m_arrayElements = true; + } else { + ASSERT(!m_arrayElements); + } + m_exps.push_back(exp); +} + +void ExpressionList::insertElement(ExpressionPtr exp, int index /* = 0 */) { + m_exps.insert(m_exps.begin() + index, exp); +} + +void ExpressionList::removeElement(int index) { + m_exps.erase(m_exps.begin() + index, m_exps.begin() + index + 1); +} + +bool ExpressionList::isScalar() const { + for (unsigned int i = 0; i < m_exps.size(); i++) { + if (!m_exps[i]->isScalar()) return false; + } + return true; +} + +bool ExpressionList::hasEffect() const { + for (unsigned int i = 0; i < m_exps.size(); i++) { + if (m_exps[i]->hasEffect()) return true; + } + return false; +} + +bool ExpressionList::isNoObjectInvolved() const { + for (unsigned int i = 0; i < m_exps.size(); i++) { + TypePtr t = m_exps[i]->getActualType(); + if (t == NULL || !t->isNoObjectInvolved()) + return false; + } + return true; +} + +bool ExpressionList::containsDynamicConstant(AnalysisResultPtr ar) const { + for (unsigned int i = 0; i < m_exps.size(); i++) { + if (m_exps[i]->containsDynamicConstant(ar)) return true; + } + return false; +} + +bool ExpressionList::isScalarArrayPairs() const { + for (unsigned int i = 0; i < m_exps.size(); i++) { + ArrayPairExpressionPtr exp = + dynamic_pointer_cast(m_exps[i]); + if (!exp || !exp->isScalarArrayPair()) { + return false; + } + } + return true; +} + +void ExpressionList::getStrings(std::vector &strings) { + for (unsigned int i = 0; i < m_exps.size(); i++) { + ScalarExpressionPtr s = dynamic_pointer_cast(m_exps[i]); + strings.push_back(s->getString()); + } +} + +bool ExpressionList::getScalarValue(Variant &value) { + if (!isScalarArrayPairs()) return false; + vector elems; + elems.reserve(128); // normally scalar arrays are large in size + for (unsigned int i = 0; i < m_exps.size(); i++) { + ArrayPairExpressionPtr exp = + dynamic_pointer_cast(m_exps[i]); + ExpressionPtr name = exp->getName(); + ExpressionPtr val = exp->getValue(); + if (!name) { + Variant v; + bool ret = val->getScalarValue(v); + if (!ret) ASSERT(false); + ArrayElement *elem = NEW(ArrayElement)(v); + elems.push_back(elem); + } else { + Variant n; + Variant v; + bool ret1 = name->getScalarValue(n); + bool ret2 = val->getScalarValue(v); + if (!(ret1 && ret2)) ASSERT(false); + ArrayElement *elem = NEW(ArrayElement)(n, v); + elems.push_back(elem); + } + } + value = ArrayData::Create(elems); + return true; +} + +void ExpressionList::setOutputCount(int count) { + ASSERT(count >= 0 && count <= (int)m_exps.size()); + m_outputCount = count; +} + +int ExpressionList::getOutputCount() const { + return m_outputCount < 0 ? m_exps.size() : m_outputCount; +} + +void ExpressionList::resetOutputCount() { + m_outputCount = -1; +} + +void ExpressionList::controlOrder(int withObj /* = 0 */) { + if (!Option::ControlEvalOrder) return; + m_controlOrder = withObj ? 1 + withObj : 1; +} + +bool ExpressionList::controllingOrder() const { + return m_controlOrder && + ((m_controlOrder >= 2 ? 1 : 0) + getOutputCount()) > 1 && + (m_controlOrder == 3 || hasEffect()); +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +ExpressionPtr &ExpressionList::operator[](int index) { + ASSERT(index >= 0 && index < getCount()); + return m_exps[index]; +} + +void ExpressionList::analyzeProgram(AnalysisResultPtr ar) { + analyzeProgramStart(ar); + analyzeProgramEnd(ar); +} + +void ExpressionList::analyzeProgramStart(AnalysisResultPtr ar) { + bool analyzeOrder = ar->getPhase() == AnalysisResult::AnalyzeFinal && + controllingOrder(); + if (analyzeOrder) { + FunctionScopePtr func = ar->getFunctionScope(); + ASSERT(func); + m_tempStart = func->requireCallTemps(m_exps.size() + + (m_controlOrder >= 2 ? 1 : 0)); + } + + for (unsigned int i = 0; i < m_exps.size(); i++) { + if (m_exps[i]) m_exps[i]->analyzeProgram(ar); + } +} + +void ExpressionList::analyzeProgramEnd(AnalysisResultPtr ar) { + bool analyzeOrder = ar->getPhase() == AnalysisResult::AnalyzeFinal && + controllingOrder(); + if (analyzeOrder) { + FunctionScopePtr func = ar->getFunctionScope(); + ASSERT(func); + func->endRequireCallTemps(m_tempStart); + } +} + +ExpressionPtr ExpressionList::preOptimize(AnalysisResultPtr ar) { + for (unsigned int i = 0; i < m_exps.size(); i++) { + ar->preOptimize(m_exps[i]); + } + return ExpressionPtr(); +} + +ExpressionPtr ExpressionList::postOptimize(AnalysisResultPtr ar) { + for (unsigned int i = 0; i < m_exps.size(); i++) { + ar->postOptimize(m_exps[i]); + } + return ExpressionPtr(); +} + +TypePtr ExpressionList::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + for (unsigned int i = 0; i < m_exps.size(); i++) { + if (m_exps[i]) m_exps[i]->inferAndCheck(ar, type, coerce); + } + return type; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ExpressionList::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + for (unsigned int i = 0; i < m_exps.size(); i++) { + if (i > 0) cg.printf(", "); + if (m_exps[i]) m_exps[i]->outputPHP(cg, ar); + } +} + +void ExpressionList::outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_arrayElements) { + cg.printf("ArrayInit(%d).", m_exps.size()); + } + for (unsigned int i = 0; i < m_exps.size(); i++) { + cg.setItemIndex(i); + if (i > 0) cg.printf(m_arrayElements ? "." : ", "); + if (m_exps[i]) { + if (m_arrayElements) { + ArrayPairExpressionPtr ap = + dynamic_pointer_cast(m_exps[i]); + cg.printf("set(%d, ", i); + m_exps[i]->outputCPP(cg, ar); + cg.printf(")"); + } else { + m_exps[i]->outputCPP(cg, ar); + } + } + } + if (m_arrayElements) { + cg.printf(".create()"); + } +} + +bool ExpressionList::outputCPPTooManyArgsPre(CodeGenerator &cg, + AnalysisResultPtr ar, + const std::string &name) { + if (m_outputCount >= 0) { + cg.printf("invoke_too_many_args(\"%s\", (", name.c_str()); + int count = 0; + for (unsigned int i = m_outputCount; i < m_exps.size(); i++) { + ExpressionPtr exp = m_exps[i]; + if (exp && exp->hasEffect()) { + if (count > 0) cg.printf(", "); + exp->outputCPP(cg, ar); + count++; + } + } + if (count > 0) cg.printf(", "); + cg.printf("%d), (", m_exps.size() - m_outputCount); + return true; + } + return false; +} + +void ExpressionList::outputCPPTooManyArgsPost(CodeGenerator &cg, + AnalysisResultPtr ar, + bool voidReturn) { + ASSERT(m_outputCount >= 0); + if (voidReturn) cg.printf(", null"); + cg.printf("))"); +} + +int ExpressionList::outputCPPControlledEvalOrderPre(CodeGenerator &cg, + AnalysisResultPtr ar, + ExpressionPtr obj /* = ExpressionPtr() */) { + if (!controllingOrder()) return -1; + uint oc = getOutputCount(); + cg.printf("("); + int tempStart = tempOffset(); + if (obj && !obj->isScalar()) { + cg.printf("assignCallTemp(%s%d, ", Option::EvalOrderTempPrefix, + m_tempStart); + obj->outputCPP(cg, ar); + cg.printf("),"); + } + for (unsigned int i = 0; i < oc; i++) { + if (m_exps[i] && !m_exps[i]->isScalar()) { + cg.printf("assignCallTemp(%s%d, ", Option::EvalOrderTempPrefix, + tempStart + i); + if (m_arrayElements) { + ArrayPairExpressionPtr ap = + dynamic_pointer_cast(m_exps[i]); + ap->getValue()->outputCPP(cg, ar); + } else { + m_exps[i]->outputCPP(cg, ar); + } + cg.printf("),"); + } + } + return m_tempStart; +} +void ExpressionList::outputCPPControlledEvalOrderPost(CodeGenerator &cg, + AnalysisResultPtr ar) { + if (!controllingOrder()) return; + cg.printf(")"); +} diff --git a/src/lib/expression/expression_list.h b/src/lib/expression/expression_list.h new file mode 100644 index 0000000000000..8b3ac8e0f89cc --- /dev/null +++ b/src/lib/expression/expression_list.h @@ -0,0 +1,90 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXPRESSION_LIST_H__ +#define __EXPRESSION_LIST_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); + +class ExpressionList : public Expression { +public: + ExpressionList(EXPRESSION_CONSTRUCTOR_PARAMETERS); + + // change case to lower so to make it case insensitive + void toLower(); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + void analyzeProgramStart(AnalysisResultPtr ar); + void analyzeProgramEnd(AnalysisResultPtr ar); + + virtual void addElement(ExpressionPtr exp); + virtual void insertElement(ExpressionPtr exp, int index = 0); + virtual bool isScalar() const; + virtual bool hasEffect() const; + bool isNoObjectInvolved() const; + virtual bool containsDynamicConstant(AnalysisResultPtr ar) const; + void removeElement(int index); + virtual bool getScalarValue(Variant &value); + + bool isScalarArrayPairs() const; + + int getCount() const { return m_exps.size();} + ExpressionPtr &operator[](int index); + + void getStrings(std::vector &strings); + + void controlOrder(int withObj = 0); + bool controllingOrder() const; + int tempOffset() const { + return m_tempStart + + (m_controlOrder >= 2 ? 1 : 0); + } + + /** + * When a function call has too many arguments, we only want to output + * max number of arguments, by limiting output count of subexpressions. + */ + void setOutputCount(int count); + int getOutputCount() const; + void resetOutputCount(); + + bool outputCPPTooManyArgsPre(CodeGenerator &cg, AnalysisResultPtr ar, + const std::string &name); + void outputCPPTooManyArgsPost(CodeGenerator &cg, AnalysisResultPtr ar, + bool voidReturn); + + int outputCPPControlledEvalOrderPre(CodeGenerator &cg, + AnalysisResultPtr ar, + ExpressionPtr obj = ExpressionPtr()); + void outputCPPControlledEvalOrderPost(CodeGenerator &cg, + AnalysisResultPtr ar); + +private: + ExpressionPtrVec m_exps; + int m_outputCount; + int m_controlOrder; + int m_tempStart; + bool m_arrayElements; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __EXPRESSION_LIST_H__ diff --git a/src/lib/expression/function_call.cpp b/src/lib/expression/function_call.cpp new file mode 100644 index 0000000000000..8546bd31d601d --- /dev/null +++ b/src/lib/expression/function_call.cpp @@ -0,0 +1,125 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +FunctionCall::FunctionCall +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr nameExp, const std::string &name, ExpressionListPtr params, + const std::string *classname) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_nameExp(nameExp), m_params(params), m_valid(false), m_validClass(false), + m_extraArg(0), m_variableArgument(false), m_voidReturn(false), + m_voidWrapper(false), m_allowVoidReturn(false), m_redeclared(false), + m_redeclaredClass(false), m_derivedFromRedeclaring(false) { + + if (m_nameExp && + m_nameExp->getKindOf() == Expression::KindOfScalarExpression) { + ASSERT(m_name.empty()); + ScalarExpressionPtr c = dynamic_pointer_cast(m_nameExp); + m_origName = c->getString(); + c->toLower(); + m_name = c->getString(); + ASSERT(!m_name.empty()); + } else { + m_origName = name; + m_name = Util::toLower(name); + } + + if (classname) m_className = Util::toLower(*classname); +} + +void FunctionCall::reset() { + m_valid = false; + m_validClass = false; + m_extraArg = 0; + m_variableArgument = false; + m_voidWrapper = false; +} + +ExpressionPtr FunctionCall::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_nameExp); + ar->preOptimize(m_params); + return ExpressionPtr(); +} + +ExpressionPtr FunctionCall::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_nameExp); + ar->postOptimize(m_params); + return ExpressionPtr(); +} + +/////////////////////////////////////////////////////////////////////////////// + +TypePtr FunctionCall::checkParamsAndReturn(AnalysisResultPtr ar, + TypePtr type, bool coerce, + FunctionScopePtr func) { + ConstructPtr self = shared_from_this(); + ar->getDependencyGraph()->add(DependencyGraph::KindOfFunctionCall, + ar->getName(), getText(), + self, func->getFullName(), func->getStmt()); + TypePtr frt = func->getReturnType(); + if (!frt) { + m_voidReturn = true; + setActualType(TypePtr()); + if (!type->is(Type::KindOfAny)) { + if (!m_allowVoidReturn && ar->isSecondPass() && !func->isAbstract()) { + ar->getCodeError()->record(self, CodeError::UseVoidReturn, self); + } + m_voidWrapper = true; + } + } else { + m_voidReturn = false; + m_voidWrapper = false; + type = checkTypesImpl(ar, type, frt, coerce); + } + m_valid = true; + m_extraArg = func->inferParamTypes(ar, self, m_params, m_valid); + m_variableArgument = func->isVariableArgument(); + + return type; +} + +void FunctionCall::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_voidWrapper) { + cg.printf("("); + } + Expression::outputCPP(cg, ar); + if (m_voidWrapper) { + cg.printf(", null)"); + } +} + +void FunctionCall::setFunctionAndClassScope(FunctionScopePtr fsp, + ClassScopePtr csp) { + m_funcScope = fsp; + m_classScope = csp; +} diff --git a/src/lib/expression/function_call.h b/src/lib/expression/function_call.h new file mode 100644 index 0000000000000..035eb8f560574 --- /dev/null +++ b/src/lib/expression/function_call.h @@ -0,0 +1,80 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __FUNCTION_CALL_H__ +#define __FUNCTION_CALL_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(FunctionScope); +DECLARE_BOOST_TYPES(FunctionCall); + +class FunctionCall : public Expression { +public: + FunctionCall(EXPRESSION_CONSTRUCTOR_PARAMETERS, ExpressionPtr nameExp, + const std::string &name, ExpressionListPtr params, + const std::string *className); + + // overriding Expression::outputCPP to implement void wrapper + virtual void outputCPP(CodeGenerator &cg, AnalysisResultPtr ar); + virtual bool isRefable() const { return true;} + + virtual ExpressionPtr preOptimize(AnalysisResultPtr ar); + virtual ExpressionPtr postOptimize(AnalysisResultPtr ar); + + void setAllowVoidReturn() { m_allowVoidReturn = true;} + void setFunctionAndClassScope(FunctionScopePtr fsp, ClassScopePtr csp); +protected: + ExpressionPtr m_nameExp; + std::string m_name; + std::string m_origName; + ExpressionListPtr m_params; + std::string m_className; + + // Pointers to the corresponding function scope and class scope for this + // function call, set during the AnalyzeAll phase. These pointers may be + // null if the function scope or class scope could not be resolved. + FunctionScopePtr m_funcScope; + ClassScopePtr m_classScope; + + bool m_valid; + bool m_validClass; + int m_extraArg; + bool m_variableArgument; + bool m_voidReturn; // no return type + bool m_voidWrapper; // void wrapper is needed + bool m_allowVoidReturn; + bool m_redeclared; + bool m_redeclaredClass; + bool m_derivedFromRedeclaring; + + /** + * Each program needs to reset this object's members to revalidate + * a function call. + */ + void reset(); + + TypePtr checkParamsAndReturn(AnalysisResultPtr ar, TypePtr type, + bool coerce, FunctionScopePtr func); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __FUNCTION_CALL_H__ diff --git a/src/lib/expression/include_expression.cpp b/src/lib/expression/include_expression.cpp new file mode 100644 index 0000000000000..542fdde14822e --- /dev/null +++ b/src/lib/expression/include_expression.cpp @@ -0,0 +1,181 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +IncludeExpression::IncludeExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp, int op) + : UnaryOpExpression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES, exp, op, true), + m_documentRoot(false) { +} + +ExpressionPtr IncludeExpression::clone() { + IncludeExpressionPtr exp(new IncludeExpression(*this)); + Expression::deepCopy(exp); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void IncludeExpression::onParse(AnalysisResultPtr ar) { + // See if we can get a string literal + preOptimize(ar); + m_include = ar->getDependencyGraph()->add + (DependencyGraph::KindOfPHPInclude, shared_from_this(), m_exp, + ar->getCodeError(), m_documentRoot); +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +std::string IncludeExpression::getCurrentInclude(AnalysisResultPtr ar) { + return m_include; +} + +void IncludeExpression::analyzeInclude(AnalysisResultPtr ar, + const std::string &include) { + ASSERT(ar->getPhase() == AnalysisResult::AnalyzeInclude); + ConstructPtr self = shared_from_this(); + FileScopePtr file = ar->findFileScope(include, true); + if (!file) { + ar->getCodeError()->record(self, CodeError::PHPIncludeFileNotFound, self); + return; + } + if (include.find("lib/") != 0 || + include.find("/lib/") == string::npos) { + ar->getCodeError()->record(self, CodeError::PHPIncludeFileNotInLib, + self, ConstructPtr(), + include.c_str()); + } + + if (!isFileLevel()) { // Not unsupported but potentially bad + ar->getCodeError()->record(self, CodeError::UseDynamicInclude, self); + } + + ar->getDependencyGraph()->add + (DependencyGraph::KindOfProgramMaxInclude, + ar->getName(), file->getName(), StatementPtr()); + ar->getDependencyGraph()->addParent + (DependencyGraph::KindOfProgramMinInclude, + ar->getName(), file->getName(), StatementPtr()); + FunctionScopePtr func = ar->getFunctionScope(); + ar->getFileScope()->addIncludeDependency(ar, m_include, + func && func->isInlined()); +} + +void IncludeExpression::analyzeProgram(AnalysisResultPtr ar) { + if (ar->isFirstPass()) { + ConstructPtr self = shared_from_this(); + if (m_op == T_INCLUDE || m_op == T_REQUIRE) { + ar->getCodeError()->record(self, CodeError::UseInclude, self); + } + } + + string include = getCurrentInclude(ar); + if (!include.empty()) { + if (ar->getPhase() == AnalysisResult::AnalyzeInclude) { + analyzeInclude(ar, include); + } + } + if (!ar->getScope()->inPseudoMain()) { + VariableTablePtr var = ar->getScope()->getVariables(); + var->setAttribute(VariableTable::ContainsLDynamicVariable); + var->forceVariants(ar); + } + + UnaryOpExpression::analyzeProgram(ar); +} + +ExpressionPtr IncludeExpression::preOptimize(AnalysisResultPtr ar) { + return UnaryOpExpression::preOptimize(ar); +} + +ExpressionPtr IncludeExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + if (!Option::KeepStatementsWithNoEffect && !m_include.empty()) { + FileScopePtr fs = ar->findFileScope(m_include, false); + if (fs && !fs->hasImpl(ar)) { + return ScalarExpressionPtr + (new ScalarExpression(getLocation(), + Expression::KindOfScalarExpression, + 1)); + } + } + return ExpressionPtr(); +} + +TypePtr IncludeExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + return UnaryOpExpression::inferTypes(ar, type, coerce); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void IncludeExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + + UnaryOpExpression::outputPHP(cg, ar); +} + +void IncludeExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool linemap = outputLineMap(cg, ar); + + // Includes aren't really supported in system mode + if (cg.getOutput() == CodeGenerator::SystemCPP) { + cg.printf("true"); + if (linemap) cg.printf(")"); + return; + } + bool require = (m_op == T_REQUIRE || m_op == T_REQUIRE_ONCE); + bool once = (m_op == T_INCLUDE_ONCE || m_op == T_REQUIRE_ONCE); + if (!getCurrentInclude(ar).empty()) { + FileScopePtr fs = ar->findFileScope(getCurrentInclude(ar), false); + if (fs) { + cg.printf("%s%s(%s, variables)", Option::PseudoMainPrefix, + fs->pseudoMainName().c_str(), once ? "true" : "false"); + if (linemap) cg.printf(")"); + return; + } + } + + // fallback to dynamic include + cg.printf("%s(", require ? "require" : "include"); + m_exp->outputCPP(cg, ar); + cg.printf(", %s, variables)", once ? "true" : "false"); + if (linemap) cg.printf(")"); +} diff --git a/src/lib/expression/include_expression.h b/src/lib/expression/include_expression.h new file mode 100644 index 0000000000000..293337d620cc0 --- /dev/null +++ b/src/lib/expression/include_expression.h @@ -0,0 +1,58 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __INCLUDE_EXPRESSION_H__ +#define __INCLUDE_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(IncludeExpression); + +class IncludeExpression : public UnaryOpExpression, + public IParseHandler { +public: + IncludeExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr exp, int op); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + + // implementing IParseHandler + virtual void onParse(AnalysisResultPtr ar); + + void setDocumentRoot() { m_documentRoot = true;} + bool isDocumentRoot() { return m_documentRoot;} + +private: + /** + * There are 3 forms of include paths: + * + * 1. "/" starts with '/'. + * 2. "" starts without '/': relative to containing file + * 3. "" + m_documentRoot == true: relative to doc root + */ + bool m_documentRoot; + std::string m_include; + + std::string getCurrentInclude(AnalysisResultPtr ar); + void analyzeInclude(AnalysisResultPtr ar, const std::string &include); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __INCLUDE_EXPRESSION_H__ diff --git a/src/lib/expression/list_assignment.cpp b/src/lib/expression/list_assignment.cpp new file mode 100644 index 0000000000000..9efa82b20595a --- /dev/null +++ b/src/lib/expression/list_assignment.cpp @@ -0,0 +1,183 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ListAssignment::ListAssignment +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionListPtr variables, ExpressionPtr array) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_variables(variables), m_array(array), m_sublist(false) { + setLValue(); +} + +ExpressionPtr ListAssignment::clone() { + ListAssignmentPtr exp(new ListAssignment(*this)); + Expression::deepCopy(exp); + exp->m_variables = Clone(m_variables); + return exp; +} + +void ListAssignment::setLValue() { + if (m_variables) { + for (int i = 0; i < m_variables->getCount(); i++) { + ExpressionPtr exp = (*m_variables)[i]; + if (exp) { + if (exp->is(Expression::KindOfListAssignment)) { + ListAssignmentPtr sublist = + dynamic_pointer_cast(exp); + sublist->setSublist(); + } else { + exp->setContext(Expression::LValue); + } + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ListAssignment::analyzeProgram(AnalysisResultPtr ar) { + if (m_variables) m_variables->analyzeProgram(ar); + if (m_array) m_array->analyzeProgram(ar); + if (!m_sublist && ar->isFirstPass()) { + createLambda(ar); + } + FunctionScopePtr func = ar->getFunctionScope(); + if (func) func->disableInline(); +} + +ExpressionPtr ListAssignment::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_variables); + ar->preOptimize(m_array); + return ExpressionPtr(); +} + +ExpressionPtr ListAssignment::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_variables); + ar->postOptimize(m_array); + return ExpressionPtr(); +} + +TypePtr ListAssignment::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + if (m_variables) { + for (int i = 0; i < m_variables->getCount(); i++) { + ExpressionPtr exp = (*m_variables)[i]; + if (exp) { + if (exp->is(Expression::KindOfListAssignment)) { + exp->inferAndCheck(ar, NEW_TYPE(Any), false); + } else { + AssignmentExpression::inferTypesImpl(ar, Type::Variant, true, exp); + } + } + } + } + + if (!m_array) return TypePtr(); + return m_array->inferAndCheck(ar, NEW_TYPE(Some), true); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ListAssignment::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("list("); + if (m_variables) m_variables->outputPHP(cg, ar); + if (m_array) { + cg.printf(") = "); + m_array->outputPHP(cg, ar); + } else { + cg.printf(")"); + } +} + +void ListAssignment::outputCPPLambdaBody(CodeGenerator &cg, + AnalysisResultPtr ar, + int &tempCount, int &argCount) { + if (!m_variables) return; + int entryTemp = tempCount; + for (int i = 0; i < m_variables->getCount(); i++) { + ExpressionPtr exp = (*m_variables)[i]; + if (exp) { + if (exp->is(Expression::KindOfListAssignment)) { + int tmp = ++tempCount; + cg.printf("Variant a%d = a%d.rvalAt(%d);\n", tmp, entryTemp, i); + ListAssignmentPtr sublist = dynamic_pointer_cast(exp); + sublist->outputCPPLambdaBody(cg, ar, tempCount, argCount); + } else { + cg.printf("p%d = a%d.rvalAt(%d);\n", argCount++, entryTemp, i); + } + } + } +} + +void ListAssignment::createLambda(AnalysisResultPtr ar) { + ostringstream args, body; + CodeGenerator cg(&body, CodeGenerator::ClusterCPP); + int tc = 0; + int ac = 0; + cg.printf("Variant a0; if (aa.is(KindOfArray)) a0 = aa;\n"); + outputCPPLambdaBody(cg, ar, tc, ac); + cg.printf("return aa;\n"); + args << "CVarRef aa"; + for (int i = 0; i < ac; i++) { + args << ", Variant &p" << i; + } + m_lambda = ar->getFileScope()->addLambda("Variant", args.str(), body.str()); +} + +void ListAssignment::outputCPPAssignment(CodeGenerator &cg, + AnalysisResultPtr ar) { + if (!m_variables) return; + + for (int i = 0; i < m_variables->getCount(); i++) { + ExpressionPtr exp = (*m_variables)[i]; + if (exp) { + if (exp->is(Expression::KindOfListAssignment)) { + ListAssignmentPtr sublist = dynamic_pointer_cast(exp); + sublist->outputCPPAssignment(cg, ar); + } else { + cg.printf(", "); + exp->outputCPP(cg, ar); + } + } + } +} + +void ListAssignment::outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) { + ASSERT(m_array); + + cg.printf("%s(", m_lambda.c_str()); + m_array->outputCPP(cg, ar); + outputCPPAssignment(cg, ar); + cg.printf(")"); +} diff --git a/src/lib/expression/list_assignment.h b/src/lib/expression/list_assignment.h new file mode 100644 index 0000000000000..2f04245a358bc --- /dev/null +++ b/src/lib/expression/list_assignment.h @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __LIST_ASSIGNMENT_H__ +#define __LIST_ASSIGNMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(ListAssignment); + +class ListAssignment : public Expression { +public: + ListAssignment(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionListPtr variables, ExpressionPtr array); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + +private: + ExpressionListPtr m_variables; + ExpressionPtr m_array; + std::string m_lambda; + + bool m_sublist; + void setSublist() { + m_sublist = true; + } + + void setLValue(); + void outputCPPLambdaBody(CodeGenerator &cg, AnalysisResultPtr ar, + int &tempCount, int &argCount); + void createLambda(AnalysisResultPtr ar); + void outputCPPAssignment(CodeGenerator &cg, AnalysisResultPtr ar); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __LIST_ASSIGNMENT_H__ diff --git a/src/lib/expression/modifier_expression.cpp b/src/lib/expression/modifier_expression.cpp new file mode 100644 index 0000000000000..874ab77c14fe2 --- /dev/null +++ b/src/lib/expression/modifier_expression.cpp @@ -0,0 +1,153 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ModifierExpression::ModifierExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES) { +} + +ExpressionPtr ModifierExpression::clone() { + ModifierExpressionPtr exp(new ModifierExpression(*this)); + Expression::deepCopy(exp); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void ModifierExpression::add(int modifier) { + m_modifiers.push_back(modifier); +} + +int ModifierExpression::operator[](int index) { + ASSERT(index >= 0 && index < getCount()); + return m_modifiers[index]; +} + +bool ModifierExpression::isPublic() const { + for (unsigned int i = 0; i < m_modifiers.size(); i++) { + switch (m_modifiers[i]) { + case T_PUBLIC: return true; + case T_PROTECTED: + case T_PRIVATE: return false; + default: + break; + } + } + return true; +} + +bool ModifierExpression::hasModifier(int modifier) const { + for (unsigned int i = 0; i < m_modifiers.size(); i++) { + if (m_modifiers[i] == modifier) { + return true; + } + } + return false; +} + +bool ModifierExpression::isProtected() const { + return hasModifier(T_PROTECTED); +} + +bool ModifierExpression::isPrivate() const { + return hasModifier(T_PRIVATE); +} + +bool ModifierExpression::isStatic() const { + return hasModifier(T_STATIC); +} + +bool ModifierExpression::isAbstract() const { + return hasModifier(T_ABSTRACT); +} + +bool ModifierExpression::isFinal() const { + return hasModifier(T_FINAL); +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ModifierExpression::analyzeProgram(AnalysisResultPtr ar) { + // do nothing +} + +ExpressionPtr ModifierExpression::preOptimize(AnalysisResultPtr ar) { + return ExpressionPtr(); +} + +ExpressionPtr ModifierExpression::postOptimize(AnalysisResultPtr ar) { + return ExpressionPtr(); +} + +TypePtr ModifierExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + ASSERT(false); + return TypePtr(); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ModifierExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_modifiers.empty()) { + cg.printf("public"); + return; + } + + for (unsigned int i = 0; i < m_modifiers.size(); i++) { + if (i > 0) cg.printf(" "); + + switch (m_modifiers[i]) { + case T_PUBLIC: cg.printf("public"); break; + case T_PROTECTED: cg.printf("protected"); break; + case T_PRIVATE: cg.printf("private"); break; + case T_STATIC: cg.printf("static"); break; + case T_ABSTRACT: cg.printf("abstract"); break; + case T_FINAL: cg.printf("final"); break; + default: + ASSERT(false); + } + } +} + +void ModifierExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + /** + * Not sure if we can bar access coding errors... + if (isPublic()) { + cg.printf("public: "); + } else if (isProtected()) { + cg.printf("protected: "); + } else { + cg.printf("private: "); + } + */ + cg.printf("public: "); + + if (isStatic()) cg.printf("static "); +} diff --git a/src/lib/expression/modifier_expression.h b/src/lib/expression/modifier_expression.h new file mode 100644 index 0000000000000..9a5c99dab5bd1 --- /dev/null +++ b/src/lib/expression/modifier_expression.h @@ -0,0 +1,53 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __MODIFIER_EXPRESSION_H__ +#define __MODIFIER_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ModifierExpression); + +class ModifierExpression : public Expression { +public: + ModifierExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + + void add(int modifier); + int getCount() const { return m_modifiers.size();} + int operator[](int index); + + bool isPublic() const; + bool isProtected() const; + bool isPrivate() const; + bool isStatic() const; + bool isAbstract() const; + bool isFinal() const; + +private: + std::vector m_modifiers; + + bool hasModifier(int modifier) const; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __MODIFIER_EXPRESSION_H__ diff --git a/src/lib/expression/new_object_expression.cpp b/src/lib/expression/new_object_expression.cpp new file mode 100644 index 0000000000000..fe0c9bac60080 --- /dev/null +++ b/src/lib/expression/new_object_expression.cpp @@ -0,0 +1,185 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +NewObjectExpression::NewObjectExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr variable, ExpressionListPtr params) + : FunctionCall(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES, + variable, "", params, NULL), m_redeclared(false) { +} + +ExpressionPtr NewObjectExpression::clone() { + NewObjectExpressionPtr exp(new NewObjectExpression(*this)); + FunctionCall::deepCopy(exp); + exp->m_params = Clone(m_params); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void NewObjectExpression::analyzeProgram(AnalysisResultPtr ar) { + if (!m_name.empty()) { + addUserClass(ar, m_name); + } + + m_nameExp->analyzeProgram(ar); + if (m_params) { + m_params->controlOrder(); + m_params->analyzeProgram(ar); + } +} + +ExpressionPtr NewObjectExpression::preOptimize(AnalysisResultPtr ar) { + return FunctionCall::preOptimize(ar); +} + +ExpressionPtr NewObjectExpression::postOptimize(AnalysisResultPtr ar) { + return FunctionCall::postOptimize(ar); +} + +TypePtr NewObjectExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + reset(); + ConstructPtr self = shared_from_this(); + if (!m_name.empty()) { + ClassScopePtr cls = ar->findClass(m_name); + if (!cls || cls->isRedeclaring()) { + if (cls) { + m_redeclared = true; + ar->getScope()->getVariables()-> + setAttribute(VariableTable::NeedGlobalPointer); + } + if (!cls && ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UnknownClass, self); + } + if (m_params) m_params->inferAndCheck(ar, NEW_TYPE(Any), false); + return NEW_TYPE(Object); + } + + m_validClass = true; + FunctionScopePtr func = cls->findConstructor(ar, true); + if (!func) { + if (m_params && m_params->getCount()) { + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::BadConstructorCall, + self); + } + m_params->inferAndCheck(ar, NEW_TYPE(Any), false); + m_params->setOutputCount(0); + } + } else { + m_extraArg = func->inferParamTypes(ar, self, m_params, + m_validClass); + m_variableArgument = func->isVariableArgument(); + } + return Type::CreateObjectType(m_name); + } else { + ar->containsDynamicClass(); + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UseDynamicClass, + self); + } + if (m_params) { + for (int i = 0; i < m_params->getCount(); i++) { + (*m_params)[i]->setContext(Expression::RefValue); + } + } + } + + m_nameExp->inferAndCheck(ar, Type::String, false); + if (m_params) m_params->inferAndCheck(ar, NEW_TYPE(Any), false); + return Type::Variant;//NEW_TYPE(Object); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void NewObjectExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + outputLineMap(cg, ar); + + cg.printf("new "); + m_nameExp->outputPHP(cg, ar); + cg.printf("("); + if (m_params) m_params->outputPHP(cg, ar); + cg.printf(")"); +} + +void NewObjectExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool linemap = outputLineMap(cg, ar); + if (m_params) m_params->outputCPPControlledEvalOrderPre(cg, ar); + if (!m_name.empty() && !m_redeclared && m_validClass) { + bool tooManyArgs = + (m_params && m_params->outputCPPTooManyArgsPre(cg, ar, m_name)); + cg.printf("%s%s(%s%s(NEW(%s%s)())->create(", + Option::SmartPtrPrefix, m_name.c_str(), + Option::SmartPtrPrefix, m_name.c_str(), + Option::ClassPrefix, m_name.c_str(), + Option::ClassPrefix, m_name.c_str()); + FunctionScope::outputCPPArguments(m_params, cg, ar, m_extraArg, + m_variableArgument); + cg.printf("))"); + if (tooManyArgs) { + m_params->outputCPPTooManyArgsPost(cg, ar, m_voidReturn); + } + } else { + if (m_redeclared) { + cg.printf("g->%s%s->create(", Option::ClassStaticsObjectPrefix, + m_name.c_str()); + } else { + cg.printf("create_object("); + if (!m_name.empty()) { + cg.printf("\"%s\"", m_name.c_str()); + } else if (m_nameExp->is(Expression::KindOfSimpleVariable)) { + m_nameExp->outputCPP(cg, ar); + } else { + cg.printf("("); + m_nameExp->outputCPP(cg, ar); + cg.printf(")"); + } + cg.printf(", "); + } + if (m_params) { + FunctionScope::outputCPPArguments(m_params, cg, ar, -1, false); + } else { + cg.printf("Array()"); + } + cg.printf(")"); + } + if (m_params) m_params->outputCPPControlledEvalOrderPost(cg, ar); + if (linemap) cg.printf(")"); +} diff --git a/src/lib/expression/new_object_expression.h b/src/lib/expression/new_object_expression.h new file mode 100644 index 0000000000000..1654c04edc94b --- /dev/null +++ b/src/lib/expression/new_object_expression.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __NEW_OBJECT_EXPRESSION_H__ +#define __NEW_OBJECT_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(NewObjectExpression); + +class NewObjectExpression : public FunctionCall { +public: + NewObjectExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr variable, ExpressionListPtr params); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + +private: + bool m_redeclared; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __NEW_OBJECT_EXPRESSION_H__ diff --git a/src/lib/expression/object_method_expression.cpp b/src/lib/expression/object_method_expression.cpp new file mode 100644 index 0000000000000..88a1971148056 --- /dev/null +++ b/src/lib/expression/object_method_expression.cpp @@ -0,0 +1,387 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ObjectMethodExpression::ObjectMethodExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr object, ExpressionPtr method, ExpressionListPtr params) + : FunctionCall(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES, + method, "", params, NULL), m_object(object), + m_invokeFewArgsDecision(true) { + m_object->setContext(Expression::ObjectContext); + m_object->clearContext(Expression::LValue); +} + +ExpressionPtr ObjectMethodExpression::clone() { + ObjectMethodExpressionPtr exp(new ObjectMethodExpression(*this)); + Expression::deepCopy(exp); + exp->m_params = Clone(m_params); + exp->m_object = Clone(m_object); + exp->m_nameExp = Clone(m_nameExp); + return exp; +} + +ClassScopePtr ObjectMethodExpression::resolveClass(AnalysisResultPtr ar, + string &name) { + ClassScopePtr cls = ar->findClass(name, AnalysisResult::MethodName); + if (cls) { + addUserClass(ar, cls->getName()); + return cls; + } + string construct("__construct"); + cls = ar->findClass(construct, + AnalysisResult::MethodName); + if (cls && name == cls->getName()) { + name = "__construct"; + cls->setAttribute(ClassScope::classNameConstructor); + return cls; + } + return ClassScopePtr(); +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ObjectMethodExpression::analyzeProgram(AnalysisResultPtr ar) { + m_params->controlOrder(m_object->hasEffect() ? 2 : 1); + m_params->analyzeProgramStart(ar); + m_object->analyzeProgram(ar); + m_params->analyzeProgramEnd(ar); + m_nameExp->analyzeProgram(ar); + + + if (ar->getPhase() == AnalysisResult::AnalyzeAll && + m_object->isThis() && !m_name.empty()) { + ClassScopePtr cls = ar->getClassScope(); + if (cls && !cls->findFunction(ar, m_name, true)) { + cls->addMissingMethod(m_name); + } + } +} + +bool ObjectMethodExpression::canInvokeFewArgs() { + // We can always change out minds about saying yes, but once we say + // no, it sticks. + if (m_invokeFewArgsDecision && m_params && + (m_params->getCount() > Option::InvokeFewArgsCount || + m_params->controllingOrder())) { + m_invokeFewArgsDecision = false; + } + return m_invokeFewArgsDecision; +} + +ExpressionPtr ObjectMethodExpression::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_object); + return FunctionCall::preOptimize(ar); +} + +ExpressionPtr ObjectMethodExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_object); + return FunctionCall::postOptimize(ar); +} + +TypePtr ObjectMethodExpression::inferTypes(AnalysisResultPtr ar, + TypePtr type, bool coerce) { + ASSERT(false); + return TypePtr(); +} + +void ObjectMethodExpression::setInvokeParams(AnalysisResultPtr ar) { + bool highParamCount = !canInvokeFewArgs(); + Context newContext = highParamCount ? Expression::RefValue : + (Expression::Context)(Expression::RefValue | Expression::NoRefWrapper); + for (int i = 0; i < m_params->getCount(); i++) { + ExpressionPtr param = (*m_params)[i]; + if ((param->getContext() & Expression::RefValue) == 0) { + param->setContext(newContext); + param->setContext(Expression::InvokeArgument); + } + param->inferAndCheck(ar, Type::Variant, false); + } + m_params->resetOutputCount(); +} + +TypePtr ObjectMethodExpression::inferAndCheck(AnalysisResultPtr ar, + TypePtr type, bool coerce) { + reset(); + + ConstructPtr self = shared_from_this(); + TypePtr objectType = m_object->inferAndCheck(ar, NEW_TYPE(Object), true); + m_valid = true; + + if (m_name.empty()) { + // if dynamic property or method, we have nothing to find out + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UseDynamicMethod, self); + } + m_nameExp->inferAndCheck(ar, Type::String, false); + setInvokeParams(ar); + // we have to use a variant to hold dynamic value + return checkTypesImpl(ar, type, Type::Variant, coerce); + } + + ClassScopePtr cls; + if (objectType && !objectType->getName().empty()) { + // what object-> has told us + cls = ar->findClass(objectType->getName()); + ASSERT(cls); + } else { + // what ->method has told us + cls = resolveClass(ar, m_name); + if (!cls) { + if (ar->isFirstPass() && + !ar->classMemberExists(m_name, AnalysisResult::MethodName)) { + ar->getCodeError()->record(self, CodeError::UnknownObjectMethod, self); + } + + setInvokeParams(ar); + return checkTypesImpl(ar, type, Type::Variant, coerce); + } + + m_object->inferAndCheck(ar, Type::CreateObjectType(cls->getName()), true); + } + + FunctionScopePtr func = cls->findFunction(ar, m_name, true); + if (!func) { + if (ar->isFirstPass() && + !cls->hasAttribute(ClassScope::HasUnknownMethodHandler, ar)) { + if (ar->classMemberExists(m_name, AnalysisResult::MethodName)) { + // TODO: we could try to find out class derivation is present... + ar->getCodeError()->record(self, CodeError::DerivedObjectMethod, self); + // we have to make sure the method is in invoke list + setDynamicByIdentifier(ar, m_name); + } else { + ar->getCodeError()->record(self, CodeError::UnknownObjectMethod, self); + } + } + + m_valid = false; + setInvokeParams(ar); + return checkTypesImpl(ar, type, Type::Variant, coerce); + } + bool valid = true; + + // use $this inside a static function + if (m_object->isThis()) { + FunctionScopePtr localfunc = ar->getFunctionScope(); + if (localfunc->isStatic()) { + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::MissingObjectContext, + self); + } + valid = false; + } + } + + // invoke() will return Variant + if (func->isVirtual() || !m_object->getType()->isSpecificObject()) { + valid = false; + } + + if (!valid) { + setInvokeParams(ar); + checkTypesImpl(ar, type, Type::Variant, coerce); + m_valid = false; // so we use invoke() syntax + return m_actualType; + } + + return checkParamsAndReturn(ar, type, coerce, func); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ObjectMethodExpression::outputPHP(CodeGenerator &cg, + AnalysisResultPtr ar) { + outputLineMap(cg, ar); + + m_object->outputPHP(cg, ar); + cg.printf("->"); + if (m_nameExp->getKindOf() == Expression::KindOfScalarExpression) { + m_nameExp->outputPHP(cg, ar); + } else { + cg.printf("{"); + m_nameExp->outputPHP(cg, ar); + cg.printf("}"); + } + cg.printf("("); + m_params->outputPHP(cg, ar); + cg.printf(")"); +} + +bool ObjectMethodExpression::directVariantProxy(AnalysisResultPtr ar) { + TypePtr actualType = m_object->getActualType(); + if (actualType && actualType->is(Type::KindOfVariant)) { + if (m_object->is(KindOfSimpleVariable)) { + SimpleVariablePtr var = + dynamic_pointer_cast(m_object); + const std::string &name = var->getName(); + FunctionScopePtr func = + dynamic_pointer_cast(ar->getScope()); + VariableTablePtr variables = func->getVariables(); + if (!variables->isParameter(name) || variables->isLvalParam(name)) { + return true; + } + if (variables->getAttribute(VariableTable::ContainsDynamicVariable) || + variables->getAttribute(VariableTable::ContainsExtract)) { + return true; + } + } else { + return true; + } + } + return false; +} + +void ObjectMethodExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool linemap = outputLineMap(cg, ar); + bool isThis = m_object->isThis(); + + if (isThis && ar->getFunctionScope()->isStatic()) { + cg.printf("throw_fatal(\"Using $this when not in object context\")"); + if (linemap) cg.printf(")"); + return; + } + + stringstream objTmp; + int objIdx = -1; + if (m_params) { + objIdx = + m_params->outputCPPControlledEvalOrderPre(cg, ar, + isThis ? ExpressionPtr() + : m_object); + objTmp << Option::EvalOrderTempPrefix << objIdx; + } + bool fewParams = canInvokeFewArgs(); + bool tooManyArgs = m_params && + m_params->outputCPPTooManyArgsPre(cg, ar, m_name); + if (!isThis) { + if (directVariantProxy(ar)) { + if (objIdx == -1) { + TypePtr expectedType = m_object->getExpectedType(); + ASSERT(expectedType->is(Type::KindOfObject)); + // Clear m_expectedType to avoid type cast (toObject). + m_object->setExpectedType(TypePtr()); + m_object->outputCPP(cg, ar); + m_object->setExpectedType(expectedType); + } else { + cg.printf("%s", objTmp.str().c_str()); + } + cg.printf("."); + } else { + if (objIdx == -1) { + m_object->outputCPP(cg, ar); + } else { + TypePtr type = m_object->getType(); + cg.printf("%s.toObject()", objTmp.str().c_str()); + if (type->isSpecificObject()) { + cg.printf(".getTyped<%s%s>()", Option::ClassPrefix, + type->getName().c_str()); + } + } + cg.printf("->"); + } + } + + if (!m_name.empty()) { + if (m_valid && m_object->getType()->isSpecificObject()) { + cg.printf("%s%s(", Option::MethodPrefix, m_name.c_str()); + FunctionScope::outputCPPArguments(m_params, cg, ar, m_extraArg, + m_variableArgument); + cg.printf(")"); + if (tooManyArgs) { + m_params->outputCPPTooManyArgsPost(cg, ar, m_voidReturn); + } + } else { + if (fewParams) { + uint64 hash = hash_string_i(m_name.data(), m_name.size()); + cg.printf("%s%sinvoke_few_args(\"%s\"", Option::ObjectPrefix, + isThis ? "root_" : "", m_origName.c_str()); + cg.printf(", 0x%016llXLL, ", hash); + + if (m_params && m_params->getCount()) { + cg.printf("%d, ", m_params->getCount()); + FunctionScope::outputCPPArguments(m_params, cg, ar, 0, false); + } else { + cg.printf("0"); + } + cg.printf(")"); + } else { + cg.printf("%s%sinvoke(\"%s\"", Option::ObjectPrefix, + isThis ? "root_" : "", m_origName.c_str()); + cg.printf(", "); + if (m_params && m_params->getCount()) { + FunctionScope::outputCPPArguments(m_params, cg, ar, -1, false); + } else { + cg.printf("Array()"); + } + uint64 hash = hash_string_i(m_name.data(), m_name.size()); + cg.printf(", 0x%016llXLL)", hash); + } + } + } else { + if (fewParams) { + cg.printf("%s%sinvoke_few_args(", Option::ObjectPrefix, + isThis ? "root_" : ""); + m_nameExp->outputCPP(cg, ar); + cg.printf(", -1LL, "); + if (m_params && m_params->getCount()) { + cg.printf("%d, ", m_params->getCount()); + FunctionScope::outputCPPArguments(m_params, cg, ar, 0, false); + } else { + cg.printf("0"); + } + cg.printf(")"); + } else { + cg.printf("%s%sinvoke((", Option::ObjectPrefix, isThis ? "root_" : ""); + m_nameExp->outputCPP(cg, ar); + cg.printf(")"); + cg.printf(", "); + if (m_params && m_params->getCount()) { + FunctionScope::outputCPPArguments(m_params, cg, ar, -1, false); + } else { + cg.printf("Array()"); + } + cg.printf(", -1LL)"); + } + } + if (m_params) m_params->outputCPPControlledEvalOrderPost(cg, ar); + if (linemap) cg.printf(")"); +} diff --git a/src/lib/expression/object_method_expression.h b/src/lib/expression/object_method_expression.h new file mode 100644 index 0000000000000..2a22631d6ff18 --- /dev/null +++ b/src/lib/expression/object_method_expression.h @@ -0,0 +1,53 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __OBJECT_METHOD_EXPRESSION_H__ +#define __OBJECT_METHOD_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ObjectMethodExpression); +DECLARE_BOOST_TYPES(ClassScope); + +class ObjectMethodExpression : public FunctionCall { +public: + ObjectMethodExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr object, ExpressionPtr method, + ExpressionListPtr params); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + + virtual TypePtr inferAndCheck(AnalysisResultPtr ar, TypePtr type, + bool coerce); + +private: + ExpressionPtr m_object; + + void setInvokeParams(AnalysisResultPtr ar); + ClassScopePtr resolveClass(AnalysisResultPtr ar, std::string &name); + // for avoiding code generate toObject(Variant) + bool directVariantProxy(AnalysisResultPtr ar); + bool canInvokeFewArgs(); + bool m_invokeFewArgsDecision; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __OBJECT_METHOD_EXPRESSION_H__ diff --git a/src/lib/expression/object_property_expression.cpp b/src/lib/expression/object_property_expression.cpp new file mode 100644 index 0000000000000..4254bfa7374f3 --- /dev/null +++ b/src/lib/expression/object_property_expression.cpp @@ -0,0 +1,345 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ObjectPropertyExpression::ObjectPropertyExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr object, ExpressionPtr property) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_object(object), m_property(property), m_valid(false), m_static(false) { + m_object->setContext(Expression::ObjectContext); +} + +ExpressionPtr ObjectPropertyExpression::clone() { + ObjectPropertyExpressionPtr exp(new ObjectPropertyExpression(*this)); + Expression::deepCopy(exp); + exp->m_object = Clone(m_object); + exp->m_property = Clone(m_property); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ObjectPropertyExpression::setContext(Context context) { + m_context |= context; + if (context == Expression::LValue && + !hasContext(Expression::UnsetContext)) { + m_object->setContext(Expression::LValue); + } +} +void ObjectPropertyExpression::clearContext(Context context) { + m_context &= ~context; + if (context == Expression::LValue) { + m_object->clearContext(Expression::LValue); + } +} + +void ObjectPropertyExpression::analyzeProgram(AnalysisResultPtr ar) { + m_object->analyzeProgram(ar); + m_property->analyzeProgram(ar); +} + +ExpressionPtr ObjectPropertyExpression::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_object); + ar->preOptimize(m_property); + return ExpressionPtr(); +} + +ExpressionPtr ObjectPropertyExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_object); + ar->postOptimize(m_property); + return ExpressionPtr(); +} + +TypePtr ObjectPropertyExpression::inferTypes(AnalysisResultPtr ar, + TypePtr type, bool coerce) { + m_valid = false; + + ConstructPtr self = shared_from_this(); + TypePtr objectType = m_object->inferAndCheck(ar, NEW_TYPE(Object), true); + + if (!m_property->is(Expression::KindOfScalarExpression)) { + // if dynamic property or method, we have nothing to find out + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UseDynamicProperty, self); + } + m_property->inferAndCheck(ar, Type::String, false); + + // we also lost track of which class variable an expression is about, hence + // any type inference could be wrong. Instead, we just force variants on + // all class variables. + if (m_context & (LValue | RefValue)) { + ar->forceClassVariants(); + } + + return Type::Variant; // we have to use a variant to hold dynamic value + } + + ScalarExpressionPtr exp = dynamic_pointer_cast(m_property); + string name = exp->getString(); + ASSERT(!name.empty()); + + ClassScopePtr cls; + if (objectType && !objectType->getName().empty()) { + // what object-> has told us + cls = ar->findClass(objectType->getName()); + ASSERT(cls); + } else { + // what ->property has told us + cls = ar->findClass(name, AnalysisResult::PropertyName); + if (!cls) { + if (m_context & (LValue | RefValue)) { + ar->forceClassVariants(name); + } + return Type::Variant; + } + + m_object->inferAndCheck(ar, Type::CreateObjectType(cls->getName()), true); + } + + // resolved to this class + int present = 0; + if (m_context & RefValue) { + type = Type::Variant; + coerce = true; + } + + // use $this inside a static function + if (m_object->isThis()) { + FunctionScopePtr func = ar->getFunctionScope(); + if (func->isStatic()) { + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::MissingObjectContext, + self); + } + m_actualType = Type::Variant; + return m_actualType; + } + } + + TypePtr ret; + if (!cls->derivesFromRedeclaring()) { // Have to use dynamic. + ret = cls->checkProperty(name, type, coerce, ar, self, present); + if (present) { + m_valid = true; + m_static = present & VariableTable::VariableStatic; + if (m_static) { + ar->getScope()->getVariables()-> + setAttribute(VariableTable::NeedGlobalPointer); + } + m_class = cls; + } + } + + // get() will return Variant + if (!m_valid || !m_object->getType()->isSpecificObject()) { + m_actualType = Type::Variant; + return m_actualType; + } + if (ar->getPhase() == AnalysisResult::LastInference) { + if (!(m_context & ObjectContext)) { + m_object->clearContext(Expression::LValue); + } + setContext(Expression::NoLValueWrapper); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ObjectPropertyExpression::outputPHP(CodeGenerator &cg, + AnalysisResultPtr ar) { + m_object->outputPHP(cg, ar); + cg.printf("->"); + if (m_property->getKindOf() == Expression::KindOfScalarExpression) { + m_property->outputPHP(cg, ar); + } else { + cg.printf("{"); + m_property->outputPHP(cg, ar); + cg.printf("}"); + } +} + +bool ObjectPropertyExpression::directVariantProxy(AnalysisResultPtr ar) { + TypePtr actualType = m_object->getActualType(); + if (actualType && actualType->is(Type::KindOfVariant)) { + if (m_object->is(KindOfSimpleVariable)) { + SimpleVariablePtr var = + dynamic_pointer_cast(m_object); + const std::string &name = var->getName(); + FunctionScopePtr func = + dynamic_pointer_cast(ar->getScope()); + VariableTablePtr variables = func->getVariables(); + if (!variables->isParameter(name) || variables->isLvalParam(name)) { + return true; + } + if (variables->getAttribute(VariableTable::ContainsDynamicVariable) || + variables->getAttribute(VariableTable::ContainsExtract)) { + return true; + } + } else { + return true; + } + } + return false; +} + +void ObjectPropertyExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool bThis = m_object->isThis(); + + const char *op = "."; + string func = Option::ObjectPrefix; + if (bThis && ar->getFunctionScope()->isStatic()) { + func = Option::ObjectStaticPrefix; + } + if (m_context & (LValue | RefValue)) { + func += "lval"; + } else { + func += "get"; + } + + if (m_property->getKindOf() == Expression::KindOfScalarExpression) { + ScalarExpressionPtr name = + dynamic_pointer_cast(m_property); + const char *propName = name->getString().c_str(); + if (m_valid && m_object->getType()->isSpecificObject()) { + if (m_static) { + if (!bThis) { + ASSERT(m_class); + cg.printf("g->%s%s%s%s", + Option::StaticPropertyPrefix, m_class->getName().c_str(), + Option::IdPrefix.c_str(), propName); + } else { + // if $val is a class static variable (static $val), then $val + // cannot be declared as a class variable (var $val), $this->val + // refers to a non-static class variable and has to use get/lval. + uint64 hash = hash_string(propName); + cg.printf("%s(\"%s\", 0x%016llXLL)", func.c_str(), propName, hash); + } + } else { + if (!bThis) { + if (directVariantProxy(ar)) { + TypePtr expectedType = m_object->getExpectedType(); + ASSERT(expectedType->is(Type::KindOfObject)); + // Clear m_expectedType to avoid type cast (toObject). + m_object->setExpectedType(TypePtr()); + m_object->outputCPP(cg, ar); + m_object->setExpectedType(expectedType); + cg.printf("."); + } else { + m_object->outputCPP(cg, ar); + cg.printf("->"); + } + } + cg.printf("%s%s", Option::PropertyPrefix, propName); + } + } else { + if (!bThis) { + if (directVariantProxy(ar)) { + TypePtr expectedType = m_object->getExpectedType(); + ASSERT(expectedType->is(Type::KindOfObject)); + // Clear m_expectedType to avoid type cast (toObject). + m_object->setExpectedType(TypePtr()); + m_object->outputCPP(cg, ar); + m_object->setExpectedType(expectedType); + } else { + m_object->outputCPP(cg, ar); + } + cg.printf(op); + } + uint64 hash = hash_string(propName); + cg.printf("%s(\"%s\", 0x%016llXLL)", func.c_str(), propName, hash); + } + } else { + if (!bThis) { + if (directVariantProxy(ar)) { + TypePtr expectedType = m_object->getExpectedType(); + ASSERT(expectedType->is(Type::KindOfObject)); + // Clear m_expectedType to avoid type cast (toObject). + m_object->setExpectedType(TypePtr()); + m_object->outputCPP(cg, ar); + m_object->setExpectedType(expectedType); + } else { + m_object->outputCPP(cg, ar); + } + cg.printf(op); + } + cg.printf("%s(", func.c_str()); + m_property->outputCPP(cg, ar); + cg.printf(", -1LL)"); + } +} + +void ObjectPropertyExpression::outputCPPIsset(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool bThis = m_object->isThis(); + if (!bThis) { + m_object->outputCPP(cg, ar); + cg.printf("->"); + } + cg.printf("t___isset("); + bool direct = m_property->getKindOf() == Expression::KindOfScalarExpression; + if (direct) { + cg.printf("\""); + } + m_property->outputCPP(cg, ar); + if (direct) { + cg.printf("\""); + } + cg.printf(")"); +} +void ObjectPropertyExpression::outputCPPUnset(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool bThis = m_object->isThis(); + if (!bThis) { + m_object->outputCPP(cg, ar); + cg.printf("->"); + } + cg.printf("t___unset("); + bool direct = m_property->getKindOf() == Expression::KindOfScalarExpression; + if (direct) { + cg.printf("\""); + } + m_property->outputCPP(cg, ar); + if (direct) { + cg.printf("\""); + } + cg.printf(");\n"); +} diff --git a/src/lib/expression/object_property_expression.h b/src/lib/expression/object_property_expression.h new file mode 100644 index 0000000000000..f5d9f039b6961 --- /dev/null +++ b/src/lib/expression/object_property_expression.h @@ -0,0 +1,62 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __OBJECT_PROPERTY_EXPRESSION_H__ +#define __OBJECT_PROPERTY_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(ObjectPropertyExpression); +DECLARE_BOOST_TYPES(ClassScope); + +class ObjectPropertyExpression : public Expression { +public: + ObjectPropertyExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr object, ExpressionPtr property); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool hasEffect() const { + return m_object->hasEffect() || m_property->hasEffect(); + } + virtual bool isRefable() const { return true;} + + virtual void setContext(Context context); + virtual void clearContext(Context context); + + ExpressionPtr getObject() { return m_object;} + ExpressionPtr getProperty() { return m_property;} + + virtual void outputCPPIsset(CodeGenerator &cg, AnalysisResultPtr ar); + virtual void outputCPPUnset(CodeGenerator &cg, AnalysisResultPtr ar); + +private: + ExpressionPtr m_object; + ExpressionPtr m_property; + + bool m_valid; + bool m_static; // whether m_property is actually a static property + ClassScopePtr m_class; // when m_object's type was inferred + // for avoiding code generate toObject(Variant) + bool directVariantProxy(AnalysisResultPtr ar); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __OBJECT_PROPERTY_EXPRESSION_H__ diff --git a/src/lib/expression/parameter_expression.cpp b/src/lib/expression/parameter_expression.cpp new file mode 100644 index 0000000000000..65926331f952d --- /dev/null +++ b/src/lib/expression/parameter_expression.cpp @@ -0,0 +1,212 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ParameterExpression::ParameterExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + const std::string &type, const std::string &name, bool ref, + ExpressionPtr defaultValue) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_name(name), m_ref(ref), m_hasRTTI(false), m_defaultValue(defaultValue) { + m_type = Util::toLower(type); + if (m_defaultValue) { + m_defaultValue->setContext(InParameterExpression); + } +} + +ExpressionPtr ParameterExpression::clone() { + ParameterExpressionPtr exp(new ParameterExpression(*this)); + Expression::deepCopy(exp); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void ParameterExpression::defaultToNull(AnalysisResultPtr ar) { + ASSERT(!m_defaultValue); + m_defaultValue = CONSTANT("null"); +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ParameterExpression::analyzeProgram(AnalysisResultPtr ar) { + if (!m_type.empty()) addUserClass(ar, m_type); + + if (m_defaultValue) m_defaultValue->analyzeProgram(ar); + + if (ar->isFirstPass()) { + // Have to use non const ref params for magic methods + FunctionScopePtr fs = ar->getFunctionScope(); + if (fs->isMagicMethod() || fs->getName() == "offsetget") { + fs->getVariables()->addLvalParam(m_name); + } + } +} + +ExpressionPtr ParameterExpression::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_defaultValue); + return ExpressionPtr(); +} + +ExpressionPtr ParameterExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_defaultValue); + return ExpressionPtr(); +} + +TypePtr ParameterExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + ASSERT(type->is(Type::KindOfSome) || type->is(Type::KindOfAny)); + + TypePtr ret; + if (m_type.empty() || m_defaultValue) { + ret = NEW_TYPE(Some); + } else if (m_type == "array") { + ret = Type::Array; + } else { + ClassScopePtr cls = ar->findClass(m_type); + if (!cls || cls->isRedeclaring()) { + if (!cls && ar->isFirstPass()) { + ConstructPtr self = shared_from_this(); + ar->getCodeError()->record(self, CodeError::UnknownClass, self); + } + ret = NEW_TYPE(Some); + } else { + ret = Type::CreateObjectType(m_type); + } + } + if (m_defaultValue) { + ret = m_defaultValue->inferAndCheck(ar, ret, false); + } + + // we still want the above to run, so to record errors and infer defaults + if (m_ref) { + ret = Type::Variant; + } + + // parameters are like variables, but we need to remember these are + // parameters so when variable table is generated, they are not generated + // as declared variables. + VariableTablePtr variables = ar->getScope()->getVariables(); + if (ar->isFirstPass()) { + ret = variables->addParam(m_name, ret, ar, shared_from_this()); + } else { + // Functions that can be called dynamically have to have + // variant parameters. + if (m_type.empty() && (ar->getFunctionScope()->isDynamic() || + ar->getFunctionScope()->isRedeclaring() || + ar->getFunctionScope()->isVirtual())) { + variables->forceVariant(ar, m_name); + } + int p; + ret = variables->checkVariable(m_name, ret, true, ar, shared_from_this(), + p); + if (ar->isSecondPass() && ret->is(Type::KindOfSome)) { + // This is probably too conservative. The problem is that + // a function never called will have parameter types of Any. + // Functions that it calls won't be able to accept variant unless + // it is forced here. + variables->forceVariant(ar, m_name); + ret = Type::Variant; + } else if (ar->getPhase() == AnalysisResult::LastInference && + !ret->getName().empty()) { + addUserClass(ar, ret->getName(), true); + } + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ParameterExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (!m_type.empty()) cg.printf("%s ", m_type.c_str()); + if (m_ref) cg.printf("&"); + cg.printf("$%s", m_name.c_str()); + if (m_defaultValue) { + cg.printf(" = "); + m_defaultValue->outputPHP(cg, ar); + } +} + +void ParameterExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + FunctionScopePtr func = + dynamic_pointer_cast(ar->getScope()); + VariableTablePtr variables = func->getVariables(); + TypePtr paramType = func->getParamType(cg.getItemIndex()); + bool isCVarRef = false; + if (cg.getContext() == CodeGenerator::CppStaticMethodWrapper || + (!variables->isLvalParam(m_name) && + !variables->getAttribute(VariableTable::ContainsDynamicVariable) && + !variables->getAttribute(VariableTable::ContainsExtract) && + !m_ref)) { + if (paramType->is(Type::KindOfVariant) || + paramType->is(Type::KindOfSome)) { + cg.printf("CVarRef"); + isCVarRef = true; + } + else if (paramType->is(Type::KindOfArray)) cg.printf("CArrRef"); + else if (paramType->is(Type::KindOfString)) cg.printf("CStrRef"); + else paramType->outputCPPDecl(cg, ar); + } else { + paramType->outputCPPDecl(cg, ar); + } + + cg.printf(" %s%s", Option::VariablePrefix, m_name.c_str()); + if (m_defaultValue) { + CodeGenerator::Context context = cg.getContext(); + bool comment = context == CodeGenerator::CppImplementation || + (context == CodeGenerator::CppDeclaration && func->isInlined()); + if (comment) { + cg.startComments(); + } + cg.printf(" = "); + ConstantExpressionPtr con = + dynamic_pointer_cast(m_defaultValue); + if (isCVarRef && con && con->isNull()) { + cg.printf("null_variant"); + } else { + if (comment) { + cg.setContext(CodeGenerator::CppParameterDefaultValueImpl); + } else { + cg.setContext(CodeGenerator::CppParameterDefaultValueDecl); + } + m_defaultValue->outputCPP(cg, ar); + cg.setContext(context); + } + if (comment) { + cg.endComments(); + } + } +} diff --git a/src/lib/expression/parameter_expression.h b/src/lib/expression/parameter_expression.h new file mode 100644 index 0000000000000..90dc241538b40 --- /dev/null +++ b/src/lib/expression/parameter_expression.h @@ -0,0 +1,57 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __PARAMETER_EXPRESSION_H__ +#define __PARAMETER_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(Type); +DECLARE_BOOST_TYPES(AnalysisResult); +DECLARE_BOOST_TYPES(ParameterExpression); + +class ParameterExpression : public Expression { +public: + ParameterExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + const std::string &type, const std::string &name, + bool ref, ExpressionPtr defaultValue); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + + bool isRef() const { return m_ref;} + bool isOptional() const { return m_defaultValue;} + bool hasRTTI() const { return m_hasRTTI;} + void setHasRTTI() { m_hasRTTI = true;} + const std::string &getName() const { return m_name;} + void defaultToNull(AnalysisResultPtr ar); + + void rename(const std::string &name) { m_name = name;} + +private: + std::string m_type; + std::string m_name; + bool m_ref; + bool m_hasRTTI; + ExpressionPtr m_defaultValue; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __PARAMETER_EXPRESSION_H__ diff --git a/src/lib/expression/qop_expression.cpp b/src/lib/expression/qop_expression.cpp new file mode 100644 index 0000000000000..9e32dcd0fcf15 --- /dev/null +++ b/src/lib/expression/qop_expression.cpp @@ -0,0 +1,120 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace HPHP; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +QOpExpression::QOpExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr condition, ExpressionPtr expYes, ExpressionPtr expNo) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_condition(condition), m_expYes(expYes), m_expNo(expNo), m_effect(false) { + m_effect = (m_condition->hasEffect() || + m_expYes->hasEffect() || + m_expNo->hasEffect()); +} + +ExpressionPtr QOpExpression::clone() { + QOpExpressionPtr exp(new QOpExpression(*this)); + Expression::deepCopy(exp); + exp->m_condition = Clone(m_condition); + exp->m_expYes = Clone(m_expYes); + exp->m_expNo = Clone(m_expNo); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void QOpExpression::analyzeProgram(AnalysisResultPtr ar) { + m_condition->analyzeProgram(ar); + m_expYes->analyzeProgram(ar); + m_expNo->analyzeProgram(ar); +} + +ExpressionPtr QOpExpression::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_condition); + ar->preOptimize(m_expYes); + ar->preOptimize(m_expNo); + Variant value; + if (m_condition->getScalarValue(value)) { + if (value.toBoolean()) return m_expYes; else return m_expNo; + } else { + return ExpressionPtr(); + } +} + +ExpressionPtr QOpExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_condition); + ar->postOptimize(m_expYes); + ar->postOptimize(m_expNo); + return ExpressionPtr(); +} + +TypePtr QOpExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + m_condition->inferAndCheck(ar, Type::Boolean, false); + + TypePtr typeSome = Type::CreateType(Type::KindOfSome); + TypePtr typeYes = m_expYes->inferAndCheck(ar, typeSome, coerce); + TypePtr typeNo = m_expNo->inferAndCheck(ar, typeSome, coerce); + if (Type::SameType(typeYes, typeNo) + && !m_expYes->isLiteralString() && !m_expNo->isLiteralString()) { + // already the same type, no coercion needed + // special case on literal string since String is slower than Variant + return typeYes; + } + else { + return Type::Variant; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void QOpExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + m_condition->outputPHP(cg, ar); + cg.printf(" ? "); + m_expYes->outputPHP(cg, ar); + cg.printf(" : "); + m_expNo->outputPHP(cg, ar); +} + +void QOpExpression::outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) { + m_condition->outputCPP(cg, ar); + TypePtr typeYes = m_expYes->getActualType(); + TypePtr typeNo = m_expNo->getActualType(); + const char *castType = + typeYes && typeNo && Type::SameType(typeYes, typeNo) && + !typeYes->is(Type::KindOfVariant) && + m_expYes->isLiteralString() == m_expNo->isLiteralString() + ? "" : "(Variant)"; + cg.printf(" ? (%s(", castType); + m_expYes->outputCPP(cg, ar); + cg.printf(")) : (%s(", castType); + m_expNo->outputCPP(cg, ar); + cg.printf("))"); +} diff --git a/src/lib/expression/qop_expression.h b/src/lib/expression/qop_expression.h new file mode 100644 index 0000000000000..a2adde1f2e26e --- /dev/null +++ b/src/lib/expression/qop_expression.h @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __QOP_EXPRESSION_H__ +#define __QOP_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(QOpExpression); + +class QOpExpression : public Expression { +public: + QOpExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr condition, ExpressionPtr expYes, + ExpressionPtr expNo); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool hasEffect() const { return m_effect;} + +private: + ExpressionPtr m_condition; + ExpressionPtr m_expYes; + ExpressionPtr m_expNo; + bool m_effect; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __QOP_EXPRESSION_H__ diff --git a/src/lib/expression/scalar_expression.cpp b/src/lib/expression/scalar_expression.cpp new file mode 100644 index 0000000000000..6eb7e2bdc9914 --- /dev/null +++ b/src/lib/expression/scalar_expression.cpp @@ -0,0 +1,536 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// statics + +void (*ScalarExpression::m_hookHandler) + (AnalysisResultPtr ar, ScalarExpressionPtr sc, HphpHookUniqueId id); + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ScalarExpression::ScalarExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + int type, const std::string &value, bool quoted /* = false */) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_type(type), m_value(value), m_quoted(quoted) { +} + +ScalarExpression::ScalarExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + CVarRef value, bool quoted /* = true */) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_quoted(quoted), m_variant(value) { + switch (value.getType()) { + case KindOfString: + case LiteralString: + m_type = T_STRING; + break; + case KindOfByte: + case KindOfInt16: + case KindOfInt32: + case KindOfInt64: + m_type = T_LNUMBER; + break; + case KindOfDouble: + m_type = T_DNUMBER; + break; + default: + ASSERT(false); + } + m_value = string(value.toString()->data(), value.toString()->size()); +} + +ExpressionPtr ScalarExpression::clone() { + ScalarExpressionPtr exp(new ScalarExpression(*this)); + Expression::deepCopy(exp); + return exp; +} + +void ScalarExpression::appendEncapString(const std::string &value) { + m_value += value; +} + +void ScalarExpression::toLower() { + ASSERT(!m_quoted); + m_value = Util::toLower(m_value); +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void ScalarExpression::onParse(AnalysisResultPtr ar) { + if (m_hookHandler) { + ScalarExpressionPtr self = + dynamic_pointer_cast(shared_from_this()); + m_hookHandler(ar, self, onScalarExpressionParse); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ScalarExpression::analyzeProgram(AnalysisResultPtr ar) { +} + +ExpressionPtr ScalarExpression::preOptimize(AnalysisResultPtr ar) { + string id = Util::toLower(getIdentifier()); + addUserFunction(ar, id, false); + addUserClass(ar, id, false); + + if (ar->isFirstPass()) { + switch (m_type) { + case T_LINE: + if (getLocation()) { + m_translated = lexical_cast(getLocation()->line1); + } else { + m_translated = "0"; + } + break; + case T_CLASS_C: + if (ar->getClassScope()) { + m_translated = ar->getClassScope()->getOriginalName(); + } + break; + case T_METHOD_C: + if (ar->getFunctionScope()) { + m_translated.clear(); + FunctionScopePtr func = ar->getFunctionScope(); + ClassScopePtr cls = ar->getClassScope(); + if (cls) { + m_translated = cls->getOriginalName(); + m_translated += "::"; + } + m_translated += func->getOriginalName(); + } + break; + case T_FUNC_C: + if (ar->getFunctionScope()) { + m_translated = ar->getFunctionScope()->getOriginalName(); + } + break; + default: + break; + } + } + return ExpressionPtr(); +} + +ExpressionPtr ScalarExpression::postOptimize(AnalysisResultPtr ar) { + return ExpressionPtr(); +} + +TypePtr ScalarExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + ASSERT(false); + return TypePtr(); +} + +TypePtr ScalarExpression::inferAndCheck(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + if (ar->getPhase() == AnalysisResult::FirstInference && + isLiteralString() && m_value.find(' ') == string::npos) { + setDynamicByIdentifier(ar, m_value); + } + + TypePtr actualType; + switch (m_type) { + case T_STRING: + actualType = Type::String; + break; + case T_NUM_STRING: + case T_LNUMBER: + actualType = Type::Int64; + break; + case T_DNUMBER: + actualType = Type::Double; + break; + + case T_LINE: + actualType = Type::Int32; + break; + + case T_CONSTANT_ENCAPSED_STRING: + case T_ENCAPSED_AND_WHITESPACE: + case T_CLASS_C: + case T_METHOD_C: + case T_FUNC_C: + actualType = Type::String; + break; + + default: + ASSERT(false); + break; + } + + if (Option::PrecomputeLiteralStrings && + Type::SameType(actualType, Type::String) && + m_quoted) { + ScalarExpressionPtr self = + dynamic_pointer_cast(shared_from_this()); + ar->addLiteralString(getLiteralString(), self); + } + + TypePtr ret = checkTypesImpl(ar, type, actualType, coerce); + if (coerce && m_expectedType && + !Type::IsLegalCast(ar, actualType, m_expectedType)) { + ar->getCodeError()->record(shared_from_this(), m_expectedType->getKindOf(), + actualType->getKindOf()); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +bool ScalarExpression::isLiteralInteger() const { + switch (m_type) { + case T_NUM_STRING: + { + char ch = m_value[0]; + if ((ch == '0' && m_value.size() == 1) || ('1' <= ch && ch <= '9')) { + // Offset could be treated as a long + return true; + } + } + break; + case T_LNUMBER: + return true; + default: + break; + } + return false; +} + +int64 ScalarExpression::getLiteralInteger() const { + ASSERT(isLiteralInteger()); + return strtoll(m_value.c_str(), NULL, 0); +} + +bool ScalarExpression::isLiteralString() const { + switch (m_type) { + case T_STRING: + return m_quoted; + case T_CONSTANT_ENCAPSED_STRING: + case T_ENCAPSED_AND_WHITESPACE: + ASSERT(m_quoted); // fall through + case T_CLASS_C: + case T_METHOD_C: + case T_FUNC_C: + return true; + case T_NUM_STRING: + { + char ch = m_value[0]; + if (!(ch == '0' && m_value.size() == 1 || ('1' <= ch && ch <= '9'))) { + // Offset must be treated as a string + return true; + } + } + break; + default: + break; + } + return false; +} + +std::string ScalarExpression::getLiteralString() const { + string output; + if(!isLiteralString()) { + return output; + } + + if (m_type == T_CLASS_C || m_type == T_METHOD_C || m_type == T_FUNC_C) { + return m_translated; + } + + switch (m_type) { + case T_STRING: + case T_ENCAPSED_AND_WHITESPACE: + case T_CONSTANT_ENCAPSED_STRING: + return m_value; + case T_NUM_STRING: + ASSERT(isLiteralString()); + return m_value; + default: + ASSERT(false); + break; + } + return ""; +} + +std::string ScalarExpression::getIdentifier() const { + if (isLiteralString()) { + if (isIdentifier(m_value)) { + return m_value; + } + } + return ""; +} + +void ScalarExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + switch (m_type) { + case T_CONSTANT_ENCAPSED_STRING: + case T_ENCAPSED_AND_WHITESPACE: + ASSERT(m_quoted); // fall through + case T_STRING: + if (m_quoted) { + string output; + output.reserve((m_value.length() << 1) + 2); + output = "'"; + for (unsigned int i = 0; i < m_value.length(); i++) { + unsigned char ch = m_value[i]; + switch (ch) { + case '\n': output += "'.\"\\n\".'"; break; + case '\r': output += "'.\"\\r\".'"; break; + case '\t': output += "'.\"\\t\".'"; break; + case '\'': output += "'.\"'\".'"; break; + case '\\': output += "'.\"\\\\\".'"; break; + default: + output += ch; + break; + } + } + output += "'"; + Util::replaceAll(output, ".''.", "."); + Util::replaceAll(output, "''.", ""); + Util::replaceAll(output, ".''", ""); + Util::replaceAll(output, "\".\"", ""); + cg.printf("%s", output.c_str()); + } else { + cg.printf("%s", m_value.c_str()); + } + break; + case T_NUM_STRING: + case T_LNUMBER: + case T_DNUMBER: + case T_LINE: + case T_CLASS_C: + case T_METHOD_C: + case T_FUNC_C: + cg.printf("%s", m_value.c_str()); + break; + default: + ASSERT(false); + } +} + +void ScalarExpression::outputCPPString(CodeGenerator &cg, AnalysisResultPtr ar) { + switch (m_type) { + case T_CONSTANT_ENCAPSED_STRING: + case T_ENCAPSED_AND_WHITESPACE: + ASSERT(m_quoted); // fall through + case T_STRING: { + bool hasEmbeddedNull = false; + if (m_quoted) { + string output; + output.reserve((m_value.length() << 1) + 2); + output = "\""; + for (unsigned int i = 0; i < m_value.length(); i++) { + unsigned char ch = m_value[i]; + switch (ch) { + case '\n': output += "\\n"; break; + case '\r': output += "\\r"; break; + case '\t': output += "\\t"; break; + case '\a': output += "\\a"; break; + case '\b': output += "\\b"; break; + case '\f': output += "\\f"; break; + case '\v': output += "\\v"; break; + case '\0': output += "\\0"; hasEmbeddedNull = true; break; + case '\"': output += "\\\""; break; + case '\\': output += "\\\\"; break; + case '?': output += "\\?"; break; // avoiding trigraph errors + default: + if (isprint(ch)) { + output += ch; + } else { + // output in octal notation + char buf[10]; + snprintf(buf, sizeof(buf), "\\%03o", ch); + output += buf; + } + break; + } + } + output += "\""; + if (hasEmbeddedNull) { + char length[20]; + snprintf(length, sizeof(length), "%ld", m_value.length()); + bool constant = + (cg.getContext() == CodeGenerator::CppConstantsDecl) || + (cg.getContext() == CodeGenerator::CppClassConstantsImpl); + output = // e.g., "a\0b" => String("a\0b", 3, AttachLiteral) + string(constant ? "Static" : "") + + string("String(") + output + string(", ") + + string(length) + + string(constant ? ")" : ", AttachLiteral)"); + } + cg.printf("%s", output.c_str()); + } else { + cg.printf("%s", m_value.c_str()); + } + break; + } + case T_CLASS_C: + case T_METHOD_C: + case T_FUNC_C: + cg.printf("\"%s\"", m_translated.c_str()); + break; + default: + ASSERT(false); + } +} + +void ScalarExpression::outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) { + switch (m_type) { + case T_CONSTANT_ENCAPSED_STRING: + case T_ENCAPSED_AND_WHITESPACE: + case T_STRING: + case T_CLASS_C: + case T_METHOD_C: + case T_FUNC_C: + if (Option::PrecomputeLiteralStrings && cg.getOutput() != + CodeGenerator::SystemCPP && m_quoted && + cg.getContext() != CodeGenerator::CppConstantsDecl && + cg.getContext() != CodeGenerator::CppClassConstantsImpl) { + int stringId = ar->getLiteralStringId(getLiteralString()); + ASSERT(stringId >= 0); + cg.printf("literalStrings[%d]", stringId); + } else { + outputCPPString(cg, ar); + } + break; + case T_LINE: + cg.printf("%s", m_translated.c_str()); + break; + case T_NUM_STRING: { + const char *s = m_value.c_str(); + + if ((*s == '0' && m_value.size() == 1) || ('1' <= *s && *s <= '9')) { + // Offset could be treated as a long + cg.printf("%s", m_value.c_str()); + } else { + // Offset must be treated as a string + cg.printf("\"%s\"", m_value.c_str()); + } + break; + } + case T_LNUMBER: { + Variant v = getVariant(); + ASSERT(v.isInteger()); + if (v.toInt64() == LONG_MIN) { + cg.printf("0x%llxLL", LONG_MIN); + } else { + cg.printf("%lldLL", v.toInt64()); + } + break; + } + case T_DNUMBER: { + double dval = getVariant().getDouble(); + if (finite(dval)) { + char *buf = NULL; + if (dval == 0.0) dval = 0.0; // so to avoid "-0" output + // 17 to ensure lossless conversion + vspprintf(&buf, 0, "%.*G", 17, dval); + ASSERT(buf); + cg.printf("%s", buf); + if (round(dval) == dval && !strchr(buf, '.') && !strchr(buf, 'E')) { + cg.printf(".0"); // for integer value + } + free(buf); + } else if (isnan(dval)) { + cg.printf("Limits::nan_double"); + } else if (dval > 0) { + cg.printf("Limits::inf_double"); + } else { + cg.printf("-Limits::inf_double"); + } + break; + } + default: + ASSERT(false); + } +} + +int64 ScalarExpression::getHash() const { + int64 hash = -1; + if (isLiteralInteger()) { + hash = hash_int64(getLiteralInteger()); + } else if (isLiteralString()) { + string scs = getLiteralString(); + int64 res; + if (is_strictly_integer(scs.c_str(), scs.size(), res)) { + hash = hash_int64(res); + } else { + hash = hash_string(scs.c_str(), scs.size()); + } + } + return hash; +} + +Variant &ScalarExpression::getVariant() { + if (!m_variant.isNull()) return m_variant; + switch (m_type) { + case T_ENCAPSED_AND_WHITESPACE: + case T_CONSTANT_ENCAPSED_STRING: + case T_STRING: + case T_NUM_STRING: + m_variant = String(m_value); + break; + case T_LNUMBER: + m_variant = strtoll(m_value.c_str(), NULL, 0); + break; + case T_LINE: + m_variant = String(m_translated).toInt64(); + break; + case T_CLASS_C: + case T_METHOD_C: + case T_FUNC_C: + m_variant = String(m_translated); + break; + case T_DNUMBER: + m_variant = String(m_value).toDouble(); + break; + default: + ASSERT(false); + } + return m_variant; +} diff --git a/src/lib/expression/scalar_expression.h b/src/lib/expression/scalar_expression.h new file mode 100644 index 0000000000000..8f923746a1b5b --- /dev/null +++ b/src/lib/expression/scalar_expression.h @@ -0,0 +1,90 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __SCALAR_EXPRESSION_H__ +#define __SCALAR_EXPRESSION_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ScalarExpression); + +class ScalarExpression : public Expression, public IParseHandler { + friend class ScalarExpressionHook; +public: + ScalarExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + int type, const std::string &value, bool quoted = false); + ScalarExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + CVarRef value, bool quoted = true); + + // change case to lower so to make it case insensitive + void toLower(); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool hasEffect() const { return false;} + virtual bool isScalar() const { return true;} + virtual bool isLiteralString() const; + virtual std::string getLiteralString() const; + virtual TypePtr inferAndCheck(AnalysisResultPtr ar, TypePtr type, + bool coerce); + virtual bool getScalarValue(Variant &value) { + value = getVariant(); return true; + } + + // implementing IParseHandler + virtual void onParse(AnalysisResultPtr ar); + + int getType() const { return m_type;} + const std::string &getString() const { return m_value;} + void appendEncapString(const std::string &value); + bool isLiteralInteger() const; + + int64 getLiteralInteger() const; + std::string getIdentifier() const; + Variant &getVariant(); + int64 getHash() const; + + void setComment(const std::string comment) { m_comment = comment;} + const std::string getComment() { return m_comment;} + + void outputCPPString(CodeGenerator &cg, AnalysisResultPtr ar); + + static void setHookHandler(void (*hookHandler)(AnalysisResultPtr ar, + ScalarExpressionPtr sc, + HphpHookUniqueId id)) { + m_hookHandler = hookHandler; + } + +private: + int m_type; + std::string m_value; + std::string m_translated; + bool m_quoted; + Variant m_variant; // value created for compile time optimization + std::string m_comment; // for inlined constant name + + // hook + static void (*m_hookHandler)(AnalysisResultPtr ar, + ScalarExpressionPtr sc, + HphpHookUniqueId id); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __SCALAR_EXPRESSION_H__ diff --git a/src/lib/expression/simple_function_call.cpp b/src/lib/expression/simple_function_call.cpp new file mode 100644 index 0000000000000..50c26e2e2af74 --- /dev/null +++ b/src/lib/expression/simple_function_call.cpp @@ -0,0 +1,900 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// statics + +std::mapSimpleFunctionCall::FunctionTypeMap; + +#define CHECK_HOOK(n) \ +do { \ + if (SimpleFunctionCall::m_hookHandler) { \ + SimpleFunctionCall::m_hookHandler(ar, this, n); \ + } \ +} while (0) + +void (*SimpleFunctionCall::m_hookHandler) + (AnalysisResultPtr ar, SimpleFunctionCall *call, HphpHookUniqueId id); + +void SimpleFunctionCall::InitFunctionTypeMap() { + if (FunctionTypeMap.empty()) { + FunctionTypeMap["define"] = DefineFunction; + FunctionTypeMap["create_function"] = CreateFunction; + + FunctionTypeMap["func_get_arg"] = VariableArgumentFunction; + FunctionTypeMap["func_get_args"] = VariableArgumentFunction; + FunctionTypeMap["func_num_args"] = VariableArgumentFunction; + + FunctionTypeMap["extract"] = ExtractFunction; + FunctionTypeMap["compact"] = CompactFunction; + + FunctionTypeMap["shell_exec"] = ShellExecFunction; + FunctionTypeMap["exec"] = ShellExecFunction; + FunctionTypeMap["passthru"] = ShellExecFunction; + FunctionTypeMap["system"] = ShellExecFunction; + + FunctionTypeMap["defined"] = DefinedFunction; + FunctionTypeMap["function_exists"] = FunctionExistsFunction; + FunctionTypeMap["class_exists"] = ClassExistsFunction; + FunctionTypeMap["interface_exists"] = InterfaceExistsFunction; + FunctionTypeMap["constant"] = ConstantFunction; + + FunctionTypeMap["unserialize"] = UnserializeFunction; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +SimpleFunctionCall::SimpleFunctionCall +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + const std::string &name, ExpressionListPtr params, + const std::string *classname) + : FunctionCall(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES, + ExpressionPtr(), name, params, classname), + m_type(UnknownType), m_dynamicConstant(false), + m_parentClass(false), m_builtinFunction(false), m_noPrefix(false), + m_hookData(NULL) { + + if (m_className.empty()) { + if (FunctionTypeMap.empty()) InitFunctionTypeMap(); + map::const_iterator iter = + FunctionTypeMap.find(m_name); + if (iter != FunctionTypeMap.end()) { + m_type = iter->second; + } + } +} + +SimpleFunctionCall::~SimpleFunctionCall() { + if (m_hookData) { + ASSERT(m_hookHandler); + m_hookHandler(AnalysisResultPtr(), this, hphpUniqueDtor); + } +} + +ExpressionPtr SimpleFunctionCall::clone() { + SimpleFunctionCallPtr exp(new SimpleFunctionCall(*this)); + FunctionCall::deepCopy(exp); + exp->m_params = Clone(m_params); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void SimpleFunctionCall::onParse(AnalysisResultPtr ar) { + FileScopePtr fs = ar->getFileScope(); + ConstructPtr self = shared_from_this(); + if (m_className.empty()) { + CodeErrorPtr codeError = ar->getCodeError(); + switch (m_type) { + case CreateFunction: + if (m_params->getCount() == 2 && + (*m_params)[0]->isLiteralString() && + (*m_params)[1]->isLiteralString()) { + FunctionScopePtr func = ar->getFunctionScope(); + if (func) func->disableInline(); + string params = (*m_params)[0]->getLiteralString(); + string body = (*m_params)[1]->getLiteralString(); + m_lambda = CodeGenerator::GetNewLambda(); + string code = "/*|Dynamic|*/function " + m_lambda + "(" + params + ") " + "{" + body + "}"; + ar->appendExtraCode(code); + } + break; + case VariableArgumentFunction: + ar->getFileScope()->setAttribute(FileScope::VariableArgument); + break; + case ExtractFunction: + ar->getCodeError()->record(self, CodeError::UseExtract, self); + ar->getFileScope()->setAttribute(FileScope::ContainsLDynamicVariable); + ar->getFileScope()->setAttribute(FileScope::ContainsExtract); + break; + case CompactFunction: + ar->getFileScope()->setAttribute(FileScope::ContainsDynamicVariable); + ar->getFileScope()->setAttribute(FileScope::ContainsCompact); + break; + case ShellExecFunction: + ar->getCodeError()->record(self, CodeError::UseShellExec, self); + break; + default: + CHECK_HOOK(onSimpleFunctionCallFuncType); + break; + } + } + + string call = getText(); + string name = m_name; + if (!m_className.empty()) { + name = m_className + "::" + name; + } + ar->getDependencyGraph()->add(DependencyGraph::KindOfFunctionCall, call, + shared_from_this(), name); +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void SimpleFunctionCall::analyzeProgram(AnalysisResultPtr ar) { + if (m_className.empty()) { + addUserFunction(ar, m_name); + } else if (m_className != "parent") { + addUserClass(ar, m_className); + } else { + m_parentClass = true; + } + + if (ar->getPhase() == AnalysisResult::AnalyzeInclude) { + + CHECK_HOOK(onSimpleFunctionCallAnalyzeInclude); + + ConstructPtr self = shared_from_this(); + + // We need to know the name of the constant so that we can associate it + // with this file before we do type inference. + if (m_className.empty() && m_type == DefineFunction) { + ScalarExpressionPtr name = + dynamic_pointer_cast((*m_params)[0]); + string varName; + if (name) { + varName = name->getIdentifier(); + if (!varName.empty()) { + ar->getFileScope()->declareConstant(ar, varName); + } + } + // handling define("CONSTANT", ...); + if (m_params && m_params->getCount() >= 2) { + ScalarExpressionPtr name = + dynamic_pointer_cast((*m_params)[0]); + string varName; + if (name) { + varName = name->getIdentifier(); + if (!varName.empty()) { + ExpressionPtr value = (*m_params)[1]; + ConstantTablePtr constants = + ar->findConstantDeclarer(varName)->getConstants(); + if (constants != ar->getConstants()) { + constants->add(varName, NEW_TYPE(Some), value, ar, self); + + if (name->hasHphpNote("Dynamic")) { + constants->setDynamic(ar, varName); + } + } + } + } + } + } + + if (m_type == UnserializeFunction) { + ar->forceClassVariants(); + } + } + + if (ar->getPhase() == AnalysisResult::AnalyzeAll) { + // Look up the corresponding FunctionScope and ClassScope + // for this function call + { + FunctionScopePtr func; + ClassScopePtr cls; + if (m_className.empty()) { + func = ar->findFunction(m_name); + } else { + cls = ar->resolveClass(m_className); + if (cls) { + if (m_name == "__construct") { + func = cls->findConstructor(ar, true); + } else { + func = cls->findFunction(ar, m_name, true); + } + } + } + if (func && !func->isRedeclaring()) + m_funcScope = func; + if (cls && !cls->isRedeclaring()) + m_classScope = cls; + } + // check for dynamic constant and volatile function/class + if (m_className.empty() && + (m_type == DefinedFunction || + m_type == FunctionExistsFunction || + m_type == ClassExistsFunction || + m_type == InterfaceExistsFunction) && + m_params && m_params->getCount() == 1) { + ExpressionPtr value = (*m_params)[0]; + if (value->isScalar()) { + ScalarExpressionPtr name = + dynamic_pointer_cast(value); + if (name && name->isLiteralString()) { + string symbol = name->getLiteralString(); + switch (m_type) { + case DefinedFunction: { + ConstantTablePtr constants = ar->getConstants(); + if (!constants->isPresent(symbol)) { + // user constant + BlockScopePtr block = ar->findConstantDeclarer(symbol); + if (block) { // found the constant + constants = block->getConstants(); + // set to be dynamic + constants->setDynamic(ar, symbol); + } + } + break; + } + case FunctionExistsFunction: { + FunctionScopePtr func = ar->findFunction(Util::toLower(symbol)); + if (func && func->isUserFunction()) { + func->setVolatile(); + } + break; + } + case InterfaceExistsFunction: + case ClassExistsFunction: { + ClassScopePtr cls = ar->findClass(Util::toLower(symbol)); + if (cls && cls->isUserClass()) { + cls->setVolatile(); + } + break; + } + default: + ASSERT(false); + } + } + } + } + } + if (m_params) { + m_params->controlOrder(); + m_params->analyzeProgram(ar); + } +} + +bool SimpleFunctionCall::isDefineWithoutImpl(AnalysisResultPtr ar) { + if (!m_className.empty()) return false; + if (m_type == DefineFunction && m_params && m_params->getCount() >= 2) { + if (m_dynamicConstant) return false; + ScalarExpressionPtr name = + dynamic_pointer_cast((*m_params)[0]); + if (!name) return false; + string varName = name->getIdentifier(); + if (varName.empty()) return false; + if (ar->getConstants()->isSystem(varName)) return true; + ExpressionPtr value = (*m_params)[1]; + return (!ar->isConstantRedeclared(varName)) && value->isScalar(); + } else { + return false; + } +} + +ExpressionPtr SimpleFunctionCall::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_nameExp); + ar->preOptimize(m_params); + if (ar->getPhase() != AnalysisResult::SecondPreOptimize) { + return ExpressionPtr(); + } + // optimize away various "exists" functions, this may trigger + // dead code elimination and improve type-inference. + if (m_className.empty() && + (m_type == DefinedFunction || + m_type == FunctionExistsFunction || + m_type == ClassExistsFunction || + m_type == InterfaceExistsFunction) && + m_params && m_params->getCount() == 1) { + ExpressionPtr value = (*m_params)[0]; + if (value->isScalar()) { + ScalarExpressionPtr name = dynamic_pointer_cast(value); + if (name && name->isLiteralString()) { + string symbol = name->getLiteralString(); + switch (m_type) { + case DefinedFunction: { + ConstantTablePtr constants = ar->getConstants(); + // system constant + if (constants->isPresent(symbol)) { + return CONSTANT("true"); + } + // user constant + BlockScopePtr block = ar->findConstantDeclarer(symbol); + // not found (i.e., undefined) + if (!block) { + if (symbol.find("::") == std::string::npos) { + return CONSTANT("false"); + } else { + // e.g., defined("self::ZERO") + return ExpressionPtr(); + } + } + constants = block->getConstants(); + // already set to be dynamic + if (constants->isDynamic(symbol)) return ExpressionPtr(); + ConstructPtr decl = constants->getValue(symbol); + ExpressionPtr constValue = dynamic_pointer_cast(decl); + if (constValue->isScalar()) { + return CONSTANT("true"); + } else { + return ExpressionPtr(); + } + break; + } + case FunctionExistsFunction: { + FunctionScopePtr func = ar->findFunction(Util::toLower(symbol)); + if (!func) { + return CONSTANT("false"); + } else if (!func->isVolatile()) { + return CONSTANT("true"); + } + break; + } + case InterfaceExistsFunction: { + ClassScopePtr cls = ar->findClass(Util::toLower(symbol)); + if (!cls || !cls->isInterface()) { + return CONSTANT("false"); + } else if (!cls->isVolatile()) { + return CONSTANT("true"); + } + break; + } + case ClassExistsFunction: { + ClassScopePtr cls = ar->findClass(Util::toLower(symbol)); + if (!cls || cls->isInterface()) { + return CONSTANT("false"); + } else if (!cls->isVolatile()) { + return CONSTANT("true"); + } + break; + } + default: + ASSERT(false); + } + } + } + } + return ExpressionPtr(); +} + +ExpressionPtr SimpleFunctionCall::postOptimize(AnalysisResultPtr ar) { + if (!Option::KeepStatementsWithNoEffect && isDefineWithoutImpl(ar)) { + return CONSTANT("true"); + } + return FunctionCall::postOptimize(ar); +} + +bool SimpleFunctionCall::hasEffect() const { + // If any of the parameters side effects, then this function + // call as a whole is considered to side effect + if (m_params && (m_params->hasEffect() || !m_params->isNoObjectInvolved())) + return true; + // Check if this function is known to have no side effects + if (m_funcScope && !m_funcScope->hasEffect()) + return false; + return true; +} + +TypePtr SimpleFunctionCall::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + ASSERT(false); + return TypePtr(); +} + +TypePtr SimpleFunctionCall::inferAndCheck(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + reset(); + + ConstructPtr self = shared_from_this(); + + // handling define("CONSTANT", ...); + if (m_className.empty()) { + if (m_type == DefineFunction && m_params && m_params->getCount() >= 2) { + ScalarExpressionPtr name = + dynamic_pointer_cast((*m_params)[0]); + string varName; + if (name) { + varName = name->getIdentifier(); + if (!varName.empty()) { + ExpressionPtr value = (*m_params)[1]; + TypePtr varType = value->inferAndCheck(ar, NEW_TYPE(Some), false); + ar->getDependencyGraph()-> + addParent(DependencyGraph::KindOfConstant, + ar->getName(), varName, self); + ConstantTablePtr constants = + ar->findConstantDeclarer(varName)->getConstants(); + if (constants != ar->getConstants()) { + if (value && !value->isScalar()) { + constants->setDynamic(ar, varName); + varType = Type::Variant; + } + if (constants->isDynamic(varName)) { + m_dynamicConstant = true; + ar->getScope()->getVariables()-> + setAttribute(VariableTable::NeedGlobalPointer); + } else { + constants->setType(ar, varName, varType, true); + } + // in case the old 'value' has been optimized + constants->setValue(ar, varName, value); + } + return checkTypesImpl(ar, type, Type::Boolean, coerce); + } + } + if (varName.empty() && ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::BadDefine, self); + } + } else if (m_type == ExtractFunction) { + ar->getScope()->getVariables()->forceVariants(ar); + } + } + + FunctionScopePtr func; + + // avoid raising both MissingObjectContext and UnknownFunction + bool errorFlagged = false; + + if (m_className.empty()) { + func = ar->findFunction(m_name); + } else { + ClassScopePtr cls = ar->resolveClass(m_className); + if (!cls || cls->isRedeclaring()) { + if (cls) { + m_redeclaredClass = true; + } + if (!cls && ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UnknownClass, self); + } + if (m_params) { + m_params->inferAndCheck(ar, NEW_TYPE(Any), false); + } + return checkTypesImpl(ar, type, Type::Variant, coerce); + } + m_derivedFromRedeclaring = cls->derivesFromRedeclaring(); + m_validClass = true; + + if (m_name == "__construct") { + // if the class is known, php will try to identify class-name ctor + func = cls->findConstructor(ar, true); + } + else { + func = cls->findFunction(ar, m_name, true); + } + + if (func && !func->isStatic()) { + ClassScopePtr clsThis = ar->getClassScope(); + FunctionScopePtr funcThis = ar->getFunctionScope(); + if (!clsThis || + (clsThis->getName() != m_className && + !clsThis->derivesFrom(ar, m_className)) || + funcThis->isStatic()) { + // set the method static to avoid "unknown method" runtime exception + if (Option::StaticMethodAutoFix && !func->containsThis()) { + func->setStatic(); + } + if (ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::MissingObjectContext, + self); + errorFlagged = true; + } + func.reset(); + } + } + } + if (!func || func->isRedeclaring()) { + if (func) m_redeclared = true; + if (!func && !errorFlagged && ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UnknownFunction, self); + } + if (m_params) { + for (int i = 0; i < m_params->getCount(); i++) { + (*m_params)[i]->setContext(Expression::RefValue); + (*m_params)[i]->setContext(Expression::InvokeArgument); + } + m_params->inferAndCheck(ar, NEW_TYPE(Any), false); + } + return checkTypesImpl(ar, type, Type::Variant, coerce); + } + m_builtinFunction = !func->isUserFunction(); + + if (m_redeclared) { + if (m_params) { + m_params->inferAndCheck(ar, NEW_TYPE(Any), false); + } + return checkTypesImpl(ar, type, type, coerce); + } + + CHECK_HOOK(beforeSimpleFunctionCallCheck); + + type = checkParamsAndReturn(ar, type, coerce, func); + + if (!m_valid && m_params) { + for (int i = 0; i < m_params->getCount(); i++) { + (*m_params)[i]->setContext(Expression::RefValue); + (*m_params)[i]->setContext(Expression::InvokeArgument); + } + } + + CHECK_HOOK(afterSimpleFunctionCallCheck); + + return type; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void SimpleFunctionCall::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + outputLineMap(cg, ar); + + if (!m_className.empty()) { + cg.printf("%s::%s(", m_className.c_str(), m_name.c_str()); + } else { + + if (cg.getOutput() == CodeGenerator::InlinedPHP || + cg.getOutput() == CodeGenerator::TrimmedPHP) { + + if (cg.getOutput() == CodeGenerator::TrimmedPHP && + cg.usingStream(CodeGenerator::PrimaryStream) && + Option::DynamicFunctionCalls.find(m_name) != + Option::DynamicFunctionCalls.end()) { + int funcNamePos = Option::DynamicFunctionCalls[m_name]; + if (m_params && m_params->getCount() && + m_params->getCount() >= funcNamePos + 1) { + if (funcNamePos == -1) funcNamePos = m_params->getCount() - 1; + ExpressionPtr funcName = (*m_params)[funcNamePos]; + if (!funcName->is(Expression::KindOfScalarExpression)) { + + cg.printf("%s(", m_name.c_str()); + for (int i = 0; i < m_params->getCount(); i++) { + if (i > 0) cg.printf(", "); + if (i == funcNamePos) { + cg.printf("%sdynamic_load(", Option::IdPrefix.c_str()); + funcName->outputPHP(cg, ar); + cg.printf(")"); + } else { + ExpressionPtr param = (*m_params)[i]; + if (param) param->outputPHP(cg, ar); + } + } + cg.printf(")"); + return; + } + } + } + /* simptodo: I dunno + if (m_type == RenderTemplateFunction && !m_template.empty()) { + cg.printf("%s_%s(", m_name.c_str(), + Util::getIdentifier(m_template).c_str()); + } else if (m_type == RenderTemplateIncludeFunction) { + string templateName = ar->getProgram()->getCurrentTemplate(); + cg.printf("%s_%s(", m_name.c_str(), + Util::getIdentifier(templateName).c_str()); + } else { + */ + cg.printf("%s(", m_name.c_str()); + //} + + } else { + cg.printf("%s(", m_name.c_str()); + } + } + + if (m_params) m_params->outputPHP(cg, ar); + cg.printf(")"); +} + +void SimpleFunctionCall::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + bool linemap = outputLineMap(cg, ar); + + if (!m_lambda.empty()) { + cg.printf("\"%s\"", m_lambda.c_str()); + if (linemap) cg.printf(")"); + return; + } + + if (m_className.empty()) { + if (m_type == DefineFunction && m_params && m_params->getCount() >= 2) { + ScalarExpressionPtr name = + dynamic_pointer_cast((*m_params)[0]); + string varName; + if (name) { + varName = name->getIdentifier(); + ExpressionPtr value = (*m_params)[1]; + if (varName.empty()) { + cg.printf("throw_fatal(\"bad define\")"); + } else if (m_dynamicConstant) { + cg.printf("g->declareConstant(\"%s\", g->%s%s, ", + varName.c_str(), Option::ConstantPrefix, + varName.c_str()); + value->outputCPP(cg, ar); + cg.printf(")"); + } else { + bool needAssignment = true; + bool isSystem = ar->getConstants()->isSystem(varName); + if (isSystem || + ((!ar->isConstantRedeclared(varName)) && value->isScalar())) { + needAssignment = false; + } + if (needAssignment) { + cg.printf("%s%s = ", Option::ConstantPrefix, varName.c_str()); + value->outputCPP(cg, ar); + } + } + } else { + cg.printf("throw_fatal(\"bad define\")"); + } + if (linemap) cg.printf(")"); + return; + } + if (m_name == "func_num_args") { + cg.printf("num_args"); + if (linemap) cg.printf(")"); + return; + } + + switch (m_type) { + case VariableArgumentFunction: + { + FunctionScopePtr func = + dynamic_pointer_cast(ar->getScope()); + if (func) { + cg.printf("%s(", m_name.c_str()); + func->outputCPPParamsCall(cg, ar, true); + if (m_params) { + cg.printf(","); + m_params->outputCPP(cg, ar); + } + cg.printf(")"); + if (linemap) cg.printf(")"); + return; + } + } + break; + case ExtractFunction: + cg.printf("extract(variables, "); + FunctionScope::outputCPPArguments(m_params, cg, ar, 0, false); + cg.printf(")"); + if (linemap) cg.printf(")"); + return; + case CompactFunction: + cg.printf("compact(variables, "); + FunctionScope::outputCPPArguments(m_params, cg, ar, -1, true); + cg.printf(")"); + if (linemap) cg.printf(")"); + return; + case FunctionExistsFunction: + case ClassExistsFunction: + case InterfaceExistsFunction: + { + bool literalString = false; + string symbol; + if (m_params && m_params->getCount() == 1) { + ExpressionPtr value = (*m_params)[0]; + if (value->isScalar()) { + ScalarExpressionPtr name = + dynamic_pointer_cast(value); + if (name && name->isLiteralString()) { + literalString = true; + symbol = name->getLiteralString(); + } + } + } + if (literalString) { + switch (m_type) { + case FunctionExistsFunction: + { + FunctionScopePtr func = ar->findFunction(Util::toLower(symbol)); + if (func) { + if (func->isRedeclaring()) { + const char *name = func->getName().c_str(); + cg.printf("(%s->%s%s != invoke_failed_%s)", + cg.getGlobals(), Option::InvokePrefix, name, name); + } else if (!func->isDynamic()) { + cg.printf("true"); + } else { + const char *name = func->getName().c_str(); + cg.printf("f_function_exists(\"%s\")", name); + } + } else { + cg.printf("false"); + } + } + break; + case ClassExistsFunction: + { + ClassScopePtr cls = ar->findClass(Util::toLower(symbol)); + if (cls && !cls->isInterface()) { + const char *name = cls->getName().c_str(); + cg.printf("f_class_exists(\"%s\")", name); + } else { + cg.printf("false"); + } + } + break; + case InterfaceExistsFunction: + { + ClassScopePtr cls = ar->findClass(Util::toLower(symbol)); + if (cls && cls->isInterface()) { + const char *name = cls->getName().c_str(); + cg.printf("f_interface_exists(\"%s\")", name); + } else { + cg.printf("false"); + } + } + break; + default: + break; + } + if (linemap) cg.printf(")"); + return; + } + } + break; + default: + break; + } + } + + if (m_params) m_params->outputCPPControlledEvalOrderPre(cg, ar); + if (m_valid) { + bool tooManyArgs = + (m_params && m_params->outputCPPTooManyArgsPre(cg, ar, m_name)); + if (!m_className.empty()) { + cg.printf("%s%s::", Option::ClassPrefix, m_className.c_str()); + ClassScopePtr cls = ar->findClass(m_className); + if (m_name == "__construct" && cls) { + FunctionScopePtr func = cls->findConstructor(ar, true); + cg.printf("%s%s(", Option::MethodPrefix, func->getName().c_str()); + } + else { + cg.printf("%s%s(", Option::MethodPrefix, m_name.c_str()); + } + } else { + int paramCount = m_params ? m_params->getCount() : 0; + if (m_name == "get_class" && ar->getClassScope() && paramCount == 0) { + cg.printf("(\"%s\"", ar->getClassScope()->getCasedName().c_str()); + } else if (m_name == "get_parent_class" && ar->getClassScope() && + paramCount == 0) { + const std::string parentClass = ar->getClassScope()->getParent(); + if (!parentClass.empty()) { + cg.printf("(\"%s\"", ar->getClassScope()->getParent().c_str()); + } else { + cg.printf("(false"); + } + } else { + if (m_noPrefix) { + cg.printf("%s(", m_name.c_str()); + } + else { + cg.printf("%s%s(", m_builtinFunction ? Option::BuiltinFunctionPrefix : + Option::FunctionPrefix, m_name.c_str()); + } + } + } + FunctionScope::outputCPPArguments(m_params, cg, ar, m_extraArg, + m_variableArgument); + cg.printf(")"); + if (tooManyArgs) { + m_params->outputCPPTooManyArgsPost(cg, ar, m_voidReturn); + } + } else { + bool dynamicInvoke = Option::DynamicInvokeFunctions.find(m_name) != + Option::DynamicInvokeFunctions.end(); + + if (m_redeclared || m_redeclaredClass || m_derivedFromRedeclaring || + m_className.empty()) { + if (m_className.empty()) { + if (m_redeclared) { + if (dynamicInvoke) { + cg.printf("invoke(\"%s\", ", m_name.c_str()); + } else { + cg.printf("%s->%s%s(", cg.getGlobals(), Option::InvokePrefix, + m_name.c_str()); + } + } else { + cg.printf("invoke_failed(\"%s\", ", m_name.c_str()); + } + } else { + bool inObj = m_parentClass && ar->getClassScope() && + !dynamic_pointer_cast(ar->getScope())->isStatic(); + if (m_redeclaredClass) { + if (inObj) { // parent is redeclared + cg.printf("parent->%sinvoke(\"%s\",", Option::ObjectPrefix, + m_name.c_str()); + } else { + cg.printf("%s->%s%s->%sinvoke(\"%s\", \"%s\",", + cg.getGlobals(), + Option::ClassStaticsObjectPrefix, + m_className.c_str(), Option::ObjectStaticPrefix, + m_className.c_str(), + m_name.c_str()); + } + } else { + if (inObj) { + cg.printf("%s%s::%sinvoke(\"%s\",", + Option::ClassPrefix, m_className.c_str(), + Option::ObjectPrefix, m_name.c_str()); + } else { + cg.printf("%s%s::%sinvoke(\"%s\", \"%s\",", + Option::ClassPrefix, m_className.c_str(), + Option::ObjectStaticPrefix, + m_className.c_str(), + m_name.c_str()); + } + } + } + if ((!m_params) || (m_params->getCount() == 0)) { + cg.printf("Array()"); + } else { + FunctionScope::outputCPPArguments(m_params, cg, ar, -1, false); + } + if (m_className.empty() && m_redeclared && !dynamicInvoke) { + cg.printf(")"); + } else { + cg.printf(", 0x%.16lXLL)", hash_string_i(m_name.data(), m_name.size())); + } + } else { + if (m_validClass) { + cg.printf("throw_fatal(\"unknown method %s::%s\", (", + m_className.c_str(), m_name.c_str()); + } else { + cg.printf("throw_fatal(\"unknown class %s\", (", m_className.c_str()); + } + FunctionScope::outputCPPEffectiveArguments(m_params, cg, ar); + cg.printf("(void*)NULL))"); + } + } + if (m_params) m_params->outputCPPControlledEvalOrderPost(cg, ar); + if (linemap) cg.printf(")"); +} diff --git a/src/lib/expression/simple_function_call.h b/src/lib/expression/simple_function_call.h new file mode 100644 index 0000000000000..55b348daf7a8b --- /dev/null +++ b/src/lib/expression/simple_function_call.h @@ -0,0 +1,95 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __SIMPLE_FUNCTION_CALL_H__ +#define __SIMPLE_FUNCTION_CALL_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +DECLARE_BOOST_TYPES(SimpleFunctionCall); +class SimpleFunctionCall : public FunctionCall, public IParseHandler { + friend class SimpleFunctionCallHook; +public: + SimpleFunctionCall(EXPRESSION_CONSTRUCTOR_PARAMETERS, + const std::string &name, ExpressionListPtr params, + const std::string *className); + + ~SimpleFunctionCall(); + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + bool isDefineWithoutImpl(AnalysisResultPtr ar); + void setValid() { m_valid = true; } + void setNoPrefix() { m_noPrefix = true; } + + virtual TypePtr inferAndCheck(AnalysisResultPtr ar, TypePtr type, + bool coerce); + + virtual bool hasEffect() const; + + // implementing IParseHandler + virtual void onParse(AnalysisResultPtr ar); + + void *getHookData() { return m_hookData;} + static void setHookHandler(void (*hookHandler)(AnalysisResultPtr ar, + SimpleFunctionCall *call, + HphpHookUniqueId id)) { + m_hookHandler = hookHandler; + } + +private: + enum FunctionType { + UnknownType, + DefineFunction, + CreateFunction, + VariableArgumentFunction, + ExtractFunction, + CompactFunction, + ShellExecFunction, + ConstantFunction, + DefinedFunction, + FunctionExistsFunction, + ClassExistsFunction, + InterfaceExistsFunction, + UnserializeFunction, + + LastType, // marker, not a valid type + }; + + static std::map FunctionTypeMap; + static void InitFunctionTypeMap(); + int m_type; + bool m_programSpecific; + bool m_dynamicConstant; + bool m_parentClass; + std::string m_lambda; + bool m_builtinFunction; + bool m_noPrefix; + + // hook + static void (*m_hookHandler)(AnalysisResultPtr ar, + SimpleFunctionCall *call, + HphpHookUniqueId id); + void *m_hookData; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __SIMPLE_FUNCTION_CALL_H__ diff --git a/src/lib/expression/simple_variable.cpp b/src/lib/expression/simple_variable.cpp new file mode 100644 index 0000000000000..45f2a1b6b61e1 --- /dev/null +++ b/src/lib/expression/simple_variable.cpp @@ -0,0 +1,204 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +SimpleVariable::SimpleVariable +(EXPRESSION_CONSTRUCTOR_PARAMETERS, const std::string &name) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_name(name), m_this(false), m_globals(false), m_superGlobal(false) { + setContext(Expression::NoLValueWrapper); +} + +ExpressionPtr SimpleVariable::clone() { + SimpleVariablePtr exp(new SimpleVariable(*this)); + Expression::deepCopy(exp); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void SimpleVariable::analyzeProgram(AnalysisResultPtr ar) { + if (m_name == "argc" || m_name == "argv") { + // special case: they are NOT superglobals when not in global scope + if (ar->getScope() == ar) { + m_superGlobal = BuiltinSymbols::isSuperGlobal(m_name); + m_superGlobalType = BuiltinSymbols::getSuperGlobalType(m_name); + } + } else { + m_superGlobal = BuiltinSymbols::isSuperGlobal(m_name); + m_superGlobalType = BuiltinSymbols::getSuperGlobalType(m_name); + } + + if (m_superGlobal) { + ar->getScope()->getVariables()-> + setAttribute(VariableTable::NeedGlobalPointer); + } + + if (m_name == "this" && ar->getClassScope()) { + FunctionScopePtr func = + dynamic_pointer_cast(ar->getScope()); + func->setContainsThis(); + if (!func->isStatic() || (m_context & ObjectContext)) { + m_this = true; + } + } else if (m_name == "GLOBALS") { + m_globals = true; + } + if (!(m_context & AssignmentLHS)) { + BlockScopePtr scope = ar->getScope(); + FunctionScopePtr func = dynamic_pointer_cast(scope); + if (func) { + func->getVariables()->addReferenced(m_name); + } + } +} + +ExpressionPtr SimpleVariable::preOptimize(AnalysisResultPtr ar) { + return ExpressionPtr(); +} + +ExpressionPtr SimpleVariable::postOptimize(AnalysisResultPtr ar) { + return ExpressionPtr(); +} + +TypePtr SimpleVariable::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + ASSERT(false); + return TypePtr(); +} + +TypePtr SimpleVariable::inferAndCheck(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + TypePtr ret; + ConstructPtr construct = shared_from_this(); + BlockScopePtr scope = ar->getScope(); + VariableTablePtr variables = scope->getVariables(); + + // check function parameter that can occur in lval context + if (m_context & (LValue | RefValue)) { + FunctionScopePtr func = dynamic_pointer_cast(scope); + if (func) { + if (variables->isParameter(m_name)) { + variables->addLvalParam(m_name); + } + } + } + if (m_name == "this") { + ClassScopePtr cls = ar->getClassScope(); + if (cls) { + bool isStaticFunc = false; + FunctionScopePtr func = dynamic_pointer_cast(scope); + if (func->isStatic()) isStaticFunc = true; + if (cls->isRedeclaring()) { + ret = Type::Variant; + } else { + ret = Type::CreateObjectType(cls->getName()); + } + if (!isStaticFunc || (m_context & ObjectContext)) m_this = true; + } + } + if (m_context & (LValue|Declaration)) { + if (m_superGlobal) { + ret = m_superGlobalType; + } else if (m_superGlobalType) { // For system + if (!m_this) { + ret = variables->add(m_name, m_superGlobalType, + ((m_context & Declaration) != Declaration), ar, + construct, scope->getModifiers()); + } + } else { + if (m_globals) { + ret = Type::Variant; // this can happen with "unset($GLOBALS)" + } else if (!m_this) { + ret = variables->add(m_name, type, + ((m_context & Declaration) != Declaration), ar, + construct, scope->getModifiers()); + } + } + } else { + if (!m_this) { + if (m_superGlobalType) { + ret = m_superGlobalType; + } else if (m_globals) { + ret = Type::Array; + } else if (scope->is(BlockScope::ClassScope)) { + // ClassVariable expression will come to this block of code + int properties; + ret = variables->checkProperty(m_name, type, true, ar, construct, + properties); + } else { + TypePtr tmpType = type; + if (m_context & RefValue) { + tmpType = Type::Variant; + coerce = true; + } + int p; + ret = variables->checkVariable(m_name, tmpType, coerce, ar, construct, + p); + } + } + } + + setTypes(ret, type); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void SimpleVariable::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("$%s", m_name.c_str()); +} + +void SimpleVariable::outputCPPImpl(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_this) { + ClassScopePtr cls = ar->getClassScope(); + if (cls->isRedeclaring() || cls->derivesFromRedeclaring() != + ClassScope::FromNormal) { + cg.printf("root"); + } else { + cg.printf("this"); + } + } else if (m_superGlobal) { + VariableTablePtr variables = ar->getScope()->getVariables(); + cg.printf("g->%s", variables->getGlobalVariableName(ar, m_name).c_str()); + } else if (m_globals) { + cg.printf("get_global_array_wrapper()"); + } else { + const char *prefix = + ar->getScope()->getVariables()->getVariablePrefix(ar, m_name); + cg.printf("%s%s", prefix, m_name.c_str()); + } +} diff --git a/src/lib/expression/simple_variable.h b/src/lib/expression/simple_variable.h new file mode 100644 index 0000000000000..8b06ed31556bb --- /dev/null +++ b/src/lib/expression/simple_variable.h @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __SIMPLE_VARIABLE_H__ +#define __SIMPLE_VARIABLE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(SimpleVariable); + +class SimpleVariable : public Expression { +public: + SimpleVariable(EXPRESSION_CONSTRUCTOR_PARAMETERS, const std::string &name); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool hasEffect() const { return false;} + virtual bool isThis() const { return m_this;} + virtual bool isRefable() const { return true;} + virtual TypePtr inferAndCheck(AnalysisResultPtr ar, TypePtr type, + bool coerce); + + const std::string &getName() const { return m_name;} + +private: + std::string m_name; + std::string m_text; + bool m_this; // whether this is a legitimate $this + bool m_globals; // whether is is $GLOBAL + bool m_superGlobal; + TypePtr m_superGlobalType; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __SIMPLE_VARIABLE_H__ diff --git a/src/lib/expression/static_member_expression.cpp b/src/lib/expression/static_member_expression.cpp new file mode 100644 index 0000000000000..af4c52f54c1ad --- /dev/null +++ b/src/lib/expression/static_member_expression.cpp @@ -0,0 +1,198 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +StaticMemberExpression::StaticMemberExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, + const std::string &className, ExpressionPtr exp) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_exp(exp), m_valid(false), m_dynamicClass(false), m_redeclared(false) { + m_className = Util::toLower(className); +} + +ExpressionPtr StaticMemberExpression::clone() { + StaticMemberExpressionPtr exp(new StaticMemberExpression(*this)); + Expression::deepCopy(exp); + return exp; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void StaticMemberExpression::analyzeProgram(AnalysisResultPtr ar) { + addUserClass(ar, m_className); + m_exp->analyzeProgram(ar); +} + +ExpressionPtr StaticMemberExpression::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + return ExpressionPtr(); +} + +ExpressionPtr StaticMemberExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return ExpressionPtr(); +} + +/** + * static_member can only be one of these two forms: + * + * T::$member + * T::$$member or T::${$member}, where $member can be an arbitrary expression + */ +TypePtr StaticMemberExpression::inferTypes(AnalysisResultPtr ar, + TypePtr type, bool coerce) { + ConstructPtr self = shared_from_this(); + + ClassScopePtr cls = ar->resolveClass(m_className); + m_valid = true; + if (!cls) { + if (!cls && ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::UnknownClass, self); + } + m_valid = false; + } + + VariableTablePtr variables = ar->getScope()->getVariables(); + variables->setAttribute(VariableTable::NeedGlobalPointer); + if (cls) { + if (cls->isRedeclaring()) { + m_redeclared = true; + } + if (cls->derivesFromRedeclaring()) { + m_dynamicClass = true; + } + } + + if (m_exp->is(Expression::KindOfSimpleVariable)) { + if (!cls) { + return type; + } + SimpleVariablePtr var = dynamic_pointer_cast(m_exp); + const std::string &name = var->getName(); + int p; + TypePtr tp; + if (m_redeclared) { + BOOST_FOREACH(ClassScopePtr clsr, ar->findClasses(m_className)) { + clsr->checkStatic(name, type, coerce, ar, self, p); + } + tp = Type::Variant; + } else { + tp = cls->checkStatic(name, type, coerce, ar, self, p); + } + if (ar->isFirstPass() && p && !(p & VariableTable::VariableStatic)) { + ar->getCodeError()->record(self, CodeError::MissingObjectContext, self); + } + + if (cls->hasProperty(name) || m_redeclared) { + m_resolvedClassName = m_className; + } else { + ClassScopePtr parent = cls->getVariables()->findParent(ar, name); + ASSERT(parent); + m_resolvedClassName = parent->getName(); + } + return tp; + } else { + cls->getVariables()->forceVariants(ar); + } + + m_exp->inferAndCheck(ar, Type::String, false); + return Type::Variant; // we have to use a variant to hold dynamic value +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void StaticMemberExpression::outputPHP(CodeGenerator &cg, + AnalysisResultPtr ar) { + cg.printf("%s::", m_className.c_str()); + m_exp->outputPHP(cg, ar); +} + +void StaticMemberExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + if (!m_valid) { + cg.printf("throw_fatal(\"unknown class %s\")", m_className.c_str()); + return; + } + + if (m_exp->is(Expression::KindOfSimpleVariable) && !m_redeclared && + !m_dynamicClass) { + ASSERT(!m_resolvedClassName.empty()); + + ClassScopePtr cls = ar->findClass(m_resolvedClassName); + ASSERT(cls); + SimpleVariablePtr var = dynamic_pointer_cast(m_exp); + if (cls->needLazyStaticInitializer()) { + cg.printf("%s%s::lazy_initializer(g)->%s%s%s%s", + Option::ClassPrefix, m_resolvedClassName.c_str(), + Option::StaticPropertyPrefix, m_resolvedClassName.c_str(), + Option::IdPrefix.c_str(), var->getName().c_str()); + } else { + cg.printf("g->%s%s%s%s", Option::StaticPropertyPrefix, + m_resolvedClassName.c_str(), Option::IdPrefix.c_str(), + var->getName().c_str()); + } + } else { + if (m_context & (LValue | RefValue)) { + if (m_redeclared) { + cg.printf("g->%s%s->%slval(", Option::ClassStaticsObjectPrefix, + m_className.c_str(),Option::ObjectStaticPrefix); + } else { + cg.printf("%s%s::%slval(", Option::ClassPrefix, m_className.c_str(), + Option::ObjectStaticPrefix); + } + } else { + if (m_redeclared) { + cg.printf("g->%s%s->%sget(", Option::ClassStaticsObjectPrefix, + m_className.c_str(), Option::ObjectStaticPrefix); + } else { + cg.printf("%s%s::%sget(", Option::ClassPrefix, m_className.c_str(), + Option::ObjectStaticPrefix); + } + } + if (m_exp->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = dynamic_pointer_cast(m_exp); + cg.printf("\"%s\"", var->getName().c_str()); + } else if (m_exp->is(Expression::KindOfDynamicVariable)) { + DynamicVariablePtr var = dynamic_pointer_cast(m_exp); + var->getSubExpression()->outputCPP(cg, ar); + } else { + m_exp->outputCPP(cg, ar); + } + cg.printf(", -1)"); + } +} diff --git a/src/lib/expression/static_member_expression.h b/src/lib/expression/static_member_expression.h new file mode 100644 index 0000000000000..4198a76249a54 --- /dev/null +++ b/src/lib/expression/static_member_expression.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __STATIC_MEMBER_EXPRESSION_H__ +#define __STATIC_MEMBER_EXPRESSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(StaticMemberExpression); + +class StaticMemberExpression : public Expression { +public: + StaticMemberExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + const std::string &className, ExpressionPtr exp); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual bool hasEffect() const { return false;} + virtual bool isRefable() const { return true;} + +private: + std::string m_className; + ExpressionPtr m_exp; + + bool m_valid; + std::string m_resolvedClassName; + + bool m_dynamicClass; + bool m_redeclared; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __STATIC_MEMBER_EXPRESSION_H__ diff --git a/src/lib/expression/unary_op_expression.cpp b/src/lib/expression/unary_op_expression.cpp new file mode 100644 index 0000000000000..656386a0672ac --- /dev/null +++ b/src/lib/expression/unary_op_expression.cpp @@ -0,0 +1,562 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +UnaryOpExpression::UnaryOpExpression +(EXPRESSION_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp, int op, bool front) + : Expression(EXPRESSION_CONSTRUCTOR_PARAMETER_VALUES), + m_exp(exp), m_op(op), m_front(front), m_effect(false), m_arrayId(-1) { + switch (m_op) { + case T_INC: + case T_DEC: + m_effect = true; + // this is hacky, what we need is LValueWrapper + if (!m_exp->is(Expression::KindOfSimpleVariable)) { + m_exp->setContext(Expression::LValue); + m_exp->clearContext(Expression::NoLValueWrapper); + } + break; + case '@': + case '(': + m_effect = m_exp->hasEffect(); + break; + case T_EXIT: + case T_PRINT: + case T_INCLUDE: + case T_INCLUDE_ONCE: + case T_REQUIRE: + case T_REQUIRE_ONCE: + case T_EVAL: + m_effect = true; + break; + case T_ISSET: + break; + case T_ARRAY: + { + ExpressionListPtr exps = dynamic_pointer_cast(m_exp); + if (exps) exps->controlOrder(); + } + default: + break; + } +} + +ExpressionPtr UnaryOpExpression::clone() { + UnaryOpExpressionPtr exp(new UnaryOpExpression(*this)); + Expression::deepCopy(exp); + exp->m_exp = Clone(m_exp); + return exp; +} + +bool UnaryOpExpression::isScalar() const { + switch (m_op) { + case '!': + case '+': + case '-': + case T_INC: + case T_DEC: + case '~': + case '@': + case '(': + return m_exp->isScalar(); + case T_ARRAY: + return (!m_exp || m_exp->isScalar()); + default: + break; + } + return false; +} + +bool UnaryOpExpression::isRefable() const { + if (m_op == '(') return m_exp->isRefable(); + return false; +} + +bool UnaryOpExpression::isThis() const { + if (m_op == '(') return m_exp->isThis(); + return false; +} + +bool UnaryOpExpression::containsDynamicConstant(AnalysisResultPtr ar) const { + switch (m_op) { + case '+': + case '-': + case T_ARRAY: + return m_exp && m_exp->containsDynamicConstant(ar); + default: + break; + } + return false; +} + +bool UnaryOpExpression::getScalarValue(Variant &value) { + if (m_op != T_ARRAY) return false; + if (m_exp) return (m_exp->getScalarValue(value)); + value = Array::Create(); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void UnaryOpExpression::onParse(AnalysisResultPtr ar) { + if (m_op == T_EVAL) { + ConstructPtr self = shared_from_this(); + ar->getCodeError()->record(self, CodeError::UseEvaluation, self); + ar->getFileScope()->setAttribute(FileScope::ContainsLDynamicVariable); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void UnaryOpExpression::analyzeProgram(AnalysisResultPtr ar) { + if (ar->isFirstPass()) { + ConstructPtr self = shared_from_this(); + if (m_op == T_INCLUDE || m_op == T_REQUIRE) { + ar->getCodeError()->record(self, CodeError::UseInclude, self); + } + } + if (m_exp) m_exp->analyzeProgram(ar); +} + +bool UnaryOpExpression::preCompute(AnalysisResultPtr ar, CVarRef value, + Variant &result) { + switch(m_op) { + case '!': + result = (!toBoolean(value)); break; + case '+': + result = value.unary_plus(); break; + case '-': + result = value.negate(); break; + case '~': + result = ~value; break; + case '(': + result = value; break; + case T_INT_CAST: + result = value.toInt64(); break; + case T_DOUBLE_CAST: + result = toDouble(value); break; + case T_STRING_CAST: + result = toString(value); break; + case T_BOOL_CAST: + result = toBoolean(value); break; + case T_INC: + case T_DEC: + ASSERT(false); + default: + return false; + } + return true; +} + +ExpressionPtr UnaryOpExpression::preOptimize(AnalysisResultPtr ar) { + Variant value; + Variant result; + bool hasResult; + + ar->preOptimize(m_exp); + + if (!m_exp || !m_exp->isScalar()) return ExpressionPtr(); + if (!m_exp->getScalarValue(value)) return ExpressionPtr(); + hasResult = preCompute(ar, value, result); + if (hasResult) { + if (result.isNull()) { + return CONSTANT("null"); + } else if (result.isBoolean()) { + return CONSTANT(result ? "true" : "false"); + } else if (result.isDouble() && !finite(result.getDouble())) { + return ExpressionPtr(); + } else if (result.isArray()) { + return ExpressionPtr(); + } else { + return ScalarExpressionPtr + (new ScalarExpression(m_exp->getLocation(), + Expression::KindOfScalarExpression, + result)); + } + } + return ExpressionPtr(); +} + +ExpressionPtr UnaryOpExpression::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return ExpressionPtr(); +} + +TypePtr UnaryOpExpression::inferTypes(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + TypePtr et; // expected m_exp's type + TypePtr rt; // return type + + switch (m_op) { + case '!': et = rt = Type::Boolean; break; + case '+': + case '-': et = NEW_TYPE(Numeric); rt = NEW_TYPE(Numeric); break; + case T_INC: + case T_DEC: + case '~': et = rt = NEW_TYPE(Primitive); break; + case T_CLONE: et = rt = NEW_TYPE(Object); break; + case '@': + case '(': et = rt = type; break; + case T_INT_CAST: et = NEW_TYPE(Some); rt = Type::Int64; break; + case T_DOUBLE_CAST: et = NEW_TYPE(Some); rt = Type::Double; break; + case T_STRING_CAST: et = NEW_TYPE(Some); rt = Type::String; break; + case T_ARRAY: + case T_ARRAY_CAST: et = NEW_TYPE(Some); rt = Type::Array; break; + case T_OBJECT_CAST: et = NEW_TYPE(Some); rt = NEW_TYPE(Object); break; + case T_BOOL_CAST: et = NEW_TYPE(Some); rt = Type::Boolean; break; + case T_UNSET_CAST: et = NEW_TYPE(Some); rt = Type::Variant; break; + case T_EXIT: et = NEW_TYPE(Primitive); rt = Type::Variant; break; + case T_PRINT: et = Type::String; rt = Type::Boolean; break; + case T_ISSET: + et = Type::Variant; + rt = Type::Boolean; + if (m_exp && m_exp->is(Expression::KindOfExpressionList)) { + ExpressionListPtr exps = dynamic_pointer_cast(m_exp); + for (int i = 0; i < exps->getCount(); i++) { + (*exps)[i]->setContext(Expression::IssetContext); + } + } + break; + case T_EMPTY: et = NEW_TYPE(Some); rt = Type::Boolean; break; + case T_INCLUDE: + case T_INCLUDE_ONCE: + case T_REQUIRE: + case T_REQUIRE_ONCE: et = Type::String; rt = Type::Boolean; break; + case T_EVAL: + et = Type::String; + rt = NEW_TYPE(Any); + ar->getScope()->getVariables()->forceVariants(ar); + break; + case T_FILE: et = rt = Type::String; break; + default: + ASSERT(false); + } + + bool insideScalarArray = ar->getInsideScalarArray(); + + if (m_op == T_ARRAY && + (getContext() & (RefValue|LValue)) == 0) { + if (m_exp) { + ExpressionListPtr pairs = dynamic_pointer_cast(m_exp); + if (pairs && pairs->isScalarArrayPairs()) { + m_arrayId = ar->registerScalarArray(m_exp); + ar->setInsideScalarArray(true); + } + } else { + m_arrayId = ar->registerScalarArray(m_exp); // empty array + } + } + + if (m_exp) { + bool ecoerce = false; // expected type needs m_exp to coerce to + switch (m_op) { + case T_CLONE: + case T_ISSET: + ecoerce = true; + default: + break; + } + + TypePtr expType = m_exp->inferAndCheck(ar, et, ecoerce); + if (Type::SameType(expType, Type::String) && + (m_op == T_INC || m_op == T_DEC)) { + rt = expType = m_exp->inferAndCheck(ar, Type::Variant, true); + } + + switch (m_op) { + case '@': + case '(': + rt = expType; + break; + case '+': + case '-': + if (Type::SameType(expType, Type::Int64) || + Type::SameType(expType, Type::Double)) { + rt = expType; + } + break; + case T_INC: + case T_DEC: + if (m_exp->is(Expression::KindOfSimpleVariable)) { + FunctionScopePtr func = + dynamic_pointer_cast(ar->getScope()); + if (func) { + SimpleVariablePtr var = dynamic_pointer_cast(m_exp); + VariableTablePtr variables = ar->getScope()->getVariables(); + const std::string &name = var->getName(); + if (variables->isParameter(name)) { + variables->addLvalParam(name); + } + } + } + // fall through + case '~': + if (Type::SameType(expType, Type::Int64) || + Type::SameType(expType, Type::Double) || + Type::SameType(expType, Type::String)) { + rt = expType; + } + break; + default: + break; + } + } + + ar->setInsideScalarArray(insideScalarArray); + + return rt; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void UnaryOpExpression::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_front) { + switch (m_op) { + case T_CLONE: cg.printf("clone "); break; + case T_INC: cg.printf("++"); break; + case T_DEC: cg.printf("--"); break; + case '+': cg.printf("+"); break; + case '-': cg.printf("-"); break; + case '!': cg.printf("!"); break; + case '~': cg.printf("~"); break; + case '(': cg.printf("("); break; + case T_INT_CAST: cg.printf("(int)"); break; + case T_DOUBLE_CAST: cg.printf("(real)"); break; + case T_STRING_CAST: cg.printf("(string)"); break; + case T_ARRAY_CAST: cg.printf("(array)"); break; + case T_OBJECT_CAST: cg.printf("(object)"); break; + case T_BOOL_CAST: cg.printf("(bool)"); break; + case T_UNSET_CAST: cg.printf("(unset)"); break; + case T_EXIT: cg.printf("exit("); break; + case '@': cg.printf("@"); break; + case T_ARRAY: cg.printf("array("); break; + case T_PRINT: cg.printf("print "); break; + case T_ISSET: cg.printf("isset("); break; + case T_EMPTY: cg.printf("empty("); break; + case T_INCLUDE: cg.printf("include "); break; + case T_INCLUDE_ONCE: cg.printf("include_once "); break; + case T_EVAL: cg.printf("eval("); break; + case T_REQUIRE: cg.printf("require "); break; + case T_REQUIRE_ONCE: cg.printf("require_once "); break; + case T_FILE: cg.printf("__FILE__"); break; + default: + ASSERT(false); + } + } + + if (m_exp) m_exp->outputPHP(cg, ar); + + if (m_front) { + switch (m_op) { + case '(': + case T_EXIT: + case T_ARRAY: + case T_ISSET: + case T_EMPTY: + case T_EVAL: cg.printf(")"); break; + default: + break; + } + } else { + switch (m_op) { + case T_INC: cg.printf("++"); break; + case T_DEC: cg.printf("--"); break; + default: + ASSERT(false); + } + } +} + +void UnaryOpExpression::outputCPPImpl(CodeGenerator &cg, + AnalysisResultPtr ar) { + if (m_arrayId != -1) { + if (cg.getOutput() == CodeGenerator::SystemCPP) { + cg.printf("SystemScalarArrays::%s[%d]", + Option::SystemScalarArrayName, m_arrayId); + } else { + cg.printf("ScalarArrays::%s[%d]", + Option::ScalarArrayName, m_arrayId); + } + return; + } + + if ((m_op == T_ISSET || m_op == T_EMPTY) && m_exp) { + if (m_exp->is(Expression::KindOfExpressionList)) { + ExpressionListPtr exps = dynamic_pointer_cast(m_exp); + if (exps->getCount() > 1) { + cg.printf("("); + } + for (int i = 0; i < exps->getCount(); i++) { + if (i > 0) cg.printf(" && "); + (*exps)[i]->outputCPPExistTest(cg, ar, m_op); + } + if (exps->getCount() > 1) { + cg.printf(")"); + } + } else { + m_exp->outputCPPExistTest(cg, ar, m_op); + } + return; + } + + if (m_front) { + switch (m_op) { + case T_CLONE: cg.printf("f_clone("); break; + case T_INC: cg.printf("++"); break; + case T_DEC: cg.printf("--"); break; + case '+': cg.printf("+"); break; + case '-': cg.printf("negate("); break; + case '!': cg.printf("!("); break; + case '~': cg.printf("~"); break; + case '(': cg.printf("("); break; + case T_INT_CAST: cg.printf("toInt64("); break; + case T_DOUBLE_CAST: cg.printf("toDouble("); break; + case T_STRING_CAST: cg.printf("toString("); break; + case T_ARRAY_CAST: cg.printf("toArray("); break; + case T_OBJECT_CAST: cg.printf("toObject("); break; + case T_BOOL_CAST: cg.printf("toBoolean("); break; + case T_UNSET_CAST: cg.printf("unset("); break; + case T_EXIT: cg.printf("f_exit("); break; + case T_ARRAY: + if (ar->getInsideScalarArray()) { + cg.printf("StaticArray("); + } else { + cg.printf("Array("); + } + break; + case T_PRINT: cg.printf("print("); break; + case T_EVAL: + if (Option::EnableEval > Option::NoEval) { + cg.printf("eval(%s, Object(%s), ", + ar->getScope()->inPseudoMain() ? + "get_variable_table()" : "variables", + ar->getClassScope() ? "this" : ""); + } else { + cg.printf("f_eval("); + } + break; + case T_INCLUDE: + case T_INCLUDE_ONCE: + case T_REQUIRE: + case T_REQUIRE_ONCE: cg.printf("f_include("); break; + case '@': + cg.printf("(silenceInc(), silenceDec("); + break; + case T_FILE: + cg.printf("get_source_filename(\"%s\")", getLocation()->file); + break; + break; + default: + ASSERT(false); + } + } + + + if (m_exp) { + switch (m_op) { + case '+': + case '-': + if (m_exp->getActualType() && + (m_exp->getActualType()->is(Type::KindOfString) || + m_exp->getActualType()->is(Type::KindOfArray))) { + cg.printf("(Variant)("); + m_exp->outputCPP(cg, ar); + cg.printf(")"); + } else { + m_exp->outputCPP(cg, ar); + } + break; + case '@': + // Void needs to return something to silenceDec + if (!m_exp->getActualType()) { + cg.printf("("); + m_exp->outputCPP(cg, ar); + cg.printf(",null)"); + } else { + m_exp->outputCPP(cg, ar); + } + break; + default: + m_exp->outputCPP(cg, ar); + break; + } + } + + if (m_front) { + switch (m_op) { + case T_ARRAY: + cg.printf(")"); + break; + case T_CLONE: + case '!': + case '(': + case '-': + case T_INT_CAST: + case T_DOUBLE_CAST: + case T_STRING_CAST: + case T_ARRAY_CAST: + case T_OBJECT_CAST: + case T_BOOL_CAST: + case T_UNSET_CAST: + case T_EXIT: + case T_PRINT: + case T_EVAL: + case T_INCLUDE: + case T_INCLUDE_ONCE: + case T_REQUIRE: + case T_REQUIRE_ONCE: + cg.printf(")"); + break; + case '@': + cg.printf("))"); + break; + default: + break; + } + } else { + switch (m_op) { + case T_INC: cg.printf("++"); break; + case T_DEC: cg.printf("--"); break; + default: + ASSERT(false); + } + } +} diff --git a/src/lib/expression/unary_op_expression.h b/src/lib/expression/unary_op_expression.h new file mode 100644 index 0000000000000..038ecf27dedd5 --- /dev/null +++ b/src/lib/expression/unary_op_expression.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __UNARY_OP_EXPRESSION_H__ +#define __UNARY_OP_EXPRESSION_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(UnaryOpExpression); + +class UnaryOpExpression : public Expression { +public: + UnaryOpExpression(EXPRESSION_CONSTRUCTOR_PARAMETERS, + ExpressionPtr exp, int op, bool front); + + DECLARE_EXPRESSION_VIRTUAL_FUNCTIONS; + virtual void onParse(AnalysisResultPtr ar); + virtual bool hasEffect() const { return m_effect;} + virtual bool isRefable() const; + virtual bool isScalar() const; + virtual bool isThis() const; + virtual bool containsDynamicConstant(AnalysisResultPtr ar) const; + virtual bool getScalarValue(Variant &value); + + ExpressionPtr getExpression() { return m_exp;} + int getOp() const { return m_op;} + +protected: + ExpressionPtr m_exp; + int m_op; + bool m_front; + bool m_effect; + int m_arrayId; + +private: + bool preCompute(AnalysisResultPtr ar, CVarRef value, Variant &result); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __UNARY_OP_EXPRESSION_H__ diff --git a/src/lib/hook.mk b/src/lib/hook.mk new file mode 100644 index 0000000000000..a73ff7ffddea0 --- /dev/null +++ b/src/lib/hook.mk @@ -0,0 +1,10 @@ +EXTRA_ERROR_INC := \ + $(wildcard ../../facebook/src/lib/analysis/extra_code_error.inc) +ifneq ($(strip $(EXTRA_ERROR_INC)),) + ERROR_INC += $(EXTRA_ERROR_INC) +endif +EXTRA_DEPENDENCY_INC := \ + $(wildcard ../../facebook/src/lib/analysis/extra_dependency.inc) +ifneq ($(strip $(EXTRA_DEPENDENCY_INC)),) + DEPENDENCY_INC += $(EXTRA_DEPENDENCY_INC) +endif diff --git a/src/lib/hphp.h b/src/lib/hphp.h new file mode 100644 index 0000000000000..cf161dace46a1 --- /dev/null +++ b/src/lib/hphp.h @@ -0,0 +1,26 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_H__ +#define __HPHP_H__ + +/////////////////////////////////////////////////////////////////////////////// + +#include + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __HPHP_H__ diff --git a/src/lib/hphp_unique.h b/src/lib/hphp_unique.h new file mode 100644 index 0000000000000..f2062898a788d --- /dev/null +++ b/src/lib/hphp_unique.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_UNIQUE_H__ +#define __HPHP_UNIQUE_H__ + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +enum HphpHookUniqueId { + hphpUniqueDtor = 0, + onSimpleFunctionCallAnalyzeInclude, + onSimpleFunctionCallFuncType, + beforeSimpleFunctionCallCheck, + afterSimpleFunctionCallCheck, + beforeAssignmentExpressionInferTypes, + afterAssignmentExpressionInferTypes, + beforeDependencyGraphAdd, + afterDependencyGraphAdd, + onPackageAddDirectory, + onScalarExpressionParse, +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_UNIQUE_H__ diff --git a/src/lib/option.cpp b/src/lib/option.cpp new file mode 100644 index 0000000000000..f9e3bbcc6adc0 --- /dev/null +++ b/src/lib/option.cpp @@ -0,0 +1,605 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// + +#define LOAD_OPTION(s) \ + if ((v = GetValue(variables, #s)) && !Load(s, v)) return false; + +bool Option::Load(VariableTablePtr variables) { + ExpressionPtr v; + + LOAD_OPTION(PackageDirectories); + LOAD_OPTION(PackageFiles); + LOAD_OPTION(PackageExcludeDirs); + LOAD_OPTION(PackageExcludeFiles); + LOAD_OPTION(AllowedBadPHPIncludes); + LOAD_OPTION(IncludeRoots); + LOAD_OPTION(AutoloadRoots); + LOAD_OPTION(DefaultIncludeRoot); + LOAD_OPTION(DynamicFunctionCalls); + LOAD_OPTION(GeneratePickledPHP); + LOAD_OPTION(GenerateInlinedPHP); + LOAD_OPTION(GenerateTrimmedPHP); + LOAD_OPTION(GenerateInlineComments); + LOAD_OPTION(GenerateInferredTypes); + LOAD_OPTION(ConvertSuperGlobals); + LOAD_OPTION(ConvertQOpExpressions); + LOAD_OPTION(ProgramPrologue); + LOAD_OPTION(TrimmedPrologue); + LOAD_OPTION(DynamicFunctionPrefixes); + LOAD_OPTION(DynamicFunctionPostfixes); + LOAD_OPTION(DynamicMethodPrefixes); + LOAD_OPTION(DynamicMethodPostfixes); + LOAD_OPTION(DynamicClassPrefixes); + LOAD_OPTION(DynamicClassPostfixes); + LOAD_OPTION(DynamicInvokeFunctions); + LOAD_OPTION(IdPrefix); + LOAD_OPTION(LambdaPrefix); + LOAD_OPTION(Tab); + LOAD_OPTION(GenerateCPPMacros); + LOAD_OPTION(GenerateCPPMain); + LOAD_OPTION(GenerateCPPComments); + LOAD_OPTION(GenerateCPPMetaInfo); + LOAD_OPTION(GenerateCPPNameSpace); + LOAD_OPTION(ConditionalIncludeExpandLevel); + LOAD_OPTION(DependencyMaxProgram); + LOAD_OPTION(CodeErrorMaxProgram); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +std::string Option::SystemRoot; +std::string Option::RootDirectory; +set Option::PackageDirectories; +set Option::PackageFiles; +set Option::PackageExcludeDirs; +set Option::PackageExcludeFiles; +bool Option::CachePHPFile = false; + +set Option::AllowedBadPHPIncludes; +map Option::IncludeRoots; +map Option::AutoloadRoots; +string Option::DefaultIncludeRoot; +map Option::DynamicFunctionCalls; + +bool Option::GeneratePickledPHP = false; +bool Option::GenerateInlinedPHP = false; +bool Option::GenerateTrimmedPHP = false; +bool Option::GenerateInlineComments = true; +bool Option::GenerateInferredTypes = false; +bool Option::ConvertSuperGlobals = false; +bool Option::ConvertQOpExpressions = false; +string Option::ProgramPrologue; +string Option::TrimmedPrologue; +vector Option::DynamicFunctionPrefixes; +vector Option::DynamicFunctionPostfixes; +vector Option::DynamicMethodPrefixes; +vector Option::DynamicMethodPostfixes; +vector Option::DynamicClassPrefixes; +vector Option::DynamicClassPostfixes; +set Option::DynamicInvokeFunctions; +string Option::IdPrefix = "$$"; +string Option::LambdaPrefix = "df_"; +string Option::Tab = " "; + +/** + * They all have to be something different. Otherwise, there is always a chance + * of name collision or incorrect code transformation. + */ +const char *Option::FunctionPrefix = "f_"; +const char *Option::BuiltinFunctionPrefix = "x_"; +const char *Option::InvokePrefix = "i_"; +const char *Option::CreateObjectPrefix = "co_"; +const char *Option::PseudoMainPrefix = "pm_"; +const char *Option::VariablePrefix = "v_"; +const char *Option::GlobalVariablePrefix = "gv_"; +const char *Option::StaticVariablePrefix = "sv_"; +const char *Option::ScalarArrayName = "sa_"; +const char *Option::SystemScalarArrayName = "ssa_"; +const char *Option::ClassPrefix = "c_"; +const char *Option::ClassStaticsPrefix = "cs_"; +const char *Option::ClassStaticsObjectPrefix = "cso_"; +const char *Option::ClassStaticsIdGetterPrefix = "csig_"; +const char *Option::ClassStaticInitializerPrefix = "csi_"; +const char *Option::ClassStaticInitializerFlagPrefix = "csf_"; +const char *Option::ClassWrapperFunctionPrefix = "cw_"; +const char *Option::ObjectPrefix = "o_"; +const char *Option::ObjectStaticPrefix = "os_"; +const char *Option::SmartPtrPrefix = "p_"; +const char *Option::MethodPrefix = "t_"; +const char *Option::MethodImplPrefix = "ti_"; +const char *Option::PropertyPrefix = "m_"; +const char *Option::StaticPropertyPrefix = "s_"; +const char *Option::ConstantPrefix = "k_"; +const char *Option::ClassConstantPrefix = "q_"; +const char *Option::ExceptionPrefix = "e_"; +const char *Option::TempVariablePrefix = "r_"; +const char *Option::EvalOrderTempPrefix = "eo_"; +const char *Option::EvalInvokePrefix = "ei_"; + +const char *Option::FFIFnPrefix = "ffi_"; + +const char *Option::TempPrefix = "tmp"; +const char *Option::MapPrefix = "map"; +const char *Option::IterPrefix = "iter"; +const char *Option::InitPrefix = "inited_"; + +const char *Option::SystemFilePrefix = "sys/"; +const char *Option::UserFilePrefix = "php/"; +const char *Option::ClassHeaderPrefix = "cls/"; +const char *Option::ClusterPrefix = "cpp/"; +const char *Option::FFIFilePrefix = "ffi/"; + +bool Option::PreOptimization = false; +bool Option::PostOptimization = false; +bool Option::ScalarArrayOptimization = true; +bool Option::ScalarArrayCompression = true; +bool Option::LiteralStringCompression = false; +int Option::ScalarArrayFileCount = 1; +int Option::ScalarArrayOverflowLimit = 2000; +bool Option::SeparateCompilation = false; +bool Option::SeparateCompLib = false; +int Option::LiteralStringFileCount = 50; + +std::string Option::RTTIOutputFile; +std::string Option::RTTIDirectory; +bool Option::GenRTTIProfileData = false; +bool Option::UseRTTIProfileData = false; + +bool Option::StaticMethodAutoFix = false; + +bool Option::GenerateCPPMacros = true; +bool Option::GenerateCPPMain = false; +bool Option::GenerateCPPComments = true; +bool Option::GenerateCPPMetaInfo = true; +bool Option::GenerateCPPNameSpace = true; +bool Option::KeepStatementsWithNoEffect = false; + +int Option::ConditionalIncludeExpandLevel = 1; + +int Option::DependencyMaxProgram = 1; +int Option::CodeErrorMaxProgram = 1; + +bool Option::GenerateFFI = false; +Option::EvalLevel Option::EnableEval = NoEval; + +std::string Option::JavaFFIRootPackage; + +std::string Option::ProgramName; + +bool Option::EnableXHP = false; + +int Option::InvokeFewArgsCount = 6; +bool Option::PrecomputeLiteralStrings = false; +bool Option::FlattenInvoke = true; +int Option::InlineFunctionThreshold = -1; +bool Option::ControlEvalOrder = true; + +bool Option::AllDynamic = false; + +std::string Option::FlibDirectory; + +/////////////////////////////////////////////////////////////////////////////// +// load from a PHP file + +std::string Option::GetSystemRoot() { + if (SystemRoot.empty()) { + const char *home = getenv("HPHP_HOME"); + if (!home || !*home) { + throw FatalErrorException("Environment variable HPHP_HOME is not set."); + } + SystemRoot = home; + SystemRoot += "/src"; + } + return SystemRoot; +} + +bool Option::Load(const char *filename) { + ASSERT(filename && *filename); + try { + Scanner scanner(new ylmm::basic_buffer(filename), true, false); + Logger::Info("loading options from %s...", filename); + AnalysisResultPtr ar(new AnalysisResult()); + + struct stat sb; + if (stat(filename, &sb)) { + Logger::Error("Unable to stat file %s", filename); + return false; + } + ParserPtr parser(new Parser(scanner, filename, sb.st_size, ar)); + if (parser->parse()) { + Logger::Error("Unable to parse file: %s\n%s", filename, + parser->getMessage().c_str()); + return false; + } + + FileScopePtr file = ar->findFileScope(filename, false); + ClassScopePtr cls = file->getClass("hphpoption"); + if (!cls) { + Logger::Error("Unable to find HPHPOption class in %s", filename); + return false; + } + + if (!Load(cls->getVariables())) { + return false; + } + + } catch (std::runtime_error) { + Logger::Error("Unable to open file %s", filename); + return false; + } + return true; +} + +ExpressionPtr Option::GetValue(VariableTablePtr variables, + const char *varName) { + ConstructPtr decl = variables->getDeclaration(varName); + if (!decl) { + return ExpressionPtr(); + } + + AssignmentExpressionPtr assignment = + dynamic_pointer_cast(decl); + if (!assignment) { + Logger::Error("Line %d: Ignored option %s", decl->getLocation()->line1, + varName); + return ExpressionPtr(); + } + + return assignment->getValue(); +} + +bool Option::GetArrayElements(ExpressionPtr value, ExpressionListPtr &out) { + UnaryOpExpressionPtr v = dynamic_pointer_cast(value); + if (!v || v->getOp() != T_ARRAY) { + Logger::Error("Line %d: invalid array: %s", value->getLocation()->line1, + value->getText().c_str()); + return false; + } + + ExpressionPtr exp = v->getExpression(); + out = dynamic_pointer_cast(exp); + if (!out) { + Logger::Error("Line %d: invalid array: %s", value->getLocation()->line1, + value->getText().c_str()); + return false; + } + + return true; +} + +bool Option::Load(bool &option, ExpressionPtr value) { + ConstantExpressionPtr v = dynamic_pointer_cast(value); + if (!v || !v->isBoolean()) { + Logger::Error("Line %d: invalid boolean: %s", value->getLocation()->line1, + value->getText().c_str()); + return false; + } + option = v->getBooleanValue(); + return true; +} + +bool Option::Load(int &option, ExpressionPtr value) { + ScalarExpressionPtr v = dynamic_pointer_cast(value); + if (!v || !v->isLiteralInteger()) { + Logger::Error("Line %d: invalid integer: %s", value->getLocation()->line1, + value->getText().c_str()); + return false; + } + option = v->getLiteralInteger(); + return true; +} + +bool Option::Load(string &option, ExpressionPtr value) { + ScalarExpressionPtr v = dynamic_pointer_cast(value); + if (!v || !v->isLiteralString()) { + Logger::Error("Line %d: invalid string: %s", value->getLocation()->line1, + value->getText().c_str()); + return false; + } + option = v->getLiteralString(); + return true; +} + +bool Option::Load(set &option, ExpressionPtr value) { + ExpressionListPtr elements; + if (!GetArrayElements(value, elements)) return false; + + for (int i = 0; i < elements->getCount(); i++) { + ExpressionPtr e = (*elements)[i]; + ArrayPairExpressionPtr pair = dynamic_pointer_cast(e); + + ScalarExpressionPtr v; + if (pair) v = dynamic_pointer_cast(pair->getValue()); + + if (!pair || !v || !v->isLiteralString()) { + Logger::Error("Line %d: invalid element: %s", e->getLocation()->line1, + e->getText().c_str()); + return false; + } + option.insert(v->getLiteralString()); + } + + return true; +} + +bool Option::Load(map &option, ExpressionPtr value) { + ExpressionListPtr elements; + if (!GetArrayElements(value, elements)) return false; + + for (int i = 0; i < elements->getCount(); i++) { + ExpressionPtr e = (*elements)[i]; + ArrayPairExpressionPtr pair = dynamic_pointer_cast(e); + + ScalarExpressionPtr n, v; + if (pair) n = dynamic_pointer_cast(pair->getName()); + if (pair) v = dynamic_pointer_cast(pair->getValue()); + + if (!pair || !n || !v || !n->isLiteralString() || !v->isLiteralString()) { + Logger::Error("Line %d: invalid element: %s", e->getLocation()->line1, + e->getText().c_str()); + return false; + } + option[n->getLiteralString()] = v->getLiteralString(); + } + + return true; +} + +bool Option::Load(map &option, ExpressionPtr value) { + ExpressionListPtr elements; + if (!GetArrayElements(value, elements)) return false; + + for (int i = 0; i < elements->getCount(); i++) { + ExpressionPtr e = (*elements)[i]; + ArrayPairExpressionPtr pair = dynamic_pointer_cast(e); + + bool negative = false; + ScalarExpressionPtr n, v; + if (pair) n = dynamic_pointer_cast(pair->getName()); + if (pair) { + if (pair->getValue()->is(Expression::KindOfUnaryOpExpression)) { + UnaryOpExpressionPtr una = + dynamic_pointer_cast(pair->getValue()); + if (una->getOp() != '+' && una->getOp() != '-') { + Logger::Error("Line %d: invalid integer: %s", + una->getLocation()->line1, una->getText().c_str()); + return false; + } + + v = dynamic_pointer_cast(una->getExpression()); + if (una->getOp() == '-') { + negative = true; + } + } else { + v = dynamic_pointer_cast(pair->getValue()); + } + } + + if (!pair || !n || !v || !n->isLiteralString() || !v->isLiteralInteger()) { + Logger::Error("Line %d: invalid element: %s", e->getLocation()->line1, + e->getText().c_str()); + return false; + } + + if (negative) { + option[n->getLiteralString()] = - v->getLiteralInteger(); + } else { + option[n->getLiteralString()] = v->getLiteralInteger(); + } + } + + return true; +} + +bool Option::Load(vector &option, ExpressionPtr value) { + ExpressionListPtr elements; + if (!GetArrayElements(value, elements)) return false; + + for (int i = 0; i < elements->getCount(); i++) { + ExpressionPtr e = (*elements)[i]; + ArrayPairExpressionPtr pair = dynamic_pointer_cast(e); + + ScalarExpressionPtr v; + if (pair) v = dynamic_pointer_cast(pair->getValue()); + + if (!pair || !v || !v->isLiteralString()) { + Logger::Error("Line %d: invalid element: %s", e->getLocation()->line1, + e->getText().c_str()); + return false; + } + option.push_back(v->getLiteralString()); + } + + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// load from HDF file + +void Option::LoadRootHdf(const Hdf &roots, map &map) { + if (roots.exists()) { + for (Hdf hdf = roots.firstChild(); hdf.exists(); hdf = hdf.next()) { + map[hdf["root"].get()] = hdf["path"].get(); + } + } +} + +void Option::Load(Hdf &config) { + LoadRootHdf(config["IncludeRoots"], IncludeRoots); + LoadRootHdf(config["AutoloadRoots"], AutoloadRoots); + + config["PackageDirectories"].get(PackageDirectories); + config["PackageExcludeDirs"].get(PackageExcludeDirs); + config["PackageExcludeFiles"].get(PackageExcludeFiles); + CachePHPFile = config["CachePHPFile"].getBool(false); + config["DynamicFunctionPrefix"].get(DynamicFunctionPrefixes); + config["DynamicFunctionPostfix"].get(DynamicFunctionPostfixes); + config["DynamicMethodPrefix"].get(DynamicMethodPrefixes); + config["DynamicInvokeFunctions"].get(DynamicInvokeFunctions); + + ScalarArrayFileCount = config["ScalarArrayFileCount"].getByte(1); + if (ScalarArrayFileCount <= 0) ScalarArrayFileCount = 1; + LiteralStringFileCount = config["LiteralStringFileCount"].getInt32(50); + if (LiteralStringFileCount <= 0) LiteralStringFileCount = 50; + ScalarArrayOverflowLimit = config["ScalarArrayOverflowLimit"].getInt32(2000); + if (ScalarArrayOverflowLimit <= 0) ScalarArrayOverflowLimit = 2000; + FlibDirectory = config["FlibDirectory"].getString(); + EnableXHP = config["EnableXHP"].getBool(); + RTTIOutputFile = config["RTTIOutputFile"].getString(); + EnableEval = (EvalLevel)config["EnableEval"].getByte(0); + AllDynamic = config["AllDynamic"].getBool(); +} + +/////////////////////////////////////////////////////////////////////////////// +/** + * Load from database "config" table that looks like this: + * + * CREATE TABLE `config` ( + * `id` varchar(255) NOT NULL, + * `name` varchar(255) NOT NULL, + * `value` varchar(255) NOT NULL, + * PRIMARY KEY (`id`,`name`) + * ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + * + * Only a subset of options are supported. + */ +void Option::Load(ServerDataPtr server) { + DBConn conn; + conn.open(server); + + DBQueryPtr q(new DBQuery(&conn, "SELECT id, name, value FROM config")); + DBDataSet ds; + q->execute(ds); + + for (ds.moveFirst(); ds.getRow(); ds.moveNext()) { + const char *id = ds.getField(0); + string name = ds.getField(1); + string value = ds.getField(2); + boost::algorithm::trim(name); + boost::algorithm::trim(value); + + if (strcmp(id, "IncludeRoots") == 0) { + IncludeRoots[name] = value; + } else if (strcmp(id, "AutoloadRoots") == 0) { + AutoloadRoots[name] = value; + } else if (strcmp(id, "PackageDirectories") == 0) { + PackageDirectories.insert(name); + } else if (strcmp(id, "PackageExcludeDirs") == 0) { + PackageExcludeDirs.insert(name); + } else if (strcmp(id, "PackageExcludeFiles") == 0) { + PackageExcludeFiles.insert(name); + } else if (strcmp(id, "DynamicFunctionPrefix") == 0) { + DynamicFunctionPrefixes.push_back(name); + } else if (strcmp(id, "DynamicFunctionPostfix") == 0) { + DynamicFunctionPostfixes.push_back(name); + } else if (strcmp(id, "DynamicMethodPrefix") == 0) { + DynamicMethodPrefixes.push_back(name); + } else if (strcmp(id, "DynamicInvokeFunctions") == 0) { + DynamicInvokeFunctions.insert(name); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Option::isDynamicFunction(bool method, const std::string &name) { + if (method) { + return isDynamic(name, DynamicMethodPrefixes, DynamicMethodPostfixes); + } + return isDynamic(name, DynamicFunctionPrefixes, DynamicFunctionPostfixes); +} + +bool Option::isDynamicClass(const std::string &name) { + return isDynamic(name, DynamicClassPrefixes, DynamicClassPostfixes); +} + +bool Option::isDynamic(const std::string &name, + const std::vector &prefixes, + const std::vector &postfixes) { + if (name.substr(0, 4) == "dyn_") return true; + + for (unsigned int i = 0; i < prefixes.size(); i++) { + const string &prefix = prefixes[i]; + if (name.substr(0, prefix.length()) == prefix) { + return true; + } + } + + for (unsigned int i = 0; i < postfixes.size(); i++) { + const string &postfix = postfixes[i]; + if (name.length() > postfix.length() && + name.substr(name.length() - postfix.length()) == postfix) { + return true; + } + } + + return false; +} + +std::string Option::getAutoloadRoot(const std::string &name) { + for (map::const_iterator iter = AutoloadRoots.begin(); + iter != AutoloadRoots.end(); ++iter) { + if (name.substr(0, iter->first.length()) == iter->first) { + return iter->second; + } + } + return ""; +} + +std::string Option::mangleFilename(const std::string &name, bool id) { + string ret = UserFilePrefix; + ret += name; + + if (id) { + Util::replaceAll(ret, "/", "$"); + Util::replaceAll(ret, "-", "_"); + Util::replaceAll(ret, ".", "_"); + } + return ret; +} + +std::string Option::FormatClusterFile(int index) { + char buf[PATH_MAX]; + snprintf(buf, sizeof(buf), "%s%03d", ClusterPrefix, index); + return buf; +} diff --git a/src/lib/option.h b/src/lib/option.h new file mode 100644 index 0000000000000..6784aefdbed51 --- /dev/null +++ b/src/lib/option.h @@ -0,0 +1,311 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __OPTION_H__ +#define __OPTION_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(VariableTable); +DECLARE_BOOST_TYPES(Expression); +DECLARE_BOOST_TYPES(ExpressionList); + +class Option { +public: + /** + * Directory that has system HPHP files for loading builtin classes, etc. + */ + static std::string GetSystemRoot(); + + /** + * Load options from different sources. + */ + static bool Load(const char *filename); // PHP file + static void Load(Hdf &config); + static void Load(ServerDataPtr server); + + /** + * Directories to add to a package. + */ + static std::string RootDirectory; + static std::set PackageDirectories; + + /** + * Files to add to a package. + */ + static std::set PackageFiles; + + /** + * File path patterns for excluding files from a package scan of programs. + */ + static std::set PackageExcludeDirs; + static std::set PackageExcludeFiles; + + /** + * Whether to store PHP source files in static file cache. + */ + static bool CachePHPFile; + + /** + * Allowed PHP includes that are otherwise found as bad. + */ + static std::set AllowedBadPHPIncludes; + + /** + * Legal root directory expressions in an include expression. For example, + * + * include_once $PHP_ROOT . '/lib.php'; + * + * Here, "$PHP_ROOT" is a legal include root. Stores what it resolves to. + * + * Option::IncludeRoots["$PHP_ROOT"] = ""; + * Option::IncludeRoots["$LIB_ROOT"] = "lib"; + */ + static std::map IncludeRoots; + static std::map AutoloadRoots; + + /** + * PHP include root expression to use when generating PHP trimmed code. + */ + static std::string DefaultIncludeRoot; + + /** + * PHP functions that will take a function name and make a dynamic call. + */ + static std::map DynamicFunctionCalls; + + /** + * Optimization flags + */ + static bool PreOptimization; + static bool PostOptimization; + static bool ScalarArrayOptimization; + static bool ScalarArrayCompression; + static int ScalarArrayFileCount; + static int ScalarArrayOverflowLimit; + static int LiteralStringFileCount; + static bool LiteralStringCompression; + + /** + * RTTI profiling metadata output file + */ + static std::string RTTIOutputFile; + + /** + * Directory of RTTI profiling data, used for second pass compilation + */ + static std::string RTTIDirectory; + + static bool GenRTTIProfileData; + static bool UseRTTIProfileData; + + /** + * Whether to change a method to static if it is called statically + */ + static bool StaticMethodAutoFix; + + /** + * Separate compilation + */ + static bool SeparateCompilation; + static bool SeparateCompLib; + + /** + * CodeGenerator options for PHP. + */ + static bool GeneratePickledPHP; + static bool GenerateInlinedPHP; + static bool GenerateTrimmedPHP; + static bool GenerateInlineComments; // comments on inlined file names + static bool GenerateInferredTypes; // comments on constant/variable tables + static bool ConvertSuperGlobals; // $GLOBALS['var'] => global $var + static bool ConvertQOpExpressions; // $var = $exp ? $yes : $no => if-else + static std::string ProgramPrologue; + static std::string TrimmedPrologue; + static std::vector DynamicFunctionPrefixes; + static std::vector DynamicFunctionPostfixes; + static std::vector DynamicMethodPrefixes; + static std::vector DynamicMethodPostfixes; + static std::vector DynamicClassPrefixes; + static std::vector DynamicClassPostfixes; + static std::set DynamicInvokeFunctions; + + /** + * A somewhat unique prefix for system identifiers. + */ + static std::string IdPrefix; + static std::string LambdaPrefix; + static std::string Tab; + + /** + * Name resolution helpers. + */ + static const char *FunctionPrefix; + static const char *BuiltinFunctionPrefix; + static const char *InvokePrefix; + static const char *CreateObjectPrefix; + static const char *PseudoMainPrefix; + static const char *VariablePrefix; + static const char *GlobalVariablePrefix; + static const char *StaticVariablePrefix; + static const char *ScalarArrayName; + static const char *SystemScalarArrayName; + static const char *ClassPrefix; + static const char *ClassStaticsPrefix; + static const char *ClassStaticsObjectPrefix; + static const char *ClassStaticsIdGetterPrefix; + static const char *ClassStaticInitializerPrefix; + static const char *ClassStaticInitializerFlagPrefix; + static const char *ClassWrapperFunctionPrefix; + static const char *ObjectPrefix; + static const char *ObjectStaticPrefix; + static const char *SmartPtrPrefix; + static const char *MethodPrefix; + static const char *MethodImplPrefix; + static const char *PropertyPrefix; + static const char *StaticPropertyPrefix; + static const char *ConstantPrefix; + static const char *ClassConstantPrefix; + static const char *ExceptionPrefix; + static const char *TempVariablePrefix; + static const char *EvalOrderTempPrefix; + static const char *EvalInvokePrefix; + + static const char *TempPrefix; + static const char *MapPrefix; + static const char *IterPrefix; + static const char *InitPrefix; + + static const char *FFIFnPrefix; + + static const char *SystemFilePrefix; + static const char *UserFilePrefix; + static const char *ClassHeaderPrefix; + static const char *ClusterPrefix; + static const char *FFIFilePrefix; + + /** + * Turn it off for cleaner unit tests. + */ + static bool GenerateCPPMacros; // all macros + static bool GenerateCPPMain; // include and main() + static bool GenerateCPPComments; // section comments + static bool GenerateCPPMetaInfo; // class map + static bool GenerateCPPNameSpace; // namespace HPHP + static bool KeepStatementsWithNoEffect; + + /** + * When we have an include inside a function or a method, how many levels + * do we expand? If 0, we rely on "require" vs. "include" to give explicit + * instructions. If 1, we only inline just one level, and all deeper + * includes are considered as libraries, and they will be moved to top + * level. If -1, we completely disable conditional include handling. + */ + static int ConditionalIncludeExpandLevel; + + /** + * Maximum number of examplar programs to store in each output. + */ + static int DependencyMaxProgram; + static int CodeErrorMaxProgram; + + /** + * Whether or not name matches dynamic function/class prefx/postfix lists. + */ + static bool isDynamicFunction(bool method, const std::string &name); + static bool isDynamicClass(const std::string &name); + + /** + * Whether or not name matches AUTOLOAD files. If not, returns empty. If + * yes, returns root directory for the file. + */ + static std::string getAutoloadRoot(const std::string &name); + + /** + * Turning a file name into an identifier. When id is false, preserve + * "/" in file paths. + */ + static std::string mangleFilename(const std::string &name, bool id); + + /** + * Returns a name for a clustered .cpp file. + */ + static std::string FormatClusterFile(int index); + + static bool GenerateFFI; + + enum EvalLevel { + NoEval = 0, // calling eval is a fatal + LimitedEval = 1, // eval is supported in a limited way with no perf hit + FullEval = 2 // eval is supported but with a performance hit + }; + + static EvalLevel EnableEval; + + /** + * The root package for Java FFI stubs (dot-separated). The default is php. + */ + static std::string JavaFFIRootPackage; + + static std::string ProgramName; + + static bool EnableXHP; + static std::string FlibDirectory; + + static bool AllDynamic; + + /** + * Optimizations + */ + static int InvokeFewArgsCount; + static bool PrecomputeLiteralStrings; + static bool FlattenInvoke; + static int InlineFunctionThreshold; + static bool ControlEvalOrder; + +private: + /** + * Directory that has system HPHP files for loading builtin classes, etc. + */ + static std::string SystemRoot; + + static bool Load(VariableTablePtr variables); + static ExpressionPtr GetValue(VariableTablePtr variables, const char *var); + static bool GetArrayElements(ExpressionPtr value, ExpressionListPtr &out); + static bool Load(bool &option, ExpressionPtr value); + static bool Load(int &option, ExpressionPtr value); + static bool Load(std::string &option, ExpressionPtr value); + static bool Load(std::set &option, ExpressionPtr value); + static bool Load(std::map &option, + ExpressionPtr value); + static bool Load(std::map &option, ExpressionPtr value); + static bool Load(std::vector &option, ExpressionPtr value); + static void LoadRootHdf(const Hdf &roots, std::map &map); + + static bool isDynamic(const std::string &name, + const std::vector &prefixes, + const std::vector &postfixes); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __OPTION_H__ diff --git a/src/lib/package.cpp b/src/lib/package.cpp new file mode 100644 index 0000000000000..0d73eb60f23f4 --- /dev/null +++ b/src/lib/package.cpp @@ -0,0 +1,453 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// +// statics + +void (*Package::m_hookHandler)(Package *package, const char *path, + HphpHookUniqueId id); + +/////////////////////////////////////////////////////////////////////////////// + +Package::Package(const char *root, bool bShortTags /* = true */, + bool bAspTags /* = false */) + : m_bShortTags(bShortTags), m_bAspTags(bAspTags), m_files(4000), + m_lineCount(0), m_charCount(0) { + m_root = root; + if (!m_root.empty() && m_root[m_root.size() - 1] != '/') m_root += "/"; + m_ar = AnalysisResultPtr(new AnalysisResult()); + m_fileCache = FileCachePtr(new FileCache()); +} + +void Package::addAllFiles(bool force) { + if (Option::PackageDirectories.empty() && Option::PackageFiles.empty()) { + addDirectory("/", force); + } else { + for (set::const_iterator iter = Option::PackageDirectories.begin(); + iter != Option::PackageDirectories.end(); ++iter) { + addDirectory(*iter, force); + } + for (set::const_iterator iter = Option::PackageFiles.begin(); + iter != Option::PackageFiles.end(); ++iter) { + addSourceFile((*iter).c_str()); + } + } +} + +void Package::addSourceFile(const char *fileName) { + ASSERT(fileName && *fileName); + m_files.add(fileName); +} + +void Package::addListFiles(const char *listFileName) { + ASSERT(listFileName && *listFileName); + FILE *f = fopen(listFileName, "r"); + if (f == NULL) { + throw Exception("Unable to open %s: %s", listFileName, + Util::safe_strerror(errno).c_str()); + } + char fileName[PATH_MAX]; + while (fgets(fileName, sizeof(fileName), f)) { + int len = strlen(fileName); + if (fileName[len - 1] == '\n') fileName[len-1] = '\0'; + addSourceFile(fileName); + } + fclose(f); +} + +void Package::addStaticFile(const char *fileName) { + ASSERT(fileName && *fileName); + m_extraStaticFiles.insert(fileName); +} + +void Package::addStaticDirectory(const std::string path) { + m_staticDirectories.insert(path); +} + +void Package::addDirectory(const std::string &path, bool force) { + addDirectory(path.c_str(), force); +} + +void Package::addDirectory(const char *path, bool force) { + m_directories.insert(path); + + addDirectory(path, "*.php", force); + addDirectory(path, "*.phpt", force); + addDirectory(path, "", force); // look for PHP files without postfix + + if (m_hookHandler) { + m_hookHandler(this, path, onPackageAddDirectory); + } +} + +void Package::addDependencyParents(const char *path, const char *postfix, + DependencyGraph::KindOf kindOf) { + vector files; + findFiles(files, path, postfix); + DependencyGraphPtr dep = m_ar->getDependencyGraph(); + int rootSize = m_root.size(); + for (unsigned int i = 0; i < files.size(); i++) { + const string &file = files[i]; + ASSERT(file.substr(0, rootSize) == m_root); + dep->addParent(kindOf, "", file.substr(rootSize), ConstructPtr()); + } +} + +void Package::findFiles(std::vector &out, const char *path, + const char *postfix) { + ASSERT(postfix && *postfix); + if (!path) path = ""; + if (*path == '/') path++; + + string fullPath = m_root + path; + const char *argv[] = {"", "-L", (char*)fullPath.c_str(), + "-name", (char*)postfix, NULL}; + string files; + Process::Exec("find", argv, NULL, files); + Util::split('\n', files.c_str(), out, true); +} + +void Package::findPHPFiles(std::vector &out, const char *path) { + if (!path) path = ""; + if (*path == '/') path++; + + string fullPath = m_root + path; + const char *argv[] = {"", "-L", (char*)fullPath.c_str(), + "-type", "f", + "-regex", ".*/[A-Za-z0-9_\\-]+", + "-not", "-regex", ".*/\\.svn/.*", + "-not", "-regex", ".*/\\.git/.*", + "-not", "-regex", ".*/[A-Z]+", + "-not", "-regex", ".*/tags", + + "-exec", "perl", "-n", "-e", + "/php\\s*$/ && print $ARGV.\"\\n\"; exit", + "{}", ";", + + NULL}; + + string files; + Process::Exec("find", argv, NULL, files); + Util::split('\n', files.c_str(), out, true); +} + +void Package::findNonPHPFiles(vector &out, const char *path) { + if (!path) path = ""; + if (*path == '/') path++; + + string fullPath = m_root + path; + DIR *dir = opendir(fullPath.c_str()); + if (dir == NULL) { + Logger::Error("findNonPHPFiles: unable to open directory %s", + fullPath.c_str()); + return; + } + + dirent *e; + while (e = readdir(dir)) { + char *ename = e->d_name; + if (strcmp(ename, ".") == 0 || strcmp(ename, "..") == 0) { + continue; + } + + string fe = fullPath + + (fullPath[fullPath.length() - 1] != '/' ? "/" : "") + ename; + struct stat se; + if (stat(fe.c_str(), &se) != 0) { + // unable to stat, maybe a broken symbolic link + // do not include it + continue; + } + if ((se.st_mode & S_IFMT) == S_IFDIR) { + if (strcmp(ename, ".svn") && strcmp(ename, ".git")) { + string subdir = path; + if (subdir[subdir.length() - 1] != '/') subdir += '/'; + subdir += ename; + findNonPHPFiles(out, subdir.c_str()); + } + continue; + } + + if (strcmp(ename, "tags") == 0) { + continue; + } + size_t len = strlen(ename); + if (len >= 4 && ename[len - 4] == '.' && ename[len - 3] == 'p' && + ename[len - 2] == 'h' && ename[len - 1] == 'p') { + // ending with .php + continue; + } + if (len >= 5 && ename[len - 5] == '.' && ename[len - 4] == 'p' && + ename[len - 3] == 'h' && ename[len - 2] == 'p' && + ename[len - 1] == 't') { + // ending with .phpt + continue; + } + + out.push_back(fe); + } + + closedir(dir); +} + +void Package::addDirectory(const char *path, const char *postfix, bool force) { + ASSERT(path && *path); + if (*path == '/') path++; + + vector files; + if (postfix && *postfix) { + findFiles(files, path, postfix); + } else { + findPHPFiles(files, path); + } + for (unsigned int i = 0; i < files.size(); i++) { + const string &file = files[i]; + bool excluded = false; + if (!force) { + for (set::const_iterator iter = + Option::PackageExcludeDirs.begin(); + iter != Option::PackageExcludeDirs.end(); ++iter) { + if (file.find(*iter) == Option::RootDirectory.size()) { + excluded = true; + break; + } + } + } + if (!excluded) { + ASSERT(file.substr(0, m_root.size()) == m_root); + string name = file.substr(m_root.size()); + if (Option::PackageExcludeFiles.find(name) == + Option::PackageExcludeFiles.end()) { + m_files.add(name.c_str()); + } + } + } +} + +void Package::getFiles(std::vector &files) const { + files.clear(); + files.reserve(m_files.size()); + for (unsigned int i = 0; i < m_files.size(); i++) { + const char *fileName = m_files.at(i); + files.push_back(fileName); + } +} + +FileCachePtr Package::getFileCache() { + for (set::const_iterator iter = m_directories.begin(); + iter != m_directories.end(); ++iter) { + vector files; + findNonPHPFiles(files, iter->c_str()); + for (unsigned int i = 0; i < files.size(); i++) { + string &file = files[i]; + string rpath = file.substr(m_root.size()); + if (!m_fileCache->fileExists(rpath.c_str())) { + Logger::Verbose("saving %s", file.c_str()); + m_fileCache->write(rpath.c_str(), file.c_str()); + } + } + } + for (set::const_iterator iter = m_staticDirectories.begin(); + iter != m_staticDirectories.end(); ++iter) { + vector files; + findNonPHPFiles(files, iter->c_str()); + for (unsigned int i = 0; i < files.size(); i++) { + string &file = files[i]; + string rpath = file.substr(m_root.size()); + if (!m_fileCache->fileExists(rpath.c_str())) { + Logger::Verbose("saving %s", file.c_str()); + m_fileCache->write(rpath.c_str(), file.c_str()); + } + } + } + for (set::const_iterator iter = m_extraStaticFiles.begin(); + iter != m_extraStaticFiles.end(); ++iter) { + const char *file = iter->c_str(); + if (!m_fileCache->fileExists(file)) { + string fullpath = m_root + file; + Logger::Verbose("saving %s", fullpath.c_str()); + m_fileCache->write(file, fullpath.c_str()); + } + } + return m_fileCache; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Package::parse() { + hphp_const_char_set files; + for (unsigned int i = 0; i < m_files.size(); i++) { + const char *fileName = m_files.at(i); + if (files.find(fileName) == files.end()) { + files.insert(fileName); + if (!parseImpl(fileName)) return false; + } + } + return true; +} + +bool Package::parse(const char *fileName) { + return parseImpl(m_files.add(fileName)); +} + +bool Package::parseImpl(const char *fileName) { + ASSERT(fileName); + if (fileName[0] == 0) return false; + + string fullPath; + if (fileName[0] == '/') { + fullPath = fileName; + } else { + fullPath = m_root + fileName; + } + + struct stat sb; + if (stat(fullPath.c_str(), &sb)) { + Logger::Error("Unable to stat file %s", fullPath.c_str()); + return false; + } + + try { + ifstream f(fullPath.c_str()); + stringstream ss; + istream *is = Option::EnableXHP ? preprocessXHP(f, ss, fullPath) : &f; + + Scanner scanner(new ylmm::basic_buffer(*is, false, true), + m_bShortTags, m_bAspTags); + Logger::Info("parsing %s...", fullPath.c_str()); + ParserPtr parser(new Parser(scanner, fileName, sb.st_size, m_ar)); + if (parser->parse()) { + throw Exception("Unable to parse file: %s\n%s", fullPath.c_str(), + parser->getMessage().c_str()); + } + + m_lineCount += parser->line1(); + struct stat fst; + stat(fullPath.c_str(), &fst); + m_charCount += fst.st_size; + + } catch (std::runtime_error) { + Logger::Error("Unable to open file %s", fullPath.c_str()); + return false; + } + + if (!m_fileCache->fileExists(fileName) && + m_extraStaticFiles.find(fileName) == m_extraStaticFiles.end()) { + if (Option::CachePHPFile) { + m_fileCache->write(fileName, fullPath.c_str()); // name + content + } else { + m_fileCache->write(fileName); // just name, without content + } + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +void Package::saveStatsToFile(const char *filename, int totalSeconds) const { + ofstream f(filename); + if (f) { + JSON::OutputStream o(f); + + f << "var FileCount = " << getFileCount() << ";\n" + << "var LineCount = " << getLineCount() << ";\n" + << "var CharCount = " << getCharCount() << ";\n" + << "var FunctionCount = " << m_ar->getFunctionCount() << ";\n" + << "var ClassCount = " << m_ar->getClassCount() << ";\n" + << "var TotalTime = " << totalSeconds << ";\n"; + + if (getLineCount()) { + f << "var AvgCharPerLine = " << (getCharCount()/getLineCount()) << ";\n"; + } + if (m_ar->getFunctionCount()) { + f << "var AvgLinePerFunc = "; + f << (getLineCount()/m_ar->getFunctionCount()) << ";\n"; + } + + std::map counts; + SymbolTable::CountTypes(counts); + m_ar->countReturnTypes(counts); + f << "var SymbolTypes = "; + o << counts; + f << ";\n"; + + f.close(); + } +} + +int Package::saveStatsToDB(ServerDataPtr server, int totalSeconds, + const std::string &branch, int revision) const { + std::map counts; + SymbolTable::CountTypes(counts); + m_ar->countReturnTypes(counts); + ostringstream sout; + JSON::OutputStream o(sout); + o << counts; + + DBConn conn; + conn.open(server); + + const char *sql = "INSERT INTO hphp_run (branch, revision, file, line, " + "byte, program, function, class, types, time)"; + DBQuery q(&conn, sql); + q.insert("'%s', %d, %d, %d, %d, %d, %d, %d, '%s', %d", + branch.c_str(), revision, + getFileCount(), getLineCount(), getCharCount(), + 1, m_ar->getFunctionCount(), + m_ar->getClassCount(), sout.str().c_str(), totalSeconds); + q.execute(); + return conn.getLastInsertId(); +} + +void Package::commitStats(ServerDataPtr server, int runId) const { + DBConn conn; + conn.open(server); + + { + DBQuery q(&conn, "UPDATE hphp_dep"); + q.setField("parent_file = parent"); + q.filterBy("run = %d", runId); + q.filterBy("kind IN ('PHPInclude', 'PHPTemplate')"); + q.execute(); + } + { + DBQuery q(&conn, "UPDATE hphp_run"); + q.setField("committed = 1"); + q.filterBy("id = %d", runId); + q.execute(); + } +} diff --git a/src/lib/package.h b/src/lib/package.h new file mode 100644 index 0000000000000..63362b5b8f3b5 --- /dev/null +++ b/src/lib/package.h @@ -0,0 +1,107 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __PACKAGE_H__ +#define __PACKAGE_H__ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ServerData); +DECLARE_BOOST_TYPES(AnalysisResult); + +/** + * A package contains a list of directories and files that will be parsed + * and analyzed together. No files outside of a package will be considered + * in type inferences. One single AnalysisResult will be generated and it + * contains all classes, functions, variables, constants and their types. + * Therefore, a package is really toppest entry point for parsing. + */ +class Package { + friend class PackageHook; +public: + Package(const char *root, bool bShortTags = true, bool bAspTags = false); + + void addAllFiles(bool force); // add from Option::PackageDirectories/Files + + void addSourceFile(const char *fileName); + void addListFiles(const char *listFileName); + void addStaticFile(const char *fileName); + void addDirectory(const std::string &path, bool force); + void addDirectory(const char *path, bool force); + void addStaticDirectory(const std::string path); + void addDirectory(const char *path, const char *postfix, bool force); + + bool parse(); + bool parse(const char *fileName); + + AnalysisResultPtr getAnalysisResult() { return m_ar;} + int getFileCount() const { return m_files.size();} + int getLineCount() const { return m_lineCount;} + int getCharCount() const { return m_charCount;} + void getFiles(std::vector &files) const; + + void saveStatsToFile(const char *filename, int totalSeconds) const; + int saveStatsToDB(ServerDataPtr server, int totalSeconds, + const std::string &branch, int revision) const; + void commitStats(ServerDataPtr server, int runId) const; + + const std::string& getRoot() const { return m_root;} + FileCachePtr getFileCache(); + + static void setHookHandler(void (*hookHandler)(Package *package, + const char *path, + HphpHookUniqueId id)) { + m_hookHandler = hookHandler; + } + +private: + std::string m_root; + bool m_bShortTags; + bool m_bAspTags; + StringBag m_files; + AnalysisResultPtr m_ar; + int m_lineCount; + int m_charCount; + + FileCachePtr m_fileCache; + std::set m_directories; + std::set m_staticDirectories; + std::set m_extraStaticFiles; + + void findFiles(std::vector &out, const char *path, + const char *postfix); + void findPHPFiles(std::vector &out, const char *path); + void findNonPHPFiles(std::vector &out, const char *path); + void addDependencyParents(const char *path, const char *postfix, + DependencyGraph::KindOf kindOf); + + bool parseImpl(const char *fileName); + + // hook + static void (*m_hookHandler)(Package *package, const char *path, + HphpHookUniqueId id); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __PACKAGE_H__ diff --git a/src/lib/parser/hphp.x b/src/lib/parser/hphp.x new file mode 100644 index 0000000000000..1e5f394c8fdfb --- /dev/null +++ b/src/lib/parser/hphp.x @@ -0,0 +1,692 @@ +%{ +#include +#include +#define YLMM_SCANNER_CLASS HPHP::Scanner +#include +#include +#define SETTOKEN _scanner->setToken(yytext, yyleng, yytext, yyleng) +%} + +%x ST_IN_SCRIPTING +%x ST_DOUBLE_QUOTES +%x ST_BACKQUOTE +%x ST_HEREDOC +%x ST_START_HEREDOC +%x ST_END_HEREDOC +%x ST_LOOKING_FOR_PROPERTY +%x ST_LOOKING_FOR_VARNAME +%x ST_VAR_OFFSET +%x ST_COMMENT +%x ST_DOC_COMMENT +%x ST_ONE_LINE_COMMENT +%option stack + +LNUM [0-9]+ +DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*) +EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) +HNUM "0x"[0-9a-fA-F]+ +LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* +WHITESPACE [ \n\r\t]+ +TABS_AND_SPACES [ \t]* +TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@] +ANY_CHAR (.|[\n]) +NEWLINE ("\r"|"\n"|"\r\n") + +/* + * LITERAL_DOLLAR matches unescaped $ that aren't followed by a label character + * or a { and therefore will be taken literally. The case of literal $ before + * a variable or "${" is handled in a rule for each string type + */ +DOUBLE_QUOTES_LITERAL_DOLLAR ("$"+([^a-zA-Z_\x7f-\xff$"\\{]|("\\"{ANY_CHAR}))) +BACKQUOTE_LITERAL_DOLLAR ("$"+([^a-zA-Z_\x7f-\xff$`\\{]|("\\"{ANY_CHAR}))) +HEREDOC_LITERAL_DOLLAR ("$"+([^a-zA-Z_\x7f-\xff$\n\r\\{]|("\\"[^\n\r]))) +/* + * Usually, HEREDOC_NEWLINE will just function like a simple NEWLINE, but some + * special cases need to be handled. HEREDOC_CHARS doesn't allow a line to + * match when { or $, and/or \ is at the end. (("{"*|"$"*)"\\"?) handles that, + * along with cases where { or $, and/or \ is the ONLY thing on a line + * + * The other case is when a line contains a label, followed by ONLY + * { or $, and/or \ Handled by ({LABEL}";"?((("{"+|"$"+)"\\"?)|"\\")) + */ +HEREDOC_NEWLINE ((({LABEL}";"?((("{"+|"$"+)"\\"?)|"\\"))|(("{"*|"$"*)"\\"?)){NEWLINE}) + +/* + * This pattern is just used in the next 2 for matching { or literal $, and/or + * \ escape sequence immediately at the beginning of a line or after a label + */ +HEREDOC_CURLY_OR_ESCAPE_OR_DOLLAR (("{"+[^$\n\r\\{])|("{"*"\\"[^\n\r])|{HEREDOC_LITERAL_DOLLAR}) + +/* + * These 2 label-related patterns allow HEREDOC_CHARS to continue "regular" + * matching after a newline that starts with either a non-label character or a + * label that isn't followed by a newline. Like HEREDOC_CHARS, they won't match + * a variable or "{$" Matching a newline, and possibly label, up TO a variable + * or "{$", is handled in the heredoc rules + * + * The HEREDOC_LABEL_NO_NEWLINE pattern (";"[^$\n\r\\{]) handles cases where ; + * follows a label. [^a-zA-Z0-9_\x7f-\xff;$\n\r\\{] is needed to prevent a label + * character or ; from matching on a possible (real) ending label + */ +HEREDOC_NON_LABEL ([^a-zA-Z_\x7f-\xff$\n\r\\{]|{HEREDOC_CURLY_OR_ESCAPE_OR_DOLLAR}) +HEREDOC_LABEL_NO_NEWLINE ({LABEL}([^a-zA-Z0-9_\x7f-\xff;$\n\r\\{]|(";"[^$\n\r\\{])|(";"?{HEREDOC_CURLY_OR_ESCAPE_OR_DOLLAR}))) +/* + * CHARS matches everything up to a variable or "{$" + * {'s are matched as long as they aren't followed by a $ + * The case of { before "{$" is handled in a rule for each string type + * + * For heredocs, matching continues across/after newlines if/when it's known + * that the next line doesn't contain a possible ending label + */ +DOUBLE_QUOTES_CHARS ("{"*([^$"\\{]|("\\"{ANY_CHAR}))|{DOUBLE_QUOTES_LITERAL_DOLLAR}) +BACKQUOTE_CHARS ("{"*([^$`\\{]|("\\"{ANY_CHAR}))|{BACKQUOTE_LITERAL_DOLLAR}) +HEREDOC_CHARS ("{"*([^$\n\r\\{]|("\\"[^\n\r]))|{HEREDOC_LITERAL_DOLLAR}|({HEREDOC_NEWLINE}+({HEREDOC_NON_LABEL}|{HEREDOC_LABEL_NO_NEWLINE}))) + +%% + +"exit" {SETTOKEN; return T_EXIT;} +"die" {SETTOKEN; return T_EXIT;} +"function" {SETTOKEN; return T_FUNCTION;} +"const" {SETTOKEN; return T_CONST;} +"return" {SETTOKEN; return T_RETURN;} +"try" {SETTOKEN; return T_TRY;} +"catch" {SETTOKEN; return T_CATCH;} +"throw" {SETTOKEN; return T_THROW;} +"if" {SETTOKEN; return T_IF;} +"elseif" {SETTOKEN; return T_ELSEIF;} +"endif" {SETTOKEN; return T_ENDIF;} +"else" {SETTOKEN; return T_ELSE;} +"while" {SETTOKEN; return T_WHILE;} +"endwhile" {SETTOKEN; return T_ENDWHILE;} +"do" {SETTOKEN; return T_DO;} +"for" {SETTOKEN; return T_FOR;} +"endfor" {SETTOKEN; return T_ENDFOR;} +"foreach" {SETTOKEN; return T_FOREACH;} +"endforeach" {SETTOKEN; return T_ENDFOREACH;} +"declare" {SETTOKEN; return T_DECLARE;} +"enddeclare" {SETTOKEN; return T_ENDDECLARE;} +"instanceof" {SETTOKEN; return T_INSTANCEOF;} +"as" {SETTOKEN; return T_AS;} +"switch" {SETTOKEN; return T_SWITCH;} +"endswitch" {SETTOKEN; return T_ENDSWITCH;} +"case" {SETTOKEN; return T_CASE;} +"default" {SETTOKEN; return T_DEFAULT;} +"break" {SETTOKEN; return T_BREAK;} +"continue" {SETTOKEN; return T_CONTINUE;} +"echo" {SETTOKEN; return T_ECHO;} +"print" {SETTOKEN; return T_PRINT;} +"class" {SETTOKEN; return T_CLASS;} +"interface" {SETTOKEN; return T_INTERFACE;} +"extends" {SETTOKEN; return T_EXTENDS;} +"implements" {SETTOKEN; return T_IMPLEMENTS;} + +^"#HPHP_DECLARE" {SETTOKEN; return T_HPHP_DECLARE;} + +"->" { + SETTOKEN; + yy_push_state(ST_LOOKING_FOR_PROPERTY); + return T_OBJECT_OPERATOR; +} + +"->" { + SETTOKEN; + return T_OBJECT_OPERATOR; +} + +{LABEL} { + SETTOKEN; + yy_pop_state(); + return T_STRING; +} + +{ANY_CHAR} { + yyless(0); + yy_pop_state(); +} + +"::" {SETTOKEN;return T_PAAMAYIM_NEKUDOTAYIM;} +"new" {SETTOKEN;return T_NEW;} +"clone" {SETTOKEN;return T_CLONE;} +"var" {SETTOKEN;return T_VAR;} + +"("{TABS_AND_SPACES}("int"|"integer"){TABS_AND_SPACES}")" { + SETTOKEN; + return T_INT_CAST; +} + +"("{TABS_AND_SPACES}("real"|"double"|"float"){TABS_AND_SPACES}")" { + SETTOKEN; + return T_DOUBLE_CAST; +} + +"("{TABS_AND_SPACES}"string"{TABS_AND_SPACES}")" { + SETTOKEN; + return T_STRING_CAST; +} + +"("{TABS_AND_SPACES}"binary"{TABS_AND_SPACES}")" { + SETTOKEN; + return T_STRING_CAST; +} + +"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" { + SETTOKEN; + return T_ARRAY_CAST; +} + +"("{TABS_AND_SPACES}"object"{TABS_AND_SPACES}")" { + SETTOKEN; + return T_OBJECT_CAST; +} + +"("{TABS_AND_SPACES}("bool"|"boolean"){TABS_AND_SPACES}")" { + SETTOKEN; + return T_BOOL_CAST; +} + +"("{TABS_AND_SPACES}("unset"){TABS_AND_SPACES}")" { + SETTOKEN; + return T_UNSET_CAST; +} + +"eval" {SETTOKEN; return T_EVAL;} +"include" {SETTOKEN; return T_INCLUDE;} +"include_once" {SETTOKEN; return T_INCLUDE_ONCE;} +"require" {SETTOKEN; return T_REQUIRE;} +"require_once" {SETTOKEN; return T_REQUIRE_ONCE;} +"use" {SETTOKEN; return T_USE;} +"global" {SETTOKEN; return T_GLOBAL;} +"isset" {SETTOKEN; return T_ISSET;} +"empty" {SETTOKEN; return T_EMPTY;} +"__halt_compiler" {SETTOKEN; return T_HALT_COMPILER;} +"static" {SETTOKEN; return T_STATIC;} +"abstract" {SETTOKEN; return T_ABSTRACT;} +"final" {SETTOKEN; return T_FINAL;} +"private" {SETTOKEN; return T_PRIVATE;} +"protected" {SETTOKEN; return T_PROTECTED;} +"public" {SETTOKEN; return T_PUBLIC;} +"unset" {SETTOKEN; return T_UNSET;} +"=>" {SETTOKEN; return T_DOUBLE_ARROW;} +"list" {SETTOKEN; return T_LIST;} +"array" {SETTOKEN; return T_ARRAY;} +"++" {SETTOKEN; return T_INC;} +"--" {SETTOKEN; return T_DEC;} +"===" {SETTOKEN; return T_IS_IDENTICAL;} +"!==" {SETTOKEN; return T_IS_NOT_IDENTICAL;} +"==" {SETTOKEN; return T_IS_EQUAL;} +"!="|"<>" {SETTOKEN; return T_IS_NOT_EQUAL;} +"<=" {SETTOKEN; return T_IS_SMALLER_OR_EQUAL;} +">=" {SETTOKEN; return T_IS_GREATER_OR_EQUAL;} +"+=" {SETTOKEN; return T_PLUS_EQUAL;} +"-=" {SETTOKEN; return T_MINUS_EQUAL;} +"*=" {SETTOKEN; return T_MUL_EQUAL;} +"/=" {SETTOKEN; return T_DIV_EQUAL;} +".=" {SETTOKEN; return T_CONCAT_EQUAL;} +"%=" {SETTOKEN; return T_MOD_EQUAL;} +"<<=" {SETTOKEN; return T_SL_EQUAL;} +">>=" {SETTOKEN; return T_SR_EQUAL;} +"&=" {SETTOKEN; return T_AND_EQUAL;} +"|=" {SETTOKEN; return T_OR_EQUAL;} +"^=" {SETTOKEN; return T_XOR_EQUAL;} +"||" {SETTOKEN; return T_BOOLEAN_OR;} +"&&" {SETTOKEN; return T_BOOLEAN_AND;} +"OR" {SETTOKEN; return T_LOGICAL_OR;} +"AND" {SETTOKEN; return T_LOGICAL_AND;} +"XOR" {SETTOKEN; return T_LOGICAL_XOR;} +"<<" {SETTOKEN; return T_SL;} +">>" {SETTOKEN; return T_SR;} +{TOKENS} {SETTOKEN; return yytext[0];} + +"{" { + SETTOKEN; + yy_push_state(ST_IN_SCRIPTING); + return '{'; +} + +"${" { + SETTOKEN; + yy_push_state(ST_LOOKING_FOR_VARNAME); + return T_DOLLAR_OPEN_CURLY_BRACES; +} + +"}" { + SETTOKEN; + if (yy_start_stack_ptr) yy_pop_state(); + return '}'; +} + +{LABEL} { + SETTOKEN; + yy_pop_state(); + yy_push_state(ST_IN_SCRIPTING); + return T_STRING_VARNAME; +} + +{ANY_CHAR} { + yyless(0); + yy_pop_state(); + yy_push_state(ST_IN_SCRIPTING); +} + +{LNUM} { + SETTOKEN; + errno = 0; + long ret = strtoll(yytext, NULL, 0); + if (errno == ERANGE) { + _scanner->error("Dec number is too big: %s", yytext); + return T_LNUMBER; + } + return ret < 0 ? T_DNUMBER : T_LNUMBER; +} + +{HNUM} { + SETTOKEN; + errno = 0; + long ret = strtoull(yytext, NULL, 16); + if (errno == ERANGE) { + _scanner->error("Hex number is too big: %s", yytext); + return T_LNUMBER; + } + return ret < 0 ? T_DNUMBER : T_LNUMBER; +} + +0|([1-9][0-9]*) { /* Offset could be treated as a long */ + SETTOKEN; + errno = 0; + strtoll(yytext, NULL, 0); + if (errno == ERANGE) { + _scanner->error("Offset number is too big: %s", yytext); + } + return T_NUM_STRING; +} + +{LNUM}|{HNUM} { /* Offset must be treated as a string */ + SETTOKEN; + return T_NUM_STRING; +} + +{DNUM}|{EXPONENT_DNUM} { + SETTOKEN; + return T_DNUMBER; +} + +"__CLASS__" { SETTOKEN; return T_CLASS_C; } +"__FUNCTION__" { SETTOKEN; return T_FUNC_C; } +"__METHOD__" { SETTOKEN; return T_METHOD_C;} +"__LINE__" { SETTOKEN; return T_LINE; } +"__FILE__" { SETTOKEN; return T_FILE; } + +"#"[^\n]*"\n" { + SETTOKEN; + return T_INLINE_HTML; +} + +(([^<]|"<"[^?%s<]){1,400})|""" { + SETTOKEN; + if (_scanner->shortTags() || yyleng > 2) { + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG; + } else { + return T_INLINE_HTML; + } +} + +"<%="|"aspTags()) || + (yytext[1]=='?' && _scanner->shortTags())) { + BEGIN(ST_IN_SCRIPTING); + return T_ECHO; //return T_OPEN_TAG_WITH_ECHO; + } else { + return T_INLINE_HTML; + } +} + +"<%" { + SETTOKEN; + if (_scanner->aspTags()) { + BEGIN(ST_IN_SCRIPTING); + return T_OPEN_TAG; + } else { + return T_INLINE_HTML; + } +} + +""$"{LABEL} { + _scanner->setToken(yytext, yyleng, yytext+1, yyleng-1); + return T_VARIABLE; +} + +"$"{LABEL}"->"[a-zA-Z_\x7f-\xff] { + yyless(yyleng - 3); + yy_push_state(ST_LOOKING_FOR_PROPERTY); + _scanner->setToken(yytext, yyleng, yytext+1, yyleng-1); + return T_VARIABLE; +} + +"$"{LABEL}"[" { + yyless(yyleng - 1); + yy_push_state(ST_VAR_OFFSET); + _scanner->setToken(yytext, yyleng, yytext+1, yyleng-1); + return T_VARIABLE; +} + +"]" { + yy_pop_state(); + return ']'; +} + +{TOKENS}|[{}"`] { + /* Only '[' can be valid, but returning other tokens will allow + a more explicit parse error */ + return yytext[0]; +} + +[ \n\r\t\\'#] { + /* Invalid rule to return a more explicit parse error with proper + line number */ + yyless(0); + yy_pop_state(); + return T_ENCAPSED_AND_WHITESPACE; +} + +{LABEL} { + SETTOKEN; + return T_STRING; +} + +{WHITESPACE} { + SETTOKEN; + return T_WHITESPACE; +} + +"#"|"//" { + BEGIN(ST_ONE_LINE_COMMENT); + yymore(); +} + +"?"|"%"|">" { + yymore(); +} + +[^\n\r?%>]*{ANY_CHAR} { + switch (yytext[yyleng-1]) { + case '?': + case '%': + case '>': + yyless(yyleng-1); + yymore(); + break; + default: + SETTOKEN; + BEGIN(ST_IN_SCRIPTING); + return T_COMMENT; + } +} + +{NEWLINE} { + SETTOKEN; + BEGIN(ST_IN_SCRIPTING); + return T_COMMENT; +} + +"?>"|"%>" { + if (_scanner->aspTags() || yytext[yyleng-2] != '%') { + _scanner->setToken(yytext, yyleng-2, yytext, yyleng-2); + yyless(yyleng-2); + BEGIN(ST_IN_SCRIPTING); + return T_COMMENT; + } else { + yymore(); + } +} + +"/**"{WHITESPACE} { + BEGIN(ST_DOC_COMMENT); + yymore(); +} + +"/*" { + BEGIN(ST_COMMENT); + yymore(); +} + +[^*]+ { + yymore(); +} + +"*/" { + SETTOKEN; + BEGIN(ST_IN_SCRIPTING); + return T_DOC_COMMENT; +} + +"*/" { + SETTOKEN; + BEGIN(ST_IN_SCRIPTING); +#ifdef HPHP_NOTE + if (yyleng > 6 && yytext[2] == '|' && yytext[yyleng-3] == '|') { + _scanner->setToken(yytext, yyleng, yytext+3, yyleng-6); + return T_HPHP_NOTE; + } +#endif + return T_COMMENT; +} + +"*" { + yymore(); +} + +("?>"|""){NEWLINE}? { + SETTOKEN; + BEGIN(INITIAL); + return ';'; //return T_CLOSE_TAG; +} + +"%>"{NEWLINE}? { + if (_scanner->aspTags()) { + SETTOKEN; + BEGIN(INITIAL); + return ';'; //return T_CLOSE_TAG; + } else { + yyless(1); + _scanner->setToken(yytext, 1, yytext, 1); + return yytext[0]; + } +} + +(b?["]{DOUBLE_QUOTES_CHARS}*("{"*|"$"*)["]) { + int bprefix = (yytext[0] != '"') ? 1 : 0; + std::string strval = + _scanner->scanEscapeString(yytext + bprefix + 1, + yyleng - bprefix - 2, '"'); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_CONSTANT_ENCAPSED_STRING; +} + +(b?[']([^'\\]|("\\"{ANY_CHAR}))*[']) { + int bprefix = (yytext[0] != '\'') ? 1 : 0; + std::string strval = + _scanner->scanEscapeString(yytext + bprefix + 1, + yyleng - bprefix - 2, '\''); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_CONSTANT_ENCAPSED_STRING; +} + +b?["] { + int bprefix = (yytext[0] != '"') ? 1 : 0; + _scanner->setToken(yytext, yyleng, yytext + bprefix, yyleng - bprefix); + BEGIN(ST_DOUBLE_QUOTES); + return '\"'; +} + +b?"<<<"{TABS_AND_SPACES}{LABEL}{NEWLINE} { + int bprefix = (yytext[0] != '<') ? 1 : 0; + int label_len = yyleng-bprefix-3-1-(yytext[yyleng-2]=='\r'?1:0); + char *s = yytext+bprefix+3; + while ((*s == ' ') || (*s == '\t')) { + s++; + label_len--; + } + _scanner->setHeredocLabel(s, label_len); + _scanner->setToken(yytext, yyleng, s, label_len); + BEGIN(ST_HEREDOC); + return T_START_HEREDOC; +} + +[`] { + SETTOKEN; + BEGIN(ST_BACKQUOTE); + return '`'; +} + +{ANY_CHAR} { + yyless(0); + BEGIN(ST_HEREDOC); +} + +{LABEL}";"?[\n\r] { + int label_len = yyleng-1; + if (yytext[label_len-1]==';') { + label_len--; + } + if (label_len == _scanner->getHeredocLabelLen() && + !memcmp(yytext, _scanner->getHeredocLabel(), label_len)) { + _scanner->setToken(yytext, label_len, yytext, label_len); + yyless(label_len); + _scanner->resetHeredoc(); + BEGIN(ST_IN_SCRIPTING); + return T_END_HEREDOC; + } else { + yymore(); + BEGIN(ST_HEREDOC); + } +} + +{HEREDOC_CHARS}*{HEREDOC_NEWLINE}+{LABEL}";"?[\n\r] { + char *end = yytext + yyleng - 1; + + if (end[-1] == ';') { + end--; + yyleng--; + } + int heredocLen = _scanner->getHeredocLabelLen(); + if (yyleng > heredocLen && + !memcmp(end - heredocLen, _scanner->getHeredocLabel(), + heredocLen)) { + int len = yyleng - heredocLen - 2; + /* 2 for newline before and after label */ + if (len > 0 && + yytext[len - 1] == '\r' && yytext[len] == '\n') { + len--; + } + yyless(yyleng - 2); + yyleng -= heredocLen - 1; + std::string strval = + _scanner->scanEscapeString(yytext, len, 0); + _scanner->setToken(yytext, yyleng, + strval.c_str(), strval.length()); + BEGIN(ST_END_HEREDOC); + return T_ENCAPSED_AND_WHITESPACE; + } else { + /* Go back to end of label, so the next match works correctly in + * case of a variable or another label at the beginning of the + * next line + */ + yyless(yyleng - 1); + yymore(); + } +} + +{ANY_CHAR} { + BEGIN(ST_IN_SCRIPTING); + SETTOKEN; + return T_END_HEREDOC; +} + +"{$" { + _scanner->setToken(yytext, 1, yytext, 1); + yy_push_state(ST_IN_SCRIPTING); + yyless(1); + return T_CURLY_OPEN; +} + +{DOUBLE_QUOTES_CHARS}+ { + std::string strval = _scanner->scanEscapeString(yytext, yyleng, '"'); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +{DOUBLE_QUOTES_CHARS}*("{"{2,}|"$"{2,}|(("{"+|"$"+)["])) { + yyless(yyleng - 1); + std::string strval = _scanner->scanEscapeString(yytext, yyleng, '"'); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +{BACKQUOTE_CHARS}+ { + std::string strval = _scanner->scanEscapeString(yytext, yyleng, '`'); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +{BACKQUOTE_CHARS}*("{"{2,}|"$"{2,}|(("{"+|"$"+)[`])) { + yyless(yyleng - 1); + std::string strval = _scanner->scanEscapeString(yytext, yyleng, '`'); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +{HEREDOC_CHARS}*({HEREDOC_NEWLINE}+({LABEL}";"?)?)? { + std::string strval = _scanner->scanEscapeString(yytext, yyleng, 0); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +{HEREDOC_CHARS}*({HEREDOC_NEWLINE}+({LABEL}";"?)?)?("{"{2,}|"$"{2,}) { + yyless(yyleng - 1); + std::string strval = _scanner->scanEscapeString(yytext, yyleng, 0); + _scanner->setToken(yytext, yyleng, strval.c_str(), strval.length()); + return T_ENCAPSED_AND_WHITESPACE; +} + +["] { + BEGIN(ST_IN_SCRIPTING); + return '"'; +} + +[`] { + BEGIN(ST_IN_SCRIPTING); + return '`'; +} + +<> { + _scanner->error("Unterminated comment at end of file"); + return 0; +} + +{ANY_CHAR} { + _scanner->error("Unexpected character in input: '%c' (ASCII=%d)", + yytext[0], yytext[0]); +} + +%% +void _scanner_init() { + BEGIN(INITIAL); +} +void suppress_defined_but_not_used_warnings() { + yy_fatal_error(0); + yyunput(0, 0); + yy_top_state(); +} diff --git a/src/lib/parser/hphp.y b/src/lib/parser/hphp.y new file mode 100644 index 0000000000000..7652a00b8c526 --- /dev/null +++ b/src/lib/parser/hphp.y @@ -0,0 +1,867 @@ +%{ +#include + +using namespace HPHP; + +#define YYSTYPE Token +#define YLMM_PARSER_CLASS Parser +#define YLMM_LEX_STATIC +#define YYERROR_VERBOSE +#define YYINITDEPTH 500 +#include + +#define _p _parser +#define BEXP(e...) _parser->onBinaryOpExp(e); +#define UEXP(e...) _parser->onUnaryOpExp(e); +%} + +%expect 2 + +%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 +%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 +%left '?' ':' +%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 '[' +%left T_HPHP_NOTE + +%nonassoc T_NEW T_CLONE +%token T_EXIT +%token T_IF +%left T_ELSEIF +%left T_ELSE +%left T_ENDIF +%token T_LNUMBER +%token T_DNUMBER +%token T_STRING +%token T_STRING_VARNAME +%token T_VARIABLE +%token T_NUM_STRING +%token T_INLINE_HTML +%token T_CHARACTER +%token T_BAD_CHARACTER +%token T_ENCAPSED_AND_WHITESPACE +%token T_CONSTANT_ENCAPSED_STRING +%token T_ECHO +%token T_DO +%token T_WHILE +%token T_ENDWHILE +%token T_FOR +%token T_ENDFOR +%token T_FOREACH +%token T_ENDFOREACH +%token T_DECLARE +%token T_ENDDECLARE +%token T_AS +%token T_SWITCH +%token T_ENDSWITCH +%token T_CASE +%token T_DEFAULT +%token T_BREAK +%token T_CONTINUE +%token T_FUNCTION +%token T_CONST +%token T_RETURN +%token T_TRY +%token T_CATCH +%token T_THROW +%token T_USE +%token T_GLOBAL +%right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC +%token T_VAR +%token T_UNSET +%token T_ISSET +%token T_EMPTY +%token T_HALT_COMPILER +%token T_CLASS +%token T_INTERFACE +%token T_EXTENDS +%token T_IMPLEMENTS +%token T_OBJECT_OPERATOR +%token T_DOUBLE_ARROW +%token T_LIST +%token T_ARRAY +%token T_CLASS_C +%token T_METHOD_C +%token T_FUNC_C +%token T_LINE +%token T_FILE +%token T_COMMENT +%token T_DOC_COMMENT +%token T_OPEN_TAG +%token T_OPEN_TAG_WITH_ECHO +%token T_CLOSE_TAG +%token T_WHITESPACE +%token T_START_HEREDOC +%token T_END_HEREDOC +%token T_DOLLAR_OPEN_CURLY_BRACES +%token T_CURLY_OPEN +%token T_PAAMAYIM_NEKUDOTAYIM + +%token T_HPHP_NOTE +%token T_HPHP_DECLARE + +%% + +start: + top_statement_list { _p->saveParseTree(&$$);} +; + +top_statement_list: + top_statement_list + top_statement { _p->addStatement(&$$,&$1,&$2);} + | { $$.reset();} +; +top_statement: + statement { $$ = $1;} + | function_declaration_statement { $$ = $1;} + | class_declaration_statement { $$ = $1;} + | T_HPHP_NOTE function_declaration_statement + { _p->onHphpNoteStatement(&$$,&$1,&$2);} + | T_HPHP_NOTE class_declaration_statement + { _p->onHphpNoteStatement(&$$,&$1,&$2);} + | T_HALT_COMPILER '(' ')' ';' { $$.reset();} + | T_HPHP_DECLARE hphp_declare_list ';' + { $$.reset(); } +; +hphp_declare_list: + hphp_declare_list ',' hphp_declare + { $$.reset();} + | hphp_declare { $$.reset();} +; +hphp_declare: + '@' T_STRING { _p->addHphpSuppressError(&$2);} + | T_STRING { _p->addHphpDeclare(&$1);} +; +inner_statement_list: + inner_statement_list + inner_statement { _p->addStatement(&$$,&$1,&$2);} + | { $$.reset();} +; +inner_statement: + statement { $$ = $1;} + | function_declaration_statement { $$ = $1;} + | class_declaration_statement { $$ = $1;} + | T_HPHP_NOTE function_declaration_statement + { _p->onHphpNoteStatement(&$$,&$1,&$2);} + | T_HPHP_NOTE class_declaration_statement + { _p->onHphpNoteStatement(&$$,&$1,&$2);} +; +statement: + expr ';' { _p->onExpStatement(&$$, &$1);} + | statement_without_expr { $$ = $1;} + | T_HPHP_NOTE statement_without_expr { _p->onHphpNoteStatement(&$$,&$1,&$2);} + +statement_without_expr: + '{' inner_statement_list '}' { _p->onBlock(&$$, &$2);} + + | T_IF '(' expr ')' + statement + elseif_list + else_single { _p->onIf(&$$,&$3,&$5,&$6,&$7);} + + | T_IF '(' expr ')' ':' + inner_statement_list + new_elseif_list + new_else_single + T_ENDIF ';' { _p->onIf(&$$,&$3,&$6,&$7,&$8);} + + | T_WHILE '(' expr ')' + while_statement { _p->onWhile(&$$,&$3,&$5);} + + | T_DO statement + T_WHILE '(' expr ')' ';' { _p->onDo(&$$,&$2,&$5);} + + | T_FOR '(' for_expr ';' + for_expr ';' for_expr ')' + for_statement { _p->onFor(&$$,&$3,&$5,&$7,&$9);} + + | T_SWITCH '(' expr ')' + switch_case_list { _p->onSwitch(&$$,&$3,&$5);} + + | T_BREAK ';' { _p->onBreak(&$$, NULL);} + | T_BREAK expr ';' { _p->onBreak(&$$, &$2);} + + | T_CONTINUE ';' { _p->onContinue(&$$, NULL);} + | T_CONTINUE expr ';' { _p->onContinue(&$$, &$2);} + + | T_RETURN ';' { _p->onReturn(&$$, NULL);} + | T_RETURN expr_without_variable ';' { _p->onReturn(&$$, &$2);} + | T_RETURN variable ';' { _p->onReturn(&$$, &$2);} + + | T_GLOBAL global_var_list ';' { _p->onGlobal(&$$, &$2);} + | T_STATIC static_var_list ';' { _p->onStatic(&$$, &$2);} + | T_ECHO echo_expr_list ';' { _p->onEcho(&$$, &$2, 0);} + | T_UNSET '(' unset_variables ')' + ';' { _p->onUnset(&$$, &$3);} + | ';' { $$.reset();} + + | T_INLINE_HTML { _p->onEcho(&$$, &$1, 1);} + + | T_FOREACH '(' variable + T_AS foreach_variable + foreach_optional_arg ')' + foreach_statement { _p->onForEach(&$$,&$3,&$5,&$6,&$8);} + + | T_FOREACH '(' expr_without_variable + T_AS variable + foreach_optional_arg ')' + foreach_statement { _p->onForEach(&$$,&$3,&$5,&$6,&$8);} + + | T_DECLARE '(' declare_list ')' + declare_statement { _p->onBlock(&$$, &$5);} + + | T_TRY '{' inner_statement_list '}' + T_CATCH '(' + fully_qualified_class_name + T_VARIABLE ')' + '{' inner_statement_list '}' + additional_catches { _p->onTry(&$$,&$3,&$7,&$8,&$11,&$13);} + + | T_THROW expr ';' { _p->onThrow(&$$, &$2);} +; + +additional_catches: + non_empty_additional_catches { $$ = $1;} + | { $$.reset();} +; +non_empty_additional_catches: + additional_catch { _p->addStatement(&$$, NULL, &$1);} + | non_empty_additional_catches + additional_catch { _p->addStatement(&$$, &$1, &$2);} +; +additional_catch: + T_CATCH '(' + fully_qualified_class_name + T_VARIABLE ')' + '{' inner_statement_list '}' { _p->onCatch(&$$, &$3, &$4, &$7);} +; + +unset_variables: + unset_variable { _p->onExprListElem(&$$, NULL, &$1);} + | unset_variables ',' unset_variable { _p->onExprListElem(&$$, &$1, &$3);} +; +unset_variable: + variable { $$ = $1;} +; + +is_reference: + '&' { $$ = 1;} + | { $$.reset();} +; + +function_declaration_statement: + T_FUNCTION is_reference T_STRING { _p->onFunctionStart();} + '(' parameter_list ')' + '{' inner_statement_list '}' { _p->onFunction(&$$,&$2,&$3,&$6,&$9);} +; + +class_declaration_statement: + class_entry_type T_STRING { _p->onClassStart();} + extends_from + implements_list '{' + class_statement_list '}' { _p->onClass(&$$,&$1,&$2,&$4,&$5,&$7);} + + | T_INTERFACE T_STRING { _p->onClassStart();} + interface_extends_list '{' + class_statement_list '}' { _p->onInterface(&$$,&$2,&$4,&$6);} +; +class_entry_type: + T_CLASS { $$ = T_CLASS;} + | T_ABSTRACT T_CLASS { $$ = T_ABSTRACT;} + | T_FINAL T_CLASS { $$ = T_FINAL;} +; +extends_from: + T_EXTENDS + fully_qualified_class_name { $$ = $2;} + | { $$.reset();} +; +implements_list: + T_IMPLEMENTS interface_list { $$ = $2;} + | { $$.reset();} +; +interface_extends_list: + T_EXTENDS interface_list { $$ = $2;} + | { $$.reset();} +; +interface_list: + fully_qualified_class_name { _p->onInterfaceName(&$$, NULL, &$1);} + | interface_list ',' + fully_qualified_class_name { _p->onInterfaceName(&$$, &$1, &$3);} +; + +foreach_optional_arg: + T_DOUBLE_ARROW foreach_variable { $$ = $2;} + | { $$.reset();} +; +foreach_variable: + variable { $$ = $1;} + | '&' variable { $$ = $2; $$ = 1;} +; + +for_statement: + statement { $$ = $1;} + | ':' inner_statement_list + T_ENDFOR ';' { $$ = $2;} +; +foreach_statement: + statement { $$ = $1;} + | ':' inner_statement_list + T_ENDFOREACH ';' { $$ = $2;} +; +while_statement: + statement { $$ = $1;} + | ':' inner_statement_list + T_ENDWHILE ';' { $$ = $2;} +; +declare_statement: + statement { $$ = $1;} + | ':' inner_statement_list + T_ENDDECLARE ';' { $$ = $2;} +; + +declare_list: + T_STRING '=' static_scalar + | declare_list ',' + T_STRING '=' static_scalar +; + +switch_case_list: + '{' case_list '}' { $$ = $2;} + | '{' ';' case_list '}' { $$ = $3;} + | ':' case_list T_ENDSWITCH ';' { $$ = $2;} + | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3;} +; +case_list: + case_list T_CASE expr + case_separator + inner_statement_list { _p->onCase(&$$,&$1,&$3,&$5);} + | case_list T_DEFAULT case_separator + inner_statement_list { _p->onCase(&$$,&$1,NULL,&$4);} + | { $$.reset();} +; +case_separator: + ':' { $$.reset();} + | ';' { $$.reset();} +; + +elseif_list: + elseif_list T_ELSEIF '(' expr ')' + statement { _p->onElseIf(&$$,&$1,&$4,&$6);} + | { $$.reset();} +; +new_elseif_list: + new_elseif_list T_ELSEIF + '(' expr ')' ':' + inner_statement_list { _p->onElseIf(&$$,&$1,&$4,&$7);} + | { $$.reset();} +; +else_single: + T_ELSE statement { $$ = $2;} + | { $$.reset();} +; +new_else_single: + T_ELSE ':' inner_statement_list { $$ = $3;} + | { $$.reset();} +; + +parameter_list: + non_empty_parameter_list { $$ = $1;} + | { $$.reset();} +; +non_empty_parameter_list: + optional_class_type T_VARIABLE { _p->onParam(&$$,NULL,&$1,&$2,0,NULL);} + | optional_class_type '&' T_VARIABLE { _p->onParam(&$$,NULL,&$1,&$3,1,NULL);} + | optional_class_type '&' T_VARIABLE + '=' static_scalar { _p->onParam(&$$,NULL,&$1,&$3,1,&$5);} + | optional_class_type T_VARIABLE + '=' static_scalar { _p->onParam(&$$,NULL,&$1,&$2,0,&$4);} + | non_empty_parameter_list ',' + optional_class_type T_VARIABLE { _p->onParam(&$$,&$1,&$3,&$4,0,NULL);} + | non_empty_parameter_list ',' + optional_class_type '&' T_VARIABLE { _p->onParam(&$$,&$1,&$3,&$5,1,NULL);} + | non_empty_parameter_list ',' + optional_class_type '&' T_VARIABLE + '=' static_scalar { _p->onParam(&$$,&$1,&$3,&$5,1,&$7);} + | non_empty_parameter_list ',' + optional_class_type T_VARIABLE + '=' static_scalar { _p->onParam(&$$,&$1,&$3,&$4,0,&$6);} +; +optional_class_type: + T_STRING { $$ = $1;} + | T_ARRAY { $$.text = "array";} + | { $$.reset();} +; + +function_call_parameter_list: + non_empty_fcall_parameter_list { $$ = $1;} + | { $$.reset();} +; +non_empty_fcall_parameter_list: + expr_without_variable { _p->onCallParam(&$$,NULL,&$1,0);} + | variable { _p->onCallParam(&$$,NULL,&$1,0);} + | '&' w_variable { _p->onCallParam(&$$,NULL,&$2,1);} + | non_empty_fcall_parameter_list ',' + expr_without_variable { _p->onCallParam(&$$,&$1,&$3,0);} + | non_empty_fcall_parameter_list ',' + variable { _p->onCallParam(&$$,&$1,&$3,0);} + | non_empty_fcall_parameter_list ',' + '&' w_variable { _p->onCallParam(&$$,&$1,&$4,1);} +; + +global_var_list: + global_var_list ',' global_var { _p->onGlobalVar(&$$, &$1, &$3);} + | global_var { _p->onGlobalVar(&$$, NULL, &$1);} +; +global_var: + T_VARIABLE { $$ = $1;} + | '$' r_variable { $$ = $2; $$ = 1;} + | '$' '{' expr '}' { $$ = $3; $$ = 1;} +; + +static_var_list: + static_var_list ',' T_VARIABLE { _p->onVariable(&$$,&$1,&$3,0);} + | static_var_list ',' T_VARIABLE + '=' static_scalar { _p->onVariable(&$$,&$1,&$3,&$5);} + | T_VARIABLE { _p->onVariable(&$$,0,&$1,0);} + | T_VARIABLE '=' static_scalar { _p->onVariable(&$$,0,&$1,&$3);} +; + +class_statement_list: + class_statement_list + class_statement { _p->addStatement(&$$, &$1, &$2);} + | { $$.reset();} +; +class_statement: + variable_modifiers + class_variable_declaration ';' { _p->onClassVariable(&$$,&$1,&$2);} + | class_constant_declaration ';' { _p->onClassVariable(&$$,NULL,&$1);} + | method_modifiers T_FUNCTION + is_reference T_STRING '(' { _p->onFunctionStart();} + parameter_list ')' method_body { _p->onMethod(&$$,&$1,&$3,&$4,&$7, + &$9);} + | T_HPHP_NOTE + method_modifiers T_FUNCTION + is_reference T_STRING '(' { _p->onFunctionStart();} + parameter_list ')' method_body { _p->onMethod(&$$,&$2,&$4,&$5,&$8, + &$10); + _p->onHphpNoteStatement(&$$,&$1,&$$);} +; +method_body: + ';' { $$.reset();} + | '{' inner_statement_list '}' { _p->finishStatement(&$$, &$2); + $$ = 1;} +; +variable_modifiers: + non_empty_member_modifiers { $$ = $1;} + | T_VAR { $$.reset();} +; +method_modifiers: + non_empty_member_modifiers { $$ = $1;} + | { $$.reset();} +; +non_empty_member_modifiers: + member_modifier { _p->onMemberModifier(&$$,NULL,&$1);} + | non_empty_member_modifiers + member_modifier { _p->onMemberModifier(&$$,&$1,&$2);} +; +member_modifier: + T_PUBLIC { $$ = T_PUBLIC;} + | T_PROTECTED { $$ = T_PROTECTED;} + | T_PRIVATE { $$ = T_PRIVATE;} + | T_STATIC { $$ = T_STATIC;} + | T_ABSTRACT { $$ = T_ABSTRACT;} + | T_FINAL { $$ = T_FINAL;} +; +class_variable_declaration: + class_variable_declaration ',' + T_VARIABLE { _p->onVariable(&$$,&$1,&$3,0);} + | class_variable_declaration ',' + T_VARIABLE '=' static_scalar { _p->onVariable(&$$,&$1,&$3,&$5);} + | T_VARIABLE { _p->onVariable(&$$,0,&$1,0);} + | T_VARIABLE '=' static_scalar { _p->onVariable(&$$,0,&$1,&$3);} +; +class_constant_declaration: + class_constant_declaration ',' + T_STRING '=' static_scalar { _p->onVariable(&$$,&$1,&$3,&$5,1);} + | T_CONST T_STRING '=' static_scalar { _p->onVariable(&$$,0,&$2,&$4,1);} +; + +echo_expr_list: + echo_expr_list ',' expr { _p->onExprListElem(&$$, &$1, &$3);} + | expr { _p->onExprListElem(&$$, NULL, &$1);} +; + +for_expr: + non_empty_for_expr { $$ = $1;} + | { $$.reset();} +; +non_empty_for_expr: + non_empty_for_expr ',' expr { _p->onExprListElem(&$$, &$1, &$3);} + | expr { _p->onExprListElem(&$$, NULL, &$1);} +; + +expr_without_variable: + T_LIST '(' assignment_list ')' + '=' expr { _p->onListAssignment(&$$, &$3, &$6);} + | variable '=' expr { _p->onAssign(&$$, &$1, &$3, 0);} + | variable '=' '&' variable { _p->onAssign(&$$, &$1, &$4, 1);} + | variable '=' '&' T_NEW + class_name_reference + ctor_arguments { _p->onAssignNew(&$$,&$1,&$5,&$6);} + | T_NEW class_name_reference + ctor_arguments { _p->onNewObject(&$$, &$2, &$3);} + | T_CLONE expr { UEXP(&$$,&$2,T_CLONE,1);} + | variable T_PLUS_EQUAL expr { BEXP(&$$,&$1,&$3,T_PLUS_EQUAL);} + | variable T_MINUS_EQUAL expr { BEXP(&$$,&$1,&$3,T_MINUS_EQUAL);} + | variable T_MUL_EQUAL expr { BEXP(&$$,&$1,&$3,T_MUL_EQUAL);} + | variable T_DIV_EQUAL expr { BEXP(&$$,&$1,&$3,T_DIV_EQUAL);} + | variable T_CONCAT_EQUAL expr { BEXP(&$$,&$1,&$3,T_CONCAT_EQUAL);} + | variable T_MOD_EQUAL expr { BEXP(&$$,&$1,&$3,T_MOD_EQUAL);} + | variable T_AND_EQUAL expr { BEXP(&$$,&$1,&$3,T_AND_EQUAL);} + | variable T_OR_EQUAL expr { BEXP(&$$,&$1,&$3,T_OR_EQUAL);} + | variable T_XOR_EQUAL expr { BEXP(&$$,&$1,&$3,T_XOR_EQUAL);} + | variable T_SL_EQUAL expr { BEXP(&$$,&$1,&$3,T_SL_EQUAL);} + | variable T_SR_EQUAL expr { BEXP(&$$,&$1,&$3,T_SR_EQUAL);} + | rw_variable T_INC { UEXP(&$$,&$1,T_INC,0);} + | T_INC rw_variable { UEXP(&$$,&$2,T_INC,1);} + | rw_variable T_DEC { UEXP(&$$,&$1,T_DEC,0);} + | T_DEC rw_variable { UEXP(&$$,&$2,T_DEC,1);} + | expr T_BOOLEAN_OR expr { BEXP(&$$,&$1,&$3,T_BOOLEAN_OR);} + | expr T_BOOLEAN_AND expr { BEXP(&$$,&$1,&$3,T_BOOLEAN_AND);} + | expr T_LOGICAL_OR expr { BEXP(&$$,&$1,&$3,T_LOGICAL_OR);} + | expr T_LOGICAL_AND expr { BEXP(&$$,&$1,&$3,T_LOGICAL_AND);} + | expr T_LOGICAL_XOR expr { BEXP(&$$,&$1,&$3,T_LOGICAL_XOR);} + | expr '|' expr { BEXP(&$$,&$1,&$3,'|');} + | expr '&' expr { BEXP(&$$,&$1,&$3,'&');} + | expr '^' expr { BEXP(&$$,&$1,&$3,'^');} + | expr '.' expr { BEXP(&$$,&$1,&$3,'.');} + | expr '+' expr { BEXP(&$$,&$1,&$3,'+');} + | expr '-' expr { BEXP(&$$,&$1,&$3,'-');} + | expr '*' expr { BEXP(&$$,&$1,&$3,'*');} + | expr '/' expr { BEXP(&$$,&$1,&$3,'/');} + | expr '%' expr { BEXP(&$$,&$1,&$3,'%');} + | expr T_SL expr { BEXP(&$$,&$1,&$3,T_SL);} + | expr T_SR expr { BEXP(&$$,&$1,&$3,T_SR);} + | '+' expr %prec T_INC { UEXP(&$$,&$2,'+',1);} + | '-' expr %prec T_INC { UEXP(&$$,&$2,'-',1);} + | '!' expr { UEXP(&$$,&$2,'!',1);} + | '~' expr { UEXP(&$$,&$2,'~',1);} + | expr T_IS_IDENTICAL expr { BEXP(&$$,&$1,&$3,T_IS_IDENTICAL);} + | expr T_IS_NOT_IDENTICAL expr { BEXP(&$$,&$1,&$3,T_IS_NOT_IDENTICAL);} + | expr T_IS_EQUAL expr { BEXP(&$$,&$1,&$3,T_IS_EQUAL);} + | expr T_IS_NOT_EQUAL expr { BEXP(&$$,&$1,&$3,T_IS_NOT_EQUAL);} + | expr '<' expr { BEXP(&$$,&$1,&$3,'<');} + | expr T_IS_SMALLER_OR_EQUAL expr { BEXP(&$$,&$1,&$3, + T_IS_SMALLER_OR_EQUAL);} + | expr '>' expr { BEXP(&$$,&$1,&$3,'>');} + | expr T_IS_GREATER_OR_EQUAL expr { BEXP(&$$,&$1,&$3, + T_IS_GREATER_OR_EQUAL);} + | expr T_INSTANCEOF + class_name_reference { BEXP(&$$,&$1,&$3,T_INSTANCEOF);} + | '(' expr ')' { UEXP(&$$,&$2,'(',1);} + | expr '?' expr ':' expr { _p->onQOp(&$$, &$1, &$3, &$5);} + | internal_functions { $$ = $1;} + | T_INT_CAST expr { UEXP(&$$,&$2,T_INT_CAST,1);} + | T_DOUBLE_CAST expr { UEXP(&$$,&$2,T_DOUBLE_CAST,1);} + | T_STRING_CAST expr { UEXP(&$$,&$2,T_STRING_CAST,1);} + | T_ARRAY_CAST expr { UEXP(&$$,&$2,T_ARRAY_CAST,1);} + | T_OBJECT_CAST expr { UEXP(&$$,&$2,T_OBJECT_CAST,1);} + | T_BOOL_CAST expr { UEXP(&$$,&$2,T_BOOL_CAST,1);} + | T_UNSET_CAST expr { UEXP(&$$,&$2,T_UNSET_CAST,1);} + | T_EXIT exit_expr { UEXP(&$$,&$2,T_EXIT,1);} + | '@' expr { UEXP(&$$,&$2,'@',1);} + | scalar { $$ = $1;} + | T_ARRAY '(' array_pair_list ')' { UEXP(&$$,&$3,T_ARRAY,1);} + | '`' encaps_list '`' { _p->onEncapsList(&$$,'`',&$2);} + | T_PRINT expr { UEXP(&$$,&$2,T_PRINT,1);} + | T_HPHP_NOTE expr { _p->onHphpNoteExpr(&$$,&$1,&$2);} +; + +function_call: + T_STRING '(' + function_call_parameter_list ')' { _p->onCall(&$$,0,&$1,&$3,NULL);} + | variable_without_objects '(' + function_call_parameter_list ')' { _p->onCall(&$$,1,&$1,&$3,NULL);} + | fully_qualified_class_name + T_PAAMAYIM_NEKUDOTAYIM + T_STRING '(' + function_call_parameter_list ')' { _p->onCall(&$$,0,&$3,&$5,&$1);} + | fully_qualified_class_name + T_PAAMAYIM_NEKUDOTAYIM + variable_without_objects '(' + function_call_parameter_list ')' { _p->onCall(&$$,1,&$3,&$5,&$1);} +; +fully_qualified_class_name: + T_STRING { $$ = $1;} +; +class_name_reference: + T_STRING { _p->onScalar(&$$, T_STRING, &$1);} + | dynamic_class_name_reference { $$ = $1;} +; +dynamic_class_name_reference: + base_variable { _p->pushObject(&$1);} + T_OBJECT_OPERATOR object_property + object_properties { _p->popObject(&$$);} + | base_variable { _p->pushObject(&$1); + _p->popObject(&$$);} +; +object_properties: + object_properties + dynamic_class_name_variable_prop { } + | { } +; +dynamic_class_name_variable_prop: + T_OBJECT_OPERATOR object_property { } +; + +exit_expr: + '(' ')' { $$.reset();} + | '(' expr ')' { $$ = $2;} + | { $$.reset();} +; + +ctor_arguments: + '(' + function_call_parameter_list ')' { $$ = $2;} + | { $$.reset();} +; + +common_scalar: + T_LNUMBER { _p->onScalar(&$$, T_LNUMBER, &$1);} + | T_DNUMBER { _p->onScalar(&$$, T_DNUMBER, &$1);} + | T_CONSTANT_ENCAPSED_STRING { _p->onScalar(&$$, + T_CONSTANT_ENCAPSED_STRING, &$1);} + | T_LINE { _p->onScalar(&$$, T_LINE, &$1);} + | T_FILE { UEXP(&$$,&$1,T_FILE,1);} + | T_CLASS_C { _p->onScalar(&$$, T_CLASS_C, &$1);} + | T_METHOD_C { _p->onScalar(&$$, T_METHOD_C, &$1);} + | T_FUNC_C { _p->onScalar(&$$, T_FUNC_C, &$1);} +; +static_scalar: + common_scalar { $$ = $1;} + | T_STRING { _p->onConstant(&$$, &$1);} + | '+' static_scalar { UEXP(&$$,&$2,'+',1);} + | '-' static_scalar { UEXP(&$$,&$2,'-',1);} + | T_ARRAY '(' + static_array_pair_list ')' { UEXP(&$$,&$3,T_ARRAY,1);} + | static_class_constant { $$ = $1;} +; +static_class_constant: + T_STRING T_PAAMAYIM_NEKUDOTAYIM + T_STRING { _p->onClassConst(&$$, &$1, &$3);} +; +scalar: + T_STRING { _p->onConstant(&$$, &$1);} + | T_STRING_VARNAME { _p->onConstant(&$$, &$1);} + | class_constant { $$ = $1} + | common_scalar { $$ = $1;} + | '"' encaps_list '"' { _p->onEncapsList(&$$,'"',&$2);} + | '\'' encaps_list '\'' { _p->onEncapsList(&$$,'\'',&$2);} + | T_START_HEREDOC encaps_list + T_END_HEREDOC { _p->onEncapsList(&$$,T_START_HEREDOC, + &$2);} +; +static_array_pair_list: + non_empty_static_array_pair_list + possible_comma { $$ = $1;} + | { $$.reset();} +; +possible_comma: + ',' { $$.reset();} + | { $$.reset();} +; +non_empty_static_array_pair_list: + non_empty_static_array_pair_list + ',' static_scalar T_DOUBLE_ARROW + static_scalar { _p->onArrayPair(&$$,&$1,&$3,&$5,0);} + | non_empty_static_array_pair_list + ',' static_scalar { _p->onArrayPair(&$$,&$1, 0,&$3,0);} + | static_scalar T_DOUBLE_ARROW + static_scalar { _p->onArrayPair(&$$, 0,&$1,&$3,0);} + | static_scalar { _p->onArrayPair(&$$, 0, 0,&$1,0);} +; + +expr: + r_variable { $$ = $1;} + | expr_without_variable { $$ = $1;} +; +r_variable: + variable { $$ = $1;} +; +w_variable: + variable { $$ = $1;} +; +rw_variable: + variable { $$ = $1;} +; +variable: + base_variable_with_function_calls { _p->pushObject(&$1);} + T_OBJECT_OPERATOR object_property + method_or_not { _p->appendMethodParams(&$5);} + variable_properties { _p->popObject(&$$);} + | base_variable_with_function_calls { _p->pushObject(&$1); + _p->popObject(&$$);} +; +variable_properties: + variable_properties + variable_property { } + | { } +; +variable_property: + T_OBJECT_OPERATOR object_property + method_or_not { _p->appendMethodParams(&$3);} +; +method_or_not: + '(' + function_call_parameter_list ')' { $$ = $2; $$.num = 1;} + | { $$.reset();} +; + +variable_without_objects: + reference_variable { $$ = $1;} + | simple_indirect_reference + reference_variable { _p->onIndirectRef(&$$,&$1,&$2);} +; +static_member: + fully_qualified_class_name + T_PAAMAYIM_NEKUDOTAYIM + variable_without_objects { _p->onStaticMember(&$$,&$1,&$3);} +; + +base_variable_with_function_calls: + base_variable { $$ = $1;} + | function_call { $$ = $1;} +; +base_variable: + reference_variable { $$ = $1;} + | simple_indirect_reference + reference_variable { _p->onIndirectRef(&$$,&$1,&$2);} + | static_member { $$ = $1; $$ = 2;} +; +reference_variable: + reference_variable + '[' dim_offset ']' { _p->onRefDim(&$$, &$1, &$3);} + | reference_variable '{' expr '}' { _p->onRefDim(&$$, &$1, &$3);} + | compound_variable { $$ = $1;} +; +compound_variable: + T_VARIABLE { _p->onSimpleVariable(&$$, &$1);} + | '$' '{' expr '}' { _p->onDynamicVariable(&$$, &$3, 0);} +; +dim_offset: + expr { $$ = $1;} + | { $$.reset();} +; + +object_property: + object_dim_list { } + | variable_without_objects { _p->appendProperty(&$1);} +; +object_dim_list: + object_dim_list '[' dim_offset ']' { _p->appendRefDim(&$3);} + | object_dim_list '{' expr '}' { _p->appendRefDim(&$3);} + | variable_name { _p->appendProperty(&$1);} +; +variable_name: + T_STRING { $$ = $1;} + | '{' expr '}' { $$ = $2;} +; + +simple_indirect_reference: + '$' { $$ = 1;} + | simple_indirect_reference '$' { $$++;} +; + +assignment_list: + assignment_list ',' alist_element { _p->onExprListElem(&$$,&$1,&$3);} + | alist_element { _p->onExprListElem(&$$,NULL,&$1);} +; +alist_element: + variable { $$ = $1;} + | T_LIST '(' assignment_list ')' { _p->onListAssignment(&$$, &$3, NULL);} + | { $$.reset();} +; + +array_pair_list: + non_empty_array_pair_list + possible_comma { $$ = $1;} + | { $$.reset();} +; +non_empty_array_pair_list: + non_empty_array_pair_list + ',' expr T_DOUBLE_ARROW expr { _p->onArrayPair(&$$,&$1,&$3,&$5,0);} + | non_empty_array_pair_list ',' expr { _p->onArrayPair(&$$,&$1, 0,&$3,0);} + | expr T_DOUBLE_ARROW expr { _p->onArrayPair(&$$, 0,&$1,&$3,0);} + | expr { _p->onArrayPair(&$$, 0, 0,&$1,0);} + | non_empty_array_pair_list + ',' expr T_DOUBLE_ARROW + '&' w_variable { _p->onArrayPair(&$$,&$1,&$3,&$6,1);} + | non_empty_array_pair_list ',' + '&' w_variable { _p->onArrayPair(&$$,&$1, 0,&$4,1);} + | expr T_DOUBLE_ARROW '&' w_variable { _p->onArrayPair(&$$, 0,&$1,&$4,1);} + | '&' w_variable { _p->onArrayPair(&$$, 0, 0,&$2,1);} +; + +encaps_list: + encaps_list encaps_var { _p->addEncap(&$$, &$1, &$2, -1);} + | encaps_list + T_ENCAPSED_AND_WHITESPACE { _p->addEncap(&$$, &$1, &$2, 0);} + | { $$.reset();} +; +encaps_var: + T_VARIABLE { _p->onSimpleVariable(&$$, &$1);} + | T_VARIABLE '[' + encaps_var_offset ']' { _p->encapRefDim(&$$, &$1, &$3);} + | T_VARIABLE T_OBJECT_OPERATOR + T_STRING { _p->encapObjProp(&$$, &$1, &$3);} + | T_DOLLAR_OPEN_CURLY_BRACES + expr '}' { _p->onDynamicVariable(&$$, &$2, 1);} + | T_DOLLAR_OPEN_CURLY_BRACES + T_STRING_VARNAME '[' expr ']' '}' { _p->encapArray(&$$, &$2, &$4);} + | T_CURLY_OPEN variable '}' { $$ = $2;} +; +encaps_var_offset: + T_STRING { $$ = $1; $$ = T_STRING;} + | T_NUM_STRING { $$ = $1; $$ = T_NUM_STRING;} + | T_VARIABLE { $$ = $1; $$ = T_VARIABLE;} +; + +internal_functions: + T_ISSET '(' isset_variables ')' { UEXP(&$$,&$3,T_ISSET,1);} + | T_EMPTY '(' variable ')' { UEXP(&$$,&$3,T_EMPTY,1);} + | T_INCLUDE expr { UEXP(&$$,&$2,T_INCLUDE,1);} + | T_INCLUDE_ONCE expr { UEXP(&$$,&$2,T_INCLUDE_ONCE,1);} + | T_EVAL '(' expr ')' { UEXP(&$$,&$3,T_EVAL,1);} + | T_REQUIRE expr { UEXP(&$$,&$2,T_REQUIRE,1);} + | T_REQUIRE_ONCE expr { UEXP(&$$,&$2,T_REQUIRE_ONCE,1);} +; + +isset_variables: + variable { _p->onExprListElem(&$$, NULL, &$1);} + | isset_variables ',' variable { _p->onExprListElem(&$$, &$1, &$3);} +; + +class_constant: + fully_qualified_class_name + T_PAAMAYIM_NEKUDOTAYIM T_STRING { _p->onClassConst(&$$, &$1, &$3);} +; +%% + +static int __attribute__((unused)) suppress_warning = yydebug; diff --git a/src/lib/parser/parser.cpp b/src/lib/parser/parser.cpp new file mode 100644 index 0000000000000..5430c3e01e814 --- /dev/null +++ b/src/lib/parser/parser.cpp @@ -0,0 +1,892 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +#define NEW_EXP0(cls) \ + cls##Ptr(new cls(getLocation(), Expression::KindOf##cls)) +#define NEW_EXP(cls, e...) \ + cls##Ptr(new cls(getLocation(), Expression::KindOf##cls, ##e)) +#define NEW_STMT0(cls) \ + cls##Ptr(new cls(getLocation(), Statement::KindOf##cls)) +#define NEW_STMT(cls, e...) \ + cls##Ptr(new cls(getLocation(), Statement::KindOf##cls, ##e)) +#define NEW_STMT_POP_LOC(cls, e...) \ + cls##Ptr(new cls(popLocation(), Statement::KindOf##cls, ##e)) + +/////////////////////////////////////////////////////////////////////////////// +// statics + +StatementListPtr Parser::parseString(const char *input, AnalysisResultPtr ar, + const char *fileName /* = NULL */) { + ASSERT(input); + istringstream iss(input); + stringstream ss; + istream *is = Option::EnableXHP ? preprocessXHP(iss, ss, fileName) : &iss; + + Scanner scanner(new ylmm::basic_buffer(*is, false, true), true, false); + if (!fileName || !*fileName) fileName = "string"; + ParserPtr parser(new Parser(scanner, fileName, strlen(input), ar)); + if (parser->parse()) { + printf("Error parsing %s: %s\n%s\n", fileName, + parser->getMessage().c_str(), input); + return StatementListPtr(); + } + return parser->getTree(); +} + +/////////////////////////////////////////////////////////////////////////////// + +Parser::Parser(Scanner &s, const char *fileName, int fileSize, + AnalysisResultPtr ar) + : m_scanner(s), m_ar(ar) { + _location = &m_location; + m_messenger.error_stream(m_err); + m_messenger.message_stream(m_msg); + messenger(m_messenger); + m_fileName = fileName ? fileName : ""; + + FileScopePtr fileScope(new FileScope(m_fileName, fileSize)); + m_ar->setFileScope(fileScope); +} + +std::string Parser::getMessage() { + string ret; + ret += m_scanner.getError(); + int line = m_scanner.getLine(); + int column = m_scanner.getColumn(); + + ret += " ("; + ret += string("Line: ") + lexical_cast(line); + ret += ", Char: " + lexical_cast(column) + "): "; + ret += m_err.str() + "\n"; + return ret; +} + +LocationPtr Parser::getLocation() { + LocationPtr location(new Location()); + location->file = file(); + location->line0 = line0(); + location->char0 = char0(); + location->line1 = line1(); + location->char1 = char1(); + return location; +} + +void Parser::pushLocation() { + m_locs.push_back(getLocation()); +} + +LocationPtr Parser::popLocation() { + LocationPtr ret = m_locs.back(); + m_locs.pop_back(); + return ret; +} + +const char *Parser::file() { + return m_fileName; +} + +int Parser::line0() { + return m_location.first_line(); +} + +int Parser::char0() { + return m_location.first_column(); +} + +int Parser::line1() { + return m_location.last_line(); +} + +int Parser::char1() { + return m_location.last_column(); +} + +int Parser::scan(void *arg /* = NULL */) { + return m_scanner.getNextToken(token(), where()); +} + +/////////////////////////////////////////////////////////////////////////////// +// variables + +void Parser::onVariable(Token *out, Token *exprs, Token *var, Token *value, + bool constant /* = false */) { + ExpressionPtr expList; + if (exprs) { + expList = exprs->exp; + } else { + expList = NEW_EXP0(ExpressionList); + } + ExpressionPtr exp; + if (constant) { + exp = NEW_EXP(ConstantExpression, var->text); + } else { + exp = NEW_EXP(SimpleVariable, var->text); + } + if (value) { + exp = NEW_EXP(AssignmentExpression, exp, value->exp, false); + } + expList->addElement(exp); + out->exp = expList; +} + +void Parser::onSimpleVariable(Token *out, Token *var) { + out->exp = NEW_EXP(SimpleVariable, var->text); +} + +void Parser::onDynamicVariable(Token *out, Token *expr, bool encap) { + out->exp = getDynamicVariable(expr->exp, encap); +} + +void Parser::onIndirectRef(Token *out, Token *refCount, Token *var) { + out->exp = var->exp; + for (int i = 0; i < refCount->num; i++) { + out->exp = createDynamicVariable(out->exp); + } +} + +void Parser::onStaticMember(Token *out, Token *className, Token *name) { + if (name->exp->is(Expression::KindOfArrayElementExpression) && + dynamic_pointer_cast(name->exp)-> + appendClassName(className->text)) { + out->exp = name->exp; + } else { + out->exp = NEW_EXP(StaticMemberExpression, className->text, name->exp); + } +} + +void Parser::onRefDim(Token *out, Token *var, Token *offset) { + if (!var->exp) { + var->exp = NEW_EXP(ConstantExpression, var->text); + } + out->exp = NEW_EXP(ArrayElementExpression, var->exp, offset->exp); +} + +ExpressionPtr Parser::getDynamicVariable(ExpressionPtr exp, bool encap) { + if (encap) { + ConstantExpressionPtr var = dynamic_pointer_cast(exp); + if (var) { + return NEW_EXP(SimpleVariable, var->getName()); + } + } else { + ScalarExpressionPtr var = dynamic_pointer_cast(exp); + if (var) { + return NEW_EXP(SimpleVariable, var->getString()); + } + } + return createDynamicVariable(exp); +} + +ExpressionPtr Parser::createDynamicVariable(ExpressionPtr exp) { + m_ar->getFileScope()->setAttribute(FileScope::ContainsDynamicVariable); + return NEW_EXP(DynamicVariable, exp); +} + +void Parser::onCallParam(Token *out, Token *params, Token *expr, bool ref) { + if (!params) { + out->exp = NEW_EXP0(ExpressionList); + } else { + out->exp = params->exp; + } + if (ref) { + expr->exp->setContext(Expression::RefParameter); + expr->exp->setContext(Expression::RefValue); + + } + out->exp->addElement(expr->exp); +} + +void Parser::onCall(Token *out, bool dynamic, Token *name, Token *params, + Token *className) { + if (dynamic) { + out->exp = NEW_EXP(DynamicFunctionCall, name->exp, + dynamic_pointer_cast(params->exp), + className ? &className->text : NULL); + } else { + SimpleFunctionCallPtr call = + NEW_EXP(SimpleFunctionCall, name->text, + dynamic_pointer_cast(params->exp), + className ? &className->text : NULL); + out->exp = call; + call->onParse(m_ar); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// object property and method calls + +void Parser::pushObject(Token *base) { + m_objects.push_back(base->exp); +} + +void Parser::popObject(Token *out) { + out->exp = m_objects.back(); + m_objects.pop_back(); +} + +void Parser::appendMethodParams(Token *params) { + ExpressionListPtr paramsExp; + if (params) { + if (params->exp) { + paramsExp = dynamic_pointer_cast(params->exp); + } else if (params->num == 1) { + paramsExp = NEW_EXP0(ExpressionList); + } + } + if (paramsExp) { + ObjectPropertyExpressionPtr prop = + dynamic_pointer_cast(m_objects.back()); + if (prop) { + ObjectMethodExpressionPtr method = + NEW_EXP(ObjectMethodExpression, + prop->getObject(), prop->getProperty(), paramsExp); + m_objects.back() = method; + } else { + m_objects.back() = NEW_EXP(DynamicFunctionCall, m_objects.back(), + paramsExp, NULL); + } + } +} + +void Parser::appendProperty(Token *prop) { + if (!prop->exp) { + prop->exp = NEW_EXP(ScalarExpression, T_STRING, prop->text); + } + m_objects.back() = NEW_EXP(ObjectPropertyExpression, m_objects.back(), + prop->exp); +} + +void Parser::appendRefDim(Token *offset) { + m_objects.back() = NEW_EXP(ArrayElementExpression, m_objects.back(), + offset->exp); +} + +/////////////////////////////////////////////////////////////////////////////// +// encapsed expressions + +void Parser::onEncapsList(Token *out, int type, Token *list) { + out->exp = NEW_EXP(EncapsListExpression, type, + dynamic_pointer_cast(list->exp)); +} + +void Parser::addEncap(Token *out, Token *list, Token *expr, int type) { + ExpressionListPtr expList; + if (list->exp) { + expList = dynamic_pointer_cast(list->exp); + } else { + expList = NEW_EXP0(ExpressionList); + } + ExpressionPtr exp; + if (type == -1) { + exp = expr->exp; + } else { + ScalarExpressionPtr scalar = + NEW_EXP(ScalarExpression, T_ENCAPSED_AND_WHITESPACE, expr->text, true); + scalar->onParse(m_ar); + exp = scalar; + } + expList->addElement(exp); + out->exp = expList; +} + +void Parser::encapRefDim(Token *out, Token *var, Token *offset) { + ExpressionPtr dim; + switch (offset->num) { + case T_STRING: + dim = NEW_EXP(ScalarExpression, T_STRING, offset->text, true); + break; + case T_NUM_STRING: + dim = NEW_EXP(ScalarExpression, T_NUM_STRING, offset->text); + break; + case T_VARIABLE: + dim = NEW_EXP(SimpleVariable, offset->text); + break; + default: + ASSERT(false); + } + + ExpressionPtr arr = NEW_EXP(SimpleVariable, var->text); + out->exp = NEW_EXP(ArrayElementExpression, arr, dim); +} + +void Parser::encapObjProp(Token *out, Token *var, Token *name) { + ExpressionPtr obj = NEW_EXP(SimpleVariable, var->text); + + ExpressionPtr prop = NEW_EXP(ScalarExpression, T_STRING, name->text); + out->exp = NEW_EXP(ObjectPropertyExpression, obj, prop); +} + +void Parser::encapArray(Token *out, Token *var, Token *expr) { + ExpressionPtr arr = NEW_EXP(SimpleVariable, var->text); + ExpressionPtr exp = NEW_EXP(ArrayElementExpression, arr, expr->exp); + out->exp = getDynamicVariable(exp, false); +} + +/////////////////////////////////////////////////////////////////////////////// +// expressions + +void Parser::onConstant(Token *out, Token *constant) { + out->exp = NEW_EXP(ConstantExpression, constant->text); +} + +void Parser::onScalar(Token *out, int type, Token *scalar) { + ScalarExpressionPtr exp; + switch (type) { + case T_STRING: + case T_LNUMBER: + case T_DNUMBER: + case T_LINE: + case T_FILE: + case T_CLASS_C: + case T_METHOD_C: + case T_FUNC_C: + exp = NEW_EXP(ScalarExpression, type, scalar->text); + break; + case T_CONSTANT_ENCAPSED_STRING: + exp = NEW_EXP(ScalarExpression, type, scalar->text, true); + break; + default: + ASSERT(false); + } + exp->onParse(m_ar); + out->exp = exp; +} + +void Parser::onExprListElem(Token *out, Token *exprs, Token *expr) { + ExpressionPtr expList; + if (exprs && exprs->exp) { + expList = exprs->exp; + } else { + expList = NEW_EXP0(ExpressionList); + } + expList->addElement(expr->exp); + out->exp = expList; +} + +void Parser::onListAssignment(Token *out, Token *vars, Token *expr) { + out->exp = NEW_EXP(ListAssignment, + dynamic_pointer_cast(vars->exp), + expr ? expr->exp : ExpressionPtr()); +} + +void Parser::onAssign(Token *out, Token *var, Token *expr, bool ref) { + out->exp = NEW_EXP(AssignmentExpression, var->exp, expr->exp, ref); +} + +void Parser::onAssignNew(Token *out, Token *var, Token *name, Token *args) { + ExpressionPtr exp = + NEW_EXP(NewObjectExpression, name->exp, + dynamic_pointer_cast(args->exp)); + out->exp = NEW_EXP(AssignmentExpression, var->exp, exp, true); +} + +void Parser::onNewObject(Token *out, Token *name, Token *args) { + out->exp = NEW_EXP(NewObjectExpression, name->exp, + dynamic_pointer_cast(args->exp)); +} + +void Parser::onUnaryOpExp(Token *out, Token *operand, int op, bool front) { + switch (op) { + case T_INCLUDE: + case T_INCLUDE_ONCE: + case T_REQUIRE: + case T_REQUIRE_ONCE: + { + IncludeExpressionPtr exp = NEW_EXP(IncludeExpression, operand->exp, op); + out->exp = exp; + exp->onParse(m_ar); + } + break; + default: + { + UnaryOpExpressionPtr exp = NEW_EXP(UnaryOpExpression, operand->exp, op, + front); + out->exp = exp; + exp->onParse(m_ar); + } + break; + } +} + +void Parser::onBinaryOpExp(Token *out, Token *operand1, Token *operand2, + int op) { + out->exp = NEW_EXP(BinaryOpExpression, operand1->exp, operand2->exp, op); +} + +void Parser::onQOp(Token *out, Token *exprCond, Token *expYes, Token *expNo) { + out->exp = NEW_EXP(QOpExpression, exprCond->exp, expYes->exp, expNo->exp); +} + +void Parser::onArrayPair(Token *out, Token *pairs, Token *name, Token *value, + bool ref) { + ExpressionPtr expList; + if (pairs) { + expList = pairs->exp; + } else { + expList = NEW_EXP0(ExpressionList); + } + ExpressionPtr nameExp = name ? name->exp : ExpressionPtr(); + expList->addElement(NEW_EXP(ArrayPairExpression, nameExp, value->exp, ref)); + out->exp = expList; +} + +void Parser::onClassConst(Token *out, Token *className, Token *name) { + out->exp = NEW_EXP(ClassConstantExpression, className->text, name->text); +} + +/////////////////////////////////////////////////////////////////////////////// +// function/method declaration + +void Parser::onFunctionStart() { + m_ar->getFileScope()->pushAttribute(); + pushLocation(); +} + +void Parser::onFunction(Token *out, Token *ref, Token *name, Token *params, + Token *stmt) { + if (!stmt->stmt) { + stmt->stmt = NEW_STMT0(StatementList); + } + FunctionStatementPtr func = NEW_STMT_POP_LOC + (FunctionStatement, ref->num, name->text, + dynamic_pointer_cast(params->exp), + dynamic_pointer_cast(stmt->stmt), + m_ar->getFileScope()->popAttribute()); + out->stmt = func; + func->onParse(m_ar); +} + +void Parser::onParam(Token *out, Token *params, Token *type, Token *var, + bool ref, Token *defValue) { + ExpressionPtr expList; + if (params) { + expList = params->exp; + } else { + expList = NEW_EXP0(ExpressionList); + } + expList->addElement(NEW_EXP(ParameterExpression, type->text, var->text, ref, + defValue ? defValue->exp : ExpressionPtr())); + out->exp = expList; +} + +void Parser::onClassStart() { + pushLocation(); +} + +void Parser::onClass(Token *out, Token *type, Token *name, Token *base, + Token *baseInterface, Token *stmt) { + StatementListPtr stmtList; + if (stmt->stmt) { + stmtList = dynamic_pointer_cast(stmt->stmt); + } + + ClassStatementPtr cls = NEW_STMT_POP_LOC + (ClassStatement, type->num, name->text, base->text, + dynamic_pointer_cast(baseInterface->exp), stmtList); + out->stmt = cls; + cls->onParse(m_ar); +} + +void Parser::onInterface(Token *out, Token *name, Token *base, Token *stmt) { + StatementListPtr stmtList; + if (stmt->stmt) { + stmtList = dynamic_pointer_cast(stmt->stmt); + } + + InterfaceStatementPtr intf = NEW_STMT_POP_LOC + (InterfaceStatement, name->text, + dynamic_pointer_cast(base->exp), stmtList); + out->stmt = intf; + intf->onParse(m_ar); +} + +void Parser::onInterfaceName(Token *out, Token *names, Token *name) { + ExpressionPtr expList; + if (names) { + expList = names->exp; + } else { + expList = NEW_EXP0(ExpressionList); + } + expList->addElement(NEW_EXP(ScalarExpression, T_STRING, name->text)); + out->exp = expList; +} + +void Parser::onClassVariable(Token *out, Token *modifiers, Token *decl) { + if (modifiers) { + ModifierExpressionPtr exp = modifiers->exp ? + dynamic_pointer_cast(modifiers->exp) + : NEW_EXP0(ModifierExpression); + + out->stmt = NEW_STMT + (ClassVariable, exp, dynamic_pointer_cast(decl->exp)); + } else { + out->stmt = + NEW_STMT(ClassConstant, dynamic_pointer_cast(decl->exp)); + } +} + +void Parser::onMethod(Token *out, Token *modifiers, Token *ref, Token *name, + Token *params, Token *stmt) { + ModifierExpressionPtr exp = modifiers->exp ? + dynamic_pointer_cast(modifiers->exp) + : NEW_EXP0(ModifierExpression); + + StatementListPtr stmts; + if (!stmt->stmt && stmt->num == 1) { + stmts = NEW_STMT0(StatementList); + } else { + stmts = dynamic_pointer_cast(stmt->stmt); + } + + out->stmt = NEW_STMT_POP_LOC + (MethodStatement, exp, ref->num, name->text, + dynamic_pointer_cast(params->exp), stmts, + m_ar->getFileScope()->popAttribute()); +} + +void Parser::onMemberModifier(Token *out, Token *modifiers, Token *modifier) { + ModifierExpressionPtr expList; + if (modifiers) { + expList = dynamic_pointer_cast(modifiers->exp); + } else { + expList = NEW_EXP0(ModifierExpression); + } + expList->add(modifier->num); + out->exp = expList; +} + +/////////////////////////////////////////////////////////////////////////////// +// statements + +void Parser::saveParseTree(Token *tree) { + if (tree->stmt) { + m_tree = dynamic_pointer_cast(tree->stmt); + } else { + m_tree = NEW_STMT0(StatementList); + } + FileScopePtr fileScope = m_ar->getFileScope(); + fileScope->setTree(m_tree); + m_ar->pushScope(fileScope); + m_tree->preOptimize(m_ar); + m_ar->popScope(); +} + +void Parser::addStatement(Token *out, Token *stmts, Token *new_stmt) { + if (!stmts || !stmts->stmt) { + out->stmt = NEW_STMT0(StatementList); + } else { + out->stmt = stmts->stmt; + } + if (new_stmt->stmt) { + out->stmt->addElement(new_stmt->stmt); + } +} + +void Parser::finishStatement(Token *out, Token *stmts) { + if (!stmts->stmt) { + out->stmt = NEW_STMT0(StatementList); + } else { + out->stmt = stmts->stmt; + } +} + +void Parser::onBlock(Token *out, Token *stmts) { + if (!stmts->stmt) { + stmts->stmt = NEW_STMT0(StatementList); + } else if (!stmts->stmt->is(Statement::KindOfStatementList)) { + out->stmt = NEW_STMT0(StatementList); + out->stmt->addElement(stmts->stmt); + stmts->stmt = out->stmt; + } + out->stmt = NEW_STMT(BlockStatement, + dynamic_pointer_cast(stmts->stmt)); +} + +void Parser::onIf(Token *out, Token *cond, Token *stmt, Token *elseifs, + Token *elseStmt) { + StatementPtr stmtList; + if (!elseifs->stmt) { + stmtList = NEW_STMT0(StatementList); + } else { + stmtList = elseifs->stmt; + } + if (stmt->stmt && stmt->stmt->is(Statement::KindOfStatementList)) { + stmt->stmt = NEW_STMT(BlockStatement, + dynamic_pointer_cast(stmt->stmt)); + } + stmtList->insertElement(NEW_STMT(IfBranchStatement, cond->exp, stmt->stmt)); + if (elseStmt->stmt) { + if (elseStmt->stmt->is(Statement::KindOfStatementList)) { + elseStmt->stmt = NEW_STMT + (BlockStatement, dynamic_pointer_cast(elseStmt->stmt)); + } + stmtList->addElement(NEW_STMT(IfBranchStatement, ExpressionPtr(), + elseStmt->stmt)); + } + out->stmt = NEW_STMT(IfStatement, + dynamic_pointer_cast(stmtList)); +} + +void Parser::onElseIf(Token *out, Token *elseifs, Token *cond, Token *stmt) { + if (!elseifs->stmt) { + out->stmt = NEW_STMT0(StatementList); + } else { + out->stmt = elseifs->stmt; + } + if (stmt->stmt && stmt->stmt->is(Statement::KindOfStatementList)) { + stmt->stmt = NEW_STMT(BlockStatement, + dynamic_pointer_cast(stmt->stmt)); + } + out->stmt->addElement(NEW_STMT(IfBranchStatement, cond->exp, stmt->stmt)); +} + +void Parser::onWhile(Token *out, Token *cond, Token *stmt) { + if (stmt->stmt && stmt->stmt->is(Statement::KindOfStatementList)) { + stmt->stmt = NEW_STMT(BlockStatement, + dynamic_pointer_cast(stmt->stmt)); + } + out->stmt = NEW_STMT(WhileStatement, cond->exp, stmt->stmt); +} + +void Parser::onDo(Token *out, Token *stmt, Token *cond) { + out->stmt = NEW_STMT(DoStatement, stmt->stmt, cond->exp); +} + +void Parser::onFor(Token *out, Token *expr1, Token *expr2, Token *expr3, + Token *stmt) { + if (stmt->stmt && stmt->stmt->is(Statement::KindOfStatementList)) { + stmt->stmt = NEW_STMT(BlockStatement, + dynamic_pointer_cast(stmt->stmt)); + } + out->stmt = NEW_STMT(ForStatement, expr1->exp, expr2->exp, expr3->exp, + stmt->stmt); +} + +void Parser::onSwitch(Token *out, Token *expr, Token *cases) { + out->stmt = NEW_STMT(SwitchStatement, expr->exp, + dynamic_pointer_cast(cases->stmt)); +} + +void Parser::onCase(Token *out, Token *cases, Token *cond, Token *stmt) { + if (!cases->stmt) { + out->stmt = NEW_STMT0(StatementList); + } else { + out->stmt = cases->stmt; + } + out->stmt->addElement(NEW_STMT(CaseStatement, + cond ? cond->exp : ExpressionPtr(), + stmt->stmt)); +} + +void Parser::onBreak(Token *out, Token *expr) { + out->stmt = NEW_STMT(BreakStatement, expr ? expr->exp : ExpressionPtr()); +} + +void Parser::onContinue(Token *out, Token *expr) { + out->stmt = NEW_STMT(ContinueStatement, expr ? expr->exp : ExpressionPtr()); +} + +void Parser::onReturn(Token *out, Token *expr) { + out->stmt = NEW_STMT(ReturnStatement, expr ? expr->exp : ExpressionPtr()); +} + +void Parser::onGlobal(Token *out, Token *expr) { + out->stmt = NEW_STMT(GlobalStatement, + dynamic_pointer_cast(expr->exp)); +} + +void Parser::onGlobalVar(Token *out, Token *exprs, Token *expr) { + ExpressionPtr expList; + if (exprs && exprs->exp) { + expList = exprs->exp; + } else { + expList = NEW_EXP0(ExpressionList); + } + switch (expr->num) { + case 0: + expList->addElement(NEW_EXP(SimpleVariable, expr->text)); + break; + case 1: + expList->addElement(createDynamicVariable(expr->exp)); + break; + default: + ASSERT(false); + } + out->exp = expList; +} + +void Parser::onStatic(Token *out, Token *expr) { + out->stmt = NEW_STMT(StaticStatement, + dynamic_pointer_cast(expr->exp)); +} + +void Parser::onEcho(Token *out, Token *expr, bool html) { + if (html) { + LocationPtr loc = getLocation(); + if (loc->line1 == 2 && loc->char1 == 0 && expr->text[0] == '#') { + // skipping linux interpreter declaration + out->stmt = NEW_STMT0(StatementList); + } else { + ExpressionPtr exp = NEW_EXP(ScalarExpression, T_STRING, expr->text, + true); + ExpressionListPtr expList = NEW_EXP(ExpressionList); + expList->addElement(exp); + out->stmt = NEW_STMT(EchoStatement, expList); + } + } else { + out->stmt = NEW_STMT(EchoStatement, + dynamic_pointer_cast(expr->exp)); + } +} + +void Parser::onUnset(Token *out, Token *expr) { + out->stmt = NEW_STMT(UnsetStatement, + dynamic_pointer_cast(expr->exp)); + m_ar->getFileScope()->setAttribute(FileScope::ContainsUnset); +} + +void Parser::onExpStatement(Token *out, Token *expr) { + out->stmt = NEW_STMT(ExpStatement, expr->exp); +} + +void Parser::onForEach(Token *out, Token *arr, Token *name, Token *value, + Token *stmt) { + if (stmt->stmt && stmt->stmt->is(Statement::KindOfStatementList)) { + stmt->stmt = NEW_STMT(BlockStatement, + dynamic_pointer_cast(stmt->stmt)); + } + out->stmt = NEW_STMT(ForEachStatement, arr->exp, name->exp, name->num == 1, + value->exp, value->num == 1, stmt->stmt); +} + +void Parser::onTry(Token *out, Token *tryStmt, Token *className, Token *var, + Token *catchStmt, Token *catches) { + StatementPtr stmtList; + if (catches->stmt) { + stmtList = catches->stmt; + } else { + stmtList = NEW_STMT0(StatementList); + } + stmtList->insertElement(NEW_STMT(CatchStatement, className->text, var->text, + catchStmt->stmt)); + out->stmt = NEW_STMT(TryStatement, tryStmt->stmt, + dynamic_pointer_cast(stmtList)); +} + +void Parser::onCatch(Token *out, Token *className, Token *var, Token *stmt) { + out->stmt = NEW_STMT(CatchStatement, className->text, var->text, stmt->stmt); +} + +void Parser::onThrow(Token *out, Token *expr) { + out->stmt = NEW_STMT(ThrowStatement, expr->exp); +} + +void Parser::addHphpNote(ConstructPtr c, const std::string ¬e) { + if (note[0] == '@') { + CodeError::ErrorType e; + if (CodeError::lookupErrorType(note.substr(1), e)) { + c->addSuppressError(e); + } else { + c->addHphpNote(note); + } + } else { + c->addHphpNote(note); + } +} + +void Parser::onHphpNoteExpr(Token *out, Token *note, Token *expr) { + addHphpNote(expr->exp, note->text); + out->exp = expr->exp; +} +void Parser::onHphpNoteStatement(Token *out, Token *note, Token *stmt) { + addHphpNote(stmt->stmt, note->text); + out->stmt = stmt->stmt; +} + +void Parser::addHphpDeclare(Token *declare) { + m_ar->getFileScope()->addDeclare(declare->text); +} + +void Parser::addHphpSuppressError(Token *error) { + CodeError::ErrorType e; + if (CodeError::lookupErrorType(error->text, e)) { + m_ar->getFileScope()->addSuppressError(e); + } +} diff --git a/src/lib/parser/parser.h b/src/lib/parser/parser.h new file mode 100644 index 0000000000000..e8d1ac3851544 --- /dev/null +++ b/src/lib/parser/parser.h @@ -0,0 +1,175 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_PARSER_H__ +#define __HPHP_PARSER_H__ + +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +namespace HPHP { + DECLARE_BOOST_TYPES(StatementList); + DECLARE_BOOST_TYPES(Location); + DECLARE_BOOST_TYPES(Parser); + DECLARE_BOOST_TYPES(AnalysisResult); + + struct Location { + const char *file; + int line0; + int char0; + int line1; + int char1; + }; + + class Parser : public ylmm::basic_parser, + public boost::enable_shared_from_this { + public: + static StatementListPtr parseString(const char *input, + AnalysisResultPtr ar, + const char *fileName = NULL); + public: + Parser(Scanner &s, const char *fileName, int fileSize, + AnalysisResultPtr ar); + // Gets + StatementListPtr getTree() const { return m_tree;} + std::string getMessage(); + LocationPtr getLocation(); + const char *file(); + int line0(); + int char0(); + int line1(); + int char1(); + + // implementing basic_parser + virtual int scan(void *arg = NULL); + + // parser handlers + void saveParseTree(Token *tree); + void onVariable(Token *out, Token *exprs, Token *var, Token *value, + bool constant = false); + void onSimpleVariable(Token *out, Token *var); + void onDynamicVariable(Token *out, Token *expr, bool encap); + void onIndirectRef(Token *out, Token *refCount, Token *var); + void onStaticMember(Token *out, Token *className, Token *name); + void onRefDim(Token *out, Token *var, Token *offset); + void onCallParam(Token *out, Token *params, Token *expr, bool ref); + void onCall(Token *out, bool dynamic, Token *name, Token *params, + Token *className); + void onEncapsList(Token *out, int type, Token *list); + void addEncap(Token *out, Token *list, Token *expr, int type); + void encapRefDim(Token *out, Token *var, Token *offset); + void encapObjProp(Token *out, Token *var, Token *name); + void encapArray(Token *out, Token *var, Token *expr); + void onConstant(Token *out, Token *constant); + void onScalar(Token *out, int type, Token *scalar); + void onExprListElem(Token *out, Token *exprs, Token *expr); + + void pushObject(Token *base); + void popObject(Token *out); + void appendMethodParams(Token *params); + void appendProperty(Token *prop); + void appendRefDim(Token *offset); + + void onListAssignment(Token *out, Token *vars, Token *expr); + void onListAssignment(Token *out, Token *assignments); + void onAssign(Token *out, Token *var, Token *expr, bool ref); + void onAssignNew(Token *out, Token *var, Token *name, Token *args); + void onNewObject(Token *out, Token *name, Token *args); + void onUnaryOpExp(Token *out, Token *operand, int op, bool front); + void onBinaryOpExp(Token *out, Token *operand1, Token *operand2, int op); + void onQOp(Token *out, Token *exprCond, Token *expYes, Token *expNo); + void onArrayPair(Token *out, Token *pairs, Token *name, Token *value, + bool ref); + void onClassConst(Token *out, Token *className, Token *name); + void onFunctionStart(); + void onFunction(Token *out, Token *ref, Token *name, Token *params, + Token *stmt); + void onParam(Token *out, Token *params, Token *type, Token *var, + bool ref, Token *defValue); + void onClassStart(); + void onClass(Token *out, Token *type, Token *name, Token *base, + Token *baseInterface, Token *stmt); + void onInterface(Token *out, Token *name, Token *base, Token *stmt); + void onInterfaceName(Token *out, Token *names, Token *name); + void onClassVariable(Token *out, Token *modifiers, Token *decl); + void onMethod(Token *out, Token *modifiers, Token *ref, Token *name, + Token *params, Token *stmt); + void onMemberModifier(Token *out, Token *modifiers, Token *modifier); + void addStatement(Token *out, Token *stmts, Token *new_stmt); + void finishStatement(Token *out, Token *stmts); + void onBlock(Token *out, Token *stmts); + void onIf(Token *out, Token *cond, Token *stmt, Token *elseifs, + Token *elseStmt); + void onElseIf(Token *out, Token *elseifs, Token *cond, Token *stmt); + void onWhile(Token *out, Token *cond, Token *stmt); + void onDo(Token *out, Token *stmt, Token *cond); + void onFor(Token *out, Token *expr1, Token *expr2, Token *expr3, + Token *stmt); + void onSwitch(Token *out, Token *expr, Token *cases); + void onCase(Token *out, Token *cases, Token *cond, Token *stmt); + void onBreak(Token *out, Token *expr); + void onContinue(Token *out, Token *expr); + void onReturn(Token *out, Token *expr); + void onGlobal(Token *out, Token *expr); + void onGlobalVar(Token *out, Token *exprs, Token *expr); + void onStatic(Token *out, Token *expr); + void onEcho(Token *out, Token *expr, bool html); + void onUnset(Token *out, Token *expr); + void onExpStatement(Token *out, Token *expr); + void onForEach(Token *out, Token *arr, Token *name, Token *value, + Token *stmt); + void onTry(Token *out, Token *tryStmt, Token *className, Token *var, + Token *catchStmt, Token *catches); + void onCatch(Token *out, Token *className, Token *var, Token *stmt); + void onThrow(Token *out, Token *expr); + + void addHphpNote(ConstructPtr c, const std::string ¬e); + void onHphpNoteExpr(Token *out, Token *note, Token *expr); + void onHphpNoteStatement(Token *out, Token *note, Token *stmt); + + void addHphpDeclare(Token *declare); + void addHphpSuppressError(Token *error); + + private: + ylmm::basic_location m_location; + std::ostringstream m_err; + std::ostringstream m_msg; + ylmm::basic_messenger m_messenger; + + Scanner &m_scanner; + const char *m_fileName; + AnalysisResultPtr m_ar; + LocationPtrVec m_locs; // for function/class/interface location stack + ExpressionPtrVec m_objects; // for parsing object property/method calls + + // parser output + StatementListPtr m_tree; + + void pushLocation(); + LocationPtr popLocation(); + ExpressionPtr getDynamicVariable(ExpressionPtr exp, bool encap); + ExpressionPtr createDynamicVariable(ExpressionPtr exp); + }; +} + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __HPHP_PARSER_H__ diff --git a/src/lib/parser/scanner.cpp b/src/lib/parser/scanner.cpp new file mode 100644 index 0000000000000..efa7893ed51ec --- /dev/null +++ b/src/lib/parser/scanner.cpp @@ -0,0 +1,185 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; +using namespace HPHP; + +/////////////////////////////////////////////////////////////////////////////// + +Scanner::Scanner(ylmm::basic_buffer* buf, bool bShortTags, bool bASPTags) + : ylmm::basic_scanner(buf), m_shortTags(bShortTags), + m_aspTags(bASPTags), m_line(1), m_column(0) { + _current->auto_increment(true); + m_messenger.error_stream(m_err); + m_messenger.message_stream(m_msg); + messenger(m_messenger); + _scanner_init(); +} + +void Scanner::setToken(const char *rawText, int rawLeng, + const char *yytext, int yyleng) { + _token.text.assign(yytext, yyleng); + if (rawText == yytext && rawLeng == yyleng) { + _token.rawText = _token.text; + } else { + _token.rawText.assign(rawText, rawLeng); + } +} + +void Scanner::setHeredocLabel(const char *label, int len) { + m_heredocLabel.assign(label, len); +} + +int Scanner::getHeredocLabelLen() const { + return m_heredocLabel.length(); +} + +const char *Scanner::getHeredocLabel() const { + return m_heredocLabel.data(); +} + +void Scanner::resetHeredoc() { + m_heredocLabel.clear(); +} + +int Scanner::getNextToken(token_type& t, location_type& l) +{ + int tokid; + bool done = false; + + do { + tokid = next(t); + if (tokid != 0) { // not EOF + for (const char *s = t.rawText.c_str(); *s; s++) { + if (*s == '\n') { + m_line++; + m_column = 0; + } else { + m_column++; + } + } + } + switch (tokid) { + case T_COMMENT: + case T_DOC_COMMENT: + case T_OPEN_TAG: + case T_WHITESPACE: + break; + default: + done = true; + break; + } + } while (!done); + + l.last_line(m_line); + l.last_column(m_column); + return tokid; +} + +string Scanner::scanEscapeString(char *input, int len, char quote_type) const { + string output; + string str(input, len); + + if (quote_type == '\'') { + for (int i = 0; i < len; i++) { + unsigned char ch = str[i]; + if (ch == '\\') { + if (++i < len) { + switch (str[i]) { + case '\\': output += "\\"; break; + case '\'': output += '\''; break; + default: + output += ch; + output += str[i]; + break; + } + } else { + ASSERT(false); + output += ch; + } + } + else { + output += ch; + } + } + } else { + for (int i = 0; i < len; i++) { + unsigned char ch = str[i]; + if (ch == '\\') { + if (++i < len) { + switch (str[i]) { + case 'n': output += '\n'; break; + case 't': output += '\t'; break; + case 'r': output += '\r'; break; + case 'v': output += '\v'; break; + case 'f': output += '\f'; break; + case '\\': output += '\\'; break; + case '$': output += '$'; break; + case '"': + if (str[i] != quote_type) { + output += '\\'; + output += '"'; + break; + } else { + output += '"'; + break; + } + case 'x': + case 'X': + if (isxdigit(str[i+1])) { + string shex; + shex += str[++i]; // 0th hex digit + if (isxdigit(str[i+1])) { + shex += str[++i]; // 1st hex digit + } + output += strtol(shex.c_str(), NULL, 16); + } else { + output += ch; + output += str[i]; + } + break; + default: + // check for an octal + if ('0' <= str[i] && str[i] <= '7') { + string soct; + soct += str[i]; // 0th octal digit + if ('0' <= str[i+1] && str[i+1] <= '7') { + soct += str[++i]; // 1st octal digit + if ('0' <= str[i+1] && str[i+1] <= '7') { + soct += str[++i]; // 2nd octal digit + } + } + output += strtol(soct.c_str(), NULL, 8); + } else { + output += ch; + output += str[i]; + } + break; + } + } else { + output += ch; + } + } else { + output += ch; + } + } + } + return output; +} + diff --git a/src/lib/parser/scanner.h b/src/lib/parser/scanner.h new file mode 100644 index 0000000000000..faecfd74935c6 --- /dev/null +++ b/src/lib/parser/scanner.h @@ -0,0 +1,83 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_SCANNER_H__ +#define __HPHP_SCANNER_H__ + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +namespace HPHP { + DECLARE_BOOST_TYPES(Expression); + DECLARE_BOOST_TYPES(Statement); + + struct Token { + Token() : num(0) {} + std::string rawText; // original token text from the source script + std::string text; // token text after lexical analysis + int num; // internal token id + ExpressionPtr exp; + StatementPtr stmt; + + Token &operator=(int num) { this->num = num; return *this;} + void operator++(int) { this->num++;} + void reset() { text.clear(); num = 0; exp.reset(); stmt.reset();} + }; + + inline std::ostream &operator<< (std::ostream &o, const Token &e) { + return o; + } + + class Scanner : public ylmm::basic_scanner { + public: + Scanner(ylmm::basic_buffer* buf, bool bShortTags, bool bASPTags); + ~Scanner() { switch_buffer(0);} + void setToken(const char *rawText, int rawLeng, + const char *yytext, int yyleng); + + bool shortTags() const { return m_shortTags;} + bool aspTags() const { return m_aspTags;} + void setHeredocLabel(const char *label, int len); + int getHeredocLabelLen() const; + const char *getHeredocLabel() const; + void resetHeredoc(); + virtual int wrap() { return 1;} + int getNextToken(token_type& t, location_type& l); + std::string scanEscapeString(char *str, int len, char quote_type) const; + + std::string getError() const { return m_err.str();} + std::string getMessage() const { return m_msg.str();} + int getLine() const { return m_line;} + int getColumn() const { return m_column;} + protected: + std::ostringstream m_err; + std::ostringstream m_msg; + ylmm::basic_messenger m_messenger; + bool m_shortTags; + bool m_aspTags; + std::string m_heredocLabel; + int m_line; // last token line + int m_column; // last token column + }; +} +extern void _scanner_init(); + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __HPHP_SCANNER_H__ diff --git a/src/lib/statement/block_statement.cpp b/src/lib/statement/block_statement.cpp new file mode 100644 index 0000000000000..c45e6e222c568 --- /dev/null +++ b/src/lib/statement/block_statement.cpp @@ -0,0 +1,92 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +BlockStatement::BlockStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, StatementListPtr stmts) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_stmts(stmts) { +} + +StatementPtr BlockStatement::clone() { + BlockStatementPtr stmt(new BlockStatement(*this)); + stmt->m_stmts = Clone(m_stmts); + return stmt; +} + +int BlockStatement::getRecursiveCount() const { + return m_stmts->getRecursiveCount(); +} +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void BlockStatement::analyzeProgram(AnalysisResultPtr ar) { + if (m_stmts) m_stmts->analyzeProgram(ar); +} + +bool BlockStatement::hasDecl() const { + return m_stmts && m_stmts->hasDecl(); +} + +bool BlockStatement::hasImpl() const { + return m_stmts && m_stmts->hasImpl(); +} + +bool BlockStatement::hasRetExp() const { + return m_stmts && m_stmts->hasRetExp(); +} + +StatementPtr BlockStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_stmts); + return StatementPtr(); +} + +StatementPtr BlockStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_stmts); + return StatementPtr(); +} + +void BlockStatement::inferTypes(AnalysisResultPtr ar) { + if (m_stmts) m_stmts->inferTypes(ar); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void BlockStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.indentBegin("{\n"); + if (m_stmts) m_stmts->outputPHP(cg, ar); + cg.indentEnd("}\n"); +} + +void BlockStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_stmts) { + cg.indentBegin("{\n"); + m_stmts->outputCPP(cg, ar); + cg.indentEnd("}\n"); + } +} diff --git a/src/lib/statement/block_statement.h b/src/lib/statement/block_statement.h new file mode 100644 index 0000000000000..d7533570bf86b --- /dev/null +++ b/src/lib/statement/block_statement.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __BLOCK_STATEMENT_H__ +#define __BLOCK_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(BlockStatement); + +class BlockStatement : public Statement { +public: + BlockStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, StatementListPtr stmts); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + + virtual bool hasDecl() const; + virtual bool hasImpl() const; + virtual bool hasRetExp() const; + virtual int getRecursiveCount() const; +private: + StatementListPtr m_stmts; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __BLOCK_STATEMENT_H__ diff --git a/src/lib/statement/break_statement.cpp b/src/lib/statement/break_statement.cpp new file mode 100644 index 0000000000000..e0dec52428070 --- /dev/null +++ b/src/lib/statement/break_statement.cpp @@ -0,0 +1,115 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +BreakStatement::BreakStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_exp(exp) { + m_name = "break"; +} + +StatementPtr BreakStatement::clone() { + BreakStatementPtr stmt(new BreakStatement(*this)); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void BreakStatement::analyzeProgram(AnalysisResultPtr ar) { + if (m_exp) m_exp->analyzeProgram(ar); +} + +StatementPtr BreakStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + Variant v; + // break/continue 1 => break/continue; + if (m_exp && m_exp->getScalarValue(v) && + v.isInteger() && v.toInt64() == 1) { + m_exp = ExpressionPtr(); + } + return StatementPtr(); +} + +StatementPtr BreakStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return StatementPtr(); +} + +void BreakStatement::inferTypes(AnalysisResultPtr ar) { + if (m_exp) m_exp->inferAndCheck(ar, Type::Int64, false); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void BreakStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_exp) { + cg.printf("%s ", m_name); + m_exp->outputPHP(cg, ar); + cg.printf(";\n"); + } else { + cg.printf("%s;\n", m_name); + } +} + +void BreakStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + const std::vector &labelIds = cg.getBreakScopes(); + if (labelIds.empty()) { + cg.printf("throw_fatal(\"bad %s\");\n", m_name); + return; + } + + if (m_exp) { + cg.printf("switch ("); + m_exp->outputCPP(cg, ar); + cg.printf(") {\n"); + for (unsigned int i = 0; i < labelIds.size(); i++) { + int labelId = labelIds[i]; + labelId &= ~CodeGenerator::BreakScopeBitMask; + cg.printf("case %d: goto %s%d;\n", labelIds.size() - i, m_name, labelId); + cg.addLabelId(m_name, labelId); + } + cg.printf("default: throw_fatal(\"bad %s\");\n", m_name); + cg.printf("}\n"); + } else { + int labelId = labelIds.back(); + if (labelId & CodeGenerator::InsideSwitch) { + if (labelId & CodeGenerator::StaticCases) { + cg.printf("break;\n"); // continue will turn into break as well + } else { + labelId &= ~CodeGenerator::BreakScopeBitMask; + cg.printf("goto %s%d;\n", m_name, labelId); + cg.addLabelId(m_name, labelId); + } + } else { + cg.printf("%s;\n", m_name); + } + } +} diff --git a/src/lib/statement/break_statement.h b/src/lib/statement/break_statement.h new file mode 100644 index 0000000000000..54e7d686c6d0e --- /dev/null +++ b/src/lib/statement/break_statement.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __BREAK_STATEMENT_H__ +#define __BREAK_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(BreakStatement); + +class BreakStatement : public Statement { +public: + BreakStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + +protected: + const char *m_name; + ExpressionPtr m_exp; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __BREAK_STATEMENT_H__ diff --git a/src/lib/statement/case_statement.cpp b/src/lib/statement/case_statement.cpp new file mode 100644 index 0000000000000..48bfe2abf1461 --- /dev/null +++ b/src/lib/statement/case_statement.cpp @@ -0,0 +1,152 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +CaseStatement::CaseStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr condition, StatementPtr stmt) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_condition(condition), m_stmt(stmt) { +} + +StatementPtr CaseStatement::clone() { + CaseStatementPtr stmt(new CaseStatement(*this)); + stmt->m_condition = Clone(m_condition); + stmt->m_stmt = Clone(m_stmt); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +bool CaseStatement::isLiteralInteger() const { + if (!m_condition->is(Expression::KindOfScalarExpression)) return false; + ScalarExpressionPtr exp = + dynamic_pointer_cast(m_condition); + return exp->isLiteralInteger(); +} + +bool CaseStatement::isLiteralString() const { + if (!m_condition->is(Expression::KindOfScalarExpression)) return false; + ScalarExpressionPtr exp = + dynamic_pointer_cast(m_condition); + return exp->isLiteralString(); +} + +int64 CaseStatement::getLiteralInteger() const { + ASSERT(m_condition->is(Expression::KindOfScalarExpression)); + ScalarExpressionPtr exp = + dynamic_pointer_cast(m_condition); + return exp->getLiteralInteger(); +} + +void CaseStatement::analyzeProgram(AnalysisResultPtr ar) { + if (m_condition) m_condition->analyzeProgram(ar); + if (m_stmt) m_stmt->analyzeProgram(ar); +} + +StatementPtr CaseStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_condition); + ar->preOptimize(m_stmt); + return StatementPtr(); +} + +StatementPtr CaseStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_condition); + ar->postOptimize(m_stmt); + return StatementPtr(); +} + +void CaseStatement::inferTypes(AnalysisResultPtr ar) { + ASSERT(false); +} + +void CaseStatement::inferAndCheck(AnalysisResultPtr ar, TypePtr type, + bool coerce) { + if (m_condition) m_condition->inferAndCheck(ar, type, coerce); + if (m_stmt) m_stmt->inferTypes(ar); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void CaseStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_condition) { + cg.printf("case "); + m_condition->outputPHP(cg, ar); + cg.indentBegin(":\n"); + } else { + cg.indentBegin("default:\n"); + } + if (m_stmt) { + m_stmt->outputPHP(cg, ar); + } + cg.indentEnd(""); +} + +void CaseStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_condition) { + cg.printf("case "); + m_condition->outputCPPImpl(cg, ar); + cg.indentBegin(":\n"); + } else { + cg.indentBegin("default:\n"); + } + cg.indentBegin("{\n"); + if (m_stmt) { + m_stmt->outputCPP(cg, ar); + } + cg.indentEnd("}\n"); + cg.indentEnd(""); +} + +void CaseStatement::outputCPPByNumber(CodeGenerator &cg, AnalysisResultPtr ar, + int caseNum) { + cg.indentBegin("case %d:\n", caseNum); + cg.indentBegin("{\n"); + if (m_stmt) { + m_stmt->outputCPP(cg, ar); + } + cg.indentEnd("}\n"); + cg.indentEnd(""); +} + +void CaseStatement::outputCPPAsIf(CodeGenerator &cg, AnalysisResultPtr ar, + int varId, int caseVar, int caseNum) { + if (m_condition) { + cg.printf("if (equal(%s%d, (", Option::TempPrefix, varId); + m_condition->outputCPP(cg, ar); + cg.indentBegin("))) {\n"); + } else { + cg.indentBegin("if (true) {\n"); + } + cg.printf("%s%d = %d;\n", Option::TempPrefix, caseVar, caseNum); + cg.indentEnd("}"); +} diff --git a/src/lib/statement/case_statement.h b/src/lib/statement/case_statement.h new file mode 100644 index 0000000000000..8d3fdfa95affb --- /dev/null +++ b/src/lib/statement/case_statement.h @@ -0,0 +1,72 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CASE_STATEMENT_H__ +#define __CASE_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(CaseStatement); + +class CaseStatement : public Statement { +public: + CaseStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr condition, StatementPtr stmt); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return m_stmt && m_stmt->hasDecl(); } + virtual bool hasRetExp() const { return m_stmt && m_stmt->hasRetExp(); } + virtual int getRecursiveCount() const { + return m_stmt ? m_stmt->getRecursiveCount() : 0; + } + void inferAndCheck(AnalysisResultPtr ar, TypePtr type, bool coerce); + + /** + * Whether condition is a literal. + */ + bool isLiteralInteger() const; + bool isLiteralString() const; + int64 getLiteralInteger() const; + + /** + * SwitchStatement needs to inspect this expression. + */ + ExpressionPtr getCondition() { return m_condition;} + + /** + * Generate an "if" statement that sets caseVar to caseNum if m_condition + * evaluates true. + */ + void outputCPPAsIf(CodeGenerator &cg, AnalysisResultPtr ar, int varId, + int caseVar, int caseNum); + + /** + * Generate a case statement that cases by caseNum. + */ + void outputCPPByNumber(CodeGenerator &cg, AnalysisResultPtr ar, + int caseNum); + +private: + ExpressionPtr m_condition; + StatementPtr m_stmt; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CASE_STATEMENT_H__ diff --git a/src/lib/statement/catch_statement.cpp b/src/lib/statement/catch_statement.cpp new file mode 100644 index 0000000000000..c6db9758d4b98 --- /dev/null +++ b/src/lib/statement/catch_statement.cpp @@ -0,0 +1,126 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +CatchStatement::CatchStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + const std::string &className, const std::string &variable, + StatementPtr stmt) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_variable(variable), m_stmt(stmt), m_valid(true) { + m_className = Util::toLower(className); +} + +StatementPtr CatchStatement::clone() { + CatchStatementPtr stmt(new CatchStatement(*this)); + stmt->m_stmt = Clone(m_stmt); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void CatchStatement::analyzeProgram(AnalysisResultPtr ar) { + addUserClass(ar, m_className); + if (ar->isFirstPass()) { + ar->getScope()->getVariables()->addReferenced(m_variable); + } + if (m_stmt) m_stmt->analyzeProgram(ar); +} + +StatementPtr CatchStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_stmt); + return StatementPtr(); +} + +StatementPtr CatchStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_stmt); + return StatementPtr(); +} + +void CatchStatement::inferTypes(AnalysisResultPtr ar) { + m_valid = true; + + ClassScopePtr cls = ar->findClass(m_className); + TypePtr type; + if (!cls || cls->isRedeclaring()) { + if (!cls && ar->isFirstPass()) { + ConstructPtr self = shared_from_this(); + ar->getCodeError()->record(self, CodeError::UnknownClass, self); + } + m_valid = false; + type = NEW_TYPE(Object); + } else { + type = Type::CreateObjectType(m_className); + } + + BlockScopePtr scope = ar->getScope(); + VariableTablePtr variables = scope->getVariables(); + variables->add(m_variable, type, false, ar, shared_from_this(), + ModifierExpressionPtr(), false); + if (ar->isFirstPass()) { + FunctionScopePtr func = dynamic_pointer_cast(scope); + if (func && variables->isParameter(m_variable)) { + variables->addLvalParam(m_variable); + } + } + if (m_stmt) m_stmt->inferTypes(ar); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void CatchStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf(" catch (%s $%s) ", m_className.c_str(), m_variable.c_str()); + cg.indentBegin("{\n"); + if (m_stmt) m_stmt->outputPHP(cg, ar); + cg.indentEnd("}"); +} + +void CatchStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_valid) { + cg.indentBegin("if (e.instanceof(\"%s\")) {\n", m_className.c_str()); + VariableTablePtr variables = ar->getScope()->getVariables(); + cg.printf("%s = e;\n", variables->getVariableName(ar, m_variable).c_str()); + if (m_stmt) m_stmt->outputCPP(cg, ar); + cg.indentEnd("}"); + } else { + cg.indentBegin("if (true) {\n"); + cg.printf("throw_fatal(\"unknown class %s\");\n", m_className.c_str()); + cg.indentEnd("}"); + } +} diff --git a/src/lib/statement/catch_statement.h b/src/lib/statement/catch_statement.h new file mode 100644 index 0000000000000..6f26728b8b321 --- /dev/null +++ b/src/lib/statement/catch_statement.h @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CATCH_STATEMENT_H__ +#define __CATCH_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(CatchStatement); + +class CatchStatement : public Statement { +public: + CatchStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + const std::string &className, const std::string &variable, + StatementPtr stmt); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return m_stmt && m_stmt->hasDecl(); } + virtual bool hasRetExp() const { return m_stmt && m_stmt->hasRetExp(); } + virtual int getRecursiveCount() const { + return (m_stmt ? m_stmt->getRecursiveCount() : 0); + } +private: + std::string m_className; + std::string m_variable; + StatementPtr m_stmt; + bool m_valid; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CATCH_STATEMENT_H__ diff --git a/src/lib/statement/class_constant.cpp b/src/lib/statement/class_constant.cpp new file mode 100644 index 0000000000000..d9bd62ddb03d3 --- /dev/null +++ b/src/lib/statement/class_constant.cpp @@ -0,0 +1,139 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ClassConstant::ClassConstant +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionListPtr exp) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_exp(exp) { +} + +StatementPtr ClassConstant::clone() { + ClassConstantPtr stmt(new ClassConstant(*this)); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void ClassConstant::onParse(AnalysisResultPtr ar) { + for (int i = 0; i < m_exp->getCount(); i++) { + IParseHandlerPtr ph = dynamic_pointer_cast((*m_exp)[i]); + ph->onParse(ar); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ClassConstant::analyzeProgram(AnalysisResultPtr ar) { + m_exp->analyzeProgram(ar); +} + +StatementPtr ClassConstant::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + return StatementPtr(); +} + +StatementPtr ClassConstant::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return StatementPtr(); +} + +void ClassConstant::inferTypes(AnalysisResultPtr ar) { + m_exp->inferAndCheck(ar, NEW_TYPE(Some), false); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ClassConstant::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("const "); + m_exp->outputPHP(cg, ar); + cg.printf(";\n"); +} + +void ClassConstant::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + bool lazyInit = cg.getContext() == CodeGenerator::CppLazyStaticInitializer; + if (cg.getContext() != CodeGenerator::CppClassConstantsDecl && + cg.getContext() != CodeGenerator::CppClassConstantsImpl && + !lazyInit) { + return; + } + + ClassScopePtr scope = ar->getClassScope(); + for (int i = 0; i < m_exp->getCount(); i++) { + AssignmentExpressionPtr exp = + dynamic_pointer_cast((*m_exp)[i]); + ConstantExpressionPtr var = + dynamic_pointer_cast(exp->getVariable()); + TypePtr type = scope->getConstants()->getFinalType(var->getName()); + ExpressionPtr value = exp->getValue(); + if (!scope->getConstants()->isDynamic(var->getName()) == lazyInit) { + continue; + } + switch (cg.getContext()) { + case CodeGenerator::CppClassConstantsDecl: + cg.printf("extern const "); + if (type->is(Type::KindOfString)) { + cg.printf("StaticString"); + } else { + type->outputCPPDecl(cg, ar); + } + cg.printf(" %s%s_%s;\n", Option::ClassConstantPrefix, + scope->getId().c_str(), + var->getName().c_str()); + break; + case CodeGenerator::CppClassConstantsImpl: + cg.printf("const "); + if (type->is(Type::KindOfString)) { + cg.printf("StaticString"); + } else { + type->outputCPPDecl(cg, ar); + } + cg.printf(" %s%s_%s = ", Option::ClassConstantPrefix, + scope->getId().c_str(), + var->getName().c_str()); + value->outputCPP(cg, ar); + cg.printf(";\n"); + break; + case CodeGenerator::CppLazyStaticInitializer: + cg.printf("g->%s%s_%s = ", Option::ClassConstantPrefix, + scope->getId().c_str(), + var->getName().c_str()); + value->outputCPP(cg, ar); + cg.printf(";\n"); + break; + default: + ASSERT(false); + } + } +} diff --git a/src/lib/statement/class_constant.h b/src/lib/statement/class_constant.h new file mode 100644 index 0000000000000..1637c862cf12c --- /dev/null +++ b/src/lib/statement/class_constant.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CLASS_CONSTANT_H__ +#define __CLASS_CONSTANT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(ClassConstant); + +class ClassConstant : public Statement, public IParseHandler { +public: + ClassConstant(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionListPtr exp); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + + // implementing IParseHandler + virtual void onParse(AnalysisResultPtr ar); + +private: + ExpressionListPtr m_exp; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CLASS_CONSTANT_H__ diff --git a/src/lib/statement/class_statement.cpp b/src/lib/statement/class_statement.cpp new file mode 100644 index 0000000000000..dbcaa571c300e --- /dev/null +++ b/src/lib/statement/class_statement.cpp @@ -0,0 +1,752 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ClassStatement::ClassStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + int type, const std::string &name, const std::string &parent, + ExpressionListPtr base, StatementListPtr stmt) + : InterfaceStatement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES, + name, base, stmt), m_type(type) { + m_parent = Util::toLower(parent); +} + +StatementPtr ClassStatement::clone() { + ClassStatementPtr stmt(new ClassStatement(*this)); + stmt->m_stmt = Clone(m_stmt); + stmt->m_base = Clone(m_base); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void ClassStatement::onParse(AnalysisResultPtr ar) { + ClassScope::KindOf kindOf = ClassScope::KindOfObjectClass; + switch (m_type) { + case T_CLASS: kindOf = ClassScope::KindOfObjectClass; break; + case T_ABSTRACT: kindOf = ClassScope::KindOfAbstractClass; break; + case T_FINAL: kindOf = ClassScope::KindOfFinalClass; break; + default: + ASSERT(false); + } + + vector bases; + if (!m_parent.empty()) bases.push_back(m_parent); + if (m_base) m_base->getStrings(bases); + StatementPtr stmt = dynamic_pointer_cast(shared_from_this()); + ClassScopePtr classScope(new ClassScope(kindOf, m_originalName, m_parent, + bases, stmt, ar->getFileScope())); + m_classScope = classScope; + ar->getFileScope()->addClass(ar, classScope); + ar->recordClassSource(m_name, ar->getFileScope()->getName()); + + if (m_stmt) { + ar->pushScope(classScope); + bool seenConstruct = false; + for (int i = 0; i < m_stmt->getCount(); i++) { + MethodStatementPtr meth = + dynamic_pointer_cast((*m_stmt)[i]); + if (meth && meth->getName() == "__construct") { + seenConstruct = true; + break; + } + } + for (int i = 0; i < m_stmt->getCount(); i++) { + if (!seenConstruct) { + MethodStatementPtr meth = + dynamic_pointer_cast((*m_stmt)[i]); + if (meth && classScope && meth->getName() == classScope->getName() + && !meth->getModifiers()->isStatic()) { + // class-name constructor + classScope->setAttribute(ClassScope::classNameConstructor); + } + } + IParseHandlerPtr ph = dynamic_pointer_cast((*m_stmt)[i]); + ph->onParse(ar); + } + ar->popScope(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +std::string ClassStatement::getName() const { + return string("Class ") + m_classScope.lock()->getName(); +} + +void ClassStatement::analyzeProgram(AnalysisResultPtr ar) { + vector bases; + if (!m_parent.empty()) bases.push_back(m_parent); + if (m_base) m_base->getStrings(bases); + for (unsigned int i = 0; i < bases.size(); i++) { + string className = bases[i]; + addUserClass(ar, bases[i]); + } + + ClassScopePtr classScope = m_classScope.lock(); + if (hasHphpNote("Volatile")) classScope->setVolatile(); + FunctionScopePtr func = ar->getFunctionScope(); + // redeclared classes are automatically volatile + if (classScope->isVolatile()) { + func->getVariables()->setAttribute(VariableTable::NeedGlobalPointer); + } + if (m_stmt) { + ar->pushScope(classScope); + m_stmt->analyzeProgram(ar); + ar->popScope(); + } + DependencyGraphPtr dependencies = ar->getDependencyGraph(); + for (unsigned int i = 0; i < bases.size(); i++) { + ClassScopePtr cls = ar->findClass(bases[i]); + if (cls) { + if (dependencies->checkCircle(DependencyGraph::KindOfClassDerivation, + m_originalName, + cls->getOriginalName())) { + ClassScopePtr classScope = m_classScope.lock(); + ar->getCodeError()->record(CodeError::InvalidDerivation, + shared_from_this(), ConstructPtr(), + cls->getOriginalName()); + m_parent = ""; + m_base = ExpressionListPtr(); + classScope->clearBases(); + } else if (cls->isUserClass()) { + dependencies->add(DependencyGraph::KindOfClassDerivation, + ar->getName(), + m_originalName, shared_from_this(), + cls->getOriginalName(), cls->getStmt()); + } + } + } +} + +StatementPtr ClassStatement::preOptimize(AnalysisResultPtr ar) { + return InterfaceStatement::preOptimize(ar); +} + +StatementPtr ClassStatement::postOptimize(AnalysisResultPtr ar) { + return InterfaceStatement::postOptimize(ar); +} + +void ClassStatement::inferTypes(AnalysisResultPtr ar) { + if (m_stmt) { + ClassScopePtr classScope = m_classScope.lock(); + ar->pushScope(classScope); + m_stmt->inferTypes(ar); + ar->popScope(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ClassStatement::getAllParents(AnalysisResultPtr ar, + std::vector &names) { + if (!m_parent.empty()) { + ClassScopePtr cls = ar->findClass(m_parent); + if (cls) { + cls->getAllParents(ar, names); + names.push_back(m_parent); + } + } + + if (m_base) { + vector bases; + m_base->getStrings(bases); + for (unsigned int i = 0; i < bases.size(); i++) { + ClassScopePtr cls = ar->findClass(bases[i]); + if (cls) { + cls->getAllParents(ar, names); + names.push_back(bases[i]); + } + } + } +} + +void ClassStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + ClassScopePtr classScope = m_classScope.lock(); + if (!classScope->isUserClass()) return; + if (ar) ar->pushScope(classScope); + + switch (m_type) { + case T_CLASS: break; + case T_ABSTRACT: cg.printf("abstract "); break; + case T_FINAL: cg.printf("final "); break; + default: + ASSERT(false); + } + cg.printf("class %s", m_name.c_str()); + + if (!m_parent.empty()) { + cg.printf(" extends %s", m_parent.c_str()); + } + + if (m_base) { + cg.printf(" implements "); + m_base->outputPHP(cg, ar); + } + + cg.indentBegin(" {\n"); + m_classScope.lock()->outputPHP(cg, ar); + if (m_stmt) m_stmt->outputPHP(cg, ar); + cg.indentEnd("}\n"); + + if (ar) ar->popScope(); +} + +bool ClassStatement::hasImpl() const { + ClassScopePtr cls = m_classScope.lock(); + return cls->isVolatile() || + cls->getVariables()->getAttribute(VariableTable::ContainsDynamicStatic); +} + +void ClassStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + ClassScopePtr classScope = m_classScope.lock(); + if (cg.getContext() == CodeGenerator::NoContext) { + if (classScope->isRedeclaring()) { + cg.printf("g->%s%s = ClassStaticsPtr(NEW(%s%s)());\n", + Option::ClassStaticsObjectPrefix, m_name.c_str(), + Option::ClassStaticsPrefix, classScope->getId().c_str()); + } + if (classScope->isVolatile()) { + cg.printf("g->declareClass(\"%s\");\n", + m_name.c_str()); + } + return; + } + + if (cg.getContext() != CodeGenerator::CppForwardDeclaration) { + printSource(cg); + } + + ar->pushScope(classScope); + string clsNameStr = classScope->getId(); + const char *clsName = clsNameStr.c_str(); + bool redeclared = classScope->isRedeclaring(); + switch (cg.getContext()) { + case CodeGenerator::CppForwardDeclaration: + if (Option::GenerateCPPMacros) { + cg.printf("FORWARD_DECLARE_CLASS(%s)\n", clsName); + if (redeclared) { + cg.printf("FORWARD_DECLARE_REDECLARED_CLASS(%s)\n", clsName); + } + } + if (m_stmt) { + cg.setContext(CodeGenerator::CppClassConstantsDecl); + m_stmt->outputCPP(cg, ar); + cg.setContext(CodeGenerator::CppForwardDeclaration); + } + break; + case CodeGenerator::CppDeclaration: + { + ClassScopePtr parCls; + if (!m_parent.empty()) parCls = ar->findClass(m_parent); + cg.printf("class %s%s", Option::ClassPrefix, clsName); + bool derived = false; + if (!m_parent.empty() && classScope->derivesFrom(ar, m_parent)) { + if (parCls->isRedeclaring()) { + cg.printf(" : public DynamicObjectData"); + } else { + cg.printf(" : virtual public %s%s", Option::ClassPrefix, + parCls->getId().c_str()); + } + derived = true; + } + if (m_base) { + for (int i = 0; i < m_base->getCount(); i++) { + ScalarExpressionPtr exp = + dynamic_pointer_cast((*m_base)[i]); + const char *intf = exp->getString().c_str(); + ClassScopePtr intfClassScope = ar->findClass(intf); + if (intfClassScope && classScope->derivesFrom(ar, intf)) { + // temporary fix for inheriting from a re-declaring class + string id = intfClassScope->getId(); + if (!derived) { + derived = true; + cg.printf(" :"); + } else { + cg.printf(","); + } + cg.printf(" virtual public %s%s", Option::ClassPrefix, id.c_str()); + } + } + } + if (!derived) { + const char *op = derived ? "," : " :"; + if (classScope->derivesFromRedeclaring()) { + cg.printf("%s public DynamicObjectData", op); + } else { + cg.printf("%s virtual public ObjectData", op); + } + } + cg.indentBegin(" {\n"); + + if (Option::GenerateCPPMacros) { + vector bases; + getAllParents(ar, bases); + + cg.indentBegin("BEGIN_CLASS_MAP(%s)\n", clsName); + for (unsigned int i = 0; i < bases.size(); i++) { + cg.printf("PARENT_CLASS(%s)\n", bases[i].c_str()); + } + cg.indentEnd("END_CLASS_MAP(%s)\n", clsName); + } + + if (Option::GenerateCPPMacros) { + bool dyn = classScope->derivesFromRedeclaring() == + ClassScope::DirectFromRedeclared; + bool idyn = classScope->derivesFromRedeclaring() == + ClassScope::IndirectFromRedeclared; + bool redec = classScope->isRedeclaring(); + if (!classScope->derivesFromRedeclaring()) { + cg.printf("DECLARE_CLASS(%s, %s, %s)\n", clsName, + m_originalName.c_str(), + m_parent.empty() ? "ObjectData" : m_parent.c_str()); + } else { + cg.printf("DECLARE_DYNAMIC_CLASS(%s, %s)\n", clsName, + m_originalName.c_str()); + } + if (cg.getOutput() == CodeGenerator::SystemCPP || + Option::EnableEval >= Option::LimitedEval) { + cg.printf("DECLARE_INVOKES_FROM_EVAL\n"); + } + if (dyn || idyn || redec) { + if (redec) { + + cg.indentBegin("Variant %sroot_invoke(const char* s, CArrRef ps, " + "int64 h, bool f = true) {\n", + Option::ObjectPrefix); + cg.printf("return root->%sinvoke(s, ps, h, f);\n", + Option::ObjectPrefix); + cg.indentEnd("}\n"); + cg.indentBegin("Variant %sroot_invoke_few_args(const char* s, " + "int64 h, int count", Option::ObjectPrefix); + for (int i = 0; i < Option::InvokeFewArgsCount; i++) { + cg.printf(", CVarRef a%d = null_variant", i); + } + cg.printf(") {\n"); + cg.printf("return root->%sinvoke_few_args(s, h, count", + Option::ObjectPrefix); + for (int i = 0; i < Option::InvokeFewArgsCount; i++) { + cg.printf(", a%d", i); + } + cg.printf(");\n"); + cg.indentEnd("}\n"); + if (!dyn && !idyn) cg.printf("private: ObjectData* root;\n"); + cg.printf("public:\n"); + } + + string conInit = ":"; + if (dyn) { + conInit += "DynamicObjectData(\"" + m_parent + "\", r)"; + } else if (idyn) { + conInit += string(Option::ClassPrefix) + parCls->getId() + + "(r?r:this)"; + } else { + conInit += "root(r?r:this)"; + } + + cg.printf("%s%s(ObjectData* r = NULL)%s {}\n", + Option::ClassPrefix, clsName, + conInit.c_str()); + } + } + + cg.printf("void init();\n", + Option::ClassPrefix, clsName); + + if (classScope->needLazyStaticInitializer()) { + cg.printf("static GlobalVariables *lazy_initializer" + "(GlobalVariables *g);\n"); + } + + if (!classScope->derivesFromRedeclaring()){ + classScope->getVariables()->outputCPPPropertyDecl(cg, ar); + } + + if (!classScope->getAttribute(ClassScope::HasConstructor)) { + FunctionScopePtr func = classScope->findFunction(ar, "__construct", + false); + if (func && !func->isAbstract() && !classScope->isInterface()) { + ar->pushScope(func); + func->outputCPPCreateDecl(cg, ar); + ar->popScope(); + } + } + if (classScope->getAttribute(ClassScope::HasDestructor)) { + cg.printf("public: virtual void destruct();\n"); + } + + // doCall + if (classScope->getAttribute(ClassScope::HasUnknownMethodHandler)) { + cg.printf("Variant doCall(Variant v_name, Variant v_arguments, " + "bool fatal);\n"); + } + + if (m_stmt) m_stmt->outputCPP(cg, ar); + { + set done; + classScope->outputCPPStaticMethodWrappers(cg, ar, done, clsName); + } + + cg.indentEnd("};\n"); + + if (redeclared) { + cg.indentBegin("class %s%s : public ClassStatics {\n", + Option::ClassStaticsPrefix, clsName); + cg.printf("public:\n"); + cg.printf("DECLARE_OBJECT_ALLOCATION(%s%s);\n", + Option::ClassStaticsPrefix, clsName); + cg.printf("%s%s() : ClassStatics(%d) {}\n", + Option::ClassStaticsPrefix, clsName, + classScope->getRedeclaringId()); + cg.indentBegin("Variant %sget(const char *s, int64 hash = -1) {\n", + Option::ObjectStaticPrefix); + cg.printf("return %s%s::%sget(s, hash);\n", Option::ClassPrefix, + clsName, Option::ObjectStaticPrefix); + cg.indentEnd("}\n"); + cg.indentBegin("Variant &%slval(const char* s, int64 hash = -1) {\n", + Option::ObjectStaticPrefix); + cg.printf("return %s%s::%slval(s, hash);\n", Option::ClassPrefix, + clsName, Option::ObjectStaticPrefix); + cg.indentEnd("}\n"); + cg.indentBegin("Variant %sinvoke(const char *c, const char *s, " + "CArrRef params, int64 hash = -1, bool fatal = true) " + "{\n", + Option::ObjectStaticPrefix); + cg.printf("return %s%s::%sinvoke(c, s, params, hash, fatal);\n", + Option::ClassPrefix, clsName, + Option::ObjectStaticPrefix); + cg.indentEnd("}\n"); + cg.indentBegin("Object create(CArrRef params, bool init = true, " + "ObjectData* root = NULL) {\n"); + cg.printf("return Object(%s%s(NEW(%s%s)(root))->" + "dynCreate(params, init));\n", + Option::SmartPtrPrefix, clsName, + Option::ClassPrefix, clsName); + cg.indentEnd("}\n"); + cg.indentBegin("Variant %sconstant(const char* s) {\n", + Option::ObjectStaticPrefix); + cg.printf("return %s%s::%sconstant(s);\n", Option::ClassPrefix, clsName, + Option::ObjectStaticPrefix); + cg.indentEnd("}\n"); + cg.indentBegin("Variant %sinvoke_from_eval(const char *c, " + "const char *s, Eval::VariableEnvironment &env, " + "const Eval::FunctionCallExpression *call, " + "int64 hash = -1, bool fatal = true) " + "{\n", + Option::ObjectStaticPrefix); + cg.printf("return %s%s::%sinvoke_from_eval(c, s, env, call, hash, " + "fatal);\n", + Option::ClassPrefix, clsName, + Option::ObjectStaticPrefix); + cg.indentEnd("}\n"); + cg.indentEnd("};\n"); + } + } + break; + case CodeGenerator::CppImplementation: + if (m_stmt) { + cg.setContext(CodeGenerator::CppClassConstantsImpl); + m_stmt->outputCPP(cg, ar); + cg.setContext(CodeGenerator::CppImplementation); + } + + classScope->outputCPPSupportMethodsImpl(cg, ar); + + if (redeclared) { + cg.printf("IMPLEMENT_OBJECT_ALLOCATION(%s%s);\n", + Option::ClassStaticsPrefix, clsName); + } + + cg.indentBegin("void %s%s::init() {\n", + Option::ClassPrefix, clsName); + if (!m_parent.empty()) { + if (classScope->derivesFromRedeclaring() == + ClassScope::DirectFromRedeclared) { + cg.printf("parent->init();\n"); + } else { + cg.printf("%s%s::init();\n", Option::ClassPrefix, m_parent.c_str()); + } + } + cg.setContext(CodeGenerator::CppConstructor); + if (m_stmt) m_stmt->outputCPP(cg, ar); + cg.indentEnd("}\n"); + + if (classScope->needStaticInitializer()) { + cg.indentBegin("void %s%s::os_static_initializer() {\n", + Option::ClassPrefix, clsName); + cg.printDeclareGlobals(); + cg.setContext(CodeGenerator::CppStaticInitializer); + if (m_stmt) m_stmt->outputCPP(cg, ar); + cg.indentEnd("}\n"); + cg.indentBegin("void %s%s() {\n", + Option::ClassStaticInitializerPrefix, clsName); + cg.printf("%s%s::os_static_initializer();\n", Option::ClassPrefix, + clsName); + cg.indentEnd("}\n"); + } + if (classScope->needLazyStaticInitializer()) { + cg.indentBegin("GlobalVariables *%s%s::lazy_initializer(" + "GlobalVariables *g) {\n", Option::ClassPrefix, clsName); + cg.indentBegin("if (!g->%s%s) {\n", + Option::ClassStaticInitializerFlagPrefix, clsName); + cg.printf("g->%s%s = true;\n", Option::ClassStaticInitializerFlagPrefix, + clsName); + cg.setContext(CodeGenerator::CppLazyStaticInitializer); + if (m_stmt) m_stmt->outputCPP(cg, ar); + cg.indentEnd("}\n"); + cg.printf("return g;\n"); + cg.indentEnd("}\n"); + } + cg.setContext(CodeGenerator::CppImplementation); + if (m_stmt) m_stmt->outputCPP(cg, ar); + + break; + case CodeGenerator::CppFFIDecl: + case CodeGenerator::CppFFIImpl: + if (m_stmt) m_stmt->outputCPP(cg, ar); + break; + case CodeGenerator::JavaFFI: + { + if (classScope->isRedeclaring()) break; + + // TODO support PHP namespaces, once HPHP supports it + string packageName = Option::JavaFFIRootPackage; + string packageDir = packageName; + Util::replaceAll(packageDir, ".", "/"); + + string outputDir = ar->getOutputPath() + "/" + Option::FFIFilePrefix + + packageDir + "/"; + Util::mkdir(outputDir); + + // uses a different cg to generate a separate file for each PHP class + // also, uses the original capitalized class name + string clsFile = outputDir + getOriginalName() + ".java"; + ofstream fcls(clsFile.c_str()); + CodeGenerator cgCls(&fcls, CodeGenerator::FileCPP); + cgCls.setContext(CodeGenerator::JavaFFI); + + cgCls.printf("package %s;\n\n", packageName.c_str()); + cgCls.printf("import hphp.*;\n\n"); + + printSource(cgCls); + + string clsModifier; + switch (m_type) { + case T_CLASS: + break; + case T_ABSTRACT: + clsModifier = "abstract "; + break; + case T_FINAL: + clsModifier = "final "; + break; + } + cgCls.printf("public %sclass %s ", clsModifier.c_str(), + getOriginalName().c_str()); + + ClassScopePtr parCls; + if (!m_parent.empty()) parCls = ar->findClass(m_parent); + if (!m_parent.empty() && classScope->derivesFrom(ar, m_parent) + && parCls->isUserClass() && !parCls->isRedeclaring()) { + // system classes are not supported in static FFI translation + // they shouldn't appear as superclasses as well + cgCls.printf("extends %s", parCls->getOriginalName()); + } + else { + cgCls.printf("extends HphpObject"); + } + if (m_base) { + bool first = true; + for (int i = 0; i < m_base->getCount(); i++) { + ScalarExpressionPtr exp = + dynamic_pointer_cast((*m_base)[i]); + const char *intf = exp->getString().c_str(); + ClassScopePtr intfClassScope = ar->findClass(intf); + if (intfClassScope && classScope->derivesFrom(ar, intf) + && intfClassScope->isUserClass()) { + if (first) { + cgCls.printf(" implements "); + first = false; + } + else { + cgCls.printf(", "); + } + cgCls.printf(intfClassScope->getOriginalName()); + } + } + } + + cgCls.indentBegin(" {\n"); + + // constructor for initializing the variant pointer + cgCls.printf("protected %s(long ptr) { super(ptr); }\n\n", + getOriginalName().c_str()); + + FunctionScopePtr cons = classScope->findConstructor(ar, true); + if (cons && !cons->isAbstract() || m_type != T_ABSTRACT) { + // if not an abstract class and not having an explicit constructor, + // adds a default constructor + outputJavaFFIConstructor(cgCls, ar, cons); + } + + if (m_stmt) m_stmt->outputCPP(cgCls, ar); + cgCls.indentEnd("}\n"); + + fcls.close(); + } + break; + case CodeGenerator::JavaFFICppDecl: + case CodeGenerator::JavaFFICppImpl: + { + if (classScope->isRedeclaring()) break; + + if (m_stmt) m_stmt->outputCPP(cg, ar); + FunctionScopePtr cons = classScope->findConstructor(ar, true); + if (cons && !cons->isAbstract() || m_type != T_ABSTRACT) { + outputJavaFFICPPCreator(cg, ar, cons); + } + } + break; + default: + ASSERT(false); + break; + } + + ar->popScope(); +} + +void ClassStatement::outputJavaFFIConstructor(CodeGenerator &cg, + AnalysisResultPtr ar, + FunctionScopePtr cons) { + int ac = cons ? cons->getMaxParamCount() : 0; + bool varArgs = cons && cons->isVariableArgument(); + + // generates the constructor + cg.printf("public %s(", getOriginalName().c_str()); + ostringstream args; + ostringstream params; + bool first = true; + for (int i = 0; i < ac; i++) { + if (first) { + first = false; + } + else { + cg.printf(", "); + args << ", "; + params << ", "; + } + cg.printf("HphpVariant a%d", i); + args << "a" << i << ".getVariantPtr()"; + params << "long a" << i; + } + if (varArgs) { + if (!first) { + cg.printf(", "); + args << ", "; + params << ", "; + } + cg.printf("HphpVariant va"); + args << "va.getVariantPtr()"; + params << "long va"; + } + cg.indentBegin(") {\n"); + cg.printf("this(create(%s));\n", args.str().c_str()); + cg.indentEnd("}\n\n"); + + // generates the native method stub for creating the object + cg.printf("private static native long create(%s);\n\n", + params.str().c_str()); +} + +void ClassStatement::outputJavaFFICPPCreator(CodeGenerator &cg, + AnalysisResultPtr ar, + FunctionScopePtr cons) { + ClassScopePtr cls = m_classScope.lock(); + string packageName = Option::JavaFFIRootPackage; + int ac = cons ? cons->getMaxParamCount() : 0; + bool varArgs = cons && cons->isVariableArgument(); + const char *clsName = getOriginalName().c_str(); + + string mangledName = "Java_" + packageName + "_" + clsName + "_create"; + Util::replaceAll(mangledName, ".", "_"); + + cg.printf("JNIEXPORT jlong JNICALL\n"); + cg.printf("%s(JNIEnv *env, jclass cls", mangledName.c_str()); + + ostringstream args; + bool first = true; + if (varArgs) { + args << ac << " + (((Variant *)va)->isNull() ? 0" + << " : ((Variant *)va)->getArrayData()->size())"; + first = false; + } + for (int i = 0; i < ac; i++) { + if (first) first = false; + else { + args << ", "; + } + cg.printf(", jlong a%d", i); + args << "*(Variant *)a" << i; + } + if (varArgs) { + if (!first) { + args << ", "; + } + cg.printf(", jlong va"); + args << "((Variant *)va)->toArray()"; + } + + if (cg.getContext() == CodeGenerator::JavaFFICppDecl) { + // java_stubs.h + cg.printf(");\n\n"); + return; + } + + cg.indentBegin(") {\n"); + cg.printf("ObjectData *obj = "); + cg.printf("(NEW(%s%s)())->create(%s);\n", + Option::ClassPrefix, cls->getId().c_str(), args.str().c_str()); + cg.printf("obj->incRefCount();\n"); + cg.printf("return (jlong)(NEW(Variant)(obj));\n"); + cg.indentEnd("}\n\n"); +} diff --git a/src/lib/statement/class_statement.h b/src/lib/statement/class_statement.h new file mode 100644 index 0000000000000..1ba2c2babc184 --- /dev/null +++ b/src/lib/statement/class_statement.h @@ -0,0 +1,57 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CLASS_STATEMENT_H__ +#define __CLASS_STATEMENT_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ClassStatement); + +class ClassStatement : public InterfaceStatement { +public: + ClassStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + int type, const std::string &name, + const std::string &parent, ExpressionListPtr base, + StatementListPtr stmt); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return true; } + virtual bool hasImpl() const; + + // implementing IParseHandler + virtual void onParse(AnalysisResultPtr ar); + + virtual std::string getName() const; + virtual void getAllParents(AnalysisResultPtr ar, + std::vector &names); +private: + int m_type; + std::string m_parent; + + void outputJavaFFIConstructor(CodeGenerator &cg, AnalysisResultPtr ar, + FunctionScopePtr cons); + void outputJavaFFICPPCreator(CodeGenerator &cg, AnalysisResultPtr ar, + FunctionScopePtr cons); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CLASS_STATEMENT_H__ diff --git a/src/lib/statement/class_variable.cpp b/src/lib/statement/class_variable.cpp new file mode 100644 index 0000000000000..3959935b73153 --- /dev/null +++ b/src/lib/statement/class_variable.cpp @@ -0,0 +1,253 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ClassVariable::ClassVariable +(STATEMENT_CONSTRUCTOR_PARAMETERS, + ModifierExpressionPtr modifiers, ExpressionListPtr declaration) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_modifiers(modifiers), m_declaration(declaration) { +} + +StatementPtr ClassVariable::clone() { + ClassVariablePtr stmt(new ClassVariable(*this)); + stmt->m_modifiers = Clone(m_modifiers); + stmt->m_declaration = Clone(m_declaration); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void ClassVariable::onParse(AnalysisResultPtr ar) { + ModifierExpressionPtr modifiers = + ar->getScope()->setModifiers(m_modifiers); + + for (int i = 0; i < m_declaration->getCount(); i++) { + VariableTablePtr variables = ar->getScope()->getVariables(); + ExpressionPtr exp = (*m_declaration)[i]; + if (exp->is(Expression::KindOfAssignmentExpression)) { + AssignmentExpressionPtr assignment = + dynamic_pointer_cast(exp); + ExpressionPtr var = assignment->getVariable(); + const std::string &name = + dynamic_pointer_cast(var)->getName(); + if (variables->isPresent(name)) { + ar->getCodeError()->record(CodeError::DeclaredVariableTwice, exp); + } + IParseHandlerPtr ph = dynamic_pointer_cast(exp); + ph->onParse(ar); + } else { + const std::string &name = + dynamic_pointer_cast(exp)->getName(); + if (variables->isPresent(name)) { + ar->getCodeError()->record(CodeError::DeclaredVariableTwice, exp); + } + variables->add(name, TypePtr(), false, ar, exp, m_modifiers); + } + } + + ar->getScope()->setModifiers(modifiers); +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ClassVariable::analyzeProgram(AnalysisResultPtr ar) { + m_declaration->analyzeProgram(ar); +} + +StatementPtr ClassVariable::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_modifiers); + ar->preOptimize(m_declaration); + return StatementPtr(); +} + +StatementPtr ClassVariable::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_modifiers); + ar->postOptimize(m_declaration); + return StatementPtr(); +} + +void ClassVariable::inferTypes(AnalysisResultPtr ar) { + m_declaration->inferAndCheck(ar, NEW_TYPE(Some), false); + + if (m_modifiers->isStatic()) { + ClassScopePtr scope = ar->getClassScope(); + for (int i = 0; i < m_declaration->getCount(); i++) { + ExpressionPtr exp = (*m_declaration)[i]; + if (exp->is(Expression::KindOfAssignmentExpression)) { + scope->setNeedStaticInitializer(); + AssignmentExpressionPtr assignment = + dynamic_pointer_cast(exp); + // If the class variable's type is Object, we have to + // force it to be a Variant, because we don't include + // the class header files in global_variables.h + SimpleVariablePtr var = + dynamic_pointer_cast(assignment->getVariable()); + if (var) { + TypePtr type = scope->getVariables()->getFinalType(var->getName()); + if (type->is(Type::KindOfObject)) { + scope->getVariables()->forceVariant(ar, var->getName()); + } + } + ExpressionPtr value = assignment->getValue(); + if (value->containsDynamicConstant(ar)) { + scope->getVariables()-> + setAttribute(VariableTable::ContainsDynamicStatic); + } + } else { + SimpleVariablePtr var = dynamic_pointer_cast(exp); + TypePtr type = scope->getVariables()->getFinalType(var->getName()); + // If the class variable's type is Object, we have to + // force it to be a Variant, because we don't include + // the class header files in global_variables.h + if (type->is(Type::KindOfObject)) { + scope->getVariables()->forceVariant(ar, var->getName()); + } + const char *initializer = type->getCPPInitializer(); + if (initializer) scope->setNeedStaticInitializer(); + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ClassVariable::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + m_modifiers->outputPHP(cg, ar); + cg.printf(" "); + m_declaration->outputPHP(cg, ar); + cg.printf(";\n"); +} + +void ClassVariable::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + ClassScopePtr scope = ar->getClassScope(); + bool derivFromRedec = scope->derivesFromRedeclaring(); + for (int i = 0; i < m_declaration->getCount(); i++) { + ExpressionPtr exp = (*m_declaration)[i]; + + SimpleVariablePtr var; + TypePtr type; + + switch (cg.getContext()) { + case CodeGenerator::CppConstructor: + if (m_modifiers->isStatic()) continue; + + if (exp->is(Expression::KindOfAssignmentExpression)) { + AssignmentExpressionPtr assignment = + dynamic_pointer_cast(exp); + + var = dynamic_pointer_cast(assignment->getVariable()); + ExpressionPtr value = assignment->getValue(); + if (derivFromRedec) { + cg.printf("%sset(\"%s\",-1, ", Option::ObjectPrefix, + var->getName().c_str()); + value->outputCPP(cg, ar); + cg.printf(")"); + } else { + cg.printf("%s%s = ", Option::PropertyPrefix, var->getName().c_str()); + value->outputCPP(cg, ar); + } + cg.printf(";\n"); + } else { + var = dynamic_pointer_cast(exp); + if (derivFromRedec) { + cg.printf("%sset(\"%s\",-1, null);\n", Option::ObjectPrefix, + var->getName().c_str()); + } else { + type = scope->getVariables()->getFinalType(var->getName()); + const char *initializer = type->getCPPInitializer(); + if (initializer) { + cg.printf("%s%s = %s;\n", Option::PropertyPrefix, + var->getName().c_str(), initializer); + } + } + } + break; + + case CodeGenerator::CppStaticInitializer: + { + if (!m_modifiers->isStatic()) continue; + + VariableTablePtr variables = scope->getVariables(); + if (exp->is(Expression::KindOfAssignmentExpression)) { + AssignmentExpressionPtr assignment = + dynamic_pointer_cast(exp); + + var = dynamic_pointer_cast(assignment->getVariable()); + ExpressionPtr value = assignment->getValue(); + if (!value->isScalar()) continue; + cg.printf("g->%s%s%s%s = ", + Option::StaticPropertyPrefix, scope->getId().c_str(), + Option::IdPrefix.c_str(), var->getName().c_str()); + + + value->outputCPP(cg, ar); + } else { + var = dynamic_pointer_cast(exp); + type = scope->getVariables()->getFinalType(var->getName()); + const char *initializer = type->getCPPInitializer(); + if (initializer) { + cg.printf("g->%s%s%s%s = %s", + Option::StaticPropertyPrefix, scope->getId().c_str(), + Option::IdPrefix.c_str(), var->getName().c_str(), + initializer); + } + } + cg.printf(";\n"); + } + break; + case CodeGenerator::CppLazyStaticInitializer: + { + if (!m_modifiers->isStatic()) continue; + if (!exp->is(Expression::KindOfAssignmentExpression)) continue; + VariableTablePtr variables = scope->getVariables(); + AssignmentExpressionPtr assignment = + dynamic_pointer_cast(exp); + var = dynamic_pointer_cast(assignment->getVariable()); + ExpressionPtr value = assignment->getValue(); + if (value->isScalar()) continue; + cg.printf("g->%s%s%s%s = ", + Option::StaticPropertyPrefix, scope->getId().c_str(), + Option::IdPrefix.c_str(), var->getName().c_str()); + value->outputCPP(cg, ar); + cg.printf(";\n"); + } + break; + default: + break; + } + } +} diff --git a/src/lib/statement/class_variable.h b/src/lib/statement/class_variable.h new file mode 100644 index 0000000000000..7572f31a12527 --- /dev/null +++ b/src/lib/statement/class_variable.h @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CLASS_VARIABLE_H__ +#define __CLASS_VARIABLE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ModifierExpression); +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(ClassVariable); + +class ClassVariable : public Statement, public IParseHandler { +public: + ClassVariable(STATEMENT_CONSTRUCTOR_PARAMETERS, + ModifierExpressionPtr modifiers, + ExpressionListPtr declaration); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + + // implementing IParseHandler + virtual void onParse(AnalysisResultPtr ar); + +private: + ModifierExpressionPtr m_modifiers; + ExpressionListPtr m_declaration; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CLASS_VARIABLE_H__ diff --git a/src/lib/statement/continue_statement.cpp b/src/lib/statement/continue_statement.cpp new file mode 100644 index 0000000000000..80e586c87fbe6 --- /dev/null +++ b/src/lib/statement/continue_statement.cpp @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ContinueStatement::ContinueStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp) + : BreakStatement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES, exp) { + m_name = "continue"; +} + +StatementPtr ContinueStatement::clone() { + ContinueStatementPtr stmt(new ContinueStatement(*this)); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions diff --git a/src/lib/statement/continue_statement.h b/src/lib/statement/continue_statement.h new file mode 100644 index 0000000000000..962df7540e1bf --- /dev/null +++ b/src/lib/statement/continue_statement.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CONTINUE_STATEMENT_H__ +#define __CONTINUE_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ContinueStatement); + +class ContinueStatement : public BreakStatement { +public: + ContinueStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp); + virtual StatementPtr clone(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __CONTINUE_STATEMENT_H__ diff --git a/src/lib/statement/do_statement.cpp b/src/lib/statement/do_statement.cpp new file mode 100644 index 0000000000000..4a5f889a24f4d --- /dev/null +++ b/src/lib/statement/do_statement.cpp @@ -0,0 +1,112 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +DoStatement::DoStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + StatementPtr stmt, ExpressionPtr condition) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_stmt(stmt), m_condition(condition) { +} + +StatementPtr DoStatement::clone() { + DoStatementPtr stmt(new DoStatement(*this)); + stmt->m_stmt = Clone(m_stmt); + stmt->m_condition = Clone(m_condition); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void DoStatement::analyzeProgram(AnalysisResultPtr ar) { + if (m_stmt) m_stmt->analyzeProgram(ar); + m_condition->analyzeProgram(ar); +} + +StatementPtr DoStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_stmt); + ar->preOptimize(m_condition); + return StatementPtr(); +} + +StatementPtr DoStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_stmt); + ar->postOptimize(m_condition); + return StatementPtr(); +} + +void DoStatement::inferTypes(AnalysisResultPtr ar) { + if (m_stmt) { + ar->getScope()->incLoopNestedLevel(); + m_stmt->inferTypes(ar); + m_condition->inferAndCheck(ar, Type::Boolean, false); + ar->getScope()->decLoopNestedLevel(); + } else { + m_condition->inferAndCheck(ar, Type::Boolean, false); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void DoStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("do "); + if (m_stmt) { + m_stmt->outputPHP(cg, ar); + } else { + cg.printf("{}\n"); + } + cg.printf("while ("); + m_condition->outputPHP(cg, ar); + cg.printf(");\n"); +} + +void DoStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.indentBegin("{\n"); + int labelId = cg.createNewId(ar); + cg.pushBreakScope(labelId); + + cg.indentBegin("do {\n"); + cg.printf("LOOP_COUNTER_CHECK(%d);\n", labelId); + if (m_stmt) { + m_stmt->outputCPP(cg, ar); + } + if (cg.findLabelId("continue", labelId)) { + cg.printf("continue%d:;\n", labelId); + } + cg.indentEnd("} while ("); + m_condition->outputCPP(cg, ar); + cg.printf(");\n"); + if (cg.findLabelId("break", labelId)) { + cg.printf("break%d:;\n", labelId); + } + cg.indentEnd("}\n"); + cg.popBreakScope(); +} diff --git a/src/lib/statement/do_statement.h b/src/lib/statement/do_statement.h new file mode 100644 index 0000000000000..82b4b067bebd6 --- /dev/null +++ b/src/lib/statement/do_statement.h @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __DO_STATEMENT_H__ +#define __DO_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(DoStatement); + +class DoStatement : public Statement { +public: + DoStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + StatementPtr stmt, ExpressionPtr condition); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return m_stmt && m_stmt->hasDecl(); } + virtual bool hasRetExp() const { return m_stmt && m_stmt->hasRetExp(); } + virtual int getRecursiveCount() const { + return 1 + (m_stmt ? m_stmt->getRecursiveCount() : 0); + } + +private: + StatementPtr m_stmt; + ExpressionPtr m_condition; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __DO_STATEMENT_H__ diff --git a/src/lib/statement/echo_statement.cpp b/src/lib/statement/echo_statement.cpp new file mode 100644 index 0000000000000..3bc18bd69d5c2 --- /dev/null +++ b/src/lib/statement/echo_statement.cpp @@ -0,0 +1,81 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +EchoStatement::EchoStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionListPtr exp) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_exp(exp) { +} + +StatementPtr EchoStatement::clone() { + EchoStatementPtr stmt(new EchoStatement(*this)); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void EchoStatement::analyzeProgram(AnalysisResultPtr ar) { + for (int i = 0; i < m_exp->getCount(); i++) { + (*m_exp)[i]->analyzeProgram(ar); + } +} + +StatementPtr EchoStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + return StatementPtr(); +} + +StatementPtr EchoStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return StatementPtr(); +} + +void EchoStatement::inferTypes(AnalysisResultPtr ar) { + m_exp->inferAndCheck(ar, Type::String, false); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void EchoStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("echo "); + m_exp->outputPHP(cg, ar); + cg.printf(";\n"); +} + +void EchoStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_exp->getCount() > 1) cg.indentBegin("{\n"); + for (int i = 0; i < m_exp->getCount(); i++) { + cg.printf("echo("); + (*m_exp)[i]->outputCPP(cg, ar); + cg.printf(");\n"); + } + if (m_exp->getCount() > 1) cg.indentEnd("}\n"); +} diff --git a/src/lib/statement/echo_statement.h b/src/lib/statement/echo_statement.h new file mode 100644 index 0000000000000..71d262a0b65ac --- /dev/null +++ b/src/lib/statement/echo_statement.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __ECHO_STATEMENT_H__ +#define __ECHO_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(EchoStatement); + +class EchoStatement : public Statement { +public: + EchoStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionListPtr exp); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + +private: + ExpressionListPtr m_exp; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __ECHO_STATEMENT_H__ diff --git a/src/lib/statement/exp_statement.cpp b/src/lib/statement/exp_statement.cpp new file mode 100644 index 0000000000000..835b23e2f63d4 --- /dev/null +++ b/src/lib/statement/exp_statement.cpp @@ -0,0 +1,133 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ExpStatement::ExpStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_exp(exp) { +} + +StatementPtr ExpStatement::clone() { + ExpStatementPtr stmt(new ExpStatement(*this)); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void ExpStatement::analyzeAutoload(AnalysisResultPtr ar) { + if (!m_exp->is(Expression::KindOfAssignmentExpression)) return; + + AssignmentExpressionPtr assign = + dynamic_pointer_cast(m_exp); + if (!assign->getVariable()->is(Expression::KindOfArrayElementExpression)) { + return; + } + if (!assign->getValue()->is(Expression::KindOfScalarExpression) || + !dynamic_pointer_cast + (assign->getValue())->isLiteralString()) { + return; + } + + string file = assign->getValue()->getLiteralString(); + if (file.empty()) return; + + string s = assign->getText(); + string path = Option::getAutoloadRoot(s); + if (path.empty()) return; + + if (path[path.length() - 1] != '/' && file[0] != '/') { + file = path + '/' + file; + } else { + file = path + file; + } + ScalarExpressionPtr exp + (new ScalarExpression(assign->getValue()->getLocation(), + Expression::KindOfScalarExpression, + T_STRING, file, true)); + IncludeExpressionPtr include + (new IncludeExpression(assign->getLocation(), + Expression::KindOfIncludeExpression, + exp, T_INCLUDE_ONCE)); + include->setDocumentRoot(); // autoload always starts from document root + include->onParse(ar); + m_exp = include; +} + +void ExpStatement::analyzeShortCircuit(AnalysisResultPtr ar) { + if (!m_exp->is(Expression::KindOfBinaryOpExpression)) return; + + BinaryOpExpressionPtr exp = dynamic_pointer_cast(m_exp); + if (exp->isShortCircuitOperator()) { + FunctionCallPtr call = dynamic_pointer_cast(exp->getExp2()); + if (call) { + call->setAllowVoidReturn(); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ExpStatement::analyzeProgram(AnalysisResultPtr ar) { + m_exp->analyzeProgram(ar); +} + +StatementPtr ExpStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + return StatementPtr(); +} + +StatementPtr ExpStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return StatementPtr(); +} + +void ExpStatement::inferTypes(AnalysisResultPtr ar) { + m_exp->inferAndCheck(ar, NEW_TYPE(Any), false); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ExpStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + m_exp->outputPHP(cg, ar); + cg.printf(";\n"); +} + +void ExpStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (hasEffect() || Option::KeepStatementsWithNoEffect) { + m_exp->outputCPP(cg, ar); + cg.printf(";\n"); + } +} diff --git a/src/lib/statement/exp_statement.h b/src/lib/statement/exp_statement.h new file mode 100644 index 0000000000000..a9ea33fed4da2 --- /dev/null +++ b/src/lib/statement/exp_statement.h @@ -0,0 +1,52 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXP_STATEMENT_H__ +#define __EXP_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpStatement); + +class ExpStatement : public Statement { +public: + ExpStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + + ExpressionPtr getExpression() { return m_exp;} + virtual bool hasEffect() const { return m_exp->hasEffect();} + + /** + * Change autoload configuration statement to includes. + */ + void analyzeAutoload(AnalysisResultPtr ar); + + /** + * Allow 2nd expression to use void returns. + */ + void analyzeShortCircuit(AnalysisResultPtr ar); + +private: + ExpressionPtr m_exp; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __EXP_STATEMENT_H__ diff --git a/src/lib/statement/for_statement.cpp b/src/lib/statement/for_statement.cpp new file mode 100644 index 0000000000000..4a4ae53c294c7 --- /dev/null +++ b/src/lib/statement/for_statement.cpp @@ -0,0 +1,137 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ForStatement::ForStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr exp1, ExpressionPtr exp2, ExpressionPtr exp3, StatementPtr stmt) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_exp1(exp1), m_exp2(exp2), m_exp3(exp3), m_stmt(stmt) { +} + +StatementPtr ForStatement::clone() { + ForStatementPtr stmt(new ForStatement(*this)); + stmt->m_exp1 = Clone(m_exp1); + stmt->m_exp2 = Clone(m_exp2); + stmt->m_exp3 = Clone(m_exp3); + stmt->m_stmt = Clone(m_stmt); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ForStatement::analyzeProgram(AnalysisResultPtr ar) { + if (m_exp1) m_exp1->analyzeProgram(ar); + if (m_exp2) m_exp2->analyzeProgram(ar); + if (m_exp3) m_exp3->analyzeProgram(ar); + if (m_stmt) m_stmt->analyzeProgram(ar); +} + +StatementPtr ForStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp1); + ar->preOptimize(m_exp2); + ar->preOptimize(m_exp3); + if (m_stmt) { + ar->getScope()->incLoopNestedLevel(); + ar->preOptimize(m_stmt); + ar->getScope()->decLoopNestedLevel(); + } + return StatementPtr(); +} + +StatementPtr ForStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp1); + ar->postOptimize(m_exp2); + ar->postOptimize(m_exp3); + if (m_stmt) { + ar->getScope()->incLoopNestedLevel(); + ar->postOptimize(m_stmt); + ar->getScope()->decLoopNestedLevel(); + } + return StatementPtr(); +} + +void ForStatement::inferTypes(AnalysisResultPtr ar) { + if (m_exp1) m_exp1->inferAndCheck(ar, NEW_TYPE(Any), false); + if (m_exp2) m_exp2->inferAndCheck(ar, Type::Boolean, false); + if (m_stmt) { + ar->getScope()->incLoopNestedLevel(); + m_stmt->inferTypes(ar); + if (m_exp3) m_exp3->inferAndCheck(ar, NEW_TYPE(Any), false); + ar->getScope()->decLoopNestedLevel(); + } else { + if (m_exp3) m_exp3->inferAndCheck(ar, NEW_TYPE(Any), false); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ForStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("for ("); + if (m_exp1) m_exp1->outputPHP(cg, ar); + cg.printf("; "); + if (m_exp2) m_exp2->outputPHP(cg, ar); + cg.printf("; "); + if (m_exp3) m_exp3->outputPHP(cg, ar); + cg.printf(") "); + if (m_stmt) { + m_stmt->outputPHP(cg, ar); + } else { + cg.printf("{}\n"); + } +} + +void ForStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.indentBegin("{\n"); + int labelId = cg.createNewId(ar); + cg.pushBreakScope(labelId); + + cg.printf("for ("); + if (m_exp1 && m_exp1->hasEffect()) m_exp1->outputCPP(cg, ar); + cg.printf("; "); + if (m_exp2) m_exp2->outputCPP(cg, ar); + cg.printf("; "); + if (m_exp3 && m_exp3->hasEffect()) m_exp3->outputCPP(cg, ar); + cg.indentBegin(") {\n"); + cg.printf("LOOP_COUNTER_CHECK(%d);\n", labelId); + if (m_stmt) { + m_stmt->outputCPP(cg, ar); + } + if (cg.findLabelId("continue", labelId)) { + cg.printf("continue%d:;\n", labelId); + } + cg.indentEnd("}\n"); + if (cg.findLabelId("break", labelId)) { + cg.printf("break%d:;\n", labelId); + } + cg.indentEnd("}\n"); + cg.popBreakScope(); +} diff --git a/src/lib/statement/for_statement.h b/src/lib/statement/for_statement.h new file mode 100644 index 0000000000000..533e7b25dddfc --- /dev/null +++ b/src/lib/statement/for_statement.h @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __FOR_STATEMENT_H__ +#define __FOR_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ForStatement); + +class ForStatement : public Statement { +public: + ForStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr exp1, ExpressionPtr exp2, ExpressionPtr exp3, + StatementPtr stmt); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return m_stmt && m_stmt->hasDecl(); } + virtual bool hasRetExp() const { return m_stmt && m_stmt->hasRetExp(); } + virtual int getRecursiveCount() const { + return 1 + (m_stmt ? m_stmt->getRecursiveCount() : 0); + } +private: + ExpressionPtr m_exp1; + ExpressionPtr m_exp2; + ExpressionPtr m_exp3; + StatementPtr m_stmt; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __FOR_STATEMENT_H__ diff --git a/src/lib/statement/foreach_statement.cpp b/src/lib/statement/foreach_statement.cpp new file mode 100644 index 0000000000000..0643d64ceb638 --- /dev/null +++ b/src/lib/statement/foreach_statement.cpp @@ -0,0 +1,247 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ForEachStatement::ForEachStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr array, ExpressionPtr name, bool nameRef, + ExpressionPtr value, bool valueRef, StatementPtr stmt) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_array(array), m_name(name), m_value(value), m_ref(valueRef), + m_stmt(stmt) { + if (!m_value) { + m_value = m_name; + m_ref = nameRef; + m_name.reset(); + } + if (m_name) { + m_name->setContext(Expression::LValue); + m_name->setContext(Expression::NoLValueWrapper); + } + m_value->setContext(Expression::LValue); + m_value->setContext(Expression::NoLValueWrapper); + if (m_ref) { + m_array->setContext(Expression::RefValue); + m_value->setContext(Expression::RefValue); + m_value->setContext(Expression::NoRefWrapper); + } +} + +StatementPtr ForEachStatement::clone() { + ForEachStatementPtr stmt(new ForEachStatement(*this)); + stmt->m_array = Clone(m_array); + stmt->m_name = Clone(m_name); + stmt->m_value = Clone(m_value); + stmt->m_stmt = Clone(m_stmt); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ForEachStatement::analyzeProgram(AnalysisResultPtr ar) { + m_array->analyzeProgram(ar); + if (m_name) m_name->analyzeProgram(ar); + m_value->analyzeProgram(ar); + if (m_stmt) m_stmt->analyzeProgram(ar); +} + +StatementPtr ForEachStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_array); + ar->preOptimize(m_name); + ar->preOptimize(m_value); + ar->preOptimize(m_stmt); + return StatementPtr(); +} + +StatementPtr ForEachStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_array); + ar->postOptimize(m_name); + ar->postOptimize(m_value); + ar->postOptimize(m_stmt); + return StatementPtr(); +} + +void ForEachStatement::inferTypes(AnalysisResultPtr ar) { + if (ar->isFirstPass() && + !m_array->is(Expression::KindOfSimpleVariable) && + !m_array->is(Expression::KindOfArrayElementExpression) && + !m_array->is(Expression::KindOfObjectPropertyExpression)) { + ConstructPtr self = shared_from_this(); + ar->getCodeError()->record(self, CodeError::ComplexForEach, self); + } + + m_array->inferAndCheck(ar, Type::Array, true); + if (m_name) { + m_name->inferAndCheck(ar, NEW_TYPE(Primitive), true); + } + m_value->inferAndCheck(ar, Type::Variant, true); + if (m_stmt) { + ar->getScope()->incLoopNestedLevel(); + m_stmt->inferTypes(ar); + ar->getScope()->decLoopNestedLevel(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ForEachStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("foreach ("); + m_array->outputPHP(cg, ar); + cg.printf(" as "); + if (m_name) { + m_name->outputPHP(cg, ar); + cg.printf(" => "); + } + if (m_ref) cg.printf("&"); + m_value->outputPHP(cg, ar); + cg.printf(") "); + if (m_stmt) { + m_stmt->outputPHP(cg, ar); + } else { + cg.printf("{}\n"); + } +} + +void ForEachStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.indentBegin("{\n"); + int labelId = cg.createNewId(ar); + cg.pushBreakScope(labelId); + + int mapId = cg.createNewId(ar); + bool passTemp; + bool isArray = false; + + if (m_ref) { + passTemp = true; + cg.printf("Variant %s%d = ref(", Option::MapPrefix, mapId); + m_array->outputCPPImpl(cg, ar); + cg.printf(");\n"); + cg.printf("%s%d.escalate();\n", Option::MapPrefix, mapId); + } else if (!m_array->is(Expression::KindOfSimpleVariable) || + m_array->isThis()) { + passTemp = true; + cg.printf("Variant %s%d = ", Option::MapPrefix, mapId); + TypePtr expectedType = m_array->getExpectedType(); + // Clear m_expectedType to avoid type cast (toArray). + m_array->setExpectedType(TypePtr()); + m_array->outputCPP(cg, ar); + m_array->setExpectedType(expectedType); + cg.printf(";\n"); + } else { + passTemp = false; + } + + int iterId = cg.createNewId(ar); + cg.printf("for ("); + if (m_ref) { + cg.printf("MutableArrayIterPtr %s%d = %s%d.begin(", + Option::IterPrefix, iterId, Option::MapPrefix, mapId); + if (m_name) { + cg.printf("&"); + m_name->outputCPP(cg, ar); + } else { + cg.printf("NULL"); + } + cg.printf(", "); + m_value->outputCPP(cg, ar); + cg.printf("); %s%d->advance();", Option::IterPrefix, iterId); + } else { + if (passTemp) { + cg.printf("ArrayIterPtr %s%d = %s%d.begin(", + Option::IterPrefix, iterId, + Option::MapPrefix, mapId); + ClassScopePtr cls = ar->getClassScope(); + if (cls) { + cg.printf("\"%s\"", cls->getName().c_str()); + } + cg.printf("); "); + cg.printf("!%s%d->end(); %s%d->next()", + Option::IterPrefix, iterId, + Option::IterPrefix, iterId); + } else { + TypePtr actualType = m_array->getActualType(); + if (actualType && actualType->is(Type::KindOfArray)) { + isArray = true; + cg.printf("ArrayIter %s%d = ", Option::IterPrefix, iterId); + } else { + cg.printf("ArrayIterPtr %s%d = ", Option::IterPrefix, iterId); + } + TypePtr expectedType = m_array->getExpectedType(); + // Clear m_expectedType to avoid type cast (toArray). + m_array->setExpectedType(TypePtr()); + m_array->outputCPP(cg, ar); + m_array->setExpectedType(expectedType); + cg.printf(".begin("); + ClassScopePtr cls = ar->getClassScope(); + if (cls) { + cg.printf("\"%s\"", cls->getName().c_str()); + } + cg.printf("); "); + if (isArray) { + cg.printf("!%s%d.end(); ", Option::IterPrefix, iterId); + cg.printf("++%s%d", Option::IterPrefix, iterId); + } else { + cg.printf("!%s%d->end(); ", Option::IterPrefix, iterId); + cg.printf("%s%d->next()", Option::IterPrefix, iterId); + } + } + } + cg.indentBegin(") {\n"); + cg.printf("LOOP_COUNTER_CHECK(%d);\n", labelId); + + if (!m_ref) { + m_value->outputCPP(cg, ar); + cg.printf(isArray ? " = %s%d.second();\n" : " = %s%d->second();\n", + Option::IterPrefix, iterId); + if (m_name) { + m_name->outputCPP(cg, ar); + cg.printf(isArray ? " = %s%d.first();\n" : " = %s%d->first();\n", + Option::IterPrefix, iterId); + } + } + if (m_stmt) { + m_stmt->outputCPP(cg, ar); + } + if (cg.findLabelId("continue", labelId)) { + cg.printf("continue%d:;\n", labelId); + } + cg.indentEnd("}\n"); + if (cg.findLabelId("break", labelId)) { + cg.printf("break%d:;\n", labelId); + } + cg.popBreakScope(); + + cg.indentEnd("}\n"); +} diff --git a/src/lib/statement/foreach_statement.h b/src/lib/statement/foreach_statement.h new file mode 100644 index 0000000000000..a4d5a438f1eab --- /dev/null +++ b/src/lib/statement/foreach_statement.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __FOREACH_STATEMENT_H__ +#define __FOREACH_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ForEachStatement); + +class ForEachStatement : public Statement { +public: + ForEachStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr array, ExpressionPtr name, bool nameRef, + ExpressionPtr value, bool valueRef, StatementPtr stmt); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return m_stmt && m_stmt->hasDecl(); } + virtual bool hasRetExp() const { return m_stmt && m_stmt->hasRetExp(); } + virtual int getRecursiveCount() const { + return 1 + (m_stmt ? m_stmt->getRecursiveCount() : 0); + } + +private: + ExpressionPtr m_array; + ExpressionPtr m_name; + ExpressionPtr m_value; + bool m_ref; + StatementPtr m_stmt; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __FOREACH_STATEMENT_H__ diff --git a/src/lib/statement/function_statement.cpp b/src/lib/statement/function_statement.cpp new file mode 100644 index 0000000000000..0f8804f5b29f8 --- /dev/null +++ b/src/lib/statement/function_statement.cpp @@ -0,0 +1,257 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +FunctionStatement::FunctionStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + bool ref, const std::string &name, ExpressionListPtr params, + StatementListPtr stmt, int attr) + : MethodStatement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES, + ModifierExpressionPtr(), ref, name, params, stmt, attr, + false) { +} + +StatementPtr FunctionStatement::clone() { + FunctionStatementPtr stmt(new FunctionStatement(*this)); + stmt->m_stmt = Clone(m_stmt); + stmt->m_params = Clone(m_params); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void FunctionStatement::onParse(AnalysisResultPtr ar) { + // note it's important to add to file scope, not a pushed FunctionContainer, + // as a function may be declared inside a class's method, yet this function + // is a global function, not a class method. + FileScopePtr fileScope = ar->getFileScope(); + fileScope->addFunction(ar, onParseImpl(ar)); + ar->recordFunctionSource(m_name, fileScope->getName()); +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +std::string FunctionStatement::getName() const { + return string("Function ") + m_funcScope.lock()->getName(); +} + +void FunctionStatement::analyzeProgram(AnalysisResultPtr ar) { + // registering myself as a parent in dependency graph, so that + // (1) we can tell orphaned parents + // (2) overwrite non-master copy of function declarations + if (ar->isFirstPass()) { + if (m_loc) { + ar->getDependencyGraph()->addParent(DependencyGraph::KindOfFunctionCall, + "", m_name, shared_from_this()); + } // else it's pseudoMain or artificial functions we added + FunctionScopePtr fs = m_funcScope.lock(); + if (!isFileLevel() && !fs->isIgnored() && + !fs->isRedeclaring()) { + // Dynamic function declaration + // fs->setRedeclaring(0); + } + } + FunctionScopePtr func = ar->getFunctionScope(); // containing function scope + FunctionScopePtr fs = m_funcScope.lock(); + // redeclared functions are automatically volatile + if (fs->isVolatile()) { + func->getVariables()->setAttribute(VariableTable::NeedGlobalPointer); + } + MethodStatement::analyzeProgram(ar); +} + +StatementPtr FunctionStatement::preOptimize(AnalysisResultPtr ar) { + return MethodStatement::preOptimize(ar); +} + +StatementPtr FunctionStatement::postOptimize(AnalysisResultPtr ar) { + return MethodStatement::postOptimize(ar); +} + +void FunctionStatement::inferTypes(AnalysisResultPtr ar) { + MethodStatement::inferTypes(ar); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void FunctionStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + FunctionScopePtr funcScope = m_funcScope.lock(); + if (!funcScope->isUserFunction()) return; + if (ar) ar->pushScope(funcScope); + + cg.printf("function "); + if (m_ref) cg.printf("&"); + cg.printf("%s(", m_name.c_str()); + if (m_params) m_params->outputPHP(cg, ar); + cg.indentBegin(") {\n"); + + m_funcScope.lock()->outputPHP(cg, ar); + if (m_stmt) m_stmt->outputPHP(cg, ar); + cg.indentEnd("}\n"); + + if (ar) ar->popScope(); +} + +bool FunctionStatement::hasImpl() const { + return m_funcScope.lock()->isVolatile(); +} + +void FunctionStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + FunctionScopePtr funcScope = m_funcScope.lock(); + string fname = funcScope->getId().c_str(); + bool pseudoMain = funcScope->inPseudoMain(); + + if (outputFFI(cg, ar)) return; + + if (cg.getContext() == CodeGenerator::NoContext) { + if (funcScope->isRedeclaring()) { + cg.printf("g->%s%s = %s%s;\n", + Option::InvokePrefix, m_name.c_str(), + Option::InvokePrefix, fname.c_str()); + } + if (funcScope->isVolatile()) { + cg.printf("g->declareFunction(\"%s\");\n", + m_name.c_str()); + } + return; + } + + if (cg.getContext() == CodeGenerator::CppDeclaration && + !funcScope->isInlined()) return; + + if (cg.getContext() == CodeGenerator::CppPseudoMain && + !pseudoMain) return; + if (cg.getContext() == CodeGenerator::CppImplementation && + (funcScope->isInlined() || pseudoMain)) return; + ar->pushScope(funcScope); + + if (pseudoMain && !Option::GenerateCPPMain) { + if (cg.getContext() == CodeGenerator::CppPseudoMain) { + if (cg.getOutput() != CodeGenerator::SystemCPP) { + cg.setContext(CodeGenerator::NoContext); // no inner functions/classes + funcScope->getVariables()->setAttribute(VariableTable::ForceGlobal); + outputCPPStmt(cg, ar); + funcScope->getVariables()->clearAttribute(VariableTable::ForceGlobal); + cg.setContext(CodeGenerator::CppPseudoMain); + ar->popScope(); + return; + } + } else if (cg.getContext() == CodeGenerator::CppForwardDeclaration && + cg.getOutput() != CodeGenerator::SystemCPP) { + return; + } + } + + if (cg.getContext() == CodeGenerator::CppImplementation) { + printSource(cg); + } + + if (funcScope->isInlined()) cg.printf("inline "); + + TypePtr type = funcScope->getReturnType(); + if (type) { + type->outputCPPDecl(cg, ar); + } else { + cg.printf("void"); + } + + if (pseudoMain) { + cg.printf(" %s%s(", Option::PseudoMainPrefix, + funcScope->getFileScope()->pseudoMainName().c_str()); + } else { + cg.printf(" %s%s(", Option::FunctionPrefix, fname.c_str()); + } + + CodeGenerator::Context context = cg.getContext(); + switch (context) { + case CodeGenerator::CppForwardDeclaration: + funcScope->outputCPPParamsDecl(cg, ar, m_params, true); + cg.printf(");\n"); + break; + case CodeGenerator::CppDeclaration: + case CodeGenerator::CppImplementation: + case CodeGenerator::CppPseudoMain: + { + funcScope->outputCPPParamsDecl(cg, ar, m_params, false); + cg.indentBegin(") {\n"); + if (pseudoMain) { + cg.printf("FUNCTION_INJECTION(run_init::%s);\n", + funcScope->getFileScope()->getName().c_str()); + cg.indentBegin("{\n"); + cg.printDeclareGlobals(); + cg.printf("bool &alreadyRun = g->run_%s%s;\n", + Option::PseudoMainPrefix, + funcScope->getFileScope()->pseudoMainName().c_str()); + cg.printf("if (alreadyRun) { if (incOnce) return true;}\n"); + cg.printf("else alreadyRun = true;\n"); + cg.printf("if (!variables) variables = g;\n"); + cg.indentEnd("}\n"); + } else { + cg.printf("FUNCTION_INJECTION(%s);\n", + funcScope->getOriginalName().c_str()); + if (Option::GenRTTIProfileData && m_params) { + for (int i = 0; i < m_params->getCount(); i++) { + ParameterExpressionPtr param = + dynamic_pointer_cast((*m_params)[i]); + if (param->hasRTTI()) { + const string ¶mName = param->getName(); + int id = ar->getParamRTTIEntryId(ClassScopePtr(), + funcScope, paramName); + if (id != -1) { + cg.printf("RTTI_INJECTION(%s%s, %d);\n", + Option::VariablePrefix, paramName.c_str(), id); + } + } + } + } + } + funcScope->outputCPP(cg, ar); + cg.setContext(CodeGenerator::NoContext); // no inner functions/classes + outputCPPStmt(cg, ar); + cg.setContext(context); + cg.indentEnd("} /* function */\n"); + } + break; + default: + ASSERT(false); + } + + ar->popScope(); +} diff --git a/src/lib/statement/function_statement.h b/src/lib/statement/function_statement.h new file mode 100644 index 0000000000000..cbcca979426fc --- /dev/null +++ b/src/lib/statement/function_statement.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __FUNCTION_STATEMENT_H__ +#define __FUNCTION_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(FunctionScope); +DECLARE_BOOST_TYPES(FunctionStatement); + +class FunctionStatement : public MethodStatement { +public: + FunctionStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + bool ref, const std::string &name, + ExpressionListPtr params, StatementListPtr stmt, + int attr); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return true; } + virtual bool hasImpl() const; + + virtual std::string getName() const; + + // implementing IParseHandler + virtual void onParse(AnalysisResultPtr ar); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __FUNCTION_STATEMENT_H__ diff --git a/src/lib/statement/global_statement.cpp b/src/lib/statement/global_statement.cpp new file mode 100644 index 0000000000000..14f6a209a1622 --- /dev/null +++ b/src/lib/statement/global_statement.cpp @@ -0,0 +1,149 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +GlobalStatement::GlobalStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionListPtr exp) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_exp(exp), m_dynamicGlobal(false) { +} + +StatementPtr GlobalStatement::clone() { + GlobalStatementPtr stmt(new GlobalStatement(*this)); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void GlobalStatement::analyzeProgram(AnalysisResultPtr ar) { + m_exp->analyzeProgram(ar); +} + +StatementPtr GlobalStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + return StatementPtr(); +} + +StatementPtr GlobalStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return StatementPtr(); +} + +void GlobalStatement::inferTypes(AnalysisResultPtr ar) { + BlockScopePtr scope = ar->getScope(); + scope->getVariables()->setAttribute(VariableTable::InsideGlobalStatement); + for (int i = 0; i < m_exp->getCount(); i++) { + ExpressionPtr exp = (*m_exp)[i]; + if (exp->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = dynamic_pointer_cast(exp); + VariableTablePtr variables = scope->getVariables(); + const std::string &name = var->getName(); + /* If we have already seen this variable in the current scope and + it is not a global variable, record this variable as "redeclared" + which will force Variant type. + */ + variables->checkRedeclared(name, KindOfGlobalStatement); + + /* If this is not a top-level global statement, the variable also + needs to be Variant type. This should not be a common use case in + php code. + */ + if (!isTopLevel()) { + variables->addNestedGlobal(name); + } + var->setContext(Expression::Declaration); + var->inferAndCheck(ar, NEW_TYPE(Any), true); + + if (variables->needLocalCopy(name)) { + variables->forceVariant(ar, name); + variables->setAttribute(VariableTable::NeedGlobalPointer); + } + + ConstructPtr decl = + ar->getVariables()->getDeclaration(var->getName()); + if (decl) { + ar->getDependencyGraph()->add(DependencyGraph::KindOfGlobalVariable, + ar->getName(), + var->getName(), var, + var->getName(), decl); + } + } else { + if (ar->isFirstPass()) { + ar->getCodeError()->record(shared_from_this(), CodeError::UseDynamicGlobal, exp); + } + m_dynamicGlobal = true; + } + } + FunctionScopePtr func = ar->getFunctionScope(); + scope->getVariables()->clearAttribute(VariableTable::InsideGlobalStatement); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void GlobalStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("global "); + m_exp->outputPHP(cg, ar); + cg.printf(";\n"); +} + +void GlobalStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_dynamicGlobal) { + cg.printf("throw_fatal(\"dynamic global\");\n"); + } else if (!ar->getScope()->inPseudoMain() || !isTopLevel()) { + BlockScopePtr scope = ar->getScope(); + if (m_exp->getCount() > 1) cg.indentBegin("{\n"); + for (int i = 0; i < m_exp->getCount(); i++) { + ExpressionPtr exp = (*m_exp)[i]; + if (exp->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = dynamic_pointer_cast(exp); + const string &name = var->getName(); + VariableTablePtr variables = scope->getVariables(); + if (variables->needLocalCopy(name)) { + cg.printf("%s%s = ref(g->%s);\n", + Option::VariablePrefix, name.c_str(), + variables->getGlobalVariableName(ar, name).c_str()); + } + } + else { + // type inference should have set m_dynamicGlobal to true. + ASSERT(false); + } + } + if (m_exp->getCount() > 1) cg.indentEnd("}\n"); + } +} diff --git a/src/lib/statement/global_statement.h b/src/lib/statement/global_statement.h new file mode 100644 index 0000000000000..3764b976f0e55 --- /dev/null +++ b/src/lib/statement/global_statement.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GLOBAL_STATEMENT_H__ +#define __GLOBAL_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(GlobalStatement); + +class GlobalStatement : public Statement { +public: + GlobalStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionListPtr exp); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + +private: + ExpressionListPtr m_exp; + bool m_dynamicGlobal; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __GLOBAL_STATEMENT_H__ diff --git a/src/lib/statement/if_branch_statement.cpp b/src/lib/statement/if_branch_statement.cpp new file mode 100644 index 0000000000000..ae8dbc4a7b5a9 --- /dev/null +++ b/src/lib/statement/if_branch_statement.cpp @@ -0,0 +1,98 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +IfBranchStatement::IfBranchStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr condition, StatementPtr stmt) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_condition(condition), m_stmt(stmt) { +} + +StatementPtr IfBranchStatement::clone() { + IfBranchStatementPtr stmt(new IfBranchStatement(*this)); + stmt->m_condition = Clone(m_condition); + stmt->m_stmt = Clone(m_stmt); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void IfBranchStatement::analyzeProgram(AnalysisResultPtr ar) { + if (m_condition) m_condition->analyzeProgram(ar); + if (m_stmt) m_stmt->analyzeProgram(ar); +} + +StatementPtr IfBranchStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_condition); + ar->preOptimize(m_stmt); + return StatementPtr(); +} + +StatementPtr IfBranchStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_condition); + ar->postOptimize(m_stmt); + return StatementPtr(); +} + +void IfBranchStatement::inferTypes(AnalysisResultPtr ar) { + if (m_condition) m_condition->inferAndCheck(ar, Type::Boolean, false); + if (m_stmt) m_stmt->inferTypes(ar); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void IfBranchStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_condition) { + cg.printf("if ("); + m_condition->outputPHP(cg, ar); + cg.printf(") "); + } else { + cg.printf(" "); + } + if (m_stmt) { + m_stmt->outputPHP(cg, ar); + } else { + cg.printf("{}\n"); + } +} + +void IfBranchStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_condition) { + cg.printf("if ("); + m_condition->outputCPP(cg, ar); + cg.printf(") "); + } + if (m_stmt) { + m_stmt->outputCPP(cg, ar); + } else { + cg.printf("{}\n"); + } +} diff --git a/src/lib/statement/if_branch_statement.h b/src/lib/statement/if_branch_statement.h new file mode 100644 index 0000000000000..b91349a6ebea3 --- /dev/null +++ b/src/lib/statement/if_branch_statement.h @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __IF_BRANCH_STATEMENT_H__ +#define __IF_BRANCH_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(IfBranchStatement); + +class IfBranchStatement : public Statement { +public: + IfBranchStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr condition, StatementPtr stmt); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return m_stmt && m_stmt->hasDecl(); } + virtual bool hasRetExp() const { return m_stmt && m_stmt->hasRetExp(); } + virtual int getRecursiveCount() const { + return m_stmt ? m_stmt->getRecursiveCount() : 0; + } + ExpressionPtr getCondition() { return m_condition; } + StatementPtr getStmt() { return m_stmt; } +private: + ExpressionPtr m_condition; + StatementPtr m_stmt; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __IF_BRANCH_STATEMENT_H__ diff --git a/src/lib/statement/if_statement.cpp b/src/lib/statement/if_statement.cpp new file mode 100644 index 0000000000000..a29d18bb2c612 --- /dev/null +++ b/src/lib/statement/if_statement.cpp @@ -0,0 +1,174 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +IfStatement::IfStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, StatementListPtr stmts) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_stmts(stmts) { +} + +StatementPtr IfStatement::clone() { + IfStatementPtr stmt(new IfStatement(*this)); + stmt->m_stmts = Clone(m_stmts); + return stmt; +} + +int IfStatement::getRecursiveCount() const { + return m_stmts->getRecursiveCount(); +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void IfStatement::analyzeProgram(AnalysisResultPtr ar) { + if (m_stmts) m_stmts->analyzeProgram(ar); +} + +bool IfStatement::hasDecl() const { + return m_stmts && m_stmts->hasDecl(); +} + +bool IfStatement::hasRetExp() const { + return m_stmts && m_stmts->hasRetExp(); +} + +StatementPtr IfStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_stmts); + if (ar->getPhase() != AnalysisResult::SecondPreOptimize) { + return StatementPtr(); + } + + int i; + int j; + + for (i = 0; i < m_stmts->getCount(); i++) { + IfBranchStatementPtr branch = + dynamic_pointer_cast((*m_stmts)[i]); + ExpressionPtr condition = branch->getCondition(); + if (!condition) break; // else branch + if (condition->is(Expression::KindOfConstantExpression)) { + ConstantExpressionPtr exp = + dynamic_pointer_cast(condition); + if (exp->isBoolean()) { + if (exp->getBooleanValue()) { + // if (true) branch + for (j = i + 1; j < m_stmts->getCount(); j++) { + if ((*m_stmts)[j]->hasDecl()) break; + } + // no declarations after if (true) + if (j == m_stmts->getCount()) break; + } else { + // if (false) branch + if (!branch->hasDecl()) { + m_stmts->removeElement(i); + i--; + } + } + } + } + } + + if (i == m_stmts->getCount()) return StatementPtr(); + + // either else branch or if (true) branch without further declarations + + i++; + while (i < m_stmts->getCount()) m_stmts->removeElement(i); + + // if there is only one branch left, return stmt. + if (m_stmts->getCount() == 1) { + return dynamic_pointer_cast((*m_stmts)[0])->getStmt(); + } else if (m_stmts->getCount() == 0) { + return NULL_STATEMENT(); + } else { + return StatementPtr(); + } +} + +StatementPtr IfStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_stmts); + for (int i = 0; i < m_stmts->getCount(); i++) { + IfBranchStatementPtr branch = + dynamic_pointer_cast((*m_stmts)[i]); + ExpressionPtr condition = branch->getCondition(); + if (!condition) { + if (!branch->getStmt()->hasImpl()) { + // remove else branch without C++ implementation. + ar->incOptCounter(); + m_stmts->removeElement(i); + } + break; + } + if (condition->is(Expression::KindOfConstantExpression)) { + ConstantExpressionPtr exp = + dynamic_pointer_cast(condition); + // Remove if (false) branch without C++ implementation. + // if (true) branch without C++ implementation is kept unless + // it is the last branch. In general we cannot let a if (true) + // branch short-circuit the rest branches which if removed may + // cause g++ to complain unreferenced variables. + if (exp->isBoolean() && !branch->getStmt()->hasImpl()) { + if (!exp->getBooleanValue() || + (exp->getBooleanValue() && i == m_stmts->getCount() - 1)) { + ar->incOptCounter(); + m_stmts->removeElement(i); + i--; + } + } + } + } + if (m_stmts->getCount() == 0) { + return NULL_STATEMENT(); + } else { + return StatementPtr(); + } +} + +void IfStatement::inferTypes(AnalysisResultPtr ar) { + if (m_stmts) m_stmts->inferTypes(ar); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void IfStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + for (int i = 0; i < m_stmts->getCount(); i++) { + if (i > 0) cg.printf("else"); + (*m_stmts)[i]->outputPHP(cg, ar); + } +} + +void IfStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + for (int i = 0; i < m_stmts->getCount(); i++) { + if (i > 0) cg.printf("else "); + (*m_stmts)[i]->outputCPP(cg, ar); + } +} diff --git a/src/lib/statement/if_statement.h b/src/lib/statement/if_statement.h new file mode 100644 index 0000000000000..cfe0596cc821a --- /dev/null +++ b/src/lib/statement/if_statement.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __IF_STATEMENT_H__ +#define __IF_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(IfStatement); + +class IfStatement : public Statement { +public: + IfStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, StatementListPtr stmts); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const; + virtual bool hasRetExp() const; + virtual int getRecursiveCount() const; + +private: + StatementListPtr m_stmts; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __IF_STATEMENT_H__ diff --git a/src/lib/statement/interface_statement.cpp b/src/lib/statement/interface_statement.cpp new file mode 100644 index 0000000000000..9c2b929f67648 --- /dev/null +++ b/src/lib/statement/interface_statement.cpp @@ -0,0 +1,320 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +InterfaceStatement::InterfaceStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + const std::string &name, ExpressionListPtr base, StatementListPtr stmt) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_originalName(name), m_base(base), m_stmt(stmt) { + m_name = Util::toLower(name); + if (m_base) m_base->toLower(); +} + +StatementPtr InterfaceStatement::clone() { + InterfaceStatementPtr stmt(new InterfaceStatement(*this)); + stmt->m_stmt = Clone(m_stmt); + stmt->m_base = Clone(m_base); + return stmt; +} + +BlockScopePtr InterfaceStatement::getScope() { + return m_classScope.lock(); +} +int InterfaceStatement::getRecursiveCount() const { + return m_stmt ? m_stmt->getRecursiveCount() : 0; +} +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void InterfaceStatement::onParse(AnalysisResultPtr ar) { + vector bases; + if (m_base) m_base->getStrings(bases); + + StatementPtr stmt = dynamic_pointer_cast(shared_from_this()); + ClassScopePtr classScope(new ClassScope(ClassScope::KindOfInterface, + m_name, "", bases, stmt, + ar->getFileScope())); + m_classScope = classScope; + ar->getFileScope()->addClass(ar, classScope); + ar->getDependencyGraph()->addParent(DependencyGraph::KindOfProgramUserClass, + "", m_originalName, stmt); + + if (m_stmt) { + ar->pushScope(classScope); + for (int i = 0; i < m_stmt->getCount(); i++) { + IParseHandlerPtr ph = dynamic_pointer_cast((*m_stmt)[i]); + ph->onParse(ar); + } + ar->popScope(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +std::string InterfaceStatement::getName() const { + return string("Interface ") + m_classScope.lock()->getName(); +} + +void InterfaceStatement::analyzeProgram(AnalysisResultPtr ar) { + ClassScopePtr classScope = m_classScope.lock(); + if (hasHphpNote("Volatile")) classScope->setVolatile(); + if (m_stmt) { + classScope->setIncludeLevel(ar->getIncludeLevel()); + ar->pushScope(classScope); + m_stmt->analyzeProgram(ar); + ar->popScope(); + } + ar->recordClassSource(m_name, ar->getFileScope()->getName()); + vector bases; + if (m_base) m_base->getStrings(bases); + DependencyGraphPtr dependencies = ar->getDependencyGraph(); + for (unsigned int i = 0; i < bases.size(); i++) { + ClassScopePtr cls = ar->findClass(bases[i]); + if (cls) { + if (dependencies->checkCircle(DependencyGraph::KindOfClassDerivation, + m_originalName, + cls->getOriginalName())) { + ClassScopePtr classScope = m_classScope.lock(); + ar->getCodeError()->record(CodeError::InvalidDerivation, + shared_from_this(), ConstructPtr(), + cls->getOriginalName()); + m_base = ExpressionListPtr(); + classScope->clearBases(); + } else if (cls->isUserClass()) { + dependencies->add(DependencyGraph::KindOfClassDerivation, + ar->getName(), + m_originalName, shared_from_this(), + cls->getOriginalName(), cls->getStmt()); + } + } + } +} + +StatementPtr InterfaceStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_base); + if (m_stmt) { + ClassScopePtr classScope = m_classScope.lock(); + ar->pushScope(classScope); + ar->preOptimize(m_stmt); + ar->popScope(); + } + return StatementPtr(); +} + +StatementPtr InterfaceStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_base); + if (m_stmt) { + ClassScopePtr classScope = m_classScope.lock(); + ar->pushScope(classScope); + ar->postOptimize(m_stmt); + ar->popScope(); + } + return StatementPtr(); +} + +void InterfaceStatement::inferTypes(AnalysisResultPtr ar) { + vector bases; + if (m_base) m_base->getStrings(bases); + for (unsigned int i = 0; i < bases.size(); i++) { + addUserClass(ar, bases[i]); + } + + if (m_stmt) { + ClassScopePtr classScope = m_classScope.lock(); + ar->pushScope(classScope); + m_stmt->inferTypes(ar); + ar->popScope(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void InterfaceStatement::getAllParents(AnalysisResultPtr ar, + std::vector &names) { + vector bases; + if (m_base) { + m_base->getStrings(bases); + for (unsigned int i = 0; i < bases.size(); i++) { + ClassScopePtr cls = ar->findClass(bases[i]); + if (cls) { + cls->getAllParents(ar, names); + names.push_back(bases[i]); + } + } + } +} + +void InterfaceStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + ClassScopePtr classScope = m_classScope.lock(); + + if (cg.getOutput() == CodeGenerator::InlinedPHP || + cg.getOutput() == CodeGenerator::TrimmedPHP) { + if (!classScope->isUserClass()) { + return; + } + } + + if (ar) ar->pushScope(classScope); + + cg.printf("interface %s", m_name.c_str()); + if (m_base) { + cg.printf(" extends "); + m_base->outputPHP(cg, ar); + } + cg.indentBegin(" {\n"); + m_classScope.lock()->outputPHP(cg, ar); + if (m_stmt) m_stmt->outputPHP(cg, ar); + cg.indentEnd("}\n"); + + if (ar) ar->popScope(); +} + +void InterfaceStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + ClassScopePtr classScope = m_classScope.lock(); + if (cg.getContext() == CodeGenerator::NoContext) { + if (classScope->isVolatile()) { + cg.printf("get_globals()->declareInterface(\"%s\");\n", m_name.c_str()); + } + return; + } + + ar->pushScope(classScope); + string clsNameStr = classScope->getId(); + const char *clsName = clsNameStr.c_str(); + + switch (cg.getContext()) { + case CodeGenerator::CppForwardDeclaration: + if (Option::GenerateCPPMacros) { + cg.printf("FORWARD_DECLARE_CLASS(%s);\n", clsName); + } + break; + case CodeGenerator::CppDeclaration: + { + printSource(cg); + cg.printf("class %s%s", Option::ClassPrefix, clsName); + bool derived = false; + if (m_base) { + for (int i = 0; i < m_base->getCount(); i++) { + ScalarExpressionPtr exp = + dynamic_pointer_cast((*m_base)[i]); + const char *intf = exp->getString().c_str(); + + if (classScope->derivesFrom(ar, intf)) { + if (!derived) { + derived = true; + cg.printf(" : virtual public %s%s", Option::ClassPrefix, intf); + } else { + cg.printf(", virtual public %s%s", Option::ClassPrefix, intf); + } + } + } + } + if (!derived) { + cg.printf(" : virtual public ObjectData"); + } + + cg.indentBegin(" {\n"); + if (m_stmt) m_stmt->outputCPP(cg, ar); + cg.indentEnd("};\n"); + } + break; + case CodeGenerator::CppImplementation: + // do nothing + break; + case CodeGenerator::CppFFIDecl: + case CodeGenerator::CppFFIImpl: + // do nothing + break; + case CodeGenerator::JavaFFI: + { + // TODO support PHP namespaces, once HPHP supports it + string packageName = Option::JavaFFIRootPackage; + string packageDir = packageName; + Util::replaceAll(packageDir, ".", "/"); + + string outputDir = ar->getOutputPath() + "/" + Option::FFIFilePrefix + + packageDir + "/"; + Util::mkdir(outputDir); + + // uses a different cg to generate a separate file for each PHP class + string clsFile = outputDir + getOriginalName() + ".java"; + ofstream fcls(clsFile.c_str()); + CodeGenerator cgCls(&fcls, CodeGenerator::FileCPP); + cgCls.setContext(CodeGenerator::JavaFFIInterface); + + cgCls.printf("package %s;\n\n", packageName.c_str()); + cgCls.printf("import hphp.*;\n\n"); + + cgCls.printf("public interface %s", getOriginalName().c_str()); + if (m_base) { + bool first = true; + for (int i = 0; i < m_base->getCount(); i++) { + ScalarExpressionPtr exp = + dynamic_pointer_cast((*m_base)[i]); + const char *intf = exp->getString().c_str(); + ClassScopePtr intfClassScope = ar->findClass(intf); + if (intfClassScope && classScope->derivesFrom(ar, intf) + && intfClassScope->isUserClass()) { + if (first) { + cgCls.printf(" extends "); + first = false; + } + else { + cgCls.printf(", "); + } + cgCls.printf(intfClassScope->getOriginalName()); + } + } + } + + cgCls.indentBegin(" {\n"); + if (m_stmt) m_stmt->outputCPP(cgCls, ar); + cgCls.indentEnd("}\n"); + + fcls.close(); + } + break; + case CodeGenerator::JavaFFICppDecl: + case CodeGenerator::JavaFFICppImpl: + // do nothing + break; + default: + ASSERT(false); + break; + } + + ar->popScope(); +} diff --git a/src/lib/statement/interface_statement.h b/src/lib/statement/interface_statement.h new file mode 100644 index 0000000000000..3ab076b5ecee8 --- /dev/null +++ b/src/lib/statement/interface_statement.h @@ -0,0 +1,61 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __INTERFACE_STATEMENT_H__ +#define __INTERFACE_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(ClassScope); +DECLARE_BOOST_TYPES(InterfaceStatement); + +class InterfaceStatement : public Statement, public IParseHandler, + public IScopeStatement { +public: + InterfaceStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + const std::string &name, ExpressionListPtr base, + StatementListPtr stmt); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return true; } + virtual bool hasImpl() const { return false; } + virtual int getRecursiveCount() const; + // implementing IParseHandler + virtual void onParse(AnalysisResultPtr ar); + + virtual BlockScopePtr getScope(); + ClassScopePtr getClassScope() { return m_classScope.lock();} + virtual std::string getName() const; + std::string getOriginalName() const { return m_originalName;} + virtual void getAllParents(AnalysisResultPtr ar, + std::vector &names); + +protected: + std::string m_originalName; + std::string m_name; + ExpressionListPtr m_base; + StatementListPtr m_stmt; + boost::weak_ptr m_classScope; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __INTERFACE_STATEMENT_H__ diff --git a/src/lib/statement/method_statement.cpp b/src/lib/statement/method_statement.cpp new file mode 100644 index 0000000000000..481b096da9e3e --- /dev/null +++ b/src/lib/statement/method_statement.cpp @@ -0,0 +1,1092 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +MethodStatement::MethodStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + ModifierExpressionPtr modifiers, bool ref, const std::string &name, + ExpressionListPtr params, StatementListPtr stmt, int attr, + bool method /* = true */) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_method(method), m_modifiers(modifiers), m_ref(ref), m_originalName(name), + m_params(params), m_stmt(stmt), m_attribute(attr) { + m_name = Util::toLower(name); +} + +StatementPtr MethodStatement::clone() { + MethodStatementPtr stmt(new MethodStatement(*this)); + stmt->m_stmt = Clone(m_stmt); + stmt->m_params = Clone(m_params); + stmt->m_modifiers = Clone(m_modifiers); + return stmt; +} + +BlockScopePtr MethodStatement::getScope() { + return m_funcScope.lock(); +} + +std::string MethodStatement::getFullName() const { + if (m_className.empty()) return m_name; + return m_className + "::" + m_name; +} + +bool MethodStatement::isRef(int index /* = -1 */) const { + if (index == -1) return m_ref; + ASSERT(index >= 0 && index < m_params->getCount()); + ParameterExpressionPtr param = + dynamic_pointer_cast((*m_params)[index]); + return param->isRef(); +} + +int MethodStatement::getRecursiveCount() const { + return m_stmt ? m_stmt->getRecursiveCount() : 0; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +FunctionScopePtr MethodStatement::onParseImpl(AnalysisResultPtr ar) { + int minParam, maxParam; + ConstructPtr self = shared_from_this(); + minParam = maxParam = 0; + bool hasRef = false; + if (m_params) { + set names; + int i = 0; + maxParam = m_params->getCount(); + for (; i < maxParam; i++) { + ParameterExpressionPtr param = + dynamic_pointer_cast((*m_params)[i]); + if (param->isRef()) hasRef = true; + if (param->isOptional()) break; + minParam++; + } + for (i++; i < maxParam; i++) { + ParameterExpressionPtr param = + dynamic_pointer_cast((*m_params)[i]); + if (param->isRef()) hasRef = true; + if (!param->isOptional()) { + ar->getCodeError()->record(self, CodeError::RequiredAfterOptionalParam, + param); + param->defaultToNull(ar); + } + } + + if (ar->isFirstPass()) { + for (i = 0; i < maxParam; i++) { + ParameterExpressionPtr param = + dynamic_pointer_cast((*m_params)[i]); + if (names.find(param->getName()) == names.end()) { + names.insert(param->getName()); + } else { + ar->getCodeError()->record(self, CodeError::RedundantParameter, param); + for (int j = 0; j < 1000; j++) { + string name = param->getName() + lexical_cast(j); + if (names.find(name) == names.end()) { + param->rename(name); + break; + } + } + } + } + } + } + + if (hasRef || m_ref) { + m_attribute |= FileScope::ContainsReference; + } + + StatementPtr stmt = dynamic_pointer_cast(shared_from_this()); + FunctionScopePtr funcScope + (new FunctionScope(ar, m_method, m_name, stmt, m_ref, minParam, maxParam, + m_modifiers, m_attribute, ar->getFileScope())); + if (!m_stmt) { + funcScope->setVirtual(); + } + m_funcScope = funcScope; + + // TODO: this may have to expand to a concept of "virtual" functions... + if (ar->getClassScope()) { + funcScope->disableInline(); + if (m_name.length() > 2 && m_name.substr(0,2) == "__") { + bool magic = true; + int paramCount = 0; + if (m_name == "__destruct") { + funcScope->setOverriding(Type::Variant); + } else if (m_name == "__call") { + funcScope->setOverriding(Type::Variant, Type::String, Type::Array); + paramCount = 2; + } else if (m_name == "__set") { + funcScope->setOverriding(Type::Variant, Type::String, Type::Variant); + paramCount = 2; + } else if (m_name == "__get") { + funcScope->setOverriding(Type::Variant, Type::String); + paramCount = 1; + } else if (m_name == "__isset") { + funcScope->setOverriding(Type::Boolean, Type::String); + paramCount = 1; + } else if (m_name == "__unset") { + funcScope->setOverriding(Type::Variant, Type::String); + paramCount = 1; + } else if (m_name == "__sleep") { + funcScope->setOverriding(Type::Variant); + } else if (m_name == "__wakeup") { + funcScope->setOverriding(Type::Variant); + } else if (m_name == "__set_state") { + funcScope->setOverriding(Type::Variant, Type::Variant); + paramCount = 1; + } else if (m_name == "__tostring") { + funcScope->setOverriding(Type::String); + } else if (m_name == "__clone") { + funcScope->setOverriding(Type::Variant); + } else { + paramCount = -1; + if (m_name != "__construct") { + ar->getCodeError()->record(self, CodeError::UnknownMagicMethod, + self); + magic = false; + } + } + if (paramCount >= 0 && + (paramCount != minParam || paramCount != maxParam)) { + ar->getCodeError()->record(self, CodeError::InvalidMagicMethod, + self); + magic = false; + } + if (magic) funcScope->setMagicMethod(); + } + // ArrayAccess methods + else if (m_name.length() > 6 && m_name.substr(0, 6) == "offset") { + if (m_name == "offsetexists") { + funcScope->setOverriding(Type::Boolean, Type::Variant); + } else if (m_name == "offsetget") { + funcScope->setOverriding(Type::Variant, Type::Variant); + } else if (m_name == "offsetset") { + funcScope->setOverriding(TypePtr(), Type::Variant, Type::Variant); + } else if (m_name == "offsetunset") { + funcScope->setOverriding(TypePtr(), Type::Variant); + } + } + } + + return funcScope; +} + +void MethodStatement::onParse(AnalysisResultPtr ar) { + ClassScopePtr classScope = + dynamic_pointer_cast(ar->getScope()); + + classScope->addFunction(ar, onParseImpl(ar)); + if (m_name == "__construct") { + classScope->setAttribute(ClassScope::HasConstructor); + } else if (m_name == "__destruct") { + classScope->setAttribute(ClassScope::HasDestructor); + } + + if (m_name == "__call") { + classScope->setAttribute(ClassScope::HasUnknownMethodHandler); + } + + m_className = classScope->getName(); +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void MethodStatement::addParamRTTI(AnalysisResultPtr ar) { + FunctionScopePtr func = + dynamic_pointer_cast(ar->getScope()); + VariableTablePtr variables = func->getVariables(); + if (variables->getAttribute(VariableTable::ContainsDynamicVariable) || + variables->getAttribute(VariableTable::ContainsExtract)) { + return; + } + for (int i = 0; i < m_params->getCount(); i++) { + ParameterExpressionPtr param = + dynamic_pointer_cast((*m_params)[i]); + const string ¶mName = param->getName(); + if (variables->isLvalParam(paramName)) continue; + TypePtr paramType = param->getActualType(); + if ((paramType->is(Type::KindOfVariant) || + paramType->is(Type::KindOfSome)) && + !param->isRef()) { + param->setHasRTTI(); + ClassScopePtr cls = ar->getClassScope(); + ar->addParamRTTIEntry(cls, func, paramName); + const string funcId = ar->getFuncId(cls, func); + ar->addRTTIFunction(funcId); + } + } +} + +void MethodStatement::analyzeProgram(AnalysisResultPtr ar) { + FunctionScopePtr funcScope = m_funcScope.lock(); + + // registering myself as a parent in dependency graph, so that + // (1) we can tell orphaned parents + // (2) overwrite non-master copy of function declarations + if (ar->isFirstPass()) { + ar->getDependencyGraph()->addParent(DependencyGraph::KindOfFunctionCall, + "", getFullName(), shared_from_this()); + if (Option::AllDynamic || hasHphpNote("Dynamic") || + BuiltinSymbols::isDeclaredDynamic(m_name) || + Option::isDynamicFunction(m_method, m_name)) { + funcScope->setDynamic(); + } + if (hasHphpNote("Volatile")) funcScope->setVolatile(); + } + + funcScope->setIncludeLevel(ar->getIncludeLevel()); + ar->pushScope(funcScope); + if (m_params) { + m_params->analyzeProgram(ar); + if (Option::GenRTTIProfileData && + ar->getPhase() == AnalysisResult::AnalyzeFinal) { + addParamRTTI(ar); + } + } + if (m_stmt) m_stmt->analyzeProgram(ar); + ar->popScope(); +} + +StatementPtr MethodStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_modifiers); + ar->preOptimize(m_params); + FunctionScopePtr funcScope = m_funcScope.lock(); + ar->pushScope(funcScope); + ar->preOptimize(m_stmt); + ar->popScope(); + return StatementPtr(); +} + +StatementPtr MethodStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_modifiers); + ar->postOptimize(m_params); + FunctionScopePtr funcScope = m_funcScope.lock(); + ar->pushScope(funcScope); + ar->postOptimize(m_stmt); + ar->popScope(); + return StatementPtr(); +} +void MethodStatement::inferTypes(AnalysisResultPtr ar) { + FunctionScopePtr funcScope = m_funcScope.lock(); + if (ar->getPhase() == AnalysisResult::FirstInference && m_stmt) { + if (m_stmt->hasRetExp() || + funcScope->inPseudoMain() || + funcScope->getReturnType()) { + bool lastIsReturn = false; + if (m_stmt->getCount()) { + StatementPtr lastStmt = (*m_stmt)[m_stmt->getCount()-1]; + if (lastStmt->is(Statement::KindOfReturnStatement)) { + lastIsReturn = true; + } + } + if (!lastIsReturn && + !(funcScope->inPseudoMain() && !Option::GenerateCPPMain)) { + ExpressionPtr constant = + funcScope->inPseudoMain() ? CONSTANT("true") : CONSTANT("null"); + ReturnStatementPtr returnStmt = + ReturnStatementPtr(new ReturnStatement(getLocation(), + Statement::KindOfReturnStatement, constant)); + m_stmt->addElement(returnStmt); + } + } + } + ar->pushScope(funcScope); + if (m_params) { + m_params->inferAndCheck(ar, NEW_TYPE(Any), false); + } + if (m_stmt) { + m_stmt->inferTypes(ar); + } + ar->popScope(); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void MethodStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + FunctionScopePtr funcScope = m_funcScope.lock(); + if (ar) ar->pushScope(funcScope); + + m_modifiers->outputPHP(cg, ar); + cg.printf(" function "); + if (m_ref) cg.printf("&"); + cg.printf("%s(", m_originalName.c_str()); + if (m_params) m_params->outputPHP(cg, ar); + if (m_stmt) { + cg.indentBegin(") {\n"); + funcScope->outputPHP(cg, ar); + m_stmt->outputPHP(cg, ar); + cg.indentEnd("}\n"); + } else { + cg.printf(");\n"); + } + + if (ar) ar->popScope(); +} + +void MethodStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + FunctionScopePtr funcScope = m_funcScope.lock(); + ClassScopePtr scope = ar->getClassScope(); + ar->pushScope(funcScope); + + if (outputFFI(cg, ar)) return; + + if (cg.getContext() == CodeGenerator::CppImplementation) { + printSource(cg); + } + + switch (cg.getContext()) { + case CodeGenerator::CppDeclaration: + { + if (!m_stmt) { + cg.printf("// "); + } + m_modifiers->outputCPP(cg, ar); + + if (m_name == "__offsetget_lval") { + cg.printf("virtual "); + } + TypePtr type = funcScope->getReturnType(); + if (type) { + type->outputCPPDecl(cg, ar); + } else { + cg.printf("void"); + } + if (m_name == "__lval") { + cg.printf(" &___lval("); + } else if (m_name == "__offsetget_lval") { + cg.printf(" &___offsetget_lval("); + } else if (m_modifiers->isStatic() && m_stmt) { + // Static method wrappers get generated as support methods + cg.printf(" %s%s(const char* cls%s", Option::MethodImplPrefix, + m_name.c_str(), + funcScope->isVariableArgument() || + (m_params && m_params->getCount()) ? ", " : ""); + } else { + cg.printf(" %s%s(", Option::MethodPrefix, m_name.c_str()); + } + funcScope->outputCPPParamsDecl(cg, ar, m_params, true); + if (m_stmt) { + cg.printf(");\n"); + } else { + cg.printf(") = 0;\n"); + } + + if (funcScope->isConstructor(scope) + && !funcScope->isAbstract() && !scope->isInterface()) { + funcScope->outputCPPCreateDecl(cg, ar); + } + } + break; + case CodeGenerator::CppImplementation: + if (m_stmt) { + TypePtr type = funcScope->getReturnType(); + if (type) { + type->outputCPPDecl(cg, ar); + } else { + cg.printf("void"); + } + if (m_name == "__lval") { + cg.printf(" &%s%s::___lval(", + Option::ClassPrefix, scope->getId().c_str()); + } else if (m_name == "__offsetget_lval") { + cg.printf(" &%s%s::___offsetget_lval(", + Option::ClassPrefix, scope->getId().c_str()); + } else if (m_modifiers->isStatic()) { + cg.printf(" %s%s::%s%s(const char* cls%s", Option::ClassPrefix, + scope->getId().c_str(), + Option::MethodImplPrefix, m_name.c_str(), + funcScope->isVariableArgument() || + (m_params && m_params->getCount()) ? ", " : ""); + } else { + cg.printf(" %s%s::%s%s(", Option::ClassPrefix, scope->getId().c_str(), + Option::MethodPrefix, m_name.c_str()); + } + funcScope->outputCPPParamsDecl(cg, ar, m_params, false); + cg.indentBegin(") {\n"); + if (m_modifiers->isStatic()) { + cg.printf("STATIC_METHOD_INJECTION(%s, %s::%s);\n", + scope->getOriginalName(), scope->getOriginalName(), + m_originalName.c_str()); + } else { + cg.printf("INSTANCE_METHOD_INJECTION(%s, %s::%s);\n", + scope->getOriginalName(), scope->getOriginalName(), + m_originalName.c_str()); + } + if (Option::GenRTTIProfileData && m_params) { + for (int i = 0; i < m_params->getCount(); i++) { + ParameterExpressionPtr param = + dynamic_pointer_cast((*m_params)[i]); + if (param->hasRTTI()) { + const string ¶mName = param->getName(); + int id = ar->getParamRTTIEntryId(ar->getClassScope(), funcScope, + paramName); + if (id != -1) { + cg.printf("RTTI_INJECTION(%s%s, %d);\n", + Option::VariablePrefix, paramName.c_str(), id); + } + } + } + } + if (m_name == "__lval" || m_name == "__offsetget_lval") { + ParameterExpressionPtr param = + dynamic_pointer_cast((*m_params)[0]); + cg.printf("Variant &v = %s->__lvalProxy;\n", cg.getGlobals()); + string lowered = Util::toLower(m_originalName); + cg.printf("v = %s%s(%s%s);\n", + Option::MethodPrefix, lowered.c_str(), + Option::VariablePrefix, param->getName().c_str()); + cg.printf("return v;\n"); + } else { + if (funcScope->isConstructor(scope)) { + cg.printf("bool oldInCtor = gasInCtor(true);\n"); + } else if (m_name == "__destruct") { + cg.printf("setInDtor();\n"); + } else if (m_name == "__call") { + ParameterExpressionPtr param; + if (m_params->getCount() > 0) { + param = dynamic_pointer_cast((*m_params)[0]); + cg.printf("INCALL_HELPER(%s%s);\n", + Option::VariablePrefix, param->getName().c_str()); + } else { + cg.printf("INCALL_HELPER(\"\");\n"); + } + } + funcScope->outputCPP(cg, ar); + cg.setContext(CodeGenerator::NoContext); // no inner functions/classes + outputCPPStmt(cg, ar); + cg.setContext(CodeGenerator::CppImplementation); + } + cg.indentEnd("} /* function */\n"); + } + break; + default: + break; + } + + ar->popScope(); +} + +void MethodStatement::outputCPPStmt(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_stmt) { + m_stmt->outputCPP(cg, ar); + if (!m_stmt->hasRetExp()) { + FunctionScopePtr funcScope = m_funcScope.lock(); + ClassScopePtr cls = ar->getClassScope(); + if (funcScope->isConstructor(cls)) { + cg.printf("gasInCtor(oldInCtor);\n"); + } + } + } +} + +void MethodStatement::outputCPPStaticMethodWrapper(CodeGenerator &cg, + AnalysisResultPtr ar, + const char *cls) { + if (!m_modifiers->isStatic() || !m_stmt) return; + FunctionScopePtr funcScope = m_funcScope.lock(); + ar->pushScope(funcScope); + m_modifiers->outputCPP(cg, ar); + TypePtr type = funcScope->getReturnType(); + if (type) { + type->outputCPPDecl(cg, ar); + } else { + cg.printf("void"); + } + cg.printf(" %s%s(", Option::MethodPrefix, m_name.c_str()); + CodeGenerator::Context old = cg.getContext(); + cg.setContext(CodeGenerator::CppStaticMethodWrapper); + funcScope->outputCPPParamsDecl(cg, ar, m_params, true); + cg.setContext(old); + cg.printf(") { %s%s%s(\"%s\"", type ? "return " : "", + Option::MethodImplPrefix, m_name.c_str(), + cls); + if (funcScope->isVariableArgument()) { + cg.printf(", num_args"); + } + if (m_params) { + for (int i = 0; i < m_params->getCount(); i++) { + ParameterExpressionPtr param = + dynamic_pointer_cast((*m_params)[i]); + ASSERT(param); + cg.printf(", %s%s", Option::VariablePrefix, param->getName().c_str()); + } + } + if (funcScope->isVariableArgument()) { + cg.printf(", args"); + } + cg.printf("); }\n"); + ar->popScope(); +} + + +bool MethodStatement::outputFFI(CodeGenerator &cg, AnalysisResultPtr ar) { + FunctionScopePtr funcScope = m_funcScope.lock(); + ClassScopePtr clsScope = ar->getClassScope(); + bool pseudoMain = funcScope->inPseudoMain(); + bool inClass = !m_className.empty(); + // only expose public methods, and ignore those in redeclared classes + bool inaccessible = + inClass && (!m_modifiers->isPublic() || clsScope->isRedeclaring()); + // skip constructors + bool isConstructor = inClass && funcScope->isConstructor(clsScope); + bool valid = !pseudoMain && !inaccessible && !isConstructor; + + if (cg.getContext() == CodeGenerator::CppFFIDecl || + cg.getContext() == CodeGenerator::CppFFIImpl) { + if (valid) outputCPPFFIStub(cg, ar); + return true; + } + + if (cg.getContext() == CodeGenerator::HsFFI) { + if (valid) outputHSFFIStub(cg, ar); + return true; + } + + if (cg.getContext() == CodeGenerator::JavaFFI + || cg.getContext() == CodeGenerator::JavaFFIInterface) { + if (valid) outputJavaFFIStub(cg, ar); + return true; + } + + if (cg.getContext() == CodeGenerator::JavaFFICppDecl + || cg.getContext() == CodeGenerator::JavaFFICppImpl) { + if (valid) outputJavaFFICPPStub(cg, ar); + return true; + } + + if (cg.getContext() == CodeGenerator::SwigFFIDecl + || cg.getContext() == CodeGenerator::SwigFFIImpl) { + if (valid) outputSwigFFIStub(cg, ar); + return true; + } + + return false; +} + +void MethodStatement::outputCPPFFIStub(CodeGenerator &cg, + AnalysisResultPtr ar) { + FunctionScopePtr funcScope = m_funcScope.lock(); + bool varArgs = funcScope->isVariableArgument(); + bool ret = funcScope->getReturnType(); + string fname = funcScope->getId(); + bool inClass = !m_className.empty(); + bool isStatic = !inClass || m_modifiers->isStatic(); + + if (inClass && m_modifiers->isAbstract()) { + return; + } + + if (fname == "__lval" || fname == "__offsetget_lval") { + return; + } + + if (ret) { + cg.printf("int"); + } else { + cg.printf("void"); + } + cg.printf(" %s%s%s(", Option::FFIFnPrefix, + (inClass ? (m_className + "_cls_").c_str() : ""), fname.c_str()); + if (ret) { + cg.printf("void** res"); + } + + bool first = !ret; + + if (!isStatic) { + // instance methods need one additional parameter for the target + if (first) { + first = false; + } + else { + cg.printf(", "); + } + cg.printf("Variant *target"); + } + + int ac = funcScope->getMaxParamCount(); + for (int i = 0; i < ac; ++i) { + if (first) { + first = false; + } else { + cg.printf(", "); + } + cg.printf("Variant *a%d", i); + } + if (varArgs) { + if (!first) { + cg.printf(", "); + } + cg.printf("Variant *va"); + } + cg.printf(")"); + if (cg.getContext() == CodeGenerator::CppFFIDecl) { + cg.printf(";\n"); + } else { + cg.indentBegin(" {\n"); + if (ret) { + cg.printf("return hphp_ffi_exportVariant("); + } + + if (!inClass) { + // simple function call + cg.printf("%s%s(", Option::FunctionPrefix, fname.c_str()); + } + else if (isStatic) { + // static method call + cg.printf("%s%s::%s%s(", Option::ClassPrefix, m_className.c_str(), + Option::MethodPrefix, fname.c_str()); + } + else { + // instance method call + cg.printf("dynamic_cast<%s%s *>(target->getObjectData())->", + Option::ClassPrefix, m_className.c_str()); + cg.printf("%s%s(", Option::MethodPrefix, fname.c_str()); + } + + first = true; + if (varArgs) { + cg.printf("%d + (va->isNull() ? 0 : va->getArrayData()->size())", ac); + first = false; + } + + for (int i = 0; i < ac; ++i) { + if (first) { + first = false; + } else { + cg.printf(", "); + } + cg.printf("*a%d", i); + } + if (varArgs) { + cg.printf(", va->toArray()"); + } + if (ret) { + cg.printf("), res"); + } + cg.printf(");\n"); + cg.indentEnd("} /* function */\n"); + } + return; +} + +void MethodStatement::outputHSFFIStub(CodeGenerator &cg, AnalysisResultPtr ar) { + if (!m_className.empty()) { + // Haskell currently doesn't support FFI for class methods. + return; + } + + FunctionScopePtr funcScope = m_funcScope.lock(); + bool varArgs = funcScope->isVariableArgument(); + bool ret = funcScope->getReturnType(); + string fname = funcScope->getId().c_str(); + cg.indentBegin("foreign import ccall \"stubs.h %s%s\" %s%s\n", + Option::FFIFnPrefix, + fname.c_str(), + Option::FFIFnPrefix, + fname.c_str()); + cg.printf(":: "); + if (ret) { + cg.printf("PtrPtr a -> "); + } + int ac = funcScope->getMaxParamCount(); + for (int i = 0; i < ac; ++i) { + cg.printf("HphpVariantPtr -> "); + } + if (varArgs) { + cg.printf("HphpVariantPtr -> "); + } + if (ret) { + cg.printf("IO CInt"); + } else { + cg.printf("IO ()"); + } + cg.indentEnd("\n"); + + cg.printf("f_%s :: ", fname.c_str()); + bool first = true; + if (ac > 0) { + cg.printf("("); + } + for (int i = 0; i < ac; ++i) { + if (first) { + first = false; + } else { + cg.printf(", "); + } + cg.printf("VariantAble a%d", i); + } + if (ac > 0) { + cg.printf(") => "); + } + for (int i = 0; i < ac; ++i) { + cg.printf("a%d -> ", i); + } + if (varArgs) { + cg.printf("[Variant] -> "); + } + if (ret) { + cg.printf("IO Variant"); + } else { + cg.printf("IO ()"); + } + cg.printf("\n"); + cg.printf("f_%s ", fname.c_str()); + for (int i = 0; i < ac; ++i) { + cg.printf("v%d ", i); + } + if (varArgs) { + cg.printf("va "); + } + cg.indentBegin("=%s\n", ret ? " alloca (\\pres ->" : ""); + for (int i = 0; i < ac; ++i) { + cg.indentBegin("withExportedVariant (toVariant v%d) (\\p%d ->\n", i, i); + } + if (varArgs) { + cg.indentBegin("withVParamList va (\\pva ->\n"); + } + cg.indentBegin("do\n"); + cg.printf("%sffi_%s", ret ? "t <- " : "", fname.c_str()); + if (ret) { + cg.printf(" pres"); + } + for (int i = 0; i < ac; ++i) { + cg.printf(" p%d", i); + } + if (varArgs) { + cg.printf(" pva"); + } + if (ret) { + cg.printf("\n"); + cg.printf("ppres <- peek pres\n"); + cg.printf("buildVariant (fromIntegral t) ppres"); + } + cg.indentEnd(""); // end do + if (varArgs) { + cg.indentEnd(")"); // end varargs + } + for (int i = 0; i < ac; ++i) { + cg.indentEnd(")"); // end wEV i + } + if (ret) { + cg.indentEnd(")"); // end alloca + } else { + cg.indentEnd(""); + } + cg.printf("\n"); + return; +} + +/** + * Generates the Java stub method for a PHP toplevel function. + * + * @author qixin + */ +void MethodStatement::outputJavaFFIStub(CodeGenerator &cg, + AnalysisResultPtr ar) { + FunctionScopePtr funcScope = m_funcScope.lock(); + bool varArgs = funcScope->isVariableArgument(); + bool ret = funcScope->getReturnType(); + bool inClass = !m_className.empty(); + bool isStatic = !inClass || m_modifiers->isStatic(); + string fname = funcScope->getId(); + string originalName = funcScope->getOriginalName(); + if (originalName.length() < fname.length()) { + // if there are functions of the same name, fname may contain "$$..." + // in the end + originalName += fname.substr(originalName.length()); + } + + if (originalName == "clone" || originalName == "equals" + || originalName == "finalize" || originalName == "getClass" + || originalName == "hashCode" || originalName == "notify" + || originalName == "notifyAll" || originalName == "toString" + || originalName == "wait") { + // not to clash with Java method names + originalName = "_" + originalName; + } + + if (cg.getContext() == CodeGenerator::JavaFFIInterface + || inClass && m_modifiers->isAbstract()) { + // skip all the abstract methods, because php overriding is not very + // compatible with Java + return; + } + + if (!inClass) printSource(cg); + + // This Java method extracts the Variant pointer from the HphpVariant + // argument as a 64-bit integer, and then calls the native version. + bool exposeNative = false; + int ac = funcScope->getMaxParamCount(); + if (ac > 0 || varArgs || !isStatic || !ret && inClass + || cg.getContext() == CodeGenerator::JavaFFIInterface) { + // make methods always return something, so that they can override + // each other + cg.printf("public %s%s %s(", + (isStatic ? "static " : ""), + (!ret && !inClass ? "void" : "HphpVariant"), originalName.c_str()); + ostringstream args; + bool first = true; + if (!isStatic) { + // instance method has an additional parameter + args << "this.getVariantPtr()"; + } + for (int i = 0; i < ac; i++) { + if (first) { + first = false; + if (!isStatic) args << ", "; + } + else { + cg.printf(", "); + args << ", "; + } + cg.printf("HphpVariant a%d", i); + args << "a" << i << ".getVariantPtr()"; + } + if (varArgs) { + if (!first) { + cg.printf(", "); + args << ", "; + } + else if (!isStatic) { + args << ", "; + } + cg.printf("HphpVariant va"); + args << "va.getVariantPtr()"; + } + + if (cg.getContext() == CodeGenerator::JavaFFIInterface) { + cg.printf(");\n\n"); + return; + } + + cg.indentBegin(") {\n"); + cg.printf("%s%s_native(%s);\n", (ret ? "return " : ""), originalName.c_str(), + args.str().c_str()); + if (!ret && inClass) { + cg.printf("return HphpNull.phpNull();\n"); + } + cg.indentEnd("}\n\n"); + } + else { + exposeNative = true; + } + + // the native method stub + cg.printf("%s %snative %s %s%s(", + (exposeNative ? "public" : "private"), + (isStatic ? "static " : ""), (ret ? "HphpVariant" : "void"), + originalName.c_str(), + (exposeNative ? "" : "_native")); + bool first = true; + if (!isStatic) { + // instance method has an additional parameter + cg.printf("long targetPtr"); + first = false; + } + for (int i = 0; i < ac; i++) { + if (first) first = false; + else cg.printf(", "); + cg.printf("long a%d", i); + } + if (varArgs) { + if (!first) cg.printf(", "); + cg.printf("long va"); + } + cg.printf(");\n\n"); +} + +void MethodStatement::outputJavaFFICPPStub(CodeGenerator &cg, + AnalysisResultPtr ar) { + // TODO translate PHP namespace once that is supported + string packageName = Option::JavaFFIRootPackage; + + FunctionScopePtr funcScope = m_funcScope.lock(); + bool varArgs = funcScope->isVariableArgument(); + bool ret = funcScope->getReturnType(); + bool inClass = !m_className.empty(); + bool isStatic = !inClass || m_modifiers->isStatic(); + string fname = funcScope->getId(); + int ac = funcScope->getMaxParamCount(); + bool exposeNative = !(ac > 0 || varArgs || !isStatic || !ret && inClass); + + if (inClass && m_modifiers->isAbstract()) { + // skip all the abstract methods, because hphp doesn't generate code + // for them + return; + } + + if (fname == "__lval" || fname == "__offsetget_lval") return; + + const char *clsName; + if (inClass) { + // uses capitalized original class name + ClassScopePtr cls = ar->findClass(m_className); + clsName = cls->getOriginalName(); + } + else { + clsName = "HphpMain"; + } + string mangledName = "Java." + packageName + "." + clsName + "." + fname + + (exposeNative ? "" : "_native"); + // all the existing "_" are replaced as "_1" + Util::replaceAll(mangledName, "_", "_1"); + Util::replaceAll(mangledName, ".", "_"); + + cg.printf("JNIEXPORT %s JNICALL\n", ret ? "jobject" : "void"); + cg.printf("%s(JNIEnv *env, %s target", mangledName.c_str(), + (isStatic ? "jclass" : "jobject")); + + ostringstream args; + bool first = true; + if (!isStatic) { + // instance method also gets an additional argument, which is a Variant + // pointer to the target, encoded in int64 + first = false; + cg.printf(", jlong targetPtr"); + args << "(Variant *)targetPtr"; + } + for (int i = 0; i < ac; i++) { + cg.printf(", jlong a%d", i); + if (first) first = false; + else args << ", "; + args << "(Variant *)a" << i; + } + if (varArgs) { + cg.printf(", jlong va"); + if (!first) args << ", "; + args << "(Variant *)va"; + } + + if (cg.getContext() == CodeGenerator::JavaFFICppDecl) { + // java_stubs.h + cg.printf(");\n\n"); + return; + } + + cg.indentBegin(") {\n"); + + // support static/instance methods + if (ret) { + cg.printf("void *result;\n"); + cg.printf("int kind = "); + cg.printf("%s%s%s(&result", + Option::FFIFnPrefix, + (inClass ? (m_className + "_cls_").c_str() : ""), fname.c_str()); + if (!isStatic || ac > 0 || varArgs) cg.printf(", "); + } + else { + cg.printf("%s%s%s(", Option::FFIFnPrefix, + (inClass ? (m_className + "_cls_").c_str() : ""), + fname.c_str()); + } + cg.printf("%s);\n", args.str().c_str()); + if (ret) { + if (!inClass) { + // HphpMain extends hphp.Hphp. + cg.printf("jclass hphp = env->GetSuperclass(target);\n"); + } + else { + cg.printf("jclass hphp = env->FindClass(\"hphp/Hphp\");\n"); + } + cg.printf("return exportVariantToJava(env, hphp, result, kind);\n"); + } + + cg.indentEnd("} /* function */\n\n"); +} + +void MethodStatement::outputSwigFFIStub(CodeGenerator &cg, + AnalysisResultPtr ar) { + FunctionScopePtr funcScope = m_funcScope.lock(); + bool varArgs = funcScope->isVariableArgument(); + bool ret = funcScope->getReturnType(); + string fname = funcScope->getId(); + string originalName = funcScope->getOriginalName(); + int ac = funcScope->getMaxParamCount(); + + if (cg.getContext() == CodeGenerator::SwigFFIImpl) { + printSource(cg); + } + + cg.printf("Variant *%s(HphpSession *s", originalName.c_str()); + ostringstream args; + bool first = true; + for (int i = 0; i < ac; i++) { + cg.printf(", Variant *a%d", i); + if (first) first = false; + else args << ", "; + args << "a" << i; + } + if (varArgs) { + cg.printf(", Variant *va"); + if (!first) args << ", "; + args << "va"; + } + + if (cg.getContext() == CodeGenerator::SwigFFIDecl) { + cg.printf(");\n\n"); + return; + } + + cg.indentBegin(") {\n"); + if (ret) { + cg.printf("void *result;\n"); + cg.printf("int kind = "); + cg.printf("%s%s(&result", Option::FFIFnPrefix, fname.c_str()); + if (ac > 0 || varArgs) cg.printf(", "); + } else { + cg.printf("%s%s(", Option::FFIFnPrefix, fname.c_str()); + } + cg.printf("%s);\n", args.str().c_str()); + cg.printf("Variant *ret = "); + if (ret) { + cg.printf("hphpBuildVariant(kind, result);\n"); + cg.printf("s->addVariant(ret);\n"); + } else { + cg.printf("hphpBuildVariant(0, 0);\n"); + cg.printf("s->addVariant(ret);\n"); + } + cg.printf("return ret;\n"); + cg.indentEnd("}\n\n"); +} diff --git a/src/lib/statement/method_statement.h b/src/lib/statement/method_statement.h new file mode 100644 index 0000000000000..9c58707d6a91c --- /dev/null +++ b/src/lib/statement/method_statement.h @@ -0,0 +1,99 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __METHOD_STATEMENT_H__ +#define __METHOD_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ModifierExpression); +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(FunctionScope); +DECLARE_BOOST_TYPES(MethodStatement); + +class MethodStatement : public Statement, public IParseHandler, + public IScopeStatement { +public: + MethodStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + ModifierExpressionPtr modifiers, bool ref, + const std::string &name, + ExpressionListPtr params, StatementListPtr stmt, int attr, + bool method = true); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return true; } + virtual bool hasImpl() const { return false; } + virtual int getRecursiveCount() const; + // implementing IParseHandler + virtual void onParse(AnalysisResultPtr ar); + + std::string getOriginalName() const { return m_originalName;} + std::string getName() const { return m_name;} + void setName(const std::string name) { m_name = name; } + std::string getFullName() const; + virtual BlockScopePtr getScope(); + FunctionScopePtr getFunctionScope() { return m_funcScope.lock();} + ExpressionListPtr getParams() { return m_params;} + StatementListPtr getStmts() { return m_stmt;} + bool isRef(int index = -1) const; + + void setFunctionScope(FunctionScopePtr f) { + m_funcScope = f; + } + + ModifierExpressionPtr getModifiers() { + return m_modifiers; + } + + void outputCPPStaticMethodWrapper(CodeGenerator &cg, + AnalysisResultPtr ar, + const char *cls); + +protected: + bool m_method; + ModifierExpressionPtr m_modifiers; + bool m_ref; + std::string m_name; + std::string m_originalName; + std::string m_className; + ExpressionListPtr m_params; + StatementListPtr m_stmt; + boost::weak_ptr m_funcScope; + int m_attribute; + + FunctionScopePtr onParseImpl(AnalysisResultPtr ar); + void outputCPPStmt(CodeGenerator &cg, AnalysisResultPtr ar); + void addParamRTTI(AnalysisResultPtr ar); + + /** + * The one FFI generation master that rules them all! + */ + bool outputFFI(CodeGenerator &cg, AnalysisResultPtr ar); + + void outputHSFFIStub(CodeGenerator &cg, AnalysisResultPtr ar); + void outputCPPFFIStub(CodeGenerator &cg, AnalysisResultPtr ar); + void outputJavaFFIStub(CodeGenerator &cg, AnalysisResultPtr ar); + void outputJavaFFICPPStub(CodeGenerator &cg, AnalysisResultPtr ar); + void outputSwigFFIStub(CodeGenerator &cg, AnalysisResultPtr ar); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __METHOD_STATEMENT_H__ diff --git a/src/lib/statement/return_statement.cpp b/src/lib/statement/return_statement.cpp new file mode 100644 index 0000000000000..3207930ca5cb0 --- /dev/null +++ b/src/lib/statement/return_statement.cpp @@ -0,0 +1,131 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ReturnStatement::ReturnStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_exp(exp) { +} + +StatementPtr ReturnStatement::clone() { + ReturnStatementPtr stmt(new ReturnStatement(*this)); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ReturnStatement::analyzeProgram(AnalysisResultPtr ar) { + if (m_exp) m_exp->analyzeProgram(ar); +} + +StatementPtr ReturnStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + return StatementPtr(); +} + +StatementPtr ReturnStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return StatementPtr(); +} + +void ReturnStatement::inferTypes(AnalysisResultPtr ar) { + if (m_exp) { + FunctionScopePtr funcScope = + dynamic_pointer_cast(ar->getScope()); + if (funcScope) { + if (funcScope->isRefReturn()) { + m_exp->setContext(Expression::RefValue); + } + TypePtr ret; + if (funcScope->isOverriding()) { + if (funcScope->getReturnType()) { + ret = m_exp->inferAndCheck(ar, funcScope->getReturnType(), false); + } else { + ConstructPtr self = shared_from_this(); + ret = m_exp->inferAndCheck(ar, NEW_TYPE(Some), false); + ar->getCodeError()->record(self, CodeError::BadReturnStatement, + self); + } + } else { + ret = m_exp->inferAndCheck(ar, NEW_TYPE(Some), false); + funcScope->setReturnType(ar, ret); + } + } else { + m_exp->inferAndCheck(ar, Type::Int64, false); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ReturnStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_exp) { + cg.printf("return "); + m_exp->outputPHP(cg, ar); + cg.printf(";\n"); + } else { + cg.printf("return;\n"); + } +} + +void ReturnStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (hasHphpNote("C++")) { + cg.printf("%s", getEmbedded().c_str()); + } + + bool braced = false; + FunctionScopePtr func = dynamic_pointer_cast(ar->getScope()); + ClassScopePtr cls = ar->getClassScope(); + if (func->isConstructor(cls)) { + cg.indentBegin("{\n"); braced = true; + cg.printf("gasInCtor(oldInCtor);\n"); + } + cg.printf("return"); + + if (m_exp) { + cg.printf(" "); + m_exp->outputCPP(cg, ar); + } else if (func && + !(func->inPseudoMain() && !Option::GenerateCPPMain && + cg.getOutput() != CodeGenerator::SystemCPP)) { + TypePtr type = func->getReturnType(); + if (type) { + const char *initializer = type->getCPPInitializer(); + cg.printf(" %s", initializer ? initializer : "null"); + } + } + + cg.printf(";\n"); + if (braced) cg.indentEnd("}\n"); +} diff --git a/src/lib/statement/return_statement.h b/src/lib/statement/return_statement.h new file mode 100644 index 0000000000000..7e748db0adb2b --- /dev/null +++ b/src/lib/statement/return_statement.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __RETURN_STATEMENT_H__ +#define __RETURN_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ReturnStatement); + +class ReturnStatement : public Statement { +public: + ReturnStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasRetExp() const { return m_exp; } + +private: + ExpressionPtr m_exp; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __RETURN_STATEMENT_H__ diff --git a/src/lib/statement/scope_statement.cpp b/src/lib/statement/scope_statement.cpp new file mode 100644 index 0000000000000..f63d986201b68 --- /dev/null +++ b/src/lib/statement/scope_statement.cpp @@ -0,0 +1,19 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// diff --git a/src/lib/statement/scope_statement.h b/src/lib/statement/scope_statement.h new file mode 100644 index 0000000000000..5a7592f861492 --- /dev/null +++ b/src/lib/statement/scope_statement.h @@ -0,0 +1,37 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __SCOPE_STATEMENT_H__ +#define __SCOPE_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(BlockScope); +DECLARE_BOOST_TYPES(IScopeStatement); + +class IScopeStatement { +public: + virtual ~IScopeStatement() {} + + virtual BlockScopePtr getScope() = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __SCOPE_STATEMENT_H__ diff --git a/src/lib/statement/statement.cpp b/src/lib/statement/statement.cpp new file mode 100644 index 0000000000000..066455b6f2dd8 --- /dev/null +++ b/src/lib/statement/statement.cpp @@ -0,0 +1,36 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +using namespace HPHP; + +/////////////////////////////////////////////////////////////////////////////// + +Statement::Statement(LocationPtr loc, KindOf kindOf) + : Construct(loc), m_kindOf(kindOf) { +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void Statement::addElement(StatementPtr stmt) { + ASSERT(false); +} + +void Statement::insertElement(StatementPtr stmt, int index /* = 0 */) { + ASSERT(false); +} diff --git a/src/lib/statement/statement.h b/src/lib/statement/statement.h new file mode 100644 index 0000000000000..964668bfd251c --- /dev/null +++ b/src/lib/statement/statement.h @@ -0,0 +1,127 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __STATEMENT_H__ +#define __STATEMENT_H__ + +#include + +#define STATEMENT_CONSTRUCTOR_PARAMETERS \ + LocationPtr loc, Statement::KindOf kindOf +#define STATEMENT_CONSTRUCTOR_PARAMETER_VALUES \ + loc, kindOf +#define DECLARE_STATEMENT_VIRTUAL_FUNCTIONS \ + virtual void analyzeProgram(AnalysisResultPtr ar); \ + virtual StatementPtr clone(); \ + virtual StatementPtr preOptimize(AnalysisResultPtr ar); \ + virtual StatementPtr postOptimize(AnalysisResultPtr ar); \ + virtual void inferTypes(AnalysisResultPtr ar); \ + virtual void outputPHP(CodeGenerator &cg, AnalysisResultPtr ar); \ + virtual void outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) +#define NULL_STATEMENT() \ + BlockStatementPtr(new BlockStatement(getLocation(), KindOfBlockStatement, \ + StatementListPtr())) + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +DECLARE_BOOST_TYPES(Statement); + +class Statement : public Construct { +public: + enum KindOf { + KindOfFunctionStatement, + KindOfClassStatement, + KindOfInterfaceStatement, + KindOfClassVariable, + KindOfClassConstant, + KindOfMethodStatement, + KindOfStatementList, + KindOfBlockStatement, + KindOfIfBranchStatement, + KindOfIfStatement, + KindOfWhileStatement, + KindOfDoStatement, + KindOfForStatement, + KindOfSwitchStatement, + KindOfCaseStatement, + KindOfBreakStatement, + KindOfContinueStatement, + KindOfReturnStatement, + KindOfGlobalStatement, + KindOfStaticStatement, + KindOfEchoStatement, + KindOfUnsetStatement, + KindOfExpStatement, + KindOfForEachStatement, + KindOfCatchStatement, + KindOfTryStatement, + KindOfThrowStatement, + /* KindOfCount = 27 */ + }; + +public: + Statement(STATEMENT_CONSTRUCTOR_PARAMETERS); + + /** + * Type checking without RTTI. + */ + bool is(KindOf type) const { return m_kindOf == type;} + KindOf getKindOf() const { return m_kindOf;} + + /** + * This is to avoid dynamic casting to StatementList in Parser. + */ + virtual void addElement(StatementPtr stmt); + virtual void insertElement(StatementPtr stmt, int index = 0); + + /** + * Return a name for stats purpose. + */ + virtual std::string getName() const { return "";} + + /** + * Called before type inference. + */ + virtual StatementPtr preOptimize(AnalysisResultPtr ar) = 0; + + /** + * Called after type inference. + */ + virtual StatementPtr postOptimize(AnalysisResultPtr ar) = 0; + + /** + * Called when types need to be inferred inside this statement. + */ + virtual void inferTypes(AnalysisResultPtr ar) = 0; + + virtual bool hasDecl() const { return false; } + virtual bool hasImpl() const { return hasEffect(); } + virtual bool hasRetExp() const { return false; } + + virtual StatementPtr clone() { + ASSERT(false); + return StatementPtr(); + } + + virtual int getRecursiveCount() const { return 1; } + +protected: + KindOf m_kindOf; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __STATEMENT_H__ diff --git a/src/lib/statement/statement_list.cpp b/src/lib/statement/statement_list.cpp new file mode 100644 index 0000000000000..6357eabae2722 --- /dev/null +++ b/src/lib/statement/statement_list.cpp @@ -0,0 +1,368 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +StatementList::StatementList +(STATEMENT_CONSTRUCTOR_PARAMETERS) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_included(false) { +} + +StatementPtr StatementList::clone() { + StatementListPtr stmt(new StatementList(*this)); + stmt->m_stmts.clear(); + for (unsigned int i = 0; i < m_stmts.size(); i++) { + stmt->m_stmts.push_back(Clone(m_stmts[i])); + } + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +void StatementList::addElement(StatementPtr stmt) { + m_stmts.push_back(stmt); +} + +void StatementList::insertElement(StatementPtr stmt, int index /* = 0 */) { + ASSERT(index >= 0 && index <= (int)m_stmts.size()); + m_stmts.insert(m_stmts.begin() + index, stmt); +} + +void StatementList::removeElement(int index) { + m_stmts.erase(m_stmts.begin() + index, m_stmts.begin() + index + 1); +} + +void StatementList::shift(int from, int to) { + ASSERT(from >= 0 && from <= (int)m_stmts.size()); + ASSERT(to >= 0 && to <= (int)m_stmts.size()); + StatementPtr stmt = m_stmts[from]; + for (int i = from; i < to; i++) { + m_stmts[i] = m_stmts[i+1]; + } + m_stmts[to] = stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +StatementPtr StatementList::operator[](int index) { + ASSERT(index >= 0 && index < getCount()); + return m_stmts[index]; +} + +bool StatementList::hasEffect() const { + for (unsigned int i = 0; i < m_stmts.size(); i++) { + if (m_stmts[i]->hasEffect()) return true; + } + return !m_stmts.empty(); +} + +bool StatementList::hasDecl() const { + for (unsigned int i = 0; i < m_stmts.size(); i++) { + if (m_stmts[i]->hasDecl()) return true; + } + return false; +} + +bool StatementList::hasImpl() const { + for (unsigned int i = 0; i < m_stmts.size(); i++) { + if (m_stmts[i]->hasImpl()) return true; + } + return false; +} + +bool StatementList::hasRetExp() const { + for (unsigned int i = 0; i < m_stmts.size(); i++) { + if (m_stmts[i]->hasRetExp()) return true; + } + return false; +} + +void StatementList::analyzeProgram(AnalysisResultPtr ar) { + m_included = true; + for (unsigned int i = 0; i < m_stmts.size(); i++) { + StatementPtr stmt = m_stmts[i]; + + // effect testing + if (ar->isFirstPass() && !stmt->hasEffect() && + !stmt->is(Statement::KindOfStatementList)) { + ar->getCodeError()->record(shared_from_this(), + CodeError::StatementHasNoEffect, stmt); + } + + // changing AUTOLOAD to includes + if (ar->getPhase() == AnalysisResult::AnalyzeInclude && + stmt->is(Statement::KindOfExpStatement)) { + ExpStatementPtr expStmt = dynamic_pointer_cast(stmt); + if (stmt->isFileLevel()) { + expStmt->analyzeAutoload(ar); + } + expStmt->analyzeShortCircuit(ar); + } + + bool scopeStmt = stmt->is(Statement::KindOfFunctionStatement) || + stmt->is(Statement::KindOfClassStatement) || + stmt->is(Statement::KindOfInterfaceStatement); + if (ar->getPhase() != AnalysisResult::AnalyzeTopLevel || !scopeStmt) { + /* Recurse when analyzing include/all OR when not a scope */ + stmt->analyzeProgram(ar); + } + } +} + +bool StatementList::mergeConcatAssign(AnalysisResultPtr ar) { + // check for vector string concat assignment such as + // $space = " "; + // $a .= "hello"; + // $a .= $space; + // $a .= "world!"; + // turn into (for constant folding and concat sequence) + // $a .= " " . "hello " . $space . "world!"; + unsigned int i = 0; + bool merged = false; + do { + std::string lhsName; + int length = 0; + for (; i < m_stmts.size(); i++) { + StatementPtr stmt = m_stmts[i]; + if (!stmt->is(Statement::KindOfExpStatement)) break; + ExpStatementPtr expStmt = dynamic_pointer_cast(stmt); + ExpressionPtr exp = expStmt->getExpression(); + + // check the first assignment + if (exp->is(Expression::KindOfAssignmentExpression)) { + AssignmentExpressionPtr assignment_exp = + dynamic_pointer_cast(exp); + ExpressionPtr variable = assignment_exp->getVariable(); + ExpressionPtr value = assignment_exp->getValue(); + std::string variableName = variable->getText(); + if (variableName.find("->") != std::string::npos) break; + if (value->hasEffect()) break; + // cannot turn $a .= $b; a .= $a into $a .= $b . $a; + if (value->getText().find(variableName) != std::string::npos) break; + if (lhsName.empty()) { + lhsName = variable->getText(); + length++; + continue; + } else { + break; + } + } else if (!exp->is(Expression::KindOfBinaryOpExpression)) { + break; + } + BinaryOpExpressionPtr binaryOpExp = + dynamic_pointer_cast(exp); + if (binaryOpExp->getOp() != T_CONCAT_EQUAL) break; + ExpressionPtr exp1 = binaryOpExp->getExp1(); + std::string exp1Text = exp1->getText(); + if (exp1Text.find("->") != std::string::npos) break; + ExpressionPtr exp2 = binaryOpExp->getExp2(); + if (exp2->hasEffect()) break; + if (exp2->getText().find(exp1Text) != std::string::npos) break; + if (lhsName.empty()) { + lhsName = exp1Text; + length++; + } else if (lhsName == exp1Text) { + length++; + } else { + break; + } + } + if (length > 1) { + // replace m_stmts[j] to m_stmts[i - 1] with a new statement + unsigned j = i - length; + ExpStatementPtr expStmt; + ExpressionPtr exp; + BinaryOpExpressionPtr binaryOpExp; + ExpressionPtr var; + ExpressionPtr exp1; + ExpressionPtr exp2; + bool isAssignment = false; + expStmt = dynamic_pointer_cast(m_stmts[j++]); + exp = expStmt->getExpression(); + if (exp->is(Expression::KindOfAssignmentExpression)) { + isAssignment = true; + AssignmentExpressionPtr assignment_exp = + dynamic_pointer_cast(exp); + var = assignment_exp->getVariable(); + exp1 = assignment_exp->getValue(); + } else { + binaryOpExp = dynamic_pointer_cast(exp); + var = binaryOpExp->getExp1(); + exp1 = binaryOpExp->getExp2(); + } + + for (; j < i; j++) { + expStmt = dynamic_pointer_cast(m_stmts[j]); + exp = expStmt->getExpression(); + binaryOpExp = dynamic_pointer_cast(exp); + exp2 = binaryOpExp->getExp2(); + exp1 = BinaryOpExpressionPtr(new BinaryOpExpression(getLocation(), + Expression::KindOfBinaryOpExpression, + exp1, exp2, '.')); + } + if (isAssignment) { + exp = AssignmentExpressionPtr + (new AssignmentExpression(exp->getLocation(), + Expression::KindOfAssignmentExpression, + var, exp1, + false)); + } else { + exp = BinaryOpExpressionPtr(new BinaryOpExpression(getLocation(), + Expression::KindOfBinaryOpExpression, + var, exp1, T_CONCAT_EQUAL)); + } + expStmt = ExpStatementPtr(new ExpStatement(getLocation(), + Statement::KindOfExpStatement, exp)); + m_stmts[i - length] = expStmt; + for (j = i - (length - 1); i > j; i--) removeElement(j); + merged = true; + } else if (length == 0) { + i++; + } + } while (i < m_stmts.size()); + return merged; +} + +StatementPtr StatementList::preOptimize(AnalysisResultPtr ar) { + for (unsigned int i = 0; i < m_stmts.size(); i++) { + ar->preOptimize(m_stmts[i]); + } + if (mergeConcatAssign(ar)) ar->incOptCounter(); + return StatementPtr(); +} + +StatementPtr StatementList::postOptimize(AnalysisResultPtr ar) { + for (unsigned int i = 0; i < m_stmts.size(); i++) { + ar->postOptimize(m_stmts[i]); + } + return StatementPtr(); +} + +void StatementList::inferTypes(AnalysisResultPtr ar) { + for (unsigned int i = 0; i < m_stmts.size(); i++) { + m_stmts[i]->inferTypes(ar); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void StatementList::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + for (unsigned int i = 0; i < m_stmts.size(); i++) { + StatementPtr stmt = m_stmts[i]; + + switch (cg.getContext()) { + case CodeGenerator::NoContext: + stmt->outputPHP(cg, ar); + break; + case CodeGenerator::PhpDeclaration: + if (stmt->is(Statement::KindOfFunctionStatement) || + stmt->is(Statement::KindOfClassStatement) || + stmt->is(Statement::KindOfInterfaceStatement)) { + cg.setContext(CodeGenerator::PhpImplementation); + stmt->outputPHP(cg, ar); + cg.setContext(CodeGenerator::PhpDeclaration); + } + break; + case CodeGenerator::PhpImplementation: + if (!stmt->is(Statement::KindOfFunctionStatement) && + !stmt->is(Statement::KindOfClassStatement) && + !stmt->is(Statement::KindOfInterfaceStatement)) { + stmt->outputPHP(cg, ar); + } + break; + default: + ASSERT(false); + } + } +} + +void StatementList::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + FunctionScopePtr func = ar->getFunctionScope(); + bool inPseudoMain = func && func->inPseudoMain(); + if (inPseudoMain) { + // We need these declarations to go first, because PHP allows top level + // function and class declarations to appear after usage. + for (unsigned int i = 0; i < m_stmts.size(); i++) { + StatementPtr stmt = m_stmts[i]; + if (stmt->is(Statement::KindOfFunctionStatement) || + stmt->is(Statement::KindOfClassStatement) || + stmt->is(Statement::KindOfInterfaceStatement)) { + stmt->outputCPP(cg,ar); + } + } + } + + for (unsigned int i = 0; i < m_stmts.size(); i++) { + StatementPtr stmt = m_stmts[i]; + if (stmt->is(Statement::KindOfClassStatement)) { + if (!inPseudoMain) stmt->outputCPP(cg, ar); + } else if (!(stmt->is(Statement::KindOfFunctionStatement) || + stmt->is(Statement::KindOfInterfaceStatement)) || + !inPseudoMain) { + stmt->outputCPP(cg, ar); + if (stmt->is(Statement::KindOfMethodStatement)) { + MethodStatementPtr methodStmt = + dynamic_pointer_cast(stmt); + std::string methodName = methodStmt->getName(); + if (methodName == "__get") { + FunctionScopePtr funcScope = methodStmt->getFunctionScope(); + std::string name = funcScope->getName(); + funcScope->setName("__lval"); + methodStmt->setName("__lval"); + methodStmt->outputCPP(cg, ar); + funcScope->setName(name); + methodStmt->setName("__get"); + } else if (methodName == "offsetget") { + ClassScopePtr cls = ar->getClassScope(); + std::string arrayAccess("arrayaccess"); + if (cls->derivesFrom(ar, arrayAccess)) { + FunctionScopePtr funcScope = methodStmt->getFunctionScope(); + std::string name = funcScope->getName(); + funcScope->setName("__offsetget_lval"); + methodStmt->setName("__offsetget_lval"); + methodStmt->outputCPP(cg, ar); + funcScope->setName(name); + methodStmt->setName("offsetget"); + } + } + } + } + } +} diff --git a/src/lib/statement/statement_list.h b/src/lib/statement/statement_list.h new file mode 100644 index 0000000000000..7b00ad13691d9 --- /dev/null +++ b/src/lib/statement/statement_list.h @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __STATEMENT_LIST_H__ +#define __STATEMENT_LIST_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(StatementList); + +class StatementList : public Statement { +public: + StatementList(STATEMENT_CONSTRUCTOR_PARAMETERS); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const; + virtual bool hasImpl() const; + virtual bool hasRetExp() const; + virtual void addElement(StatementPtr stmt); + virtual void insertElement(StatementPtr stmt, int index = 0); + virtual bool hasEffect() const; + virtual int getRecursiveCount() const { + int ct = 0; + for (StatementPtrVec::const_iterator it = m_stmts.begin(); + it != m_stmts.end(); ++it) { + ct += (*it)->getRecursiveCount(); + } + return ct; + } + void removeElement(int index); + + int getCount() const { return m_stmts.size();} + StatementPtr operator[](int index); + + /** + * This is for reordering out-of-order defaults. + */ + void shift(int from, int to); + +private: + bool mergeConcatAssign(AnalysisResultPtr ar); + + StatementPtrVec m_stmts; + bool m_included; // whether includes have been inlined +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __STATEMENT_LIST_H__ diff --git a/src/lib/statement/static_statement.cpp b/src/lib/statement/static_statement.cpp new file mode 100644 index 0000000000000..96c7fa68264f0 --- /dev/null +++ b/src/lib/statement/static_statement.cpp @@ -0,0 +1,232 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +StaticStatement::StaticStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionListPtr exp) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_exp(exp) { +} + +StatementPtr StaticStatement::clone() { + StaticStatementPtr stmt(new StaticStatement(*this)); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void StaticStatement::analyzeProgram(AnalysisResultPtr ar) { + m_exp->analyzeProgram(ar); + BlockScopePtr scope = ar->getScope(); + for (int i = 0; i < m_exp->getCount(); i++) { + ExpressionPtr exp = (*m_exp)[i]; + ExpressionPtr variable; + ExpressionPtr value; + if (ar->getPhase() == AnalysisResult::AnalyzeInclude) { + // turn static $a; into static $a = null; + if (exp->is(Expression::KindOfSimpleVariable)) { + variable = dynamic_pointer_cast(exp); + exp = AssignmentExpressionPtr + (new AssignmentExpression(exp->getLocation(), + Expression::KindOfAssignmentExpression, + variable, + CONSTANT("null"), + false)); + (*m_exp)[i] = exp; + } + } + if (exp->is(Expression::KindOfAssignmentExpression)) { + AssignmentExpressionPtr assignment_exp = + dynamic_pointer_cast(exp); + variable = assignment_exp->getVariable(); + value = assignment_exp->getValue(); + } else { + ASSERT(false); + } + SimpleVariablePtr var = dynamic_pointer_cast(variable); + if (ar->getPhase() == AnalysisResult::AnalyzeInclude) { + if (scope->getVariables()->setStaticInitVal(var->getName(), value)) { + ar->getCodeError()->record(CodeError::DeclaredStaticVariableTwice, + exp); + } + } else if (ar->getPhase() == AnalysisResult::AnalyzeAll) { + // update initial value + const string &name = var->getName(); + ExpressionPtr initValue = + (dynamic_pointer_cast + (scope->getVariables()->getStaticInitVal(name)))->clone(); + exp = AssignmentExpressionPtr + (new AssignmentExpression(exp->getLocation(), + Expression::KindOfAssignmentExpression, + variable, initValue, false)); + (*m_exp)[i] = exp; + } + } +} + +StatementPtr StaticStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + return StatementPtr(); +} + +StatementPtr StaticStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return StatementPtr(); +} + +void StaticStatement::inferTypes(AnalysisResultPtr ar) { + BlockScopePtr scope = ar->getScope(); + if (scope->inPseudoMain()) { // static just means to unset at global level + for (int i = 0; i < m_exp->getCount(); i++) { + ExpressionPtr exp = (*m_exp)[i]; + if (exp->is(Expression::KindOfAssignmentExpression)) { + AssignmentExpressionPtr assignment_exp = + dynamic_pointer_cast(exp); + ExpressionPtr variable = assignment_exp->getVariable(); + if (variable->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = + dynamic_pointer_cast(variable); + var->setContext(Expression::Declaration); + scope->getVariables()->forceVariant(ar, var->getName()); + } else { + ASSERT(false); + } + } else { + ASSERT(false); + } + } + m_exp->inferTypes(ar, NEW_TYPE(Any), true); + return; + } + scope->getVariables()->setAttribute(VariableTable::InsideStaticStatement); + for (int i = 0; i < m_exp->getCount(); i++) { + ExpressionPtr exp = (*m_exp)[i]; + VariableTablePtr variables = scope->getVariables(); + if (exp->is(Expression::KindOfAssignmentExpression)) { + AssignmentExpressionPtr assignment_exp = + dynamic_pointer_cast(exp); + ExpressionPtr variable = assignment_exp->getVariable(); + if (variable->is(Expression::KindOfSimpleVariable)) { + SimpleVariablePtr var = dynamic_pointer_cast(variable); + var->setContext(Expression::Declaration); + const std::string &name = var->getName(); + /* If we have already seen this variable in the current scope and + it is not a static variable, record this variable as "redeclared" + to force Variant type. + */ + if (ar->isFirstPass()) { + variables->checkRedeclared(name, KindOfStaticStatement); + } + /* If this is not a top-level static statement, the variable also + needs to be Variant type. This should not be a common use case in + php code. + */ + if (!isTopLevel()) { + variables->addNestedStatic(name); + } + + if (variables->needLocalCopy(name)) { + variables->forceVariant(ar, name); + } + } else { + ASSERT(false); + } + } else { + ASSERT(false); + } + exp->inferAndCheck(ar, NEW_TYPE(Any), false); + } + scope->getVariables()->clearAttribute(VariableTable::InsideStaticStatement); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void StaticStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("static "); + m_exp->outputPHP(cg, ar); + cg.printf(";\n"); +} + +void StaticStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + BlockScopePtr scope = ar->getScope(); + if (scope->inPseudoMain()) { + if (m_exp->getCount() > 1) cg.indentBegin("{\n"); + for (int i = 0; i < m_exp->getCount(); i++) { + ExpressionPtr exp = (*m_exp)[i]; + if (exp->is(Expression::KindOfAssignmentExpression)) { + exp->outputCPP(cg, ar); + cg.printf(";\n"); + } else { + ASSERT(false); + } + } + if (m_exp->getCount() > 1) cg.indentEnd("}\n"); + return; + } + + VariableTablePtr variables = scope->getVariables(); + if (m_exp->getCount() > 1) cg.indentBegin("{\n"); + for (int i = 0; i < m_exp->getCount(); i++) { + ExpressionPtr exp = (*m_exp)[i]; + if (exp->is(Expression::KindOfAssignmentExpression)) { + AssignmentExpressionPtr assignment_exp = + dynamic_pointer_cast(exp); + ExpressionPtr variable = assignment_exp->getVariable(); + SimpleVariablePtr var = dynamic_pointer_cast(variable); + var->setContext(Expression::Declaration); + const std::string &name = var->getName(); + + if (variables->needLocalCopy(name)) { + cg.printf("%s%s = ref(%s%s);\n", + Option::VariablePrefix, name.c_str(), + Option::StaticVariablePrefix, name.c_str()); + } + + cg.indentBegin("if (!%s%s%s) {\n", Option::InitPrefix, + Option::StaticVariablePrefix, name.c_str()); + exp->outputCPP(cg, ar); + cg.printf(";\n"); + cg.printf("%s%s%s = true;\n", Option::InitPrefix, + Option::StaticVariablePrefix, name.c_str()); + cg.indentEnd("}\n"); + } else { + ASSERT(false); + } + } + if (m_exp->getCount() > 1) cg.indentEnd("}\n"); +} diff --git a/src/lib/statement/static_statement.h b/src/lib/statement/static_statement.h new file mode 100644 index 0000000000000..464eef7621453 --- /dev/null +++ b/src/lib/statement/static_statement.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __STATIC_STATEMENT_H__ +#define __STATIC_STATEMENT_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(StaticStatement); + +class StaticStatement : public Statement { +public: + StaticStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionListPtr exp); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + +private: + ExpressionListPtr m_exp; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __STATIC_STATEMENT_H__ diff --git a/src/lib/statement/switch_statement.cpp b/src/lib/statement/switch_statement.cpp new file mode 100644 index 0000000000000..1d87192b408f8 --- /dev/null +++ b/src/lib/statement/switch_statement.cpp @@ -0,0 +1,238 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +SwitchStatement::SwitchStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp, StatementListPtr cases) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_exp(exp), m_cases(cases) { +} + +StatementPtr SwitchStatement::clone() { + SwitchStatementPtr stmt(new SwitchStatement(*this)); + stmt->m_cases = Clone(m_cases); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +int SwitchStatement::getRecursiveCount() const { + return 1 + (m_cases ? m_cases->getRecursiveCount() : 0); +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void SwitchStatement::analyzeProgram(AnalysisResultPtr ar) { + m_exp->analyzeProgram(ar); + if (m_cases) m_cases->analyzeProgram(ar); +} + +bool SwitchStatement::hasDecl() const { + return m_cases && m_cases->hasDecl(); +} + +bool SwitchStatement::hasRetExp() const { + return m_cases && m_cases->hasRetExp(); +} + +StatementPtr SwitchStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + ar->preOptimize(m_cases); + return StatementPtr(); +} + +StatementPtr SwitchStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + ar->postOptimize(m_cases); + return StatementPtr(); +} + +void SwitchStatement::inferTypes(AnalysisResultPtr ar) { + // we optimize the most two common cases of switch statements + bool allInteger = true; + bool allString = true; + if (m_cases && m_cases->getCount()) { + for (int i = 0; i < m_cases->getCount(); i++) { + CaseStatementPtr stmt = + dynamic_pointer_cast((*m_cases)[i]); + if (!stmt->getCondition()) { + if (m_cases->getCount() == 1) allInteger = allString = false; + } else { + if (!stmt->isLiteralInteger()) allInteger = false; + if (!stmt->isLiteralString()) allString = false; + } + } + } + if (allInteger && allString) { + allInteger = allString = false; + } + + TypePtr ret; + if (allInteger) { + ret = m_exp->inferAndCheck(ar, Type::Int64, false); + } else if (allString) { + // We're not able to do this, because switch($obj) may work on an object + // that didn't implement __toString(), throwing an exception, which isn't + // consistent with PHP. + //ret = m_exp->inferAndCheck(ar, Type::String, false); + ret = m_exp->inferAndCheck(ar, NEW_TYPE(Some), false); + } else { + ret = m_exp->inferAndCheck(ar, NEW_TYPE(Some), false); + } + ConstructPtr self = shared_from_this(); + if (m_cases && m_cases->getCount()) { + bool checking = false; + vector defaults; + int defaultCount = 0; + for (int i = 0; i < m_cases->getCount(); i++) { + CaseStatementPtr stmt = + dynamic_pointer_cast((*m_cases)[i]); + stmt->inferAndCheck(ar, ret, false); + ExpressionPtr cond = stmt->getCondition(); + if (!cond) { + checking = true; + defaultCount++; + } else if (checking && cond && ar->isFirstPass()) { + defaults.push_back(i); + ar->getCodeError()->record(self, CodeError::CaseAfterDefault, stmt); + } + } + if (defaultCount > 1 && ar->isFirstPass()) { + ar->getCodeError()->record(self, CodeError::MoreThanOneDefault, m_cases); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void SwitchStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("switch ("); + m_exp->outputPHP(cg, ar); + cg.printf(") {\n"); + if (m_cases) m_cases->outputPHP(cg, ar); + cg.printf("}\n"); +} + +void SwitchStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + int labelId = cg.createNewId(ar); + + bool staticCases = true; + if (!m_exp->getType()->isInteger()) { + staticCases = false; + } else if (m_cases) { + bool seenDefault = false; + set seenNums; + for (int i = 0; i < m_cases->getCount(); i++) { + CaseStatementPtr stmt = + dynamic_pointer_cast((*m_cases)[i]); + if (stmt->getCondition()) { + if (!stmt->isLiteralInteger() || seenDefault) { + staticCases = false; + break; + } + + // detecting duplicate case value + int64 num = stmt->getLiteralInteger(); + if (seenNums.find(num) != seenNums.end()) { + staticCases = false; + break; + } + seenNums.insert(num); + } else { + seenDefault = true; + } + } + } + + labelId |= CodeGenerator::InsideSwitch; + if (staticCases) labelId |= CodeGenerator::StaticCases; + cg.pushBreakScope(labelId, false); + cg.indentBegin("{\n"); + + if (staticCases) { + cg.printf("switch ("); + m_exp->outputCPP(cg, ar); + cg.printf(") {\n"); + if (m_cases) m_cases->outputCPP(cg, ar); + cg.printf("}\n"); + } else { + int varId = cg.createNewId(ar); + m_exp->getType()->outputCPPDecl(cg, ar); + cg.printf(" %s%d = (", Option::TempPrefix, varId); + m_exp->outputCPP(cg, ar); + cg.printf(");\n"); + if (m_cases && m_cases->getCount()) { + int caseVar = cg.createNewId(ar); + cg.printf("int %s%d = -1;\n", Option::TempPrefix, caseVar); + CaseStatementPtr defaultCase; + int defaultCaseNum = -1; + for (int i = 0; i < m_cases->getCount(); i++) { + CaseStatementPtr stmt = + dynamic_pointer_cast((*m_cases)[i]); + if (stmt->getCondition()) { + if ((!defaultCase && i > 0) || i > 1) cg.printf(" else "); + stmt->outputCPPAsIf(cg, ar, varId, caseVar, i); + } else { + defaultCase = stmt; + defaultCaseNum = i; + } + } + if (defaultCaseNum != -1) { + if (m_cases->getCount() > 1) { + cg.printf(" else "); + } + defaultCase->outputCPPAsIf(cg, ar, varId, caseVar, defaultCaseNum); + } + cg.printf("\n"); + cg.printf("switch (%s%d) {\n", Option::TempPrefix, caseVar); + for (int i = 0; i < m_cases->getCount(); i++) { + CaseStatementPtr stmt = + dynamic_pointer_cast((*m_cases)[i]); + stmt->outputCPPByNumber(cg, ar, i); + } + cg.printf("}\n"); + } + } + + // Even though switch's break/continue will never goto these labels, we need + // them for "break/continue n" inside switches. + labelId &= ~CodeGenerator::BreakScopeBitMask; + if (cg.findLabelId("continue", labelId)) { + cg.printf("continue%d:;\n", labelId); + } + if (cg.findLabelId("break", labelId)) { + cg.printf("break%d:;\n", labelId); + } + cg.indentEnd("}\n"); + cg.popBreakScope(); +} diff --git a/src/lib/statement/switch_statement.h b/src/lib/statement/switch_statement.h new file mode 100644 index 0000000000000..d12ddce85bc17 --- /dev/null +++ b/src/lib/statement/switch_statement.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __SWITCH_STATEMENT_H__ +#define __SWITCH_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(SwitchStatement); + +class SwitchStatement : public Statement { +public: + SwitchStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr exp, StatementListPtr cases); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const; + virtual bool hasRetExp() const; + virtual int getRecursiveCount() const; +private: + ExpressionPtr m_exp; + StatementListPtr m_cases; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __SWITCH_STATEMENT_H__ diff --git a/src/lib/statement/throw_statement.cpp b/src/lib/statement/throw_statement.cpp new file mode 100644 index 0000000000000..8765f4b5d7cd2 --- /dev/null +++ b/src/lib/statement/throw_statement.cpp @@ -0,0 +1,74 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +ThrowStatement::ThrowStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_exp(exp) { +} + +StatementPtr ThrowStatement::clone() { + ThrowStatementPtr stmt(new ThrowStatement(*this)); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void ThrowStatement::analyzeProgram(AnalysisResultPtr ar) { + m_exp->analyzeProgram(ar); +} + +StatementPtr ThrowStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + return StatementPtr(); +} + +StatementPtr ThrowStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return StatementPtr(); +} + +void ThrowStatement::inferTypes(AnalysisResultPtr ar) { + m_exp->inferAndCheck(ar, NEW_TYPE(Object), true); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void ThrowStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("throw "); + m_exp->outputPHP(cg, ar); + cg.printf(";\n"); +} + +void ThrowStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("throw_exception("); + m_exp->outputCPP(cg, ar); + cg.printf(");\n"); +} diff --git a/src/lib/statement/throw_statement.h b/src/lib/statement/throw_statement.h new file mode 100644 index 0000000000000..752875fe98616 --- /dev/null +++ b/src/lib/statement/throw_statement.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __THROW_STATEMENT_H__ +#define __THROW_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ThrowStatement); + +class ThrowStatement : public Statement { +public: + ThrowStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionPtr exp); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + +private: + ExpressionPtr m_exp; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __THROW_STATEMENT_H__ diff --git a/src/lib/statement/try_statement.cpp b/src/lib/statement/try_statement.cpp new file mode 100644 index 0000000000000..2decbcc87b1ec --- /dev/null +++ b/src/lib/statement/try_statement.cpp @@ -0,0 +1,110 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +TryStatement::TryStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + StatementPtr tryStmt, StatementListPtr catches) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_tryStmt(tryStmt), m_catches(catches) { +} + +StatementPtr TryStatement::clone() { + TryStatementPtr stmt(new TryStatement(*this)); + stmt->m_tryStmt = Clone(m_tryStmt); + stmt->m_catches = Clone(m_catches); + return stmt; +} + +int TryStatement::getRecursiveCount() const { + return (m_tryStmt ? m_tryStmt->getRecursiveCount() : 0) + + (m_catches ? m_catches->getRecursiveCount() : 0); +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void TryStatement::analyzeProgram(AnalysisResultPtr ar) { + if (m_tryStmt) m_tryStmt->analyzeProgram(ar); + m_catches->analyzeProgram(ar); +} + +bool TryStatement::hasDecl() const { + if (m_tryStmt && m_tryStmt->hasDecl()) return true; + return m_catches->hasDecl(); +} + +bool TryStatement::hasRetExp() const { + if (m_tryStmt && m_tryStmt->hasRetExp()) return true; + return m_catches->hasRetExp(); +} + +StatementPtr TryStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_tryStmt); + ar->preOptimize(m_catches); + return StatementPtr(); +} + +StatementPtr TryStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_tryStmt); + ar->postOptimize(m_catches); + return StatementPtr(); +} + +void TryStatement::inferTypes(AnalysisResultPtr ar) { + if (m_tryStmt) m_tryStmt->inferTypes(ar); + m_catches->inferTypes(ar); +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void TryStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.indentBegin("try {\n"); + if (m_tryStmt) m_tryStmt->outputPHP(cg, ar); + cg.indentEnd("}"); + m_catches->outputPHP(cg, ar); + cg.printf("\n"); +} + +void TryStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + ASSERT(m_catches->getCount()); + + cg.indentBegin("try {\n"); + if (m_tryStmt) m_tryStmt->outputCPP(cg, ar); + cg.indentEnd("}"); + cg.indentBegin(" catch (Object e) {\n"); + for (int i = 0; i < m_catches->getCount(); i++) { + if (i > 0) cg.printf(" else "); + (*m_catches)[i]->outputCPP(cg, ar); + } + cg.printf(" else {\n"); + cg.printf(" throw;\n"); + cg.printf("}\n"); + cg.indentEnd("}\n"); +} diff --git a/src/lib/statement/try_statement.h b/src/lib/statement/try_statement.h new file mode 100644 index 0000000000000..ef0b72571103b --- /dev/null +++ b/src/lib/statement/try_statement.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TRY_STATEMENT_H__ +#define __TRY_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(StatementList); +DECLARE_BOOST_TYPES(TryStatement); + +class TryStatement : public Statement { +public: + TryStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + StatementPtr tryStmt, StatementListPtr catches); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const; + virtual bool hasRetExp() const; + virtual int getRecursiveCount() const; +private: + StatementPtr m_tryStmt; + StatementListPtr m_catches; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __TRY_STATEMENT_H__ diff --git a/src/lib/statement/unset_statement.cpp b/src/lib/statement/unset_statement.cpp new file mode 100644 index 0000000000000..0626fe2b17ce9 --- /dev/null +++ b/src/lib/statement/unset_statement.cpp @@ -0,0 +1,100 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +UnsetStatement::UnsetStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionListPtr exp) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), m_exp(exp) { + for (int i = 0; i < m_exp->getCount(); i++) { + ExpressionPtr exp = (*m_exp)[i]; + exp->setContext(Expression::UnsetContext); + exp->setContext(Expression::LValue); + exp->setContext(Expression::NoLValueWrapper); + } +} + +StatementPtr UnsetStatement::clone() { + UnsetStatementPtr stmt(new UnsetStatement(*this)); + stmt->m_exp = Clone(m_exp); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void UnsetStatement::analyzeProgram(AnalysisResultPtr ar) { + m_exp->analyzeProgram(ar); +} + +StatementPtr UnsetStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_exp); + return StatementPtr(); +} + +StatementPtr UnsetStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_exp); + return StatementPtr(); +} + +void UnsetStatement::inferTypes(AnalysisResultPtr ar) { + m_exp->inferAndCheck(ar, Type::Variant, true); + ConstructPtr self = shared_from_this(); + VariableTablePtr variables = ar->getScope()->getVariables(); + for (int i = 0; i < m_exp->getCount(); i++) { + ExpressionPtr exp = (*m_exp)[i]; + if (ar->isFirstPass() && + !exp->is(Expression::KindOfSimpleVariable) && + !exp->is(Expression::KindOfArrayElementExpression)) { + ar->getCodeError()->record(self, CodeError::UseNotSupportedUnset, exp); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void UnsetStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("unset("); + m_exp->outputPHP(cg, ar); + cg.printf(");\n"); +} + +void UnsetStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + if (m_exp->getCount() > 1) cg.indentBegin("{\n"); + for (int i = 0; i < m_exp->getCount(); i++) { + (*m_exp)[i]->outputCPPUnset(cg, ar); + } + if (m_exp->getCount() > 1) cg.indentEnd("}\n"); +} diff --git a/src/lib/statement/unset_statement.h b/src/lib/statement/unset_statement.h new file mode 100644 index 0000000000000..e03469ab48aa1 --- /dev/null +++ b/src/lib/statement/unset_statement.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __UNSET_STATEMENT_H__ +#define __UNSET_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(ExpressionList); +DECLARE_BOOST_TYPES(UnsetStatement); + +class UnsetStatement : public Statement { +public: + UnsetStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, ExpressionListPtr exp); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + +private: + ExpressionListPtr m_exp; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __UNSET_STATEMENT_H__ diff --git a/src/lib/statement/while_statement.cpp b/src/lib/statement/while_statement.cpp new file mode 100644 index 0000000000000..7755803b1f670 --- /dev/null +++ b/src/lib/statement/while_statement.cpp @@ -0,0 +1,117 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +/////////////////////////////////////////////////////////////////////////////// +// constructors/destructors + +WhileStatement::WhileStatement +(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr condition, StatementPtr stmt) + : Statement(STATEMENT_CONSTRUCTOR_PARAMETER_VALUES), + m_condition(condition), m_stmt(stmt) { +} + +StatementPtr WhileStatement::clone() { + WhileStatementPtr stmt(new WhileStatement(*this)); + stmt->m_condition = Clone(m_condition); + stmt->m_stmt = Clone(m_stmt); + return stmt; +} + +/////////////////////////////////////////////////////////////////////////////// +// parser functions + +/////////////////////////////////////////////////////////////////////////////// +// static analysis functions + +void WhileStatement::analyzeProgram(AnalysisResultPtr ar) { + m_condition->analyzeProgram(ar); + if (m_stmt) m_stmt->analyzeProgram(ar); +} + +StatementPtr WhileStatement::preOptimize(AnalysisResultPtr ar) { + ar->preOptimize(m_condition); + if (m_stmt) { + ar->getScope()->incLoopNestedLevel(); + ar->preOptimize(m_stmt); + ar->getScope()->decLoopNestedLevel(); + } + return StatementPtr(); +} + +StatementPtr WhileStatement::postOptimize(AnalysisResultPtr ar) { + ar->postOptimize(m_condition); + if (m_stmt) { + ar->getScope()->incLoopNestedLevel(); + ar->postOptimize(m_stmt); + ar->getScope()->decLoopNestedLevel(); + } + return StatementPtr(); +} + +void WhileStatement::inferTypes(AnalysisResultPtr ar) { + m_condition->inferAndCheck(ar, Type::Boolean, false); + if (m_stmt) { + ar->getScope()->incLoopNestedLevel(); + m_stmt->inferTypes(ar); + ar->getScope()->decLoopNestedLevel(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation functions + +void WhileStatement::outputPHP(CodeGenerator &cg, AnalysisResultPtr ar) { + cg.printf("while ("); + m_condition->outputPHP(cg, ar); + cg.printf(") "); + if (m_stmt) { + m_stmt->outputPHP(cg, ar); + } else { + cg.printf("{}\n"); + } +} + +void WhileStatement::outputCPP(CodeGenerator &cg, AnalysisResultPtr ar) { + int labelId = cg.createNewId(ar); + cg.pushBreakScope(labelId); + cg.indentBegin("{\n"); + + cg.printf("while ("); + m_condition->outputCPP(cg, ar); + cg.indentBegin(") {\n"); + cg.printf("LOOP_COUNTER_CHECK(%d);\n", labelId); + if (m_stmt) { + m_stmt->outputCPP(cg, ar); + } + if (cg.findLabelId("continue", labelId)) { + cg.printf("continue%d:;\n", labelId, labelId); + } + cg.indentEnd("}\n"); + if (cg.findLabelId("break", labelId)) { + cg.printf("break%d:;\n", labelId); + } + cg.indentEnd("}\n"); + cg.popBreakScope(); +} diff --git a/src/lib/statement/while_statement.h b/src/lib/statement/while_statement.h new file mode 100644 index 0000000000000..46f3bfff7a1fb --- /dev/null +++ b/src/lib/statement/while_statement.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __WHILE_STATEMENT_H__ +#define __WHILE_STATEMENT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(WhileStatement); + +class WhileStatement : public Statement { +public: + WhileStatement(STATEMENT_CONSTRUCTOR_PARAMETERS, + ExpressionPtr condition, StatementPtr stmt); + + DECLARE_STATEMENT_VIRTUAL_FUNCTIONS; + virtual bool hasDecl() const { return m_stmt && m_stmt->hasDecl(); } + virtual bool hasRetExp() const { return m_stmt && m_stmt->hasRetExp(); } + virtual int getRecursiveCount() const { + return 1 + (m_stmt ? m_stmt->getRecursiveCount() : 0); + } +private: + ExpressionPtr m_condition; + StatementPtr m_stmt; +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __WHILE_STATEMENT_H__ diff --git a/src/lib/system/Makefile b/src/lib/system/Makefile new file mode 100644 index 0000000000000..462a5340485f3 --- /dev/null +++ b/src/lib/system/Makefile @@ -0,0 +1,10 @@ + +PROJECT_ROOT = ../../.. + +HPHP = $(PROJECT_ROOT)/src/hphp/hphp +PHP_FILES = $(wildcard */*.php) + +all: + $(HPHP) -t cpp -f sys --input-dir . -i $(PHP_FILES) -o gen 1>/dev/null + @find . -name "*.h" -or -name "*.cpp" | xargs svn add 2>&1 | grep -v "is already under version control" || echo "lib/system files re-generated" + @php $(PROJECT_ROOT)/src/license.php diff --git a/src/lib/system/apache.inc b/src/lib/system/apache.inc new file mode 100644 index 0000000000000..7140518347270 --- /dev/null +++ b/src/lib/system/apache.inc @@ -0,0 +1,23 @@ +#if EXT_TYPE == 0 +"apache_child_terminate", T(Boolean), S(0), NULL, S(0), +"apache_get_modules", T(Array), S(0), NULL, S(0), +"apache_get_version", T(String), S(0), NULL, S(0), +"apache_getenv", T(String), S(0), "variable", T(String), NULL, S(0), "walk_to_top", T(Boolean), "false", S(0), NULL, S(0), +"apache_lookup_uri", T(Object), S(0), "filename", T(String), NULL, S(0), NULL, S(0), +"apache_note", T(Variant), S(0), "note_name", T(String), NULL, S(0), "note_value", T(String), "null_string", S(0), NULL, S(0), +"apache_request_headers", T(Array), S(0), NULL, S(0), +"apache_reset_timeout", T(Boolean), S(0), NULL, S(0), +"apache_response_headers", T(Array), S(0), NULL, S(0), +"apache_setenv", T(Boolean), S(0), "variable", T(String), NULL, S(0), "value", T(String), NULL, S(0), "walk_to_top", T(Boolean), "false", S(0), NULL, S(0), +"ascii2ebcdic", T(Int32), S(0), "ascii_str", T(String), NULL, S(0), NULL, S(0), +"ebcdic2ascii", T(Int32), S(0), "ebcdic_str", T(String), NULL, S(0), NULL, S(0), +"getallheaders", T(Array), S(0), NULL, S(0), +"virtual", T(Boolean), S(0), "filename", T(String), NULL, S(0), NULL, S(0), +"apache_get_config", T(Variant), S(0), NULL, S(0), +"apache_get_scoreboard", T(Variant), S(0), NULL, S(0), +"apache_get_rewrite_rules", T(Variant), S(0), NULL, S(0), +#elif EXT_TYPE == 1 +#elif EXT_TYPE == 2 +#elif EXT_TYPE == 3 + +#endif diff --git a/src/lib/system/apc.inc b/src/lib/system/apc.inc new file mode 100644 index 0000000000000..04f312d23b03c --- /dev/null +++ b/src/lib/system/apc.inc @@ -0,0 +1,25 @@ +#if EXT_TYPE == 0 +"apc_add", T(Boolean), S(0), "key", T(String), NULL, S(0), "var", T(Variant), NULL, S(0), "ttl", T(Int64), "0", S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_store", T(Boolean), S(0), "key", T(String), NULL, S(0), "var", T(Variant), NULL, S(0), "ttl", T(Int64), "0", S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_fetch", T(Variant), S(0), "key", T(Variant), NULL, S(0), "success", T(Variant), "null", S(1), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_delete", T(Variant), S(0), "key", T(Variant), NULL, S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_compile_file", T(Boolean), S(0), "filename", T(String), NULL, S(0), "atomic", T(Boolean), "true", S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_cache_info", T(Variant), S(0), "cache_id", T(Int64), "0", S(0), "limited", T(Boolean), "false", S(0), NULL, S(0), +"apc_clear_cache", T(Boolean), S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_define_constants", T(Boolean), S(0), "key", T(String), NULL, S(0), "constants", T(String), NULL, S(0), "case_sensitive", T(Boolean), "true", S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_load_constants", T(Boolean), S(0), "key", T(String), NULL, S(0), "case_sensitive", T(Boolean), "true", S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_sma_info", T(Array), S(0), "limited", T(Boolean), "false", S(0), NULL, S(0), +"apc_filehits", T(Array), S(0), NULL, S(0), +"apc_delete_file", T(Variant), S(0), "keys", T(Variant), NULL, S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_inc", T(Variant), S(0), "key", T(String), NULL, S(0), "step", T(Int64), "1", S(0), "success", T(Variant), "null", S(1), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_dec", T(Variant), S(0), "key", T(String), NULL, S(0), "step", T(Int64), "1", S(0), "success", T(Variant), "null", S(1), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_cas", T(Boolean), S(0), "key", T(String), NULL, S(0), "old_cas", T(Int64), NULL, S(0), "new_cas", T(Int64), NULL, S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_bin_dump", T(Variant), S(0), "cache_id", T(Int64), "0", S(0), "filter", T(Variant), "null_variant", S(0), NULL, S(0), +"apc_bin_load", T(Boolean), S(0), "data", T(String), NULL, S(0), "flags", T(Int64), "0", S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +"apc_bin_dumpfile", T(Variant), S(0), "cache_id", T(Int64), NULL, S(0), "filter", T(Variant), NULL, S(0), "filename", T(String), NULL, S(0), "flags", T(Int64), "0", S(0), "context", T(Object), "null", S(0), NULL, S(0), +"apc_bin_loadfile", T(Boolean), S(0), "filename", T(String), NULL, S(0), "context", T(Object), "null", S(0), "flags", T(Int64), "0", S(0), "cache_id", T(Int64), "0", S(0), NULL, S(0), +#elif EXT_TYPE == 1 +#elif EXT_TYPE == 2 +#elif EXT_TYPE == 3 + +#endif diff --git a/src/lib/system/apd.inc b/src/lib/system/apd.inc new file mode 100644 index 0000000000000..d9a05d8e6604b --- /dev/null +++ b/src/lib/system/apd.inc @@ -0,0 +1,15 @@ +#if EXT_TYPE == 0 +"override_function", T(Boolean), S(0), "name", T(String), NULL, S(0), "args", T(String), NULL, S(0), "code", T(String), NULL, S(0), NULL, S(0), +"rename_function", T(Boolean), S(0), "orig_name", T(String), NULL, S(0), "new_name", T(String), NULL, S(0), NULL, S(0), +"apd_set_browser_trace", T(Void), S(0), NULL, S(0), +"apd_set_pprof_trace", T(String), S(0), "dumpdir", T(String), "null_string", S(0), "frament", T(String), "null_string", S(0), NULL, S(0), +"apd_set_session_trace_socket", T(Boolean), S(0), "ip_or_filename", T(String), NULL, S(0), "domain", T(Int32), NULL, S(0), "port", T(Int32), NULL, S(0), "mask", T(Int32), NULL, S(0), NULL, S(0), +"apd_stop_trace", T(Void), S(0), NULL, S(0), +"apd_breakpoint", T(Boolean), S(0), NULL, S(0), +"apd_continue", T(Boolean), S(0), NULL, S(0), +"apd_echo", T(Boolean), S(0), "output", T(String), NULL, S(0), NULL, S(0), +#elif EXT_TYPE == 1 +#elif EXT_TYPE == 2 +#elif EXT_TYPE == 3 + +#endif diff --git a/src/lib/system/array.inc b/src/lib/system/array.inc new file mode 100644 index 0000000000000..d89e4042ecbe1 --- /dev/null +++ b/src/lib/system/array.inc @@ -0,0 +1,104 @@ +#if EXT_TYPE == 0 +"array_change_key_case", T(Variant), S(0), "input", T(Variant), NULL, S(0), "upper", T(Boolean), "false", S(0), NULL, S(0), +"array_chunk", T(Variant), S(0), "input", T(Variant), NULL, S(0), "size", T(Int32), NULL, S(0), "preserve_keys", T(Boolean), "false", S(0), NULL, S(0), +"array_combine", T(Variant), S(0), "keys", T(Variant), NULL, S(0), "values", T(Variant), NULL, S(0), NULL, S(0), +"array_count_values", T(Variant), S(0), "input", T(Variant), NULL, S(0), NULL, S(0), +"array_fill_keys", T(Variant), S(0), "keys", T(Variant), NULL, S(0), "value", T(Variant), NULL, S(0), NULL, S(0), +"array_fill", T(Array), S(0), "start_index", T(Int32), NULL, S(0), "num", T(Int32), NULL, S(0), "value", T(Variant), NULL, S(0), NULL, S(0), +"array_filter", T(Variant), S(0), "input", T(Variant), NULL, S(0), "callback", T(Variant), "null_variant", S(0), NULL, S(0), +"array_flip", T(Variant), S(0), "trans", T(Variant), NULL, S(0), NULL, S(0), +"array_key_exists", T(Boolean), S(0), "key", T(Variant), NULL, S(0), "search", T(Variant), NULL, S(0), NULL, S(0), +"array_keys", T(Variant), S(0), "input", T(Variant), NULL, S(0), "search_value", T(Variant), "null_variant", S(0), "strict", T(Boolean), "false", S(0), NULL, S(0), +"array_map", T(Variant), S(0), "callback", T(Variant), NULL, S(0), "arr1", T(Variant), NULL, S(0), NULL, S(1), +"array_merge_recursive", T(Variant), S(0), "array1", T(Variant), NULL, S(0), NULL, S(1), +"array_merge", T(Variant), S(0), "array1", T(Variant), NULL, S(0), NULL, S(1), +"array_multisort", T(Boolean), S(0), "ar1", T(Variant), NULL, S(1), NULL, S(2), +"array_pad", T(Variant), S(0), "input", T(Variant), NULL, S(0), "pad_size", T(Int32), NULL, S(0), "pad_value", T(Variant), NULL, S(0), NULL, S(0), +"array_pop", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"array_product", T(Variant), S(0), "array", T(Variant), NULL, S(0), NULL, S(0), +"array_push", T(Variant), S(0), "array", T(Variant), NULL, S(1), "var", T(Variant), NULL, S(0), NULL, S(1), +"array_rand", T(Variant), S(0), "input", T(Variant), NULL, S(0), "num_req", T(Int32), "1", S(0), NULL, S(0), +"array_reduce", T(Variant), S(0), "input", T(Variant), NULL, S(0), "callback", T(Variant), NULL, S(0), "initial", T(Variant), "null_variant", S(0), NULL, S(0), +"array_reverse", T(Variant), S(0), "array", T(Variant), NULL, S(0), "preserve_keys", T(Boolean), "false", S(0), NULL, S(0), +"array_search", T(Variant), S(0), "needle", T(Variant), NULL, S(0), "haystack", T(Variant), NULL, S(0), "strict", T(Boolean), "false", S(0), NULL, S(0), +"array_shift", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"array_slice", T(Variant), S(0), "array", T(Variant), NULL, S(0), "offset", T(Int32), NULL, S(0), "length", T(Variant), "null_variant", S(0), "preserve_keys", T(Boolean), "false", S(0), NULL, S(0), +"array_splice", T(Variant), S(0), "input", T(Variant), NULL, S(1), "offset", T(Int32), NULL, S(0), "length", T(Variant), "null_variant", S(0), "replacement", T(Variant), "null_variant", S(0), NULL, S(0), +"array_sum", T(Variant), S(0), "array", T(Variant), NULL, S(0), NULL, S(0), +"array_unique", T(Variant), S(0), "array", T(Variant), NULL, S(0), NULL, S(0), +"array_unshift", T(Int32), S(0), "array", T(Variant), NULL, S(1), "var", T(Variant), NULL, S(0), NULL, S(1), +"array_values", T(Variant), S(0), "input", T(Variant), NULL, S(0), NULL, S(0), +"array_walk_recursive", T(Boolean), S(0), "input", T(Variant), NULL, S(1), "funcname", T(Variant), NULL, S(0), "userdata", T(Variant), "null_variant", S(0), NULL, S(0), +"array_walk", T(Boolean), S(0), "input", T(Variant), NULL, S(1), "funcname", T(Variant), NULL, S(0), "userdata", T(Variant), "null_variant", S(0), NULL, S(0), +"compact", T(Array), S(0), "varname", T(Variant), NULL, S(0), NULL, S(1), +"shuffle", T(Boolean), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"count", T(Int32), S(0), "var", T(Variant), NULL, S(0), "recursive", T(Boolean), "false", S(0), NULL, S(0), +"sizeof", T(Int32), S(0), "var", T(Variant), NULL, S(0), "recursive", T(Boolean), "false", S(0), NULL, S(0), +"each", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"current", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"next", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"pos", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"prev", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"reset", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"end", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"in_array", T(Boolean), S(0), "needle", T(Variant), NULL, S(0), "haystack", T(Variant), NULL, S(0), "strict", T(Boolean), "false", S(0), NULL, S(0), +"key", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"range", T(Array), S(0), "low", T(Variant), NULL, S(0), "high", T(Variant), NULL, S(0), "step", T(Variant), "1", S(0), NULL, S(0), +"array_diff", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), NULL, S(1), +"array_udiff", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), "data_compare_func", T(Variant), NULL, S(0), NULL, S(1), +"array_diff_assoc", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), NULL, S(1), +"array_diff_uassoc", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), "key_compare_func", T(Variant), NULL, S(0), NULL, S(1), +"array_udiff_assoc", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), "data_compare_func", T(Variant), NULL, S(0), NULL, S(1), +"array_udiff_uassoc", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), "data_compare_func", T(Variant), NULL, S(0), "key_compare_func", T(Variant), NULL, S(0), NULL, S(1), +"array_diff_key", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), NULL, S(1), +"array_diff_ukey", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), "key_compare_func", T(Variant), NULL, S(0), NULL, S(1), +"array_intersect", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), NULL, S(1), +"array_uintersect", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), "data_compare_func", T(Variant), NULL, S(0), NULL, S(1), +"array_intersect_assoc", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), NULL, S(1), +"array_intersect_uassoc", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), "key_compare_func", T(Variant), NULL, S(0), NULL, S(1), +"array_uintersect_assoc", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), "data_compare_func", T(Variant), NULL, S(0), NULL, S(1), +"array_uintersect_uassoc", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), "data_compare_func", T(Variant), NULL, S(0), "key_compare_func", T(Variant), NULL, S(0), NULL, S(1), +"array_intersect_key", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), NULL, S(1), +"array_intersect_ukey", T(Variant), S(0), "array1", T(Variant), NULL, S(0), "array2", T(Variant), NULL, S(0), "key_compare_func", T(Variant), NULL, S(0), NULL, S(1), +"sort", T(Boolean), S(0), "array", T(Variant), NULL, S(1), "sort_flags", T(Int32), "0", S(0), "use_collator", T(Boolean), "false", S(0), NULL, S(0), +"rsort", T(Boolean), S(0), "array", T(Variant), NULL, S(1), "sort_flags", T(Int32), "0", S(0), "use_collator", T(Boolean), "false", S(0), NULL, S(0), +"asort", T(Boolean), S(0), "array", T(Variant), NULL, S(1), "sort_flags", T(Int32), "0", S(0), "use_collator", T(Boolean), "false", S(0), NULL, S(0), +"arsort", T(Boolean), S(0), "array", T(Variant), NULL, S(1), "sort_flags", T(Int32), "0", S(0), "use_collator", T(Boolean), "false", S(0), NULL, S(0), +"ksort", T(Boolean), S(0), "array", T(Variant), NULL, S(1), "sort_flags", T(Int32), "0", S(0), NULL, S(0), +"krsort", T(Boolean), S(0), "array", T(Variant), NULL, S(1), "sort_flags", T(Int32), "0", S(0), NULL, S(0), +"usort", T(Boolean), S(0), "array", T(Variant), NULL, S(1), "cmp_function", T(Variant), NULL, S(0), NULL, S(0), +"uasort", T(Boolean), S(0), "array", T(Variant), NULL, S(1), "cmp_function", T(Variant), NULL, S(0), NULL, S(0), +"uksort", T(Boolean), S(0), "array", T(Variant), NULL, S(1), "cmp_function", T(Variant), NULL, S(0), NULL, S(0), +"natsort", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"natcasesort", T(Variant), S(0), "array", T(Variant), NULL, S(1), NULL, S(0), +"i18n_loc_get_default", T(String), S(0), NULL, S(0), +"i18n_loc_set_default", T(Boolean), S(0), "locale", T(String), NULL, S(0), NULL, S(0), +"i18n_loc_set_attribute", T(Boolean), S(0), "attr", T(Int64), NULL, S(0), "val", T(Int64), NULL, S(0), NULL, S(0), +"i18n_loc_set_strength", T(Boolean), S(0), "strength", T(Int64), NULL, S(0), NULL, S(0), +"i18n_loc_get_error_code", T(Variant), S(0), NULL, S(0), +#elif EXT_TYPE == 1 +"UCOL_DEFAULT", T(Int64), +"UCOL_PRIMARY", T(Int64), +"UCOL_SECONDARY", T(Int64), +"UCOL_TERTIARY", T(Int64), +"UCOL_DEFAULT_STRENGTH", T(Int64), +"UCOL_QUATERNARY", T(Int64), +"UCOL_IDENTICAL", T(Int64), +"UCOL_OFF", T(Int64), +"UCOL_ON", T(Int64), +"UCOL_SHIFTED", T(Int64), +"UCOL_NON_IGNORABLE", T(Int64), +"UCOL_LOWER_FIRST", T(Int64), +"UCOL_UPPER_FIRST", T(Int64), +"UCOL_FRENCH_COLLATION", T(Int64), +"UCOL_ALTERNATE_HANDLING", T(Int64), +"UCOL_CASE_FIRST", T(Int64), +"UCOL_CASE_LEVEL", T(Int64), +"UCOL_NORMALIZATION_MODE", T(Int64), +"UCOL_STRENGTH", T(Int64), +"UCOL_HIRAGANA_QUATERNARY_MODE", T(Int64), +"UCOL_NUMERIC_COLLATION", T(Int64), +#elif EXT_TYPE == 2 +#elif EXT_TYPE == 3 + +#endif diff --git a/src/lib/system/bcmath.inc b/src/lib/system/bcmath.inc new file mode 100644 index 0000000000000..cc26ec27e74a6 --- /dev/null +++ b/src/lib/system/bcmath.inc @@ -0,0 +1,16 @@ +#if EXT_TYPE == 0 +"bcscale", T(Boolean), S(0), "scale", T(Int64), NULL, S(0), NULL, S(0), +"bcadd", T(String), S(0), "left", T(String), NULL, S(0), "right", T(String), NULL, S(0), "scale", T(Int64), "-1", S(0), NULL, S(0), +"bcsub", T(String), S(0), "left", T(String), NULL, S(0), "right", T(String), NULL, S(0), "scale", T(Int64), "-1", S(0), NULL, S(0), +"bccomp", T(Int64), S(0), "left", T(String), NULL, S(0), "right", T(String), NULL, S(0), "scale", T(Int64), "-1", S(0), NULL, S(0), +"bcmul", T(String), S(0), "left", T(String), NULL, S(0), "right", T(String), NULL, S(0), "scale", T(Int64), "-1", S(0), NULL, S(0), +"bcdiv", T(String), S(0), "left", T(String), NULL, S(0), "right", T(String), NULL, S(0), "scale", T(Int64), "-1", S(0), NULL, S(0), +"bcmod", T(String), S(0), "left", T(String), NULL, S(0), "right", T(String), NULL, S(0), NULL, S(0), +"bcpow", T(String), S(0), "left", T(String), NULL, S(0), "right", T(String), NULL, S(0), "scale", T(Int64), "-1", S(0), NULL, S(0), +"bcpowmod", T(Variant), S(0), "left", T(String), NULL, S(0), "right", T(String), NULL, S(0), "modulus", T(String), NULL, S(0), "scale", T(Int64), "-1", S(0), NULL, S(0), +"bcsqrt", T(Variant), S(0), "operand", T(String), NULL, S(0), "scale", T(Int64), "-1", S(0), NULL, S(0), +#elif EXT_TYPE == 1 +#elif EXT_TYPE == 2 +#elif EXT_TYPE == 3 + +#endif diff --git a/src/lib/system/builtin_symbols.cpp b/src/lib/system/builtin_symbols.cpp new file mode 100644 index 0000000000000..9cfd52034f504 --- /dev/null +++ b/src/lib/system/builtin_symbols.cpp @@ -0,0 +1,430 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace HPHP; +using namespace std; +using namespace boost; + +#define BF_COLUMN_COUNT 3 +#define BF_COLUMN_NAME 0 +#define BF_COLUMN_RETURN 1 +#define BF_COLUMN_PARAMS 2 + +/////////////////////////////////////////////////////////////////////////////// + +bool BuiltinSymbols::Loaded = false; +bool BuiltinSymbols::NoSuperGlobals = false; +StringBag BuiltinSymbols::s_strings; + +const char *BuiltinSymbols::ExtensionFunctions[] = { +#define S(n) (const char *)n +#define T(t) (const char *)Type::KindOf ## t +#define EXT_TYPE 0 +#include "ext.inc" + NULL, +}; +#undef EXT_TYPE + +const char *BuiltinSymbols::ExtensionConsts[] = { +#define EXT_TYPE 1 +#include "ext.inc" + NULL, +}; +#undef EXT_TYPE + +const char *BuiltinSymbols::ExtensionClasses[] = { +#define EXT_TYPE 2 +#include "ext.inc" + NULL, +}; +#undef EXT_TYPE + +const char *BuiltinSymbols::ExtensionDeclaredDynamic[] = { +#define EXT_TYPE 3 +#include "ext.inc" + NULL, +}; +#undef EXT_TYPE + +const char *BuiltinSymbols::HelperFunctions[] = { +#include "helper.inc" + NULL, +}; + +StringToFunctionScopePtrMap BuiltinSymbols::s_functions; +StringToFunctionScopePtrMap BuiltinSymbols::s_helperFunctions; + +const char *BuiltinSymbols::SystemClasses[] = { + "stdclass", + "exception", + "arrayaccess", + "iterator", + "pear_error", + "reflection", + NULL +}; + +StringToClassScopePtrMap BuiltinSymbols::s_classes; +VariableTablePtr BuiltinSymbols::s_variables; +ConstantTablePtr BuiltinSymbols::s_constants; +StringToTypePtrMap BuiltinSymbols::s_superGlobals; +std::set BuiltinSymbols::s_declaredDynamic; + +/////////////////////////////////////////////////////////////////////////////// + +void BuiltinSymbols::parseExtConsts(AnalysisResultPtr ar) { + const char **p = ExtensionConsts; + while (*p) { + // Parse name + const char *name = *p++; + // Parse type + Type::KindOf type = (Type::KindOf)(long)(*p++); + s_constants->add(name, Type::GetType(type), + ExpressionPtr(), ar, ConstructPtr()); + } +} + +void BuiltinSymbols::parseExtClasses(AnalysisResultPtr ar) { + const char **p = ExtensionClasses; + while (*p) { + // Parse name + const char *cname = *p++; + // Parse parent + const char *cparent = *p++; + // Parse list of interfaces + vector ifaces; + while (*p) { + ifaces.push_back(string(*p++)); + } + p++; + // Parse methods + vector methods; + while (*p) { + FunctionScopePtr fs = parseExtFunction(ar, p); + bool abstract = (bool)*p++; + if (abstract) { + fs->addModifier(T_ABSTRACT); + } + int visibility = (long)*p++; + int vismod = 0; + if (visibility == 1) { + vismod = T_PROTECTED; + } else if (visibility == 2) { + vismod = T_PRIVATE; + } + fs->addModifier(vismod); + bool stat = (bool)*p++; + if (stat) { + fs->addModifier(T_STATIC); + } + methods.push_back(fs); + } + if (cparent && *cparent && (ifaces.empty() || ifaces[0] != cparent)) { + ifaces.insert(ifaces.begin(), cparent); + } + ClassScopePtr cl(new ClassScope(ar, string(cname), string(cparent), + ifaces, methods)); + p++; + // Parse consts + while (*p) { + const char *name = *p++; + // Parse type + Type::KindOf type = (Type::KindOf)(long)(*p++); + cl->getConstants()->add(name, Type::GetType(type), + ExpressionPtr(), ar, ConstructPtr()); + } + p++; + cl->setSystem(); + s_classes[cname] = cl; + } +} + +FunctionScopePtr BuiltinSymbols::parseExtFunction(AnalysisResultPtr ar, + const char** &p) { + const char *name = *p++; + Type::KindOf retType = (Type::KindOf)(long)(*p++); + bool reference = *p++; + + int minParam = -1; + int maxParam = 0; + const char **arg = p; + while (*arg) { + /* const char *argName = */ arg++; + /* Type::KindOf argType = (Type::KindOf) */ arg++; + const char *argDefault = *arg++; + /* bool argReference = */ arg++; + if (argDefault && minParam < 0) { + minParam = maxParam; + } + maxParam++; + } + if (minParam < 0) minParam = maxParam; + + string lowered = Util::toLower(name); + FunctionScopePtr f(new FunctionScope(false, lowered, reference)); + f->setParamCounts(minParam, maxParam); + if (retType != Type::KindOfVoid) { + f->setReturnType(ar, Type::GetType(retType)); + } + + int index = 0; + const char *paramName = NULL; + while ((paramName = *p++ /* argName */)) { + Type::KindOf argType = (Type::KindOf)(long)*p++; + /* const char *argDefault = */ p++; + bool argReference = *p++; + + f->setParamName(index, paramName); + if (argReference) f->setRefParam(index); + f->setParamType(ar, index, Type::GetType(argType)); + + index++; + } + + // Read function flags (these flags are defined in "idl/base.php") + int flags = (int)(int64)(*p++); + // Flags for variable arguments + if (flags & 0x2) { + f->setVariableArgument(true); + } else if (flags & 0x1) { + f->setVariableArgument(false); + } + // Flag for no side effects + if (flags & 0x4) { + f->setNoEffect(); + } + + return f; +} + +FunctionScopePtr BuiltinSymbols::parseHelperFunction(AnalysisResultPtr ar, + const char** &p) { + FunctionScopePtr f = parseExtFunction(ar, p); + f->setHelperFunction(); + return f; +} + +void BuiltinSymbols::load(AnalysisResultPtr ar, bool extOnly /* = false */) { + if (Loaded) return; + Loaded = true; + // Build function scopes for some of the runtime helper functions + // declared in "cpp/base/builtin_functions.h" + const char **helper = HelperFunctions; + while (*helper) { + FunctionScopePtr f = parseHelperFunction(ar, helper); + ASSERT(!s_helperFunctions[f->getName()]); + s_helperFunctions[f->getName()] = f; + } + // load extension functions + const char **p = ExtensionFunctions; + while (*p) { + FunctionScopePtr f = parseExtFunction(ar, p); + ASSERT(!s_functions[f->getName()]); + s_functions[f->getName()] = f; + } + if (!extOnly) { + // parse all PHP files under system/classes + ar = AnalysisResultPtr(new AnalysisResult()); + for (const char **cls = SystemClasses; *cls; cls++) { + string phpFileName = Option::GetSystemRoot(); + phpFileName += "/lib/system/classes/"; + phpFileName += *cls; + phpFileName += ".php"; + const char *fileName = s_strings.add(phpFileName.c_str()); + try { + Scanner scanner(new ylmm::basic_buffer(fileName), true, false); + ParserPtr parser(new Parser(scanner, fileName, 0, ar)); + if (parser->parse()) { + Logger::Error("Unable to parse file %s: %s", phpFileName.c_str(), + parser->getMessage().c_str()); + ASSERT(false); + } + } catch (std::runtime_error) { + Logger::Error("Unable to open file %s", fileName); + } + } + ar->analyzeProgram(); + ar->inferTypes(); + const StringToFileScopePtrMap &files = ar->getAllFiles(); + for (StringToFileScopePtrMap::const_iterator iterFile = files.begin(); + iterFile != files.end(); iterFile++) { + const StringToClassScopePtrVecMap &classes = + iterFile->second->getClasses(); + for (StringToClassScopePtrVecMap::const_iterator iter = classes.begin(); + iter != classes.end(); ++iter) { + ASSERT(iter->second.size() == 1); + iter->second[0]->setSystem(); + ASSERT(!s_classes[iter->first]); + s_classes[iter->first] = iter->second[0]; + } + } + + // parse globals/variables.php and globals/constants.php + NoSuperGlobals = true; + s_variables = loadGlobalSymbols("symbols.php")->getVariables(); + s_constants = loadGlobalSymbols("constants.php")-> + getAllFilesVector()[0]->getConstants(); + NoSuperGlobals = false; + } else { + AnalysisResult ar2; + s_variables = VariableTablePtr(new VariableTable(ar2)); + s_constants = ConstantTablePtr(new ConstantTable(ar2)); + NoSuperGlobals = true; + } + + // load extension constants + parseExtConsts(ar); + + // load extension classes + parseExtClasses(ar); + + p = ExtensionDeclaredDynamic; + while (*p) { + s_declaredDynamic.insert(Util::toLower(string(*p))); + p++; + } +} + +AnalysisResultPtr BuiltinSymbols::loadGlobalSymbols(const char *fileName) { + AnalysisResultPtr ar(new AnalysisResult()); + string phpFileName = Option::GetSystemRoot(); + phpFileName += "/lib/system/globals/"; + phpFileName += fileName; + fileName = s_strings.add(phpFileName.c_str()); + try { + Scanner scanner(new ylmm::basic_buffer(fileName), true, false); + ParserPtr parser(new Parser(scanner, fileName, 0, ar)); + if (parser->parse()) { + ASSERT(false); + Logger::Error("Unable to parse file %s: %s", phpFileName.c_str(), + parser->getMessage().c_str()); + } + } catch (std::runtime_error) { + Logger::Error("Unable to open file %s", fileName); + } + ar->analyzeProgram(); + ar->inferTypes(); + return ar; +} + +void BuiltinSymbols::loadFunctions(AnalysisResultPtr ar, + StringToFunctionScopePtrVecMap &functions) { + ASSERT(Loaded); + for (StringToFunctionScopePtrMap::const_iterator it = s_functions.begin(); + it != s_functions.end(); ++it) { + functions[it->first].push_back(it->second); + } + + // we are adding these builtin functions, so that user-defined functions + // will not overwrite them with their own file and line number information + for (StringToFunctionScopePtrMap::const_iterator iter = + s_functions.begin(); iter != s_functions.end(); ++iter) { + ar->getDependencyGraph()->addParent(DependencyGraph::KindOfFunctionCall, + "", iter->first, StatementPtr()); + } +} + +void BuiltinSymbols::loadHelperFunctions(AnalysisResultPtr ar, + StringToFunctionScopePtrVecMap &functions) { + ASSERT(Loaded); + for (StringToFunctionScopePtrMap::const_iterator it = + s_helperFunctions.begin(); it != s_helperFunctions.end(); ++it) { + functions[it->first].push_back(it->second); + } +} + +void BuiltinSymbols::loadClasses(AnalysisResultPtr ar, + StringToClassScopePtrMap &classes) { + ASSERT(Loaded); + classes.insert(s_classes.begin(), s_classes.end()); + + // we are adding these builtin functions, so that user-defined functions + // will not overwrite them with their own file and line number information + for (StringToClassScopePtrMap::const_iterator iter = + s_classes.begin(); iter != s_classes.end(); ++iter) { + ar->getDependencyGraph()->addParent(DependencyGraph::KindOfClassDerivation, + "", iter->first, StatementPtr()); + } +} + +void BuiltinSymbols::loadVariables(AnalysisResultPtr ar, + VariableTablePtr variables) { + ASSERT(Loaded); + if (s_variables) { + variables->import(s_variables); + } +} + +void BuiltinSymbols::loadConstants(AnalysisResultPtr ar, + ConstantTablePtr constants) { + ASSERT(Loaded); + if (s_constants) { + constants->import(s_constants); + } +} + +void BuiltinSymbols::loadSuperGlobals() { + if (s_superGlobals.empty()) { + s_superGlobals["argc"] = Type::Variant; + s_superGlobals["argv"] = Type::Variant; + + s_superGlobals["_SERVER"] = Type::Variant; + s_superGlobals["_GET"] = Type::Variant; + s_superGlobals["_POST"] = Type::Variant; + s_superGlobals["_COOKIE"] = Type::Variant; + s_superGlobals["_FILES"] = Type::Variant; + s_superGlobals["_ENV"] = Type::Variant; + s_superGlobals["_REQUEST"] = Type::Variant; + s_superGlobals["_SESSION"] = Type::Variant; + s_superGlobals["http_response_header"] = Type::Variant; + } +} + +bool BuiltinSymbols::isSuperGlobal(const std::string &name) { + if (NoSuperGlobals) return false; + loadSuperGlobals(); + return s_superGlobals.find(name) != s_superGlobals.end(); +} + +TypePtr BuiltinSymbols::getSuperGlobalType(const std::string &name) { + loadSuperGlobals(); + StringToTypePtrMap::const_iterator iter = s_superGlobals.find(name); + if (iter != s_superGlobals.end()) { + return iter->second; + } + return TypePtr(); +} + +bool BuiltinSymbols::isDeclaredDynamic(const std::string& name) { + return s_declaredDynamic.find(name) != s_declaredDynamic.end(); +} diff --git a/src/lib/system/builtin_symbols.h b/src/lib/system/builtin_symbols.h new file mode 100644 index 0000000000000..cb0ea3c2bc4a6 --- /dev/null +++ b/src/lib/system/builtin_symbols.h @@ -0,0 +1,89 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __BUILTIN_SYMBOLS_H__ +#define __BUILTIN_SYMBOLS_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DECLARE_BOOST_TYPES(Type); +DECLARE_BOOST_TYPES(AnalysisResult); +DECLARE_BOOST_TYPES(FunctionScope); +DECLARE_BOOST_TYPES(ClassScope); +DECLARE_BOOST_TYPES(VariableTable); +DECLARE_BOOST_TYPES(ConstantTable); + +class BuiltinSymbols { +public: + static bool Loaded; + static bool NoSuperGlobals; // for SystemCPP bootstraping only + + static void load(AnalysisResultPtr ar, bool extOnly = false); + + static void loadFunctions(AnalysisResultPtr ar, + StringToFunctionScopePtrVecMap &functions); + static void loadHelperFunctions(AnalysisResultPtr ar, + StringToFunctionScopePtrVecMap &functions); + static void loadClasses(AnalysisResultPtr ar, + StringToClassScopePtrMap &classes); + static void loadVariables(AnalysisResultPtr ar, + VariableTablePtr variables); + static void loadConstants(AnalysisResultPtr ar, + ConstantTablePtr constants); + + /** + * Testing whether a variable is a PHP superglobal. + */ + static bool isSuperGlobal(const std::string &name); + static TypePtr getSuperGlobalType(const std::string &name); + + static bool isDeclaredDynamic(const std::string& name); + + static StringToFunctionScopePtrMap s_functions; + static StringToFunctionScopePtrMap s_helperFunctions; + static StringToClassScopePtrMap s_classes; + static VariableTablePtr s_variables; + static ConstantTablePtr s_constants; +private: + static StringBag s_strings; + static const char *ExtensionFunctions[]; + static const char *ExtensionClasses[]; + static const char *ExtensionConsts[]; + static const char *ExtensionDeclaredDynamic[]; + static const char *SystemClasses[]; + static const char *HelperFunctions[]; + static AnalysisResultPtr loadGlobalSymbols(const char *fileName); + + static StringToTypePtrMap s_superGlobals; + static void loadSuperGlobals(); + + static std::set s_declaredDynamic; + + static void parseExtConsts(AnalysisResultPtr ar); + static void parseExtClasses(AnalysisResultPtr ar); + static FunctionScopePtr parseExtFunction(AnalysisResultPtr ar, + const char** &p); + static FunctionScopePtr parseHelperFunction(AnalysisResultPtr ar, + const char** &p); +}; + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __BUILTIN_SYMBOLS_H__ diff --git a/src/lib/system/class.inc b/src/lib/system/class.inc new file mode 100644 index 0000000000000..0cd2a8a0b23c7 --- /dev/null +++ b/src/lib/system/class.inc @@ -0,0 +1,21 @@ +#if EXT_TYPE == 0 +"get_declared_classes", T(Array), S(0), NULL, S(0), +"get_declared_interfaces", T(Array), S(0), NULL, S(0), +"class_exists", T(Boolean), S(0), "class_name", T(String), NULL, S(0), "autoload", T(Boolean), "false", S(0), NULL, S(0), +"interface_exists", T(Boolean), S(0), "interface_name", T(String), NULL, S(0), "autoload", T(Boolean), "false", S(0), NULL, S(0), +"get_class_methods", T(Array), S(0), "class_or_object", T(Variant), NULL, S(0), NULL, S(0), +"get_class_vars", T(Array), S(0), "class_name", T(String), NULL, S(0), NULL, S(0), +"get_class", T(Variant), S(0), "object", T(Variant), "null_variant", S(0), NULL, S(0), +"get_parent_class", T(Variant), S(0), "object", T(Variant), "null_variant", S(0), NULL, S(0), +"is_a", T(Boolean), S(0), "object", T(Object), NULL, S(0), "class_name", T(String), NULL, S(0), NULL, S(0), +"is_subclass_of", T(Boolean), S(0), "class_or_object", T(Variant), NULL, S(0), "class_name", T(String), NULL, S(0), NULL, S(0), +"method_exists", T(Boolean), S(0), "class_or_object", T(Variant), NULL, S(0), "method_name", T(String), NULL, S(0), NULL, S(0), +"property_exists", T(Boolean), S(0), "class_or_object", T(Variant), NULL, S(0), "property", T(String), NULL, S(0), NULL, S(0), +"get_object_vars", T(Array), S(0), "object", T(Object), NULL, S(0), NULL, S(0), +"call_user_method_array", T(Variant), S(0), "method_name", T(String), NULL, S(0), "obj", T(Variant), NULL, S(1), "paramarr", T(Array), NULL, S(0), NULL, S(0), +"call_user_method", T(Variant), S(0), "method_name", T(String), NULL, S(0), "obj", T(Variant), NULL, S(1), NULL, S(1), +#elif EXT_TYPE == 1 +#elif EXT_TYPE == 2 +#elif EXT_TYPE == 3 + +#endif diff --git a/src/lib/system/classes/arrayaccess.php b/src/lib/system/classes/arrayaccess.php new file mode 100644 index 0000000000000..37738aab61851 --- /dev/null +++ b/src/lib/system/classes/arrayaccess.php @@ -0,0 +1,8 @@ +message = $message; + $this->code = $code; + $this->trace = debug_backtrace(); + $frame = array_shift($this->trace); + $this->file = $frame['file']; + $this->line = $frame['line']; + } + + // message of exception + final function getMessage() { + return $this->message; + } + + // code of exception + final function getCode() { + return $this->code; + } + + // source filename + final function getFile() { + return $this->file; + } + + // source line + final function getLine() { + return $this->line; + } + + // an array of the backtrace() + final function getTrace() { + return $this->trace; + } + + // formated string of trace + final function getTraceAsString() { + // works with the new FrameInjection-based stacktrace. + $i = 0; + $s = ""; + foreach ($this->getTrace() as $frame) { + if (!is_array($frame)) continue; + $s .= "#$i " . $frame['file'] . "(" . + $frame['line']. "): " . + (isset($frame['class']) ? $frame['class'] . $frame['type'] : "") . + $frame['function'] . "()\n"; + $i++; + } + $s .= "#$i {main}"; + return $s; + } + + /* Overrideable */ + // formated string for display + function __toString() { + return $this->getMessage(); + } +} + +class LogicException extends Exception {} + class BadFunctionCallException extends LogicException {} + class BadMethodCallException extends BadFunctionCallException {} + class DomainException extends LogicException {} + class InvalidArgumentException extends LogicException {} + class LengthException extends LogicException {} + class OutOfRangeException extends LogicException {} +class RuntimeException extends Exception {} + class OutOfBoundsException extends RuntimeException {} + class OverflowException extends RuntimeException {} + class RangeException extends RuntimeException {} + class UnderflowException extends RuntimeException {} + class UnexpectedValueException extends RuntimeException {} diff --git a/src/lib/system/classes/iterator.php b/src/lib/system/classes/iterator.php new file mode 100644 index 0000000000000..826caed9d8537 --- /dev/null +++ b/src/lib/system/classes/iterator.php @@ -0,0 +1,137 @@ +arr = $array; + $this->flags = $flags; + } + + public function append($value) { + $this->arr[] = $value; + } + + public function asort() { + return asort($this->arr, $this->flags); + } + + public function count() { + return count($this->arr); + } + + public function current() { + return current($this->arr); + } + + public function getArrayCopy() { + return $this->arr; + } + + public function getFlags() { + return $this->flags; + } + + public function key() { + return key($this->arr); + } + + public function ksort() { + return ksort($this->arr, $this->flags); + } + + public function natcasesort() { + return natcasesort($this->arr); + } + + public function natsort() { + return natsort($this->arr); + } + + public function next() { + return next($this->arr); + } + + public function offsetExists($index) { + return isset($this->arr[$index]); + } + + public function offsetGet($index) { + return $this->arr[$index]; + } + + public function offsetSet($index, $newval) { + $this->arr[$index] = $newval; + } + + public function offsetUnset($index) { + unset($this->arr[$index]); + } + + public function rewind() { + return reset($this->arr); + } + + public function seek($position) { + reset($this->arr); + for ($i = 0; $i < $position; $i++) { + if (!next($this->arr)) { + break; + } + } + } + + public function setFlags($flags) { + $this->flags = $flags; + } + + public function uasort($cmp_function) { + return uasort($this->arr, $cmp_function); + } + + public function uksort($cmp_function) { + return uksort($cmp_function); + } + + public function valid() { + return current($this->arr) !== false; + } +} + +interface FilterIterator extends Iterator, + OuterIterator { +} + +interface IteratorAggregate extends Traversable { + public function getIterator(); +} diff --git a/src/lib/system/classes/pear_error.php b/src/lib/system/classes/pear_error.php new file mode 100644 index 0000000000000..7798925bb7465 --- /dev/null +++ b/src/lib/system/classes/pear_error.php @@ -0,0 +1,19 @@ +getParameters(); + $this->info = $params[$param]->info; + } + } + + public function __toString() { + // TODO + } + + public static function export($func, $param, $ret) { + $obj = new ReflectionParameter($func, $param); + $str = (string)$obj; + if ($ret) { + return $str; + } + print $str; + } + + public function getName() { + return $this->info['name']; + } + + public function isPassedByReference() { + return $this->info['ref']; + } + + public function getDeclaringClass() { + if (empty($this->info['class'])) { + return null; + } + return new ReflectionClass($this->info['class']); + } + + public function getClass() { + if (empty($this->info['type'])) { + return null; + } + return new ReflectionClass($this->info['type']); + } + + public function isArray() { + return $this->info['type'] == 'array'; + } + + public function allowsNull() { + return $this->info['nullable']; + } + + public function isOptional() { + return isset($this->info['default']); + } + + public function isDefaultValueAvailable() { + return isset($this->info['default']); + } + + public function getDefaultValue() { + if (!$this->isOptional()) { + throw new ReflectionException('Parameter is not optional'); + } + return $this->info['default']; + } + + public function getPosition() { + return $this->info['index']; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +class ReflectionFunctionAbstract { + protected $info; + + public function getName() { + return $this->info['name']; + } + + public function isInternal() { + return $this->info['internal']; + } + + public function getClosure() { + return $this->info['closure']; + } + + public function isUserDefined() { + return !$this->info['internal']; + } + + public function getFileName() { + return $this->info['file']; + } + + public function getStartLine() { + return $this->info['line1']; + } + + public function getEndLine() { + return $this->info['line2']; + } + + public function getDocComment() { + return $this->info['doc']; + } + + public function getStaticVariables() { + return $this->info['static_variables']; + } + + public function returnsReference() { + return $this->info['ref']; + } + + public function getParameters() { + $ret = array(); + foreach ($this->info['params'] as $name => $info) { + $param = new ReflectionParameter(null, null); + $param->info = $info; + $ret[] = $param; + } + return $ret; + } + + public function getNumberOfParameters() { + return count($this->info['params']); + } + + public function getNumberOfRequiredParameters() { + $count = 0; + $params = $this->getParameters(); + foreach ($params as $name => $param) { + if ($param->isOptional()) { + break; + } + $count++; + } + return $count; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// function + +class ReflectionFunction extends ReflectionFunctionAbstract +implements Reflector { + public function __construct($name) { + $this->info = hphp_get_function_info($name); + if (empty($this->info)) { + throw new ReflectionException("Function $name does not exist"); + } + } + + public function __toString() { + //TODO + } + + public static function export($name, $ret) { + $obj = new ReflectionFunction($name); + $str = (string)$obj; + if ($ret) { + return $str; + } + print $str; + } + + public function invoke() { + $args = func_get_args(); + return hphp_invoke($this->info['name'], $args); + } + + public function invokeArgs($args) { + return hphp_invoke($this->info['name'], $args); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// class + +class ReflectionClass implements Reflector { + public $name; + protected $info; + + public function __construct($name) { + $this->info = hphp_get_class_info($name); + if (empty($this->info)) { + if (is_object($name)) $name = get_class($name); + throw new ReflectionException("Class $name does not exist"); + } + $this->name = $this->info['name']; + + // flattening the trees, so it's easier for lookups + if (!empty($this->info['parent'])) { + $p = new ReflectionClass($this->info['parent']); + $this->info['interfaces'] += $p->info['interfaces']; + $this->info['properties'] += $p->info['properties']; + $this->info['methods'] += $p->info['methods']; + $this->info['constants'] += $p->info['constants']; + } + foreach ($this->info['interfaces'] as $interface => $_) { + $p = new ReflectionClass($interface); + $this->info['methods'] += $p->info['methods']; + } + } + + public function __toString() { + } + + public static function export($name, $ret) { + $obj = new ReflectionClass($name); + $str = (string)$obj; + if ($ret) { + return $str; + } + print $str; + } + + public function getName() { + return $this->info['name']; + } + + public function isInternal() { + return $this->info['internal']; + } + + public function isUserDefined() { + return !$this->info['internal']; + } + + public function isInstantiable() { + return !$this->info['abstract']; + } + + public function hasConstant($name) { + return isset($this->info['constants'][$name]); + } + + public function hasMethod($name) { + return isset($this->info['methods'][$name]); + } + + public function hasProperty($name) { + return isset($this->info['properties'][$name]); + } + + public function getFileName() { + return $this->info['file']; + } + + public function getStartLine() { + return $this->info['line1']; + } + + public function getEndLine() { + return $this->info['line2']; + } + + public function getDocComment() { + return $this->info['doc']; + } + + public function getConstructor() { + if ($this->hasMethod('__construct')) { + return $this->getMethod('__construct'); + } + if ($this->hasMethod($this->info['name'])) { + return $this->getMethod($this->info['name']); + } + return null; + } + + public function getMethod($name) { + $lname = strtolower($name); + if (!isset($this->info['methods'][$lname])) { + $class = $this->info['name']; + throw new ReflectionException("Method $class::$name does not exist"); + } + + $ret = new ReflectionMethod(null, null); + $ret->info = $this->info['methods'][$lname]; + $ret->name = $lname; + $ret->class = $this->info['name']; + return $ret; + } + + public function getMethods() { + $ret = array(); + foreach ($this->info['methods'] as $name => $_) { + $ret[] = $this->getMethod($name); + } + return $ret; + } + + public function getProperty($name) { + if (!isset($this->info['properties'][$name])) { + $class = $this->info['name']; + throw new ReflectionException("Property $class::$name does not exist"); + } + + $ret = new ReflectionProperty(null, null); + $ret->info = $this->info['properties'][$name]; + $ret->name = $name; + $ret->class = $this->info['name']; + return $ret; + } + + public function getProperties() { + $ret = array(); + foreach ($this->info['properties'] as $name => $_) { + $ret[] = $this->getProperty($name); + } + return $ret; + } + + public function getConstants() { + return $this->info['constants']; + } + + public function getConstant($name) { + if (!isset($this->info['constants'][$name])) { + $class = $this->info['name']; + throw new ReflectionException("Class constant $class::$name does not exist"); + } + return $this->info['constants'][$name]; + } + + public function getInterfaces() { + $ret = array(); + foreach ($this->info['interfaces'] as $name => $_) { + $cls = new ReflectionClass($name); + if ($cls->isInterface()) { + $ret[$name] = $cls; + } + } + return $ret; + } + + public function isInterface() { + return $this->info['interface']; + } + + public function isAbstract() { + return $this->info['abstract']; + } + + public function isFinal() { + return $this->info['final']; + } + + public function getModifiers() { + return $this->info['modifiers']; + } + + public function isInstance($obj) { + return hphp_instanceof($obj, $this->info['name']); + } + + public function newInstance() { + $args = func_get_args(); + return hphp_create_object($this->info['name'], $args); + } + + public function newInstanceArgs($args) { + return hphp_create_object($this->info['name'], $args); + } + + public function getParentClass() { + if (empty($this->info['parent'])) { + return false; + } + return new ReflectionClass($this->info['parent']); + } + + public function isSubclassOf($cls) { + if ($cls instanceof ReflectionClass) { + $cls = $cls->info['name']; + } + foreach ($this->info['interfaces'] as $name => $_) { + if (strcasecmp($cls, $name) == 0) { + return true; + } + } + if (empty($this->info['parent'])) { + return false; + } + if (strcasecmp($cls, $this->info['parent']) == 0) { + return true; + } + return $this->getParentClass()->isSubclassOf($cls); + } + + public function getStaticProperties() { + $ret = array(); + foreach ($this->getProperties() as $prop) { + if ($prop->isStatic()) { + $ret[$prop->name] = $prop; + } + } + return $ret; + } + + public function getStaticPropertyValue($name, $default = null) { + if ($this->hasProperty($name) && + $this->getProperty($name)->isStatic()) { + return hphp_get_static_property($this->info['name'], $name); + } + return $default; + } + + public function setStaticPropertyValue($name, $value) { + hphp_set_static_property($this->info['name'], $name, $value); + } + + public function getDefaultProperties() { + $ret = array(); + foreach ($this->getProperties() as $prop) { + if ($prop->isDefault()) { + $ret[$prop->name] = $prop; + } + } + return $ret; + } + + public function isIterateable() { + return $this->isSubclassOf('ArrayAccess'); + } + + public function implementsInterface($cls) { + if ($cls instanceof ReflectionClass) { + $cls = $cls->info['name']; + } + foreach ($this->info['interfaces'] as $name => $_) { + if (strcasecmp($cls, $name) == 0) { + return true; + } + } + return false; + } + + public function getExtension() { + return $this->info['extension']; + } + + public function getExtensionName() { + return $this->info['extension']->getName(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// object + +class ReflectionObject extends ReflectionClass { + public function __construct($obj) { + $this->info = hphp_get_class_info($obj); + } + + public static function export($obj, $ret) { + $obj = new ReflectionObject($obj); + $str = (string)$obj; + if ($ret) { + return $str; + } + print $str; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// property + +class ReflectionProperty implements Reflector { + public $info; + public $name; + public $class; + + public function __construct($cls, $name) { + if ($cls && $name) { + if (!is_object($cls)) $cls = new ReflectionClass($cls); + $prop = $cls->getProperty($name); + if ($prop) { + $this->info = $prop->info; + $this->name = $prop->name; + $this->class = $prop->class; + } + } + } + + public function __toString() { + } + + public static function export($cls, $name, $ret) { + if (!is_object($cls)) $cls = new ReflectionClass($cls); + $obj = $cls->getProperty($name); + $str = (string)$obj; + if ($ret) { + return $str; + } + print $str; + } + + public function getName() { + return $this->info['name']; + } + + public function isPublic() { + return $this->info['access'] == 'public'; + } + + public function isPrivate() { + return $this->info['access'] == 'private'; + } + + public function isProtected() { + return $this->info['access'] == 'protected'; + } + + public function isStatic() { + return $this->info['static']; + } + + public function isDefault() { + return $this->info['default']; + } + + public function setAccessible() { + } + + public function getModifiers() { + return $this->info['modifiers']; + } + + public function getValue($obj) { + if ($this->isStatic()) { + return hphp_get_static_property($this->info['class'], + $this->info['name']); + } + return hphp_get_property($obj, $this->info['class'], $this->info['name']); + } + + public function setValue($obj, $value) { + if ($this->isStatic()) { + return hphp_set_static_property($this->info['class'], + $this->info['name'], $value); + } + hphp_set_property($obj, $this->info['class'], $this->info['name'], $value); + } + + public function getDeclaringClass() { + if (empty($this->info['class'])) { + return null; + } + return new ReflectionClass($this->info['class']); + } + + public function getDocComment() { + return $this->info['doc']; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// method + +class ReflectionMethod extends ReflectionFunctionAbstract +implements Reflector { + public $name; + public $class; + + public function __construct($cls, $name) { + if ($cls && $name) { + if (!is_object($cls)) $cls = new ReflectionClass($cls); + $method = $cls->getMethod($name); + if ($method) { + $this->info = $method->info; + $this->name = $method->name; + $this->class = $method->class; + } + } + } + + public function __toString() { + //TODO + } + + public static function export($cls, $name, $ret) { + if (!is_object($cls)) $cls = new ReflectionClass($cls); + $obj = $cls->getMethod($name); + $str = (string)$obj; + if ($ret) { + return $str; + } + print $str; + } + + public function invoke($obj) { + $args = func_get_args(); + array_shift($args); + return hphp_invoke_method($obj, $this->info['class'], $this->info['name'], + $args); + } + + public function invokeArgs($obj, $args) { + return hphp_invoke_method($obj, $this->info['class'], $this->info['name'], + $args); + } + + public function isFinal() { + return $this->info['final']; + } + + public function isAbstract() { + return $this->info['abstract']; + } + + public function isPublic() { + return $this->info['access'] == "public"; + } + + public function isPrivate() { + return $this->info['access'] == "private"; + } + + public function isProtected() { + return $this->info['access'] == "protected"; + } + + public function isStatic() { + return $this->info['static']; + } + + public function isConstructor() { + return $this->getName() == '__construct'; + } + + public function isDestructor() { + return $this->getName() == '__destruct'; + } + + public function getModifiers() { + return $this->info['modifiers']; + } + + public function getClosure() { + return $this->info['closure']; + } + + public function getDeclaringClass() { + if (empty($this->info['class'])) { + return null; + } + return new ReflectionClass($this->info['class']); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// extension + +class ReflectionExtension implements Reflector { + private $name; + private $info; + + public function __construct($name) { + $this->info = hphp_get_extension_info($name); + } + + public function __toString() { + } + + public static function export($name, $ret) { + $obj = new ReflectionExtension($name); + $str = (string)$obj; + if ($ret) { + return $str; + } + print $str; + } + + public function getName() { + return $this->info['name']; + } + + public function getVersion() { + return $this->info['version']; + } + + public function getFunctions() { + return $this->info['functions']; + } + + public function getConstants() { + return $this->info['constants']; + } + + public function getINIEntries() { + return $this->info['ini']; + } + + public function getClasses() { + return $this->info['classes']; + } + + public function getClassNames() { + $ret = array(); + foreach ($this->info['classes'] as $cls) { + $ret[] = $cls->getName(); + } + return $ret; + } + + public function info() { + return $this->info['info']; + } +} diff --git a/src/lib/system/classes/stdclass.php b/src/lib/system/classes/stdclass.php new file mode 100644 index 0000000000000..c4a2002b63680 --- /dev/null +++ b/src/lib/system/classes/stdclass.php @@ -0,0 +1,9 @@ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/iterator.php line 31 */ +class c_arrayiterator : virtual public c_iterator, virtual public c_arrayaccess, virtual public c_seekableiterator, virtual public c_countable { + BEGIN_CLASS_MAP(arrayiterator) + PARENT_CLASS(traversable) + PARENT_CLASS(iterator) + PARENT_CLASS(arrayaccess) + PARENT_CLASS(seekableiterator) + PARENT_CLASS(countable) + END_CLASS_MAP(arrayiterator) + DECLARE_CLASS(arrayiterator, ArrayIterator, ObjectData) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: Variant m_arr; + public: Variant m_flags; + public: void t___construct(Variant v_array, Variant v_flags = 0LL /* SORT_REGULAR */); + public: ObjectData *create(Variant v_array, Variant v_flags = 0LL /* SORT_REGULAR */); + public: ObjectData *dynCreate(CArrRef params, bool init = true); + public: void dynConstruct(CArrRef params); + public: void t_append(CVarRef v_value); + public: bool t_asort(); + public: int t_count(); + public: Variant t_current(); + public: Variant t_getarraycopy(); + public: Variant t_getflags(); + public: Variant t_key(); + public: bool t_ksort(); + public: Variant t_natcasesort(); + public: Variant t_natsort(); + public: Variant t_next(); + public: bool t_offsetexists(CVarRef v_index); + public: Variant t_offsetget(Variant v_index); + public: virtual Variant &___offsetget_lval(Variant v_index); + public: void t_offsetset(CVarRef v_index, CVarRef v_newval); + public: void t_offsetunset(CVarRef v_index); + public: Variant t_rewind(); + public: void t_seek(CVarRef v_position); + public: void t_setflags(CVarRef v_flags); + public: bool t_uasort(CVarRef v_cmp_function); + public: bool t_uksort(Variant v_cmp_function); + public: bool t_valid(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_ARRAYITERATOR_H__ diff --git a/src/lib/system/gen/cls/badfunctioncallexception.h b/src/lib/system/gen/cls/badfunctioncallexception.h new file mode 100644 index 0000000000000..8bf71100cd6eb --- /dev/null +++ b/src/lib/system/gen/cls/badfunctioncallexception.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_BADFUNCTIONCALLEXCEPTION_H__ +#define __GENERATED_CLS_BADFUNCTIONCALLEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 68 */ +class c_badfunctioncallexception : virtual public c_logicexception { + BEGIN_CLASS_MAP(badfunctioncallexception) + PARENT_CLASS(exception) + PARENT_CLASS(logicexception) + END_CLASS_MAP(badfunctioncallexception) + DECLARE_CLASS(badfunctioncallexception, BadFunctionCallException, logicexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_BADFUNCTIONCALLEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/badmethodcallexception.h b/src/lib/system/gen/cls/badmethodcallexception.h new file mode 100644 index 0000000000000..f557257a602be --- /dev/null +++ b/src/lib/system/gen/cls/badmethodcallexception.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_BADMETHODCALLEXCEPTION_H__ +#define __GENERATED_CLS_BADMETHODCALLEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 69 */ +class c_badmethodcallexception : virtual public c_badfunctioncallexception { + BEGIN_CLASS_MAP(badmethodcallexception) + PARENT_CLASS(exception) + PARENT_CLASS(logicexception) + PARENT_CLASS(badfunctioncallexception) + END_CLASS_MAP(badmethodcallexception) + DECLARE_CLASS(badmethodcallexception, BadMethodCallException, badfunctioncallexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_BADMETHODCALLEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/countable.h b/src/lib/system/gen/cls/countable.h new file mode 100644 index 0000000000000..03812498046cc --- /dev/null +++ b/src/lib/system/gen/cls/countable.h @@ -0,0 +1,32 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_COUNTABLE_H__ +#define __GENERATED_CLS_COUNTABLE_H__ + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/iterator.php line 3 */ +class c_countable : virtual public ObjectData { + // public: void t_count() = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_COUNTABLE_H__ diff --git a/src/lib/system/gen/cls/domainexception.h b/src/lib/system/gen/cls/domainexception.h new file mode 100644 index 0000000000000..a6cb77c294a33 --- /dev/null +++ b/src/lib/system/gen/cls/domainexception.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_DOMAINEXCEPTION_H__ +#define __GENERATED_CLS_DOMAINEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 70 */ +class c_domainexception : virtual public c_logicexception { + BEGIN_CLASS_MAP(domainexception) + PARENT_CLASS(exception) + PARENT_CLASS(logicexception) + END_CLASS_MAP(domainexception) + DECLARE_CLASS(domainexception, DomainException, logicexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_DOMAINEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/exception.h b/src/lib/system/gen/cls/exception.h new file mode 100644 index 0000000000000..aab675aa090e3 --- /dev/null +++ b/src/lib/system/gen/cls/exception.h @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_EXCEPTION_H__ +#define __GENERATED_CLS_EXCEPTION_H__ + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 3 */ +class c_exception : virtual public ObjectData { + BEGIN_CLASS_MAP(exception) + END_CLASS_MAP(exception) + DECLARE_CLASS(exception, Exception, ObjectData) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: Variant m_message; + public: Variant m_code; + public: Variant m_file; + public: Variant m_line; + public: void t___construct(Variant v_message = "", Variant v_code = 0LL); + public: ObjectData *create(Variant v_message = "", Variant v_code = 0LL); + public: ObjectData *dynCreate(CArrRef params, bool init = true); + public: void dynConstruct(CArrRef params); + public: Variant t_getmessage(); + public: Variant t_getcode(); + public: Variant t_getfile(); + public: Variant t_getline(); + public: Variant t_gettrace(); + public: String t_gettraceasstring(); + public: String t___tostring(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_EXCEPTION_H__ diff --git a/src/lib/system/gen/cls/filteriterator.h b/src/lib/system/gen/cls/filteriterator.h new file mode 100644 index 0000000000000..738ba10a4bce0 --- /dev/null +++ b/src/lib/system/gen/cls/filteriterator.h @@ -0,0 +1,33 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_FILTERITERATOR_H__ +#define __GENERATED_CLS_FILTERITERATOR_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/iterator.php line 131 */ +class c_filteriterator : virtual public c_iterator, virtual public c_outeriterator { +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_FILTERITERATOR_H__ diff --git a/src/lib/system/gen/cls/invalidargumentexception.h b/src/lib/system/gen/cls/invalidargumentexception.h new file mode 100644 index 0000000000000..eb5275cdce815 --- /dev/null +++ b/src/lib/system/gen/cls/invalidargumentexception.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_INVALIDARGUMENTEXCEPTION_H__ +#define __GENERATED_CLS_INVALIDARGUMENTEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 71 */ +class c_invalidargumentexception : virtual public c_logicexception { + BEGIN_CLASS_MAP(invalidargumentexception) + PARENT_CLASS(exception) + PARENT_CLASS(logicexception) + END_CLASS_MAP(invalidargumentexception) + DECLARE_CLASS(invalidargumentexception, InvalidArgumentException, logicexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_INVALIDARGUMENTEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/iterator.h b/src/lib/system/gen/cls/iterator.h new file mode 100644 index 0000000000000..77cdd1b99cd58 --- /dev/null +++ b/src/lib/system/gen/cls/iterator.h @@ -0,0 +1,37 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_ITERATOR_H__ +#define __GENERATED_CLS_ITERATOR_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/iterator.php line 23 */ +class c_iterator : virtual public c_traversable { + // public: void t_current() = 0; + // public: void t_key() = 0; + // public: void t_next() = 0; + // public: void t_rewind() = 0; + // public: void t_valid() = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_ITERATOR_H__ diff --git a/src/lib/system/gen/cls/iteratoraggregate.h b/src/lib/system/gen/cls/iteratoraggregate.h new file mode 100644 index 0000000000000..7c13ac310a64c --- /dev/null +++ b/src/lib/system/gen/cls/iteratoraggregate.h @@ -0,0 +1,33 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_ITERATORAGGREGATE_H__ +#define __GENERATED_CLS_ITERATORAGGREGATE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/iterator.php line 135 */ +class c_iteratoraggregate : virtual public c_traversable { + // public: void t_getiterator() = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_ITERATORAGGREGATE_H__ diff --git a/src/lib/system/gen/cls/lengthexception.h b/src/lib/system/gen/cls/lengthexception.h new file mode 100644 index 0000000000000..797eeafa795be --- /dev/null +++ b/src/lib/system/gen/cls/lengthexception.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_LENGTHEXCEPTION_H__ +#define __GENERATED_CLS_LENGTHEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 72 */ +class c_lengthexception : virtual public c_logicexception { + BEGIN_CLASS_MAP(lengthexception) + PARENT_CLASS(exception) + PARENT_CLASS(logicexception) + END_CLASS_MAP(lengthexception) + DECLARE_CLASS(lengthexception, LengthException, logicexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_LENGTHEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/logicexception.h b/src/lib/system/gen/cls/logicexception.h new file mode 100644 index 0000000000000..12eab6b9ec483 --- /dev/null +++ b/src/lib/system/gen/cls/logicexception.h @@ -0,0 +1,38 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_LOGICEXCEPTION_H__ +#define __GENERATED_CLS_LOGICEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 67 */ +class c_logicexception : virtual public c_exception { + BEGIN_CLASS_MAP(logicexception) + PARENT_CLASS(exception) + END_CLASS_MAP(logicexception) + DECLARE_CLASS(logicexception, LogicException, exception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_LOGICEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/outeriterator.h b/src/lib/system/gen/cls/outeriterator.h new file mode 100644 index 0000000000000..a299575ecee49 --- /dev/null +++ b/src/lib/system/gen/cls/outeriterator.h @@ -0,0 +1,32 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_OUTERITERATOR_H__ +#define __GENERATED_CLS_OUTERITERATOR_H__ + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/iterator.php line 19 */ +class c_outeriterator : virtual public ObjectData { + // public: void t_getinneriterator() = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_OUTERITERATOR_H__ diff --git a/src/lib/system/gen/cls/outofboundsexception.h b/src/lib/system/gen/cls/outofboundsexception.h new file mode 100644 index 0000000000000..1ec064a9be230 --- /dev/null +++ b/src/lib/system/gen/cls/outofboundsexception.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_OUTOFBOUNDSEXCEPTION_H__ +#define __GENERATED_CLS_OUTOFBOUNDSEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 75 */ +class c_outofboundsexception : virtual public c_runtimeexception { + BEGIN_CLASS_MAP(outofboundsexception) + PARENT_CLASS(exception) + PARENT_CLASS(runtimeexception) + END_CLASS_MAP(outofboundsexception) + DECLARE_CLASS(outofboundsexception, OutOfBoundsException, runtimeexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_OUTOFBOUNDSEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/outofrangeexception.h b/src/lib/system/gen/cls/outofrangeexception.h new file mode 100644 index 0000000000000..a9aba998b859c --- /dev/null +++ b/src/lib/system/gen/cls/outofrangeexception.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_OUTOFRANGEEXCEPTION_H__ +#define __GENERATED_CLS_OUTOFRANGEEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 73 */ +class c_outofrangeexception : virtual public c_logicexception { + BEGIN_CLASS_MAP(outofrangeexception) + PARENT_CLASS(exception) + PARENT_CLASS(logicexception) + END_CLASS_MAP(outofrangeexception) + DECLARE_CLASS(outofrangeexception, OutOfRangeException, logicexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_OUTOFRANGEEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/overflowexception.h b/src/lib/system/gen/cls/overflowexception.h new file mode 100644 index 0000000000000..3b2891bc16f27 --- /dev/null +++ b/src/lib/system/gen/cls/overflowexception.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_OVERFLOWEXCEPTION_H__ +#define __GENERATED_CLS_OVERFLOWEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 76 */ +class c_overflowexception : virtual public c_runtimeexception { + BEGIN_CLASS_MAP(overflowexception) + PARENT_CLASS(exception) + PARENT_CLASS(runtimeexception) + END_CLASS_MAP(overflowexception) + DECLARE_CLASS(overflowexception, OverflowException, runtimeexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_OVERFLOWEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/pear_error.h b/src/lib/system/gen/cls/pear_error.h new file mode 100644 index 0000000000000..99e099c7a7d4a --- /dev/null +++ b/src/lib/system/gen/cls/pear_error.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_PEAR_ERROR_H__ +#define __GENERATED_CLS_PEAR_ERROR_H__ + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/pear_error.php line 3 */ +class c_pear_error : virtual public ObjectData { + BEGIN_CLASS_MAP(pear_error) + END_CLASS_MAP(pear_error) + DECLARE_CLASS(pear_error, pear_error, ObjectData) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: void t_pear_error(CStrRef v_message = "unknown error", CVarRef v_code = null_variant, CVarRef v_mode = null_variant, CVarRef v_options = null_variant, CVarRef v_userinfo = null_variant); + public: ObjectData *create(CStrRef v_message = "unknown error", CVarRef v_code = null_variant, CVarRef v_mode = null_variant, CVarRef v_options = null_variant, CVarRef v_userinfo = null_variant); + public: ObjectData *dynCreate(CArrRef params, bool init = true); + public: void t_adduserinfo(CVarRef v_info); + public: void t_getcallback(); + public: void t_getcode(); + public: void t_getmessage(); + public: void t_getmode(); + public: void t_getdebuginfo(); + public: void t_gettype(); + public: void t_getuserinfo(); + public: void t_getbacktrace(CVarRef v_frame = null_variant); + public: void t_tostring(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_PEAR_ERROR_H__ diff --git a/src/lib/system/gen/cls/rangeexception.h b/src/lib/system/gen/cls/rangeexception.h new file mode 100644 index 0000000000000..8c6dcca79e68c --- /dev/null +++ b/src/lib/system/gen/cls/rangeexception.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_RANGEEXCEPTION_H__ +#define __GENERATED_CLS_RANGEEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 77 */ +class c_rangeexception : virtual public c_runtimeexception { + BEGIN_CLASS_MAP(rangeexception) + PARENT_CLASS(exception) + PARENT_CLASS(runtimeexception) + END_CLASS_MAP(rangeexception) + DECLARE_CLASS(rangeexception, RangeException, runtimeexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_RANGEEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/reflectionclass.h b/src/lib/system/gen/cls/reflectionclass.h new file mode 100644 index 0000000000000..534f65eae5840 --- /dev/null +++ b/src/lib/system/gen/cls/reflectionclass.h @@ -0,0 +1,83 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_REFLECTIONCLASS_H__ +#define __GENERATED_CLS_REFLECTIONCLASS_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/reflection.php line 200 */ +class c_reflectionclass : virtual public c_reflector { + BEGIN_CLASS_MAP(reflectionclass) + PARENT_CLASS(reflector) + END_CLASS_MAP(reflectionclass) + DECLARE_CLASS(reflectionclass, ReflectionClass, ObjectData) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: Variant m_name; + public: Array m_info; + public: void t___construct(Variant v_name); + public: ObjectData *create(Variant v_name); + public: ObjectData *dynCreate(CArrRef params, bool init = true); + public: void dynConstruct(CArrRef params); + public: String t___tostring(); + public: static Variant ti_export(const char* cls, CVarRef v_name, CVarRef v_ret); + public: Variant t_getname(); + public: Variant t_isinternal(); + public: bool t_isuserdefined(); + public: bool t_isinstantiable(); + public: bool t_hasconstant(CVarRef v_name); + public: bool t_hasmethod(CVarRef v_name); + public: bool t_hasproperty(CVarRef v_name); + public: Variant t_getfilename(); + public: Variant t_getstartline(); + public: Variant t_getendline(); + public: Variant t_getdoccomment(); + public: Variant t_getconstructor(); + public: p_reflectionmethod t_getmethod(CVarRef v_name); + public: Array t_getmethods(); + public: p_reflectionproperty t_getproperty(CVarRef v_name); + public: Array t_getproperties(); + public: Variant t_getconstants(); + public: Variant t_getconstant(CVarRef v_name); + public: Variant t_getinterfaces(); + public: Variant t_isinterface(); + public: Variant t_isabstract(); + public: Variant t_isfinal(); + public: Variant t_getmodifiers(); + public: bool t_isinstance(CVarRef v_obj); + public: Object t_newinstance(int num_args, Array args = Array()); + public: Object t_newinstanceargs(CVarRef v_args); + public: Variant t_getparentclass(); + public: Variant t_issubclassof(Variant v_cls); + public: Variant t_getstaticproperties(); + public: Variant t_getstaticpropertyvalue(CVarRef v_name, CVarRef v_default = null_variant); + public: void t_setstaticpropertyvalue(CVarRef v_name, CVarRef v_value); + public: Variant t_getdefaultproperties(); + public: Variant t_isiterateable(); + public: bool t_implementsinterface(Variant v_cls); + public: Variant t_getextension(); + public: Variant t_getextensionname(); + public: static Variant t_export(CVarRef v_name, CVarRef v_ret) { return ti_export("reflectionclass", v_name, v_ret); } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_REFLECTIONCLASS_H__ diff --git a/src/lib/system/gen/cls/reflectionexception.h b/src/lib/system/gen/cls/reflectionexception.h new file mode 100644 index 0000000000000..8bc83a1a21d34 --- /dev/null +++ b/src/lib/system/gen/cls/reflectionexception.h @@ -0,0 +1,38 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_REFLECTIONEXCEPTION_H__ +#define __GENERATED_CLS_REFLECTIONEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/reflection.php line 11 */ +class c_reflectionexception : virtual public c_exception { + BEGIN_CLASS_MAP(reflectionexception) + PARENT_CLASS(exception) + END_CLASS_MAP(reflectionexception) + DECLARE_CLASS(reflectionexception, ReflectionException, exception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_REFLECTIONEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/reflectionextension.h b/src/lib/system/gen/cls/reflectionextension.h new file mode 100644 index 0000000000000..f98bca306b7a4 --- /dev/null +++ b/src/lib/system/gen/cls/reflectionextension.h @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_REFLECTIONEXTENSION_H__ +#define __GENERATED_CLS_REFLECTIONEXTENSION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/reflection.php line 676 */ +class c_reflectionextension : virtual public c_reflector { + BEGIN_CLASS_MAP(reflectionextension) + PARENT_CLASS(reflector) + END_CLASS_MAP(reflectionextension) + DECLARE_CLASS(reflectionextension, ReflectionExtension, ObjectData) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: Variant m_name; + public: Array m_info; + public: void t___construct(Variant v_name); + public: ObjectData *create(Variant v_name); + public: ObjectData *dynCreate(CArrRef params, bool init = true); + public: void dynConstruct(CArrRef params); + public: String t___tostring(); + public: static Variant ti_export(const char* cls, CVarRef v_name, CVarRef v_ret); + public: Variant t_getname(); + public: Variant t_getversion(); + public: Variant t_getfunctions(); + public: Variant t_getconstants(); + public: Variant t_getinientries(); + public: Variant t_getclasses(); + public: Array t_getclassnames(); + public: Variant t_info(); + public: static Variant t_export(CVarRef v_name, CVarRef v_ret) { return ti_export("reflectionextension", v_name, v_ret); } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_REFLECTIONEXTENSION_H__ diff --git a/src/lib/system/gen/cls/reflectionfunction.h b/src/lib/system/gen/cls/reflectionfunction.h new file mode 100644 index 0000000000000..0161e0fcf71f6 --- /dev/null +++ b/src/lib/system/gen/cls/reflectionfunction.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_REFLECTIONFUNCTION_H__ +#define __GENERATED_CLS_REFLECTIONFUNCTION_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/reflection.php line 165 */ +class c_reflectionfunction : virtual public c_reflectionfunctionabstract, virtual public c_reflector { + BEGIN_CLASS_MAP(reflectionfunction) + PARENT_CLASS(reflectionfunctionabstract) + PARENT_CLASS(reflector) + END_CLASS_MAP(reflectionfunction) + DECLARE_CLASS(reflectionfunction, ReflectionFunction, reflectionfunctionabstract) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: void t___construct(Variant v_name); + public: ObjectData *create(Variant v_name); + public: ObjectData *dynCreate(CArrRef params, bool init = true); + public: void dynConstruct(CArrRef params); + public: String t___tostring(); + public: static Variant ti_export(const char* cls, CVarRef v_name, CVarRef v_ret); + public: Variant t_invoke(int num_args, Array args = Array()); + public: Variant t_invokeargs(CVarRef v_args); + public: static Variant t_export(CVarRef v_name, CVarRef v_ret) { return ti_export("reflectionfunction", v_name, v_ret); } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_REFLECTIONFUNCTION_H__ diff --git a/src/lib/system/gen/cls/reflectionfunctionabstract.h b/src/lib/system/gen/cls/reflectionfunctionabstract.h new file mode 100644 index 0000000000000..5de4a91069dc6 --- /dev/null +++ b/src/lib/system/gen/cls/reflectionfunctionabstract.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_REFLECTIONFUNCTIONABSTRACT_H__ +#define __GENERATED_CLS_REFLECTIONFUNCTIONABSTRACT_H__ + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/reflection.php line 92 */ +class c_reflectionfunctionabstract : virtual public ObjectData { + BEGIN_CLASS_MAP(reflectionfunctionabstract) + END_CLASS_MAP(reflectionfunctionabstract) + DECLARE_CLASS(reflectionfunctionabstract, ReflectionFunctionAbstract, ObjectData) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: Variant m_info; + public: Variant t_getname(); + public: Variant t_isinternal(); + public: Variant t_getclosure(); + public: bool t_isuserdefined(); + public: Variant t_getfilename(); + public: Variant t_getstartline(); + public: Variant t_getendline(); + public: Variant t_getdoccomment(); + public: Variant t_getstaticvariables(); + public: Variant t_returnsreference(); + public: Array t_getparameters(); + public: int t_getnumberofparameters(); + public: int64 t_getnumberofrequiredparameters(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_REFLECTIONFUNCTIONABSTRACT_H__ diff --git a/src/lib/system/gen/cls/reflectionmethod.h b/src/lib/system/gen/cls/reflectionmethod.h new file mode 100644 index 0000000000000..bf1d323317270 --- /dev/null +++ b/src/lib/system/gen/cls/reflectionmethod.h @@ -0,0 +1,62 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_REFLECTIONMETHOD_H__ +#define __GENERATED_CLS_REFLECTIONMETHOD_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/reflection.php line 582 */ +class c_reflectionmethod : virtual public c_reflectionfunctionabstract, virtual public c_reflector { + BEGIN_CLASS_MAP(reflectionmethod) + PARENT_CLASS(reflectionfunctionabstract) + PARENT_CLASS(reflector) + END_CLASS_MAP(reflectionmethod) + DECLARE_CLASS(reflectionmethod, ReflectionMethod, reflectionfunctionabstract) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: Variant m_name; + public: Variant m_class; + public: void t___construct(Variant v_cls, Variant v_name); + public: ObjectData *create(Variant v_cls, Variant v_name); + public: ObjectData *dynCreate(CArrRef params, bool init = true); + public: void dynConstruct(CArrRef params); + public: String t___tostring(); + public: static Variant ti_export(const char* cls, Variant v_cls, Variant v_name, CVarRef v_ret); + public: Variant t_invoke(int num_args, CVarRef v_obj, Array args = Array()); + public: Variant t_invokeargs(CVarRef v_obj, CVarRef v_args); + public: Variant t_isfinal(); + public: Variant t_isabstract(); + public: bool t_ispublic(); + public: bool t_isprivate(); + public: bool t_isprotected(); + public: Variant t_isstatic(); + public: bool t_isconstructor(); + public: bool t_isdestructor(); + public: Variant t_getmodifiers(); + public: Variant t_getclosure(); + public: Variant t_getdeclaringclass(); + public: static Variant t_export(CVarRef v_cls, CVarRef v_name, CVarRef v_ret) { return ti_export("reflectionmethod", v_cls, v_name, v_ret); } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_REFLECTIONMETHOD_H__ diff --git a/src/lib/system/gen/cls/reflectionobject.h b/src/lib/system/gen/cls/reflectionobject.h new file mode 100644 index 0000000000000..dee9c9007861b --- /dev/null +++ b/src/lib/system/gen/cls/reflectionobject.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_REFLECTIONOBJECT_H__ +#define __GENERATED_CLS_REFLECTIONOBJECT_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/reflection.php line 472 */ +class c_reflectionobject : virtual public c_reflectionclass { + BEGIN_CLASS_MAP(reflectionobject) + PARENT_CLASS(reflector) + PARENT_CLASS(reflectionclass) + END_CLASS_MAP(reflectionobject) + DECLARE_CLASS(reflectionobject, ReflectionObject, reflectionclass) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: void t___construct(Variant v_obj); + public: ObjectData *create(Variant v_obj); + public: ObjectData *dynCreate(CArrRef params, bool init = true); + public: void dynConstruct(CArrRef params); + public: static Variant ti_export(const char* cls, Variant v_obj, CVarRef v_ret); + public: static Variant t_export(CVarRef v_obj, CVarRef v_ret) { return ti_export("reflectionobject", v_obj, v_ret); } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_REFLECTIONOBJECT_H__ diff --git a/src/lib/system/gen/cls/reflectionparameter.h b/src/lib/system/gen/cls/reflectionparameter.h new file mode 100644 index 0000000000000..28523e66fa7ad --- /dev/null +++ b/src/lib/system/gen/cls/reflectionparameter.h @@ -0,0 +1,56 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_REFLECTIONPARAMETER_H__ +#define __GENERATED_CLS_REFLECTIONPARAMETER_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/reflection.php line 17 */ +class c_reflectionparameter : virtual public c_reflector { + BEGIN_CLASS_MAP(reflectionparameter) + PARENT_CLASS(reflector) + END_CLASS_MAP(reflectionparameter) + DECLARE_CLASS(reflectionparameter, ReflectionParameter, ObjectData) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: Variant m_info; + public: void t___construct(Variant v_func, Variant v_param); + public: ObjectData *create(Variant v_func, Variant v_param); + public: ObjectData *dynCreate(CArrRef params, bool init = true); + public: void dynConstruct(CArrRef params); + public: String t___tostring(); + public: static Variant ti_export(const char* cls, CVarRef v_func, CVarRef v_param, CVarRef v_ret); + public: Variant t_getname(); + public: Variant t_ispassedbyreference(); + public: Variant t_getdeclaringclass(); + public: Variant t_getclass(); + public: bool t_isarray(); + public: Variant t_allowsnull(); + public: bool t_isoptional(); + public: bool t_isdefaultvalueavailable(); + public: Variant t_getdefaultvalue(); + public: Variant t_getposition(); + public: static Variant t_export(CVarRef v_func, CVarRef v_param, CVarRef v_ret) { return ti_export("reflectionparameter", v_func, v_param, v_ret); } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_REFLECTIONPARAMETER_H__ diff --git a/src/lib/system/gen/cls/reflectionproperty.h b/src/lib/system/gen/cls/reflectionproperty.h new file mode 100644 index 0000000000000..ead8ce7e83d2c --- /dev/null +++ b/src/lib/system/gen/cls/reflectionproperty.h @@ -0,0 +1,60 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_REFLECTIONPROPERTY_H__ +#define __GENERATED_CLS_REFLECTIONPROPERTY_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/reflection.php line 490 */ +class c_reflectionproperty : virtual public c_reflector { + BEGIN_CLASS_MAP(reflectionproperty) + PARENT_CLASS(reflector) + END_CLASS_MAP(reflectionproperty) + DECLARE_CLASS(reflectionproperty, ReflectionProperty, ObjectData) + DECLARE_INVOKES_FROM_EVAL + void init(); + public: Variant m_info; + public: Variant m_name; + public: Variant m_class; + public: void t___construct(Variant v_cls, Variant v_name); + public: ObjectData *create(Variant v_cls, Variant v_name); + public: ObjectData *dynCreate(CArrRef params, bool init = true); + public: void dynConstruct(CArrRef params); + public: String t___tostring(); + public: static Variant ti_export(const char* cls, Variant v_cls, Variant v_name, CVarRef v_ret); + public: Variant t_getname(); + public: bool t_ispublic(); + public: bool t_isprivate(); + public: bool t_isprotected(); + public: Variant t_isstatic(); + public: Variant t_isdefault(); + public: void t_setaccessible(); + public: Variant t_getmodifiers(); + public: Variant t_getvalue(CVarRef v_obj); + public: Variant t_setvalue(CVarRef v_obj, CVarRef v_value); + public: Variant t_getdeclaringclass(); + public: Variant t_getdoccomment(); + public: static Variant t_export(CVarRef v_cls, CVarRef v_name, CVarRef v_ret) { return ti_export("reflectionproperty", v_cls, v_name, v_ret); } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_REFLECTIONPROPERTY_H__ diff --git a/src/lib/system/gen/cls/reflector.h b/src/lib/system/gen/cls/reflector.h new file mode 100644 index 0000000000000..47a8e8940a29d --- /dev/null +++ b/src/lib/system/gen/cls/reflector.h @@ -0,0 +1,33 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_REFLECTOR_H__ +#define __GENERATED_CLS_REFLECTOR_H__ + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/reflection.php line 6 */ +class c_reflector : virtual public ObjectData { + // public: String t___tostring() = 0; + // public: static void t_export() = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_REFLECTOR_H__ diff --git a/src/lib/system/gen/cls/runtimeexception.h b/src/lib/system/gen/cls/runtimeexception.h new file mode 100644 index 0000000000000..d7a1f86205312 --- /dev/null +++ b/src/lib/system/gen/cls/runtimeexception.h @@ -0,0 +1,38 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_RUNTIMEEXCEPTION_H__ +#define __GENERATED_CLS_RUNTIMEEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 74 */ +class c_runtimeexception : virtual public c_exception { + BEGIN_CLASS_MAP(runtimeexception) + PARENT_CLASS(exception) + END_CLASS_MAP(runtimeexception) + DECLARE_CLASS(runtimeexception, RuntimeException, exception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_RUNTIMEEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/seekableiterator.h b/src/lib/system/gen/cls/seekableiterator.h new file mode 100644 index 0000000000000..a7ca5bb17b83f --- /dev/null +++ b/src/lib/system/gen/cls/seekableiterator.h @@ -0,0 +1,32 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_SEEKABLEITERATOR_H__ +#define __GENERATED_CLS_SEEKABLEITERATOR_H__ + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/iterator.php line 15 */ +class c_seekableiterator : virtual public ObjectData { + // public: void t_seek(CVarRef v_position) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_SEEKABLEITERATOR_H__ diff --git a/src/lib/system/gen/cls/serializable.h b/src/lib/system/gen/cls/serializable.h new file mode 100644 index 0000000000000..12db1c2fc9b31 --- /dev/null +++ b/src/lib/system/gen/cls/serializable.h @@ -0,0 +1,33 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_SERIALIZABLE_H__ +#define __GENERATED_CLS_SERIALIZABLE_H__ + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/iterator.php line 7 */ +class c_serializable : virtual public ObjectData { + // public: void t_serialize() = 0; + // public: void t_unserialize(CVarRef v_serialized) = 0; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_SERIALIZABLE_H__ diff --git a/src/lib/system/gen/cls/stdclass.h b/src/lib/system/gen/cls/stdclass.h new file mode 100644 index 0000000000000..5d2c866689cb9 --- /dev/null +++ b/src/lib/system/gen/cls/stdclass.h @@ -0,0 +1,36 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_STDCLASS_H__ +#define __GENERATED_CLS_STDCLASS_H__ + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/stdclass.php line 4 */ +class c_stdclass : virtual public ObjectData { + BEGIN_CLASS_MAP(stdclass) + END_CLASS_MAP(stdclass) + DECLARE_CLASS(stdclass, stdClass, ObjectData) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_STDCLASS_H__ diff --git a/src/lib/system/gen/cls/traversable.h b/src/lib/system/gen/cls/traversable.h new file mode 100644 index 0000000000000..2792a74981b82 --- /dev/null +++ b/src/lib/system/gen/cls/traversable.h @@ -0,0 +1,31 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_TRAVERSABLE_H__ +#define __GENERATED_CLS_TRAVERSABLE_H__ + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/iterator.php line 12 */ +class c_traversable : virtual public ObjectData { +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_TRAVERSABLE_H__ diff --git a/src/lib/system/gen/cls/underflowexception.h b/src/lib/system/gen/cls/underflowexception.h new file mode 100644 index 0000000000000..e0caffb8bc8d7 --- /dev/null +++ b/src/lib/system/gen/cls/underflowexception.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_UNDERFLOWEXCEPTION_H__ +#define __GENERATED_CLS_UNDERFLOWEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 78 */ +class c_underflowexception : virtual public c_runtimeexception { + BEGIN_CLASS_MAP(underflowexception) + PARENT_CLASS(exception) + PARENT_CLASS(runtimeexception) + END_CLASS_MAP(underflowexception) + DECLARE_CLASS(underflowexception, UnderflowException, runtimeexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_UNDERFLOWEXCEPTION_H__ diff --git a/src/lib/system/gen/cls/unexpectedvalueexception.h b/src/lib/system/gen/cls/unexpectedvalueexception.h new file mode 100644 index 0000000000000..35505316682eb --- /dev/null +++ b/src/lib/system/gen/cls/unexpectedvalueexception.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_CLS_UNEXPECTEDVALUEEXCEPTION_H__ +#define __GENERATED_CLS_UNEXPECTEDVALUEEXCEPTION_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* SRC: classes/exception.php line 79 */ +class c_unexpectedvalueexception : virtual public c_runtimeexception { + BEGIN_CLASS_MAP(unexpectedvalueexception) + PARENT_CLASS(exception) + PARENT_CLASS(runtimeexception) + END_CLASS_MAP(unexpectedvalueexception) + DECLARE_CLASS(unexpectedvalueexception, UnexpectedValueException, runtimeexception) + DECLARE_INVOKES_FROM_EVAL + void init(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_CLS_UNEXPECTEDVALUEEXCEPTION_H__ diff --git a/src/lib/system/gen/php/classes/arrayaccess.cpp b/src/lib/system/gen/php/classes/arrayaccess.cpp new file mode 100644 index 0000000000000..d28976b01f583 --- /dev/null +++ b/src/lib/system/gen/php/classes/arrayaccess.cpp @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* preface starts */ +/* preface finishes */ +Variant pm_php$classes$arrayaccess_php(bool incOnce /* = false */, LVariableTable* variables /* = NULL */) { + FUNCTION_INJECTION(run_init::classes/arrayaccess.php); + { + DECLARE_SYSTEM_GLOBALS(g); + bool &alreadyRun = g->run_pm_php$classes$arrayaccess_php; + if (alreadyRun) { if (incOnce) return true;} + else alreadyRun = true; + if (!variables) variables = g; + } + DECLARE_SYSTEM_GLOBALS(g); + LVariableTable *gVariables __attribute__((__unused__)) = get_variable_table(); + return true; +} /* function */ + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/php/classes/arrayaccess.fw.h b/src/lib/system/gen/php/classes/arrayaccess.fw.h new file mode 100644 index 0000000000000..29cd991255c22 --- /dev/null +++ b/src/lib/system/gen/php/classes/arrayaccess.fw.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_ARRAYACCESS_FW_H__ +#define __GENERATED_PHP_CLASSES_ARRAYACCESS_FW_H__ + +#include + +// Forward Declarations + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// 1. Constants + +// 2. Classes +FORWARD_DECLARE_CLASS(arrayaccess); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_CLASSES_ARRAYACCESS_FW_H__ diff --git a/src/lib/system/gen/php/classes/arrayaccess.h b/src/lib/system/gen/php/classes/arrayaccess.h new file mode 100644 index 0000000000000..b2a22b1119179 --- /dev/null +++ b/src/lib/system/gen/php/classes/arrayaccess.h @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_ARRAYACCESS_H__ +#define __GENERATED_PHP_CLASSES_ARRAYACCESS_H__ + +#include +#include + +// Declarations +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant pm_php$classes$arrayaccess_php(bool incOnce = false, LVariableTable* variables = NULL); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_CLASSES_ARRAYACCESS_H__ diff --git a/src/lib/system/gen/php/classes/exception.cpp b/src/lib/system/gen/php/classes/exception.cpp new file mode 100644 index 0000000000000..dd9a9d0de4fec --- /dev/null +++ b/src/lib/system/gen/php/classes/exception.cpp @@ -0,0 +1,3794 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* preface starts */ +/* preface finishes */ +/* SRC: classes/exception.php line 79 */ +Variant c_unexpectedvalueexception::os_get(const char *s, int64 hash) { + return c_runtimeexception::os_get(s, hash); +} +Variant &c_unexpectedvalueexception::os_lval(const char *s, int64 hash) { + return c_runtimeexception::os_lval(s, hash); +} +void c_unexpectedvalueexception::o_get(ArrayElementVec &props) const { + c_runtimeexception::o_get(props); +} +bool c_unexpectedvalueexception::o_exists(CStrRef s, int64 hash) const { + return c_runtimeexception::o_exists(s, hash); +} +Variant c_unexpectedvalueexception::o_get(CStrRef s, int64 hash) { + return c_runtimeexception::o_get(s, hash); +} +Variant c_unexpectedvalueexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_runtimeexception::o_set(s, hash, v, forInit); +} +Variant &c_unexpectedvalueexception::o_lval(CStrRef s, int64 hash) { + return c_runtimeexception::o_lval(s, hash); +} +Variant c_unexpectedvalueexception::os_constant(const char *s) { + return c_runtimeexception::os_constant(s); +} +IMPLEMENT_CLASS(unexpectedvalueexception) +ObjectData *c_unexpectedvalueexception::cloneImpl() { + c_unexpectedvalueexception *obj = NEW(c_unexpectedvalueexception)(); + cloneSet(obj); + return obj; +} +void c_unexpectedvalueexception::cloneSet(c_unexpectedvalueexception *clone) { + c_runtimeexception::cloneSet(clone); +} +Variant c_unexpectedvalueexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke(s, params, hash, fatal); +} +Variant c_unexpectedvalueexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_unexpectedvalueexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_runtimeexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_unexpectedvalueexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_unexpectedvalueexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_runtimeexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_unexpectedvalueexception$os_get(const char *s) { + return c_unexpectedvalueexception::os_get(s, -1); +} +Variant &cw_unexpectedvalueexception$os_lval(const char *s) { + return c_unexpectedvalueexception::os_lval(s, -1); +} +Variant cw_unexpectedvalueexception$os_constant(const char *s) { + return c_unexpectedvalueexception::os_constant(s); +} +Variant cw_unexpectedvalueexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_unexpectedvalueexception::os_invoke(c, s, params, -1, fatal); +} +void c_unexpectedvalueexception::init() { + c_runtimeexception::init(); +} +/* SRC: classes/exception.php line 76 */ +Variant c_overflowexception::os_get(const char *s, int64 hash) { + return c_runtimeexception::os_get(s, hash); +} +Variant &c_overflowexception::os_lval(const char *s, int64 hash) { + return c_runtimeexception::os_lval(s, hash); +} +void c_overflowexception::o_get(ArrayElementVec &props) const { + c_runtimeexception::o_get(props); +} +bool c_overflowexception::o_exists(CStrRef s, int64 hash) const { + return c_runtimeexception::o_exists(s, hash); +} +Variant c_overflowexception::o_get(CStrRef s, int64 hash) { + return c_runtimeexception::o_get(s, hash); +} +Variant c_overflowexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_runtimeexception::o_set(s, hash, v, forInit); +} +Variant &c_overflowexception::o_lval(CStrRef s, int64 hash) { + return c_runtimeexception::o_lval(s, hash); +} +Variant c_overflowexception::os_constant(const char *s) { + return c_runtimeexception::os_constant(s); +} +IMPLEMENT_CLASS(overflowexception) +ObjectData *c_overflowexception::cloneImpl() { + c_overflowexception *obj = NEW(c_overflowexception)(); + cloneSet(obj); + return obj; +} +void c_overflowexception::cloneSet(c_overflowexception *clone) { + c_runtimeexception::cloneSet(clone); +} +Variant c_overflowexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke(s, params, hash, fatal); +} +Variant c_overflowexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_overflowexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_runtimeexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_overflowexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_overflowexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_runtimeexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_overflowexception$os_get(const char *s) { + return c_overflowexception::os_get(s, -1); +} +Variant &cw_overflowexception$os_lval(const char *s) { + return c_overflowexception::os_lval(s, -1); +} +Variant cw_overflowexception$os_constant(const char *s) { + return c_overflowexception::os_constant(s); +} +Variant cw_overflowexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_overflowexception::os_invoke(c, s, params, -1, fatal); +} +void c_overflowexception::init() { + c_runtimeexception::init(); +} +/* SRC: classes/exception.php line 75 */ +Variant c_outofboundsexception::os_get(const char *s, int64 hash) { + return c_runtimeexception::os_get(s, hash); +} +Variant &c_outofboundsexception::os_lval(const char *s, int64 hash) { + return c_runtimeexception::os_lval(s, hash); +} +void c_outofboundsexception::o_get(ArrayElementVec &props) const { + c_runtimeexception::o_get(props); +} +bool c_outofboundsexception::o_exists(CStrRef s, int64 hash) const { + return c_runtimeexception::o_exists(s, hash); +} +Variant c_outofboundsexception::o_get(CStrRef s, int64 hash) { + return c_runtimeexception::o_get(s, hash); +} +Variant c_outofboundsexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_runtimeexception::o_set(s, hash, v, forInit); +} +Variant &c_outofboundsexception::o_lval(CStrRef s, int64 hash) { + return c_runtimeexception::o_lval(s, hash); +} +Variant c_outofboundsexception::os_constant(const char *s) { + return c_runtimeexception::os_constant(s); +} +IMPLEMENT_CLASS(outofboundsexception) +ObjectData *c_outofboundsexception::cloneImpl() { + c_outofboundsexception *obj = NEW(c_outofboundsexception)(); + cloneSet(obj); + return obj; +} +void c_outofboundsexception::cloneSet(c_outofboundsexception *clone) { + c_runtimeexception::cloneSet(clone); +} +Variant c_outofboundsexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke(s, params, hash, fatal); +} +Variant c_outofboundsexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_outofboundsexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_runtimeexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_outofboundsexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_outofboundsexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_runtimeexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_outofboundsexception$os_get(const char *s) { + return c_outofboundsexception::os_get(s, -1); +} +Variant &cw_outofboundsexception$os_lval(const char *s) { + return c_outofboundsexception::os_lval(s, -1); +} +Variant cw_outofboundsexception$os_constant(const char *s) { + return c_outofboundsexception::os_constant(s); +} +Variant cw_outofboundsexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_outofboundsexception::os_invoke(c, s, params, -1, fatal); +} +void c_outofboundsexception::init() { + c_runtimeexception::init(); +} +/* SRC: classes/exception.php line 67 */ +Variant c_logicexception::os_get(const char *s, int64 hash) { + return c_exception::os_get(s, hash); +} +Variant &c_logicexception::os_lval(const char *s, int64 hash) { + return c_exception::os_lval(s, hash); +} +void c_logicexception::o_get(ArrayElementVec &props) const { + c_exception::o_get(props); +} +bool c_logicexception::o_exists(CStrRef s, int64 hash) const { + return c_exception::o_exists(s, hash); +} +Variant c_logicexception::o_get(CStrRef s, int64 hash) { + return c_exception::o_get(s, hash); +} +Variant c_logicexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_exception::o_set(s, hash, v, forInit); +} +Variant &c_logicexception::o_lval(CStrRef s, int64 hash) { + return c_exception::o_lval(s, hash); +} +Variant c_logicexception::os_constant(const char *s) { + return c_exception::os_constant(s); +} +IMPLEMENT_CLASS(logicexception) +ObjectData *c_logicexception::cloneImpl() { + c_logicexception *obj = NEW(c_logicexception)(); + cloneSet(obj); + return obj; +} +void c_logicexception::cloneSet(c_logicexception *clone) { + c_exception::cloneSet(clone); +} +Variant c_logicexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_exception::o_invoke(s, params, hash, fatal); +} +Variant c_logicexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_exception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_logicexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_exception::os_invoke(c, s, params, hash, fatal); +} +Variant c_logicexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_exception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_logicexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_exception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_logicexception$os_get(const char *s) { + return c_logicexception::os_get(s, -1); +} +Variant &cw_logicexception$os_lval(const char *s) { + return c_logicexception::os_lval(s, -1); +} +Variant cw_logicexception$os_constant(const char *s) { + return c_logicexception::os_constant(s); +} +Variant cw_logicexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_logicexception::os_invoke(c, s, params, -1, fatal); +} +void c_logicexception::init() { + c_exception::init(); +} +/* SRC: classes/exception.php line 77 */ +Variant c_rangeexception::os_get(const char *s, int64 hash) { + return c_runtimeexception::os_get(s, hash); +} +Variant &c_rangeexception::os_lval(const char *s, int64 hash) { + return c_runtimeexception::os_lval(s, hash); +} +void c_rangeexception::o_get(ArrayElementVec &props) const { + c_runtimeexception::o_get(props); +} +bool c_rangeexception::o_exists(CStrRef s, int64 hash) const { + return c_runtimeexception::o_exists(s, hash); +} +Variant c_rangeexception::o_get(CStrRef s, int64 hash) { + return c_runtimeexception::o_get(s, hash); +} +Variant c_rangeexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_runtimeexception::o_set(s, hash, v, forInit); +} +Variant &c_rangeexception::o_lval(CStrRef s, int64 hash) { + return c_runtimeexception::o_lval(s, hash); +} +Variant c_rangeexception::os_constant(const char *s) { + return c_runtimeexception::os_constant(s); +} +IMPLEMENT_CLASS(rangeexception) +ObjectData *c_rangeexception::cloneImpl() { + c_rangeexception *obj = NEW(c_rangeexception)(); + cloneSet(obj); + return obj; +} +void c_rangeexception::cloneSet(c_rangeexception *clone) { + c_runtimeexception::cloneSet(clone); +} +Variant c_rangeexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke(s, params, hash, fatal); +} +Variant c_rangeexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_rangeexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_runtimeexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_rangeexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_rangeexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_runtimeexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_rangeexception$os_get(const char *s) { + return c_rangeexception::os_get(s, -1); +} +Variant &cw_rangeexception$os_lval(const char *s) { + return c_rangeexception::os_lval(s, -1); +} +Variant cw_rangeexception$os_constant(const char *s) { + return c_rangeexception::os_constant(s); +} +Variant cw_rangeexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_rangeexception::os_invoke(c, s, params, -1, fatal); +} +void c_rangeexception::init() { + c_runtimeexception::init(); +} +/* SRC: classes/exception.php line 71 */ +Variant c_invalidargumentexception::os_get(const char *s, int64 hash) { + return c_logicexception::os_get(s, hash); +} +Variant &c_invalidargumentexception::os_lval(const char *s, int64 hash) { + return c_logicexception::os_lval(s, hash); +} +void c_invalidargumentexception::o_get(ArrayElementVec &props) const { + c_logicexception::o_get(props); +} +bool c_invalidargumentexception::o_exists(CStrRef s, int64 hash) const { + return c_logicexception::o_exists(s, hash); +} +Variant c_invalidargumentexception::o_get(CStrRef s, int64 hash) { + return c_logicexception::o_get(s, hash); +} +Variant c_invalidargumentexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_logicexception::o_set(s, hash, v, forInit); +} +Variant &c_invalidargumentexception::o_lval(CStrRef s, int64 hash) { + return c_logicexception::o_lval(s, hash); +} +Variant c_invalidargumentexception::os_constant(const char *s) { + return c_logicexception::os_constant(s); +} +IMPLEMENT_CLASS(invalidargumentexception) +ObjectData *c_invalidargumentexception::cloneImpl() { + c_invalidargumentexception *obj = NEW(c_invalidargumentexception)(); + cloneSet(obj); + return obj; +} +void c_invalidargumentexception::cloneSet(c_invalidargumentexception *clone) { + c_logicexception::cloneSet(clone); +} +Variant c_invalidargumentexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke(s, params, hash, fatal); +} +Variant c_invalidargumentexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_invalidargumentexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_logicexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_invalidargumentexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_invalidargumentexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_logicexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_invalidargumentexception$os_get(const char *s) { + return c_invalidargumentexception::os_get(s, -1); +} +Variant &cw_invalidargumentexception$os_lval(const char *s) { + return c_invalidargumentexception::os_lval(s, -1); +} +Variant cw_invalidargumentexception$os_constant(const char *s) { + return c_invalidargumentexception::os_constant(s); +} +Variant cw_invalidargumentexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_invalidargumentexception::os_invoke(c, s, params, -1, fatal); +} +void c_invalidargumentexception::init() { + c_logicexception::init(); +} +/* SRC: classes/exception.php line 78 */ +Variant c_underflowexception::os_get(const char *s, int64 hash) { + return c_runtimeexception::os_get(s, hash); +} +Variant &c_underflowexception::os_lval(const char *s, int64 hash) { + return c_runtimeexception::os_lval(s, hash); +} +void c_underflowexception::o_get(ArrayElementVec &props) const { + c_runtimeexception::o_get(props); +} +bool c_underflowexception::o_exists(CStrRef s, int64 hash) const { + return c_runtimeexception::o_exists(s, hash); +} +Variant c_underflowexception::o_get(CStrRef s, int64 hash) { + return c_runtimeexception::o_get(s, hash); +} +Variant c_underflowexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_runtimeexception::o_set(s, hash, v, forInit); +} +Variant &c_underflowexception::o_lval(CStrRef s, int64 hash) { + return c_runtimeexception::o_lval(s, hash); +} +Variant c_underflowexception::os_constant(const char *s) { + return c_runtimeexception::os_constant(s); +} +IMPLEMENT_CLASS(underflowexception) +ObjectData *c_underflowexception::cloneImpl() { + c_underflowexception *obj = NEW(c_underflowexception)(); + cloneSet(obj); + return obj; +} +void c_underflowexception::cloneSet(c_underflowexception *clone) { + c_runtimeexception::cloneSet(clone); +} +Variant c_underflowexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke(s, params, hash, fatal); +} +Variant c_underflowexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_underflowexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_runtimeexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_underflowexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_runtimeexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_underflowexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_runtimeexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_underflowexception$os_get(const char *s) { + return c_underflowexception::os_get(s, -1); +} +Variant &cw_underflowexception$os_lval(const char *s) { + return c_underflowexception::os_lval(s, -1); +} +Variant cw_underflowexception$os_constant(const char *s) { + return c_underflowexception::os_constant(s); +} +Variant cw_underflowexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_underflowexception::os_invoke(c, s, params, -1, fatal); +} +void c_underflowexception::init() { + c_runtimeexception::init(); +} +/* SRC: classes/exception.php line 73 */ +Variant c_outofrangeexception::os_get(const char *s, int64 hash) { + return c_logicexception::os_get(s, hash); +} +Variant &c_outofrangeexception::os_lval(const char *s, int64 hash) { + return c_logicexception::os_lval(s, hash); +} +void c_outofrangeexception::o_get(ArrayElementVec &props) const { + c_logicexception::o_get(props); +} +bool c_outofrangeexception::o_exists(CStrRef s, int64 hash) const { + return c_logicexception::o_exists(s, hash); +} +Variant c_outofrangeexception::o_get(CStrRef s, int64 hash) { + return c_logicexception::o_get(s, hash); +} +Variant c_outofrangeexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_logicexception::o_set(s, hash, v, forInit); +} +Variant &c_outofrangeexception::o_lval(CStrRef s, int64 hash) { + return c_logicexception::o_lval(s, hash); +} +Variant c_outofrangeexception::os_constant(const char *s) { + return c_logicexception::os_constant(s); +} +IMPLEMENT_CLASS(outofrangeexception) +ObjectData *c_outofrangeexception::cloneImpl() { + c_outofrangeexception *obj = NEW(c_outofrangeexception)(); + cloneSet(obj); + return obj; +} +void c_outofrangeexception::cloneSet(c_outofrangeexception *clone) { + c_logicexception::cloneSet(clone); +} +Variant c_outofrangeexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke(s, params, hash, fatal); +} +Variant c_outofrangeexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_outofrangeexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_logicexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_outofrangeexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_outofrangeexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_logicexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_outofrangeexception$os_get(const char *s) { + return c_outofrangeexception::os_get(s, -1); +} +Variant &cw_outofrangeexception$os_lval(const char *s) { + return c_outofrangeexception::os_lval(s, -1); +} +Variant cw_outofrangeexception$os_constant(const char *s) { + return c_outofrangeexception::os_constant(s); +} +Variant cw_outofrangeexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_outofrangeexception::os_invoke(c, s, params, -1, fatal); +} +void c_outofrangeexception::init() { + c_logicexception::init(); +} +/* SRC: classes/exception.php line 69 */ +Variant c_badmethodcallexception::os_get(const char *s, int64 hash) { + return c_badfunctioncallexception::os_get(s, hash); +} +Variant &c_badmethodcallexception::os_lval(const char *s, int64 hash) { + return c_badfunctioncallexception::os_lval(s, hash); +} +void c_badmethodcallexception::o_get(ArrayElementVec &props) const { + c_badfunctioncallexception::o_get(props); +} +bool c_badmethodcallexception::o_exists(CStrRef s, int64 hash) const { + return c_badfunctioncallexception::o_exists(s, hash); +} +Variant c_badmethodcallexception::o_get(CStrRef s, int64 hash) { + return c_badfunctioncallexception::o_get(s, hash); +} +Variant c_badmethodcallexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_badfunctioncallexception::o_set(s, hash, v, forInit); +} +Variant &c_badmethodcallexception::o_lval(CStrRef s, int64 hash) { + return c_badfunctioncallexception::o_lval(s, hash); +} +Variant c_badmethodcallexception::os_constant(const char *s) { + return c_badfunctioncallexception::os_constant(s); +} +IMPLEMENT_CLASS(badmethodcallexception) +ObjectData *c_badmethodcallexception::cloneImpl() { + c_badmethodcallexception *obj = NEW(c_badmethodcallexception)(); + cloneSet(obj); + return obj; +} +void c_badmethodcallexception::cloneSet(c_badmethodcallexception *clone) { + c_badfunctioncallexception::cloneSet(clone); +} +Variant c_badmethodcallexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_badfunctioncallexception::o_invoke(s, params, hash, fatal); +} +Variant c_badmethodcallexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_badfunctioncallexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_badmethodcallexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_badfunctioncallexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_badmethodcallexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_badfunctioncallexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_badmethodcallexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_badfunctioncallexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_badmethodcallexception$os_get(const char *s) { + return c_badmethodcallexception::os_get(s, -1); +} +Variant &cw_badmethodcallexception$os_lval(const char *s) { + return c_badmethodcallexception::os_lval(s, -1); +} +Variant cw_badmethodcallexception$os_constant(const char *s) { + return c_badmethodcallexception::os_constant(s); +} +Variant cw_badmethodcallexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_badmethodcallexception::os_invoke(c, s, params, -1, fatal); +} +void c_badmethodcallexception::init() { + c_badfunctioncallexception::init(); +} +/* SRC: classes/exception.php line 74 */ +Variant c_runtimeexception::os_get(const char *s, int64 hash) { + return c_exception::os_get(s, hash); +} +Variant &c_runtimeexception::os_lval(const char *s, int64 hash) { + return c_exception::os_lval(s, hash); +} +void c_runtimeexception::o_get(ArrayElementVec &props) const { + c_exception::o_get(props); +} +bool c_runtimeexception::o_exists(CStrRef s, int64 hash) const { + return c_exception::o_exists(s, hash); +} +Variant c_runtimeexception::o_get(CStrRef s, int64 hash) { + return c_exception::o_get(s, hash); +} +Variant c_runtimeexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_exception::o_set(s, hash, v, forInit); +} +Variant &c_runtimeexception::o_lval(CStrRef s, int64 hash) { + return c_exception::o_lval(s, hash); +} +Variant c_runtimeexception::os_constant(const char *s) { + return c_exception::os_constant(s); +} +IMPLEMENT_CLASS(runtimeexception) +ObjectData *c_runtimeexception::cloneImpl() { + c_runtimeexception *obj = NEW(c_runtimeexception)(); + cloneSet(obj); + return obj; +} +void c_runtimeexception::cloneSet(c_runtimeexception *clone) { + c_exception::cloneSet(clone); +} +Variant c_runtimeexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_exception::o_invoke(s, params, hash, fatal); +} +Variant c_runtimeexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_exception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_runtimeexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_exception::os_invoke(c, s, params, hash, fatal); +} +Variant c_runtimeexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_exception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_runtimeexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_exception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_runtimeexception$os_get(const char *s) { + return c_runtimeexception::os_get(s, -1); +} +Variant &cw_runtimeexception$os_lval(const char *s) { + return c_runtimeexception::os_lval(s, -1); +} +Variant cw_runtimeexception$os_constant(const char *s) { + return c_runtimeexception::os_constant(s); +} +Variant cw_runtimeexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_runtimeexception::os_invoke(c, s, params, -1, fatal); +} +void c_runtimeexception::init() { + c_exception::init(); +} +/* SRC: classes/exception.php line 3 */ +Variant c_exception::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_exception::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_exception::o_get(ArrayElementVec &props) const { + props.push_back(NEW(ArrayElement)("message", m_message.isReferenced() ? ref(m_message) : m_message)); + props.push_back(NEW(ArrayElement)("code", m_code.isReferenced() ? ref(m_code) : m_code)); + props.push_back(NEW(ArrayElement)("file", m_file.isReferenced() ? ref(m_file) : m_file)); + props.push_back(NEW(ArrayElement)("line", m_line.isReferenced() ? ref(m_line) : m_line)); + c_ObjectData::o_get(props); +} +bool c_exception::o_exists(CStrRef s, int64 hash) const { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 7) { + case 3: + HASH_EXISTS_STRING(0x612E37678CE7DB5BLL, file, 4); + break; + case 4: + HASH_EXISTS_STRING(0x5B2CD7DDAB7A1DECLL, code, 4); + HASH_EXISTS_STRING(0x21093C71DDF8728CLL, line, 4); + break; + case 7: + HASH_EXISTS_STRING(0x3EAA4B97155366DFLL, message, 7); + break; + default: + break; + } + return c_ObjectData::o_exists(s, hash); +} +Variant c_exception::o_get(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 7) { + case 3: + HASH_RETURN_STRING(0x612E37678CE7DB5BLL, m_file, + file, 4); + break; + case 4: + HASH_RETURN_STRING(0x5B2CD7DDAB7A1DECLL, m_code, + code, 4); + HASH_RETURN_STRING(0x21093C71DDF8728CLL, m_line, + line, 4); + break; + case 7: + HASH_RETURN_STRING(0x3EAA4B97155366DFLL, m_message, + message, 7); + break; + default: + break; + } + return c_ObjectData::o_get(s, hash); +} +Variant c_exception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 7) { + case 3: + HASH_SET_STRING(0x612E37678CE7DB5BLL, m_file, + file, 4); + break; + case 4: + HASH_SET_STRING(0x5B2CD7DDAB7A1DECLL, m_code, + code, 4); + HASH_SET_STRING(0x21093C71DDF8728CLL, m_line, + line, 4); + break; + case 7: + HASH_SET_STRING(0x3EAA4B97155366DFLL, m_message, + message, 7); + break; + default: + break; + } + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_exception::o_lval(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 7) { + case 3: + HASH_RETURN_STRING(0x612E37678CE7DB5BLL, m_file, + file, 4); + break; + case 4: + HASH_RETURN_STRING(0x5B2CD7DDAB7A1DECLL, m_code, + code, 4); + HASH_RETURN_STRING(0x21093C71DDF8728CLL, m_line, + line, 4); + break; + case 7: + HASH_RETURN_STRING(0x3EAA4B97155366DFLL, m_message, + message, 7); + break; + default: + break; + } + return c_ObjectData::o_lval(s, hash); +} +Variant c_exception::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(exception) +ObjectData *c_exception::create(Variant v_message /* = "" */, Variant v_code /* = 0LL */) { + init(); + t___construct(v_message, v_code); + return this; +} +ObjectData *c_exception::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 0) return (create()); + if (count == 1) return (create(params.rvalAt(0))); + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_exception::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 0) (t___construct()); + if (count == 1) (t___construct(params.rvalAt(0))); + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +ObjectData *c_exception::cloneImpl() { + c_exception *obj = NEW(c_exception)(); + cloneSet(obj); + return obj; +} +void c_exception::cloneSet(c_exception *clone) { + clone->m_message = m_message.isReferenced() ? ref(m_message) : m_message; + clone->m_code = m_code.isReferenced() ? ref(m_code) : m_code; + clone->m_file = m_file.isReferenced() ? ref(m_file) : m_file; + clone->m_line = m_line.isReferenced() ? ref(m_line) : m_line; + ObjectData::cloneSet(clone); +} +Variant c_exception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_exception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_exception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_exception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_exception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_exception$os_get(const char *s) { + return c_exception::os_get(s, -1); +} +Variant &cw_exception$os_lval(const char *s) { + return c_exception::os_lval(s, -1); +} +Variant cw_exception$os_constant(const char *s) { + return c_exception::os_constant(s); +} +Variant cw_exception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_exception::os_invoke(c, s, params, -1, fatal); +} +void c_exception::init() { + m_message = "Unknown exception"; + m_code = 0LL; +} +/* SRC: classes/exception.php line 9 */ +void c_exception::t___construct(Variant v_message /* = "" */, Variant v_code /* = 0LL */) { + INSTANCE_METHOD_INJECTION(Exception, Exception::__construct); + bool oldInCtor = gasInCtor(true); + Variant v_frame; + + m_message = v_message; + m_code = v_code; + o_lval("trace", 0x0253015494C9CE77LL) = x_debug_backtrace(); + v_frame = x_array_shift(ref(lval(o_lval("trace", 0x0253015494C9CE77LL)))); + m_file = v_frame.rvalAt("file", 0x612E37678CE7DB5BLL); + m_line = v_frame.rvalAt("line", 0x21093C71DDF8728CLL); + gasInCtor(oldInCtor); +} /* function */ +/* SRC: classes/exception.php line 19 */ +Variant c_exception::t_getmessage() { + INSTANCE_METHOD_INJECTION(Exception, Exception::getMessage); + return m_message; +} /* function */ +/* SRC: classes/exception.php line 24 */ +Variant c_exception::t_getcode() { + INSTANCE_METHOD_INJECTION(Exception, Exception::getCode); + return m_code; +} /* function */ +/* SRC: classes/exception.php line 29 */ +Variant c_exception::t_getfile() { + INSTANCE_METHOD_INJECTION(Exception, Exception::getFile); + return m_file; +} /* function */ +/* SRC: classes/exception.php line 34 */ +Variant c_exception::t_getline() { + INSTANCE_METHOD_INJECTION(Exception, Exception::getLine); + return m_line; +} /* function */ +/* SRC: classes/exception.php line 39 */ +Variant c_exception::t_gettrace() { + INSTANCE_METHOD_INJECTION(Exception, Exception::getTrace); + return o_get("trace", 0x0253015494C9CE77LL); +} /* function */ +/* SRC: classes/exception.php line 44 */ +String c_exception::t_gettraceasstring() { + INSTANCE_METHOD_INJECTION(Exception, Exception::getTraceAsString); + int64 v_i = 0; + String v_s; + Variant v_frame; + + v_i = 0LL; + v_s = ""; + { + LOOP_COUNTER(1); + Variant map2 = t_gettrace(); + for (ArrayIterPtr iter3 = map2.begin("exception"); !iter3->end(); iter3->next()) { + LOOP_COUNTER_CHECK(1); + v_frame = iter3->second(); + { + if (!(x_is_array(v_frame))) continue; + concat_assign(v_s, concat_rev(concat6("(", toString(v_frame.rvalAt("line", 0x21093C71DDF8728CLL)), "): ", (toString(isset(v_frame, "class", 0x45397FE5C82DBD12LL) ? ((Variant)(concat(toString(v_frame.rvalAt("class", 0x45397FE5C82DBD12LL)), toString(v_frame.rvalAt("type", 0x508FC7C8724A760ALL))))) : ((Variant)("")))), toString(v_frame.rvalAt("function", 0x736D912A52403931LL)), "()\n"), concat4("#", toString(v_i), " ", toString(v_frame.rvalAt("file", 0x612E37678CE7DB5BLL))))); + v_i++; + } + } + } + concat_assign(v_s, concat3("#", toString(v_i), " {main}")); + return v_s; +} /* function */ +/* SRC: classes/exception.php line 62 */ +String c_exception::t___tostring() { + INSTANCE_METHOD_INJECTION(Exception, Exception::__toString); + return toString(t_getmessage()); +} /* function */ +/* SRC: classes/exception.php line 68 */ +Variant c_badfunctioncallexception::os_get(const char *s, int64 hash) { + return c_logicexception::os_get(s, hash); +} +Variant &c_badfunctioncallexception::os_lval(const char *s, int64 hash) { + return c_logicexception::os_lval(s, hash); +} +void c_badfunctioncallexception::o_get(ArrayElementVec &props) const { + c_logicexception::o_get(props); +} +bool c_badfunctioncallexception::o_exists(CStrRef s, int64 hash) const { + return c_logicexception::o_exists(s, hash); +} +Variant c_badfunctioncallexception::o_get(CStrRef s, int64 hash) { + return c_logicexception::o_get(s, hash); +} +Variant c_badfunctioncallexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_logicexception::o_set(s, hash, v, forInit); +} +Variant &c_badfunctioncallexception::o_lval(CStrRef s, int64 hash) { + return c_logicexception::o_lval(s, hash); +} +Variant c_badfunctioncallexception::os_constant(const char *s) { + return c_logicexception::os_constant(s); +} +IMPLEMENT_CLASS(badfunctioncallexception) +ObjectData *c_badfunctioncallexception::cloneImpl() { + c_badfunctioncallexception *obj = NEW(c_badfunctioncallexception)(); + cloneSet(obj); + return obj; +} +void c_badfunctioncallexception::cloneSet(c_badfunctioncallexception *clone) { + c_logicexception::cloneSet(clone); +} +Variant c_badfunctioncallexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke(s, params, hash, fatal); +} +Variant c_badfunctioncallexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_badfunctioncallexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_logicexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_badfunctioncallexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_badfunctioncallexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_logicexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_badfunctioncallexception$os_get(const char *s) { + return c_badfunctioncallexception::os_get(s, -1); +} +Variant &cw_badfunctioncallexception$os_lval(const char *s) { + return c_badfunctioncallexception::os_lval(s, -1); +} +Variant cw_badfunctioncallexception$os_constant(const char *s) { + return c_badfunctioncallexception::os_constant(s); +} +Variant cw_badfunctioncallexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_badfunctioncallexception::os_invoke(c, s, params, -1, fatal); +} +void c_badfunctioncallexception::init() { + c_logicexception::init(); +} +/* SRC: classes/exception.php line 72 */ +Variant c_lengthexception::os_get(const char *s, int64 hash) { + return c_logicexception::os_get(s, hash); +} +Variant &c_lengthexception::os_lval(const char *s, int64 hash) { + return c_logicexception::os_lval(s, hash); +} +void c_lengthexception::o_get(ArrayElementVec &props) const { + c_logicexception::o_get(props); +} +bool c_lengthexception::o_exists(CStrRef s, int64 hash) const { + return c_logicexception::o_exists(s, hash); +} +Variant c_lengthexception::o_get(CStrRef s, int64 hash) { + return c_logicexception::o_get(s, hash); +} +Variant c_lengthexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_logicexception::o_set(s, hash, v, forInit); +} +Variant &c_lengthexception::o_lval(CStrRef s, int64 hash) { + return c_logicexception::o_lval(s, hash); +} +Variant c_lengthexception::os_constant(const char *s) { + return c_logicexception::os_constant(s); +} +IMPLEMENT_CLASS(lengthexception) +ObjectData *c_lengthexception::cloneImpl() { + c_lengthexception *obj = NEW(c_lengthexception)(); + cloneSet(obj); + return obj; +} +void c_lengthexception::cloneSet(c_lengthexception *clone) { + c_logicexception::cloneSet(clone); +} +Variant c_lengthexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke(s, params, hash, fatal); +} +Variant c_lengthexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_lengthexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_logicexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_lengthexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_lengthexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_logicexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_lengthexception$os_get(const char *s) { + return c_lengthexception::os_get(s, -1); +} +Variant &cw_lengthexception$os_lval(const char *s) { + return c_lengthexception::os_lval(s, -1); +} +Variant cw_lengthexception$os_constant(const char *s) { + return c_lengthexception::os_constant(s); +} +Variant cw_lengthexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_lengthexception::os_invoke(c, s, params, -1, fatal); +} +void c_lengthexception::init() { + c_logicexception::init(); +} +/* SRC: classes/exception.php line 70 */ +Variant c_domainexception::os_get(const char *s, int64 hash) { + return c_logicexception::os_get(s, hash); +} +Variant &c_domainexception::os_lval(const char *s, int64 hash) { + return c_logicexception::os_lval(s, hash); +} +void c_domainexception::o_get(ArrayElementVec &props) const { + c_logicexception::o_get(props); +} +bool c_domainexception::o_exists(CStrRef s, int64 hash) const { + return c_logicexception::o_exists(s, hash); +} +Variant c_domainexception::o_get(CStrRef s, int64 hash) { + return c_logicexception::o_get(s, hash); +} +Variant c_domainexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_logicexception::o_set(s, hash, v, forInit); +} +Variant &c_domainexception::o_lval(CStrRef s, int64 hash) { + return c_logicexception::o_lval(s, hash); +} +Variant c_domainexception::os_constant(const char *s) { + return c_logicexception::os_constant(s); +} +IMPLEMENT_CLASS(domainexception) +ObjectData *c_domainexception::cloneImpl() { + c_domainexception *obj = NEW(c_domainexception)(); + cloneSet(obj); + return obj; +} +void c_domainexception::cloneSet(c_domainexception *clone) { + c_logicexception::cloneSet(clone); +} +Variant c_domainexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke(s, params, hash, fatal); +} +Variant c_domainexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domainexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_logicexception::os_invoke(c, s, params, hash, fatal); +} +Variant c_domainexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_logicexception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domainexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_logicexception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domainexception$os_get(const char *s) { + return c_domainexception::os_get(s, -1); +} +Variant &cw_domainexception$os_lval(const char *s) { + return c_domainexception::os_lval(s, -1); +} +Variant cw_domainexception$os_constant(const char *s) { + return c_domainexception::os_constant(s); +} +Variant cw_domainexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domainexception::os_invoke(c, s, params, -1, fatal); +} +void c_domainexception::init() { + c_logicexception::init(); +} +Object co_unexpectedvalueexception(CArrRef params, bool init /* = true */) { + return Object(p_unexpectedvalueexception(NEW(c_unexpectedvalueexception)())->dynCreate(params, init)); +} +Object co_overflowexception(CArrRef params, bool init /* = true */) { + return Object(p_overflowexception(NEW(c_overflowexception)())->dynCreate(params, init)); +} +Object co_outofboundsexception(CArrRef params, bool init /* = true */) { + return Object(p_outofboundsexception(NEW(c_outofboundsexception)())->dynCreate(params, init)); +} +Object co_logicexception(CArrRef params, bool init /* = true */) { + return Object(p_logicexception(NEW(c_logicexception)())->dynCreate(params, init)); +} +Object co_rangeexception(CArrRef params, bool init /* = true */) { + return Object(p_rangeexception(NEW(c_rangeexception)())->dynCreate(params, init)); +} +Object co_invalidargumentexception(CArrRef params, bool init /* = true */) { + return Object(p_invalidargumentexception(NEW(c_invalidargumentexception)())->dynCreate(params, init)); +} +Object co_underflowexception(CArrRef params, bool init /* = true */) { + return Object(p_underflowexception(NEW(c_underflowexception)())->dynCreate(params, init)); +} +Object co_outofrangeexception(CArrRef params, bool init /* = true */) { + return Object(p_outofrangeexception(NEW(c_outofrangeexception)())->dynCreate(params, init)); +} +Object co_badmethodcallexception(CArrRef params, bool init /* = true */) { + return Object(p_badmethodcallexception(NEW(c_badmethodcallexception)())->dynCreate(params, init)); +} +Object co_runtimeexception(CArrRef params, bool init /* = true */) { + return Object(p_runtimeexception(NEW(c_runtimeexception)())->dynCreate(params, init)); +} +Object co_exception(CArrRef params, bool init /* = true */) { + return Object(p_exception(NEW(c_exception)())->dynCreate(params, init)); +} +Object co_badfunctioncallexception(CArrRef params, bool init /* = true */) { + return Object(p_badfunctioncallexception(NEW(c_badfunctioncallexception)())->dynCreate(params, init)); +} +Object co_lengthexception(CArrRef params, bool init /* = true */) { + return Object(p_lengthexception(NEW(c_lengthexception)())->dynCreate(params, init)); +} +Object co_domainexception(CArrRef params, bool init /* = true */) { + return Object(p_domainexception(NEW(c_domainexception)())->dynCreate(params, init)); +} +Variant pm_php$classes$exception_php(bool incOnce /* = false */, LVariableTable* variables /* = NULL */) { + FUNCTION_INJECTION(run_init::classes/exception.php); + { + DECLARE_SYSTEM_GLOBALS(g); + bool &alreadyRun = g->run_pm_php$classes$exception_php; + if (alreadyRun) { if (incOnce) return true;} + else alreadyRun = true; + if (!variables) variables = g; + } + DECLARE_SYSTEM_GLOBALS(g); + LVariableTable *gVariables __attribute__((__unused__)) = get_variable_table(); + return true; +} /* function */ + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/php/classes/exception.fw.h b/src/lib/system/gen/php/classes/exception.fw.h new file mode 100644 index 0000000000000..02edaf81a792f --- /dev/null +++ b/src/lib/system/gen/php/classes/exception.fw.h @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_EXCEPTION_FW_H__ +#define __GENERATED_PHP_CLASSES_EXCEPTION_FW_H__ + +#include + +// Forward Declarations + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// 1. Constants + +// 2. Classes +FORWARD_DECLARE_CLASS(unexpectedvalueexception) +FORWARD_DECLARE_CLASS(overflowexception) +FORWARD_DECLARE_CLASS(outofboundsexception) +FORWARD_DECLARE_CLASS(logicexception) +FORWARD_DECLARE_CLASS(rangeexception) +FORWARD_DECLARE_CLASS(invalidargumentexception) +FORWARD_DECLARE_CLASS(underflowexception) +FORWARD_DECLARE_CLASS(outofrangeexception) +FORWARD_DECLARE_CLASS(badmethodcallexception) +FORWARD_DECLARE_CLASS(runtimeexception) +FORWARD_DECLARE_CLASS(exception) +FORWARD_DECLARE_CLASS(badfunctioncallexception) +FORWARD_DECLARE_CLASS(lengthexception) +FORWARD_DECLARE_CLASS(domainexception) + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_CLASSES_EXCEPTION_FW_H__ diff --git a/src/lib/system/gen/php/classes/exception.h b/src/lib/system/gen/php/classes/exception.h new file mode 100644 index 0000000000000..32b8ee1548816 --- /dev/null +++ b/src/lib/system/gen/php/classes/exception.h @@ -0,0 +1,61 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_EXCEPTION_H__ +#define __GENERATED_PHP_CLASSES_EXCEPTION_H__ + +#include +#include + +// Declarations +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant pm_php$classes$exception_php(bool incOnce = false, LVariableTable* variables = NULL); +Object co_unexpectedvalueexception(CArrRef params, bool init = true); +Object co_overflowexception(CArrRef params, bool init = true); +Object co_outofboundsexception(CArrRef params, bool init = true); +Object co_logicexception(CArrRef params, bool init = true); +Object co_rangeexception(CArrRef params, bool init = true); +Object co_invalidargumentexception(CArrRef params, bool init = true); +Object co_underflowexception(CArrRef params, bool init = true); +Object co_outofrangeexception(CArrRef params, bool init = true); +Object co_badmethodcallexception(CArrRef params, bool init = true); +Object co_runtimeexception(CArrRef params, bool init = true); +Object co_exception(CArrRef params, bool init = true); +Object co_badfunctioncallexception(CArrRef params, bool init = true); +Object co_lengthexception(CArrRef params, bool init = true); +Object co_domainexception(CArrRef params, bool init = true); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_CLASSES_EXCEPTION_H__ diff --git a/src/lib/system/gen/php/classes/iterator.cpp b/src/lib/system/gen/php/classes/iterator.cpp new file mode 100644 index 0000000000000..a218ee21a59ca --- /dev/null +++ b/src/lib/system/gen/php/classes/iterator.cpp @@ -0,0 +1,842 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* preface starts */ +/* preface finishes */ +/* SRC: classes/iterator.php line 31 */ +Variant c_arrayiterator::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_arrayiterator::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_arrayiterator::o_get(ArrayElementVec &props) const { + props.push_back(NEW(ArrayElement)("arr", m_arr.isReferenced() ? ref(m_arr) : m_arr)); + props.push_back(NEW(ArrayElement)("flags", m_flags.isReferenced() ? ref(m_flags) : m_flags)); + c_ObjectData::o_get(props); +} +bool c_arrayiterator::o_exists(CStrRef s, int64 hash) const { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_EXISTS_STRING(0x1776D8467CB08D68LL, arr, 3); + break; + case 1: + HASH_EXISTS_STRING(0x6AFDA85728FAE70DLL, flags, 5); + break; + default: + break; + } + return c_ObjectData::o_exists(s, hash); +} +Variant c_arrayiterator::o_get(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_RETURN_STRING(0x1776D8467CB08D68LL, m_arr, + arr, 3); + break; + case 1: + HASH_RETURN_STRING(0x6AFDA85728FAE70DLL, m_flags, + flags, 5); + break; + default: + break; + } + return c_ObjectData::o_get(s, hash); +} +Variant c_arrayiterator::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_SET_STRING(0x1776D8467CB08D68LL, m_arr, + arr, 3); + break; + case 1: + HASH_SET_STRING(0x6AFDA85728FAE70DLL, m_flags, + flags, 5); + break; + default: + break; + } + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_arrayiterator::o_lval(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_RETURN_STRING(0x1776D8467CB08D68LL, m_arr, + arr, 3); + break; + case 1: + HASH_RETURN_STRING(0x6AFDA85728FAE70DLL, m_flags, + flags, 5); + break; + default: + break; + } + return c_ObjectData::o_lval(s, hash); +} +Variant c_arrayiterator::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(arrayiterator) +ObjectData *c_arrayiterator::create(Variant v_array, Variant v_flags /* = 0LL (SORT_REGULAR) */) { + init(); + t___construct(v_array, v_flags); + return this; +} +ObjectData *c_arrayiterator::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 1) return (create(params.rvalAt(0))); + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_arrayiterator::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 1) (t___construct(params.rvalAt(0))); + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +ObjectData *c_arrayiterator::cloneImpl() { + c_arrayiterator *obj = NEW(c_arrayiterator)(); + cloneSet(obj); + return obj; +} +void c_arrayiterator::cloneSet(c_arrayiterator *clone) { + clone->m_arr = m_arr.isReferenced() ? ref(m_arr) : m_arr; + clone->m_flags = m_flags.isReferenced() ? ref(m_flags) : m_flags; + ObjectData::cloneSet(clone); +} +Variant c_arrayiterator::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 0: + HASH_GUARD(0x3E6BCFB9742FC700LL, offsetexists) { + return (t_offsetexists(params.rvalAt(0))); + } + break; + case 2: + HASH_GUARD(0x4DEE4A472DC69EC2LL, append) { + return (t_append(params.rvalAt(0)), null); + } + break; + case 4: + HASH_GUARD(0x6413CB5154808C44LL, valid) { + return (t_valid()); + } + HASH_GUARD(0x4842AF70A71BE6C4LL, uksort) { + return (t_uksort(params.rvalAt(0))); + } + break; + case 6: + HASH_GUARD(0x234F6A0A486E8646LL, natcasesort) { + return (t_natcasesort()); + } + break; + case 10: + HASH_GUARD(0x2FC3A6941D522E0ALL, setflags) { + return (t_setflags(params.rvalAt(0)), null); + } + break; + case 16: + HASH_GUARD(0x5CEFA5A265104D10LL, count) { + return (t_count()); + } + break; + case 17: + HASH_GUARD(0x56EDB60C824E8C51LL, key) { + return (t_key()); + } + break; + case 24: + HASH_GUARD(0x61D11ECEF4404498LL, offsetget) { + return (t_offsetget(params.rvalAt(0))); + } + HASH_GUARD(0x70448A629A74FB18LL, ksort) { + return (t_ksort()); + } + break; + case 28: + HASH_GUARD(0x5B3A4A72846B21DCLL, current) { + return (t_current()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + case 32: + HASH_GUARD(0x6FACBD7F02B6FD60LL, uasort) { + return (t_uasort(params.rvalAt(0))); + } + break; + case 33: + HASH_GUARD(0x0E210679B2DFD461LL, getarraycopy) { + return (t_getarraycopy()); + } + HASH_GUARD(0x27E7DBA875AD17E1LL, getflags) { + return (t_getflags()); + } + break; + case 39: + HASH_GUARD(0x7EF5445C77054C67LL, seek) { + return (t_seek(params.rvalAt(0)), null); + } + break; + case 42: + HASH_GUARD(0x1670096FDE27AF6ALL, rewind) { + return (t_rewind()); + } + break; + case 46: + HASH_GUARD(0x790B7C44A3442BEELL, asort) { + return (t_asort()); + } + break; + case 51: + HASH_GUARD(0x7DB9D839ACE0DEB3LL, natsort) { + return (t_natsort()); + } + break; + case 56: + HASH_GUARD(0x3C6D50F3BB8102B8LL, next) { + return (t_next()); + } + HASH_GUARD(0x0957F693A48AF738LL, offsetset) { + return (t_offsetset(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + case 58: + HASH_GUARD(0x08329980E6369ABALL, offsetunset) { + return (t_offsetunset(params.rvalAt(0)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_arrayiterator::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 0: + HASH_GUARD(0x3E6BCFB9742FC700LL, offsetexists) { + return (t_offsetexists(a0)); + } + break; + case 2: + HASH_GUARD(0x4DEE4A472DC69EC2LL, append) { + return (t_append(a0), null); + } + break; + case 4: + HASH_GUARD(0x6413CB5154808C44LL, valid) { + return (t_valid()); + } + HASH_GUARD(0x4842AF70A71BE6C4LL, uksort) { + return (t_uksort(a0)); + } + break; + case 6: + HASH_GUARD(0x234F6A0A486E8646LL, natcasesort) { + return (t_natcasesort()); + } + break; + case 10: + HASH_GUARD(0x2FC3A6941D522E0ALL, setflags) { + return (t_setflags(a0), null); + } + break; + case 16: + HASH_GUARD(0x5CEFA5A265104D10LL, count) { + return (t_count()); + } + break; + case 17: + HASH_GUARD(0x56EDB60C824E8C51LL, key) { + return (t_key()); + } + break; + case 24: + HASH_GUARD(0x61D11ECEF4404498LL, offsetget) { + return (t_offsetget(a0)); + } + HASH_GUARD(0x70448A629A74FB18LL, ksort) { + return (t_ksort()); + } + break; + case 28: + HASH_GUARD(0x5B3A4A72846B21DCLL, current) { + return (t_current()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + break; + case 32: + HASH_GUARD(0x6FACBD7F02B6FD60LL, uasort) { + return (t_uasort(a0)); + } + break; + case 33: + HASH_GUARD(0x0E210679B2DFD461LL, getarraycopy) { + return (t_getarraycopy()); + } + HASH_GUARD(0x27E7DBA875AD17E1LL, getflags) { + return (t_getflags()); + } + break; + case 39: + HASH_GUARD(0x7EF5445C77054C67LL, seek) { + return (t_seek(a0), null); + } + break; + case 42: + HASH_GUARD(0x1670096FDE27AF6ALL, rewind) { + return (t_rewind()); + } + break; + case 46: + HASH_GUARD(0x790B7C44A3442BEELL, asort) { + return (t_asort()); + } + break; + case 51: + HASH_GUARD(0x7DB9D839ACE0DEB3LL, natsort) { + return (t_natsort()); + } + break; + case 56: + HASH_GUARD(0x3C6D50F3BB8102B8LL, next) { + return (t_next()); + } + HASH_GUARD(0x0957F693A48AF738LL, offsetset) { + return (t_offsetset(a0, a1), null); + } + break; + case 58: + HASH_GUARD(0x08329980E6369ABALL, offsetunset) { + return (t_offsetunset(a0), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_arrayiterator::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_arrayiterator::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 0: + HASH_GUARD(0x3E6BCFB9742FC700LL, offsetexists) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_offsetexists(a0)); + } + break; + case 2: + HASH_GUARD(0x4DEE4A472DC69EC2LL, append) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_append(a0), null); + } + break; + case 4: + HASH_GUARD(0x6413CB5154808C44LL, valid) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_valid()); + } + HASH_GUARD(0x4842AF70A71BE6C4LL, uksort) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_uksort(a0)); + } + break; + case 6: + HASH_GUARD(0x234F6A0A486E8646LL, natcasesort) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_natcasesort()); + } + break; + case 10: + HASH_GUARD(0x2FC3A6941D522E0ALL, setflags) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setflags(a0), null); + } + break; + case 16: + HASH_GUARD(0x5CEFA5A265104D10LL, count) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_count()); + } + break; + case 17: + HASH_GUARD(0x56EDB60C824E8C51LL, key) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_key()); + } + break; + case 24: + HASH_GUARD(0x61D11ECEF4404498LL, offsetget) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_offsetget(a0)); + } + HASH_GUARD(0x70448A629A74FB18LL, ksort) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_ksort()); + } + break; + case 28: + HASH_GUARD(0x5B3A4A72846B21DCLL, current) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_current()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + break; + case 32: + HASH_GUARD(0x6FACBD7F02B6FD60LL, uasort) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_uasort(a0)); + } + break; + case 33: + HASH_GUARD(0x0E210679B2DFD461LL, getarraycopy) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getarraycopy()); + } + HASH_GUARD(0x27E7DBA875AD17E1LL, getflags) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getflags()); + } + break; + case 39: + HASH_GUARD(0x7EF5445C77054C67LL, seek) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_seek(a0), null); + } + break; + case 42: + HASH_GUARD(0x1670096FDE27AF6ALL, rewind) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_rewind()); + } + break; + case 46: + HASH_GUARD(0x790B7C44A3442BEELL, asort) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_asort()); + } + break; + case 51: + HASH_GUARD(0x7DB9D839ACE0DEB3LL, natsort) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_natsort()); + } + break; + case 56: + HASH_GUARD(0x3C6D50F3BB8102B8LL, next) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_next()); + } + HASH_GUARD(0x0957F693A48AF738LL, offsetset) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_offsetset(a0, a1), null); + } + break; + case 58: + HASH_GUARD(0x08329980E6369ABALL, offsetunset) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_offsetunset(a0), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_arrayiterator::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_arrayiterator$os_get(const char *s) { + return c_arrayiterator::os_get(s, -1); +} +Variant &cw_arrayiterator$os_lval(const char *s) { + return c_arrayiterator::os_lval(s, -1); +} +Variant cw_arrayiterator$os_constant(const char *s) { + return c_arrayiterator::os_constant(s); +} +Variant cw_arrayiterator$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_arrayiterator::os_invoke(c, s, params, -1, fatal); +} +void c_arrayiterator::init() { +} +/* SRC: classes/iterator.php line 36 */ +void c_arrayiterator::t___construct(Variant v_array, Variant v_flags /* = 0LL (SORT_REGULAR) */) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::__construct); + bool oldInCtor = gasInCtor(true); + m_arr = v_array; + m_flags = v_flags; + gasInCtor(oldInCtor); +} /* function */ +/* SRC: classes/iterator.php line 41 */ +void c_arrayiterator::t_append(CVarRef v_value) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::append); + m_arr.append((v_value)); +} /* function */ +/* SRC: classes/iterator.php line 45 */ +bool c_arrayiterator::t_asort() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::asort); + return x_asort(ref(lval(m_arr)), toInt32(m_flags)); +} /* function */ +/* SRC: classes/iterator.php line 49 */ +int c_arrayiterator::t_count() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::count); + return x_count(m_arr); +} /* function */ +/* SRC: classes/iterator.php line 53 */ +Variant c_arrayiterator::t_current() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::current); + return x_current(ref(lval(m_arr))); +} /* function */ +/* SRC: classes/iterator.php line 57 */ +Variant c_arrayiterator::t_getarraycopy() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::getArrayCopy); + return m_arr; +} /* function */ +/* SRC: classes/iterator.php line 61 */ +Variant c_arrayiterator::t_getflags() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::getFlags); + return m_flags; +} /* function */ +/* SRC: classes/iterator.php line 65 */ +Variant c_arrayiterator::t_key() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::key); + return x_key(ref(lval(m_arr))); +} /* function */ +/* SRC: classes/iterator.php line 69 */ +bool c_arrayiterator::t_ksort() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::ksort); + return x_ksort(ref(lval(m_arr)), toInt32(m_flags)); +} /* function */ +/* SRC: classes/iterator.php line 73 */ +Variant c_arrayiterator::t_natcasesort() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::natcasesort); + return x_natcasesort(ref(lval(m_arr))); +} /* function */ +/* SRC: classes/iterator.php line 77 */ +Variant c_arrayiterator::t_natsort() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::natsort); + return x_natsort(ref(lval(m_arr))); +} /* function */ +/* SRC: classes/iterator.php line 81 */ +Variant c_arrayiterator::t_next() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::next); + return x_next(ref(lval(m_arr))); +} /* function */ +/* SRC: classes/iterator.php line 85 */ +bool c_arrayiterator::t_offsetexists(CVarRef v_index) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::offsetExists); + return isset(m_arr, v_index); +} /* function */ +/* SRC: classes/iterator.php line 89 */ +Variant c_arrayiterator::t_offsetget(Variant v_index) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::offsetGet); + return m_arr.rvalAt(v_index); +} /* function */ +/* SRC: classes/iterator.php line 89 */ +Variant &c_arrayiterator::___offsetget_lval(Variant v_index) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::offsetGet); + Variant &v = get_system_globals()->__lvalProxy; + v = t_offsetget(v_index); + return v; +} /* function */ +/* SRC: classes/iterator.php line 93 */ +void c_arrayiterator::t_offsetset(CVarRef v_index, CVarRef v_newval) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::offsetSet); + m_arr.set(v_index, (v_newval)); +} /* function */ +/* SRC: classes/iterator.php line 97 */ +void c_arrayiterator::t_offsetunset(CVarRef v_index) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::offsetUnset); + DECLARE_SYSTEM_GLOBALS(g); + m_arr.weakRemove(v_index); +} /* function */ +/* SRC: classes/iterator.php line 101 */ +Variant c_arrayiterator::t_rewind() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::rewind); + return x_reset(ref(lval(m_arr))); +} /* function */ +/* SRC: classes/iterator.php line 105 */ +void c_arrayiterator::t_seek(CVarRef v_position) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::seek); + int64 v_i = 0; + + x_reset(ref(lval(m_arr))); + { + LOOP_COUNTER(1); + for (v_i = 0LL; less(v_i, v_position); v_i++) { + LOOP_COUNTER_CHECK(1); + { + if (!(toBoolean(x_next(ref(lval(m_arr)))))) { + break; + } + } + } + } +} /* function */ +/* SRC: classes/iterator.php line 114 */ +void c_arrayiterator::t_setflags(CVarRef v_flags) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::setFlags); + m_flags = v_flags; +} /* function */ +/* SRC: classes/iterator.php line 118 */ +bool c_arrayiterator::t_uasort(CVarRef v_cmp_function) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::uasort); + return x_uasort(ref(lval(m_arr)), v_cmp_function); +} /* function */ +/* SRC: classes/iterator.php line 122 */ +bool c_arrayiterator::t_uksort(Variant v_cmp_function) { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::uksort); + return invoke_failed("uksort", Array(ArrayInit(1).set(0, ArrayElement(ref(v_cmp_function))).create()), 0x4842AF70A71BE6C4LL); +} /* function */ +/* SRC: classes/iterator.php line 126 */ +bool c_arrayiterator::t_valid() { + INSTANCE_METHOD_INJECTION(ArrayIterator, ArrayIterator::valid); + return !same(x_current(ref(lval(m_arr))), false); +} /* function */ +Object co_arrayiterator(CArrRef params, bool init /* = true */) { + return Object(p_arrayiterator(NEW(c_arrayiterator)())->dynCreate(params, init)); +} +Variant pm_php$classes$iterator_php(bool incOnce /* = false */, LVariableTable* variables /* = NULL */) { + FUNCTION_INJECTION(run_init::classes/iterator.php); + { + DECLARE_SYSTEM_GLOBALS(g); + bool &alreadyRun = g->run_pm_php$classes$iterator_php; + if (alreadyRun) { if (incOnce) return true;} + else alreadyRun = true; + if (!variables) variables = g; + } + DECLARE_SYSTEM_GLOBALS(g); + LVariableTable *gVariables __attribute__((__unused__)) = get_variable_table(); + return true; +} /* function */ + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/php/classes/iterator.fw.h b/src/lib/system/gen/php/classes/iterator.fw.h new file mode 100644 index 0000000000000..51b634c5de875 --- /dev/null +++ b/src/lib/system/gen/php/classes/iterator.fw.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_ITERATOR_FW_H__ +#define __GENERATED_PHP_CLASSES_ITERATOR_FW_H__ + +#include + +// Forward Declarations + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// 1. Constants + +// 2. Classes +FORWARD_DECLARE_CLASS(outeriterator); +FORWARD_DECLARE_CLASS(serializable); +FORWARD_DECLARE_CLASS(traversable); +FORWARD_DECLARE_CLASS(countable); +FORWARD_DECLARE_CLASS(arrayiterator) +FORWARD_DECLARE_CLASS(iterator); +FORWARD_DECLARE_CLASS(seekableiterator); +FORWARD_DECLARE_CLASS(iteratoraggregate); +FORWARD_DECLARE_CLASS(filteriterator); + +/////////////////////////////////////////////////////////////////////////////// +} +#include +#include + +#endif // __GENERATED_PHP_CLASSES_ITERATOR_FW_H__ diff --git a/src/lib/system/gen/php/classes/iterator.h b/src/lib/system/gen/php/classes/iterator.h new file mode 100644 index 0000000000000..70c71eb6ce628 --- /dev/null +++ b/src/lib/system/gen/php/classes/iterator.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_ITERATOR_H__ +#define __GENERATED_PHP_CLASSES_ITERATOR_H__ + +#include +#include + +// Declarations +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant pm_php$classes$iterator_php(bool incOnce = false, LVariableTable* variables = NULL); +Object co_arrayiterator(CArrRef params, bool init = true); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_CLASSES_ITERATOR_H__ diff --git a/src/lib/system/gen/php/classes/pear_error.cpp b/src/lib/system/gen/php/classes/pear_error.cpp new file mode 100644 index 0000000000000..2001b27e8e9ec --- /dev/null +++ b/src/lib/system/gen/php/classes/pear_error.cpp @@ -0,0 +1,470 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* preface starts */ +/* preface finishes */ +/* SRC: classes/pear_error.php line 3 */ +Variant c_pear_error::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_pear_error::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_pear_error::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_pear_error::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_pear_error::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_pear_error::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_pear_error::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_pear_error::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(pear_error) +ObjectData *c_pear_error::create(CStrRef v_message /* = "unknown error" */, CVarRef v_code /* = null_variant */, CVarRef v_mode /* = null_variant */, CVarRef v_options /* = null_variant */, CVarRef v_userinfo /* = null_variant */) { + init(); + t_pear_error(v_message, v_code, v_mode, v_options, v_userinfo); + return this; +} +ObjectData *c_pear_error::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 0) return (create()); + if (count == 1) return (create(params.rvalAt(0))); + if (count == 2) return (create(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } else return this; +} +ObjectData *c_pear_error::cloneImpl() { + c_pear_error *obj = NEW(c_pear_error)(); + cloneSet(obj); + return obj; +} +void c_pear_error::cloneSet(c_pear_error *clone) { + ObjectData::cloneSet(clone); +} +Variant c_pear_error::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 1: + HASH_GUARD(0x488B59A7AC1AD281LL, getbacktrace) { + int count = params.size(); + if (count <= 0) return (t_getbacktrace(), null); + return (t_getbacktrace(params.rvalAt(0)), null); + } + break; + case 4: + HASH_GUARD(0x4394241AA92AEB44LL, adduserinfo) { + return (t_adduserinfo(params.rvalAt(0)), null); + } + break; + case 6: + HASH_GUARD(0x1D3B08AA0AF50F06LL, gettype) { + return (t_gettype(), null); + } + break; + case 12: + HASH_GUARD(0x337CF323F97137ACLL, getmode) { + return (t_getmode(), null); + } + break; + case 15: + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode(), null); + } + break; + case 17: + HASH_GUARD(0x2E87870339147BF1LL, getcallback) { + return (t_getcallback(), null); + } + break; + case 18: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage(), null); + } + break; + case 19: + HASH_GUARD(0x05CF5B3C831C4053LL, getuserinfo) { + return (t_getuserinfo(), null); + } + HASH_GUARD(0x6271FDA592D5EF53LL, tostring) { + return (t_tostring(), null); + } + break; + case 24: + HASH_GUARD(0x3CEBA108A1BAB998LL, pear_error) { + int count = params.size(); + if (count <= 0) return (t_pear_error(), null); + if (count == 1) return (t_pear_error(params.rvalAt(0)), null); + if (count == 2) return (t_pear_error(params.rvalAt(0), params.rvalAt(1)), null); + if (count == 3) return (t_pear_error(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + if (count == 4) return (t_pear_error(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); + return (t_pear_error(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); + } + break; + case 27: + HASH_GUARD(0x74E7C543C0FD73FBLL, getdebuginfo) { + return (t_getdebuginfo(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_pear_error::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 1: + HASH_GUARD(0x488B59A7AC1AD281LL, getbacktrace) { + if (count <= 0) return (t_getbacktrace(), null); + return (t_getbacktrace(a0), null); + } + break; + case 4: + HASH_GUARD(0x4394241AA92AEB44LL, adduserinfo) { + return (t_adduserinfo(a0), null); + } + break; + case 6: + HASH_GUARD(0x1D3B08AA0AF50F06LL, gettype) { + return (t_gettype(), null); + } + break; + case 12: + HASH_GUARD(0x337CF323F97137ACLL, getmode) { + return (t_getmode(), null); + } + break; + case 15: + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode(), null); + } + break; + case 17: + HASH_GUARD(0x2E87870339147BF1LL, getcallback) { + return (t_getcallback(), null); + } + break; + case 18: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage(), null); + } + break; + case 19: + HASH_GUARD(0x05CF5B3C831C4053LL, getuserinfo) { + return (t_getuserinfo(), null); + } + HASH_GUARD(0x6271FDA592D5EF53LL, tostring) { + return (t_tostring(), null); + } + break; + case 24: + HASH_GUARD(0x3CEBA108A1BAB998LL, pear_error) { + if (count <= 0) return (t_pear_error(), null); + if (count == 1) return (t_pear_error(a0), null); + if (count == 2) return (t_pear_error(a0, a1), null); + if (count == 3) return (t_pear_error(a0, a1, a2), null); + if (count == 4) return (t_pear_error(a0, a1, a2, a3), null); + return (t_pear_error(a0, a1, a2, a3, a4), null); + } + break; + case 27: + HASH_GUARD(0x74E7C543C0FD73FBLL, getdebuginfo) { + return (t_getdebuginfo(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_pear_error::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_pear_error::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 1: + HASH_GUARD(0x488B59A7AC1AD281LL, getbacktrace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_getbacktrace(), null); + return (t_getbacktrace(a0), null); + } + break; + case 4: + HASH_GUARD(0x4394241AA92AEB44LL, adduserinfo) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_adduserinfo(a0), null); + } + break; + case 6: + HASH_GUARD(0x1D3B08AA0AF50F06LL, gettype) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettype(), null); + } + break; + case 12: + HASH_GUARD(0x337CF323F97137ACLL, getmode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmode(), null); + } + break; + case 15: + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode(), null); + } + break; + case 17: + HASH_GUARD(0x2E87870339147BF1LL, getcallback) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcallback(), null); + } + break; + case 18: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage(), null); + } + break; + case 19: + HASH_GUARD(0x05CF5B3C831C4053LL, getuserinfo) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getuserinfo(), null); + } + HASH_GUARD(0x6271FDA592D5EF53LL, tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_tostring(), null); + } + break; + case 24: + HASH_GUARD(0x3CEBA108A1BAB998LL, pear_error) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_pear_error(), null); + if (count == 1) return (t_pear_error(a0), null); + if (count == 2) return (t_pear_error(a0, a1), null); + if (count == 3) return (t_pear_error(a0, a1, a2), null); + if (count == 4) return (t_pear_error(a0, a1, a2, a3), null); + return (t_pear_error(a0, a1, a2, a3, a4), null); + } + break; + case 27: + HASH_GUARD(0x74E7C543C0FD73FBLL, getdebuginfo) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdebuginfo(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_pear_error::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_pear_error$os_get(const char *s) { + return c_pear_error::os_get(s, -1); +} +Variant &cw_pear_error$os_lval(const char *s) { + return c_pear_error::os_lval(s, -1); +} +Variant cw_pear_error$os_constant(const char *s) { + return c_pear_error::os_constant(s); +} +Variant cw_pear_error$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_pear_error::os_invoke(c, s, params, -1, fatal); +} +void c_pear_error::init() { +} +/* SRC: classes/pear_error.php line 4 */ +void c_pear_error::t_pear_error(CStrRef v_message /* = "unknown error" */, CVarRef v_code /* = null_variant */, CVarRef v_mode /* = null_variant */, CVarRef v_options /* = null_variant */, CVarRef v_userinfo /* = null_variant */) { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::pear_error); + bool oldInCtor = gasInCtor(true); + gasInCtor(oldInCtor); +} /* function */ +/* SRC: classes/pear_error.php line 8 */ +void c_pear_error::t_adduserinfo(CVarRef v_info) { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::addUserInfo); +} /* function */ +/* SRC: classes/pear_error.php line 9 */ +void c_pear_error::t_getcallback() { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::getCallback); +} /* function */ +/* SRC: classes/pear_error.php line 10 */ +void c_pear_error::t_getcode() { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::getCode); +} /* function */ +/* SRC: classes/pear_error.php line 11 */ +void c_pear_error::t_getmessage() { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::getMessage); +} /* function */ +/* SRC: classes/pear_error.php line 12 */ +void c_pear_error::t_getmode() { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::getMode); +} /* function */ +/* SRC: classes/pear_error.php line 13 */ +void c_pear_error::t_getdebuginfo() { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::getDebugInfo); +} /* function */ +/* SRC: classes/pear_error.php line 14 */ +void c_pear_error::t_gettype() { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::getType); +} /* function */ +/* SRC: classes/pear_error.php line 15 */ +void c_pear_error::t_getuserinfo() { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::getUserInfo); +} /* function */ +/* SRC: classes/pear_error.php line 16 */ +void c_pear_error::t_getbacktrace(CVarRef v_frame /* = null_variant */) { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::getBacktrace); +} /* function */ +/* SRC: classes/pear_error.php line 18 */ +void c_pear_error::t_tostring() { + INSTANCE_METHOD_INJECTION(pear_error, pear_error::toString); +} /* function */ +Object co_pear_error(CArrRef params, bool init /* = true */) { + return Object(p_pear_error(NEW(c_pear_error)())->dynCreate(params, init)); +} +Variant pm_php$classes$pear_error_php(bool incOnce /* = false */, LVariableTable* variables /* = NULL */) { + FUNCTION_INJECTION(run_init::classes/pear_error.php); + { + DECLARE_SYSTEM_GLOBALS(g); + bool &alreadyRun = g->run_pm_php$classes$pear_error_php; + if (alreadyRun) { if (incOnce) return true;} + else alreadyRun = true; + if (!variables) variables = g; + } + DECLARE_SYSTEM_GLOBALS(g); + LVariableTable *gVariables __attribute__((__unused__)) = get_variable_table(); + return true; +} /* function */ + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/php/classes/pear_error.fw.h b/src/lib/system/gen/php/classes/pear_error.fw.h new file mode 100644 index 0000000000000..2635627e2c90a --- /dev/null +++ b/src/lib/system/gen/php/classes/pear_error.fw.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_PEAR_ERROR_FW_H__ +#define __GENERATED_PHP_CLASSES_PEAR_ERROR_FW_H__ + +#include + +// Forward Declarations + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// 1. Constants + +// 2. Classes +FORWARD_DECLARE_CLASS(pear_error) + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_CLASSES_PEAR_ERROR_FW_H__ diff --git a/src/lib/system/gen/php/classes/pear_error.h b/src/lib/system/gen/php/classes/pear_error.h new file mode 100644 index 0000000000000..6d81cfd046b36 --- /dev/null +++ b/src/lib/system/gen/php/classes/pear_error.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_PEAR_ERROR_H__ +#define __GENERATED_PHP_CLASSES_PEAR_ERROR_H__ + +#include +#include + +// Declarations +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant pm_php$classes$pear_error_php(bool incOnce = false, LVariableTable* variables = NULL); +Object co_pear_error(CArrRef params, bool init = true); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_CLASSES_PEAR_ERROR_H__ diff --git a/src/lib/system/gen/php/classes/reflection.cpp b/src/lib/system/gen/php/classes/reflection.cpp new file mode 100644 index 0000000000000..a55ff2239b4f9 --- /dev/null +++ b/src/lib/system/gen/php/classes/reflection.cpp @@ -0,0 +1,6622 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* preface starts */ +/* preface finishes */ +/* SRC: classes/reflection.php line 92 */ +Variant c_reflectionfunctionabstract::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_reflectionfunctionabstract::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_reflectionfunctionabstract::o_get(ArrayElementVec &props) const { + props.push_back(NEW(ArrayElement)("info", m_info.isReferenced() ? ref(m_info) : m_info)); + c_ObjectData::o_get(props); +} +bool c_reflectionfunctionabstract::o_exists(CStrRef s, int64 hash) const { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 1) { + case 0: + HASH_EXISTS_STRING(0x59E9384E33988B3ELL, info, 4); + break; + default: + break; + } + return c_ObjectData::o_exists(s, hash); +} +Variant c_reflectionfunctionabstract::o_get(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 1) { + case 0: + HASH_RETURN_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_get(s, hash); +} +Variant c_reflectionfunctionabstract::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 1) { + case 0: + HASH_SET_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_reflectionfunctionabstract::o_lval(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 1) { + case 0: + HASH_RETURN_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_lval(s, hash); +} +Variant c_reflectionfunctionabstract::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(reflectionfunctionabstract) +ObjectData *c_reflectionfunctionabstract::cloneImpl() { + c_reflectionfunctionabstract *obj = NEW(c_reflectionfunctionabstract)(); + cloneSet(obj); + return obj; +} +void c_reflectionfunctionabstract::cloneSet(c_reflectionfunctionabstract *clone) { + clone->m_info = m_info.isReferenced() ? ref(m_info) : m_info; + ObjectData::cloneSet(clone); +} +Variant c_reflectionfunctionabstract::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 0: + HASH_GUARD(0x57D8DC34C9A03560LL, getnumberofparameters) { + return (t_getnumberofparameters()); + } + break; + case 1: + HASH_GUARD(0x4D637DECDBFA6221LL, getnumberofrequiredparameters) { + return (t_getnumberofrequiredparameters()); + } + break; + case 2: + HASH_GUARD(0x33A6C2CFBDB05EE2LL, getclosure) { + return (t_getclosure()); + } + break; + case 4: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + return (t_isuserdefined()); + } + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + return (t_getstartline()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x37FFB8F44A3329A8LL, getstaticvariables) { + return (t_getstaticvariables()); + } + HASH_GUARD(0x1A3AB3B0276D2668LL, returnsreference) { + return (t_returnsreference()); + } + break; + case 13: + HASH_GUARD(0x3E62225132C2A32DLL, getparameters) { + return (t_getparameters()); + } + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + return (t_getfilename()); + } + break; + case 15: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + return (t_isinternal()); + } + break; + case 16: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + return (t_getendline()); + } + break; + case 24: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_reflectionfunctionabstract::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 0: + HASH_GUARD(0x57D8DC34C9A03560LL, getnumberofparameters) { + return (t_getnumberofparameters()); + } + break; + case 1: + HASH_GUARD(0x4D637DECDBFA6221LL, getnumberofrequiredparameters) { + return (t_getnumberofrequiredparameters()); + } + break; + case 2: + HASH_GUARD(0x33A6C2CFBDB05EE2LL, getclosure) { + return (t_getclosure()); + } + break; + case 4: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + return (t_isuserdefined()); + } + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + return (t_getstartline()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x37FFB8F44A3329A8LL, getstaticvariables) { + return (t_getstaticvariables()); + } + HASH_GUARD(0x1A3AB3B0276D2668LL, returnsreference) { + return (t_returnsreference()); + } + break; + case 13: + HASH_GUARD(0x3E62225132C2A32DLL, getparameters) { + return (t_getparameters()); + } + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + return (t_getfilename()); + } + break; + case 15: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + return (t_isinternal()); + } + break; + case 16: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + return (t_getendline()); + } + break; + case 24: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_reflectionfunctionabstract::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_reflectionfunctionabstract::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 0: + HASH_GUARD(0x57D8DC34C9A03560LL, getnumberofparameters) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnumberofparameters()); + } + break; + case 1: + HASH_GUARD(0x4D637DECDBFA6221LL, getnumberofrequiredparameters) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnumberofrequiredparameters()); + } + break; + case 2: + HASH_GUARD(0x33A6C2CFBDB05EE2LL, getclosure) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getclosure()); + } + break; + case 4: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isuserdefined()); + } + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getstartline()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x37FFB8F44A3329A8LL, getstaticvariables) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getstaticvariables()); + } + HASH_GUARD(0x1A3AB3B0276D2668LL, returnsreference) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_returnsreference()); + } + break; + case 13: + HASH_GUARD(0x3E62225132C2A32DLL, getparameters) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getparameters()); + } + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfilename()); + } + break; + case 15: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinternal()); + } + break; + case 16: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getendline()); + } + break; + case 24: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdoccomment()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_reflectionfunctionabstract::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_reflectionfunctionabstract$os_get(const char *s) { + return c_reflectionfunctionabstract::os_get(s, -1); +} +Variant &cw_reflectionfunctionabstract$os_lval(const char *s) { + return c_reflectionfunctionabstract::os_lval(s, -1); +} +Variant cw_reflectionfunctionabstract$os_constant(const char *s) { + return c_reflectionfunctionabstract::os_constant(s); +} +Variant cw_reflectionfunctionabstract$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_reflectionfunctionabstract::os_invoke(c, s, params, -1, fatal); +} +void c_reflectionfunctionabstract::init() { +} +/* SRC: classes/reflection.php line 95 */ +Variant c_reflectionfunctionabstract::t_getname() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::getName); + return m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); +} /* function */ +/* SRC: classes/reflection.php line 99 */ +Variant c_reflectionfunctionabstract::t_isinternal() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::isInternal); + return m_info.rvalAt("internal", 0x575D95D69332A8ACLL); +} /* function */ +/* SRC: classes/reflection.php line 103 */ +Variant c_reflectionfunctionabstract::t_getclosure() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::getClosure); + return m_info.rvalAt("closure", 0x10958EC44CD61020LL); +} /* function */ +/* SRC: classes/reflection.php line 107 */ +bool c_reflectionfunctionabstract::t_isuserdefined() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::isUserDefined); + return !(toBoolean(m_info.rvalAt("internal", 0x575D95D69332A8ACLL))); +} /* function */ +/* SRC: classes/reflection.php line 111 */ +Variant c_reflectionfunctionabstract::t_getfilename() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::getFileName); + return m_info.rvalAt("file", 0x612E37678CE7DB5BLL); +} /* function */ +/* SRC: classes/reflection.php line 115 */ +Variant c_reflectionfunctionabstract::t_getstartline() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::getStartLine); + return m_info.rvalAt("line1", 0x7E7BD613D4C67725LL); +} /* function */ +/* SRC: classes/reflection.php line 119 */ +Variant c_reflectionfunctionabstract::t_getendline() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::getEndLine); + return m_info.rvalAt("line2", 0x641B12C5BEFE32A8LL); +} /* function */ +/* SRC: classes/reflection.php line 123 */ +Variant c_reflectionfunctionabstract::t_getdoccomment() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::getDocComment); + return m_info.rvalAt("doc", 0x16758C759CFA17A6LL); +} /* function */ +/* SRC: classes/reflection.php line 127 */ +Variant c_reflectionfunctionabstract::t_getstaticvariables() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::getStaticVariables); + return m_info.rvalAt("static_variables", 0x4BC9448B5BE7A94ALL); +} /* function */ +/* SRC: classes/reflection.php line 131 */ +Variant c_reflectionfunctionabstract::t_returnsreference() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::returnsReference); + return m_info.rvalAt("ref", 0x0B1A6D25134FD5FALL); +} /* function */ +/* SRC: classes/reflection.php line 135 */ +Array c_reflectionfunctionabstract::t_getparameters() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::getParameters); + Array v_ret; + Primitive v_name = 0; + Variant v_info; + p_reflectionparameter v_param; + + v_ret = SystemScalarArrays::ssa_[0]; + { + LOOP_COUNTER(1); + Variant map2 = m_info.rvalAt("params", 0x6E4C9E151F20AC62LL); + for (ArrayIterPtr iter3 = map2.begin("reflectionfunctionabstract"); !iter3->end(); iter3->next()) { + LOOP_COUNTER_CHECK(1); + v_info = iter3->second(); + v_name = iter3->first(); + { + ((Object)(v_param = ((Object)(p_reflectionparameter(p_reflectionparameter(NEW(c_reflectionparameter)())->create(null, null)))))); + v_param->m_info = v_info; + v_ret.append((((Object)(v_param)))); + } + } + } + return v_ret; +} /* function */ +/* SRC: classes/reflection.php line 145 */ +int c_reflectionfunctionabstract::t_getnumberofparameters() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::getNumberOfParameters); + return x_count(m_info.rvalAt("params", 0x6E4C9E151F20AC62LL)); +} /* function */ +/* SRC: classes/reflection.php line 149 */ +int64 c_reflectionfunctionabstract::t_getnumberofrequiredparameters() { + INSTANCE_METHOD_INJECTION(ReflectionFunctionAbstract, ReflectionFunctionAbstract::getNumberOfRequiredParameters); + int64 v_count = 0; + Array v_params; + Primitive v_name = 0; + Variant v_param; + + v_count = 0LL; + v_params = t_getparameters(); + { + LOOP_COUNTER(4); + for (ArrayIter iter6 = v_params.begin("reflectionfunctionabstract"); !iter6.end(); ++iter6) { + LOOP_COUNTER_CHECK(4); + v_param = iter6.second(); + v_name = iter6.first(); + { + if (toBoolean(v_param.o_invoke_few_args("isOptional", 0x2D6EF48BBAB22735LL, 0))) { + break; + } + v_count++; + } + } + } + return v_count; +} /* function */ +/* SRC: classes/reflection.php line 472 */ +Variant c_reflectionobject::os_get(const char *s, int64 hash) { + return c_reflectionclass::os_get(s, hash); +} +Variant &c_reflectionobject::os_lval(const char *s, int64 hash) { + return c_reflectionclass::os_lval(s, hash); +} +void c_reflectionobject::o_get(ArrayElementVec &props) const { + c_reflectionclass::o_get(props); +} +bool c_reflectionobject::o_exists(CStrRef s, int64 hash) const { + return c_reflectionclass::o_exists(s, hash); +} +Variant c_reflectionobject::o_get(CStrRef s, int64 hash) { + return c_reflectionclass::o_get(s, hash); +} +Variant c_reflectionobject::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_reflectionclass::o_set(s, hash, v, forInit); +} +Variant &c_reflectionobject::o_lval(CStrRef s, int64 hash) { + return c_reflectionclass::o_lval(s, hash); +} +Variant c_reflectionobject::os_constant(const char *s) { + return c_reflectionclass::os_constant(s); +} +IMPLEMENT_CLASS(reflectionobject) +ObjectData *c_reflectionobject::create(Variant v_obj) { + init(); + t___construct(v_obj); + return this; +} +ObjectData *c_reflectionobject::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_reflectionobject::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +ObjectData *c_reflectionobject::cloneImpl() { + c_reflectionobject *obj = NEW(c_reflectionobject)(); + cloneSet(obj); + return obj; +} +void c_reflectionobject::cloneSet(c_reflectionobject *clone) { + c_reflectionclass::cloneSet(clone); +} +Variant c_reflectionobject::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 4: + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + return (t_getstartline()); + } + break; + case 15: + HASH_GUARD(0x40C7B30DCB439C8FLL, hasproperty) { + return (t_hasproperty(params.rvalAt(0))); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + return (t_getmodifiers()); + } + break; + case 24: + HASH_GUARD(0x21820E7AA4733998LL, hasmethod) { + return (t_hasmethod(params.rvalAt(0))); + } + break; + case 27: + HASH_GUARD(0x0F1AD0A8EC4C229BLL, getdefaultproperties) { + return (t_getdefaultproperties()); + } + break; + case 30: + HASH_GUARD(0x1BC5F3D87676509ELL, isinterface) { + return (t_isinterface()); + } + break; + case 34: + HASH_GUARD(0x323D9BCB05797B22LL, getstaticproperties) { + return (t_getstaticproperties()); + } + break; + case 41: + HASH_GUARD(0x030CE1D6142F8C29LL, isinstance) { + return (t_isinstance(params.rvalAt(0))); + } + HASH_GUARD(0x1D6B8CA358B49929LL, getextensionname) { + return (t_getextensionname()); + } + break; + case 42: + HASH_GUARD(0x16BA16CE6488AAAALL, getmethods) { + return (t_getmethods()); + } + HASH_GUARD(0x226F6E80CECD3CAALL, getconstructor) { + return (t_getconstructor()); + } + break; + case 46: + HASH_GUARD(0x3C882D4A895F612ELL, getstaticpropertyvalue) { + int count = params.size(); + if (count <= 1) return (t_getstaticpropertyvalue(params.rvalAt(0))); + return (t_getstaticpropertyvalue(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x06FB6A7DC3D795AELL, isfinal) { + return (t_isfinal()); + } + break; + case 48: + HASH_GUARD(0x30A86FCA01FE7030LL, newinstance) { + int count = params.size(); + if (count <= 0) return (t_newinstance(count)); + return (t_newinstance(count,params.slice(0, count - 0, false))); + } + break; + case 52: + HASH_GUARD(0x3DB53E1FBD3C0734LL, getconstant) { + return (t_getconstant(params.rvalAt(0))); + } + break; + case 54: + HASH_GUARD(0x0D81ECE253A3B5B6LL, getmethod) { + return (t_getmethod(params.rvalAt(0))); + } + break; + case 55: + HASH_GUARD(0x7460D945DA32FDB7LL, isabstract) { + return (t_isabstract()); + } + break; + case 59: + HASH_GUARD(0x25D24435915E6E3BLL, getextension) { + return (t_getextension()); + } + break; + case 60: + HASH_GUARD(0x0D8AAD6BA2BBCD3CLL, isinstantiable) { + return (t_isinstantiable()); + } + break; + case 63: + HASH_GUARD(0x54C2DC04C4A62B3FLL, hasconstant) { + return (t_hasconstant(params.rvalAt(0))); + } + break; + case 67: + HASH_GUARD(0x67C15E3D98C00B43LL, getinterfaces) { + return (t_getinterfaces()); + } + break; + case 68: + HASH_GUARD(0x1EB679C3602F4B44LL, getproperties) { + return (t_getproperties()); + } + break; + case 71: + HASH_GUARD(0x0FD73627FB023047LL, getproperty) { + return (t_getproperty(params.rvalAt(0))); + } + break; + case 77: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + return (t_getfilename()); + } + break; + case 78: + HASH_GUARD(0x7D5A57B5370B68CELL, isiterateable) { + return (t_isiterateable()); + } + break; + case 79: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + return (t_isinternal()); + } + break; + case 85: + HASH_GUARD(0x1CC71CB013143955LL, getconstants) { + return (t_getconstants()); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + break; + case 100: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + return (t_isuserdefined()); + } + break; + case 101: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 102: + HASH_GUARD(0x2735DCC254EE5C66LL, newinstanceargs) { + return (t_newinstanceargs(params.rvalAt(0))); + } + break; + case 104: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), params.rvalAt(0), params.rvalAt(1))); + } + break; + case 112: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + return (t_getendline()); + } + break; + case 113: + HASH_GUARD(0x07ECA928E37717F1LL, setstaticpropertyvalue) { + return (t_setstaticpropertyvalue(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + case 114: + HASH_GUARD(0x74F7FEDE16957472LL, getparentclass) { + return (t_getparentclass()); + } + break; + case 120: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + case 123: + HASH_GUARD(0x28DC702215C7D6FBLL, implementsinterface) { + return (t_implementsinterface(params.rvalAt(0))); + } + break; + case 126: + HASH_GUARD(0x373333991926C97ELL, issubclassof) { + return (t_issubclassof(params.rvalAt(0))); + } + break; + default: + break; + } + return c_reflectionclass::o_invoke(s, params, hash, fatal); +} +Variant c_reflectionobject::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 4: + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + return (t_getstartline()); + } + break; + case 15: + HASH_GUARD(0x40C7B30DCB439C8FLL, hasproperty) { + return (t_hasproperty(a0)); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + return (t_getmodifiers()); + } + break; + case 24: + HASH_GUARD(0x21820E7AA4733998LL, hasmethod) { + return (t_hasmethod(a0)); + } + break; + case 27: + HASH_GUARD(0x0F1AD0A8EC4C229BLL, getdefaultproperties) { + return (t_getdefaultproperties()); + } + break; + case 30: + HASH_GUARD(0x1BC5F3D87676509ELL, isinterface) { + return (t_isinterface()); + } + break; + case 34: + HASH_GUARD(0x323D9BCB05797B22LL, getstaticproperties) { + return (t_getstaticproperties()); + } + break; + case 41: + HASH_GUARD(0x030CE1D6142F8C29LL, isinstance) { + return (t_isinstance(a0)); + } + HASH_GUARD(0x1D6B8CA358B49929LL, getextensionname) { + return (t_getextensionname()); + } + break; + case 42: + HASH_GUARD(0x16BA16CE6488AAAALL, getmethods) { + return (t_getmethods()); + } + HASH_GUARD(0x226F6E80CECD3CAALL, getconstructor) { + return (t_getconstructor()); + } + break; + case 46: + HASH_GUARD(0x3C882D4A895F612ELL, getstaticpropertyvalue) { + if (count <= 1) return (t_getstaticpropertyvalue(a0)); + return (t_getstaticpropertyvalue(a0, a1)); + } + HASH_GUARD(0x06FB6A7DC3D795AELL, isfinal) { + return (t_isfinal()); + } + break; + case 48: + HASH_GUARD(0x30A86FCA01FE7030LL, newinstance) { + if (count <= 0) return (t_newinstance(count)); + Array params; + if (count >= 1) params.append(a0); + if (count >= 2) params.append(a1); + if (count >= 3) params.append(a2); + if (count >= 4) params.append(a3); + if (count >= 5) params.append(a4); + if (count >= 6) params.append(a5); + return (t_newinstance(count,params)); + } + break; + case 52: + HASH_GUARD(0x3DB53E1FBD3C0734LL, getconstant) { + return (t_getconstant(a0)); + } + break; + case 54: + HASH_GUARD(0x0D81ECE253A3B5B6LL, getmethod) { + return (t_getmethod(a0)); + } + break; + case 55: + HASH_GUARD(0x7460D945DA32FDB7LL, isabstract) { + return (t_isabstract()); + } + break; + case 59: + HASH_GUARD(0x25D24435915E6E3BLL, getextension) { + return (t_getextension()); + } + break; + case 60: + HASH_GUARD(0x0D8AAD6BA2BBCD3CLL, isinstantiable) { + return (t_isinstantiable()); + } + break; + case 63: + HASH_GUARD(0x54C2DC04C4A62B3FLL, hasconstant) { + return (t_hasconstant(a0)); + } + break; + case 67: + HASH_GUARD(0x67C15E3D98C00B43LL, getinterfaces) { + return (t_getinterfaces()); + } + break; + case 68: + HASH_GUARD(0x1EB679C3602F4B44LL, getproperties) { + return (t_getproperties()); + } + break; + case 71: + HASH_GUARD(0x0FD73627FB023047LL, getproperty) { + return (t_getproperty(a0)); + } + break; + case 77: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + return (t_getfilename()); + } + break; + case 78: + HASH_GUARD(0x7D5A57B5370B68CELL, isiterateable) { + return (t_isiterateable()); + } + break; + case 79: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + return (t_isinternal()); + } + break; + case 85: + HASH_GUARD(0x1CC71CB013143955LL, getconstants) { + return (t_getconstants()); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + break; + case 100: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + return (t_isuserdefined()); + } + break; + case 101: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 102: + HASH_GUARD(0x2735DCC254EE5C66LL, newinstanceargs) { + return (t_newinstanceargs(a0)); + } + break; + case 104: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), a0, a1)); + } + break; + case 112: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + return (t_getendline()); + } + break; + case 113: + HASH_GUARD(0x07ECA928E37717F1LL, setstaticpropertyvalue) { + return (t_setstaticpropertyvalue(a0, a1), null); + } + break; + case 114: + HASH_GUARD(0x74F7FEDE16957472LL, getparentclass) { + return (t_getparentclass()); + } + break; + case 120: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + case 123: + HASH_GUARD(0x28DC702215C7D6FBLL, implementsinterface) { + return (t_implementsinterface(a0)); + } + break; + case 126: + HASH_GUARD(0x373333991926C97ELL, issubclassof) { + return (t_issubclassof(a0)); + } + break; + default: + break; + } + return c_reflectionclass::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_reflectionobject::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(c, params.rvalAt(0), params.rvalAt(1))); + } + break; + default: + break; + } + return c_reflectionclass::os_invoke(c, s, params, hash, fatal); +} +Variant c_reflectionobject::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 4: + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getstartline()); + } + break; + case 15: + HASH_GUARD(0x40C7B30DCB439C8FLL, hasproperty) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasproperty(a0)); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmodifiers()); + } + break; + case 24: + HASH_GUARD(0x21820E7AA4733998LL, hasmethod) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasmethod(a0)); + } + break; + case 27: + HASH_GUARD(0x0F1AD0A8EC4C229BLL, getdefaultproperties) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdefaultproperties()); + } + break; + case 30: + HASH_GUARD(0x1BC5F3D87676509ELL, isinterface) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinterface()); + } + break; + case 34: + HASH_GUARD(0x323D9BCB05797B22LL, getstaticproperties) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getstaticproperties()); + } + break; + case 41: + HASH_GUARD(0x030CE1D6142F8C29LL, isinstance) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinstance(a0)); + } + HASH_GUARD(0x1D6B8CA358B49929LL, getextensionname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getextensionname()); + } + break; + case 42: + HASH_GUARD(0x16BA16CE6488AAAALL, getmethods) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmethods()); + } + HASH_GUARD(0x226F6E80CECD3CAALL, getconstructor) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getconstructor()); + } + break; + case 46: + HASH_GUARD(0x3C882D4A895F612ELL, getstaticpropertyvalue) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_getstaticpropertyvalue(a0)); + return (t_getstaticpropertyvalue(a0, a1)); + } + HASH_GUARD(0x06FB6A7DC3D795AELL, isfinal) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isfinal()); + } + break; + case 48: + HASH_GUARD(0x30A86FCA01FE7030LL, newinstance) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + int count = params.size(); + if (count <= 0) return (t_newinstance(count)); + return (t_newinstance(count,vargs)); + } + break; + case 52: + HASH_GUARD(0x3DB53E1FBD3C0734LL, getconstant) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getconstant(a0)); + } + break; + case 54: + HASH_GUARD(0x0D81ECE253A3B5B6LL, getmethod) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmethod(a0)); + } + break; + case 55: + HASH_GUARD(0x7460D945DA32FDB7LL, isabstract) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isabstract()); + } + break; + case 59: + HASH_GUARD(0x25D24435915E6E3BLL, getextension) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getextension()); + } + break; + case 60: + HASH_GUARD(0x0D8AAD6BA2BBCD3CLL, isinstantiable) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinstantiable()); + } + break; + case 63: + HASH_GUARD(0x54C2DC04C4A62B3FLL, hasconstant) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasconstant(a0)); + } + break; + case 67: + HASH_GUARD(0x67C15E3D98C00B43LL, getinterfaces) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getinterfaces()); + } + break; + case 68: + HASH_GUARD(0x1EB679C3602F4B44LL, getproperties) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getproperties()); + } + break; + case 71: + HASH_GUARD(0x0FD73627FB023047LL, getproperty) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getproperty(a0)); + } + break; + case 77: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfilename()); + } + break; + case 78: + HASH_GUARD(0x7D5A57B5370B68CELL, isiterateable) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isiterateable()); + } + break; + case 79: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinternal()); + } + break; + case 85: + HASH_GUARD(0x1CC71CB013143955LL, getconstants) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getconstants()); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + break; + case 100: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isuserdefined()); + } + break; + case 101: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getname()); + } + break; + case 102: + HASH_GUARD(0x2735DCC254EE5C66LL, newinstanceargs) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_newinstanceargs(a0)); + } + break; + case 104: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(o_getClassName(), a0, a1)); + } + break; + case 112: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getendline()); + } + break; + case 113: + HASH_GUARD(0x07ECA928E37717F1LL, setstaticpropertyvalue) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setstaticpropertyvalue(a0, a1), null); + } + break; + case 114: + HASH_GUARD(0x74F7FEDE16957472LL, getparentclass) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getparentclass()); + } + break; + case 120: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdoccomment()); + } + break; + case 123: + HASH_GUARD(0x28DC702215C7D6FBLL, implementsinterface) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_implementsinterface(a0)); + } + break; + case 126: + HASH_GUARD(0x373333991926C97ELL, issubclassof) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issubclassof(a0)); + } + break; + default: + break; + } + return c_reflectionclass::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_reflectionobject::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(c, a0, a1)); + } + break; + default: + break; + } + return c_reflectionclass::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_reflectionobject$os_get(const char *s) { + return c_reflectionobject::os_get(s, -1); +} +Variant &cw_reflectionobject$os_lval(const char *s) { + return c_reflectionobject::os_lval(s, -1); +} +Variant cw_reflectionobject$os_constant(const char *s) { + return c_reflectionobject::os_constant(s); +} +Variant cw_reflectionobject$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_reflectionobject::os_invoke(c, s, params, -1, fatal); +} +void c_reflectionobject::init() { + c_reflectionclass::init(); +} +/* SRC: classes/reflection.php line 473 */ +void c_reflectionobject::t___construct(Variant v_obj) { + INSTANCE_METHOD_INJECTION(ReflectionObject, ReflectionObject::__construct); + bool oldInCtor = gasInCtor(true); + m_info = x_hphp_get_class_info(v_obj); + gasInCtor(oldInCtor); +} /* function */ +/* SRC: classes/reflection.php line 477 */ +Variant c_reflectionobject::ti_export(const char* cls, Variant v_obj, CVarRef v_ret) { + STATIC_METHOD_INJECTION(ReflectionObject, ReflectionObject::export); + String v_str; + + v_obj = ((Object)(p_reflectionobject(p_reflectionobject(NEW(c_reflectionobject)())->create(v_obj)))); + v_str = toString(v_obj); + if (toBoolean(v_ret)) { + return v_str; + } + print(v_str); + return null; +} /* function */ +/* SRC: classes/reflection.php line 11 */ +Variant c_reflectionexception::os_get(const char *s, int64 hash) { + return c_exception::os_get(s, hash); +} +Variant &c_reflectionexception::os_lval(const char *s, int64 hash) { + return c_exception::os_lval(s, hash); +} +void c_reflectionexception::o_get(ArrayElementVec &props) const { + c_exception::o_get(props); +} +bool c_reflectionexception::o_exists(CStrRef s, int64 hash) const { + return c_exception::o_exists(s, hash); +} +Variant c_reflectionexception::o_get(CStrRef s, int64 hash) { + return c_exception::o_get(s, hash); +} +Variant c_reflectionexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_exception::o_set(s, hash, v, forInit); +} +Variant &c_reflectionexception::o_lval(CStrRef s, int64 hash) { + return c_exception::o_lval(s, hash); +} +Variant c_reflectionexception::os_constant(const char *s) { + return c_exception::os_constant(s); +} +IMPLEMENT_CLASS(reflectionexception) +ObjectData *c_reflectionexception::cloneImpl() { + c_reflectionexception *obj = NEW(c_reflectionexception)(); + cloneSet(obj); + return obj; +} +void c_reflectionexception::cloneSet(c_reflectionexception *clone) { + c_exception::cloneSet(clone); +} +Variant c_reflectionexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_exception::o_invoke(s, params, hash, fatal); +} +Variant c_reflectionexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + default: + break; + } + return c_exception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_reflectionexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_exception::os_invoke(c, s, params, hash, fatal); +} +Variant c_reflectionexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 3: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 14: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + default: + break; + } + return c_exception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_reflectionexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_exception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_reflectionexception$os_get(const char *s) { + return c_reflectionexception::os_get(s, -1); +} +Variant &cw_reflectionexception$os_lval(const char *s) { + return c_reflectionexception::os_lval(s, -1); +} +Variant cw_reflectionexception$os_constant(const char *s) { + return c_reflectionexception::os_constant(s); +} +Variant cw_reflectionexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_reflectionexception::os_invoke(c, s, params, -1, fatal); +} +void c_reflectionexception::init() { + c_exception::init(); +} +/* SRC: classes/reflection.php line 200 */ +Variant c_reflectionclass::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_reflectionclass::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_reflectionclass::o_get(ArrayElementVec &props) const { + props.push_back(NEW(ArrayElement)("name", m_name.isReferenced() ? ref(m_name) : m_name)); + props.push_back(NEW(ArrayElement)("info", m_info)); + c_ObjectData::o_get(props); +} +bool c_reflectionclass::o_exists(CStrRef s, int64 hash) const { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_EXISTS_STRING(0x0BCDB293DC3CBDDCLL, name, 4); + break; + case 2: + HASH_EXISTS_STRING(0x59E9384E33988B3ELL, info, 4); + break; + default: + break; + } + return c_ObjectData::o_exists(s, hash); +} +Variant c_reflectionclass::o_get(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_RETURN_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + case 2: + HASH_RETURN_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_get(s, hash); +} +Variant c_reflectionclass::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_SET_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + case 2: + HASH_SET_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_reflectionclass::o_lval(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 1) { + case 0: + HASH_RETURN_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + default: + break; + } + return c_ObjectData::o_lval(s, hash); +} +Variant c_reflectionclass::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(reflectionclass) +ObjectData *c_reflectionclass::create(Variant v_name) { + init(); + t___construct(v_name); + return this; +} +ObjectData *c_reflectionclass::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_reflectionclass::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +ObjectData *c_reflectionclass::cloneImpl() { + c_reflectionclass *obj = NEW(c_reflectionclass)(); + cloneSet(obj); + return obj; +} +void c_reflectionclass::cloneSet(c_reflectionclass *clone) { + clone->m_name = m_name.isReferenced() ? ref(m_name) : m_name; + clone->m_info = m_info; + ObjectData::cloneSet(clone); +} +Variant c_reflectionclass::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 4: + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + return (t_getstartline()); + } + break; + case 15: + HASH_GUARD(0x40C7B30DCB439C8FLL, hasproperty) { + return (t_hasproperty(params.rvalAt(0))); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + return (t_getmodifiers()); + } + break; + case 24: + HASH_GUARD(0x21820E7AA4733998LL, hasmethod) { + return (t_hasmethod(params.rvalAt(0))); + } + break; + case 27: + HASH_GUARD(0x0F1AD0A8EC4C229BLL, getdefaultproperties) { + return (t_getdefaultproperties()); + } + break; + case 30: + HASH_GUARD(0x1BC5F3D87676509ELL, isinterface) { + return (t_isinterface()); + } + break; + case 34: + HASH_GUARD(0x323D9BCB05797B22LL, getstaticproperties) { + return (t_getstaticproperties()); + } + break; + case 41: + HASH_GUARD(0x030CE1D6142F8C29LL, isinstance) { + return (t_isinstance(params.rvalAt(0))); + } + HASH_GUARD(0x1D6B8CA358B49929LL, getextensionname) { + return (t_getextensionname()); + } + break; + case 42: + HASH_GUARD(0x16BA16CE6488AAAALL, getmethods) { + return (t_getmethods()); + } + HASH_GUARD(0x226F6E80CECD3CAALL, getconstructor) { + return (t_getconstructor()); + } + break; + case 46: + HASH_GUARD(0x3C882D4A895F612ELL, getstaticpropertyvalue) { + int count = params.size(); + if (count <= 1) return (t_getstaticpropertyvalue(params.rvalAt(0))); + return (t_getstaticpropertyvalue(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x06FB6A7DC3D795AELL, isfinal) { + return (t_isfinal()); + } + break; + case 48: + HASH_GUARD(0x30A86FCA01FE7030LL, newinstance) { + int count = params.size(); + if (count <= 0) return (t_newinstance(count)); + return (t_newinstance(count,params.slice(0, count - 0, false))); + } + break; + case 52: + HASH_GUARD(0x3DB53E1FBD3C0734LL, getconstant) { + return (t_getconstant(params.rvalAt(0))); + } + break; + case 54: + HASH_GUARD(0x0D81ECE253A3B5B6LL, getmethod) { + return (t_getmethod(params.rvalAt(0))); + } + break; + case 55: + HASH_GUARD(0x7460D945DA32FDB7LL, isabstract) { + return (t_isabstract()); + } + break; + case 59: + HASH_GUARD(0x25D24435915E6E3BLL, getextension) { + return (t_getextension()); + } + break; + case 60: + HASH_GUARD(0x0D8AAD6BA2BBCD3CLL, isinstantiable) { + return (t_isinstantiable()); + } + break; + case 63: + HASH_GUARD(0x54C2DC04C4A62B3FLL, hasconstant) { + return (t_hasconstant(params.rvalAt(0))); + } + break; + case 67: + HASH_GUARD(0x67C15E3D98C00B43LL, getinterfaces) { + return (t_getinterfaces()); + } + break; + case 68: + HASH_GUARD(0x1EB679C3602F4B44LL, getproperties) { + return (t_getproperties()); + } + break; + case 71: + HASH_GUARD(0x0FD73627FB023047LL, getproperty) { + return (t_getproperty(params.rvalAt(0))); + } + break; + case 77: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + return (t_getfilename()); + } + break; + case 78: + HASH_GUARD(0x7D5A57B5370B68CELL, isiterateable) { + return (t_isiterateable()); + } + break; + case 79: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + return (t_isinternal()); + } + break; + case 85: + HASH_GUARD(0x1CC71CB013143955LL, getconstants) { + return (t_getconstants()); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + break; + case 100: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + return (t_isuserdefined()); + } + break; + case 101: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 102: + HASH_GUARD(0x2735DCC254EE5C66LL, newinstanceargs) { + return (t_newinstanceargs(params.rvalAt(0))); + } + break; + case 104: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), params.rvalAt(0), params.rvalAt(1))); + } + break; + case 112: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + return (t_getendline()); + } + break; + case 113: + HASH_GUARD(0x07ECA928E37717F1LL, setstaticpropertyvalue) { + return (t_setstaticpropertyvalue(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + case 114: + HASH_GUARD(0x74F7FEDE16957472LL, getparentclass) { + return (t_getparentclass()); + } + break; + case 120: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + case 123: + HASH_GUARD(0x28DC702215C7D6FBLL, implementsinterface) { + return (t_implementsinterface(params.rvalAt(0))); + } + break; + case 126: + HASH_GUARD(0x373333991926C97ELL, issubclassof) { + return (t_issubclassof(params.rvalAt(0))); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_reflectionclass::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 4: + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + return (t_getstartline()); + } + break; + case 15: + HASH_GUARD(0x40C7B30DCB439C8FLL, hasproperty) { + return (t_hasproperty(a0)); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + return (t_getmodifiers()); + } + break; + case 24: + HASH_GUARD(0x21820E7AA4733998LL, hasmethod) { + return (t_hasmethod(a0)); + } + break; + case 27: + HASH_GUARD(0x0F1AD0A8EC4C229BLL, getdefaultproperties) { + return (t_getdefaultproperties()); + } + break; + case 30: + HASH_GUARD(0x1BC5F3D87676509ELL, isinterface) { + return (t_isinterface()); + } + break; + case 34: + HASH_GUARD(0x323D9BCB05797B22LL, getstaticproperties) { + return (t_getstaticproperties()); + } + break; + case 41: + HASH_GUARD(0x030CE1D6142F8C29LL, isinstance) { + return (t_isinstance(a0)); + } + HASH_GUARD(0x1D6B8CA358B49929LL, getextensionname) { + return (t_getextensionname()); + } + break; + case 42: + HASH_GUARD(0x16BA16CE6488AAAALL, getmethods) { + return (t_getmethods()); + } + HASH_GUARD(0x226F6E80CECD3CAALL, getconstructor) { + return (t_getconstructor()); + } + break; + case 46: + HASH_GUARD(0x3C882D4A895F612ELL, getstaticpropertyvalue) { + if (count <= 1) return (t_getstaticpropertyvalue(a0)); + return (t_getstaticpropertyvalue(a0, a1)); + } + HASH_GUARD(0x06FB6A7DC3D795AELL, isfinal) { + return (t_isfinal()); + } + break; + case 48: + HASH_GUARD(0x30A86FCA01FE7030LL, newinstance) { + if (count <= 0) return (t_newinstance(count)); + Array params; + if (count >= 1) params.append(a0); + if (count >= 2) params.append(a1); + if (count >= 3) params.append(a2); + if (count >= 4) params.append(a3); + if (count >= 5) params.append(a4); + if (count >= 6) params.append(a5); + return (t_newinstance(count,params)); + } + break; + case 52: + HASH_GUARD(0x3DB53E1FBD3C0734LL, getconstant) { + return (t_getconstant(a0)); + } + break; + case 54: + HASH_GUARD(0x0D81ECE253A3B5B6LL, getmethod) { + return (t_getmethod(a0)); + } + break; + case 55: + HASH_GUARD(0x7460D945DA32FDB7LL, isabstract) { + return (t_isabstract()); + } + break; + case 59: + HASH_GUARD(0x25D24435915E6E3BLL, getextension) { + return (t_getextension()); + } + break; + case 60: + HASH_GUARD(0x0D8AAD6BA2BBCD3CLL, isinstantiable) { + return (t_isinstantiable()); + } + break; + case 63: + HASH_GUARD(0x54C2DC04C4A62B3FLL, hasconstant) { + return (t_hasconstant(a0)); + } + break; + case 67: + HASH_GUARD(0x67C15E3D98C00B43LL, getinterfaces) { + return (t_getinterfaces()); + } + break; + case 68: + HASH_GUARD(0x1EB679C3602F4B44LL, getproperties) { + return (t_getproperties()); + } + break; + case 71: + HASH_GUARD(0x0FD73627FB023047LL, getproperty) { + return (t_getproperty(a0)); + } + break; + case 77: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + return (t_getfilename()); + } + break; + case 78: + HASH_GUARD(0x7D5A57B5370B68CELL, isiterateable) { + return (t_isiterateable()); + } + break; + case 79: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + return (t_isinternal()); + } + break; + case 85: + HASH_GUARD(0x1CC71CB013143955LL, getconstants) { + return (t_getconstants()); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + break; + case 100: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + return (t_isuserdefined()); + } + break; + case 101: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 102: + HASH_GUARD(0x2735DCC254EE5C66LL, newinstanceargs) { + return (t_newinstanceargs(a0)); + } + break; + case 104: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), a0, a1)); + } + break; + case 112: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + return (t_getendline()); + } + break; + case 113: + HASH_GUARD(0x07ECA928E37717F1LL, setstaticpropertyvalue) { + return (t_setstaticpropertyvalue(a0, a1), null); + } + break; + case 114: + HASH_GUARD(0x74F7FEDE16957472LL, getparentclass) { + return (t_getparentclass()); + } + break; + case 120: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + case 123: + HASH_GUARD(0x28DC702215C7D6FBLL, implementsinterface) { + return (t_implementsinterface(a0)); + } + break; + case 126: + HASH_GUARD(0x373333991926C97ELL, issubclassof) { + return (t_issubclassof(a0)); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_reflectionclass::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(c, params.rvalAt(0), params.rvalAt(1))); + } + break; + default: + break; + } + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_reflectionclass::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 4: + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getstartline()); + } + break; + case 15: + HASH_GUARD(0x40C7B30DCB439C8FLL, hasproperty) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasproperty(a0)); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmodifiers()); + } + break; + case 24: + HASH_GUARD(0x21820E7AA4733998LL, hasmethod) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasmethod(a0)); + } + break; + case 27: + HASH_GUARD(0x0F1AD0A8EC4C229BLL, getdefaultproperties) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdefaultproperties()); + } + break; + case 30: + HASH_GUARD(0x1BC5F3D87676509ELL, isinterface) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinterface()); + } + break; + case 34: + HASH_GUARD(0x323D9BCB05797B22LL, getstaticproperties) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getstaticproperties()); + } + break; + case 41: + HASH_GUARD(0x030CE1D6142F8C29LL, isinstance) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinstance(a0)); + } + HASH_GUARD(0x1D6B8CA358B49929LL, getextensionname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getextensionname()); + } + break; + case 42: + HASH_GUARD(0x16BA16CE6488AAAALL, getmethods) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmethods()); + } + HASH_GUARD(0x226F6E80CECD3CAALL, getconstructor) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getconstructor()); + } + break; + case 46: + HASH_GUARD(0x3C882D4A895F612ELL, getstaticpropertyvalue) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_getstaticpropertyvalue(a0)); + return (t_getstaticpropertyvalue(a0, a1)); + } + HASH_GUARD(0x06FB6A7DC3D795AELL, isfinal) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isfinal()); + } + break; + case 48: + HASH_GUARD(0x30A86FCA01FE7030LL, newinstance) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + int count = params.size(); + if (count <= 0) return (t_newinstance(count)); + return (t_newinstance(count,vargs)); + } + break; + case 52: + HASH_GUARD(0x3DB53E1FBD3C0734LL, getconstant) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getconstant(a0)); + } + break; + case 54: + HASH_GUARD(0x0D81ECE253A3B5B6LL, getmethod) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmethod(a0)); + } + break; + case 55: + HASH_GUARD(0x7460D945DA32FDB7LL, isabstract) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isabstract()); + } + break; + case 59: + HASH_GUARD(0x25D24435915E6E3BLL, getextension) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getextension()); + } + break; + case 60: + HASH_GUARD(0x0D8AAD6BA2BBCD3CLL, isinstantiable) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinstantiable()); + } + break; + case 63: + HASH_GUARD(0x54C2DC04C4A62B3FLL, hasconstant) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasconstant(a0)); + } + break; + case 67: + HASH_GUARD(0x67C15E3D98C00B43LL, getinterfaces) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getinterfaces()); + } + break; + case 68: + HASH_GUARD(0x1EB679C3602F4B44LL, getproperties) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getproperties()); + } + break; + case 71: + HASH_GUARD(0x0FD73627FB023047LL, getproperty) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getproperty(a0)); + } + break; + case 77: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfilename()); + } + break; + case 78: + HASH_GUARD(0x7D5A57B5370B68CELL, isiterateable) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isiterateable()); + } + break; + case 79: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinternal()); + } + break; + case 85: + HASH_GUARD(0x1CC71CB013143955LL, getconstants) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getconstants()); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + break; + case 100: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isuserdefined()); + } + break; + case 101: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getname()); + } + break; + case 102: + HASH_GUARD(0x2735DCC254EE5C66LL, newinstanceargs) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_newinstanceargs(a0)); + } + break; + case 104: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(o_getClassName(), a0, a1)); + } + break; + case 112: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getendline()); + } + break; + case 113: + HASH_GUARD(0x07ECA928E37717F1LL, setstaticpropertyvalue) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setstaticpropertyvalue(a0, a1), null); + } + break; + case 114: + HASH_GUARD(0x74F7FEDE16957472LL, getparentclass) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getparentclass()); + } + break; + case 120: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdoccomment()); + } + break; + case 123: + HASH_GUARD(0x28DC702215C7D6FBLL, implementsinterface) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_implementsinterface(a0)); + } + break; + case 126: + HASH_GUARD(0x373333991926C97ELL, issubclassof) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issubclassof(a0)); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_reflectionclass::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(c, a0, a1)); + } + break; + default: + break; + } + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_reflectionclass$os_get(const char *s) { + return c_reflectionclass::os_get(s, -1); +} +Variant &cw_reflectionclass$os_lval(const char *s) { + return c_reflectionclass::os_lval(s, -1); +} +Variant cw_reflectionclass$os_constant(const char *s) { + return c_reflectionclass::os_constant(s); +} +Variant cw_reflectionclass$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_reflectionclass::os_invoke(c, s, params, -1, fatal); +} +void c_reflectionclass::init() { +} +/* SRC: classes/reflection.php line 204 */ +void c_reflectionclass::t___construct(Variant v_name) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::__construct); + bool oldInCtor = gasInCtor(true); + p_reflectionclass v_p; + Primitive v_interface = 0; + Variant v__; + + m_info = x_hphp_get_class_info(v_name); + if (empty(m_info)) { + if (x_is_object(v_name)) v_name = x_get_class(v_name); + throw_exception(((Object)(p_reflectionexception(p_reflectionexception(NEW(c_reflectionexception)())->create(concat3("Class ", toString(v_name), " does not exist")))))); + } + m_name = m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); + if (!(empty(m_info, "parent", 0x16E2F26FFB10FD8CLL))) { + ((Object)(v_p = ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(m_info.rvalAt("parent", 0x16E2F26FFB10FD8CLL))))))); + lval(m_info.lvalAt("interfaces", 0x0C5BD661CFB8E254LL)) += v_p->m_info.rvalAt("interfaces", 0x0C5BD661CFB8E254LL); + lval(m_info.lvalAt("properties", 0x5D7B5CC390269404LL)) += v_p->m_info.rvalAt("properties", 0x5D7B5CC390269404LL); + lval(m_info.lvalAt("methods", 0x2A7E90235B229AD5LL)) += v_p->m_info.rvalAt("methods", 0x2A7E90235B229AD5LL); + lval(m_info.lvalAt("constants", 0x3A127EB7623AE369LL)) += v_p->m_info.rvalAt("constants", 0x3A127EB7623AE369LL); + } + { + LOOP_COUNTER(7); + Variant map8 = m_info.rvalAt("interfaces", 0x0C5BD661CFB8E254LL); + for (ArrayIterPtr iter9 = map8.begin("reflectionclass"); !iter9->end(); iter9->next()) { + LOOP_COUNTER_CHECK(7); + v__ = iter9->second(); + v_interface = iter9->first(); + { + ((Object)(v_p = ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(v_interface)))))); + lval(m_info.lvalAt("methods", 0x2A7E90235B229AD5LL)) += v_p->m_info.rvalAt("methods", 0x2A7E90235B229AD5LL); + } + } + } + gasInCtor(oldInCtor); +} /* function */ +/* SRC: classes/reflection.php line 226 */ +String c_reflectionclass::t___tostring() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::__toString); + return toString(null); +} /* function */ +/* SRC: classes/reflection.php line 229 */ +Variant c_reflectionclass::ti_export(const char* cls, CVarRef v_name, CVarRef v_ret) { + STATIC_METHOD_INJECTION(ReflectionClass, ReflectionClass::export); + p_reflectionclass v_obj; + String v_str; + + ((Object)(v_obj = ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(v_name)))))); + v_str = toString(((Object)(v_obj))); + if (toBoolean(v_ret)) { + return v_str; + } + print(v_str); + return null; +} /* function */ +/* SRC: classes/reflection.php line 238 */ +Variant c_reflectionclass::t_getname() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getName); + return m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); +} /* function */ +/* SRC: classes/reflection.php line 242 */ +Variant c_reflectionclass::t_isinternal() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::isInternal); + return m_info.rvalAt("internal", 0x575D95D69332A8ACLL); +} /* function */ +/* SRC: classes/reflection.php line 246 */ +bool c_reflectionclass::t_isuserdefined() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::isUserDefined); + return !(toBoolean(m_info.rvalAt("internal", 0x575D95D69332A8ACLL))); +} /* function */ +/* SRC: classes/reflection.php line 250 */ +bool c_reflectionclass::t_isinstantiable() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::isInstantiable); + return !(toBoolean(m_info.rvalAt("abstract", 0x475C06CE12C8A8A6LL))); +} /* function */ +/* SRC: classes/reflection.php line 254 */ +bool c_reflectionclass::t_hasconstant(CVarRef v_name) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::hasConstant); + return isset(m_info.rvalAt("constants", 0x3A127EB7623AE369LL), v_name); +} /* function */ +/* SRC: classes/reflection.php line 258 */ +bool c_reflectionclass::t_hasmethod(CVarRef v_name) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::hasMethod); + return isset(m_info.rvalAt("methods", 0x2A7E90235B229AD5LL), v_name); +} /* function */ +/* SRC: classes/reflection.php line 262 */ +bool c_reflectionclass::t_hasproperty(CVarRef v_name) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::hasProperty); + return isset(m_info.rvalAt("properties", 0x5D7B5CC390269404LL), v_name); +} /* function */ +/* SRC: classes/reflection.php line 266 */ +Variant c_reflectionclass::t_getfilename() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getFileName); + return m_info.rvalAt("file", 0x612E37678CE7DB5BLL); +} /* function */ +/* SRC: classes/reflection.php line 270 */ +Variant c_reflectionclass::t_getstartline() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getStartLine); + return m_info.rvalAt("line1", 0x7E7BD613D4C67725LL); +} /* function */ +/* SRC: classes/reflection.php line 274 */ +Variant c_reflectionclass::t_getendline() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getEndLine); + return m_info.rvalAt("line2", 0x641B12C5BEFE32A8LL); +} /* function */ +/* SRC: classes/reflection.php line 278 */ +Variant c_reflectionclass::t_getdoccomment() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getDocComment); + return m_info.rvalAt("doc", 0x16758C759CFA17A6LL); +} /* function */ +/* SRC: classes/reflection.php line 282 */ +Variant c_reflectionclass::t_getconstructor() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getConstructor); + if (t_hasmethod("__construct")) { + return ((Object)(t_getmethod("__construct"))); + } + if (t_hasmethod(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL))) { + return ((Object)(t_getmethod(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)))); + } + return null; +} /* function */ +/* SRC: classes/reflection.php line 292 */ +p_reflectionmethod c_reflectionclass::t_getmethod(CVarRef v_name) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getMethod); + String v_lname; + Variant v_class; + p_reflectionmethod v_ret; + + v_lname = x_strtolower(toString(v_name)); + if (!(isset(m_info.rvalAt("methods", 0x2A7E90235B229AD5LL), v_lname))) { + v_class = m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); + throw_exception(((Object)(p_reflectionexception(p_reflectionexception(NEW(c_reflectionexception)())->create(concat5("Method ", toString(v_class), "::", toString(v_name), " does not exist")))))); + } + ((Object)(v_ret = ((Object)(p_reflectionmethod(p_reflectionmethod(NEW(c_reflectionmethod)())->create(null, null)))))); + v_ret->m_info = m_info.rvalAt("methods", 0x2A7E90235B229AD5LL).rvalAt(v_lname); + v_ret->m_name = v_lname; + v_ret->m_class = m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); + return ((Object)(v_ret)); +} /* function */ +/* SRC: classes/reflection.php line 306 */ +Array c_reflectionclass::t_getmethods() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getMethods); + Array v_ret; + Primitive v_name = 0; + Variant v__; + + v_ret = SystemScalarArrays::ssa_[0]; + { + LOOP_COUNTER(10); + Variant map11 = m_info.rvalAt("methods", 0x2A7E90235B229AD5LL); + for (ArrayIterPtr iter12 = map11.begin("reflectionclass"); !iter12->end(); iter12->next()) { + LOOP_COUNTER_CHECK(10); + v__ = iter12->second(); + v_name = iter12->first(); + { + v_ret.append((((Object)(t_getmethod(v_name))))); + } + } + } + return v_ret; +} /* function */ +/* SRC: classes/reflection.php line 314 */ +p_reflectionproperty c_reflectionclass::t_getproperty(CVarRef v_name) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getProperty); + Variant v_class; + p_reflectionproperty v_ret; + + if (!(isset(m_info.rvalAt("properties", 0x5D7B5CC390269404LL), v_name))) { + v_class = m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); + throw_exception(((Object)(p_reflectionexception(p_reflectionexception(NEW(c_reflectionexception)())->create(concat5("Property ", toString(v_class), "::", toString(v_name), " does not exist")))))); + } + ((Object)(v_ret = ((Object)(p_reflectionproperty(p_reflectionproperty(NEW(c_reflectionproperty)())->create(null, null)))))); + v_ret->m_info = m_info.rvalAt("properties", 0x5D7B5CC390269404LL).rvalAt(v_name); + v_ret->m_name = v_name; + v_ret->m_class = m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); + return ((Object)(v_ret)); +} /* function */ +/* SRC: classes/reflection.php line 327 */ +Array c_reflectionclass::t_getproperties() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getProperties); + Array v_ret; + Primitive v_name = 0; + Variant v__; + + v_ret = SystemScalarArrays::ssa_[0]; + { + LOOP_COUNTER(13); + Variant map14 = m_info.rvalAt("properties", 0x5D7B5CC390269404LL); + for (ArrayIterPtr iter15 = map14.begin("reflectionclass"); !iter15->end(); iter15->next()) { + LOOP_COUNTER_CHECK(13); + v__ = iter15->second(); + v_name = iter15->first(); + { + v_ret.append((((Object)(t_getproperty(v_name))))); + } + } + } + return v_ret; +} /* function */ +/* SRC: classes/reflection.php line 335 */ +Variant c_reflectionclass::t_getconstants() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getConstants); + return m_info.rvalAt("constants", 0x3A127EB7623AE369LL); +} /* function */ +/* SRC: classes/reflection.php line 339 */ +Variant c_reflectionclass::t_getconstant(CVarRef v_name) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getConstant); + Variant v_class; + + if (!(isset(m_info.rvalAt("constants", 0x3A127EB7623AE369LL), v_name))) { + v_class = m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); + throw_exception(((Object)(p_reflectionexception(p_reflectionexception(NEW(c_reflectionexception)())->create(concat5("Class constant ", toString(v_class), "::", toString(v_name), " does not exist")))))); + } + return m_info.rvalAt("constants", 0x3A127EB7623AE369LL).rvalAt(v_name); +} /* function */ +/* SRC: classes/reflection.php line 347 */ +Variant c_reflectionclass::t_getinterfaces() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getInterfaces); + Variant v_ret; + Primitive v_name = 0; + Variant v__; + p_reflectionclass v_cls; + + v_ret = SystemScalarArrays::ssa_[0]; + { + LOOP_COUNTER(16); + Variant map17 = m_info.rvalAt("interfaces", 0x0C5BD661CFB8E254LL); + for (ArrayIterPtr iter18 = map17.begin("reflectionclass"); !iter18->end(); iter18->next()) { + LOOP_COUNTER_CHECK(16); + v__ = iter18->second(); + v_name = iter18->first(); + { + ((Object)(v_cls = ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(v_name)))))); + if (toBoolean(v_cls->t_isinterface())) { + v_ret.set(v_name, (((Object)(v_cls)))); + } + } + } + } + return v_ret; +} /* function */ +/* SRC: classes/reflection.php line 358 */ +Variant c_reflectionclass::t_isinterface() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::isInterface); + return m_info.rvalAt("interface", 0x448B10707228E959LL); +} /* function */ +/* SRC: classes/reflection.php line 362 */ +Variant c_reflectionclass::t_isabstract() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::isAbstract); + return m_info.rvalAt("abstract", 0x475C06CE12C8A8A6LL); +} /* function */ +/* SRC: classes/reflection.php line 366 */ +Variant c_reflectionclass::t_isfinal() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::isFinal); + return m_info.rvalAt("final", 0x5192930B2145036ELL); +} /* function */ +/* SRC: classes/reflection.php line 370 */ +Variant c_reflectionclass::t_getmodifiers() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getModifiers); + return m_info.rvalAt("modifiers", 0x2CAF244C9F244C80LL); +} /* function */ +/* SRC: classes/reflection.php line 374 */ +bool c_reflectionclass::t_isinstance(CVarRef v_obj) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::isInstance); + return x_hphp_instanceof(toObject(v_obj), toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL))); +} /* function */ +/* SRC: classes/reflection.php line 378 */ +Object c_reflectionclass::t_newinstance(int num_args, Array args /* = Array() */) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::newInstance); + Array v_args; + + v_args = func_get_args(num_args, Array(),args); + return x_hphp_create_object(toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)), v_args); +} /* function */ +/* SRC: classes/reflection.php line 383 */ +Object c_reflectionclass::t_newinstanceargs(CVarRef v_args) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::newInstanceArgs); + return x_hphp_create_object(toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)), toArray(v_args)); +} /* function */ +/* SRC: classes/reflection.php line 387 */ +Variant c_reflectionclass::t_getparentclass() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getParentClass); + if (empty(m_info, "parent", 0x16E2F26FFB10FD8CLL)) { + return false; + } + return ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(m_info.rvalAt("parent", 0x16E2F26FFB10FD8CLL))))); +} /* function */ +/* SRC: classes/reflection.php line 394 */ +Variant c_reflectionclass::t_issubclassof(Variant v_cls) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::isSubclassOf); + Variant eo_0; + Variant eo_1; + Primitive v_name = 0; + Variant v__; + + if (instanceOf(v_cls, "ReflectionClass")) { + v_cls = v_cls.o_get("info", 0x59E9384E33988B3ELL).rvalAt("name", 0x0BCDB293DC3CBDDCLL); + } + { + LOOP_COUNTER(19); + Variant map20 = m_info.rvalAt("interfaces", 0x0C5BD661CFB8E254LL); + for (ArrayIterPtr iter21 = map20.begin("reflectionclass"); !iter21->end(); iter21->next()) { + LOOP_COUNTER_CHECK(19); + v__ = iter21->second(); + v_name = iter21->first(); + { + if (equal(x_strcasecmp(toString(v_cls), toString(v_name)), 0LL)) { + return true; + } + } + } + } + if (empty(m_info, "parent", 0x16E2F26FFB10FD8CLL)) { + return false; + } + if (equal(x_strcasecmp(toString(v_cls), toString(m_info.rvalAt("parent", 0x16E2F26FFB10FD8CLL))), 0LL)) { + return true; + } + return (assignCallTemp(eo_0, toObject(t_getparentclass())),assignCallTemp(eo_1, ref(v_cls)),eo_0.o_invoke("isSubclassOf", Array(ArrayInit(1).set(0, ArrayElement(eo_1)).create()), 0x373333991926C97ELL)); +} /* function */ +/* SRC: classes/reflection.php line 412 */ +Variant c_reflectionclass::t_getstaticproperties() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getStaticProperties); + Variant v_ret; + Variant v_prop; + + v_ret = SystemScalarArrays::ssa_[0]; + { + LOOP_COUNTER(22); + Variant map23 = t_getproperties(); + for (ArrayIterPtr iter24 = map23.begin("reflectionclass"); !iter24->end(); iter24->next()) { + LOOP_COUNTER_CHECK(22); + v_prop = iter24->second(); + { + if (toBoolean(v_prop.o_invoke_few_args("isStatic", 0x7A15DC56E8CC0B19LL, 0))) { + v_ret.set(v_prop.o_get("name", 0x0BCDB293DC3CBDDCLL), (v_prop)); + } + } + } + } + return v_ret; +} /* function */ +/* SRC: classes/reflection.php line 422 */ +Variant c_reflectionclass::t_getstaticpropertyvalue(CVarRef v_name, CVarRef v_default /* = null_variant */) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getStaticPropertyValue); + if (t_hasproperty(v_name) && toBoolean(t_getproperty(v_name)->t_isstatic())) { + return x_hphp_get_static_property(toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)), toString(v_name)); + } + return v_default; +} /* function */ +/* SRC: classes/reflection.php line 430 */ +void c_reflectionclass::t_setstaticpropertyvalue(CVarRef v_name, CVarRef v_value) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::setStaticPropertyValue); + x_hphp_set_static_property(toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)), toString(v_name), v_value); +} /* function */ +/* SRC: classes/reflection.php line 434 */ +Variant c_reflectionclass::t_getdefaultproperties() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getDefaultProperties); + Variant v_ret; + Variant v_prop; + + v_ret = SystemScalarArrays::ssa_[0]; + { + LOOP_COUNTER(25); + Variant map26 = t_getproperties(); + for (ArrayIterPtr iter27 = map26.begin("reflectionclass"); !iter27->end(); iter27->next()) { + LOOP_COUNTER_CHECK(25); + v_prop = iter27->second(); + { + if (toBoolean(v_prop.o_invoke_few_args("isDefault", 0x384A52597AB11F15LL, 0))) { + v_ret.set(v_prop.o_get("name", 0x0BCDB293DC3CBDDCLL), (v_prop)); + } + } + } + } + return v_ret; +} /* function */ +/* SRC: classes/reflection.php line 444 */ +Variant c_reflectionclass::t_isiterateable() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::isIterateable); + return t_issubclassof("ArrayAccess"); +} /* function */ +/* SRC: classes/reflection.php line 448 */ +bool c_reflectionclass::t_implementsinterface(Variant v_cls) { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::implementsInterface); + Primitive v_name = 0; + Variant v__; + + if (instanceOf(v_cls, "ReflectionClass")) { + v_cls = v_cls.o_get("info", 0x59E9384E33988B3ELL).rvalAt("name", 0x0BCDB293DC3CBDDCLL); + } + { + LOOP_COUNTER(28); + Variant map29 = m_info.rvalAt("interfaces", 0x0C5BD661CFB8E254LL); + for (ArrayIterPtr iter30 = map29.begin("reflectionclass"); !iter30->end(); iter30->next()) { + LOOP_COUNTER_CHECK(28); + v__ = iter30->second(); + v_name = iter30->first(); + { + if (equal(x_strcasecmp(toString(v_cls), toString(v_name)), 0LL)) { + return true; + } + } + } + } + return false; +} /* function */ +/* SRC: classes/reflection.php line 460 */ +Variant c_reflectionclass::t_getextension() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getExtension); + return m_info.rvalAt("extension", 0x3E8C2484E9BF4500LL); +} /* function */ +/* SRC: classes/reflection.php line 464 */ +Variant c_reflectionclass::t_getextensionname() { + INSTANCE_METHOD_INJECTION(ReflectionClass, ReflectionClass::getExtensionName); + return m_info.rvalAt("extension", 0x3E8C2484E9BF4500LL).o_invoke_few_args("getName", 0x23F51CDECC198965LL, 0); +} /* function */ +/* SRC: classes/reflection.php line 676 */ +Variant c_reflectionextension::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_reflectionextension::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_reflectionextension::o_get(ArrayElementVec &props) const { + props.push_back(NEW(ArrayElement)("name", m_name.isReferenced() ? ref(m_name) : m_name)); + props.push_back(NEW(ArrayElement)("info", m_info)); + c_ObjectData::o_get(props); +} +bool c_reflectionextension::o_exists(CStrRef s, int64 hash) const { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_EXISTS_STRING(0x0BCDB293DC3CBDDCLL, name, 4); + break; + case 2: + HASH_EXISTS_STRING(0x59E9384E33988B3ELL, info, 4); + break; + default: + break; + } + return c_ObjectData::o_exists(s, hash); +} +Variant c_reflectionextension::o_get(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_RETURN_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + case 2: + HASH_RETURN_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_get(s, hash); +} +Variant c_reflectionextension::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_SET_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + case 2: + HASH_SET_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_reflectionextension::o_lval(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 1) { + case 0: + HASH_RETURN_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + default: + break; + } + return c_ObjectData::o_lval(s, hash); +} +Variant c_reflectionextension::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(reflectionextension) +ObjectData *c_reflectionextension::create(Variant v_name) { + init(); + t___construct(v_name); + return this; +} +ObjectData *c_reflectionextension::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_reflectionextension::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +ObjectData *c_reflectionextension::cloneImpl() { + c_reflectionextension *obj = NEW(c_reflectionextension)(); + cloneSet(obj); + return obj; +} +void c_reflectionextension::cloneSet(c_reflectionextension *clone) { + clone->m_name = m_name.isReferenced() ? ref(m_name) : m_name; + clone->m_info = m_info; + ObjectData::cloneSet(clone); +} +Variant c_reflectionextension::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 2: + HASH_GUARD(0x0113D73FC859EDC2LL, getclasses) { + return (t_getclasses()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x652BDFA6E22F17AFLL, getfunctions) { + return (t_getfunctions()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x5CE2786E11341594LL, getclassnames) { + return (t_getclassnames()); + } + break; + case 21: + HASH_GUARD(0x306B5F4D1D03D335LL, getinientries) { + return (t_getinientries()); + } + HASH_GUARD(0x1CC71CB013143955LL, getconstants) { + return (t_getconstants()); + } + break; + case 22: + HASH_GUARD(0x7521E8833BE3D316LL, getversion) { + return (t_getversion()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + HASH_GUARD(0x0F2EF58F157D479FLL, info) { + return (t_info()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_reflectionextension::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 2: + HASH_GUARD(0x0113D73FC859EDC2LL, getclasses) { + return (t_getclasses()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), a0, a1)); + } + break; + case 15: + HASH_GUARD(0x652BDFA6E22F17AFLL, getfunctions) { + return (t_getfunctions()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x5CE2786E11341594LL, getclassnames) { + return (t_getclassnames()); + } + break; + case 21: + HASH_GUARD(0x306B5F4D1D03D335LL, getinientries) { + return (t_getinientries()); + } + HASH_GUARD(0x1CC71CB013143955LL, getconstants) { + return (t_getconstants()); + } + break; + case 22: + HASH_GUARD(0x7521E8833BE3D316LL, getversion) { + return (t_getversion()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + HASH_GUARD(0x0F2EF58F157D479FLL, info) { + return (t_info()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_reflectionextension::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(c, params.rvalAt(0), params.rvalAt(1))); + } + break; + default: + break; + } + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_reflectionextension::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 2: + HASH_GUARD(0x0113D73FC859EDC2LL, getclasses) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getclasses()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(o_getClassName(), a0, a1)); + } + break; + case 15: + HASH_GUARD(0x652BDFA6E22F17AFLL, getfunctions) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfunctions()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x5CE2786E11341594LL, getclassnames) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getclassnames()); + } + break; + case 21: + HASH_GUARD(0x306B5F4D1D03D335LL, getinientries) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getinientries()); + } + HASH_GUARD(0x1CC71CB013143955LL, getconstants) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getconstants()); + } + break; + case 22: + HASH_GUARD(0x7521E8833BE3D316LL, getversion) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getversion()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + HASH_GUARD(0x0F2EF58F157D479FLL, info) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_info()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_reflectionextension::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(c, a0, a1)); + } + break; + default: + break; + } + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_reflectionextension$os_get(const char *s) { + return c_reflectionextension::os_get(s, -1); +} +Variant &cw_reflectionextension$os_lval(const char *s) { + return c_reflectionextension::os_lval(s, -1); +} +Variant cw_reflectionextension$os_constant(const char *s) { + return c_reflectionextension::os_constant(s); +} +Variant cw_reflectionextension$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_reflectionextension::os_invoke(c, s, params, -1, fatal); +} +void c_reflectionextension::init() { +} +/* SRC: classes/reflection.php line 680 */ +void c_reflectionextension::t___construct(Variant v_name) { + INSTANCE_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::__construct); + bool oldInCtor = gasInCtor(true); + m_info = x_hphp_get_extension_info(toString(v_name)); + gasInCtor(oldInCtor); +} /* function */ +/* SRC: classes/reflection.php line 684 */ +String c_reflectionextension::t___tostring() { + INSTANCE_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::__toString); + return toString(null); +} /* function */ +/* SRC: classes/reflection.php line 687 */ +Variant c_reflectionextension::ti_export(const char* cls, CVarRef v_name, CVarRef v_ret) { + STATIC_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::export); + p_reflectionextension v_obj; + String v_str; + + ((Object)(v_obj = ((Object)(p_reflectionextension(p_reflectionextension(NEW(c_reflectionextension)())->create(v_name)))))); + v_str = toString(((Object)(v_obj))); + if (toBoolean(v_ret)) { + return v_str; + } + print(v_str); + return null; +} /* function */ +/* SRC: classes/reflection.php line 696 */ +Variant c_reflectionextension::t_getname() { + INSTANCE_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::getName); + return m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); +} /* function */ +/* SRC: classes/reflection.php line 700 */ +Variant c_reflectionextension::t_getversion() { + INSTANCE_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::getVersion); + return m_info.rvalAt("version", 0x2AF5F0847CD91DB4LL); +} /* function */ +/* SRC: classes/reflection.php line 704 */ +Variant c_reflectionextension::t_getfunctions() { + INSTANCE_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::getFunctions); + return m_info.rvalAt("functions", 0x345241CAC8396B02LL); +} /* function */ +/* SRC: classes/reflection.php line 708 */ +Variant c_reflectionextension::t_getconstants() { + INSTANCE_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::getConstants); + return m_info.rvalAt("constants", 0x3A127EB7623AE369LL); +} /* function */ +/* SRC: classes/reflection.php line 712 */ +Variant c_reflectionextension::t_getinientries() { + INSTANCE_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::getINIEntries); + return m_info.rvalAt("ini", 0x62EA1C97CEDEF5DCLL); +} /* function */ +/* SRC: classes/reflection.php line 716 */ +Variant c_reflectionextension::t_getclasses() { + INSTANCE_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::getClasses); + return m_info.rvalAt("classes", 0x475D2D970415E4A0LL); +} /* function */ +/* SRC: classes/reflection.php line 720 */ +Array c_reflectionextension::t_getclassnames() { + INSTANCE_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::getClassNames); + Array v_ret; + Variant v_cls; + + v_ret = SystemScalarArrays::ssa_[0]; + { + LOOP_COUNTER(31); + Variant map32 = m_info.rvalAt("classes", 0x475D2D970415E4A0LL); + for (ArrayIterPtr iter33 = map32.begin("reflectionextension"); !iter33->end(); iter33->next()) { + LOOP_COUNTER_CHECK(31); + v_cls = iter33->second(); + { + v_ret.append((v_cls.o_invoke_few_args("getName", 0x23F51CDECC198965LL, 0))); + } + } + } + return v_ret; +} /* function */ +/* SRC: classes/reflection.php line 728 */ +Variant c_reflectionextension::t_info() { + INSTANCE_METHOD_INJECTION(ReflectionExtension, ReflectionExtension::info); + return m_info.rvalAt("info", 0x59E9384E33988B3ELL); +} /* function */ +/* SRC: classes/reflection.php line 582 */ +Variant c_reflectionmethod::os_get(const char *s, int64 hash) { + return c_reflectionfunctionabstract::os_get(s, hash); +} +Variant &c_reflectionmethod::os_lval(const char *s, int64 hash) { + return c_reflectionfunctionabstract::os_lval(s, hash); +} +void c_reflectionmethod::o_get(ArrayElementVec &props) const { + props.push_back(NEW(ArrayElement)("name", m_name.isReferenced() ? ref(m_name) : m_name)); + props.push_back(NEW(ArrayElement)("class", m_class.isReferenced() ? ref(m_class) : m_class)); + c_reflectionfunctionabstract::o_get(props); +} +bool c_reflectionmethod::o_exists(CStrRef s, int64 hash) const { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_EXISTS_STRING(0x0BCDB293DC3CBDDCLL, name, 4); + break; + case 2: + HASH_EXISTS_STRING(0x45397FE5C82DBD12LL, class, 5); + break; + default: + break; + } + return c_reflectionfunctionabstract::o_exists(s, hash); +} +Variant c_reflectionmethod::o_get(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_RETURN_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + case 2: + HASH_RETURN_STRING(0x45397FE5C82DBD12LL, m_class, + class, 5); + break; + default: + break; + } + return c_reflectionfunctionabstract::o_get(s, hash); +} +Variant c_reflectionmethod::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_SET_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + case 2: + HASH_SET_STRING(0x45397FE5C82DBD12LL, m_class, + class, 5); + break; + default: + break; + } + return c_reflectionfunctionabstract::o_set(s, hash, v, forInit); +} +Variant &c_reflectionmethod::o_lval(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 3) { + case 0: + HASH_RETURN_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + case 2: + HASH_RETURN_STRING(0x45397FE5C82DBD12LL, m_class, + class, 5); + break; + default: + break; + } + return c_reflectionfunctionabstract::o_lval(s, hash); +} +Variant c_reflectionmethod::os_constant(const char *s) { + return c_reflectionfunctionabstract::os_constant(s); +} +IMPLEMENT_CLASS(reflectionmethod) +ObjectData *c_reflectionmethod::create(Variant v_cls, Variant v_name) { + init(); + t___construct(v_cls, v_name); + return this; +} +ObjectData *c_reflectionmethod::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_reflectionmethod::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +ObjectData *c_reflectionmethod::cloneImpl() { + c_reflectionmethod *obj = NEW(c_reflectionmethod)(); + cloneSet(obj); + return obj; +} +void c_reflectionmethod::cloneSet(c_reflectionmethod *clone) { + clone->m_name = m_name.isReferenced() ? ref(m_name) : m_name; + clone->m_class = m_class.isReferenced() ? ref(m_class) : m_class; + c_reflectionfunctionabstract::cloneSet(clone); +} +Variant c_reflectionmethod::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 2: + HASH_GUARD(0x3FCE192CF6199942LL, invoke) { + int count = params.size(); + if (count <= 1) return (t_invoke(count, params.rvalAt(0))); + return (t_invoke(count,params.rvalAt(0), params.slice(1, count - 1, false))); + } + break; + case 4: + HASH_GUARD(0x3235AF57F23103C4LL, invokeargs) { + return (t_invokeargs(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + return (t_getstartline()); + } + break; + case 7: + HASH_GUARD(0x51A20EA0E327F607LL, isdestructor) { + return (t_isdestructor()); + } + break; + case 13: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + return (t_getfilename()); + } + break; + case 15: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + return (t_isinternal()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + return (t_getmodifiers()); + } + break; + case 25: + HASH_GUARD(0x7A15DC56E8CC0B19LL, isstatic) { + return (t_isstatic()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + case 32: + HASH_GUARD(0x57D8DC34C9A03560LL, getnumberofparameters) { + return (t_getnumberofparameters()); + } + break; + case 33: + HASH_GUARD(0x4D637DECDBFA6221LL, getnumberofrequiredparameters) { + return (t_getnumberofrequiredparameters()); + } + break; + case 34: + HASH_GUARD(0x33A6C2CFBDB05EE2LL, getclosure) { + return (t_getclosure()); + } + break; + case 35: + HASH_GUARD(0x6ED51288559D6063LL, getdeclaringclass) { + return (t_getdeclaringclass()); + } + break; + case 36: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + return (t_isuserdefined()); + } + break; + case 37: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 40: + HASH_GUARD(0x37FFB8F44A3329A8LL, getstaticvariables) { + return (t_getstaticvariables()); + } + HASH_GUARD(0x1A3AB3B0276D2668LL, returnsreference) { + return (t_returnsreference()); + } + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 42: + HASH_GUARD(0x2D7209A590477CEALL, isprotected) { + return (t_isprotected()); + } + break; + case 45: + HASH_GUARD(0x3E62225132C2A32DLL, getparameters) { + return (t_getparameters()); + } + break; + case 46: + HASH_GUARD(0x06FB6A7DC3D795AELL, isfinal) { + return (t_isfinal()); + } + break; + case 47: + HASH_GUARD(0x37AAE0845E2F636FLL, isprivate) { + return (t_isprivate()); + } + break; + case 48: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + return (t_getendline()); + } + break; + case 55: + HASH_GUARD(0x7460D945DA32FDB7LL, isabstract) { + return (t_isabstract()); + } + break; + case 56: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + case 58: + HASH_GUARD(0x654B5F965C5CAC7ALL, isconstructor) { + return (t_isconstructor()); + } + break; + case 60: + HASH_GUARD(0x2820F10358723B7CLL, ispublic) { + return (t_ispublic()); + } + break; + default: + break; + } + return c_reflectionfunctionabstract::o_invoke(s, params, hash, fatal); +} +Variant c_reflectionmethod::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 2: + HASH_GUARD(0x3FCE192CF6199942LL, invoke) { + if (count <= 1) return (t_invoke(count, a0)); + Array params; + if (count >= 2) params.append(a1); + if (count >= 3) params.append(a2); + if (count >= 4) params.append(a3); + if (count >= 5) params.append(a4); + if (count >= 6) params.append(a5); + return (t_invoke(count,a0, params)); + } + break; + case 4: + HASH_GUARD(0x3235AF57F23103C4LL, invokeargs) { + return (t_invokeargs(a0, a1)); + } + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + return (t_getstartline()); + } + break; + case 7: + HASH_GUARD(0x51A20EA0E327F607LL, isdestructor) { + return (t_isdestructor()); + } + break; + case 13: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + return (t_getfilename()); + } + break; + case 15: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + return (t_isinternal()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + return (t_getmodifiers()); + } + break; + case 25: + HASH_GUARD(0x7A15DC56E8CC0B19LL, isstatic) { + return (t_isstatic()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0, a1), null); + } + break; + case 32: + HASH_GUARD(0x57D8DC34C9A03560LL, getnumberofparameters) { + return (t_getnumberofparameters()); + } + break; + case 33: + HASH_GUARD(0x4D637DECDBFA6221LL, getnumberofrequiredparameters) { + return (t_getnumberofrequiredparameters()); + } + break; + case 34: + HASH_GUARD(0x33A6C2CFBDB05EE2LL, getclosure) { + return (t_getclosure()); + } + break; + case 35: + HASH_GUARD(0x6ED51288559D6063LL, getdeclaringclass) { + return (t_getdeclaringclass()); + } + break; + case 36: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + return (t_isuserdefined()); + } + break; + case 37: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 40: + HASH_GUARD(0x37FFB8F44A3329A8LL, getstaticvariables) { + return (t_getstaticvariables()); + } + HASH_GUARD(0x1A3AB3B0276D2668LL, returnsreference) { + return (t_returnsreference()); + } + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), a0, a1, a2)); + } + break; + case 42: + HASH_GUARD(0x2D7209A590477CEALL, isprotected) { + return (t_isprotected()); + } + break; + case 45: + HASH_GUARD(0x3E62225132C2A32DLL, getparameters) { + return (t_getparameters()); + } + break; + case 46: + HASH_GUARD(0x06FB6A7DC3D795AELL, isfinal) { + return (t_isfinal()); + } + break; + case 47: + HASH_GUARD(0x37AAE0845E2F636FLL, isprivate) { + return (t_isprivate()); + } + break; + case 48: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + return (t_getendline()); + } + break; + case 55: + HASH_GUARD(0x7460D945DA32FDB7LL, isabstract) { + return (t_isabstract()); + } + break; + case 56: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + case 58: + HASH_GUARD(0x654B5F965C5CAC7ALL, isconstructor) { + return (t_isconstructor()); + } + break; + case 60: + HASH_GUARD(0x2820F10358723B7CLL, ispublic) { + return (t_ispublic()); + } + break; + default: + break; + } + return c_reflectionfunctionabstract::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_reflectionmethod::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(c, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + default: + break; + } + return c_reflectionfunctionabstract::os_invoke(c, s, params, hash, fatal); +} +Variant c_reflectionmethod::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 2: + HASH_GUARD(0x3FCE192CF6199942LL, invoke) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + int count = params.size(); + if (count <= 1) return (t_invoke(count, a0)); + return (t_invoke(count, a0,vargs)); + } + break; + case 4: + HASH_GUARD(0x3235AF57F23103C4LL, invokeargs) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_invokeargs(a0, a1)); + } + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getstartline()); + } + break; + case 7: + HASH_GUARD(0x51A20EA0E327F607LL, isdestructor) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdestructor()); + } + break; + case 13: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfilename()); + } + break; + case 15: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinternal()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmodifiers()); + } + break; + case 25: + HASH_GUARD(0x7A15DC56E8CC0B19LL, isstatic) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isstatic()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0, a1), null); + } + break; + case 32: + HASH_GUARD(0x57D8DC34C9A03560LL, getnumberofparameters) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnumberofparameters()); + } + break; + case 33: + HASH_GUARD(0x4D637DECDBFA6221LL, getnumberofrequiredparameters) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnumberofrequiredparameters()); + } + break; + case 34: + HASH_GUARD(0x33A6C2CFBDB05EE2LL, getclosure) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getclosure()); + } + break; + case 35: + HASH_GUARD(0x6ED51288559D6063LL, getdeclaringclass) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdeclaringclass()); + } + break; + case 36: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isuserdefined()); + } + break; + case 37: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getname()); + } + break; + case 40: + HASH_GUARD(0x37FFB8F44A3329A8LL, getstaticvariables) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getstaticvariables()); + } + HASH_GUARD(0x1A3AB3B0276D2668LL, returnsreference) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_returnsreference()); + } + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(o_getClassName(), a0, a1, a2)); + } + break; + case 42: + HASH_GUARD(0x2D7209A590477CEALL, isprotected) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isprotected()); + } + break; + case 45: + HASH_GUARD(0x3E62225132C2A32DLL, getparameters) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getparameters()); + } + break; + case 46: + HASH_GUARD(0x06FB6A7DC3D795AELL, isfinal) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isfinal()); + } + break; + case 47: + HASH_GUARD(0x37AAE0845E2F636FLL, isprivate) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isprivate()); + } + break; + case 48: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getendline()); + } + break; + case 55: + HASH_GUARD(0x7460D945DA32FDB7LL, isabstract) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isabstract()); + } + break; + case 56: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdoccomment()); + } + break; + case 58: + HASH_GUARD(0x654B5F965C5CAC7ALL, isconstructor) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isconstructor()); + } + break; + case 60: + HASH_GUARD(0x2820F10358723B7CLL, ispublic) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_ispublic()); + } + break; + default: + break; + } + return c_reflectionfunctionabstract::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_reflectionmethod::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(c, a0, a1, a2)); + } + break; + default: + break; + } + return c_reflectionfunctionabstract::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_reflectionmethod$os_get(const char *s) { + return c_reflectionmethod::os_get(s, -1); +} +Variant &cw_reflectionmethod$os_lval(const char *s) { + return c_reflectionmethod::os_lval(s, -1); +} +Variant cw_reflectionmethod$os_constant(const char *s) { + return c_reflectionmethod::os_constant(s); +} +Variant cw_reflectionmethod$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_reflectionmethod::os_invoke(c, s, params, -1, fatal); +} +void c_reflectionmethod::init() { + c_reflectionfunctionabstract::init(); +} +/* SRC: classes/reflection.php line 587 */ +void c_reflectionmethod::t___construct(Variant v_cls, Variant v_name) { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::__construct); + bool oldInCtor = gasInCtor(true); + Variant v_method; + + if (toBoolean(v_cls) && toBoolean(v_name)) { + if (!(x_is_object(v_cls))) v_cls = ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(v_cls)))); + v_method = v_cls.o_invoke_few_args("getMethod", 0x0D81ECE253A3B5B6LL, 1, v_name); + if (toBoolean(v_method)) { + m_info = v_method.o_get("info", 0x59E9384E33988B3ELL); + m_name = v_method.o_get("name", 0x0BCDB293DC3CBDDCLL); + m_class = v_method.o_get("class", 0x45397FE5C82DBD12LL); + } + } + gasInCtor(oldInCtor); +} /* function */ +/* SRC: classes/reflection.php line 599 */ +String c_reflectionmethod::t___tostring() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::__toString); + return toString(null); +} /* function */ +/* SRC: classes/reflection.php line 603 */ +Variant c_reflectionmethod::ti_export(const char* cls, Variant v_cls, Variant v_name, CVarRef v_ret) { + STATIC_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::export); + Variant v_obj; + String v_str; + + if (!(x_is_object(v_cls))) v_cls = ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(v_cls)))); + v_obj = v_cls.o_invoke_few_args("getMethod", 0x0D81ECE253A3B5B6LL, 1, v_name); + v_str = toString(v_obj); + if (toBoolean(v_ret)) { + return v_str; + } + print(v_str); + return null; +} /* function */ +/* SRC: classes/reflection.php line 613 */ +Variant c_reflectionmethod::t_invoke(int num_args, CVarRef v_obj, Array args /* = Array() */) { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::invoke); + Variant v_args; + + v_args = func_get_args(num_args, Array(ArrayInit(1).set(0, ArrayElement(v_obj)).create()),args); + x_array_shift(ref(v_args)); + return x_hphp_invoke_method(v_obj, toString(m_info.rvalAt("class", 0x45397FE5C82DBD12LL)), toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)), toArray(v_args)); +} /* function */ +/* SRC: classes/reflection.php line 620 */ +Variant c_reflectionmethod::t_invokeargs(CVarRef v_obj, CVarRef v_args) { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::invokeArgs); + return x_hphp_invoke_method(v_obj, toString(m_info.rvalAt("class", 0x45397FE5C82DBD12LL)), toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)), toArray(v_args)); +} /* function */ +/* SRC: classes/reflection.php line 625 */ +Variant c_reflectionmethod::t_isfinal() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::isFinal); + return m_info.rvalAt("final", 0x5192930B2145036ELL); +} /* function */ +/* SRC: classes/reflection.php line 629 */ +Variant c_reflectionmethod::t_isabstract() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::isAbstract); + return m_info.rvalAt("abstract", 0x475C06CE12C8A8A6LL); +} /* function */ +/* SRC: classes/reflection.php line 633 */ +bool c_reflectionmethod::t_ispublic() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::isPublic); + return equal(m_info.rvalAt("access", 0x432ABF90750CDA3BLL), "public"); +} /* function */ +/* SRC: classes/reflection.php line 637 */ +bool c_reflectionmethod::t_isprivate() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::isPrivate); + return equal(m_info.rvalAt("access", 0x432ABF90750CDA3BLL), "private"); +} /* function */ +/* SRC: classes/reflection.php line 641 */ +bool c_reflectionmethod::t_isprotected() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::isProtected); + return equal(m_info.rvalAt("access", 0x432ABF90750CDA3BLL), "protected"); +} /* function */ +/* SRC: classes/reflection.php line 645 */ +Variant c_reflectionmethod::t_isstatic() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::isStatic); + return m_info.rvalAt("static", 0x1F5751E5F08D205DLL); +} /* function */ +/* SRC: classes/reflection.php line 649 */ +bool c_reflectionmethod::t_isconstructor() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::isConstructor); + return equal(t_getname(), "__construct"); +} /* function */ +/* SRC: classes/reflection.php line 653 */ +bool c_reflectionmethod::t_isdestructor() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::isDestructor); + return equal(t_getname(), "__destruct"); +} /* function */ +/* SRC: classes/reflection.php line 657 */ +Variant c_reflectionmethod::t_getmodifiers() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::getModifiers); + return m_info.rvalAt("modifiers", 0x2CAF244C9F244C80LL); +} /* function */ +/* SRC: classes/reflection.php line 661 */ +Variant c_reflectionmethod::t_getclosure() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::getClosure); + return m_info.rvalAt("closure", 0x10958EC44CD61020LL); +} /* function */ +/* SRC: classes/reflection.php line 665 */ +Variant c_reflectionmethod::t_getdeclaringclass() { + INSTANCE_METHOD_INJECTION(ReflectionMethod, ReflectionMethod::getDeclaringClass); + if (empty(m_info, "class", 0x45397FE5C82DBD12LL)) { + return null; + } + return ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(m_info.rvalAt("class", 0x45397FE5C82DBD12LL))))); +} /* function */ +/* SRC: classes/reflection.php line 490 */ +Variant c_reflectionproperty::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_reflectionproperty::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_reflectionproperty::o_get(ArrayElementVec &props) const { + props.push_back(NEW(ArrayElement)("info", m_info.isReferenced() ? ref(m_info) : m_info)); + props.push_back(NEW(ArrayElement)("name", m_name.isReferenced() ? ref(m_name) : m_name)); + props.push_back(NEW(ArrayElement)("class", m_class.isReferenced() ? ref(m_class) : m_class)); + c_ObjectData::o_get(props); +} +bool c_reflectionproperty::o_exists(CStrRef s, int64 hash) const { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 7) { + case 2: + HASH_EXISTS_STRING(0x45397FE5C82DBD12LL, class, 5); + break; + case 4: + HASH_EXISTS_STRING(0x0BCDB293DC3CBDDCLL, name, 4); + break; + case 6: + HASH_EXISTS_STRING(0x59E9384E33988B3ELL, info, 4); + break; + default: + break; + } + return c_ObjectData::o_exists(s, hash); +} +Variant c_reflectionproperty::o_get(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 7) { + case 2: + HASH_RETURN_STRING(0x45397FE5C82DBD12LL, m_class, + class, 5); + break; + case 4: + HASH_RETURN_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + case 6: + HASH_RETURN_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_get(s, hash); +} +Variant c_reflectionproperty::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 7) { + case 2: + HASH_SET_STRING(0x45397FE5C82DBD12LL, m_class, + class, 5); + break; + case 4: + HASH_SET_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + case 6: + HASH_SET_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_reflectionproperty::o_lval(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 7) { + case 2: + HASH_RETURN_STRING(0x45397FE5C82DBD12LL, m_class, + class, 5); + break; + case 4: + HASH_RETURN_STRING(0x0BCDB293DC3CBDDCLL, m_name, + name, 4); + break; + case 6: + HASH_RETURN_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_lval(s, hash); +} +Variant c_reflectionproperty::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(reflectionproperty) +ObjectData *c_reflectionproperty::create(Variant v_cls, Variant v_name) { + init(); + t___construct(v_cls, v_name); + return this; +} +ObjectData *c_reflectionproperty::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_reflectionproperty::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +ObjectData *c_reflectionproperty::cloneImpl() { + c_reflectionproperty *obj = NEW(c_reflectionproperty)(); + cloneSet(obj); + return obj; +} +void c_reflectionproperty::cloneSet(c_reflectionproperty *clone) { + clone->m_info = m_info.isReferenced() ? ref(m_info) : m_info; + clone->m_name = m_name.isReferenced() ? ref(m_name) : m_name; + clone->m_class = m_class.isReferenced() ? ref(m_class) : m_class; + ObjectData::cloneSet(clone); +} +Variant c_reflectionproperty::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 2: + HASH_GUARD(0x791E9751F5B8C5A2LL, setaccessible) { + return (t_setaccessible(), null); + } + break; + case 3: + HASH_GUARD(0x56879BCEB40997E3LL, getvalue) { + return (t_getvalue(params.rvalAt(0))); + } + HASH_GUARD(0x6ED51288559D6063LL, getdeclaringclass) { + return (t_getdeclaringclass()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 10: + HASH_GUARD(0x2D7209A590477CEALL, isprotected) { + return (t_isprotected()); + } + break; + case 15: + HASH_GUARD(0x37AAE0845E2F636FLL, isprivate) { + return (t_isprivate()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + return (t_getmodifiers()); + } + break; + case 21: + HASH_GUARD(0x384A52597AB11F15LL, isdefault) { + return (t_isdefault()); + } + HASH_GUARD(0x36FBED35008C8DB5LL, setvalue) { + return (t_setvalue(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 24: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + case 25: + HASH_GUARD(0x7A15DC56E8CC0B19LL, isstatic) { + return (t_isstatic()); + } + break; + case 28: + HASH_GUARD(0x2820F10358723B7CLL, ispublic) { + return (t_ispublic()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_reflectionproperty::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 2: + HASH_GUARD(0x791E9751F5B8C5A2LL, setaccessible) { + return (t_setaccessible(), null); + } + break; + case 3: + HASH_GUARD(0x56879BCEB40997E3LL, getvalue) { + return (t_getvalue(a0)); + } + HASH_GUARD(0x6ED51288559D6063LL, getdeclaringclass) { + return (t_getdeclaringclass()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), a0, a1, a2)); + } + break; + case 10: + HASH_GUARD(0x2D7209A590477CEALL, isprotected) { + return (t_isprotected()); + } + break; + case 15: + HASH_GUARD(0x37AAE0845E2F636FLL, isprivate) { + return (t_isprivate()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + return (t_getmodifiers()); + } + break; + case 21: + HASH_GUARD(0x384A52597AB11F15LL, isdefault) { + return (t_isdefault()); + } + HASH_GUARD(0x36FBED35008C8DB5LL, setvalue) { + return (t_setvalue(a0, a1)); + } + break; + case 24: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + case 25: + HASH_GUARD(0x7A15DC56E8CC0B19LL, isstatic) { + return (t_isstatic()); + } + break; + case 28: + HASH_GUARD(0x2820F10358723B7CLL, ispublic) { + return (t_ispublic()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_reflectionproperty::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(c, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + default: + break; + } + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_reflectionproperty::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 2: + HASH_GUARD(0x791E9751F5B8C5A2LL, setaccessible) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setaccessible(), null); + } + break; + case 3: + HASH_GUARD(0x56879BCEB40997E3LL, getvalue) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getvalue(a0)); + } + HASH_GUARD(0x6ED51288559D6063LL, getdeclaringclass) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdeclaringclass()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(o_getClassName(), a0, a1, a2)); + } + break; + case 10: + HASH_GUARD(0x2D7209A590477CEALL, isprotected) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isprotected()); + } + break; + case 15: + HASH_GUARD(0x37AAE0845E2F636FLL, isprivate) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isprivate()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x24253EBA491D6014LL, getmodifiers) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmodifiers()); + } + break; + case 21: + HASH_GUARD(0x384A52597AB11F15LL, isdefault) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefault()); + } + HASH_GUARD(0x36FBED35008C8DB5LL, setvalue) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setvalue(a0, a1)); + } + break; + case 24: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdoccomment()); + } + break; + case 25: + HASH_GUARD(0x7A15DC56E8CC0B19LL, isstatic) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isstatic()); + } + break; + case 28: + HASH_GUARD(0x2820F10358723B7CLL, ispublic) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_ispublic()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_reflectionproperty::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(c, a0, a1, a2)); + } + break; + default: + break; + } + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_reflectionproperty$os_get(const char *s) { + return c_reflectionproperty::os_get(s, -1); +} +Variant &cw_reflectionproperty$os_lval(const char *s) { + return c_reflectionproperty::os_lval(s, -1); +} +Variant cw_reflectionproperty$os_constant(const char *s) { + return c_reflectionproperty::os_constant(s); +} +Variant cw_reflectionproperty$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_reflectionproperty::os_invoke(c, s, params, -1, fatal); +} +void c_reflectionproperty::init() { +} +/* SRC: classes/reflection.php line 495 */ +void c_reflectionproperty::t___construct(Variant v_cls, Variant v_name) { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::__construct); + bool oldInCtor = gasInCtor(true); + Variant v_prop; + + if (toBoolean(v_cls) && toBoolean(v_name)) { + if (!(x_is_object(v_cls))) v_cls = ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(v_cls)))); + v_prop = v_cls.o_invoke_few_args("getProperty", 0x0FD73627FB023047LL, 1, v_name); + if (toBoolean(v_prop)) { + m_info = v_prop.o_get("info", 0x59E9384E33988B3ELL); + m_name = v_prop.o_get("name", 0x0BCDB293DC3CBDDCLL); + m_class = v_prop.o_get("class", 0x45397FE5C82DBD12LL); + } + } + gasInCtor(oldInCtor); +} /* function */ +/* SRC: classes/reflection.php line 507 */ +String c_reflectionproperty::t___tostring() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::__toString); + return toString(null); +} /* function */ +/* SRC: classes/reflection.php line 510 */ +Variant c_reflectionproperty::ti_export(const char* cls, Variant v_cls, Variant v_name, CVarRef v_ret) { + STATIC_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::export); + Variant v_obj; + String v_str; + + if (!(x_is_object(v_cls))) v_cls = ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(v_cls)))); + v_obj = v_cls.o_invoke_few_args("getProperty", 0x0FD73627FB023047LL, 1, v_name); + v_str = toString(v_obj); + if (toBoolean(v_ret)) { + return v_str; + } + print(v_str); + return null; +} /* function */ +/* SRC: classes/reflection.php line 520 */ +Variant c_reflectionproperty::t_getname() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::getName); + return m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); +} /* function */ +/* SRC: classes/reflection.php line 524 */ +bool c_reflectionproperty::t_ispublic() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::isPublic); + return equal(m_info.rvalAt("access", 0x432ABF90750CDA3BLL), "public"); +} /* function */ +/* SRC: classes/reflection.php line 528 */ +bool c_reflectionproperty::t_isprivate() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::isPrivate); + return equal(m_info.rvalAt("access", 0x432ABF90750CDA3BLL), "private"); +} /* function */ +/* SRC: classes/reflection.php line 532 */ +bool c_reflectionproperty::t_isprotected() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::isProtected); + return equal(m_info.rvalAt("access", 0x432ABF90750CDA3BLL), "protected"); +} /* function */ +/* SRC: classes/reflection.php line 536 */ +Variant c_reflectionproperty::t_isstatic() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::isStatic); + return m_info.rvalAt("static", 0x1F5751E5F08D205DLL); +} /* function */ +/* SRC: classes/reflection.php line 540 */ +Variant c_reflectionproperty::t_isdefault() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::isDefault); + return m_info.rvalAt("default", 0x6DE26F84570270CCLL); +} /* function */ +/* SRC: classes/reflection.php line 544 */ +void c_reflectionproperty::t_setaccessible() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::setAccessible); +} /* function */ +/* SRC: classes/reflection.php line 547 */ +Variant c_reflectionproperty::t_getmodifiers() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::getModifiers); + return m_info.rvalAt("modifiers", 0x2CAF244C9F244C80LL); +} /* function */ +/* SRC: classes/reflection.php line 551 */ +Variant c_reflectionproperty::t_getvalue(CVarRef v_obj) { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::getValue); + if (toBoolean(t_isstatic())) { + return x_hphp_get_static_property(toString(m_info.rvalAt("class", 0x45397FE5C82DBD12LL)), toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL))); + } + return x_hphp_get_property(toObject(v_obj), toString(m_info.rvalAt("class", 0x45397FE5C82DBD12LL)), toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL))); +} /* function */ +/* SRC: classes/reflection.php line 559 */ +Variant c_reflectionproperty::t_setvalue(CVarRef v_obj, CVarRef v_value) { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::setValue); + if (toBoolean(t_isstatic())) { + return (x_hphp_set_static_property(toString(m_info.rvalAt("class", 0x45397FE5C82DBD12LL)), toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)), v_value), null); + } + x_hphp_set_property(toObject(v_obj), toString(m_info.rvalAt("class", 0x45397FE5C82DBD12LL)), toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)), v_value); + return null; +} /* function */ +/* SRC: classes/reflection.php line 567 */ +Variant c_reflectionproperty::t_getdeclaringclass() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::getDeclaringClass); + if (empty(m_info, "class", 0x45397FE5C82DBD12LL)) { + return null; + } + return ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(m_info.rvalAt("class", 0x45397FE5C82DBD12LL))))); +} /* function */ +/* SRC: classes/reflection.php line 574 */ +Variant c_reflectionproperty::t_getdoccomment() { + INSTANCE_METHOD_INJECTION(ReflectionProperty, ReflectionProperty::getDocComment); + return m_info.rvalAt("doc", 0x16758C759CFA17A6LL); +} /* function */ +/* SRC: classes/reflection.php line 165 */ +Variant c_reflectionfunction::os_get(const char *s, int64 hash) { + return c_reflectionfunctionabstract::os_get(s, hash); +} +Variant &c_reflectionfunction::os_lval(const char *s, int64 hash) { + return c_reflectionfunctionabstract::os_lval(s, hash); +} +void c_reflectionfunction::o_get(ArrayElementVec &props) const { + c_reflectionfunctionabstract::o_get(props); +} +bool c_reflectionfunction::o_exists(CStrRef s, int64 hash) const { + return c_reflectionfunctionabstract::o_exists(s, hash); +} +Variant c_reflectionfunction::o_get(CStrRef s, int64 hash) { + return c_reflectionfunctionabstract::o_get(s, hash); +} +Variant c_reflectionfunction::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_reflectionfunctionabstract::o_set(s, hash, v, forInit); +} +Variant &c_reflectionfunction::o_lval(CStrRef s, int64 hash) { + return c_reflectionfunctionabstract::o_lval(s, hash); +} +Variant c_reflectionfunction::os_constant(const char *s) { + return c_reflectionfunctionabstract::os_constant(s); +} +IMPLEMENT_CLASS(reflectionfunction) +ObjectData *c_reflectionfunction::create(Variant v_name) { + init(); + t___construct(v_name); + return this; +} +ObjectData *c_reflectionfunction::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_reflectionfunction::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +ObjectData *c_reflectionfunction::cloneImpl() { + c_reflectionfunction *obj = NEW(c_reflectionfunction)(); + cloneSet(obj); + return obj; +} +void c_reflectionfunction::cloneSet(c_reflectionfunction *clone) { + c_reflectionfunctionabstract::cloneSet(clone); +} +Variant c_reflectionfunction::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 2: + HASH_GUARD(0x3FCE192CF6199942LL, invoke) { + int count = params.size(); + if (count <= 0) return (t_invoke(count)); + return (t_invoke(count,params.slice(0, count - 0, false))); + } + break; + case 4: + HASH_GUARD(0x3235AF57F23103C4LL, invokeargs) { + return (t_invokeargs(params.rvalAt(0))); + } + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + return (t_getstartline()); + } + break; + case 13: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + return (t_getfilename()); + } + break; + case 15: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + return (t_isinternal()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + break; + case 32: + HASH_GUARD(0x57D8DC34C9A03560LL, getnumberofparameters) { + return (t_getnumberofparameters()); + } + break; + case 33: + HASH_GUARD(0x4D637DECDBFA6221LL, getnumberofrequiredparameters) { + return (t_getnumberofrequiredparameters()); + } + break; + case 34: + HASH_GUARD(0x33A6C2CFBDB05EE2LL, getclosure) { + return (t_getclosure()); + } + break; + case 36: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + return (t_isuserdefined()); + } + break; + case 37: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 40: + HASH_GUARD(0x37FFB8F44A3329A8LL, getstaticvariables) { + return (t_getstaticvariables()); + } + HASH_GUARD(0x1A3AB3B0276D2668LL, returnsreference) { + return (t_returnsreference()); + } + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), params.rvalAt(0), params.rvalAt(1))); + } + break; + case 45: + HASH_GUARD(0x3E62225132C2A32DLL, getparameters) { + return (t_getparameters()); + } + break; + case 48: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + return (t_getendline()); + } + break; + case 56: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + default: + break; + } + return c_reflectionfunctionabstract::o_invoke(s, params, hash, fatal); +} +Variant c_reflectionfunction::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 2: + HASH_GUARD(0x3FCE192CF6199942LL, invoke) { + if (count <= 0) return (t_invoke(count)); + Array params; + if (count >= 1) params.append(a0); + if (count >= 2) params.append(a1); + if (count >= 3) params.append(a2); + if (count >= 4) params.append(a3); + if (count >= 5) params.append(a4); + if (count >= 6) params.append(a5); + return (t_invoke(count,params)); + } + break; + case 4: + HASH_GUARD(0x3235AF57F23103C4LL, invokeargs) { + return (t_invokeargs(a0)); + } + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + return (t_getstartline()); + } + break; + case 13: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + return (t_getfilename()); + } + break; + case 15: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + return (t_isinternal()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + break; + case 32: + HASH_GUARD(0x57D8DC34C9A03560LL, getnumberofparameters) { + return (t_getnumberofparameters()); + } + break; + case 33: + HASH_GUARD(0x4D637DECDBFA6221LL, getnumberofrequiredparameters) { + return (t_getnumberofrequiredparameters()); + } + break; + case 34: + HASH_GUARD(0x33A6C2CFBDB05EE2LL, getclosure) { + return (t_getclosure()); + } + break; + case 36: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + return (t_isuserdefined()); + } + break; + case 37: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 40: + HASH_GUARD(0x37FFB8F44A3329A8LL, getstaticvariables) { + return (t_getstaticvariables()); + } + HASH_GUARD(0x1A3AB3B0276D2668LL, returnsreference) { + return (t_returnsreference()); + } + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), a0, a1)); + } + break; + case 45: + HASH_GUARD(0x3E62225132C2A32DLL, getparameters) { + return (t_getparameters()); + } + break; + case 48: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + return (t_getendline()); + } + break; + case 56: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + return (t_getdoccomment()); + } + break; + default: + break; + } + return c_reflectionfunctionabstract::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_reflectionfunction::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(c, params.rvalAt(0), params.rvalAt(1))); + } + break; + default: + break; + } + return c_reflectionfunctionabstract::os_invoke(c, s, params, hash, fatal); +} +Variant c_reflectionfunction::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 2: + HASH_GUARD(0x3FCE192CF6199942LL, invoke) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + int count = params.size(); + if (count <= 0) return (t_invoke(count)); + return (t_invoke(count,vargs)); + } + break; + case 4: + HASH_GUARD(0x3235AF57F23103C4LL, invokeargs) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_invokeargs(a0)); + } + HASH_GUARD(0x39C1BB731CB1CB04LL, getstartline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getstartline()); + } + break; + case 13: + HASH_GUARD(0x1930CE336D39474DLL, getfilename) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfilename()); + } + break; + case 15: + HASH_GUARD(0x48FDF6C5835C64CFLL, isinternal) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isinternal()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + break; + case 32: + HASH_GUARD(0x57D8DC34C9A03560LL, getnumberofparameters) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnumberofparameters()); + } + break; + case 33: + HASH_GUARD(0x4D637DECDBFA6221LL, getnumberofrequiredparameters) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnumberofrequiredparameters()); + } + break; + case 34: + HASH_GUARD(0x33A6C2CFBDB05EE2LL, getclosure) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getclosure()); + } + break; + case 36: + HASH_GUARD(0x6A6B8BECAE7D4164LL, isuserdefined) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isuserdefined()); + } + break; + case 37: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getname()); + } + break; + case 40: + HASH_GUARD(0x37FFB8F44A3329A8LL, getstaticvariables) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getstaticvariables()); + } + HASH_GUARD(0x1A3AB3B0276D2668LL, returnsreference) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_returnsreference()); + } + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(o_getClassName(), a0, a1)); + } + break; + case 45: + HASH_GUARD(0x3E62225132C2A32DLL, getparameters) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getparameters()); + } + break; + case 48: + HASH_GUARD(0x6C19E85007BC4570LL, getendline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getendline()); + } + break; + case 56: + HASH_GUARD(0x7C4F424FDA56ADF8LL, getdoccomment) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdoccomment()); + } + break; + default: + break; + } + return c_reflectionfunctionabstract::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_reflectionfunction::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(c, a0, a1)); + } + break; + default: + break; + } + return c_reflectionfunctionabstract::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_reflectionfunction$os_get(const char *s) { + return c_reflectionfunction::os_get(s, -1); +} +Variant &cw_reflectionfunction$os_lval(const char *s) { + return c_reflectionfunction::os_lval(s, -1); +} +Variant cw_reflectionfunction$os_constant(const char *s) { + return c_reflectionfunction::os_constant(s); +} +Variant cw_reflectionfunction$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_reflectionfunction::os_invoke(c, s, params, -1, fatal); +} +void c_reflectionfunction::init() { + c_reflectionfunctionabstract::init(); +} +/* SRC: classes/reflection.php line 167 */ +void c_reflectionfunction::t___construct(Variant v_name) { + INSTANCE_METHOD_INJECTION(ReflectionFunction, ReflectionFunction::__construct); + bool oldInCtor = gasInCtor(true); + m_info = x_hphp_get_function_info(toString(v_name)); + if (empty(m_info)) { + throw_exception(((Object)(p_reflectionexception(p_reflectionexception(NEW(c_reflectionexception)())->create(concat3("Function ", toString(v_name), " does not exist")))))); + } + gasInCtor(oldInCtor); +} /* function */ +/* SRC: classes/reflection.php line 174 */ +String c_reflectionfunction::t___tostring() { + INSTANCE_METHOD_INJECTION(ReflectionFunction, ReflectionFunction::__toString); + return toString(null); +} /* function */ +/* SRC: classes/reflection.php line 178 */ +Variant c_reflectionfunction::ti_export(const char* cls, CVarRef v_name, CVarRef v_ret) { + STATIC_METHOD_INJECTION(ReflectionFunction, ReflectionFunction::export); + p_reflectionfunction v_obj; + String v_str; + + ((Object)(v_obj = ((Object)(p_reflectionfunction(p_reflectionfunction(NEW(c_reflectionfunction)())->create(v_name)))))); + v_str = toString(((Object)(v_obj))); + if (toBoolean(v_ret)) { + return v_str; + } + print(v_str); + return null; +} /* function */ +/* SRC: classes/reflection.php line 187 */ +Variant c_reflectionfunction::t_invoke(int num_args, Array args /* = Array() */) { + INSTANCE_METHOD_INJECTION(ReflectionFunction, ReflectionFunction::invoke); + Array v_args; + + v_args = func_get_args(num_args, Array(),args); + return x_hphp_invoke(toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)), v_args); +} /* function */ +/* SRC: classes/reflection.php line 192 */ +Variant c_reflectionfunction::t_invokeargs(CVarRef v_args) { + INSTANCE_METHOD_INJECTION(ReflectionFunction, ReflectionFunction::invokeArgs); + return x_hphp_invoke(toString(m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL)), toArray(v_args)); +} /* function */ +/* SRC: classes/reflection.php line 17 */ +Variant c_reflectionparameter::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_reflectionparameter::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_reflectionparameter::o_get(ArrayElementVec &props) const { + props.push_back(NEW(ArrayElement)("info", m_info.isReferenced() ? ref(m_info) : m_info)); + c_ObjectData::o_get(props); +} +bool c_reflectionparameter::o_exists(CStrRef s, int64 hash) const { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 1) { + case 0: + HASH_EXISTS_STRING(0x59E9384E33988B3ELL, info, 4); + break; + default: + break; + } + return c_ObjectData::o_exists(s, hash); +} +Variant c_reflectionparameter::o_get(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 1) { + case 0: + HASH_RETURN_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_get(s, hash); +} +Variant c_reflectionparameter::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 1) { + case 0: + HASH_SET_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_reflectionparameter::o_lval(CStrRef s, int64 hash) { + if (hash < 0) hash = hash_string(s.data(), s.length()); + switch (hash & 1) { + case 0: + HASH_RETURN_STRING(0x59E9384E33988B3ELL, m_info, + info, 4); + break; + default: + break; + } + return c_ObjectData::o_lval(s, hash); +} +Variant c_reflectionparameter::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(reflectionparameter) +ObjectData *c_reflectionparameter::create(Variant v_func, Variant v_param) { + init(); + t___construct(v_func, v_param); + return this; +} +ObjectData *c_reflectionparameter::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_reflectionparameter::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +ObjectData *c_reflectionparameter::cloneImpl() { + c_reflectionparameter *obj = NEW(c_reflectionparameter)(); + cloneSet(obj); + return obj; +} +void c_reflectionparameter::cloneSet(c_reflectionparameter *clone) { + clone->m_info = m_info.isReferenced() ? ref(m_info) : m_info; + ObjectData::cloneSet(clone); +} +Variant c_reflectionparameter::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x6ED51288559D6063LL, getdeclaringclass) { + return (t_getdeclaringclass()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + HASH_GUARD(0x4044F1EEBF3BB8C8LL, getposition) { + return (t_getposition()); + } + break; + case 9: + HASH_GUARD(0x4F51DA0B633E9909LL, getclass) { + return (t_getclass()); + } + HASH_GUARD(0x24ED05F4504C4C09LL, allowsnull) { + return (t_allowsnull()); + } + break; + case 12: + HASH_GUARD(0x27C482A6C7951E0CLL, getdefaultvalue) { + return (t_getdefaultvalue()); + } + break; + case 17: + HASH_GUARD(0x13E3F304BDD89FB1LL, ispassedbyreference) { + return (t_ispassedbyreference()); + } + break; + case 18: + HASH_GUARD(0x6E34805C91257C92LL, isdefaultvalueavailable) { + return (t_isdefaultvalueavailable()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 21: + HASH_GUARD(0x2D6EF48BBAB22735LL, isoptional) { + return (t_isoptional()); + } + break; + case 29: + HASH_GUARD(0x5A9CE40C0F25871DLL, isarray) { + return (t_isarray()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_reflectionparameter::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x6ED51288559D6063LL, getdeclaringclass) { + return (t_getdeclaringclass()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(o_getClassName(), a0, a1, a2)); + } + HASH_GUARD(0x4044F1EEBF3BB8C8LL, getposition) { + return (t_getposition()); + } + break; + case 9: + HASH_GUARD(0x4F51DA0B633E9909LL, getclass) { + return (t_getclass()); + } + HASH_GUARD(0x24ED05F4504C4C09LL, allowsnull) { + return (t_allowsnull()); + } + break; + case 12: + HASH_GUARD(0x27C482A6C7951E0CLL, getdefaultvalue) { + return (t_getdefaultvalue()); + } + break; + case 17: + HASH_GUARD(0x13E3F304BDD89FB1LL, ispassedbyreference) { + return (t_ispassedbyreference()); + } + break; + case 18: + HASH_GUARD(0x6E34805C91257C92LL, isdefaultvalueavailable) { + return (t_isdefaultvalueavailable()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 21: + HASH_GUARD(0x2D6EF48BBAB22735LL, isoptional) { + return (t_isoptional()); + } + break; + case 29: + HASH_GUARD(0x5A9CE40C0F25871DLL, isarray) { + return (t_isarray()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_reflectionparameter::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + return (ti_export(c, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + default: + break; + } + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_reflectionparameter::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x6ED51288559D6063LL, getdeclaringclass) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdeclaringclass()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(o_getClassName(), a0, a1, a2)); + } + HASH_GUARD(0x4044F1EEBF3BB8C8LL, getposition) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getposition()); + } + break; + case 9: + HASH_GUARD(0x4F51DA0B633E9909LL, getclass) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getclass()); + } + HASH_GUARD(0x24ED05F4504C4C09LL, allowsnull) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_allowsnull()); + } + break; + case 12: + HASH_GUARD(0x27C482A6C7951E0CLL, getdefaultvalue) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getdefaultvalue()); + } + break; + case 17: + HASH_GUARD(0x13E3F304BDD89FB1LL, ispassedbyreference) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_ispassedbyreference()); + } + break; + case 18: + HASH_GUARD(0x6E34805C91257C92LL, isdefaultvalueavailable) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultvalueavailable()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + break; + case 21: + HASH_GUARD(0x2D6EF48BBAB22735LL, isoptional) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isoptional()); + } + break; + case 29: + HASH_GUARD(0x5A9CE40C0F25871DLL, isarray) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isarray()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_reflectionparameter::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 1) { + case 0: + HASH_GUARD(0x0B5ABC58C98E70E8LL, export) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_export(c, a0, a1, a2)); + } + break; + default: + break; + } + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_reflectionparameter$os_get(const char *s) { + return c_reflectionparameter::os_get(s, -1); +} +Variant &cw_reflectionparameter$os_lval(const char *s) { + return c_reflectionparameter::os_lval(s, -1); +} +Variant cw_reflectionparameter$os_constant(const char *s) { + return c_reflectionparameter::os_constant(s); +} +Variant cw_reflectionparameter$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_reflectionparameter::os_invoke(c, s, params, -1, fatal); +} +void c_reflectionparameter::init() { +} +/* SRC: classes/reflection.php line 20 */ +void c_reflectionparameter::t___construct(Variant v_func, Variant v_param) { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::__construct); + bool oldInCtor = gasInCtor(true); + Variant v_params; + + if (toBoolean(v_func) && toBoolean(v_param)) { + v_params = v_func.o_invoke_few_args("getParameters", 0x3E62225132C2A32DLL, 0); + m_info = v_params.rvalAt(v_param).o_get("info", 0x59E9384E33988B3ELL); + } + gasInCtor(oldInCtor); +} /* function */ +/* SRC: classes/reflection.php line 27 */ +String c_reflectionparameter::t___tostring() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::__toString); + return toString(null); +} /* function */ +/* SRC: classes/reflection.php line 31 */ +Variant c_reflectionparameter::ti_export(const char* cls, CVarRef v_func, CVarRef v_param, CVarRef v_ret) { + STATIC_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::export); + p_reflectionparameter v_obj; + String v_str; + + ((Object)(v_obj = ((Object)(p_reflectionparameter(p_reflectionparameter(NEW(c_reflectionparameter)())->create(v_func, v_param)))))); + v_str = toString(((Object)(v_obj))); + if (toBoolean(v_ret)) { + return v_str; + } + print(v_str); + return null; +} /* function */ +/* SRC: classes/reflection.php line 40 */ +Variant c_reflectionparameter::t_getname() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::getName); + return m_info.rvalAt("name", 0x0BCDB293DC3CBDDCLL); +} /* function */ +/* SRC: classes/reflection.php line 44 */ +Variant c_reflectionparameter::t_ispassedbyreference() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::isPassedByReference); + return m_info.rvalAt("ref", 0x0B1A6D25134FD5FALL); +} /* function */ +/* SRC: classes/reflection.php line 48 */ +Variant c_reflectionparameter::t_getdeclaringclass() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::getDeclaringClass); + if (empty(m_info, "class", 0x45397FE5C82DBD12LL)) { + return null; + } + return ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(m_info.rvalAt("class", 0x45397FE5C82DBD12LL))))); +} /* function */ +/* SRC: classes/reflection.php line 55 */ +Variant c_reflectionparameter::t_getclass() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::getClass); + if (empty(m_info, "type", 0x508FC7C8724A760ALL)) { + return null; + } + return ((Object)(p_reflectionclass(p_reflectionclass(NEW(c_reflectionclass)())->create(m_info.rvalAt("type", 0x508FC7C8724A760ALL))))); +} /* function */ +/* SRC: classes/reflection.php line 62 */ +bool c_reflectionparameter::t_isarray() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::isArray); + return equal(m_info.rvalAt("type", 0x508FC7C8724A760ALL), "array"); +} /* function */ +/* SRC: classes/reflection.php line 66 */ +Variant c_reflectionparameter::t_allowsnull() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::allowsNull); + return m_info.rvalAt("nullable", 0x5E22F816EDD47A43LL); +} /* function */ +/* SRC: classes/reflection.php line 70 */ +bool c_reflectionparameter::t_isoptional() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::isOptional); + return isset(m_info, "default", 0x6DE26F84570270CCLL); +} /* function */ +/* SRC: classes/reflection.php line 74 */ +bool c_reflectionparameter::t_isdefaultvalueavailable() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::isDefaultValueAvailable); + return isset(m_info, "default", 0x6DE26F84570270CCLL); +} /* function */ +/* SRC: classes/reflection.php line 78 */ +Variant c_reflectionparameter::t_getdefaultvalue() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::getDefaultValue); + if (!(t_isoptional())) { + throw_exception(((Object)(p_reflectionexception(p_reflectionexception(NEW(c_reflectionexception)())->create("Parameter is not optional"))))); + } + return m_info.rvalAt("default", 0x6DE26F84570270CCLL); +} /* function */ +/* SRC: classes/reflection.php line 85 */ +Variant c_reflectionparameter::t_getposition() { + INSTANCE_METHOD_INJECTION(ReflectionParameter, ReflectionParameter::getPosition); + return m_info.rvalAt("index", 0x440D5888C0FF3081LL); +} /* function */ +Object co_reflectionfunctionabstract(CArrRef params, bool init /* = true */) { + return Object(p_reflectionfunctionabstract(NEW(c_reflectionfunctionabstract)())->dynCreate(params, init)); +} +Object co_reflectionobject(CArrRef params, bool init /* = true */) { + return Object(p_reflectionobject(NEW(c_reflectionobject)())->dynCreate(params, init)); +} +Object co_reflectionexception(CArrRef params, bool init /* = true */) { + return Object(p_reflectionexception(NEW(c_reflectionexception)())->dynCreate(params, init)); +} +Object co_reflectionclass(CArrRef params, bool init /* = true */) { + return Object(p_reflectionclass(NEW(c_reflectionclass)())->dynCreate(params, init)); +} +Object co_reflectionextension(CArrRef params, bool init /* = true */) { + return Object(p_reflectionextension(NEW(c_reflectionextension)())->dynCreate(params, init)); +} +Object co_reflectionmethod(CArrRef params, bool init /* = true */) { + return Object(p_reflectionmethod(NEW(c_reflectionmethod)())->dynCreate(params, init)); +} +Object co_reflectionproperty(CArrRef params, bool init /* = true */) { + return Object(p_reflectionproperty(NEW(c_reflectionproperty)())->dynCreate(params, init)); +} +Object co_reflectionfunction(CArrRef params, bool init /* = true */) { + return Object(p_reflectionfunction(NEW(c_reflectionfunction)())->dynCreate(params, init)); +} +Object co_reflectionparameter(CArrRef params, bool init /* = true */) { + return Object(p_reflectionparameter(NEW(c_reflectionparameter)())->dynCreate(params, init)); +} +Variant pm_php$classes$reflection_php(bool incOnce /* = false */, LVariableTable* variables /* = NULL */) { + FUNCTION_INJECTION(run_init::classes/reflection.php); + { + DECLARE_SYSTEM_GLOBALS(g); + bool &alreadyRun = g->run_pm_php$classes$reflection_php; + if (alreadyRun) { if (incOnce) return true;} + else alreadyRun = true; + if (!variables) variables = g; + } + DECLARE_SYSTEM_GLOBALS(g); + LVariableTable *gVariables __attribute__((__unused__)) = get_variable_table(); + return true; +} /* function */ + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/php/classes/reflection.fw.h b/src/lib/system/gen/php/classes/reflection.fw.h new file mode 100644 index 0000000000000..c78d6c64e1298 --- /dev/null +++ b/src/lib/system/gen/php/classes/reflection.fw.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_REFLECTION_FW_H__ +#define __GENERATED_PHP_CLASSES_REFLECTION_FW_H__ + +#include + +// Forward Declarations + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// 1. Constants + +// 2. Classes +FORWARD_DECLARE_CLASS(reflectionfunctionabstract) +FORWARD_DECLARE_CLASS(reflectionobject) +FORWARD_DECLARE_CLASS(reflector); +FORWARD_DECLARE_CLASS(reflectionexception) +FORWARD_DECLARE_CLASS(reflectionclass) +FORWARD_DECLARE_CLASS(reflectionextension) +FORWARD_DECLARE_CLASS(reflectionmethod) +FORWARD_DECLARE_CLASS(reflectionproperty) +FORWARD_DECLARE_CLASS(reflectionfunction) +FORWARD_DECLARE_CLASS(reflectionparameter) + +/////////////////////////////////////////////////////////////////////////////// +} +#include + +#endif // __GENERATED_PHP_CLASSES_REFLECTION_FW_H__ diff --git a/src/lib/system/gen/php/classes/reflection.h b/src/lib/system/gen/php/classes/reflection.h new file mode 100644 index 0000000000000..60c1db68d0994 --- /dev/null +++ b/src/lib/system/gen/php/classes/reflection.h @@ -0,0 +1,53 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_REFLECTION_H__ +#define __GENERATED_PHP_CLASSES_REFLECTION_H__ + +#include +#include + +// Declarations +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant pm_php$classes$reflection_php(bool incOnce = false, LVariableTable* variables = NULL); +Object co_reflectionfunctionabstract(CArrRef params, bool init = true); +Object co_reflectionobject(CArrRef params, bool init = true); +Object co_reflectionexception(CArrRef params, bool init = true); +Object co_reflectionclass(CArrRef params, bool init = true); +Object co_reflectionextension(CArrRef params, bool init = true); +Object co_reflectionmethod(CArrRef params, bool init = true); +Object co_reflectionproperty(CArrRef params, bool init = true); +Object co_reflectionfunction(CArrRef params, bool init = true); +Object co_reflectionparameter(CArrRef params, bool init = true); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_CLASSES_REFLECTION_H__ diff --git a/src/lib/system/gen/php/classes/stdclass.cpp b/src/lib/system/gen/php/classes/stdclass.cpp new file mode 100644 index 0000000000000..a109ef59b16f0 --- /dev/null +++ b/src/lib/system/gen/php/classes/stdclass.cpp @@ -0,0 +1,173 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* preface starts */ +/* preface finishes */ +/* SRC: classes/stdclass.php line 4 */ +Variant c_stdclass::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_stdclass::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_stdclass::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_stdclass::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_stdclass::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_stdclass::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_stdclass::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_stdclass::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(stdclass) +ObjectData *c_stdclass::cloneImpl() { + c_stdclass *obj = NEW(c_stdclass)(); + cloneSet(obj); + return obj; +} +void c_stdclass::cloneSet(c_stdclass *clone) { + ObjectData::cloneSet(clone); +} +Variant c_stdclass::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_stdclass::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_stdclass::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_stdclass::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_stdclass::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_stdclass$os_get(const char *s) { + return c_stdclass::os_get(s, -1); +} +Variant &cw_stdclass$os_lval(const char *s) { + return c_stdclass::os_lval(s, -1); +} +Variant cw_stdclass$os_constant(const char *s) { + return c_stdclass::os_constant(s); +} +Variant cw_stdclass$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_stdclass::os_invoke(c, s, params, -1, fatal); +} +void c_stdclass::init() { +} +/* SRC: classes/stdclass.php line 8 */ +Variant c___php_incomplete_class::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c___php_incomplete_class::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c___php_incomplete_class::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c___php_incomplete_class::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c___php_incomplete_class::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c___php_incomplete_class::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c___php_incomplete_class::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c___php_incomplete_class::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(__php_incomplete_class) +ObjectData *c___php_incomplete_class::cloneImpl() { + c___php_incomplete_class *obj = NEW(c___php_incomplete_class)(); + cloneSet(obj); + return obj; +} +void c___php_incomplete_class::cloneSet(c___php_incomplete_class *clone) { + ObjectData::cloneSet(clone); +} +Variant c___php_incomplete_class::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c___php_incomplete_class::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c___php_incomplete_class::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c___php_incomplete_class::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c___php_incomplete_class::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw___php_incomplete_class$os_get(const char *s) { + return c___php_incomplete_class::os_get(s, -1); +} +Variant &cw___php_incomplete_class$os_lval(const char *s) { + return c___php_incomplete_class::os_lval(s, -1); +} +Variant cw___php_incomplete_class$os_constant(const char *s) { + return c___php_incomplete_class::os_constant(s); +} +Variant cw___php_incomplete_class$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c___php_incomplete_class::os_invoke(c, s, params, -1, fatal); +} +void c___php_incomplete_class::init() { +} +Object co_stdclass(CArrRef params, bool init /* = true */) { + return Object(p_stdclass(NEW(c_stdclass)())->dynCreate(params, init)); +} +Object co___php_incomplete_class(CArrRef params, bool init /* = true */) { + return Object(p___php_incomplete_class(NEW(c___php_incomplete_class)())->dynCreate(params, init)); +} +Variant pm_php$classes$stdclass_php(bool incOnce /* = false */, LVariableTable* variables /* = NULL */) { + FUNCTION_INJECTION(run_init::classes/stdclass.php); + { + DECLARE_SYSTEM_GLOBALS(g); + bool &alreadyRun = g->run_pm_php$classes$stdclass_php; + if (alreadyRun) { if (incOnce) return true;} + else alreadyRun = true; + if (!variables) variables = g; + } + DECLARE_SYSTEM_GLOBALS(g); + LVariableTable *gVariables __attribute__((__unused__)) = get_variable_table(); + return true; +} /* function */ + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/php/classes/stdclass.fw.h b/src/lib/system/gen/php/classes/stdclass.fw.h new file mode 100644 index 0000000000000..c3e3997b0f538 --- /dev/null +++ b/src/lib/system/gen/php/classes/stdclass.fw.h @@ -0,0 +1,36 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_STDCLASS_FW_H__ +#define __GENERATED_PHP_CLASSES_STDCLASS_FW_H__ + +#include + +// Forward Declarations + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// 1. Constants + +// 2. Classes +FORWARD_DECLARE_CLASS(stdclass) +FORWARD_DECLARE_CLASS(__php_incomplete_class) + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_CLASSES_STDCLASS_FW_H__ diff --git a/src/lib/system/gen/php/classes/stdclass.h b/src/lib/system/gen/php/classes/stdclass.h new file mode 100644 index 0000000000000..2a4a6ced78d22 --- /dev/null +++ b/src/lib/system/gen/php/classes/stdclass.h @@ -0,0 +1,37 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_CLASSES_STDCLASS_H__ +#define __GENERATED_PHP_CLASSES_STDCLASS_H__ + +#include +#include + +// Declarations +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant pm_php$classes$stdclass_php(bool incOnce = false, LVariableTable* variables = NULL); +Object co_stdclass(CArrRef params, bool init = true); +Object co___php_incomplete_class(CArrRef params, bool init = true); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_CLASSES_STDCLASS_H__ diff --git a/src/lib/system/gen/php/globals/constants.cpp b/src/lib/system/gen/php/globals/constants.cpp new file mode 100644 index 0000000000000..73528495a7c27 --- /dev/null +++ b/src/lib/system/gen/php/globals/constants.cpp @@ -0,0 +1,1919 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +const int64 k_PATHINFO_BASENAME = 2LL; +const int64 k_OPENSSL_VERSION_NUMBER = 9465967LL; +const int64 k_CURLOPT_HEADERFUNCTION = 20079LL; +const int64 k_CURLOPT_INFILESIZE = 14LL; +const int64 k_MW_ResourceLimitError = 400LL; +const int64 k_MW_MeanSquaredErrorMetric = 3LL; +const Variant k_NULL = null; +const int64 k_MW_ColorBurnCompositeOp = 8LL; +const int64 k_PREG_SPLIT_DELIM_CAPTURE = 2LL; +const int64 k_MW_ImpulseNoise = 4LL; +const int64 k_PREG_GREP_INVERT = 1LL; +const int64 k_MYSQLI_USE_RESULT = 1LL; +const int64 k_T_COMMENT = 365LL; +const int64 k_LOG_EMERG = 0LL; +const int64 k_SIGXFSZ = 25LL; +const int64 k_SOCKET_ENOMSG = 42LL; +const int64 k_CURLOPT_INFILE = 10009LL; +const int64 k_IMAGETYPE_WBMP = 15LL; +const int64 k_T_PRINT = 266LL; +const int64 k_STREAM_REPORT_ERRORS = 8LL; +const int64 k_PATHINFO_EXTENSION = 4LL; +const int64 k_DEBUG_LOG_TRACE = 1LL; +const int64 k_PHP_URL_PATH = 5LL; +const int64 k_OCI_FETCHSTATEMENT_BY_ROW = 32LL; +const int64 k_MW_MinEvaluateOperator = 6LL; +const int64 k_PHP_URL_PASS = 4LL; +const double k_M_2_SQRTPI = 1.1283791670954999; +const int64 k_XML_OPTION_CASE_FOLDING = 1LL; +const int64 k_MYSQLI_TYPE_LONGLONG = 8LL; +const int64 k_T_WHILE = 318LL; +const int64 k_MW_NoCompositeOp = 1LL; +const int64 k_T_ARRAY = 359LL; +const int64 k_MW_HWBColorspace = 16LL; +const int64 k_CURLOPT_SSL_VERIFYPEER = 64LL; +const int64 k_U_UNDEFINED_SEGMENT_REFERENCE = 65553LL; +const int64 k_MW_UnframeMode = 2LL; +const int64 k_MW_PeakAbsoluteErrorMetric = 4LL; +const int64 k_U_REGEX_INVALID_BACK_REF = 66314LL; +const int64 k_MW_GreenChannel = 2LL; +const int64 k_CURLOPT_POSTQUOTE = 10039LL; +const int64 k_OCI_D_FILE = 56LL; +const int64 k_OPENSSL_CIPHER_RC2_128 = 1LL; +const int64 k_MW_CharPixel = 1LL; +const int64 k_IMAGETYPE_TIFF_II = 7LL; +const int64 k_INFO_MODULES = 8LL; +const int64 k_CURLOPT_BUFFERSIZE = 98LL; +const int64 k_MW_ShadePreview = 21LL; +const int64 k_STREAM_SOCK_SEQPACKET = 5LL; +const int64 k_SOCKET_ESPIPE = 29LL; +const int64 k_DNS_NAPTR = 67108864LL; +const int64 k_MW_AnyStretch = 10LL; +const int64 k_T_ECHO = 316LL; +const int64 k_IDNA_MALLOC_ERROR = 201LL; +const int64 k_MYSQLI_GROUP_FLAG = 32768LL; +const int64 k_MYSQLI_REPORT_INDEX = 4LL; +const int64 k_CREDITS_QA = 64LL; +const int64 k_IMAGETYPE_TIFF_MM = 8LL; +const int64 k_MW_NormalStretch = 1LL; +const int64 k_MW_UndefinedPixel = 0LL; +const int64 k_MW_UndefinedCap = 0LL; +const int64 k_MYSQLI_NOT_NULL_FLAG = 1LL; +const int64 k_IMAGETYPE_JPEG2000 = 9LL; +const int64 k_XSD_BASE64BINARY = 116LL; +const int64 k_POSIX_W_OK = 2LL; +const int64 k_OCI_B_BFILE = 114LL; +const int64 k_XML_ERROR_UNKNOWN_ENCODING = 18LL; +const int64 k_SIGABRT = 6LL; +const int64 k_LIBXML_XINCLUDE = 1024LL; +const int64 k_MW_UnrecognizedDispose = 0LL; +const int64 k_MW_OpacityChannel = 8LL; +const int64 k_INFO_LICENSE = 64LL; +const int64 k_MW_ColorizeCompositeOp = 10LL; +const int64 k_MW_OutCompositeOp = 38LL; +const int64 k_DNS_AAAA = 134217728LL; +const int64 k_CURLE_FTP_COULDNT_STOR_FILE = 25LL; +const int64 k_MW_DissolveCompositeOp = 28LL; +const int64 k_GRAPHEME_EXTR_MAXBYTES = 1LL; +const int64 k_IMAGETYPE_BMP = 6LL; +const int64 k_CURLCLOSEPOLICY_CALLBACK = 5LL; +const int64 k_MW_RootMeanSquaredErrorMetric = 6LL; +const int64 k_SIGBABY = 31LL; +const int64 k_MW_TrueColorType = 6LL; +const int64 k_ASSERT_CALLBACK = 2LL; +const int64 k_XSD_NEGATIVEINTEGER = 133LL; +const int64 k_CURLINFO_CONNECT_TIME = 3145733LL; +const int64 k_CASE_LOWER = 0LL; +const int64 k_U_MALFORMED_EXPONENTIAL_PATTERN = 65795LL; +const int64 k_U_UNSUPPORTED_PROPERTY = 65802LL; +const int64 k_SOCKET_ENOSPC = 28LL; +const double k_M_PI = 3.1415926535898002; +const int64 k_MSG_OOB = 1LL; +const int64 k_LIBXML_NSCLEAN = 8192LL; +const int64 k_MW_JPEGCompression = 5LL; +const int64 k_DOM_INVALID_CHARACTER_ERR = 5LL; +const int64 k_CURLOPT_LOW_SPEED_LIMIT = 19LL; +const int64 k_MB_CASE_LOWER = 1LL; +const int64 k_CURLE_FTP_CANT_RECONNECT = 16LL; +const int64 k_OCI_FETCHSTATEMENT_BY_COLUMN = 16LL; +const int64 k_CURLOPT_POSTFIELDS = 10015LL; +const int64 k_MW_YCCColorspace = 8LL; +const int64 k_SOCKET_EMULTIHOP = 72LL; +const int64 k_T_BOOLEAN_AND = 279LL; +const int64 k_OCI_TEMP_BLOB = 1LL; +const int64 k_CREDITS_ALL = 4294967295LL; +const int64 k_STREAM_URL_STAT_LINK = 1LL; +const int64 k_MW_UndefinedResolution = 0LL; +const int64 k_SOCKET_ENOSTR = 60LL; +const int64 k_STREAM_NOTIFY_FAILURE = 9LL; +const int64 k_XML_ERROR_BINARY_ENTITY_REF = 15LL; +const StaticString k_MCRYPT_IDEA = "idea"; +const int64 k_U_REGEX_ERROR_LIMIT = 66318LL; +const int64 k_CURLE_SSL_CIPHER = 59LL; +const int64 k_CURLOPT_PUT = 54LL; +const int64 k_SOCK_DGRAM = 2LL; +const int64 k_XSD_UNSIGNEDLONG = 139LL; +const int64 k_T_CLASS = 352LL; +const int64 k_T_WHITESPACE = 370LL; +const int64 k_SOCKET_EISDIR = 21LL; +const int64 k_SOCKET_ENOSYS = 38LL; +const StaticString k_LIBXML_DOTTED_VERSION = "2.6.20"; +const int64 k_MW_LeftAlign = 1LL; +const int64 k_SOCKET_ENOTTY = 25LL; +const int64 k_LDAP_OPT_PROTOCOL_VERSION = 17LL; +const int64 k_CURLM_OUT_OF_MEMORY = 3LL; +const int64 k_SOCKET_EWOULDBLOCK = 11LL; +const int64 k_DOM_INVALID_STATE_ERR = 11LL; +const int64 k_CURLOPT_DNS_USE_GLOBAL_CACHE = 91LL; +const int64 k_U_MISPLACED_ANCHOR_START = 65544LL; +const int64 k_IMAGETYPE_GIF = 1LL; +const int64 k_POSIX_X_OK = 1LL; +const int64 k_CURLM_OK = 0LL; +const int64 k_MW_JPEGPreview = 29LL; +const int64 k_DEBUG_LOG_DEFAULT = 111LL; +const int64 k_MCRYPT_DEV_RANDOM = 0LL; +const int64 k_OPENSSL_KEYTYPE_EC = 3LL; +const int64 k_OPENSSL_KEYTYPE_DH = 2LL; +const int64 k_SOCKET_ESOCKTNOSUPPORT = 94LL; +const int64 k_CURLCLOSEPOLICY_SLOWEST = 4LL; +const int64 k_MW_UndefinedType = 0LL; +const int64 k_STREAM_FILTER_WRITE = 2LL; +const int64 k_SEEK_SET = 0LL; +const int64 k_MYSQLI_TIMESTAMP_FLAG = 1024LL; +const int64 k_CURLINFO_SSL_VERIFYRESULT = 2097165LL; +const int64 k_SOCKET_EREMOTE = 66LL; +const int64 k_MYSQLI_TYPE_LONG = 3LL; +const int64 k_CURL_HTTP_VERSION_NONE = 0LL; +const int64 k_MW_SaturationPreview = 5LL; +const int64 k_CURLINFO_HTTP_CODE = 2097154LL; +const int64 k_IMAGETYPE_JB2 = 12LL; +const int64 k_MW_MaxEvaluateOperator = 5LL; +const int64 k_OCI_SYSOPER = 4LL; +const int64 k_CURLOPT_PROXYUSERPWD = 10006LL; +const int64 k_MW_UnderlineDecoration = 2LL; +const int64 k_T_IS_NOT_EQUAL = 282LL; +const int64 k_ERA_D_T_FMT = 131120LL; +const int64 k_MYSQLI_TYPE_FLOAT = 4LL; +const int64 k_IMAGETYPE_IFF = 14LL; +const int64 k_MW_DstOverCompositeOp = 25LL; +const int64 k_CREDITS_GENERAL = 2LL; +const int64 k_MW_YCbCrColorspace = 7LL; +const int64 k_SOCKET_ENETDOWN = 100LL; +const int64 k_MW_DullPreview = 9LL; +const int64 k_IMG_FILTER_BRIGHTNESS = 2LL; +const int64 k_STREAM_MUST_SEEK = 16LL; +const int64 k_GLOB_NOSORT = 4LL; +const int64 k_MW_CorruptImageFatalError = 725LL; +const int64 k_CURLFTPSSL_CONTROL = 2LL; +const int64 k_DNS_HINFO = 4096LL; +const int64 k_U_BUFFER_OVERFLOW_ERROR = 15LL; +const int64 k_U_INVALID_STATE_ERROR = 27LL; +const int64 k_FILE_SKIP_EMPTY_LINES = 4LL; +const int64 k_CURLMSG_DONE = 1LL; +const int64 k_XML_ATTRIBUTE_ENUMERATION = 9LL; +const int64 k_CURLINFO_SIZE_DOWNLOAD = 3145736LL; +const int64 k_MW_RegistryWarning = 390LL; +const int64 k_MW_NormalStyle = 1LL; +const int64 k_CURLOPT_VERBOSE = 41LL; +const int64 k_T_VARIABLE = 309LL; +const int64 k_CURLE_FTP_BAD_DOWNLOAD_RESUME = 36LL; +const int64 k_T_REQUIRE_ONCE = 258LL; +const int64 k_MW_StreamWarning = 340LL; +const int64 k_OCI_TEMP_CLOB = 2LL; +const StaticString k_PHP_BINDIR = ""; +const int64 k_MYSQLI_RPL_MASTER = 0LL; +const int64 k_ICONV_MIME_DECODE_STRICT = 1LL; +const int64 k_CURLOPT_URL = 10002LL; +const StaticString k_MCRYPT_GOST = "gost"; +const int64 k_MW_QuadraticFilter = 9LL; +const int64 k_MW_OpaqueOpacity = 0LL; +const int64 k_U_RULE_MASK_ERROR = 65557LL; +const int64 k_MYSQLI_REPORT_STRICT = 2LL; +const int64 k_MW_UndefinedStyle = 0LL; +const int64 k_STREAM_NOTIFY_RESOLVE = 1LL; +const int64 k_STREAM_IPPROTO_IP = 0LL; +const int64 k_MW_NoCompression = 1LL; +const int64 k_IMAGETYPE_JP2 = 10LL; +const int64 k_XSD_DURATION = 106LL; +const int64 k_T_CLOSE_TAG = 369LL; +const StaticString k_DATE_RFC822 = "D, d M y H:i:s O"; +const int64 k_SOCKET_EL2NSYNC = 45LL; +const int64 k_T_BREAK = 331LL; +const int64 k_IMAGETYPE_JPC = 9LL; +const int64 k_CURL_NETRC_OPTIONAL = 1LL; +const int64 k_LC_TIME = 2LL; +const int64 k_CURLE_FILESIZE_EXCEEDED = 63LL; +const int64 k_DNS_A6 = 16777216LL; +const StaticString k_DATE_RFC850 = "l, d-M-y H:i:s T"; +const int64 k_T_ELSE = 303LL; +const int64 k_U_INVARIANT_CONVERSION_ERROR = 26LL; +const int64 k_XSD_IDREFS = 128LL; +const int64 k_T_OBJECT_CAST = 291LL; +const int64 k_MW_FaxCompression = 3LL; +const int64 k_CURLOPT_HTTP200ALIASES = 10104LL; +const int64 k_SIGALRM = 14LL; +const int64 k_IMAGETYPE_JPX = 11LL; +const int64 k_CURLE_BAD_PASSWORD_ENTERED = 46LL; +const int64 k_SOAP_ENC_OBJECT = 301LL; +const int64 k_T_FILE = 364LL; +const int64 k_CREDITS_GROUP = 1LL; +const int64 k_LOG_AUTH = 32LL; +const int64 k_SOCKET_EDQUOT = 122LL; +const int64 k_XSD_QNAME = 118LL; +const int64 k_CURLOPT_TIMEOUT = 13LL; +const int64 k_U_MISPLACED_CURSOR_OFFSET = 65545LL; +const int64 k_SOAP_ENCODED = 1LL; +const int64 k_MW_SouthGravity = 8LL; +const int64 k_PHP_URL_PORT = 2LL; +const int64 k_LIBXML_NOEMPTYTAG = 4LL; +const double k_M_SQRT2 = 1.4142135623731; +const double k_M_SQRT3 = 1.7320508075689001; +const int64 k_MW_FileOpenWarning = 330LL; +const int64 k_CURLOPT_UNRESTRICTED_AUTH = 105LL; +const int64 k_D_T_FMT = 131112LL; +const int64 k_FILE_NO_DEFAULT_CONTEXT = 16LL; +const int64 k_LOG_NOTICE = 5LL; +const int64 k_MW_BackgroundDispose = 2LL; +const int64 k_U_DIFFERENT_UCA_VERSION = -121LL; +const int64 k_GLOB_BRACE = 1024LL; +const int64 k_E_COMPILE_WARNING = 128LL; +const int64 k_MYSQLI_REPORT_ALL = 255LL; +const int64 k_LIBXML_ERR_WARNING = 1LL; +const int64 k_PSFS_PASS_ON = 2LL; +const int64 k_STREAM_SOCK_RAW = 3LL; +const int64 k_MW_SaturateCompositeOp = 43LL; +const int64 k_INFO_ENVIRONMENT = 16LL; +const int64 k_STREAM_SOCK_RDM = 4LL; +const int64 k_U_INTERNAL_TRANSLITERATOR_ERROR = 65568LL; +const int64 k_FILE_IGNORE_NEW_LINES = 2LL; +const int64 k_MW_OilPaintPreview = 27LL; +const int64 k_CURLOPT_SSLENGINE = 10089LL; +const int64 k_SO_SNDBUF = 7LL; +const int64 k_SOCKET_EISNAM = 120LL; +const StaticString k_PATH_SEPARATOR = ":"; +const int64 k_MW_BlobWarning = 335LL; +const int64 k_MW_RelativeIntent = 4LL; +const int64 k_ERA_D_FMT = 131118LL; +const int64 k_MW_WarningException = 300LL; +const int64 k_CURLINFO_NAMELOOKUP_TIME = 3145732LL; +const int64 k_SOCKET_ESRMNT = 69LL; +const int64 k_MYSQL_BOTH = 3LL; +const int64 k_MW_ConfigureFatalError = 795LL; +const int64 k_IMG_COLOR_STYLEDBRUSHED = -4LL; +const int64 k_CURLCLOSEPOLICY_LEAST_TRAFFIC = 3LL; +const int64 k_SOCKET_EREMOTEIO = 121LL; +const int64 k_XSD_INTEGER = 131LL; +const int64 k_XML_ERROR_PARTIAL_CHAR = 6LL; +const int64 k_DNS_MX = 16384LL; +const int64 k_DNS_NS = 2LL; +const int64 k_MW_FileOpenFatalError = 730LL; +const int64 k_LOG_PERROR = 32LL; +const int64 k_MW_SemiExpandedStretch = 6LL; +const int64 k_MW_LABColorspace = 5LL; +const int64 k_MW_HSLColorspace = 15LL; +const int64 k_CURLOPT_FTPLISTONLY = 48LL; +const int64 k_SOCKET_EMSGSIZE = 90LL; +const int64 k_E_CORE_WARNING = 32LL; +const int64 k_LOG_CONS = 2LL; +const int64 k_CURLOPT_FAILONERROR = 45LL; +const int64 k_MW_HardLightCompositeOp = 30LL; +const int64 k_MW_TypeError = 405LL; +const int64 k_T_SWITCH = 327LL; +const int64 k_SOCKET_ECOMM = 70LL; +const int64 k_T_REQUIRE = 259LL; +const int64 k_XML_NOTATION_NODE = 12LL; +const int64 k_T_DEFAULT = 330LL; +const int64 k_IMG_JPEG = 2LL; +const int64 k_DEBUG_LOG_NONE = 0LL; +const int64 k_U_BRK_INTERNAL_ERROR = 66048LL; +const int64 k_CONNECTION_NORMAL = 0LL; +const int64 k_MW_CopyBlueCompositeOp = 12LL; +const int64 k_SIGCHLD = 17LL; +const int64 k_U_BRK_MALFORMED_RULE_TAG = 66061LL; +const int64 k_EXTR_OVERWRITE = 0LL; +const int64 k_INI_SYSTEM = 4LL; +const StaticString k_XSD_1999_NAMESPACE = "http://www.w3.org/1999/XMLSchema"; +const int64 k_X509_PURPOSE_ANY = 7LL; +const int64 k_IMAGETYPE_PNG = 3LL; +const int64 k_X509_PURPOSE_SSL_CLIENT = 1LL; +const int64 k_STREAM_NOTIFY_SEVERITY_WARN = 1LL; +const int64 k_LOG_ALERT = 1LL; +const int64 k_MW_FileResource = 3LL; +const int64 k_CURLE_SSL_CERTPROBLEM = 58LL; +const int64 k_MSG_NOERROR = 2LL; +const int64 k_XML_PI_NODE = 7LL; +const int64 k_MW_ZipCompression = 10LL; +const int64 k_LOG_CRIT = 2LL; +const int64 k_CURLOPT_IPRESOLVE = 113LL; +const int64 k_IMAGETYPE_PSD = 5LL; +const int64 k_MW_ModuleWarning = 355LL; +const StaticString k_PCRE_VERSION = "7.3 2007-08-28"; +const int64 k_CURLOPT_NOBODY = 44LL; +const int64 k_CURLOPT_EGDSOCKET = 10077LL; +const int64 k_CURLOPT_HTTPGET = 80LL; +const int64 k_MW_HueCompositeOp = 31LL; +const int64 k_T_EVAL = 260LL; +const int64 k_LDAP_OPT_REFERRALS = 8LL; +const int64 k_CURLE_UNSUPPORTED_PROTOCOL = 1LL; +const int64 k_CURLE_SSL_PEER_CERTIFICATE = 51LL; +const int64 k_T_CLONE = 298LL; +const int64 k_SOCKET_EBUSY = 16LL; +const int64 k_MW_SemiCondensedStretch = 5LL; +const int64 k_CURL_VERSION_IPV6 = 1LL; +const int64 k_XML_ATTRIBUTE_DECL_NODE = 16LL; +const int64 k_LOG_CRON = 72LL; +const int64 k_MW_ReduceNoisePreview = 13LL; +const int64 k_T_IMPLEMENTS = 355LL; +const int64 k_T_FUNCTION = 333LL; +const StaticString k_MCRYPT_DES = "des"; +const int64 k_MCRYPT_ENCRYPT = 0LL; +const int64 k_INFO_CONFIGURATION = 4LL; +const int64 k_IMG_FILTER_EDGEDETECT = 5LL; +const int64 k_ABDAY_1 = 131072LL; +const int64 k_SOCKET_ECONNRESET = 104LL; +const int64 k_ABDAY_2 = 131073LL; +const int64 k_ABDAY_3 = 131074LL; +const int64 k_ABDAY_4 = 131075LL; +const int64 k_STREAM_IS_URL = 1LL; +const int64 k_ABDAY_5 = 131076LL; +const int64 k_MW_UltraExpandedStretch = 9LL; +const StaticString k_MCRYPT_3DES = "tripledes"; +const int64 k_ABDAY_6 = 131077LL; +const int64 k_ABDAY_7 = 131078LL; +const int64 k_U_MULTIPLE_DECIMAL_SEPERATORS = 65793LL; +const int64 k_STREAM_CRYPTO_METHOD_TLS_SERVER = 7LL; +const int64 k_MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH = 0LL; +const int64 k_U_INVALID_PROPERTY_PATTERN = 65561LL; +const int64 k_U_TOO_MANY_ALIASES_ERROR = 24LL; +const int64 k_PHP_URL_FRAGMENT = 7LL; +const int64 k_U_UNTERMINATED_QUOTE = 65556LL; +const int64 k_U_MISPLACED_QUANTIFIER = 65546LL; +const StaticString k_DATE_W3C = "Y-m-d\\TH:i:sP"; +const int64 k_LC_MONETARY = 4LL; +const int64 k_MW_CoderWarning = 350LL; +const int64 k_SOCKET_ENOTCONN = 107LL; +const int64 k_DNS_CNAME = 16LL; +const int64 k_T_CURLY_OPEN = 374LL; +const int64 k_U_BRK_UNRECOGNIZED_OPTION = 66060LL; +const int64 k_CURLE_OBSOLETE = 50LL; +const int64 k_IMG_ARC_NOFILL = 2LL; +const int64 k_U_INVALID_CHAR_FOUND = 10LL; +const int64 k_MW_NonZeroRule = 2LL; +const int64 k_MW_ConfigureWarning = 395LL; +const int64 k_U_BRK_UNCLOSED_SET = 66052LL; +const int64 k_SORT_LOCALE_STRING = 5LL; +const int64 k_MW_MitchellFilter = 12LL; +const int64 k_XML_ERROR_NO_ELEMENTS = 3LL; +const int64 k_U_INTERNAL_PROGRAM_ERROR = 5LL; +const int64 k_IMAGETYPE_SWC = 13LL; +const int64 k_IMAGETYPE_SWF = 4LL; +const int64 k_MW_OverlayCompositeOp = 40LL; +const StaticString k_DATE_RSS = "D, d M Y H:i:s O"; +const int64 k_MW_sRGBColorspace = 13LL; +const int64 k_YESEXPR = 327680LL; +const int64 k_IMG_EFFECT_NORMAL = 2LL; +const int64 k_LOG_NOWAIT = 16LL; +const int64 k_MW_UndefinedMethod = 0LL; +const int64 k_T_EXIT = 300LL; +const int64 k_MYSQLI_BLOB_FLAG = 16LL; +const int64 k_T_NUM_STRING = 310LL; +const int64 k_E_NOTICE = 8LL; +const int64 k_IMAGETYPE_XBM = 16LL; +const int64 k_CRYPT_STD_DES = 1LL; +const int64 k_PRIO_USER = 2LL; +const int64 k_STREAM_PF_UNIX = 1LL; +const int64 k_MW_CoderFatalError = 750LL; +const int64 k_XSD_GYEARMONTH = 110LL; +const int64 k_CURLE_HTTP_PORT_FAILED = 45LL; +const int64 k_CURLOPT_FTPAPPEND = 50LL; +const int64 k_CURLOPT_FTP_CREATE_MISSING_DIRS = 110LL; +const int64 k_MYSQLI_TYPE_NULL = 6LL; +const int64 k_CURLINFO_CONTENT_TYPE = 1048594LL; +const int64 k_XSD_NAME = 124LL; +const int64 k_T_CONCAT_EQUAL = 273LL; +const int64 k_PSFS_FLAG_NORMAL = 0LL; +const int64 k_CURLE_HTTP_RANGE_ERROR = 33LL; +const int64 k_U_MALFORMED_VARIABLE_DEFINITION = 65541LL; +const int64 k_XML_ENTITY_REF_NODE = 5LL; +const int64 k_CLOCK_MONOTONIC = 1LL; +const int64 k_T_INLINE_HTML = 311LL; +const int64 k_MYSQLI_CLIENT_FOUND_ROWS = 2LL; +const int64 k_CURLE_URL_MALFORMAT_USER = 4LL; +const int64 k_CURLOPT_SSLKEYTYPE = 10088LL; +const int64 k_U_FMT_PARSE_ERROR_START = 65792LL; +const int64 k_CURL_VERSION_LIBZ = 8LL; +const int64 k_E_STRICT = 2048LL; +const StaticString k_MCRYPT_TRIPLEDES = "tripledes"; +const int64 k_STREAM_NOTIFY_PROGRESS = 7LL; +const int64 k_MW_UndefinedStretch = 0LL; +const int64 k_MW_TransparentOpacity = 65535LL; +const int64 k_SOCKET_ENOTBLK = 15LL; +const int64 k_XSD_IDREF = 127LL; +const int64 k_OCI_RETURN_LOBS = 8LL; +const int64 k_MW_TriangleFilter = 3LL; +const int64 k_SIGCONT = 18LL; +const int64 k_CURLOPT_HTTPPROXYTUNNEL = 61LL; +const int64 k_CURL_TIMECOND_LASTMOD = 3LL; +const int64 k_SOCKET_EADDRINUSE = 98LL; +const int64 k_MON_10 = 131107LL; +const int64 k_MON_11 = 131108LL; +const int64 k_MCC_ACCESSPOINT_DOWN = 2LL; +const int64 k_MON_12 = 131109LL; +const int64 k_XSD_INT = 135LL; +const int64 k_OCI_B_CFILEE = 115LL; +const int64 k_U_MISMATCHED_SEGMENT_DELIMITERS = 65543LL; +const int64 k_MYSQLI_TYPE_TIMESTAMP = 7LL; +const int64 k_T_STATIC = 346LL; +const int64 k_T_HALT_COMPILER = 351LL; +const int64 k_SOCKET_ETOOMANYREFS = 109LL; +const int64 k_XSD_ENTITY = 129LL; +const int64 k_MW_XorCompositeOp = 53LL; +const int64 k_STREAM_SERVER_BIND = 4LL; +const int64 k_DOM_NO_DATA_ALLOWED_ERR = 6LL; +const int64 k_OCI_LOB_BUFFER_FREE = 1LL; +const int64 k_MW_GaussianNoise = 2LL; +const StaticString k_MCRYPT_MARS = "mars"; +const int64 k_LIBXML_DTDATTR = 8LL; +const int64 k_T_BOOLEAN_OR = 278LL; +const int64 k_U_BRK_SEMICOLON_EXPECTED = 66050LL; +const int64 k_SOCKET_ENOTDIR = 20LL; +const int64 k_MW_MagentaChannel = 2LL; +const int64 k_MYSQLI_REPORT_OFF = 0LL; +const int64 k_CURLOPT_FOLLOWLOCATION = 52LL; +const int64 k_CURLE_URL_MALFORMAT = 3LL; +const int64 k_MYSQLI_CLIENT_INTERACTIVE = 1024LL; +const int64 k_MW_LeftShiftEvaluateOperator = 4LL; +const int64 k_CURLOPT_MUTE = -2LL; +const int64 k_MW_DrawWarning = 360LL; +const bool k_TRUE = true; +const int64 k_LOG_SYSLOG = 40LL; +const int64 k_IMG_FILTER_GAUSSIAN_BLUR = 7LL; +const int64 k_T_ENCAPSED_AND_WHITESPACE = 314LL; +const int64 k_STREAM_SERVER_LISTEN = 8LL; +const int64 k_MW_SrcAtopCompositeOp = 46LL; +const int64 k_SOCK_STREAM = 1LL; +const int64 k_MW_ThresholdPreview = 17LL; +const int64 k_XML_OPTION_SKIP_WHITE = 4LL; +const int64 k_CURLE_READ_ERROR = 26LL; +const int64 k_MW_MirrorVirtualPixelMethod = 5LL; +const int64 k_MW_DespecklePreview = 12LL; +const int64 k_U_PARSE_ERROR_START = 65536LL; +const int64 k_PNG_ALL_FILTERS = 248LL; +const int64 k_XSD_LONG = 134LL; +const int64 k_DEBUG_LOG_POST = 16LL; +const int64 k_T_IS_NOT_IDENTICAL = 280LL; +const int64 k_X509_PURPOSE_NS_SSL_SERVER = 3LL; +const double k_M_LN2 = 0.69314718055994995; +const int64 k_MW_SoftLightCompositeOp = 45LL; +const double k_M_LN10 = 2.3025850929940002; +const int64 k_T_ABSTRACT = 345LL; +const int64 k_T_LNUMBER = 305LL; +const int64 k_DEBUG_LOG_REFERER = 4LL; +const int64 k_MSG_PEEK = 2LL; +const StaticString k_MCRYPT_TWOFISH = "twofish"; +const int64 k_SIG_DFL = 0LL; +const int64 k_MW_DisplaceCompositeOp = 27LL; +const int64 k_U_ERROR_LIMIT = 66568LL; +const int64 k_ASSERT_QUIET_EVAL = 5LL; +const int64 k_PKCS7_NOINTERN = 16LL; +const int64 k_MW_LongPixel = 5LL; +const int64 k_CRYPT_MD5 = 1LL; +const int64 k_MYSQLI_TYPE_SET = 248LL; +const int64 k_LDAP_OPT_MATCHED_DN = 51LL; +const int64 k_CURLOPT_USERPWD = 10005LL; +const StaticString k_DEFAULT_INCLUDE_PATH = ""; +const int64 k_E_USER_NOTICE = 1024LL; +const int64 k_MW_CharcoalDrawingPreview = 28LL; +const int64 k_MW_SubtractCompositeOp = 51LL; +const int64 k_MW_CondensedStretch = 4LL; +const int64 k_MW_CenterGravity = 5LL; +const int64 k_CURLINFO_SPEED_UPLOAD = 3145738LL; +const int64 k_GRAPHEME_EXTR_COUNT = 0LL; +const int64 k_T_INCLUDE_ONCE = 261LL; +const int64 k_MSG_DONTROUTE = 4LL; +const int64 k_MW_OptimizeType = 10LL; +const int64 k_WUNTRACED = 2LL; +const int64 k_U_INVALID_ID = 65569LL; +const int64 k_CREDITS_MODULES = 8LL; +const int64 k_MW_DivideEvaluateOperator = 3LL; +const StaticString k_DATE_RFC1036 = "D, d M y H:i:s O"; +const int64 k_U_INDEX_OUTOFBOUNDS_ERROR = 8LL; +const int64 k_UPLOAD_ERR_FORM_SIZE = 2LL; +const int64 k_LC_ALL = 6LL; +const int64 k_XML_ERROR_INVALID_TOKEN = 4LL; +const int64 k_CURLE_ABORTED_BY_CALLBACK = 42LL; +const int64 k_SO_OOBINLINE = 10LL; +const int64 k_MW_UndefinedMetric = 0LL; +const StaticString k_DATE_RFC1123 = "D, d M Y H:i:s O"; +const int64 k_EXTR_PREFIX_SAME = 2LL; +const int64 k_XML_DTD_NODE = 14LL; +const int64 k_U_REGEX_MAX_LT_MIN = 66313LL; +const int64 k_MW_HSBColorspace = 14LL; +const int64 k_MW_ForgetGravity = 0LL; +const StaticString k_MCRYPT_RC2 = "rc2"; +const int64 k_E_PARSE = 4LL; +const int64 k_MW_ColorSeparationType = 8LL; +const int64 k_MYSQLI_TYPE_DOUBLE = 5LL; +const int64 k_MW_MonitorFatalError = 785LL; +const StaticString k_MCRYPT_RC6 = "rc6"; +const int64 k_CURLOPT_STDERR = 10037LL; +const int64 k_CURLE_MALFORMAT_USER = 24LL; +const int64 k_CURLAUTH_ANY = -1LL; +const int64 k_T_BOOL_CAST = 290LL; +const int64 k_MW_StreamError = 440LL; +const int64 k_XML_ERROR_TAG_MISMATCH = 7LL; +const int64 k_LDAP_DEREF_FINDING = 2LL; +const int64 k_MW_ResourceLimitWarning = 300LL; +const int64 k_MW_XYZColorspace = 6LL; +const int64 k_MW_ConcatenateMode = 3LL; +const int64 k_SIG_ERR = -1LL; +const int64 k_XHPROF_FLAGS_MEMORY = 4LL; +const int64 k_GLOB_NOESCAPE = 64LL; +const int64 k_T_LOGICAL_OR = 263LL; +const int64 k_T_DOC_COMMENT = 366LL; +const int64 k_XHPROF_FLAGS_NO_BUILTINS = 1LL; +const int64 k_STREAM_FILTER_READ = 1LL; +const int64 k_SORT_REGULAR = 0LL; +const int64 k_MW_ThresholdCompositeOp = 52LL; +const int64 k_CURLOPT_RESUME_FROM = 21LL; +const int64 k_MW_RegistryFatalError = 790LL; +const int64 k_FNM_CASEFOLD = 16LL; +const int64 k_PHP_NORMAL_READ = 1LL; +const int64 k_MW_MonitorError = 485LL; +const int64 k_UPLOAD_ERR_NO_TMP_DIR = 6LL; +const int64 k_IMG_EFFECT_ALPHABLEND = 1LL; +const int64 k_CURLINFO_FILETIME = 2097166LL; +const int64 k_T_XOR_EQUAL = 269LL; +const int64 k_CURLOPT_FTPPORT = 10017LL; +const int64 k_U_MULTIPLE_ANTE_CONTEXTS = 65549LL; +const int64 k_MW_ImageWarning = 365LL; +const int64 k_SIG_IGN = 1LL; +const int64 k_XML_ERROR_INCORRECT_ENCODING = 19LL; +const int64 k_MW_CorruptImageWarning = 325LL; +const int64 k_AM_STR = 131110LL; +const int64 k_MW_YIQColorspace = 9LL; +const int64 k_SOCKET_ENOTEMPTY = 39LL; +const int64 k_SOAP_COMPRESSION_GZIP = 0LL; +const int64 k_T_CONST = 334LL; +const int64 k_UPLOAD_ERR_CANT_WRITE = 7LL; +const int64 k_UPLOAD_ERR_PARTIAL = 3LL; +const int64 k_WNOHANG = 1LL; +const int64 k_CURLE_COULDNT_CONNECT = 7LL; +const int64 k_MW_PlusCompositeOp = 41LL; +const int64 k_CURLINFO_REDIRECT_TIME = 3145747LL; +const int64 k_PNG_FILTER_NONE = 8LL; +const int64 k_XML_ERROR_ASYNC_ENTITY = 13LL; +const int64 k_MW_AtopCompositeOp = 3LL; +const int64 k_PHP_OUTPUT_HANDLER_END = 4LL; +const int64 k_PSFS_FLAG_FLUSH_CLOSE = 2LL; +const int64 k_STREAM_CLIENT_PERSISTENT = 1LL; +const double k_M_LNPI = 1.1447298858493999; +const int64 k_U_USING_DEFAULT_WARNING = -127LL; +const int64 k_CURLFTPSSL_NONE = 0LL; +const int64 k_CURLOPT_PORT = 3LL; +const int64 k_SOCKET_EIDRM = 43LL; +const int64 k_APACHE_MAP = 200LL; +const int64 k_MCC_DOWN_ON_TIMEOUT = 1LL; +const int64 k_CURLOPT_POST = 47LL; +const int64 k_MYSQLI_SET_CHARSET_NAME = 7LL; +const double k_M_SQRT1_2 = 0.70710678118655002; +const int64 k_MW_BZipCompression = 2LL; +const int64 k_STREAM_CRYPTO_METHOD_SSLv23_CLIENT = 2LL; +const int64 k_LOG_NDELAY = 8LL; +const int64 k_T_AS = 326LL; +const int64 k_U_STATE_OLD_WARNING = -125LL; +const int64 k_STREAM_CRYPTO_METHOD_SSLv2_CLIENT = 0LL; +const int64 k_T_LOGICAL_AND = 265LL; +const int64 k_DEBUG_LOG_ALL = 65535LL; +const int64 k_IMG_FILTER_NEGATE = 0LL; +const int64 k_U_MISSING_OPERATOR = 65547LL; +const int64 k_T_DO = 317LL; +const int64 k_STREAM_CLIENT_CONNECT = 4LL; +const int64 k_SIGVTALRM = 26LL; +const int64 k_PREG_BACKTRACK_LIMIT_ERROR = 2LL; +const int64 k_T_IF = 301LL; +const int64 k_MW_UndefinedPathUnits = 0LL; +const int64 k_MW_AddCompositeOp = 2LL; +const int64 k_CURLOPT_PROXYPORT = 59LL; +const int64 k_U_SAFECLONE_ALLOCATED_WARNING = -126LL; +const int64 k_PNG_FILTER_PAETH = 128LL; +const int64 k_UPLOAD_ERR_EXTENSION = 8LL; +const StaticString k_GD_EXTRA_VERSION = ""; +const int64 k_U_CE_NOT_FOUND_ERROR = 21LL; +const int64 k_SOCKET_ESHUTDOWN = 108LL; +const int64 k_XSD_ANYTYPE = 145LL; +const StaticString k_MCRYPT_LOKI97 = "loki97"; +const int64 k_LOG_ODELAY = 4LL; +const int64 k_ULOC_VALID_LOCALE = 1LL; +const int64 k_MW_SpiffPreview = 8LL; +const int64 k_MYSQLI_TYPE_VAR_STRING = 253LL; +const int64 k_T_MINUS_EQUAL = 276LL; +const int64 k_CURLOPT_BINARYTRANSFER = 19914LL; +const StaticString k_DATE_ATOM = "Y-m-d\\TH:i:sP"; +const int64 k_U_MULTIPLE_EXPONENTIAL_SYMBOLS = 65794LL; +const StaticString k_MCRYPT_BLOWFISH_COMPAT = "blowfish-compat"; +const int64 k_CURLOPT_NOSIGNAL = 99LL; +const int64 k_MW_AddNoisePreview = 14LL; +const int64 k_HTML_SPECIALCHARS = 0LL; +const int64 k_MW_AreaResource = 1LL; +const int64 k_T_PLUS_EQUAL = 277LL; +const int64 k_CURLE_RECV_ERROR = 56LL; +const int64 k_MW_FrameMode = 1LL; +const int64 k_DAY_1 = 131079LL; +const int64 k_DAY_2 = 131080LL; +const int64 k_DAY_3 = 131081LL; +const int64 k_CURLOPT_NOPROGRESS = 43LL; +const int64 k_DAY_4 = 131082LL; +const int64 k_MW_CopyRedCompositeOp = 18LL; +const int64 k_DAY_5 = 131083LL; +const int64 k_DAY_6 = 131084LL; +const int64 k_DAY_7 = 131085LL; +const int64 k_STREAM_CLIENT_ASYNC_CONNECT = 2LL; +const int64 k_MW_BrightnessPreview = 6LL; +const int64 k_PHP_URL_USER = 3LL; +const StaticString k_PEAR_EXTENSION_DIR = ""; +const int64 k_PHP_URL_SCHEME = 0LL; +const int64 k_MW_UltraCondensedStretch = 2LL; +const StaticString k_PHP_SYSCONFDIR = ""; +const int64 k_U_REGEX_UNIMPLEMENTED = 66309LL; +const int64 k_T_SL = 287LL; +const int64 k_MW_GammaPreview = 7LL; +const int64 k_SOAP_USE_XSI_ARRAY_TYPE = 4LL; +const int64 k_T_SR = 286LL; +const int64 k_STREAM_MKDIR_RECURSIVE = 1LL; +const int64 k_XML_ATTRIBUTE_NMTOKEN = 7LL; +const int64 k_U_COLLATOR_VERSION_MISMATCH = 28LL; +const int64 k_SOCKET_E2BIG = 7LL; +const StaticString k_ICONV_VERSION = "2.3.5"; +const int64 k_POSIX_F_OK = 0LL; +const int64 k_PKCS7_BINARY = 128LL; +const int64 k_U_UNSUPPORTED_ERROR = 16LL; +const int64 k_IMG_COLOR_TRANSPARENT = -6LL; +const double k_M_1_PI = 0.31830988618379003; +const int64 k_MYSQLI_STORE_RESULT = 0LL; +const int64 k_MW_WestGravity = 4LL; +const int64 k_GLOB_ERR = 1LL; +const int64 k_U_REGEX_MISMATCHED_PAREN = 66310LL; +const int64 k_U_TRAILING_BACKSLASH = 65552LL; +const int64 k_LOG_LOCAL0 = 128LL; +const int64 k_MW_GrayscaleType = 2LL; +const int64 k_IMG_GD2_RAW = 1LL; +const int64 k_LOG_LOCAL1 = 136LL; +const int64 k_U_MALFORMED_PRAGMA = 65562LL; +const int64 k_LOG_LOCAL2 = 144LL; +const int64 k_LOG_LOCAL3 = 152LL; +const int64 k_LOG_LOCAL4 = 160LL; +const int64 k_IDNA_ROUNDTRIP_VERIFY_ERROR = 7LL; +const int64 k_MW_CopyBlackCompositeOp = 11LL; +const int64 k_LOG_LOCAL5 = 168LL; +const int64 k_LOG_LOCAL6 = 176LL; +const int64 k_LOG_LOCAL7 = 184LL; +const int64 k_MW_OverlineDecoration = 3LL; +const int64 k_CONNECTION_ABORTED = 1LL; +const int64 k_MYSQLI_TYPE_TIME = 11LL; +const int64 k_T_PAAMAYIM_NEKUDOTAYIM = 375LL; +const int64 k_U_REGEX_NUMBER_TOO_BIG = 66311LL; +const int64 k_STREAM_NOTIFY_REDIRECTED = 6LL; +const int64 k_CURLOPT_RANGE = 10007LL; +const int64 k_T_PUBLIC = 341LL; +const int64 k_T_IS_SMALLER_OR_EQUAL = 285LL; +const int64 k_U_BRK_UNDEFINED_VARIABLE = 66057LL; +const int64 k_T_DOUBLE_ARROW = 357LL; +const int64 k_CURLOPT_MAXREDIRS = 68LL; +const int64 k_CURLINFO_HEADER_SIZE = 2097163LL; +const int64 k_MW_HammingFilter = 6LL; +const int64 k_MW_ExpandedStretch = 7LL; +const int64 k_MYSQLI_TYPE_TINY = 1LL; +const int64 k_OCI_B_BIN = 23LL; +const int64 k_SOCKET_EMEDIUMTYPE = 124LL; +const int64 k_MW_DoublePixel = 2LL; +const int64 k_E_WARNING = 2LL; +const int64 k_ENT_COMPAT = 2LL; +const int64 k_XML_ERROR_UNDEFINED_ENTITY = 11LL; +const int64 k_MW_ReplaceCompositeOp = 42LL; +const int64 k_MYSQLI_INIT_COMMAND = 3LL; +const int64 k_CRNCYSTR = 262159LL; +const int64 k_T_LINE = 363LL; +const int64 k_OCI_BOTH = 3LL; +const StaticString k_MCRYPT_SAFERPLUS = "saferplus"; +const int64 k_CURLE_BAD_CONTENT_ENCODING = 61LL; +const int64 k_MYSQLI_CLIENT_COMPRESS = 32LL; +const int64 k_LOG_INFO = 6LL; +const StaticString k_DATE_RFC2822 = "D, d M Y H:i:s O"; +const int64 k_LOG_AUTHPRIV = 80LL; +const int64 k_CURLM_INTERNAL_ERROR = 4LL; +const int64 k_PKCS7_NOATTR = 256LL; +const StaticString k_OPENSSL_VERSION_TEXT = "OpenSSL 0.9.7f 22 Mar 2005"; +const StaticString k_DATE_RFC3339 = "Y-m-d\\TH:i:sP"; +const StaticString k_PHP_VERSION = "HPHP"; +const int64 k_PREG_OFFSET_CAPTURE = 256LL; +const int64 k_OCI_NUM = 2LL; +const int64 k_MSG_WAITALL = 256LL; +const int64 k_SOCKET_EISCONN = 106LL; +const StaticString k_MCRYPT_ARCFOUR = "arcfour"; +const int64 k_XSD_DOUBLE = 105LL; +const int64 k_XML_ERROR_NONE = 0LL; +const int64 k_SOCKET_EL2HLT = 51LL; +const int64 k_XSD_HEXBINARY = 115LL; +const int64 k_T_UNSET_CAST = 289LL; +const int64 k_CURLE_FTP_COULDNT_SET_BINARY = 17LL; +const int64 k_MSG_EAGAIN = 11LL; +const int64 k_T_LIST = 358LL; +const int64 k_CURLE_FTP_WRITE_ERROR = 20LL; +const int64 k_CURLOPT_CONNECTTIMEOUT = 78LL; +const int64 k_CURLE_HTTP_POST_ERROR = 34LL; +const int64 k_MW_QuantumRange = 65535LL; +const int64 k_D_FMT = 131113LL; +const int64 k_SO_REUSEADDR = 2LL; +const int64 k_U_UNCLOSED_SEGMENT = 65563LL; +const int64 k_PNG_NO_FILTER = 0LL; +const int64 k_CURLM_BAD_EASY_HANDLE = 2LL; +const double k_M_EULER = 0.57721566490152998; +const int64 k_MW_HanningFilter = 5LL; +const int64 k_CURLOPT_READFUNCTION = 20012LL; +const int64 k_U_UNSUPPORTED_ESCAPE_SEQUENCE = 19LL; +const int64 k_MW_MemoryResource = 5LL; +const int64 k_XSD_DECIMAL = 103LL; +const int64 k_MW_MultiplyEvaluateOperator = 7LL; +const int64 k_ERA_T_FMT = 131121LL; +const int64 k_MYSQLI_TYPE_TINY_BLOB = 249LL; +const int64 k_U_FILE_ACCESS_ERROR = 4LL; +const int64 k_U_MULTIPLE_COMPOUND_FILTERS = 65559LL; +const int64 k_POSIX_S_IFBLK = 24576LL; +const double k_M_2_PI = 0.63661977236758005; +const int64 k_MCC_ACCESSPOINT_UP = 1LL; +const int64 k_MW_UndefinedDecoration = 0LL; +const StaticString k_XSD_NAMESPACE = "http://www.w3.org/2001/XMLSchema"; +const int64 k_U_BRK_HEX_DIGITS_EXPECTED = 66049LL; +const int64 k_UNKNOWN_TYPE = 999998LL; +const int64 k_MW_FloodfillMethod = 3LL; +const int64 k_XSD_1999_TIMEINSTANT = 401LL; +const int64 k_POSIX_S_IFCHR = 8192LL; +const int64 k_CURLE_FTP_COULDNT_SET_ASCII = 29LL; +const int64 k_U_STRING_NOT_TERMINATED_WARNING = -124LL; +const int64 k_DOM_VALIDATION_ERR = 16LL; +const int64 k_SOCKET_EMFILE = 24LL; +const int64 k_LOG_KERN = 0LL; +const int64 k_SOCKET_EINTR = 4LL; +const StaticString k_DATE_COOKIE = "l, d-M-y H:i:s T"; +const int64 k_GLOB_ONLYDIR = 8192LL; +const int64 k_XML_NAMESPACE_DECL_NODE = 18LL; +const int64 k_CURLOPT_FTP_USE_EPRT = 106LL; +const int64 k_LIBXML_ERR_ERROR = 2LL; +const int64 k_MW_SpreadPreview = 19LL; +const StaticString k_ICONV_IMPL = "glibc"; +const int64 k_IMG_ARC_CHORD = 1LL; +const int64 k_MW_EdgeVirtualPixelMethod = 4LL; +const int64 k_MYSQLI_TYPE_GEOMETRY = 255LL; +const int64 k_T_END_HEREDOC = 372LL; +const int64 k_CURLOPT_FTP_USE_EPSV = 85LL; +const int64 k_SOAP_COMPRESSION_DEFLATE = 16LL; +const int64 k_ULOC_ACTUAL_LOCALE = 0LL; +const int64 k_LIBXML_ERR_NONE = 0LL; +const double k_M_LOG10E = 0.43429448190324998; +const int64 k_CURLINFO_REDIRECT_COUNT = 2097172LL; +const int64 k_IDNA_STRINGPREP_ERROR = 1LL; +const int64 k_CURLINFO_CONTENT_LENGTH_UPLOAD = 3145744LL; +const int64 k_LIBXML_NOWARNING = 64LL; +const int64 k_U_BRK_ASSIGN_ERROR = 66053LL; +const int64 k_MW_LaplacianNoise = 5LL; +const int64 k_XSD_SHORT = 136LL; +const int64 k_MYSQLI_CLIENT_IGNORE_SPACE = 256LL; +const int64 k_XML_DOCUMENT_TYPE_NODE = 10LL; +const int64 k_U_AMBIGUOUS_ALIAS_WARNING = -122LL; +const int64 k_MW_LanczosFilter = 13LL; +const int64 k_LOCK_EX = 2LL; +const int64 k_CURLE_LDAP_SEARCH_FAILED = 39LL; +const int64 k_FNM_PERIOD = 4LL; +const int64 k_MW_MonitorWarning = 385LL; +const int64 k_AF_UNIX = 1LL; +const int64 k_T_SR_EQUAL = 267LL; +const int64 k_MB_CASE_TITLE = 2LL; +const int64 k_SOCKET_EL3HLT = 46LL; +const int64 k_MYSQLI_READ_DEFAULT_FILE = 4LL; +const int64 k_MYSQLI_TYPE_NEWDATE = 14LL; +const int64 k_MYSQLI_TYPE_LONG_BLOB = 251LL; +const int64 k_XML_ATTRIBUTE_CDATA = 1LL; +const int64 k_LOCK_NB = 4LL; +const int64 k_MCRYPT_RAND = 2LL; +const int64 k_XSD_NOTATION = 119LL; +const int64 k_MYSQLI_UNSIGNED_FLAG = 32LL; +const int64 k_GRAPHEME_EXTR_MAXCHARS = 2LL; +const int64 k_MW_NoDecoration = 1LL; +const int64 k_U_MULTIPLE_PERCENT_SYMBOLS = 65796LL; +const int64 k_OPENSSL_KEYTYPE_DSA = 1LL; +const int64 k_IMG_FILTER_MEAN_REMOVAL = 9LL; +const int64 k_U_BRK_VARIABLE_REDFINITION = 66054LL; +const int64 k_CURLOPT_KRB4LEVEL = 10063LL; +const int64 k_SO_SNDLOWAT = 19LL; +const int64 k_CURLOPT_SSLKEY = 10087LL; +const int64 k_ABMON_10 = 131095LL; +const int64 k_MW_SrcOverCompositeOp = 50LL; +const int64 k_ABMON_11 = 131096LL; +const int64 k_ABMON_12 = 131097LL; +const int64 k_MW_SrcOutCompositeOp = 49LL; +const int64 k_LOG_MAIL = 16LL; +const int64 k_OCI_B_INT = 3LL; +const int64 k_MW_CopyOpacityCompositeOp = 17LL; +const int64 k_LDAP_OPT_TIMELIMIT = 4LL; +const int64 k_U_FMT_PARSE_ERROR_LIMIT = 65804LL; +const int64 k_LOCK_SH = 1LL; +const int64 k_LDAP_OPT_CLIENT_CONTROLS = 19LL; +const int64 k_SOCKET_EINPROGRESS = 115LL; +const int64 k_STREAM_NOTIFY_AUTH_REQUIRED = 3LL; +const int64 k_PREG_BAD_UTF8_ERROR = 4LL; +const int64 k_IMG_ARC_ROUNDED = 0LL; +const int64 k_CURLOPT_HTTP_VERSION = 84LL; +const int64 k_CURLOPT_CAINFO = 10065LL; +const int64 k_DOM_NOT_FOUND_ERR = 8LL; +const int64 k_CURLE_SEND_ERROR = 55LL; +const int64 k_LOCK_UN = 3LL; +const int64 k_CURLOPT_RANDOM_FILE = 10076LL; +const int64 k_POSIX_S_IFIFO = 4096LL; +const int64 k_MW_CoderError = 450LL; +const int64 k_SO_LINGER = 13LL; +const int64 k_U_ILLEGAL_CHAR_IN_SEGMENT = 65564LL; +const int64 k_CURLE_GOT_NOTHING = 52LL; +const int64 k_PHP_INT_MAX = 9223372036854775807LL; +const StaticString k_MCRYPT_MODE_CBC = "cbc"; +const int64 k_T_EXTENDS = 354LL; +const int64 k_UPLOAD_ERR_NO_FILE = 4LL; +const double k_M_PI_2 = 1.5707963267949001; +const double k_M_PI_4 = 0.78539816339745006; +const int64 k_CURLOPT_SSLVERSION = 32LL; +const int64 k_SUNFUNCS_RET_DOUBLE = 2LL; +const int64 k_XSD_DATETIME = 107LL; +const int64 k_MYSQL_CLIENT_IGNORE_SPACE = 256LL; +const int64 k_MW_SouthWestGravity = 7LL; +const int64 k_XML_ATTRIBUTE_NOTATION = 10LL; +const StaticString k_MCRYPT_MODE_CFB = "cfb"; +const int64 k_CURLM_CALL_MULTI_PERFORM = -1LL; +const int64 k_HTML_ENTITIES = 1LL; +const int64 k_CREDITS_DOCS = 16LL; +const int64 k_MYSQLI_TYPE_STRING = 254LL; +const int64 k_MSG_ENOMSG = 42LL; +const int64 k_MW_PaletteType = 4LL; +const int64 k_X509_PURPOSE_CRL_SIGN = 6LL; +const int64 k_IMG_FILTER_SMOOTH = 10LL; +const int64 k_IMG_COLOR_STYLED = -2LL; +const int64 k_XSD_ANYURI = 117LL; +const int64 k_STREAM_NOTIFY_SEVERITY_ERR = 2LL; +const int64 k_XML_HTML_DOCUMENT_NODE = 13LL; +const int64 k_DEBUG_LOG_USER = 32LL; +const int64 k_MW_ObjectBoundingBox = 3LL; +const int64 k_MW_WavePreview = 26LL; +const int64 k_XML_ERROR_DUPLICATE_ATTRIBUTE = 8LL; +const int64 k_U_PARSE_ERROR_LIMIT = 65571LL; +const int64 k_LOG_DEBUG = 7LL; +const StaticString k_MCRYPT_MODE_ECB = "ecb"; +const int64 k_MW_ScreenCompositeOp = 44LL; +const int64 k_STREAM_NOTIFY_COMPLETED = 8LL; +const int64 k_IDNA_ICONV_ERROR = 9LL; +const int64 k_X509_PURPOSE_SSL_SERVER = 2LL; +const StaticString k_DIRECTORY_SEPARATOR = "/"; +const int64 k_ASSERT_BAIL = 3LL; +const int64 k_CRYPT_EXT_DES = 0LL; +const int64 k_UPLOAD_ERR_INI_SIZE = 1LL; +const int64 k_MW_RightShiftEvaluateOperator = 9LL; +const int64 k_MW_OptionError = 410LL; +const int64 k_GLOB_AVAILABLE_FLAGS = 9303LL; +const int64 k_MW_AddEvaluateOperator = 1LL; +const int64 k_U_REGEX_BAD_INTERVAL = 66312LL; +const int64 k_U_MALFORMED_UNICODE_ESCAPE = 65540LL; +const int64 k_XSD_NORMALIZEDSTRING = 120LL; +const int64 k_WSDL_CACHE_BOTH = 3LL; +const int64 k_SOAP_COMPRESSION_ACCEPT = 32LL; +const int64 k_CURL_NETRC_IGNORED = 0LL; +const int64 k_CURLE_BAD_FUNCTION_ARGUMENT = 43LL; +const int64 k_XML_COMMENT_NODE = 8LL; +const int64 k_XSD_ANYXML = 147LL; +const int64 k_CURLE_FTP_QUOTE_ERROR = 21LL; +const int64 k_MW_UndefinedGravity = 0LL; +const int64 k_U_BRK_RULE_SYNTAX = 66051LL; +const int64 k_U_MISSING_SEGMENT_CLOSE = 65548LL; +const int64 k_T_METHOD_C = 361LL; +const int64 k_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16LL; +const int64 k_U_STRINGPREP_UNASSIGNED_ERROR = 66561LL; +const int64 k_U_PATTERN_SYNTAX_ERROR = 65799LL; +const int64 k_ASSERT_WARNING = 4LL; +const int64 k_SO_ERROR = 4LL; +const int64 k_MW_OptionFatalError = 710LL; +const int64 k_CURLE_FTP_WEIRD_227_FORMAT = 14LL; +const int64 k_T_INCLUDE = 262LL; +const int64 k_SOCKET_EUNATCH = 49LL; +const int64 k_MW_ColorSeparationMatteType = 9LL; +const int64 k_OCI_B_NUM = 2LL; +const int64 k_MSG_IPC_NOWAIT = 1LL; +const int64 k_CURLAUTH_GSSNEGOTIATE = 4LL; +const int64 k_MW_RoundCap = 2LL; +const int64 k_CURLE_COULDNT_RESOLVE_PROXY = 5LL; +const int64 k_U_ILLEGAL_ARGUMENT_ERROR = 1LL; +const int64 k_OCI_B_NTY = 108LL; +const int64 k_SOL_TCP = 6LL; +const int64 k_LDAP_OPT_ERROR_NUMBER = 49LL; +const int64 k_MW_PaletteMatteType = 5LL; +const int64 k_ABMON_1 = 131086LL; +const int64 k_ABMON_2 = 131087LL; +const int64 k_ABMON_3 = 131088LL; +const int64 k_ABMON_4 = 131089LL; +const int64 k_CURLOPT_FILETIME = 69LL; +const int64 k_ABMON_5 = 131090LL; +const int64 k_ABMON_6 = 131091LL; +const int64 k_IMG_GD2_COMPRESSED = 2LL; +const int64 k_MW_DifferenceCompositeOp = 26LL; +const int64 k_ABMON_7 = 131092LL; +const int64 k_ABMON_8 = 131093LL; +const int64 k_CRYPT_SALT_LENGTH = 12LL; +const int64 k_ABMON_9 = 131094LL; +const double k_M_LOG2E = 1.442695040889; +const int64 k_XML_TEXT_NODE = 3LL; +const int64 k_DOM_INDEX_SIZE_ERR = 1LL; +const int64 k_DEBUG_LOG_URL = 2LL; +const int64 k_CURLOPT_SSL_CIPHER_LIST = 10083LL; +const int64 k_SIGKILL = 9LL; +const int64 k_U_VARIABLE_RANGE_OVERLAP = 65566LL; +const int64 k_MW_RaisePreview = 22LL; +const int64 k_CURLOPT_REFERER = 10016LL; +const int64 k_T_THROW = 338LL; +const int64 k_SOL_UDP = 17LL; +const int64 k_SOAP_ENC_ARRAY = 300LL; +const int64 k_MW_BlackmanFilter = 7LL; +const int64 k_MW_OverCompositeOp = 39LL; +const int64 k_U_REGEX_SET_CONTAINS_STRING = 66317LL; +const int64 k_MW_UndefinedColorspace = 0LL; +const int64 k_CURL_VERSION_KERBEROS4 = 2LL; +const int64 k_PSFS_FLAG_FLUSH_INC = 1LL; +const int64 k_PHP_OUTPUT_HANDLER_CONT = 2LL; +const int64 k_CURLOPT_TRANSFERTEXT = 53LL; +const int64 k_IMG_COLOR_BRUSHED = -3LL; +const int64 k_OCI_SYSDBA = 2LL; +const int64 k_CURLOPT_COOKIE = 10022LL; +const int64 k_CURLE_OPERATION_TIMEOUTED = 28LL; +const int64 k_OPENSSL_SSLV23_PADDING = 2LL; +const int64 k_T_ARRAY_CAST = 292LL; +const int64 k_SO_RCVLOWAT = 18LL; +const int64 k_WSDL_CACHE_DISK = 1LL; +const int64 k_POSIX_S_IFREG = 32768LL; +const int64 k_MYSQLI_REPORT_ERROR = 1LL; +const int64 k_U_INVALID_FORMAT_ERROR = 3LL; +const int64 k_T_LOGICAL_XOR = 264LL; +const int64 k_SOAP_ACTOR_NEXT = 1LL; +const int64 k_OCI_DEFAULT = 0LL; +const int64 k_CURLCLOSEPOLICY_LEAST_RECENTLY_USED = 2LL; +const int64 k_MYSQLI_TYPE_YEAR = 13LL; +const int64 k_T_PROTECTED = 342LL; +const int64 k_SOCKET_EL3RST = 47LL; +const int64 k_U_MALFORMED_VARIABLE_REFERENCE = 65542LL; +const int64 k_MW_BlackChannel = 32LL; +const int64 k_MW_ExclusionCompositeOp = 29LL; +const int64 k_CURL_VERSION_SSL = 4LL; +const int64 k_CURLVERSION_NOW = 2LL; +const int64 k_MW_PointMethod = 1LL; +const int64 k_MW_PartitionInterlace = 4LL; +const int64 k_FORCE_DEFLATE = 2LL; +const int64 k_U_MALFORMED_SYMBOL_REFERENCE = 65539LL; +const int64 k_MW_YPbPrColorspace = 10LL; +const int64 k_SOCKET_ELOOP = 40LL; +const int64 k_XSD_TIME = 108LL; +const int64 k_SOCKET_EEXIST = 17LL; +const int64 k_DOMSTRING_SIZE_ERR = 2LL; +const int64 k_SO_BROADCAST = 6LL; +const int64 k_PM_STR = 131111LL; +const int64 k_MW_ErrorException = 400LL; +const int64 k_CURLE_HTTP_NOT_FOUND = 22LL; +const int64 k_EXTR_PREFIX_ALL = 3LL; +const int64 k_OCI_SEEK_CUR = 1LL; +const int64 k_SOCKET_ECHRNG = 44LL; +const int64 k_OCI_SEEK_END = 2LL; +const int64 k_XML_ENTITY_NODE = 6LL; +const int64 k_MW_PixelsPerInchResolution = 1LL; +const int64 k_T_OBJECT_OPERATOR = 356LL; +const int64 k_MW_CorruptImageError = 425LL; +const int64 k_STREAM_PEEK = 2LL; +const int64 k_IMG_COLOR_TILED = -5LL; +const int64 k_LOG_NEWS = 56LL; +const int64 k_MW_CatromFilter = 11LL; +const int64 k_PKCS7_TEXT = 1LL; +const int64 k_MW_RightAlign = 3LL; +const int64 k_MYSQL_NUM = 2LL; +const int64 k_CURLE_FILE_COULDNT_READ_FILE = 37LL; +const int64 k_SOCKET_EUSERS = 87LL; +const int64 k_CURLOPT_LOW_SPEED_TIME = 20LL; +const int64 k_PHP_BINARY_READ = 2LL; +const int64 k_STR_PAD_BOTH = 2LL; +const int64 k_U_REGEX_PROPERTY_SYNTAX = 66308LL; +const int64 k_STREAM_FILTER_ALL = 3LL; +const int64 k_CURLAUTH_DIGEST = 2LL; +const int64 k_XSD_UNSIGNEDSHORT = 141LL; +const int64 k_CURL_IPRESOLVE_WHATEVER = 0LL; +const int64 k_SIGIO = 29LL; +const int64 k_T_ENDSWITCH = 328LL; +const int64 k_LDAP_OPT_SIZELIMIT = 3LL; +const StaticString k_OCI_SYSDATE = "SYSDATE"; +const int64 k_MW_SubtractEvaluateOperator = 11LL; +const int64 k_MYSQLI_RPL_SLAVE = 1LL; +const int64 k_STREAM_SHUT_RD = 0LL; +const int64 k_SOAP_1_1 = 1LL; +const int64 k_DOM_PHP_ERR = 0LL; +const int64 k_SOAP_1_2 = 2LL; +const int64 k_OPENSSL_KEYTYPE_RSA = 0LL; +const int64 k_PNG_FILTER_UP = 32LL; +const int64 k_EXTR_REFS = 256LL; +const int64 k_OPENSSL_CIPHER_DES = 3LL; +const int64 k_E_ALL = 6143LL; +const int64 k_LIBXML_NOENT = 2LL; +const int64 k_U_USING_FALLBACK_WARNING = -128LL; +const int64 k_MW_BlendCompositeOp = 4LL; +const StaticString k_HPHP_TRIM_CHARLIST = StaticString(" \n\r\t\v\0", 6); +const int64 k_MYSQL_CLIENT_COMPRESS = 32LL; +const int64 k_E_USER_ERROR = 256LL; +const int64 k_SOAP_PERSISTENCE_REQUEST = 2LL; +const int64 k_T_MUL_EQUAL = 275LL; +const int64 k_MW_IndexChannel = 32LL; +const int64 k_U_ILLEGAL_CHAR_FOUND = 12LL; +const int64 k_OPENSSL_PKCS1_PADDING = 1LL; +const int64 k_PHP_INT_SIZE = 8LL; +const int64 k_CURLE_FTP_SSL_FAILED = 64LL; +const int64 k_CURLE_FTP_ACCESS_DENIED = 9LL; +const int64 k_CURLE_TOO_MANY_REDIRECTS = 47LL; +const int64 k_STREAM_USE_PATH = 1LL; +const int64 k_MW_DelegateWarning = 315LL; +const StaticString k_MCRYPT_MODE_OFB = "ofb"; +const int64 k_CURLE_FTP_COULDNT_USE_REST = 31LL; +const int64 k_T_PRIVATE = 343LL; +const int64 k_STREAM_SHUT_WR = 1LL; +const StaticString k_DATE_ISO8601 = "Y-m-d\\TH:i:sO"; +const int64 k_CURLE_LDAP_CANNOT_BIND = 38LL; +const int64 k_IDNA_INVALID_LENGTH = 5LL; +const int64 k_LDAP_DEREF_ALWAYS = 3LL; +const int64 k_XML_ERROR_BAD_CHAR_REF = 14LL; +const int64 k_XSD_STRING = 101LL; +const int64 k_IMG_ARC_PIE = 0LL; +const int64 k_SOCKET_ECONNREFUSED = 111LL; +const int64 k_PKCS7_NOVERIFY = 32LL; +const int64 k_T_DOLLAR_OPEN_CURLY_BRACES = 373LL; +const int64 k_CURLOPT_SSLENGINE_DEFAULT = 90LL; +const int64 k_XSD_GYEAR = 111LL; +const int64 k_SOCKET_EPROTO = 71LL; +const int64 k_XSD_NONPOSITIVEINTEGER = 132LL; +const StaticString k_XML_SAX_IMPL = "expat"; +const int64 k_LDAP_OPT_RESTART = 9LL; +const int64 k_MW_SolarizePreview = 20LL; +const int64 k_U_USELESS_COLLATOR_ERROR = 29LL; +const int64 k_MW_BlobError = 435LL; +const int64 k_IMG_ARC_EDGED = 4LL; +const int64 k_DOM_NOT_SUPPORTED_ERR = 9LL; +const int64 k_PNG_FILTER_AVG = 64LL; +const int64 k_CURLM_BAD_HANDLE = 1LL; +const int64 k_MW_LightenCompositeOp = 33LL; +const int64 k_CURLOPT_PROXYTYPE = 101LL; +const int64 k_T_ENDIF = 304LL; +const int64 k_CURLOPT_FTPSSLAUTH = 129LL; +const int64 k_MW_BesselFilter = 14LL; +const int64 k_DOM_INUSE_ATTRIBUTE_ERR = 10LL; +const int64 k_MW_UndefinedVirtualPixelMethod = 0LL; +const int64 k_CURLE_FTP_WEIRD_SERVER_REPLY = 8LL; +const int64 k_CURLE_LDAP_INVALID_URL = 62LL; +const int64 k_XML_DOCUMENT_FRAG_NODE = 11LL; +const int64 k_MW_ImageError = 465LL; +const int64 k_IMG_FILTER_CONTRAST = 3LL; +const int64 k_SOCKET_EHOSTUNREACH = 113LL; +const int64 k_MW_UndefinedDispose = 0LL; +const int64 k_CURLPROXY_HTTP = 0LL; +const int64 k_MW_Group4Compression = 4LL; +const int64 k_CLOCK_THREAD_CPUTIME_ID = 3LL; +const int64 k_MCRYPT_DEV_URANDOM = 1LL; +const StaticString k_MCRYPT_MODE_STREAM = "stream"; +const int64 k_SOAP_ACTOR_NONE = 2LL; +const int64 k_MYSQLI_UNIQUE_KEY_FLAG = 4LL; +const StaticString k_PHP_EXTENSION_DIR = ""; +const int64 k_DOM_INVALID_MODIFICATION_ERR = 13LL; +const int64 k_U_MULTIPLE_PAD_SPECIFIERS = 65798LL; +const int64 k_STR_PAD_RIGHT = 1LL; +const int64 k_SOCKET_ENODATA = 61LL; +const int64 k_MW_ConstantVirtualPixelMethod = 2LL; +const int64 k_U_MALFORMED_RULE = 65537LL; +const int64 k_U_UNSUPPORTED_ATTRIBUTE = 65803LL; +const int64 k_OCI_EXACT_FETCH = 2LL; +const int64 k_CURLAUTH_ANYSAFE = -2LL; +const int64 k_STREAM_SHUT_RDWR = 2LL; +const int64 k_U_BRK_ERROR_START = 66048LL; +const int64 k_PRIO_PROCESS = 0LL; +const int64 k_STREAM_PF_INET6 = 10LL; +const int64 k_CURLE_FTP_COULDNT_GET_SIZE = 32LL; +const int64 k_OCI_DTYPE_LOB = 50LL; +const int64 k_U_INVALID_FUNCTION = 65570LL; +const int64 k_MW_MissingDelegateFatalError = 720LL; +const int64 k_IMAGETYPE_JPEG = 2LL; +const int64 k_SOCKET_ENOPROTOOPT = 92LL; +const int64 k_IMG_WBMP = 8LL; +const int64 k_LDAP_OPT_DEBUG_LEVEL = 20481LL; +const int64 k_MW_CenterAlign = 2LL; +const int64 k_LOG_DAEMON = 24LL; +const int64 k_MW_UndefinedJoin = 0LL; +const int64 k_XML_ELEMENT_NODE = 1LL; +const int64 k_LC_NUMERIC = 1LL; +const int64 k_CREDITS_FULLPAGE = 32LL; +const int64 k_U_PRIMARY_TOO_LONG_ERROR = 22LL; +const int64 k_LIBXML_DTDVALID = 16LL; +const int64 k_U_ERROR_WARNING_START = -128LL; +const int64 k_MW_FloatPixel = 3LL; +const int64 k_CURLOPT_WRITEFUNCTION = 20011LL; +const int64 k_CURLE_SSL_CONNECT_ERROR = 35LL; +const int64 k_MW_WandFatalError = 770LL; +const int64 k_MW_GRAYColorspace = 2LL; +const int64 k_IMG_GIF = 1LL; +const int64 k_U_PARSE_ERROR = 9LL; +const int64 k_MYSQLI_TYPE_SHORT = 2LL; +const int64 k_IMG_FILTER_COLORIZE = 4LL; +const int64 k_T_DOUBLE_COLON = 375LL; +const int64 k_T_DEC = 296LL; +const int64 k_SOCKET_ELNRNG = 48LL; +const StaticString k_PHP_DATADIR = ""; +const int64 k_CURLOPT_READDATA = 10009LL; +const int64 k_CURL_NETRC_REQUIRED = 2LL; +const int64 k_XSD_ENTITIES = 130LL; +const int64 k_MW_DelegateFatalError = 715LL; +const int64 k_U_STATE_TOO_OLD_ERROR = 23LL; +const int64 k_CURLOPT_CLOSEPOLICY = 72LL; +const int64 k_PREG_SPLIT_NO_EMPTY = 1LL; +const int64 k_LIBXML_NONET = 2048LL; +const int64 k_SOCKET_ENFILE = 23LL; +const int64 k_MW_CopyMagentaCompositeOp = 16LL; +const int64 k_STREAM_IPPROTO_RAW = 255LL; +const int64 k_LIBXML_DTDLOAD = 4LL; +const int64 k_CURLINFO_STARTTRANSFER_TIME = 3145745LL; +const int64 k_COUNT_RECURSIVE = 1LL; +const int64 k_CODESET = 14LL; +const int64 k_CURLOPT_PASSWDFUNCTION = -3LL; +const int64 k_SOCKET_EPERM = 1LL; +const int64 k_GD_MAJOR_VERSION = 2LL; +const int64 k_PKCS7_DETACHED = 64LL; +const int64 k_OPENSSL_CIPHER_RC2_40 = 0LL; +const int64 k_SOCKET_ENOSR = 63LL; +const int64 k_LC_MESSAGES = 5LL; +const int64 k_T_STRING_VARNAME = 308LL; +const int64 k_SOMAXCONN = 128LL; +const int64 k_MW_RedChannel = 1LL; +const int64 k_MW_ButtCap = 1LL; +const int64 k_OPENSSL_CIPHER_RC2_64 = 2LL; +const int64 k_SOCKET_ETIMEDOUT = 110LL; +const int64 k_IDNA_CONTAINS_ACE_PREFIX = 8LL; +const int64 k_MW_ColorDodgeCompositeOp = 9LL; +const int64 k_T_FMT_AMPM = 131115LL; +const int64 k_SQLT_RSET = 116LL; +const int64 k_U_REGEX_INVALID_STATE = 66306LL; +const int64 k_T_CHARACTER = 312LL; +const int64 k_XML_ATTRIBUTE_NODE = 2LL; +const int64 k_STREAM_ENFORCE_SAFE_MODE = 4LL; +const int64 k_SUNFUNCS_RET_TIMESTAMP = 0LL; +const int64 k_STREAM_IPPROTO_TCP = 6LL; +const int64 k_SO_RCVBUF = 8LL; +const int64 k_STREAM_NOTIFY_MIME_TYPE_IS = 4LL; +const int64 k_COUNT_NORMAL = 0LL; +const int64 k_U_REGEX_INTERNAL_ERROR = 66304LL; +const int64 k_STREAM_CRYPTO_METHOD_SSLv23_SERVER = 6LL; +const StaticString k_MCRYPT_WAKE = "wake"; +const int64 k_U_TRUNCATED_CHAR_FOUND = 11LL; +const int64 k_STREAM_CRYPTO_METHOD_SSLv2_SERVER = 4LL; +const int64 k_MW_WandError = 470LL; +const int64 k_SO_DEBUG = 1LL; +const bool k_FALSE = false; +const int64 k_LDAP_OPT_ERROR_STRING = 50LL; +const bool k_ZEND_THREAD_SAFE = false; +const int64 k_AF_INET6 = 10LL; +const int64 k_SUNFUNCS_RET_STRING = 1LL; +const int64 k_OPENSSL_PKCS1_OAEP_PADDING = 4LL; +const int64 k_SIGSTKFLT = 16LL; +const int64 k_XML_ERROR_NO_MEMORY = 1LL; +const int64 k_DNS_ALL = 251713587LL; +const int64 k_MB_OVERLOAD_REGEX = 4LL; +const int64 k_MW_SincFilter = 15LL; +const int64 k_IMG_JPG = 2LL; +const int64 k_MW_ShearPreview = 2LL; +const int64 k_ASSERT_ACTIVE = 1LL; +const int64 k_STREAM_IPPROTO_UDP = 17LL; +const int64 k_OCI_SEEK_SET = 0LL; +const int64 k_SOCKET_EDESTADDRREQ = 89LL; +const int64 k_T_FMT = 131114LL; +const int64 k_MW_EastGravity = 6LL; +const int64 k_SOCKET_EPIPE = 32LL; +const int64 k_SIGCLD = 17LL; +const int64 k_T_FINAL = 344LL; +const int64 k_MW_StaticGravity = 10LL; +const int64 k_T_FOR = 320LL; +const int64 k_EXTR_SKIP = 1LL; +const int64 k_MW_HermiteFilter = 4LL; +const int64 k_DNS_ANY = 268435456LL; +const int64 k_OCI_DTYPE_FILE = 56LL; +const int64 k_CURLE_BAD_CALLING_ORDER = 44LL; +const int64 k_SOCKET_ENOBUFS = 105LL; +const int64 k_LC_COLLATE = 3LL; +const int64 k_CURLOPT_CAPATH = 10097LL; +const int64 k_PKCS7_NOCHAIN = 8LL; +const int64 k_U_INVALID_TABLE_FORMAT = 13LL; +const int64 k_CHAR_MAX = 127LL; +const int64 k_PREG_INTERNAL_ERROR = 1LL; +const int64 k_MYSQLI_RPL_ADMIN = 2LL; +const int64 k_E_USER_WARNING = 512LL; +const int64 k_PREG_NO_ERROR = 0LL; +const int64 k_U_STRINGPREP_CHECK_BIDI_ERROR = 66562LL; +const int64 k_SOCKET_EPROTONOSUPPORT = 93LL; +const StaticString k_MCRYPT_PANAMA = "panama"; +const int64 k_MYSQLI_TYPE_CHAR = 1LL; +const int64 k_MON_1 = 131098LL; +const int64 k_T_EMPTY = 350LL; +const int64 k_MON_2 = 131099LL; +const int64 k_SIGBUS = 7LL; +const int64 k_MYSQLI_SET_FLAG = 2048LL; +const int64 k_MON_3 = 131100LL; +const int64 k_MON_4 = 131101LL; +const int64 k_MON_5 = 131102LL; +const int64 k_MON_6 = 131103LL; +const int64 k_MON_7 = 131104LL; +const int64 k_MON_8 = 131105LL; +const int64 k_MON_9 = 131106LL; +const int64 k_SOCKET_EMLINK = 31LL; +const int64 k_EXTR_IF_EXISTS = 6LL; +const int64 k_LDAP_OPT_SERVER_CONTROLS = 18LL; +const int64 k_CURLE_COULDNT_RESOLVE_HOST = 6LL; +const int64 k_MW_BlobFatalError = 735LL; +const int64 k_MYSQLI_ZEROFILL_FLAG = 64LL; +const StaticString k_GD_VERSION = "2.0.35"; +const int64 k_SOCKET_EBADMSG = 74LL; +const int64 k_CURLE_FTP_USER_PASSWORD_INCORRECT = 10LL; +const int64 k_T_INC = 297LL; +const int64 k_THOUSEP = 65537LL; +const int64 k_SORT_DESC = 3LL; +const int64 k_MYSQLI_TYPE_BLOB = 252LL; +const int64 k_SOCKET_EAFNOSUPPORT = 97LL; +const int64 k_MYSQLI_TYPE_DATE = 10LL; +const int64 k_T_DNUMBER = 306LL; +const int64 k_MW_BlueChannel = 4LL; +const int64 k_CURLE_UNKNOWN_TELNET_OPTION = 48LL; +const int64 k_T_CONTINUE = 332LL; +const StaticString k_PHP_SHLIB_SUFFIX = "so"; +const int64 k_CURLE_LIBRARY_NOT_FOUND = 40LL; +const int64 k_T_FUNC_C = 362LL; +const int64 k_MW_ObliqueStyle = 3LL; +const int64 k_SOCKET_ENETUNREACH = 101LL; +const int64 k_MW_EdgeDetectPreview = 18LL; +const int64 k_XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21LL; +const int64 k_MW_DstInCompositeOp = 23LL; +const int64 k_LDAP_DEREF_SEARCHING = 1LL; +const int64 k_STREAM_IPPROTO_ICMP = 1LL; +const int64 k_SIGFPE = 8LL; +const int64 k_LIBXML_NOCDATA = 16384LL; +const int64 k_SOCKET_ENXIO = 6LL; +const int64 k_MW_MinusCompositeOp = 35LL; +const int64 k_MW_RotatePreview = 1LL; +const int64 k_U_REGEX_BAD_ESCAPE_SEQUENCE = 66307LL; +const int64 k_IMG_FILTER_GRAYSCALE = 1LL; +const int64 k_PREG_SET_ORDER = 2LL; +const int64 k_SORT_STRING = 2LL; +const int64 k_CURLOPT_FORBID_REUSE = 75LL; +const int64 k_U_BRK_MISMATCHED_PAREN = 66055LL; +const int64 k_MW_LosslessJPEGCompression = 7LL; +const int64 k_XML_ERROR_PARAM_ENTITY_REF = 10LL; +const int64 k_CURLAUTH_BASIC = 1LL; +const int64 k_MW_UndefinedFilter = 0LL; +const int64 k_MW_NorthWestGravity = 1LL; +const int64 k_PKCS7_NOCERTS = 2LL; +const int64 k_MYSQLI_ASSOC = 1LL; +const int64 k_OCI_COMMIT_ON_SUCCESS = 32LL; +const int64 k_POSIX_S_IFSOCK = 49152LL; +const int64 k_IMG_PNG = 4LL; +const int64 k_DEBUG_LOG_IP = 64LL; +const int64 k_CURLE_FTP_WEIRD_USER_REPLY = 12LL; +const int64 k_CURLE_FTP_WEIRD_PASS_REPLY = 11LL; +const int64 k_MW_InCompositeOp = 32LL; +const int64 k_STREAM_NOTIFY_SEVERITY_INFO = 0LL; +const int64 k_MB_OVERLOAD_STRING = 2LL; +const int64 k_XML_ELEMENT_DECL_NODE = 15LL; +const int64 k_CURLINFO_PRIVATE = 1048597LL; +const int64 k_MW_FileOpenError = 430LL; +const int64 k_CURL_TIMECOND_IFMODSINCE = 1LL; +const int64 k_CURLINFO_TOTAL_TIME = 3145731LL; +const int64 k_IDNA_NO_ACE_PREFIX = 6LL; +const int64 k_SIGILL = 4LL; +const int64 k_T_NEW = 299LL; +const int64 k_CURLOPT_PROXY = 10004LL; +const int64 k_SOCKET_EBADRQC = 56LL; +const int64 k_SQLT_BFILEE = 114LL; +const int64 k_U_BRK_INIT_ERROR = 66058LL; +const int64 k_MW_AndEvaluateOperator = 2LL; +const int64 k_CURLE_FTP_PORT_FAILED = 30LL; +const int64 k_MW_RollPreview = 3LL; +const int64 k_SIGINT = 2LL; +const int64 k_SOCKET_EBADSLT = 57LL; +const int64 k_STREAM_CRYPTO_METHOD_SSLv3_CLIENT = 1LL; +const int64 k_SIGIOT = 6LL; +const int64 k_SIGHUP = 1LL; +const int64 k_MYSQL_ASSOC = 1LL; +const int64 k_U_ILLEGAL_ESCAPE_SEQUENCE = 18LL; +const int64 k_MW_ItalicStyle = 2LL; +const int64 k_U_UNEXPECTED_TOKEN = 65792LL; +const int64 k_MW_NoneDispose = 1LL; +const int64 k_MW_ImplodePreview = 25LL; +const int64 k_T_ENDWHILE = 319LL; +const int64 k_MW_StreamFatalError = 740LL; +const int64 k_U_ZERO_ERROR = 0LL; +const int64 k_DOM_HIERARCHY_REQUEST_ERR = 3LL; +const int64 k_MW_UndefinedMode = 0LL; +const StaticString k_PHP_CONFIG_FILE_SCAN_DIR = ""; +const int64 k_T_ISSET = 349LL; +const int64 k_LC_CTYPE = 0LL; +const int64 k_PSFS_ERR_FATAL = 0LL; +const int64 k_SIGPIPE = 13LL; +const int64 k_T_INTERFACE = 353LL; +const int64 k_MW_AllChannels = 255LL; +const int64 k_MW_DarkenCompositeOp = 20LL; +const int64 k_STREAM_NOTIFY_AUTH_RESULT = 10LL; +const int64 k_SQLT_CFILEE = 115LL; +const int64 k_MYSQLI_MULTIPLE_KEY_FLAG = 8LL; +const int64 k_MW_SrcCompositeOp = 47LL; +const int64 k_T_MOD_EQUAL = 272LL; +const double k_M_SQRTPI = 1.7724538509054999; +const int64 k_PNG_FILTER_SUB = 16LL; +const int64 k_FILE_APPEND = 8LL; +const int64 k_SOCKET_ESTRPIPE = 86LL; +const int64 k_OPENSSL_ALGO_MD2 = 4LL; +const int64 k_DOM_SYNTAX_ERR = 12LL; +const int64 k_OPENSSL_ALGO_MD4 = 3LL; +const int64 k_OPENSSL_ALGO_MD5 = 2LL; +const int64 k_EXTR_PREFIX_IF_EXISTS = 5LL; +const int64 k_INFO_ALL = 4294967295LL; +const int64 k_CURLOPT_SSLCERTPASSWD = 10026LL; +const int64 k_XML_OPTION_SKIP_TAGSTART = 3LL; +const int64 k_MW_HuePreview = 4LL; +const int64 k_MW_IntegerPixel = 4LL; +const int64 k_IMG_EFFECT_REPLACE = 0LL; +const int64 k_OCI_B_CURSOR = 116LL; +const int64 k_OPENSSL_NO_PADDING = 3LL; +const int64 k_MW_FillToBorderMethod = 4LL; +const int64 k_U_BRK_NEW_LINE_IN_QUOTED_STRING = 66056LL; +const int64 k_STREAM_PF_INET = 2LL; +const int64 k_SOCKET_EHOSTDOWN = 112LL; +const int64 k_MW_UserSpaceOnUse = 2LL; +const int64 k_MW_UndefinedChannel = 0LL; +const int64 k_SOCKET_ERESTART = 85LL; +const int64 k_ERA = 131116LL; +const int64 k_XML_OPTION_TARGET_ENCODING = 2LL; +const int64 k_CURLOPT_PRIVATE = 10103LL; +const int64 k_SOCKET_EALREADY = 114LL; +const int64 k_XSD_NMTOKENS = 144LL; +const int64 k_MW_TrueColorMatteType = 7LL; +const int64 k_XSD_LANGUAGE = 122LL; +const int64 k_MW_UniformNoise = 1LL; +const int64 k_U_MEMORY_ALLOCATION_ERROR = 7LL; +const int64 k_SORT_ASC = 4LL; +const int64 k_IMG_FILTER_EMBOSS = 6LL; +const int64 k_U_REGEX_INVALID_FLAG = 66315LL; +const int64 k_U_UNQUOTED_SPECIAL = 65555LL; +const int64 k_MYSQLI_OPT_LOCAL_INFILE = 8LL; +const int64 k_MYSQLI_AUTO_INCREMENT_FLAG = 512LL; +const int64 k_U_UNDEFINED_VARIABLE = 65554LL; +const int64 k_SOAP_LITERAL = 2LL; +const int64 k_XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9LL; +const int64 k_MW_BlurPreview = 16LL; +const int64 k_U_INVALID_RBT_SYNTAX = 65560LL; +const int64 k_MW_SouthEastGravity = 9LL; +const int64 k_SOCKET_EXFULL = 54LL; +const int64 k_T_OPEN_TAG_WITH_ECHO = 368LL; +const int64 k_MYSQL_CLIENT_SSL = 2048LL; +const int64 k_MW_LineThroughDecoration = 4LL; +const int64 k_T_START_HEREDOC = 371LL; +const int64 k_U_VARIABLE_RANGE_EXHAUSTED = 65565LL; +const int64 k_E_ERROR = 1LL; +const int64 k_INI_USER = 1LL; +const int64 k_MW_DstCompositeOp = 22LL; +const int64 k_SO_SNDTIMEO = 21LL; +const int64 k_MW_GrayscaleMatteType = 3LL; +const int64 k_CURLE_FUNCTION_NOT_FOUND = 41LL; +const int64 k_CURLOPT_ENCODING = 10102LL; +const int64 k_MW_ExtraCondensedStretch = 3LL; +const int64 k_T_IS_GREATER_OR_EQUAL = 284LL; +const int64 k_T_BAD_CHARACTER = 313LL; +const int64 k_T_INSTANCEOF = 288LL; +const int64 k_MW_LuminizeCompositeOp = 34LL; +const int64 k_MYSQLI_READ_DEFAULT_GROUP = 5LL; +const int64 k_XML_ERROR_MISPLACED_XML_PI = 17LL; +const int64 k_MW_AnyStyle = 4LL; +const int64 k_MW_CyanChannel = 1LL; +const int64 k_CURLINFO_SPEED_DOWNLOAD = 3145737LL; +const int64 k_MYSQLI_BOTH = 3LL; +const int64 k_MW_CacheFatalError = 745LL; +const int64 k_MW_WandWarning = 370LL; +const int64 k_T_VAR = 347LL; +const int64 k_PATHINFO_DIRNAME = 1LL; +const int64 k_MW_AlphaChannel = 8LL; +const int64 k_CURLPROXY_SOCKS5 = 5LL; +const int64 k_SIGPOLL = 29LL; +const int64 k_MW_CopyCyanCompositeOp = 14LL; +const int64 k_CURLINFO_CONTENT_LENGTH_DOWNLOAD = 3145743LL; +const int64 k_IMG_XPM = 16LL; +const StaticString k_INF = "INF"; +const int64 k_CURLOPT_HTTPAUTH = 107LL; +const int64 k_XML_ATTRIBUTE_NMTOKENS = 8LL; +const int64 k_MW_MissingDelegateError = 420LL; +const int64 k_MW_UserSpace = 1LL; +const int64 k_CURLFTPSSL_ALL = 3LL; +const int64 k_MYSQLI_CLIENT_NO_SCHEMA = 16LL; +const int64 k_T_CATCH = 337LL; +const int64 k_SOCKET_EROFS = 30LL; +const int64 k_INFO_VARIABLES = 32LL; +const int64 k_CURLOPT_DNS_CACHE_TIMEOUT = 92LL; +const int64 k_U_REGEX_RULE_SYNTAX = 66305LL; +const int64 k_CURLE_OK = 0LL; +const int64 k_T_TRY = 336LL; +const int64 k_T_ENDDECLARE = 325LL; +const int64 k_CURL_IPRESOLVE_V4 = 1LL; +const int64 k_XML_LOCAL_NAMESPACE = 18LL; +const int64 k_XSD_UNSIGNEDBYTE = 142LL; +const int64 k_CURLOPT_TCP_NODELAY = 121LL; +const int64 k_CURL_IPRESOLVE_V6 = 2LL; +const int64 k_CRYPT_BLOWFISH = 0LL; +const int64 k_XML_ATTRIBUTE_IDREF = 3LL; +const int64 k_U_ENUM_OUT_OF_SYNC_ERROR = 25LL; +const int64 k_T_USE = 339LL; +const StaticString k_MCRYPT_CAST_128 = "cast-128"; +const int64 k_CURLINFO_EFFECTIVE_URL = 1048577LL; +const int64 k_T_IS_EQUAL = 283LL; +const StaticString k_MCRYPT_RIJNDAEL_128 = "rijndael-128"; +const int64 k_SQLT_AFC = 96LL; +const int64 k_MW_SetEvaluateOperator = 10LL; +const int64 k_CURLOPT_TIMEVALUE = 34LL; +const int64 k_SIGPWR = 30LL; +const int64 k_OCI_B_ROWID = 104LL; +const int64 k_MW_FatalErrorException = 700LL; +const int64 k_CURLOPT_HTTPHEADER = 10023LL; +const int64 k_CURLOPT_COOKIEFILE = 10031LL; +const StaticString k_PHP_LIBDIR = ""; +const int64 k_DEBUG_LOG_AGENT = 8LL; +const int64 k_DNS_PTR = 2048LL; +const int64 k_XML_ERROR_SYNTAX = 2LL; +const int64 k_U_NO_SPACE_AVAILABLE = 20LL; +const int64 k_T_CONSTANT_ENCAPSED_STRING = 315LL; +const int64 k_MW_MeanAbsoluteErrorMetric = 2LL; +const int64 k_CURLOPT_PROXYAUTH = 111LL; +const StaticString k_NAN = "NAN"; +const int64 k_GD_RELEASE_VERSION = 35LL; +const int64 k_SOL_SOCKET = 1LL; +const StaticString k_MCRYPT_RIJNDAEL_192 = "rijndael-192"; +const int64 k_SOCKET_ENOMEDIUM = 123LL; +const int64 k_CURLOPT_COOKIESESSION = 96LL; +const int64 k_SIGPROF = 27LL; +const StaticString k_MCRYPT_ARCFOUR_IV = "arcfour-iv"; +const int64 k_MW_UndefinedNoise = 0LL; +const StaticString k_MCRYPT_CAST_256 = "cast-256"; +const int64 k_MW_BevelJoin = 3LL; +const int64 k_PREG_SPLIT_OFFSET_CAPTURE = 4LL; +const int64 k_IDNA_CONTAINS_MINUS = 4LL; +const int64 k_SO_KEEPALIVE = 9LL; +const StaticString k_MCRYPT_RIJNDAEL_256 = "rijndael-256"; +const int64 k_MW_UndefinedInterlace = 0LL; +const int64 k_U_STANDARD_ERROR_LIMIT = 31LL; +const int64 k_T_OPEN_TAG = 367LL; +const int64 k_MW_UndefinedException = 0LL; +const int64 k_LIBXML_NOERROR = 32LL; +const int64 k_CURLOPT_NETRC = 51LL; +const int64 k_DNS_SOA = 32LL; +const int64 k_SQLT_BIN = 23LL; +const int64 k_MW_ShortPixel = 7LL; +const int64 k_MW_DelegateError = 415LL; +const int64 k_SIGSEGV = 11LL; +const int64 k_MW_TypeFatalError = 705LL; +const int64 k_U_REGEX_LOOK_BEHIND_LIMIT = 66316LL; +const int64 k_CURLFTPAUTH_DEFAULT = 0LL; +const int64 k_STREAM_SOCK_DGRAM = 2LL; +const int64 k_CURLCLOSEPOLICY_OLDEST = 1LL; +const int64 k_STREAM_URL_STAT_QUIET = 2LL; +const int64 k_SQLT_CHR = 1LL; +const int64 k_SOCKET_EACCES = 13LL; +const int64 k_MYSQLI_TYPE_INT24 = 9LL; +const int64 k_SOCK_RAW = 3LL; +const int64 k_SQLT_AVC = 97LL; +const int64 k_MYSQLI_TYPE_INTERVAL = 247LL; +const int64 k_SOCK_RDM = 4LL; +const int64 k_DNS_SRV = 33554432LL; +const int64 k_XSD_UNSIGNEDINT = 140LL; +const int64 k_SIGSYS = 31LL; +const int64 k_SOAP_RPC = 1LL; +const int64 k_MW_PoissonNoise = 6LL; +const int64 k_SIGURG = 23LL; +const int64 k_SOCKET_ETIME = 62LL; +const int64 k_T_ENDFOREACH = 323LL; +const StaticString k_PHP_SAPI = "cli"; +const StaticString k_PHP_PREFIX = ""; +const int64 k_U_BRK_ERROR_LIMIT = 66062LL; +const int64 k_MW_SwirlPreview = 24LL; +const int64 k_MW_BumpmapCompositeOp = 5LL; +const int64 k_SOAP_SINGLE_ELEMENT_ARRAYS = 1LL; +const int64 k_MYSQL_CLIENT_INTERACTIVE = 1024LL; +const int64 k_CURLOPT_CRLF = 27LL; +const int64 k_CURL_HTTP_VERSION_1_0 = 1LL; +const int64 k_CURL_HTTP_VERSION_1_1 = 2LL; +const StaticString k_MCRYPT_MODE_NOFB = "nofb"; +const int64 k_CURLOPT_MAXCONNECTS = 71LL; +const int64 k_XML_ATTRIBUTE_IDREFS = 4LL; +const int64 k_T_INT_CAST = 295LL; +const int64 k_XSD_POSITIVEINTEGER = 143LL; +const int64 k_CURLOPT_SSL_VERIFYHOST = 81LL; +const int64 k_XSD_NCNAME = 125LL; +const int64 k_X509_PURPOSE_SMIME_SIGN = 4LL; +const int64 k_SOCKET_EPROTOTYPE = 91LL; +const int64 k_U_ERROR_WARNING_LIMIT = -120LL; +const int64 k_MYSQLI_TYPE_ENUM = 247LL; +const int64 k_CURLE_PARTIAL_FILE = 18LL; +const int64 k_PHP_URL_HOST = 1LL; +const int64 k_STREAM_SOCK_STREAM = 1LL; +const int64 k_MW_DrawError = 460LL; +const double k_M_E = 2.7182818284589998; +const int64 k_DNS_TXT = 32768LL; +const int64 k_DOM_WRONG_DOCUMENT_ERR = 4LL; +const StaticString k_MCRYPT_XTEA = "xtea"; +const int64 k_SO_RCVTIMEO = 20LL; +const int64 k_XSD_NONNEGATIVEINTEGER = 138LL; +const int64 k_CURLE_WRITE_ERROR = 23LL; +const int64 k_ALT_DIGITS = 131119LL; +const int64 k_XHPROF_FLAGS_CPU = 2LL; +const int64 k_MW_SquareCap = 3LL; +const int64 k_MYSQLI_NO_DATA = 100LL; +const int64 k_SOCKET_EIO = 5LL; +const int64 k_MW_OHTAColorspace = 4LL; +const int64 k_U_MISSING_RESOURCE_ERROR = 2LL; +const int64 k_T_DOUBLE_CAST = 294LL; +const int64 k_SQLT_FLT = 4LL; +const int64 k_FILE_USE_INCLUDE_PATH = 1LL; +const int64 k_SOCKET_ENOTSOCK = 88LL; +const int64 k_XSD_DATE = 109LL; +const int64 k_E_RECOVERABLE_ERROR = 4096LL; +const int64 k_OCI_ASSOC = 1LL; +const int64 k_CURLE_SSL_ENGINE_SETFAILED = 54LL; +const int64 k_U_MULTIPLE_POST_CONTEXTS = 65551LL; +const int64 k_GLOB_NOCHECK = 16LL; +const int64 k_PREG_RECURSION_LIMIT_ERROR = 3LL; +const int64 k_T_ENDFOR = 321LL; +const int64 k_DNS_A = 1LL; +const StaticString k_PHP_CONFIG_FILE_PATH = ""; +const int64 k_MW_RoundJoin = 2LL; +const int64 k_MW_ModulateCompositeOp = 36LL; +const int64 k_CURLE_SHARE_IN_USE = 57LL; +const int64 k_U_ILLEGAL_PAD_POSITION = 65800LL; +const int64 k_LIBXML_VERSION = 20620LL; +const int64 k_MW_UndefinedResource = 0LL; +const int64 k_DOM_NO_MODIFICATION_ALLOWED_ERR = 7LL; +const int64 k_CURLOPT_SSLKEYPASSWD = 10026LL; +const int64 k_CURLOPT_SSLCERT = 10025LL; +const int64 k_SIGQUIT = 3LL; +const int64 k_MW_ResetMethod = 5LL; +const int64 k_SQLT_BFLOAT = 21LL; +const StaticString k_MCRYPT_SKIPJACK = "skipjack"; +const int64 k_SO_DONTROUTE = 5LL; +const int64 k_T_DECLARE = 324LL; +const int64 k_SIGTERM = 15LL; +const int64 k_T_GLOBAL = 340LL; +const int64 k_MW_MissingDelegateWarning = 320LL; +const int64 k_MW_PerceptualIntent = 2LL; +const int64 k_POSIX_R_OK = 4LL; +const int64 k_T_STRING = 307LL; +const int64 k_INFO_CREDITS = 2LL; +const int64 k_STR_PAD_LEFT = 0LL; +const int64 k_XSD_ID = 126LL; +const int64 k_MW_TransparentColorspace = 3LL; +const int64 k_OCI_RETURN_NULLS = 4LL; +const int64 k_T_IS_IDENTICAL = 281LL; +const int64 k_CLOCK_PROCESS_CPUTIME_ID = 2LL; +const int64 k_MW_UndefinedEvaluateOperator = 0LL; +const int64 k_OPENSSL_ALGO_SHA1 = 1LL; +const int64 k_MW_CopyYellowCompositeOp = 19LL; +const int64 k_MW_CopyGreenCompositeOp = 15LL; +const int64 k_CURLOPT_FILE = 10001LL; +const int64 k_SQLT_INT = 3LL; +const int64 k_IMG_EFFECT_OVERLAY = 3LL; +const int64 k_SQLT_LBI = 24LL; +const int64 k_WSDL_CACHE_MEMORY = 2LL; +const int64 k_GD_MINOR_VERSION = 0LL; +const int64 k_XSD_TOKEN = 121LL; +const int64 k_FNM_NOESCAPE = 2LL; +const int64 k_U_BRK_RULE_EMPTY_SET = 66059LL; +const int64 k_PHP_OUTPUT_HANDLER_START = 1LL; +const int64 k_INFO_GENERAL = 1LL; +const int64 k_LOG_ERR = 3LL; +const int64 k_MYSQLI_NUM = 2LL; +const int64 k_MYSQLI_OPT_CONNECT_TIMEOUT = 0LL; +const int64 k_MW_RGBColorspace = 1LL; +const int64 k_DEBUG_LOG_COOKIE = 128LL; +const int64 k_EXTR_PREFIX_INVALID = 4LL; +const int64 k_U_REGEX_ERROR_START = 66304LL; +const int64 k_MW_OrEvaluateOperator = 8LL; +const int64 k_SORT_NUMERIC = 1LL; +const int64 k_CURLINFO_HEADER_OUT = 2LL; +const int64 k_MW_UndefinedCompositeOp = 0LL; +const int64 k_MW_DiskResource = 2LL; +const int64 k_OCI_D_LOB = 50LL; +const int64 k_XML_DOCUMENT_NODE = 9LL; +const int64 k_LDAP_DEREF_NEVER = 0LL; +const StaticString k_MCRYPT_THREEWAY = "threeway"; +const int64 k_MW_ExtraExpandedStretch = 8LL; +const int64 k_MW_AbsoluteIntent = 3LL; +const int64 k_FORCE_GZIP = 1LL; +const int64 k_OCI_B_BLOB = 113LL; +const int64 k_CASE_UPPER = 1LL; +const StaticString k_PHP_EOL = "\n"; +const int64 k_SQLT_LNG = 8LL; +const int64 k_SOCKET_ENETRESET = 102LL; +const int64 k_MW_CubicFilter = 10LL; +const int64 k_U_MISPLACED_COMPOUND_FILTER = 65558LL; +const int64 k_MYSQLI_NUM_FLAG = 32768LL; +const int64 k_MB_CASE_UPPER = 0LL; +const int64 k_CURLE_FAILED_INIT = 2LL; +const int64 k_MW_DrawFatalError = 760LL; +const int64 k_IDNA_CONTAINS_NON_LDH = 3LL; +const int64 k_T_FOREACH = 322LL; +const int64 k_CURLOPT_UPLOAD = 46LL; +const int64 k_MW_PixelsPerCentimeterResolution = 2LL; +const int64 k_MYSQLI_TYPE_MEDIUM_BLOB = 250LL; +const int64 k_CURLOPT_AUTOREFERER = 58LL; +const int64 k_SOAP_FUNCTIONS_ALL = 999LL; +const int64 k_SOCK_SEQPACKET = 5LL; +const int64 k_SQLT_LVC = 94LL; +const int64 k_MW_OptionWarning = 310LL; +const int64 k_SQLT_ODT = 156LL; +const int64 k_SOCKET_EFAULT = 14LL; +const int64 k_MW_MiterJoin = 1LL; +const int64 k_NOEXPR = 327681LL; +const int64 k_STREAM_CRYPTO_METHOD_TLS_CLIENT = 3LL; +const int64 k_CURLOPT_USERAGENT = 10018LL; +const int64 k_MW_RegistryError = 490LL; +const int64 k_MYSQLI_CLIENT_SSL = 2048LL; +const int64 k_CURLOPT_INTERFACE = 10062LL; +const int64 k_MW_BilevelType = 1LL; +const int64 k_XSD_BOOLEAN = 102LL; +const int64 k_U_MULTIPLE_DECIMAL_SEPARATORS = 65793LL; +const int64 k_E_CORE_ERROR = 16LL; +const int64 k_RADIXCHAR = 65536LL; +const int64 k_EXIF_USE_MBSTRING = 0LL; +const int64 k_MW_LZWCompression = 8LL; +const int64 k_MW_XorEvaluateOperator = 12LL; +const int64 k_XSD_GMONTH = 114LL; +const int64 k_SOAP_WAIT_ONE_WAY_CALLS = 2LL; +const int64 k_U_STRINGPREP_PROHIBITED_ERROR = 66560LL; +const int64 k_MW_TypeWarning = 305LL; +const int64 k_U_MULTIPLE_CURSORS = 65550LL; +const StaticString k_MCRYPT_SERPENT = "serpent"; +const int64 k_MYSQLI_TYPE_DECIMAL = 0LL; +const int64 k_MYSQLI_PART_KEY_FLAG = 16384LL; +const int64 k_MW_MultiplicativeGaussianNoise = 3LL; +const int64 k_INI_PERDIR = 2LL; +const int64 k_XML_ATTRIBUTE_ID = 2LL; +const int64 k_MB_OVERLOAD_MAIL = 1LL; +const int64 k_CURLOPT_SSLCERTTYPE = 10086LL; +const int64 k_SQLT_NUM = 2LL; +const StaticString k_MCRYPT_CRYPT = "crypt"; +const int64 k_CURLE_OUT_OF_MEMORY = 27LL; +const int64 k_SQLT_RDD = 104LL; +const int64 k_SQLT_NTY = 108LL; +const int64 k_MW_PlaneInterlace = 3LL; +const int64 k_MW_ResourceLimitFatalError = 700LL; +const int64 k_U_MALFORMED_SET = 65538LL; +const int64 k_LOG_USER = 8LL; +const int64 k_LDAP_OPT_HOST_NAME = 48LL; +const int64 k_CURLOPT_RETURNTRANSFER = 19913LL; +const int64 k_CURLE_FTP_WEIRD_PASV_REPLY = 13LL; +const int64 k_CURLOPT_WRITEHEADER = 10029LL; +const int64 k_OCI_B_CLOB = 112LL; +const int64 k_SOCKET_ENOTUNIQ = 76LL; +const int64 k_MW_DstAtopCompositeOp = 21LL; +const int64 k_LOG_LPR = 48LL; +const int64 k_MW_LineInterlace = 2LL; +const int64 k_SOCKET_EXDEV = 18LL; +const int64 k_U_NO_WRITE_PERMISSION = 30LL; +const int64 k_MW_MaxRGB = 65535LL; +const int64 k_SIGWINCH = 28LL; +const int64 k_OCI_DESCRIBE_ONLY = 16LL; +const int64 k_SOCKET_ENAMETOOLONG = 36LL; +const int64 k_CLOCK_REALTIME = 0LL; +const int64 k_XML_ATTRIBUTE_ENTITY = 6LL; +const int64 k_LIBXML_ERR_FATAL = 3LL; +const int64 k_SOCKET_ENOANO = 55LL; +const int64 k_T_CLASS_C = 360LL; +const int64 k_XSD_FLOAT = 104LL; +const int64 k_LOG_UUCP = 64LL; +const int64 k_MW_ClearCompositeOp = 7LL; +const int64 k_STREAM_OOB = 1LL; +const int64 k_OCI_D_ROWID = 54LL; +const int64 k_STREAM_IGNORE_URL = 2LL; +const int64 k_SOCKET_EBADFD = 77LL; +const int64 k_U_ILLEGAL_CHARACTER = 65567LL; +const int64 k_SIGSTOP = 19LL; +const int64 k_SIGTRAP = 5LL; +const int64 k_ENT_QUOTES = 3LL; +const int64 k_CURLE_SSL_CACERT = 60LL; +const int64 k_LIBXML_NOBLANKS = 256LL; +const int64 k_IDNA_PUNYCODE_ERROR = 2LL; +const int64 k_CURLFTPSSL_TRY = 1LL; +const int64 k_MW_CMYKColorspace = 12LL; +const int64 k_SOAP_AUTHENTICATION_DIGEST = 1LL; +const int64 k_CURLOPT_HEADER = 42LL; +const StaticString k_PHP_LOCALSTATEDIR = ""; +const int64 k_LOG_PID = 1LL; +const int64 k_SOCKET_ENODEV = 19LL; +const int64 k_SQLT_BLOB = 113LL; +const int64 k_CURLFTPAUTH_TLS = 2LL; +const int64 k_XML_ERROR_UNCLOSED_TOKEN = 5LL; +const int64 k_CURLFTPAUTH_SSL = 1LL; +const int64 k_XML_ERROR_UNCLOSED_CDATA_SECTION = 20LL; +const int64 k_U_RESOURCE_TYPE_MISMATCH = 17LL; +const int64 k_T_AND_EQUAL = 271LL; +const int64 k_U_MULTIPLE_PERMILL_SYMBOLS = 65797LL; +const int64 k_E_COMPILE_ERROR = 64LL; +const int64 k_AF_INET = 2LL; +const int64 k_MW_MapResource = 4LL; +const int64 k_MW_TileVirtualPixelMethod = 7LL; +const int64 k_T_OR_EQUAL = 270LL; +const int64 k_DOM_INVALID_ACCESS_ERR = 15LL; +const int64 k_MW_RLECompression = 9LL; +const int64 k_PRIO_PGRP = 1LL; +const int64 k_SOCKET_ENOCSI = 50LL; +const int64 k_T_UNSET = 348LL; +const int64 k_XML_ENTITY_DECL_NODE = 17LL; +const int64 k_SQLT_UIN = 68LL; +const int64 k_SQLT_VCS = 9LL; +const int64 k_XSD_BYTE = 137LL; +const int64 k_MW_ImageFatalError = 765LL; +const int64 k_MW_MultiplyCompositeOp = 37LL; +const int64 k_MW_NorthGravity = 2LL; +const int64 k_MSG_EXCEPT = 4LL; +const int64 k_SQLT_STR = 5LL; +const int64 k_CURLOPT_FTP_SSL = 119LL; +const int64 k_SOCKET_EAGAIN = 11LL; +const int64 k_MW_UndefinedPreview = 0LL; +const int64 k_MW_CopyCompositeOp = 13LL; +const int64 k_MW_ModuleFatalError = 755LL; +const int64 k_CONNECTION_TIMEOUT = 2LL; +const int64 k_XSD_GDAY = 113LL; +const int64 k_XSD_NMTOKEN = 123LL; +const int64 k_MYSQLI_TYPE_DATETIME = 12LL; +const int64 k_SIGTTIN = 21LL; +const int64 k_SOCKET_ENOENT = 2LL; +const int64 k_CURLOPT_CUSTOMREQUEST = 10036LL; +const int64 k_DOM_NAMESPACE_ERR = 14LL; +const int64 k_MW_UndefinedCompression = 0LL; +const int64 k_LDAP_OPT_DEREF = 2LL; +const int64 k_T_CASE = 329LL; +const int64 k_MW_EvenOddRule = 1LL; +const int64 k_STREAM_NOTIFY_FILE_SIZE_IS = 5LL; +const int64 k_MW_PeakSignalToNoiseRatioMetric = 5LL; +const int64 k_SOAP_DOCUMENT = 2LL; +const int64 k_CURLE_FTP_COULDNT_RETR_FILE = 19LL; +const int64 k_MW_UndefinedIntent = 0LL; +const int64 k_MW_YellowChannel = 4LL; +const int64 k_WSDL_CACHE_NONE = 0LL; +const int64 k_SIGTSTP = 20LL; +const int64 k_SO_TYPE = 3LL; +const int64 k_MW_NorthEastGravity = 3LL; +const int64 k_INTL_MAX_LOCALE_LEN = 80LL; +const int64 k_SIGTTOU = 22LL; +const int64 k_MW_CacheError = 445LL; +const int64 k_CURLINFO_PRETRANSFER_TIME = 3145734LL; +const int64 k_SOCKET_ECONNABORTED = 103LL; +const int64 k_SOCKET_ENOLINK = 67LL; +const int64 k_MW_SrcInCompositeOp = 48LL; +const int64 k_MW_GrayscalePreview = 10LL; +const int64 k_MW_SegmentPreview = 23LL; +const int64 k_SOCKET_EADDRNOTAVAIL = 99LL; +const int64 k_CURLE_SSL_ENGINE_NOTFOUND = 53LL; +const int64 k_XML_ERROR_RECURSIVE_ENTITY_REF = 12LL; +const int64 k_SOAP_ACTOR_UNLIMATERECEIVER = 3LL; +const int64 k_SQLT_CLOB = 112LL; +const int64 k_MW_UndefinedRule = 0LL; +const int64 k_SOCKET_EPFNOSUPPORT = 96LL; +const int64 k_MW_DstOutCompositeOp = 24LL; +const int64 k_MW_PreviousDispose = 3LL; +const int64 k_MW_ConfigureError = 495LL; +const int64 k_GLOB_MARK = 2LL; +const int64 k_T_RETURN = 335LL; +const int64 k_CURLAUTH_NTLM = 8LL; +const StaticString k_MCRYPT_ENIGNA = "crypt"; +const int64 k_X509_PURPOSE_SMIME_ENCRYPT = 5LL; +const int64 k_SOCKET_EREMCHG = 78LL; +const int64 k_SOAP_PERSISTENCE_SESSION = 1LL; +const StaticString k_MCRYPT_SAFER128 = "safer-sk128"; +const int64 k_ICONV_MIME_DECODE_CONTINUE_ON_ERROR = 2LL; +const int64 k_OCI_DTYPE_ROWID = 54LL; +const int64 k_MCRYPT_DECRYPT = 1LL; +const int64 k_MW_YUVColorspace = 11LL; +const int64 k_CREDITS_SAPI = 4LL; +const int64 k_T_SL_EQUAL = 268LL; +const int64 k_INI_ALL = 7LL; +const int64 k_CURLOPT_COOKIEJAR = 10082LL; +const int64 k_UPLOAD_ERR_OK = 0LL; +const int64 k_MW_CacheWarning = 345LL; +const int64 k_HASH_HMAC = 1LL; +const int64 k_MW_ReplaceMethod = 2LL; +const int64 k_MSG_EOF = 512LL; +const int64 k_U_BAD_VARIABLE_DEFINITION = 65536LL; +const int64 k_MW_GaussianFilter = 8LL; +const int64 k_SOCKET_ENOLCK = 37LL; +const int64 k_SEEK_CUR = 1LL; +const int64 k_CURLOPT_FRESH_CONNECT = 74LL; +const int64 k_GD_BUNDLED = 1LL; +const int64 k_SEEK_END = 2LL; +const int64 k_MW_SaturationIntent = 1LL; +const int64 k_MSG_EOR = 128LL; +const int64 k_MW_NoInterlace = 1LL; +const int64 k_SIGUSR1 = 10LL; +const int64 k_U_SORT_KEY_TOO_SHORT_WARNING = -123LL; +const int64 k_SIGXCPU = 24LL; +const int64 k_SIGUSR2 = 12LL; +const int64 k_SOCKET_EBADE = 52LL; +const int64 k_MYSQLI_PRI_KEY_FLAG = 2LL; +const int64 k_SOCKET_EBADF = 9LL; +const int64 k_CURLINFO_REQUEST_SIZE = 2097164LL; +const int64 k_CURLOPT_TIMECONDITION = 33LL; +const int64 k_FNM_PATHNAME = 1LL; +const int64 k_CURL_TIMECOND_IFUNMODSINCE = 2LL; +const int64 k_MW_SharpenPreview = 15LL; +const int64 k_SQLT_BDOUBLE = 22LL; +const int64 k_SOCKET_EBADR = 53LL; +const int64 k_MW_PointFilter = 1LL; +const int64 k_SOCKET_EOPNOTSUPP = 95LL; +const int64 k_U_UNMATCHED_BRACES = 65801LL; +const int64 k_ENT_NOQUOTES = 0LL; +const StaticString k_PHP_OS = "Linux"; +const int64 k_PSFS_FEED_ME = 1LL; +const int64 k_LOG_WARNING = 4LL; +const int64 k_SOCKET_ENOMEM = 12LL; +const int64 k_CURLE_TELNET_OPTION_SYNTAX = 49LL; +const int64 k_PATHINFO_FILENAME = 8LL; +const StaticString k_PEAR_INSTALL_DIR = ""; +const int64 k_PHP_URL_QUERY = 6LL; +const int64 k_XSD_GMONTHDAY = 112LL; +const int64 k_MW_UndefinedAlign = 0LL; +const StaticString k_MCRYPT_BLOWFISH = "blowfish"; +const int64 k_CURLE_FTP_CANT_GET_HOST = 15LL; +const int64 k_PKCS7_NOSIGS = 4LL; +const int64 k_XML_CDATA_SECTION_NODE = 4LL; +const int64 k_U_MESSAGE_PARSE_ERROR = 6LL; +const int64 k_SOCKET_EADV = 68LL; +const int64 k_MW_QuantizePreview = 11LL; +const int64 k_CURLOPT_QUOTE = 10028LL; +const int64 k_STREAM_CRYPTO_METHOD_SSLv3_SERVER = 5LL; +const int64 k_STREAM_NOTIFY_CONNECT = 2LL; +const int64 k_SOAP_AUTHENTICATION_BASIC = 0LL; +const int64 k_IMG_FILTER_SELECTIVE_BLUR = 8LL; +const int64 k_CURLINFO_SIZE_UPLOAD = 3145735LL; +const int64 k_MW_BoxFilter = 2LL; +const int64 k_OPENSSL_CIPHER_3DES = 4LL; +const int64 k_SOCKET_ENONET = 64LL; +const int64 k_PREG_PATTERN_ORDER = 1LL; +const int64 k_SOCKET_EINVAL = 22LL; +const StaticString k_MCRYPT_SAFER64 = "safer-sk64"; +const int64 k_T_DIV_EQUAL = 274LL; +const int64 k_MW_ModuleError = 455LL; +const int64 k_U_INVALID_TABLE_FILE = 14LL; +const int64 k_T_ELSEIF = 302LL; +const int64 k_T_STRING_CAST = 293LL; + +/* preface starts */ +/* preface finishes */ +Variant pm_php$globals$constants_php(bool incOnce /* = false */, LVariableTable* variables /* = NULL */) { + FUNCTION_INJECTION(run_init::globals/constants.php); + { + DECLARE_SYSTEM_GLOBALS(g); + bool &alreadyRun = g->run_pm_php$globals$constants_php; + if (alreadyRun) { if (incOnce) return true;} + else alreadyRun = true; + if (!variables) variables = g; + } + DECLARE_SYSTEM_GLOBALS(g); + LVariableTable *gVariables __attribute__((__unused__)) = get_variable_table(); + return true; +} /* function */ + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/php/globals/constants.fw.h b/src/lib/system/gen/php/globals/constants.fw.h new file mode 100644 index 0000000000000..2b1bab49fc4e4 --- /dev/null +++ b/src/lib/system/gen/php/globals/constants.fw.h @@ -0,0 +1,1912 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_GLOBALS_CONSTANTS_FW_H__ +#define __GENERATED_PHP_GLOBALS_CONSTANTS_FW_H__ + +#include + +// Forward Declarations + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// 1. Constants +extern const int64 k_PATHINFO_BASENAME; +extern const int64 k_OPENSSL_VERSION_NUMBER; +extern const int64 k_CURLOPT_HEADERFUNCTION; +extern const int64 k_CURLOPT_INFILESIZE; +extern const int64 k_MW_ResourceLimitError; +extern const int64 k_MW_MeanSquaredErrorMetric; +extern const Variant k_NULL; +extern const int64 k_MW_ColorBurnCompositeOp; +extern const int64 k_PREG_SPLIT_DELIM_CAPTURE; +extern const int64 k_MW_ImpulseNoise; +extern const int64 k_PREG_GREP_INVERT; +extern const int64 k_MYSQLI_USE_RESULT; +extern const int64 k_T_COMMENT; +extern const int64 k_LOG_EMERG; +extern const int64 k_SIGXFSZ; +extern const int64 k_SOCKET_ENOMSG; +extern const int64 k_CURLOPT_INFILE; +extern const int64 k_IMAGETYPE_WBMP; +extern const int64 k_T_PRINT; +extern const int64 k_STREAM_REPORT_ERRORS; +extern const int64 k_PATHINFO_EXTENSION; +extern const int64 k_DEBUG_LOG_TRACE; +extern const int64 k_PHP_URL_PATH; +extern const int64 k_OCI_FETCHSTATEMENT_BY_ROW; +extern const int64 k_MW_MinEvaluateOperator; +extern const int64 k_PHP_URL_PASS; +extern const double k_M_2_SQRTPI; +extern const int64 k_XML_OPTION_CASE_FOLDING; +extern const int64 k_MYSQLI_TYPE_LONGLONG; +extern const int64 k_T_WHILE; +extern const int64 k_MW_NoCompositeOp; +extern const int64 k_T_ARRAY; +extern const int64 k_MW_HWBColorspace; +extern const int64 k_CURLOPT_SSL_VERIFYPEER; +extern const int64 k_U_UNDEFINED_SEGMENT_REFERENCE; +extern const int64 k_MW_UnframeMode; +extern const int64 k_MW_PeakAbsoluteErrorMetric; +extern const int64 k_U_REGEX_INVALID_BACK_REF; +extern const int64 k_MW_GreenChannel; +extern const int64 k_CURLOPT_POSTQUOTE; +extern const int64 k_OCI_D_FILE; +extern const int64 k_OPENSSL_CIPHER_RC2_128; +extern const int64 k_MW_CharPixel; +extern const int64 k_IMAGETYPE_TIFF_II; +extern const int64 k_INFO_MODULES; +extern const int64 k_CURLOPT_BUFFERSIZE; +extern const int64 k_MW_ShadePreview; +extern const int64 k_STREAM_SOCK_SEQPACKET; +extern const int64 k_SOCKET_ESPIPE; +extern const int64 k_DNS_NAPTR; +extern const int64 k_MW_AnyStretch; +extern const int64 k_T_ECHO; +extern const int64 k_IDNA_MALLOC_ERROR; +extern const int64 k_MYSQLI_GROUP_FLAG; +extern const int64 k_MYSQLI_REPORT_INDEX; +extern const int64 k_CREDITS_QA; +extern const int64 k_IMAGETYPE_TIFF_MM; +extern const int64 k_MW_NormalStretch; +extern const int64 k_MW_UndefinedPixel; +extern const int64 k_MW_UndefinedCap; +extern const int64 k_MYSQLI_NOT_NULL_FLAG; +extern const int64 k_IMAGETYPE_JPEG2000; +extern const int64 k_XSD_BASE64BINARY; +extern const int64 k_POSIX_W_OK; +extern const int64 k_OCI_B_BFILE; +extern const int64 k_XML_ERROR_UNKNOWN_ENCODING; +extern const int64 k_SIGABRT; +extern const int64 k_LIBXML_XINCLUDE; +extern const int64 k_MW_UnrecognizedDispose; +extern const int64 k_MW_OpacityChannel; +extern const int64 k_INFO_LICENSE; +extern const int64 k_MW_ColorizeCompositeOp; +extern const int64 k_MW_OutCompositeOp; +extern const int64 k_DNS_AAAA; +extern const int64 k_CURLE_FTP_COULDNT_STOR_FILE; +extern const int64 k_MW_DissolveCompositeOp; +extern const int64 k_GRAPHEME_EXTR_MAXBYTES; +extern const int64 k_IMAGETYPE_BMP; +extern const int64 k_CURLCLOSEPOLICY_CALLBACK; +extern const int64 k_MW_RootMeanSquaredErrorMetric; +extern const int64 k_SIGBABY; +extern const int64 k_MW_TrueColorType; +extern const int64 k_ASSERT_CALLBACK; +extern const int64 k_XSD_NEGATIVEINTEGER; +extern const int64 k_CURLINFO_CONNECT_TIME; +extern const int64 k_CASE_LOWER; +extern const int64 k_U_MALFORMED_EXPONENTIAL_PATTERN; +extern const int64 k_U_UNSUPPORTED_PROPERTY; +extern const int64 k_SOCKET_ENOSPC; +extern const double k_M_PI; +extern const int64 k_MSG_OOB; +extern const int64 k_LIBXML_NSCLEAN; +extern const int64 k_MW_JPEGCompression; +extern const int64 k_DOM_INVALID_CHARACTER_ERR; +extern const int64 k_CURLOPT_LOW_SPEED_LIMIT; +extern const int64 k_MB_CASE_LOWER; +extern const int64 k_CURLE_FTP_CANT_RECONNECT; +extern const int64 k_OCI_FETCHSTATEMENT_BY_COLUMN; +extern const int64 k_CURLOPT_POSTFIELDS; +extern const int64 k_MW_YCCColorspace; +extern const int64 k_SOCKET_EMULTIHOP; +extern const int64 k_T_BOOLEAN_AND; +extern const int64 k_OCI_TEMP_BLOB; +extern const int64 k_CREDITS_ALL; +extern const int64 k_STREAM_URL_STAT_LINK; +extern const int64 k_MW_UndefinedResolution; +extern const int64 k_SOCKET_ENOSTR; +extern const int64 k_STREAM_NOTIFY_FAILURE; +extern const int64 k_XML_ERROR_BINARY_ENTITY_REF; +extern const StaticString k_MCRYPT_IDEA; +extern const int64 k_U_REGEX_ERROR_LIMIT; +extern const int64 k_CURLE_SSL_CIPHER; +extern const int64 k_CURLOPT_PUT; +extern const int64 k_SOCK_DGRAM; +extern const int64 k_XSD_UNSIGNEDLONG; +extern const int64 k_T_CLASS; +extern const int64 k_T_WHITESPACE; +extern const int64 k_SOCKET_EISDIR; +extern const int64 k_SOCKET_ENOSYS; +extern const StaticString k_LIBXML_DOTTED_VERSION; +extern const int64 k_MW_LeftAlign; +extern const int64 k_SOCKET_ENOTTY; +extern const int64 k_LDAP_OPT_PROTOCOL_VERSION; +extern const int64 k_CURLM_OUT_OF_MEMORY; +extern const int64 k_SOCKET_EWOULDBLOCK; +extern const int64 k_DOM_INVALID_STATE_ERR; +extern const int64 k_CURLOPT_DNS_USE_GLOBAL_CACHE; +extern const int64 k_U_MISPLACED_ANCHOR_START; +extern const int64 k_IMAGETYPE_GIF; +extern const int64 k_POSIX_X_OK; +extern const int64 k_CURLM_OK; +extern const int64 k_MW_JPEGPreview; +extern const int64 k_DEBUG_LOG_DEFAULT; +extern const int64 k_MCRYPT_DEV_RANDOM; +extern const int64 k_OPENSSL_KEYTYPE_EC; +extern const int64 k_OPENSSL_KEYTYPE_DH; +extern const int64 k_SOCKET_ESOCKTNOSUPPORT; +extern const int64 k_CURLCLOSEPOLICY_SLOWEST; +extern const int64 k_MW_UndefinedType; +extern const int64 k_STREAM_FILTER_WRITE; +extern const int64 k_SEEK_SET; +extern const int64 k_MYSQLI_TIMESTAMP_FLAG; +extern const int64 k_CURLINFO_SSL_VERIFYRESULT; +extern const int64 k_SOCKET_EREMOTE; +extern const int64 k_MYSQLI_TYPE_LONG; +extern const int64 k_CURL_HTTP_VERSION_NONE; +extern const int64 k_MW_SaturationPreview; +extern const int64 k_CURLINFO_HTTP_CODE; +extern const int64 k_IMAGETYPE_JB2; +extern const int64 k_MW_MaxEvaluateOperator; +extern const int64 k_OCI_SYSOPER; +extern const int64 k_CURLOPT_PROXYUSERPWD; +extern const int64 k_MW_UnderlineDecoration; +extern const int64 k_T_IS_NOT_EQUAL; +extern const int64 k_ERA_D_T_FMT; +extern const int64 k_MYSQLI_TYPE_FLOAT; +extern const int64 k_IMAGETYPE_IFF; +extern const int64 k_MW_DstOverCompositeOp; +extern const int64 k_CREDITS_GENERAL; +extern const int64 k_MW_YCbCrColorspace; +extern const int64 k_SOCKET_ENETDOWN; +extern const int64 k_MW_DullPreview; +extern const int64 k_IMG_FILTER_BRIGHTNESS; +extern const int64 k_STREAM_MUST_SEEK; +extern const int64 k_GLOB_NOSORT; +extern const int64 k_MW_CorruptImageFatalError; +extern const int64 k_CURLFTPSSL_CONTROL; +extern const int64 k_DNS_HINFO; +extern const int64 k_U_BUFFER_OVERFLOW_ERROR; +extern const int64 k_U_INVALID_STATE_ERROR; +extern const int64 k_FILE_SKIP_EMPTY_LINES; +extern const int64 k_CURLMSG_DONE; +extern const int64 k_XML_ATTRIBUTE_ENUMERATION; +extern const int64 k_CURLINFO_SIZE_DOWNLOAD; +extern const int64 k_MW_RegistryWarning; +extern const int64 k_MW_NormalStyle; +extern const int64 k_CURLOPT_VERBOSE; +extern const int64 k_T_VARIABLE; +extern const int64 k_CURLE_FTP_BAD_DOWNLOAD_RESUME; +extern const int64 k_T_REQUIRE_ONCE; +extern const int64 k_MW_StreamWarning; +extern const int64 k_OCI_TEMP_CLOB; +extern const StaticString k_PHP_BINDIR; +extern const int64 k_MYSQLI_RPL_MASTER; +extern const int64 k_ICONV_MIME_DECODE_STRICT; +extern const int64 k_CURLOPT_URL; +extern const StaticString k_MCRYPT_GOST; +extern const int64 k_MW_QuadraticFilter; +extern const int64 k_MW_OpaqueOpacity; +extern const int64 k_U_RULE_MASK_ERROR; +extern const int64 k_MYSQLI_REPORT_STRICT; +extern const int64 k_MW_UndefinedStyle; +extern const int64 k_STREAM_NOTIFY_RESOLVE; +extern const int64 k_STREAM_IPPROTO_IP; +extern const int64 k_MW_NoCompression; +extern const int64 k_IMAGETYPE_JP2; +extern const int64 k_XSD_DURATION; +extern const int64 k_T_CLOSE_TAG; +extern const StaticString k_DATE_RFC822; +extern const int64 k_SOCKET_EL2NSYNC; +extern const int64 k_T_BREAK; +extern const int64 k_IMAGETYPE_JPC; +extern const int64 k_CURL_NETRC_OPTIONAL; +extern const int64 k_LC_TIME; +extern const int64 k_CURLE_FILESIZE_EXCEEDED; +extern const int64 k_DNS_A6; +extern const StaticString k_DATE_RFC850; +extern const int64 k_T_ELSE; +extern const int64 k_U_INVARIANT_CONVERSION_ERROR; +extern const int64 k_XSD_IDREFS; +extern const int64 k_T_OBJECT_CAST; +extern const int64 k_MW_FaxCompression; +extern const int64 k_CURLOPT_HTTP200ALIASES; +extern const int64 k_SIGALRM; +extern const int64 k_IMAGETYPE_JPX; +extern const int64 k_CURLE_BAD_PASSWORD_ENTERED; +extern const int64 k_SOAP_ENC_OBJECT; +extern const int64 k_T_FILE; +extern const int64 k_CREDITS_GROUP; +extern const int64 k_LOG_AUTH; +extern const int64 k_SOCKET_EDQUOT; +extern const int64 k_XSD_QNAME; +extern const int64 k_CURLOPT_TIMEOUT; +extern const int64 k_U_MISPLACED_CURSOR_OFFSET; +extern const int64 k_SOAP_ENCODED; +extern const int64 k_MW_SouthGravity; +extern const int64 k_PHP_URL_PORT; +extern const int64 k_LIBXML_NOEMPTYTAG; +extern const double k_M_SQRT2; +extern const double k_M_SQRT3; +extern const int64 k_MW_FileOpenWarning; +extern const int64 k_CURLOPT_UNRESTRICTED_AUTH; +extern const int64 k_D_T_FMT; +extern const int64 k_FILE_NO_DEFAULT_CONTEXT; +extern const int64 k_LOG_NOTICE; +extern const int64 k_MW_BackgroundDispose; +extern const int64 k_U_DIFFERENT_UCA_VERSION; +extern const int64 k_GLOB_BRACE; +extern const int64 k_E_COMPILE_WARNING; +extern const int64 k_MYSQLI_REPORT_ALL; +extern const int64 k_LIBXML_ERR_WARNING; +extern const int64 k_PSFS_PASS_ON; +extern const int64 k_STREAM_SOCK_RAW; +extern const int64 k_MW_SaturateCompositeOp; +extern const int64 k_INFO_ENVIRONMENT; +extern const int64 k_STREAM_SOCK_RDM; +extern const int64 k_U_INTERNAL_TRANSLITERATOR_ERROR; +extern const int64 k_FILE_IGNORE_NEW_LINES; +extern const int64 k_MW_OilPaintPreview; +extern const int64 k_CURLOPT_SSLENGINE; +extern const int64 k_SO_SNDBUF; +extern const int64 k_SOCKET_EISNAM; +extern const StaticString k_PATH_SEPARATOR; +extern const int64 k_MW_BlobWarning; +extern const int64 k_MW_RelativeIntent; +extern const int64 k_ERA_D_FMT; +extern const int64 k_MW_WarningException; +extern const int64 k_CURLINFO_NAMELOOKUP_TIME; +extern const int64 k_SOCKET_ESRMNT; +extern const int64 k_MYSQL_BOTH; +extern const int64 k_MW_ConfigureFatalError; +extern const int64 k_IMG_COLOR_STYLEDBRUSHED; +extern const int64 k_CURLCLOSEPOLICY_LEAST_TRAFFIC; +extern const int64 k_SOCKET_EREMOTEIO; +extern const int64 k_XSD_INTEGER; +extern const int64 k_XML_ERROR_PARTIAL_CHAR; +extern const int64 k_DNS_MX; +extern const int64 k_DNS_NS; +extern const int64 k_MW_FileOpenFatalError; +extern const int64 k_LOG_PERROR; +extern const int64 k_MW_SemiExpandedStretch; +extern const int64 k_MW_LABColorspace; +extern const int64 k_MW_HSLColorspace; +extern const int64 k_CURLOPT_FTPLISTONLY; +extern const int64 k_SOCKET_EMSGSIZE; +extern const int64 k_E_CORE_WARNING; +extern const int64 k_LOG_CONS; +extern const int64 k_CURLOPT_FAILONERROR; +extern const int64 k_MW_HardLightCompositeOp; +extern const int64 k_MW_TypeError; +extern const int64 k_T_SWITCH; +extern const int64 k_SOCKET_ECOMM; +extern const int64 k_T_REQUIRE; +extern const int64 k_XML_NOTATION_NODE; +extern const int64 k_T_DEFAULT; +extern const int64 k_IMG_JPEG; +extern const int64 k_DEBUG_LOG_NONE; +extern const int64 k_U_BRK_INTERNAL_ERROR; +extern const int64 k_CONNECTION_NORMAL; +extern const int64 k_MW_CopyBlueCompositeOp; +extern const int64 k_SIGCHLD; +extern const int64 k_U_BRK_MALFORMED_RULE_TAG; +extern const int64 k_EXTR_OVERWRITE; +extern const int64 k_INI_SYSTEM; +extern const StaticString k_XSD_1999_NAMESPACE; +extern const int64 k_X509_PURPOSE_ANY; +extern const int64 k_IMAGETYPE_PNG; +extern const int64 k_X509_PURPOSE_SSL_CLIENT; +extern const int64 k_STREAM_NOTIFY_SEVERITY_WARN; +extern const int64 k_LOG_ALERT; +extern const int64 k_MW_FileResource; +extern const int64 k_CURLE_SSL_CERTPROBLEM; +extern const int64 k_MSG_NOERROR; +extern const int64 k_XML_PI_NODE; +extern const int64 k_MW_ZipCompression; +extern const int64 k_LOG_CRIT; +extern const int64 k_CURLOPT_IPRESOLVE; +extern const int64 k_IMAGETYPE_PSD; +extern const int64 k_MW_ModuleWarning; +extern const StaticString k_PCRE_VERSION; +extern const int64 k_CURLOPT_NOBODY; +extern const int64 k_CURLOPT_EGDSOCKET; +extern const int64 k_CURLOPT_HTTPGET; +extern const int64 k_MW_HueCompositeOp; +extern const int64 k_T_EVAL; +extern const int64 k_LDAP_OPT_REFERRALS; +extern const int64 k_CURLE_UNSUPPORTED_PROTOCOL; +extern const int64 k_CURLE_SSL_PEER_CERTIFICATE; +extern const int64 k_T_CLONE; +extern const int64 k_SOCKET_EBUSY; +extern const int64 k_MW_SemiCondensedStretch; +extern const int64 k_CURL_VERSION_IPV6; +extern const int64 k_XML_ATTRIBUTE_DECL_NODE; +extern const int64 k_LOG_CRON; +extern const int64 k_MW_ReduceNoisePreview; +extern const int64 k_T_IMPLEMENTS; +extern const int64 k_T_FUNCTION; +extern const StaticString k_MCRYPT_DES; +extern const int64 k_MCRYPT_ENCRYPT; +extern const int64 k_INFO_CONFIGURATION; +extern const int64 k_IMG_FILTER_EDGEDETECT; +extern const int64 k_ABDAY_1; +extern const int64 k_SOCKET_ECONNRESET; +extern const int64 k_ABDAY_2; +extern const int64 k_ABDAY_3; +extern const int64 k_ABDAY_4; +extern const int64 k_STREAM_IS_URL; +extern const int64 k_ABDAY_5; +extern const int64 k_MW_UltraExpandedStretch; +extern const StaticString k_MCRYPT_3DES; +extern const int64 k_ABDAY_6; +extern const int64 k_ABDAY_7; +extern const int64 k_U_MULTIPLE_DECIMAL_SEPERATORS; +extern const int64 k_STREAM_CRYPTO_METHOD_TLS_SERVER; +extern const int64 k_MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH; +extern const int64 k_U_INVALID_PROPERTY_PATTERN; +extern const int64 k_U_TOO_MANY_ALIASES_ERROR; +extern const int64 k_PHP_URL_FRAGMENT; +extern const int64 k_U_UNTERMINATED_QUOTE; +extern const int64 k_U_MISPLACED_QUANTIFIER; +extern const StaticString k_DATE_W3C; +extern const int64 k_LC_MONETARY; +extern const int64 k_MW_CoderWarning; +extern const int64 k_SOCKET_ENOTCONN; +extern const int64 k_DNS_CNAME; +extern const int64 k_T_CURLY_OPEN; +extern const int64 k_U_BRK_UNRECOGNIZED_OPTION; +extern const int64 k_CURLE_OBSOLETE; +extern const int64 k_IMG_ARC_NOFILL; +extern const int64 k_U_INVALID_CHAR_FOUND; +extern const int64 k_MW_NonZeroRule; +extern const int64 k_MW_ConfigureWarning; +extern const int64 k_U_BRK_UNCLOSED_SET; +extern const int64 k_SORT_LOCALE_STRING; +extern const int64 k_MW_MitchellFilter; +extern const int64 k_XML_ERROR_NO_ELEMENTS; +extern const int64 k_U_INTERNAL_PROGRAM_ERROR; +extern const int64 k_IMAGETYPE_SWC; +extern const int64 k_IMAGETYPE_SWF; +extern const int64 k_MW_OverlayCompositeOp; +extern const StaticString k_DATE_RSS; +extern const int64 k_MW_sRGBColorspace; +extern const int64 k_YESEXPR; +extern const int64 k_IMG_EFFECT_NORMAL; +extern const int64 k_LOG_NOWAIT; +extern const int64 k_MW_UndefinedMethod; +extern const int64 k_T_EXIT; +extern const int64 k_MYSQLI_BLOB_FLAG; +extern const int64 k_T_NUM_STRING; +extern const int64 k_E_NOTICE; +extern const int64 k_IMAGETYPE_XBM; +extern const int64 k_CRYPT_STD_DES; +extern const int64 k_PRIO_USER; +extern const int64 k_STREAM_PF_UNIX; +extern const int64 k_MW_CoderFatalError; +extern const int64 k_XSD_GYEARMONTH; +extern const int64 k_CURLE_HTTP_PORT_FAILED; +extern const int64 k_CURLOPT_FTPAPPEND; +extern const int64 k_CURLOPT_FTP_CREATE_MISSING_DIRS; +extern const int64 k_MYSQLI_TYPE_NULL; +extern const int64 k_CURLINFO_CONTENT_TYPE; +extern const int64 k_XSD_NAME; +extern const int64 k_T_CONCAT_EQUAL; +extern const int64 k_PSFS_FLAG_NORMAL; +extern const int64 k_CURLE_HTTP_RANGE_ERROR; +extern const int64 k_U_MALFORMED_VARIABLE_DEFINITION; +extern const int64 k_XML_ENTITY_REF_NODE; +extern const int64 k_CLOCK_MONOTONIC; +extern const int64 k_T_INLINE_HTML; +extern const int64 k_MYSQLI_CLIENT_FOUND_ROWS; +extern const int64 k_CURLE_URL_MALFORMAT_USER; +extern const int64 k_CURLOPT_SSLKEYTYPE; +extern const int64 k_U_FMT_PARSE_ERROR_START; +extern const int64 k_CURL_VERSION_LIBZ; +extern const int64 k_E_STRICT; +extern const StaticString k_MCRYPT_TRIPLEDES; +extern const int64 k_STREAM_NOTIFY_PROGRESS; +extern const int64 k_MW_UndefinedStretch; +extern const int64 k_MW_TransparentOpacity; +extern const int64 k_SOCKET_ENOTBLK; +extern const int64 k_XSD_IDREF; +extern const int64 k_OCI_RETURN_LOBS; +extern const int64 k_MW_TriangleFilter; +extern const int64 k_SIGCONT; +extern const int64 k_CURLOPT_HTTPPROXYTUNNEL; +extern const int64 k_CURL_TIMECOND_LASTMOD; +extern const int64 k_SOCKET_EADDRINUSE; +extern const int64 k_MON_10; +extern const int64 k_MON_11; +extern const int64 k_MCC_ACCESSPOINT_DOWN; +extern const int64 k_MON_12; +extern const int64 k_XSD_INT; +extern const int64 k_OCI_B_CFILEE; +extern const int64 k_U_MISMATCHED_SEGMENT_DELIMITERS; +extern const int64 k_MYSQLI_TYPE_TIMESTAMP; +extern const int64 k_T_STATIC; +extern const int64 k_T_HALT_COMPILER; +extern const int64 k_SOCKET_ETOOMANYREFS; +extern const int64 k_XSD_ENTITY; +extern const int64 k_MW_XorCompositeOp; +extern const int64 k_STREAM_SERVER_BIND; +extern const int64 k_DOM_NO_DATA_ALLOWED_ERR; +extern const int64 k_OCI_LOB_BUFFER_FREE; +extern const int64 k_MW_GaussianNoise; +extern const StaticString k_MCRYPT_MARS; +extern const int64 k_LIBXML_DTDATTR; +extern const int64 k_T_BOOLEAN_OR; +extern const int64 k_U_BRK_SEMICOLON_EXPECTED; +extern const int64 k_SOCKET_ENOTDIR; +extern const int64 k_MW_MagentaChannel; +extern const int64 k_MYSQLI_REPORT_OFF; +extern const int64 k_CURLOPT_FOLLOWLOCATION; +extern const int64 k_CURLE_URL_MALFORMAT; +extern const int64 k_MYSQLI_CLIENT_INTERACTIVE; +extern const int64 k_MW_LeftShiftEvaluateOperator; +extern const int64 k_CURLOPT_MUTE; +extern const int64 k_MW_DrawWarning; +extern const bool k_TRUE; +extern const int64 k_LOG_SYSLOG; +extern const int64 k_IMG_FILTER_GAUSSIAN_BLUR; +extern const int64 k_T_ENCAPSED_AND_WHITESPACE; +extern const int64 k_STREAM_SERVER_LISTEN; +extern const int64 k_MW_SrcAtopCompositeOp; +extern const int64 k_SOCK_STREAM; +extern const int64 k_MW_ThresholdPreview; +extern const int64 k_XML_OPTION_SKIP_WHITE; +extern const int64 k_CURLE_READ_ERROR; +extern const int64 k_MW_MirrorVirtualPixelMethod; +extern const int64 k_MW_DespecklePreview; +extern const int64 k_U_PARSE_ERROR_START; +extern const int64 k_PNG_ALL_FILTERS; +extern const int64 k_XSD_LONG; +extern const int64 k_DEBUG_LOG_POST; +extern const int64 k_T_IS_NOT_IDENTICAL; +extern const int64 k_X509_PURPOSE_NS_SSL_SERVER; +extern const double k_M_LN2; +extern const int64 k_MW_SoftLightCompositeOp; +extern const double k_M_LN10; +extern const int64 k_T_ABSTRACT; +extern const int64 k_T_LNUMBER; +extern const int64 k_DEBUG_LOG_REFERER; +extern const int64 k_MSG_PEEK; +extern const StaticString k_MCRYPT_TWOFISH; +extern const int64 k_SIG_DFL; +extern const int64 k_MW_DisplaceCompositeOp; +extern const int64 k_U_ERROR_LIMIT; +extern const int64 k_ASSERT_QUIET_EVAL; +extern const int64 k_PKCS7_NOINTERN; +extern const int64 k_MW_LongPixel; +extern const int64 k_CRYPT_MD5; +extern const int64 k_MYSQLI_TYPE_SET; +extern const int64 k_LDAP_OPT_MATCHED_DN; +extern const int64 k_CURLOPT_USERPWD; +extern const StaticString k_DEFAULT_INCLUDE_PATH; +extern const int64 k_E_USER_NOTICE; +extern const int64 k_MW_CharcoalDrawingPreview; +extern const int64 k_MW_SubtractCompositeOp; +extern const int64 k_MW_CondensedStretch; +extern const int64 k_MW_CenterGravity; +extern const int64 k_CURLINFO_SPEED_UPLOAD; +extern const int64 k_GRAPHEME_EXTR_COUNT; +extern const int64 k_T_INCLUDE_ONCE; +extern const int64 k_MSG_DONTROUTE; +extern const int64 k_MW_OptimizeType; +extern const int64 k_WUNTRACED; +extern const int64 k_U_INVALID_ID; +extern const int64 k_CREDITS_MODULES; +extern const int64 k_MW_DivideEvaluateOperator; +extern const StaticString k_DATE_RFC1036; +extern const int64 k_U_INDEX_OUTOFBOUNDS_ERROR; +extern const int64 k_UPLOAD_ERR_FORM_SIZE; +extern const int64 k_LC_ALL; +extern const int64 k_XML_ERROR_INVALID_TOKEN; +extern const int64 k_CURLE_ABORTED_BY_CALLBACK; +extern const int64 k_SO_OOBINLINE; +extern const int64 k_MW_UndefinedMetric; +extern const StaticString k_DATE_RFC1123; +extern const int64 k_EXTR_PREFIX_SAME; +extern const int64 k_XML_DTD_NODE; +extern const int64 k_U_REGEX_MAX_LT_MIN; +extern const int64 k_MW_HSBColorspace; +extern const int64 k_MW_ForgetGravity; +extern const StaticString k_MCRYPT_RC2; +extern const int64 k_E_PARSE; +extern const int64 k_MW_ColorSeparationType; +extern const int64 k_MYSQLI_TYPE_DOUBLE; +extern const int64 k_MW_MonitorFatalError; +extern const StaticString k_MCRYPT_RC6; +extern const int64 k_CURLOPT_STDERR; +extern const int64 k_CURLE_MALFORMAT_USER; +extern const int64 k_CURLAUTH_ANY; +extern const int64 k_T_BOOL_CAST; +extern const int64 k_MW_StreamError; +extern const int64 k_XML_ERROR_TAG_MISMATCH; +extern const int64 k_LDAP_DEREF_FINDING; +extern const int64 k_MW_ResourceLimitWarning; +extern const int64 k_MW_XYZColorspace; +extern const int64 k_MW_ConcatenateMode; +extern const int64 k_SIG_ERR; +extern const int64 k_XHPROF_FLAGS_MEMORY; +extern const int64 k_GLOB_NOESCAPE; +extern const int64 k_T_LOGICAL_OR; +extern const int64 k_T_DOC_COMMENT; +extern const int64 k_XHPROF_FLAGS_NO_BUILTINS; +extern const int64 k_STREAM_FILTER_READ; +extern const int64 k_SORT_REGULAR; +extern const int64 k_MW_ThresholdCompositeOp; +extern const int64 k_CURLOPT_RESUME_FROM; +extern const int64 k_MW_RegistryFatalError; +extern const int64 k_FNM_CASEFOLD; +extern const int64 k_PHP_NORMAL_READ; +extern const int64 k_MW_MonitorError; +extern const int64 k_UPLOAD_ERR_NO_TMP_DIR; +extern const int64 k_IMG_EFFECT_ALPHABLEND; +extern const int64 k_CURLINFO_FILETIME; +extern const int64 k_T_XOR_EQUAL; +extern const int64 k_CURLOPT_FTPPORT; +extern const int64 k_U_MULTIPLE_ANTE_CONTEXTS; +extern const int64 k_MW_ImageWarning; +extern const int64 k_SIG_IGN; +extern const int64 k_XML_ERROR_INCORRECT_ENCODING; +extern const int64 k_MW_CorruptImageWarning; +extern const int64 k_AM_STR; +extern const int64 k_MW_YIQColorspace; +extern const int64 k_SOCKET_ENOTEMPTY; +extern const int64 k_SOAP_COMPRESSION_GZIP; +extern const int64 k_T_CONST; +extern const int64 k_UPLOAD_ERR_CANT_WRITE; +extern const int64 k_UPLOAD_ERR_PARTIAL; +extern const int64 k_WNOHANG; +extern const int64 k_CURLE_COULDNT_CONNECT; +extern const int64 k_MW_PlusCompositeOp; +extern const int64 k_CURLINFO_REDIRECT_TIME; +extern const int64 k_PNG_FILTER_NONE; +extern const int64 k_XML_ERROR_ASYNC_ENTITY; +extern const int64 k_MW_AtopCompositeOp; +extern const int64 k_PHP_OUTPUT_HANDLER_END; +extern const int64 k_PSFS_FLAG_FLUSH_CLOSE; +extern const int64 k_STREAM_CLIENT_PERSISTENT; +extern const double k_M_LNPI; +extern const int64 k_U_USING_DEFAULT_WARNING; +extern const int64 k_CURLFTPSSL_NONE; +extern const int64 k_CURLOPT_PORT; +extern const int64 k_SOCKET_EIDRM; +extern const int64 k_APACHE_MAP; +extern const int64 k_MCC_DOWN_ON_TIMEOUT; +extern const int64 k_CURLOPT_POST; +extern const int64 k_MYSQLI_SET_CHARSET_NAME; +extern const double k_M_SQRT1_2; +extern const int64 k_MW_BZipCompression; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv23_CLIENT; +extern const int64 k_LOG_NDELAY; +extern const int64 k_T_AS; +extern const int64 k_U_STATE_OLD_WARNING; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv2_CLIENT; +extern const int64 k_T_LOGICAL_AND; +extern const int64 k_DEBUG_LOG_ALL; +extern const int64 k_IMG_FILTER_NEGATE; +extern const int64 k_U_MISSING_OPERATOR; +extern const int64 k_T_DO; +extern const int64 k_STREAM_CLIENT_CONNECT; +extern const int64 k_SIGVTALRM; +extern const int64 k_PREG_BACKTRACK_LIMIT_ERROR; +extern const int64 k_T_IF; +extern const int64 k_MW_UndefinedPathUnits; +extern const int64 k_MW_AddCompositeOp; +extern const int64 k_CURLOPT_PROXYPORT; +extern const int64 k_U_SAFECLONE_ALLOCATED_WARNING; +extern const int64 k_PNG_FILTER_PAETH; +extern const int64 k_UPLOAD_ERR_EXTENSION; +extern const StaticString k_GD_EXTRA_VERSION; +extern const int64 k_U_CE_NOT_FOUND_ERROR; +extern const int64 k_SOCKET_ESHUTDOWN; +extern const int64 k_XSD_ANYTYPE; +extern const StaticString k_MCRYPT_LOKI97; +extern const int64 k_LOG_ODELAY; +extern const int64 k_ULOC_VALID_LOCALE; +extern const int64 k_MW_SpiffPreview; +extern const int64 k_MYSQLI_TYPE_VAR_STRING; +extern const int64 k_T_MINUS_EQUAL; +extern const int64 k_CURLOPT_BINARYTRANSFER; +extern const StaticString k_DATE_ATOM; +extern const int64 k_U_MULTIPLE_EXPONENTIAL_SYMBOLS; +extern const StaticString k_MCRYPT_BLOWFISH_COMPAT; +extern const int64 k_CURLOPT_NOSIGNAL; +extern const int64 k_MW_AddNoisePreview; +extern const int64 k_HTML_SPECIALCHARS; +extern const int64 k_MW_AreaResource; +extern const int64 k_T_PLUS_EQUAL; +extern const int64 k_CURLE_RECV_ERROR; +extern const int64 k_MW_FrameMode; +extern const int64 k_DAY_1; +extern const int64 k_DAY_2; +extern const int64 k_DAY_3; +extern const int64 k_CURLOPT_NOPROGRESS; +extern const int64 k_DAY_4; +extern const int64 k_MW_CopyRedCompositeOp; +extern const int64 k_DAY_5; +extern const int64 k_DAY_6; +extern const int64 k_DAY_7; +extern const int64 k_STREAM_CLIENT_ASYNC_CONNECT; +extern const int64 k_MW_BrightnessPreview; +extern const int64 k_PHP_URL_USER; +extern const StaticString k_PEAR_EXTENSION_DIR; +extern const int64 k_PHP_URL_SCHEME; +extern const int64 k_MW_UltraCondensedStretch; +extern const StaticString k_PHP_SYSCONFDIR; +extern const int64 k_U_REGEX_UNIMPLEMENTED; +extern const int64 k_T_SL; +extern const int64 k_MW_GammaPreview; +extern const int64 k_SOAP_USE_XSI_ARRAY_TYPE; +extern const int64 k_T_SR; +extern const int64 k_STREAM_MKDIR_RECURSIVE; +extern const int64 k_XML_ATTRIBUTE_NMTOKEN; +extern const int64 k_U_COLLATOR_VERSION_MISMATCH; +extern const int64 k_SOCKET_E2BIG; +extern const StaticString k_ICONV_VERSION; +extern const int64 k_POSIX_F_OK; +extern const int64 k_PKCS7_BINARY; +extern const int64 k_U_UNSUPPORTED_ERROR; +extern const int64 k_IMG_COLOR_TRANSPARENT; +extern const double k_M_1_PI; +extern const int64 k_MYSQLI_STORE_RESULT; +extern const int64 k_MW_WestGravity; +extern const int64 k_GLOB_ERR; +extern const int64 k_U_REGEX_MISMATCHED_PAREN; +extern const int64 k_U_TRAILING_BACKSLASH; +extern const int64 k_LOG_LOCAL0; +extern const int64 k_MW_GrayscaleType; +extern const int64 k_IMG_GD2_RAW; +extern const int64 k_LOG_LOCAL1; +extern const int64 k_U_MALFORMED_PRAGMA; +extern const int64 k_LOG_LOCAL2; +extern const int64 k_LOG_LOCAL3; +extern const int64 k_LOG_LOCAL4; +extern const int64 k_IDNA_ROUNDTRIP_VERIFY_ERROR; +extern const int64 k_MW_CopyBlackCompositeOp; +extern const int64 k_LOG_LOCAL5; +extern const int64 k_LOG_LOCAL6; +extern const int64 k_LOG_LOCAL7; +extern const int64 k_MW_OverlineDecoration; +extern const int64 k_CONNECTION_ABORTED; +extern const int64 k_MYSQLI_TYPE_TIME; +extern const int64 k_T_PAAMAYIM_NEKUDOTAYIM; +extern const int64 k_U_REGEX_NUMBER_TOO_BIG; +extern const int64 k_STREAM_NOTIFY_REDIRECTED; +extern const int64 k_CURLOPT_RANGE; +extern const int64 k_T_PUBLIC; +extern const int64 k_T_IS_SMALLER_OR_EQUAL; +extern const int64 k_U_BRK_UNDEFINED_VARIABLE; +extern const int64 k_T_DOUBLE_ARROW; +extern const int64 k_CURLOPT_MAXREDIRS; +extern const int64 k_CURLINFO_HEADER_SIZE; +extern const int64 k_MW_HammingFilter; +extern const int64 k_MW_ExpandedStretch; +extern const int64 k_MYSQLI_TYPE_TINY; +extern const int64 k_OCI_B_BIN; +extern const int64 k_SOCKET_EMEDIUMTYPE; +extern const int64 k_MW_DoublePixel; +extern const int64 k_E_WARNING; +extern const int64 k_ENT_COMPAT; +extern const int64 k_XML_ERROR_UNDEFINED_ENTITY; +extern const int64 k_MW_ReplaceCompositeOp; +extern const int64 k_MYSQLI_INIT_COMMAND; +extern const int64 k_CRNCYSTR; +extern const int64 k_T_LINE; +extern const int64 k_OCI_BOTH; +extern const StaticString k_MCRYPT_SAFERPLUS; +extern const int64 k_CURLE_BAD_CONTENT_ENCODING; +extern const int64 k_MYSQLI_CLIENT_COMPRESS; +extern const int64 k_LOG_INFO; +extern const StaticString k_DATE_RFC2822; +extern const int64 k_LOG_AUTHPRIV; +extern const int64 k_CURLM_INTERNAL_ERROR; +extern const int64 k_PKCS7_NOATTR; +extern const StaticString k_OPENSSL_VERSION_TEXT; +extern const StaticString k_DATE_RFC3339; +extern const StaticString k_PHP_VERSION; +extern const int64 k_PREG_OFFSET_CAPTURE; +extern const int64 k_OCI_NUM; +extern const int64 k_MSG_WAITALL; +extern const int64 k_SOCKET_EISCONN; +extern const StaticString k_MCRYPT_ARCFOUR; +extern const int64 k_XSD_DOUBLE; +extern const int64 k_XML_ERROR_NONE; +extern const int64 k_SOCKET_EL2HLT; +extern const int64 k_XSD_HEXBINARY; +extern const int64 k_T_UNSET_CAST; +extern const int64 k_CURLE_FTP_COULDNT_SET_BINARY; +extern const int64 k_MSG_EAGAIN; +extern const int64 k_T_LIST; +extern const int64 k_CURLE_FTP_WRITE_ERROR; +extern const int64 k_CURLOPT_CONNECTTIMEOUT; +extern const int64 k_CURLE_HTTP_POST_ERROR; +extern const int64 k_MW_QuantumRange; +extern const int64 k_D_FMT; +extern const int64 k_SO_REUSEADDR; +extern const int64 k_U_UNCLOSED_SEGMENT; +extern const int64 k_PNG_NO_FILTER; +extern const int64 k_CURLM_BAD_EASY_HANDLE; +extern const double k_M_EULER; +extern const int64 k_MW_HanningFilter; +extern const int64 k_CURLOPT_READFUNCTION; +extern const int64 k_U_UNSUPPORTED_ESCAPE_SEQUENCE; +extern const int64 k_MW_MemoryResource; +extern const int64 k_XSD_DECIMAL; +extern const int64 k_MW_MultiplyEvaluateOperator; +extern const int64 k_ERA_T_FMT; +extern const int64 k_MYSQLI_TYPE_TINY_BLOB; +extern const int64 k_U_FILE_ACCESS_ERROR; +extern const int64 k_U_MULTIPLE_COMPOUND_FILTERS; +extern const int64 k_POSIX_S_IFBLK; +extern const double k_M_2_PI; +extern const int64 k_MCC_ACCESSPOINT_UP; +extern const int64 k_MW_UndefinedDecoration; +extern const StaticString k_XSD_NAMESPACE; +extern const int64 k_U_BRK_HEX_DIGITS_EXPECTED; +extern const int64 k_UNKNOWN_TYPE; +extern const int64 k_MW_FloodfillMethod; +extern const int64 k_XSD_1999_TIMEINSTANT; +extern const int64 k_POSIX_S_IFCHR; +extern const int64 k_CURLE_FTP_COULDNT_SET_ASCII; +extern const int64 k_U_STRING_NOT_TERMINATED_WARNING; +extern const int64 k_DOM_VALIDATION_ERR; +extern const int64 k_SOCKET_EMFILE; +extern const int64 k_LOG_KERN; +extern const int64 k_SOCKET_EINTR; +extern const StaticString k_DATE_COOKIE; +extern const int64 k_GLOB_ONLYDIR; +extern const int64 k_XML_NAMESPACE_DECL_NODE; +extern const int64 k_CURLOPT_FTP_USE_EPRT; +extern const int64 k_LIBXML_ERR_ERROR; +extern const int64 k_MW_SpreadPreview; +extern const StaticString k_ICONV_IMPL; +extern const int64 k_IMG_ARC_CHORD; +extern const int64 k_MW_EdgeVirtualPixelMethod; +extern const int64 k_MYSQLI_TYPE_GEOMETRY; +extern const int64 k_T_END_HEREDOC; +extern const int64 k_CURLOPT_FTP_USE_EPSV; +extern const int64 k_SOAP_COMPRESSION_DEFLATE; +extern const int64 k_ULOC_ACTUAL_LOCALE; +extern const int64 k_LIBXML_ERR_NONE; +extern const double k_M_LOG10E; +extern const int64 k_CURLINFO_REDIRECT_COUNT; +extern const int64 k_IDNA_STRINGPREP_ERROR; +extern const int64 k_CURLINFO_CONTENT_LENGTH_UPLOAD; +extern const int64 k_LIBXML_NOWARNING; +extern const int64 k_U_BRK_ASSIGN_ERROR; +extern const int64 k_MW_LaplacianNoise; +extern const int64 k_XSD_SHORT; +extern const int64 k_MYSQLI_CLIENT_IGNORE_SPACE; +extern const int64 k_XML_DOCUMENT_TYPE_NODE; +extern const int64 k_U_AMBIGUOUS_ALIAS_WARNING; +extern const int64 k_MW_LanczosFilter; +extern const int64 k_LOCK_EX; +extern const int64 k_CURLE_LDAP_SEARCH_FAILED; +extern const int64 k_FNM_PERIOD; +extern const int64 k_MW_MonitorWarning; +extern const int64 k_AF_UNIX; +extern const int64 k_T_SR_EQUAL; +extern const int64 k_MB_CASE_TITLE; +extern const int64 k_SOCKET_EL3HLT; +extern const int64 k_MYSQLI_READ_DEFAULT_FILE; +extern const int64 k_MYSQLI_TYPE_NEWDATE; +extern const int64 k_MYSQLI_TYPE_LONG_BLOB; +extern const int64 k_XML_ATTRIBUTE_CDATA; +extern const int64 k_LOCK_NB; +extern const int64 k_MCRYPT_RAND; +extern const int64 k_XSD_NOTATION; +extern const int64 k_MYSQLI_UNSIGNED_FLAG; +extern const int64 k_GRAPHEME_EXTR_MAXCHARS; +extern const int64 k_MW_NoDecoration; +extern const int64 k_U_MULTIPLE_PERCENT_SYMBOLS; +extern const int64 k_OPENSSL_KEYTYPE_DSA; +extern const int64 k_IMG_FILTER_MEAN_REMOVAL; +extern const int64 k_U_BRK_VARIABLE_REDFINITION; +extern const int64 k_CURLOPT_KRB4LEVEL; +extern const int64 k_SO_SNDLOWAT; +extern const int64 k_CURLOPT_SSLKEY; +extern const int64 k_ABMON_10; +extern const int64 k_MW_SrcOverCompositeOp; +extern const int64 k_ABMON_11; +extern const int64 k_ABMON_12; +extern const int64 k_MW_SrcOutCompositeOp; +extern const int64 k_LOG_MAIL; +extern const int64 k_OCI_B_INT; +extern const int64 k_MW_CopyOpacityCompositeOp; +extern const int64 k_LDAP_OPT_TIMELIMIT; +extern const int64 k_U_FMT_PARSE_ERROR_LIMIT; +extern const int64 k_LOCK_SH; +extern const int64 k_LDAP_OPT_CLIENT_CONTROLS; +extern const int64 k_SOCKET_EINPROGRESS; +extern const int64 k_STREAM_NOTIFY_AUTH_REQUIRED; +extern const int64 k_PREG_BAD_UTF8_ERROR; +extern const int64 k_IMG_ARC_ROUNDED; +extern const int64 k_CURLOPT_HTTP_VERSION; +extern const int64 k_CURLOPT_CAINFO; +extern const int64 k_DOM_NOT_FOUND_ERR; +extern const int64 k_CURLE_SEND_ERROR; +extern const int64 k_LOCK_UN; +extern const int64 k_CURLOPT_RANDOM_FILE; +extern const int64 k_POSIX_S_IFIFO; +extern const int64 k_MW_CoderError; +extern const int64 k_SO_LINGER; +extern const int64 k_U_ILLEGAL_CHAR_IN_SEGMENT; +extern const int64 k_CURLE_GOT_NOTHING; +extern const int64 k_PHP_INT_MAX; +extern const StaticString k_MCRYPT_MODE_CBC; +extern const int64 k_T_EXTENDS; +extern const int64 k_UPLOAD_ERR_NO_FILE; +extern const double k_M_PI_2; +extern const double k_M_PI_4; +extern const int64 k_CURLOPT_SSLVERSION; +extern const int64 k_SUNFUNCS_RET_DOUBLE; +extern const int64 k_XSD_DATETIME; +extern const int64 k_MYSQL_CLIENT_IGNORE_SPACE; +extern const int64 k_MW_SouthWestGravity; +extern const int64 k_XML_ATTRIBUTE_NOTATION; +extern const StaticString k_MCRYPT_MODE_CFB; +extern const int64 k_CURLM_CALL_MULTI_PERFORM; +extern const int64 k_HTML_ENTITIES; +extern const int64 k_CREDITS_DOCS; +extern const int64 k_MYSQLI_TYPE_STRING; +extern const int64 k_MSG_ENOMSG; +extern const int64 k_MW_PaletteType; +extern const int64 k_X509_PURPOSE_CRL_SIGN; +extern const int64 k_IMG_FILTER_SMOOTH; +extern const int64 k_IMG_COLOR_STYLED; +extern const int64 k_XSD_ANYURI; +extern const int64 k_STREAM_NOTIFY_SEVERITY_ERR; +extern const int64 k_XML_HTML_DOCUMENT_NODE; +extern const int64 k_DEBUG_LOG_USER; +extern const int64 k_MW_ObjectBoundingBox; +extern const int64 k_MW_WavePreview; +extern const int64 k_XML_ERROR_DUPLICATE_ATTRIBUTE; +extern const int64 k_U_PARSE_ERROR_LIMIT; +extern const int64 k_LOG_DEBUG; +extern const StaticString k_MCRYPT_MODE_ECB; +extern const int64 k_MW_ScreenCompositeOp; +extern const int64 k_STREAM_NOTIFY_COMPLETED; +extern const int64 k_IDNA_ICONV_ERROR; +extern const int64 k_X509_PURPOSE_SSL_SERVER; +extern const StaticString k_DIRECTORY_SEPARATOR; +extern const int64 k_ASSERT_BAIL; +extern const int64 k_CRYPT_EXT_DES; +extern const int64 k_UPLOAD_ERR_INI_SIZE; +extern const int64 k_MW_RightShiftEvaluateOperator; +extern const int64 k_MW_OptionError; +extern const int64 k_GLOB_AVAILABLE_FLAGS; +extern const int64 k_MW_AddEvaluateOperator; +extern const int64 k_U_REGEX_BAD_INTERVAL; +extern const int64 k_U_MALFORMED_UNICODE_ESCAPE; +extern const int64 k_XSD_NORMALIZEDSTRING; +extern const int64 k_WSDL_CACHE_BOTH; +extern const int64 k_SOAP_COMPRESSION_ACCEPT; +extern const int64 k_CURL_NETRC_IGNORED; +extern const int64 k_CURLE_BAD_FUNCTION_ARGUMENT; +extern const int64 k_XML_COMMENT_NODE; +extern const int64 k_XSD_ANYXML; +extern const int64 k_CURLE_FTP_QUOTE_ERROR; +extern const int64 k_MW_UndefinedGravity; +extern const int64 k_U_BRK_RULE_SYNTAX; +extern const int64 k_U_MISSING_SEGMENT_CLOSE; +extern const int64 k_T_METHOD_C; +extern const int64 k_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; +extern const int64 k_U_STRINGPREP_UNASSIGNED_ERROR; +extern const int64 k_U_PATTERN_SYNTAX_ERROR; +extern const int64 k_ASSERT_WARNING; +extern const int64 k_SO_ERROR; +extern const int64 k_MW_OptionFatalError; +extern const int64 k_CURLE_FTP_WEIRD_227_FORMAT; +extern const int64 k_T_INCLUDE; +extern const int64 k_SOCKET_EUNATCH; +extern const int64 k_MW_ColorSeparationMatteType; +extern const int64 k_OCI_B_NUM; +extern const int64 k_MSG_IPC_NOWAIT; +extern const int64 k_CURLAUTH_GSSNEGOTIATE; +extern const int64 k_MW_RoundCap; +extern const int64 k_CURLE_COULDNT_RESOLVE_PROXY; +extern const int64 k_U_ILLEGAL_ARGUMENT_ERROR; +extern const int64 k_OCI_B_NTY; +extern const int64 k_SOL_TCP; +extern const int64 k_LDAP_OPT_ERROR_NUMBER; +extern const int64 k_MW_PaletteMatteType; +extern const int64 k_ABMON_1; +extern const int64 k_ABMON_2; +extern const int64 k_ABMON_3; +extern const int64 k_ABMON_4; +extern const int64 k_CURLOPT_FILETIME; +extern const int64 k_ABMON_5; +extern const int64 k_ABMON_6; +extern const int64 k_IMG_GD2_COMPRESSED; +extern const int64 k_MW_DifferenceCompositeOp; +extern const int64 k_ABMON_7; +extern const int64 k_ABMON_8; +extern const int64 k_CRYPT_SALT_LENGTH; +extern const int64 k_ABMON_9; +extern const double k_M_LOG2E; +extern const int64 k_XML_TEXT_NODE; +extern const int64 k_DOM_INDEX_SIZE_ERR; +extern const int64 k_DEBUG_LOG_URL; +extern const int64 k_CURLOPT_SSL_CIPHER_LIST; +extern const int64 k_SIGKILL; +extern const int64 k_U_VARIABLE_RANGE_OVERLAP; +extern const int64 k_MW_RaisePreview; +extern const int64 k_CURLOPT_REFERER; +extern const int64 k_T_THROW; +extern const int64 k_SOL_UDP; +extern const int64 k_SOAP_ENC_ARRAY; +extern const int64 k_MW_BlackmanFilter; +extern const int64 k_MW_OverCompositeOp; +extern const int64 k_U_REGEX_SET_CONTAINS_STRING; +extern const int64 k_MW_UndefinedColorspace; +extern const int64 k_CURL_VERSION_KERBEROS4; +extern const int64 k_PSFS_FLAG_FLUSH_INC; +extern const int64 k_PHP_OUTPUT_HANDLER_CONT; +extern const int64 k_CURLOPT_TRANSFERTEXT; +extern const int64 k_IMG_COLOR_BRUSHED; +extern const int64 k_OCI_SYSDBA; +extern const int64 k_CURLOPT_COOKIE; +extern const int64 k_CURLE_OPERATION_TIMEOUTED; +extern const int64 k_OPENSSL_SSLV23_PADDING; +extern const int64 k_T_ARRAY_CAST; +extern const int64 k_SO_RCVLOWAT; +extern const int64 k_WSDL_CACHE_DISK; +extern const int64 k_POSIX_S_IFREG; +extern const int64 k_MYSQLI_REPORT_ERROR; +extern const int64 k_U_INVALID_FORMAT_ERROR; +extern const int64 k_T_LOGICAL_XOR; +extern const int64 k_SOAP_ACTOR_NEXT; +extern const int64 k_OCI_DEFAULT; +extern const int64 k_CURLCLOSEPOLICY_LEAST_RECENTLY_USED; +extern const int64 k_MYSQLI_TYPE_YEAR; +extern const int64 k_T_PROTECTED; +extern const int64 k_SOCKET_EL3RST; +extern const int64 k_U_MALFORMED_VARIABLE_REFERENCE; +extern const int64 k_MW_BlackChannel; +extern const int64 k_MW_ExclusionCompositeOp; +extern const int64 k_CURL_VERSION_SSL; +extern const int64 k_CURLVERSION_NOW; +extern const int64 k_MW_PointMethod; +extern const int64 k_MW_PartitionInterlace; +extern const int64 k_FORCE_DEFLATE; +extern const int64 k_U_MALFORMED_SYMBOL_REFERENCE; +extern const int64 k_MW_YPbPrColorspace; +extern const int64 k_SOCKET_ELOOP; +extern const int64 k_XSD_TIME; +extern const int64 k_SOCKET_EEXIST; +extern const int64 k_DOMSTRING_SIZE_ERR; +extern const int64 k_SO_BROADCAST; +extern const int64 k_PM_STR; +extern const int64 k_MW_ErrorException; +extern const int64 k_CURLE_HTTP_NOT_FOUND; +extern const int64 k_EXTR_PREFIX_ALL; +extern const int64 k_OCI_SEEK_CUR; +extern const int64 k_SOCKET_ECHRNG; +extern const int64 k_OCI_SEEK_END; +extern const int64 k_XML_ENTITY_NODE; +extern const int64 k_MW_PixelsPerInchResolution; +extern const int64 k_T_OBJECT_OPERATOR; +extern const int64 k_MW_CorruptImageError; +extern const int64 k_STREAM_PEEK; +extern const int64 k_IMG_COLOR_TILED; +extern const int64 k_LOG_NEWS; +extern const int64 k_MW_CatromFilter; +extern const int64 k_PKCS7_TEXT; +extern const int64 k_MW_RightAlign; +extern const int64 k_MYSQL_NUM; +extern const int64 k_CURLE_FILE_COULDNT_READ_FILE; +extern const int64 k_SOCKET_EUSERS; +extern const int64 k_CURLOPT_LOW_SPEED_TIME; +extern const int64 k_PHP_BINARY_READ; +extern const int64 k_STR_PAD_BOTH; +extern const int64 k_U_REGEX_PROPERTY_SYNTAX; +extern const int64 k_STREAM_FILTER_ALL; +extern const int64 k_CURLAUTH_DIGEST; +extern const int64 k_XSD_UNSIGNEDSHORT; +extern const int64 k_CURL_IPRESOLVE_WHATEVER; +extern const int64 k_SIGIO; +extern const int64 k_T_ENDSWITCH; +extern const int64 k_LDAP_OPT_SIZELIMIT; +extern const StaticString k_OCI_SYSDATE; +extern const int64 k_MW_SubtractEvaluateOperator; +extern const int64 k_MYSQLI_RPL_SLAVE; +extern const int64 k_STREAM_SHUT_RD; +extern const int64 k_SOAP_1_1; +extern const int64 k_DOM_PHP_ERR; +extern const int64 k_SOAP_1_2; +extern const int64 k_OPENSSL_KEYTYPE_RSA; +extern const int64 k_PNG_FILTER_UP; +extern const int64 k_EXTR_REFS; +extern const int64 k_OPENSSL_CIPHER_DES; +extern const int64 k_E_ALL; +extern const int64 k_LIBXML_NOENT; +extern const int64 k_U_USING_FALLBACK_WARNING; +extern const int64 k_MW_BlendCompositeOp; +extern const StaticString k_HPHP_TRIM_CHARLIST; +extern const int64 k_MYSQL_CLIENT_COMPRESS; +extern const int64 k_E_USER_ERROR; +extern const int64 k_SOAP_PERSISTENCE_REQUEST; +extern const int64 k_T_MUL_EQUAL; +extern const int64 k_MW_IndexChannel; +extern const int64 k_U_ILLEGAL_CHAR_FOUND; +extern const int64 k_OPENSSL_PKCS1_PADDING; +extern const int64 k_PHP_INT_SIZE; +extern const int64 k_CURLE_FTP_SSL_FAILED; +extern const int64 k_CURLE_FTP_ACCESS_DENIED; +extern const int64 k_CURLE_TOO_MANY_REDIRECTS; +extern const int64 k_STREAM_USE_PATH; +extern const int64 k_MW_DelegateWarning; +extern const StaticString k_MCRYPT_MODE_OFB; +extern const int64 k_CURLE_FTP_COULDNT_USE_REST; +extern const int64 k_T_PRIVATE; +extern const int64 k_STREAM_SHUT_WR; +extern const StaticString k_DATE_ISO8601; +extern const int64 k_CURLE_LDAP_CANNOT_BIND; +extern const int64 k_IDNA_INVALID_LENGTH; +extern const int64 k_LDAP_DEREF_ALWAYS; +extern const int64 k_XML_ERROR_BAD_CHAR_REF; +extern const int64 k_XSD_STRING; +extern const int64 k_IMG_ARC_PIE; +extern const int64 k_SOCKET_ECONNREFUSED; +extern const int64 k_PKCS7_NOVERIFY; +extern const int64 k_T_DOLLAR_OPEN_CURLY_BRACES; +extern const int64 k_CURLOPT_SSLENGINE_DEFAULT; +extern const int64 k_XSD_GYEAR; +extern const int64 k_SOCKET_EPROTO; +extern const int64 k_XSD_NONPOSITIVEINTEGER; +extern const StaticString k_XML_SAX_IMPL; +extern const int64 k_LDAP_OPT_RESTART; +extern const int64 k_MW_SolarizePreview; +extern const int64 k_U_USELESS_COLLATOR_ERROR; +extern const int64 k_MW_BlobError; +extern const int64 k_IMG_ARC_EDGED; +extern const int64 k_DOM_NOT_SUPPORTED_ERR; +extern const int64 k_PNG_FILTER_AVG; +extern const int64 k_CURLM_BAD_HANDLE; +extern const int64 k_MW_LightenCompositeOp; +extern const int64 k_CURLOPT_PROXYTYPE; +extern const int64 k_T_ENDIF; +extern const int64 k_CURLOPT_FTPSSLAUTH; +extern const int64 k_MW_BesselFilter; +extern const int64 k_DOM_INUSE_ATTRIBUTE_ERR; +extern const int64 k_MW_UndefinedVirtualPixelMethod; +extern const int64 k_CURLE_FTP_WEIRD_SERVER_REPLY; +extern const int64 k_CURLE_LDAP_INVALID_URL; +extern const int64 k_XML_DOCUMENT_FRAG_NODE; +extern const int64 k_MW_ImageError; +extern const int64 k_IMG_FILTER_CONTRAST; +extern const int64 k_SOCKET_EHOSTUNREACH; +extern const int64 k_MW_UndefinedDispose; +extern const int64 k_CURLPROXY_HTTP; +extern const int64 k_MW_Group4Compression; +extern const int64 k_CLOCK_THREAD_CPUTIME_ID; +extern const int64 k_MCRYPT_DEV_URANDOM; +extern const StaticString k_MCRYPT_MODE_STREAM; +extern const int64 k_SOAP_ACTOR_NONE; +extern const int64 k_MYSQLI_UNIQUE_KEY_FLAG; +extern const StaticString k_PHP_EXTENSION_DIR; +extern const int64 k_DOM_INVALID_MODIFICATION_ERR; +extern const int64 k_U_MULTIPLE_PAD_SPECIFIERS; +extern const int64 k_STR_PAD_RIGHT; +extern const int64 k_SOCKET_ENODATA; +extern const int64 k_MW_ConstantVirtualPixelMethod; +extern const int64 k_U_MALFORMED_RULE; +extern const int64 k_U_UNSUPPORTED_ATTRIBUTE; +extern const int64 k_OCI_EXACT_FETCH; +extern const int64 k_CURLAUTH_ANYSAFE; +extern const int64 k_STREAM_SHUT_RDWR; +extern const int64 k_U_BRK_ERROR_START; +extern const int64 k_PRIO_PROCESS; +extern const int64 k_STREAM_PF_INET6; +extern const int64 k_CURLE_FTP_COULDNT_GET_SIZE; +extern const int64 k_OCI_DTYPE_LOB; +extern const int64 k_U_INVALID_FUNCTION; +extern const int64 k_MW_MissingDelegateFatalError; +extern const int64 k_IMAGETYPE_JPEG; +extern const int64 k_SOCKET_ENOPROTOOPT; +extern const int64 k_IMG_WBMP; +extern const int64 k_LDAP_OPT_DEBUG_LEVEL; +extern const int64 k_MW_CenterAlign; +extern const int64 k_LOG_DAEMON; +extern const int64 k_MW_UndefinedJoin; +extern const int64 k_XML_ELEMENT_NODE; +extern const int64 k_LC_NUMERIC; +extern const int64 k_CREDITS_FULLPAGE; +extern const int64 k_U_PRIMARY_TOO_LONG_ERROR; +extern const int64 k_LIBXML_DTDVALID; +extern const int64 k_U_ERROR_WARNING_START; +extern const int64 k_MW_FloatPixel; +extern const int64 k_CURLOPT_WRITEFUNCTION; +extern const int64 k_CURLE_SSL_CONNECT_ERROR; +extern const int64 k_MW_WandFatalError; +extern const int64 k_MW_GRAYColorspace; +extern const int64 k_IMG_GIF; +extern const int64 k_U_PARSE_ERROR; +extern const int64 k_MYSQLI_TYPE_SHORT; +extern const int64 k_IMG_FILTER_COLORIZE; +extern const int64 k_T_DOUBLE_COLON; +extern const int64 k_T_DEC; +extern const int64 k_SOCKET_ELNRNG; +extern const StaticString k_PHP_DATADIR; +extern const int64 k_CURLOPT_READDATA; +extern const int64 k_CURL_NETRC_REQUIRED; +extern const int64 k_XSD_ENTITIES; +extern const int64 k_MW_DelegateFatalError; +extern const int64 k_U_STATE_TOO_OLD_ERROR; +extern const int64 k_CURLOPT_CLOSEPOLICY; +extern const int64 k_PREG_SPLIT_NO_EMPTY; +extern const int64 k_LIBXML_NONET; +extern const int64 k_SOCKET_ENFILE; +extern const int64 k_MW_CopyMagentaCompositeOp; +extern const int64 k_STREAM_IPPROTO_RAW; +extern const int64 k_LIBXML_DTDLOAD; +extern const int64 k_CURLINFO_STARTTRANSFER_TIME; +extern const int64 k_COUNT_RECURSIVE; +extern const int64 k_CODESET; +extern const int64 k_CURLOPT_PASSWDFUNCTION; +extern const int64 k_SOCKET_EPERM; +extern const int64 k_GD_MAJOR_VERSION; +extern const int64 k_PKCS7_DETACHED; +extern const int64 k_OPENSSL_CIPHER_RC2_40; +extern const int64 k_SOCKET_ENOSR; +extern const int64 k_LC_MESSAGES; +extern const int64 k_T_STRING_VARNAME; +extern const int64 k_SOMAXCONN; +extern const int64 k_MW_RedChannel; +extern const int64 k_MW_ButtCap; +extern const int64 k_OPENSSL_CIPHER_RC2_64; +extern const int64 k_SOCKET_ETIMEDOUT; +extern const int64 k_IDNA_CONTAINS_ACE_PREFIX; +extern const int64 k_MW_ColorDodgeCompositeOp; +extern const int64 k_T_FMT_AMPM; +extern const int64 k_SQLT_RSET; +extern const int64 k_U_REGEX_INVALID_STATE; +extern const int64 k_T_CHARACTER; +extern const int64 k_XML_ATTRIBUTE_NODE; +extern const int64 k_STREAM_ENFORCE_SAFE_MODE; +extern const int64 k_SUNFUNCS_RET_TIMESTAMP; +extern const int64 k_STREAM_IPPROTO_TCP; +extern const int64 k_SO_RCVBUF; +extern const int64 k_STREAM_NOTIFY_MIME_TYPE_IS; +extern const int64 k_COUNT_NORMAL; +extern const int64 k_U_REGEX_INTERNAL_ERROR; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv23_SERVER; +extern const StaticString k_MCRYPT_WAKE; +extern const int64 k_U_TRUNCATED_CHAR_FOUND; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv2_SERVER; +extern const int64 k_MW_WandError; +extern const int64 k_SO_DEBUG; +extern const bool k_FALSE; +extern const int64 k_LDAP_OPT_ERROR_STRING; +extern const bool k_ZEND_THREAD_SAFE; +extern const int64 k_AF_INET6; +extern const int64 k_SUNFUNCS_RET_STRING; +extern const int64 k_OPENSSL_PKCS1_OAEP_PADDING; +extern const int64 k_SIGSTKFLT; +extern const int64 k_XML_ERROR_NO_MEMORY; +extern const int64 k_DNS_ALL; +extern const int64 k_MB_OVERLOAD_REGEX; +extern const int64 k_MW_SincFilter; +extern const int64 k_IMG_JPG; +extern const int64 k_MW_ShearPreview; +extern const int64 k_ASSERT_ACTIVE; +extern const int64 k_STREAM_IPPROTO_UDP; +extern const int64 k_OCI_SEEK_SET; +extern const int64 k_SOCKET_EDESTADDRREQ; +extern const int64 k_T_FMT; +extern const int64 k_MW_EastGravity; +extern const int64 k_SOCKET_EPIPE; +extern const int64 k_SIGCLD; +extern const int64 k_T_FINAL; +extern const int64 k_MW_StaticGravity; +extern const int64 k_T_FOR; +extern const int64 k_EXTR_SKIP; +extern const int64 k_MW_HermiteFilter; +extern const int64 k_DNS_ANY; +extern const int64 k_OCI_DTYPE_FILE; +extern const int64 k_CURLE_BAD_CALLING_ORDER; +extern const int64 k_SOCKET_ENOBUFS; +extern const int64 k_LC_COLLATE; +extern const int64 k_CURLOPT_CAPATH; +extern const int64 k_PKCS7_NOCHAIN; +extern const int64 k_U_INVALID_TABLE_FORMAT; +extern const int64 k_CHAR_MAX; +extern const int64 k_PREG_INTERNAL_ERROR; +extern const int64 k_MYSQLI_RPL_ADMIN; +extern const int64 k_E_USER_WARNING; +extern const int64 k_PREG_NO_ERROR; +extern const int64 k_U_STRINGPREP_CHECK_BIDI_ERROR; +extern const int64 k_SOCKET_EPROTONOSUPPORT; +extern const StaticString k_MCRYPT_PANAMA; +extern const int64 k_MYSQLI_TYPE_CHAR; +extern const int64 k_MON_1; +extern const int64 k_T_EMPTY; +extern const int64 k_MON_2; +extern const int64 k_SIGBUS; +extern const int64 k_MYSQLI_SET_FLAG; +extern const int64 k_MON_3; +extern const int64 k_MON_4; +extern const int64 k_MON_5; +extern const int64 k_MON_6; +extern const int64 k_MON_7; +extern const int64 k_MON_8; +extern const int64 k_MON_9; +extern const int64 k_SOCKET_EMLINK; +extern const int64 k_EXTR_IF_EXISTS; +extern const int64 k_LDAP_OPT_SERVER_CONTROLS; +extern const int64 k_CURLE_COULDNT_RESOLVE_HOST; +extern const int64 k_MW_BlobFatalError; +extern const int64 k_MYSQLI_ZEROFILL_FLAG; +extern const StaticString k_GD_VERSION; +extern const int64 k_SOCKET_EBADMSG; +extern const int64 k_CURLE_FTP_USER_PASSWORD_INCORRECT; +extern const int64 k_T_INC; +extern const int64 k_THOUSEP; +extern const int64 k_SORT_DESC; +extern const int64 k_MYSQLI_TYPE_BLOB; +extern const int64 k_SOCKET_EAFNOSUPPORT; +extern const int64 k_MYSQLI_TYPE_DATE; +extern const int64 k_T_DNUMBER; +extern const int64 k_MW_BlueChannel; +extern const int64 k_CURLE_UNKNOWN_TELNET_OPTION; +extern const int64 k_T_CONTINUE; +extern const StaticString k_PHP_SHLIB_SUFFIX; +extern const int64 k_CURLE_LIBRARY_NOT_FOUND; +extern const int64 k_T_FUNC_C; +extern const int64 k_MW_ObliqueStyle; +extern const int64 k_SOCKET_ENETUNREACH; +extern const int64 k_MW_EdgeDetectPreview; +extern const int64 k_XML_ERROR_EXTERNAL_ENTITY_HANDLING; +extern const int64 k_MW_DstInCompositeOp; +extern const int64 k_LDAP_DEREF_SEARCHING; +extern const int64 k_STREAM_IPPROTO_ICMP; +extern const int64 k_SIGFPE; +extern const int64 k_LIBXML_NOCDATA; +extern const int64 k_SOCKET_ENXIO; +extern const int64 k_MW_MinusCompositeOp; +extern const int64 k_MW_RotatePreview; +extern const int64 k_U_REGEX_BAD_ESCAPE_SEQUENCE; +extern const int64 k_IMG_FILTER_GRAYSCALE; +extern const int64 k_PREG_SET_ORDER; +extern const int64 k_SORT_STRING; +extern const int64 k_CURLOPT_FORBID_REUSE; +extern const int64 k_U_BRK_MISMATCHED_PAREN; +extern const int64 k_MW_LosslessJPEGCompression; +extern const int64 k_XML_ERROR_PARAM_ENTITY_REF; +extern const int64 k_CURLAUTH_BASIC; +extern const int64 k_MW_UndefinedFilter; +extern const int64 k_MW_NorthWestGravity; +extern const int64 k_PKCS7_NOCERTS; +extern const int64 k_MYSQLI_ASSOC; +extern const int64 k_OCI_COMMIT_ON_SUCCESS; +extern const int64 k_POSIX_S_IFSOCK; +extern const int64 k_IMG_PNG; +extern const int64 k_DEBUG_LOG_IP; +extern const int64 k_CURLE_FTP_WEIRD_USER_REPLY; +extern const int64 k_CURLE_FTP_WEIRD_PASS_REPLY; +extern const int64 k_MW_InCompositeOp; +extern const int64 k_STREAM_NOTIFY_SEVERITY_INFO; +extern const int64 k_MB_OVERLOAD_STRING; +extern const int64 k_XML_ELEMENT_DECL_NODE; +extern const int64 k_CURLINFO_PRIVATE; +extern const int64 k_MW_FileOpenError; +extern const int64 k_CURL_TIMECOND_IFMODSINCE; +extern const int64 k_CURLINFO_TOTAL_TIME; +extern const int64 k_IDNA_NO_ACE_PREFIX; +extern const int64 k_SIGILL; +extern const int64 k_T_NEW; +extern const int64 k_CURLOPT_PROXY; +extern const int64 k_SOCKET_EBADRQC; +extern const int64 k_SQLT_BFILEE; +extern const int64 k_U_BRK_INIT_ERROR; +extern const int64 k_MW_AndEvaluateOperator; +extern const int64 k_CURLE_FTP_PORT_FAILED; +extern const int64 k_MW_RollPreview; +extern const int64 k_SIGINT; +extern const int64 k_SOCKET_EBADSLT; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv3_CLIENT; +extern const int64 k_SIGIOT; +extern const int64 k_SIGHUP; +extern const int64 k_MYSQL_ASSOC; +extern const int64 k_U_ILLEGAL_ESCAPE_SEQUENCE; +extern const int64 k_MW_ItalicStyle; +extern const int64 k_U_UNEXPECTED_TOKEN; +extern const int64 k_MW_NoneDispose; +extern const int64 k_MW_ImplodePreview; +extern const int64 k_T_ENDWHILE; +extern const int64 k_MW_StreamFatalError; +extern const int64 k_U_ZERO_ERROR; +extern const int64 k_DOM_HIERARCHY_REQUEST_ERR; +extern const int64 k_MW_UndefinedMode; +extern const StaticString k_PHP_CONFIG_FILE_SCAN_DIR; +extern const int64 k_T_ISSET; +extern const int64 k_LC_CTYPE; +extern const int64 k_PSFS_ERR_FATAL; +extern const int64 k_SIGPIPE; +extern const int64 k_T_INTERFACE; +extern const int64 k_MW_AllChannels; +extern const int64 k_MW_DarkenCompositeOp; +extern const int64 k_STREAM_NOTIFY_AUTH_RESULT; +extern const int64 k_SQLT_CFILEE; +extern const int64 k_MYSQLI_MULTIPLE_KEY_FLAG; +extern const int64 k_MW_SrcCompositeOp; +extern const int64 k_T_MOD_EQUAL; +extern const double k_M_SQRTPI; +extern const int64 k_PNG_FILTER_SUB; +extern const int64 k_FILE_APPEND; +extern const int64 k_SOCKET_ESTRPIPE; +extern const int64 k_OPENSSL_ALGO_MD2; +extern const int64 k_DOM_SYNTAX_ERR; +extern const int64 k_OPENSSL_ALGO_MD4; +extern const int64 k_OPENSSL_ALGO_MD5; +extern const int64 k_EXTR_PREFIX_IF_EXISTS; +extern const int64 k_INFO_ALL; +extern const int64 k_CURLOPT_SSLCERTPASSWD; +extern const int64 k_XML_OPTION_SKIP_TAGSTART; +extern const int64 k_MW_HuePreview; +extern const int64 k_MW_IntegerPixel; +extern const int64 k_IMG_EFFECT_REPLACE; +extern const int64 k_OCI_B_CURSOR; +extern const int64 k_OPENSSL_NO_PADDING; +extern const int64 k_MW_FillToBorderMethod; +extern const int64 k_U_BRK_NEW_LINE_IN_QUOTED_STRING; +extern const int64 k_STREAM_PF_INET; +extern const int64 k_SOCKET_EHOSTDOWN; +extern const int64 k_MW_UserSpaceOnUse; +extern const int64 k_MW_UndefinedChannel; +extern const int64 k_SOCKET_ERESTART; +extern const int64 k_ERA; +extern const int64 k_XML_OPTION_TARGET_ENCODING; +extern const int64 k_CURLOPT_PRIVATE; +extern const int64 k_SOCKET_EALREADY; +extern const int64 k_XSD_NMTOKENS; +extern const int64 k_MW_TrueColorMatteType; +extern const int64 k_XSD_LANGUAGE; +extern const int64 k_MW_UniformNoise; +extern const int64 k_U_MEMORY_ALLOCATION_ERROR; +extern const int64 k_SORT_ASC; +extern const int64 k_IMG_FILTER_EMBOSS; +extern const int64 k_U_REGEX_INVALID_FLAG; +extern const int64 k_U_UNQUOTED_SPECIAL; +extern const int64 k_MYSQLI_OPT_LOCAL_INFILE; +extern const int64 k_MYSQLI_AUTO_INCREMENT_FLAG; +extern const int64 k_U_UNDEFINED_VARIABLE; +extern const int64 k_SOAP_LITERAL; +extern const int64 k_XML_ERROR_JUNK_AFTER_DOC_ELEMENT; +extern const int64 k_MW_BlurPreview; +extern const int64 k_U_INVALID_RBT_SYNTAX; +extern const int64 k_MW_SouthEastGravity; +extern const int64 k_SOCKET_EXFULL; +extern const int64 k_T_OPEN_TAG_WITH_ECHO; +extern const int64 k_MYSQL_CLIENT_SSL; +extern const int64 k_MW_LineThroughDecoration; +extern const int64 k_T_START_HEREDOC; +extern const int64 k_U_VARIABLE_RANGE_EXHAUSTED; +extern const int64 k_E_ERROR; +extern const int64 k_INI_USER; +extern const int64 k_MW_DstCompositeOp; +extern const int64 k_SO_SNDTIMEO; +extern const int64 k_MW_GrayscaleMatteType; +extern const int64 k_CURLE_FUNCTION_NOT_FOUND; +extern const int64 k_CURLOPT_ENCODING; +extern const int64 k_MW_ExtraCondensedStretch; +extern const int64 k_T_IS_GREATER_OR_EQUAL; +extern const int64 k_T_BAD_CHARACTER; +extern const int64 k_T_INSTANCEOF; +extern const int64 k_MW_LuminizeCompositeOp; +extern const int64 k_MYSQLI_READ_DEFAULT_GROUP; +extern const int64 k_XML_ERROR_MISPLACED_XML_PI; +extern const int64 k_MW_AnyStyle; +extern const int64 k_MW_CyanChannel; +extern const int64 k_CURLINFO_SPEED_DOWNLOAD; +extern const int64 k_MYSQLI_BOTH; +extern const int64 k_MW_CacheFatalError; +extern const int64 k_MW_WandWarning; +extern const int64 k_T_VAR; +extern const int64 k_PATHINFO_DIRNAME; +extern const int64 k_MW_AlphaChannel; +extern const int64 k_CURLPROXY_SOCKS5; +extern const int64 k_SIGPOLL; +extern const int64 k_MW_CopyCyanCompositeOp; +extern const int64 k_CURLINFO_CONTENT_LENGTH_DOWNLOAD; +extern const int64 k_IMG_XPM; +extern const StaticString k_INF; +extern const int64 k_CURLOPT_HTTPAUTH; +extern const int64 k_XML_ATTRIBUTE_NMTOKENS; +extern const int64 k_MW_MissingDelegateError; +extern const int64 k_MW_UserSpace; +extern const int64 k_CURLFTPSSL_ALL; +extern const int64 k_MYSQLI_CLIENT_NO_SCHEMA; +extern const int64 k_T_CATCH; +extern const int64 k_SOCKET_EROFS; +extern const int64 k_INFO_VARIABLES; +extern const int64 k_CURLOPT_DNS_CACHE_TIMEOUT; +extern const int64 k_U_REGEX_RULE_SYNTAX; +extern const int64 k_CURLE_OK; +extern const int64 k_T_TRY; +extern const int64 k_T_ENDDECLARE; +extern const int64 k_CURL_IPRESOLVE_V4; +extern const int64 k_XML_LOCAL_NAMESPACE; +extern const int64 k_XSD_UNSIGNEDBYTE; +extern const int64 k_CURLOPT_TCP_NODELAY; +extern const int64 k_CURL_IPRESOLVE_V6; +extern const int64 k_CRYPT_BLOWFISH; +extern const int64 k_XML_ATTRIBUTE_IDREF; +extern const int64 k_U_ENUM_OUT_OF_SYNC_ERROR; +extern const int64 k_T_USE; +extern const StaticString k_MCRYPT_CAST_128; +extern const int64 k_CURLINFO_EFFECTIVE_URL; +extern const int64 k_T_IS_EQUAL; +extern const StaticString k_MCRYPT_RIJNDAEL_128; +extern const int64 k_SQLT_AFC; +extern const int64 k_MW_SetEvaluateOperator; +extern const int64 k_CURLOPT_TIMEVALUE; +extern const int64 k_SIGPWR; +extern const int64 k_OCI_B_ROWID; +extern const int64 k_MW_FatalErrorException; +extern const int64 k_CURLOPT_HTTPHEADER; +extern const int64 k_CURLOPT_COOKIEFILE; +extern const StaticString k_PHP_LIBDIR; +extern const int64 k_DEBUG_LOG_AGENT; +extern const int64 k_DNS_PTR; +extern const int64 k_XML_ERROR_SYNTAX; +extern const int64 k_U_NO_SPACE_AVAILABLE; +extern const int64 k_T_CONSTANT_ENCAPSED_STRING; +extern const int64 k_MW_MeanAbsoluteErrorMetric; +extern const int64 k_CURLOPT_PROXYAUTH; +extern const StaticString k_NAN; +extern const int64 k_GD_RELEASE_VERSION; +extern const int64 k_SOL_SOCKET; +extern const StaticString k_MCRYPT_RIJNDAEL_192; +extern const int64 k_SOCKET_ENOMEDIUM; +extern const int64 k_CURLOPT_COOKIESESSION; +extern const int64 k_SIGPROF; +extern const StaticString k_MCRYPT_ARCFOUR_IV; +extern const int64 k_MW_UndefinedNoise; +extern const StaticString k_MCRYPT_CAST_256; +extern const int64 k_MW_BevelJoin; +extern const int64 k_PREG_SPLIT_OFFSET_CAPTURE; +extern const int64 k_IDNA_CONTAINS_MINUS; +extern const int64 k_SO_KEEPALIVE; +extern const StaticString k_MCRYPT_RIJNDAEL_256; +extern const int64 k_MW_UndefinedInterlace; +extern const int64 k_U_STANDARD_ERROR_LIMIT; +extern const int64 k_T_OPEN_TAG; +extern const int64 k_MW_UndefinedException; +extern const int64 k_LIBXML_NOERROR; +extern const int64 k_CURLOPT_NETRC; +extern const int64 k_DNS_SOA; +extern const int64 k_SQLT_BIN; +extern const int64 k_MW_ShortPixel; +extern const int64 k_MW_DelegateError; +extern const int64 k_SIGSEGV; +extern const int64 k_MW_TypeFatalError; +extern const int64 k_U_REGEX_LOOK_BEHIND_LIMIT; +extern const int64 k_CURLFTPAUTH_DEFAULT; +extern const int64 k_STREAM_SOCK_DGRAM; +extern const int64 k_CURLCLOSEPOLICY_OLDEST; +extern const int64 k_STREAM_URL_STAT_QUIET; +extern const int64 k_SQLT_CHR; +extern const int64 k_SOCKET_EACCES; +extern const int64 k_MYSQLI_TYPE_INT24; +extern const int64 k_SOCK_RAW; +extern const int64 k_SQLT_AVC; +extern const int64 k_MYSQLI_TYPE_INTERVAL; +extern const int64 k_SOCK_RDM; +extern const int64 k_DNS_SRV; +extern const int64 k_XSD_UNSIGNEDINT; +extern const int64 k_SIGSYS; +extern const int64 k_SOAP_RPC; +extern const int64 k_MW_PoissonNoise; +extern const int64 k_SIGURG; +extern const int64 k_SOCKET_ETIME; +extern const int64 k_T_ENDFOREACH; +extern const StaticString k_PHP_SAPI; +extern const StaticString k_PHP_PREFIX; +extern const int64 k_U_BRK_ERROR_LIMIT; +extern const int64 k_MW_SwirlPreview; +extern const int64 k_MW_BumpmapCompositeOp; +extern const int64 k_SOAP_SINGLE_ELEMENT_ARRAYS; +extern const int64 k_MYSQL_CLIENT_INTERACTIVE; +extern const int64 k_CURLOPT_CRLF; +extern const int64 k_CURL_HTTP_VERSION_1_0; +extern const int64 k_CURL_HTTP_VERSION_1_1; +extern const StaticString k_MCRYPT_MODE_NOFB; +extern const int64 k_CURLOPT_MAXCONNECTS; +extern const int64 k_XML_ATTRIBUTE_IDREFS; +extern const int64 k_T_INT_CAST; +extern const int64 k_XSD_POSITIVEINTEGER; +extern const int64 k_CURLOPT_SSL_VERIFYHOST; +extern const int64 k_XSD_NCNAME; +extern const int64 k_X509_PURPOSE_SMIME_SIGN; +extern const int64 k_SOCKET_EPROTOTYPE; +extern const int64 k_U_ERROR_WARNING_LIMIT; +extern const int64 k_MYSQLI_TYPE_ENUM; +extern const int64 k_CURLE_PARTIAL_FILE; +extern const int64 k_PHP_URL_HOST; +extern const int64 k_STREAM_SOCK_STREAM; +extern const int64 k_MW_DrawError; +extern const double k_M_E; +extern const int64 k_DNS_TXT; +extern const int64 k_DOM_WRONG_DOCUMENT_ERR; +extern const StaticString k_MCRYPT_XTEA; +extern const int64 k_SO_RCVTIMEO; +extern const int64 k_XSD_NONNEGATIVEINTEGER; +extern const int64 k_CURLE_WRITE_ERROR; +extern const int64 k_ALT_DIGITS; +extern const int64 k_XHPROF_FLAGS_CPU; +extern const int64 k_MW_SquareCap; +extern const int64 k_MYSQLI_NO_DATA; +extern const int64 k_SOCKET_EIO; +extern const int64 k_MW_OHTAColorspace; +extern const int64 k_U_MISSING_RESOURCE_ERROR; +extern const int64 k_T_DOUBLE_CAST; +extern const int64 k_SQLT_FLT; +extern const int64 k_FILE_USE_INCLUDE_PATH; +extern const int64 k_SOCKET_ENOTSOCK; +extern const int64 k_XSD_DATE; +extern const int64 k_E_RECOVERABLE_ERROR; +extern const int64 k_OCI_ASSOC; +extern const int64 k_CURLE_SSL_ENGINE_SETFAILED; +extern const int64 k_U_MULTIPLE_POST_CONTEXTS; +extern const int64 k_GLOB_NOCHECK; +extern const int64 k_PREG_RECURSION_LIMIT_ERROR; +extern const int64 k_T_ENDFOR; +extern const int64 k_DNS_A; +extern const StaticString k_PHP_CONFIG_FILE_PATH; +extern const int64 k_MW_RoundJoin; +extern const int64 k_MW_ModulateCompositeOp; +extern const int64 k_CURLE_SHARE_IN_USE; +extern const int64 k_U_ILLEGAL_PAD_POSITION; +extern const int64 k_LIBXML_VERSION; +extern const int64 k_MW_UndefinedResource; +extern const int64 k_DOM_NO_MODIFICATION_ALLOWED_ERR; +extern const int64 k_CURLOPT_SSLKEYPASSWD; +extern const int64 k_CURLOPT_SSLCERT; +extern const int64 k_SIGQUIT; +extern const int64 k_MW_ResetMethod; +extern const int64 k_SQLT_BFLOAT; +extern const StaticString k_MCRYPT_SKIPJACK; +extern const int64 k_SO_DONTROUTE; +extern const int64 k_T_DECLARE; +extern const int64 k_SIGTERM; +extern const int64 k_T_GLOBAL; +extern const int64 k_MW_MissingDelegateWarning; +extern const int64 k_MW_PerceptualIntent; +extern const int64 k_POSIX_R_OK; +extern const int64 k_T_STRING; +extern const int64 k_INFO_CREDITS; +extern const int64 k_STR_PAD_LEFT; +extern const int64 k_XSD_ID; +extern const int64 k_MW_TransparentColorspace; +extern const int64 k_OCI_RETURN_NULLS; +extern const int64 k_T_IS_IDENTICAL; +extern const int64 k_CLOCK_PROCESS_CPUTIME_ID; +extern const int64 k_MW_UndefinedEvaluateOperator; +extern const int64 k_OPENSSL_ALGO_SHA1; +extern const int64 k_MW_CopyYellowCompositeOp; +extern const int64 k_MW_CopyGreenCompositeOp; +extern const int64 k_CURLOPT_FILE; +extern const int64 k_SQLT_INT; +extern const int64 k_IMG_EFFECT_OVERLAY; +extern const int64 k_SQLT_LBI; +extern const int64 k_WSDL_CACHE_MEMORY; +extern const int64 k_GD_MINOR_VERSION; +extern const int64 k_XSD_TOKEN; +extern const int64 k_FNM_NOESCAPE; +extern const int64 k_U_BRK_RULE_EMPTY_SET; +extern const int64 k_PHP_OUTPUT_HANDLER_START; +extern const int64 k_INFO_GENERAL; +extern const int64 k_LOG_ERR; +extern const int64 k_MYSQLI_NUM; +extern const int64 k_MYSQLI_OPT_CONNECT_TIMEOUT; +extern const int64 k_MW_RGBColorspace; +extern const int64 k_DEBUG_LOG_COOKIE; +extern const int64 k_EXTR_PREFIX_INVALID; +extern const int64 k_U_REGEX_ERROR_START; +extern const int64 k_MW_OrEvaluateOperator; +extern const int64 k_SORT_NUMERIC; +extern const int64 k_CURLINFO_HEADER_OUT; +extern const int64 k_MW_UndefinedCompositeOp; +extern const int64 k_MW_DiskResource; +extern const int64 k_OCI_D_LOB; +extern const int64 k_XML_DOCUMENT_NODE; +extern const int64 k_LDAP_DEREF_NEVER; +extern const StaticString k_MCRYPT_THREEWAY; +extern const int64 k_MW_ExtraExpandedStretch; +extern const int64 k_MW_AbsoluteIntent; +extern const int64 k_FORCE_GZIP; +extern const int64 k_OCI_B_BLOB; +extern const int64 k_CASE_UPPER; +extern const StaticString k_PHP_EOL; +extern const int64 k_SQLT_LNG; +extern const int64 k_SOCKET_ENETRESET; +extern const int64 k_MW_CubicFilter; +extern const int64 k_U_MISPLACED_COMPOUND_FILTER; +extern const int64 k_MYSQLI_NUM_FLAG; +extern const int64 k_MB_CASE_UPPER; +extern const int64 k_CURLE_FAILED_INIT; +extern const int64 k_MW_DrawFatalError; +extern const int64 k_IDNA_CONTAINS_NON_LDH; +extern const int64 k_T_FOREACH; +extern const int64 k_CURLOPT_UPLOAD; +extern const int64 k_MW_PixelsPerCentimeterResolution; +extern const int64 k_MYSQLI_TYPE_MEDIUM_BLOB; +extern const int64 k_CURLOPT_AUTOREFERER; +extern const int64 k_SOAP_FUNCTIONS_ALL; +extern const int64 k_SOCK_SEQPACKET; +extern const int64 k_SQLT_LVC; +extern const int64 k_MW_OptionWarning; +extern const int64 k_SQLT_ODT; +extern const int64 k_SOCKET_EFAULT; +extern const int64 k_MW_MiterJoin; +extern const int64 k_NOEXPR; +extern const int64 k_STREAM_CRYPTO_METHOD_TLS_CLIENT; +extern const int64 k_CURLOPT_USERAGENT; +extern const int64 k_MW_RegistryError; +extern const int64 k_MYSQLI_CLIENT_SSL; +extern const int64 k_CURLOPT_INTERFACE; +extern const int64 k_MW_BilevelType; +extern const int64 k_XSD_BOOLEAN; +extern const int64 k_U_MULTIPLE_DECIMAL_SEPARATORS; +extern const int64 k_E_CORE_ERROR; +extern const int64 k_RADIXCHAR; +extern const int64 k_EXIF_USE_MBSTRING; +extern const int64 k_MW_LZWCompression; +extern const int64 k_MW_XorEvaluateOperator; +extern const int64 k_XSD_GMONTH; +extern const int64 k_SOAP_WAIT_ONE_WAY_CALLS; +extern const int64 k_U_STRINGPREP_PROHIBITED_ERROR; +extern const int64 k_MW_TypeWarning; +extern const int64 k_U_MULTIPLE_CURSORS; +extern const StaticString k_MCRYPT_SERPENT; +extern const int64 k_MYSQLI_TYPE_DECIMAL; +extern const int64 k_MYSQLI_PART_KEY_FLAG; +extern const int64 k_MW_MultiplicativeGaussianNoise; +extern const int64 k_INI_PERDIR; +extern const int64 k_XML_ATTRIBUTE_ID; +extern const int64 k_MB_OVERLOAD_MAIL; +extern const int64 k_CURLOPT_SSLCERTTYPE; +extern const int64 k_SQLT_NUM; +extern const StaticString k_MCRYPT_CRYPT; +extern const int64 k_CURLE_OUT_OF_MEMORY; +extern const int64 k_SQLT_RDD; +extern const int64 k_SQLT_NTY; +extern const int64 k_MW_PlaneInterlace; +extern const int64 k_MW_ResourceLimitFatalError; +extern const int64 k_U_MALFORMED_SET; +extern const int64 k_LOG_USER; +extern const int64 k_LDAP_OPT_HOST_NAME; +extern const int64 k_CURLOPT_RETURNTRANSFER; +extern const int64 k_CURLE_FTP_WEIRD_PASV_REPLY; +extern const int64 k_CURLOPT_WRITEHEADER; +extern const int64 k_OCI_B_CLOB; +extern const int64 k_SOCKET_ENOTUNIQ; +extern const int64 k_MW_DstAtopCompositeOp; +extern const int64 k_LOG_LPR; +extern const int64 k_MW_LineInterlace; +extern const int64 k_SOCKET_EXDEV; +extern const int64 k_U_NO_WRITE_PERMISSION; +extern const int64 k_MW_MaxRGB; +extern const int64 k_SIGWINCH; +extern const int64 k_OCI_DESCRIBE_ONLY; +extern const int64 k_SOCKET_ENAMETOOLONG; +extern const int64 k_CLOCK_REALTIME; +extern const int64 k_XML_ATTRIBUTE_ENTITY; +extern const int64 k_LIBXML_ERR_FATAL; +extern const int64 k_SOCKET_ENOANO; +extern const int64 k_T_CLASS_C; +extern const int64 k_XSD_FLOAT; +extern const int64 k_LOG_UUCP; +extern const int64 k_MW_ClearCompositeOp; +extern const int64 k_STREAM_OOB; +extern const int64 k_OCI_D_ROWID; +extern const int64 k_STREAM_IGNORE_URL; +extern const int64 k_SOCKET_EBADFD; +extern const int64 k_U_ILLEGAL_CHARACTER; +extern const int64 k_SIGSTOP; +extern const int64 k_SIGTRAP; +extern const int64 k_ENT_QUOTES; +extern const int64 k_CURLE_SSL_CACERT; +extern const int64 k_LIBXML_NOBLANKS; +extern const int64 k_IDNA_PUNYCODE_ERROR; +extern const int64 k_CURLFTPSSL_TRY; +extern const int64 k_MW_CMYKColorspace; +extern const int64 k_SOAP_AUTHENTICATION_DIGEST; +extern const int64 k_CURLOPT_HEADER; +extern const StaticString k_PHP_LOCALSTATEDIR; +extern const int64 k_LOG_PID; +extern const int64 k_SOCKET_ENODEV; +extern const int64 k_SQLT_BLOB; +extern const int64 k_CURLFTPAUTH_TLS; +extern const int64 k_XML_ERROR_UNCLOSED_TOKEN; +extern const int64 k_CURLFTPAUTH_SSL; +extern const int64 k_XML_ERROR_UNCLOSED_CDATA_SECTION; +extern const int64 k_U_RESOURCE_TYPE_MISMATCH; +extern const int64 k_T_AND_EQUAL; +extern const int64 k_U_MULTIPLE_PERMILL_SYMBOLS; +extern const int64 k_E_COMPILE_ERROR; +extern const int64 k_AF_INET; +extern const int64 k_MW_MapResource; +extern const int64 k_MW_TileVirtualPixelMethod; +extern const int64 k_T_OR_EQUAL; +extern const int64 k_DOM_INVALID_ACCESS_ERR; +extern const int64 k_MW_RLECompression; +extern const int64 k_PRIO_PGRP; +extern const int64 k_SOCKET_ENOCSI; +extern const int64 k_T_UNSET; +extern const int64 k_XML_ENTITY_DECL_NODE; +extern const int64 k_SQLT_UIN; +extern const int64 k_SQLT_VCS; +extern const int64 k_XSD_BYTE; +extern const int64 k_MW_ImageFatalError; +extern const int64 k_MW_MultiplyCompositeOp; +extern const int64 k_MW_NorthGravity; +extern const int64 k_MSG_EXCEPT; +extern const int64 k_SQLT_STR; +extern const int64 k_CURLOPT_FTP_SSL; +extern const int64 k_SOCKET_EAGAIN; +extern const int64 k_MW_UndefinedPreview; +extern const int64 k_MW_CopyCompositeOp; +extern const int64 k_MW_ModuleFatalError; +extern const int64 k_CONNECTION_TIMEOUT; +extern const int64 k_XSD_GDAY; +extern const int64 k_XSD_NMTOKEN; +extern const int64 k_MYSQLI_TYPE_DATETIME; +extern const int64 k_SIGTTIN; +extern const int64 k_SOCKET_ENOENT; +extern const int64 k_CURLOPT_CUSTOMREQUEST; +extern const int64 k_DOM_NAMESPACE_ERR; +extern const int64 k_MW_UndefinedCompression; +extern const int64 k_LDAP_OPT_DEREF; +extern const int64 k_T_CASE; +extern const int64 k_MW_EvenOddRule; +extern const int64 k_STREAM_NOTIFY_FILE_SIZE_IS; +extern const int64 k_MW_PeakSignalToNoiseRatioMetric; +extern const int64 k_SOAP_DOCUMENT; +extern const int64 k_CURLE_FTP_COULDNT_RETR_FILE; +extern const int64 k_MW_UndefinedIntent; +extern const int64 k_MW_YellowChannel; +extern const int64 k_WSDL_CACHE_NONE; +extern const int64 k_SIGTSTP; +extern const int64 k_SO_TYPE; +extern const int64 k_MW_NorthEastGravity; +extern const int64 k_INTL_MAX_LOCALE_LEN; +extern const int64 k_SIGTTOU; +extern const int64 k_MW_CacheError; +extern const int64 k_CURLINFO_PRETRANSFER_TIME; +extern const int64 k_SOCKET_ECONNABORTED; +extern const int64 k_SOCKET_ENOLINK; +extern const int64 k_MW_SrcInCompositeOp; +extern const int64 k_MW_GrayscalePreview; +extern const int64 k_MW_SegmentPreview; +extern const int64 k_SOCKET_EADDRNOTAVAIL; +extern const int64 k_CURLE_SSL_ENGINE_NOTFOUND; +extern const int64 k_XML_ERROR_RECURSIVE_ENTITY_REF; +extern const int64 k_SOAP_ACTOR_UNLIMATERECEIVER; +extern const int64 k_SQLT_CLOB; +extern const int64 k_MW_UndefinedRule; +extern const int64 k_SOCKET_EPFNOSUPPORT; +extern const int64 k_MW_DstOutCompositeOp; +extern const int64 k_MW_PreviousDispose; +extern const int64 k_MW_ConfigureError; +extern const int64 k_GLOB_MARK; +extern const int64 k_T_RETURN; +extern const int64 k_CURLAUTH_NTLM; +extern const StaticString k_MCRYPT_ENIGNA; +extern const int64 k_X509_PURPOSE_SMIME_ENCRYPT; +extern const int64 k_SOCKET_EREMCHG; +extern const int64 k_SOAP_PERSISTENCE_SESSION; +extern const StaticString k_MCRYPT_SAFER128; +extern const int64 k_ICONV_MIME_DECODE_CONTINUE_ON_ERROR; +extern const int64 k_OCI_DTYPE_ROWID; +extern const int64 k_MCRYPT_DECRYPT; +extern const int64 k_MW_YUVColorspace; +extern const int64 k_CREDITS_SAPI; +extern const int64 k_T_SL_EQUAL; +extern const int64 k_INI_ALL; +extern const int64 k_CURLOPT_COOKIEJAR; +extern const int64 k_UPLOAD_ERR_OK; +extern const int64 k_MW_CacheWarning; +extern const int64 k_HASH_HMAC; +extern const int64 k_MW_ReplaceMethod; +extern const int64 k_MSG_EOF; +extern const int64 k_U_BAD_VARIABLE_DEFINITION; +extern const int64 k_MW_GaussianFilter; +extern const int64 k_SOCKET_ENOLCK; +extern const int64 k_SEEK_CUR; +extern const int64 k_CURLOPT_FRESH_CONNECT; +extern const int64 k_GD_BUNDLED; +extern const int64 k_SEEK_END; +extern const int64 k_MW_SaturationIntent; +extern const int64 k_MSG_EOR; +extern const int64 k_MW_NoInterlace; +extern const int64 k_SIGUSR1; +extern const int64 k_U_SORT_KEY_TOO_SHORT_WARNING; +extern const int64 k_SIGXCPU; +extern const int64 k_SIGUSR2; +extern const int64 k_SOCKET_EBADE; +extern const int64 k_MYSQLI_PRI_KEY_FLAG; +extern const int64 k_SOCKET_EBADF; +extern const int64 k_CURLINFO_REQUEST_SIZE; +extern const int64 k_CURLOPT_TIMECONDITION; +extern const int64 k_FNM_PATHNAME; +extern const int64 k_CURL_TIMECOND_IFUNMODSINCE; +extern const int64 k_MW_SharpenPreview; +extern const int64 k_SQLT_BDOUBLE; +extern const int64 k_SOCKET_EBADR; +extern const int64 k_MW_PointFilter; +extern const int64 k_SOCKET_EOPNOTSUPP; +extern const int64 k_U_UNMATCHED_BRACES; +extern const int64 k_ENT_NOQUOTES; +extern const StaticString k_PHP_OS; +extern const int64 k_PSFS_FEED_ME; +extern const int64 k_LOG_WARNING; +extern const int64 k_SOCKET_ENOMEM; +extern const int64 k_CURLE_TELNET_OPTION_SYNTAX; +extern const int64 k_PATHINFO_FILENAME; +extern const StaticString k_PEAR_INSTALL_DIR; +extern const int64 k_PHP_URL_QUERY; +extern const int64 k_XSD_GMONTHDAY; +extern const int64 k_MW_UndefinedAlign; +extern const StaticString k_MCRYPT_BLOWFISH; +extern const int64 k_CURLE_FTP_CANT_GET_HOST; +extern const int64 k_PKCS7_NOSIGS; +extern const int64 k_XML_CDATA_SECTION_NODE; +extern const int64 k_U_MESSAGE_PARSE_ERROR; +extern const int64 k_SOCKET_EADV; +extern const int64 k_MW_QuantizePreview; +extern const int64 k_CURLOPT_QUOTE; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv3_SERVER; +extern const int64 k_STREAM_NOTIFY_CONNECT; +extern const int64 k_SOAP_AUTHENTICATION_BASIC; +extern const int64 k_IMG_FILTER_SELECTIVE_BLUR; +extern const int64 k_CURLINFO_SIZE_UPLOAD; +extern const int64 k_MW_BoxFilter; +extern const int64 k_OPENSSL_CIPHER_3DES; +extern const int64 k_SOCKET_ENONET; +extern const int64 k_PREG_PATTERN_ORDER; +extern const int64 k_SOCKET_EINVAL; +extern const StaticString k_MCRYPT_SAFER64; +extern const int64 k_T_DIV_EQUAL; +extern const int64 k_MW_ModuleError; +extern const int64 k_U_INVALID_TABLE_FILE; +extern const int64 k_T_ELSEIF; +extern const int64 k_T_STRING_CAST; + + +// 2. Classes + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_GLOBALS_CONSTANTS_FW_H__ diff --git a/src/lib/system/gen/php/globals/constants.h b/src/lib/system/gen/php/globals/constants.h new file mode 100644 index 0000000000000..c1919ad86445b --- /dev/null +++ b/src/lib/system/gen/php/globals/constants.h @@ -0,0 +1,33 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_GLOBALS_CONSTANTS_H__ +#define __GENERATED_PHP_GLOBALS_CONSTANTS_H__ + +#include +#include + +// Declarations + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant pm_php$globals$constants_php(bool incOnce = false, LVariableTable* variables = NULL); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_GLOBALS_CONSTANTS_H__ diff --git a/src/lib/system/gen/php/globals/symbols.cpp b/src/lib/system/gen/php/globals/symbols.cpp new file mode 100644 index 0000000000000..705834ccf7f8b --- /dev/null +++ b/src/lib/system/gen/php/globals/symbols.cpp @@ -0,0 +1,74 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/* preface starts */ +/* preface finishes */ +Variant pm_php$globals$symbols_php(bool incOnce /* = false */, LVariableTable* variables /* = NULL */) { + FUNCTION_INJECTION(run_init::globals/symbols.php); + { + DECLARE_SYSTEM_GLOBALS(g); + bool &alreadyRun = g->run_pm_php$globals$symbols_php; + if (alreadyRun) { if (incOnce) return true;} + else alreadyRun = true; + if (!variables) variables = g; + } + DECLARE_SYSTEM_GLOBALS(g); + LVariableTable *gVariables __attribute__((__unused__)) = get_variable_table(); + Variant &v_argc __attribute__((__unused__)) = g->gv_argc; + Variant &v_argv __attribute__((__unused__)) = g->gv_argv; + Variant &v__SERVER __attribute__((__unused__)) = g->gv__SERVER; + Variant &v__GET __attribute__((__unused__)) = g->gv__GET; + Variant &v__POST __attribute__((__unused__)) = g->gv__POST; + Variant &v__COOKIE __attribute__((__unused__)) = g->gv__COOKIE; + Variant &v__FILES __attribute__((__unused__)) = g->gv__FILES; + Variant &v__ENV __attribute__((__unused__)) = g->gv__ENV; + Variant &v__REQUEST __attribute__((__unused__)) = g->gv__REQUEST; + Variant &v__SESSION __attribute__((__unused__)) = g->gv__SESSION; + Variant &v_HTTP_RAW_POST_DATA __attribute__((__unused__)) = g->gv_HTTP_RAW_POST_DATA; + Variant &v_http_response_header __attribute__((__unused__)) = g->gv_http_response_header; + + setNull(v_argc); + setNull(v_argv); + setNull(v__SERVER); + setNull(v__GET); + setNull(v__POST); + setNull(v__COOKIE); + setNull(v__FILES); + setNull(v__ENV); + setNull(v__REQUEST); + setNull(v__SESSION); + v__SERVER = SystemScalarArrays::ssa_[0]; + v__GET = SystemScalarArrays::ssa_[0]; + v__POST = SystemScalarArrays::ssa_[0]; + v__COOKIE = SystemScalarArrays::ssa_[0]; + v__FILES = SystemScalarArrays::ssa_[0]; + v__ENV = SystemScalarArrays::ssa_[0]; + v__REQUEST = SystemScalarArrays::ssa_[0]; + v__SESSION = SystemScalarArrays::ssa_[0]; + setNull(v_HTTP_RAW_POST_DATA); + setNull(v_http_response_header); + return true; +} /* function */ + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/php/globals/symbols.fw.h b/src/lib/system/gen/php/globals/symbols.fw.h new file mode 100644 index 0000000000000..d24055a5cc6eb --- /dev/null +++ b/src/lib/system/gen/php/globals/symbols.fw.h @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_GLOBALS_SYMBOLS_FW_H__ +#define __GENERATED_PHP_GLOBALS_SYMBOLS_FW_H__ + +#include + +// Forward Declarations + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// 1. Constants + +// 2. Classes + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_GLOBALS_SYMBOLS_FW_H__ diff --git a/src/lib/system/gen/php/globals/symbols.h b/src/lib/system/gen/php/globals/symbols.h new file mode 100644 index 0000000000000..1d70e93bb2d47 --- /dev/null +++ b/src/lib/system/gen/php/globals/symbols.h @@ -0,0 +1,33 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_PHP_GLOBALS_SYMBOLS_H__ +#define __GENERATED_PHP_GLOBALS_SYMBOLS_H__ + +#include +#include + +// Declarations + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Variant pm_php$globals$symbols_php(bool incOnce = false, LVariableTable* variables = NULL); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_PHP_GLOBALS_SYMBOLS_H__ diff --git a/src/lib/system/gen/sys/dynamic_table_class.no.cpp b/src/lib/system/gen/sys/dynamic_table_class.no.cpp new file mode 100644 index 0000000000000..16914911abcf8 --- /dev/null +++ b/src/lib/system/gen/sys/dynamic_table_class.no.cpp @@ -0,0 +1,20838 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +// Class Invoke Tables +Variant cw_reflectionfunctionabstract$os_get(const char *s); +Variant &cw_reflectionfunctionabstract$os_lval(const char *s); +Variant cw_reflectionfunctionabstract$os_constant(const char *s); +Variant cw_reflectionfunctionabstract$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_reflectionobject$os_get(const char *s); +Variant &cw_reflectionobject$os_lval(const char *s); +Variant cw_reflectionobject$os_constant(const char *s); +Variant cw_reflectionobject$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_unexpectedvalueexception$os_get(const char *s); +Variant &cw_unexpectedvalueexception$os_lval(const char *s); +Variant cw_unexpectedvalueexception$os_constant(const char *s); +Variant cw_unexpectedvalueexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_stdclass$os_get(const char *s); +Variant &cw_stdclass$os_lval(const char *s); +Variant cw_stdclass$os_constant(const char *s); +Variant cw_stdclass$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_reflectionexception$os_get(const char *s); +Variant &cw_reflectionexception$os_lval(const char *s); +Variant cw_reflectionexception$os_constant(const char *s); +Variant cw_reflectionexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_overflowexception$os_get(const char *s); +Variant &cw_overflowexception$os_lval(const char *s); +Variant cw_overflowexception$os_constant(const char *s); +Variant cw_overflowexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_arrayiterator$os_get(const char *s); +Variant &cw_arrayiterator$os_lval(const char *s); +Variant cw_arrayiterator$os_constant(const char *s); +Variant cw_arrayiterator$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_outofboundsexception$os_get(const char *s); +Variant &cw_outofboundsexception$os_lval(const char *s); +Variant cw_outofboundsexception$os_constant(const char *s); +Variant cw_outofboundsexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_logicexception$os_get(const char *s); +Variant &cw_logicexception$os_lval(const char *s); +Variant cw_logicexception$os_constant(const char *s); +Variant cw_logicexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_rangeexception$os_get(const char *s); +Variant &cw_rangeexception$os_lval(const char *s); +Variant cw_rangeexception$os_constant(const char *s); +Variant cw_rangeexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_invalidargumentexception$os_get(const char *s); +Variant &cw_invalidargumentexception$os_lval(const char *s); +Variant cw_invalidargumentexception$os_constant(const char *s); +Variant cw_invalidargumentexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_reflectionclass$os_get(const char *s); +Variant &cw_reflectionclass$os_lval(const char *s); +Variant cw_reflectionclass$os_constant(const char *s); +Variant cw_reflectionclass$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_underflowexception$os_get(const char *s); +Variant &cw_underflowexception$os_lval(const char *s); +Variant cw_underflowexception$os_constant(const char *s); +Variant cw_underflowexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_reflectionextension$os_get(const char *s); +Variant &cw_reflectionextension$os_lval(const char *s); +Variant cw_reflectionextension$os_constant(const char *s); +Variant cw_reflectionextension$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_outofrangeexception$os_get(const char *s); +Variant &cw_outofrangeexception$os_lval(const char *s); +Variant cw_outofrangeexception$os_constant(const char *s); +Variant cw_outofrangeexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_reflectionmethod$os_get(const char *s); +Variant &cw_reflectionmethod$os_lval(const char *s); +Variant cw_reflectionmethod$os_constant(const char *s); +Variant cw_reflectionmethod$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_badmethodcallexception$os_get(const char *s); +Variant &cw_badmethodcallexception$os_lval(const char *s); +Variant cw_badmethodcallexception$os_constant(const char *s); +Variant cw_badmethodcallexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_pear_error$os_get(const char *s); +Variant &cw_pear_error$os_lval(const char *s); +Variant cw_pear_error$os_constant(const char *s); +Variant cw_pear_error$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_reflectionproperty$os_get(const char *s); +Variant &cw_reflectionproperty$os_lval(const char *s); +Variant cw_reflectionproperty$os_constant(const char *s); +Variant cw_reflectionproperty$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw___php_incomplete_class$os_get(const char *s); +Variant &cw___php_incomplete_class$os_lval(const char *s); +Variant cw___php_incomplete_class$os_constant(const char *s); +Variant cw___php_incomplete_class$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_runtimeexception$os_get(const char *s); +Variant &cw_runtimeexception$os_lval(const char *s); +Variant cw_runtimeexception$os_constant(const char *s); +Variant cw_runtimeexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_exception$os_get(const char *s); +Variant &cw_exception$os_lval(const char *s); +Variant cw_exception$os_constant(const char *s); +Variant cw_exception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_reflectionfunction$os_get(const char *s); +Variant &cw_reflectionfunction$os_lval(const char *s); +Variant cw_reflectionfunction$os_constant(const char *s); +Variant cw_reflectionfunction$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_badfunctioncallexception$os_get(const char *s); +Variant &cw_badfunctioncallexception$os_lval(const char *s); +Variant cw_badfunctioncallexception$os_constant(const char *s); +Variant cw_badfunctioncallexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_lengthexception$os_get(const char *s); +Variant &cw_lengthexception$os_lval(const char *s); +Variant cw_lengthexception$os_constant(const char *s); +Variant cw_lengthexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_domainexception$os_get(const char *s); +Variant &cw_domainexception$os_lval(const char *s); +Variant cw_domainexception$os_constant(const char *s); +Variant cw_domainexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Variant cw_reflectionparameter$os_get(const char *s); +Variant &cw_reflectionparameter$os_lval(const char *s); +Variant cw_reflectionparameter$os_constant(const char *s); +Variant cw_reflectionparameter$os_invoke(const char *c, const char *s, CArrRef params, bool fatal = true); +Object co_domdocumentfragment(CArrRef params, bool init /* = true */) { + return Object(p_domdocumentfragment(NEW(c_domdocumentfragment)())->dynCreate(params, init)); +} +Variant c_domdocumentfragment::os_get(const char *s, int64 hash) { + return c_domnode::os_get(s, hash); +} +Variant &c_domdocumentfragment::os_lval(const char *s, int64 hash) { + return c_domnode::os_lval(s, hash); +} +void c_domdocumentfragment::o_get(ArrayElementVec &props) const { + c_domnode::o_get(props); +} +bool c_domdocumentfragment::o_exists(CStrRef s, int64 hash) const { + return c_domnode::o_exists(s, hash); +} +Variant c_domdocumentfragment::o_get(CStrRef s, int64 hash) { + return c_domnode::o_get(s, hash); +} +Variant c_domdocumentfragment::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domnode::o_set(s, hash, v, forInit); +} +Variant &c_domdocumentfragment::o_lval(CStrRef s, int64 hash) { + return c_domnode::o_lval(s, hash); +} +Variant c_domdocumentfragment::os_constant(const char *s) { + return c_domnode::os_constant(s); +} +IMPLEMENT_CLASS(domdocumentfragment) +ObjectData *c_domdocumentfragment::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_domdocumentfragment::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_domdocumentfragment::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_domdocumentfragment::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domdocumentfragment::cloneImpl() { + c_domdocumentfragment *obj = NEW(c_domdocumentfragment)(); + cloneSet(obj); + return obj; +} +void c_domdocumentfragment::cloneSet(c_domdocumentfragment *clone) { + c_domnode::cloneSet(clone); +} +Variant c_domdocumentfragment::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + HASH_GUARD(0x1E44C8E8C1920931LL, appendxml) { + return (t_appendxml(params.rvalAt(0))); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke(s, params, hash, fatal); +} +Variant c_domdocumentfragment::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + HASH_GUARD(0x1E44C8E8C1920931LL, appendxml) { + return (t_appendxml(a0)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domdocumentfragment::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domnode::os_invoke(c, s, params, hash, fatal); +} +Variant c_domdocumentfragment::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + HASH_GUARD(0x1E44C8E8C1920931LL, appendxml) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendxml(a0)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domdocumentfragment::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domnode::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domdocumentfragment$os_get(const char *s) { + return c_domdocumentfragment::os_get(s, -1); +} +Variant &cw_domdocumentfragment$os_lval(const char *s) { + return c_domdocumentfragment::os_lval(s, -1); +} +Variant cw_domdocumentfragment$os_constant(const char *s) { + return c_domdocumentfragment::os_constant(s); +} +Variant cw_domdocumentfragment$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domdocumentfragment::os_invoke(c, s, params, -1, fatal); +} +Object co_domtext(CArrRef params, bool init /* = true */) { + return Object(p_domtext(NEW(c_domtext)())->dynCreate(params, init)); +} +Variant c_domtext::os_get(const char *s, int64 hash) { + return c_domcharacterdata::os_get(s, hash); +} +Variant &c_domtext::os_lval(const char *s, int64 hash) { + return c_domcharacterdata::os_lval(s, hash); +} +void c_domtext::o_get(ArrayElementVec &props) const { + c_domcharacterdata::o_get(props); +} +bool c_domtext::o_exists(CStrRef s, int64 hash) const { + return c_domcharacterdata::o_exists(s, hash); +} +Variant c_domtext::o_get(CStrRef s, int64 hash) { + return c_domcharacterdata::o_get(s, hash); +} +Variant c_domtext::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domcharacterdata::o_set(s, hash, v, forInit); +} +Variant &c_domtext::o_lval(CStrRef s, int64 hash) { + return c_domcharacterdata::o_lval(s, hash); +} +Variant c_domtext::os_constant(const char *s) { + return c_domcharacterdata::os_constant(s); +} +IMPLEMENT_CLASS(domtext) +ObjectData *c_domtext::create(Variant a0) { + init(); + t___construct(a0); + return this; +} +ObjectData *c_domtext::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_domtext::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +void c_domtext::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domtext::cloneImpl() { + c_domtext *obj = NEW(c_domtext)(); + cloneSet(obj); + return obj; +} +void c_domtext::cloneSet(c_domtext *clone) { + c_domcharacterdata::cloneSet(clone); +} +Variant c_domtext::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + return (t_deletedata(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + HASH_GUARD(0x28FBAB4F0F6C02DDLL, iswhitespaceinelementcontent) { + return (t_iswhitespaceinelementcontent()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + return (t_appenddata(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + return (t_substringdata(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + return (t_replacedata(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 55: + HASH_GUARD(0x714D38308D8212B7LL, splittext) { + return (t_splittext(params.rvalAt(0))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + return (t_insertdata(params.rvalAt(0), params.rvalAt(1))); + } + break; + default: + break; + } + return c_domcharacterdata::o_invoke(s, params, hash, fatal); +} +Variant c_domtext::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + return (t_deletedata(a0, a1)); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + HASH_GUARD(0x28FBAB4F0F6C02DDLL, iswhitespaceinelementcontent) { + return (t_iswhitespaceinelementcontent()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + return (t_appenddata(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + return (t_substringdata(a0, a1)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + return (t_replacedata(a0, a1, a2)); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 55: + HASH_GUARD(0x714D38308D8212B7LL, splittext) { + return (t_splittext(a0)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + return (t_insertdata(a0, a1)); + } + break; + default: + break; + } + return c_domcharacterdata::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domtext::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domcharacterdata::os_invoke(c, s, params, hash, fatal); +} +Variant c_domtext::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_deletedata(a0, a1)); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + HASH_GUARD(0x28FBAB4F0F6C02DDLL, iswhitespaceinelementcontent) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_iswhitespaceinelementcontent()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appenddata(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_substringdata(a0, a1)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacedata(a0, a1, a2)); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 55: + HASH_GUARD(0x714D38308D8212B7LL, splittext) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_splittext(a0)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_insertdata(a0, a1)); + } + break; + default: + break; + } + return c_domcharacterdata::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domtext::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domcharacterdata::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domtext$os_get(const char *s) { + return c_domtext::os_get(s, -1); +} +Variant &cw_domtext$os_lval(const char *s) { + return c_domtext::os_lval(s, -1); +} +Variant cw_domtext$os_constant(const char *s) { + return c_domtext::os_constant(s); +} +Variant cw_domtext$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domtext::os_invoke(c, s, params, -1, fatal); +} +Object co_domcdatasection(CArrRef params, bool init /* = true */) { + return Object(p_domcdatasection(NEW(c_domcdatasection)())->dynCreate(params, init)); +} +Variant c_domcdatasection::os_get(const char *s, int64 hash) { + return c_domtext::os_get(s, hash); +} +Variant &c_domcdatasection::os_lval(const char *s, int64 hash) { + return c_domtext::os_lval(s, hash); +} +void c_domcdatasection::o_get(ArrayElementVec &props) const { + c_domtext::o_get(props); +} +bool c_domcdatasection::o_exists(CStrRef s, int64 hash) const { + return c_domtext::o_exists(s, hash); +} +Variant c_domcdatasection::o_get(CStrRef s, int64 hash) { + return c_domtext::o_get(s, hash); +} +Variant c_domcdatasection::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domtext::o_set(s, hash, v, forInit); +} +Variant &c_domcdatasection::o_lval(CStrRef s, int64 hash) { + return c_domtext::o_lval(s, hash); +} +Variant c_domcdatasection::os_constant(const char *s) { + return c_domtext::os_constant(s); +} +IMPLEMENT_CLASS(domcdatasection) +ObjectData *c_domcdatasection::create(Variant a0) { + init(); + t___construct(a0); + return this; +} +ObjectData *c_domcdatasection::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_domcdatasection::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +void c_domcdatasection::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domcdatasection::cloneImpl() { + c_domcdatasection *obj = NEW(c_domcdatasection)(); + cloneSet(obj); + return obj; +} +void c_domcdatasection::cloneSet(c_domcdatasection *clone) { + c_domtext::cloneSet(clone); +} +Variant c_domcdatasection::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + return (t_deletedata(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + HASH_GUARD(0x28FBAB4F0F6C02DDLL, iswhitespaceinelementcontent) { + return (t_iswhitespaceinelementcontent()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + return (t_appenddata(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + return (t_substringdata(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + return (t_replacedata(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 55: + HASH_GUARD(0x714D38308D8212B7LL, splittext) { + return (t_splittext(params.rvalAt(0))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + return (t_insertdata(params.rvalAt(0), params.rvalAt(1))); + } + break; + default: + break; + } + return c_domtext::o_invoke(s, params, hash, fatal); +} +Variant c_domcdatasection::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + return (t_deletedata(a0, a1)); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + HASH_GUARD(0x28FBAB4F0F6C02DDLL, iswhitespaceinelementcontent) { + return (t_iswhitespaceinelementcontent()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + return (t_appenddata(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + return (t_substringdata(a0, a1)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + return (t_replacedata(a0, a1, a2)); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 55: + HASH_GUARD(0x714D38308D8212B7LL, splittext) { + return (t_splittext(a0)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + return (t_insertdata(a0, a1)); + } + break; + default: + break; + } + return c_domtext::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domcdatasection::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domtext::os_invoke(c, s, params, hash, fatal); +} +Variant c_domcdatasection::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_deletedata(a0, a1)); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + HASH_GUARD(0x28FBAB4F0F6C02DDLL, iswhitespaceinelementcontent) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_iswhitespaceinelementcontent()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appenddata(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_substringdata(a0, a1)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacedata(a0, a1, a2)); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 55: + HASH_GUARD(0x714D38308D8212B7LL, splittext) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_splittext(a0)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_insertdata(a0, a1)); + } + break; + default: + break; + } + return c_domtext::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domcdatasection::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domtext::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domcdatasection$os_get(const char *s) { + return c_domcdatasection::os_get(s, -1); +} +Variant &cw_domcdatasection$os_lval(const char *s) { + return c_domcdatasection::os_lval(s, -1); +} +Variant cw_domcdatasection$os_constant(const char *s) { + return c_domcdatasection::os_constant(s); +} +Variant cw_domcdatasection$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domcdatasection::os_invoke(c, s, params, -1, fatal); +} +Object co_domdocumenttype(CArrRef params, bool init /* = true */) { + return Object(p_domdocumenttype(NEW(c_domdocumenttype)())->dynCreate(params, init)); +} +Variant c_domdocumenttype::os_get(const char *s, int64 hash) { + return c_domnode::os_get(s, hash); +} +Variant &c_domdocumenttype::os_lval(const char *s, int64 hash) { + return c_domnode::os_lval(s, hash); +} +void c_domdocumenttype::o_get(ArrayElementVec &props) const { + c_domnode::o_get(props); +} +bool c_domdocumenttype::o_exists(CStrRef s, int64 hash) const { + return c_domnode::o_exists(s, hash); +} +Variant c_domdocumenttype::o_get(CStrRef s, int64 hash) { + return c_domnode::o_get(s, hash); +} +Variant c_domdocumenttype::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domnode::o_set(s, hash, v, forInit); +} +Variant &c_domdocumenttype::o_lval(CStrRef s, int64 hash) { + return c_domnode::o_lval(s, hash); +} +Variant c_domdocumenttype::os_constant(const char *s) { + return c_domnode::os_constant(s); +} +IMPLEMENT_CLASS(domdocumenttype) +ObjectData *c_domdocumenttype::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_domdocumenttype::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_domdocumenttype::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_domdocumenttype::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domdocumenttype::cloneImpl() { + c_domdocumenttype *obj = NEW(c_domdocumenttype)(); + cloneSet(obj); + return obj; +} +void c_domdocumenttype::cloneSet(c_domdocumenttype *clone) { + c_domnode::cloneSet(clone); +} +Variant c_domdocumenttype::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke(s, params, hash, fatal); +} +Variant c_domdocumenttype::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domdocumenttype::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domnode::os_invoke(c, s, params, hash, fatal); +} +Variant c_domdocumenttype::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domdocumenttype::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domnode::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domdocumenttype$os_get(const char *s) { + return c_domdocumenttype::os_get(s, -1); +} +Variant &cw_domdocumenttype$os_lval(const char *s) { + return c_domdocumenttype::os_lval(s, -1); +} +Variant cw_domdocumenttype$os_constant(const char *s) { + return c_domdocumenttype::os_constant(s); +} +Variant cw_domdocumenttype$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domdocumenttype::os_invoke(c, s, params, -1, fatal); +} +Object co_sqlite3stmt(CArrRef params, bool init /* = true */) { + return Object(p_sqlite3stmt(NEW(c_sqlite3stmt)())->dynCreate(params, init)); +} +Variant c_sqlite3stmt::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_sqlite3stmt::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_sqlite3stmt::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_sqlite3stmt::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_sqlite3stmt::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_sqlite3stmt::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_sqlite3stmt::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_sqlite3stmt::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(sqlite3stmt) +ObjectData *c_sqlite3stmt::create(Object a0, String a1) { + init(); + t___construct(a0, a1); + return this; +} +ObjectData *c_sqlite3stmt::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_sqlite3stmt::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +void c_sqlite3stmt::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_sqlite3stmt::cloneImpl() { + c_sqlite3stmt *obj = NEW(c_sqlite3stmt)(); + cloneSet(obj); + return obj; +} +void c_sqlite3stmt::cloneSet(c_sqlite3stmt *clone) { + ObjectData::cloneSet(clone); +} +Variant c_sqlite3stmt::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 0: + HASH_GUARD(0x340A51AE22A924E0LL, reset) { + return (t_reset()); + } + break; + case 1: + HASH_GUARD(0x78AE97BFBEBF5341LL, close) { + return (t_close()); + } + break; + case 3: + HASH_GUARD(0x436E6AFC3628E403LL, bindvalue) { + int count = params.size(); + if (count <= 2) return (t_bindvalue(params.rvalAt(0), params.rvalAt(1))); + return (t_bindvalue(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 7: + HASH_GUARD(0x31DA235C5A226667LL, clear) { + return (t_clear()); + } + break; + case 14: + HASH_GUARD(0x187C7F43EB57714ELL, execute) { + return (t_execute()); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 22: + HASH_GUARD(0x77B13FCF1BA41696LL, bindparam) { + int count = params.size(); + if (count <= 2) return (t_bindparam(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (t_bindparam(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); + } + break; + case 23: + HASH_GUARD(0x72FA987001E93357LL, paramcount) { + return (t_paramcount()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_sqlite3stmt::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 0: + HASH_GUARD(0x340A51AE22A924E0LL, reset) { + return (t_reset()); + } + break; + case 1: + HASH_GUARD(0x78AE97BFBEBF5341LL, close) { + return (t_close()); + } + break; + case 3: + HASH_GUARD(0x436E6AFC3628E403LL, bindvalue) { + if (count <= 2) return (t_bindvalue(a0, a1)); + return (t_bindvalue(a0, a1, a2)); + } + break; + case 7: + HASH_GUARD(0x31DA235C5A226667LL, clear) { + return (t_clear()); + } + break; + case 14: + HASH_GUARD(0x187C7F43EB57714ELL, execute) { + return (t_execute()); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 22: + HASH_GUARD(0x77B13FCF1BA41696LL, bindparam) { + if (count <= 2) return (t_bindparam(a0, ref(a1))); + return (t_bindparam(a0, ref(a1), a2)); + } + break; + case 23: + HASH_GUARD(0x72FA987001E93357LL, paramcount) { + return (t_paramcount()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_sqlite3stmt::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_sqlite3stmt::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 0: + HASH_GUARD(0x340A51AE22A924E0LL, reset) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_reset()); + } + break; + case 1: + HASH_GUARD(0x78AE97BFBEBF5341LL, close) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_close()); + } + break; + case 3: + HASH_GUARD(0x436E6AFC3628E403LL, bindvalue) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_bindvalue(a0, a1)); + return (t_bindvalue(a0, a1, a2)); + } + break; + case 7: + HASH_GUARD(0x31DA235C5A226667LL, clear) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_clear()); + } + break; + case 14: + HASH_GUARD(0x187C7F43EB57714ELL, execute) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_execute()); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 22: + HASH_GUARD(0x77B13FCF1BA41696LL, bindparam) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_bindparam(a0, ref(a1))); + return (t_bindparam(a0, ref(a1), a2)); + } + break; + case 23: + HASH_GUARD(0x72FA987001E93357LL, paramcount) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_paramcount()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_sqlite3stmt::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_sqlite3stmt$os_get(const char *s) { + return c_sqlite3stmt::os_get(s, -1); +} +Variant &cw_sqlite3stmt$os_lval(const char *s) { + return c_sqlite3stmt::os_lval(s, -1); +} +Variant cw_sqlite3stmt$os_constant(const char *s) { + return c_sqlite3stmt::os_constant(s); +} +Variant cw_sqlite3stmt$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_sqlite3stmt::os_invoke(c, s, params, -1, fatal); +} +Object co_domnodelist(CArrRef params, bool init /* = true */) { + return Object(p_domnodelist(NEW(c_domnodelist)())->dynCreate(params, init)); +} +Variant c_domnodelist::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_domnodelist::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_domnodelist::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_domnodelist::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_domnodelist::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_domnodelist::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_domnodelist::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_domnodelist::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(domnodelist) +ObjectData *c_domnodelist::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_domnodelist::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_domnodelist::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_domnodelist::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domnodelist::cloneImpl() { + c_domnodelist *obj = NEW(c_domnodelist)(); + cloneSet(obj); + return obj; +} +void c_domnodelist::cloneSet(c_domnodelist *clone) { + ObjectData::cloneSet(clone); +} +Variant c_domnodelist::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 7) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 6: + HASH_GUARD(0x0A41DBE0830902C6LL, item) { + return (t_item(params.rvalAt(0))); + } + break; + case 7: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_domnodelist::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 7) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 6: + HASH_GUARD(0x0A41DBE0830902C6LL, item) { + return (t_item(a0)); + } + break; + case 7: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domnodelist::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_domnodelist::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 7) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 6: + HASH_GUARD(0x0A41DBE0830902C6LL, item) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_item(a0)); + } + break; + case 7: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domnodelist::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domnodelist$os_get(const char *s) { + return c_domnodelist::os_get(s, -1); +} +Variant &cw_domnodelist$os_lval(const char *s) { + return c_domnodelist::os_lval(s, -1); +} +Variant cw_domnodelist$os_constant(const char *s) { + return c_domnodelist::os_constant(s); +} +Variant cw_domnodelist$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domnodelist::os_invoke(c, s, params, -1, fatal); +} +Object co_domcharacterdata(CArrRef params, bool init /* = true */) { + return Object(p_domcharacterdata(NEW(c_domcharacterdata)())->dynCreate(params, init)); +} +Variant c_domcharacterdata::os_get(const char *s, int64 hash) { + return c_domnode::os_get(s, hash); +} +Variant &c_domcharacterdata::os_lval(const char *s, int64 hash) { + return c_domnode::os_lval(s, hash); +} +void c_domcharacterdata::o_get(ArrayElementVec &props) const { + c_domnode::o_get(props); +} +bool c_domcharacterdata::o_exists(CStrRef s, int64 hash) const { + return c_domnode::o_exists(s, hash); +} +Variant c_domcharacterdata::o_get(CStrRef s, int64 hash) { + return c_domnode::o_get(s, hash); +} +Variant c_domcharacterdata::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domnode::o_set(s, hash, v, forInit); +} +Variant &c_domcharacterdata::o_lval(CStrRef s, int64 hash) { + return c_domnode::o_lval(s, hash); +} +Variant c_domcharacterdata::os_constant(const char *s) { + return c_domnode::os_constant(s); +} +IMPLEMENT_CLASS(domcharacterdata) +ObjectData *c_domcharacterdata::create(Variant a0) { + init(); + t___construct(a0); + return this; +} +ObjectData *c_domcharacterdata::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_domcharacterdata::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +void c_domcharacterdata::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domcharacterdata::cloneImpl() { + c_domcharacterdata *obj = NEW(c_domcharacterdata)(); + cloneSet(obj); + return obj; +} +void c_domcharacterdata::cloneSet(c_domcharacterdata *clone) { + c_domnode::cloneSet(clone); +} +Variant c_domcharacterdata::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + return (t_deletedata(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + return (t_appenddata(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + return (t_substringdata(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + return (t_replacedata(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + return (t_insertdata(params.rvalAt(0), params.rvalAt(1))); + } + break; + default: + break; + } + return c_domnode::o_invoke(s, params, hash, fatal); +} +Variant c_domcharacterdata::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + return (t_deletedata(a0, a1)); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + return (t_appenddata(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + return (t_substringdata(a0, a1)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + return (t_replacedata(a0, a1, a2)); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + return (t_insertdata(a0, a1)); + } + break; + default: + break; + } + return c_domnode::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domcharacterdata::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domnode::os_invoke(c, s, params, hash, fatal); +} +Variant c_domcharacterdata::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_deletedata(a0, a1)); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appenddata(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_substringdata(a0, a1)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacedata(a0, a1, a2)); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_insertdata(a0, a1)); + } + break; + default: + break; + } + return c_domnode::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domcharacterdata::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domnode::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domcharacterdata$os_get(const char *s) { + return c_domcharacterdata::os_get(s, -1); +} +Variant &cw_domcharacterdata$os_lval(const char *s) { + return c_domcharacterdata::os_lval(s, -1); +} +Variant cw_domcharacterdata$os_constant(const char *s) { + return c_domcharacterdata::os_constant(s); +} +Variant cw_domcharacterdata$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domcharacterdata::os_invoke(c, s, params, -1, fatal); +} +Object co_domentityreference(CArrRef params, bool init /* = true */) { + return Object(p_domentityreference(NEW(c_domentityreference)())->dynCreate(params, init)); +} +Variant c_domentityreference::os_get(const char *s, int64 hash) { + return c_domnode::os_get(s, hash); +} +Variant &c_domentityreference::os_lval(const char *s, int64 hash) { + return c_domnode::os_lval(s, hash); +} +void c_domentityreference::o_get(ArrayElementVec &props) const { + c_domnode::o_get(props); +} +bool c_domentityreference::o_exists(CStrRef s, int64 hash) const { + return c_domnode::o_exists(s, hash); +} +Variant c_domentityreference::o_get(CStrRef s, int64 hash) { + return c_domnode::o_get(s, hash); +} +Variant c_domentityreference::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domnode::o_set(s, hash, v, forInit); +} +Variant &c_domentityreference::o_lval(CStrRef s, int64 hash) { + return c_domnode::o_lval(s, hash); +} +Variant c_domentityreference::os_constant(const char *s) { + return c_domnode::os_constant(s); +} +IMPLEMENT_CLASS(domentityreference) +ObjectData *c_domentityreference::create(Variant a0) { + init(); + t___construct(a0); + return this; +} +ObjectData *c_domentityreference::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_domentityreference::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +void c_domentityreference::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domentityreference::cloneImpl() { + c_domentityreference *obj = NEW(c_domentityreference)(); + cloneSet(obj); + return obj; +} +void c_domentityreference::cloneSet(c_domentityreference *clone) { + c_domnode::cloneSet(clone); +} +Variant c_domentityreference::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke(s, params, hash, fatal); +} +Variant c_domentityreference::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domentityreference::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domnode::os_invoke(c, s, params, hash, fatal); +} +Variant c_domentityreference::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domentityreference::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domnode::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domentityreference$os_get(const char *s) { + return c_domentityreference::os_get(s, -1); +} +Variant &cw_domentityreference$os_lval(const char *s) { + return c_domentityreference::os_lval(s, -1); +} +Variant cw_domentityreference$os_constant(const char *s) { + return c_domentityreference::os_constant(s); +} +Variant cw_domentityreference$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domentityreference::os_invoke(c, s, params, -1, fatal); +} +Object co_datetimezone(CArrRef params, bool init /* = true */) { + return Object(p_datetimezone(NEW(c_datetimezone)())->dynCreate(params, init)); +} +Variant c_datetimezone::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_datetimezone::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_datetimezone::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_datetimezone::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_datetimezone::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_datetimezone::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_datetimezone::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_datetimezone::os_constant(const char *s) { + int64 hash = hash_string(s); + switch (hash & 31) { + case 2: + HASH_RETURN(0x5213CDB166554802LL, q_datetimezone_AFRICA, AFRICA); + break; + case 10: + HASH_RETURN(0x1F67AB7044E3CA2ALL, q_datetimezone_EUROPE, EUROPE); + break; + case 12: + HASH_RETURN(0x76F99914EEA96ECCLL, q_datetimezone_ARCTIC, ARCTIC); + break; + case 13: + HASH_RETURN(0x338F44565E0C038DLL, q_datetimezone_AMERICA, AMERICA); + break; + case 15: + HASH_RETURN(0x22CAA6990573E5EFLL, q_datetimezone_PACIFIC, PACIFIC); + break; + case 19: + HASH_RETURN(0x7879534F49C301F3LL, q_datetimezone_PER_COUNTRY, PER_COUNTRY); + break; + case 20: + HASH_RETURN(0x6FB9D84AA364CA14LL, q_datetimezone_UTC, UTC); + break; + case 23: + HASH_RETURN(0x5A01AACAA61E0FF7LL, q_datetimezone_ASIA, ASIA); + HASH_RETURN(0x3E74CAEDAD25E137LL, q_datetimezone_INDIAN, INDIAN); + break; + case 24: + HASH_RETURN(0x0C4F30470A9EEBF8LL, q_datetimezone_ALL, ALL); + break; + case 25: + HASH_RETURN(0x2BEDCED53E63BC79LL, q_datetimezone_ATLANTIC, ATLANTIC); + break; + case 30: + HASH_RETURN(0x3C168ED86522549ELL, q_datetimezone_AUSTRALIA, AUSTRALIA); + HASH_RETURN(0x690180C3BA732B5ELL, q_datetimezone_ALL_WITH_BC, ALL_WITH_BC); + break; + case 31: + HASH_RETURN(0x6B29DE65F46EAFDFLL, q_datetimezone_ANTARCTICA, ANTARCTICA); + break; + default: + break; + } + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(datetimezone) +ObjectData *c_datetimezone::create(String a0) { + init(); + t___construct(a0); + return this; +} +ObjectData *c_datetimezone::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_datetimezone::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +void c_datetimezone::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_datetimezone::cloneImpl() { + c_datetimezone *obj = NEW(c_datetimezone)(); + cloneSet(obj); + return obj; +} +void c_datetimezone::cloneSet(c_datetimezone *clone) { + ObjectData::cloneSet(clone); +} +Variant c_datetimezone::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 3: + HASH_GUARD(0x6D7CD16BBA93D063LL, listidentifiers) { + return (ti_listidentifiers(o_getClassName())); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 4: + HASH_GUARD(0x63D3CF3884CE93F4LL, gettransitions) { + return (t_gettransitions()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x2D0CCAB16C3ED068LL, listabbreviations) { + return (ti_listabbreviations(o_getClassName())); + } + break; + case 11: + HASH_GUARD(0x68DB66F60B55BD0BLL, getoffset) { + return (t_getoffset(params.rvalAt(0))); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_datetimezone::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 3: + HASH_GUARD(0x6D7CD16BBA93D063LL, listidentifiers) { + return (ti_listidentifiers(o_getClassName())); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 4: + HASH_GUARD(0x63D3CF3884CE93F4LL, gettransitions) { + return (t_gettransitions()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x2D0CCAB16C3ED068LL, listabbreviations) { + return (ti_listabbreviations(o_getClassName())); + } + break; + case 11: + HASH_GUARD(0x68DB66F60B55BD0BLL, getoffset) { + return (t_getoffset(a0)); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_datetimezone::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 0: + HASH_GUARD(0x2D0CCAB16C3ED068LL, listabbreviations) { + return (ti_listabbreviations(c)); + } + break; + case 3: + HASH_GUARD(0x6D7CD16BBA93D063LL, listidentifiers) { + return (ti_listidentifiers(c)); + } + break; + default: + break; + } + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_datetimezone::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 3: + HASH_GUARD(0x6D7CD16BBA93D063LL, listidentifiers) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_listidentifiers(o_getClassName())); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 4: + HASH_GUARD(0x63D3CF3884CE93F4LL, gettransitions) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettransitions()); + } + break; + case 5: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getname()); + } + break; + case 8: + HASH_GUARD(0x2D0CCAB16C3ED068LL, listabbreviations) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_listabbreviations(o_getClassName())); + } + break; + case 11: + HASH_GUARD(0x68DB66F60B55BD0BLL, getoffset) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getoffset(a0)); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_datetimezone::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 0: + HASH_GUARD(0x2D0CCAB16C3ED068LL, listabbreviations) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_listabbreviations(c)); + } + break; + case 3: + HASH_GUARD(0x6D7CD16BBA93D063LL, listidentifiers) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (ti_listidentifiers(c)); + } + break; + default: + break; + } + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_datetimezone$os_get(const char *s) { + return c_datetimezone::os_get(s, -1); +} +Variant &cw_datetimezone$os_lval(const char *s) { + return c_datetimezone::os_lval(s, -1); +} +Variant cw_datetimezone$os_constant(const char *s) { + return c_datetimezone::os_constant(s); +} +Variant cw_datetimezone$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_datetimezone::os_invoke(c, s, params, -1, fatal); +} +Object co_domimplementation(CArrRef params, bool init /* = true */) { + return Object(p_domimplementation(NEW(c_domimplementation)())->dynCreate(params, init)); +} +Variant c_domimplementation::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_domimplementation::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_domimplementation::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_domimplementation::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_domimplementation::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_domimplementation::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_domimplementation::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_domimplementation::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(domimplementation) +ObjectData *c_domimplementation::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_domimplementation::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_domimplementation::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_domimplementation::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domimplementation::cloneImpl() { + c_domimplementation *obj = NEW(c_domimplementation)(); + cloneSet(obj); + return obj; +} +void c_domimplementation::cloneSet(c_domimplementation *clone) { + ObjectData::cloneSet(clone); +} +Variant c_domimplementation::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 3: + HASH_GUARD(0x3CB56A796F3DBAC3LL, createdocumenttype) { + int count = params.size(); + if (count <= 0) return (t_createdocumenttype()); + if (count == 1) return (t_createdocumenttype(params.rvalAt(0))); + if (count == 2) return (t_createdocumenttype(params.rvalAt(0), params.rvalAt(1))); + return (t_createdocumenttype(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + HASH_GUARD(0x280878EAC306A6A3LL, hasfeature) { + return (t_hasfeature(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 14: + HASH_GUARD(0x30855E95B37D1B4ELL, createdocument) { + int count = params.size(); + if (count <= 0) return (t_createdocument()); + if (count == 1) return (t_createdocument(params.rvalAt(0))); + if (count == 2) return (t_createdocument(params.rvalAt(0), params.rvalAt(1))); + return (t_createdocument(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_domimplementation::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 3: + HASH_GUARD(0x3CB56A796F3DBAC3LL, createdocumenttype) { + if (count <= 0) return (t_createdocumenttype()); + if (count == 1) return (t_createdocumenttype(a0)); + if (count == 2) return (t_createdocumenttype(a0, a1)); + return (t_createdocumenttype(a0, a1, a2)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + HASH_GUARD(0x280878EAC306A6A3LL, hasfeature) { + return (t_hasfeature(a0, a1)); + } + break; + case 14: + HASH_GUARD(0x30855E95B37D1B4ELL, createdocument) { + if (count <= 0) return (t_createdocument()); + if (count == 1) return (t_createdocument(a0)); + if (count == 2) return (t_createdocument(a0, a1)); + return (t_createdocument(a0, a1, a2)); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domimplementation::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_domimplementation::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 3: + HASH_GUARD(0x3CB56A796F3DBAC3LL, createdocumenttype) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_createdocumenttype()); + if (count == 1) return (t_createdocumenttype(a0)); + if (count == 2) return (t_createdocumenttype(a0, a1)); + return (t_createdocumenttype(a0, a1, a2)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + HASH_GUARD(0x280878EAC306A6A3LL, hasfeature) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasfeature(a0, a1)); + } + break; + case 14: + HASH_GUARD(0x30855E95B37D1B4ELL, createdocument) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_createdocument()); + if (count == 1) return (t_createdocument(a0)); + if (count == 2) return (t_createdocument(a0, a1)); + return (t_createdocument(a0, a1, a2)); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domimplementation::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domimplementation$os_get(const char *s) { + return c_domimplementation::os_get(s, -1); +} +Variant &cw_domimplementation$os_lval(const char *s) { + return c_domimplementation::os_lval(s, -1); +} +Variant cw_domimplementation$os_constant(const char *s) { + return c_domimplementation::os_constant(s); +} +Variant cw_domimplementation$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domimplementation::os_invoke(c, s, params, -1, fatal); +} +Object co_soapheader(CArrRef params, bool init /* = true */) { + return Object(p_soapheader(NEW(c_soapheader)())->dynCreate(params, init)); +} +Variant c_soapheader::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_soapheader::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_soapheader::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_soapheader::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_soapheader::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_soapheader::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_soapheader::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_soapheader::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(soapheader) +ObjectData *c_soapheader::create(String a0, String a1, Variant a2, bool a3, Variant a4) { + init(); + t___construct(a0, a1, a2, a3, a4); + return this; +} +ObjectData *c_soapheader::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 2) return (create(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } else return this; +} +void c_soapheader::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 2) (t___construct(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +void c_soapheader::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_soapheader::cloneImpl() { + c_soapheader *obj = NEW(c_soapheader)(); + cloneSet(obj); + return obj; +} +void c_soapheader::cloneSet(c_soapheader *clone) { + ObjectData::cloneSet(clone); +} +Variant c_soapheader::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 2) return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + if (count == 3) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + if (count == 4) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_soapheader::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 2) return (t___construct(a0, a1), null); + if (count == 3) return (t___construct(a0, a1, a2), null); + if (count == 4) return (t___construct(a0, a1, a2, a3), null); + return (t___construct(a0, a1, a2, a3, a4), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_soapheader::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_soapheader::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t___construct(a0, a1), null); + if (count == 3) return (t___construct(a0, a1, a2), null); + if (count == 4) return (t___construct(a0, a1, a2, a3), null); + return (t___construct(a0, a1, a2, a3, a4), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_soapheader::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_soapheader$os_get(const char *s) { + return c_soapheader::os_get(s, -1); +} +Variant &cw_soapheader$os_lval(const char *s) { + return c_soapheader::os_lval(s, -1); +} +Variant cw_soapheader$os_constant(const char *s) { + return c_soapheader::os_constant(s); +} +Variant cw_soapheader$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_soapheader::os_invoke(c, s, params, -1, fatal); +} +Object co_domnotation(CArrRef params, bool init /* = true */) { + return Object(p_domnotation(NEW(c_domnotation)())->dynCreate(params, init)); +} +Variant c_domnotation::os_get(const char *s, int64 hash) { + return c_domnode::os_get(s, hash); +} +Variant &c_domnotation::os_lval(const char *s, int64 hash) { + return c_domnode::os_lval(s, hash); +} +void c_domnotation::o_get(ArrayElementVec &props) const { + c_domnode::o_get(props); +} +bool c_domnotation::o_exists(CStrRef s, int64 hash) const { + return c_domnode::o_exists(s, hash); +} +Variant c_domnotation::o_get(CStrRef s, int64 hash) { + return c_domnode::o_get(s, hash); +} +Variant c_domnotation::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domnode::o_set(s, hash, v, forInit); +} +Variant &c_domnotation::o_lval(CStrRef s, int64 hash) { + return c_domnode::o_lval(s, hash); +} +Variant c_domnotation::os_constant(const char *s) { + return c_domnode::os_constant(s); +} +IMPLEMENT_CLASS(domnotation) +ObjectData *c_domnotation::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_domnotation::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_domnotation::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_domnotation::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domnotation::cloneImpl() { + c_domnotation *obj = NEW(c_domnotation)(); + cloneSet(obj); + return obj; +} +void c_domnotation::cloneSet(c_domnotation *clone) { + c_domnode::cloneSet(clone); +} +Variant c_domnotation::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke(s, params, hash, fatal); +} +Variant c_domnotation::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domnotation::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domnode::os_invoke(c, s, params, hash, fatal); +} +Variant c_domnotation::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domnotation::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domnode::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domnotation$os_get(const char *s) { + return c_domnotation::os_get(s, -1); +} +Variant &cw_domnotation$os_lval(const char *s) { + return c_domnotation::os_lval(s, -1); +} +Variant cw_domnotation$os_constant(const char *s) { + return c_domnotation::os_constant(s); +} +Variant cw_domnotation$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domnotation::os_invoke(c, s, params, -1, fatal); +} +Object co_domcomment(CArrRef params, bool init /* = true */) { + return Object(p_domcomment(NEW(c_domcomment)())->dynCreate(params, init)); +} +Variant c_domcomment::os_get(const char *s, int64 hash) { + return c_domcharacterdata::os_get(s, hash); +} +Variant &c_domcomment::os_lval(const char *s, int64 hash) { + return c_domcharacterdata::os_lval(s, hash); +} +void c_domcomment::o_get(ArrayElementVec &props) const { + c_domcharacterdata::o_get(props); +} +bool c_domcomment::o_exists(CStrRef s, int64 hash) const { + return c_domcharacterdata::o_exists(s, hash); +} +Variant c_domcomment::o_get(CStrRef s, int64 hash) { + return c_domcharacterdata::o_get(s, hash); +} +Variant c_domcomment::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domcharacterdata::o_set(s, hash, v, forInit); +} +Variant &c_domcomment::o_lval(CStrRef s, int64 hash) { + return c_domcharacterdata::o_lval(s, hash); +} +Variant c_domcomment::os_constant(const char *s) { + return c_domcharacterdata::os_constant(s); +} +IMPLEMENT_CLASS(domcomment) +ObjectData *c_domcomment::create(Variant a0) { + init(); + t___construct(a0); + return this; +} +ObjectData *c_domcomment::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_domcomment::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +void c_domcomment::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domcomment::cloneImpl() { + c_domcomment *obj = NEW(c_domcomment)(); + cloneSet(obj); + return obj; +} +void c_domcomment::cloneSet(c_domcomment *clone) { + c_domcharacterdata::cloneSet(clone); +} +Variant c_domcomment::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + return (t_deletedata(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + return (t_appenddata(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + return (t_substringdata(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + return (t_replacedata(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + return (t_insertdata(params.rvalAt(0), params.rvalAt(1))); + } + break; + default: + break; + } + return c_domcharacterdata::o_invoke(s, params, hash, fatal); +} +Variant c_domcomment::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + return (t_deletedata(a0, a1)); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + return (t_appenddata(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + return (t_substringdata(a0, a1)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + return (t_replacedata(a0, a1, a2)); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + return (t_insertdata(a0, a1)); + } + break; + default: + break; + } + return c_domcharacterdata::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domcomment::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domcharacterdata::os_invoke(c, s, params, hash, fatal); +} +Variant c_domcomment::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + HASH_GUARD(0x7543EC746714D118LL, deletedata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_deletedata(a0, a1)); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 45: + HASH_GUARD(0x3DAC04A51FD2D92DLL, appenddata) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appenddata(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 50: + HASH_GUARD(0x2D8D2253C2149972LL, substringdata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_substringdata(a0, a1)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 52: + HASH_GUARD(0x470F2F0EA1F3D4B4LL, replacedata) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacedata(a0, a1, a2)); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + case 61: + HASH_GUARD(0x0E19CE7886BCEF3DLL, insertdata) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_insertdata(a0, a1)); + } + break; + default: + break; + } + return c_domcharacterdata::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domcomment::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domcharacterdata::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domcomment$os_get(const char *s) { + return c_domcomment::os_get(s, -1); +} +Variant &cw_domcomment$os_lval(const char *s) { + return c_domcomment::os_lval(s, -1); +} +Variant cw_domcomment$os_constant(const char *s) { + return c_domcomment::os_constant(s); +} +Variant cw_domcomment$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domcomment::os_invoke(c, s, params, -1, fatal); +} +Object co_sqlite3(CArrRef params, bool init /* = true */) { + return Object(p_sqlite3(NEW(c_sqlite3)())->dynCreate(params, init)); +} +Variant c_sqlite3::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_sqlite3::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_sqlite3::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_sqlite3::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_sqlite3::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_sqlite3::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_sqlite3::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_sqlite3::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(sqlite3) +ObjectData *c_sqlite3::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_sqlite3::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_sqlite3::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_sqlite3::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_sqlite3::cloneImpl() { + c_sqlite3 *obj = NEW(c_sqlite3)(); + cloneSet(obj); + return obj; +} +void c_sqlite3::cloneSet(c_sqlite3 *clone) { + ObjectData::cloneSet(clone); +} +Variant c_sqlite3::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 1: + HASH_GUARD(0x78AE97BFBEBF5341LL, close) { + return (t_close()); + } + break; + case 2: + HASH_GUARD(0x6081F282094466C2LL, lasterrormsg) { + return (t_lasterrormsg()); + } + HASH_GUARD(0x65BD6700742BF3C2LL, openblob) { + int count = params.size(); + if (count <= 3) return (t_openblob(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_openblob(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 3: + HASH_GUARD(0x3AA4CCEC6BD68143LL, createaggregate) { + int count = params.size(); + if (count <= 3) return (t_createaggregate(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_createaggregate(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 4: + HASH_GUARD(0x21F68C010C124BC4LL, open) { + int count = params.size(); + if (count <= 1) return (t_open(params.rvalAt(0)), null); + if (count == 2) return (t_open(params.rvalAt(0), params.rvalAt(1)), null); + return (t_open(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + } + break; + case 10: + HASH_GUARD(0x632B468FC2FCAB0ALL, lasterrorcode) { + return (t_lasterrorcode()); + } + break; + case 12: + HASH_GUARD(0x4F1D1ED7B087208CLL, exec) { + return (t_exec(params.rvalAt(0))); + } + break; + case 13: + HASH_GUARD(0x7CECF508291057CDLL, createfunction) { + int count = params.size(); + if (count <= 2) return (t_createfunction(params.rvalAt(0), params.rvalAt(1))); + return (t_createfunction(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 25: + HASH_GUARD(0x64D2BDB189B02819LL, changes) { + return (t_changes()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 36: + HASH_GUARD(0x1B3CDE890A487664LL, loadextension) { + return (t_loadextension(params.rvalAt(0))); + } + break; + case 38: + HASH_GUARD(0x5024F08DB0FDCBE6LL, lastinsertrowid) { + return (t_lastinsertrowid()); + } + break; + case 42: + HASH_GUARD(0x5AE41239FF63D86ALL, version) { + return (t_version()); + } + break; + case 46: + HASH_GUARD(0x156B1FAE4132ABEELL, querysingle) { + int count = params.size(); + if (count <= 1) return (t_querysingle(params.rvalAt(0))); + return (t_querysingle(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 47: + HASH_GUARD(0x540020AE4BA591AFLL, prepare) { + return (t_prepare(params.rvalAt(0))); + } + break; + case 51: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x607C4C73BB251635LL, escapestring) { + return (t_escapestring(params.rvalAt(0))); + } + break; + case 55: + HASH_GUARD(0x356758D4414DA377LL, query) { + return (t_query(params.rvalAt(0))); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_sqlite3::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 1: + HASH_GUARD(0x78AE97BFBEBF5341LL, close) { + return (t_close()); + } + break; + case 2: + HASH_GUARD(0x6081F282094466C2LL, lasterrormsg) { + return (t_lasterrormsg()); + } + HASH_GUARD(0x65BD6700742BF3C2LL, openblob) { + if (count <= 3) return (t_openblob(a0, a1, a2)); + return (t_openblob(a0, a1, a2, a3)); + } + break; + case 3: + HASH_GUARD(0x3AA4CCEC6BD68143LL, createaggregate) { + if (count <= 3) return (t_createaggregate(a0, a1, a2)); + return (t_createaggregate(a0, a1, a2, a3)); + } + break; + case 4: + HASH_GUARD(0x21F68C010C124BC4LL, open) { + if (count <= 1) return (t_open(a0), null); + if (count == 2) return (t_open(a0, a1), null); + return (t_open(a0, a1, a2), null); + } + break; + case 10: + HASH_GUARD(0x632B468FC2FCAB0ALL, lasterrorcode) { + return (t_lasterrorcode()); + } + break; + case 12: + HASH_GUARD(0x4F1D1ED7B087208CLL, exec) { + return (t_exec(a0)); + } + break; + case 13: + HASH_GUARD(0x7CECF508291057CDLL, createfunction) { + if (count <= 2) return (t_createfunction(a0, a1)); + return (t_createfunction(a0, a1, a2)); + } + break; + case 25: + HASH_GUARD(0x64D2BDB189B02819LL, changes) { + return (t_changes()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 36: + HASH_GUARD(0x1B3CDE890A487664LL, loadextension) { + return (t_loadextension(a0)); + } + break; + case 38: + HASH_GUARD(0x5024F08DB0FDCBE6LL, lastinsertrowid) { + return (t_lastinsertrowid()); + } + break; + case 42: + HASH_GUARD(0x5AE41239FF63D86ALL, version) { + return (t_version()); + } + break; + case 46: + HASH_GUARD(0x156B1FAE4132ABEELL, querysingle) { + if (count <= 1) return (t_querysingle(a0)); + return (t_querysingle(a0, a1)); + } + break; + case 47: + HASH_GUARD(0x540020AE4BA591AFLL, prepare) { + return (t_prepare(a0)); + } + break; + case 51: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x607C4C73BB251635LL, escapestring) { + return (t_escapestring(a0)); + } + break; + case 55: + HASH_GUARD(0x356758D4414DA377LL, query) { + return (t_query(a0)); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_sqlite3::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_sqlite3::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 1: + HASH_GUARD(0x78AE97BFBEBF5341LL, close) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_close()); + } + break; + case 2: + HASH_GUARD(0x6081F282094466C2LL, lasterrormsg) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lasterrormsg()); + } + HASH_GUARD(0x65BD6700742BF3C2LL, openblob) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 3) return (t_openblob(a0, a1, a2)); + return (t_openblob(a0, a1, a2, a3)); + } + break; + case 3: + HASH_GUARD(0x3AA4CCEC6BD68143LL, createaggregate) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 3) return (t_createaggregate(a0, a1, a2)); + return (t_createaggregate(a0, a1, a2, a3)); + } + break; + case 4: + HASH_GUARD(0x21F68C010C124BC4LL, open) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_open(a0), null); + if (count == 2) return (t_open(a0, a1), null); + return (t_open(a0, a1, a2), null); + } + break; + case 10: + HASH_GUARD(0x632B468FC2FCAB0ALL, lasterrorcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lasterrorcode()); + } + break; + case 12: + HASH_GUARD(0x4F1D1ED7B087208CLL, exec) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_exec(a0)); + } + break; + case 13: + HASH_GUARD(0x7CECF508291057CDLL, createfunction) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_createfunction(a0, a1)); + return (t_createfunction(a0, a1, a2)); + } + break; + case 25: + HASH_GUARD(0x64D2BDB189B02819LL, changes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_changes()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + case 36: + HASH_GUARD(0x1B3CDE890A487664LL, loadextension) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_loadextension(a0)); + } + break; + case 38: + HASH_GUARD(0x5024F08DB0FDCBE6LL, lastinsertrowid) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lastinsertrowid()); + } + break; + case 42: + HASH_GUARD(0x5AE41239FF63D86ALL, version) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_version()); + } + break; + case 46: + HASH_GUARD(0x156B1FAE4132ABEELL, querysingle) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_querysingle(a0)); + return (t_querysingle(a0, a1)); + } + break; + case 47: + HASH_GUARD(0x540020AE4BA591AFLL, prepare) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_prepare(a0)); + } + break; + case 51: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x607C4C73BB251635LL, escapestring) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_escapestring(a0)); + } + break; + case 55: + HASH_GUARD(0x356758D4414DA377LL, query) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_query(a0)); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_sqlite3::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_sqlite3$os_get(const char *s) { + return c_sqlite3::os_get(s, -1); +} +Variant &cw_sqlite3$os_lval(const char *s) { + return c_sqlite3::os_lval(s, -1); +} +Variant cw_sqlite3$os_constant(const char *s) { + return c_sqlite3::os_constant(s); +} +Variant cw_sqlite3$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_sqlite3::os_invoke(c, s, params, -1, fatal); +} +Object co_domattr(CArrRef params, bool init /* = true */) { + return Object(p_domattr(NEW(c_domattr)())->dynCreate(params, init)); +} +Variant c_domattr::os_get(const char *s, int64 hash) { + return c_domnode::os_get(s, hash); +} +Variant &c_domattr::os_lval(const char *s, int64 hash) { + return c_domnode::os_lval(s, hash); +} +void c_domattr::o_get(ArrayElementVec &props) const { + c_domnode::o_get(props); +} +bool c_domattr::o_exists(CStrRef s, int64 hash) const { + return c_domnode::o_exists(s, hash); +} +Variant c_domattr::o_get(CStrRef s, int64 hash) { + return c_domnode::o_get(s, hash); +} +Variant c_domattr::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domnode::o_set(s, hash, v, forInit); +} +Variant &c_domattr::o_lval(CStrRef s, int64 hash) { + return c_domnode::o_lval(s, hash); +} +Variant c_domattr::os_constant(const char *s) { + return c_domnode::os_constant(s); +} +IMPLEMENT_CLASS(domattr) +ObjectData *c_domattr::create(Variant a0, Variant a1) { + init(); + t___construct(a0, a1); + return this; +} +ObjectData *c_domattr::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_domattr::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +void c_domattr::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domattr::cloneImpl() { + c_domattr *obj = NEW(c_domattr)(); + cloneSet(obj); + return obj; +} +void c_domattr::cloneSet(c_domattr *clone) { + c_domnode::cloneSet(clone); +} +Variant c_domattr::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + HASH_GUARD(0x30A9329415D17F24LL, isid) { + return (t_isid()); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke(s, params, hash, fatal); +} +Variant c_domattr::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0, a1), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + HASH_GUARD(0x30A9329415D17F24LL, isid) { + return (t_isid()); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domattr::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domnode::os_invoke(c, s, params, hash, fatal); +} +Variant c_domattr::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0, a1), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + HASH_GUARD(0x30A9329415D17F24LL, isid) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isid()); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domattr::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domnode::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domattr$os_get(const char *s) { + return c_domattr::os_get(s, -1); +} +Variant &cw_domattr$os_lval(const char *s) { + return c_domattr::os_lval(s, -1); +} +Variant cw_domattr$os_constant(const char *s) { + return c_domattr::os_constant(s); +} +Variant cw_domattr$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domattr::os_invoke(c, s, params, -1, fatal); +} +Object co_soapvar(CArrRef params, bool init /* = true */) { + return Object(p_soapvar(NEW(c_soapvar)())->dynCreate(params, init)); +} +Variant c_soapvar::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_soapvar::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_soapvar::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_soapvar::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_soapvar::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_soapvar::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_soapvar::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_soapvar::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(soapvar) +ObjectData *c_soapvar::create(Variant a0, Variant a1, String a2, String a3, String a4, String a5) { + init(); + t___construct(a0, a1, a2, a3, a4, a5); + return this; +} +ObjectData *c_soapvar::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 2) return (create(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + } else return this; +} +void c_soapvar::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 2) (t___construct(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +void c_soapvar::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_soapvar::cloneImpl() { + c_soapvar *obj = NEW(c_soapvar)(); + cloneSet(obj); + return obj; +} +void c_soapvar::cloneSet(c_soapvar *clone) { + ObjectData::cloneSet(clone); +} +Variant c_soapvar::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 2) return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + if (count == 3) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + if (count == 4) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); + if (count == 5) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_soapvar::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 2) return (t___construct(a0, a1), null); + if (count == 3) return (t___construct(a0, a1, a2), null); + if (count == 4) return (t___construct(a0, a1, a2, a3), null); + if (count == 5) return (t___construct(a0, a1, a2, a3, a4), null); + return (t___construct(a0, a1, a2, a3, a4, a5), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_soapvar::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_soapvar::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t___construct(a0, a1), null); + if (count == 3) return (t___construct(a0, a1, a2), null); + if (count == 4) return (t___construct(a0, a1, a2, a3), null); + if (count == 5) return (t___construct(a0, a1, a2, a3, a4), null); + return (t___construct(a0, a1, a2, a3, a4, a5), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_soapvar::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_soapvar$os_get(const char *s) { + return c_soapvar::os_get(s, -1); +} +Variant &cw_soapvar$os_lval(const char *s) { + return c_soapvar::os_lval(s, -1); +} +Variant cw_soapvar$os_constant(const char *s) { + return c_soapvar::os_constant(s); +} +Variant cw_soapvar$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_soapvar::os_invoke(c, s, params, -1, fatal); +} +Object co_domnamednodemap(CArrRef params, bool init /* = true */) { + return Object(p_domnamednodemap(NEW(c_domnamednodemap)())->dynCreate(params, init)); +} +Variant c_domnamednodemap::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_domnamednodemap::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_domnamednodemap::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_domnamednodemap::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_domnamednodemap::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_domnamednodemap::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_domnamednodemap::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_domnamednodemap::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(domnamednodemap) +ObjectData *c_domnamednodemap::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_domnamednodemap::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_domnamednodemap::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_domnamednodemap::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domnamednodemap::cloneImpl() { + c_domnamednodemap *obj = NEW(c_domnamednodemap)(); + cloneSet(obj); + return obj; +} +void c_domnamednodemap::cloneSet(c_domnamednodemap *clone) { + ObjectData::cloneSet(clone); +} +Variant c_domnamednodemap::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 6: + HASH_GUARD(0x0A41DBE0830902C6LL, item) { + return (t_item(params.rvalAt(0))); + } + break; + case 10: + HASH_GUARD(0x5D3CEC627F9ADC3ALL, getnameditem) { + return (t_getnameditem(params.rvalAt(0))); + } + break; + case 11: + HASH_GUARD(0x53B4D840FF4F0F1BLL, getnameditemns) { + return (t_getnameditemns(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_domnamednodemap::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 6: + HASH_GUARD(0x0A41DBE0830902C6LL, item) { + return (t_item(a0)); + } + break; + case 10: + HASH_GUARD(0x5D3CEC627F9ADC3ALL, getnameditem) { + return (t_getnameditem(a0)); + } + break; + case 11: + HASH_GUARD(0x53B4D840FF4F0F1BLL, getnameditemns) { + return (t_getnameditemns(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domnamednodemap::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_domnamednodemap::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 6: + HASH_GUARD(0x0A41DBE0830902C6LL, item) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_item(a0)); + } + break; + case 10: + HASH_GUARD(0x5D3CEC627F9ADC3ALL, getnameditem) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnameditem(a0)); + } + break; + case 11: + HASH_GUARD(0x53B4D840FF4F0F1BLL, getnameditemns) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnameditemns(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domnamednodemap::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domnamednodemap$os_get(const char *s) { + return c_domnamednodemap::os_get(s, -1); +} +Variant &cw_domnamednodemap$os_lval(const char *s) { + return c_domnamednodemap::os_lval(s, -1); +} +Variant cw_domnamednodemap$os_constant(const char *s) { + return c_domnamednodemap::os_constant(s); +} +Variant cw_domnamednodemap$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domnamednodemap::os_invoke(c, s, params, -1, fatal); +} +Object co_sqlite3result(CArrRef params, bool init /* = true */) { + return Object(p_sqlite3result(NEW(c_sqlite3result)())->dynCreate(params, init)); +} +Variant c_sqlite3result::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_sqlite3result::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_sqlite3result::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_sqlite3result::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_sqlite3result::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_sqlite3result::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_sqlite3result::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_sqlite3result::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(sqlite3result) +ObjectData *c_sqlite3result::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_sqlite3result::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_sqlite3result::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_sqlite3result::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_sqlite3result::cloneImpl() { + c_sqlite3result *obj = NEW(c_sqlite3result)(); + cloneSet(obj); + return obj; +} +void c_sqlite3result::cloneSet(c_sqlite3result *clone) { + ObjectData::cloneSet(clone); +} +Variant c_sqlite3result::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 0: + HASH_GUARD(0x340A51AE22A924E0LL, reset) { + return (t_reset()); + } + break; + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 6: + HASH_GUARD(0x4C7702FC22784996LL, numcolumns) { + return (t_numcolumns()); + } + break; + case 8: + HASH_GUARD(0x696EFC04EE7E47F8LL, columnname) { + return (t_columnname(params.rvalAt(0))); + } + break; + case 11: + HASH_GUARD(0x59F73C4DEF1C3A6BLL, fetcharray) { + int count = params.size(); + if (count <= 0) return (t_fetcharray()); + return (t_fetcharray(params.rvalAt(0))); + } + break; + case 12: + HASH_GUARD(0x32A58B0CE493957CLL, finalize) { + return (t_finalize()); + } + break; + case 13: + HASH_GUARD(0x42EDB5CA009D8C6DLL, columntype) { + return (t_columntype(params.rvalAt(0))); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_sqlite3result::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 0: + HASH_GUARD(0x340A51AE22A924E0LL, reset) { + return (t_reset()); + } + break; + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 6: + HASH_GUARD(0x4C7702FC22784996LL, numcolumns) { + return (t_numcolumns()); + } + break; + case 8: + HASH_GUARD(0x696EFC04EE7E47F8LL, columnname) { + return (t_columnname(a0)); + } + break; + case 11: + HASH_GUARD(0x59F73C4DEF1C3A6BLL, fetcharray) { + if (count <= 0) return (t_fetcharray()); + return (t_fetcharray(a0)); + } + break; + case 12: + HASH_GUARD(0x32A58B0CE493957CLL, finalize) { + return (t_finalize()); + } + break; + case 13: + HASH_GUARD(0x42EDB5CA009D8C6DLL, columntype) { + return (t_columntype(a0)); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_sqlite3result::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_sqlite3result::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 0: + HASH_GUARD(0x340A51AE22A924E0LL, reset) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_reset()); + } + break; + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 6: + HASH_GUARD(0x4C7702FC22784996LL, numcolumns) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_numcolumns()); + } + break; + case 8: + HASH_GUARD(0x696EFC04EE7E47F8LL, columnname) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_columnname(a0)); + } + break; + case 11: + HASH_GUARD(0x59F73C4DEF1C3A6BLL, fetcharray) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_fetcharray()); + return (t_fetcharray(a0)); + } + break; + case 12: + HASH_GUARD(0x32A58B0CE493957CLL, finalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_finalize()); + } + break; + case 13: + HASH_GUARD(0x42EDB5CA009D8C6DLL, columntype) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_columntype(a0)); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_sqlite3result::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_sqlite3result$os_get(const char *s) { + return c_sqlite3result::os_get(s, -1); +} +Variant &cw_sqlite3result$os_lval(const char *s) { + return c_sqlite3result::os_lval(s, -1); +} +Variant cw_sqlite3result$os_constant(const char *s) { + return c_sqlite3result::os_constant(s); +} +Variant cw_sqlite3result$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_sqlite3result::os_invoke(c, s, params, -1, fatal); +} +Object co_simplexmlelement(CArrRef params, bool init /* = true */) { + return Object(p_simplexmlelement(NEW(c_simplexmlelement)())->dynCreate(params, init)); +} +Variant c_simplexmlelement::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_simplexmlelement::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_simplexmlelement::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_simplexmlelement::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_simplexmlelement::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_simplexmlelement::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_simplexmlelement::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_simplexmlelement::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(simplexmlelement) +ObjectData *c_simplexmlelement::create(String a0, int64 a1, bool a2, String a3, bool a4) { + init(); + t___construct(a0, a1, a2, a3, a4); + return this; +} +ObjectData *c_simplexmlelement::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 1) return (create(params.rvalAt(0))); + if (count == 2) return (create(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } else return this; +} +void c_simplexmlelement::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 1) (t___construct(params.rvalAt(0))); + if (count == 2) (t___construct(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +void c_simplexmlelement::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_simplexmlelement::cloneImpl() { + c_simplexmlelement *obj = NEW(c_simplexmlelement)(); + cloneSet(obj); + return obj; +} +void c_simplexmlelement::cloneSet(c_simplexmlelement *clone) { + ObjectData::cloneSet(clone); +} +Variant c_simplexmlelement::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 0: + HASH_GUARD(0x3E6BCFB9742FC700LL, offsetexists) { + return (t_offsetexists(params.rvalAt(0))); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x2DDE12A9866FC794LL, addchild) { + int count = params.size(); + if (count <= 1) return (t_addchild(params.rvalAt(0))); + if (count == 2) return (t_addchild(params.rvalAt(0), params.rvalAt(1))); + return (t_addchild(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 22: + HASH_GUARD(0x52F7AA6C19BEEAD6LL, addattribute) { + int count = params.size(); + if (count <= 1) return (t_addattribute(params.rvalAt(0)), null); + if (count == 2) return (t_addattribute(params.rvalAt(0), params.rvalAt(1)), null); + return (t_addattribute(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + } + break; + case 24: + HASH_GUARD(0x61D11ECEF4404498LL, offsetget) { + return (t_offsetget(params.rvalAt(0))); + } + break; + case 27: + HASH_GUARD(0x0817454F196A9A1BLL, xpath) { + return (t_xpath(params.rvalAt(0))); + } + break; + case 29: + HASH_GUARD(0x4B65E1A09A33F21DLL, attributes) { + int count = params.size(); + if (count <= 0) return (t_attributes()); + if (count == 1) return (t_attributes(params.rvalAt(0))); + return (t_attributes(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 1) return (t___construct(params.rvalAt(0)), null); + if (count == 2) return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + if (count == 3) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + if (count == 4) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); + } + break; + case 37: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 38: + HASH_GUARD(0x6D9D75B7E3B40FA6LL, getnamespaces) { + int count = params.size(); + if (count <= 0) return (t_getnamespaces()); + return (t_getnamespaces(params.rvalAt(0))); + } + HASH_GUARD(0x5C09D9345FD864A6LL, asxml) { + return (t_asxml(params.rvalAt(0))); + } + break; + case 45: + HASH_GUARD(0x2B299E949E2E82ADLL, children) { + int count = params.size(); + if (count <= 0) return (t_children()); + if (count == 1) return (t_children(params.rvalAt(0))); + return (t_children(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 49: + HASH_GUARD(0x0D08AA5F0B2F34F1LL, getdocnamespaces) { + int count = params.size(); + if (count <= 0) return (t_getdocnamespaces()); + return (t_getdocnamespaces(params.rvalAt(0))); + } + break; + case 51: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 56: + HASH_GUARD(0x0957F693A48AF738LL, offsetset) { + return (t_offsetset(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + case 58: + HASH_GUARD(0x08329980E6369ABALL, offsetunset) { + return (t_offsetunset(params.rvalAt(0)), null); + } + break; + case 61: + HASH_GUARD(0x3FE8F6937854F83DLL, registerxpathnamespace) { + return (t_registerxpathnamespace(params.rvalAt(0), params.rvalAt(1))); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_simplexmlelement::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 0: + HASH_GUARD(0x3E6BCFB9742FC700LL, offsetexists) { + return (t_offsetexists(a0)); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x2DDE12A9866FC794LL, addchild) { + if (count <= 1) return (t_addchild(a0)); + if (count == 2) return (t_addchild(a0, a1)); + return (t_addchild(a0, a1, a2)); + } + break; + case 22: + HASH_GUARD(0x52F7AA6C19BEEAD6LL, addattribute) { + if (count <= 1) return (t_addattribute(a0), null); + if (count == 2) return (t_addattribute(a0, a1), null); + return (t_addattribute(a0, a1, a2), null); + } + break; + case 24: + HASH_GUARD(0x61D11ECEF4404498LL, offsetget) { + return (t_offsetget(a0)); + } + break; + case 27: + HASH_GUARD(0x0817454F196A9A1BLL, xpath) { + return (t_xpath(a0)); + } + break; + case 29: + HASH_GUARD(0x4B65E1A09A33F21DLL, attributes) { + if (count <= 0) return (t_attributes()); + if (count == 1) return (t_attributes(a0)); + return (t_attributes(a0, a1)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 1) return (t___construct(a0), null); + if (count == 2) return (t___construct(a0, a1), null); + if (count == 3) return (t___construct(a0, a1, a2), null); + if (count == 4) return (t___construct(a0, a1, a2, a3), null); + return (t___construct(a0, a1, a2, a3, a4), null); + } + break; + case 37: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + return (t_getname()); + } + break; + case 38: + HASH_GUARD(0x6D9D75B7E3B40FA6LL, getnamespaces) { + if (count <= 0) return (t_getnamespaces()); + return (t_getnamespaces(a0)); + } + HASH_GUARD(0x5C09D9345FD864A6LL, asxml) { + return (t_asxml(a0)); + } + break; + case 45: + HASH_GUARD(0x2B299E949E2E82ADLL, children) { + if (count <= 0) return (t_children()); + if (count == 1) return (t_children(a0)); + return (t_children(a0, a1)); + } + break; + case 49: + HASH_GUARD(0x0D08AA5F0B2F34F1LL, getdocnamespaces) { + if (count <= 0) return (t_getdocnamespaces()); + return (t_getdocnamespaces(a0)); + } + break; + case 51: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 56: + HASH_GUARD(0x0957F693A48AF738LL, offsetset) { + return (t_offsetset(a0, a1), null); + } + break; + case 58: + HASH_GUARD(0x08329980E6369ABALL, offsetunset) { + return (t_offsetunset(a0), null); + } + break; + case 61: + HASH_GUARD(0x3FE8F6937854F83DLL, registerxpathnamespace) { + return (t_registerxpathnamespace(a0, a1)); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_simplexmlelement::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_simplexmlelement::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 0: + HASH_GUARD(0x3E6BCFB9742FC700LL, offsetexists) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_offsetexists(a0)); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + break; + case 20: + HASH_GUARD(0x2DDE12A9866FC794LL, addchild) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_addchild(a0)); + if (count == 2) return (t_addchild(a0, a1)); + return (t_addchild(a0, a1, a2)); + } + break; + case 22: + HASH_GUARD(0x52F7AA6C19BEEAD6LL, addattribute) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_addattribute(a0), null); + if (count == 2) return (t_addattribute(a0, a1), null); + return (t_addattribute(a0, a1, a2), null); + } + break; + case 24: + HASH_GUARD(0x61D11ECEF4404498LL, offsetget) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_offsetget(a0)); + } + break; + case 27: + HASH_GUARD(0x0817454F196A9A1BLL, xpath) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_xpath(a0)); + } + break; + case 29: + HASH_GUARD(0x4B65E1A09A33F21DLL, attributes) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_attributes()); + if (count == 1) return (t_attributes(a0)); + return (t_attributes(a0, a1)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t___construct(a0), null); + if (count == 2) return (t___construct(a0, a1), null); + if (count == 3) return (t___construct(a0, a1, a2), null); + if (count == 4) return (t___construct(a0, a1, a2, a3), null); + return (t___construct(a0, a1, a2, a3, a4), null); + } + break; + case 37: + HASH_GUARD(0x23F51CDECC198965LL, getname) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getname()); + } + break; + case 38: + HASH_GUARD(0x6D9D75B7E3B40FA6LL, getnamespaces) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_getnamespaces()); + return (t_getnamespaces(a0)); + } + HASH_GUARD(0x5C09D9345FD864A6LL, asxml) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_asxml(a0)); + } + break; + case 45: + HASH_GUARD(0x2B299E949E2E82ADLL, children) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_children()); + if (count == 1) return (t_children(a0)); + return (t_children(a0, a1)); + } + break; + case 49: + HASH_GUARD(0x0D08AA5F0B2F34F1LL, getdocnamespaces) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_getdocnamespaces()); + return (t_getdocnamespaces(a0)); + } + break; + case 51: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 56: + HASH_GUARD(0x0957F693A48AF738LL, offsetset) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_offsetset(a0, a1), null); + } + break; + case 58: + HASH_GUARD(0x08329980E6369ABALL, offsetunset) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_offsetunset(a0), null); + } + break; + case 61: + HASH_GUARD(0x3FE8F6937854F83DLL, registerxpathnamespace) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_registerxpathnamespace(a0, a1)); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_simplexmlelement::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_simplexmlelement$os_get(const char *s) { + return c_simplexmlelement::os_get(s, -1); +} +Variant &cw_simplexmlelement$os_lval(const char *s) { + return c_simplexmlelement::os_lval(s, -1); +} +Variant cw_simplexmlelement$os_constant(const char *s) { + return c_simplexmlelement::os_constant(s); +} +Variant cw_simplexmlelement$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_simplexmlelement::os_invoke(c, s, params, -1, fatal); +} +Object co_domprocessinginstruction(CArrRef params, bool init /* = true */) { + return Object(p_domprocessinginstruction(NEW(c_domprocessinginstruction)())->dynCreate(params, init)); +} +Variant c_domprocessinginstruction::os_get(const char *s, int64 hash) { + return c_domnode::os_get(s, hash); +} +Variant &c_domprocessinginstruction::os_lval(const char *s, int64 hash) { + return c_domnode::os_lval(s, hash); +} +void c_domprocessinginstruction::o_get(ArrayElementVec &props) const { + c_domnode::o_get(props); +} +bool c_domprocessinginstruction::o_exists(CStrRef s, int64 hash) const { + return c_domnode::o_exists(s, hash); +} +Variant c_domprocessinginstruction::o_get(CStrRef s, int64 hash) { + return c_domnode::o_get(s, hash); +} +Variant c_domprocessinginstruction::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domnode::o_set(s, hash, v, forInit); +} +Variant &c_domprocessinginstruction::o_lval(CStrRef s, int64 hash) { + return c_domnode::o_lval(s, hash); +} +Variant c_domprocessinginstruction::os_constant(const char *s) { + return c_domnode::os_constant(s); +} +IMPLEMENT_CLASS(domprocessinginstruction) +ObjectData *c_domprocessinginstruction::create(Variant a0, Variant a1) { + init(); + t___construct(a0, a1); + return this; +} +ObjectData *c_domprocessinginstruction::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 1) return (create(params.rvalAt(0))); + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_domprocessinginstruction::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 1) (t___construct(params.rvalAt(0))); + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +void c_domprocessinginstruction::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domprocessinginstruction::cloneImpl() { + c_domprocessinginstruction *obj = NEW(c_domprocessinginstruction)(); + cloneSet(obj); + return obj; +} +void c_domprocessinginstruction::cloneSet(c_domprocessinginstruction *clone) { + c_domnode::cloneSet(clone); +} +Variant c_domprocessinginstruction::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke(s, params, hash, fatal); +} +Variant c_domprocessinginstruction::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domprocessinginstruction::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domnode::os_invoke(c, s, params, hash, fatal); +} +Variant c_domprocessinginstruction::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domprocessinginstruction::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domnode::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domprocessinginstruction$os_get(const char *s) { + return c_domprocessinginstruction::os_get(s, -1); +} +Variant &cw_domprocessinginstruction$os_lval(const char *s) { + return c_domprocessinginstruction::os_lval(s, -1); +} +Variant cw_domprocessinginstruction$os_constant(const char *s) { + return c_domprocessinginstruction::os_constant(s); +} +Variant cw_domprocessinginstruction$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domprocessinginstruction::os_invoke(c, s, params, -1, fatal); +} +Object co_soapclient(CArrRef params, bool init /* = true */) { + return Object(p_soapclient(NEW(c_soapclient)())->dynCreate(params, init)); +} +Variant c_soapclient::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_soapclient::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_soapclient::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_soapclient::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_soapclient::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_soapclient::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_soapclient::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_soapclient::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(soapclient) +ObjectData *c_soapclient::create(Variant a0, Array a1) { + init(); + t___construct(a0, a1); + return this; +} +ObjectData *c_soapclient::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 1) return (create(params.rvalAt(0))); + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_soapclient::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 1) (t___construct(params.rvalAt(0))); + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +void c_soapclient::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_soapclient::cloneImpl() { + c_soapclient *obj = NEW(c_soapclient)(); + cloneSet(obj); + return obj; +} +void c_soapclient::cloneSet(c_soapclient *clone) { + ObjectData::cloneSet(clone); +} +Variant c_soapclient::doCall(Variant v_name, Variant v_arguments, bool fatal) { + return t___call(v_name, v_arguments); +} +Variant c_soapclient::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 4: + HASH_GUARD(0x5C5C1E24A140F6E4LL, __getlastrequest) { + return (t___getlastrequest()); + } + break; + case 12: + HASH_GUARD(0x3648EE7D3B37DE8CLL, __getlastrequestheaders) { + return (t___getlastrequestheaders()); + } + HASH_GUARD(0x5D73364F53CEEB6CLL, __call) { + return (t___call(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 17: + HASH_GUARD(0x1365B3105FC59871LL, __getfunctions) { + return (t___getfunctions()); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 20: + HASH_GUARD(0x3CA9145031035A54LL, __getlastresponse) { + return (t___getlastresponse()); + } + break; + case 21: + HASH_GUARD(0x19A26CEC7E8AAEF5LL, __dorequest) { + int count = params.size(); + if (count <= 4) return (t___dorequest(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t___dorequest(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + HASH_GUARD(0x52C6ABACCBFD0C75LL, __setcookie) { + int count = params.size(); + if (count <= 1) return (t___setcookie(params.rvalAt(0))); + return (t___setcookie(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x628D398E7604B9D5LL, __gettypes) { + return (t___gettypes()); + } + break; + case 25: + HASH_GUARD(0x4A2F89F662050D99LL, __soapcall) { + int count = params.size(); + if (count <= 2) return (t___soapcall(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t___soapcall(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t___soapcall(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t___soapcall(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), ref(const_cast(params).lvalAt(4)))); + } + break; + case 26: + HASH_GUARD(0x0C94657A58A82CFALL, __getlastresponseheaders) { + return (t___getlastresponseheaders()); + } + break; + case 27: + HASH_GUARD(0x14842228D5E335BBLL, __setsoapheaders) { + int count = params.size(); + if (count <= 0) return (t___setsoapheaders()); + return (t___setsoapheaders(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x232D13904DBC36FFLL, __setlocation) { + int count = params.size(); + if (count <= 0) return (t___setlocation()); + return (t___setlocation(params.rvalAt(0))); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_soapclient::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 4: + HASH_GUARD(0x5C5C1E24A140F6E4LL, __getlastrequest) { + return (t___getlastrequest()); + } + break; + case 12: + HASH_GUARD(0x3648EE7D3B37DE8CLL, __getlastrequestheaders) { + return (t___getlastrequestheaders()); + } + HASH_GUARD(0x5D73364F53CEEB6CLL, __call) { + return (t___call(a0, a1)); + } + break; + case 17: + HASH_GUARD(0x1365B3105FC59871LL, __getfunctions) { + return (t___getfunctions()); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 20: + HASH_GUARD(0x3CA9145031035A54LL, __getlastresponse) { + return (t___getlastresponse()); + } + break; + case 21: + HASH_GUARD(0x19A26CEC7E8AAEF5LL, __dorequest) { + if (count <= 4) return (t___dorequest(a0, a1, a2, a3)); + return (t___dorequest(a0, a1, a2, a3, a4)); + } + HASH_GUARD(0x52C6ABACCBFD0C75LL, __setcookie) { + if (count <= 1) return (t___setcookie(a0)); + return (t___setcookie(a0, a1)); + } + HASH_GUARD(0x628D398E7604B9D5LL, __gettypes) { + return (t___gettypes()); + } + break; + case 25: + HASH_GUARD(0x4A2F89F662050D99LL, __soapcall) { + if (count <= 2) return (t___soapcall(a0, a1)); + if (count == 3) return (t___soapcall(a0, a1, a2)); + if (count == 4) return (t___soapcall(a0, a1, a2, a3)); + return (t___soapcall(a0, a1, a2, a3, ref(a4))); + } + break; + case 26: + HASH_GUARD(0x0C94657A58A82CFALL, __getlastresponseheaders) { + return (t___getlastresponseheaders()); + } + break; + case 27: + HASH_GUARD(0x14842228D5E335BBLL, __setsoapheaders) { + if (count <= 0) return (t___setsoapheaders()); + return (t___setsoapheaders(a0)); + } + break; + case 31: + HASH_GUARD(0x232D13904DBC36FFLL, __setlocation) { + if (count <= 0) return (t___setlocation()); + return (t___setlocation(a0)); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_soapclient::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_soapclient::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 4: + HASH_GUARD(0x5C5C1E24A140F6E4LL, __getlastrequest) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___getlastrequest()); + } + break; + case 12: + HASH_GUARD(0x3648EE7D3B37DE8CLL, __getlastrequestheaders) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___getlastrequestheaders()); + } + HASH_GUARD(0x5D73364F53CEEB6CLL, __call) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___call(a0, a1)); + } + break; + case 17: + HASH_GUARD(0x1365B3105FC59871LL, __getfunctions) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___getfunctions()); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 20: + HASH_GUARD(0x3CA9145031035A54LL, __getlastresponse) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___getlastresponse()); + } + break; + case 21: + HASH_GUARD(0x19A26CEC7E8AAEF5LL, __dorequest) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 4) return (t___dorequest(a0, a1, a2, a3)); + return (t___dorequest(a0, a1, a2, a3, a4)); + } + HASH_GUARD(0x52C6ABACCBFD0C75LL, __setcookie) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t___setcookie(a0)); + return (t___setcookie(a0, a1)); + } + HASH_GUARD(0x628D398E7604B9D5LL, __gettypes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___gettypes()); + } + break; + case 25: + HASH_GUARD(0x4A2F89F662050D99LL, __soapcall) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t___soapcall(a0, a1)); + if (count == 3) return (t___soapcall(a0, a1, a2)); + if (count == 4) return (t___soapcall(a0, a1, a2, a3)); + return (t___soapcall(a0, a1, a2, a3, ref(a4))); + } + break; + case 26: + HASH_GUARD(0x0C94657A58A82CFALL, __getlastresponseheaders) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___getlastresponseheaders()); + } + break; + case 27: + HASH_GUARD(0x14842228D5E335BBLL, __setsoapheaders) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___setsoapheaders()); + return (t___setsoapheaders(a0)); + } + break; + case 31: + HASH_GUARD(0x232D13904DBC36FFLL, __setlocation) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___setlocation()); + return (t___setlocation(a0)); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_soapclient::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_soapclient$os_get(const char *s) { + return c_soapclient::os_get(s, -1); +} +Variant &cw_soapclient$os_lval(const char *s) { + return c_soapclient::os_lval(s, -1); +} +Variant cw_soapclient$os_constant(const char *s) { + return c_soapclient::os_constant(s); +} +Variant cw_soapclient$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_soapclient::os_invoke(c, s, params, -1, fatal); +} +Object co_soapparam(CArrRef params, bool init /* = true */) { + return Object(p_soapparam(NEW(c_soapparam)())->dynCreate(params, init)); +} +Variant c_soapparam::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_soapparam::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_soapparam::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_soapparam::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_soapparam::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_soapparam::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_soapparam::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_soapparam::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(soapparam) +ObjectData *c_soapparam::create(Variant a0, String a1) { + init(); + t___construct(a0, a1); + return this; +} +ObjectData *c_soapparam::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_soapparam::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +void c_soapparam::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_soapparam::cloneImpl() { + c_soapparam *obj = NEW(c_soapparam)(); + cloneSet(obj); + return obj; +} +void c_soapparam::cloneSet(c_soapparam *clone) { + ObjectData::cloneSet(clone); +} +Variant c_soapparam::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_soapparam::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_soapparam::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_soapparam::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_soapparam::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_soapparam$os_get(const char *s) { + return c_soapparam::os_get(s, -1); +} +Variant &cw_soapparam$os_lval(const char *s) { + return c_soapparam::os_lval(s, -1); +} +Variant cw_soapparam$os_constant(const char *s) { + return c_soapparam::os_constant(s); +} +Variant cw_soapparam$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_soapparam::os_invoke(c, s, params, -1, fatal); +} +Object co_datetime(CArrRef params, bool init /* = true */) { + return Object(p_datetime(NEW(c_datetime)())->dynCreate(params, init)); +} +Variant c_datetime::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_datetime::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_datetime::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_datetime::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_datetime::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_datetime::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_datetime::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_datetime::os_constant(const char *s) { + int64 hash = hash_string(s); + switch (hash & 31) { + case 4: + HASH_RETURN(0x65F665B8975D4C44LL, q_datetime_RSS, RSS); + break; + case 5: + HASH_RETURN(0x4C70260A54584B05LL, q_datetime_ATOM, ATOM); + break; + case 6: + HASH_RETURN(0x68B7C078B5B92826LL, q_datetime_RFC1123, RFC1123); + break; + case 8: + HASH_RETURN(0x53F6E373F1EBB708LL, q_datetime_RFC822, RFC822); + break; + case 12: + HASH_RETURN(0x2183317DB64F7D2CLL, q_datetime_COOKIE, COOKIE); + break; + case 16: + HASH_RETURN(0x5B0E14CE27A57F90LL, q_datetime_RFC3339, RFC3339); + HASH_RETURN(0x5D2FBC8B1577ACB0LL, q_datetime_W3C, W3C); + break; + case 17: + HASH_RETURN(0x66C93EBB188AAF11LL, q_datetime_RFC1036, RFC1036); + break; + case 18: + HASH_RETURN(0x1AE03F7E0EC93DD2LL, q_datetime_RFC850, RFC850); + break; + case 27: + HASH_RETURN(0x6D8D5D3FBA38037BLL, q_datetime_ISO8601, ISO8601); + break; + case 31: + HASH_RETURN(0x2C528E9FD5EDAE9FLL, q_datetime_RFC2822, RFC2822); + break; + default: + break; + } + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(datetime) +ObjectData *c_datetime::create(String a0, Object a1) { + init(); + t___construct(a0, a1); + return this; +} +ObjectData *c_datetime::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 0) return (create()); + if (count == 1) return (create(params.rvalAt(0))); + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_datetime::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 0) (t___construct()); + if (count == 1) (t___construct(params.rvalAt(0))); + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +void c_datetime::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_datetime::cloneImpl() { + c_datetime *obj = NEW(c_datetime)(); + cloneSet(obj); + return obj; +} +void c_datetime::cloneSet(c_datetime *clone) { + ObjectData::cloneSet(clone); +} +Variant c_datetime::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 7: + HASH_GUARD(0x65A9B2950F080587LL, modify) { + return (t_modify(params.rvalAt(0))); + } + break; + case 11: + HASH_GUARD(0x67314943DC9D120BLL, setdate) { + return (t_setdate(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + HASH_GUARD(0x68DB66F60B55BD0BLL, getoffset) { + return (t_getoffset()); + } + break; + case 12: + HASH_GUARD(0x688601F33BE7716CLL, gettimezone) { + return (t_gettimezone()); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 20: + HASH_GUARD(0x16D6DBFD6EE55A74LL, setisodate) { + int count = params.size(); + if (count <= 2) return (t_setisodate(params.rvalAt(0), params.rvalAt(1))); + return (t_setisodate(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 24: + HASH_GUARD(0x07CB96AB34F4C258LL, settime) { + int count = params.size(); + if (count <= 2) return (t_settime(params.rvalAt(0), params.rvalAt(1))); + return (t_settime(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + HASH_GUARD(0x3B576E558B957CB8LL, settimezone) { + return (t_settimezone(params.rvalAt(0))); + } + break; + case 27: + HASH_GUARD(0x1B6DDAF6AAF8CA9BLL, format) { + return (t_format(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_datetime::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 7: + HASH_GUARD(0x65A9B2950F080587LL, modify) { + return (t_modify(a0)); + } + break; + case 11: + HASH_GUARD(0x67314943DC9D120BLL, setdate) { + return (t_setdate(a0, a1, a2)); + } + HASH_GUARD(0x68DB66F60B55BD0BLL, getoffset) { + return (t_getoffset()); + } + break; + case 12: + HASH_GUARD(0x688601F33BE7716CLL, gettimezone) { + return (t_gettimezone()); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 20: + HASH_GUARD(0x16D6DBFD6EE55A74LL, setisodate) { + if (count <= 2) return (t_setisodate(a0, a1)); + return (t_setisodate(a0, a1, a2)); + } + break; + case 24: + HASH_GUARD(0x07CB96AB34F4C258LL, settime) { + if (count <= 2) return (t_settime(a0, a1)); + return (t_settime(a0, a1, a2)); + } + HASH_GUARD(0x3B576E558B957CB8LL, settimezone) { + return (t_settimezone(a0)); + } + break; + case 27: + HASH_GUARD(0x1B6DDAF6AAF8CA9BLL, format) { + return (t_format(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_datetime::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_datetime::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 7: + HASH_GUARD(0x65A9B2950F080587LL, modify) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_modify(a0)); + } + break; + case 11: + HASH_GUARD(0x67314943DC9D120BLL, setdate) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setdate(a0, a1, a2)); + } + HASH_GUARD(0x68DB66F60B55BD0BLL, getoffset) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getoffset()); + } + break; + case 12: + HASH_GUARD(0x688601F33BE7716CLL, gettimezone) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettimezone()); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 20: + HASH_GUARD(0x16D6DBFD6EE55A74LL, setisodate) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_setisodate(a0, a1)); + return (t_setisodate(a0, a1, a2)); + } + break; + case 24: + HASH_GUARD(0x07CB96AB34F4C258LL, settime) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_settime(a0, a1)); + return (t_settime(a0, a1, a2)); + } + HASH_GUARD(0x3B576E558B957CB8LL, settimezone) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_settimezone(a0)); + } + break; + case 27: + HASH_GUARD(0x1B6DDAF6AAF8CA9BLL, format) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_format(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t___construct(), null); + if (count == 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_datetime::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_datetime$os_get(const char *s) { + return c_datetime::os_get(s, -1); +} +Variant &cw_datetime$os_lval(const char *s) { + return c_datetime::os_lval(s, -1); +} +Variant cw_datetime$os_constant(const char *s) { + return c_datetime::os_constant(s); +} +Variant cw_datetime$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_datetime::os_invoke(c, s, params, -1, fatal); +} +Object co_domentity(CArrRef params, bool init /* = true */) { + return Object(p_domentity(NEW(c_domentity)())->dynCreate(params, init)); +} +Variant c_domentity::os_get(const char *s, int64 hash) { + return c_domnode::os_get(s, hash); +} +Variant &c_domentity::os_lval(const char *s, int64 hash) { + return c_domnode::os_lval(s, hash); +} +void c_domentity::o_get(ArrayElementVec &props) const { + c_domnode::o_get(props); +} +bool c_domentity::o_exists(CStrRef s, int64 hash) const { + return c_domnode::o_exists(s, hash); +} +Variant c_domentity::o_get(CStrRef s, int64 hash) { + return c_domnode::o_get(s, hash); +} +Variant c_domentity::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domnode::o_set(s, hash, v, forInit); +} +Variant &c_domentity::o_lval(CStrRef s, int64 hash) { + return c_domnode::o_lval(s, hash); +} +Variant c_domentity::os_constant(const char *s) { + return c_domnode::os_constant(s); +} +IMPLEMENT_CLASS(domentity) +ObjectData *c_domentity::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_domentity::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_domentity::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_domentity::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domentity::cloneImpl() { + c_domentity *obj = NEW(c_domentity)(); + cloneSet(obj); + return obj; +} +void c_domentity::cloneSet(c_domentity *clone) { + c_domnode::cloneSet(clone); +} +Variant c_domentity::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke(s, params, hash, fatal); +} +Variant c_domentity::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domentity::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domnode::os_invoke(c, s, params, hash, fatal); +} +Variant c_domentity::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_domnode::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domentity::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domnode::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domentity$os_get(const char *s) { + return c_domentity::os_get(s, -1); +} +Variant &cw_domentity$os_lval(const char *s) { + return c_domentity::os_lval(s, -1); +} +Variant cw_domentity$os_constant(const char *s) { + return c_domentity::os_constant(s); +} +Variant cw_domentity$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domentity::os_invoke(c, s, params, -1, fatal); +} +Object co_xmlwriter(CArrRef params, bool init /* = true */) { + return Object(p_xmlwriter(NEW(c_xmlwriter)())->dynCreate(params, init)); +} +Variant c_xmlwriter::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_xmlwriter::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_xmlwriter::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_xmlwriter::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_xmlwriter::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_xmlwriter::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_xmlwriter::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_xmlwriter::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(xmlwriter) +ObjectData *c_xmlwriter::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_xmlwriter::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_xmlwriter::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_xmlwriter::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_xmlwriter::cloneImpl() { + c_xmlwriter *obj = NEW(c_xmlwriter)(); + cloneSet(obj); + return obj; +} +void c_xmlwriter::cloneSet(c_xmlwriter *clone) { + ObjectData::cloneSet(clone); +} +Variant c_xmlwriter::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 2: + HASH_GUARD(0x1EBCBEA66B6B0982LL, writecdata) { + return (t_writecdata(params.rvalAt(0))); + } + break; + case 3: + HASH_GUARD(0x55E29E84E96ACF83LL, startdtd) { + int count = params.size(); + if (count <= 1) return (t_startdtd(params.rvalAt(0))); + if (count == 2) return (t_startdtd(params.rvalAt(0), params.rvalAt(1))); + return (t_startdtd(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 8: + HASH_GUARD(0x7C1FF8A79BAB3608LL, writedtd) { + int count = params.size(); + if (count <= 1) return (t_writedtd(params.rvalAt(0))); + if (count == 2) return (t_writedtd(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_writedtd(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_writedtd(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x119CC9E7C3E7EF0ELL, openmemory) { + return (t_openmemory()); + } + break; + case 16: + HASH_GUARD(0x0A7FE14C41766610LL, endcdata) { + return (t_endcdata()); + } + break; + case 19: + HASH_GUARD(0x75F8C992981A4093LL, writecomment) { + return (t_writecomment(params.rvalAt(0))); + } + HASH_GUARD(0x5A7AE5A26994FF13LL, startattribute) { + return (t_startattribute(params.rvalAt(0))); + } + break; + case 28: + HASH_GUARD(0x337EFFF3783B919CLL, writeelement) { + int count = params.size(); + if (count <= 1) return (t_writeelement(params.rvalAt(0))); + return (t_writeelement(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 29: + HASH_GUARD(0x4D26D167066BB11DLL, text) { + return (t_text(params.rvalAt(0))); + } + break; + case 32: + HASH_GUARD(0x7DF0368A44C01B20LL, startcdata) { + return (t_startcdata()); + } + break; + case 33: + HASH_GUARD(0x5D49A460168D5C21LL, endpi) { + return (t_endpi()); + } + break; + case 41: + HASH_GUARD(0x1D81ABDC9890C5A9LL, writedtdattlist) { + return (t_writedtdattlist(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 43: + HASH_GUARD(0x0DEAF425F1AD73ABLL, setindentstring) { + return (t_setindentstring(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x78A7A5D96EF2F4AFLL, endelement) { + return (t_endelement()); + } + break; + case 53: + HASH_GUARD(0x75B357D89DDE6EB5LL, endcomment) { + return (t_endcomment()); + } + break; + case 55: + HASH_GUARD(0x4B0F1F6361A59C37LL, writeraw) { + return (t_writeraw(params.rvalAt(0))); + } + break; + case 56: + HASH_GUARD(0x7FC89CF1AFFB1E38LL, startdocument) { + int count = params.size(); + if (count <= 0) return (t_startdocument()); + if (count == 1) return (t_startdocument(params.rvalAt(0))); + if (count == 2) return (t_startdocument(params.rvalAt(0), params.rvalAt(1))); + return (t_startdocument(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 58: + HASH_GUARD(0x0D155D1E5C6641BALL, outputmemory) { + int count = params.size(); + if (count <= 0) return (t_outputmemory()); + return (t_outputmemory(params.rvalAt(0))); + } + break; + case 62: + HASH_GUARD(0x1FBE635680ADB7BELL, openuri) { + return (t_openuri(params.rvalAt(0))); + } + break; + case 68: + HASH_GUARD(0x275896BFD7A77144LL, enddtd) { + return (t_enddtd()); + } + break; + case 70: + HASH_GUARD(0x5D4650E5C0DAEE46LL, writedtdentity) { + int count = params.size(); + if (count <= 2) return (t_writedtdentity(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_writedtdentity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_writedtdentity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (t_writedtdentity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (t_writedtdentity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + } + break; + case 71: + HASH_GUARD(0x017687FD7029CCC7LL, enddtdelement) { + return (t_enddtdelement()); + } + break; + case 75: + HASH_GUARD(0x3954A2C0306CCCCBLL, writeattribute) { + return (t_writeattribute(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7C43ECE80FF886CBLL, endattribute) { + return (t_endattribute()); + } + break; + case 77: + HASH_GUARD(0x4F1D890D5B36D24DLL, startattributens) { + return (t_startattributens(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 82: + HASH_GUARD(0x1357CA1E92397452LL, writedtdelement) { + return (t_writedtdelement(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 84: + HASH_GUARD(0x154AE94AEFAC7C54LL, writeattributens) { + return (t_writeattributens(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 86: + HASH_GUARD(0x4520735705A382D6LL, enddtdentity) { + return (t_enddtdentity()); + } + HASH_GUARD(0x37D51A94C6EE8F56LL, writepi) { + return (t_writepi(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 88: + HASH_GUARD(0x24A376E9310BF058LL, writeelementns) { + int count = params.size(); + if (count <= 3) return (t_writeelementns(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_writeelementns(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 89: + HASH_GUARD(0x390B6C01AE7C4159LL, startpi) { + return (t_startpi(params.rvalAt(0))); + } + break; + case 92: + HASH_GUARD(0x0DC5AC1E0A2F63DCLL, enddocument) { + return (t_enddocument()); + } + break; + case 93: + HASH_GUARD(0x75A033B824EA1ADDLL, startdtdentity) { + return (t_startdtdentity(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 98: + HASH_GUARD(0x55BFFBE5717EFD62LL, startelement) { + return (t_startelement(params.rvalAt(0))); + } + break; + case 101: + HASH_GUARD(0x349B7446B5EE65E5LL, setindent) { + return (t_setindent(params.rvalAt(0))); + } + break; + case 105: + HASH_GUARD(0x608A2D39DE12E169LL, startelementns) { + return (t_startelementns(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 112: + HASH_GUARD(0x0CBB10FA542B7D70LL, startdtdattlist) { + return (t_startdtdattlist(params.rvalAt(0))); + } + break; + case 113: + HASH_GUARD(0x496175DBD52E1771LL, enddtdattlist) { + return (t_enddtdattlist()); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 120: + HASH_GUARD(0x451436438EBA2AF8LL, startdtdelement) { + return (t_startdtdelement(params.rvalAt(0))); + } + break; + case 122: + HASH_GUARD(0x6A3D9F8EDB005E7ALL, flush) { + int count = params.size(); + if (count <= 0) return (t_flush()); + return (t_flush(params.rvalAt(0))); + } + break; + case 126: + HASH_GUARD(0x3174CCE00BFB9FFELL, fullendelement) { + return (t_fullendelement()); + } + break; + case 127: + HASH_GUARD(0x6A8CC27A7F0466FFLL, startcomment) { + return (t_startcomment()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_xmlwriter::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 2: + HASH_GUARD(0x1EBCBEA66B6B0982LL, writecdata) { + return (t_writecdata(a0)); + } + break; + case 3: + HASH_GUARD(0x55E29E84E96ACF83LL, startdtd) { + if (count <= 1) return (t_startdtd(a0)); + if (count == 2) return (t_startdtd(a0, a1)); + return (t_startdtd(a0, a1, a2)); + } + break; + case 8: + HASH_GUARD(0x7C1FF8A79BAB3608LL, writedtd) { + if (count <= 1) return (t_writedtd(a0)); + if (count == 2) return (t_writedtd(a0, a1)); + if (count == 3) return (t_writedtd(a0, a1, a2)); + return (t_writedtd(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x119CC9E7C3E7EF0ELL, openmemory) { + return (t_openmemory()); + } + break; + case 16: + HASH_GUARD(0x0A7FE14C41766610LL, endcdata) { + return (t_endcdata()); + } + break; + case 19: + HASH_GUARD(0x75F8C992981A4093LL, writecomment) { + return (t_writecomment(a0)); + } + HASH_GUARD(0x5A7AE5A26994FF13LL, startattribute) { + return (t_startattribute(a0)); + } + break; + case 28: + HASH_GUARD(0x337EFFF3783B919CLL, writeelement) { + if (count <= 1) return (t_writeelement(a0)); + return (t_writeelement(a0, a1)); + } + break; + case 29: + HASH_GUARD(0x4D26D167066BB11DLL, text) { + return (t_text(a0)); + } + break; + case 32: + HASH_GUARD(0x7DF0368A44C01B20LL, startcdata) { + return (t_startcdata()); + } + break; + case 33: + HASH_GUARD(0x5D49A460168D5C21LL, endpi) { + return (t_endpi()); + } + break; + case 41: + HASH_GUARD(0x1D81ABDC9890C5A9LL, writedtdattlist) { + return (t_writedtdattlist(a0, a1)); + } + break; + case 43: + HASH_GUARD(0x0DEAF425F1AD73ABLL, setindentstring) { + return (t_setindentstring(a0)); + } + break; + case 47: + HASH_GUARD(0x78A7A5D96EF2F4AFLL, endelement) { + return (t_endelement()); + } + break; + case 53: + HASH_GUARD(0x75B357D89DDE6EB5LL, endcomment) { + return (t_endcomment()); + } + break; + case 55: + HASH_GUARD(0x4B0F1F6361A59C37LL, writeraw) { + return (t_writeraw(a0)); + } + break; + case 56: + HASH_GUARD(0x7FC89CF1AFFB1E38LL, startdocument) { + if (count <= 0) return (t_startdocument()); + if (count == 1) return (t_startdocument(a0)); + if (count == 2) return (t_startdocument(a0, a1)); + return (t_startdocument(a0, a1, a2)); + } + break; + case 58: + HASH_GUARD(0x0D155D1E5C6641BALL, outputmemory) { + if (count <= 0) return (t_outputmemory()); + return (t_outputmemory(a0)); + } + break; + case 62: + HASH_GUARD(0x1FBE635680ADB7BELL, openuri) { + return (t_openuri(a0)); + } + break; + case 68: + HASH_GUARD(0x275896BFD7A77144LL, enddtd) { + return (t_enddtd()); + } + break; + case 70: + HASH_GUARD(0x5D4650E5C0DAEE46LL, writedtdentity) { + if (count <= 2) return (t_writedtdentity(a0, a1)); + if (count == 3) return (t_writedtdentity(a0, a1, a2)); + if (count == 4) return (t_writedtdentity(a0, a1, a2, a3)); + if (count == 5) return (t_writedtdentity(a0, a1, a2, a3, a4)); + return (t_writedtdentity(a0, a1, a2, a3, a4, a5)); + } + break; + case 71: + HASH_GUARD(0x017687FD7029CCC7LL, enddtdelement) { + return (t_enddtdelement()); + } + break; + case 75: + HASH_GUARD(0x3954A2C0306CCCCBLL, writeattribute) { + return (t_writeattribute(a0, a1)); + } + HASH_GUARD(0x7C43ECE80FF886CBLL, endattribute) { + return (t_endattribute()); + } + break; + case 77: + HASH_GUARD(0x4F1D890D5B36D24DLL, startattributens) { + return (t_startattributens(a0, a1, a2)); + } + break; + case 82: + HASH_GUARD(0x1357CA1E92397452LL, writedtdelement) { + return (t_writedtdelement(a0, a1)); + } + break; + case 84: + HASH_GUARD(0x154AE94AEFAC7C54LL, writeattributens) { + return (t_writeattributens(a0, a1, a2, a3)); + } + break; + case 86: + HASH_GUARD(0x4520735705A382D6LL, enddtdentity) { + return (t_enddtdentity()); + } + HASH_GUARD(0x37D51A94C6EE8F56LL, writepi) { + return (t_writepi(a0, a1)); + } + break; + case 88: + HASH_GUARD(0x24A376E9310BF058LL, writeelementns) { + if (count <= 3) return (t_writeelementns(a0, a1, a2)); + return (t_writeelementns(a0, a1, a2, a3)); + } + break; + case 89: + HASH_GUARD(0x390B6C01AE7C4159LL, startpi) { + return (t_startpi(a0)); + } + break; + case 92: + HASH_GUARD(0x0DC5AC1E0A2F63DCLL, enddocument) { + return (t_enddocument()); + } + break; + case 93: + HASH_GUARD(0x75A033B824EA1ADDLL, startdtdentity) { + return (t_startdtdentity(a0, a1)); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 98: + HASH_GUARD(0x55BFFBE5717EFD62LL, startelement) { + return (t_startelement(a0)); + } + break; + case 101: + HASH_GUARD(0x349B7446B5EE65E5LL, setindent) { + return (t_setindent(a0)); + } + break; + case 105: + HASH_GUARD(0x608A2D39DE12E169LL, startelementns) { + return (t_startelementns(a0, a1, a2)); + } + break; + case 112: + HASH_GUARD(0x0CBB10FA542B7D70LL, startdtdattlist) { + return (t_startdtdattlist(a0)); + } + break; + case 113: + HASH_GUARD(0x496175DBD52E1771LL, enddtdattlist) { + return (t_enddtdattlist()); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 120: + HASH_GUARD(0x451436438EBA2AF8LL, startdtdelement) { + return (t_startdtdelement(a0)); + } + break; + case 122: + HASH_GUARD(0x6A3D9F8EDB005E7ALL, flush) { + if (count <= 0) return (t_flush()); + return (t_flush(a0)); + } + break; + case 126: + HASH_GUARD(0x3174CCE00BFB9FFELL, fullendelement) { + return (t_fullendelement()); + } + break; + case 127: + HASH_GUARD(0x6A8CC27A7F0466FFLL, startcomment) { + return (t_startcomment()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_xmlwriter::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_xmlwriter::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 2: + HASH_GUARD(0x1EBCBEA66B6B0982LL, writecdata) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_writecdata(a0)); + } + break; + case 3: + HASH_GUARD(0x55E29E84E96ACF83LL, startdtd) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_startdtd(a0)); + if (count == 2) return (t_startdtd(a0, a1)); + return (t_startdtd(a0, a1, a2)); + } + break; + case 8: + HASH_GUARD(0x7C1FF8A79BAB3608LL, writedtd) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_writedtd(a0)); + if (count == 2) return (t_writedtd(a0, a1)); + if (count == 3) return (t_writedtd(a0, a1, a2)); + return (t_writedtd(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x119CC9E7C3E7EF0ELL, openmemory) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_openmemory()); + } + break; + case 16: + HASH_GUARD(0x0A7FE14C41766610LL, endcdata) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_endcdata()); + } + break; + case 19: + HASH_GUARD(0x75F8C992981A4093LL, writecomment) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_writecomment(a0)); + } + HASH_GUARD(0x5A7AE5A26994FF13LL, startattribute) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_startattribute(a0)); + } + break; + case 28: + HASH_GUARD(0x337EFFF3783B919CLL, writeelement) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_writeelement(a0)); + return (t_writeelement(a0, a1)); + } + break; + case 29: + HASH_GUARD(0x4D26D167066BB11DLL, text) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_text(a0)); + } + break; + case 32: + HASH_GUARD(0x7DF0368A44C01B20LL, startcdata) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_startcdata()); + } + break; + case 33: + HASH_GUARD(0x5D49A460168D5C21LL, endpi) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_endpi()); + } + break; + case 41: + HASH_GUARD(0x1D81ABDC9890C5A9LL, writedtdattlist) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_writedtdattlist(a0, a1)); + } + break; + case 43: + HASH_GUARD(0x0DEAF425F1AD73ABLL, setindentstring) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setindentstring(a0)); + } + break; + case 47: + HASH_GUARD(0x78A7A5D96EF2F4AFLL, endelement) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_endelement()); + } + break; + case 53: + HASH_GUARD(0x75B357D89DDE6EB5LL, endcomment) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_endcomment()); + } + break; + case 55: + HASH_GUARD(0x4B0F1F6361A59C37LL, writeraw) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_writeraw(a0)); + } + break; + case 56: + HASH_GUARD(0x7FC89CF1AFFB1E38LL, startdocument) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_startdocument()); + if (count == 1) return (t_startdocument(a0)); + if (count == 2) return (t_startdocument(a0, a1)); + return (t_startdocument(a0, a1, a2)); + } + break; + case 58: + HASH_GUARD(0x0D155D1E5C6641BALL, outputmemory) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_outputmemory()); + return (t_outputmemory(a0)); + } + break; + case 62: + HASH_GUARD(0x1FBE635680ADB7BELL, openuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_openuri(a0)); + } + break; + case 68: + HASH_GUARD(0x275896BFD7A77144LL, enddtd) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_enddtd()); + } + break; + case 70: + HASH_GUARD(0x5D4650E5C0DAEE46LL, writedtdentity) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_writedtdentity(a0, a1)); + if (count == 3) return (t_writedtdentity(a0, a1, a2)); + if (count == 4) return (t_writedtdentity(a0, a1, a2, a3)); + if (count == 5) return (t_writedtdentity(a0, a1, a2, a3, a4)); + return (t_writedtdentity(a0, a1, a2, a3, a4, a5)); + } + break; + case 71: + HASH_GUARD(0x017687FD7029CCC7LL, enddtdelement) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_enddtdelement()); + } + break; + case 75: + HASH_GUARD(0x3954A2C0306CCCCBLL, writeattribute) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_writeattribute(a0, a1)); + } + HASH_GUARD(0x7C43ECE80FF886CBLL, endattribute) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_endattribute()); + } + break; + case 77: + HASH_GUARD(0x4F1D890D5B36D24DLL, startattributens) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_startattributens(a0, a1, a2)); + } + break; + case 82: + HASH_GUARD(0x1357CA1E92397452LL, writedtdelement) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_writedtdelement(a0, a1)); + } + break; + case 84: + HASH_GUARD(0x154AE94AEFAC7C54LL, writeattributens) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_writeattributens(a0, a1, a2, a3)); + } + break; + case 86: + HASH_GUARD(0x4520735705A382D6LL, enddtdentity) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_enddtdentity()); + } + HASH_GUARD(0x37D51A94C6EE8F56LL, writepi) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_writepi(a0, a1)); + } + break; + case 88: + HASH_GUARD(0x24A376E9310BF058LL, writeelementns) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 3) return (t_writeelementns(a0, a1, a2)); + return (t_writeelementns(a0, a1, a2, a3)); + } + break; + case 89: + HASH_GUARD(0x390B6C01AE7C4159LL, startpi) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_startpi(a0)); + } + break; + case 92: + HASH_GUARD(0x0DC5AC1E0A2F63DCLL, enddocument) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_enddocument()); + } + break; + case 93: + HASH_GUARD(0x75A033B824EA1ADDLL, startdtdentity) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_startdtdentity(a0, a1)); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + case 98: + HASH_GUARD(0x55BFFBE5717EFD62LL, startelement) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_startelement(a0)); + } + break; + case 101: + HASH_GUARD(0x349B7446B5EE65E5LL, setindent) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setindent(a0)); + } + break; + case 105: + HASH_GUARD(0x608A2D39DE12E169LL, startelementns) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_startelementns(a0, a1, a2)); + } + break; + case 112: + HASH_GUARD(0x0CBB10FA542B7D70LL, startdtdattlist) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_startdtdattlist(a0)); + } + break; + case 113: + HASH_GUARD(0x496175DBD52E1771LL, enddtdattlist) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_enddtdattlist()); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 120: + HASH_GUARD(0x451436438EBA2AF8LL, startdtdelement) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_startdtdelement(a0)); + } + break; + case 122: + HASH_GUARD(0x6A3D9F8EDB005E7ALL, flush) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_flush()); + return (t_flush(a0)); + } + break; + case 126: + HASH_GUARD(0x3174CCE00BFB9FFELL, fullendelement) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_fullendelement()); + } + break; + case 127: + HASH_GUARD(0x6A8CC27A7F0466FFLL, startcomment) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_startcomment()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_xmlwriter::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_xmlwriter$os_get(const char *s) { + return c_xmlwriter::os_get(s, -1); +} +Variant &cw_xmlwriter$os_lval(const char *s) { + return c_xmlwriter::os_lval(s, -1); +} +Variant cw_xmlwriter$os_constant(const char *s) { + return c_xmlwriter::os_constant(s); +} +Variant cw_xmlwriter$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_xmlwriter::os_invoke(c, s, params, -1, fatal); +} +Object co_domexception(CArrRef params, bool init /* = true */) { + return Object(p_domexception(NEW(c_domexception)())->dynCreate(params, init)); +} +Variant c_domexception::os_get(const char *s, int64 hash) { + return c_exception::os_get(s, hash); +} +Variant &c_domexception::os_lval(const char *s, int64 hash) { + return c_exception::os_lval(s, hash); +} +void c_domexception::o_get(ArrayElementVec &props) const { + c_exception::o_get(props); +} +bool c_domexception::o_exists(CStrRef s, int64 hash) const { + return c_exception::o_exists(s, hash); +} +Variant c_domexception::o_get(CStrRef s, int64 hash) { + return c_exception::o_get(s, hash); +} +Variant c_domexception::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_exception::o_set(s, hash, v, forInit); +} +Variant &c_domexception::o_lval(CStrRef s, int64 hash) { + return c_exception::o_lval(s, hash); +} +Variant c_domexception::os_constant(const char *s) { + return c_exception::os_constant(s); +} +IMPLEMENT_CLASS(domexception) +ObjectData *c_domexception::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_domexception::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_domexception::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_domexception::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domexception::cloneImpl() { + c_domexception *obj = NEW(c_domexception)(); + cloneSet(obj); + return obj; +} +void c_domexception::cloneSet(c_domexception *clone) { + c_exception::cloneSet(clone); +} +Variant c_domexception::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + break; + case 15: + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + case 18: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 26: + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 30: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_exception::o_invoke(s, params, hash, fatal); +} +Variant c_domexception::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + break; + case 15: + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + case 18: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 26: + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 30: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_exception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domexception::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_exception::os_invoke(c, s, params, hash, fatal); +} +Variant c_domexception::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + break; + case 15: + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + case 18: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 26: + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 30: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + default: + break; + } + return c_exception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domexception::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_exception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domexception$os_get(const char *s) { + return c_domexception::os_get(s, -1); +} +Variant &cw_domexception$os_lval(const char *s) { + return c_domexception::os_lval(s, -1); +} +Variant cw_domexception$os_constant(const char *s) { + return c_domexception::os_constant(s); +} +Variant cw_domexception$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domexception::os_invoke(c, s, params, -1, fatal); +} +Object co_domxpath(CArrRef params, bool init /* = true */) { + return Object(p_domxpath(NEW(c_domxpath)())->dynCreate(params, init)); +} +Variant c_domxpath::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_domxpath::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_domxpath::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_domxpath::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_domxpath::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_domxpath::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_domxpath::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_domxpath::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(domxpath) +ObjectData *c_domxpath::create(Variant a0) { + init(); + t___construct(a0); + return this; +} +ObjectData *c_domxpath::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0))); + } else return this; +} +void c_domxpath::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0))); +} +void c_domxpath::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domxpath::cloneImpl() { + c_domxpath *obj = NEW(c_domxpath)(); + cloneSet(obj); + return obj; +} +void c_domxpath::cloneSet(c_domxpath *clone) { + ObjectData::cloneSet(clone); +} +Variant c_domxpath::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x144FADF6B374AB82LL, registerphpfunctions) { + int count = params.size(); + if (count <= 0) return (t_registerphpfunctions()); + return (t_registerphpfunctions(params.rvalAt(0))); + } + break; + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 7: + HASH_GUARD(0x356758D4414DA377LL, query) { + int count = params.size(); + if (count <= 1) return (t_query(params.rvalAt(0))); + return (t_query(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 8: + HASH_GUARD(0x47ACFB6D8681B0E8LL, registernamespace) { + return (t_registernamespace(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0)), null); + } + HASH_GUARD(0x2443593B6F3C912FLL, evaluate) { + int count = params.size(); + if (count <= 1) return (t_evaluate(params.rvalAt(0))); + return (t_evaluate(params.rvalAt(0), params.rvalAt(1))); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_domxpath::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x144FADF6B374AB82LL, registerphpfunctions) { + if (count <= 0) return (t_registerphpfunctions()); + return (t_registerphpfunctions(a0)); + } + break; + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 7: + HASH_GUARD(0x356758D4414DA377LL, query) { + if (count <= 1) return (t_query(a0)); + return (t_query(a0, a1)); + } + break; + case 8: + HASH_GUARD(0x47ACFB6D8681B0E8LL, registernamespace) { + return (t_registernamespace(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0), null); + } + HASH_GUARD(0x2443593B6F3C912FLL, evaluate) { + if (count <= 1) return (t_evaluate(a0)); + return (t_evaluate(a0, a1)); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domxpath::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_domxpath::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 15) { + case 2: + HASH_GUARD(0x144FADF6B374AB82LL, registerphpfunctions) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_registerphpfunctions()); + return (t_registerphpfunctions(a0)); + } + break; + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 7: + HASH_GUARD(0x356758D4414DA377LL, query) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_query(a0)); + return (t_query(a0, a1)); + } + break; + case 8: + HASH_GUARD(0x47ACFB6D8681B0E8LL, registernamespace) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_registernamespace(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0), null); + } + HASH_GUARD(0x2443593B6F3C912FLL, evaluate) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_evaluate(a0)); + return (t_evaluate(a0, a1)); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domxpath::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domxpath$os_get(const char *s) { + return c_domxpath::os_get(s, -1); +} +Variant &cw_domxpath$os_lval(const char *s) { + return c_domxpath::os_lval(s, -1); +} +Variant cw_domxpath$os_constant(const char *s) { + return c_domxpath::os_constant(s); +} +Variant cw_domxpath$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domxpath::os_invoke(c, s, params, -1, fatal); +} +Object co_soapserver(CArrRef params, bool init /* = true */) { + return Object(p_soapserver(NEW(c_soapserver)())->dynCreate(params, init)); +} +Variant c_soapserver::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_soapserver::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_soapserver::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_soapserver::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_soapserver::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_soapserver::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_soapserver::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_soapserver::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(soapserver) +ObjectData *c_soapserver::create(Variant a0, Array a1) { + init(); + t___construct(a0, a1); + return this; +} +ObjectData *c_soapserver::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 1) return (create(params.rvalAt(0))); + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_soapserver::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 1) (t___construct(params.rvalAt(0))); + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +void c_soapserver::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_soapserver::cloneImpl() { + c_soapserver *obj = NEW(c_soapserver)(); + cloneSet(obj); + return obj; +} +void c_soapserver::cloneSet(c_soapserver *clone) { + ObjectData::cloneSet(clone); +} +Variant c_soapserver::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x758A4E04590FE203LL, fault) { + int count = params.size(); + if (count <= 2) return (t_fault(params.rvalAt(0), params.rvalAt(1)), null); + if (count == 3) return (t_fault(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + if (count == 4) return (t_fault(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); + return (t_fault(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); + } + break; + case 8: + HASH_GUARD(0x5E77DD94E0A69328LL, setpersistence) { + return (t_setpersistence(params.rvalAt(0)), null); + } + break; + case 15: + HASH_GUARD(0x652BDFA6E22F17AFLL, getfunctions) { + return (t_getfunctions()); + } + break; + case 18: + HASH_GUARD(0x5C4CA333F4541532LL, handle) { + int count = params.size(); + if (count <= 0) return (t_handle(), null); + return (t_handle(params.rvalAt(0)), null); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 20: + HASH_GUARD(0x597B151CC4F70834LL, setclass) { + int count = params.size(); + if (count <= 1) return (t_setclass(count, params.rvalAt(0)), null); + return (t_setclass(count,params.rvalAt(0), params.slice(1, count - 1, false)), null); + } + break; + case 25: + HASH_GUARD(0x559622F84FE626B9LL, setobject) { + return (t_setobject(params.rvalAt(0)), null); + } + break; + case 30: + HASH_GUARD(0x278B0E6CCA74963ELL, addsoapheader) { + return (t_addsoapheader(params.rvalAt(0)), null); + } + break; + case 31: + HASH_GUARD(0x48B5852A397D2D9FLL, addfunction) { + return (t_addfunction(params.rvalAt(0)), null); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 1) return (t___construct(params.rvalAt(0)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_soapserver::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x758A4E04590FE203LL, fault) { + if (count <= 2) return (t_fault(a0, a1), null); + if (count == 3) return (t_fault(a0, a1, a2), null); + if (count == 4) return (t_fault(a0, a1, a2, a3), null); + return (t_fault(a0, a1, a2, a3, a4), null); + } + break; + case 8: + HASH_GUARD(0x5E77DD94E0A69328LL, setpersistence) { + return (t_setpersistence(a0), null); + } + break; + case 15: + HASH_GUARD(0x652BDFA6E22F17AFLL, getfunctions) { + return (t_getfunctions()); + } + break; + case 18: + HASH_GUARD(0x5C4CA333F4541532LL, handle) { + if (count <= 0) return (t_handle(), null); + return (t_handle(a0), null); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 20: + HASH_GUARD(0x597B151CC4F70834LL, setclass) { + if (count <= 1) return (t_setclass(count, a0), null); + Array params; + if (count >= 2) params.append(a1); + if (count >= 3) params.append(a2); + if (count >= 4) params.append(a3); + if (count >= 5) params.append(a4); + if (count >= 6) params.append(a5); + return (t_setclass(count,a0, params), null); + } + break; + case 25: + HASH_GUARD(0x559622F84FE626B9LL, setobject) { + return (t_setobject(a0), null); + } + break; + case 30: + HASH_GUARD(0x278B0E6CCA74963ELL, addsoapheader) { + return (t_addsoapheader(a0), null); + } + break; + case 31: + HASH_GUARD(0x48B5852A397D2D9FLL, addfunction) { + return (t_addfunction(a0), null); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_soapserver::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_soapserver::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x758A4E04590FE203LL, fault) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_fault(a0, a1), null); + if (count == 3) return (t_fault(a0, a1, a2), null); + if (count == 4) return (t_fault(a0, a1, a2, a3), null); + return (t_fault(a0, a1, a2, a3, a4), null); + } + break; + case 8: + HASH_GUARD(0x5E77DD94E0A69328LL, setpersistence) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setpersistence(a0), null); + } + break; + case 15: + HASH_GUARD(0x652BDFA6E22F17AFLL, getfunctions) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfunctions()); + } + break; + case 18: + HASH_GUARD(0x5C4CA333F4541532LL, handle) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_handle(), null); + return (t_handle(a0), null); + } + break; + case 19: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 20: + HASH_GUARD(0x597B151CC4F70834LL, setclass) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + int count = params.size(); + if (count <= 1) return (t_setclass(count, a0), null); + return (t_setclass(count, a0,vargs), null); + } + break; + case 25: + HASH_GUARD(0x559622F84FE626B9LL, setobject) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setobject(a0), null); + } + break; + case 30: + HASH_GUARD(0x278B0E6CCA74963ELL, addsoapheader) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_addsoapheader(a0), null); + } + break; + case 31: + HASH_GUARD(0x48B5852A397D2D9FLL, addfunction) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_addfunction(a0), null); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t___construct(a0), null); + return (t___construct(a0, a1), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_soapserver::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_soapserver$os_get(const char *s) { + return c_soapserver::os_get(s, -1); +} +Variant &cw_soapserver$os_lval(const char *s) { + return c_soapserver::os_lval(s, -1); +} +Variant cw_soapserver$os_constant(const char *s) { + return c_soapserver::os_constant(s); +} +Variant cw_soapserver$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_soapserver::os_invoke(c, s, params, -1, fatal); +} +Object co_domnode(CArrRef params, bool init /* = true */) { + return Object(p_domnode(NEW(c_domnode)())->dynCreate(params, init)); +} +Variant c_domnode::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_domnode::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_domnode::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_domnode::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_domnode::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_domnode::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_domnode::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_domnode::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(domnode) +ObjectData *c_domnode::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_domnode::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_domnode::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_domnode::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domnode::cloneImpl() { + c_domnode *obj = NEW(c_domnode)(); + cloneSet(obj); + return obj; +} +void c_domnode::cloneSet(c_domnode *clone) { + ObjectData::cloneSet(clone); +} +Variant c_domnode::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_domnode::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domnode::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_domnode::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 63) { + case 3: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 15: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + break; + case 26: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 29: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + case 33: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 36: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 47: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 53: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 58: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domnode::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domnode$os_get(const char *s) { + return c_domnode::os_get(s, -1); +} +Variant &cw_domnode$os_lval(const char *s) { + return c_domnode::os_lval(s, -1); +} +Variant cw_domnode$os_constant(const char *s) { + return c_domnode::os_constant(s); +} +Variant cw_domnode$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domnode::os_invoke(c, s, params, -1, fatal); +} +Object co_domdocument(CArrRef params, bool init /* = true */) { + return Object(p_domdocument(NEW(c_domdocument)())->dynCreate(params, init)); +} +Variant c_domdocument::os_get(const char *s, int64 hash) { + return c_domnode::os_get(s, hash); +} +Variant &c_domdocument::os_lval(const char *s, int64 hash) { + return c_domnode::os_lval(s, hash); +} +void c_domdocument::o_get(ArrayElementVec &props) const { + c_domnode::o_get(props); +} +bool c_domdocument::o_exists(CStrRef s, int64 hash) const { + return c_domnode::o_exists(s, hash); +} +Variant c_domdocument::o_get(CStrRef s, int64 hash) { + return c_domnode::o_get(s, hash); +} +Variant c_domdocument::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domnode::o_set(s, hash, v, forInit); +} +Variant &c_domdocument::o_lval(CStrRef s, int64 hash) { + return c_domnode::o_lval(s, hash); +} +Variant c_domdocument::os_constant(const char *s) { + return c_domnode::os_constant(s); +} +IMPLEMENT_CLASS(domdocument) +ObjectData *c_domdocument::create(String a0, String a1) { + init(); + t___construct(a0, a1); + return this; +} +ObjectData *c_domdocument::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0), params.rvalAt(1))); + } else return this; +} +void c_domdocument::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0), params.rvalAt(1))); +} +void c_domdocument::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domdocument::cloneImpl() { + c_domdocument *obj = NEW(c_domdocument)(); + cloneSet(obj); + return obj; +} +void c_domdocument::cloneSet(c_domdocument *clone) { + c_domnode::cloneSet(clone); +} +Variant c_domdocument::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 5: + HASH_GUARD(0x515FE7746601E385LL, getelementbyid) { + return (t_getelementbyid(params.rvalAt(0))); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + HASH_GUARD(0x142A28F8CE4A4E8ALL, xinclude) { + int count = params.size(); + if (count <= 0) return (t_xinclude()); + return (t_xinclude(params.rvalAt(0))); + } + break; + case 13: + HASH_GUARD(0x0D128C363EBF7F0DLL, createcdatasection) { + return (t_createcdatasection(params.rvalAt(0))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 17: + HASH_GUARD(0x69C6F7D584EC5011LL, schemavalidatesource) { + return (t_schemavalidatesource(params.rvalAt(0))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 20: + HASH_GUARD(0x04F8F7CEA46D0514LL, save) { + int count = params.size(); + if (count <= 1) return (t_save(params.rvalAt(0))); + return (t_save(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 21: + HASH_GUARD(0x2FC58024A75AEB15LL, createattributens) { + return (t_createattributens(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 28: + HASH_GUARD(0x1A78385D7CD10A1CLL, relaxngvalidate) { + return (t_relaxngvalidate(params.rvalAt(0))); + } + break; + case 34: + HASH_GUARD(0x1B0F4D437C8404A2LL, loadhtml) { + return (t_loadhtml(params.rvalAt(0))); + } + HASH_GUARD(0x4C40B0F935B39FA2LL, createelement) { + int count = params.size(); + if (count <= 1) return (t_createelement(params.rvalAt(0))); + return (t_createelement(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 44: + HASH_GUARD(0x1304C35F6E006FACLL, relaxngvalidatesource) { + return (t_relaxngvalidatesource(params.rvalAt(0))); + } + HASH_GUARD(0x2BFDE9CF0FE9A82CLL, createattribute) { + return (t_createattribute(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x4A6C6D9AB88CD42FLL, importnode) { + int count = params.size(); + if (count <= 1) return (t_importnode(params.rvalAt(0))); + return (t_importnode(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5FE94CA513F14AAFLL, loadhtmlfile) { + return (t_loadhtmlfile(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + HASH_GUARD(0x20E2B2FD2B7AE431LL, loadxml) { + int count = params.size(); + if (count <= 1) return (t_loadxml(params.rvalAt(0))); + return (t_loadxml(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 50: + HASH_GUARD(0x7A9C4709CAD09832LL, createentityreference) { + return (t_createentityreference(params.rvalAt(0))); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 55: + HASH_GUARD(0x1CA408E02262F737LL, validate) { + return (t_validate()); + } + break; + case 67: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 71: + HASH_GUARD(0x29C79E90C6FCC0C7LL, createcomment) { + return (t_createcomment(params.rvalAt(0))); + } + break; + case 72: + HASH_GUARD(0x7EB8C68BABDC5648LL, schemavalidate) { + return (t_schemavalidate(params.rvalAt(0))); + } + break; + case 74: + HASH_GUARD(0x3FFA3F55ECAB93CALL, getelementsbytagname) { + return (t_getelementsbytagname(params.rvalAt(0))); + } + HASH_GUARD(0x1A9CC561CA4817CALL, getelementsbytagnamens) { + return (t_getelementsbytagnamens(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 77: + HASH_GUARD(0x35C0FF513ED3054DLL, savehtmlfile) { + return (t_savehtmlfile(params.rvalAt(0))); + } + break; + case 79: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 83: + HASH_GUARD(0x21F3F1C9058310D3LL, savehtml) { + return (t_savehtml()); + } + break; + case 90: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 93: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + } + HASH_GUARD(0x79B7A5774A0943DFLL, load) { + int count = params.size(); + if (count <= 1) return (t_load(params.rvalAt(0))); + return (t_load(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 97: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 100: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 101: + HASH_GUARD(0x26D66F56DDDC32E5LL, savexml) { + int count = params.size(); + if (count <= 0) return (t_savexml()); + if (count == 1) return (t_savexml(params.rvalAt(0))); + return (t_savexml(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 106: + HASH_GUARD(0x0AC931EAB2FE3D6ALL, normalizedocument) { + return (t_normalizedocument(), null); + } + break; + case 107: + HASH_GUARD(0x05EA36F416B7EBEBLL, createelementns) { + int count = params.size(); + if (count <= 2) return (t_createelementns(params.rvalAt(0), params.rvalAt(1))); + return (t_createelementns(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 109: + HASH_GUARD(0x2A99431FC6E7BA6DLL, createprocessinginstruction) { + int count = params.size(); + if (count <= 1) return (t_createprocessinginstruction(params.rvalAt(0))); + return (t_createprocessinginstruction(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 111: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 117: + HASH_GUARD(0x615771958E1EB375LL, registernodeclass) { + return (t_registernodeclass(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 120: + HASH_GUARD(0x44FD8C24F4EA46F8LL, createdocumentfragment) { + return (t_createdocumentfragment()); + } + break; + case 122: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 123: + HASH_GUARD(0x6056A5BB9855D7FBLL, createtextnode) { + return (t_createtextnode(params.rvalAt(0))); + } + break; + default: + break; + } + return c_domnode::o_invoke(s, params, hash, fatal); +} +Variant c_domdocument::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 5: + HASH_GUARD(0x515FE7746601E385LL, getelementbyid) { + return (t_getelementbyid(a0)); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + HASH_GUARD(0x142A28F8CE4A4E8ALL, xinclude) { + if (count <= 0) return (t_xinclude()); + return (t_xinclude(a0)); + } + break; + case 13: + HASH_GUARD(0x0D128C363EBF7F0DLL, createcdatasection) { + return (t_createcdatasection(a0)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 17: + HASH_GUARD(0x69C6F7D584EC5011LL, schemavalidatesource) { + return (t_schemavalidatesource(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 20: + HASH_GUARD(0x04F8F7CEA46D0514LL, save) { + if (count <= 1) return (t_save(a0)); + return (t_save(a0, a1)); + } + break; + case 21: + HASH_GUARD(0x2FC58024A75AEB15LL, createattributens) { + return (t_createattributens(a0, a1)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + break; + case 28: + HASH_GUARD(0x1A78385D7CD10A1CLL, relaxngvalidate) { + return (t_relaxngvalidate(a0)); + } + break; + case 34: + HASH_GUARD(0x1B0F4D437C8404A2LL, loadhtml) { + return (t_loadhtml(a0)); + } + HASH_GUARD(0x4C40B0F935B39FA2LL, createelement) { + if (count <= 1) return (t_createelement(a0)); + return (t_createelement(a0, a1)); + } + break; + case 44: + HASH_GUARD(0x1304C35F6E006FACLL, relaxngvalidatesource) { + return (t_relaxngvalidatesource(a0)); + } + HASH_GUARD(0x2BFDE9CF0FE9A82CLL, createattribute) { + return (t_createattribute(a0)); + } + break; + case 47: + HASH_GUARD(0x4A6C6D9AB88CD42FLL, importnode) { + if (count <= 1) return (t_importnode(a0)); + return (t_importnode(a0, a1)); + } + HASH_GUARD(0x5FE94CA513F14AAFLL, loadhtmlfile) { + return (t_loadhtmlfile(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + HASH_GUARD(0x20E2B2FD2B7AE431LL, loadxml) { + if (count <= 1) return (t_loadxml(a0)); + return (t_loadxml(a0, a1)); + } + break; + case 50: + HASH_GUARD(0x7A9C4709CAD09832LL, createentityreference) { + return (t_createentityreference(a0)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + break; + case 55: + HASH_GUARD(0x1CA408E02262F737LL, validate) { + return (t_validate()); + } + break; + case 67: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 71: + HASH_GUARD(0x29C79E90C6FCC0C7LL, createcomment) { + return (t_createcomment(a0)); + } + break; + case 72: + HASH_GUARD(0x7EB8C68BABDC5648LL, schemavalidate) { + return (t_schemavalidate(a0)); + } + break; + case 74: + HASH_GUARD(0x3FFA3F55ECAB93CALL, getelementsbytagname) { + return (t_getelementsbytagname(a0)); + } + HASH_GUARD(0x1A9CC561CA4817CALL, getelementsbytagnamens) { + return (t_getelementsbytagnamens(a0, a1)); + } + break; + case 77: + HASH_GUARD(0x35C0FF513ED3054DLL, savehtmlfile) { + return (t_savehtmlfile(a0)); + } + break; + case 79: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 83: + HASH_GUARD(0x21F3F1C9058310D3LL, savehtml) { + return (t_savehtml()); + } + break; + case 90: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 93: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x79B7A5774A0943DFLL, load) { + if (count <= 1) return (t_load(a0)); + return (t_load(a0, a1)); + } + break; + case 97: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 100: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 101: + HASH_GUARD(0x26D66F56DDDC32E5LL, savexml) { + if (count <= 0) return (t_savexml()); + if (count == 1) return (t_savexml(a0)); + return (t_savexml(a0, a1)); + } + break; + case 106: + HASH_GUARD(0x0AC931EAB2FE3D6ALL, normalizedocument) { + return (t_normalizedocument(), null); + } + break; + case 107: + HASH_GUARD(0x05EA36F416B7EBEBLL, createelementns) { + if (count <= 2) return (t_createelementns(a0, a1)); + return (t_createelementns(a0, a1, a2)); + } + break; + case 109: + HASH_GUARD(0x2A99431FC6E7BA6DLL, createprocessinginstruction) { + if (count <= 1) return (t_createprocessinginstruction(a0)); + return (t_createprocessinginstruction(a0, a1)); + } + break; + case 111: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 117: + HASH_GUARD(0x615771958E1EB375LL, registernodeclass) { + return (t_registernodeclass(a0, a1)); + } + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 120: + HASH_GUARD(0x44FD8C24F4EA46F8LL, createdocumentfragment) { + return (t_createdocumentfragment()); + } + break; + case 122: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 123: + HASH_GUARD(0x6056A5BB9855D7FBLL, createtextnode) { + return (t_createtextnode(a0)); + } + break; + default: + break; + } + return c_domnode::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domdocument::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domnode::os_invoke(c, s, params, hash, fatal); +} +Variant c_domdocument::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 5: + HASH_GUARD(0x515FE7746601E385LL, getelementbyid) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getelementbyid(a0)); + } + break; + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + HASH_GUARD(0x142A28F8CE4A4E8ALL, xinclude) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_xinclude()); + return (t_xinclude(a0)); + } + break; + case 13: + HASH_GUARD(0x0D128C363EBF7F0DLL, createcdatasection) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_createcdatasection(a0)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 17: + HASH_GUARD(0x69C6F7D584EC5011LL, schemavalidatesource) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_schemavalidatesource(a0)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 20: + HASH_GUARD(0x04F8F7CEA46D0514LL, save) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_save(a0)); + return (t_save(a0, a1)); + } + break; + case 21: + HASH_GUARD(0x2FC58024A75AEB15LL, createattributens) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_createattributens(a0, a1)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + break; + case 28: + HASH_GUARD(0x1A78385D7CD10A1CLL, relaxngvalidate) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_relaxngvalidate(a0)); + } + break; + case 34: + HASH_GUARD(0x1B0F4D437C8404A2LL, loadhtml) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_loadhtml(a0)); + } + HASH_GUARD(0x4C40B0F935B39FA2LL, createelement) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_createelement(a0)); + return (t_createelement(a0, a1)); + } + break; + case 44: + HASH_GUARD(0x1304C35F6E006FACLL, relaxngvalidatesource) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_relaxngvalidatesource(a0)); + } + HASH_GUARD(0x2BFDE9CF0FE9A82CLL, createattribute) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_createattribute(a0)); + } + break; + case 47: + HASH_GUARD(0x4A6C6D9AB88CD42FLL, importnode) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_importnode(a0)); + return (t_importnode(a0, a1)); + } + HASH_GUARD(0x5FE94CA513F14AAFLL, loadhtmlfile) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_loadhtmlfile(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + HASH_GUARD(0x20E2B2FD2B7AE431LL, loadxml) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_loadxml(a0)); + return (t_loadxml(a0, a1)); + } + break; + case 50: + HASH_GUARD(0x7A9C4709CAD09832LL, createentityreference) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_createentityreference(a0)); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + break; + case 55: + HASH_GUARD(0x1CA408E02262F737LL, validate) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_validate()); + } + break; + case 67: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 71: + HASH_GUARD(0x29C79E90C6FCC0C7LL, createcomment) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_createcomment(a0)); + } + break; + case 72: + HASH_GUARD(0x7EB8C68BABDC5648LL, schemavalidate) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_schemavalidate(a0)); + } + break; + case 74: + HASH_GUARD(0x3FFA3F55ECAB93CALL, getelementsbytagname) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getelementsbytagname(a0)); + } + HASH_GUARD(0x1A9CC561CA4817CALL, getelementsbytagnamens) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getelementsbytagnamens(a0, a1)); + } + break; + case 77: + HASH_GUARD(0x35C0FF513ED3054DLL, savehtmlfile) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_savehtmlfile(a0)); + } + break; + case 79: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 83: + HASH_GUARD(0x21F3F1C9058310D3LL, savehtml) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_savehtml()); + } + break; + case 90: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 93: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0, a1), null); + } + HASH_GUARD(0x79B7A5774A0943DFLL, load) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_load(a0)); + return (t_load(a0, a1)); + } + break; + case 97: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 100: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 101: + HASH_GUARD(0x26D66F56DDDC32E5LL, savexml) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_savexml()); + if (count == 1) return (t_savexml(a0)); + return (t_savexml(a0, a1)); + } + break; + case 106: + HASH_GUARD(0x0AC931EAB2FE3D6ALL, normalizedocument) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalizedocument(), null); + } + break; + case 107: + HASH_GUARD(0x05EA36F416B7EBEBLL, createelementns) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_createelementns(a0, a1)); + return (t_createelementns(a0, a1, a2)); + } + break; + case 109: + HASH_GUARD(0x2A99431FC6E7BA6DLL, createprocessinginstruction) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_createprocessinginstruction(a0)); + return (t_createprocessinginstruction(a0, a1)); + } + break; + case 111: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 117: + HASH_GUARD(0x615771958E1EB375LL, registernodeclass) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_registernodeclass(a0, a1)); + } + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 120: + HASH_GUARD(0x44FD8C24F4EA46F8LL, createdocumentfragment) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_createdocumentfragment()); + } + break; + case 122: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + case 123: + HASH_GUARD(0x6056A5BB9855D7FBLL, createtextnode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_createtextnode(a0)); + } + break; + default: + break; + } + return c_domnode::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domdocument::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domnode::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domdocument$os_get(const char *s) { + return c_domdocument::os_get(s, -1); +} +Variant &cw_domdocument$os_lval(const char *s) { + return c_domdocument::os_lval(s, -1); +} +Variant cw_domdocument$os_constant(const char *s) { + return c_domdocument::os_constant(s); +} +Variant cw_domdocument$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domdocument::os_invoke(c, s, params, -1, fatal); +} +Object co_libxmlerror(CArrRef params, bool init /* = true */) { + return Object(p_libxmlerror(NEW(c_libxmlerror)())->dynCreate(params, init)); +} +Variant c_libxmlerror::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_libxmlerror::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_libxmlerror::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_libxmlerror::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_libxmlerror::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_libxmlerror::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_libxmlerror::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_libxmlerror::os_constant(const char *s) { + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(libxmlerror) +ObjectData *c_libxmlerror::create() { + init(); + t___construct(); + return this; +} +ObjectData *c_libxmlerror::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create()); + } else return this; +} +void c_libxmlerror::dynConstruct(CArrRef params) { + (t___construct()); +} +void c_libxmlerror::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_libxmlerror::cloneImpl() { + c_libxmlerror *obj = NEW(c_libxmlerror)(); + cloneSet(obj); + return obj; +} +void c_libxmlerror::cloneSet(c_libxmlerror *clone) { + ObjectData::cloneSet(clone); +} +Variant c_libxmlerror::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_libxmlerror::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_libxmlerror::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_libxmlerror::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 3) { + case 3: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_libxmlerror::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_libxmlerror$os_get(const char *s) { + return c_libxmlerror::os_get(s, -1); +} +Variant &cw_libxmlerror$os_lval(const char *s) { + return c_libxmlerror::os_lval(s, -1); +} +Variant cw_libxmlerror$os_constant(const char *s) { + return c_libxmlerror::os_constant(s); +} +Variant cw_libxmlerror$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_libxmlerror::os_invoke(c, s, params, -1, fatal); +} +Object co_soapfault(CArrRef params, bool init /* = true */) { + return Object(p_soapfault(NEW(c_soapfault)())->dynCreate(params, init)); +} +Variant c_soapfault::os_get(const char *s, int64 hash) { + return c_exception::os_get(s, hash); +} +Variant &c_soapfault::os_lval(const char *s, int64 hash) { + return c_exception::os_lval(s, hash); +} +void c_soapfault::o_get(ArrayElementVec &props) const { + c_exception::o_get(props); +} +bool c_soapfault::o_exists(CStrRef s, int64 hash) const { + return c_exception::o_exists(s, hash); +} +Variant c_soapfault::o_get(CStrRef s, int64 hash) { + return c_exception::o_get(s, hash); +} +Variant c_soapfault::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_exception::o_set(s, hash, v, forInit); +} +Variant &c_soapfault::o_lval(CStrRef s, int64 hash) { + return c_exception::o_lval(s, hash); +} +Variant c_soapfault::os_constant(const char *s) { + return c_exception::os_constant(s); +} +IMPLEMENT_CLASS(soapfault) +ObjectData *c_soapfault::create(Variant a0, String a1, String a2, Variant a3, String a4, Variant a5) { + init(); + t___construct(a0, a1, a2, a3, a4, a5); + return this; +} +ObjectData *c_soapfault::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 2) return (create(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + } else return this; +} +void c_soapfault::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 2) (t___construct(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +void c_soapfault::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_soapfault::cloneImpl() { + c_soapfault *obj = NEW(c_soapfault)(); + cloneSet(obj); + return obj; +} +void c_soapfault::cloneSet(c_soapfault *clone) { + c_exception::cloneSet(clone); +} +Variant c_soapfault::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + break; + case 15: + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + case 18: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 26: + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 30: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 2) return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + if (count == 3) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + if (count == 4) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); + if (count == 5) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5)), null); + } + break; + default: + break; + } + return c_exception::o_invoke(s, params, hash, fatal); +} +Variant c_soapfault::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + return (t_gettraceasstring()); + } + break; + case 15: + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + return (t_getcode()); + } + break; + case 18: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + return (t_getmessage()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 26: + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + return (t_gettrace()); + } + break; + case 30: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + return (t_getfile()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 2) return (t___construct(a0, a1), null); + if (count == 3) return (t___construct(a0, a1, a2), null); + if (count == 4) return (t___construct(a0, a1, a2, a3), null); + if (count == 5) return (t___construct(a0, a1, a2, a3, a4), null); + return (t___construct(a0, a1, a2, a3, a4, a5), null); + } + break; + default: + break; + } + return c_exception::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_soapfault::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_exception::os_invoke(c, s, params, hash, fatal); +} +Variant c_soapfault::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 31) { + case 3: + HASH_GUARD(0x31D981FD9D2728E3LL, getline) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getline()); + } + break; + case 10: + HASH_GUARD(0x03CA4360169ECC8ALL, gettraceasstring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettraceasstring()); + } + break; + case 15: + HASH_GUARD(0x5C108B351DC3D04FLL, getcode) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getcode()); + } + break; + case 18: + HASH_GUARD(0x71859D7313E682D2LL, getmessage) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getmessage()); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 26: + HASH_GUARD(0x6800B2B4C4EC4CBALL, gettrace) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_gettrace()); + } + break; + case 30: + HASH_GUARD(0x3CE90CB8F0C9579ELL, getfile) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getfile()); + } + break; + case 31: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t___construct(a0, a1), null); + if (count == 3) return (t___construct(a0, a1, a2), null); + if (count == 4) return (t___construct(a0, a1, a2, a3), null); + if (count == 5) return (t___construct(a0, a1, a2, a3, a4), null); + return (t___construct(a0, a1, a2, a3, a4, a5), null); + } + break; + default: + break; + } + return c_exception::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_soapfault::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_exception::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_soapfault$os_get(const char *s) { + return c_soapfault::os_get(s, -1); +} +Variant &cw_soapfault$os_lval(const char *s) { + return c_soapfault::os_lval(s, -1); +} +Variant cw_soapfault$os_constant(const char *s) { + return c_soapfault::os_constant(s); +} +Variant cw_soapfault$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_soapfault::os_invoke(c, s, params, -1, fatal); +} +Object co_domelement(CArrRef params, bool init /* = true */) { + return Object(p_domelement(NEW(c_domelement)())->dynCreate(params, init)); +} +Variant c_domelement::os_get(const char *s, int64 hash) { + return c_domnode::os_get(s, hash); +} +Variant &c_domelement::os_lval(const char *s, int64 hash) { + return c_domnode::os_lval(s, hash); +} +void c_domelement::o_get(ArrayElementVec &props) const { + c_domnode::o_get(props); +} +bool c_domelement::o_exists(CStrRef s, int64 hash) const { + return c_domnode::o_exists(s, hash); +} +Variant c_domelement::o_get(CStrRef s, int64 hash) { + return c_domnode::o_get(s, hash); +} +Variant c_domelement::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_domnode::o_set(s, hash, v, forInit); +} +Variant &c_domelement::o_lval(CStrRef s, int64 hash) { + return c_domnode::o_lval(s, hash); +} +Variant c_domelement::os_constant(const char *s) { + return c_domnode::os_constant(s); +} +IMPLEMENT_CLASS(domelement) +ObjectData *c_domelement::create(Variant a0, Variant a1, Variant a2) { + init(); + t___construct(a0, a1, a2); + return this; +} +ObjectData *c_domelement::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } else return this; +} +void c_domelement::dynConstruct(CArrRef params) { + (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +void c_domelement::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_domelement::cloneImpl() { + c_domelement *obj = NEW(c_domelement)(); + cloneSet(obj); + return obj; +} +void c_domelement::cloneSet(c_domelement *clone) { + c_domnode::cloneSet(clone); +} +Variant c_domelement::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(params.rvalAt(0))); + if (count == 2) return (t_c14n(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_c14n(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + HASH_GUARD(0x1D5B8B8144F4AB8ALL, setattribute) { + return (t_setattribute(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 16: + HASH_GUARD(0x710986B01E1A0890LL, removeattributens) { + return (t_removeattributens(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 17: + HASH_GUARD(0x31426AC6A851EE11LL, setidattributens) { + return (t_setidattributens(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(params.rvalAt(0))); + } + break; + case 22: + HASH_GUARD(0x6F83EC29E110D616LL, setidattribute) { + return (t_setidattribute(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + HASH_GUARD(0x640FA60DDC80EC18LL, getattributenodens) { + return (t_getattributenodens(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 25: + HASH_GUARD(0x34E103E06D3F0899LL, getattributens) { + return (t_getattributens(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 40: + HASH_GUARD(0x49F89C466612FC28LL, getattribute) { + return (t_getattribute(params.rvalAt(0))); + } + break; + case 47: + HASH_GUARD(0x47B96C0FC62E1E2FLL, removeattribute) { + return (t_removeattribute(params.rvalAt(0))); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + int count = params.size(); + if (count <= 1) return (t_insertbefore(params.rvalAt(0))); + return (t_insertbefore(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 67: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 74: + HASH_GUARD(0x3FFA3F55ECAB93CALL, getelementsbytagname) { + return (t_getelementsbytagname(params.rvalAt(0))); + } + HASH_GUARD(0x1A9CC561CA4817CALL, getelementsbytagnamens) { + return (t_getelementsbytagnamens(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x29D272CBBC0CDA4ALL, setidattributenode) { + return (t_setidattributenode(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 79: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(params.rvalAt(0))); + } + break; + case 81: + HASH_GUARD(0x482E3873306253D1LL, setattributenodens) { + return (t_setattributenodens(params.rvalAt(0))); + } + break; + case 85: + HASH_GUARD(0x5EF7C3A45311D955LL, hasattributens) { + return (t_hasattributens(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 87: + HASH_GUARD(0x62A40E71FAF19157LL, setattributens) { + return (t_setattributens(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 90: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 92: + HASH_GUARD(0x606827EF5CF34C5CLL, setattributenode) { + return (t_setattributenode(params.rvalAt(0))); + } + break; + case 93: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(params.rvalAt(0))); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(params.rvalAt(0))); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + } + break; + case 97: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(params.rvalAt(0))); + } + break; + case 100: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(params.rvalAt(0))); + } + break; + case 106: + HASH_GUARD(0x1BFDB4272EA150EALL, removeattributenode) { + return (t_removeattributenode(params.rvalAt(0))); + } + break; + case 108: + HASH_GUARD(0x6471DF8BB944FFECLL, hasattribute) { + return (t_hasattribute(params.rvalAt(0))); + } + break; + case 111: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(params.rvalAt(0))); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 117: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + int count = params.size(); + if (count <= 1) return (t_c14nfile(params.rvalAt(0))); + if (count == 2) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_c14nfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 122: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 126: + HASH_GUARD(0x343DF562BB5AB1FELL, getattributenode) { + return (t_getattributenode(params.rvalAt(0))); + } + break; + default: + break; + } + return c_domnode::o_invoke(s, params, hash, fatal); +} +Variant c_domelement::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + HASH_GUARD(0x1D5B8B8144F4AB8ALL, setattribute) { + return (t_setattribute(a0, a1)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + return (t_replacechild(a0, a1)); + } + break; + case 16: + HASH_GUARD(0x710986B01E1A0890LL, removeattributens) { + return (t_removeattributens(a0, a1)); + } + break; + case 17: + HASH_GUARD(0x31426AC6A851EE11LL, setidattributens) { + return (t_setidattributens(a0, a1, a2)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 22: + HASH_GUARD(0x6F83EC29E110D616LL, setidattribute) { + return (t_setidattribute(a0, a1)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + return (t_getlineno()); + } + HASH_GUARD(0x640FA60DDC80EC18LL, getattributenodens) { + return (t_getattributenodens(a0, a1)); + } + break; + case 25: + HASH_GUARD(0x34E103E06D3F0899LL, getattributens) { + return (t_getattributens(a0, a1)); + } + break; + case 40: + HASH_GUARD(0x49F89C466612FC28LL, getattribute) { + return (t_getattribute(a0)); + } + break; + case 47: + HASH_GUARD(0x47B96C0FC62E1E2FLL, removeattribute) { + return (t_removeattribute(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + break; + case 67: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + return (t_getnodepath()); + } + break; + case 74: + HASH_GUARD(0x3FFA3F55ECAB93CALL, getelementsbytagname) { + return (t_getelementsbytagname(a0)); + } + HASH_GUARD(0x1A9CC561CA4817CALL, getelementsbytagnamens) { + return (t_getelementsbytagnamens(a0, a1)); + } + HASH_GUARD(0x29D272CBBC0CDA4ALL, setidattributenode) { + return (t_setidattributenode(a0, a1)); + } + break; + case 79: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + return (t_appendchild(a0)); + } + break; + case 81: + HASH_GUARD(0x482E3873306253D1LL, setattributenodens) { + return (t_setattributenodens(a0)); + } + break; + case 85: + HASH_GUARD(0x5EF7C3A45311D955LL, hasattributens) { + return (t_hasattributens(a0, a1)); + } + break; + case 87: + HASH_GUARD(0x62A40E71FAF19157LL, setattributens) { + return (t_setattributens(a0, a1, a2)); + } + break; + case 90: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + return (t_normalize(), null); + } + break; + case 92: + HASH_GUARD(0x606827EF5CF34C5CLL, setattributenode) { + return (t_setattributenode(a0)); + } + break; + case 93: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + return (t_removechild(a0)); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + return (t___construct(a0, a1, a2), null); + } + break; + case 97: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + return (t_lookupprefix(a0)); + } + break; + case 100: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + return (t_isdefaultnamespace(a0)); + } + break; + case 106: + HASH_GUARD(0x1BFDB4272EA150EALL, removeattributenode) { + return (t_removeattributenode(a0)); + } + break; + case 108: + HASH_GUARD(0x6471DF8BB944FFECLL, hasattribute) { + return (t_hasattribute(a0)); + } + break; + case 111: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + return (t_issamenode(a0)); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 117: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 122: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + return (t_haschildnodes()); + } + break; + case 126: + HASH_GUARD(0x343DF562BB5AB1FELL, getattributenode) { + return (t_getattributenode(a0)); + } + break; + default: + break; + } + return c_domnode::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_domelement::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_domnode::os_invoke(c, s, params, hash, fatal); +} +Variant c_domelement::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 10: + HASH_GUARD(0x77570221C582ED8ALL, c14n) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_c14n()); + if (count == 1) return (t_c14n(a0)); + if (count == 2) return (t_c14n(a0, a1)); + if (count == 3) return (t_c14n(a0, a1, a2)); + return (t_c14n(a0, a1, a2, a3)); + } + HASH_GUARD(0x1D5B8B8144F4AB8ALL, setattribute) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setattribute(a0, a1)); + } + break; + case 14: + HASH_GUARD(0x1C51CE3C2356D08ELL, replacechild) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_replacechild(a0, a1)); + } + break; + case 16: + HASH_GUARD(0x710986B01E1A0890LL, removeattributens) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removeattributens(a0, a1)); + } + break; + case 17: + HASH_GUARD(0x31426AC6A851EE11LL, setidattributens) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setidattributens(a0, a1, a2)); + } + break; + case 18: + HASH_GUARD(0x4F615934A04E3092LL, clonenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_clonenode()); + return (t_clonenode(a0)); + } + break; + case 22: + HASH_GUARD(0x6F83EC29E110D616LL, setidattribute) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setidattribute(a0, a1)); + } + break; + case 24: + HASH_GUARD(0x58F8D846AF9E5D18LL, getlineno) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getlineno()); + } + HASH_GUARD(0x640FA60DDC80EC18LL, getattributenodens) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getattributenodens(a0, a1)); + } + break; + case 25: + HASH_GUARD(0x34E103E06D3F0899LL, getattributens) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getattributens(a0, a1)); + } + break; + case 40: + HASH_GUARD(0x49F89C466612FC28LL, getattribute) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getattribute(a0)); + } + break; + case 47: + HASH_GUARD(0x47B96C0FC62E1E2FLL, removeattribute) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removeattribute(a0)); + } + break; + case 49: + HASH_GUARD(0x3CFA6EECF6F5AEB1LL, hasattributes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributes()); + } + break; + case 51: + HASH_GUARD(0x076FF0CF9185C433LL, insertbefore) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_insertbefore(a0)); + return (t_insertbefore(a0, a1)); + } + break; + case 67: + HASH_GUARD(0x69797649716AE343LL, getnodepath) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getnodepath()); + } + break; + case 74: + HASH_GUARD(0x3FFA3F55ECAB93CALL, getelementsbytagname) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getelementsbytagname(a0)); + } + HASH_GUARD(0x1A9CC561CA4817CALL, getelementsbytagnamens) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getelementsbytagnamens(a0, a1)); + } + HASH_GUARD(0x29D272CBBC0CDA4ALL, setidattributenode) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setidattributenode(a0, a1)); + } + break; + case 79: + HASH_GUARD(0x0B44A59A023E75CFLL, appendchild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_appendchild(a0)); + } + break; + case 81: + HASH_GUARD(0x482E3873306253D1LL, setattributenodens) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setattributenodens(a0)); + } + break; + case 85: + HASH_GUARD(0x5EF7C3A45311D955LL, hasattributens) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattributens(a0, a1)); + } + break; + case 87: + HASH_GUARD(0x62A40E71FAF19157LL, setattributens) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setattributens(a0, a1, a2)); + } + break; + case 90: + HASH_GUARD(0x11A2D4B742CB6C5ALL, normalize) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_normalize(), null); + } + break; + case 92: + HASH_GUARD(0x606827EF5CF34C5CLL, setattributenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_setattributenode(a0)); + } + break; + case 93: + HASH_GUARD(0x28D1E151A83B8F5DLL, lookupnamespaceuri) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupnamespaceuri(a0)); + } + HASH_GUARD(0x72044C28B65364DDLL, removechild) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removechild(a0)); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___construct(a0, a1, a2), null); + } + break; + case 97: + HASH_GUARD(0x599DE23996CB7D61LL, lookupprefix) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_lookupprefix(a0)); + } + break; + case 100: + HASH_GUARD(0x643EFC8E9378F664LL, isdefaultnamespace) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_isdefaultnamespace(a0)); + } + break; + case 106: + HASH_GUARD(0x1BFDB4272EA150EALL, removeattributenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_removeattributenode(a0)); + } + break; + case 108: + HASH_GUARD(0x6471DF8BB944FFECLL, hasattribute) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_hasattribute(a0)); + } + break; + case 111: + HASH_GUARD(0x102549E9CA2EC6EFLL, issamenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issamenode(a0)); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 117: + HASH_GUARD(0x1D1768A6CF365A75LL, c14nfile) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_c14nfile(a0)); + if (count == 2) return (t_c14nfile(a0, a1)); + if (count == 3) return (t_c14nfile(a0, a1, a2)); + if (count == 4) return (t_c14nfile(a0, a1, a2, a3)); + return (t_c14nfile(a0, a1, a2, a3, a4)); + } + break; + case 122: + HASH_GUARD(0x279AA1B214B7677ALL, issupported) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_issupported(a0, a1)); + } + HASH_GUARD(0x5F63574EA50595FALL, haschildnodes) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_haschildnodes()); + } + break; + case 126: + HASH_GUARD(0x343DF562BB5AB1FELL, getattributenode) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_getattributenode(a0)); + } + break; + default: + break; + } + return c_domnode::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_domelement::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_domnode::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_domelement$os_get(const char *s) { + return c_domelement::os_get(s, -1); +} +Variant &cw_domelement$os_lval(const char *s) { + return c_domelement::os_lval(s, -1); +} +Variant cw_domelement$os_constant(const char *s) { + return c_domelement::os_constant(s); +} +Variant cw_domelement$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_domelement::os_invoke(c, s, params, -1, fatal); +} +Object co_phpmcc(CArrRef params, bool init /* = true */) { + return Object(p_phpmcc(NEW(c_phpmcc)())->dynCreate(params, init)); +} +Variant c_phpmcc::os_get(const char *s, int64 hash) { + return c_ObjectData::os_get(s, hash); +} +Variant &c_phpmcc::os_lval(const char *s, int64 hash) { + return c_ObjectData::os_lval(s, hash); +} +void c_phpmcc::o_get(ArrayElementVec &props) const { + c_ObjectData::o_get(props); +} +bool c_phpmcc::o_exists(CStrRef s, int64 hash) const { + return c_ObjectData::o_exists(s, hash); +} +Variant c_phpmcc::o_get(CStrRef s, int64 hash) { + return c_ObjectData::o_get(s, hash); +} +Variant c_phpmcc::o_set(CStrRef s, int64 hash, CVarRef v,bool forInit /* = false */) { + return c_ObjectData::o_set(s, hash, v, forInit); +} +Variant &c_phpmcc::o_lval(CStrRef s, int64 hash) { + return c_ObjectData::o_lval(s, hash); +} +Variant c_phpmcc::os_constant(const char *s) { + int64 hash = hash_string(s); + switch (hash & 3) { + case 2: + HASH_RETURN(0x4923E849F03135F6LL, q_phpmcc_IPPROTO_TCP, IPPROTO_TCP); + break; + case 3: + HASH_RETURN(0x666DA84AE15B3863LL, q_phpmcc_IPPROTO_UDP, IPPROTO_UDP); + break; + default: + break; + } + return c_ObjectData::os_constant(s); +} +IMPLEMENT_CLASS(phpmcc) +ObjectData *c_phpmcc::create(String a0, bool a1, int64 a2, int64 a3, int64 a4, int64 a5, int64 a6, int64 a7, int64 a8, int64 a9, double a10, int64 a11, int64 a12, int64 a13) { + init(); + t___construct(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); + return this; +} +ObjectData *c_phpmcc::dynCreate(CArrRef params, bool init /* = true */) { + if (init) { + int count = params.size(); + if (count <= 1) return (create(params.rvalAt(0))); + if (count == 2) return (create(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + if (count == 7) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); + if (count == 8) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); + if (count == 9) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8))); + if (count == 10) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9))); + if (count == 11) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10))); + if (count == 12) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10), params.rvalAt(11))); + if (count == 13) return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10), params.rvalAt(11), params.rvalAt(12))); + return (create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10), params.rvalAt(11), params.rvalAt(12), params.rvalAt(13))); + } else return this; +} +void c_phpmcc::dynConstruct(CArrRef params) { + int count = params.size(); + if (count <= 1) (t___construct(params.rvalAt(0))); + if (count == 2) (t___construct(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + if (count == 7) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); + if (count == 8) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); + if (count == 9) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8))); + if (count == 10) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9))); + if (count == 11) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10))); + if (count == 12) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10), params.rvalAt(11))); + if (count == 13) (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10), params.rvalAt(11), params.rvalAt(12))); + (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10), params.rvalAt(11), params.rvalAt(12), params.rvalAt(13))); +} +void c_phpmcc::destruct() { + if (!inCtorDtor()) { + incRefCount(); + try { + t___destruct(); + } catch (...) { handle_destructor_exception();} + } +} +ObjectData *c_phpmcc::cloneImpl() { + c_phpmcc *obj = NEW(c_phpmcc)(); + cloneSet(obj); + return obj; +} +void c_phpmcc::cloneSet(c_phpmcc *clone) { + ObjectData::cloneSet(clone); +} +Variant c_phpmcc::o_invoke(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 0: + HASH_GUARD(0x287D45DFC81FC980LL, remove_accesspoint_listener) { + return (t_remove_accesspoint_listener(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + } + break; + case 1: + HASH_GUARD(0x46E23E0C0952C501LL, add_serverpool_ex) { + return (t_add_serverpool_ex(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 2: + HASH_GUARD(0x0D0D7334CFD39802LL, get_server) { + return (t_get_server(params.rvalAt(0))); + } + break; + case 3: + HASH_GUARD(0x31A5F52718109C83LL, add_server_listener) { + return (t_add_server_listener(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + } + break; + case 4: + HASH_GUARD(0x4BC1ACE3DA46AE84LL, multi_add) { + int count = params.size(); + if (count <= 1) return (t_multi_add(params.rvalAt(0))); + if (count == 2) return (t_multi_add(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_multi_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_multi_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_multi_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + HASH_GUARD(0x2E784EAC5C9A4484LL, add_accesspoint) { + int count = params.size(); + if (count <= 2) return (t_add_accesspoint(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_add_accesspoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (t_add_accesspoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + } + break; + case 7: + HASH_GUARD(0x243C448A57E7B987LL, serverpool_get_consistent_hashing_enabled) { + return (t_serverpool_get_consistent_hashing_enabled(params.rvalAt(0))); + } + break; + case 8: + HASH_GUARD(0x23594ECA012C5588LL, remove_server) { + int count = params.size(); + if (count <= 1) return (t_remove_server(params.rvalAt(0)), null); + return (t_remove_server(params.rvalAt(0), params.rvalAt(1)), null); + } + break; + case 11: + HASH_GUARD(0x15D34462FC79458BLL, add) { + int count = params.size(); + if (count <= 2) return (t_add(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (t_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (t_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + } + break; + case 12: + HASH_GUARD(0x554D125BFDE3D20CLL, stats) { + int count = params.size(); + if (count <= 0) return (t_stats()); + return (t_stats(params.rvalAt(0))); + } + break; + case 15: + HASH_GUARD(0x26B6E00C74FA338FLL, __get) { + return (t___get(params.rvalAt(0))); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x0BA3AA7BE2D9CB93LL, incr) { + int count = params.size(); + if (count <= 1) return (t_incr(params.rvalAt(0))); + return (t_incr(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 20: + HASH_GUARD(0x57549DDFB56FAC94LL, remove_server_listener) { + return (t_remove_server_listener(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + } + break; + case 21: + HASH_GUARD(0x52F3DAD783340395LL, __set) { + return (t___set(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 33: + HASH_GUARD(0x399A6427C2185621LL, set) { + int count = params.size(); + if (count <= 2) return (t_set(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (t_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (t_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + } + HASH_GUARD(0x10E5032E1C4D64A1LL, server_version) { + return (t_server_version(params.rvalAt(0))); + } + break; + case 35: + HASH_GUARD(0x634DB670B6CE9023LL, del) { + return (t_del()); + } + break; + case 39: + HASH_GUARD(0x084E3295EBC0FC27LL, server_flush) { + int count = params.size(); + if (count <= 1) return (t_server_flush(params.rvalAt(0))); + return (t_server_flush(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x5F169417C7165027LL, server_is_alive) { + int count = params.size(); + if (count <= 0) return (t_server_is_alive()); + return (t_server_is_alive(params.rvalAt(0))); + } + break; + case 40: + HASH_GUARD(0x25DCCC35D69AD828LL, get) { + int count = params.size(); + if (count <= 1) return (t_get(params.rvalAt(0))); + if (count == 2) return (t_get(params.rvalAt(0), params.rvalAt(1))); + return (t_get(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + } + break; + case 42: + HASH_GUARD(0x4517BD70AECCB02ALL, get_accesspoints) { + return (t_get_accesspoints(params.rvalAt(0))); + } + break; + case 48: + HASH_GUARD(0x1EE2831BCAC937B0LL, get_multi) { + int count = params.size(); + if (count <= 1) return (t_get_multi(params.rvalAt(0))); + if (count == 2) return (t_get_multi(params.rvalAt(0), params.rvalAt(1))); + return (t_get_multi(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + } + break; + case 54: + HASH_GUARD(0x311E08562CC0B336LL, add_mirror_accesspoint) { + int count = params.size(); + if (count <= 3) return (t_add_mirror_accesspoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_add_mirror_accesspoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_add_mirror_accesspoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 57: + HASH_GUARD(0x7227812505D83939LL, delete_details) { + int count = params.size(); + if (count <= 1) return (t_delete_details(params.rvalAt(0))); + return (t_delete_details(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 58: + HASH_GUARD(0x31C0C13D01B3DBBALL, get_host) { + return (t_get_host(params.rvalAt(0))); + } + HASH_GUARD(0x6AD9AC8BCC019E3ALL, serverpool_get_servers) { + return (t_serverpool_get_servers(params.rvalAt(0))); + } + break; + case 60: + HASH_GUARD(0x256203B2C8626F3CLL, get_serverpool_by_key) { + return (t_get_serverpool_by_key(params.rvalAt(0))); + } + break; + case 64: + HASH_GUARD(0x133C228C5F60F640LL, remove_error_listener) { + return (t_remove_error_listener(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + } + break; + case 65: + HASH_GUARD(0x78AE97BFBEBF5341LL, close) { + return (t_close()); + } + break; + case 68: + HASH_GUARD(0x3BE70632874CEB44LL, add_mirror) { + return (t_add_mirror(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 70: + HASH_GUARD(0x42FAC655280A6146LL, replace) { + int count = params.size(); + if (count <= 2) return (t_replace(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (t_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (t_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + } + break; + case 74: + HASH_GUARD(0x25591D582B52EC4ALL, add_error_listener) { + return (t_add_error_listener(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + } + break; + case 77: + HASH_GUARD(0x171F238AA93B8F4DLL, remove_mirror) { + return (t_remove_mirror(params.rvalAt(0))); + } + break; + case 83: + HASH_GUARD(0x1C660E5BFA6F55D3LL, delete) { + int count = params.size(); + if (count <= 1) return (t_delete(params.rvalAt(0))); + return (t_delete(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 85: + HASH_GUARD(0x7F36B59A84C6F855LL, get_server_by_key) { + return (t_get_server_by_key(params.rvalAt(0))); + } + break; + case 91: + HASH_GUARD(0x62353414DB69A2DBLL, test_proxy) { + int count = params.size(); + if (count <= 0) return (t_test_proxy()); + return (t_test_proxy(params.rvalAt(0))); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + int count = params.size(); + if (count <= 1) return (t___construct(params.rvalAt(0)), null); + if (count == 2) return (t___construct(params.rvalAt(0), params.rvalAt(1)), null); + if (count == 3) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + if (count == 4) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); + if (count == 5) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); + if (count == 6) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5)), null); + if (count == 7) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6)), null); + if (count == 8) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7)), null); + if (count == 9) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8)), null); + if (count == 10) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9)), null); + if (count == 11) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10)), null); + if (count == 12) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10), params.rvalAt(11)), null); + if (count == 13) return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10), params.rvalAt(11), params.rvalAt(12)), null); + return (t___construct(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10), params.rvalAt(11), params.rvalAt(12), params.rvalAt(13)), null); + } + HASH_GUARD(0x2575F1DA69AC775FLL, add_serverpool) { + int count = params.size(); + if (count <= 1) return (t_add_serverpool(params.rvalAt(0))); + return (t_add_serverpool(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 97: + HASH_GUARD(0x0137D510C62DC561LL, decr) { + int count = params.size(); + if (count <= 1) return (t_decr(params.rvalAt(0))); + return (t_decr(params.rvalAt(0), params.rvalAt(1))); + } + break; + case 104: + HASH_GUARD(0x2DCA0F568B108368LL, remove_mirror_accesspoint) { + int count = params.size(); + if (count <= 3) return (t_remove_mirror_accesspoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + if (count == 4) return (t_remove_mirror_accesspoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); + return (t_remove_mirror_accesspoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); + } + break; + case 105: + HASH_GUARD(0x52078303E3BC24E9LL, serverpool_add_server) { + int count = params.size(); + if (count <= 2) return (t_serverpool_add_server(params.rvalAt(0), params.rvalAt(1))); + return (t_serverpool_add_server(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 107: + HASH_GUARD(0x6C6ECF5DBDCDA56BLL, serverpool_remove_server) { + int count = params.size(); + if (count <= 2) return (t_serverpool_remove_server(params.rvalAt(0), params.rvalAt(1))); + return (t_serverpool_remove_server(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 116: + HASH_GUARD(0x25362C52A06A7DF4LL, remove_serverpool) { + return (t_remove_serverpool(params.rvalAt(0)), null); + } + HASH_GUARD(0x41DED45DAB6EA0F4LL, multi_set) { + int count = params.size(); + if (count <= 1) return (t_multi_set(params.rvalAt(0))); + if (count == 2) return (t_multi_set(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_multi_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_multi_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_multi_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 117: + HASH_GUARD(0x1959BC64791572F5LL, add_server) { + int count = params.size(); + if (count <= 1) return (t_add_server(params.rvalAt(0))); + return (t_add_server(params.rvalAt(0), params.rvalAt(1))); + } + HASH_GUARD(0x17BE282CC008CE75LL, serverpool_get_consistent_hashing_version) { + return (t_serverpool_get_consistent_hashing_version(params.rvalAt(0))); + } + break; + case 118: + HASH_GUARD(0x59A033953F63DBF6LL, add_accesspoint_listener) { + return (t_add_accesspoint_listener(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + } + break; + case 122: + HASH_GUARD(0x0D41BFBA13C4317ALL, multi_replace) { + int count = params.size(); + if (count <= 1) return (t_multi_replace(params.rvalAt(0))); + if (count == 2) return (t_multi_replace(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (t_multi_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (t_multi_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (t_multi_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + } + break; + case 124: + HASH_GUARD(0x4F2C2C1CCF05AB7CLL, remove_accesspoint) { + int count = params.size(); + if (count <= 2) return (t_remove_accesspoint(params.rvalAt(0), params.rvalAt(1)), null); + if (count == 3) return (t_remove_accesspoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + return (t_remove_accesspoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke(s, params, hash, fatal); +} +Variant c_phpmcc::o_invoke_few_args(const char *s, int64 hash, int count, CVarRef a0, CVarRef a1, CVarRef a2, CVarRef a3, CVarRef a4, CVarRef a5) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 0: + HASH_GUARD(0x287D45DFC81FC980LL, remove_accesspoint_listener) { + return (t_remove_accesspoint_listener(a0, ref(a1))); + } + break; + case 1: + HASH_GUARD(0x46E23E0C0952C501LL, add_serverpool_ex) { + return (t_add_serverpool_ex(a0, a1)); + } + break; + case 2: + HASH_GUARD(0x0D0D7334CFD39802LL, get_server) { + return (t_get_server(a0)); + } + break; + case 3: + HASH_GUARD(0x31A5F52718109C83LL, add_server_listener) { + return (t_add_server_listener(a0, ref(a1))); + } + break; + case 4: + HASH_GUARD(0x4BC1ACE3DA46AE84LL, multi_add) { + if (count <= 1) return (t_multi_add(a0)); + if (count == 2) return (t_multi_add(a0, a1)); + if (count == 3) return (t_multi_add(a0, a1, a2)); + if (count == 4) return (t_multi_add(a0, a1, a2, a3)); + return (t_multi_add(a0, a1, a2, a3, a4)); + } + HASH_GUARD(0x2E784EAC5C9A4484LL, add_accesspoint) { + if (count <= 2) return (t_add_accesspoint(a0, a1)); + if (count == 3) return (t_add_accesspoint(a0, a1, a2)); + return (t_add_accesspoint(a0, a1, a2, a3)); + } + break; + case 7: + HASH_GUARD(0x243C448A57E7B987LL, serverpool_get_consistent_hashing_enabled) { + return (t_serverpool_get_consistent_hashing_enabled(a0)); + } + break; + case 8: + HASH_GUARD(0x23594ECA012C5588LL, remove_server) { + if (count <= 1) return (t_remove_server(a0), null); + return (t_remove_server(a0, a1), null); + } + break; + case 11: + HASH_GUARD(0x15D34462FC79458BLL, add) { + if (count <= 2) return (t_add(a0, a1)); + if (count == 3) return (t_add(a0, a1, a2)); + if (count == 4) return (t_add(a0, a1, a2, a3)); + if (count == 5) return (t_add(a0, a1, a2, a3, a4)); + return (t_add(a0, a1, a2, a3, a4, a5)); + } + break; + case 12: + HASH_GUARD(0x554D125BFDE3D20CLL, stats) { + if (count <= 0) return (t_stats()); + return (t_stats(a0)); + } + break; + case 15: + HASH_GUARD(0x26B6E00C74FA338FLL, __get) { + return (t___get(a0)); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + return (t___tostring()); + } + HASH_GUARD(0x0BA3AA7BE2D9CB93LL, incr) { + if (count <= 1) return (t_incr(a0)); + return (t_incr(a0, a1)); + } + break; + case 20: + HASH_GUARD(0x57549DDFB56FAC94LL, remove_server_listener) { + return (t_remove_server_listener(a0, ref(a1))); + } + break; + case 21: + HASH_GUARD(0x52F3DAD783340395LL, __set) { + return (t___set(a0, a1)); + } + break; + case 33: + HASH_GUARD(0x399A6427C2185621LL, set) { + if (count <= 2) return (t_set(a0, a1)); + if (count == 3) return (t_set(a0, a1, a2)); + if (count == 4) return (t_set(a0, a1, a2, a3)); + if (count == 5) return (t_set(a0, a1, a2, a3, a4)); + return (t_set(a0, a1, a2, a3, a4, a5)); + } + HASH_GUARD(0x10E5032E1C4D64A1LL, server_version) { + return (t_server_version(a0)); + } + break; + case 35: + HASH_GUARD(0x634DB670B6CE9023LL, del) { + return (t_del()); + } + break; + case 39: + HASH_GUARD(0x084E3295EBC0FC27LL, server_flush) { + if (count <= 1) return (t_server_flush(a0)); + return (t_server_flush(a0, a1)); + } + HASH_GUARD(0x5F169417C7165027LL, server_is_alive) { + if (count <= 0) return (t_server_is_alive()); + return (t_server_is_alive(a0)); + } + break; + case 40: + HASH_GUARD(0x25DCCC35D69AD828LL, get) { + if (count <= 1) return (t_get(a0)); + if (count == 2) return (t_get(a0, a1)); + return (t_get(a0, a1, ref(a2))); + } + break; + case 42: + HASH_GUARD(0x4517BD70AECCB02ALL, get_accesspoints) { + return (t_get_accesspoints(a0)); + } + break; + case 48: + HASH_GUARD(0x1EE2831BCAC937B0LL, get_multi) { + if (count <= 1) return (t_get_multi(a0)); + if (count == 2) return (t_get_multi(a0, a1)); + return (t_get_multi(a0, a1, ref(a2))); + } + break; + case 54: + HASH_GUARD(0x311E08562CC0B336LL, add_mirror_accesspoint) { + if (count <= 3) return (t_add_mirror_accesspoint(a0, a1, a2)); + if (count == 4) return (t_add_mirror_accesspoint(a0, a1, a2, a3)); + return (t_add_mirror_accesspoint(a0, a1, a2, a3, a4)); + } + break; + case 57: + HASH_GUARD(0x7227812505D83939LL, delete_details) { + if (count <= 1) return (t_delete_details(a0)); + return (t_delete_details(a0, a1)); + } + break; + case 58: + HASH_GUARD(0x31C0C13D01B3DBBALL, get_host) { + return (t_get_host(a0)); + } + HASH_GUARD(0x6AD9AC8BCC019E3ALL, serverpool_get_servers) { + return (t_serverpool_get_servers(a0)); + } + break; + case 60: + HASH_GUARD(0x256203B2C8626F3CLL, get_serverpool_by_key) { + return (t_get_serverpool_by_key(a0)); + } + break; + case 64: + HASH_GUARD(0x133C228C5F60F640LL, remove_error_listener) { + return (t_remove_error_listener(a0, ref(a1))); + } + break; + case 65: + HASH_GUARD(0x78AE97BFBEBF5341LL, close) { + return (t_close()); + } + break; + case 68: + HASH_GUARD(0x3BE70632874CEB44LL, add_mirror) { + return (t_add_mirror(a0, a1)); + } + break; + case 70: + HASH_GUARD(0x42FAC655280A6146LL, replace) { + if (count <= 2) return (t_replace(a0, a1)); + if (count == 3) return (t_replace(a0, a1, a2)); + if (count == 4) return (t_replace(a0, a1, a2, a3)); + if (count == 5) return (t_replace(a0, a1, a2, a3, a4)); + return (t_replace(a0, a1, a2, a3, a4, a5)); + } + break; + case 74: + HASH_GUARD(0x25591D582B52EC4ALL, add_error_listener) { + return (t_add_error_listener(a0, ref(a1))); + } + break; + case 77: + HASH_GUARD(0x171F238AA93B8F4DLL, remove_mirror) { + return (t_remove_mirror(a0)); + } + break; + case 83: + HASH_GUARD(0x1C660E5BFA6F55D3LL, delete) { + if (count <= 1) return (t_delete(a0)); + return (t_delete(a0, a1)); + } + break; + case 85: + HASH_GUARD(0x7F36B59A84C6F855LL, get_server_by_key) { + return (t_get_server_by_key(a0)); + } + break; + case 91: + HASH_GUARD(0x62353414DB69A2DBLL, test_proxy) { + if (count <= 0) return (t_test_proxy()); + return (t_test_proxy(a0)); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + if (count <= 1) return (t___construct(a0), null); + if (count == 2) return (t___construct(a0, a1), null); + if (count == 3) return (t___construct(a0, a1, a2), null); + if (count == 4) return (t___construct(a0, a1, a2, a3), null); + if (count == 5) return (t___construct(a0, a1, a2, a3, a4), null); + return (t___construct(a0, a1, a2, a3, a4, a5), null); + } + HASH_GUARD(0x2575F1DA69AC775FLL, add_serverpool) { + if (count <= 1) return (t_add_serverpool(a0)); + return (t_add_serverpool(a0, a1)); + } + break; + case 97: + HASH_GUARD(0x0137D510C62DC561LL, decr) { + if (count <= 1) return (t_decr(a0)); + return (t_decr(a0, a1)); + } + break; + case 104: + HASH_GUARD(0x2DCA0F568B108368LL, remove_mirror_accesspoint) { + if (count <= 3) return (t_remove_mirror_accesspoint(a0, a1, a2), null); + if (count == 4) return (t_remove_mirror_accesspoint(a0, a1, a2, a3), null); + return (t_remove_mirror_accesspoint(a0, a1, a2, a3, a4), null); + } + break; + case 105: + HASH_GUARD(0x52078303E3BC24E9LL, serverpool_add_server) { + if (count <= 2) return (t_serverpool_add_server(a0, a1)); + return (t_serverpool_add_server(a0, a1, a2)); + } + break; + case 107: + HASH_GUARD(0x6C6ECF5DBDCDA56BLL, serverpool_remove_server) { + if (count <= 2) return (t_serverpool_remove_server(a0, a1)); + return (t_serverpool_remove_server(a0, a1, a2)); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + return (t___destruct()); + } + break; + case 116: + HASH_GUARD(0x25362C52A06A7DF4LL, remove_serverpool) { + return (t_remove_serverpool(a0), null); + } + HASH_GUARD(0x41DED45DAB6EA0F4LL, multi_set) { + if (count <= 1) return (t_multi_set(a0)); + if (count == 2) return (t_multi_set(a0, a1)); + if (count == 3) return (t_multi_set(a0, a1, a2)); + if (count == 4) return (t_multi_set(a0, a1, a2, a3)); + return (t_multi_set(a0, a1, a2, a3, a4)); + } + break; + case 117: + HASH_GUARD(0x1959BC64791572F5LL, add_server) { + if (count <= 1) return (t_add_server(a0)); + return (t_add_server(a0, a1)); + } + HASH_GUARD(0x17BE282CC008CE75LL, serverpool_get_consistent_hashing_version) { + return (t_serverpool_get_consistent_hashing_version(a0)); + } + break; + case 118: + HASH_GUARD(0x59A033953F63DBF6LL, add_accesspoint_listener) { + return (t_add_accesspoint_listener(a0, ref(a1))); + } + break; + case 122: + HASH_GUARD(0x0D41BFBA13C4317ALL, multi_replace) { + if (count <= 1) return (t_multi_replace(a0)); + if (count == 2) return (t_multi_replace(a0, a1)); + if (count == 3) return (t_multi_replace(a0, a1, a2)); + if (count == 4) return (t_multi_replace(a0, a1, a2, a3)); + return (t_multi_replace(a0, a1, a2, a3, a4)); + } + break; + case 124: + HASH_GUARD(0x4F2C2C1CCF05AB7CLL, remove_accesspoint) { + if (count <= 2) return (t_remove_accesspoint(a0, a1), null); + if (count == 3) return (t_remove_accesspoint(a0, a1, a2), null); + return (t_remove_accesspoint(a0, a1, a2, a3), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_few_args(s, hash, count, a0, a1, a2, a3, a4, a5); +} +Variant c_phpmcc::os_invoke(const char *c, const char *s, CArrRef params, int64 hash, bool fatal) { + return c_ObjectData::os_invoke(c, s, params, hash, fatal); +} +Variant c_phpmcc::o_invoke_from_eval(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 127) { + case 0: + HASH_GUARD(0x287D45DFC81FC980LL, remove_accesspoint_listener) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_remove_accesspoint_listener(a0, ref(a1))); + } + break; + case 1: + HASH_GUARD(0x46E23E0C0952C501LL, add_serverpool_ex) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_add_serverpool_ex(a0, a1)); + } + break; + case 2: + HASH_GUARD(0x0D0D7334CFD39802LL, get_server) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_get_server(a0)); + } + break; + case 3: + HASH_GUARD(0x31A5F52718109C83LL, add_server_listener) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_add_server_listener(a0, ref(a1))); + } + break; + case 4: + HASH_GUARD(0x4BC1ACE3DA46AE84LL, multi_add) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_multi_add(a0)); + if (count == 2) return (t_multi_add(a0, a1)); + if (count == 3) return (t_multi_add(a0, a1, a2)); + if (count == 4) return (t_multi_add(a0, a1, a2, a3)); + return (t_multi_add(a0, a1, a2, a3, a4)); + } + HASH_GUARD(0x2E784EAC5C9A4484LL, add_accesspoint) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_add_accesspoint(a0, a1)); + if (count == 3) return (t_add_accesspoint(a0, a1, a2)); + return (t_add_accesspoint(a0, a1, a2, a3)); + } + break; + case 7: + HASH_GUARD(0x243C448A57E7B987LL, serverpool_get_consistent_hashing_enabled) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_serverpool_get_consistent_hashing_enabled(a0)); + } + break; + case 8: + HASH_GUARD(0x23594ECA012C5588LL, remove_server) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_remove_server(a0), null); + return (t_remove_server(a0, a1), null); + } + break; + case 11: + HASH_GUARD(0x15D34462FC79458BLL, add) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_add(a0, a1)); + if (count == 3) return (t_add(a0, a1, a2)); + if (count == 4) return (t_add(a0, a1, a2, a3)); + if (count == 5) return (t_add(a0, a1, a2, a3, a4)); + return (t_add(a0, a1, a2, a3, a4, a5)); + } + break; + case 12: + HASH_GUARD(0x554D125BFDE3D20CLL, stats) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_stats()); + return (t_stats(a0)); + } + break; + case 15: + HASH_GUARD(0x26B6E00C74FA338FLL, __get) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___get(a0)); + } + break; + case 19: + HASH_GUARD(0x642C2D2994B34A13LL, __tostring) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___tostring()); + } + HASH_GUARD(0x0BA3AA7BE2D9CB93LL, incr) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_incr(a0)); + return (t_incr(a0, a1)); + } + break; + case 20: + HASH_GUARD(0x57549DDFB56FAC94LL, remove_server_listener) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_remove_server_listener(a0, ref(a1))); + } + break; + case 21: + HASH_GUARD(0x52F3DAD783340395LL, __set) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___set(a0, a1)); + } + break; + case 33: + HASH_GUARD(0x399A6427C2185621LL, set) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_set(a0, a1)); + if (count == 3) return (t_set(a0, a1, a2)); + if (count == 4) return (t_set(a0, a1, a2, a3)); + if (count == 5) return (t_set(a0, a1, a2, a3, a4)); + return (t_set(a0, a1, a2, a3, a4, a5)); + } + HASH_GUARD(0x10E5032E1C4D64A1LL, server_version) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_server_version(a0)); + } + break; + case 35: + HASH_GUARD(0x634DB670B6CE9023LL, del) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_del()); + } + break; + case 39: + HASH_GUARD(0x084E3295EBC0FC27LL, server_flush) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_server_flush(a0)); + return (t_server_flush(a0, a1)); + } + HASH_GUARD(0x5F169417C7165027LL, server_is_alive) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_server_is_alive()); + return (t_server_is_alive(a0)); + } + break; + case 40: + HASH_GUARD(0x25DCCC35D69AD828LL, get) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_get(a0)); + if (count == 2) return (t_get(a0, a1)); + return (t_get(a0, a1, ref(a2))); + } + break; + case 42: + HASH_GUARD(0x4517BD70AECCB02ALL, get_accesspoints) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_get_accesspoints(a0)); + } + break; + case 48: + HASH_GUARD(0x1EE2831BCAC937B0LL, get_multi) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_get_multi(a0)); + if (count == 2) return (t_get_multi(a0, a1)); + return (t_get_multi(a0, a1, ref(a2))); + } + break; + case 54: + HASH_GUARD(0x311E08562CC0B336LL, add_mirror_accesspoint) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 3) return (t_add_mirror_accesspoint(a0, a1, a2)); + if (count == 4) return (t_add_mirror_accesspoint(a0, a1, a2, a3)); + return (t_add_mirror_accesspoint(a0, a1, a2, a3, a4)); + } + break; + case 57: + HASH_GUARD(0x7227812505D83939LL, delete_details) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_delete_details(a0)); + return (t_delete_details(a0, a1)); + } + break; + case 58: + HASH_GUARD(0x31C0C13D01B3DBBALL, get_host) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_get_host(a0)); + } + HASH_GUARD(0x6AD9AC8BCC019E3ALL, serverpool_get_servers) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_serverpool_get_servers(a0)); + } + break; + case 60: + HASH_GUARD(0x256203B2C8626F3CLL, get_serverpool_by_key) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_get_serverpool_by_key(a0)); + } + break; + case 64: + HASH_GUARD(0x133C228C5F60F640LL, remove_error_listener) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_remove_error_listener(a0, ref(a1))); + } + break; + case 65: + HASH_GUARD(0x78AE97BFBEBF5341LL, close) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_close()); + } + break; + case 68: + HASH_GUARD(0x3BE70632874CEB44LL, add_mirror) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_add_mirror(a0, a1)); + } + break; + case 70: + HASH_GUARD(0x42FAC655280A6146LL, replace) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_replace(a0, a1)); + if (count == 3) return (t_replace(a0, a1, a2)); + if (count == 4) return (t_replace(a0, a1, a2, a3)); + if (count == 5) return (t_replace(a0, a1, a2, a3, a4)); + return (t_replace(a0, a1, a2, a3, a4, a5)); + } + break; + case 74: + HASH_GUARD(0x25591D582B52EC4ALL, add_error_listener) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_add_error_listener(a0, ref(a1))); + } + break; + case 77: + HASH_GUARD(0x171F238AA93B8F4DLL, remove_mirror) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_remove_mirror(a0)); + } + break; + case 83: + HASH_GUARD(0x1C660E5BFA6F55D3LL, delete) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_delete(a0)); + return (t_delete(a0, a1)); + } + break; + case 85: + HASH_GUARD(0x7F36B59A84C6F855LL, get_server_by_key) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_get_server_by_key(a0)); + } + break; + case 91: + HASH_GUARD(0x62353414DB69A2DBLL, test_proxy) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 0) return (t_test_proxy()); + return (t_test_proxy(a0)); + } + break; + case 95: + HASH_GUARD(0x0D31D0AC229C615FLL, __construct) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + Variant a8; + Variant a9; + Variant a10; + Variant a11; + Variant a12; + Variant a13; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a8 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a9 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a10 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a11 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a12 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a13 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t___construct(a0), null); + if (count == 2) return (t___construct(a0, a1), null); + if (count == 3) return (t___construct(a0, a1, a2), null); + if (count == 4) return (t___construct(a0, a1, a2, a3), null); + if (count == 5) return (t___construct(a0, a1, a2, a3, a4), null); + if (count == 6) return (t___construct(a0, a1, a2, a3, a4, a5), null); + if (count == 7) return (t___construct(a0, a1, a2, a3, a4, a5, a6), null); + if (count == 8) return (t___construct(a0, a1, a2, a3, a4, a5, a6, a7), null); + if (count == 9) return (t___construct(a0, a1, a2, a3, a4, a5, a6, a7, a8), null); + if (count == 10) return (t___construct(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), null); + if (count == 11) return (t___construct(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10), null); + if (count == 12) return (t___construct(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11), null); + if (count == 13) return (t___construct(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12), null); + return (t___construct(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13), null); + } + HASH_GUARD(0x2575F1DA69AC775FLL, add_serverpool) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_add_serverpool(a0)); + return (t_add_serverpool(a0, a1)); + } + break; + case 97: + HASH_GUARD(0x0137D510C62DC561LL, decr) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_decr(a0)); + return (t_decr(a0, a1)); + } + break; + case 104: + HASH_GUARD(0x2DCA0F568B108368LL, remove_mirror_accesspoint) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 3) return (t_remove_mirror_accesspoint(a0, a1, a2), null); + if (count == 4) return (t_remove_mirror_accesspoint(a0, a1, a2, a3), null); + return (t_remove_mirror_accesspoint(a0, a1, a2, a3, a4), null); + } + break; + case 105: + HASH_GUARD(0x52078303E3BC24E9LL, serverpool_add_server) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_serverpool_add_server(a0, a1)); + return (t_serverpool_add_server(a0, a1, a2)); + } + break; + case 107: + HASH_GUARD(0x6C6ECF5DBDCDA56BLL, serverpool_remove_server) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_serverpool_remove_server(a0, a1)); + return (t_serverpool_remove_server(a0, a1, a2)); + } + break; + case 115: + HASH_GUARD(0x7F974836AACC1EF3LL, __destruct) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t___destruct()); + } + break; + case 116: + HASH_GUARD(0x25362C52A06A7DF4LL, remove_serverpool) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_remove_serverpool(a0), null); + } + HASH_GUARD(0x41DED45DAB6EA0F4LL, multi_set) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_multi_set(a0)); + if (count == 2) return (t_multi_set(a0, a1)); + if (count == 3) return (t_multi_set(a0, a1, a2)); + if (count == 4) return (t_multi_set(a0, a1, a2, a3)); + return (t_multi_set(a0, a1, a2, a3, a4)); + } + break; + case 117: + HASH_GUARD(0x1959BC64791572F5LL, add_server) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_add_server(a0)); + return (t_add_server(a0, a1)); + } + HASH_GUARD(0x17BE282CC008CE75LL, serverpool_get_consistent_hashing_version) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_serverpool_get_consistent_hashing_version(a0)); + } + break; + case 118: + HASH_GUARD(0x59A033953F63DBF6LL, add_accesspoint_listener) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + return (t_add_accesspoint_listener(a0, ref(a1))); + } + break; + case 122: + HASH_GUARD(0x0D41BFBA13C4317ALL, multi_replace) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 1) return (t_multi_replace(a0)); + if (count == 2) return (t_multi_replace(a0, a1)); + if (count == 3) return (t_multi_replace(a0, a1, a2)); + if (count == 4) return (t_multi_replace(a0, a1, a2, a3)); + return (t_multi_replace(a0, a1, a2, a3, a4)); + } + break; + case 124: + HASH_GUARD(0x4F2C2C1CCF05AB7CLL, remove_accesspoint) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + int count = params.size(); + if (count <= 2) return (t_remove_accesspoint(a0, a1), null); + if (count == 3) return (t_remove_accesspoint(a0, a1, a2), null); + return (t_remove_accesspoint(a0, a1, a2, a3), null); + } + break; + default: + break; + } + return c_ObjectData::o_invoke_from_eval(s, env, caller, hash, fatal); +} +Variant c_phpmcc::os_invoke_from_eval(const char *c, const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + return c_ObjectData::os_invoke_from_eval(c, s, env, caller, hash, fatal); +} +Variant cw_phpmcc$os_get(const char *s) { + return c_phpmcc::os_get(s, -1); +} +Variant &cw_phpmcc$os_lval(const char *s) { + return c_phpmcc::os_lval(s, -1); +} +Variant cw_phpmcc$os_constant(const char *s) { + return c_phpmcc::os_constant(s); +} +Variant cw_phpmcc$os_invoke(const char *c, const char *s, CArrRef params, bool fatal /* = true */) { + return c_phpmcc::os_invoke(c, s, params, -1, fatal); +} +Object create_builtin_object(const char *s, CArrRef params, bool init /* = true */,ObjectData* root /* = NULL*/) { + DECLARE_SYSTEM_GLOBALS(g); + int64 hash = hash_string_i(s); + switch (hash & 127) { + case 0: + HASH_CREATE_OBJECT(0x59B3EFD1CD987F80LL, domprocessinginstruction); + break; + case 2: + HASH_CREATE_OBJECT(0x33BD46E935281082LL, reflectionfunctionabstract); + break; + case 3: + HASH_CREATE_OBJECT(0x24DE53FD7D3E8383LL, datetimezone); + break; + case 4: + HASH_CREATE_OBJECT(0x70D4A29DE6A7BA84LL, domainexception); + break; + case 9: + HASH_CREATE_OBJECT(0x21EF70351574EC09LL, reflectionfunction); + break; + case 11: + HASH_CREATE_OBJECT(0x4365BE9E5A85E60BLL, domnotation); + break; + case 16: + HASH_CREATE_OBJECT(0x06335FF83CDEA590LL, badmethodcallexception); + break; + case 19: + HASH_CREATE_OBJECT(0x6A76B9AABB7CC713LL, simplexmlelement); + HASH_CREATE_OBJECT(0x2E7081C468A05993LL, reflectionparameter); + break; + case 20: + HASH_CREATE_OBJECT(0x6FFDF8DF15CABE94LL, domcdatasection); + HASH_CREATE_OBJECT(0x6576EACCCE24D694LL, __php_incomplete_class); + HASH_CREATE_OBJECT(0x47D93E6F80B66A94LL, exception); + break; + case 21: + HASH_CREATE_OBJECT(0x32E5C767255D2515LL, soapfault); + break; + case 24: + HASH_CREATE_OBJECT(0x3CEBA108A1BAB998LL, pear_error); + break; + case 26: + HASH_CREATE_OBJECT(0x5CBA5B52C68B501ALL, domentityreference); + break; + case 29: + HASH_CREATE_OBJECT(0x35A44A5E6AE2E71DLL, reflectionclass); + break; + case 30: + HASH_CREATE_OBJECT(0x3DB8FB455A602A1ELL, datetime); + break; + case 40: + HASH_CREATE_OBJECT(0x7D46DB2E09C6DBA8LL, domxpath); + break; + case 41: + HASH_CREATE_OBJECT(0x1D35C3EFD00E11A9LL, sqlite3); + break; + case 47: + HASH_CREATE_OBJECT(0x2E650138BA043AAFLL, domdocument); + break; + case 48: + HASH_CREATE_OBJECT(0x43BBC8F6F28E44B0LL, reflectionmethod); + break; + case 49: + HASH_CREATE_OBJECT(0x6DD772FA3B20B8B1LL, domnodelist); + break; + case 53: + HASH_CREATE_OBJECT(0x7909270014376235LL, soapvar); + break; + case 56: + HASH_CREATE_OBJECT(0x672AD818DDE95538LL, reflectionexception); + break; + case 62: + HASH_CREATE_OBJECT(0x49FC1A1F7B878C3ELL, soapserver); + break; + case 65: + HASH_CREATE_OBJECT(0x227C70ED5B143841LL, outofboundsexception); + break; + case 67: + HASH_CREATE_OBJECT(0x40B3C44077F5DDC3LL, domelement); + break; + case 70: + HASH_CREATE_OBJECT(0x196F76C9C527B946LL, domnamednodemap); + HASH_CREATE_OBJECT(0x66282FC8E4EF4E46LL, badfunctioncallexception); + break; + case 73: + HASH_CREATE_OBJECT(0x5AA2EE582E0D3849LL, unexpectedvalueexception); + break; + case 75: + HASH_CREATE_OBJECT(0x253AC17234FC8CCBLL, libxmlerror); + HASH_CREATE_OBJECT(0x4860DC2F9B0E6D4BLL, logicexception); + break; + case 77: + HASH_CREATE_OBJECT(0x164F490DAC49174DLL, domtext); + break; + case 78: + HASH_CREATE_OBJECT(0x308D1D59986A3D4ELL, soapheader); + break; + case 82: + HASH_CREATE_OBJECT(0x52E5CC58B841AED2LL, sqlite3stmt); + break; + case 83: + HASH_CREATE_OBJECT(0x02239AA5D64B1453LL, domcharacterdata); + HASH_CREATE_OBJECT(0x6AF83706F76A9D53LL, rangeexception); + break; + case 84: + HASH_CREATE_OBJECT(0x5E623FEAF7B068D4LL, underflowexception); + break; + case 89: + HASH_CREATE_OBJECT(0x0E4CCE95F6A727D9LL, overflowexception); + break; + case 90: + HASH_CREATE_OBJECT(0x7A52EBE538182BDALL, soapclient); + break; + case 92: + HASH_CREATE_OBJECT(0x1078CB3118A8B3DCLL, runtimeexception); + break; + case 97: + HASH_CREATE_OBJECT(0x70EBB2CC1FBF9761LL, domdocumenttype); + break; + case 98: + HASH_CREATE_OBJECT(0x70747A09B3523662LL, domnode); + break; + case 100: + HASH_CREATE_OBJECT(0x75AA2571BDB659E4LL, reflectionproperty); + break; + case 101: + HASH_CREATE_OBJECT(0x2FF1EF6EBB3DA065LL, xmlwriter); + break; + case 104: + HASH_CREATE_OBJECT(0x7E07B9C27FE59D68LL, domcomment); + HASH_CREATE_OBJECT(0x17A40D895C55D968LL, soapparam); + break; + case 106: + HASH_CREATE_OBJECT(0x6A5B99D5B1A4566ALL, domexception); + break; + case 107: + HASH_CREATE_OBJECT(0x3CAE91CFA2AAD16BLL, lengthexception); + break; + case 115: + HASH_CREATE_OBJECT(0x3D5870E53BF89873LL, arrayiterator); + HASH_CREATE_OBJECT(0x0B61E0BFCFA06573LL, reflectionextension); + break; + case 116: + HASH_CREATE_OBJECT(0x297174231D4912F4LL, domattr); + break; + case 117: + HASH_CREATE_OBJECT(0x085A4F6FD393D475LL, invalidargumentexception); + break; + case 118: + HASH_CREATE_OBJECT(0x3C57A5EF08527376LL, phpmcc); + break; + case 119: + HASH_CREATE_OBJECT(0x3D69936178BA13F7LL, stdclass); + break; + case 122: + HASH_CREATE_OBJECT(0x41A9F7D81254DD7ALL, reflectionobject); + break; + case 124: + HASH_CREATE_OBJECT(0x622D4DF07E2A01FCLL, outofrangeexception); + break; + case 125: + HASH_CREATE_OBJECT(0x7AD161197633B87DLL, domdocumentfragment); + HASH_CREATE_OBJECT(0x74419B70A46387FDLL, domimplementation); + HASH_CREATE_OBJECT(0x2E899D2A2572EF7DLL, sqlite3result); + break; + case 127: + HASH_CREATE_OBJECT(0x624835B2D74B86FFLL, domentity); + break; + default: + break; + } + return throw_missing_class(s); +} +Variant invoke_builtin_static_method(const char *s, const char *method, CArrRef params, bool fatal) { + DECLARE_SYSTEM_GLOBALS(g); + int64 hash = hash_string_i(s); + switch (hash & 127) { + case 0: + HASH_INVOKE_STATIC_METHOD(0x59B3EFD1CD987F80LL, domprocessinginstruction); + break; + case 2: + HASH_INVOKE_STATIC_METHOD(0x33BD46E935281082LL, reflectionfunctionabstract); + break; + case 3: + HASH_INVOKE_STATIC_METHOD(0x24DE53FD7D3E8383LL, datetimezone); + break; + case 4: + HASH_INVOKE_STATIC_METHOD(0x70D4A29DE6A7BA84LL, domainexception); + break; + case 9: + HASH_INVOKE_STATIC_METHOD(0x21EF70351574EC09LL, reflectionfunction); + break; + case 11: + HASH_INVOKE_STATIC_METHOD(0x4365BE9E5A85E60BLL, domnotation); + break; + case 16: + HASH_INVOKE_STATIC_METHOD(0x06335FF83CDEA590LL, badmethodcallexception); + break; + case 19: + HASH_INVOKE_STATIC_METHOD(0x6A76B9AABB7CC713LL, simplexmlelement); + HASH_INVOKE_STATIC_METHOD(0x2E7081C468A05993LL, reflectionparameter); + break; + case 20: + HASH_INVOKE_STATIC_METHOD(0x6FFDF8DF15CABE94LL, domcdatasection); + HASH_INVOKE_STATIC_METHOD(0x6576EACCCE24D694LL, __php_incomplete_class); + HASH_INVOKE_STATIC_METHOD(0x47D93E6F80B66A94LL, exception); + break; + case 21: + HASH_INVOKE_STATIC_METHOD(0x32E5C767255D2515LL, soapfault); + break; + case 24: + HASH_INVOKE_STATIC_METHOD(0x3CEBA108A1BAB998LL, pear_error); + break; + case 26: + HASH_INVOKE_STATIC_METHOD(0x5CBA5B52C68B501ALL, domentityreference); + break; + case 29: + HASH_INVOKE_STATIC_METHOD(0x35A44A5E6AE2E71DLL, reflectionclass); + break; + case 30: + HASH_INVOKE_STATIC_METHOD(0x3DB8FB455A602A1ELL, datetime); + break; + case 40: + HASH_INVOKE_STATIC_METHOD(0x7D46DB2E09C6DBA8LL, domxpath); + break; + case 41: + HASH_INVOKE_STATIC_METHOD(0x1D35C3EFD00E11A9LL, sqlite3); + break; + case 47: + HASH_INVOKE_STATIC_METHOD(0x2E650138BA043AAFLL, domdocument); + break; + case 48: + HASH_INVOKE_STATIC_METHOD(0x43BBC8F6F28E44B0LL, reflectionmethod); + break; + case 49: + HASH_INVOKE_STATIC_METHOD(0x6DD772FA3B20B8B1LL, domnodelist); + break; + case 53: + HASH_INVOKE_STATIC_METHOD(0x7909270014376235LL, soapvar); + break; + case 56: + HASH_INVOKE_STATIC_METHOD(0x672AD818DDE95538LL, reflectionexception); + break; + case 62: + HASH_INVOKE_STATIC_METHOD(0x49FC1A1F7B878C3ELL, soapserver); + break; + case 65: + HASH_INVOKE_STATIC_METHOD(0x227C70ED5B143841LL, outofboundsexception); + break; + case 67: + HASH_INVOKE_STATIC_METHOD(0x40B3C44077F5DDC3LL, domelement); + break; + case 70: + HASH_INVOKE_STATIC_METHOD(0x196F76C9C527B946LL, domnamednodemap); + HASH_INVOKE_STATIC_METHOD(0x66282FC8E4EF4E46LL, badfunctioncallexception); + break; + case 73: + HASH_INVOKE_STATIC_METHOD(0x5AA2EE582E0D3849LL, unexpectedvalueexception); + break; + case 75: + HASH_INVOKE_STATIC_METHOD(0x253AC17234FC8CCBLL, libxmlerror); + HASH_INVOKE_STATIC_METHOD(0x4860DC2F9B0E6D4BLL, logicexception); + break; + case 77: + HASH_INVOKE_STATIC_METHOD(0x164F490DAC49174DLL, domtext); + break; + case 78: + HASH_INVOKE_STATIC_METHOD(0x308D1D59986A3D4ELL, soapheader); + break; + case 82: + HASH_INVOKE_STATIC_METHOD(0x52E5CC58B841AED2LL, sqlite3stmt); + break; + case 83: + HASH_INVOKE_STATIC_METHOD(0x02239AA5D64B1453LL, domcharacterdata); + HASH_INVOKE_STATIC_METHOD(0x6AF83706F76A9D53LL, rangeexception); + break; + case 84: + HASH_INVOKE_STATIC_METHOD(0x5E623FEAF7B068D4LL, underflowexception); + break; + case 89: + HASH_INVOKE_STATIC_METHOD(0x0E4CCE95F6A727D9LL, overflowexception); + break; + case 90: + HASH_INVOKE_STATIC_METHOD(0x7A52EBE538182BDALL, soapclient); + break; + case 92: + HASH_INVOKE_STATIC_METHOD(0x1078CB3118A8B3DCLL, runtimeexception); + break; + case 97: + HASH_INVOKE_STATIC_METHOD(0x70EBB2CC1FBF9761LL, domdocumenttype); + break; + case 98: + HASH_INVOKE_STATIC_METHOD(0x70747A09B3523662LL, domnode); + break; + case 100: + HASH_INVOKE_STATIC_METHOD(0x75AA2571BDB659E4LL, reflectionproperty); + break; + case 101: + HASH_INVOKE_STATIC_METHOD(0x2FF1EF6EBB3DA065LL, xmlwriter); + break; + case 104: + HASH_INVOKE_STATIC_METHOD(0x7E07B9C27FE59D68LL, domcomment); + HASH_INVOKE_STATIC_METHOD(0x17A40D895C55D968LL, soapparam); + break; + case 106: + HASH_INVOKE_STATIC_METHOD(0x6A5B99D5B1A4566ALL, domexception); + break; + case 107: + HASH_INVOKE_STATIC_METHOD(0x3CAE91CFA2AAD16BLL, lengthexception); + break; + case 115: + HASH_INVOKE_STATIC_METHOD(0x3D5870E53BF89873LL, arrayiterator); + HASH_INVOKE_STATIC_METHOD(0x0B61E0BFCFA06573LL, reflectionextension); + break; + case 116: + HASH_INVOKE_STATIC_METHOD(0x297174231D4912F4LL, domattr); + break; + case 117: + HASH_INVOKE_STATIC_METHOD(0x085A4F6FD393D475LL, invalidargumentexception); + break; + case 118: + HASH_INVOKE_STATIC_METHOD(0x3C57A5EF08527376LL, phpmcc); + break; + case 119: + HASH_INVOKE_STATIC_METHOD(0x3D69936178BA13F7LL, stdclass); + break; + case 122: + HASH_INVOKE_STATIC_METHOD(0x41A9F7D81254DD7ALL, reflectionobject); + break; + case 124: + HASH_INVOKE_STATIC_METHOD(0x622D4DF07E2A01FCLL, outofrangeexception); + break; + case 125: + HASH_INVOKE_STATIC_METHOD(0x7AD161197633B87DLL, domdocumentfragment); + HASH_INVOKE_STATIC_METHOD(0x74419B70A46387FDLL, domimplementation); + HASH_INVOKE_STATIC_METHOD(0x2E899D2A2572EF7DLL, sqlite3result); + break; + case 127: + HASH_INVOKE_STATIC_METHOD(0x624835B2D74B86FFLL, domentity); + break; + default: + break; + } + if (fatal) { + return throw_missing_class(s); + } else { + Logger::Warning("call_user_func to non-existent class's method %s::%s", s, method); + return false; + } +} +Variant get_builtin_static_property(const char *s, const char *prop) { + DECLARE_SYSTEM_GLOBALS(g); + int64 hash = hash_string_i(s); + switch (hash & 127) { + case 0: + HASH_GET_STATIC_PROPERTY(0x59B3EFD1CD987F80LL, domprocessinginstruction); + break; + case 2: + HASH_GET_STATIC_PROPERTY(0x33BD46E935281082LL, reflectionfunctionabstract); + break; + case 3: + HASH_GET_STATIC_PROPERTY(0x24DE53FD7D3E8383LL, datetimezone); + break; + case 4: + HASH_GET_STATIC_PROPERTY(0x70D4A29DE6A7BA84LL, domainexception); + break; + case 9: + HASH_GET_STATIC_PROPERTY(0x21EF70351574EC09LL, reflectionfunction); + break; + case 11: + HASH_GET_STATIC_PROPERTY(0x4365BE9E5A85E60BLL, domnotation); + break; + case 16: + HASH_GET_STATIC_PROPERTY(0x06335FF83CDEA590LL, badmethodcallexception); + break; + case 19: + HASH_GET_STATIC_PROPERTY(0x6A76B9AABB7CC713LL, simplexmlelement); + HASH_GET_STATIC_PROPERTY(0x2E7081C468A05993LL, reflectionparameter); + break; + case 20: + HASH_GET_STATIC_PROPERTY(0x6FFDF8DF15CABE94LL, domcdatasection); + HASH_GET_STATIC_PROPERTY(0x6576EACCCE24D694LL, __php_incomplete_class); + HASH_GET_STATIC_PROPERTY(0x47D93E6F80B66A94LL, exception); + break; + case 21: + HASH_GET_STATIC_PROPERTY(0x32E5C767255D2515LL, soapfault); + break; + case 24: + HASH_GET_STATIC_PROPERTY(0x3CEBA108A1BAB998LL, pear_error); + break; + case 26: + HASH_GET_STATIC_PROPERTY(0x5CBA5B52C68B501ALL, domentityreference); + break; + case 29: + HASH_GET_STATIC_PROPERTY(0x35A44A5E6AE2E71DLL, reflectionclass); + break; + case 30: + HASH_GET_STATIC_PROPERTY(0x3DB8FB455A602A1ELL, datetime); + break; + case 40: + HASH_GET_STATIC_PROPERTY(0x7D46DB2E09C6DBA8LL, domxpath); + break; + case 41: + HASH_GET_STATIC_PROPERTY(0x1D35C3EFD00E11A9LL, sqlite3); + break; + case 47: + HASH_GET_STATIC_PROPERTY(0x2E650138BA043AAFLL, domdocument); + break; + case 48: + HASH_GET_STATIC_PROPERTY(0x43BBC8F6F28E44B0LL, reflectionmethod); + break; + case 49: + HASH_GET_STATIC_PROPERTY(0x6DD772FA3B20B8B1LL, domnodelist); + break; + case 53: + HASH_GET_STATIC_PROPERTY(0x7909270014376235LL, soapvar); + break; + case 56: + HASH_GET_STATIC_PROPERTY(0x672AD818DDE95538LL, reflectionexception); + break; + case 62: + HASH_GET_STATIC_PROPERTY(0x49FC1A1F7B878C3ELL, soapserver); + break; + case 65: + HASH_GET_STATIC_PROPERTY(0x227C70ED5B143841LL, outofboundsexception); + break; + case 67: + HASH_GET_STATIC_PROPERTY(0x40B3C44077F5DDC3LL, domelement); + break; + case 70: + HASH_GET_STATIC_PROPERTY(0x196F76C9C527B946LL, domnamednodemap); + HASH_GET_STATIC_PROPERTY(0x66282FC8E4EF4E46LL, badfunctioncallexception); + break; + case 73: + HASH_GET_STATIC_PROPERTY(0x5AA2EE582E0D3849LL, unexpectedvalueexception); + break; + case 75: + HASH_GET_STATIC_PROPERTY(0x253AC17234FC8CCBLL, libxmlerror); + HASH_GET_STATIC_PROPERTY(0x4860DC2F9B0E6D4BLL, logicexception); + break; + case 77: + HASH_GET_STATIC_PROPERTY(0x164F490DAC49174DLL, domtext); + break; + case 78: + HASH_GET_STATIC_PROPERTY(0x308D1D59986A3D4ELL, soapheader); + break; + case 82: + HASH_GET_STATIC_PROPERTY(0x52E5CC58B841AED2LL, sqlite3stmt); + break; + case 83: + HASH_GET_STATIC_PROPERTY(0x02239AA5D64B1453LL, domcharacterdata); + HASH_GET_STATIC_PROPERTY(0x6AF83706F76A9D53LL, rangeexception); + break; + case 84: + HASH_GET_STATIC_PROPERTY(0x5E623FEAF7B068D4LL, underflowexception); + break; + case 89: + HASH_GET_STATIC_PROPERTY(0x0E4CCE95F6A727D9LL, overflowexception); + break; + case 90: + HASH_GET_STATIC_PROPERTY(0x7A52EBE538182BDALL, soapclient); + break; + case 92: + HASH_GET_STATIC_PROPERTY(0x1078CB3118A8B3DCLL, runtimeexception); + break; + case 97: + HASH_GET_STATIC_PROPERTY(0x70EBB2CC1FBF9761LL, domdocumenttype); + break; + case 98: + HASH_GET_STATIC_PROPERTY(0x70747A09B3523662LL, domnode); + break; + case 100: + HASH_GET_STATIC_PROPERTY(0x75AA2571BDB659E4LL, reflectionproperty); + break; + case 101: + HASH_GET_STATIC_PROPERTY(0x2FF1EF6EBB3DA065LL, xmlwriter); + break; + case 104: + HASH_GET_STATIC_PROPERTY(0x7E07B9C27FE59D68LL, domcomment); + HASH_GET_STATIC_PROPERTY(0x17A40D895C55D968LL, soapparam); + break; + case 106: + HASH_GET_STATIC_PROPERTY(0x6A5B99D5B1A4566ALL, domexception); + break; + case 107: + HASH_GET_STATIC_PROPERTY(0x3CAE91CFA2AAD16BLL, lengthexception); + break; + case 115: + HASH_GET_STATIC_PROPERTY(0x3D5870E53BF89873LL, arrayiterator); + HASH_GET_STATIC_PROPERTY(0x0B61E0BFCFA06573LL, reflectionextension); + break; + case 116: + HASH_GET_STATIC_PROPERTY(0x297174231D4912F4LL, domattr); + break; + case 117: + HASH_GET_STATIC_PROPERTY(0x085A4F6FD393D475LL, invalidargumentexception); + break; + case 118: + HASH_GET_STATIC_PROPERTY(0x3C57A5EF08527376LL, phpmcc); + break; + case 119: + HASH_GET_STATIC_PROPERTY(0x3D69936178BA13F7LL, stdclass); + break; + case 122: + HASH_GET_STATIC_PROPERTY(0x41A9F7D81254DD7ALL, reflectionobject); + break; + case 124: + HASH_GET_STATIC_PROPERTY(0x622D4DF07E2A01FCLL, outofrangeexception); + break; + case 125: + HASH_GET_STATIC_PROPERTY(0x7AD161197633B87DLL, domdocumentfragment); + HASH_GET_STATIC_PROPERTY(0x74419B70A46387FDLL, domimplementation); + HASH_GET_STATIC_PROPERTY(0x2E899D2A2572EF7DLL, sqlite3result); + break; + case 127: + HASH_GET_STATIC_PROPERTY(0x624835B2D74B86FFLL, domentity); + break; + default: + break; + } + return null; +} +Variant *get_builtin_static_property_lv(const char *s, const char *prop) { + DECLARE_SYSTEM_GLOBALS(g); + int64 hash = hash_string_i(s); + switch (hash & 127) { + case 0: + HASH_GET_STATIC_PROPERTY_LV(0x59B3EFD1CD987F80LL, domprocessinginstruction); + break; + case 2: + HASH_GET_STATIC_PROPERTY_LV(0x33BD46E935281082LL, reflectionfunctionabstract); + break; + case 3: + HASH_GET_STATIC_PROPERTY_LV(0x24DE53FD7D3E8383LL, datetimezone); + break; + case 4: + HASH_GET_STATIC_PROPERTY_LV(0x70D4A29DE6A7BA84LL, domainexception); + break; + case 9: + HASH_GET_STATIC_PROPERTY_LV(0x21EF70351574EC09LL, reflectionfunction); + break; + case 11: + HASH_GET_STATIC_PROPERTY_LV(0x4365BE9E5A85E60BLL, domnotation); + break; + case 16: + HASH_GET_STATIC_PROPERTY_LV(0x06335FF83CDEA590LL, badmethodcallexception); + break; + case 19: + HASH_GET_STATIC_PROPERTY_LV(0x6A76B9AABB7CC713LL, simplexmlelement); + HASH_GET_STATIC_PROPERTY_LV(0x2E7081C468A05993LL, reflectionparameter); + break; + case 20: + HASH_GET_STATIC_PROPERTY_LV(0x6FFDF8DF15CABE94LL, domcdatasection); + HASH_GET_STATIC_PROPERTY_LV(0x6576EACCCE24D694LL, __php_incomplete_class); + HASH_GET_STATIC_PROPERTY_LV(0x47D93E6F80B66A94LL, exception); + break; + case 21: + HASH_GET_STATIC_PROPERTY_LV(0x32E5C767255D2515LL, soapfault); + break; + case 24: + HASH_GET_STATIC_PROPERTY_LV(0x3CEBA108A1BAB998LL, pear_error); + break; + case 26: + HASH_GET_STATIC_PROPERTY_LV(0x5CBA5B52C68B501ALL, domentityreference); + break; + case 29: + HASH_GET_STATIC_PROPERTY_LV(0x35A44A5E6AE2E71DLL, reflectionclass); + break; + case 30: + HASH_GET_STATIC_PROPERTY_LV(0x3DB8FB455A602A1ELL, datetime); + break; + case 40: + HASH_GET_STATIC_PROPERTY_LV(0x7D46DB2E09C6DBA8LL, domxpath); + break; + case 41: + HASH_GET_STATIC_PROPERTY_LV(0x1D35C3EFD00E11A9LL, sqlite3); + break; + case 47: + HASH_GET_STATIC_PROPERTY_LV(0x2E650138BA043AAFLL, domdocument); + break; + case 48: + HASH_GET_STATIC_PROPERTY_LV(0x43BBC8F6F28E44B0LL, reflectionmethod); + break; + case 49: + HASH_GET_STATIC_PROPERTY_LV(0x6DD772FA3B20B8B1LL, domnodelist); + break; + case 53: + HASH_GET_STATIC_PROPERTY_LV(0x7909270014376235LL, soapvar); + break; + case 56: + HASH_GET_STATIC_PROPERTY_LV(0x672AD818DDE95538LL, reflectionexception); + break; + case 62: + HASH_GET_STATIC_PROPERTY_LV(0x49FC1A1F7B878C3ELL, soapserver); + break; + case 65: + HASH_GET_STATIC_PROPERTY_LV(0x227C70ED5B143841LL, outofboundsexception); + break; + case 67: + HASH_GET_STATIC_PROPERTY_LV(0x40B3C44077F5DDC3LL, domelement); + break; + case 70: + HASH_GET_STATIC_PROPERTY_LV(0x196F76C9C527B946LL, domnamednodemap); + HASH_GET_STATIC_PROPERTY_LV(0x66282FC8E4EF4E46LL, badfunctioncallexception); + break; + case 73: + HASH_GET_STATIC_PROPERTY_LV(0x5AA2EE582E0D3849LL, unexpectedvalueexception); + break; + case 75: + HASH_GET_STATIC_PROPERTY_LV(0x253AC17234FC8CCBLL, libxmlerror); + HASH_GET_STATIC_PROPERTY_LV(0x4860DC2F9B0E6D4BLL, logicexception); + break; + case 77: + HASH_GET_STATIC_PROPERTY_LV(0x164F490DAC49174DLL, domtext); + break; + case 78: + HASH_GET_STATIC_PROPERTY_LV(0x308D1D59986A3D4ELL, soapheader); + break; + case 82: + HASH_GET_STATIC_PROPERTY_LV(0x52E5CC58B841AED2LL, sqlite3stmt); + break; + case 83: + HASH_GET_STATIC_PROPERTY_LV(0x02239AA5D64B1453LL, domcharacterdata); + HASH_GET_STATIC_PROPERTY_LV(0x6AF83706F76A9D53LL, rangeexception); + break; + case 84: + HASH_GET_STATIC_PROPERTY_LV(0x5E623FEAF7B068D4LL, underflowexception); + break; + case 89: + HASH_GET_STATIC_PROPERTY_LV(0x0E4CCE95F6A727D9LL, overflowexception); + break; + case 90: + HASH_GET_STATIC_PROPERTY_LV(0x7A52EBE538182BDALL, soapclient); + break; + case 92: + HASH_GET_STATIC_PROPERTY_LV(0x1078CB3118A8B3DCLL, runtimeexception); + break; + case 97: + HASH_GET_STATIC_PROPERTY_LV(0x70EBB2CC1FBF9761LL, domdocumenttype); + break; + case 98: + HASH_GET_STATIC_PROPERTY_LV(0x70747A09B3523662LL, domnode); + break; + case 100: + HASH_GET_STATIC_PROPERTY_LV(0x75AA2571BDB659E4LL, reflectionproperty); + break; + case 101: + HASH_GET_STATIC_PROPERTY_LV(0x2FF1EF6EBB3DA065LL, xmlwriter); + break; + case 104: + HASH_GET_STATIC_PROPERTY_LV(0x7E07B9C27FE59D68LL, domcomment); + HASH_GET_STATIC_PROPERTY_LV(0x17A40D895C55D968LL, soapparam); + break; + case 106: + HASH_GET_STATIC_PROPERTY_LV(0x6A5B99D5B1A4566ALL, domexception); + break; + case 107: + HASH_GET_STATIC_PROPERTY_LV(0x3CAE91CFA2AAD16BLL, lengthexception); + break; + case 115: + HASH_GET_STATIC_PROPERTY_LV(0x3D5870E53BF89873LL, arrayiterator); + HASH_GET_STATIC_PROPERTY_LV(0x0B61E0BFCFA06573LL, reflectionextension); + break; + case 116: + HASH_GET_STATIC_PROPERTY_LV(0x297174231D4912F4LL, domattr); + break; + case 117: + HASH_GET_STATIC_PROPERTY_LV(0x085A4F6FD393D475LL, invalidargumentexception); + break; + case 118: + HASH_GET_STATIC_PROPERTY_LV(0x3C57A5EF08527376LL, phpmcc); + break; + case 119: + HASH_GET_STATIC_PROPERTY_LV(0x3D69936178BA13F7LL, stdclass); + break; + case 122: + HASH_GET_STATIC_PROPERTY_LV(0x41A9F7D81254DD7ALL, reflectionobject); + break; + case 124: + HASH_GET_STATIC_PROPERTY_LV(0x622D4DF07E2A01FCLL, outofrangeexception); + break; + case 125: + HASH_GET_STATIC_PROPERTY_LV(0x7AD161197633B87DLL, domdocumentfragment); + HASH_GET_STATIC_PROPERTY_LV(0x74419B70A46387FDLL, domimplementation); + HASH_GET_STATIC_PROPERTY_LV(0x2E899D2A2572EF7DLL, sqlite3result); + break; + case 127: + HASH_GET_STATIC_PROPERTY_LV(0x624835B2D74B86FFLL, domentity); + break; + default: + break; + } + return NULL; +} +Variant get_builtin_class_constant(const char *s, const char *constant) { + DECLARE_SYSTEM_GLOBALS(g); + int64 hash = hash_string_i(s); + switch (hash & 127) { + case 0: + HASH_GET_CLASS_CONSTANT(0x59B3EFD1CD987F80LL, domprocessinginstruction); + break; + case 2: + HASH_GET_CLASS_CONSTANT(0x33BD46E935281082LL, reflectionfunctionabstract); + break; + case 3: + HASH_GET_CLASS_CONSTANT(0x24DE53FD7D3E8383LL, datetimezone); + break; + case 4: + HASH_GET_CLASS_CONSTANT(0x70D4A29DE6A7BA84LL, domainexception); + break; + case 9: + HASH_GET_CLASS_CONSTANT(0x21EF70351574EC09LL, reflectionfunction); + break; + case 11: + HASH_GET_CLASS_CONSTANT(0x4365BE9E5A85E60BLL, domnotation); + break; + case 16: + HASH_GET_CLASS_CONSTANT(0x06335FF83CDEA590LL, badmethodcallexception); + break; + case 19: + HASH_GET_CLASS_CONSTANT(0x6A76B9AABB7CC713LL, simplexmlelement); + HASH_GET_CLASS_CONSTANT(0x2E7081C468A05993LL, reflectionparameter); + break; + case 20: + HASH_GET_CLASS_CONSTANT(0x6FFDF8DF15CABE94LL, domcdatasection); + HASH_GET_CLASS_CONSTANT(0x6576EACCCE24D694LL, __php_incomplete_class); + HASH_GET_CLASS_CONSTANT(0x47D93E6F80B66A94LL, exception); + break; + case 21: + HASH_GET_CLASS_CONSTANT(0x32E5C767255D2515LL, soapfault); + break; + case 24: + HASH_GET_CLASS_CONSTANT(0x3CEBA108A1BAB998LL, pear_error); + break; + case 26: + HASH_GET_CLASS_CONSTANT(0x5CBA5B52C68B501ALL, domentityreference); + break; + case 29: + HASH_GET_CLASS_CONSTANT(0x35A44A5E6AE2E71DLL, reflectionclass); + break; + case 30: + HASH_GET_CLASS_CONSTANT(0x3DB8FB455A602A1ELL, datetime); + break; + case 40: + HASH_GET_CLASS_CONSTANT(0x7D46DB2E09C6DBA8LL, domxpath); + break; + case 41: + HASH_GET_CLASS_CONSTANT(0x1D35C3EFD00E11A9LL, sqlite3); + break; + case 47: + HASH_GET_CLASS_CONSTANT(0x2E650138BA043AAFLL, domdocument); + break; + case 48: + HASH_GET_CLASS_CONSTANT(0x43BBC8F6F28E44B0LL, reflectionmethod); + break; + case 49: + HASH_GET_CLASS_CONSTANT(0x6DD772FA3B20B8B1LL, domnodelist); + break; + case 53: + HASH_GET_CLASS_CONSTANT(0x7909270014376235LL, soapvar); + break; + case 56: + HASH_GET_CLASS_CONSTANT(0x672AD818DDE95538LL, reflectionexception); + break; + case 62: + HASH_GET_CLASS_CONSTANT(0x49FC1A1F7B878C3ELL, soapserver); + break; + case 65: + HASH_GET_CLASS_CONSTANT(0x227C70ED5B143841LL, outofboundsexception); + break; + case 67: + HASH_GET_CLASS_CONSTANT(0x40B3C44077F5DDC3LL, domelement); + break; + case 70: + HASH_GET_CLASS_CONSTANT(0x196F76C9C527B946LL, domnamednodemap); + HASH_GET_CLASS_CONSTANT(0x66282FC8E4EF4E46LL, badfunctioncallexception); + break; + case 73: + HASH_GET_CLASS_CONSTANT(0x5AA2EE582E0D3849LL, unexpectedvalueexception); + break; + case 75: + HASH_GET_CLASS_CONSTANT(0x253AC17234FC8CCBLL, libxmlerror); + HASH_GET_CLASS_CONSTANT(0x4860DC2F9B0E6D4BLL, logicexception); + break; + case 77: + HASH_GET_CLASS_CONSTANT(0x164F490DAC49174DLL, domtext); + break; + case 78: + HASH_GET_CLASS_CONSTANT(0x308D1D59986A3D4ELL, soapheader); + break; + case 82: + HASH_GET_CLASS_CONSTANT(0x52E5CC58B841AED2LL, sqlite3stmt); + break; + case 83: + HASH_GET_CLASS_CONSTANT(0x02239AA5D64B1453LL, domcharacterdata); + HASH_GET_CLASS_CONSTANT(0x6AF83706F76A9D53LL, rangeexception); + break; + case 84: + HASH_GET_CLASS_CONSTANT(0x5E623FEAF7B068D4LL, underflowexception); + break; + case 89: + HASH_GET_CLASS_CONSTANT(0x0E4CCE95F6A727D9LL, overflowexception); + break; + case 90: + HASH_GET_CLASS_CONSTANT(0x7A52EBE538182BDALL, soapclient); + break; + case 92: + HASH_GET_CLASS_CONSTANT(0x1078CB3118A8B3DCLL, runtimeexception); + break; + case 97: + HASH_GET_CLASS_CONSTANT(0x70EBB2CC1FBF9761LL, domdocumenttype); + break; + case 98: + HASH_GET_CLASS_CONSTANT(0x70747A09B3523662LL, domnode); + break; + case 100: + HASH_GET_CLASS_CONSTANT(0x75AA2571BDB659E4LL, reflectionproperty); + break; + case 101: + HASH_GET_CLASS_CONSTANT(0x2FF1EF6EBB3DA065LL, xmlwriter); + break; + case 104: + HASH_GET_CLASS_CONSTANT(0x7E07B9C27FE59D68LL, domcomment); + HASH_GET_CLASS_CONSTANT(0x17A40D895C55D968LL, soapparam); + break; + case 106: + HASH_GET_CLASS_CONSTANT(0x6A5B99D5B1A4566ALL, domexception); + break; + case 107: + HASH_GET_CLASS_CONSTANT(0x3CAE91CFA2AAD16BLL, lengthexception); + break; + case 115: + HASH_GET_CLASS_CONSTANT(0x3D5870E53BF89873LL, arrayiterator); + HASH_GET_CLASS_CONSTANT(0x0B61E0BFCFA06573LL, reflectionextension); + break; + case 116: + HASH_GET_CLASS_CONSTANT(0x297174231D4912F4LL, domattr); + break; + case 117: + HASH_GET_CLASS_CONSTANT(0x085A4F6FD393D475LL, invalidargumentexception); + break; + case 118: + HASH_GET_CLASS_CONSTANT(0x3C57A5EF08527376LL, phpmcc); + break; + case 119: + HASH_GET_CLASS_CONSTANT(0x3D69936178BA13F7LL, stdclass); + break; + case 122: + HASH_GET_CLASS_CONSTANT(0x41A9F7D81254DD7ALL, reflectionobject); + break; + case 124: + HASH_GET_CLASS_CONSTANT(0x622D4DF07E2A01FCLL, outofrangeexception); + break; + case 125: + HASH_GET_CLASS_CONSTANT(0x7AD161197633B87DLL, domdocumentfragment); + HASH_GET_CLASS_CONSTANT(0x74419B70A46387FDLL, domimplementation); + HASH_GET_CLASS_CONSTANT(0x2E899D2A2572EF7DLL, sqlite3result); + break; + case 127: + HASH_GET_CLASS_CONSTANT(0x624835B2D74B86FFLL, domentity); + break; + default: + break; + } + return null; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/sys/dynamic_table_constant.no.cpp b/src/lib/system/gen/sys/dynamic_table_constant.no.cpp new file mode 100644 index 0000000000000..b5e8822ae1bcc --- /dev/null +++ b/src/lib/system/gen/sys/dynamic_table_constant.no.cpp @@ -0,0 +1,7047 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +extern const int64 k_PATHINFO_BASENAME; +extern const int64 k_OPENSSL_VERSION_NUMBER; +extern const int64 k_CURLOPT_HEADERFUNCTION; +extern const int64 k_CURLOPT_INFILESIZE; +extern const int64 k_MW_ResourceLimitError; +extern const int64 k_MW_MeanSquaredErrorMetric; +extern const Variant k_NULL; +extern const int64 k_MW_ColorBurnCompositeOp; +extern const int64 k_PREG_SPLIT_DELIM_CAPTURE; +extern const int64 k_MW_ImpulseNoise; +extern const int64 k_PREG_GREP_INVERT; +extern const int64 k_MYSQLI_USE_RESULT; +extern const int64 k_T_COMMENT; +extern const int64 k_LOG_EMERG; +extern const int64 k_SIGXFSZ; +extern const int64 k_SOCKET_ENOMSG; +extern const int64 k_CURLOPT_INFILE; +extern const int64 k_IMAGETYPE_WBMP; +extern const int64 k_T_PRINT; +extern const int64 k_STREAM_REPORT_ERRORS; +extern const int64 k_PATHINFO_EXTENSION; +extern const int64 k_DEBUG_LOG_TRACE; +extern const int64 k_PHP_URL_PATH; +extern const int64 k_OCI_FETCHSTATEMENT_BY_ROW; +extern const int64 k_MW_MinEvaluateOperator; +extern const int64 k_PHP_URL_PASS; +extern const double k_M_2_SQRTPI; +extern const int64 k_XML_OPTION_CASE_FOLDING; +extern const int64 k_MYSQLI_TYPE_LONGLONG; +extern const int64 k_T_WHILE; +extern const int64 k_MW_NoCompositeOp; +extern const int64 k_T_ARRAY; +extern const int64 k_MW_HWBColorspace; +extern const int64 k_CURLOPT_SSL_VERIFYPEER; +extern const int64 k_U_UNDEFINED_SEGMENT_REFERENCE; +extern const int64 k_MW_UnframeMode; +extern const int64 k_MW_PeakAbsoluteErrorMetric; +extern const int64 k_U_REGEX_INVALID_BACK_REF; +extern const int64 k_MW_GreenChannel; +extern const int64 k_CURLOPT_POSTQUOTE; +extern const int64 k_OCI_D_FILE; +extern const int64 k_OPENSSL_CIPHER_RC2_128; +extern const int64 k_MW_CharPixel; +extern const int64 k_IMAGETYPE_TIFF_II; +extern const int64 k_INFO_MODULES; +extern const int64 k_CURLOPT_BUFFERSIZE; +extern const int64 k_MW_ShadePreview; +extern const int64 k_STREAM_SOCK_SEQPACKET; +extern const int64 k_SOCKET_ESPIPE; +extern const int64 k_DNS_NAPTR; +extern const int64 k_MW_AnyStretch; +extern const int64 k_T_ECHO; +extern const int64 k_IDNA_MALLOC_ERROR; +extern const int64 k_MYSQLI_GROUP_FLAG; +extern const int64 k_MYSQLI_REPORT_INDEX; +extern const int64 k_CREDITS_QA; +extern const int64 k_IMAGETYPE_TIFF_MM; +extern const int64 k_MW_NormalStretch; +extern const int64 k_MW_UndefinedPixel; +extern const int64 k_MW_UndefinedCap; +extern const int64 k_MYSQLI_NOT_NULL_FLAG; +extern const int64 k_IMAGETYPE_JPEG2000; +extern const int64 k_XSD_BASE64BINARY; +extern const int64 k_POSIX_W_OK; +extern const int64 k_OCI_B_BFILE; +extern const int64 k_XML_ERROR_UNKNOWN_ENCODING; +extern const int64 k_SIGABRT; +extern const int64 k_LIBXML_XINCLUDE; +extern const int64 k_MW_UnrecognizedDispose; +extern const int64 k_MW_OpacityChannel; +extern const int64 k_INFO_LICENSE; +extern const int64 k_MW_ColorizeCompositeOp; +extern const int64 k_MW_OutCompositeOp; +extern const int64 k_DNS_AAAA; +extern const int64 k_CURLE_FTP_COULDNT_STOR_FILE; +extern const int64 k_MW_DissolveCompositeOp; +extern const int64 k_GRAPHEME_EXTR_MAXBYTES; +extern const int64 k_IMAGETYPE_BMP; +extern const int64 k_CURLCLOSEPOLICY_CALLBACK; +extern const int64 k_MW_RootMeanSquaredErrorMetric; +extern const int64 k_SIGBABY; +extern const int64 k_MW_TrueColorType; +extern const int64 k_ASSERT_CALLBACK; +extern const int64 k_XSD_NEGATIVEINTEGER; +extern const int64 k_CURLINFO_CONNECT_TIME; +extern const int64 k_CASE_LOWER; +extern const int64 k_U_MALFORMED_EXPONENTIAL_PATTERN; +extern const int64 k_U_UNSUPPORTED_PROPERTY; +extern const int64 k_SOCKET_ENOSPC; +extern const double k_M_PI; +extern const int64 k_MSG_OOB; +extern const int64 k_LIBXML_NSCLEAN; +extern const int64 k_MW_JPEGCompression; +extern const int64 k_DOM_INVALID_CHARACTER_ERR; +extern const int64 k_CURLOPT_LOW_SPEED_LIMIT; +extern const int64 k_MB_CASE_LOWER; +extern const int64 k_CURLE_FTP_CANT_RECONNECT; +extern const int64 k_OCI_FETCHSTATEMENT_BY_COLUMN; +extern const int64 k_CURLOPT_POSTFIELDS; +extern const int64 k_MW_YCCColorspace; +extern const int64 k_SOCKET_EMULTIHOP; +extern const int64 k_T_BOOLEAN_AND; +extern const int64 k_OCI_TEMP_BLOB; +extern const int64 k_CREDITS_ALL; +extern const int64 k_STREAM_URL_STAT_LINK; +extern const int64 k_MW_UndefinedResolution; +extern const int64 k_SOCKET_ENOSTR; +extern const int64 k_STREAM_NOTIFY_FAILURE; +extern const int64 k_XML_ERROR_BINARY_ENTITY_REF; +extern const StaticString k_MCRYPT_IDEA; +extern const int64 k_U_REGEX_ERROR_LIMIT; +extern const int64 k_CURLE_SSL_CIPHER; +extern const int64 k_CURLOPT_PUT; +extern const int64 k_SOCK_DGRAM; +extern const int64 k_XSD_UNSIGNEDLONG; +extern const int64 k_T_CLASS; +extern const int64 k_T_WHITESPACE; +extern const int64 k_SOCKET_EISDIR; +extern const int64 k_SOCKET_ENOSYS; +extern const StaticString k_LIBXML_DOTTED_VERSION; +extern const int64 k_MW_LeftAlign; +extern const int64 k_SOCKET_ENOTTY; +extern const int64 k_LDAP_OPT_PROTOCOL_VERSION; +extern const int64 k_CURLM_OUT_OF_MEMORY; +extern const int64 k_SOCKET_EWOULDBLOCK; +extern const int64 k_DOM_INVALID_STATE_ERR; +extern const int64 k_CURLOPT_DNS_USE_GLOBAL_CACHE; +extern const int64 k_U_MISPLACED_ANCHOR_START; +extern const int64 k_IMAGETYPE_GIF; +extern const int64 k_POSIX_X_OK; +extern const int64 k_CURLM_OK; +extern const int64 k_MW_JPEGPreview; +extern const int64 k_DEBUG_LOG_DEFAULT; +extern const int64 k_MCRYPT_DEV_RANDOM; +extern const int64 k_OPENSSL_KEYTYPE_EC; +extern const int64 k_OPENSSL_KEYTYPE_DH; +extern const int64 k_SOCKET_ESOCKTNOSUPPORT; +extern const int64 k_CURLCLOSEPOLICY_SLOWEST; +extern const int64 k_MW_UndefinedType; +extern const int64 k_STREAM_FILTER_WRITE; +extern const int64 k_SEEK_SET; +extern const int64 k_MYSQLI_TIMESTAMP_FLAG; +extern const int64 k_CURLINFO_SSL_VERIFYRESULT; +extern const int64 k_SOCKET_EREMOTE; +extern const int64 k_MYSQLI_TYPE_LONG; +extern const int64 k_CURL_HTTP_VERSION_NONE; +extern const int64 k_MW_SaturationPreview; +extern const int64 k_CURLINFO_HTTP_CODE; +extern const int64 k_IMAGETYPE_JB2; +extern const int64 k_MW_MaxEvaluateOperator; +extern const int64 k_OCI_SYSOPER; +extern const int64 k_CURLOPT_PROXYUSERPWD; +extern const int64 k_MW_UnderlineDecoration; +extern const int64 k_T_IS_NOT_EQUAL; +extern const int64 k_ERA_D_T_FMT; +extern const int64 k_MYSQLI_TYPE_FLOAT; +extern const int64 k_IMAGETYPE_IFF; +extern const int64 k_MW_DstOverCompositeOp; +extern const int64 k_CREDITS_GENERAL; +extern const int64 k_MW_YCbCrColorspace; +extern const int64 k_SOCKET_ENETDOWN; +extern const int64 k_MW_DullPreview; +extern const int64 k_IMG_FILTER_BRIGHTNESS; +extern const int64 k_STREAM_MUST_SEEK; +extern const int64 k_GLOB_NOSORT; +extern const int64 k_MW_CorruptImageFatalError; +extern const int64 k_CURLFTPSSL_CONTROL; +extern const int64 k_DNS_HINFO; +extern const int64 k_U_BUFFER_OVERFLOW_ERROR; +extern const int64 k_U_INVALID_STATE_ERROR; +extern const int64 k_FILE_SKIP_EMPTY_LINES; +extern const int64 k_CURLMSG_DONE; +extern const int64 k_XML_ATTRIBUTE_ENUMERATION; +extern const int64 k_CURLINFO_SIZE_DOWNLOAD; +extern const int64 k_MW_RegistryWarning; +extern const int64 k_MW_NormalStyle; +extern const int64 k_CURLOPT_VERBOSE; +extern const int64 k_T_VARIABLE; +extern const int64 k_CURLE_FTP_BAD_DOWNLOAD_RESUME; +extern const int64 k_T_REQUIRE_ONCE; +extern const int64 k_MW_StreamWarning; +extern const int64 k_OCI_TEMP_CLOB; +extern const StaticString k_PHP_BINDIR; +extern const int64 k_MYSQLI_RPL_MASTER; +extern const int64 k_ICONV_MIME_DECODE_STRICT; +extern const int64 k_CURLOPT_URL; +extern const StaticString k_MCRYPT_GOST; +extern const int64 k_MW_QuadraticFilter; +extern const int64 k_MW_OpaqueOpacity; +extern const int64 k_U_RULE_MASK_ERROR; +extern const int64 k_MYSQLI_REPORT_STRICT; +extern const int64 k_MW_UndefinedStyle; +extern const int64 k_STREAM_NOTIFY_RESOLVE; +extern const int64 k_STREAM_IPPROTO_IP; +extern const int64 k_MW_NoCompression; +extern const int64 k_IMAGETYPE_JP2; +extern const int64 k_XSD_DURATION; +extern const int64 k_T_CLOSE_TAG; +extern const StaticString k_DATE_RFC822; +extern const int64 k_SOCKET_EL2NSYNC; +extern const int64 k_T_BREAK; +extern const int64 k_IMAGETYPE_JPC; +extern const int64 k_CURL_NETRC_OPTIONAL; +extern const int64 k_LC_TIME; +extern const int64 k_CURLE_FILESIZE_EXCEEDED; +extern const int64 k_DNS_A6; +extern const StaticString k_DATE_RFC850; +extern const int64 k_T_ELSE; +extern const int64 k_U_INVARIANT_CONVERSION_ERROR; +extern const int64 k_XSD_IDREFS; +extern const int64 k_T_OBJECT_CAST; +extern const int64 k_MW_FaxCompression; +extern const int64 k_CURLOPT_HTTP200ALIASES; +extern const int64 k_SIGALRM; +extern const int64 k_IMAGETYPE_JPX; +extern const int64 k_CURLE_BAD_PASSWORD_ENTERED; +extern const int64 k_SOAP_ENC_OBJECT; +extern const int64 k_T_FILE; +extern const int64 k_CREDITS_GROUP; +extern const int64 k_LOG_AUTH; +extern const int64 k_SOCKET_EDQUOT; +extern const int64 k_XSD_QNAME; +extern const int64 k_CURLOPT_TIMEOUT; +extern const int64 k_U_MISPLACED_CURSOR_OFFSET; +extern const int64 k_SOAP_ENCODED; +extern const int64 k_MW_SouthGravity; +extern const int64 k_PHP_URL_PORT; +extern const int64 k_LIBXML_NOEMPTYTAG; +extern const double k_M_SQRT2; +extern const double k_M_SQRT3; +extern const int64 k_MW_FileOpenWarning; +extern const int64 k_CURLOPT_UNRESTRICTED_AUTH; +extern const int64 k_D_T_FMT; +extern const int64 k_FILE_NO_DEFAULT_CONTEXT; +extern const int64 k_LOG_NOTICE; +extern const int64 k_MW_BackgroundDispose; +extern const int64 k_U_DIFFERENT_UCA_VERSION; +extern const int64 k_GLOB_BRACE; +extern const int64 k_E_COMPILE_WARNING; +extern const int64 k_MYSQLI_REPORT_ALL; +extern const int64 k_LIBXML_ERR_WARNING; +extern const int64 k_PSFS_PASS_ON; +extern const int64 k_STREAM_SOCK_RAW; +extern const int64 k_MW_SaturateCompositeOp; +extern const int64 k_INFO_ENVIRONMENT; +extern const int64 k_STREAM_SOCK_RDM; +extern const int64 k_U_INTERNAL_TRANSLITERATOR_ERROR; +extern const int64 k_FILE_IGNORE_NEW_LINES; +extern const int64 k_MW_OilPaintPreview; +extern const int64 k_CURLOPT_SSLENGINE; +extern const int64 k_SO_SNDBUF; +extern const int64 k_SOCKET_EISNAM; +extern const StaticString k_PATH_SEPARATOR; +extern const int64 k_MW_BlobWarning; +extern const int64 k_MW_RelativeIntent; +extern const int64 k_ERA_D_FMT; +extern const int64 k_MW_WarningException; +extern const int64 k_CURLINFO_NAMELOOKUP_TIME; +extern const int64 k_SOCKET_ESRMNT; +extern const int64 k_MYSQL_BOTH; +extern const int64 k_MW_ConfigureFatalError; +extern const int64 k_IMG_COLOR_STYLEDBRUSHED; +extern const int64 k_CURLCLOSEPOLICY_LEAST_TRAFFIC; +extern const int64 k_SOCKET_EREMOTEIO; +extern const int64 k_XSD_INTEGER; +extern const int64 k_XML_ERROR_PARTIAL_CHAR; +extern const int64 k_DNS_MX; +extern const int64 k_DNS_NS; +extern const int64 k_MW_FileOpenFatalError; +extern const int64 k_LOG_PERROR; +extern const int64 k_MW_SemiExpandedStretch; +extern const int64 k_MW_LABColorspace; +extern const int64 k_MW_HSLColorspace; +extern const int64 k_CURLOPT_FTPLISTONLY; +extern const int64 k_SOCKET_EMSGSIZE; +extern const int64 k_E_CORE_WARNING; +extern const int64 k_LOG_CONS; +extern const int64 k_CURLOPT_FAILONERROR; +extern const int64 k_MW_HardLightCompositeOp; +extern const int64 k_MW_TypeError; +extern const int64 k_T_SWITCH; +extern const int64 k_SOCKET_ECOMM; +extern const int64 k_T_REQUIRE; +extern const int64 k_XML_NOTATION_NODE; +extern const int64 k_T_DEFAULT; +extern const int64 k_IMG_JPEG; +extern const int64 k_DEBUG_LOG_NONE; +extern const int64 k_U_BRK_INTERNAL_ERROR; +extern const int64 k_CONNECTION_NORMAL; +extern const int64 k_MW_CopyBlueCompositeOp; +extern const int64 k_SIGCHLD; +extern const int64 k_U_BRK_MALFORMED_RULE_TAG; +extern const int64 k_EXTR_OVERWRITE; +extern const int64 k_INI_SYSTEM; +extern const StaticString k_XSD_1999_NAMESPACE; +extern const int64 k_X509_PURPOSE_ANY; +extern const int64 k_IMAGETYPE_PNG; +extern const int64 k_X509_PURPOSE_SSL_CLIENT; +extern const int64 k_STREAM_NOTIFY_SEVERITY_WARN; +extern const int64 k_LOG_ALERT; +extern const int64 k_MW_FileResource; +extern const int64 k_CURLE_SSL_CERTPROBLEM; +extern const int64 k_MSG_NOERROR; +extern const int64 k_XML_PI_NODE; +extern const int64 k_MW_ZipCompression; +extern const int64 k_LOG_CRIT; +extern const int64 k_CURLOPT_IPRESOLVE; +extern const int64 k_IMAGETYPE_PSD; +extern const int64 k_MW_ModuleWarning; +extern const StaticString k_PCRE_VERSION; +extern const int64 k_CURLOPT_NOBODY; +extern const int64 k_CURLOPT_EGDSOCKET; +extern const int64 k_CURLOPT_HTTPGET; +extern const int64 k_MW_HueCompositeOp; +extern const int64 k_T_EVAL; +extern const int64 k_LDAP_OPT_REFERRALS; +extern const int64 k_CURLE_UNSUPPORTED_PROTOCOL; +extern const int64 k_CURLE_SSL_PEER_CERTIFICATE; +extern const int64 k_T_CLONE; +extern const int64 k_SOCKET_EBUSY; +extern const int64 k_MW_SemiCondensedStretch; +extern const int64 k_CURL_VERSION_IPV6; +extern const int64 k_XML_ATTRIBUTE_DECL_NODE; +extern const int64 k_LOG_CRON; +extern const int64 k_MW_ReduceNoisePreview; +extern const int64 k_T_IMPLEMENTS; +extern const int64 k_T_FUNCTION; +extern const StaticString k_MCRYPT_DES; +extern const int64 k_MCRYPT_ENCRYPT; +extern const int64 k_INFO_CONFIGURATION; +extern const int64 k_IMG_FILTER_EDGEDETECT; +extern const int64 k_ABDAY_1; +extern const int64 k_SOCKET_ECONNRESET; +extern const int64 k_ABDAY_2; +extern const int64 k_ABDAY_3; +extern const int64 k_ABDAY_4; +extern const int64 k_STREAM_IS_URL; +extern const int64 k_ABDAY_5; +extern const int64 k_MW_UltraExpandedStretch; +extern const StaticString k_MCRYPT_3DES; +extern const int64 k_ABDAY_6; +extern const int64 k_ABDAY_7; +extern const int64 k_U_MULTIPLE_DECIMAL_SEPERATORS; +extern const int64 k_STREAM_CRYPTO_METHOD_TLS_SERVER; +extern const int64 k_MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH; +extern const int64 k_U_INVALID_PROPERTY_PATTERN; +extern const int64 k_U_TOO_MANY_ALIASES_ERROR; +extern const int64 k_PHP_URL_FRAGMENT; +extern const int64 k_U_UNTERMINATED_QUOTE; +extern const int64 k_U_MISPLACED_QUANTIFIER; +extern const StaticString k_DATE_W3C; +extern const int64 k_LC_MONETARY; +extern const int64 k_MW_CoderWarning; +extern const int64 k_SOCKET_ENOTCONN; +extern const int64 k_DNS_CNAME; +extern const int64 k_T_CURLY_OPEN; +extern const int64 k_U_BRK_UNRECOGNIZED_OPTION; +extern const int64 k_CURLE_OBSOLETE; +extern const int64 k_IMG_ARC_NOFILL; +extern const int64 k_U_INVALID_CHAR_FOUND; +extern const int64 k_MW_NonZeroRule; +extern const int64 k_MW_ConfigureWarning; +extern const int64 k_U_BRK_UNCLOSED_SET; +extern const int64 k_SORT_LOCALE_STRING; +extern const int64 k_MW_MitchellFilter; +extern const int64 k_XML_ERROR_NO_ELEMENTS; +extern const int64 k_U_INTERNAL_PROGRAM_ERROR; +extern const int64 k_IMAGETYPE_SWC; +extern const int64 k_IMAGETYPE_SWF; +extern const int64 k_MW_OverlayCompositeOp; +extern const StaticString k_DATE_RSS; +extern const int64 k_MW_sRGBColorspace; +extern const int64 k_YESEXPR; +extern const int64 k_IMG_EFFECT_NORMAL; +extern const int64 k_LOG_NOWAIT; +extern const int64 k_MW_UndefinedMethod; +extern const int64 k_T_EXIT; +extern const int64 k_MYSQLI_BLOB_FLAG; +extern const int64 k_T_NUM_STRING; +extern const int64 k_E_NOTICE; +extern const int64 k_IMAGETYPE_XBM; +extern const int64 k_CRYPT_STD_DES; +extern const int64 k_PRIO_USER; +extern const int64 k_STREAM_PF_UNIX; +extern const int64 k_MW_CoderFatalError; +extern const int64 k_XSD_GYEARMONTH; +extern const int64 k_CURLE_HTTP_PORT_FAILED; +extern const int64 k_CURLOPT_FTPAPPEND; +extern const int64 k_CURLOPT_FTP_CREATE_MISSING_DIRS; +extern const int64 k_MYSQLI_TYPE_NULL; +extern const int64 k_CURLINFO_CONTENT_TYPE; +extern const int64 k_XSD_NAME; +extern const int64 k_T_CONCAT_EQUAL; +extern const int64 k_PSFS_FLAG_NORMAL; +extern const int64 k_CURLE_HTTP_RANGE_ERROR; +extern const int64 k_U_MALFORMED_VARIABLE_DEFINITION; +extern const int64 k_XML_ENTITY_REF_NODE; +extern const int64 k_CLOCK_MONOTONIC; +extern const int64 k_T_INLINE_HTML; +extern const int64 k_MYSQLI_CLIENT_FOUND_ROWS; +extern const int64 k_CURLE_URL_MALFORMAT_USER; +extern const int64 k_CURLOPT_SSLKEYTYPE; +extern const int64 k_U_FMT_PARSE_ERROR_START; +extern const int64 k_CURL_VERSION_LIBZ; +extern const int64 k_E_STRICT; +extern const StaticString k_MCRYPT_TRIPLEDES; +extern const int64 k_STREAM_NOTIFY_PROGRESS; +extern const int64 k_MW_UndefinedStretch; +extern const int64 k_MW_TransparentOpacity; +extern const int64 k_SOCKET_ENOTBLK; +extern const int64 k_XSD_IDREF; +extern const int64 k_OCI_RETURN_LOBS; +extern const int64 k_MW_TriangleFilter; +extern const int64 k_SIGCONT; +extern const int64 k_CURLOPT_HTTPPROXYTUNNEL; +extern const int64 k_CURL_TIMECOND_LASTMOD; +extern const int64 k_SOCKET_EADDRINUSE; +extern const int64 k_MON_10; +extern const int64 k_MON_11; +extern const int64 k_MCC_ACCESSPOINT_DOWN; +extern const int64 k_MON_12; +extern const int64 k_XSD_INT; +extern const int64 k_OCI_B_CFILEE; +extern const int64 k_U_MISMATCHED_SEGMENT_DELIMITERS; +extern const int64 k_MYSQLI_TYPE_TIMESTAMP; +extern const int64 k_T_STATIC; +extern const int64 k_T_HALT_COMPILER; +extern const int64 k_SOCKET_ETOOMANYREFS; +extern const int64 k_XSD_ENTITY; +extern const int64 k_MW_XorCompositeOp; +extern const int64 k_STREAM_SERVER_BIND; +extern const int64 k_DOM_NO_DATA_ALLOWED_ERR; +extern const int64 k_OCI_LOB_BUFFER_FREE; +extern const int64 k_MW_GaussianNoise; +extern const StaticString k_MCRYPT_MARS; +extern const int64 k_LIBXML_DTDATTR; +extern const int64 k_T_BOOLEAN_OR; +extern const int64 k_U_BRK_SEMICOLON_EXPECTED; +extern const int64 k_SOCKET_ENOTDIR; +extern const int64 k_MW_MagentaChannel; +extern const int64 k_MYSQLI_REPORT_OFF; +extern const int64 k_CURLOPT_FOLLOWLOCATION; +extern const int64 k_CURLE_URL_MALFORMAT; +extern const int64 k_MYSQLI_CLIENT_INTERACTIVE; +extern const int64 k_MW_LeftShiftEvaluateOperator; +extern const int64 k_CURLOPT_MUTE; +extern const int64 k_MW_DrawWarning; +extern const bool k_TRUE; +extern const int64 k_LOG_SYSLOG; +extern const int64 k_IMG_FILTER_GAUSSIAN_BLUR; +extern const int64 k_T_ENCAPSED_AND_WHITESPACE; +extern const int64 k_STREAM_SERVER_LISTEN; +extern const int64 k_MW_SrcAtopCompositeOp; +extern const int64 k_SOCK_STREAM; +extern const int64 k_MW_ThresholdPreview; +extern const int64 k_XML_OPTION_SKIP_WHITE; +extern const int64 k_CURLE_READ_ERROR; +extern const int64 k_MW_MirrorVirtualPixelMethod; +extern const int64 k_MW_DespecklePreview; +extern const int64 k_U_PARSE_ERROR_START; +extern const int64 k_PNG_ALL_FILTERS; +extern const int64 k_XSD_LONG; +extern const int64 k_DEBUG_LOG_POST; +extern const int64 k_T_IS_NOT_IDENTICAL; +extern const int64 k_X509_PURPOSE_NS_SSL_SERVER; +extern const double k_M_LN2; +extern const int64 k_MW_SoftLightCompositeOp; +extern const double k_M_LN10; +extern const int64 k_T_ABSTRACT; +extern const int64 k_T_LNUMBER; +extern const int64 k_DEBUG_LOG_REFERER; +extern const int64 k_MSG_PEEK; +extern const StaticString k_MCRYPT_TWOFISH; +extern const int64 k_SIG_DFL; +extern const int64 k_MW_DisplaceCompositeOp; +extern const int64 k_U_ERROR_LIMIT; +extern const int64 k_ASSERT_QUIET_EVAL; +extern const int64 k_PKCS7_NOINTERN; +extern const int64 k_MW_LongPixel; +extern const int64 k_CRYPT_MD5; +extern const int64 k_MYSQLI_TYPE_SET; +extern const int64 k_LDAP_OPT_MATCHED_DN; +extern const int64 k_CURLOPT_USERPWD; +extern const StaticString k_DEFAULT_INCLUDE_PATH; +extern const int64 k_E_USER_NOTICE; +extern const int64 k_MW_CharcoalDrawingPreview; +extern const int64 k_MW_SubtractCompositeOp; +extern const int64 k_MW_CondensedStretch; +extern const int64 k_MW_CenterGravity; +extern const int64 k_CURLINFO_SPEED_UPLOAD; +extern const int64 k_GRAPHEME_EXTR_COUNT; +extern const int64 k_T_INCLUDE_ONCE; +extern const int64 k_MSG_DONTROUTE; +extern const int64 k_MW_OptimizeType; +extern const int64 k_WUNTRACED; +extern const int64 k_U_INVALID_ID; +extern const int64 k_CREDITS_MODULES; +extern const int64 k_MW_DivideEvaluateOperator; +extern const StaticString k_DATE_RFC1036; +extern const int64 k_U_INDEX_OUTOFBOUNDS_ERROR; +extern const int64 k_UPLOAD_ERR_FORM_SIZE; +extern const int64 k_LC_ALL; +extern const int64 k_XML_ERROR_INVALID_TOKEN; +extern const int64 k_CURLE_ABORTED_BY_CALLBACK; +extern const int64 k_SO_OOBINLINE; +extern const int64 k_MW_UndefinedMetric; +extern const StaticString k_DATE_RFC1123; +extern const int64 k_EXTR_PREFIX_SAME; +extern const int64 k_XML_DTD_NODE; +extern const int64 k_U_REGEX_MAX_LT_MIN; +extern const int64 k_MW_HSBColorspace; +extern const int64 k_MW_ForgetGravity; +extern const StaticString k_MCRYPT_RC2; +extern const int64 k_E_PARSE; +extern const int64 k_MW_ColorSeparationType; +extern const int64 k_MYSQLI_TYPE_DOUBLE; +extern const int64 k_MW_MonitorFatalError; +extern const StaticString k_MCRYPT_RC6; +extern const int64 k_CURLOPT_STDERR; +extern const int64 k_CURLE_MALFORMAT_USER; +extern const int64 k_CURLAUTH_ANY; +extern const int64 k_T_BOOL_CAST; +extern const int64 k_MW_StreamError; +extern const int64 k_XML_ERROR_TAG_MISMATCH; +extern const int64 k_LDAP_DEREF_FINDING; +extern const int64 k_MW_ResourceLimitWarning; +extern const int64 k_MW_XYZColorspace; +extern const int64 k_MW_ConcatenateMode; +extern const int64 k_SIG_ERR; +extern const int64 k_XHPROF_FLAGS_MEMORY; +extern const int64 k_GLOB_NOESCAPE; +extern const int64 k_T_LOGICAL_OR; +extern const int64 k_T_DOC_COMMENT; +extern const int64 k_XHPROF_FLAGS_NO_BUILTINS; +extern const int64 k_STREAM_FILTER_READ; +extern const int64 k_SORT_REGULAR; +extern const int64 k_MW_ThresholdCompositeOp; +extern const int64 k_CURLOPT_RESUME_FROM; +extern const int64 k_MW_RegistryFatalError; +extern const int64 k_FNM_CASEFOLD; +extern const int64 k_PHP_NORMAL_READ; +extern const int64 k_MW_MonitorError; +extern const int64 k_UPLOAD_ERR_NO_TMP_DIR; +extern const int64 k_IMG_EFFECT_ALPHABLEND; +extern const int64 k_CURLINFO_FILETIME; +extern const int64 k_T_XOR_EQUAL; +extern const int64 k_CURLOPT_FTPPORT; +extern const int64 k_U_MULTIPLE_ANTE_CONTEXTS; +extern const int64 k_MW_ImageWarning; +extern const int64 k_SIG_IGN; +extern const int64 k_XML_ERROR_INCORRECT_ENCODING; +extern const int64 k_MW_CorruptImageWarning; +extern const int64 k_AM_STR; +extern const int64 k_MW_YIQColorspace; +extern const int64 k_SOCKET_ENOTEMPTY; +extern const int64 k_SOAP_COMPRESSION_GZIP; +extern const int64 k_T_CONST; +extern const int64 k_UPLOAD_ERR_CANT_WRITE; +extern const int64 k_UPLOAD_ERR_PARTIAL; +extern const int64 k_WNOHANG; +extern const int64 k_CURLE_COULDNT_CONNECT; +extern const int64 k_MW_PlusCompositeOp; +extern const int64 k_CURLINFO_REDIRECT_TIME; +extern const int64 k_PNG_FILTER_NONE; +extern const int64 k_XML_ERROR_ASYNC_ENTITY; +extern const int64 k_MW_AtopCompositeOp; +extern const int64 k_PHP_OUTPUT_HANDLER_END; +extern const int64 k_PSFS_FLAG_FLUSH_CLOSE; +extern const int64 k_STREAM_CLIENT_PERSISTENT; +extern const double k_M_LNPI; +extern const int64 k_U_USING_DEFAULT_WARNING; +extern const int64 k_CURLFTPSSL_NONE; +extern const int64 k_CURLOPT_PORT; +extern const int64 k_SOCKET_EIDRM; +extern const int64 k_APACHE_MAP; +extern const int64 k_MCC_DOWN_ON_TIMEOUT; +extern const int64 k_CURLOPT_POST; +extern const int64 k_MYSQLI_SET_CHARSET_NAME; +extern const double k_M_SQRT1_2; +extern const int64 k_MW_BZipCompression; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv23_CLIENT; +extern const int64 k_LOG_NDELAY; +extern const int64 k_T_AS; +extern const int64 k_U_STATE_OLD_WARNING; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv2_CLIENT; +extern const int64 k_T_LOGICAL_AND; +extern const int64 k_DEBUG_LOG_ALL; +extern const int64 k_IMG_FILTER_NEGATE; +extern const int64 k_U_MISSING_OPERATOR; +extern const int64 k_T_DO; +extern const int64 k_STREAM_CLIENT_CONNECT; +extern const int64 k_SIGVTALRM; +extern const int64 k_PREG_BACKTRACK_LIMIT_ERROR; +extern const int64 k_T_IF; +extern const int64 k_MW_UndefinedPathUnits; +extern const int64 k_MW_AddCompositeOp; +extern const int64 k_CURLOPT_PROXYPORT; +extern const int64 k_U_SAFECLONE_ALLOCATED_WARNING; +extern const int64 k_PNG_FILTER_PAETH; +extern const int64 k_UPLOAD_ERR_EXTENSION; +extern const StaticString k_GD_EXTRA_VERSION; +extern const int64 k_U_CE_NOT_FOUND_ERROR; +extern const int64 k_SOCKET_ESHUTDOWN; +extern const int64 k_XSD_ANYTYPE; +extern const StaticString k_MCRYPT_LOKI97; +extern const int64 k_LOG_ODELAY; +extern const int64 k_ULOC_VALID_LOCALE; +extern const int64 k_MW_SpiffPreview; +extern const int64 k_MYSQLI_TYPE_VAR_STRING; +extern const int64 k_T_MINUS_EQUAL; +extern const int64 k_CURLOPT_BINARYTRANSFER; +extern const StaticString k_DATE_ATOM; +extern const int64 k_U_MULTIPLE_EXPONENTIAL_SYMBOLS; +extern const StaticString k_MCRYPT_BLOWFISH_COMPAT; +extern const int64 k_CURLOPT_NOSIGNAL; +extern const int64 k_MW_AddNoisePreview; +extern const int64 k_HTML_SPECIALCHARS; +extern const int64 k_MW_AreaResource; +extern const int64 k_T_PLUS_EQUAL; +extern const int64 k_CURLE_RECV_ERROR; +extern const int64 k_MW_FrameMode; +extern const int64 k_DAY_1; +extern const int64 k_DAY_2; +extern const int64 k_DAY_3; +extern const int64 k_CURLOPT_NOPROGRESS; +extern const int64 k_DAY_4; +extern const int64 k_MW_CopyRedCompositeOp; +extern const int64 k_DAY_5; +extern const int64 k_DAY_6; +extern const int64 k_DAY_7; +extern const int64 k_STREAM_CLIENT_ASYNC_CONNECT; +extern const int64 k_MW_BrightnessPreview; +extern const int64 k_PHP_URL_USER; +extern const StaticString k_PEAR_EXTENSION_DIR; +extern const int64 k_PHP_URL_SCHEME; +extern const int64 k_MW_UltraCondensedStretch; +extern const StaticString k_PHP_SYSCONFDIR; +extern const int64 k_U_REGEX_UNIMPLEMENTED; +extern const int64 k_T_SL; +extern const int64 k_MW_GammaPreview; +extern const int64 k_SOAP_USE_XSI_ARRAY_TYPE; +extern const int64 k_T_SR; +extern const int64 k_STREAM_MKDIR_RECURSIVE; +extern const int64 k_XML_ATTRIBUTE_NMTOKEN; +extern const int64 k_U_COLLATOR_VERSION_MISMATCH; +extern const int64 k_SOCKET_E2BIG; +extern const StaticString k_ICONV_VERSION; +extern const int64 k_POSIX_F_OK; +extern const int64 k_PKCS7_BINARY; +extern const int64 k_U_UNSUPPORTED_ERROR; +extern const int64 k_IMG_COLOR_TRANSPARENT; +extern const double k_M_1_PI; +extern const int64 k_MYSQLI_STORE_RESULT; +extern const int64 k_MW_WestGravity; +extern const int64 k_GLOB_ERR; +extern const int64 k_U_REGEX_MISMATCHED_PAREN; +extern const int64 k_U_TRAILING_BACKSLASH; +extern const int64 k_LOG_LOCAL0; +extern const int64 k_MW_GrayscaleType; +extern const int64 k_IMG_GD2_RAW; +extern const int64 k_LOG_LOCAL1; +extern const int64 k_U_MALFORMED_PRAGMA; +extern const int64 k_LOG_LOCAL2; +extern const int64 k_LOG_LOCAL3; +extern const int64 k_LOG_LOCAL4; +extern const int64 k_IDNA_ROUNDTRIP_VERIFY_ERROR; +extern const int64 k_MW_CopyBlackCompositeOp; +extern const int64 k_LOG_LOCAL5; +extern const int64 k_LOG_LOCAL6; +extern const int64 k_LOG_LOCAL7; +extern const int64 k_MW_OverlineDecoration; +extern const int64 k_CONNECTION_ABORTED; +extern const int64 k_MYSQLI_TYPE_TIME; +extern const int64 k_T_PAAMAYIM_NEKUDOTAYIM; +extern const int64 k_U_REGEX_NUMBER_TOO_BIG; +extern const int64 k_STREAM_NOTIFY_REDIRECTED; +extern const int64 k_CURLOPT_RANGE; +extern const int64 k_T_PUBLIC; +extern const int64 k_T_IS_SMALLER_OR_EQUAL; +extern const int64 k_U_BRK_UNDEFINED_VARIABLE; +extern const int64 k_T_DOUBLE_ARROW; +extern const int64 k_CURLOPT_MAXREDIRS; +extern const int64 k_CURLINFO_HEADER_SIZE; +extern const int64 k_MW_HammingFilter; +extern const int64 k_MW_ExpandedStretch; +extern const int64 k_MYSQLI_TYPE_TINY; +extern const int64 k_OCI_B_BIN; +extern const int64 k_SOCKET_EMEDIUMTYPE; +extern const int64 k_MW_DoublePixel; +extern const int64 k_E_WARNING; +extern const int64 k_ENT_COMPAT; +extern const int64 k_XML_ERROR_UNDEFINED_ENTITY; +extern const int64 k_MW_ReplaceCompositeOp; +extern const int64 k_MYSQLI_INIT_COMMAND; +extern const int64 k_CRNCYSTR; +extern const int64 k_T_LINE; +extern const int64 k_OCI_BOTH; +extern const StaticString k_MCRYPT_SAFERPLUS; +extern const int64 k_CURLE_BAD_CONTENT_ENCODING; +extern const int64 k_MYSQLI_CLIENT_COMPRESS; +extern const int64 k_LOG_INFO; +extern const StaticString k_DATE_RFC2822; +extern const int64 k_LOG_AUTHPRIV; +extern const int64 k_CURLM_INTERNAL_ERROR; +extern const int64 k_PKCS7_NOATTR; +extern const StaticString k_OPENSSL_VERSION_TEXT; +extern const StaticString k_DATE_RFC3339; +extern const StaticString k_PHP_VERSION; +extern const int64 k_PREG_OFFSET_CAPTURE; +extern const int64 k_OCI_NUM; +extern const int64 k_MSG_WAITALL; +extern const int64 k_SOCKET_EISCONN; +extern const StaticString k_MCRYPT_ARCFOUR; +extern const int64 k_XSD_DOUBLE; +extern const int64 k_XML_ERROR_NONE; +extern const int64 k_SOCKET_EL2HLT; +extern const int64 k_XSD_HEXBINARY; +extern const int64 k_T_UNSET_CAST; +extern const int64 k_CURLE_FTP_COULDNT_SET_BINARY; +extern const int64 k_MSG_EAGAIN; +extern const int64 k_T_LIST; +extern const int64 k_CURLE_FTP_WRITE_ERROR; +extern const int64 k_CURLOPT_CONNECTTIMEOUT; +extern const int64 k_CURLE_HTTP_POST_ERROR; +extern const int64 k_MW_QuantumRange; +extern const int64 k_D_FMT; +extern const int64 k_SO_REUSEADDR; +extern const int64 k_U_UNCLOSED_SEGMENT; +extern const int64 k_PNG_NO_FILTER; +extern const int64 k_CURLM_BAD_EASY_HANDLE; +extern const double k_M_EULER; +extern const int64 k_MW_HanningFilter; +extern const int64 k_CURLOPT_READFUNCTION; +extern const int64 k_U_UNSUPPORTED_ESCAPE_SEQUENCE; +extern const int64 k_MW_MemoryResource; +extern const int64 k_XSD_DECIMAL; +extern const int64 k_MW_MultiplyEvaluateOperator; +extern const int64 k_ERA_T_FMT; +extern const int64 k_MYSQLI_TYPE_TINY_BLOB; +extern const int64 k_U_FILE_ACCESS_ERROR; +extern const int64 k_U_MULTIPLE_COMPOUND_FILTERS; +extern const int64 k_POSIX_S_IFBLK; +extern const double k_M_2_PI; +extern const int64 k_MCC_ACCESSPOINT_UP; +extern const int64 k_MW_UndefinedDecoration; +extern const StaticString k_XSD_NAMESPACE; +extern const int64 k_U_BRK_HEX_DIGITS_EXPECTED; +extern const int64 k_UNKNOWN_TYPE; +extern const int64 k_MW_FloodfillMethod; +extern const int64 k_XSD_1999_TIMEINSTANT; +extern const int64 k_POSIX_S_IFCHR; +extern const int64 k_CURLE_FTP_COULDNT_SET_ASCII; +extern const int64 k_U_STRING_NOT_TERMINATED_WARNING; +extern const int64 k_DOM_VALIDATION_ERR; +extern const int64 k_SOCKET_EMFILE; +extern const int64 k_LOG_KERN; +extern const int64 k_SOCKET_EINTR; +extern const StaticString k_DATE_COOKIE; +extern const int64 k_GLOB_ONLYDIR; +extern const int64 k_XML_NAMESPACE_DECL_NODE; +extern const int64 k_CURLOPT_FTP_USE_EPRT; +extern const int64 k_LIBXML_ERR_ERROR; +extern const int64 k_MW_SpreadPreview; +extern const StaticString k_ICONV_IMPL; +extern const int64 k_IMG_ARC_CHORD; +extern const int64 k_MW_EdgeVirtualPixelMethod; +extern const int64 k_MYSQLI_TYPE_GEOMETRY; +extern const int64 k_T_END_HEREDOC; +extern const int64 k_CURLOPT_FTP_USE_EPSV; +extern const int64 k_SOAP_COMPRESSION_DEFLATE; +extern const int64 k_ULOC_ACTUAL_LOCALE; +extern const int64 k_LIBXML_ERR_NONE; +extern const double k_M_LOG10E; +extern const int64 k_CURLINFO_REDIRECT_COUNT; +extern const int64 k_IDNA_STRINGPREP_ERROR; +extern const int64 k_CURLINFO_CONTENT_LENGTH_UPLOAD; +extern const int64 k_LIBXML_NOWARNING; +extern const int64 k_U_BRK_ASSIGN_ERROR; +extern const int64 k_MW_LaplacianNoise; +extern const int64 k_XSD_SHORT; +extern const int64 k_MYSQLI_CLIENT_IGNORE_SPACE; +extern const int64 k_XML_DOCUMENT_TYPE_NODE; +extern const int64 k_U_AMBIGUOUS_ALIAS_WARNING; +extern const int64 k_MW_LanczosFilter; +extern const int64 k_LOCK_EX; +extern const int64 k_CURLE_LDAP_SEARCH_FAILED; +extern const int64 k_FNM_PERIOD; +extern const int64 k_MW_MonitorWarning; +extern const int64 k_AF_UNIX; +extern const int64 k_T_SR_EQUAL; +extern const int64 k_MB_CASE_TITLE; +extern const int64 k_SOCKET_EL3HLT; +extern const int64 k_MYSQLI_READ_DEFAULT_FILE; +extern const int64 k_MYSQLI_TYPE_NEWDATE; +extern const int64 k_MYSQLI_TYPE_LONG_BLOB; +extern const int64 k_XML_ATTRIBUTE_CDATA; +extern const int64 k_LOCK_NB; +extern const int64 k_MCRYPT_RAND; +extern const int64 k_XSD_NOTATION; +extern const int64 k_MYSQLI_UNSIGNED_FLAG; +extern const int64 k_GRAPHEME_EXTR_MAXCHARS; +extern const int64 k_MW_NoDecoration; +extern const int64 k_U_MULTIPLE_PERCENT_SYMBOLS; +extern const int64 k_OPENSSL_KEYTYPE_DSA; +extern const int64 k_IMG_FILTER_MEAN_REMOVAL; +extern const int64 k_U_BRK_VARIABLE_REDFINITION; +extern const int64 k_CURLOPT_KRB4LEVEL; +extern const int64 k_SO_SNDLOWAT; +extern const int64 k_CURLOPT_SSLKEY; +extern const int64 k_ABMON_10; +extern const int64 k_MW_SrcOverCompositeOp; +extern const int64 k_ABMON_11; +extern const int64 k_ABMON_12; +extern const int64 k_MW_SrcOutCompositeOp; +extern const int64 k_LOG_MAIL; +extern const int64 k_OCI_B_INT; +extern const int64 k_MW_CopyOpacityCompositeOp; +extern const int64 k_LDAP_OPT_TIMELIMIT; +extern const int64 k_U_FMT_PARSE_ERROR_LIMIT; +extern const int64 k_LOCK_SH; +extern const int64 k_LDAP_OPT_CLIENT_CONTROLS; +extern const int64 k_SOCKET_EINPROGRESS; +extern const int64 k_STREAM_NOTIFY_AUTH_REQUIRED; +extern const int64 k_PREG_BAD_UTF8_ERROR; +extern const int64 k_IMG_ARC_ROUNDED; +extern const int64 k_CURLOPT_HTTP_VERSION; +extern const int64 k_CURLOPT_CAINFO; +extern const int64 k_DOM_NOT_FOUND_ERR; +extern const int64 k_CURLE_SEND_ERROR; +extern const int64 k_LOCK_UN; +extern const int64 k_CURLOPT_RANDOM_FILE; +extern const int64 k_POSIX_S_IFIFO; +extern const int64 k_MW_CoderError; +extern const int64 k_SO_LINGER; +extern const int64 k_U_ILLEGAL_CHAR_IN_SEGMENT; +extern const int64 k_CURLE_GOT_NOTHING; +extern const int64 k_PHP_INT_MAX; +extern const StaticString k_MCRYPT_MODE_CBC; +extern const int64 k_T_EXTENDS; +extern const int64 k_UPLOAD_ERR_NO_FILE; +extern const double k_M_PI_2; +extern const double k_M_PI_4; +extern const int64 k_CURLOPT_SSLVERSION; +extern const int64 k_SUNFUNCS_RET_DOUBLE; +extern const int64 k_XSD_DATETIME; +extern const int64 k_MYSQL_CLIENT_IGNORE_SPACE; +extern const int64 k_MW_SouthWestGravity; +extern const int64 k_XML_ATTRIBUTE_NOTATION; +extern const StaticString k_MCRYPT_MODE_CFB; +extern const int64 k_CURLM_CALL_MULTI_PERFORM; +extern const int64 k_HTML_ENTITIES; +extern const int64 k_CREDITS_DOCS; +extern const int64 k_MYSQLI_TYPE_STRING; +extern const int64 k_MSG_ENOMSG; +extern const int64 k_MW_PaletteType; +extern const int64 k_X509_PURPOSE_CRL_SIGN; +extern const int64 k_IMG_FILTER_SMOOTH; +extern const int64 k_IMG_COLOR_STYLED; +extern const int64 k_XSD_ANYURI; +extern const int64 k_STREAM_NOTIFY_SEVERITY_ERR; +extern const int64 k_XML_HTML_DOCUMENT_NODE; +extern const int64 k_DEBUG_LOG_USER; +extern const int64 k_MW_ObjectBoundingBox; +extern const int64 k_MW_WavePreview; +extern const int64 k_XML_ERROR_DUPLICATE_ATTRIBUTE; +extern const int64 k_U_PARSE_ERROR_LIMIT; +extern const int64 k_LOG_DEBUG; +extern const StaticString k_MCRYPT_MODE_ECB; +extern const int64 k_MW_ScreenCompositeOp; +extern const int64 k_STREAM_NOTIFY_COMPLETED; +extern const int64 k_IDNA_ICONV_ERROR; +extern const int64 k_X509_PURPOSE_SSL_SERVER; +extern const StaticString k_DIRECTORY_SEPARATOR; +extern const int64 k_ASSERT_BAIL; +extern const int64 k_CRYPT_EXT_DES; +extern const int64 k_UPLOAD_ERR_INI_SIZE; +extern const int64 k_MW_RightShiftEvaluateOperator; +extern const int64 k_MW_OptionError; +extern const int64 k_GLOB_AVAILABLE_FLAGS; +extern const int64 k_MW_AddEvaluateOperator; +extern const int64 k_U_REGEX_BAD_INTERVAL; +extern const int64 k_U_MALFORMED_UNICODE_ESCAPE; +extern const int64 k_XSD_NORMALIZEDSTRING; +extern const int64 k_WSDL_CACHE_BOTH; +extern const int64 k_SOAP_COMPRESSION_ACCEPT; +extern const int64 k_CURL_NETRC_IGNORED; +extern const int64 k_CURLE_BAD_FUNCTION_ARGUMENT; +extern const int64 k_XML_COMMENT_NODE; +extern const int64 k_XSD_ANYXML; +extern const int64 k_CURLE_FTP_QUOTE_ERROR; +extern const int64 k_MW_UndefinedGravity; +extern const int64 k_U_BRK_RULE_SYNTAX; +extern const int64 k_U_MISSING_SEGMENT_CLOSE; +extern const int64 k_T_METHOD_C; +extern const int64 k_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; +extern const int64 k_U_STRINGPREP_UNASSIGNED_ERROR; +extern const int64 k_U_PATTERN_SYNTAX_ERROR; +extern const int64 k_ASSERT_WARNING; +extern const int64 k_SO_ERROR; +extern const int64 k_MW_OptionFatalError; +extern const int64 k_CURLE_FTP_WEIRD_227_FORMAT; +extern const int64 k_T_INCLUDE; +extern const int64 k_SOCKET_EUNATCH; +extern const int64 k_MW_ColorSeparationMatteType; +extern const int64 k_OCI_B_NUM; +extern const int64 k_MSG_IPC_NOWAIT; +extern const int64 k_CURLAUTH_GSSNEGOTIATE; +extern const int64 k_MW_RoundCap; +extern const int64 k_CURLE_COULDNT_RESOLVE_PROXY; +extern const int64 k_U_ILLEGAL_ARGUMENT_ERROR; +extern const int64 k_OCI_B_NTY; +extern const int64 k_SOL_TCP; +extern const int64 k_LDAP_OPT_ERROR_NUMBER; +extern const int64 k_MW_PaletteMatteType; +extern const int64 k_ABMON_1; +extern const int64 k_ABMON_2; +extern const int64 k_ABMON_3; +extern const int64 k_ABMON_4; +extern const int64 k_CURLOPT_FILETIME; +extern const int64 k_ABMON_5; +extern const int64 k_ABMON_6; +extern const int64 k_IMG_GD2_COMPRESSED; +extern const int64 k_MW_DifferenceCompositeOp; +extern const int64 k_ABMON_7; +extern const int64 k_ABMON_8; +extern const int64 k_CRYPT_SALT_LENGTH; +extern const int64 k_ABMON_9; +extern const double k_M_LOG2E; +extern const int64 k_XML_TEXT_NODE; +extern const int64 k_DOM_INDEX_SIZE_ERR; +extern const int64 k_DEBUG_LOG_URL; +extern const int64 k_CURLOPT_SSL_CIPHER_LIST; +extern const int64 k_SIGKILL; +extern const int64 k_U_VARIABLE_RANGE_OVERLAP; +extern const int64 k_MW_RaisePreview; +extern const int64 k_CURLOPT_REFERER; +extern const int64 k_T_THROW; +extern const int64 k_SOL_UDP; +extern const int64 k_SOAP_ENC_ARRAY; +extern const int64 k_MW_BlackmanFilter; +extern const int64 k_MW_OverCompositeOp; +extern const int64 k_U_REGEX_SET_CONTAINS_STRING; +extern const int64 k_MW_UndefinedColorspace; +extern const int64 k_CURL_VERSION_KERBEROS4; +extern const int64 k_PSFS_FLAG_FLUSH_INC; +extern const int64 k_PHP_OUTPUT_HANDLER_CONT; +extern const int64 k_CURLOPT_TRANSFERTEXT; +extern const int64 k_IMG_COLOR_BRUSHED; +extern const int64 k_OCI_SYSDBA; +extern const int64 k_CURLOPT_COOKIE; +extern const int64 k_CURLE_OPERATION_TIMEOUTED; +extern const int64 k_OPENSSL_SSLV23_PADDING; +extern const int64 k_T_ARRAY_CAST; +extern const int64 k_SO_RCVLOWAT; +extern const int64 k_WSDL_CACHE_DISK; +extern const int64 k_POSIX_S_IFREG; +extern const int64 k_MYSQLI_REPORT_ERROR; +extern const int64 k_U_INVALID_FORMAT_ERROR; +extern const int64 k_T_LOGICAL_XOR; +extern const int64 k_SOAP_ACTOR_NEXT; +extern const int64 k_OCI_DEFAULT; +extern const int64 k_CURLCLOSEPOLICY_LEAST_RECENTLY_USED; +extern const int64 k_MYSQLI_TYPE_YEAR; +extern const int64 k_T_PROTECTED; +extern const int64 k_SOCKET_EL3RST; +extern const int64 k_U_MALFORMED_VARIABLE_REFERENCE; +extern const int64 k_MW_BlackChannel; +extern const int64 k_MW_ExclusionCompositeOp; +extern const int64 k_CURL_VERSION_SSL; +extern const int64 k_CURLVERSION_NOW; +extern const int64 k_MW_PointMethod; +extern const int64 k_MW_PartitionInterlace; +extern const int64 k_FORCE_DEFLATE; +extern const int64 k_U_MALFORMED_SYMBOL_REFERENCE; +extern const int64 k_MW_YPbPrColorspace; +extern const int64 k_SOCKET_ELOOP; +extern const int64 k_XSD_TIME; +extern const int64 k_SOCKET_EEXIST; +extern const int64 k_DOMSTRING_SIZE_ERR; +extern const int64 k_SO_BROADCAST; +extern const int64 k_PM_STR; +extern const int64 k_MW_ErrorException; +extern const int64 k_CURLE_HTTP_NOT_FOUND; +extern const int64 k_EXTR_PREFIX_ALL; +extern const int64 k_OCI_SEEK_CUR; +extern const int64 k_SOCKET_ECHRNG; +extern const int64 k_OCI_SEEK_END; +extern const int64 k_XML_ENTITY_NODE; +extern const int64 k_MW_PixelsPerInchResolution; +extern const int64 k_T_OBJECT_OPERATOR; +extern const int64 k_MW_CorruptImageError; +extern const int64 k_STREAM_PEEK; +extern const int64 k_IMG_COLOR_TILED; +extern const int64 k_LOG_NEWS; +extern const int64 k_MW_CatromFilter; +extern const int64 k_PKCS7_TEXT; +extern const int64 k_MW_RightAlign; +extern const int64 k_MYSQL_NUM; +extern const int64 k_CURLE_FILE_COULDNT_READ_FILE; +extern const int64 k_SOCKET_EUSERS; +extern const int64 k_CURLOPT_LOW_SPEED_TIME; +extern const int64 k_PHP_BINARY_READ; +extern const int64 k_STR_PAD_BOTH; +extern const int64 k_U_REGEX_PROPERTY_SYNTAX; +extern const int64 k_STREAM_FILTER_ALL; +extern const int64 k_CURLAUTH_DIGEST; +extern const int64 k_XSD_UNSIGNEDSHORT; +extern const int64 k_CURL_IPRESOLVE_WHATEVER; +extern const int64 k_SIGIO; +extern const int64 k_T_ENDSWITCH; +extern const int64 k_LDAP_OPT_SIZELIMIT; +extern const StaticString k_OCI_SYSDATE; +extern const int64 k_MW_SubtractEvaluateOperator; +extern const int64 k_MYSQLI_RPL_SLAVE; +extern const int64 k_STREAM_SHUT_RD; +extern const int64 k_SOAP_1_1; +extern const int64 k_DOM_PHP_ERR; +extern const int64 k_SOAP_1_2; +extern const int64 k_OPENSSL_KEYTYPE_RSA; +extern const int64 k_PNG_FILTER_UP; +extern const int64 k_EXTR_REFS; +extern const int64 k_OPENSSL_CIPHER_DES; +extern const int64 k_E_ALL; +extern const int64 k_LIBXML_NOENT; +extern const int64 k_U_USING_FALLBACK_WARNING; +extern const int64 k_MW_BlendCompositeOp; +extern const StaticString k_HPHP_TRIM_CHARLIST; +extern const int64 k_MYSQL_CLIENT_COMPRESS; +extern const int64 k_E_USER_ERROR; +extern const int64 k_SOAP_PERSISTENCE_REQUEST; +extern const int64 k_T_MUL_EQUAL; +extern const int64 k_MW_IndexChannel; +extern const int64 k_U_ILLEGAL_CHAR_FOUND; +extern const int64 k_OPENSSL_PKCS1_PADDING; +extern const int64 k_PHP_INT_SIZE; +extern const int64 k_CURLE_FTP_SSL_FAILED; +extern const int64 k_CURLE_FTP_ACCESS_DENIED; +extern const int64 k_CURLE_TOO_MANY_REDIRECTS; +extern const int64 k_STREAM_USE_PATH; +extern const int64 k_MW_DelegateWarning; +extern const StaticString k_MCRYPT_MODE_OFB; +extern const int64 k_CURLE_FTP_COULDNT_USE_REST; +extern const int64 k_T_PRIVATE; +extern const int64 k_STREAM_SHUT_WR; +extern const StaticString k_DATE_ISO8601; +extern const int64 k_CURLE_LDAP_CANNOT_BIND; +extern const int64 k_IDNA_INVALID_LENGTH; +extern const int64 k_LDAP_DEREF_ALWAYS; +extern const int64 k_XML_ERROR_BAD_CHAR_REF; +extern const int64 k_XSD_STRING; +extern const int64 k_IMG_ARC_PIE; +extern const int64 k_SOCKET_ECONNREFUSED; +extern const int64 k_PKCS7_NOVERIFY; +extern const int64 k_T_DOLLAR_OPEN_CURLY_BRACES; +extern const int64 k_CURLOPT_SSLENGINE_DEFAULT; +extern const int64 k_XSD_GYEAR; +extern const int64 k_SOCKET_EPROTO; +extern const int64 k_XSD_NONPOSITIVEINTEGER; +extern const StaticString k_XML_SAX_IMPL; +extern const int64 k_LDAP_OPT_RESTART; +extern const int64 k_MW_SolarizePreview; +extern const int64 k_U_USELESS_COLLATOR_ERROR; +extern const int64 k_MW_BlobError; +extern const int64 k_IMG_ARC_EDGED; +extern const int64 k_DOM_NOT_SUPPORTED_ERR; +extern const int64 k_PNG_FILTER_AVG; +extern const int64 k_CURLM_BAD_HANDLE; +extern const int64 k_MW_LightenCompositeOp; +extern const int64 k_CURLOPT_PROXYTYPE; +extern const int64 k_T_ENDIF; +extern const int64 k_CURLOPT_FTPSSLAUTH; +extern const int64 k_MW_BesselFilter; +extern const int64 k_DOM_INUSE_ATTRIBUTE_ERR; +extern const int64 k_MW_UndefinedVirtualPixelMethod; +extern const int64 k_CURLE_FTP_WEIRD_SERVER_REPLY; +extern const int64 k_CURLE_LDAP_INVALID_URL; +extern const int64 k_XML_DOCUMENT_FRAG_NODE; +extern const int64 k_MW_ImageError; +extern const int64 k_IMG_FILTER_CONTRAST; +extern const int64 k_SOCKET_EHOSTUNREACH; +extern const int64 k_MW_UndefinedDispose; +extern const int64 k_CURLPROXY_HTTP; +extern const int64 k_MW_Group4Compression; +extern const int64 k_CLOCK_THREAD_CPUTIME_ID; +extern const int64 k_MCRYPT_DEV_URANDOM; +extern const StaticString k_MCRYPT_MODE_STREAM; +extern const int64 k_SOAP_ACTOR_NONE; +extern const int64 k_MYSQLI_UNIQUE_KEY_FLAG; +extern const StaticString k_PHP_EXTENSION_DIR; +extern const int64 k_DOM_INVALID_MODIFICATION_ERR; +extern const int64 k_U_MULTIPLE_PAD_SPECIFIERS; +extern const int64 k_STR_PAD_RIGHT; +extern const int64 k_SOCKET_ENODATA; +extern const int64 k_MW_ConstantVirtualPixelMethod; +extern const int64 k_U_MALFORMED_RULE; +extern const int64 k_U_UNSUPPORTED_ATTRIBUTE; +extern const int64 k_OCI_EXACT_FETCH; +extern const int64 k_CURLAUTH_ANYSAFE; +extern const int64 k_STREAM_SHUT_RDWR; +extern const int64 k_U_BRK_ERROR_START; +extern const int64 k_PRIO_PROCESS; +extern const int64 k_STREAM_PF_INET6; +extern const int64 k_CURLE_FTP_COULDNT_GET_SIZE; +extern const int64 k_OCI_DTYPE_LOB; +extern const int64 k_U_INVALID_FUNCTION; +extern const int64 k_MW_MissingDelegateFatalError; +extern const int64 k_IMAGETYPE_JPEG; +extern const int64 k_SOCKET_ENOPROTOOPT; +extern const int64 k_IMG_WBMP; +extern const int64 k_LDAP_OPT_DEBUG_LEVEL; +extern const int64 k_MW_CenterAlign; +extern const int64 k_LOG_DAEMON; +extern const int64 k_MW_UndefinedJoin; +extern const int64 k_XML_ELEMENT_NODE; +extern const int64 k_LC_NUMERIC; +extern const int64 k_CREDITS_FULLPAGE; +extern const int64 k_U_PRIMARY_TOO_LONG_ERROR; +extern const int64 k_LIBXML_DTDVALID; +extern const int64 k_U_ERROR_WARNING_START; +extern const int64 k_MW_FloatPixel; +extern const int64 k_CURLOPT_WRITEFUNCTION; +extern const int64 k_CURLE_SSL_CONNECT_ERROR; +extern const int64 k_MW_WandFatalError; +extern const int64 k_MW_GRAYColorspace; +extern const int64 k_IMG_GIF; +extern const int64 k_U_PARSE_ERROR; +extern const int64 k_MYSQLI_TYPE_SHORT; +extern const int64 k_IMG_FILTER_COLORIZE; +extern const int64 k_T_DOUBLE_COLON; +extern const int64 k_T_DEC; +extern const int64 k_SOCKET_ELNRNG; +extern const StaticString k_PHP_DATADIR; +extern const int64 k_CURLOPT_READDATA; +extern const int64 k_CURL_NETRC_REQUIRED; +extern const int64 k_XSD_ENTITIES; +extern const int64 k_MW_DelegateFatalError; +extern const int64 k_U_STATE_TOO_OLD_ERROR; +extern const int64 k_CURLOPT_CLOSEPOLICY; +extern const int64 k_PREG_SPLIT_NO_EMPTY; +extern const int64 k_LIBXML_NONET; +extern const int64 k_SOCKET_ENFILE; +extern const int64 k_MW_CopyMagentaCompositeOp; +extern const int64 k_STREAM_IPPROTO_RAW; +extern const int64 k_LIBXML_DTDLOAD; +extern const int64 k_CURLINFO_STARTTRANSFER_TIME; +extern const int64 k_COUNT_RECURSIVE; +extern const int64 k_CODESET; +extern const int64 k_CURLOPT_PASSWDFUNCTION; +extern const int64 k_SOCKET_EPERM; +extern const int64 k_GD_MAJOR_VERSION; +extern const int64 k_PKCS7_DETACHED; +extern const int64 k_OPENSSL_CIPHER_RC2_40; +extern const int64 k_SOCKET_ENOSR; +extern const int64 k_LC_MESSAGES; +extern const int64 k_T_STRING_VARNAME; +extern const int64 k_SOMAXCONN; +extern const int64 k_MW_RedChannel; +extern const int64 k_MW_ButtCap; +extern const int64 k_OPENSSL_CIPHER_RC2_64; +extern const int64 k_SOCKET_ETIMEDOUT; +extern const int64 k_IDNA_CONTAINS_ACE_PREFIX; +extern const int64 k_MW_ColorDodgeCompositeOp; +extern const int64 k_T_FMT_AMPM; +extern const int64 k_SQLT_RSET; +extern const int64 k_U_REGEX_INVALID_STATE; +extern const int64 k_T_CHARACTER; +extern const int64 k_XML_ATTRIBUTE_NODE; +extern const int64 k_STREAM_ENFORCE_SAFE_MODE; +extern const int64 k_SUNFUNCS_RET_TIMESTAMP; +extern const int64 k_STREAM_IPPROTO_TCP; +extern const int64 k_SO_RCVBUF; +extern const int64 k_STREAM_NOTIFY_MIME_TYPE_IS; +extern const int64 k_COUNT_NORMAL; +extern const int64 k_U_REGEX_INTERNAL_ERROR; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv23_SERVER; +extern const StaticString k_MCRYPT_WAKE; +extern const int64 k_U_TRUNCATED_CHAR_FOUND; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv2_SERVER; +extern const int64 k_MW_WandError; +extern const int64 k_SO_DEBUG; +extern const bool k_FALSE; +extern const int64 k_LDAP_OPT_ERROR_STRING; +extern const bool k_ZEND_THREAD_SAFE; +extern const int64 k_AF_INET6; +extern const int64 k_SUNFUNCS_RET_STRING; +extern const int64 k_OPENSSL_PKCS1_OAEP_PADDING; +extern const int64 k_SIGSTKFLT; +extern const int64 k_XML_ERROR_NO_MEMORY; +extern const int64 k_DNS_ALL; +extern const int64 k_MB_OVERLOAD_REGEX; +extern const int64 k_MW_SincFilter; +extern const int64 k_IMG_JPG; +extern const int64 k_MW_ShearPreview; +extern const int64 k_ASSERT_ACTIVE; +extern const int64 k_STREAM_IPPROTO_UDP; +extern const int64 k_OCI_SEEK_SET; +extern const int64 k_SOCKET_EDESTADDRREQ; +extern const int64 k_T_FMT; +extern const int64 k_MW_EastGravity; +extern const int64 k_SOCKET_EPIPE; +extern const int64 k_SIGCLD; +extern const int64 k_T_FINAL; +extern const int64 k_MW_StaticGravity; +extern const int64 k_T_FOR; +extern const int64 k_EXTR_SKIP; +extern const int64 k_MW_HermiteFilter; +extern const int64 k_DNS_ANY; +extern const int64 k_OCI_DTYPE_FILE; +extern const int64 k_CURLE_BAD_CALLING_ORDER; +extern const int64 k_SOCKET_ENOBUFS; +extern const int64 k_LC_COLLATE; +extern const int64 k_CURLOPT_CAPATH; +extern const int64 k_PKCS7_NOCHAIN; +extern const int64 k_U_INVALID_TABLE_FORMAT; +extern const int64 k_CHAR_MAX; +extern const int64 k_PREG_INTERNAL_ERROR; +extern const int64 k_MYSQLI_RPL_ADMIN; +extern const int64 k_E_USER_WARNING; +extern const int64 k_PREG_NO_ERROR; +extern const int64 k_U_STRINGPREP_CHECK_BIDI_ERROR; +extern const int64 k_SOCKET_EPROTONOSUPPORT; +extern const StaticString k_MCRYPT_PANAMA; +extern const int64 k_MYSQLI_TYPE_CHAR; +extern const int64 k_MON_1; +extern const int64 k_T_EMPTY; +extern const int64 k_MON_2; +extern const int64 k_SIGBUS; +extern const int64 k_MYSQLI_SET_FLAG; +extern const int64 k_MON_3; +extern const int64 k_MON_4; +extern const int64 k_MON_5; +extern const int64 k_MON_6; +extern const int64 k_MON_7; +extern const int64 k_MON_8; +extern const int64 k_MON_9; +extern const int64 k_SOCKET_EMLINK; +extern const int64 k_EXTR_IF_EXISTS; +extern const int64 k_LDAP_OPT_SERVER_CONTROLS; +extern const int64 k_CURLE_COULDNT_RESOLVE_HOST; +extern const int64 k_MW_BlobFatalError; +extern const int64 k_MYSQLI_ZEROFILL_FLAG; +extern const StaticString k_GD_VERSION; +extern const int64 k_SOCKET_EBADMSG; +extern const int64 k_CURLE_FTP_USER_PASSWORD_INCORRECT; +extern const int64 k_T_INC; +extern const int64 k_THOUSEP; +extern const int64 k_SORT_DESC; +extern const int64 k_MYSQLI_TYPE_BLOB; +extern const int64 k_SOCKET_EAFNOSUPPORT; +extern const int64 k_MYSQLI_TYPE_DATE; +extern const int64 k_T_DNUMBER; +extern const int64 k_MW_BlueChannel; +extern const int64 k_CURLE_UNKNOWN_TELNET_OPTION; +extern const int64 k_T_CONTINUE; +extern const StaticString k_PHP_SHLIB_SUFFIX; +extern const int64 k_CURLE_LIBRARY_NOT_FOUND; +extern const int64 k_T_FUNC_C; +extern const int64 k_MW_ObliqueStyle; +extern const int64 k_SOCKET_ENETUNREACH; +extern const int64 k_MW_EdgeDetectPreview; +extern const int64 k_XML_ERROR_EXTERNAL_ENTITY_HANDLING; +extern const int64 k_MW_DstInCompositeOp; +extern const int64 k_LDAP_DEREF_SEARCHING; +extern const int64 k_STREAM_IPPROTO_ICMP; +extern const int64 k_SIGFPE; +extern const int64 k_LIBXML_NOCDATA; +extern const int64 k_SOCKET_ENXIO; +extern const int64 k_MW_MinusCompositeOp; +extern const int64 k_MW_RotatePreview; +extern const int64 k_U_REGEX_BAD_ESCAPE_SEQUENCE; +extern const int64 k_IMG_FILTER_GRAYSCALE; +extern const int64 k_PREG_SET_ORDER; +extern const int64 k_SORT_STRING; +extern const int64 k_CURLOPT_FORBID_REUSE; +extern const int64 k_U_BRK_MISMATCHED_PAREN; +extern const int64 k_MW_LosslessJPEGCompression; +extern const int64 k_XML_ERROR_PARAM_ENTITY_REF; +extern const int64 k_CURLAUTH_BASIC; +extern const int64 k_MW_UndefinedFilter; +extern const int64 k_MW_NorthWestGravity; +extern const int64 k_PKCS7_NOCERTS; +extern const int64 k_MYSQLI_ASSOC; +extern const int64 k_OCI_COMMIT_ON_SUCCESS; +extern const int64 k_POSIX_S_IFSOCK; +extern const int64 k_IMG_PNG; +extern const int64 k_DEBUG_LOG_IP; +extern const int64 k_CURLE_FTP_WEIRD_USER_REPLY; +extern const int64 k_CURLE_FTP_WEIRD_PASS_REPLY; +extern const int64 k_MW_InCompositeOp; +extern const int64 k_STREAM_NOTIFY_SEVERITY_INFO; +extern const int64 k_MB_OVERLOAD_STRING; +extern const int64 k_XML_ELEMENT_DECL_NODE; +extern const int64 k_CURLINFO_PRIVATE; +extern const int64 k_MW_FileOpenError; +extern const int64 k_CURL_TIMECOND_IFMODSINCE; +extern const int64 k_CURLINFO_TOTAL_TIME; +extern const int64 k_IDNA_NO_ACE_PREFIX; +extern const int64 k_SIGILL; +extern const int64 k_T_NEW; +extern const int64 k_CURLOPT_PROXY; +extern const int64 k_SOCKET_EBADRQC; +extern const int64 k_SQLT_BFILEE; +extern const int64 k_U_BRK_INIT_ERROR; +extern const int64 k_MW_AndEvaluateOperator; +extern const int64 k_CURLE_FTP_PORT_FAILED; +extern const int64 k_MW_RollPreview; +extern const int64 k_SIGINT; +extern const int64 k_SOCKET_EBADSLT; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv3_CLIENT; +extern const int64 k_SIGIOT; +extern const int64 k_SIGHUP; +extern const int64 k_MYSQL_ASSOC; +extern const int64 k_U_ILLEGAL_ESCAPE_SEQUENCE; +extern const int64 k_MW_ItalicStyle; +extern const int64 k_U_UNEXPECTED_TOKEN; +extern const int64 k_MW_NoneDispose; +extern const int64 k_MW_ImplodePreview; +extern const int64 k_T_ENDWHILE; +extern const int64 k_MW_StreamFatalError; +extern const int64 k_U_ZERO_ERROR; +extern const int64 k_DOM_HIERARCHY_REQUEST_ERR; +extern const int64 k_MW_UndefinedMode; +extern const StaticString k_PHP_CONFIG_FILE_SCAN_DIR; +extern const int64 k_T_ISSET; +extern const int64 k_LC_CTYPE; +extern const int64 k_PSFS_ERR_FATAL; +extern const int64 k_SIGPIPE; +extern const int64 k_T_INTERFACE; +extern const int64 k_MW_AllChannels; +extern const int64 k_MW_DarkenCompositeOp; +extern const int64 k_STREAM_NOTIFY_AUTH_RESULT; +extern const int64 k_SQLT_CFILEE; +extern const int64 k_MYSQLI_MULTIPLE_KEY_FLAG; +extern const int64 k_MW_SrcCompositeOp; +extern const int64 k_T_MOD_EQUAL; +extern const double k_M_SQRTPI; +extern const int64 k_PNG_FILTER_SUB; +extern const int64 k_FILE_APPEND; +extern const int64 k_SOCKET_ESTRPIPE; +extern const int64 k_OPENSSL_ALGO_MD2; +extern const int64 k_DOM_SYNTAX_ERR; +extern const int64 k_OPENSSL_ALGO_MD4; +extern const int64 k_OPENSSL_ALGO_MD5; +extern const int64 k_EXTR_PREFIX_IF_EXISTS; +extern const int64 k_INFO_ALL; +extern const int64 k_CURLOPT_SSLCERTPASSWD; +extern const int64 k_XML_OPTION_SKIP_TAGSTART; +extern const int64 k_MW_HuePreview; +extern const int64 k_MW_IntegerPixel; +extern const int64 k_IMG_EFFECT_REPLACE; +extern const int64 k_OCI_B_CURSOR; +extern const int64 k_OPENSSL_NO_PADDING; +extern const int64 k_MW_FillToBorderMethod; +extern const int64 k_U_BRK_NEW_LINE_IN_QUOTED_STRING; +extern const int64 k_STREAM_PF_INET; +extern const int64 k_SOCKET_EHOSTDOWN; +extern const int64 k_MW_UserSpaceOnUse; +extern const int64 k_MW_UndefinedChannel; +extern const int64 k_SOCKET_ERESTART; +extern const int64 k_ERA; +extern const int64 k_XML_OPTION_TARGET_ENCODING; +extern const int64 k_CURLOPT_PRIVATE; +extern const int64 k_SOCKET_EALREADY; +extern const int64 k_XSD_NMTOKENS; +extern const int64 k_MW_TrueColorMatteType; +extern const int64 k_XSD_LANGUAGE; +extern const int64 k_MW_UniformNoise; +extern const int64 k_U_MEMORY_ALLOCATION_ERROR; +extern const int64 k_SORT_ASC; +extern const int64 k_IMG_FILTER_EMBOSS; +extern const int64 k_U_REGEX_INVALID_FLAG; +extern const int64 k_U_UNQUOTED_SPECIAL; +extern const int64 k_MYSQLI_OPT_LOCAL_INFILE; +extern const int64 k_MYSQLI_AUTO_INCREMENT_FLAG; +extern const int64 k_U_UNDEFINED_VARIABLE; +extern const int64 k_SOAP_LITERAL; +extern const int64 k_XML_ERROR_JUNK_AFTER_DOC_ELEMENT; +extern const int64 k_MW_BlurPreview; +extern const int64 k_U_INVALID_RBT_SYNTAX; +extern const int64 k_MW_SouthEastGravity; +extern const int64 k_SOCKET_EXFULL; +extern const int64 k_T_OPEN_TAG_WITH_ECHO; +extern const int64 k_MYSQL_CLIENT_SSL; +extern const int64 k_MW_LineThroughDecoration; +extern const int64 k_T_START_HEREDOC; +extern const int64 k_U_VARIABLE_RANGE_EXHAUSTED; +extern const int64 k_E_ERROR; +extern const int64 k_INI_USER; +extern const int64 k_MW_DstCompositeOp; +extern const int64 k_SO_SNDTIMEO; +extern const int64 k_MW_GrayscaleMatteType; +extern const int64 k_CURLE_FUNCTION_NOT_FOUND; +extern const int64 k_CURLOPT_ENCODING; +extern const int64 k_MW_ExtraCondensedStretch; +extern const int64 k_T_IS_GREATER_OR_EQUAL; +extern const int64 k_T_BAD_CHARACTER; +extern const int64 k_T_INSTANCEOF; +extern const int64 k_MW_LuminizeCompositeOp; +extern const int64 k_MYSQLI_READ_DEFAULT_GROUP; +extern const int64 k_XML_ERROR_MISPLACED_XML_PI; +extern const int64 k_MW_AnyStyle; +extern const int64 k_MW_CyanChannel; +extern const int64 k_CURLINFO_SPEED_DOWNLOAD; +extern const int64 k_MYSQLI_BOTH; +extern const int64 k_MW_CacheFatalError; +extern const int64 k_MW_WandWarning; +extern const int64 k_T_VAR; +extern const int64 k_PATHINFO_DIRNAME; +extern const int64 k_MW_AlphaChannel; +extern const int64 k_CURLPROXY_SOCKS5; +extern const int64 k_SIGPOLL; +extern const int64 k_MW_CopyCyanCompositeOp; +extern const int64 k_CURLINFO_CONTENT_LENGTH_DOWNLOAD; +extern const int64 k_IMG_XPM; +extern const StaticString k_INF; +extern const int64 k_CURLOPT_HTTPAUTH; +extern const int64 k_XML_ATTRIBUTE_NMTOKENS; +extern const int64 k_MW_MissingDelegateError; +extern const int64 k_MW_UserSpace; +extern const int64 k_CURLFTPSSL_ALL; +extern const int64 k_MYSQLI_CLIENT_NO_SCHEMA; +extern const int64 k_T_CATCH; +extern const int64 k_SOCKET_EROFS; +extern const int64 k_INFO_VARIABLES; +extern const int64 k_CURLOPT_DNS_CACHE_TIMEOUT; +extern const int64 k_U_REGEX_RULE_SYNTAX; +extern const int64 k_CURLE_OK; +extern const int64 k_T_TRY; +extern const int64 k_T_ENDDECLARE; +extern const int64 k_CURL_IPRESOLVE_V4; +extern const int64 k_XML_LOCAL_NAMESPACE; +extern const int64 k_XSD_UNSIGNEDBYTE; +extern const int64 k_CURLOPT_TCP_NODELAY; +extern const int64 k_CURL_IPRESOLVE_V6; +extern const int64 k_CRYPT_BLOWFISH; +extern const int64 k_XML_ATTRIBUTE_IDREF; +extern const int64 k_U_ENUM_OUT_OF_SYNC_ERROR; +extern const int64 k_T_USE; +extern const StaticString k_MCRYPT_CAST_128; +extern const int64 k_CURLINFO_EFFECTIVE_URL; +extern const int64 k_T_IS_EQUAL; +extern const StaticString k_MCRYPT_RIJNDAEL_128; +extern const int64 k_SQLT_AFC; +extern const int64 k_MW_SetEvaluateOperator; +extern const int64 k_CURLOPT_TIMEVALUE; +extern const int64 k_SIGPWR; +extern const int64 k_OCI_B_ROWID; +extern const int64 k_MW_FatalErrorException; +extern const int64 k_CURLOPT_HTTPHEADER; +extern const int64 k_CURLOPT_COOKIEFILE; +extern const StaticString k_PHP_LIBDIR; +extern const int64 k_DEBUG_LOG_AGENT; +extern const int64 k_DNS_PTR; +extern const int64 k_XML_ERROR_SYNTAX; +extern const int64 k_U_NO_SPACE_AVAILABLE; +extern const int64 k_T_CONSTANT_ENCAPSED_STRING; +extern const int64 k_MW_MeanAbsoluteErrorMetric; +extern const int64 k_CURLOPT_PROXYAUTH; +extern const StaticString k_NAN; +extern const int64 k_GD_RELEASE_VERSION; +extern const int64 k_SOL_SOCKET; +extern const StaticString k_MCRYPT_RIJNDAEL_192; +extern const int64 k_SOCKET_ENOMEDIUM; +extern const int64 k_CURLOPT_COOKIESESSION; +extern const int64 k_SIGPROF; +extern const StaticString k_MCRYPT_ARCFOUR_IV; +extern const int64 k_MW_UndefinedNoise; +extern const StaticString k_MCRYPT_CAST_256; +extern const int64 k_MW_BevelJoin; +extern const int64 k_PREG_SPLIT_OFFSET_CAPTURE; +extern const int64 k_IDNA_CONTAINS_MINUS; +extern const int64 k_SO_KEEPALIVE; +extern const StaticString k_MCRYPT_RIJNDAEL_256; +extern const int64 k_MW_UndefinedInterlace; +extern const int64 k_U_STANDARD_ERROR_LIMIT; +extern const int64 k_T_OPEN_TAG; +extern const int64 k_MW_UndefinedException; +extern const int64 k_LIBXML_NOERROR; +extern const int64 k_CURLOPT_NETRC; +extern const int64 k_DNS_SOA; +extern const int64 k_SQLT_BIN; +extern const int64 k_MW_ShortPixel; +extern const int64 k_MW_DelegateError; +extern const int64 k_SIGSEGV; +extern const int64 k_MW_TypeFatalError; +extern const int64 k_U_REGEX_LOOK_BEHIND_LIMIT; +extern const int64 k_CURLFTPAUTH_DEFAULT; +extern const int64 k_STREAM_SOCK_DGRAM; +extern const int64 k_CURLCLOSEPOLICY_OLDEST; +extern const int64 k_STREAM_URL_STAT_QUIET; +extern const int64 k_SQLT_CHR; +extern const int64 k_SOCKET_EACCES; +extern const int64 k_MYSQLI_TYPE_INT24; +extern const int64 k_SOCK_RAW; +extern const int64 k_SQLT_AVC; +extern const int64 k_MYSQLI_TYPE_INTERVAL; +extern const int64 k_SOCK_RDM; +extern const int64 k_DNS_SRV; +extern const int64 k_XSD_UNSIGNEDINT; +extern const int64 k_SIGSYS; +extern const int64 k_SOAP_RPC; +extern const int64 k_MW_PoissonNoise; +extern const int64 k_SIGURG; +extern const int64 k_SOCKET_ETIME; +extern const int64 k_T_ENDFOREACH; +extern const StaticString k_PHP_SAPI; +extern const StaticString k_PHP_PREFIX; +extern const int64 k_U_BRK_ERROR_LIMIT; +extern const int64 k_MW_SwirlPreview; +extern const int64 k_MW_BumpmapCompositeOp; +extern const int64 k_SOAP_SINGLE_ELEMENT_ARRAYS; +extern const int64 k_MYSQL_CLIENT_INTERACTIVE; +extern const int64 k_CURLOPT_CRLF; +extern const int64 k_CURL_HTTP_VERSION_1_0; +extern const int64 k_CURL_HTTP_VERSION_1_1; +extern const StaticString k_MCRYPT_MODE_NOFB; +extern const int64 k_CURLOPT_MAXCONNECTS; +extern const int64 k_XML_ATTRIBUTE_IDREFS; +extern const int64 k_T_INT_CAST; +extern const int64 k_XSD_POSITIVEINTEGER; +extern const int64 k_CURLOPT_SSL_VERIFYHOST; +extern const int64 k_XSD_NCNAME; +extern const int64 k_X509_PURPOSE_SMIME_SIGN; +extern const int64 k_SOCKET_EPROTOTYPE; +extern const int64 k_U_ERROR_WARNING_LIMIT; +extern const int64 k_MYSQLI_TYPE_ENUM; +extern const int64 k_CURLE_PARTIAL_FILE; +extern const int64 k_PHP_URL_HOST; +extern const int64 k_STREAM_SOCK_STREAM; +extern const int64 k_MW_DrawError; +extern const double k_M_E; +extern const int64 k_DNS_TXT; +extern const int64 k_DOM_WRONG_DOCUMENT_ERR; +extern const StaticString k_MCRYPT_XTEA; +extern const int64 k_SO_RCVTIMEO; +extern const int64 k_XSD_NONNEGATIVEINTEGER; +extern const int64 k_CURLE_WRITE_ERROR; +extern const int64 k_ALT_DIGITS; +extern const int64 k_XHPROF_FLAGS_CPU; +extern const int64 k_MW_SquareCap; +extern const int64 k_MYSQLI_NO_DATA; +extern const int64 k_SOCKET_EIO; +extern const int64 k_MW_OHTAColorspace; +extern const int64 k_U_MISSING_RESOURCE_ERROR; +extern const int64 k_T_DOUBLE_CAST; +extern const int64 k_SQLT_FLT; +extern const int64 k_FILE_USE_INCLUDE_PATH; +extern const int64 k_SOCKET_ENOTSOCK; +extern const int64 k_XSD_DATE; +extern const int64 k_E_RECOVERABLE_ERROR; +extern const int64 k_OCI_ASSOC; +extern const int64 k_CURLE_SSL_ENGINE_SETFAILED; +extern const int64 k_U_MULTIPLE_POST_CONTEXTS; +extern const int64 k_GLOB_NOCHECK; +extern const int64 k_PREG_RECURSION_LIMIT_ERROR; +extern const int64 k_T_ENDFOR; +extern const int64 k_DNS_A; +extern const StaticString k_PHP_CONFIG_FILE_PATH; +extern const int64 k_MW_RoundJoin; +extern const int64 k_MW_ModulateCompositeOp; +extern const int64 k_CURLE_SHARE_IN_USE; +extern const int64 k_U_ILLEGAL_PAD_POSITION; +extern const int64 k_LIBXML_VERSION; +extern const int64 k_MW_UndefinedResource; +extern const int64 k_DOM_NO_MODIFICATION_ALLOWED_ERR; +extern const int64 k_CURLOPT_SSLKEYPASSWD; +extern const int64 k_CURLOPT_SSLCERT; +extern const int64 k_SIGQUIT; +extern const int64 k_MW_ResetMethod; +extern const int64 k_SQLT_BFLOAT; +extern const StaticString k_MCRYPT_SKIPJACK; +extern const int64 k_SO_DONTROUTE; +extern const int64 k_T_DECLARE; +extern const int64 k_SIGTERM; +extern const int64 k_T_GLOBAL; +extern const int64 k_MW_MissingDelegateWarning; +extern const int64 k_MW_PerceptualIntent; +extern const int64 k_POSIX_R_OK; +extern const int64 k_T_STRING; +extern const int64 k_INFO_CREDITS; +extern const int64 k_STR_PAD_LEFT; +extern const int64 k_XSD_ID; +extern const int64 k_MW_TransparentColorspace; +extern const int64 k_OCI_RETURN_NULLS; +extern const int64 k_T_IS_IDENTICAL; +extern const int64 k_CLOCK_PROCESS_CPUTIME_ID; +extern const int64 k_MW_UndefinedEvaluateOperator; +extern const int64 k_OPENSSL_ALGO_SHA1; +extern const int64 k_MW_CopyYellowCompositeOp; +extern const int64 k_MW_CopyGreenCompositeOp; +extern const int64 k_CURLOPT_FILE; +extern const int64 k_SQLT_INT; +extern const int64 k_IMG_EFFECT_OVERLAY; +extern const int64 k_SQLT_LBI; +extern const int64 k_WSDL_CACHE_MEMORY; +extern const int64 k_GD_MINOR_VERSION; +extern const int64 k_XSD_TOKEN; +extern const int64 k_FNM_NOESCAPE; +extern const int64 k_U_BRK_RULE_EMPTY_SET; +extern const int64 k_PHP_OUTPUT_HANDLER_START; +extern const int64 k_INFO_GENERAL; +extern const int64 k_LOG_ERR; +extern const int64 k_MYSQLI_NUM; +extern const int64 k_MYSQLI_OPT_CONNECT_TIMEOUT; +extern const int64 k_MW_RGBColorspace; +extern const int64 k_DEBUG_LOG_COOKIE; +extern const int64 k_EXTR_PREFIX_INVALID; +extern const int64 k_U_REGEX_ERROR_START; +extern const int64 k_MW_OrEvaluateOperator; +extern const int64 k_SORT_NUMERIC; +extern const int64 k_CURLINFO_HEADER_OUT; +extern const int64 k_MW_UndefinedCompositeOp; +extern const int64 k_MW_DiskResource; +extern const int64 k_OCI_D_LOB; +extern const int64 k_XML_DOCUMENT_NODE; +extern const int64 k_LDAP_DEREF_NEVER; +extern const StaticString k_MCRYPT_THREEWAY; +extern const int64 k_MW_ExtraExpandedStretch; +extern const int64 k_MW_AbsoluteIntent; +extern const int64 k_FORCE_GZIP; +extern const int64 k_OCI_B_BLOB; +extern const int64 k_CASE_UPPER; +extern const StaticString k_PHP_EOL; +extern const int64 k_SQLT_LNG; +extern const int64 k_SOCKET_ENETRESET; +extern const int64 k_MW_CubicFilter; +extern const int64 k_U_MISPLACED_COMPOUND_FILTER; +extern const int64 k_MYSQLI_NUM_FLAG; +extern const int64 k_MB_CASE_UPPER; +extern const int64 k_CURLE_FAILED_INIT; +extern const int64 k_MW_DrawFatalError; +extern const int64 k_IDNA_CONTAINS_NON_LDH; +extern const int64 k_T_FOREACH; +extern const int64 k_CURLOPT_UPLOAD; +extern const int64 k_MW_PixelsPerCentimeterResolution; +extern const int64 k_MYSQLI_TYPE_MEDIUM_BLOB; +extern const int64 k_CURLOPT_AUTOREFERER; +extern const int64 k_SOAP_FUNCTIONS_ALL; +extern const int64 k_SOCK_SEQPACKET; +extern const int64 k_SQLT_LVC; +extern const int64 k_MW_OptionWarning; +extern const int64 k_SQLT_ODT; +extern const int64 k_SOCKET_EFAULT; +extern const int64 k_MW_MiterJoin; +extern const int64 k_NOEXPR; +extern const int64 k_STREAM_CRYPTO_METHOD_TLS_CLIENT; +extern const int64 k_CURLOPT_USERAGENT; +extern const int64 k_MW_RegistryError; +extern const int64 k_MYSQLI_CLIENT_SSL; +extern const int64 k_CURLOPT_INTERFACE; +extern const int64 k_MW_BilevelType; +extern const int64 k_XSD_BOOLEAN; +extern const int64 k_U_MULTIPLE_DECIMAL_SEPARATORS; +extern const int64 k_E_CORE_ERROR; +extern const int64 k_RADIXCHAR; +extern const int64 k_EXIF_USE_MBSTRING; +extern const int64 k_MW_LZWCompression; +extern const int64 k_MW_XorEvaluateOperator; +extern const int64 k_XSD_GMONTH; +extern const int64 k_SOAP_WAIT_ONE_WAY_CALLS; +extern const int64 k_U_STRINGPREP_PROHIBITED_ERROR; +extern const int64 k_MW_TypeWarning; +extern const int64 k_U_MULTIPLE_CURSORS; +extern const StaticString k_MCRYPT_SERPENT; +extern const int64 k_MYSQLI_TYPE_DECIMAL; +extern const int64 k_MYSQLI_PART_KEY_FLAG; +extern const int64 k_MW_MultiplicativeGaussianNoise; +extern const int64 k_INI_PERDIR; +extern const int64 k_XML_ATTRIBUTE_ID; +extern const int64 k_MB_OVERLOAD_MAIL; +extern const int64 k_CURLOPT_SSLCERTTYPE; +extern const int64 k_SQLT_NUM; +extern const StaticString k_MCRYPT_CRYPT; +extern const int64 k_CURLE_OUT_OF_MEMORY; +extern const int64 k_SQLT_RDD; +extern const int64 k_SQLT_NTY; +extern const int64 k_MW_PlaneInterlace; +extern const int64 k_MW_ResourceLimitFatalError; +extern const int64 k_U_MALFORMED_SET; +extern const int64 k_LOG_USER; +extern const int64 k_LDAP_OPT_HOST_NAME; +extern const int64 k_CURLOPT_RETURNTRANSFER; +extern const int64 k_CURLE_FTP_WEIRD_PASV_REPLY; +extern const int64 k_CURLOPT_WRITEHEADER; +extern const int64 k_OCI_B_CLOB; +extern const int64 k_SOCKET_ENOTUNIQ; +extern const int64 k_MW_DstAtopCompositeOp; +extern const int64 k_LOG_LPR; +extern const int64 k_MW_LineInterlace; +extern const int64 k_SOCKET_EXDEV; +extern const int64 k_U_NO_WRITE_PERMISSION; +extern const int64 k_MW_MaxRGB; +extern const int64 k_SIGWINCH; +extern const int64 k_OCI_DESCRIBE_ONLY; +extern const int64 k_SOCKET_ENAMETOOLONG; +extern const int64 k_CLOCK_REALTIME; +extern const int64 k_XML_ATTRIBUTE_ENTITY; +extern const int64 k_LIBXML_ERR_FATAL; +extern const int64 k_SOCKET_ENOANO; +extern const int64 k_T_CLASS_C; +extern const int64 k_XSD_FLOAT; +extern const int64 k_LOG_UUCP; +extern const int64 k_MW_ClearCompositeOp; +extern const int64 k_STREAM_OOB; +extern const int64 k_OCI_D_ROWID; +extern const int64 k_STREAM_IGNORE_URL; +extern const int64 k_SOCKET_EBADFD; +extern const int64 k_U_ILLEGAL_CHARACTER; +extern const int64 k_SIGSTOP; +extern const int64 k_SIGTRAP; +extern const int64 k_ENT_QUOTES; +extern const int64 k_CURLE_SSL_CACERT; +extern const int64 k_LIBXML_NOBLANKS; +extern const int64 k_IDNA_PUNYCODE_ERROR; +extern const int64 k_CURLFTPSSL_TRY; +extern const int64 k_MW_CMYKColorspace; +extern const int64 k_SOAP_AUTHENTICATION_DIGEST; +extern const int64 k_CURLOPT_HEADER; +extern const StaticString k_PHP_LOCALSTATEDIR; +extern const int64 k_LOG_PID; +extern const int64 k_SOCKET_ENODEV; +extern const int64 k_SQLT_BLOB; +extern const int64 k_CURLFTPAUTH_TLS; +extern const int64 k_XML_ERROR_UNCLOSED_TOKEN; +extern const int64 k_CURLFTPAUTH_SSL; +extern const int64 k_XML_ERROR_UNCLOSED_CDATA_SECTION; +extern const int64 k_U_RESOURCE_TYPE_MISMATCH; +extern const int64 k_T_AND_EQUAL; +extern const int64 k_U_MULTIPLE_PERMILL_SYMBOLS; +extern const int64 k_E_COMPILE_ERROR; +extern const int64 k_AF_INET; +extern const int64 k_MW_MapResource; +extern const int64 k_MW_TileVirtualPixelMethod; +extern const int64 k_T_OR_EQUAL; +extern const int64 k_DOM_INVALID_ACCESS_ERR; +extern const int64 k_MW_RLECompression; +extern const int64 k_PRIO_PGRP; +extern const int64 k_SOCKET_ENOCSI; +extern const int64 k_T_UNSET; +extern const int64 k_XML_ENTITY_DECL_NODE; +extern const int64 k_SQLT_UIN; +extern const int64 k_SQLT_VCS; +extern const int64 k_XSD_BYTE; +extern const int64 k_MW_ImageFatalError; +extern const int64 k_MW_MultiplyCompositeOp; +extern const int64 k_MW_NorthGravity; +extern const int64 k_MSG_EXCEPT; +extern const int64 k_SQLT_STR; +extern const int64 k_CURLOPT_FTP_SSL; +extern const int64 k_SOCKET_EAGAIN; +extern const int64 k_MW_UndefinedPreview; +extern const int64 k_MW_CopyCompositeOp; +extern const int64 k_MW_ModuleFatalError; +extern const int64 k_CONNECTION_TIMEOUT; +extern const int64 k_XSD_GDAY; +extern const int64 k_XSD_NMTOKEN; +extern const int64 k_MYSQLI_TYPE_DATETIME; +extern const int64 k_SIGTTIN; +extern const int64 k_SOCKET_ENOENT; +extern const int64 k_CURLOPT_CUSTOMREQUEST; +extern const int64 k_DOM_NAMESPACE_ERR; +extern const int64 k_MW_UndefinedCompression; +extern const int64 k_LDAP_OPT_DEREF; +extern const int64 k_T_CASE; +extern const int64 k_MW_EvenOddRule; +extern const int64 k_STREAM_NOTIFY_FILE_SIZE_IS; +extern const int64 k_MW_PeakSignalToNoiseRatioMetric; +extern const int64 k_SOAP_DOCUMENT; +extern const int64 k_CURLE_FTP_COULDNT_RETR_FILE; +extern const int64 k_MW_UndefinedIntent; +extern const int64 k_MW_YellowChannel; +extern const int64 k_WSDL_CACHE_NONE; +extern const int64 k_SIGTSTP; +extern const int64 k_SO_TYPE; +extern const int64 k_MW_NorthEastGravity; +extern const int64 k_INTL_MAX_LOCALE_LEN; +extern const int64 k_SIGTTOU; +extern const int64 k_MW_CacheError; +extern const int64 k_CURLINFO_PRETRANSFER_TIME; +extern const int64 k_SOCKET_ECONNABORTED; +extern const int64 k_SOCKET_ENOLINK; +extern const int64 k_MW_SrcInCompositeOp; +extern const int64 k_MW_GrayscalePreview; +extern const int64 k_MW_SegmentPreview; +extern const int64 k_SOCKET_EADDRNOTAVAIL; +extern const int64 k_CURLE_SSL_ENGINE_NOTFOUND; +extern const int64 k_XML_ERROR_RECURSIVE_ENTITY_REF; +extern const int64 k_SOAP_ACTOR_UNLIMATERECEIVER; +extern const int64 k_SQLT_CLOB; +extern const int64 k_MW_UndefinedRule; +extern const int64 k_SOCKET_EPFNOSUPPORT; +extern const int64 k_MW_DstOutCompositeOp; +extern const int64 k_MW_PreviousDispose; +extern const int64 k_MW_ConfigureError; +extern const int64 k_GLOB_MARK; +extern const int64 k_T_RETURN; +extern const int64 k_CURLAUTH_NTLM; +extern const StaticString k_MCRYPT_ENIGNA; +extern const int64 k_X509_PURPOSE_SMIME_ENCRYPT; +extern const int64 k_SOCKET_EREMCHG; +extern const int64 k_SOAP_PERSISTENCE_SESSION; +extern const StaticString k_MCRYPT_SAFER128; +extern const int64 k_ICONV_MIME_DECODE_CONTINUE_ON_ERROR; +extern const int64 k_OCI_DTYPE_ROWID; +extern const int64 k_MCRYPT_DECRYPT; +extern const int64 k_MW_YUVColorspace; +extern const int64 k_CREDITS_SAPI; +extern const int64 k_T_SL_EQUAL; +extern const int64 k_INI_ALL; +extern const int64 k_CURLOPT_COOKIEJAR; +extern const int64 k_UPLOAD_ERR_OK; +extern const int64 k_MW_CacheWarning; +extern const int64 k_HASH_HMAC; +extern const int64 k_MW_ReplaceMethod; +extern const int64 k_MSG_EOF; +extern const int64 k_U_BAD_VARIABLE_DEFINITION; +extern const int64 k_MW_GaussianFilter; +extern const int64 k_SOCKET_ENOLCK; +extern const int64 k_SEEK_CUR; +extern const int64 k_CURLOPT_FRESH_CONNECT; +extern const int64 k_GD_BUNDLED; +extern const int64 k_SEEK_END; +extern const int64 k_MW_SaturationIntent; +extern const int64 k_MSG_EOR; +extern const int64 k_MW_NoInterlace; +extern const int64 k_SIGUSR1; +extern const int64 k_U_SORT_KEY_TOO_SHORT_WARNING; +extern const int64 k_SIGXCPU; +extern const int64 k_SIGUSR2; +extern const int64 k_SOCKET_EBADE; +extern const int64 k_MYSQLI_PRI_KEY_FLAG; +extern const int64 k_SOCKET_EBADF; +extern const int64 k_CURLINFO_REQUEST_SIZE; +extern const int64 k_CURLOPT_TIMECONDITION; +extern const int64 k_FNM_PATHNAME; +extern const int64 k_CURL_TIMECOND_IFUNMODSINCE; +extern const int64 k_MW_SharpenPreview; +extern const int64 k_SQLT_BDOUBLE; +extern const int64 k_SOCKET_EBADR; +extern const int64 k_MW_PointFilter; +extern const int64 k_SOCKET_EOPNOTSUPP; +extern const int64 k_U_UNMATCHED_BRACES; +extern const int64 k_ENT_NOQUOTES; +extern const StaticString k_PHP_OS; +extern const int64 k_PSFS_FEED_ME; +extern const int64 k_LOG_WARNING; +extern const int64 k_SOCKET_ENOMEM; +extern const int64 k_CURLE_TELNET_OPTION_SYNTAX; +extern const int64 k_PATHINFO_FILENAME; +extern const StaticString k_PEAR_INSTALL_DIR; +extern const int64 k_PHP_URL_QUERY; +extern const int64 k_XSD_GMONTHDAY; +extern const int64 k_MW_UndefinedAlign; +extern const StaticString k_MCRYPT_BLOWFISH; +extern const int64 k_CURLE_FTP_CANT_GET_HOST; +extern const int64 k_PKCS7_NOSIGS; +extern const int64 k_XML_CDATA_SECTION_NODE; +extern const int64 k_U_MESSAGE_PARSE_ERROR; +extern const int64 k_SOCKET_EADV; +extern const int64 k_MW_QuantizePreview; +extern const int64 k_CURLOPT_QUOTE; +extern const int64 k_STREAM_CRYPTO_METHOD_SSLv3_SERVER; +extern const int64 k_STREAM_NOTIFY_CONNECT; +extern const int64 k_SOAP_AUTHENTICATION_BASIC; +extern const int64 k_IMG_FILTER_SELECTIVE_BLUR; +extern const int64 k_CURLINFO_SIZE_UPLOAD; +extern const int64 k_MW_BoxFilter; +extern const int64 k_OPENSSL_CIPHER_3DES; +extern const int64 k_SOCKET_ENONET; +extern const int64 k_PREG_PATTERN_ORDER; +extern const int64 k_SOCKET_EINVAL; +extern const StaticString k_MCRYPT_SAFER64; +extern const int64 k_T_DIV_EQUAL; +extern const int64 k_MW_ModuleError; +extern const int64 k_U_INVALID_TABLE_FILE; +extern const int64 k_T_ELSEIF; +extern const int64 k_T_STRING_CAST; + + +// Get Constant Table +Variant get_builtin_constant(CStrRef name) { + DECLARE_SYSTEM_GLOBALS(g); + const char* s = name.data(); + int64 hash = hash_string(s); + switch (hash & 4095) { + case 5: + HASH_RETURN(0x22079DF7EF397005LL, k_MW_HSLColorspace, MW_HSLColorspace); + break; + case 6: + HASH_RETURN(0x427ADB94318BA006LL, k_MB_CASE_LOWER, MB_CASE_LOWER); + break; + case 7: + HASH_RETURN(0x3C9B524C0D75C007LL, k_LOG_LOCAL6, LOG_LOCAL6); + HASH_RETURN(0x3F8D31CC5C991007LL, k_CURLOPT_NETRC, CURLOPT_NETRC); + break; + case 9: + HASH_RETURN(0x2EAB3056565E0009LL, k_STREAM_NOTIFY_MIME_TYPE_IS, STREAM_NOTIFY_MIME_TYPE_IS); + break; + case 10: + HASH_RETURN(0x7DC287493FD4600ALL, k_PATHINFO_FILENAME, PATHINFO_FILENAME); + HASH_RETURN(0x59D30BBD3CC7D00ALL, k_SOCKET_ENOENT, SOCKET_ENOENT); + break; + case 11: + HASH_RETURN(0x7A5A4FE5207B600BLL, k_MW_SwirlPreview, MW_SwirlPreview); + break; + case 19: + HASH_RETURN(0x4F426AC7CDD8A013LL, k_MW_TypeError, MW_TypeError); + break; + case 20: + HASH_RETURN(0x3883A319AEB61014LL, k_U_BRK_INIT_ERROR, U_BRK_INIT_ERROR); + break; + case 23: + HASH_RETURN(0x73AE4B48D8F03017LL, k_STREAM_SHUT_WR, STREAM_SHUT_WR); + break; + case 32: + HASH_RETURN(0x67901B3F70900020LL, k_SOCKET_EBADFD, SOCKET_EBADFD); + break; + case 35: + HASH_RETURN(0x2B10C59571E39023LL, k_CURLOPT_CAPATH, CURLOPT_CAPATH); + break; + case 36: + HASH_RETURN(0x2AB900E06ED1A024LL, k_MCRYPT_RIJNDAEL_128, MCRYPT_RIJNDAEL_128); + break; + case 41: + HASH_RETURN(0x74D28B5FB562E029LL, k_ICONV_MIME_DECODE_CONTINUE_ON_ERROR, ICONV_MIME_DECODE_CONTINUE_ON_ERROR); + break; + case 42: + HASH_RETURN(0x27AA50A19650502ALL, k_CURLE_FTP_COULDNT_SET_BINARY, CURLE_FTP_COULDNT_SET_BINARY); + break; + case 45: + HASH_RETURN(0x369BD3C84577102DLL, k_MW_FileOpenError, MW_FileOpenError); + break; + case 46: + HASH_RETURN(0x2EB86189B5FCF02ELL, k_UCOL_IDENTICAL, UCOL_IDENTICAL); + HASH_RETURN(0x4FE908A1E1FC002ELL, k_MW_OilPaintPreview, MW_OilPaintPreview); + break; + case 53: + HASH_RETURN(0x03D7422B63552035LL, k_MW_WarningException, MW_WarningException); + break; + case 55: + HASH_RETURN(0x6223F293818E4037LL, k_MW_OverlineDecoration, MW_OverlineDecoration); + break; + case 56: + HASH_RETURN(0x7BFDF81D16304038LL, k_LIBXML_NOENT, LIBXML_NOENT); + HASH_RETURN(0x0D2E1084CDAD0038LL, k_SOCKET_EACCES, SOCKET_EACCES); + break; + case 57: + HASH_RETURN(0x305D14A7AEA6E039LL, k_CURLE_HTTP_POST_ERROR, CURLE_HTTP_POST_ERROR); + break; + case 62: + HASH_RETURN(0x5FD2CB246217903ELL, k_SOCKET_ENFILE, SOCKET_ENFILE); + HASH_RETURN(0x5A685A8B923EF03ELL, k_GD_MAJOR_VERSION, GD_MAJOR_VERSION); + break; + case 66: + HASH_RETURN(0x165DDF876D7B8042LL, k_MCC_ARG_WINDOW_MAX, MCC_ARG_WINDOW_MAX); + break; + case 67: + HASH_RETURN(0x1B8359C060BEA043LL, k_MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_FLOAT); + break; + case 70: + HASH_RETURN(0x2EAC6C54274D9046LL, k_CURLE_FILESIZE_EXCEEDED, CURLE_FILESIZE_EXCEEDED); + HASH_RETURN(0x120F5D0A6F7B6046LL, k_MW_QuadraticFilter, MW_QuadraticFilter); + HASH_RETURN(0x58333A9A1EAD5046LL, k_OCI_DTYPE_LOB, OCI_DTYPE_LOB); + HASH_RETURN(0x24E35407C7ECB046LL, k_LDAP_DEREF_FINDING, LDAP_DEREF_FINDING); + break; + case 72: + HASH_RETURN(0x24D76667BF633048LL, k_MW_CorruptImageError, MW_CorruptImageError); + break; + case 73: + HASH_RETURN(0x5DE3E748D9D8E049LL, k_IMG_ARC_CHORD, IMG_ARC_CHORD); + break; + case 76: + HASH_RETURN(0x63640164CF34D04CLL, k_U_VARIABLE_RANGE_OVERLAP, U_VARIABLE_RANGE_OVERLAP); + break; + case 78: + HASH_RETURN(0x65AB783463AC404ELL, k_PRIO_USER, PRIO_USER); + break; + case 83: + HASH_RETURN(0x3834ADF336A48053LL, k_CURLE_BAD_CALLING_ORDER, CURLE_BAD_CALLING_ORDER); + break; + case 88: + HASH_RETURN(0x191F3AC40DACA058LL, k_NOEXPR, NOEXPR); + HASH_RETURN(0x5DECA34BD518F058LL, k_CURLOPT_SSLENGINE_DEFAULT, CURLOPT_SSLENGINE_DEFAULT); + break; + case 90: + HASH_RETURN(0x3B233A808E27205ALL, k_X509_PURPOSE_SMIME_SIGN, X509_PURPOSE_SMIME_SIGN); + break; + case 91: + HASH_RETURN(0x529FF2519242105BLL, k_MYSQL_BOTH, MYSQL_BOTH); + break; + case 93: + HASH_RETURN(0x32FEF2218E3D005DLL, k_U_BRK_ERROR_START, U_BRK_ERROR_START); + break; + case 94: + HASH_RETURN(0x0775673C011FE05ELL, k_M_SQRT3, M_SQRT3); + HASH_RETURN(0x1066F0380935705ELL, k_CURLE_BAD_PASSWORD_ENTERED, CURLE_BAD_PASSWORD_ENTERED); + HASH_RETURN(0x60E71BCBB155905ELL, k_OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_NUMBER); + break; + case 95: + HASH_RETURN(0x025C97AC83F2605FLL, k_PHP_EXTENSION_DIR, PHP_EXTENSION_DIR); + HASH_RETURN(0x05BD0F7CB619405FLL, k_XHPROF_FLAGS_MEMORY, XHPROF_FLAGS_MEMORY); + break; + case 97: + HASH_RETURN(0x0D39E8DB4B050061LL, k_CURLE_URL_MALFORMAT_USER, CURLE_URL_MALFORMAT_USER); + break; + case 99: + HASH_RETURN(0x1B9FCA1518C08063LL, k_SQLT_VCS, SQLT_VCS); + break; + case 101: + HASH_RETURN(0x4DBAD5248E28E065LL, k_GD_MINOR_VERSION, GD_MINOR_VERSION); + break; + case 102: + HASH_RETURN(0x162869AD09667066LL, k_SOCKET_EMSGSIZE, SOCKET_EMSGSIZE); + break; + case 104: + HASH_RETURN(0x58DE2F532062E068LL, k_DNS_HINFO, DNS_HINFO); + break; + case 105: + HASH_RETURN(0x26831E046E602069LL, k_MYSQLI_PART_KEY_FLAG, MYSQLI_PART_KEY_FLAG); + break; + case 107: + HASH_RETURN(0x48A3A28E7886406BLL, k_SOCKET_EREMOTEIO, SOCKET_EREMOTEIO); + break; + case 108: + HASH_RETURN(0x1253AD3A8CEFA06CLL, k_PHPMCC_USED_SLOW_PATH, PHPMCC_USED_SLOW_PATH); + break; + case 110: + HASH_RETURN(0x23364B3005FE106ELL, k_U_TRAILING_BACKSLASH, U_TRAILING_BACKSLASH); + break; + case 112: + HASH_RETURN(0x43AD63E370BD6070LL, k_E_COMPILE_ERROR, E_COMPILE_ERROR); + break; + case 115: + HASH_RETURN(0x708BF44942953073LL, k_MW_DstInCompositeOp, MW_DstInCompositeOp); + HASH_RETURN(0x476F7EC294E4B073LL, k_MW_SolarizePreview, MW_SolarizePreview); + break; + case 118: + HASH_RETURN(0x0116B9772230A076LL, k_FNM_CASEFOLD, FNM_CASEFOLD); + break; + case 122: + HASH_RETURN(0x5C6D7235E403E07ALL, k_STREAM_CRYPTO_METHOD_TLS_SERVER, STREAM_CRYPTO_METHOD_TLS_SERVER); + break; + case 141: + HASH_RETURN(0x40914964F267908DLL, k_CURLINFO_SPEED_DOWNLOAD, CURLINFO_SPEED_DOWNLOAD); + break; + case 143: + HASH_RETURN(0x0A853395B8ABA08FLL, k_T_BOOLEAN_AND, T_BOOLEAN_AND); + break; + case 144: + HASH_RETURN(0x23BF045B559AC090LL, k_T_EXTENDS, T_EXTENDS); + break; + case 145: + HASH_RETURN(0x163178A011E18091LL, k_HTML_SPECIALCHARS, HTML_SPECIALCHARS); + break; + case 149: + HASH_RETURN(0x3EFC91D453928095LL, k_ICONV_MIME_DECODE_STRICT, ICONV_MIME_DECODE_STRICT); + break; + case 151: + HASH_RETURN(0x72B7498CEA160097LL, k_MCRYPT_SKIPJACK, MCRYPT_SKIPJACK); + HASH_RETURN(0x6717E5225F186097LL, k_MW_CMYKColorspace, MW_CMYKColorspace); + HASH_RETURN(0x249CC4EE18443097LL, k_OCI_SEEK_CUR, OCI_SEEK_CUR); + HASH_RETURN(0x4088FE8774F8C097LL, k_T_ENDFOR, T_ENDFOR); + break; + case 154: + HASH_RETURN(0x7DF1494DB1C9B09ALL, k_CURLOPT_TRANSFERTEXT, CURLOPT_TRANSFERTEXT); + HASH_RETURN(0x291F64C52D9BC09ALL, k_MW_DullPreview, MW_DullPreview); + break; + case 155: + HASH_RETURN(0x7BE020B47FF3209BLL, k_CURLFTPAUTH_TLS, CURLFTPAUTH_TLS); + HASH_RETURN(0x6C7282D4A03D509BLL, k_U_STRINGPREP_CHECK_BIDI_ERROR, U_STRINGPREP_CHECK_BIDI_ERROR); + break; + case 157: + HASH_RETURN(0x545C08575F9F909DLL, k_CURLE_SSL_PEER_CERTIFICATE, CURLE_SSL_PEER_CERTIFICATE); + break; + case 158: + HASH_RETURN(0x741CE25AA8E7A09ELL, k_CURLE_SSL_ENGINE_SETFAILED, CURLE_SSL_ENGINE_SETFAILED); + break; + case 160: + HASH_RETURN(0x3BCFF366A59C30A0LL, k_CURLM_CALL_MULTI_PERFORM, CURLM_CALL_MULTI_PERFORM); + break; + case 167: + HASH_RETURN(0x40F1B698E86BD0A7LL, k_M_SQRTPI, M_SQRTPI); + HASH_RETURN(0x34ED5F28955D50A7LL, k_MW_FileResource, MW_FileResource); + break; + case 168: + HASH_RETURN(0x6BE87509C64100A8LL, k_LIBXML_ERR_NONE, LIBXML_ERR_NONE); + break; + case 176: + HASH_RETURN(0x2F34C34383F430B0LL, k_LOG_DAEMON, LOG_DAEMON); + break; + case 177: + HASH_RETURN(0x54E38A1069E2A0B1LL, k_IDNA_PUNYCODE_ERROR, IDNA_PUNYCODE_ERROR); + HASH_RETURN(0x188AC91EC3F880B1LL, k_SQLT_ODT, SQLT_ODT); + break; + case 178: + HASH_RETURN(0x042031889E8080B2LL, k_SOCKET_ENETUNREACH, SOCKET_ENETUNREACH); + break; + case 179: + HASH_RETURN(0x1D504269BD2470B3LL, k_MW_BlackmanFilter, MW_BlackmanFilter); + break; + case 185: + HASH_RETURN(0x143B4F841B5FB0B9LL, k_U_MULTIPLE_EXPONENTIAL_SYMBOLS, U_MULTIPLE_EXPONENTIAL_SYMBOLS); + HASH_RETURN(0x44E041C232EDF0B9LL, k_T_THROW, T_THROW); + break; + case 188: + HASH_RETURN(0x77BB9261EECFB0BCLL, k_MW_SouthGravity, MW_SouthGravity); + HASH_RETURN(0x0E53DA129A4F70BCLL, k_LDAP_OPT_CLIENT_CONTROLS, LDAP_OPT_CLIENT_CONTROLS); + break; + case 190: + HASH_RETURN(0x7C721A82712E90BELL, k_CURLOPT_CAINFO, CURLOPT_CAINFO); + break; + case 197: + HASH_RETURN(0x3734E1F98D2EE0C5LL, k_MCC_ARG_SERVERS, MCC_ARG_SERVERS); + HASH_RETURN(0x49A29C927887A0C5LL, k_XSD_IDREFS, XSD_IDREFS); + break; + case 199: + HASH_RETURN(0x2CFE05AC8C3320C7LL, k_CURL_IPRESOLVE_WHATEVER, CURL_IPRESOLVE_WHATEVER); + break; + case 204: + HASH_RETURN(0x4A55CB4BDF07F0CCLL, k_XML_ATTRIBUTE_IDREF, XML_ATTRIBUTE_IDREF); + break; + case 205: + HASH_RETURN(0x3441A1ABA3FE80CDLL, k_MW_SubtractEvaluateOperator, MW_SubtractEvaluateOperator); + break; + case 206: + HASH_RETURN(0x5EE85E31EEDC50CELL, k_SOCKET_ENOMEM, SOCKET_ENOMEM); + break; + case 209: + HASH_RETURN(0x3909AB4B264710D1LL, k_SOCKET_ENOTBLK, SOCKET_ENOTBLK); + HASH_RETURN(0x35A650DFB90F00D1LL, k_MW_FillToBorderMethod, MW_FillToBorderMethod); + break; + case 210: + HASH_RETURN(0x2394038890C480D2LL, k_OCI_D_ROWID, OCI_D_ROWID); + break; + case 213: + HASH_RETURN(0x778EDAC12F8690D5LL, k_ABMON_12, ABMON_12); + break; + case 217: + HASH_RETURN(0x15C7DA341C93E0D9LL, k_XML_ERROR_ASYNC_ENTITY, XML_ERROR_ASYNC_ENTITY); + HASH_RETURN(0x377526C0A21900D9LL, k_T_ENDFOREACH, T_ENDFOREACH); + HASH_RETURN(0x36E917F3A3A030D9LL, k_T_IMPLEMENTS, T_IMPLEMENTS); + break; + case 220: + HASH_RETURN(0x3E8E74A9BBD4C0DCLL, k_MW_FileOpenWarning, MW_FileOpenWarning); + break; + case 222: + HASH_RETURN(0x3BC5DBA5FE7680DELL, k_U_STATE_OLD_WARNING, U_STATE_OLD_WARNING); + break; + case 223: + HASH_RETURN(0x784F8EB628DD60DFLL, k_U_FMT_PARSE_ERROR_START, U_FMT_PARSE_ERROR_START); + break; + case 225: + HASH_RETURN(0x6DD05D42DBBCA0E1LL, k_PHP_DATADIR, PHP_DATADIR); + HASH_RETURN(0x5B2F10E9551430E1LL, k_MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_LONGLONG); + break; + case 227: + HASH_RETURN(0x4FC6A9FA9B35E0E3LL, k_XML_PI_NODE, XML_PI_NODE); + break; + case 230: + HASH_RETURN(0x6993BDC6091260E6LL, k_MW_OptionError, MW_OptionError); + break; + case 231: + HASH_RETURN(0x61CA6A1041A950E7LL, k_U_INVALID_TABLE_FILE, U_INVALID_TABLE_FILE); + break; + case 232: + HASH_RETURN(0x499D4EB129ABE0E8LL, k_T_FILE, T_FILE); + break; + case 240: + HASH_RETURN(0x2A7F40F6572060F0LL, k_IMG_EFFECT_NORMAL, IMG_EFFECT_NORMAL); + break; + case 241: + HASH_RETURN(0x445C45466A6F20F1LL, k_SOCKET_ENOBUFS, SOCKET_ENOBUFS); + HASH_RETURN(0x2E4F54EADDE900F1LL, k_SOAP_ENC_ARRAY, SOAP_ENC_ARRAY); + break; + case 243: + HASH_RETURN(0x45D607659E0CF0F3LL, k_MW_ReduceNoisePreview, MW_ReduceNoisePreview); + break; + case 246: + HASH_RETURN(0x18F8A8B94217C0F6LL, k_MCC_DGRAM_NTRIES, MCC_DGRAM_NTRIES); + break; + case 249: + HASH_RETURN(0x3E3A7A47D81BF0F9LL, k_LOG_INFO, LOG_INFO); + HASH_RETURN(0x13E6D3157BAD80F9LL, k_CURLE_SSL_CIPHER, CURLE_SSL_CIPHER); + break; + case 251: + HASH_RETURN(0x35614BB5666840FBLL, k_MW_NormalStretch, MW_NormalStretch); + break; + case 252: + HASH_RETURN(0x3B90AAADEB96A0FCLL, k_SIGFPE, SIGFPE); + break; + case 256: + HASH_RETURN(0x380AEF9D6199A100LL, k_T_NEW, T_NEW); + break; + case 258: + HASH_RETURN(0x6DF3B76679016102LL, k_MW_MeanAbsoluteErrorMetric, MW_MeanAbsoluteErrorMetric); + break; + case 259: + HASH_RETURN(0x2CB14D7BD7E77103LL, k_MW_AndEvaluateOperator, MW_AndEvaluateOperator); + break; + case 260: + HASH_RETURN(0x4C4DEFD46F4CB104LL, k_T_OPEN_TAG_WITH_ECHO, T_OPEN_TAG_WITH_ECHO); + break; + case 262: + HASH_RETURN(0x34C392F7D6EBB106LL, k_SOL_UDP, SOL_UDP); + HASH_RETURN(0x5CC13D449E9A8106LL, k_U_ILLEGAL_ARGUMENT_ERROR, U_ILLEGAL_ARGUMENT_ERROR); + break; + case 267: + HASH_RETURN(0x118B4C355CEFB10BLL, k_SOCKET_EMFILE, SOCKET_EMFILE); + HASH_RETURN(0x14AD1681EF6B110BLL, k_U_MISPLACED_COMPOUND_FILTER, U_MISPLACED_COMPOUND_FILTER); + break; + case 270: + HASH_RETURN(0x6415537DBCA4D10ELL, k_PM_STR, PM_STR); + break; + case 273: + HASH_RETURN(0x06CBB3DB2B5C5111LL, k_GLOB_NOSORT, GLOB_NOSORT); + break; + case 275: + HASH_RETURN(0x5612C4D49FAF3113LL, k_CREDITS_SAPI, CREDITS_SAPI); + break; + case 278: + HASH_RETURN(0x508F323F0DE93116LL, k_SO_RCVLOWAT, SO_RCVLOWAT); + break; + case 280: + HASH_RETURN(0x49038AFF177BC118LL, k_LOG_CRON, LOG_CRON); + break; + case 281: + HASH_RETURN(0x3F0E0374DF40C119LL, k_U_REGEX_NUMBER_TOO_BIG, U_REGEX_NUMBER_TOO_BIG); + break; + case 283: + HASH_RETURN(0x7D0F3DEAA815C11BLL, k_MYSQLI_AUTO_INCREMENT_FLAG, MYSQLI_AUTO_INCREMENT_FLAG); + break; + case 285: + HASH_RETURN(0x0B391B824191411DLL, k_MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DOUBLE); + break; + case 286: + HASH_RETURN(0x2A5BA04D0218F11ELL, k_CASE_LOWER, CASE_LOWER); + HASH_RETURN(0x090443FFB5C7011ELL, k_OCI_RETURN_NULLS, OCI_RETURN_NULLS); + break; + case 289: + HASH_RETURN(0x51F00A16CBFFC121LL, k_MW_DifferenceCompositeOp, MW_DifferenceCompositeOp); + break; + case 290: + HASH_RETURN(0x5589FB788F200122LL, k_OPENSSL_SSLV23_PADDING, OPENSSL_SSLV23_PADDING); + break; + case 292: + HASH_RETURN(0x31DEDD534D889124LL, k_OCI_TEMP_BLOB, OCI_TEMP_BLOB); + break; + case 296: + HASH_RETURN(0x46850CA539E9D128LL, k_MW_StreamFatalError, MW_StreamFatalError); + break; + case 297: + HASH_RETURN(0x62498AF37C414129LL, k_IMG_ARC_EDGED, IMG_ARC_EDGED); + HASH_RETURN(0x140415FCF4E4C129LL, k_DATE_RFC822, DATE_RFC822); + break; + case 298: + HASH_RETURN(0x0AC536552E01212ALL, k_PNG_FILTER_UP, PNG_FILTER_UP); + break; + case 299: + HASH_RETURN(0x4BF499AE6A95A12BLL, k_MCC_SERVER_UP, MCC_SERVER_UP); + break; + case 301: + HASH_RETURN(0x09D8CFF143C5012DLL, k_MW_XorEvaluateOperator, MW_XorEvaluateOperator); + break; + case 302: + HASH_RETURN(0x4A5FD0F4E5ADD12ELL, k_CURLOPT_HEADERFUNCTION, CURLOPT_HEADERFUNCTION); + break; + case 304: + HASH_RETURN(0x188CA8C3A8F31130LL, k_OPENSSL_CIPHER_DES, OPENSSL_CIPHER_DES); + break; + case 310: + HASH_RETURN(0x2A91B7F4FD759136LL, k_MCRYPT_TWOFISH, MCRYPT_TWOFISH); + HASH_RETURN(0x685C0D44AF9AF136LL, k_MW_LineThroughDecoration, MW_LineThroughDecoration); + break; + case 312: + HASH_RETURN(0x1C8F3D80A55E2138LL, k_SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_TIMESTAMP); + break; + case 313: + HASH_RETURN(0x6E83FBC65D1B4139LL, k_IMG_GIF, IMG_GIF); + HASH_RETURN(0x149CD063632D8139LL, k_CURLE_TELNET_OPTION_SYNTAX, CURLE_TELNET_OPTION_SYNTAX); + break; + case 314: + HASH_RETURN(0x640BCCEAFB24A13ALL, k_MCC_TMO_MS, MCC_TMO_MS); + break; + case 316: + HASH_RETURN(0x451AD21F509FD13CLL, k_XSD_BOOLEAN, XSD_BOOLEAN); + break; + case 317: + HASH_RETURN(0x7D444AE389E2613DLL, k_CURLOPT_FILE, CURLOPT_FILE); + break; + case 320: + HASH_RETURN(0x09FD8C5060C5B140LL, k_DEFAULT_INCLUDE_PATH, DEFAULT_INCLUDE_PATH); + break; + case 321: + HASH_RETURN(0x7E983EF53BD42141LL, k_OPENSSL_ALGO_SHA1, OPENSSL_ALGO_SHA1); + break; + case 323: + HASH_RETURN(0x6C175FA78ADC8143LL, k_LIBXML_NOWARNING, LIBXML_NOWARNING); + HASH_RETURN(0x4DB37DBA76037143LL, k_U_USING_FALLBACK_WARNING, U_USING_FALLBACK_WARNING); + break; + case 324: + HASH_RETURN(0x242982A365105144LL, k_PHPMCC_VERSION, PHPMCC_VERSION); + break; + case 326: + HASH_RETURN(0x71E66725B71CB146LL, k_SOCKET_EUSERS, SOCKET_EUSERS); + break; + case 327: + HASH_RETURN(0x79033164D561A147LL, k_CURL_IPRESOLVE_V6, CURL_IPRESOLVE_V6); + break; + case 331: + HASH_RETURN(0x3E5116E246A5914BLL, k_SOCKET_ENOTSOCK, SOCKET_ENOTSOCK); + break; + case 333: + HASH_RETURN(0x07E54C9273E4014DLL, k_MCC_ARG_TMO, MCC_ARG_TMO); + break; + case 335: + HASH_RETURN(0x4DF9F0C632EB814FLL, k_MSG_EAGAIN, MSG_EAGAIN); + break; + case 337: + HASH_RETURN(0x565FFA5ECBAD9151LL, k_SQLITE3_ASSOC, SQLITE3_ASSOC); + HASH_RETURN(0x6A49D2B6B928F151LL, k_CURLE_FILE_COULDNT_READ_FILE, CURLE_FILE_COULDNT_READ_FILE); + break; + case 342: + HASH_RETURN(0x259028A31473A156LL, k_LOG_LOCAL3, LOG_LOCAL3); + break; + case 344: + HASH_RETURN(0x1E52A84F16CDB158LL, k_MW_NormalStyle, MW_NormalStyle); + break; + case 351: + HASH_RETURN(0x2E4075B6078C815FLL, k_MW_CacheWarning, MW_CacheWarning); + break; + case 353: + HASH_RETURN(0x70925BCCF19D2161LL, k_MW_ColorBurnCompositeOp, MW_ColorBurnCompositeOp); + break; + case 356: + HASH_RETURN(0x24F8A02C16A17164LL, k_X509_PURPOSE_NS_SSL_SERVER, X509_PURPOSE_NS_SSL_SERVER); + break; + case 357: + HASH_RETURN(0x085CED2CE2F67165LL, k_MW_ExtraExpandedStretch, MW_ExtraExpandedStretch); + break; + case 358: + HASH_RETURN(0x53490BFB7D564166LL, k_T_OBJECT_OPERATOR, T_OBJECT_OPERATOR); + break; + case 362: + HASH_RETURN(0x3236091988B9B16ALL, k_PHP_URL_PORT, PHP_URL_PORT); + break; + case 365: + HASH_RETURN(0x49BCF050AF62516DLL, k_IMG_EFFECT_REPLACE, IMG_EFFECT_REPLACE); + break; + case 366: + HASH_RETURN(0x758094C4288E216ELL, k_MW_CacheError, MW_CacheError); + break; + case 369: + HASH_RETURN(0x3539B397F70E0171LL, k_XSD_FLOAT, XSD_FLOAT); + break; + case 372: + HASH_RETURN(0x2DB8B7D39720D174LL, k_CURLOPT_FOLLOWLOCATION, CURLOPT_FOLLOWLOCATION); + break; + case 373: + HASH_RETURN(0x31297DF89A1AB175LL, k_SUNFUNCS_RET_DOUBLE, SUNFUNCS_RET_DOUBLE); + HASH_RETURN(0x764AF1C97F4E0175LL, k_CURLE_PARTIAL_FILE, CURLE_PARTIAL_FILE); + break; + case 375: + HASH_RETURN(0x033A40C2EFB53177LL, k_MW_UndefinedType, MW_UndefinedType); + break; + case 376: + HASH_RETURN(0x782044F13ADEF178LL, k_T_INCLUDE, T_INCLUDE); + break; + case 377: + HASH_RETURN(0x44E30716A70FD179LL, k_SOCKET_EAFNOSUPPORT, SOCKET_EAFNOSUPPORT); + break; + case 378: + HASH_RETURN(0x3C73805E2669F17ALL, k_CURLINFO_PRIVATE, CURLINFO_PRIVATE); + break; + case 379: + HASH_RETURN(0x04789C02EC68317BLL, k_STREAM_PEEK, STREAM_PEEK); + break; + case 380: + HASH_RETURN(0x1848F3513E3E717CLL, k_IMG_COLOR_TILED, IMG_COLOR_TILED); + break; + case 384: + HASH_RETURN(0x50AF07DFFA51D180LL, k_EXTR_PREFIX_INVALID, EXTR_PREFIX_INVALID); + HASH_RETURN(0x2D472DCACC4A7180LL, k_DNS_CNAME, DNS_CNAME); + break; + case 385: + HASH_RETURN(0x2FDCB3E64ABEF181LL, k_MW_SoftLightCompositeOp, MW_SoftLightCompositeOp); + break; + case 388: + HASH_RETURN(0x75232C75C3AE8184LL, k_MSG_ENOMSG, MSG_ENOMSG); + break; + case 396: + HASH_RETURN(0x684493AD30D0018CLL, k_HPHP_TRIM_CHARLIST, HPHP_TRIM_CHARLIST); + break; + case 397: + HASH_RETURN(0x4E8DCC2289B8218DLL, k_MW_CopyMagentaCompositeOp, MW_CopyMagentaCompositeOp); + break; + case 401: + HASH_RETURN(0x691B371D350D7191LL, k_MCC_ARG_DEFAULT_PREFIX, MCC_ARG_DEFAULT_PREFIX); + HASH_RETURN(0x4B68DEF2F07EB191LL, k_XML_LOCAL_NAMESPACE, XML_LOCAL_NAMESPACE); + break; + case 402: + HASH_RETURN(0x23F9120DF08B6192LL, k_DAY_4, DAY_4); + break; + case 407: + HASH_RETURN(0x723970AB4A10C197LL, k_INFO_ENVIRONMENT, INFO_ENVIRONMENT); + break; + case 408: + HASH_RETURN(0x368063F7585BE198LL, k_EXTR_PREFIX_IF_EXISTS, EXTR_PREFIX_IF_EXISTS); + HASH_RETURN(0x72A4B3A45D00C198LL, k_OPENSSL_KEYTYPE_EC, OPENSSL_KEYTYPE_EC); + break; + case 411: + HASH_RETURN(0x69F13B2D4055419BLL, k_STREAM_CRYPTO_METHOD_SSLv3_SERVER, STREAM_CRYPTO_METHOD_SSLv3_SERVER); + HASH_RETURN(0x28A19E59FA34619BLL, k_OCI_D_LOB, OCI_D_LOB); + break; + case 413: + HASH_RETURN(0x23E9BE044083D19DLL, k_M_LNPI, M_LNPI); + break; + case 414: + HASH_RETURN(0x24E3EB353DA4B19ELL, k_MYSQLI_REPORT_OFF, MYSQLI_REPORT_OFF); + break; + case 418: + HASH_RETURN(0x6DFC0765EBAB81A2LL, k_MCRYPT_DECRYPT, MCRYPT_DECRYPT); + break; + case 421: + HASH_RETURN(0x421DE792CD6961A5LL, k_U_MEMORY_ALLOCATION_ERROR, U_MEMORY_ALLOCATION_ERROR); + break; + case 422: + HASH_RETURN(0x57B0D81DB48C41A6LL, k_OCI_B_NUM, OCI_B_NUM); + break; + case 423: + HASH_RETURN(0x59937C7A8FE691A7LL, k_M_PI_2, M_PI_2); + HASH_RETURN(0x1D7804BB22E7E1A7LL, k_LOG_NDELAY, LOG_NDELAY); + break; + case 425: + HASH_RETURN(0x66F66C34345AE1A9LL, k_SOCKET_ECONNRESET, SOCKET_ECONNRESET); + break; + case 426: + HASH_RETURN(0x41CEB68707B291AALL, k_U_INTERNAL_PROGRAM_ERROR, U_INTERNAL_PROGRAM_ERROR); + break; + case 427: + HASH_RETURN(0x3D437EACE05F11ABLL, k_XML_ENTITY_DECL_NODE, XML_ENTITY_DECL_NODE); + break; + case 429: + HASH_RETURN(0x434B13D254DEE1ADLL, k_STREAM_CRYPTO_METHOD_SSLv2_CLIENT, STREAM_CRYPTO_METHOD_SSLv2_CLIENT); + HASH_RETURN(0x76DEA24C644F01ADLL, k_MW_SincFilter, MW_SincFilter); + HASH_RETURN(0x7D900C62865A91ADLL, k_MYSQLI_TYPE_TIME, MYSQLI_TYPE_TIME); + break; + case 435: + HASH_RETURN(0x2B43B6A242E051B3LL, k_GRAPHEME_EXTR_MAXBYTES, GRAPHEME_EXTR_MAXBYTES); + break; + case 436: + HASH_RETURN(0x125E7D9D64F581B4LL, k_MW_CacheFatalError, MW_CacheFatalError); + break; + case 437: + HASH_RETURN(0x31EAEC47352351B5LL, k_CURLOPT_ENCODING, CURLOPT_ENCODING); + break; + case 439: + HASH_RETURN(0x59AAE1BAB6E251B7LL, k_SOCKET_ENODEV, SOCKET_ENODEV); + HASH_RETURN(0x4B973B36D9D711B7LL, k_PNG_FILTER_SUB, PNG_FILTER_SUB); + break; + case 440: + HASH_RETURN(0x134E8D31B1E7C1B8LL, k_XML_ERROR_NONE, XML_ERROR_NONE); + HASH_RETURN(0x3338F347689101B8LL, k_MW_HanningFilter, MW_HanningFilter); + HASH_RETURN(0x1C77297ADBA211B8LL, k_U_INVALID_TABLE_FORMAT, U_INVALID_TABLE_FORMAT); + break; + case 443: + HASH_RETURN(0x0AFB77DBFC0841BBLL, k_E_CORE_WARNING, E_CORE_WARNING); + break; + case 444: + HASH_RETURN(0x62CAA7398AB841BCLL, k_SQLT_BFLOAT, SQLT_BFLOAT); + break; + case 446: + HASH_RETURN(0x05FB39895CB581BELL, k_UCOL_NON_IGNORABLE, UCOL_NON_IGNORABLE); + break; + case 447: + HASH_RETURN(0x3CCBEA4C0CE031BFLL, k_LIBXML_NOEMPTYTAG, LIBXML_NOEMPTYTAG); + break; + case 449: + HASH_RETURN(0x7D56706ABE12A1C1LL, k_MW_ResourceLimitError, MW_ResourceLimitError); + break; + case 450: + HASH_RETURN(0x1702970FD93A71C2LL, k_MW_HammingFilter, MW_HammingFilter); + break; + case 452: + HASH_RETURN(0x3F80D588B8A951C4LL, k_OPENSSL_PKCS1_OAEP_PADDING, OPENSSL_PKCS1_OAEP_PADDING); + break; + case 454: + HASH_RETURN(0x077B23F8471641C6LL, k_MSG_WAITALL, MSG_WAITALL); + break; + case 457: + HASH_RETURN(0x23B24F5A215BC1C9LL, k_ASSERT_ACTIVE, ASSERT_ACTIVE); + break; + case 461: + HASH_RETURN(0x7ADA5CA60966D1CDLL, k_MW_AddNoisePreview, MW_AddNoisePreview); + break; + case 462: + HASH_RETURN(0x00DFD8C30BCED1CELL, k_T_FUNC_C, T_FUNC_C); + break; + case 464: + HASH_RETURN(0x2C2F185F8164E1D0LL, k_SOCK_STREAM, SOCK_STREAM); + break; + case 465: + HASH_RETURN(0x3E276CAB068B01D1LL, k_MYSQLI_INIT_COMMAND, MYSQLI_INIT_COMMAND); + break; + case 470: + HASH_RETURN(0x53B27B033CEC71D6LL, k_COUNT_RECURSIVE, COUNT_RECURSIVE); + break; + case 471: + HASH_RETURN(0x664A69917264B1D7LL, k_IMG_ARC_PIE, IMG_ARC_PIE); + break; + case 472: + HASH_RETURN(0x089D261CA15031D8LL, k_SOAP_AUTHENTICATION_BASIC, SOAP_AUTHENTICATION_BASIC); + break; + case 473: + HASH_RETURN(0x3C4BE0D0E97501D9LL, k_CURLE_FTP_WRITE_ERROR, CURLE_FTP_WRITE_ERROR); + HASH_RETURN(0x44EE7CD09091A1D9LL, k_CURLE_HTTP_RANGE_ERROR, CURLE_HTTP_RANGE_ERROR); + break; + case 474: + HASH_RETURN(0x471A3A9CAE2EB1DALL, k_STREAM_IPPROTO_IP, STREAM_IPPROTO_IP); + break; + case 478: + HASH_RETURN(0x25EABAA903DCF1DELL, k_CURLM_INTERNAL_ERROR, CURLM_INTERNAL_ERROR); + break; + case 479: + HASH_RETURN(0x147159A9911D11DFLL, k_T_REQUIRE, T_REQUIRE); + break; + case 481: + HASH_RETURN(0x76A49DAC4A5F21E1LL, k_MW_ExclusionCompositeOp, MW_ExclusionCompositeOp); + HASH_RETURN(0x1A70FFCD298CF1E1LL, k_MYSQLI_TYPE_STRING, MYSQLI_TYPE_STRING); + break; + case 483: + HASH_RETURN(0x66493CAECEFAB1E3LL, k_UPLOAD_ERR_FORM_SIZE, UPLOAD_ERR_FORM_SIZE); + break; + case 487: + HASH_RETURN(0x2E0D473C4F1F31E7LL, k_XML_ERROR_TAG_MISMATCH, XML_ERROR_TAG_MISMATCH); + break; + case 492: + HASH_RETURN(0x48F4280605B5D1ECLL, k_T_IS_NOT_IDENTICAL, T_IS_NOT_IDENTICAL); + break; + case 493: + HASH_RETURN(0x5E38D4F4DF3E81EDLL, k_MCC_ARG_POLL_TMO, MCC_ARG_POLL_TMO); + HASH_RETURN(0x18C103CFDBD061EDLL, k_MCRYPT_BLOWFISH, MCRYPT_BLOWFISH); + break; + case 497: + HASH_RETURN(0x2B9EA864B4CDF1F1LL, k_MW_SrcOutCompositeOp, MW_SrcOutCompositeOp); + break; + case 502: + HASH_RETURN(0x2B5BC4677592F1F6LL, k_PKCS7_NOCERTS, PKCS7_NOCERTS); + break; + case 503: + HASH_RETURN(0x78E26CB9768801F7LL, k_POSIX_X_OK, POSIX_X_OK); + break; + case 505: + HASH_RETURN(0x56CE2F535F97A1F9LL, k_MW_CopyCyanCompositeOp, MW_CopyCyanCompositeOp); + break; + case 509: + HASH_RETURN(0x44301A1317A401FDLL, k_FNM_PATHNAME, FNM_PATHNAME); + HASH_RETURN(0x6A05B29805ED71FDLL, k_SOCKET_ENXIO, SOCKET_ENXIO); + break; + case 510: + HASH_RETURN(0x41EB97A0D996B1FELL, k_LDAP_OPT_SIZELIMIT, LDAP_OPT_SIZELIMIT); + break; + case 512: + HASH_RETURN(0x220AEBF3CE0DD200LL, k_CURLOPT_SSLCERTTYPE, CURLOPT_SSLCERTTYPE); + HASH_RETURN(0x432F1693EB75E200LL, k_T_DOUBLE_CAST, T_DOUBLE_CAST); + break; + case 513: + HASH_RETURN(0x10BBA645AF0F0201LL, k_MW_MultiplicativeGaussianNoise, MW_MultiplicativeGaussianNoise); + HASH_RETURN(0x52472178725EB201LL, k_SIGTSTP, SIGTSTP); + break; + case 514: + HASH_RETURN(0x7F565A8D62FC3202LL, k_CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_RESOLVE_HOST); + break; + case 515: + HASH_RETURN(0x6275F0000C7BA203LL, k_SOCKET_EROFS, SOCKET_EROFS); + HASH_RETURN(0x7B9363B88DB9B203LL, k_SOAP_COMPRESSION_ACCEPT, SOAP_COMPRESSION_ACCEPT); + break; + case 521: + HASH_RETURN(0x5280025069C04209LL, k_SOCKET_ENOMSG, SOCKET_ENOMSG); + break; + case 524: + HASH_RETURN(0x5247B815BD67F20CLL, k_PHP_LOCALSTATEDIR, PHP_LOCALSTATEDIR); + break; + case 525: + HASH_RETURN(0x0D5ACF18B2D6320DLL, k_ERA, ERA); + HASH_RETURN(0x43695032DF31A20DLL, k_XSD_SHORT, XSD_SHORT); + break; + case 534: + HASH_RETURN(0x24C8AA4D07AC5216LL, k_MW_PlusCompositeOp, MW_PlusCompositeOp); + break; + case 535: + HASH_RETURN(0x5ABC7FB06285B217LL, k_CRYPT_BLOWFISH, CRYPT_BLOWFISH); + break; + case 540: + HASH_RETURN(0x2E47072D968CA21CLL, k_U_BAD_VARIABLE_DEFINITION, U_BAD_VARIABLE_DEFINITION); + break; + case 541: + HASH_RETURN(0x2DF7204E47E6C21DLL, k_MW_MissingDelegateWarning, MW_MissingDelegateWarning); + HASH_RETURN(0x6F790B9D7AF1821DLL, k_T_LOGICAL_AND, T_LOGICAL_AND); + break; + case 542: + HASH_RETURN(0x171DD7FF1910C21ELL, k_DEBUG_LOG_USER, DEBUG_LOG_USER); + break; + case 543: + HASH_RETURN(0x412CD1382CE0521FLL, k_DOM_NOT_FOUND_ERR, DOM_NOT_FOUND_ERR); + HASH_RETURN(0x14133F8D7E51D21FLL, k_INFO_CREDITS, INFO_CREDITS); + break; + case 544: + HASH_RETURN(0x0A17581916F41220LL, k_CURLE_FTP_SSL_FAILED, CURLE_FTP_SSL_FAILED); + break; + case 552: + HASH_RETURN(0x29F2C3F8843D2228LL, k_SOCKET_ETIMEDOUT, SOCKET_ETIMEDOUT); + HASH_RETURN(0x39051623AFC62228LL, k_SOAP_DOCUMENT, SOAP_DOCUMENT); + break; + case 553: + HASH_RETURN(0x341A23ACEC9CE229LL, k_MCC_CONSISTENCY_IGNORE, MCC_CONSISTENCY_IGNORE); + break; + case 557: + HASH_RETURN(0x47E23B8709BBF22DLL, k_OPENSSL_VERSION_TEXT, OPENSSL_VERSION_TEXT); + HASH_RETURN(0x3C7A6BA33C6EC22DLL, k_MW_MaxEvaluateOperator, MW_MaxEvaluateOperator); + HASH_RETURN(0x4E3A159B3A7D422DLL, k_MW_PeakSignalToNoiseRatioMetric, MW_PeakSignalToNoiseRatioMetric); + break; + case 560: + HASH_RETURN(0x075DA4F5613C7230LL, k_MW_GreenChannel, MW_GreenChannel); + break; + case 563: + HASH_RETURN(0x349855B7ABB09233LL, k_SIG_ERR, SIG_ERR); + break; + case 564: + HASH_RETURN(0x20DE23C56C971234LL, k_DOM_INDEX_SIZE_ERR, DOM_INDEX_SIZE_ERR); + break; + case 565: + HASH_RETURN(0x12DF89577506F235LL, k_MCC_DELETE_NOTFOUND, MCC_DELETE_NOTFOUND); + HASH_RETURN(0x5EEB3A56F10EA235LL, k_LDAP_OPT_MATCHED_DN, LDAP_OPT_MATCHED_DN); + break; + case 566: + HASH_RETURN(0x6EC0C8D3D9175236LL, k_T_PUBLIC, T_PUBLIC); + break; + case 569: + HASH_RETURN(0x19F3B7F325559239LL, k_SOCKET_ESPIPE, SOCKET_ESPIPE); + break; + case 572: + HASH_RETURN(0x4094703FB8A4623CLL, k_SOCKET_ENOANO, SOCKET_ENOANO); + HASH_RETURN(0x0D125C842F3E223CLL, k_MCRYPT_SAFER64, MCRYPT_SAFER64); + break; + case 573: + HASH_RETURN(0x1C790270BB9B823DLL, k_T_CASE, T_CASE); + break; + case 574: + HASH_RETURN(0x5634BF0CE8EAB23ELL, k_DOM_VALIDATION_ERR, DOM_VALIDATION_ERR); + HASH_RETURN(0x27F2762A0A00F23ELL, k_SO_SNDTIMEO, SO_SNDTIMEO); + HASH_RETURN(0x3E25D27E876AC23ELL, k_U_SAFECLONE_ALLOCATED_WARNING, U_SAFECLONE_ALLOCATED_WARNING); + break; + case 575: + HASH_RETURN(0x287AB2CF3F9B923FLL, k_PKCS7_DETACHED, PKCS7_DETACHED); + break; + case 578: + HASH_RETURN(0x3ACFA7C2982C8242LL, k_MCC_ARG_DEBUG_LOGFILE, MCC_ARG_DEBUG_LOGFILE); + break; + case 582: + HASH_RETURN(0x7F7B3D2EF8483246LL, k_CURLFTPSSL_TRY, CURLFTPSSL_TRY); + break; + case 583: + HASH_RETURN(0x6018A619DB8D9247LL, k_CURLOPT_SSL_VERIFYHOST, CURLOPT_SSL_VERIFYHOST); + break; + case 584: + HASH_RETURN(0x1381ADDF8A942248LL, k_MW_HueCompositeOp, MW_HueCompositeOp); + HASH_RETURN(0x5EC35AD5B9A19248LL, k_MW_SubtractCompositeOp, MW_SubtractCompositeOp); + break; + case 587: + HASH_RETURN(0x72229207EBA2224BLL, k_SIGTTIN, SIGTTIN); + break; + case 590: + HASH_RETURN(0x73A7F14F205CC24ELL, k_XSD_QNAME, XSD_QNAME); + break; + case 591: + HASH_RETURN(0x7A9D570E193F724FLL, k_IMG_EFFECT_ALPHABLEND, IMG_EFFECT_ALPHABLEND); + HASH_RETURN(0x3C13389DB311F24FLL, k_IDNA_MALLOC_ERROR, IDNA_MALLOC_ERROR); + HASH_RETURN(0x42BC8083C1F9124FLL, k_T_ENCAPSED_AND_WHITESPACE, T_ENCAPSED_AND_WHITESPACE); + break; + case 595: + HASH_RETURN(0x355F9D2D97ECB253LL, k_XML_ERROR_INCORRECT_ENCODING, XML_ERROR_INCORRECT_ENCODING); + break; + case 597: + HASH_RETURN(0x593FE694D1BB1255LL, k_MCC_PROXY_GET_OP, MCC_PROXY_GET_OP); + HASH_RETURN(0x3EA72BED56FC6255LL, k_CURLOPT_UNRESTRICTED_AUTH, CURLOPT_UNRESTRICTED_AUTH); + break; + case 600: + HASH_RETURN(0x2245E0B5CB0FE258LL, k_SOCKET_EBADE, SOCKET_EBADE); + break; + case 602: + HASH_RETURN(0x417E7879E2D4525ALL, k_U_INVALID_RBT_SYNTAX, U_INVALID_RBT_SYNTAX); + break; + case 607: + HASH_RETURN(0x5DF7F07E50E0B25FLL, k_MW_CenterAlign, MW_CenterAlign); + break; + case 610: + HASH_RETURN(0x74E66DE996EE7262LL, k_CLOCK_PROCESS_CPUTIME_ID, CLOCK_PROCESS_CPUTIME_ID); + break; + case 613: + HASH_RETURN(0x1C4252DFF3BD2265LL, k_MYSQLI_RPL_ADMIN, MYSQLI_RPL_ADMIN); + break; + case 616: + HASH_RETURN(0x1B2F2E42374C3268LL, k_SOCKET_ENOSYS, SOCKET_ENOSYS); + break; + case 618: + HASH_RETURN(0x5B55E1129AA9826ALL, k_MW_CatromFilter, MW_CatromFilter); + break; + case 621: + HASH_RETURN(0x42FCCBA127F3B26DLL, k_DAY_3, DAY_3); + break; + case 622: + HASH_RETURN(0x165965CF421BB26ELL, k_MYSQLI_CLIENT_INTERACTIVE, MYSQLI_CLIENT_INTERACTIVE); + break; + case 627: + HASH_RETURN(0x56C6427F10C24273LL, k_STREAM_NOTIFY_COMPLETED, STREAM_NOTIFY_COMPLETED); + break; + case 628: + HASH_RETURN(0x3659948CD65DB274LL, k_SOCKET_EBUSY, SOCKET_EBUSY); + break; + case 630: + HASH_RETURN(0x113B3E85DF8FB276LL, k_M_LN10, M_LN10); + HASH_RETURN(0x782069B95F67F276LL, k_SOCKET_EPROTO, SOCKET_EPROTO); + break; + case 631: + HASH_RETURN(0x2BD53205C251B277LL, k_STREAM_SHUT_RD, STREAM_SHUT_RD); + break; + case 632: + HASH_RETURN(0x64DE7307E05FD278LL, k_MW_UniformNoise, MW_UniformNoise); + break; + case 634: + HASH_RETURN(0x14A7EDF65F3DD27ALL, k_CURLOPT_BINARYTRANSFER, CURLOPT_BINARYTRANSFER); + break; + case 635: + HASH_RETURN(0x7A39A5C5CE68C27BLL, k_STREAM_NOTIFY_SEVERITY_WARN, STREAM_NOTIFY_SEVERITY_WARN); + break; + case 638: + HASH_RETURN(0x4F255D7C3AE5B27ELL, k_IMAGETYPE_PSD, IMAGETYPE_PSD); + break; + case 642: + HASH_RETURN(0x1623F1D4FA681282LL, k_XSD_ENTITIES, XSD_ENTITIES); + break; + case 643: + HASH_RETURN(0x1BE9DEE4FDF90283LL, k_XSD_NOTATION, XSD_NOTATION); + break; + case 644: + HASH_RETURN(0x73B37628DB24D284LL, k_LOG_LOCAL7, LOG_LOCAL7); + HASH_RETURN(0x34CC1A9C86D9A284LL, k_U_ERROR_LIMIT, U_ERROR_LIMIT); + break; + case 645: + HASH_RETURN(0x7B60B2C732ADA285LL, k_DATE_ATOM, DATE_ATOM); + break; + case 649: + HASH_RETURN(0x790C72D9881D7289LL, k_LOCK_SH, LOCK_SH); + HASH_RETURN(0x143F8F0A3E3B8289LL, k_CURLOPT_EGDSOCKET, CURLOPT_EGDSOCKET); + break; + case 651: + HASH_RETURN(0x29E952E38690128BLL, k_CURLOPT_FTP_SSL, CURLOPT_FTP_SSL); + break; + case 652: + HASH_RETURN(0x28AB5875C40CA28CLL, k_MCC_DGRAM_TMO_THRESHOLD, MCC_DGRAM_TMO_THRESHOLD); + HASH_RETURN(0x228ECCDDE928928CLL, k_IMG_FILTER_EMBOSS, IMG_FILTER_EMBOSS); + break; + case 654: + HASH_RETURN(0x42919790EC83E28ELL, k_UPLOAD_ERR_OK, UPLOAD_ERR_OK); + break; + case 659: + HASH_RETURN(0x237C0278F4DEB293LL, k_PHP_URL_USER, PHP_URL_USER); + break; + case 663: + HASH_RETURN(0x369DC1F8808DB297LL, k_LIBXML_NOCDATA, LIBXML_NOCDATA); + break; + case 668: + HASH_RETURN(0x1A02746C3B3C729CLL, k_SOCKET_EPROTOTYPE, SOCKET_EPROTOTYPE); + HASH_RETURN(0x7F2EEE1B4C19029CLL, k_SIGTTOU, SIGTTOU); + break; + case 669: + HASH_RETURN(0x181A719752D0029DLL, k_SOCKET_ENOTEMPTY, SOCKET_ENOTEMPTY); + HASH_RETURN(0x4E8CCB7CE850029DLL, k_DEBUG_LOG_REFERER, DEBUG_LOG_REFERER); + break; + case 671: + HASH_RETURN(0x62F9F10FC177A29FLL, k_CURLINFO_HEADER_OUT, CURLINFO_HEADER_OUT); + HASH_RETURN(0x1E7CF4E4B67AC29FLL, k_CURLE_FTP_COULDNT_GET_SIZE, CURLE_FTP_COULDNT_GET_SIZE); + break; + case 673: + HASH_RETURN(0x2585AD895FB7F2A1LL, k_MW_ModuleError, MW_ModuleError); + break; + case 674: + HASH_RETURN(0x4E64944034A9D2A2LL, k_CURLCLOSEPOLICY_LEAST_TRAFFIC, CURLCLOSEPOLICY_LEAST_TRAFFIC); + break; + case 676: + HASH_RETURN(0x41B6ACF88D2C82A4LL, k_SQLT_AFC, SQLT_AFC); + break; + case 677: + HASH_RETURN(0x1A209FE7F8F1C2A5LL, k_T_LIST, T_LIST); + break; + case 678: + HASH_RETURN(0x455D174A426D42A6LL, k_SOAP_RPC, SOAP_RPC); + HASH_RETURN(0x22BC948E7F8002A6LL, k_CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_1_1); + break; + case 680: + HASH_RETURN(0x4E4C6CF288C352A8LL, k_CURLOPT_PROXYPORT, CURLOPT_PROXYPORT); + break; + case 682: + HASH_RETURN(0x189F588D3DE012AALL, k_SOCK_RAW, SOCK_RAW); + HASH_RETURN(0x39200AAC022002AALL, k_MW_NoDecoration, MW_NoDecoration); + HASH_RETURN(0x102A6D8614C5F2AALL, k_MW_ConfigureError, MW_ConfigureError); + HASH_RETURN(0x51C0E50390FA62AALL, k_MW_UndefinedMetric, MW_UndefinedMetric); + break; + case 686: + HASH_RETURN(0x1792BEA1445A82AELL, k_MW_UndefinedCompositeOp, MW_UndefinedCompositeOp); + break; + case 687: + HASH_RETURN(0x20BEC282C625B2AFLL, k_M_E, M_E); + HASH_RETURN(0x3F66E2A07F9A72AFLL, k_MW_PointFilter, MW_PointFilter); + break; + case 688: + HASH_RETURN(0x35ED63A6253462B0LL, k_CURLOPT_FTP_CREATE_MISSING_DIRS, CURLOPT_FTP_CREATE_MISSING_DIRS); + break; + case 690: + HASH_RETURN(0x35240EA20DAE42B2LL, k_IMG_COLOR_STYLEDBRUSHED, IMG_COLOR_STYLEDBRUSHED); + break; + case 692: + HASH_RETURN(0x2E02DF17536A82B4LL, k_SQLITE3_NULL, SQLITE3_NULL); + break; + case 698: + HASH_RETURN(0x5DF2939D286472BALL, k_ABMON_9, ABMON_9); + break; + case 699: + HASH_RETURN(0x0F9902441019F2BBLL, k_MW_SrcInCompositeOp, MW_SrcInCompositeOp); + break; + case 700: + HASH_RETURN(0x17E190EDE625F2BCLL, k_MCRYPT_CAST_256, MCRYPT_CAST_256); + HASH_RETURN(0x621568120FA9A2BCLL, k_DATE_COOKIE, DATE_COOKIE); + break; + case 703: + HASH_RETURN(0x1E73F96470FFF2BFLL, k_SOAP_USE_XSI_ARRAY_TYPE, SOAP_USE_XSI_ARRAY_TYPE); + break; + case 706: + HASH_RETURN(0x3546D073D91FC2C2LL, k_MW_UndefinedDecoration, MW_UndefinedDecoration); + HASH_RETURN(0x68B3775AF555B2C2LL, k_LDAP_DEREF_SEARCHING, LDAP_DEREF_SEARCHING); + break; + case 709: + HASH_RETURN(0x38976DA1695812C5LL, k_U_MESSAGE_PARSE_ERROR, U_MESSAGE_PARSE_ERROR); + break; + case 710: + HASH_RETURN(0x1E4F8F809E3F22C6LL, k_CURLOPT_FTPLISTONLY, CURLOPT_FTPLISTONLY); + HASH_RETURN(0x6B97364DCE0B32C6LL, k_U_ILLEGAL_CHAR_IN_SEGMENT, U_ILLEGAL_CHAR_IN_SEGMENT); + break; + case 712: + HASH_RETURN(0x6AF9238480B522C8LL, k_STREAM_SOCK_DGRAM, STREAM_SOCK_DGRAM); + break; + case 716: + HASH_RETURN(0x1E05D97666E0D2CCLL, k_T_FMT_AMPM, T_FMT_AMPM); + break; + case 717: + HASH_RETURN(0x7FCF03B11EE272CDLL, k_M_LOG2E, M_LOG2E); + break; + case 718: + HASH_RETURN(0x4AC106C9FC2522CELL, k_SQLT_LBI, SQLT_LBI); + break; + case 722: + HASH_RETURN(0x7D58E4C5EDB3E2D2LL, k_CURLCLOSEPOLICY_SLOWEST, CURLCLOSEPOLICY_SLOWEST); + break; + case 723: + HASH_RETURN(0x4AA86A910F9062D3LL, k_PHP_OUTPUT_HANDLER_CONT, PHP_OUTPUT_HANDLER_CONT); + break; + case 724: + HASH_RETURN(0x0A00C65D60AE52D4LL, k_CREDITS_GROUP, CREDITS_GROUP); + HASH_RETURN(0x4FC0D94706C662D4LL, k_U_NO_SPACE_AVAILABLE, U_NO_SPACE_AVAILABLE); + break; + case 725: + HASH_RETURN(0x3D93FDBE5D2ED2D5LL, k_IMAGETYPE_SWC, IMAGETYPE_SWC); + break; + case 727: + HASH_RETURN(0x1A3C70DD642FC2D7LL, k_MW_UndefinedCap, MW_UndefinedCap); + break; + case 729: + HASH_RETURN(0x55E4F13C45A2B2D9LL, k_MSG_IPC_NOWAIT, MSG_IPC_NOWAIT); + break; + case 731: + HASH_RETURN(0x7D3641290CD902DBLL, k_POSIX_W_OK, POSIX_W_OK); + break; + case 734: + HASH_RETURN(0x7A1801943EC752DELL, k_U_UNDEFINED_SEGMENT_REFERENCE, U_UNDEFINED_SEGMENT_REFERENCE); + break; + case 748: + HASH_RETURN(0x0CD5F3B4B12E32ECLL, k_T_DOC_COMMENT, T_DOC_COMMENT); + break; + case 750: + HASH_RETURN(0x2FBB7CC292C9D2EELL, k_LOG_LOCAL5, LOG_LOCAL5); + HASH_RETURN(0x43EB2A36480A22EELL, k_PNG_FILTER_NONE, PNG_FILTER_NONE); + break; + case 761: + HASH_RETURN(0x2FC79D110F9502F9LL, k_CURLAUTH_NTLM, CURLAUTH_NTLM); + break; + case 762: + HASH_RETURN(0x68D4466D8E0A82FALL, k_PREG_RECURSION_LIMIT_ERROR, PREG_RECURSION_LIMIT_ERROR); + break; + case 764: + HASH_RETURN(0x334AAA38C97C62FCLL, k_SORT_STRING, SORT_STRING); + break; + case 765: + HASH_RETURN(0x4B38D50E1636B2FDLL, k_MYSQLI_ZEROFILL_FLAG, MYSQLI_ZEROFILL_FLAG); + break; + case 768: + HASH_RETURN(0x0F9BEB1F63F43300LL, k_XSD_DATETIME, XSD_DATETIME); + break; + case 769: + HASH_RETURN(0x1143A1E38AA4C301LL, k_MW_CorruptImageFatalError, MW_CorruptImageFatalError); + break; + case 777: + HASH_RETURN(0x22DC0CE9518CB309LL, k_ABMON_6, ABMON_6); + break; + case 779: + HASH_RETURN(0x49566FE0BA32030BLL, k_GLOB_AVAILABLE_FLAGS, GLOB_AVAILABLE_FLAGS); + break; + case 782: + HASH_RETURN(0x7AE584489D4A930ELL, k_CURLE_OBSOLETE, CURLE_OBSOLETE); + break; + case 786: + HASH_RETURN(0x0ECCA8FCF9730312LL, k_CURLMSG_DONE, CURLMSG_DONE); + break; + case 787: + HASH_RETURN(0x7AE91B1CE7FFA313LL, k_IMG_ARC_ROUNDED, IMG_ARC_ROUNDED); + HASH_RETURN(0x3ABE09B351C61313LL, k_MW_BesselFilter, MW_BesselFilter); + break; + case 800: + HASH_RETURN(0x4761F8F65A845320LL, k_MW_MirrorVirtualPixelMethod, MW_MirrorVirtualPixelMethod); + break; + case 801: + HASH_RETURN(0x0FB546F53B431321LL, k_CURLOPT_REFERER, CURLOPT_REFERER); + HASH_RETURN(0x3529B27DB9D81321LL, k_U_MISPLACED_CURSOR_OFFSET, U_MISPLACED_CURSOR_OFFSET); + break; + case 803: + HASH_RETURN(0x7979E954F1B70323LL, k_SORT_LOCALE_STRING, SORT_LOCALE_STRING); + break; + case 805: + HASH_RETURN(0x5DFD78B059539325LL, k_MW_MeanSquaredErrorMetric, MW_MeanSquaredErrorMetric); + HASH_RETURN(0x774A979412A0B325LL, k_POSIX_S_IFREG, POSIX_S_IFREG); + break; + case 807: + HASH_RETURN(0x323226035FA4A327LL, k_LDAP_OPT_DEREF, LDAP_OPT_DEREF); + break; + case 810: + HASH_RETURN(0x53FA16BBA877F32ALL, k_MW_MapResource, MW_MapResource); + HASH_RETURN(0x1DB39D1B2F05232ALL, k_U_REGEX_ERROR_START, U_REGEX_ERROR_START); + break; + case 816: + HASH_RETURN(0x7795727FCCA4A330LL, k_XML_ELEMENT_NODE, XML_ELEMENT_NODE); + HASH_RETURN(0x1D1C33835BAF5330LL, k_DEBUG_LOG_POST, DEBUG_LOG_POST); + break; + case 817: + HASH_RETURN(0x399E19BFA1EF7331LL, k_CURLM_BAD_EASY_HANDLE, CURLM_BAD_EASY_HANDLE); + break; + case 819: + HASH_RETURN(0x5710E7D860D48333LL, k_CREDITS_MODULES, CREDITS_MODULES); + break; + case 821: + HASH_RETURN(0x1AA4CD54F6D53335LL, k_STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_FILE_SIZE_IS); + HASH_RETURN(0x7F7E8227E089D335LL, k_MW_ModuleFatalError, MW_ModuleFatalError); + break; + case 828: + HASH_RETURN(0x3486E1F13CD4833CLL, k_SOAP_ENC_OBJECT, SOAP_ENC_OBJECT); + HASH_RETURN(0x12593ED93669A33CLL, k_CURLOPT_INFILESIZE, CURLOPT_INFILESIZE); + break; + case 829: + HASH_RETURN(0x1B0C5A86F9AC033DLL, k_CURLOPT_IPRESOLVE, CURLOPT_IPRESOLVE); + break; + case 831: + HASH_RETURN(0x020A4209EF17233FLL, k_MYSQLI_READ_DEFAULT_FILE, MYSQLI_READ_DEFAULT_FILE); + break; + case 833: + HASH_RETURN(0x200848FE3FE25341LL, k_MW_RelativeIntent, MW_RelativeIntent); + HASH_RETURN(0x6887A46ACAA8A341LL, k_WNOHANG, WNOHANG); + break; + case 834: + HASH_RETURN(0x48DCEDA680CD2342LL, k_U_INVALID_PROPERTY_PATTERN, U_INVALID_PROPERTY_PATTERN); + break; + case 836: + HASH_RETURN(0x31CED6F609F44344LL, k_SOCKET_ETIME, SOCKET_ETIME); + break; + case 837: + HASH_RETURN(0x77757027A1C85345LL, k_CURLINFO_SPEED_UPLOAD, CURLINFO_SPEED_UPLOAD); + HASH_RETURN(0x34813AEE6859D345LL, k_U_AMBIGUOUS_ALIAS_WARNING, U_AMBIGUOUS_ALIAS_WARNING); + break; + case 841: + HASH_RETURN(0x6EFCAB50D6EE8349LL, k_MW_OpaqueOpacity, MW_OpaqueOpacity); + break; + case 843: + HASH_RETURN(0x19BEC0973D8DB34BLL, k_MCRYPT_LOKI97, MCRYPT_LOKI97); + break; + case 844: + HASH_RETURN(0x140C8260945D834CLL, k_CURLE_FTP_COULDNT_RETR_FILE, CURLE_FTP_COULDNT_RETR_FILE); + break; + case 846: + HASH_RETURN(0x08CFBA5329A0834ELL, k_MCC_RXDGRAM_MAX, MCC_RXDGRAM_MAX); + HASH_RETURN(0x5071218CCED8534ELL, k_INFO_MODULES, INFO_MODULES); + break; + case 847: + HASH_RETURN(0x216FEB6549BC634FLL, k_DEBUG_LOG_NONE, DEBUG_LOG_NONE); + HASH_RETURN(0x68C61080F8E5D34FLL, k_MW_InCompositeOp, MW_InCompositeOp); + HASH_RETURN(0x17FF6A906E8A834FLL, k_T_DOUBLE_COLON, T_DOUBLE_COLON); + break; + case 852: + HASH_RETURN(0x30E8CD0D7596D354LL, k_STREAM_SERVER_LISTEN, STREAM_SERVER_LISTEN); + break; + case 857: + HASH_RETURN(0x3FD34044ACB34359LL, k_STREAM_MKDIR_RECURSIVE, STREAM_MKDIR_RECURSIVE); + break; + case 858: + HASH_RETURN(0x22801028245F135ALL, k_MCRYPT_SERPENT, MCRYPT_SERPENT); + HASH_RETURN(0x5397F98E0316535ALL, k_U_INVALID_CHAR_FOUND, U_INVALID_CHAR_FOUND); + HASH_RETURN(0x40D02305AC4C135ALL, k_SIGCLD, SIGCLD); + break; + case 859: + HASH_RETURN(0x2A2B82F82056C35BLL, k_UCOL_DEFAULT_STRENGTH, UCOL_DEFAULT_STRENGTH); + break; + case 863: + HASH_RETURN(0x0F910BA0E3F8F35FLL, k_MCRYPT_DEV_URANDOM, MCRYPT_DEV_URANDOM); + break; + case 864: + HASH_RETURN(0x371DC37A0607D360LL, k_MCC_ARG_FB_SERIALIZE_ENABLED, MCC_ARG_FB_SERIALIZE_ENABLED); + break; + case 867: + HASH_RETURN(0x594B91873B32D363LL, k_U_MULTIPLE_DECIMAL_SEPERATORS, U_MULTIPLE_DECIMAL_SEPERATORS); + break; + case 870: + HASH_RETURN(0x2FFF697373A2B366LL, k_LC_NUMERIC, LC_NUMERIC); + HASH_RETURN(0x519FF69D856DA366LL, k_CURLE_BAD_FUNCTION_ARGUMENT, CURLE_BAD_FUNCTION_ARGUMENT); + break; + case 871: + HASH_RETURN(0x0325787AD2DA4367LL, k_CURLOPT_PROXY, CURLOPT_PROXY); + break; + case 873: + HASH_RETURN(0x0D55442B282D7369LL, k_WSDL_CACHE_MEMORY, WSDL_CACHE_MEMORY); + break; + case 874: + HASH_RETURN(0x21EF9D5B5074D36ALL, k_MCC_DOWN_ON_TIMEOUT, MCC_DOWN_ON_TIMEOUT); + break; + case 875: + HASH_RETURN(0x198D20310CD0036BLL, k_T_BOOL_CAST, T_BOOL_CAST); + break; + case 876: + HASH_RETURN(0x30EB29BDEA5C136CLL, k_SOCKET_ENOTUNIQ, SOCKET_ENOTUNIQ); + break; + case 878: + HASH_RETURN(0x24FFA35440DD236ELL, k_MYSQL_NUM, MYSQL_NUM); + break; + case 882: + HASH_RETURN(0x14349C4DD3636372LL, k_MCRYPT_XTEA, MCRYPT_XTEA); + HASH_RETURN(0x3F9D615E26D5B372LL, k_T_AS, T_AS); + break; + case 886: + HASH_RETURN(0x54A96BB48C682376LL, k_XHPROF_FLAGS_NO_BUILTINS, XHPROF_FLAGS_NO_BUILTINS); + break; + case 889: + HASH_RETURN(0x66A60F42072BF379LL, k_OCI_B_BLOB, OCI_B_BLOB); + break; + case 890: + HASH_RETURN(0x1CE0CA042A91037ALL, k_STR_PAD_LEFT, STR_PAD_LEFT); + break; + case 894: + HASH_RETURN(0x690439A851C2937ELL, k_DNS_NAPTR, DNS_NAPTR); + HASH_RETURN(0x1078EBC4EDB2D37ELL, k_MYSQLI_TYPE_NULL, MYSQLI_TYPE_NULL); + break; + case 896: + HASH_RETURN(0x6ECB38F9F400C380LL, k_SOCKET_ESTRPIPE, SOCKET_ESTRPIPE); + break; + case 897: + HASH_RETURN(0x388556C05BC0D381LL, k_SIGCONT, SIGCONT); + break; + case 901: + HASH_RETURN(0x4A03134D4796B385LL, k_CURLINFO_REDIRECT_TIME, CURLINFO_REDIRECT_TIME); + break; + case 905: + HASH_RETURN(0x0F65936884163389LL, k_MW_ImageFatalError, MW_ImageFatalError); + HASH_RETURN(0x5CA3FFC20BED4389LL, k_MW_ShearPreview, MW_ShearPreview); + break; + case 907: + HASH_RETURN(0x1A92401EE5EDA38BLL, k_MYSQL_CLIENT_IGNORE_SPACE, MYSQL_CLIENT_IGNORE_SPACE); + break; + case 913: + HASH_RETURN(0x413EB10196557391LL, k_MW_UndefinedResolution, MW_UndefinedResolution); + break; + case 915: + HASH_RETURN(0x4DF0A43082631393LL, k_FB_UNSERIALIZE_UNEXPECTED_ARRAY_KEY_TYPE, FB_UNSERIALIZE_UNEXPECTED_ARRAY_KEY_TYPE); + break; + case 921: + HASH_RETURN(0x7536C3C6B3140399LL, k_MW_MonitorFatalError, MW_MonitorFatalError); + break; + case 925: + HASH_RETURN(0x0B63E2C05F99139DLL, k_LDAP_OPT_TIMELIMIT, LDAP_OPT_TIMELIMIT); + break; + case 933: + HASH_RETURN(0x7D4257DF684E23A5LL, k_E_CORE_ERROR, E_CORE_ERROR); + break; + case 936: + HASH_RETURN(0x3BBB1A5A5501E3A8LL, k_CURLOPT_PRIVATE, CURLOPT_PRIVATE); + break; + case 937: + HASH_RETURN(0x0B8B3957C8BAB3A9LL, k_MW_ErrorException, MW_ErrorException); + break; + case 940: + HASH_RETURN(0x34BC31E4554FD3ACLL, k_LIBXML_NOBLANKS, LIBXML_NOBLANKS); + break; + case 944: + HASH_RETURN(0x2ACD3EF18A9043B0LL, k_MYSQLI_CLIENT_NO_SCHEMA, MYSQLI_CLIENT_NO_SCHEMA); + break; + case 945: + HASH_RETURN(0x2035AAFE6B3A33B1LL, k_OCI_SYSDATE, OCI_SYSDATE); + break; + case 946: + HASH_RETURN(0x63EB39F3D345F3B2LL, k_STREAM_REPORT_ERRORS, STREAM_REPORT_ERRORS); + HASH_RETURN(0x46F02DF0C232F3B2LL, k_SOCKET_ENONET, SOCKET_ENONET); + break; + case 947: + HASH_RETURN(0x7A9FA5A6050B23B3LL, k_U_MISSING_SEGMENT_CLOSE, U_MISSING_SEGMENT_CLOSE); + break; + case 950: + HASH_RETURN(0x3CC3CB3BC40793B6LL, k_LDAP_OPT_ERROR_STRING, LDAP_OPT_ERROR_STRING); + break; + case 954: + HASH_RETURN(0x51D56DE3761713BALL, k_MCRYPT_CRYPT, MCRYPT_CRYPT); + HASH_RETURN(0x1F8C9ECCA43E23BALL, k_MW_SemiCondensedStretch, MW_SemiCondensedStretch); + break; + case 955: + HASH_RETURN(0x592B54B3464DC3BBLL, k_SOCKET_ERESTART, SOCKET_ERESTART); + break; + case 957: + HASH_RETURN(0x211874E4DFCA83BDLL, k_T_RETURN, T_RETURN); + break; + case 959: + HASH_RETURN(0x6DDD00AF7D5703BFLL, k_PHP_PREFIX, PHP_PREFIX); + HASH_RETURN(0x1E4ECFDAB4C683BFLL, k_LOG_LPR, LOG_LPR); + break; + case 960: + HASH_RETURN(0x618AD241D7EF83C0LL, k_MW_FloodfillMethod, MW_FloodfillMethod); + break; + case 962: + HASH_RETURN(0x642995D84F4603C2LL, k_CURLAUTH_BASIC, CURLAUTH_BASIC); + break; + case 969: + HASH_RETURN(0x51FFBFDA902D43C9LL, k_SOAP_COMPRESSION_GZIP, SOAP_COMPRESSION_GZIP); + HASH_RETURN(0x4DB9C3ACC4D1E3C9LL, k_MW_PointMethod, MW_PointMethod); + break; + case 971: + HASH_RETURN(0x6723C5CCCE1C53CBLL, k_DATE_RFC1123, DATE_RFC1123); + break; + case 974: + HASH_RETURN(0x58FC90A2D0AB23CELL, k_SOAP_PERSISTENCE_REQUEST, SOAP_PERSISTENCE_REQUEST); + break; + case 978: + HASH_RETURN(0x08791F21085DE3D2LL, k_GD_BUNDLED, GD_BUNDLED); + break; + case 979: + HASH_RETURN(0x0898FB0BC51483D3LL, k_U_CE_NOT_FOUND_ERROR, U_CE_NOT_FOUND_ERROR); + HASH_RETURN(0x5161581BF71593D3LL, k_SIGTERM, SIGTERM); + break; + case 984: + HASH_RETURN(0x5D2BC68C7A1F53D8LL, k_SUNFUNCS_RET_STRING, SUNFUNCS_RET_STRING); + HASH_RETURN(0x515149D35870B3D8LL, k_MW_RLECompression, MW_RLECompression); + break; + case 987: + HASH_RETURN(0x4BAFEFF8509AB3DBLL, k_MW_HuePreview, MW_HuePreview); + break; + case 988: + HASH_RETURN(0x2BACE243439BE3DCLL, k_U_MALFORMED_SET, U_MALFORMED_SET); + break; + case 991: + HASH_RETURN(0x4F623035829943DFLL, k_SIGVTALRM, SIGVTALRM); + break; + case 992: + HASH_RETURN(0x22194AB670F923E0LL, k_MW_ShortPixel, MW_ShortPixel); + break; + case 998: + HASH_RETURN(0x73653B67F129A3E6LL, k_MCC_HAVE_DEBUG_LOG, MCC_HAVE_DEBUG_LOG); + break; + case 999: + HASH_RETURN(0x1B4A82CDE6A203E7LL, k_IMG_GD2_RAW, IMG_GD2_RAW); + break; + case 1013: + HASH_RETURN(0x5C1CAE9BE066C3F5LL, k_MYSQLI_REPORT_ERROR, MYSQLI_REPORT_ERROR); + break; + case 1016: + HASH_RETURN(0x56A1DD618F5E63F8LL, k_MCC_POOLPREFIX_LEN, MCC_POOLPREFIX_LEN); + HASH_RETURN(0x61B92D6E153063F8LL, k_MCC_ARG_COMPRESSION_THRESHOLD, MCC_ARG_COMPRESSION_THRESHOLD); + break; + case 1017: + HASH_RETURN(0x2889D4C7118163F9LL, k_MB_OVERLOAD_STRING, MB_OVERLOAD_STRING); + break; + case 1021: + HASH_RETURN(0x2E0208671FEC33FDLL, k_SOAP_1_2, SOAP_1_2); + break; + case 1022: + HASH_RETURN(0x47865D1C68BA03FELL, k_CURLOPT_PORT, CURLOPT_PORT); + break; + case 1023: + HASH_RETURN(0x055F8F9DAF6E73FFLL, k_MW_BlobFatalError, MW_BlobFatalError); + break; + case 1027: + HASH_RETURN(0x44D1DA387595A403LL, k_SORT_REGULAR, SORT_REGULAR); + break; + case 1034: + HASH_RETURN(0x4D583E498929E40ALL, k_CURLOPT_MUTE, CURLOPT_MUTE); + break; + case 1036: + HASH_RETURN(0x56303306D7C0D40CLL, k_SIG_DFL, SIG_DFL); + break; + case 1037: + HASH_RETURN(0x3C2A2247DD4DC40DLL, k_MCC_ARG_CONN_TMO, MCC_ARG_CONN_TMO); + HASH_RETURN(0x3FD0ED62DC81140DLL, k_MYSQLI_UNIQUE_KEY_FLAG, MYSQLI_UNIQUE_KEY_FLAG); + break; + case 1038: + HASH_RETURN(0x7F3AA86098A5040ELL, k_T_CONTINUE, T_CONTINUE); + break; + case 1042: + HASH_RETURN(0x0439717F9D2E1412LL, k_DEBUG_LOG_IP, DEBUG_LOG_IP); + HASH_RETURN(0x6F1875824B546412LL, k_MW_YCCColorspace, MW_YCCColorspace); + break; + case 1043: + HASH_RETURN(0x4B3C9CDC8FC11413LL, k_SQLT_FLT, SQLT_FLT); + break; + case 1044: + HASH_RETURN(0x40CCA04176521414LL, k_FB_UNSERIALIZE_UNRECOGNIZED_OBJECT_TYPE, FB_UNSERIALIZE_UNRECOGNIZED_OBJECT_TYPE); + break; + case 1046: + HASH_RETURN(0x0EFF3CB5E042F416LL, k_CURLOPT_FORBID_REUSE, CURLOPT_FORBID_REUSE); + HASH_RETURN(0x5C1326E47B270416LL, k_U_BRK_UNCLOSED_SET, U_BRK_UNCLOSED_SET); + break; + case 1047: + HASH_RETURN(0x452AAD8C245A3417LL, k_SOAP_LITERAL, SOAP_LITERAL); + break; + case 1049: + HASH_RETURN(0x3515808C6B65B419LL, k_IMG_JPG, IMG_JPG); + break; + case 1053: + HASH_RETURN(0x1E9C173187F3941DLL, k_U_BRK_MALFORMED_RULE_TAG, U_BRK_MALFORMED_RULE_TAG); + break; + case 1056: + HASH_RETURN(0x1640565007A90420LL, k_DOM_NO_MODIFICATION_ALLOWED_ERR, DOM_NO_MODIFICATION_ALLOWED_ERR); + break; + case 1066: + HASH_RETURN(0x61A7D060422F542ALL, k_XSD_NONNEGATIVEINTEGER, XSD_NONNEGATIVEINTEGER); + break; + case 1067: + HASH_RETURN(0x1467C96E65B5642BLL, k_XML_ERROR_MISPLACED_XML_PI, XML_ERROR_MISPLACED_XML_PI); + break; + case 1071: + HASH_RETURN(0x5F38698397CF242FLL, k_MW_FatalErrorException, MW_FatalErrorException); + break; + case 1072: + HASH_RETURN(0x6AADD2C591BBC430LL, k_PHP_OS, PHP_OS); + break; + case 1075: + HASH_RETURN(0x37EB3256E1517433LL, k_SOCKET_EREMCHG, SOCKET_EREMCHG); + break; + case 1076: + HASH_RETURN(0x2938A99748C20434LL, k_MCC_HAVE_FB_SERIALIZATION, MCC_HAVE_FB_SERIALIZATION); + break; + case 1077: + HASH_RETURN(0x703818F00F369435LL, k_ABMON_4, ABMON_4); + HASH_RETURN(0x7FC3740ECCB00435LL, k_MW_SaturationIntent, MW_SaturationIntent); + HASH_RETURN(0x11942C70E9C49435LL, k_MW_AreaResource, MW_AreaResource); + break; + case 1080: + HASH_RETURN(0x6E98E18DE6B7F438LL, k_MW_MonitorError, MW_MonitorError); + break; + case 1081: + HASH_RETURN(0x2AD0F20CF9DAA439LL, k_SQLT_BFILEE, SQLT_BFILEE); + break; + case 1082: + HASH_RETURN(0x006037A9C1AC943ALL, k_DEBUG_LOG_ALL, DEBUG_LOG_ALL); + break; + case 1084: + HASH_RETURN(0x302C6C1AC180543CLL, k_U_PRIMARY_TOO_LONG_ERROR, U_PRIMARY_TOO_LONG_ERROR); + break; + case 1087: + HASH_RETURN(0x233FEA38B4A4843FLL, k_MCRYPT_SAFERPLUS, MCRYPT_SAFERPLUS); + break; + case 1089: + HASH_RETURN(0x7CD8EC893580A441LL, k_MW_OutCompositeOp, MW_OutCompositeOp); + break; + case 1090: + HASH_RETURN(0x3123C2EEF1C6B442LL, k_SOAP_SINGLE_ELEMENT_ARRAYS, SOAP_SINGLE_ELEMENT_ARRAYS); + HASH_RETURN(0x1FAAE5BE3607D442LL, k_T_SWITCH, T_SWITCH); + break; + case 1091: + HASH_RETURN(0x007A01CB4FC8B443LL, k_T_ENDWHILE, T_ENDWHILE); + break; + case 1095: + HASH_RETURN(0x2EB10EFD3490D447LL, k_MCRYPT_IDEA, MCRYPT_IDEA); + HASH_RETURN(0x1EDDB4235B624447LL, k_MW_CopyBlackCompositeOp, MW_CopyBlackCompositeOp); + break; + case 1096: + HASH_RETURN(0x7A514EA9EBBD1448LL, k_MW_JPEGPreview, MW_JPEGPreview); + break; + case 1097: + HASH_RETURN(0x36ECFC6074D5F449LL, k_DOM_SYNTAX_ERR, DOM_SYNTAX_ERR); + HASH_RETURN(0x1F7B1A30472A6449LL, k_FILE_USE_INCLUDE_PATH, FILE_USE_INCLUDE_PATH); + HASH_RETURN(0x3214C18660AB1449LL, k_U_UNTERMINATED_QUOTE, U_UNTERMINATED_QUOTE); + break; + case 1101: + HASH_RETURN(0x282E6AABD1BDC44DLL, k_T_ELSE, T_ELSE); + break; + case 1104: + HASH_RETURN(0x43E392D03B394450LL, k_MW_ReplaceMethod, MW_ReplaceMethod); + break; + case 1108: + HASH_RETURN(0x23D78E911FEA2454LL, k_T_CHARACTER, T_CHARACTER); + break; + case 1111: + HASH_RETURN(0x4FDF0D9A8930E457LL, k_XML_HTML_DOCUMENT_NODE, XML_HTML_DOCUMENT_NODE); + break; + case 1117: + HASH_RETURN(0x6FC496B3F19F345DLL, k_PHP_INT_MAX, PHP_INT_MAX); + break; + case 1118: + HASH_RETURN(0x226CB6C562E6C45ELL, k_MW_LightenCompositeOp, MW_LightenCompositeOp); + break; + case 1120: + HASH_RETURN(0x16988B3565B5C460LL, k_DOM_HIERARCHY_REQUEST_ERR, DOM_HIERARCHY_REQUEST_ERR); + HASH_RETURN(0x698A3061C4731460LL, k_U_ILLEGAL_CHARACTER, U_ILLEGAL_CHARACTER); + break; + case 1121: + HASH_RETURN(0x065D455238423461LL, k_ERA_T_FMT, ERA_T_FMT); + HASH_RETURN(0x01D279BEED84F461LL, k_GLOB_ONLYDIR, GLOB_ONLYDIR); + break; + case 1124: + HASH_RETURN(0x1A8FFF593757E464LL, k_MW_ConfigureFatalError, MW_ConfigureFatalError); + break; + case 1125: + HASH_RETURN(0x443F331662C8C465LL, k_LOCK_UN, LOCK_UN); + break; + case 1126: + HASH_RETURN(0x6C5E618A94DB9466LL, k_U_MULTIPLE_POST_CONTEXTS, U_MULTIPLE_POST_CONTEXTS); + break; + case 1130: + HASH_RETURN(0x4E4B002DD36A846ALL, k_MCC_POLL_TMO_US, MCC_POLL_TMO_US); + break; + case 1131: + HASH_RETURN(0x39F71AD2140F346BLL, k_IMG_FILTER_MEAN_REMOVAL, IMG_FILTER_MEAN_REMOVAL); + HASH_RETURN(0x6FB5FA98BB57746BLL, k_MW_IntegerPixel, MW_IntegerPixel); + break; + case 1133: + HASH_RETURN(0x6672402F0997546DLL, k_LIBXML_VERSION, LIBXML_VERSION); + break; + case 1138: + HASH_RETURN(0x6174D79B08BC6472LL, k_APACHE_MAP, APACHE_MAP); + break; + case 1141: + HASH_RETURN(0x3F32B9AC6D36A475LL, k_MCC_ARG_MIRROR_CFG_NAME, MCC_ARG_MIRROR_CFG_NAME); + break; + case 1142: + HASH_RETURN(0x1B0827C12937E476LL, k_MCRYPT_MODE_ECB, MCRYPT_MODE_ECB); + break; + case 1144: + HASH_RETURN(0x100C13A9559F8478LL, k_SOCKET_ESHUTDOWN, SOCKET_ESHUTDOWN); + break; + case 1145: + HASH_RETURN(0x40431455AC3E3479LL, k_ERA_D_T_FMT, ERA_D_T_FMT); + break; + case 1146: + HASH_RETURN(0x39C972A1DEE8047ALL, k_SOAP_ACTOR_NONE, SOAP_ACTOR_NONE); + HASH_RETURN(0x7445D5623ED5F47ALL, k_XSD_NCNAME, XSD_NCNAME); + break; + case 1147: + HASH_RETURN(0x2515EB7B28BCA47BLL, k_CREDITS_GENERAL, CREDITS_GENERAL); + HASH_RETURN(0x17A61EFF29DB047BLL, k_ABMON_5, ABMON_5); + HASH_RETURN(0x3FEB4E858C24C47BLL, k_U_UNSUPPORTED_ERROR, U_UNSUPPORTED_ERROR); + break; + case 1148: + HASH_RETURN(0x0916CC6A5D9BD47CLL, k_U_INVALID_FUNCTION, U_INVALID_FUNCTION); + break; + case 1150: + HASH_RETURN(0x3F5A101418D7B47ELL, k_XSD_LANGUAGE, XSD_LANGUAGE); + break; + case 1153: + HASH_RETURN(0x7DF7ED94B7585481LL, k_MW_DespecklePreview, MW_DespecklePreview); + HASH_RETURN(0x2B3F87F4D6560481LL, k_MYSQLI_REPORT_STRICT, MYSQLI_REPORT_STRICT); + break; + case 1156: + HASH_RETURN(0x06C04B5A183A1484LL, k_SOCKET_ENODATA, SOCKET_ENODATA); + HASH_RETURN(0x1D7DFF1817C3E484LL, k_MW_ResourceLimitWarning, MW_ResourceLimitWarning); + HASH_RETURN(0x27FDB27550017484LL, k_OCI_SEEK_SET, OCI_SEEK_SET); + break; + case 1159: + HASH_RETURN(0x5AF69B2C92692487LL, k_T_LOGICAL_XOR, T_LOGICAL_XOR); + break; + case 1163: + HASH_RETURN(0x70B6E904F99F348BLL, k_PHP_LIBDIR, PHP_LIBDIR); + break; + case 1165: + HASH_RETURN(0x4E9CE5DA1576348DLL, k_POSIX_S_IFBLK, POSIX_S_IFBLK); + break; + case 1167: + HASH_RETURN(0x272492CFFFED348FLL, k_MW_YellowChannel, MW_YellowChannel); + break; + case 1173: + HASH_RETURN(0x779F00F0255B8495LL, k_MW_UndefinedResource, MW_UndefinedResource); + break; + case 1174: + HASH_RETURN(0x6CD22582D88D5496LL, k_PNG_ALL_FILTERS, PNG_ALL_FILTERS); + HASH_RETURN(0x651B6E7DE0C45496LL, k_T_OR_EQUAL, T_OR_EQUAL); + break; + case 1179: + HASH_RETURN(0x06DE4595C4FE649BLL, k_MW_HardLightCompositeOp, MW_HardLightCompositeOp); + break; + case 1185: + HASH_RETURN(0x3FBA8EE3472A44A1LL, k_MW_LanczosFilter, MW_LanczosFilter); + break; + case 1186: + HASH_RETURN(0x1EE9096F3433C4A2LL, k_SOCKET_ENOTDIR, SOCKET_ENOTDIR); + break; + case 1188: + HASH_RETURN(0x23BD33212F0464A4LL, k_SOCKET_EDQUOT, SOCKET_EDQUOT); + break; + case 1191: + HASH_RETURN(0x46DB00B5F0A234A7LL, k_OCI_B_CFILEE, OCI_B_CFILEE); + break; + case 1198: + HASH_RETURN(0x68F6A316CAE374AELL, k_CURLOPT_SSLVERSION, CURLOPT_SSLVERSION); + break; + case 1200: + HASH_RETURN(0x53D42B9772EFE4B0LL, k_SOCKET_ENOMEDIUM, SOCKET_ENOMEDIUM); + break; + case 1202: + HASH_RETURN(0x19E592A258C334B2LL, k_MW_YCbCrColorspace, MW_YCbCrColorspace); + break; + case 1205: + HASH_RETURN(0x3F2BFA3068E094B5LL, k_IDNA_INVALID_LENGTH, IDNA_INVALID_LENGTH); + break; + case 1206: + HASH_RETURN(0x03CFF8CF8581B4B6LL, k_CURLOPT_TIMECONDITION, CURLOPT_TIMECONDITION); + break; + case 1207: + HASH_RETURN(0x31EF12DD3D2224B7LL, k_MCC_ARG_NZLIB_COMPRESSION, MCC_ARG_NZLIB_COMPRESSION); + HASH_RETURN(0x797DEF582C49B4B7LL, k_LDAP_DEREF_ALWAYS, LDAP_DEREF_ALWAYS); + break; + case 1208: + HASH_RETURN(0x69CFF21DFDA9D4B8LL, k_XML_ATTRIBUTE_NODE, XML_ATTRIBUTE_NODE); + break; + case 1209: + HASH_RETURN(0x15A254798D93A4B9LL, k_OCI_SEEK_END, OCI_SEEK_END); + break; + case 1210: + HASH_RETURN(0x7190396E5D0AD4BALL, k_ASSERT_QUIET_EVAL, ASSERT_QUIET_EVAL); + break; + case 1211: + HASH_RETURN(0x711D323D3B6644BBLL, k_CURLOPT_SSLKEYPASSWD, CURLOPT_SSLKEYPASSWD); + break; + case 1212: + HASH_RETURN(0x3BE48BA0D85894BCLL, k_MW_AlphaChannel, MW_AlphaChannel); + break; + case 1214: + HASH_RETURN(0x621C4ED98EF454BELL, k_XSD_DURATION, XSD_DURATION); + break; + case 1215: + HASH_RETURN(0x6D0374D2EC3A64BFLL, k_OCI_BOTH, OCI_BOTH); + break; + case 1216: + HASH_RETURN(0x2755BB25E49D44C0LL, k_XSD_UNSIGNEDBYTE, XSD_UNSIGNEDBYTE); + break; + case 1218: + HASH_RETURN(0x1F74CFE2D30104C2LL, k_IMG_FILTER_SMOOTH, IMG_FILTER_SMOOTH); + break; + case 1220: + HASH_RETURN(0x589C7B7CE97304C4LL, k_MW_BumpmapCompositeOp, MW_BumpmapCompositeOp); + break; + case 1221: + HASH_RETURN(0x4B704A9CBC7ED4C5LL, k_U_ZERO_ERROR, U_ZERO_ERROR); + break; + case 1224: + HASH_RETURN(0x152F61B46F7444C8LL, k_MW_MaxRGB, MW_MaxRGB); + break; + case 1227: + HASH_RETURN(0x6B7CB71BCB0BF4CBLL, k_XML_ERROR_UNDEFINED_ENTITY, XML_ERROR_UNDEFINED_ENTITY); + break; + case 1228: + HASH_RETURN(0x2D0BEACE978184CCLL, k_DNS_SOA, DNS_SOA); + break; + case 1229: + HASH_RETURN(0x0A4074925F29C4CDLL, k_CURLINFO_CONTENT_LENGTH_DOWNLOAD, CURLINFO_CONTENT_LENGTH_DOWNLOAD); + break; + case 1230: + HASH_RETURN(0x03C5D552422834CELL, k_MW_LongPixel, MW_LongPixel); + break; + case 1231: + HASH_RETURN(0x4D12E388F00434CFLL, k_AF_INET6, AF_INET6); + break; + case 1236: + HASH_RETURN(0x6D4BF2FC509F14D4LL, k_CURLOPT_NOBODY, CURLOPT_NOBODY); + HASH_RETURN(0x3FA1E3B801B644D4LL, k_MYSQLI_OPT_LOCAL_INFILE, MYSQLI_OPT_LOCAL_INFILE); + break; + case 1237: + HASH_RETURN(0x336D1DEA1207A4D5LL, k_U_REGEX_INVALID_FLAG, U_REGEX_INVALID_FLAG); + break; + case 1240: + HASH_RETURN(0x5AEB1F7D69EBF4D8LL, k_CURLOPT_WRITEFUNCTION, CURLOPT_WRITEFUNCTION); + break; + case 1242: + HASH_RETURN(0x585F029786E184DALL, k_STREAM_SOCK_SEQPACKET, STREAM_SOCK_SEQPACKET); + break; + case 1244: + HASH_RETURN(0x74117A5B7E2DC4DCLL, k_MW_NonZeroRule, MW_NonZeroRule); + HASH_RETURN(0x7115CEB4F47E14DCLL, k_MW_StaticGravity, MW_StaticGravity); + break; + case 1248: + HASH_RETURN(0x4A4834C3967104E0LL, k_MW_DivideEvaluateOperator, MW_DivideEvaluateOperator); + break; + case 1249: + HASH_RETURN(0x7138FB985FD4A4E1LL, k_CURLOPT_INFILE, CURLOPT_INFILE); + break; + case 1250: + HASH_RETURN(0x6D01485DA58D74E2LL, k_MW_UndefinedCompression, MW_UndefinedCompression); + break; + case 1253: + HASH_RETURN(0x46A3CE35AD2734E5LL, k_MW_UndefinedStyle, MW_UndefinedStyle); + break; + case 1258: + HASH_RETURN(0x76CD4525B68C64EALL, k_SIGIO, SIGIO); + break; + case 1261: + HASH_RETURN(0x7B44D93198FDD4EDLL, k_STREAM_FILTER_READ, STREAM_FILTER_READ); + break; + case 1264: + HASH_RETURN(0x7CD011F60F63F4F0LL, k_U_BRK_RULE_SYNTAX, U_BRK_RULE_SYNTAX); + break; + case 1265: + HASH_RETURN(0x072A4A6DA80F74F1LL, k_MCC_DELETE_DELETED, MCC_DELETE_DELETED); + break; + case 1266: + HASH_RETURN(0x2D39FFEEF43E34F2LL, k_SIGSEGV, SIGSEGV); + break; + case 1267: + HASH_RETURN(0x6F900C618583E4F3LL, k_NULL, NULL); + break; + case 1270: + HASH_RETURN(0x20F5E850402104F6LL, k_IMAGETYPE_JP2, IMAGETYPE_JP2); + break; + case 1275: + HASH_RETURN(0x3A3158BE899A04FBLL, k_U_INVALID_STATE_ERROR, U_INVALID_STATE_ERROR); + break; + case 1280: + HASH_RETURN(0x45B6E0587D35A500LL, k_MW_GRAYColorspace, MW_GRAYColorspace); + break; + case 1281: + HASH_RETURN(0x56CF4A6CEAE2B501LL, k_CURLE_OPERATION_TIMEOUTED, CURLE_OPERATION_TIMEOUTED); + break; + case 1283: + HASH_RETURN(0x0EF53B552C2FA503LL, k_CRYPT_STD_DES, CRYPT_STD_DES); + break; + case 1287: + HASH_RETURN(0x201290F9235F6507LL, k_T_EXIT, T_EXIT); + break; + case 1288: + HASH_RETURN(0x39A673D017140508LL, k_E_PARSE, E_PARSE); + HASH_RETURN(0x47650B1056B2F508LL, k_CURLFTPSSL_CONTROL, CURLFTPSSL_CONTROL); + HASH_RETURN(0x55CA230EA6731508LL, k_SQLT_INT, SQLT_INT); + break; + case 1290: + HASH_RETURN(0x1111973C6C2A650ALL, k_MW_BlurPreview, MW_BlurPreview); + break; + case 1293: + HASH_RETURN(0x0EA3ED561350150DLL, k_XSD_1999_TIMEINSTANT, XSD_1999_TIMEINSTANT); + break; + case 1296: + HASH_RETURN(0x26083912D9CBE510LL, k_MSG_PEEK, MSG_PEEK); + break; + case 1298: + HASH_RETURN(0x06C0B14E2320D512LL, k_CURLE_READ_ERROR, CURLE_READ_ERROR); + break; + case 1304: + HASH_RETURN(0x163B88C01BC8A518LL, k_U_BRK_RULE_EMPTY_SET, U_BRK_RULE_EMPTY_SET); + break; + case 1306: + HASH_RETURN(0x50053271437C951ALL, k_ICONV_IMPL, ICONV_IMPL); + HASH_RETURN(0x3C2A59931D2B751ALL, k_PKCS7_NOATTR, PKCS7_NOATTR); + break; + case 1307: + HASH_RETURN(0x578F4640791FD51BLL, k_SQLT_CFILEE, SQLT_CFILEE); + break; + case 1311: + HASH_RETURN(0x1854F1B8D378751FLL, k_XML_ERROR_NO_ELEMENTS, XML_ERROR_NO_ELEMENTS); + break; + case 1312: + HASH_RETURN(0x24F1342D32B6B520LL, k_ULOC_VALID_LOCALE, ULOC_VALID_LOCALE); + HASH_RETURN(0x1B33A8314BE85520LL, k_MYSQLI_BOTH, MYSQLI_BOTH); + HASH_RETURN(0x2BE3A7281E58A520LL, k_SIGILL, SIGILL); + break; + case 1314: + HASH_RETURN(0x459970987FA25522LL, k_XSD_BYTE, XSD_BYTE); + HASH_RETURN(0x37EF6C3EE7B15522LL, k_T_TRY, T_TRY); + break; + case 1323: + HASH_RETURN(0x47C626DD0F7B152BLL, k_XML_ERROR_PARTIAL_CHAR, XML_ERROR_PARTIAL_CHAR); + break; + case 1327: + HASH_RETURN(0x4B558BF8FBD0952FLL, k_SOCKET_ENOLINK, SOCKET_ENOLINK); + break; + case 1328: + HASH_RETURN(0x0D8261B6FE375530LL, k_XSD_DECIMAL, XSD_DECIMAL); + break; + case 1330: + HASH_RETURN(0x11C0A42F3CEB5532LL, k_XSD_ENTITY, XSD_ENTITY); + break; + case 1331: + HASH_RETURN(0x6C13C3409FEED533LL, k_CREDITS_FULLPAGE, CREDITS_FULLPAGE); + break; + case 1334: + HASH_RETURN(0x19DFD448EE084536LL, k_CURLOPT_FTPPORT, CURLOPT_FTPPORT); + break; + case 1335: + HASH_RETURN(0x5AAE8BB5B61AE537LL, k_CURLOPT_FTP_USE_EPRT, CURLOPT_FTP_USE_EPRT); + break; + case 1343: + HASH_RETURN(0x05C037D5171AE53FLL, k_CURLOPT_COOKIEJAR, CURLOPT_COOKIEJAR); + break; + case 1346: + HASH_RETURN(0x471C7648E1966542LL, k_UCOL_FRENCH_COLLATION, UCOL_FRENCH_COLLATION); + HASH_RETURN(0x197D4758552EF542LL, k_STREAM_URL_STAT_QUIET, STREAM_URL_STAT_QUIET); + HASH_RETURN(0x449C124585357542LL, k_CURLINFO_EFFECTIVE_URL, CURLINFO_EFFECTIVE_URL); + break; + case 1350: + HASH_RETURN(0x655E760BB6D14546LL, k_SQLT_BDOUBLE, SQLT_BDOUBLE); + break; + case 1353: + HASH_RETURN(0x3BF1743611D1A549LL, k_MW_StreamWarning, MW_StreamWarning); + break; + case 1355: + HASH_RETURN(0x0E42C0323399554BLL, k_MCC_PROXY_UPDATE_OP, MCC_PROXY_UPDATE_OP); + HASH_RETURN(0x6E211606EA57F54BLL, k_SOCKET_ENOTTY, SOCKET_ENOTTY); + break; + case 1358: + HASH_RETURN(0x294650C8405A654ELL, k_PSFS_FEED_ME, PSFS_FEED_ME); + HASH_RETURN(0x07E1E24DDF43454ELL, k_ABMON_8, ABMON_8); + break; + case 1359: + HASH_RETURN(0x7DD73051C5ABD54FLL, k_MW_RegistryFatalError, MW_RegistryFatalError); + break; + case 1364: + HASH_RETURN(0x79335A1990735554LL, k_SIGINT, SIGINT); + break; + case 1365: + HASH_RETURN(0x46C77A0EF3296555LL, k_CURLOPT_POSTQUOTE, CURLOPT_POSTQUOTE); + break; + case 1367: + HASH_RETURN(0x430E45DAE8E5F557LL, k_PHP_CONFIG_FILE_SCAN_DIR, PHP_CONFIG_FILE_SCAN_DIR); + HASH_RETURN(0x489184A8A7FF7557LL, k_XML_ERROR_UNCLOSED_CDATA_SECTION, XML_ERROR_UNCLOSED_CDATA_SECTION); + break; + case 1369: + HASH_RETURN(0x04D6FFBBAC8C1559LL, k_MW_UndefinedMethod, MW_UndefinedMethod); + break; + case 1370: + HASH_RETURN(0x277B4DBBBF37155ALL, k_SOCKET_EISCONN, SOCKET_EISCONN); + HASH_RETURN(0x0D50B1F78E3ED55ALL, k_XSD_ANYXML, XSD_ANYXML); + HASH_RETURN(0x0CFE7AF65E2B655ALL, k_MW_BlobError, MW_BlobError); + break; + case 1372: + HASH_RETURN(0x2692040725F4855CLL, k_ICONV_VERSION, ICONV_VERSION); + break; + case 1373: + HASH_RETURN(0x2228E63D6B01455DLL, k_MCC_ARG_MIRROR_CFG, MCC_ARG_MIRROR_CFG); + HASH_RETURN(0x693322BFA32D955DLL, k_WSDL_CACHE_BOTH, WSDL_CACHE_BOTH); + HASH_RETURN(0x573E323057AF155DLL, k_CURLOPT_MAXCONNECTS, CURLOPT_MAXCONNECTS); + break; + case 1375: + HASH_RETURN(0x5C0358DEF5D2555FLL, k_MCC_CONN_NTRIES, MCC_CONN_NTRIES); + break; + case 1380: + HASH_RETURN(0x1A8D83C5AC4A7564LL, k_XML_ERROR_SYNTAX, XML_ERROR_SYNTAX); + break; + case 1384: + HASH_RETURN(0x7915DFB18792B568LL, k_EXTR_OVERWRITE, EXTR_OVERWRITE); + break; + case 1385: + HASH_RETURN(0x3EEA52457CCB2569LL, k_E_WARNING, E_WARNING); + break; + case 1386: + HASH_RETURN(0x7463815F2AD9F56ALL, k_MW_UnderlineDecoration, MW_UnderlineDecoration); + HASH_RETURN(0x4D09382249CA056ALL, k_T_IS_SMALLER_OR_EQUAL, T_IS_SMALLER_OR_EQUAL); + break; + case 1387: + HASH_RETURN(0x6A5CDC059D57156BLL, k_T_ENDDECLARE, T_ENDDECLARE); + break; + case 1388: + HASH_RETURN(0x55334A910497356CLL, k_SOCKET_EPROTONOSUPPORT, SOCKET_EPROTONOSUPPORT); + break; + case 1389: + HASH_RETURN(0x1FE0E0BB7E5F156DLL, k_SQLITE3_OPEN_READONLY, SQLITE3_OPEN_READONLY); + break; + case 1393: + HASH_RETURN(0x394B9F5608338571LL, k_MCRYPT_ARCFOUR, MCRYPT_ARCFOUR); + break; + case 1394: + HASH_RETURN(0x6B42984521110572LL, k_MW_CorruptImageWarning, MW_CorruptImageWarning); + break; + case 1396: + HASH_RETURN(0x5E374C828C6DE574LL, k_MCC_WINDOW_MAX, MCC_WINDOW_MAX); + HASH_RETURN(0x636C871213F37574LL, k_MCRYPT_ENCRYPT, MCRYPT_ENCRYPT); + break; + case 1397: + HASH_RETURN(0x1911D163F3648575LL, k_MW_ConstantVirtualPixelMethod, MW_ConstantVirtualPixelMethod); + break; + case 1407: + HASH_RETURN(0x461FD6AD1B05D57FLL, k_MYSQLI_TYPE_INTERVAL, MYSQLI_TYPE_INTERVAL); + break; + case 1408: + HASH_RETURN(0x3E8690B39E8F9580LL, k_PHP_URL_SCHEME, PHP_URL_SCHEME); + break; + case 1413: + HASH_RETURN(0x6B5949C7180ED585LL, k_GRAPHEME_EXTR_COUNT, GRAPHEME_EXTR_COUNT); + break; + case 1415: + HASH_RETURN(0x41EC17ABDC632587LL, k_INFO_VARIABLES, INFO_VARIABLES); + break; + case 1422: + HASH_RETURN(0x62729803227A958ELL, k_CURLE_ABORTED_BY_CALLBACK, CURLE_ABORTED_BY_CALLBACK); + break; + case 1424: + HASH_RETURN(0x6D29B833F9D68590LL, k_CURLOPT_COOKIEFILE, CURLOPT_COOKIEFILE); + HASH_RETURN(0x0727AB750B46F590LL, k_OPENSSL_CIPHER_RC2_40, OPENSSL_CIPHER_RC2_40); + break; + case 1425: + HASH_RETURN(0x4C237622094F3591LL, k_XSD_GMONTH, XSD_GMONTH); + break; + case 1428: + HASH_RETURN(0x0939FC6C2398A594LL, k_SOCKET_ECHRNG, SOCKET_ECHRNG); + HASH_RETURN(0x09AC72E7E80FE594LL, k_MW_CharcoalDrawingPreview, MW_CharcoalDrawingPreview); + break; + case 1433: + HASH_RETURN(0x2879B59F4E8B7599LL, k_UCOL_LOWER_FIRST, UCOL_LOWER_FIRST); + HASH_RETURN(0x74BD1873B3D4C599LL, k_MW_QuantumRange, MW_QuantumRange); + break; + case 1434: + HASH_RETURN(0x7B9C1DEF8C78259ALL, k_SOCKET_ECONNREFUSED, SOCKET_ECONNREFUSED); + break; + case 1437: + HASH_RETURN(0x37371F798991459DLL, k_SOCKET_EBADSLT, SOCKET_EBADSLT); + break; + case 1443: + HASH_RETURN(0x18B0DDF31986A5A3LL, k_XSD_NAME, XSD_NAME); + break; + case 1446: + HASH_RETURN(0x5E0FD5E63D4CD5A6LL, k_MW_RollPreview, MW_RollPreview); + HASH_RETURN(0x281F40E1E16E25A6LL, k_MYSQLI_NOT_NULL_FLAG, MYSQLI_NOT_NULL_FLAG); + break; + case 1450: + HASH_RETURN(0x1B690B48EB8335AALL, k_LOG_PID, LOG_PID); + break; + case 1451: + HASH_RETURN(0x5FF83688511395ABLL, k_M_2_SQRTPI, M_2_SQRTPI); + break; + case 1453: + HASH_RETURN(0x3A0170FF604015ADLL, k_MW_BrightnessPreview, MW_BrightnessPreview); + HASH_RETURN(0x10FE425AEE9885ADLL, k_T_ENDSWITCH, T_ENDSWITCH); + break; + case 1454: + HASH_RETURN(0x749E9580B463E5AELL, k_MON_5, MON_5); + break; + case 1455: + HASH_RETURN(0x035C8656F0D6A5AFLL, k_IMG_COLOR_TRANSPARENT, IMG_COLOR_TRANSPARENT); + break; + case 1458: + HASH_RETURN(0x45697C201C6C55B2LL, k_UCOL_QUATERNARY, UCOL_QUATERNARY); + break; + case 1465: + HASH_RETURN(0x3FE2E5DB834865B9LL, k_XML_SAX_IMPL, XML_SAX_IMPL); + HASH_RETURN(0x59E3CB50C7FCB5B9LL, k_SIGIOT, SIGIOT); + break; + case 1466: + HASH_RETURN(0x1DC0E76406F095BALL, k_CURLOPT_FTPAPPEND, CURLOPT_FTPAPPEND); + break; + case 1474: + HASH_RETURN(0x7E9D9B62B151F5C2LL, k_U_MULTIPLE_PERMILL_SYMBOLS, U_MULTIPLE_PERMILL_SYMBOLS); + break; + case 1475: + HASH_RETURN(0x3B0F00B36B8E75C3LL, k_MW_PaletteMatteType, MW_PaletteMatteType); + HASH_RETURN(0x252B12A8DE87A5C3LL, k_MYSQLI_TYPE_TINY, MYSQLI_TYPE_TINY); + break; + case 1480: + HASH_RETURN(0x6812CCAE80BF05C8LL, k_SOCKET_EL2NSYNC, SOCKET_EL2NSYNC); + HASH_RETURN(0x6A09AF437CD245C8LL, k_T_INC, T_INC); + break; + case 1481: + HASH_RETURN(0x15873E5F393AB5C9LL, k_MCC_ARG_CONN_NTRIES, MCC_ARG_CONN_NTRIES); + break; + case 1487: + HASH_RETURN(0x7029FB652ACD15CFLL, k_SQLITE3_FLOAT, SQLITE3_FLOAT); + break; + case 1488: + HASH_RETURN(0x56E7F7F6085F25D0LL, k_UCOL_ALTERNATE_HANDLING, UCOL_ALTERNATE_HANDLING); + HASH_RETURN(0x2B3E49A5D68A55D0LL, k_MW_DstAtopCompositeOp, MW_DstAtopCompositeOp); + break; + case 1490: + HASH_RETURN(0x4BC23844AAAE55D2LL, k_GLOB_NOCHECK, GLOB_NOCHECK); + break; + case 1492: + HASH_RETURN(0x10381BE6DEC9E5D4LL, k_PREG_NO_ERROR, PREG_NO_ERROR); + HASH_RETURN(0x1C75A5C262B725D4LL, k_DATE_RFC2822, DATE_RFC2822); + break; + case 1496: + HASH_RETURN(0x53EE03F19DCA15D8LL, k_MSG_OOB, MSG_OOB); + break; + case 1500: + HASH_RETURN(0x0C6A80B75AE295DCLL, k_MW_PixelsPerCentimeterResolution, MW_PixelsPerCentimeterResolution); + break; + case 1501: + HASH_RETURN(0x2C095BBEF25D45DDLL, k_SIGALRM, SIGALRM); + break; + case 1502: + HASH_RETURN(0x2DEE9B77FCBAE5DELL, k_MYSQL_CLIENT_COMPRESS, MYSQL_CLIENT_COMPRESS); + break; + case 1507: + HASH_RETURN(0x5E0F41BB026D55E3LL, k_STREAM_CRYPTO_METHOD_SSLv23_CLIENT, STREAM_CRYPTO_METHOD_SSLv23_CLIENT); + break; + case 1508: + HASH_RETURN(0x65E0924A3F7F85E4LL, k_U_VARIABLE_RANGE_EXHAUSTED, U_VARIABLE_RANGE_EXHAUSTED); + break; + case 1511: + HASH_RETURN(0x533DE31D0A7305E7LL, k_FNM_NOESCAPE, FNM_NOESCAPE); + break; + case 1513: + HASH_RETURN(0x7CD211F10A9BB5E9LL, k_SIGPROF, SIGPROF); + break; + case 1515: + HASH_RETURN(0x335CAD4518E8E5EBLL, k_MW_StreamError, MW_StreamError); + break; + case 1517: + HASH_RETURN(0x04AC44206DABD5EDLL, k_MCC_ARG_DGRAM_TMO_WEIGHT, MCC_ARG_DGRAM_TMO_WEIGHT); + break; + case 1519: + HASH_RETURN(0x78F830721EABD5EFLL, k_MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_MEDIUM_BLOB); + break; + case 1523: + HASH_RETURN(0x62699EC4D91315F3LL, k_MW_UndefinedException, MW_UndefinedException); + break; + case 1524: + HASH_RETURN(0x040DBC4A68F435F4LL, k_PREG_SET_ORDER, PREG_SET_ORDER); + break; + case 1526: + HASH_RETURN(0x7D413354DBE2D5F6LL, k_UCOL_STRENGTH, UCOL_STRENGTH); + break; + case 1527: + HASH_RETURN(0x7BF86292A876E5F7LL, k_LDAP_OPT_ERROR_NUMBER, LDAP_OPT_ERROR_NUMBER); + break; + case 1529: + HASH_RETURN(0x6AFA1034674B65F9LL, k_MW_EastGravity, MW_EastGravity); + break; + case 1531: + HASH_RETURN(0x011725839BB515FBLL, k_X509_PURPOSE_SSL_SERVER, X509_PURPOSE_SSL_SERVER); + break; + case 1534: + HASH_RETURN(0x7CFDCB01D09925FELL, k_MW_LuminizeCompositeOp, MW_LuminizeCompositeOp); + break; + case 1537: + HASH_RETURN(0x367A7A5337BBA601LL, k_MCC_ARG_DELETE_PROXY, MCC_ARG_DELETE_PROXY); + HASH_RETURN(0x5332ACDFDA1FF601LL, k_XSD_INTEGER, XSD_INTEGER); + HASH_RETURN(0x51378EF3DAB8A601LL, k_MYSQLI_STORE_RESULT, MYSQLI_STORE_RESULT); + break; + case 1539: + HASH_RETURN(0x27741597BB08C603LL, k_CURLE_FTP_USER_PASSWORD_INCORRECT, CURLE_FTP_USER_PASSWORD_INCORRECT); + break; + case 1540: + HASH_RETURN(0x65B0B1DFE2D7B604LL, k_CURLAUTH_GSSNEGOTIATE, CURLAUTH_GSSNEGOTIATE); + break; + case 1548: + HASH_RETURN(0x45FC5C46C22B560CLL, k_CURLE_WRITE_ERROR, CURLE_WRITE_ERROR); + break; + case 1550: + HASH_RETURN(0x50B2E544D35D160ELL, k_CURLOPT_PROXYAUTH, CURLOPT_PROXYAUTH); + break; + case 1551: + HASH_RETURN(0x66D60AD02C4C960FLL, k_PHP_URL_HOST, PHP_URL_HOST); + HASH_RETURN(0x5FBF2BBBCD48160FLL, k_T_VAR, T_VAR); + break; + case 1558: + HASH_RETURN(0x4E64CC2434B19616LL, k_IMG_FILTER_BRIGHTNESS, IMG_FILTER_BRIGHTNESS); + HASH_RETURN(0x093E9290B2EF8616LL, k_T_CLASS_C, T_CLASS_C); + break; + case 1560: + HASH_RETURN(0x173AC303C51D7618LL, k_T_WHITESPACE, T_WHITESPACE); + break; + case 1570: + HASH_RETURN(0x4206ADEB9D059622LL, k_DNS_MX, DNS_MX); + HASH_RETURN(0x61E805D70BAAA622LL, k_U_UNQUOTED_SPECIAL, U_UNQUOTED_SPECIAL); + break; + case 1571: + HASH_RETURN(0x4DC4205C6A930623LL, k_MCC_ARG_PERSISTENT, MCC_ARG_PERSISTENT); + HASH_RETURN(0x28D3269E52080623LL, k_SOCKET_ENOSR, SOCKET_ENOSR); + HASH_RETURN(0x06B5709915BF2623LL, k_CURLE_FAILED_INIT, CURLE_FAILED_INIT); + HASH_RETURN(0x356E3482E31B1623LL, k_MW_UnframeMode, MW_UnframeMode); + break; + case 1572: + HASH_RETURN(0x4250A97FE47A5624LL, k_CURL_VERSION_LIBZ, CURL_VERSION_LIBZ); + break; + case 1573: + HASH_RETURN(0x74C57495C48A2625LL, k_CURLOPT_PROXYTYPE, CURLOPT_PROXYTYPE); + break; + case 1577: + HASH_RETURN(0x4FF31C1C1C0F4629LL, k_ULOC_ACTUAL_LOCALE, ULOC_ACTUAL_LOCALE); + break; + case 1578: + HASH_RETURN(0x2C757E45D392262ALL, k_EXTR_PREFIX_SAME, EXTR_PREFIX_SAME); + HASH_RETURN(0x201D79E87496762ALL, k_MW_UndefinedRule, MW_UndefinedRule); + break; + case 1582: + HASH_RETURN(0x3C07A491DFAB062ELL, k_CURLINFO_PRETRANSFER_TIME, CURLINFO_PRETRANSFER_TIME); + HASH_RETURN(0x0FF0E5E69A87962ELL, k_WUNTRACED, WUNTRACED); + break; + case 1583: + HASH_RETURN(0x69D80EB693E0162FLL, k_CURLOPT_USERPWD, CURLOPT_USERPWD); + HASH_RETURN(0x5A05A5EF04EF762FLL, k_MW_DstCompositeOp, MW_DstCompositeOp); + break; + case 1591: + HASH_RETURN(0x4B9820BB7315E637LL, k_U_BRK_MISMATCHED_PAREN, U_BRK_MISMATCHED_PAREN); + break; + case 1592: + HASH_RETURN(0x02AB8992456CC638LL, k_DEBUG_LOG_AGENT, DEBUG_LOG_AGENT); + break; + case 1593: + HASH_RETURN(0x3A13FB735D863639LL, k_SQLITE3_TEXT, SQLITE3_TEXT); + break; + case 1594: + HASH_RETURN(0x6F01ED04CDEA063ALL, k_SQLITE3_INTEGER, SQLITE3_INTEGER); + HASH_RETURN(0x6365CD9A0B57B63ALL, k_CURLOPT_HTTP200ALIASES, CURLOPT_HTTP200ALIASES); + break; + case 1599: + HASH_RETURN(0x34DC73ABB362C63FLL, k_MW_NorthWestGravity, MW_NorthWestGravity); + break; + case 1602: + HASH_RETURN(0x2902E44A32F74642LL, k_XML_ATTRIBUTE_ENUMERATION, XML_ATTRIBUTE_ENUMERATION); + HASH_RETURN(0x33BB1059C979E642LL, k_POSIX_S_IFIFO, POSIX_S_IFIFO); + break; + case 1603: + HASH_RETURN(0x56DCBD0054C97643LL, k_PREG_BACKTRACK_LIMIT_ERROR, PREG_BACKTRACK_LIMIT_ERROR); + break; + case 1610: + HASH_RETURN(0x3B5E417C2BC1064ALL, k_SOCKET_EISNAM, SOCKET_EISNAM); + break; + case 1612: + HASH_RETURN(0x0714AB515519064CLL, k_SOCKET_ECONNABORTED, SOCKET_ECONNABORTED); + break; + case 1614: + HASH_RETURN(0x693E8CE5A4BDB64ELL, k_UPLOAD_ERR_EXTENSION, UPLOAD_ERR_EXTENSION); + break; + case 1615: + HASH_RETURN(0x0F0BCFC5B7D9564FLL, k_MW_LineInterlace, MW_LineInterlace); + break; + case 1618: + HASH_RETURN(0x6F2036553475E652LL, k_IMG_GD2_COMPRESSED, IMG_GD2_COMPRESSED); + HASH_RETURN(0x31C84658D22E4652LL, k_T_OPEN_TAG, T_OPEN_TAG); + break; + case 1620: + HASH_RETURN(0x1A5E3F3A09409654LL, k_ABDAY_3, ABDAY_3); + break; + case 1621: + HASH_RETURN(0x577B9D2AD53EF655LL, k_MYSQLI_NO_DATA, MYSQLI_NO_DATA); + break; + case 1622: + HASH_RETURN(0x5836A6364F894656LL, k_SOCKET_EINPROGRESS, SOCKET_EINPROGRESS); + break; + case 1626: + HASH_RETURN(0x3A13EC9C59F4165ALL, k_PHP_OUTPUT_HANDLER_START, PHP_OUTPUT_HANDLER_START); + break; + case 1628: + HASH_RETURN(0x35181A573537365CLL, k_STREAM_ENFORCE_SAFE_MODE, STREAM_ENFORCE_SAFE_MODE); + HASH_RETURN(0x232DEB0238C1565CLL, k_SOCKET_EADV, SOCKET_EADV); + break; + case 1633: + HASH_RETURN(0x594396F7F695B661LL, k_SOCKET_EOPNOTSUPP, SOCKET_EOPNOTSUPP); + break; + case 1635: + HASH_RETURN(0x527DBB739B4F5663LL, k_DATE_W3C, DATE_W3C); + break; + case 1636: + HASH_RETURN(0x3D193EE0BAC99664LL, k_SOCKET_ELOOP, SOCKET_ELOOP); + break; + case 1640: + HASH_RETURN(0x07F3CE6F91820668LL, k_LOG_DEBUG, LOG_DEBUG); + break; + case 1642: + HASH_RETURN(0x0B878628BB55666ALL, k_MCC_PORT_DEFAULT, MCC_PORT_DEFAULT); + HASH_RETURN(0x49C7314634E6366ALL, k_LOG_USER, LOG_USER); + break; + case 1652: + HASH_RETURN(0x3A3C1B143EAB6674LL, k_MW_SpreadPreview, MW_SpreadPreview); + break; + case 1654: + HASH_RETURN(0x72FF6CA950BC5676LL, k_XML_COMMENT_NODE, XML_COMMENT_NODE); + break; + case 1655: + HASH_RETURN(0x3E0F46D27EEF1677LL, k_U_FMT_PARSE_ERROR_LIMIT, U_FMT_PARSE_ERROR_LIMIT); + break; + case 1659: + HASH_RETURN(0x4B9782CE0E21D67BLL, k_MW_ScreenCompositeOp, MW_ScreenCompositeOp); + break; + case 1663: + HASH_RETURN(0x20AFB1446DAC467FLL, k_MW_CopyGreenCompositeOp, MW_CopyGreenCompositeOp); + break; + case 1664: + HASH_RETURN(0x6941704F7A3A4680LL, k_T_MOD_EQUAL, T_MOD_EQUAL); + break; + case 1669: + HASH_RETURN(0x353E4A8C9EA0E685LL, k_MW_RotatePreview, MW_RotatePreview); + break; + case 1671: + HASH_RETURN(0x213D650546EC9687LL, k_IMG_FILTER_GRAYSCALE, IMG_FILTER_GRAYSCALE); + break; + case 1674: + HASH_RETURN(0x549BA1E91A68068ALL, k_UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_NO_TMP_DIR); + break; + case 1677: + HASH_RETURN(0x56C3923D320DA68DLL, k_MW_TrueColorType, MW_TrueColorType); + HASH_RETURN(0x7A21D43E0067868DLL, k_U_REGEX_BAD_ESCAPE_SEQUENCE, U_REGEX_BAD_ESCAPE_SEQUENCE); + break; + case 1678: + HASH_RETURN(0x4AD5D039F33E068ELL, k_U_REGEX_ERROR_LIMIT, U_REGEX_ERROR_LIMIT); + HASH_RETURN(0x6D38BED4F9B5E68ELL, k_MYSQLI_GROUP_FLAG, MYSQLI_GROUP_FLAG); + break; + case 1684: + HASH_RETURN(0x4F52C13DD1F62694LL, k_XML_NOTATION_NODE, XML_NOTATION_NODE); + break; + case 1685: + HASH_RETURN(0x3AA13E3175564695LL, k_MON_2, MON_2); + break; + case 1691: + HASH_RETURN(0x2C7D797DADA9C69BLL, k_MW_SrcOverCompositeOp, MW_SrcOverCompositeOp); + break; + case 1693: + HASH_RETURN(0x420C3B126DE3D69DLL, k_MW_FloatPixel, MW_FloatPixel); + break; + case 1695: + HASH_RETURN(0x0D64A754EC74369FLL, k_CURL_VERSION_SSL, CURL_VERSION_SSL); + break; + case 1697: + HASH_RETURN(0x6FBA9F728C5836A1LL, k_MCC_NODELAY, MCC_NODELAY); + break; + case 1698: + HASH_RETURN(0x752BFAD2BED0F6A2LL, k_T_CATCH, T_CATCH); + break; + case 1700: + HASH_RETURN(0x69CFCC774FFB46A4LL, k_PKCS7_NOVERIFY, PKCS7_NOVERIFY); + HASH_RETURN(0x691114B93042A6A4LL, k_T_INT_CAST, T_INT_CAST); + break; + case 1703: + HASH_RETURN(0x756037040434A6A7LL, k_DNS_AAAA, DNS_AAAA); + break; + case 1707: + HASH_RETURN(0x603174EB69B9D6ABLL, k_IMAGETYPE_SWF, IMAGETYPE_SWF); + break; + case 1713: + HASH_RETURN(0x13B67015F66776B1LL, k_MW_DelegateError, MW_DelegateError); + break; + case 1716: + HASH_RETURN(0x31E9FAA3813766B4LL, k_MCC_DGRAM_TMO_WEIGHT, MCC_DGRAM_TMO_WEIGHT); + HASH_RETURN(0x0809501EC57106B4LL, k_IMG_FILTER_COLORIZE, IMG_FILTER_COLORIZE); + break; + case 1723: + HASH_RETURN(0x382F450B2DF1C6BBLL, k_SQLITE3_NUM, SQLITE3_NUM); + HASH_RETURN(0x1D0C5FE6684436BBLL, k_MW_MultiplyCompositeOp, MW_MultiplyCompositeOp); + HASH_RETURN(0x3CE71ED37919B6BBLL, k_U_INVALID_ID, U_INVALID_ID); + break; + case 1727: + HASH_RETURN(0x7F09B219DD62B6BFLL, k_FORCE_DEFLATE, FORCE_DEFLATE); + break; + case 1730: + HASH_RETURN(0x28DA6E111BED76C2LL, k_U_MULTIPLE_ANTE_CONTEXTS, U_MULTIPLE_ANTE_CONTEXTS); + break; + case 1733: + HASH_RETURN(0x33153DFC262E76C5LL, k_XSD_BASE64BINARY, XSD_BASE64BINARY); + break; + case 1737: + HASH_RETURN(0x23BD1300773736C9LL, k_SOCKET_EWOULDBLOCK, SOCKET_EWOULDBLOCK); + break; + case 1740: + HASH_RETURN(0x6F04597B140A96CCLL, k_SOL_TCP, SOL_TCP); + break; + case 1743: + HASH_RETURN(0x40222ED008C456CFLL, k_MCC_CONN_TMO_MS, MCC_CONN_TMO_MS); + break; + case 1744: + HASH_RETURN(0x1724D37E8935E6D0LL, k_STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_FAILURE); + break; + case 1745: + HASH_RETURN(0x6544B14F39B016D1LL, k_SOCKET_EAGAIN, SOCKET_EAGAIN); + break; + case 1752: + HASH_RETURN(0x30E37E8FDCF0A6D8LL, k_U_PARSE_ERROR_LIMIT, U_PARSE_ERROR_LIMIT); + break; + case 1753: + HASH_RETURN(0x3E4C4F24639EE6D9LL, k_SOCKET_EREMOTE, SOCKET_EREMOTE); + break; + case 1758: + HASH_RETURN(0x2AD352CA317456DELL, k_T_SL_EQUAL, T_SL_EQUAL); + break; + case 1761: + HASH_RETURN(0x63C9F5A35DE6E6E1LL, k_MYSQLI_TYPE_SET, MYSQLI_TYPE_SET); + break; + case 1763: + HASH_RETURN(0x5FABFDCB8225A6E3LL, k_LOG_UUCP, LOG_UUCP); + break; + case 1766: + HASH_RETURN(0x5A375DEB3587B6E6LL, k_MW_DisplaceCompositeOp, MW_DisplaceCompositeOp); + break; + case 1767: + HASH_RETURN(0x548883D60E9096E7LL, k_MYSQLI_TYPE_TIMESTAMP, MYSQLI_TYPE_TIMESTAMP); + break; + case 1768: + HASH_RETURN(0x300FB4FDC555A6E8LL, k_IMG_FILTER_NEGATE, IMG_FILTER_NEGATE); + break; + case 1772: + HASH_RETURN(0x1805BFEFC053E6ECLL, k_LOG_LOCAL4, LOG_LOCAL4); + HASH_RETURN(0x6D2FDA24541BF6ECLL, k_MYSQLI_MULTIPLE_KEY_FLAG, MYSQLI_MULTIPLE_KEY_FLAG); + break; + case 1774: + HASH_RETURN(0x144F99BEDEF4C6EELL, k_XML_ERROR_JUNK_AFTER_DOC_ELEMENT, XML_ERROR_JUNK_AFTER_DOC_ELEMENT); + HASH_RETURN(0x2293332FF8FFE6EELL, k_SOCKET_EXDEV, SOCKET_EXDEV); + break; + case 1777: + HASH_RETURN(0x3E8BC8B28AC606F1LL, k_MW_MissingDelegateError, MW_MissingDelegateError); + break; + case 1785: + HASH_RETURN(0x18146CB6242F56F9LL, k_MW_TransparentOpacity, MW_TransparentOpacity); + break; + case 1787: + HASH_RETURN(0x64399C8ED2D806FBLL, k_DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR); + break; + case 1789: + HASH_RETURN(0x2502BB56AD3B06FDLL, k_SOCKET_ESOCKTNOSUPPORT, SOCKET_ESOCKTNOSUPPORT); + HASH_RETURN(0x07FCB05E8D49F6FDLL, k_MW_AnyStyle, MW_AnyStyle); + break; + case 1793: + HASH_RETURN(0x6DD31F8F8D1BC701LL, k_LOG_NOWAIT, LOG_NOWAIT); + break; + case 1803: + HASH_RETURN(0x038DCF9D35BB370BLL, k_PHPMCC_NEW_HANDLE, PHPMCC_NEW_HANDLE); + break; + case 1810: + HASH_RETURN(0x68C5E4A4577BB712LL, k_U_REGEX_PROPERTY_SYNTAX, U_REGEX_PROPERTY_SYNTAX); + break; + case 1812: + HASH_RETURN(0x260BC1D181858714LL, k_OPENSSL_CIPHER_3DES, OPENSSL_CIPHER_3DES); + break; + case 1814: + HASH_RETURN(0x6BE145E729972716LL, k_U_INVARIANT_CONVERSION_ERROR, U_INVARIANT_CONVERSION_ERROR); + break; + case 1818: + HASH_RETURN(0x0EFB8EB113D4E71ALL, k_DNS_A6, DNS_A6); + break; + case 1820: + HASH_RETURN(0x792D92EA13AE471CLL, k_CURLOPT_INTERFACE, CURLOPT_INTERFACE); + break; + case 1821: + HASH_RETURN(0x188542CC6A9BD71DLL, k_SQLITE3_OPEN_CREATE, SQLITE3_OPEN_CREATE); + break; + case 1823: + HASH_RETURN(0x041E99953E9DC71FLL, k_PREG_GREP_INVERT, PREG_GREP_INVERT); + break; + case 1825: + HASH_RETURN(0x639180A8AC631721LL, k_GD_RELEASE_VERSION, GD_RELEASE_VERSION); + break; + case 1826: + HASH_RETURN(0x395FC3A9CD571722LL, k_CURLOPT_STDERR, CURLOPT_STDERR); + break; + case 1828: + HASH_RETURN(0x5BADEE146DF33724LL, k_MW_QuantizePreview, MW_QuantizePreview); + HASH_RETURN(0x1ADA9DB736DCD724LL, k_U_RULE_MASK_ERROR, U_RULE_MASK_ERROR); + break; + case 1829: + HASH_RETURN(0x2B620D69A2299725LL, k_MW_CopyYellowCompositeOp, MW_CopyYellowCompositeOp); + break; + case 1830: + HASH_RETURN(0x648120A99666F726LL, k_MCRYPT_TRIPLEDES, MCRYPT_TRIPLEDES); + break; + case 1834: + HASH_RETURN(0x6EECBB6F29B1B72ALL, k_MB_OVERLOAD_REGEX, MB_OVERLOAD_REGEX); + break; + case 1838: + HASH_RETURN(0x1F175B4F9F33C72ELL, k_MCC_PROXY_ARITH_OP, MCC_PROXY_ARITH_OP); + break; + case 1842: + HASH_RETURN(0x292EF9B0EA4AE732LL, k_MW_SrcCompositeOp, MW_SrcCompositeOp); + break; + case 1847: + HASH_RETURN(0x67DF05DCFD4E1737LL, k_MCC_ARG_NODELAY, MCC_ARG_NODELAY); + break; + case 1848: + HASH_RETURN(0x0EDAA0C1735C3738LL, k_MW_YIQColorspace, MW_YIQColorspace); + break; + case 1852: + HASH_RETURN(0x57D9975BA586973CLL, k_MCRYPT_RAND, MCRYPT_RAND); + break; + case 1855: + HASH_RETURN(0x650E641CC0E3873FLL, k_CONNECTION_ABORTED, CONNECTION_ABORTED); + break; + case 1857: + HASH_RETURN(0x0941509526468741LL, k_SOCKET_EISDIR, SOCKET_EISDIR); + break; + case 1860: + HASH_RETURN(0x32D82FB8CCF6B744LL, k_GRAPHEME_EXTR_MAXCHARS, GRAPHEME_EXTR_MAXCHARS); + break; + case 1861: + HASH_RETURN(0x31CF63F42018C745LL, k_CURLOPT_COOKIE, CURLOPT_COOKIE); + HASH_RETURN(0x1D4B894BEEDF4745LL, k_T_CONSTANT_ENCAPSED_STRING, T_CONSTANT_ENCAPSED_STRING); + break; + case 1862: + HASH_RETURN(0x33B6CA0ED5797746LL, k_MW_RootMeanSquaredErrorMetric, MW_RootMeanSquaredErrorMetric); + break; + case 1866: + HASH_RETURN(0x15405967EC1DE74ALL, k_MW_DstOutCompositeOp, MW_DstOutCompositeOp); + break; + case 1874: + HASH_RETURN(0x01A68F55AB8FB752LL, k_T_ENDIF, T_ENDIF); + break; + case 1875: + HASH_RETURN(0x579054DAC7BEA753LL, k_SEEK_CUR, SEEK_CUR); + break; + case 1876: + HASH_RETURN(0x3F1C931FB1410754LL, k_XSD_NEGATIVEINTEGER, XSD_NEGATIVEINTEGER); + break; + case 1877: + HASH_RETURN(0x2FA7F648C4AD1755LL, k_T_EVAL, T_EVAL); + break; + case 1883: + HASH_RETURN(0x0FB449265D3FA75BLL, k_MW_CopyCompositeOp, MW_CopyCompositeOp); + break; + case 1884: + HASH_RETURN(0x772C219B5A46075CLL, k_MW_PixelsPerInchResolution, MW_PixelsPerInchResolution); + break; + case 1887: + HASH_RETURN(0x7825179695D2575FLL, k_MCC_GET_RECORD_ERRORS, MCC_GET_RECORD_ERRORS); + break; + case 1888: + HASH_RETURN(0x287530C302633760LL, k_MCC_ARG_MIRROR_CFG_SERVERPOOLS, MCC_ARG_MIRROR_CFG_SERVERPOOLS); + HASH_RETURN(0x3A01C3205E2C1760LL, k_CURL_TIMECOND_LASTMOD, CURL_TIMECOND_LASTMOD); + break; + case 1890: + HASH_RETURN(0x57AA9835923EE762LL, k_UCOL_OFF, UCOL_OFF); + break; + case 1891: + HASH_RETURN(0x0647DE45E5710763LL, k_PSFS_ERR_FATAL, PSFS_ERR_FATAL); + HASH_RETURN(0x5FC6D86D2BE50763LL, k_CURLE_FTP_WEIRD_USER_REPLY, CURLE_FTP_WEIRD_USER_REPLY); + break; + case 1892: + HASH_RETURN(0x6633A488203B1764LL, k_T_DIV_EQUAL, T_DIV_EQUAL); + break; + case 1893: + HASH_RETURN(0x133DA7547CDC9765LL, k_PREG_SPLIT_NO_EMPTY, PREG_SPLIT_NO_EMPTY); + HASH_RETURN(0x4CEC52E1E8FEC765LL, k_IMG_ARC_NOFILL, IMG_ARC_NOFILL); + break; + case 1894: + HASH_RETURN(0x501EDBA82DA56766LL, k_MCC_ARG_CONSISTENT_HASHING_PREFIXES, MCC_ARG_CONSISTENT_HASHING_PREFIXES); + break; + case 1895: + HASH_RETURN(0x54A74F763794C767LL, k_CURLOPT_CRLF, CURLOPT_CRLF); + HASH_RETURN(0x05D6298339507767LL, k_MW_ReplaceCompositeOp, MW_ReplaceCompositeOp); + break; + case 1896: + HASH_RETURN(0x448607F579E9C768LL, k_SOCKET_EIDRM, SOCKET_EIDRM); + HASH_RETURN(0x565D48E6A30DD768LL, k_OCI_B_BIN, OCI_B_BIN); + break; + case 1902: + HASH_RETURN(0x71A04AD5ED9D876ELL, k_IMG_WBMP, IMG_WBMP); + break; + case 1908: + HASH_RETURN(0x2F1A49A33C675774LL, k_SIGCHLD, SIGCHLD); + break; + case 1911: + HASH_RETURN(0x626AC3D2E1FAE777LL, k_CURL_NETRC_OPTIONAL, CURL_NETRC_OPTIONAL); + break; + case 1914: + HASH_RETURN(0x0BC84FD0103FA77ALL, k_MCC_IPPROTO_TCP, MCC_IPPROTO_TCP); + break; + case 1916: + HASH_RETURN(0x78193C84413D077CLL, k_MW_FrameMode, MW_FrameMode); + break; + case 1922: + HASH_RETURN(0x03B141A69794D782LL, k_PHP_URL_QUERY, PHP_URL_QUERY); + HASH_RETURN(0x1343FDD056926782LL, k_CURLOPT_COOKIESESSION, CURLOPT_COOKIESESSION); + HASH_RETURN(0x1117821E1B069782LL, k_CURLE_SSL_ENGINE_NOTFOUND, CURLE_SSL_ENGINE_NOTFOUND); + break; + case 1924: + HASH_RETURN(0x7A4B8593A23CC784LL, k_T_END_HEREDOC, T_END_HEREDOC); + break; + case 1926: + HASH_RETURN(0x5ADD2A9E70C23786LL, k_XSD_GYEAR, XSD_GYEAR); + break; + case 1929: + HASH_RETURN(0x7BEA68732FFA8789LL, k_MW_UndefinedFilter, MW_UndefinedFilter); + HASH_RETURN(0x7CAD868BF5F07789LL, k_U_SORT_KEY_TOO_SHORT_WARNING, U_SORT_KEY_TOO_SHORT_WARNING); + HASH_RETURN(0x3F36CD494FD4C789LL, k_SIGHUP, SIGHUP); + break; + case 1934: + HASH_RETURN(0x762066131D7B278ELL, k_IMG_COLOR_BRUSHED, IMG_COLOR_BRUSHED); + break; + case 1935: + HASH_RETURN(0x63ACEEDBF49D678FLL, k_MCRYPT_RIJNDAEL_256, MCRYPT_RIJNDAEL_256); + break; + case 1936: + HASH_RETURN(0x4128B3B8BD6F0790LL, k_DATE_ISO8601, DATE_ISO8601); + HASH_RETURN(0x35AD2988BE853790LL, k_MW_BZipCompression, MW_BZipCompression); + break; + case 1937: + HASH_RETURN(0x58B82AB623312791LL, k_MW_GrayscalePreview, MW_GrayscalePreview); + break; + case 1939: + HASH_RETURN(0x4A97C20CE8EB5793LL, k_SOCKET_EPIPE, SOCKET_EPIPE); + HASH_RETURN(0x7A2A02F8D8F28793LL, k_MW_PeakAbsoluteErrorMetric, MW_PeakAbsoluteErrorMetric); + break; + case 1941: + HASH_RETURN(0x536D4F77BF80F795LL, k_SOAP_ENCODED, SOAP_ENCODED); + break; + case 1949: + HASH_RETURN(0x1382424778D8979DLL, k_SOCKET_EPFNOSUPPORT, SOCKET_EPFNOSUPPORT); + break; + case 1952: + HASH_RETURN(0x4900DF8C3B1F47A0LL, k_DOM_WRONG_DOCUMENT_ERR, DOM_WRONG_DOCUMENT_ERR); + break; + case 1963: + HASH_RETURN(0x5099501095EEB7ABLL, k_MW_UnrecognizedDispose, MW_UnrecognizedDispose); + HASH_RETURN(0x4E78DA139192B7ABLL, k_MYSQLI_TYPE_NEWDATE, MYSQLI_TYPE_NEWDATE); + break; + case 1966: + HASH_RETURN(0x37C2AE2BAABEC7AELL, k_LOG_AUTHPRIV, LOG_AUTHPRIV); + break; + case 1969: + HASH_RETURN(0x6496036DB407B7B1LL, k_T_PRIVATE, T_PRIVATE); + break; + case 1972: + HASH_RETURN(0x6F874FE3ABDF17B4LL, k_MW_DrawWarning, MW_DrawWarning); + break; + case 1973: + HASH_RETURN(0x36AD2EE9B5FB47B5LL, k_ABMON_1, ABMON_1); + break; + case 1974: + HASH_RETURN(0x4F7A901EB149E7B6LL, k_LC_MONETARY, LC_MONETARY); + break; + case 1975: + HASH_RETURN(0x0EB4E2C64D0C67B7LL, k_MW_UndefinedPixel, MW_UndefinedPixel); + break; + case 1976: + HASH_RETURN(0x5A792FBC3B6C27B8LL, k_CURLOPT_HTTPGET, CURLOPT_HTTPGET); + HASH_RETURN(0x1D077550A75167B8LL, k_CURL_NETRC_IGNORED, CURL_NETRC_IGNORED); + break; + case 1982: + HASH_RETURN(0x444C8C4C24BC27BELL, k_LOG_EMERG, LOG_EMERG); + HASH_RETURN(0x0873640DDAF3A7BELL, k_CURLOPT_SSLCERT, CURLOPT_SSLCERT); + break; + case 1983: + HASH_RETURN(0x665928FDFBC3C7BFLL, k_U_MALFORMED_VARIABLE_REFERENCE, U_MALFORMED_VARIABLE_REFERENCE); + HASH_RETURN(0x0A31065FCEBF77BFLL, k_T_SR, T_SR); + break; + case 1988: + HASH_RETURN(0x3215B126C795F7C4LL, k_MYSQLI_CLIENT_FOUND_ROWS, MYSQLI_CLIENT_FOUND_ROWS); + break; + case 1991: + HASH_RETURN(0x070B1673707BB7C7LL, k_MW_XYZColorspace, MW_XYZColorspace); + break; + case 1993: + HASH_RETURN(0x78E6D9AB7B1F77C9LL, k_CURLOPT_FTP_USE_EPSV, CURLOPT_FTP_USE_EPSV); + HASH_RETURN(0x195236F07FE8D7C9LL, k_OPENSSL_ALGO_MD2, OPENSSL_ALGO_MD2); + break; + case 1995: + HASH_RETURN(0x61A887EB9132F7CBLL, k_LIBXML_NONET, LIBXML_NONET); + HASH_RETURN(0x2C99C566869427CBLL, k_CURLPROXY_HTTP, CURLPROXY_HTTP); + break; + case 1997: + HASH_RETURN(0x27733194860247CDLL, k_CURLINFO_REDIRECT_COUNT, CURLINFO_REDIRECT_COUNT); + break; + case 2006: + HASH_RETURN(0x313F6CCD237977D6LL, k_XSD_IDREF, XSD_IDREF); + break; + case 2009: + HASH_RETURN(0x03CC1DAC7413F7D9LL, k_XML_ERROR_BAD_CHAR_REF, XML_ERROR_BAD_CHAR_REF); + HASH_RETURN(0x6001284C876B17D9LL, k_MW_GammaPreview, MW_GammaPreview); + break; + case 2011: + HASH_RETURN(0x38F10B0B143D47DBLL, k_IMAGETYPE_PNG, IMAGETYPE_PNG); + break; + case 2014: + HASH_RETURN(0x379335F89D4EA7DELL, k_CURLE_HTTP_PORT_FAILED, CURLE_HTTP_PORT_FAILED); + break; + case 2020: + HASH_RETURN(0x5C6968EBD7E647E4LL, k_SOCKET_EINVAL, SOCKET_EINVAL); + HASH_RETURN(0x7B2A807DE31127E4LL, k_POSIX_R_OK, POSIX_R_OK); + break; + case 2022: + HASH_RETURN(0x63D643FEF95D17E6LL, k_CURLOPT_VERBOSE, CURLOPT_VERBOSE); + break; + case 2030: + HASH_RETURN(0x28DD5960595917EELL, k_U_BRK_INTERNAL_ERROR, U_BRK_INTERNAL_ERROR); + break; + case 2032: + HASH_RETURN(0x464500713ED9B7F0LL, k_LDAP_OPT_RESTART, LDAP_OPT_RESTART); + break; + case 2041: + HASH_RETURN(0x579FA9D42A0DE7F9LL, k_EXTR_SKIP, EXTR_SKIP); + HASH_RETURN(0x0947FED54DD737F9LL, k_CURL_VERSION_IPV6, CURL_VERSION_IPV6); + break; + case 2042: + HASH_RETURN(0x37A1799ECE3A77FALL, k_OCI_DTYPE_FILE, OCI_DTYPE_FILE); + break; + case 2044: + HASH_RETURN(0x20DB841B6D8487FCLL, k_MW_ImageError, MW_ImageError); + HASH_RETURN(0x5B880AEFC81517FCLL, k_CLOCK_REALTIME, CLOCK_REALTIME); + break; + case 2045: + HASH_RETURN(0x49327DA0861697FDLL, k_IMG_XPM, IMG_XPM); + break; + case 2049: + HASH_RETURN(0x12BCEA0A7E8F1801LL, k_MCC_ARG_UDP_REPLY_PORTS, MCC_ARG_UDP_REPLY_PORTS); + break; + case 2050: + HASH_RETURN(0x0367293F7FF58802LL, k_U_REGEX_INVALID_BACK_REF, U_REGEX_INVALID_BACK_REF); + break; + case 2053: + HASH_RETURN(0x46405EB950EFB805LL, k_MW_FaxCompression, MW_FaxCompression); + break; + case 2056: + HASH_RETURN(0x19279D6DB4F70808LL, k_HASH_HMAC, HASH_HMAC); + HASH_RETURN(0x3CADC65B210C7808LL, k_SIGSYS, SIGSYS); + break; + case 2057: + HASH_RETURN(0x65E88B54E276D809LL, k_MCRYPT_BLOWFISH_COMPAT, MCRYPT_BLOWFISH_COMPAT); + break; + case 2059: + HASH_RETURN(0x1283FEC64E20380BLL, k_U_STRINGPREP_PROHIBITED_ERROR, U_STRINGPREP_PROHIBITED_ERROR); + break; + case 2061: + HASH_RETURN(0x3FE76D87A11F780DLL, k_MW_ButtCap, MW_ButtCap); + break; + case 2063: + HASH_RETURN(0x17CC1D98A80E180FLL, k_CURLE_SSL_CERTPROBLEM, CURLE_SSL_CERTPROBLEM); + break; + case 2064: + HASH_RETURN(0x33952DD5D2646810LL, k_XML_NAMESPACE_DECL_NODE, XML_NAMESPACE_DECL_NODE); + break; + case 2065: + HASH_RETURN(0x33A0B703BE508811LL, k_E_USER_ERROR, E_USER_ERROR); + HASH_RETURN(0x30E55E9F164FF811LL, k_MW_WestGravity, MW_WestGravity); + break; + case 2066: + HASH_RETURN(0x34192513C8751812LL, k_SQLT_BIN, SQLT_BIN); + break; + case 2071: + HASH_RETURN(0x192E88872DDA2817LL, k_OCI_B_NTY, OCI_B_NTY); + break; + case 2072: + HASH_RETURN(0x574CCEE9AF16E818LL, k_CURLE_UNKNOWN_TELNET_OPTION, CURLE_UNKNOWN_TELNET_OPTION); + break; + case 2074: + HASH_RETURN(0x14A2F28E9D9E581ALL, k_MW_WandError, MW_WandError); + HASH_RETURN(0x77922EEE8970081ALL, k_MW_ForgetGravity, MW_ForgetGravity); + break; + case 2079: + HASH_RETURN(0x5B7713B85F5D981FLL, k_MW_NorthEastGravity, MW_NorthEastGravity); + break; + case 2083: + HASH_RETURN(0x345D832025A65823LL, k_IMAGETYPE_BMP, IMAGETYPE_BMP); + break; + case 2086: + HASH_RETURN(0x19D7B9306EFAC826LL, k_T_CLASS, T_CLASS); + break; + case 2092: + HASH_RETURN(0x071B51CF8A72482CLL, k_PKCS7_NOCHAIN, PKCS7_NOCHAIN); + break; + case 2093: + HASH_RETURN(0x388D47E32D74182DLL, k_SQLITE3_OPEN_READWRITE, SQLITE3_OPEN_READWRITE); + break; + case 2094: + HASH_RETURN(0x154F2D870C9D282ELL, k_LC_ALL, LC_ALL); + HASH_RETURN(0x4BC3971B0CBF782ELL, k_MW_ObliqueStyle, MW_ObliqueStyle); + HASH_RETURN(0x27D637FD3FD5582ELL, k_U_COLLATOR_VERSION_MISMATCH, U_COLLATOR_VERSION_MISMATCH); + break; + case 2095: + HASH_RETURN(0x5E50FB86E399C82FLL, k_U_BRK_UNRECOGNIZED_OPTION, U_BRK_UNRECOGNIZED_OPTION); + break; + case 2099: + HASH_RETURN(0x5F50413E37549833LL, k_MW_BlueChannel, MW_BlueChannel); + break; + case 2100: + HASH_RETURN(0x030936AF1A6C6834LL, k_LC_MESSAGES, LC_MESSAGES); + HASH_RETURN(0x46F6871193CE7834LL, k_SEEK_END, SEEK_END); + break; + case 2102: + HASH_RETURN(0x24A11AD381891836LL, k_CURLOPT_DNS_USE_GLOBAL_CACHE, CURLOPT_DNS_USE_GLOBAL_CACHE); + HASH_RETURN(0x6613FF05B85FD836LL, k_MW_AbsoluteIntent, MW_AbsoluteIntent); + break; + case 2103: + HASH_RETURN(0x584AD726A54D7837LL, k_STREAM_PF_INET6, STREAM_PF_INET6); + HASH_RETURN(0x4F3E0D57B2562837LL, k_CURLE_OUT_OF_MEMORY, CURLE_OUT_OF_MEMORY); + break; + case 2105: + HASH_RETURN(0x2011D11D55C07839LL, k_MCC_ARG_NPOOLPREFIX, MCC_ARG_NPOOLPREFIX); + break; + case 2109: + HASH_RETURN(0x6C960B8716F2B83DLL, k_SOAP_ACTOR_UNLIMATERECEIVER, SOAP_ACTOR_UNLIMATERECEIVER); + break; + case 2110: + HASH_RETURN(0x53C20120DCBEC83ELL, k_ENT_COMPAT, ENT_COMPAT); + break; + case 2111: + HASH_RETURN(0x75356FA2FC21583FLL, k_GLOB_NOESCAPE, GLOB_NOESCAPE); + break; + case 2112: + HASH_RETURN(0x6CF1C1A2820B7840LL, k_U_BRK_ASSIGN_ERROR, U_BRK_ASSIGN_ERROR); + break; + case 2113: + HASH_RETURN(0x60693C58E7379841LL, k_MCC_ARG_DEBUG, MCC_ARG_DEBUG); + break; + case 2114: + HASH_RETURN(0x06F461C01A127842LL, k_INI_SYSTEM, INI_SYSTEM); + HASH_RETURN(0x3E0060C421772842LL, k_CURLE_FTP_ACCESS_DENIED, CURLE_FTP_ACCESS_DENIED); + break; + case 2117: + HASH_RETURN(0x27B0A348C67FC845LL, k_STREAM_NOTIFY_AUTH_REQUIRED, STREAM_NOTIFY_AUTH_REQUIRED); + HASH_RETURN(0x74E3A184D1378845LL, k_MW_ExpandedStretch, MW_ExpandedStretch); + break; + case 2119: + HASH_RETURN(0x2A7B2DAC5D786847LL, k_U_STRINGPREP_UNASSIGNED_ERROR, U_STRINGPREP_UNASSIGNED_ERROR); + break; + case 2121: + HASH_RETURN(0x02FBD61BF653A849LL, k_M_LOG10E, M_LOG10E); + break; + case 2129: + HASH_RETURN(0x5D3D57A12F025851LL, k_UCOL_NORMALIZATION_MODE, UCOL_NORMALIZATION_MODE); + HASH_RETURN(0x2EA281C863FF3851LL, k_U_STRING_NOT_TERMINATED_WARNING, U_STRING_NOT_TERMINATED_WARNING); + break; + case 2131: + HASH_RETURN(0x42461339B9C65853LL, k_PEAR_INSTALL_DIR, PEAR_INSTALL_DIR); + HASH_RETURN(0x27916C6508584853LL, k_MYSQLI_RPL_SLAVE, MYSQLI_RPL_SLAVE); + break; + case 2134: + HASH_RETURN(0x49F51C300540C856LL, k_T_FOR, T_FOR); + break; + case 2140: + HASH_RETURN(0x25CDD385D0DF085CLL, k_FALSE, FALSE); + HASH_RETURN(0x4714E01C3C39785CLL, k_XSD_1999_NAMESPACE, XSD_1999_NAMESPACE); + break; + case 2142: + HASH_RETURN(0x077D2273E186585ELL, k_PHP_INT_SIZE, PHP_INT_SIZE); + HASH_RETURN(0x5FA43EBB9F0F985ELL, k_T_STRING_CAST, T_STRING_CAST); + break; + case 2144: + HASH_RETURN(0x7CFEE5419ADF8860LL, k_SOCKET_EPERM, SOCKET_EPERM); + break; + case 2146: + HASH_RETURN(0x40F39F69B1D46862LL, k_T_BOOLEAN_OR, T_BOOLEAN_OR); + break; + case 2149: + HASH_RETURN(0x70F168CA811F8865LL, k_T_ARRAY_CAST, T_ARRAY_CAST); + break; + case 2153: + HASH_RETURN(0x758294CA60EFC869LL, k_XML_ELEMENT_DECL_NODE, XML_ELEMENT_DECL_NODE); + break; + case 2155: + HASH_RETURN(0x5EE2191D3CFA886BLL, k_CREDITS_ALL, CREDITS_ALL); + HASH_RETURN(0x64EAE61C324E786BLL, k_SOCKET_ENOSTR, SOCKET_ENOSTR); + HASH_RETURN(0x7C12D02C6A19D86BLL, k_CURLOPT_URL, CURLOPT_URL); + break; + case 2156: + HASH_RETURN(0x790B315ECC2EE86CLL, k_MW_BilevelType, MW_BilevelType); + break; + case 2163: + HASH_RETURN(0x465B3D22688A5873LL, k_MW_ImpulseNoise, MW_ImpulseNoise); + break; + case 2164: + HASH_RETURN(0x0EFEA98354284874LL, k_UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_INI_SIZE); + break; + case 2165: + HASH_RETURN(0x2EE21BA57B82B875LL, k_DNS_PTR, DNS_PTR); + HASH_RETURN(0x1599D857F2708875LL, k_U_PARSE_ERROR, U_PARSE_ERROR); + break; + case 2166: + HASH_RETURN(0x37D152A35A3E6876LL, k_OCI_ASSOC, OCI_ASSOC); + break; + case 2167: + HASH_RETURN(0x2F75598DE6463877LL, k_CURLINFO_SSL_VERIFYRESULT, CURLINFO_SSL_VERIFYRESULT); + break; + case 2168: + HASH_RETURN(0x2F9FFC1169FAB878LL, k_MW_WandFatalError, MW_WandFatalError); + break; + case 2169: + HASH_RETURN(0x031F7DBCABC84879LL, k_CURLE_FTP_PORT_FAILED, CURLE_FTP_PORT_FAILED); + HASH_RETURN(0x45C713C0CF69E879LL, k_T_CURLY_OPEN, T_CURLY_OPEN); + break; + case 2170: + HASH_RETURN(0x2240C503C9BFB87ALL, k_X509_PURPOSE_SSL_CLIENT, X509_PURPOSE_SSL_CLIENT); + break; + case 2172: + HASH_RETURN(0x2C335891BDF0487CLL, k_CURLOPT_PASSWDFUNCTION, CURLOPT_PASSWDFUNCTION); + break; + case 2175: + HASH_RETURN(0x5AAA6387AA31687FLL, k_DOM_INUSE_ATTRIBUTE_ERR, DOM_INUSE_ATTRIBUTE_ERR); + HASH_RETURN(0x4BCFA64F4A5A587FLL, k_XML_OPTION_TARGET_ENCODING, XML_OPTION_TARGET_ENCODING); + HASH_RETURN(0x27367C3E2B2DA87FLL, k_SQLT_LNG, SQLT_LNG); + break; + case 2176: + HASH_RETURN(0x0E3C35A225716880LL, k_MW_UndefinedColorspace, MW_UndefinedColorspace); + break; + case 2178: + HASH_RETURN(0x77A65A9BBD798882LL, k_XML_ATTRIBUTE_NMTOKENS, XML_ATTRIBUTE_NMTOKENS); + HASH_RETURN(0x0120F1CB87C56882LL, k_ASSERT_BAIL, ASSERT_BAIL); + HASH_RETURN(0x318F26B448ED5882LL, k_SOCK_DGRAM, SOCK_DGRAM); + HASH_RETURN(0x79457CDE8DCE5882LL, k_T_UNSET, T_UNSET); + break; + case 2180: + HASH_RETURN(0x0C510EF549D02884LL, k_CURLFTPAUTH_SSL, CURLFTPAUTH_SSL); + break; + case 2181: + HASH_RETURN(0x765F082D54FAA885LL, k_OCI_SYSOPER, OCI_SYSOPER); + break; + case 2183: + HASH_RETURN(0x37C2795D03D77887LL, k_MW_GrayscaleType, MW_GrayscaleType); + break; + case 2184: + HASH_RETURN(0x1FCCE341BB995888LL, k_MW_MiterJoin, MW_MiterJoin); + break; + case 2186: + HASH_RETURN(0x6B505CF72E0EB88ALL, k_CURLOPT_MAXREDIRS, CURLOPT_MAXREDIRS); + break; + case 2197: + HASH_RETURN(0x22B98ADA0CE2D895LL, k_U_ILLEGAL_PAD_POSITION, U_ILLEGAL_PAD_POSITION); + HASH_RETURN(0x03A102A1EF8DA895LL, k_OCI_DEFAULT, OCI_DEFAULT); + break; + case 2198: + HASH_RETURN(0x72B940DF50000896LL, k_MW_ColorDodgeCompositeOp, MW_ColorDodgeCompositeOp); + break; + case 2200: + HASH_RETURN(0x2FEC23E876B5C898LL, k_XML_ATTRIBUTE_ENTITY, XML_ATTRIBUTE_ENTITY); + break; + case 2202: + HASH_RETURN(0x3740A89ECE65589ALL, k_SOL_SOCKET, SOL_SOCKET); + HASH_RETURN(0x300C182E4A25089ALL, k_T_LINE, T_LINE); + break; + case 2205: + HASH_RETURN(0x5C853574E144989DLL, k_MW_CharPixel, MW_CharPixel); + break; + case 2209: + HASH_RETURN(0x15653FAD67FAD8A1LL, k_AF_UNIX, AF_UNIX); + break; + case 2211: + HASH_RETURN(0x0A5955E4DEB8C8A3LL, k_SQLT_NTY, SQLT_NTY); + break; + case 2214: + HASH_RETURN(0x2C360E8A69F738A6LL, k_U_MULTIPLE_CURSORS, U_MULTIPLE_CURSORS); + break; + case 2217: + HASH_RETURN(0x24E10F7B53B4E8A9LL, k_U_UNEXPECTED_TOKEN, U_UNEXPECTED_TOKEN); + break; + case 2220: + HASH_RETURN(0x484BB3BB4F7598ACLL, k_MSG_EOR, MSG_EOR); + HASH_RETURN(0x32D78DF4B542B8ACLL, k_SQLT_BLOB, SQLT_BLOB); + break; + case 2227: + HASH_RETURN(0x11532565DA65F8B3LL, k_OCI_B_BFILE, OCI_B_BFILE); + break; + case 2229: + HASH_RETURN(0x5F6E900C4AED48B5LL, k_XML_TEXT_NODE, XML_TEXT_NODE); + break; + case 2231: + HASH_RETURN(0x5C8411EE9DE9B8B7LL, k_SOCKET_ENOLCK, SOCKET_ENOLCK); + break; + case 2233: + HASH_RETURN(0x02F11043EA15F8B9LL, k_ABMON_3, ABMON_3); + break; + case 2234: + HASH_RETURN(0x6BC20D4DEBB4E8BALL, k_CRNCYSTR, CRNCYSTR); + HASH_RETURN(0x34B08D613DB728BALL, k_PKCS7_NOSIGS, PKCS7_NOSIGS); + break; + case 2237: + HASH_RETURN(0x07FC64F8B870A8BDLL, k_STREAM_SOCK_RAW, STREAM_SOCK_RAW); + HASH_RETURN(0x0F97E4968AEBE8BDLL, k_MW_PerceptualIntent, MW_PerceptualIntent); + HASH_RETURN(0x1CAD112F1B5CF8BDLL, k_MCC_ACCESSPOINT_UP, MCC_ACCESSPOINT_UP); + break; + case 2238: + HASH_RETURN(0x7EA3BE3E8331B8BELL, k_CURLOPT_HTTP_VERSION, CURLOPT_HTTP_VERSION); + break; + case 2239: + HASH_RETURN(0x486D3F04BDC408BFLL, k_PNG_NO_FILTER, PNG_NO_FILTER); + break; + case 2245: + HASH_RETURN(0x23CA1AEA4CDA68C5LL, k_U_BRK_HEX_DIGITS_EXPECTED, U_BRK_HEX_DIGITS_EXPECTED); + break; + case 2249: + HASH_RETURN(0x5A82E7A362F938C9LL, k_SOCKET_EBADF, SOCKET_EBADF); + break; + case 2251: + HASH_RETURN(0x02AF23FBAF73B8CBLL, k_MW_LosslessJPEGCompression, MW_LosslessJPEGCompression); + break; + case 2254: + HASH_RETURN(0x746DBA3493DA28CELL, k_X509_PURPOSE_ANY, X509_PURPOSE_ANY); + break; + case 2257: + HASH_RETURN(0x5A3CDD027D1B98D1LL, k_MW_ThresholdCompositeOp, MW_ThresholdCompositeOp); + break; + case 2259: + HASH_RETURN(0x7E29F1A55B1348D3LL, k_SORT_DESC, SORT_DESC); + HASH_RETURN(0x5EF153AF8AC5A8D3LL, k_CURLE_UNSUPPORTED_PROTOCOL, CURLE_UNSUPPORTED_PROTOCOL); + break; + case 2260: + HASH_RETURN(0x6A7AD33CDF49E8D4LL, k_SORT_NUMERIC, SORT_NUMERIC); + break; + case 2272: + HASH_RETURN(0x43A223E650D4E8E0LL, k_MW_ModuleWarning, MW_ModuleWarning); + HASH_RETURN(0x5320CFF3F9BEE8E0LL, k_MW_OptimizeType, MW_OptimizeType); + break; + case 2276: + HASH_RETURN(0x7A2B5AADC981A8E4LL, k_U_MISPLACED_ANCHOR_START, U_MISPLACED_ANCHOR_START); + break; + case 2278: + HASH_RETURN(0x5E9B400E452458E6LL, k_MON_8, MON_8); + HASH_RETURN(0x54679881E76768E6LL, k_MCRYPT_RC6, MCRYPT_RC6); + break; + case 2283: + HASH_RETURN(0x655FC9A5A7A468EBLL, k_UCOL_UPPER_FIRST, UCOL_UPPER_FIRST); + break; + case 2287: + HASH_RETURN(0x4F1FC9EF358F48EFLL, k_PCRE_VERSION, PCRE_VERSION); + break; + case 2290: + HASH_RETURN(0x707028E4908748F2LL, k_STREAM_NOTIFY_CONNECT, STREAM_NOTIFY_CONNECT); + break; + case 2293: + HASH_RETURN(0x4B4926CD21E9E8F5LL, k_T_LOGICAL_OR, T_LOGICAL_OR); + break; + case 2295: + HASH_RETURN(0x23FD459A654E88F7LL, k_MYSQLI_TYPE_YEAR, MYSQLI_TYPE_YEAR); + break; + case 2296: + HASH_RETURN(0x173A4363512CC8F8LL, k_MW_ColorizeCompositeOp, MW_ColorizeCompositeOp); + break; + case 2298: + HASH_RETURN(0x4A765DF8CC5BA8FALL, k_UCOL_ON, UCOL_ON); + break; + case 2300: + HASH_RETURN(0x4F7A2A658BB568FCLL, k_SOCKET_EFAULT, SOCKET_EFAULT); + break; + case 2302: + HASH_RETURN(0x76D357E7C04318FELL, k_SOAP_PERSISTENCE_SESSION, SOAP_PERSISTENCE_SESSION); + break; + case 2312: + HASH_RETURN(0x03378600DF2B6908LL, k_CURL_TIMECOND_IFMODSINCE, CURL_TIMECOND_IFMODSINCE); + break; + case 2314: + HASH_RETURN(0x110DFB34EFB0A90ALL, k_SQLT_STR, SQLT_STR); + break; + case 2315: + HASH_RETURN(0x1047DF1F1BF2990BLL, k_MW_ColorSeparationType, MW_ColorSeparationType); + break; + case 2319: + HASH_RETURN(0x09480BF69F8BD90FLL, k_MON_4, MON_4); + break; + case 2323: + HASH_RETURN(0x0112B569D0962913LL, k_CURLE_FTP_BAD_DOWNLOAD_RESUME, CURLE_FTP_BAD_DOWNLOAD_RESUME); + break; + case 2324: + HASH_RETURN(0x31370A258E78D914LL, k_XSD_NAMESPACE, XSD_NAMESPACE); + HASH_RETURN(0x2C343F827292F914LL, k_U_ILLEGAL_ESCAPE_SEQUENCE, U_ILLEGAL_ESCAPE_SEQUENCE); + HASH_RETURN(0x0174B285BF9FB914LL, k_IDNA_NO_ACE_PREFIX, IDNA_NO_ACE_PREFIX); + break; + case 2325: + HASH_RETURN(0x2D84211FD73C7915LL, k_SEEK_SET, SEEK_SET); + break; + case 2326: + HASH_RETURN(0x05F207C1FFDC0916LL, k_MCC_TCP_INACTIVITY_TMO_DEFAULT, MCC_TCP_INACTIVITY_TMO_DEFAULT); + HASH_RETURN(0x388C3D22F9225916LL, k_MW_ResetMethod, MW_ResetMethod); + break; + case 2327: + HASH_RETURN(0x29E763F1CCCCA917LL, k_CURLM_BAD_HANDLE, CURLM_BAD_HANDLE); + HASH_RETURN(0x7D90050F0D6A5917LL, k_U_UNSUPPORTED_PROPERTY, U_UNSUPPORTED_PROPERTY); + break; + case 2335: + HASH_RETURN(0x7E75714DA4B7F91FLL, k_OCI_DESCRIBE_ONLY, OCI_DESCRIBE_ONLY); + break; + case 2337: + HASH_RETURN(0x66841F72C3513921LL, k_PATHINFO_BASENAME, PATHINFO_BASENAME); + break; + case 2339: + HASH_RETURN(0x6F24996DA2E26923LL, k_LOG_ODELAY, LOG_ODELAY); + break; + case 2341: + HASH_RETURN(0x68541380F4E53925LL, k_CURLE_COULDNT_RESOLVE_PROXY, CURLE_COULDNT_RESOLVE_PROXY); + break; + case 2344: + HASH_RETURN(0x7A87A43C047C6928LL, k_CODESET, CODESET); + break; + case 2345: + HASH_RETURN(0x26653F979C3D9929LL, k_CURLE_FTP_WEIRD_PASS_REPLY, CURLE_FTP_WEIRD_PASS_REPLY); + break; + case 2346: + HASH_RETURN(0x285FD5301BE9792ALL, k_PHP_BINARY_READ, PHP_BINARY_READ); + break; + case 2348: + HASH_RETURN(0x6CF2F9707E6BE92CLL, k_SOCKET_EBADR, SOCKET_EBADR); + break; + case 2350: + HASH_RETURN(0x1BFDA67089F8A92ELL, k_MW_AddEvaluateOperator, MW_AddEvaluateOperator); + HASH_RETURN(0x62D2366B6E78092ELL, k_U_REGEX_SET_CONTAINS_STRING, U_REGEX_SET_CONTAINS_STRING); + break; + case 2353: + HASH_RETURN(0x472D172E9FD61931LL, k_CURLOPT_SSLENGINE, CURLOPT_SSLENGINE); + HASH_RETURN(0x7756005C96A67931LL, k_U_MALFORMED_PRAGMA, U_MALFORMED_PRAGMA); + break; + case 2358: + HASH_RETURN(0x3105C07A2DC1E936LL, k_LIBXML_NOERROR, LIBXML_NOERROR); + HASH_RETURN(0x67FC6A5469828936LL, k_SO_ERROR, SO_ERROR); + break; + case 2360: + HASH_RETURN(0x3FFF6279F204E938LL, k_SOAP_WAIT_ONE_WAY_CALLS, SOAP_WAIT_ONE_WAY_CALLS); + break; + case 2362: + HASH_RETURN(0x0404A4649D9EC93ALL, k_IDNA_CONTAINS_NON_LDH, IDNA_CONTAINS_NON_LDH); + break; + case 2365: + HASH_RETURN(0x40272409CA10393DLL, k_MCRYPT_ENIGNA, MCRYPT_ENIGNA); + break; + case 2367: + HASH_RETURN(0x09EA912F5BFF493FLL, k_CURLCLOSEPOLICY_OLDEST, CURLCLOSEPOLICY_OLDEST); + break; + case 2371: + HASH_RETURN(0x58EEBE21FA018943LL, k_ABDAY_2, ABDAY_2); + break; + case 2374: + HASH_RETURN(0x0EC74FD23BF5F946LL, k_XSD_POSITIVEINTEGER, XSD_POSITIVEINTEGER); + break; + case 2375: + HASH_RETURN(0x16DC2D0D5C490947LL, k_LOG_MAIL, LOG_MAIL); + break; + case 2383: + HASH_RETURN(0x2CD008FE18C4F94FLL, k_MW_LeftAlign, MW_LeftAlign); + break; + case 2387: + HASH_RETURN(0x7859C5EE9AD71953LL, k_IMAGETYPE_JPX, IMAGETYPE_JPX); + HASH_RETURN(0x734EC3FA084E8953LL, k_MW_LABColorspace, MW_LABColorspace); + break; + case 2388: + HASH_RETURN(0x02CF2AE2FD7E8954LL, k_CURLE_LDAP_SEARCH_FAILED, CURLE_LDAP_SEARCH_FAILED); + break; + case 2389: + HASH_RETURN(0x33960F1673FEE955LL, k_U_MULTIPLE_COMPOUND_FILTERS, U_MULTIPLE_COMPOUND_FILTERS); + break; + case 2390: + HASH_RETURN(0x5C955010382FB956LL, k_SOCKET_EL3RST, SOCKET_EL3RST); + break; + case 2393: + HASH_RETURN(0x032787AF5C785959LL, k_PEAR_EXTENSION_DIR, PEAR_EXTENSION_DIR); + break; + case 2396: + HASH_RETURN(0x16EB68A181FE395CLL, k_FILE_IGNORE_NEW_LINES, FILE_IGNORE_NEW_LINES); + HASH_RETURN(0x735DAB190723D95CLL, k_CRYPT_EXT_DES, CRYPT_EXT_DES); + break; + case 2397: + HASH_RETURN(0x098E806BB5F1095DLL, k_MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); + break; + case 2400: + HASH_RETURN(0x44D60610A7FD3960LL, k_SOCKET_EUNATCH, SOCKET_EUNATCH); + break; + case 2402: + HASH_RETURN(0x13AC56A6C39A2962LL, k_FB_UNSERIALIZE_NONSTRING_VALUE, FB_UNSERIALIZE_NONSTRING_VALUE); + HASH_RETURN(0x4DC3AFA568EB5962LL, k_MW_UndefinedChannel, MW_UndefinedChannel); + break; + case 2405: + HASH_RETURN(0x03EFBFF5CA1E4965LL, k_E_ERROR, E_ERROR); + break; + case 2410: + HASH_RETURN(0x09A70C497AC6D96ALL, k_CURLFTPSSL_NONE, CURLFTPSSL_NONE); + HASH_RETURN(0x10CF3B121D72D96ALL, k_MW_RegistryError, MW_RegistryError); + break; + case 2412: + HASH_RETURN(0x70B8FC059341196CLL, k_MW_UndefinedPathUnits, MW_UndefinedPathUnits); + HASH_RETURN(0x30FF028F540E696CLL, k_MW_LZWCompression, MW_LZWCompression); + break; + case 2413: + HASH_RETURN(0x039F36758709D96DLL, k_SOCKET_EHOSTUNREACH, SOCKET_EHOSTUNREACH); + HASH_RETURN(0x7785CA5E2CE3196DLL, k_CURLOPT_SSLKEY, CURLOPT_SSLKEY); + break; + case 2416: + HASH_RETURN(0x420AE31E6D527970LL, k_STREAM_CLIENT_ASYNC_CONNECT, STREAM_CLIENT_ASYNC_CONNECT); + HASH_RETURN(0x28E040F9106FA970LL, k_CURLOPT_DNS_CACHE_TIMEOUT, CURLOPT_DNS_CACHE_TIMEOUT); + break; + case 2419: + HASH_RETURN(0x4BCC0F7A51724973LL, k_UCOL_SHIFTED, UCOL_SHIFTED); + HASH_RETURN(0x3CF067AC5B261973LL, k_SOCK_RDM, SOCK_RDM); + break; + case 2424: + HASH_RETURN(0x3DBA922036C2D978LL, k_IMAGETYPE_JPC, IMAGETYPE_JPC); + break; + case 2425: + HASH_RETURN(0x3F5848029B6E4979LL, k_MW_HermiteFilter, MW_HermiteFilter); + break; + case 2426: + HASH_RETURN(0x4092130A2E6AA97ALL, k_PHP_URL_PATH, PHP_URL_PATH); + break; + case 2427: + HASH_RETURN(0x357DB71C9E8E097BLL, k_IDNA_CONTAINS_ACE_PREFIX, IDNA_CONTAINS_ACE_PREFIX); + break; + case 2428: + HASH_RETURN(0x674AA8DD33D1497CLL, k_LIBXML_ERR_FATAL, LIBXML_ERR_FATAL); + break; + case 2429: + HASH_RETURN(0x358E5276A4AB697DLL, k_IMAGETYPE_GIF, IMAGETYPE_GIF); + break; + case 2431: + HASH_RETURN(0x635C75864E19797FLL, k_PHP_URL_PASS, PHP_URL_PASS); + break; + case 2432: + HASH_RETURN(0x390A369464AFC980LL, k_CURLOPT_FRESH_CONNECT, CURLOPT_FRESH_CONNECT); + break; + case 2433: + HASH_RETURN(0x16D08C750D482981LL, k_CURLE_FUNCTION_NOT_FOUND, CURLE_FUNCTION_NOT_FOUND); + break; + case 2434: + HASH_RETURN(0x3249C6BFF130C982LL, k_XML_DOCUMENT_NODE, XML_DOCUMENT_NODE); + break; + case 2437: + HASH_RETURN(0x3A6B9561E565A985LL, k_CURLOPT_PUT, CURLOPT_PUT); + HASH_RETURN(0x47D0A6FC1432A985LL, k_CURLE_FTP_CANT_RECONNECT, CURLE_FTP_CANT_RECONNECT); + break; + case 2440: + HASH_RETURN(0x65E1A61DCE3D0988LL, k_DATE_RFC850, DATE_RFC850); + break; + case 2441: + HASH_RETURN(0x0C37BD7326578989LL, k_SQLT_AVC, SQLT_AVC); + break; + case 2443: + HASH_RETURN(0x63E5DC19318BA98BLL, k_LDAP_OPT_DEBUG_LEVEL, LDAP_OPT_DEBUG_LEVEL); + break; + case 2445: + HASH_RETURN(0x01F3801999B5E98DLL, k_M_PI_4, M_PI_4); + break; + case 2446: + HASH_RETURN(0x67D787896EA0D98ELL, k_D_T_FMT, D_T_FMT); + break; + case 2449: + HASH_RETURN(0x41D25C4005361991LL, k_XSD_ID, XSD_ID); + break; + case 2450: + HASH_RETURN(0x698FD54883B9D992LL, k_XSD_HEXBINARY, XSD_HEXBINARY); + break; + case 2454: + HASH_RETURN(0x58A38776F9EE4996LL, k_ABMON_11, ABMON_11); + HASH_RETURN(0x39FA3B4ACE936996LL, k_MCRYPT_MODE_OFB, MCRYPT_MODE_OFB); + break; + case 2458: + HASH_RETURN(0x394F32AA0E8A699ALL, k_SQLT_RSET, SQLT_RSET); + break; + case 2460: + HASH_RETURN(0x51DB69619928599CLL, k_MW_MissingDelegateFatalError, MW_MissingDelegateFatalError); + HASH_RETURN(0x3FD9355EEBA9999CLL, k_MYSQLI_TYPE_DECIMAL, MYSQLI_TYPE_DECIMAL); + break; + case 2462: + HASH_RETURN(0x16F09001DC71499ELL, k_XML_DOCUMENT_FRAG_NODE, XML_DOCUMENT_FRAG_NODE); + HASH_RETURN(0x13EFDD816DC9799ELL, k_T_START_HEREDOC, T_START_HEREDOC); + break; + case 2464: + HASH_RETURN(0x5B6DCCDE7AD699A0LL, k_XML_ENTITY_NODE, XML_ENTITY_NODE); + HASH_RETURN(0x3ADC05D11911B9A0LL, k_DAY_2, DAY_2); + HASH_RETURN(0x0F8F905AEFD7C9A0LL, k_MW_JPEGCompression, MW_JPEGCompression); + break; + case 2468: + HASH_RETURN(0x668C95D9A5A149A4LL, k_DATE_RSS, DATE_RSS); + break; + case 2470: + HASH_RETURN(0x6DC825C646F759A6LL, k_MCC_SERVER_DISABLED, MCC_SERVER_DISABLED); + break; + case 2471: + HASH_RETURN(0x43F7EEC222C759A7LL, k_DAY_6, DAY_6); + break; + case 2473: + HASH_RETURN(0x0AA6222BC82F99A9LL, k_MW_DstOverCompositeOp, MW_DstOverCompositeOp); + break; + case 2477: + HASH_RETURN(0x10AFA81F159479ADLL, k_MW_RedChannel, MW_RedChannel); + break; + case 2481: + HASH_RETURN(0x771F20A576A959B1LL, k_XSD_NORMALIZEDSTRING, XSD_NORMALIZEDSTRING); + break; + case 2489: + HASH_RETURN(0x75B4EB59DA30A9B9LL, k_EXTR_REFS, EXTR_REFS); + break; + case 2491: + HASH_RETURN(0x137D5434ACF3A9BBLL, k_MYSQL_CLIENT_INTERACTIVE, MYSQL_CLIENT_INTERACTIVE); + break; + case 2495: + HASH_RETURN(0x54DD7D6B4CCA79BFLL, k_CURLE_GOT_NOTHING, CURLE_GOT_NOTHING); + break; + case 2496: + HASH_RETURN(0x68E1B70D4F4979C0LL, k_SOCKET_EBADRQC, SOCKET_EBADRQC); + break; + case 2497: + HASH_RETURN(0x321740CD419049C1LL, k_CURLOPT_RESUME_FROM, CURLOPT_RESUME_FROM); + break; + case 2498: + HASH_RETURN(0x72282E1AF60499C2LL, k_T_EMPTY, T_EMPTY); + break; + case 2501: + HASH_RETURN(0x24C5831E3221F9C5LL, k_CURLINFO_FILETIME, CURLINFO_FILETIME); + break; + case 2504: + HASH_RETURN(0x4BA110F9307FE9C8LL, k_CURLFTPSSL_ALL, CURLFTPSSL_ALL); + break; + case 2506: + HASH_RETURN(0x3BE4F907456969CALL, k_STREAM_IGNORE_URL, STREAM_IGNORE_URL); + break; + case 2509: + HASH_RETURN(0x29F4CBFAEAB389CDLL, k_MW_WandWarning, MW_WandWarning); + break; + case 2512: + HASH_RETURN(0x0BD951C18B00C9D0LL, k_SO_TYPE, SO_TYPE); + break; + case 2514: + HASH_RETURN(0x7A3C6246DF1CD9D2LL, k_LDAP_OPT_HOST_NAME, LDAP_OPT_HOST_NAME); + break; + case 2515: + HASH_RETURN(0x515A6F1E2D2B59D3LL, k_SOCKET_EMEDIUMTYPE, SOCKET_EMEDIUMTYPE); + HASH_RETURN(0x6F2A0EAF454939D3LL, k_CURLINFO_HTTP_CODE, CURLINFO_HTTP_CODE); + break; + case 2516: + HASH_RETURN(0x0151536238DE89D4LL, k_MW_DarkenCompositeOp, MW_DarkenCompositeOp); + break; + case 2518: + HASH_RETURN(0x17578C814623D9D6LL, k_CURLOPT_RANDOM_FILE, CURLOPT_RANDOM_FILE); + break; + case 2520: + HASH_RETURN(0x4335FA5B685E49D8LL, k_MW_HSBColorspace, MW_HSBColorspace); + break; + case 2521: + HASH_RETURN(0x772BFBE3468769D9LL, k_LIBXML_DTDLOAD, LIBXML_DTDLOAD); + break; + case 2523: + HASH_RETURN(0x4D22AD59AC4179DBLL, k_XML_ATTRIBUTE_DECL_NODE, XML_ATTRIBUTE_DECL_NODE); + break; + case 2528: + HASH_RETURN(0x3FCB6550F40539E0LL, k_CRYPT_SALT_LENGTH, CRYPT_SALT_LENGTH); + break; + case 2529: + HASH_RETURN(0x2B169E2A6F8DD9E1LL, k_MW_NorthGravity, MW_NorthGravity); + break; + case 2530: + HASH_RETURN(0x50C098E26C5509E2LL, k_MON_1, MON_1); + HASH_RETURN(0x0690C7C0646B29E2LL, k_MW_AnyStretch, MW_AnyStretch); + break; + case 2531: + HASH_RETURN(0x4B1D2BB8295279E3LL, k_T_ISSET, T_ISSET); + break; + case 2534: + HASH_RETURN(0x13EE8285564269E6LL, k_FB_UNSERIALIZE_UNEXPECTED_END, FB_UNSERIALIZE_UNEXPECTED_END); + break; + case 2537: + HASH_RETURN(0x2497AFE6CF32A9E9LL, k_STREAM_IPPROTO_TCP, STREAM_IPPROTO_TCP); + break; + case 2538: + HASH_RETURN(0x0EF43AFB0857C9EALL, k_MCC_ARG_SERVER_RETRY_TMO_MS, MCC_ARG_SERVER_RETRY_TMO_MS); + break; + case 2541: + HASH_RETURN(0x44E399DE55AFB9EDLL, k_MCC_CONSISTENCY_MATCH_HITS_SUPERCEDES, MCC_CONSISTENCY_MATCH_HITS_SUPERCEDES); + break; + case 2544: + HASH_RETURN(0x547BA6FCF3B989F0LL, k_PSFS_FLAG_NORMAL, PSFS_FLAG_NORMAL); + break; + case 2545: + HASH_RETURN(0x69CE45F5299759F1LL, k_LOCK_EX, LOCK_EX); + break; + case 2546: + HASH_RETURN(0x475ED755F1D3E9F2LL, k_MW_GaussianNoise, MW_GaussianNoise); + break; + case 2547: + HASH_RETURN(0x4C06BBFB5FBBA9F3LL, k_E_USER_WARNING, E_USER_WARNING); + HASH_RETURN(0x1244E23654E739F3LL, k_STR_PAD_BOTH, STR_PAD_BOTH); + break; + case 2548: + HASH_RETURN(0x7AD9F8D598C349F4LL, k_CURLINFO_REQUEST_SIZE, CURLINFO_REQUEST_SIZE); + break; + case 2549: + HASH_RETURN(0x3210F73E8C4749F5LL, k_MYSQLI_UNSIGNED_FLAG, MYSQLI_UNSIGNED_FLAG); + break; + case 2551: + HASH_RETURN(0x33004E7E1FE1A9F7LL, k_LIBXML_DTDATTR, LIBXML_DTDATTR); + break; + case 2554: + HASH_RETURN(0x05BD4F202B0EB9FALL, k_MCC_ARG_PROXY_OPS, MCC_ARG_PROXY_OPS); + break; + case 2555: + HASH_RETURN(0x529AC6470D4589FBLL, k_MW_ImplodePreview, MW_ImplodePreview); + break; + case 2556: + HASH_RETURN(0x4FE44D1D755059FCLL, k_MW_AddCompositeOp, MW_AddCompositeOp); + break; + case 2557: + HASH_RETURN(0x14598BDC3230B9FDLL, k_STREAM_FILTER_ALL, STREAM_FILTER_ALL); + break; + case 2559: + HASH_RETURN(0x59DFA8E4508559FFLL, k_T_GLOBAL, T_GLOBAL); + break; + case 2560: + HASH_RETURN(0x1EC891568EDFFA00LL, k_SOAP_COMPRESSION_DEFLATE, SOAP_COMPRESSION_DEFLATE); + break; + case 2561: + HASH_RETURN(0x25BFE6991D197A01LL, k_T_INCLUDE_ONCE, T_INCLUDE_ONCE); + break; + case 2566: + HASH_RETURN(0x498817332D8FDA06LL, k_XML_ERROR_NO_MEMORY, XML_ERROR_NO_MEMORY); + break; + case 2568: + HASH_RETURN(0x42DF97153C668A08LL, k_U_REGEX_INTERNAL_ERROR, U_REGEX_INTERNAL_ERROR); + break; + case 2579: + HASH_RETURN(0x49FE8A438B3AEA13LL, k_SOCKET_ENOCSI, SOCKET_ENOCSI); + break; + case 2589: + HASH_RETURN(0x7031551D1992DA1DLL, k_T_AND_EQUAL, T_AND_EQUAL); + break; + case 2593: + HASH_RETURN(0x1844B2396F4B5A21LL, k_UCOL_CASE_FIRST, UCOL_CASE_FIRST); + HASH_RETURN(0x078FA8B3130A3A21LL, k_MYSQLI_NUM_FLAG, MYSQLI_NUM_FLAG); + break; + case 2594: + HASH_RETURN(0x16B09F6F7844CA22LL, k_T_DECLARE, T_DECLARE); + break; + case 2596: + HASH_RETURN(0x33F71F2542A1AA24LL, k_MW_MagentaChannel, MW_MagentaChannel); + break; + case 2597: + HASH_RETURN(0x37F650C462FB6A25LL, k_CASE_UPPER, CASE_UPPER); + HASH_RETURN(0x5867D2BA10A35A25LL, k_CURLE_FTP_WEIRD_PASV_REPLY, CURLE_FTP_WEIRD_PASV_REPLY); + break; + case 2598: + HASH_RETURN(0x17F6AA0F5B016A26LL, k_CURLE_FTP_CANT_GET_HOST, CURLE_FTP_CANT_GET_HOST); + HASH_RETURN(0x54C496DB399F5A26LL, k_MW_FileOpenFatalError, MW_FileOpenFatalError); + break; + case 2600: + HASH_RETURN(0x08752B0B4C8BDA28LL, k_MW_SetEvaluateOperator, MW_SetEvaluateOperator); + break; + case 2602: + HASH_RETURN(0x28B1D7177D375A2ALL, k_T_REQUIRE_ONCE, T_REQUIRE_ONCE); + break; + case 2610: + HASH_RETURN(0x17EB7B36C3461A32LL, k_DEBUG_LOG_COOKIE, DEBUG_LOG_COOKIE); + HASH_RETURN(0x0BC3EDF749800A32LL, k_U_INTERNAL_TRANSLITERATOR_ERROR, U_INTERNAL_TRANSLITERATOR_ERROR); + break; + case 2613: + HASH_RETURN(0x3FD744C685CF2A35LL, k_CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID); + break; + case 2614: + HASH_RETURN(0x573042051A86AA36LL, k_STREAM_IPPROTO_ICMP, STREAM_IPPROTO_ICMP); + break; + case 2624: + HASH_RETURN(0x17ABFE6A89CFAA40LL, k_MW_HWBColorspace, MW_HWBColorspace); + break; + case 2626: + HASH_RETURN(0x4136719D47DECA42LL, k_M_SQRT1_2, M_SQRT1_2); + break; + case 2630: + HASH_RETURN(0x023D40E0CE37CA46LL, k_CURLAUTH_ANY, CURLAUTH_ANY); + HASH_RETURN(0x194D91E998A0BA46LL, k_DEBUG_LOG_URL, DEBUG_LOG_URL); + break; + case 2631: + HASH_RETURN(0x5881C762E9C94A47LL, k_E_ALL, E_ALL); + HASH_RETURN(0x6AC5604FD3BB4A47LL, k_CURLOPT_TCP_NODELAY, CURLOPT_TCP_NODELAY); + break; + case 2635: + HASH_RETURN(0x61EB0F8F2CF2BA4BLL, k_FILE_SKIP_EMPTY_LINES, FILE_SKIP_EMPTY_LINES); + HASH_RETURN(0x10D2E7F92C0E2A4BLL, k_FNM_PERIOD, FNM_PERIOD); + HASH_RETURN(0x7D28B0E058FE9A4BLL, k_IMG_FILTER_EDGEDETECT, IMG_FILTER_EDGEDETECT); + break; + case 2636: + HASH_RETURN(0x489472AD364E8A4CLL, k_MON_12, MON_12); + break; + case 2639: + HASH_RETURN(0x7916DFA41D331A4FLL, k_T_CONCAT_EQUAL, T_CONCAT_EQUAL); + break; + case 2641: + HASH_RETURN(0x077795A7F9ADAA51LL, k_IMAGETYPE_JPEG2000, IMAGETYPE_JPEG2000); + break; + case 2643: + HASH_RETURN(0x5F65CE21F6EC4A53LL, k_CURL_NETRC_REQUIRED, CURL_NETRC_REQUIRED); + break; + case 2644: + HASH_RETURN(0x0EBD392ECED8EA54LL, k_XSD_TIME, XSD_TIME); + break; + case 2645: + HASH_RETURN(0x73CF2C0E7545EA55LL, k_CURLE_SEND_ERROR, CURLE_SEND_ERROR); + break; + case 2647: + HASH_RETURN(0x2B480ABF652F0A57LL, k_MCRYPT_MODE_CFB, MCRYPT_MODE_CFB); + HASH_RETURN(0x5505631AAA52EA57LL, k_PNG_FILTER_PAETH, PNG_FILTER_PAETH); + break; + case 2648: + HASH_RETURN(0x685DA73E469A4A58LL, k_CURLOPT_POSTFIELDS, CURLOPT_POSTFIELDS); + break; + case 2649: + HASH_RETURN(0x6DF3CC2C173F9A59LL, k_CURLCLOSEPOLICY_LEAST_RECENTLY_USED, CURLCLOSEPOLICY_LEAST_RECENTLY_USED); + break; + case 2650: + HASH_RETURN(0x758D2FB74B095A5ALL, k_E_NOTICE, E_NOTICE); + break; + case 2656: + HASH_RETURN(0x5CFB79F502A1DA60LL, k_STREAM_FILTER_WRITE, STREAM_FILTER_WRITE); + break; + case 2657: + HASH_RETURN(0x2A494FBEFC63FA61LL, k_MW_CopyOpacityCompositeOp, MW_CopyOpacityCompositeOp); + HASH_RETURN(0x5B2AB29E90099A61LL, k_MW_PartitionInterlace, MW_PartitionInterlace); + break; + case 2660: + HASH_RETURN(0x38D027CA435ADA64LL, k_CURLOPT_FAILONERROR, CURLOPT_FAILONERROR); + HASH_RETURN(0x04D429D84E820A64LL, k_MW_SaturateCompositeOp, MW_SaturateCompositeOp); + break; + case 2666: + HASH_RETURN(0x3D933CE31E2DCA6ALL, k_E_USER_NOTICE, E_USER_NOTICE); + break; + case 2667: + HASH_RETURN(0x36C5B40B7508CA6BLL, k_U_BRK_ERROR_LIMIT, U_BRK_ERROR_LIMIT); + break; + case 2668: + HASH_RETURN(0x58F580070B123A6CLL, k_U_REGEX_INVALID_STATE, U_REGEX_INVALID_STATE); + break; + case 2669: + HASH_RETURN(0x657A6417A5002A6DLL, k_CURLINFO_CONTENT_LENGTH_UPLOAD, CURLINFO_CONTENT_LENGTH_UPLOAD); + break; + case 2670: + HASH_RETURN(0x4394E36C5CE89A6ELL, k_SOCKET_EXFULL, SOCKET_EXFULL); + break; + case 2672: + HASH_RETURN(0x151C8E5474C7EA70LL, k_SO_SNDLOWAT, SO_SNDLOWAT); + break; + case 2678: + HASH_RETURN(0x0B9707ADC9A33A76LL, k_D_FMT, D_FMT); + break; + case 2679: + HASH_RETURN(0x65F32B0265C17A77LL, k_MCC_CONSISTENCY_MATCH_ALL, MCC_CONSISTENCY_MATCH_ALL); + HASH_RETURN(0x57B997B628A78A77LL, k_ENT_QUOTES, ENT_QUOTES); + break; + case 2684: + HASH_RETURN(0x586FAD022BC7EA7CLL, k_MW_OHTAColorspace, MW_OHTAColorspace); + break; + case 2685: + HASH_RETURN(0x5789DA2495F3DA7DLL, k_XML_ERROR_UNCLOSED_TOKEN, XML_ERROR_UNCLOSED_TOKEN); + HASH_RETURN(0x0A0A2A95E703CA7DLL, k_MW_DoublePixel, MW_DoublePixel); + HASH_RETURN(0x5DBA78A0C47AFA7DLL, k_MYSQLI_CLIENT_IGNORE_SPACE, MYSQLI_CLIENT_IGNORE_SPACE); + break; + case 2689: + HASH_RETURN(0x591B84D535EE0A81LL, k_LDAP_OPT_PROTOCOL_VERSION, LDAP_OPT_PROTOCOL_VERSION); + break; + case 2690: + HASH_RETURN(0x645290ED74C16A82LL, k_OCI_NUM, OCI_NUM); + break; + case 2694: + HASH_RETURN(0x27719595A3884A86LL, k_XML_CDATA_SECTION_NODE, XML_CDATA_SECTION_NODE); + HASH_RETURN(0x533FAB9E3D858A86LL, k_T_LNUMBER, T_LNUMBER); + break; + case 2697: + HASH_RETURN(0x00D18FD3D62C4A89LL, k_PHP_NORMAL_READ, PHP_NORMAL_READ); + break; + case 2698: + HASH_RETURN(0x01481CE9C0003A8ALL, k_M_PI, M_PI); + break; + case 2700: + HASH_RETURN(0x737B5DC9691FDA8CLL, k_ABDAY_4, ABDAY_4); + break; + case 2701: + HASH_RETURN(0x1526953193697A8DLL, k_MW_DissolveCompositeOp, MW_DissolveCompositeOp); + break; + case 2703: + HASH_RETURN(0x064FFC26A1BEDA8FLL, k_MCC_ACCESSPOINT_DOWN, MCC_ACCESSPOINT_DOWN); + HASH_RETURN(0x3159B21008945A8FLL, k_SIGXCPU, SIGXCPU); + break; + case 2704: + HASH_RETURN(0x493B826AE747AA90LL, k_MW_ExtraCondensedStretch, MW_ExtraCondensedStretch); + break; + case 2708: + HASH_RETURN(0x3D59A12AE8830A94LL, k_DAY_7, DAY_7); + break; + case 2713: + HASH_RETURN(0x110D06664602AA99LL, k_T_HALT_COMPILER, T_HALT_COMPILER); + break; + case 2715: + HASH_RETURN(0x3FC849E49A880A9BLL, k_CURLINFO_SIZE_UPLOAD, CURLINFO_SIZE_UPLOAD); + break; + case 2716: + HASH_RETURN(0x763DAA7C42CFFA9CLL, k_CURLOPT_HEADER, CURLOPT_HEADER); + break; + case 2717: + HASH_RETURN(0x31D2BDC616571A9DLL, k_LOG_ALERT, LOG_ALERT); + break; + case 2718: + HASH_RETURN(0x36199492D2ADDA9ELL, k_E_COMPILE_WARNING, E_COMPILE_WARNING); + break; + case 2721: + HASH_RETURN(0x570EC613A0EB4AA1LL, k_MW_UserSpaceOnUse, MW_UserSpaceOnUse); + HASH_RETURN(0x1300EC79A289FAA1LL, k_MYSQLI_NUM, MYSQLI_NUM); + break; + case 2722: + HASH_RETURN(0x7B548C7058D44AA2LL, k_CURLE_LDAP_CANNOT_BIND, CURLE_LDAP_CANNOT_BIND); + HASH_RETURN(0x3B8E3A3EC15C6AA2LL, k_T_SR_EQUAL, T_SR_EQUAL); + break; + case 2724: + HASH_RETURN(0x5FBA32870DE6EAA4LL, k_MCC_ARG_DGRAM_TMO_THRESHOLD, MCC_ARG_DGRAM_TMO_THRESHOLD); + break; + case 2727: + HASH_RETURN(0x4A454B32C8DAAAA7LL, k_MW_RaisePreview, MW_RaisePreview); + break; + case 2728: + HASH_RETURN(0x0734D69114274AA8LL, k_MW_MemoryResource, MW_MemoryResource); + HASH_RETURN(0x59638E3CD5839AA8LL, k_U_BRK_UNDEFINED_VARIABLE, U_BRK_UNDEFINED_VARIABLE); + break; + case 2738: + HASH_RETURN(0x5786857F38F31AB2LL, k_MW_GaussianFilter, MW_GaussianFilter); + break; + case 2739: + HASH_RETURN(0x06DABFEE92981AB3LL, k_T_STRING_VARNAME, T_STRING_VARNAME); + break; + case 2742: + HASH_RETURN(0x243D46B22559CAB6LL, k_T_UNSET_CAST, T_UNSET_CAST); + break; + case 2746: + HASH_RETURN(0x5CD5B603D9E47ABALL, k_T_XOR_EQUAL, T_XOR_EQUAL); + break; + case 2750: + HASH_RETURN(0x250B73392D416ABELL, k_SIGBUS, SIGBUS); + break; + case 2752: + HASH_RETURN(0x4024FAF61052EAC0LL, k_SOCKET_ENAMETOOLONG, SOCKET_ENAMETOOLONG); + break; + case 2756: + HASH_RETURN(0x53D181033B1DEAC4LL, k_OCI_FETCHSTATEMENT_BY_ROW, OCI_FETCHSTATEMENT_BY_ROW); + break; + case 2758: + HASH_RETURN(0x227C4DCCA5F7DAC6LL, k_MCC_PROXY_DELETE_OP, MCC_PROXY_DELETE_OP); + break; + case 2759: + HASH_RETURN(0x39C257B01459AAC7LL, k_MW_UndefinedPreview, MW_UndefinedPreview); + break; + case 2760: + HASH_RETURN(0x3BE2E003D0286AC8LL, k_T_STRING, T_STRING); + break; + case 2762: + HASH_RETURN(0x2261E9F887001ACALL, k_XML_OPTION_SKIP_WHITE, XML_OPTION_SKIP_WHITE); + break; + case 2764: + HASH_RETURN(0x65E829458F1ABACCLL, k_CURLINFO_HEADER_SIZE, CURLINFO_HEADER_SIZE); + break; + case 2767: + HASH_RETURN(0x0ABBF2E321C47ACFLL, k_XSD_LONG, XSD_LONG); + HASH_RETURN(0x51D3603A88FE4ACFLL, k_T_FINAL, T_FINAL); + break; + case 2768: + HASH_RETURN(0x3C891E4E5FACCAD0LL, k_CURLE_COULDNT_CONNECT, CURLE_COULDNT_CONNECT); + break; + case 2770: + HASH_RETURN(0x42CAB1030D846AD2LL, k_CURL_VERSION_KERBEROS4, CURL_VERSION_KERBEROS4); + break; + case 2772: + HASH_RETURN(0x5FAC392492F68AD4LL, k_OCI_B_CLOB, OCI_B_CLOB); + break; + case 2773: + HASH_RETURN(0x669D8411D2916AD5LL, k_MW_CyanChannel, MW_CyanChannel); + break; + case 2775: + HASH_RETURN(0x48978BD57A748AD7LL, k_MW_SemiExpandedStretch, MW_SemiExpandedStretch); + break; + case 2776: + HASH_RETURN(0x16B030F977458AD8LL, k_MYSQLI_OPT_CONNECT_TIMEOUT, MYSQLI_OPT_CONNECT_TIMEOUT); + break; + case 2777: + HASH_RETURN(0x2F04677BF407BAD9LL, k_MW_SouthWestGravity, MW_SouthWestGravity); + break; + case 2778: + HASH_RETURN(0x395E5D035821FADALL, k_PATHINFO_EXTENSION, PATHINFO_EXTENSION); + break; + case 2780: + HASH_RETURN(0x1612DDFB06F3DADCLL, k_MW_ResourceLimitFatalError, MW_ResourceLimitFatalError); + break; + case 2783: + HASH_RETURN(0x21CF90B2DC2A8ADFLL, k_SIGBABY, SIGBABY); + break; + case 2786: + HASH_RETURN(0x213E21AC19463AE2LL, k_MYSQLI_CLIENT_SSL, MYSQLI_CLIENT_SSL); + break; + case 2789: + HASH_RETURN(0x747D52041C337AE5LL, k_CURLE_HTTP_NOT_FOUND, CURLE_HTTP_NOT_FOUND); + break; + case 2790: + HASH_RETURN(0x7017D75A4FB1DAE6LL, k_CHAR_MAX, CHAR_MAX); + HASH_RETURN(0x2CB22777D6F90AE6LL, k_IMG_FILTER_GAUSSIAN_BLUR, IMG_FILTER_GAUSSIAN_BLUR); + break; + case 2794: + HASH_RETURN(0x3E4E56381DD9CAEALL, k_PHP_SYSCONFDIR, PHP_SYSCONFDIR); + HASH_RETURN(0x30CA3CAADE790AEALL, k_SOCKET_EL3HLT, SOCKET_EL3HLT); + break; + case 2797: + HASH_RETURN(0x0817F86FE6040AEDLL, k_CURLOPT_UPLOAD, CURLOPT_UPLOAD); + break; + case 2798: + HASH_RETURN(0x29CBD31CB5304AEELL, k_SOCKET_EINTR, SOCKET_EINTR); + break; + case 2801: + HASH_RETURN(0x3FF3A6F69EFC5AF1LL, k_PREG_SPLIT_DELIM_CAPTURE, PREG_SPLIT_DELIM_CAPTURE); + break; + case 2804: + HASH_RETURN(0x59BEA11F758FBAF4LL, k_UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_CANT_WRITE); + break; + case 2805: + HASH_RETURN(0x7D611D4AD51BEAF5LL, k_T_SL, T_SL); + break; + case 2806: + HASH_RETURN(0x3C7D2C061C055AF6LL, k_CURLOPT_CUSTOMREQUEST, CURLOPT_CUSTOMREQUEST); + break; + case 2809: + HASH_RETURN(0x432BB874244C0AF9LL, k_U_MISPLACED_QUANTIFIER, U_MISPLACED_QUANTIFIER); + HASH_RETURN(0x43D7CE6B2F128AF9LL, k_T_FOREACH, T_FOREACH); + break; + case 2810: + HASH_RETURN(0x090E65DB410A2AFALL, k_ABDAY_6, ABDAY_6); + break; + case 2812: + HASH_RETURN(0x7C0F0F955FB24AFCLL, k_MYSQLI_RPL_MASTER, MYSQLI_RPL_MASTER); + break; + case 2814: + HASH_RETURN(0x3B3164D5F14B0AFELL, k_MW_PoissonNoise, MW_PoissonNoise); + break; + case 2816: + HASH_RETURN(0x03F80B8F11796B00LL, k_MW_UndefinedJoin, MW_UndefinedJoin); + break; + case 2819: + HASH_RETURN(0x6B814172ADF42B03LL, k_STREAM_SOCK_STREAM, STREAM_SOCK_STREAM); + HASH_RETURN(0x485C9CE21EF4AB03LL, k_OPENSSL_CIPHER_RC2_128, OPENSSL_CIPHER_RC2_128); + HASH_RETURN(0x2F261F526F0E8B03LL, k_MW_CoderWarning, MW_CoderWarning); + break; + case 2821: + HASH_RETURN(0x2223E4DE90FDFB05LL, k_OPENSSL_PKCS1_PADDING, OPENSSL_PKCS1_PADDING); + HASH_RETURN(0x0F1752A0A272BB05LL, k_MW_UndefinedNoise, MW_UndefinedNoise); + break; + case 2822: + HASH_RETURN(0x68883FEECE26DB06LL, k_CURLINFO_SIZE_DOWNLOAD, CURLINFO_SIZE_DOWNLOAD); + break; + case 2823: + HASH_RETURN(0x5CE43D1FBD7DBB07LL, k_IMAGETYPE_WBMP, IMAGETYPE_WBMP); + break; + case 2827: + HASH_RETURN(0x4F66555E08C46B0BLL, k_XML_ERROR_INVALID_TOKEN, XML_ERROR_INVALID_TOKEN); + break; + case 2828: + HASH_RETURN(0x23C8582A7C489B0CLL, k_IMG_COLOR_STYLED, IMG_COLOR_STYLED); + break; + case 2830: + HASH_RETURN(0x2346CE3E090F0B0ELL, k_SOCKET_EADDRINUSE, SOCKET_EADDRINUSE); + break; + case 2833: + HASH_RETURN(0x12B1EE7C2A7A7B11LL, k_PREG_BAD_UTF8_ERROR, PREG_BAD_UTF8_ERROR); + break; + case 2834: + HASH_RETURN(0x21D14DFB8AC3FB12LL, k_XSD_NMTOKENS, XSD_NMTOKENS); + break; + case 2835: + HASH_RETURN(0x12BABEDC55D34B13LL, k_MW_SrcAtopCompositeOp, MW_SrcAtopCompositeOp); + break; + case 2837: + HASH_RETURN(0x0FF2E4D94DB80B15LL, k_CURLOPT_NOSIGNAL, CURLOPT_NOSIGNAL); + break; + case 2839: + HASH_RETURN(0x05A94136259A5B17LL, k_SOCK_SEQPACKET, SOCK_SEQPACKET); + break; + case 2840: + HASH_RETURN(0x15335D4DFCE06B18LL, k_PHP_VERSION, PHP_VERSION); + break; + case 2843: + HASH_RETURN(0x5A9BD51BEB73EB1BLL, k_LOG_LOCAL1, LOG_LOCAL1); + break; + case 2844: + HASH_RETURN(0x4FC95AF0868FAB1CLL, k_MW_TypeWarning, MW_TypeWarning); + break; + case 2847: + HASH_RETURN(0x01AA3EB3A6599B1FLL, k_CREDITS_DOCS, CREDITS_DOCS); + break; + case 2850: + HASH_RETURN(0x01C136E7190A9B22LL, k_CURLOPT_BUFFERSIZE, CURLOPT_BUFFERSIZE); + break; + case 2851: + HASH_RETURN(0x2CC2D4E376F8CB23LL, k_U_UNSUPPORTED_ESCAPE_SEQUENCE, U_UNSUPPORTED_ESCAPE_SEQUENCE); + HASH_RETURN(0x3581628C21904B23LL, k_MYSQLI_READ_DEFAULT_GROUP, MYSQLI_READ_DEFAULT_GROUP); + break; + case 2855: + HASH_RETURN(0x5E4EA34FE1613B27LL, k_SIGSTKFLT, SIGSTKFLT); + break; + case 2856: + HASH_RETURN(0x1E2930F6B647AB28LL, k_CURLE_LIBRARY_NOT_FOUND, CURLE_LIBRARY_NOT_FOUND); + HASH_RETURN(0x5E09BC123B163B28LL, k_CURLOPT_FTPSSLAUTH, CURLOPT_FTPSSLAUTH); + break; + case 2857: + HASH_RETURN(0x19ACF9E8988C8B29LL, k_U_UNCLOSED_SEGMENT, U_UNCLOSED_SEGMENT); + break; + case 2859: + HASH_RETURN(0x70501BEABC2A3B2BLL, k_DNS_ALL, DNS_ALL); + HASH_RETURN(0x22194156EDF82B2BLL, k_MW_CopyRedCompositeOp, MW_CopyRedCompositeOp); + break; + case 2861: + HASH_RETURN(0x76E82B282E60EB2DLL, k_MYSQLI_ASSOC, MYSQLI_ASSOC); + break; + case 2862: + HASH_RETURN(0x048479303F6C5B2ELL, k_CURLE_SHARE_IN_USE, CURLE_SHARE_IN_USE); + break; + case 2864: + HASH_RETURN(0x2F0D602554D3EB30LL, k_HTML_ENTITIES, HTML_ENTITIES); + break; + case 2869: + HASH_RETURN(0x3E26A2DFC61CAB35LL, k_SIGUSR1, SIGUSR1); + break; + case 2873: + HASH_RETURN(0x6609AB522524BB39LL, k_SIG_IGN, SIG_IGN); + break; + case 2878: + HASH_RETURN(0x71E04E7A276B4B3ELL, k_MW_UndefinedDispose, MW_UndefinedDispose); + break; + case 2886: + HASH_RETURN(0x22A6C64B7E48BB46LL, k_GLOB_ERR, GLOB_ERR); + HASH_RETURN(0x66F89A9794F8FB46LL, k_XSD_GYEARMONTH, XSD_GYEARMONTH); + break; + case 2887: + HASH_RETURN(0x51E3840B085F8B47LL, k_CONNECTION_NORMAL, CONNECTION_NORMAL); + break; + case 2888: + HASH_RETURN(0x33F5C95FD6B78B48LL, k_ASSERT_WARNING, ASSERT_WARNING); + HASH_RETURN(0x2D08DF3E17596B48LL, k_U_MISSING_RESOURCE_ERROR, U_MISSING_RESOURCE_ERROR); + break; + case 2889: + HASH_RETURN(0x3CDFE3901E48FB49LL, k_SORT_ASC, SORT_ASC); + break; + case 2892: + HASH_RETURN(0x3568BED9CAECEB4CLL, k_SO_RCVTIMEO, SO_RCVTIMEO); + break; + case 2893: + HASH_RETURN(0x0BCD197CA5A36B4DLL, k_MCC_UDP_REPLY_PORTS, MCC_UDP_REPLY_PORTS); + break; + case 2895: + HASH_RETURN(0x3963DD3F576AFB4FLL, k_MW_YUVColorspace, MW_YUVColorspace); + break; + case 2899: + HASH_RETURN(0x65E9A299C170CB53LL, k_SOAP_FUNCTIONS_ALL, SOAP_FUNCTIONS_ALL); + break; + case 2913: + HASH_RETURN(0x1DAAE34E32386B61LL, k_MYSQLI_TYPE_LONG_BLOB, MYSQLI_TYPE_LONG_BLOB); + break; + case 2914: + HASH_RETURN(0x24939CEFE32D9B62LL, k_T_DEC, T_DEC); + HASH_RETURN(0x523F7536F6CA2B62LL, k_MYSQLI_REPORT_INDEX, MYSQLI_REPORT_INDEX); + break; + case 2920: + HASH_RETURN(0x58DA784376103B68LL, k_MCC_IPPROTO_UDP, MCC_IPPROTO_UDP); + HASH_RETURN(0x627C8E2B6A50BB68LL, k_CURLOPT_AUTOREFERER, CURLOPT_AUTOREFERER); + break; + case 2922: + HASH_RETURN(0x08F569F34AE1EB6ALL, k_MW_NoneDispose, MW_NoneDispose); + HASH_RETURN(0x13B4E02756307B6ALL, k_INTL_MAX_LOCALE_LEN, INTL_MAX_LOCALE_LEN); + HASH_RETURN(0x7B91AB2B39EBDB6ALL, k_IDNA_ROUNDTRIP_VERIFY_ERROR, IDNA_ROUNDTRIP_VERIFY_ERROR); + break; + case 2924: + HASH_RETURN(0x064CC9EE44F30B6CLL, k_CURLOPT_NOPROGRESS, CURLOPT_NOPROGRESS); + break; + case 2928: + HASH_RETURN(0x7A9550961ACB1B70LL, k_MW_RGBColorspace, MW_RGBColorspace); + break; + case 2930: + HASH_RETURN(0x3CB308D00BF9FB72LL, k_FILE_NO_DEFAULT_CONTEXT, FILE_NO_DEFAULT_CONTEXT); + break; + case 2931: + HASH_RETURN(0x6023830227F5DB73LL, k_SOCKET_ENOPROTOOPT, SOCKET_ENOPROTOOPT); + HASH_RETURN(0x0E15F670C5A2FB73LL, k_CURL_HTTP_VERSION_NONE, CURL_HTTP_VERSION_NONE); + break; + case 2934: + HASH_RETURN(0x491B077D1071CB76LL, k_DOM_NAMESPACE_ERR, DOM_NAMESPACE_ERR); + HASH_RETURN(0x605BC5C3D5ADBB76LL, k_STREAM_SOCK_RDM, STREAM_SOCK_RDM); + HASH_RETURN(0x2473D2AA56054B76LL, k_MW_DiskResource, MW_DiskResource); + HASH_RETURN(0x522026106E095B76LL, k_POSIX_S_IFSOCK, POSIX_S_IFSOCK); + break; + case 2936: + HASH_RETURN(0x7FAFCF53408B9B78LL, k_SOCKET_EALREADY, SOCKET_EALREADY); + break; + case 2938: + HASH_RETURN(0x5087417BEA969B7ALL, k_PHP_EOL, PHP_EOL); + break; + case 2943: + HASH_RETURN(0x5D2BFD8D2FECDB7FLL, k_U_REGEX_RULE_SYNTAX, U_REGEX_RULE_SYNTAX); + break; + case 2944: + HASH_RETURN(0x3BB0B57F8682CB80LL, k_IDNA_CONTAINS_MINUS, IDNA_CONTAINS_MINUS); + break; + case 2949: + HASH_RETURN(0x3227F28B41DA6B85LL, k_U_UNMATCHED_BRACES, U_UNMATCHED_BRACES); + break; + case 2950: + HASH_RETURN(0x0B464E1C6B23FB86LL, k_SIGPOLL, SIGPOLL); + break; + case 2954: + HASH_RETURN(0x6665F8685D0F5B8ALL, k_MW_ThresholdPreview, MW_ThresholdPreview); + HASH_RETURN(0x44B0662C4463AB8ALL, k_T_ABSTRACT, T_ABSTRACT); + break; + case 2955: + HASH_RETURN(0x3A144CB9C9FF8B8BLL, k_UCOL_DEFAULT, UCOL_DEFAULT); + HASH_RETURN(0x3C95B36362763B8BLL, k_U_MALFORMED_RULE, U_MALFORMED_RULE); + break; + case 2960: + HASH_RETURN(0x303C6529961DCB90LL, k_DOM_NO_DATA_ALLOWED_ERR, DOM_NO_DATA_ALLOWED_ERR); + break; + case 2965: + HASH_RETURN(0x01A5C7D3692BCB95LL, k_LOG_AUTH, LOG_AUTH); + break; + case 2968: + HASH_RETURN(0x29273CCEB2874B98LL, k_MW_SquareCap, MW_SquareCap); + break; + case 2975: + HASH_RETURN(0x325C39166457BB9FLL, k_OPENSSL_KEYTYPE_DH, OPENSSL_KEYTYPE_DH); + break; + case 2976: + HASH_RETURN(0x5732EA54F38E4BA0LL, k_U_TOO_MANY_ALIASES_ERROR, U_TOO_MANY_ALIASES_ERROR); + break; + case 2981: + HASH_RETURN(0x4D374FF8068ADBA5LL, k_STREAM_NOTIFY_SEVERITY_ERR, STREAM_NOTIFY_SEVERITY_ERR); + break; + case 2986: + HASH_RETURN(0x6B0E9748AE8C6BAALL, k_SOCKET_ENOSPC, SOCKET_ENOSPC); + break; + case 2988: + HASH_RETURN(0x682A5ECD075BEBACLL, k_DOM_INVALID_STATE_ERR, DOM_INVALID_STATE_ERR); + break; + case 2989: + HASH_RETURN(0x116B1814FD193BADLL, k_MCRYPT_MARS, MCRYPT_MARS); + break; + case 2995: + HASH_RETURN(0x079A74C67C1CDBB3LL, k_MW_SpiffPreview, MW_SpiffPreview); + break; + case 2999: + HASH_RETURN(0x726E6E34464C5BB7LL, k_STREAM_CRYPTO_METHOD_SSLv2_SERVER, STREAM_CRYPTO_METHOD_SSLv2_SERVER); + break; + case 3001: + HASH_RETURN(0x1598130294EACBB9LL, k_SO_REUSEADDR, SO_REUSEADDR); + HASH_RETURN(0x3EE67FB2D681BBB9LL, k_MW_UndefinedIntent, MW_UndefinedIntent); + HASH_RETURN(0x29456DEFF9CB3BB9LL, k_U_USING_DEFAULT_WARNING, U_USING_DEFAULT_WARNING); + break; + case 3004: + HASH_RETURN(0x2334BC1C55ED5BBCLL, k_SQLITE3_BOTH, SQLITE3_BOTH); + break; + case 3005: + HASH_RETURN(0x29AA6D95C1253BBDLL, k_CURLE_FTP_WEIRD_SERVER_REPLY, CURLE_FTP_WEIRD_SERVER_REPLY); + break; + case 3007: + HASH_RETURN(0x72C0097961952BBFLL, k_MW_MinEvaluateOperator, MW_MinEvaluateOperator); + break; + case 3014: + HASH_RETURN(0x5411D311A7C46BC6LL, k_MW_DelegateWarning, MW_DelegateWarning); + break; + case 3019: + HASH_RETURN(0x71172CC6A9F41BCBLL, k_MW_PreviousDispose, MW_PreviousDispose); + break; + case 3022: + HASH_RETURN(0x16FB28F675159BCELL, k_SIGURG, SIGURG); + break; + case 3023: + HASH_RETURN(0x1E2C8DBE2F010BCFLL, k_E_RECOVERABLE_ERROR, E_RECOVERABLE_ERROR); + break; + case 3026: + HASH_RETURN(0x0CABD2A60862DBD2LL, k_CRYPT_MD5, CRYPT_MD5); + HASH_RETURN(0x36E76C0B0C6EBBD2LL, k_SO_KEEPALIVE, SO_KEEPALIVE); + HASH_RETURN(0x4D8A388BF1F30BD2LL, k_T_IS_NOT_EQUAL, T_IS_NOT_EQUAL); + break; + case 3028: + HASH_RETURN(0x118AA57D63D82BD4LL, k_MW_WavePreview, MW_WavePreview); + break; + case 3034: + HASH_RETURN(0x664B7B3263EAABDALL, k_OCI_B_CURSOR, OCI_B_CURSOR); + break; + case 3035: + HASH_RETURN(0x40DE6D41066BBBDBLL, k_MYSQLI_USE_RESULT, MYSQLI_USE_RESULT); + break; + case 3041: + HASH_RETURN(0x206C8DC6C063DBE1LL, k_U_INVALID_FORMAT_ERROR, U_INVALID_FORMAT_ERROR); + break; + case 3042: + HASH_RETURN(0x6DDCFF21FBFF3BE2LL, k_STREAM_NOTIFY_AUTH_RESULT, STREAM_NOTIFY_AUTH_RESULT); + HASH_RETURN(0x4E5376497D7CDBE2LL, k_MON_9, MON_9); + break; + case 3044: + HASH_RETURN(0x3E9580F4B357BBE4LL, k_CURLOPT_RANGE, CURLOPT_RANGE); + break; + case 3051: + HASH_RETURN(0x657F154126B10BEBLL, k_MCRYPT_RC2, MCRYPT_RC2); + break; + case 3052: + HASH_RETURN(0x2DADD85D33375BECLL, k_STREAM_CRYPTO_METHOD_TLS_CLIENT, STREAM_CRYPTO_METHOD_TLS_CLIENT); + HASH_RETURN(0x4C497A200FF16BECLL, k_MW_BlendCompositeOp, MW_BlendCompositeOp); + break; + case 3053: + HASH_RETURN(0x7B30143FB470ABEDLL, k_XSD_INT, XSD_INT); + break; + case 3058: + HASH_RETURN(0x71D83C5B79CB0BF2LL, k_IMG_PNG, IMG_PNG); + break; + case 3061: + HASH_RETURN(0x42FC7F5C971F9BF5LL, k_CREDITS_QA, CREDITS_QA); + break; + case 3065: + HASH_RETURN(0x777C72E84F08DBF9LL, k_MW_OverlayCompositeOp, MW_OverlayCompositeOp); + break; + case 3067: + HASH_RETURN(0x360CF202A3146BFBLL, k_M_SQRT2, M_SQRT2); + HASH_RETURN(0x2C3E020267942BFBLL, k_MW_NoCompositeOp, MW_NoCompositeOp); + break; + case 3069: + HASH_RETURN(0x120DBE17F1A54BFDLL, k_U_ERROR_WARNING_LIMIT, U_ERROR_WARNING_LIMIT); + HASH_RETURN(0x0FA29672A08F0BFDLL, k_U_BRK_NEW_LINE_IN_QUOTED_STRING, U_BRK_NEW_LINE_IN_QUOTED_STRING); + break; + case 3071: + HASH_RETURN(0x2FAE93A5FD06FBFFLL, k_SOCKET_ENOTCONN, SOCKET_ENOTCONN); + break; + case 3072: + HASH_RETURN(0x70D579B8ABBA5C00LL, k_PSFS_FLAG_FLUSH_INC, PSFS_FLAG_FLUSH_INC); + HASH_RETURN(0x6A94EEA7BCA66C00LL, k_U_BRK_VARIABLE_REDFINITION, U_BRK_VARIABLE_REDFINITION); + break; + case 3073: + HASH_RETURN(0x7F910373E8737C01LL, k_SOAP_ACTOR_NEXT, SOAP_ACTOR_NEXT); + break; + case 3075: + HASH_RETURN(0x4C4B984669440C03LL, k_XSD_TOKEN, XSD_TOKEN); + break; + case 3076: + HASH_RETURN(0x282EDE6A40070C04LL, k_M_1_PI, M_1_PI); + break; + case 3086: + HASH_RETURN(0x73DF2AF6843F6C0ELL, k_T_PROTECTED, T_PROTECTED); + break; + case 3093: + HASH_RETURN(0x7B2ED86FFBE5AC15LL, k_LDAP_DEREF_NEVER, LDAP_DEREF_NEVER); + break; + case 3095: + HASH_RETURN(0x1B94C21395D78C17LL, k_DOM_INVALID_CHARACTER_ERR, DOM_INVALID_CHARACTER_ERR); + break; + case 3101: + HASH_RETURN(0x138E588009796C1DLL, k_DOM_PHP_ERR, DOM_PHP_ERR); + break; + case 3102: + HASH_RETURN(0x6DA461D92D8E5C1ELL, k_PREG_INTERNAL_ERROR, PREG_INTERNAL_ERROR); + break; + case 3106: + HASH_RETURN(0x690C9024AD43DC22LL, k_MON_10, MON_10); + break; + case 3109: + HASH_RETURN(0x0BF33EEC8E51CC25LL, k_MYSQLI_TYPE_CHAR, MYSQLI_TYPE_CHAR); + break; + case 3112: + HASH_RETURN(0x49189CACCCEFBC28LL, k_MW_CenterGravity, MW_CenterGravity); + break; + case 3113: + HASH_RETURN(0x40F9D27309E99C29LL, k_SOCKET_ENETRESET, SOCKET_ENETRESET); + break; + case 3114: + HASH_RETURN(0x0E502C4A7888EC2ALL, k_POSIX_F_OK, POSIX_F_OK); + break; + case 3115: + HASH_RETURN(0x0C73D2781467FC2BLL, k_MCRYPT_MODE_STREAM, MCRYPT_MODE_STREAM); + HASH_RETURN(0x1CBE3A117AC26C2BLL, k_CURLOPT_TIMEVALUE, CURLOPT_TIMEVALUE); + break; + case 3116: + HASH_RETURN(0x7FA172362B399C2CLL, k_MCC_DELETE_ERROR_NOLOG, MCC_DELETE_ERROR_NOLOG); + break; + case 3119: + HASH_RETURN(0x4C8E188D58C10C2FLL, k_XML_ATTRIBUTE_IDREFS, XML_ATTRIBUTE_IDREFS); + break; + case 3120: + HASH_RETURN(0x0F3E316670BDCC30LL, k_MW_NoCompression, MW_NoCompression); + break; + case 3122: + HASH_RETURN(0x20344610C4004C32LL, k_STREAM_CLIENT_CONNECT, STREAM_CLIENT_CONNECT); + break; + case 3123: + HASH_RETURN(0x0B46DA3528C87C33LL, k_CURLOPT_SSLCERTPASSWD, CURLOPT_SSLCERTPASSWD); + break; + case 3125: + HASH_RETURN(0x77A389D7783DBC35LL, k_T_FUNCTION, T_FUNCTION); + break; + case 3127: + HASH_RETURN(0x23417ECCF281AC37LL, k_MCC_COMPRESSION_THRESHHOLD, MCC_COMPRESSION_THRESHHOLD); + break; + case 3128: + HASH_RETURN(0x44312215697EBC38LL, k_MCRYPT_MODE_CBC, MCRYPT_MODE_CBC); + break; + case 3129: + HASH_RETURN(0x6A3BA61C9FA5EC39LL, k_XML_ERROR_RECURSIVE_ENTITY_REF, XML_ERROR_RECURSIVE_ENTITY_REF); + break; + case 3139: + HASH_RETURN(0x4BB65A9DFEFC8C43LL, k_DNS_SRV, DNS_SRV); + HASH_RETURN(0x51F387821BA42C43LL, k_MSG_NOERROR, MSG_NOERROR); + break; + case 3141: + HASH_RETURN(0x2A36DD3AB4042C45LL, k_SIGPWR, SIGPWR); + break; + case 3142: + HASH_RETURN(0x73D9078E79E39C46LL, k_STREAM_CRYPTO_METHOD_SSLv3_CLIENT, STREAM_CRYPTO_METHOD_SSLv3_CLIENT); + HASH_RETURN(0x46BB95B496C1BC46LL, k_WSDL_CACHE_NONE, WSDL_CACHE_NONE); + HASH_RETURN(0x248265C110F0EC46LL, k_U_ENUM_OUT_OF_SYNC_ERROR, U_ENUM_OUT_OF_SYNC_ERROR); + break; + case 3145: + HASH_RETURN(0x26A39406E1871C49LL, k_CURLE_FTP_WEIRD_227_FORMAT, CURLE_FTP_WEIRD_227_FORMAT); + break; + case 3147: + HASH_RETURN(0x4C6391DC0DF45C4BLL, k_NAN, NAN); + break; + case 3153: + HASH_RETURN(0x1A272A79DEEA7C51LL, k_MW_TransparentColorspace, MW_TransparentColorspace); + break; + case 3157: + HASH_RETURN(0x2EF4675A93480C55LL, k_CURLOPT_WRITEHEADER, CURLOPT_WRITEHEADER); + break; + case 3158: + HASH_RETURN(0x439AE53819511C56LL, k_MW_LeftShiftEvaluateOperator, MW_LeftShiftEvaluateOperator); + break; + case 3163: + HASH_RETURN(0x64160F288165BC5BLL, k_MW_LaplacianNoise, MW_LaplacianNoise); + break; + case 3165: + HASH_RETURN(0x593156CEAB253C5DLL, k_OPENSSL_CIPHER_RC2_64, OPENSSL_CIPHER_RC2_64); + break; + case 3166: + HASH_RETURN(0x71957B0797970C5ELL, k_GD_EXTRA_VERSION, GD_EXTRA_VERSION); + break; + case 3167: + HASH_RETURN(0x4F8A200B3EE7DC5FLL, k_MW_UndefinedGravity, MW_UndefinedGravity); + HASH_RETURN(0x4547A8440E5F1C5FLL, k_T_NUM_STRING, T_NUM_STRING); + HASH_RETURN(0x3E963DD47ED5CC5FLL, k_SIGSTOP, SIGSTOP); + break; + case 3168: + HASH_RETURN(0x646C74912C780C60LL, k_CURLOPT_READDATA, CURLOPT_READDATA); + HASH_RETURN(0x5C90CD4295711C60LL, k_MW_NoInterlace, MW_NoInterlace); + break; + case 3171: + HASH_RETURN(0x3706DD6220C99C63LL, k_XML_ENTITY_REF_NODE, XML_ENTITY_REF_NODE); + HASH_RETURN(0x489418E1FFFFCC63LL, k_MW_RoundCap, MW_RoundCap); + break; + case 3174: + HASH_RETURN(0x52DD8CA209326C66LL, k_XML_ATTRIBUTE_NMTOKEN, XML_ATTRIBUTE_NMTOKEN); + break; + case 3184: + HASH_RETURN(0x02DE0CD2B0DFBC70LL, k_ABDAY_1, ABDAY_1); + break; + case 3186: + HASH_RETURN(0x4D52E901652F0C72LL, k_SO_RCVBUF, SO_RCVBUF); + break; + case 3187: + HASH_RETURN(0x1A54DB9FB8AC9C73LL, k_LIBXML_ERR_ERROR, LIBXML_ERR_ERROR); + HASH_RETURN(0x7005290DD5515C73LL, k_OCI_LOB_BUFFER_FREE, OCI_LOB_BUFFER_FREE); + break; + case 3188: + HASH_RETURN(0x2752CDFC38AD3C74LL, k_CURLINFO_NAMELOOKUP_TIME, CURLINFO_NAMELOOKUP_TIME); + HASH_RETURN(0x132C522537683C74LL, k_MW_sRGBColorspace, MW_sRGBColorspace); + break; + case 3192: + HASH_RETURN(0x3969AE373E567C78LL, k_DNS_NS, DNS_NS); + break; + case 3195: + HASH_RETURN(0x009CB349B875BC7BLL, k_SOCKET_ELNRNG, SOCKET_ELNRNG); + break; + case 3208: + HASH_RETURN(0x7BC051800FB96C88LL, k_SOCKET_ETOOMANYREFS, SOCKET_ETOOMANYREFS); + break; + case 3214: + HASH_RETURN(0x385190CEB9B1FC8ELL, k_U_MULTIPLE_PAD_SPECIFIERS, U_MULTIPLE_PAD_SPECIFIERS); + break; + case 3215: + HASH_RETURN(0x5F1CAF039934BC8FLL, k_MW_UndefinedMode, MW_UndefinedMode); + break; + case 3217: + HASH_RETURN(0x6AB1BF19D5A03C91LL, k_U_USELESS_COLLATOR_ERROR, U_USELESS_COLLATOR_ERROR); + HASH_RETURN(0x7935065FD925CC91LL, k_T_DEFAULT, T_DEFAULT); + break; + case 3219: + HASH_RETURN(0x0D81BCC2FA730C93LL, k_LOG_PERROR, LOG_PERROR); + break; + case 3220: + HASH_RETURN(0x1E00F62826A05C94LL, k_DOM_INVALID_ACCESS_ERR, DOM_INVALID_ACCESS_ERR); + HASH_RETURN(0x60DD6AA63E8EFC94LL, k_LOG_CONS, LOG_CONS); + HASH_RETURN(0x5085A057EC380C94LL, k_SQLT_CLOB, SQLT_CLOB); + HASH_RETURN(0x4D4024238FAB3C94LL, k_MYSQLI_REPORT_ALL, MYSQLI_REPORT_ALL); + break; + case 3221: + HASH_RETURN(0x1D346642999A5C95LL, k_SQLT_LVC, SQLT_LVC); + break; + case 3223: + HASH_RETURN(0x0C2057F071B77C97LL, k_MW_ObjectBoundingBox, MW_ObjectBoundingBox); + break; + case 3225: + HASH_RETURN(0x083F3192D8830C99LL, k_MW_UserSpace, MW_UserSpace); + break; + case 3226: + HASH_RETURN(0x0DF09036B9385C9ALL, k_MCRYPT_RIJNDAEL_192, MCRYPT_RIJNDAEL_192); + break; + case 3229: + HASH_RETURN(0x6F4EE56705510C9DLL, k_MW_BlackChannel, MW_BlackChannel); + break; + case 3231: + HASH_RETURN(0x1F4DE6C405ADBC9FLL, k_LDAP_OPT_SERVER_CONTROLS, LDAP_OPT_SERVER_CONTROLS); + break; + case 3232: + HASH_RETURN(0x6C3F56D5C0CFCCA0LL, k_PHP_CONFIG_FILE_PATH, PHP_CONFIG_FILE_PATH); + break; + case 3234: + HASH_RETURN(0x0D675D880BDE7CA2LL, k_T_PLUS_EQUAL, T_PLUS_EQUAL); + HASH_RETURN(0x2DFED526B1931CA2LL, k_T_STATIC, T_STATIC); + break; + case 3238: + HASH_RETURN(0x6228DEB87CDFFCA6LL, k_M_2_PI, M_2_PI); + HASH_RETURN(0x7F5833E1598FFCA6LL, k_STREAM_PF_INET, STREAM_PF_INET); + break; + case 3239: + HASH_RETURN(0x46726135D0036CA7LL, k_ABMON_7, ABMON_7); + break; + case 3241: + HASH_RETURN(0x2C8197262EF5FCA9LL, k_MYSQLI_SET_FLAG, MYSQLI_SET_FLAG); + break; + case 3242: + HASH_RETURN(0x49694C9BD88D7CAALL, k_SOCKET_EEXIST, SOCKET_EEXIST); + break; + case 3245: + HASH_RETURN(0x43B60680D1FFACADLL, k_SOCKET_EIO, SOCKET_EIO); + HASH_RETURN(0x4CCC408F995DDCADLL, k_MW_TrueColorMatteType, MW_TrueColorMatteType); + break; + case 3248: + HASH_RETURN(0x110A57D331619CB0LL, k_MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_TINY_BLOB); + break; + case 3252: + HASH_RETURN(0x13594B79B76FDCB4LL, k_LOG_ERR, LOG_ERR); + break; + case 3253: + HASH_RETURN(0x5817D9152083CCB5LL, k_MSG_DONTROUTE, MSG_DONTROUTE); + HASH_RETURN(0x118AB611B2125CB5LL, k_CURLE_FTP_COULDNT_STOR_FILE, CURLE_FTP_COULDNT_STOR_FILE); + break; + case 3254: + HASH_RETURN(0x0A7BA8A0028B5CB6LL, k_DNS_TXT, DNS_TXT); + HASH_RETURN(0x47B7A7F80ED1ECB6LL, k_T_DOLLAR_OPEN_CURLY_BRACES, T_DOLLAR_OPEN_CURLY_BRACES); + break; + case 3255: + HASH_RETURN(0x3B18031C93653CB7LL, k_T_METHOD_C, T_METHOD_C); + break; + case 3257: + HASH_RETURN(0x31E92A1C48B2DCB9LL, k_MCC_ARG_TCP_INACTIVITY_TIME, MCC_ARG_TCP_INACTIVITY_TIME); + HASH_RETURN(0x195553BD6A1ABCB9LL, k_M_EULER, M_EULER); + break; + case 3259: + HASH_RETURN(0x7B35C51C1ABEACBBLL, k_SO_SNDBUF, SO_SNDBUF); + break; + case 3262: + HASH_RETURN(0x311BD761A68ADCBELL, k_SO_DEBUG, SO_DEBUG); + HASH_RETURN(0x5B2078AE29DC1CBELL, k_MW_OptionWarning, MW_OptionWarning); + break; + case 3263: + HASH_RETURN(0x0D0FECB6CE117CBFLL, k_SQLT_UIN, SQLT_UIN); + break; + case 3268: + HASH_RETURN(0x555120EDDEE03CC4LL, k_SIGUSR2, SIGUSR2); + break; + case 3269: + HASH_RETURN(0x0862E2079CBE2CC5LL, k_XML_OPTION_SKIP_TAGSTART, XML_OPTION_SKIP_TAGSTART); + break; + case 3273: + HASH_RETURN(0x1156FE16CF6B4CC9LL, k_MCC_HAVE_ZLIB_COMPRESSION, MCC_HAVE_ZLIB_COMPRESSION); + break; + case 3274: + HASH_RETURN(0x1E5A85ABB162BCCALL, k_PNG_FILTER_AVG, PNG_FILTER_AVG); + break; + case 3276: + HASH_RETURN(0x632EC42BD663DCCCLL, k_MW_UndefinedEvaluateOperator, MW_UndefinedEvaluateOperator); + break; + case 3284: + HASH_RETURN(0x2EE3255D26095CD4LL, k_IMAGETYPE_XBM, IMAGETYPE_XBM); + break; + case 3289: + HASH_RETURN(0x483D3E900AA2BCD9LL, k_MB_OVERLOAD_MAIL, MB_OVERLOAD_MAIL); + HASH_RETURN(0x50D40BBF21B47CD9LL, k_T_INSTANCEOF, T_INSTANCEOF); + break; + case 3292: + HASH_RETURN(0x5700A180906B6CDCLL, k_LOCK_NB, LOCK_NB); + break; + case 3298: + HASH_RETURN(0x31234F1ED95BBCE2LL, k_MW_DelegateFatalError, MW_DelegateFatalError); + break; + case 3300: + HASH_RETURN(0x2F8DC4C719BE7CE4LL, k_MW_ConfigureWarning, MW_ConfigureWarning); + HASH_RETURN(0x43B1B2B997732CE4LL, k_T_INTERFACE, T_INTERFACE); + break; + case 3306: + HASH_RETURN(0x79B69C2399224CEALL, k_XSD_NMTOKEN, XSD_NMTOKEN); + break; + case 3310: + HASH_RETURN(0x3078202CA3F8DCEELL, k_TRUE, TRUE); + HASH_RETURN(0x61AC0A0A051D2CEELL, k_OCI_B_ROWID, OCI_B_ROWID); + break; + case 3312: + HASH_RETURN(0x4BF4993DFA04CCF0LL, k_SIGXFSZ, SIGXFSZ); + break; + case 3313: + HASH_RETURN(0x7F8704DDF2420CF1LL, k_U_REGEX_MISMATCHED_PAREN, U_REGEX_MISMATCHED_PAREN); + break; + case 3317: + HASH_RETURN(0x3F5BB76AB1C23CF5LL, k_CURLPROXY_SOCKS5, CURLPROXY_SOCKS5); + HASH_RETURN(0x58874FBEB6023CF5LL, k_CURLM_OUT_OF_MEMORY, CURLM_OUT_OF_MEMORY); + break; + case 3318: + HASH_RETURN(0x056A3CBE2AAE5CF6LL, k_T_IS_EQUAL, T_IS_EQUAL); + break; + case 3319: + HASH_RETURN(0x5EB4230441ED3CF7LL, k_PRIO_PROCESS, PRIO_PROCESS); + break; + case 3324: + HASH_RETURN(0x016F9B334DA96CFCLL, k_U_BUFFER_OVERFLOW_ERROR, U_BUFFER_OVERFLOW_ERROR); + break; + case 3328: + HASH_RETURN(0x2EA99771426CCD00LL, k_DNS_ANY, DNS_ANY); + HASH_RETURN(0x32A885245D6B1D00LL, k_MW_OrEvaluateOperator, MW_OrEvaluateOperator); + HASH_RETURN(0x789DD1AE1BD63D00LL, k_SIGKILL, SIGKILL); + break; + case 3329: + HASH_RETURN(0x594C523F41517D01LL, k_GLOB_MARK, GLOB_MARK); + break; + case 3331: + HASH_RETURN(0x38E61A1156C63D03LL, k_U_UNDEFINED_VARIABLE, U_UNDEFINED_VARIABLE); + break; + case 3333: + HASH_RETURN(0x3EE9DDA712FCAD05LL, k_UCOL_HIRAGANA_QUATERNARY_MODE, UCOL_HIRAGANA_QUATERNARY_MODE); + HASH_RETURN(0x497D5C4B2BA0DD05LL, k_MW_CondensedStretch, MW_CondensedStretch); + break; + case 3334: + HASH_RETURN(0x5DD63F178B2C8D06LL, k_PREG_SPLIT_OFFSET_CAPTURE, PREG_SPLIT_OFFSET_CAPTURE); + break; + case 3335: + HASH_RETURN(0x080AB4323664AD07LL, k_MW_BevelJoin, MW_BevelJoin); + break; + case 3336: + HASH_RETURN(0x7E214588295A5D08LL, k_STREAM_NOTIFY_RESOLVE, STREAM_NOTIFY_RESOLVE); + break; + case 3346: + HASH_RETURN(0x14047D2D0AE2DD12LL, k_XSD_ANYTYPE, XSD_ANYTYPE); + HASH_RETURN(0x19446B6AFA2B9D12LL, k_MW_UltraExpandedStretch, MW_UltraExpandedStretch); + break; + case 3359: + HASH_RETURN(0x689BD4E0DF9C4D1FLL, k_STREAM_OOB, STREAM_OOB); + break; + case 3361: + HASH_RETURN(0x65FEA52F2D59AD21LL, k_PHP_OUTPUT_HANDLER_END, PHP_OUTPUT_HANDLER_END); + break; + case 3364: + HASH_RETURN(0x19CB6B67ACA52D24LL, k_CURLAUTH_ANYSAFE, CURLAUTH_ANYSAFE); + break; + case 3365: + HASH_RETURN(0x65F5B238B76ECD25LL, k_MW_OptionFatalError, MW_OptionFatalError); + break; + case 3367: + HASH_RETURN(0x4EB7CAE7EFFCED27LL, k_INFO_CONFIGURATION, INFO_CONFIGURATION); + break; + case 3368: + HASH_RETURN(0x286787B5B66B2D28LL, k_INI_ALL, INI_ALL); + break; + case 3374: + HASH_RETURN(0x4F890C74E2E7ED2ELL, k_MON_7, MON_7); + break; + case 3381: + HASH_RETURN(0x1FA8779B873BDD35LL, k_SO_BROADCAST, SO_BROADCAST); + HASH_RETURN(0x09EAE0131A9CCD35LL, k_MCRYPT_SAFER128, MCRYPT_SAFER128); + HASH_RETURN(0x50E0B002A434DD35LL, k_CURLOPT_SSL_CIPHER_LIST, CURLOPT_SSL_CIPHER_LIST); + break; + case 3382: + HASH_RETURN(0x1A9C7ECBABDC7D36LL, k_ERA_D_FMT, ERA_D_FMT); + break; + case 3383: + HASH_RETURN(0x07824AA94D409D37LL, k_LIBXML_DOTTED_VERSION, LIBXML_DOTTED_VERSION); + break; + case 3384: + HASH_RETURN(0x3F3077DA2F37ED38LL, k_XSD_UNSIGNEDLONG, XSD_UNSIGNEDLONG); + HASH_RETURN(0x4CCAAFCF17C91D38LL, k_MCRYPT_CAST_128, MCRYPT_CAST_128); + break; + case 3385: + HASH_RETURN(0x3953428C65BEED39LL, k_STREAM_SHUT_RDWR, STREAM_SHUT_RDWR); + break; + case 3387: + HASH_RETURN(0x29D809A5176A1D3BLL, k_MW_CubicFilter, MW_CubicFilter); + break; + case 3390: + HASH_RETURN(0x425EDA14F9F82D3ELL, k_MSG_EOF, MSG_EOF); + break; + case 3398: + HASH_RETURN(0x4A93491A9D5A3D46LL, k_U_MULTIPLE_DECIMAL_SEPARATORS, U_MULTIPLE_DECIMAL_SEPARATORS); + break; + case 3399: + HASH_RETURN(0x045A3851B7EC4D47LL, k_CURLE_LDAP_INVALID_URL, CURLE_LDAP_INVALID_URL); + HASH_RETURN(0x6B749260EFE3DD47LL, k_MW_TileVirtualPixelMethod, MW_TileVirtualPixelMethod); + break; + case 3402: + HASH_RETURN(0x6AD8E8C54E36BD4ALL, k_XSD_DOUBLE, XSD_DOUBLE); + HASH_RETURN(0x6A8FE321DA080D4ALL, k_CURLE_FTP_QUOTE_ERROR, CURLE_FTP_QUOTE_ERROR); + break; + case 3407: + HASH_RETURN(0x575B196147E3ED4FLL, k_STREAM_USE_PATH, STREAM_USE_PATH); + break; + case 3408: + HASH_RETURN(0x5E2231652664BD50LL, k_U_MALFORMED_EXPONENTIAL_PATTERN, U_MALFORMED_EXPONENTIAL_PATTERN); + HASH_RETURN(0x75A66974FDF56D50LL, k_POSIX_S_IFCHR, POSIX_S_IFCHR); + break; + case 3411: + HASH_RETURN(0x62E0A16FE1AB4D53LL, k_T_OBJECT_CAST, T_OBJECT_CAST); + break; + case 3413: + HASH_RETURN(0x4AA98DC874A74D55LL, k_LOG_KERN, LOG_KERN); + break; + case 3415: + HASH_RETURN(0x2BF259577D2BFD57LL, k_XML_ERROR_PARAM_ENTITY_REF, XML_ERROR_PARAM_ENTITY_REF); + break; + case 3417: + HASH_RETURN(0x671B68F7A43F8D59LL, k_MYSQLI_TIMESTAMP_FLAG, MYSQLI_TIMESTAMP_FLAG); + break; + case 3420: + HASH_RETURN(0x0EBFC8C032948D5CLL, k_SOCKET_ENETDOWN, SOCKET_ENETDOWN); + HASH_RETURN(0x4F5A6829041E7D5CLL, k_MW_PaletteType, MW_PaletteType); + break; + case 3422: + HASH_RETURN(0x0DF314772A9FBD5ELL, k_STREAM_NOTIFY_REDIRECTED, STREAM_NOTIFY_REDIRECTED); + break; + case 3423: + HASH_RETURN(0x6E50FE5A6CE31D5FLL, k_LDAP_OPT_REFERRALS, LDAP_OPT_REFERRALS); + break; + case 3424: + HASH_RETURN(0x754C31003A262D60LL, k_UPLOAD_ERR_NO_FILE, UPLOAD_ERR_NO_FILE); + HASH_RETURN(0x3D724D44F99B8D60LL, k_T_DNUMBER, T_DNUMBER); + break; + case 3436: + HASH_RETURN(0x7ABB5B454F3B7D6CLL, k_SIGPIPE, SIGPIPE); + break; + case 3438: + HASH_RETURN(0x1BDB52AC8DD9AD6ELL, k_XSD_GMONTHDAY, XSD_GMONTHDAY); + break; + case 3442: + HASH_RETURN(0x7531529AC01F9D72LL, k_CURLOPT_USERAGENT, CURLOPT_USERAGENT); + break; + case 3446: + HASH_RETURN(0x4EC6EDC68E017D76LL, k_MW_MinusCompositeOp, MW_MinusCompositeOp); + break; + case 3447: + HASH_RETURN(0x7E2045A74D4C6D77LL, k_LC_TIME, LC_TIME); + break; + case 3448: + HASH_RETURN(0x7B04F9CA4180AD78LL, k_AM_STR, AM_STR); + break; + case 3450: + HASH_RETURN(0x59AA899293A2CD7ALL, k_CURLVERSION_NOW, CURLVERSION_NOW); + break; + case 3451: + HASH_RETURN(0x07BA663F5358BD7BLL, k_PHP_BINDIR, PHP_BINDIR); + break; + case 3454: + HASH_RETURN(0x642B6A707D1D7D7ELL, k_CURLOPT_HTTPHEADER, CURLOPT_HTTPHEADER); + break; + case 3455: + HASH_RETURN(0x0624D9FDA4FA2D7FLL, k_CURLE_URL_MALFORMAT, CURLE_URL_MALFORMAT); + break; + case 3456: + HASH_RETURN(0x1B0BE5D3FCBDCD80LL, k_SQLT_RDD, SQLT_RDD); + HASH_RETURN(0x5E108CDF92320D80LL, k_SIGQUIT, SIGQUIT); + break; + case 3457: + HASH_RETURN(0x60103CDE5B5DED81LL, k_MW_EdgeVirtualPixelMethod, MW_EdgeVirtualPixelMethod); + HASH_RETURN(0x3C975F338FE45D81LL, k_IDNA_STRINGPREP_ERROR, IDNA_STRINGPREP_ERROR); + break; + case 3458: + HASH_RETURN(0x41B8FB03B8837D82LL, k_ABMON_10, ABMON_10); + break; + case 3459: + HASH_RETURN(0x519F2D2E92F21D83LL, k_CURLOPT_CLOSEPOLICY, CURLOPT_CLOSEPOLICY); + break; + case 3460: + HASH_RETURN(0x7B08F92F6EEFAD84LL, k_XML_OPTION_CASE_FOLDING, XML_OPTION_CASE_FOLDING); + break; + case 3461: + HASH_RETURN(0x2DA3CB49AD2F0D85LL, k_U_STANDARD_ERROR_LIMIT, U_STANDARD_ERROR_LIMIT); + break; + case 3462: + HASH_RETURN(0x50F6693EB1A91D86LL, k_DATE_RFC3339, DATE_RFC3339); + break; + case 3469: + HASH_RETURN(0x63015003E99EBD8DLL, k_T_MUL_EQUAL, T_MUL_EQUAL); + break; + case 3478: + HASH_RETURN(0x4BD8FE56552BBD96LL, k_MCC_DELETE_ERROR_LOG, MCC_DELETE_ERROR_LOG); + break; + case 3479: + HASH_RETURN(0x725E8AF1FCC17D97LL, k_U_MALFORMED_SYMBOL_REFERENCE, U_MALFORMED_SYMBOL_REFERENCE); + HASH_RETURN(0x5285F1FB2FDD5D97LL, k_OCI_COMMIT_ON_SUCCESS, OCI_COMMIT_ON_SUCCESS); + break; + case 3483: + HASH_RETURN(0x74608FBC8A472D9BLL, k_MW_MonitorWarning, MW_MonitorWarning); + break; + case 3484: + HASH_RETURN(0x06DC44600D683D9CLL, k_PHPMCC_USED_FAST_PATH, PHPMCC_USED_FAST_PATH); + break; + case 3486: + HASH_RETURN(0x2AB052BFEA350D9ELL, k_U_RESOURCE_TYPE_MISMATCH, U_RESOURCE_TYPE_MISMATCH); + HASH_RETURN(0x099E775BCDF63D9ELL, k_U_UNSUPPORTED_ATTRIBUTE, U_UNSUPPORTED_ATTRIBUTE); + break; + case 3487: + HASH_RETURN(0x567B425E3C995D9FLL, k_UCOL_PRIMARY, UCOL_PRIMARY); + HASH_RETURN(0x4EB13AF70DCE4D9FLL, k_XML_ERROR_UNKNOWN_ENCODING, XML_ERROR_UNKNOWN_ENCODING); + HASH_RETURN(0x7695C4F73EA18D9FLL, k_STREAM_CRYPTO_METHOD_SSLv23_SERVER, STREAM_CRYPTO_METHOD_SSLv23_SERVER); + break; + case 3489: + HASH_RETURN(0x57CD72A00AAD2DA1LL, k_IMAGETYPE_TIFF_MM, IMAGETYPE_TIFF_MM); + break; + case 3491: + HASH_RETURN(0x14C42AD03A63BDA3LL, k_SQLT_NUM, SQLT_NUM); + break; + case 3493: + HASH_RETURN(0x1BC7248DB0E08DA5LL, k_INI_USER, INI_USER); + break; + case 3494: + HASH_RETURN(0x0484A19599814DA6LL, k_CURLOPT_LOW_SPEED_TIME, CURLOPT_LOW_SPEED_TIME); + HASH_RETURN(0x34025636636B9DA6LL, k_U_ILLEGAL_CHAR_FOUND, U_ILLEGAL_CHAR_FOUND); + break; + case 3496: + HASH_RETURN(0x1A6DD2C63CC2CDA8LL, k_FILE_APPEND, FILE_APPEND); + break; + case 3497: + HASH_RETURN(0x14E7395A94B38DA9LL, k_PKCS7_TEXT, PKCS7_TEXT); + break; + case 3499: + HASH_RETURN(0x7D6F66A55B084DABLL, k_E_STRICT, E_STRICT); + HASH_RETURN(0x32E92869964BADABLL, k_SOCKET_EL2HLT, SOCKET_EL2HLT); + break; + case 3501: + HASH_RETURN(0x76F0432FE8FD3DADLL, k_LC_CTYPE, LC_CTYPE); + break; + case 3503: + HASH_RETURN(0x2BC33F509A5AADAFLL, k_CURLAUTH_DIGEST, CURLAUTH_DIGEST); + break; + case 3506: + HASH_RETURN(0x3A8C33DE41ADDDB2LL, k_XSD_NONPOSITIVEINTEGER, XSD_NONPOSITIVEINTEGER); + break; + case 3511: + HASH_RETURN(0x7BC3241B87664DB7LL, k_U_TRUNCATED_CHAR_FOUND, U_TRUNCATED_CHAR_FOUND); + break; + case 3515: + HASH_RETURN(0x4995655B45B0EDBBLL, k_MW_MultiplyEvaluateOperator, MW_MultiplyEvaluateOperator); + break; + case 3518: + HASH_RETURN(0x00569354D7800DBELL, k_EXTR_IF_EXISTS, EXTR_IF_EXISTS); + HASH_RETURN(0x11F1ED94ABA77DBELL, k_PKCS7_NOINTERN, PKCS7_NOINTERN); + break; + case 3524: + HASH_RETURN(0x27EEEF865B07FDC4LL, k_IDNA_ICONV_ERROR, IDNA_ICONV_ERROR); + break; + case 3526: + HASH_RETURN(0x04050975BB277DC6LL, k_MW_BackgroundDispose, MW_BackgroundDispose); + break; + case 3532: + HASH_RETURN(0x0B3367C454FC5DCCLL, k_STR_PAD_RIGHT, STR_PAD_RIGHT); + HASH_RETURN(0x41ED5FFAFCE49DCCLL, k_X509_PURPOSE_SMIME_ENCRYPT, X509_PURPOSE_SMIME_ENCRYPT); + break; + case 3534: + HASH_RETURN(0x7EF65783EA58CDCELL, k_IMAGETYPE_JPEG, IMAGETYPE_JPEG); + break; + case 3539: + HASH_RETURN(0x0B872BC75FC9ADD3LL, k_UCOL_CASE_LEVEL, UCOL_CASE_LEVEL); + break; + case 3540: + HASH_RETURN(0x267A5DE787395DD4LL, k_MW_ItalicStyle, MW_ItalicStyle); + break; + case 3542: + HASH_RETURN(0x2516BDA00D88DDD6LL, k_MYSQLI_TYPE_INT24, MYSQLI_TYPE_INT24); + break; + case 3549: + HASH_RETURN(0x53A05E2E1B3A1DDDLL, k_MYSQLI_CLIENT_COMPRESS, MYSQLI_CLIENT_COMPRESS); + break; + case 3551: + HASH_RETURN(0x5EDE310A750EBDDFLL, k_XML_ERROR_DUPLICATE_ATTRIBUTE, XML_ERROR_DUPLICATE_ATTRIBUTE); + break; + case 3552: + HASH_RETURN(0x36F4F66B710AEDE0LL, k_CURLOPT_SSL_VERIFYPEER, CURLOPT_SSL_VERIFYPEER); + break; + case 3553: + HASH_RETURN(0x5E179C7BF16AADE1LL, k_U_REGEX_LOOK_BEHIND_LIMIT, U_REGEX_LOOK_BEHIND_LIMIT); + break; + case 3557: + HASH_RETURN(0x5ED04B226C6F5DE5LL, k_CURLE_RECV_ERROR, CURLE_RECV_ERROR); + break; + case 3565: + HASH_RETURN(0x640C16523EB7DDEDLL, k_CURLOPT_KRB4LEVEL, CURLOPT_KRB4LEVEL); + HASH_RETURN(0x1E12B42FFDA93DEDLL, k_MW_RightAlign, MW_RightAlign); + break; + case 3569: + HASH_RETURN(0x183F3978FCC61DF1LL, k_T_COMMENT, T_COMMENT); + break; + case 3573: + HASH_RETURN(0x54DF231EC3A20DF5LL, k_MCC_MTU, MCC_MTU); + break; + case 3575: + HASH_RETURN(0x3494F07712A06DF7LL, k_INF, INF); + break; + case 3578: + HASH_RETURN(0x225B5C23C91AADFALL, k_U_FILE_ACCESS_ERROR, U_FILE_ACCESS_ERROR); + break; + case 3579: + HASH_RETURN(0x11498EA6A53EFDFBLL, k_STREAM_NOTIFY_SEVERITY_INFO, STREAM_NOTIFY_SEVERITY_INFO); + break; + case 3580: + HASH_RETURN(0x221920EBBB628DFCLL, k_SIGWINCH, SIGWINCH); + break; + case 3581: + HASH_RETURN(0x2D51185B445E6DFDLL, k_SQLITE3_BLOB, SQLITE3_BLOB); + HASH_RETURN(0x0A07C0E7F4731DFDLL, k_LOG_SYSLOG, LOG_SYSLOG); + break; + case 3582: + HASH_RETURN(0x0837B8B91C1AEDFELL, k_LOG_CRIT, LOG_CRIT); + break; + case 3583: + HASH_RETURN(0x4D9940F29E8D2DFFLL, k_SOCKET_ESRMNT, SOCKET_ESRMNT); + break; + case 3584: + HASH_RETURN(0x345B84A19F145E00LL, k_CURLINFO_CONNECT_TIME, CURLINFO_CONNECT_TIME); + break; + case 3589: + HASH_RETURN(0x2C4915B589B81E05LL, k_XSD_UNSIGNEDSHORT, XSD_UNSIGNEDSHORT); + break; + case 3590: + HASH_RETURN(0x16FA49F8EF5CDE06LL, k_T_BREAK, T_BREAK); + break; + case 3597: + HASH_RETURN(0x7A38C903855C7E0DLL, k_MW_UndefinedVirtualPixelMethod, MW_UndefinedVirtualPixelMethod); + break; + case 3599: + HASH_RETURN(0x6FB13B6F426B0E0FLL, k_SOAP_1_1, SOAP_1_1); + break; + case 3600: + HASH_RETURN(0x22CD7D927EE36E10LL, k_XML_ATTRIBUTE_CDATA, XML_ATTRIBUTE_CDATA); + break; + case 3604: + HASH_RETURN(0x4C7A4802615D5E14LL, k_DEBUG_LOG_TRACE, DEBUG_LOG_TRACE); + break; + case 3605: + HASH_RETURN(0x5648EF867B700E15LL, k_EXTR_PREFIX_ALL, EXTR_PREFIX_ALL); + break; + case 3607: + HASH_RETURN(0x7CB628606FE34E17LL, k_MW_RightShiftEvaluateOperator, MW_RightShiftEvaluateOperator); + break; + case 3608: + HASH_RETURN(0x50707DEC820F4E18LL, k_MCC_ARG_MIRROR_CFG_MODEL, MCC_ARG_MIRROR_CFG_MODEL); + HASH_RETURN(0x6AFCBC5FE70F8E18LL, k_MCRYPT_ARCFOUR_IV, MCRYPT_ARCFOUR_IV); + HASH_RETURN(0x70639E133AD63E18LL, k_CURLFTPAUTH_DEFAULT, CURLFTPAUTH_DEFAULT); + break; + case 3610: + HASH_RETURN(0x145ED25BDC64AE1ALL, k_IMG_EFFECT_OVERLAY, IMG_EFFECT_OVERLAY); + break; + case 3611: + HASH_RETURN(0x470FEE7019508E1BLL, k_OCI_D_FILE, OCI_D_FILE); + break; + case 3612: + HASH_RETURN(0x1CF42F59A432EE1CLL, k_ABDAY_5, ABDAY_5); + break; + case 3613: + HASH_RETURN(0x752D7DBBF3D39E1DLL, k_MW_UndefinedStretch, MW_UndefinedStretch); + break; + case 3618: + HASH_RETURN(0x0A38761E0DA4EE22LL, k_OCI_RETURN_LOBS, OCI_RETURN_LOBS); + break; + case 3620: + HASH_RETURN(0x44BCD76418C00E24LL, k_CURLE_FTP_COULDNT_SET_ASCII, CURLE_FTP_COULDNT_SET_ASCII); + break; + case 3621: + HASH_RETURN(0x5E784C2A73C45E25LL, k_DEBUG_LOG_DEFAULT, DEBUG_LOG_DEFAULT); + break; + case 3622: + HASH_RETURN(0x15F5684D6D173E26LL, k_INI_PERDIR, INI_PERDIR); + HASH_RETURN(0x5740B2A94B671E26LL, k_IMG_FILTER_SELECTIVE_BLUR, IMG_FILTER_SELECTIVE_BLUR); + break; + case 3624: + HASH_RETURN(0x6A8ACC8C8626BE28LL, k_STREAM_IPPROTO_UDP, STREAM_IPPROTO_UDP); + HASH_RETURN(0x453FFE038CED3E28LL, k_SOCKET_EHOSTDOWN, SOCKET_EHOSTDOWN); + break; + case 3627: + HASH_RETURN(0x062595DB35D40E2BLL, k_MON_11, MON_11); + break; + case 3631: + HASH_RETURN(0x3C1215853485BE2FLL, k_UCOL_NUMERIC_COLLATION, UCOL_NUMERIC_COLLATION); + break; + case 3633: + HASH_RETURN(0x0E1C77C869257E31LL, k_MB_CASE_UPPER, MB_CASE_UPPER); + break; + case 3635: + HASH_RETURN(0x3140458572921E33LL, k_SOCKET_ECOMM, SOCKET_ECOMM); + break; + case 3637: + HASH_RETURN(0x3A33A5F6B0E71E35LL, k_MYSQLI_TYPE_GEOMETRY, MYSQLI_TYPE_GEOMETRY); + break; + case 3642: + HASH_RETURN(0x37C9D9DC7CB3BE3ALL, k_XML_ERROR_EXTERNAL_ENTITY_HANDLING, XML_ERROR_EXTERNAL_ENTITY_HANDLING); + HASH_RETURN(0x468C9B40C4051E3ALL, k_ENT_NOQUOTES, ENT_NOQUOTES); + break; + case 3643: + HASH_RETURN(0x177B88E869891E3BLL, k_MSG_EXCEPT, MSG_EXCEPT); + break; + case 3644: + HASH_RETURN(0x752ADBB53BA8CE3CLL, k_DOM_NOT_SUPPORTED_ERR, DOM_NOT_SUPPORTED_ERR); + break; + case 3647: + HASH_RETURN(0x45A80B1B9E5A0E3FLL, k_U_MALFORMED_VARIABLE_DEFINITION, U_MALFORMED_VARIABLE_DEFINITION); + break; + case 3648: + HASH_RETURN(0x17461F220A1CDE40LL, k_SOCKET_EADDRNOTAVAIL, SOCKET_EADDRNOTAVAIL); + break; + case 3649: + HASH_RETURN(0x2261E4CD8D204E41LL, k_CURLE_MALFORMAT_USER, CURLE_MALFORMAT_USER); + break; + case 3652: + HASH_RETURN(0x644A05E8D26A0E44LL, k_MW_OverCompositeOp, MW_OverCompositeOp); + break; + case 3653: + HASH_RETURN(0x217B3E865E541E45LL, k_PHP_SAPI, PHP_SAPI); + HASH_RETURN(0x55E559C5DC163E45LL, k_CURLOPT_POST, CURLOPT_POST); + break; + case 3654: + HASH_RETURN(0x51D82188E1C87E46LL, k_MW_IndexChannel, MW_IndexChannel); + break; + case 3655: + HASH_RETURN(0x382079A4E1859E47LL, k_MON_6, MON_6); + break; + case 3657: + HASH_RETURN(0x1432AE6BD6E60E49LL, k_STREAM_SERVER_BIND, STREAM_SERVER_BIND); + HASH_RETURN(0x15042757BAFCAE49LL, k_OCI_DTYPE_ROWID, OCI_DTYPE_ROWID); + break; + case 3661: + HASH_RETURN(0x4CDB98912E88BE4DLL, k_STREAM_URL_STAT_LINK, STREAM_URL_STAT_LINK); + HASH_RETURN(0x707379159AEB4E4DLL, k_CURLOPT_HTTPPROXYTUNNEL, CURLOPT_HTTPPROXYTUNNEL); + break; + case 3663: + HASH_RETURN(0x0B7A2DC2A24B4E4FLL, k_LIBXML_DTDVALID, LIBXML_DTDVALID); + HASH_RETURN(0x6DC52B94939EFE4FLL, k_MW_RegistryWarning, MW_RegistryWarning); + HASH_RETURN(0x0CD9CDAAF1163E4FLL, k_MW_CoderFatalError, MW_CoderFatalError); + break; + case 3671: + HASH_RETURN(0x404229D73F2E0E57LL, k_PSFS_FLAG_FLUSH_CLOSE, PSFS_FLAG_FLUSH_CLOSE); + break; + case 3672: + HASH_RETURN(0x4504777806FBFE58LL, k_FORCE_GZIP, FORCE_GZIP); + break; + case 3674: + HASH_RETURN(0x6808FCB2921D3E5ALL, k_MW_ColorSeparationMatteType, MW_ColorSeparationMatteType); + break; + case 3676: + HASH_RETURN(0x694B7BB67D4D2E5CLL, k_SOCKET_EMULTIHOP, SOCKET_EMULTIHOP); + break; + case 3677: + HASH_RETURN(0x2B1364E64F41AE5DLL, k_LOG_WARNING, LOG_WARNING); + break; + case 3679: + HASH_RETURN(0x619B30E96685FE5FLL, k_MCRYPT_DEV_RANDOM, MCRYPT_DEV_RANDOM); + break; + case 3685: + HASH_RETURN(0x3A4F748BEA361E65LL, k_T_IS_GREATER_OR_EQUAL, T_IS_GREATER_OR_EQUAL); + break; + case 3689: + HASH_RETURN(0x3C7ED822E90FAE69LL, k_MW_BoxFilter, MW_BoxFilter); + HASH_RETURN(0x13003A75EDE89E69LL, k_T_DO, T_DO); + break; + case 3690: + HASH_RETURN(0x71D054A19E8F6E6ALL, k_PATH_SEPARATOR, PATH_SEPARATOR); + HASH_RETURN(0x449C6C5701CEFE6ALL, k_U_REGEX_MAX_LT_MIN, U_REGEX_MAX_LT_MIN); + break; + case 3691: + HASH_RETURN(0x61E930FBB9D0FE6BLL, k_STREAM_PF_UNIX, STREAM_PF_UNIX); + HASH_RETURN(0x405D15D732BF0E6BLL, k_SOCKET_EMLINK, SOCKET_EMLINK); + HASH_RETURN(0x1356B4A73A1B2E6BLL, k_XHPROF_FLAGS_CPU, XHPROF_FLAGS_CPU); + break; + case 3692: + HASH_RETURN(0x6F2F949C502AEE6CLL, k_U_MISMATCHED_SEGMENT_DELIMITERS, U_MISMATCHED_SEGMENT_DELIMITERS); + break; + case 3694: + HASH_RETURN(0x139C3A8F7E600E6ELL, k_XML_DTD_NODE, XML_DTD_NODE); + break; + case 3695: + HASH_RETURN(0x11469A6B4A81DE6FLL, k_MW_SouthEastGravity, MW_SouthEastGravity); + break; + case 3703: + HASH_RETURN(0x41892F9BFCC91E77LL, k_MW_XorCompositeOp, MW_XorCompositeOp); + break; + case 3704: + HASH_RETURN(0x490B6C273B019E78LL, k_OCI_FETCHSTATEMENT_BY_COLUMN, OCI_FETCHSTATEMENT_BY_COLUMN); + break; + case 3705: + HASH_RETURN(0x58DA5C816A9D0E79LL, k_LC_COLLATE, LC_COLLATE); + HASH_RETURN(0x6FF1581687418E79LL, k_MYSQLI_BLOB_FLAG, MYSQLI_BLOB_FLAG); + break; + case 3706: + HASH_RETURN(0x6DC0AE1806411E7ALL, k_SOCKET_EBADMSG, SOCKET_EBADMSG); + break; + case 3707: + HASH_RETURN(0x72F3AC0339F5BE7BLL, k_U_MALFORMED_UNICODE_ESCAPE, U_MALFORMED_UNICODE_ESCAPE); + break; + case 3709: + HASH_RETURN(0x158314442E45DE7DLL, k_LOG_LOCAL0, LOG_LOCAL0); + HASH_RETURN(0x05CDAC3CFDEC7E7DLL, k_DATE_RFC1036, DATE_RFC1036); + break; + case 3710: + HASH_RETURN(0x4BD825B1356B0E7ELL, k_MCC_ARG_PROXY, MCC_ARG_PROXY); + break; + case 3716: + HASH_RETURN(0x46C414938F663E84LL, k_UNKNOWN_TYPE, UNKNOWN_TYPE); + HASH_RETURN(0x071FB0702D5D7E84LL, k_MW_TypeFatalError, MW_TypeFatalError); + break; + case 3718: + HASH_RETURN(0x0DA0D99299360E86LL, k_XSD_DATE, XSD_DATE); + break; + case 3719: + HASH_RETURN(0x363E537C1B1B6E87LL, k_AF_INET, AF_INET); + HASH_RETURN(0x77967753B3F3AE87LL, k_MYSQLI_TYPE_BLOB, MYSQLI_TYPE_BLOB); + break; + case 3721: + HASH_RETURN(0x0E3AFA272D679E89LL, k_M_LN2, M_LN2); + break; + case 3724: + HASH_RETURN(0x306E85E598280E8CLL, k_MW_GrayscaleMatteType, MW_GrayscaleMatteType); + break; + case 3725: + HASH_RETURN(0x587E1718D2E0BE8DLL, k_YESEXPR, YESEXPR); + break; + case 3726: + HASH_RETURN(0x1740AE3316108E8ELL, k_SIGABRT, SIGABRT); + break; + case 3738: + HASH_RETURN(0x4D0D7C94AB774E9ALL, k_CURLOPT_QUOTE, CURLOPT_QUOTE); + break; + case 3741: + HASH_RETURN(0x4922A66A0E802E9DLL, k_OCI_EXACT_FETCH, OCI_EXACT_FETCH); + break; + case 3743: + HASH_RETURN(0x5BB76BAE17DACE9FLL, k_IMG_FILTER_CONTRAST, IMG_FILTER_CONTRAST); + break; + case 3744: + HASH_RETURN(0x39C728C412DEBEA0LL, k_IMAGETYPE_IFF, IMAGETYPE_IFF); + break; + case 3748: + HASH_RETURN(0x42C56034DD1CFEA4LL, k_MW_UndefinedInterlace, MW_UndefinedInterlace); + break; + case 3750: + HASH_RETURN(0x052C698265DBDEA6LL, k_XML_ERROR_BINARY_ENTITY_REF, XML_ERROR_BINARY_ENTITY_REF); + break; + case 3752: + HASH_RETURN(0x2FD78BD3739B6EA8LL, k_U_DIFFERENT_UCA_VERSION, U_DIFFERENT_UCA_VERSION); + break; + case 3753: + HASH_RETURN(0x43C1A340EAE87EA9LL, k_PKCS7_BINARY, PKCS7_BINARY); + break; + case 3754: + HASH_RETURN(0x7E3C4FDB23064EAALL, k_GD_VERSION, GD_VERSION); + break; + case 3755: + HASH_RETURN(0x40CA2A80486C2EABLL, k_T_IS_IDENTICAL, T_IS_IDENTICAL); + break; + case 3761: + HASH_RETURN(0x64F156C9F2FC1EB1LL, k_SO_DONTROUTE, SO_DONTROUTE); + HASH_RETURN(0x24FF3413EB09CEB1LL, k_CURLINFO_TOTAL_TIME, CURLINFO_TOTAL_TIME); + HASH_RETURN(0x4075F95101C36EB1LL, k_MB_CASE_TITLE, MB_CASE_TITLE); + break; + case 3762: + HASH_RETURN(0x5DB146EA0F090EB2LL, k_MW_CoderError, MW_CoderError); + break; + case 3763: + HASH_RETURN(0x676BE5B93694EEB3LL, k_UCOL_TERTIARY, UCOL_TERTIARY); + HASH_RETURN(0x56AFE5B9EECAAEB3LL, k_MW_ImageWarning, MW_ImageWarning); + break; + case 3764: + HASH_RETURN(0x6075626EA8093EB4LL, k_IMAGETYPE_JB2, IMAGETYPE_JB2); + HASH_RETURN(0x58D89A6449014EB4LL, k_MCRYPT_PANAMA, MCRYPT_PANAMA); + break; + case 3766: + HASH_RETURN(0x3B52041CCA765EB6LL, k_T_IF, T_IF); + break; + case 3767: + HASH_RETURN(0x17EF63EAD33F2EB7LL, k_LIBXML_ERR_WARNING, LIBXML_ERR_WARNING); + HASH_RETURN(0x625E97D83FE3AEB7LL, k_XSD_ANYURI, XSD_ANYURI); + break; + case 3769: + HASH_RETURN(0x2BCF528CAA6C2EB9LL, k_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF); + break; + case 3770: + HASH_RETURN(0x046E4710E1706EBALL, k_CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_1_0); + break; + case 3771: + HASH_RETURN(0x6DA907C87A77FEBBLL, k_U_REGEX_BAD_INTERVAL, U_REGEX_BAD_INTERVAL); + break; + case 3775: + HASH_RETURN(0x041BF5F1E6FA8EBFLL, k_MW_DrawFatalError, MW_DrawFatalError); + break; + case 3779: + HASH_RETURN(0x53A71C8D70072EC3LL, k_CURLOPT_PROXYUSERPWD, CURLOPT_PROXYUSERPWD); + break; + case 3780: + HASH_RETURN(0x65F3F80E3353BEC4LL, k_OPENSSL_NO_PADDING, OPENSSL_NO_PADDING); + HASH_RETURN(0x4C8EA3F8E5994EC4LL, k_T_CLOSE_TAG, T_CLOSE_TAG); + break; + case 3781: + HASH_RETURN(0x4EE18378D076BEC5LL, k_LOG_LOCAL2, LOG_LOCAL2); + break; + case 3784: + HASH_RETURN(0x3DD29A895FABFEC8LL, k_CURLE_BAD_CONTENT_ENCODING, CURLE_BAD_CONTENT_ENCODING); + HASH_RETURN(0x2BE32D01E84F3EC8LL, k_MYSQLI_TYPE_DATETIME, MYSQLI_TYPE_DATETIME); + break; + case 3785: + HASH_RETURN(0x19EEBD1A9E93BEC9LL, k_CURLE_FTP_COULDNT_USE_REST, CURLE_FTP_COULDNT_USE_REST); + break; + case 3790: + HASH_RETURN(0x71E2B4F0E335FECELL, k_U_STATE_TOO_OLD_ERROR, U_STATE_TOO_OLD_ERROR); + break; + case 3793: + HASH_RETURN(0x14EA5F6FD4892ED1LL, k_MW_PlaneInterlace, MW_PlaneInterlace); + break; + case 3794: + HASH_RETURN(0x01A74DDCF6DD8ED2LL, k_U_MISSING_OPERATOR, U_MISSING_OPERATOR); + break; + case 3795: + HASH_RETURN(0x69F0BD8218172ED3LL, k_MCC_SERVER_DOWN, MCC_SERVER_DOWN); + break; + case 3796: + HASH_RETURN(0x6D9D3195E581CED4LL, k_PSFS_PASS_ON, PSFS_PASS_ON); + break; + case 3798: + HASH_RETURN(0x521261F658D44ED6LL, k_CURLOPT_READFUNCTION, CURLOPT_READFUNCTION); + break; + case 3801: + HASH_RETURN(0x04980D06D5D28ED9LL, k_CURLINFO_STARTTRANSFER_TIME, CURLINFO_STARTTRANSFER_TIME); + break; + case 3802: + HASH_RETURN(0x4B4EC5983088DEDALL, k_T_MINUS_EQUAL, T_MINUS_EQUAL); + break; + case 3803: + HASH_RETURN(0x403ABCC16F4F2EDBLL, k_DNS_A, DNS_A); + break; + case 3806: + HASH_RETURN(0x774C4111D6F0CEDELL, k_T_CLONE, T_CLONE); + break; + case 3807: + HASH_RETURN(0x6D4DA813591B2EDFLL, k_CURLINFO_CONTENT_TYPE, CURLINFO_CONTENT_TYPE); + break; + case 3808: + HASH_RETURN(0x04B20664C7849EE0LL, k_MW_DrawError, MW_DrawError); + break; + case 3809: + HASH_RETURN(0x3E54A25ACF621EE1LL, k_ALT_DIGITS, ALT_DIGITS); + break; + case 3810: + HASH_RETURN(0x27166E4DB39CFEE2LL, k_MYSQLI_TYPE_ENUM, MYSQLI_TYPE_ENUM); + break; + case 3813: + HASH_RETURN(0x62C692807F0BCEE5LL, k_OPENSSL_KEYTYPE_DSA, OPENSSL_KEYTYPE_DSA); + break; + case 3815: + HASH_RETURN(0x29B47DC30B394EE7LL, k_MW_AllChannels, MW_AllChannels); + break; + case 3816: + HASH_RETURN(0x73E6F0F221340EE8LL, k_EXIF_USE_MBSTRING, EXIF_USE_MBSTRING); + break; + case 3821: + HASH_RETURN(0x0FEA059CA89E1EEDLL, k_OCI_SYSDBA, OCI_SYSDBA); + break; + case 3823: + HASH_RETURN(0x5269C5EAD4C7AEEFLL, k_INFO_GENERAL, INFO_GENERAL); + break; + case 3824: + HASH_RETURN(0x7F176E6ED0CA5EF0LL, k_PREG_OFFSET_CAPTURE, PREG_OFFSET_CAPTURE); + break; + case 3827: + HASH_RETURN(0x3867CC5C75CD9EF3LL, k_IMG_JPEG, IMG_JPEG); + break; + case 3828: + HASH_RETURN(0x2637AB3CFC3A5EF4LL, k_COUNT_NORMAL, COUNT_NORMAL); + break; + case 3830: + HASH_RETURN(0x2FDF8F84934F3EF6LL, k_T_FMT, T_FMT); + break; + case 3831: + HASH_RETURN(0x751E7F5F5D589EF7LL, k_MON_3, MON_3); + break; + case 3833: + HASH_RETURN(0x760FEEC981CB1EF9LL, k_T_VARIABLE, T_VARIABLE); + break; + case 3835: + HASH_RETURN(0x58FED4771ED61EFBLL, k_PATHINFO_DIRNAME, PATHINFO_DIRNAME); + break; + case 3837: + HASH_RETURN(0x561EC5547B7FAEFDLL, k_CURLM_OK, CURLM_OK); + break; + case 3838: + HASH_RETURN(0x249685C5CEF46EFELL, k_MW_ConcatenateMode, MW_ConcatenateMode); + break; + case 3840: + HASH_RETURN(0x2769043A92972F00LL, k_MCRYPT_GOST, MCRYPT_GOST); + break; + case 3841: + HASH_RETURN(0x008499341CD1DF01LL, k_SOCKET_E2BIG, SOCKET_E2BIG); + break; + case 3845: + HASH_RETURN(0x5022DC35BDEFEF05LL, k_STREAM_CLIENT_PERSISTENT, STREAM_CLIENT_PERSISTENT); + break; + case 3849: + HASH_RETURN(0x562453EADF708F09LL, k_CURLOPT_RETURNTRANSFER, CURLOPT_RETURNTRANSFER); + break; + case 3850: + HASH_RETURN(0x0FDBC94DA31DFF0ALL, k_MW_YPbPrColorspace, MW_YPbPrColorspace); + break; + case 3853: + HASH_RETURN(0x4F241752C9FAEF0DLL, k_MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONG); + break; + case 3854: + HASH_RETURN(0x3C7D69E227DD9F0ELL, k_PRIO_PGRP, PRIO_PGRP); + break; + case 3855: + HASH_RETURN(0x0CCF96C5EF255F0FLL, k_LOG_NEWS, LOG_NEWS); + break; + case 3858: + HASH_RETURN(0x16EE3956BC818F12LL, k_CURLE_OK, CURLE_OK); + break; + case 3860: + HASH_RETURN(0x4090887392D0FF14LL, k_MW_SegmentPreview, MW_SegmentPreview); + break; + case 3864: + HASH_RETURN(0x607F7ED62648BF18LL, k_INFO_ALL, INFO_ALL); + break; + case 3868: + HASH_RETURN(0x3397DAF409349F1CLL, k_OPENSSL_ALGO_MD5, OPENSSL_ALGO_MD5); + break; + case 3874: + HASH_RETURN(0x25FA0806735FDF22LL, k_IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_II); + break; + case 3876: + HASH_RETURN(0x7720C773295D5F24LL, k_MYSQL_ASSOC, MYSQL_ASSOC); + break; + case 3877: + HASH_RETURN(0x3CA9C7BBDEB4BF25LL, k_T_USE, T_USE); + break; + case 3883: + HASH_RETURN(0x56D2E35CABB23F2BLL, k_STREAM_IS_URL, STREAM_IS_URL); + break; + case 3884: + HASH_RETURN(0x5A4A7283F0400F2CLL, k_MW_SharpenPreview, MW_SharpenPreview); + break; + case 3885: + HASH_RETURN(0x647F1A783511DF2DLL, k_MW_ShadePreview, MW_ShadePreview); + break; + case 3887: + HASH_RETURN(0x23654A24957D4F2FLL, k_T_WHILE, T_WHILE); + break; + case 3889: + HASH_RETURN(0x10F9066DDD41AF31LL, k_DOM_INVALID_MODIFICATION_ERR, DOM_INVALID_MODIFICATION_ERR); + break; + case 3891: + HASH_RETURN(0x357C3B3722523F33LL, k_RADIXCHAR, RADIXCHAR); + break; + case 3892: + HASH_RETURN(0x06F1EFB64D4D3F34LL, k_STREAM_NOTIFY_PROGRESS, STREAM_NOTIFY_PROGRESS); + HASH_RETURN(0x64E5A69F5D8A8F34LL, k_MW_ClearCompositeOp, MW_ClearCompositeOp); + break; + case 3894: + HASH_RETURN(0x747339E898926F36LL, k_MCRYPT_THREEWAY, MCRYPT_THREEWAY); + break; + case 3895: + HASH_RETURN(0x6D955FB67B9C4F37LL, k_XML_ATTRIBUTE_NOTATION, XML_ATTRIBUTE_NOTATION); + break; + case 3896: + HASH_RETURN(0x655B612DD9AB2F38LL, k_UPLOAD_ERR_PARTIAL, UPLOAD_ERR_PARTIAL); + break; + case 3898: + HASH_RETURN(0x30A4954899851F3ALL, k_INFO_LICENSE, INFO_LICENSE); + break; + case 3899: + HASH_RETURN(0x371038F4A8DA7F3BLL, k_U_PATTERN_SYNTAX_ERROR, U_PATTERN_SYNTAX_ERROR); + break; + case 3902: + HASH_RETURN(0x35D35C56CB5F8F3ELL, k_MCRYPT_DES, MCRYPT_DES); + break; + case 3904: + HASH_RETURN(0x2906770823A28F40LL, k_DAY_1, DAY_1); + HASH_RETURN(0x3777F36C2B19DF40LL, k_T_BAD_CHARACTER, T_BAD_CHARACTER); + break; + case 3913: + HASH_RETURN(0x34C202AA7FE72F49LL, k_CURLE_TOO_MANY_REDIRECTS, CURLE_TOO_MANY_REDIRECTS); + break; + case 3916: + HASH_RETURN(0x5D199BE1E3F8FF4CLL, k_SOAP_AUTHENTICATION_DIGEST, SOAP_AUTHENTICATION_DIGEST); + HASH_RETURN(0x0C0959B4A422BF4CLL, k_MYSQLI_TYPE_DATE, MYSQLI_TYPE_DATE); + break; + case 3918: + HASH_RETURN(0x726744A927126F4ELL, k_THOUSEP, THOUSEP); + break; + case 3919: + HASH_RETURN(0x0A465CA27767DF4FLL, k_CURLOPT_FILETIME, CURLOPT_FILETIME); + HASH_RETURN(0x09241EB8D846EF4FLL, k_CURLE_SSL_CACERT, CURLE_SSL_CACERT); + break; + case 3920: + HASH_RETURN(0x12BF3928F2DF7F50LL, k_MCRYPT_WAKE, MCRYPT_WAKE); + HASH_RETURN(0x499537B9DF697F50LL, k_U_ERROR_WARNING_START, U_ERROR_WARNING_START); + break; + case 3921: + HASH_RETURN(0x50FAF3A45B71EF51LL, k_XSD_GDAY, XSD_GDAY); + HASH_RETURN(0x1661FDE02F75AF51LL, k_X509_PURPOSE_CRL_SIGN, X509_PURPOSE_CRL_SIGN); + break; + case 3924: + HASH_RETURN(0x60886938B3A8DF54LL, k_CURL_IPRESOLVE_V4, CURL_IPRESOLVE_V4); + break; + case 3935: + HASH_RETURN(0x4E1929443836FF5FLL, k_PHP_URL_FRAGMENT, PHP_URL_FRAGMENT); + HASH_RETURN(0x0307698D4C121F5FLL, k_MW_TriangleFilter, MW_TriangleFilter); + break; + case 3939: + HASH_RETURN(0x7176D0B448AB7F63LL, k_MCC_SERVER_RETRY_TMO_MS, MCC_SERVER_RETRY_TMO_MS); + HASH_RETURN(0x0BBCEDF6A8E09F63LL, k_XML_DOCUMENT_TYPE_NODE, XML_DOCUMENT_TYPE_NODE); + break; + case 3943: + HASH_RETURN(0x2C244A0A5099CF67LL, k_SOMAXCONN, SOMAXCONN); + HASH_RETURN(0x6CF93FC8650B6F67LL, k_MW_Group4Compression, MW_Group4Compression); + break; + case 3949: + HASH_RETURN(0x5ACE57FCE6544F6DLL, k_SO_OOBINLINE, SO_OOBINLINE); + break; + case 3950: + HASH_RETURN(0x055A8EEDD3AF2F6ELL, k_CURLOPT_SSLKEYTYPE, CURLOPT_SSLKEYTYPE); + HASH_RETURN(0x5DC45A6B785C7F6ELL, k_T_ECHO, T_ECHO); + HASH_RETURN(0x7A55CA35812E6F6ELL, k_MYSQLI_TYPE_VAR_STRING, MYSQLI_TYPE_VAR_STRING); + break; + case 3956: + HASH_RETURN(0x7FB5FB40CEEFFF74LL, k_U_NO_WRITE_PERMISSION, U_NO_WRITE_PERMISSION); + break; + case 3959: + HASH_RETURN(0x63561DDEAF3E4F77LL, k_MYSQL_CLIENT_SSL, MYSQL_CLIENT_SSL); + break; + case 3961: + HASH_RETURN(0x6438D83AFCA71F79LL, k_ZEND_THREAD_SAFE, ZEND_THREAD_SAFE); + break; + case 3962: + HASH_RETURN(0x608F0CF6B908CF7ALL, k_XML_ATTRIBUTE_ID, XML_ATTRIBUTE_ID); + break; + case 3965: + HASH_RETURN(0x2074C93458FBBF7DLL, k_UCOL_SECONDARY, UCOL_SECONDARY); + break; + case 3966: + HASH_RETURN(0x60C8A6D94CADAF7ELL, k_XSD_STRING, XSD_STRING); + HASH_RETURN(0x72C1827C5B3BCF7ELL, k_MW_SaturationPreview, MW_SaturationPreview); + break; + case 3972: + HASH_RETURN(0x13CEDD7D6F4CEF84LL, k_T_PAAMAYIM_NEKUDOTAYIM, T_PAAMAYIM_NEKUDOTAYIM); + break; + case 3976: + HASH_RETURN(0x1BDED1F33B77DF88LL, k_T_DOUBLE_ARROW, T_DOUBLE_ARROW); + break; + case 3977: + HASH_RETURN(0x1B6710D13E73EF89LL, k_MCRYPT_MODE_NOFB, MCRYPT_MODE_NOFB); + HASH_RETURN(0x549014A650F47F89LL, k_MW_AtopCompositeOp, MW_AtopCompositeOp); + break; + case 3981: + HASH_RETURN(0x4882E302ABFB2F8DLL, k_CURLOPT_CONNECTTIMEOUT, CURLOPT_CONNECTTIMEOUT); + break; + case 3982: + HASH_RETURN(0x561B993E0F7CFF8ELL, k_U_INDEX_OUTOFBOUNDS_ERROR, U_INDEX_OUTOFBOUNDS_ERROR); + break; + case 3985: + HASH_RETURN(0x78463112BE739F91LL, k_CONNECTION_TIMEOUT, CONNECTION_TIMEOUT); + break; + case 3987: + HASH_RETURN(0x051EE62C6B226F93LL, k_STREAM_IPPROTO_RAW, STREAM_IPPROTO_RAW); + break; + case 3989: + HASH_RETURN(0x2919569163A4AF95LL, k_MW_OpacityChannel, MW_OpacityChannel); + break; + case 3991: + HASH_RETURN(0x2ADC01792DF55F97LL, k_MW_UltraCondensedStretch, MW_UltraCondensedStretch); + break; + case 3993: + HASH_RETURN(0x33C5B73ECF053F99LL, k_PHP_SHLIB_SUFFIX, PHP_SHLIB_SUFFIX); + break; + case 3994: + HASH_RETURN(0x670D024730A7DF9ALL, k_CURL_TIMECOND_IFUNMODSINCE, CURL_TIMECOND_IFUNMODSINCE); + break; + case 3998: + HASH_RETURN(0x0459D9A18F091F9ELL, k_MYSQLI_PRI_KEY_FLAG, MYSQLI_PRI_KEY_FLAG); + break; + case 3999: + HASH_RETURN(0x7B7186B0D12CEF9FLL, k_DAY_5, DAY_5); + break; + case 4001: + HASH_RETURN(0x71EFB3619963EFA1LL, k_DOMSTRING_SIZE_ERR, DOMSTRING_SIZE_ERR); + break; + case 4003: + HASH_RETURN(0x7A4F8E7E110EEFA3LL, k_MW_MitchellFilter, MW_MitchellFilter); + break; + case 4007: + HASH_RETURN(0x1E1E53CAB3A5DFA7LL, k_OCI_B_INT, OCI_B_INT); + break; + case 4008: + HASH_RETURN(0x4BE0A36552A04FA8LL, k_T_ELSEIF, T_ELSEIF); + break; + case 4009: + HASH_RETURN(0x564E222501222FA9LL, k_T_ARRAY, T_ARRAY); + break; + case 4011: + HASH_RETURN(0x50238391D66C4FABLL, k_CURLOPT_HTTPAUTH, CURLOPT_HTTPAUTH); + HASH_RETURN(0x1D0E4D445ED42FABLL, k_U_REGEX_UNIMPLEMENTED, U_REGEX_UNIMPLEMENTED); + break; + case 4013: + HASH_RETURN(0x6312D84676288FADLL, k_GLOB_BRACE, GLOB_BRACE); + break; + case 4014: + HASH_RETURN(0x3E0233217F575FAELL, k_MW_ModulateCompositeOp, MW_ModulateCompositeOp); + break; + case 4016: + HASH_RETURN(0x77049D04A015CFB0LL, k_CURLE_SSL_CONNECT_ERROR, CURLE_SSL_CONNECT_ERROR); + break; + case 4020: + HASH_RETURN(0x2B900B2495727FB4LL, k_MW_BlobWarning, MW_BlobWarning); + break; + case 4022: + HASH_RETURN(0x339412C5F7495FB6LL, k_MYSQLI_TYPE_SHORT, MYSQLI_TYPE_SHORT); + break; + case 4025: + HASH_RETURN(0x193E526993AB4FB9LL, k_XSD_UNSIGNEDINT, XSD_UNSIGNEDINT); + HASH_RETURN(0x38F861239B0EFFB9LL, k_T_INLINE_HTML, T_INLINE_HTML); + break; + case 4031: + HASH_RETURN(0x4D61C903BCFCFFBFLL, k_SO_LINGER, SO_LINGER); + HASH_RETURN(0x1FB47E4AED84BFBFLL, k_SOCKET_EDESTADDRREQ, SOCKET_EDESTADDRREQ); + break; + case 4033: + HASH_RETURN(0x678C7AD918180FC1LL, k_LIBXML_XINCLUDE, LIBXML_XINCLUDE); + HASH_RETURN(0x1DD087C403394FC1LL, k_MW_RoundJoin, MW_RoundJoin); + break; + case 4036: + HASH_RETURN(0x482BF7BC7B15BFC4LL, k_T_CONST, T_CONST); + break; + case 4039: + HASH_RETURN(0x1A3B8F1D6084CFC7LL, k_MCC_ARG_DGRAM_NTRIES, MCC_ARG_DGRAM_NTRIES); + HASH_RETURN(0x484FD8889240CFC7LL, k_MCC_CONSISTENCY_MATCH_HITS, MCC_CONSISTENCY_MATCH_HITS); + break; + case 4040: + HASH_RETURN(0x79AE2B0243A62FC8LL, k_OCI_TEMP_CLOB, OCI_TEMP_CLOB); + break; + case 4045: + HASH_RETURN(0x3D1197127A5E0FCDLL, k_MW_UndefinedAlign, MW_UndefinedAlign); + HASH_RETURN(0x1103959ABEBC4FCDLL, k_CLOCK_MONOTONIC, CLOCK_MONOTONIC); + break; + case 4048: + HASH_RETURN(0x05978953F6931FD0LL, k_OPENSSL_KEYTYPE_RSA, OPENSSL_KEYTYPE_RSA); + HASH_RETURN(0x055211EDDE948FD0LL, k_MYSQLI_SET_CHARSET_NAME, MYSQLI_SET_CHARSET_NAME); + break; + case 4049: + HASH_RETURN(0x64724464BCA1EFD1LL, k_CURLOPT_TIMEOUT, CURLOPT_TIMEOUT); + HASH_RETURN(0x310C6D062D9BFFD1LL, k_SQLT_CHR, SQLT_CHR); + break; + case 4052: + HASH_RETURN(0x3ED583CF6153BFD4LL, k_SIGTRAP, SIGTRAP); + break; + case 4053: + HASH_RETURN(0x2F829788E900DFD5LL, k_ASSERT_CALLBACK, ASSERT_CALLBACK); + HASH_RETURN(0x6375BADBAD5E2FD5LL, k_PREG_PATTERN_ORDER, PREG_PATTERN_ORDER); + break; + case 4055: + HASH_RETURN(0x55A8589222089FD7LL, k_MCRYPT_3DES, MCRYPT_3DES); + HASH_RETURN(0x023EEFFE2C1F4FD7LL, k_U_MULTIPLE_PERCENT_SYMBOLS, U_MULTIPLE_PERCENT_SYMBOLS); + break; + case 4058: + HASH_RETURN(0x341D6D9590056FDALL, k_WSDL_CACHE_DISK, WSDL_CACHE_DISK); + break; + case 4060: + HASH_RETURN(0x2D0647CFC259DFDCLL, k_ABDAY_7, ABDAY_7); + break; + case 4062: + HASH_RETURN(0x3C8D16E92D328FDELL, k_CURLOPT_LOW_SPEED_LIMIT, CURLOPT_LOW_SPEED_LIMIT); + HASH_RETURN(0x06B7CD4014BFAFDELL, k_U_PARSE_ERROR_START, U_PARSE_ERROR_START); + break; + case 4065: + HASH_RETURN(0x62635468A89CEFE1LL, k_T_PRINT, T_PRINT); + break; + case 4069: + HASH_RETURN(0x62D75B029DE29FE5LL, k_U_BRK_SEMICOLON_EXPECTED, U_BRK_SEMICOLON_EXPECTED); + break; + case 4071: + HASH_RETURN(0x2E6828A987B93FE7LL, k_CURLCLOSEPOLICY_CALLBACK, CURLCLOSEPOLICY_CALLBACK); + break; + case 4073: + HASH_RETURN(0x3CB7E2EF1C506FE9LL, k_MW_EdgeDetectPreview, MW_EdgeDetectPreview); + break; + case 4075: + HASH_RETURN(0x2B32349F3EB0DFEBLL, k_MW_CopyBlueCompositeOp, MW_CopyBlueCompositeOp); + break; + case 4076: + HASH_RETURN(0x2945A3EB70577FECLL, k_LIBXML_NSCLEAN, LIBXML_NSCLEAN); + break; + case 4079: + HASH_RETURN(0x1731A36EFEE33FEFLL, k_MW_EvenOddRule, MW_EvenOddRule); + break; + case 4083: + HASH_RETURN(0x535FA2057826AFF3LL, k_MW_ZipCompression, MW_ZipCompression); + break; + case 4085: + HASH_RETURN(0x4FA2748CCA81BFF5LL, k_OPENSSL_ALGO_MD4, OPENSSL_ALGO_MD4); + break; + case 4088: + HASH_RETURN(0x3A0888E313510FF8LL, k_ABMON_2, ABMON_2); + break; + case 4094: + HASH_RETURN(0x2DFDB60E31F90FFELL, k_STREAM_MUST_SEEK, STREAM_MUST_SEEK); + break; + case 4095: + HASH_RETURN(0x1CFC3805FEC22FFFLL, k_LOG_NOTICE, LOG_NOTICE); + break; + default: + break; + } + return name; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/sys/dynamic_table_file.no.cpp b/src/lib/system/gen/sys/dynamic_table_file.no.cpp new file mode 100644 index 0000000000000..ff25d2c093350 --- /dev/null +++ b/src/lib/system/gen/sys/dynamic_table_file.no.cpp @@ -0,0 +1,29 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/sys/dynamic_table_func.no.cpp b/src/lib/system/gen/sys/dynamic_table_func.no.cpp new file mode 100644 index 0000000000000..84c035fafeb1e --- /dev/null +++ b/src/lib/system/gen/sys/dynamic_table_func.no.cpp @@ -0,0 +1,54894 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// Function Invoke Proxies + +// Function Invoke Table +Variant i_utf8_encode(CArrRef params) { + FUNCTION_INJECTION(utf8_encode); + return (f_utf8_encode(params.rvalAt(0))); +} +Variant i_func_get_args(CArrRef params) { + FUNCTION_INJECTION(func_get_args); + return (f_func_get_args()); +} +Variant i_php_uname(CArrRef params) { + FUNCTION_INJECTION(php_uname); + int count = params.size(); + if (count <= 0) return (f_php_uname()); + return (f_php_uname(params.rvalAt(0))); +} +Variant i_posix_uname(CArrRef params) { + FUNCTION_INJECTION(posix_uname); + return (f_posix_uname()); +} +Variant i_curl_multi_remove_handle(CArrRef params) { + FUNCTION_INJECTION(curl_multi_remove_handle); + return (f_curl_multi_remove_handle(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mysql_result(CArrRef params) { + FUNCTION_INJECTION(mysql_result); + int count = params.size(); + if (count <= 2) return (f_mysql_result(params.rvalAt(0), params.rvalAt(1))); + return (f_mysql_result(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_register_shutdown_function(CArrRef params) { + FUNCTION_INJECTION(register_shutdown_function); + int count = params.size(); + if (count <= 1) return (f_register_shutdown_function(count, params.rvalAt(0)), null); + return (f_register_shutdown_function(count,params.rvalAt(0), params.slice(1, count - 1, false)), null); +} +Variant i_pixelsetmagentaquantum(CArrRef params) { + FUNCTION_INJECTION(pixelsetmagentaquantum); + return (f_pixelsetmagentaquantum(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_newmagickwand(CArrRef params) { + FUNCTION_INJECTION(newmagickwand); + return (f_newmagickwand()); +} +Variant i_natsort(CArrRef params) { + FUNCTION_INJECTION(natsort); + return (f_natsort(ref(const_cast(params).lvalAt(0)))); +} +Variant i_socket_accept(CArrRef params) { + FUNCTION_INJECTION(socket_accept); + return (f_socket_accept(params.rvalAt(0))); +} +Variant i_vprintf(CArrRef params) { + FUNCTION_INJECTION(vprintf); + return (f_vprintf(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ucwords(CArrRef params) { + FUNCTION_INJECTION(ucwords); + return (f_ucwords(params.rvalAt(0))); +} +Variant i_header(CArrRef params) { + FUNCTION_INJECTION(header); + int count = params.size(); + if (count <= 1) return (f_header(params.rvalAt(0)), null); + if (count == 2) return (f_header(params.rvalAt(0), params.rvalAt(1)), null); + return (f_header(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_date_default_timezone_set(CArrRef params) { + FUNCTION_INJECTION(date_default_timezone_set); + return (f_date_default_timezone_set(params.rvalAt(0))); +} +Variant i_fbml_get_children_by_name_11(CArrRef params) { + FUNCTION_INJECTION(fbml_get_children_by_name_11); + return (f_fbml_get_children_by_name_11(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_is_object(CArrRef params) { + FUNCTION_INJECTION(is_object); + return (f_is_object(params.rvalAt(0))); +} +Variant i_magicksetimagebias(CArrRef params) { + FUNCTION_INJECTION(magicksetimagebias); + return (f_magicksetimagebias(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_exif_imagetype(CArrRef params) { + FUNCTION_INJECTION(exif_imagetype); + return (f_exif_imagetype(params.rvalAt(0))); +} +Variant i_imagegrabscreen(CArrRef params) { + FUNCTION_INJECTION(imagegrabscreen); + return (f_imagegrabscreen()); +} +Variant i_bcmod(CArrRef params) { + FUNCTION_INJECTION(bcmod); + return (f_bcmod(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_chr(CArrRef params) { + FUNCTION_INJECTION(chr); + return (f_chr(params.rvalAt(0))); +} +Variant i_drawsetfontstretch(CArrRef params) { + FUNCTION_INJECTION(drawsetfontstretch); + return (f_drawsetfontstretch(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_posix_setsid(CArrRef params) { + FUNCTION_INJECTION(posix_setsid); + return (f_posix_setsid()); +} +Variant i_posix_getpwnam(CArrRef params) { + FUNCTION_INJECTION(posix_getpwnam); + return (f_posix_getpwnam(params.rvalAt(0))); +} +Variant i_mcrypt_enc_get_supported_key_sizes(CArrRef params) { + FUNCTION_INJECTION(mcrypt_enc_get_supported_key_sizes); + return (f_mcrypt_enc_get_supported_key_sizes(params.rvalAt(0))); +} +Variant i_phpinfo(CArrRef params) { + FUNCTION_INJECTION(phpinfo); + int count = params.size(); + if (count <= 0) return (f_phpinfo()); + return (f_phpinfo(params.rvalAt(0))); +} +Variant i_evhttp_async_get(CArrRef params) { + FUNCTION_INJECTION(evhttp_async_get); + int count = params.size(); + if (count <= 1) return (f_evhttp_async_get(params.rvalAt(0))); + if (count == 2) return (f_evhttp_async_get(params.rvalAt(0), params.rvalAt(1))); + return (f_evhttp_async_get(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_ldap_parse_result(CArrRef params) { + FUNCTION_INJECTION(ldap_parse_result); + int count = params.size(); + if (count <= 3) return (f_ldap_parse_result(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + if (count == 4) return (f_ldap_parse_result(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)))); + if (count == 5) return (f_ldap_parse_result(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)), ref(const_cast(params).lvalAt(4)))); + return (f_ldap_parse_result(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)), ref(const_cast(params).lvalAt(4)), ref(const_cast(params).lvalAt(5)))); +} +Variant i_drawgettextantialias(CArrRef params) { + FUNCTION_INJECTION(drawgettextantialias); + return (f_drawgettextantialias(params.rvalAt(0))); +} +Variant i_array_fill_keys(CArrRef params) { + FUNCTION_INJECTION(array_fill_keys); + return (f_array_fill_keys(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_openssl_seal(CArrRef params) { + FUNCTION_INJECTION(openssl_seal); + return (f_openssl_seal(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); +} +Variant i_socket_clear_error(CArrRef params) { + FUNCTION_INJECTION(socket_clear_error); + int count = params.size(); + if (count <= 0) return (f_socket_clear_error(), null); + return (f_socket_clear_error(params.rvalAt(0)), null); +} +Variant i_die(CArrRef params) { + FUNCTION_INJECTION(die); + int count = params.size(); + if (count <= 0) return (f_die()); + return (f_die(params.rvalAt(0))); +} +Variant i_diskfreespace(CArrRef params) { + FUNCTION_INJECTION(diskfreespace); + return (f_diskfreespace(params.rvalAt(0))); +} +Variant i_xml_set_start_namespace_decl_handler(CArrRef params) { + FUNCTION_INJECTION(xml_set_start_namespace_decl_handler); + return (f_xml_set_start_namespace_decl_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_decbin(CArrRef params) { + FUNCTION_INJECTION(decbin); + return (f_decbin(params.rvalAt(0))); +} +Variant i_sizeof(CArrRef params) { + FUNCTION_INJECTION(sizeof); + int count = params.size(); + if (count <= 1) return (f_sizeof(params.rvalAt(0))); + return (f_sizeof(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_convert_case(CArrRef params) { + FUNCTION_INJECTION(mb_convert_case); + int count = params.size(); + if (count <= 2) return (f_mb_convert_case(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_convert_case(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_dir(CArrRef params) { + FUNCTION_INJECTION(dir); + return (f_dir(params.rvalAt(0))); +} +Variant i_array_combine(CArrRef params) { + FUNCTION_INJECTION(array_combine); + return (f_array_combine(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_strpos(CArrRef params) { + FUNCTION_INJECTION(strpos); + int count = params.size(); + if (count <= 2) return (f_strpos(params.rvalAt(0), params.rvalAt(1))); + return (f_strpos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_array_reverse(CArrRef params) { + FUNCTION_INJECTION(array_reverse); + int count = params.size(); + if (count <= 1) return (f_array_reverse(params.rvalAt(0))); + return (f_array_reverse(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_strrev(CArrRef params) { + FUNCTION_INJECTION(strrev); + return (f_strrev(params.rvalAt(0))); +} +Variant i_msg_set_queue(CArrRef params) { + FUNCTION_INJECTION(msg_set_queue); + return (f_msg_set_queue(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_cos(CArrRef params) { + FUNCTION_INJECTION(cos); + return (f_cos(params.rvalAt(0))); +} +Variant i_bcmul(CArrRef params) { + FUNCTION_INJECTION(bcmul); + int count = params.size(); + if (count <= 2) return (f_bcmul(params.rvalAt(0), params.rvalAt(1))); + return (f_bcmul(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_openlog(CArrRef params) { + FUNCTION_INJECTION(openlog); + return (f_openlog(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_get_include_path(CArrRef params) { + FUNCTION_INJECTION(get_include_path); + return (f_get_include_path()); +} +Variant i_socket_select(CArrRef params) { + FUNCTION_INJECTION(socket_select); + int count = params.size(); + if (count <= 4) return (f_socket_select(ref(const_cast(params).lvalAt(0)), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); + return (f_socket_select(ref(const_cast(params).lvalAt(0)), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_magickraiseimage(CArrRef params) { + FUNCTION_INJECTION(magickraiseimage); + return (f_magickraiseimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_gzputs(CArrRef params) { + FUNCTION_INJECTION(gzputs); + int count = params.size(); + if (count <= 2) return (f_gzputs(params.rvalAt(0), params.rvalAt(1))); + return (f_gzputs(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_strpbrk(CArrRef params) { + FUNCTION_INJECTION(strpbrk); + return (f_strpbrk(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_shm_remove_var(CArrRef params) { + FUNCTION_INJECTION(shm_remove_var); + return (f_shm_remove_var(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_posix_setuid(CArrRef params) { + FUNCTION_INJECTION(posix_setuid); + return (f_posix_setuid(params.rvalAt(0))); +} +Variant i_pixelgetyellow(CArrRef params) { + FUNCTION_INJECTION(pixelgetyellow); + return (f_pixelgetyellow(params.rvalAt(0))); +} +Variant i_convert_uudecode(CArrRef params) { + FUNCTION_INJECTION(convert_uudecode); + return (f_convert_uudecode(params.rvalAt(0))); +} +Variant i_htmlspecialchars_decode(CArrRef params) { + FUNCTION_INJECTION(htmlspecialchars_decode); + int count = params.size(); + if (count <= 1) return (f_htmlspecialchars_decode(params.rvalAt(0))); + return (f_htmlspecialchars_decode(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xmlwriter_end_document(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_end_document); + return (f_xmlwriter_end_document(params.rvalAt(0))); +} +Variant i_magickgetimagehistogram(CArrRef params) { + FUNCTION_INJECTION(magickgetimagehistogram); + return (f_magickgetimagehistogram(params.rvalAt(0))); +} +Variant i_preg_last_error(CArrRef params) { + FUNCTION_INJECTION(preg_last_error); + return (f_preg_last_error()); +} +Variant i_end(CArrRef params) { + FUNCTION_INJECTION(end); + return (f_end(ref(const_cast(params).lvalAt(0)))); +} +Variant i_stream_get_line(CArrRef params) { + FUNCTION_INJECTION(stream_get_line); + int count = params.size(); + if (count <= 1) return (f_stream_get_line(params.rvalAt(0))); + if (count == 2) return (f_stream_get_line(params.rvalAt(0), params.rvalAt(1))); + return (f_stream_get_line(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_deg2rad(CArrRef params) { + FUNCTION_INJECTION(deg2rad); + return (f_deg2rad(params.rvalAt(0))); +} +Variant i_magickrollimage(CArrRef params) { + FUNCTION_INJECTION(magickrollimage); + return (f_magickrollimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_ldap_sort(CArrRef params) { + FUNCTION_INJECTION(ldap_sort); + return (f_ldap_sort(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagetruecolortopalette(CArrRef params) { + FUNCTION_INJECTION(imagetruecolortopalette); + return (f_imagetruecolortopalette(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_defined(CArrRef params) { + FUNCTION_INJECTION(defined); + return (f_defined(params.rvalAt(0))); +} +Variant i_magickgetimageunits(CArrRef params) { + FUNCTION_INJECTION(magickgetimageunits); + return (f_magickgetimageunits(params.rvalAt(0))); +} +Variant i_magicksetimageblueprimary(CArrRef params) { + FUNCTION_INJECTION(magicksetimageblueprimary); + return (f_magicksetimageblueprimary(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_get_class_vars(CArrRef params) { + FUNCTION_INJECTION(get_class_vars); + return (f_get_class_vars(params.rvalAt(0))); +} +Variant i_syslog(CArrRef params) { + FUNCTION_INJECTION(syslog); + return (f_syslog(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_array_unique(CArrRef params) { + FUNCTION_INJECTION(array_unique); + return (f_array_unique(params.rvalAt(0))); +} +Variant i_bcpow(CArrRef params) { + FUNCTION_INJECTION(bcpow); + int count = params.size(); + if (count <= 2) return (f_bcpow(params.rvalAt(0), params.rvalAt(1))); + return (f_bcpow(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_pixelgetopacityquantum(CArrRef params) { + FUNCTION_INJECTION(pixelgetopacityquantum); + return (f_pixelgetopacityquantum(params.rvalAt(0))); +} +Variant i_php_check_syntax(CArrRef params) { + FUNCTION_INJECTION(php_check_syntax); + int count = params.size(); + if (count <= 1) return (f_php_check_syntax(params.rvalAt(0))); + return (f_php_check_syntax(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); +} +Variant i_drawgetstrokemiterlimit(CArrRef params) { + FUNCTION_INJECTION(drawgetstrokemiterlimit); + return (f_drawgetstrokemiterlimit(params.rvalAt(0))); +} +Variant i_pixelsetquantumcolor(CArrRef params) { + FUNCTION_INJECTION(pixelsetquantumcolor); + int count = params.size(); + if (count <= 4) return (f_pixelsetquantumcolor(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); + return (f_pixelsetquantumcolor(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); +} +Variant i_gztell(CArrRef params) { + FUNCTION_INJECTION(gztell); + return (f_gztell(params.rvalAt(0))); +} +Variant i_strval(CArrRef params) { + FUNCTION_INJECTION(strval); + return (f_strval(params.rvalAt(0))); +} +Variant i_evhttp_recv(CArrRef params) { + FUNCTION_INJECTION(evhttp_recv); + return (f_evhttp_recv(params.rvalAt(0))); +} +Variant i_strspn(CArrRef params) { + FUNCTION_INJECTION(strspn); + int count = params.size(); + if (count <= 2) return (f_strspn(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_strspn(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_strspn(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_ini_restore(CArrRef params) { + FUNCTION_INJECTION(ini_restore); + return (f_ini_restore(params.rvalAt(0)), null); +} +Variant i_ldap_dn2ufn(CArrRef params) { + FUNCTION_INJECTION(ldap_dn2ufn); + return (f_ldap_dn2ufn(params.rvalAt(0))); +} +Variant i_ceil(CArrRef params) { + FUNCTION_INJECTION(ceil); + return (f_ceil(params.rvalAt(0))); +} +Variant i_xmlwriter_end_dtd_attlist(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_end_dtd_attlist); + return (f_xmlwriter_end_dtd_attlist(params.rvalAt(0))); +} +Variant i_phpversion(CArrRef params) { + FUNCTION_INJECTION(phpversion); + int count = params.size(); + if (count <= 0) return (f_phpversion()); + return (f_phpversion(params.rvalAt(0))); +} +Variant i_stream_filter_remove(CArrRef params) { + FUNCTION_INJECTION(stream_filter_remove); + return (f_stream_filter_remove(params.rvalAt(0))); +} +Variant i_mcrypt_generic(CArrRef params) { + FUNCTION_INJECTION(mcrypt_generic); + return (f_mcrypt_generic(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_is_file(CArrRef params) { + FUNCTION_INJECTION(is_file); + return (f_is_file(params.rvalAt(0))); +} +Variant i_xml_set_end_namespace_decl_handler(CArrRef params) { + FUNCTION_INJECTION(xml_set_end_namespace_decl_handler); + return (f_xml_set_end_namespace_decl_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_openssl_x509_export_to_file(CArrRef params) { + FUNCTION_INJECTION(openssl_x509_export_to_file); + int count = params.size(); + if (count <= 2) return (f_openssl_x509_export_to_file(params.rvalAt(0), params.rvalAt(1))); + return (f_openssl_x509_export_to_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagesetstyle(CArrRef params) { + FUNCTION_INJECTION(imagesetstyle); + return (f_imagesetstyle(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawcolor(CArrRef params) { + FUNCTION_INJECTION(drawcolor); + return (f_drawcolor(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); +} +Variant i_get_headers(CArrRef params) { + FUNCTION_INJECTION(get_headers); + int count = params.size(); + if (count <= 1) return (f_get_headers(params.rvalAt(0))); + return (f_get_headers(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mysql_drop_db(CArrRef params) { + FUNCTION_INJECTION(mysql_drop_db); + int count = params.size(); + if (count <= 1) return (f_mysql_drop_db(params.rvalAt(0))); + return (f_mysql_drop_db(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickresampleimage(CArrRef params) { + FUNCTION_INJECTION(magickresampleimage); + return (f_magickresampleimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_i18n_loc_get_default(CArrRef params) { + FUNCTION_INJECTION(i18n_loc_get_default); + return (f_i18n_loc_get_default()); +} +Variant i_strtok(CArrRef params) { + FUNCTION_INJECTION(strtok); + int count = params.size(); + if (count <= 1) return (f_strtok(params.rvalAt(0))); + return (f_strtok(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_array_key_exists(CArrRef params) { + FUNCTION_INJECTION(array_key_exists); + return (f_array_key_exists(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_exp(CArrRef params) { + FUNCTION_INJECTION(exp); + return (f_exp(params.rvalAt(0))); +} +Variant i_strstr(CArrRef params) { + FUNCTION_INJECTION(strstr); + return (f_strstr(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_realpath(CArrRef params) { + FUNCTION_INJECTION(realpath); + return (f_realpath(params.rvalAt(0))); +} +Variant i_stream_filter_append(CArrRef params) { + FUNCTION_INJECTION(stream_filter_append); + int count = params.size(); + if (count <= 2) return (f_stream_filter_append(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_stream_filter_append(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_stream_filter_append(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_oci_bind_by_name(CArrRef params) { + FUNCTION_INJECTION(oci_bind_by_name); + int count = params.size(); + if (count <= 3) return (f_oci_bind_by_name(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + if (count == 4) return (f_oci_bind_by_name(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); + return (f_oci_bind_by_name(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_hphp_get_property(CArrRef params) { + FUNCTION_INJECTION(hphp_get_property); + return (f_hphp_get_property(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickgetcharheight(CArrRef params) { + FUNCTION_INJECTION(magickgetcharheight); + int count = params.size(); + if (count <= 3) return (f_magickgetcharheight(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickgetcharheight(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_imagerotate(CArrRef params) { + FUNCTION_INJECTION(imagerotate); + int count = params.size(); + if (count <= 3) return (f_imagerotate(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_imagerotate(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magickcompositeimage(CArrRef params) { + FUNCTION_INJECTION(magickcompositeimage); + return (f_magickcompositeimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_openssl_sign(CArrRef params) { + FUNCTION_INJECTION(openssl_sign); + int count = params.size(); + if (count <= 3) return (f_openssl_sign(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); + return (f_openssl_sign(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_version_compare(CArrRef params) { + FUNCTION_INJECTION(version_compare); + int count = params.size(); + if (count <= 2) return (f_version_compare(params.rvalAt(0), params.rvalAt(1))); + return (f_version_compare(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_timezone_name_get(CArrRef params) { + FUNCTION_INJECTION(timezone_name_get); + return (f_timezone_name_get(params.rvalAt(0))); +} +Variant i_posix_getpgid(CArrRef params) { + FUNCTION_INJECTION(posix_getpgid); + return (f_posix_getpgid(params.rvalAt(0))); +} +Variant i_imagestring(CArrRef params) { + FUNCTION_INJECTION(imagestring); + return (f_imagestring(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_mcrypt_list_modes(CArrRef params) { + FUNCTION_INJECTION(mcrypt_list_modes); + int count = params.size(); + if (count <= 0) return (f_mcrypt_list_modes()); + return (f_mcrypt_list_modes(params.rvalAt(0))); +} +Variant i_mcrypt_list_algorithms(CArrRef params) { + FUNCTION_INJECTION(mcrypt_list_algorithms); + int count = params.size(); + if (count <= 0) return (f_mcrypt_list_algorithms()); + return (f_mcrypt_list_algorithms(params.rvalAt(0))); +} +Variant i_mcrypt_get_cipher_name(CArrRef params) { + FUNCTION_INJECTION(mcrypt_get_cipher_name); + return (f_mcrypt_get_cipher_name(params.rvalAt(0))); +} +Variant i_idn_to_unicode(CArrRef params) { + FUNCTION_INJECTION(idn_to_unicode); + int count = params.size(); + if (count <= 1) return (f_idn_to_unicode(params.rvalAt(0))); + return (f_idn_to_unicode(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); +} +Variant i_lchown(CArrRef params) { + FUNCTION_INJECTION(lchown); + return (f_lchown(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawcomposite(CArrRef params) { + FUNCTION_INJECTION(drawcomposite); + return (f_drawcomposite(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); +} +Variant i_dechex(CArrRef params) { + FUNCTION_INJECTION(dechex); + return (f_dechex(params.rvalAt(0))); +} +Variant i_imagecolortransparent(CArrRef params) { + FUNCTION_INJECTION(imagecolortransparent); + int count = params.size(); + if (count <= 1) return (f_imagecolortransparent(params.rvalAt(0))); + return (f_imagecolortransparent(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_socket_get_option(CArrRef params) { + FUNCTION_INJECTION(socket_get_option); + return (f_socket_get_option(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_stream_filter_register(CArrRef params) { + FUNCTION_INJECTION(stream_filter_register); + return (f_stream_filter_register(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_apache_response_headers(CArrRef params) { + FUNCTION_INJECTION(apache_response_headers); + return (f_apache_response_headers()); +} +Variant i_array_merge(CArrRef params) { + FUNCTION_INJECTION(array_merge); + int count = params.size(); + if (count <= 1) return (f_array_merge(count, params.rvalAt(0))); + return (f_array_merge(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_phprof_disable(CArrRef params) { + FUNCTION_INJECTION(phprof_disable); + return (f_phprof_disable()); +} +Variant i_md5(CArrRef params) { + FUNCTION_INJECTION(md5); + int count = params.size(); + if (count <= 1) return (f_md5(params.rvalAt(0))); + return (f_md5(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_bcsub(CArrRef params) { + FUNCTION_INJECTION(bcsub); + int count = params.size(); + if (count <= 2) return (f_bcsub(params.rvalAt(0), params.rvalAt(1))); + return (f_bcsub(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_xmlwriter_flush(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_flush); + int count = params.size(); + if (count <= 1) return (f_xmlwriter_flush(params.rvalAt(0))); + return (f_xmlwriter_flush(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_sha1_file(CArrRef params) { + FUNCTION_INJECTION(sha1_file); + int count = params.size(); + if (count <= 1) return (f_sha1_file(params.rvalAt(0))); + return (f_sha1_file(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_posix_ctermid(CArrRef params) { + FUNCTION_INJECTION(posix_ctermid); + return (f_posix_ctermid()); +} +Variant i_date(CArrRef params) { + FUNCTION_INJECTION(date); + int count = params.size(); + if (count <= 1) return (f_date(params.rvalAt(0))); + return (f_date(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_evhttp_post(CArrRef params) { + FUNCTION_INJECTION(evhttp_post); + int count = params.size(); + if (count <= 2) return (f_evhttp_post(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_evhttp_post(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_evhttp_post(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_ldap_connect(CArrRef params) { + FUNCTION_INJECTION(ldap_connect); + int count = params.size(); + if (count <= 0) return (f_ldap_connect()); + if (count == 1) return (f_ldap_connect(params.rvalAt(0))); + return (f_ldap_connect(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_shuffle(CArrRef params) { + FUNCTION_INJECTION(shuffle); + return (f_shuffle(ref(const_cast(params).lvalAt(0)))); +} +Variant i_mcrypt_module_get_algo_block_size(CArrRef params) { + FUNCTION_INJECTION(mcrypt_module_get_algo_block_size); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_get_algo_block_size(params.rvalAt(0))); + return (f_mcrypt_module_get_algo_block_size(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_key(CArrRef params) { + FUNCTION_INJECTION(key); + return (f_key(ref(const_cast(params).lvalAt(0)))); +} +Variant i_xmlwriter_start_dtd_entity(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_dtd_entity); + return (f_xmlwriter_start_dtd_entity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_readfile(CArrRef params) { + FUNCTION_INJECTION(readfile); + int count = params.size(); + if (count <= 1) return (f_readfile(params.rvalAt(0))); + if (count == 2) return (f_readfile(params.rvalAt(0), params.rvalAt(1))); + return (f_readfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_atan(CArrRef params) { + FUNCTION_INJECTION(atan); + return (f_atan(params.rvalAt(0))); +} +Variant i_magickmodulateimage(CArrRef params) { + FUNCTION_INJECTION(magickmodulateimage); + return (f_magickmodulateimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_mysql_set_charset(CArrRef params) { + FUNCTION_INJECTION(mysql_set_charset); + int count = params.size(); + if (count <= 1) return (f_mysql_set_charset(params.rvalAt(0))); + return (f_mysql_set_charset(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetfontweight(CArrRef params) { + FUNCTION_INJECTION(drawgetfontweight); + return (f_drawgetfontweight(params.rvalAt(0))); +} +Variant i_magickgetimageheight(CArrRef params) { + FUNCTION_INJECTION(magickgetimageheight); + return (f_magickgetimageheight(params.rvalAt(0))); +} +Variant i_posix_getpgrp(CArrRef params) { + FUNCTION_INJECTION(posix_getpgrp); + return (f_posix_getpgrp()); +} +Variant i_i18n_loc_get_error_code(CArrRef params) { + FUNCTION_INJECTION(i18n_loc_get_error_code); + return (f_i18n_loc_get_error_code()); +} +Variant i_hash_file(CArrRef params) { + FUNCTION_INJECTION(hash_file); + int count = params.size(); + if (count <= 2) return (f_hash_file(params.rvalAt(0), params.rvalAt(1))); + return (f_hash_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_is_callable(CArrRef params) { + FUNCTION_INJECTION(is_callable); + int count = params.size(); + if (count <= 1) return (f_is_callable(params.rvalAt(0))); + if (count == 2) return (f_is_callable(params.rvalAt(0), params.rvalAt(1))); + return (f_is_callable(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_asin(CArrRef params) { + FUNCTION_INJECTION(asin); + return (f_asin(params.rvalAt(0))); +} +Variant i_openssl_public_encrypt(CArrRef params) { + FUNCTION_INJECTION(openssl_public_encrypt); + int count = params.size(); + if (count <= 3) return (f_openssl_public_encrypt(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); + return (f_openssl_public_encrypt(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_curl_multi_init(CArrRef params) { + FUNCTION_INJECTION(curl_multi_init); + return (f_curl_multi_init()); +} +Variant i_posix_getpwuid(CArrRef params) { + FUNCTION_INJECTION(posix_getpwuid); + return (f_posix_getpwuid(params.rvalAt(0))); +} +Variant i_json_encode(CArrRef params) { + FUNCTION_INJECTION(json_encode); + int count = params.size(); + if (count <= 1) return (f_json_encode(params.rvalAt(0))); + return (f_json_encode(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_show_source(CArrRef params) { + FUNCTION_INJECTION(show_source); + int count = params.size(); + if (count <= 1) return (f_show_source(params.rvalAt(0))); + return (f_show_source(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mcrypt_module_self_test(CArrRef params) { + FUNCTION_INJECTION(mcrypt_module_self_test); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_self_test(params.rvalAt(0))); + return (f_mcrypt_module_self_test(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_sscanf(CArrRef params) { + FUNCTION_INJECTION(sscanf); + int count = params.size(); + if (count <= 2) return (f_sscanf(count, params.rvalAt(0), params.rvalAt(1))); + return (f_sscanf(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_chop(CArrRef params) { + FUNCTION_INJECTION(chop); + int count = params.size(); + if (count <= 1) return (f_chop(params.rvalAt(0))); + return (f_chop(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_convert_variables(CArrRef params) { + FUNCTION_INJECTION(mb_convert_variables); + int count = params.size(); + if (count <= 3) return (f_mb_convert_variables(count, params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + return (f_mb_convert_variables(count,params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.slice(3, count - 3, false))); +} +Variant i_fbml_render_children_11(CArrRef params) { + FUNCTION_INJECTION(fbml_render_children_11); + int count = params.size(); + if (count <= 4) return (f_fbml_render_children_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_fbml_render_children_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_socket_close(CArrRef params) { + FUNCTION_INJECTION(socket_close); + return (f_socket_close(params.rvalAt(0)), null); +} +Variant i_max(CArrRef params) { + FUNCTION_INJECTION(max); + int count = params.size(); + if (count <= 1) return (f_max(count, params.rvalAt(0))); + return (f_max(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_magickadaptivethresholdimage(CArrRef params) { + FUNCTION_INJECTION(magickadaptivethresholdimage); + return (f_magickadaptivethresholdimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_each(CArrRef params) { + FUNCTION_INJECTION(each); + return (f_each(ref(const_cast(params).lvalAt(0)))); +} +Variant i_magickremoveimageprofiles(CArrRef params) { + FUNCTION_INJECTION(magickremoveimageprofiles); + return (f_magickremoveimageprofiles(params.rvalAt(0))); +} +Variant i_drawgettextalignment(CArrRef params) { + FUNCTION_INJECTION(drawgettextalignment); + return (f_drawgettextalignment(params.rvalAt(0))); +} +Variant i_xbox_send_message(CArrRef params) { + FUNCTION_INJECTION(xbox_send_message); + int count = params.size(); + if (count <= 3) return (f_xbox_send_message(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); + return (f_xbox_send_message(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_thrift_protocol_write_binary(CArrRef params) { + FUNCTION_INJECTION(thrift_protocol_write_binary); + return (f_thrift_protocol_write_binary(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5)), null); +} +Variant i_wandgetexceptiontype(CArrRef params) { + FUNCTION_INJECTION(wandgetexceptiontype); + return (f_wandgetexceptiontype(params.rvalAt(0))); +} +Variant i_drawpathellipticarcabsolute(CArrRef params) { + FUNCTION_INJECTION(drawpathellipticarcabsolute); + return (f_drawpathellipticarcabsolute(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7)), null); +} +Variant i_pixelsetgreen(CArrRef params) { + FUNCTION_INJECTION(pixelsetgreen); + return (f_pixelsetgreen(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_magickgetimagecolorspace(CArrRef params) { + FUNCTION_INJECTION(magickgetimagecolorspace); + return (f_magickgetimagecolorspace(params.rvalAt(0))); +} +Variant i_pixelsetalphaquantum(CArrRef params) { + FUNCTION_INJECTION(pixelsetalphaquantum); + return (f_pixelsetalphaquantum(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_stream_bucket_append(CArrRef params) { + FUNCTION_INJECTION(stream_bucket_append); + return (f_stream_bucket_append(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_msg_stat_queue(CArrRef params) { + FUNCTION_INJECTION(msg_stat_queue); + return (f_msg_stat_queue(params.rvalAt(0))); +} +Variant i_system(CArrRef params) { + FUNCTION_INJECTION(system); + int count = params.size(); + if (count <= 1) return (f_system(params.rvalAt(0))); + return (f_system(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); +} +Variant i_mb_parse_str(CArrRef params) { + FUNCTION_INJECTION(mb_parse_str); + int count = params.size(); + if (count <= 1) return (f_mb_parse_str(params.rvalAt(0))); + return (f_mb_parse_str(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); +} +Variant i_log(CArrRef params) { + FUNCTION_INJECTION(log); + int count = params.size(); + if (count <= 1) return (f_log(params.rvalAt(0))); + return (f_log(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawskewx(CArrRef params) { + FUNCTION_INJECTION(drawskewx); + return (f_drawskewx(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_min(CArrRef params) { + FUNCTION_INJECTION(min); + int count = params.size(); + if (count <= 1) return (f_min(count, params.rvalAt(0))); + return (f_min(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_curl_multi_getcontent(CArrRef params) { + FUNCTION_INJECTION(curl_multi_getcontent); + return (f_curl_multi_getcontent(params.rvalAt(0))); +} +Variant i_drawskewy(CArrRef params) { + FUNCTION_INJECTION(drawskewy); + return (f_drawskewy(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_is_uploaded_file(CArrRef params) { + FUNCTION_INJECTION(is_uploaded_file); + return (f_is_uploaded_file(params.rvalAt(0))); +} +Variant i_magicksetresourcelimit(CArrRef params) { + FUNCTION_INJECTION(magicksetresourcelimit); + return (f_magicksetresourcelimit(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_date_timezone_get(CArrRef params) { + FUNCTION_INJECTION(date_timezone_get); + return (f_date_timezone_get(params.rvalAt(0))); +} +Variant i_apache_get_rewrite_rules(CArrRef params) { + FUNCTION_INJECTION(apache_get_rewrite_rules); + return (f_apache_get_rewrite_rules()); +} +Variant i_is_string(CArrRef params) { + FUNCTION_INJECTION(is_string); + return (f_is_string(params.rvalAt(0))); +} +Variant i_pcntl_wtermsig(CArrRef params) { + FUNCTION_INJECTION(pcntl_wtermsig); + return (f_pcntl_wtermsig(params.rvalAt(0))); +} +Variant i_stream_context_get_default(CArrRef params) { + FUNCTION_INJECTION(stream_context_get_default); + int count = params.size(); + if (count <= 0) return (f_stream_context_get_default()); + return (f_stream_context_get_default(params.rvalAt(0))); +} +Variant i_drawpathlinetorelative(CArrRef params) { + FUNCTION_INJECTION(drawpathlinetorelative); + return (f_drawpathlinetorelative(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_fql_parse_10(CArrRef params) { + FUNCTION_INJECTION(fql_parse_10); + return (f_fql_parse_10(params.rvalAt(0))); +} +Variant i_urlencode(CArrRef params) { + FUNCTION_INJECTION(urlencode); + return (f_urlencode(params.rvalAt(0))); +} +Variant i_mb_preferred_mime_name(CArrRef params) { + FUNCTION_INJECTION(mb_preferred_mime_name); + return (f_mb_preferred_mime_name(params.rvalAt(0))); +} +Variant i_pixelgetgreenquantum(CArrRef params) { + FUNCTION_INJECTION(pixelgetgreenquantum); + return (f_pixelgetgreenquantum(params.rvalAt(0))); +} +Variant i_magicksetfilename(CArrRef params) { + FUNCTION_INJECTION(magicksetfilename); + int count = params.size(); + if (count <= 1) return (f_magicksetfilename(params.rvalAt(0))); + return (f_magicksetfilename(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickappendimages(CArrRef params) { + FUNCTION_INJECTION(magickappendimages); + int count = params.size(); + if (count <= 1) return (f_magickappendimages(params.rvalAt(0))); + return (f_magickappendimages(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pcntl_wifstopped(CArrRef params) { + FUNCTION_INJECTION(pcntl_wifstopped); + return (f_pcntl_wifstopped(params.rvalAt(0))); +} +Variant i_mb_ereg_search(CArrRef params) { + FUNCTION_INJECTION(mb_ereg_search); + int count = params.size(); + if (count <= 0) return (f_mb_ereg_search()); + if (count == 1) return (f_mb_ereg_search(params.rvalAt(0))); + return (f_mb_ereg_search(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_rewind(CArrRef params) { + FUNCTION_INJECTION(rewind); + return (f_rewind(params.rvalAt(0))); +} +Variant i_chunk_split(CArrRef params) { + FUNCTION_INJECTION(chunk_split); + int count = params.size(); + if (count <= 1) return (f_chunk_split(params.rvalAt(0))); + if (count == 2) return (f_chunk_split(params.rvalAt(0), params.rvalAt(1))); + return (f_chunk_split(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mb_list_encodings_alias_names(CArrRef params) { + FUNCTION_INJECTION(mb_list_encodings_alias_names); + int count = params.size(); + if (count <= 0) return (f_mb_list_encodings_alias_names()); + return (f_mb_list_encodings_alias_names(params.rvalAt(0))); +} +Variant i_i18n_loc_set_attribute(CArrRef params) { + FUNCTION_INJECTION(i18n_loc_set_attribute); + return (f_i18n_loc_set_attribute(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pixelsynciterator(CArrRef params) { + FUNCTION_INJECTION(pixelsynciterator); + return (f_pixelsynciterator(params.rvalAt(0))); +} +Variant i_openssl_error_string(CArrRef params) { + FUNCTION_INJECTION(openssl_error_string); + return (f_openssl_error_string()); +} +Variant i_ismagickwand(CArrRef params) { + FUNCTION_INJECTION(ismagickwand); + return (f_ismagickwand(params.rvalAt(0))); +} +Variant i_strrchr(CArrRef params) { + FUNCTION_INJECTION(strrchr); + return (f_strrchr(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xmlwriter_start_dtd_element(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_dtd_element); + return (f_xmlwriter_start_dtd_element(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_str_ireplace(CArrRef params) { + FUNCTION_INJECTION(str_ireplace); + int count = params.size(); + if (count <= 3) return (f_str_ireplace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_str_ireplace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), ref(const_cast(params).lvalAt(3)))); +} +Variant i_magickpainttransparentimage(CArrRef params) { + FUNCTION_INJECTION(magickpainttransparentimage); + int count = params.size(); + if (count <= 2) return (f_magickpainttransparentimage(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_magickpainttransparentimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickpainttransparentimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawsettextundercolor(CArrRef params) { + FUNCTION_INJECTION(drawsettextundercolor); + return (f_drawsettextundercolor(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_magickgetstringwidth(CArrRef params) { + FUNCTION_INJECTION(magickgetstringwidth); + int count = params.size(); + if (count <= 3) return (f_magickgetstringwidth(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickgetstringwidth(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_echo(CArrRef params) { + FUNCTION_INJECTION(echo); + int count = params.size(); + if (count <= 1) return (f_echo(count, params.rvalAt(0)), null); + return (f_echo(count,params.rvalAt(0), params.slice(1, count - 1, false)), null); +} +Variant i_ldap_parse_reference(CArrRef params) { + FUNCTION_INJECTION(ldap_parse_reference); + return (f_ldap_parse_reference(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_ctype_xdigit(CArrRef params) { + FUNCTION_INJECTION(ctype_xdigit); + return (f_ctype_xdigit(params.rvalAt(0))); +} +Variant i_gmstrftime(CArrRef params) { + FUNCTION_INJECTION(gmstrftime); + int count = params.size(); + if (count <= 1) return (f_gmstrftime(params.rvalAt(0))); + return (f_gmstrftime(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_stream_socket_get_name(CArrRef params) { + FUNCTION_INJECTION(stream_socket_get_name); + return (f_stream_socket_get_name(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_socket_set_option(CArrRef params) { + FUNCTION_INJECTION(socket_set_option); + return (f_socket_set_option(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_array_multisort(CArrRef params) { + FUNCTION_INJECTION(array_multisort); + int count = params.size(); + if (count <= 1) return (f_array_multisort(count, ref(const_cast(params).lvalAt(0)))); + return (f_array_multisort(count,ref(const_cast(params).lvalAt(0)), params.slice(1, count - 1, false))); +} +Variant i_imagepsbbox(CArrRef params) { + FUNCTION_INJECTION(imagepsbbox); + int count = params.size(); + if (count <= 3) return (f_imagepsbbox(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_imagepsbbox(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_imagepsbbox(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_imagepsbbox(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_drawpathlinetoverticalabsolute(CArrRef params) { + FUNCTION_INJECTION(drawpathlinetoverticalabsolute); + return (f_drawpathlinetoverticalabsolute(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mailparse_msg_get_structure(CArrRef params) { + FUNCTION_INJECTION(mailparse_msg_get_structure); + return (f_mailparse_msg_get_structure(params.rvalAt(0))); +} +Variant i_mb_ereg(CArrRef params) { + FUNCTION_INJECTION(mb_ereg); + int count = params.size(); + if (count <= 2) return (f_mb_ereg(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_ereg(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_decoct(CArrRef params) { + FUNCTION_INJECTION(decoct); + return (f_decoct(params.rvalAt(0))); +} +Variant i_xml_parse(CArrRef params) { + FUNCTION_INJECTION(xml_parse); + int count = params.size(); + if (count <= 2) return (f_xml_parse(params.rvalAt(0), params.rvalAt(1))); + return (f_xml_parse(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_xml_get_current_line_number(CArrRef params) { + FUNCTION_INJECTION(xml_get_current_line_number); + return (f_xml_get_current_line_number(params.rvalAt(0))); +} +Variant i_drawaffine(CArrRef params) { + FUNCTION_INJECTION(drawaffine); + return (f_drawaffine(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6)), null); +} +Variant i_magicksetimagewhitepoint(CArrRef params) { + FUNCTION_INJECTION(magicksetimagewhitepoint); + return (f_magicksetimagewhitepoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_gzclose(CArrRef params) { + FUNCTION_INJECTION(gzclose); + return (f_gzclose(params.rvalAt(0))); +} +Variant i_imagecolorat(CArrRef params) { + FUNCTION_INJECTION(imagecolorat); + return (f_imagecolorat(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickgetimageextrema(CArrRef params) { + FUNCTION_INJECTION(magickgetimageextrema); + int count = params.size(); + if (count <= 1) return (f_magickgetimageextrema(params.rvalAt(0))); + return (f_magickgetimageextrema(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ord(CArrRef params) { + FUNCTION_INJECTION(ord); + return (f_ord(params.rvalAt(0))); +} +Variant i_mktime(CArrRef params) { + FUNCTION_INJECTION(mktime); + int count = params.size(); + if (count <= 0) return (f_mktime()); + if (count == 1) return (f_mktime(params.rvalAt(0))); + if (count == 2) return (f_mktime(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mktime(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_mktime(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_mktime(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_mktime(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_sem_get(CArrRef params) { + FUNCTION_INJECTION(sem_get); + int count = params.size(); + if (count <= 1) return (f_sem_get(params.rvalAt(0))); + if (count == 2) return (f_sem_get(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_sem_get(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_sem_get(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawsetstrokelinejoin(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokelinejoin); + return (f_drawsetstrokelinejoin(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_array_intersect(CArrRef params) { + FUNCTION_INJECTION(array_intersect); + int count = params.size(); + if (count <= 2) return (f_array_intersect(count, params.rvalAt(0), params.rvalAt(1))); + return (f_array_intersect(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_mailparse_msg_extract_whole_part_file(CArrRef params) { + FUNCTION_INJECTION(mailparse_msg_extract_whole_part_file); + int count = params.size(); + if (count <= 2) return (f_mailparse_msg_extract_whole_part_file(params.rvalAt(0), params.rvalAt(1))); + return (f_mailparse_msg_extract_whole_part_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mb_strrichr(CArrRef params) { + FUNCTION_INJECTION(mb_strrichr); + int count = params.size(); + if (count <= 2) return (f_mb_strrichr(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_strrichr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_strrichr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_socket_sendto(CArrRef params) { + FUNCTION_INJECTION(socket_sendto); + int count = params.size(); + if (count <= 5) return (f_socket_sendto(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_socket_sendto(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_fb_request_timers(CArrRef params) { + FUNCTION_INJECTION(fb_request_timers); + return (f_fb_request_timers()); +} +Variant i_mb_output_handler(CArrRef params) { + FUNCTION_INJECTION(mb_output_handler); + return (f_mb_output_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fclose(CArrRef params) { + FUNCTION_INJECTION(fclose); + return (f_fclose(params.rvalAt(0))); +} +Variant i_drawpathcurvetoquadraticbeziersmoothabsolute(CArrRef params) { + FUNCTION_INJECTION(drawpathcurvetoquadraticbeziersmoothabsolute); + return (f_drawpathcurvetoquadraticbeziersmoothabsolute(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_function_exists(CArrRef params) { + FUNCTION_INJECTION(function_exists); + return (f_function_exists(params.rvalAt(0))); +} +Variant i_oci_connect(CArrRef params) { + FUNCTION_INJECTION(oci_connect); + int count = params.size(); + if (count <= 2) return (f_oci_connect(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_oci_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_oci_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_oci_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_fbml_precache_11(CArrRef params) { + FUNCTION_INJECTION(fbml_precache_11); + return (f_fbml_precache_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_ctype_alpha(CArrRef params) { + FUNCTION_INJECTION(ctype_alpha); + return (f_ctype_alpha(params.rvalAt(0))); +} +Variant i_pos(CArrRef params) { + FUNCTION_INJECTION(pos); + return (f_pos(ref(const_cast(params).lvalAt(0)))); +} +Variant i_imagecolorexactalpha(CArrRef params) { + FUNCTION_INJECTION(imagecolorexactalpha); + return (f_imagecolorexactalpha(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_pow(CArrRef params) { + FUNCTION_INJECTION(pow); + return (f_pow(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pixelgetredquantum(CArrRef params) { + FUNCTION_INJECTION(pixelgetredquantum); + return (f_pixelgetredquantum(params.rvalAt(0))); +} +Variant i_imagecolorsforindex(CArrRef params) { + FUNCTION_INJECTION(imagecolorsforindex); + return (f_imagecolorsforindex(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_libxml_set_streams_context(CArrRef params) { + FUNCTION_INJECTION(libxml_set_streams_context); + return (f_libxml_set_streams_context(params.rvalAt(0)), null); +} +Variant i_image_type_to_mime_type(CArrRef params) { + FUNCTION_INJECTION(image_type_to_mime_type); + return (f_image_type_to_mime_type(params.rvalAt(0))); +} +Variant i_socket_create(CArrRef params) { + FUNCTION_INJECTION(socket_create); + return (f_socket_create(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_xmlwriter_write_pi(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_pi); + return (f_xmlwriter_write_pi(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_posix_getppid(CArrRef params) { + FUNCTION_INJECTION(posix_getppid); + return (f_posix_getppid()); +} +Variant i_oci_close(CArrRef params) { + FUNCTION_INJECTION(oci_close); + return (f_oci_close(params.rvalAt(0))); +} +Variant i_mb_stripos(CArrRef params) { + FUNCTION_INJECTION(mb_stripos); + int count = params.size(); + if (count <= 2) return (f_mb_stripos(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_stripos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_stripos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magickpingimage(CArrRef params) { + FUNCTION_INJECTION(magickpingimage); + return (f_magickpingimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_bcpowmod(CArrRef params) { + FUNCTION_INJECTION(bcpowmod); + int count = params.size(); + if (count <= 3) return (f_bcpowmod(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_bcpowmod(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_timezone_offset_get(CArrRef params) { + FUNCTION_INJECTION(timezone_offset_get); + return (f_timezone_offset_get(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_getrandmax(CArrRef params) { + FUNCTION_INJECTION(getrandmax); + return (f_getrandmax()); +} +Variant i_ctype_alnum(CArrRef params) { + FUNCTION_INJECTION(ctype_alnum); + return (f_ctype_alnum(params.rvalAt(0))); +} +Variant i_tan(CArrRef params) { + FUNCTION_INJECTION(tan); + return (f_tan(params.rvalAt(0))); +} +Variant i_set_exception_handler(CArrRef params) { + FUNCTION_INJECTION(set_exception_handler); + return (f_set_exception_handler(params.rvalAt(0))); +} +Variant i_imagegrabwindow(CArrRef params) { + FUNCTION_INJECTION(imagegrabwindow); + int count = params.size(); + if (count <= 1) return (f_imagegrabwindow(params.rvalAt(0))); + return (f_imagegrabwindow(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickstereoimage(CArrRef params) { + FUNCTION_INJECTION(magickstereoimage); + return (f_magickstereoimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetimagescene(CArrRef params) { + FUNCTION_INJECTION(magickgetimagescene); + return (f_magickgetimagescene(params.rvalAt(0))); +} +Variant i_openssl_csr_sign(CArrRef params) { + FUNCTION_INJECTION(openssl_csr_sign); + int count = params.size(); + if (count <= 4) return (f_openssl_csr_sign(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_openssl_csr_sign(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_openssl_csr_sign(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_openssl_pkcs12_export(CArrRef params) { + FUNCTION_INJECTION(openssl_pkcs12_export); + int count = params.size(); + if (count <= 4) return (f_openssl_pkcs12_export(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); + return (f_openssl_pkcs12_export(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_magickgetquantumdepth(CArrRef params) { + FUNCTION_INJECTION(magickgetquantumdepth); + return (f_magickgetquantumdepth()); +} +Variant i_socket_listen(CArrRef params) { + FUNCTION_INJECTION(socket_listen); + int count = params.size(); + if (count <= 1) return (f_socket_listen(params.rvalAt(0))); + return (f_socket_listen(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_parse_str(CArrRef params) { + FUNCTION_INJECTION(parse_str); + int count = params.size(); + if (count <= 1) return (f_parse_str(params.rvalAt(0)), null); + return (f_parse_str(params.rvalAt(0), ref(const_cast(params).lvalAt(1))), null); +} +Variant i_sin(CArrRef params) { + FUNCTION_INJECTION(sin); + return (f_sin(params.rvalAt(0))); +} +Variant i_cosh(CArrRef params) { + FUNCTION_INJECTION(cosh); + return (f_cosh(params.rvalAt(0))); +} +Variant i_copy(CArrRef params) { + FUNCTION_INJECTION(copy); + int count = params.size(); + if (count <= 2) return (f_copy(params.rvalAt(0), params.rvalAt(1))); + return (f_copy(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagechar(CArrRef params) { + FUNCTION_INJECTION(imagechar); + return (f_imagechar(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_magicksetimagebackgroundcolor(CArrRef params) { + FUNCTION_INJECTION(magicksetimagebackgroundcolor); + return (f_magicksetimagebackgroundcolor(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_mod_add(CArrRef params) { + FUNCTION_INJECTION(ldap_mod_add); + return (f_ldap_mod_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_fb_thrift_serialize(CArrRef params) { + FUNCTION_INJECTION(fb_thrift_serialize); + return (f_fb_thrift_serialize(params.rvalAt(0))); +} +Variant i_posix_ttyname(CArrRef params) { + FUNCTION_INJECTION(posix_ttyname); + return (f_posix_ttyname(params.rvalAt(0))); +} +Variant i_filectime(CArrRef params) { + FUNCTION_INJECTION(filectime); + return (f_filectime(params.rvalAt(0))); +} +Variant i_newpixelwand(CArrRef params) { + FUNCTION_INJECTION(newpixelwand); + int count = params.size(); + if (count <= 0) return (f_newpixelwand()); + return (f_newpixelwand(params.rvalAt(0))); +} +Variant i_pcntl_wait(CArrRef params) { + FUNCTION_INJECTION(pcntl_wait); + int count = params.size(); + if (count <= 1) return (f_pcntl_wait(ref(const_cast(params).lvalAt(0)))); + return (f_pcntl_wait(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); +} +Variant i_hypot(CArrRef params) { + FUNCTION_INJECTION(hypot); + return (f_hypot(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_parse_url(CArrRef params) { + FUNCTION_INJECTION(parse_url); + int count = params.size(); + if (count <= 1) return (f_parse_url(params.rvalAt(0))); + return (f_parse_url(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickreadimageblob(CArrRef params) { + FUNCTION_INJECTION(magickreadimageblob); + return (f_magickreadimageblob(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_eregi(CArrRef params) { + FUNCTION_INJECTION(eregi); + int count = params.size(); + if (count <= 2) return (f_eregi(params.rvalAt(0), params.rvalAt(1))); + return (f_eregi(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_pixelsetcolorcount(CArrRef params) { + FUNCTION_INJECTION(pixelsetcolorcount); + return (f_pixelsetcolorcount(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_drawpathcurvetoquadraticbezierrelative(CArrRef params) { + FUNCTION_INJECTION(drawpathcurvetoquadraticbezierrelative); + return (f_drawpathcurvetoquadraticbezierrelative(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); +} +Variant i_posix_getgroups(CArrRef params) { + FUNCTION_INJECTION(posix_getgroups); + return (f_posix_getgroups()); +} +Variant i_fileinode(CArrRef params) { + FUNCTION_INJECTION(fileinode); + return (f_fileinode(params.rvalAt(0))); +} +Variant i_magickgetnumberimages(CArrRef params) { + FUNCTION_INJECTION(magickgetnumberimages); + return (f_magickgetnumberimages(params.rvalAt(0))); +} +Variant i_magickgetimagesblob(CArrRef params) { + FUNCTION_INJECTION(magickgetimagesblob); + return (f_magickgetimagesblob(params.rvalAt(0))); +} +Variant i_magickcontrastimage(CArrRef params) { + FUNCTION_INJECTION(magickcontrastimage); + return (f_magickcontrastimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pcntl_setpriority(CArrRef params) { + FUNCTION_INJECTION(pcntl_setpriority); + int count = params.size(); + if (count <= 1) return (f_pcntl_setpriority(params.rvalAt(0))); + if (count == 2) return (f_pcntl_setpriority(params.rvalAt(0), params.rvalAt(1))); + return (f_pcntl_setpriority(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawgetfontstretch(CArrRef params) { + FUNCTION_INJECTION(drawgetfontstretch); + return (f_drawgetfontstretch(params.rvalAt(0))); +} +Variant i_bcscale(CArrRef params) { + FUNCTION_INJECTION(bcscale); + return (f_bcscale(params.rvalAt(0))); +} +Variant i_imageconvolution(CArrRef params) { + FUNCTION_INJECTION(imageconvolution); + return (f_imageconvolution(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_utf8_decode(CArrRef params) { + FUNCTION_INJECTION(utf8_decode); + return (f_utf8_decode(params.rvalAt(0))); +} +Variant i_ldap_unbind(CArrRef params) { + FUNCTION_INJECTION(ldap_unbind); + return (f_ldap_unbind(params.rvalAt(0))); +} +Variant i_newpixelregioniterator(CArrRef params) { + FUNCTION_INJECTION(newpixelregioniterator); + return (f_newpixelregioniterator(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_array_intersect_assoc(CArrRef params) { + FUNCTION_INJECTION(array_intersect_assoc); + int count = params.size(); + if (count <= 2) return (f_array_intersect_assoc(count, params.rvalAt(0), params.rvalAt(1))); + return (f_array_intersect_assoc(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_ob_get_level(CArrRef params) { + FUNCTION_INJECTION(ob_get_level); + return (f_ob_get_level()); +} +Variant i_hebrev(CArrRef params) { + FUNCTION_INJECTION(hebrev); + int count = params.size(); + if (count <= 1) return (f_hebrev(params.rvalAt(0))); + return (f_hebrev(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_socket_set_block(CArrRef params) { + FUNCTION_INJECTION(socket_set_block); + return (f_socket_set_block(params.rvalAt(0))); +} +Variant i_mcrypt_module_close(CArrRef params) { + FUNCTION_INJECTION(mcrypt_module_close); + return (f_mcrypt_module_close(params.rvalAt(0))); +} +Variant i_mb_strwidth(CArrRef params) { + FUNCTION_INJECTION(mb_strwidth); + int count = params.size(); + if (count <= 1) return (f_mb_strwidth(params.rvalAt(0))); + return (f_mb_strwidth(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_clonemagickwand(CArrRef params) { + FUNCTION_INJECTION(clonemagickwand); + return (f_clonemagickwand(params.rvalAt(0))); +} +Variant i_pixelgetred(CArrRef params) { + FUNCTION_INJECTION(pixelgetred); + return (f_pixelgetred(params.rvalAt(0))); +} +Variant i_ip2long(CArrRef params) { + FUNCTION_INJECTION(ip2long); + return (f_ip2long(params.rvalAt(0))); +} +Variant i_mb_stristr(CArrRef params) { + FUNCTION_INJECTION(mb_stristr); + int count = params.size(); + if (count <= 2) return (f_mb_stristr(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_stristr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_stristr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_array_diff_ukey(CArrRef params) { + FUNCTION_INJECTION(array_diff_ukey); + int count = params.size(); + if (count <= 3) return (f_array_diff_ukey(count, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_array_diff_ukey(count,params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.slice(3, count - 3, false))); +} +Variant i_isdrawingwand(CArrRef params) { + FUNCTION_INJECTION(isdrawingwand); + return (f_isdrawingwand(params.rvalAt(0))); +} +Variant i_magicksetimagemattecolor(CArrRef params) { + FUNCTION_INJECTION(magicksetimagemattecolor); + return (f_magicksetimagemattecolor(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_closedir(CArrRef params) { + FUNCTION_INJECTION(closedir); + return (f_closedir(params.rvalAt(0)), null); +} +Variant i_fb_call_user_func_safe_return(CArrRef params) { + FUNCTION_INJECTION(fb_call_user_func_safe_return); + int count = params.size(); + if (count <= 2) return (f_fb_call_user_func_safe_return(count, params.rvalAt(0), params.rvalAt(1))); + return (f_fb_call_user_func_safe_return(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_magickwriteimagesfile(CArrRef params) { + FUNCTION_INJECTION(magickwriteimagesfile); + return (f_magickwriteimagesfile(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickdescribeimage(CArrRef params) { + FUNCTION_INJECTION(magickdescribeimage); + return (f_magickdescribeimage(params.rvalAt(0))); +} +Variant i_imageftbbox(CArrRef params) { + FUNCTION_INJECTION(imageftbbox); + int count = params.size(); + if (count <= 4) return (f_imageftbbox(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_imageftbbox(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_magicksetlastiterator(CArrRef params) { + FUNCTION_INJECTION(magicksetlastiterator); + return (f_magicksetlastiterator(params.rvalAt(0)), null); +} +Variant i_hphp_output_global_state(CArrRef params) { + FUNCTION_INJECTION(hphp_output_global_state); + int count = params.size(); + if (count <= 0) return (f_hphp_output_global_state(), null); + return (f_hphp_output_global_state(params.rvalAt(0)), null); +} +Variant i_imagefontheight(CArrRef params) { + FUNCTION_INJECTION(imagefontheight); + return (f_imagefontheight(params.rvalAt(0))); +} +Variant i_putenv(CArrRef params) { + FUNCTION_INJECTION(putenv); + return (f_putenv(params.rvalAt(0))); +} +Variant i_magickedgeimage(CArrRef params) { + FUNCTION_INJECTION(magickedgeimage); + return (f_magickedgeimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xml_error_string(CArrRef params) { + FUNCTION_INJECTION(xml_error_string); + return (f_xml_error_string(params.rvalAt(0))); +} +Variant i_array_rand(CArrRef params) { + FUNCTION_INJECTION(array_rand); + int count = params.size(); + if (count <= 1) return (f_array_rand(params.rvalAt(0))); + return (f_array_rand(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_mod_del(CArrRef params) { + FUNCTION_INJECTION(ldap_mod_del); + return (f_ldap_mod_del(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_range(CArrRef params) { + FUNCTION_INJECTION(range); + int count = params.size(); + if (count <= 2) return (f_range(params.rvalAt(0), params.rvalAt(1))); + return (f_range(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_levenshtein(CArrRef params) { + FUNCTION_INJECTION(levenshtein); + int count = params.size(); + if (count <= 2) return (f_levenshtein(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_levenshtein(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_levenshtein(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_levenshtein(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_curl_multi_close(CArrRef params) { + FUNCTION_INJECTION(curl_multi_close); + return (f_curl_multi_close(params.rvalAt(0)), null); +} +Variant i_drawgetfillalpha(CArrRef params) { + FUNCTION_INJECTION(drawgetfillalpha); + return (f_drawgetfillalpha(params.rvalAt(0))); +} +Variant i_hash_hmac(CArrRef params) { + FUNCTION_INJECTION(hash_hmac); + int count = params.size(); + if (count <= 3) return (f_hash_hmac(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_hash_hmac(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_get_html_translation_table(CArrRef params) { + FUNCTION_INJECTION(get_html_translation_table); + int count = params.size(); + if (count <= 0) return (f_get_html_translation_table()); + if (count == 1) return (f_get_html_translation_table(params.rvalAt(0))); + return (f_get_html_translation_table(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_user_error(CArrRef params) { + FUNCTION_INJECTION(user_error); + int count = params.size(); + if (count <= 1) return (f_user_error(params.rvalAt(0))); + return (f_user_error(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_feof(CArrRef params) { + FUNCTION_INJECTION(feof); + return (f_feof(params.rvalAt(0))); +} +Variant i_filemtime(CArrRef params) { + FUNCTION_INJECTION(filemtime); + return (f_filemtime(params.rvalAt(0))); +} +Variant i_microtime(CArrRef params) { + FUNCTION_INJECTION(microtime); + int count = params.size(); + if (count <= 0) return (f_microtime()); + return (f_microtime(params.rvalAt(0))); +} +Variant i_zend_version(CArrRef params) { + FUNCTION_INJECTION(zend_version); + return (f_zend_version()); +} +Variant i_openssl_x509_free(CArrRef params) { + FUNCTION_INJECTION(openssl_x509_free); + return (f_openssl_x509_free(params.rvalAt(0)), null); +} +Variant i_fb_call_user_func_safe(CArrRef params) { + FUNCTION_INJECTION(fb_call_user_func_safe); + int count = params.size(); + if (count <= 1) return (f_fb_call_user_func_safe(count, params.rvalAt(0))); + return (f_fb_call_user_func_safe(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_var_export(CArrRef params) { + FUNCTION_INJECTION(var_export); + int count = params.size(); + if (count <= 1) return (f_var_export(params.rvalAt(0))); + return (f_var_export(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_strcut(CArrRef params) { + FUNCTION_INJECTION(mb_strcut); + int count = params.size(); + if (count <= 2) return (f_mb_strcut(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_strcut(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_strcut(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_xmlwriter_end_comment(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_end_comment); + return (f_xmlwriter_end_comment(params.rvalAt(0))); +} +Variant i_xmlwriter_end_dtd_element(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_end_dtd_element); + return (f_xmlwriter_end_dtd_element(params.rvalAt(0))); +} +Variant i_openssl_pkey_export_to_file(CArrRef params) { + FUNCTION_INJECTION(openssl_pkey_export_to_file); + int count = params.size(); + if (count <= 2) return (f_openssl_pkey_export_to_file(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_openssl_pkey_export_to_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_openssl_pkey_export_to_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_oci_commit(CArrRef params) { + FUNCTION_INJECTION(oci_commit); + return (f_oci_commit(params.rvalAt(0))); +} +Variant i_imagecolorclosesthwb(CArrRef params) { + FUNCTION_INJECTION(imagecolorclosesthwb); + return (f_imagecolorclosesthwb(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_ldap_get_attributes(CArrRef params) { + FUNCTION_INJECTION(ldap_get_attributes); + return (f_ldap_get_attributes(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_date_modify(CArrRef params) { + FUNCTION_INJECTION(date_modify); + return (f_date_modify(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_umask(CArrRef params) { + FUNCTION_INJECTION(umask); + int count = params.size(); + if (count <= 0) return (f_umask()); + return (f_umask(params.rvalAt(0))); +} +Variant i_xml_get_current_column_number(CArrRef params) { + FUNCTION_INJECTION(xml_get_current_column_number); + return (f_xml_get_current_column_number(params.rvalAt(0))); +} +Variant i_pixelsetblue(CArrRef params) { + FUNCTION_INJECTION(pixelsetblue); + return (f_pixelsetblue(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mb_http_output(CArrRef params) { + FUNCTION_INJECTION(mb_http_output); + int count = params.size(); + if (count <= 0) return (f_mb_http_output()); + return (f_mb_http_output(params.rvalAt(0))); +} +Variant i_flock(CArrRef params) { + FUNCTION_INJECTION(flock); + int count = params.size(); + if (count <= 2) return (f_flock(params.rvalAt(0), params.rvalAt(1))); + return (f_flock(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_pcntl_wifexited(CArrRef params) { + FUNCTION_INJECTION(pcntl_wifexited); + return (f_pcntl_wifexited(params.rvalAt(0))); +} +Variant i_magicksetformat(CArrRef params) { + FUNCTION_INJECTION(magicksetformat); + return (f_magicksetformat(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_array_map(CArrRef params) { + FUNCTION_INJECTION(array_map); + int count = params.size(); + if (count <= 2) return (f_array_map(count, params.rvalAt(0), params.rvalAt(1))); + return (f_array_map(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_magicksharpenimage(CArrRef params) { + FUNCTION_INJECTION(magicksharpenimage); + int count = params.size(); + if (count <= 3) return (f_magicksharpenimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magicksharpenimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_is_infinite(CArrRef params) { + FUNCTION_INJECTION(is_infinite); + return (f_is_infinite(params.rvalAt(0))); +} +Variant i_date_timezone_set(CArrRef params) { + FUNCTION_INJECTION(date_timezone_set); + return (f_date_timezone_set(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mb_ereg_search_init(CArrRef params) { + FUNCTION_INJECTION(mb_ereg_search_init); + int count = params.size(); + if (count <= 1) return (f_mb_ereg_search_init(params.rvalAt(0))); + if (count == 2) return (f_mb_ereg_search_init(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_ereg_search_init(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawcircle(CArrRef params) { + FUNCTION_INJECTION(drawcircle); + return (f_drawcircle(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); +} +Variant i_is_readable(CArrRef params) { + FUNCTION_INJECTION(is_readable); + return (f_is_readable(params.rvalAt(0))); +} +Variant i_image_type_to_extension(CArrRef params) { + FUNCTION_INJECTION(image_type_to_extension); + int count = params.size(); + if (count <= 1) return (f_image_type_to_extension(params.rvalAt(0))); + return (f_image_type_to_extension(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_printf(CArrRef params) { + FUNCTION_INJECTION(printf); + int count = params.size(); + if (count <= 1) return (f_printf(count, params.rvalAt(0))); + return (f_printf(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_magicksetimagecompression(CArrRef params) { + FUNCTION_INJECTION(magicksetimagecompression); + return (f_magicksetimagecompression(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mcrypt_decrypt(CArrRef params) { + FUNCTION_INJECTION(mcrypt_decrypt); + int count = params.size(); + if (count <= 4) return (f_mcrypt_decrypt(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_mcrypt_decrypt(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_natcasesort(CArrRef params) { + FUNCTION_INJECTION(natcasesort); + return (f_natcasesort(ref(const_cast(params).lvalAt(0)))); +} +Variant i_array_chunk(CArrRef params) { + FUNCTION_INJECTION(array_chunk); + int count = params.size(); + if (count <= 2) return (f_array_chunk(params.rvalAt(0), params.rvalAt(1))); + return (f_array_chunk(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagefilledpolygon(CArrRef params) { + FUNCTION_INJECTION(imagefilledpolygon); + return (f_imagefilledpolygon(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawpoppattern(CArrRef params) { + FUNCTION_INJECTION(drawpoppattern); + return (f_drawpoppattern(params.rvalAt(0)), null); +} +Variant i_magickgetimagewidth(CArrRef params) { + FUNCTION_INJECTION(magickgetimagewidth); + return (f_magickgetimagewidth(params.rvalAt(0))); +} +Variant i_drawgetfontfamily(CArrRef params) { + FUNCTION_INJECTION(drawgetfontfamily); + return (f_drawgetfontfamily(params.rvalAt(0))); +} +Variant i_dl(CArrRef params) { + FUNCTION_INJECTION(dl); + return (f_dl(params.rvalAt(0))); +} +Variant i_touch(CArrRef params) { + FUNCTION_INJECTION(touch); + int count = params.size(); + if (count <= 1) return (f_touch(params.rvalAt(0))); + if (count == 2) return (f_touch(params.rvalAt(0), params.rvalAt(1))); + return (f_touch(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magicksetimagebordercolor(CArrRef params) { + FUNCTION_INJECTION(magicksetimagebordercolor); + return (f_magicksetimagebordercolor(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickspliceimage(CArrRef params) { + FUNCTION_INJECTION(magickspliceimage); + return (f_magickspliceimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_define(CArrRef params) { + FUNCTION_INJECTION(define); + int count = params.size(); + if (count <= 2) return (f_define(params.rvalAt(0), params.rvalAt(1))); + return (f_define(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_headers_sent(CArrRef params) { + FUNCTION_INJECTION(headers_sent); + int count = params.size(); + if (count <= 0) return (f_headers_sent()); + if (count == 1) return (f_headers_sent(ref(const_cast(params).lvalAt(0)))); + return (f_headers_sent(ref(const_cast(params).lvalAt(0)), ref(const_cast(params).lvalAt(1)))); +} +Variant i_stream_context_get_options(CArrRef params) { + FUNCTION_INJECTION(stream_context_get_options); + return (f_stream_context_get_options(params.rvalAt(0))); +} +Variant i_file(CArrRef params) { + FUNCTION_INJECTION(file); + int count = params.size(); + if (count <= 1) return (f_file(params.rvalAt(0))); + if (count == 2) return (f_file(params.rvalAt(0), params.rvalAt(1))); + return (f_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagecolorresolvealpha(CArrRef params) { + FUNCTION_INJECTION(imagecolorresolvealpha); + return (f_imagecolorresolvealpha(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_strtr(CArrRef params) { + FUNCTION_INJECTION(strtr); + int count = params.size(); + if (count <= 2) return (f_strtr(params.rvalAt(0), params.rvalAt(1))); + return (f_strtr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_posix_strerror(CArrRef params) { + FUNCTION_INJECTION(posix_strerror); + return (f_posix_strerror(params.rvalAt(0))); +} +Variant i_libxml_use_internal_errors(CArrRef params) { + FUNCTION_INJECTION(libxml_use_internal_errors); + int count = params.size(); + if (count <= 0) return (f_libxml_use_internal_errors()); + return (f_libxml_use_internal_errors(params.rvalAt(0))); +} +Variant i_openssl_get_publickey(CArrRef params) { + FUNCTION_INJECTION(openssl_get_publickey); + return (f_openssl_get_publickey(params.rvalAt(0))); +} +Variant i_time_nanosleep(CArrRef params) { + FUNCTION_INJECTION(time_nanosleep); + return (f_time_nanosleep(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicksetimageunits(CArrRef params) { + FUNCTION_INJECTION(magicksetimageunits); + return (f_magicksetimageunits(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_floor(CArrRef params) { + FUNCTION_INJECTION(floor); + return (f_floor(params.rvalAt(0))); +} +Variant i_array_pad(CArrRef params) { + FUNCTION_INJECTION(array_pad); + return (f_array_pad(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_sem_release(CArrRef params) { + FUNCTION_INJECTION(sem_release); + return (f_sem_release(params.rvalAt(0))); +} +Variant i_highlight_string(CArrRef params) { + FUNCTION_INJECTION(highlight_string); + int count = params.size(); + if (count <= 1) return (f_highlight_string(params.rvalAt(0))); + return (f_highlight_string(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hphp_invoke(CArrRef params) { + FUNCTION_INJECTION(hphp_invoke); + return (f_hphp_invoke(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_imageloadfont(CArrRef params) { + FUNCTION_INJECTION(imageloadfont); + return (f_imageloadfont(params.rvalAt(0))); +} +Variant i_xmlwriter_start_element(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_element); + return (f_xmlwriter_start_element(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_localeconv(CArrRef params) { + FUNCTION_INJECTION(localeconv); + return (f_localeconv()); +} +Variant i_exif_thumbnail(CArrRef params) { + FUNCTION_INJECTION(exif_thumbnail); + int count = params.size(); + if (count <= 1) return (f_exif_thumbnail(params.rvalAt(0))); + if (count == 2) return (f_exif_thumbnail(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + if (count == 3) return (f_exif_thumbnail(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); + return (f_exif_thumbnail(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)))); +} +Variant i_mysql_get_proto_info(CArrRef params) { + FUNCTION_INJECTION(mysql_get_proto_info); + int count = params.size(); + if (count <= 0) return (f_mysql_get_proto_info()); + return (f_mysql_get_proto_info(params.rvalAt(0))); +} +Variant i_imagefontwidth(CArrRef params) { + FUNCTION_INJECTION(imagefontwidth); + return (f_imagefontwidth(params.rvalAt(0))); +} +Variant i_substr_compare(CArrRef params) { + FUNCTION_INJECTION(substr_compare); + int count = params.size(); + if (count <= 3) return (f_substr_compare(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_substr_compare(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_substr_compare(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_xbox_post_message(CArrRef params) { + FUNCTION_INJECTION(xbox_post_message); + int count = params.size(); + if (count <= 1) return (f_xbox_post_message(params.rvalAt(0))); + return (f_xbox_post_message(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fb_rename_function(CArrRef params) { + FUNCTION_INJECTION(fb_rename_function); + return (f_fb_rename_function(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_array_walk_recursive(CArrRef params) { + FUNCTION_INJECTION(array_walk_recursive); + int count = params.size(); + if (count <= 2) return (f_array_walk_recursive(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); + return (f_array_walk_recursive(ref(const_cast(params).lvalAt(0)), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mysql_list_processes(CArrRef params) { + FUNCTION_INJECTION(mysql_list_processes); + int count = params.size(); + if (count <= 0) return (f_mysql_list_processes()); + return (f_mysql_list_processes(params.rvalAt(0))); +} +Variant i_imagedashedline(CArrRef params) { + FUNCTION_INJECTION(imagedashedline); + return (f_imagedashedline(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_magickgetimagedelay(CArrRef params) { + FUNCTION_INJECTION(magickgetimagedelay); + return (f_magickgetimagedelay(params.rvalAt(0))); +} +Variant i_pi(CArrRef params) { + FUNCTION_INJECTION(pi); + return (f_pi()); +} +Variant i_mb_substr_count(CArrRef params) { + FUNCTION_INJECTION(mb_substr_count); + int count = params.size(); + if (count <= 2) return (f_mb_substr_count(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_substr_count(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_hotprofiler_disable(CArrRef params) { + FUNCTION_INJECTION(hotprofiler_disable); + return (f_hotprofiler_disable()); +} +Variant i_magickgettextdescent(CArrRef params) { + FUNCTION_INJECTION(magickgettextdescent); + int count = params.size(); + if (count <= 3) return (f_magickgettextdescent(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickgettextdescent(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawsetstrokealpha(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokealpha); + return (f_drawsetstrokealpha(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_apc_delete_file(CArrRef params) { + FUNCTION_INJECTION(apc_delete_file); + int count = params.size(); + if (count <= 1) return (f_apc_delete_file(params.rvalAt(0))); + return (f_apc_delete_file(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_strrpos(CArrRef params) { + FUNCTION_INJECTION(strrpos); + int count = params.size(); + if (count <= 2) return (f_strrpos(params.rvalAt(0), params.rvalAt(1))); + return (f_strrpos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_array_diff_assoc(CArrRef params) { + FUNCTION_INJECTION(array_diff_assoc); + int count = params.size(); + if (count <= 2) return (f_array_diff_assoc(count, params.rvalAt(0), params.rvalAt(1))); + return (f_array_diff_assoc(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_magickclippathimage(CArrRef params) { + FUNCTION_INJECTION(magickclippathimage); + return (f_magickclippathimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_xmlwriter_write_element(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_element); + int count = params.size(); + if (count <= 2) return (f_xmlwriter_write_element(params.rvalAt(0), params.rvalAt(1))); + return (f_xmlwriter_write_element(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_ascii2ebcdic(CArrRef params) { + FUNCTION_INJECTION(ascii2ebcdic); + return (f_ascii2ebcdic(params.rvalAt(0))); +} +Variant i_ereg(CArrRef params) { + FUNCTION_INJECTION(ereg); + int count = params.size(); + if (count <= 2) return (f_ereg(params.rvalAt(0), params.rvalAt(1))); + return (f_ereg(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_curl_multi_info_read(CArrRef params) { + FUNCTION_INJECTION(curl_multi_info_read); + int count = params.size(); + if (count <= 1) return (f_curl_multi_info_read(params.rvalAt(0))); + return (f_curl_multi_info_read(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); +} +Variant i_oci_field_size(CArrRef params) { + FUNCTION_INJECTION(oci_field_size); + return (f_oci_field_size(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickthresholdimage(CArrRef params) { + FUNCTION_INJECTION(magickthresholdimage); + int count = params.size(); + if (count <= 2) return (f_magickthresholdimage(params.rvalAt(0), params.rvalAt(1))); + return (f_magickthresholdimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_msg_remove_queue(CArrRef params) { + FUNCTION_INJECTION(msg_remove_queue); + return (f_msg_remove_queue(params.rvalAt(0))); +} +Variant i_mb_strlen(CArrRef params) { + FUNCTION_INJECTION(mb_strlen); + int count = params.size(); + if (count <= 1) return (f_mb_strlen(params.rvalAt(0))); + return (f_mb_strlen(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetclippath(CArrRef params) { + FUNCTION_INJECTION(drawgetclippath); + return (f_drawgetclippath(params.rvalAt(0))); +} +Variant i_imagecopy(CArrRef params) { + FUNCTION_INJECTION(imagecopy); + return (f_imagecopy(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); +} +Variant i_pixelsetcolor(CArrRef params) { + FUNCTION_INJECTION(pixelsetcolor); + return (f_pixelsetcolor(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_time_sleep_until(CArrRef params) { + FUNCTION_INJECTION(time_sleep_until); + return (f_time_sleep_until(params.rvalAt(0))); +} +Variant i_mb_ereg_replace(CArrRef params) { + FUNCTION_INJECTION(mb_ereg_replace); + int count = params.size(); + if (count <= 3) return (f_mb_ereg_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_ereg_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_openssl_csr_get_public_key(CArrRef params) { + FUNCTION_INJECTION(openssl_csr_get_public_key); + return (f_openssl_csr_get_public_key(params.rvalAt(0))); +} +Variant i_magickfximage(CArrRef params) { + FUNCTION_INJECTION(magickfximage); + int count = params.size(); + if (count <= 2) return (f_magickfximage(params.rvalAt(0), params.rvalAt(1))); + return (f_magickfximage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_tmpfile(CArrRef params) { + FUNCTION_INJECTION(tmpfile); + return (f_tmpfile()); +} +Variant i_hash(CArrRef params) { + FUNCTION_INJECTION(hash); + int count = params.size(); + if (count <= 2) return (f_hash(params.rvalAt(0), params.rvalAt(1))); + return (f_hash(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_uasort(CArrRef params) { + FUNCTION_INJECTION(uasort); + return (f_uasort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); +} +Variant i_pixelgetalpha(CArrRef params) { + FUNCTION_INJECTION(pixelgetalpha); + return (f_pixelgetalpha(params.rvalAt(0))); +} +Variant i_drawsettextencoding(CArrRef params) { + FUNCTION_INJECTION(drawsettextencoding); + return (f_drawsettextencoding(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_apache_request_headers(CArrRef params) { + FUNCTION_INJECTION(apache_request_headers); + return (f_apache_request_headers()); +} +Variant i_is_subclass_of(CArrRef params) { + FUNCTION_INJECTION(is_subclass_of); + return (f_is_subclass_of(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pixelgetmagentaquantum(CArrRef params) { + FUNCTION_INJECTION(pixelgetmagentaquantum); + return (f_pixelgetmagentaquantum(params.rvalAt(0))); +} +Variant i_hphp_get_static_property(CArrRef params) { + FUNCTION_INJECTION(hphp_get_static_property); + return (f_hphp_get_static_property(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_array_pop(CArrRef params) { + FUNCTION_INJECTION(array_pop); + return (f_array_pop(ref(const_cast(params).lvalAt(0)))); +} +Variant i_magickgetimagecolors(CArrRef params) { + FUNCTION_INJECTION(magickgetimagecolors); + return (f_magickgetimagecolors(params.rvalAt(0))); +} +Variant i_class_exists(CArrRef params) { + FUNCTION_INJECTION(class_exists); + int count = params.size(); + if (count <= 1) return (f_class_exists(params.rvalAt(0))); + return (f_class_exists(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_getallheaders(CArrRef params) { + FUNCTION_INJECTION(getallheaders); + return (f_getallheaders()); +} +Variant i_get_extension_funcs(CArrRef params) { + FUNCTION_INJECTION(get_extension_funcs); + return (f_get_extension_funcs(params.rvalAt(0))); +} +Variant i_imagecolordeallocate(CArrRef params) { + FUNCTION_INJECTION(imagecolordeallocate); + return (f_imagecolordeallocate(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_closelog(CArrRef params) { + FUNCTION_INJECTION(closelog); + return (f_closelog(), null); +} +Variant i_drawpathlinetoabsolute(CArrRef params) { + FUNCTION_INJECTION(drawpathlinetoabsolute); + return (f_drawpathlinetoabsolute(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_mcrypt_enc_get_iv_size(CArrRef params) { + FUNCTION_INJECTION(mcrypt_enc_get_iv_size); + return (f_mcrypt_enc_get_iv_size(params.rvalAt(0))); +} +Variant i_json_decode(CArrRef params) { + FUNCTION_INJECTION(json_decode); + int count = params.size(); + if (count <= 1) return (f_json_decode(params.rvalAt(0))); + if (count == 2) return (f_json_decode(params.rvalAt(0), params.rvalAt(1))); + return (f_json_decode(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_preg_replace(CArrRef params) { + FUNCTION_INJECTION(preg_replace); + int count = params.size(); + if (count <= 3) return (f_preg_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_preg_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_preg_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), ref(const_cast(params).lvalAt(4)))); +} +Variant i_fmod(CArrRef params) { + FUNCTION_INJECTION(fmod); + return (f_fmod(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_curl_errno(CArrRef params) { + FUNCTION_INJECTION(curl_errno); + return (f_curl_errno(params.rvalAt(0))); +} +Variant i_pagelet_server_task_start(CArrRef params) { + FUNCTION_INJECTION(pagelet_server_task_start); + int count = params.size(); + if (count <= 1) return (f_pagelet_server_task_start(params.rvalAt(0))); + if (count == 2) return (f_pagelet_server_task_start(params.rvalAt(0), params.rvalAt(1))); + return (f_pagelet_server_task_start(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_hash_init(CArrRef params) { + FUNCTION_INJECTION(hash_init); + int count = params.size(); + if (count <= 1) return (f_hash_init(params.rvalAt(0))); + if (count == 2) return (f_hash_init(params.rvalAt(0), params.rvalAt(1))); + return (f_hash_init(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mb_strripos(CArrRef params) { + FUNCTION_INJECTION(mb_strripos); + int count = params.size(); + if (count <= 2) return (f_mb_strripos(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_strripos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_strripos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_mysql_fetch_row(CArrRef params) { + FUNCTION_INJECTION(mysql_fetch_row); + return (f_mysql_fetch_row(params.rvalAt(0))); +} +Variant i_ob_get_flush(CArrRef params) { + FUNCTION_INJECTION(ob_get_flush); + return (f_ob_get_flush()); +} +Variant i_curl_error(CArrRef params) { + FUNCTION_INJECTION(curl_error); + return (f_curl_error(params.rvalAt(0))); +} +Variant i_oci_new_connect(CArrRef params) { + FUNCTION_INJECTION(oci_new_connect); + int count = params.size(); + if (count <= 2) return (f_oci_new_connect(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_oci_new_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_oci_new_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_oci_new_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_set_magic_quotes_runtime(CArrRef params) { + FUNCTION_INJECTION(set_magic_quotes_runtime); + return (f_set_magic_quotes_runtime(params.rvalAt(0))); +} +Variant i_magickcharcoalimage(CArrRef params) { + FUNCTION_INJECTION(magickcharcoalimage); + return (f_magickcharcoalimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_scandir(CArrRef params) { + FUNCTION_INJECTION(scandir); + int count = params.size(); + if (count <= 1) return (f_scandir(params.rvalAt(0))); + if (count == 2) return (f_scandir(params.rvalAt(0), params.rvalAt(1))); + return (f_scandir(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickmosaicimages(CArrRef params) { + FUNCTION_INJECTION(magickmosaicimages); + return (f_magickmosaicimages(params.rvalAt(0))); +} +Variant i_timezone_transitions_get(CArrRef params) { + FUNCTION_INJECTION(timezone_transitions_get); + return (f_timezone_transitions_get(params.rvalAt(0))); +} +Variant i_drawsetfontweight(CArrRef params) { + FUNCTION_INJECTION(drawsetfontweight); + return (f_drawsetfontweight(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_popdrawingwand(CArrRef params) { + FUNCTION_INJECTION(popdrawingwand); + return (f_popdrawingwand(params.rvalAt(0)), null); +} +Variant i_socket_shutdown(CArrRef params) { + FUNCTION_INJECTION(socket_shutdown); + int count = params.size(); + if (count <= 1) return (f_socket_shutdown(params.rvalAt(0))); + return (f_socket_shutdown(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mcrypt_create_iv(CArrRef params) { + FUNCTION_INJECTION(mcrypt_create_iv); + int count = params.size(); + if (count <= 1) return (f_mcrypt_create_iv(params.rvalAt(0))); + return (f_mcrypt_create_iv(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_eval(CArrRef params) { + FUNCTION_INJECTION(eval); + return (f_eval(params.rvalAt(0))); +} +Variant i_fbml_get_attribute_11(CArrRef params) { + FUNCTION_INJECTION(fbml_get_attribute_11); + return (f_fbml_get_attribute_11(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_bindec(CArrRef params) { + FUNCTION_INJECTION(bindec); + return (f_bindec(params.rvalAt(0))); +} +Variant i_fileperms(CArrRef params) { + FUNCTION_INJECTION(fileperms); + return (f_fileperms(params.rvalAt(0))); +} +Variant i_unserialize(CArrRef params) { + FUNCTION_INJECTION(unserialize); + return (f_unserialize(params.rvalAt(0))); +} +Variant i_ldap_t61_to_8859(CArrRef params) { + FUNCTION_INJECTION(ldap_t61_to_8859); + return (f_ldap_t61_to_8859(params.rvalAt(0))); +} +Variant i_urldecode(CArrRef params) { + FUNCTION_INJECTION(urldecode); + return (f_urldecode(params.rvalAt(0))); +} +Variant i_magickannotateimage(CArrRef params) { + FUNCTION_INJECTION(magickannotateimage); + return (f_magickannotateimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_mailparse_msg_create(CArrRef params) { + FUNCTION_INJECTION(mailparse_msg_create); + return (f_mailparse_msg_create()); +} +Variant i_oci_field_type_raw(CArrRef params) { + FUNCTION_INJECTION(oci_field_type_raw); + return (f_oci_field_type_raw(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_apache_get_modules(CArrRef params) { + FUNCTION_INJECTION(apache_get_modules); + return (f_apache_get_modules()); +} +Variant i_drawellipse(CArrRef params) { + FUNCTION_INJECTION(drawellipse); + return (f_drawellipse(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6)), null); +} +Variant i_xmlwriter_write_element_ns(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_element_ns); + int count = params.size(); + if (count <= 4) return (f_xmlwriter_write_element_ns(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_xmlwriter_write_element_ns(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_magicksetcompressionquality(CArrRef params) { + FUNCTION_INJECTION(magicksetcompressionquality); + return (f_magicksetcompressionquality(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickaddnoiseimage(CArrRef params) { + FUNCTION_INJECTION(magickaddnoiseimage); + return (f_magickaddnoiseimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetimagewhitepoint(CArrRef params) { + FUNCTION_INJECTION(magickgetimagewhitepoint); + return (f_magickgetimagewhitepoint(params.rvalAt(0))); +} +Variant i_magickseparateimagechannel(CArrRef params) { + FUNCTION_INJECTION(magickseparateimagechannel); + return (f_magickseparateimagechannel(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_array_push(CArrRef params) { + FUNCTION_INJECTION(array_push); + int count = params.size(); + if (count <= 2) return (f_array_push(count, ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); + return (f_array_push(count,ref(const_cast(params).lvalAt(0)), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_flush(CArrRef params) { + FUNCTION_INJECTION(flush); + return (f_flush(), null); +} +Variant i_connection_aborted(CArrRef params) { + FUNCTION_INJECTION(connection_aborted); + return (f_connection_aborted()); +} +Variant i_uksort(CArrRef params) { + FUNCTION_INJECTION(uksort); + return (f_uksort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); +} +Variant i_mysql_set_timeout(CArrRef params) { + FUNCTION_INJECTION(mysql_set_timeout); + int count = params.size(); + if (count <= 0) return (f_mysql_set_timeout()); + if (count == 1) return (f_mysql_set_timeout(params.rvalAt(0))); + return (f_mysql_set_timeout(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hash_update_stream(CArrRef params) { + FUNCTION_INJECTION(hash_update_stream); + int count = params.size(); + if (count <= 2) return (f_hash_update_stream(params.rvalAt(0), params.rvalAt(1))); + return (f_hash_update_stream(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_ob_start(CArrRef params) { + FUNCTION_INJECTION(ob_start); + int count = params.size(); + if (count <= 0) return (f_ob_start()); + if (count == 1) return (f_ob_start(params.rvalAt(0))); + if (count == 2) return (f_ob_start(params.rvalAt(0), params.rvalAt(1))); + return (f_ob_start(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mysql_get_host_info(CArrRef params) { + FUNCTION_INJECTION(mysql_get_host_info); + int count = params.size(); + if (count <= 0) return (f_mysql_get_host_info()); + return (f_mysql_get_host_info(params.rvalAt(0))); +} +Variant i_mb_language(CArrRef params) { + FUNCTION_INJECTION(mb_language); + int count = params.size(); + if (count <= 0) return (f_mb_language()); + return (f_mb_language(params.rvalAt(0))); +} +Variant i_pixelgetnextiteratorrow(CArrRef params) { + FUNCTION_INJECTION(pixelgetnextiteratorrow); + return (f_pixelgetnextiteratorrow(params.rvalAt(0))); +} +Variant i_ldap_next_reference(CArrRef params) { + FUNCTION_INJECTION(ldap_next_reference); + return (f_ldap_next_reference(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_socket_get_status(CArrRef params) { + FUNCTION_INJECTION(socket_get_status); + return (f_socket_get_status(params.rvalAt(0))); +} +Variant i_checkdnsrr(CArrRef params) { + FUNCTION_INJECTION(checkdnsrr); + int count = params.size(); + if (count <= 1) return (f_checkdnsrr(params.rvalAt(0))); + return (f_checkdnsrr(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_openssl_verify(CArrRef params) { + FUNCTION_INJECTION(openssl_verify); + int count = params.size(); + if (count <= 3) return (f_openssl_verify(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_openssl_verify(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_curl_exec(CArrRef params) { + FUNCTION_INJECTION(curl_exec); + return (f_curl_exec(params.rvalAt(0))); +} +Variant i_magickgetexceptiontype(CArrRef params) { + FUNCTION_INJECTION(magickgetexceptiontype); + return (f_magickgetexceptiontype(params.rvalAt(0))); +} +Variant i_array_sum(CArrRef params) { + FUNCTION_INJECTION(array_sum); + return (f_array_sum(params.rvalAt(0))); +} +Variant i_unregister_tick_function(CArrRef params) { + FUNCTION_INJECTION(unregister_tick_function); + return (f_unregister_tick_function(params.rvalAt(0)), null); +} +Variant i_newpixelwandarray(CArrRef params) { + FUNCTION_INJECTION(newpixelwandarray); + return (f_newpixelwandarray(params.rvalAt(0))); +} +Variant i_magickgetversion(CArrRef params) { + FUNCTION_INJECTION(magickgetversion); + return (f_magickgetversion()); +} +Variant i_imagelayereffect(CArrRef params) { + FUNCTION_INJECTION(imagelayereffect); + return (f_imagelayereffect(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_apache_reset_timeout(CArrRef params) { + FUNCTION_INJECTION(apache_reset_timeout); + return (f_apache_reset_timeout()); +} +Variant i_glob(CArrRef params) { + FUNCTION_INJECTION(glob); + int count = params.size(); + if (count <= 1) return (f_glob(params.rvalAt(0))); + return (f_glob(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_exec(CArrRef params) { + FUNCTION_INJECTION(exec); + int count = params.size(); + if (count <= 1) return (f_exec(params.rvalAt(0))); + if (count == 2) return (f_exec(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_exec(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); +} +Variant i_apd_continue(CArrRef params) { + FUNCTION_INJECTION(apd_continue); + return (f_apd_continue()); +} +Variant i_magickgetimagedepth(CArrRef params) { + FUNCTION_INJECTION(magickgetimagedepth); + int count = params.size(); + if (count <= 1) return (f_magickgetimagedepth(params.rvalAt(0))); + return (f_magickgetimagedepth(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pclose(CArrRef params) { + FUNCTION_INJECTION(pclose); + return (f_pclose(params.rvalAt(0))); +} +Variant i_get_parent_class(CArrRef params) { + FUNCTION_INJECTION(get_parent_class); + int count = params.size(); + if (count <= 0) return (f_get_parent_class()); + return (f_get_parent_class(params.rvalAt(0))); +} +Variant i_fql_static_data_set_10(CArrRef params) { + FUNCTION_INJECTION(fql_static_data_set_10); + return (f_fql_static_data_set_10()); +} +Variant i_mb_strpos(CArrRef params) { + FUNCTION_INJECTION(mb_strpos); + int count = params.size(); + if (count <= 2) return (f_mb_strpos(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_strpos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_strpos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_xmlwriter_write_dtd_attlist(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_dtd_attlist); + return (f_xmlwriter_write_dtd_attlist(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_xml_set_element_handler(CArrRef params) { + FUNCTION_INJECTION(xml_set_element_handler); + return (f_xml_set_element_handler(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawgetstrokeopacity(CArrRef params) { + FUNCTION_INJECTION(drawgetstrokeopacity); + return (f_drawgetstrokeopacity(params.rvalAt(0))); +} +Variant i_ldap_get_entries(CArrRef params) { + FUNCTION_INJECTION(ldap_get_entries); + return (f_ldap_get_entries(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fb_run_mcproxy(CArrRef params) { + FUNCTION_INJECTION(fb_run_mcproxy); + return (f_fb_run_mcproxy(), null); +} +Variant i_ob_iconv_handler(CArrRef params) { + FUNCTION_INJECTION(ob_iconv_handler); + return (f_ob_iconv_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pathinfo(CArrRef params) { + FUNCTION_INJECTION(pathinfo); + int count = params.size(); + if (count <= 1) return (f_pathinfo(params.rvalAt(0))); + return (f_pathinfo(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickaffinetransformimage(CArrRef params) { + FUNCTION_INJECTION(magickaffinetransformimage); + return (f_magickaffinetransformimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ob_get_status(CArrRef params) { + FUNCTION_INJECTION(ob_get_status); + int count = params.size(); + if (count <= 0) return (f_ob_get_status()); + return (f_ob_get_status(params.rvalAt(0))); +} +Variant i_exit(CArrRef params) { + FUNCTION_INJECTION(exit); + int count = params.size(); + if (count <= 0) return (f_exit()); + return (f_exit(params.rvalAt(0))); +} +Variant i_apc_sma_info(CArrRef params) { + FUNCTION_INJECTION(apc_sma_info); + int count = params.size(); + if (count <= 0) return (f_apc_sma_info()); + return (f_apc_sma_info(params.rvalAt(0))); +} +Variant i_ldap_bind(CArrRef params) { + FUNCTION_INJECTION(ldap_bind); + int count = params.size(); + if (count <= 1) return (f_ldap_bind(params.rvalAt(0))); + if (count == 2) return (f_ldap_bind(params.rvalAt(0), params.rvalAt(1))); + return (f_ldap_bind(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_pixelsetbluequantum(CArrRef params) { + FUNCTION_INJECTION(pixelsetbluequantum); + return (f_pixelsetbluequantum(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_magickreadimagefile(CArrRef params) { + FUNCTION_INJECTION(magickreadimagefile); + return (f_magickreadimagefile(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ebcdic2ascii(CArrRef params) { + FUNCTION_INJECTION(ebcdic2ascii); + return (f_ebcdic2ascii(params.rvalAt(0))); +} +Variant i_mysql_real_escape_string(CArrRef params) { + FUNCTION_INJECTION(mysql_real_escape_string); + int count = params.size(); + if (count <= 1) return (f_mysql_real_escape_string(params.rvalAt(0))); + return (f_mysql_real_escape_string(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickframeimage(CArrRef params) { + FUNCTION_INJECTION(magickframeimage); + return (f_magickframeimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_pixelgetblue(CArrRef params) { + FUNCTION_INJECTION(pixelgetblue); + return (f_pixelgetblue(params.rvalAt(0))); +} +Variant i_imagefill(CArrRef params) { + FUNCTION_INJECTION(imagefill); + return (f_imagefill(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_hphp_set_property(CArrRef params) { + FUNCTION_INJECTION(hphp_set_property); + return (f_hphp_set_property(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); +} +Variant i_oci_execute(CArrRef params) { + FUNCTION_INJECTION(oci_execute); + int count = params.size(); + if (count <= 1) return (f_oci_execute(params.rvalAt(0))); + return (f_oci_execute(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_oci_cancel(CArrRef params) { + FUNCTION_INJECTION(oci_cancel); + return (f_oci_cancel(params.rvalAt(0))); +} +Variant i_readgzfile(CArrRef params) { + FUNCTION_INJECTION(readgzfile); + int count = params.size(); + if (count <= 1) return (f_readgzfile(params.rvalAt(0))); + return (f_readgzfile(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fb_backtrace(CArrRef params) { + FUNCTION_INJECTION(fb_backtrace); + int count = params.size(); + if (count <= 0) return (f_fb_backtrace()); + return (f_fb_backtrace(params.rvalAt(0))); +} +Variant i_magicksampleimage(CArrRef params) { + FUNCTION_INJECTION(magicksampleimage); + return (f_magicksampleimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mysql_escape_string(CArrRef params) { + FUNCTION_INJECTION(mysql_escape_string); + return (f_mysql_escape_string(params.rvalAt(0))); +} +Variant i_idn_to_utf8(CArrRef params) { + FUNCTION_INJECTION(idn_to_utf8); + int count = params.size(); + if (count <= 1) return (f_idn_to_utf8(params.rvalAt(0))); + return (f_idn_to_utf8(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); +} +Variant i_sql_regcase(CArrRef params) { + FUNCTION_INJECTION(sql_regcase); + return (f_sql_regcase(params.rvalAt(0))); +} +Variant i_in_array(CArrRef params) { + FUNCTION_INJECTION(in_array); + int count = params.size(); + if (count <= 2) return (f_in_array(params.rvalAt(0), params.rvalAt(1))); + return (f_in_array(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawpathcurvetoquadraticbezierabsolute(CArrRef params) { + FUNCTION_INJECTION(drawpathcurvetoquadraticbezierabsolute); + return (f_drawpathcurvetoquadraticbezierabsolute(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); +} +Variant i_apache_getenv(CArrRef params) { + FUNCTION_INJECTION(apache_getenv); + int count = params.size(); + if (count <= 1) return (f_apache_getenv(params.rvalAt(0))); + return (f_apache_getenv(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_socket_set_timeout(CArrRef params) { + FUNCTION_INJECTION(socket_set_timeout); + int count = params.size(); + if (count <= 2) return (f_socket_set_timeout(params.rvalAt(0), params.rvalAt(1))); + return (f_socket_set_timeout(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_bin2hex(CArrRef params) { + FUNCTION_INJECTION(bin2hex); + return (f_bin2hex(params.rvalAt(0))); +} +Variant i_error_get_last(CArrRef params) { + FUNCTION_INJECTION(error_get_last); + return (f_error_get_last()); +} +Variant i_is_link(CArrRef params) { + FUNCTION_INJECTION(is_link); + return (f_is_link(params.rvalAt(0))); +} +Variant i_set_file_buffer(CArrRef params) { + FUNCTION_INJECTION(set_file_buffer); + return (f_set_file_buffer(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicksetimageredprimary(CArrRef params) { + FUNCTION_INJECTION(magicksetimageredprimary); + return (f_magicksetimageredprimary(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_i18n_loc_set_default(CArrRef params) { + FUNCTION_INJECTION(i18n_loc_set_default); + return (f_i18n_loc_set_default(params.rvalAt(0))); +} +Variant i_ftok(CArrRef params) { + FUNCTION_INJECTION(ftok); + return (f_ftok(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mysql_list_fields(CArrRef params) { + FUNCTION_INJECTION(mysql_list_fields); + int count = params.size(); + if (count <= 2) return (f_mysql_list_fields(params.rvalAt(0), params.rvalAt(1))); + return (f_mysql_list_fields(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_stream_wrapper_register(CArrRef params) { + FUNCTION_INJECTION(stream_wrapper_register); + return (f_stream_wrapper_register(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pixelsetredquantum(CArrRef params) { + FUNCTION_INJECTION(pixelsetredquantum); + return (f_pixelsetredquantum(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_xhprof_disable(CArrRef params) { + FUNCTION_INJECTION(xhprof_disable); + return (f_xhprof_disable()); +} +Variant i_magickgammaimage(CArrRef params) { + FUNCTION_INJECTION(magickgammaimage); + int count = params.size(); + if (count <= 2) return (f_magickgammaimage(params.rvalAt(0), params.rvalAt(1))); + return (f_magickgammaimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_pixelsetcyan(CArrRef params) { + FUNCTION_INJECTION(pixelsetcyan); + return (f_pixelsetcyan(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mb_decode_mimeheader(CArrRef params) { + FUNCTION_INJECTION(mb_decode_mimeheader); + return (f_mb_decode_mimeheader(params.rvalAt(0))); +} +Variant i_htmlentities(CArrRef params) { + FUNCTION_INJECTION(htmlentities); + int count = params.size(); + if (count <= 1) return (f_htmlentities(params.rvalAt(0))); + if (count == 2) return (f_htmlentities(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_htmlentities(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_htmlentities(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_rad2deg(CArrRef params) { + FUNCTION_INJECTION(rad2deg); + return (f_rad2deg(params.rvalAt(0))); +} +Variant i_xmlwriter_start_dtd(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_dtd); + int count = params.size(); + if (count <= 2) return (f_xmlwriter_start_dtd(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_xmlwriter_start_dtd(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_xmlwriter_start_dtd(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawpathstart(CArrRef params) { + FUNCTION_INJECTION(drawpathstart); + return (f_drawpathstart(params.rvalAt(0)), null); +} +Variant i_proc_nice(CArrRef params) { + FUNCTION_INJECTION(proc_nice); + return (f_proc_nice(params.rvalAt(0))); +} +Variant i_hphp_thread_is_warmup_enabled(CArrRef params) { + FUNCTION_INJECTION(hphp_thread_is_warmup_enabled); + return (f_hphp_thread_is_warmup_enabled()); +} +Variant i_imagepsslantfont(CArrRef params) { + FUNCTION_INJECTION(imagepsslantfont); + return (f_imagepsslantfont(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetimagemattecolor(CArrRef params) { + FUNCTION_INJECTION(magickgetimagemattecolor); + return (f_magickgetimagemattecolor(params.rvalAt(0))); +} +Variant i_mb_strstr(CArrRef params) { + FUNCTION_INJECTION(mb_strstr); + int count = params.size(); + if (count <= 2) return (f_mb_strstr(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_strstr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_strstr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_pixelgetblack(CArrRef params) { + FUNCTION_INJECTION(pixelgetblack); + return (f_pixelgetblack(params.rvalAt(0))); +} +Variant i_mysql_field_table(CArrRef params) { + FUNCTION_INJECTION(mysql_field_table); + int count = params.size(); + if (count <= 1) return (f_mysql_field_table(params.rvalAt(0))); + return (f_mysql_field_table(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicksetimagescene(CArrRef params) { + FUNCTION_INJECTION(magicksetimagescene); + return (f_magicksetimagescene(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetimagerenderingintent(CArrRef params) { + FUNCTION_INJECTION(magickgetimagerenderingintent); + return (f_magickgetimagerenderingintent(params.rvalAt(0))); +} +Variant i_setlocale(CArrRef params) { + FUNCTION_INJECTION(setlocale); + int count = params.size(); + if (count <= 2) return (f_setlocale(count, params.rvalAt(0), params.rvalAt(1))); + return (f_setlocale(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_drawpushclippath(CArrRef params) { + FUNCTION_INJECTION(drawpushclippath); + return (f_drawpushclippath(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_drawpopclippath(CArrRef params) { + FUNCTION_INJECTION(drawpopclippath); + return (f_drawpopclippath(params.rvalAt(0)), null); +} +Variant i_nl2br(CArrRef params) { + FUNCTION_INJECTION(nl2br); + return (f_nl2br(params.rvalAt(0))); +} +Variant i_drawsetfillopacity(CArrRef params) { + FUNCTION_INJECTION(drawsetfillopacity); + return (f_drawsetfillopacity(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mb_substitute_character(CArrRef params) { + FUNCTION_INJECTION(mb_substitute_character); + int count = params.size(); + if (count <= 0) return (f_mb_substitute_character()); + return (f_mb_substitute_character(params.rvalAt(0))); +} +Variant i_setrawcookie(CArrRef params) { + FUNCTION_INJECTION(setrawcookie); + int count = params.size(); + if (count <= 1) return (f_setrawcookie(params.rvalAt(0))); + if (count == 2) return (f_setrawcookie(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_setrawcookie(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_setrawcookie(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_setrawcookie(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_setrawcookie(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + return (f_setrawcookie(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); +} +Variant i_evhttp_get(CArrRef params) { + FUNCTION_INJECTION(evhttp_get); + int count = params.size(); + if (count <= 1) return (f_evhttp_get(params.rvalAt(0))); + if (count == 2) return (f_evhttp_get(params.rvalAt(0), params.rvalAt(1))); + return (f_evhttp_get(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_getimagesize(CArrRef params) { + FUNCTION_INJECTION(getimagesize); + int count = params.size(); + if (count <= 1) return (f_getimagesize(params.rvalAt(0))); + return (f_getimagesize(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); +} +Variant i_ldap_modify(CArrRef params) { + FUNCTION_INJECTION(ldap_modify); + return (f_ldap_modify(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_ldap_search(CArrRef params) { + FUNCTION_INJECTION(ldap_search); + int count = params.size(); + if (count <= 3) return (f_ldap_search(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_ldap_search(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_ldap_search(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_ldap_search(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + if (count == 7) return (f_ldap_search(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); + return (f_ldap_search(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); +} +Variant i_strcasecmp(CArrRef params) { + FUNCTION_INJECTION(strcasecmp); + return (f_strcasecmp(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetimagesignature(CArrRef params) { + FUNCTION_INJECTION(magickgetimagesignature); + return (f_magickgetimagesignature(params.rvalAt(0))); +} +Variant i_get_class_methods(CArrRef params) { + FUNCTION_INJECTION(get_class_methods); + return (f_get_class_methods(params.rvalAt(0))); +} +Variant i_fopen(CArrRef params) { + FUNCTION_INJECTION(fopen); + int count = params.size(); + if (count <= 2) return (f_fopen(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_fopen(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_fopen(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_mcrypt_generic_end(CArrRef params) { + FUNCTION_INJECTION(mcrypt_generic_end); + return (f_mcrypt_generic_end(params.rvalAt(0))); +} +Variant i_openssl_pkey_free(CArrRef params) { + FUNCTION_INJECTION(openssl_pkey_free); + return (f_openssl_pkey_free(params.rvalAt(0)), null); +} +Variant i_fbml_get_tag_name_11(CArrRef params) { + FUNCTION_INJECTION(fbml_get_tag_name_11); + return (f_fbml_get_tag_name_11(params.rvalAt(0))); +} +Variant i_readlink(CArrRef params) { + FUNCTION_INJECTION(readlink); + return (f_readlink(params.rvalAt(0))); +} +Variant i_magickechoimagesblob(CArrRef params) { + FUNCTION_INJECTION(magickechoimagesblob); + return (f_magickechoimagesblob(params.rvalAt(0))); +} +Variant i_mailparse_msg_parse(CArrRef params) { + FUNCTION_INJECTION(mailparse_msg_parse); + return (f_mailparse_msg_parse(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xmlwriter_text(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_text); + return (f_xmlwriter_text(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pixelsetindex(CArrRef params) { + FUNCTION_INJECTION(pixelsetindex); + return (f_pixelsetindex(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_php_sapi_name(CArrRef params) { + FUNCTION_INJECTION(php_sapi_name); + return (f_php_sapi_name()); +} +Variant i_mcrypt_enc_get_key_size(CArrRef params) { + FUNCTION_INJECTION(mcrypt_enc_get_key_size); + return (f_mcrypt_enc_get_key_size(params.rvalAt(0))); +} +Variant i_mysql_num_fields(CArrRef params) { + FUNCTION_INJECTION(mysql_num_fields); + return (f_mysql_num_fields(params.rvalAt(0))); +} +Variant i_phprof_enable(CArrRef params) { + FUNCTION_INJECTION(phprof_enable); + int count = params.size(); + if (count <= 0) return (f_phprof_enable(), null); + return (f_phprof_enable(params.rvalAt(0)), null); +} +Variant i_magicksteganoimage(CArrRef params) { + FUNCTION_INJECTION(magicksteganoimage); + return (f_magicksteganoimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magicksetfirstiterator(CArrRef params) { + FUNCTION_INJECTION(magicksetfirstiterator); + return (f_magicksetfirstiterator(params.rvalAt(0)), null); +} +Variant i_pixelgetcolorasstring(CArrRef params) { + FUNCTION_INJECTION(pixelgetcolorasstring); + return (f_pixelgetcolorasstring(params.rvalAt(0))); +} +Variant i_magickremoveimage(CArrRef params) { + FUNCTION_INJECTION(magickremoveimage); + return (f_magickremoveimage(params.rvalAt(0))); +} +Variant i_file_exists(CArrRef params) { + FUNCTION_INJECTION(file_exists); + return (f_file_exists(params.rvalAt(0))); +} +Variant i_call_user_func_array(CArrRef params) { + FUNCTION_INJECTION(call_user_func_array); + return (f_call_user_func_array(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_restore_include_path(CArrRef params) { + FUNCTION_INJECTION(restore_include_path); + return (f_restore_include_path(), null); +} +Variant i_drawgettextundercolor(CArrRef params) { + FUNCTION_INJECTION(drawgettextundercolor); + return (f_drawgettextundercolor(params.rvalAt(0))); +} +Variant i_array_shift(CArrRef params) { + FUNCTION_INJECTION(array_shift); + return (f_array_shift(ref(const_cast(params).lvalAt(0)))); +} +Variant i_magicksetimageformat(CArrRef params) { + FUNCTION_INJECTION(magicksetimageformat); + return (f_magicksetimageformat(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xmlwriter_open_memory(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_open_memory); + return (f_xmlwriter_open_memory()); +} +Variant i_drawsetstrokemiterlimit(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokemiterlimit); + return (f_drawsetstrokemiterlimit(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mb_convert_kana(CArrRef params) { + FUNCTION_INJECTION(mb_convert_kana); + int count = params.size(); + if (count <= 1) return (f_mb_convert_kana(params.rvalAt(0))); + if (count == 2) return (f_mb_convert_kana(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_convert_kana(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_token_name(CArrRef params) { + FUNCTION_INJECTION(token_name); + return (f_token_name(params.rvalAt(0))); +} +Variant i_preg_quote(CArrRef params) { + FUNCTION_INJECTION(preg_quote); + int count = params.size(); + if (count <= 1) return (f_preg_quote(params.rvalAt(0))); + return (f_preg_quote(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hphp_service_thread_started(CArrRef params) { + FUNCTION_INJECTION(hphp_service_thread_started); + return (f_hphp_service_thread_started(), null); +} +Variant i_magickconvolveimage(CArrRef params) { + FUNCTION_INJECTION(magickconvolveimage); + int count = params.size(); + if (count <= 2) return (f_magickconvolveimage(params.rvalAt(0), params.rvalAt(1))); + return (f_magickconvolveimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_curl_getinfo(CArrRef params) { + FUNCTION_INJECTION(curl_getinfo); + int count = params.size(); + if (count <= 1) return (f_curl_getinfo(params.rvalAt(0))); + return (f_curl_getinfo(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pfsockopen(CArrRef params) { + FUNCTION_INJECTION(pfsockopen); + int count = params.size(); + if (count <= 1) return (f_pfsockopen(params.rvalAt(0))); + if (count == 2) return (f_pfsockopen(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_pfsockopen(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + if (count == 4) return (f_pfsockopen(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)))); + return (f_pfsockopen(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)), params.rvalAt(4))); +} +Variant i_ucfirst(CArrRef params) { + FUNCTION_INJECTION(ucfirst); + return (f_ucfirst(params.rvalAt(0))); +} +Variant i_chroot(CArrRef params) { + FUNCTION_INJECTION(chroot); + return (f_chroot(params.rvalAt(0))); +} +Variant i_chdir(CArrRef params) { + FUNCTION_INJECTION(chdir); + return (f_chdir(params.rvalAt(0))); +} +Variant i_socket_write(CArrRef params) { + FUNCTION_INJECTION(socket_write); + int count = params.size(); + if (count <= 2) return (f_socket_write(params.rvalAt(0), params.rvalAt(1))); + return (f_socket_write(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_stream_bucket_new(CArrRef params) { + FUNCTION_INJECTION(stream_bucket_new); + return (f_stream_bucket_new(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickflipimage(CArrRef params) { + FUNCTION_INJECTION(magickflipimage); + return (f_magickflipimage(params.rvalAt(0))); +} +Variant i_timezone_identifiers_list(CArrRef params) { + FUNCTION_INJECTION(timezone_identifiers_list); + return (f_timezone_identifiers_list()); +} +Variant i_array_diff_key(CArrRef params) { + FUNCTION_INJECTION(array_diff_key); + int count = params.size(); + if (count <= 2) return (f_array_diff_key(count, params.rvalAt(0), params.rvalAt(1))); + return (f_array_diff_key(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_fread(CArrRef params) { + FUNCTION_INJECTION(fread); + return (f_fread(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_override_function(CArrRef params) { + FUNCTION_INJECTION(override_function); + return (f_override_function(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_is_long(CArrRef params) { + FUNCTION_INJECTION(is_long); + return (f_is_long(params.rvalAt(0))); +} +Variant i_pixelsetred(CArrRef params) { + FUNCTION_INJECTION(pixelsetred); + return (f_pixelsetred(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mailparse_uudecode_all(CArrRef params) { + FUNCTION_INJECTION(mailparse_uudecode_all); + return (f_mailparse_uudecode_all(params.rvalAt(0))); +} +Variant i_drawsetvectorgraphics(CArrRef params) { + FUNCTION_INJECTION(drawsetvectorgraphics); + return (f_drawsetvectorgraphics(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_oci_parse(CArrRef params) { + FUNCTION_INJECTION(oci_parse); + return (f_oci_parse(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ctype_upper(CArrRef params) { + FUNCTION_INJECTION(ctype_upper); + return (f_ctype_upper(params.rvalAt(0))); +} +Variant i_get_declared_classes(CArrRef params) { + FUNCTION_INJECTION(get_declared_classes); + return (f_get_declared_classes()); +} +Variant i_drawgetstrokelinejoin(CArrRef params) { + FUNCTION_INJECTION(drawgetstrokelinejoin); + return (f_drawgetstrokelinejoin(params.rvalAt(0))); +} +Variant i_popen(CArrRef params) { + FUNCTION_INJECTION(popen); + return (f_popen(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_next_entry(CArrRef params) { + FUNCTION_INJECTION(ldap_next_entry); + return (f_ldap_next_entry(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mailparse_msg_parse_file(CArrRef params) { + FUNCTION_INJECTION(mailparse_msg_parse_file); + return (f_mailparse_msg_parse_file(params.rvalAt(0))); +} +Variant i_get_loaded_extensions(CArrRef params) { + FUNCTION_INJECTION(get_loaded_extensions); + int count = params.size(); + if (count <= 0) return (f_get_loaded_extensions()); + return (f_get_loaded_extensions(params.rvalAt(0))); +} +Variant i_magickdrawimage(CArrRef params) { + FUNCTION_INJECTION(magickdrawimage); + return (f_magickdrawimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mcrypt_cbc(CArrRef params) { + FUNCTION_INJECTION(mcrypt_cbc); + int count = params.size(); + if (count <= 4) return (f_mcrypt_cbc(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_mcrypt_cbc(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_imagecreatetruecolor(CArrRef params) { + FUNCTION_INJECTION(imagecreatetruecolor); + return (f_imagecreatetruecolor(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_inet_ntop(CArrRef params) { + FUNCTION_INJECTION(inet_ntop); + return (f_inet_ntop(params.rvalAt(0))); +} +Variant i_magickreadimage(CArrRef params) { + FUNCTION_INJECTION(magickreadimage); + return (f_magickreadimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_curl_init(CArrRef params) { + FUNCTION_INJECTION(curl_init); + int count = params.size(); + if (count <= 0) return (f_curl_init()); + return (f_curl_init(params.rvalAt(0))); +} +Variant i_mcrypt_cfb(CArrRef params) { + FUNCTION_INJECTION(mcrypt_cfb); + int count = params.size(); + if (count <= 4) return (f_mcrypt_cfb(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_mcrypt_cfb(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_set_time_limit(CArrRef params) { + FUNCTION_INJECTION(set_time_limit); + return (f_set_time_limit(params.rvalAt(0)), null); +} +Variant i_libxml_get_errors(CArrRef params) { + FUNCTION_INJECTION(libxml_get_errors); + return (f_libxml_get_errors()); +} +Variant i_get_magic_quotes_gpc(CArrRef params) { + FUNCTION_INJECTION(get_magic_quotes_gpc); + return (f_get_magic_quotes_gpc()); +} +Variant i_proc_get_status(CArrRef params) { + FUNCTION_INJECTION(proc_get_status); + return (f_proc_get_status(params.rvalAt(0))); +} +Variant i_log10(CArrRef params) { + FUNCTION_INJECTION(log10); + return (f_log10(params.rvalAt(0))); +} +Variant i_ldap_get_values(CArrRef params) { + FUNCTION_INJECTION(ldap_get_values); + return (f_ldap_get_values(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_is_soap_fault(CArrRef params) { + FUNCTION_INJECTION(is_soap_fault); + return (f_is_soap_fault(params.rvalAt(0))); +} +Variant i_magickgetimagechannelmean(CArrRef params) { + FUNCTION_INJECTION(magickgetimagechannelmean); + return (f_magickgetimagechannelmean(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_disk_total_space(CArrRef params) { + FUNCTION_INJECTION(disk_total_space); + return (f_disk_total_space(params.rvalAt(0))); +} +Variant i_imagegd(CArrRef params) { + FUNCTION_INJECTION(imagegd); + int count = params.size(); + if (count <= 1) return (f_imagegd(params.rvalAt(0))); + return (f_imagegd(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_socket_set_blocking(CArrRef params) { + FUNCTION_INJECTION(socket_set_blocking); + return (f_socket_set_blocking(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_posix_mknod(CArrRef params) { + FUNCTION_INJECTION(posix_mknod); + int count = params.size(); + if (count <= 2) return (f_posix_mknod(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_posix_mknod(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_posix_mknod(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_apc_define_constants(CArrRef params) { + FUNCTION_INJECTION(apc_define_constants); + int count = params.size(); + if (count <= 2) return (f_apc_define_constants(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_apc_define_constants(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_apc_define_constants(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_posix_kill(CArrRef params) { + FUNCTION_INJECTION(posix_kill); + return (f_posix_kill(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetstrokealpha(CArrRef params) { + FUNCTION_INJECTION(drawgetstrokealpha); + return (f_drawgetstrokealpha(params.rvalAt(0))); +} +Variant i_mcrypt_get_block_size(CArrRef params) { + FUNCTION_INJECTION(mcrypt_get_block_size); + int count = params.size(); + if (count <= 1) return (f_mcrypt_get_block_size(params.rvalAt(0))); + return (f_mcrypt_get_block_size(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickmorphimages(CArrRef params) { + FUNCTION_INJECTION(magickmorphimages); + return (f_magickmorphimages(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_getlastmod(CArrRef params) { + FUNCTION_INJECTION(getlastmod); + return (f_getlastmod()); +} +Variant i_magickquantizeimage(CArrRef params) { + FUNCTION_INJECTION(magickquantizeimage); + return (f_magickquantizeimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_imagesavealpha(CArrRef params) { + FUNCTION_INJECTION(imagesavealpha); + return (f_imagesavealpha(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawsetfontfamily(CArrRef params) { + FUNCTION_INJECTION(drawsetfontfamily); + return (f_drawsetfontfamily(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawsettextantialias(CArrRef params) { + FUNCTION_INJECTION(drawsettextantialias); + int count = params.size(); + if (count <= 1) return (f_drawsettextantialias(params.rvalAt(0)), null); + return (f_drawsettextantialias(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_pixelsetgreenquantum(CArrRef params) { + FUNCTION_INJECTION(pixelsetgreenquantum); + return (f_pixelsetgreenquantum(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_bcsqrt(CArrRef params) { + FUNCTION_INJECTION(bcsqrt); + int count = params.size(); + if (count <= 1) return (f_bcsqrt(params.rvalAt(0))); + return (f_bcsqrt(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fbml_sanitize_css_11(CArrRef params) { + FUNCTION_INJECTION(fbml_sanitize_css_11); + return (f_fbml_sanitize_css_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_pcntl_signal(CArrRef params) { + FUNCTION_INJECTION(pcntl_signal); + int count = params.size(); + if (count <= 2) return (f_pcntl_signal(params.rvalAt(0), params.rvalAt(1))); + return (f_pcntl_signal(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mcrypt_ecb(CArrRef params) { + FUNCTION_INJECTION(mcrypt_ecb); + int count = params.size(); + if (count <= 4) return (f_mcrypt_ecb(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_mcrypt_ecb(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_pixelsetcyanquantum(CArrRef params) { + FUNCTION_INJECTION(pixelsetcyanquantum); + return (f_pixelsetcyanquantum(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_array_walk(CArrRef params) { + FUNCTION_INJECTION(array_walk); + int count = params.size(); + if (count <= 2) return (f_array_walk(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); + return (f_array_walk(ref(const_cast(params).lvalAt(0)), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_getmxrr(CArrRef params) { + FUNCTION_INJECTION(getmxrr); + int count = params.size(); + if (count <= 2) return (f_getmxrr(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_getmxrr(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); +} +Variant i_magickqueryfonts(CArrRef params) { + FUNCTION_INJECTION(magickqueryfonts); + return (f_magickqueryfonts(params.rvalAt(0))); +} +Variant i_floatval(CArrRef params) { + FUNCTION_INJECTION(floatval); + return (f_floatval(params.rvalAt(0))); +} +Variant i_xml_set_object(CArrRef params) { + FUNCTION_INJECTION(xml_set_object); + return (f_xml_set_object(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); +} +Variant i_ctype_print(CArrRef params) { + FUNCTION_INJECTION(ctype_print); + return (f_ctype_print(params.rvalAt(0))); +} +Variant i_gzwrite(CArrRef params) { + FUNCTION_INJECTION(gzwrite); + int count = params.size(); + if (count <= 2) return (f_gzwrite(params.rvalAt(0), params.rvalAt(1))); + return (f_gzwrite(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickaddimage(CArrRef params) { + FUNCTION_INJECTION(magickaddimage); + return (f_magickaddimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_clearstatcache(CArrRef params) { + FUNCTION_INJECTION(clearstatcache); + return (f_clearstatcache(), null); +} +Variant i_chgrp(CArrRef params) { + FUNCTION_INJECTION(chgrp); + return (f_chgrp(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_virtual(CArrRef params) { + FUNCTION_INJECTION(virtual); + return (f_virtual(params.rvalAt(0))); +} +Variant i_reset(CArrRef params) { + FUNCTION_INJECTION(reset); + return (f_reset(ref(const_cast(params).lvalAt(0)))); +} +Variant i_fbml_get_text_11(CArrRef params) { + FUNCTION_INJECTION(fbml_get_text_11); + return (f_fbml_get_text_11(params.rvalAt(0))); +} +Variant i_oci_field_type(CArrRef params) { + FUNCTION_INJECTION(oci_field_type); + return (f_oci_field_type(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_set_include_path(CArrRef params) { + FUNCTION_INJECTION(set_include_path); + return (f_set_include_path(params.rvalAt(0))); +} +Variant i_openssl_x509_export(CArrRef params) { + FUNCTION_INJECTION(openssl_x509_export); + int count = params.size(); + if (count <= 2) return (f_openssl_x509_export(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_openssl_x509_export(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); +} +Variant i_magickcolorizeimage(CArrRef params) { + FUNCTION_INJECTION(magickcolorizeimage); + return (f_magickcolorizeimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagettftext(CArrRef params) { + FUNCTION_INJECTION(imagettftext); + return (f_imagettftext(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); +} +Variant i_mb_strrchr(CArrRef params) { + FUNCTION_INJECTION(mb_strrchr); + int count = params.size(); + if (count <= 2) return (f_mb_strrchr(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_strrchr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_strrchr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magickgetimageprofile(CArrRef params) { + FUNCTION_INJECTION(magickgetimageprofile); + return (f_magickgetimageprofile(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_file_put_contents(CArrRef params) { + FUNCTION_INJECTION(file_put_contents); + int count = params.size(); + if (count <= 2) return (f_file_put_contents(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_file_put_contents(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_file_put_contents(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_iconv_mime_encode(CArrRef params) { + FUNCTION_INJECTION(iconv_mime_encode); + int count = params.size(); + if (count <= 2) return (f_iconv_mime_encode(params.rvalAt(0), params.rvalAt(1))); + return (f_iconv_mime_encode(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_log1p(CArrRef params) { + FUNCTION_INJECTION(log1p); + return (f_log1p(params.rvalAt(0))); +} +Variant i_fwrite(CArrRef params) { + FUNCTION_INJECTION(fwrite); + int count = params.size(); + if (count <= 2) return (f_fwrite(params.rvalAt(0), params.rvalAt(1))); + return (f_fwrite(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_atan2(CArrRef params) { + FUNCTION_INJECTION(atan2); + return (f_atan2(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_is_a(CArrRef params) { + FUNCTION_INJECTION(is_a); + return (f_is_a(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_idate(CArrRef params) { + FUNCTION_INJECTION(idate); + int count = params.size(); + if (count <= 1) return (f_idate(params.rvalAt(0))); + return (f_idate(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_posix_initgroups(CArrRef params) { + FUNCTION_INJECTION(posix_initgroups); + return (f_posix_initgroups(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_arsort(CArrRef params) { + FUNCTION_INJECTION(arsort); + int count = params.size(); + if (count <= 1) return (f_arsort(ref(const_cast(params).lvalAt(0)))); + if (count == 2) return (f_arsort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); + return (f_arsort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_gethostbyaddr(CArrRef params) { + FUNCTION_INJECTION(gethostbyaddr); + return (f_gethostbyaddr(params.rvalAt(0))); +} +Variant i_apc_delete(CArrRef params) { + FUNCTION_INJECTION(apc_delete); + int count = params.size(); + if (count <= 1) return (f_apc_delete(params.rvalAt(0))); + return (f_apc_delete(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicklevelimage(CArrRef params) { + FUNCTION_INJECTION(magicklevelimage); + int count = params.size(); + if (count <= 4) return (f_magicklevelimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_magicklevelimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_openssl_x509_parse(CArrRef params) { + FUNCTION_INJECTION(openssl_x509_parse); + int count = params.size(); + if (count <= 1) return (f_openssl_x509_parse(params.rvalAt(0))); + return (f_openssl_x509_parse(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickcommentimage(CArrRef params) { + FUNCTION_INJECTION(magickcommentimage); + return (f_magickcommentimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicksetimagedelay(CArrRef params) { + FUNCTION_INJECTION(magicksetimagedelay); + return (f_magicksetimagedelay(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickposterizeimage(CArrRef params) { + FUNCTION_INJECTION(magickposterizeimage); + return (f_magickposterizeimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_stream_socket_accept(CArrRef params) { + FUNCTION_INJECTION(stream_socket_accept); + int count = params.size(); + if (count <= 1) return (f_stream_socket_accept(params.rvalAt(0))); + if (count == 2) return (f_stream_socket_accept(params.rvalAt(0), params.rvalAt(1))); + return (f_stream_socket_accept(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_magickqueryconfigureoption(CArrRef params) { + FUNCTION_INJECTION(magickqueryconfigureoption); + return (f_magickqueryconfigureoption(params.rvalAt(0))); +} +Variant i_magickevaluateimage(CArrRef params) { + FUNCTION_INJECTION(magickevaluateimage); + int count = params.size(); + if (count <= 3) return (f_magickevaluateimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickevaluateimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_imagesx(CArrRef params) { + FUNCTION_INJECTION(imagesx); + return (f_imagesx(params.rvalAt(0))); +} +Variant i_imagesy(CArrRef params) { + FUNCTION_INJECTION(imagesy); + return (f_imagesy(params.rvalAt(0))); +} +Variant i_mysql_get_client_info(CArrRef params) { + FUNCTION_INJECTION(mysql_get_client_info); + return (f_mysql_get_client_info()); +} +Variant i_fb_crossall_query(CArrRef params) { + FUNCTION_INJECTION(fb_crossall_query); + int count = params.size(); + if (count <= 1) return (f_fb_crossall_query(params.rvalAt(0))); + if (count == 2) return (f_fb_crossall_query(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_fb_crossall_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_fb_crossall_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_fb_crossall_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_fb_crossall_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_fseek(CArrRef params) { + FUNCTION_INJECTION(fseek); + int count = params.size(); + if (count <= 2) return (f_fseek(params.rvalAt(0), params.rvalAt(1))); + return (f_fseek(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_apc_compile_file(CArrRef params) { + FUNCTION_INJECTION(apc_compile_file); + int count = params.size(); + if (count <= 1) return (f_apc_compile_file(params.rvalAt(0))); + if (count == 2) return (f_apc_compile_file(params.rvalAt(0), params.rvalAt(1))); + return (f_apc_compile_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magicksetpassphrase(CArrRef params) { + FUNCTION_INJECTION(magicksetpassphrase); + return (f_magicksetpassphrase(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mysql_info(CArrRef params) { + FUNCTION_INJECTION(mysql_info); + int count = params.size(); + if (count <= 0) return (f_mysql_info()); + return (f_mysql_info(params.rvalAt(0))); +} +Variant i_is_writable(CArrRef params) { + FUNCTION_INJECTION(is_writable); + return (f_is_writable(params.rvalAt(0))); +} +Variant i_magickrotateimage(CArrRef params) { + FUNCTION_INJECTION(magickrotateimage); + return (f_magickrotateimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_fgetcsv(CArrRef params) { + FUNCTION_INJECTION(fgetcsv); + int count = params.size(); + if (count <= 1) return (f_fgetcsv(params.rvalAt(0))); + if (count == 2) return (f_fgetcsv(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_fgetcsv(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_fgetcsv(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_oci_fetch_array(CArrRef params) { + FUNCTION_INJECTION(oci_fetch_array); + int count = params.size(); + if (count <= 1) return (f_oci_fetch_array(params.rvalAt(0))); + return (f_oci_fetch_array(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickcolorfloodfillimage(CArrRef params) { + FUNCTION_INJECTION(magickcolorfloodfillimage); + return (f_magickcolorfloodfillimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_atanh(CArrRef params) { + FUNCTION_INJECTION(atanh); + return (f_atanh(params.rvalAt(0))); +} +Variant i_imagecopyresized(CArrRef params) { + FUNCTION_INJECTION(imagecopyresized); + return (f_imagecopyresized(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9))); +} +Variant i_fpassthru(CArrRef params) { + FUNCTION_INJECTION(fpassthru); + return (f_fpassthru(params.rvalAt(0))); +} +Variant i_magickblackthresholdimage(CArrRef params) { + FUNCTION_INJECTION(magickblackthresholdimage); + return (f_magickblackthresholdimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mcrypt_encrypt(CArrRef params) { + FUNCTION_INJECTION(mcrypt_encrypt); + int count = params.size(); + if (count <= 4) return (f_mcrypt_encrypt(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_mcrypt_encrypt(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_magicksetimagegreenprimary(CArrRef params) { + FUNCTION_INJECTION(magicksetimagegreenprimary); + return (f_magicksetimagegreenprimary(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_xmlwriter_start_attribute_ns(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_attribute_ns); + return (f_xmlwriter_start_attribute_ns(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magickgetimageinterlacescheme(CArrRef params) { + FUNCTION_INJECTION(magickgetimageinterlacescheme); + return (f_magickgetimageinterlacescheme(params.rvalAt(0))); +} +Variant i_apache_child_terminate(CArrRef params) { + FUNCTION_INJECTION(apache_child_terminate); + return (f_apache_child_terminate()); +} +Variant i_array_merge_recursive(CArrRef params) { + FUNCTION_INJECTION(array_merge_recursive); + int count = params.size(); + if (count <= 1) return (f_array_merge_recursive(count, params.rvalAt(0))); + return (f_array_merge_recursive(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_array_uintersect(CArrRef params) { + FUNCTION_INJECTION(array_uintersect); + int count = params.size(); + if (count <= 3) return (f_array_uintersect(count, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_array_uintersect(count,params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.slice(3, count - 3, false))); +} +Variant i_xml_set_unparsed_entity_decl_handler(CArrRef params) { + FUNCTION_INJECTION(xml_set_unparsed_entity_decl_handler); + return (f_xml_set_unparsed_entity_decl_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ob_get_contents(CArrRef params) { + FUNCTION_INJECTION(ob_get_contents); + return (f_ob_get_contents()); +} +Variant i_pixelgetcyan(CArrRef params) { + FUNCTION_INJECTION(pixelgetcyan); + return (f_pixelgetcyan(params.rvalAt(0))); +} +Variant i_stream_select(CArrRef params) { + FUNCTION_INJECTION(stream_select); + int count = params.size(); + if (count <= 4) return (f_stream_select(ref(const_cast(params).lvalAt(0)), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); + return (f_stream_select(ref(const_cast(params).lvalAt(0)), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_get_resource_type(CArrRef params) { + FUNCTION_INJECTION(get_resource_type); + return (f_get_resource_type(params.rvalAt(0))); +} +Variant i_dangling_server_proxy_old_request(CArrRef params) { + FUNCTION_INJECTION(dangling_server_proxy_old_request); + return (f_dangling_server_proxy_old_request()); +} +Variant i_magickgetimagefilename(CArrRef params) { + FUNCTION_INJECTION(magickgetimagefilename); + return (f_magickgetimagefilename(params.rvalAt(0))); +} +Variant i_exif_tagname(CArrRef params) { + FUNCTION_INJECTION(exif_tagname); + return (f_exif_tagname(params.rvalAt(0))); +} +Variant i_drawsetfillalpha(CArrRef params) { + FUNCTION_INJECTION(drawsetfillalpha); + return (f_drawsetfillalpha(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mb_convert_encoding(CArrRef params) { + FUNCTION_INJECTION(mb_convert_encoding); + int count = params.size(); + if (count <= 2) return (f_mb_convert_encoding(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_convert_encoding(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_wandgetexceptionstring(CArrRef params) { + FUNCTION_INJECTION(wandgetexceptionstring); + return (f_wandgetexceptionstring(params.rvalAt(0))); +} +Variant i_proc_open(CArrRef params) { + FUNCTION_INJECTION(proc_open); + int count = params.size(); + if (count <= 3) return (f_proc_open(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + if (count == 4) return (f_proc_open(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); + if (count == 5) return (f_proc_open(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4))); + return (f_proc_open(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_clearpixeliterator(CArrRef params) { + FUNCTION_INJECTION(clearpixeliterator); + return (f_clearpixeliterator(params.rvalAt(0)), null); +} +Variant i_socket_server(CArrRef params) { + FUNCTION_INJECTION(socket_server); + int count = params.size(); + if (count <= 1) return (f_socket_server(params.rvalAt(0))); + if (count == 2) return (f_socket_server(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_socket_server(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + return (f_socket_server(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)))); +} +Variant i_magickremoveimageprofile(CArrRef params) { + FUNCTION_INJECTION(magickremoveimageprofile); + return (f_magickremoveimageprofile(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xmlwriter_write_dtd_element(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_dtd_element); + return (f_xmlwriter_write_dtd_element(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawpushdefs(CArrRef params) { + FUNCTION_INJECTION(drawpushdefs); + return (f_drawpushdefs(params.rvalAt(0)), null); +} +Variant i_image2wbmp(CArrRef params) { + FUNCTION_INJECTION(image2wbmp); + int count = params.size(); + if (count <= 1) return (f_image2wbmp(params.rvalAt(0))); + if (count == 2) return (f_image2wbmp(params.rvalAt(0), params.rvalAt(1))); + return (f_image2wbmp(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_join(CArrRef params) { + FUNCTION_INJECTION(join); + int count = params.size(); + if (count <= 1) return (f_join(params.rvalAt(0))); + return (f_join(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicksetimage(CArrRef params) { + FUNCTION_INJECTION(magicksetimage); + return (f_magicksetimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_openssl_free_key(CArrRef params) { + FUNCTION_INJECTION(openssl_free_key); + return (f_openssl_free_key(params.rvalAt(0)), null); +} +Variant i_preg_grep(CArrRef params) { + FUNCTION_INJECTION(preg_grep); + int count = params.size(); + if (count <= 2) return (f_preg_grep(params.rvalAt(0), params.rvalAt(1))); + return (f_preg_grep(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_is_float(CArrRef params) { + FUNCTION_INJECTION(is_float); + return (f_is_float(params.rvalAt(0))); +} +Variant i_stream_socket_pair(CArrRef params) { + FUNCTION_INJECTION(stream_socket_pair); + return (f_stream_socket_pair(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_get_required_files(CArrRef params) { + FUNCTION_INJECTION(get_required_files); + return (f_get_required_files()); +} +Variant i_mysql_fetch_field(CArrRef params) { + FUNCTION_INJECTION(mysql_fetch_field); + int count = params.size(); + if (count <= 1) return (f_mysql_fetch_field(params.rvalAt(0))); + return (f_mysql_fetch_field(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fb_start_mcproxy(CArrRef params) { + FUNCTION_INJECTION(fb_start_mcproxy); + return (f_fb_start_mcproxy(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_chmod(CArrRef params) { + FUNCTION_INJECTION(chmod); + return (f_chmod(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgettextascent(CArrRef params) { + FUNCTION_INJECTION(magickgettextascent); + int count = params.size(); + if (count <= 3) return (f_magickgettextascent(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickgettextascent(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_mb_regex_encoding(CArrRef params) { + FUNCTION_INJECTION(mb_regex_encoding); + int count = params.size(); + if (count <= 0) return (f_mb_regex_encoding()); + return (f_mb_regex_encoding(params.rvalAt(0))); +} +Variant i_mail(CArrRef params) { + FUNCTION_INJECTION(mail); + int count = params.size(); + if (count <= 3) return (f_mail(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_mail(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_mail(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_mcrypt_enc_self_test(CArrRef params) { + FUNCTION_INJECTION(mcrypt_enc_self_test); + return (f_mcrypt_enc_self_test(params.rvalAt(0))); +} +Variant i_ignore_user_abort(CArrRef params) { + FUNCTION_INJECTION(ignore_user_abort); + int count = params.size(); + if (count <= 0) return (f_ignore_user_abort()); + return (f_ignore_user_abort(params.rvalAt(0))); +} +Variant i_oci_field_is_null(CArrRef params) { + FUNCTION_INJECTION(oci_field_is_null); + return (f_oci_field_is_null(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_imagesetthickness(CArrRef params) { + FUNCTION_INJECTION(imagesetthickness); + return (f_imagesetthickness(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_str_pad(CArrRef params) { + FUNCTION_INJECTION(str_pad); + int count = params.size(); + if (count <= 2) return (f_str_pad(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_str_pad(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_str_pad(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_openssl_pkcs7_decrypt(CArrRef params) { + FUNCTION_INJECTION(openssl_pkcs7_decrypt); + int count = params.size(); + if (count <= 3) return (f_openssl_pkcs7_decrypt(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_openssl_pkcs7_decrypt(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_pagelet_server_task_result(CArrRef params) { + FUNCTION_INJECTION(pagelet_server_task_result); + return (f_pagelet_server_task_result(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); +} +Variant i_asinh(CArrRef params) { + FUNCTION_INJECTION(asinh); + return (f_asinh(params.rvalAt(0))); +} +Variant i_mailparse_msg_extract_part(CArrRef params) { + FUNCTION_INJECTION(mailparse_msg_extract_part); + int count = params.size(); + if (count <= 2) return (f_mailparse_msg_extract_part(params.rvalAt(0), params.rvalAt(1)), null); + return (f_mailparse_msg_extract_part(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_magickgetimagecompose(CArrRef params) { + FUNCTION_INJECTION(magickgetimagecompose); + return (f_magickgetimagecompose(params.rvalAt(0))); +} +Variant i_magickcropimage(CArrRef params) { + FUNCTION_INJECTION(magickcropimage); + return (f_magickcropimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_ob_gzhandler(CArrRef params) { + FUNCTION_INJECTION(ob_gzhandler); + return (f_ob_gzhandler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawcomment(CArrRef params) { + FUNCTION_INJECTION(drawcomment); + return (f_drawcomment(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_call_user_method(CArrRef params) { + FUNCTION_INJECTION(call_user_method); + int count = params.size(); + if (count <= 2) return (f_call_user_method(count, params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_call_user_method(count,params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.slice(2, count - 2, false))); +} +Variant i_mb_split(CArrRef params) { + FUNCTION_INJECTION(mb_split); + int count = params.size(); + if (count <= 2) return (f_mb_split(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_split(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagepolygon(CArrRef params) { + FUNCTION_INJECTION(imagepolygon); + return (f_imagepolygon(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_mysql_field_name(CArrRef params) { + FUNCTION_INJECTION(mysql_field_name); + int count = params.size(); + if (count <= 1) return (f_mysql_field_name(params.rvalAt(0))); + return (f_mysql_field_name(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fputs(CArrRef params) { + FUNCTION_INJECTION(fputs); + int count = params.size(); + if (count <= 2) return (f_fputs(params.rvalAt(0), params.rvalAt(1))); + return (f_fputs(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagecolorallocatealpha(CArrRef params) { + FUNCTION_INJECTION(imagecolorallocatealpha); + return (f_imagecolorallocatealpha(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_substr_count(CArrRef params) { + FUNCTION_INJECTION(substr_count); + int count = params.size(); + if (count <= 2) return (f_substr_count(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_substr_count(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_substr_count(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_ldap_first_reference(CArrRef params) { + FUNCTION_INJECTION(ldap_first_reference); + return (f_ldap_first_reference(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_clock_settime(CArrRef params) { + FUNCTION_INJECTION(clock_settime); + return (f_clock_settime(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_ftruncate(CArrRef params) { + FUNCTION_INJECTION(ftruncate); + return (f_ftruncate(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_curl_version(CArrRef params) { + FUNCTION_INJECTION(curl_version); + int count = params.size(); + if (count <= 0) return (f_curl_version()); + return (f_curl_version(params.rvalAt(0))); +} +Variant i_pixelgetbluequantum(CArrRef params) { + FUNCTION_INJECTION(pixelgetbluequantum); + return (f_pixelgetbluequantum(params.rvalAt(0))); +} +Variant i_print(CArrRef params) { + FUNCTION_INJECTION(print); + return (f_print(params.rvalAt(0))); +} +Variant i_mysql_unbuffered_query(CArrRef params) { + FUNCTION_INJECTION(mysql_unbuffered_query); + int count = params.size(); + if (count <= 1) return (f_mysql_unbuffered_query(params.rvalAt(0))); + return (f_mysql_unbuffered_query(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hash_final(CArrRef params) { + FUNCTION_INJECTION(hash_final); + int count = params.size(); + if (count <= 1) return (f_hash_final(params.rvalAt(0))); + return (f_hash_final(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_imagecolorresolve(CArrRef params) { + FUNCTION_INJECTION(imagecolorresolve); + return (f_imagecolorresolve(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_date_date_set(CArrRef params) { + FUNCTION_INJECTION(date_date_set); + return (f_date_date_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); +} +Variant i_pixelsetyellow(CArrRef params) { + FUNCTION_INJECTION(pixelsetyellow); + return (f_pixelsetyellow(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_inet_pton(CArrRef params) { + FUNCTION_INJECTION(inet_pton); + return (f_inet_pton(params.rvalAt(0))); +} +Variant i_mcrypt_get_key_size(CArrRef params) { + FUNCTION_INJECTION(mcrypt_get_key_size); + return (f_mcrypt_get_key_size(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawsettextalignment(CArrRef params) { + FUNCTION_INJECTION(drawsettextalignment); + return (f_drawsettextalignment(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_magickgetimageredprimary(CArrRef params) { + FUNCTION_INJECTION(magickgetimageredprimary); + return (f_magickgetimageredprimary(params.rvalAt(0))); +} +Variant i_addslashes(CArrRef params) { + FUNCTION_INJECTION(addslashes); + return (f_addslashes(params.rvalAt(0))); +} +Variant i_ldap_count_entries(CArrRef params) { + FUNCTION_INJECTION(ldap_count_entries); + return (f_ldap_count_entries(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ereg_replace(CArrRef params) { + FUNCTION_INJECTION(ereg_replace); + return (f_ereg_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawrender(CArrRef params) { + FUNCTION_INJECTION(drawrender); + return (f_drawrender(params.rvalAt(0))); +} +Variant i_magickgetversionnumber(CArrRef params) { + FUNCTION_INJECTION(magickgetversionnumber); + return (f_magickgetversionnumber()); +} +Variant i_array_splice(CArrRef params) { + FUNCTION_INJECTION(array_splice); + int count = params.size(); + if (count <= 2) return (f_array_splice(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); + if (count == 3) return (f_array_splice(ref(const_cast(params).lvalAt(0)), params.rvalAt(1), params.rvalAt(2))); + return (f_array_splice(ref(const_cast(params).lvalAt(0)), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_oci_new_descriptor(CArrRef params) { + FUNCTION_INJECTION(oci_new_descriptor); + int count = params.size(); + if (count <= 1) return (f_oci_new_descriptor(params.rvalAt(0))); + return (f_oci_new_descriptor(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ftell(CArrRef params) { + FUNCTION_INJECTION(ftell); + return (f_ftell(params.rvalAt(0))); +} +Variant i_magicksetimagedepth(CArrRef params) { + FUNCTION_INJECTION(magicksetimagedepth); + int count = params.size(); + if (count <= 2) return (f_magicksetimagedepth(params.rvalAt(0), params.rvalAt(1))); + return (f_magicksetimagedepth(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_apc_load_constants(CArrRef params) { + FUNCTION_INJECTION(apc_load_constants); + int count = params.size(); + if (count <= 1) return (f_apc_load_constants(params.rvalAt(0))); + if (count == 2) return (f_apc_load_constants(params.rvalAt(0), params.rvalAt(1))); + return (f_apc_load_constants(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i___halt_compiler(CArrRef params) { + FUNCTION_INJECTION(__halt_compiler); + return (f___halt_compiler(), null); +} +Variant i_magicklabelimage(CArrRef params) { + FUNCTION_INJECTION(magicklabelimage); + return (f_magicklabelimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hphp_log(CArrRef params) { + FUNCTION_INJECTION(hphp_log); + return (f_hphp_log(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_stream_get_contents(CArrRef params) { + FUNCTION_INJECTION(stream_get_contents); + int count = params.size(); + if (count <= 1) return (f_stream_get_contents(params.rvalAt(0))); + if (count == 2) return (f_stream_get_contents(params.rvalAt(0), params.rvalAt(1))); + return (f_stream_get_contents(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagecreatefromjpeg(CArrRef params) { + FUNCTION_INJECTION(imagecreatefromjpeg); + return (f_imagecreatefromjpeg(params.rvalAt(0))); +} +Variant i_chown(CArrRef params) { + FUNCTION_INJECTION(chown); + return (f_chown(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hash_hmac_file(CArrRef params) { + FUNCTION_INJECTION(hash_hmac_file); + int count = params.size(); + if (count <= 3) return (f_hash_hmac_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_hash_hmac_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magickechoimageblob(CArrRef params) { + FUNCTION_INJECTION(magickechoimageblob); + return (f_magickechoimageblob(params.rvalAt(0))); +} +Variant i_link(CArrRef params) { + FUNCTION_INJECTION(link); + return (f_link(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fb_utf8ize(CArrRef params) { + FUNCTION_INJECTION(fb_utf8ize); + return (f_fb_utf8ize(ref(const_cast(params).lvalAt(0)))); +} +Variant i_drawsetfillpatternurl(CArrRef params) { + FUNCTION_INJECTION(drawsetfillpatternurl); + return (f_drawsetfillpatternurl(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_iconv(CArrRef params) { + FUNCTION_INJECTION(iconv); + return (f_iconv(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_highlight_file(CArrRef params) { + FUNCTION_INJECTION(highlight_file); + int count = params.size(); + if (count <= 1) return (f_highlight_file(params.rvalAt(0))); + return (f_highlight_file(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_iconv_mime_decode_headers(CArrRef params) { + FUNCTION_INJECTION(iconv_mime_decode_headers); + int count = params.size(); + if (count <= 1) return (f_iconv_mime_decode_headers(params.rvalAt(0))); + if (count == 2) return (f_iconv_mime_decode_headers(params.rvalAt(0), params.rvalAt(1))); + return (f_iconv_mime_decode_headers(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_ini_get_all(CArrRef params) { + FUNCTION_INJECTION(ini_get_all); + int count = params.size(); + if (count <= 0) return (f_ini_get_all()); + return (f_ini_get_all(params.rvalAt(0))); +} +Variant i_ldap_get_values_len(CArrRef params) { + FUNCTION_INJECTION(ldap_get_values_len); + return (f_ldap_get_values_len(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_openssl_pkcs7_verify(CArrRef params) { + FUNCTION_INJECTION(openssl_pkcs7_verify); + int count = params.size(); + if (count <= 2) return (f_openssl_pkcs7_verify(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_openssl_pkcs7_verify(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_openssl_pkcs7_verify(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_openssl_pkcs7_verify(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_openssl_pkcs7_verify(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_stream_socket_recvfrom(CArrRef params) { + FUNCTION_INJECTION(stream_socket_recvfrom); + int count = params.size(); + if (count <= 2) return (f_stream_socket_recvfrom(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_stream_socket_recvfrom(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_stream_socket_recvfrom(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawgetcliprule(CArrRef params) { + FUNCTION_INJECTION(drawgetcliprule); + return (f_drawgetcliprule(params.rvalAt(0))); +} +Variant i_apc_filehits(CArrRef params) { + FUNCTION_INJECTION(apc_filehits); + return (f_apc_filehits()); +} +Variant i_pixelgetexceptionstring(CArrRef params) { + FUNCTION_INJECTION(pixelgetexceptionstring); + return (f_pixelgetexceptionstring(params.rvalAt(0))); +} +Variant i_mcrypt_ofb(CArrRef params) { + FUNCTION_INJECTION(mcrypt_ofb); + int count = params.size(); + if (count <= 4) return (f_mcrypt_ofb(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_mcrypt_ofb(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_imageantialias(CArrRef params) { + FUNCTION_INJECTION(imageantialias); + return (f_imageantialias(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_idn_to_ascii(CArrRef params) { + FUNCTION_INJECTION(idn_to_ascii); + int count = params.size(); + if (count <= 1) return (f_idn_to_ascii(params.rvalAt(0))); + return (f_idn_to_ascii(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); +} +Variant i_error_log(CArrRef params) { + FUNCTION_INJECTION(error_log); + int count = params.size(); + if (count <= 1) return (f_error_log(params.rvalAt(0))); + if (count == 2) return (f_error_log(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_error_log(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_error_log(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_hash_update(CArrRef params) { + FUNCTION_INJECTION(hash_update); + return (f_hash_update(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ob_flush(CArrRef params) { + FUNCTION_INJECTION(ob_flush); + return (f_ob_flush(), null); +} +Variant i_fbml_get_attributes_11(CArrRef params) { + FUNCTION_INJECTION(fbml_get_attributes_11); + return (f_fbml_get_attributes_11(params.rvalAt(0))); +} +Variant i_md5_file(CArrRef params) { + FUNCTION_INJECTION(md5_file); + int count = params.size(); + if (count <= 1) return (f_md5_file(params.rvalAt(0))); + return (f_md5_file(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetexception(CArrRef params) { + FUNCTION_INJECTION(drawgetexception); + return (f_drawgetexception(params.rvalAt(0))); +} +Variant i_file_get_contents(CArrRef params) { + FUNCTION_INJECTION(file_get_contents); + int count = params.size(); + if (count <= 1) return (f_file_get_contents(params.rvalAt(0))); + if (count == 2) return (f_file_get_contents(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_file_get_contents(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_file_get_contents(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_file_get_contents(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_uniqid(CArrRef params) { + FUNCTION_INJECTION(uniqid); + int count = params.size(); + if (count <= 0) return (f_uniqid()); + if (count == 1) return (f_uniqid(params.rvalAt(0))); + return (f_uniqid(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_strncasecmp(CArrRef params) { + FUNCTION_INJECTION(strncasecmp); + return (f_strncasecmp(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magicksetimagepixels(CArrRef params) { + FUNCTION_INJECTION(magicksetimagepixels); + return (f_magicksetimagepixels(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); +} +Variant i_drawgetfillopacity(CArrRef params) { + FUNCTION_INJECTION(drawgetfillopacity); + return (f_drawgetfillopacity(params.rvalAt(0))); +} +Variant i_xml_parser_create_ns(CArrRef params) { + FUNCTION_INJECTION(xml_parser_create_ns); + int count = params.size(); + if (count <= 0) return (f_xml_parser_create_ns()); + if (count == 1) return (f_xml_parser_create_ns(params.rvalAt(0))); + return (f_xml_parser_create_ns(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_oci_fetch_assoc(CArrRef params) { + FUNCTION_INJECTION(oci_fetch_assoc); + return (f_oci_fetch_assoc(params.rvalAt(0))); +} +Variant i_ldap_delete(CArrRef params) { + FUNCTION_INJECTION(ldap_delete); + return (f_ldap_delete(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fnmatch(CArrRef params) { + FUNCTION_INJECTION(fnmatch); + int count = params.size(); + if (count <= 2) return (f_fnmatch(params.rvalAt(0), params.rvalAt(1))); + return (f_fnmatch(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_metaphone(CArrRef params) { + FUNCTION_INJECTION(metaphone); + int count = params.size(); + if (count <= 1) return (f_metaphone(params.rvalAt(0))); + return (f_metaphone(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mysql_errno(CArrRef params) { + FUNCTION_INJECTION(mysql_errno); + int count = params.size(); + if (count <= 0) return (f_mysql_errno()); + return (f_mysql_errno(params.rvalAt(0))); +} +Variant i_stream_wrapper_unregister(CArrRef params) { + FUNCTION_INJECTION(stream_wrapper_unregister); + return (f_stream_wrapper_unregister(params.rvalAt(0))); +} +Variant i_magickcyclecolormapimage(CArrRef params) { + FUNCTION_INJECTION(magickcyclecolormapimage); + return (f_magickcyclecolormapimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_restore_error_handler(CArrRef params) { + FUNCTION_INJECTION(restore_error_handler); + return (f_restore_error_handler()); +} +Variant i_magicksetimagevirtualpixelmethod(CArrRef params) { + FUNCTION_INJECTION(magicksetimagevirtualpixelmethod); + return (f_magicksetimagevirtualpixelmethod(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_socket_getpeername(CArrRef params) { + FUNCTION_INJECTION(socket_getpeername); + int count = params.size(); + if (count <= 2) return (f_socket_getpeername(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_socket_getpeername(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); +} +Variant i_mysql_error(CArrRef params) { + FUNCTION_INJECTION(mysql_error); + int count = params.size(); + if (count <= 0) return (f_mysql_error()); + return (f_mysql_error(params.rvalAt(0))); +} +Variant i_drawtranslate(CArrRef params) { + FUNCTION_INJECTION(drawtranslate); + return (f_drawtranslate(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_mysql_list_dbs(CArrRef params) { + FUNCTION_INJECTION(mysql_list_dbs); + int count = params.size(); + if (count <= 0) return (f_mysql_list_dbs()); + return (f_mysql_list_dbs(params.rvalAt(0))); +} +Variant i_imagefilter(CArrRef params) { + FUNCTION_INJECTION(imagefilter); + int count = params.size(); + if (count <= 2) return (f_imagefilter(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_imagefilter(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_imagefilter(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_imagefilter(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_imagefilter(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_base64_encode(CArrRef params) { + FUNCTION_INJECTION(base64_encode); + return (f_base64_encode(params.rvalAt(0))); +} +Variant i_is_null(CArrRef params) { + FUNCTION_INJECTION(is_null); + return (f_is_null(params.rvalAt(0))); +} +Variant i_octdec(CArrRef params) { + FUNCTION_INJECTION(octdec); + return (f_octdec(params.rvalAt(0))); +} +Variant i_oci_fetch(CArrRef params) { + FUNCTION_INJECTION(oci_fetch); + return (f_oci_fetch(params.rvalAt(0))); +} +Variant i_drawsetclippath(CArrRef params) { + FUNCTION_INJECTION(drawsetclippath); + return (f_drawsetclippath(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickconstituteimage(CArrRef params) { + FUNCTION_INJECTION(magickconstituteimage); + return (f_magickconstituteimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_pcntl_wexitstatus(CArrRef params) { + FUNCTION_INJECTION(pcntl_wexitstatus); + return (f_pcntl_wexitstatus(params.rvalAt(0))); +} +Variant i_fql_multiparse_10(CArrRef params) { + FUNCTION_INJECTION(fql_multiparse_10); + return (f_fql_multiparse_10(params.rvalAt(0))); +} +Variant i_apache_setenv(CArrRef params) { + FUNCTION_INJECTION(apache_setenv); + int count = params.size(); + if (count <= 2) return (f_apache_setenv(params.rvalAt(0), params.rvalAt(1))); + return (f_apache_setenv(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_clonedrawingwand(CArrRef params) { + FUNCTION_INJECTION(clonedrawingwand); + return (f_clonedrawingwand(params.rvalAt(0))); +} +Variant i_ob_get_clean(CArrRef params) { + FUNCTION_INJECTION(ob_get_clean); + return (f_ob_get_clean()); +} +Variant i_expm1(CArrRef params) { + FUNCTION_INJECTION(expm1); + return (f_expm1(params.rvalAt(0))); +} +Variant i_ldap_first_entry(CArrRef params) { + FUNCTION_INJECTION(ldap_first_entry); + return (f_ldap_first_entry(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_curl_multi_select(CArrRef params) { + FUNCTION_INJECTION(curl_multi_select); + int count = params.size(); + if (count <= 1) return (f_curl_multi_select(params.rvalAt(0))); + return (f_curl_multi_select(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickswirlimage(CArrRef params) { + FUNCTION_INJECTION(magickswirlimage); + return (f_magickswirlimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_ereg_search_regs(CArrRef params) { + FUNCTION_INJECTION(mb_ereg_search_regs); + int count = params.size(); + if (count <= 0) return (f_mb_ereg_search_regs()); + if (count == 1) return (f_mb_ereg_search_regs(params.rvalAt(0))); + return (f_mb_ereg_search_regs(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_errno(CArrRef params) { + FUNCTION_INJECTION(ldap_errno); + return (f_ldap_errno(params.rvalAt(0))); +} +Variant i_mysql_get_server_info(CArrRef params) { + FUNCTION_INJECTION(mysql_get_server_info); + int count = params.size(); + if (count <= 0) return (f_mysql_get_server_info()); + return (f_mysql_get_server_info(params.rvalAt(0))); +} +Variant i_mailparse_rfc822_parse_addresses(CArrRef params) { + FUNCTION_INJECTION(mailparse_rfc822_parse_addresses); + return (f_mailparse_rfc822_parse_addresses(params.rvalAt(0))); +} +Variant i_magickgetimagemimetype(CArrRef params) { + FUNCTION_INJECTION(magickgetimagemimetype); + return (f_magickgetimagemimetype(params.rvalAt(0))); +} +Variant i_soundex(CArrRef params) { + FUNCTION_INJECTION(soundex); + return (f_soundex(params.rvalAt(0))); +} +Variant i_magickgetimageformat(CArrRef params) { + FUNCTION_INJECTION(magickgetimageformat); + return (f_magickgetimageformat(params.rvalAt(0))); +} +Variant i_mcrypt_module_get_supported_key_sizes(CArrRef params) { + FUNCTION_INJECTION(mcrypt_module_get_supported_key_sizes); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_get_supported_key_sizes(params.rvalAt(0))); + return (f_mcrypt_module_get_supported_key_sizes(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_preg_replace_callback(CArrRef params) { + FUNCTION_INJECTION(preg_replace_callback); + int count = params.size(); + if (count <= 3) return (f_preg_replace_callback(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_preg_replace_callback(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_preg_replace_callback(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), ref(const_cast(params).lvalAt(4)))); +} +Variant i_ldap_error(CArrRef params) { + FUNCTION_INJECTION(ldap_error); + return (f_ldap_error(params.rvalAt(0))); +} +Variant i_xmlwriter_full_end_element(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_full_end_element); + return (f_xmlwriter_full_end_element(params.rvalAt(0))); +} +Variant i_ctype_graph(CArrRef params) { + FUNCTION_INJECTION(ctype_graph); + return (f_ctype_graph(params.rvalAt(0))); +} +Variant i_asort(CArrRef params) { + FUNCTION_INJECTION(asort); + int count = params.size(); + if (count <= 1) return (f_asort(ref(const_cast(params).lvalAt(0)))); + if (count == 2) return (f_asort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); + return (f_asort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_apd_echo(CArrRef params) { + FUNCTION_INJECTION(apd_echo); + return (f_apd_echo(params.rvalAt(0))); +} +Variant i_rewinddir(CArrRef params) { + FUNCTION_INJECTION(rewinddir); + return (f_rewinddir(params.rvalAt(0)), null); +} +Variant i_ob_implicit_flush(CArrRef params) { + FUNCTION_INJECTION(ob_implicit_flush); + int count = params.size(); + if (count <= 0) return (f_ob_implicit_flush(), null); + return (f_ob_implicit_flush(params.rvalAt(0)), null); +} +Variant i_pcntl_signal_dispatch(CArrRef params) { + FUNCTION_INJECTION(pcntl_signal_dispatch); + return (f_pcntl_signal_dispatch()); +} +Variant i_pixelgetiteratorexceptionstring(CArrRef params) { + FUNCTION_INJECTION(pixelgetiteratorexceptionstring); + return (f_pixelgetiteratorexceptionstring(params.rvalAt(0))); +} +Variant i_stream_socket_client(CArrRef params) { + FUNCTION_INJECTION(stream_socket_client); + int count = params.size(); + if (count <= 1) return (f_stream_socket_client(params.rvalAt(0))); + if (count == 2) return (f_stream_socket_client(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + if (count == 3) return (f_stream_socket_client(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); + if (count == 4) return (f_stream_socket_client(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); + if (count == 5) return (f_stream_socket_client(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4))); + return (f_stream_socket_client(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_drawsetstrokedasharray(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokedasharray); + int count = params.size(); + if (count <= 1) return (f_drawsetstrokedasharray(params.rvalAt(0)), null); + return (f_drawsetstrokedasharray(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mysql_free_result(CArrRef params) { + FUNCTION_INJECTION(mysql_free_result); + return (f_mysql_free_result(params.rvalAt(0))); +} +Variant i_is_real(CArrRef params) { + FUNCTION_INJECTION(is_real); + return (f_is_real(params.rvalAt(0))); +} +Variant i_mcrypt_enc_is_block_algorithm_mode(CArrRef params) { + FUNCTION_INJECTION(mcrypt_enc_is_block_algorithm_mode); + return (f_mcrypt_enc_is_block_algorithm_mode(params.rvalAt(0))); +} +Variant i_array_slice(CArrRef params) { + FUNCTION_INJECTION(array_slice); + int count = params.size(); + if (count <= 2) return (f_array_slice(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_array_slice(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_array_slice(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_count_chars(CArrRef params) { + FUNCTION_INJECTION(count_chars); + int count = params.size(); + if (count <= 1) return (f_count_chars(params.rvalAt(0))); + return (f_count_chars(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_array_uintersect_uassoc(CArrRef params) { + FUNCTION_INJECTION(array_uintersect_uassoc); + int count = params.size(); + if (count <= 4) return (f_array_uintersect_uassoc(count, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_array_uintersect_uassoc(count,params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.slice(4, count - 4, false))); +} +Variant i_oci_free_statement(CArrRef params) { + FUNCTION_INJECTION(oci_free_statement); + return (f_oci_free_statement(params.rvalAt(0))); +} +Variant i_drawsetstrokewidth(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokewidth); + return (f_drawsetstrokewidth(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_posix_mkfifo(CArrRef params) { + FUNCTION_INJECTION(posix_mkfifo); + return (f_posix_mkfifo(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_array_count_values(CArrRef params) { + FUNCTION_INJECTION(array_count_values); + return (f_array_count_values(params.rvalAt(0))); +} +Variant i_pixelgetexception(CArrRef params) { + FUNCTION_INJECTION(pixelgetexception); + return (f_pixelgetexception(params.rvalAt(0))); +} +Variant i_mkdir(CArrRef params) { + FUNCTION_INJECTION(mkdir); + int count = params.size(); + if (count <= 1) return (f_mkdir(params.rvalAt(0))); + if (count == 2) return (f_mkdir(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mkdir(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mkdir(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magicksetsize(CArrRef params) { + FUNCTION_INJECTION(magicksetsize); + return (f_magicksetsize(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_debug_zval_dump(CArrRef params) { + FUNCTION_INJECTION(debug_zval_dump); + return (f_debug_zval_dump(params.rvalAt(0)), null); +} +Variant i_iconv_substr(CArrRef params) { + FUNCTION_INJECTION(iconv_substr); + int count = params.size(); + if (count <= 2) return (f_iconv_substr(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_iconv_substr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_iconv_substr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_xml_set_external_entity_ref_handler(CArrRef params) { + FUNCTION_INJECTION(xml_set_external_entity_ref_handler); + return (f_xml_set_external_entity_ref_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_decode_numericentity(CArrRef params) { + FUNCTION_INJECTION(mb_decode_numericentity); + int count = params.size(); + if (count <= 2) return (f_mb_decode_numericentity(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_decode_numericentity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_ldap_next_attribute(CArrRef params) { + FUNCTION_INJECTION(ldap_next_attribute); + return (f_ldap_next_attribute(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_imagejpeg(CArrRef params) { + FUNCTION_INJECTION(imagejpeg); + int count = params.size(); + if (count <= 1) return (f_imagejpeg(params.rvalAt(0))); + if (count == 2) return (f_imagejpeg(params.rvalAt(0), params.rvalAt(1))); + return (f_imagejpeg(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagesetbrush(CArrRef params) { + FUNCTION_INJECTION(imagesetbrush); + return (f_imagesetbrush(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_strtoupper(CArrRef params) { + FUNCTION_INJECTION(mb_strtoupper); + int count = params.size(); + if (count <= 1) return (f_mb_strtoupper(params.rvalAt(0))); + return (f_mb_strtoupper(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_usleep(CArrRef params) { + FUNCTION_INJECTION(usleep); + return (f_usleep(params.rvalAt(0)), null); +} +Variant i_mb_strrpos(CArrRef params) { + FUNCTION_INJECTION(mb_strrpos); + int count = params.size(); + if (count <= 2) return (f_mb_strrpos(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_strrpos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_strrpos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_extract(CArrRef params) { + FUNCTION_INJECTION(extract); + int count = params.size(); + if (count <= 1) return (f_extract(params.rvalAt(0))); + if (count == 2) return (f_extract(params.rvalAt(0), params.rvalAt(1))); + return (f_extract(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_get_browser(CArrRef params) { + FUNCTION_INJECTION(get_browser); + int count = params.size(); + if (count <= 0) return (f_get_browser()); + if (count == 1) return (f_get_browser(params.rvalAt(0))); + return (f_get_browser(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_html_entity_decode(CArrRef params) { + FUNCTION_INJECTION(html_entity_decode); + int count = params.size(); + if (count <= 1) return (f_html_entity_decode(params.rvalAt(0))); + if (count == 2) return (f_html_entity_decode(params.rvalAt(0), params.rvalAt(1))); + return (f_html_entity_decode(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_preg_split(CArrRef params) { + FUNCTION_INJECTION(preg_split); + int count = params.size(); + if (count <= 2) return (f_preg_split(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_preg_split(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_preg_split(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magickpreviewimages(CArrRef params) { + FUNCTION_INJECTION(magickpreviewimages); + return (f_magickpreviewimages(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_zend_logo_guid(CArrRef params) { + FUNCTION_INJECTION(zend_logo_guid); + return (f_zend_logo_guid()); +} +Variant i_magickgetimagesize(CArrRef params) { + FUNCTION_INJECTION(magickgetimagesize); + return (f_magickgetimagesize(params.rvalAt(0))); +} +Variant i_apd_set_browser_trace(CArrRef params) { + FUNCTION_INJECTION(apd_set_browser_trace); + return (f_apd_set_browser_trace(), null); +} +Variant i_xhprof_sample_enable(CArrRef params) { + FUNCTION_INJECTION(xhprof_sample_enable); + return (f_xhprof_sample_enable(), null); +} +Variant i_mb_http_input(CArrRef params) { + FUNCTION_INJECTION(mb_http_input); + int count = params.size(); + if (count <= 0) return (f_mb_http_input()); + return (f_mb_http_input(params.rvalAt(0))); +} +Variant i_gzinflate(CArrRef params) { + FUNCTION_INJECTION(gzinflate); + int count = params.size(); + if (count <= 1) return (f_gzinflate(params.rvalAt(0))); + return (f_gzinflate(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_openssl_pkcs7_sign(CArrRef params) { + FUNCTION_INJECTION(openssl_pkcs7_sign); + int count = params.size(); + if (count <= 5) return (f_openssl_pkcs7_sign(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_openssl_pkcs7_sign(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + return (f_openssl_pkcs7_sign(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); +} +Variant i_assert(CArrRef params) { + FUNCTION_INJECTION(assert); + return (f_assert(params.rvalAt(0))); +} +Variant i_stream_get_wrappers(CArrRef params) { + FUNCTION_INJECTION(stream_get_wrappers); + return (f_stream_get_wrappers()); +} +Variant i_gzfile(CArrRef params) { + FUNCTION_INJECTION(gzfile); + int count = params.size(); + if (count <= 1) return (f_gzfile(params.rvalAt(0))); + return (f_gzfile(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_oci_field_precision(CArrRef params) { + FUNCTION_INJECTION(oci_field_precision); + return (f_oci_field_precision(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_stream_socket_sendto(CArrRef params) { + FUNCTION_INJECTION(stream_socket_sendto); + int count = params.size(); + if (count <= 2) return (f_stream_socket_sendto(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_stream_socket_sendto(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_stream_socket_sendto(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_gzpassthru(CArrRef params) { + FUNCTION_INJECTION(gzpassthru); + return (f_gzpassthru(params.rvalAt(0))); +} +Variant i_stream_bucket_make_writeable(CArrRef params) { + FUNCTION_INJECTION(stream_bucket_make_writeable); + return (f_stream_bucket_make_writeable(params.rvalAt(0))); +} +Variant i_posix_setegid(CArrRef params) { + FUNCTION_INJECTION(posix_setegid); + return (f_posix_setegid(params.rvalAt(0))); +} +Variant i_drawgetexceptionstring(CArrRef params) { + FUNCTION_INJECTION(drawgetexceptionstring); + return (f_drawgetexceptionstring(params.rvalAt(0))); +} +Variant i_hash_algos(CArrRef params) { + FUNCTION_INJECTION(hash_algos); + return (f_hash_algos()); +} +Variant i_drawsetstrokeantialias(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokeantialias); + int count = params.size(); + if (count <= 1) return (f_drawsetstrokeantialias(params.rvalAt(0)), null); + return (f_drawsetstrokeantialias(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_destroypixelwand(CArrRef params) { + FUNCTION_INJECTION(destroypixelwand); + return (f_destroypixelwand(params.rvalAt(0)), null); +} +Variant i_fstat(CArrRef params) { + FUNCTION_INJECTION(fstat); + return (f_fstat(params.rvalAt(0))); +} +Variant i_magicksetimageresolution(CArrRef params) { + FUNCTION_INJECTION(magicksetimageresolution); + return (f_magicksetimageresolution(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mysql_db_name(CArrRef params) { + FUNCTION_INJECTION(mysql_db_name); + int count = params.size(); + if (count <= 2) return (f_mysql_db_name(params.rvalAt(0), params.rvalAt(1))); + return (f_mysql_db_name(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_is_finite(CArrRef params) { + FUNCTION_INJECTION(is_finite); + return (f_is_finite(params.rvalAt(0))); +} +Variant i_pixelgetyellowquantum(CArrRef params) { + FUNCTION_INJECTION(pixelgetyellowquantum); + return (f_pixelgetyellowquantum(params.rvalAt(0))); +} +Variant i_ksort(CArrRef params) { + FUNCTION_INJECTION(ksort); + int count = params.size(); + if (count <= 1) return (f_ksort(ref(const_cast(params).lvalAt(0)))); + return (f_ksort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); +} +Variant i_thrift_protocol_read_binary(CArrRef params) { + FUNCTION_INJECTION(thrift_protocol_read_binary); + return (f_thrift_protocol_read_binary(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_get_included_files(CArrRef params) { + FUNCTION_INJECTION(get_included_files); + return (f_get_included_files()); +} +Variant i_strip_tags(CArrRef params) { + FUNCTION_INJECTION(strip_tags); + int count = params.size(); + if (count <= 1) return (f_strip_tags(params.rvalAt(0))); + return (f_strip_tags(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_ereg_search_getpos(CArrRef params) { + FUNCTION_INJECTION(mb_ereg_search_getpos); + return (f_mb_ereg_search_getpos()); +} +Variant i_pixelgetcyanquantum(CArrRef params) { + FUNCTION_INJECTION(pixelgetcyanquantum); + return (f_pixelgetcyanquantum(params.rvalAt(0))); +} +Variant i_oci_define_by_name(CArrRef params) { + FUNCTION_INJECTION(oci_define_by_name); + int count = params.size(); + if (count <= 3) return (f_oci_define_by_name(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + return (f_oci_define_by_name(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); +} +Variant i_magickgetexception(CArrRef params) { + FUNCTION_INJECTION(magickgetexception); + return (f_magickgetexception(params.rvalAt(0))); +} +Variant i_ctype_punct(CArrRef params) { + FUNCTION_INJECTION(ctype_punct); + return (f_ctype_punct(params.rvalAt(0))); +} +Variant i_next(CArrRef params) { + FUNCTION_INJECTION(next); + return (f_next(ref(const_cast(params).lvalAt(0)))); +} +Variant i_shm_detach(CArrRef params) { + FUNCTION_INJECTION(shm_detach); + return (f_shm_detach(params.rvalAt(0))); +} +Variant i_shm_attach(CArrRef params) { + FUNCTION_INJECTION(shm_attach); + int count = params.size(); + if (count <= 1) return (f_shm_attach(params.rvalAt(0))); + if (count == 2) return (f_shm_attach(params.rvalAt(0), params.rvalAt(1))); + return (f_shm_attach(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickflattenimages(CArrRef params) { + FUNCTION_INJECTION(magickflattenimages); + return (f_magickflattenimages(params.rvalAt(0))); +} +Variant i_similar_text(CArrRef params) { + FUNCTION_INJECTION(similar_text); + int count = params.size(); + if (count <= 2) return (f_similar_text(params.rvalAt(0), params.rvalAt(1))); + return (f_similar_text(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_imagecreatefromgd2part(CArrRef params) { + FUNCTION_INJECTION(imagecreatefromgd2part); + return (f_imagecreatefromgd2part(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_iconv_get_encoding(CArrRef params) { + FUNCTION_INJECTION(iconv_get_encoding); + int count = params.size(); + if (count <= 0) return (f_iconv_get_encoding()); + return (f_iconv_get_encoding(params.rvalAt(0))); +} +Variant i_getmyinode(CArrRef params) { + FUNCTION_INJECTION(getmyinode); + return (f_getmyinode()); +} +Variant i_gzgetc(CArrRef params) { + FUNCTION_INJECTION(gzgetc); + return (f_gzgetc(params.rvalAt(0))); +} +Variant i_hphp_set_static_property(CArrRef params) { + FUNCTION_INJECTION(hphp_set_static_property); + return (f_hphp_set_static_property(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_unlink(CArrRef params) { + FUNCTION_INJECTION(unlink); + int count = params.size(); + if (count <= 1) return (f_unlink(params.rvalAt(0))); + return (f_unlink(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mcrypt_module_open(CArrRef params) { + FUNCTION_INJECTION(mcrypt_module_open); + return (f_mcrypt_module_open(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_token_get_all(CArrRef params) { + FUNCTION_INJECTION(token_get_all); + return (f_token_get_all(params.rvalAt(0))); +} +Variant i_base_convert(CArrRef params) { + FUNCTION_INJECTION(base_convert); + return (f_base_convert(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_gethostbynamel(CArrRef params) { + FUNCTION_INJECTION(gethostbynamel); + return (f_gethostbynamel(params.rvalAt(0))); +} +Variant i_var_dump(CArrRef params) { + FUNCTION_INJECTION(var_dump); + int count = params.size(); + if (count <= 1) return (f_var_dump(count, params.rvalAt(0)), null); + return (f_var_dump(count,params.rvalAt(0), params.slice(1, count - 1, false)), null); +} +Variant i_xmlwriter_start_attribute(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_attribute); + return (f_xmlwriter_start_attribute(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pack(CArrRef params) { + FUNCTION_INJECTION(pack); + int count = params.size(); + if (count <= 1) return (f_pack(count, params.rvalAt(0))); + return (f_pack(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_gzgets(CArrRef params) { + FUNCTION_INJECTION(gzgets); + int count = params.size(); + if (count <= 1) return (f_gzgets(params.rvalAt(0))); + return (f_gzgets(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_apache_get_version(CArrRef params) { + FUNCTION_INJECTION(apache_get_version); + return (f_apache_get_version()); +} +Variant i_array_intersect_uassoc(CArrRef params) { + FUNCTION_INJECTION(array_intersect_uassoc); + int count = params.size(); + if (count <= 3) return (f_array_intersect_uassoc(count, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_array_intersect_uassoc(count,params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.slice(3, count - 3, false))); +} +Variant i_basename(CArrRef params) { + FUNCTION_INJECTION(basename); + int count = params.size(); + if (count <= 1) return (f_basename(params.rvalAt(0))); + return (f_basename(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_krsort(CArrRef params) { + FUNCTION_INJECTION(krsort); + int count = params.size(); + if (count <= 1) return (f_krsort(ref(const_cast(params).lvalAt(0)))); + return (f_krsort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); +} +Variant i_clock_gettime(CArrRef params) { + FUNCTION_INJECTION(clock_gettime); + return (f_clock_gettime(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); +} +Variant i_pushdrawingwand(CArrRef params) { + FUNCTION_INJECTION(pushdrawingwand); + return (f_pushdrawingwand(params.rvalAt(0)), null); +} +Variant i_imageline(CArrRef params) { + FUNCTION_INJECTION(imageline); + return (f_imageline(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_socket_read(CArrRef params) { + FUNCTION_INJECTION(socket_read); + int count = params.size(); + if (count <= 2) return (f_socket_read(params.rvalAt(0), params.rvalAt(1))); + return (f_socket_read(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_xmlwriter_write_dtd_entity(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_dtd_entity); + int count = params.size(); + if (count <= 3) return (f_xmlwriter_write_dtd_entity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_xmlwriter_write_dtd_entity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_xmlwriter_write_dtd_entity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_xmlwriter_write_dtd_entity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + return (f_xmlwriter_write_dtd_entity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); +} +Variant i_mysql_tablename(CArrRef params) { + FUNCTION_INJECTION(mysql_tablename); + return (f_mysql_tablename(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickwriteimage(CArrRef params) { + FUNCTION_INJECTION(magickwriteimage); + return (f_magickwriteimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mcrypt_module_get_algo_key_size(CArrRef params) { + FUNCTION_INJECTION(mcrypt_module_get_algo_key_size); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_get_algo_key_size(params.rvalAt(0))); + return (f_mcrypt_module_get_algo_key_size(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hash_update_file(CArrRef params) { + FUNCTION_INJECTION(hash_update_file); + int count = params.size(); + if (count <= 2) return (f_hash_update_file(params.rvalAt(0), params.rvalAt(1))); + return (f_hash_update_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickembossimage(CArrRef params) { + FUNCTION_INJECTION(magickembossimage); + return (f_magickembossimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_gzencode(CArrRef params) { + FUNCTION_INJECTION(gzencode); + int count = params.size(); + if (count <= 1) return (f_gzencode(params.rvalAt(0))); + if (count == 2) return (f_gzencode(params.rvalAt(0), params.rvalAt(1))); + return (f_gzencode(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_checkdate(CArrRef params) { + FUNCTION_INJECTION(checkdate); + return (f_checkdate(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickimplodeimage(CArrRef params) { + FUNCTION_INJECTION(magickimplodeimage); + return (f_magickimplodeimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetimageindex(CArrRef params) { + FUNCTION_INJECTION(magickgetimageindex); + return (f_magickgetimageindex(params.rvalAt(0))); +} +Variant i_ctype_lower(CArrRef params) { + FUNCTION_INJECTION(ctype_lower); + return (f_ctype_lower(params.rvalAt(0))); +} +Variant i_imagepsloadfont(CArrRef params) { + FUNCTION_INJECTION(imagepsloadfont); + return (f_imagepsloadfont(params.rvalAt(0))); +} +Variant i_iconv_mime_decode(CArrRef params) { + FUNCTION_INJECTION(iconv_mime_decode); + int count = params.size(); + if (count <= 1) return (f_iconv_mime_decode(params.rvalAt(0))); + if (count == 2) return (f_iconv_mime_decode(params.rvalAt(0), params.rvalAt(1))); + return (f_iconv_mime_decode(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mcrypt_module_is_block_algorithm(CArrRef params) { + FUNCTION_INJECTION(mcrypt_module_is_block_algorithm); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_is_block_algorithm(params.rvalAt(0))); + return (f_mcrypt_module_is_block_algorithm(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fbjsparse(CArrRef params) { + FUNCTION_INJECTION(fbjsparse); + return (f_fbjsparse(params.rvalAt(0))); +} +Variant i_wandgetexception(CArrRef params) { + FUNCTION_INJECTION(wandgetexception); + return (f_wandgetexception(params.rvalAt(0))); +} +Variant i_fb_add_included_file(CArrRef params) { + FUNCTION_INJECTION(fb_add_included_file); + return (f_fb_add_included_file(params.rvalAt(0)), null); +} +Variant i_fsockopen(CArrRef params) { + FUNCTION_INJECTION(fsockopen); + int count = params.size(); + if (count <= 1) return (f_fsockopen(params.rvalAt(0))); + if (count == 2) return (f_fsockopen(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_fsockopen(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + if (count == 4) return (f_fsockopen(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)))); + return (f_fsockopen(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)), params.rvalAt(4))); +} +Variant i_usort(CArrRef params) { + FUNCTION_INJECTION(usort); + return (f_usort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); +} +Variant i_pixelsetiteratorrow(CArrRef params) { + FUNCTION_INJECTION(pixelsetiteratorrow); + return (f_pixelsetiteratorrow(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_get_option(CArrRef params) { + FUNCTION_INJECTION(ldap_get_option); + return (f_ldap_get_option(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_socket_recv(CArrRef params) { + FUNCTION_INJECTION(socket_recv); + return (f_socket_recv(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_sys_getloadavg(CArrRef params) { + FUNCTION_INJECTION(sys_getloadavg); + return (f_sys_getloadavg()); +} +Variant i_evhttp_async_post(CArrRef params) { + FUNCTION_INJECTION(evhttp_async_post); + int count = params.size(); + if (count <= 2) return (f_evhttp_async_post(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_evhttp_async_post(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_evhttp_async_post(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_array_values(CArrRef params) { + FUNCTION_INJECTION(array_values); + return (f_array_values(params.rvalAt(0))); +} +Variant i_ctype_digit(CArrRef params) { + FUNCTION_INJECTION(ctype_digit); + return (f_ctype_digit(params.rvalAt(0))); +} +Variant i_ob_get_length(CArrRef params) { + FUNCTION_INJECTION(ob_get_length); + return (f_ob_get_length()); +} +Variant i_magicksolarizeimage(CArrRef params) { + FUNCTION_INJECTION(magicksolarizeimage); + return (f_magicksolarizeimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ob_list_handlers(CArrRef params) { + FUNCTION_INJECTION(ob_list_handlers); + return (f_ob_list_handlers()); +} +Variant i_array_uintersect_assoc(CArrRef params) { + FUNCTION_INJECTION(array_uintersect_assoc); + int count = params.size(); + if (count <= 3) return (f_array_uintersect_assoc(count, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_array_uintersect_assoc(count,params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.slice(3, count - 3, false))); +} +Variant i_openssl_x509_read(CArrRef params) { + FUNCTION_INJECTION(openssl_x509_read); + return (f_openssl_x509_read(params.rvalAt(0))); +} +Variant i_magickgetimagecolormapcolor(CArrRef params) { + FUNCTION_INJECTION(magickgetimagecolormapcolor); + return (f_magickgetimagecolormapcolor(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_settype(CArrRef params) { + FUNCTION_INJECTION(settype); + return (f_settype(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); +} +Variant i_posix_access(CArrRef params) { + FUNCTION_INJECTION(posix_access); + int count = params.size(); + if (count <= 1) return (f_posix_access(params.rvalAt(0))); + return (f_posix_access(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fql_set_static_data_10(CArrRef params) { + FUNCTION_INJECTION(fql_set_static_data_10); + return (f_fql_set_static_data_10(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_explode(CArrRef params) { + FUNCTION_INJECTION(explode); + int count = params.size(); + if (count <= 2) return (f_explode(params.rvalAt(0), params.rvalAt(1))); + return (f_explode(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_fbml_complex_expand_tag_list_11(CArrRef params) { + FUNCTION_INJECTION(fbml_complex_expand_tag_list_11); + return (f_fbml_complex_expand_tag_list_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9)), null); +} +Variant i_fb_load_local_databases(CArrRef params) { + FUNCTION_INJECTION(fb_load_local_databases); + return (f_fb_load_local_databases(params.rvalAt(0)), null); +} +Variant i_hotprofiler_enable(CArrRef params) { + FUNCTION_INJECTION(hotprofiler_enable); + return (f_hotprofiler_enable(params.rvalAt(0)), null); +} +Variant i_fbml_get_children_count_11(CArrRef params) { + FUNCTION_INJECTION(fbml_get_children_count_11); + return (f_fbml_get_children_count_11(params.rvalAt(0))); +} +Variant i_imagecreatefromgd(CArrRef params) { + FUNCTION_INJECTION(imagecreatefromgd); + return (f_imagecreatefromgd(params.rvalAt(0))); +} +Variant i_proc_close(CArrRef params) { + FUNCTION_INJECTION(proc_close); + return (f_proc_close(params.rvalAt(0))); +} +Variant i_magickgaussianblurimage(CArrRef params) { + FUNCTION_INJECTION(magickgaussianblurimage); + int count = params.size(); + if (count <= 3) return (f_magickgaussianblurimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickgaussianblurimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_fbml_tag_list_expanded_11(CArrRef params) { + FUNCTION_INJECTION(fbml_tag_list_expanded_11); + return (f_fbml_tag_list_expanded_11()); +} +Variant i_apd_set_session_trace_socket(CArrRef params) { + FUNCTION_INJECTION(apd_set_session_trace_socket); + return (f_apd_set_session_trace_socket(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_openssl_pkcs12_export_to_file(CArrRef params) { + FUNCTION_INJECTION(openssl_pkcs12_export_to_file); + int count = params.size(); + if (count <= 4) return (f_openssl_pkcs12_export_to_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_openssl_pkcs12_export_to_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_mailparse_msg_free(CArrRef params) { + FUNCTION_INJECTION(mailparse_msg_free); + return (f_mailparse_msg_free(params.rvalAt(0))); +} +Variant i_openssl_private_decrypt(CArrRef params) { + FUNCTION_INJECTION(openssl_private_decrypt); + int count = params.size(); + if (count <= 3) return (f_openssl_private_decrypt(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); + return (f_openssl_private_decrypt(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_hphp_get_extension_info(CArrRef params) { + FUNCTION_INJECTION(hphp_get_extension_info); + return (f_hphp_get_extension_info(params.rvalAt(0))); +} +Variant i_output_add_rewrite_var(CArrRef params) { + FUNCTION_INJECTION(output_add_rewrite_var); + return (f_output_add_rewrite_var(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xmlwriter_write_cdata(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_cdata); + return (f_xmlwriter_write_cdata(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_list_mime_names(CArrRef params) { + FUNCTION_INJECTION(mb_list_mime_names); + int count = params.size(); + if (count <= 0) return (f_mb_list_mime_names()); + return (f_mb_list_mime_names(params.rvalAt(0))); +} +Variant i_ispixelwand(CArrRef params) { + FUNCTION_INJECTION(ispixelwand); + return (f_ispixelwand(params.rvalAt(0))); +} +Variant i_xmlwriter_end_dtd(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_end_dtd); + return (f_xmlwriter_end_dtd(params.rvalAt(0))); +} +Variant i_curl_close(CArrRef params) { + FUNCTION_INJECTION(curl_close); + return (f_curl_close(params.rvalAt(0)), null); +} +Variant i_array_udiff(CArrRef params) { + FUNCTION_INJECTION(array_udiff); + int count = params.size(); + if (count <= 3) return (f_array_udiff(count, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_array_udiff(count,params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.slice(3, count - 3, false))); +} +Variant i_stream_context_create(CArrRef params) { + FUNCTION_INJECTION(stream_context_create); + int count = params.size(); + if (count <= 0) return (f_stream_context_create()); + if (count == 1) return (f_stream_context_create(params.rvalAt(0))); + return (f_stream_context_create(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetstrokedashoffset(CArrRef params) { + FUNCTION_INJECTION(drawgetstrokedashoffset); + return (f_drawgetstrokedashoffset(params.rvalAt(0))); +} +Variant i_openssl_pkey_get_public(CArrRef params) { + FUNCTION_INJECTION(openssl_pkey_get_public); + return (f_openssl_pkey_get_public(params.rvalAt(0))); +} +Variant i_interface_exists(CArrRef params) { + FUNCTION_INJECTION(interface_exists); + int count = params.size(); + if (count <= 1) return (f_interface_exists(params.rvalAt(0))); + return (f_interface_exists(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawpathmovetorelative(CArrRef params) { + FUNCTION_INJECTION(drawpathmovetorelative); + return (f_drawpathmovetorelative(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_apache_get_config(CArrRef params) { + FUNCTION_INJECTION(apache_get_config); + return (f_apache_get_config()); +} +Variant i_curl_copy_handle(CArrRef params) { + FUNCTION_INJECTION(curl_copy_handle); + return (f_curl_copy_handle(params.rvalAt(0))); +} +Variant i_drawgetvectorgraphics(CArrRef params) { + FUNCTION_INJECTION(drawgetvectorgraphics); + return (f_drawgetvectorgraphics(params.rvalAt(0))); +} +Variant i_drawpathfinish(CArrRef params) { + FUNCTION_INJECTION(drawpathfinish); + return (f_drawpathfinish(params.rvalAt(0)), null); +} +Variant i_png2wbmp(CArrRef params) { + FUNCTION_INJECTION(png2wbmp); + return (f_png2wbmp(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_drawmatte(CArrRef params) { + FUNCTION_INJECTION(drawmatte); + return (f_drawmatte(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); +} +Variant i_imagecolormatch(CArrRef params) { + FUNCTION_INJECTION(imagecolormatch); + return (f_imagecolormatch(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawrectangle(CArrRef params) { + FUNCTION_INJECTION(drawrectangle); + return (f_drawrectangle(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); +} +Variant i_fb_parallel_query(CArrRef params) { + FUNCTION_INJECTION(fb_parallel_query); + int count = params.size(); + if (count <= 1) return (f_fb_parallel_query(params.rvalAt(0))); + if (count == 2) return (f_fb_parallel_query(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_fb_parallel_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_fb_parallel_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_fb_parallel_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_fb_parallel_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + return (f_fb_parallel_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); +} +Variant i_mcrypt_enc_get_block_size(CArrRef params) { + FUNCTION_INJECTION(mcrypt_enc_get_block_size); + return (f_mcrypt_enc_get_block_size(params.rvalAt(0))); +} +Variant i_stream_context_set_option(CArrRef params) { + FUNCTION_INJECTION(stream_context_set_option); + int count = params.size(); + if (count <= 2) return (f_stream_context_set_option(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_stream_context_set_option(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_stream_context_set_option(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawpathcurvetorelative(CArrRef params) { + FUNCTION_INJECTION(drawpathcurvetorelative); + return (f_drawpathcurvetorelative(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6)), null); +} +Variant i_phpcredits(CArrRef params) { + FUNCTION_INJECTION(phpcredits); + int count = params.size(); + if (count <= 0) return (f_phpcredits()); + return (f_phpcredits(params.rvalAt(0))); +} +Variant i_drawgetfillrule(CArrRef params) { + FUNCTION_INJECTION(drawgetfillrule); + return (f_drawgetfillrule(params.rvalAt(0))); +} +Variant i_xmlwriter_end_cdata(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_end_cdata); + return (f_xmlwriter_end_cdata(params.rvalAt(0))); +} +Variant i_magickgetversionstring(CArrRef params) { + FUNCTION_INJECTION(magickgetversionstring); + return (f_magickgetversionstring()); +} +Variant i_pcntl_fork(CArrRef params) { + FUNCTION_INJECTION(pcntl_fork); + return (f_pcntl_fork()); +} +Variant i_doubleval(CArrRef params) { + FUNCTION_INJECTION(doubleval); + return (f_doubleval(params.rvalAt(0))); +} +Variant i_assert_options(CArrRef params) { + FUNCTION_INJECTION(assert_options); + int count = params.size(); + if (count <= 1) return (f_assert_options(params.rvalAt(0))); + return (f_assert_options(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickhasnextimage(CArrRef params) { + FUNCTION_INJECTION(magickhasnextimage); + return (f_magickhasnextimage(params.rvalAt(0))); +} +Variant i_rmdir(CArrRef params) { + FUNCTION_INJECTION(rmdir); + int count = params.size(); + if (count <= 1) return (f_rmdir(params.rvalAt(0))); + return (f_rmdir(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetstrokelinecap(CArrRef params) { + FUNCTION_INJECTION(drawgetstrokelinecap); + return (f_drawgetstrokelinecap(params.rvalAt(0))); +} +Variant i_oci_statement_type(CArrRef params) { + FUNCTION_INJECTION(oci_statement_type); + return (f_oci_statement_type(params.rvalAt(0))); +} +Variant i_magickscaleimage(CArrRef params) { + FUNCTION_INJECTION(magickscaleimage); + return (f_magickscaleimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_pixelgetblackquantum(CArrRef params) { + FUNCTION_INJECTION(pixelgetblackquantum); + return (f_pixelgetblackquantum(params.rvalAt(0))); +} +Variant i_magicknewimage(CArrRef params) { + FUNCTION_INJECTION(magicknewimage); + int count = params.size(); + if (count <= 3) return (f_magicknewimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magicknewimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_destroypixelwands(CArrRef params) { + FUNCTION_INJECTION(destroypixelwands); + return (f_destroypixelwands(params.rvalAt(0)), null); +} +Variant i_shm_remove(CArrRef params) { + FUNCTION_INJECTION(shm_remove); + return (f_shm_remove(params.rvalAt(0))); +} +Variant i_date_sun_info(CArrRef params) { + FUNCTION_INJECTION(date_sun_info); + return (f_date_sun_info(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickresizeimage(CArrRef params) { + FUNCTION_INJECTION(magickresizeimage); + return (f_magickresizeimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_parse_ini_file(CArrRef params) { + FUNCTION_INJECTION(parse_ini_file); + int count = params.size(); + if (count <= 1) return (f_parse_ini_file(params.rvalAt(0))); + return (f_parse_ini_file(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_stream_get_meta_data(CArrRef params) { + FUNCTION_INJECTION(stream_get_meta_data); + return (f_stream_get_meta_data(params.rvalAt(0))); +} +Variant i_imagepsencodefont(CArrRef params) { + FUNCTION_INJECTION(imagepsencodefont); + return (f_imagepsencodefont(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_set_option(CArrRef params) { + FUNCTION_INJECTION(ldap_set_option); + return (f_ldap_set_option(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickgetsize(CArrRef params) { + FUNCTION_INJECTION(magickgetsize); + return (f_magickgetsize(params.rvalAt(0))); +} +Variant i_memory_get_peak_usage(CArrRef params) { + FUNCTION_INJECTION(memory_get_peak_usage); + int count = params.size(); + if (count <= 0) return (f_memory_get_peak_usage()); + return (f_memory_get_peak_usage(params.rvalAt(0))); +} +Variant i_pcntl_exec(CArrRef params) { + FUNCTION_INJECTION(pcntl_exec); + int count = params.size(); + if (count <= 1) return (f_pcntl_exec(params.rvalAt(0)), null); + if (count == 2) return (f_pcntl_exec(params.rvalAt(0), params.rvalAt(1)), null); + return (f_pcntl_exec(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_xmlwriter_set_indent_string(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_set_indent_string); + return (f_xmlwriter_set_indent_string(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_php_strip_whitespace(CArrRef params) { + FUNCTION_INJECTION(php_strip_whitespace); + return (f_php_strip_whitespace(params.rvalAt(0))); +} +Variant i_strcoll(CArrRef params) { + FUNCTION_INJECTION(strcoll); + return (f_strcoll(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_socket_send(CArrRef params) { + FUNCTION_INJECTION(socket_send); + return (f_socket_send(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_zlib_get_coding_type(CArrRef params) { + FUNCTION_INJECTION(zlib_get_coding_type); + return (f_zlib_get_coding_type()); +} +Variant i_mb_ereg_search_getregs(CArrRef params) { + FUNCTION_INJECTION(mb_ereg_search_getregs); + return (f_mb_ereg_search_getregs()); +} +Variant i_mb_eregi(CArrRef params) { + FUNCTION_INJECTION(mb_eregi); + int count = params.size(); + if (count <= 2) return (f_mb_eregi(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_eregi(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_pixelgetgreen(CArrRef params) { + FUNCTION_INJECTION(pixelgetgreen); + return (f_pixelgetgreen(params.rvalAt(0))); +} +Variant i_mysql_client_encoding(CArrRef params) { + FUNCTION_INJECTION(mysql_client_encoding); + int count = params.size(); + if (count <= 0) return (f_mysql_client_encoding()); + return (f_mysql_client_encoding(params.rvalAt(0))); +} +Variant i_zend_thread_id(CArrRef params) { + FUNCTION_INJECTION(zend_thread_id); + return (f_zend_thread_id()); +} +Variant i_ldap_mod_replace(CArrRef params) { + FUNCTION_INJECTION(ldap_mod_replace); + return (f_ldap_mod_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_stream_filter_prepend(CArrRef params) { + FUNCTION_INJECTION(stream_filter_prepend); + int count = params.size(); + if (count <= 2) return (f_stream_filter_prepend(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_stream_filter_prepend(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_stream_filter_prepend(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_substr(CArrRef params) { + FUNCTION_INJECTION(substr); + int count = params.size(); + if (count <= 2) return (f_substr(params.rvalAt(0), params.rvalAt(1))); + return (f_substr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickcombineimages(CArrRef params) { + FUNCTION_INJECTION(magickcombineimages); + return (f_magickcombineimages(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pixelgetexceptiontype(CArrRef params) { + FUNCTION_INJECTION(pixelgetexceptiontype); + return (f_pixelgetexceptiontype(params.rvalAt(0))); +} +Variant i_unpack(CArrRef params) { + FUNCTION_INJECTION(unpack); + return (f_unpack(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetimagepixels(CArrRef params) { + FUNCTION_INJECTION(magickgetimagepixels); + return (f_magickgetimagepixels(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); +} +Variant i_array_product(CArrRef params) { + FUNCTION_INJECTION(array_product); + return (f_array_product(params.rvalAt(0))); +} +Variant i_substr_replace(CArrRef params) { + FUNCTION_INJECTION(substr_replace); + int count = params.size(); + if (count <= 3) return (f_substr_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_substr_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_oci_bind_array_by_name(CArrRef params) { + FUNCTION_INJECTION(oci_bind_array_by_name); + int count = params.size(); + if (count <= 4) return (f_oci_bind_array_by_name(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); + if (count == 5) return (f_oci_bind_array_by_name(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4))); + return (f_oci_bind_array_by_name(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_xmlwriter_write_dtd(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_dtd); + int count = params.size(); + if (count <= 2) return (f_xmlwriter_write_dtd(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_xmlwriter_write_dtd(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_xmlwriter_write_dtd(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_xmlwriter_write_dtd(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_mysql_select_db(CArrRef params) { + FUNCTION_INJECTION(mysql_select_db); + int count = params.size(); + if (count <= 1) return (f_mysql_select_db(params.rvalAt(0))); + return (f_mysql_select_db(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_use_soap_error_handler(CArrRef params) { + FUNCTION_INJECTION(use_soap_error_handler); + int count = params.size(); + if (count <= 0) return (f_use_soap_error_handler()); + return (f_use_soap_error_handler(params.rvalAt(0))); +} +Variant i_debug_backtrace(CArrRef params) { + FUNCTION_INJECTION(debug_backtrace); + return (f_debug_backtrace()); +} +Variant i_drawpathcurvetosmoothrelative(CArrRef params) { + FUNCTION_INJECTION(drawpathcurvetosmoothrelative); + return (f_drawpathcurvetosmoothrelative(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); +} +Variant i_mailparse_determine_best_xfer_encoding(CArrRef params) { + FUNCTION_INJECTION(mailparse_determine_best_xfer_encoding); + return (f_mailparse_determine_best_xfer_encoding(params.rvalAt(0))); +} +Variant i_imagettfbbox(CArrRef params) { + FUNCTION_INJECTION(imagettfbbox); + return (f_imagettfbbox(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_mb_internal_encoding(CArrRef params) { + FUNCTION_INJECTION(mb_internal_encoding); + int count = params.size(); + if (count <= 0) return (f_mb_internal_encoding()); + return (f_mb_internal_encoding(params.rvalAt(0))); +} +Variant i_msg_get_queue(CArrRef params) { + FUNCTION_INJECTION(msg_get_queue); + int count = params.size(); + if (count <= 1) return (f_msg_get_queue(params.rvalAt(0))); + return (f_msg_get_queue(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_posix_getegid(CArrRef params) { + FUNCTION_INJECTION(posix_getegid); + return (f_posix_getegid()); +} +Variant i_magickmedianfilterimage(CArrRef params) { + FUNCTION_INJECTION(magickmedianfilterimage); + return (f_magickmedianfilterimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xbox_task_result(CArrRef params) { + FUNCTION_INJECTION(xbox_task_result); + return (f_xbox_task_result(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); +} +Variant i_mcrypt_generic_deinit(CArrRef params) { + FUNCTION_INJECTION(mcrypt_generic_deinit); + return (f_mcrypt_generic_deinit(params.rvalAt(0))); +} +Variant i_method_exists(CArrRef params) { + FUNCTION_INJECTION(method_exists); + return (f_method_exists(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_money_format(CArrRef params) { + FUNCTION_INJECTION(money_format); + return (f_money_format(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_clearmagickwand(CArrRef params) { + FUNCTION_INJECTION(clearmagickwand); + return (f_clearmagickwand(params.rvalAt(0)), null); +} +Variant i_array_udiff_assoc(CArrRef params) { + FUNCTION_INJECTION(array_udiff_assoc); + int count = params.size(); + if (count <= 3) return (f_array_udiff_assoc(count, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_array_udiff_assoc(count,params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.slice(3, count - 3, false))); +} +Variant i_xml_parser_free(CArrRef params) { + FUNCTION_INJECTION(xml_parser_free); + return (f_xml_parser_free(params.rvalAt(0))); +} +Variant i_fb_reset_opcode(CArrRef params) { + FUNCTION_INJECTION(fb_reset_opcode); + return (f_fb_reset_opcode(params.rvalAt(0)), null); +} +Variant i_is_resource(CArrRef params) { + FUNCTION_INJECTION(is_resource); + return (f_is_resource(params.rvalAt(0))); +} +Variant i_posix_seteuid(CArrRef params) { + FUNCTION_INJECTION(posix_seteuid); + return (f_posix_seteuid(params.rvalAt(0))); +} +Variant i_magicksetinterlacescheme(CArrRef params) { + FUNCTION_INJECTION(magicksetinterlacescheme); + return (f_magicksetinterlacescheme(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_str_shuffle(CArrRef params) { + FUNCTION_INJECTION(str_shuffle); + return (f_str_shuffle(params.rvalAt(0))); +} +Variant i_mcrypt_enc_is_block_algorithm(CArrRef params) { + FUNCTION_INJECTION(mcrypt_enc_is_block_algorithm); + return (f_mcrypt_enc_is_block_algorithm(params.rvalAt(0))); +} +Variant i_magickgetcopyright(CArrRef params) { + FUNCTION_INJECTION(magickgetcopyright); + return (f_magickgetcopyright()); +} +Variant i_magickstripimage(CArrRef params) { + FUNCTION_INJECTION(magickstripimage); + return (f_magickstripimage(params.rvalAt(0))); +} +Variant i_base64_decode(CArrRef params) { + FUNCTION_INJECTION(base64_decode); + int count = params.size(); + if (count <= 1) return (f_base64_decode(params.rvalAt(0))); + return (f_base64_decode(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_rand(CArrRef params) { + FUNCTION_INJECTION(rand); + int count = params.size(); + if (count <= 0) return (f_rand()); + if (count == 1) return (f_rand(params.rvalAt(0))); + return (f_rand(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_crc32(CArrRef params) { + FUNCTION_INJECTION(crc32); + return (f_crc32(params.rvalAt(0))); +} +Variant i_stream_encoding(CArrRef params) { + FUNCTION_INJECTION(stream_encoding); + int count = params.size(); + if (count <= 1) return (f_stream_encoding(params.rvalAt(0))); + return (f_stream_encoding(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetstrokedasharray(CArrRef params) { + FUNCTION_INJECTION(drawgetstrokedasharray); + return (f_drawgetstrokedasharray(params.rvalAt(0))); +} +Variant i_magickgetimagedispose(CArrRef params) { + FUNCTION_INJECTION(magickgetimagedispose); + return (f_magickgetimagedispose(params.rvalAt(0))); +} +Variant i_drawpopdefs(CArrRef params) { + FUNCTION_INJECTION(drawpopdefs); + return (f_drawpopdefs(params.rvalAt(0)), null); +} +Variant i_xml_parser_create(CArrRef params) { + FUNCTION_INJECTION(xml_parser_create); + int count = params.size(); + if (count <= 0) return (f_xml_parser_create()); + return (f_xml_parser_create(params.rvalAt(0))); +} +Variant i_pcntl_wifsignaled(CArrRef params) { + FUNCTION_INJECTION(pcntl_wifsignaled); + return (f_pcntl_wifsignaled(params.rvalAt(0))); +} +Variant i_fbml_flatten_11(CArrRef params) { + FUNCTION_INJECTION(fbml_flatten_11); + return (f_fbml_flatten_11(params.rvalAt(0))); +} +Variant i_openssl_pkcs7_encrypt(CArrRef params) { + FUNCTION_INJECTION(openssl_pkcs7_encrypt); + int count = params.size(); + if (count <= 4) return (f_openssl_pkcs7_encrypt(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_openssl_pkcs7_encrypt(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_openssl_pkcs7_encrypt(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_read_exif_data(CArrRef params) { + FUNCTION_INJECTION(read_exif_data); + int count = params.size(); + if (count <= 1) return (f_read_exif_data(params.rvalAt(0))); + if (count == 2) return (f_read_exif_data(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_read_exif_data(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_read_exif_data(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawsetstrokeopacity(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokeopacity); + return (f_drawsetstrokeopacity(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_drawroundrectangle(CArrRef params) { + FUNCTION_INJECTION(drawroundrectangle); + return (f_drawroundrectangle(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6)), null); +} +Variant i_drawgetstrokewidth(CArrRef params) { + FUNCTION_INJECTION(drawgetstrokewidth); + return (f_drawgetstrokewidth(params.rvalAt(0))); +} +Variant i_date_create(CArrRef params) { + FUNCTION_INJECTION(date_create); + int count = params.size(); + if (count <= 0) return (f_date_create()); + if (count == 1) return (f_date_create(params.rvalAt(0))); + return (f_date_create(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_strcspn(CArrRef params) { + FUNCTION_INJECTION(strcspn); + int count = params.size(); + if (count <= 2) return (f_strcspn(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_strcspn(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_strcspn(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawgetclipunits(CArrRef params) { + FUNCTION_INJECTION(drawgetclipunits); + return (f_drawgetclipunits(params.rvalAt(0))); +} +Variant i_ldap_sasl_bind(CArrRef params) { + FUNCTION_INJECTION(ldap_sasl_bind); + int count = params.size(); + if (count <= 1) return (f_ldap_sasl_bind(params.rvalAt(0))); + if (count == 2) return (f_ldap_sasl_bind(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_ldap_sasl_bind(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_ldap_sasl_bind(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_ldap_sasl_bind(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_ldap_sasl_bind(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + return (f_ldap_sasl_bind(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); +} +Variant i_sem_acquire(CArrRef params) { + FUNCTION_INJECTION(sem_acquire); + return (f_sem_acquire(params.rvalAt(0))); +} +Variant i_socket_strerror(CArrRef params) { + FUNCTION_INJECTION(socket_strerror); + return (f_socket_strerror(params.rvalAt(0))); +} +Variant i_magickgetstringheight(CArrRef params) { + FUNCTION_INJECTION(magickgetstringheight); + int count = params.size(); + if (count <= 3) return (f_magickgetstringheight(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickgetstringheight(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_rawurlencode(CArrRef params) { + FUNCTION_INJECTION(rawurlencode); + return (f_rawurlencode(params.rvalAt(0))); +} +Variant i_strtotime(CArrRef params) { + FUNCTION_INJECTION(strtotime); + int count = params.size(); + if (count <= 1) return (f_strtotime(params.rvalAt(0))); + return (f_strtotime(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_apc_clear_cache(CArrRef params) { + FUNCTION_INJECTION(apc_clear_cache); + int count = params.size(); + if (count <= 0) return (f_apc_clear_cache()); + return (f_apc_clear_cache(params.rvalAt(0))); +} +Variant i_dirname(CArrRef params) { + FUNCTION_INJECTION(dirname); + return (f_dirname(params.rvalAt(0))); +} +Variant i_strnatcasecmp(CArrRef params) { + FUNCTION_INJECTION(strnatcasecmp); + return (f_strnatcasecmp(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicksetsamplingfactors(CArrRef params) { + FUNCTION_INJECTION(magicksetsamplingfactors); + return (f_magicksetsamplingfactors(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_openssl_pkey_get_private(CArrRef params) { + FUNCTION_INJECTION(openssl_pkey_get_private); + int count = params.size(); + if (count <= 1) return (f_openssl_pkey_get_private(params.rvalAt(0))); + return (f_openssl_pkey_get_private(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickaverageimages(CArrRef params) { + FUNCTION_INJECTION(magickaverageimages); + return (f_magickaverageimages(params.rvalAt(0))); +} +Variant i_iconv_strrpos(CArrRef params) { + FUNCTION_INJECTION(iconv_strrpos); + int count = params.size(); + if (count <= 2) return (f_iconv_strrpos(params.rvalAt(0), params.rvalAt(1))); + return (f_iconv_strrpos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawsetviewbox(CArrRef params) { + FUNCTION_INJECTION(drawsetviewbox); + return (f_drawsetviewbox(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); +} +Variant i_magicksetimagecompressionquality(CArrRef params) { + FUNCTION_INJECTION(magicksetimagecompressionquality); + return (f_magicksetimagecompressionquality(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mysql_ping(CArrRef params) { + FUNCTION_INJECTION(mysql_ping); + int count = params.size(); + if (count <= 0) return (f_mysql_ping()); + return (f_mysql_ping(params.rvalAt(0))); +} +Variant i_xml_get_current_byte_index(CArrRef params) { + FUNCTION_INJECTION(xml_get_current_byte_index); + return (f_xml_get_current_byte_index(params.rvalAt(0))); +} +Variant i_magicktransformimage(CArrRef params) { + FUNCTION_INJECTION(magicktransformimage); + return (f_magicktransformimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawgetstrokeantialias(CArrRef params) { + FUNCTION_INJECTION(drawgetstrokeantialias); + return (f_drawgetstrokeantialias(params.rvalAt(0))); +} +Variant i_ini_alter(CArrRef params) { + FUNCTION_INJECTION(ini_alter); + return (f_ini_alter(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_get_class(CArrRef params) { + FUNCTION_INJECTION(get_class); + int count = params.size(); + if (count <= 0) return (f_get_class()); + return (f_get_class(params.rvalAt(0))); +} +Variant i_magicksetimageprofile(CArrRef params) { + FUNCTION_INJECTION(magicksetimageprofile); + return (f_magicksetimageprofile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mysql_field_seek(CArrRef params) { + FUNCTION_INJECTION(mysql_field_seek); + int count = params.size(); + if (count <= 1) return (f_mysql_field_seek(params.rvalAt(0))); + return (f_mysql_field_seek(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetfontsize(CArrRef params) { + FUNCTION_INJECTION(drawgetfontsize); + return (f_drawgetfontsize(params.rvalAt(0))); +} +Variant i_mysql_num_rows(CArrRef params) { + FUNCTION_INJECTION(mysql_num_rows); + return (f_mysql_num_rows(params.rvalAt(0))); +} +Variant i_magickgetimageresolution(CArrRef params) { + FUNCTION_INJECTION(magickgetimageresolution); + return (f_magickgetimageresolution(params.rvalAt(0))); +} +Variant i_array_diff(CArrRef params) { + FUNCTION_INJECTION(array_diff); + int count = params.size(); + if (count <= 2) return (f_array_diff(count, params.rvalAt(0), params.rvalAt(1))); + return (f_array_diff(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_xmlwriter_open_uri(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_open_uri); + return (f_xmlwriter_open_uri(params.rvalAt(0))); +} +Variant i_magickgetimagetype(CArrRef params) { + FUNCTION_INJECTION(magickgetimagetype); + return (f_magickgetimagetype(params.rvalAt(0))); +} +Variant i_simplexml_load_string(CArrRef params) { + FUNCTION_INJECTION(simplexml_load_string); + int count = params.size(); + if (count <= 1) return (f_simplexml_load_string(params.rvalAt(0))); + if (count == 2) return (f_simplexml_load_string(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_simplexml_load_string(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_simplexml_load_string(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_simplexml_load_string(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_magickunsharpmaskimage(CArrRef params) { + FUNCTION_INJECTION(magickunsharpmaskimage); + int count = params.size(); + if (count <= 5) return (f_magickunsharpmaskimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_magickunsharpmaskimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_quoted_printable_encode(CArrRef params) { + FUNCTION_INJECTION(quoted_printable_encode); + return (f_quoted_printable_encode(params.rvalAt(0))); +} +Variant i_gettype(CArrRef params) { + FUNCTION_INJECTION(gettype); + return (f_gettype(params.rvalAt(0))); +} +Variant i_magickgetimagebackgroundcolor(CArrRef params) { + FUNCTION_INJECTION(magickgetimagebackgroundcolor); + return (f_magickgetimagebackgroundcolor(params.rvalAt(0))); +} +Variant i_array_intersect_key(CArrRef params) { + FUNCTION_INJECTION(array_intersect_key); + int count = params.size(); + if (count <= 2) return (f_array_intersect_key(count, params.rvalAt(0), params.rvalAt(1))); + return (f_array_intersect_key(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_array_change_key_case(CArrRef params) { + FUNCTION_INJECTION(array_change_key_case); + int count = params.size(); + if (count <= 1) return (f_array_change_key_case(params.rvalAt(0))); + return (f_array_change_key_case(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_first_attribute(CArrRef params) { + FUNCTION_INJECTION(ldap_first_attribute); + return (f_ldap_first_attribute(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_gettimeofday(CArrRef params) { + FUNCTION_INJECTION(gettimeofday); + int count = params.size(); + if (count <= 0) return (f_gettimeofday()); + return (f_gettimeofday(params.rvalAt(0))); +} +Variant i_xmlwriter_end_element(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_end_element); + return (f_xmlwriter_end_element(params.rvalAt(0))); +} +Variant i_drawpoint(CArrRef params) { + FUNCTION_INJECTION(drawpoint); + return (f_drawpoint(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_oci_fetch_object(CArrRef params) { + FUNCTION_INJECTION(oci_fetch_object); + return (f_oci_fetch_object(params.rvalAt(0))); +} +Variant i_strnatcmp(CArrRef params) { + FUNCTION_INJECTION(strnatcmp); + return (f_strnatcmp(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_property_exists(CArrRef params) { + FUNCTION_INJECTION(property_exists); + return (f_property_exists(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xhp_preprocess_code(CArrRef params) { + FUNCTION_INJECTION(xhp_preprocess_code); + return (f_xhp_preprocess_code(params.rvalAt(0))); +} +Variant i_oci_rollback(CArrRef params) { + FUNCTION_INJECTION(oci_rollback); + return (f_oci_rollback(params.rvalAt(0))); +} +Variant i_mysql_affected_rows(CArrRef params) { + FUNCTION_INJECTION(mysql_affected_rows); + int count = params.size(); + if (count <= 0) return (f_mysql_affected_rows()); + return (f_mysql_affected_rows(params.rvalAt(0))); +} +Variant i_magickdespeckleimage(CArrRef params) { + FUNCTION_INJECTION(magickdespeckleimage); + return (f_magickdespeckleimage(params.rvalAt(0))); +} +Variant i_imagecopymergegray(CArrRef params) { + FUNCTION_INJECTION(imagecopymergegray); + return (f_imagecopymergegray(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8))); +} +Variant i_ctype_cntrl(CArrRef params) { + FUNCTION_INJECTION(ctype_cntrl); + return (f_ctype_cntrl(params.rvalAt(0))); +} +Variant i_is_array(CArrRef params) { + FUNCTION_INJECTION(is_array); + return (f_is_array(params.rvalAt(0))); +} +Variant i_rename(CArrRef params) { + FUNCTION_INJECTION(rename); + int count = params.size(); + if (count <= 2) return (f_rename(params.rvalAt(0), params.rvalAt(1))); + return (f_rename(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_date_format(CArrRef params) { + FUNCTION_INJECTION(date_format); + return (f_date_format(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickshaveimage(CArrRef params) { + FUNCTION_INJECTION(magickshaveimage); + return (f_magickshaveimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_xmlwriter_output_memory(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_output_memory); + int count = params.size(); + if (count <= 1) return (f_xmlwriter_output_memory(params.rvalAt(0))); + return (f_xmlwriter_output_memory(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ob_end_flush(CArrRef params) { + FUNCTION_INJECTION(ob_end_flush); + return (f_ob_end_flush()); +} +Variant i_magickwhitethresholdimage(CArrRef params) { + FUNCTION_INJECTION(magickwhitethresholdimage); + return (f_magickwhitethresholdimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawpolyline(CArrRef params) { + FUNCTION_INJECTION(drawpolyline); + return (f_drawpolyline(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_hphp_get_function_info(CArrRef params) { + FUNCTION_INJECTION(hphp_get_function_info); + return (f_hphp_get_function_info(params.rvalAt(0))); +} +Variant i_prev(CArrRef params) { + FUNCTION_INJECTION(prev); + return (f_prev(ref(const_cast(params).lvalAt(0)))); +} +Variant i_imagegammacorrect(CArrRef params) { + FUNCTION_INJECTION(imagegammacorrect); + return (f_imagegammacorrect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_str_replace(CArrRef params) { + FUNCTION_INJECTION(str_replace); + int count = params.size(); + if (count <= 3) return (f_str_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_str_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), ref(const_cast(params).lvalAt(3)))); +} +Variant i_fb_get_ape_version(CArrRef params) { + FUNCTION_INJECTION(fb_get_ape_version); + return (f_fb_get_ape_version()); +} +Variant i_clock_getres(CArrRef params) { + FUNCTION_INJECTION(clock_getres); + return (f_clock_getres(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); +} +Variant i_magicktrimimage(CArrRef params) { + FUNCTION_INJECTION(magicktrimimage); + return (f_magicktrimimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetimagegamma(CArrRef params) { + FUNCTION_INJECTION(magickgetimagegamma); + return (f_magickgetimagegamma(params.rvalAt(0))); +} +Variant i_newdrawingwand(CArrRef params) { + FUNCTION_INJECTION(newdrawingwand); + return (f_newdrawingwand()); +} +Variant i_oci_new_cursor(CArrRef params) { + FUNCTION_INJECTION(oci_new_cursor); + return (f_oci_new_cursor(params.rvalAt(0))); +} +Variant i_gzrewind(CArrRef params) { + FUNCTION_INJECTION(gzrewind); + return (f_gzrewind(params.rvalAt(0))); +} +Variant i_ldap_explode_dn(CArrRef params) { + FUNCTION_INJECTION(ldap_explode_dn); + return (f_ldap_explode_dn(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_posix_times(CArrRef params) { + FUNCTION_INJECTION(posix_times); + return (f_posix_times()); +} +Variant i_drawgetfillcolor(CArrRef params) { + FUNCTION_INJECTION(drawgetfillcolor); + return (f_drawgetfillcolor(params.rvalAt(0))); +} +Variant i_mb_strtolower(CArrRef params) { + FUNCTION_INJECTION(mb_strtolower); + int count = params.size(); + if (count <= 1) return (f_mb_strtolower(params.rvalAt(0))); + return (f_mb_strtolower(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_localtime(CArrRef params) { + FUNCTION_INJECTION(localtime); + int count = params.size(); + if (count <= 0) return (f_localtime()); + if (count == 1) return (f_localtime(params.rvalAt(0))); + return (f_localtime(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_oci_password_change(CArrRef params) { + FUNCTION_INJECTION(oci_password_change); + return (f_oci_password_change(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_fb_thrift_unserialize(CArrRef params) { + FUNCTION_INJECTION(fb_thrift_unserialize); + int count = params.size(); + if (count <= 2) return (f_fb_thrift_unserialize(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_fb_thrift_unserialize(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); +} +Variant i_sha1(CArrRef params) { + FUNCTION_INJECTION(sha1); + int count = params.size(); + if (count <= 1) return (f_sha1(params.rvalAt(0))); + return (f_sha1(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_implode(CArrRef params) { + FUNCTION_INJECTION(implode); + int count = params.size(); + if (count <= 1) return (f_implode(params.rvalAt(0))); + return (f_implode(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_date_isodate_set(CArrRef params) { + FUNCTION_INJECTION(date_isodate_set); + int count = params.size(); + if (count <= 3) return (f_date_isodate_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + return (f_date_isodate_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); +} +Variant i_oci_result(CArrRef params) { + FUNCTION_INJECTION(oci_result); + return (f_oci_result(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickpaintopaqueimage(CArrRef params) { + FUNCTION_INJECTION(magickpaintopaqueimage); + int count = params.size(); + if (count <= 3) return (f_magickpaintopaqueimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickpaintopaqueimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_mb_strimwidth(CArrRef params) { + FUNCTION_INJECTION(mb_strimwidth); + int count = params.size(); + if (count <= 3) return (f_mb_strimwidth(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_mb_strimwidth(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_mb_strimwidth(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_drawsetfont(CArrRef params) { + FUNCTION_INJECTION(drawsetfont); + return (f_drawsetfont(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xml_set_default_handler(CArrRef params) { + FUNCTION_INJECTION(xml_set_default_handler); + return (f_xml_set_default_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickchopimage(CArrRef params) { + FUNCTION_INJECTION(magickchopimage); + return (f_magickchopimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_wordwrap(CArrRef params) { + FUNCTION_INJECTION(wordwrap); + int count = params.size(); + if (count <= 1) return (f_wordwrap(params.rvalAt(0))); + if (count == 2) return (f_wordwrap(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_wordwrap(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_wordwrap(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_gzgetss(CArrRef params) { + FUNCTION_INJECTION(gzgetss); + int count = params.size(); + if (count <= 1) return (f_gzgetss(params.rvalAt(0))); + if (count == 2) return (f_gzgetss(params.rvalAt(0), params.rvalAt(1))); + return (f_gzgetss(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickgetimagevirtualpixelmethod(CArrRef params) { + FUNCTION_INJECTION(magickgetimagevirtualpixelmethod); + return (f_magickgetimagevirtualpixelmethod(params.rvalAt(0))); +} +Variant i_imagedestroy(CArrRef params) { + FUNCTION_INJECTION(imagedestroy); + return (f_imagedestroy(params.rvalAt(0))); +} +Variant i_timezone_open(CArrRef params) { + FUNCTION_INJECTION(timezone_open); + return (f_timezone_open(params.rvalAt(0))); +} +Variant i_ob_clean(CArrRef params) { + FUNCTION_INJECTION(ob_clean); + return (f_ob_clean(), null); +} +Variant i_mb_ereg_search_pos(CArrRef params) { + FUNCTION_INJECTION(mb_ereg_search_pos); + int count = params.size(); + if (count <= 0) return (f_mb_ereg_search_pos()); + if (count == 1) return (f_mb_ereg_search_pos(params.rvalAt(0))); + return (f_mb_ereg_search_pos(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_bccomp(CArrRef params) { + FUNCTION_INJECTION(bccomp); + int count = params.size(); + if (count <= 2) return (f_bccomp(params.rvalAt(0), params.rvalAt(1))); + return (f_bccomp(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_gzdecode(CArrRef params) { + FUNCTION_INJECTION(gzdecode); + return (f_gzdecode(params.rvalAt(0))); +} +Variant i_magicksetimagecompose(CArrRef params) { + FUNCTION_INJECTION(magicksetimagecompose); + return (f_magicksetimagecompose(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_apc_bin_dump(CArrRef params) { + FUNCTION_INJECTION(apc_bin_dump); + int count = params.size(); + if (count <= 0) return (f_apc_bin_dump()); + if (count == 1) return (f_apc_bin_dump(params.rvalAt(0))); + return (f_apc_bin_dump(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ini_get(CArrRef params) { + FUNCTION_INJECTION(ini_get); + return (f_ini_get(params.rvalAt(0))); +} +Variant i_mb_ereg_search_setpos(CArrRef params) { + FUNCTION_INJECTION(mb_ereg_search_setpos); + return (f_mb_ereg_search_setpos(params.rvalAt(0))); +} +Variant i_stream_copy_to_stream(CArrRef params) { + FUNCTION_INJECTION(stream_copy_to_stream); + int count = params.size(); + if (count <= 2) return (f_stream_copy_to_stream(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_stream_copy_to_stream(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_stream_copy_to_stream(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_xml_get_error_code(CArrRef params) { + FUNCTION_INJECTION(xml_get_error_code); + return (f_xml_get_error_code(params.rvalAt(0))); +} +Variant i_pcntl_alarm(CArrRef params) { + FUNCTION_INJECTION(pcntl_alarm); + return (f_pcntl_alarm(params.rvalAt(0))); +} +Variant i_drawpolygon(CArrRef params) { + FUNCTION_INJECTION(drawpolygon); + return (f_drawpolygon(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mysql_connect(CArrRef params) { + FUNCTION_INJECTION(mysql_connect); + int count = params.size(); + if (count <= 0) return (f_mysql_connect()); + if (count == 1) return (f_mysql_connect(params.rvalAt(0))); + if (count == 2) return (f_mysql_connect(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mysql_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_mysql_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_mysql_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_mysql_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + return (f_mysql_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); +} +Variant i_xmlwriter_write_raw(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_raw); + return (f_xmlwriter_write_raw(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fgetss(CArrRef params) { + FUNCTION_INJECTION(fgetss); + int count = params.size(); + if (count <= 1) return (f_fgetss(params.rvalAt(0))); + if (count == 2) return (f_fgetss(params.rvalAt(0), params.rvalAt(1))); + return (f_fgetss(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawarc(CArrRef params) { + FUNCTION_INJECTION(drawarc); + return (f_drawarc(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6)), null); +} +Variant i_set_error_handler(CArrRef params) { + FUNCTION_INJECTION(set_error_handler); + int count = params.size(); + if (count <= 1) return (f_set_error_handler(params.rvalAt(0))); + return (f_set_error_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_str_word_count(CArrRef params) { + FUNCTION_INJECTION(str_word_count); + int count = params.size(); + if (count <= 1) return (f_str_word_count(params.rvalAt(0))); + if (count == 2) return (f_str_word_count(params.rvalAt(0), params.rvalAt(1))); + return (f_str_word_count(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawsetcliprule(CArrRef params) { + FUNCTION_INJECTION(drawsetcliprule); + return (f_drawsetcliprule(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_openssl_pkcs12_read(CArrRef params) { + FUNCTION_INJECTION(openssl_pkcs12_read); + return (f_openssl_pkcs12_read(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); +} +Variant i_ldap_list(CArrRef params) { + FUNCTION_INJECTION(ldap_list); + int count = params.size(); + if (count <= 3) return (f_ldap_list(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_ldap_list(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_ldap_list(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_ldap_list(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + if (count == 7) return (f_ldap_list(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); + return (f_ldap_list(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); +} +Variant i_func_num_args(CArrRef params) { + FUNCTION_INJECTION(func_num_args); + return (f_func_num_args()); +} +Variant i_drawsettextdecoration(CArrRef params) { + FUNCTION_INJECTION(drawsettextdecoration); + return (f_drawsettextdecoration(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_str_rot13(CArrRef params) { + FUNCTION_INJECTION(str_rot13); + return (f_str_rot13(params.rvalAt(0))); +} +Variant i_openssl_pkey_new(CArrRef params) { + FUNCTION_INJECTION(openssl_pkey_new); + int count = params.size(); + if (count <= 0) return (f_openssl_pkey_new()); + return (f_openssl_pkey_new(params.rvalAt(0))); +} +Variant i_magicksetimageindex(CArrRef params) { + FUNCTION_INJECTION(magicksetimageindex); + return (f_magicksetimageindex(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_rename(CArrRef params) { + FUNCTION_INJECTION(ldap_rename); + return (f_ldap_rename(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_ldap_start_tls(CArrRef params) { + FUNCTION_INJECTION(ldap_start_tls); + return (f_ldap_start_tls(params.rvalAt(0))); +} +Variant i_tanh(CArrRef params) { + FUNCTION_INJECTION(tanh); + return (f_tanh(params.rvalAt(0))); +} +Variant i_drawscale(CArrRef params) { + FUNCTION_INJECTION(drawscale); + return (f_drawscale(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_drawrotate(CArrRef params) { + FUNCTION_INJECTION(drawrotate); + return (f_drawrotate(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_getservbyname(CArrRef params) { + FUNCTION_INJECTION(getservbyname); + return (f_getservbyname(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_compact(CArrRef params) { + FUNCTION_INJECTION(compact); + int count = params.size(); + if (count <= 1) return (f_compact(count, params.rvalAt(0))); + return (f_compact(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_imagecolorclosest(CArrRef params) { + FUNCTION_INJECTION(imagecolorclosest); + return (f_imagecolorclosest(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magickwriteimages(CArrRef params) { + FUNCTION_INJECTION(magickwriteimages); + int count = params.size(); + if (count <= 1) return (f_magickwriteimages(params.rvalAt(0))); + if (count == 2) return (f_magickwriteimages(params.rvalAt(0), params.rvalAt(1))); + return (f_magickwriteimages(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_pixelsetalpha(CArrRef params) { + FUNCTION_INJECTION(pixelsetalpha); + return (f_pixelsetalpha(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_magicksetimageiterations(CArrRef params) { + FUNCTION_INJECTION(magicksetimageiterations); + return (f_magicksetimageiterations(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_oci_field_scale(CArrRef params) { + FUNCTION_INJECTION(oci_field_scale); + return (f_oci_field_scale(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawpathmovetoabsolute(CArrRef params) { + FUNCTION_INJECTION(drawpathmovetoabsolute); + return (f_drawpathmovetoabsolute(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_quotemeta(CArrRef params) { + FUNCTION_INJECTION(quotemeta); + return (f_quotemeta(params.rvalAt(0))); +} +Variant i_imagefilltoborder(CArrRef params) { + FUNCTION_INJECTION(imagefilltoborder); + return (f_imagefilltoborder(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_xml_set_notation_decl_handler(CArrRef params) { + FUNCTION_INJECTION(xml_set_notation_decl_handler); + return (f_xml_set_notation_decl_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_oci_free_descriptor(CArrRef params) { + FUNCTION_INJECTION(oci_free_descriptor); + return (f_oci_free_descriptor(params.rvalAt(0))); +} +Variant i_is_writeable(CArrRef params) { + FUNCTION_INJECTION(is_writeable); + return (f_is_writeable(params.rvalAt(0))); +} +Variant i_magickgetwandsize(CArrRef params) { + FUNCTION_INJECTION(magickgetwandsize); + return (f_magickgetwandsize(params.rvalAt(0))); +} +Variant i_imageinterlace(CArrRef params) { + FUNCTION_INJECTION(imageinterlace); + int count = params.size(); + if (count <= 1) return (f_imageinterlace(params.rvalAt(0))); + return (f_imageinterlace(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_preg_match_all(CArrRef params) { + FUNCTION_INJECTION(preg_match_all); + int count = params.size(); + if (count <= 3) return (f_preg_match_all(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + if (count == 4) return (f_preg_match_all(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); + return (f_preg_match_all(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_proc_terminate(CArrRef params) { + FUNCTION_INJECTION(proc_terminate); + int count = params.size(); + if (count <= 1) return (f_proc_terminate(params.rvalAt(0))); + return (f_proc_terminate(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_apc_bin_loadfile(CArrRef params) { + FUNCTION_INJECTION(apc_bin_loadfile); + int count = params.size(); + if (count <= 1) return (f_apc_bin_loadfile(params.rvalAt(0))); + if (count == 2) return (f_apc_bin_loadfile(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_apc_bin_loadfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_apc_bin_loadfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_posix_getcwd(CArrRef params) { + FUNCTION_INJECTION(posix_getcwd); + return (f_posix_getcwd()); +} +Variant i_drawpathcurvetoabsolute(CArrRef params) { + FUNCTION_INJECTION(drawpathcurvetoabsolute); + return (f_drawpathcurvetoabsolute(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6)), null); +} +Variant i_preg_match(CArrRef params) { + FUNCTION_INJECTION(preg_match); + int count = params.size(); + if (count <= 2) return (f_preg_match(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_preg_match(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + if (count == 4) return (f_preg_match(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); + return (f_preg_match(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_timezone_abbreviations_list(CArrRef params) { + FUNCTION_INJECTION(timezone_abbreviations_list); + return (f_timezone_abbreviations_list()); +} +Variant i_magickradialblurimage(CArrRef params) { + FUNCTION_INJECTION(magickradialblurimage); + return (f_magickradialblurimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_posix_geteuid(CArrRef params) { + FUNCTION_INJECTION(posix_geteuid); + return (f_posix_geteuid()); +} +Variant i_mysql_fetch_lengths(CArrRef params) { + FUNCTION_INJECTION(mysql_fetch_lengths); + return (f_mysql_fetch_lengths(params.rvalAt(0))); +} +Variant i_magickwriteimagefile(CArrRef params) { + FUNCTION_INJECTION(magickwriteimagefile); + return (f_magickwriteimagefile(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_serialize(CArrRef params) { + FUNCTION_INJECTION(serialize); + return (f_serialize(params.rvalAt(0))); +} +Variant i_exif_read_data(CArrRef params) { + FUNCTION_INJECTION(exif_read_data); + int count = params.size(); + if (count <= 1) return (f_exif_read_data(params.rvalAt(0))); + if (count == 2) return (f_exif_read_data(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_exif_read_data(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_exif_read_data(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_pixelgetiteratorexceptiontype(CArrRef params) { + FUNCTION_INJECTION(pixelgetiteratorexceptiontype); + return (f_pixelgetiteratorexceptiontype(params.rvalAt(0))); +} +Variant i_destroydrawingwand(CArrRef params) { + FUNCTION_INJECTION(destroydrawingwand); + return (f_destroydrawingwand(params.rvalAt(0)), null); +} +Variant i_lstat(CArrRef params) { + FUNCTION_INJECTION(lstat); + return (f_lstat(params.rvalAt(0))); +} +Variant i_apache_note(CArrRef params) { + FUNCTION_INJECTION(apache_note); + int count = params.size(); + if (count <= 1) return (f_apache_note(params.rvalAt(0))); + return (f_apache_note(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetexceptiontype(CArrRef params) { + FUNCTION_INJECTION(drawgetexceptiontype); + return (f_drawgetexceptiontype(params.rvalAt(0))); +} +Variant i_drawbezier(CArrRef params) { + FUNCTION_INJECTION(drawbezier); + return (f_drawbezier(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_xmlwriter_start_comment(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_comment); + return (f_xmlwriter_start_comment(params.rvalAt(0))); +} +Variant i_ldap_set_rebind_proc(CArrRef params) { + FUNCTION_INJECTION(ldap_set_rebind_proc); + return (f_ldap_set_rebind_proc(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fb_debug_rlog(CArrRef params) { + FUNCTION_INJECTION(fb_debug_rlog); + int count = params.size(); + if (count <= 1) return (f_fb_debug_rlog(params.rvalAt(0))); + if (count == 2) return (f_fb_debug_rlog(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_fb_debug_rlog(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_fb_debug_rlog(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawsetstrokecolor(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokecolor); + return (f_drawsetstrokecolor(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_drawpathlinetohorizontalrelative(CArrRef params) { + FUNCTION_INJECTION(drawpathlinetohorizontalrelative); + return (f_drawpathlinetohorizontalrelative(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_gmmktime(CArrRef params) { + FUNCTION_INJECTION(gmmktime); + int count = params.size(); + if (count <= 0) return (f_gmmktime()); + if (count == 1) return (f_gmmktime(params.rvalAt(0))); + if (count == 2) return (f_gmmktime(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_gmmktime(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_gmmktime(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_gmmktime(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_gmmktime(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_gmdate(CArrRef params) { + FUNCTION_INJECTION(gmdate); + int count = params.size(); + if (count <= 1) return (f_gmdate(params.rvalAt(0))); + return (f_gmdate(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_posix_getgid(CArrRef params) { + FUNCTION_INJECTION(posix_getgid); + return (f_posix_getgid()); +} +Variant i_sinh(CArrRef params) { + FUNCTION_INJECTION(sinh); + return (f_sinh(params.rvalAt(0))); +} +Variant i_apc_fetch(CArrRef params) { + FUNCTION_INJECTION(apc_fetch); + int count = params.size(); + if (count <= 1) return (f_apc_fetch(params.rvalAt(0))); + if (count == 2) return (f_apc_fetch(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_apc_fetch(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); +} +Variant i_fileowner(CArrRef params) { + FUNCTION_INJECTION(fileowner); + return (f_fileowner(params.rvalAt(0))); +} +Variant i_imagecopymerge(CArrRef params) { + FUNCTION_INJECTION(imagecopymerge); + return (f_imagecopymerge(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8))); +} +Variant i_magickclipimage(CArrRef params) { + FUNCTION_INJECTION(magickclipimage); + return (f_magickclipimage(params.rvalAt(0))); +} +Variant i_imagestringup(CArrRef params) { + FUNCTION_INJECTION(imagestringup); + return (f_imagestringup(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_mt_getrandmax(CArrRef params) { + FUNCTION_INJECTION(mt_getrandmax); + return (f_mt_getrandmax()); +} +Variant i_magickgetresourcelimit(CArrRef params) { + FUNCTION_INJECTION(magickgetresourcelimit); + return (f_magickgetresourcelimit(params.rvalAt(0))); +} +Variant i_imagecolorexact(CArrRef params) { + FUNCTION_INJECTION(imagecolorexact); + return (f_imagecolorexact(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_setcookie(CArrRef params) { + FUNCTION_INJECTION(setcookie); + int count = params.size(); + if (count <= 1) return (f_setcookie(params.rvalAt(0))); + if (count == 2) return (f_setcookie(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_setcookie(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_setcookie(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_setcookie(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_setcookie(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + return (f_setcookie(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); +} +Variant i_fileatime(CArrRef params) { + FUNCTION_INJECTION(fileatime); + return (f_fileatime(params.rvalAt(0))); +} +Variant i_apd_stop_trace(CArrRef params) { + FUNCTION_INJECTION(apd_stop_trace); + return (f_apd_stop_trace(), null); +} +Variant i_addcslashes(CArrRef params) { + FUNCTION_INJECTION(addcslashes); + return (f_addcslashes(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicksetimageoption(CArrRef params) { + FUNCTION_INJECTION(magicksetimageoption); + return (f_magicksetimageoption(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_xmlwriter_write_comment(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_comment); + return (f_xmlwriter_write_comment(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetfontstyle(CArrRef params) { + FUNCTION_INJECTION(drawgetfontstyle); + return (f_drawgetfontstyle(params.rvalAt(0))); +} +Variant i_strtoupper(CArrRef params) { + FUNCTION_INJECTION(strtoupper); + return (f_strtoupper(params.rvalAt(0))); +} +Variant i_xml_set_processing_instruction_handler(CArrRef params) { + FUNCTION_INJECTION(xml_set_processing_instruction_handler); + return (f_xml_set_processing_instruction_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_apd_breakpoint(CArrRef params) { + FUNCTION_INJECTION(apd_breakpoint); + return (f_apd_breakpoint()); +} +Variant i_magickgetimageblueprimary(CArrRef params) { + FUNCTION_INJECTION(magickgetimageblueprimary); + return (f_magickgetimageblueprimary(params.rvalAt(0))); +} +Variant i_magickspreadimage(CArrRef params) { + FUNCTION_INJECTION(magickspreadimage); + return (f_magickspreadimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_array_fill(CArrRef params) { + FUNCTION_INJECTION(array_fill); + return (f_array_fill(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_fb_render_wrapped(CArrRef params) { + FUNCTION_INJECTION(fb_render_wrapped); + int count = params.size(); + if (count <= 1) return (f_fb_render_wrapped(params.rvalAt(0))); + if (count == 2) return (f_fb_render_wrapped(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_fb_render_wrapped(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_fb_render_wrapped(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_stream_set_write_buffer(CArrRef params) { + FUNCTION_INJECTION(stream_set_write_buffer); + return (f_stream_set_write_buffer(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_list_encodings(CArrRef params) { + FUNCTION_INJECTION(mb_list_encodings); + return (f_mb_list_encodings()); +} +Variant i_sleep(CArrRef params) { + FUNCTION_INJECTION(sleep); + return (f_sleep(params.rvalAt(0))); +} +Variant i_cleardrawingwand(CArrRef params) { + FUNCTION_INJECTION(cleardrawingwand); + return (f_cleardrawingwand(params.rvalAt(0)), null); +} +Variant i_imagecolorset(CArrRef params) { + FUNCTION_INJECTION(imagecolorset); + return (f_imagecolorset(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_openssl_x509_checkpurpose(CArrRef params) { + FUNCTION_INJECTION(openssl_x509_checkpurpose); + int count = params.size(); + if (count <= 2) return (f_openssl_x509_checkpurpose(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_openssl_x509_checkpurpose(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_openssl_x509_checkpurpose(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_drawpathcurvetosmoothabsolute(CArrRef params) { + FUNCTION_INJECTION(drawpathcurvetosmoothabsolute); + return (f_drawpathcurvetosmoothabsolute(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); +} +Variant i_array_intersect_ukey(CArrRef params) { + FUNCTION_INJECTION(array_intersect_ukey); + int count = params.size(); + if (count <= 3) return (f_array_intersect_ukey(count, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_array_intersect_ukey(count,params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.slice(3, count - 3, false))); +} +Variant i_timezone_name_from_abbr(CArrRef params) { + FUNCTION_INJECTION(timezone_name_from_abbr); + int count = params.size(); + if (count <= 1) return (f_timezone_name_from_abbr(params.rvalAt(0))); + if (count == 2) return (f_timezone_name_from_abbr(params.rvalAt(0), params.rvalAt(1))); + return (f_timezone_name_from_abbr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagefilledellipse(CArrRef params) { + FUNCTION_INJECTION(imagefilledellipse); + return (f_imagefilledellipse(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_pcntl_wstopsig(CArrRef params) { + FUNCTION_INJECTION(pcntl_wstopsig); + return (f_pcntl_wstopsig(params.rvalAt(0))); +} +Variant i_get_defined_vars(CArrRef params) { + FUNCTION_INJECTION(get_defined_vars); + return (f_get_defined_vars()); +} +Variant i_memory_get_usage(CArrRef params) { + FUNCTION_INJECTION(memory_get_usage); + int count = params.size(); + if (count <= 0) return (f_memory_get_usage()); + return (f_memory_get_usage(params.rvalAt(0))); +} +Variant i_intval(CArrRef params) { + FUNCTION_INJECTION(intval); + int count = params.size(); + if (count <= 1) return (f_intval(params.rvalAt(0))); + return (f_intval(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pagelet_server_task_status(CArrRef params) { + FUNCTION_INJECTION(pagelet_server_task_status); + return (f_pagelet_server_task_status(params.rvalAt(0))); +} +Variant i_iconv_set_encoding(CArrRef params) { + FUNCTION_INJECTION(iconv_set_encoding); + return (f_iconv_set_encoding(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickmattefloodfillimage(CArrRef params) { + FUNCTION_INJECTION(magickmattefloodfillimage); + return (f_magickmattefloodfillimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_mailparse_msg_get_part(CArrRef params) { + FUNCTION_INJECTION(mailparse_msg_get_part); + return (f_mailparse_msg_get_part(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_check_encoding(CArrRef params) { + FUNCTION_INJECTION(mb_check_encoding); + int count = params.size(); + if (count <= 0) return (f_mb_check_encoding()); + if (count == 1) return (f_mb_check_encoding(params.rvalAt(0))); + return (f_mb_check_encoding(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_get_dn(CArrRef params) { + FUNCTION_INJECTION(ldap_get_dn); + return (f_ldap_get_dn(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_newpixeliterator(CArrRef params) { + FUNCTION_INJECTION(newpixeliterator); + return (f_newpixeliterator(params.rvalAt(0))); +} +Variant i_magicksetimagefilename(CArrRef params) { + FUNCTION_INJECTION(magicksetimagefilename); + int count = params.size(); + if (count <= 1) return (f_magicksetimagefilename(params.rvalAt(0))); + return (f_magicksetimagefilename(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_call_user_func(CArrRef params) { + FUNCTION_INJECTION(call_user_func); + int count = params.size(); + if (count <= 1) return (f_call_user_func(count, params.rvalAt(0))); + return (f_call_user_func(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_mysql_list_tables(CArrRef params) { + FUNCTION_INJECTION(mysql_list_tables); + int count = params.size(); + if (count <= 1) return (f_mysql_list_tables(params.rvalAt(0))); + return (f_mysql_list_tables(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetinterlacescheme(CArrRef params) { + FUNCTION_INJECTION(magickgetinterlacescheme); + return (f_magickgetinterlacescheme(params.rvalAt(0))); +} +Variant i_ltrim(CArrRef params) { + FUNCTION_INJECTION(ltrim); + int count = params.size(); + if (count <= 1) return (f_ltrim(params.rvalAt(0))); + return (f_ltrim(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicktextureimage(CArrRef params) { + FUNCTION_INJECTION(magicktextureimage); + return (f_magicktextureimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_ereg_match(CArrRef params) { + FUNCTION_INJECTION(mb_ereg_match); + int count = params.size(); + if (count <= 2) return (f_mb_ereg_match(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_ereg_match(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mt_srand(CArrRef params) { + FUNCTION_INJECTION(mt_srand); + int count = params.size(); + if (count <= 0) return (f_mt_srand(), null); + return (f_mt_srand(params.rvalAt(0)), null); +} +Variant i_imagecolorallocate(CArrRef params) { + FUNCTION_INJECTION(imagecolorallocate); + return (f_imagecolorallocate(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_define_syslog_variables(CArrRef params) { + FUNCTION_INJECTION(define_syslog_variables); + return (f_define_syslog_variables(), null); +} +Variant i_mcrypt_enc_get_modes_name(CArrRef params) { + FUNCTION_INJECTION(mcrypt_enc_get_modes_name); + return (f_mcrypt_enc_get_modes_name(params.rvalAt(0))); +} +Variant i_array_flip(CArrRef params) { + FUNCTION_INJECTION(array_flip); + return (f_array_flip(params.rvalAt(0))); +} +Variant i_count(CArrRef params) { + FUNCTION_INJECTION(count); + int count = params.size(); + if (count <= 1) return (f_count(params.rvalAt(0))); + return (f_count(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_lcg_value(CArrRef params) { + FUNCTION_INJECTION(lcg_value); + return (f_lcg_value()); +} +Variant i_php_logo_guid(CArrRef params) { + FUNCTION_INJECTION(php_logo_guid); + return (f_php_logo_guid()); +} +Variant i_time(CArrRef params) { + FUNCTION_INJECTION(time); + return (f_time()); +} +Variant i_magickcoalesceimages(CArrRef params) { + FUNCTION_INJECTION(magickcoalesceimages); + return (f_magickcoalesceimages(params.rvalAt(0))); +} +Variant i_pixelgetquantumcolor(CArrRef params) { + FUNCTION_INJECTION(pixelgetquantumcolor); + return (f_pixelgetquantumcolor(params.rvalAt(0))); +} +Variant i_openssl_private_encrypt(CArrRef params) { + FUNCTION_INJECTION(openssl_private_encrypt); + int count = params.size(); + if (count <= 3) return (f_openssl_private_encrypt(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); + return (f_openssl_private_encrypt(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_xhprof_enable(CArrRef params) { + FUNCTION_INJECTION(xhprof_enable); + int count = params.size(); + if (count <= 1) return (f_xhprof_enable(params.rvalAt(0)), null); + return (f_xhprof_enable(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_xmlwriter_start_document(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_document); + int count = params.size(); + if (count <= 1) return (f_xmlwriter_start_document(params.rvalAt(0))); + if (count == 2) return (f_xmlwriter_start_document(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_xmlwriter_start_document(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_xmlwriter_start_document(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_libxml_clear_errors(CArrRef params) { + FUNCTION_INJECTION(libxml_clear_errors); + return (f_libxml_clear_errors(), null); +} +Variant i_magicknormalizeimage(CArrRef params) { + FUNCTION_INJECTION(magicknormalizeimage); + return (f_magicknormalizeimage(params.rvalAt(0))); +} +Variant i_magickgetformat(CArrRef params) { + FUNCTION_INJECTION(magickgetformat); + return (f_magickgetformat(params.rvalAt(0))); +} +Variant i_hphp_get_class_info(CArrRef params) { + FUNCTION_INJECTION(hphp_get_class_info); + return (f_hphp_get_class_info(params.rvalAt(0))); +} +Variant i_mailparse_msg_get_part_data(CArrRef params) { + FUNCTION_INJECTION(mailparse_msg_get_part_data); + return (f_mailparse_msg_get_part_data(params.rvalAt(0))); +} +Variant i_openssl_csr_new(CArrRef params) { + FUNCTION_INJECTION(openssl_csr_new); + int count = params.size(); + if (count <= 2) return (f_openssl_csr_new(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + if (count == 3) return (f_openssl_csr_new(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); + return (f_openssl_csr_new(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_xbox_task_start(CArrRef params) { + FUNCTION_INJECTION(xbox_task_start); + return (f_xbox_task_start(params.rvalAt(0))); +} +Variant i_getcwd(CArrRef params) { + FUNCTION_INJECTION(getcwd); + return (f_getcwd()); +} +Variant i_posix_getrlimit(CArrRef params) { + FUNCTION_INJECTION(posix_getrlimit); + return (f_posix_getrlimit()); +} +Variant i_mb_get_info(CArrRef params) { + FUNCTION_INJECTION(mb_get_info); + int count = params.size(); + if (count <= 0) return (f_mb_get_info()); + return (f_mb_get_info(params.rvalAt(0))); +} +Variant i_newpixelwands(CArrRef params) { + FUNCTION_INJECTION(newpixelwands); + return (f_newpixelwands(params.rvalAt(0))); +} +Variant i_fputcsv(CArrRef params) { + FUNCTION_INJECTION(fputcsv); + int count = params.size(); + if (count <= 2) return (f_fputcsv(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_fputcsv(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_fputcsv(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_stream_bucket_prepend(CArrRef params) { + FUNCTION_INJECTION(stream_bucket_prepend); + return (f_stream_bucket_prepend(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_apache_get_scoreboard(CArrRef params) { + FUNCTION_INJECTION(apache_get_scoreboard); + return (f_apache_get_scoreboard()); +} +Variant i_sprintf(CArrRef params) { + FUNCTION_INJECTION(sprintf); + int count = params.size(); + if (count <= 1) return (f_sprintf(count, params.rvalAt(0))); + return (f_sprintf(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_ldap_err2str(CArrRef params) { + FUNCTION_INJECTION(ldap_err2str); + return (f_ldap_err2str(params.rvalAt(0))); +} +Variant i_xmlwriter_end_attribute(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_end_attribute); + return (f_xmlwriter_end_attribute(params.rvalAt(0))); +} +Variant i_imagecharup(CArrRef params) { + FUNCTION_INJECTION(imagecharup); + return (f_imagecharup(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_fflush(CArrRef params) { + FUNCTION_INJECTION(fflush); + return (f_fflush(params.rvalAt(0))); +} +Variant i_magickwaveimage(CArrRef params) { + FUNCTION_INJECTION(magickwaveimage); + return (f_magickwaveimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagepsfreefont(CArrRef params) { + FUNCTION_INJECTION(imagepsfreefont); + return (f_imagepsfreefont(params.rvalAt(0))); +} +Variant i_magickgetsamplingfactors(CArrRef params) { + FUNCTION_INJECTION(magickgetsamplingfactors); + return (f_magickgetsamplingfactors(params.rvalAt(0))); +} +Variant i_mt_rand(CArrRef params) { + FUNCTION_INJECTION(mt_rand); + int count = params.size(); + if (count <= 0) return (f_mt_rand()); + if (count == 1) return (f_mt_rand(params.rvalAt(0))); + return (f_mt_rand(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickflopimage(CArrRef params) { + FUNCTION_INJECTION(magickflopimage); + return (f_magickflopimage(params.rvalAt(0))); +} +Variant i_getenv(CArrRef params) { + FUNCTION_INJECTION(getenv); + return (f_getenv(params.rvalAt(0))); +} +Variant i_register_cleanup_function(CArrRef params) { + FUNCTION_INJECTION(register_cleanup_function); + int count = params.size(); + if (count <= 1) return (f_register_cleanup_function(count, params.rvalAt(0)), null); + return (f_register_cleanup_function(count,params.rvalAt(0), params.slice(1, count - 1, false)), null); +} +Variant i_is_dir(CArrRef params) { + FUNCTION_INJECTION(is_dir); + return (f_is_dir(params.rvalAt(0))); +} +Variant i_get_defined_functions(CArrRef params) { + FUNCTION_INJECTION(get_defined_functions); + return (f_get_defined_functions()); +} +Variant i_stream_set_timeout(CArrRef params) { + FUNCTION_INJECTION(stream_set_timeout); + int count = params.size(); + if (count <= 2) return (f_stream_set_timeout(params.rvalAt(0), params.rvalAt(1))); + return (f_stream_set_timeout(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_pixelsetblack(CArrRef params) { + FUNCTION_INJECTION(pixelsetblack); + return (f_pixelsetblack(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_magickenhanceimage(CArrRef params) { + FUNCTION_INJECTION(magickenhanceimage); + return (f_magickenhanceimage(params.rvalAt(0))); +} +Variant i_magickgetcharwidth(CArrRef params) { + FUNCTION_INJECTION(magickgetcharwidth); + int count = params.size(); + if (count <= 3) return (f_magickgetcharwidth(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickgetcharwidth(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magickshearimage(CArrRef params) { + FUNCTION_INJECTION(magickshearimage); + return (f_magickshearimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_stream_socket_enable_crypto(CArrRef params) { + FUNCTION_INJECTION(stream_socket_enable_crypto); + int count = params.size(); + if (count <= 2) return (f_stream_socket_enable_crypto(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_stream_socket_enable_crypto(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_stream_socket_enable_crypto(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_stream_socket_server(CArrRef params) { + FUNCTION_INJECTION(stream_socket_server); + int count = params.size(); + if (count <= 1) return (f_stream_socket_server(params.rvalAt(0))); + if (count == 2) return (f_stream_socket_server(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + if (count == 3) return (f_stream_socket_server(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); + if (count == 4) return (f_stream_socket_server(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); + return (f_stream_socket_server(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_apd_set_pprof_trace(CArrRef params) { + FUNCTION_INJECTION(apd_set_pprof_trace); + int count = params.size(); + if (count <= 0) return (f_apd_set_pprof_trace()); + if (count == 1) return (f_apd_set_pprof_trace(params.rvalAt(0))); + return (f_apd_set_pprof_trace(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_sort(CArrRef params) { + FUNCTION_INJECTION(sort); + int count = params.size(); + if (count <= 1) return (f_sort(ref(const_cast(params).lvalAt(0)))); + if (count == 2) return (f_sort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); + return (f_sort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_oci_num_rows(CArrRef params) { + FUNCTION_INJECTION(oci_num_rows); + return (f_oci_num_rows(params.rvalAt(0))); +} +Variant i_ini_set(CArrRef params) { + FUNCTION_INJECTION(ini_set); + return (f_ini_set(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawgetfont(CArrRef params) { + FUNCTION_INJECTION(drawgetfont); + return (f_drawgetfont(params.rvalAt(0))); +} +Variant i_readdir(CArrRef params) { + FUNCTION_INJECTION(readdir); + return (f_readdir(params.rvalAt(0))); +} +Variant i_mysql_close(CArrRef params) { + FUNCTION_INJECTION(mysql_close); + int count = params.size(); + if (count <= 0) return (f_mysql_close()); + return (f_mysql_close(params.rvalAt(0))); +} +Variant i_ldap_8859_to_t61(CArrRef params) { + FUNCTION_INJECTION(ldap_8859_to_t61); + return (f_ldap_8859_to_t61(params.rvalAt(0))); +} +Variant i_magickblurimage(CArrRef params) { + FUNCTION_INJECTION(magickblurimage); + int count = params.size(); + if (count <= 3) return (f_magickblurimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickblurimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magickreducenoiseimage(CArrRef params) { + FUNCTION_INJECTION(magickreducenoiseimage); + return (f_magickreducenoiseimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicksetimagerenderingintent(CArrRef params) { + FUNCTION_INJECTION(magicksetimagerenderingintent); + return (f_magicksetimagerenderingintent(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicktintimage(CArrRef params) { + FUNCTION_INJECTION(magicktintimage); + return (f_magicktintimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_oci_fetch_all(CArrRef params) { + FUNCTION_INJECTION(oci_fetch_all); + int count = params.size(); + if (count <= 2) return (f_oci_fetch_all(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + if (count == 3) return (f_oci_fetch_all(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); + if (count == 4) return (f_oci_fetch_all(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); + return (f_oci_fetch_all(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_rawurldecode(CArrRef params) { + FUNCTION_INJECTION(rawurldecode); + return (f_rawurldecode(params.rvalAt(0))); +} +Variant i_xmlwriter_start_element_ns(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_element_ns); + return (f_xmlwriter_start_element_ns(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_strftime(CArrRef params) { + FUNCTION_INJECTION(strftime); + int count = params.size(); + if (count <= 1) return (f_strftime(params.rvalAt(0))); + return (f_strftime(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_imagecolorstotal(CArrRef params) { + FUNCTION_INJECTION(imagecolorstotal); + return (f_imagecolorstotal(params.rvalAt(0))); +} +Variant i_apc_bin_dumpfile(CArrRef params) { + FUNCTION_INJECTION(apc_bin_dumpfile); + int count = params.size(); + if (count <= 3) return (f_apc_bin_dumpfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_apc_bin_dumpfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_apc_bin_dumpfile(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_xml_parse_into_struct(CArrRef params) { + FUNCTION_INJECTION(xml_parse_into_struct); + int count = params.size(); + if (count <= 3) return (f_xml_parse_into_struct(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + return (f_xml_parse_into_struct(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)))); +} +Variant i_icu_transliterate(CArrRef params) { + FUNCTION_INJECTION(icu_transliterate); + return (f_icu_transliterate(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_eregi_replace(CArrRef params) { + FUNCTION_INJECTION(mb_eregi_replace); + int count = params.size(); + if (count <= 3) return (f_mb_eregi_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_eregi_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_array_unshift(CArrRef params) { + FUNCTION_INJECTION(array_unshift); + int count = params.size(); + if (count <= 2) return (f_array_unshift(count, ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); + return (f_array_unshift(count,ref(const_cast(params).lvalAt(0)), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_oci_error(CArrRef params) { + FUNCTION_INJECTION(oci_error); + int count = params.size(); + if (count <= 0) return (f_oci_error()); + return (f_oci_error(params.rvalAt(0))); +} +Variant i_stat(CArrRef params) { + FUNCTION_INJECTION(stat); + return (f_stat(params.rvalAt(0))); +} +Variant i_posix_getpid(CArrRef params) { + FUNCTION_INJECTION(posix_getpid); + return (f_posix_getpid()); +} +Variant i_get_current_user(CArrRef params) { + FUNCTION_INJECTION(get_current_user); + return (f_get_current_user()); +} +Variant i_filesize(CArrRef params) { + FUNCTION_INJECTION(filesize); + return (f_filesize(params.rvalAt(0))); +} +Variant i_round(CArrRef params) { + FUNCTION_INJECTION(round); + int count = params.size(); + if (count <= 1) return (f_round(params.rvalAt(0))); + return (f_round(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_sqrt(CArrRef params) { + FUNCTION_INJECTION(sqrt); + return (f_sqrt(params.rvalAt(0))); +} +Variant i_ldap_close(CArrRef params) { + FUNCTION_INJECTION(ldap_close); + return (f_ldap_close(params.rvalAt(0))); +} +Variant i_mcrypt_enc_get_algorithms_name(CArrRef params) { + FUNCTION_INJECTION(mcrypt_enc_get_algorithms_name); + return (f_mcrypt_enc_get_algorithms_name(params.rvalAt(0))); +} +Variant i_extension_loaded(CArrRef params) { + FUNCTION_INJECTION(extension_loaded); + return (f_extension_loaded(params.rvalAt(0))); +} +Variant i_fprintf(CArrRef params) { + FUNCTION_INJECTION(fprintf); + int count = params.size(); + if (count <= 2) return (f_fprintf(count, params.rvalAt(0), params.rvalAt(1))); + return (f_fprintf(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_mb_detect_order(CArrRef params) { + FUNCTION_INJECTION(mb_detect_order); + int count = params.size(); + if (count <= 0) return (f_mb_detect_order()); + return (f_mb_detect_order(params.rvalAt(0))); +} +Variant i_get_magic_quotes_runtime(CArrRef params) { + FUNCTION_INJECTION(get_magic_quotes_runtime); + return (f_get_magic_quotes_runtime()); +} +Variant i_magickmapimage(CArrRef params) { + FUNCTION_INJECTION(magickmapimage); + return (f_magickmapimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_pixelsetopacityquantum(CArrRef params) { + FUNCTION_INJECTION(pixelsetopacityquantum); + return (f_pixelsetopacityquantum(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_ctype_space(CArrRef params) { + FUNCTION_INJECTION(ctype_space); + return (f_ctype_space(params.rvalAt(0))); +} +Variant i_mcrypt_generic_init(CArrRef params) { + FUNCTION_INJECTION(mcrypt_generic_init); + return (f_mcrypt_generic_init(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_quoted_printable_decode(CArrRef params) { + FUNCTION_INJECTION(quoted_printable_decode); + return (f_quoted_printable_decode(params.rvalAt(0))); +} +Variant i_destroymagickwand(CArrRef params) { + FUNCTION_INJECTION(destroymagickwand); + return (f_destroymagickwand(params.rvalAt(0)), null); +} +Variant i_imagerectangle(CArrRef params) { + FUNCTION_INJECTION(imagerectangle); + return (f_imagerectangle(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_get_cfg_var(CArrRef params) { + FUNCTION_INJECTION(get_cfg_var); + return (f_get_cfg_var(params.rvalAt(0))); +} +Variant i_pixelgetalphaquantum(CArrRef params) { + FUNCTION_INJECTION(pixelgetalphaquantum); + return (f_pixelgetalphaquantum(params.rvalAt(0))); +} +Variant i_magickgetimageblob(CArrRef params) { + FUNCTION_INJECTION(magickgetimageblob); + return (f_magickgetimageblob(params.rvalAt(0))); +} +Variant i_imagepsextendfont(CArrRef params) { + FUNCTION_INJECTION(imagepsextendfont); + return (f_imagepsextendfont(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_stream_get_filters(CArrRef params) { + FUNCTION_INJECTION(stream_get_filters); + return (f_stream_get_filters()); +} +Variant i_magickqueryfontmetrics(CArrRef params) { + FUNCTION_INJECTION(magickqueryfontmetrics); + int count = params.size(); + if (count <= 3) return (f_magickqueryfontmetrics(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickqueryfontmetrics(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_ispixeliterator(CArrRef params) { + FUNCTION_INJECTION(ispixeliterator); + return (f_ispixeliterator(params.rvalAt(0))); +} +Variant i_getdate(CArrRef params) { + FUNCTION_INJECTION(getdate); + int count = params.size(); + if (count <= 0) return (f_getdate()); + return (f_getdate(params.rvalAt(0))); +} +Variant i_imagefilledarc(CArrRef params) { + FUNCTION_INJECTION(imagefilledarc); + return (f_imagefilledarc(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8))); +} +Variant i_oci_server_version(CArrRef params) { + FUNCTION_INJECTION(oci_server_version); + return (f_oci_server_version(params.rvalAt(0))); +} +Variant i_xmlwriter_write_attribute(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_attribute); + return (f_xmlwriter_write_attribute(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagearc(CArrRef params) { + FUNCTION_INJECTION(imagearc); + return (f_imagearc(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); +} +Variant i_drawgetgravity(CArrRef params) { + FUNCTION_INJECTION(drawgetgravity); + return (f_drawgetgravity(params.rvalAt(0))); +} +Variant i_magickreadimages(CArrRef params) { + FUNCTION_INJECTION(magickreadimages); + return (f_magickreadimages(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_imagecreatefromgd2(CArrRef params) { + FUNCTION_INJECTION(imagecreatefromgd2); + return (f_imagecreatefromgd2(params.rvalAt(0))); +} +Variant i_stream_socket_shutdown(CArrRef params) { + FUNCTION_INJECTION(stream_socket_shutdown); + return (f_stream_socket_shutdown(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_connection_status(CArrRef params) { + FUNCTION_INJECTION(connection_status); + return (f_connection_status()); +} +Variant i_pixelresetiterator(CArrRef params) { + FUNCTION_INJECTION(pixelresetiterator); + return (f_pixelresetiterator(params.rvalAt(0)), null); +} +Variant i_msg_send(CArrRef params) { + FUNCTION_INJECTION(msg_send); + int count = params.size(); + if (count <= 3) return (f_msg_send(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_msg_send(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_msg_send(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_msg_send(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), ref(const_cast(params).lvalAt(5)))); +} +Variant i_getmygid(CArrRef params) { + FUNCTION_INJECTION(getmygid); + return (f_getmygid()); +} +Variant i_array_udiff_uassoc(CArrRef params) { + FUNCTION_INJECTION(array_udiff_uassoc); + int count = params.size(); + if (count <= 4) return (f_array_udiff_uassoc(count, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_array_udiff_uassoc(count,params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.slice(4, count - 4, false))); +} +Variant i_xml_set_character_data_handler(CArrRef params) { + FUNCTION_INJECTION(xml_set_character_data_handler); + return (f_xml_set_character_data_handler(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_array_diff_uassoc(CArrRef params) { + FUNCTION_INJECTION(array_diff_uassoc); + int count = params.size(); + if (count <= 3) return (f_array_diff_uassoc(count, params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_array_diff_uassoc(count,params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.slice(3, count - 3, false))); +} +Variant i_strptime(CArrRef params) { + FUNCTION_INJECTION(strptime); + return (f_strptime(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pcntl_waitpid(CArrRef params) { + FUNCTION_INJECTION(pcntl_waitpid); + int count = params.size(); + if (count <= 2) return (f_pcntl_waitpid(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_pcntl_waitpid(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); +} +Variant i_gd_info(CArrRef params) { + FUNCTION_INJECTION(gd_info); + return (f_gd_info()); +} +Variant i_stream_get_transports(CArrRef params) { + FUNCTION_INJECTION(stream_get_transports); + return (f_stream_get_transports()); +} +Variant i_drawsetstrokepatternurl(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokepatternurl); + return (f_drawsetstrokepatternurl(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawsetfillrule(CArrRef params) { + FUNCTION_INJECTION(drawsetfillrule); + return (f_drawsetfillrule(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_acosh(CArrRef params) { + FUNCTION_INJECTION(acosh); + return (f_acosh(params.rvalAt(0))); +} +Variant i_ldap_add(CArrRef params) { + FUNCTION_INJECTION(ldap_add); + return (f_ldap_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_posix_getsid(CArrRef params) { + FUNCTION_INJECTION(posix_getsid); + return (f_posix_getsid(params.rvalAt(0))); +} +Variant i_posix_getlogin(CArrRef params) { + FUNCTION_INJECTION(posix_getlogin); + return (f_posix_getlogin()); +} +Variant i_socket_create_pair(CArrRef params) { + FUNCTION_INJECTION(socket_create_pair); + return (f_socket_create_pair(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), ref(const_cast(params).lvalAt(3)))); +} +Variant i_imagecreate(CArrRef params) { + FUNCTION_INJECTION(imagecreate); + return (f_imagecreate(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_imagegd2(CArrRef params) { + FUNCTION_INJECTION(imagegd2); + int count = params.size(); + if (count <= 1) return (f_imagegd2(params.rvalAt(0))); + if (count == 2) return (f_imagegd2(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_imagegd2(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_imagegd2(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_openssl_x509_check_private_key(CArrRef params) { + FUNCTION_INJECTION(openssl_x509_check_private_key); + return (f_openssl_x509_check_private_key(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_oci_num_fields(CArrRef params) { + FUNCTION_INJECTION(oci_num_fields); + return (f_oci_num_fields(params.rvalAt(0))); +} +Variant i_shm_put_var(CArrRef params) { + FUNCTION_INJECTION(shm_put_var); + return (f_shm_put_var(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_debug_print_backtrace(CArrRef params) { + FUNCTION_INJECTION(debug_print_backtrace); + return (f_debug_print_backtrace(), null); +} +Variant i_stream_set_blocking(CArrRef params) { + FUNCTION_INJECTION(stream_set_blocking); + return (f_stream_set_blocking(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fb_get_derived_classes(CArrRef params) { + FUNCTION_INJECTION(fb_get_derived_classes); + return (f_fb_get_derived_classes(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xml_parser_get_option(CArrRef params) { + FUNCTION_INJECTION(xml_parser_get_option); + return (f_xml_parser_get_option(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ezmlm_hash(CArrRef params) { + FUNCTION_INJECTION(ezmlm_hash); + return (f_ezmlm_hash(params.rvalAt(0))); +} +Variant i_array_search(CArrRef params) { + FUNCTION_INJECTION(array_search); + int count = params.size(); + if (count <= 2) return (f_array_search(params.rvalAt(0), params.rvalAt(1))); + return (f_array_search(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_html_profile(CArrRef params) { + FUNCTION_INJECTION(html_profile); + return (f_html_profile(params.rvalAt(0))); +} +Variant i_is_int(CArrRef params) { + FUNCTION_INJECTION(is_int); + return (f_is_int(params.rvalAt(0))); +} +Variant i_dangling_server_proxy_new_request(CArrRef params) { + FUNCTION_INJECTION(dangling_server_proxy_new_request); + return (f_dangling_server_proxy_new_request(params.rvalAt(0))); +} +Variant i_fb_set_opcode(CArrRef params) { + FUNCTION_INJECTION(fb_set_opcode); + return (f_fb_set_opcode(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_xmlwriter_end_dtd_entity(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_end_dtd_entity); + return (f_xmlwriter_end_dtd_entity(params.rvalAt(0))); +} +Variant i_fbml_get_children_11(CArrRef params) { + FUNCTION_INJECTION(fbml_get_children_11); + return (f_fbml_get_children_11(params.rvalAt(0))); +} +Variant i_trim(CArrRef params) { + FUNCTION_INJECTION(trim); + int count = params.size(); + if (count <= 1) return (f_trim(params.rvalAt(0))); + return (f_trim(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_connection_timeout(CArrRef params) { + FUNCTION_INJECTION(connection_timeout); + return (f_connection_timeout()); +} +Variant i_magickprofileimage(CArrRef params) { + FUNCTION_INJECTION(magickprofileimage); + int count = params.size(); + if (count <= 2) return (f_magickprofileimage(params.rvalAt(0), params.rvalAt(1))); + return (f_magickprofileimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawpathclose(CArrRef params) { + FUNCTION_INJECTION(drawpathclose); + return (f_drawpathclose(params.rvalAt(0)), null); +} +Variant i_pixelgetindex(CArrRef params) { + FUNCTION_INJECTION(pixelgetindex); + return (f_pixelgetindex(params.rvalAt(0))); +} +Variant i_mysql_data_seek(CArrRef params) { + FUNCTION_INJECTION(mysql_data_seek); + return (f_mysql_data_seek(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hebrevc(CArrRef params) { + FUNCTION_INJECTION(hebrevc); + int count = params.size(); + if (count <= 1) return (f_hebrevc(params.rvalAt(0))); + return (f_hebrevc(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_get_meta_tags(CArrRef params) { + FUNCTION_INJECTION(get_meta_tags); + int count = params.size(); + if (count <= 1) return (f_get_meta_tags(params.rvalAt(0))); + return (f_get_meta_tags(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicknextimage(CArrRef params) { + FUNCTION_INJECTION(magicknextimage); + return (f_magicknextimage(params.rvalAt(0))); +} +Variant i_mysql_stat(CArrRef params) { + FUNCTION_INJECTION(mysql_stat); + int count = params.size(); + if (count <= 0) return (f_mysql_stat()); + return (f_mysql_stat(params.rvalAt(0))); +} +Variant i_mysql_create_db(CArrRef params) { + FUNCTION_INJECTION(mysql_create_db); + int count = params.size(); + if (count <= 1) return (f_mysql_create_db(params.rvalAt(0))); + return (f_mysql_create_db(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_get_object_vars(CArrRef params) { + FUNCTION_INJECTION(get_object_vars); + return (f_get_object_vars(params.rvalAt(0))); +} +Variant i_msg_receive(CArrRef params) { + FUNCTION_INJECTION(msg_receive); + int count = params.size(); + if (count <= 5) return (f_msg_receive(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), ref(const_cast(params).lvalAt(4)))); + if (count == 6) return (f_msg_receive(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), ref(const_cast(params).lvalAt(4)), params.rvalAt(5))); + if (count == 7) return (f_msg_receive(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), ref(const_cast(params).lvalAt(4)), params.rvalAt(5), params.rvalAt(6))); + return (f_msg_receive(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3), ref(const_cast(params).lvalAt(4)), params.rvalAt(5), params.rvalAt(6), ref(const_cast(params).lvalAt(7)))); +} +Variant i_is_integer(CArrRef params) { + FUNCTION_INJECTION(is_integer); + return (f_is_integer(params.rvalAt(0))); +} +Variant i_oci_set_prefetch(CArrRef params) { + FUNCTION_INJECTION(oci_set_prefetch); + return (f_oci_set_prefetch(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_imagecreatefromgif(CArrRef params) { + FUNCTION_INJECTION(imagecreatefromgif); + return (f_imagecreatefromgif(params.rvalAt(0))); +} +Variant i_posix_getuid(CArrRef params) { + FUNCTION_INJECTION(posix_getuid); + return (f_posix_getuid()); +} +Variant i_mb_send_mail(CArrRef params) { + FUNCTION_INJECTION(mb_send_mail); + int count = params.size(); + if (count <= 3) return (f_mb_send_mail(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_mb_send_mail(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_mb_send_mail(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_register_postsend_function(CArrRef params) { + FUNCTION_INJECTION(register_postsend_function); + int count = params.size(); + if (count <= 1) return (f_register_postsend_function(count, params.rvalAt(0)), null); + return (f_register_postsend_function(count,params.rvalAt(0), params.slice(1, count - 1, false)), null); +} +Variant i_long2ip(CArrRef params) { + FUNCTION_INJECTION(long2ip); + return (f_long2ip(params.rvalAt(0))); +} +Variant i_getrusage(CArrRef params) { + FUNCTION_INJECTION(getrusage); + int count = params.size(); + if (count <= 0) return (f_getrusage()); + return (f_getrusage(params.rvalAt(0))); +} +Variant i_evhttp_set_cache(CArrRef params) { + FUNCTION_INJECTION(evhttp_set_cache); + int count = params.size(); + if (count <= 2) return (f_evhttp_set_cache(params.rvalAt(0), params.rvalAt(1)), null); + return (f_evhttp_set_cache(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_magickoilpaintimage(CArrRef params) { + FUNCTION_INJECTION(magickoilpaintimage); + return (f_magickoilpaintimage(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_strripos(CArrRef params) { + FUNCTION_INJECTION(strripos); + int count = params.size(); + if (count <= 2) return (f_strripos(params.rvalAt(0), params.rvalAt(1))); + return (f_strripos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickgetfilename(CArrRef params) { + FUNCTION_INJECTION(magickgetfilename); + return (f_magickgetfilename(params.rvalAt(0))); +} +Variant i_magicksetimagecolormapcolor(CArrRef params) { + FUNCTION_INJECTION(magicksetimagecolormapcolor); + return (f_magicksetimagecolormapcolor(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magicksetimagegamma(CArrRef params) { + FUNCTION_INJECTION(magicksetimagegamma); + return (f_magicksetimagegamma(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mysql_pconnect(CArrRef params) { + FUNCTION_INJECTION(mysql_pconnect); + int count = params.size(); + if (count <= 0) return (f_mysql_pconnect()); + if (count == 1) return (f_mysql_pconnect(params.rvalAt(0))); + if (count == 2) return (f_mysql_pconnect(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mysql_pconnect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_mysql_pconnect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_mysql_pconnect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_mysql_pconnect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_stripos(CArrRef params) { + FUNCTION_INJECTION(stripos); + int count = params.size(); + if (count <= 2) return (f_stripos(params.rvalAt(0), params.rvalAt(1))); + return (f_stripos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_http_build_query(CArrRef params) { + FUNCTION_INJECTION(http_build_query); + int count = params.size(); + if (count <= 1) return (f_http_build_query(params.rvalAt(0))); + if (count == 2) return (f_http_build_query(params.rvalAt(0), params.rvalAt(1))); + return (f_http_build_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_apc_add(CArrRef params) { + FUNCTION_INJECTION(apc_add); + int count = params.size(); + if (count <= 2) return (f_apc_add(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_apc_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_apc_add(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_iconv_strlen(CArrRef params) { + FUNCTION_INJECTION(iconv_strlen); + int count = params.size(); + if (count <= 1) return (f_iconv_strlen(params.rvalAt(0))); + return (f_iconv_strlen(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_vsprintf(CArrRef params) { + FUNCTION_INJECTION(vsprintf); + return (f_vsprintf(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fbml_sanitize_js_11(CArrRef params) { + FUNCTION_INJECTION(fbml_sanitize_js_11); + return (f_fbml_sanitize_js_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mailparse_msg_extract_part_file(CArrRef params) { + FUNCTION_INJECTION(mailparse_msg_extract_part_file); + int count = params.size(); + if (count <= 2) return (f_mailparse_msg_extract_part_file(params.rvalAt(0), params.rvalAt(1))); + return (f_mailparse_msg_extract_part_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imageistruecolor(CArrRef params) { + FUNCTION_INJECTION(imageistruecolor); + return (f_imageistruecolor(params.rvalAt(0))); +} +Variant i_is_nan(CArrRef params) { + FUNCTION_INJECTION(is_nan); + return (f_is_nan(params.rvalAt(0))); +} +Variant i_imagegif(CArrRef params) { + FUNCTION_INJECTION(imagegif); + int count = params.size(); + if (count <= 1) return (f_imagegif(params.rvalAt(0))); + return (f_imagegif(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fbml_batch_precache_11(CArrRef params) { + FUNCTION_INJECTION(fbml_batch_precache_11); + return (f_fbml_batch_precache_11(params.rvalAt(0))); +} +Variant i_eregi_replace(CArrRef params) { + FUNCTION_INJECTION(eregi_replace); + return (f_eregi_replace(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickgetimageiterations(CArrRef params) { + FUNCTION_INJECTION(magickgetimageiterations); + return (f_magickgetimageiterations(params.rvalAt(0))); +} +Variant i_register_tick_function(CArrRef params) { + FUNCTION_INJECTION(register_tick_function); + int count = params.size(); + if (count <= 1) return (f_register_tick_function(count, params.rvalAt(0))); + return (f_register_tick_function(count,params.rvalAt(0), params.slice(1, count - 1, false))); +} +Variant i_pixelsetblackquantum(CArrRef params) { + FUNCTION_INJECTION(pixelsetblackquantum); + return (f_pixelsetblackquantum(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_jpeg2wbmp(CArrRef params) { + FUNCTION_INJECTION(jpeg2wbmp); + return (f_jpeg2wbmp(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_mcrypt_get_iv_size(CArrRef params) { + FUNCTION_INJECTION(mcrypt_get_iv_size); + return (f_mcrypt_get_iv_size(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mysql_fetch_array(CArrRef params) { + FUNCTION_INJECTION(mysql_fetch_array); + int count = params.size(); + if (count <= 1) return (f_mysql_fetch_array(params.rvalAt(0))); + return (f_mysql_fetch_array(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickpreviousimage(CArrRef params) { + FUNCTION_INJECTION(magickpreviousimage); + return (f_magickpreviousimage(params.rvalAt(0))); +} +Variant i_magickborderimage(CArrRef params) { + FUNCTION_INJECTION(magickborderimage); + return (f_magickborderimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_mcrypt_module_is_block_mode(CArrRef params) { + FUNCTION_INJECTION(mcrypt_module_is_block_mode); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_is_block_mode(params.rvalAt(0))); + return (f_mcrypt_module_is_block_mode(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mb_substr(CArrRef params) { + FUNCTION_INJECTION(mb_substr); + int count = params.size(); + if (count <= 2) return (f_mb_substr(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_substr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_mb_substr(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_get_defined_constants(CArrRef params) { + FUNCTION_INJECTION(get_defined_constants); + int count = params.size(); + if (count <= 0) return (f_get_defined_constants()); + return (f_get_defined_constants(params.rvalAt(0))); +} +Variant i_mcrypt_enc_is_block_mode(CArrRef params) { + FUNCTION_INJECTION(mcrypt_enc_is_block_mode); + return (f_mcrypt_enc_is_block_mode(params.rvalAt(0))); +} +Variant i_mailparse_stream_encode(CArrRef params) { + FUNCTION_INJECTION(mailparse_stream_encode); + return (f_mailparse_stream_encode(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawsetstrokedashoffset(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokedashoffset); + return (f_drawsetstrokedashoffset(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_php_ini_scanned_files(CArrRef params) { + FUNCTION_INJECTION(php_ini_scanned_files); + return (f_php_ini_scanned_files()); +} +Variant i_disk_free_space(CArrRef params) { + FUNCTION_INJECTION(disk_free_space); + return (f_disk_free_space(params.rvalAt(0))); +} +Variant i_pixelsetyellowquantum(CArrRef params) { + FUNCTION_INJECTION(pixelsetyellowquantum); + return (f_pixelsetyellowquantum(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_openssl_public_decrypt(CArrRef params) { + FUNCTION_INJECTION(openssl_public_decrypt); + int count = params.size(); + if (count <= 3) return (f_openssl_public_decrypt(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); + return (f_openssl_public_decrypt(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_convert_uuencode(CArrRef params) { + FUNCTION_INJECTION(convert_uuencode); + return (f_convert_uuencode(params.rvalAt(0))); +} +Variant i_magickequalizeimage(CArrRef params) { + FUNCTION_INJECTION(magickequalizeimage); + return (f_magickequalizeimage(params.rvalAt(0))); +} +Variant i_mysql_field_len(CArrRef params) { + FUNCTION_INJECTION(mysql_field_len); + int count = params.size(); + if (count <= 1) return (f_mysql_field_len(params.rvalAt(0))); + return (f_mysql_field_len(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawsetclipunits(CArrRef params) { + FUNCTION_INJECTION(drawsetclipunits); + return (f_drawsetclipunits(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_mdecrypt_generic(CArrRef params) { + FUNCTION_INJECTION(mdecrypt_generic); + return (f_mdecrypt_generic(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fb_config_coredump(CArrRef params) { + FUNCTION_INJECTION(fb_config_coredump); + return (f_fb_config_coredump(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_getprotobyname(CArrRef params) { + FUNCTION_INJECTION(getprotobyname); + return (f_getprotobyname(params.rvalAt(0))); +} +Variant i_xmlwriter_start_pi(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_pi); + return (f_xmlwriter_start_pi(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mysql_field_type(CArrRef params) { + FUNCTION_INJECTION(mysql_field_type); + int count = params.size(); + if (count <= 1) return (f_mysql_field_type(params.rvalAt(0))); + return (f_mysql_field_type(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_apc_cas(CArrRef params) { + FUNCTION_INJECTION(apc_cas); + int count = params.size(); + if (count <= 3) return (f_apc_cas(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_apc_cas(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_getopt(CArrRef params) { + FUNCTION_INJECTION(getopt); + int count = params.size(); + if (count <= 1) return (f_getopt(params.rvalAt(0))); + return (f_getopt(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_clearpixelwand(CArrRef params) { + FUNCTION_INJECTION(clearpixelwand); + return (f_clearpixelwand(params.rvalAt(0)), null); +} +Variant i_drawsetgravity(CArrRef params) { + FUNCTION_INJECTION(drawsetgravity); + return (f_drawsetgravity(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_magickgetimagecompressionquality(CArrRef params) { + FUNCTION_INJECTION(magickgetimagecompressionquality); + return (f_magickgetimagecompressionquality(params.rvalAt(0))); +} +Variant i_magickquantizeimages(CArrRef params) { + FUNCTION_INJECTION(magickquantizeimages); + return (f_magickquantizeimages(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_mysql_insert_id(CArrRef params) { + FUNCTION_INJECTION(mysql_insert_id); + int count = params.size(); + if (count <= 0) return (f_mysql_insert_id()); + return (f_mysql_insert_id(params.rvalAt(0))); +} +Variant i_hphp_thread_set_warmup_enabled(CArrRef params) { + FUNCTION_INJECTION(hphp_thread_set_warmup_enabled); + return (f_hphp_thread_set_warmup_enabled(), null); +} +Variant i_stream_context_set_param(CArrRef params) { + FUNCTION_INJECTION(stream_context_set_param); + return (f_stream_context_set_param(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawpathlinetohorizontalabsolute(CArrRef params) { + FUNCTION_INJECTION(drawpathlinetohorizontalabsolute); + return (f_drawpathlinetohorizontalabsolute(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_openssl_csr_export(CArrRef params) { + FUNCTION_INJECTION(openssl_csr_export); + int count = params.size(); + if (count <= 2) return (f_openssl_csr_export(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_openssl_csr_export(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); +} +Variant i_socket_connect(CArrRef params) { + FUNCTION_INJECTION(socket_connect); + int count = params.size(); + if (count <= 2) return (f_socket_connect(params.rvalAt(0), params.rvalAt(1))); + return (f_socket_connect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_stripslashes(CArrRef params) { + FUNCTION_INJECTION(stripslashes); + return (f_stripslashes(params.rvalAt(0))); +} +Variant i_magickhaspreviousimage(CArrRef params) { + FUNCTION_INJECTION(magickhaspreviousimage); + return (f_magickhaspreviousimage(params.rvalAt(0))); +} +Variant i_drawgetstrokecolor(CArrRef params) { + FUNCTION_INJECTION(drawgetstrokecolor); + return (f_drawgetstrokecolor(params.rvalAt(0))); +} +Variant i_imagecreatefromwbmp(CArrRef params) { + FUNCTION_INJECTION(imagecreatefromwbmp); + return (f_imagecreatefromwbmp(params.rvalAt(0))); +} +Variant i_str_repeat(CArrRef params) { + FUNCTION_INJECTION(str_repeat); + return (f_str_repeat(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_stream_resolve_include_path(CArrRef params) { + FUNCTION_INJECTION(stream_resolve_include_path); + int count = params.size(); + if (count <= 1) return (f_stream_resolve_include_path(params.rvalAt(0))); + return (f_stream_resolve_include_path(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_read(CArrRef params) { + FUNCTION_INJECTION(ldap_read); + int count = params.size(); + if (count <= 3) return (f_ldap_read(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_ldap_read(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_ldap_read(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_ldap_read(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + if (count == 7) return (f_ldap_read(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); + return (f_ldap_read(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); +} +Variant i_apc_dec(CArrRef params) { + FUNCTION_INJECTION(apc_dec); + int count = params.size(); + if (count <= 1) return (f_apc_dec(params.rvalAt(0))); + if (count == 2) return (f_apc_dec(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_apc_dec(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + return (f_apc_dec(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); +} +Variant i_posix_get_last_error(CArrRef params) { + FUNCTION_INJECTION(posix_get_last_error); + return (f_posix_get_last_error()); +} +Variant i_iptcparse(CArrRef params) { + FUNCTION_INJECTION(iptcparse); + return (f_iptcparse(params.rvalAt(0))); +} +Variant i_curl_setopt_array(CArrRef params) { + FUNCTION_INJECTION(curl_setopt_array); + return (f_curl_setopt_array(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_socket_recvfrom(CArrRef params) { + FUNCTION_INJECTION(socket_recvfrom); + int count = params.size(); + if (count <= 5) return (f_socket_recvfrom(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3), ref(const_cast(params).lvalAt(4)))); + return (f_socket_recvfrom(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3), ref(const_cast(params).lvalAt(4)), ref(const_cast(params).lvalAt(5)))); +} +Variant i_imagepstext(CArrRef params) { + FUNCTION_INJECTION(imagepstext); + int count = params.size(); + if (count <= 8) return (f_imagepstext(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); + if (count == 9) return (f_imagepstext(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8))); + if (count == 10) return (f_imagepstext(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9))); + if (count == 11) return (f_imagepstext(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10))); + return (f_imagepstext(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9), params.rvalAt(10), params.rvalAt(11))); +} +Variant i_mb_encode_mimeheader(CArrRef params) { + FUNCTION_INJECTION(mb_encode_mimeheader); + int count = params.size(); + if (count <= 1) return (f_mb_encode_mimeheader(params.rvalAt(0))); + if (count == 2) return (f_mb_encode_mimeheader(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_mb_encode_mimeheader(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_mb_encode_mimeheader(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_mb_encode_mimeheader(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_socket_getsockname(CArrRef params) { + FUNCTION_INJECTION(socket_getsockname); + int count = params.size(); + if (count <= 2) return (f_socket_getsockname(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_socket_getsockname(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); +} +Variant i_imagecreatefromstring(CArrRef params) { + FUNCTION_INJECTION(imagecreatefromstring); + return (f_imagecreatefromstring(params.rvalAt(0))); +} +Variant i_vfprintf(CArrRef params) { + FUNCTION_INJECTION(vfprintf); + return (f_vfprintf(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickcompareimages(CArrRef params) { + FUNCTION_INJECTION(magickcompareimages); + int count = params.size(); + if (count <= 3) return (f_magickcompareimages(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickcompareimages(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_fscanf(CArrRef params) { + FUNCTION_INJECTION(fscanf); + int count = params.size(); + if (count <= 2) return (f_fscanf(count, params.rvalAt(0), params.rvalAt(1))); + return (f_fscanf(count,params.rvalAt(0), params.rvalAt(1), params.slice(2, count - 2, false))); +} +Variant i_stristr(CArrRef params) { + FUNCTION_INJECTION(stristr); + return (f_stristr(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xml_parser_set_option(CArrRef params) { + FUNCTION_INJECTION(xml_parser_set_option); + return (f_xml_parser_set_option(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magicksetimageinterlacescheme(CArrRef params) { + FUNCTION_INJECTION(magicksetimageinterlacescheme); + return (f_magicksetimageinterlacescheme(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_destroypixeliterator(CArrRef params) { + FUNCTION_INJECTION(destroypixeliterator); + return (f_destroypixeliterator(params.rvalAt(0)), null); +} +Variant i_magicksetimagetype(CArrRef params) { + FUNCTION_INJECTION(magicksetimagetype); + return (f_magicksetimagetype(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_date_sunrise(CArrRef params) { + FUNCTION_INJECTION(date_sunrise); + int count = params.size(); + if (count <= 1) return (f_date_sunrise(params.rvalAt(0))); + if (count == 2) return (f_date_sunrise(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_date_sunrise(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_date_sunrise(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_date_sunrise(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_date_sunrise(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_magickgethomeurl(CArrRef params) { + FUNCTION_INJECTION(magickgethomeurl); + return (f_magickgethomeurl()); +} +Variant i_mb_detect_encoding(CArrRef params) { + FUNCTION_INJECTION(mb_detect_encoding); + int count = params.size(); + if (count <= 1) return (f_mb_detect_encoding(params.rvalAt(0))); + if (count == 2) return (f_mb_detect_encoding(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_detect_encoding(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_wandhasexception(CArrRef params) { + FUNCTION_INJECTION(wandhasexception); + return (f_wandhasexception(params.rvalAt(0))); +} +Variant i_error_reporting(CArrRef params) { + FUNCTION_INJECTION(error_reporting); + int count = params.size(); + if (count <= 0) return (f_error_reporting()); + return (f_error_reporting(params.rvalAt(0))); +} +Variant i_imagepalettecopy(CArrRef params) { + FUNCTION_INJECTION(imagepalettecopy); + return (f_imagepalettecopy(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_rename_function(CArrRef params) { + FUNCTION_INJECTION(rename_function); + return (f_rename_function(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_gzcompress(CArrRef params) { + FUNCTION_INJECTION(gzcompress); + int count = params.size(); + if (count <= 1) return (f_gzcompress(params.rvalAt(0))); + return (f_gzcompress(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_gzeof(CArrRef params) { + FUNCTION_INJECTION(gzeof); + return (f_gzeof(params.rvalAt(0))); +} +Variant i_bcadd(CArrRef params) { + FUNCTION_INJECTION(bcadd); + int count = params.size(); + if (count <= 2) return (f_bcadd(params.rvalAt(0), params.rvalAt(1))); + return (f_bcadd(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_curl_setopt(CArrRef params) { + FUNCTION_INJECTION(curl_setopt); + return (f_curl_setopt(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagealphablending(CArrRef params) { + FUNCTION_INJECTION(imagealphablending); + return (f_imagealphablending(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pixelgetmagenta(CArrRef params) { + FUNCTION_INJECTION(pixelgetmagenta); + return (f_pixelgetmagenta(params.rvalAt(0))); +} +Variant i_drawannotation(CArrRef params) { + FUNCTION_INJECTION(drawannotation); + return (f_drawannotation(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); +} +Variant i_getmypid(CArrRef params) { + FUNCTION_INJECTION(getmypid); + return (f_getmypid()); +} +Variant i_magicksetimagedispose(CArrRef params) { + FUNCTION_INJECTION(magicksetimagedispose); + return (f_magicksetimagedispose(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawsetfontsize(CArrRef params) { + FUNCTION_INJECTION(drawsetfontsize); + return (f_drawsetfontsize(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_gethostbyname(CArrRef params) { + FUNCTION_INJECTION(gethostbyname); + return (f_gethostbyname(params.rvalAt(0))); +} +Variant i_stream_wrapper_restore(CArrRef params) { + FUNCTION_INJECTION(stream_wrapper_restore); + return (f_stream_wrapper_restore(params.rvalAt(0))); +} +Variant i_magickgetimagecompression(CArrRef params) { + FUNCTION_INJECTION(magickgetimagecompression); + return (f_magickgetimagecompression(params.rvalAt(0))); +} +Variant i_hphp_invoke_method(CArrRef params) { + FUNCTION_INJECTION(hphp_invoke_method); + return (f_hphp_invoke_method(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_date_offset_get(CArrRef params) { + FUNCTION_INJECTION(date_offset_get); + return (f_date_offset_get(params.rvalAt(0))); +} +Variant i_pixelgetiteratorexception(CArrRef params) { + FUNCTION_INJECTION(pixelgetiteratorexception); + return (f_pixelgetiteratorexception(params.rvalAt(0))); +} +Variant i_mysql_field_flags(CArrRef params) { + FUNCTION_INJECTION(mysql_field_flags); + int count = params.size(); + if (count <= 1) return (f_mysql_field_flags(params.rvalAt(0))); + return (f_mysql_field_flags(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_linkinfo(CArrRef params) { + FUNCTION_INJECTION(linkinfo); + return (f_linkinfo(params.rvalAt(0))); +} +Variant i_strchr(CArrRef params) { + FUNCTION_INJECTION(strchr); + return (f_strchr(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickqueryformats(CArrRef params) { + FUNCTION_INJECTION(magickqueryformats); + return (f_magickqueryformats(params.rvalAt(0))); +} +Variant i_date_time_set(CArrRef params) { + FUNCTION_INJECTION(date_time_set); + int count = params.size(); + if (count <= 3) return (f_date_time_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); + return (f_date_time_set(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3)), null); +} +Variant i_iconv_strpos(CArrRef params) { + FUNCTION_INJECTION(iconv_strpos); + int count = params.size(); + if (count <= 2) return (f_iconv_strpos(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_iconv_strpos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_iconv_strpos(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_i18n_loc_set_strength(CArrRef params) { + FUNCTION_INJECTION(i18n_loc_set_strength); + return (f_i18n_loc_set_strength(params.rvalAt(0))); +} +Variant i_magickgetimagebordercolor(CArrRef params) { + FUNCTION_INJECTION(magickgetimagebordercolor); + return (f_magickgetimagebordercolor(params.rvalAt(0))); +} +Variant i_ob_end_clean(CArrRef params) { + FUNCTION_INJECTION(ob_end_clean); + return (f_ob_end_clean()); +} +Variant i_trigger_error(CArrRef params) { + FUNCTION_INJECTION(trigger_error); + int count = params.size(); + if (count <= 1) return (f_trigger_error(params.rvalAt(0))); + return (f_trigger_error(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pcntl_getpriority(CArrRef params) { + FUNCTION_INJECTION(pcntl_getpriority); + int count = params.size(); + if (count <= 0) return (f_pcntl_getpriority()); + if (count == 1) return (f_pcntl_getpriority(params.rvalAt(0))); + return (f_pcntl_getpriority(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_date_default_timezone_get(CArrRef params) { + FUNCTION_INJECTION(date_default_timezone_get); + return (f_date_default_timezone_get()); +} +Variant i_strcmp(CArrRef params) { + FUNCTION_INJECTION(strcmp); + return (f_strcmp(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hphp_instanceof(CArrRef params) { + FUNCTION_INJECTION(hphp_instanceof); + return (f_hphp_instanceof(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_import_request_variables(CArrRef params) { + FUNCTION_INJECTION(import_request_variables); + int count = params.size(); + if (count <= 1) return (f_import_request_variables(params.rvalAt(0))); + return (f_import_request_variables(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetpackagename(CArrRef params) { + FUNCTION_INJECTION(magickgetpackagename); + return (f_magickgetpackagename()); +} +Variant i_destroypixelwandarray(CArrRef params) { + FUNCTION_INJECTION(destroypixelwandarray); + return (f_destroypixelwandarray(params.rvalAt(0)), null); +} +Variant i_spliti(CArrRef params) { + FUNCTION_INJECTION(spliti); + int count = params.size(); + if (count <= 2) return (f_spliti(params.rvalAt(0), params.rvalAt(1))); + return (f_spliti(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_posix_setgid(CArrRef params) { + FUNCTION_INJECTION(posix_setgid); + return (f_posix_setgid(params.rvalAt(0))); +} +Variant i_is_double(CArrRef params) { + FUNCTION_INJECTION(is_double); + return (f_is_double(params.rvalAt(0))); +} +Variant i_output_reset_rewrite_vars(CArrRef params) { + FUNCTION_INJECTION(output_reset_rewrite_vars); + return (f_output_reset_rewrite_vars()); +} +Variant i_get_declared_interfaces(CArrRef params) { + FUNCTION_INJECTION(get_declared_interfaces); + return (f_get_declared_interfaces()); +} +Variant i_passthru(CArrRef params) { + FUNCTION_INJECTION(passthru); + int count = params.size(); + if (count <= 1) return (f_passthru(params.rvalAt(0)), null); + return (f_passthru(params.rvalAt(0), ref(const_cast(params).lvalAt(1))), null); +} +Variant i_fbml_attr_to_color_11(CArrRef params) { + FUNCTION_INJECTION(fbml_attr_to_color_11); + return (f_fbml_attr_to_color_11(params.rvalAt(0))); +} +Variant i_magickmontageimage(CArrRef params) { + FUNCTION_INJECTION(magickmontageimage); + return (f_magickmontageimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_apc_cache_info(CArrRef params) { + FUNCTION_INJECTION(apc_cache_info); + int count = params.size(); + if (count <= 0) return (f_apc_cache_info()); + if (count == 1) return (f_apc_cache_info(params.rvalAt(0))); + return (f_apc_cache_info(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_convert_cyr_string(CArrRef params) { + FUNCTION_INJECTION(convert_cyr_string); + return (f_convert_cyr_string(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_libxml_get_last_error(CArrRef params) { + FUNCTION_INJECTION(libxml_get_last_error); + return (f_libxml_get_last_error()); +} +Variant i_sys_get_temp_dir(CArrRef params) { + FUNCTION_INJECTION(sys_get_temp_dir); + return (f_sys_get_temp_dir()); +} +Variant i_drawline(CArrRef params) { + FUNCTION_INJECTION(drawline); + return (f_drawline(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4)), null); +} +Variant i_drawsetfillcolor(CArrRef params) { + FUNCTION_INJECTION(drawsetfillcolor); + return (f_drawsetfillcolor(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_gzopen(CArrRef params) { + FUNCTION_INJECTION(gzopen); + int count = params.size(); + if (count <= 2) return (f_gzopen(params.rvalAt(0), params.rvalAt(1))); + return (f_gzopen(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_getservbyport(CArrRef params) { + FUNCTION_INJECTION(getservbyport); + return (f_getservbyport(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_stripcslashes(CArrRef params) { + FUNCTION_INJECTION(stripcslashes); + return (f_stripcslashes(params.rvalAt(0))); +} +Variant i_curl_multi_add_handle(CArrRef params) { + FUNCTION_INJECTION(curl_multi_add_handle); + return (f_curl_multi_add_handle(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_ldap_free_result(CArrRef params) { + FUNCTION_INJECTION(ldap_free_result); + return (f_ldap_free_result(params.rvalAt(0))); +} +Variant i_xmlwriter_end_pi(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_end_pi); + return (f_xmlwriter_end_pi(params.rvalAt(0))); +} +Variant i_imagewbmp(CArrRef params) { + FUNCTION_INJECTION(imagewbmp); + int count = params.size(); + if (count <= 1) return (f_imagewbmp(params.rvalAt(0))); + if (count == 2) return (f_imagewbmp(params.rvalAt(0), params.rvalAt(1))); + return (f_imagewbmp(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_socket_set_nonblock(CArrRef params) { + FUNCTION_INJECTION(socket_set_nonblock); + return (f_socket_set_nonblock(params.rvalAt(0))); +} +Variant i_shm_get_var(CArrRef params) { + FUNCTION_INJECTION(shm_get_var); + return (f_shm_get_var(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetmimetype(CArrRef params) { + FUNCTION_INJECTION(magickgetmimetype); + return (f_magickgetmimetype(params.rvalAt(0))); +} +Variant i_mysql_fetch_assoc(CArrRef params) { + FUNCTION_INJECTION(mysql_fetch_assoc); + return (f_mysql_fetch_assoc(params.rvalAt(0))); +} +Variant i_array_filter(CArrRef params) { + FUNCTION_INJECTION(array_filter); + int count = params.size(); + if (count <= 1) return (f_array_filter(params.rvalAt(0))); + return (f_array_filter(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_mysql_query(CArrRef params) { + FUNCTION_INJECTION(mysql_query); + int count = params.size(); + if (count <= 1) return (f_mysql_query(params.rvalAt(0))); + return (f_mysql_query(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_crypt(CArrRef params) { + FUNCTION_INJECTION(crypt); + int count = params.size(); + if (count <= 1) return (f_crypt(params.rvalAt(0))); + return (f_crypt(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_xmlwriter_start_cdata(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_cdata); + return (f_xmlwriter_start_cdata(params.rvalAt(0))); +} +Variant i_fgetc(CArrRef params) { + FUNCTION_INJECTION(fgetc); + return (f_fgetc(params.rvalAt(0))); +} +Variant i_move_uploaded_file(CArrRef params) { + FUNCTION_INJECTION(move_uploaded_file); + return (f_move_uploaded_file(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_imagecopyresampled(CArrRef params) { + FUNCTION_INJECTION(imagecopyresampled); + return (f_imagecopyresampled(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8), params.rvalAt(9))); +} +Variant i_imagecreatefrompng(CArrRef params) { + FUNCTION_INJECTION(imagecreatefrompng); + return (f_imagecreatefrompng(params.rvalAt(0))); +} +Variant i_magickgetimage(CArrRef params) { + FUNCTION_INJECTION(magickgetimage); + return (f_magickgetimage(params.rvalAt(0))); +} +Variant i_imagesettile(CArrRef params) { + FUNCTION_INJECTION(imagesettile); + return (f_imagesettile(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_fgets(CArrRef params) { + FUNCTION_INJECTION(fgets); + int count = params.size(); + if (count <= 1) return (f_fgets(params.rvalAt(0))); + return (f_fgets(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_tempnam(CArrRef params) { + FUNCTION_INJECTION(tempnam); + return (f_tempnam(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_bcdiv(CArrRef params) { + FUNCTION_INJECTION(bcdiv); + int count = params.size(); + if (count <= 2) return (f_bcdiv(params.rvalAt(0), params.rvalAt(1))); + return (f_bcdiv(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_rsort(CArrRef params) { + FUNCTION_INJECTION(rsort); + int count = params.size(); + if (count <= 1) return (f_rsort(ref(const_cast(params).lvalAt(0)))); + if (count == 2) return (f_rsort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1))); + return (f_rsort(ref(const_cast(params).lvalAt(0)), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawgettextdecoration(CArrRef params) { + FUNCTION_INJECTION(drawgettextdecoration); + return (f_drawgettextdecoration(params.rvalAt(0))); +} +Variant i_strtolower(CArrRef params) { + FUNCTION_INJECTION(strtolower); + return (f_strtolower(params.rvalAt(0))); +} +Variant i_oci_field_name(CArrRef params) { + FUNCTION_INJECTION(oci_field_name); + return (f_oci_field_name(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_posix_getgrgid(CArrRef params) { + FUNCTION_INJECTION(posix_getgrgid); + return (f_posix_getgrgid(params.rvalAt(0))); +} +Variant i_apc_inc(CArrRef params) { + FUNCTION_INJECTION(apc_inc); + int count = params.size(); + if (count <= 1) return (f_apc_inc(params.rvalAt(0))); + if (count == 2) return (f_apc_inc(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_apc_inc(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + return (f_apc_inc(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), params.rvalAt(3))); +} +Variant i_hphp_create_object(CArrRef params) { + FUNCTION_INJECTION(hphp_create_object); + return (f_hphp_create_object(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hexdec(CArrRef params) { + FUNCTION_INJECTION(hexdec); + return (f_hexdec(params.rvalAt(0))); +} +Variant i_imagefttext(CArrRef params) { + FUNCTION_INJECTION(imagefttext); + int count = params.size(); + if (count <= 8) return (f_imagefttext(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7))); + return (f_imagefttext(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7), params.rvalAt(8))); +} +Variant i_xhprof_sample_disable(CArrRef params) { + FUNCTION_INJECTION(xhprof_sample_disable); + return (f_xhprof_sample_disable()); +} +Variant i_ldap_compare(CArrRef params) { + FUNCTION_INJECTION(ldap_compare); + return (f_ldap_compare(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_dns_get_record(CArrRef params) { + FUNCTION_INJECTION(dns_get_record); + int count = params.size(); + if (count <= 1) return (f_dns_get_record(params.rvalAt(0))); + if (count == 2) return (f_dns_get_record(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_dns_get_record(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)))); + return (f_dns_get_record(params.rvalAt(0), params.rvalAt(1), ref(const_cast(params).lvalAt(2)), ref(const_cast(params).lvalAt(3)))); +} +Variant i_openssl_get_privatekey(CArrRef params) { + FUNCTION_INJECTION(openssl_get_privatekey); + int count = params.size(); + if (count <= 1) return (f_openssl_get_privatekey(params.rvalAt(0))); + return (f_openssl_get_privatekey(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_socket_bind(CArrRef params) { + FUNCTION_INJECTION(socket_bind); + int count = params.size(); + if (count <= 2) return (f_socket_bind(params.rvalAt(0), params.rvalAt(1))); + return (f_socket_bind(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagepng(CArrRef params) { + FUNCTION_INJECTION(imagepng); + int count = params.size(); + if (count <= 1) return (f_imagepng(params.rvalAt(0))); + if (count == 2) return (f_imagepng(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_imagepng(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_imagepng(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_getmyuid(CArrRef params) { + FUNCTION_INJECTION(getmyuid); + return (f_getmyuid()); +} +Variant i_pixelgetopacity(CArrRef params) { + FUNCTION_INJECTION(pixelgetopacity); + return (f_pixelgetopacity(params.rvalAt(0))); +} +Variant i_drawsetstrokelinecap(CArrRef params) { + FUNCTION_INJECTION(drawsetstrokelinecap); + return (f_drawsetstrokelinecap(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_xmlwriter_write_attribute_ns(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_write_attribute_ns); + return (f_xmlwriter_write_attribute_ns(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_array_keys(CArrRef params) { + FUNCTION_INJECTION(array_keys); + int count = params.size(); + if (count <= 1) return (f_array_keys(params.rvalAt(0))); + if (count == 2) return (f_array_keys(params.rvalAt(0), params.rvalAt(1))); + return (f_array_keys(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_call_user_method_array(CArrRef params) { + FUNCTION_INJECTION(call_user_method_array); + return (f_call_user_method_array(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); +} +Variant i_magickmagnifyimage(CArrRef params) { + FUNCTION_INJECTION(magickmagnifyimage); + return (f_magickmagnifyimage(params.rvalAt(0))); +} +Variant i_is_bool(CArrRef params) { + FUNCTION_INJECTION(is_bool); + return (f_is_bool(params.rvalAt(0))); +} +Variant i_magickgetimagegreenprimary(CArrRef params) { + FUNCTION_INJECTION(magickgetimagegreenprimary); + return (f_magickgetimagegreenprimary(params.rvalAt(0))); +} +Variant i_filegroup(CArrRef params) { + FUNCTION_INJECTION(filegroup); + return (f_filegroup(params.rvalAt(0))); +} +Variant i_gzread(CArrRef params) { + FUNCTION_INJECTION(gzread); + int count = params.size(); + if (count <= 1) return (f_gzread(params.rvalAt(0))); + return (f_gzread(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawpathellipticarcrelative(CArrRef params) { + FUNCTION_INJECTION(drawpathellipticarcrelative); + return (f_drawpathellipticarcrelative(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6), params.rvalAt(7)), null); +} +Variant i_openssl_csr_export_to_file(CArrRef params) { + FUNCTION_INJECTION(openssl_csr_export_to_file); + int count = params.size(); + if (count <= 2) return (f_openssl_csr_export_to_file(params.rvalAt(0), params.rvalAt(1))); + return (f_openssl_csr_export_to_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_oci_fetch_row(CArrRef params) { + FUNCTION_INJECTION(oci_fetch_row); + return (f_oci_fetch_row(params.rvalAt(0))); +} +Variant i_magicksetimagecolorspace(CArrRef params) { + FUNCTION_INJECTION(magicksetimagecolorspace); + return (f_magicksetimagecolorspace(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_nl_langinfo(CArrRef params) { + FUNCTION_INJECTION(nl_langinfo); + return (f_nl_langinfo(params.rvalAt(0))); +} +Variant i_hphp_get_stats(CArrRef params) { + FUNCTION_INJECTION(hphp_get_stats); + return (f_hphp_get_stats(params.rvalAt(0))); +} +Variant i_strncmp(CArrRef params) { + FUNCTION_INJECTION(strncmp); + return (f_strncmp(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_mb_regex_set_options(CArrRef params) { + FUNCTION_INJECTION(mb_regex_set_options); + int count = params.size(); + if (count <= 0) return (f_mb_regex_set_options()); + return (f_mb_regex_set_options(params.rvalAt(0))); +} +Variant i_pixelsetmagenta(CArrRef params) { + FUNCTION_INJECTION(pixelsetmagenta); + return (f_pixelsetmagenta(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_magickdeconstructimages(CArrRef params) { + FUNCTION_INJECTION(magickdeconstructimages); + return (f_magickdeconstructimages(params.rvalAt(0))); +} +Variant i_xbox_task_status(CArrRef params) { + FUNCTION_INJECTION(xbox_task_status); + return (f_xbox_task_status(params.rvalAt(0))); +} +Variant i_openssl_open(CArrRef params) { + FUNCTION_INJECTION(openssl_open); + return (f_openssl_open(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_apc_bin_load(CArrRef params) { + FUNCTION_INJECTION(apc_bin_load); + int count = params.size(); + if (count <= 1) return (f_apc_bin_load(params.rvalAt(0))); + if (count == 2) return (f_apc_bin_load(params.rvalAt(0), params.rvalAt(1))); + return (f_apc_bin_load(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_current(CArrRef params) { + FUNCTION_INJECTION(current); + return (f_current(ref(const_cast(params).lvalAt(0)))); +} +Variant i_stream_register_wrapper(CArrRef params) { + FUNCTION_INJECTION(stream_register_wrapper); + return (f_stream_register_wrapper(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_hphp_stats(CArrRef params) { + FUNCTION_INJECTION(hphp_stats); + return (f_hphp_stats(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_opendir(CArrRef params) { + FUNCTION_INJECTION(opendir); + int count = params.size(); + if (count <= 1) return (f_opendir(params.rvalAt(0))); + return (f_opendir(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magickgetexceptionstring(CArrRef params) { + FUNCTION_INJECTION(magickgetexceptionstring); + return (f_magickgetexceptionstring(params.rvalAt(0))); +} +Variant i_mcrypt_module_is_block_algorithm_mode(CArrRef params) { + FUNCTION_INJECTION(mcrypt_module_is_block_algorithm_mode); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_is_block_algorithm_mode(params.rvalAt(0))); + return (f_mcrypt_module_is_block_algorithm_mode(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_posix_setpgid(CArrRef params) { + FUNCTION_INJECTION(posix_setpgid); + return (f_posix_setpgid(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_dns_get_mx(CArrRef params) { + FUNCTION_INJECTION(dns_get_mx); + int count = params.size(); + if (count <= 2) return (f_dns_get_mx(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + return (f_dns_get_mx(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), ref(const_cast(params).lvalAt(2)))); +} +Variant i_escapeshellarg(CArrRef params) { + FUNCTION_INJECTION(escapeshellarg); + return (f_escapeshellarg(params.rvalAt(0))); +} +Variant i_headers_list(CArrRef params) { + FUNCTION_INJECTION(headers_list); + return (f_headers_list()); +} +Variant i_is_scalar(CArrRef params) { + FUNCTION_INJECTION(is_scalar); + return (f_is_scalar(params.rvalAt(0))); +} +Variant i_acos(CArrRef params) { + FUNCTION_INJECTION(acos); + return (f_acos(params.rvalAt(0))); +} +Variant i_oci_internal_debug(CArrRef params) { + FUNCTION_INJECTION(oci_internal_debug); + return (f_oci_internal_debug(params.rvalAt(0)), null); +} +Variant i_drawgettextencoding(CArrRef params) { + FUNCTION_INJECTION(drawgettextencoding); + return (f_drawgettextencoding(params.rvalAt(0))); +} +Variant i_filetype(CArrRef params) { + FUNCTION_INJECTION(filetype); + return (f_filetype(params.rvalAt(0))); +} +Variant i_magicksetresolution(CArrRef params) { + FUNCTION_INJECTION(magicksetresolution); + return (f_magicksetresolution(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_fbml_attr_to_bool_11(CArrRef params) { + FUNCTION_INJECTION(fbml_attr_to_bool_11); + return (f_fbml_attr_to_bool_11(params.rvalAt(0))); +} +Variant i_posix_isatty(CArrRef params) { + FUNCTION_INJECTION(posix_isatty); + return (f_posix_isatty(params.rvalAt(0))); +} +Variant i_escapeshellcmd(CArrRef params) { + FUNCTION_INJECTION(escapeshellcmd); + return (f_escapeshellcmd(params.rvalAt(0))); +} +Variant i_apc_store(CArrRef params) { + FUNCTION_INJECTION(apc_store); + int count = params.size(); + if (count <= 2) return (f_apc_store(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_apc_store(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_apc_store(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_magickresetiterator(CArrRef params) { + FUNCTION_INJECTION(magickresetiterator); + return (f_magickresetiterator(params.rvalAt(0)), null); +} +Variant i_apache_lookup_uri(CArrRef params) { + FUNCTION_INJECTION(apache_lookup_uri); + return (f_apache_lookup_uri(params.rvalAt(0))); +} +Variant i_magickmotionblurimage(CArrRef params) { + FUNCTION_INJECTION(magickmotionblurimage); + return (f_magickmotionblurimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_fbml_parse_opaque_11(CArrRef params) { + FUNCTION_INJECTION(fbml_parse_opaque_11); + int count = params.size(); + if (count <= 3) return (f_fbml_parse_opaque_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_fbml_parse_opaque_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_fbml_parse_opaque_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + if (count == 6) return (f_fbml_parse_opaque_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); + return (f_fbml_parse_opaque_11(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5), params.rvalAt(6))); +} +Variant i_magicksetwandsize(CArrRef params) { + FUNCTION_INJECTION(magicksetwandsize); + return (f_magicksetwandsize(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_number_format(CArrRef params) { + FUNCTION_INJECTION(number_format); + int count = params.size(); + if (count <= 1) return (f_number_format(params.rvalAt(0))); + if (count == 2) return (f_number_format(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_number_format(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_number_format(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_array_reduce(CArrRef params) { + FUNCTION_INJECTION(array_reduce); + int count = params.size(); + if (count <= 2) return (f_array_reduce(params.rvalAt(0), params.rvalAt(1))); + return (f_array_reduce(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_xmlwriter_start_dtd_attlist(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_start_dtd_attlist); + return (f_xmlwriter_start_dtd_attlist(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_constant(CArrRef params) { + FUNCTION_INJECTION(constant); + return (f_constant(params.rvalAt(0))); +} +Variant i_strlen(CArrRef params) { + FUNCTION_INJECTION(strlen); + return (f_strlen(params.rvalAt(0))); +} +Variant i_srand(CArrRef params) { + FUNCTION_INJECTION(srand); + int count = params.size(); + if (count <= 0) return (f_srand(), null); + return (f_srand(params.rvalAt(0)), null); +} +Variant i_mysql_fetch_object(CArrRef params) { + FUNCTION_INJECTION(mysql_fetch_object); + int count = params.size(); + if (count <= 1) return (f_mysql_fetch_object(params.rvalAt(0))); + if (count == 2) return (f_mysql_fetch_object(params.rvalAt(0), params.rvalAt(1))); + return (f_mysql_fetch_object(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawpathlinetoverticalrelative(CArrRef params) { + FUNCTION_INJECTION(drawpathlinetoverticalrelative); + return (f_drawpathlinetoverticalrelative(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_magickminifyimage(CArrRef params) { + FUNCTION_INJECTION(magickminifyimage); + return (f_magickminifyimage(params.rvalAt(0))); +} +Variant i_date_sunset(CArrRef params) { + FUNCTION_INJECTION(date_sunset); + int count = params.size(); + if (count <= 1) return (f_date_sunset(params.rvalAt(0))); + if (count == 2) return (f_date_sunset(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_date_sunset(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_date_sunset(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + if (count == 5) return (f_date_sunset(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); + return (f_date_sunset(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_symlink(CArrRef params) { + FUNCTION_INJECTION(symlink); + return (f_symlink(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_imagesetpixel(CArrRef params) { + FUNCTION_INJECTION(imagesetpixel); + return (f_imagesetpixel(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_split(CArrRef params) { + FUNCTION_INJECTION(split); + int count = params.size(); + if (count <= 2) return (f_split(params.rvalAt(0), params.rvalAt(1))); + return (f_split(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_drawsetfontstyle(CArrRef params) { + FUNCTION_INJECTION(drawsetfontstyle); + return (f_drawsetfontstyle(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_imagecreatefromxbm(CArrRef params) { + FUNCTION_INJECTION(imagecreatefromxbm); + return (f_imagecreatefromxbm(params.rvalAt(0))); +} +Variant i_mysql_db_query(CArrRef params) { + FUNCTION_INJECTION(mysql_db_query); + int count = params.size(); + if (count <= 2) return (f_mysql_db_query(params.rvalAt(0), params.rvalAt(1))); + return (f_mysql_db_query(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_imagecolorclosestalpha(CArrRef params) { + FUNCTION_INJECTION(imagecolorclosestalpha); + return (f_imagecolorclosestalpha(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_gzuncompress(CArrRef params) { + FUNCTION_INJECTION(gzuncompress); + int count = params.size(); + if (count <= 1) return (f_gzuncompress(params.rvalAt(0))); + return (f_gzuncompress(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_is_executable(CArrRef params) { + FUNCTION_INJECTION(is_executable); + return (f_is_executable(params.rvalAt(0))); +} +Variant i_socket_create_listen(CArrRef params) { + FUNCTION_INJECTION(socket_create_listen); + int count = params.size(); + if (count <= 1) return (f_socket_create_listen(params.rvalAt(0))); + return (f_socket_create_listen(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_pixelgetcolorcount(CArrRef params) { + FUNCTION_INJECTION(pixelgetcolorcount); + return (f_pixelgetcolorcount(params.rvalAt(0))); +} +Variant i_magickqueryconfigureoptions(CArrRef params) { + FUNCTION_INJECTION(magickqueryconfigureoptions); + return (f_magickqueryconfigureoptions(params.rvalAt(0))); +} +Variant i_iptcembed(CArrRef params) { + FUNCTION_INJECTION(iptcembed); + int count = params.size(); + if (count <= 2) return (f_iptcembed(params.rvalAt(0), params.rvalAt(1))); + return (f_iptcembed(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_posix_getgrnam(CArrRef params) { + FUNCTION_INJECTION(posix_getgrnam); + return (f_posix_getgrnam(params.rvalAt(0))); +} +Variant i_rtrim(CArrRef params) { + FUNCTION_INJECTION(rtrim); + int count = params.size(); + if (count <= 1) return (f_rtrim(params.rvalAt(0))); + return (f_rtrim(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_print_r(CArrRef params) { + FUNCTION_INJECTION(print_r); + int count = params.size(); + if (count <= 1) return (f_print_r(params.rvalAt(0))); + return (f_print_r(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_drawpathcurvetoquadraticbeziersmoothrelative(CArrRef params) { + FUNCTION_INJECTION(drawpathcurvetoquadraticbeziersmoothrelative); + return (f_drawpathcurvetoquadraticbeziersmoothrelative(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2)), null); +} +Variant i_openssl_pkey_export(CArrRef params) { + FUNCTION_INJECTION(openssl_pkey_export); + int count = params.size(); + if (count <= 2) return (f_openssl_pkey_export(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); + if (count == 3) return (f_openssl_pkey_export(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2))); + return (f_openssl_pkey_export(params.rvalAt(0), ref(const_cast(params).lvalAt(1)), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_abs(CArrRef params) { + FUNCTION_INJECTION(abs); + return (f_abs(params.rvalAt(0))); +} +Variant i_shell_exec(CArrRef params) { + FUNCTION_INJECTION(shell_exec); + return (f_shell_exec(params.rvalAt(0))); +} +Variant i_restore_exception_handler(CArrRef params) { + FUNCTION_INJECTION(restore_exception_handler); + return (f_restore_exception_handler()); +} +Variant i_curl_multi_exec(CArrRef params) { + FUNCTION_INJECTION(curl_multi_exec); + return (f_curl_multi_exec(params.rvalAt(0), ref(const_cast(params).lvalAt(1)))); +} +Variant i_htmlspecialchars(CArrRef params) { + FUNCTION_INJECTION(htmlspecialchars); + int count = params.size(); + if (count <= 1) return (f_htmlspecialchars(params.rvalAt(0))); + if (count == 2) return (f_htmlspecialchars(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_htmlspecialchars(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_htmlspecialchars(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_imagexbm(CArrRef params) { + FUNCTION_INJECTION(imagexbm); + int count = params.size(); + if (count <= 1) return (f_imagexbm(params.rvalAt(0))); + if (count == 2) return (f_imagexbm(params.rvalAt(0), params.rvalAt(1))); + return (f_imagexbm(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickgetreleasedate(CArrRef params) { + FUNCTION_INJECTION(magickgetreleasedate); + return (f_magickgetreleasedate()); +} +Variant i_sem_remove(CArrRef params) { + FUNCTION_INJECTION(sem_remove); + return (f_sem_remove(params.rvalAt(0))); +} +Variant i_imageellipse(CArrRef params) { + FUNCTION_INJECTION(imageellipse); + return (f_imageellipse(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_getprotobynumber(CArrRef params) { + FUNCTION_INJECTION(getprotobynumber); + return (f_getprotobynumber(params.rvalAt(0))); +} +Variant i_pixelsetopacity(CArrRef params) { + FUNCTION_INJECTION(pixelsetopacity); + return (f_pixelsetopacity(params.rvalAt(0), params.rvalAt(1)), null); +} +Variant i_lchgrp(CArrRef params) { + FUNCTION_INJECTION(lchgrp); + return (f_lchgrp(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_simplexml_load_file(CArrRef params) { + FUNCTION_INJECTION(simplexml_load_file); + int count = params.size(); + if (count <= 1) return (f_simplexml_load_file(params.rvalAt(0))); + if (count == 2) return (f_simplexml_load_file(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_simplexml_load_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_simplexml_load_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_simplexml_load_file(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_openssl_pkey_get_details(CArrRef params) { + FUNCTION_INJECTION(openssl_pkey_get_details); + return (f_openssl_pkey_get_details(params.rvalAt(0))); +} +Variant i_imagetypes(CArrRef params) { + FUNCTION_INJECTION(imagetypes); + return (f_imagetypes()); +} +Variant i_gzseek(CArrRef params) { + FUNCTION_INJECTION(gzseek); + int count = params.size(); + if (count <= 2) return (f_gzseek(params.rvalAt(0), params.rvalAt(1))); + return (f_gzseek(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_magickgetmaxtextadvance(CArrRef params) { + FUNCTION_INJECTION(magickgetmaxtextadvance); + int count = params.size(); + if (count <= 3) return (f_magickgetmaxtextadvance(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + return (f_magickgetmaxtextadvance(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); +} +Variant i_func_get_arg(CArrRef params) { + FUNCTION_INJECTION(func_get_arg); + return (f_func_get_arg(params.rvalAt(0))); +} +Variant i_imagefilledrectangle(CArrRef params) { + FUNCTION_INJECTION(imagefilledrectangle); + return (f_imagefilledrectangle(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5))); +} +Variant i_oci_pconnect(CArrRef params) { + FUNCTION_INJECTION(oci_pconnect); + int count = params.size(); + if (count <= 2) return (f_oci_pconnect(params.rvalAt(0), params.rvalAt(1))); + if (count == 3) return (f_oci_pconnect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); + if (count == 4) return (f_oci_pconnect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3))); + return (f_oci_pconnect(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4))); +} +Variant i_drawpushpattern(CArrRef params) { + FUNCTION_INJECTION(drawpushpattern); + return (f_drawpushpattern(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2), params.rvalAt(3), params.rvalAt(4), params.rvalAt(5)), null); +} +Variant i_xmlwriter_set_indent(CArrRef params) { + FUNCTION_INJECTION(xmlwriter_set_indent); + return (f_xmlwriter_set_indent(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_openssl_csr_get_subject(CArrRef params) { + FUNCTION_INJECTION(openssl_csr_get_subject); + int count = params.size(); + if (count <= 1) return (f_openssl_csr_get_subject(params.rvalAt(0))); + return (f_openssl_csr_get_subject(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_is_numeric(CArrRef params) { + FUNCTION_INJECTION(is_numeric); + return (f_is_numeric(params.rvalAt(0))); +} +Variant i_gzdeflate(CArrRef params) { + FUNCTION_INJECTION(gzdeflate); + int count = params.size(); + if (count <= 1) return (f_gzdeflate(params.rvalAt(0))); + return (f_gzdeflate(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_dns_check_record(CArrRef params) { + FUNCTION_INJECTION(dns_check_record); + int count = params.size(); + if (count <= 1) return (f_dns_check_record(params.rvalAt(0))); + return (f_dns_check_record(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_magicknegateimage(CArrRef params) { + FUNCTION_INJECTION(magicknegateimage); + int count = params.size(); + if (count <= 1) return (f_magicknegateimage(params.rvalAt(0))); + if (count == 2) return (f_magicknegateimage(params.rvalAt(0), params.rvalAt(1))); + return (f_magicknegateimage(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_socket_last_error(CArrRef params) { + FUNCTION_INJECTION(socket_last_error); + int count = params.size(); + if (count <= 0) return (f_socket_last_error()); + return (f_socket_last_error(params.rvalAt(0))); +} +Variant i_create_function(CArrRef params) { + FUNCTION_INJECTION(create_function); + return (f_create_function(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_str_split(CArrRef params) { + FUNCTION_INJECTION(str_split); + int count = params.size(); + if (count <= 1) return (f_str_split(params.rvalAt(0))); + return (f_str_split(params.rvalAt(0), params.rvalAt(1))); +} +Variant i_date_parse(CArrRef params) { + FUNCTION_INJECTION(date_parse); + return (f_date_parse(params.rvalAt(0))); +} +Variant i_imagecreatefromxpm(CArrRef params) { + FUNCTION_INJECTION(imagecreatefromxpm); + return (f_imagecreatefromxpm(params.rvalAt(0))); +} +Variant i_mysql_thread_id(CArrRef params) { + FUNCTION_INJECTION(mysql_thread_id); + int count = params.size(); + if (count <= 0) return (f_mysql_thread_id()); + return (f_mysql_thread_id(params.rvalAt(0))); +} +Variant i_mb_encode_numericentity(CArrRef params) { + FUNCTION_INJECTION(mb_encode_numericentity); + int count = params.size(); + if (count <= 2) return (f_mb_encode_numericentity(params.rvalAt(0), params.rvalAt(1))); + return (f_mb_encode_numericentity(params.rvalAt(0), params.rvalAt(1), params.rvalAt(2))); +} +Variant i_fb_call_user_func_array_safe(CArrRef params) { + FUNCTION_INJECTION(fb_call_user_func_array_safe); + return (f_fb_call_user_func_array_safe(params.rvalAt(0), params.rvalAt(1))); +} +Variant invoke_builtin(const char *s, CArrRef params, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 4095) { + case 1: + HASH_INVOKE(0x4F7230DC25F0E001LL, magicknormalizeimage); + break; + case 2: + HASH_INVOKE(0x76C320EDB9B6E002LL, xmlwriter_flush); + break; + case 3: + HASH_INVOKE(0x7E0EC3E131BCA003LL, token_name); + break; + case 5: + HASH_INVOKE(0x20D579E7E4131005LL, imagecolorclosest); + HASH_INVOKE(0x18A0F1EE8E249005LL, msg_send); + break; + case 10: + HASH_INVOKE(0x555D7A3FB939300ALL, apache_setenv); + break; + case 11: + HASH_INVOKE(0x4FDCCE1C7754600BLL, ob_iconv_handler); + break; + case 13: + HASH_INVOKE(0x40FA17130FA7100DLL, openssl_seal); + break; + case 22: + HASH_INVOKE(0x5623A698A728F016LL, getlastmod); + break; + case 24: + HASH_INVOKE(0x4C915E3480E94018LL, mb_substr_count); + break; + case 26: + HASH_INVOKE(0x03834225EBBC101ALL, drawsettextundercolor); + break; + case 32: + HASH_INVOKE(0x583D163A6EB52020LL, oci_result); + break; + case 34: + HASH_INVOKE(0x145D42B2AB55D022LL, drawmatte); + break; + case 35: + HASH_INVOKE(0x35C74650867B7023LL, imagesetpixel); + break; + case 40: + HASH_INVOKE(0x601C5152277AE028LL, readfile); + break; + case 44: + HASH_INVOKE(0x464EB9B1F955202CLL, apc_add); + break; + case 51: + HASH_INVOKE(0x48F35DFD653D7033LL, pclose); + break; + case 54: + HASH_INVOKE(0x32F23F206C394036LL, curl_setopt_array); + break; + case 55: + HASH_INVOKE(0x418D937957ECE037LL, tanh); + break; + case 62: + HASH_INVOKE(0x32E6E5D3CCE3703ELL, magickgetimagewidth); + HASH_INVOKE(0x43461C4D9130103ELL, exit); + HASH_INVOKE(0x67C1ED9B816E503ELL, md5_file); + HASH_INVOKE(0x497E31C70409603ELL, timezone_name_from_abbr); + break; + case 63: + HASH_INVOKE(0x24206A195B9C203FLL, ucfirst); + break; + case 65: + HASH_INVOKE(0x65B39B11F5D7C041LL, array_unique); + break; + case 67: + HASH_INVOKE(0x5ACCF9166CD9D043LL, ftruncate); + break; + case 68: + HASH_INVOKE(0x378A73FF98B60044LL, curl_init); + break; + case 73: + HASH_INVOKE(0x047A8BF04DB51049LL, range); + HASH_INVOKE(0x4282E0231F600049LL, fseek); + break; + case 75: + HASH_INVOKE(0x17CD0E68E778C04BLL, drawsetstrokelinejoin); + HASH_INVOKE(0x6370CF455EA8604BLL, socket_create); + break; + case 76: + HASH_INVOKE(0x03047FD5FC67204CLL, exif_read_data); + break; + case 77: + HASH_INVOKE(0x430441BA393E204DLL, xhp_preprocess_code); + break; + case 83: + HASH_INVOKE(0x15A9EB33DA6E9053LL, getimagesize); + HASH_INVOKE(0x07EB5C3A3BEA3053LL, acosh); + break; + case 86: + HASH_INVOKE(0x4B3A51F6ABAC1056LL, fbml_attr_to_color_11); + break; + case 87: + HASH_INVOKE(0x12B22A2E6B344057LL, ldap_sort); + break; + case 90: + HASH_INVOKE(0x271AB768D202F05ALL, mcrypt_module_is_block_algorithm); + break; + case 92: + HASH_INVOKE(0x2B7532A070BF605CLL, openssl_get_privatekey); + break; + case 95: + HASH_INVOKE(0x4B70746F965E705FLL, preg_last_error); + break; + case 98: + HASH_INVOKE(0x745910AD5C922062LL, magickgetmimetype); + break; + case 100: + HASH_INVOKE(0x5CC8BA5ADFAC0064LL, imagegrabscreen); + break; + case 101: + HASH_INVOKE(0x777FE52584FAE065LL, apc_bin_dump); + break; + case 103: + HASH_INVOKE(0x0CE1918B30DF5067LL, sys_getloadavg); + HASH_INVOKE(0x4512BD5EA7076067LL, openssl_csr_export_to_file); + break; + case 112: + HASH_INVOKE(0x3C466098FF7B5070LL, mb_check_encoding); + break; + case 119: + HASH_INVOKE(0x6FF6A07FA963C077LL, fb_request_timers); + break; + case 120: + HASH_INVOKE(0x6B268C26E21C1078LL, arsort); + break; + case 122: + HASH_INVOKE(0x5F9DDC342A83807ALL, date_default_timezone_get); + break; + case 131: + HASH_INVOKE(0x1A90213EE1A56083LL, array_pop); + break; + case 132: + HASH_INVOKE(0x53FD8C9AC3F4D084LL, dangling_server_proxy_new_request); + break; + case 137: + HASH_INVOKE(0x4AD554CBAB9CC089LL, call_user_method_array); + break; + case 140: + HASH_INVOKE(0x4F1D1ED7B087208CLL, exec); + HASH_INVOKE(0x3A0B58797E8FE08CLL, xml_set_external_entity_ref_handler); + break; + case 141: + HASH_INVOKE(0x200864F8F053C08DLL, magickgetversionstring); + break; + case 142: + HASH_INVOKE(0x3E4AE974AFA9708ELL, pixelsetquantumcolor); + break; + case 145: + HASH_INVOKE(0x3E5CF6378A49C091LL, ldap_get_attributes); + HASH_INVOKE(0x673B36244DC87091LL, closelog); + HASH_INVOKE(0x1C32BB63986C8091LL, socket_strerror); + break; + case 147: + HASH_INVOKE(0x3B5E32078E37A093LL, imagedestroy); + break; + case 158: + HASH_INVOKE(0x4AF87BA91163D09ELL, mysql_db_name); + HASH_INVOKE(0x74F0D6D8F1F2709ELL, drawsetstrokedashoffset); + break; + case 159: + HASH_INVOKE(0x2B130322DEC4B09FLL, pixelgetopacityquantum); + break; + case 161: + HASH_INVOKE(0x0DF945F12533F0A1LL, abs); + break; + case 162: + HASH_INVOKE(0x10DF7941C3F3E0A2LL, socket_bind); + break; + case 163: + HASH_INVOKE(0x54242D2846BC60A3LL, magickunsharpmaskimage); + break; + case 167: + HASH_INVOKE(0x74C787060F7290A7LL, icu_transliterate); + break; + case 168: + HASH_INVOKE(0x6E8C61326DCE40A8LL, var_export); + break; + case 169: + HASH_INVOKE(0x431F4E8713B9D0A9LL, oci_field_scale); + break; + case 171: + HASH_INVOKE(0x439DF153FC32D0ABLL, printf); + HASH_INVOKE(0x5B1D9F56698A40ABLL, html_entity_decode); + break; + case 172: + HASH_INVOKE(0x6E27DC1E74C5B0ACLL, drawpathstart); + break; + case 173: + HASH_INVOKE(0x4C9252FB9C3300ADLL, pixelsetalphaquantum); + break; + case 174: + HASH_INVOKE(0x47AB4A08446BD0AELL, bcmod); + HASH_INVOKE(0x4BBD5D8A6E0110AELL, error_log); + break; + case 175: + HASH_INVOKE(0x3954FFED1E0650AFLL, stream_register_wrapper); + break; + case 176: + HASH_INVOKE(0x5B9F8B3E1D8330B0LL, stream_socket_sendto); + break; + case 178: + HASH_INVOKE(0x48BBFB59FB7F90B2LL, iconv_strlen); + break; + case 184: + HASH_INVOKE(0x05A4C165810A30B8LL, gzread); + break; + case 185: + HASH_INVOKE(0x5C659372B2CD80B9LL, imagecolorstotal); + break; + case 187: + HASH_INVOKE(0x331E7DFBE6E240BBLL, libxml_get_errors); + break; + case 188: + HASH_INVOKE(0x3900350CD9D990BCLL, imagecreatefromjpeg); + break; + case 190: + HASH_INVOKE(0x2E71CD02E4BA50BELL, fb_add_included_file); + break; + case 197: + HASH_INVOKE(0x7424946F7ED520C5LL, magickgetimagefilename); + HASH_INVOKE(0x6B477F3B9CDB10C5LL, base64_decode); + break; + case 199: + HASH_INVOKE(0x677F33E78342A0C7LL, function_exists); + break; + case 200: + HASH_INVOKE(0x30AB38D851C440C8LL, magickgetimagebackgroundcolor); + break; + case 202: + HASH_INVOKE(0x2EE0967F6EB5A0CALL, date_format); + HASH_INVOKE(0x4C67DEE74080E0CALL, magicksetimagecompose); + break; + case 206: + HASH_INVOKE(0x64E390E5F2FDC0CELL, ismagickwand); + break; + case 210: + HASH_INVOKE(0x5365BD7509BE60D2LL, ldap_dn2ufn); + HASH_INVOKE(0x3E4DAD592CD0A0D2LL, magickdescribeimage); + break; + case 213: + HASH_INVOKE(0x3BF44C6DECD790D5LL, xmlwriter_start_dtd_entity); + break; + case 217: + HASH_INVOKE(0x08F6B727D60670D9LL, magicksetimagedepth); + break; + case 219: + HASH_INVOKE(0x3801923AD84670DBLL, apc_inc); + break; + case 224: + HASH_INVOKE(0x2E4612DF112010E0LL, imagecopyresized); + break; + case 228: + HASH_INVOKE(0x2B9425038D4230E4LL, imagecreatefromxpm); + break; + case 231: + HASH_INVOKE(0x79E6FD78989B10E7LL, tmpfile); + HASH_INVOKE(0x59DE3A26AFF570E7LL, magickshaveimage); + break; + case 232: + HASH_INVOKE(0x476F4B6CC987E0E8LL, magickframeimage); + HASH_INVOKE(0x17CB328F55FDF0E8LL, drawsetstrokeantialias); + break; + case 233: + HASH_INVOKE(0x47F8A63A709D70E9LL, oci_new_cursor); + break; + case 234: + HASH_INVOKE(0x53BA3992F8C240EALL, imagegrabwindow); + break; + case 243: + HASH_INVOKE(0x315CCBC8C5C7D0F3LL, xmlwriter_write_raw); + break; + case 249: + HASH_INVOKE(0x480797DB7165A0F9LL, xmlwriter_set_indent); + break; + case 259: + HASH_INVOKE(0x1FFCBCF1927D7103LL, posix_setpgid); + break; + case 261: + HASH_INVOKE(0x71E3372AA1AD0105LL, is_infinite); + HASH_INVOKE(0x509B763CDAD9D105LL, gethostbyaddr); + break; + case 264: + HASH_INVOKE(0x60B8B61133F59108LL, quoted_printable_decode); + break; + case 267: + HASH_INVOKE(0x7DE1BEE0C35D010BLL, pcntl_signal); + break; + case 273: + HASH_INVOKE(0x3A9A5D4FEE79A111LL, getmxrr); + break; + case 274: + HASH_INVOKE(0x0B1BA48B0CFB1112LL, strval); + HASH_INVOKE(0x28C44527BD59D112LL, is_link); + break; + case 276: + HASH_INVOKE(0x02A4724E6A881114LL, mb_decode_numericentity); + break; + case 281: + HASH_INVOKE(0x3AB82455A70F5119LL, imagecolortransparent); + HASH_INVOKE(0x2B31A877824A1119LL, stristr); + break; + case 284: + HASH_INVOKE(0x070A63F6A0B8711CLL, array_walk_recursive); + break; + case 285: + HASH_INVOKE(0x291088666B8BF11DLL, drawsetfontfamily); + break; + case 286: + HASH_INVOKE(0x658444BB4E29E11ELL, openssl_free_key); + break; + case 287: + HASH_INVOKE(0x4C70C24C84F5511FLL, magicksetimagegamma); + break; + case 291: + HASH_INVOKE(0x3669138315204123LL, mcrypt_module_get_algo_key_size); + break; + case 292: + HASH_INVOKE(0x7D4D28D561392124LL, drawsettextalignment); + break; + case 293: + HASH_INVOKE(0x7A8B3EC0235EF125LL, magickprofileimage); + break; + case 301: + HASH_INVOKE(0x7579DBE83CE5812DLL, imagerectangle); + break; + case 305: + HASH_INVOKE(0x6D4F38F96F3BC131LL, fb_config_coredump); + break; + case 307: + HASH_INVOKE(0x6A7E0B15FF689133LL, mb_ereg_search_init); + break; + case 311: + HASH_INVOKE(0x5666016FA3C0F137LL, socket_clear_error); + break; + case 312: + HASH_INVOKE(0x2676902697E37138LL, xmlwriter_start_comment); + break; + case 314: + HASH_INVOKE(0x2A57E5D29D73D13ALL, register_tick_function); + break; + case 315: + HASH_INVOKE(0x1F61AFCDC510413BLL, imagefilter); + break; + case 316: + HASH_INVOKE(0x403F59EEC2B1D13CLL, fbml_render_children_11); + break; + case 320: + HASH_INVOKE(0x7A1E910EF82F0140LL, fb_get_ape_version); + break; + case 323: + HASH_INVOKE(0x296C739F28D6C143LL, drawsetfontsize); + break; + case 326: + HASH_INVOKE(0x422F426D3D0D8146LL, fql_set_static_data_10); + break; + case 335: + HASH_INVOKE(0x61A61E91C477514FLL, chop); + HASH_INVOKE(0x7863294A8F33D14FLL, file); + break; + case 337: + HASH_INVOKE(0x3044E9F91628E151LL, mb_strlen); + break; + case 338: + HASH_INVOKE(0x5D170BCBBBA02152LL, system); + HASH_INVOKE(0x26DD46D8C1F47152LL, ldap_bind); + break; + case 341: + HASH_INVOKE(0x2623917110168155LL, fclose); + HASH_INVOKE(0x4F43FE32079C0155LL, magickgetimagesblob); + break; + case 347: + HASH_INVOKE(0x3711AF36391EA15BLL, mysql_list_tables); + break; + case 348: + HASH_INVOKE(0x6CD7466174B9A15CLL, pixelsetredquantum); + break; + case 353: + HASH_INVOKE(0x309E780586D6C161LL, socket_set_nonblock); + break; + case 355: + HASH_INVOKE(0x36D6B73D289DD163LL, date_sunset); + break; + case 358: + HASH_INVOKE(0x31B6EEAEB42EA166LL, fbml_sanitize_css_11); + break; + case 360: + HASH_INVOKE(0x14E46EA3CBCFB168LL, magickgetsamplingfactors); + break; + case 361: + HASH_INVOKE(0x4983571BFEAE6169LL, magickaffinetransformimage); + HASH_INVOKE(0x1612E331D1726169LL, drawsetstrokecolor); + break; + case 366: + HASH_INVOKE(0x15B61E061268B16ELL, magickenhanceimage); + HASH_INVOKE(0x0125F8B9428E416ELL, hphp_create_object); + break; + case 370: + HASH_INVOKE(0x59FE6A862E1CB172LL, get_browser); + break; + case 372: + HASH_INVOKE(0x345E070844E3F174LL, create_function); + break; + case 377: + HASH_INVOKE(0x6884FAF0D1EF3179LL, posix_mknod); + break; + case 379: + HASH_INVOKE(0x59594143EFC7617BLL, mcrypt_module_open); + break; + case 380: + HASH_INVOKE(0x3E1343B4A3AD717CLL, magickgettextascent); + break; + case 383: + HASH_INVOKE(0x4EF9496D16F9D17FLL, xmlwriter_start_element_ns); + break; + case 385: + HASH_INVOKE(0x1CBD3B58296C8181LL, xmlwriter_write_dtd); + break; + case 386: + HASH_INVOKE(0x7BB7C27B2C118182LL, get_magic_quotes_gpc); + HASH_INVOKE(0x130B62A8C77F3182LL, mb_ereg_search_getregs); + break; + case 389: + HASH_INVOKE(0x13E90F8874839185LL, ob_get_status); + HASH_INVOKE(0x54DB5DC6A069A185LL, hphp_get_class_info); + break; + case 390: + HASH_INVOKE(0x5DB5E45860801186LL, openssl_csr_export); + break; + case 391: + HASH_INVOKE(0x1BC448670BA4E187LL, iconv_strpos); + break; + case 393: + HASH_INVOKE(0x0CC53B2F0D38D189LL, timezone_offset_get); + break; + case 402: + HASH_INVOKE(0x07B5BF934F6EA192LL, imagesettile); + break; + case 407: + HASH_INVOKE(0x15AD9CE061C75197LL, timezone_transitions_get); + break; + case 409: + HASH_INVOKE(0x0CE71BC3B75D8199LL, mb_strimwidth); + break; + case 411: + HASH_INVOKE(0x7FF6C2A693CE119BLL, magickcyclecolormapimage); + HASH_INVOKE(0x74F20C284227219BLL, similar_text); + break; + case 416: + HASH_INVOKE(0x6FB5104FC97A31A0LL, drawpathcurvetorelative); + break; + case 418: + HASH_INVOKE(0x6DFC0765EBAB81A2LL, mcrypt_decrypt); + HASH_INVOKE(0x2A9015499A2EB1A2LL, fnmatch); + HASH_INVOKE(0x615723D21421A1A2LL, sem_remove); + break; + case 419: + HASH_INVOKE(0x735B81C45C2971A3LL, drawgetfillopacity); + break; + case 424: + HASH_INVOKE(0x2691B602BFA8A1A8LL, oci_field_size); + break; + case 425: + HASH_INVOKE(0x740DC7FFAD8BB1A9LL, imagecolorat); + HASH_INVOKE(0x0DDFE3B1F6EEE1A9LL, array_reduce); + break; + case 426: + HASH_INVOKE(0x11A5C66A3D0711AALL, apc_sma_info); + break; + case 429: + HASH_INVOKE(0x5A6EFF8C71A431ADLL, socket_get_status); + HASH_INVOKE(0x50538F37398AF1ADLL, ldap_get_option); + break; + case 431: + HASH_INVOKE(0x5B1F9C2E9FE111AFLL, fb_utf8ize); + break; + case 438: + HASH_INVOKE(0x33BD672B4AC301B6LL, mt_rand); + break; + case 445: + HASH_INVOKE(0x4B3F35310DEA31BDLL, socket_create_pair); + break; + case 447: + HASH_INVOKE(0x0E88ACEB15A581BFLL, magickgetimageextrema); + HASH_INVOKE(0x681CD0E7D9DB71BFLL, pow); + break; + case 450: + HASH_INVOKE(0x02103322F88C71C2LL, pixelgetcolorcount); + break; + case 452: + HASH_INVOKE(0x3617DAE43A23D1C4LL, xml_parser_set_option); + break; + case 455: + HASH_INVOKE(0x5AE12CB1FFDC21C7LL, drawellipse); + break; + case 456: + HASH_INVOKE(0x11C0B5DA066891C8LL, preg_match_all); + break; + case 458: + HASH_INVOKE(0x75CA86838D24A1CALL, hash_algos); + break; + case 460: + HASH_INVOKE(0x3DF488365DAAF1CCLL, drawgettextencoding); + HASH_INVOKE(0x39DA6409D82D11CCLL, fbml_attr_to_bool_11); + break; + case 461: + HASH_INVOKE(0x37340B707E7CD1CDLL, magickgetimagebordercolor); + break; + case 462: + HASH_INVOKE(0x2E7741B5440FB1CELL, magicksetlastiterator); + break; + case 464: + HASH_INVOKE(0x03012F3DDD7AB1D0LL, getservbyport); + break; + case 468: + HASH_INVOKE(0x219F3257BA3371D4LL, decbin); + break; + case 470: + HASH_INVOKE(0x78831282736801D6LL, stream_context_get_default); + break; + case 472: + HASH_INVOKE(0x60E9E392663921D8LL, readlink); + break; + case 473: + HASH_INVOKE(0x7A69D0078F4F31D9LL, ldap_start_tls); + break; + case 474: + HASH_INVOKE(0x0482E069503A91DALL, posix_setgid); + break; + case 475: + HASH_INVOKE(0x3FEBBC0DA79F31DBLL, fb_call_user_func_safe); + break; + case 476: + HASH_INVOKE(0x14FB46333D6D11DCLL, xml_set_default_handler); + HASH_INVOKE(0x5B3A4A72846B21DCLL, current); + break; + case 477: + HASH_INVOKE(0x04666D6F67C7A1DDLL, mysql_list_processes); + HASH_INVOKE(0x03A183D73942B1DDLL, apc_filehits); + break; + case 479: + HASH_INVOKE(0x7403251412E931DFLL, syslog); + break; + case 480: + HASH_INVOKE(0x5932D2750A8A91E0LL, magickgetpackagename); + break; + case 481: + HASH_INVOKE(0x2771C632A60371E1LL, ftok); + HASH_INVOKE(0x0ED729A444C611E1LL, openssl_x509_read); + break; + case 482: + HASH_INVOKE(0x67D4BA8513BF41E2LL, newpixelwand); + break; + case 483: + HASH_INVOKE(0x131D11F79A8801E3LL, mb_http_output); + HASH_INVOKE(0x406BDC51A3FD81E3LL, pcntl_waitpid); + break; + case 484: + HASH_INVOKE(0x08F7A6C37FC7B1E4LL, shm_get_var); + break; + case 488: + HASH_INVOKE(0x7F843353646391E8LL, rad2deg); + break; + case 493: + HASH_INVOKE(0x1B09A9A533FFA1EDLL, drawgetexceptiontype); + break; + case 497: + HASH_INVOKE(0x02BCE5B0FBED61F1LL, strlen); + break; + case 498: + HASH_INVOKE(0x46AFE55982B371F2LL, posix_geteuid); + break; + case 499: + HASH_INVOKE(0x582D10141D5601F3LL, stream_context_set_option); + HASH_INVOKE(0x11BB3CDC5E4971F3LL, xmlwriter_end_pi); + break; + case 501: + HASH_INVOKE(0x542FBDCF960031F5LL, fprintf); + HASH_INVOKE(0x02ABC00C046291F5LL, imageellipse); + break; + case 506: + HASH_INVOKE(0x135D5CBF936B11FALL, msg_receive); + break; + case 509: + HASH_INVOKE(0x5304E6B47ED0B1FDLL, srand); + break; + case 514: + HASH_INVOKE(0x16699E33370A8202LL, idn_to_unicode); + break; + case 515: + HASH_INVOKE(0x5B3C354575BB8203LL, mysql_free_result); + break; + case 520: + HASH_INVOKE(0x7B525920E026C208LL, gztell); + break; + case 524: + HASH_INVOKE(0x41B15671649A320CLL, curl_multi_getcontent); + HASH_INVOKE(0x257BEA4D6DC9920CLL, ctype_alnum); + break; + case 525: + HASH_INVOKE(0x5C0DECC8CC67E20DLL, magickwriteimagesfile); + break; + case 526: + HASH_INVOKE(0x533642044A00520ELL, pixelgetmagentaquantum); + break; + case 527: + HASH_INVOKE(0x08DC8BF3ADAE520FLL, getallheaders); + HASH_INVOKE(0x53631CF3A937320FLL, get_class_methods); + break; + case 528: + HASH_INVOKE(0x15EF510022CAF210LL, xml_parser_create_ns); + HASH_INVOKE(0x2D41D7F8F4113210LL, sinh); + break; + case 529: + HASH_INVOKE(0x438CD1A0327A8211LL, apc_define_constants); + break; + case 532: + HASH_INVOKE(0x7D85E9FACB92D214LL, magickgetimageblob); + break; + case 536: + HASH_INVOKE(0x56C95225813A5218LL, memory_get_usage); + break; + case 538: + HASH_INVOKE(0x72C0C89D897E721ALL, magicksetimagetype); + break; + case 539: + HASH_INVOKE(0x3A90CC67D58A021BLL, hash_hmac_file); + break; + case 545: + HASH_INVOKE(0x345E2BAE171FA221LL, date_sunrise); + break; + case 546: + HASH_INVOKE(0x39E4E0175FADC222LL, drawskewx); + break; + case 551: + HASH_INVOKE(0x5A26F00A81BA5227LL, xmlwriter_start_attribute_ns); + break; + case 552: + HASH_INVOKE(0x44911AEE34D63228LL, time_sleep_until); + break; + case 556: + HASH_INVOKE(0x4129FFBF3548E22CLL, mb_strpos); + break; + case 561: + HASH_INVOKE(0x61A192D10C004231LL, magickconvolveimage); + HASH_INVOKE(0x7C07D66F70E43231LL, mailparse_determine_best_xfer_encoding); + break; + case 564: + HASH_INVOKE(0x422C51C95928A234LL, str_replace); + break; + case 566: + HASH_INVOKE(0x5542AABF33A2F236LL, stream_filter_remove); + break; + case 568: + HASH_INVOKE(0x695AC59F79E2A238LL, mb_encode_mimeheader); + break; + case 570: + HASH_INVOKE(0x679ABBE5A08C523ALL, xml_parse_into_struct); + break; + case 574: + HASH_INVOKE(0x5E54CE856B78223ELL, array_flip); + break; + case 576: + HASH_INVOKE(0x0DB9DD4AE24B0240LL, base64_encode); + break; + case 579: + HASH_INVOKE(0x78183A24F2ACB243LL, strtotime); + break; + case 584: + HASH_INVOKE(0x7071BB6F0591E248LL, serialize); + break; + case 591: + HASH_INVOKE(0x1D8FE8E68F7EA24FLL, pixelsetiteratorrow); + break; + case 592: + HASH_INVOKE(0x30747B708DA1D250LL, pushdrawingwand); + break; + case 598: + HASH_INVOKE(0x0384346A8857D256LL, clonemagickwand); + break; + case 603: + HASH_INVOKE(0x2F8F40E95EDF925BLL, sizeof); + break; + case 605: + HASH_INVOKE(0x7E6024E53AEEE25DLL, apc_delete); + break; + case 608: + HASH_INVOKE(0x71D2D4757B7E4260LL, apache_request_headers); + break; + case 609: + HASH_INVOKE(0x383800902035F261LL, apache_child_terminate); + HASH_INVOKE(0x48305E8ABB8BC261LL, hphp_instanceof); + break; + case 610: + HASH_INVOKE(0x63AC0EED6D946262LL, pcntl_fork); + break; + case 612: + HASH_INVOKE(0x261F403C4174D264LL, posix_getsid); + break; + case 613: + HASH_INVOKE(0x561DB8F1DC0BC265LL, magickseparateimagechannel); + break; + case 615: + HASH_INVOKE(0x50C5488E19492267LL, mb_list_encodings_alias_names); + HASH_INVOKE(0x38B376B9D9091267LL, xmlwriter_write_attribute); + break; + case 620: + HASH_INVOKE(0x188DF1EB5FD1B26CLL, mailparse_msg_parse_file); + break; + case 622: + HASH_INVOKE(0x5672949384A4F26ELL, stream_filter_register); + break; + case 626: + HASH_INVOKE(0x1C65F32FF28BC272LL, pathinfo); + break; + case 627: + HASH_INVOKE(0x61C991F216E85273LL, inet_ntop); + break; + case 634: + HASH_INVOKE(0x39E05F957C7DD27ALL, magickgetimagedepth); + break; + case 636: + HASH_INVOKE(0x0F7E33D551E0727CLL, posix_getpid); + break; + case 637: + HASH_INVOKE(0x7DB57C59E607627DLL, mcrypt_generic_deinit); + break; + case 638: + HASH_INVOKE(0x4111669F4862E27ELL, drawpathlinetoverticalrelative); + break; + case 639: + HASH_INVOKE(0x5B94A6962F1EC27FLL, magickechoimagesblob); + HASH_INVOKE(0x57E8781CF111727FLL, fileowner); + break; + case 641: + HASH_INVOKE(0x1765A2E5186DE281LL, socket_write); + HASH_INVOKE(0x0881440DCF5D3281LL, magickflattenimages); + break; + case 643: + HASH_INVOKE(0x4C83B098C8BDA283LL, posix_setsid); + break; + case 645: + HASH_INVOKE(0x5F7DC3612050A285LL, drawsetfontweight); + HASH_INVOKE(0x1A895A2307126285LL, openssl_pkcs7_decrypt); + break; + case 646: + HASH_INVOKE(0x3A2E2C40B019E286LL, is_a); + HASH_INVOKE(0x4F028FA6AAEEC286LL, call_user_method); + break; + case 647: + HASH_INVOKE(0x27698DDEDAD6E287LL, openssl_pkey_new); + break; + case 656: + HASH_INVOKE(0x04C11602C720A290LL, convert_cyr_string); + break; + case 660: + HASH_INVOKE(0x4D05DD57E4052294LL, xmlwriter_output_memory); + break; + case 661: + HASH_INVOKE(0x69868C648BC12295LL, apc_store); + break; + case 665: + HASH_INVOKE(0x22D380E06E67E299LL, stream_encoding); + break; + case 666: + HASH_INVOKE(0x68272A37CC9E729ALL, mb_strtolower); + break; + case 667: + HASH_INVOKE(0x4A09634AE6DFF29BLL, fileperms); + break; + case 668: + HASH_INVOKE(0x0F71D3E47044E29CLL, drawpathcurvetosmoothrelative); + break; + case 675: + HASH_INVOKE(0x10E7B5A0E29CF2A3LL, bcscale); + HASH_INVOKE(0x743EA4BF2CC8F2A3LL, mysql_field_type); + break; + case 678: + HASH_INVOKE(0x73EF3A19F76872A6LL, iconv_strrpos); + break; + case 680: + HASH_INVOKE(0x5409127FEDE332A8LL, exif_imagetype); + break; + case 685: + HASH_INVOKE(0x35D259398CDDA2ADLL, pixelgetredquantum); + HASH_INVOKE(0x00AB6FC4E9EE62ADLL, imagefilledrectangle); + break; + case 686: + HASH_INVOKE(0x36AB9E6AA687F2AELL, xmlwriter_start_dtd_element); + break; + case 691: + HASH_INVOKE(0x44530C37F2B522B3LL, drawgetstrokedasharray); + HASH_INVOKE(0x59BB7B8078AC22B3LL, tempnam); + break; + case 694: + HASH_INVOKE(0x0C4B98B47B0862B6LL, apd_echo); + HASH_INVOKE(0x0E9C9B409F94B2B6LL, setcookie); + break; + case 696: + HASH_INVOKE(0x3C6D50F3BB8102B8LL, next); + break; + case 698: + HASH_INVOKE(0x4A3D2113D3DFD2BALL, newpixelwandarray); + break; + case 700: + HASH_INVOKE(0x33E08846F3EB42BCLL, ldap_get_values); + HASH_INVOKE(0x41F7E2214DDE12BCLL, mcrypt_enc_self_test); + break; + case 701: + HASH_INVOKE(0x327C865E52FD12BDLL, ldap_get_values_len); + break; + case 702: + HASH_INVOKE(0x72D6F9B3661AB2BELL, magickgetimage); + break; + case 704: + HASH_INVOKE(0x5B7C1B74BA3452C0LL, newpixelregioniterator); + break; + case 707: + HASH_INVOKE(0x446D76A95365D2C3LL, pixelgetyellow); + break; + case 708: + HASH_INVOKE(0x6018C9F7DF40C2C4LL, xml_get_current_column_number); + break; + case 716: + HASH_INVOKE(0x407EF03C23BF92CCLL, drawpathellipticarcabsolute); + HASH_INVOKE(0x44273F8BA3F542CCLL, imagesx); + break; + case 718: + HASH_INVOKE(0x1922D51F3E1522CELL, xmlwriter_end_dtd_attlist); + break; + case 719: + HASH_INVOKE(0x4ACE27EC476632CFLL, apc_bin_dumpfile); + break; + case 722: + HASH_INVOKE(0x4D9A87BD0CF742D2LL, imagepsextendfont); + break; + case 725: + HASH_INVOKE(0x4D04C580CF9212D5LL, posix_getgroups); + break; + case 728: + HASH_INVOKE(0x56C4896BA2FF52D8LL, drawsetstrokeopacity); + break; + case 730: + HASH_INVOKE(0x5C6A85B448C352DALL, posix_uname); + break; + case 738: + HASH_INVOKE(0x4AEC19D75BF652E2LL, magickremoveimage); + break; + case 739: + HASH_INVOKE(0x45382D0BA5B262E3LL, mysql_get_proto_info); + break; + case 749: + HASH_INVOKE(0x215E0E2EFA7422EDLL, drawgetstrokeantialias); + break; + case 750: + HASH_INVOKE(0x2884B7B3252B02EELL, imagealphablending); + break; + case 752: + HASH_INVOKE(0x25CA0794823AA2F0LL, openssl_csr_get_public_key); + break; + case 754: + HASH_INVOKE(0x2EE56D216BB832F2LL, time_nanosleep); + break; + case 756: + HASH_INVOKE(0x418EC805C5FD32F4LL, mcrypt_get_key_size); + break; + case 761: + HASH_INVOKE(0x00CFD56391DF82F9LL, mysql_data_seek); + HASH_INVOKE(0x319EF52B36AAB2F9LL, posix_isatty); + break; + case 763: + HASH_INVOKE(0x4D393D30CE1112FBLL, drawpathmovetoabsolute); + break; + case 764: + HASH_INVOKE(0x66D59E4DBC7382FCLL, drawscale); + break; + case 766: + HASH_INVOKE(0x208B66A8731F72FELL, sem_get); + HASH_INVOKE(0x755A9950B65472FELL, drawgetgravity); + break; + case 770: + HASH_INVOKE(0x0103FE1E2C307302LL, socket_recvfrom); + break; + case 773: + HASH_INVOKE(0x65D40C6B4842F305LL, clearpixelwand); + break; + case 774: + HASH_INVOKE(0x689D60184DD81306LL, htmlspecialchars_decode); + break; + case 777: + HASH_INVOKE(0x414038596F552309LL, magickgetversionnumber); + HASH_INVOKE(0x47CB27E8FDB60309LL, array_fill); + break; + case 779: + HASH_INVOKE(0x0C6F751411F5E30BLL, strrev); + HASH_INVOKE(0x65F586C35A88030BLL, magickresizeimage); + break; + case 789: + HASH_INVOKE(0x4F1E663AE18FD315LL, msg_remove_queue); + break; + case 798: + HASH_INVOKE(0x27FF9DB54420531ELL, xml_error_string); + break; + case 804: + HASH_INVOKE(0x5E5E4F998C8E7324LL, pcntl_wifexited); + break; + case 808: + HASH_INVOKE(0x73FEB3BF75FFB328LL, ctype_space); + break; + case 811: + HASH_INVOKE(0x2BDB1EE3869E132BLL, restore_error_handler); + break; + case 815: + HASH_INVOKE(0x7DD6461A6290B32FLL, mysql_real_escape_string); + break; + case 816: + HASH_INVOKE(0x300F758BB0E16330LL, mysql_num_rows); + HASH_INVOKE(0x1601C1826E90B330LL, strptime); + break; + case 817: + HASH_INVOKE(0x00DAFE46631AE331LL, stream_set_timeout); + break; + case 818: + HASH_INVOKE(0x037055C215998332LL, bcsub); + break; + case 824: + HASH_INVOKE(0x549D51040C250338LL, cleardrawingwand); + break; + case 825: + HASH_INVOKE(0x48D57F17C5132339LL, drawgetclippath); + break; + case 826: + HASH_INVOKE(0x34DDF0DFC546033ALL, xbox_task_start); + break; + case 829: + HASH_INVOKE(0x4E166ECE0EC6A33DLL, openssl_pkey_get_public); + break; + case 830: + HASH_INVOKE(0x758EA7E9AA45C33ELL, xmlwriter_end_document); + break; + case 835: + HASH_INVOKE(0x6794CFB89DEEF343LL, curl_exec); + break; + case 836: + HASH_INVOKE(0x1A9DC76AB74F6344LL, openssl_verify); + break; + case 837: + HASH_INVOKE(0x45FAE3D08E96B345LL, curl_errno); + break; + case 842: + HASH_INVOKE(0x208BB4C3C0BA534ALL, xmlwriter_write_dtd_element); + break; + case 843: + HASH_INVOKE(0x57A9E8878872D34BLL, parse_ini_file); + break; + case 844: + HASH_INVOKE(0x0644E5FB91C8134CLL, array_udiff); + break; + case 845: + HASH_INVOKE(0x5998E61D600D634DLL, drawaffine); + break; + case 847: + HASH_INVOKE(0x5C8B3B9FA833934FLL, ldap_first_attribute); + break; + case 849: + HASH_INVOKE(0x2B422699C3A57351LL, sha1); + break; + case 852: + HASH_INVOKE(0x501F4DF5C8997354LL, hphp_get_property); + HASH_INVOKE(0x77EB4D2F5BDDB354LL, magickgetimageresolution); + break; + case 858: + HASH_INVOKE(0x4BF5DEBDB76EC35ALL, mcrypt_enc_get_iv_size); + HASH_INVOKE(0x0E0C79E42812235ALL, imagepng); + break; + case 859: + HASH_INVOKE(0x1AC48909BEEF935BLL, func_get_arg); + break; + case 861: + HASH_INVOKE(0x54C3E9AB6FB8E35DLL, magickswirlimage); + break; + case 863: + HASH_INVOKE(0x280DE04F84FB235FLL, popdrawingwand); + break; + case 870: + HASH_INVOKE(0x4EF3469306E44366LL, floatval); + break; + case 871: + HASH_INVOKE(0x4810A9774785C367LL, posix_getpgrp); + break; + case 872: + HASH_INVOKE(0x5D406167C673D368LL, magickcompareimages); + break; + case 873: + HASH_INVOKE(0x6C715D7DD63DA369LL, is_integer); + break; + case 878: + HASH_INVOKE(0x7CE90898E882F36ELL, pixelsetyellow); + break; + case 882: + HASH_INVOKE(0x7107AE03689F5372LL, hphp_invoke); + break; + case 889: + HASH_INVOKE(0x5ED8901DB5D14379LL, magickcharcoalimage); + break; + case 900: + HASH_INVOKE(0x44C1BC500D175384LL, wandgetexception); + break; + case 901: + HASH_INVOKE(0x7C5CA3E2E3C8F385LL, magickflipimage); + HASH_INVOKE(0x57554E082E0ED385LL, pcntl_exec); + break; + case 902: + HASH_INVOKE(0x589E24C7664D5386LL, doubleval); + break; + case 904: + HASH_INVOKE(0x791E946E04F50388LL, magicksetresourcelimit); + break; + case 907: + HASH_INVOKE(0x73A3F87C0A56238BLL, stat); + break; + case 909: + HASH_INVOKE(0x4127DE142CD4A38DLL, xml_get_error_code); + break; + case 913: + HASH_INVOKE(0x25FA64929C619391LL, asin); + break; + case 914: + HASH_INVOKE(0x2052D8D4822EF392LL, is_subclass_of); + break; + case 916: + HASH_INVOKE(0x269A220896FD2394LL, deg2rad); + HASH_INVOKE(0x36953788781F4394LL, mailparse_msg_extract_part); + break; + case 917: + HASH_INVOKE(0x7B0552A224E27395LL, bcsqrt); + HASH_INVOKE(0x422599B9E8AC0395LL, stream_bucket_make_writeable); + break; + case 918: + HASH_INVOKE(0x15EC64198D93C396LL, openssl_pkcs12_read); + break; + case 919: + HASH_INVOKE(0x1D2C305EA5C82397LL, idn_to_utf8); + break; + case 921: + HASH_INVOKE(0x66DA89629BA5D399LL, posix_getgrgid); + break; + case 922: + HASH_INVOKE(0x0CC562CBD773639ALL, i18n_loc_get_default); + break; + case 923: + HASH_INVOKE(0x25DF28703309C39BLL, idate); + HASH_INVOKE(0x5B33B55D4B7E339BLL, fpassthru); + break; + case 926: + HASH_INVOKE(0x27AD0D17AA7FB39ELL, ldap_set_rebind_proc); + break; + case 927: + HASH_INVOKE(0x57E72C21F67D039FLL, user_error); + HASH_INVOKE(0x0368F1779E3AE39FLL, mysql_field_table); + break; + case 929: + HASH_INVOKE(0x5C29B6D7973903A1LL, proc_nice); + break; + case 930: + HASH_INVOKE(0x0207E332D629A3A2LL, mailparse_msg_get_structure); + HASH_INVOKE(0x0A2A4AA078D433A2LL, hexdec); + break; + case 932: + HASH_INVOKE(0x1676FB393F8493A4LL, constant); + break; + case 934: + HASH_INVOKE(0x40E0D496EE29B3A6LL, call_user_func_array); + break; + case 936: + HASH_INVOKE(0x4120B8157ED413A8LL, i18n_loc_set_strength); + break; + case 937: + HASH_INVOKE(0x03A023F87CB923A9LL, oci_field_name); + break; + case 938: + HASH_INVOKE(0x3238A5BD362443AALL, escapeshellcmd); + break; + case 946: + HASH_INVOKE(0x3DB7EBC0B670C3B2LL, magicksetimageredprimary); + break; + case 947: + HASH_INVOKE(0x61720D771D1A23B3LL, posix_getpwnam); + break; + case 948: + HASH_INVOKE(0x2788C40C6AB4E3B4LL, oci_free_descriptor); + break; + case 950: + HASH_INVOKE(0x6C07640F7C5BD3B6LL, imagettfbbox); + break; + case 955: + HASH_INVOKE(0x5A3F5AAD1B13A3BBLL, is_executable); + break; + case 956: + HASH_INVOKE(0x0629158C42C893BCLL, compact); + break; + case 957: + HASH_INVOKE(0x60294C2616F6A3BDLL, mcrypt_enc_get_supported_key_sizes); + break; + case 958: + HASH_INVOKE(0x49A34964289453BELL, eregi); + break; + case 959: + HASH_INVOKE(0x0E38CDC93E5893BFLL, magicksetimagemattecolor); + break; + case 968: + HASH_INVOKE(0x4D100C70E86593C8LL, stream_set_write_buffer); + HASH_INVOKE(0x3101CE70BA49A3C8LL, error_reporting); + break; + case 971: + HASH_INVOKE(0x0173CC6FACAB93CBLL, quotemeta); + HASH_INVOKE(0x4C3B6BE9112E63CBLL, str_split); + break; + case 972: + HASH_INVOKE(0x50C88817090C63CCLL, pcntl_wait); + break; + case 974: + HASH_INVOKE(0x4F9F68F60FD7A3CELL, drawgetfillrule); + HASH_INVOKE(0x02BEFBEE8287D3CELL, get_magic_quotes_runtime); + break; + case 978: + HASH_INVOKE(0x67C155632E5373D2LL, mailparse_msg_create); + break; + case 979: + HASH_INVOKE(0x734FD402E190E3D3LL, evhttp_async_get); + HASH_INVOKE(0x0A8D4FAF266973D3LL, bcpow); + break; + case 983: + HASH_INVOKE(0x7677A58EF5D593D7LL, oci_parse); + HASH_INVOKE(0x382B5B1EF00153D7LL, imagecreatefrompng); + break; + case 996: + HASH_INVOKE(0x7E7718CC939D63E4LL, setrawcookie); + break; + case 1000: + HASH_INVOKE(0x6BB9D669DDB703E8LL, xml_get_current_byte_index); + HASH_INVOKE(0x4A3127C309B0C3E8LL, drawsetstrokelinecap); + break; + case 1002: + HASH_INVOKE(0x0D3C8F00B0C633EALL, inet_pton); + HASH_INVOKE(0x6DA49696220FE3EALL, mailparse_rfc822_parse_addresses); + break; + case 1003: + HASH_INVOKE(0x1DAE0831CECB63EBLL, ob_get_clean); + break; + case 1006: + HASH_INVOKE(0x598472448937E3EELL, magickqueryfontmetrics); + break; + case 1009: + HASH_INVOKE(0x5EFE291585A713F1LL, method_exists); + break; + case 1010: + HASH_INVOKE(0x0FE12E46BC9853F2LL, stream_filter_append); + HASH_INVOKE(0x41A19AE18BC8B3F2LL, curl_error); + HASH_INVOKE(0x696241660648B3F2LL, magickwhitethresholdimage); + break; + case 1012: + HASH_INVOKE(0x26D53A77483EF3F4LL, drawbezier); + break; + case 1013: + HASH_INVOKE(0x34159AB5FE8FC3F5LL, oci_internal_debug); + break; + case 1015: + HASH_INVOKE(0x43F22CB4E3E8F3F7LL, apache_note); + break; + case 1016: + HASH_INVOKE(0x4C024573FCD5B3F8LL, var_dump); + HASH_INVOKE(0x514EA9C8FF5B33F8LL, posix_getrlimit); + break; + case 1018: + HASH_INVOKE(0x1B217E78CBC713FALL, zend_thread_id); + break; + case 1025: + HASH_INVOKE(0x36B9C440B1881401LL, fmod); + HASH_INVOKE(0x3DCB1C92B5864401LL, gzrewind); + break; + case 1028: + HASH_INVOKE(0x2B12B0E9109D0404LL, iptcembed); + break; + case 1033: + HASH_INVOKE(0x2E57E06900594409LL, xbox_send_message); + break; + case 1034: + HASH_INVOKE(0x6DC61C51FA1D340ALL, show_source); + break; + case 1037: + HASH_INVOKE(0x2939C5BAE0C4A40DLL, nl2br); + HASH_INVOKE(0x267529454569840DLL, ob_flush); + HASH_INVOKE(0x152C7161567F940DLL, func_num_args); + HASH_INVOKE(0x002CCCD877D9640DLL, drawpathclose); + break; + case 1043: + HASH_INVOKE(0x56EC1A6732D07413LL, drawgetfontsize); + HASH_INVOKE(0x20C24D873DC65413LL, openssl_csr_get_subject); + break; + case 1051: + HASH_INVOKE(0x47279C717370B41BLL, acos); + break; + case 1054: + HASH_INVOKE(0x3E4E7C561D3A541ELL, fgetss); + break; + case 1055: + HASH_INVOKE(0x301963016A91741FLL, hphp_stats); + break; + case 1059: + HASH_INVOKE(0x4C9108B5A5807423LL, drawsetfillcolor); + break; + case 1062: + HASH_INVOKE(0x21EFB0B9D1514426LL, magicksetpassphrase); + HASH_INVOKE(0x161D8EA3339AB426LL, apc_cas); + break; + case 1068: + HASH_INVOKE(0x12D324CC744BF42CLL, pixelgetcolorasstring); + break; + case 1069: + HASH_INVOKE(0x333D1E2E28B0942DLL, imagejpeg); + HASH_INVOKE(0x2A5A519E4BFE442DLL, mb_eregi); + break; + case 1071: + HASH_INVOKE(0x316F2725AC15042FLL, stream_resolve_include_path); + break; + case 1074: + HASH_INVOKE(0x71C6E38BC56CE432LL, stream_wrapper_register); + break; + case 1075: + HASH_INVOKE(0x6829094421CDB433LL, touch); + break; + case 1077: + HASH_INVOKE(0x75DAFEF5BFEF1435LL, imagesetstyle); + HASH_INVOKE(0x6BE1C72A6609B435LL, fql_static_data_set_10); + HASH_INVOKE(0x044386A0E8B25435LL, drawgetclipunits); + break; + case 1079: + HASH_INVOKE(0x1AAF02CF6DEBB437LL, magickdeconstructimages); + break; + case 1081: + HASH_INVOKE(0x34C52EF423EFD439LL, proc_open); + break; + case 1082: + HASH_INVOKE(0x5019A1FBF377C43ALL, imagepsbbox); + break; + case 1084: + HASH_INVOKE(0x59ECE01C7629643CLL, mysql_drop_db); + break; + case 1088: + HASH_INVOKE(0x5247425ED698B440LL, hphp_thread_is_warmup_enabled); + break; + case 1089: + HASH_INVOKE(0x158E2271E381C441LL, hash_file); + HASH_INVOKE(0x05892E3C5B9EB441LL, closedir); + break; + case 1090: + HASH_INVOKE(0x3F869126D0336442LL, trigger_error); + break; + case 1099: + HASH_INVOKE(0x609D331E874A944BLL, fb_set_opcode); + break; + case 1105: + HASH_INVOKE(0x7539134E1CC61451LL, xmlwriter_start_cdata); + break; + case 1106: + HASH_INVOKE(0x1056EF1C14D2A452LL, socket_connect); + break; + case 1116: + HASH_INVOKE(0x436AB52B2099145CLL, ldap_close); + break; + case 1117: + HASH_INVOKE(0x0246AF48CD31245DLL, count_chars); + break; + case 1118: + HASH_INVOKE(0x0ED191E71A60545ELL, magicksetfirstiterator); + break; + case 1125: + HASH_INVOKE(0x05D72365192CE465LL, fwrite); + HASH_INVOKE(0x406A1404F48E4465LL, posix_getuid); + break; + case 1130: + HASH_INVOKE(0x32643AE461D3F46ALL, mailparse_stream_encode); + break; + case 1132: + HASH_INVOKE(0x07D959A8C0CF546CLL, stream_wrapper_unregister); + break; + case 1133: + HASH_INVOKE(0x738D381800CE946DLL, ldap_parse_result); + HASH_INVOKE(0x5229C0069FD7D46DLL, vfprintf); + break; + case 1136: + HASH_INVOKE(0x0C626F268F120470LL, __halt_compiler); + break; + case 1139: + HASH_INVOKE(0x0F8F276A48900473LL, drawgetstrokelinecap); + break; + case 1141: + HASH_INVOKE(0x268706C46202C475LL, sem_acquire); + break; + case 1143: + HASH_INVOKE(0x18666906A8001477LL, array_diff_assoc); + break; + case 1144: + HASH_INVOKE(0x6497CC8295DDB478LL, fb_thrift_unserialize); + break; + case 1145: + HASH_INVOKE(0x4859AF715D5A3479LL, magickmagnifyimage); + break; + case 1148: + HASH_INVOKE(0x1A08C578AD3BC47CLL, apache_response_headers); + HASH_INVOKE(0x2FA7269AB0E1147CLL, mysql_field_seek); + break; + case 1150: + HASH_INVOKE(0x1D583AA4F7F6547ELL, drawpathlinetorelative); + HASH_INVOKE(0x5A97A7211F52647ELL, fbml_get_children_count_11); + HASH_INVOKE(0x0AC36D9F961B247ELL, newpixeliterator); + break; + case 1151: + HASH_INVOKE(0x68AE04B02253B47FLL, mb_parse_str); + break; + case 1154: + HASH_INVOKE(0x4590C853C2027482LL, magickembossimage); + break; + case 1157: + HASH_INVOKE(0x250DD3D58EA37485LL, gmstrftime); + break; + case 1161: + HASH_INVOKE(0x4F7EAF5B37663489LL, magickgetimageredprimary); + break; + case 1162: + HASH_INVOKE(0x7E88764A1DE8548ALL, drawgetstrokewidth); + break; + case 1163: + HASH_INVOKE(0x5860ACF621DD948BLL, is_file); + break; + case 1165: + HASH_INVOKE(0x23511F83C2BC548DLL, header); + HASH_INVOKE(0x275D127C87EF048DLL, mysql_db_query); + break; + case 1167: + HASH_INVOKE(0x43672229728A648FLL, drawpushpattern); + break; + case 1171: + HASH_INVOKE(0x56377FCC2447D493LL, magicksetimagepixels); + break; + case 1175: + HASH_INVOKE(0x353E2A635A47F497LL, evhttp_get); + HASH_INVOKE(0x5388045C2D13D497LL, mysql_num_fields); + break; + case 1181: + HASH_INVOKE(0x7A59813AC331449DLL, mb_ereg_search_regs); + break; + case 1183: + HASH_INVOKE(0x2B8C2AFB154E449FLL, oci_num_fields); + HASH_INVOKE(0x7FF66005524E649FLL, drawgettextdecoration); + break; + case 1188: + HASH_INVOKE(0x6EC476E42A53A4A4LL, ldap_err2str); + break; + case 1189: + HASH_INVOKE(0x18BE9B1C2DE6D4A5LL, imagexbm); + break; + case 1193: + HASH_INVOKE(0x386378F2BA3234A9LL, magickevaluateimage); + break; + case 1196: + HASH_INVOKE(0x245AA2790C87C4ACLL, image_type_to_mime_type); + HASH_INVOKE(0x6E8FFA56842304ACLL, drawgetfont); + break; + case 1197: + HASH_INVOKE(0x3D98ACFCEBB764ADLL, hphp_set_property); + break; + case 1199: + HASH_INVOKE(0x42463E7E5C3434AFLL, mb_strrichr); + HASH_INVOKE(0x6AC751181531F4AFLL, simplexml_load_string); + break; + case 1200: + HASH_INVOKE(0x0E11D317044974B0LL, magickgetnumberimages); + HASH_INVOKE(0x3AF65A9F3653E4B0LL, addslashes); + break; + case 1201: + HASH_INVOKE(0x060619D7A1B5F4B1LL, checkdate); + break; + case 1203: + HASH_INVOKE(0x57034CAD772AF4B3LL, magickgetimagechannelmean); + break; + case 1206: + HASH_INVOKE(0x12A9166E68DCF4B6LL, pixelgetgreen); + break; + case 1207: + HASH_INVOKE(0x7EEBC81AF9BC54B7LL, xml_parser_free); + break; + case 1209: + HASH_INVOKE(0x5351290CD139A4B9LL, mb_strrpos); + break; + case 1210: + HASH_INVOKE(0x6B49D11E633274BALL, fopen); + break; + case 1213: + HASH_INVOKE(0x35BE8F6E7726C4BDLL, dechex); + HASH_INVOKE(0x5BA371A93F60F4BDLL, use_soap_error_handler); + break; + case 1214: + HASH_INVOKE(0x57278846B8B0E4BELL, ldap_count_entries); + break; + case 1215: + HASH_INVOKE(0x01681C307C5AE4BFLL, strtoupper); + break; + case 1219: + HASH_INVOKE(0x7AAC29849263C4C3LL, getprotobyname); + break; + case 1220: + HASH_INVOKE(0x67EADCF4E81084C4LL, mb_ereg); + break; + case 1221: + HASH_INVOKE(0x34A38DDF2CD914C5LL, long2ip); + break; + case 1222: + HASH_INVOKE(0x651F7FBBA90604C6LL, magickgetimageindex); + break; + case 1224: + HASH_INVOKE(0x1B8BBFC882FDB4C8LL, magicktintimage); + break; + case 1230: + HASH_INVOKE(0x60783C20BF7724CELL, mailparse_msg_free); + break; + case 1231: + HASH_INVOKE(0x72DECE786967A4CFLL, magickpreviousimage); + break; + case 1232: + HASH_INVOKE(0x7DF31BD0D23FD4D0LL, oci_num_rows); + break; + case 1233: + HASH_INVOKE(0x29EE24C41FD3D4D1LL, mysql_field_name); + break; + case 1238: + HASH_INVOKE(0x19ECDD5A937DD4D6LL, mailparse_msg_get_part_data); + break; + case 1239: + HASH_INVOKE(0x215403F1E335C4D7LL, magicksolarizeimage); + break; + case 1240: + HASH_INVOKE(0x2532EB687D51E4D8LL, unregister_tick_function); + HASH_INVOKE(0x14BF763DDDC014D8LL, imagepsencodefont); + HASH_INVOKE(0x56B908FC91C834D8LL, magickflopimage); + HASH_INVOKE(0x1301F911ED6D54D8LL, is_nan); + HASH_INVOKE(0x575C5AE3D2A694D8LL, ob_end_clean); + break; + case 1247: + HASH_INVOKE(0x747A7F585CD694DFLL, zend_version); + HASH_INVOKE(0x2E5E5A0FC3B5C4DFLL, xml_set_character_data_handler); + break; + case 1248: + HASH_INVOKE(0x340A51AE22A924E0LL, reset); + break; + case 1251: + HASH_INVOKE(0x7D57A0D72D6254E3LL, ob_implicit_flush); + break; + case 1253: + HASH_INVOKE(0x52951AFD1514B4E5LL, fql_multiparse_10); + break; + case 1262: + HASH_INVOKE(0x5895ADDD91F354EELL, hphp_thread_set_warmup_enabled); + break; + case 1265: + HASH_INVOKE(0x65BD541EAB38E4F1LL, mysql_close); + break; + case 1268: + HASH_INVOKE(0x436B36C5EB8DB4F4LL, mcrypt_generic); + break; + case 1269: + HASH_INVOKE(0x528AC8D252D224F5LL, log10); + HASH_INVOKE(0x112A0ACDD8B9D4F5LL, mb_list_mime_names); + break; + case 1272: + HASH_INVOKE(0x011006D90D79E4F8LL, mysql_errno); + break; + case 1277: + HASH_INVOKE(0x002387F1D23B44FDLL, mcrypt_list_modes); + break; + case 1287: + HASH_INVOKE(0x197A5D237BD4C507LL, mb_ereg_search_getpos); + break; + case 1288: + HASH_INVOKE(0x63A08D6AD1209508LL, magickgetexception); + break; + case 1295: + HASH_INVOKE(0x5A66CCB3D924450FLL, xml_parser_create); + break; + case 1297: + HASH_INVOKE(0x09D5355CA8198511LL, mb_internal_encoding); + HASH_INVOKE(0x3C0304A55503D511LL, magickgetimageiterations); + break; + case 1299: + HASH_INVOKE(0x772E8BF114FEF513LL, eregi_replace); + break; + case 1300: + HASH_INVOKE(0x100385A0988FD514LL, magickgetfilename); + break; + case 1314: + HASH_INVOKE(0x7DA98E0379D33522LL, chdir); + break; + case 1316: + HASH_INVOKE(0x28E724EDE0BB6524LL, mb_strcut); + break; + case 1317: + HASH_INVOKE(0x230FE1D6EC599525LL, link); + break; + case 1318: + HASH_INVOKE(0x57DDA4C3F7FF8526LL, fputcsv); + break; + case 1319: + HASH_INVOKE(0x6B2B942CAF1A2527LL, array_shift); + break; + case 1324: + HASH_INVOKE(0x1AB55BBA0967952CLL, mb_convert_variables); + break; + case 1327: + HASH_INVOKE(0x6770E2559C9A152FLL, openssl_private_decrypt); + break; + case 1329: + HASH_INVOKE(0x6776C27C6123D531LL, dl); + break; + case 1330: + HASH_INVOKE(0x6193A26936F4D532LL, disk_total_space); + break; + case 1331: + HASH_INVOKE(0x313D2A505076A533LL, dir); + break; + case 1333: + HASH_INVOKE(0x6C87406DDC0AB535LL, mcrypt_ecb); + break; + case 1334: + HASH_INVOKE(0x0E80D04691227536LL, eval); + break; + case 1335: + HASH_INVOKE(0x557C72DE98679537LL, hash_update_stream); + HASH_INVOKE(0x175B86BCB3124537LL, magickgetexceptionstring); + break; + case 1337: + HASH_INVOKE(0x3C88F0FAC3EDD539LL, phpversion); + break; + case 1340: + HASH_INVOKE(0x5CA55E62F2A5953CLL, drawgetstrokeopacity); + break; + case 1341: + HASH_INVOKE(0x0F32841DBF7A053DLL, fb_crossall_query); + break; + case 1342: + HASH_INVOKE(0x36A80B48E08B753ELL, implode); + break; + case 1346: + HASH_INVOKE(0x59A44591E67D4542LL, drawrender); + break; + case 1347: + HASH_INVOKE(0x20E2B1D920122543LL, die); + break; + case 1348: + HASH_INVOKE(0x4D397FE5D0C0B544LL, magickmedianfilterimage); + break; + case 1350: + HASH_INVOKE(0x12A739BE0ED32546LL, ignore_user_abort); + HASH_INVOKE(0x081F76AC889BC546LL, getrusage); + break; + case 1352: + HASH_INVOKE(0x0AD3BFAB5F780548LL, magickcoalesceimages); + break; + case 1355: + HASH_INVOKE(0x40CE61115E11154BLL, msg_stat_queue); + break; + case 1357: + HASH_INVOKE(0x0F0702D91EAFB54DLL, drawgettextantialias); + HASH_INVOKE(0x1B9E769FFEC3C54DLL, pcntl_wtermsig); + break; + case 1359: + HASH_INVOKE(0x063200B5AAFEC54FLL, mysql_thread_id); + break; + case 1370: + HASH_INVOKE(0x268EE73DB2EA555ALL, get_object_vars); + break; + case 1372: + HASH_INVOKE(0x5749AD20CAFCD55CLL, pixelgetbluequantum); + break; + case 1379: + HASH_INVOKE(0x1B1B2D70792D9563LL, mysql_get_client_info); + break; + case 1382: + HASH_INVOKE(0x6E2FDBD28F895566LL, timezone_abbreviations_list); + HASH_INVOKE(0x3DA2058E5C540566LL, spliti); + break; + case 1386: + HASH_INVOKE(0x74599147803DC56ALL, magickgetstringwidth); + break; + case 1387: + HASH_INVOKE(0x0DE86977367F656BLL, register_shutdown_function); + break; + case 1390: + HASH_INVOKE(0x2A1F1B52160DE56ELL, zend_logo_guid); + break; + case 1391: + HASH_INVOKE(0x016722439BBA756FLL, filetype); + break; + case 1392: + HASH_INVOKE(0x13D0427F3BB3E570LL, get_declared_interfaces); + HASH_INVOKE(0x21B3935EB3140570LL, mysql_fetch_object); + break; + case 1393: + HASH_INVOKE(0x2AD3361DE8B1D571LL, pcntl_signal_dispatch); + break; + case 1396: + HASH_INVOKE(0x636C871213F37574LL, mcrypt_encrypt); + break; + case 1399: + HASH_INVOKE(0x412521E7ADB21577LL, iconv_mime_decode_headers); + HASH_INVOKE(0x1E154D823451B577LL, magicksetresolution); + break; + case 1400: + HASH_INVOKE(0x588DE7449C8E0578LL, oci_connect); + break; + case 1401: + HASH_INVOKE(0x1DC8A386E219C579LL, ldap_add); + break; + case 1405: + HASH_INVOKE(0x78EDB608B02A857DLL, join); + HASH_INVOKE(0x22E08DEDF360057DLL, pixelsetmagenta); + break; + case 1406: + HASH_INVOKE(0x31529E9BCA1E157ELL, shm_remove); + HASH_INVOKE(0x132776D93181E57ELL, ldap_set_option); + break; + case 1410: + HASH_INVOKE(0x02688986D5D76582LL, magickspreadimage); + HASH_INVOKE(0x0B1F0EB755BDB582LL, ispixeliterator); + break; + case 1411: + HASH_INVOKE(0x3B2CD86F5DB72583LL, magickblackthresholdimage); + break; + case 1419: + HASH_INVOKE(0x3A34B44E4C51C58BLL, xml_set_element_handler); + break; + case 1420: + HASH_INVOKE(0x560C2F71978CE58CLL, shm_put_var); + break; + case 1426: + HASH_INVOKE(0x3E9519FE856C4592LL, curl_multi_init); + HASH_INVOKE(0x5464E148E8A0C592LL, get_extension_funcs); + HASH_INVOKE(0x7F65501600346592LL, mcrypt_get_block_size); + break; + case 1431: + HASH_INVOKE(0x513787A813DB0597LL, date_date_set); + break; + case 1433: + HASH_INVOKE(0x12F502A88E0AA599LL, magickcompositeimage); + break; + case 1434: + HASH_INVOKE(0x77F1EDE7D5EF759ALL, apc_cache_info); + break; + case 1435: + HASH_INVOKE(0x37D003B09D0C759BLL, stream_get_contents); + break; + case 1440: + HASH_INVOKE(0x20502FCACBB9F5A0LL, convert_uuencode); + break; + case 1441: + HASH_INVOKE(0x297690F3A63335A1LL, magickrotateimage); + break; + case 1444: + HASH_INVOKE(0x3C014439AE5D75A4LL, magickgetcharheight); + break; + case 1448: + HASH_INVOKE(0x4FBB1F662399A5A8LL, is_soap_fault); + break; + case 1451: + HASH_INVOKE(0x79E0380A18A345ABLL, apache_get_modules); + break; + case 1452: + HASH_INVOKE(0x763BA2B1C60A55ACLL, pixelgetalphaquantum); + break; + case 1453: + HASH_INVOKE(0x4110AF96B98B25ADLL, gzeof); + break; + case 1455: + HASH_INVOKE(0x1636FBA5043CF5AFLL, ldap_error); + break; + case 1459: + HASH_INVOKE(0x001DBE44BC0B55B3LL, magicksetimagecolormapcolor); + break; + case 1461: + HASH_INVOKE(0x3F9C5B4708FC55B5LL, timezone_name_get); + HASH_INVOKE(0x5EFE573046B565B5LL, mcrypt_module_close); + break; + case 1466: + HASH_INVOKE(0x05B8EB2C515885BALL, vprintf); + break; + case 1472: + HASH_INVOKE(0x61465CD8C67905C0LL, openssl_pkey_free); + break; + case 1473: + HASH_INVOKE(0x7731B90FB7C975C1LL, magickremoveimageprofile); + break; + case 1478: + HASH_INVOKE(0x3B3D5CE69B1565C6LL, mcrypt_module_is_block_mode); + break; + case 1481: + HASH_INVOKE(0x75B299F5E35A95C9LL, mb_strwidth); + break; + case 1483: + HASH_INVOKE(0x6751946191FBE5CBLL, override_function); + break; + case 1484: + HASH_INVOKE(0x2A6F86821A39C5CCLL, expm1); + break; + case 1487: + HASH_INVOKE(0x5D9818B3E1C385CFLL, openssl_pkey_export_to_file); + break; + case 1489: + HASH_INVOKE(0x054503DBBF5CA5D1LL, imagecopy); + break; + case 1492: + HASH_INVOKE(0x2FE56B4C457AB5D4LL, ctype_graph); + break; + case 1493: + HASH_INVOKE(0x5295463221FB45D5LL, phprof_enable); + HASH_INVOKE(0x43901543EA8625D5LL, curl_multi_select); + break; + case 1494: + HASH_INVOKE(0x6D265875A19685D6LL, is_float); + break; + case 1495: + HASH_INVOKE(0x617AD1AD708785D7LL, magickmodulateimage); + break; + case 1508: + HASH_INVOKE(0x3A9643992AC805E4LL, magickdrawimage); + break; + case 1510: + HASH_INVOKE(0x6FE2E44FBC44E5E6LL, magickaddnoiseimage); + HASH_INVOKE(0x08069ECE0EA3C5E6LL, imagecopymergegray); + break; + case 1514: + HASH_INVOKE(0x0B7ACBAB402015EALL, mb_send_mail); + break; + case 1518: + HASH_INVOKE(0x3076D369F63E65EELL, pixelgetalpha); + break; + case 1524: + HASH_INVOKE(0x1E89F15B7F2805F4LL, openssl_pkcs7_encrypt); + HASH_INVOKE(0x459330C31956A5F4LL, vsprintf); + break; + case 1525: + HASH_INVOKE(0x0D1BD0E5AF4175F5LL, drawsetfont); + HASH_INVOKE(0x73A1F34DF95B35F5LL, get_defined_constants); + break; + case 1527: + HASH_INVOKE(0x18E4CC945005E5F7LL, drawpushclippath); + break; + case 1528: + HASH_INVOKE(0x7C48F6EA39B7B5F8LL, magickadaptivethresholdimage); + break; + case 1531: + HASH_INVOKE(0x0FEC4ED541B7F5FBLL, magickgetimagevirtualpixelmethod); + break; + case 1532: + HASH_INVOKE(0x39156C7CCE2D75FCLL, hash_update); + break; + case 1533: + HASH_INVOKE(0x0C1CB24A3FC065FDLL, bcmul); + break; + case 1534: + HASH_INVOKE(0x397D3C6576ED75FELL, set_include_path); + break; + case 1535: + HASH_INVOKE(0x40A557CBB9FC35FFLL, mysql_tablename); + break; + case 1537: + HASH_INVOKE(0x0F3403D8676C2601LL, mysql_query); + break; + case 1545: + HASH_INVOKE(0x52D5698F31D12609LL, pcntl_setpriority); + break; + case 1555: + HASH_INVOKE(0x36783304F63C4613LL, sscanf); + HASH_INVOKE(0x4AC405EA2B8C4613LL, magickresetiterator); + break; + case 1557: + HASH_INVOKE(0x6AD774816F8F7615LL, mb_strrchr); + break; + case 1558: + HASH_INVOKE(0x66C7616225F1C616LL, pixelsetgreen); + HASH_INVOKE(0x7FA6D13B0D38E616LL, imagegif); + break; + case 1561: + HASH_INVOKE(0x6DD51BF03F003619LL, mailparse_uudecode_all); + HASH_INVOKE(0x2F29627AF1A97619LL, shm_attach); + break; + case 1563: + HASH_INVOKE(0x40DDE277D934061BLL, gzputs); + break; + case 1564: + HASH_INVOKE(0x70725954DC99F61CLL, mcrypt_create_iv); + break; + case 1565: + HASH_INVOKE(0x7E98B97C1B5D861DLL, magickqueryconfigureoptions); + break; + case 1569: + HASH_INVOKE(0x0F71DDE51AA55621LL, hphp_output_global_state); + break; + case 1570: + HASH_INVOKE(0x134550B9EB596622LL, drawgetfontstyle); + break; + case 1576: + HASH_INVOKE(0x1E77B3BCF062D628LL, magickreadimage); + break; + case 1577: + HASH_INVOKE(0x679B81CE06EE0629LL, bcdiv); + break; + case 1578: + HASH_INVOKE(0x608EA42B08A7462ALL, linkinfo); + break; + case 1580: + HASH_INVOKE(0x5CEA60D9C54A162CLL, pcntl_wifstopped); + break; + case 1583: + HASH_INVOKE(0x652C331CE138362FLL, is_string); + break; + case 1585: + HASH_INVOKE(0x5AD6595ACA656631LL, pixelresetiterator); + break; + case 1591: + HASH_INVOKE(0x60276BC7990F9637LL, mysql_list_dbs); + HASH_INVOKE(0x6723D4EF0880E637LL, fb_debug_rlog); + break; + case 1595: + HASH_INVOKE(0x391C68F2BE85E63BLL, pixelgetiteratorexceptionstring); + break; + case 1596: + HASH_INVOKE(0x62DE03461EF4663CLL, symlink); + break; + case 1598: + HASH_INVOKE(0x60302D15A677963ELL, ldap_free_result); + break; + case 1599: + HASH_INVOKE(0x17242BC6C9C9563FLL, crypt); + break; + case 1606: + HASH_INVOKE(0x4901517CB796F646LL, msg_set_queue); + HASH_INVOKE(0x234F6A0A486E8646LL, natcasesort); + break; + case 1613: + HASH_INVOKE(0x4FAA0B35DDAB364DLL, oci_statement_type); + break; + case 1614: + HASH_INVOKE(0x7E978C38D741664ELL, fgetcsv); + HASH_INVOKE(0x769E5C6A5369F64ELL, ob_list_handlers); + break; + case 1617: + HASH_INVOKE(0x5F3DA61B6506A651LL, oci_error); + break; + case 1621: + HASH_INVOKE(0x629EDDC1E74ED655LL, array_uintersect_assoc); + HASH_INVOKE(0x6BE3B1277BBF8655LL, oci_pconnect); + break; + case 1628: + HASH_INVOKE(0x381BBFEABFEC865CLL, libxml_get_last_error); + break; + case 1630: + HASH_INVOKE(0x205BB9CFF397B65ELL, ldap_mod_replace); + break; + case 1631: + HASH_INVOKE(0x1355AFB40AB1165FLL, drawsetfontstyle); + break; + case 1636: + HASH_INVOKE(0x5B0759F776EC2664LL, newdrawingwand); + break; + case 1637: + HASH_INVOKE(0x08A6AD20C2C5A665LL, hphp_set_static_property); + break; + case 1647: + HASH_INVOKE(0x7D68CADB8069466FLL, magickaverageimages); + break; + case 1651: + HASH_INVOKE(0x126FC82D358E9673LL, magicksetimagevirtualpixelmethod); + break; + case 1655: + HASH_INVOKE(0x001F23CAC36E3677LL, magickgetimagescene); + break; + case 1658: + HASH_INVOKE(0x583AA7498A40E67ALL, drawgetcliprule); + break; + case 1659: + HASH_INVOKE(0x5BCED33A57D9B67BLL, intval); + break; + case 1661: + HASH_INVOKE(0x69616E2817E1967DLL, fileinode); + break; + case 1662: + HASH_INVOKE(0x20B9799C1BDDE67ELL, oci_fetch); + break; + case 1666: + HASH_INVOKE(0x665D2615E377A682LL, pagelet_server_task_start); + HASH_INVOKE(0x5F6750E1C7E5D682LL, imageinterlace); + break; + case 1677: + HASH_INVOKE(0x07A946E3DD8E968DLL, ldap_connect); + break; + case 1679: + HASH_INVOKE(0x2EFF4F69EB1DF68FLL, apache_get_config); + break; + case 1680: + HASH_INVOKE(0x166D5E2336878690LL, imagepolygon); + break; + case 1681: + HASH_INVOKE(0x57BA0BC1A4870691LL, magickgetquantumdepth); + break; + case 1682: + HASH_INVOKE(0x16BE0DBA42800692LL, magickgetimagesize); + break; + case 1684: + HASH_INVOKE(0x2673FAB2B4DE4694LL, destroypixelwands); + break; + case 1685: + HASH_INVOKE(0x7186EF5EF0581695LL, exp); + break; + case 1686: + HASH_INVOKE(0x0DD7A2DB53093696LL, utf8_decode); + break; + case 1691: + HASH_INVOKE(0x24D34E49C21DE69BLL, mb_stristr); + break; + case 1694: + HASH_INVOKE(0x5E9821F06711669ELL, gethostbynamel); + break; + case 1702: + HASH_INVOKE(0x0D841874977646A6LL, krsort); + break; + case 1703: + HASH_INVOKE(0x38BBEE42F136D6A7LL, magickgetimageblueprimary); + break; + case 1704: + HASH_INVOKE(0x45AB8F419BA666A8LL, drawpathlinetohorizontalabsolute); + break; + case 1706: + HASH_INVOKE(0x6E9D4D3A119D76AALL, wandgetexceptiontype); + HASH_INVOKE(0x48C4DB333172F6AALL, parse_url); + HASH_INVOKE(0x541926FB6D6FC6AALL, magickgetimagecolors); + break; + case 1707: + HASH_INVOKE(0x72B3F8E02D8B16ABLL, array_unshift); + break; + case 1711: + HASH_INVOKE(0x65497D63C0D716AFLL, getdate); + break; + case 1712: + HASH_INVOKE(0x23AAF570C78AC6B0LL, ip2long); + break; + case 1714: + HASH_INVOKE(0x0D669C546C0EC6B2LL, proc_terminate); + break; + case 1717: + HASH_INVOKE(0x798B4197212456B5LL, bcpowmod); + HASH_INVOKE(0x623CE67C41A9E6B5LL, ldap_next_attribute); + HASH_INVOKE(0x7E773A36449576B5LL, imagecharup); + break; + case 1720: + HASH_INVOKE(0x44A226F0E402D6B8LL, oci_execute); + break; + case 1721: + HASH_INVOKE(0x316F054CB76446B9LL, openssl_sign); + break; + case 1722: + HASH_INVOKE(0x72B901C3605CB6BALL, pixelsetopacity); + break; + case 1726: + HASH_INVOKE(0x081D5EA9920076BELL, drawgetfillalpha); + break; + case 1732: + HASH_INVOKE(0x4842AF70A71BE6C4LL, uksort); + HASH_INVOKE(0x34184B42D6AA86C4LL, mb_ereg_search_pos); + HASH_INVOKE(0x3C042C09F662C6C4LL, drawsetstrokepatternurl); + break; + case 1733: + HASH_INVOKE(0x28526EF49FF516C5LL, pixelsetgreenquantum); + break; + case 1736: + HASH_INVOKE(0x29DD2C9F889246C8LL, passthru); + break; + case 1737: + HASH_INVOKE(0x2D8DF100C30D06C9LL, xmlwriter_set_indent_string); + break; + case 1738: + HASH_INVOKE(0x41BCD0A72B1396CALL, xmlwriter_start_dtd_attlist); + break; + case 1745: + HASH_INVOKE(0x2B3D5B9AF915D6D1LL, imagecopymerge); + break; + case 1748: + HASH_INVOKE(0x04A0E6E8337E56D4LL, drawcolor); + break; + case 1749: + HASH_INVOKE(0x317FFA522A7D96D5LL, imagefilledpolygon); + break; + case 1750: + HASH_INVOKE(0x158348EB08F406D6LL, strtr); + break; + case 1761: + HASH_INVOKE(0x11DA0A0EB8E0D6E1LL, clock_getres); + break; + case 1764: + HASH_INVOKE(0x40D0E3AF799226E4LL, bin2hex); + HASH_INVOKE(0x1CF3544CB5C9D6E4LL, xml_set_processing_instruction_handler); + HASH_INVOKE(0x31FFFC333AA6D6E4LL, drawsetfillrule); + break; + case 1767: + HASH_INVOKE(0x44201A16F3D876E7LL, trim); + break; + case 1773: + HASH_INVOKE(0x04BD4B43921956EDLL, ldap_search); + break; + case 1774: + HASH_INVOKE(0x76382756EA00B6EELL, is_object); + break; + case 1775: + HASH_INVOKE(0x0FA74D85885F86EFLL, output_add_rewrite_var); + break; + case 1776: + HASH_INVOKE(0x014BD9A6823256F0LL, extract); + break; + case 1777: + HASH_INVOKE(0x6B7347DF1AA7E6F1LL, drawpopdefs); + break; + case 1779: + HASH_INVOKE(0x6F1968BE449FB6F3LL, stream_socket_pair); + HASH_INVOKE(0x5768A80BB0B926F3LL, apd_set_session_trace_socket); + break; + case 1785: + HASH_INVOKE(0x20740D956F0236F9LL, image2wbmp); + break; + case 1791: + HASH_INVOKE(0x623C20A027A606FFLL, array_uintersect_uassoc); + break; + case 1793: + HASH_INVOKE(0x1A80392751AA7701LL, magickgetformat); + break; + case 1796: + HASH_INVOKE(0x5EFE15CE970A5704LL, drawpolyline); + break; + case 1801: + HASH_INVOKE(0x21972B2BC7A14709LL, imageistruecolor); + break; + case 1803: + HASH_INVOKE(0x5F7873F2DF5BE70BLL, ctype_cntrl); + break; + case 1805: + HASH_INVOKE(0x7CE752299E80B70DLL, unserialize); + HASH_INVOKE(0x4F3C0DB2F6C8F70DLL, unlink); + break; + case 1807: + HASH_INVOKE(0x2FB2FA1DD832C70FLL, xmlwriter_write_attribute_ns); + break; + case 1812: + HASH_INVOKE(0x1778ED2AF035F714LL, rsort); + break; + case 1813: + HASH_INVOKE(0x25D578B4772C1715LL, define); + break; + case 1816: + HASH_INVOKE(0x7971A5647C957718LL, date_time_set); + break; + case 1819: + HASH_INVOKE(0x3C16230CBC6D471BLL, imagecreatetruecolor); + break; + case 1820: + HASH_INVOKE(0x50AC61A28C5AC71CLL, imagecolorclosestalpha); + break; + case 1824: + HASH_INVOKE(0x2D213FD80048F720LL, usleep); + break; + case 1827: + HASH_INVOKE(0x78420E0B5D110723LL, imagetruecolortopalette); + break; + case 1828: + HASH_INVOKE(0x4DAA3FBC2BD3A724LL, magickequalizeimage); + break; + case 1829: + HASH_INVOKE(0x31EAD049860CE725LL, posix_kill); + break; + case 1830: + HASH_INVOKE(0x523AB2EA95DAD726LL, get_included_files); + break; + case 1831: + HASH_INVOKE(0x11641BE0F11CD727LL, magickgammaimage); + break; + case 1833: + HASH_INVOKE(0x1D30F1E638D71729LL, readgzfile); + break; + case 1834: + HASH_INVOKE(0x17C0D9B1C10B872ALL, openssl_x509_export); + HASH_INVOKE(0x1F98B41362CDA72ALL, magickgetimagegreenprimary); + break; + case 1837: + HASH_INVOKE(0x14563723F798172DLL, magickpaintopaqueimage); + break; + case 1840: + HASH_INVOKE(0x0D558F552A784730LL, ob_get_contents); + break; + case 1842: + HASH_INVOKE(0x2B1C192C419B8732LL, drawgetexception); + break; + case 1855: + HASH_INVOKE(0x650E641CC0E3873FLL, connection_aborted); + break; + case 1857: + HASH_INVOKE(0x5062777D2B947741LL, wordwrap); + break; + case 1863: + HASH_INVOKE(0x3CD58419E181A747LL, magickstereoimage); + break; + case 1864: + HASH_INVOKE(0x0D7BBA9608A36748LL, magickcombineimages); + break; + case 1865: + HASH_INVOKE(0x73E4417BA7B49749LL, curl_multi_info_read); + break; + case 1866: + HASH_INVOKE(0x1FF03B7DE19DD74ALL, drawpathmovetorelative); + break; + case 1867: + HASH_INVOKE(0x7DA9307A6149B74BLL, get_meta_tags); + break; + case 1873: + HASH_INVOKE(0x017FF216C00D9751LL, property_exists); + break; + case 1875: + HASH_INVOKE(0x42795829DF700753LL, mysql_get_host_info); + break; + case 1876: + HASH_INVOKE(0x53AEFD595C044754LL, max); + break; + case 1879: + HASH_INVOKE(0x7554E3E8674F2757LL, mb_list_encodings); + break; + case 1883: + HASH_INVOKE(0x05D293F45C15F75BLL, ldap_mod_del); + break; + case 1887: + HASH_INVOKE(0x3EDB48C5DDD9675FLL, socket_select); + break; + case 1888: + HASH_INVOKE(0x1BD984C11BB16760LL, array_merge); + HASH_INVOKE(0x7AB5E6EA37196760LL, date_timezone_set); + break; + case 1889: + HASH_INVOKE(0x6AF50085AC2AC761LL, xmlwriter_write_element); + break; + case 1893: + HASH_INVOKE(0x1D803CE961921765LL, md5); + HASH_INVOKE(0x45631C592AD6D765LL, str_ireplace); + break; + case 1894: + HASH_INVOKE(0x1F4505BE6460D766LL, scandir); + break; + case 1895: + HASH_INVOKE(0x6C280D5855D20767LL, drawsetfillalpha); + break; + case 1896: + HASH_INVOKE(0x179A72074C778768LL, openssl_x509_export_to_file); + break; + case 1901: + HASH_INVOKE(0x3304663FBC6C976DLL, get_html_translation_table); + HASH_INVOKE(0x553ADA5A41AE976DLL, mb_ereg_replace); + break; + case 1904: + HASH_INVOKE(0x6F6C5B9E3DC64770LL, drawgetstrokemiterlimit); + break; + case 1909: + HASH_INVOKE(0x04D9076808F79775LL, getenv); + break; + case 1910: + HASH_INVOKE(0x616DDB67073A0776LL, ord); + HASH_INVOKE(0x4102C410C5031776LL, magickcolorizeimage); + break; + case 1914: + HASH_INVOKE(0x1FBF36B5D65E677ALL, fb_call_user_func_safe_return); + HASH_INVOKE(0x4330CE9C9002477ALL, array_udiff_uassoc); + break; + case 1915: + HASH_INVOKE(0x129E39AC523A977BLL, magickgethomeurl); + break; + case 1920: + HASH_INVOKE(0x29824AAA934CE780LL, array_filter); + break; + case 1923: + HASH_INVOKE(0x53B4DBE58B356783LL, imagesetthickness); + HASH_INVOKE(0x38704D99FEA9B783LL, mysql_fetch_array); + break; + case 1924: + HASH_INVOKE(0x784FD2E7191A3784LL, drawpathellipticarcrelative); + break; + case 1925: + HASH_INVOKE(0x5BFC6198960A5785LL, in_array); + break; + case 1926: + HASH_INVOKE(0x3D3F7C6DE95D5786LL, oci_field_is_null); + break; + case 1927: + HASH_INVOKE(0x4991643BD854D787LL, drawgetexceptionstring); + break; + case 1928: + HASH_INVOKE(0x32D8CE5D0FA6D788LL, ldap_rename); + break; + case 1930: + HASH_INVOKE(0x70A1EC006032E78ALL, pixelgetquantumcolor); + break; + case 1935: + HASH_INVOKE(0x7B4E25772D0AC78FLL, simplexml_load_file); + break; + case 1938: + HASH_INVOKE(0x7E5B890072113792LL, fbml_complex_expand_tag_list_11); + HASH_INVOKE(0x0D4891A5E1A20792LL, get_defined_functions); + break; + case 1945: + HASH_INVOKE(0x26D226FD28566799LL, date_isodate_set); + break; + case 1947: + HASH_INVOKE(0x1196D899ACCD379BLL, evhttp_recv); + break; + case 1949: + HASH_INVOKE(0x02ECD8C169DF579DLL, feof); + break; + case 1951: + HASH_INVOKE(0x4B092931EFB7979FLL, mysql_create_db); + break; + case 1959: + HASH_INVOKE(0x1F76E954F9A147A7LL, magickcontrastimage); + break; + case 1961: + HASH_INVOKE(0x7C251B7DE8DB87A9LL, mcrypt_list_algorithms); + break; + case 1962: + HASH_INVOKE(0x45A53A884414A7AALL, pack); + HASH_INVOKE(0x58D6464A3A9127AALL, apc_bin_loadfile); + break; + case 1965: + HASH_INVOKE(0x7DA08D9D148837ADLL, posix_mkfifo); + HASH_INVOKE(0x217C52A1EBDF87ADLL, apache_get_version); + break; + case 1966: + HASH_INVOKE(0x00141B0E3E6F77AELL, xml_set_unparsed_entity_decl_handler); + break; + case 1967: + HASH_INVOKE(0x16CB9891EF26D7AFLL, drawgetstrokedashoffset); + break; + case 1977: + HASH_INVOKE(0x1FC9406FD7FCD7B9LL, strrpos); + HASH_INVOKE(0x1B6467AD87E167B9LL, log1p); + break; + case 1983: + HASH_INVOKE(0x3F46374E6E1B07BFLL, posix_getpwuid); + break; + case 1984: + HASH_INVOKE(0x152D1AB941A647C0LL, hphp_get_extension_info); + HASH_INVOKE(0x52FDAC1D298D67C0LL, mcrypt_enc_get_algorithms_name); + break; + case 1985: + HASH_INVOKE(0x4E172EA6743697C1LL, ldap_first_entry); + break; + case 1988: + HASH_INVOKE(0x3C696836396BE7C4LL, mb_language); + break; + case 1990: + HASH_INVOKE(0x0C8A7BE6ABC957C6LL, clearpixeliterator); + HASH_INVOKE(0x3D6D684AF537A7C6LL, ldap_explode_dn); + break; + case 1991: + HASH_INVOKE(0x686C5142FD0337C7LL, lcg_value); + break; + case 1994: + HASH_INVOKE(0x3C781898488687CALL, xml_parse); + HASH_INVOKE(0x55B68546CFAC87CALL, magicksetimageresolution); + break; + case 1998: + HASH_INVOKE(0x3AE33FEA6830C7CELL, magickshearimage); + break; + case 1999: + HASH_INVOKE(0x2FAB1F75659707CFLL, is_scalar); + break; + case 2001: + HASH_INVOKE(0x35B661C87484D7D1LL, openssl_csr_sign); + break; + case 2004: + HASH_INVOKE(0x08BF57B6353A77D4LL, fbml_get_text_11); + break; + case 2009: + HASH_INVOKE(0x2ED6760DAA3A67D9LL, strcasecmp); + break; + case 2012: + HASH_INVOKE(0x1FE65AFCC92967DCLL, rmdir); + break; + case 2013: + HASH_INVOKE(0x2B5AEDF1A5FC47DDLL, strripos); + break; + case 2018: + HASH_INVOKE(0x0888289CBD2887E2LL, iconv_substr); + break; + case 2020: + HASH_INVOKE(0x2621680306BC97E4LL, magicksetimagescene); + break; + case 2023: + HASH_INVOKE(0x4215DDB57604F7E7LL, xmlwriter_start_pi); + break; + case 2024: + HASH_INVOKE(0x53B7BF8991FA67E8LL, i18n_loc_get_error_code); + break; + case 2025: + HASH_INVOKE(0x6BB8AC68771287E9LL, strcmp); + break; + case 2027: + HASH_INVOKE(0x54AE7140B95027EBLL, pixelgetgreenquantum); + HASH_INVOKE(0x1A397501431EC7EBLL, is_numeric); + break; + case 2031: + HASH_INVOKE(0x5367B0F3A4D2D7EFLL, ldap_list); + break; + case 2032: + HASH_INVOKE(0x14F700DD189DB7F0LL, drawsetclipunits); + break; + case 2035: + HASH_INVOKE(0x73877357478137F3LL, posix_ctermid); + HASH_INVOKE(0x4B57E07A323FE7F3LL, drawpathlinetoverticalabsolute); + HASH_INVOKE(0x7F436B50B7BBD7F3LL, getcwd); + break; + case 2041: + HASH_INVOKE(0x376FB2649384A7F9LL, str_pad); + break; + case 2042: + HASH_INVOKE(0x0FD7C3144B4007FALL, libxml_set_streams_context); + break; + case 2045: + HASH_INVOKE(0x238E501F2536E7FDLL, drawsetclippath); + break; + case 2048: + HASH_INVOKE(0x0E66983DD04B0800LL, get_current_user); + break; + case 2051: + HASH_INVOKE(0x10F7244AA9CB5803LL, imagepstext); + break; + case 2052: + HASH_INVOKE(0x349A0DF6723B6804LL, pixelsetcolorcount); + break; + case 2053: + HASH_INVOKE(0x54ED49F8B155C805LL, ldap_t61_to_8859); + break; + case 2056: + HASH_INVOKE(0x19279D6DB4F70808LL, hash_hmac); + HASH_INVOKE(0x083B8F01AE15B808LL, assert); + break; + case 2057: + HASH_INVOKE(0x221F5A9D5E021809LL, magickwriteimages); + break; + case 2058: + HASH_INVOKE(0x5A0D1AE1D4C6F80ALL, array_slice); + break; + case 2060: + HASH_INVOKE(0x3FF63423EC4B280CLL, posix_getegid); + break; + case 2061: + HASH_INVOKE(0x11EC19E702F2C80DLL, getmyinode); + HASH_INVOKE(0x727F5A6D8E26B80DLL, extension_loaded); + break; + case 2063: + HASH_INVOKE(0x2342E5B393F0680FLL, oci_password_change); + break; + case 2064: + HASH_INVOKE(0x4297B1072CE76810LL, fb_call_user_func_array_safe); + break; + case 2067: + HASH_INVOKE(0x1A6B577442218813LL, pixelsetmagentaquantum); + HASH_INVOKE(0x5F7940A713863813LL, floor); + break; + case 2068: + HASH_INVOKE(0x3C0DFA15D3447814LL, rawurldecode); + break; + case 2071: + HASH_INVOKE(0x0D8B1D0A8C381817LL, stream_bucket_new); + break; + case 2072: + HASH_INVOKE(0x0FBDB0B22A59B818LL, mailparse_msg_parse); + break; + case 2077: + HASH_INVOKE(0x4D624A655A9B581DLL, drawpoint); + break; + case 2081: + HASH_INVOKE(0x2D52FB9B52EC2821LL, xml_set_notation_decl_handler); + HASH_INVOKE(0x107DBCA79C15B821LL, addcslashes); + break; + case 2084: + HASH_INVOKE(0x2B78E204F615A824LL, openssl_pkcs12_export_to_file); + break; + case 2087: + HASH_INVOKE(0x33EC567341B9C827LL, magickgetmaxtextadvance); + break; + case 2089: + HASH_INVOKE(0x39EE4CCCA716E829LL, stream_context_get_options); + HASH_INVOKE(0x57FFCEB7FA2D9829LL, usort); + break; + case 2092: + HASH_INVOKE(0x34F0E032AB05C82CLL, pixelsetblue); + break; + case 2093: + HASH_INVOKE(0x1C4AE57BF4E4A82DLL, apc_dec); + break; + case 2094: + HASH_INVOKE(0x3402C1E7544C382ELL, lstat); + break; + case 2095: + HASH_INVOKE(0x79A05154A7F5482FLL, magickgetimagedelay); + break; + case 2096: + HASH_INVOKE(0x5BBFA7EAEBD25830LL, pixelgetcyanquantum); + break; + case 2100: + HASH_INVOKE(0x605132E71CE7D834LL, array_push); + break; + case 2101: + HASH_INVOKE(0x1C4A162E6635B835LL, imageftbbox); + break; + case 2104: + HASH_INVOKE(0x63E554E0F11CE838LL, mysql_unbuffered_query); + HASH_INVOKE(0x03098F16B0AD5838LL, mcrypt_module_get_supported_key_sizes); + HASH_INVOKE(0x0890F9052322E838LL, fstat); + break; + case 2105: + HASH_INVOKE(0x4F148A9F4E2C5839LL, fb_start_mcproxy); + break; + case 2107: + HASH_INVOKE(0x63E2EA180786B83BLL, pixelsetblack); + break; + case 2108: + HASH_INVOKE(0x7C8969C75CA1783CLL, get_declared_classes); + HASH_INVOKE(0x034EDEBD109FD83CLL, filesize); + break; + case 2115: + HASH_INVOKE(0x567A7139AD476843LL, socket_listen); + break; + case 2116: + HASH_INVOKE(0x1639883196856844LL, oci_close); + break; + case 2118: + HASH_INVOKE(0x50088ED5D482C846LL, ldap_mod_add); + break; + case 2119: + HASH_INVOKE(0x4E69A952E3EA4847LL, magicksetfilename); + break; + case 2122: + HASH_INVOKE(0x7D3F626E636C084ALL, ldap_delete); + break; + case 2123: + HASH_INVOKE(0x68B7597C22FA484BLL, openssl_public_encrypt); + break; + case 2124: + HASH_INVOKE(0x26A2BBC465A2B84CLL, strcoll); + break; + case 2126: + HASH_INVOKE(0x488C2F267BF2884ELL, array_intersect); + break; + case 2128: + HASH_INVOKE(0x4DDB82A3632FA850LL, atan); + break; + case 2129: + HASH_INVOKE(0x488BFCC942C73851LL, gzopen); + break; + case 2140: + HASH_INVOKE(0x5A017A4C6A41E85CLL, curl_multi_add_handle); + break; + case 2142: + HASH_INVOKE(0x6B4DE6865142285ELL, destroypixeliterator); + break; + case 2145: + HASH_INVOKE(0x2AD6B0E3B9F3B861LL, array_search); + break; + case 2147: + HASH_INVOKE(0x21B30164F5D49863LL, is_resource); + break; + case 2148: + HASH_INVOKE(0x168EDA8238EEE864LL, mb_detect_order); + break; + case 2151: + HASH_INVOKE(0x65A68A31B96E7867LL, hash); + break; + case 2152: + HASH_INVOKE(0x785C812E6292E868LL, i18n_loc_set_default); + break; + case 2153: + HASH_INVOKE(0x246EC2B1844DB869LL, pixelgetexception); + break; + case 2155: + HASH_INVOKE(0x0C1BBEDECEF1C86BLL, newmagickwand); + break; + case 2156: + HASH_INVOKE(0x6414504A6658286CLL, stripos); + break; + case 2159: + HASH_INVOKE(0x1476A177CC50686FLL, mb_strstr); + break; + case 2160: + HASH_INVOKE(0x34F50577C14C6870LL, array_diff_uassoc); + break; + case 2162: + HASH_INVOKE(0x3C7B86F57AFA0872LL, hebrev); + HASH_INVOKE(0x558D62FBEB210872LL, str_rot13); + break; + case 2163: + HASH_INVOKE(0x4C06B4AFC1C08873LL, str_shuffle); + break; + case 2167: + HASH_INVOKE(0x6AA3788C9B737877LL, magickdespeckleimage); + break; + case 2168: + HASH_INVOKE(0x00F8C6758B50B878LL, drawpathcurvetoquadraticbezierabsolute); + break; + case 2172: + HASH_INVOKE(0x6451BCB825D1787CLL, chroot); + break; + case 2173: + HASH_INVOKE(0x54F84DC9A334287DLL, gzencode); + HASH_INVOKE(0x2B36081E0828487DLL, debug_print_backtrace); + break; + case 2180: + HASH_INVOKE(0x766CD15A7F2A0884LL, array_uintersect); + break; + case 2184: + HASH_INVOKE(0x0125AFE24DC1A888LL, fbml_get_children_by_name_11); + HASH_INVOKE(0x1062CF2DA5443888LL, imagedashedline); + break; + case 2191: + HASH_INVOKE(0x539868C56806688FLL, imagecopyresampled); + break; + case 2200: + HASH_INVOKE(0x4AC522FF7BB60898LL, xmlwriter_write_dtd_entity); + break; + case 2205: + HASH_INVOKE(0x1FC855F0E4F1189DLL, magickminifyimage); + break; + case 2208: + HASH_INVOKE(0x6B1A3BCE67BAC8A0LL, openssl_csr_new); + break; + case 2209: + HASH_INVOKE(0x1756D4437A4098A1LL, date_modify); + break; + case 2215: + HASH_INVOKE(0x57105D4E43B078A7LL, magicksetformat); + HASH_INVOKE(0x6C6B4B739AE1B8A7LL, curl_close); + break; + case 2217: + HASH_INVOKE(0x346B2DB3BA2378A9LL, imagecolormatch); + break; + case 2218: + HASH_INVOKE(0x44BC069A75EE98AALL, xhprof_disable); + break; + case 2219: + HASH_INVOKE(0x39F11BA6A4D778ABLL, strnatcmp); + break; + case 2220: + HASH_INVOKE(0x5B1F4C6424DDD8ACLL, openlog); + break; + case 2224: + HASH_INVOKE(0x2CEF8DDC092698B0LL, drawgetvectorgraphics); + break; + case 2226: + HASH_INVOKE(0x31830AA5032428B2LL, is_double); + break; + case 2236: + HASH_INVOKE(0x7AE3AE9B634988BCLL, stream_context_create); + break; + case 2244: + HASH_INVOKE(0x5C28BE7FFE6A68C4LL, xml_set_start_namespace_decl_handler); + break; + case 2245: + HASH_INVOKE(0x146A1A7658CCA8C5LL, asinh); + break; + case 2247: + HASH_INVOKE(0x4623383F8534E8C7LL, array_multisort); + HASH_INVOKE(0x6D9B9BE3CED388C7LL, apc_load_constants); + break; + case 2254: + HASH_INVOKE(0x3FFAA982E4B1E8CELL, date_offset_get); + break; + case 2257: + HASH_INVOKE(0x1015EB3F52B098D1LL, print); + break; + case 2260: + HASH_INVOKE(0x6DB4EE8696C7E8D4LL, magicksetimageiterations); + break; + case 2262: + HASH_INVOKE(0x2F585B36DDDB68D6LL, mb_convert_case); + HASH_INVOKE(0x26DC8AB4A9CBE8D6LL, iconv); + break; + case 2264: + HASH_INVOKE(0x3A65182A3E8908D8LL, openssl_open); + break; + case 2265: + HASH_INVOKE(0x18B64D6BFE4208D9LL, stream_get_transports); + break; + case 2267: + HASH_INVOKE(0x4052842EC87038DBLL, magickcropimage); + break; + case 2268: + HASH_INVOKE(0x31F50FDA18B888DCLL, magickgetimagetype); + break; + case 2276: + HASH_INVOKE(0x16A18007E10F48E4LL, socket_getsockname); + break; + case 2278: + HASH_INVOKE(0x69887F054A1E28E6LL, strtok); + break; + case 2279: + HASH_INVOKE(0x608729F27FA428E7LL, error_get_last); + break; + case 2280: + HASH_INVOKE(0x4F7ED8C3156AD8E8LL, magicksetimagedispose); + break; + case 2293: + HASH_INVOKE(0x45DA105C5B48F8F5LL, apd_set_pprof_trace); + break; + case 2295: + HASH_INVOKE(0x17582BEA497D48F7LL, ctype_alpha); + break; + case 2298: + HASH_INVOKE(0x6F0F82818B68A8FALL, array_values); + break; + case 2299: + HASH_INVOKE(0x214532C4A2BC28FBLL, ldap_next_entry); + break; + case 2300: + HASH_INVOKE(0x4C2AFB2EFDB1B8FCLL, stripslashes); + break; + case 2302: + HASH_INVOKE(0x047BF4D3D0ED08FELL, strchr); + break; + case 2306: + HASH_INVOKE(0x010760453DD28902LL, fb_run_mcproxy); + break; + case 2315: + HASH_INVOKE(0x67B879A1120C190BLL, headers_sent); + HASH_INVOKE(0x2987B15E11FE890BLL, clock_settime); + break; + case 2316: + HASH_INVOKE(0x72E1EBF65C25F90CLL, oci_fetch_assoc); + break; + case 2321: + HASH_INVOKE(0x04F822B7817E5911LL, bindec); + HASH_INVOKE(0x0AFD4F231D6CB911LL, magickaddimage); + HASH_INVOKE(0x5B9B2C3B32906911LL, drawsetfillpatternurl); + break; + case 2323: + HASH_INVOKE(0x55757E1242390913LL, cos); + break; + case 2324: + HASH_INVOKE(0x6E22C6D840B44914LL, mcrypt_generic_init); + break; + case 2326: + HASH_INVOKE(0x245A2DC3B6B62916LL, apache_lookup_uri); + break; + case 2329: + HASH_INVOKE(0x022B16C0D64D7919LL, file_put_contents); + HASH_INVOKE(0x4AA4DD47E99E5919LL, oci_bind_array_by_name); + break; + case 2333: + HASH_INVOKE(0x069C028EFEF8C91DLL, date); + break; + case 2335: + HASH_INVOKE(0x277D7E2D1F5C191FLL, drawpathcurvetoquadraticbezierrelative); + HASH_INVOKE(0x4E2C55C92D71F91FLL, magickcolorfloodfillimage); + break; + case 2337: + HASH_INVOKE(0x0F5917FFCDD6C921LL, mb_substr); + break; + case 2339: + HASH_INVOKE(0x044B276686B77923LL, fscanf); + break; + case 2349: + HASH_INVOKE(0x27363CE6CBFC392DLL, pcntl_wexitstatus); + HASH_INVOKE(0x2337F8C3EE17192DLL, sprintf); + break; + case 2350: + HASH_INVOKE(0x26E8B741BDDDC92ELL, xmlwriter_start_element); + break; + case 2352: + HASH_INVOKE(0x507CE1912FD74930LL, mail); + HASH_INVOKE(0x30972530BD557930LL, shell_exec); + break; + case 2354: + HASH_INVOKE(0x72C01E1D90BE5932LL, mcrypt_enc_get_block_size); + break; + case 2356: + HASH_INVOKE(0x4FB95164A5F84934LL, mcrypt_generic_end); + break; + case 2357: + HASH_INVOKE(0x46BD9A56BDE40935LL, mysql_escape_string); + HASH_INVOKE(0x06486B6912479935LL, zlib_get_coding_type); + HASH_INVOKE(0x48D3CA6CA0B29935LL, mb_regex_set_options); + break; + case 2359: + HASH_INVOKE(0x0447476ED176F937LL, oci_bind_by_name); + break; + case 2361: + HASH_INVOKE(0x5B60C8396C624939LL, mb_substitute_character); + break; + case 2366: + HASH_INVOKE(0x0CADFE289C92893ELL, socket_getpeername); + break; + case 2371: + HASH_INVOKE(0x7C565AD57BC84943LL, pixelsetindex); + break; + case 2373: + HASH_INVOKE(0x7CB0596B6CCFA945LL, split); + break; + case 2375: + HASH_INVOKE(0x630288865DE68947LL, php_strip_whitespace); + break; + case 2376: + HASH_INVOKE(0x6A3412DE82715948LL, openssl_x509_checkpurpose); + break; + case 2377: + HASH_INVOKE(0x243BB8B284895949LL, apache_get_rewrite_rules); + break; + case 2379: + HASH_INVOKE(0x37F356F578FA394BLL, substr); + break; + case 2381: + HASH_INVOKE(0x3D3AD12E52FF294DLL, imagecreatefromwbmp); + break; + case 2387: + HASH_INVOKE(0x068438AFD33A9953LL, imagecolorclosesthwb); + break; + case 2391: + HASH_INVOKE(0x253AC5D4E450A957LL, magickgetreleasedate); + break; + case 2394: + HASH_INVOKE(0x7056E766A274895ALL, virtual); + break; + case 2397: + HASH_INVOKE(0x21DBCE74EB1FC95DLL, xmlwriter_text); + break; + case 2401: + HASH_INVOKE(0x5EA7052A00E88961LL, magickgetcopyright); + break; + case 2407: + HASH_INVOKE(0x1419B3BF428B2967LL, evhttp_async_post); + break; + case 2415: + HASH_INVOKE(0x134EF88685C0396FLL, magickgetexceptiontype); + break; + case 2417: + HASH_INVOKE(0x442A28FB6F6C3971LL, xmlwriter_start_attribute); + HASH_INVOKE(0x72C73F5DA7D6F971LL, magickgetimagecolormapcolor); + break; + case 2418: + HASH_INVOKE(0x758263CEBF2E8972LL, assert_options); + break; + case 2421: + HASH_INVOKE(0x7E26D48503362975LL, drawpathcurvetoabsolute); + HASH_INVOKE(0x488141281A75E975LL, imagecreatefromgif); + break; + case 2423: + HASH_INVOKE(0x0C16C797916C2977LL, posix_setegid); + break; + case 2430: + HASH_INVOKE(0x5067A65AD1D0297ELL, pixelgetiteratorexception); + break; + case 2432: + HASH_INVOKE(0x3D3445105C335980LL, filectime); + break; + case 2434: + HASH_INVOKE(0x214EA70BDD8FB982LL, magickmorphimages); + break; + case 2435: + HASH_INVOKE(0x3DA64BF893DBF983LL, strncmp); + break; + case 2436: + HASH_INVOKE(0x2B2A9D6B27656984LL, oci_new_connect); + break; + case 2438: + HASH_INVOKE(0x6ECE4BDB8842E986LL, posix_strerror); + break; + case 2439: + HASH_INVOKE(0x22B3CF8DD3D1A987LL, pixelsynciterator); + break; + case 2440: + HASH_INVOKE(0x489355BDBE396988LL, drawsettextencoding); + HASH_INVOKE(0x55BE7AE8DEF3F988LL, magickgetstringheight); + break; + case 2443: + HASH_INVOKE(0x0E863EF8C11A598BLL, is_writable); + break; + case 2445: + HASH_INVOKE(0x23DEB9C15DF9D98DLL, oci_commit); + HASH_INVOKE(0x69003892F71C798DLL, apache_get_scoreboard); + HASH_INVOKE(0x651A8CBB8D2A398DLL, mysql_stat); + break; + case 2446: + HASH_INVOKE(0x333D4DFD4927898ELL, magickgetimagewhitepoint); + break; + case 2456: + HASH_INVOKE(0x501AAD31C8086998LL, posix_getcwd); + break; + case 2459: + HASH_INVOKE(0x564D8D3DA1E8E99BLL, xml_get_current_line_number); + break; + case 2462: + HASH_INVOKE(0x59D2DFF08F4DB99ELL, imagecreate); + break; + case 2466: + HASH_INVOKE(0x01D2367A02F0A9A2LL, magicksetsize); + HASH_INVOKE(0x3FE0D440B157A9A2LL, oci_field_precision); + break; + case 2467: + HASH_INVOKE(0x43D1339C52E309A3LL, hphp_service_thread_started); + HASH_INVOKE(0x78261FA60B8D89A3LL, imagepsloadfont); + break; + case 2468: + HASH_INVOKE(0x6F8676B049C919A4LL, array_intersect_uassoc); + break; + case 2469: + HASH_INVOKE(0x76988956F35329A5LL, xmlwriter_end_cdata); + break; + case 2473: + HASH_INVOKE(0x6F9CF95104CAE9A9LL, pixelgetyellowquantum); + break; + case 2476: + HASH_INVOKE(0x522256BAA78159ACLL, popen); + HASH_INVOKE(0x1D4F0A3AEA18F9ACLL, oci_server_version); + break; + case 2477: + HASH_INVOKE(0x05C5AD90751159ADLL, drawpathcurvetoquadraticbeziersmoothabsolute); + break; + case 2479: + HASH_INVOKE(0x25268012A48A99AFLL, magickclipimage); + break; + case 2481: + HASH_INVOKE(0x7C1CE38F14E529B1LL, date_default_timezone_set); + break; + case 2482: + HASH_INVOKE(0x65D7CBE8681CE9B2LL, gzgetss); + break; + case 2486: + HASH_INVOKE(0x5FC1B94446EA59B6LL, magickremoveimageprofiles); + break; + case 2487: + HASH_INVOKE(0x18F2C246FACAD9B7LL, each); + break; + case 2488: + HASH_INVOKE(0x3741447B159359B8LL, mcrypt_get_cipher_name); + HASH_INVOKE(0x4EFD7A9C90E559B8LL, posix_ttyname); + break; + case 2489: + HASH_INVOKE(0x145702974C97F9B9LL, ltrim); + break; + case 2490: + HASH_INVOKE(0x13B3172E092D99BALL, is_dir); + break; + case 2493: + HASH_INVOKE(0x6325F56D49E6F9BDLL, fb_get_derived_classes); + break; + case 2494: + HASH_INVOKE(0x458B5ABEDAC1C9BELL, disk_free_space); + break; + case 2497: + HASH_INVOKE(0x2A87F980E2A2B9C1LL, hotprofiler_enable); + break; + case 2498: + HASH_INVOKE(0x6A7BDB900E7429C2LL, magickconstituteimage); + break; + case 2500: + HASH_INVOKE(0x47B7D3745D80B9C4LL, socket_get_option); + break; + case 2503: + HASH_INVOKE(0x6ECDF24B29D789C7LL, strtolower); + break; + case 2506: + HASH_INVOKE(0x5C5B0CC85133B9CALL, mkdir); + break; + case 2509: + HASH_INVOKE(0x4E61FE901C1C29CDLL, array_intersect_key); + break; + case 2510: + HASH_INVOKE(0x7A9FB932873D09CELL, gmmktime); + break; + case 2511: + HASH_INVOKE(0x415B91CAEE0689CFLL, magickgetimageinterlacescheme); + break; + case 2514: + HASH_INVOKE(0x3DCCD1FEAD8759D2LL, array_sum); + break; + case 2515: + HASH_INVOKE(0x1C31A9E1207209D3LL, mb_split); + HASH_INVOKE(0x10C82F357BB7E9D3LL, curl_version); + HASH_INVOKE(0x25CA0299103F49D3LL, magickgetsize); + break; + case 2517: + HASH_INVOKE(0x245860A2FE4CB9D5LL, socket_set_blocking); + break; + case 2523: + HASH_INVOKE(0x48B2E069B89489DBLL, magickappendimages); + break; + case 2526: + HASH_INVOKE(0x5C039967E60089DELL, array_intersect_ukey); + break; + case 2527: + HASH_INVOKE(0x349E2E0F2CD7B9DFLL, magickgetversion); + break; + case 2534: + HASH_INVOKE(0x1B44CF284E9B09E6LL, interface_exists); + break; + case 2537: + HASH_INVOKE(0x4ADFA265F07AB9E9LL, drawgettextalignment); + HASH_INVOKE(0x6A45EB471332A9E9LL, imagecolorexactalpha); + HASH_INVOKE(0x330EE2729DB7C9E9LL, drawgetfontstretch); + break; + case 2538: + HASH_INVOKE(0x25DDD924EFE979EALL, hash_update_file); + break; + case 2539: + HASH_INVOKE(0x71B0FF80B88459EBLL, diskfreespace); + break; + case 2543: + HASH_INVOKE(0x7EA6200B688459EFLL, ldap_modify); + break; + case 2544: + HASH_INVOKE(0x1FC307200E8959F0LL, stream_bucket_append); + break; + case 2547: + HASH_INVOKE(0x6535B60A4BC449F3LL, dns_get_record); + break; + case 2548: + HASH_INVOKE(0x51201EE65BC729F4LL, localtime); + break; + case 2549: + HASH_INVOKE(0x2BC61637253BE9F5LL, drawgetfontweight); + HASH_INVOKE(0x35BABFBC091759F5LL, socket_server); + break; + case 2557: + HASH_INVOKE(0x2394D4E030AB69FDLL, getmypid); + break; + case 2564: + HASH_INVOKE(0x17B83C425BD09A04LL, atanh); + break; + case 2567: + HASH_INVOKE(0x391E0A4CF1EC9A07LL, stream_socket_recvfrom); + break; + case 2568: + HASH_INVOKE(0x0436CA4DFB315A08LL, soundex); + break; + case 2571: + HASH_INVOKE(0x70075DC878825A0BLL, ctype_lower); + break; + case 2573: + HASH_INVOKE(0x736C133EFF8E5A0DLL, mysql_list_fields); + HASH_INVOKE(0x50A7146A79877A0DLL, pcntl_alarm); + break; + case 2577: + HASH_INVOKE(0x472CA39715598A11LL, mb_eregi_replace); + break; + case 2579: + HASH_INVOKE(0x08D7F857A0FDAA13LL, fbml_batch_precache_11); + break; + case 2588: + HASH_INVOKE(0x12D49AD562F38A1CLL, date_timezone_get); + break; + case 2592: + HASH_INVOKE(0x2A420675E6AF0A20LL, basename); + break; + case 2593: + HASH_INVOKE(0x14279BB1A6872A21LL, atan2); + break; + case 2595: + HASH_INVOKE(0x71434F6D4842FA23LL, fbml_get_attributes_11); + break; + case 2597: + HASH_INVOKE(0x5EC0A3DD935EEA25LL, magickresampleimage); + HASH_INVOKE(0x1DB9A1FB97A3AA25LL, magicksetimageoption); + break; + case 2601: + HASH_INVOKE(0x618D2A98986B1A29LL, ldap_unbind); + break; + case 2602: + HASH_INVOKE(0x3CAEA6B8D1C92A2ALL, stream_bucket_prepend); + break; + case 2608: + HASH_INVOKE(0x6943B78E10995A30LL, fb_reset_opcode); + break; + case 2609: + HASH_INVOKE(0x1F3E32847C1CCA31LL, mb_ereg_match); + break; + case 2612: + HASH_INVOKE(0x2D948E4099975A34LL, restore_include_path); + HASH_INVOKE(0x5AB266C6E7075A34LL, mysql_error); + break; + case 2616: + HASH_INVOKE(0x3E65EF9761BE5A38LL, pixelgetiteratorexceptiontype); + break; + case 2619: + HASH_INVOKE(0x545A7BE199EC4A3BLL, pcntl_getpriority); + HASH_INVOKE(0x785ECCF53D98BA3BLL, curl_multi_exec); + break; + case 2620: + HASH_INVOKE(0x21DF7BAEEFABCA3CLL, umask); + break; + case 2621: + HASH_INVOKE(0x2468D7D3685C3A3DLL, fbml_sanitize_js_11); + break; + case 2622: + HASH_INVOKE(0x31C3A072D092FA3ELL, socket_create_listen); + break; + case 2623: + HASH_INVOKE(0x4C0E2C6882051A3FLL, magickgetresourcelimit); + break; + case 2624: + HASH_INVOKE(0x4926EE59103B2A40LL, destroydrawingwand); + HASH_INVOKE(0x682C14726D484A40LL, fileatime); + break; + case 2626: + HASH_INVOKE(0x128914E131AFFA42LL, microtime); + HASH_INVOKE(0x5FF7C3A6BDDCFA42LL, mb_convert_kana); + break; + case 2628: + HASH_INVOKE(0x7F6A6306BBE8AA44LL, imagelayereffect); + break; + case 2631: + HASH_INVOKE(0x1B45CFF586F85A47LL, utf8_encode); + break; + case 2647: + HASH_INVOKE(0x5088945958DD4A57LL, mktime); + HASH_INVOKE(0x7E929ED7D9BE6A57LL, ini_get); + break; + case 2648: + HASH_INVOKE(0x6E823A722DE1EA58LL, stream_socket_client); + break; + case 2651: + HASH_INVOKE(0x2B18DFF183C0BA5BLL, mb_get_info); + break; + case 2653: + HASH_INVOKE(0x7E1E9C4C3D4E8A5DLL, stream_select); + break; + case 2654: + HASH_INVOKE(0x2C6826999658AA5ELL, getopt); + break; + case 2655: + HASH_INVOKE(0x7CAE3FE798EC0A5FLL, php_logo_guid); + break; + case 2661: + HASH_INVOKE(0x469199B8FD886A65LL, putenv); + HASH_INVOKE(0x3590F3AAC94E0A65LL, array_change_key_case); + break; + case 2662: + HASH_INVOKE(0x60C4B9EEDBD5FA66LL, pos); + break; + case 2664: + HASH_INVOKE(0x01DD2057FD9B1A68LL, xmlwriter_write_cdata); + HASH_INVOKE(0x32AD0455A7689A68LL, magickoilpaintimage); + break; + case 2665: + HASH_INVOKE(0x10CDCF2BB4057A69LL, debug_zval_dump); + break; + case 2667: + HASH_INVOKE(0x0912965F4440FA6BLL, str_repeat); + break; + case 2673: + HASH_INVOKE(0x5B5DA6AD0AD63A71LL, drawannotation); + break; + case 2674: + HASH_INVOKE(0x71AFF1D58D103A72LL, imagefontheight); + break; + case 2677: + HASH_INVOKE(0x7A957BEC6CA57A75LL, preg_replace_callback); + break; + case 2681: + HASH_INVOKE(0x28AC28C54C4E6A79LL, openssl_error_string); + break; + case 2685: + HASH_INVOKE(0x414C2E31304E9A7DLL, stream_get_filters); + break; + case 2690: + HASH_INVOKE(0x258205B54DC06A82LL, newpixelwands); + HASH_INVOKE(0x79786FABC5551A82LL, jpeg2wbmp); + break; + case 2691: + HASH_INVOKE(0x11149278DB0A9A83LL, levenshtein); + break; + case 2692: + HASH_INVOKE(0x08C1A5A05B6A0A84LL, ob_get_length); + break; + case 2693: + HASH_INVOKE(0x755DEFDEDF35DA85LL, ctype_print); + HASH_INVOKE(0x2180916F8D4F6A85LL, drawcomment); + break; + case 2695: + HASH_INVOKE(0x7C5A22328CAB4A87LL, ereg_replace); + break; + case 2696: + HASH_INVOKE(0x1818A3CFBA357A88LL, magicksetwandsize); + break; + case 2699: + HASH_INVOKE(0x7ACBCD9CF335AA8BLL, xmlwriter_start_document); + break; + case 2700: + HASH_INVOKE(0x6A2EEE463F969A8CLL, getservbyname); + break; + case 2701: + HASH_INVOKE(0x7202579D23243A8DLL, hotprofiler_disable); + break; + case 2706: + HASH_INVOKE(0x1257DB9F159E9A92LL, magickmontageimage); + break; + case 2707: + HASH_INVOKE(0x4A32653C8E719A93LL, pixelgetcyan); + break; + case 2708: + HASH_INVOKE(0x465E6C67F885AA94LL, drawgetstrokelinejoin); + HASH_INVOKE(0x7761D019E0B5EA94LL, magickstripimage); + HASH_INVOKE(0x4B1501C4C22FFA94LL, quoted_printable_encode); + HASH_INVOKE(0x0AC7CBCE30442A94LL, imagepalettecopy); + break; + case 2709: + HASH_INVOKE(0x34B8A4E5AE0EFA95LL, pixelgetopacity); + break; + case 2711: + HASH_INVOKE(0x0089115038C03A97LL, array_diff_ukey); + break; + case 2714: + HASH_INVOKE(0x19AFF8596E19DA9ALL, xhprof_enable); + break; + case 2717: + HASH_INVOKE(0x1234AB687C515A9DLL, mb_encode_numericentity); + break; + case 2719: + HASH_INVOKE(0x2E5E23ECA0525A9FLL, bcadd); + break; + case 2720: + HASH_INVOKE(0x55FAF12AF1920AA0LL, sha1_file); + break; + case 2723: + HASH_INVOKE(0x2B75B48A53AACAA3LL, imagestring); + break; + case 2725: + HASH_INVOKE(0x2418528164415AA5LL, magickscaleimage); + HASH_INVOKE(0x421C6B40EB370AA5LL, ldap_sasl_bind); + break; + case 2726: + HASH_INVOKE(0x4BBA1E164DF9CAA6LL, localeconv); + break; + case 2727: + HASH_INVOKE(0x797CEC173CBB7AA7LL, ob_get_flush); + HASH_INVOKE(0x61FC96080D1AFAA7LL, fbml_get_children_11); + break; + case 2729: + HASH_INVOKE(0x2238FC7870E9CAA9LL, strspn); + break; + case 2731: + HASH_INVOKE(0x1331979EF8EF0AABLL, mb_ereg_search); + break; + case 2732: + HASH_INVOKE(0x18CF3E4A60E4AAACLL, pi); + break; + case 2738: + HASH_INVOKE(0x569EED88F20BAAB2LL, drawgettextundercolor); + HASH_INVOKE(0x62519270CC9F1AB2LL, stream_get_meta_data); + break; + case 2740: + HASH_INVOKE(0x1BAFB965204D0AB4LL, openssl_x509_check_private_key); + break; + case 2747: + HASH_INVOKE(0x4B3B35D3C145FABBLL, fb_backtrace); + break; + case 2751: + HASH_INVOKE(0x030DFC3D3C88BABFLL, filegroup); + break; + case 2757: + HASH_INVOKE(0x3754E97715176AC5LL, hphp_get_stats); + break; + case 2759: + HASH_INVOKE(0x5D2F899A270D9AC7LL, xmlwriter_end_dtd_element); + HASH_INVOKE(0x79215854355CBAC7LL, proc_get_status); + HASH_INVOKE(0x3886D2664F874AC7LL, openssl_pkcs7_verify); + break; + case 2761: + HASH_INVOKE(0x5CA9671385EF0AC9LL, sem_release); + break; + case 2762: + HASH_INVOKE(0x45B30CD663284ACALL, is_int); + break; + case 2763: + HASH_INVOKE(0x348888DDF223AACBLL, mt_getrandmax); + break; + case 2764: + HASH_INVOKE(0x3632B44502F9BACCLL, fql_parse_10); + HASH_INVOKE(0x750D0396676E6ACCLL, imagecolorexact); + HASH_INVOKE(0x2BD6476D2C467ACCLL, pagelet_server_task_status); + break; + case 2765: + HASH_INVOKE(0x173EDC165B673ACDLL, magicktransformimage); + break; + case 2769: + HASH_INVOKE(0x47E2B4F7B8DE5AD1LL, xmlwriter_write_dtd_attlist); + HASH_INVOKE(0x314317450857FAD1LL, ctype_punct); + break; + case 2773: + HASH_INVOKE(0x0D5DAF8034B41AD5LL, get_include_path); + break; + case 2774: + HASH_INVOKE(0x231BCE6071220AD6LL, drawcircle); + break; + case 2776: + HASH_INVOKE(0x52401023E146AAD8LL, xmlwriter_end_dtd); + break; + case 2779: + HASH_INVOKE(0x24771ED112008ADBLL, echo); + break; + case 2780: + HASH_INVOKE(0x547E7EE64761AADCLL, imagecreatefromxbm); + break; + case 2781: + HASH_INVOKE(0x3E319E451A32FADDLL, magicksharpenimage); + break; + case 2788: + HASH_INVOKE(0x47B15A7136E94AE4LL, strnatcasecmp); + HASH_INVOKE(0x1827F1C22F1CCAE4LL, hebrevc); + break; + case 2790: + HASH_INVOKE(0x0E09D0FEA30B6AE6LL, hphp_get_function_info); + break; + case 2795: + HASH_INVOKE(0x225F05071947BAEBLL, drawpathlinetoabsolute); + break; + case 2797: + HASH_INVOKE(0x46C33B4739C2FAEDLL, shm_remove_var); + break; + case 2798: + HASH_INVOKE(0x160A82E3E2CBBAEELL, is_finite); + break; + case 2800: + HASH_INVOKE(0x6B259D5D9D681AF0LL, register_postsend_function); + break; + case 2804: + HASH_INVOKE(0x2EC0ABF9A979FAF4LL, ob_get_level); + break; + case 2806: + HASH_INVOKE(0x2C7C9772AE983AF6LL, drawsetgravity); + break; + case 2808: + HASH_INVOKE(0x12859AD75BAF3AF8LL, magickreadimageblob); + break; + case 2813: + HASH_INVOKE(0x16BA422EB6C51AFDLL, gzwrite); + break; + case 2814: + HASH_INVOKE(0x04E86BA79B6CBAFELL, stream_socket_shutdown); + break; + case 2815: + HASH_INVOKE(0x7833F4C337542AFFLL, openssl_pkey_export); + break; + case 2817: + HASH_INVOKE(0x6F3503C7FB12DB01LL, lchgrp); + break; + case 2819: + HASH_INVOKE(0x673A96C50F00FB03LL, str_word_count); + HASH_INVOKE(0x32458C11C6E74B03LL, pixelsetblackquantum); + break; + case 2826: + HASH_INVOKE(0x14B366EF64A66B0ALL, get_loaded_extensions); + HASH_INVOKE(0x14AF32A23B507B0ALL, metaphone); + break; + case 2829: + HASH_INVOKE(0x368DBC0699272B0DLL, magicknegateimage); + break; + case 2836: + HASH_INVOKE(0x76675F14C1138B14LL, gzuncompress); + break; + case 2837: + HASH_INVOKE(0x24D0895FBB7BCB15LL, is_callable); + break; + case 2839: + HASH_INVOKE(0x66F9A476DAB47B17LL, pixelsetcolor); + break; + case 2840: + HASH_INVOKE(0x70448A629A74FB18LL, ksort); + break; + case 2841: + HASH_INVOKE(0x0551EACBE8278B19LL, decoct); + break; + case 2842: + HASH_INVOKE(0x399522EE0CF3EB1ALL, drawsetstrokewidth); + break; + case 2843: + HASH_INVOKE(0x1B7CE8114AEACB1BLL, magickannotateimage); + break; + case 2844: + HASH_INVOKE(0x249399CEC35B7B1CLL, png2wbmp); + break; + case 2845: + HASH_INVOKE(0x6791459B883F0B1DLL, apache_reset_timeout); + break; + case 2846: + HASH_INVOKE(0x7160AA24D4251B1ELL, mb_strripos); + break; + case 2848: + HASH_INVOKE(0x2563BB012A5C3B20LL, oci_define_by_name); + HASH_INVOKE(0x1112712715D75B20LL, pixelgetblackquantum); + break; + case 2853: + HASH_INVOKE(0x798F2776FECAEB25LL, get_required_files); + break; + case 2854: + HASH_INVOKE(0x24CE95457EACBB26LL, get_parent_class); + break; + case 2857: + HASH_INVOKE(0x17C38BE3A6EE8B29LL, mysql_field_flags); + break; + case 2858: + HASH_INVOKE(0x1F4984938E1DBB2ALL, sort); + break; + case 2860: + HASH_INVOKE(0x70742211FA3EFB2CLL, imagettftext); + break; + case 2865: + HASH_INVOKE(0x442B1E05FC146B31LL, stream_context_set_param); + break; + case 2867: + HASH_INVOKE(0x00DCD60DD8752B33LL, set_exception_handler); + HASH_INVOKE(0x4D5D45D1F1EB3B33LL, posix_access); + break; + case 2868: + HASH_INVOKE(0x0B7D52E2540ABB34LL, tan); + break; + case 2869: + HASH_INVOKE(0x78842C1950B38B35LL, drawpathfinish); + break; + case 2871: + HASH_INVOKE(0x053B14F52350FB37LL, socket_shutdown); + break; + case 2872: + HASH_INVOKE(0x68C09D6CB8E79B38LL, class_exists); + break; + case 2873: + HASH_INVOKE(0x02A2C373E54FFB39LL, hash_init); + break; + case 2874: + HASH_INVOKE(0x49A45F75B2B25B3ALL, apd_breakpoint); + break; + case 2876: + HASH_INVOKE(0x35F4A0789F367B3CLL, drawpathlinetohorizontalrelative); + break; + case 2878: + HASH_INVOKE(0x5E2AF775FEB04B3ELL, posix_getppid); + break; + case 2879: + HASH_INVOKE(0x0B07AD87DF1B5B3FLL, urldecode); + break; + case 2880: + HASH_INVOKE(0x24CBCBA5C4407B40LL, evhttp_set_cache); + break; + case 2884: + HASH_INVOKE(0x4E4449EBAADD7B44LL, magickpingimage); + break; + case 2885: + HASH_INVOKE(0x684881C79ED1AB45LL, func_get_args); + HASH_INVOKE(0x72E3AE55A0B33B45LL, ispixelwand); + break; + case 2886: + HASH_INVOKE(0x00D8FE7A00252B46LL, escapeshellarg); + break; + case 2893: + HASH_INVOKE(0x37DF53E4D9348B4DLL, xbox_post_message); + break; + case 2896: + HASH_INVOKE(0x6237393C71E56B50LL, array_fill_keys); + break; + case 2899: + HASH_INVOKE(0x40F0B69D55F7EB53LL, drawsetstrokealpha); + break; + case 2901: + HASH_INVOKE(0x333FB673518A1B55LL, ldap_get_entries); + break; + case 2904: + HASH_INVOKE(0x6158E2E0A5ACCB58LL, idn_to_ascii); + break; + case 2907: + HASH_INVOKE(0x23FD09A13E0D8B5BLL, xmlwriter_open_memory); + break; + case 2913: + HASH_INVOKE(0x7636825871399B61LL, highlight_file); + break; + case 2920: + HASH_INVOKE(0x674F1DA24EDE7B68LL, xmlwriter_end_attribute); + break; + case 2922: + HASH_INVOKE(0x4BD4E9D9D4A56B6ALL, exif_tagname); + break; + case 2923: + HASH_INVOKE(0x5543A0CACD153B6BLL, substr_replace); + HASH_INVOKE(0x1D4136B4CEAE4B6BLL, stripcslashes); + break; + case 2927: + HASH_INVOKE(0x2D8D57FC1DC6CB6FLL, import_request_variables); + break; + case 2928: + HASH_INVOKE(0x1A73FD4416FECB70LL, magickwriteimagefile); + break; + case 2929: + HASH_INVOKE(0x5E5C875DB04CFB71LL, drawrectangle); + break; + case 2933: + HASH_INVOKE(0x42F0AED7599C1B75LL, magickechoimageblob); + break; + case 2934: + HASH_INVOKE(0x2A63A0BF9B7E3B76LL, ini_alter); + break; + case 2935: + HASH_INVOKE(0x7F5F29D8E63ABB77LL, mcrypt_module_self_test); + HASH_INVOKE(0x5025B43B46679B77LL, openssl_x509_free); + break; + case 2937: + HASH_INVOKE(0x31242F51AA828B79LL, drawpoppattern); + break; + case 2940: + HASH_INVOKE(0x3A096F905FBF7B7CLL, magickcommentimage); + break; + case 2941: + HASH_INVOKE(0x28DE19828167FB7DLL, magickmapimage); + break; + case 2943: + HASH_INVOKE(0x308C90AD9478CB7FLL, substr_compare); + break; + case 2946: + HASH_INVOKE(0x5BDE96FD5015AB82LL, base_convert); + break; + case 2949: + HASH_INVOKE(0x41F8FDD700C0CB85LL, socket_last_error); + break; + case 2955: + HASH_INVOKE(0x3B72159A4B04FB8BLL, set_time_limit); + break; + case 2957: + HASH_INVOKE(0x3B831DB1A615FB8DLL, xhprof_sample_enable); + break; + case 2958: + HASH_INVOKE(0x62A4D7A03F7C3B8ELL, ceil); + break; + case 2965: + HASH_INVOKE(0x687104D0A7C11B95LL, oci_new_descriptor); + break; + case 2967: + HASH_INVOKE(0x09837A82A928AB97LL, is_null); + break; + case 2969: + HASH_INVOKE(0x076E66D4089A3B99LL, mb_stripos); + break; + case 2970: + HASH_INVOKE(0x023133732CB51B9ALL, exif_thumbnail); + break; + case 2975: + HASH_INVOKE(0x390A267EC6B51B9FLL, socket_sendto); + break; + case 2978: + HASH_INVOKE(0x4870ADD98EE02BA2LL, pcntl_wifsignaled); + break; + case 2979: + HASH_INVOKE(0x444A3375EFBC2BA3LL, openssl_public_decrypt); + break; + case 2980: + HASH_INVOKE(0x0D95DD13A2D3BBA4LL, drawtranslate); + break; + case 2983: + HASH_INVOKE(0x6DFBC598BA473BA7LL, fbml_get_tag_name_11); + break; + case 2986: + HASH_INVOKE(0x7C833A303C7CFBAALL, getrandmax); + break; + case 2987: + HASH_INVOKE(0x006481EAF2A70BABLL, ldap_errno); + break; + case 2991: + HASH_INVOKE(0x6A2236CDDFF12BAFLL, magickhaspreviousimage); + break; + case 2992: + HASH_INVOKE(0x1F3E4C6660247BB0LL, imagecolorresolve); + HASH_INVOKE(0x7D9BF61D6CDE3BB0LL, fb_parallel_query); + break; + case 2993: + HASH_INVOKE(0x04A24B397CF46BB1LL, strrchr); + break; + case 2997: + HASH_INVOKE(0x3F7DCC3A00800BB5LL, imagecolorallocate); + break; + case 2998: + HASH_INVOKE(0x3AD840AB993DDBB6LL, ldap_8859_to_t61); + break; + case 3004: + HASH_INVOKE(0x43B74276235F4BBCLL, is_bool); + break; + case 3006: + HASH_INVOKE(0x79617ED8EFD1ABBELL, get_class_vars); + HASH_INVOKE(0x3F56AF1511AEDBBELL, magicklabelimage); + HASH_INVOKE(0x5ECB0B145B88EBBELL, imagefilledarc); + HASH_INVOKE(0x42684202E2E62BBELL, mcrypt_get_iv_size); + break; + case 3015: + HASH_INVOKE(0x10C5CF7B55173BC7LL, settype); + break; + case 3017: + HASH_INVOKE(0x0B4E7B9180C4ABC9LL, xml_set_end_namespace_decl_handler); + HASH_INVOKE(0x22BA0903D344CBC9LL, array_rand); + break; + case 3021: + HASH_INVOKE(0x22251ECF8CD58BCDLL, array_product); + HASH_INVOKE(0x53A88C8F973CFBCDLL, apc_clear_cache); + break; + case 3022: + HASH_INVOKE(0x45D6BA980AFFDBCELL, msg_get_queue); + HASH_INVOKE(0x600AFF0A6378ABCELL, is_writeable); + break; + case 3024: + HASH_INVOKE(0x7046755D8374EBD0LL, ctype_digit); + break; + case 3026: + HASH_INVOKE(0x6FE3C5FF5E883BD2LL, round); + break; + case 3028: + HASH_INVOKE(0x5B2F2A23D8368BD4LL, magickraiseimage); + HASH_INVOKE(0x4E4EB301A994DBD4LL, drawpolygon); + break; + case 3032: + HASH_INVOKE(0x21E44C7C7A911BD8LL, phpinfo); + break; + case 3038: + HASH_INVOKE(0x58D0D9B66F045BDELL, strpos); + break; + case 3040: + HASH_INVOKE(0x2E10B74DC6067BE0LL, strip_tags); + break; + case 3041: + HASH_INVOKE(0x25FBB61480091BE1LL, mysql_client_encoding); + break; + case 3047: + HASH_INVOKE(0x1BB5D99C1D29CBE7LL, strstr); + break; + case 3048: + HASH_INVOKE(0x4E903B706977ABE8LL, imagepsslantfont); + break; + case 3051: + HASH_INVOKE(0x505B44DDF2383BEBLL, drawgetfillcolor); + HASH_INVOKE(0x0C1904372E8EDBEBLL, stream_copy_to_stream); + break; + case 3052: + HASH_INVOKE(0x44279BB3E2191BECLL, socket_accept); + break; + case 3054: + HASH_INVOKE(0x03F50E435DE20BEELL, magickclippathimage); + HASH_INVOKE(0x790B7C44A3442BEELL, asort); + break; + case 3056: + HASH_INVOKE(0x187C049E785A1BF0LL, iconv_get_encoding); + HASH_INVOKE(0x04C0582DB1AD7BF0LL, mt_srand); + break; + case 3057: + HASH_INVOKE(0x0CA96856E5BEFBF1LL, iptcparse); + break; + case 3060: + HASH_INVOKE(0x1444DB037B4D5BF4LL, imagegammacorrect); + break; + case 3062: + HASH_INVOKE(0x08B4BEBAB3312BF6LL, image_type_to_extension); + break; + case 3063: + HASH_INVOKE(0x74ABB4A1E10BBBF7LL, time); + break; + case 3065: + HASH_INVOKE(0x5B7F6E0A642BBBF9LL, sleep); + break; + case 3068: + HASH_INVOKE(0x64F52E1DB5E95BFCLL, curl_multi_remove_handle); + break; + case 3074: + HASH_INVOKE(0x249340DF734D9C02LL, magickgetimageheight); + break; + case 3077: + HASH_INVOKE(0x2EC378A759F9EC05LL, xbox_task_status); + break; + case 3080: + HASH_INVOKE(0x48E1616EE837FC08LL, is_uploaded_file); + break; + case 3083: + HASH_INVOKE(0x0EEE484739520C0BLL, magickthresholdimage); + HASH_INVOKE(0x0833BCE91C40CC0BLL, magickqueryconfigureoption); + break; + case 3090: + HASH_INVOKE(0x510B683F2E764C12LL, fb_load_local_databases); + break; + case 3099: + HASH_INVOKE(0x67742A0F218F6C1BLL, posix_initgroups); + HASH_INVOKE(0x7D615C7E3ADB2C1BLL, xmlwriter_write_comment); + break; + case 3100: + HASH_INVOKE(0x758A62BD65E6FC1CLL, imagegd2); + break; + case 3102: + HASH_INVOKE(0x7039C5EBB1D6BC1ELL, array_walk); + break; + case 3103: + HASH_INVOKE(0x3A5D921797669C1FLL, hphp_log); + HASH_INVOKE(0x0D321888A29C6C1FLL, oci_fetch_object); + break; + case 3104: + HASH_INVOKE(0x7BD43EB167198C20LL, xmlwriter_write_pi); + break; + case 3105: + HASH_INVOKE(0x0179CBA2C5F4DC21LL, magickgetimageformat); + break; + case 3111: + HASH_INVOKE(0x5A02EE8ED39F0C27LL, posix_getgrnam); + break; + case 3112: + HASH_INVOKE(0x79A4E240F18BAC28LL, rand); + break; + case 3116: + HASH_INVOKE(0x116C3EC924B9AC2CLL, imagegd); + break; + case 3122: + HASH_INVOKE(0x0B9B362534621C32LL, isdrawingwand); + break; + case 3123: + HASH_INVOKE(0x49965C44E9EE3C33LL, set_file_buffer); + break; + case 3128: + HASH_INVOKE(0x21564F9315F3FC38LL, drawsettextdecoration); + break; + case 3134: + HASH_INVOKE(0x15EC581662651C3ELL, date_parse); + break; + case 3141: + HASH_INVOKE(0x6EF89BCAD607CC45LL, strncasecmp); + break; + case 3142: + HASH_INVOKE(0x7D992445F5E37C46LL, magicktextureimage); + break; + case 3143: + HASH_INVOKE(0x44055093E56E4C47LL, mcrypt_enc_get_key_size); + break; + case 3146: + HASH_INVOKE(0x3C23768CFB492C4ALL, gzinflate); + break; + case 3148: + HASH_INVOKE(0x0C485E94495F9C4CLL, fbjsparse); + break; + case 3150: + HASH_INVOKE(0x5DAC1C64D8F08C4ELL, openssl_pkey_get_private); + break; + case 3152: + HASH_INVOKE(0x04534F26B8D05C50LL, drawgetstrokecolor); + break; + case 3153: + HASH_INVOKE(0x56EDB60C824E8C51LL, key); + break; + case 3154: + HASH_INVOKE(0x1FC294B806F76C52LL, php_sapi_name); + break; + case 3160: + HASH_INVOKE(0x1B8C3DA27170DC58LL, dirname); + break; + case 3161: + HASH_INVOKE(0x57633BDF8DB3FC59LL, i18n_loc_set_attribute); + break; + case 3165: + HASH_INVOKE(0x1F032B064680FC5DLL, oci_field_type); + break; + case 3169: + HASH_INVOKE(0x6E54EEDA1D887C61LL, magicksetimageinterlacescheme); + HASH_INVOKE(0x5176725DA884DC61LL, curl_setopt); + break; + case 3171: + HASH_INVOKE(0x43C0E9827D502C63LL, array_intersect_assoc); + break; + case 3172: + HASH_INVOKE(0x3409D717D9246C64LL, libxml_use_internal_errors); + break; + case 3175: + HASH_INVOKE(0x07DC355325165C67LL, magickwriteimage); + break; + case 3176: + HASH_INVOKE(0x10D6AE9D688D1C68LL, copy); + break; + case 3178: + HASH_INVOKE(0x41BD9EA0BC5E4C6ALL, move_uploaded_file); + break; + case 3179: + HASH_INVOKE(0x7C6B37BF6300AC6BLL, iconv_mime_encode); + break; + case 3185: + HASH_INVOKE(0x1E074215FE5FCC71LL, set_error_handler); + break; + case 3189: + HASH_INVOKE(0x528366F3195ACC75LL, xbox_task_result); + break; + case 3190: + HASH_INVOKE(0x1C35934C6BC52C76LL, libxml_clear_errors); + HASH_INVOKE(0x296AFFE84B5E4C76LL, oci_fetch_row); + break; + case 3192: + HASH_INVOKE(0x665F08996BD4AC78LL, magicksetimagegreenprimary); + break; + case 3194: + HASH_INVOKE(0x05D7B804ECDE8C7ALL, checkdnsrr); + HASH_INVOKE(0x05F3BC04D61CAC7ALL, get_defined_vars); + break; + case 3201: + HASH_INVOKE(0x767806D6F1053C81LL, sin); + break; + case 3204: + HASH_INVOKE(0x5D49AF7004696C84LL, shm_detach); + break; + case 3205: + HASH_INVOKE(0x56DA17241B793C85LL, mysql_set_timeout); + break; + case 3209: + HASH_INVOKE(0x0F9C0C82F40F2C89LL, pixelsetcyanquantum); + break; + case 3214: + HASH_INVOKE(0x467470230015AC8ELL, mcrypt_module_is_block_algorithm_mode); + break; + case 3215: + HASH_INVOKE(0x4173EFD9A8EECC8FLL, magicknewimage); + break; + case 3216: + HASH_INVOKE(0x05556EDFC1BB0C90LL, mysql_info); + HASH_INVOKE(0x3F0C947E68D02C90LL, ini_get_all); + break; + case 3217: + HASH_INVOKE(0x4E04B71729485C91LL, clonedrawingwand); + HASH_INVOKE(0x78792DE5D00C6C91LL, html_profile); + break; + case 3219: + HASH_INVOKE(0x0F8242C6327B5C93LL, dns_check_record); + break; + case 3222: + HASH_INVOKE(0x47C5BC101A512C96LL, magickquantizeimage); + break; + case 3225: + HASH_INVOKE(0x2EA6E1D600786C99LL, mb_strtoupper); + break; + case 3226: + HASH_INVOKE(0x374F20BDAF709C9ALL, mb_preferred_mime_name); + break; + case 3227: + HASH_INVOKE(0x36F7F9FD7766DC9BLL, xmlwriter_end_comment); + break; + case 3230: + HASH_INVOKE(0x50296037C7968C9ELL, preg_split); + break; + case 3233: + HASH_INVOKE(0x4590B5971EC9ACA1LL, getmygid); + break; + case 3235: + HASH_INVOKE(0x737253E9FC112CA3LL, socket_close); + break; + case 3242: + HASH_INVOKE(0x5B13DE83E2DE0CAALL, oci_rollback); + HASH_INVOKE(0x653C0D78A3501CAALL, oci_fetch_all); + break; + case 3245: + HASH_INVOKE(0x1C1216F2B7C16CADLL, ftell); + break; + case 3246: + HASH_INVOKE(0x3ACD2F1EA5282CAELL, magickmattefloodfillimage); + break; + case 3248: + HASH_INVOKE(0x373B3FADEACB7CB0LL, openssl_private_encrypt); + break; + case 3249: + HASH_INVOKE(0x735555B148E58CB1LL, ldap_read); + break; + case 3250: + HASH_INVOKE(0x56023CC5ECC9ECB2LL, dns_get_mx); + break; + case 3252: + HASH_INVOKE(0x41FBEF9F7A024CB4LL, xmlwriter_end_element); + HASH_INVOKE(0x742AD1AA5A80ECB4LL, output_reset_rewrite_vars); + break; + case 3254: + HASH_INVOKE(0x560637BE51C36CB6LL, ezmlm_hash); + break; + case 3255: + HASH_INVOKE(0x3DFD5CA79919DCB7LL, imageantialias); + HASH_INVOKE(0x39E03AAC188D3CB7LL, magickgetimagecompressionquality); + break; + case 3259: + HASH_INVOKE(0x41D3B07854936CBBLL, token_get_all); + HASH_INVOKE(0x15ACD9F32D214CBBLL, mysql_fetch_lengths); + break; + case 3260: + HASH_INVOKE(0x19C1872E55A7ECBCLL, is_long); + HASH_INVOKE(0x3978BE548631ECBCLL, hash_final); + break; + case 3264: + HASH_INVOKE(0x3033FE14E114FCC0LL, magicksetimageblueprimary); + break; + case 3266: + HASH_INVOKE(0x42BCEFCF899D0CC2LL, magickgetimagecolorspace); + HASH_INVOKE(0x34B6388D7730BCC2LL, drawline); + break; + case 3278: + HASH_INVOKE(0x0183A548B759BCCELL, posix_getpgid); + HASH_INVOKE(0x66273C5932B1FCCELL, clock_gettime); + break; + case 3279: + HASH_INVOKE(0x407B1F3AFEC43CCFLL, pixelgetblue); + break; + case 3281: + HASH_INVOKE(0x576C5DC462663CD1LL, explode); + break; + case 3282: + HASH_INVOKE(0x1FD3FB2AB0F48CD2LL, magickgetimagesignature); + break; + case 3283: + HASH_INVOKE(0x544302E2FAD3FCD3LL, magicknextimage); + break; + case 3284: + HASH_INVOKE(0x323FE1D92C9B3CD4LL, gzdecode); + break; + case 3285: + HASH_INVOKE(0x757BC444FDF79CD5LL, posix_get_last_error); + break; + case 3286: + HASH_INVOKE(0x11166D3106DB6CD6LL, wandhasexception); + break; + case 3289: + HASH_INVOKE(0x27BFAF1293A60CD9LL, ldap_get_dn); + break; + case 3290: + HASH_INVOKE(0x674AA2DBDA5E4CDALL, imageloadfont); + HASH_INVOKE(0x09C6455B4BC6FCDALL, drawsetviewbox); + break; + case 3300: + HASH_INVOKE(0x7CDDF96AFEA2DCE4LL, chunk_split); + break; + case 3306: + HASH_INVOKE(0x5A8AF4F880DA4CEALL, mailparse_msg_extract_whole_part_file); + HASH_INVOKE(0x7821BD05E5228CEALL, imagewbmp); + break; + case 3309: + HASH_INVOKE(0x4952EB6C693ECCEDLL, fbml_parse_opaque_11); + break; + case 3310: + HASH_INVOKE(0x78FFA0E69D6AACEELL, mcrypt_cfb); + break; + case 3311: + HASH_INVOKE(0x6AA89C314C647CEFLL, magickgetimagehistogram); + break; + case 3313: + HASH_INVOKE(0x21C8FC9A94404CF1LL, php_ini_scanned_files); + break; + case 3314: + HASH_INVOKE(0x26C49BBC67475CF2LL, magicksetimagewhitepoint); + break; + case 3315: + HASH_INVOKE(0x5C1F75D51C077CF3LL, pixelgetindex); + break; + case 3319: + HASH_INVOKE(0x1C30C8470100ECF7LL, mcrypt_enc_is_block_mode); + break; + case 3321: + HASH_INVOKE(0x537CF5DE8C43CCF9LL, curl_getinfo); + break; + case 3323: + HASH_INVOKE(0x09B4EE276DCCFCFBLL, mysql_fetch_row); + break; + case 3326: + HASH_INVOKE(0x768F3E6D1CBA5CFELL, socket_recv); + break; + case 3327: + HASH_INVOKE(0x748D3DFF0EB57CFFLL, uniqid); + HASH_INVOKE(0x48A2F2A7A4620CFFLL, pixelsetyellowquantum); + break; + case 3330: + HASH_INVOKE(0x018F22AEA371ED02LL, filemtime); + break; + case 3331: + HASH_INVOKE(0x48EE7157C4392D03LL, apache_getenv); + break; + case 3332: + HASH_INVOKE(0x1248250E701DAD04LL, magickgaussianblurimage); + break; + case 3334: + HASH_INVOKE(0x2BA9FB0F8B76DD06LL, number_format); + break; + case 3335: + HASH_INVOKE(0x19B643D858DC6D07LL, magickgetimagerenderingintent); + break; + case 3337: + HASH_INVOKE(0x153F7DBFC9047D09LL, pixelsetred); + break; + case 3340: + HASH_INVOKE(0x30A8326034801D0CLL, mysql_pconnect); + break; + case 3341: + HASH_INVOKE(0x3ACE8A8BC9ACDD0DLL, iconv_mime_decode); + break; + case 3344: + HASH_INVOKE(0x42BEEC88EE81FD10LL, imagechar); + HASH_INVOKE(0x08F41A00D5D57D10LL, mb_decode_mimeheader); + HASH_INVOKE(0x5CEFA5A265104D10LL, count); + break; + case 3345: + HASH_INVOKE(0x2D484921B5400D11LL, magickradialblurimage); + break; + case 3348: + HASH_INVOKE(0x63837ECAF6235D14LL, preg_replace); + break; + case 3351: + HASH_INVOKE(0x12BB5E00E714ED17LL, magickgetimagecompose); + break; + case 3354: + HASH_INVOKE(0x75DB75CA9DE56D1ALL, xml_parser_get_option); + break; + case 3355: + HASH_INVOKE(0x70C22A7EEF54CD1BLL, ldap_compare); + break; + case 3359: + HASH_INVOKE(0x566465036CCBCD1FLL, min); + break; + case 3365: + HASH_INVOKE(0x71DF0C17F47EDD25LL, getprotobynumber); + break; + case 3368: + HASH_INVOKE(0x7C12261259F87D28LL, mcrypt_enc_is_block_algorithm_mode); + break; + case 3369: + HASH_INVOKE(0x632D50B69429ED29LL, socket_set_block); + break; + case 3370: + HASH_INVOKE(0x7A9C06B9CF853D2ALL, substr_count); + break; + case 3378: + HASH_INVOKE(0x4DAC43060BA57D32LL, stream_wrapper_restore); + break; + case 3383: + HASH_INVOKE(0x3ACF745D381E9D37LL, rtrim); + break; + case 3384: + HASH_INVOKE(0x0BA3AD85EB597D38LL, pagelet_server_task_result); + break; + case 3387: + HASH_INVOKE(0x0784B2B034560D3BLL, destroypixelwand); + HASH_INVOKE(0x6C9AE626DAD02D3BLL, mailparse_msg_extract_part_file); + break; + case 3392: + HASH_INVOKE(0x198627C81DABAD40LL, register_cleanup_function); + break; + case 3393: + HASH_INVOKE(0x6B6DA1EE18673D41LL, xmlwriter_end_dtd_entity); + break; + case 3394: + HASH_INVOKE(0x40497FCA4EC4DD42LL, posix_seteuid); + HASH_INVOKE(0x298BA735FA3ABD42LL, nl_langinfo); + break; + case 3397: + HASH_INVOKE(0x400A44045A999D45LL, rawurlencode); + break; + case 3398: + HASH_INVOKE(0x502CF4EB0A747D46LL, magicksetimagebias); + HASH_INVOKE(0x455DB7F86BCEDD46LL, pixelsetopacityquantum); + HASH_INVOKE(0x59AD2C922FF75D46LL, mdecrypt_generic); + break; + case 3400: + HASH_INVOKE(0x1C6F3EB2B6B16D48LL, phprof_disable); + break; + case 3401: + HASH_INVOKE(0x113ED435AEFDDD49LL, imagecolorallocatealpha); + HASH_INVOKE(0x41785512C45FCD49LL, mysql_ping); + break; + case 3407: + HASH_INVOKE(0x0FBCF35ADD209D4FLL, drawarc); + break; + case 3408: + HASH_INVOKE(0x39B11A2A25E40D50LL, mysql_get_server_info); + HASH_INVOKE(0x337D2252CDA22D50LL, is_real); + break; + case 3413: + HASH_INVOKE(0x36D672EF4FBEFD55LL, json_encode); + break; + case 3418: + HASH_INVOKE(0x4ACCF26A7AE80D5ALL, imagefilltoborder); + break; + case 3419: + HASH_INVOKE(0x41B5E3D2AADE2D5BLL, drawroundrectangle); + break; + case 3420: + HASH_INVOKE(0x1371413B4F6F8D5CLL, pixelgetred); + break; + case 3424: + HASH_INVOKE(0x6FACBD7F02B6FD60LL, uasort); + HASH_INVOKE(0x567276D68FE12D60LL, preg_quote); + break; + case 3425: + HASH_INVOKE(0x34F150F3D94E6D61LL, gzpassthru); + HASH_INVOKE(0x357BAB6E700EBD61LL, destroypixelwandarray); + break; + case 3427: + HASH_INVOKE(0x470A406564DBAD63LL, oci_field_type_raw); + break; + case 3430: + HASH_INVOKE(0x0C393EE8F6540D66LL, bccomp); + break; + case 3434: + HASH_INVOKE(0x6F37BD7643602D6ALL, fbml_flatten_11); + break; + case 3437: + HASH_INVOKE(0x21D924BA98BFCD6DLL, file_get_contents); + HASH_INVOKE(0x7D9E024FD8696D6DLL, get_class); + HASH_INVOKE(0x4351AFD0FD818D6DLL, magickmotionblurimage); + break; + case 3438: + HASH_INVOKE(0x0B1348D1540E7D6ELL, magicksetimageformat); + break; + case 3443: + HASH_INVOKE(0x7D8DCC72522CBD73LL, mb_detect_encoding); + break; + case 3446: + HASH_INVOKE(0x7467E8107EF08D76LL, unpack); + break; + case 3447: + HASH_INVOKE(0x3ED49C2BBDDFAD77LL, ldap_next_reference); + break; + case 3448: + HASH_INVOKE(0x6352349F97557D78LL, stream_socket_get_name); + break; + case 3451: + HASH_INVOKE(0x680A7EB3DA1F5D7BLL, prev); + break; + case 3454: + HASH_INVOKE(0x384E8BC9B5FE2D7ELL, magickfximage); + break; + case 3455: + HASH_INVOKE(0x4E19AFB75A62AD7FLL, imagerotate); + break; + case 3457: + HASH_INVOKE(0x25EA810DAEA74D81LL, ob_clean); + break; + case 3458: + HASH_INVOKE(0x2D15262403ADDD82LL, drawcomposite); + break; + case 3459: + HASH_INVOKE(0x1B0FF5C02F571D83LL, fb_rename_function); + break; + case 3463: + HASH_INVOKE(0x344091B785FE8D87LL, socket_set_timeout); + break; + case 3464: + HASH_INVOKE(0x2AFF8525E93D6D88LL, drawsetfillopacity); + break; + case 3465: + HASH_INVOKE(0x230E7AD147721D89LL, end); + break; + case 3470: + HASH_INVOKE(0x6A351AEDFC4D0D8ELL, magickgetimagemimetype); + break; + case 3471: + HASH_INVOKE(0x1806DC9468882D8FLL, gzfile); + break; + case 3472: + HASH_INVOKE(0x5E4360FC28D0AD90LL, magicksetinterlacescheme); + break; + case 3473: + HASH_INVOKE(0x48444F8F18E60D91LL, strftime); + HASH_INVOKE(0x7C2B3FE61FBDFD91LL, openssl_pkey_get_details); + break; + case 3480: + HASH_INVOKE(0x06A796D329C21D98LL, call_user_func); + break; + case 3486: + HASH_INVOKE(0x30C1AE2B06990D9ELL, gzseek); + break; + case 3488: + HASH_INVOKE(0x73B43ABDD5C61DA0LL, shuffle); + HASH_INVOKE(0x5E8606470A09BDA0LL, magickposterizeimage); + HASH_INVOKE(0x7084C6294240CDA0LL, octdec); + HASH_INVOKE(0x167A11C41EB71DA0LL, pixelgetexceptiontype); + break; + case 3490: + HASH_INVOKE(0x71583A8FEF5C7DA2LL, sys_get_temp_dir); + break; + case 3494: + HASH_INVOKE(0x28DC1AD6DA9E7DA6LL, gethostbyname); + break; + case 3496: + HASH_INVOKE(0x572AE270D9E4FDA8LL, socket_set_option); + HASH_INVOKE(0x474A096265502DA8LL, glob); + break; + case 3498: + HASH_INVOKE(0x6326C14D0FFA7DAALL, fb_thrift_serialize); + break; + case 3499: + HASH_INVOKE(0x188720048AB37DABLL, magickquantizeimages); + HASH_INVOKE(0x66764CAABFF4CDABLL, array_keys); + break; + case 3506: + HASH_INVOKE(0x257371BC40186DB2LL, magickblurimage); + break; + case 3507: + HASH_INVOKE(0x53F2C6F5AE244DB3LL, drawpushdefs); + break; + case 3512: + HASH_INVOKE(0x2B1D442AEA06ADB8LL, strpbrk); + break; + case 3514: + HASH_INVOKE(0x5E0C6E797607DDBALL, mysql_result); + HASH_INVOKE(0x7964DE73DCA17DBALL, magickhasnextimage); + break; + case 3516: + HASH_INVOKE(0x770DEDCB168B0DBCLL, mb_ereg_search_setpos); + break; + case 3517: + HASH_INVOKE(0x48AA091B1E493DBDLL, setlocale); + HASH_INVOKE(0x01E6FF7D9746CDBDLL, stream_socket_accept); + break; + case 3521: + HASH_INVOKE(0x683E88F441F9BDC1LL, chgrp); + break; + case 3523: + HASH_INVOKE(0x069EE6F604BA2DC3LL, array_reverse); + HASH_INVOKE(0x0433140BB339DDC3LL, log); + break; + case 3524: + HASH_INVOKE(0x2A38BA8B4A0F9DC4LL, apc_fetch); + break; + case 3526: + HASH_INVOKE(0x73210FEAA2EACDC6LL, imagecolorsforindex); + break; + case 3528: + HASH_INVOKE(0x66C3E73210067DC8LL, magickgetimageunits); + break; + case 3530: + HASH_INVOKE(0x3BB701F2BDD0ADCALL, magickgetimageprofile); + break; + case 3534: + HASH_INVOKE(0x3E5C990C32470DCELL, array_combine); + HASH_INVOKE(0x4AD5B65BCE665DCELL, array_key_exists); + HASH_INVOKE(0x40C3C7DE46D62DCELL, ob_start); + break; + case 3536: + HASH_INVOKE(0x0E1C354339208DD0LL, imagetypes); + break; + case 3541: + HASH_INVOKE(0x7E1801C8E70D1DD5LL, imagefontwidth); + break; + case 3543: + HASH_INVOKE(0x638690DF6D06FDD7LL, imageconvolution); + HASH_INVOKE(0x1AE08377A1630DD7LL, mysql_insert_id); + break; + case 3548: + HASH_INVOKE(0x5EBE067E3FAECDDCLL, ob_gzhandler); + HASH_INVOKE(0x2497295AC9F72DDCLL, stream_set_blocking); + break; + case 3549: + HASH_INVOKE(0x3B00B916C3682DDDLL, ctype_upper); + break; + case 3560: + HASH_INVOKE(0x47A4BA8616D02DE8LL, restore_exception_handler); + break; + case 3564: + HASH_INVOKE(0x5B51DD18C3E13DECLL, openssl_x509_parse); + HASH_INVOKE(0x5ABB7486CE861DECLL, array_merge_recursive); + break; + case 3567: + HASH_INVOKE(0x0BB22147ADADDDEFLL, pfsockopen); + HASH_INVOKE(0x72293DCE8CC4BDEFLL, htmlspecialchars); + break; + case 3571: + HASH_INVOKE(0x7AE1BE187F18FDF3LL, fgets); + break; + case 3572: + HASH_INVOKE(0x73B30E65808A6DF4LL, ctype_xdigit); + HASH_INVOKE(0x5046A0D9DFDB5DF4LL, strcspn); + break; + case 3576: + HASH_INVOKE(0x5E43280BC8DD1DF8LL, magicktrimimage); + break; + case 3579: + HASH_INVOKE(0x47C62D58B0B65DFBLL, thrift_protocol_write_binary); + break; + case 3580: + HASH_INVOKE(0x0432ED7109BBCDFCLL, oci_cancel); + break; + case 3582: + HASH_INVOKE(0x21F24104004CFDFELL, evhttp_post); + break; + case 3586: + HASH_INVOKE(0x7829D2171DFBFE02LL, magickgetimagegamma); + break; + case 3596: + HASH_INVOKE(0x3AD6E084483B2E0CLL, array_udiff_assoc); + break; + case 3597: + HASH_INVOKE(0x5EB0A2F93E650E0DLL, array_diff_key); + HASH_INVOKE(0x756B92411E7FBE0DLL, stream_get_wrappers); + break; + case 3598: + HASH_INVOKE(0x5230E4C9D8D64E0ELL, highlight_string); + break; + case 3602: + HASH_INVOKE(0x05FAA2085D94FE12LL, urlencode); + HASH_INVOKE(0x76636D0F0C090E12LL, curl_copy_handle); + break; + case 3604: + HASH_INVOKE(0x41E394B12170BE14LL, socket_send); + HASH_INVOKE(0x3192209D50C1FE14LL, pixelsetalpha); + break; + case 3605: + HASH_INVOKE(0x525F197D74423E15LL, get_resource_type); + break; + case 3607: + HASH_INVOKE(0x0F5759A501FAFE17LL, imagecreatefromgd2part); + HASH_INVOKE(0x3D13FD5FE3AF6E17LL, imagestringup); + break; + case 3609: + HASH_INVOKE(0x4A694B42B21A9E19LL, destroymagickwand); + break; + case 3611: + HASH_INVOKE(0x7FA0B63054221E1BLL, magickrollimage); + break; + case 3616: + HASH_INVOKE(0x7BDA47B5C47EAE20LL, fread); + break; + case 3617: + HASH_INVOKE(0x5B7F218FA08D8E21LL, imagefilledellipse); + break; + case 3621: + HASH_INVOKE(0x1C6246FA51EBDE25LL, hphp_get_static_property); + break; + case 3624: + HASH_INVOKE(0x3456885FF0679E28LL, lchown); + break; + case 3625: + HASH_INVOKE(0x73FE5C79E14A0E29LL, pixelsetbluequantum); + break; + case 3629: + HASH_INVOKE(0x7817FA38BAAEFE2DLL, fsockopen); + break; + case 3634: + HASH_INVOKE(0x000AAF93F814AE32LL, drawsetvectorgraphics); + break; + case 3635: + HASH_INVOKE(0x38433635F28B4E33LL, is_readable); + break; + case 3638: + HASH_INVOKE(0x2E42ED1E15CCFE36LL, mysql_affected_rows); + break; + case 3642: + HASH_INVOKE(0x6E2CF6ECA0987E3ALL, get_headers); + HASH_INVOKE(0x13048F0A79F7CE3ALL, magicksetsamplingfactors); + break; + case 3648: + HASH_INVOKE(0x11681FDE841D0E40LL, drawskewy); + break; + case 3650: + HASH_INVOKE(0x160B01F095B20E42LL, mb_output_handler); + break; + case 3654: + HASH_INVOKE(0x7F4C1DF551150E46LL, pixelgetnextiteratorrow); + break; + case 3660: + HASH_INVOKE(0x1EEBDFD62B6BEE4CLL, mcrypt_module_get_algo_block_size); + break; + case 3661: + HASH_INVOKE(0x261E9B559C495E4DLL, oci_set_prefetch); + break; + case 3663: + HASH_INVOKE(0x62C934CD93938E4FLL, magickimplodeimage); + break; + case 3664: + HASH_INVOKE(0x4022005DE7E24E50LL, openssl_pkcs7_sign); + break; + case 3668: + HASH_INVOKE(0x6BF155774D546E54LL, define_syslog_variables); + break; + case 3671: + HASH_INVOKE(0x2DEF52641933CE57LL, magickgetimagemattecolor); + break; + case 3675: + HASH_INVOKE(0x299F1A5895461E5BLL, curl_multi_close); + break; + case 3676: + HASH_INVOKE(0x532D0D905CE60E5CLL, posix_times); + break; + case 3677: + HASH_INVOKE(0x38373F6643B14E5DLL, ldap_parse_reference); + break; + case 3681: + HASH_INVOKE(0x593EA675D239CE61LL, ldap_first_reference); + break; + case 3682: + HASH_INVOKE(0x7639C74DBC4F4E62LL, array_splice); + break; + case 3683: + HASH_INVOKE(0x4B6FE37D66784E63LL, imagesy); + HASH_INVOKE(0x5697E5F6AAF47E63LL, mb_http_input); + break; + case 3684: + HASH_INVOKE(0x4F0DF8BBC4340E64LL, stream_socket_server); + break; + case 3686: + HASH_INVOKE(0x6CB3DEB458A2DE66LL, apc_bin_load); + break; + case 3688: + HASH_INVOKE(0x5B1DFB89BFC1CE68LL, realpath); + break; + case 3689: + HASH_INVOKE(0x24B836D2C79D0E69LL, magickgetimagepixels); + break; + case 3690: + HASH_INVOKE(0x2F9816D9A2B2CE6ALL, mysql_set_charset); + HASH_INVOKE(0x25C0C5E961AFDE6ALL, xmlwriter_full_end_element); + break; + case 3693: + HASH_INVOKE(0x714001ABB0D76E6DLL, magickgetinterlacescheme); + break; + case 3695: + HASH_INVOKE(0x7E6223D0CF184E6FLL, magickqueryformats); + break; + case 3697: + HASH_INVOKE(0x6AC126DCE941FE71LL, memory_get_peak_usage); + break; + case 3700: + HASH_INVOKE(0x47D0510206B89E74LL, ini_restore); + break; + case 3701: + HASH_INVOKE(0x4EC7C66593DDEE75LL, sql_regcase); + break; + case 3702: + HASH_INVOKE(0x36E9EC047FC73E76LL, mb_convert_encoding); + break; + case 3703: + HASH_INVOKE(0x12B7B2D835B80E77LL, chmod); + break; + case 3706: + HASH_INVOKE(0x6A3D9F8EDB005E7ALL, flush); + break; + case 3708: + HASH_INVOKE(0x4D9C5B9A944CCE7CLL, convert_uudecode); + break; + case 3710: + HASH_INVOKE(0x51060D186C703E7ELL, headers_list); + break; + case 3713: + HASH_INVOKE(0x0ECFC3676B4FDE81LL, chr); + break; + case 3714: + HASH_INVOKE(0x379F7BF525FF1E82LL, magicksetimagecolorspace); + break; + case 3715: + HASH_INVOKE(0x724011CF7C31AE83LL, sqrt); + break; + case 3716: + HASH_INVOKE(0x1765A63835CC4E84LL, drawgetfontfamily); + break; + case 3717: + HASH_INVOKE(0x4710320ED6638E85LL, rename_function); + break; + case 3720: + HASH_INVOKE(0x1569DCC552EE8E88LL, cosh); + break; + case 3722: + HASH_INVOKE(0x15C9E5C16374EE8ALL, gzclose); + break; + case 3723: + HASH_INVOKE(0x6FB196047821EE8BLL, fb_render_wrapped); + break; + case 3726: + HASH_INVOKE(0x29A2FBD427647E8ELL, mysql_connect); + break; + case 3728: + HASH_INVOKE(0x33D6CC3959D3CE90LL, clearmagickwand); + break; + case 3731: + HASH_INVOKE(0x5E968924197F5E93LL, mcrypt_ofb); + HASH_INVOKE(0x37A9E8F91C33EE93LL, magickborderimage); + break; + case 3735: + HASH_INVOKE(0x6254E9BDC11F3E97LL, imagecreatefromgd2); + break; + case 3739: + HASH_INVOKE(0x2A019CAA1188BE9BLL, preg_grep); + break; + case 3742: + HASH_INVOKE(0x76EBE919625D8E9ELL, openssl_pkcs12_export); + break; + case 3743: + HASH_INVOKE(0x7CFF820207DC6E9FLL, debug_backtrace); + break; + case 3744: + HASH_INVOKE(0x37C5AF6E7E8B5EA0LL, fputs); + break; + case 3747: + HASH_INVOKE(0x6467FFB910B8BEA3LL, magickspliceimage); + break; + case 3752: + HASH_INVOKE(0x3C6190E9534F3EA8LL, ebcdic2ascii); + break; + case 3753: + HASH_INVOKE(0x308D76DB12424EA9LL, magicksetimageindex); + break; + case 3755: + HASH_INVOKE(0x632D4FC346797EABLL, pixelgetexceptionstring); + break; + case 3758: + HASH_INVOKE(0x5772A0B8C16DAEAELL, posix_setuid); + break; + case 3759: + HASH_INVOKE(0x12D83A92EFB0EEAFLL, xmlwriter_open_uri); + break; + case 3761: + HASH_INVOKE(0x33FE101882726EB1LL, proc_close); + break; + case 3763: + HASH_INVOKE(0x7DB9D839ACE0DEB3LL, natsort); + HASH_INVOKE(0x7379B5B97EC2EEB3LL, hypot); + break; + case 3767: + HASH_INVOKE(0x58B9EFA0FB35FEB7LL, stream_filter_prepend); + break; + case 3769: + HASH_INVOKE(0x2A483AD7A3D07EB9LL, magickgetwandsize); + break; + case 3770: + HASH_INVOKE(0x1F5B2728DE875EBALL, magicksetimage); + break; + case 3776: + HASH_INVOKE(0x2475D7045D9DEEC0LL, magicksetimagecompression); + HASH_INVOKE(0x495316E596537EC0LL, imagefttext); + break; + case 3778: + HASH_INVOKE(0x4CDD0B7BF826FEC2LL, rewinddir); + break; + case 3780: + HASH_INVOKE(0x7052903F1B17AEC4LL, parse_str); + break; + case 3785: + HASH_INVOKE(0x58C8DCAAE5B7CEC9LL, get_cfg_var); + break; + case 3786: + HASH_INVOKE(0x1AA83A1057BE6ECALL, mysql_field_len); + break; + case 3794: + HASH_INVOKE(0x3CCD09EC3511CED2LL, apd_stop_trace); + break; + case 3798: + HASH_INVOKE(0x134B37520683DED6LL, imagesetbrush); + break; + case 3800: + HASH_INVOKE(0x338D9D95095D1ED8LL, magicksetimagedelay); + break; + case 3801: + HASH_INVOKE(0x7F802A06996BBED9LL, apd_set_browser_trace); + break; + case 3802: + HASH_INVOKE(0x29E2771785CCBEDALL, magickgettextdescent); + break; + case 3803: + HASH_INVOKE(0x16331E18B5CD8EDBLL, timezone_open); + HASH_INVOKE(0x1340509769275EDBLL, magickgetimagecompression); + break; + case 3808: + HASH_INVOKE(0x7A1C6E429399CEE0LL, iconv_set_encoding); + break; + case 3811: + HASH_INVOKE(0x28A98134BD97BEE3LL, mb_regex_encoding); + break; + case 3812: + HASH_INVOKE(0x5B6FF42ACB2FBEE4LL, getmyuid); + break; + case 3813: + HASH_INVOKE(0x367CFD20B4446EE5LL, is_array); + break; + case 3816: + HASH_INVOKE(0x6CB6650E66CE4EE8LL, magicksetimagebordercolor); + break; + case 3819: + HASH_INVOKE(0x72882DBF2D49CEEBLL, set_magic_quotes_runtime); + break; + case 3824: + HASH_INVOKE(0x7DFF9707F1CD9EF0LL, dangling_server_proxy_old_request); + break; + case 3832: + HASH_INVOKE(0x33FD10AC81146EF8LL, thrift_protocol_read_binary); + break; + case 3833: + HASH_INVOKE(0x200FC256EB093EF9LL, gettimeofday); + break; + case 3835: + HASH_INVOKE(0x6D450F078F02BEFBLL, apd_continue); + break; + case 3837: + HASH_INVOKE(0x0CF27A6BC84CEEFDLL, openssl_get_publickey); + HASH_INVOKE(0x283E167EB3F04EFDLL, posix_getgid); + break; + case 3840: + HASH_INVOKE(0x09637D7CA2E33F00LL, fgetc); + break; + case 3841: + HASH_INVOKE(0x66137942508EBF01LL, date_create); + HASH_INVOKE(0x7B6A0D7510184F01LL, mysql_fetch_assoc); + break; + case 3842: + HASH_INVOKE(0x78A02A603FA6FF02LL, magickreducenoiseimage); + break; + case 3845: + HASH_INVOKE(0x6842585E79988F05LL, magickmosaicimages); + break; + case 3846: + HASH_INVOKE(0x1D3B08AA0AF50F06LL, gettype); + HASH_INVOKE(0x6692475BA65A2F06LL, imagearc); + break; + case 3851: + HASH_INVOKE(0x7756593AAC1F6F0BLL, imagecreatefromstring); + break; + case 3855: + HASH_INVOKE(0x61E7A36CA7FF5F0FLL, drawsetcliprule); + HASH_INVOKE(0x4BD54A631F665F0FLL, drawpathcurvetosmoothabsolute); + break; + case 3856: + HASH_INVOKE(0x700A75BF904DAF10LL, magickgetcharwidth); + break; + case 3858: + HASH_INVOKE(0x042492DDA48C4F12LL, gzdeflate); + break; + case 3860: + HASH_INVOKE(0x04525BA2AE51EF14LL, date_sun_info); + break; + case 3861: + HASH_INVOKE(0x12F09EAED9078F15LL, mysql_fetch_field); + break; + case 3862: + HASH_INVOKE(0x23B7D9E4EC992F16LL, stream_get_line); + HASH_INVOKE(0x38664EFE3E0A0F16LL, json_decode); + break; + case 3867: + HASH_INVOKE(0x27A4633381195F1BLL, chown); + break; + case 3871: + HASH_INVOKE(0x7C0C145EFE0EBF1FLL, defined); + break; + case 3873: + HASH_INVOKE(0x4282496A4BF42F21LL, php_uname); + HASH_INVOKE(0x77EC28645855AF21LL, magicksetcompressionquality); + HASH_INVOKE(0x1FF5B9A4FC78BF21LL, drawsettextantialias); + break; + case 3876: + HASH_INVOKE(0x05BD68F1D09CEF24LL, array_count_values); + HASH_INVOKE(0x5FA07E8B63BEAF24LL, mcrypt_enc_get_modes_name); + break; + case 3879: + HASH_INVOKE(0x4BAA5B688E6F6F27LL, gd_info); + break; + case 3882: + HASH_INVOKE(0x6276D05E81B9BF2ALL, fbml_get_attribute_11); + break; + case 3884: + HASH_INVOKE(0x035EFF9E1757DF2CLL, http_build_query); + break; + case 3890: + HASH_INVOKE(0x78257F34467BDF32LL, drawsetstrokedasharray); + HASH_INVOKE(0x2B66EACB77AE9F32LL, print_r); + break; + case 3897: + HASH_INVOKE(0x3E9146C06AAEFF39LL, magicksetimagecompressionquality); + HASH_INVOKE(0x496CF4113CEA8F39LL, magicksetimagefilename); + break; + case 3899: + HASH_INVOKE(0x7EE74F798791CF3BLL, magickedgeimage); + break; + case 3903: + HASH_INVOKE(0x1A9EFDD653DB8F3FLL, pcntl_wstopsig); + break; + case 3906: + HASH_INVOKE(0x3B46305DA1154F42LL, drawpopclippath); + break; + case 3909: + HASH_INVOKE(0x4E36A077234B8F45LL, pixelgetblack); + HASH_INVOKE(0x79265AADD9A8AF45LL, mcrypt_cbc); + HASH_INVOKE(0x5D3A31AB0E326F45LL, crc32); + break; + case 3910: + HASH_INVOKE(0x079EA27F72594F46LL, gzgets); + break; + case 3915: + HASH_INVOKE(0x15145FAF11392F4BLL, fbml_precache_11); + break; + case 3920: + HASH_INVOKE(0x7978A278AEAFAF50LL, pixelgetmagenta); + break; + case 3926: + HASH_INVOKE(0x621590803EC88F56LL, imageline); + break; + case 3928: + HASH_INVOKE(0x0551AAE8F1A6FF58LL, magicklevelimage); + break; + case 3929: + HASH_INVOKE(0x38246B6BDE246F59LL, magickgetimagedispose); + break; + case 3931: + HASH_INVOKE(0x24F698A8A4B5AF5BLL, imagecolordeallocate); + HASH_INVOKE(0x76418F884500DF5BLL, stream_socket_enable_crypto); + break; + case 3933: + HASH_INVOKE(0x07FF92CF46DDFF5DLL, imagepsfreefont); + break; + case 3936: + HASH_INVOKE(0x4F1D2858AD31AF60LL, imagecreatefromgd); + break; + case 3938: + HASH_INVOKE(0x463A00D839C51F62LL, oci_fetch_array); + break; + case 3939: + HASH_INVOKE(0x1FFD204252F60F63LL, magicksetimageprofile); + break; + case 3940: + HASH_INVOKE(0x280051555A21DF64LL, rename); + break; + case 3942: + HASH_INVOKE(0x6FFF1304EA444F66LL, drawsetstrokemiterlimit); + break; + case 3943: + HASH_INVOKE(0x319407AC92912F67LL, ereg); + break; + case 3946: + HASH_INVOKE(0x1670096FDE27AF6ALL, rewind); + break; + case 3948: + HASH_INVOKE(0x23D5E9E53D11BF6CLL, gmdate); + break; + case 3950: + HASH_INVOKE(0x3A56371CDDEA0F6ELL, gzgetc); + break; + case 3951: + HASH_INVOKE(0x42C4EC9D9F782F6FLL, htmlentities); + break; + case 3952: + HASH_INVOKE(0x68C257B62A36EF70LL, magicksetimagebackgroundcolor); + HASH_INVOKE(0x71557D108E5C0F70LL, xml_set_object); + break; + case 3954: + HASH_INVOKE(0x4B22EF06BAA83F72LL, version_compare); + break; + case 3956: + HASH_INVOKE(0x18BC9BF6D1E3CF74LL, magickpreviewimages); + break; + case 3961: + HASH_INVOKE(0x4BE9D91DD8624F79LL, money_format); + break; + case 3962: + HASH_INVOKE(0x7B0E6DB649084F7ALL, clearstatcache); + break; + case 3966: + HASH_INVOKE(0x7064BEBF508F3F7ELL, socket_read); + break; + case 3968: + HASH_INVOKE(0x63F18DE0DB807F80LL, magickqueryfonts); + break; + case 3972: + HASH_INVOKE(0x14402B01D00E9F84LL, magicksteganoimage); + break; + case 3973: + HASH_INVOKE(0x7EF68B9A55222F85LL, wandgetexceptionstring); + break; + case 3974: + HASH_INVOKE(0x44CE4DB1CE7E9F86LL, flock); + break; + case 3977: + HASH_INVOKE(0x13F52A829BAC0F89LL, timezone_identifiers_list); + break; + case 3979: + HASH_INVOKE(0x2755DD4112AA5F8BLL, magicksampleimage); + HASH_INVOKE(0x3703D22147C24F8BLL, pixelsetcyan); + break; + case 3982: + HASH_INVOKE(0x7A8F1104B0CCDF8ELL, phpcredits); + break; + case 3985: + HASH_INVOKE(0x78463112BE739F91LL, connection_timeout); + break; + case 3986: + HASH_INVOKE(0x288D61E7DE28AF92LL, ucwords); + break; + case 3988: + HASH_INVOKE(0x76B9D87BC7F02F94LL, preg_match); + break; + case 3989: + HASH_INVOKE(0x40D620CBA0D41F95LL, opendir); + break; + case 3991: + HASH_INVOKE(0x6F9651265C096F97LL, magickreadimages); + break; + case 3992: + HASH_INVOKE(0x0293F60B46511F98LL, drawsetfontstretch); + HASH_INVOKE(0x66F1F0DB16C82F98LL, imagesavealpha); + break; + case 3994: + HASH_INVOKE(0x2B7CAC006AF27F9ALL, fflush); + break; + case 3997: + HASH_INVOKE(0x0AD6DE8829773F9DLL, apc_compile_file); + break; + case 4006: + HASH_INVOKE(0x0DEEA8C3E3A47FA6LL, read_exif_data); + break; + case 4013: + HASH_INVOKE(0x73A9C0E0C8344FADLL, oci_free_statement); + break; + case 4014: + HASH_INVOKE(0x64D269A505D51FAELL, array_map); + break; + case 4015: + HASH_INVOKE(0x03979AACDBB24FAFLL, mailparse_msg_get_part); + break; + case 4016: + HASH_INVOKE(0x4A0B5F4676578FB0LL, imagecolorresolvealpha); + break; + case 4017: + HASH_INVOKE(0x0F78ECF42C30DFB1LL, array_chunk); + break; + case 4020: + HASH_INVOKE(0x3900FDF1C97BEFB4LL, drawrotate); + break; + case 4022: + HASH_INVOKE(0x56C0CCB57BB6EFB6LL, magicksetimageunits); + HASH_INVOKE(0x2B451EF5D52C4FB6LL, array_diff); + break; + case 4023: + HASH_INVOKE(0x6465CD999F4C5FB7LL, hphp_invoke_method); + break; + case 4024: + HASH_INVOKE(0x6DB2DB341ECF3FB8LL, file_exists); + break; + case 4026: + HASH_INVOKE(0x0664323CB1CC2FBALL, imagecolorset); + break; + case 4031: + HASH_INVOKE(0x70B38AB9EAE16FBFLL, ini_set); + break; + case 4034: + HASH_INVOKE(0x6CA22E62D4762FC2LL, magickpainttransparentimage); + break; + case 4043: + HASH_INVOKE(0x38237A4515F42FCBLL, array_pad); + break; + case 4045: + HASH_INVOKE(0x474566F3A2BE0FCDLL, mcrypt_enc_is_block_algorithm); + break; + case 4046: + HASH_INVOKE(0x042193C97C65FFCELL, magickwaveimage); + break; + case 4047: + HASH_INVOKE(0x3A3CFC1F001A6FCFLL, magickreadimagefile); + break; + case 4048: + HASH_INVOKE(0x2EAA47FA6C3FEFD0LL, drawgetstrokealpha); + HASH_INVOKE(0x53DB5D0490C51FD0LL, xhprof_sample_disable); + break; + case 4052: + HASH_INVOKE(0x4970B72A182E4FD4LL, readdir); + break; + case 4053: + HASH_INVOKE(0x751283FE764CAFD5LL, mysql_select_db); + break; + case 4054: + HASH_INVOKE(0x7FC00035D14B9FD6LL, apc_delete_file); + break; + case 4056: + HASH_INVOKE(0x4234F2B59531FFD8LL, posix_getlogin); + break; + case 4061: + HASH_INVOKE(0x4EDEDA4278CD3FDDLL, magickchopimage); + break; + case 4062: + HASH_INVOKE(0x7F5FC3CAF8CE9FDELL, gzcompress); + HASH_INVOKE(0x72925D2DF7E61FDELL, drawpathcurvetoquadraticbeziersmoothrelative); + break; + case 4071: + HASH_INVOKE(0x217067889854CFE7LL, xmlwriter_start_dtd); + break; + case 4079: + HASH_INVOKE(0x00EEEE9C6CEA5FEFLL, xmlwriter_write_element_ns); + break; + case 4080: + HASH_INVOKE(0x1189B7C4F4874FF0LL, php_check_syntax); + break; + case 4086: + HASH_INVOKE(0x25FCE64E12505FF6LL, magicksetimagerenderingintent); + break; + case 4088: + HASH_INVOKE(0x7C5A98EA30B22FF8LL, fbml_tag_list_expanded_11); + break; + case 4090: + HASH_INVOKE(0x13EE24AF67113FFALL, ob_end_flush); + break; + case 4091: + HASH_INVOKE(0x68E499A4D75BDFFBLL, ascii2ebcdic); + HASH_INVOKE(0x63BE4CEF1FC47FFBLL, imagefill); + break; + case 4094: + HASH_INVOKE(0x32F8747E480CCFFELL, connection_status); + break; + default: + break; + } + return invoke_failed(s, params, hash, fatal); +} +Variant ei_utf8_encode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(utf8_encode); + return (f_utf8_encode(a0)); +} +Variant ei_func_get_args(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(func_get_args); + return (f_func_get_args()); +} +Variant ei_php_uname(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(php_uname); + int count = params.size(); + if (count <= 0) return (f_php_uname()); + return (f_php_uname(a0)); +} +Variant ei_posix_uname(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_uname); + return (f_posix_uname()); +} +Variant ei_curl_multi_remove_handle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_multi_remove_handle); + return (f_curl_multi_remove_handle(a0, a1)); +} +Variant ei_mysql_result(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_result); + int count = params.size(); + if (count <= 2) return (f_mysql_result(a0, a1)); + return (f_mysql_result(a0, a1, a2)); +} +Variant ei_register_shutdown_function(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(register_shutdown_function); + int count = params.size(); + if (count <= 1) return (f_register_shutdown_function(count, a0), null); + return (f_register_shutdown_function(count, a0,vargs), null); +} +Variant ei_pixelsetmagentaquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetmagentaquantum); + return (f_pixelsetmagentaquantum(a0, a1), null); +} +Variant ei_newmagickwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(newmagickwand); + return (f_newmagickwand()); +} +Variant ei_natsort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(natsort); + return (f_natsort(ref(a0))); +} +Variant ei_socket_accept(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_accept); + return (f_socket_accept(a0)); +} +Variant ei_vprintf(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(vprintf); + return (f_vprintf(a0, a1)); +} +Variant ei_ucwords(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ucwords); + return (f_ucwords(a0)); +} +Variant ei_header(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(header); + int count = params.size(); + if (count <= 1) return (f_header(a0), null); + if (count == 2) return (f_header(a0, a1), null); + return (f_header(a0, a1, a2), null); +} +Variant ei_date_default_timezone_set(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_default_timezone_set); + return (f_date_default_timezone_set(a0)); +} +Variant ei_fbml_get_children_by_name_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_get_children_by_name_11); + return (f_fbml_get_children_by_name_11(a0, a1)); +} +Variant ei_is_object(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_object); + return (f_is_object(a0)); +} +Variant ei_magicksetimagebias(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagebias); + return (f_magicksetimagebias(a0, a1)); +} +Variant ei_exif_imagetype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(exif_imagetype); + return (f_exif_imagetype(a0)); +} +Variant ei_imagegrabscreen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagegrabscreen); + return (f_imagegrabscreen()); +} +Variant ei_bcmod(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bcmod); + return (f_bcmod(a0, a1)); +} +Variant ei_chr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(chr); + return (f_chr(a0)); +} +Variant ei_drawsetfontstretch(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfontstretch); + return (f_drawsetfontstretch(a0, a1), null); +} +Variant ei_posix_setsid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_setsid); + return (f_posix_setsid()); +} +Variant ei_posix_getpwnam(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getpwnam); + return (f_posix_getpwnam(a0)); +} +Variant ei_mcrypt_enc_get_supported_key_sizes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_enc_get_supported_key_sizes); + return (f_mcrypt_enc_get_supported_key_sizes(a0)); +} +Variant ei_phpinfo(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(phpinfo); + int count = params.size(); + if (count <= 0) return (f_phpinfo()); + return (f_phpinfo(a0)); +} +Variant ei_evhttp_async_get(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(evhttp_async_get); + int count = params.size(); + if (count <= 1) return (f_evhttp_async_get(a0)); + if (count == 2) return (f_evhttp_async_get(a0, a1)); + return (f_evhttp_async_get(a0, a1, a2)); +} +Variant ei_ldap_parse_result(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a4 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a5 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_parse_result); + int count = params.size(); + if (count <= 3) return (f_ldap_parse_result(a0, a1, ref(a2))); + if (count == 4) return (f_ldap_parse_result(a0, a1, ref(a2), ref(a3))); + if (count == 5) return (f_ldap_parse_result(a0, a1, ref(a2), ref(a3), ref(a4))); + return (f_ldap_parse_result(a0, a1, ref(a2), ref(a3), ref(a4), ref(a5))); +} +Variant ei_drawgettextantialias(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgettextantialias); + return (f_drawgettextantialias(a0)); +} +Variant ei_array_fill_keys(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_fill_keys); + return (f_array_fill_keys(a0, a1)); +} +Variant ei_openssl_seal(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_seal); + return (f_openssl_seal(a0, ref(a1), ref(a2), a3)); +} +Variant ei_socket_clear_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_clear_error); + int count = params.size(); + if (count <= 0) return (f_socket_clear_error(), null); + return (f_socket_clear_error(a0), null); +} +Variant ei_die(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(die); + int count = params.size(); + if (count <= 0) return (f_die()); + return (f_die(a0)); +} +Variant ei_diskfreespace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(diskfreespace); + return (f_diskfreespace(a0)); +} +Variant ei_xml_set_start_namespace_decl_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_set_start_namespace_decl_handler); + return (f_xml_set_start_namespace_decl_handler(a0, a1)); +} +Variant ei_decbin(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(decbin); + return (f_decbin(a0)); +} +Variant ei_sizeof(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sizeof); + int count = params.size(); + if (count <= 1) return (f_sizeof(a0)); + return (f_sizeof(a0, a1)); +} +Variant ei_mb_convert_case(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_convert_case); + int count = params.size(); + if (count <= 2) return (f_mb_convert_case(a0, a1)); + return (f_mb_convert_case(a0, a1, a2)); +} +Variant ei_dir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(dir); + return (f_dir(a0)); +} +Variant ei_array_combine(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_combine); + return (f_array_combine(a0, a1)); +} +Variant ei_strpos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strpos); + int count = params.size(); + if (count <= 2) return (f_strpos(a0, a1)); + return (f_strpos(a0, a1, a2)); +} +Variant ei_array_reverse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_reverse); + int count = params.size(); + if (count <= 1) return (f_array_reverse(a0)); + return (f_array_reverse(a0, a1)); +} +Variant ei_strrev(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strrev); + return (f_strrev(a0)); +} +Variant ei_msg_set_queue(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(msg_set_queue); + return (f_msg_set_queue(a0, a1)); +} +Variant ei_cos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(cos); + return (f_cos(a0)); +} +Variant ei_bcmul(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bcmul); + int count = params.size(); + if (count <= 2) return (f_bcmul(a0, a1)); + return (f_bcmul(a0, a1, a2)); +} +Variant ei_openlog(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openlog); + return (f_openlog(a0, a1, a2), null); +} +Variant ei_get_include_path(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_include_path); + return (f_get_include_path()); +} +Variant ei_socket_select(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_select); + int count = params.size(); + if (count <= 4) return (f_socket_select(ref(a0), ref(a1), ref(a2), a3)); + return (f_socket_select(ref(a0), ref(a1), ref(a2), a3, a4)); +} +Variant ei_magickraiseimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickraiseimage); + return (f_magickraiseimage(a0, a1, a2, a3, a4, a5)); +} +Variant ei_gzputs(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzputs); + int count = params.size(); + if (count <= 2) return (f_gzputs(a0, a1)); + return (f_gzputs(a0, a1, a2)); +} +Variant ei_strpbrk(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strpbrk); + return (f_strpbrk(a0, a1)); +} +Variant ei_shm_remove_var(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(shm_remove_var); + return (f_shm_remove_var(a0, a1)); +} +Variant ei_posix_setuid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_setuid); + return (f_posix_setuid(a0)); +} +Variant ei_pixelgetyellow(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetyellow); + return (f_pixelgetyellow(a0)); +} +Variant ei_convert_uudecode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(convert_uudecode); + return (f_convert_uudecode(a0)); +} +Variant ei_htmlspecialchars_decode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(htmlspecialchars_decode); + int count = params.size(); + if (count <= 1) return (f_htmlspecialchars_decode(a0)); + return (f_htmlspecialchars_decode(a0, a1)); +} +Variant ei_xmlwriter_end_document(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_end_document); + return (f_xmlwriter_end_document(a0)); +} +Variant ei_magickgetimagehistogram(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagehistogram); + return (f_magickgetimagehistogram(a0)); +} +Variant ei_preg_last_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(preg_last_error); + return (f_preg_last_error()); +} +Variant ei_end(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(end); + return (f_end(ref(a0))); +} +Variant ei_stream_get_line(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_get_line); + int count = params.size(); + if (count <= 1) return (f_stream_get_line(a0)); + if (count == 2) return (f_stream_get_line(a0, a1)); + return (f_stream_get_line(a0, a1, a2)); +} +Variant ei_deg2rad(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(deg2rad); + return (f_deg2rad(a0)); +} +Variant ei_magickrollimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickrollimage); + return (f_magickrollimage(a0, a1, a2)); +} +Variant ei_ldap_sort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_sort); + return (f_ldap_sort(a0, a1, a2)); +} +Variant ei_imagetruecolortopalette(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagetruecolortopalette); + return (f_imagetruecolortopalette(a0, a1, a2)); +} +Variant ei_defined(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(defined); + return (f_defined(a0)); +} +Variant ei_magickgetimageunits(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageunits); + return (f_magickgetimageunits(a0)); +} +Variant ei_magicksetimageblueprimary(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimageblueprimary); + return (f_magicksetimageblueprimary(a0, a1, a2)); +} +Variant ei_get_class_vars(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_class_vars); + return (f_get_class_vars(a0)); +} +Variant ei_syslog(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(syslog); + return (f_syslog(a0, a1), null); +} +Variant ei_array_unique(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_unique); + return (f_array_unique(a0)); +} +Variant ei_bcpow(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bcpow); + int count = params.size(); + if (count <= 2) return (f_bcpow(a0, a1)); + return (f_bcpow(a0, a1, a2)); +} +Variant ei_pixelgetopacityquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetopacityquantum); + return (f_pixelgetopacityquantum(a0)); +} +Variant ei_php_check_syntax(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(php_check_syntax); + int count = params.size(); + if (count <= 1) return (f_php_check_syntax(a0)); + return (f_php_check_syntax(a0, ref(a1))); +} +Variant ei_drawgetstrokemiterlimit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetstrokemiterlimit); + return (f_drawgetstrokemiterlimit(a0)); +} +Variant ei_pixelsetquantumcolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetquantumcolor); + int count = params.size(); + if (count <= 4) return (f_pixelsetquantumcolor(a0, a1, a2, a3), null); + return (f_pixelsetquantumcolor(a0, a1, a2, a3, a4), null); +} +Variant ei_gztell(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gztell); + return (f_gztell(a0)); +} +Variant ei_strval(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strval); + return (f_strval(a0)); +} +Variant ei_evhttp_recv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(evhttp_recv); + return (f_evhttp_recv(a0)); +} +Variant ei_strspn(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strspn); + int count = params.size(); + if (count <= 2) return (f_strspn(a0, a1)); + if (count == 3) return (f_strspn(a0, a1, a2)); + return (f_strspn(a0, a1, a2, a3)); +} +Variant ei_ini_restore(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ini_restore); + return (f_ini_restore(a0), null); +} +Variant ei_ldap_dn2ufn(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_dn2ufn); + return (f_ldap_dn2ufn(a0)); +} +Variant ei_ceil(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ceil); + return (f_ceil(a0)); +} +Variant ei_xmlwriter_end_dtd_attlist(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_end_dtd_attlist); + return (f_xmlwriter_end_dtd_attlist(a0)); +} +Variant ei_phpversion(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(phpversion); + int count = params.size(); + if (count <= 0) return (f_phpversion()); + return (f_phpversion(a0)); +} +Variant ei_stream_filter_remove(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_filter_remove); + return (f_stream_filter_remove(a0)); +} +Variant ei_mcrypt_generic(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_generic); + return (f_mcrypt_generic(a0, a1)); +} +Variant ei_is_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_file); + return (f_is_file(a0)); +} +Variant ei_xml_set_end_namespace_decl_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_set_end_namespace_decl_handler); + return (f_xml_set_end_namespace_decl_handler(a0, a1)); +} +Variant ei_openssl_x509_export_to_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_x509_export_to_file); + int count = params.size(); + if (count <= 2) return (f_openssl_x509_export_to_file(a0, a1)); + return (f_openssl_x509_export_to_file(a0, a1, a2)); +} +Variant ei_imagesetstyle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagesetstyle); + return (f_imagesetstyle(a0, a1)); +} +Variant ei_drawcolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawcolor); + return (f_drawcolor(a0, a1, a2, a3), null); +} +Variant ei_get_headers(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_headers); + int count = params.size(); + if (count <= 1) return (f_get_headers(a0)); + return (f_get_headers(a0, a1)); +} +Variant ei_mysql_drop_db(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_drop_db); + int count = params.size(); + if (count <= 1) return (f_mysql_drop_db(a0)); + return (f_mysql_drop_db(a0, a1)); +} +Variant ei_magickresampleimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickresampleimage); + return (f_magickresampleimage(a0, a1, a2, a3, a4)); +} +Variant ei_i18n_loc_get_default(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(i18n_loc_get_default); + return (f_i18n_loc_get_default()); +} +Variant ei_strtok(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strtok); + int count = params.size(); + if (count <= 1) return (f_strtok(a0)); + return (f_strtok(a0, a1)); +} +Variant ei_array_key_exists(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_key_exists); + return (f_array_key_exists(a0, a1)); +} +Variant ei_exp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(exp); + return (f_exp(a0)); +} +Variant ei_strstr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strstr); + return (f_strstr(a0, a1)); +} +Variant ei_realpath(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(realpath); + return (f_realpath(a0)); +} +Variant ei_stream_filter_append(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_filter_append); + int count = params.size(); + if (count <= 2) return (f_stream_filter_append(a0, a1)); + if (count == 3) return (f_stream_filter_append(a0, a1, a2)); + return (f_stream_filter_append(a0, a1, a2, a3)); +} +Variant ei_oci_bind_by_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_bind_by_name); + int count = params.size(); + if (count <= 3) return (f_oci_bind_by_name(a0, a1, ref(a2))); + if (count == 4) return (f_oci_bind_by_name(a0, a1, ref(a2), a3)); + return (f_oci_bind_by_name(a0, a1, ref(a2), a3, a4)); +} +Variant ei_hphp_get_property(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_get_property); + return (f_hphp_get_property(a0, a1, a2)); +} +Variant ei_magickgetcharheight(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetcharheight); + int count = params.size(); + if (count <= 3) return (f_magickgetcharheight(a0, a1, a2)); + return (f_magickgetcharheight(a0, a1, a2, a3)); +} +Variant ei_imagerotate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagerotate); + int count = params.size(); + if (count <= 3) return (f_imagerotate(a0, a1, a2)); + return (f_imagerotate(a0, a1, a2, a3)); +} +Variant ei_magickcompositeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcompositeimage); + return (f_magickcompositeimage(a0, a1, a2, a3, a4)); +} +Variant ei_openssl_sign(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_sign); + int count = params.size(); + if (count <= 3) return (f_openssl_sign(a0, ref(a1), a2)); + return (f_openssl_sign(a0, ref(a1), a2, a3)); +} +Variant ei_version_compare(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(version_compare); + int count = params.size(); + if (count <= 2) return (f_version_compare(a0, a1)); + return (f_version_compare(a0, a1, a2)); +} +Variant ei_timezone_name_get(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(timezone_name_get); + return (f_timezone_name_get(a0)); +} +Variant ei_posix_getpgid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getpgid); + return (f_posix_getpgid(a0)); +} +Variant ei_imagestring(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagestring); + return (f_imagestring(a0, a1, a2, a3, a4, a5)); +} +Variant ei_mcrypt_list_modes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_list_modes); + int count = params.size(); + if (count <= 0) return (f_mcrypt_list_modes()); + return (f_mcrypt_list_modes(a0)); +} +Variant ei_mcrypt_list_algorithms(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_list_algorithms); + int count = params.size(); + if (count <= 0) return (f_mcrypt_list_algorithms()); + return (f_mcrypt_list_algorithms(a0)); +} +Variant ei_mcrypt_get_cipher_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_get_cipher_name); + return (f_mcrypt_get_cipher_name(a0)); +} +Variant ei_idn_to_unicode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(idn_to_unicode); + int count = params.size(); + if (count <= 1) return (f_idn_to_unicode(a0)); + return (f_idn_to_unicode(a0, ref(a1))); +} +Variant ei_lchown(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(lchown); + return (f_lchown(a0, a1)); +} +Variant ei_drawcomposite(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawcomposite); + return (f_drawcomposite(a0, a1, a2, a3, a4, a5, a6)); +} +Variant ei_dechex(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(dechex); + return (f_dechex(a0)); +} +Variant ei_imagecolortransparent(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolortransparent); + int count = params.size(); + if (count <= 1) return (f_imagecolortransparent(a0)); + return (f_imagecolortransparent(a0, a1)); +} +Variant ei_socket_get_option(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_get_option); + return (f_socket_get_option(a0, a1, a2)); +} +Variant ei_stream_filter_register(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_filter_register); + return (f_stream_filter_register(a0, a1)); +} +Variant ei_apache_response_headers(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_response_headers); + return (f_apache_response_headers()); +} +Variant ei_array_merge(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_merge); + int count = params.size(); + if (count <= 1) return (f_array_merge(count, a0)); + return (f_array_merge(count, a0,vargs)); +} +Variant ei_phprof_disable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(phprof_disable); + return (f_phprof_disable()); +} +Variant ei_md5(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(md5); + int count = params.size(); + if (count <= 1) return (f_md5(a0)); + return (f_md5(a0, a1)); +} +Variant ei_bcsub(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bcsub); + int count = params.size(); + if (count <= 2) return (f_bcsub(a0, a1)); + return (f_bcsub(a0, a1, a2)); +} +Variant ei_xmlwriter_flush(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_flush); + int count = params.size(); + if (count <= 1) return (f_xmlwriter_flush(a0)); + return (f_xmlwriter_flush(a0, a1)); +} +Variant ei_sha1_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sha1_file); + int count = params.size(); + if (count <= 1) return (f_sha1_file(a0)); + return (f_sha1_file(a0, a1)); +} +Variant ei_posix_ctermid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_ctermid); + return (f_posix_ctermid()); +} +Variant ei_date(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date); + int count = params.size(); + if (count <= 1) return (f_date(a0)); + return (f_date(a0, a1)); +} +Variant ei_evhttp_post(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(evhttp_post); + int count = params.size(); + if (count <= 2) return (f_evhttp_post(a0, a1)); + if (count == 3) return (f_evhttp_post(a0, a1, a2)); + return (f_evhttp_post(a0, a1, a2, a3)); +} +Variant ei_ldap_connect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_connect); + int count = params.size(); + if (count <= 0) return (f_ldap_connect()); + if (count == 1) return (f_ldap_connect(a0)); + return (f_ldap_connect(a0, a1)); +} +Variant ei_shuffle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(shuffle); + return (f_shuffle(ref(a0))); +} +Variant ei_mcrypt_module_get_algo_block_size(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_module_get_algo_block_size); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_get_algo_block_size(a0)); + return (f_mcrypt_module_get_algo_block_size(a0, a1)); +} +Variant ei_key(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(key); + return (f_key(ref(a0))); +} +Variant ei_xmlwriter_start_dtd_entity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_dtd_entity); + return (f_xmlwriter_start_dtd_entity(a0, a1, a2)); +} +Variant ei_readfile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(readfile); + int count = params.size(); + if (count <= 1) return (f_readfile(a0)); + if (count == 2) return (f_readfile(a0, a1)); + return (f_readfile(a0, a1, a2)); +} +Variant ei_atan(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(atan); + return (f_atan(a0)); +} +Variant ei_magickmodulateimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickmodulateimage); + return (f_magickmodulateimage(a0, a1, a2, a3)); +} +Variant ei_mysql_set_charset(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_set_charset); + int count = params.size(); + if (count <= 1) return (f_mysql_set_charset(a0)); + return (f_mysql_set_charset(a0, a1)); +} +Variant ei_drawgetfontweight(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetfontweight); + return (f_drawgetfontweight(a0)); +} +Variant ei_magickgetimageheight(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageheight); + return (f_magickgetimageheight(a0)); +} +Variant ei_posix_getpgrp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getpgrp); + return (f_posix_getpgrp()); +} +Variant ei_i18n_loc_get_error_code(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(i18n_loc_get_error_code); + return (f_i18n_loc_get_error_code()); +} +Variant ei_hash_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hash_file); + int count = params.size(); + if (count <= 2) return (f_hash_file(a0, a1)); + return (f_hash_file(a0, a1, a2)); +} +Variant ei_is_callable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_callable); + int count = params.size(); + if (count <= 1) return (f_is_callable(a0)); + if (count == 2) return (f_is_callable(a0, a1)); + return (f_is_callable(a0, a1, ref(a2))); +} +Variant ei_asin(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(asin); + return (f_asin(a0)); +} +Variant ei_openssl_public_encrypt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_public_encrypt); + int count = params.size(); + if (count <= 3) return (f_openssl_public_encrypt(a0, ref(a1), a2)); + return (f_openssl_public_encrypt(a0, ref(a1), a2, a3)); +} +Variant ei_curl_multi_init(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_multi_init); + return (f_curl_multi_init()); +} +Variant ei_posix_getpwuid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getpwuid); + return (f_posix_getpwuid(a0)); +} +Variant ei_json_encode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(json_encode); + int count = params.size(); + if (count <= 1) return (f_json_encode(a0)); + return (f_json_encode(a0, a1)); +} +Variant ei_show_source(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(show_source); + int count = params.size(); + if (count <= 1) return (f_show_source(a0)); + return (f_show_source(a0, a1)); +} +Variant ei_mcrypt_module_self_test(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_module_self_test); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_self_test(a0)); + return (f_mcrypt_module_self_test(a0, a1)); +} +Variant ei_sscanf(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append(ref((*it)->refval(env))); + } + FUNCTION_INJECTION(sscanf); + int count = params.size(); + if (count <= 2) return (f_sscanf(count, a0, a1)); + return (f_sscanf(count, a0, a1,vargs)); +} +Variant ei_chop(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(chop); + int count = params.size(); + if (count <= 1) return (f_chop(a0)); + return (f_chop(a0, a1)); +} +Variant ei_mb_convert_variables(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(mb_convert_variables); + int count = params.size(); + if (count <= 3) return (f_mb_convert_variables(count, a0, a1, ref(a2))); + return (f_mb_convert_variables(count, a0, a1, ref(a2),vargs)); +} +Variant ei_fbml_render_children_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_render_children_11); + int count = params.size(); + if (count <= 4) return (f_fbml_render_children_11(a0, a1, a2, a3)); + return (f_fbml_render_children_11(a0, a1, a2, a3, a4)); +} +Variant ei_socket_close(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_close); + return (f_socket_close(a0), null); +} +Variant ei_max(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(max); + int count = params.size(); + if (count <= 1) return (f_max(count, a0)); + return (f_max(count, a0,vargs)); +} +Variant ei_magickadaptivethresholdimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickadaptivethresholdimage); + return (f_magickadaptivethresholdimage(a0, a1, a2, a3)); +} +Variant ei_each(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(each); + return (f_each(ref(a0))); +} +Variant ei_magickremoveimageprofiles(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickremoveimageprofiles); + return (f_magickremoveimageprofiles(a0)); +} +Variant ei_drawgettextalignment(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgettextalignment); + return (f_drawgettextalignment(a0)); +} +Variant ei_xbox_send_message(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xbox_send_message); + int count = params.size(); + if (count <= 3) return (f_xbox_send_message(a0, ref(a1), a2)); + return (f_xbox_send_message(a0, ref(a1), a2, a3)); +} +Variant ei_thrift_protocol_write_binary(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(thrift_protocol_write_binary); + return (f_thrift_protocol_write_binary(a0, a1, a2, a3, a4, a5), null); +} +Variant ei_wandgetexceptiontype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(wandgetexceptiontype); + return (f_wandgetexceptiontype(a0)); +} +Variant ei_drawpathellipticarcabsolute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathellipticarcabsolute); + return (f_drawpathellipticarcabsolute(a0, a1, a2, a3, a4, a5, a6, a7), null); +} +Variant ei_pixelsetgreen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetgreen); + return (f_pixelsetgreen(a0, a1), null); +} +Variant ei_magickgetimagecolorspace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagecolorspace); + return (f_magickgetimagecolorspace(a0)); +} +Variant ei_pixelsetalphaquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetalphaquantum); + return (f_pixelsetalphaquantum(a0, a1), null); +} +Variant ei_stream_bucket_append(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_bucket_append); + return (f_stream_bucket_append(a0, a1), null); +} +Variant ei_msg_stat_queue(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(msg_stat_queue); + return (f_msg_stat_queue(a0)); +} +Variant ei_system(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(system); + int count = params.size(); + if (count <= 1) return (f_system(a0)); + return (f_system(a0, ref(a1))); +} +Variant ei_mb_parse_str(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_parse_str); + int count = params.size(); + if (count <= 1) return (f_mb_parse_str(a0)); + return (f_mb_parse_str(a0, ref(a1))); +} +Variant ei_log(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(log); + int count = params.size(); + if (count <= 1) return (f_log(a0)); + return (f_log(a0, a1)); +} +Variant ei_drawskewx(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawskewx); + return (f_drawskewx(a0, a1), null); +} +Variant ei_min(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(min); + int count = params.size(); + if (count <= 1) return (f_min(count, a0)); + return (f_min(count, a0,vargs)); +} +Variant ei_curl_multi_getcontent(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_multi_getcontent); + return (f_curl_multi_getcontent(a0)); +} +Variant ei_drawskewy(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawskewy); + return (f_drawskewy(a0, a1), null); +} +Variant ei_is_uploaded_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_uploaded_file); + return (f_is_uploaded_file(a0)); +} +Variant ei_magicksetresourcelimit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetresourcelimit); + return (f_magicksetresourcelimit(a0, a1)); +} +Variant ei_date_timezone_get(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_timezone_get); + return (f_date_timezone_get(a0)); +} +Variant ei_apache_get_rewrite_rules(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_get_rewrite_rules); + return (f_apache_get_rewrite_rules()); +} +Variant ei_is_string(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_string); + return (f_is_string(a0)); +} +Variant ei_pcntl_wtermsig(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_wtermsig); + return (f_pcntl_wtermsig(a0)); +} +Variant ei_stream_context_get_default(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_context_get_default); + int count = params.size(); + if (count <= 0) return (f_stream_context_get_default()); + return (f_stream_context_get_default(a0)); +} +Variant ei_drawpathlinetorelative(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathlinetorelative); + return (f_drawpathlinetorelative(a0, a1, a2), null); +} +Variant ei_fql_parse_10(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fql_parse_10); + return (f_fql_parse_10(a0)); +} +Variant ei_urlencode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(urlencode); + return (f_urlencode(a0)); +} +Variant ei_mb_preferred_mime_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_preferred_mime_name); + return (f_mb_preferred_mime_name(a0)); +} +Variant ei_pixelgetgreenquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetgreenquantum); + return (f_pixelgetgreenquantum(a0)); +} +Variant ei_magicksetfilename(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetfilename); + int count = params.size(); + if (count <= 1) return (f_magicksetfilename(a0)); + return (f_magicksetfilename(a0, a1)); +} +Variant ei_magickappendimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickappendimages); + int count = params.size(); + if (count <= 1) return (f_magickappendimages(a0)); + return (f_magickappendimages(a0, a1)); +} +Variant ei_pcntl_wifstopped(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_wifstopped); + return (f_pcntl_wifstopped(a0)); +} +Variant ei_mb_ereg_search(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_ereg_search); + int count = params.size(); + if (count <= 0) return (f_mb_ereg_search()); + if (count == 1) return (f_mb_ereg_search(a0)); + return (f_mb_ereg_search(a0, a1)); +} +Variant ei_rewind(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rewind); + return (f_rewind(a0)); +} +Variant ei_chunk_split(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(chunk_split); + int count = params.size(); + if (count <= 1) return (f_chunk_split(a0)); + if (count == 2) return (f_chunk_split(a0, a1)); + return (f_chunk_split(a0, a1, a2)); +} +Variant ei_mb_list_encodings_alias_names(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_list_encodings_alias_names); + int count = params.size(); + if (count <= 0) return (f_mb_list_encodings_alias_names()); + return (f_mb_list_encodings_alias_names(a0)); +} +Variant ei_i18n_loc_set_attribute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(i18n_loc_set_attribute); + return (f_i18n_loc_set_attribute(a0, a1)); +} +Variant ei_pixelsynciterator(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsynciterator); + return (f_pixelsynciterator(a0)); +} +Variant ei_openssl_error_string(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_error_string); + return (f_openssl_error_string()); +} +Variant ei_ismagickwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ismagickwand); + return (f_ismagickwand(a0)); +} +Variant ei_strrchr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strrchr); + return (f_strrchr(a0, a1)); +} +Variant ei_xmlwriter_start_dtd_element(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_dtd_element); + return (f_xmlwriter_start_dtd_element(a0, a1)); +} +Variant ei_str_ireplace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(str_ireplace); + int count = params.size(); + if (count <= 3) return (f_str_ireplace(a0, a1, a2)); + return (f_str_ireplace(a0, a1, a2, ref(a3))); +} +Variant ei_magickpainttransparentimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickpainttransparentimage); + int count = params.size(); + if (count <= 2) return (f_magickpainttransparentimage(a0, a1)); + if (count == 3) return (f_magickpainttransparentimage(a0, a1, a2)); + return (f_magickpainttransparentimage(a0, a1, a2, a3)); +} +Variant ei_drawsettextundercolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsettextundercolor); + return (f_drawsettextundercolor(a0, a1), null); +} +Variant ei_magickgetstringwidth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetstringwidth); + int count = params.size(); + if (count <= 3) return (f_magickgetstringwidth(a0, a1, a2)); + return (f_magickgetstringwidth(a0, a1, a2, a3)); +} +Variant ei_echo(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(echo); + int count = params.size(); + if (count <= 1) return (f_echo(count, a0), null); + return (f_echo(count, a0,vargs), null); +} +Variant ei_ldap_parse_reference(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_parse_reference); + return (f_ldap_parse_reference(a0, a1, ref(a2))); +} +Variant ei_ctype_xdigit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_xdigit); + return (f_ctype_xdigit(a0)); +} +Variant ei_gmstrftime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gmstrftime); + int count = params.size(); + if (count <= 1) return (f_gmstrftime(a0)); + return (f_gmstrftime(a0, a1)); +} +Variant ei_stream_socket_get_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_socket_get_name); + return (f_stream_socket_get_name(a0, a1)); +} +Variant ei_socket_set_option(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_set_option); + return (f_socket_set_option(a0, a1, a2, a3)); +} +Variant ei_array_multisort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append(ref((*it)->refval(env))); + } + FUNCTION_INJECTION(array_multisort); + int count = params.size(); + if (count <= 1) return (f_array_multisort(count, ref(a0))); + return (f_array_multisort(count, ref(a0),vargs)); +} +Variant ei_imagepsbbox(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagepsbbox); + int count = params.size(); + if (count <= 3) return (f_imagepsbbox(a0, a1, a2)); + if (count == 4) return (f_imagepsbbox(a0, a1, a2, a3)); + if (count == 5) return (f_imagepsbbox(a0, a1, a2, a3, a4)); + return (f_imagepsbbox(a0, a1, a2, a3, a4, a5)); +} +Variant ei_drawpathlinetoverticalabsolute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathlinetoverticalabsolute); + return (f_drawpathlinetoverticalabsolute(a0, a1), null); +} +Variant ei_mailparse_msg_get_structure(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_msg_get_structure); + return (f_mailparse_msg_get_structure(a0)); +} +Variant ei_mb_ereg(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_ereg); + int count = params.size(); + if (count <= 2) return (f_mb_ereg(a0, a1)); + return (f_mb_ereg(a0, a1, ref(a2))); +} +Variant ei_decoct(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(decoct); + return (f_decoct(a0)); +} +Variant ei_xml_parse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_parse); + int count = params.size(); + if (count <= 2) return (f_xml_parse(a0, a1)); + return (f_xml_parse(a0, a1, a2)); +} +Variant ei_xml_get_current_line_number(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_get_current_line_number); + return (f_xml_get_current_line_number(a0)); +} +Variant ei_drawaffine(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawaffine); + return (f_drawaffine(a0, a1, a2, a3, a4, a5, a6), null); +} +Variant ei_magicksetimagewhitepoint(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagewhitepoint); + return (f_magicksetimagewhitepoint(a0, a1, a2)); +} +Variant ei_gzclose(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzclose); + return (f_gzclose(a0)); +} +Variant ei_imagecolorat(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorat); + return (f_imagecolorat(a0, a1, a2)); +} +Variant ei_magickgetimageextrema(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageextrema); + int count = params.size(); + if (count <= 1) return (f_magickgetimageextrema(a0)); + return (f_magickgetimageextrema(a0, a1)); +} +Variant ei_ord(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ord); + return (f_ord(a0)); +} +Variant ei_mktime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mktime); + int count = params.size(); + if (count <= 0) return (f_mktime()); + if (count == 1) return (f_mktime(a0)); + if (count == 2) return (f_mktime(a0, a1)); + if (count == 3) return (f_mktime(a0, a1, a2)); + if (count == 4) return (f_mktime(a0, a1, a2, a3)); + if (count == 5) return (f_mktime(a0, a1, a2, a3, a4)); + return (f_mktime(a0, a1, a2, a3, a4, a5)); +} +Variant ei_sem_get(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sem_get); + int count = params.size(); + if (count <= 1) return (f_sem_get(a0)); + if (count == 2) return (f_sem_get(a0, a1)); + if (count == 3) return (f_sem_get(a0, a1, a2)); + return (f_sem_get(a0, a1, a2, a3)); +} +Variant ei_drawsetstrokelinejoin(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokelinejoin); + return (f_drawsetstrokelinejoin(a0, a1), null); +} +Variant ei_array_intersect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_intersect); + int count = params.size(); + if (count <= 2) return (f_array_intersect(count, a0, a1)); + return (f_array_intersect(count, a0, a1,vargs)); +} +Variant ei_mailparse_msg_extract_whole_part_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_msg_extract_whole_part_file); + int count = params.size(); + if (count <= 2) return (f_mailparse_msg_extract_whole_part_file(a0, a1)); + return (f_mailparse_msg_extract_whole_part_file(a0, a1, a2)); +} +Variant ei_mb_strrichr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strrichr); + int count = params.size(); + if (count <= 2) return (f_mb_strrichr(a0, a1)); + if (count == 3) return (f_mb_strrichr(a0, a1, a2)); + return (f_mb_strrichr(a0, a1, a2, a3)); +} +Variant ei_socket_sendto(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_sendto); + int count = params.size(); + if (count <= 5) return (f_socket_sendto(a0, a1, a2, a3, a4)); + return (f_socket_sendto(a0, a1, a2, a3, a4, a5)); +} +Variant ei_fb_request_timers(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_request_timers); + return (f_fb_request_timers()); +} +Variant ei_mb_output_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_output_handler); + return (f_mb_output_handler(a0, a1)); +} +Variant ei_fclose(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fclose); + return (f_fclose(a0)); +} +Variant ei_drawpathcurvetoquadraticbeziersmoothabsolute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathcurvetoquadraticbeziersmoothabsolute); + return (f_drawpathcurvetoquadraticbeziersmoothabsolute(a0, a1, a2), null); +} +Variant ei_function_exists(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(function_exists); + return (f_function_exists(a0)); +} +Variant ei_oci_connect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_connect); + int count = params.size(); + if (count <= 2) return (f_oci_connect(a0, a1)); + if (count == 3) return (f_oci_connect(a0, a1, a2)); + if (count == 4) return (f_oci_connect(a0, a1, a2, a3)); + return (f_oci_connect(a0, a1, a2, a3, a4)); +} +Variant ei_fbml_precache_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_precache_11); + return (f_fbml_precache_11(a0, a1, a2), null); +} +Variant ei_ctype_alpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_alpha); + return (f_ctype_alpha(a0)); +} +Variant ei_pos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pos); + return (f_pos(ref(a0))); +} +Variant ei_imagecolorexactalpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorexactalpha); + return (f_imagecolorexactalpha(a0, a1, a2, a3, a4)); +} +Variant ei_pow(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pow); + return (f_pow(a0, a1)); +} +Variant ei_pixelgetredquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetredquantum); + return (f_pixelgetredquantum(a0)); +} +Variant ei_imagecolorsforindex(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorsforindex); + return (f_imagecolorsforindex(a0, a1)); +} +Variant ei_libxml_set_streams_context(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(libxml_set_streams_context); + return (f_libxml_set_streams_context(a0), null); +} +Variant ei_image_type_to_mime_type(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(image_type_to_mime_type); + return (f_image_type_to_mime_type(a0)); +} +Variant ei_socket_create(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_create); + return (f_socket_create(a0, a1, a2)); +} +Variant ei_xmlwriter_write_pi(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_pi); + return (f_xmlwriter_write_pi(a0, a1, a2)); +} +Variant ei_posix_getppid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getppid); + return (f_posix_getppid()); +} +Variant ei_oci_close(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_close); + return (f_oci_close(a0)); +} +Variant ei_mb_stripos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_stripos); + int count = params.size(); + if (count <= 2) return (f_mb_stripos(a0, a1)); + if (count == 3) return (f_mb_stripos(a0, a1, a2)); + return (f_mb_stripos(a0, a1, a2, a3)); +} +Variant ei_magickpingimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickpingimage); + return (f_magickpingimage(a0, a1)); +} +Variant ei_bcpowmod(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bcpowmod); + int count = params.size(); + if (count <= 3) return (f_bcpowmod(a0, a1, a2)); + return (f_bcpowmod(a0, a1, a2, a3)); +} +Variant ei_timezone_offset_get(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(timezone_offset_get); + return (f_timezone_offset_get(a0, a1)); +} +Variant ei_getrandmax(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getrandmax); + return (f_getrandmax()); +} +Variant ei_ctype_alnum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_alnum); + return (f_ctype_alnum(a0)); +} +Variant ei_tan(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(tan); + return (f_tan(a0)); +} +Variant ei_set_exception_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(set_exception_handler); + return (f_set_exception_handler(a0)); +} +Variant ei_imagegrabwindow(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagegrabwindow); + int count = params.size(); + if (count <= 1) return (f_imagegrabwindow(a0)); + return (f_imagegrabwindow(a0, a1)); +} +Variant ei_magickstereoimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickstereoimage); + return (f_magickstereoimage(a0, a1)); +} +Variant ei_magickgetimagescene(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagescene); + return (f_magickgetimagescene(a0)); +} +Variant ei_openssl_csr_sign(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_csr_sign); + int count = params.size(); + if (count <= 4) return (f_openssl_csr_sign(a0, a1, a2, a3)); + if (count == 5) return (f_openssl_csr_sign(a0, a1, a2, a3, a4)); + return (f_openssl_csr_sign(a0, a1, a2, a3, a4, a5)); +} +Variant ei_openssl_pkcs12_export(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkcs12_export); + int count = params.size(); + if (count <= 4) return (f_openssl_pkcs12_export(a0, ref(a1), a2, a3)); + return (f_openssl_pkcs12_export(a0, ref(a1), a2, a3, a4)); +} +Variant ei_magickgetquantumdepth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetquantumdepth); + return (f_magickgetquantumdepth()); +} +Variant ei_socket_listen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_listen); + int count = params.size(); + if (count <= 1) return (f_socket_listen(a0)); + return (f_socket_listen(a0, a1)); +} +Variant ei_parse_str(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(parse_str); + int count = params.size(); + if (count <= 1) return (f_parse_str(a0), null); + return (f_parse_str(a0, ref(a1)), null); +} +Variant ei_sin(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sin); + return (f_sin(a0)); +} +Variant ei_cosh(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(cosh); + return (f_cosh(a0)); +} +Variant ei_copy(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(copy); + int count = params.size(); + if (count <= 2) return (f_copy(a0, a1)); + return (f_copy(a0, a1, a2)); +} +Variant ei_imagechar(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagechar); + return (f_imagechar(a0, a1, a2, a3, a4, a5)); +} +Variant ei_magicksetimagebackgroundcolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagebackgroundcolor); + return (f_magicksetimagebackgroundcolor(a0, a1)); +} +Variant ei_ldap_mod_add(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_mod_add); + return (f_ldap_mod_add(a0, a1, a2)); +} +Variant ei_fb_thrift_serialize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_thrift_serialize); + return (f_fb_thrift_serialize(a0)); +} +Variant ei_posix_ttyname(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_ttyname); + return (f_posix_ttyname(a0)); +} +Variant ei_filectime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(filectime); + return (f_filectime(a0)); +} +Variant ei_newpixelwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(newpixelwand); + int count = params.size(); + if (count <= 0) return (f_newpixelwand()); + return (f_newpixelwand(a0)); +} +Variant ei_pcntl_wait(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_wait); + int count = params.size(); + if (count <= 1) return (f_pcntl_wait(ref(a0))); + return (f_pcntl_wait(ref(a0), a1)); +} +Variant ei_hypot(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hypot); + return (f_hypot(a0, a1)); +} +Variant ei_parse_url(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(parse_url); + int count = params.size(); + if (count <= 1) return (f_parse_url(a0)); + return (f_parse_url(a0, a1)); +} +Variant ei_magickreadimageblob(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickreadimageblob); + return (f_magickreadimageblob(a0, a1)); +} +Variant ei_eregi(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(eregi); + int count = params.size(); + if (count <= 2) return (f_eregi(a0, a1)); + return (f_eregi(a0, a1, ref(a2))); +} +Variant ei_pixelsetcolorcount(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetcolorcount); + return (f_pixelsetcolorcount(a0, a1), null); +} +Variant ei_drawpathcurvetoquadraticbezierrelative(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathcurvetoquadraticbezierrelative); + return (f_drawpathcurvetoquadraticbezierrelative(a0, a1, a2, a3, a4), null); +} +Variant ei_posix_getgroups(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getgroups); + return (f_posix_getgroups()); +} +Variant ei_fileinode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fileinode); + return (f_fileinode(a0)); +} +Variant ei_magickgetnumberimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetnumberimages); + return (f_magickgetnumberimages(a0)); +} +Variant ei_magickgetimagesblob(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagesblob); + return (f_magickgetimagesblob(a0)); +} +Variant ei_magickcontrastimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcontrastimage); + return (f_magickcontrastimage(a0, a1)); +} +Variant ei_pcntl_setpriority(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_setpriority); + int count = params.size(); + if (count <= 1) return (f_pcntl_setpriority(a0)); + if (count == 2) return (f_pcntl_setpriority(a0, a1)); + return (f_pcntl_setpriority(a0, a1, a2)); +} +Variant ei_drawgetfontstretch(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetfontstretch); + return (f_drawgetfontstretch(a0)); +} +Variant ei_bcscale(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bcscale); + return (f_bcscale(a0)); +} +Variant ei_imageconvolution(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imageconvolution); + return (f_imageconvolution(a0, a1, a2, a3)); +} +Variant ei_utf8_decode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(utf8_decode); + return (f_utf8_decode(a0)); +} +Variant ei_ldap_unbind(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_unbind); + return (f_ldap_unbind(a0)); +} +Variant ei_newpixelregioniterator(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(newpixelregioniterator); + return (f_newpixelregioniterator(a0, a1, a2, a3, a4)); +} +Variant ei_array_intersect_assoc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_intersect_assoc); + int count = params.size(); + if (count <= 2) return (f_array_intersect_assoc(count, a0, a1)); + return (f_array_intersect_assoc(count, a0, a1,vargs)); +} +Variant ei_ob_get_level(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_get_level); + return (f_ob_get_level()); +} +Variant ei_hebrev(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hebrev); + int count = params.size(); + if (count <= 1) return (f_hebrev(a0)); + return (f_hebrev(a0, a1)); +} +Variant ei_socket_set_block(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_set_block); + return (f_socket_set_block(a0)); +} +Variant ei_mcrypt_module_close(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_module_close); + return (f_mcrypt_module_close(a0)); +} +Variant ei_mb_strwidth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strwidth); + int count = params.size(); + if (count <= 1) return (f_mb_strwidth(a0)); + return (f_mb_strwidth(a0, a1)); +} +Variant ei_clonemagickwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(clonemagickwand); + return (f_clonemagickwand(a0)); +} +Variant ei_pixelgetred(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetred); + return (f_pixelgetred(a0)); +} +Variant ei_ip2long(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ip2long); + return (f_ip2long(a0)); +} +Variant ei_mb_stristr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_stristr); + int count = params.size(); + if (count <= 2) return (f_mb_stristr(a0, a1)); + if (count == 3) return (f_mb_stristr(a0, a1, a2)); + return (f_mb_stristr(a0, a1, a2, a3)); +} +Variant ei_array_diff_ukey(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_diff_ukey); + int count = params.size(); + if (count <= 3) return (f_array_diff_ukey(count, a0, a1, a2)); + return (f_array_diff_ukey(count, a0, a1, a2,vargs)); +} +Variant ei_isdrawingwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(isdrawingwand); + return (f_isdrawingwand(a0)); +} +Variant ei_magicksetimagemattecolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagemattecolor); + return (f_magicksetimagemattecolor(a0, a1)); +} +Variant ei_closedir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(closedir); + return (f_closedir(a0), null); +} +Variant ei_fb_call_user_func_safe_return(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(fb_call_user_func_safe_return); + int count = params.size(); + if (count <= 2) return (f_fb_call_user_func_safe_return(count, a0, a1)); + return (f_fb_call_user_func_safe_return(count, a0, a1,vargs)); +} +Variant ei_magickwriteimagesfile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickwriteimagesfile); + return (f_magickwriteimagesfile(a0, a1)); +} +Variant ei_magickdescribeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickdescribeimage); + return (f_magickdescribeimage(a0)); +} +Variant ei_imageftbbox(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imageftbbox); + int count = params.size(); + if (count <= 4) return (f_imageftbbox(a0, a1, a2, a3)); + return (f_imageftbbox(a0, a1, a2, a3, a4)); +} +Variant ei_magicksetlastiterator(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetlastiterator); + return (f_magicksetlastiterator(a0), null); +} +Variant ei_hphp_output_global_state(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_output_global_state); + int count = params.size(); + if (count <= 0) return (f_hphp_output_global_state(), null); + return (f_hphp_output_global_state(a0), null); +} +Variant ei_imagefontheight(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagefontheight); + return (f_imagefontheight(a0)); +} +Variant ei_putenv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(putenv); + return (f_putenv(a0)); +} +Variant ei_magickedgeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickedgeimage); + return (f_magickedgeimage(a0, a1)); +} +Variant ei_xml_error_string(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_error_string); + return (f_xml_error_string(a0)); +} +Variant ei_array_rand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_rand); + int count = params.size(); + if (count <= 1) return (f_array_rand(a0)); + return (f_array_rand(a0, a1)); +} +Variant ei_ldap_mod_del(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_mod_del); + return (f_ldap_mod_del(a0, a1, a2)); +} +Variant ei_range(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(range); + int count = params.size(); + if (count <= 2) return (f_range(a0, a1)); + return (f_range(a0, a1, a2)); +} +Variant ei_levenshtein(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(levenshtein); + int count = params.size(); + if (count <= 2) return (f_levenshtein(a0, a1)); + if (count == 3) return (f_levenshtein(a0, a1, a2)); + if (count == 4) return (f_levenshtein(a0, a1, a2, a3)); + return (f_levenshtein(a0, a1, a2, a3, a4)); +} +Variant ei_curl_multi_close(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_multi_close); + return (f_curl_multi_close(a0), null); +} +Variant ei_drawgetfillalpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetfillalpha); + return (f_drawgetfillalpha(a0)); +} +Variant ei_hash_hmac(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hash_hmac); + int count = params.size(); + if (count <= 3) return (f_hash_hmac(a0, a1, a2)); + return (f_hash_hmac(a0, a1, a2, a3)); +} +Variant ei_get_html_translation_table(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_html_translation_table); + int count = params.size(); + if (count <= 0) return (f_get_html_translation_table()); + if (count == 1) return (f_get_html_translation_table(a0)); + return (f_get_html_translation_table(a0, a1)); +} +Variant ei_user_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(user_error); + int count = params.size(); + if (count <= 1) return (f_user_error(a0)); + return (f_user_error(a0, a1)); +} +Variant ei_feof(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(feof); + return (f_feof(a0)); +} +Variant ei_filemtime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(filemtime); + return (f_filemtime(a0)); +} +Variant ei_microtime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(microtime); + int count = params.size(); + if (count <= 0) return (f_microtime()); + return (f_microtime(a0)); +} +Variant ei_zend_version(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(zend_version); + return (f_zend_version()); +} +Variant ei_openssl_x509_free(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_x509_free); + return (f_openssl_x509_free(a0), null); +} +Variant ei_fb_call_user_func_safe(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(fb_call_user_func_safe); + int count = params.size(); + if (count <= 1) return (f_fb_call_user_func_safe(count, a0)); + return (f_fb_call_user_func_safe(count, a0,vargs)); +} +Variant ei_var_export(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(var_export); + int count = params.size(); + if (count <= 1) return (f_var_export(a0)); + return (f_var_export(a0, a1)); +} +Variant ei_mb_strcut(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strcut); + int count = params.size(); + if (count <= 2) return (f_mb_strcut(a0, a1)); + if (count == 3) return (f_mb_strcut(a0, a1, a2)); + return (f_mb_strcut(a0, a1, a2, a3)); +} +Variant ei_xmlwriter_end_comment(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_end_comment); + return (f_xmlwriter_end_comment(a0)); +} +Variant ei_xmlwriter_end_dtd_element(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_end_dtd_element); + return (f_xmlwriter_end_dtd_element(a0)); +} +Variant ei_openssl_pkey_export_to_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkey_export_to_file); + int count = params.size(); + if (count <= 2) return (f_openssl_pkey_export_to_file(a0, a1)); + if (count == 3) return (f_openssl_pkey_export_to_file(a0, a1, a2)); + return (f_openssl_pkey_export_to_file(a0, a1, a2, a3)); +} +Variant ei_oci_commit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_commit); + return (f_oci_commit(a0)); +} +Variant ei_imagecolorclosesthwb(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorclosesthwb); + return (f_imagecolorclosesthwb(a0, a1, a2, a3)); +} +Variant ei_ldap_get_attributes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_get_attributes); + return (f_ldap_get_attributes(a0, a1)); +} +Variant ei_date_modify(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_modify); + return (f_date_modify(a0, a1), null); +} +Variant ei_umask(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(umask); + int count = params.size(); + if (count <= 0) return (f_umask()); + return (f_umask(a0)); +} +Variant ei_xml_get_current_column_number(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_get_current_column_number); + return (f_xml_get_current_column_number(a0)); +} +Variant ei_pixelsetblue(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetblue); + return (f_pixelsetblue(a0, a1), null); +} +Variant ei_mb_http_output(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_http_output); + int count = params.size(); + if (count <= 0) return (f_mb_http_output()); + return (f_mb_http_output(a0)); +} +Variant ei_flock(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(flock); + int count = params.size(); + if (count <= 2) return (f_flock(a0, a1)); + return (f_flock(a0, a1, ref(a2))); +} +Variant ei_pcntl_wifexited(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_wifexited); + return (f_pcntl_wifexited(a0)); +} +Variant ei_magicksetformat(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetformat); + return (f_magicksetformat(a0, a1)); +} +Variant ei_array_map(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_map); + int count = params.size(); + if (count <= 2) return (f_array_map(count, a0, a1)); + return (f_array_map(count, a0, a1,vargs)); +} +Variant ei_magicksharpenimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksharpenimage); + int count = params.size(); + if (count <= 3) return (f_magicksharpenimage(a0, a1, a2)); + return (f_magicksharpenimage(a0, a1, a2, a3)); +} +Variant ei_is_infinite(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_infinite); + return (f_is_infinite(a0)); +} +Variant ei_date_timezone_set(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_timezone_set); + return (f_date_timezone_set(a0, a1), null); +} +Variant ei_mb_ereg_search_init(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_ereg_search_init); + int count = params.size(); + if (count <= 1) return (f_mb_ereg_search_init(a0)); + if (count == 2) return (f_mb_ereg_search_init(a0, a1)); + return (f_mb_ereg_search_init(a0, a1, a2)); +} +Variant ei_drawcircle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawcircle); + return (f_drawcircle(a0, a1, a2, a3, a4), null); +} +Variant ei_is_readable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_readable); + return (f_is_readable(a0)); +} +Variant ei_image_type_to_extension(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(image_type_to_extension); + int count = params.size(); + if (count <= 1) return (f_image_type_to_extension(a0)); + return (f_image_type_to_extension(a0, a1)); +} +Variant ei_printf(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(printf); + int count = params.size(); + if (count <= 1) return (f_printf(count, a0)); + return (f_printf(count, a0,vargs)); +} +Variant ei_magicksetimagecompression(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagecompression); + return (f_magicksetimagecompression(a0, a1)); +} +Variant ei_mcrypt_decrypt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_decrypt); + int count = params.size(); + if (count <= 4) return (f_mcrypt_decrypt(a0, a1, a2, a3)); + return (f_mcrypt_decrypt(a0, a1, a2, a3, a4)); +} +Variant ei_natcasesort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(natcasesort); + return (f_natcasesort(ref(a0))); +} +Variant ei_array_chunk(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_chunk); + int count = params.size(); + if (count <= 2) return (f_array_chunk(a0, a1)); + return (f_array_chunk(a0, a1, a2)); +} +Variant ei_imagefilledpolygon(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagefilledpolygon); + return (f_imagefilledpolygon(a0, a1, a2, a3)); +} +Variant ei_drawpoppattern(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpoppattern); + return (f_drawpoppattern(a0), null); +} +Variant ei_magickgetimagewidth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagewidth); + return (f_magickgetimagewidth(a0)); +} +Variant ei_drawgetfontfamily(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetfontfamily); + return (f_drawgetfontfamily(a0)); +} +Variant ei_dl(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(dl); + return (f_dl(a0)); +} +Variant ei_touch(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(touch); + int count = params.size(); + if (count <= 1) return (f_touch(a0)); + if (count == 2) return (f_touch(a0, a1)); + return (f_touch(a0, a1, a2)); +} +Variant ei_magicksetimagebordercolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagebordercolor); + return (f_magicksetimagebordercolor(a0, a1)); +} +Variant ei_magickspliceimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickspliceimage); + return (f_magickspliceimage(a0, a1, a2, a3, a4)); +} +Variant ei_define(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(define); + int count = params.size(); + if (count <= 2) return (f_define(a0, a1)); + return (f_define(a0, a1, a2)); +} +Variant ei_headers_sent(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(headers_sent); + int count = params.size(); + if (count <= 0) return (f_headers_sent()); + if (count == 1) return (f_headers_sent(ref(a0))); + return (f_headers_sent(ref(a0), ref(a1))); +} +Variant ei_stream_context_get_options(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_context_get_options); + return (f_stream_context_get_options(a0)); +} +Variant ei_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(file); + int count = params.size(); + if (count <= 1) return (f_file(a0)); + if (count == 2) return (f_file(a0, a1)); + return (f_file(a0, a1, a2)); +} +Variant ei_imagecolorresolvealpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorresolvealpha); + return (f_imagecolorresolvealpha(a0, a1, a2, a3, a4)); +} +Variant ei_strtr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strtr); + int count = params.size(); + if (count <= 2) return (f_strtr(a0, a1)); + return (f_strtr(a0, a1, a2)); +} +Variant ei_posix_strerror(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_strerror); + return (f_posix_strerror(a0)); +} +Variant ei_libxml_use_internal_errors(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(libxml_use_internal_errors); + int count = params.size(); + if (count <= 0) return (f_libxml_use_internal_errors()); + return (f_libxml_use_internal_errors(a0)); +} +Variant ei_openssl_get_publickey(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_get_publickey); + return (f_openssl_get_publickey(a0)); +} +Variant ei_time_nanosleep(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(time_nanosleep); + return (f_time_nanosleep(a0, a1)); +} +Variant ei_magicksetimageunits(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimageunits); + return (f_magicksetimageunits(a0, a1)); +} +Variant ei_floor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(floor); + return (f_floor(a0)); +} +Variant ei_array_pad(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_pad); + return (f_array_pad(a0, a1, a2)); +} +Variant ei_sem_release(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sem_release); + return (f_sem_release(a0)); +} +Variant ei_highlight_string(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(highlight_string); + int count = params.size(); + if (count <= 1) return (f_highlight_string(a0)); + return (f_highlight_string(a0, a1)); +} +Variant ei_hphp_invoke(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_invoke); + return (f_hphp_invoke(a0, a1)); +} +Variant ei_imageloadfont(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imageloadfont); + return (f_imageloadfont(a0)); +} +Variant ei_xmlwriter_start_element(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_element); + return (f_xmlwriter_start_element(a0, a1)); +} +Variant ei_localeconv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(localeconv); + return (f_localeconv()); +} +Variant ei_exif_thumbnail(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(exif_thumbnail); + int count = params.size(); + if (count <= 1) return (f_exif_thumbnail(a0)); + if (count == 2) return (f_exif_thumbnail(a0, ref(a1))); + if (count == 3) return (f_exif_thumbnail(a0, ref(a1), ref(a2))); + return (f_exif_thumbnail(a0, ref(a1), ref(a2), ref(a3))); +} +Variant ei_mysql_get_proto_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_get_proto_info); + int count = params.size(); + if (count <= 0) return (f_mysql_get_proto_info()); + return (f_mysql_get_proto_info(a0)); +} +Variant ei_imagefontwidth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagefontwidth); + return (f_imagefontwidth(a0)); +} +Variant ei_substr_compare(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(substr_compare); + int count = params.size(); + if (count <= 3) return (f_substr_compare(a0, a1, a2)); + if (count == 4) return (f_substr_compare(a0, a1, a2, a3)); + return (f_substr_compare(a0, a1, a2, a3, a4)); +} +Variant ei_xbox_post_message(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xbox_post_message); + int count = params.size(); + if (count <= 1) return (f_xbox_post_message(a0)); + return (f_xbox_post_message(a0, a1)); +} +Variant ei_fb_rename_function(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_rename_function); + return (f_fb_rename_function(a0, a1)); +} +Variant ei_array_walk_recursive(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_walk_recursive); + int count = params.size(); + if (count <= 2) return (f_array_walk_recursive(ref(a0), a1)); + return (f_array_walk_recursive(ref(a0), a1, a2)); +} +Variant ei_mysql_list_processes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_list_processes); + int count = params.size(); + if (count <= 0) return (f_mysql_list_processes()); + return (f_mysql_list_processes(a0)); +} +Variant ei_imagedashedline(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagedashedline); + return (f_imagedashedline(a0, a1, a2, a3, a4, a5)); +} +Variant ei_magickgetimagedelay(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagedelay); + return (f_magickgetimagedelay(a0)); +} +Variant ei_pi(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pi); + return (f_pi()); +} +Variant ei_mb_substr_count(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_substr_count); + int count = params.size(); + if (count <= 2) return (f_mb_substr_count(a0, a1)); + return (f_mb_substr_count(a0, a1, a2)); +} +Variant ei_hotprofiler_disable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hotprofiler_disable); + return (f_hotprofiler_disable()); +} +Variant ei_magickgettextdescent(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgettextdescent); + int count = params.size(); + if (count <= 3) return (f_magickgettextdescent(a0, a1, a2)); + return (f_magickgettextdescent(a0, a1, a2, a3)); +} +Variant ei_drawsetstrokealpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokealpha); + return (f_drawsetstrokealpha(a0, a1), null); +} +Variant ei_apc_delete_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_delete_file); + int count = params.size(); + if (count <= 1) return (f_apc_delete_file(a0)); + return (f_apc_delete_file(a0, a1)); +} +Variant ei_strrpos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strrpos); + int count = params.size(); + if (count <= 2) return (f_strrpos(a0, a1)); + return (f_strrpos(a0, a1, a2)); +} +Variant ei_array_diff_assoc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_diff_assoc); + int count = params.size(); + if (count <= 2) return (f_array_diff_assoc(count, a0, a1)); + return (f_array_diff_assoc(count, a0, a1,vargs)); +} +Variant ei_magickclippathimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickclippathimage); + return (f_magickclippathimage(a0, a1, a2)); +} +Variant ei_xmlwriter_write_element(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_element); + int count = params.size(); + if (count <= 2) return (f_xmlwriter_write_element(a0, a1)); + return (f_xmlwriter_write_element(a0, a1, a2)); +} +Variant ei_ascii2ebcdic(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ascii2ebcdic); + return (f_ascii2ebcdic(a0)); +} +Variant ei_ereg(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ereg); + int count = params.size(); + if (count <= 2) return (f_ereg(a0, a1)); + return (f_ereg(a0, a1, ref(a2))); +} +Variant ei_curl_multi_info_read(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_multi_info_read); + int count = params.size(); + if (count <= 1) return (f_curl_multi_info_read(a0)); + return (f_curl_multi_info_read(a0, ref(a1))); +} +Variant ei_oci_field_size(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_field_size); + return (f_oci_field_size(a0, a1)); +} +Variant ei_magickthresholdimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickthresholdimage); + int count = params.size(); + if (count <= 2) return (f_magickthresholdimage(a0, a1)); + return (f_magickthresholdimage(a0, a1, a2)); +} +Variant ei_msg_remove_queue(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(msg_remove_queue); + return (f_msg_remove_queue(a0)); +} +Variant ei_mb_strlen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strlen); + int count = params.size(); + if (count <= 1) return (f_mb_strlen(a0)); + return (f_mb_strlen(a0, a1)); +} +Variant ei_drawgetclippath(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetclippath); + return (f_drawgetclippath(a0)); +} +Variant ei_imagecopy(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecopy); + return (f_imagecopy(a0, a1, a2, a3, a4, a5, a6, a7)); +} +Variant ei_pixelsetcolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetcolor); + return (f_pixelsetcolor(a0, a1), null); +} +Variant ei_time_sleep_until(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(time_sleep_until); + return (f_time_sleep_until(a0)); +} +Variant ei_mb_ereg_replace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_ereg_replace); + int count = params.size(); + if (count <= 3) return (f_mb_ereg_replace(a0, a1, a2)); + return (f_mb_ereg_replace(a0, a1, a2, a3)); +} +Variant ei_openssl_csr_get_public_key(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_csr_get_public_key); + return (f_openssl_csr_get_public_key(a0)); +} +Variant ei_magickfximage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickfximage); + int count = params.size(); + if (count <= 2) return (f_magickfximage(a0, a1)); + return (f_magickfximage(a0, a1, a2)); +} +Variant ei_tmpfile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(tmpfile); + return (f_tmpfile()); +} +Variant ei_hash(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hash); + int count = params.size(); + if (count <= 2) return (f_hash(a0, a1)); + return (f_hash(a0, a1, a2)); +} +Variant ei_uasort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(uasort); + return (f_uasort(ref(a0), a1)); +} +Variant ei_pixelgetalpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetalpha); + return (f_pixelgetalpha(a0)); +} +Variant ei_drawsettextencoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsettextencoding); + return (f_drawsettextencoding(a0, a1), null); +} +Variant ei_apache_request_headers(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_request_headers); + return (f_apache_request_headers()); +} +Variant ei_is_subclass_of(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_subclass_of); + return (f_is_subclass_of(a0, a1)); +} +Variant ei_pixelgetmagentaquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetmagentaquantum); + return (f_pixelgetmagentaquantum(a0)); +} +Variant ei_hphp_get_static_property(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_get_static_property); + return (f_hphp_get_static_property(a0, a1)); +} +Variant ei_array_pop(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_pop); + return (f_array_pop(ref(a0))); +} +Variant ei_magickgetimagecolors(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagecolors); + return (f_magickgetimagecolors(a0)); +} +Variant ei_class_exists(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(class_exists); + int count = params.size(); + if (count <= 1) return (f_class_exists(a0)); + return (f_class_exists(a0, a1)); +} +Variant ei_getallheaders(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getallheaders); + return (f_getallheaders()); +} +Variant ei_get_extension_funcs(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_extension_funcs); + return (f_get_extension_funcs(a0)); +} +Variant ei_imagecolordeallocate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolordeallocate); + return (f_imagecolordeallocate(a0, a1)); +} +Variant ei_closelog(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(closelog); + return (f_closelog(), null); +} +Variant ei_drawpathlinetoabsolute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathlinetoabsolute); + return (f_drawpathlinetoabsolute(a0, a1, a2), null); +} +Variant ei_mcrypt_enc_get_iv_size(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_enc_get_iv_size); + return (f_mcrypt_enc_get_iv_size(a0)); +} +Variant ei_json_decode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(json_decode); + int count = params.size(); + if (count <= 1) return (f_json_decode(a0)); + if (count == 2) return (f_json_decode(a0, a1)); + return (f_json_decode(a0, a1, a2)); +} +Variant ei_preg_replace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(preg_replace); + int count = params.size(); + if (count <= 3) return (f_preg_replace(a0, a1, a2)); + if (count == 4) return (f_preg_replace(a0, a1, a2, a3)); + return (f_preg_replace(a0, a1, a2, a3, ref(a4))); +} +Variant ei_fmod(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fmod); + return (f_fmod(a0, a1)); +} +Variant ei_curl_errno(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_errno); + return (f_curl_errno(a0)); +} +Variant ei_pagelet_server_task_start(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pagelet_server_task_start); + int count = params.size(); + if (count <= 1) return (f_pagelet_server_task_start(a0)); + if (count == 2) return (f_pagelet_server_task_start(a0, a1)); + return (f_pagelet_server_task_start(a0, a1, a2)); +} +Variant ei_hash_init(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hash_init); + int count = params.size(); + if (count <= 1) return (f_hash_init(a0)); + if (count == 2) return (f_hash_init(a0, a1)); + return (f_hash_init(a0, a1, a2)); +} +Variant ei_mb_strripos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strripos); + int count = params.size(); + if (count <= 2) return (f_mb_strripos(a0, a1)); + if (count == 3) return (f_mb_strripos(a0, a1, a2)); + return (f_mb_strripos(a0, a1, a2, a3)); +} +Variant ei_mysql_fetch_row(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_fetch_row); + return (f_mysql_fetch_row(a0)); +} +Variant ei_ob_get_flush(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_get_flush); + return (f_ob_get_flush()); +} +Variant ei_curl_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_error); + return (f_curl_error(a0)); +} +Variant ei_oci_new_connect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_new_connect); + int count = params.size(); + if (count <= 2) return (f_oci_new_connect(a0, a1)); + if (count == 3) return (f_oci_new_connect(a0, a1, a2)); + if (count == 4) return (f_oci_new_connect(a0, a1, a2, a3)); + return (f_oci_new_connect(a0, a1, a2, a3, a4)); +} +Variant ei_set_magic_quotes_runtime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(set_magic_quotes_runtime); + return (f_set_magic_quotes_runtime(a0)); +} +Variant ei_magickcharcoalimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcharcoalimage); + return (f_magickcharcoalimage(a0, a1, a2)); +} +Variant ei_scandir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(scandir); + int count = params.size(); + if (count <= 1) return (f_scandir(a0)); + if (count == 2) return (f_scandir(a0, a1)); + return (f_scandir(a0, a1, a2)); +} +Variant ei_magickmosaicimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickmosaicimages); + return (f_magickmosaicimages(a0)); +} +Variant ei_timezone_transitions_get(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(timezone_transitions_get); + return (f_timezone_transitions_get(a0)); +} +Variant ei_drawsetfontweight(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfontweight); + return (f_drawsetfontweight(a0, a1), null); +} +Variant ei_popdrawingwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(popdrawingwand); + return (f_popdrawingwand(a0), null); +} +Variant ei_socket_shutdown(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_shutdown); + int count = params.size(); + if (count <= 1) return (f_socket_shutdown(a0)); + return (f_socket_shutdown(a0, a1)); +} +Variant ei_mcrypt_create_iv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_create_iv); + int count = params.size(); + if (count <= 1) return (f_mcrypt_create_iv(a0)); + return (f_mcrypt_create_iv(a0, a1)); +} +Variant ei_eval(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(eval); + return (f_eval(a0)); +} +Variant ei_fbml_get_attribute_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_get_attribute_11); + return (f_fbml_get_attribute_11(a0, a1)); +} +Variant ei_bindec(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bindec); + return (f_bindec(a0)); +} +Variant ei_fileperms(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fileperms); + return (f_fileperms(a0)); +} +Variant ei_unserialize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(unserialize); + return (f_unserialize(a0)); +} +Variant ei_ldap_t61_to_8859(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_t61_to_8859); + return (f_ldap_t61_to_8859(a0)); +} +Variant ei_urldecode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(urldecode); + return (f_urldecode(a0)); +} +Variant ei_magickannotateimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickannotateimage); + return (f_magickannotateimage(a0, a1, a2, a3, a4, a5)); +} +Variant ei_mailparse_msg_create(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_msg_create); + return (f_mailparse_msg_create()); +} +Variant ei_oci_field_type_raw(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_field_type_raw); + return (f_oci_field_type_raw(a0, a1)); +} +Variant ei_apache_get_modules(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_get_modules); + return (f_apache_get_modules()); +} +Variant ei_drawellipse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawellipse); + return (f_drawellipse(a0, a1, a2, a3, a4, a5, a6), null); +} +Variant ei_xmlwriter_write_element_ns(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_element_ns); + int count = params.size(); + if (count <= 4) return (f_xmlwriter_write_element_ns(a0, a1, a2, a3)); + return (f_xmlwriter_write_element_ns(a0, a1, a2, a3, a4)); +} +Variant ei_magicksetcompressionquality(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetcompressionquality); + return (f_magicksetcompressionquality(a0, a1)); +} +Variant ei_magickaddnoiseimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickaddnoiseimage); + return (f_magickaddnoiseimage(a0, a1)); +} +Variant ei_magickgetimagewhitepoint(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagewhitepoint); + return (f_magickgetimagewhitepoint(a0)); +} +Variant ei_magickseparateimagechannel(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickseparateimagechannel); + return (f_magickseparateimagechannel(a0, a1)); +} +Variant ei_array_push(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_push); + int count = params.size(); + if (count <= 2) return (f_array_push(count, ref(a0), a1)); + return (f_array_push(count, ref(a0), a1,vargs)); +} +Variant ei_flush(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(flush); + return (f_flush(), null); +} +Variant ei_connection_aborted(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(connection_aborted); + return (f_connection_aborted()); +} +Variant ei_uksort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(uksort); + return (f_uksort(ref(a0), a1)); +} +Variant ei_mysql_set_timeout(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_set_timeout); + int count = params.size(); + if (count <= 0) return (f_mysql_set_timeout()); + if (count == 1) return (f_mysql_set_timeout(a0)); + return (f_mysql_set_timeout(a0, a1)); +} +Variant ei_hash_update_stream(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hash_update_stream); + int count = params.size(); + if (count <= 2) return (f_hash_update_stream(a0, a1)); + return (f_hash_update_stream(a0, a1, a2)); +} +Variant ei_ob_start(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_start); + int count = params.size(); + if (count <= 0) return (f_ob_start()); + if (count == 1) return (f_ob_start(a0)); + if (count == 2) return (f_ob_start(a0, a1)); + return (f_ob_start(a0, a1, a2)); +} +Variant ei_mysql_get_host_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_get_host_info); + int count = params.size(); + if (count <= 0) return (f_mysql_get_host_info()); + return (f_mysql_get_host_info(a0)); +} +Variant ei_mb_language(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_language); + int count = params.size(); + if (count <= 0) return (f_mb_language()); + return (f_mb_language(a0)); +} +Variant ei_pixelgetnextiteratorrow(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetnextiteratorrow); + return (f_pixelgetnextiteratorrow(a0)); +} +Variant ei_ldap_next_reference(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_next_reference); + return (f_ldap_next_reference(a0, a1)); +} +Variant ei_socket_get_status(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_get_status); + return (f_socket_get_status(a0)); +} +Variant ei_checkdnsrr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(checkdnsrr); + int count = params.size(); + if (count <= 1) return (f_checkdnsrr(a0)); + return (f_checkdnsrr(a0, a1)); +} +Variant ei_openssl_verify(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_verify); + int count = params.size(); + if (count <= 3) return (f_openssl_verify(a0, a1, a2)); + return (f_openssl_verify(a0, a1, a2, a3)); +} +Variant ei_curl_exec(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_exec); + return (f_curl_exec(a0)); +} +Variant ei_magickgetexceptiontype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetexceptiontype); + return (f_magickgetexceptiontype(a0)); +} +Variant ei_array_sum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_sum); + return (f_array_sum(a0)); +} +Variant ei_unregister_tick_function(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(unregister_tick_function); + return (f_unregister_tick_function(a0), null); +} +Variant ei_newpixelwandarray(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(newpixelwandarray); + return (f_newpixelwandarray(a0)); +} +Variant ei_magickgetversion(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetversion); + return (f_magickgetversion()); +} +Variant ei_imagelayereffect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagelayereffect); + return (f_imagelayereffect(a0, a1)); +} +Variant ei_apache_reset_timeout(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_reset_timeout); + return (f_apache_reset_timeout()); +} +Variant ei_glob(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(glob); + int count = params.size(); + if (count <= 1) return (f_glob(a0)); + return (f_glob(a0, a1)); +} +Variant ei_exec(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(exec); + int count = params.size(); + if (count <= 1) return (f_exec(a0)); + if (count == 2) return (f_exec(a0, ref(a1))); + return (f_exec(a0, ref(a1), ref(a2))); +} +Variant ei_apd_continue(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apd_continue); + return (f_apd_continue()); +} +Variant ei_magickgetimagedepth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagedepth); + int count = params.size(); + if (count <= 1) return (f_magickgetimagedepth(a0)); + return (f_magickgetimagedepth(a0, a1)); +} +Variant ei_pclose(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pclose); + return (f_pclose(a0)); +} +Variant ei_get_parent_class(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_parent_class); + int count = params.size(); + if (count <= 0) return (f_get_parent_class()); + return (f_get_parent_class(a0)); +} +Variant ei_fql_static_data_set_10(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fql_static_data_set_10); + return (f_fql_static_data_set_10()); +} +Variant ei_mb_strpos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strpos); + int count = params.size(); + if (count <= 2) return (f_mb_strpos(a0, a1)); + if (count == 3) return (f_mb_strpos(a0, a1, a2)); + return (f_mb_strpos(a0, a1, a2, a3)); +} +Variant ei_xmlwriter_write_dtd_attlist(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_dtd_attlist); + return (f_xmlwriter_write_dtd_attlist(a0, a1, a2)); +} +Variant ei_xml_set_element_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_set_element_handler); + return (f_xml_set_element_handler(a0, a1, a2)); +} +Variant ei_drawgetstrokeopacity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetstrokeopacity); + return (f_drawgetstrokeopacity(a0)); +} +Variant ei_ldap_get_entries(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_get_entries); + return (f_ldap_get_entries(a0, a1)); +} +Variant ei_fb_run_mcproxy(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_run_mcproxy); + return (f_fb_run_mcproxy(), null); +} +Variant ei_ob_iconv_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_iconv_handler); + return (f_ob_iconv_handler(a0, a1)); +} +Variant ei_pathinfo(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pathinfo); + int count = params.size(); + if (count <= 1) return (f_pathinfo(a0)); + return (f_pathinfo(a0, a1)); +} +Variant ei_magickaffinetransformimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickaffinetransformimage); + return (f_magickaffinetransformimage(a0, a1)); +} +Variant ei_ob_get_status(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_get_status); + int count = params.size(); + if (count <= 0) return (f_ob_get_status()); + return (f_ob_get_status(a0)); +} +Variant ei_exit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(exit); + int count = params.size(); + if (count <= 0) return (f_exit()); + return (f_exit(a0)); +} +Variant ei_apc_sma_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_sma_info); + int count = params.size(); + if (count <= 0) return (f_apc_sma_info()); + return (f_apc_sma_info(a0)); +} +Variant ei_ldap_bind(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_bind); + int count = params.size(); + if (count <= 1) return (f_ldap_bind(a0)); + if (count == 2) return (f_ldap_bind(a0, a1)); + return (f_ldap_bind(a0, a1, a2)); +} +Variant ei_pixelsetbluequantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetbluequantum); + return (f_pixelsetbluequantum(a0, a1), null); +} +Variant ei_magickreadimagefile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickreadimagefile); + return (f_magickreadimagefile(a0, a1)); +} +Variant ei_ebcdic2ascii(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ebcdic2ascii); + return (f_ebcdic2ascii(a0)); +} +Variant ei_mysql_real_escape_string(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_real_escape_string); + int count = params.size(); + if (count <= 1) return (f_mysql_real_escape_string(a0)); + return (f_mysql_real_escape_string(a0, a1)); +} +Variant ei_magickframeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickframeimage); + return (f_magickframeimage(a0, a1, a2, a3, a4, a5)); +} +Variant ei_pixelgetblue(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetblue); + return (f_pixelgetblue(a0)); +} +Variant ei_imagefill(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagefill); + return (f_imagefill(a0, a1, a2, a3)); +} +Variant ei_hphp_set_property(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_set_property); + return (f_hphp_set_property(a0, a1, a2, a3), null); +} +Variant ei_oci_execute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_execute); + int count = params.size(); + if (count <= 1) return (f_oci_execute(a0)); + return (f_oci_execute(a0, a1)); +} +Variant ei_oci_cancel(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_cancel); + return (f_oci_cancel(a0)); +} +Variant ei_readgzfile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(readgzfile); + int count = params.size(); + if (count <= 1) return (f_readgzfile(a0)); + return (f_readgzfile(a0, a1)); +} +Variant ei_fb_backtrace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_backtrace); + int count = params.size(); + if (count <= 0) return (f_fb_backtrace()); + return (f_fb_backtrace(a0)); +} +Variant ei_magicksampleimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksampleimage); + return (f_magicksampleimage(a0, a1, a2)); +} +Variant ei_mysql_escape_string(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_escape_string); + return (f_mysql_escape_string(a0)); +} +Variant ei_idn_to_utf8(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(idn_to_utf8); + int count = params.size(); + if (count <= 1) return (f_idn_to_utf8(a0)); + return (f_idn_to_utf8(a0, ref(a1))); +} +Variant ei_sql_regcase(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sql_regcase); + return (f_sql_regcase(a0)); +} +Variant ei_in_array(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(in_array); + int count = params.size(); + if (count <= 2) return (f_in_array(a0, a1)); + return (f_in_array(a0, a1, a2)); +} +Variant ei_drawpathcurvetoquadraticbezierabsolute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathcurvetoquadraticbezierabsolute); + return (f_drawpathcurvetoquadraticbezierabsolute(a0, a1, a2, a3, a4), null); +} +Variant ei_apache_getenv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_getenv); + int count = params.size(); + if (count <= 1) return (f_apache_getenv(a0)); + return (f_apache_getenv(a0, a1)); +} +Variant ei_socket_set_timeout(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_set_timeout); + int count = params.size(); + if (count <= 2) return (f_socket_set_timeout(a0, a1)); + return (f_socket_set_timeout(a0, a1, a2)); +} +Variant ei_bin2hex(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bin2hex); + return (f_bin2hex(a0)); +} +Variant ei_error_get_last(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(error_get_last); + return (f_error_get_last()); +} +Variant ei_is_link(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_link); + return (f_is_link(a0)); +} +Variant ei_set_file_buffer(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(set_file_buffer); + return (f_set_file_buffer(a0, a1)); +} +Variant ei_magicksetimageredprimary(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimageredprimary); + return (f_magicksetimageredprimary(a0, a1, a2)); +} +Variant ei_i18n_loc_set_default(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(i18n_loc_set_default); + return (f_i18n_loc_set_default(a0)); +} +Variant ei_ftok(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ftok); + return (f_ftok(a0, a1)); +} +Variant ei_mysql_list_fields(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_list_fields); + int count = params.size(); + if (count <= 2) return (f_mysql_list_fields(a0, a1)); + return (f_mysql_list_fields(a0, a1, a2)); +} +Variant ei_stream_wrapper_register(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_wrapper_register); + return (f_stream_wrapper_register(a0, a1)); +} +Variant ei_pixelsetredquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetredquantum); + return (f_pixelsetredquantum(a0, a1), null); +} +Variant ei_xhprof_disable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xhprof_disable); + return (f_xhprof_disable()); +} +Variant ei_magickgammaimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgammaimage); + int count = params.size(); + if (count <= 2) return (f_magickgammaimage(a0, a1)); + return (f_magickgammaimage(a0, a1, a2)); +} +Variant ei_pixelsetcyan(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetcyan); + return (f_pixelsetcyan(a0, a1), null); +} +Variant ei_mb_decode_mimeheader(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_decode_mimeheader); + return (f_mb_decode_mimeheader(a0)); +} +Variant ei_htmlentities(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(htmlentities); + int count = params.size(); + if (count <= 1) return (f_htmlentities(a0)); + if (count == 2) return (f_htmlentities(a0, a1)); + if (count == 3) return (f_htmlentities(a0, a1, a2)); + return (f_htmlentities(a0, a1, a2, a3)); +} +Variant ei_rad2deg(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rad2deg); + return (f_rad2deg(a0)); +} +Variant ei_xmlwriter_start_dtd(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_dtd); + int count = params.size(); + if (count <= 2) return (f_xmlwriter_start_dtd(a0, a1)); + if (count == 3) return (f_xmlwriter_start_dtd(a0, a1, a2)); + return (f_xmlwriter_start_dtd(a0, a1, a2, a3)); +} +Variant ei_drawpathstart(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathstart); + return (f_drawpathstart(a0), null); +} +Variant ei_proc_nice(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(proc_nice); + return (f_proc_nice(a0)); +} +Variant ei_hphp_thread_is_warmup_enabled(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_thread_is_warmup_enabled); + return (f_hphp_thread_is_warmup_enabled()); +} +Variant ei_imagepsslantfont(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagepsslantfont); + return (f_imagepsslantfont(a0, a1)); +} +Variant ei_magickgetimagemattecolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagemattecolor); + return (f_magickgetimagemattecolor(a0)); +} +Variant ei_mb_strstr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strstr); + int count = params.size(); + if (count <= 2) return (f_mb_strstr(a0, a1)); + if (count == 3) return (f_mb_strstr(a0, a1, a2)); + return (f_mb_strstr(a0, a1, a2, a3)); +} +Variant ei_pixelgetblack(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetblack); + return (f_pixelgetblack(a0)); +} +Variant ei_mysql_field_table(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_field_table); + int count = params.size(); + if (count <= 1) return (f_mysql_field_table(a0)); + return (f_mysql_field_table(a0, a1)); +} +Variant ei_magicksetimagescene(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagescene); + return (f_magicksetimagescene(a0, a1)); +} +Variant ei_magickgetimagerenderingintent(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagerenderingintent); + return (f_magickgetimagerenderingintent(a0)); +} +Variant ei_setlocale(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(setlocale); + int count = params.size(); + if (count <= 2) return (f_setlocale(count, a0, a1)); + return (f_setlocale(count, a0, a1,vargs)); +} +Variant ei_drawpushclippath(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpushclippath); + return (f_drawpushclippath(a0, a1), null); +} +Variant ei_drawpopclippath(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpopclippath); + return (f_drawpopclippath(a0), null); +} +Variant ei_nl2br(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(nl2br); + return (f_nl2br(a0)); +} +Variant ei_drawsetfillopacity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfillopacity); + return (f_drawsetfillopacity(a0, a1), null); +} +Variant ei_mb_substitute_character(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_substitute_character); + int count = params.size(); + if (count <= 0) return (f_mb_substitute_character()); + return (f_mb_substitute_character(a0)); +} +Variant ei_setrawcookie(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(setrawcookie); + int count = params.size(); + if (count <= 1) return (f_setrawcookie(a0)); + if (count == 2) return (f_setrawcookie(a0, a1)); + if (count == 3) return (f_setrawcookie(a0, a1, a2)); + if (count == 4) return (f_setrawcookie(a0, a1, a2, a3)); + if (count == 5) return (f_setrawcookie(a0, a1, a2, a3, a4)); + if (count == 6) return (f_setrawcookie(a0, a1, a2, a3, a4, a5)); + return (f_setrawcookie(a0, a1, a2, a3, a4, a5, a6)); +} +Variant ei_evhttp_get(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(evhttp_get); + int count = params.size(); + if (count <= 1) return (f_evhttp_get(a0)); + if (count == 2) return (f_evhttp_get(a0, a1)); + return (f_evhttp_get(a0, a1, a2)); +} +Variant ei_getimagesize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getimagesize); + int count = params.size(); + if (count <= 1) return (f_getimagesize(a0)); + return (f_getimagesize(a0, ref(a1))); +} +Variant ei_ldap_modify(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_modify); + return (f_ldap_modify(a0, a1, a2)); +} +Variant ei_ldap_search(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_search); + int count = params.size(); + if (count <= 3) return (f_ldap_search(a0, a1, a2)); + if (count == 4) return (f_ldap_search(a0, a1, a2, a3)); + if (count == 5) return (f_ldap_search(a0, a1, a2, a3, a4)); + if (count == 6) return (f_ldap_search(a0, a1, a2, a3, a4, a5)); + if (count == 7) return (f_ldap_search(a0, a1, a2, a3, a4, a5, a6)); + return (f_ldap_search(a0, a1, a2, a3, a4, a5, a6, a7)); +} +Variant ei_strcasecmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strcasecmp); + return (f_strcasecmp(a0, a1)); +} +Variant ei_magickgetimagesignature(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagesignature); + return (f_magickgetimagesignature(a0)); +} +Variant ei_get_class_methods(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_class_methods); + return (f_get_class_methods(a0)); +} +Variant ei_fopen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fopen); + int count = params.size(); + if (count <= 2) return (f_fopen(a0, a1)); + if (count == 3) return (f_fopen(a0, a1, a2)); + return (f_fopen(a0, a1, a2, a3)); +} +Variant ei_mcrypt_generic_end(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_generic_end); + return (f_mcrypt_generic_end(a0)); +} +Variant ei_openssl_pkey_free(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkey_free); + return (f_openssl_pkey_free(a0), null); +} +Variant ei_fbml_get_tag_name_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_get_tag_name_11); + return (f_fbml_get_tag_name_11(a0)); +} +Variant ei_readlink(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(readlink); + return (f_readlink(a0)); +} +Variant ei_magickechoimagesblob(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickechoimagesblob); + return (f_magickechoimagesblob(a0)); +} +Variant ei_mailparse_msg_parse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_msg_parse); + return (f_mailparse_msg_parse(a0, a1)); +} +Variant ei_xmlwriter_text(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_text); + return (f_xmlwriter_text(a0, a1)); +} +Variant ei_pixelsetindex(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetindex); + return (f_pixelsetindex(a0, a1), null); +} +Variant ei_php_sapi_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(php_sapi_name); + return (f_php_sapi_name()); +} +Variant ei_mcrypt_enc_get_key_size(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_enc_get_key_size); + return (f_mcrypt_enc_get_key_size(a0)); +} +Variant ei_mysql_num_fields(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_num_fields); + return (f_mysql_num_fields(a0)); +} +Variant ei_phprof_enable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(phprof_enable); + int count = params.size(); + if (count <= 0) return (f_phprof_enable(), null); + return (f_phprof_enable(a0), null); +} +Variant ei_magicksteganoimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksteganoimage); + return (f_magicksteganoimage(a0, a1, a2)); +} +Variant ei_magicksetfirstiterator(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetfirstiterator); + return (f_magicksetfirstiterator(a0), null); +} +Variant ei_pixelgetcolorasstring(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetcolorasstring); + return (f_pixelgetcolorasstring(a0)); +} +Variant ei_magickremoveimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickremoveimage); + return (f_magickremoveimage(a0)); +} +Variant ei_file_exists(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(file_exists); + return (f_file_exists(a0)); +} +Variant ei_call_user_func_array(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(call_user_func_array); + return (f_call_user_func_array(a0, a1)); +} +Variant ei_restore_include_path(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(restore_include_path); + return (f_restore_include_path(), null); +} +Variant ei_drawgettextundercolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgettextundercolor); + return (f_drawgettextundercolor(a0)); +} +Variant ei_array_shift(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_shift); + return (f_array_shift(ref(a0))); +} +Variant ei_magicksetimageformat(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimageformat); + return (f_magicksetimageformat(a0, a1)); +} +Variant ei_xmlwriter_open_memory(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_open_memory); + return (f_xmlwriter_open_memory()); +} +Variant ei_drawsetstrokemiterlimit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokemiterlimit); + return (f_drawsetstrokemiterlimit(a0, a1), null); +} +Variant ei_mb_convert_kana(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_convert_kana); + int count = params.size(); + if (count <= 1) return (f_mb_convert_kana(a0)); + if (count == 2) return (f_mb_convert_kana(a0, a1)); + return (f_mb_convert_kana(a0, a1, a2)); +} +Variant ei_token_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(token_name); + return (f_token_name(a0)); +} +Variant ei_preg_quote(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(preg_quote); + int count = params.size(); + if (count <= 1) return (f_preg_quote(a0)); + return (f_preg_quote(a0, a1)); +} +Variant ei_hphp_service_thread_started(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_service_thread_started); + return (f_hphp_service_thread_started(), null); +} +Variant ei_magickconvolveimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickconvolveimage); + int count = params.size(); + if (count <= 2) return (f_magickconvolveimage(a0, a1)); + return (f_magickconvolveimage(a0, a1, a2)); +} +Variant ei_curl_getinfo(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_getinfo); + int count = params.size(); + if (count <= 1) return (f_curl_getinfo(a0)); + return (f_curl_getinfo(a0, a1)); +} +Variant ei_pfsockopen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pfsockopen); + int count = params.size(); + if (count <= 1) return (f_pfsockopen(a0)); + if (count == 2) return (f_pfsockopen(a0, a1)); + if (count == 3) return (f_pfsockopen(a0, a1, ref(a2))); + if (count == 4) return (f_pfsockopen(a0, a1, ref(a2), ref(a3))); + return (f_pfsockopen(a0, a1, ref(a2), ref(a3), a4)); +} +Variant ei_ucfirst(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ucfirst); + return (f_ucfirst(a0)); +} +Variant ei_chroot(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(chroot); + return (f_chroot(a0)); +} +Variant ei_chdir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(chdir); + return (f_chdir(a0)); +} +Variant ei_socket_write(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_write); + int count = params.size(); + if (count <= 2) return (f_socket_write(a0, a1)); + return (f_socket_write(a0, a1, a2)); +} +Variant ei_stream_bucket_new(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_bucket_new); + return (f_stream_bucket_new(a0, a1)); +} +Variant ei_magickflipimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickflipimage); + return (f_magickflipimage(a0)); +} +Variant ei_timezone_identifiers_list(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(timezone_identifiers_list); + return (f_timezone_identifiers_list()); +} +Variant ei_array_diff_key(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_diff_key); + int count = params.size(); + if (count <= 2) return (f_array_diff_key(count, a0, a1)); + return (f_array_diff_key(count, a0, a1,vargs)); +} +Variant ei_fread(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fread); + return (f_fread(a0, a1)); +} +Variant ei_override_function(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(override_function); + return (f_override_function(a0, a1, a2)); +} +Variant ei_is_long(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_long); + return (f_is_long(a0)); +} +Variant ei_pixelsetred(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetred); + return (f_pixelsetred(a0, a1), null); +} +Variant ei_mailparse_uudecode_all(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_uudecode_all); + return (f_mailparse_uudecode_all(a0)); +} +Variant ei_drawsetvectorgraphics(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetvectorgraphics); + return (f_drawsetvectorgraphics(a0, a1)); +} +Variant ei_oci_parse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_parse); + return (f_oci_parse(a0, a1)); +} +Variant ei_ctype_upper(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_upper); + return (f_ctype_upper(a0)); +} +Variant ei_get_declared_classes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_declared_classes); + return (f_get_declared_classes()); +} +Variant ei_drawgetstrokelinejoin(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetstrokelinejoin); + return (f_drawgetstrokelinejoin(a0)); +} +Variant ei_popen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(popen); + return (f_popen(a0, a1)); +} +Variant ei_ldap_next_entry(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_next_entry); + return (f_ldap_next_entry(a0, a1)); +} +Variant ei_mailparse_msg_parse_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_msg_parse_file); + return (f_mailparse_msg_parse_file(a0)); +} +Variant ei_get_loaded_extensions(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_loaded_extensions); + int count = params.size(); + if (count <= 0) return (f_get_loaded_extensions()); + return (f_get_loaded_extensions(a0)); +} +Variant ei_magickdrawimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickdrawimage); + return (f_magickdrawimage(a0, a1)); +} +Variant ei_mcrypt_cbc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_cbc); + int count = params.size(); + if (count <= 4) return (f_mcrypt_cbc(a0, a1, a2, a3)); + return (f_mcrypt_cbc(a0, a1, a2, a3, a4)); +} +Variant ei_imagecreatetruecolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatetruecolor); + return (f_imagecreatetruecolor(a0, a1)); +} +Variant ei_inet_ntop(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(inet_ntop); + return (f_inet_ntop(a0)); +} +Variant ei_magickreadimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickreadimage); + return (f_magickreadimage(a0, a1)); +} +Variant ei_curl_init(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_init); + int count = params.size(); + if (count <= 0) return (f_curl_init()); + return (f_curl_init(a0)); +} +Variant ei_mcrypt_cfb(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_cfb); + int count = params.size(); + if (count <= 4) return (f_mcrypt_cfb(a0, a1, a2, a3)); + return (f_mcrypt_cfb(a0, a1, a2, a3, a4)); +} +Variant ei_set_time_limit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(set_time_limit); + return (f_set_time_limit(a0), null); +} +Variant ei_libxml_get_errors(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(libxml_get_errors); + return (f_libxml_get_errors()); +} +Variant ei_get_magic_quotes_gpc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_magic_quotes_gpc); + return (f_get_magic_quotes_gpc()); +} +Variant ei_proc_get_status(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(proc_get_status); + return (f_proc_get_status(a0)); +} +Variant ei_log10(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(log10); + return (f_log10(a0)); +} +Variant ei_ldap_get_values(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_get_values); + return (f_ldap_get_values(a0, a1, a2)); +} +Variant ei_is_soap_fault(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_soap_fault); + return (f_is_soap_fault(a0)); +} +Variant ei_magickgetimagechannelmean(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagechannelmean); + return (f_magickgetimagechannelmean(a0, a1)); +} +Variant ei_disk_total_space(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(disk_total_space); + return (f_disk_total_space(a0)); +} +Variant ei_imagegd(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagegd); + int count = params.size(); + if (count <= 1) return (f_imagegd(a0)); + return (f_imagegd(a0, a1)); +} +Variant ei_socket_set_blocking(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_set_blocking); + return (f_socket_set_blocking(a0, a1)); +} +Variant ei_posix_mknod(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_mknod); + int count = params.size(); + if (count <= 2) return (f_posix_mknod(a0, a1)); + if (count == 3) return (f_posix_mknod(a0, a1, a2)); + return (f_posix_mknod(a0, a1, a2, a3)); +} +Variant ei_apc_define_constants(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_define_constants); + int count = params.size(); + if (count <= 2) return (f_apc_define_constants(a0, a1)); + if (count == 3) return (f_apc_define_constants(a0, a1, a2)); + return (f_apc_define_constants(a0, a1, a2, a3)); +} +Variant ei_posix_kill(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_kill); + return (f_posix_kill(a0, a1)); +} +Variant ei_drawgetstrokealpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetstrokealpha); + return (f_drawgetstrokealpha(a0)); +} +Variant ei_mcrypt_get_block_size(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_get_block_size); + int count = params.size(); + if (count <= 1) return (f_mcrypt_get_block_size(a0)); + return (f_mcrypt_get_block_size(a0, a1)); +} +Variant ei_magickmorphimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickmorphimages); + return (f_magickmorphimages(a0, a1)); +} +Variant ei_getlastmod(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getlastmod); + return (f_getlastmod()); +} +Variant ei_magickquantizeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickquantizeimage); + return (f_magickquantizeimage(a0, a1, a2, a3, a4, a5)); +} +Variant ei_imagesavealpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagesavealpha); + return (f_imagesavealpha(a0, a1)); +} +Variant ei_drawsetfontfamily(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfontfamily); + return (f_drawsetfontfamily(a0, a1)); +} +Variant ei_drawsettextantialias(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsettextantialias); + int count = params.size(); + if (count <= 1) return (f_drawsettextantialias(a0), null); + return (f_drawsettextantialias(a0, a1), null); +} +Variant ei_pixelsetgreenquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetgreenquantum); + return (f_pixelsetgreenquantum(a0, a1), null); +} +Variant ei_bcsqrt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bcsqrt); + int count = params.size(); + if (count <= 1) return (f_bcsqrt(a0)); + return (f_bcsqrt(a0, a1)); +} +Variant ei_fbml_sanitize_css_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_sanitize_css_11); + return (f_fbml_sanitize_css_11(a0, a1, a2, a3)); +} +Variant ei_pcntl_signal(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_signal); + int count = params.size(); + if (count <= 2) return (f_pcntl_signal(a0, a1)); + return (f_pcntl_signal(a0, a1, a2)); +} +Variant ei_mcrypt_ecb(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_ecb); + int count = params.size(); + if (count <= 4) return (f_mcrypt_ecb(a0, a1, a2, a3)); + return (f_mcrypt_ecb(a0, a1, a2, a3, a4)); +} +Variant ei_pixelsetcyanquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetcyanquantum); + return (f_pixelsetcyanquantum(a0, a1), null); +} +Variant ei_array_walk(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_walk); + int count = params.size(); + if (count <= 2) return (f_array_walk(ref(a0), a1)); + return (f_array_walk(ref(a0), a1, a2)); +} +Variant ei_getmxrr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getmxrr); + int count = params.size(); + if (count <= 2) return (f_getmxrr(a0, ref(a1))); + return (f_getmxrr(a0, ref(a1), ref(a2))); +} +Variant ei_magickqueryfonts(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickqueryfonts); + return (f_magickqueryfonts(a0)); +} +Variant ei_floatval(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(floatval); + return (f_floatval(a0)); +} +Variant ei_xml_set_object(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_set_object); + return (f_xml_set_object(a0, ref(a1))); +} +Variant ei_ctype_print(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_print); + return (f_ctype_print(a0)); +} +Variant ei_gzwrite(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzwrite); + int count = params.size(); + if (count <= 2) return (f_gzwrite(a0, a1)); + return (f_gzwrite(a0, a1, a2)); +} +Variant ei_magickaddimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickaddimage); + return (f_magickaddimage(a0, a1)); +} +Variant ei_clearstatcache(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(clearstatcache); + return (f_clearstatcache(), null); +} +Variant ei_chgrp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(chgrp); + return (f_chgrp(a0, a1)); +} +Variant ei_virtual(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(virtual); + return (f_virtual(a0)); +} +Variant ei_reset(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(reset); + return (f_reset(ref(a0))); +} +Variant ei_fbml_get_text_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_get_text_11); + return (f_fbml_get_text_11(a0)); +} +Variant ei_oci_field_type(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_field_type); + return (f_oci_field_type(a0, a1)); +} +Variant ei_set_include_path(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(set_include_path); + return (f_set_include_path(a0)); +} +Variant ei_openssl_x509_export(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_x509_export); + int count = params.size(); + if (count <= 2) return (f_openssl_x509_export(a0, ref(a1))); + return (f_openssl_x509_export(a0, ref(a1), a2)); +} +Variant ei_magickcolorizeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcolorizeimage); + return (f_magickcolorizeimage(a0, a1, a2)); +} +Variant ei_imagettftext(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagettftext); + return (f_imagettftext(a0, a1, a2, a3, a4, a5, a6, a7)); +} +Variant ei_mb_strrchr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strrchr); + int count = params.size(); + if (count <= 2) return (f_mb_strrchr(a0, a1)); + if (count == 3) return (f_mb_strrchr(a0, a1, a2)); + return (f_mb_strrchr(a0, a1, a2, a3)); +} +Variant ei_magickgetimageprofile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageprofile); + return (f_magickgetimageprofile(a0, a1)); +} +Variant ei_file_put_contents(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(file_put_contents); + int count = params.size(); + if (count <= 2) return (f_file_put_contents(a0, a1)); + if (count == 3) return (f_file_put_contents(a0, a1, a2)); + return (f_file_put_contents(a0, a1, a2, a3)); +} +Variant ei_iconv_mime_encode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iconv_mime_encode); + int count = params.size(); + if (count <= 2) return (f_iconv_mime_encode(a0, a1)); + return (f_iconv_mime_encode(a0, a1, a2)); +} +Variant ei_log1p(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(log1p); + return (f_log1p(a0)); +} +Variant ei_fwrite(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fwrite); + int count = params.size(); + if (count <= 2) return (f_fwrite(a0, a1)); + return (f_fwrite(a0, a1, a2)); +} +Variant ei_atan2(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(atan2); + return (f_atan2(a0, a1)); +} +Variant ei_is_a(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_a); + return (f_is_a(a0, a1)); +} +Variant ei_idate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(idate); + int count = params.size(); + if (count <= 1) return (f_idate(a0)); + return (f_idate(a0, a1)); +} +Variant ei_posix_initgroups(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_initgroups); + return (f_posix_initgroups(a0, a1)); +} +Variant ei_arsort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(arsort); + int count = params.size(); + if (count <= 1) return (f_arsort(ref(a0))); + if (count == 2) return (f_arsort(ref(a0), a1)); + return (f_arsort(ref(a0), a1, a2)); +} +Variant ei_gethostbyaddr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gethostbyaddr); + return (f_gethostbyaddr(a0)); +} +Variant ei_apc_delete(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_delete); + int count = params.size(); + if (count <= 1) return (f_apc_delete(a0)); + return (f_apc_delete(a0, a1)); +} +Variant ei_magicklevelimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicklevelimage); + int count = params.size(); + if (count <= 4) return (f_magicklevelimage(a0, a1, a2, a3)); + return (f_magicklevelimage(a0, a1, a2, a3, a4)); +} +Variant ei_openssl_x509_parse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_x509_parse); + int count = params.size(); + if (count <= 1) return (f_openssl_x509_parse(a0)); + return (f_openssl_x509_parse(a0, a1)); +} +Variant ei_magickcommentimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcommentimage); + return (f_magickcommentimage(a0, a1)); +} +Variant ei_magicksetimagedelay(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagedelay); + return (f_magicksetimagedelay(a0, a1)); +} +Variant ei_magickposterizeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickposterizeimage); + return (f_magickposterizeimage(a0, a1, a2)); +} +Variant ei_stream_socket_accept(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_socket_accept); + int count = params.size(); + if (count <= 1) return (f_stream_socket_accept(a0)); + if (count == 2) return (f_stream_socket_accept(a0, a1)); + return (f_stream_socket_accept(a0, a1, ref(a2))); +} +Variant ei_magickqueryconfigureoption(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickqueryconfigureoption); + return (f_magickqueryconfigureoption(a0)); +} +Variant ei_magickevaluateimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickevaluateimage); + int count = params.size(); + if (count <= 3) return (f_magickevaluateimage(a0, a1, a2)); + return (f_magickevaluateimage(a0, a1, a2, a3)); +} +Variant ei_imagesx(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagesx); + return (f_imagesx(a0)); +} +Variant ei_imagesy(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagesy); + return (f_imagesy(a0)); +} +Variant ei_mysql_get_client_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_get_client_info); + return (f_mysql_get_client_info()); +} +Variant ei_fb_crossall_query(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_crossall_query); + int count = params.size(); + if (count <= 1) return (f_fb_crossall_query(a0)); + if (count == 2) return (f_fb_crossall_query(a0, a1)); + if (count == 3) return (f_fb_crossall_query(a0, a1, a2)); + if (count == 4) return (f_fb_crossall_query(a0, a1, a2, a3)); + if (count == 5) return (f_fb_crossall_query(a0, a1, a2, a3, a4)); + return (f_fb_crossall_query(a0, a1, a2, a3, a4, a5)); +} +Variant ei_fseek(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fseek); + int count = params.size(); + if (count <= 2) return (f_fseek(a0, a1)); + return (f_fseek(a0, a1, a2)); +} +Variant ei_apc_compile_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_compile_file); + int count = params.size(); + if (count <= 1) return (f_apc_compile_file(a0)); + if (count == 2) return (f_apc_compile_file(a0, a1)); + return (f_apc_compile_file(a0, a1, a2)); +} +Variant ei_magicksetpassphrase(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetpassphrase); + return (f_magicksetpassphrase(a0, a1)); +} +Variant ei_mysql_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_info); + int count = params.size(); + if (count <= 0) return (f_mysql_info()); + return (f_mysql_info(a0)); +} +Variant ei_is_writable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_writable); + return (f_is_writable(a0)); +} +Variant ei_magickrotateimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickrotateimage); + return (f_magickrotateimage(a0, a1, a2)); +} +Variant ei_fgetcsv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fgetcsv); + int count = params.size(); + if (count <= 1) return (f_fgetcsv(a0)); + if (count == 2) return (f_fgetcsv(a0, a1)); + if (count == 3) return (f_fgetcsv(a0, a1, a2)); + return (f_fgetcsv(a0, a1, a2, a3)); +} +Variant ei_oci_fetch_array(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_fetch_array); + int count = params.size(); + if (count <= 1) return (f_oci_fetch_array(a0)); + return (f_oci_fetch_array(a0, a1)); +} +Variant ei_magickcolorfloodfillimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcolorfloodfillimage); + return (f_magickcolorfloodfillimage(a0, a1, a2, a3, a4, a5)); +} +Variant ei_atanh(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(atanh); + return (f_atanh(a0)); +} +Variant ei_imagecopyresized(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + Variant a8; + Variant a9; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a8 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a9 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecopyresized); + return (f_imagecopyresized(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} +Variant ei_fpassthru(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fpassthru); + return (f_fpassthru(a0)); +} +Variant ei_magickblackthresholdimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickblackthresholdimage); + return (f_magickblackthresholdimage(a0, a1)); +} +Variant ei_mcrypt_encrypt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_encrypt); + int count = params.size(); + if (count <= 4) return (f_mcrypt_encrypt(a0, a1, a2, a3)); + return (f_mcrypt_encrypt(a0, a1, a2, a3, a4)); +} +Variant ei_magicksetimagegreenprimary(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagegreenprimary); + return (f_magicksetimagegreenprimary(a0, a1, a2)); +} +Variant ei_xmlwriter_start_attribute_ns(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_attribute_ns); + return (f_xmlwriter_start_attribute_ns(a0, a1, a2, a3)); +} +Variant ei_magickgetimageinterlacescheme(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageinterlacescheme); + return (f_magickgetimageinterlacescheme(a0)); +} +Variant ei_apache_child_terminate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_child_terminate); + return (f_apache_child_terminate()); +} +Variant ei_array_merge_recursive(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_merge_recursive); + int count = params.size(); + if (count <= 1) return (f_array_merge_recursive(count, a0)); + return (f_array_merge_recursive(count, a0,vargs)); +} +Variant ei_array_uintersect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_uintersect); + int count = params.size(); + if (count <= 3) return (f_array_uintersect(count, a0, a1, a2)); + return (f_array_uintersect(count, a0, a1, a2,vargs)); +} +Variant ei_xml_set_unparsed_entity_decl_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_set_unparsed_entity_decl_handler); + return (f_xml_set_unparsed_entity_decl_handler(a0, a1)); +} +Variant ei_ob_get_contents(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_get_contents); + return (f_ob_get_contents()); +} +Variant ei_pixelgetcyan(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetcyan); + return (f_pixelgetcyan(a0)); +} +Variant ei_stream_select(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_select); + int count = params.size(); + if (count <= 4) return (f_stream_select(ref(a0), ref(a1), ref(a2), a3)); + return (f_stream_select(ref(a0), ref(a1), ref(a2), a3, a4)); +} +Variant ei_get_resource_type(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_resource_type); + return (f_get_resource_type(a0)); +} +Variant ei_dangling_server_proxy_old_request(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(dangling_server_proxy_old_request); + return (f_dangling_server_proxy_old_request()); +} +Variant ei_magickgetimagefilename(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagefilename); + return (f_magickgetimagefilename(a0)); +} +Variant ei_exif_tagname(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(exif_tagname); + return (f_exif_tagname(a0)); +} +Variant ei_drawsetfillalpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfillalpha); + return (f_drawsetfillalpha(a0, a1), null); +} +Variant ei_mb_convert_encoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_convert_encoding); + int count = params.size(); + if (count <= 2) return (f_mb_convert_encoding(a0, a1)); + return (f_mb_convert_encoding(a0, a1, a2)); +} +Variant ei_wandgetexceptionstring(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(wandgetexceptionstring); + return (f_wandgetexceptionstring(a0)); +} +Variant ei_proc_open(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(proc_open); + int count = params.size(); + if (count <= 3) return (f_proc_open(a0, a1, ref(a2))); + if (count == 4) return (f_proc_open(a0, a1, ref(a2), a3)); + if (count == 5) return (f_proc_open(a0, a1, ref(a2), a3, a4)); + return (f_proc_open(a0, a1, ref(a2), a3, a4, a5)); +} +Variant ei_clearpixeliterator(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(clearpixeliterator); + return (f_clearpixeliterator(a0), null); +} +Variant ei_socket_server(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_server); + int count = params.size(); + if (count <= 1) return (f_socket_server(a0)); + if (count == 2) return (f_socket_server(a0, a1)); + if (count == 3) return (f_socket_server(a0, a1, ref(a2))); + return (f_socket_server(a0, a1, ref(a2), ref(a3))); +} +Variant ei_magickremoveimageprofile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickremoveimageprofile); + return (f_magickremoveimageprofile(a0, a1)); +} +Variant ei_xmlwriter_write_dtd_element(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_dtd_element); + return (f_xmlwriter_write_dtd_element(a0, a1, a2)); +} +Variant ei_drawpushdefs(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpushdefs); + return (f_drawpushdefs(a0), null); +} +Variant ei_image2wbmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(image2wbmp); + int count = params.size(); + if (count <= 1) return (f_image2wbmp(a0)); + if (count == 2) return (f_image2wbmp(a0, a1)); + return (f_image2wbmp(a0, a1, a2)); +} +Variant ei_join(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(join); + int count = params.size(); + if (count <= 1) return (f_join(a0)); + return (f_join(a0, a1)); +} +Variant ei_magicksetimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimage); + return (f_magicksetimage(a0, a1)); +} +Variant ei_openssl_free_key(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_free_key); + return (f_openssl_free_key(a0), null); +} +Variant ei_preg_grep(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(preg_grep); + int count = params.size(); + if (count <= 2) return (f_preg_grep(a0, a1)); + return (f_preg_grep(a0, a1, a2)); +} +Variant ei_is_float(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_float); + return (f_is_float(a0)); +} +Variant ei_stream_socket_pair(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_socket_pair); + return (f_stream_socket_pair(a0, a1, a2)); +} +Variant ei_get_required_files(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_required_files); + return (f_get_required_files()); +} +Variant ei_mysql_fetch_field(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_fetch_field); + int count = params.size(); + if (count <= 1) return (f_mysql_fetch_field(a0)); + return (f_mysql_fetch_field(a0, a1)); +} +Variant ei_fb_start_mcproxy(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_start_mcproxy); + return (f_fb_start_mcproxy(a0, a1)); +} +Variant ei_chmod(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(chmod); + return (f_chmod(a0, a1)); +} +Variant ei_magickgettextascent(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgettextascent); + int count = params.size(); + if (count <= 3) return (f_magickgettextascent(a0, a1, a2)); + return (f_magickgettextascent(a0, a1, a2, a3)); +} +Variant ei_mb_regex_encoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_regex_encoding); + int count = params.size(); + if (count <= 0) return (f_mb_regex_encoding()); + return (f_mb_regex_encoding(a0)); +} +Variant ei_mail(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mail); + int count = params.size(); + if (count <= 3) return (f_mail(a0, a1, a2)); + if (count == 4) return (f_mail(a0, a1, a2, a3)); + return (f_mail(a0, a1, a2, a3, a4)); +} +Variant ei_mcrypt_enc_self_test(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_enc_self_test); + return (f_mcrypt_enc_self_test(a0)); +} +Variant ei_ignore_user_abort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ignore_user_abort); + int count = params.size(); + if (count <= 0) return (f_ignore_user_abort()); + return (f_ignore_user_abort(a0)); +} +Variant ei_oci_field_is_null(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_field_is_null); + return (f_oci_field_is_null(a0, a1)); +} +Variant ei_imagesetthickness(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagesetthickness); + return (f_imagesetthickness(a0, a1)); +} +Variant ei_str_pad(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(str_pad); + int count = params.size(); + if (count <= 2) return (f_str_pad(a0, a1)); + if (count == 3) return (f_str_pad(a0, a1, a2)); + return (f_str_pad(a0, a1, a2, a3)); +} +Variant ei_openssl_pkcs7_decrypt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkcs7_decrypt); + int count = params.size(); + if (count <= 3) return (f_openssl_pkcs7_decrypt(a0, a1, a2)); + return (f_openssl_pkcs7_decrypt(a0, a1, a2, a3)); +} +Variant ei_pagelet_server_task_result(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pagelet_server_task_result); + return (f_pagelet_server_task_result(a0, ref(a1), ref(a2))); +} +Variant ei_asinh(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(asinh); + return (f_asinh(a0)); +} +Variant ei_mailparse_msg_extract_part(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_msg_extract_part); + int count = params.size(); + if (count <= 2) return (f_mailparse_msg_extract_part(a0, a1), null); + return (f_mailparse_msg_extract_part(a0, a1, a2), null); +} +Variant ei_magickgetimagecompose(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagecompose); + return (f_magickgetimagecompose(a0)); +} +Variant ei_magickcropimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcropimage); + return (f_magickcropimage(a0, a1, a2, a3, a4)); +} +Variant ei_ob_gzhandler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_gzhandler); + return (f_ob_gzhandler(a0, a1)); +} +Variant ei_drawcomment(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawcomment); + return (f_drawcomment(a0, a1), null); +} +Variant ei_call_user_method(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(call_user_method); + int count = params.size(); + if (count <= 2) return (f_call_user_method(count, a0, ref(a1))); + return (f_call_user_method(count, a0, ref(a1),vargs)); +} +Variant ei_mb_split(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_split); + int count = params.size(); + if (count <= 2) return (f_mb_split(a0, a1)); + return (f_mb_split(a0, a1, a2)); +} +Variant ei_imagepolygon(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagepolygon); + return (f_imagepolygon(a0, a1, a2, a3)); +} +Variant ei_mysql_field_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_field_name); + int count = params.size(); + if (count <= 1) return (f_mysql_field_name(a0)); + return (f_mysql_field_name(a0, a1)); +} +Variant ei_fputs(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fputs); + int count = params.size(); + if (count <= 2) return (f_fputs(a0, a1)); + return (f_fputs(a0, a1, a2)); +} +Variant ei_imagecolorallocatealpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorallocatealpha); + return (f_imagecolorallocatealpha(a0, a1, a2, a3, a4)); +} +Variant ei_substr_count(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(substr_count); + int count = params.size(); + if (count <= 2) return (f_substr_count(a0, a1)); + if (count == 3) return (f_substr_count(a0, a1, a2)); + return (f_substr_count(a0, a1, a2, a3)); +} +Variant ei_ldap_first_reference(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_first_reference); + return (f_ldap_first_reference(a0, a1)); +} +Variant ei_clock_settime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(clock_settime); + return (f_clock_settime(a0, a1, a2)); +} +Variant ei_ftruncate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ftruncate); + return (f_ftruncate(a0, a1)); +} +Variant ei_curl_version(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_version); + int count = params.size(); + if (count <= 0) return (f_curl_version()); + return (f_curl_version(a0)); +} +Variant ei_pixelgetbluequantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetbluequantum); + return (f_pixelgetbluequantum(a0)); +} +Variant ei_print(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(print); + return (f_print(a0)); +} +Variant ei_mysql_unbuffered_query(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_unbuffered_query); + int count = params.size(); + if (count <= 1) return (f_mysql_unbuffered_query(a0)); + return (f_mysql_unbuffered_query(a0, a1)); +} +Variant ei_hash_final(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hash_final); + int count = params.size(); + if (count <= 1) return (f_hash_final(a0)); + return (f_hash_final(a0, a1)); +} +Variant ei_imagecolorresolve(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorresolve); + return (f_imagecolorresolve(a0, a1, a2, a3)); +} +Variant ei_date_date_set(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_date_set); + return (f_date_date_set(a0, a1, a2, a3), null); +} +Variant ei_pixelsetyellow(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetyellow); + return (f_pixelsetyellow(a0, a1), null); +} +Variant ei_inet_pton(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(inet_pton); + return (f_inet_pton(a0)); +} +Variant ei_mcrypt_get_key_size(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_get_key_size); + return (f_mcrypt_get_key_size(a0, a1)); +} +Variant ei_drawsettextalignment(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsettextalignment); + return (f_drawsettextalignment(a0, a1), null); +} +Variant ei_magickgetimageredprimary(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageredprimary); + return (f_magickgetimageredprimary(a0)); +} +Variant ei_addslashes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(addslashes); + return (f_addslashes(a0)); +} +Variant ei_ldap_count_entries(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_count_entries); + return (f_ldap_count_entries(a0, a1)); +} +Variant ei_ereg_replace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ereg_replace); + return (f_ereg_replace(a0, a1, a2)); +} +Variant ei_drawrender(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawrender); + return (f_drawrender(a0)); +} +Variant ei_magickgetversionnumber(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetversionnumber); + return (f_magickgetversionnumber()); +} +Variant ei_array_splice(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_splice); + int count = params.size(); + if (count <= 2) return (f_array_splice(ref(a0), a1)); + if (count == 3) return (f_array_splice(ref(a0), a1, a2)); + return (f_array_splice(ref(a0), a1, a2, a3)); +} +Variant ei_oci_new_descriptor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_new_descriptor); + int count = params.size(); + if (count <= 1) return (f_oci_new_descriptor(a0)); + return (f_oci_new_descriptor(a0, a1)); +} +Variant ei_ftell(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ftell); + return (f_ftell(a0)); +} +Variant ei_magicksetimagedepth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagedepth); + int count = params.size(); + if (count <= 2) return (f_magicksetimagedepth(a0, a1)); + return (f_magicksetimagedepth(a0, a1, a2)); +} +Variant ei_apc_load_constants(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_load_constants); + int count = params.size(); + if (count <= 1) return (f_apc_load_constants(a0)); + if (count == 2) return (f_apc_load_constants(a0, a1)); + return (f_apc_load_constants(a0, a1, a2)); +} +Variant ei___halt_compiler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(__halt_compiler); + return (f___halt_compiler(), null); +} +Variant ei_magicklabelimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicklabelimage); + return (f_magicklabelimage(a0, a1)); +} +Variant ei_hphp_log(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_log); + return (f_hphp_log(a0, a1)); +} +Variant ei_stream_get_contents(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_get_contents); + int count = params.size(); + if (count <= 1) return (f_stream_get_contents(a0)); + if (count == 2) return (f_stream_get_contents(a0, a1)); + return (f_stream_get_contents(a0, a1, a2)); +} +Variant ei_imagecreatefromjpeg(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatefromjpeg); + return (f_imagecreatefromjpeg(a0)); +} +Variant ei_chown(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(chown); + return (f_chown(a0, a1)); +} +Variant ei_hash_hmac_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hash_hmac_file); + int count = params.size(); + if (count <= 3) return (f_hash_hmac_file(a0, a1, a2)); + return (f_hash_hmac_file(a0, a1, a2, a3)); +} +Variant ei_magickechoimageblob(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickechoimageblob); + return (f_magickechoimageblob(a0)); +} +Variant ei_link(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(link); + return (f_link(a0, a1)); +} +Variant ei_fb_utf8ize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_utf8ize); + return (f_fb_utf8ize(ref(a0))); +} +Variant ei_drawsetfillpatternurl(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfillpatternurl); + return (f_drawsetfillpatternurl(a0, a1)); +} +Variant ei_iconv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iconv); + return (f_iconv(a0, a1, a2)); +} +Variant ei_highlight_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(highlight_file); + int count = params.size(); + if (count <= 1) return (f_highlight_file(a0)); + return (f_highlight_file(a0, a1)); +} +Variant ei_iconv_mime_decode_headers(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iconv_mime_decode_headers); + int count = params.size(); + if (count <= 1) return (f_iconv_mime_decode_headers(a0)); + if (count == 2) return (f_iconv_mime_decode_headers(a0, a1)); + return (f_iconv_mime_decode_headers(a0, a1, a2)); +} +Variant ei_ini_get_all(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ini_get_all); + int count = params.size(); + if (count <= 0) return (f_ini_get_all()); + return (f_ini_get_all(a0)); +} +Variant ei_ldap_get_values_len(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_get_values_len); + return (f_ldap_get_values_len(a0, a1, a2)); +} +Variant ei_openssl_pkcs7_verify(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkcs7_verify); + int count = params.size(); + if (count <= 2) return (f_openssl_pkcs7_verify(a0, a1)); + if (count == 3) return (f_openssl_pkcs7_verify(a0, a1, a2)); + if (count == 4) return (f_openssl_pkcs7_verify(a0, a1, a2, a3)); + if (count == 5) return (f_openssl_pkcs7_verify(a0, a1, a2, a3, a4)); + return (f_openssl_pkcs7_verify(a0, a1, a2, a3, a4, a5)); +} +Variant ei_stream_socket_recvfrom(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_socket_recvfrom); + int count = params.size(); + if (count <= 2) return (f_stream_socket_recvfrom(a0, a1)); + if (count == 3) return (f_stream_socket_recvfrom(a0, a1, a2)); + return (f_stream_socket_recvfrom(a0, a1, a2, a3)); +} +Variant ei_drawgetcliprule(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetcliprule); + return (f_drawgetcliprule(a0)); +} +Variant ei_apc_filehits(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_filehits); + return (f_apc_filehits()); +} +Variant ei_pixelgetexceptionstring(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetexceptionstring); + return (f_pixelgetexceptionstring(a0)); +} +Variant ei_mcrypt_ofb(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_ofb); + int count = params.size(); + if (count <= 4) return (f_mcrypt_ofb(a0, a1, a2, a3)); + return (f_mcrypt_ofb(a0, a1, a2, a3, a4)); +} +Variant ei_imageantialias(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imageantialias); + return (f_imageantialias(a0, a1)); +} +Variant ei_idn_to_ascii(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(idn_to_ascii); + int count = params.size(); + if (count <= 1) return (f_idn_to_ascii(a0)); + return (f_idn_to_ascii(a0, ref(a1))); +} +Variant ei_error_log(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(error_log); + int count = params.size(); + if (count <= 1) return (f_error_log(a0)); + if (count == 2) return (f_error_log(a0, a1)); + if (count == 3) return (f_error_log(a0, a1, a2)); + return (f_error_log(a0, a1, a2, a3)); +} +Variant ei_hash_update(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hash_update); + return (f_hash_update(a0, a1)); +} +Variant ei_ob_flush(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_flush); + return (f_ob_flush(), null); +} +Variant ei_fbml_get_attributes_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_get_attributes_11); + return (f_fbml_get_attributes_11(a0)); +} +Variant ei_md5_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(md5_file); + int count = params.size(); + if (count <= 1) return (f_md5_file(a0)); + return (f_md5_file(a0, a1)); +} +Variant ei_drawgetexception(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetexception); + return (f_drawgetexception(a0)); +} +Variant ei_file_get_contents(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(file_get_contents); + int count = params.size(); + if (count <= 1) return (f_file_get_contents(a0)); + if (count == 2) return (f_file_get_contents(a0, a1)); + if (count == 3) return (f_file_get_contents(a0, a1, a2)); + if (count == 4) return (f_file_get_contents(a0, a1, a2, a3)); + return (f_file_get_contents(a0, a1, a2, a3, a4)); +} +Variant ei_uniqid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(uniqid); + int count = params.size(); + if (count <= 0) return (f_uniqid()); + if (count == 1) return (f_uniqid(a0)); + return (f_uniqid(a0, a1)); +} +Variant ei_strncasecmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strncasecmp); + return (f_strncasecmp(a0, a1, a2)); +} +Variant ei_magicksetimagepixels(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagepixels); + return (f_magicksetimagepixels(a0, a1, a2, a3, a4, a5, a6, a7)); +} +Variant ei_drawgetfillopacity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetfillopacity); + return (f_drawgetfillopacity(a0)); +} +Variant ei_xml_parser_create_ns(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_parser_create_ns); + int count = params.size(); + if (count <= 0) return (f_xml_parser_create_ns()); + if (count == 1) return (f_xml_parser_create_ns(a0)); + return (f_xml_parser_create_ns(a0, a1)); +} +Variant ei_oci_fetch_assoc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_fetch_assoc); + return (f_oci_fetch_assoc(a0)); +} +Variant ei_ldap_delete(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_delete); + return (f_ldap_delete(a0, a1)); +} +Variant ei_fnmatch(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fnmatch); + int count = params.size(); + if (count <= 2) return (f_fnmatch(a0, a1)); + return (f_fnmatch(a0, a1, a2)); +} +Variant ei_metaphone(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(metaphone); + int count = params.size(); + if (count <= 1) return (f_metaphone(a0)); + return (f_metaphone(a0, a1)); +} +Variant ei_mysql_errno(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_errno); + int count = params.size(); + if (count <= 0) return (f_mysql_errno()); + return (f_mysql_errno(a0)); +} +Variant ei_stream_wrapper_unregister(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_wrapper_unregister); + return (f_stream_wrapper_unregister(a0)); +} +Variant ei_magickcyclecolormapimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcyclecolormapimage); + return (f_magickcyclecolormapimage(a0, a1)); +} +Variant ei_restore_error_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(restore_error_handler); + return (f_restore_error_handler()); +} +Variant ei_magicksetimagevirtualpixelmethod(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagevirtualpixelmethod); + return (f_magicksetimagevirtualpixelmethod(a0, a1)); +} +Variant ei_socket_getpeername(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_getpeername); + int count = params.size(); + if (count <= 2) return (f_socket_getpeername(a0, ref(a1))); + return (f_socket_getpeername(a0, ref(a1), ref(a2))); +} +Variant ei_mysql_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_error); + int count = params.size(); + if (count <= 0) return (f_mysql_error()); + return (f_mysql_error(a0)); +} +Variant ei_drawtranslate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawtranslate); + return (f_drawtranslate(a0, a1, a2), null); +} +Variant ei_mysql_list_dbs(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_list_dbs); + int count = params.size(); + if (count <= 0) return (f_mysql_list_dbs()); + return (f_mysql_list_dbs(a0)); +} +Variant ei_imagefilter(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagefilter); + int count = params.size(); + if (count <= 2) return (f_imagefilter(a0, a1)); + if (count == 3) return (f_imagefilter(a0, a1, a2)); + if (count == 4) return (f_imagefilter(a0, a1, a2, a3)); + if (count == 5) return (f_imagefilter(a0, a1, a2, a3, a4)); + return (f_imagefilter(a0, a1, a2, a3, a4, a5)); +} +Variant ei_base64_encode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(base64_encode); + return (f_base64_encode(a0)); +} +Variant ei_is_null(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_null); + return (f_is_null(a0)); +} +Variant ei_octdec(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(octdec); + return (f_octdec(a0)); +} +Variant ei_oci_fetch(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_fetch); + return (f_oci_fetch(a0)); +} +Variant ei_drawsetclippath(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetclippath); + return (f_drawsetclippath(a0, a1)); +} +Variant ei_magickconstituteimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickconstituteimage); + return (f_magickconstituteimage(a0, a1, a2, a3, a4, a5)); +} +Variant ei_pcntl_wexitstatus(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_wexitstatus); + return (f_pcntl_wexitstatus(a0)); +} +Variant ei_fql_multiparse_10(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fql_multiparse_10); + return (f_fql_multiparse_10(a0)); +} +Variant ei_apache_setenv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_setenv); + int count = params.size(); + if (count <= 2) return (f_apache_setenv(a0, a1)); + return (f_apache_setenv(a0, a1, a2)); +} +Variant ei_clonedrawingwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(clonedrawingwand); + return (f_clonedrawingwand(a0)); +} +Variant ei_ob_get_clean(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_get_clean); + return (f_ob_get_clean()); +} +Variant ei_expm1(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(expm1); + return (f_expm1(a0)); +} +Variant ei_ldap_first_entry(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_first_entry); + return (f_ldap_first_entry(a0, a1)); +} +Variant ei_curl_multi_select(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_multi_select); + int count = params.size(); + if (count <= 1) return (f_curl_multi_select(a0)); + return (f_curl_multi_select(a0, a1)); +} +Variant ei_magickswirlimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickswirlimage); + return (f_magickswirlimage(a0, a1)); +} +Variant ei_mb_ereg_search_regs(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_ereg_search_regs); + int count = params.size(); + if (count <= 0) return (f_mb_ereg_search_regs()); + if (count == 1) return (f_mb_ereg_search_regs(a0)); + return (f_mb_ereg_search_regs(a0, a1)); +} +Variant ei_ldap_errno(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_errno); + return (f_ldap_errno(a0)); +} +Variant ei_mysql_get_server_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_get_server_info); + int count = params.size(); + if (count <= 0) return (f_mysql_get_server_info()); + return (f_mysql_get_server_info(a0)); +} +Variant ei_mailparse_rfc822_parse_addresses(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_rfc822_parse_addresses); + return (f_mailparse_rfc822_parse_addresses(a0)); +} +Variant ei_magickgetimagemimetype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagemimetype); + return (f_magickgetimagemimetype(a0)); +} +Variant ei_soundex(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(soundex); + return (f_soundex(a0)); +} +Variant ei_magickgetimageformat(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageformat); + return (f_magickgetimageformat(a0)); +} +Variant ei_mcrypt_module_get_supported_key_sizes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_module_get_supported_key_sizes); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_get_supported_key_sizes(a0)); + return (f_mcrypt_module_get_supported_key_sizes(a0, a1)); +} +Variant ei_preg_replace_callback(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(preg_replace_callback); + int count = params.size(); + if (count <= 3) return (f_preg_replace_callback(a0, a1, a2)); + if (count == 4) return (f_preg_replace_callback(a0, a1, a2, a3)); + return (f_preg_replace_callback(a0, a1, a2, a3, ref(a4))); +} +Variant ei_ldap_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_error); + return (f_ldap_error(a0)); +} +Variant ei_xmlwriter_full_end_element(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_full_end_element); + return (f_xmlwriter_full_end_element(a0)); +} +Variant ei_ctype_graph(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_graph); + return (f_ctype_graph(a0)); +} +Variant ei_asort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(asort); + int count = params.size(); + if (count <= 1) return (f_asort(ref(a0))); + if (count == 2) return (f_asort(ref(a0), a1)); + return (f_asort(ref(a0), a1, a2)); +} +Variant ei_apd_echo(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apd_echo); + return (f_apd_echo(a0)); +} +Variant ei_rewinddir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rewinddir); + return (f_rewinddir(a0), null); +} +Variant ei_ob_implicit_flush(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_implicit_flush); + int count = params.size(); + if (count <= 0) return (f_ob_implicit_flush(), null); + return (f_ob_implicit_flush(a0), null); +} +Variant ei_pcntl_signal_dispatch(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_signal_dispatch); + return (f_pcntl_signal_dispatch()); +} +Variant ei_pixelgetiteratorexceptionstring(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetiteratorexceptionstring); + return (f_pixelgetiteratorexceptionstring(a0)); +} +Variant ei_stream_socket_client(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_socket_client); + int count = params.size(); + if (count <= 1) return (f_stream_socket_client(a0)); + if (count == 2) return (f_stream_socket_client(a0, ref(a1))); + if (count == 3) return (f_stream_socket_client(a0, ref(a1), ref(a2))); + if (count == 4) return (f_stream_socket_client(a0, ref(a1), ref(a2), a3)); + if (count == 5) return (f_stream_socket_client(a0, ref(a1), ref(a2), a3, a4)); + return (f_stream_socket_client(a0, ref(a1), ref(a2), a3, a4, a5)); +} +Variant ei_drawsetstrokedasharray(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokedasharray); + int count = params.size(); + if (count <= 1) return (f_drawsetstrokedasharray(a0), null); + return (f_drawsetstrokedasharray(a0, a1), null); +} +Variant ei_mysql_free_result(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_free_result); + return (f_mysql_free_result(a0)); +} +Variant ei_is_real(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_real); + return (f_is_real(a0)); +} +Variant ei_mcrypt_enc_is_block_algorithm_mode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_enc_is_block_algorithm_mode); + return (f_mcrypt_enc_is_block_algorithm_mode(a0)); +} +Variant ei_array_slice(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_slice); + int count = params.size(); + if (count <= 2) return (f_array_slice(a0, a1)); + if (count == 3) return (f_array_slice(a0, a1, a2)); + return (f_array_slice(a0, a1, a2, a3)); +} +Variant ei_count_chars(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(count_chars); + int count = params.size(); + if (count <= 1) return (f_count_chars(a0)); + return (f_count_chars(a0, a1)); +} +Variant ei_array_uintersect_uassoc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_uintersect_uassoc); + int count = params.size(); + if (count <= 4) return (f_array_uintersect_uassoc(count, a0, a1, a2, a3)); + return (f_array_uintersect_uassoc(count, a0, a1, a2, a3,vargs)); +} +Variant ei_oci_free_statement(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_free_statement); + return (f_oci_free_statement(a0)); +} +Variant ei_drawsetstrokewidth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokewidth); + return (f_drawsetstrokewidth(a0, a1), null); +} +Variant ei_posix_mkfifo(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_mkfifo); + return (f_posix_mkfifo(a0, a1)); +} +Variant ei_array_count_values(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_count_values); + return (f_array_count_values(a0)); +} +Variant ei_pixelgetexception(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetexception); + return (f_pixelgetexception(a0)); +} +Variant ei_mkdir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mkdir); + int count = params.size(); + if (count <= 1) return (f_mkdir(a0)); + if (count == 2) return (f_mkdir(a0, a1)); + if (count == 3) return (f_mkdir(a0, a1, a2)); + return (f_mkdir(a0, a1, a2, a3)); +} +Variant ei_magicksetsize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetsize); + return (f_magicksetsize(a0, a1, a2)); +} +Variant ei_debug_zval_dump(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(debug_zval_dump); + return (f_debug_zval_dump(a0), null); +} +Variant ei_iconv_substr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iconv_substr); + int count = params.size(); + if (count <= 2) return (f_iconv_substr(a0, a1)); + if (count == 3) return (f_iconv_substr(a0, a1, a2)); + return (f_iconv_substr(a0, a1, a2, a3)); +} +Variant ei_xml_set_external_entity_ref_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_set_external_entity_ref_handler); + return (f_xml_set_external_entity_ref_handler(a0, a1)); +} +Variant ei_mb_decode_numericentity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_decode_numericentity); + int count = params.size(); + if (count <= 2) return (f_mb_decode_numericentity(a0, a1)); + return (f_mb_decode_numericentity(a0, a1, a2)); +} +Variant ei_ldap_next_attribute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_next_attribute); + return (f_ldap_next_attribute(a0, a1)); +} +Variant ei_imagejpeg(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagejpeg); + int count = params.size(); + if (count <= 1) return (f_imagejpeg(a0)); + if (count == 2) return (f_imagejpeg(a0, a1)); + return (f_imagejpeg(a0, a1, a2)); +} +Variant ei_imagesetbrush(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagesetbrush); + return (f_imagesetbrush(a0, a1)); +} +Variant ei_mb_strtoupper(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strtoupper); + int count = params.size(); + if (count <= 1) return (f_mb_strtoupper(a0)); + return (f_mb_strtoupper(a0, a1)); +} +Variant ei_usleep(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(usleep); + return (f_usleep(a0), null); +} +Variant ei_mb_strrpos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strrpos); + int count = params.size(); + if (count <= 2) return (f_mb_strrpos(a0, a1)); + if (count == 3) return (f_mb_strrpos(a0, a1, a2)); + return (f_mb_strrpos(a0, a1, a2, a3)); +} +Variant ei_extract(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(extract); + int count = params.size(); + if (count <= 1) return (f_extract(a0)); + if (count == 2) return (f_extract(a0, a1)); + return (f_extract(a0, a1, a2)); +} +Variant ei_get_browser(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_browser); + int count = params.size(); + if (count <= 0) return (f_get_browser()); + if (count == 1) return (f_get_browser(a0)); + return (f_get_browser(a0, a1)); +} +Variant ei_html_entity_decode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(html_entity_decode); + int count = params.size(); + if (count <= 1) return (f_html_entity_decode(a0)); + if (count == 2) return (f_html_entity_decode(a0, a1)); + return (f_html_entity_decode(a0, a1, a2)); +} +Variant ei_preg_split(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(preg_split); + int count = params.size(); + if (count <= 2) return (f_preg_split(a0, a1)); + if (count == 3) return (f_preg_split(a0, a1, a2)); + return (f_preg_split(a0, a1, a2, a3)); +} +Variant ei_magickpreviewimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickpreviewimages); + return (f_magickpreviewimages(a0, a1)); +} +Variant ei_zend_logo_guid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(zend_logo_guid); + return (f_zend_logo_guid()); +} +Variant ei_magickgetimagesize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagesize); + return (f_magickgetimagesize(a0)); +} +Variant ei_apd_set_browser_trace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apd_set_browser_trace); + return (f_apd_set_browser_trace(), null); +} +Variant ei_xhprof_sample_enable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xhprof_sample_enable); + return (f_xhprof_sample_enable(), null); +} +Variant ei_mb_http_input(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_http_input); + int count = params.size(); + if (count <= 0) return (f_mb_http_input()); + return (f_mb_http_input(a0)); +} +Variant ei_gzinflate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzinflate); + int count = params.size(); + if (count <= 1) return (f_gzinflate(a0)); + return (f_gzinflate(a0, a1)); +} +Variant ei_openssl_pkcs7_sign(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkcs7_sign); + int count = params.size(); + if (count <= 5) return (f_openssl_pkcs7_sign(a0, a1, a2, a3, a4)); + if (count == 6) return (f_openssl_pkcs7_sign(a0, a1, a2, a3, a4, a5)); + return (f_openssl_pkcs7_sign(a0, a1, a2, a3, a4, a5, a6)); +} +Variant ei_assert(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(assert); + return (f_assert(a0)); +} +Variant ei_stream_get_wrappers(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_get_wrappers); + return (f_stream_get_wrappers()); +} +Variant ei_gzfile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzfile); + int count = params.size(); + if (count <= 1) return (f_gzfile(a0)); + return (f_gzfile(a0, a1)); +} +Variant ei_oci_field_precision(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_field_precision); + return (f_oci_field_precision(a0, a1)); +} +Variant ei_stream_socket_sendto(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_socket_sendto); + int count = params.size(); + if (count <= 2) return (f_stream_socket_sendto(a0, a1)); + if (count == 3) return (f_stream_socket_sendto(a0, a1, a2)); + return (f_stream_socket_sendto(a0, a1, a2, a3)); +} +Variant ei_gzpassthru(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzpassthru); + return (f_gzpassthru(a0)); +} +Variant ei_stream_bucket_make_writeable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_bucket_make_writeable); + return (f_stream_bucket_make_writeable(a0)); +} +Variant ei_posix_setegid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_setegid); + return (f_posix_setegid(a0)); +} +Variant ei_drawgetexceptionstring(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetexceptionstring); + return (f_drawgetexceptionstring(a0)); +} +Variant ei_hash_algos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hash_algos); + return (f_hash_algos()); +} +Variant ei_drawsetstrokeantialias(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokeantialias); + int count = params.size(); + if (count <= 1) return (f_drawsetstrokeantialias(a0), null); + return (f_drawsetstrokeantialias(a0, a1), null); +} +Variant ei_destroypixelwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(destroypixelwand); + return (f_destroypixelwand(a0), null); +} +Variant ei_fstat(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fstat); + return (f_fstat(a0)); +} +Variant ei_magicksetimageresolution(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimageresolution); + return (f_magicksetimageresolution(a0, a1, a2)); +} +Variant ei_mysql_db_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_db_name); + int count = params.size(); + if (count <= 2) return (f_mysql_db_name(a0, a1)); + return (f_mysql_db_name(a0, a1, a2)); +} +Variant ei_is_finite(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_finite); + return (f_is_finite(a0)); +} +Variant ei_pixelgetyellowquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetyellowquantum); + return (f_pixelgetyellowquantum(a0)); +} +Variant ei_ksort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ksort); + int count = params.size(); + if (count <= 1) return (f_ksort(ref(a0))); + return (f_ksort(ref(a0), a1)); +} +Variant ei_thrift_protocol_read_binary(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(thrift_protocol_read_binary); + return (f_thrift_protocol_read_binary(a0, a1, a2)); +} +Variant ei_get_included_files(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_included_files); + return (f_get_included_files()); +} +Variant ei_strip_tags(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strip_tags); + int count = params.size(); + if (count <= 1) return (f_strip_tags(a0)); + return (f_strip_tags(a0, a1)); +} +Variant ei_mb_ereg_search_getpos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_ereg_search_getpos); + return (f_mb_ereg_search_getpos()); +} +Variant ei_pixelgetcyanquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetcyanquantum); + return (f_pixelgetcyanquantum(a0)); +} +Variant ei_oci_define_by_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_define_by_name); + int count = params.size(); + if (count <= 3) return (f_oci_define_by_name(a0, a1, ref(a2))); + return (f_oci_define_by_name(a0, a1, ref(a2), a3)); +} +Variant ei_magickgetexception(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetexception); + return (f_magickgetexception(a0)); +} +Variant ei_ctype_punct(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_punct); + return (f_ctype_punct(a0)); +} +Variant ei_next(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(next); + return (f_next(ref(a0))); +} +Variant ei_shm_detach(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(shm_detach); + return (f_shm_detach(a0)); +} +Variant ei_shm_attach(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(shm_attach); + int count = params.size(); + if (count <= 1) return (f_shm_attach(a0)); + if (count == 2) return (f_shm_attach(a0, a1)); + return (f_shm_attach(a0, a1, a2)); +} +Variant ei_magickflattenimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickflattenimages); + return (f_magickflattenimages(a0)); +} +Variant ei_similar_text(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(similar_text); + int count = params.size(); + if (count <= 2) return (f_similar_text(a0, a1)); + return (f_similar_text(a0, a1, ref(a2))); +} +Variant ei_imagecreatefromgd2part(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatefromgd2part); + return (f_imagecreatefromgd2part(a0, a1, a2, a3, a4)); +} +Variant ei_iconv_get_encoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iconv_get_encoding); + int count = params.size(); + if (count <= 0) return (f_iconv_get_encoding()); + return (f_iconv_get_encoding(a0)); +} +Variant ei_getmyinode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getmyinode); + return (f_getmyinode()); +} +Variant ei_gzgetc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzgetc); + return (f_gzgetc(a0)); +} +Variant ei_hphp_set_static_property(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_set_static_property); + return (f_hphp_set_static_property(a0, a1, a2), null); +} +Variant ei_unlink(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(unlink); + int count = params.size(); + if (count <= 1) return (f_unlink(a0)); + return (f_unlink(a0, a1)); +} +Variant ei_mcrypt_module_open(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_module_open); + return (f_mcrypt_module_open(a0, a1, a2, a3)); +} +Variant ei_token_get_all(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(token_get_all); + return (f_token_get_all(a0)); +} +Variant ei_base_convert(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(base_convert); + return (f_base_convert(a0, a1, a2)); +} +Variant ei_gethostbynamel(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gethostbynamel); + return (f_gethostbynamel(a0)); +} +Variant ei_var_dump(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(var_dump); + int count = params.size(); + if (count <= 1) return (f_var_dump(count, a0), null); + return (f_var_dump(count, a0,vargs), null); +} +Variant ei_xmlwriter_start_attribute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_attribute); + return (f_xmlwriter_start_attribute(a0, a1)); +} +Variant ei_pack(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(pack); + int count = params.size(); + if (count <= 1) return (f_pack(count, a0)); + return (f_pack(count, a0,vargs)); +} +Variant ei_gzgets(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzgets); + int count = params.size(); + if (count <= 1) return (f_gzgets(a0)); + return (f_gzgets(a0, a1)); +} +Variant ei_apache_get_version(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_get_version); + return (f_apache_get_version()); +} +Variant ei_array_intersect_uassoc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_intersect_uassoc); + int count = params.size(); + if (count <= 3) return (f_array_intersect_uassoc(count, a0, a1, a2)); + return (f_array_intersect_uassoc(count, a0, a1, a2,vargs)); +} +Variant ei_basename(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(basename); + int count = params.size(); + if (count <= 1) return (f_basename(a0)); + return (f_basename(a0, a1)); +} +Variant ei_krsort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(krsort); + int count = params.size(); + if (count <= 1) return (f_krsort(ref(a0))); + return (f_krsort(ref(a0), a1)); +} +Variant ei_clock_gettime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(clock_gettime); + return (f_clock_gettime(a0, ref(a1), ref(a2))); +} +Variant ei_pushdrawingwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pushdrawingwand); + return (f_pushdrawingwand(a0), null); +} +Variant ei_imageline(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imageline); + return (f_imageline(a0, a1, a2, a3, a4, a5)); +} +Variant ei_socket_read(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_read); + int count = params.size(); + if (count <= 2) return (f_socket_read(a0, a1)); + return (f_socket_read(a0, a1, a2)); +} +Variant ei_xmlwriter_write_dtd_entity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_dtd_entity); + int count = params.size(); + if (count <= 3) return (f_xmlwriter_write_dtd_entity(a0, a1, a2)); + if (count == 4) return (f_xmlwriter_write_dtd_entity(a0, a1, a2, a3)); + if (count == 5) return (f_xmlwriter_write_dtd_entity(a0, a1, a2, a3, a4)); + if (count == 6) return (f_xmlwriter_write_dtd_entity(a0, a1, a2, a3, a4, a5)); + return (f_xmlwriter_write_dtd_entity(a0, a1, a2, a3, a4, a5, a6)); +} +Variant ei_mysql_tablename(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_tablename); + return (f_mysql_tablename(a0, a1)); +} +Variant ei_magickwriteimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickwriteimage); + return (f_magickwriteimage(a0, a1)); +} +Variant ei_mcrypt_module_get_algo_key_size(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_module_get_algo_key_size); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_get_algo_key_size(a0)); + return (f_mcrypt_module_get_algo_key_size(a0, a1)); +} +Variant ei_hash_update_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hash_update_file); + int count = params.size(); + if (count <= 2) return (f_hash_update_file(a0, a1)); + return (f_hash_update_file(a0, a1, a2)); +} +Variant ei_magickembossimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickembossimage); + return (f_magickembossimage(a0, a1, a2)); +} +Variant ei_gzencode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzencode); + int count = params.size(); + if (count <= 1) return (f_gzencode(a0)); + if (count == 2) return (f_gzencode(a0, a1)); + return (f_gzencode(a0, a1, a2)); +} +Variant ei_checkdate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(checkdate); + return (f_checkdate(a0, a1, a2)); +} +Variant ei_magickimplodeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickimplodeimage); + return (f_magickimplodeimage(a0, a1)); +} +Variant ei_magickgetimageindex(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageindex); + return (f_magickgetimageindex(a0)); +} +Variant ei_ctype_lower(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_lower); + return (f_ctype_lower(a0)); +} +Variant ei_imagepsloadfont(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagepsloadfont); + return (f_imagepsloadfont(a0)); +} +Variant ei_iconv_mime_decode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iconv_mime_decode); + int count = params.size(); + if (count <= 1) return (f_iconv_mime_decode(a0)); + if (count == 2) return (f_iconv_mime_decode(a0, a1)); + return (f_iconv_mime_decode(a0, a1, a2)); +} +Variant ei_mcrypt_module_is_block_algorithm(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_module_is_block_algorithm); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_is_block_algorithm(a0)); + return (f_mcrypt_module_is_block_algorithm(a0, a1)); +} +Variant ei_fbjsparse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbjsparse); + return (f_fbjsparse(a0)); +} +Variant ei_wandgetexception(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(wandgetexception); + return (f_wandgetexception(a0)); +} +Variant ei_fb_add_included_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_add_included_file); + return (f_fb_add_included_file(a0), null); +} +Variant ei_fsockopen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fsockopen); + int count = params.size(); + if (count <= 1) return (f_fsockopen(a0)); + if (count == 2) return (f_fsockopen(a0, a1)); + if (count == 3) return (f_fsockopen(a0, a1, ref(a2))); + if (count == 4) return (f_fsockopen(a0, a1, ref(a2), ref(a3))); + return (f_fsockopen(a0, a1, ref(a2), ref(a3), a4)); +} +Variant ei_usort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(usort); + return (f_usort(ref(a0), a1)); +} +Variant ei_pixelsetiteratorrow(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetiteratorrow); + return (f_pixelsetiteratorrow(a0, a1)); +} +Variant ei_ldap_get_option(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_get_option); + return (f_ldap_get_option(a0, a1, ref(a2))); +} +Variant ei_socket_recv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_recv); + return (f_socket_recv(a0, ref(a1), a2, a3)); +} +Variant ei_sys_getloadavg(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sys_getloadavg); + return (f_sys_getloadavg()); +} +Variant ei_evhttp_async_post(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(evhttp_async_post); + int count = params.size(); + if (count <= 2) return (f_evhttp_async_post(a0, a1)); + if (count == 3) return (f_evhttp_async_post(a0, a1, a2)); + return (f_evhttp_async_post(a0, a1, a2, a3)); +} +Variant ei_array_values(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_values); + return (f_array_values(a0)); +} +Variant ei_ctype_digit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_digit); + return (f_ctype_digit(a0)); +} +Variant ei_ob_get_length(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_get_length); + return (f_ob_get_length()); +} +Variant ei_magicksolarizeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksolarizeimage); + return (f_magicksolarizeimage(a0, a1)); +} +Variant ei_ob_list_handlers(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_list_handlers); + return (f_ob_list_handlers()); +} +Variant ei_array_uintersect_assoc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_uintersect_assoc); + int count = params.size(); + if (count <= 3) return (f_array_uintersect_assoc(count, a0, a1, a2)); + return (f_array_uintersect_assoc(count, a0, a1, a2,vargs)); +} +Variant ei_openssl_x509_read(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_x509_read); + return (f_openssl_x509_read(a0)); +} +Variant ei_magickgetimagecolormapcolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagecolormapcolor); + return (f_magickgetimagecolormapcolor(a0, a1)); +} +Variant ei_settype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(settype); + return (f_settype(ref(a0), a1)); +} +Variant ei_posix_access(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_access); + int count = params.size(); + if (count <= 1) return (f_posix_access(a0)); + return (f_posix_access(a0, a1)); +} +Variant ei_fql_set_static_data_10(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fql_set_static_data_10); + return (f_fql_set_static_data_10(a0, a1), null); +} +Variant ei_explode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(explode); + int count = params.size(); + if (count <= 2) return (f_explode(a0, a1)); + return (f_explode(a0, a1, a2)); +} +Variant ei_fbml_complex_expand_tag_list_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + Variant a8; + Variant a9; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a8 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a9 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_complex_expand_tag_list_11); + return (f_fbml_complex_expand_tag_list_11(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9), null); +} +Variant ei_fb_load_local_databases(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_load_local_databases); + return (f_fb_load_local_databases(a0), null); +} +Variant ei_hotprofiler_enable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hotprofiler_enable); + return (f_hotprofiler_enable(a0), null); +} +Variant ei_fbml_get_children_count_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_get_children_count_11); + return (f_fbml_get_children_count_11(a0)); +} +Variant ei_imagecreatefromgd(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatefromgd); + return (f_imagecreatefromgd(a0)); +} +Variant ei_proc_close(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(proc_close); + return (f_proc_close(a0)); +} +Variant ei_magickgaussianblurimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgaussianblurimage); + int count = params.size(); + if (count <= 3) return (f_magickgaussianblurimage(a0, a1, a2)); + return (f_magickgaussianblurimage(a0, a1, a2, a3)); +} +Variant ei_fbml_tag_list_expanded_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_tag_list_expanded_11); + return (f_fbml_tag_list_expanded_11()); +} +Variant ei_apd_set_session_trace_socket(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apd_set_session_trace_socket); + return (f_apd_set_session_trace_socket(a0, a1, a2, a3)); +} +Variant ei_openssl_pkcs12_export_to_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkcs12_export_to_file); + int count = params.size(); + if (count <= 4) return (f_openssl_pkcs12_export_to_file(a0, a1, a2, a3)); + return (f_openssl_pkcs12_export_to_file(a0, a1, a2, a3, a4)); +} +Variant ei_mailparse_msg_free(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_msg_free); + return (f_mailparse_msg_free(a0)); +} +Variant ei_openssl_private_decrypt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_private_decrypt); + int count = params.size(); + if (count <= 3) return (f_openssl_private_decrypt(a0, ref(a1), a2)); + return (f_openssl_private_decrypt(a0, ref(a1), a2, a3)); +} +Variant ei_hphp_get_extension_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_get_extension_info); + return (f_hphp_get_extension_info(a0)); +} +Variant ei_output_add_rewrite_var(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(output_add_rewrite_var); + return (f_output_add_rewrite_var(a0, a1)); +} +Variant ei_xmlwriter_write_cdata(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_cdata); + return (f_xmlwriter_write_cdata(a0, a1)); +} +Variant ei_mb_list_mime_names(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_list_mime_names); + int count = params.size(); + if (count <= 0) return (f_mb_list_mime_names()); + return (f_mb_list_mime_names(a0)); +} +Variant ei_ispixelwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ispixelwand); + return (f_ispixelwand(a0)); +} +Variant ei_xmlwriter_end_dtd(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_end_dtd); + return (f_xmlwriter_end_dtd(a0)); +} +Variant ei_curl_close(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_close); + return (f_curl_close(a0), null); +} +Variant ei_array_udiff(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_udiff); + int count = params.size(); + if (count <= 3) return (f_array_udiff(count, a0, a1, a2)); + return (f_array_udiff(count, a0, a1, a2,vargs)); +} +Variant ei_stream_context_create(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_context_create); + int count = params.size(); + if (count <= 0) return (f_stream_context_create()); + if (count == 1) return (f_stream_context_create(a0)); + return (f_stream_context_create(a0, a1)); +} +Variant ei_drawgetstrokedashoffset(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetstrokedashoffset); + return (f_drawgetstrokedashoffset(a0)); +} +Variant ei_openssl_pkey_get_public(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkey_get_public); + return (f_openssl_pkey_get_public(a0)); +} +Variant ei_interface_exists(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(interface_exists); + int count = params.size(); + if (count <= 1) return (f_interface_exists(a0)); + return (f_interface_exists(a0, a1)); +} +Variant ei_drawpathmovetorelative(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathmovetorelative); + return (f_drawpathmovetorelative(a0, a1, a2), null); +} +Variant ei_apache_get_config(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_get_config); + return (f_apache_get_config()); +} +Variant ei_curl_copy_handle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_copy_handle); + return (f_curl_copy_handle(a0)); +} +Variant ei_drawgetvectorgraphics(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetvectorgraphics); + return (f_drawgetvectorgraphics(a0)); +} +Variant ei_drawpathfinish(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathfinish); + return (f_drawpathfinish(a0), null); +} +Variant ei_png2wbmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(png2wbmp); + return (f_png2wbmp(a0, a1, a2, a3, a4)); +} +Variant ei_drawmatte(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawmatte); + return (f_drawmatte(a0, a1, a2, a3), null); +} +Variant ei_imagecolormatch(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolormatch); + return (f_imagecolormatch(a0, a1)); +} +Variant ei_drawrectangle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawrectangle); + return (f_drawrectangle(a0, a1, a2, a3, a4), null); +} +Variant ei_fb_parallel_query(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_parallel_query); + int count = params.size(); + if (count <= 1) return (f_fb_parallel_query(a0)); + if (count == 2) return (f_fb_parallel_query(a0, a1)); + if (count == 3) return (f_fb_parallel_query(a0, a1, a2)); + if (count == 4) return (f_fb_parallel_query(a0, a1, a2, a3)); + if (count == 5) return (f_fb_parallel_query(a0, a1, a2, a3, a4)); + if (count == 6) return (f_fb_parallel_query(a0, a1, a2, a3, a4, a5)); + return (f_fb_parallel_query(a0, a1, a2, a3, a4, a5, a6)); +} +Variant ei_mcrypt_enc_get_block_size(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_enc_get_block_size); + return (f_mcrypt_enc_get_block_size(a0)); +} +Variant ei_stream_context_set_option(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_context_set_option); + int count = params.size(); + if (count <= 2) return (f_stream_context_set_option(a0, a1)); + if (count == 3) return (f_stream_context_set_option(a0, a1, a2)); + return (f_stream_context_set_option(a0, a1, a2, a3)); +} +Variant ei_drawpathcurvetorelative(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathcurvetorelative); + return (f_drawpathcurvetorelative(a0, a1, a2, a3, a4, a5, a6), null); +} +Variant ei_phpcredits(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(phpcredits); + int count = params.size(); + if (count <= 0) return (f_phpcredits()); + return (f_phpcredits(a0)); +} +Variant ei_drawgetfillrule(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetfillrule); + return (f_drawgetfillrule(a0)); +} +Variant ei_xmlwriter_end_cdata(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_end_cdata); + return (f_xmlwriter_end_cdata(a0)); +} +Variant ei_magickgetversionstring(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetversionstring); + return (f_magickgetversionstring()); +} +Variant ei_pcntl_fork(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_fork); + return (f_pcntl_fork()); +} +Variant ei_doubleval(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(doubleval); + return (f_doubleval(a0)); +} +Variant ei_assert_options(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(assert_options); + int count = params.size(); + if (count <= 1) return (f_assert_options(a0)); + return (f_assert_options(a0, a1)); +} +Variant ei_magickhasnextimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickhasnextimage); + return (f_magickhasnextimage(a0)); +} +Variant ei_rmdir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rmdir); + int count = params.size(); + if (count <= 1) return (f_rmdir(a0)); + return (f_rmdir(a0, a1)); +} +Variant ei_drawgetstrokelinecap(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetstrokelinecap); + return (f_drawgetstrokelinecap(a0)); +} +Variant ei_oci_statement_type(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_statement_type); + return (f_oci_statement_type(a0)); +} +Variant ei_magickscaleimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickscaleimage); + return (f_magickscaleimage(a0, a1, a2)); +} +Variant ei_pixelgetblackquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetblackquantum); + return (f_pixelgetblackquantum(a0)); +} +Variant ei_magicknewimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicknewimage); + int count = params.size(); + if (count <= 3) return (f_magicknewimage(a0, a1, a2)); + return (f_magicknewimage(a0, a1, a2, a3)); +} +Variant ei_destroypixelwands(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(destroypixelwands); + return (f_destroypixelwands(a0), null); +} +Variant ei_shm_remove(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(shm_remove); + return (f_shm_remove(a0)); +} +Variant ei_date_sun_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_sun_info); + return (f_date_sun_info(a0, a1, a2)); +} +Variant ei_magickresizeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickresizeimage); + return (f_magickresizeimage(a0, a1, a2, a3, a4)); +} +Variant ei_parse_ini_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(parse_ini_file); + int count = params.size(); + if (count <= 1) return (f_parse_ini_file(a0)); + return (f_parse_ini_file(a0, a1)); +} +Variant ei_stream_get_meta_data(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_get_meta_data); + return (f_stream_get_meta_data(a0)); +} +Variant ei_imagepsencodefont(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagepsencodefont); + return (f_imagepsencodefont(a0, a1)); +} +Variant ei_ldap_set_option(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_set_option); + return (f_ldap_set_option(a0, a1, a2)); +} +Variant ei_magickgetsize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetsize); + return (f_magickgetsize(a0)); +} +Variant ei_memory_get_peak_usage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(memory_get_peak_usage); + int count = params.size(); + if (count <= 0) return (f_memory_get_peak_usage()); + return (f_memory_get_peak_usage(a0)); +} +Variant ei_pcntl_exec(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_exec); + int count = params.size(); + if (count <= 1) return (f_pcntl_exec(a0), null); + if (count == 2) return (f_pcntl_exec(a0, a1), null); + return (f_pcntl_exec(a0, a1, a2), null); +} +Variant ei_xmlwriter_set_indent_string(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_set_indent_string); + return (f_xmlwriter_set_indent_string(a0, a1)); +} +Variant ei_php_strip_whitespace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(php_strip_whitespace); + return (f_php_strip_whitespace(a0)); +} +Variant ei_strcoll(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strcoll); + return (f_strcoll(a0, a1)); +} +Variant ei_socket_send(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_send); + return (f_socket_send(a0, a1, a2, a3)); +} +Variant ei_zlib_get_coding_type(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(zlib_get_coding_type); + return (f_zlib_get_coding_type()); +} +Variant ei_mb_ereg_search_getregs(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_ereg_search_getregs); + return (f_mb_ereg_search_getregs()); +} +Variant ei_mb_eregi(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_eregi); + int count = params.size(); + if (count <= 2) return (f_mb_eregi(a0, a1)); + return (f_mb_eregi(a0, a1, ref(a2))); +} +Variant ei_pixelgetgreen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetgreen); + return (f_pixelgetgreen(a0)); +} +Variant ei_mysql_client_encoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_client_encoding); + int count = params.size(); + if (count <= 0) return (f_mysql_client_encoding()); + return (f_mysql_client_encoding(a0)); +} +Variant ei_zend_thread_id(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(zend_thread_id); + return (f_zend_thread_id()); +} +Variant ei_ldap_mod_replace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_mod_replace); + return (f_ldap_mod_replace(a0, a1, a2)); +} +Variant ei_stream_filter_prepend(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_filter_prepend); + int count = params.size(); + if (count <= 2) return (f_stream_filter_prepend(a0, a1)); + if (count == 3) return (f_stream_filter_prepend(a0, a1, a2)); + return (f_stream_filter_prepend(a0, a1, a2, a3)); +} +Variant ei_substr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(substr); + int count = params.size(); + if (count <= 2) return (f_substr(a0, a1)); + return (f_substr(a0, a1, a2)); +} +Variant ei_magickcombineimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcombineimages); + return (f_magickcombineimages(a0, a1)); +} +Variant ei_pixelgetexceptiontype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetexceptiontype); + return (f_pixelgetexceptiontype(a0)); +} +Variant ei_unpack(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(unpack); + return (f_unpack(a0, a1)); +} +Variant ei_magickgetimagepixels(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagepixels); + return (f_magickgetimagepixels(a0, a1, a2, a3, a4, a5, a6)); +} +Variant ei_array_product(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_product); + return (f_array_product(a0)); +} +Variant ei_substr_replace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(substr_replace); + int count = params.size(); + if (count <= 3) return (f_substr_replace(a0, a1, a2)); + return (f_substr_replace(a0, a1, a2, a3)); +} +Variant ei_oci_bind_array_by_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_bind_array_by_name); + int count = params.size(); + if (count <= 4) return (f_oci_bind_array_by_name(a0, a1, ref(a2), a3)); + if (count == 5) return (f_oci_bind_array_by_name(a0, a1, ref(a2), a3, a4)); + return (f_oci_bind_array_by_name(a0, a1, ref(a2), a3, a4, a5)); +} +Variant ei_xmlwriter_write_dtd(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_dtd); + int count = params.size(); + if (count <= 2) return (f_xmlwriter_write_dtd(a0, a1)); + if (count == 3) return (f_xmlwriter_write_dtd(a0, a1, a2)); + if (count == 4) return (f_xmlwriter_write_dtd(a0, a1, a2, a3)); + return (f_xmlwriter_write_dtd(a0, a1, a2, a3, a4)); +} +Variant ei_mysql_select_db(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_select_db); + int count = params.size(); + if (count <= 1) return (f_mysql_select_db(a0)); + return (f_mysql_select_db(a0, a1)); +} +Variant ei_use_soap_error_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(use_soap_error_handler); + int count = params.size(); + if (count <= 0) return (f_use_soap_error_handler()); + return (f_use_soap_error_handler(a0)); +} +Variant ei_debug_backtrace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(debug_backtrace); + return (f_debug_backtrace()); +} +Variant ei_drawpathcurvetosmoothrelative(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathcurvetosmoothrelative); + return (f_drawpathcurvetosmoothrelative(a0, a1, a2, a3, a4), null); +} +Variant ei_mailparse_determine_best_xfer_encoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_determine_best_xfer_encoding); + return (f_mailparse_determine_best_xfer_encoding(a0)); +} +Variant ei_imagettfbbox(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagettfbbox); + return (f_imagettfbbox(a0, a1, a2, a3)); +} +Variant ei_mb_internal_encoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_internal_encoding); + int count = params.size(); + if (count <= 0) return (f_mb_internal_encoding()); + return (f_mb_internal_encoding(a0)); +} +Variant ei_msg_get_queue(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(msg_get_queue); + int count = params.size(); + if (count <= 1) return (f_msg_get_queue(a0)); + return (f_msg_get_queue(a0, a1)); +} +Variant ei_posix_getegid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getegid); + return (f_posix_getegid()); +} +Variant ei_magickmedianfilterimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickmedianfilterimage); + return (f_magickmedianfilterimage(a0, a1)); +} +Variant ei_xbox_task_result(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xbox_task_result); + return (f_xbox_task_result(a0, a1, ref(a2))); +} +Variant ei_mcrypt_generic_deinit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_generic_deinit); + return (f_mcrypt_generic_deinit(a0)); +} +Variant ei_method_exists(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(method_exists); + return (f_method_exists(a0, a1)); +} +Variant ei_money_format(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(money_format); + return (f_money_format(a0, a1)); +} +Variant ei_clearmagickwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(clearmagickwand); + return (f_clearmagickwand(a0), null); +} +Variant ei_array_udiff_assoc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_udiff_assoc); + int count = params.size(); + if (count <= 3) return (f_array_udiff_assoc(count, a0, a1, a2)); + return (f_array_udiff_assoc(count, a0, a1, a2,vargs)); +} +Variant ei_xml_parser_free(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_parser_free); + return (f_xml_parser_free(a0)); +} +Variant ei_fb_reset_opcode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_reset_opcode); + return (f_fb_reset_opcode(a0), null); +} +Variant ei_is_resource(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_resource); + return (f_is_resource(a0)); +} +Variant ei_posix_seteuid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_seteuid); + return (f_posix_seteuid(a0)); +} +Variant ei_magicksetinterlacescheme(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetinterlacescheme); + return (f_magicksetinterlacescheme(a0, a1)); +} +Variant ei_str_shuffle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(str_shuffle); + return (f_str_shuffle(a0)); +} +Variant ei_mcrypt_enc_is_block_algorithm(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_enc_is_block_algorithm); + return (f_mcrypt_enc_is_block_algorithm(a0)); +} +Variant ei_magickgetcopyright(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetcopyright); + return (f_magickgetcopyright()); +} +Variant ei_magickstripimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickstripimage); + return (f_magickstripimage(a0)); +} +Variant ei_base64_decode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(base64_decode); + int count = params.size(); + if (count <= 1) return (f_base64_decode(a0)); + return (f_base64_decode(a0, a1)); +} +Variant ei_rand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rand); + int count = params.size(); + if (count <= 0) return (f_rand()); + if (count == 1) return (f_rand(a0)); + return (f_rand(a0, a1)); +} +Variant ei_crc32(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(crc32); + return (f_crc32(a0)); +} +Variant ei_stream_encoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_encoding); + int count = params.size(); + if (count <= 1) return (f_stream_encoding(a0)); + return (f_stream_encoding(a0, a1)); +} +Variant ei_drawgetstrokedasharray(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetstrokedasharray); + return (f_drawgetstrokedasharray(a0)); +} +Variant ei_magickgetimagedispose(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagedispose); + return (f_magickgetimagedispose(a0)); +} +Variant ei_drawpopdefs(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpopdefs); + return (f_drawpopdefs(a0), null); +} +Variant ei_xml_parser_create(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_parser_create); + int count = params.size(); + if (count <= 0) return (f_xml_parser_create()); + return (f_xml_parser_create(a0)); +} +Variant ei_pcntl_wifsignaled(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_wifsignaled); + return (f_pcntl_wifsignaled(a0)); +} +Variant ei_fbml_flatten_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_flatten_11); + return (f_fbml_flatten_11(a0)); +} +Variant ei_openssl_pkcs7_encrypt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkcs7_encrypt); + int count = params.size(); + if (count <= 4) return (f_openssl_pkcs7_encrypt(a0, a1, a2, a3)); + if (count == 5) return (f_openssl_pkcs7_encrypt(a0, a1, a2, a3, a4)); + return (f_openssl_pkcs7_encrypt(a0, a1, a2, a3, a4, a5)); +} +Variant ei_read_exif_data(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(read_exif_data); + int count = params.size(); + if (count <= 1) return (f_read_exif_data(a0)); + if (count == 2) return (f_read_exif_data(a0, a1)); + if (count == 3) return (f_read_exif_data(a0, a1, a2)); + return (f_read_exif_data(a0, a1, a2, a3)); +} +Variant ei_drawsetstrokeopacity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokeopacity); + return (f_drawsetstrokeopacity(a0, a1), null); +} +Variant ei_drawroundrectangle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawroundrectangle); + return (f_drawroundrectangle(a0, a1, a2, a3, a4, a5, a6), null); +} +Variant ei_drawgetstrokewidth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetstrokewidth); + return (f_drawgetstrokewidth(a0)); +} +Variant ei_date_create(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_create); + int count = params.size(); + if (count <= 0) return (f_date_create()); + if (count == 1) return (f_date_create(a0)); + return (f_date_create(a0, a1)); +} +Variant ei_strcspn(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strcspn); + int count = params.size(); + if (count <= 2) return (f_strcspn(a0, a1)); + if (count == 3) return (f_strcspn(a0, a1, a2)); + return (f_strcspn(a0, a1, a2, a3)); +} +Variant ei_drawgetclipunits(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetclipunits); + return (f_drawgetclipunits(a0)); +} +Variant ei_ldap_sasl_bind(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_sasl_bind); + int count = params.size(); + if (count <= 1) return (f_ldap_sasl_bind(a0)); + if (count == 2) return (f_ldap_sasl_bind(a0, a1)); + if (count == 3) return (f_ldap_sasl_bind(a0, a1, a2)); + if (count == 4) return (f_ldap_sasl_bind(a0, a1, a2, a3)); + if (count == 5) return (f_ldap_sasl_bind(a0, a1, a2, a3, a4)); + if (count == 6) return (f_ldap_sasl_bind(a0, a1, a2, a3, a4, a5)); + return (f_ldap_sasl_bind(a0, a1, a2, a3, a4, a5, a6)); +} +Variant ei_sem_acquire(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sem_acquire); + return (f_sem_acquire(a0)); +} +Variant ei_socket_strerror(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_strerror); + return (f_socket_strerror(a0)); +} +Variant ei_magickgetstringheight(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetstringheight); + int count = params.size(); + if (count <= 3) return (f_magickgetstringheight(a0, a1, a2)); + return (f_magickgetstringheight(a0, a1, a2, a3)); +} +Variant ei_rawurlencode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rawurlencode); + return (f_rawurlencode(a0)); +} +Variant ei_strtotime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strtotime); + int count = params.size(); + if (count <= 1) return (f_strtotime(a0)); + return (f_strtotime(a0, a1)); +} +Variant ei_apc_clear_cache(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_clear_cache); + int count = params.size(); + if (count <= 0) return (f_apc_clear_cache()); + return (f_apc_clear_cache(a0)); +} +Variant ei_dirname(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(dirname); + return (f_dirname(a0)); +} +Variant ei_strnatcasecmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strnatcasecmp); + return (f_strnatcasecmp(a0, a1)); +} +Variant ei_magicksetsamplingfactors(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetsamplingfactors); + return (f_magicksetsamplingfactors(a0, a1, a2)); +} +Variant ei_openssl_pkey_get_private(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkey_get_private); + int count = params.size(); + if (count <= 1) return (f_openssl_pkey_get_private(a0)); + return (f_openssl_pkey_get_private(a0, a1)); +} +Variant ei_magickaverageimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickaverageimages); + return (f_magickaverageimages(a0)); +} +Variant ei_iconv_strrpos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iconv_strrpos); + int count = params.size(); + if (count <= 2) return (f_iconv_strrpos(a0, a1)); + return (f_iconv_strrpos(a0, a1, a2)); +} +Variant ei_drawsetviewbox(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetviewbox); + return (f_drawsetviewbox(a0, a1, a2, a3, a4), null); +} +Variant ei_magicksetimagecompressionquality(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagecompressionquality); + return (f_magicksetimagecompressionquality(a0, a1)); +} +Variant ei_mysql_ping(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_ping); + int count = params.size(); + if (count <= 0) return (f_mysql_ping()); + return (f_mysql_ping(a0)); +} +Variant ei_xml_get_current_byte_index(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_get_current_byte_index); + return (f_xml_get_current_byte_index(a0)); +} +Variant ei_magicktransformimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicktransformimage); + return (f_magicktransformimage(a0, a1, a2)); +} +Variant ei_drawgetstrokeantialias(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetstrokeantialias); + return (f_drawgetstrokeantialias(a0)); +} +Variant ei_ini_alter(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ini_alter); + return (f_ini_alter(a0, a1)); +} +Variant ei_get_class(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_class); + int count = params.size(); + if (count <= 0) return (f_get_class()); + return (f_get_class(a0)); +} +Variant ei_magicksetimageprofile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimageprofile); + return (f_magicksetimageprofile(a0, a1, a2)); +} +Variant ei_mysql_field_seek(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_field_seek); + int count = params.size(); + if (count <= 1) return (f_mysql_field_seek(a0)); + return (f_mysql_field_seek(a0, a1)); +} +Variant ei_drawgetfontsize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetfontsize); + return (f_drawgetfontsize(a0)); +} +Variant ei_mysql_num_rows(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_num_rows); + return (f_mysql_num_rows(a0)); +} +Variant ei_magickgetimageresolution(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageresolution); + return (f_magickgetimageresolution(a0)); +} +Variant ei_array_diff(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_diff); + int count = params.size(); + if (count <= 2) return (f_array_diff(count, a0, a1)); + return (f_array_diff(count, a0, a1,vargs)); +} +Variant ei_xmlwriter_open_uri(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_open_uri); + return (f_xmlwriter_open_uri(a0)); +} +Variant ei_magickgetimagetype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagetype); + return (f_magickgetimagetype(a0)); +} +Variant ei_simplexml_load_string(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(simplexml_load_string); + int count = params.size(); + if (count <= 1) return (f_simplexml_load_string(a0)); + if (count == 2) return (f_simplexml_load_string(a0, a1)); + if (count == 3) return (f_simplexml_load_string(a0, a1, a2)); + if (count == 4) return (f_simplexml_load_string(a0, a1, a2, a3)); + return (f_simplexml_load_string(a0, a1, a2, a3, a4)); +} +Variant ei_magickunsharpmaskimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickunsharpmaskimage); + int count = params.size(); + if (count <= 5) return (f_magickunsharpmaskimage(a0, a1, a2, a3, a4)); + return (f_magickunsharpmaskimage(a0, a1, a2, a3, a4, a5)); +} +Variant ei_quoted_printable_encode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(quoted_printable_encode); + return (f_quoted_printable_encode(a0)); +} +Variant ei_gettype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gettype); + return (f_gettype(a0)); +} +Variant ei_magickgetimagebackgroundcolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagebackgroundcolor); + return (f_magickgetimagebackgroundcolor(a0)); +} +Variant ei_array_intersect_key(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_intersect_key); + int count = params.size(); + if (count <= 2) return (f_array_intersect_key(count, a0, a1)); + return (f_array_intersect_key(count, a0, a1,vargs)); +} +Variant ei_array_change_key_case(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_change_key_case); + int count = params.size(); + if (count <= 1) return (f_array_change_key_case(a0)); + return (f_array_change_key_case(a0, a1)); +} +Variant ei_ldap_first_attribute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_first_attribute); + return (f_ldap_first_attribute(a0, a1)); +} +Variant ei_gettimeofday(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gettimeofday); + int count = params.size(); + if (count <= 0) return (f_gettimeofday()); + return (f_gettimeofday(a0)); +} +Variant ei_xmlwriter_end_element(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_end_element); + return (f_xmlwriter_end_element(a0)); +} +Variant ei_drawpoint(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpoint); + return (f_drawpoint(a0, a1, a2), null); +} +Variant ei_oci_fetch_object(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_fetch_object); + return (f_oci_fetch_object(a0)); +} +Variant ei_strnatcmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strnatcmp); + return (f_strnatcmp(a0, a1)); +} +Variant ei_property_exists(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(property_exists); + return (f_property_exists(a0, a1)); +} +Variant ei_xhp_preprocess_code(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xhp_preprocess_code); + return (f_xhp_preprocess_code(a0)); +} +Variant ei_oci_rollback(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_rollback); + return (f_oci_rollback(a0)); +} +Variant ei_mysql_affected_rows(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_affected_rows); + int count = params.size(); + if (count <= 0) return (f_mysql_affected_rows()); + return (f_mysql_affected_rows(a0)); +} +Variant ei_magickdespeckleimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickdespeckleimage); + return (f_magickdespeckleimage(a0)); +} +Variant ei_imagecopymergegray(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + Variant a8; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a8 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecopymergegray); + return (f_imagecopymergegray(a0, a1, a2, a3, a4, a5, a6, a7, a8)); +} +Variant ei_ctype_cntrl(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_cntrl); + return (f_ctype_cntrl(a0)); +} +Variant ei_is_array(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_array); + return (f_is_array(a0)); +} +Variant ei_rename(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rename); + int count = params.size(); + if (count <= 2) return (f_rename(a0, a1)); + return (f_rename(a0, a1, a2)); +} +Variant ei_date_format(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_format); + return (f_date_format(a0, a1)); +} +Variant ei_magickshaveimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickshaveimage); + return (f_magickshaveimage(a0, a1, a2)); +} +Variant ei_xmlwriter_output_memory(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_output_memory); + int count = params.size(); + if (count <= 1) return (f_xmlwriter_output_memory(a0)); + return (f_xmlwriter_output_memory(a0, a1)); +} +Variant ei_ob_end_flush(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_end_flush); + return (f_ob_end_flush()); +} +Variant ei_magickwhitethresholdimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickwhitethresholdimage); + return (f_magickwhitethresholdimage(a0, a1)); +} +Variant ei_drawpolyline(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpolyline); + return (f_drawpolyline(a0, a1), null); +} +Variant ei_hphp_get_function_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_get_function_info); + return (f_hphp_get_function_info(a0)); +} +Variant ei_prev(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(prev); + return (f_prev(ref(a0))); +} +Variant ei_imagegammacorrect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagegammacorrect); + return (f_imagegammacorrect(a0, a1, a2)); +} +Variant ei_str_replace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(str_replace); + int count = params.size(); + if (count <= 3) return (f_str_replace(a0, a1, a2)); + return (f_str_replace(a0, a1, a2, ref(a3))); +} +Variant ei_fb_get_ape_version(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_get_ape_version); + return (f_fb_get_ape_version()); +} +Variant ei_clock_getres(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(clock_getres); + return (f_clock_getres(a0, ref(a1), ref(a2))); +} +Variant ei_magicktrimimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicktrimimage); + return (f_magicktrimimage(a0, a1)); +} +Variant ei_magickgetimagegamma(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagegamma); + return (f_magickgetimagegamma(a0)); +} +Variant ei_newdrawingwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(newdrawingwand); + return (f_newdrawingwand()); +} +Variant ei_oci_new_cursor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_new_cursor); + return (f_oci_new_cursor(a0)); +} +Variant ei_gzrewind(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzrewind); + return (f_gzrewind(a0)); +} +Variant ei_ldap_explode_dn(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_explode_dn); + return (f_ldap_explode_dn(a0, a1)); +} +Variant ei_posix_times(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_times); + return (f_posix_times()); +} +Variant ei_drawgetfillcolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetfillcolor); + return (f_drawgetfillcolor(a0)); +} +Variant ei_mb_strtolower(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strtolower); + int count = params.size(); + if (count <= 1) return (f_mb_strtolower(a0)); + return (f_mb_strtolower(a0, a1)); +} +Variant ei_localtime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(localtime); + int count = params.size(); + if (count <= 0) return (f_localtime()); + if (count == 1) return (f_localtime(a0)); + return (f_localtime(a0, a1)); +} +Variant ei_oci_password_change(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_password_change); + return (f_oci_password_change(a0, a1, a2, a3)); +} +Variant ei_fb_thrift_unserialize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_thrift_unserialize); + int count = params.size(); + if (count <= 2) return (f_fb_thrift_unserialize(a0, ref(a1))); + return (f_fb_thrift_unserialize(a0, ref(a1), ref(a2))); +} +Variant ei_sha1(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sha1); + int count = params.size(); + if (count <= 1) return (f_sha1(a0)); + return (f_sha1(a0, a1)); +} +Variant ei_implode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(implode); + int count = params.size(); + if (count <= 1) return (f_implode(a0)); + return (f_implode(a0, a1)); +} +Variant ei_date_isodate_set(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_isodate_set); + int count = params.size(); + if (count <= 3) return (f_date_isodate_set(a0, a1, a2), null); + return (f_date_isodate_set(a0, a1, a2, a3), null); +} +Variant ei_oci_result(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_result); + return (f_oci_result(a0, a1)); +} +Variant ei_magickpaintopaqueimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickpaintopaqueimage); + int count = params.size(); + if (count <= 3) return (f_magickpaintopaqueimage(a0, a1, a2)); + return (f_magickpaintopaqueimage(a0, a1, a2, a3)); +} +Variant ei_mb_strimwidth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_strimwidth); + int count = params.size(); + if (count <= 3) return (f_mb_strimwidth(a0, a1, a2)); + if (count == 4) return (f_mb_strimwidth(a0, a1, a2, a3)); + return (f_mb_strimwidth(a0, a1, a2, a3, a4)); +} +Variant ei_drawsetfont(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfont); + return (f_drawsetfont(a0, a1)); +} +Variant ei_xml_set_default_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_set_default_handler); + return (f_xml_set_default_handler(a0, a1)); +} +Variant ei_magickchopimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickchopimage); + return (f_magickchopimage(a0, a1, a2, a3, a4)); +} +Variant ei_wordwrap(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(wordwrap); + int count = params.size(); + if (count <= 1) return (f_wordwrap(a0)); + if (count == 2) return (f_wordwrap(a0, a1)); + if (count == 3) return (f_wordwrap(a0, a1, a2)); + return (f_wordwrap(a0, a1, a2, a3)); +} +Variant ei_gzgetss(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzgetss); + int count = params.size(); + if (count <= 1) return (f_gzgetss(a0)); + if (count == 2) return (f_gzgetss(a0, a1)); + return (f_gzgetss(a0, a1, a2)); +} +Variant ei_magickgetimagevirtualpixelmethod(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagevirtualpixelmethod); + return (f_magickgetimagevirtualpixelmethod(a0)); +} +Variant ei_imagedestroy(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagedestroy); + return (f_imagedestroy(a0)); +} +Variant ei_timezone_open(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(timezone_open); + return (f_timezone_open(a0)); +} +Variant ei_ob_clean(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_clean); + return (f_ob_clean(), null); +} +Variant ei_mb_ereg_search_pos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_ereg_search_pos); + int count = params.size(); + if (count <= 0) return (f_mb_ereg_search_pos()); + if (count == 1) return (f_mb_ereg_search_pos(a0)); + return (f_mb_ereg_search_pos(a0, a1)); +} +Variant ei_bccomp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bccomp); + int count = params.size(); + if (count <= 2) return (f_bccomp(a0, a1)); + return (f_bccomp(a0, a1, a2)); +} +Variant ei_gzdecode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzdecode); + return (f_gzdecode(a0)); +} +Variant ei_magicksetimagecompose(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagecompose); + return (f_magicksetimagecompose(a0, a1)); +} +Variant ei_apc_bin_dump(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_bin_dump); + int count = params.size(); + if (count <= 0) return (f_apc_bin_dump()); + if (count == 1) return (f_apc_bin_dump(a0)); + return (f_apc_bin_dump(a0, a1)); +} +Variant ei_ini_get(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ini_get); + return (f_ini_get(a0)); +} +Variant ei_mb_ereg_search_setpos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_ereg_search_setpos); + return (f_mb_ereg_search_setpos(a0)); +} +Variant ei_stream_copy_to_stream(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_copy_to_stream); + int count = params.size(); + if (count <= 2) return (f_stream_copy_to_stream(a0, a1)); + if (count == 3) return (f_stream_copy_to_stream(a0, a1, a2)); + return (f_stream_copy_to_stream(a0, a1, a2, a3)); +} +Variant ei_xml_get_error_code(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_get_error_code); + return (f_xml_get_error_code(a0)); +} +Variant ei_pcntl_alarm(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_alarm); + return (f_pcntl_alarm(a0)); +} +Variant ei_drawpolygon(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpolygon); + return (f_drawpolygon(a0, a1), null); +} +Variant ei_mysql_connect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_connect); + int count = params.size(); + if (count <= 0) return (f_mysql_connect()); + if (count == 1) return (f_mysql_connect(a0)); + if (count == 2) return (f_mysql_connect(a0, a1)); + if (count == 3) return (f_mysql_connect(a0, a1, a2)); + if (count == 4) return (f_mysql_connect(a0, a1, a2, a3)); + if (count == 5) return (f_mysql_connect(a0, a1, a2, a3, a4)); + if (count == 6) return (f_mysql_connect(a0, a1, a2, a3, a4, a5)); + return (f_mysql_connect(a0, a1, a2, a3, a4, a5, a6)); +} +Variant ei_xmlwriter_write_raw(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_raw); + return (f_xmlwriter_write_raw(a0, a1)); +} +Variant ei_fgetss(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fgetss); + int count = params.size(); + if (count <= 1) return (f_fgetss(a0)); + if (count == 2) return (f_fgetss(a0, a1)); + return (f_fgetss(a0, a1, a2)); +} +Variant ei_drawarc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawarc); + return (f_drawarc(a0, a1, a2, a3, a4, a5, a6), null); +} +Variant ei_set_error_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(set_error_handler); + int count = params.size(); + if (count <= 1) return (f_set_error_handler(a0)); + return (f_set_error_handler(a0, a1)); +} +Variant ei_str_word_count(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(str_word_count); + int count = params.size(); + if (count <= 1) return (f_str_word_count(a0)); + if (count == 2) return (f_str_word_count(a0, a1)); + return (f_str_word_count(a0, a1, a2)); +} +Variant ei_drawsetcliprule(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetcliprule); + return (f_drawsetcliprule(a0, a1), null); +} +Variant ei_openssl_pkcs12_read(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkcs12_read); + return (f_openssl_pkcs12_read(a0, ref(a1), a2)); +} +Variant ei_ldap_list(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_list); + int count = params.size(); + if (count <= 3) return (f_ldap_list(a0, a1, a2)); + if (count == 4) return (f_ldap_list(a0, a1, a2, a3)); + if (count == 5) return (f_ldap_list(a0, a1, a2, a3, a4)); + if (count == 6) return (f_ldap_list(a0, a1, a2, a3, a4, a5)); + if (count == 7) return (f_ldap_list(a0, a1, a2, a3, a4, a5, a6)); + return (f_ldap_list(a0, a1, a2, a3, a4, a5, a6, a7)); +} +Variant ei_func_num_args(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(func_num_args); + return (f_func_num_args()); +} +Variant ei_drawsettextdecoration(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsettextdecoration); + return (f_drawsettextdecoration(a0, a1), null); +} +Variant ei_str_rot13(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(str_rot13); + return (f_str_rot13(a0)); +} +Variant ei_openssl_pkey_new(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkey_new); + int count = params.size(); + if (count <= 0) return (f_openssl_pkey_new()); + return (f_openssl_pkey_new(a0)); +} +Variant ei_magicksetimageindex(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimageindex); + return (f_magicksetimageindex(a0, a1)); +} +Variant ei_ldap_rename(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_rename); + return (f_ldap_rename(a0, a1, a2, a3, a4)); +} +Variant ei_ldap_start_tls(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_start_tls); + return (f_ldap_start_tls(a0)); +} +Variant ei_tanh(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(tanh); + return (f_tanh(a0)); +} +Variant ei_drawscale(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawscale); + return (f_drawscale(a0, a1, a2), null); +} +Variant ei_drawrotate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawrotate); + return (f_drawrotate(a0, a1), null); +} +Variant ei_getservbyname(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getservbyname); + return (f_getservbyname(a0, a1)); +} +Variant ei_compact(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(compact); + int count = params.size(); + if (count <= 1) return (f_compact(count, a0)); + return (f_compact(count, a0,vargs)); +} +Variant ei_imagecolorclosest(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorclosest); + return (f_imagecolorclosest(a0, a1, a2, a3)); +} +Variant ei_magickwriteimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickwriteimages); + int count = params.size(); + if (count <= 1) return (f_magickwriteimages(a0)); + if (count == 2) return (f_magickwriteimages(a0, a1)); + return (f_magickwriteimages(a0, a1, a2)); +} +Variant ei_pixelsetalpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetalpha); + return (f_pixelsetalpha(a0, a1), null); +} +Variant ei_magicksetimageiterations(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimageiterations); + return (f_magicksetimageiterations(a0, a1)); +} +Variant ei_oci_field_scale(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_field_scale); + return (f_oci_field_scale(a0, a1)); +} +Variant ei_drawpathmovetoabsolute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathmovetoabsolute); + return (f_drawpathmovetoabsolute(a0, a1, a2), null); +} +Variant ei_quotemeta(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(quotemeta); + return (f_quotemeta(a0)); +} +Variant ei_imagefilltoborder(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagefilltoborder); + return (f_imagefilltoborder(a0, a1, a2, a3, a4)); +} +Variant ei_xml_set_notation_decl_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_set_notation_decl_handler); + return (f_xml_set_notation_decl_handler(a0, a1)); +} +Variant ei_oci_free_descriptor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_free_descriptor); + return (f_oci_free_descriptor(a0)); +} +Variant ei_is_writeable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_writeable); + return (f_is_writeable(a0)); +} +Variant ei_magickgetwandsize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetwandsize); + return (f_magickgetwandsize(a0)); +} +Variant ei_imageinterlace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imageinterlace); + int count = params.size(); + if (count <= 1) return (f_imageinterlace(a0)); + return (f_imageinterlace(a0, a1)); +} +Variant ei_preg_match_all(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(preg_match_all); + int count = params.size(); + if (count <= 3) return (f_preg_match_all(a0, a1, ref(a2))); + if (count == 4) return (f_preg_match_all(a0, a1, ref(a2), a3)); + return (f_preg_match_all(a0, a1, ref(a2), a3, a4)); +} +Variant ei_proc_terminate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(proc_terminate); + int count = params.size(); + if (count <= 1) return (f_proc_terminate(a0)); + return (f_proc_terminate(a0, a1)); +} +Variant ei_apc_bin_loadfile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_bin_loadfile); + int count = params.size(); + if (count <= 1) return (f_apc_bin_loadfile(a0)); + if (count == 2) return (f_apc_bin_loadfile(a0, a1)); + if (count == 3) return (f_apc_bin_loadfile(a0, a1, a2)); + return (f_apc_bin_loadfile(a0, a1, a2, a3)); +} +Variant ei_posix_getcwd(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getcwd); + return (f_posix_getcwd()); +} +Variant ei_drawpathcurvetoabsolute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathcurvetoabsolute); + return (f_drawpathcurvetoabsolute(a0, a1, a2, a3, a4, a5, a6), null); +} +Variant ei_preg_match(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(preg_match); + int count = params.size(); + if (count <= 2) return (f_preg_match(a0, a1)); + if (count == 3) return (f_preg_match(a0, a1, ref(a2))); + if (count == 4) return (f_preg_match(a0, a1, ref(a2), a3)); + return (f_preg_match(a0, a1, ref(a2), a3, a4)); +} +Variant ei_timezone_abbreviations_list(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(timezone_abbreviations_list); + return (f_timezone_abbreviations_list()); +} +Variant ei_magickradialblurimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickradialblurimage); + return (f_magickradialblurimage(a0, a1)); +} +Variant ei_posix_geteuid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_geteuid); + return (f_posix_geteuid()); +} +Variant ei_mysql_fetch_lengths(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_fetch_lengths); + return (f_mysql_fetch_lengths(a0)); +} +Variant ei_magickwriteimagefile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickwriteimagefile); + return (f_magickwriteimagefile(a0, a1)); +} +Variant ei_serialize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(serialize); + return (f_serialize(a0)); +} +Variant ei_exif_read_data(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(exif_read_data); + int count = params.size(); + if (count <= 1) return (f_exif_read_data(a0)); + if (count == 2) return (f_exif_read_data(a0, a1)); + if (count == 3) return (f_exif_read_data(a0, a1, a2)); + return (f_exif_read_data(a0, a1, a2, a3)); +} +Variant ei_pixelgetiteratorexceptiontype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetiteratorexceptiontype); + return (f_pixelgetiteratorexceptiontype(a0)); +} +Variant ei_destroydrawingwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(destroydrawingwand); + return (f_destroydrawingwand(a0), null); +} +Variant ei_lstat(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(lstat); + return (f_lstat(a0)); +} +Variant ei_apache_note(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_note); + int count = params.size(); + if (count <= 1) return (f_apache_note(a0)); + return (f_apache_note(a0, a1)); +} +Variant ei_drawgetexceptiontype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetexceptiontype); + return (f_drawgetexceptiontype(a0)); +} +Variant ei_drawbezier(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawbezier); + return (f_drawbezier(a0, a1), null); +} +Variant ei_xmlwriter_start_comment(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_comment); + return (f_xmlwriter_start_comment(a0)); +} +Variant ei_ldap_set_rebind_proc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_set_rebind_proc); + return (f_ldap_set_rebind_proc(a0, a1)); +} +Variant ei_fb_debug_rlog(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_debug_rlog); + int count = params.size(); + if (count <= 1) return (f_fb_debug_rlog(a0)); + if (count == 2) return (f_fb_debug_rlog(a0, a1)); + if (count == 3) return (f_fb_debug_rlog(a0, a1, a2)); + return (f_fb_debug_rlog(a0, a1, a2, a3)); +} +Variant ei_drawsetstrokecolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokecolor); + return (f_drawsetstrokecolor(a0, a1), null); +} +Variant ei_drawpathlinetohorizontalrelative(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathlinetohorizontalrelative); + return (f_drawpathlinetohorizontalrelative(a0, a1), null); +} +Variant ei_gmmktime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gmmktime); + int count = params.size(); + if (count <= 0) return (f_gmmktime()); + if (count == 1) return (f_gmmktime(a0)); + if (count == 2) return (f_gmmktime(a0, a1)); + if (count == 3) return (f_gmmktime(a0, a1, a2)); + if (count == 4) return (f_gmmktime(a0, a1, a2, a3)); + if (count == 5) return (f_gmmktime(a0, a1, a2, a3, a4)); + return (f_gmmktime(a0, a1, a2, a3, a4, a5)); +} +Variant ei_gmdate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gmdate); + int count = params.size(); + if (count <= 1) return (f_gmdate(a0)); + return (f_gmdate(a0, a1)); +} +Variant ei_posix_getgid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getgid); + return (f_posix_getgid()); +} +Variant ei_sinh(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sinh); + return (f_sinh(a0)); +} +Variant ei_apc_fetch(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_fetch); + int count = params.size(); + if (count <= 1) return (f_apc_fetch(a0)); + if (count == 2) return (f_apc_fetch(a0, ref(a1))); + return (f_apc_fetch(a0, ref(a1), a2)); +} +Variant ei_fileowner(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fileowner); + return (f_fileowner(a0)); +} +Variant ei_imagecopymerge(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + Variant a8; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a8 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecopymerge); + return (f_imagecopymerge(a0, a1, a2, a3, a4, a5, a6, a7, a8)); +} +Variant ei_magickclipimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickclipimage); + return (f_magickclipimage(a0)); +} +Variant ei_imagestringup(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagestringup); + return (f_imagestringup(a0, a1, a2, a3, a4, a5)); +} +Variant ei_mt_getrandmax(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mt_getrandmax); + return (f_mt_getrandmax()); +} +Variant ei_magickgetresourcelimit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetresourcelimit); + return (f_magickgetresourcelimit(a0)); +} +Variant ei_imagecolorexact(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorexact); + return (f_imagecolorexact(a0, a1, a2, a3)); +} +Variant ei_setcookie(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(setcookie); + int count = params.size(); + if (count <= 1) return (f_setcookie(a0)); + if (count == 2) return (f_setcookie(a0, a1)); + if (count == 3) return (f_setcookie(a0, a1, a2)); + if (count == 4) return (f_setcookie(a0, a1, a2, a3)); + if (count == 5) return (f_setcookie(a0, a1, a2, a3, a4)); + if (count == 6) return (f_setcookie(a0, a1, a2, a3, a4, a5)); + return (f_setcookie(a0, a1, a2, a3, a4, a5, a6)); +} +Variant ei_fileatime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fileatime); + return (f_fileatime(a0)); +} +Variant ei_apd_stop_trace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apd_stop_trace); + return (f_apd_stop_trace(), null); +} +Variant ei_addcslashes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(addcslashes); + return (f_addcslashes(a0, a1)); +} +Variant ei_magicksetimageoption(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimageoption); + return (f_magicksetimageoption(a0, a1, a2, a3)); +} +Variant ei_xmlwriter_write_comment(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_comment); + return (f_xmlwriter_write_comment(a0, a1)); +} +Variant ei_drawgetfontstyle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetfontstyle); + return (f_drawgetfontstyle(a0)); +} +Variant ei_strtoupper(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strtoupper); + return (f_strtoupper(a0)); +} +Variant ei_xml_set_processing_instruction_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_set_processing_instruction_handler); + return (f_xml_set_processing_instruction_handler(a0, a1)); +} +Variant ei_apd_breakpoint(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apd_breakpoint); + return (f_apd_breakpoint()); +} +Variant ei_magickgetimageblueprimary(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageblueprimary); + return (f_magickgetimageblueprimary(a0)); +} +Variant ei_magickspreadimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickspreadimage); + return (f_magickspreadimage(a0, a1)); +} +Variant ei_array_fill(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_fill); + return (f_array_fill(a0, a1, a2)); +} +Variant ei_fb_render_wrapped(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_render_wrapped); + int count = params.size(); + if (count <= 1) return (f_fb_render_wrapped(a0)); + if (count == 2) return (f_fb_render_wrapped(a0, a1)); + if (count == 3) return (f_fb_render_wrapped(a0, a1, a2)); + return (f_fb_render_wrapped(a0, a1, a2, a3)); +} +Variant ei_stream_set_write_buffer(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_set_write_buffer); + return (f_stream_set_write_buffer(a0, a1)); +} +Variant ei_mb_list_encodings(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_list_encodings); + return (f_mb_list_encodings()); +} +Variant ei_sleep(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sleep); + return (f_sleep(a0)); +} +Variant ei_cleardrawingwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(cleardrawingwand); + return (f_cleardrawingwand(a0), null); +} +Variant ei_imagecolorset(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorset); + return (f_imagecolorset(a0, a1, a2, a3, a4)); +} +Variant ei_openssl_x509_checkpurpose(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_x509_checkpurpose); + int count = params.size(); + if (count <= 2) return (f_openssl_x509_checkpurpose(a0, a1)); + if (count == 3) return (f_openssl_x509_checkpurpose(a0, a1, a2)); + return (f_openssl_x509_checkpurpose(a0, a1, a2, a3)); +} +Variant ei_drawpathcurvetosmoothabsolute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathcurvetosmoothabsolute); + return (f_drawpathcurvetosmoothabsolute(a0, a1, a2, a3, a4), null); +} +Variant ei_array_intersect_ukey(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_intersect_ukey); + int count = params.size(); + if (count <= 3) return (f_array_intersect_ukey(count, a0, a1, a2)); + return (f_array_intersect_ukey(count, a0, a1, a2,vargs)); +} +Variant ei_timezone_name_from_abbr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(timezone_name_from_abbr); + int count = params.size(); + if (count <= 1) return (f_timezone_name_from_abbr(a0)); + if (count == 2) return (f_timezone_name_from_abbr(a0, a1)); + return (f_timezone_name_from_abbr(a0, a1, a2)); +} +Variant ei_imagefilledellipse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagefilledellipse); + return (f_imagefilledellipse(a0, a1, a2, a3, a4, a5)); +} +Variant ei_pcntl_wstopsig(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_wstopsig); + return (f_pcntl_wstopsig(a0)); +} +Variant ei_get_defined_vars(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_defined_vars); + return (f_get_defined_vars()); +} +Variant ei_memory_get_usage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(memory_get_usage); + int count = params.size(); + if (count <= 0) return (f_memory_get_usage()); + return (f_memory_get_usage(a0)); +} +Variant ei_intval(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(intval); + int count = params.size(); + if (count <= 1) return (f_intval(a0)); + return (f_intval(a0, a1)); +} +Variant ei_pagelet_server_task_status(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pagelet_server_task_status); + return (f_pagelet_server_task_status(a0)); +} +Variant ei_iconv_set_encoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iconv_set_encoding); + return (f_iconv_set_encoding(a0, a1)); +} +Variant ei_magickmattefloodfillimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickmattefloodfillimage); + return (f_magickmattefloodfillimage(a0, a1, a2, a3, a4, a5)); +} +Variant ei_mailparse_msg_get_part(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_msg_get_part); + return (f_mailparse_msg_get_part(a0, a1)); +} +Variant ei_mb_check_encoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_check_encoding); + int count = params.size(); + if (count <= 0) return (f_mb_check_encoding()); + if (count == 1) return (f_mb_check_encoding(a0)); + return (f_mb_check_encoding(a0, a1)); +} +Variant ei_ldap_get_dn(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_get_dn); + return (f_ldap_get_dn(a0, a1)); +} +Variant ei_newpixeliterator(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(newpixeliterator); + return (f_newpixeliterator(a0)); +} +Variant ei_magicksetimagefilename(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagefilename); + int count = params.size(); + if (count <= 1) return (f_magicksetimagefilename(a0)); + return (f_magicksetimagefilename(a0, a1)); +} +Variant ei_call_user_func(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(call_user_func); + int count = params.size(); + if (count <= 1) return (f_call_user_func(count, a0)); + return (f_call_user_func(count, a0,vargs)); +} +Variant ei_mysql_list_tables(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_list_tables); + int count = params.size(); + if (count <= 1) return (f_mysql_list_tables(a0)); + return (f_mysql_list_tables(a0, a1)); +} +Variant ei_magickgetinterlacescheme(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetinterlacescheme); + return (f_magickgetinterlacescheme(a0)); +} +Variant ei_ltrim(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ltrim); + int count = params.size(); + if (count <= 1) return (f_ltrim(a0)); + return (f_ltrim(a0, a1)); +} +Variant ei_magicktextureimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicktextureimage); + return (f_magicktextureimage(a0, a1)); +} +Variant ei_mb_ereg_match(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_ereg_match); + int count = params.size(); + if (count <= 2) return (f_mb_ereg_match(a0, a1)); + return (f_mb_ereg_match(a0, a1, a2)); +} +Variant ei_mt_srand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mt_srand); + int count = params.size(); + if (count <= 0) return (f_mt_srand(), null); + return (f_mt_srand(a0), null); +} +Variant ei_imagecolorallocate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorallocate); + return (f_imagecolorallocate(a0, a1, a2, a3)); +} +Variant ei_define_syslog_variables(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(define_syslog_variables); + return (f_define_syslog_variables(), null); +} +Variant ei_mcrypt_enc_get_modes_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_enc_get_modes_name); + return (f_mcrypt_enc_get_modes_name(a0)); +} +Variant ei_array_flip(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_flip); + return (f_array_flip(a0)); +} +Variant ei_count(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(count); + int count = params.size(); + if (count <= 1) return (f_count(a0)); + return (f_count(a0, a1)); +} +Variant ei_lcg_value(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(lcg_value); + return (f_lcg_value()); +} +Variant ei_php_logo_guid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(php_logo_guid); + return (f_php_logo_guid()); +} +Variant ei_time(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(time); + return (f_time()); +} +Variant ei_magickcoalesceimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcoalesceimages); + return (f_magickcoalesceimages(a0)); +} +Variant ei_pixelgetquantumcolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetquantumcolor); + return (f_pixelgetquantumcolor(a0)); +} +Variant ei_openssl_private_encrypt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_private_encrypt); + int count = params.size(); + if (count <= 3) return (f_openssl_private_encrypt(a0, ref(a1), a2)); + return (f_openssl_private_encrypt(a0, ref(a1), a2, a3)); +} +Variant ei_xhprof_enable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xhprof_enable); + int count = params.size(); + if (count <= 1) return (f_xhprof_enable(a0), null); + return (f_xhprof_enable(a0, a1), null); +} +Variant ei_xmlwriter_start_document(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_document); + int count = params.size(); + if (count <= 1) return (f_xmlwriter_start_document(a0)); + if (count == 2) return (f_xmlwriter_start_document(a0, a1)); + if (count == 3) return (f_xmlwriter_start_document(a0, a1, a2)); + return (f_xmlwriter_start_document(a0, a1, a2, a3)); +} +Variant ei_libxml_clear_errors(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(libxml_clear_errors); + return (f_libxml_clear_errors(), null); +} +Variant ei_magicknormalizeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicknormalizeimage); + return (f_magicknormalizeimage(a0)); +} +Variant ei_magickgetformat(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetformat); + return (f_magickgetformat(a0)); +} +Variant ei_hphp_get_class_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_get_class_info); + return (f_hphp_get_class_info(a0)); +} +Variant ei_mailparse_msg_get_part_data(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_msg_get_part_data); + return (f_mailparse_msg_get_part_data(a0)); +} +Variant ei_openssl_csr_new(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_csr_new); + int count = params.size(); + if (count <= 2) return (f_openssl_csr_new(a0, ref(a1))); + if (count == 3) return (f_openssl_csr_new(a0, ref(a1), a2)); + return (f_openssl_csr_new(a0, ref(a1), a2, a3)); +} +Variant ei_xbox_task_start(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xbox_task_start); + return (f_xbox_task_start(a0)); +} +Variant ei_getcwd(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getcwd); + return (f_getcwd()); +} +Variant ei_posix_getrlimit(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getrlimit); + return (f_posix_getrlimit()); +} +Variant ei_mb_get_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_get_info); + int count = params.size(); + if (count <= 0) return (f_mb_get_info()); + return (f_mb_get_info(a0)); +} +Variant ei_newpixelwands(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(newpixelwands); + return (f_newpixelwands(a0)); +} +Variant ei_fputcsv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fputcsv); + int count = params.size(); + if (count <= 2) return (f_fputcsv(a0, a1)); + if (count == 3) return (f_fputcsv(a0, a1, a2)); + return (f_fputcsv(a0, a1, a2, a3)); +} +Variant ei_stream_bucket_prepend(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_bucket_prepend); + return (f_stream_bucket_prepend(a0, a1), null); +} +Variant ei_apache_get_scoreboard(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_get_scoreboard); + return (f_apache_get_scoreboard()); +} +Variant ei_sprintf(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(sprintf); + int count = params.size(); + if (count <= 1) return (f_sprintf(count, a0)); + return (f_sprintf(count, a0,vargs)); +} +Variant ei_ldap_err2str(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_err2str); + return (f_ldap_err2str(a0)); +} +Variant ei_xmlwriter_end_attribute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_end_attribute); + return (f_xmlwriter_end_attribute(a0)); +} +Variant ei_imagecharup(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecharup); + return (f_imagecharup(a0, a1, a2, a3, a4, a5)); +} +Variant ei_fflush(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fflush); + return (f_fflush(a0)); +} +Variant ei_magickwaveimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickwaveimage); + return (f_magickwaveimage(a0, a1, a2)); +} +Variant ei_imagepsfreefont(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagepsfreefont); + return (f_imagepsfreefont(a0)); +} +Variant ei_magickgetsamplingfactors(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetsamplingfactors); + return (f_magickgetsamplingfactors(a0)); +} +Variant ei_mt_rand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mt_rand); + int count = params.size(); + if (count <= 0) return (f_mt_rand()); + if (count == 1) return (f_mt_rand(a0)); + return (f_mt_rand(a0, a1)); +} +Variant ei_magickflopimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickflopimage); + return (f_magickflopimage(a0)); +} +Variant ei_getenv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getenv); + return (f_getenv(a0)); +} +Variant ei_register_cleanup_function(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(register_cleanup_function); + int count = params.size(); + if (count <= 1) return (f_register_cleanup_function(count, a0), null); + return (f_register_cleanup_function(count, a0,vargs), null); +} +Variant ei_is_dir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_dir); + return (f_is_dir(a0)); +} +Variant ei_get_defined_functions(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_defined_functions); + return (f_get_defined_functions()); +} +Variant ei_stream_set_timeout(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_set_timeout); + int count = params.size(); + if (count <= 2) return (f_stream_set_timeout(a0, a1)); + return (f_stream_set_timeout(a0, a1, a2)); +} +Variant ei_pixelsetblack(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetblack); + return (f_pixelsetblack(a0, a1), null); +} +Variant ei_magickenhanceimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickenhanceimage); + return (f_magickenhanceimage(a0)); +} +Variant ei_magickgetcharwidth(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetcharwidth); + int count = params.size(); + if (count <= 3) return (f_magickgetcharwidth(a0, a1, a2)); + return (f_magickgetcharwidth(a0, a1, a2, a3)); +} +Variant ei_magickshearimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickshearimage); + return (f_magickshearimage(a0, a1, a2, a3)); +} +Variant ei_stream_socket_enable_crypto(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_socket_enable_crypto); + int count = params.size(); + if (count <= 2) return (f_stream_socket_enable_crypto(a0, a1)); + if (count == 3) return (f_stream_socket_enable_crypto(a0, a1, a2)); + return (f_stream_socket_enable_crypto(a0, a1, a2, a3)); +} +Variant ei_stream_socket_server(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_socket_server); + int count = params.size(); + if (count <= 1) return (f_stream_socket_server(a0)); + if (count == 2) return (f_stream_socket_server(a0, ref(a1))); + if (count == 3) return (f_stream_socket_server(a0, ref(a1), ref(a2))); + if (count == 4) return (f_stream_socket_server(a0, ref(a1), ref(a2), a3)); + return (f_stream_socket_server(a0, ref(a1), ref(a2), a3, a4)); +} +Variant ei_apd_set_pprof_trace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apd_set_pprof_trace); + int count = params.size(); + if (count <= 0) return (f_apd_set_pprof_trace()); + if (count == 1) return (f_apd_set_pprof_trace(a0)); + return (f_apd_set_pprof_trace(a0, a1)); +} +Variant ei_sort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sort); + int count = params.size(); + if (count <= 1) return (f_sort(ref(a0))); + if (count == 2) return (f_sort(ref(a0), a1)); + return (f_sort(ref(a0), a1, a2)); +} +Variant ei_oci_num_rows(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_num_rows); + return (f_oci_num_rows(a0)); +} +Variant ei_ini_set(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ini_set); + return (f_ini_set(a0, a1)); +} +Variant ei_drawgetfont(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetfont); + return (f_drawgetfont(a0)); +} +Variant ei_readdir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(readdir); + return (f_readdir(a0)); +} +Variant ei_mysql_close(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_close); + int count = params.size(); + if (count <= 0) return (f_mysql_close()); + return (f_mysql_close(a0)); +} +Variant ei_ldap_8859_to_t61(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_8859_to_t61); + return (f_ldap_8859_to_t61(a0)); +} +Variant ei_magickblurimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickblurimage); + int count = params.size(); + if (count <= 3) return (f_magickblurimage(a0, a1, a2)); + return (f_magickblurimage(a0, a1, a2, a3)); +} +Variant ei_magickreducenoiseimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickreducenoiseimage); + return (f_magickreducenoiseimage(a0, a1)); +} +Variant ei_magicksetimagerenderingintent(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagerenderingintent); + return (f_magicksetimagerenderingintent(a0, a1)); +} +Variant ei_magicktintimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicktintimage); + return (f_magicktintimage(a0, a1, a2)); +} +Variant ei_oci_fetch_all(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_fetch_all); + int count = params.size(); + if (count <= 2) return (f_oci_fetch_all(a0, ref(a1))); + if (count == 3) return (f_oci_fetch_all(a0, ref(a1), a2)); + if (count == 4) return (f_oci_fetch_all(a0, ref(a1), a2, a3)); + return (f_oci_fetch_all(a0, ref(a1), a2, a3, a4)); +} +Variant ei_rawurldecode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rawurldecode); + return (f_rawurldecode(a0)); +} +Variant ei_xmlwriter_start_element_ns(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_element_ns); + return (f_xmlwriter_start_element_ns(a0, a1, a2, a3)); +} +Variant ei_strftime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strftime); + int count = params.size(); + if (count <= 1) return (f_strftime(a0)); + return (f_strftime(a0, a1)); +} +Variant ei_imagecolorstotal(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorstotal); + return (f_imagecolorstotal(a0)); +} +Variant ei_apc_bin_dumpfile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_bin_dumpfile); + int count = params.size(); + if (count <= 3) return (f_apc_bin_dumpfile(a0, a1, a2)); + if (count == 4) return (f_apc_bin_dumpfile(a0, a1, a2, a3)); + return (f_apc_bin_dumpfile(a0, a1, a2, a3, a4)); +} +Variant ei_xml_parse_into_struct(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_parse_into_struct); + int count = params.size(); + if (count <= 3) return (f_xml_parse_into_struct(a0, a1, ref(a2))); + return (f_xml_parse_into_struct(a0, a1, ref(a2), ref(a3))); +} +Variant ei_icu_transliterate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(icu_transliterate); + return (f_icu_transliterate(a0, a1)); +} +Variant ei_mb_eregi_replace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_eregi_replace); + int count = params.size(); + if (count <= 3) return (f_mb_eregi_replace(a0, a1, a2)); + return (f_mb_eregi_replace(a0, a1, a2, a3)); +} +Variant ei_array_unshift(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_unshift); + int count = params.size(); + if (count <= 2) return (f_array_unshift(count, ref(a0), a1)); + return (f_array_unshift(count, ref(a0), a1,vargs)); +} +Variant ei_oci_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_error); + int count = params.size(); + if (count <= 0) return (f_oci_error()); + return (f_oci_error(a0)); +} +Variant ei_stat(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stat); + return (f_stat(a0)); +} +Variant ei_posix_getpid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getpid); + return (f_posix_getpid()); +} +Variant ei_get_current_user(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_current_user); + return (f_get_current_user()); +} +Variant ei_filesize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(filesize); + return (f_filesize(a0)); +} +Variant ei_round(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(round); + int count = params.size(); + if (count <= 1) return (f_round(a0)); + return (f_round(a0, a1)); +} +Variant ei_sqrt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sqrt); + return (f_sqrt(a0)); +} +Variant ei_ldap_close(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_close); + return (f_ldap_close(a0)); +} +Variant ei_mcrypt_enc_get_algorithms_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_enc_get_algorithms_name); + return (f_mcrypt_enc_get_algorithms_name(a0)); +} +Variant ei_extension_loaded(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(extension_loaded); + return (f_extension_loaded(a0)); +} +Variant ei_fprintf(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(fprintf); + int count = params.size(); + if (count <= 2) return (f_fprintf(count, a0, a1)); + return (f_fprintf(count, a0, a1,vargs)); +} +Variant ei_mb_detect_order(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_detect_order); + int count = params.size(); + if (count <= 0) return (f_mb_detect_order()); + return (f_mb_detect_order(a0)); +} +Variant ei_get_magic_quotes_runtime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_magic_quotes_runtime); + return (f_get_magic_quotes_runtime()); +} +Variant ei_magickmapimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickmapimage); + return (f_magickmapimage(a0, a1, a2)); +} +Variant ei_pixelsetopacityquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetopacityquantum); + return (f_pixelsetopacityquantum(a0, a1), null); +} +Variant ei_ctype_space(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ctype_space); + return (f_ctype_space(a0)); +} +Variant ei_mcrypt_generic_init(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_generic_init); + return (f_mcrypt_generic_init(a0, a1, a2)); +} +Variant ei_quoted_printable_decode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(quoted_printable_decode); + return (f_quoted_printable_decode(a0)); +} +Variant ei_destroymagickwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(destroymagickwand); + return (f_destroymagickwand(a0), null); +} +Variant ei_imagerectangle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagerectangle); + return (f_imagerectangle(a0, a1, a2, a3, a4, a5)); +} +Variant ei_get_cfg_var(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_cfg_var); + return (f_get_cfg_var(a0)); +} +Variant ei_pixelgetalphaquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetalphaquantum); + return (f_pixelgetalphaquantum(a0)); +} +Variant ei_magickgetimageblob(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageblob); + return (f_magickgetimageblob(a0)); +} +Variant ei_imagepsextendfont(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagepsextendfont); + return (f_imagepsextendfont(a0, a1)); +} +Variant ei_stream_get_filters(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_get_filters); + return (f_stream_get_filters()); +} +Variant ei_magickqueryfontmetrics(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickqueryfontmetrics); + int count = params.size(); + if (count <= 3) return (f_magickqueryfontmetrics(a0, a1, a2)); + return (f_magickqueryfontmetrics(a0, a1, a2, a3)); +} +Variant ei_ispixeliterator(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ispixeliterator); + return (f_ispixeliterator(a0)); +} +Variant ei_getdate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getdate); + int count = params.size(); + if (count <= 0) return (f_getdate()); + return (f_getdate(a0)); +} +Variant ei_imagefilledarc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + Variant a8; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a8 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagefilledarc); + return (f_imagefilledarc(a0, a1, a2, a3, a4, a5, a6, a7, a8)); +} +Variant ei_oci_server_version(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_server_version); + return (f_oci_server_version(a0)); +} +Variant ei_xmlwriter_write_attribute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_attribute); + return (f_xmlwriter_write_attribute(a0, a1, a2)); +} +Variant ei_imagearc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagearc); + return (f_imagearc(a0, a1, a2, a3, a4, a5, a6, a7)); +} +Variant ei_drawgetgravity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetgravity); + return (f_drawgetgravity(a0)); +} +Variant ei_magickreadimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickreadimages); + return (f_magickreadimages(a0, a1)); +} +Variant ei_imagecreatefromgd2(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatefromgd2); + return (f_imagecreatefromgd2(a0)); +} +Variant ei_stream_socket_shutdown(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_socket_shutdown); + return (f_stream_socket_shutdown(a0, a1)); +} +Variant ei_connection_status(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(connection_status); + return (f_connection_status()); +} +Variant ei_pixelresetiterator(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelresetiterator); + return (f_pixelresetiterator(a0), null); +} +Variant ei_msg_send(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(msg_send); + int count = params.size(); + if (count <= 3) return (f_msg_send(a0, a1, a2)); + if (count == 4) return (f_msg_send(a0, a1, a2, a3)); + if (count == 5) return (f_msg_send(a0, a1, a2, a3, a4)); + return (f_msg_send(a0, a1, a2, a3, a4, ref(a5))); +} +Variant ei_getmygid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getmygid); + return (f_getmygid()); +} +Variant ei_array_udiff_uassoc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_udiff_uassoc); + int count = params.size(); + if (count <= 4) return (f_array_udiff_uassoc(count, a0, a1, a2, a3)); + return (f_array_udiff_uassoc(count, a0, a1, a2, a3,vargs)); +} +Variant ei_xml_set_character_data_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_set_character_data_handler); + return (f_xml_set_character_data_handler(a0, a1)); +} +Variant ei_array_diff_uassoc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(array_diff_uassoc); + int count = params.size(); + if (count <= 3) return (f_array_diff_uassoc(count, a0, a1, a2)); + return (f_array_diff_uassoc(count, a0, a1, a2,vargs)); +} +Variant ei_strptime(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strptime); + return (f_strptime(a0, a1)); +} +Variant ei_pcntl_waitpid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_waitpid); + int count = params.size(); + if (count <= 2) return (f_pcntl_waitpid(a0, ref(a1))); + return (f_pcntl_waitpid(a0, ref(a1), a2)); +} +Variant ei_gd_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gd_info); + return (f_gd_info()); +} +Variant ei_stream_get_transports(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_get_transports); + return (f_stream_get_transports()); +} +Variant ei_drawsetstrokepatternurl(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokepatternurl); + return (f_drawsetstrokepatternurl(a0, a1)); +} +Variant ei_drawsetfillrule(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfillrule); + return (f_drawsetfillrule(a0, a1), null); +} +Variant ei_acosh(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(acosh); + return (f_acosh(a0)); +} +Variant ei_ldap_add(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_add); + return (f_ldap_add(a0, a1, a2)); +} +Variant ei_posix_getsid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getsid); + return (f_posix_getsid(a0)); +} +Variant ei_posix_getlogin(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getlogin); + return (f_posix_getlogin()); +} +Variant ei_socket_create_pair(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_create_pair); + return (f_socket_create_pair(a0, a1, a2, ref(a3))); +} +Variant ei_imagecreate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreate); + return (f_imagecreate(a0, a1)); +} +Variant ei_imagegd2(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagegd2); + int count = params.size(); + if (count <= 1) return (f_imagegd2(a0)); + if (count == 2) return (f_imagegd2(a0, a1)); + if (count == 3) return (f_imagegd2(a0, a1, a2)); + return (f_imagegd2(a0, a1, a2, a3)); +} +Variant ei_openssl_x509_check_private_key(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_x509_check_private_key); + return (f_openssl_x509_check_private_key(a0, a1)); +} +Variant ei_oci_num_fields(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_num_fields); + return (f_oci_num_fields(a0)); +} +Variant ei_shm_put_var(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(shm_put_var); + return (f_shm_put_var(a0, a1, a2)); +} +Variant ei_debug_print_backtrace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(debug_print_backtrace); + return (f_debug_print_backtrace(), null); +} +Variant ei_stream_set_blocking(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_set_blocking); + return (f_stream_set_blocking(a0, a1)); +} +Variant ei_fb_get_derived_classes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_get_derived_classes); + return (f_fb_get_derived_classes(a0, a1)); +} +Variant ei_xml_parser_get_option(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_parser_get_option); + return (f_xml_parser_get_option(a0, a1)); +} +Variant ei_ezmlm_hash(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ezmlm_hash); + return (f_ezmlm_hash(a0)); +} +Variant ei_array_search(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_search); + int count = params.size(); + if (count <= 2) return (f_array_search(a0, a1)); + return (f_array_search(a0, a1, a2)); +} +Variant ei_html_profile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(html_profile); + return (f_html_profile(a0)); +} +Variant ei_is_int(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_int); + return (f_is_int(a0)); +} +Variant ei_dangling_server_proxy_new_request(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(dangling_server_proxy_new_request); + return (f_dangling_server_proxy_new_request(a0)); +} +Variant ei_fb_set_opcode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_set_opcode); + return (f_fb_set_opcode(a0, a1), null); +} +Variant ei_xmlwriter_end_dtd_entity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_end_dtd_entity); + return (f_xmlwriter_end_dtd_entity(a0)); +} +Variant ei_fbml_get_children_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_get_children_11); + return (f_fbml_get_children_11(a0)); +} +Variant ei_trim(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(trim); + int count = params.size(); + if (count <= 1) return (f_trim(a0)); + return (f_trim(a0, a1)); +} +Variant ei_connection_timeout(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(connection_timeout); + return (f_connection_timeout()); +} +Variant ei_magickprofileimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickprofileimage); + int count = params.size(); + if (count <= 2) return (f_magickprofileimage(a0, a1)); + return (f_magickprofileimage(a0, a1, a2)); +} +Variant ei_drawpathclose(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathclose); + return (f_drawpathclose(a0), null); +} +Variant ei_pixelgetindex(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetindex); + return (f_pixelgetindex(a0)); +} +Variant ei_mysql_data_seek(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_data_seek); + return (f_mysql_data_seek(a0, a1)); +} +Variant ei_hebrevc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hebrevc); + int count = params.size(); + if (count <= 1) return (f_hebrevc(a0)); + return (f_hebrevc(a0, a1)); +} +Variant ei_get_meta_tags(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_meta_tags); + int count = params.size(); + if (count <= 1) return (f_get_meta_tags(a0)); + return (f_get_meta_tags(a0, a1)); +} +Variant ei_magicknextimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicknextimage); + return (f_magicknextimage(a0)); +} +Variant ei_mysql_stat(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_stat); + int count = params.size(); + if (count <= 0) return (f_mysql_stat()); + return (f_mysql_stat(a0)); +} +Variant ei_mysql_create_db(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_create_db); + int count = params.size(); + if (count <= 1) return (f_mysql_create_db(a0)); + return (f_mysql_create_db(a0, a1)); +} +Variant ei_get_object_vars(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_object_vars); + return (f_get_object_vars(a0)); +} +Variant ei_msg_receive(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(msg_receive); + int count = params.size(); + if (count <= 5) return (f_msg_receive(a0, a1, ref(a2), a3, ref(a4))); + if (count == 6) return (f_msg_receive(a0, a1, ref(a2), a3, ref(a4), a5)); + if (count == 7) return (f_msg_receive(a0, a1, ref(a2), a3, ref(a4), a5, a6)); + return (f_msg_receive(a0, a1, ref(a2), a3, ref(a4), a5, a6, ref(a7))); +} +Variant ei_is_integer(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_integer); + return (f_is_integer(a0)); +} +Variant ei_oci_set_prefetch(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_set_prefetch); + return (f_oci_set_prefetch(a0, a1)); +} +Variant ei_imagecreatefromgif(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatefromgif); + return (f_imagecreatefromgif(a0)); +} +Variant ei_posix_getuid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getuid); + return (f_posix_getuid()); +} +Variant ei_mb_send_mail(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_send_mail); + int count = params.size(); + if (count <= 3) return (f_mb_send_mail(a0, a1, a2)); + if (count == 4) return (f_mb_send_mail(a0, a1, a2, a3)); + return (f_mb_send_mail(a0, a1, a2, a3, a4)); +} +Variant ei_register_postsend_function(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(register_postsend_function); + int count = params.size(); + if (count <= 1) return (f_register_postsend_function(count, a0), null); + return (f_register_postsend_function(count, a0,vargs), null); +} +Variant ei_long2ip(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(long2ip); + return (f_long2ip(a0)); +} +Variant ei_getrusage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getrusage); + int count = params.size(); + if (count <= 0) return (f_getrusage()); + return (f_getrusage(a0)); +} +Variant ei_evhttp_set_cache(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(evhttp_set_cache); + int count = params.size(); + if (count <= 2) return (f_evhttp_set_cache(a0, a1), null); + return (f_evhttp_set_cache(a0, a1, a2), null); +} +Variant ei_magickoilpaintimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickoilpaintimage); + return (f_magickoilpaintimage(a0, a1)); +} +Variant ei_strripos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strripos); + int count = params.size(); + if (count <= 2) return (f_strripos(a0, a1)); + return (f_strripos(a0, a1, a2)); +} +Variant ei_magickgetfilename(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetfilename); + return (f_magickgetfilename(a0)); +} +Variant ei_magicksetimagecolormapcolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagecolormapcolor); + return (f_magicksetimagecolormapcolor(a0, a1, a2)); +} +Variant ei_magicksetimagegamma(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagegamma); + return (f_magicksetimagegamma(a0, a1)); +} +Variant ei_mysql_pconnect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_pconnect); + int count = params.size(); + if (count <= 0) return (f_mysql_pconnect()); + if (count == 1) return (f_mysql_pconnect(a0)); + if (count == 2) return (f_mysql_pconnect(a0, a1)); + if (count == 3) return (f_mysql_pconnect(a0, a1, a2)); + if (count == 4) return (f_mysql_pconnect(a0, a1, a2, a3)); + if (count == 5) return (f_mysql_pconnect(a0, a1, a2, a3, a4)); + return (f_mysql_pconnect(a0, a1, a2, a3, a4, a5)); +} +Variant ei_stripos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stripos); + int count = params.size(); + if (count <= 2) return (f_stripos(a0, a1)); + return (f_stripos(a0, a1, a2)); +} +Variant ei_http_build_query(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(http_build_query); + int count = params.size(); + if (count <= 1) return (f_http_build_query(a0)); + if (count == 2) return (f_http_build_query(a0, a1)); + return (f_http_build_query(a0, a1, a2)); +} +Variant ei_apc_add(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_add); + int count = params.size(); + if (count <= 2) return (f_apc_add(a0, a1)); + if (count == 3) return (f_apc_add(a0, a1, a2)); + return (f_apc_add(a0, a1, a2, a3)); +} +Variant ei_iconv_strlen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iconv_strlen); + int count = params.size(); + if (count <= 1) return (f_iconv_strlen(a0)); + return (f_iconv_strlen(a0, a1)); +} +Variant ei_vsprintf(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(vsprintf); + return (f_vsprintf(a0, a1)); +} +Variant ei_fbml_sanitize_js_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_sanitize_js_11); + return (f_fbml_sanitize_js_11(a0, a1, a2)); +} +Variant ei_mailparse_msg_extract_part_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_msg_extract_part_file); + int count = params.size(); + if (count <= 2) return (f_mailparse_msg_extract_part_file(a0, a1)); + return (f_mailparse_msg_extract_part_file(a0, a1, a2)); +} +Variant ei_imageistruecolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imageistruecolor); + return (f_imageistruecolor(a0)); +} +Variant ei_is_nan(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_nan); + return (f_is_nan(a0)); +} +Variant ei_imagegif(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagegif); + int count = params.size(); + if (count <= 1) return (f_imagegif(a0)); + return (f_imagegif(a0, a1)); +} +Variant ei_fbml_batch_precache_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_batch_precache_11); + return (f_fbml_batch_precache_11(a0)); +} +Variant ei_eregi_replace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(eregi_replace); + return (f_eregi_replace(a0, a1, a2)); +} +Variant ei_magickgetimageiterations(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimageiterations); + return (f_magickgetimageiterations(a0)); +} +Variant ei_register_tick_function(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append((*it)->eval(env)); + } + FUNCTION_INJECTION(register_tick_function); + int count = params.size(); + if (count <= 1) return (f_register_tick_function(count, a0)); + return (f_register_tick_function(count, a0,vargs)); +} +Variant ei_pixelsetblackquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetblackquantum); + return (f_pixelsetblackquantum(a0, a1), null); +} +Variant ei_jpeg2wbmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(jpeg2wbmp); + return (f_jpeg2wbmp(a0, a1, a2, a3, a4)); +} +Variant ei_mcrypt_get_iv_size(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_get_iv_size); + return (f_mcrypt_get_iv_size(a0, a1)); +} +Variant ei_mysql_fetch_array(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_fetch_array); + int count = params.size(); + if (count <= 1) return (f_mysql_fetch_array(a0)); + return (f_mysql_fetch_array(a0, a1)); +} +Variant ei_magickpreviousimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickpreviousimage); + return (f_magickpreviousimage(a0)); +} +Variant ei_magickborderimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickborderimage); + return (f_magickborderimage(a0, a1, a2, a3)); +} +Variant ei_mcrypt_module_is_block_mode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_module_is_block_mode); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_is_block_mode(a0)); + return (f_mcrypt_module_is_block_mode(a0, a1)); +} +Variant ei_mb_substr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_substr); + int count = params.size(); + if (count <= 2) return (f_mb_substr(a0, a1)); + if (count == 3) return (f_mb_substr(a0, a1, a2)); + return (f_mb_substr(a0, a1, a2, a3)); +} +Variant ei_get_defined_constants(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_defined_constants); + int count = params.size(); + if (count <= 0) return (f_get_defined_constants()); + return (f_get_defined_constants(a0)); +} +Variant ei_mcrypt_enc_is_block_mode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_enc_is_block_mode); + return (f_mcrypt_enc_is_block_mode(a0)); +} +Variant ei_mailparse_stream_encode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mailparse_stream_encode); + return (f_mailparse_stream_encode(a0, a1, a2)); +} +Variant ei_drawsetstrokedashoffset(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokedashoffset); + return (f_drawsetstrokedashoffset(a0, a1), null); +} +Variant ei_php_ini_scanned_files(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(php_ini_scanned_files); + return (f_php_ini_scanned_files()); +} +Variant ei_disk_free_space(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(disk_free_space); + return (f_disk_free_space(a0)); +} +Variant ei_pixelsetyellowquantum(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetyellowquantum); + return (f_pixelsetyellowquantum(a0, a1), null); +} +Variant ei_openssl_public_decrypt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_public_decrypt); + int count = params.size(); + if (count <= 3) return (f_openssl_public_decrypt(a0, ref(a1), a2)); + return (f_openssl_public_decrypt(a0, ref(a1), a2, a3)); +} +Variant ei_convert_uuencode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(convert_uuencode); + return (f_convert_uuencode(a0)); +} +Variant ei_magickequalizeimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickequalizeimage); + return (f_magickequalizeimage(a0)); +} +Variant ei_mysql_field_len(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_field_len); + int count = params.size(); + if (count <= 1) return (f_mysql_field_len(a0)); + return (f_mysql_field_len(a0, a1)); +} +Variant ei_drawsetclipunits(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetclipunits); + return (f_drawsetclipunits(a0, a1), null); +} +Variant ei_mdecrypt_generic(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mdecrypt_generic); + return (f_mdecrypt_generic(a0, a1)); +} +Variant ei_fb_config_coredump(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_config_coredump); + return (f_fb_config_coredump(a0, a1), null); +} +Variant ei_getprotobyname(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getprotobyname); + return (f_getprotobyname(a0)); +} +Variant ei_xmlwriter_start_pi(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_pi); + return (f_xmlwriter_start_pi(a0, a1)); +} +Variant ei_mysql_field_type(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_field_type); + int count = params.size(); + if (count <= 1) return (f_mysql_field_type(a0)); + return (f_mysql_field_type(a0, a1)); +} +Variant ei_apc_cas(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_cas); + int count = params.size(); + if (count <= 3) return (f_apc_cas(a0, a1, a2)); + return (f_apc_cas(a0, a1, a2, a3)); +} +Variant ei_getopt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getopt); + int count = params.size(); + if (count <= 1) return (f_getopt(a0)); + return (f_getopt(a0, a1)); +} +Variant ei_clearpixelwand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(clearpixelwand); + return (f_clearpixelwand(a0), null); +} +Variant ei_drawsetgravity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetgravity); + return (f_drawsetgravity(a0, a1), null); +} +Variant ei_magickgetimagecompressionquality(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagecompressionquality); + return (f_magickgetimagecompressionquality(a0)); +} +Variant ei_magickquantizeimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickquantizeimages); + return (f_magickquantizeimages(a0, a1, a2, a3, a4, a5)); +} +Variant ei_mysql_insert_id(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_insert_id); + int count = params.size(); + if (count <= 0) return (f_mysql_insert_id()); + return (f_mysql_insert_id(a0)); +} +Variant ei_hphp_thread_set_warmup_enabled(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_thread_set_warmup_enabled); + return (f_hphp_thread_set_warmup_enabled(), null); +} +Variant ei_stream_context_set_param(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_context_set_param); + return (f_stream_context_set_param(a0, a1)); +} +Variant ei_drawpathlinetohorizontalabsolute(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathlinetohorizontalabsolute); + return (f_drawpathlinetohorizontalabsolute(a0, a1), null); +} +Variant ei_openssl_csr_export(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_csr_export); + int count = params.size(); + if (count <= 2) return (f_openssl_csr_export(a0, ref(a1))); + return (f_openssl_csr_export(a0, ref(a1), a2)); +} +Variant ei_socket_connect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_connect); + int count = params.size(); + if (count <= 2) return (f_socket_connect(a0, a1)); + return (f_socket_connect(a0, a1, a2)); +} +Variant ei_stripslashes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stripslashes); + return (f_stripslashes(a0)); +} +Variant ei_magickhaspreviousimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickhaspreviousimage); + return (f_magickhaspreviousimage(a0)); +} +Variant ei_drawgetstrokecolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgetstrokecolor); + return (f_drawgetstrokecolor(a0)); +} +Variant ei_imagecreatefromwbmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatefromwbmp); + return (f_imagecreatefromwbmp(a0)); +} +Variant ei_str_repeat(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(str_repeat); + return (f_str_repeat(a0, a1)); +} +Variant ei_stream_resolve_include_path(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_resolve_include_path); + int count = params.size(); + if (count <= 1) return (f_stream_resolve_include_path(a0)); + return (f_stream_resolve_include_path(a0, a1)); +} +Variant ei_ldap_read(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_read); + int count = params.size(); + if (count <= 3) return (f_ldap_read(a0, a1, a2)); + if (count == 4) return (f_ldap_read(a0, a1, a2, a3)); + if (count == 5) return (f_ldap_read(a0, a1, a2, a3, a4)); + if (count == 6) return (f_ldap_read(a0, a1, a2, a3, a4, a5)); + if (count == 7) return (f_ldap_read(a0, a1, a2, a3, a4, a5, a6)); + return (f_ldap_read(a0, a1, a2, a3, a4, a5, a6, a7)); +} +Variant ei_apc_dec(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_dec); + int count = params.size(); + if (count <= 1) return (f_apc_dec(a0)); + if (count == 2) return (f_apc_dec(a0, a1)); + if (count == 3) return (f_apc_dec(a0, a1, ref(a2))); + return (f_apc_dec(a0, a1, ref(a2), a3)); +} +Variant ei_posix_get_last_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_get_last_error); + return (f_posix_get_last_error()); +} +Variant ei_iptcparse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iptcparse); + return (f_iptcparse(a0)); +} +Variant ei_curl_setopt_array(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_setopt_array); + return (f_curl_setopt_array(a0, a1)); +} +Variant ei_socket_recvfrom(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a5 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_recvfrom); + int count = params.size(); + if (count <= 5) return (f_socket_recvfrom(a0, ref(a1), a2, a3, ref(a4))); + return (f_socket_recvfrom(a0, ref(a1), a2, a3, ref(a4), ref(a5))); +} +Variant ei_imagepstext(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + Variant a8; + Variant a9; + Variant a10; + Variant a11; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a8 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a9 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a10 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a11 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagepstext); + int count = params.size(); + if (count <= 8) return (f_imagepstext(a0, a1, a2, a3, a4, a5, a6, a7)); + if (count == 9) return (f_imagepstext(a0, a1, a2, a3, a4, a5, a6, a7, a8)); + if (count == 10) return (f_imagepstext(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); + if (count == 11) return (f_imagepstext(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)); + return (f_imagepstext(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); +} +Variant ei_mb_encode_mimeheader(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_encode_mimeheader); + int count = params.size(); + if (count <= 1) return (f_mb_encode_mimeheader(a0)); + if (count == 2) return (f_mb_encode_mimeheader(a0, a1)); + if (count == 3) return (f_mb_encode_mimeheader(a0, a1, a2)); + if (count == 4) return (f_mb_encode_mimeheader(a0, a1, a2, a3)); + return (f_mb_encode_mimeheader(a0, a1, a2, a3, a4)); +} +Variant ei_socket_getsockname(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_getsockname); + int count = params.size(); + if (count <= 2) return (f_socket_getsockname(a0, ref(a1))); + return (f_socket_getsockname(a0, ref(a1), ref(a2))); +} +Variant ei_imagecreatefromstring(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatefromstring); + return (f_imagecreatefromstring(a0)); +} +Variant ei_vfprintf(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(vfprintf); + return (f_vfprintf(a0, a1, a2)); +} +Variant ei_magickcompareimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickcompareimages); + int count = params.size(); + if (count <= 3) return (f_magickcompareimages(a0, a1, a2)); + return (f_magickcompareimages(a0, a1, a2, a3)); +} +Variant ei_fscanf(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + Array vargs; + for (; it != params.end(); ++it) { + vargs.append(ref((*it)->refval(env))); + } + FUNCTION_INJECTION(fscanf); + int count = params.size(); + if (count <= 2) return (f_fscanf(count, a0, a1)); + return (f_fscanf(count, a0, a1,vargs)); +} +Variant ei_stristr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stristr); + return (f_stristr(a0, a1)); +} +Variant ei_xml_parser_set_option(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xml_parser_set_option); + return (f_xml_parser_set_option(a0, a1, a2)); +} +Variant ei_magicksetimageinterlacescheme(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimageinterlacescheme); + return (f_magicksetimageinterlacescheme(a0, a1)); +} +Variant ei_destroypixeliterator(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(destroypixeliterator); + return (f_destroypixeliterator(a0), null); +} +Variant ei_magicksetimagetype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagetype); + return (f_magicksetimagetype(a0, a1)); +} +Variant ei_date_sunrise(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_sunrise); + int count = params.size(); + if (count <= 1) return (f_date_sunrise(a0)); + if (count == 2) return (f_date_sunrise(a0, a1)); + if (count == 3) return (f_date_sunrise(a0, a1, a2)); + if (count == 4) return (f_date_sunrise(a0, a1, a2, a3)); + if (count == 5) return (f_date_sunrise(a0, a1, a2, a3, a4)); + return (f_date_sunrise(a0, a1, a2, a3, a4, a5)); +} +Variant ei_magickgethomeurl(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgethomeurl); + return (f_magickgethomeurl()); +} +Variant ei_mb_detect_encoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_detect_encoding); + int count = params.size(); + if (count <= 1) return (f_mb_detect_encoding(a0)); + if (count == 2) return (f_mb_detect_encoding(a0, a1)); + return (f_mb_detect_encoding(a0, a1, a2)); +} +Variant ei_wandhasexception(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(wandhasexception); + return (f_wandhasexception(a0)); +} +Variant ei_error_reporting(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(error_reporting); + int count = params.size(); + if (count <= 0) return (f_error_reporting()); + return (f_error_reporting(a0)); +} +Variant ei_imagepalettecopy(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagepalettecopy); + return (f_imagepalettecopy(a0, a1), null); +} +Variant ei_rename_function(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rename_function); + return (f_rename_function(a0, a1)); +} +Variant ei_gzcompress(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzcompress); + int count = params.size(); + if (count <= 1) return (f_gzcompress(a0)); + return (f_gzcompress(a0, a1)); +} +Variant ei_gzeof(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzeof); + return (f_gzeof(a0)); +} +Variant ei_bcadd(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bcadd); + int count = params.size(); + if (count <= 2) return (f_bcadd(a0, a1)); + return (f_bcadd(a0, a1, a2)); +} +Variant ei_curl_setopt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_setopt); + return (f_curl_setopt(a0, a1, a2)); +} +Variant ei_imagealphablending(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagealphablending); + return (f_imagealphablending(a0, a1)); +} +Variant ei_pixelgetmagenta(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetmagenta); + return (f_pixelgetmagenta(a0)); +} +Variant ei_drawannotation(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawannotation); + return (f_drawannotation(a0, a1, a2, a3), null); +} +Variant ei_getmypid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getmypid); + return (f_getmypid()); +} +Variant ei_magicksetimagedispose(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagedispose); + return (f_magicksetimagedispose(a0, a1)); +} +Variant ei_drawsetfontsize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfontsize); + return (f_drawsetfontsize(a0, a1), null); +} +Variant ei_gethostbyname(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gethostbyname); + return (f_gethostbyname(a0)); +} +Variant ei_stream_wrapper_restore(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_wrapper_restore); + return (f_stream_wrapper_restore(a0)); +} +Variant ei_magickgetimagecompression(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagecompression); + return (f_magickgetimagecompression(a0)); +} +Variant ei_hphp_invoke_method(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_invoke_method); + return (f_hphp_invoke_method(a0, a1, a2, a3)); +} +Variant ei_date_offset_get(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_offset_get); + return (f_date_offset_get(a0)); +} +Variant ei_pixelgetiteratorexception(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetiteratorexception); + return (f_pixelgetiteratorexception(a0)); +} +Variant ei_mysql_field_flags(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_field_flags); + int count = params.size(); + if (count <= 1) return (f_mysql_field_flags(a0)); + return (f_mysql_field_flags(a0, a1)); +} +Variant ei_linkinfo(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(linkinfo); + return (f_linkinfo(a0)); +} +Variant ei_strchr(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strchr); + return (f_strchr(a0, a1)); +} +Variant ei_magickqueryformats(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickqueryformats); + return (f_magickqueryformats(a0)); +} +Variant ei_date_time_set(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_time_set); + int count = params.size(); + if (count <= 3) return (f_date_time_set(a0, a1, a2), null); + return (f_date_time_set(a0, a1, a2, a3), null); +} +Variant ei_iconv_strpos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iconv_strpos); + int count = params.size(); + if (count <= 2) return (f_iconv_strpos(a0, a1)); + if (count == 3) return (f_iconv_strpos(a0, a1, a2)); + return (f_iconv_strpos(a0, a1, a2, a3)); +} +Variant ei_i18n_loc_set_strength(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(i18n_loc_set_strength); + return (f_i18n_loc_set_strength(a0)); +} +Variant ei_magickgetimagebordercolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagebordercolor); + return (f_magickgetimagebordercolor(a0)); +} +Variant ei_ob_end_clean(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ob_end_clean); + return (f_ob_end_clean()); +} +Variant ei_trigger_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(trigger_error); + int count = params.size(); + if (count <= 1) return (f_trigger_error(a0)); + return (f_trigger_error(a0, a1)); +} +Variant ei_pcntl_getpriority(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pcntl_getpriority); + int count = params.size(); + if (count <= 0) return (f_pcntl_getpriority()); + if (count == 1) return (f_pcntl_getpriority(a0)); + return (f_pcntl_getpriority(a0, a1)); +} +Variant ei_date_default_timezone_get(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_default_timezone_get); + return (f_date_default_timezone_get()); +} +Variant ei_strcmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strcmp); + return (f_strcmp(a0, a1)); +} +Variant ei_hphp_instanceof(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_instanceof); + return (f_hphp_instanceof(a0, a1)); +} +Variant ei_import_request_variables(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(import_request_variables); + int count = params.size(); + if (count <= 1) return (f_import_request_variables(a0)); + return (f_import_request_variables(a0, a1)); +} +Variant ei_magickgetpackagename(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetpackagename); + return (f_magickgetpackagename()); +} +Variant ei_destroypixelwandarray(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(destroypixelwandarray); + return (f_destroypixelwandarray(a0), null); +} +Variant ei_spliti(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(spliti); + int count = params.size(); + if (count <= 2) return (f_spliti(a0, a1)); + return (f_spliti(a0, a1, a2)); +} +Variant ei_posix_setgid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_setgid); + return (f_posix_setgid(a0)); +} +Variant ei_is_double(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_double); + return (f_is_double(a0)); +} +Variant ei_output_reset_rewrite_vars(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(output_reset_rewrite_vars); + return (f_output_reset_rewrite_vars()); +} +Variant ei_get_declared_interfaces(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(get_declared_interfaces); + return (f_get_declared_interfaces()); +} +Variant ei_passthru(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(passthru); + int count = params.size(); + if (count <= 1) return (f_passthru(a0), null); + return (f_passthru(a0, ref(a1)), null); +} +Variant ei_fbml_attr_to_color_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_attr_to_color_11); + return (f_fbml_attr_to_color_11(a0)); +} +Variant ei_magickmontageimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickmontageimage); + return (f_magickmontageimage(a0, a1, a2, a3, a4, a5)); +} +Variant ei_apc_cache_info(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_cache_info); + int count = params.size(); + if (count <= 0) return (f_apc_cache_info()); + if (count == 1) return (f_apc_cache_info(a0)); + return (f_apc_cache_info(a0, a1)); +} +Variant ei_convert_cyr_string(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(convert_cyr_string); + return (f_convert_cyr_string(a0, a1, a2)); +} +Variant ei_libxml_get_last_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(libxml_get_last_error); + return (f_libxml_get_last_error()); +} +Variant ei_sys_get_temp_dir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sys_get_temp_dir); + return (f_sys_get_temp_dir()); +} +Variant ei_drawline(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawline); + return (f_drawline(a0, a1, a2, a3, a4), null); +} +Variant ei_drawsetfillcolor(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfillcolor); + return (f_drawsetfillcolor(a0, a1), null); +} +Variant ei_gzopen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzopen); + int count = params.size(); + if (count <= 2) return (f_gzopen(a0, a1)); + return (f_gzopen(a0, a1, a2)); +} +Variant ei_getservbyport(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getservbyport); + return (f_getservbyport(a0, a1)); +} +Variant ei_stripcslashes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stripcslashes); + return (f_stripcslashes(a0)); +} +Variant ei_curl_multi_add_handle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_multi_add_handle); + return (f_curl_multi_add_handle(a0, a1)); +} +Variant ei_ldap_free_result(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_free_result); + return (f_ldap_free_result(a0)); +} +Variant ei_xmlwriter_end_pi(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_end_pi); + return (f_xmlwriter_end_pi(a0)); +} +Variant ei_imagewbmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagewbmp); + int count = params.size(); + if (count <= 1) return (f_imagewbmp(a0)); + if (count == 2) return (f_imagewbmp(a0, a1)); + return (f_imagewbmp(a0, a1, a2)); +} +Variant ei_socket_set_nonblock(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_set_nonblock); + return (f_socket_set_nonblock(a0)); +} +Variant ei_shm_get_var(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(shm_get_var); + return (f_shm_get_var(a0, a1)); +} +Variant ei_magickgetmimetype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetmimetype); + return (f_magickgetmimetype(a0)); +} +Variant ei_mysql_fetch_assoc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_fetch_assoc); + return (f_mysql_fetch_assoc(a0)); +} +Variant ei_array_filter(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_filter); + int count = params.size(); + if (count <= 1) return (f_array_filter(a0)); + return (f_array_filter(a0, a1)); +} +Variant ei_mysql_query(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_query); + int count = params.size(); + if (count <= 1) return (f_mysql_query(a0)); + return (f_mysql_query(a0, a1)); +} +Variant ei_crypt(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(crypt); + int count = params.size(); + if (count <= 1) return (f_crypt(a0)); + return (f_crypt(a0, a1)); +} +Variant ei_xmlwriter_start_cdata(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_cdata); + return (f_xmlwriter_start_cdata(a0)); +} +Variant ei_fgetc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fgetc); + return (f_fgetc(a0)); +} +Variant ei_move_uploaded_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(move_uploaded_file); + return (f_move_uploaded_file(a0, a1)); +} +Variant ei_imagecopyresampled(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + Variant a8; + Variant a9; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a8 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a9 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecopyresampled); + return (f_imagecopyresampled(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} +Variant ei_imagecreatefrompng(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatefrompng); + return (f_imagecreatefrompng(a0)); +} +Variant ei_magickgetimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimage); + return (f_magickgetimage(a0)); +} +Variant ei_imagesettile(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagesettile); + return (f_imagesettile(a0, a1)); +} +Variant ei_fgets(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fgets); + int count = params.size(); + if (count <= 1) return (f_fgets(a0)); + return (f_fgets(a0, a1)); +} +Variant ei_tempnam(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(tempnam); + return (f_tempnam(a0, a1)); +} +Variant ei_bcdiv(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(bcdiv); + int count = params.size(); + if (count <= 2) return (f_bcdiv(a0, a1)); + return (f_bcdiv(a0, a1, a2)); +} +Variant ei_rsort(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rsort); + int count = params.size(); + if (count <= 1) return (f_rsort(ref(a0))); + if (count == 2) return (f_rsort(ref(a0), a1)); + return (f_rsort(ref(a0), a1, a2)); +} +Variant ei_drawgettextdecoration(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgettextdecoration); + return (f_drawgettextdecoration(a0)); +} +Variant ei_strtolower(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strtolower); + return (f_strtolower(a0)); +} +Variant ei_oci_field_name(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_field_name); + return (f_oci_field_name(a0, a1)); +} +Variant ei_posix_getgrgid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getgrgid); + return (f_posix_getgrgid(a0)); +} +Variant ei_apc_inc(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_inc); + int count = params.size(); + if (count <= 1) return (f_apc_inc(a0)); + if (count == 2) return (f_apc_inc(a0, a1)); + if (count == 3) return (f_apc_inc(a0, a1, ref(a2))); + return (f_apc_inc(a0, a1, ref(a2), a3)); +} +Variant ei_hphp_create_object(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_create_object); + return (f_hphp_create_object(a0, a1)); +} +Variant ei_hexdec(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hexdec); + return (f_hexdec(a0)); +} +Variant ei_imagefttext(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + Variant a8; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a8 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagefttext); + int count = params.size(); + if (count <= 8) return (f_imagefttext(a0, a1, a2, a3, a4, a5, a6, a7)); + return (f_imagefttext(a0, a1, a2, a3, a4, a5, a6, a7, a8)); +} +Variant ei_xhprof_sample_disable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xhprof_sample_disable); + return (f_xhprof_sample_disable()); +} +Variant ei_ldap_compare(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(ldap_compare); + return (f_ldap_compare(a0, a1, a2, a3)); +} +Variant ei_dns_get_record(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a3 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(dns_get_record); + int count = params.size(); + if (count <= 1) return (f_dns_get_record(a0)); + if (count == 2) return (f_dns_get_record(a0, a1)); + if (count == 3) return (f_dns_get_record(a0, a1, ref(a2))); + return (f_dns_get_record(a0, a1, ref(a2), ref(a3))); +} +Variant ei_openssl_get_privatekey(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_get_privatekey); + int count = params.size(); + if (count <= 1) return (f_openssl_get_privatekey(a0)); + return (f_openssl_get_privatekey(a0, a1)); +} +Variant ei_socket_bind(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_bind); + int count = params.size(); + if (count <= 2) return (f_socket_bind(a0, a1)); + return (f_socket_bind(a0, a1, a2)); +} +Variant ei_imagepng(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagepng); + int count = params.size(); + if (count <= 1) return (f_imagepng(a0)); + if (count == 2) return (f_imagepng(a0, a1)); + if (count == 3) return (f_imagepng(a0, a1, a2)); + return (f_imagepng(a0, a1, a2, a3)); +} +Variant ei_getmyuid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getmyuid); + return (f_getmyuid()); +} +Variant ei_pixelgetopacity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetopacity); + return (f_pixelgetopacity(a0)); +} +Variant ei_drawsetstrokelinecap(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetstrokelinecap); + return (f_drawsetstrokelinecap(a0, a1), null); +} +Variant ei_xmlwriter_write_attribute_ns(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_write_attribute_ns); + return (f_xmlwriter_write_attribute_ns(a0, a1, a2, a3, a4)); +} +Variant ei_array_keys(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_keys); + int count = params.size(); + if (count <= 1) return (f_array_keys(a0)); + if (count == 2) return (f_array_keys(a0, a1)); + return (f_array_keys(a0, a1, a2)); +} +Variant ei_call_user_method_array(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(call_user_method_array); + return (f_call_user_method_array(a0, ref(a1), a2)); +} +Variant ei_magickmagnifyimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickmagnifyimage); + return (f_magickmagnifyimage(a0)); +} +Variant ei_is_bool(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_bool); + return (f_is_bool(a0)); +} +Variant ei_magickgetimagegreenprimary(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetimagegreenprimary); + return (f_magickgetimagegreenprimary(a0)); +} +Variant ei_filegroup(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(filegroup); + return (f_filegroup(a0)); +} +Variant ei_gzread(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzread); + int count = params.size(); + if (count <= 1) return (f_gzread(a0)); + return (f_gzread(a0, a1)); +} +Variant ei_drawpathellipticarcrelative(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + Variant a7; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a7 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathellipticarcrelative); + return (f_drawpathellipticarcrelative(a0, a1, a2, a3, a4, a5, a6, a7), null); +} +Variant ei_openssl_csr_export_to_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_csr_export_to_file); + int count = params.size(); + if (count <= 2) return (f_openssl_csr_export_to_file(a0, a1)); + return (f_openssl_csr_export_to_file(a0, a1, a2)); +} +Variant ei_oci_fetch_row(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_fetch_row); + return (f_oci_fetch_row(a0)); +} +Variant ei_magicksetimagecolorspace(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetimagecolorspace); + return (f_magicksetimagecolorspace(a0, a1)); +} +Variant ei_nl_langinfo(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(nl_langinfo); + return (f_nl_langinfo(a0)); +} +Variant ei_hphp_get_stats(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_get_stats); + return (f_hphp_get_stats(a0)); +} +Variant ei_strncmp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strncmp); + return (f_strncmp(a0, a1, a2)); +} +Variant ei_mb_regex_set_options(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_regex_set_options); + int count = params.size(); + if (count <= 0) return (f_mb_regex_set_options()); + return (f_mb_regex_set_options(a0)); +} +Variant ei_pixelsetmagenta(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetmagenta); + return (f_pixelsetmagenta(a0, a1), null); +} +Variant ei_magickdeconstructimages(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickdeconstructimages); + return (f_magickdeconstructimages(a0)); +} +Variant ei_xbox_task_status(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xbox_task_status); + return (f_xbox_task_status(a0)); +} +Variant ei_openssl_open(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_open); + return (f_openssl_open(a0, ref(a1), a2, a3)); +} +Variant ei_apc_bin_load(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_bin_load); + int count = params.size(); + if (count <= 1) return (f_apc_bin_load(a0)); + if (count == 2) return (f_apc_bin_load(a0, a1)); + return (f_apc_bin_load(a0, a1, a2)); +} +Variant ei_current(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(current); + return (f_current(ref(a0))); +} +Variant ei_stream_register_wrapper(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(stream_register_wrapper); + return (f_stream_register_wrapper(a0, a1)); +} +Variant ei_hphp_stats(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(hphp_stats); + return (f_hphp_stats(a0, a1), null); +} +Variant ei_opendir(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(opendir); + int count = params.size(); + if (count <= 1) return (f_opendir(a0)); + return (f_opendir(a0, a1)); +} +Variant ei_magickgetexceptionstring(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetexceptionstring); + return (f_magickgetexceptionstring(a0)); +} +Variant ei_mcrypt_module_is_block_algorithm_mode(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mcrypt_module_is_block_algorithm_mode); + int count = params.size(); + if (count <= 1) return (f_mcrypt_module_is_block_algorithm_mode(a0)); + return (f_mcrypt_module_is_block_algorithm_mode(a0, a1)); +} +Variant ei_posix_setpgid(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_setpgid); + return (f_posix_setpgid(a0, a1)); +} +Variant ei_dns_get_mx(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(dns_get_mx); + int count = params.size(); + if (count <= 2) return (f_dns_get_mx(a0, ref(a1))); + return (f_dns_get_mx(a0, ref(a1), ref(a2))); +} +Variant ei_escapeshellarg(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(escapeshellarg); + return (f_escapeshellarg(a0)); +} +Variant ei_headers_list(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(headers_list); + return (f_headers_list()); +} +Variant ei_is_scalar(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_scalar); + return (f_is_scalar(a0)); +} +Variant ei_acos(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(acos); + return (f_acos(a0)); +} +Variant ei_oci_internal_debug(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_internal_debug); + return (f_oci_internal_debug(a0), null); +} +Variant ei_drawgettextencoding(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawgettextencoding); + return (f_drawgettextencoding(a0)); +} +Variant ei_filetype(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(filetype); + return (f_filetype(a0)); +} +Variant ei_magicksetresolution(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetresolution); + return (f_magicksetresolution(a0, a1, a2)); +} +Variant ei_fbml_attr_to_bool_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_attr_to_bool_11); + return (f_fbml_attr_to_bool_11(a0)); +} +Variant ei_posix_isatty(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_isatty); + return (f_posix_isatty(a0)); +} +Variant ei_escapeshellcmd(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(escapeshellcmd); + return (f_escapeshellcmd(a0)); +} +Variant ei_apc_store(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apc_store); + int count = params.size(); + if (count <= 2) return (f_apc_store(a0, a1)); + if (count == 3) return (f_apc_store(a0, a1, a2)); + return (f_apc_store(a0, a1, a2, a3)); +} +Variant ei_magickresetiterator(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickresetiterator); + return (f_magickresetiterator(a0), null); +} +Variant ei_apache_lookup_uri(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(apache_lookup_uri); + return (f_apache_lookup_uri(a0)); +} +Variant ei_magickmotionblurimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickmotionblurimage); + return (f_magickmotionblurimage(a0, a1, a2, a3)); +} +Variant ei_fbml_parse_opaque_11(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + Variant a6; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a6 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fbml_parse_opaque_11); + int count = params.size(); + if (count <= 3) return (f_fbml_parse_opaque_11(a0, a1, a2)); + if (count == 4) return (f_fbml_parse_opaque_11(a0, a1, a2, a3)); + if (count == 5) return (f_fbml_parse_opaque_11(a0, a1, a2, a3, a4)); + if (count == 6) return (f_fbml_parse_opaque_11(a0, a1, a2, a3, a4, a5)); + return (f_fbml_parse_opaque_11(a0, a1, a2, a3, a4, a5, a6)); +} +Variant ei_magicksetwandsize(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicksetwandsize); + return (f_magicksetwandsize(a0, a1, a2)); +} +Variant ei_number_format(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(number_format); + int count = params.size(); + if (count <= 1) return (f_number_format(a0)); + if (count == 2) return (f_number_format(a0, a1)); + if (count == 3) return (f_number_format(a0, a1, a2)); + return (f_number_format(a0, a1, a2, a3)); +} +Variant ei_array_reduce(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(array_reduce); + int count = params.size(); + if (count <= 2) return (f_array_reduce(a0, a1)); + return (f_array_reduce(a0, a1, a2)); +} +Variant ei_xmlwriter_start_dtd_attlist(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_start_dtd_attlist); + return (f_xmlwriter_start_dtd_attlist(a0, a1)); +} +Variant ei_constant(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(constant); + return (f_constant(a0)); +} +Variant ei_strlen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(strlen); + return (f_strlen(a0)); +} +Variant ei_srand(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(srand); + int count = params.size(); + if (count <= 0) return (f_srand(), null); + return (f_srand(a0), null); +} +Variant ei_mysql_fetch_object(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_fetch_object); + int count = params.size(); + if (count <= 1) return (f_mysql_fetch_object(a0)); + if (count == 2) return (f_mysql_fetch_object(a0, a1)); + return (f_mysql_fetch_object(a0, a1, a2)); +} +Variant ei_drawpathlinetoverticalrelative(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathlinetoverticalrelative); + return (f_drawpathlinetoverticalrelative(a0, a1), null); +} +Variant ei_magickminifyimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickminifyimage); + return (f_magickminifyimage(a0)); +} +Variant ei_date_sunset(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_sunset); + int count = params.size(); + if (count <= 1) return (f_date_sunset(a0)); + if (count == 2) return (f_date_sunset(a0, a1)); + if (count == 3) return (f_date_sunset(a0, a1, a2)); + if (count == 4) return (f_date_sunset(a0, a1, a2, a3)); + if (count == 5) return (f_date_sunset(a0, a1, a2, a3, a4)); + return (f_date_sunset(a0, a1, a2, a3, a4, a5)); +} +Variant ei_symlink(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(symlink); + return (f_symlink(a0, a1)); +} +Variant ei_imagesetpixel(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagesetpixel); + return (f_imagesetpixel(a0, a1, a2, a3)); +} +Variant ei_split(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(split); + int count = params.size(); + if (count <= 2) return (f_split(a0, a1)); + return (f_split(a0, a1, a2)); +} +Variant ei_drawsetfontstyle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawsetfontstyle); + return (f_drawsetfontstyle(a0, a1), null); +} +Variant ei_imagecreatefromxbm(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatefromxbm); + return (f_imagecreatefromxbm(a0)); +} +Variant ei_mysql_db_query(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_db_query); + int count = params.size(); + if (count <= 2) return (f_mysql_db_query(a0, a1)); + return (f_mysql_db_query(a0, a1, a2)); +} +Variant ei_imagecolorclosestalpha(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecolorclosestalpha); + return (f_imagecolorclosestalpha(a0, a1, a2, a3, a4)); +} +Variant ei_gzuncompress(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzuncompress); + int count = params.size(); + if (count <= 1) return (f_gzuncompress(a0)); + return (f_gzuncompress(a0, a1)); +} +Variant ei_is_executable(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_executable); + return (f_is_executable(a0)); +} +Variant ei_socket_create_listen(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_create_listen); + int count = params.size(); + if (count <= 1) return (f_socket_create_listen(a0)); + return (f_socket_create_listen(a0, a1)); +} +Variant ei_pixelgetcolorcount(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelgetcolorcount); + return (f_pixelgetcolorcount(a0)); +} +Variant ei_magickqueryconfigureoptions(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickqueryconfigureoptions); + return (f_magickqueryconfigureoptions(a0)); +} +Variant ei_iptcembed(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(iptcembed); + int count = params.size(); + if (count <= 2) return (f_iptcembed(a0, a1)); + return (f_iptcembed(a0, a1, a2)); +} +Variant ei_posix_getgrnam(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(posix_getgrnam); + return (f_posix_getgrnam(a0)); +} +Variant ei_rtrim(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(rtrim); + int count = params.size(); + if (count <= 1) return (f_rtrim(a0)); + return (f_rtrim(a0, a1)); +} +Variant ei_print_r(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(print_r); + int count = params.size(); + if (count <= 1) return (f_print_r(a0)); + return (f_print_r(a0, a1)); +} +Variant ei_drawpathcurvetoquadraticbeziersmoothrelative(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpathcurvetoquadraticbeziersmoothrelative); + return (f_drawpathcurvetoquadraticbeziersmoothrelative(a0, a1, a2), null); +} +Variant ei_openssl_pkey_export(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkey_export); + int count = params.size(); + if (count <= 2) return (f_openssl_pkey_export(a0, ref(a1))); + if (count == 3) return (f_openssl_pkey_export(a0, ref(a1), a2)); + return (f_openssl_pkey_export(a0, ref(a1), a2, a3)); +} +Variant ei_abs(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(abs); + return (f_abs(a0)); +} +Variant ei_shell_exec(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(shell_exec); + return (f_shell_exec(a0)); +} +Variant ei_restore_exception_handler(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(restore_exception_handler); + return (f_restore_exception_handler()); +} +Variant ei_curl_multi_exec(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = ref((*it)->refval(env)); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(curl_multi_exec); + return (f_curl_multi_exec(a0, ref(a1))); +} +Variant ei_htmlspecialchars(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(htmlspecialchars); + int count = params.size(); + if (count <= 1) return (f_htmlspecialchars(a0)); + if (count == 2) return (f_htmlspecialchars(a0, a1)); + if (count == 3) return (f_htmlspecialchars(a0, a1, a2)); + return (f_htmlspecialchars(a0, a1, a2, a3)); +} +Variant ei_imagexbm(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagexbm); + int count = params.size(); + if (count <= 1) return (f_imagexbm(a0)); + if (count == 2) return (f_imagexbm(a0, a1)); + return (f_imagexbm(a0, a1, a2)); +} +Variant ei_magickgetreleasedate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetreleasedate); + return (f_magickgetreleasedate()); +} +Variant ei_sem_remove(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(sem_remove); + return (f_sem_remove(a0)); +} +Variant ei_imageellipse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imageellipse); + return (f_imageellipse(a0, a1, a2, a3, a4, a5)); +} +Variant ei_getprotobynumber(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(getprotobynumber); + return (f_getprotobynumber(a0)); +} +Variant ei_pixelsetopacity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(pixelsetopacity); + return (f_pixelsetopacity(a0, a1), null); +} +Variant ei_lchgrp(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(lchgrp); + return (f_lchgrp(a0, a1)); +} +Variant ei_simplexml_load_file(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(simplexml_load_file); + int count = params.size(); + if (count <= 1) return (f_simplexml_load_file(a0)); + if (count == 2) return (f_simplexml_load_file(a0, a1)); + if (count == 3) return (f_simplexml_load_file(a0, a1, a2)); + if (count == 4) return (f_simplexml_load_file(a0, a1, a2, a3)); + return (f_simplexml_load_file(a0, a1, a2, a3, a4)); +} +Variant ei_openssl_pkey_get_details(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_pkey_get_details); + return (f_openssl_pkey_get_details(a0)); +} +Variant ei_imagetypes(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagetypes); + return (f_imagetypes()); +} +Variant ei_gzseek(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzseek); + int count = params.size(); + if (count <= 2) return (f_gzseek(a0, a1)); + return (f_gzseek(a0, a1, a2)); +} +Variant ei_magickgetmaxtextadvance(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magickgetmaxtextadvance); + int count = params.size(); + if (count <= 3) return (f_magickgetmaxtextadvance(a0, a1, a2)); + return (f_magickgetmaxtextadvance(a0, a1, a2, a3)); +} +Variant ei_func_get_arg(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(func_get_arg); + return (f_func_get_arg(a0)); +} +Variant ei_imagefilledrectangle(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagefilledrectangle); + return (f_imagefilledrectangle(a0, a1, a2, a3, a4, a5)); +} +Variant ei_oci_pconnect(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(oci_pconnect); + int count = params.size(); + if (count <= 2) return (f_oci_pconnect(a0, a1)); + if (count == 3) return (f_oci_pconnect(a0, a1, a2)); + if (count == 4) return (f_oci_pconnect(a0, a1, a2, a3)); + return (f_oci_pconnect(a0, a1, a2, a3, a4)); +} +Variant ei_drawpushpattern(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + Variant a3; + Variant a4; + Variant a5; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a3 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a4 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a5 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(drawpushpattern); + return (f_drawpushpattern(a0, a1, a2, a3, a4, a5), null); +} +Variant ei_xmlwriter_set_indent(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(xmlwriter_set_indent); + return (f_xmlwriter_set_indent(a0, a1)); +} +Variant ei_openssl_csr_get_subject(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(openssl_csr_get_subject); + int count = params.size(); + if (count <= 1) return (f_openssl_csr_get_subject(a0)); + return (f_openssl_csr_get_subject(a0, a1)); +} +Variant ei_is_numeric(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(is_numeric); + return (f_is_numeric(a0)); +} +Variant ei_gzdeflate(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(gzdeflate); + int count = params.size(); + if (count <= 1) return (f_gzdeflate(a0)); + return (f_gzdeflate(a0, a1)); +} +Variant ei_dns_check_record(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(dns_check_record); + int count = params.size(); + if (count <= 1) return (f_dns_check_record(a0)); + return (f_dns_check_record(a0, a1)); +} +Variant ei_magicknegateimage(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(magicknegateimage); + int count = params.size(); + if (count <= 1) return (f_magicknegateimage(a0)); + if (count == 2) return (f_magicknegateimage(a0, a1)); + return (f_magicknegateimage(a0, a1, a2)); +} +Variant ei_socket_last_error(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(socket_last_error); + int count = params.size(); + if (count <= 0) return (f_socket_last_error()); + return (f_socket_last_error(a0)); +} +Variant ei_create_function(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(create_function); + return (f_create_function(a0, a1)); +} +Variant ei_str_split(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(str_split); + int count = params.size(); + if (count <= 1) return (f_str_split(a0)); + return (f_str_split(a0, a1)); +} +Variant ei_date_parse(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(date_parse); + return (f_date_parse(a0)); +} +Variant ei_imagecreatefromxpm(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(imagecreatefromxpm); + return (f_imagecreatefromxpm(a0)); +} +Variant ei_mysql_thread_id(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mysql_thread_id); + int count = params.size(); + if (count <= 0) return (f_mysql_thread_id()); + return (f_mysql_thread_id(a0)); +} +Variant ei_mb_encode_numericentity(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + Variant a2; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a2 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(mb_encode_numericentity); + int count = params.size(); + if (count <= 2) return (f_mb_encode_numericentity(a0, a1)); + return (f_mb_encode_numericentity(a0, a1, a2)); +} +Variant ei_fb_call_user_func_array_safe(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) { + Variant a0; + Variant a1; + const std::vector ¶ms = caller->params(); + std::vector::const_iterator it = params.begin(); + do { + if (it == params.end()) break; + a0 = (*it)->eval(env); + it++; + if (it == params.end()) break; + a1 = (*it)->eval(env); + it++; + } while(false); + for (; it != params.end(); ++it) { + (*it)->eval(env); + } + FUNCTION_INJECTION(fb_call_user_func_array_safe); + return (f_fb_call_user_func_array_safe(a0, a1)); +} +Variant Eval::invoke_from_eval_builtin(const char *s, Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller, int64 hash, bool fatal) { + if (hash < 0) hash = hash_string_i(s); + switch (hash & 4095) { + case 1: + HASH_INVOKE_FROM_EVAL(0x4F7230DC25F0E001LL, magicknormalizeimage); + break; + case 2: + HASH_INVOKE_FROM_EVAL(0x76C320EDB9B6E002LL, xmlwriter_flush); + break; + case 3: + HASH_INVOKE_FROM_EVAL(0x7E0EC3E131BCA003LL, token_name); + break; + case 5: + HASH_INVOKE_FROM_EVAL(0x20D579E7E4131005LL, imagecolorclosest); + HASH_INVOKE_FROM_EVAL(0x18A0F1EE8E249005LL, msg_send); + break; + case 10: + HASH_INVOKE_FROM_EVAL(0x555D7A3FB939300ALL, apache_setenv); + break; + case 11: + HASH_INVOKE_FROM_EVAL(0x4FDCCE1C7754600BLL, ob_iconv_handler); + break; + case 13: + HASH_INVOKE_FROM_EVAL(0x40FA17130FA7100DLL, openssl_seal); + break; + case 22: + HASH_INVOKE_FROM_EVAL(0x5623A698A728F016LL, getlastmod); + break; + case 24: + HASH_INVOKE_FROM_EVAL(0x4C915E3480E94018LL, mb_substr_count); + break; + case 26: + HASH_INVOKE_FROM_EVAL(0x03834225EBBC101ALL, drawsettextundercolor); + break; + case 32: + HASH_INVOKE_FROM_EVAL(0x583D163A6EB52020LL, oci_result); + break; + case 34: + HASH_INVOKE_FROM_EVAL(0x145D42B2AB55D022LL, drawmatte); + break; + case 35: + HASH_INVOKE_FROM_EVAL(0x35C74650867B7023LL, imagesetpixel); + break; + case 40: + HASH_INVOKE_FROM_EVAL(0x601C5152277AE028LL, readfile); + break; + case 44: + HASH_INVOKE_FROM_EVAL(0x464EB9B1F955202CLL, apc_add); + break; + case 51: + HASH_INVOKE_FROM_EVAL(0x48F35DFD653D7033LL, pclose); + break; + case 54: + HASH_INVOKE_FROM_EVAL(0x32F23F206C394036LL, curl_setopt_array); + break; + case 55: + HASH_INVOKE_FROM_EVAL(0x418D937957ECE037LL, tanh); + break; + case 62: + HASH_INVOKE_FROM_EVAL(0x32E6E5D3CCE3703ELL, magickgetimagewidth); + HASH_INVOKE_FROM_EVAL(0x43461C4D9130103ELL, exit); + HASH_INVOKE_FROM_EVAL(0x67C1ED9B816E503ELL, md5_file); + HASH_INVOKE_FROM_EVAL(0x497E31C70409603ELL, timezone_name_from_abbr); + break; + case 63: + HASH_INVOKE_FROM_EVAL(0x24206A195B9C203FLL, ucfirst); + break; + case 65: + HASH_INVOKE_FROM_EVAL(0x65B39B11F5D7C041LL, array_unique); + break; + case 67: + HASH_INVOKE_FROM_EVAL(0x5ACCF9166CD9D043LL, ftruncate); + break; + case 68: + HASH_INVOKE_FROM_EVAL(0x378A73FF98B60044LL, curl_init); + break; + case 73: + HASH_INVOKE_FROM_EVAL(0x047A8BF04DB51049LL, range); + HASH_INVOKE_FROM_EVAL(0x4282E0231F600049LL, fseek); + break; + case 75: + HASH_INVOKE_FROM_EVAL(0x17CD0E68E778C04BLL, drawsetstrokelinejoin); + HASH_INVOKE_FROM_EVAL(0x6370CF455EA8604BLL, socket_create); + break; + case 76: + HASH_INVOKE_FROM_EVAL(0x03047FD5FC67204CLL, exif_read_data); + break; + case 77: + HASH_INVOKE_FROM_EVAL(0x430441BA393E204DLL, xhp_preprocess_code); + break; + case 83: + HASH_INVOKE_FROM_EVAL(0x15A9EB33DA6E9053LL, getimagesize); + HASH_INVOKE_FROM_EVAL(0x07EB5C3A3BEA3053LL, acosh); + break; + case 86: + HASH_INVOKE_FROM_EVAL(0x4B3A51F6ABAC1056LL, fbml_attr_to_color_11); + break; + case 87: + HASH_INVOKE_FROM_EVAL(0x12B22A2E6B344057LL, ldap_sort); + break; + case 90: + HASH_INVOKE_FROM_EVAL(0x271AB768D202F05ALL, mcrypt_module_is_block_algorithm); + break; + case 92: + HASH_INVOKE_FROM_EVAL(0x2B7532A070BF605CLL, openssl_get_privatekey); + break; + case 95: + HASH_INVOKE_FROM_EVAL(0x4B70746F965E705FLL, preg_last_error); + break; + case 98: + HASH_INVOKE_FROM_EVAL(0x745910AD5C922062LL, magickgetmimetype); + break; + case 100: + HASH_INVOKE_FROM_EVAL(0x5CC8BA5ADFAC0064LL, imagegrabscreen); + break; + case 101: + HASH_INVOKE_FROM_EVAL(0x777FE52584FAE065LL, apc_bin_dump); + break; + case 103: + HASH_INVOKE_FROM_EVAL(0x0CE1918B30DF5067LL, sys_getloadavg); + HASH_INVOKE_FROM_EVAL(0x4512BD5EA7076067LL, openssl_csr_export_to_file); + break; + case 112: + HASH_INVOKE_FROM_EVAL(0x3C466098FF7B5070LL, mb_check_encoding); + break; + case 119: + HASH_INVOKE_FROM_EVAL(0x6FF6A07FA963C077LL, fb_request_timers); + break; + case 120: + HASH_INVOKE_FROM_EVAL(0x6B268C26E21C1078LL, arsort); + break; + case 122: + HASH_INVOKE_FROM_EVAL(0x5F9DDC342A83807ALL, date_default_timezone_get); + break; + case 131: + HASH_INVOKE_FROM_EVAL(0x1A90213EE1A56083LL, array_pop); + break; + case 132: + HASH_INVOKE_FROM_EVAL(0x53FD8C9AC3F4D084LL, dangling_server_proxy_new_request); + break; + case 137: + HASH_INVOKE_FROM_EVAL(0x4AD554CBAB9CC089LL, call_user_method_array); + break; + case 140: + HASH_INVOKE_FROM_EVAL(0x4F1D1ED7B087208CLL, exec); + HASH_INVOKE_FROM_EVAL(0x3A0B58797E8FE08CLL, xml_set_external_entity_ref_handler); + break; + case 141: + HASH_INVOKE_FROM_EVAL(0x200864F8F053C08DLL, magickgetversionstring); + break; + case 142: + HASH_INVOKE_FROM_EVAL(0x3E4AE974AFA9708ELL, pixelsetquantumcolor); + break; + case 145: + HASH_INVOKE_FROM_EVAL(0x3E5CF6378A49C091LL, ldap_get_attributes); + HASH_INVOKE_FROM_EVAL(0x673B36244DC87091LL, closelog); + HASH_INVOKE_FROM_EVAL(0x1C32BB63986C8091LL, socket_strerror); + break; + case 147: + HASH_INVOKE_FROM_EVAL(0x3B5E32078E37A093LL, imagedestroy); + break; + case 158: + HASH_INVOKE_FROM_EVAL(0x4AF87BA91163D09ELL, mysql_db_name); + HASH_INVOKE_FROM_EVAL(0x74F0D6D8F1F2709ELL, drawsetstrokedashoffset); + break; + case 159: + HASH_INVOKE_FROM_EVAL(0x2B130322DEC4B09FLL, pixelgetopacityquantum); + break; + case 161: + HASH_INVOKE_FROM_EVAL(0x0DF945F12533F0A1LL, abs); + break; + case 162: + HASH_INVOKE_FROM_EVAL(0x10DF7941C3F3E0A2LL, socket_bind); + break; + case 163: + HASH_INVOKE_FROM_EVAL(0x54242D2846BC60A3LL, magickunsharpmaskimage); + break; + case 167: + HASH_INVOKE_FROM_EVAL(0x74C787060F7290A7LL, icu_transliterate); + break; + case 168: + HASH_INVOKE_FROM_EVAL(0x6E8C61326DCE40A8LL, var_export); + break; + case 169: + HASH_INVOKE_FROM_EVAL(0x431F4E8713B9D0A9LL, oci_field_scale); + break; + case 171: + HASH_INVOKE_FROM_EVAL(0x439DF153FC32D0ABLL, printf); + HASH_INVOKE_FROM_EVAL(0x5B1D9F56698A40ABLL, html_entity_decode); + break; + case 172: + HASH_INVOKE_FROM_EVAL(0x6E27DC1E74C5B0ACLL, drawpathstart); + break; + case 173: + HASH_INVOKE_FROM_EVAL(0x4C9252FB9C3300ADLL, pixelsetalphaquantum); + break; + case 174: + HASH_INVOKE_FROM_EVAL(0x47AB4A08446BD0AELL, bcmod); + HASH_INVOKE_FROM_EVAL(0x4BBD5D8A6E0110AELL, error_log); + break; + case 175: + HASH_INVOKE_FROM_EVAL(0x3954FFED1E0650AFLL, stream_register_wrapper); + break; + case 176: + HASH_INVOKE_FROM_EVAL(0x5B9F8B3E1D8330B0LL, stream_socket_sendto); + break; + case 178: + HASH_INVOKE_FROM_EVAL(0x48BBFB59FB7F90B2LL, iconv_strlen); + break; + case 184: + HASH_INVOKE_FROM_EVAL(0x05A4C165810A30B8LL, gzread); + break; + case 185: + HASH_INVOKE_FROM_EVAL(0x5C659372B2CD80B9LL, imagecolorstotal); + break; + case 187: + HASH_INVOKE_FROM_EVAL(0x331E7DFBE6E240BBLL, libxml_get_errors); + break; + case 188: + HASH_INVOKE_FROM_EVAL(0x3900350CD9D990BCLL, imagecreatefromjpeg); + break; + case 190: + HASH_INVOKE_FROM_EVAL(0x2E71CD02E4BA50BELL, fb_add_included_file); + break; + case 197: + HASH_INVOKE_FROM_EVAL(0x7424946F7ED520C5LL, magickgetimagefilename); + HASH_INVOKE_FROM_EVAL(0x6B477F3B9CDB10C5LL, base64_decode); + break; + case 199: + HASH_INVOKE_FROM_EVAL(0x677F33E78342A0C7LL, function_exists); + break; + case 200: + HASH_INVOKE_FROM_EVAL(0x30AB38D851C440C8LL, magickgetimagebackgroundcolor); + break; + case 202: + HASH_INVOKE_FROM_EVAL(0x2EE0967F6EB5A0CALL, date_format); + HASH_INVOKE_FROM_EVAL(0x4C67DEE74080E0CALL, magicksetimagecompose); + break; + case 206: + HASH_INVOKE_FROM_EVAL(0x64E390E5F2FDC0CELL, ismagickwand); + break; + case 210: + HASH_INVOKE_FROM_EVAL(0x5365BD7509BE60D2LL, ldap_dn2ufn); + HASH_INVOKE_FROM_EVAL(0x3E4DAD592CD0A0D2LL, magickdescribeimage); + break; + case 213: + HASH_INVOKE_FROM_EVAL(0x3BF44C6DECD790D5LL, xmlwriter_start_dtd_entity); + break; + case 217: + HASH_INVOKE_FROM_EVAL(0x08F6B727D60670D9LL, magicksetimagedepth); + break; + case 219: + HASH_INVOKE_FROM_EVAL(0x3801923AD84670DBLL, apc_inc); + break; + case 224: + HASH_INVOKE_FROM_EVAL(0x2E4612DF112010E0LL, imagecopyresized); + break; + case 228: + HASH_INVOKE_FROM_EVAL(0x2B9425038D4230E4LL, imagecreatefromxpm); + break; + case 231: + HASH_INVOKE_FROM_EVAL(0x79E6FD78989B10E7LL, tmpfile); + HASH_INVOKE_FROM_EVAL(0x59DE3A26AFF570E7LL, magickshaveimage); + break; + case 232: + HASH_INVOKE_FROM_EVAL(0x476F4B6CC987E0E8LL, magickframeimage); + HASH_INVOKE_FROM_EVAL(0x17CB328F55FDF0E8LL, drawsetstrokeantialias); + break; + case 233: + HASH_INVOKE_FROM_EVAL(0x47F8A63A709D70E9LL, oci_new_cursor); + break; + case 234: + HASH_INVOKE_FROM_EVAL(0x53BA3992F8C240EALL, imagegrabwindow); + break; + case 243: + HASH_INVOKE_FROM_EVAL(0x315CCBC8C5C7D0F3LL, xmlwriter_write_raw); + break; + case 249: + HASH_INVOKE_FROM_EVAL(0x480797DB7165A0F9LL, xmlwriter_set_indent); + break; + case 259: + HASH_INVOKE_FROM_EVAL(0x1FFCBCF1927D7103LL, posix_setpgid); + break; + case 261: + HASH_INVOKE_FROM_EVAL(0x71E3372AA1AD0105LL, is_infinite); + HASH_INVOKE_FROM_EVAL(0x509B763CDAD9D105LL, gethostbyaddr); + break; + case 264: + HASH_INVOKE_FROM_EVAL(0x60B8B61133F59108LL, quoted_printable_decode); + break; + case 267: + HASH_INVOKE_FROM_EVAL(0x7DE1BEE0C35D010BLL, pcntl_signal); + break; + case 273: + HASH_INVOKE_FROM_EVAL(0x3A9A5D4FEE79A111LL, getmxrr); + break; + case 274: + HASH_INVOKE_FROM_EVAL(0x0B1BA48B0CFB1112LL, strval); + HASH_INVOKE_FROM_EVAL(0x28C44527BD59D112LL, is_link); + break; + case 276: + HASH_INVOKE_FROM_EVAL(0x02A4724E6A881114LL, mb_decode_numericentity); + break; + case 281: + HASH_INVOKE_FROM_EVAL(0x3AB82455A70F5119LL, imagecolortransparent); + HASH_INVOKE_FROM_EVAL(0x2B31A877824A1119LL, stristr); + break; + case 284: + HASH_INVOKE_FROM_EVAL(0x070A63F6A0B8711CLL, array_walk_recursive); + break; + case 285: + HASH_INVOKE_FROM_EVAL(0x291088666B8BF11DLL, drawsetfontfamily); + break; + case 286: + HASH_INVOKE_FROM_EVAL(0x658444BB4E29E11ELL, openssl_free_key); + break; + case 287: + HASH_INVOKE_FROM_EVAL(0x4C70C24C84F5511FLL, magicksetimagegamma); + break; + case 291: + HASH_INVOKE_FROM_EVAL(0x3669138315204123LL, mcrypt_module_get_algo_key_size); + break; + case 292: + HASH_INVOKE_FROM_EVAL(0x7D4D28D561392124LL, drawsettextalignment); + break; + case 293: + HASH_INVOKE_FROM_EVAL(0x7A8B3EC0235EF125LL, magickprofileimage); + break; + case 301: + HASH_INVOKE_FROM_EVAL(0x7579DBE83CE5812DLL, imagerectangle); + break; + case 305: + HASH_INVOKE_FROM_EVAL(0x6D4F38F96F3BC131LL, fb_config_coredump); + break; + case 307: + HASH_INVOKE_FROM_EVAL(0x6A7E0B15FF689133LL, mb_ereg_search_init); + break; + case 311: + HASH_INVOKE_FROM_EVAL(0x5666016FA3C0F137LL, socket_clear_error); + break; + case 312: + HASH_INVOKE_FROM_EVAL(0x2676902697E37138LL, xmlwriter_start_comment); + break; + case 314: + HASH_INVOKE_FROM_EVAL(0x2A57E5D29D73D13ALL, register_tick_function); + break; + case 315: + HASH_INVOKE_FROM_EVAL(0x1F61AFCDC510413BLL, imagefilter); + break; + case 316: + HASH_INVOKE_FROM_EVAL(0x403F59EEC2B1D13CLL, fbml_render_children_11); + break; + case 320: + HASH_INVOKE_FROM_EVAL(0x7A1E910EF82F0140LL, fb_get_ape_version); + break; + case 323: + HASH_INVOKE_FROM_EVAL(0x296C739F28D6C143LL, drawsetfontsize); + break; + case 326: + HASH_INVOKE_FROM_EVAL(0x422F426D3D0D8146LL, fql_set_static_data_10); + break; + case 335: + HASH_INVOKE_FROM_EVAL(0x61A61E91C477514FLL, chop); + HASH_INVOKE_FROM_EVAL(0x7863294A8F33D14FLL, file); + break; + case 337: + HASH_INVOKE_FROM_EVAL(0x3044E9F91628E151LL, mb_strlen); + break; + case 338: + HASH_INVOKE_FROM_EVAL(0x5D170BCBBBA02152LL, system); + HASH_INVOKE_FROM_EVAL(0x26DD46D8C1F47152LL, ldap_bind); + break; + case 341: + HASH_INVOKE_FROM_EVAL(0x2623917110168155LL, fclose); + HASH_INVOKE_FROM_EVAL(0x4F43FE32079C0155LL, magickgetimagesblob); + break; + case 347: + HASH_INVOKE_FROM_EVAL(0x3711AF36391EA15BLL, mysql_list_tables); + break; + case 348: + HASH_INVOKE_FROM_EVAL(0x6CD7466174B9A15CLL, pixelsetredquantum); + break; + case 353: + HASH_INVOKE_FROM_EVAL(0x309E780586D6C161LL, socket_set_nonblock); + break; + case 355: + HASH_INVOKE_FROM_EVAL(0x36D6B73D289DD163LL, date_sunset); + break; + case 358: + HASH_INVOKE_FROM_EVAL(0x31B6EEAEB42EA166LL, fbml_sanitize_css_11); + break; + case 360: + HASH_INVOKE_FROM_EVAL(0x14E46EA3CBCFB168LL, magickgetsamplingfactors); + break; + case 361: + HASH_INVOKE_FROM_EVAL(0x4983571BFEAE6169LL, magickaffinetransformimage); + HASH_INVOKE_FROM_EVAL(0x1612E331D1726169LL, drawsetstrokecolor); + break; + case 366: + HASH_INVOKE_FROM_EVAL(0x15B61E061268B16ELL, magickenhanceimage); + HASH_INVOKE_FROM_EVAL(0x0125F8B9428E416ELL, hphp_create_object); + break; + case 370: + HASH_INVOKE_FROM_EVAL(0x59FE6A862E1CB172LL, get_browser); + break; + case 372: + HASH_INVOKE_FROM_EVAL(0x345E070844E3F174LL, create_function); + break; + case 377: + HASH_INVOKE_FROM_EVAL(0x6884FAF0D1EF3179LL, posix_mknod); + break; + case 379: + HASH_INVOKE_FROM_EVAL(0x59594143EFC7617BLL, mcrypt_module_open); + break; + case 380: + HASH_INVOKE_FROM_EVAL(0x3E1343B4A3AD717CLL, magickgettextascent); + break; + case 383: + HASH_INVOKE_FROM_EVAL(0x4EF9496D16F9D17FLL, xmlwriter_start_element_ns); + break; + case 385: + HASH_INVOKE_FROM_EVAL(0x1CBD3B58296C8181LL, xmlwriter_write_dtd); + break; + case 386: + HASH_INVOKE_FROM_EVAL(0x7BB7C27B2C118182LL, get_magic_quotes_gpc); + HASH_INVOKE_FROM_EVAL(0x130B62A8C77F3182LL, mb_ereg_search_getregs); + break; + case 389: + HASH_INVOKE_FROM_EVAL(0x13E90F8874839185LL, ob_get_status); + HASH_INVOKE_FROM_EVAL(0x54DB5DC6A069A185LL, hphp_get_class_info); + break; + case 390: + HASH_INVOKE_FROM_EVAL(0x5DB5E45860801186LL, openssl_csr_export); + break; + case 391: + HASH_INVOKE_FROM_EVAL(0x1BC448670BA4E187LL, iconv_strpos); + break; + case 393: + HASH_INVOKE_FROM_EVAL(0x0CC53B2F0D38D189LL, timezone_offset_get); + break; + case 402: + HASH_INVOKE_FROM_EVAL(0x07B5BF934F6EA192LL, imagesettile); + break; + case 407: + HASH_INVOKE_FROM_EVAL(0x15AD9CE061C75197LL, timezone_transitions_get); + break; + case 409: + HASH_INVOKE_FROM_EVAL(0x0CE71BC3B75D8199LL, mb_strimwidth); + break; + case 411: + HASH_INVOKE_FROM_EVAL(0x7FF6C2A693CE119BLL, magickcyclecolormapimage); + HASH_INVOKE_FROM_EVAL(0x74F20C284227219BLL, similar_text); + break; + case 416: + HASH_INVOKE_FROM_EVAL(0x6FB5104FC97A31A0LL, drawpathcurvetorelative); + break; + case 418: + HASH_INVOKE_FROM_EVAL(0x6DFC0765EBAB81A2LL, mcrypt_decrypt); + HASH_INVOKE_FROM_EVAL(0x2A9015499A2EB1A2LL, fnmatch); + HASH_INVOKE_FROM_EVAL(0x615723D21421A1A2LL, sem_remove); + break; + case 419: + HASH_INVOKE_FROM_EVAL(0x735B81C45C2971A3LL, drawgetfillopacity); + break; + case 424: + HASH_INVOKE_FROM_EVAL(0x2691B602BFA8A1A8LL, oci_field_size); + break; + case 425: + HASH_INVOKE_FROM_EVAL(0x740DC7FFAD8BB1A9LL, imagecolorat); + HASH_INVOKE_FROM_EVAL(0x0DDFE3B1F6EEE1A9LL, array_reduce); + break; + case 426: + HASH_INVOKE_FROM_EVAL(0x11A5C66A3D0711AALL, apc_sma_info); + break; + case 429: + HASH_INVOKE_FROM_EVAL(0x5A6EFF8C71A431ADLL, socket_get_status); + HASH_INVOKE_FROM_EVAL(0x50538F37398AF1ADLL, ldap_get_option); + break; + case 431: + HASH_INVOKE_FROM_EVAL(0x5B1F9C2E9FE111AFLL, fb_utf8ize); + break; + case 438: + HASH_INVOKE_FROM_EVAL(0x33BD672B4AC301B6LL, mt_rand); + break; + case 445: + HASH_INVOKE_FROM_EVAL(0x4B3F35310DEA31BDLL, socket_create_pair); + break; + case 447: + HASH_INVOKE_FROM_EVAL(0x0E88ACEB15A581BFLL, magickgetimageextrema); + HASH_INVOKE_FROM_EVAL(0x681CD0E7D9DB71BFLL, pow); + break; + case 450: + HASH_INVOKE_FROM_EVAL(0x02103322F88C71C2LL, pixelgetcolorcount); + break; + case 452: + HASH_INVOKE_FROM_EVAL(0x3617DAE43A23D1C4LL, xml_parser_set_option); + break; + case 455: + HASH_INVOKE_FROM_EVAL(0x5AE12CB1FFDC21C7LL, drawellipse); + break; + case 456: + HASH_INVOKE_FROM_EVAL(0x11C0B5DA066891C8LL, preg_match_all); + break; + case 458: + HASH_INVOKE_FROM_EVAL(0x75CA86838D24A1CALL, hash_algos); + break; + case 460: + HASH_INVOKE_FROM_EVAL(0x3DF488365DAAF1CCLL, drawgettextencoding); + HASH_INVOKE_FROM_EVAL(0x39DA6409D82D11CCLL, fbml_attr_to_bool_11); + break; + case 461: + HASH_INVOKE_FROM_EVAL(0x37340B707E7CD1CDLL, magickgetimagebordercolor); + break; + case 462: + HASH_INVOKE_FROM_EVAL(0x2E7741B5440FB1CELL, magicksetlastiterator); + break; + case 464: + HASH_INVOKE_FROM_EVAL(0x03012F3DDD7AB1D0LL, getservbyport); + break; + case 468: + HASH_INVOKE_FROM_EVAL(0x219F3257BA3371D4LL, decbin); + break; + case 470: + HASH_INVOKE_FROM_EVAL(0x78831282736801D6LL, stream_context_get_default); + break; + case 472: + HASH_INVOKE_FROM_EVAL(0x60E9E392663921D8LL, readlink); + break; + case 473: + HASH_INVOKE_FROM_EVAL(0x7A69D0078F4F31D9LL, ldap_start_tls); + break; + case 474: + HASH_INVOKE_FROM_EVAL(0x0482E069503A91DALL, posix_setgid); + break; + case 475: + HASH_INVOKE_FROM_EVAL(0x3FEBBC0DA79F31DBLL, fb_call_user_func_safe); + break; + case 476: + HASH_INVOKE_FROM_EVAL(0x14FB46333D6D11DCLL, xml_set_default_handler); + HASH_INVOKE_FROM_EVAL(0x5B3A4A72846B21DCLL, current); + break; + case 477: + HASH_INVOKE_FROM_EVAL(0x04666D6F67C7A1DDLL, mysql_list_processes); + HASH_INVOKE_FROM_EVAL(0x03A183D73942B1DDLL, apc_filehits); + break; + case 479: + HASH_INVOKE_FROM_EVAL(0x7403251412E931DFLL, syslog); + break; + case 480: + HASH_INVOKE_FROM_EVAL(0x5932D2750A8A91E0LL, magickgetpackagename); + break; + case 481: + HASH_INVOKE_FROM_EVAL(0x2771C632A60371E1LL, ftok); + HASH_INVOKE_FROM_EVAL(0x0ED729A444C611E1LL, openssl_x509_read); + break; + case 482: + HASH_INVOKE_FROM_EVAL(0x67D4BA8513BF41E2LL, newpixelwand); + break; + case 483: + HASH_INVOKE_FROM_EVAL(0x131D11F79A8801E3LL, mb_http_output); + HASH_INVOKE_FROM_EVAL(0x406BDC51A3FD81E3LL, pcntl_waitpid); + break; + case 484: + HASH_INVOKE_FROM_EVAL(0x08F7A6C37FC7B1E4LL, shm_get_var); + break; + case 488: + HASH_INVOKE_FROM_EVAL(0x7F843353646391E8LL, rad2deg); + break; + case 493: + HASH_INVOKE_FROM_EVAL(0x1B09A9A533FFA1EDLL, drawgetexceptiontype); + break; + case 497: + HASH_INVOKE_FROM_EVAL(0x02BCE5B0FBED61F1LL, strlen); + break; + case 498: + HASH_INVOKE_FROM_EVAL(0x46AFE55982B371F2LL, posix_geteuid); + break; + case 499: + HASH_INVOKE_FROM_EVAL(0x582D10141D5601F3LL, stream_context_set_option); + HASH_INVOKE_FROM_EVAL(0x11BB3CDC5E4971F3LL, xmlwriter_end_pi); + break; + case 501: + HASH_INVOKE_FROM_EVAL(0x542FBDCF960031F5LL, fprintf); + HASH_INVOKE_FROM_EVAL(0x02ABC00C046291F5LL, imageellipse); + break; + case 506: + HASH_INVOKE_FROM_EVAL(0x135D5CBF936B11FALL, msg_receive); + break; + case 509: + HASH_INVOKE_FROM_EVAL(0x5304E6B47ED0B1FDLL, srand); + break; + case 514: + HASH_INVOKE_FROM_EVAL(0x16699E33370A8202LL, idn_to_unicode); + break; + case 515: + HASH_INVOKE_FROM_EVAL(0x5B3C354575BB8203LL, mysql_free_result); + break; + case 520: + HASH_INVOKE_FROM_EVAL(0x7B525920E026C208LL, gztell); + break; + case 524: + HASH_INVOKE_FROM_EVAL(0x41B15671649A320CLL, curl_multi_getcontent); + HASH_INVOKE_FROM_EVAL(0x257BEA4D6DC9920CLL, ctype_alnum); + break; + case 525: + HASH_INVOKE_FROM_EVAL(0x5C0DECC8CC67E20DLL, magickwriteimagesfile); + break; + case 526: + HASH_INVOKE_FROM_EVAL(0x533642044A00520ELL, pixelgetmagentaquantum); + break; + case 527: + HASH_INVOKE_FROM_EVAL(0x08DC8BF3ADAE520FLL, getallheaders); + HASH_INVOKE_FROM_EVAL(0x53631CF3A937320FLL, get_class_methods); + break; + case 528: + HASH_INVOKE_FROM_EVAL(0x15EF510022CAF210LL, xml_parser_create_ns); + HASH_INVOKE_FROM_EVAL(0x2D41D7F8F4113210LL, sinh); + break; + case 529: + HASH_INVOKE_FROM_EVAL(0x438CD1A0327A8211LL, apc_define_constants); + break; + case 532: + HASH_INVOKE_FROM_EVAL(0x7D85E9FACB92D214LL, magickgetimageblob); + break; + case 536: + HASH_INVOKE_FROM_EVAL(0x56C95225813A5218LL, memory_get_usage); + break; + case 538: + HASH_INVOKE_FROM_EVAL(0x72C0C89D897E721ALL, magicksetimagetype); + break; + case 539: + HASH_INVOKE_FROM_EVAL(0x3A90CC67D58A021BLL, hash_hmac_file); + break; + case 545: + HASH_INVOKE_FROM_EVAL(0x345E2BAE171FA221LL, date_sunrise); + break; + case 546: + HASH_INVOKE_FROM_EVAL(0x39E4E0175FADC222LL, drawskewx); + break; + case 551: + HASH_INVOKE_FROM_EVAL(0x5A26F00A81BA5227LL, xmlwriter_start_attribute_ns); + break; + case 552: + HASH_INVOKE_FROM_EVAL(0x44911AEE34D63228LL, time_sleep_until); + break; + case 556: + HASH_INVOKE_FROM_EVAL(0x4129FFBF3548E22CLL, mb_strpos); + break; + case 561: + HASH_INVOKE_FROM_EVAL(0x61A192D10C004231LL, magickconvolveimage); + HASH_INVOKE_FROM_EVAL(0x7C07D66F70E43231LL, mailparse_determine_best_xfer_encoding); + break; + case 564: + HASH_INVOKE_FROM_EVAL(0x422C51C95928A234LL, str_replace); + break; + case 566: + HASH_INVOKE_FROM_EVAL(0x5542AABF33A2F236LL, stream_filter_remove); + break; + case 568: + HASH_INVOKE_FROM_EVAL(0x695AC59F79E2A238LL, mb_encode_mimeheader); + break; + case 570: + HASH_INVOKE_FROM_EVAL(0x679ABBE5A08C523ALL, xml_parse_into_struct); + break; + case 574: + HASH_INVOKE_FROM_EVAL(0x5E54CE856B78223ELL, array_flip); + break; + case 576: + HASH_INVOKE_FROM_EVAL(0x0DB9DD4AE24B0240LL, base64_encode); + break; + case 579: + HASH_INVOKE_FROM_EVAL(0x78183A24F2ACB243LL, strtotime); + break; + case 584: + HASH_INVOKE_FROM_EVAL(0x7071BB6F0591E248LL, serialize); + break; + case 591: + HASH_INVOKE_FROM_EVAL(0x1D8FE8E68F7EA24FLL, pixelsetiteratorrow); + break; + case 592: + HASH_INVOKE_FROM_EVAL(0x30747B708DA1D250LL, pushdrawingwand); + break; + case 598: + HASH_INVOKE_FROM_EVAL(0x0384346A8857D256LL, clonemagickwand); + break; + case 603: + HASH_INVOKE_FROM_EVAL(0x2F8F40E95EDF925BLL, sizeof); + break; + case 605: + HASH_INVOKE_FROM_EVAL(0x7E6024E53AEEE25DLL, apc_delete); + break; + case 608: + HASH_INVOKE_FROM_EVAL(0x71D2D4757B7E4260LL, apache_request_headers); + break; + case 609: + HASH_INVOKE_FROM_EVAL(0x383800902035F261LL, apache_child_terminate); + HASH_INVOKE_FROM_EVAL(0x48305E8ABB8BC261LL, hphp_instanceof); + break; + case 610: + HASH_INVOKE_FROM_EVAL(0x63AC0EED6D946262LL, pcntl_fork); + break; + case 612: + HASH_INVOKE_FROM_EVAL(0x261F403C4174D264LL, posix_getsid); + break; + case 613: + HASH_INVOKE_FROM_EVAL(0x561DB8F1DC0BC265LL, magickseparateimagechannel); + break; + case 615: + HASH_INVOKE_FROM_EVAL(0x50C5488E19492267LL, mb_list_encodings_alias_names); + HASH_INVOKE_FROM_EVAL(0x38B376B9D9091267LL, xmlwriter_write_attribute); + break; + case 620: + HASH_INVOKE_FROM_EVAL(0x188DF1EB5FD1B26CLL, mailparse_msg_parse_file); + break; + case 622: + HASH_INVOKE_FROM_EVAL(0x5672949384A4F26ELL, stream_filter_register); + break; + case 626: + HASH_INVOKE_FROM_EVAL(0x1C65F32FF28BC272LL, pathinfo); + break; + case 627: + HASH_INVOKE_FROM_EVAL(0x61C991F216E85273LL, inet_ntop); + break; + case 634: + HASH_INVOKE_FROM_EVAL(0x39E05F957C7DD27ALL, magickgetimagedepth); + break; + case 636: + HASH_INVOKE_FROM_EVAL(0x0F7E33D551E0727CLL, posix_getpid); + break; + case 637: + HASH_INVOKE_FROM_EVAL(0x7DB57C59E607627DLL, mcrypt_generic_deinit); + break; + case 638: + HASH_INVOKE_FROM_EVAL(0x4111669F4862E27ELL, drawpathlinetoverticalrelative); + break; + case 639: + HASH_INVOKE_FROM_EVAL(0x5B94A6962F1EC27FLL, magickechoimagesblob); + HASH_INVOKE_FROM_EVAL(0x57E8781CF111727FLL, fileowner); + break; + case 641: + HASH_INVOKE_FROM_EVAL(0x1765A2E5186DE281LL, socket_write); + HASH_INVOKE_FROM_EVAL(0x0881440DCF5D3281LL, magickflattenimages); + break; + case 643: + HASH_INVOKE_FROM_EVAL(0x4C83B098C8BDA283LL, posix_setsid); + break; + case 645: + HASH_INVOKE_FROM_EVAL(0x5F7DC3612050A285LL, drawsetfontweight); + HASH_INVOKE_FROM_EVAL(0x1A895A2307126285LL, openssl_pkcs7_decrypt); + break; + case 646: + HASH_INVOKE_FROM_EVAL(0x3A2E2C40B019E286LL, is_a); + HASH_INVOKE_FROM_EVAL(0x4F028FA6AAEEC286LL, call_user_method); + break; + case 647: + HASH_INVOKE_FROM_EVAL(0x27698DDEDAD6E287LL, openssl_pkey_new); + break; + case 656: + HASH_INVOKE_FROM_EVAL(0x04C11602C720A290LL, convert_cyr_string); + break; + case 660: + HASH_INVOKE_FROM_EVAL(0x4D05DD57E4052294LL, xmlwriter_output_memory); + break; + case 661: + HASH_INVOKE_FROM_EVAL(0x69868C648BC12295LL, apc_store); + break; + case 665: + HASH_INVOKE_FROM_EVAL(0x22D380E06E67E299LL, stream_encoding); + break; + case 666: + HASH_INVOKE_FROM_EVAL(0x68272A37CC9E729ALL, mb_strtolower); + break; + case 667: + HASH_INVOKE_FROM_EVAL(0x4A09634AE6DFF29BLL, fileperms); + break; + case 668: + HASH_INVOKE_FROM_EVAL(0x0F71D3E47044E29CLL, drawpathcurvetosmoothrelative); + break; + case 675: + HASH_INVOKE_FROM_EVAL(0x10E7B5A0E29CF2A3LL, bcscale); + HASH_INVOKE_FROM_EVAL(0x743EA4BF2CC8F2A3LL, mysql_field_type); + break; + case 678: + HASH_INVOKE_FROM_EVAL(0x73EF3A19F76872A6LL, iconv_strrpos); + break; + case 680: + HASH_INVOKE_FROM_EVAL(0x5409127FEDE332A8LL, exif_imagetype); + break; + case 685: + HASH_INVOKE_FROM_EVAL(0x35D259398CDDA2ADLL, pixelgetredquantum); + HASH_INVOKE_FROM_EVAL(0x00AB6FC4E9EE62ADLL, imagefilledrectangle); + break; + case 686: + HASH_INVOKE_FROM_EVAL(0x36AB9E6AA687F2AELL, xmlwriter_start_dtd_element); + break; + case 691: + HASH_INVOKE_FROM_EVAL(0x44530C37F2B522B3LL, drawgetstrokedasharray); + HASH_INVOKE_FROM_EVAL(0x59BB7B8078AC22B3LL, tempnam); + break; + case 694: + HASH_INVOKE_FROM_EVAL(0x0C4B98B47B0862B6LL, apd_echo); + HASH_INVOKE_FROM_EVAL(0x0E9C9B409F94B2B6LL, setcookie); + break; + case 696: + HASH_INVOKE_FROM_EVAL(0x3C6D50F3BB8102B8LL, next); + break; + case 698: + HASH_INVOKE_FROM_EVAL(0x4A3D2113D3DFD2BALL, newpixelwandarray); + break; + case 700: + HASH_INVOKE_FROM_EVAL(0x33E08846F3EB42BCLL, ldap_get_values); + HASH_INVOKE_FROM_EVAL(0x41F7E2214DDE12BCLL, mcrypt_enc_self_test); + break; + case 701: + HASH_INVOKE_FROM_EVAL(0x327C865E52FD12BDLL, ldap_get_values_len); + break; + case 702: + HASH_INVOKE_FROM_EVAL(0x72D6F9B3661AB2BELL, magickgetimage); + break; + case 704: + HASH_INVOKE_FROM_EVAL(0x5B7C1B74BA3452C0LL, newpixelregioniterator); + break; + case 707: + HASH_INVOKE_FROM_EVAL(0x446D76A95365D2C3LL, pixelgetyellow); + break; + case 708: + HASH_INVOKE_FROM_EVAL(0x6018C9F7DF40C2C4LL, xml_get_current_column_number); + break; + case 716: + HASH_INVOKE_FROM_EVAL(0x407EF03C23BF92CCLL, drawpathellipticarcabsolute); + HASH_INVOKE_FROM_EVAL(0x44273F8BA3F542CCLL, imagesx); + break; + case 718: + HASH_INVOKE_FROM_EVAL(0x1922D51F3E1522CELL, xmlwriter_end_dtd_attlist); + break; + case 719: + HASH_INVOKE_FROM_EVAL(0x4ACE27EC476632CFLL, apc_bin_dumpfile); + break; + case 722: + HASH_INVOKE_FROM_EVAL(0x4D9A87BD0CF742D2LL, imagepsextendfont); + break; + case 725: + HASH_INVOKE_FROM_EVAL(0x4D04C580CF9212D5LL, posix_getgroups); + break; + case 728: + HASH_INVOKE_FROM_EVAL(0x56C4896BA2FF52D8LL, drawsetstrokeopacity); + break; + case 730: + HASH_INVOKE_FROM_EVAL(0x5C6A85B448C352DALL, posix_uname); + break; + case 738: + HASH_INVOKE_FROM_EVAL(0x4AEC19D75BF652E2LL, magickremoveimage); + break; + case 739: + HASH_INVOKE_FROM_EVAL(0x45382D0BA5B262E3LL, mysql_get_proto_info); + break; + case 749: + HASH_INVOKE_FROM_EVAL(0x215E0E2EFA7422EDLL, drawgetstrokeantialias); + break; + case 750: + HASH_INVOKE_FROM_EVAL(0x2884B7B3252B02EELL, imagealphablending); + break; + case 752: + HASH_INVOKE_FROM_EVAL(0x25CA0794823AA2F0LL, openssl_csr_get_public_key); + break; + case 754: + HASH_INVOKE_FROM_EVAL(0x2EE56D216BB832F2LL, time_nanosleep); + break; + case 756: + HASH_INVOKE_FROM_EVAL(0x418EC805C5FD32F4LL, mcrypt_get_key_size); + break; + case 761: + HASH_INVOKE_FROM_EVAL(0x00CFD56391DF82F9LL, mysql_data_seek); + HASH_INVOKE_FROM_EVAL(0x319EF52B36AAB2F9LL, posix_isatty); + break; + case 763: + HASH_INVOKE_FROM_EVAL(0x4D393D30CE1112FBLL, drawpathmovetoabsolute); + break; + case 764: + HASH_INVOKE_FROM_EVAL(0x66D59E4DBC7382FCLL, drawscale); + break; + case 766: + HASH_INVOKE_FROM_EVAL(0x208B66A8731F72FELL, sem_get); + HASH_INVOKE_FROM_EVAL(0x755A9950B65472FELL, drawgetgravity); + break; + case 770: + HASH_INVOKE_FROM_EVAL(0x0103FE1E2C307302LL, socket_recvfrom); + break; + case 773: + HASH_INVOKE_FROM_EVAL(0x65D40C6B4842F305LL, clearpixelwand); + break; + case 774: + HASH_INVOKE_FROM_EVAL(0x689D60184DD81306LL, htmlspecialchars_decode); + break; + case 777: + HASH_INVOKE_FROM_EVAL(0x414038596F552309LL, magickgetversionnumber); + HASH_INVOKE_FROM_EVAL(0x47CB27E8FDB60309LL, array_fill); + break; + case 779: + HASH_INVOKE_FROM_EVAL(0x0C6F751411F5E30BLL, strrev); + HASH_INVOKE_FROM_EVAL(0x65F586C35A88030BLL, magickresizeimage); + break; + case 789: + HASH_INVOKE_FROM_EVAL(0x4F1E663AE18FD315LL, msg_remove_queue); + break; + case 798: + HASH_INVOKE_FROM_EVAL(0x27FF9DB54420531ELL, xml_error_string); + break; + case 804: + HASH_INVOKE_FROM_EVAL(0x5E5E4F998C8E7324LL, pcntl_wifexited); + break; + case 808: + HASH_INVOKE_FROM_EVAL(0x73FEB3BF75FFB328LL, ctype_space); + break; + case 811: + HASH_INVOKE_FROM_EVAL(0x2BDB1EE3869E132BLL, restore_error_handler); + break; + case 815: + HASH_INVOKE_FROM_EVAL(0x7DD6461A6290B32FLL, mysql_real_escape_string); + break; + case 816: + HASH_INVOKE_FROM_EVAL(0x300F758BB0E16330LL, mysql_num_rows); + HASH_INVOKE_FROM_EVAL(0x1601C1826E90B330LL, strptime); + break; + case 817: + HASH_INVOKE_FROM_EVAL(0x00DAFE46631AE331LL, stream_set_timeout); + break; + case 818: + HASH_INVOKE_FROM_EVAL(0x037055C215998332LL, bcsub); + break; + case 824: + HASH_INVOKE_FROM_EVAL(0x549D51040C250338LL, cleardrawingwand); + break; + case 825: + HASH_INVOKE_FROM_EVAL(0x48D57F17C5132339LL, drawgetclippath); + break; + case 826: + HASH_INVOKE_FROM_EVAL(0x34DDF0DFC546033ALL, xbox_task_start); + break; + case 829: + HASH_INVOKE_FROM_EVAL(0x4E166ECE0EC6A33DLL, openssl_pkey_get_public); + break; + case 830: + HASH_INVOKE_FROM_EVAL(0x758EA7E9AA45C33ELL, xmlwriter_end_document); + break; + case 835: + HASH_INVOKE_FROM_EVAL(0x6794CFB89DEEF343LL, curl_exec); + break; + case 836: + HASH_INVOKE_FROM_EVAL(0x1A9DC76AB74F6344LL, openssl_verify); + break; + case 837: + HASH_INVOKE_FROM_EVAL(0x45FAE3D08E96B345LL, curl_errno); + break; + case 842: + HASH_INVOKE_FROM_EVAL(0x208BB4C3C0BA534ALL, xmlwriter_write_dtd_element); + break; + case 843: + HASH_INVOKE_FROM_EVAL(0x57A9E8878872D34BLL, parse_ini_file); + break; + case 844: + HASH_INVOKE_FROM_EVAL(0x0644E5FB91C8134CLL, array_udiff); + break; + case 845: + HASH_INVOKE_FROM_EVAL(0x5998E61D600D634DLL, drawaffine); + break; + case 847: + HASH_INVOKE_FROM_EVAL(0x5C8B3B9FA833934FLL, ldap_first_attribute); + break; + case 849: + HASH_INVOKE_FROM_EVAL(0x2B422699C3A57351LL, sha1); + break; + case 852: + HASH_INVOKE_FROM_EVAL(0x501F4DF5C8997354LL, hphp_get_property); + HASH_INVOKE_FROM_EVAL(0x77EB4D2F5BDDB354LL, magickgetimageresolution); + break; + case 858: + HASH_INVOKE_FROM_EVAL(0x4BF5DEBDB76EC35ALL, mcrypt_enc_get_iv_size); + HASH_INVOKE_FROM_EVAL(0x0E0C79E42812235ALL, imagepng); + break; + case 859: + HASH_INVOKE_FROM_EVAL(0x1AC48909BEEF935BLL, func_get_arg); + break; + case 861: + HASH_INVOKE_FROM_EVAL(0x54C3E9AB6FB8E35DLL, magickswirlimage); + break; + case 863: + HASH_INVOKE_FROM_EVAL(0x280DE04F84FB235FLL, popdrawingwand); + break; + case 870: + HASH_INVOKE_FROM_EVAL(0x4EF3469306E44366LL, floatval); + break; + case 871: + HASH_INVOKE_FROM_EVAL(0x4810A9774785C367LL, posix_getpgrp); + break; + case 872: + HASH_INVOKE_FROM_EVAL(0x5D406167C673D368LL, magickcompareimages); + break; + case 873: + HASH_INVOKE_FROM_EVAL(0x6C715D7DD63DA369LL, is_integer); + break; + case 878: + HASH_INVOKE_FROM_EVAL(0x7CE90898E882F36ELL, pixelsetyellow); + break; + case 882: + HASH_INVOKE_FROM_EVAL(0x7107AE03689F5372LL, hphp_invoke); + break; + case 889: + HASH_INVOKE_FROM_EVAL(0x5ED8901DB5D14379LL, magickcharcoalimage); + break; + case 900: + HASH_INVOKE_FROM_EVAL(0x44C1BC500D175384LL, wandgetexception); + break; + case 901: + HASH_INVOKE_FROM_EVAL(0x7C5CA3E2E3C8F385LL, magickflipimage); + HASH_INVOKE_FROM_EVAL(0x57554E082E0ED385LL, pcntl_exec); + break; + case 902: + HASH_INVOKE_FROM_EVAL(0x589E24C7664D5386LL, doubleval); + break; + case 904: + HASH_INVOKE_FROM_EVAL(0x791E946E04F50388LL, magicksetresourcelimit); + break; + case 907: + HASH_INVOKE_FROM_EVAL(0x73A3F87C0A56238BLL, stat); + break; + case 909: + HASH_INVOKE_FROM_EVAL(0x4127DE142CD4A38DLL, xml_get_error_code); + break; + case 913: + HASH_INVOKE_FROM_EVAL(0x25FA64929C619391LL, asin); + break; + case 914: + HASH_INVOKE_FROM_EVAL(0x2052D8D4822EF392LL, is_subclass_of); + break; + case 916: + HASH_INVOKE_FROM_EVAL(0x269A220896FD2394LL, deg2rad); + HASH_INVOKE_FROM_EVAL(0x36953788781F4394LL, mailparse_msg_extract_part); + break; + case 917: + HASH_INVOKE_FROM_EVAL(0x7B0552A224E27395LL, bcsqrt); + HASH_INVOKE_FROM_EVAL(0x422599B9E8AC0395LL, stream_bucket_make_writeable); + break; + case 918: + HASH_INVOKE_FROM_EVAL(0x15EC64198D93C396LL, openssl_pkcs12_read); + break; + case 919: + HASH_INVOKE_FROM_EVAL(0x1D2C305EA5C82397LL, idn_to_utf8); + break; + case 921: + HASH_INVOKE_FROM_EVAL(0x66DA89629BA5D399LL, posix_getgrgid); + break; + case 922: + HASH_INVOKE_FROM_EVAL(0x0CC562CBD773639ALL, i18n_loc_get_default); + break; + case 923: + HASH_INVOKE_FROM_EVAL(0x25DF28703309C39BLL, idate); + HASH_INVOKE_FROM_EVAL(0x5B33B55D4B7E339BLL, fpassthru); + break; + case 926: + HASH_INVOKE_FROM_EVAL(0x27AD0D17AA7FB39ELL, ldap_set_rebind_proc); + break; + case 927: + HASH_INVOKE_FROM_EVAL(0x57E72C21F67D039FLL, user_error); + HASH_INVOKE_FROM_EVAL(0x0368F1779E3AE39FLL, mysql_field_table); + break; + case 929: + HASH_INVOKE_FROM_EVAL(0x5C29B6D7973903A1LL, proc_nice); + break; + case 930: + HASH_INVOKE_FROM_EVAL(0x0207E332D629A3A2LL, mailparse_msg_get_structure); + HASH_INVOKE_FROM_EVAL(0x0A2A4AA078D433A2LL, hexdec); + break; + case 932: + HASH_INVOKE_FROM_EVAL(0x1676FB393F8493A4LL, constant); + break; + case 934: + HASH_INVOKE_FROM_EVAL(0x40E0D496EE29B3A6LL, call_user_func_array); + break; + case 936: + HASH_INVOKE_FROM_EVAL(0x4120B8157ED413A8LL, i18n_loc_set_strength); + break; + case 937: + HASH_INVOKE_FROM_EVAL(0x03A023F87CB923A9LL, oci_field_name); + break; + case 938: + HASH_INVOKE_FROM_EVAL(0x3238A5BD362443AALL, escapeshellcmd); + break; + case 946: + HASH_INVOKE_FROM_EVAL(0x3DB7EBC0B670C3B2LL, magicksetimageredprimary); + break; + case 947: + HASH_INVOKE_FROM_EVAL(0x61720D771D1A23B3LL, posix_getpwnam); + break; + case 948: + HASH_INVOKE_FROM_EVAL(0x2788C40C6AB4E3B4LL, oci_free_descriptor); + break; + case 950: + HASH_INVOKE_FROM_EVAL(0x6C07640F7C5BD3B6LL, imagettfbbox); + break; + case 955: + HASH_INVOKE_FROM_EVAL(0x5A3F5AAD1B13A3BBLL, is_executable); + break; + case 956: + HASH_INVOKE_FROM_EVAL(0x0629158C42C893BCLL, compact); + break; + case 957: + HASH_INVOKE_FROM_EVAL(0x60294C2616F6A3BDLL, mcrypt_enc_get_supported_key_sizes); + break; + case 958: + HASH_INVOKE_FROM_EVAL(0x49A34964289453BELL, eregi); + break; + case 959: + HASH_INVOKE_FROM_EVAL(0x0E38CDC93E5893BFLL, magicksetimagemattecolor); + break; + case 968: + HASH_INVOKE_FROM_EVAL(0x4D100C70E86593C8LL, stream_set_write_buffer); + HASH_INVOKE_FROM_EVAL(0x3101CE70BA49A3C8LL, error_reporting); + break; + case 971: + HASH_INVOKE_FROM_EVAL(0x0173CC6FACAB93CBLL, quotemeta); + HASH_INVOKE_FROM_EVAL(0x4C3B6BE9112E63CBLL, str_split); + break; + case 972: + HASH_INVOKE_FROM_EVAL(0x50C88817090C63CCLL, pcntl_wait); + break; + case 974: + HASH_INVOKE_FROM_EVAL(0x4F9F68F60FD7A3CELL, drawgetfillrule); + HASH_INVOKE_FROM_EVAL(0x02BEFBEE8287D3CELL, get_magic_quotes_runtime); + break; + case 978: + HASH_INVOKE_FROM_EVAL(0x67C155632E5373D2LL, mailparse_msg_create); + break; + case 979: + HASH_INVOKE_FROM_EVAL(0x734FD402E190E3D3LL, evhttp_async_get); + HASH_INVOKE_FROM_EVAL(0x0A8D4FAF266973D3LL, bcpow); + break; + case 983: + HASH_INVOKE_FROM_EVAL(0x7677A58EF5D593D7LL, oci_parse); + HASH_INVOKE_FROM_EVAL(0x382B5B1EF00153D7LL, imagecreatefrompng); + break; + case 996: + HASH_INVOKE_FROM_EVAL(0x7E7718CC939D63E4LL, setrawcookie); + break; + case 1000: + HASH_INVOKE_FROM_EVAL(0x6BB9D669DDB703E8LL, xml_get_current_byte_index); + HASH_INVOKE_FROM_EVAL(0x4A3127C309B0C3E8LL, drawsetstrokelinecap); + break; + case 1002: + HASH_INVOKE_FROM_EVAL(0x0D3C8F00B0C633EALL, inet_pton); + HASH_INVOKE_FROM_EVAL(0x6DA49696220FE3EALL, mailparse_rfc822_parse_addresses); + break; + case 1003: + HASH_INVOKE_FROM_EVAL(0x1DAE0831CECB63EBLL, ob_get_clean); + break; + case 1006: + HASH_INVOKE_FROM_EVAL(0x598472448937E3EELL, magickqueryfontmetrics); + break; + case 1009: + HASH_INVOKE_FROM_EVAL(0x5EFE291585A713F1LL, method_exists); + break; + case 1010: + HASH_INVOKE_FROM_EVAL(0x0FE12E46BC9853F2LL, stream_filter_append); + HASH_INVOKE_FROM_EVAL(0x41A19AE18BC8B3F2LL, curl_error); + HASH_INVOKE_FROM_EVAL(0x696241660648B3F2LL, magickwhitethresholdimage); + break; + case 1012: + HASH_INVOKE_FROM_EVAL(0x26D53A77483EF3F4LL, drawbezier); + break; + case 1013: + HASH_INVOKE_FROM_EVAL(0x34159AB5FE8FC3F5LL, oci_internal_debug); + break; + case 1015: + HASH_INVOKE_FROM_EVAL(0x43F22CB4E3E8F3F7LL, apache_note); + break; + case 1016: + HASH_INVOKE_FROM_EVAL(0x4C024573FCD5B3F8LL, var_dump); + HASH_INVOKE_FROM_EVAL(0x514EA9C8FF5B33F8LL, posix_getrlimit); + break; + case 1018: + HASH_INVOKE_FROM_EVAL(0x1B217E78CBC713FALL, zend_thread_id); + break; + case 1025: + HASH_INVOKE_FROM_EVAL(0x36B9C440B1881401LL, fmod); + HASH_INVOKE_FROM_EVAL(0x3DCB1C92B5864401LL, gzrewind); + break; + case 1028: + HASH_INVOKE_FROM_EVAL(0x2B12B0E9109D0404LL, iptcembed); + break; + case 1033: + HASH_INVOKE_FROM_EVAL(0x2E57E06900594409LL, xbox_send_message); + break; + case 1034: + HASH_INVOKE_FROM_EVAL(0x6DC61C51FA1D340ALL, show_source); + break; + case 1037: + HASH_INVOKE_FROM_EVAL(0x2939C5BAE0C4A40DLL, nl2br); + HASH_INVOKE_FROM_EVAL(0x267529454569840DLL, ob_flush); + HASH_INVOKE_FROM_EVAL(0x152C7161567F940DLL, func_num_args); + HASH_INVOKE_FROM_EVAL(0x002CCCD877D9640DLL, drawpathclose); + break; + case 1043: + HASH_INVOKE_FROM_EVAL(0x56EC1A6732D07413LL, drawgetfontsize); + HASH_INVOKE_FROM_EVAL(0x20C24D873DC65413LL, openssl_csr_get_subject); + break; + case 1051: + HASH_INVOKE_FROM_EVAL(0x47279C717370B41BLL, acos); + break; + case 1054: + HASH_INVOKE_FROM_EVAL(0x3E4E7C561D3A541ELL, fgetss); + break; + case 1055: + HASH_INVOKE_FROM_EVAL(0x301963016A91741FLL, hphp_stats); + break; + case 1059: + HASH_INVOKE_FROM_EVAL(0x4C9108B5A5807423LL, drawsetfillcolor); + break; + case 1062: + HASH_INVOKE_FROM_EVAL(0x21EFB0B9D1514426LL, magicksetpassphrase); + HASH_INVOKE_FROM_EVAL(0x161D8EA3339AB426LL, apc_cas); + break; + case 1068: + HASH_INVOKE_FROM_EVAL(0x12D324CC744BF42CLL, pixelgetcolorasstring); + break; + case 1069: + HASH_INVOKE_FROM_EVAL(0x333D1E2E28B0942DLL, imagejpeg); + HASH_INVOKE_FROM_EVAL(0x2A5A519E4BFE442DLL, mb_eregi); + break; + case 1071: + HASH_INVOKE_FROM_EVAL(0x316F2725AC15042FLL, stream_resolve_include_path); + break; + case 1074: + HASH_INVOKE_FROM_EVAL(0x71C6E38BC56CE432LL, stream_wrapper_register); + break; + case 1075: + HASH_INVOKE_FROM_EVAL(0x6829094421CDB433LL, touch); + break; + case 1077: + HASH_INVOKE_FROM_EVAL(0x75DAFEF5BFEF1435LL, imagesetstyle); + HASH_INVOKE_FROM_EVAL(0x6BE1C72A6609B435LL, fql_static_data_set_10); + HASH_INVOKE_FROM_EVAL(0x044386A0E8B25435LL, drawgetclipunits); + break; + case 1079: + HASH_INVOKE_FROM_EVAL(0x1AAF02CF6DEBB437LL, magickdeconstructimages); + break; + case 1081: + HASH_INVOKE_FROM_EVAL(0x34C52EF423EFD439LL, proc_open); + break; + case 1082: + HASH_INVOKE_FROM_EVAL(0x5019A1FBF377C43ALL, imagepsbbox); + break; + case 1084: + HASH_INVOKE_FROM_EVAL(0x59ECE01C7629643CLL, mysql_drop_db); + break; + case 1088: + HASH_INVOKE_FROM_EVAL(0x5247425ED698B440LL, hphp_thread_is_warmup_enabled); + break; + case 1089: + HASH_INVOKE_FROM_EVAL(0x158E2271E381C441LL, hash_file); + HASH_INVOKE_FROM_EVAL(0x05892E3C5B9EB441LL, closedir); + break; + case 1090: + HASH_INVOKE_FROM_EVAL(0x3F869126D0336442LL, trigger_error); + break; + case 1099: + HASH_INVOKE_FROM_EVAL(0x609D331E874A944BLL, fb_set_opcode); + break; + case 1105: + HASH_INVOKE_FROM_EVAL(0x7539134E1CC61451LL, xmlwriter_start_cdata); + break; + case 1106: + HASH_INVOKE_FROM_EVAL(0x1056EF1C14D2A452LL, socket_connect); + break; + case 1116: + HASH_INVOKE_FROM_EVAL(0x436AB52B2099145CLL, ldap_close); + break; + case 1117: + HASH_INVOKE_FROM_EVAL(0x0246AF48CD31245DLL, count_chars); + break; + case 1118: + HASH_INVOKE_FROM_EVAL(0x0ED191E71A60545ELL, magicksetfirstiterator); + break; + case 1125: + HASH_INVOKE_FROM_EVAL(0x05D72365192CE465LL, fwrite); + HASH_INVOKE_FROM_EVAL(0x406A1404F48E4465LL, posix_getuid); + break; + case 1130: + HASH_INVOKE_FROM_EVAL(0x32643AE461D3F46ALL, mailparse_stream_encode); + break; + case 1132: + HASH_INVOKE_FROM_EVAL(0x07D959A8C0CF546CLL, stream_wrapper_unregister); + break; + case 1133: + HASH_INVOKE_FROM_EVAL(0x738D381800CE946DLL, ldap_parse_result); + HASH_INVOKE_FROM_EVAL(0x5229C0069FD7D46DLL, vfprintf); + break; + case 1136: + HASH_INVOKE_FROM_EVAL(0x0C626F268F120470LL, __halt_compiler); + break; + case 1139: + HASH_INVOKE_FROM_EVAL(0x0F8F276A48900473LL, drawgetstrokelinecap); + break; + case 1141: + HASH_INVOKE_FROM_EVAL(0x268706C46202C475LL, sem_acquire); + break; + case 1143: + HASH_INVOKE_FROM_EVAL(0x18666906A8001477LL, array_diff_assoc); + break; + case 1144: + HASH_INVOKE_FROM_EVAL(0x6497CC8295DDB478LL, fb_thrift_unserialize); + break; + case 1145: + HASH_INVOKE_FROM_EVAL(0x4859AF715D5A3479LL, magickmagnifyimage); + break; + case 1148: + HASH_INVOKE_FROM_EVAL(0x1A08C578AD3BC47CLL, apache_response_headers); + HASH_INVOKE_FROM_EVAL(0x2FA7269AB0E1147CLL, mysql_field_seek); + break; + case 1150: + HASH_INVOKE_FROM_EVAL(0x1D583AA4F7F6547ELL, drawpathlinetorelative); + HASH_INVOKE_FROM_EVAL(0x5A97A7211F52647ELL, fbml_get_children_count_11); + HASH_INVOKE_FROM_EVAL(0x0AC36D9F961B247ELL, newpixeliterator); + break; + case 1151: + HASH_INVOKE_FROM_EVAL(0x68AE04B02253B47FLL, mb_parse_str); + break; + case 1154: + HASH_INVOKE_FROM_EVAL(0x4590C853C2027482LL, magickembossimage); + break; + case 1157: + HASH_INVOKE_FROM_EVAL(0x250DD3D58EA37485LL, gmstrftime); + break; + case 1161: + HASH_INVOKE_FROM_EVAL(0x4F7EAF5B37663489LL, magickgetimageredprimary); + break; + case 1162: + HASH_INVOKE_FROM_EVAL(0x7E88764A1DE8548ALL, drawgetstrokewidth); + break; + case 1163: + HASH_INVOKE_FROM_EVAL(0x5860ACF621DD948BLL, is_file); + break; + case 1165: + HASH_INVOKE_FROM_EVAL(0x23511F83C2BC548DLL, header); + HASH_INVOKE_FROM_EVAL(0x275D127C87EF048DLL, mysql_db_query); + break; + case 1167: + HASH_INVOKE_FROM_EVAL(0x43672229728A648FLL, drawpushpattern); + break; + case 1171: + HASH_INVOKE_FROM_EVAL(0x56377FCC2447D493LL, magicksetimagepixels); + break; + case 1175: + HASH_INVOKE_FROM_EVAL(0x353E2A635A47F497LL, evhttp_get); + HASH_INVOKE_FROM_EVAL(0x5388045C2D13D497LL, mysql_num_fields); + break; + case 1181: + HASH_INVOKE_FROM_EVAL(0x7A59813AC331449DLL, mb_ereg_search_regs); + break; + case 1183: + HASH_INVOKE_FROM_EVAL(0x2B8C2AFB154E449FLL, oci_num_fields); + HASH_INVOKE_FROM_EVAL(0x7FF66005524E649FLL, drawgettextdecoration); + break; + case 1188: + HASH_INVOKE_FROM_EVAL(0x6EC476E42A53A4A4LL, ldap_err2str); + break; + case 1189: + HASH_INVOKE_FROM_EVAL(0x18BE9B1C2DE6D4A5LL, imagexbm); + break; + case 1193: + HASH_INVOKE_FROM_EVAL(0x386378F2BA3234A9LL, magickevaluateimage); + break; + case 1196: + HASH_INVOKE_FROM_EVAL(0x245AA2790C87C4ACLL, image_type_to_mime_type); + HASH_INVOKE_FROM_EVAL(0x6E8FFA56842304ACLL, drawgetfont); + break; + case 1197: + HASH_INVOKE_FROM_EVAL(0x3D98ACFCEBB764ADLL, hphp_set_property); + break; + case 1199: + HASH_INVOKE_FROM_EVAL(0x42463E7E5C3434AFLL, mb_strrichr); + HASH_INVOKE_FROM_EVAL(0x6AC751181531F4AFLL, simplexml_load_string); + break; + case 1200: + HASH_INVOKE_FROM_EVAL(0x0E11D317044974B0LL, magickgetnumberimages); + HASH_INVOKE_FROM_EVAL(0x3AF65A9F3653E4B0LL, addslashes); + break; + case 1201: + HASH_INVOKE_FROM_EVAL(0x060619D7A1B5F4B1LL, checkdate); + break; + case 1203: + HASH_INVOKE_FROM_EVAL(0x57034CAD772AF4B3LL, magickgetimagechannelmean); + break; + case 1206: + HASH_INVOKE_FROM_EVAL(0x12A9166E68DCF4B6LL, pixelgetgreen); + break; + case 1207: + HASH_INVOKE_FROM_EVAL(0x7EEBC81AF9BC54B7LL, xml_parser_free); + break; + case 1209: + HASH_INVOKE_FROM_EVAL(0x5351290CD139A4B9LL, mb_strrpos); + break; + case 1210: + HASH_INVOKE_FROM_EVAL(0x6B49D11E633274BALL, fopen); + break; + case 1213: + HASH_INVOKE_FROM_EVAL(0x35BE8F6E7726C4BDLL, dechex); + HASH_INVOKE_FROM_EVAL(0x5BA371A93F60F4BDLL, use_soap_error_handler); + break; + case 1214: + HASH_INVOKE_FROM_EVAL(0x57278846B8B0E4BELL, ldap_count_entries); + break; + case 1215: + HASH_INVOKE_FROM_EVAL(0x01681C307C5AE4BFLL, strtoupper); + break; + case 1219: + HASH_INVOKE_FROM_EVAL(0x7AAC29849263C4C3LL, getprotobyname); + break; + case 1220: + HASH_INVOKE_FROM_EVAL(0x67EADCF4E81084C4LL, mb_ereg); + break; + case 1221: + HASH_INVOKE_FROM_EVAL(0x34A38DDF2CD914C5LL, long2ip); + break; + case 1222: + HASH_INVOKE_FROM_EVAL(0x651F7FBBA90604C6LL, magickgetimageindex); + break; + case 1224: + HASH_INVOKE_FROM_EVAL(0x1B8BBFC882FDB4C8LL, magicktintimage); + break; + case 1230: + HASH_INVOKE_FROM_EVAL(0x60783C20BF7724CELL, mailparse_msg_free); + break; + case 1231: + HASH_INVOKE_FROM_EVAL(0x72DECE786967A4CFLL, magickpreviousimage); + break; + case 1232: + HASH_INVOKE_FROM_EVAL(0x7DF31BD0D23FD4D0LL, oci_num_rows); + break; + case 1233: + HASH_INVOKE_FROM_EVAL(0x29EE24C41FD3D4D1LL, mysql_field_name); + break; + case 1238: + HASH_INVOKE_FROM_EVAL(0x19ECDD5A937DD4D6LL, mailparse_msg_get_part_data); + break; + case 1239: + HASH_INVOKE_FROM_EVAL(0x215403F1E335C4D7LL, magicksolarizeimage); + break; + case 1240: + HASH_INVOKE_FROM_EVAL(0x2532EB687D51E4D8LL, unregister_tick_function); + HASH_INVOKE_FROM_EVAL(0x14BF763DDDC014D8LL, imagepsencodefont); + HASH_INVOKE_FROM_EVAL(0x56B908FC91C834D8LL, magickflopimage); + HASH_INVOKE_FROM_EVAL(0x1301F911ED6D54D8LL, is_nan); + HASH_INVOKE_FROM_EVAL(0x575C5AE3D2A694D8LL, ob_end_clean); + break; + case 1247: + HASH_INVOKE_FROM_EVAL(0x747A7F585CD694DFLL, zend_version); + HASH_INVOKE_FROM_EVAL(0x2E5E5A0FC3B5C4DFLL, xml_set_character_data_handler); + break; + case 1248: + HASH_INVOKE_FROM_EVAL(0x340A51AE22A924E0LL, reset); + break; + case 1251: + HASH_INVOKE_FROM_EVAL(0x7D57A0D72D6254E3LL, ob_implicit_flush); + break; + case 1253: + HASH_INVOKE_FROM_EVAL(0x52951AFD1514B4E5LL, fql_multiparse_10); + break; + case 1262: + HASH_INVOKE_FROM_EVAL(0x5895ADDD91F354EELL, hphp_thread_set_warmup_enabled); + break; + case 1265: + HASH_INVOKE_FROM_EVAL(0x65BD541EAB38E4F1LL, mysql_close); + break; + case 1268: + HASH_INVOKE_FROM_EVAL(0x436B36C5EB8DB4F4LL, mcrypt_generic); + break; + case 1269: + HASH_INVOKE_FROM_EVAL(0x528AC8D252D224F5LL, log10); + HASH_INVOKE_FROM_EVAL(0x112A0ACDD8B9D4F5LL, mb_list_mime_names); + break; + case 1272: + HASH_INVOKE_FROM_EVAL(0x011006D90D79E4F8LL, mysql_errno); + break; + case 1277: + HASH_INVOKE_FROM_EVAL(0x002387F1D23B44FDLL, mcrypt_list_modes); + break; + case 1287: + HASH_INVOKE_FROM_EVAL(0x197A5D237BD4C507LL, mb_ereg_search_getpos); + break; + case 1288: + HASH_INVOKE_FROM_EVAL(0x63A08D6AD1209508LL, magickgetexception); + break; + case 1295: + HASH_INVOKE_FROM_EVAL(0x5A66CCB3D924450FLL, xml_parser_create); + break; + case 1297: + HASH_INVOKE_FROM_EVAL(0x09D5355CA8198511LL, mb_internal_encoding); + HASH_INVOKE_FROM_EVAL(0x3C0304A55503D511LL, magickgetimageiterations); + break; + case 1299: + HASH_INVOKE_FROM_EVAL(0x772E8BF114FEF513LL, eregi_replace); + break; + case 1300: + HASH_INVOKE_FROM_EVAL(0x100385A0988FD514LL, magickgetfilename); + break; + case 1314: + HASH_INVOKE_FROM_EVAL(0x7DA98E0379D33522LL, chdir); + break; + case 1316: + HASH_INVOKE_FROM_EVAL(0x28E724EDE0BB6524LL, mb_strcut); + break; + case 1317: + HASH_INVOKE_FROM_EVAL(0x230FE1D6EC599525LL, link); + break; + case 1318: + HASH_INVOKE_FROM_EVAL(0x57DDA4C3F7FF8526LL, fputcsv); + break; + case 1319: + HASH_INVOKE_FROM_EVAL(0x6B2B942CAF1A2527LL, array_shift); + break; + case 1324: + HASH_INVOKE_FROM_EVAL(0x1AB55BBA0967952CLL, mb_convert_variables); + break; + case 1327: + HASH_INVOKE_FROM_EVAL(0x6770E2559C9A152FLL, openssl_private_decrypt); + break; + case 1329: + HASH_INVOKE_FROM_EVAL(0x6776C27C6123D531LL, dl); + break; + case 1330: + HASH_INVOKE_FROM_EVAL(0x6193A26936F4D532LL, disk_total_space); + break; + case 1331: + HASH_INVOKE_FROM_EVAL(0x313D2A505076A533LL, dir); + break; + case 1333: + HASH_INVOKE_FROM_EVAL(0x6C87406DDC0AB535LL, mcrypt_ecb); + break; + case 1334: + HASH_INVOKE_FROM_EVAL(0x0E80D04691227536LL, eval); + break; + case 1335: + HASH_INVOKE_FROM_EVAL(0x557C72DE98679537LL, hash_update_stream); + HASH_INVOKE_FROM_EVAL(0x175B86BCB3124537LL, magickgetexceptionstring); + break; + case 1337: + HASH_INVOKE_FROM_EVAL(0x3C88F0FAC3EDD539LL, phpversion); + break; + case 1340: + HASH_INVOKE_FROM_EVAL(0x5CA55E62F2A5953CLL, drawgetstrokeopacity); + break; + case 1341: + HASH_INVOKE_FROM_EVAL(0x0F32841DBF7A053DLL, fb_crossall_query); + break; + case 1342: + HASH_INVOKE_FROM_EVAL(0x36A80B48E08B753ELL, implode); + break; + case 1346: + HASH_INVOKE_FROM_EVAL(0x59A44591E67D4542LL, drawrender); + break; + case 1347: + HASH_INVOKE_FROM_EVAL(0x20E2B1D920122543LL, die); + break; + case 1348: + HASH_INVOKE_FROM_EVAL(0x4D397FE5D0C0B544LL, magickmedianfilterimage); + break; + case 1350: + HASH_INVOKE_FROM_EVAL(0x12A739BE0ED32546LL, ignore_user_abort); + HASH_INVOKE_FROM_EVAL(0x081F76AC889BC546LL, getrusage); + break; + case 1352: + HASH_INVOKE_FROM_EVAL(0x0AD3BFAB5F780548LL, magickcoalesceimages); + break; + case 1355: + HASH_INVOKE_FROM_EVAL(0x40CE61115E11154BLL, msg_stat_queue); + break; + case 1357: + HASH_INVOKE_FROM_EVAL(0x0F0702D91EAFB54DLL, drawgettextantialias); + HASH_INVOKE_FROM_EVAL(0x1B9E769FFEC3C54DLL, pcntl_wtermsig); + break; + case 1359: + HASH_INVOKE_FROM_EVAL(0x063200B5AAFEC54FLL, mysql_thread_id); + break; + case 1370: + HASH_INVOKE_FROM_EVAL(0x268EE73DB2EA555ALL, get_object_vars); + break; + case 1372: + HASH_INVOKE_FROM_EVAL(0x5749AD20CAFCD55CLL, pixelgetbluequantum); + break; + case 1379: + HASH_INVOKE_FROM_EVAL(0x1B1B2D70792D9563LL, mysql_get_client_info); + break; + case 1382: + HASH_INVOKE_FROM_EVAL(0x6E2FDBD28F895566LL, timezone_abbreviations_list); + HASH_INVOKE_FROM_EVAL(0x3DA2058E5C540566LL, spliti); + break; + case 1386: + HASH_INVOKE_FROM_EVAL(0x74599147803DC56ALL, magickgetstringwidth); + break; + case 1387: + HASH_INVOKE_FROM_EVAL(0x0DE86977367F656BLL, register_shutdown_function); + break; + case 1390: + HASH_INVOKE_FROM_EVAL(0x2A1F1B52160DE56ELL, zend_logo_guid); + break; + case 1391: + HASH_INVOKE_FROM_EVAL(0x016722439BBA756FLL, filetype); + break; + case 1392: + HASH_INVOKE_FROM_EVAL(0x13D0427F3BB3E570LL, get_declared_interfaces); + HASH_INVOKE_FROM_EVAL(0x21B3935EB3140570LL, mysql_fetch_object); + break; + case 1393: + HASH_INVOKE_FROM_EVAL(0x2AD3361DE8B1D571LL, pcntl_signal_dispatch); + break; + case 1396: + HASH_INVOKE_FROM_EVAL(0x636C871213F37574LL, mcrypt_encrypt); + break; + case 1399: + HASH_INVOKE_FROM_EVAL(0x412521E7ADB21577LL, iconv_mime_decode_headers); + HASH_INVOKE_FROM_EVAL(0x1E154D823451B577LL, magicksetresolution); + break; + case 1400: + HASH_INVOKE_FROM_EVAL(0x588DE7449C8E0578LL, oci_connect); + break; + case 1401: + HASH_INVOKE_FROM_EVAL(0x1DC8A386E219C579LL, ldap_add); + break; + case 1405: + HASH_INVOKE_FROM_EVAL(0x78EDB608B02A857DLL, join); + HASH_INVOKE_FROM_EVAL(0x22E08DEDF360057DLL, pixelsetmagenta); + break; + case 1406: + HASH_INVOKE_FROM_EVAL(0x31529E9BCA1E157ELL, shm_remove); + HASH_INVOKE_FROM_EVAL(0x132776D93181E57ELL, ldap_set_option); + break; + case 1410: + HASH_INVOKE_FROM_EVAL(0x02688986D5D76582LL, magickspreadimage); + HASH_INVOKE_FROM_EVAL(0x0B1F0EB755BDB582LL, ispixeliterator); + break; + case 1411: + HASH_INVOKE_FROM_EVAL(0x3B2CD86F5DB72583LL, magickblackthresholdimage); + break; + case 1419: + HASH_INVOKE_FROM_EVAL(0x3A34B44E4C51C58BLL, xml_set_element_handler); + break; + case 1420: + HASH_INVOKE_FROM_EVAL(0x560C2F71978CE58CLL, shm_put_var); + break; + case 1426: + HASH_INVOKE_FROM_EVAL(0x3E9519FE856C4592LL, curl_multi_init); + HASH_INVOKE_FROM_EVAL(0x5464E148E8A0C592LL, get_extension_funcs); + HASH_INVOKE_FROM_EVAL(0x7F65501600346592LL, mcrypt_get_block_size); + break; + case 1431: + HASH_INVOKE_FROM_EVAL(0x513787A813DB0597LL, date_date_set); + break; + case 1433: + HASH_INVOKE_FROM_EVAL(0x12F502A88E0AA599LL, magickcompositeimage); + break; + case 1434: + HASH_INVOKE_FROM_EVAL(0x77F1EDE7D5EF759ALL, apc_cache_info); + break; + case 1435: + HASH_INVOKE_FROM_EVAL(0x37D003B09D0C759BLL, stream_get_contents); + break; + case 1440: + HASH_INVOKE_FROM_EVAL(0x20502FCACBB9F5A0LL, convert_uuencode); + break; + case 1441: + HASH_INVOKE_FROM_EVAL(0x297690F3A63335A1LL, magickrotateimage); + break; + case 1444: + HASH_INVOKE_FROM_EVAL(0x3C014439AE5D75A4LL, magickgetcharheight); + break; + case 1448: + HASH_INVOKE_FROM_EVAL(0x4FBB1F662399A5A8LL, is_soap_fault); + break; + case 1451: + HASH_INVOKE_FROM_EVAL(0x79E0380A18A345ABLL, apache_get_modules); + break; + case 1452: + HASH_INVOKE_FROM_EVAL(0x763BA2B1C60A55ACLL, pixelgetalphaquantum); + break; + case 1453: + HASH_INVOKE_FROM_EVAL(0x4110AF96B98B25ADLL, gzeof); + break; + case 1455: + HASH_INVOKE_FROM_EVAL(0x1636FBA5043CF5AFLL, ldap_error); + break; + case 1459: + HASH_INVOKE_FROM_EVAL(0x001DBE44BC0B55B3LL, magicksetimagecolormapcolor); + break; + case 1461: + HASH_INVOKE_FROM_EVAL(0x3F9C5B4708FC55B5LL, timezone_name_get); + HASH_INVOKE_FROM_EVAL(0x5EFE573046B565B5LL, mcrypt_module_close); + break; + case 1466: + HASH_INVOKE_FROM_EVAL(0x05B8EB2C515885BALL, vprintf); + break; + case 1472: + HASH_INVOKE_FROM_EVAL(0x61465CD8C67905C0LL, openssl_pkey_free); + break; + case 1473: + HASH_INVOKE_FROM_EVAL(0x7731B90FB7C975C1LL, magickremoveimageprofile); + break; + case 1478: + HASH_INVOKE_FROM_EVAL(0x3B3D5CE69B1565C6LL, mcrypt_module_is_block_mode); + break; + case 1481: + HASH_INVOKE_FROM_EVAL(0x75B299F5E35A95C9LL, mb_strwidth); + break; + case 1483: + HASH_INVOKE_FROM_EVAL(0x6751946191FBE5CBLL, override_function); + break; + case 1484: + HASH_INVOKE_FROM_EVAL(0x2A6F86821A39C5CCLL, expm1); + break; + case 1487: + HASH_INVOKE_FROM_EVAL(0x5D9818B3E1C385CFLL, openssl_pkey_export_to_file); + break; + case 1489: + HASH_INVOKE_FROM_EVAL(0x054503DBBF5CA5D1LL, imagecopy); + break; + case 1492: + HASH_INVOKE_FROM_EVAL(0x2FE56B4C457AB5D4LL, ctype_graph); + break; + case 1493: + HASH_INVOKE_FROM_EVAL(0x5295463221FB45D5LL, phprof_enable); + HASH_INVOKE_FROM_EVAL(0x43901543EA8625D5LL, curl_multi_select); + break; + case 1494: + HASH_INVOKE_FROM_EVAL(0x6D265875A19685D6LL, is_float); + break; + case 1495: + HASH_INVOKE_FROM_EVAL(0x617AD1AD708785D7LL, magickmodulateimage); + break; + case 1508: + HASH_INVOKE_FROM_EVAL(0x3A9643992AC805E4LL, magickdrawimage); + break; + case 1510: + HASH_INVOKE_FROM_EVAL(0x6FE2E44FBC44E5E6LL, magickaddnoiseimage); + HASH_INVOKE_FROM_EVAL(0x08069ECE0EA3C5E6LL, imagecopymergegray); + break; + case 1514: + HASH_INVOKE_FROM_EVAL(0x0B7ACBAB402015EALL, mb_send_mail); + break; + case 1518: + HASH_INVOKE_FROM_EVAL(0x3076D369F63E65EELL, pixelgetalpha); + break; + case 1524: + HASH_INVOKE_FROM_EVAL(0x1E89F15B7F2805F4LL, openssl_pkcs7_encrypt); + HASH_INVOKE_FROM_EVAL(0x459330C31956A5F4LL, vsprintf); + break; + case 1525: + HASH_INVOKE_FROM_EVAL(0x0D1BD0E5AF4175F5LL, drawsetfont); + HASH_INVOKE_FROM_EVAL(0x73A1F34DF95B35F5LL, get_defined_constants); + break; + case 1527: + HASH_INVOKE_FROM_EVAL(0x18E4CC945005E5F7LL, drawpushclippath); + break; + case 1528: + HASH_INVOKE_FROM_EVAL(0x7C48F6EA39B7B5F8LL, magickadaptivethresholdimage); + break; + case 1531: + HASH_INVOKE_FROM_EVAL(0x0FEC4ED541B7F5FBLL, magickgetimagevirtualpixelmethod); + break; + case 1532: + HASH_INVOKE_FROM_EVAL(0x39156C7CCE2D75FCLL, hash_update); + break; + case 1533: + HASH_INVOKE_FROM_EVAL(0x0C1CB24A3FC065FDLL, bcmul); + break; + case 1534: + HASH_INVOKE_FROM_EVAL(0x397D3C6576ED75FELL, set_include_path); + break; + case 1535: + HASH_INVOKE_FROM_EVAL(0x40A557CBB9FC35FFLL, mysql_tablename); + break; + case 1537: + HASH_INVOKE_FROM_EVAL(0x0F3403D8676C2601LL, mysql_query); + break; + case 1545: + HASH_INVOKE_FROM_EVAL(0x52D5698F31D12609LL, pcntl_setpriority); + break; + case 1555: + HASH_INVOKE_FROM_EVAL(0x36783304F63C4613LL, sscanf); + HASH_INVOKE_FROM_EVAL(0x4AC405EA2B8C4613LL, magickresetiterator); + break; + case 1557: + HASH_INVOKE_FROM_EVAL(0x6AD774816F8F7615LL, mb_strrchr); + break; + case 1558: + HASH_INVOKE_FROM_EVAL(0x66C7616225F1C616LL, pixelsetgreen); + HASH_INVOKE_FROM_EVAL(0x7FA6D13B0D38E616LL, imagegif); + break; + case 1561: + HASH_INVOKE_FROM_EVAL(0x6DD51BF03F003619LL, mailparse_uudecode_all); + HASH_INVOKE_FROM_EVAL(0x2F29627AF1A97619LL, shm_attach); + break; + case 1563: + HASH_INVOKE_FROM_EVAL(0x40DDE277D934061BLL, gzputs); + break; + case 1564: + HASH_INVOKE_FROM_EVAL(0x70725954DC99F61CLL, mcrypt_create_iv); + break; + case 1565: + HASH_INVOKE_FROM_EVAL(0x7E98B97C1B5D861DLL, magickqueryconfigureoptions); + break; + case 1569: + HASH_INVOKE_FROM_EVAL(0x0F71DDE51AA55621LL, hphp_output_global_state); + break; + case 1570: + HASH_INVOKE_FROM_EVAL(0x134550B9EB596622LL, drawgetfontstyle); + break; + case 1576: + HASH_INVOKE_FROM_EVAL(0x1E77B3BCF062D628LL, magickreadimage); + break; + case 1577: + HASH_INVOKE_FROM_EVAL(0x679B81CE06EE0629LL, bcdiv); + break; + case 1578: + HASH_INVOKE_FROM_EVAL(0x608EA42B08A7462ALL, linkinfo); + break; + case 1580: + HASH_INVOKE_FROM_EVAL(0x5CEA60D9C54A162CLL, pcntl_wifstopped); + break; + case 1583: + HASH_INVOKE_FROM_EVAL(0x652C331CE138362FLL, is_string); + break; + case 1585: + HASH_INVOKE_FROM_EVAL(0x5AD6595ACA656631LL, pixelresetiterator); + break; + case 1591: + HASH_INVOKE_FROM_EVAL(0x60276BC7990F9637LL, mysql_list_dbs); + HASH_INVOKE_FROM_EVAL(0x6723D4EF0880E637LL, fb_debug_rlog); + break; + case 1595: + HASH_INVOKE_FROM_EVAL(0x391C68F2BE85E63BLL, pixelgetiteratorexceptionstring); + break; + case 1596: + HASH_INVOKE_FROM_EVAL(0x62DE03461EF4663CLL, symlink); + break; + case 1598: + HASH_INVOKE_FROM_EVAL(0x60302D15A677963ELL, ldap_free_result); + break; + case 1599: + HASH_INVOKE_FROM_EVAL(0x17242BC6C9C9563FLL, crypt); + break; + case 1606: + HASH_INVOKE_FROM_EVAL(0x4901517CB796F646LL, msg_set_queue); + HASH_INVOKE_FROM_EVAL(0x234F6A0A486E8646LL, natcasesort); + break; + case 1613: + HASH_INVOKE_FROM_EVAL(0x4FAA0B35DDAB364DLL, oci_statement_type); + break; + case 1614: + HASH_INVOKE_FROM_EVAL(0x7E978C38D741664ELL, fgetcsv); + HASH_INVOKE_FROM_EVAL(0x769E5C6A5369F64ELL, ob_list_handlers); + break; + case 1617: + HASH_INVOKE_FROM_EVAL(0x5F3DA61B6506A651LL, oci_error); + break; + case 1621: + HASH_INVOKE_FROM_EVAL(0x629EDDC1E74ED655LL, array_uintersect_assoc); + HASH_INVOKE_FROM_EVAL(0x6BE3B1277BBF8655LL, oci_pconnect); + break; + case 1628: + HASH_INVOKE_FROM_EVAL(0x381BBFEABFEC865CLL, libxml_get_last_error); + break; + case 1630: + HASH_INVOKE_FROM_EVAL(0x205BB9CFF397B65ELL, ldap_mod_replace); + break; + case 1631: + HASH_INVOKE_FROM_EVAL(0x1355AFB40AB1165FLL, drawsetfontstyle); + break; + case 1636: + HASH_INVOKE_FROM_EVAL(0x5B0759F776EC2664LL, newdrawingwand); + break; + case 1637: + HASH_INVOKE_FROM_EVAL(0x08A6AD20C2C5A665LL, hphp_set_static_property); + break; + case 1647: + HASH_INVOKE_FROM_EVAL(0x7D68CADB8069466FLL, magickaverageimages); + break; + case 1651: + HASH_INVOKE_FROM_EVAL(0x126FC82D358E9673LL, magicksetimagevirtualpixelmethod); + break; + case 1655: + HASH_INVOKE_FROM_EVAL(0x001F23CAC36E3677LL, magickgetimagescene); + break; + case 1658: + HASH_INVOKE_FROM_EVAL(0x583AA7498A40E67ALL, drawgetcliprule); + break; + case 1659: + HASH_INVOKE_FROM_EVAL(0x5BCED33A57D9B67BLL, intval); + break; + case 1661: + HASH_INVOKE_FROM_EVAL(0x69616E2817E1967DLL, fileinode); + break; + case 1662: + HASH_INVOKE_FROM_EVAL(0x20B9799C1BDDE67ELL, oci_fetch); + break; + case 1666: + HASH_INVOKE_FROM_EVAL(0x665D2615E377A682LL, pagelet_server_task_start); + HASH_INVOKE_FROM_EVAL(0x5F6750E1C7E5D682LL, imageinterlace); + break; + case 1677: + HASH_INVOKE_FROM_EVAL(0x07A946E3DD8E968DLL, ldap_connect); + break; + case 1679: + HASH_INVOKE_FROM_EVAL(0x2EFF4F69EB1DF68FLL, apache_get_config); + break; + case 1680: + HASH_INVOKE_FROM_EVAL(0x166D5E2336878690LL, imagepolygon); + break; + case 1681: + HASH_INVOKE_FROM_EVAL(0x57BA0BC1A4870691LL, magickgetquantumdepth); + break; + case 1682: + HASH_INVOKE_FROM_EVAL(0x16BE0DBA42800692LL, magickgetimagesize); + break; + case 1684: + HASH_INVOKE_FROM_EVAL(0x2673FAB2B4DE4694LL, destroypixelwands); + break; + case 1685: + HASH_INVOKE_FROM_EVAL(0x7186EF5EF0581695LL, exp); + break; + case 1686: + HASH_INVOKE_FROM_EVAL(0x0DD7A2DB53093696LL, utf8_decode); + break; + case 1691: + HASH_INVOKE_FROM_EVAL(0x24D34E49C21DE69BLL, mb_stristr); + break; + case 1694: + HASH_INVOKE_FROM_EVAL(0x5E9821F06711669ELL, gethostbynamel); + break; + case 1702: + HASH_INVOKE_FROM_EVAL(0x0D841874977646A6LL, krsort); + break; + case 1703: + HASH_INVOKE_FROM_EVAL(0x38BBEE42F136D6A7LL, magickgetimageblueprimary); + break; + case 1704: + HASH_INVOKE_FROM_EVAL(0x45AB8F419BA666A8LL, drawpathlinetohorizontalabsolute); + break; + case 1706: + HASH_INVOKE_FROM_EVAL(0x6E9D4D3A119D76AALL, wandgetexceptiontype); + HASH_INVOKE_FROM_EVAL(0x48C4DB333172F6AALL, parse_url); + HASH_INVOKE_FROM_EVAL(0x541926FB6D6FC6AALL, magickgetimagecolors); + break; + case 1707: + HASH_INVOKE_FROM_EVAL(0x72B3F8E02D8B16ABLL, array_unshift); + break; + case 1711: + HASH_INVOKE_FROM_EVAL(0x65497D63C0D716AFLL, getdate); + break; + case 1712: + HASH_INVOKE_FROM_EVAL(0x23AAF570C78AC6B0LL, ip2long); + break; + case 1714: + HASH_INVOKE_FROM_EVAL(0x0D669C546C0EC6B2LL, proc_terminate); + break; + case 1717: + HASH_INVOKE_FROM_EVAL(0x798B4197212456B5LL, bcpowmod); + HASH_INVOKE_FROM_EVAL(0x623CE67C41A9E6B5LL, ldap_next_attribute); + HASH_INVOKE_FROM_EVAL(0x7E773A36449576B5LL, imagecharup); + break; + case 1720: + HASH_INVOKE_FROM_EVAL(0x44A226F0E402D6B8LL, oci_execute); + break; + case 1721: + HASH_INVOKE_FROM_EVAL(0x316F054CB76446B9LL, openssl_sign); + break; + case 1722: + HASH_INVOKE_FROM_EVAL(0x72B901C3605CB6BALL, pixelsetopacity); + break; + case 1726: + HASH_INVOKE_FROM_EVAL(0x081D5EA9920076BELL, drawgetfillalpha); + break; + case 1732: + HASH_INVOKE_FROM_EVAL(0x4842AF70A71BE6C4LL, uksort); + HASH_INVOKE_FROM_EVAL(0x34184B42D6AA86C4LL, mb_ereg_search_pos); + HASH_INVOKE_FROM_EVAL(0x3C042C09F662C6C4LL, drawsetstrokepatternurl); + break; + case 1733: + HASH_INVOKE_FROM_EVAL(0x28526EF49FF516C5LL, pixelsetgreenquantum); + break; + case 1736: + HASH_INVOKE_FROM_EVAL(0x29DD2C9F889246C8LL, passthru); + break; + case 1737: + HASH_INVOKE_FROM_EVAL(0x2D8DF100C30D06C9LL, xmlwriter_set_indent_string); + break; + case 1738: + HASH_INVOKE_FROM_EVAL(0x41BCD0A72B1396CALL, xmlwriter_start_dtd_attlist); + break; + case 1745: + HASH_INVOKE_FROM_EVAL(0x2B3D5B9AF915D6D1LL, imagecopymerge); + break; + case 1748: + HASH_INVOKE_FROM_EVAL(0x04A0E6E8337E56D4LL, drawcolor); + break; + case 1749: + HASH_INVOKE_FROM_EVAL(0x317FFA522A7D96D5LL, imagefilledpolygon); + break; + case 1750: + HASH_INVOKE_FROM_EVAL(0x158348EB08F406D6LL, strtr); + break; + case 1761: + HASH_INVOKE_FROM_EVAL(0x11DA0A0EB8E0D6E1LL, clock_getres); + break; + case 1764: + HASH_INVOKE_FROM_EVAL(0x40D0E3AF799226E4LL, bin2hex); + HASH_INVOKE_FROM_EVAL(0x1CF3544CB5C9D6E4LL, xml_set_processing_instruction_handler); + HASH_INVOKE_FROM_EVAL(0x31FFFC333AA6D6E4LL, drawsetfillrule); + break; + case 1767: + HASH_INVOKE_FROM_EVAL(0x44201A16F3D876E7LL, trim); + break; + case 1773: + HASH_INVOKE_FROM_EVAL(0x04BD4B43921956EDLL, ldap_search); + break; + case 1774: + HASH_INVOKE_FROM_EVAL(0x76382756EA00B6EELL, is_object); + break; + case 1775: + HASH_INVOKE_FROM_EVAL(0x0FA74D85885F86EFLL, output_add_rewrite_var); + break; + case 1776: + HASH_INVOKE_FROM_EVAL(0x014BD9A6823256F0LL, extract); + break; + case 1777: + HASH_INVOKE_FROM_EVAL(0x6B7347DF1AA7E6F1LL, drawpopdefs); + break; + case 1779: + HASH_INVOKE_FROM_EVAL(0x6F1968BE449FB6F3LL, stream_socket_pair); + HASH_INVOKE_FROM_EVAL(0x5768A80BB0B926F3LL, apd_set_session_trace_socket); + break; + case 1785: + HASH_INVOKE_FROM_EVAL(0x20740D956F0236F9LL, image2wbmp); + break; + case 1791: + HASH_INVOKE_FROM_EVAL(0x623C20A027A606FFLL, array_uintersect_uassoc); + break; + case 1793: + HASH_INVOKE_FROM_EVAL(0x1A80392751AA7701LL, magickgetformat); + break; + case 1796: + HASH_INVOKE_FROM_EVAL(0x5EFE15CE970A5704LL, drawpolyline); + break; + case 1801: + HASH_INVOKE_FROM_EVAL(0x21972B2BC7A14709LL, imageistruecolor); + break; + case 1803: + HASH_INVOKE_FROM_EVAL(0x5F7873F2DF5BE70BLL, ctype_cntrl); + break; + case 1805: + HASH_INVOKE_FROM_EVAL(0x7CE752299E80B70DLL, unserialize); + HASH_INVOKE_FROM_EVAL(0x4F3C0DB2F6C8F70DLL, unlink); + break; + case 1807: + HASH_INVOKE_FROM_EVAL(0x2FB2FA1DD832C70FLL, xmlwriter_write_attribute_ns); + break; + case 1812: + HASH_INVOKE_FROM_EVAL(0x1778ED2AF035F714LL, rsort); + break; + case 1813: + HASH_INVOKE_FROM_EVAL(0x25D578B4772C1715LL, define); + break; + case 1816: + HASH_INVOKE_FROM_EVAL(0x7971A5647C957718LL, date_time_set); + break; + case 1819: + HASH_INVOKE_FROM_EVAL(0x3C16230CBC6D471BLL, imagecreatetruecolor); + break; + case 1820: + HASH_INVOKE_FROM_EVAL(0x50AC61A28C5AC71CLL, imagecolorclosestalpha); + break; + case 1824: + HASH_INVOKE_FROM_EVAL(0x2D213FD80048F720LL, usleep); + break; + case 1827: + HASH_INVOKE_FROM_EVAL(0x78420E0B5D110723LL, imagetruecolortopalette); + break; + case 1828: + HASH_INVOKE_FROM_EVAL(0x4DAA3FBC2BD3A724LL, magickequalizeimage); + break; + case 1829: + HASH_INVOKE_FROM_EVAL(0x31EAD049860CE725LL, posix_kill); + break; + case 1830: + HASH_INVOKE_FROM_EVAL(0x523AB2EA95DAD726LL, get_included_files); + break; + case 1831: + HASH_INVOKE_FROM_EVAL(0x11641BE0F11CD727LL, magickgammaimage); + break; + case 1833: + HASH_INVOKE_FROM_EVAL(0x1D30F1E638D71729LL, readgzfile); + break; + case 1834: + HASH_INVOKE_FROM_EVAL(0x17C0D9B1C10B872ALL, openssl_x509_export); + HASH_INVOKE_FROM_EVAL(0x1F98B41362CDA72ALL, magickgetimagegreenprimary); + break; + case 1837: + HASH_INVOKE_FROM_EVAL(0x14563723F798172DLL, magickpaintopaqueimage); + break; + case 1840: + HASH_INVOKE_FROM_EVAL(0x0D558F552A784730LL, ob_get_contents); + break; + case 1842: + HASH_INVOKE_FROM_EVAL(0x2B1C192C419B8732LL, drawgetexception); + break; + case 1855: + HASH_INVOKE_FROM_EVAL(0x650E641CC0E3873FLL, connection_aborted); + break; + case 1857: + HASH_INVOKE_FROM_EVAL(0x5062777D2B947741LL, wordwrap); + break; + case 1863: + HASH_INVOKE_FROM_EVAL(0x3CD58419E181A747LL, magickstereoimage); + break; + case 1864: + HASH_INVOKE_FROM_EVAL(0x0D7BBA9608A36748LL, magickcombineimages); + break; + case 1865: + HASH_INVOKE_FROM_EVAL(0x73E4417BA7B49749LL, curl_multi_info_read); + break; + case 1866: + HASH_INVOKE_FROM_EVAL(0x1FF03B7DE19DD74ALL, drawpathmovetorelative); + break; + case 1867: + HASH_INVOKE_FROM_EVAL(0x7DA9307A6149B74BLL, get_meta_tags); + break; + case 1873: + HASH_INVOKE_FROM_EVAL(0x017FF216C00D9751LL, property_exists); + break; + case 1875: + HASH_INVOKE_FROM_EVAL(0x42795829DF700753LL, mysql_get_host_info); + break; + case 1876: + HASH_INVOKE_FROM_EVAL(0x53AEFD595C044754LL, max); + break; + case 1879: + HASH_INVOKE_FROM_EVAL(0x7554E3E8674F2757LL, mb_list_encodings); + break; + case 1883: + HASH_INVOKE_FROM_EVAL(0x05D293F45C15F75BLL, ldap_mod_del); + break; + case 1887: + HASH_INVOKE_FROM_EVAL(0x3EDB48C5DDD9675FLL, socket_select); + break; + case 1888: + HASH_INVOKE_FROM_EVAL(0x1BD984C11BB16760LL, array_merge); + HASH_INVOKE_FROM_EVAL(0x7AB5E6EA37196760LL, date_timezone_set); + break; + case 1889: + HASH_INVOKE_FROM_EVAL(0x6AF50085AC2AC761LL, xmlwriter_write_element); + break; + case 1893: + HASH_INVOKE_FROM_EVAL(0x1D803CE961921765LL, md5); + HASH_INVOKE_FROM_EVAL(0x45631C592AD6D765LL, str_ireplace); + break; + case 1894: + HASH_INVOKE_FROM_EVAL(0x1F4505BE6460D766LL, scandir); + break; + case 1895: + HASH_INVOKE_FROM_EVAL(0x6C280D5855D20767LL, drawsetfillalpha); + break; + case 1896: + HASH_INVOKE_FROM_EVAL(0x179A72074C778768LL, openssl_x509_export_to_file); + break; + case 1901: + HASH_INVOKE_FROM_EVAL(0x3304663FBC6C976DLL, get_html_translation_table); + HASH_INVOKE_FROM_EVAL(0x553ADA5A41AE976DLL, mb_ereg_replace); + break; + case 1904: + HASH_INVOKE_FROM_EVAL(0x6F6C5B9E3DC64770LL, drawgetstrokemiterlimit); + break; + case 1909: + HASH_INVOKE_FROM_EVAL(0x04D9076808F79775LL, getenv); + break; + case 1910: + HASH_INVOKE_FROM_EVAL(0x616DDB67073A0776LL, ord); + HASH_INVOKE_FROM_EVAL(0x4102C410C5031776LL, magickcolorizeimage); + break; + case 1914: + HASH_INVOKE_FROM_EVAL(0x1FBF36B5D65E677ALL, fb_call_user_func_safe_return); + HASH_INVOKE_FROM_EVAL(0x4330CE9C9002477ALL, array_udiff_uassoc); + break; + case 1915: + HASH_INVOKE_FROM_EVAL(0x129E39AC523A977BLL, magickgethomeurl); + break; + case 1920: + HASH_INVOKE_FROM_EVAL(0x29824AAA934CE780LL, array_filter); + break; + case 1923: + HASH_INVOKE_FROM_EVAL(0x53B4DBE58B356783LL, imagesetthickness); + HASH_INVOKE_FROM_EVAL(0x38704D99FEA9B783LL, mysql_fetch_array); + break; + case 1924: + HASH_INVOKE_FROM_EVAL(0x784FD2E7191A3784LL, drawpathellipticarcrelative); + break; + case 1925: + HASH_INVOKE_FROM_EVAL(0x5BFC6198960A5785LL, in_array); + break; + case 1926: + HASH_INVOKE_FROM_EVAL(0x3D3F7C6DE95D5786LL, oci_field_is_null); + break; + case 1927: + HASH_INVOKE_FROM_EVAL(0x4991643BD854D787LL, drawgetexceptionstring); + break; + case 1928: + HASH_INVOKE_FROM_EVAL(0x32D8CE5D0FA6D788LL, ldap_rename); + break; + case 1930: + HASH_INVOKE_FROM_EVAL(0x70A1EC006032E78ALL, pixelgetquantumcolor); + break; + case 1935: + HASH_INVOKE_FROM_EVAL(0x7B4E25772D0AC78FLL, simplexml_load_file); + break; + case 1938: + HASH_INVOKE_FROM_EVAL(0x7E5B890072113792LL, fbml_complex_expand_tag_list_11); + HASH_INVOKE_FROM_EVAL(0x0D4891A5E1A20792LL, get_defined_functions); + break; + case 1945: + HASH_INVOKE_FROM_EVAL(0x26D226FD28566799LL, date_isodate_set); + break; + case 1947: + HASH_INVOKE_FROM_EVAL(0x1196D899ACCD379BLL, evhttp_recv); + break; + case 1949: + HASH_INVOKE_FROM_EVAL(0x02ECD8C169DF579DLL, feof); + break; + case 1951: + HASH_INVOKE_FROM_EVAL(0x4B092931EFB7979FLL, mysql_create_db); + break; + case 1959: + HASH_INVOKE_FROM_EVAL(0x1F76E954F9A147A7LL, magickcontrastimage); + break; + case 1961: + HASH_INVOKE_FROM_EVAL(0x7C251B7DE8DB87A9LL, mcrypt_list_algorithms); + break; + case 1962: + HASH_INVOKE_FROM_EVAL(0x45A53A884414A7AALL, pack); + HASH_INVOKE_FROM_EVAL(0x58D6464A3A9127AALL, apc_bin_loadfile); + break; + case 1965: + HASH_INVOKE_FROM_EVAL(0x7DA08D9D148837ADLL, posix_mkfifo); + HASH_INVOKE_FROM_EVAL(0x217C52A1EBDF87ADLL, apache_get_version); + break; + case 1966: + HASH_INVOKE_FROM_EVAL(0x00141B0E3E6F77AELL, xml_set_unparsed_entity_decl_handler); + break; + case 1967: + HASH_INVOKE_FROM_EVAL(0x16CB9891EF26D7AFLL, drawgetstrokedashoffset); + break; + case 1977: + HASH_INVOKE_FROM_EVAL(0x1FC9406FD7FCD7B9LL, strrpos); + HASH_INVOKE_FROM_EVAL(0x1B6467AD87E167B9LL, log1p); + break; + case 1983: + HASH_INVOKE_FROM_EVAL(0x3F46374E6E1B07BFLL, posix_getpwuid); + break; + case 1984: + HASH_INVOKE_FROM_EVAL(0x152D1AB941A647C0LL, hphp_get_extension_info); + HASH_INVOKE_FROM_EVAL(0x52FDAC1D298D67C0LL, mcrypt_enc_get_algorithms_name); + break; + case 1985: + HASH_INVOKE_FROM_EVAL(0x4E172EA6743697C1LL, ldap_first_entry); + break; + case 1988: + HASH_INVOKE_FROM_EVAL(0x3C696836396BE7C4LL, mb_language); + break; + case 1990: + HASH_INVOKE_FROM_EVAL(0x0C8A7BE6ABC957C6LL, clearpixeliterator); + HASH_INVOKE_FROM_EVAL(0x3D6D684AF537A7C6LL, ldap_explode_dn); + break; + case 1991: + HASH_INVOKE_FROM_EVAL(0x686C5142FD0337C7LL, lcg_value); + break; + case 1994: + HASH_INVOKE_FROM_EVAL(0x3C781898488687CALL, xml_parse); + HASH_INVOKE_FROM_EVAL(0x55B68546CFAC87CALL, magicksetimageresolution); + break; + case 1998: + HASH_INVOKE_FROM_EVAL(0x3AE33FEA6830C7CELL, magickshearimage); + break; + case 1999: + HASH_INVOKE_FROM_EVAL(0x2FAB1F75659707CFLL, is_scalar); + break; + case 2001: + HASH_INVOKE_FROM_EVAL(0x35B661C87484D7D1LL, openssl_csr_sign); + break; + case 2004: + HASH_INVOKE_FROM_EVAL(0x08BF57B6353A77D4LL, fbml_get_text_11); + break; + case 2009: + HASH_INVOKE_FROM_EVAL(0x2ED6760DAA3A67D9LL, strcasecmp); + break; + case 2012: + HASH_INVOKE_FROM_EVAL(0x1FE65AFCC92967DCLL, rmdir); + break; + case 2013: + HASH_INVOKE_FROM_EVAL(0x2B5AEDF1A5FC47DDLL, strripos); + break; + case 2018: + HASH_INVOKE_FROM_EVAL(0x0888289CBD2887E2LL, iconv_substr); + break; + case 2020: + HASH_INVOKE_FROM_EVAL(0x2621680306BC97E4LL, magicksetimagescene); + break; + case 2023: + HASH_INVOKE_FROM_EVAL(0x4215DDB57604F7E7LL, xmlwriter_start_pi); + break; + case 2024: + HASH_INVOKE_FROM_EVAL(0x53B7BF8991FA67E8LL, i18n_loc_get_error_code); + break; + case 2025: + HASH_INVOKE_FROM_EVAL(0x6BB8AC68771287E9LL, strcmp); + break; + case 2027: + HASH_INVOKE_FROM_EVAL(0x54AE7140B95027EBLL, pixelgetgreenquantum); + HASH_INVOKE_FROM_EVAL(0x1A397501431EC7EBLL, is_numeric); + break; + case 2031: + HASH_INVOKE_FROM_EVAL(0x5367B0F3A4D2D7EFLL, ldap_list); + break; + case 2032: + HASH_INVOKE_FROM_EVAL(0x14F700DD189DB7F0LL, drawsetclipunits); + break; + case 2035: + HASH_INVOKE_FROM_EVAL(0x73877357478137F3LL, posix_ctermid); + HASH_INVOKE_FROM_EVAL(0x4B57E07A323FE7F3LL, drawpathlinetoverticalabsolute); + HASH_INVOKE_FROM_EVAL(0x7F436B50B7BBD7F3LL, getcwd); + break; + case 2041: + HASH_INVOKE_FROM_EVAL(0x376FB2649384A7F9LL, str_pad); + break; + case 2042: + HASH_INVOKE_FROM_EVAL(0x0FD7C3144B4007FALL, libxml_set_streams_context); + break; + case 2045: + HASH_INVOKE_FROM_EVAL(0x238E501F2536E7FDLL, drawsetclippath); + break; + case 2048: + HASH_INVOKE_FROM_EVAL(0x0E66983DD04B0800LL, get_current_user); + break; + case 2051: + HASH_INVOKE_FROM_EVAL(0x10F7244AA9CB5803LL, imagepstext); + break; + case 2052: + HASH_INVOKE_FROM_EVAL(0x349A0DF6723B6804LL, pixelsetcolorcount); + break; + case 2053: + HASH_INVOKE_FROM_EVAL(0x54ED49F8B155C805LL, ldap_t61_to_8859); + break; + case 2056: + HASH_INVOKE_FROM_EVAL(0x19279D6DB4F70808LL, hash_hmac); + HASH_INVOKE_FROM_EVAL(0x083B8F01AE15B808LL, assert); + break; + case 2057: + HASH_INVOKE_FROM_EVAL(0x221F5A9D5E021809LL, magickwriteimages); + break; + case 2058: + HASH_INVOKE_FROM_EVAL(0x5A0D1AE1D4C6F80ALL, array_slice); + break; + case 2060: + HASH_INVOKE_FROM_EVAL(0x3FF63423EC4B280CLL, posix_getegid); + break; + case 2061: + HASH_INVOKE_FROM_EVAL(0x11EC19E702F2C80DLL, getmyinode); + HASH_INVOKE_FROM_EVAL(0x727F5A6D8E26B80DLL, extension_loaded); + break; + case 2063: + HASH_INVOKE_FROM_EVAL(0x2342E5B393F0680FLL, oci_password_change); + break; + case 2064: + HASH_INVOKE_FROM_EVAL(0x4297B1072CE76810LL, fb_call_user_func_array_safe); + break; + case 2067: + HASH_INVOKE_FROM_EVAL(0x1A6B577442218813LL, pixelsetmagentaquantum); + HASH_INVOKE_FROM_EVAL(0x5F7940A713863813LL, floor); + break; + case 2068: + HASH_INVOKE_FROM_EVAL(0x3C0DFA15D3447814LL, rawurldecode); + break; + case 2071: + HASH_INVOKE_FROM_EVAL(0x0D8B1D0A8C381817LL, stream_bucket_new); + break; + case 2072: + HASH_INVOKE_FROM_EVAL(0x0FBDB0B22A59B818LL, mailparse_msg_parse); + break; + case 2077: + HASH_INVOKE_FROM_EVAL(0x4D624A655A9B581DLL, drawpoint); + break; + case 2081: + HASH_INVOKE_FROM_EVAL(0x2D52FB9B52EC2821LL, xml_set_notation_decl_handler); + HASH_INVOKE_FROM_EVAL(0x107DBCA79C15B821LL, addcslashes); + break; + case 2084: + HASH_INVOKE_FROM_EVAL(0x2B78E204F615A824LL, openssl_pkcs12_export_to_file); + break; + case 2087: + HASH_INVOKE_FROM_EVAL(0x33EC567341B9C827LL, magickgetmaxtextadvance); + break; + case 2089: + HASH_INVOKE_FROM_EVAL(0x39EE4CCCA716E829LL, stream_context_get_options); + HASH_INVOKE_FROM_EVAL(0x57FFCEB7FA2D9829LL, usort); + break; + case 2092: + HASH_INVOKE_FROM_EVAL(0x34F0E032AB05C82CLL, pixelsetblue); + break; + case 2093: + HASH_INVOKE_FROM_EVAL(0x1C4AE57BF4E4A82DLL, apc_dec); + break; + case 2094: + HASH_INVOKE_FROM_EVAL(0x3402C1E7544C382ELL, lstat); + break; + case 2095: + HASH_INVOKE_FROM_EVAL(0x79A05154A7F5482FLL, magickgetimagedelay); + break; + case 2096: + HASH_INVOKE_FROM_EVAL(0x5BBFA7EAEBD25830LL, pixelgetcyanquantum); + break; + case 2100: + HASH_INVOKE_FROM_EVAL(0x605132E71CE7D834LL, array_push); + break; + case 2101: + HASH_INVOKE_FROM_EVAL(0x1C4A162E6635B835LL, imageftbbox); + break; + case 2104: + HASH_INVOKE_FROM_EVAL(0x63E554E0F11CE838LL, mysql_unbuffered_query); + HASH_INVOKE_FROM_EVAL(0x03098F16B0AD5838LL, mcrypt_module_get_supported_key_sizes); + HASH_INVOKE_FROM_EVAL(0x0890F9052322E838LL, fstat); + break; + case 2105: + HASH_INVOKE_FROM_EVAL(0x4F148A9F4E2C5839LL, fb_start_mcproxy); + break; + case 2107: + HASH_INVOKE_FROM_EVAL(0x63E2EA180786B83BLL, pixelsetblack); + break; + case 2108: + HASH_INVOKE_FROM_EVAL(0x7C8969C75CA1783CLL, get_declared_classes); + HASH_INVOKE_FROM_EVAL(0x034EDEBD109FD83CLL, filesize); + break; + case 2115: + HASH_INVOKE_FROM_EVAL(0x567A7139AD476843LL, socket_listen); + break; + case 2116: + HASH_INVOKE_FROM_EVAL(0x1639883196856844LL, oci_close); + break; + case 2118: + HASH_INVOKE_FROM_EVAL(0x50088ED5D482C846LL, ldap_mod_add); + break; + case 2119: + HASH_INVOKE_FROM_EVAL(0x4E69A952E3EA4847LL, magicksetfilename); + break; + case 2122: + HASH_INVOKE_FROM_EVAL(0x7D3F626E636C084ALL, ldap_delete); + break; + case 2123: + HASH_INVOKE_FROM_EVAL(0x68B7597C22FA484BLL, openssl_public_encrypt); + break; + case 2124: + HASH_INVOKE_FROM_EVAL(0x26A2BBC465A2B84CLL, strcoll); + break; + case 2126: + HASH_INVOKE_FROM_EVAL(0x488C2F267BF2884ELL, array_intersect); + break; + case 2128: + HASH_INVOKE_FROM_EVAL(0x4DDB82A3632FA850LL, atan); + break; + case 2129: + HASH_INVOKE_FROM_EVAL(0x488BFCC942C73851LL, gzopen); + break; + case 2140: + HASH_INVOKE_FROM_EVAL(0x5A017A4C6A41E85CLL, curl_multi_add_handle); + break; + case 2142: + HASH_INVOKE_FROM_EVAL(0x6B4DE6865142285ELL, destroypixeliterator); + break; + case 2145: + HASH_INVOKE_FROM_EVAL(0x2AD6B0E3B9F3B861LL, array_search); + break; + case 2147: + HASH_INVOKE_FROM_EVAL(0x21B30164F5D49863LL, is_resource); + break; + case 2148: + HASH_INVOKE_FROM_EVAL(0x168EDA8238EEE864LL, mb_detect_order); + break; + case 2151: + HASH_INVOKE_FROM_EVAL(0x65A68A31B96E7867LL, hash); + break; + case 2152: + HASH_INVOKE_FROM_EVAL(0x785C812E6292E868LL, i18n_loc_set_default); + break; + case 2153: + HASH_INVOKE_FROM_EVAL(0x246EC2B1844DB869LL, pixelgetexception); + break; + case 2155: + HASH_INVOKE_FROM_EVAL(0x0C1BBEDECEF1C86BLL, newmagickwand); + break; + case 2156: + HASH_INVOKE_FROM_EVAL(0x6414504A6658286CLL, stripos); + break; + case 2159: + HASH_INVOKE_FROM_EVAL(0x1476A177CC50686FLL, mb_strstr); + break; + case 2160: + HASH_INVOKE_FROM_EVAL(0x34F50577C14C6870LL, array_diff_uassoc); + break; + case 2162: + HASH_INVOKE_FROM_EVAL(0x3C7B86F57AFA0872LL, hebrev); + HASH_INVOKE_FROM_EVAL(0x558D62FBEB210872LL, str_rot13); + break; + case 2163: + HASH_INVOKE_FROM_EVAL(0x4C06B4AFC1C08873LL, str_shuffle); + break; + case 2167: + HASH_INVOKE_FROM_EVAL(0x6AA3788C9B737877LL, magickdespeckleimage); + break; + case 2168: + HASH_INVOKE_FROM_EVAL(0x00F8C6758B50B878LL, drawpathcurvetoquadraticbezierabsolute); + break; + case 2172: + HASH_INVOKE_FROM_EVAL(0x6451BCB825D1787CLL, chroot); + break; + case 2173: + HASH_INVOKE_FROM_EVAL(0x54F84DC9A334287DLL, gzencode); + HASH_INVOKE_FROM_EVAL(0x2B36081E0828487DLL, debug_print_backtrace); + break; + case 2180: + HASH_INVOKE_FROM_EVAL(0x766CD15A7F2A0884LL, array_uintersect); + break; + case 2184: + HASH_INVOKE_FROM_EVAL(0x0125AFE24DC1A888LL, fbml_get_children_by_name_11); + HASH_INVOKE_FROM_EVAL(0x1062CF2DA5443888LL, imagedashedline); + break; + case 2191: + HASH_INVOKE_FROM_EVAL(0x539868C56806688FLL, imagecopyresampled); + break; + case 2200: + HASH_INVOKE_FROM_EVAL(0x4AC522FF7BB60898LL, xmlwriter_write_dtd_entity); + break; + case 2205: + HASH_INVOKE_FROM_EVAL(0x1FC855F0E4F1189DLL, magickminifyimage); + break; + case 2208: + HASH_INVOKE_FROM_EVAL(0x6B1A3BCE67BAC8A0LL, openssl_csr_new); + break; + case 2209: + HASH_INVOKE_FROM_EVAL(0x1756D4437A4098A1LL, date_modify); + break; + case 2215: + HASH_INVOKE_FROM_EVAL(0x57105D4E43B078A7LL, magicksetformat); + HASH_INVOKE_FROM_EVAL(0x6C6B4B739AE1B8A7LL, curl_close); + break; + case 2217: + HASH_INVOKE_FROM_EVAL(0x346B2DB3BA2378A9LL, imagecolormatch); + break; + case 2218: + HASH_INVOKE_FROM_EVAL(0x44BC069A75EE98AALL, xhprof_disable); + break; + case 2219: + HASH_INVOKE_FROM_EVAL(0x39F11BA6A4D778ABLL, strnatcmp); + break; + case 2220: + HASH_INVOKE_FROM_EVAL(0x5B1F4C6424DDD8ACLL, openlog); + break; + case 2224: + HASH_INVOKE_FROM_EVAL(0x2CEF8DDC092698B0LL, drawgetvectorgraphics); + break; + case 2226: + HASH_INVOKE_FROM_EVAL(0x31830AA5032428B2LL, is_double); + break; + case 2236: + HASH_INVOKE_FROM_EVAL(0x7AE3AE9B634988BCLL, stream_context_create); + break; + case 2244: + HASH_INVOKE_FROM_EVAL(0x5C28BE7FFE6A68C4LL, xml_set_start_namespace_decl_handler); + break; + case 2245: + HASH_INVOKE_FROM_EVAL(0x146A1A7658CCA8C5LL, asinh); + break; + case 2247: + HASH_INVOKE_FROM_EVAL(0x4623383F8534E8C7LL, array_multisort); + HASH_INVOKE_FROM_EVAL(0x6D9B9BE3CED388C7LL, apc_load_constants); + break; + case 2254: + HASH_INVOKE_FROM_EVAL(0x3FFAA982E4B1E8CELL, date_offset_get); + break; + case 2257: + HASH_INVOKE_FROM_EVAL(0x1015EB3F52B098D1LL, print); + break; + case 2260: + HASH_INVOKE_FROM_EVAL(0x6DB4EE8696C7E8D4LL, magicksetimageiterations); + break; + case 2262: + HASH_INVOKE_FROM_EVAL(0x2F585B36DDDB68D6LL, mb_convert_case); + HASH_INVOKE_FROM_EVAL(0x26DC8AB4A9CBE8D6LL, iconv); + break; + case 2264: + HASH_INVOKE_FROM_EVAL(0x3A65182A3E8908D8LL, openssl_open); + break; + case 2265: + HASH_INVOKE_FROM_EVAL(0x18B64D6BFE4208D9LL, stream_get_transports); + break; + case 2267: + HASH_INVOKE_FROM_EVAL(0x4052842EC87038DBLL, magickcropimage); + break; + case 2268: + HASH_INVOKE_FROM_EVAL(0x31F50FDA18B888DCLL, magickgetimagetype); + break; + case 2276: + HASH_INVOKE_FROM_EVAL(0x16A18007E10F48E4LL, socket_getsockname); + break; + case 2278: + HASH_INVOKE_FROM_EVAL(0x69887F054A1E28E6LL, strtok); + break; + case 2279: + HASH_INVOKE_FROM_EVAL(0x608729F27FA428E7LL, error_get_last); + break; + case 2280: + HASH_INVOKE_FROM_EVAL(0x4F7ED8C3156AD8E8LL, magicksetimagedispose); + break; + case 2293: + HASH_INVOKE_FROM_EVAL(0x45DA105C5B48F8F5LL, apd_set_pprof_trace); + break; + case 2295: + HASH_INVOKE_FROM_EVAL(0x17582BEA497D48F7LL, ctype_alpha); + break; + case 2298: + HASH_INVOKE_FROM_EVAL(0x6F0F82818B68A8FALL, array_values); + break; + case 2299: + HASH_INVOKE_FROM_EVAL(0x214532C4A2BC28FBLL, ldap_next_entry); + break; + case 2300: + HASH_INVOKE_FROM_EVAL(0x4C2AFB2EFDB1B8FCLL, stripslashes); + break; + case 2302: + HASH_INVOKE_FROM_EVAL(0x047BF4D3D0ED08FELL, strchr); + break; + case 2306: + HASH_INVOKE_FROM_EVAL(0x010760453DD28902LL, fb_run_mcproxy); + break; + case 2315: + HASH_INVOKE_FROM_EVAL(0x67B879A1120C190BLL, headers_sent); + HASH_INVOKE_FROM_EVAL(0x2987B15E11FE890BLL, clock_settime); + break; + case 2316: + HASH_INVOKE_FROM_EVAL(0x72E1EBF65C25F90CLL, oci_fetch_assoc); + break; + case 2321: + HASH_INVOKE_FROM_EVAL(0x04F822B7817E5911LL, bindec); + HASH_INVOKE_FROM_EVAL(0x0AFD4F231D6CB911LL, magickaddimage); + HASH_INVOKE_FROM_EVAL(0x5B9B2C3B32906911LL, drawsetfillpatternurl); + break; + case 2323: + HASH_INVOKE_FROM_EVAL(0x55757E1242390913LL, cos); + break; + case 2324: + HASH_INVOKE_FROM_EVAL(0x6E22C6D840B44914LL, mcrypt_generic_init); + break; + case 2326: + HASH_INVOKE_FROM_EVAL(0x245A2DC3B6B62916LL, apache_lookup_uri); + break; + case 2329: + HASH_INVOKE_FROM_EVAL(0x022B16C0D64D7919LL, file_put_contents); + HASH_INVOKE_FROM_EVAL(0x4AA4DD47E99E5919LL, oci_bind_array_by_name); + break; + case 2333: + HASH_INVOKE_FROM_EVAL(0x069C028EFEF8C91DLL, date); + break; + case 2335: + HASH_INVOKE_FROM_EVAL(0x277D7E2D1F5C191FLL, drawpathcurvetoquadraticbezierrelative); + HASH_INVOKE_FROM_EVAL(0x4E2C55C92D71F91FLL, magickcolorfloodfillimage); + break; + case 2337: + HASH_INVOKE_FROM_EVAL(0x0F5917FFCDD6C921LL, mb_substr); + break; + case 2339: + HASH_INVOKE_FROM_EVAL(0x044B276686B77923LL, fscanf); + break; + case 2349: + HASH_INVOKE_FROM_EVAL(0x27363CE6CBFC392DLL, pcntl_wexitstatus); + HASH_INVOKE_FROM_EVAL(0x2337F8C3EE17192DLL, sprintf); + break; + case 2350: + HASH_INVOKE_FROM_EVAL(0x26E8B741BDDDC92ELL, xmlwriter_start_element); + break; + case 2352: + HASH_INVOKE_FROM_EVAL(0x507CE1912FD74930LL, mail); + HASH_INVOKE_FROM_EVAL(0x30972530BD557930LL, shell_exec); + break; + case 2354: + HASH_INVOKE_FROM_EVAL(0x72C01E1D90BE5932LL, mcrypt_enc_get_block_size); + break; + case 2356: + HASH_INVOKE_FROM_EVAL(0x4FB95164A5F84934LL, mcrypt_generic_end); + break; + case 2357: + HASH_INVOKE_FROM_EVAL(0x46BD9A56BDE40935LL, mysql_escape_string); + HASH_INVOKE_FROM_EVAL(0x06486B6912479935LL, zlib_get_coding_type); + HASH_INVOKE_FROM_EVAL(0x48D3CA6CA0B29935LL, mb_regex_set_options); + break; + case 2359: + HASH_INVOKE_FROM_EVAL(0x0447476ED176F937LL, oci_bind_by_name); + break; + case 2361: + HASH_INVOKE_FROM_EVAL(0x5B60C8396C624939LL, mb_substitute_character); + break; + case 2366: + HASH_INVOKE_FROM_EVAL(0x0CADFE289C92893ELL, socket_getpeername); + break; + case 2371: + HASH_INVOKE_FROM_EVAL(0x7C565AD57BC84943LL, pixelsetindex); + break; + case 2373: + HASH_INVOKE_FROM_EVAL(0x7CB0596B6CCFA945LL, split); + break; + case 2375: + HASH_INVOKE_FROM_EVAL(0x630288865DE68947LL, php_strip_whitespace); + break; + case 2376: + HASH_INVOKE_FROM_EVAL(0x6A3412DE82715948LL, openssl_x509_checkpurpose); + break; + case 2377: + HASH_INVOKE_FROM_EVAL(0x243BB8B284895949LL, apache_get_rewrite_rules); + break; + case 2379: + HASH_INVOKE_FROM_EVAL(0x37F356F578FA394BLL, substr); + break; + case 2381: + HASH_INVOKE_FROM_EVAL(0x3D3AD12E52FF294DLL, imagecreatefromwbmp); + break; + case 2387: + HASH_INVOKE_FROM_EVAL(0x068438AFD33A9953LL, imagecolorclosesthwb); + break; + case 2391: + HASH_INVOKE_FROM_EVAL(0x253AC5D4E450A957LL, magickgetreleasedate); + break; + case 2394: + HASH_INVOKE_FROM_EVAL(0x7056E766A274895ALL, virtual); + break; + case 2397: + HASH_INVOKE_FROM_EVAL(0x21DBCE74EB1FC95DLL, xmlwriter_text); + break; + case 2401: + HASH_INVOKE_FROM_EVAL(0x5EA7052A00E88961LL, magickgetcopyright); + break; + case 2407: + HASH_INVOKE_FROM_EVAL(0x1419B3BF428B2967LL, evhttp_async_post); + break; + case 2415: + HASH_INVOKE_FROM_EVAL(0x134EF88685C0396FLL, magickgetexceptiontype); + break; + case 2417: + HASH_INVOKE_FROM_EVAL(0x442A28FB6F6C3971LL, xmlwriter_start_attribute); + HASH_INVOKE_FROM_EVAL(0x72C73F5DA7D6F971LL, magickgetimagecolormapcolor); + break; + case 2418: + HASH_INVOKE_FROM_EVAL(0x758263CEBF2E8972LL, assert_options); + break; + case 2421: + HASH_INVOKE_FROM_EVAL(0x7E26D48503362975LL, drawpathcurvetoabsolute); + HASH_INVOKE_FROM_EVAL(0x488141281A75E975LL, imagecreatefromgif); + break; + case 2423: + HASH_INVOKE_FROM_EVAL(0x0C16C797916C2977LL, posix_setegid); + break; + case 2430: + HASH_INVOKE_FROM_EVAL(0x5067A65AD1D0297ELL, pixelgetiteratorexception); + break; + case 2432: + HASH_INVOKE_FROM_EVAL(0x3D3445105C335980LL, filectime); + break; + case 2434: + HASH_INVOKE_FROM_EVAL(0x214EA70BDD8FB982LL, magickmorphimages); + break; + case 2435: + HASH_INVOKE_FROM_EVAL(0x3DA64BF893DBF983LL, strncmp); + break; + case 2436: + HASH_INVOKE_FROM_EVAL(0x2B2A9D6B27656984LL, oci_new_connect); + break; + case 2438: + HASH_INVOKE_FROM_EVAL(0x6ECE4BDB8842E986LL, posix_strerror); + break; + case 2439: + HASH_INVOKE_FROM_EVAL(0x22B3CF8DD3D1A987LL, pixelsynciterator); + break; + case 2440: + HASH_INVOKE_FROM_EVAL(0x489355BDBE396988LL, drawsettextencoding); + HASH_INVOKE_FROM_EVAL(0x55BE7AE8DEF3F988LL, magickgetstringheight); + break; + case 2443: + HASH_INVOKE_FROM_EVAL(0x0E863EF8C11A598BLL, is_writable); + break; + case 2445: + HASH_INVOKE_FROM_EVAL(0x23DEB9C15DF9D98DLL, oci_commit); + HASH_INVOKE_FROM_EVAL(0x69003892F71C798DLL, apache_get_scoreboard); + HASH_INVOKE_FROM_EVAL(0x651A8CBB8D2A398DLL, mysql_stat); + break; + case 2446: + HASH_INVOKE_FROM_EVAL(0x333D4DFD4927898ELL, magickgetimagewhitepoint); + break; + case 2456: + HASH_INVOKE_FROM_EVAL(0x501AAD31C8086998LL, posix_getcwd); + break; + case 2459: + HASH_INVOKE_FROM_EVAL(0x564D8D3DA1E8E99BLL, xml_get_current_line_number); + break; + case 2462: + HASH_INVOKE_FROM_EVAL(0x59D2DFF08F4DB99ELL, imagecreate); + break; + case 2466: + HASH_INVOKE_FROM_EVAL(0x01D2367A02F0A9A2LL, magicksetsize); + HASH_INVOKE_FROM_EVAL(0x3FE0D440B157A9A2LL, oci_field_precision); + break; + case 2467: + HASH_INVOKE_FROM_EVAL(0x43D1339C52E309A3LL, hphp_service_thread_started); + HASH_INVOKE_FROM_EVAL(0x78261FA60B8D89A3LL, imagepsloadfont); + break; + case 2468: + HASH_INVOKE_FROM_EVAL(0x6F8676B049C919A4LL, array_intersect_uassoc); + break; + case 2469: + HASH_INVOKE_FROM_EVAL(0x76988956F35329A5LL, xmlwriter_end_cdata); + break; + case 2473: + HASH_INVOKE_FROM_EVAL(0x6F9CF95104CAE9A9LL, pixelgetyellowquantum); + break; + case 2476: + HASH_INVOKE_FROM_EVAL(0x522256BAA78159ACLL, popen); + HASH_INVOKE_FROM_EVAL(0x1D4F0A3AEA18F9ACLL, oci_server_version); + break; + case 2477: + HASH_INVOKE_FROM_EVAL(0x05C5AD90751159ADLL, drawpathcurvetoquadraticbeziersmoothabsolute); + break; + case 2479: + HASH_INVOKE_FROM_EVAL(0x25268012A48A99AFLL, magickclipimage); + break; + case 2481: + HASH_INVOKE_FROM_EVAL(0x7C1CE38F14E529B1LL, date_default_timezone_set); + break; + case 2482: + HASH_INVOKE_FROM_EVAL(0x65D7CBE8681CE9B2LL, gzgetss); + break; + case 2486: + HASH_INVOKE_FROM_EVAL(0x5FC1B94446EA59B6LL, magickremoveimageprofiles); + break; + case 2487: + HASH_INVOKE_FROM_EVAL(0x18F2C246FACAD9B7LL, each); + break; + case 2488: + HASH_INVOKE_FROM_EVAL(0x3741447B159359B8LL, mcrypt_get_cipher_name); + HASH_INVOKE_FROM_EVAL(0x4EFD7A9C90E559B8LL, posix_ttyname); + break; + case 2489: + HASH_INVOKE_FROM_EVAL(0x145702974C97F9B9LL, ltrim); + break; + case 2490: + HASH_INVOKE_FROM_EVAL(0x13B3172E092D99BALL, is_dir); + break; + case 2493: + HASH_INVOKE_FROM_EVAL(0x6325F56D49E6F9BDLL, fb_get_derived_classes); + break; + case 2494: + HASH_INVOKE_FROM_EVAL(0x458B5ABEDAC1C9BELL, disk_free_space); + break; + case 2497: + HASH_INVOKE_FROM_EVAL(0x2A87F980E2A2B9C1LL, hotprofiler_enable); + break; + case 2498: + HASH_INVOKE_FROM_EVAL(0x6A7BDB900E7429C2LL, magickconstituteimage); + break; + case 2500: + HASH_INVOKE_FROM_EVAL(0x47B7D3745D80B9C4LL, socket_get_option); + break; + case 2503: + HASH_INVOKE_FROM_EVAL(0x6ECDF24B29D789C7LL, strtolower); + break; + case 2506: + HASH_INVOKE_FROM_EVAL(0x5C5B0CC85133B9CALL, mkdir); + break; + case 2509: + HASH_INVOKE_FROM_EVAL(0x4E61FE901C1C29CDLL, array_intersect_key); + break; + case 2510: + HASH_INVOKE_FROM_EVAL(0x7A9FB932873D09CELL, gmmktime); + break; + case 2511: + HASH_INVOKE_FROM_EVAL(0x415B91CAEE0689CFLL, magickgetimageinterlacescheme); + break; + case 2514: + HASH_INVOKE_FROM_EVAL(0x3DCCD1FEAD8759D2LL, array_sum); + break; + case 2515: + HASH_INVOKE_FROM_EVAL(0x1C31A9E1207209D3LL, mb_split); + HASH_INVOKE_FROM_EVAL(0x10C82F357BB7E9D3LL, curl_version); + HASH_INVOKE_FROM_EVAL(0x25CA0299103F49D3LL, magickgetsize); + break; + case 2517: + HASH_INVOKE_FROM_EVAL(0x245860A2FE4CB9D5LL, socket_set_blocking); + break; + case 2523: + HASH_INVOKE_FROM_EVAL(0x48B2E069B89489DBLL, magickappendimages); + break; + case 2526: + HASH_INVOKE_FROM_EVAL(0x5C039967E60089DELL, array_intersect_ukey); + break; + case 2527: + HASH_INVOKE_FROM_EVAL(0x349E2E0F2CD7B9DFLL, magickgetversion); + break; + case 2534: + HASH_INVOKE_FROM_EVAL(0x1B44CF284E9B09E6LL, interface_exists); + break; + case 2537: + HASH_INVOKE_FROM_EVAL(0x4ADFA265F07AB9E9LL, drawgettextalignment); + HASH_INVOKE_FROM_EVAL(0x6A45EB471332A9E9LL, imagecolorexactalpha); + HASH_INVOKE_FROM_EVAL(0x330EE2729DB7C9E9LL, drawgetfontstretch); + break; + case 2538: + HASH_INVOKE_FROM_EVAL(0x25DDD924EFE979EALL, hash_update_file); + break; + case 2539: + HASH_INVOKE_FROM_EVAL(0x71B0FF80B88459EBLL, diskfreespace); + break; + case 2543: + HASH_INVOKE_FROM_EVAL(0x7EA6200B688459EFLL, ldap_modify); + break; + case 2544: + HASH_INVOKE_FROM_EVAL(0x1FC307200E8959F0LL, stream_bucket_append); + break; + case 2547: + HASH_INVOKE_FROM_EVAL(0x6535B60A4BC449F3LL, dns_get_record); + break; + case 2548: + HASH_INVOKE_FROM_EVAL(0x51201EE65BC729F4LL, localtime); + break; + case 2549: + HASH_INVOKE_FROM_EVAL(0x2BC61637253BE9F5LL, drawgetfontweight); + HASH_INVOKE_FROM_EVAL(0x35BABFBC091759F5LL, socket_server); + break; + case 2557: + HASH_INVOKE_FROM_EVAL(0x2394D4E030AB69FDLL, getmypid); + break; + case 2564: + HASH_INVOKE_FROM_EVAL(0x17B83C425BD09A04LL, atanh); + break; + case 2567: + HASH_INVOKE_FROM_EVAL(0x391E0A4CF1EC9A07LL, stream_socket_recvfrom); + break; + case 2568: + HASH_INVOKE_FROM_EVAL(0x0436CA4DFB315A08LL, soundex); + break; + case 2571: + HASH_INVOKE_FROM_EVAL(0x70075DC878825A0BLL, ctype_lower); + break; + case 2573: + HASH_INVOKE_FROM_EVAL(0x736C133EFF8E5A0DLL, mysql_list_fields); + HASH_INVOKE_FROM_EVAL(0x50A7146A79877A0DLL, pcntl_alarm); + break; + case 2577: + HASH_INVOKE_FROM_EVAL(0x472CA39715598A11LL, mb_eregi_replace); + break; + case 2579: + HASH_INVOKE_FROM_EVAL(0x08D7F857A0FDAA13LL, fbml_batch_precache_11); + break; + case 2588: + HASH_INVOKE_FROM_EVAL(0x12D49AD562F38A1CLL, date_timezone_get); + break; + case 2592: + HASH_INVOKE_FROM_EVAL(0x2A420675E6AF0A20LL, basename); + break; + case 2593: + HASH_INVOKE_FROM_EVAL(0x14279BB1A6872A21LL, atan2); + break; + case 2595: + HASH_INVOKE_FROM_EVAL(0x71434F6D4842FA23LL, fbml_get_attributes_11); + break; + case 2597: + HASH_INVOKE_FROM_EVAL(0x5EC0A3DD935EEA25LL, magickresampleimage); + HASH_INVOKE_FROM_EVAL(0x1DB9A1FB97A3AA25LL, magicksetimageoption); + break; + case 2601: + HASH_INVOKE_FROM_EVAL(0x618D2A98986B1A29LL, ldap_unbind); + break; + case 2602: + HASH_INVOKE_FROM_EVAL(0x3CAEA6B8D1C92A2ALL, stream_bucket_prepend); + break; + case 2608: + HASH_INVOKE_FROM_EVAL(0x6943B78E10995A30LL, fb_reset_opcode); + break; + case 2609: + HASH_INVOKE_FROM_EVAL(0x1F3E32847C1CCA31LL, mb_ereg_match); + break; + case 2612: + HASH_INVOKE_FROM_EVAL(0x2D948E4099975A34LL, restore_include_path); + HASH_INVOKE_FROM_EVAL(0x5AB266C6E7075A34LL, mysql_error); + break; + case 2616: + HASH_INVOKE_FROM_EVAL(0x3E65EF9761BE5A38LL, pixelgetiteratorexceptiontype); + break; + case 2619: + HASH_INVOKE_FROM_EVAL(0x545A7BE199EC4A3BLL, pcntl_getpriority); + HASH_INVOKE_FROM_EVAL(0x785ECCF53D98BA3BLL, curl_multi_exec); + break; + case 2620: + HASH_INVOKE_FROM_EVAL(0x21DF7BAEEFABCA3CLL, umask); + break; + case 2621: + HASH_INVOKE_FROM_EVAL(0x2468D7D3685C3A3DLL, fbml_sanitize_js_11); + break; + case 2622: + HASH_INVOKE_FROM_EVAL(0x31C3A072D092FA3ELL, socket_create_listen); + break; + case 2623: + HASH_INVOKE_FROM_EVAL(0x4C0E2C6882051A3FLL, magickgetresourcelimit); + break; + case 2624: + HASH_INVOKE_FROM_EVAL(0x4926EE59103B2A40LL, destroydrawingwand); + HASH_INVOKE_FROM_EVAL(0x682C14726D484A40LL, fileatime); + break; + case 2626: + HASH_INVOKE_FROM_EVAL(0x128914E131AFFA42LL, microtime); + HASH_INVOKE_FROM_EVAL(0x5FF7C3A6BDDCFA42LL, mb_convert_kana); + break; + case 2628: + HASH_INVOKE_FROM_EVAL(0x7F6A6306BBE8AA44LL, imagelayereffect); + break; + case 2631: + HASH_INVOKE_FROM_EVAL(0x1B45CFF586F85A47LL, utf8_encode); + break; + case 2647: + HASH_INVOKE_FROM_EVAL(0x5088945958DD4A57LL, mktime); + HASH_INVOKE_FROM_EVAL(0x7E929ED7D9BE6A57LL, ini_get); + break; + case 2648: + HASH_INVOKE_FROM_EVAL(0x6E823A722DE1EA58LL, stream_socket_client); + break; + case 2651: + HASH_INVOKE_FROM_EVAL(0x2B18DFF183C0BA5BLL, mb_get_info); + break; + case 2653: + HASH_INVOKE_FROM_EVAL(0x7E1E9C4C3D4E8A5DLL, stream_select); + break; + case 2654: + HASH_INVOKE_FROM_EVAL(0x2C6826999658AA5ELL, getopt); + break; + case 2655: + HASH_INVOKE_FROM_EVAL(0x7CAE3FE798EC0A5FLL, php_logo_guid); + break; + case 2661: + HASH_INVOKE_FROM_EVAL(0x469199B8FD886A65LL, putenv); + HASH_INVOKE_FROM_EVAL(0x3590F3AAC94E0A65LL, array_change_key_case); + break; + case 2662: + HASH_INVOKE_FROM_EVAL(0x60C4B9EEDBD5FA66LL, pos); + break; + case 2664: + HASH_INVOKE_FROM_EVAL(0x01DD2057FD9B1A68LL, xmlwriter_write_cdata); + HASH_INVOKE_FROM_EVAL(0x32AD0455A7689A68LL, magickoilpaintimage); + break; + case 2665: + HASH_INVOKE_FROM_EVAL(0x10CDCF2BB4057A69LL, debug_zval_dump); + break; + case 2667: + HASH_INVOKE_FROM_EVAL(0x0912965F4440FA6BLL, str_repeat); + break; + case 2673: + HASH_INVOKE_FROM_EVAL(0x5B5DA6AD0AD63A71LL, drawannotation); + break; + case 2674: + HASH_INVOKE_FROM_EVAL(0x71AFF1D58D103A72LL, imagefontheight); + break; + case 2677: + HASH_INVOKE_FROM_EVAL(0x7A957BEC6CA57A75LL, preg_replace_callback); + break; + case 2681: + HASH_INVOKE_FROM_EVAL(0x28AC28C54C4E6A79LL, openssl_error_string); + break; + case 2685: + HASH_INVOKE_FROM_EVAL(0x414C2E31304E9A7DLL, stream_get_filters); + break; + case 2690: + HASH_INVOKE_FROM_EVAL(0x258205B54DC06A82LL, newpixelwands); + HASH_INVOKE_FROM_EVAL(0x79786FABC5551A82LL, jpeg2wbmp); + break; + case 2691: + HASH_INVOKE_FROM_EVAL(0x11149278DB0A9A83LL, levenshtein); + break; + case 2692: + HASH_INVOKE_FROM_EVAL(0x08C1A5A05B6A0A84LL, ob_get_length); + break; + case 2693: + HASH_INVOKE_FROM_EVAL(0x755DEFDEDF35DA85LL, ctype_print); + HASH_INVOKE_FROM_EVAL(0x2180916F8D4F6A85LL, drawcomment); + break; + case 2695: + HASH_INVOKE_FROM_EVAL(0x7C5A22328CAB4A87LL, ereg_replace); + break; + case 2696: + HASH_INVOKE_FROM_EVAL(0x1818A3CFBA357A88LL, magicksetwandsize); + break; + case 2699: + HASH_INVOKE_FROM_EVAL(0x7ACBCD9CF335AA8BLL, xmlwriter_start_document); + break; + case 2700: + HASH_INVOKE_FROM_EVAL(0x6A2EEE463F969A8CLL, getservbyname); + break; + case 2701: + HASH_INVOKE_FROM_EVAL(0x7202579D23243A8DLL, hotprofiler_disable); + break; + case 2706: + HASH_INVOKE_FROM_EVAL(0x1257DB9F159E9A92LL, magickmontageimage); + break; + case 2707: + HASH_INVOKE_FROM_EVAL(0x4A32653C8E719A93LL, pixelgetcyan); + break; + case 2708: + HASH_INVOKE_FROM_EVAL(0x465E6C67F885AA94LL, drawgetstrokelinejoin); + HASH_INVOKE_FROM_EVAL(0x7761D019E0B5EA94LL, magickstripimage); + HASH_INVOKE_FROM_EVAL(0x4B1501C4C22FFA94LL, quoted_printable_encode); + HASH_INVOKE_FROM_EVAL(0x0AC7CBCE30442A94LL, imagepalettecopy); + break; + case 2709: + HASH_INVOKE_FROM_EVAL(0x34B8A4E5AE0EFA95LL, pixelgetopacity); + break; + case 2711: + HASH_INVOKE_FROM_EVAL(0x0089115038C03A97LL, array_diff_ukey); + break; + case 2714: + HASH_INVOKE_FROM_EVAL(0x19AFF8596E19DA9ALL, xhprof_enable); + break; + case 2717: + HASH_INVOKE_FROM_EVAL(0x1234AB687C515A9DLL, mb_encode_numericentity); + break; + case 2719: + HASH_INVOKE_FROM_EVAL(0x2E5E23ECA0525A9FLL, bcadd); + break; + case 2720: + HASH_INVOKE_FROM_EVAL(0x55FAF12AF1920AA0LL, sha1_file); + break; + case 2723: + HASH_INVOKE_FROM_EVAL(0x2B75B48A53AACAA3LL, imagestring); + break; + case 2725: + HASH_INVOKE_FROM_EVAL(0x2418528164415AA5LL, magickscaleimage); + HASH_INVOKE_FROM_EVAL(0x421C6B40EB370AA5LL, ldap_sasl_bind); + break; + case 2726: + HASH_INVOKE_FROM_EVAL(0x4BBA1E164DF9CAA6LL, localeconv); + break; + case 2727: + HASH_INVOKE_FROM_EVAL(0x797CEC173CBB7AA7LL, ob_get_flush); + HASH_INVOKE_FROM_EVAL(0x61FC96080D1AFAA7LL, fbml_get_children_11); + break; + case 2729: + HASH_INVOKE_FROM_EVAL(0x2238FC7870E9CAA9LL, strspn); + break; + case 2731: + HASH_INVOKE_FROM_EVAL(0x1331979EF8EF0AABLL, mb_ereg_search); + break; + case 2732: + HASH_INVOKE_FROM_EVAL(0x18CF3E4A60E4AAACLL, pi); + break; + case 2738: + HASH_INVOKE_FROM_EVAL(0x569EED88F20BAAB2LL, drawgettextundercolor); + HASH_INVOKE_FROM_EVAL(0x62519270CC9F1AB2LL, stream_get_meta_data); + break; + case 2740: + HASH_INVOKE_FROM_EVAL(0x1BAFB965204D0AB4LL, openssl_x509_check_private_key); + break; + case 2747: + HASH_INVOKE_FROM_EVAL(0x4B3B35D3C145FABBLL, fb_backtrace); + break; + case 2751: + HASH_INVOKE_FROM_EVAL(0x030DFC3D3C88BABFLL, filegroup); + break; + case 2757: + HASH_INVOKE_FROM_EVAL(0x3754E97715176AC5LL, hphp_get_stats); + break; + case 2759: + HASH_INVOKE_FROM_EVAL(0x5D2F899A270D9AC7LL, xmlwriter_end_dtd_element); + HASH_INVOKE_FROM_EVAL(0x79215854355CBAC7LL, proc_get_status); + HASH_INVOKE_FROM_EVAL(0x3886D2664F874AC7LL, openssl_pkcs7_verify); + break; + case 2761: + HASH_INVOKE_FROM_EVAL(0x5CA9671385EF0AC9LL, sem_release); + break; + case 2762: + HASH_INVOKE_FROM_EVAL(0x45B30CD663284ACALL, is_int); + break; + case 2763: + HASH_INVOKE_FROM_EVAL(0x348888DDF223AACBLL, mt_getrandmax); + break; + case 2764: + HASH_INVOKE_FROM_EVAL(0x3632B44502F9BACCLL, fql_parse_10); + HASH_INVOKE_FROM_EVAL(0x750D0396676E6ACCLL, imagecolorexact); + HASH_INVOKE_FROM_EVAL(0x2BD6476D2C467ACCLL, pagelet_server_task_status); + break; + case 2765: + HASH_INVOKE_FROM_EVAL(0x173EDC165B673ACDLL, magicktransformimage); + break; + case 2769: + HASH_INVOKE_FROM_EVAL(0x47E2B4F7B8DE5AD1LL, xmlwriter_write_dtd_attlist); + HASH_INVOKE_FROM_EVAL(0x314317450857FAD1LL, ctype_punct); + break; + case 2773: + HASH_INVOKE_FROM_EVAL(0x0D5DAF8034B41AD5LL, get_include_path); + break; + case 2774: + HASH_INVOKE_FROM_EVAL(0x231BCE6071220AD6LL, drawcircle); + break; + case 2776: + HASH_INVOKE_FROM_EVAL(0x52401023E146AAD8LL, xmlwriter_end_dtd); + break; + case 2779: + HASH_INVOKE_FROM_EVAL(0x24771ED112008ADBLL, echo); + break; + case 2780: + HASH_INVOKE_FROM_EVAL(0x547E7EE64761AADCLL, imagecreatefromxbm); + break; + case 2781: + HASH_INVOKE_FROM_EVAL(0x3E319E451A32FADDLL, magicksharpenimage); + break; + case 2788: + HASH_INVOKE_FROM_EVAL(0x47B15A7136E94AE4LL, strnatcasecmp); + HASH_INVOKE_FROM_EVAL(0x1827F1C22F1CCAE4LL, hebrevc); + break; + case 2790: + HASH_INVOKE_FROM_EVAL(0x0E09D0FEA30B6AE6LL, hphp_get_function_info); + break; + case 2795: + HASH_INVOKE_FROM_EVAL(0x225F05071947BAEBLL, drawpathlinetoabsolute); + break; + case 2797: + HASH_INVOKE_FROM_EVAL(0x46C33B4739C2FAEDLL, shm_remove_var); + break; + case 2798: + HASH_INVOKE_FROM_EVAL(0x160A82E3E2CBBAEELL, is_finite); + break; + case 2800: + HASH_INVOKE_FROM_EVAL(0x6B259D5D9D681AF0LL, register_postsend_function); + break; + case 2804: + HASH_INVOKE_FROM_EVAL(0x2EC0ABF9A979FAF4LL, ob_get_level); + break; + case 2806: + HASH_INVOKE_FROM_EVAL(0x2C7C9772AE983AF6LL, drawsetgravity); + break; + case 2808: + HASH_INVOKE_FROM_EVAL(0x12859AD75BAF3AF8LL, magickreadimageblob); + break; + case 2813: + HASH_INVOKE_FROM_EVAL(0x16BA422EB6C51AFDLL, gzwrite); + break; + case 2814: + HASH_INVOKE_FROM_EVAL(0x04E86BA79B6CBAFELL, stream_socket_shutdown); + break; + case 2815: + HASH_INVOKE_FROM_EVAL(0x7833F4C337542AFFLL, openssl_pkey_export); + break; + case 2817: + HASH_INVOKE_FROM_EVAL(0x6F3503C7FB12DB01LL, lchgrp); + break; + case 2819: + HASH_INVOKE_FROM_EVAL(0x673A96C50F00FB03LL, str_word_count); + HASH_INVOKE_FROM_EVAL(0x32458C11C6E74B03LL, pixelsetblackquantum); + break; + case 2826: + HASH_INVOKE_FROM_EVAL(0x14B366EF64A66B0ALL, get_loaded_extensions); + HASH_INVOKE_FROM_EVAL(0x14AF32A23B507B0ALL, metaphone); + break; + case 2829: + HASH_INVOKE_FROM_EVAL(0x368DBC0699272B0DLL, magicknegateimage); + break; + case 2836: + HASH_INVOKE_FROM_EVAL(0x76675F14C1138B14LL, gzuncompress); + break; + case 2837: + HASH_INVOKE_FROM_EVAL(0x24D0895FBB7BCB15LL, is_callable); + break; + case 2839: + HASH_INVOKE_FROM_EVAL(0x66F9A476DAB47B17LL, pixelsetcolor); + break; + case 2840: + HASH_INVOKE_FROM_EVAL(0x70448A629A74FB18LL, ksort); + break; + case 2841: + HASH_INVOKE_FROM_EVAL(0x0551EACBE8278B19LL, decoct); + break; + case 2842: + HASH_INVOKE_FROM_EVAL(0x399522EE0CF3EB1ALL, drawsetstrokewidth); + break; + case 2843: + HASH_INVOKE_FROM_EVAL(0x1B7CE8114AEACB1BLL, magickannotateimage); + break; + case 2844: + HASH_INVOKE_FROM_EVAL(0x249399CEC35B7B1CLL, png2wbmp); + break; + case 2845: + HASH_INVOKE_FROM_EVAL(0x6791459B883F0B1DLL, apache_reset_timeout); + break; + case 2846: + HASH_INVOKE_FROM_EVAL(0x7160AA24D4251B1ELL, mb_strripos); + break; + case 2848: + HASH_INVOKE_FROM_EVAL(0x2563BB012A5C3B20LL, oci_define_by_name); + HASH_INVOKE_FROM_EVAL(0x1112712715D75B20LL, pixelgetblackquantum); + break; + case 2853: + HASH_INVOKE_FROM_EVAL(0x798F2776FECAEB25LL, get_required_files); + break; + case 2854: + HASH_INVOKE_FROM_EVAL(0x24CE95457EACBB26LL, get_parent_class); + break; + case 2857: + HASH_INVOKE_FROM_EVAL(0x17C38BE3A6EE8B29LL, mysql_field_flags); + break; + case 2858: + HASH_INVOKE_FROM_EVAL(0x1F4984938E1DBB2ALL, sort); + break; + case 2860: + HASH_INVOKE_FROM_EVAL(0x70742211FA3EFB2CLL, imagettftext); + break; + case 2865: + HASH_INVOKE_FROM_EVAL(0x442B1E05FC146B31LL, stream_context_set_param); + break; + case 2867: + HASH_INVOKE_FROM_EVAL(0x00DCD60DD8752B33LL, set_exception_handler); + HASH_INVOKE_FROM_EVAL(0x4D5D45D1F1EB3B33LL, posix_access); + break; + case 2868: + HASH_INVOKE_FROM_EVAL(0x0B7D52E2540ABB34LL, tan); + break; + case 2869: + HASH_INVOKE_FROM_EVAL(0x78842C1950B38B35LL, drawpathfinish); + break; + case 2871: + HASH_INVOKE_FROM_EVAL(0x053B14F52350FB37LL, socket_shutdown); + break; + case 2872: + HASH_INVOKE_FROM_EVAL(0x68C09D6CB8E79B38LL, class_exists); + break; + case 2873: + HASH_INVOKE_FROM_EVAL(0x02A2C373E54FFB39LL, hash_init); + break; + case 2874: + HASH_INVOKE_FROM_EVAL(0x49A45F75B2B25B3ALL, apd_breakpoint); + break; + case 2876: + HASH_INVOKE_FROM_EVAL(0x35F4A0789F367B3CLL, drawpathlinetohorizontalrelative); + break; + case 2878: + HASH_INVOKE_FROM_EVAL(0x5E2AF775FEB04B3ELL, posix_getppid); + break; + case 2879: + HASH_INVOKE_FROM_EVAL(0x0B07AD87DF1B5B3FLL, urldecode); + break; + case 2880: + HASH_INVOKE_FROM_EVAL(0x24CBCBA5C4407B40LL, evhttp_set_cache); + break; + case 2884: + HASH_INVOKE_FROM_EVAL(0x4E4449EBAADD7B44LL, magickpingimage); + break; + case 2885: + HASH_INVOKE_FROM_EVAL(0x684881C79ED1AB45LL, func_get_args); + HASH_INVOKE_FROM_EVAL(0x72E3AE55A0B33B45LL, ispixelwand); + break; + case 2886: + HASH_INVOKE_FROM_EVAL(0x00D8FE7A00252B46LL, escapeshellarg); + break; + case 2893: + HASH_INVOKE_FROM_EVAL(0x37DF53E4D9348B4DLL, xbox_post_message); + break; + case 2896: + HASH_INVOKE_FROM_EVAL(0x6237393C71E56B50LL, array_fill_keys); + break; + case 2899: + HASH_INVOKE_FROM_EVAL(0x40F0B69D55F7EB53LL, drawsetstrokealpha); + break; + case 2901: + HASH_INVOKE_FROM_EVAL(0x333FB673518A1B55LL, ldap_get_entries); + break; + case 2904: + HASH_INVOKE_FROM_EVAL(0x6158E2E0A5ACCB58LL, idn_to_ascii); + break; + case 2907: + HASH_INVOKE_FROM_EVAL(0x23FD09A13E0D8B5BLL, xmlwriter_open_memory); + break; + case 2913: + HASH_INVOKE_FROM_EVAL(0x7636825871399B61LL, highlight_file); + break; + case 2920: + HASH_INVOKE_FROM_EVAL(0x674F1DA24EDE7B68LL, xmlwriter_end_attribute); + break; + case 2922: + HASH_INVOKE_FROM_EVAL(0x4BD4E9D9D4A56B6ALL, exif_tagname); + break; + case 2923: + HASH_INVOKE_FROM_EVAL(0x5543A0CACD153B6BLL, substr_replace); + HASH_INVOKE_FROM_EVAL(0x1D4136B4CEAE4B6BLL, stripcslashes); + break; + case 2927: + HASH_INVOKE_FROM_EVAL(0x2D8D57FC1DC6CB6FLL, import_request_variables); + break; + case 2928: + HASH_INVOKE_FROM_EVAL(0x1A73FD4416FECB70LL, magickwriteimagefile); + break; + case 2929: + HASH_INVOKE_FROM_EVAL(0x5E5C875DB04CFB71LL, drawrectangle); + break; + case 2933: + HASH_INVOKE_FROM_EVAL(0x42F0AED7599C1B75LL, magickechoimageblob); + break; + case 2934: + HASH_INVOKE_FROM_EVAL(0x2A63A0BF9B7E3B76LL, ini_alter); + break; + case 2935: + HASH_INVOKE_FROM_EVAL(0x7F5F29D8E63ABB77LL, mcrypt_module_self_test); + HASH_INVOKE_FROM_EVAL(0x5025B43B46679B77LL, openssl_x509_free); + break; + case 2937: + HASH_INVOKE_FROM_EVAL(0x31242F51AA828B79LL, drawpoppattern); + break; + case 2940: + HASH_INVOKE_FROM_EVAL(0x3A096F905FBF7B7CLL, magickcommentimage); + break; + case 2941: + HASH_INVOKE_FROM_EVAL(0x28DE19828167FB7DLL, magickmapimage); + break; + case 2943: + HASH_INVOKE_FROM_EVAL(0x308C90AD9478CB7FLL, substr_compare); + break; + case 2946: + HASH_INVOKE_FROM_EVAL(0x5BDE96FD5015AB82LL, base_convert); + break; + case 2949: + HASH_INVOKE_FROM_EVAL(0x41F8FDD700C0CB85LL, socket_last_error); + break; + case 2955: + HASH_INVOKE_FROM_EVAL(0x3B72159A4B04FB8BLL, set_time_limit); + break; + case 2957: + HASH_INVOKE_FROM_EVAL(0x3B831DB1A615FB8DLL, xhprof_sample_enable); + break; + case 2958: + HASH_INVOKE_FROM_EVAL(0x62A4D7A03F7C3B8ELL, ceil); + break; + case 2965: + HASH_INVOKE_FROM_EVAL(0x687104D0A7C11B95LL, oci_new_descriptor); + break; + case 2967: + HASH_INVOKE_FROM_EVAL(0x09837A82A928AB97LL, is_null); + break; + case 2969: + HASH_INVOKE_FROM_EVAL(0x076E66D4089A3B99LL, mb_stripos); + break; + case 2970: + HASH_INVOKE_FROM_EVAL(0x023133732CB51B9ALL, exif_thumbnail); + break; + case 2975: + HASH_INVOKE_FROM_EVAL(0x390A267EC6B51B9FLL, socket_sendto); + break; + case 2978: + HASH_INVOKE_FROM_EVAL(0x4870ADD98EE02BA2LL, pcntl_wifsignaled); + break; + case 2979: + HASH_INVOKE_FROM_EVAL(0x444A3375EFBC2BA3LL, openssl_public_decrypt); + break; + case 2980: + HASH_INVOKE_FROM_EVAL(0x0D95DD13A2D3BBA4LL, drawtranslate); + break; + case 2983: + HASH_INVOKE_FROM_EVAL(0x6DFBC598BA473BA7LL, fbml_get_tag_name_11); + break; + case 2986: + HASH_INVOKE_FROM_EVAL(0x7C833A303C7CFBAALL, getrandmax); + break; + case 2987: + HASH_INVOKE_FROM_EVAL(0x006481EAF2A70BABLL, ldap_errno); + break; + case 2991: + HASH_INVOKE_FROM_EVAL(0x6A2236CDDFF12BAFLL, magickhaspreviousimage); + break; + case 2992: + HASH_INVOKE_FROM_EVAL(0x1F3E4C6660247BB0LL, imagecolorresolve); + HASH_INVOKE_FROM_EVAL(0x7D9BF61D6CDE3BB0LL, fb_parallel_query); + break; + case 2993: + HASH_INVOKE_FROM_EVAL(0x04A24B397CF46BB1LL, strrchr); + break; + case 2997: + HASH_INVOKE_FROM_EVAL(0x3F7DCC3A00800BB5LL, imagecolorallocate); + break; + case 2998: + HASH_INVOKE_FROM_EVAL(0x3AD840AB993DDBB6LL, ldap_8859_to_t61); + break; + case 3004: + HASH_INVOKE_FROM_EVAL(0x43B74276235F4BBCLL, is_bool); + break; + case 3006: + HASH_INVOKE_FROM_EVAL(0x79617ED8EFD1ABBELL, get_class_vars); + HASH_INVOKE_FROM_EVAL(0x3F56AF1511AEDBBELL, magicklabelimage); + HASH_INVOKE_FROM_EVAL(0x5ECB0B145B88EBBELL, imagefilledarc); + HASH_INVOKE_FROM_EVAL(0x42684202E2E62BBELL, mcrypt_get_iv_size); + break; + case 3015: + HASH_INVOKE_FROM_EVAL(0x10C5CF7B55173BC7LL, settype); + break; + case 3017: + HASH_INVOKE_FROM_EVAL(0x0B4E7B9180C4ABC9LL, xml_set_end_namespace_decl_handler); + HASH_INVOKE_FROM_EVAL(0x22BA0903D344CBC9LL, array_rand); + break; + case 3021: + HASH_INVOKE_FROM_EVAL(0x22251ECF8CD58BCDLL, array_product); + HASH_INVOKE_FROM_EVAL(0x53A88C8F973CFBCDLL, apc_clear_cache); + break; + case 3022: + HASH_INVOKE_FROM_EVAL(0x45D6BA980AFFDBCELL, msg_get_queue); + HASH_INVOKE_FROM_EVAL(0x600AFF0A6378ABCELL, is_writeable); + break; + case 3024: + HASH_INVOKE_FROM_EVAL(0x7046755D8374EBD0LL, ctype_digit); + break; + case 3026: + HASH_INVOKE_FROM_EVAL(0x6FE3C5FF5E883BD2LL, round); + break; + case 3028: + HASH_INVOKE_FROM_EVAL(0x5B2F2A23D8368BD4LL, magickraiseimage); + HASH_INVOKE_FROM_EVAL(0x4E4EB301A994DBD4LL, drawpolygon); + break; + case 3032: + HASH_INVOKE_FROM_EVAL(0x21E44C7C7A911BD8LL, phpinfo); + break; + case 3038: + HASH_INVOKE_FROM_EVAL(0x58D0D9B66F045BDELL, strpos); + break; + case 3040: + HASH_INVOKE_FROM_EVAL(0x2E10B74DC6067BE0LL, strip_tags); + break; + case 3041: + HASH_INVOKE_FROM_EVAL(0x25FBB61480091BE1LL, mysql_client_encoding); + break; + case 3047: + HASH_INVOKE_FROM_EVAL(0x1BB5D99C1D29CBE7LL, strstr); + break; + case 3048: + HASH_INVOKE_FROM_EVAL(0x4E903B706977ABE8LL, imagepsslantfont); + break; + case 3051: + HASH_INVOKE_FROM_EVAL(0x505B44DDF2383BEBLL, drawgetfillcolor); + HASH_INVOKE_FROM_EVAL(0x0C1904372E8EDBEBLL, stream_copy_to_stream); + break; + case 3052: + HASH_INVOKE_FROM_EVAL(0x44279BB3E2191BECLL, socket_accept); + break; + case 3054: + HASH_INVOKE_FROM_EVAL(0x03F50E435DE20BEELL, magickclippathimage); + HASH_INVOKE_FROM_EVAL(0x790B7C44A3442BEELL, asort); + break; + case 3056: + HASH_INVOKE_FROM_EVAL(0x187C049E785A1BF0LL, iconv_get_encoding); + HASH_INVOKE_FROM_EVAL(0x04C0582DB1AD7BF0LL, mt_srand); + break; + case 3057: + HASH_INVOKE_FROM_EVAL(0x0CA96856E5BEFBF1LL, iptcparse); + break; + case 3060: + HASH_INVOKE_FROM_EVAL(0x1444DB037B4D5BF4LL, imagegammacorrect); + break; + case 3062: + HASH_INVOKE_FROM_EVAL(0x08B4BEBAB3312BF6LL, image_type_to_extension); + break; + case 3063: + HASH_INVOKE_FROM_EVAL(0x74ABB4A1E10BBBF7LL, time); + break; + case 3065: + HASH_INVOKE_FROM_EVAL(0x5B7F6E0A642BBBF9LL, sleep); + break; + case 3068: + HASH_INVOKE_FROM_EVAL(0x64F52E1DB5E95BFCLL, curl_multi_remove_handle); + break; + case 3074: + HASH_INVOKE_FROM_EVAL(0x249340DF734D9C02LL, magickgetimageheight); + break; + case 3077: + HASH_INVOKE_FROM_EVAL(0x2EC378A759F9EC05LL, xbox_task_status); + break; + case 3080: + HASH_INVOKE_FROM_EVAL(0x48E1616EE837FC08LL, is_uploaded_file); + break; + case 3083: + HASH_INVOKE_FROM_EVAL(0x0EEE484739520C0BLL, magickthresholdimage); + HASH_INVOKE_FROM_EVAL(0x0833BCE91C40CC0BLL, magickqueryconfigureoption); + break; + case 3090: + HASH_INVOKE_FROM_EVAL(0x510B683F2E764C12LL, fb_load_local_databases); + break; + case 3099: + HASH_INVOKE_FROM_EVAL(0x67742A0F218F6C1BLL, posix_initgroups); + HASH_INVOKE_FROM_EVAL(0x7D615C7E3ADB2C1BLL, xmlwriter_write_comment); + break; + case 3100: + HASH_INVOKE_FROM_EVAL(0x758A62BD65E6FC1CLL, imagegd2); + break; + case 3102: + HASH_INVOKE_FROM_EVAL(0x7039C5EBB1D6BC1ELL, array_walk); + break; + case 3103: + HASH_INVOKE_FROM_EVAL(0x3A5D921797669C1FLL, hphp_log); + HASH_INVOKE_FROM_EVAL(0x0D321888A29C6C1FLL, oci_fetch_object); + break; + case 3104: + HASH_INVOKE_FROM_EVAL(0x7BD43EB167198C20LL, xmlwriter_write_pi); + break; + case 3105: + HASH_INVOKE_FROM_EVAL(0x0179CBA2C5F4DC21LL, magickgetimageformat); + break; + case 3111: + HASH_INVOKE_FROM_EVAL(0x5A02EE8ED39F0C27LL, posix_getgrnam); + break; + case 3112: + HASH_INVOKE_FROM_EVAL(0x79A4E240F18BAC28LL, rand); + break; + case 3116: + HASH_INVOKE_FROM_EVAL(0x116C3EC924B9AC2CLL, imagegd); + break; + case 3122: + HASH_INVOKE_FROM_EVAL(0x0B9B362534621C32LL, isdrawingwand); + break; + case 3123: + HASH_INVOKE_FROM_EVAL(0x49965C44E9EE3C33LL, set_file_buffer); + break; + case 3128: + HASH_INVOKE_FROM_EVAL(0x21564F9315F3FC38LL, drawsettextdecoration); + break; + case 3134: + HASH_INVOKE_FROM_EVAL(0x15EC581662651C3ELL, date_parse); + break; + case 3141: + HASH_INVOKE_FROM_EVAL(0x6EF89BCAD607CC45LL, strncasecmp); + break; + case 3142: + HASH_INVOKE_FROM_EVAL(0x7D992445F5E37C46LL, magicktextureimage); + break; + case 3143: + HASH_INVOKE_FROM_EVAL(0x44055093E56E4C47LL, mcrypt_enc_get_key_size); + break; + case 3146: + HASH_INVOKE_FROM_EVAL(0x3C23768CFB492C4ALL, gzinflate); + break; + case 3148: + HASH_INVOKE_FROM_EVAL(0x0C485E94495F9C4CLL, fbjsparse); + break; + case 3150: + HASH_INVOKE_FROM_EVAL(0x5DAC1C64D8F08C4ELL, openssl_pkey_get_private); + break; + case 3152: + HASH_INVOKE_FROM_EVAL(0x04534F26B8D05C50LL, drawgetstrokecolor); + break; + case 3153: + HASH_INVOKE_FROM_EVAL(0x56EDB60C824E8C51LL, key); + break; + case 3154: + HASH_INVOKE_FROM_EVAL(0x1FC294B806F76C52LL, php_sapi_name); + break; + case 3160: + HASH_INVOKE_FROM_EVAL(0x1B8C3DA27170DC58LL, dirname); + break; + case 3161: + HASH_INVOKE_FROM_EVAL(0x57633BDF8DB3FC59LL, i18n_loc_set_attribute); + break; + case 3165: + HASH_INVOKE_FROM_EVAL(0x1F032B064680FC5DLL, oci_field_type); + break; + case 3169: + HASH_INVOKE_FROM_EVAL(0x6E54EEDA1D887C61LL, magicksetimageinterlacescheme); + HASH_INVOKE_FROM_EVAL(0x5176725DA884DC61LL, curl_setopt); + break; + case 3171: + HASH_INVOKE_FROM_EVAL(0x43C0E9827D502C63LL, array_intersect_assoc); + break; + case 3172: + HASH_INVOKE_FROM_EVAL(0x3409D717D9246C64LL, libxml_use_internal_errors); + break; + case 3175: + HASH_INVOKE_FROM_EVAL(0x07DC355325165C67LL, magickwriteimage); + break; + case 3176: + HASH_INVOKE_FROM_EVAL(0x10D6AE9D688D1C68LL, copy); + break; + case 3178: + HASH_INVOKE_FROM_EVAL(0x41BD9EA0BC5E4C6ALL, move_uploaded_file); + break; + case 3179: + HASH_INVOKE_FROM_EVAL(0x7C6B37BF6300AC6BLL, iconv_mime_encode); + break; + case 3185: + HASH_INVOKE_FROM_EVAL(0x1E074215FE5FCC71LL, set_error_handler); + break; + case 3189: + HASH_INVOKE_FROM_EVAL(0x528366F3195ACC75LL, xbox_task_result); + break; + case 3190: + HASH_INVOKE_FROM_EVAL(0x1C35934C6BC52C76LL, libxml_clear_errors); + HASH_INVOKE_FROM_EVAL(0x296AFFE84B5E4C76LL, oci_fetch_row); + break; + case 3192: + HASH_INVOKE_FROM_EVAL(0x665F08996BD4AC78LL, magicksetimagegreenprimary); + break; + case 3194: + HASH_INVOKE_FROM_EVAL(0x05D7B804ECDE8C7ALL, checkdnsrr); + HASH_INVOKE_FROM_EVAL(0x05F3BC04D61CAC7ALL, get_defined_vars); + break; + case 3201: + HASH_INVOKE_FROM_EVAL(0x767806D6F1053C81LL, sin); + break; + case 3204: + HASH_INVOKE_FROM_EVAL(0x5D49AF7004696C84LL, shm_detach); + break; + case 3205: + HASH_INVOKE_FROM_EVAL(0x56DA17241B793C85LL, mysql_set_timeout); + break; + case 3209: + HASH_INVOKE_FROM_EVAL(0x0F9C0C82F40F2C89LL, pixelsetcyanquantum); + break; + case 3214: + HASH_INVOKE_FROM_EVAL(0x467470230015AC8ELL, mcrypt_module_is_block_algorithm_mode); + break; + case 3215: + HASH_INVOKE_FROM_EVAL(0x4173EFD9A8EECC8FLL, magicknewimage); + break; + case 3216: + HASH_INVOKE_FROM_EVAL(0x05556EDFC1BB0C90LL, mysql_info); + HASH_INVOKE_FROM_EVAL(0x3F0C947E68D02C90LL, ini_get_all); + break; + case 3217: + HASH_INVOKE_FROM_EVAL(0x4E04B71729485C91LL, clonedrawingwand); + HASH_INVOKE_FROM_EVAL(0x78792DE5D00C6C91LL, html_profile); + break; + case 3219: + HASH_INVOKE_FROM_EVAL(0x0F8242C6327B5C93LL, dns_check_record); + break; + case 3222: + HASH_INVOKE_FROM_EVAL(0x47C5BC101A512C96LL, magickquantizeimage); + break; + case 3225: + HASH_INVOKE_FROM_EVAL(0x2EA6E1D600786C99LL, mb_strtoupper); + break; + case 3226: + HASH_INVOKE_FROM_EVAL(0x374F20BDAF709C9ALL, mb_preferred_mime_name); + break; + case 3227: + HASH_INVOKE_FROM_EVAL(0x36F7F9FD7766DC9BLL, xmlwriter_end_comment); + break; + case 3230: + HASH_INVOKE_FROM_EVAL(0x50296037C7968C9ELL, preg_split); + break; + case 3233: + HASH_INVOKE_FROM_EVAL(0x4590B5971EC9ACA1LL, getmygid); + break; + case 3235: + HASH_INVOKE_FROM_EVAL(0x737253E9FC112CA3LL, socket_close); + break; + case 3242: + HASH_INVOKE_FROM_EVAL(0x5B13DE83E2DE0CAALL, oci_rollback); + HASH_INVOKE_FROM_EVAL(0x653C0D78A3501CAALL, oci_fetch_all); + break; + case 3245: + HASH_INVOKE_FROM_EVAL(0x1C1216F2B7C16CADLL, ftell); + break; + case 3246: + HASH_INVOKE_FROM_EVAL(0x3ACD2F1EA5282CAELL, magickmattefloodfillimage); + break; + case 3248: + HASH_INVOKE_FROM_EVAL(0x373B3FADEACB7CB0LL, openssl_private_encrypt); + break; + case 3249: + HASH_INVOKE_FROM_EVAL(0x735555B148E58CB1LL, ldap_read); + break; + case 3250: + HASH_INVOKE_FROM_EVAL(0x56023CC5ECC9ECB2LL, dns_get_mx); + break; + case 3252: + HASH_INVOKE_FROM_EVAL(0x41FBEF9F7A024CB4LL, xmlwriter_end_element); + HASH_INVOKE_FROM_EVAL(0x742AD1AA5A80ECB4LL, output_reset_rewrite_vars); + break; + case 3254: + HASH_INVOKE_FROM_EVAL(0x560637BE51C36CB6LL, ezmlm_hash); + break; + case 3255: + HASH_INVOKE_FROM_EVAL(0x3DFD5CA79919DCB7LL, imageantialias); + HASH_INVOKE_FROM_EVAL(0x39E03AAC188D3CB7LL, magickgetimagecompressionquality); + break; + case 3259: + HASH_INVOKE_FROM_EVAL(0x41D3B07854936CBBLL, token_get_all); + HASH_INVOKE_FROM_EVAL(0x15ACD9F32D214CBBLL, mysql_fetch_lengths); + break; + case 3260: + HASH_INVOKE_FROM_EVAL(0x19C1872E55A7ECBCLL, is_long); + HASH_INVOKE_FROM_EVAL(0x3978BE548631ECBCLL, hash_final); + break; + case 3264: + HASH_INVOKE_FROM_EVAL(0x3033FE14E114FCC0LL, magicksetimageblueprimary); + break; + case 3266: + HASH_INVOKE_FROM_EVAL(0x42BCEFCF899D0CC2LL, magickgetimagecolorspace); + HASH_INVOKE_FROM_EVAL(0x34B6388D7730BCC2LL, drawline); + break; + case 3278: + HASH_INVOKE_FROM_EVAL(0x0183A548B759BCCELL, posix_getpgid); + HASH_INVOKE_FROM_EVAL(0x66273C5932B1FCCELL, clock_gettime); + break; + case 3279: + HASH_INVOKE_FROM_EVAL(0x407B1F3AFEC43CCFLL, pixelgetblue); + break; + case 3281: + HASH_INVOKE_FROM_EVAL(0x576C5DC462663CD1LL, explode); + break; + case 3282: + HASH_INVOKE_FROM_EVAL(0x1FD3FB2AB0F48CD2LL, magickgetimagesignature); + break; + case 3283: + HASH_INVOKE_FROM_EVAL(0x544302E2FAD3FCD3LL, magicknextimage); + break; + case 3284: + HASH_INVOKE_FROM_EVAL(0x323FE1D92C9B3CD4LL, gzdecode); + break; + case 3285: + HASH_INVOKE_FROM_EVAL(0x757BC444FDF79CD5LL, posix_get_last_error); + break; + case 3286: + HASH_INVOKE_FROM_EVAL(0x11166D3106DB6CD6LL, wandhasexception); + break; + case 3289: + HASH_INVOKE_FROM_EVAL(0x27BFAF1293A60CD9LL, ldap_get_dn); + break; + case 3290: + HASH_INVOKE_FROM_EVAL(0x674AA2DBDA5E4CDALL, imageloadfont); + HASH_INVOKE_FROM_EVAL(0x09C6455B4BC6FCDALL, drawsetviewbox); + break; + case 3300: + HASH_INVOKE_FROM_EVAL(0x7CDDF96AFEA2DCE4LL, chunk_split); + break; + case 3306: + HASH_INVOKE_FROM_EVAL(0x5A8AF4F880DA4CEALL, mailparse_msg_extract_whole_part_file); + HASH_INVOKE_FROM_EVAL(0x7821BD05E5228CEALL, imagewbmp); + break; + case 3309: + HASH_INVOKE_FROM_EVAL(0x4952EB6C693ECCEDLL, fbml_parse_opaque_11); + break; + case 3310: + HASH_INVOKE_FROM_EVAL(0x78FFA0E69D6AACEELL, mcrypt_cfb); + break; + case 3311: + HASH_INVOKE_FROM_EVAL(0x6AA89C314C647CEFLL, magickgetimagehistogram); + break; + case 3313: + HASH_INVOKE_FROM_EVAL(0x21C8FC9A94404CF1LL, php_ini_scanned_files); + break; + case 3314: + HASH_INVOKE_FROM_EVAL(0x26C49BBC67475CF2LL, magicksetimagewhitepoint); + break; + case 3315: + HASH_INVOKE_FROM_EVAL(0x5C1F75D51C077CF3LL, pixelgetindex); + break; + case 3319: + HASH_INVOKE_FROM_EVAL(0x1C30C8470100ECF7LL, mcrypt_enc_is_block_mode); + break; + case 3321: + HASH_INVOKE_FROM_EVAL(0x537CF5DE8C43CCF9LL, curl_getinfo); + break; + case 3323: + HASH_INVOKE_FROM_EVAL(0x09B4EE276DCCFCFBLL, mysql_fetch_row); + break; + case 3326: + HASH_INVOKE_FROM_EVAL(0x768F3E6D1CBA5CFELL, socket_recv); + break; + case 3327: + HASH_INVOKE_FROM_EVAL(0x748D3DFF0EB57CFFLL, uniqid); + HASH_INVOKE_FROM_EVAL(0x48A2F2A7A4620CFFLL, pixelsetyellowquantum); + break; + case 3330: + HASH_INVOKE_FROM_EVAL(0x018F22AEA371ED02LL, filemtime); + break; + case 3331: + HASH_INVOKE_FROM_EVAL(0x48EE7157C4392D03LL, apache_getenv); + break; + case 3332: + HASH_INVOKE_FROM_EVAL(0x1248250E701DAD04LL, magickgaussianblurimage); + break; + case 3334: + HASH_INVOKE_FROM_EVAL(0x2BA9FB0F8B76DD06LL, number_format); + break; + case 3335: + HASH_INVOKE_FROM_EVAL(0x19B643D858DC6D07LL, magickgetimagerenderingintent); + break; + case 3337: + HASH_INVOKE_FROM_EVAL(0x153F7DBFC9047D09LL, pixelsetred); + break; + case 3340: + HASH_INVOKE_FROM_EVAL(0x30A8326034801D0CLL, mysql_pconnect); + break; + case 3341: + HASH_INVOKE_FROM_EVAL(0x3ACE8A8BC9ACDD0DLL, iconv_mime_decode); + break; + case 3344: + HASH_INVOKE_FROM_EVAL(0x42BEEC88EE81FD10LL, imagechar); + HASH_INVOKE_FROM_EVAL(0x08F41A00D5D57D10LL, mb_decode_mimeheader); + HASH_INVOKE_FROM_EVAL(0x5CEFA5A265104D10LL, count); + break; + case 3345: + HASH_INVOKE_FROM_EVAL(0x2D484921B5400D11LL, magickradialblurimage); + break; + case 3348: + HASH_INVOKE_FROM_EVAL(0x63837ECAF6235D14LL, preg_replace); + break; + case 3351: + HASH_INVOKE_FROM_EVAL(0x12BB5E00E714ED17LL, magickgetimagecompose); + break; + case 3354: + HASH_INVOKE_FROM_EVAL(0x75DB75CA9DE56D1ALL, xml_parser_get_option); + break; + case 3355: + HASH_INVOKE_FROM_EVAL(0x70C22A7EEF54CD1BLL, ldap_compare); + break; + case 3359: + HASH_INVOKE_FROM_EVAL(0x566465036CCBCD1FLL, min); + break; + case 3365: + HASH_INVOKE_FROM_EVAL(0x71DF0C17F47EDD25LL, getprotobynumber); + break; + case 3368: + HASH_INVOKE_FROM_EVAL(0x7C12261259F87D28LL, mcrypt_enc_is_block_algorithm_mode); + break; + case 3369: + HASH_INVOKE_FROM_EVAL(0x632D50B69429ED29LL, socket_set_block); + break; + case 3370: + HASH_INVOKE_FROM_EVAL(0x7A9C06B9CF853D2ALL, substr_count); + break; + case 3378: + HASH_INVOKE_FROM_EVAL(0x4DAC43060BA57D32LL, stream_wrapper_restore); + break; + case 3383: + HASH_INVOKE_FROM_EVAL(0x3ACF745D381E9D37LL, rtrim); + break; + case 3384: + HASH_INVOKE_FROM_EVAL(0x0BA3AD85EB597D38LL, pagelet_server_task_result); + break; + case 3387: + HASH_INVOKE_FROM_EVAL(0x0784B2B034560D3BLL, destroypixelwand); + HASH_INVOKE_FROM_EVAL(0x6C9AE626DAD02D3BLL, mailparse_msg_extract_part_file); + break; + case 3392: + HASH_INVOKE_FROM_EVAL(0x198627C81DABAD40LL, register_cleanup_function); + break; + case 3393: + HASH_INVOKE_FROM_EVAL(0x6B6DA1EE18673D41LL, xmlwriter_end_dtd_entity); + break; + case 3394: + HASH_INVOKE_FROM_EVAL(0x40497FCA4EC4DD42LL, posix_seteuid); + HASH_INVOKE_FROM_EVAL(0x298BA735FA3ABD42LL, nl_langinfo); + break; + case 3397: + HASH_INVOKE_FROM_EVAL(0x400A44045A999D45LL, rawurlencode); + break; + case 3398: + HASH_INVOKE_FROM_EVAL(0x502CF4EB0A747D46LL, magicksetimagebias); + HASH_INVOKE_FROM_EVAL(0x455DB7F86BCEDD46LL, pixelsetopacityquantum); + HASH_INVOKE_FROM_EVAL(0x59AD2C922FF75D46LL, mdecrypt_generic); + break; + case 3400: + HASH_INVOKE_FROM_EVAL(0x1C6F3EB2B6B16D48LL, phprof_disable); + break; + case 3401: + HASH_INVOKE_FROM_EVAL(0x113ED435AEFDDD49LL, imagecolorallocatealpha); + HASH_INVOKE_FROM_EVAL(0x41785512C45FCD49LL, mysql_ping); + break; + case 3407: + HASH_INVOKE_FROM_EVAL(0x0FBCF35ADD209D4FLL, drawarc); + break; + case 3408: + HASH_INVOKE_FROM_EVAL(0x39B11A2A25E40D50LL, mysql_get_server_info); + HASH_INVOKE_FROM_EVAL(0x337D2252CDA22D50LL, is_real); + break; + case 3413: + HASH_INVOKE_FROM_EVAL(0x36D672EF4FBEFD55LL, json_encode); + break; + case 3418: + HASH_INVOKE_FROM_EVAL(0x4ACCF26A7AE80D5ALL, imagefilltoborder); + break; + case 3419: + HASH_INVOKE_FROM_EVAL(0x41B5E3D2AADE2D5BLL, drawroundrectangle); + break; + case 3420: + HASH_INVOKE_FROM_EVAL(0x1371413B4F6F8D5CLL, pixelgetred); + break; + case 3424: + HASH_INVOKE_FROM_EVAL(0x6FACBD7F02B6FD60LL, uasort); + HASH_INVOKE_FROM_EVAL(0x567276D68FE12D60LL, preg_quote); + break; + case 3425: + HASH_INVOKE_FROM_EVAL(0x34F150F3D94E6D61LL, gzpassthru); + HASH_INVOKE_FROM_EVAL(0x357BAB6E700EBD61LL, destroypixelwandarray); + break; + case 3427: + HASH_INVOKE_FROM_EVAL(0x470A406564DBAD63LL, oci_field_type_raw); + break; + case 3430: + HASH_INVOKE_FROM_EVAL(0x0C393EE8F6540D66LL, bccomp); + break; + case 3434: + HASH_INVOKE_FROM_EVAL(0x6F37BD7643602D6ALL, fbml_flatten_11); + break; + case 3437: + HASH_INVOKE_FROM_EVAL(0x21D924BA98BFCD6DLL, file_get_contents); + HASH_INVOKE_FROM_EVAL(0x7D9E024FD8696D6DLL, get_class); + HASH_INVOKE_FROM_EVAL(0x4351AFD0FD818D6DLL, magickmotionblurimage); + break; + case 3438: + HASH_INVOKE_FROM_EVAL(0x0B1348D1540E7D6ELL, magicksetimageformat); + break; + case 3443: + HASH_INVOKE_FROM_EVAL(0x7D8DCC72522CBD73LL, mb_detect_encoding); + break; + case 3446: + HASH_INVOKE_FROM_EVAL(0x7467E8107EF08D76LL, unpack); + break; + case 3447: + HASH_INVOKE_FROM_EVAL(0x3ED49C2BBDDFAD77LL, ldap_next_reference); + break; + case 3448: + HASH_INVOKE_FROM_EVAL(0x6352349F97557D78LL, stream_socket_get_name); + break; + case 3451: + HASH_INVOKE_FROM_EVAL(0x680A7EB3DA1F5D7BLL, prev); + break; + case 3454: + HASH_INVOKE_FROM_EVAL(0x384E8BC9B5FE2D7ELL, magickfximage); + break; + case 3455: + HASH_INVOKE_FROM_EVAL(0x4E19AFB75A62AD7FLL, imagerotate); + break; + case 3457: + HASH_INVOKE_FROM_EVAL(0x25EA810DAEA74D81LL, ob_clean); + break; + case 3458: + HASH_INVOKE_FROM_EVAL(0x2D15262403ADDD82LL, drawcomposite); + break; + case 3459: + HASH_INVOKE_FROM_EVAL(0x1B0FF5C02F571D83LL, fb_rename_function); + break; + case 3463: + HASH_INVOKE_FROM_EVAL(0x344091B785FE8D87LL, socket_set_timeout); + break; + case 3464: + HASH_INVOKE_FROM_EVAL(0x2AFF8525E93D6D88LL, drawsetfillopacity); + break; + case 3465: + HASH_INVOKE_FROM_EVAL(0x230E7AD147721D89LL, end); + break; + case 3470: + HASH_INVOKE_FROM_EVAL(0x6A351AEDFC4D0D8ELL, magickgetimagemimetype); + break; + case 3471: + HASH_INVOKE_FROM_EVAL(0x1806DC9468882D8FLL, gzfile); + break; + case 3472: + HASH_INVOKE_FROM_EVAL(0x5E4360FC28D0AD90LL, magicksetinterlacescheme); + break; + case 3473: + HASH_INVOKE_FROM_EVAL(0x48444F8F18E60D91LL, strftime); + HASH_INVOKE_FROM_EVAL(0x7C2B3FE61FBDFD91LL, openssl_pkey_get_details); + break; + case 3480: + HASH_INVOKE_FROM_EVAL(0x06A796D329C21D98LL, call_user_func); + break; + case 3486: + HASH_INVOKE_FROM_EVAL(0x30C1AE2B06990D9ELL, gzseek); + break; + case 3488: + HASH_INVOKE_FROM_EVAL(0x73B43ABDD5C61DA0LL, shuffle); + HASH_INVOKE_FROM_EVAL(0x5E8606470A09BDA0LL, magickposterizeimage); + HASH_INVOKE_FROM_EVAL(0x7084C6294240CDA0LL, octdec); + HASH_INVOKE_FROM_EVAL(0x167A11C41EB71DA0LL, pixelgetexceptiontype); + break; + case 3490: + HASH_INVOKE_FROM_EVAL(0x71583A8FEF5C7DA2LL, sys_get_temp_dir); + break; + case 3494: + HASH_INVOKE_FROM_EVAL(0x28DC1AD6DA9E7DA6LL, gethostbyname); + break; + case 3496: + HASH_INVOKE_FROM_EVAL(0x572AE270D9E4FDA8LL, socket_set_option); + HASH_INVOKE_FROM_EVAL(0x474A096265502DA8LL, glob); + break; + case 3498: + HASH_INVOKE_FROM_EVAL(0x6326C14D0FFA7DAALL, fb_thrift_serialize); + break; + case 3499: + HASH_INVOKE_FROM_EVAL(0x188720048AB37DABLL, magickquantizeimages); + HASH_INVOKE_FROM_EVAL(0x66764CAABFF4CDABLL, array_keys); + break; + case 3506: + HASH_INVOKE_FROM_EVAL(0x257371BC40186DB2LL, magickblurimage); + break; + case 3507: + HASH_INVOKE_FROM_EVAL(0x53F2C6F5AE244DB3LL, drawpushdefs); + break; + case 3512: + HASH_INVOKE_FROM_EVAL(0x2B1D442AEA06ADB8LL, strpbrk); + break; + case 3514: + HASH_INVOKE_FROM_EVAL(0x5E0C6E797607DDBALL, mysql_result); + HASH_INVOKE_FROM_EVAL(0x7964DE73DCA17DBALL, magickhasnextimage); + break; + case 3516: + HASH_INVOKE_FROM_EVAL(0x770DEDCB168B0DBCLL, mb_ereg_search_setpos); + break; + case 3517: + HASH_INVOKE_FROM_EVAL(0x48AA091B1E493DBDLL, setlocale); + HASH_INVOKE_FROM_EVAL(0x01E6FF7D9746CDBDLL, stream_socket_accept); + break; + case 3521: + HASH_INVOKE_FROM_EVAL(0x683E88F441F9BDC1LL, chgrp); + break; + case 3523: + HASH_INVOKE_FROM_EVAL(0x069EE6F604BA2DC3LL, array_reverse); + HASH_INVOKE_FROM_EVAL(0x0433140BB339DDC3LL, log); + break; + case 3524: + HASH_INVOKE_FROM_EVAL(0x2A38BA8B4A0F9DC4LL, apc_fetch); + break; + case 3526: + HASH_INVOKE_FROM_EVAL(0x73210FEAA2EACDC6LL, imagecolorsforindex); + break; + case 3528: + HASH_INVOKE_FROM_EVAL(0x66C3E73210067DC8LL, magickgetimageunits); + break; + case 3530: + HASH_INVOKE_FROM_EVAL(0x3BB701F2BDD0ADCALL, magickgetimageprofile); + break; + case 3534: + HASH_INVOKE_FROM_EVAL(0x3E5C990C32470DCELL, array_combine); + HASH_INVOKE_FROM_EVAL(0x4AD5B65BCE665DCELL, array_key_exists); + HASH_INVOKE_FROM_EVAL(0x40C3C7DE46D62DCELL, ob_start); + break; + case 3536: + HASH_INVOKE_FROM_EVAL(0x0E1C354339208DD0LL, imagetypes); + break; + case 3541: + HASH_INVOKE_FROM_EVAL(0x7E1801C8E70D1DD5LL, imagefontwidth); + break; + case 3543: + HASH_INVOKE_FROM_EVAL(0x638690DF6D06FDD7LL, imageconvolution); + HASH_INVOKE_FROM_EVAL(0x1AE08377A1630DD7LL, mysql_insert_id); + break; + case 3548: + HASH_INVOKE_FROM_EVAL(0x5EBE067E3FAECDDCLL, ob_gzhandler); + HASH_INVOKE_FROM_EVAL(0x2497295AC9F72DDCLL, stream_set_blocking); + break; + case 3549: + HASH_INVOKE_FROM_EVAL(0x3B00B916C3682DDDLL, ctype_upper); + break; + case 3560: + HASH_INVOKE_FROM_EVAL(0x47A4BA8616D02DE8LL, restore_exception_handler); + break; + case 3564: + HASH_INVOKE_FROM_EVAL(0x5B51DD18C3E13DECLL, openssl_x509_parse); + HASH_INVOKE_FROM_EVAL(0x5ABB7486CE861DECLL, array_merge_recursive); + break; + case 3567: + HASH_INVOKE_FROM_EVAL(0x0BB22147ADADDDEFLL, pfsockopen); + HASH_INVOKE_FROM_EVAL(0x72293DCE8CC4BDEFLL, htmlspecialchars); + break; + case 3571: + HASH_INVOKE_FROM_EVAL(0x7AE1BE187F18FDF3LL, fgets); + break; + case 3572: + HASH_INVOKE_FROM_EVAL(0x73B30E65808A6DF4LL, ctype_xdigit); + HASH_INVOKE_FROM_EVAL(0x5046A0D9DFDB5DF4LL, strcspn); + break; + case 3576: + HASH_INVOKE_FROM_EVAL(0x5E43280BC8DD1DF8LL, magicktrimimage); + break; + case 3579: + HASH_INVOKE_FROM_EVAL(0x47C62D58B0B65DFBLL, thrift_protocol_write_binary); + break; + case 3580: + HASH_INVOKE_FROM_EVAL(0x0432ED7109BBCDFCLL, oci_cancel); + break; + case 3582: + HASH_INVOKE_FROM_EVAL(0x21F24104004CFDFELL, evhttp_post); + break; + case 3586: + HASH_INVOKE_FROM_EVAL(0x7829D2171DFBFE02LL, magickgetimagegamma); + break; + case 3596: + HASH_INVOKE_FROM_EVAL(0x3AD6E084483B2E0CLL, array_udiff_assoc); + break; + case 3597: + HASH_INVOKE_FROM_EVAL(0x5EB0A2F93E650E0DLL, array_diff_key); + HASH_INVOKE_FROM_EVAL(0x756B92411E7FBE0DLL, stream_get_wrappers); + break; + case 3598: + HASH_INVOKE_FROM_EVAL(0x5230E4C9D8D64E0ELL, highlight_string); + break; + case 3602: + HASH_INVOKE_FROM_EVAL(0x05FAA2085D94FE12LL, urlencode); + HASH_INVOKE_FROM_EVAL(0x76636D0F0C090E12LL, curl_copy_handle); + break; + case 3604: + HASH_INVOKE_FROM_EVAL(0x41E394B12170BE14LL, socket_send); + HASH_INVOKE_FROM_EVAL(0x3192209D50C1FE14LL, pixelsetalpha); + break; + case 3605: + HASH_INVOKE_FROM_EVAL(0x525F197D74423E15LL, get_resource_type); + break; + case 3607: + HASH_INVOKE_FROM_EVAL(0x0F5759A501FAFE17LL, imagecreatefromgd2part); + HASH_INVOKE_FROM_EVAL(0x3D13FD5FE3AF6E17LL, imagestringup); + break; + case 3609: + HASH_INVOKE_FROM_EVAL(0x4A694B42B21A9E19LL, destroymagickwand); + break; + case 3611: + HASH_INVOKE_FROM_EVAL(0x7FA0B63054221E1BLL, magickrollimage); + break; + case 3616: + HASH_INVOKE_FROM_EVAL(0x7BDA47B5C47EAE20LL, fread); + break; + case 3617: + HASH_INVOKE_FROM_EVAL(0x5B7F218FA08D8E21LL, imagefilledellipse); + break; + case 3621: + HASH_INVOKE_FROM_EVAL(0x1C6246FA51EBDE25LL, hphp_get_static_property); + break; + case 3624: + HASH_INVOKE_FROM_EVAL(0x3456885FF0679E28LL, lchown); + break; + case 3625: + HASH_INVOKE_FROM_EVAL(0x73FE5C79E14A0E29LL, pixelsetbluequantum); + break; + case 3629: + HASH_INVOKE_FROM_EVAL(0x7817FA38BAAEFE2DLL, fsockopen); + break; + case 3634: + HASH_INVOKE_FROM_EVAL(0x000AAF93F814AE32LL, drawsetvectorgraphics); + break; + case 3635: + HASH_INVOKE_FROM_EVAL(0x38433635F28B4E33LL, is_readable); + break; + case 3638: + HASH_INVOKE_FROM_EVAL(0x2E42ED1E15CCFE36LL, mysql_affected_rows); + break; + case 3642: + HASH_INVOKE_FROM_EVAL(0x6E2CF6ECA0987E3ALL, get_headers); + HASH_INVOKE_FROM_EVAL(0x13048F0A79F7CE3ALL, magicksetsamplingfactors); + break; + case 3648: + HASH_INVOKE_FROM_EVAL(0x11681FDE841D0E40LL, drawskewy); + break; + case 3650: + HASH_INVOKE_FROM_EVAL(0x160B01F095B20E42LL, mb_output_handler); + break; + case 3654: + HASH_INVOKE_FROM_EVAL(0x7F4C1DF551150E46LL, pixelgetnextiteratorrow); + break; + case 3660: + HASH_INVOKE_FROM_EVAL(0x1EEBDFD62B6BEE4CLL, mcrypt_module_get_algo_block_size); + break; + case 3661: + HASH_INVOKE_FROM_EVAL(0x261E9B559C495E4DLL, oci_set_prefetch); + break; + case 3663: + HASH_INVOKE_FROM_EVAL(0x62C934CD93938E4FLL, magickimplodeimage); + break; + case 3664: + HASH_INVOKE_FROM_EVAL(0x4022005DE7E24E50LL, openssl_pkcs7_sign); + break; + case 3668: + HASH_INVOKE_FROM_EVAL(0x6BF155774D546E54LL, define_syslog_variables); + break; + case 3671: + HASH_INVOKE_FROM_EVAL(0x2DEF52641933CE57LL, magickgetimagemattecolor); + break; + case 3675: + HASH_INVOKE_FROM_EVAL(0x299F1A5895461E5BLL, curl_multi_close); + break; + case 3676: + HASH_INVOKE_FROM_EVAL(0x532D0D905CE60E5CLL, posix_times); + break; + case 3677: + HASH_INVOKE_FROM_EVAL(0x38373F6643B14E5DLL, ldap_parse_reference); + break; + case 3681: + HASH_INVOKE_FROM_EVAL(0x593EA675D239CE61LL, ldap_first_reference); + break; + case 3682: + HASH_INVOKE_FROM_EVAL(0x7639C74DBC4F4E62LL, array_splice); + break; + case 3683: + HASH_INVOKE_FROM_EVAL(0x4B6FE37D66784E63LL, imagesy); + HASH_INVOKE_FROM_EVAL(0x5697E5F6AAF47E63LL, mb_http_input); + break; + case 3684: + HASH_INVOKE_FROM_EVAL(0x4F0DF8BBC4340E64LL, stream_socket_server); + break; + case 3686: + HASH_INVOKE_FROM_EVAL(0x6CB3DEB458A2DE66LL, apc_bin_load); + break; + case 3688: + HASH_INVOKE_FROM_EVAL(0x5B1DFB89BFC1CE68LL, realpath); + break; + case 3689: + HASH_INVOKE_FROM_EVAL(0x24B836D2C79D0E69LL, magickgetimagepixels); + break; + case 3690: + HASH_INVOKE_FROM_EVAL(0x2F9816D9A2B2CE6ALL, mysql_set_charset); + HASH_INVOKE_FROM_EVAL(0x25C0C5E961AFDE6ALL, xmlwriter_full_end_element); + break; + case 3693: + HASH_INVOKE_FROM_EVAL(0x714001ABB0D76E6DLL, magickgetinterlacescheme); + break; + case 3695: + HASH_INVOKE_FROM_EVAL(0x7E6223D0CF184E6FLL, magickqueryformats); + break; + case 3697: + HASH_INVOKE_FROM_EVAL(0x6AC126DCE941FE71LL, memory_get_peak_usage); + break; + case 3700: + HASH_INVOKE_FROM_EVAL(0x47D0510206B89E74LL, ini_restore); + break; + case 3701: + HASH_INVOKE_FROM_EVAL(0x4EC7C66593DDEE75LL, sql_regcase); + break; + case 3702: + HASH_INVOKE_FROM_EVAL(0x36E9EC047FC73E76LL, mb_convert_encoding); + break; + case 3703: + HASH_INVOKE_FROM_EVAL(0x12B7B2D835B80E77LL, chmod); + break; + case 3706: + HASH_INVOKE_FROM_EVAL(0x6A3D9F8EDB005E7ALL, flush); + break; + case 3708: + HASH_INVOKE_FROM_EVAL(0x4D9C5B9A944CCE7CLL, convert_uudecode); + break; + case 3710: + HASH_INVOKE_FROM_EVAL(0x51060D186C703E7ELL, headers_list); + break; + case 3713: + HASH_INVOKE_FROM_EVAL(0x0ECFC3676B4FDE81LL, chr); + break; + case 3714: + HASH_INVOKE_FROM_EVAL(0x379F7BF525FF1E82LL, magicksetimagecolorspace); + break; + case 3715: + HASH_INVOKE_FROM_EVAL(0x724011CF7C31AE83LL, sqrt); + break; + case 3716: + HASH_INVOKE_FROM_EVAL(0x1765A63835CC4E84LL, drawgetfontfamily); + break; + case 3717: + HASH_INVOKE_FROM_EVAL(0x4710320ED6638E85LL, rename_function); + break; + case 3720: + HASH_INVOKE_FROM_EVAL(0x1569DCC552EE8E88LL, cosh); + break; + case 3722: + HASH_INVOKE_FROM_EVAL(0x15C9E5C16374EE8ALL, gzclose); + break; + case 3723: + HASH_INVOKE_FROM_EVAL(0x6FB196047821EE8BLL, fb_render_wrapped); + break; + case 3726: + HASH_INVOKE_FROM_EVAL(0x29A2FBD427647E8ELL, mysql_connect); + break; + case 3728: + HASH_INVOKE_FROM_EVAL(0x33D6CC3959D3CE90LL, clearmagickwand); + break; + case 3731: + HASH_INVOKE_FROM_EVAL(0x5E968924197F5E93LL, mcrypt_ofb); + HASH_INVOKE_FROM_EVAL(0x37A9E8F91C33EE93LL, magickborderimage); + break; + case 3735: + HASH_INVOKE_FROM_EVAL(0x6254E9BDC11F3E97LL, imagecreatefromgd2); + break; + case 3739: + HASH_INVOKE_FROM_EVAL(0x2A019CAA1188BE9BLL, preg_grep); + break; + case 3742: + HASH_INVOKE_FROM_EVAL(0x76EBE919625D8E9ELL, openssl_pkcs12_export); + break; + case 3743: + HASH_INVOKE_FROM_EVAL(0x7CFF820207DC6E9FLL, debug_backtrace); + break; + case 3744: + HASH_INVOKE_FROM_EVAL(0x37C5AF6E7E8B5EA0LL, fputs); + break; + case 3747: + HASH_INVOKE_FROM_EVAL(0x6467FFB910B8BEA3LL, magickspliceimage); + break; + case 3752: + HASH_INVOKE_FROM_EVAL(0x3C6190E9534F3EA8LL, ebcdic2ascii); + break; + case 3753: + HASH_INVOKE_FROM_EVAL(0x308D76DB12424EA9LL, magicksetimageindex); + break; + case 3755: + HASH_INVOKE_FROM_EVAL(0x632D4FC346797EABLL, pixelgetexceptionstring); + break; + case 3758: + HASH_INVOKE_FROM_EVAL(0x5772A0B8C16DAEAELL, posix_setuid); + break; + case 3759: + HASH_INVOKE_FROM_EVAL(0x12D83A92EFB0EEAFLL, xmlwriter_open_uri); + break; + case 3761: + HASH_INVOKE_FROM_EVAL(0x33FE101882726EB1LL, proc_close); + break; + case 3763: + HASH_INVOKE_FROM_EVAL(0x7DB9D839ACE0DEB3LL, natsort); + HASH_INVOKE_FROM_EVAL(0x7379B5B97EC2EEB3LL, hypot); + break; + case 3767: + HASH_INVOKE_FROM_EVAL(0x58B9EFA0FB35FEB7LL, stream_filter_prepend); + break; + case 3769: + HASH_INVOKE_FROM_EVAL(0x2A483AD7A3D07EB9LL, magickgetwandsize); + break; + case 3770: + HASH_INVOKE_FROM_EVAL(0x1F5B2728DE875EBALL, magicksetimage); + break; + case 3776: + HASH_INVOKE_FROM_EVAL(0x2475D7045D9DEEC0LL, magicksetimagecompression); + HASH_INVOKE_FROM_EVAL(0x495316E596537EC0LL, imagefttext); + break; + case 3778: + HASH_INVOKE_FROM_EVAL(0x4CDD0B7BF826FEC2LL, rewinddir); + break; + case 3780: + HASH_INVOKE_FROM_EVAL(0x7052903F1B17AEC4LL, parse_str); + break; + case 3785: + HASH_INVOKE_FROM_EVAL(0x58C8DCAAE5B7CEC9LL, get_cfg_var); + break; + case 3786: + HASH_INVOKE_FROM_EVAL(0x1AA83A1057BE6ECALL, mysql_field_len); + break; + case 3794: + HASH_INVOKE_FROM_EVAL(0x3CCD09EC3511CED2LL, apd_stop_trace); + break; + case 3798: + HASH_INVOKE_FROM_EVAL(0x134B37520683DED6LL, imagesetbrush); + break; + case 3800: + HASH_INVOKE_FROM_EVAL(0x338D9D95095D1ED8LL, magicksetimagedelay); + break; + case 3801: + HASH_INVOKE_FROM_EVAL(0x7F802A06996BBED9LL, apd_set_browser_trace); + break; + case 3802: + HASH_INVOKE_FROM_EVAL(0x29E2771785CCBEDALL, magickgettextdescent); + break; + case 3803: + HASH_INVOKE_FROM_EVAL(0x16331E18B5CD8EDBLL, timezone_open); + HASH_INVOKE_FROM_EVAL(0x1340509769275EDBLL, magickgetimagecompression); + break; + case 3808: + HASH_INVOKE_FROM_EVAL(0x7A1C6E429399CEE0LL, iconv_set_encoding); + break; + case 3811: + HASH_INVOKE_FROM_EVAL(0x28A98134BD97BEE3LL, mb_regex_encoding); + break; + case 3812: + HASH_INVOKE_FROM_EVAL(0x5B6FF42ACB2FBEE4LL, getmyuid); + break; + case 3813: + HASH_INVOKE_FROM_EVAL(0x367CFD20B4446EE5LL, is_array); + break; + case 3816: + HASH_INVOKE_FROM_EVAL(0x6CB6650E66CE4EE8LL, magicksetimagebordercolor); + break; + case 3819: + HASH_INVOKE_FROM_EVAL(0x72882DBF2D49CEEBLL, set_magic_quotes_runtime); + break; + case 3824: + HASH_INVOKE_FROM_EVAL(0x7DFF9707F1CD9EF0LL, dangling_server_proxy_old_request); + break; + case 3832: + HASH_INVOKE_FROM_EVAL(0x33FD10AC81146EF8LL, thrift_protocol_read_binary); + break; + case 3833: + HASH_INVOKE_FROM_EVAL(0x200FC256EB093EF9LL, gettimeofday); + break; + case 3835: + HASH_INVOKE_FROM_EVAL(0x6D450F078F02BEFBLL, apd_continue); + break; + case 3837: + HASH_INVOKE_FROM_EVAL(0x0CF27A6BC84CEEFDLL, openssl_get_publickey); + HASH_INVOKE_FROM_EVAL(0x283E167EB3F04EFDLL, posix_getgid); + break; + case 3840: + HASH_INVOKE_FROM_EVAL(0x09637D7CA2E33F00LL, fgetc); + break; + case 3841: + HASH_INVOKE_FROM_EVAL(0x66137942508EBF01LL, date_create); + HASH_INVOKE_FROM_EVAL(0x7B6A0D7510184F01LL, mysql_fetch_assoc); + break; + case 3842: + HASH_INVOKE_FROM_EVAL(0x78A02A603FA6FF02LL, magickreducenoiseimage); + break; + case 3845: + HASH_INVOKE_FROM_EVAL(0x6842585E79988F05LL, magickmosaicimages); + break; + case 3846: + HASH_INVOKE_FROM_EVAL(0x1D3B08AA0AF50F06LL, gettype); + HASH_INVOKE_FROM_EVAL(0x6692475BA65A2F06LL, imagearc); + break; + case 3851: + HASH_INVOKE_FROM_EVAL(0x7756593AAC1F6F0BLL, imagecreatefromstring); + break; + case 3855: + HASH_INVOKE_FROM_EVAL(0x61E7A36CA7FF5F0FLL, drawsetcliprule); + HASH_INVOKE_FROM_EVAL(0x4BD54A631F665F0FLL, drawpathcurvetosmoothabsolute); + break; + case 3856: + HASH_INVOKE_FROM_EVAL(0x700A75BF904DAF10LL, magickgetcharwidth); + break; + case 3858: + HASH_INVOKE_FROM_EVAL(0x042492DDA48C4F12LL, gzdeflate); + break; + case 3860: + HASH_INVOKE_FROM_EVAL(0x04525BA2AE51EF14LL, date_sun_info); + break; + case 3861: + HASH_INVOKE_FROM_EVAL(0x12F09EAED9078F15LL, mysql_fetch_field); + break; + case 3862: + HASH_INVOKE_FROM_EVAL(0x23B7D9E4EC992F16LL, stream_get_line); + HASH_INVOKE_FROM_EVAL(0x38664EFE3E0A0F16LL, json_decode); + break; + case 3867: + HASH_INVOKE_FROM_EVAL(0x27A4633381195F1BLL, chown); + break; + case 3871: + HASH_INVOKE_FROM_EVAL(0x7C0C145EFE0EBF1FLL, defined); + break; + case 3873: + HASH_INVOKE_FROM_EVAL(0x4282496A4BF42F21LL, php_uname); + HASH_INVOKE_FROM_EVAL(0x77EC28645855AF21LL, magicksetcompressionquality); + HASH_INVOKE_FROM_EVAL(0x1FF5B9A4FC78BF21LL, drawsettextantialias); + break; + case 3876: + HASH_INVOKE_FROM_EVAL(0x05BD68F1D09CEF24LL, array_count_values); + HASH_INVOKE_FROM_EVAL(0x5FA07E8B63BEAF24LL, mcrypt_enc_get_modes_name); + break; + case 3879: + HASH_INVOKE_FROM_EVAL(0x4BAA5B688E6F6F27LL, gd_info); + break; + case 3882: + HASH_INVOKE_FROM_EVAL(0x6276D05E81B9BF2ALL, fbml_get_attribute_11); + break; + case 3884: + HASH_INVOKE_FROM_EVAL(0x035EFF9E1757DF2CLL, http_build_query); + break; + case 3890: + HASH_INVOKE_FROM_EVAL(0x78257F34467BDF32LL, drawsetstrokedasharray); + HASH_INVOKE_FROM_EVAL(0x2B66EACB77AE9F32LL, print_r); + break; + case 3897: + HASH_INVOKE_FROM_EVAL(0x3E9146C06AAEFF39LL, magicksetimagecompressionquality); + HASH_INVOKE_FROM_EVAL(0x496CF4113CEA8F39LL, magicksetimagefilename); + break; + case 3899: + HASH_INVOKE_FROM_EVAL(0x7EE74F798791CF3BLL, magickedgeimage); + break; + case 3903: + HASH_INVOKE_FROM_EVAL(0x1A9EFDD653DB8F3FLL, pcntl_wstopsig); + break; + case 3906: + HASH_INVOKE_FROM_EVAL(0x3B46305DA1154F42LL, drawpopclippath); + break; + case 3909: + HASH_INVOKE_FROM_EVAL(0x4E36A077234B8F45LL, pixelgetblack); + HASH_INVOKE_FROM_EVAL(0x79265AADD9A8AF45LL, mcrypt_cbc); + HASH_INVOKE_FROM_EVAL(0x5D3A31AB0E326F45LL, crc32); + break; + case 3910: + HASH_INVOKE_FROM_EVAL(0x079EA27F72594F46LL, gzgets); + break; + case 3915: + HASH_INVOKE_FROM_EVAL(0x15145FAF11392F4BLL, fbml_precache_11); + break; + case 3920: + HASH_INVOKE_FROM_EVAL(0x7978A278AEAFAF50LL, pixelgetmagenta); + break; + case 3926: + HASH_INVOKE_FROM_EVAL(0x621590803EC88F56LL, imageline); + break; + case 3928: + HASH_INVOKE_FROM_EVAL(0x0551AAE8F1A6FF58LL, magicklevelimage); + break; + case 3929: + HASH_INVOKE_FROM_EVAL(0x38246B6BDE246F59LL, magickgetimagedispose); + break; + case 3931: + HASH_INVOKE_FROM_EVAL(0x24F698A8A4B5AF5BLL, imagecolordeallocate); + HASH_INVOKE_FROM_EVAL(0x76418F884500DF5BLL, stream_socket_enable_crypto); + break; + case 3933: + HASH_INVOKE_FROM_EVAL(0x07FF92CF46DDFF5DLL, imagepsfreefont); + break; + case 3936: + HASH_INVOKE_FROM_EVAL(0x4F1D2858AD31AF60LL, imagecreatefromgd); + break; + case 3938: + HASH_INVOKE_FROM_EVAL(0x463A00D839C51F62LL, oci_fetch_array); + break; + case 3939: + HASH_INVOKE_FROM_EVAL(0x1FFD204252F60F63LL, magicksetimageprofile); + break; + case 3940: + HASH_INVOKE_FROM_EVAL(0x280051555A21DF64LL, rename); + break; + case 3942: + HASH_INVOKE_FROM_EVAL(0x6FFF1304EA444F66LL, drawsetstrokemiterlimit); + break; + case 3943: + HASH_INVOKE_FROM_EVAL(0x319407AC92912F67LL, ereg); + break; + case 3946: + HASH_INVOKE_FROM_EVAL(0x1670096FDE27AF6ALL, rewind); + break; + case 3948: + HASH_INVOKE_FROM_EVAL(0x23D5E9E53D11BF6CLL, gmdate); + break; + case 3950: + HASH_INVOKE_FROM_EVAL(0x3A56371CDDEA0F6ELL, gzgetc); + break; + case 3951: + HASH_INVOKE_FROM_EVAL(0x42C4EC9D9F782F6FLL, htmlentities); + break; + case 3952: + HASH_INVOKE_FROM_EVAL(0x68C257B62A36EF70LL, magicksetimagebackgroundcolor); + HASH_INVOKE_FROM_EVAL(0x71557D108E5C0F70LL, xml_set_object); + break; + case 3954: + HASH_INVOKE_FROM_EVAL(0x4B22EF06BAA83F72LL, version_compare); + break; + case 3956: + HASH_INVOKE_FROM_EVAL(0x18BC9BF6D1E3CF74LL, magickpreviewimages); + break; + case 3961: + HASH_INVOKE_FROM_EVAL(0x4BE9D91DD8624F79LL, money_format); + break; + case 3962: + HASH_INVOKE_FROM_EVAL(0x7B0E6DB649084F7ALL, clearstatcache); + break; + case 3966: + HASH_INVOKE_FROM_EVAL(0x7064BEBF508F3F7ELL, socket_read); + break; + case 3968: + HASH_INVOKE_FROM_EVAL(0x63F18DE0DB807F80LL, magickqueryfonts); + break; + case 3972: + HASH_INVOKE_FROM_EVAL(0x14402B01D00E9F84LL, magicksteganoimage); + break; + case 3973: + HASH_INVOKE_FROM_EVAL(0x7EF68B9A55222F85LL, wandgetexceptionstring); + break; + case 3974: + HASH_INVOKE_FROM_EVAL(0x44CE4DB1CE7E9F86LL, flock); + break; + case 3977: + HASH_INVOKE_FROM_EVAL(0x13F52A829BAC0F89LL, timezone_identifiers_list); + break; + case 3979: + HASH_INVOKE_FROM_EVAL(0x2755DD4112AA5F8BLL, magicksampleimage); + HASH_INVOKE_FROM_EVAL(0x3703D22147C24F8BLL, pixelsetcyan); + break; + case 3982: + HASH_INVOKE_FROM_EVAL(0x7A8F1104B0CCDF8ELL, phpcredits); + break; + case 3985: + HASH_INVOKE_FROM_EVAL(0x78463112BE739F91LL, connection_timeout); + break; + case 3986: + HASH_INVOKE_FROM_EVAL(0x288D61E7DE28AF92LL, ucwords); + break; + case 3988: + HASH_INVOKE_FROM_EVAL(0x76B9D87BC7F02F94LL, preg_match); + break; + case 3989: + HASH_INVOKE_FROM_EVAL(0x40D620CBA0D41F95LL, opendir); + break; + case 3991: + HASH_INVOKE_FROM_EVAL(0x6F9651265C096F97LL, magickreadimages); + break; + case 3992: + HASH_INVOKE_FROM_EVAL(0x0293F60B46511F98LL, drawsetfontstretch); + HASH_INVOKE_FROM_EVAL(0x66F1F0DB16C82F98LL, imagesavealpha); + break; + case 3994: + HASH_INVOKE_FROM_EVAL(0x2B7CAC006AF27F9ALL, fflush); + break; + case 3997: + HASH_INVOKE_FROM_EVAL(0x0AD6DE8829773F9DLL, apc_compile_file); + break; + case 4006: + HASH_INVOKE_FROM_EVAL(0x0DEEA8C3E3A47FA6LL, read_exif_data); + break; + case 4013: + HASH_INVOKE_FROM_EVAL(0x73A9C0E0C8344FADLL, oci_free_statement); + break; + case 4014: + HASH_INVOKE_FROM_EVAL(0x64D269A505D51FAELL, array_map); + break; + case 4015: + HASH_INVOKE_FROM_EVAL(0x03979AACDBB24FAFLL, mailparse_msg_get_part); + break; + case 4016: + HASH_INVOKE_FROM_EVAL(0x4A0B5F4676578FB0LL, imagecolorresolvealpha); + break; + case 4017: + HASH_INVOKE_FROM_EVAL(0x0F78ECF42C30DFB1LL, array_chunk); + break; + case 4020: + HASH_INVOKE_FROM_EVAL(0x3900FDF1C97BEFB4LL, drawrotate); + break; + case 4022: + HASH_INVOKE_FROM_EVAL(0x56C0CCB57BB6EFB6LL, magicksetimageunits); + HASH_INVOKE_FROM_EVAL(0x2B451EF5D52C4FB6LL, array_diff); + break; + case 4023: + HASH_INVOKE_FROM_EVAL(0x6465CD999F4C5FB7LL, hphp_invoke_method); + break; + case 4024: + HASH_INVOKE_FROM_EVAL(0x6DB2DB341ECF3FB8LL, file_exists); + break; + case 4026: + HASH_INVOKE_FROM_EVAL(0x0664323CB1CC2FBALL, imagecolorset); + break; + case 4031: + HASH_INVOKE_FROM_EVAL(0x70B38AB9EAE16FBFLL, ini_set); + break; + case 4034: + HASH_INVOKE_FROM_EVAL(0x6CA22E62D4762FC2LL, magickpainttransparentimage); + break; + case 4043: + HASH_INVOKE_FROM_EVAL(0x38237A4515F42FCBLL, array_pad); + break; + case 4045: + HASH_INVOKE_FROM_EVAL(0x474566F3A2BE0FCDLL, mcrypt_enc_is_block_algorithm); + break; + case 4046: + HASH_INVOKE_FROM_EVAL(0x042193C97C65FFCELL, magickwaveimage); + break; + case 4047: + HASH_INVOKE_FROM_EVAL(0x3A3CFC1F001A6FCFLL, magickreadimagefile); + break; + case 4048: + HASH_INVOKE_FROM_EVAL(0x2EAA47FA6C3FEFD0LL, drawgetstrokealpha); + HASH_INVOKE_FROM_EVAL(0x53DB5D0490C51FD0LL, xhprof_sample_disable); + break; + case 4052: + HASH_INVOKE_FROM_EVAL(0x4970B72A182E4FD4LL, readdir); + break; + case 4053: + HASH_INVOKE_FROM_EVAL(0x751283FE764CAFD5LL, mysql_select_db); + break; + case 4054: + HASH_INVOKE_FROM_EVAL(0x7FC00035D14B9FD6LL, apc_delete_file); + break; + case 4056: + HASH_INVOKE_FROM_EVAL(0x4234F2B59531FFD8LL, posix_getlogin); + break; + case 4061: + HASH_INVOKE_FROM_EVAL(0x4EDEDA4278CD3FDDLL, magickchopimage); + break; + case 4062: + HASH_INVOKE_FROM_EVAL(0x7F5FC3CAF8CE9FDELL, gzcompress); + HASH_INVOKE_FROM_EVAL(0x72925D2DF7E61FDELL, drawpathcurvetoquadraticbeziersmoothrelative); + break; + case 4071: + HASH_INVOKE_FROM_EVAL(0x217067889854CFE7LL, xmlwriter_start_dtd); + break; + case 4079: + HASH_INVOKE_FROM_EVAL(0x00EEEE9C6CEA5FEFLL, xmlwriter_write_element_ns); + break; + case 4080: + HASH_INVOKE_FROM_EVAL(0x1189B7C4F4874FF0LL, php_check_syntax); + break; + case 4086: + HASH_INVOKE_FROM_EVAL(0x25FCE64E12505FF6LL, magicksetimagerenderingintent); + break; + case 4088: + HASH_INVOKE_FROM_EVAL(0x7C5A98EA30B22FF8LL, fbml_tag_list_expanded_11); + break; + case 4090: + HASH_INVOKE_FROM_EVAL(0x13EE24AF67113FFALL, ob_end_flush); + break; + case 4091: + HASH_INVOKE_FROM_EVAL(0x68E499A4D75BDFFBLL, ascii2ebcdic); + HASH_INVOKE_FROM_EVAL(0x63BE4CEF1FC47FFBLL, imagefill); + break; + case 4094: + HASH_INVOKE_FROM_EVAL(0x32F8747E480CCFFELL, connection_status); + break; + default: + break; + } + return invoke_failed(s, Array(), -1, fatal); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/sys/scalar_arrays_0.no.cpp b/src/lib/system/gen/sys/scalar_arrays_0.no.cpp new file mode 100644 index 0000000000000..e03c7bcf58eca --- /dev/null +++ b/src/lib/system/gen/sys/scalar_arrays_0.no.cpp @@ -0,0 +1,31 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +StaticArray SystemScalarArrays::ssa_[1]; + +void SystemScalarArrays::initialize() { + ssa_[0] = StaticArray((ArrayElement*)NULL); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/sys/system_globals.cpp b/src/lib/system/gen/sys/system_globals.cpp new file mode 100644 index 0000000000000..3d5e26ae89bd8 --- /dev/null +++ b/src/lib/system/gen/sys/system_globals.cpp @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +SystemGlobals::SystemGlobals() : dummy(false), + run_pm_php$classes$arrayaccess_php(false), + run_pm_php$classes$exception_php(false), + run_pm_php$classes$iterator_php(false), + run_pm_php$classes$pear_error_php(false), + run_pm_php$classes$reflection_php(false), + run_pm_php$classes$stdclass_php(false), + run_pm_php$globals$constants_php(false), + run_pm_php$globals$symbols_php(false) { + + // Dynamic Constants + + // Primitive Function/Method Static Variables + + // Primitive Class Static Variables + + // Redeclared Functions + + // Redeclared Classes +} + +void SystemGlobals::initialize() { + pm_php$classes$arrayaccess_php(false); + pm_php$classes$exception_php(false); + pm_php$classes$iterator_php(false); + pm_php$classes$pear_error_php(false); + pm_php$classes$reflection_php(false); + pm_php$classes$stdclass_php(false); + pm_php$globals$constants_php(false); + pm_php$globals$symbols_php(false); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/system/gen/sys/system_globals.h b/src/lib/system/gen/sys/system_globals.h new file mode 100644 index 0000000000000..138d99e33e693 --- /dev/null +++ b/src/lib/system/gen/sys/system_globals.h @@ -0,0 +1,201 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __GENERATED_SYS_SYSTEM_GLOBALS_H__ +#define __GENERATED_SYS_SYSTEM_GLOBALS_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + + +// Class Forward Declarations + +class SystemGlobals : public Globals { +public: + SystemGlobals(); + static void initialize(); + + bool dummy; // for easier constructor initializer output + + // Global Variables + Variant gv_argc; + Variant gv_argv; + Variant gv__SERVER; + Variant gv__GET; + Variant gv__POST; + Variant gv__COOKIE; + Variant gv__FILES; + Variant gv__ENV; + Variant gv__REQUEST; + Variant gv__SESSION; + Variant gv_HTTP_RAW_POST_DATA; + Variant gv_http_response_header; + + // Dynamic Constants + + // Function/Method Static Variables + + // Function/Method Static Variable Initialization Booleans + + // Class Static Variables + + // Class Static Initializer Flags + + // PseudoMain Variables + bool run_pm_php$classes$arrayaccess_php; + bool run_pm_php$classes$exception_php; + bool run_pm_php$classes$iterator_php; + bool run_pm_php$classes$pear_error_php; + bool run_pm_php$classes$reflection_php; + bool run_pm_php$classes$stdclass_php; + bool run_pm_php$globals$constants_php; + bool run_pm_php$globals$symbols_php; + + // Redeclared Functions + + // Redeclared Classes +}; + +// Scalar Arrays +class SystemScalarArrays { +public: + static void initialize(); + + static StaticArray ssa_[1]; +}; + +extern const int64 k_UCOL_CASE_LEVEL; +extern const StaticString k_MCC_ARG_POLL_TMO; +extern const int64 k_MCC_PROXY_GET_OP; +extern const StaticString k_MCC_ARG_CONN_NTRIES; +extern const int64 k_SQLITE3_TEXT; +extern const int64 k_MCC_SERVER_UP; +extern const int64 k_UCOL_CASE_FIRST; +extern const StaticString k_MCC_ARG_PROXY_OPS; +extern const int64 k_UCOL_DEFAULT_STRENGTH; +extern const int64 k_MCC_WINDOW_MAX; +extern const int64 k_SQLITE3_OPEN_CREATE; +extern const int64 k_FB_UNSERIALIZE_UNRECOGNIZED_OBJECT_TYPE; +extern const int64 k_UCOL_ON; +extern const int64 k_MCC_TMO_MS; +extern const int64 k_MCC_POOLPREFIX_LEN; +extern const int64 k_SQLITE3_FLOAT; +extern const double k_MCC_DGRAM_TMO_WEIGHT; +extern const int64 k_MCC_POLL_TMO_US; +extern const StaticString k_MCC_ARG_COMPRESSION_THRESHOLD; +extern const StaticString k_MCC_ARG_NZLIB_COMPRESSION; +extern const StaticString k_MCC_ARG_DEBUG_LOGFILE; +extern const int64 k_UCOL_SHIFTED; +extern const int64 k_FB_UNSERIALIZE_UNEXPECTED_ARRAY_KEY_TYPE; +extern const int64 k_UCOL_IDENTICAL; +extern const int64 k_SQLITE3_OPEN_READWRITE; +extern const int64 k_MCC_HAVE_DEBUG_LOG; +extern const int64 k_MCC_SERVER_RETRY_TMO_MS; +extern const int64 k_MCC_CONSISTENCY_MATCH_HITS; +extern const int64 k_SQLITE3_ASSOC; +extern const int64 k_MCC_CONN_TMO_MS; +extern const int64 k_SQLITE3_NUM; +extern const int64 k_PHPMCC_NEW_HANDLE; +extern const int64 k_UCOL_HIRAGANA_QUATERNARY_MODE; +extern const int64 k_UCOL_STRENGTH; +extern const int64 k_MCC_UDP_REPLY_PORTS; +extern const int64 k_UCOL_TERTIARY; +extern const StaticString k_MCC_ARG_DELETE_PROXY; +extern const StaticString k_MCC_ARG_DGRAM_NTRIES; +extern const int64 k_MCC_PROXY_ARITH_OP; +extern const int64 k_PHPMCC_USED_SLOW_PATH; +extern const int64 k_MCC_GET_RECORD_ERRORS; +extern const int64 k_PHPMCC_USED_FAST_PATH; +extern const StaticString k_MCC_ARG_SERVERS; +extern const int64 k_MCC_PORT_DEFAULT; +extern const StaticString k_MCC_ARG_CONSISTENT_HASHING_PREFIXES; +extern const StaticString k_MCC_ARG_TCP_INACTIVITY_TIME; +extern const StaticString k_MCC_ARG_DGRAM_TMO_THRESHOLD; +extern const int64 k_FB_UNSERIALIZE_NONSTRING_VALUE; +extern const int64 k_UCOL_UPPER_FIRST; +extern const StaticString k_MCC_ARG_DGRAM_TMO_WEIGHT; +extern const int64 k_SQLITE3_INTEGER; +extern const int64 k_MCC_TCP_INACTIVITY_TMO_DEFAULT; +extern const int64 k_MCC_COMPRESSION_THRESHHOLD; +extern const StaticString k_MCC_ARG_MIRROR_CFG_NAME; +extern const StaticString k_MCC_ARG_MIRROR_CFG_MODEL; +extern const int64 k_SQLITE3_BOTH; +extern const int64 k_MCC_RXDGRAM_MAX; +extern const StaticString k_MCC_ARG_MIRROR_CFG; +extern const int64 k_MCC_SERVER_DISABLED; +extern const int64 k_UCOL_LOWER_FIRST; +extern const int64 k_UCOL_SECONDARY; +extern const int64 k_MCC_PROXY_UPDATE_OP; +extern const StaticString k_MCC_ARG_WINDOW_MAX; +extern const int64 k_MCC_IPPROTO_TCP; +extern const StaticString k_MCC_ARG_UDP_REPLY_PORTS; +extern const StaticString k_MCC_ARG_CONN_TMO; +extern const int64 k_MCC_HAVE_FB_SERIALIZATION; +extern const int64 k_UCOL_ALTERNATE_HANDLING; +extern const int64 k_SQLITE3_OPEN_READONLY; +extern const int64 k_MCC_CONSISTENCY_MATCH_ALL; +extern const StaticString k_MCC_ARG_PERSISTENT; +extern const int64 k_UCOL_NUMERIC_COLLATION; +extern const StaticString k_PHPMCC_VERSION; +extern const int64 k_MCC_DELETE_ERROR_LOG; +extern const int64 k_UCOL_NORMALIZATION_MODE; +extern const int64 k_MCC_CONSISTENCY_MATCH_HITS_SUPERCEDES; +extern const StaticString k_MCC_ARG_NPOOLPREFIX; +extern const StaticString k_MCC_ARG_TMO; +extern const StaticString k_MCC_ARG_NODELAY; +extern const StaticString k_MCC_ARG_MIRROR_CFG_SERVERPOOLS; +extern const int64 k_MCC_DELETE_ERROR_NOLOG; +extern const int64 k_MCC_CONN_NTRIES; +extern const int64 k_MCC_DGRAM_NTRIES; +extern const int64 k_MCC_NODELAY; +extern const int64 k_UCOL_DEFAULT; +extern const StaticString k_MCC_ARG_FB_SERIALIZE_ENABLED; +extern const int64 k_MCC_IPPROTO_UDP; +extern const StaticString k_MCC_ARG_DEBUG; +extern const int64 k_MCC_MTU; +extern const StaticString k_MCC_ARG_DEFAULT_PREFIX; +extern const int64 k_UCOL_FRENCH_COLLATION; +extern const int64 k_MCC_CONSISTENCY_IGNORE; +extern const int64 k_UCOL_PRIMARY; +extern const int64 k_MCC_DGRAM_TMO_THRESHOLD; +extern const int64 k_UCOL_OFF; +extern const int64 k_MCC_SERVER_DOWN; +extern const int64 k_UCOL_QUATERNARY; +extern const int64 k_MCC_DELETE_DELETED; +extern const StaticString k_MCC_ARG_PROXY; +extern const int64 k_SQLITE3_NULL; +extern const int64 k_MCC_PROXY_DELETE_OP; +extern const int64 k_MCC_DELETE_NOTFOUND; +extern const StaticString k_MCC_ARG_SERVER_RETRY_TMO_MS; +extern const int64 k_UCOL_NON_IGNORABLE; +extern const int64 k_FB_UNSERIALIZE_UNEXPECTED_END; +extern const int64 k_SQLITE3_BLOB; +extern const int64 k_MCC_HAVE_ZLIB_COMPRESSION; + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __GENERATED_SYS_SYSTEM_GLOBALS_H__ diff --git a/src/lib/system/globals/constants.php b/src/lib/system/globals/constants.php new file mode 100644 index 0000000000000..c77fcb7e3f577 --- /dev/null +++ b/src/lib/system/globals/constants.php @@ -0,0 +1,1952 @@ + $value) { + if (is_resource($value)) continue; + + print "define('$name', "; + if (is_string($value) || preg_match('/^(INF|NAN)$/', $name)) { + if (preg_match('|/usr/local/|', $value)) { + $value = ''; + } + $value = preg_replace('/\r/', "\r", $value); + $value = preg_replace('/\n/', "\n", $value); + + print "'$value'"; + } else if (is_numeric($value)) { + print $value; + } else if (is_bool($value)) { + print $value ? "true" : "false"; + } else if (is_null($value)) { + print 'null'; + } else { + exit('doh'); + } + print ");\n"; +} + +print "// HPHP system constants\n"; +print "define('HPHP_TRIM_CHARLIST', \" \\n\\r\\t\\v\\0\");\n"; +print "define('CLOCK_REALTIME', 0);\n"; +print "define('CLOCK_MONOTONIC', 1);\n"; +print "define('CLOCK_PROCESS_CPUTIME_ID', 2);\n"; +print "define('CLOCK_THREAD_CPUTIME_ID', 3);\n"; +print "define('OPENSSL_KEYTYPE_EC', 3);\n"; diff --git a/src/lib/system/globals/symbols.php b/src/lib/system/globals/symbols.php new file mode 100644 index 0000000000000..f97d1a207751c --- /dev/null +++ b/src/lib/system/globals/symbols.php @@ -0,0 +1,28 @@ + +#include + +namespace HPHP { +using namespace std; +/////////////////////////////////////////////////////////////////////////////// + +JumpTable::JumpTable(CodeGenerator &cg, + const vector &keys, bool caseInsensitive, + bool hasPrehash, bool useString) + : m_cg(cg), m_subIter(0) { + if (keys.empty()) { + m_iter = m_table.end(); + return; + } + int tableSize = Util::roundUpToPowerOfTwo(keys.size() * 2); + CodeGenerator::BuildJumpTable(keys, m_table, tableSize, caseInsensitive); + if (hasPrehash) { + m_cg.printf("if (hash < 0) "); + } else { + m_cg.printf("int64 "); + } + m_cg.printf("hash = hash_string%s(", caseInsensitive ? "_i" : ""); + if (useString) { + m_cg.printf("s.data(), s.length()"); + } else { + m_cg.printf("s"); + } + m_cg.printf(");\n"); + m_cg.printStartOfJumpTable(tableSize); + m_iter = m_table.begin(); + if (ready()) { + m_cg.indentBegin("case %d:\n", m_iter->first); + } +} + +void JumpTable::next() { + ASSERT(ready()); + m_subIter++; + if (m_subIter >= m_iter->second.size()) { + m_cg.indentEnd(" break;\n"); + m_subIter = 0; + ++m_iter; + if (m_iter == m_table.end()) { + m_cg.printf("default:\n"); + m_cg.printf(" break;\n"); + m_cg.indentEnd("}\n"); + } else { + m_cg.indentBegin("case %d:\n", m_iter->first); + } + } +} + +bool JumpTable::ready() const { + return m_iter != m_table.end(); +} + +const char *JumpTable::key() const { + return m_iter->second.at(m_subIter); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/lib/util/jump_table.h b/src/lib/util/jump_table.h new file mode 100644 index 0000000000000..3e5c64828592a --- /dev/null +++ b/src/lib/util/jump_table.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __JUMP_TABLE_H__ +#define __JUMP_TABLE_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class JumpTable { +public: + JumpTable(CodeGenerator &cg, const std::vector &keys, + bool caseInsensitive, bool hasPrehash, bool useString); + bool ready() const; + void next(); + const char *key() const; +protected: + CodeGenerator &m_cg; + CodeGenerator::MapIntToStringVec::const_iterator m_iter; + CodeGenerator::MapIntToStringVec m_table; + uint m_subIter; + +}; + + +/////////////////////////////////////////////////////////////////////////////// +} +#endif // __JUMP_TABLE_H__ diff --git a/src/license.php b/src/license.php new file mode 100644 index 0000000000000..edf9a78d5a0f4 --- /dev/null +++ b/src/license.php @@ -0,0 +1,137 @@ + +# LIB_TARGETS = +# PROGRAMS = +# TARGETS = $(PROGRAMS) # add more targets than xxx +# +# 5. Mono-Target Project: +# +# CODEGEN_TARGETS = +# LIB_TARGETS = +# MONO_TARGETS = +# TARGETS = $(MONO_TARGETS) # add more targets than xxx +# +# The following targets are automatically defined: +# +# make clobber: delete all intermediate files and built targets +# make clean: delete all intermediate files without deleting targets +# make cleartargets: delete targets only +# (check default.mk for more) +# +# If there are extra files to remove when "make clobber" or "make clean", add +# them to $(INTERMEDIATE_FILES). +# +############################################################################### +# Machine specific information + +OS = $(shell echo `cat /etc/issue | head -1 | cut -d' ' -f1`) +ifeq ($(OS), CentOS) + +ifdef HPHP_DEV +OS = centos +else +OS = centos-dev +endif + +else +OS = fedora +endif + +GCC_VERSION = $(shell echo `gcc --version | head -1 | cut -d ' ' -f3`) + +############################################################################### +# Command line switches. For example, "make RELEASE=1". + +INFINITE_LOOP_DETECTION = 1 +INFINITE_RECURSION_DETECTION = 1 +REQUEST_TIMEOUT_DETECTION = 1 +STACK_FRAME_INJECTION = 1 + +#MYSQL_MILLISECOND_TIMEOUT = 1; + +-include $(wildcard $(PROJECT_ROOT)/local/*.mk) + +# This normally generates debug symbols, but you may also use this in your +# code to output extra debugging information. +#DEBUG = 1 +#DEBUG_MEMORY_LEAK = 1 +#DEBUG_APC_LEAK = 1 +#DEBUG_RACE_CONDITION = 1 + +#USE_JEMALLOC = 1 +USE_TLS = 1 + +ifndef DEBUG_MEMORY_LEAK +ifndef DEBUG_RACE_CONDITION + +# This normally adds -O3 tag to generate the most optimized code targeted for +# production build. +ifndef DEBUG +RELEASE = 1 +endif + +# For hotprofiler instrumentation +#HOTPROFILER = 1 + +ifndef USE_JEMALLOC +# For google profilers +#GOOGLE_CPU_PROFILER = 1 +#GOOGLE_HEAP_PROFILER = 1 + +ifndef NO_TCMALLOC +# Whether to link with tcmalloc.a +GOOGLE_TCMALLOC = 1 +endif + +endif + +# For GNU profiler - gprof. +#PROFILE = 1 + +# For GNU coverage - gcov. +#COVERAGE = 1 + +endif +endif + +############################################################################### +# Directories + +MKDIR = mkdir -p +RMDIR = rm -fR +LIB_DIR = $(PROJECT_ROOT)/bin +EXT_DIR = $(PROJECT_ROOT)/external-$(OS) + +############################################################################### +# Source Files + +ifdef AUTO_SOURCES + +CXX_NOOPT_SOURCES += \ + $(filter-out $(GENERATED_CXX_NOOPT_SOURCES), \ + $(wildcard *.no.cpp) \ + $(wildcard $(patsubst %, %/*.no.cpp, $(SOURCE_SUBDIRS)))) + +CXX_SOURCES += \ + $(filter-out $(GENERATED_CXX_SOURCES) $(CXX_NOOPT_SOURCES), \ + $(wildcard *.cpp) \ + $(wildcard $(patsubst %, %/*.cpp, $(SOURCE_SUBDIRS)))) + +C_SOURCES += \ + $(filter-out $(GENERATED_C_SOURCES) $(GENERATED_CPP_SOURCES), \ + $(wildcard *.c) \ + $(wildcard $(patsubst %, %/*.c, $(SOURCE_SUBDIRS)))) + +endif + +ifdef AUTO_SOURCES_RECURSIVE + +CXX_NOOPT_SOURCES += \ + $(filter-out $(GENERATED_CXX_NOOPT_SOURCES), \ + $(shell echo `find . -name "*.no.cpp"`)) + +CXX_SOURCES += \ + $(filter-out $(GENERATED_CXX_SOURCES) $(CXX_NOOPT_SOURCES), \ + $(shell echo `find . -name "*.cpp"`)) + +C_SOURCES += \ + $(filter-out $(GENERATED_C_SOURCES) $(GENERATED_CPP_SOURCES), \ + $(shell echo `find . -name "*.c"`)) + +endif + +GENERATED_SOURCES = \ + $(GENERATED_CXX_NOOPT_SOURCES) \ + $(GENERATED_CXX_SOURCES) \ + $(GENERATED_C_SOURCES) \ + $(GENERATED_CPP_SOURCES) + +ALL_SOURCES += \ + $(CXX_NOOPT_SOURCES) \ + $(CXX_SOURCES) \ + $(C_SOURCES) \ + $(GENERATED_SOURCES) + +INTERMEDIATE_FILES += $(GENERATED_SOURCES) time_build.out +SOURCES += $(filter-out $(EXCLUDES), $(ALL_SOURCES)) +OBJECTS += $(patsubst %.cpp, %.o, $(SOURCES:.c=.o)) + +STATIC_LIB = $(LIB_DIR)/lib$(PROJECT_NAME).a +SHARED_LIB = $(LIB_DIR)/lib$(PROJECT_NAME).so +APP_TARGET = $(PROJECT_NAME) +MONO_TARGETS = $(filter-out $(APP_TARGET), $(patsubst %.cpp, %, $(wildcard *.cpp))) + +# external shared libraries +EXTERNAL = + +############################################################################### +# Compilation + +# To time compilation time and link time, run "TIME_BUILD=1 make -j1", and it +# will generate time_build.out for analysis. +ifdef TIME_BUILD +TIMECMD = /usr/bin/time -f "%e %C" -o time_build.out --append +NO_DISTCC = 1 +else +TIMECMD = +endif + +ifdef NO_DISTCC +CC = $(TIMECMD) gcc +CXX = $(TIMECMD) g++ +else +CC = $(TIMECMD) distcc gcc +CXX = $(TIMECMD) distcc g++ +endif + +# Both $(CC) and $(CXX) will now generate .d dependency files. +CPPFLAGS += -MMD -fPIC + +# Include frame pointers to make it easier to generate callgraphs in oprofile +CPPFLAGS += -fno-omit-frame-pointer + +ifdef MAC_OS_X + +CPPFLAGS += \ + -I /usr/local/include \ + -I /usr/local/include/boost-1_37 \ + -I /usr/local/mysql/include \ + +CXXFLAGS += \ + -DMAC_OS_X \ + -D_GNU_SOURCE \ + -ftemplate-depth-60 \ + +else + +CPPFLAGS += \ + -isystem $(EXT_DIR)/binutils \ + -isystem $(EXT_DIR)/pcre/include \ + -isystem $(EXT_DIR)/libevent/include \ + -isystem $(EXT_DIR)/libcurl/include \ + -isystem $(EXT_DIR)/libafdt/include \ + -isystem $(EXT_DIR)/gd/include \ + -isystem /usr/local/include \ + -isystem $(EXT_DIR)/boost/include/boost-1_37 \ + -isystem $(EXT_DIR)/mysql/include \ + -isystem $(EXT_DIR)/sqlite/include \ + -isystem /usr/include/libxml2 \ + -isystem $(EXT_DIR)/libfbml/include \ + -isystem $(EXT_DIR)/libmbfl/include \ + -isystem $(EXT_DIR)/oniguruma/include \ + -isystem $(EXT_DIR)/icu/include \ + -isystem $(EXT_DIR)/xhp/include \ + -isystem $(EXT_DIR)/libmcc/include \ + -isystem $(EXT_DIR)/libch/include \ + -isystem $(EXT_DIR)/timelib/include \ + -isystem $(EXT_DIR)/tbb/include \ + -isystem $(EXT_DIR)/libmcrypt/include \ + -isystem $(EXT_DIR)/libfbi/include \ + -I $(PROJECT_ROOT)/src \ + -I $(PROJECT_ROOT)/src/lib/system/gen \ + +ifdef GOOGLE_CPU_PROFILER +GOOGLE_TOOLS = 1 +endif +ifdef GOOGLE_HEAP_PROFILER +GOOGLE_TOOLS = 1 +endif +ifdef GOOGLE_TCMALLOC +GOOGLE_TOOLS = 1 +endif +ifdef GOOGLE_TOOLS +CPPFLAGS += -isystem $(EXT_DIR)/google-perftools/include +endif + +CPPFLAGS += -D_GNU_SOURCE -D_REENTRANT=1 -D_PTHREADS=1 -pthread +CXXFLAGS += -ftemplate-depth-60 + +endif + +ifndef NO_WALL +CXXFLAGS += -Wall -Woverloaded-virtual -Wno-deprecated -Wno-parentheses -Wno-strict-aliasing -Wno-write-strings +endif + +ifndef NO_WERROR +CXXFLAGS += -Werror +endif + +ifndef NO_DEBUG_SYMBOL +DEBUG_SYMBOL = -g +else +DEBUG_SYMBOL = +endif +CPPFLAGS += $(DEBUG_SYMBOL) + +ifdef HPHP_DEV +CPPFLAGS += -DHPHP_DEV +endif + +ifdef DEBUG +CPPFLAGS += -DDEBUG +OPT = +endif + +ifdef DEBUG_MEMORY_LEAK +CPPFLAGS += -DDEBUG_MEMORY_LEAK +OPT = +endif + +ifdef DEBUG_APC_LEAK +CPPFLAGS += -DDEBUG_APC_LEAK +endif + +ifdef DEBUG_RACE_CONDITION +CPPFLAGS += -DDEBUG_RACE_CONDITION +OPT = +endif + +ifdef RELEASE +CPPFLAGS += -DRELEASE +OPT = -O3 +endif + +ifdef INFINITE_LOOP_DETECTION +CPPFLAGS += -DINFINITE_LOOP_DETECTION +endif +ifdef INFINITE_RECURSION_DETECTION +CPPFLAGS += -DINFINITE_RECURSION_DETECTION +endif +ifdef REQUEST_TIMEOUT_DETECTION +CPPFLAGS += -DREQUEST_TIMEOUT_DETECTION +endif +ifdef HOTPROFILER +CPPFLAGS += -DHOTPROFILER +endif +ifdef HOTPROFILER_NO_BUILTIN +CPPFLAGS += -DHOTPROFILER_NO_BUILTIN +endif +ifdef STACK_FRAME_INJECTION +CPPFLAGS += -DSTACK_FRAME_INJECTION +endif + +ifdef GOOGLE_CPU_PROFILER +CPPFLAGS += -DGOOGLE_CPU_PROFILER +endif +ifdef GOOGLE_HEAP_PROFILER +CPPFLAGS += -DGOOGLE_HEAP_PROFILER +endif +ifdef GOOGLE_TCMALLOC +CPPFLAGS += -DGOOGLE_TCMALLOC +endif +ifdef USE_JEMALLOC +CPPFLAGS += -DUSE_JEMALLOC +endif +ifdef PROFILE +CPPFLAGS += -pg +endif + +ifdef COVERAGE +CPPFLAGS += -fprofile-arcs -ftest-coverage +endif + +ifdef HPHP_BUILD_LIBRARY +CPPFLAGS += -DHPHP_BUILD_LIBRARY +endif + +ifdef HPHP_BUILD_FFI +JAVA_PATH = /usr/local/jdk-6u7-64 +CPPFLAGS += -I $(JAVA_PATH)/include -I $(JAVA_PATH)/include/linux +endif + +ifdef USE_TLS +CPPFLAGS += -DUSE_TLS +endif + +############################################################################### +# Linking + +AR = $(TIMECMD) ar -crs +LD = $(TIMECMD) g++ -o + +ifndef NO_GOLD +LD = $(TIMECMD) g++ -B$(EXT_DIR)/binutils/ -o +LDFLAGS += -Xlinker --export-dynamic -Xlinker --no-warn-search-mismatch +else +LDFLAGS += -rdynamic +endif + +# Add library search paths here. +LDFLAGS += \ + -L$(LIB_DIR) \ + -L/usr/local/lib + +ifdef PROFILE +LDFLAGS += -pg +endif + +ifdef COVERAGE +LDFLAGS += -fprofile-arcs +endif + +############################################################################### +# Libraries +# +# 1. Base Libraries +# +# These have to be libraries that nearly ALL programs need to link with. Do +# NOT add something that not everyone wants. + +ifdef MAC_OS_X +LINK_LIBS = -lpthread -lstdc++ -lz -ldl +else +BFD_LIBS = -L$(EXT_DIR)/binutils/ -lbfd -liberty -ldl -lz +LINK_LIBS = -lpthread $(BFD_LIBS) -lrt -lstdc++ -lresolv -lcap +endif + +# 2. Common Libraries +# +# Common but not essential. + +ifeq ($(GCC_VERSION), 4.4.0) +BOOST_LIBS = \ + $(EXT_DIR)/boost/lib/libboost_program_options-gcc44-mt.a \ + $(EXT_DIR)/boost/lib/libboost_filesystem-gcc44-mt.a \ + $(EXT_DIR)/boost/lib/libboost_system-gcc44-mt.a \ + +else +BOOST_LIBS = \ + $(EXT_DIR)/boost/lib/libboost_program_options-gcc40-mt.a \ + $(EXT_DIR)/boost/lib/libboost_filesystem-gcc40-mt.a \ + $(EXT_DIR)/boost/lib/libboost_system-gcc40-mt.a \ + +endif + +ifdef MAC_OS_X + +MYSQL_LIBS = -L/usr/local/mysql/lib -lmysqlclient + +else + +MYSQL_LIBS = $(EXT_DIR)/mysql/lib/mysql/libmysqlclient_r.a \ + -lssl -lcrypto -lcrypt +SQLITE_LIBS = $(EXT_DIR)/sqlite/lib/libsqlite3.a + +PCRE_LIBS = $(EXT_DIR)/pcre/lib/libpcre.a + +HTTP_LIBS = $(EXT_DIR)/libafdt/lib/libafdt.a $(EXT_DIR)/libevent/lib/libevent.a + +MCC_LIBS = $(EXT_DIR)/libmcc/lib/libmcc.a $(EXT_DIR)/libch/lib/libch.a \ + $(EXT_DIR)/libevent/lib/libevent.a + +GD_LIBS = $(EXT_DIR)/gd/lib/libgd.a -lpng -ljpeg -lfreetype -lfontconfig + +MOZILLA_LIBS = $(EXT_DIR)/mozilla/libmozutil_s.a \ + $(EXT_DIR)/mozilla/libexpat_s.a \ + $(EXT_DIR)/mozilla/libsaxp.a \ + $(EXT_DIR)/mozilla/libunicharutil_s.a \ + $(EXT_DIR)/mozilla/libxptcmd.a \ + $(EXT_DIR)/mozilla/libxptcall.a \ + $(EXT_DIR)/mozilla/libxptinfo.a \ + $(EXT_DIR)/mozilla/libxpt.a \ + $(EXT_DIR)/mozilla/libxpcomcomponents_s.a \ + $(EXT_DIR)/mozilla/libxpcomproxy_s.a \ + $(EXT_DIR)/mozilla/libxpcomio_s.a \ + $(EXT_DIR)/mozilla/libxpcomds_s.a \ + $(EXT_DIR)/mozilla/libxpcomglue.a \ + $(EXT_DIR)/mozilla/libxpcombase_s.a \ + $(EXT_DIR)/mozilla/libxpcomthreads_s.a \ + $(EXT_DIR)/mozilla/libstring_s.a \ + $(EXT_DIR)/mozilla/libplc4.a \ + $(EXT_DIR)/mozilla/libplds4.a \ + $(EXT_DIR)/mozilla/libnspr4.a + +CURL_LIBS = $(EXT_DIR)/libcurl/lib/libcurl.a + +LIBXML_LIBS = -lxml2 + +TIME_LIBS = $(EXT_DIR)/timelib/lib/libtimelib.a + +FBML_LIBS = $(EXT_DIR)/libfbml/lib/libfbml.a $(MOZILLA_LIBS) + +MBFL_LIBS = $(EXT_DIR)/libmbfl/lib/libmbfl.a \ + $(EXT_DIR)/oniguruma/lib/libonig.a + +LIB_UNWIND = $(EXT_DIR)/libunwind/lib/libunwind.a + +ifdef GOOGLE_HEAP_PROFILER +GOOGLE_LIBS = $(EXT_DIR)/google-perftools/lib/libprofiler.a \ + $(EXT_DIR)/google-perftools/lib/libtcmalloc.a $(LIB_UNWIND) +else +GOOGLE_LIBS = +ifdef GOOGLE_CPU_PROFILER +GOOGLE_LIBS = $(EXT_DIR)/google-perftools/lib/libprofiler.a $(LIB_UNWIND) +endif +ifdef GOOGLE_TCMALLOC +GOOGLE_LIBS += $(EXT_DIR)/google-perftools/lib/libtcmalloc_minimal.a +endif +endif + +ICU_LIBS = \ + $(EXT_DIR)/icu/lib/libsicui18n.a \ + $(EXT_DIR)/icu/lib/libsicuuc.a \ + $(EXT_DIR)/icu/lib/libsicudata.a \ + +endif + +XHP_LIBS = $(EXT_DIR)/xhp/lib/libxhp.a + +TBB_LIBS = -L$(EXT_DIR)/tbb/lib/ $(EXT_DIR)/tbb/lib/libtbb.a + +MCRYPT_LIBS = $(EXT_DIR)/libmcrypt/lib/libmcrypt.a + +FBI_LIBS = $(EXT_DIR)/libfbi/lib/libfbi.a + +ALL_LIBS = $(CURL_LIBS) $(PCRE_LIBS) $(BOOST_LIBS) \ + $(MYSQL_LIBS) $(SQLITE_LIBS) $(MCC_LIBS) \ + $(GD_LIBS) $(LIBXML_LIBS) $(FBML_LIBS) $(MBFL_LIBS) \ + $(MCRYPT_LIBS) $(GOOGLE_LIBS) $(ICU_LIBS) $(HTTP_LIBS) $(XHP_LIBS) \ + $(TIME_LIBS) $(TBB_LIBS) $(FBI_LIBS) + +############################################################################### +# Dependencies + +# This is to make sure "make" without any target will actually "make all". +overall: all + +# Suppressing no rule errors +%.d:; + +DEPEND_FILES := $(patsubst %.cpp, %.d, $(ALL_SOURCES:.c=.d)) +ifneq ($(DEPEND_FILES),) +-include $(DEPEND_FILES) +endif + +dep_libs = $(filter $(patsubst -L%,, $(patsubst -l%, $(LIB_DIR)/lib%.a, $(1))), $(wildcard $(LIB_DIR)/*)) + +DEP_LIBS += $(call dep_libs, $(LIBS)) + +############################################################################### +# Predefined Targets + +ifdef SHOW_COMPILE +define COMPILE_CXX +$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< +endef +else +define COMPILE_CXX +@echo 'Compiling $<...' +@$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< +endef +endif + +ifdef SHOW_LINK +define LINK_OBJECTS +$(LD) $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS) +endef +else +define LINK_OBJECTS +@echo 'Linking $@...' +@$(LD) $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS) +endef +endif + +%:%.o + +%:%.c + +%:%.cpp + +ifdef SHOW_COMPILE + +$(CXX_NOOPT_SOURCES:%.cpp=%.o) $(GENERATED_CXX_NOOPT_SOURCES:%.cpp=%.o): %.o:%.cpp + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< + +$(CXX_SOURCES:%.cpp=%.o) $(GENERATED_CXX_SOURCES:%.cpp=%.o): %.o:%.cpp + $(CXX) -c $(CPPFLAGS) $(OPT) $(CXXFLAGS) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< + +$(C_SOURCES:%.c=%.o) $(GENERATED_C_SOURCES:%.c=%.o): %.o:%.c + $(CC) -c $(CPPFLAGS) $(OPT) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< + +$(GENERATED_CPP_SOURCES:%.c=%.o): %.o:%.c + $(CXX) -c $(CPPFLAGS) $(OPT) $(CXXFLAGS) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< + +%.o:%.cpp + $(CXX) -c $(CPPFLAGS) $(OPT) $(CXXFLAGS) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< + +else + +$(CXX_NOOPT_SOURCES:%.cpp=%.o) $(GENERATED_CXX_NOOPT_SOURCES:%.cpp=%.o): %.o:%.cpp + @echo 'Compiling $<...' + @$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< + +$(CXX_SOURCES:%.cpp=%.o) $(GENERATED_CXX_SOURCES:%.cpp=%.o): %.o:%.cpp + @echo 'Compiling $<...' + @$(CXX) -c $(CPPFLAGS) $(OPT) $(CXXFLAGS) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< + +$(C_SOURCES:%.c=%.o) $(GENERATED_C_SOURCES:%.c=%.o): %.o:%.c + @echo 'Compiling $<...' + @$(CC) -c $(CPPFLAGS) $(OPT) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< + +$(GENERATED_CPP_SOURCES:%.c=%.o): %.o:%.c + @echo 'Compiling $<...' + @$(CXX) -c $(CPPFLAGS) $(OPT) $(CXXFLAGS) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< + +%.o:%.cpp + @echo 'Compiling $<...' + @$(CXX) -c $(CPPFLAGS) $(OPT) $(CXXFLAGS) -o $@ -MT $@ -MF $(patsubst %.o, %.d, $@) $< + +endif + +.EXPORT_ALL_VARIABLES:; +unexport CXX_NOOPT_SOURCES CXX_SOURCES C_SOURCES GENERATED_CXX_NOOPT_SOURCES GENERATED_CXX_SOURCES GENERATED_C_SOURCES GENERATED_CPP_SOURCES ALL_SOURCES SOURCES OBJECTS DEPEND_FILES CPPFLAGS CXXFLAGS LDFLAGS PROGRAMS LIB_TARGETS DEP_LIBS + +# Since these variables start with += in this file, when calling submake, +# they will not start with empty list. SUB_XXX will always start with empty. +SUB_SOURCE_SUBDIRS = $(SOURCE_SUBDIRS) +SUB_PROGRAMS = $(PROGRAMS) +SUB_LIB_TARGETS = $(LIB_TARGETS) +SUB_OBJECTS = $(OBJECTS) +SUB_INTERMEDIATE_FILES = $(INTERMEDIATE_FILES) + +# This trick allows Makefiles in recursive directories each defines its own +# SUB_CLEAN_DIRS without passing into child directories + +.DEFAULT: + @$(MAKE) --no-print-directory -f $(PROJECT_ROOT)/src/default.mk $@ + +$(OBJECTS): $(GENERATED_SOURCES) + +ifdef SHOW_LINK + +$(SHARED_LIB): $(OBJECTS) + $(CXX) -shared -fPIC $(DEBUG_SYMBOL) -Wall -Werror -Wl,-soname,lib$(PROJECT_NAME).so -o $@ $(OBJECTS) $(EXTERNAL) + +$(STATIC_LIB): $(OBJECTS) + $(AR) $@ $(OBJECTS) + +$(MONO_TARGETS): %:%.o $(DEP_LIBS) + $(LD) $@ $(LDFLAGS) $< $(LIBS) + +else + +$(SHARED_LIB): $(OBJECTS) + @echo 'Linking $@...' + @$(CXX) -shared -fPIC $(DEBUG_SYMBOL) -Wall -Werror -Wl,-soname,lib$(PROJECT_NAME).so -o $@ $(OBJECTS) $(EXTERNAL) + +$(STATIC_LIB): $(OBJECTS) + @echo 'Linking $@...' + @$(AR) $@ $(OBJECTS) + +$(MONO_TARGETS): %:%.o $(DEP_LIBS) + @echo 'Linking $@...' + @$(LD) $@ $(LDFLAGS) $< $(LIBS) + +endif + +$(APP_TARGET): $(OBJECTS) $(DEP_LIBS) + $(LINK_OBJECTS) $(LINK_LIBS) + +.PHONY: $(LIB_TARGETS) +$(LIB_TARGETS): $(CODEGEN_TARGETS) + @$(MAKE) --no-print-directory -C $@ + +.PHONY: $(PROGRAMS) +$(PROGRAMS): $(LIB_TARGETS) + @$(MAKE) --no-print-directory -C $@ + +.PHONY: report +report: + @echo "Time PID Source File" + @echo "---------------------------------------------" + @ps wwaxo pid,etime,command k start | grep distcc | grep -v grep | \ + sed 's/^\( *[0-9]\+\) \+\([0-9:]\+\) .* \([^ ]\+\)$$/\2 \1 \3/' | \ + head -`tput lines` + +.PHONY: top +top: + @watch $(MAKE) -s report diff --git a/src/schema.sql b/src/schema.sql new file mode 100644 index 0000000000000..6a311fe4a044e --- /dev/null +++ b/src/schema.sql @@ -0,0 +1,53 @@ +CREATE TABLE `hphp_run` ( + `id` int(11) NOT NULL auto_increment, + `branch` varchar(255) NOT NULL default '', + `revision` int(11) NOT NULL default '0', + `file` int(11) NOT NULL default '0', + `line` int(11) NOT NULL default '0', + `byte` int(11) NOT NULL default '0', + `program` int(11) NOT NULL default '0', + `function` int(11) NOT NULL default '0', + `class` int(11) NOT NULL default '0', + `types` text NOT NULL, + `time` int(11) NOT NULL default '0', + `created` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `committed` tinyint(4) NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `hphp_dep` ( + `id` int(11) NOT NULL auto_increment, + `run` int(11) NOT NULL default '0', + `program` varchar(255) NOT NULL default '', + `kind` varchar(255) NOT NULL default '', + `parent` varchar(255) NOT NULL default '', + `parent_file` varchar(255) NOT NULL default '', + `parent_line` int(11) NOT NULL default '0', + `child` varchar(255) NOT NULL default '', + `child_file` varchar(255) NOT NULL default '', + `child_line` int(11) NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `program` (`run`,`program`), + KEY `parent` (`run`,`kind`,`parent`,`child`), + KEY `child` (`run`,`kind`,`child`,`parent`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `hphp_err` ( + `id` int(11) NOT NULL auto_increment, + `run` int(11) NOT NULL default '0', + `program` varchar(255) NOT NULL default '', + `kind` varchar(255) NOT NULL default '', + `construct` bigint(20) NOT NULL default '0', + `file1` varchar(255) NOT NULL default '', + `line1` int(11) NOT NULL default '0', + `file2` varchar(255) NOT NULL default '', + `line2` int(11) NOT NULL default '0', + `expected_type` int(11) NOT NULL default '0', + `actual_type` int(11) NOT NULL default '0', + `data` varchar(255) NOT NULL default '', + `suppressed` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `program` (`run`,`program`), + KEY `kind` (`run`,`kind`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + diff --git a/src/test/Makefile b/src/test/Makefile new file mode 100644 index 0000000000000..e22db98cf34d4 --- /dev/null +++ b/src/test/Makefile @@ -0,0 +1,44 @@ + +PROJECT_ROOT = ../.. +PROJECT_NAME = test + +INTERMEDIATE_FILES = $(wildcard *.tmp) +AUTO_SOURCES = 1 + +LIBS = \ + $(LIB_DIR)/libhphp_analysis.a \ + $(LIB_DIR)/libhphp_runtime.a \ + $(ALL_LIBS) + +include $(PROJECT_ROOT)/src/rules.mk +TARGETS = $(APP_TARGET) + +TEST_SUITE_INC := test_base_suite.inc +TEST_FAST_INC := test_base_fast.inc +TEST_MYSQL_INFO_INC := dummy_mysql_info.inc + +HOOK_RULE_FILE = $(wildcard hook.mk) +ifneq ($(strip $(HOOK_RULE_FILE)),) + include hook.mk +endif + +$(PROJECT_ROOT)/src/test/test_suite.inc:: $(TEST_SUITE_INC) + @cat $^ > $@ + +$(PROJECT_ROOT)/src/test/test_fast.inc: $(TEST_FAST_INC) + @cat $^ > $@ + +$(PROJECT_ROOT)/src/test/test_mysql_info.inc: $(TEST_MYSQL_INFO_INC) + @cat $^ > $@ + +test.o: $(PROJECT_ROOT)/src/test/test_suite.inc \ + $(PROJECT_ROOT)/src/test/test_fast.inc +test_cpp_base.o: $(PROJECT_ROOT)/src/test/test_mysql_info.inc +test_ext_mysql.o: $(PROJECT_ROOT)/src/test/test_mysql_info.inc +all: $(TARGETS) + +clobber:: + @rm -f test_suite.inc test_fast.inc test_mysql_info.inc + @$(MAKE) --no-print-directory -f $(PROJECT_ROOT)/src/default.mk $@ + @rm -fR test_hphp/*/output + @rm -f test_hphp/*~ test_hphp/*/*~ test_hphp/*/*/*~ diff --git a/src/test/config-server.hdf b/src/test/config-server.hdf new file mode 100644 index 0000000000000..3aa78a3a8c40c --- /dev/null +++ b/src/test/config-server.hdf @@ -0,0 +1,18 @@ + +Log { + AlwaysLogUnhandledExceptions = false +} + +Server { + Port = 8080 + SourceRoot = /unittest/rootdoc + + AllowedFiles { + 0 = string + } +} + +VirtualHost { + default { + } +} diff --git a/src/test/config.hdf b/src/test/config.hdf new file mode 100644 index 0000000000000..195cce205595b --- /dev/null +++ b/src/test/config.hdf @@ -0,0 +1,17 @@ + +Log { + AlwaysLogUnhandledExceptions = false +} + +Server { + Port = 8080 + + AllowedFiles { + 0 = string + } +} + +VirtualHost { + default { + } +} diff --git a/src/test/dummy_mysql_info.inc b/src/test/dummy_mysql_info.inc new file mode 100644 index 0000000000000..ce048b59e83f1 --- /dev/null +++ b/src/test/dummy_mysql_info.inc @@ -0,0 +1,5 @@ +// Fill the following macros with username/password/hostname/dbname +#define TEST_USERNAME "" +#define TEST_PASSWORD "" +#define TEST_HOSTNAME "" +#define TEST_DATABASE "" diff --git a/src/test/hook.mk b/src/test/hook.mk new file mode 100644 index 0000000000000..ea80d9e699f68 --- /dev/null +++ b/src/test/hook.mk @@ -0,0 +1,50 @@ +CXX_SOURCES += fb_lib_hooks.cpp test_fbcode_error.cpp test_fbdepend_graph.cpp + +EXTRA_TEST_SUITE_INC := \ + $(wildcard ../../facebook/src/test/test_extra_suite.inc) +ifneq ($(strip $(EXTRA_TEST_SUITE_INC)),) + TEST_SUITE_INC += $(EXTRA_TEST_SUITE_INC) +endif +EXTRA_TEST_FAST_INC := \ + $(wildcard ../../facebook/src/test/test_extra_fast.inc) +ifneq ($(strip $(EXTRA_TEST_FAST_INC)),) + TEST_FAST_INC += $(EXTRA_TEST_FAST_INC) +endif +REAL_MYSQL_INFO_INC := \ + $(wildcard ../../facebook/src/test/real_mysql_info.inc) +ifneq ($(strip $(REAL_MYSQL_INFO_INC)),) + TEST_MYSQL_INFO_INC := $(REAL_MYSQL_INFO_INC) +endif + +test_fbcode_error.cpp: \ + ../../facebook/src/test/test_fbcode_error.cpp \ + test_fbcode_error.h + @cp $< $@ + +test_fbcode_error.h: ../../facebook/src/test/test_fbcode_error.h + @cp $< $@ + +test_fbdepend_graph.cpp: \ + ../../facebook/src/test/test_fbdepend_graph.cpp \ + test_fbdepend_graph.h + @cp $< $@ + +test_fbdepend_graph.h: ../../facebook/src/test/test_fbdepend_graph.h + @cp $< $@ + +fb_lib_hooks.cpp: \ + ../../facebook/src/lib/fb_lib_hooks.cpp \ + fb_lib_hooks.h + @cp $< $@ + +fb_lib_hooks.h: \ + ../../facebook/src/lib/fb_lib_hooks.h + @cp $< $@ + +test.o: fb_lib_hooks.h test_fbcode_error.h test_fbdepend_graph.h +test: fb_lib_hooks.o test_fbcode_error.o test_fbdepend_graph.o +clobber:: + @rm -f test_fbcode_error.cpp test_fbcode_error.h \ + test_fbdepend_graph.cpp test_fbdepend_graph.h \ + test_extra_suite.inc test_extra_fast.inc \ + fb_lib_hooks.cpp fb_lib_hooks.h diff --git a/src/test/images/246x247.png b/src/test/images/246x247.png new file mode 100644 index 0000000000000000000000000000000000000000..648a64e0aa83d8ec0f95879b6df8083c96d0ebfe GIT binary patch literal 360 zcmeAS@N?(olHy`uVBq!ia0vp^-+=f#3p0?sldvTYNNJb2MwB=gr6!hS=I1GdWag$a z_~t7ZS}6GCmnj$-7#JxSnp+u~SQ%L=Xd4(B7+6d6@B+25mw5WRvR~pB5>OBqnY?=n zP>8d@BeIx*f$IYZGdis?nE@1JNq6*hWMJ6X&;2Kn705RT@Ck7R(*OVe2a-gB=%wvb zfl6CET^vIyZoNHg$jHFJ!=#{nWB(e(vNw%POX?q$?Y^70{q|cLQ{N9VJaBpVymRjo QNs!Y$UHx3vIVCg!09*ZrcmMzZ literal 0 HcmV?d00001 diff --git a/src/test/images/php.gif b/src/test/images/php.gif new file mode 100644 index 0000000000000000000000000000000000000000..f352c7308fee4c5cb1ab4f2e3dd73d6af6cfc6f6 GIT binary patch literal 2523 zcmV<12_*JMNk%w1VR!&T0Oo1{e}cFx)#tLb)I&m8gNC_+gR@dn za*&e3!o=RHtk6tLV_RH<-QMgwI6Q7~rD|=RVPlPTd9izbwdLmUnViOqjlsFP*=uW( zPEKoabg6oJqlk;Wa&)6~bC`~h!CG5>;^XgoeXXRW&~0#{a(1khmdLxk*>rfWg^0V7 zmBZNC>XMSgWM-0UZl9&7&XktLE-NonQE0QY*KBHxTw8XEjlX7SmS}34oS(=sE;+8S z)0~{mRaSVOp~{w-#essaXK9x|Jy5*9+FoFZn3>3oj=zbDx>s0ywzt>S*XSZ1AZ%}* z&d}t)z}$Cxw03x>UtWEgnapl)m~(foA|4f7}-0Pa0$!27PXlIG1sM2n5po@#S#>e2t$>C{ioR^r(A^8LW003$LEC2ui z0C)gH000O7fNFw+goTEOh>41ejE#^DWJlk4H^u6O$AU;1ATl9QBf*#tgm#jvqCd1x*rGt z78Vs(C?ysN8NtKrj3#k>E^KTN5Opre1Jp9JA|L)N01*fTK(OF9g5jjBK=DSx2|qiY zOc|1dokcZ4Yz$yS;(|vKB=R*7vOtQ-lPFWFTzPU_2MH5)=zu}t2n8!cL|nuagb5Um z9xu2sLZ=1GqezpYyz(Xnj3Y-Lj97BSgU+3herR+7fg=PX1Xw5?OE&416FMF&0ir;` zh$%Dwur4y8p+FNCbqW|rQns&Oq#a-^QNV$N13U@j8p;!80F(j)eB}7Mash_Rm@#~y zob(L^1rFA%QQ$$bnmk7M^clcp2IrL@vT&JAn@gA1O5H43bKro35IfyPVZfjP0^BPx zaKXa7xtZI@lXlo$q{y1m!+!XXV?+fH3(;4qAk)0Lm;&LIUU_gJKmZPKK$$SWL=FJ} z=~osIQ=T~)75ORkh63*Oa0e!H(BXptG8`A6N?n-I9~N8?@SsvLtkFXc2kcSF4>B~+ zKuH&-1V9!OVv)sWB_{Pi02=})NgD+0<6w&?DL0`RU*M>eA4SkW0~L|j5d;A5XOXJT+k$mEHUZimiUc@f&(-NP{SigU=Re9M}6=`7HqcZ=9^h`Q9uJ- zqErAF6OsXEn->gV;YkbZDJYv=4A6j5KnNg!1C7ie1O{R$MZj_?R%!+qTzml_N?mMG zX^J##p+y;8kZ8b^pH8?17+!R7C{iN`-~^+JY$L>tNsX84r(1XdL6;})`Y9M=U?9Z+ zcnYg(83QCWf)h^QkVpz5w18$(5b&pLieW%t5(Zvun<5&wUEry><1>shV zg&5Es)q$*I5|RP}AJjS4q&vbn#u?g9=mi0tPRPZZV{m~+idtlWYQ%7samKk5mVqTp z3P76%A>QCRmahGY;VnuFG|&Zk6KcT#!2PX=5(W)?5kb{iXi+u0fEw^cvi*f&fKoKf zI>;XYAfRMf+2*;aiCKKzbQT$x$Ky&60Nq^9f-`r<+A4i82F`aMwFI;Zt095~CX;2a z%mt?uxT-o+`E*J#_jg7XGz4wzN}-phMdK`W0PPKeu#iw+4^KG8wI^-f9~xPp-Q0gF z1sil36Vi~yQK=8kI!i^ktwuO=lZA4B5%kE?<^2(kxk}&`pT!xfUT_ru*5v`O6bDZ9 zAV>w2F;eBpv8OiA}9^u6$L4+3JGQ1vQz6f3G>AzEBo6q!RV75GsF5a_}f zv@k}|4WNF^@gPd_$1|~IuM2+!WEaZdNSRS_CFoP%^Ez;azU)W;RayvTD8+EE6p7&r z1bCndy=bQiVxfW;6qP8oK+0i>uPn`@)d$|tfxbjYV`%uo0#1cP7n;Oe6Ov&e19r-x zN#}KfNPz_2@I$32v0u$RmMg8c5=3Hwi5dfgF#Ga2Cq(Xf66obv*4Qr^oMD_&KxTiq z@T#q;k~wV*SOm^+0cWz!d4hPs2_(=-r7%)lW+1~D22iINcF>>1)F1!wWd<2CfR0Hi zniGyjh#{Qd4P&90{$@E#GH_uGg+f!HNE%93oCC(xfP5z!0SaGDD=` z1Se1@Qeeo13($ie1^6QY{Am(E9`&f11JnSXN{>S>lQ~}hFzQj0>PG_XbSwu;*ddY- zgAcA+~ov#86p8?EogG?xk9$GqyY_#SjX~HPH8Ek1bJo2 zLHTG*ze<4tm23_e&=a6?(rOWiHLC=x#sJ5vM0ZlWBxN*uSw@s#0x{@79;HCkdV1C* zd2`w6qSJu`K&!NkNC0XjpvAOeVGL{a(E=97M!EWh2t9z7VI!f0Crm)IQuyB%rb}Jk zz1E)8r7jo-`x*tvN&qsN#0x;+hZyh{00p2bJrH+YDWF%q5O6JJh;T3`M1Z4~NPrtq z`-auF*RLnAt#U!}f+_d`wW|HEUs1pTSvjEy_yvXk67=AP1NT?KB|5EO^2qFn3Ai@q{JOLWl zI4Kh#P!EJ8CcFB05GhE29&|tiA-f@{{>AVcj)3D0Ex8DIc)^nw@d7F9;LK;lm>eXekz-@s{3OW@O=1}adAaA~%PrZ)$uP7wld032)}F^?8T3O-N*5Lf{! zPcX$xTrW0=sKx;I5o02OXHFa$BjS}`e50s=hXfemaRExrbJu-igx l!*GBKBN%}dtWbhxKl|K^5J4Ica20gB``z%4cf11u06W9wSquOG literal 0 HcmV?d00001 diff --git a/src/test/images/simpletext.jpg b/src/test/images/simpletext.jpg new file mode 100644 index 0000000000000000000000000000000000000000..19122dd996b17fc7f4f72bce4e665b376e3ebd50 GIT binary patch literal 1298 zcmex=_1P|rX?qqI0P zFI~aY%U!`Mz|~!$%*;qrMU_b4?usLlYAdd38%$3nLpnV-q8g zA&i`yoIKn-61=<;Mv5|uMkIs(2N(o77(^HHEAm;@P_1sVSzVUP#6M4GWKmj7kOu zR(eKeR&hybS$RceRdY*gTYE=m*QCi)rcRqaW9F z9X@jO*zpr5PhGlvWX5a=%^78Yg}c96dqnaY8fS&)TQ(U48ZF_1m6P*};Rkwe63;=+vwIhBorK8Pk2 zUE~r|F?p!^5#%+n&xrF_6Inikdko>PTMRtRjKIia7G$tz_+XJR>EWqk?93{gSsAJ) zANbGk`ch?3`exqhaP`mC}Ce$oOV6VVE=i(rx7+g{v}UMXmmU;Q&5%A`}Vwv zw3bDs{iEo(voG&2oHD^vCFoRxXb01O1_KtR!pke4^v&BU8zX+|*vDlZoA0Py2>jOi zL}pHtzn1lr&yy$5DqFmQ`#*z9N6liXw+9qfe2X(;D{k;SR$%BjXQBI~S5e=#{o23V z+irDtktfv3T3nw^SLqQ|==t({=hu_!whX!Jmgzobe3YJ8G@UuS z)ggRCOyQh)^X^R%fAitbx8Tc{-~If@Rx7$Tea%mCP3z@nCO&v0VI***ae^Bghs2Wv kK0Y?14C9p?Zkor!_fNZj{e?)NE1ROLNB|=q%>Mr-0LW$tjQ{`u literal 0 HcmV?d00001 diff --git a/src/test/images/smile.happy.png b/src/test/images/smile.happy.png new file mode 100644 index 0000000000000000000000000000000000000000..1e5c0522f93a1177b41e6275170748919c6afbd4 GIT binary patch literal 150 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9oB=)|uK)l42Qq;~@Y{q#Ko(<3 zkY6x^!?PP{K#sMii(^Q|oa6)s=8FOf6Sq!kY%IL0#m=@ZbhVm+hwtodEM9A(Sd}-0 sF?B|so@TH?w|5ppAkQ^6Lk13pu-T%Sr{uJxfW|O*y85}Sb4q9e0Oyt~?*IS* literal 0 HcmV?d00001 diff --git a/src/test/images/test1pix.jpg b/src/test/images/test1pix.jpg new file mode 100644 index 0000000000000000000000000000000000000000..121decb65ad30078dc0a09bd23c62fb49d8a44ea GIT binary patch literal 523 zcmex=?U?LR#UJO6b*$~fG#Lh5@t1O zoG1cv!NH)5ABQ +#include +#include +#include + +using namespace HPHP; +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + + +int main(int argc, char **argv) { + string suite, which, set; + void (*lib_hook_initialize)(); + lib_hook_initialize = + (void (*)())dlsym(NULL, "lib_hook_initialize"); + if (lib_hook_initialize) lib_hook_initialize(); + if (argc >= 2) suite = argv[1]; + if (argc >= 3) which = argv[2]; + if (argc >= 4) set = argv[3]; + if (argc >= 5) { + if (strcmp(argv[4], "quiet") == 0) { + Test::s_quiet = true; + } else { + Logger::LogLevel = (Logger::LogLevelType)atoi(argv[4]); + } + } + hphp_process_init(); + Test test; + test.RunTests(suite, which, set); + return 0; +} diff --git a/src/test/perf_ad_hoc.php b/src/test/perf_ad_hoc.php new file mode 100644 index 0000000000000..9ccbc17853205 --- /dev/null +++ b/src/test/perf_ad_hoc.php @@ -0,0 +1,618 @@ + DBTYPE_COLLEGE, + 'TEST' => DBTYPE_TEST, + 'GENERAL' => DBTYPE_GENERAL, + 'HS' => DBTYPE_HS, + 'PLATFORM' => DBTYPE_PLATFORM, + 'ADMARKET' => DBTYPE_ADMARKET, + 'ANALYTICS' => DBTYPE_ANALYTICS, + 'PLANALYTICS' => DBTYPE_PLANALYTICS, + ); + + // 100K users per database + $block_u = 100000; + + /** + * Database layout configuration. This defines for each database type + * the starting database id index, the number of logical databases in the + * pool, and the block size of each database (which is the number of objects + * allocated to that database). + */ + $DBTYPE_CONFIG_ = + array(DBTYPE_COLLEGE => + array('min_dbid' => 1, + 'max_dbid' => 4990, + 'count' => 4990, + 'block_u' => $block_u, + 'min_uid' => 1, + 'max_uid' => 4990 * $block_u - 1, + 'block_o' => 100000000), + + DBTYPE_TEST => + array('min_dbid' => 4991, + 'max_dbid' => 4999, + 'count' => 9, + 'block_u' => $block_u, + 'min_uid' => 4990 * $block_u, // NOTE: offset college_max + 'max_uid' => 4999 * $block_u - 1, + 'block_o' => 100000000), + + DBTYPE_GENERAL => + array('min_dbid' => 5000, + 'max_dbid' => 9999, + 'count' => 5000, + 'block_u' => $block_u, + 'min_uid' => 5000 * $block_u, // NOTE: offset general_min + 'max_uid' => 9999 * $block_u - 1, + 'block_o' => 100000000), + + DBTYPE_HS => + array('min_dbid' => 10000, + 'max_dbid' => 33004, // count reserves up to 50000 + 'count' => 40001, // moskov messup, 2005 =) + 'block_u' => 30000, + 'min_uid' => 9999 * $block_u, // NOTE: offset general_max + 'block_o' => 100000000), + + DBTYPE_PLATFORM => + array('min_dbid' => 50001, + 'max_dbid' => 51000, + 'count' => 1000, + 'block_o' => 1000000000), + + DBTYPE_ADMARKET => + array('min_dbid' => 51001, + 'max_dbid' => 51200, + 'count' => 200, + 'block_o' => 5000000000), + + DBTYPE_ANALYTICS => + array('min_dbid' => 52001, + 'max_dbid' => 52200, + 'count' => 200, + 'block_o' => 5000000000), + + DBTYPE_PLANALYTICS => + array('min_dbid' => 52201, + 'max_dbid' => 52400, + 'count' => 200, + 'block_o' => 100000000), + ); + + $GLOBALS['DBTYPE_USER_ORDER'] = + array(DBTYPE_COLLEGE, + DBTYPE_TEST, + DBTYPE_GENERAL, + DBTYPE_HS); + + $GLOBALS['DBTYPE_OBJECT_ORDER'] = + array(DBTYPE_GENERAL, + DBTYPE_COLLEGE, + DBTYPE_TEST, + DBTYPE_HS, + DBTYPE_PLATFORM, + DBTYPE_ADMARKET, + DBTYPE_ANALYTICS); + + // Compute object space once + $GLOBALS['first_object'] = 2200000000; + + // Offset general block object ids by the database count. I (mcslee) am + // not sure why we do this, but it may be another moskov-hack circa 2005. + $min_oid = + $GLOBALS['first_object'] + + $DBTYPE_CONFIG_[DBTYPE_GENERAL]['count']; + foreach ($GLOBALS['DBTYPE_OBJECT_ORDER'] as $dbtype) { + $config = &$DBTYPE_CONFIG_[$dbtype]; + $config['min_oid'] = $min_oid; + $config['max_oid'] = $min_oid + ($config['count'] * $config['block_o']); + + // Next range starts at the end of this range, plus one! Guess what? The + // plus one was another little unreversible error from back in the day. + // It should have been that max_oid had a -1 in it, but this stuff is + // no longer reversible now that the ids are all allocated. + $min_oid = $config['max_oid'] + 1; + } + + // Put the config into globals + $GLOBALS['DBTYPE_CONFIG'] = $DBTYPE_CONFIG_; + + // Miscellaneous legacy stuff + + // this was basically choosen as just some nice number > 33004 + // (the network_id of the last old-style launched hs) + // the first new-style launched colleges and high schools have this network_id + $GLOBALS['gemu_school_min_network_id'] = 50000; + + // corp networks are folded within the general dbs + $GLOBALS['min_corp_id'] = 100000; + $GLOBALS['max_corp_id'] = 500000; +} + + +/** + * Checks if given id is in the fbid range (so not a user id) + * + * @param int $oid object id + * @return bool Is this id in the object space + */ +function is_fbobj($oid) { + global $first_object; + return ($oid >= $first_object); +} + +/** + * Tells if some id looks like a Facebook user id + * Needs to conform to is_fbobj, but don't do the function call for performance reasons. + * + * @param int $id + * @return bool true if the id is in the user id range, which 0 is not + * + * @author ccheever + */ +function is_user_id($id) { + global $first_object; + return ($id > 0 && $id < $first_object); +} + +/** + * Determines offset information for a given dbid. This provides the caller + * with information about the starting object id for this dbtype range, + * the number of dbs in this dbtype range, and the offset of this db into + * its range. + * + * @param int $dbid + * @return array keys start, num_dbs, db_offset + */ +function fbid_calculate_offset_info($dbid) { + global $DBTYPE_CONFIG; + foreach ($DBTYPE_CONFIG as $config) { + if (($dbid >= $config['min_dbid']) && + ($dbid < $config['min_dbid'] + $config['count'])) { + return array('start' => $config['min_oid'], + 'num_dbs' => $config['count'], + 'db_offset' => $dbid - $config['min_dbid']); + } + } + debug_rlog('FBID: no offset into for dbid: '.$dbid); +} + +/** + * Converts a person or object id to the id of the db containing information + * about the person or object. The object case (any id over 2.2B) simply + * hashes the id into one of the available general buckets. The person case + * is a piece-wise function. Currently, the first 4990 dbs are reserved for + * college users and ids are seperated into 100000 space buckets. DBs 4491-4999 + * are reserved for test purposes. The next + * 5000 dbs (5000 - 9999) represent the general buckets, and are divided + * similar to the college ones in 100K chunks. HS dbs are similar, except + * they start at db 10000 and user id 10K*100K, and the buckets are only + * 30000 ids long. + *

    + * example:
    + * id_to_db(6) = 1
    + * id_to_db(1000001003) = 10003
    + * id_to_db(500001003) = 6003
    + * id_to_db(2250001003) = 6003 (object) + * + * @param int $id the id to be converted + * @param bool $log_errors Should we generate error messages on failure. + * @return int the id of the db housing information about this id + */ +function id_to_db($id, $log_errors=true) { + if (!is_numeric($id)) { + if ($log_errors) { + debug_rlog("invalid call to ID_TO_DB $id"); + } + return null; + } + + if ($id == 0x7fffffff) { + if ($log_errors) { + debug_rlog( + "0x7fffffff is an invalid object id! ". + "Did you put a 64-bit object id into a 32-bit mysql column? ". + "Please investigate."); + } + return null; + } + if ($id == 0x7fffffffffffffff) { + if ($log_errors) { + debug_rlog( + "0x7fffffffffffffff is an invalid object id! ". + "Is some clown app overflowing a BIGINT column, or are we?"); + } + return null; + } + + global $DBTYPE_CONFIG; + if ($id < $GLOBALS['first_object']) { + // User id case, this is special-cased like whoa. If you take issue with + // this, take it up with moskov. Don't try to clean it up, because these + // ids are already allocated and you'll destroy everything. + if ($id <= $DBTYPE_CONFIG[DBTYPE_COLLEGE]['max_uid']) { + return (int)($id / $DBTYPE_CONFIG[DBTYPE_COLLEGE]['block_u']) + 1; + } else if ($id <= $DBTYPE_CONFIG[DBTYPE_TEST]['max_uid']) { + return (int)($id / $DBTYPE_CONFIG[DBTYPE_TEST]['block_u']) + 1; + } else if ($id < $DBTYPE_CONFIG[DBTYPE_GENERAL]['max_uid']) { + // GEMU is different. < instead of <=, I don't know why. Also, ids + // here are hashed across the DB space. + return + $DBTYPE_CONFIG[DBTYPE_GENERAL]['min_dbid'] + + (int)($id % $DBTYPE_CONFIG[DBTYPE_GENERAL]['count']); + } else { + $min_dbid = $DBTYPE_CONFIG[DBTYPE_HS]['min_dbid']; + $base = ($min_dbid - 1) * $DBTYPE_CONFIG[DBTYPE_COLLEGE]['block_u']; + $offset = (int)(($id - $base) / $DBTYPE_CONFIG[DBTYPE_HS]['block_u']); + return $min_dbid + $offset; + } + } else { + // Object id case, this one is nice and general-ish + foreach ($GLOBALS['DBTYPE_OBJECT_ORDER'] as $dbtype) { + $config = $DBTYPE_CONFIG[$dbtype]; + if (($id >= $config['min_oid']) && ($id <= $config['max_oid'])) { + $offset = $id - $config['min_oid']; + return $config['min_dbid'] + ($offset % $config['count']); + } + } + if ($log_errors) { + debug_rlog('FBID: Cannot determine db_id for '.$id); + } + } + + return null; +} + +/** + * Equivalent to calling id_to_db with $log_errors=false, but more readable. + * + * @param int $id the id to be converted + * @return int the id of the db housing information about this id (or null). + */ +function untrusted_id_to_db($id) { + return id_to_db($id, false); +} + +/** + * Maps the xid to a db by converting the xid into an + * int and then using id_to_db + * + * @param int $xid Xid to get db for + * @param int $db_type db type to use for hashing the xid. + * Defaults to DBTYPE_GENERAL + * @return int db_id with in the specified db type + */ +function xid_to_db($xid, $db_type=DBTYPE_GENERAL) { + if (!isset($GLOBALS['DBTYPE_CONFIG'][$db_type])) { + return NULL; + } + + // crc32 is weird in the sense that it will return a signed int in + // some situations and a non negative one in other. to get around + // this whole issue, we'll grab the positive part of the int + $id = (crc32($xid) & 0x7fffffff); + + // Hash the id to a range within the specified db type + return + $GLOBALS['DBTYPE_CONFIG'][$db_type]['min_dbid'] + + ($id % $GLOBALS['DBTYPE_CONFIG'][$db_type]['count']); +} + + +/** + * Converts a single array of fbid into a nested array keyed on dbid. + * + * @param array + * @return array + */ +function ids_to_dbmap($ids) { + $map = array(); + foreach ($ids as $id) { + $map[id_to_db($id)][] = $id; + } + return $map; +} + +/** + * Returns a random dbid from the specified dbtype pool, or pools + * + * @param mixed $db_type could either be on specific type as in most use cases, or multiple parameters each denoting a type + * @return int + * @author mcslee + */ +function get_rand_db($db_type) { + if (func_num_args() > 1) { + $args = func_get_args(); + $sizes = array(); + $total = 0; + foreach ($args as $index => $db_pool_type) { + if (!isset($GLOBALS['DBTYPE_CONFIG'][$db_pool_type])) { + debug_rlog('FBID: invalid dbtype to get_rand_db: '.$db_pool_type); + return null; + } + $total += $GLOBALS['DBTYPE_CONFIG'][$db_pool_type]['count']; + $sizes[$db_pool_type] = $total; + } + $index = mt_rand(1, $total); + foreach ($sizes as $pool => $size) { + if ($index <= $size) { + $db_type = $pool; + break; + } + } + } + if (!isset($GLOBALS['DBTYPE_CONFIG'][$db_type])) { + debug_rlog('FBID: invalid dbtype to get_rand_db: '.$db_type); + return null; + } + $config = $GLOBALS['DBTYPE_CONFIG'][$db_type]; + $min = $config['min_dbid']; + $max = $config['max_dbid']; + for ($i = 0; $i < 10; ++$i) { + $dbid = mt_rand($min, $max); + if (!check_down($dbid)) { + break; // exit the loop if this connection is good + } + } + // On QA DB, only use 1 out of 100 object DBs + if (is_qa_server()) { + $dbid = 100 * (int)($dbid/100); + } + return $dbid; +} + + +/** + * Returns db_type given a db id + * + * @param int $db_id Database ID + * @return int DB Type + * @author peter + */ +function dbid_to_dbtype($db_id) { + global $DBTYPE_CONFIG; + + foreach ($DBTYPE_CONFIG as $db_type => $db_config) { + if ($db_id >= $db_config['min_dbid'] && + $db_id <= $db_config['max_dbid']) { + return $db_type; + } + } + return null; +} + +fbid_init(); + +PERF_START + +// 200 id_to_db() calls +for ($i = 0; $i < 10; $i++) { + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); + id_to_db(503938184); +} + +PERF_END diff --git a/src/test/tahoma.ttf b/src/test/tahoma.ttf new file mode 100755 index 0000000000000000000000000000000000000000..f5a011e9a5163fdbcb54ef2f720e0f4cb5012a30 GIT binary patch literal 383140 zcmb@v37~98RqtJWdfwf8?D_PW@4(Fs2@o(S5E%s?4+Rnk0b?W(W`bb~gAXDI8Wa&l zi6Z)eVgQvWp9&gzfFI}+jm%>d85G0;M8FV9a{K%JSMBQV)At0(BUPuW_E6(mtJYez zs&*e&an22hYVN`JIp=@e@0Y&uYwvaS|NUa;raSk$&kx-9dmnU{4|Cro*QNJ6=VAAH z(m4-#sH?yA@11L${=kQxbN@&D#*2U4x!voXYhL%Db8dIWJ0JO~$2eE{1o_WB_dY*( z-ld;>{<+Sb@)hUmpLxv17hY2T+D%heIeL+E$=+iwedf+{9{a)@UF9D4aBl4jkGtgY z7vE*=QP;c5oi3;TyFLEGXI$b&u1$N_P+#`=r#$y@ceworAL1&H{<^Dv>93z~(Z$bc zJlFlAbGQ3|bJzXS6CQivMIZRk6%p;9PyREXz=QZpoiA|zOWYrR!o|;g&YfR$`G3&X z?Va2Ht0zD9=}&$0dw##;>JNUGbLl@k<;Na#VbOZgMXqx1W4yoS;tQX1N#{+?ODO** zl;3&kg%>|IJ%8)>T>Vk6buNDWB|r9zXTI*gzyI~F{?z+8cmJQdyywL){?YVq|K+AF9yoW^yRP0)`u1;J{Jb0PbmF||k6ZWUw(Zue z1kE|us+@R)bDfZmz1DsxPm+ z!qr`?{_6T2sq%7Ve`TK9hNoShx&+L_(h*rE@2 zZB;67*r`-zJHUi~m0ek*h=n)0f2yA8o?icudwJ~w_oU_r+~evOxqDasz&){=xu*~w z!1GIZ|Lbc{aSvGgqI)FiJF4mIi#$Jv@HxW8gbNAB2>*-lFv4R9Dtqs>kGQW9o<|+; zCA^F9@#ve6S-FU4az*r{b23)X0!U;-AihJIlI1jXSZJaZP%*3X7*pT z=eoNwjw`FFyA$c7Y5yg)3ua%TZ`arE=r8)W71ks@J(l*VUK1 zJ5)bGAJWR5NY(yN*|;@!#;q|kUK@+`Uwt|tSRd)1`WOQJdrsvevl-#93D?g1rv5Dl z`lY_j!v*fAtM74-1qM$iJc97->TlWg_thTbE^j{7ooivuJ-K#4<?r|-UaPG zx$+0IcR{ZgmUTT_Fc;pdm(Ko?y#EBwf1Ged?LOf3`w5I)G)%d#RZpK?-`R1Gvvx## z!iiFXXpeB5@IYOw5Ay(>30Df>;APZ#E#Y;9w-UYp%-%zK6X`DLH%ZSW{aEd=8?T+= z#-dlzjM1j(1KOy+isu(FKJ{H=_$m4UjWMpb5E2NPB;((4m(_p9?XEr2y|j9bd#QNZ+N)ez`>6ZHwU4=< zRN(q8q?d&8YaZ@{)d~y(ECQTQO5s%oi$4X2uXSDMCDNQEy))@&NFPf2A<+@A{88~V z@fG81@D}iWxrg)YV{>>0_?B=L?JeLt``3MNeVf}3aJ;!xJW+fp(AQcEx-Idqd9Arw zwsDGRB;;RBLwU_R=;;H{-y`aodqki|(w`yxs^+Ap|BB|sRcZ@5bB%{1=RQaJc%^q z)0i`qt$uTML;Y>g*){GS^!-|^PqfcFJyZYd@1#G_aP1oK#(Wp<)gR%$Rds3e)8u&v zc|Js*S0lSL7U4rMP!Rn;#}%rpd7If+Yxf4n=ktu9GWDmp)Zjt6eXx*B5iC@v<__?v z|2TPu?njz0qpsiK`o*(Z<3ZH(Cc-uF<=2q@)9eP5JCB1eox#}81}4u&hQbT#pKz_} zo7|4^bojbp1pLza2I&h48oT&?DN8j!1-nMyeZS;j?Uk12QH{H}%NwfqWz1j6iwbr9 zg*)CDbNzkDPw^e*kJ{$>S>lo4nhF1liReL^i@XXmCFYbZQ5`Pz60^=u?>1B-f z6vCweUbWj+K1|pooK^d?|#9*o4s5-rT%E-#TL5I zd)x**w_krAvf>V|zxD!XjO+TZxL?+N?Rse8dUqD#{`UNN?%cJ{qf>p4I|Ewm*Kbey zK=;J@ozYX@kKXxb?!NUWGp?7rtp;+l{(JDbM^jH3#EYaWG_F#6z}(kQ8@isoT=l8k za4}G| zebik?_=cDC!9t&mGI+)2T=Eyq0zfn?@zt&pIyzIJAdt?m5g^Pt1_Qjd#d{q;qin=SU8Kk zPjZNlimSC|S1WDa-JNfBICq|&t-0BaH8;Dud6_#uyl*_qov-^fm8Y%7b=+^d^YvWU zwNJYT*I!Mz@9gUO)5!Dr*(;G-K_So5{ zG_Ez|Q3yfi9+2L%cHZpD1D>0V4*cZXr6Fv@ z?{;U4hALm4eRT~Ty7FcBpf&0J=gwYQ{khpoxj&ox*9Uk8Jn{VX_Iw3@qLtdOxU)~f z>q@>=yneg;D!7Iw?;FxU2O(`=<<5`J2j|d3>-n>*Pr5(Lo!@>iG?hVPhj_noU%v?Y z`c1;kq_t1Fvul4qAKt-y_!Km^a&L57(z|Fq(6Q)W_w~P}?Z++XwSJmAzy4n6{_dXc zYgf-6UB7Jhs9K-=e@FfYlE1N-7XhyINAdn~^r6I0z)MI2erlhdy}o|c?DfF)Nc}3e zOZq*e-xE^mJ5NEla_+<*d;Wgnb)+vRKCcSW~(mBY?;(_NLf`q>i~0k6;O4<{bU``ZDFD{F6czruR? zjkUMa)>kO|QtBGHLss^LLkisZM)C=#Zy|h?Yw&YojX=FOeYW;N_bdhae;K;q8-d4V z^-q=IRM&0X0T>YI<7M@qb7!?)g517R^m4}*{_mbOL!4&yqh*U1oc(z zy2h0byW$Pc=KZHhU(K^B??24_XGzZ^Je_Cr@gbj|T-|nWHJU~rk&Z0A&(=sO<2>7) z-h9&RtBo~u*#bF#J9I#FVCjJMmvH}T?!&q{q+djL-EvVKy%+uTQKWv2rghYr?##fu zOPM z)_&ccVRj(&_6GJP)_<Ju}RY zTbeR{*CK>@71|5+gy$iJ53;_T-JQUm#_SF7guT{{?u^!(-5J~?3ukZT*$o8po!I04 zipt-*GpgsfW8A-(`%aB}Qh2Jui4!N$=8FEaN@LOqrIUoYQ}Z@V*=$0phmUcI@{bNi2cInNnVNZI_9)j%nb30wI z&z+RAcDr=;S+l)h16sRr_9bi$50{;W^bdo5ZZ$1!qR%UBc9*WCuaI3vynHo1$+q|K zQYM9T#nu;OR7lO%B{<6FrSu#7Y^~w`PUZ7E&2^|?Z@#${853-?2c;*iQ?$>rWV;RT zwf7>sPe@O)9b$_zdr(M&tkxb4cJR6FH{1&+Z=QY7_ES_ZwraCm${zf!g6wFrH~u0v zMupSMaGtBw39zBmPRM<3o!s_=JZkbUid0A097OdC)1q46p12{qX_zeT8{EjB(< z1~jxfHp_1reuKOy7|jcOXncr!Li3(J1Y87|1~@V1obb|l-^)IQwnDj^O#>cZLmw5s zw+tm7Y3H(U6}}x_LO*Uc{SL={VE@a$8xJh6&9-tu<-I<&{i4^c^j|b~S)CP99Zj@> zhTLFPCjNx22HT9Sjb8`NyoT@;!bN3xIH~y78HBYOE4M1Nvs~sRdcdAtQwVe-+c}}p zq&;Y&#)=T0ew7cE=N<&3#xuz)8if9^w=0~AOn9Bfhb;OX!cQaP{+tv!Hv45#)`}v z(3Z-c_%nj~rckzd;%Qu$eYO5B-CLQy^?H~RaX%9dtv+k=E?>fo&^hza3x|MEGJ|a1O z+^&lxO`}edB&R0PB*~BEmBUfK6YHI29$2o*v|H(PyVFjka@$RA_PX85w3t?kB8`$f zADFY8UEH)IH^q^kztSa@ypnJ|vir5QN+qjAdLUO6xxYA_zIOfPUZuiK5fxEH2WdyH ze5V|nmBX99oAz)`RWi^@a(FYXq+A{^2E`z4S0edt)Qc*~G@0g|%55vRJ-o@YJfG$> z6{_S_qBEkrQmj!~QW;c=Nu@HWP@bx+0@W-(r8`~kPpu@KB)X*z1vsBZ4buuB9n~my+tbvq(>kXO z=x2JkUO%-`iH`a5XOKThj-5`YRYkW`*{F2lPPYjh2HOIuYV1~ehLCP80#*#dp79u1 zavw$D)!YJWm9*axELWXCdytRf{XWf78}Ukcx_*3`bW0 zJ zuH;F(0+5mo<=z71l^uoK>UN*I^1rXV^2)rk?9+bmLUkt%KF_?j^30zz@WfW<8EOyg z5c@03G>^9EL#49rLv1Ik5XKenc__SeH|V={mwsv>du;&03toX@h}y3IZ=%DSc^or6 zDnpf?+C-|<_LzaH^Y*9dX^i6mj}#xx_N6wIm(=@cx3yxB5SBRxQzx^0=ox2-46g?O+$%qoeC`r zKSz)dHAfOPc+?0zA(V&`N%4Lj0+}tRo+d??J_uMx@rn;}w<{4nM|eHtYKDuld!idd zS$JNiF??wVu7^xH@i*_o#I3{~<8xwb@|wc%Ieabiev-?F_hDuntH62GDg5Eh;Pbfj zC0op=JK0W_?xlOMJLZe;(lp-7N?F5$qS)L-A_yF~I9^}B!yP0~e(ca#0 zn5HIlI{C3fhw}Wi(jmu=dEqn|RI+}*FqsBrO|z`iIqfu_mTvJTw4!$5ou#W(7Nscy z&ngfQ(4u9JIz^N~mA*@WbdwwPp+cPJ+3l&xS9O|=Net=Mawe1DPO8ron+n@)y6(E` zTQfGbTeB0c?b^hVi--o>?RjmoVav$qf1>zoVlDhcLj0bdc-|9Anv;%@xYCU zhZc|Acy@yuyY<;O-NfQ`H|2WjHitZkKhXUU*FWeUMEpbUA;b@IXA?izokRQ(_t4pYU|m;y zjysq5q3+?t53~4O_lVh--NW4@iO+LCJo}P+ggc-3k?u!`f7o3>d_M8NyB~2sN_>HP zH1UsG{3!Prt}k>K&Hl|j+TzE!$8mj;dpz-D-4lr)NBpnu@$N~)PjF8mexk)sau;*` zWcSqBzqqGZe6f2P*H3j%C;l<_4B|_Ozv!Oko=N<4cPa5R+_Q7GmcEcd+GKf6mU zezyB@uAk$cPyAf>0^;Wpe}R30%ZUG%dm-`j-HV7{;C_<$GWX)y=iN_O{6hB#B?q`U9%Ka?yPg{Js`#G*(>RvwkNB1)p|Ezlj*DrIwK>Ty=m9x*e zms|Yv?w7cJh5KdVU$FQW-4$HF(*5e}v+kEH{$=-Su3zPTjra=pn%QUEuee_){#ExI z#IJU*CH^&wU*lfK^{>0%ntj^+hQ{>pyZ=6aTTrZ*_k*yVkwUy`A_^+&hW?)Z(k%ySV-{_vf=uy0=^W zzumjJeuw*u*(cmP-Cq*F%l#kXKX-pc{QtT462II1HSv4g-w^+WyJq%r_m>v`ANRi5 z$J}4J4-miC;=gtupK)I#{;b8HbN|ZqKe~ULebD`r`*-5cyDt%c!F`$dpNT)b}YK*W8W7U$^+b+)Z3x=T6N2 z)_udxh_A1>*){IJIe>kQ`(|a0_=ZZA_{K_&_@+vO_=Lr?N|S32uCuoLdOL2rYIUvF zY($NMuZ z8a?zKrC)6xR%`95x}X}UN)yO^@lk>ZR6@tpzN3MYkJOBBc#_-=LFi zje-$3+O5_a!=vt+0NLPAqX9DXxUSp`V~wDcel}Vv*=o>+VA5`@FaY4T1qd2cAe55o zNn6lu(?yB`TP3=o8ey<*1pxt-3+{AM&DLwJ$ahj5ZG)9&U0Q<*F1awu)zpJ(5erak zMz)uVil7(TwQBbVL%3WfnGof0AEc5 z@K;lfVc~_Ag%1eYkECVP1QdyA!DA$n61qZIkXax%k4m9&fADweoyM{3Jfc0q4LlLX zJUKx`kPh8b#{jI7RVSVy4|fB*-UpC_xj7Tl8%<&VF7Q2#j;T|Y3-iMAh_!n53L7?G zJ_)%=p&peNn4u^S>}snarr;gY08s%f&FM<~*}GQDPfbZ0IioXAjbsqi7tF?*QDGbe zZFNFpK*UR_MXjPzxzLJl)0ec;)`xk1NxmlHq0DamW$yVNseW#P(@c`ov&vvQG=lN= zR&#kHDt|UeyKV5?mvKZ*<5v8j22>D%B zG@l>z#QQ+|f`tabV*{P)t%ghy@M7*DH5;|4CGTavSb;{dEb|)+nJ>V#xTVvABp1er zN%=!X&}$Rv%!ep4}Q8gotUf4A-sdgR+gNQgdsHjEA^fF&B zYwZqPdhTegYK~W?~Z#5o9$pguJ5{=mq zugs7fKmb@!g5?viIn2b)5<~D}9ma3Pe8gk^xRwf6tw!~zjS5h$wH^_&U=}#0P?Y+!zM^!KR;qPiyL9K=$(1^QrV?@3}x7}7C zi#ci)@*t&}1@sijdI>;=&#VR(8iCs3(mXkC0b3E>(nJ%`2?J`4=}HWP)wLdw@J>`n zZ`60u3PQJR22Rfmo8R)WhK46(Hk+N5z8K2Na&wtadr*#QEj`V8brY3NAQO-ny11#> zepM~g3iR2blacVWhSpO`d@u9cNL>%`)ieNqH5D=z&Vf*k_3=|nnl`f%f={@ z61qZIkXazNfJ&jx2cc9XrC7b2H(y?OM0mGJPH!m_uSv9 zl-$k9{P0$@)?ZT(Wa9fODiqO(oPl`5ODSVCmf7Z+$hCAK_q=qeY0O^>FQWIdH1)%1 z7BZikP?fs8B=hMA)8^K5!T?QZ^3~W`(&`6B+A*1LO4Fhryg+L~W@w!1e<|~I7i7LB zz0krmw{^a5jf3(+dIjC5yfha%8|13Y_sXaK!(~*3wQedHlZ@U&=HeFgRb^4otap<6M&QgNzjRkV0ZgRl z8)XIEsCVd6wca5Qe`Hw957ma3eZqUF6tbMld;}65_n819l`(hF^_OHm&=o7tC?HG$zA6jIGs@$w^ARgq%iU za%K%v3)g<~Y3ea}NKVG3mgUr&D&udfcarQToW=8(ngSz6v8BxKG&&JTtD+B?gk(_= z0W-)y>eP9tuh9r(+$G${%&mx2uxK7*L26)M^MKKzdn^6GXm3 z+-@r@>h(}YbAp_tH+WfZBEe)ncw_`>CzQE`GM^66`6fEJ9Mz+df)2W?*hG(iMOUS# z(|i6J^(C2a7NdpCC%do)l3K0qip)2Z32ivZe9VZDorH+ZKtC_lY^y9-0uP-JqZ#u+ zjJ=fk5I{4A%XfsQHIw{?F~8D^kh&h=tEu{bP!KW}UT9hPIfC{h2^t8fS)@7=(d~+) zgsu=4WERLRpi-z?4ngwUVrHM%=0FOF_6Ro+cKJX?ZVfF+b2ZSAsHR*J%_+0I5L1xb zC-eOy#d9WRRm|7<-(Kd6wU+EP0I`(+o`e<4`6ZBD`g~&JH!Jf+Lzb7w+fP_Fl@6wE z&cAQTN;a4I64W9>bM{8>4wm^QT>@CpOvw268lGNj%t}kAXEX{M1uUI*#~2AMP;sM$aFunMR+<W0`b*cAYM14ld}N>*lM_rba%*|-`)zz$5T`vE1(a9q zi7aKRHFm8^;BD%tbdLs$21IU`Jp4(xs<@oz>#ATO^M%YcU#r#2LNsLSBJ8nPq3gG5 zUFNCXQ;S%ENx3#k4z$bgc*=~2Zuk>)q87DaX{9$n4;f}D{qy4|A6){SECwwMHd=Q06u%uZxR!EX|TY=Z+=)Op>)Ja6FQrILQ z&}hwOpy?_S<5}5DXyz916wL-&(CiWhL>$1KClDwxs|8Lq zlA={wrQ+4m4V6CeM<`?pQ8A1DzB!HYO%cG8tx{0KOt`Gv5EvKs%2!HQm z_0R}#DeA;Rv`4ssC+29roU|YTEObvD6DvHx3B~3-ppCaJve`bbJrjLv3VU$CM9s_6 zfCZ(@5$1)JH;Hd77`7@OEdL=lDXN^4MDn z@7v5@37c@IEwa*KcZtyGr9(+hDaV|s1!i+)LBxqy{loLtytL)8#~P}4^bjUrGwEkC zp9NW{iK>|e+*uic4Tu`LZkkE=mYDIi8WoA@E*dd<<2iVMadg{VhR<7xB1$8TOy*M_ zD|9>VHoK+Fr<|b@nP1qL7BYXic9Y0nGx0K?NhTWgtd}9EtZ%XjtI#@`2e2zI@0HI0 zMst$+5TH5+F(O>z8gq?|MxlO0$}A6hOSYoT0_2xH^z|Z?LN*aKueu!$2zZ&#J%bl3 z&?rzz8<2pNHkr>P@&X$Q0_2$bh(H@o;xnptkog{Xu%t-4V5X9KnNKsFcG_*V zVw3r1TnRFtxv4J}gyxgOG6I&b0}6d=$e%|6LHm&;paj$`(oR>On24l=t`Gv5EvKt{ z{6eW@s$%sF0^aAli4g4(ZXitg*ho$?Uyu&nQ^#1?gt@Ss8XpkG50v?fg^TE0;PiA2 z6E!cB5-SSc$%i?i`sWfJW?K3hEK$D9P0Aa;1fp-j*8tLd;)>MdOv*s|TDynd%YM>f z`%98Wu3SKu16q;!CF`)t%5rc)AmXKzNh7P+6Zhgiv|=R{%}bZrfvuDk@7nZG8#um4 z$a`!FC<=RHPX%{mdplgIF4#l&^UkDlP_rn4_$H0APBTL=lic z8nNqXO~P2BByM3;#uBR91wjO1wb8TMB=hMnU|Xu)3wQMrXGFmyqxZ;iks*Cm=P9Oy zMYGoNyk;KN+gjuETK6JBp@mcv0LRwfN#re=-XYw<3BD zZWGn1B3kQ!MUaWt6Mph`EJ=g)XjKeHd>v|2a5ofKII_aHi z5_PKJvNMnfvftYKb$){BV99xz58;ThvGJ`rg&v8$eM#nHYSA{(?lnA18&(>Fv1&d#J6kpq?yDl`)kcOF$oF#Krv#IwGq=p1>@9V?3NnG z2MPyzbwe=sehwdGev+8XhoWoU#AH5{SB=Hhjr8ck@+4?A5=}T#gwycu*9NuU)Vw7V)15Jzwu#mN{&eSFWiG_lc6Dedh zH6@65+ZlW;5$>y9MWvU-@bWPLeK`%lT}}7X^L}X?5VRjjbJUb-qsenjM11{}ill_D z5CWMkr(U`Xb!7mhGKyLZd3edUh~rd<_6RrdWT}Uev>*X2bWa@<4?M~7sC?Q6#KH5d z^iAo~bFV4v-@ru8%cK-_LymcQ+7W9l*=vyb;-dJF+c;3mvqS5c&!?>&>GP#CUSG<5 zzvf=NL7L#gI-kWORVv8Ix&j|79W=~mr=_zuF_a=L!AmJ|{os6yi#y*+DD3N1>4np< zyc3nPZlG2gQFP>N{LsO1+>E&*p$q%nskd|_3P zAkSO&U7wa!w4m}Gq>)Xv0e zGRdG|1e^plC(c!tGBym!d?RprAeoP`TRcTw!D|qd(b6WN{aQ06kEmC+k8*wl+Q#@_ z+PJV&(CV6AFb>Il)ml!Xgoc?r2$yy#^CQW8R&Z%5u>@CTy%Mhph>RE@Kss~-_;)*u z%2r(x^vHZ$ymJ|3zMu$5_!bfT85YpfC@51V4B8}6l%&i{a7kMfH9LTYs{yn6#|{vK zW;3zCt4-$HNE=DsYN?an2|*%G6%6xmo@X1}p z)WXOld;G-RC-XH{^3_O!%tzptGGE0?=Vd-OUgoE*G(l0TwUX2%BojLZ=*aveZSoK+ zOc?h(HJLB;9^?)6V$kLT>f0=T)6{x{)xH*|=-VdwF?PYOO*Yf2T2>GNO1KogG*jTW z2Vw;+rsV0qRte}N4b*3*GPsN+5`=2Wd`;J8oT{DB7ii`duoTfPFlVnsB~NuZ%0k(AICLLjr{R46<-_$TUJSPF+U$%JT+a05@y51hzJ<_prH zd+Hc`ec#k8Z{|~XS>`V?&Y76dpeZaa2!2bMkChA`s6EUJ6&GujFTn>0VTj(BY!M{m zCG(Y*>=)E>HJABb%G)vy{;C75W^S_nbxKQ|B#oTj%lXdBy0VbW${M7$f5V~>8a-L& zt3~DXwMd*utz0V2FPFq@x|Q#(#U+^^LF99pkLX&K`Irols^Z-^)))-s)|C0ef)`w^ zW;V=B=A#9(_0?#1MY`5ki%=8MhmaY}T}FuYsiid!atAJh%$JU(Ne`-#o%)EWCIx{d zA#xB!N){Tr56?0V&6td~G~E`BP+Sb6ou-uSrg$wLJi9;#V6DnMO}1mKHCftDCG+VP z)1DqfK-I=j+|(34$|ClcYS&RNh?*hLj45|aGIB%aNOPJ+X~Anl9hjRXUzM@2!?aBv z$jmCI64}8uQjHixVW-~8>gYi%D7Dz&g}mqMieXdc1q*8SwW?m#8nPuU@M~yXNw?kb zKiq=MXYgVLq!3x$!uCgL0MKCt18MLFr!<*QcNi-s3z@UwuD*Y^_SGhd5Y%Kb2m-`> zJIHphK^;_~8ekSlidq$=nq(RpHAou}Moi{o2Y{Iimpstv0CozjrL<_b)k*J!ATbmb zTykNeucjVUi&%id+KB03$!P}!dnn`zy91|82A%SgPL3@fYM>#>e9e+bQ&0MyGBaan9^$|SCG)e)&gHQ)R!=g3P*;1HU5FLbY6#+|V(7g=mMav!ZdZXU=0FhIgJ!7a-J#roFE(zOausc}eC&MJ-$L z!+Q))l2c_y!SW=TPX*wCF=t-p(;Q7AY*HvvG9O?k$ow3cuajwB=9~J)e)(7{9W!qU zZ~J7vxD0GZyVeLf8Fctv9?_`r3`s@7gJR+z5G$y#2MAd3#nRf#e378!pGv8&j4st% zIixF@ZxpHuBxJnrMqc9UOso{cxy<*qhHNQ{Ft4%{nU8?MYu(@O=*NRZ-JKZ21}hI6 zAPal89;FdNzEBW5{cQ8mC($Q5VvzZ^_T>x@-9hHF7%Vw)H%cY*p(vC2?4xus52K4m zndpsLP!l9j4HoRS03Nhh<{blPU8mClwo?F8PkT|@|H6^t_-17O92{Z1KJ}nl#9rou zmt|+_42GM9%m=fODlw1vaXT`zy@EvNi45!{mf2)JTu_v!d;;D==0oAI`Z~KqbLV9~ zwk$HaRL+6+8z8(6pcCt(dRQb-Z`;`dk()5U1cWc>J@ln+anfTh^EI6q zNKgSB*~I0HdlxHxDfgePgG?gH{B|=#)nf)~tPrOG7B$Nc!UIn-KV}W-RZ=hWflJcq z!LV}4{93v!^U*;hA3eZV(*XR{RLEHP{W3owXg`vcQ4>%kr9{8bC6W@lLI`BGoC=lu z0w~qt48`i5w>T`~tPr9-!VNsV!b2&@{Lnph46H2AJiCS?0BY}HdBHCxZTlpdZ%Bbl zc+bulK1}>jUUiGLdiENC=yd>b(%@B>XNSI4#q9=)(TdDx%A4~nAdDg|Epd`Ga$1u! z&;w<@wpX-dkn`GrWIkkC%6xqsmUz2zHXIRP?g{kyo*V}Y6A;URB#5p8O1tsAmDh{XwU~t01Q?F6YEnO9R!`3 zsoKfNgUpwr4?@};FK1HLqzTCCj9wZzy( zJ4PDO2{jq%Ap^00{4y^);yMP(YXq+GpSkVn+3#ReddS7u)Udy3|z4^y*$ zsCrdv$d=JA?=#YdhOT=_F|h)T0%KE~nZx!50O)dB3c~=K|6;mH%;?!+pf_AF72vLV z0Nto0Fhh7_qACj06Cl+tvR&FJIMmv}WIh@Ji`ZP#8;yx@@eWPML_u z?gkxU520m9TTb>Cx~krwkJt?h?UHk8u80K$Mn-<7UMyQ{x3?nm%l&7|ip=NW4l+MC zAp+{5L0VuQpjMRyOW?80NVEb03RzZ{dckz*q}>60tPq}RnWEB5V0if$fWDjt;IF1a z#=w*f<;n7R|tX3mQ$f}UjU_ANh?d>e4OK4I zD!%|>coK5Mo~X&QLu=6ky8-{!5i@gPo$tr&Wqx?)_e?U(I^Id<%lY>)Kg_M;ujSp6 z%=d3H1d+__UP_rXvaF%Sc}d%ufp-UI^{RB4ofc)#@J?0%ee>gcq~$6%3x`6$jn%{f z4;sBSWxn8wX;k8&)m!gL=EKu_9Cv9(iB#4_KQImPIZ#g5>5z`QbNW>RSW_N3VHPFK zdPW?q$RzVIB=Z=XEE2`gz^?2@@>Xt)1HfOb+0Xqe$ z0N%_3`e}E;q}A(z0@J+WPR>X>7!!OIVisrwFziC;;k<%u|A+_%B0YsW4i>=7+aOt| z16U=oQ$R~mD<5_ub<#T_NG!#Wx`;eTzJ2UvK6qJn9Fjz-L|N2gh6C{GZ`=BCffAqfN~`K+XR$2^Eio1;;J5X?l~PMRx5w~?dAnk}-;fhtIk)17l6ujzzVx+L?-4=co!68Bg7 zQtm%n=SrC$wF-1z?du4LCLkD9kog{X0Ew*_jxhj*Jg=)M;W>+kFsvRbU!#^|>JivI z=mnGj@YOT`e>D{{7Jk3X4+z?iq-E3u6sd#yfo_qM&=o=;v*lE%Tn<91*3pX9yM?s( zS4Cfl_6Ro+4)`}ea+t`7E3`wTV+BYDT@Ys$}0l9vHfAok%zcGQYpkN9JPz>h$^Utkp@8`K3yve%OJx zcELb-3W1n)wbW4Sn4JiHn2Df zhkjI#6cQfLO^rVl6PC>H_puad#|ryqA*x0FrV1W#v^Pd0 z0Iof1S1o4yX9PG_^ZYv<9SvuZ&%pHwC7crWu9jNGsMAp=y`wRc`6{^N1loiAQWm=u zpq%UX{gfDNL&(Fp=c#N=9PC{7 z^M9q{DPk`3!&;_;$-CdPb9o#}Y29b^1j*$eYu4)AG!r1M%$-YVli461ub}7x&Ler*mJYPd95CsUl6j!iVt(j z7b=0LBbK(fk`czse0rD1BN$fyWSP&xB<}}+uciU`tErH&@cU(cK+t|9Eu$u&C@=D2 zh!aT(T_FTATTX?_eF2neFHo_1x7ca$SH(bx_6Rrd42K>{vU~{Ap?m5WR^O%RFu$Bn zU07c5^OyWOn%HFUn!+9_VQ*gBNNFAzUC5{MVy*HE5QZlqHx?q$>)D~M%A8F&(ww)8 z9oUpFWxn?4L+`X_lINhmbdvdU{(X}6dXnqq9h#TSgmOt)PV7%|N;wv_h8D|$yz#C0 zvdg6{hqb6Bp?67~rF@`KE-bWMZ z4*e))J|+NWvg9H=P6!}Q*)ipj7L2Ks`Je^asm;TB0ihrsnA?~*Oy*NsV#e2MDvc1~ z!EbobGZ+Z}iH0%v@IYB=f;I-z0{gUNK27q!oYFzB!-sjRGJg}U?#)}m8}eZ>1kC8j zV+Kecfh+t5#Tp3(nM>`Y-^Mr?6>UPUtU|OLV|B}RHbohT?oFukGZxq%*kkBMeY(_$ z22B(>WNT_bvi&YU#A1$0qcZ9%q?? z45;$p69XKKve!m0!B&uS!VZyuEC%DMRVN_yzwNxRP+!2L7X;r?EV_j-5;oR!JQ+G+ zS;VC5!d!_VH#u#Nl2hiuj9(GJuCyfcW66A`b!bnhL*{cPGEIjoeOZzD(u*KFEgVak zZ!|@-{FbOW4?KXBWM+_%5vH!Dv>GguF$`;9GQU__=SyIC`51t{oCe^prb5QT@0Yg$ zLHm)kjGBO=qF3}rIFXdl6+$4hzk|%jVRc7ZNRqcOs)-*^#2gs~OZ@`b-02yi-v`uLAFp#|s0mWb z(jHqy+-GnZ7)v(jcl%mzviw9~(_WumeQkH7>Tj!j!N2);zfEC4B5?Oop z_-;#O0kygVp9dBCbO3S4hi&9xSHJ^|X(2-t%11v@UTYQ?IY`38oKW3eIoT=qlnYIqb*o?Bh<%7Scp0f{6T(P(Xh#U32!yzcp>KJ25pOI1}MmNJ*W-_00%TAy@$S>#7wU_zBp)s2fnaoFUM_SDAQ5$#_ z2};QEh?5-@)R79!LX34baV>Mp=jC7|0+W1JQd39A9Is($ffr}wm+<)c&`4?pW(oM zv;&J}vp3Y|?`kiK6)ULK5TqwaxJ);OBZbL&o+}uaP(D>m==IwcvO-28)xl;?u39-K z8uf;1hhCV672X1tBDw|UsboI5pn4We1uPKeif&@R4VWZ?y38#s>_8R6<%^E+TklT# zvBXPgm6}q1X#kZiOGhhxDbJi)RupG1^ZPlxhZTT;NDBfi-dE>=2auRE`e;{182#gL zep(*pkxpP(L(t!>_oVifW;j{sO+FgH1K>j%fWMjswausdWqv@=ek3iUCZMR-@Abzx zk(AICLLjr{RH$4ILaEl#iq*TtPJ_SdkA!HCa0Aa|?4cB7e(0V$#t|h=!&Nt*y2cVc zUt8qq@DatrYYKbHhKZV&6(h%P>3x_LDlgXR*()?{9=b3e*rJdecRV}PRhh4uagsLl zz)Rq;FYoQ_;hoM&^m={FI^M}>&OpWGa2a+w$#w5g0D6cGbE&=Q_r?Asr<6ln-@DLa zxDTzIT-tJ|K~{J{o~GLEM`HON$wY19D^!g_z@=3M!$%&?54w81eOIw?z&5AkY&6;# zA@i{S#lwtaFL92{_h$!vhjqvu696+=avSS5#%Q<&@IzXV1;tW|K4`&Qtph{#9(SAs z<9t8H6WL^J`6VG^&J-Js+JoO(5vyXKc`#s7=7VfNn>-P_z_i?F1A+UTCSfeua1ak9 z^XV34WU`5o`8%?1+QtqrV*+SdT)J*U@|fcw^pWqGVFf7GhyqsmGB?pzV;t-TBb`c_ z&ucI9Dat^!JX0mm3Jgp;#Bpbclxuc|O%|R|FKa37jms-D#qpdYG9U3#v1Gp0s(Mwc z&z8mmj9+}DH|Qht2e~{lpTSH0*C-PB05gZ<@(eIztG=LeI)E!O9jcGX#ZHa3GbHnQ zz|vgSY+%MR9t-_w1n{H@A$JDIe5wRW0$7f<35}qLlOdCgp>=^OaAM6!!q-!b2^o)d z15FNFu4I0%#~bnv*5g>6^iBv8QCi0q(P9ekzw)43!~zsMj3ZAYWy~Q-v;h=eEoS(r zO;pGMX9+nT#jN-kHAgCVE@NF!_94sM@_Cih@-u+F&Egwd4mA*QqW(zjXn`mXCT{^N5#2%j$w7sv!8j$d$eu`44? zL+XWelwP_%NaB&n{Juy4)T zO6Uq9klAwTrMo2ja`1QRonP%P;=x#m_6RpXu1`EXW%jN_Lu=v!6hg9Wf?GJm`~ zX0^cvU_2^izE0ZDoqgEW8Pa)X8K1SY6A~$s`I> zkWaewK9%~fQ6yQft7BI%M=$exEQ;t3DCy-i%#k&EBbkr-jMQcVu{2l7xy&DrK|zrD zjFc*c4r(Z17H9;p?U9y=lrFISV_OhNSj`uJj3r!-%%?@xXZ(;|c{(5(PLo)j^sY#9 zJ7#SlSVXGlAiv1rue{6$FUzj2q4B9a0-hyw&Qc%wz!^I5t0iP#7^_EpJx}fUGcPQ2 z%jZ>2%SVpPWIlUzh*%c$7(EeObBF$CM;{Z({AP399Sy zWH1f@Urht>S5q(RL%e^D9T2o1NpsW)Jt3f!tm8ydLRScZ%$8H3a$f+YvYjhd?-n}^ z{%SZ8qCLV5Jkxa#r6BV|_tdciWj?45ep%)(rs$lBiM~zdgA{mO-FsOvde|+!4>Lo> z#acak6kCq`NzuoDl>jfVUq~c z34kq9I)!yR9-z8$oEdUsFHt&{raSXH;iF)Th7C>?p?Y;W-!I!gazv*36phbwSZsa? zKcuH$Ae%e!3f7;K$v92>liq|jd4gF8AoRv8$+_>dXdALivpz{DoEL1+EqIyKx0G)L zj-u##g^%SPR^FxB6SF{Z<_<%4s_&WO>2wM=!dxY_lTs24SSPh93PB+=b#$c1-de6a zSO|1a2fIm+ez90)K^d?2lU^%cZ=+w^Av;y2T~*fM-uJTkH>b=Eei+Tys(Mvx$TntD zG_zzf=1}0cFQ3KqKBtpYjUp=svCOe3C7c-Hr+NnTjqU){K`+93l9CHkgto9*o~xfM zyHv8DaykzPb*58HSCW+UZ44Hv5_G5rjxJ#y=Epg*b(UlaKXMps|H6nY{%MNszn8?A zdbCr(7ao46An8oD(^Q@Gj>b%?Qf}D^va>6bemWncF_Ea#}ue6lN$!ch?t(`emr7zSK`Px)A$3(7RT1 znoP%RRyLE#bUd82+T-zXoIzGmXR;nA3M{f$oXLEhMOk==w)BR2JFKA{%D~rBjfU!Lsh^^)^@fQl2@p4(eyGI@l*V6O8+^@d$_*O;BEXEaCki zJn#Tg(MLH+5-p*dYD%;|Dz;%*Q;eFe##nne5P`hTn2x6b;Hzl>{%Tq-Udv_aet8=Z zv>!>!s0k>N#<+7+shbYDKKovsbZIdFaA?$Zgi- z*t0{`TIOr_IY}G(sXcqmY;P9yUqFO+ecLk`qvCnT;?eX2|GtNHMaN&uJB)RR9CQB7 z7(t|cd@rR;8d+9i;h%Rgi@%CNCf~y3V^ry{Zo2)j_JhP2HTVUBhhf(Qi>FmH;!loh9H|_OV=_W%&#DK*` zFXypzEF^}^{i(h_<@el~SPT>@GCKh4U+GX;Z(x>J#FIuT1{s&D;-n#D2v!%sy#Jrl&v9n zMW*kW6DAov5B0@V&rC<;1ZojCd>&MYF%PmLLd5c^V4egWEw5##k{$WPDYLVZ=^83`N6ZEr= z5G10c+_Liv+mmAtszoe7Ik&kvp8~q*q)hJ!zt4wq{0E=3y%Vs*=Tpvwa z(PVuzDOj>}y3>s$RhWcv&r>@+CG;-*kRQ49UdZO`TxNLvoZhB=Mv1fx|C(&KceKSD`U znoc@#7Fva@S!J<qR+Ei1b^>J?(hP7#*MNjxjN?`Y(7f=GgSJMFe)pWlmyDV!L2-=UNWz+-|P1Yyt z+c=Sw&=o=;v*lE%+!sKp4reG@C`KdJBc+r5WHMP_m!y%yg2^}`Rda(OvPLUef2ZA* z()I1l`a0|nPUxkSNh8Y{S}Y49PJAmTmoBqIcUls9*GEC-%Oq-*Lv(TaFw_Kv4w0&o zP&gPq^61u-`NBe;4D`FA@y=;G`o)TPly46?pOcStqGHYq+5JWbN;d)QkU2fBx18^}PSe(rDSVU# zXtwrK{Ww0Q$6n44m%)Z8m1R3SJNcmK7OW5WE;sMUl7babCr%KcoE8*w9_1VsR33i5 zOZTcI8;$8~FQs?c_9!2=)9t9oH-@Ugs!|o6vk!|=Z~pxWa|8PEwW?m#>az`s&2f>n zdimzYDDP~J<@r4rXp2tnXcWESBwHV?H(3o8#gNbTC-iNIkSltVA)D=K(S(wrXr@Ae z*`IzQrh#q&n$Z8*klNWE^$HZnUN$T?wW1nMhExGoFlqL;wuh5mZ>vw&<02nvXO-mx zh(VhgXGIP>A7&})7RT5)b=qEEXEe09d8EkIN$>;)?4z{|2@ z^MvykLre%mtm;F=K1R20Ed27QSRX+<&3LNkeQzQ~04j6G=T%P2M~;Cl8kuLD@Z$4u zq%4OK=Z@VP4u5m2pW(_CRAjC-D%%!f>u z{J03-P~RJsUV_RzChwhXJC~9;?jmTiR%rrymTOsq3vsso!=~yqLCmG~hmXO<^zJ zVWQ?IQ~AK?!pzX56KnPCRcuurx-cJdW4%I3i5)5h**;%qoaLtDs}_V37J8V0Ih~9c zqkwuR`w76^kff2*0-Awh7myo`x3;F!kavX14zXcwNV(~Bb5raO?g9gn&TN-kpE&fqa7^N|)v4OA@PY%(97iP5md4kOYR z4w|7z$pB!>FW8bn+vK|~r$Q5?S|0%6?QK9k-WqMuCZq-<|>(9k%};m9KIvj z1fOTID>5D#VPZ!|<{PPF9LZVk$?6XcWZPr(qimsEcnfoYFN1Vs6Q7vO zx7~U`N4=^wWZRnbvQ|Ie+T?)1)4?v*ZGjUkKpcNdm5rHir{2_QqpkMe8+1HjM+r?i~{`1sb*UZGBUH|dRSB~81_PM|%=uj&B; z6V}FEPa|c_fl?NX!$H;`=^!HC9P&+iHy#gA=b^``m-!odJ{ZW<4&p6y*XNDL8Y}t8 zF|-erI2NlPq1SIkbvcYUcW7bk&2Z~w{%*dzm9+9!zP-CO-ELzjnQkJ=ApfnMtWekt zWxFJ$|T8^xY85@Yh--LZ3dY*0m;yZYs0wU_l2E2z~Fv}c56E;)AU z&LM@PM<)}7AoHORPSo|Y&8-A!m*nGh5II&IsLvDC%2|9C=oVA_ zkc~BMTO#uZqm3y)DKp*NfTfPP$05Nnx1bhe{Yihw?B}G%lFY}RhAJOgMH?H9#$!~r z@#xS>U-rp-eF=bZJK3J_-Fb#40kyLwVA}bpR9p;r0@84j^SjCU7OthHF!S^`hDTvo zyC(BDCG*QuciNEK+zkL(Qz2vFg_ea62-=UNIckKS5Ku}E<3v(IR|tX3mQ$f} zIS8dpWQ)~1+gMx}-qWo^LbOM?LHo#I4|G{RG*?6S)Ug;_(5mADRn#k!`TZrCznHq{ z<8z4*KV=Gg%7%%WpKQp7JYim_nYqlLgD}YakQ>tlDxGJCsLrjoz ze$5>QF-EGJ%4e24{Wmawrq910O}4jn6sEjGH;|c7ZZu)#xv{n7Wq!-#$U>7)i!d43 zuXmvpUv{~)y*Cw@Ls4b!;b5I*T9==fkwfNlq^^7=em)s%*V3w*j@D5$=7(N9-oC3? za7E@z&ZbB1c!bqPH=XtmPx#Lq{i)7VSYIu&&F=yOA}2z6lLr=WLhI9xxx*Wc5=D{2}{g&t$>ZKZca(Y4MboQMHz9JLOv z$5G!wmhdAcSRGBdJ96X*+=x8~9T((V0qve(2jZYs4*|+?_{m^0SnrSG5vS^hSP0Oj zwY$J!f{g*{L9V(EO?&H|;&7MK9-J!dSyfa3l&Ble4n;VZl5+3}ne1y-z0`{2@_rXZ zxIOIc?XLIZ-KqSbp!Xv>c|@ZaPBx3J=@#4Q0ARu=e4A7~Vcj|yY_9X6T|VH5S-}P5 ziE)V4)u33P0^PxMFh&38yu*>hQ&dcFh>c(uZI~)CDzd&BY@m4_VrzIfJj6G`7&LlQ z>;Om#ilcNE8-R?Rf%RU#(bq9Hl(lGk3!?`+HG9VgeRa~ijltAb(gEsaD$pL}1*l~& zP&s$x$Xp8Rf&&v6?k3}WIElKGb;Le4KlwXp3`b*df$?rM!H6^(Z0+p83?Xf~_4N^|7w?ME1|JlnwB#(b z%VwBPc0eJt3RzDk(*Z-b z4?KW0+34{z1-(67TQ&emhV9Am-Qn>l(2N&xt38i2o=?$>1Z@9qZ# z?MKoaH9}7ayF0tba3U$8D}+F1%c)Sg9E4KIRK@C@-*{idd$$pyJ;Duy$B$X!Wcd)J zL-*9Ngk8Q>H_$>4rCB~Nxf+~pF>QNY@wwnNg}uaviJITsmJjd4%uq98t)9K=WWGFf zVLq@$6nmtUXNNXd{GM5N%1;}FS&KA)*H2iE$c;u?*@t)2>F(~%&MqpRcY4o2%Z;%0 z4P?zu$h(fQPD=(k|7LFw#tJ9oH?xpXQ`B1TLW|)(wBpMym$n>gaLBPXRf3z0H#a8y zj||@<&S0}-^#ai1jj2u*SXEo=TkFUJkFQ%L7XFwvGQMTU?{ZvUvgF&NQ#RO;A8kXv z*oK2kQ+AvBEG9S+GThk6ipgMyZ#=fx;M|xTMX_Po%%mS;wjA>17Uu$@Ln_O`8di{) zR%v5ftaxK=%xxYS^%L&5LGRvV zvUSSQ(NXO6?d|OW_GE1T!%^JM?=nFU*hvCdKWf`j?Zd8Ys@diUavD);FgSkvINXS} zf|g<9QHl^8ZftI9_h}HZJJ{Rc^%i!vb@nAD$)vA)RWjIOtnisF*xa%0;bymgN;2W> zp=wZ7wt=P0R>7E!9P>q2+eMK*w0c!*$aZvlJm^e@M~`fc(xcn*<3W2gn$pSRq`-N% zzqhp)p_GhA8`)&CvoYSHI}CSsGaJ(_#yS9H9C{eT2H~`Wtu2jzYrHj>0HNaeDO(^w zn^v3SqhN7@eU~c0%Jz73dhFQd?s#&Hv%^C^ir8jjd@!0KBvAqeJAiC=cf2|1?+k}n z4Oj*ilsd zR`uPIOfvg&_wIZ9?)$#Yo%PO|$-a;kNJ0o9B7}Vv0s>+P7y*%;7!i?mG9UyD5D^iO zecy}$k)R?XA|Q$6{Z9Av%p~x>_k7>?$E%uO_wDZLs#E7wovJ!j)dLG3W_z(41mCB@ z!h|u0*&5hsa0$~no`#x2KI~AfYVwDCZvWI8uh;FhI_!>`dVjF7nc&s(J$667o~H-C?T1Y zBm!iqcnFv_el>c1bxmF``VDSOPC7BS?`VR=DONj-UEUC-1D&FHEJFGZR0@?_dPsiA_`)2*T!cSkWmnLupw>s~sJ&<_3IWaWolJCo~$3V?7Nt z_ztW_gobuHq6g73YKvCh#0Nw$3p}-{&M#rT9SSlr(b{Zlv9&mxouglynWiugOtMSO zQ_-jO!BtVp=<-=)djfhaM9Z-!d$B5;*sijkn4&TK;Iqd3gU_0wL_LoUSC!$YCZGd_ zG$tAnj|OxZV{lZYNL(7UVm9$iqMQg4DNWSSk*HIR@Z(2+gaoY$Tw!56rpkbNK~z^Y z@`$ini`rkCSa;3njx}3a6tAd6Rb`D=+U9AR5~DL!VYPjS5>>n;lh?v%HG`5M)vBsj zQmf=qE)=hYhI&G8LRE((>d|o3BDODTL|U+_#%8nI)q#T5>Ow28JrhNrkNV^4KE5gV zN;u8D)5<+^PRZ~0c+}sxB1_Atb0|-IKInP0NNOwPBt@e*Ek*5GOXaI?j|NAIH7&}% zYus?yT#_B%&Qxha(}fk`T1>EYNg@XKElN~S_zp+Q=*m=8YX8k6@fE|L78-!XI%61Z z)YQ8yQ4tgJ78fmzA?Bz~F@!gV>^3{vTv4opp;Q)K7MH_nbJ~LF*kAzbLgN7enXzyP z>jJ9$#M`>28fXHv=IE`tpo*=qlByb3+2uroB1HsPWdT_<;|xfx*Orw^~|I$tRitmk>9+)n&s(j^Z1p(R5Lj8Y{(%SZha> zt~KbkwM?~}LjjkiHs~gAYe56=AXR{~#V&f9y)JJRL}0awSk5maYS9ASYV%5UHsq}e zN*5M*R0V4bls=3wE*H3Kby;04cJQPj76tRr{@KuR3X)YzgbYQC-3E(_=n{A@ihk|FBQtzYt z4kzh%^c9uBwQ5)jsf0rar!r_nJ;P=nEE~r+wkJ{18+EmqP-(8kg|Zr`I@S^kHB7}W z{ctSg4Nt2L1ib;fIxqFT*aPoH(R_4?}csz>n^h%YvS> z!{L$~=z3Z05QQ5n4KavsV%m3K8LCrDBU%$JRlD6GNp3gPu1iWzH0C3KPYZ=vmo9M#{60|CCg^`(*%Fij7LZP~+<^p z+8muEheCdTD1U3a5h}Gq8XmVKmF4-=Nc8ALug)s$vEDzZ<(7IsZP*t_1iaH4P`sO;j z#fvUJCY7lVWp~M=jH9uD@*iTs<#y%S9C>=hmhymNMKTUJiYJ0Q2xk0u$u%j7o zSuChzHkZA@j`4vLov(T-XKuGl-3CjQrQU*GipwtB#Coyb-i)HzLe~_DMfSn~<7km> zc1yx*m21q&TFm@lg@Ki#q6okxMW4FuSTUrnOR07s)habsikD(lgSqTcufsCUX^ll> zTYc0^-eCdt5~%{ph0`4{2Rwl)rvo!k?god`585!Ig>ntZ4OseT#}YG`BJ3!hc1trp zu4P9vOCFy8UiMfg4_jTZ$*#eupz5TG4;7TfHr+ z9RPxXEx~7T*!%&zY%%*Vq-&xTDAmCra$~nNMT>SD5ve+#-Q%P}sd0VuJYIzl{H3yL z{79@~ER|B~hIYW@iPc)~h6%x4UF()%?GfGX`bIBIcDQ8^%1ETDF+}%8DF}z5z7n`j z4cq8N|Bu2|OIYMi)X^dbeE5w%5mz^v+NV)hj|mksZIz(iAJx?iS3|5OK;bcYRYVVYU$>TE555N}Dg+CVHP;^CWDKQ}bx3RL>e3QppC|tAzD|HIY;` z*1=GEW(OS!l&S{mC(xWgTURnmD3yFZ0%WOpR8lh`5^b_XB25-gz-*H|h{J7hx_lI? z8(-{=q$nMY7A!&{zWiT0D!0(I?nzGc8AUhxqoO+;LMJj138TB^v7zTIN$7<*9Zh&< z7QIe4YQMFanYAIjqt0n*Mr)#_=yamR_j+k`C1($!C8Pzyxe8lj@x^RQQ_P3;b`}|h z*?|T}vPpJytVTNv3iF6bE}yj;ofGPiO{0|U4yQBZDnenUu%or6DuPYGqnpIQdSZ&k z@Pp49^AA2Noi??J8x@N-VKXkE1BEmu8WN9&NFj0p8i-M*mIql(Z3 zwo?^W%Qcj!;{74=nxfNc25Ed!t*Uw@wMt&=1!$pNFc3K{syd`tN5j>5v3-$ZAcxjK zCi}fQRu)CS--l75>b%})6wHliZ9WXhA`PL{EXuxEjHbm@hYmm(O^)K!C($UWKj>6w zU}`k9kdz`d%G$M-%2(f3LQsNEOmVBtoZXEMvb(Y5X1^orq0W#W_I`AUG}qAJM}G(gM9g?0?~Top zE#!gq-R*?gCJ8p8gXKrl4*}V+WCqr!snkJmVm*)37C;vteK++HWTX1;{OT90c#v`j>jeA%QUN#AJo`)y*2 zgSu~y+N!1@$%!r>O%-9dhh`tkt~6(_fhsgN`5dB6bmA?W4VBE{aW*>5l0~wJjs_UW z>|U>rx(&9ewgww|DITZK;cjp@APg)7=uJB*5}PjoVnvJ3;k0G^c5kgUTj#>MAc_G| zsWw(kv-?GDrAl)RO&3j7W2Ja0R*I8+G9cQjC3`aAb2KCa1f36?-w*CO{Z7A40#BNASuoE7 zDcHQu1bV|RFJy>yLy{N}z3z0z8y2NBDj7OKc0bmzpr1i9gxNJ{6CI(j=(Smb4m;NO zo3ZjE8bQ%?+M1K?P6rXGx*+-@R5&%RkDiIOU*}a;jUS0sjOB7_85un`*{7l(=aDUv zx2DePt3i{Fl^D%_8TMq!D@J@MJ5?~XkXc`*3Xb}s1a45nHlrO;!quQn^b&QbXHClY zWTxR$2h>#0C0Bu4#xTB5{|`<85q7WvmWDT+8>^ z8IxSKwLZs0A9QM-1nqZe9tBbLm}kyqusag7Y4}Q1JXg~&t(MZWh;$@Ssv4-DK&Irb zzHE`u-VqEEAWOx=vS}s6lg+kxqS@vTTOG0=lgD1W%M+wnJ@|TGJV)tJV?o|xnK)@q zEc&k;m0M_9&twT*c$dfKbh*9pC_0gmc+BOJ{01=)P9GVSv7M4 zs*}x()AjwANO|(XkudBnH+KQ#6JjeAbwM@LBD&X~zRC z{hELd6w;VzNIV)6@kA>e6)6&z2CbM)Jd-FVf<)>Gsz;)Z@-fk;iX>=N;0hz#T2+3M zRJ0>bG#Xk+Ek*5GOXaI?DTOj;KE<1wE46CuiI)O!GE}(4<2^ zV!b3yt94AH4uXV*HLx1P>WBVWh=$(&AZchg8>v|`p^hhlmr?9cA9HCmY1v>FCOOF^ zdHt{wI)Z7*)`07f$K{I4aZi8Ml}QWHJTQiPX!a+>?yN=J z*5;su1Vqc7@#mZ@v(Sx#c`6 z8ET#w!ptiA8CY9{y6cF5Wzm=`;IKt7q%+%K`>stSkQu8=bQIzg)R zbG!;4_)BHg_>maJSgE9zkSc@h-5NK)%LB4jk-xY@#q^T_l zy6^GD;ZR?cz>R8H3aNyv^?H2D0;Z-Wdoy+&V=Q0WP^DPW)I$??HrQyZ1a_ccuSm&J z%9?AiOFvi2#&flesZ2a22Yvn~bFN?)3280gV`rt!N6nbvBQDL8phL3eQ4m!RlXt0r zZy?Yb`|7%M32Rd8C_S5tjs!|o1L;%DY?}LqitU6-Pb5NsEENv{!vf^Cr?O`BOU#Z? z%r5#uwT?jia|*YsWJ~t@!Kxszx3W){I%cgPlu6 z^>s_+Wt*ne{L*-(b=HsHg+4_UMi&eoN>uUDBzY~2Rx>CWQmv|bCACUk?E|e3)Ze&*v5uyJ$OR+WY%-b6LeHZ`Qd=psKBErp4_X&Ljbat2rJ}w&@onWX8a`RZ zqNvf(es3(|Z)!rUU@VCCK$X}3$dRPrb_B6zK(tm4tv6ODW0A+J9YC_}}<4x99PWv}R! zv2X|jh?;`egI&W;OhTt%T7|5VSeWXI#v=*`WRXs^x57)R8bRS`6|~dqZEtV&dXsJO zHl*qGdBZUujI;4pkJOCoB$%BK1maz7-ZuJPTQceLJCHo0Xsos!8t_5<=hYbHxdG#2;CKG{`+*+D0nl;WO{Ib`-a z{mp(c;*Ai2PIo-z^*H@v-0O99CgoV8)YTj?n_+yHm8cK_xTF~9quzucYx@*$Z}214 z8Z}mm7qPZboaD-&O7PhCpNmXKx^yb>$MdngDuD-l)YN$V7ed zsMm}3EgQG^K^F4rg2=Gw!3Q57yvfV2uvG&E~4P)Slp_D6)0YoP2i@Bw=Ec?;v#|JL+dF00D zwztjjd5K8XrF@AX6;6%oqi166*Lh;pL{E%jtWr_S$mkK1Cs;5T4NHL-tm^T4R0quX z+mc~aZIs7+0*O@H3Uogd&cj8cYTy<%tSt$nJcX+dha$=XCM=Y()?v~UyMHWG(RI+A z*=xgkJ6vIP8P=Uv+?6(4ox9H6QEAI{G?+`}Tqzij#LV{gF3CeEY55*IlZ~k{?wROQ zKFyP$6G6>u<9#27zm+a4Z8Nt!Ya2_I26JsAr6>95NT5_Th^S<=IAZRi?ta3|S?M$Z zvQ&J~ACL&8Hk-Rtwz-oz$rDaAVC{iB7)epAQLo)us!%!_Ef~1`2P%bX1GWf8s{+AD zFc^isC=@FdLLqOiR160F2~Utj5s!xgeupm@f-((86BxuhnIw%S<8KaNzC{}AX#@h0 zX)*~7orv}O52U3q;j-G=V6oRUxb5w!kQ{JfTn4jA&>i-Ky>U4{x(iKV9x*ABk{d9` z&<0mWDSQ2aKp{E<3adh&RjDpvQwp(NWj!%PWB9>mjrj+kNf_h)z%?tHfDRPWm}p2m z8p@^eARHAb5|;+8m`yyBC?|qMN)t77Bk ztg!eU?0o2s$$l^SfT(G;sCT^D%1z^Up-)kT)shV*s`yNSycR~Q8I%mER#m-{S|txP zt9VTsih%@xt$Qr z?<UP2kz}+d5~g8u z9@QPg2EREN!iv-%SkDvk7SI@Z93E1|p;VSE_HZ&CXt5my3o1$iFJmq?80_oo z4hHi**&d`B3*@`{b?j+R#}E zrC@G|+v2v6D`JVr$xt#xk@&KOP|zKbv%!#eAn(sKdj`!>n++=r{1lZkedSLf?o==x z%7yK9su!EkW$@Oiu~NJgE5%8^rx5lwMEyP8*`TebKtAlP4F=;NatLQE(QfsWbLF~d zBo+##?U85+w55ZgNH|i?+QT7ts18ck5elIygfZv|N>IT$a5t0-<$O`_L>!u)i-yza z1pCsVN+6YrVyuTKqLFYRl1}swWLhK9eykn#iy?m=7BX)rf!8rW^A^3~V5v2n@yW%2 zKP<}FKi|~e9!910i9Lsef<&b13Za~0iXG>>@{3sebzWuF_>maJ*w7Fajxp!(*I_Ou zm5`(9rj~T33EjDL+UCqBu|Oe`4!32IM6I)f?#Gj)-_c)J0$bIv&U^}{d4y|9#FJ^N zGng)OG+@#bv*NaD%;IUz78GIh!4-CyVd>(KZ>UFX@HP1QhI-oinyg)wwyszr_UiQT2w3%AWOwVz#c+ZkLc^Fh`wCe6G-NotdWc_mMT!Jsi5fU8lrS! zS=GyO_&?AkRBo}pDK#w`OU7a;FPisES3BDHwysVr#>oX^B#LY%j;>cY7Wc#ou~ZIy zOgHn4w#p3ENtvwBQjJFA=}bPKD3x-VIT7uydTyU^SxYMf>adWzuaNLZy&0GW!rqu4 z-KbF3pH;e>*ny@n4@^oG{7oLezZb57hO{BH3>~S3Fp3P(a_rhJe4$F)T298ft|5)# z2cI?OAAHsfC8Oq&(a9Qh%0?5=fkGM+4T(oXrK>U*j*1kCOM_O-CZ0)@6G0+P71Se9 zrx+Q>2jQ;X*(7LH;0hxb%vJeWhba`Qs~UMkm;^?IUUsec%}85 zNzZAXs<7H(Ly0QB)Ipxqo~HV!c90|0s;XB~tK?BG6tAhpWQbZRQil{LRJR(=Qtc_b3U@R?k;*xTFLsfEpUc6MrW zblCzu>FEiDXs)0R?MNt;%V{Ce{-AXkw+d*feD!VR4K#ewC?-hNW-gRYl#6MbEvQn2 zRi#)7r#65%hQq}?QKv-JmMv$|9;ovAA30K+6!B&;e-LoZKXE=r8+KPYI=2Ahe6);} z6Oux!a&S1x<+6V$l}r`l;e0`qlflk>YpgXBOXN~Ri9`(6h%#&{F<&f#B{K~z!G^wA z6jLQ$do0)<#Cm5bP=+dw=Ua0$rX)biY|tn~qrPZt=FGupv^=AA2x(&I zk}bre!C+}H>bK*%oK7TqQmNLtL(w7FVC&1}V8RoXBy_th^{x|B@l-rc(*~Fw1KS#u z$dyC5CFYHJrBXBzjK}a+FgSny{AfNV#=JBPOGF*$EJq5(Qalom1RF2~>&?gVvDRqD znQ_Lv346kyi{)YzNvO3w7WF0ktORuGe^ z&V0PJ5Q`-eiSCk^0OK1_k|ppSRVnC+#yqiLYZ=^)mE+}5Dkh5Z{CVY6qL4}^L&f;? zNCA4Hvw$d4i9~y%n4LAJ*p*1lPDf%9cP!EdBY7~E#lSJ<^9MVE@n~0fycF_xL?T%0 zhyC*{y*&w}6mkz89*+`{s%wvzm1V)>d{=%EYroE`tQtQOqZpe%Uu%SwvlMO!haH8i zKUHk87E3LeOr}_Ly4rI2Tp(G9_p~C3dRH&q&*XaG3I#Q=Lk;U{%jcAEE!j-2NL2^Z zWl|F+JuxfpsG;_0)H$MVhu?t<>{q}x)cK+LL+&Q**qb$fs4}a?F)+O{kS^s5PI=~> zK!h-$<$LT*HYQ7JbfRyMYn}wH8gb~TjrS86{?4B((bpVgd@*8Rev6~gLh1PvbR*>2$I+ik@>O(^|^F;E$#} zkZw;ET9e6$mjy=mhO?v{qnS`(w2`J|n~-T+TduRSwY2ykT6!nYQ!llMGNvHiGuyN1 zyA%_|#B?|t&Bj_It)nylD)Ydkd`GwiGX^u@n#gz%OQceL`NM~jiTT(jZK)f;rW9hk z%6ejo#_)sB8uJf6AJ~&sR_2V&UTFe4P)K8l z@k$%ElAhB%RpDfiJd~*7JNwA1`j8Z=>Ph31YE{)Msa5h&vx?W$VlGCll&TI%)T80- z?ZHSB#Xv5VLQgT5&#TtDOs1==qeFcXi?y{)pFTJ^eY(1juc5)`Q~L*M7F#=J&g}2k z!nXGJ_oK;CT&aD=jQ;+ip;*j^Y5oSZBQZ1@T1YKL?OIFat8XhI(D0>Fj;Mnofh%OY zI|>d*RHX^)u>!bIp5Ty3bhM>Gof1{0wNffY$0op3x&60}B!y(KHA+3G9)I@W{6C?ZEH7`A8Hy2@y!;6il3V5%vtB#?$nh4C|#N-bPCHS%bQN9cU{1`1%jt5OB8hkPrc)Teccs$N#g%xcEwa>EaJdQ;1EQh`z$Lug zmTpgXXWdPz_gT?ph&8FPQoIx^#YujCPd3()Pb`?*m2%DRA)k#kplpH2%R$ z^~JKOfx%2?EZmn&WPRZvHn7Z?kwr>z--4qvDI!vJy_s&s6g$p$%7XU@gp&c zvE|FDaEv)Q(UeHI+FQf<4vV9s(^4!JJ33t6O1Z5Z$+c&Ox{ySJcP8C0mTADeE0dX+G?UHPTY>L*OLa8cJL+61pA>fC0%j|0LtP$QKHt}Z9eal? zpFjN&t2Afc^f`sjwhotX;gU#_Fh|Sx*jZT++?AT>do!9RL3bB4KRU*aWtl85Un0}D zdVIlV+nnWAso6&9g|l=dP^ucjs3)}U?zmHzt|F}aMqfVxvQ&H_myZzU%=g9S%=5)6 z(<8}p#VX}G;)S+einTrM3(i?i=@hzD9}Z{#164xhHj&A+*X9f5VzE7%E|xlG&nyMZ87el+FLVo#yHJD*PmS#-2jW~fe4bRqsWAAHuBfAE=vG49m`k=juc(1Ai46Ag(+ z!@N23R>M(|B5`TZirK_7iE<)Hq;0+Gk*K45O!Ny^lAu+AD~vp9waU*XOy}hBQzMTE zlXIkl4|JJCDxb)qcb7}&L+#LLsvobk2?yyp%~KUtTWly%#rMx7uj)fmsH!K8PpVZ_ zubTA$bq`OeOAxvfndg%^th1ATq!lXSYLXWqOy zbLP#XmWEs?gaVqwct>$veG3=Po~?!Lnmv2AHb>XhyKv#GS@Y+o)3BL=!POV9W|+7Q4CYr=nlNKNNK4igT9tz=W40;2tlV1eDP$@= z80n^FR{Hb(?S)czd1jS8ml#AFT&VPS z(-;5^3aME#gccMl28L#Zd>m;-^Z7#$U7XJkF6&>0H1oxLXHOxYO!h6##a*}_#5Bvi za=Cxivivfv}?=3{jv2v`Km&=)Qrl+^BkS%0WEh$ebS}9Zt{ke8eyQdH>xk_Zp4rJc19Mu+t?h+EkGHivvr_Eu$&+@S z-RCW#r`>{*>@Vb7QmJApoXdv`sr~_Qw=hr`NSDEr(CSqKVJmuPm&%8?q0|$>!J|mkgh2l|Y%=z<5 zsZ=2yT6RJqPeiJ2s4&n*g>#(m$}eK=*Ljsy<40l?MjorxGBSGfWiW)7E1mIjk4^09 zv!O}v>G1>xySlp)tv$tg{YauIuz>Ejcg=%CeNh6-YS_SFcb5{**4f_GL)6J~+=tJ^ z&~`+3J#`gEotzKKaTyobWrj^Ct5d6&1ufXIci8G>a}Tr2il6frv&t+vZ%C#4rJ(vd)^YKWtr zctW1g>F2FlM>z4M88Zo$KGnCiwk8ORmIYIbmIPCSa}wFE0lVDVn{MkKqF5{WP-M|+ zN~f(~_3^l3{~+G{UpT4_*+QXGS8nTSZ?7Z^?H#>`%x`Zm%w4n)-K~LK8!brd?`toY z!o~LXMEmr%3Pw=bC`)KV_*Pdd=35e@jWlEBaz}6P;9wWVUA^BZ9Z19c371XSCW9|& zr9+1fb!5t^-V(8}E!~;xEc9plM|YvA%mb6Uhcb3_PL{!0d$DhZ0r%%mw60?P;oyY6m4ks#R65(9Md6npM1}7P|{%5mVJ6 ziJH_eylZ+YgPC5{mCJp7U0oRbDXzVJ)~p#bs68P!efp9mixw?eqD;Br5R0LJw!)yK zxc(W39(u?jYRE#Nf8oMI21Z@q(DLOA7cN_t&tqI(XlbE-!oa}6DQa(OseJWq#S`^jxn+;n=MMx!;Rx2pC6cLhCY#H{gx*?i!=SpWyMku6e_(L>(2SY0X3v>BZ~lUX zhb&sWWa+ZyhaPtLij{2D5vz|}bJW_S*L~xdZytNx`r}VH@uZVaIrX&D&p7j}Z=HS4 zhI7yR_W2iF_??TsyYb>pmt6Y2&ELQ5@+*FD-S7QZ4z?(IorUD>@;>ZKZk#hU&epLhxvW{FZ^$OzhD!B z!V=*!;Wxq)!tZpmbgOh{>o)2(>3*bpMt`{ea{UkW*Xw_*zgzzc{pv*8o` zS9Y6GG?t7Djo&o>)%ay~sd}07TIavSCVZx{SDYy>5|@a}#6!hziT8+)iZ6<9ihmP7 z5x2EynXv#oA*H2~RF>MM9_bwEE|I?OG&jqVzEJ$l_%Y{U<{ z2iz;%M|ywcz0Lci_gU|IzT@6Eyl;NL^pWsU@-ypaj=jQOX>V?Cd2jpPuDv~bx9#1t zcmKXs|L*wr$6xN-ziPl$>wjcOmER@(=kJf>{VCIe!c}e@(}9E0FW^k@HJ+ zKh`t-X8o1=YxG<7cj~w6U(>&D7&bg-_-HieE@P*0g>k*{qiSB=;bhJ&BEv>*NgNR8 zjOP4saf5iT_?Y;L_&f1q@l$E4)F5GBf|B!;R2<9smIHFWY&7R}$hl=K=c|$PTgP(F zm7MdB^q;ZM?0Y$K9@<+#&O7&3_V(?4aqqr;hyA-9Ip07z-~R`c@znlCb~C%$m^TVW zVgE*Sqp1mlbK=vpZ34W*uLlX{dV8(eJ|{L z7JM9apQb;hW{B+>*)zQ7&ONv9xpmLa_S~}Pr+aSRbJLz5@7cO%%bpweT)*eKcivK8 z*nPq7AG|$z_xZd3_4XmVPu+bVW4jBx!*9#KU-$ddcdy-D-gV`!t-CH}Y}d`eNxP2U zb@;CMuEd)+ym{ptAHI3wn}_Z?*}BvEh4t;)hZvi7@wAPGhfFt{t~Xt0y4G}!>1s6% zL?TKW68% z3xrm7C3}xu$S!3Uv+LQ<*iHD)vm2oezs)XZAF;o)OV|(DMVzy@*x%R<>{j*<_A&c} zZDqH!$Jt}-4z`LN!8Wti>`8Vc`we@7J;Q#>o?=h4J!}noo;}N+V|TKn*oW-<>?QUB zdy%bWe`0@O-(~CA(d--So9q~NEZf44W5=`g>;!fqJDHutPGP6A_o0Q(V5hS)*|*qP z>^}A*b`Com+UZ>OXZ8WRpZD-yE^r;!a|7GU_VGU6&j317;W@#Xwbei%QTuiz`8318*~ zUgWFz5qvd2lCR;@cr`zYujMtome=umwwt}p8+ao>ny=$cyqTByH~2C9oBUXQ9AD2{ zxS8F>hPj1X`SJV&ZsT_D;7)!bKZ*T|eZk&gf8ZjQxQn~_$@~<4DnE^%&d=ay^0T1KE{9By#@CJS^KaV}Y{XD>fJjC8*f8^h0udv^<*V!BFO}2}@%6=!z5N4XL)t!lw ze!b}i(~YJr!ba1NOj}JqHr-_U3F^R4O}ChSX1djMo9TAb9i}@?cbSGw+e{;-yG{3) zer~$gbf0Ov>3-q6rUy*FFzqlsXnM%>uxY31m!?NdzcM{)`nBmX({D_Vo1QQ|Y5J|{ zDbv%YXH3tUo-;jfdcpLf=_S+4O8T#uUNyaDdfoJf=}psHrr()%nSO8DZF<}E4!@q? zz;EOm`4+S&Tlr1=C;VpqQ+^8%^Plls`EC4m9^rTJJE3!j`8Gbn@8#!9U^uP`1ci_g79v7ahzW5aAtZ&Akk%)KjF1&_LSBD|{!ZZ%;Zosy!e-(7Xq7J) zt`L48T&YhBKNPMKt`@Elu7&QpUbsQHQTUtgT-~>I7wEpD`>yU1-S>2t>wciST6aBK z?w{y>rn^mdhwd)jHr>y4_v;?i{ZjX9-4nW}g^zU4>t5EquKS(tZQUPrf71O`_cyc# ze-}O${vmuK{8RW;_)Pd*XVrhI|4jIo@P)8f*eCp3_)^%9_L1uZold70KF}HTZ|gtT zf1%%pa9|MW!ENvvLWY>mZ%FB%GvtgWL%~oolnw2M zPD8i;1w)Ua&oE$^ZkS=1r3)M880HxcF)TG4W>{rdV_2*68ICcm*U5&H45t~+GMuf8 z8a5ctH(X@cWZ0}r8m=&0Ww_3;#c-417Q^jmo9{7f*S}=gVR*>!i0&_jM|JeC z8-~XXPa2*wJcG9T1;a~*S9Dp!Ylb%ry9~Px@95vu|4#pV-6Z`xhIb8r)c?Woo?(yS zeZ!y7!}*Kh1H)ep9~%B<_{i{g!^ehy7(Oxl)9|U`Gd%fRqs!m}5h%su68RN!;F=(DfE@QW`V(c;Y8vBg>#sTA?ak_EHIKw#8ILkQOILA2GIL|oW zxB$JdLyU`zi;YW+OO4Bn%Z-N`4>KN){>e(?D&rBx)y5-@Ym7%3*BXyDt}}kacntb% z#~P1A@8x*o3C0tRCmByRo?<-Jc$)Ea;~B;?jb|CZWjxz>j&XzWT;qAhZyV1yUSPb? z_#NX##_t+88ZS0(GG1c5)c8H)X5;sbml-cNUSa%!@k-+ljaM13HeO@AmS4;_@k{un z=xuE_UT3`Cc!Tjq;}+wOj9ZOAHr{0XiScIRPmQ-2e`dVZc$@Kd;~mC3jdvM`joXAn zg~Noyg%!d|VU=)%uv$1$SR))ItQC$H)(PJbjuE~o94j0rtQU?KP7qEMP7+QQP7zKO zP7_WS&JfNN&Jw;QoGqLqY!J>B&J(^ZoG)A;Tqt};xJWlcHxs?u*}6Hpxw?6}`ML$V zg}Os@i*$>1OLR+h%XG_ihw2W~9gg1LO7wk?(5==TsavBvO1D;bv~Hd58@gk3-$ei5 zINf^P@%;PzGTlkKlXa))PSu^JJDqJ~BSL{^*w5L$>{tA9b~n3+J<85wzhvLh|55** zeh>R6|AGE}{hxSV|7ZPQgq^xG*be;%`oHQwWLLAlvPalY__h2x^ftL((ChSiy+Lo( zoAi_Pll4>dRr;y=Y5Hn?jlNc2r?1yH=o|G-`euEL-mZ7(oqAC(>0NraUe@8yu*?Cc`AdWYpglgV|uwKc#zZP!}?!3~58gkVPGDLrrf*P4Cb@r+;1-)hOa~nqTVn>vy9Tzp8&t_ZQs<1k~8KP-k~R2V7#f z)bKsj>t|8BpGNI|9y;h1!>g$6zeP=d5%v3RC5KsEPJfFIeXGv41+ArG0rP^HbSjyM z$FLGO6b$%%UTn~GNwAaQ^PUzn*23ang4N-llTVvkHD&T7lhL5p37kdvu(`5$o5d8y zo?zFK=;*ce!0Tb1xAtS#FsnZxknO-g+w2EjI}W;bj$O|hW{tyra;1kN-p2ag8)gl| zym6ROD!gGPQW~YCclA2C_vm3uW%Y^`c%w(Im4^F1ijR__5WKBwN=2?5IVBol+on|E zXBB=S?D}oIubnGDgudR=Hi1o=7L5$ohld4kFJawq=fx}VL+(M=@uXq=$@cv_H%)xR z@R}NkA(--u4;w4PCM8|z=;6+l!|Y;dTV&_PP1|ePsukg>tL4=zmoFaHtproIF`c(} z?E+jOWnjfxX;_bRm4gj;q~5jCMqE>{6*$U0cIUT#RV)PDf^lA?!qH}P# zbH%W9gfz_NEtc_efeuF&*v2CYRE`l1k4A>(jK4K(@Yc%G#($z8yh8r#2SoAsot2|^ zjNaORGJ4o2_pR8tu}_xzHm=yXa{K-bt7NHG-neaOXyf|c6-af?;$e>a4_s^;?%T9v zxOT-_UIOo_1oX{Y++lOoAs_1H9PN^!NTFb%2qQb-0{#X^Pml#$u-GM4hS|c!OKf1| zV*0%RztuApBoy2NWIW0?;?a?mStLZiM}N9pR5~x--pN)$?!z1AE>^E4w#qibI^$u; zV+B3gsXb|0NKZCsPsUzfAwxL#DC5$m;Yq%+zna?ShTgTMVcz^-JU&u=KHN}Qtg{JJ z;PFea>FC##Flu^vxFw9=f$&C%EioqVXnDo!Qv5gzbh-cmu&Ok z+2Z>p=y2t(KzHdT1(E224N)l{K?j|}+wSjVY=iPtuiQ|skJ!$ca!(C}dz>AyT~P1U zYT*Rj)2sJ7m3vf1qT3d9Zs*6{9f;=WJknyzZRf||tt+`UcVQHWh!Qx?0oDUI0uKYf z2aK!+#}43d;2c1|eKl|FvqsXH(H|ZkBA<14xmm1vkS}9@0|eH| zm)>o$QtC_Z#;1|!JW^Y$ys_l&$y4aY`cd-M6L}Q*p(9P|k5wa$P0F2BTDtSJA4iSg zdrcJhsF7-)@?*`&gwVY3~^Q zVNr9q^6mzO+?97%O(QA~9|@$C5VJ=PS*rfHyV#mbbT#wY$mMKsaW*Wt>v7xwz-r4^ zvsyr4&*8Y6e(}{K>sKoY_l-0(Dv|V!G&hg_05^!H?vXlT?W6cHrCPbuKGI@Vezc8L z;Ri;T@y@E0xaa-V;`=WoL}>>vLXJhmUmVey#jYv5mE*IoOyqf-r{SFCsgXu8-Zd51 zoacC&RpV|3=SG~9JUvn?c0RxhY%?!(#)X2Px7kAdma~{knVkJa$Ror3miW?og=|iu69Hk=^U9evVLU4$d-}e zk>^Hsk4)J)^3e!|?mYA7$dK5>YYq_)5oRwue4$WyI3ynTFu(EPyB-$u_cw`gjIJMQ z5g&Z0S$ychCh>v$=ZW{;9~AGqKP7Gl?#~v*az{#R>u3|(J6vL=!y$He%oDqSPM{;3 z5>x5bVmg}8##_f-e$M5>ahv)2OZhpQZrmhn*uvSWIjeTA(siy}zf!1OCN0~%Ot-di zK)f4>Hr9!eMz0udEQ+DV2J!cSzXgP619Z{_8f(QHqze8Y4?fF@v(#7?Z?w+C2VMI` zo3$)j8&mjydqsQ{x=XCb|K6wr);IFb#;!_^8DSj4Uz~Tq26PUr84tq_0oysBQp0!+ zi?a@P9PC(kv4>$9`y1PjfBri;FV+Y(I^kL2S>1k&p7m3w6%G2LPAGC#oMV9fV?Q6R zA7Vobx`!J$&hxvsO-_Y}hF8z)zTlEe9K%;qySBlxWcwt9K?6C=FI_S`iFB{>lhMNQ z6Hmh5i6;%~dWVg@YgY~%<(?DiqM9zM(b=i)9j>9@HF6IhZtPt<+$i^iPgK^NYX`)k zxD!WR_{0-OL#R*K$y&&XXG$0$l@mWH%8J^h6~)VQAIf zwKyOfYG_8*R%0VZ;m_;O(jTgO0ripX-?RViFHie&^_NR@*D_l4d?oCc_rq%W41TL_ z2S!%pPGKW#CoGo}-MQ=vSi_%!jqPt^x37W?^foq(>mTCRw_p`K3)WA%dlPJ@cVb-k z0Q=Qg=>Of17rC~O^;be8S1I@tn<_jH>)@q``G>3<{;>(KUj)l%5&r+d!9F#p>kyU- zPYK_}xR};F!3k#|cRO`2=zhv(!0&`T5f<~WxN~9Y`WGy+e+1v2;iTX z?73I5pWx~^_8s;;b}ekU2RY+LL!JKP18#1Iz4$`595&0}V)VNOziFcThlq>8$~%Qw znP^xs`o^uWG5>$!^oI#Q2e+;ep4N2>JA`3f97FIO{QD?xU+DB~1^g1wKLdPN!-l|* zo7pXF2kwyDgpxG^>-tT~)$y=%Ujy6nw}o2~{$zHt?mAr(&vvjjwhFf2NqD=+?&UYY zKD-ouJ#@u8{8!*U-qi1a^;~n9k6;slQUsec6L3%W4r2zKjrRhWSuky8Y!c?ZCu5uR z=-wId>;cEkJ${|3%tkJH*aR_ z*t3DHz+=Flu|%;NKt7H;20+;3?g3r{zGQ6uDFEU-{v*at0PQD%o|6&&&p_N~Aigv2Wb7>P_1JgerGj{$Bj9q{{ zU$6$i{R@$w?`&l3qFsz#T#KR&zFg7?YzOe{(vukb-eHVw2A$tW{=WYLW0yfLmx0#H z!Jo^^z$(VBKpw8dyI0->JO>4E2!JqGg@CgFquc2faB{%%5; zpMd6{oWR)4IN!V&cnm=NKSdlreTlJKz{^`e)6a~+3yj@*4FDQ${eZFCtN_xx?J~x0 ze}J(&5ci!CU=Cw?f|tKGGxpf+ z0OI)#?)?Td{04D6-VA^TPk_EBwgRB(iBA}N(hc+hrvWzrPXS2(w@ClDxc}Re0Hpua zS&ThB0)UQZ-eBz6sX!Sx1K0vQ1AM{Qa{*uma5H1iBd;$aj+c;+mxmd91@FH4BxA3& zGxj=YdHqAi-tYlC8G8%7`P~PY-~Al3zm33B0C{-lBF6r3J7e!6FYo4n^MO|w`y>Jf!+`UETLIAX-agDhOTa7uJlF#|_dE(9fA2Rl_NT`f`^$6ydH>5j zjC}z7^&Q4Oe2cM<^uSie{yxCi#{z&f|M3uGpMa)+BE5fp%Gjq?pp&uBfX^oZ$iu(z z>|dbe3#7Mq4X_D7-uL3YeTZit^84=$unM>kGwXfmv&;iP!+!8&|0BSA7&SHm1&kza zU|hHpc#C0%1xNr30E97I%DCx#UeHG&}u05+6_acuz#P37=KF}600-!VKW;}#=Lmx99 zF*6=r%6RM%-~|Bj#}R)V@yFKy*D;>h0ld$63ineHpbXpufKM63lg0bFIl$QrV>)0b zfV>qS0FdXBhw)ZD(8zfCA;#N#81KM)ouI4hJjS~(1dxyJn}K^7uOP0<3IOz1HZb0U zbb7&)-hGVsA@2T7j1M5KK|G&+8skG78J~ghGuJUb3-QlJ9J3!|d~SyEd1nCcF+Lyk z%-_xU!p)2y@;Kv*E(L}eUkv(|fX=1BvZVmxSoUY&3&xjE0k!}Lch~}8HRFeacZY*- zDJUygg1)Az+_FcxW+rjwt(;2^E z3V>&5pZSg8!4}-x@)F}e0=6PQTaoUMw=jMa()md{<2UCR|0(ixO8|JE@t+~STh}vw z+Zx7i$MZYz><+|rXAgk%?z#nd2>6om;cfu&3=cED4d-o}fbEQrfQAw9XXJbU;YZ$Q z{O)=Haoi2s?!Fm#jq!V`ffRsn_u$?=j|2M{|9J#h3Y-nx1N@osdjr560QB8E0=xoz z!T5dP$$g;nKBTvua1rn^Mf71s%!}#NK7=L07<4+>&Z$Z~nCo%ps zol_J;2Hq&zA6C7 z+v^Db`U{M|f$KNkWBkop#^1UOc#ZMjIe}Hc&A=Os|K19`#rW=z8GkzgtOITUkk&gM z0O|eVamN367~}74V0;ha_|q`sf4Pya~7$*v7>rsM#mHRVd+G2l}sRE2=UfXe{f ztNMZoQ*m$VD&QL61tv_J0^r?gxHk>)PkV$3)j%z1sl9;-b!P#$1Ftcm9%1Xt!23*S zcmQ~h35^KXcoh?xjsdm+$V*Fx31-k_*~J8#2UrYj0(JtQFu{Se#7Rt$@XQ7JT{{58 z>2?AOm>?s(2lqXQ&od0X#RM`b}-p+)u9!LPofs259fZa@pOa%(S zY9>VQ1wd=88R%m|{2?YJ=K-K2c>)ts;AL6>@H>Mr+38HkAxs`|6<%XPaXS-Aps@rR z(bfyCpt}{kY(v@@n+hFPCUgb>q}MqBY+yq7df+BtHxnx0TLrXNjsbA50>1Q^0m!l! z@%Dbogg)e(0D;rkyrHFqs;`shPCR~0V6RtoU zSK=O)jtbXSGvWGrCfw*@!j@y0uyqR)e*6j(Zbmqa4~1Ls{w>JMEnhI}81w zue`y8*WPEs>$vxN0yqRX13?;+_P=O*6Zoi#tbMrZ*1flH@7+mvdP~yX*^>_G z?41pA34|pCLG~?x>>$G?A|eVd18$>^I*7|4<0$S7ZYUTr;~=jaDvG!}=-@JrsG|(S zAl-aV)$K%d-uZv;`~Q9)Kb}tYy|?eJI(5#eb55PAOQiSE5AUH(?{xx;fop;7z^g?1 zU_FsO#P^R--;ZVjD~JR=Fa7yzA|197>Ei)J`a~zvUr@ilpsjyF8;-OAsMC=R0NQqB z8?ci|pW^tZhl%t#?)TRqk-n@Y(%+U4>8tHTI*NYzdNq;0X#qNk^lcV!k|5m-z_Y$b ze;&i%e*niH2SCq%q8{+Gq<^8!Cr=RR2h`<ct-L* z;2k2RGyu;_EhEzDBEkp(RuM)Wgh`u$SAi5^>>T@(E$;1j0<0 z5vFY=%(9j+>)nLeULnkJ1@Hi2t}h64?<6ea1HwGV2=iV?SXKeB0>F3QIKuqPfPKI_ zgass^5||EL2|NmXL|D)Q)C04Cn*m%Oasg8Sd=K&O#|g_uTe4B7>?W1 zvxBf)+&>r3%-sgOM_3r`4YvVn06Z)FC1H^~0QZgD2)smC6u*f!0gHhx0P2~S0pNFe zD}cLzHweqeb@|o6EZ{}}G%P^93-H^5MF4(Vfa?lX0LKbf0gnQBW>Fq64cG*{M_6$# za29Y0upRh_u#ya52(Sjgv69aSE5&uCxULk}mEu?_t}DYc%W(fP94mW{FzA04!|!72 zf!)9xb+6;U4|2170Pp!U5oW#RG)JRRHb5c);Rc6IPiE;9Mo{U5UC^ zq7GF-0LQ9uzp9-8+Eb0|s>c8u09;r75n(lWPE9?4cGuv#n&X7k;(IN=*W!EaF~aI< z0noV)d{hUXsrLXwfE56EvHmb&i8lyq!2KGx5Z1I3*bactFy^r4nZOM|4}kl%pzm8i z*A^UWd4aJ01ki!?z#ag!7=ULEz%vKj2OJ@+bufVEx1JzO?*!HYc(#uE4734lz-j=` z9f<4OaDEW#Ip{9J23G>pfGdH=fy0Egy8t}1eHpM7zj4xJw@0s^w}`n zci0ZXhU2%xj}g{U3(Ns-2GH)#Y+w=a6z~;cBO}0K0N>A&fC<1Iz$b)_LjR4v5!eTu zB<$>J0KYvObUPdO8Y2Us{}}v!4C+1x^%|Q+*tiP9#!m;X2GB3#@!JUl0Mvg1uAA@< zVUzHE(j|mVM*F9N##4I;n})hi!?U{3=QF+~?3`5q>UGX%gw2`&93*VE3gF(eza(tV zOkf4@9bxm90P6wVdmhfsuLmvzUL|Y+_-g@vvjERtfO{=0191JqJ%lZifFXpPTR_<2 zT%ZHMa~IhN%;u)9X8JD7sm!c0Y1I;e01jYeq%VjuzxdmtdaP8%| z_Hxwca`eUJDZ;J*ZLa|Bu2=?a0zk7XP}g6oKpB9#{&EBG5by>7nrw&w_|1kDz->Se z@C9KT(Y}pn-$wjqBigs|F5m?K^}W&s;M|pqfUN-9cjYO+IQ}bK4;zU6YAx^p zfM@^eJHoC54H0W#*UbWOuj_EH>u|5@P7roI+IT(cb^T)C1^~~$9`(8b_q(ACm;`J9 z9tS=k?AJ1Y<2QmvHw6J5m;yg{>}LG-X4K{8F#u?NGwSgh2XGc}HL#DcO`yjn z&<=A5Y|~4G-GckxG5}Z&JPMp7Y%|)qc_o0p-TVb%x1z4M4gpZtTWw(<>j{O$({OugzS^(Gm_AA1+6ac8}7Sv_S z0|456Cun#l?sw-Z;0|CffNQsUfEHjeunoYqzsmqR06hD5_W@}CT{w2v1OPO?3+=t@ zTf%;id;T8J`913MdtCSXg8UsCg0DgOq22=uQ-#z&KJud+G{Wd=^20-1n z^#I2RyBEjqMSbp_30wi-zW2TYd`H-QICme;-G_7c;oN;VcOTB(hjaIr0Mmg@0G{~( z`tSkt#{(+?(BOd-VGj-l)&t$Zal#%#ogPAc9ztCnE(aC>puxjO2-}YS-HzvMzXN!O zus`GibAY=6oZo@-m``Cl9s*7f_6Y8U*bjT;al#%YKqs&nc!RLVYyfEY*mb}Qggq_+ z!vK7L{2*aZ1Oe3biCF;Z{{;H>iLVLUnE`-bb}j~P1oi@75%#1DSPQ&I*i*RAQ)thw zWdPc_3-{aY0IC7}Za3|0BwOsR%{7wLM*@tWQ=>YD(5BL7BG62u~uO0w2c%cHgkFXc< z%oi5{Xvd515cbkp0Pg!Tu74SQ_lga;1VEej<2n160k0GGYBhlNzxohiui-hbp+2wS zIj^q(P(Fa)9Y8$~>?Z6DwC4>x^UY3RJAmgL%myAM>@8gP7V7@iM}!?32H-hw`vKhZ z?M;Ne(*oc*?_3M)CG1_a>s`?DU9|DNCII(+AJ=_=-+X}UKE(MCQQr^0BX-(YY6)cb^4+MSPN_g(0_l;CG5)yg#8Wo z|LQElj-p*hw*l~ZD4Y%xQSod1@jR(YGU15t|8T$fsH%**qwYd{P+WC#JzwmGzXSzB zB&-D^bgyzi{CbM+WK5FO@rp)f$}u)m;n`DWyDLEy7qZ@;I{ne(cDve)!Y7a0Y@+bN z6ILq2lgUR!^>^m}OhHGb>1QWLI})tFtw8lyg+3oaywaRxRLRA*Rk^A!mTz8K8ID;G8lz_5L(!OC4Bv>B7`^{3AsRr=^b3ILg$) zKcrMw>g(w=gWa9Fa${;Ly@z8XUA>WROHJYUW$FsfGmBCf_|y_oN-D9N(cksWwoFoz zo#`qmv^8l>nRPieC4+3kGe<=Sl}y&g=Zud}u3o6k$(dWSu-_W(yqq=t&PxO`oOl~R zW1{P%A$iD0AuxRTP3Zsa9o12qn(OaHB*T&E|?sFQ>2Bn$W$}3;Kc^+%;W-E8H24 z@h)r^kObTrzDBT|uO=R^2Jyjw?i%z#oFCulsE9c(cJ19L@7=r6)w0*Ix2lqKQIBeJ z=ezNCp}Lx^EFUjmW1QOhguBL#?_RuvqnH=6vI^a*>h)yNS{$gam&wNuu2}s3+0Ie> zRtAOzHeLGBV=JcqX@GOcy)&bY-Yb8TlBTSgOuJ_;owty#z3EMFY7>@#R+hZf++o2o z1-DkZ?ZWHca8p<6JJv6>uX31{8e?)Qku6`)E!x~Elg~*_oj%2vI>$DfC}iI0znB&( zM~Rg@p`rN+Nk>F5<$nvr3hz@vfShqv(iu7uXx!f>OLoh<(>l>}Vp6 zbX8SuR4QT{FWw8@_Ne)JoWeELS%oy8p7|ZL&ClaRuBom+v&@R0cyRk;J0INssC3(@ zWA`wdG_v==54NH6=MNiv?);&0TVJX6<99#!@bG&d^qh=C(Y%uWMt5(%W6Ld@wroj} zbOHQ7==8_RJ<7M>|9V8-@6gY&P!@2O*h(#B8G(K@8i<#5lntsL(lEYy!qAz~`K2?f z=hn|nTtLomSTkUCo3Bu>E_5XD-o&y}$xM7wZH;0fT7jpqzbBZ8L`!8d$m58WNmyj; zb_WZYMubj|NV>U};0mwxXe+)SjaOB6MWe+kXjj0w zv%a41-y{m4qZdr9swP@rUsuD+CW>!@TR9Z7Z0LuyUNS+m$zQ`U=fzrYRBP@7hXWH^Zs zXV`_+Y?3ULM^_6-jQe-->`2LE>-im@o_$km%ZT9v zT5cPen)4cc6*=3r^sUz{!=GJuQR-+>rgS-8U~ZRs#`b_Fgz3D;{yrTd1q9Y zx+GJ69q-$Wx>^ZJiz~1U>F#}h_;lnQO#_B^^zVOLCu%OWq+U*yzh-HF@xn`K_}+VH z(b~29+AXi8Dsbmz(kk{1>gp!H+C?15u*MLMk?gRZg@O{nhr~ZdWm30pb|pBs>WwH+ z)oHOhG&fc&+tg9=Xw=%`w4n*qi7jg-;1*&V!%7OPLFDIBQ(u8BAXYnJlpBp%`gZF_f%$b%Wv1C`vkuHK> zIFf8Rg6c*wa$so2P!Uz?Ql@Pw6aCjV`Y(_ig{|~oDU;xb>#*)S2fC(CFD#=msg5*C z?PQoVo=leJkd?#&{+}Sn6?C)(tGXo#B!LQb9joS?-$iMDCOww=;>H~`C%Ig@o^!+$ ztmeK>f@Mf@bTe&}*5Mf8$?T8W+zBZjaZ|XQ8=ZS8-f&yZdH4*F$sEHYF1tRmnz<3k57z|SPpIDJ+5-wmS2woMAw~A zdFS(g+yd<_fjF&4aR^!&a+sgT)kaNq23No^5AaIlytMv>0)Yyat$+Rg_-7oaNsiy2 zo4at_*mJ|VS$J9Rxf8~oEB!UKG<6lWYPgc#M9)uMa%yMCC%4`D$%xKTqt5F5;>J7P z7&~(8C=mD)7;H}|hlq__q!%hXRn?4T;ZLCxk;Q=1=t{Fy0XoRgtzhJS1AQcKJ z-O5if8*eeb9}|S)1>M1$&rjf!Iqck^N;kCTXbkd-Ud7U)WD8U==Lyd7(YosT1lXQE zl`Nx<)OWZ3+I&0JHnY#JoOt0$%yMI24uU1d-;yG-Mz0Cx75ZY~ShPi{_ci8sDnoq3 z^T+w7M5pG>_00^e^j#3TD6%du6K@OK9gw8L-BjbN=Jc@Dg;7q6wq}pYma>Dq`q^29 zS=mURraclB{BE&xe(ze&O+KTGP}6E|c8C#ED9E35icp$Aj+xN(QCU8JlYysACf{@oGc;UpS)vHIH3!64rw86W&thWY;3hB3P2s0!a|cB z;<{GzHRH* zG@R`ZdY}wSz-KY|dKRpkxSrHSU_Io650AdXh_|+n#zPb$!YrQaH#P(&k(p-7-Sx-J_JrBs3fNgj1HlVvra%LeeEbm(5;r^3 z4wBGkKlVGA#SK>#4iQ8O%)-8JAJF>r%5z`qboeIJHqYwcvZA!GI93|Fc;wl4SFx(( z4FyATR%{vGF^ayo_^CmI&x#kl>5gT3eX+{&Rij7Eix!0gR_XK~QY&S-DA9mh0!iCEw=?WP9<>EbMOHG`ys(c5u^VX`*XP{+I$RqAgfin~|fI?}|j! zjI6BS?hL76mum6)d2f2XMHoal@echTh7euY1SBU;s-s(NJvIrP)1zl$Xtjy4!zRWK zn;1KA>WFUT^tK7Hv-PUZqu7|ekEk&|V1S-n&>&|&A#0ITSDTTjFW>~^?j|2QddX?} zZ%30*r#@)goVoY3j+{7p?AesuS3MzW4$W)Y{i%28rpXg8A3A3A%a!%TvulT3p-WQ# zezB=_tA9iPa^7*KTsduRdBjszl2sbM zeNR=q=poLdvmsp`@Tf{U^*A5#w-_Tnk=Sm9NgC|-7&gejKbe!27)I1gc|CTQ5LOJ@ z%l$$~Owx^JpJ5kZ6p=m2wQoreoJz4rtB>zeM+18vpVmPr|>&2Uf2nBf~27?(4) zbZkvmVvc35Z*g>H(d_csm2>JBHm=QBReoM&xY%o}GiRu|?8yo#^i-~eM5?M9yd^Pb zwASW=LN<&FsTl?Cp@_oaCpcd&=V(Cu3 zb>O8JEm@TM)64%jf5~MVQh$?I&DpSeUdOyrcZ++_uae8BEpEsx&rSSp{>B}*qz<+X zXt`(Fg)g_L`sNk)9e!)uoV^LP|Msh%O{E~ggHHcNHpAlcK!W$_x?E*x$f^o9los}v z`fGL8k;n^bw~q5oDxA_Vwej4B#f@vEWqFy^A?L2Tx?*)#NCFjh7h9?`NYoXj(O%(2 z!La|t5#Apt82u3~<5Vr=-GDb+nWM|R>%CjOJzm)h<6dg^ib2yW=#RisT7bPm?7as4 z1^ET>V_nJWYHn0usQgiUdj%782IY;hu&~!3_hn^xJrX?dUbP9^FkyTvDq?y=Rr!?q zi*Br}FPfRqZ%$B_WFrO+cx>AId;5ippzPg~c|I^&o z{vJa7iQEOLGLZt^PA5o;IziD)q@PNA4P6?KA$BJCN{nGO7{zMnC*R;7(`n8RzlZTJ zku|C7q=NLFI`r~#8Jn`0YUL)=AbGfHygbD;OI{&cG44*#_)}!rq6T4WtA=+WENVOm z;|qKnJgd*S!Lu^CgM;U_aUX|2@>EZ+pYtLaCI2A52>mljM-l}*4h3uG6crn#NDT_q zgaXe~VNB&=!i#tJ`=M^#l8 zVzIRsX2K6Yyee0pdX^0wCDGLqeKd7`>U^}jhc3cCQ`-dv^Yu*SSyiRaN+zZfY|0fu z3{8sHbm6s7aJPhY%snpd6Dk=$Y?sGyFvr$p_g1b=-zK9FWKOq+2ksk~;}kUHi?ki^&-XMwZvGhzs)k(KhD30%X!ja3D4k~yh6gzP8 zlQ%(wD^BOCFDqXo;@zKY)@N8Hi&?gZq@bldr!ZV!Ii#$ke5`Fs*`mOLoO$8djq7q& zhF6zodUS6v;dxq?oA+p$nRU-N99l(5K|!>;B-C9Y6%>$|;#S;MWgd^eq0DN{^><@2 zVQzPfx7zGTK$q|cAM`l40OCo+K!iDfmUBxBmH|$HVL2Pcgn=NLjDR2Fd~hzae04A^ z;b6K*G(z0?g#C>`Rle~hLMUR_ebH0(<<6n0sewVu&$(^y-)|qbpzhAU6h%{yrCvzA zlUj$(0xQmbZ1lK?$ECKUDzSmxBy2ahHTht}^qS>YFIdt40_m1(Qpv?D8wdUKZ-1j| zL2l)#okKsFhW!z*Po16GpW2z4pXI;KTbY4y&2u zL$Df5u*wfVqDt6}V;2q|)5Dx$s2Juni(;vT2Mbo0HKH-uOiW;P7^3JP?g%7K${x-~UZ z8ZPZY<{-m5Wg=e%x_C(esiB2>M6r2o#kR((4o^qbcxi%nVg8zcr9{M>GTi00xx8+p zoldnmH`kO?tFeByCM`?lM9lJLloO}!9PMPzESF1dc4qPGoWii+F@LGqiGT)PoSVH9J=57)e;X9!^?b9~lbzQS-}mn1zcbCLbsZNLOR`#!)v$656<`=V8I4DUoh*(W z0$L%-o#m$={9pMNzK?ewSeL&{f}hxw!4sL3X`R_T|6S)Q_3RzX=) zR!!Lu_ptaBX^K42GSTf?lDRHZ%FGPb+OUJqvVKy(enqv!l35}8Avb})uNb7Qr~qlH zvo2gWqmD&DTD_K&Fyg%c`~3-vMU8MPM-?`V>fnS|9lQ(qS^mi{hXHz6P+Xl?>pEso znFp_81~vt*mC@{8*cruvtvYABs|dfm9Na>#X?Gn%L#UTJ0LuOyY*-o<}qyTjQY^9 zj3J@JTvNxWVeF-uG$ZY`^>U}u@1ARx|MiK~ z{dDXb-;BFq%d0Dvje2~;Ew@~;Z_NA!(&w+Fo|-naQaR9?n2~z^?T5Y}Tv_(R#>k*@Vra2a) ze!XggTR@l~FC7PPHBUytg30eJ%{13=#CHYz(TrD`s z!c=z-3ucvNCET^;L)~0bCs@w)p6j!h)aj+PwA4n{Wl}?A^SP{+ma3V>9#ZBili*l< zX+%=WB+hF5yI?gGc&rr;2fRbW@WHE`oz;4^l*6MhLY8y9=l>67S@xyoJZ%z{)Ky!<-nWg36NE;_<64IX86h_?0U zE-rVPrdUjjA_0ZRs0`jk;jkE7P&g%MjlyX`YZSf|Yz#Z1_j2Lb@Oz2S< z7N1OGn1$gpO^`)*jr{t) z$5vB~PXv4?G@OX{yLm$yf>`*>=FP>?gQB^N{n*?X8kg+Bf8MhCA8)2vw^}@kwDktI zmF>VTy-+=vP=K+4PazWgCcK5C?W`+Jv96=l$)jl1QAFmkCFW$zA;8V7i^9CGk?u_H z*|SG#+p}l0{JYJYf8gGN`SjnU7tk6n^j^qJ{n*y#Jjdl!$*A!%lgV1k%$b=cH`jA~ z8bfIQ&(Oo7@SSeuBO?(bWBLlA@VH78g>-zB_)I)QNA#rOjHJDMVSS(By9)<|3ySo@ zH!oKHuHIUDVe7PC1Vhf$^Ae?(?>*?YJ>$qLD=t~t$>wh9<@JN2H@?uP14)# zNz$utF_*~WcSiaWrwmV3T9b_V8l^murp66>SU#9Ko&0zr*mTz4 zlbfX{W+fj6r;e2#PR>tLhaCrX6f%A%CWz~(NQ!vOB8G`QhBJwzHrWGtHO4U%jv3ub zVO$E)HtI{~sK)RhvL}T3$Y-dytgz#!ez#A$6;}A44eg`cglF1lw(gr?!PI4gQg2x* zEmdY()=BG>Wfrp#60RI%NQ>UcOXJNGEK{s(m6<9QxEB((#x0fW>iFJu!BJEm% ziTAD*P&JsdML$LF?4zlsA{GO z{Vc0c>Z?rDW(t`KOtq$V(`eH|=^WFA(sGl$N>sJGxqoOyTX;ZKcU$ot_JpP~Dr+j0&^A5-z`Nk5?V{0{B*OI>$oFk8fsd!@ zFH{o|<}yyF#9$x_X;JB;H%t;8CW*{%%|G$fOmKm5Llg{pqmZVzEb(iw(;DcFqx-}d zB=?#sKc{yx7DM#*M;U?(8(Xowi*&(sjHam#&EE4-a>*`eg^9Zq`Q#}iF3pv1hjrVA z45j&)SM(uA>3KbBF)QAn+3THR9`99iYrRr&t=ZxiUY_5(8a5Z_FQJl+NQ{{5{Yo?) zr@j(e0)-EB4`($tKjy^DY-?;?Om@cjY+>3`Dezw4q)tIPrx?7P5q?vr@H(7Aw>mw% z`TQ(Cd%X_lys{q|O?VyYuP6&E1#{-~%<$+L&PUpf6BCeLF`+I$K7RVNiBrG7@s{r< zPMC)G4t>9A^RY&~srlXoi+?wux%K#Kul++Qnw9!!_YS_4&wibHKlLI_7`}x(2po&u7Rev<@+MDH&Ir$loY9VP&biLj*;=5M zr<{&L%BjihueC6<<`$-yJMB0N9o0AJ9O`AMR}6AuKVy)Dkf<|C111m56N7V5NDoV9 z(Np-|XUQ1MW1bU9TX=nnm$OmY)HQ++JXaCEu$X2P-tf;H4S7&||BWbY% z$4-B>u0DQo*WDXe-&|E*BD>CcxPRwa$+wgPT$h`P;AE+2P^mX$ zR&$v1!Vtw2w84NV@KB(blr|U;M~(;vL?O+9q4_P&mM}(_buF^9h1T^kV4YyVGuiD- zHtb_eu%0ks&S1dipEKZRVu{W7np^<}17W+eQ{*+}? zH#;2N+vm?dgIQ;CCQki1b>*Oj$-!_=z{0lvgnM7W#xRCw>`!y=VSRMFvpq+$;0+<= zw2Ab`n@T!7Q|M&R=H33$OUqrvF`!;BRj4KpG=O#f&`3)QIf za(9xa<;G$>oM&_jyyzC;&GBe3R0B6D{5=$TV90kgX4LxvKR*leDE`#xRLLj%==${! zpLN#MZP(AMs4QDHcJKD_S60SK5%}Jr9LTPz-g5rkAJoxp1LsDveaTmI<7F$k4Kflj zoHicAp`H4WxV_X9i#1A(_WJC);tr|Z(qU`Q9$qlGc#1T^GTAxBKR$bU!CZAw=3?(W z|J>|(B{RzxRIbX-UgKCYgcVX;dLXb zA!0|P>X1BG$ors@pDpxm_3iLUKDgadvrj|@eRvkiLVfciDvt9@5t{!%%+ZJ#Jtn#l zqfh^X-iFJ4hMkPB=`?HJlSUvZ#*gr9C>~DYiPU}BAP^V)ud6+CdfS*YLs-d3D3R*# z`pX>0tP|(mecz;+?JFjXTobRTp~3er{__my(2v$!{lJ_Vtvg$8yKbmH?1|8zsuR=Z zUbSrUvXBQ6w*l2vznu8QKdLK^4m{`5g)^1~-LZ`Lo@*vP&^&MmdYQkEONQx*Nc00~ zugI#>Iv)2`OgwJX7aRfG3L_%IX@V1f74${H@QVn+IKbUJ{%_xh`}lme@Qbq3w{x0X z&5|%v zy(`^$`QG-k^nJmilB;HS-B3~(+SfX2=riH=!DqdDC;Q#08S{VD&@x~^OXJmZ*tSzM zZvSXx`(VxsC%_A@f_hl|(mN-iApgh4O-|lSPAwEp>V7Vyh^ui?Ws(XPS3#JLb3`Iom528^r+2~z}g7R9oz}tBAOHL z);!e30u!>_TVC0hMgjx|6vqAP(Y--#*R@h|+wkZ{a0{Ww1P!z$;D8Wor@Yg9j9l zvg8I)@QoUuEG|W82VzW~#G!kZmHJddkm#|{F)Ldj~k!t0HWtcqFGTb@|dvMIx zR?AmQ8}RD8x0SaopDUkh|D^x4<|38RnXp>$5~NJjOEcps9=!IZl;Aa1N|D-ut=I=E z?W(3B2~r_uxCn?EaZWUY6StBbLM{%bgTBNOcCu`d6W^29DXzgU3rePq!ByEayo^r0$s%a)Li7K1Xgk8+F=#%6bQX(U-6Y}N zFA^LbgLKG;?!v+vd}56k=mu8f2`N0ehtH|=sdfGrbc=1&Tzj>>|Ncpl=N%O^2Ac8=7E&$W`+$^RIghYcyzD&E>*o;tdTKH;!R?Ajo zED0@*RvNQlDDY7M>QEM=0=}mww2|CkUTRrq=~Lg(TQ#sGF~uvyF1@-diB(-mtp^N5 zxkoMJ?*5c{U&{OeUdgrrPV{rhUr3j*vB{;se4*7TITaK~dm+{o*=Ewx(O4*g{! zMY>OU20r^U)XE5adqQ0_LPz6$dSYcoUq(rK`as&AJRxbRd+FrVYSSIp|LZb-x7t)U zD-apwReH`)HlMAbNGW5iLBf;@G9)A#!Kxey4$8l!mUnS^WCiypcRiHq=9%T#uN`$; zBStTz1xT@@fwN@ccfBa+(FnJDiUoL;k`x46R6(3sOIYH)k{RC z{V$~ll#%EYl}ytcCm{quk?r0I^E|V`w9lQ)QIH6=oThwcDZA8x)hOuO!bRk|VC(T4S z(I6w{wZ)PeK|pECZ&KfUuVhi|wnLhbk@}dt8u{h*^rqf1(gx;9n-pIfnZ<Jo0({!_TfEOA!P7IIKw=*4FS1;+ZT3VsoLMod3>$p%<`4&(gEm=2 zb57{P`TgsIbwQ_7YOWJG>2>gcQC`{*aAB=Xzy(7;rt^=ODHOo8ywn_kxqwe`bs&RZ z9axqy+>5kiL!85jfG$Zi67S< zr1NCBiS5ppP7K=LI%3x11(R=R^^Gj3?i$y=Hr}s()}rZ@+>8vC1&M(>CRuBrn{nQj z*8VL|4syEX&WBklnBj>pLX9Tlr;}si6to(gtEUFc>ot@=#78gG2EGURq+_*3a zQv|Ozfn{0+nXr)@+COb+XQ+PG7Lv25S2JZ=bQdzTxh28-90kLrLE$~&(uh;M^HF%i zP+oR>IM;8=gr)ifXCb}f^3ftm$<6T5WP(P9$0xm7+PV z#O%z=D=i7C8N8!ZkyWB*^A7kiy+BZ1RZB~LDx7Hw=biqtVR8>zwjbIKL(G2I^da5R z9HG#3f(yAL350Tb^Z;bi<#Ou$8d1e)G|#9V zKU-wZNuZiDN@*~}>xiU?Any)Uh?pw88Fg7nn#{t^6L}9}xdR+nE>JwlYI54u=u6z} zn<7mo(DtP~3_h=?y}ff(Tif%?r#(2x>S^s)yr}BNM;_cfZJTb*9+y|y85lZj*!wr% zbZGeSQMGw*y32i@+z(&c_hDztoAyGp!wD&AhJHN)DG87wT9WPsPq0AJd_Iq#`v<~0?KiVV)XFxwQAw2-Lfz}{M- zYJEaMgG8t}B4#X5|F87|uI9+nl4!^wI>;d|aEK0ahz@crD>fo^M}MOJL~T$PR0a|; zIhtShb4@1_Rope~%!D^~q`O>?l}u=ydV77MrE^gKhi8mi+uq$hWa+?P-+jq79h+7Z zR(dkMox?lc{nbrxj~+g@u$Ue>c}lt>FZk~M=MN0xTCDl>XLvv2T9QkUc$Ds+tXPY~ zK??iB#e{4z z3~k5Fz-*VW@q_gnfvXrd&{YG}TCK&_66#dj zwc)ml>BUuMy@tm53ew>@aLxa{hR$k=N^+4zkXu5<%28vf8P?&~dIKkJxkzXz7o1(b zw640^6pDy`hzRzN2=ys>xpb4{r+TF7R1Rg{)4ZlBfGir0u+u6cXJu(L{w zDo^F5j--wUv-UzFu0&?|ag0t`G?MOHyVa$&Wy%gpH9HTjoDhZ>&$Kx#%s8(9!HGW| zmyQ^I7Nvfl3o6C7;kpF-29h#?46!e=9WktSIk@ykBOYlvZNrbi{!BKcySP$NrF5@{O4uQX? z#DIcAiVuBKGZnO^g4Ps`z!B7Cl(8W3QL8h7m|Sm|o#(6~e-#c8=LMb#1+v#9_$ETb zy1VU%4#{0l{|Ra3+ftM1Zcx(;yXv5x2#Mj)N<&D?WWK?EmN~$qAP~~Z?4GbGZjwws zm3Mo3;zJ}(`tHo)R2PGFR+h=bGB{`R=Apn-$3)?TE;2DPf`7msG@Kk53$T_*Bz2`% z6d92g927jryMdej_~atPdk%&7#Eh7CX(-KFAU#?di(v&bZ)^-2Je`Nc8x0dk5j&>z zPOI?65Il8C5MtN<$HOCwtXXyb5$E``oG;N0^w6QmvoEOXeTuoTq+rP?cJm#el8|n> z2-0n(O=*sEAi!*u@q%V-j-hCX@_zj!uQ2lB!B@sKEea=LmxI?3bKt4+2AA=?Ii#)# zt`yRY?}jv=kuJxjnH$>s4{>4cK{T3&#X@?ZM0$t5Z)Rp1ra4mB-j5EW7t&Q`UIT1j zfRHaAP&vsFZ$75C@=~3(9oZQOyaYu;)Z-!-iYG#)>n@G9%tXx6vJ4HyY$ma5OfV%2 zqGsRfnY^DA!FpVBP+npa#D{!~U4$@d8u=ONkhw^4`iEa+IHeNn~^^n)P5X^VqAs(U&^Z@_lX7M74pC- znI-P|-$~z2L;*)B^rr$C`cDFgP$@_+q_6KO7^g(?L0am##GyF`AE^zn0V-&EWryz1 zjamw_Ol`$kZP8-9B|KZ@a}y!00;02%^Lzz?rD7BvPK>!mF&F|lzDVcl30;NnV(kF9 zt&IN;-wl0*7kj}cL^=@XPp8mmPO&`)j=nB5n$sCaN6HG%(>jg+V)TLWcGQKuGGy3ta@SP~&7$NhW!`*mSy6sbS!38_ zDJTx)nzGu8(Qt)0Ls~!4A^k8aaeAW-m;)4p5p=Nl{w2@$N9h(zLC_&Cb_CIolX{f1 zDPPBdPrKr(mGMaB zx=JHb-DNBXNXDvNyzxi*JdrrWySfF#8w|#pGd!;!2RRW(`td6t^Ss6y<=&ObUbnK= zmg(teZTjU<%DP3d|AyA??v7tioPBG__`7BdTUFk#O4=~;^1_m$p@ZD^OMs-z^eMV*DqIgxkjdON&H=lm5S0Bnq`_5Vo{M z0xk9bqeW8vKe9-S-uXXUBp|skNMMmPB7PSJrLDwAL%r6Yx0PwmR_uyLGF0$!Uv}MB zy*5W*$|;|HHsn=@EzCy?KgL)Ht166qRrt875LrI|Cgf061O7gB^P>Rr;I0VDhxFQj zh|vXviQnv~b=7*Bvqm@uy9RqkWQm%gh8A0hXk2heURvIaoFi2Dq+TOLPUJt3<=BFb zW*}O`FYb*Qap6hFjD!)dF7u~-*uHfheUk*32b@fKK#niItHJJ*y*p|lP$!2|-+uDf z)IVtE$DdHwb6ak_>CQWE`t_YsMe4KEe%c>1BYs+seV9If_suuoedFD?M9efbN3H_R zU1!8h-By)(+8kId9nz6{W^MXbOsHWnqbHLhEVbxF(dDW`s<6(6qYR=ov9A@tBpUqY*PT z!lZp#DZ}WRbP!dpO8w)NvFisR7WClUp0}S{bJghI4C+`o_{O`W&eUI1PZX7;%9Vee z-#R|^dg^b_zB#lZxv?O4NW_CubA-Q(3{&!vUYchxBI_Tl%DS2Zyr zXu{#tgu|%`UIo`f!Zbf0=`@i8r-@Wd(DMsnVrt8xKbn|O_i4^Hh{>f)&=95sh=@$9 ze{(y39$y=C$BaFnj2bxLp{@y+wDGX>GX3VQ>o<a-BBN5+ufmGpL_xL-Xo?dr338a1WS&6* zZuw#C$3Wkb>=MgwIUUm5Z}f2zc7J=v;*Cc;H-UZT-#RQOCxhLjvbKSzK9{?;O&x(u zBD8PN=}+0Ym^Z7Zo71{8yUHCbk#k5iS~wsF2_Dt~#2j&pY#4VHcM^C_QNU^xUehXZ z2Hy`EaT07hkzgf3nO_wY^J75~&qeQ}MKGZZ6&ehlIX~7LCqV|vUi5D7&OV0Ky~dar zYY;4qbm4f=?~NCkutAZjF&_zU;mOiu|G4nz_(ExJcy7Ph@e8F@;VZ&d&Pd>)zP+z_Q_HkC#AaTZa7?hsl9Z!jx?zdULn z@n#V`u1C*ycoV@4uFr#Fwk#-8KZC+<3JQzO*ey|5G4LzI z0w|-w@E?(h*1OjySuVI60mpP+8sd$7UIjjsaNtF1nh1iWcV78fY8u_S>`%JIKd`>? zyaD~@1@gngy9!oTtzUWMnJ&yH4|`-v*ZR(JW%C=?Ufh^yxh2$+_hx2AAS=)7^3~Q3 z8tgOs9fh|qxn)m9{)>%mXN?-to@Mnq!Z)lPc4 zf~iBOYk7dhr1bcM@6CvhhytfN3P?)k{KrHRAU`1_g>BC6RUFk_E!Ze3<}#$Ei-)t2=pYP5 zB+epE&XcvcKMJ!^EXC`~*y5Wg()VtAXx+MQIwiGD^|(6+R!qpW*8L*u56?*F-a!YZ zp1mV^bo{iE{QQvley5w$V?Aa_zJ{g<&}u`Hb`b(@;SI*D@G(7um;8ziaT1^8X;Umd zm|YMeE+|w48+okZ-z>m1r6>&r9UxrVcTFc=_Kt~GYbcmDNP6d*F-5{9iO(U5Os>!_ z5(0bXaC(}xi?s{QE3@RM6zczJg-$?Ip(BHQU=}Qo!jG}3-VyOjzD@@t!qQN$7l5jz zV^Y{M5glX|5f-Z$39U_Xh*6^dFukNBkfw z&SH8yq=$Lt6W**w?nSz+97H~xpZHh_DQ27LeUxuj@}+L(+fnk3DZ!{99twniu5KYq-QW5-id z?@vvCnO4)d-1Won<*rkAvFV&ca}f!71Jtq6<&K5jsBxIT>ScYS!~TsQ1#{*S9gkw^d@wjj90=>e)9(^v75m7a4#m=&8eDud|=Wg?xdOtdZ}^XMXJj=Vsbqb)Mev7BpNE1f5=R#s_i z%quMyT8r_pI1|>rQqK z2P$9zKYxWDLr5^)W0K9vEhpakB3_adtA?Fdct0Wjs#(mEitJ!8Hq#`J1Nspb-7%pV zCA$b5J^vwyoc=G!+e_V$KKg%>#m7nT_>UQSj~jV;q8eg942#*MA|$6^A9tRc_ZaAe zzp#3EUm+ncZl7UaYG>*uu#2(l8&dL)2;#+B#M&-+^Vl#3n_e5+E~j_9K^|U<$j1BG zr-<^197mCi$G-YJ_4m|Y-=bHf)_+dz)N?3x3EwhYDwAqb)9GEw_qZgeu#UN&Fp(GZ z(k!)6ou)2U~ ze4dfn^91tzO;+&L*S(o}?i!4SbwI@^zMxd_tOV4NKg<;nY4} zua?wmwhBSI1X;3+_+TA$z>tu*H4)T2?lP^=-K5pJ+uhj4-Mvto=U$LIzh-srsv2i$ ziEWSFPJ`V6n&_rh5)u2`$HQKw1QG8&lf^PBc-tE+47z^;1Nw*O|&^H=+Gau<#K!h`-|+IP zWn=y@a#3!MAGDygsnzs-5r2*7Hm5R5K{6p)76yNbJ*N3qR1jRA9SzT?hQ5FAy*w)s zR74ITyF*a%vR$MfsMrDmS~wLmYYJ=XY6jO#lgHI8lILYCESg($UdHMoTXu--sjs({ zb;qc^+h&c$vDL9H-y5zpAx_t`6FZcKOfc}UqjP!#1inH*Co{4B6}j3x6Z7Yk#pXa5 z(gkHj!WZag?6AoVS7X=j1U7Wz*6SH`$4t60=GU-0{#$}BigJR6Cp3@lBRoCv|4z`W zdx_7vYy-VU>12083NAuQm#pT5%$~eSxohN=Ii?tl(8rw41TyKq(Ch7vLmGD&KjAz4P|EAcpsuO-|!iJTb#;HJ686h?PGFW*KYij}~gV-$z0s$v2e)I^k zH9r$yMBa|Ezqw)SfC~7ZP8P@)yG0p^1+ew|%>9JYDHWBLu9?+1H9ubuglYq!ro!qr zq{p%Qq~hX|E2gyI1h$v$@6BnBR<~z*kZOD9yk|xXpB4@ThU7*E2eb1qd3|l?f<41J zCr1JSJwJ3-R&J!BvU=l~)2B}#$E^M#Q;SrO{CvE~9Pgm0py!atPFOO_T-1eTVTFVv zArY6AN`*957wf7cb#;WLfB77|V=sx)m_GYC`*ZGt_JeL2dF@&mE7Th0^K;ikOdhW% zvu~>-kJs4h2r1$gyt*PNdCjF#k(qCE)UIKfxwKkZ!_L<(FgsO*lCoD-aiTI)p$ zrg5547wq>^Uwr_2! z&1}oSrLbP!5iTqWeM?JU7n%%5_*y5vpHjXvKb+s1zb^m!e8rhhwG#e7Ey7KBjJ<~9 z!@l>>#m2}blr(>T0N+}rh0hnE({cVNUld}jV&E^z=-qhCcG1_;BxrKd^N9u43s)MQCsw;PC;FHTHkC{|^>Ka*g!UrCwN= z^S{{^NXu2JeD|*l=aiWJXO&E!L}^C&f3Z;zrVpK!IltLuvu(BdMor8p2~Y{Ey~KVw z8if>=2r2v(siNnTOx;RHBZ~oBLKw0~AbaVndrW`C)fm$uvu~44kXgr*xYB1)2$xb) zhwH=&Y}065SDlvat+=aCw=-#UoHB{T%bbi~U56WsJByWC;uj6+UtEP>6zevLj>eYg zGxL|_OZkRQuqPTSHSh}URv`XZP`=^E`u zhEO}f# zs(AKwyU4z_)GAHET5prwS=zshxZc$&_R!Ju^ureNxGxCj=z)8i;g6B_N=PioGCUM?|Ux6|o}LfUL{9y36X?u&iBl z-Cc3{sp~3`!+qZG%!I(AzrFYGOG(ZoXU?4Reed^{=Y1ZQDH}vCG1(Ywe5zEEXEk9x>p z9A7hO@)ELl%g-LaydYNmLR-q_ordpjbe{p=?J-&c29SyBa&MnOMsenbY)eg1>B`AH zlDwK(#u+m(EEyt{ z#=bU@QJ|AiWDgq8y4N&n*!tcSq2_78&muRM>4cog7G~>&U&jj%%R0^YS>3+^9}b%w zRefw-QHDU)i=kDSg=o<%gp1=`urOt%N~yq=mWWo^i4L+~r|&rsiFca0B_*OIWlK)q z=b%m7r?m96eVColK5?xzX(!5ywVjxqxCq()OmvQJ+C0jQMFqe|mwLNt`{- zisSF^v)8~AdhF$Wf~V*REquu9=(XKpgn{z;1HKqpUyF&mMG0PN>@uN05)q!Hvl|to zU_|>Zf_KTlP!<}Q)M=O`hKjHdD&kimQm_xO84!#y1HN`9ScJw`3NZvC)bAiUvJMTI z1eeFnz)8Qk^Tt)TJ^F>z@f5FDf96-f%cGF_sLU{5sIoq&l*z_Hx=s^VDtm!n9=VW` zv9gCou&nqq6F14gT7l0^{@ps}=u=>X;!p>oJxu_FkVbM6cJ<_* zJ?f@CdkA{<+uzbCL~RGCL0T0?u~GOgMj<`x+;pq9fMOq3U1raEG}~uQk2bda8Mxqo*I|AO;bQW555j>$`2|Nd=Hv2Hl3!b}ZFJdWU?qtlq&dz&Cz@ zWRj0xBwjCHA@gh1#Sjh@xY@$@;&k~Rgc#szlsxZVQMB(x;tY+r=U8UDF19Rn=`2OC zNJYd`sOUP;^~_dHwqnAu$F%9A1O_G(!X|58`}7aDZTa}aZQDNFba`jzc*(Ul2pN3%yKnhIA3smMON@tJsT^)S-Yw^PyhYBJ zGvhL}XlQZm?1Y8-~8L1tRTpIkrWjd*I90DpJW5xA# zXgMDAg(C4lMIH??o+_46#fNe`-iV|>K6>GlZQH(n?(9|druwzYisk&d>g`MCi^A)X zz0a)Tl~;eva=unny5Sb}tyN7+U+ib5QFNiYQv3>R)P8O{_YY;DIo()jFX3Cc;eqr( zVOEK=)iJy|)~}?wv~0v6uC-)jY5x(^bkp)j4_#k(hRt=n8XXjQYMw*)&Q^xtvm7=!01fr zMXHS9|0xwnR3d$v?4WJ`bvDO-j*{>ly+T2hyht_mQNE(4hEHWJdMlLJhjKoQ!T%R& zG#I774)h2tEEE3i3xqO!N;EPt;feV@k>TfNPpENM^c?h$$c?u*Exs$SD7vC`;?j6Y z@r>D1M)KUJ<8Gd0ntb=zuDgp03YL#}cGG#2CyZ&X@At@xksHVGx8(G%DQ^MegVmJb zvgAhm6H7*QMoa;xC90aNXh*kqOsN^@&&cs+RK<$UZJG8^KYhj8$qydzXT4Msoieem zCEb_rsn~Swx%brQOIJ@DwzjOgKA8CuS+K=?LM#{m1xpfvs+4H#0(S<6Cdc#z+nL$G zG7AcK%(lKJLo9#&mRnwX?Uq|!7uK=wuf2w&)v0%g#64|=RSKg#VFCxeu)_*+0A!e% zim7bmi(bc`3+=|ZK9hOcAS^KM*{o~-Sa;W z5xeD|4!r&~o%!`AzLtv7LsG+SQ*6=d_Vh_ro$2$cmIrht6y%`$fW9l~FeX)%o_^lU zMz2@`x5nI0H0G0^as<4P)`Tw*FXPLqIFAm%8J(vL#MZ>kPsJW=yqC-xE~?G*=bPw< z`6)h){PPnOlN@${;E0hM#mSm$z)c#9n8R^QU@c?jVXcHoZWgToo&yo5Wd2ZNG{SYK z+78&XPD_)D)$iWRXiGB%`(=(eFOm~_?bY@7dVId&4b|iGbBnqMH9_~`!B5sMy6<`Z zvk%nIbkcT%F%hr4Xw*YnHeGN{WN0vy6DrKRdfKsV0D<_(fo70$4lQY=Ykuf@FeugP#%XQ>>VrdI(vmCQL3({6p z8~sa=q>lOueYV2PLcw6ydxb(@hJQzSd1i(Z;zMOSGQBT^GL2Z3UN8yc9PIKaVnd&-lxjy z2K<%zWBeTaJ$8ZGs{R3gTlr^r=sEJw^n9Uyx#E64ecE}ojWr7=xqO)!{mL(xQ8w1^ zPZw_L^VXxPPTj!Q@z1G4)!*aq5dQg<{7iL|c$+Pp-Ptzl^4y-h8n?r&{?VPD4yEH$ zo=GM5kaA(_=2!YEax0^irGtF^a|cBSm5%j|$sHRVTbg<(GkoWSX5~UVAUA_O4o79U zQh;sT6QFxd8diHE-WLLqGd_~Mg=nrTj`}h!k7SM0KG&L4c=&U+qi&4x`|AUbt3V4G}Q8h5T@O*hY#FO)@VA!N=_1KzLHW5Zy{ z5v#?);v~y#aha&Mpwy)^=)5kM!)-OYU+{`TA*U}4gW1Dqf7DUvdDP(!gI+w|0R|x` zQ83NW!z6ma7Ig*;z;XkN1_e#BYn9OEm6?gFj_77w;yEzxwTu4A^lM zPb)bZG}h&Y`UlCHfYdu*4uc<4HaTn_jt_%xg2GjXeCGiKL}1Fmw5(7H1~0r$W8rET z7Yc?<>gd3tq4Bg}10s6p1wdduTV9G#Qmk@Yt4$`iY^ZjD{>=uZ5Dwl;^I<|$!kal< z2J#LDjAI@liFDvk(hEfD9nuG&tOQvGa_-bd$o_-eMAVy(cd7dKUl*oG2Yaf74Lx&& z1IN2w`j=4B^Hz#1T*wh7^*jI@GvLH(d9JPmkwb)wasN^l3WCAv5gdjLYo@2wHPW-d zv%_SnMXktIh%w~N6*kc{V?vFIv2- z{es&co-$Xxr0V+7fBtt>T#P14dsf%2obuXF!q@7}>iqiZ{d^h-x?hB}$NEI#;bXJZ z&-kX|67_)k?sabr=kHtf-q7O{N=reCi6?SCw@LRNu*m6%rK-8>l)1+8oZM(hqui(m zu*+RnJ~=ctYi#c1!pS9LtIyTXaL-G>$h0(VY3{`(-pa>BG4hzsWj972^Lhi18SS&V zb1cGq-<-0GeM`%(^{pyf=i5-W-M6F6R1humA&gCAMyaSIKoORze6)&okcW4;(Q%l) z!gn%V9@h8BfT>9h6vl!e_i3GkCnIZ=32>tsxKH=q7k^xNuxZ5aZ+QCMfBY6(Z3nJ> z`rYHVG(I%>s+%sIKW@o@jB?>Gm(82F82u{g^$+8x!ku5L|Jb(bu3LH6Ti@`uZL8MZ zp?-VI(xvxpTDz%jNpYw7=DW{Ylo*#-vg}^6L-%l7F?k^{S|;vnrRrCekvOOZ7+(ad04XDN!RCTBNF;eA#4jC8 zABn_^NFfQ&;TJ`PAdy5AIZ2tMx5Z+TO9DLNi;MU#cB|{~*T0n_x_5z(GA7S#I=Juo z|3&2pXSNdfEO7DzP|+)NL`p}@>HlBP3t~rfUQF<)`1spW1)Z1ZQA4}=bNF+1tD)md za9%uzI*gP9yX)X?d5*Kgq@G0y=~`>6^&+bXK3fOzM%is{hyU0C^pQ$-)aBf+A`?yV&?J)xYs$D#p-i zxU>)O!3=%wvl{&jj>zz#W)^qg^(z{t#cVK{0730-lWk1aNq}3>l85kz8QKiw4LMp! zO0Gwe)C5$=;!a)T^2t-rsqOBLUN(O6in8t{%|nLt>-it~=i^UTG}Tv&L~96bcBUJb zhx*(VifODgwtQ*k1?3W~^4Fwk8cs%8=$<;F6e5y>;53NP91szA8H<|jc4Igg^fiZt zct4{l0iR{b*yH{E4nFOrH9CQ{iI|N!%lG($P!iuP=qGDa76_CmSh&>Tr zYY}#J6*@pDT1WUq$b*x7JK{;(F<6$cM`c-*)hgI3J=_n!~(k*fawnymN!*su1b;*zfA3pUSa@EFlS3DUrMCbP$6GD9FuG?>8>hJ>CZ zmLWslXd=G{h|D=3G75*tWf zpH!`f<{8h%6MUGjlFj0?jc9VEIyd92)EQ_H>Sh_V=$1lUJd!wN+A)lXyg+(~R1oAh zeqJnpd^B6PmOhCx(MK5`txhqaqg8AMoR0?nAq}X?Ei_7gnSHX%I(_Bydq04V->jv( z>F^QpXt%2C78i>z93PBB;^@PG0q`N#4{;4j5Vl0|b9Orl%P4`^^nP17jZX?QrRIMc zd?)CgGi@^p#_=ELpX6WwlV#uXc`~gg`Ang?p_OO9^<>%93RC{Xtd(cKxvPF!RGwsV zUbz0)rZ?X;nw~T}E?h6oeDhti0W)N=5E9Qp1f2tYlLZQvV9pjYmKf`elZrZl*)T+C zN*5vjAQo)8V0xmc8IHbVvt6C9aObl?Ifi!*oCLHJOE z4LEvE&IdLZPLi^u;7Gj<@yWRWEsRuR3$-%wob7HUt7znqOSX@1Z##5pBpe!Fde*iA zd+}p!`+mQ@|IW(BVG}0|UoO;4vBzz0?*muOyDC37Q|GQyTuyV`w!<2}Yo~hA_macz z95Jx%tO2yvj1z+5W^h(h4q8$20TPu*>qnc<NJ?*@q_ia(#uIc!xvdai zVL?5U^`>iNDn32E&ISn~VPc<>jo$qC=YMnP?=QUYx2LXHxbVu$7cIO((*6Ae$LqiN z8_%oXJo3Q(k3ID8!!$->So>DseCoLEinp$6Sk;^~(dIy{J3n@gZGKD?(A@BW5(T}k z-;Z>2z*ZF#YBQ_(fFa=$GF_aXzubSbf2&{g3;sNVw+;;wAG5Ut8;}phWGydm@OVRc ztY)3ZhH@TkA=?KV`*xv@n#X+h{p450V*8n2-?4~=g~;wQ9u};uvC0mjKY}NpQr9a; zL8vqgSvoDMNr+i0C4~GWWrgrmy%Bju&l^n_7M8@TYpS;|IPbpt>bmOUl4XrOZ}2y? zURhC5H(}hUA8)_?$e7XN6Y==vZTt=VRrynD`>kC%{lTWDp+lPMADMdIrrNqm`Rb*Q zUJ|{qZTRjvH-0=}OlQZqv0q+4clWSi7sW0i&$Rx;7rJ-gncBFsxG8+LVp;B68e7uX zHRSC^8M-=0o-!jQLaF}rsD~j*+(%QX%PV#U80C+LyG9JapC@=IAvX{KfVq{f$x+oTJO;l ziBBY@6MS`$RDmcK4F#y)k0WU9-Pk}!Bz}*L_moUBW4DBJaHVZcWCIva<^ytp0;7rx)x4(UKr7Tc`4)JnF$`A zA=|zh=ABU1|Hkug{o^@jPvz4$#0qlf_8;|PoxS`|Q?|ZRJ>cbKpMH7#o5t$uYxxQp zFvN3P&zc)6EI0AdnycDGv)40q)bx&tQ$x^#PEz*Fo9iAG%rAav{T1t?1%9!<|9D@T zyE@}VTS4cVnN^yn=tdbhAv*pq={ia7~QrxZ0Nv$51ckljDeQ z#9*&IW3Ay)p97*K1drs3Q1Fd33>S6uR7OFQrWtnJ#mb1z*#v|Zho zJ+bz-dqN?hG!#_Fsx=~bFl*}JD4W9P9=S;eU^WPywbSRvocNRay#@cew;|)wS7u1P{fh~ z6lgdctkRoIbc=n1W-)s^m4Di1MV z0=1|(+?+ck7~qOy7I;+fBunCJ#CU*j%4KxDkNhJ3w;FTtz zfsOYVm|FnQd*3qzQ8zk3=M4yV44k+r$*HK?Wmj58b>vKdCN+u9a)lW(YE52TD&=Ie+03|ja={uzAM&XVb&?!S@0^DdG02>_n zI>$#0R*6^y!;QKCz%Ih`I@j^P&r^3ChUGR2Yjiz7ohyEJH zgx68;utjXuw$VDt0IpAcAT!IN*FTlz_he=H&4ETkW@etY!2?k~y9>P@~GoyHV~9w-SRuTcq@GKSeF9NYyjkxX&~!G&%zC z`3C0Zcg;!*@ww_BhJ@eTT`;}E6r5SqHOJHPPw(6F;p6N;k%P6j?}GC zP*C<_$e)A%Q5rOvSU{pyYubw)))Z{LW z4Ibv&oW5lvUgRx_wG4G_a_+ce=yjD@%i==@Wk~J6{oSxq-{@(V?%v;8nmJ;@%AVuT zy)>*et8L-M`+nb6>>o92Iqn9-DywX+=(rn|fkmK{sgqiSp(5D4b)d4ACg|o%vvn3A zSzzomB+EH0^C->3YOb5d^TIj8Z1G}YsVJdsi zbwynjq*#$Xs{?4CIW;VWhTs|hBw|+vSzjc=Lq?jH)T2KMrXN)GD)nmcasNf?Jhm0j za4vU`~#q~y@O zWx$-mPP>5UM|98fRy1}A2gvG^G^;S7=*e{?Wu;~0Cy+Xk+^UcNTKz5Gq>fevUR8JV zZ7=foj^pp?MhnwF-{<#E;`i)VKTrV^61b~yzVYPw&R5JQPnE0@Riw!1AmBxn+h8%s zGQUDxfh!XEc5V`n(kX8;8?yK;{UmTkLzk-0DQhR&_nc3ja!NWHXN-SR9Ov1F^HkMF zoO=__{cE999k3s{i2VKPzzJ$cH<KbL-rB^ zxB|B=g#ac@Q6dTHrRRZQL%$lMK8?%cb}1RU?D_I?qv)x2I(c7}quL5FQZGVnAW4pZ z?%0};vrumEkjTQ{wak4wdYPfBz_{-4Q;jYI8<0t$VV<6DbBTJ)fKQbma~$RtWO?<> zUq~t_utc+-c3|^jj(#b4tmfn+Z$X2N3czp;nBx!KHlVn0i?yUa;cPHF;P&;(+Q4{f zd3)KJY|qiUM)a$X{rv1tvv1z~(Djr4=Vi&*QzC5ZnJ&C_eBOn(zc6y{yv1E(c3)97 zU^?IQ-W&YDDUFSfGYL>xT2WFx=*UA5F0Cjaj~ys2y#pS*4jm2keC6(mITNacGP06B zSjk+no$i1c-f^9&#?fjT;*ct_X7yIfZScMe$a4>b;W2>z_e-S^xgMFEhBBQg*R5-; ztu2X&O_iqR$`T2zIPT_%qdBs!z?4WH2Q&EyxO%J!J$qBGu9m#_3^GZzemx7Drt4SY z4(hFe0O!ZsG!9R;L4G|pGy!C69Ml-A6N?(HfheO~h_a^{WluB8JUJMAtppJ5N{J68 z*%n~b(U#dkl$gv%CkNg^zI$^caSM^Z1NLey$waOLSr2mI>B;nsLeJ#JrA2o;X;^Uxe8?ot1pXu?^B3p>eCWuYTCC?5iL4)06tMXkX#PKJiQ89oD<0=O*tK zd~m+7B7D7zQg-;xu%SBoDS8RnPthj$wc-b2ln2qfEDJiGn+YwqnToC*uro0UJ3~te ztRMLiG-ar_3iR>#FT8WDdhFZ7^aURr?|DOr)0|%*ekop_Jd1J9aS}elMxW`!Y3O{K zE!4~0{uw)eAry=^Vz~;O5q1!_D(wi6iMN0xy8%XW7lrlNMFDah>vHdz|(!; zN3t`hIm2D>u+PK7gbe#kMQ9f~;p(w;1}d7`MbZ`WBUh=%zM~6+6L>a`c!V9X>N)h) zf32jScKSFR==W!`Wd>=e7io56+fBqx*!3hq{yaI>Hjo(z-vAdV?$!T=dm1NJconTz`~ z)Q)c{=)$bzJB)gHO3&J!wZdY4y*dvG`t`!vo_gVB;pLus{zEla%_oE?>xyNl&8e6q zY1~?@=nS=KHAoEXN?21($%6HVG_rMPEf>)`O3)u-qep5pYW*i#M+s)o7ci~2GtVoa z*lWcW5p_UO!o}f+F#nkzIyJEJ;_b(OxL>qrvMzY%At+sy$=`5sZl_|lg+T=z48sP8 zX*KC@cP7G_)3f>P?A#1f7_UqggTbjQ0=CA*J2{t2ms^!7=&CHHXiEaWCp4*G(EP3>W8*DosQor4?p?q<0u*gpjjw#*tDDQZ3vt!NfXP3<` z5Plcv8HCBQZq<$%T~mKEWb;i&R}~h8f~$Dl`um3d_UsksJhdtqDk{W-;Z|@vh2_$@ zSj%d5GdGOpG_pi+5=9QRH0VA|z;4);v@b*y&-=K8WXqFops+mU_3h-Jn#Aw=z4}-6 zuXy8~IQ|`dk55yN9UopD>SFNeCX?^^i^oqoZNeQXZw)@$@ZUobF5~y=2%0M)jGO0? zxAud%;9jL*h56ESL1*QIgF>Ry>20=h;yPWw3?mFD;Gz;A+LFopGht`HRZdmW)z(91 zfYX_e!i9b7B#mVOeS?zU1atf?s6yfP(={+Zg#dS9^mr4lyb((w(i_Z!r&rqQM~!}s zJ%<={lKT7zNlzJg_=KlncDxY+po-6TtCNYO_^zsPL6c)xbp9A&-XH!T?mylLqT;%z z-!w}*b#TN1mLu)}i?`M9PH{BD^t<3;Cm?@dU?vVbSbQ3**6-S;DheA-OO-^3Q)_ z2Vm*>6W^=f@K^Ey>{+Ua9OL48tC8znG*?88bP<3_R3AK5Evc- zcmv>ddX?85ha3%xf?3^0!7kbi17qDy;S421$jE3d?@qW)xt5qsu-Jw~;i=av(RvPz zb)``b#jL8d!l=cjvpW!PIf79;9uSue|2K)s?E=38W$ZAhQAB~6r-4kHtfm6sI0m=I z7J#Ay%Y`wHTlifV=t*1^ma9G;0C`xt`o8Yl$J=*1ug`n>ddOnI?uQ@U_4LD!J}GQq z3!pF}^@C%Up>yZ93|cUEs5Bt8C90|4KAHNFRQ1{WAAa=d2OsWZf@lYlulVQJZ`^$6 zy3LzaF1c}M@;4tPU(<@N^?x7kjXV!RY2$3xodRkF*6>ZE?(1yeze$w|jD4E<%qc1gq^r9?x(o(@mVum%txQCnt!I8GdVWrPuzp)|}jNT|K zL%qU3)_|ulpOg(}g+8iy{9^7`+-JICLDj@)v659@Ag$J~npHVI78@Lj$3$J{#*O)f zMX|}lH*A8-Tr{}_x1W1jPKXc6RH^Y}tnS6UcJQ4PWoV%T5Y)&LQRF2)*kcpElM@^0 zU0+Fm6_@K~0jC-z$|w}X+@6F5wTT_gD5JYEv8_={YT3i7v(Q=t$xxXQm8nXGv#u7G zM+-_8Pa3@y-VZ*_LfC9s(?LlqkY~Ay$?q80&(hj51yF=8`l851SM6qJSQuJqB1KQ7Y zbc(e2Ac>6RBaZb;3&`0|Tygo6)G~eBq#=VRPZ~00lDy`MosU3Wc;}VFX3lDDoiUTn zGy)Y2ne*UpSaIr50ZwoxlWnig>WQLz1)~TtGm>y|gfV$%Y7Q1o@baVAq=*mN1;OJ= zVia`nfI}H%$%ypOH%JfJ6H=WhnoOW$ zBJz2iXhF)>1Z*Fz6&4d!9zbd9f#NH<{S?PwLzBM4hDIrXjUyTl*j+ZQSYJ`0DOw}( zPeCoK05AiB;zaDaefu0hOp}teQ(v6`0FKmYB2w1zZ4W}EeW?1JaF>v^YTI?9r)LFk z*{1%a;$qmf2tnj&%-lMqu$60-CvlVH`P^*X#oPrt@Q?5&$=r;H%`BVI#ZG+z0AEHM+a7h@6RW^W+>oyR?*WCw&y#EKqgYuex( zU8Z4A0N~QBD!sv9Wf6nHfZI!xImQ3`KPgP+rO&7c$d7sRpJQ*{{MzEKkxyNFCk^R4 zuYP&-+EZ{r0 zDVF}>+4{MGIhhwmWFKxi6<6alZX+cc~mHv||2J;lQf=+)Zh#a-cZpoL^a@=X?{#XR$r>+aI&%=%%u-+d=Rtf_f zCY%1y9ntt8SZ4?|2*Q*jD^H*cE{XgEDn>3y;A?dR{hEn%Lhh$XWqTW$rI32$?*|dA zx?Y%d`9U-`(^>y-y;I?iwXGP(|a-Ulk@+Gd-9K zjRrTBRmO8XMlPc$*2XXDCfG>o<8fRrE zO)1cZ8t{qgS8S3oE-1EQ)2L+aOBjMk3lc(48k6rW9z%kQa ztEw%#eDd}iE?gfkE)v~SAF69>QTNJksNabh~&eTdC9j1L)@r1ql*HP%4X{|%|R{_&o-|AW;W-k{JZ2U#t~qZqjt?QE^(wY4_s z2g<=z=?2#4&)fwdqP!ogQK=GsS9s4LfO7zl;kyhE2=cq~duHJ_d9(R``9ZWE2^sLA z@xVwndr=;QWeRvc!Sm_7EG$&VtK%2)kE){=@;mq)3)Rt|pYn=-6nnr-b3X|+K;FEA zj7TXehT;z1CcmIVo(h#6yWL`o3SID{DbYYpT7(>d#|4KApBjPDqMlZmD2QfNim{$| z4!m75BO@zEyzWJz=3=3?3p!ZEg~$IwpYt3(X9h4VA+G&7&H;Oa91qHkM?gyocv5f= zk4_(ld5>FwHW0KwQS_gawk!>PNl-9E(;R6ISyQowL}P$Z^7oTS90J5+@nDU`r(HW*)WyM#Wz{Q2j=rhCGjGGlvFA^i zxBAiv(??Gja95sFSvPY1jB7r50MN2xB3kjC1BO%qTJ1j$(x%W$<52om%?;;C_4ci3MO$pRDhlLgzqluw%N=U z(QM%F){8Gll3oM>7eYbYtvNZ%a***YvU{UBXjitgESeKG&TgDT%ra&a=c7pOW5_X= zI(F)V$M}O9akB&U4uVN*_k~i}7>SiKrL}%_I0%vZ-9mouc*}tDvyu9d*u6<4?@c-~|K};qwdNM{9MgQudG1Ty zI(M4Q-|fn9dG2-~eCc~jtR9~;nufHt&E_^5%g|HU_tFs@V_aaoSEA8Fn|P@U$7|}E zq^S?LsL!S6c!4HEQ;V}Qf+W;wmpb|0b!r{|${qJY8snk9S9i?(;fK!&fu1M$o7FB{ z5wZySg~*eZ0;kc$Dcm0vb2%+S^UGJ%ojMPiPMHUFja5o_ZF6n?-8D7kak1Q>O^jwt zjXo1&LtdYmp%h}KSJpQtqK%bGT~$?`Jr1DU%5uK^lxd>Pk<=8Syg^6u-rznk23Hsd zg3W7vB-BEw4Uy!XB2RlQlY0j4W7%!Aalb*aALKrw-~$aI-OalhTxPeLtl@tc8Fn7fx4JM6wAn( zxOv%RGl5CD)7)jg93=J(MuBdFkD2R=jjx&4iw#ZD1RLM6+6g)l=nt~$hvNVNqIiTG zjUu5IYay&pd9HjC(~^?5M3m+3xlWkcb00yMUVidPv009&Qy*8qyHP#BSKTPN5KRm? z@rCp+{rkw-BAJ2sSkf@Vc0v3dmmK`LJBEWVU+oh zBTVHL`{XY_IGOEaxlt_}$@06nF(c4ZG60p?VSIavX}uI)JoyS>$NP#o7TEZdc%Ok1 zV(vq_jl8FHf)+vX7+a;n@HVGS$mR-Tf+4#KI=xj0->JZg!AaR9UP~#_eIyyHIf&VH z{&2nyGM%2Ha4c3Q)LCnSRRvIiFb%T|4i3v5R4`c>Z<=JE>>C%HmOEQ_j{98i9N+BV zoWjoHd1cFjk-9Lf=Eb%pg+gJ>X{(Yse^zEZb7iKOnMr4`2qS@vZyxe6Kz`wT`Y>K{ ziAqtTw@IbxnVDuUE^wdX1syUYy&O4Qkfc2C*7V2I1zaT1Zq7tH0x!zpQ0Wlg>2e6| zgiVcdg={VaacK|y3TcU$rt5riKEYMg{t>4K{Kpi34Ff*Gn@q0EXUf)qJ*4KIFJ{?h z{B*&64^HeHymhZqn@C$^1fNKak#dX(2--q6gpG)DYBFFW#4piLNiu_pga8ynBg9`Wj65sd zBjj5pF^IsLy;1W7Lr^71L; z!JF%E`0q7B+(C=0I{W01h-L_k`ELLa9Xnafm(T3h8g5p~Zq>kU)l{Eqw@CS&#e74U z-AcuL(ITBaWw%a0;wNB2O=fD~zH^ECUp?X{KOid%R1dJ87-Q_HFqx#M{h721aa9EC z_FiRBqu5wj6>TgXE{-f56m2avM10+u{|xYffG5Zc>4tnJEnW-(^o$H!R#s-fmm~51 zPVRDU3mm>oR-UJpK^9DLZ0sZK`Z1L`IidmeIIgS+lH;^D9C#|kGl(8ZjYITj(R$v*cj zrIl}xw(=oKb&?#)3>4F>PjBX&waQ;bFz6+6!(YB=lA^nx>xug zf8c+d*(Xg@>ecDeMyv=H_#uC0 z47(KV#OMMo=>OxJve5jdYhb)~arnqtS?* z=+G=~n7^8}6jrCE6E>3Exz!7YpXAPs5qEAZc1G@8Ce71_JGU*FbEMVzBzJBFTej)m zQ8d}iNVk%bzlbw&Kl^s|q@OZR!yY;JC91m3o{Xt83u*?1aDZj4v z3h+D!BA6-kAstaf@Y2R`Wp-Wu@bKX5i-J0X0d+<=dx3OMVPQ1t<1(4`%!TzVC@4zz z^Zugg5Spew?_SN>k5jqj?~q%D7s+uESW5C4Y>YM6<~hwq#xyQ*?GbiVf&`HzTqsG^ zOwKqs5b+O>4e~>=*e}^gWMWPcJ4aPjJk)&#`v`@;h5c{2@3I?*trPxoWaZk$d1W5A zcX;ct_t)I^ZhPyPyaN8v(c`_gQEpQ8{Li?=|DSLFZ}ROx8^Ur-hm8)ScP9obyVq|8 zKY+{|t1X;Cs^&!yrdbkXSVI8Lfr}^%^t4U@#`9B!=@yyhX4|uQ5Yl2)krFM-_(I>7 zLJ|%vo9y*VEUnAUif9I)rvlXmDk61YX{C`wo@XNkZj`ly3DtDNw626RPUJhqdwX(( zhkM2eA06szF7F2-_YJKH;qjA(a^1S@YKSz!`@q$5=tHOgrs@sFHN-xVpI9T-`Ct+= z%76_4NaP5yNC49LlTrp)Y*A5OQ;D^?(Prc7nskycE5j!`A-`5enTEL*SkUZfS(!!5 z$f)$Ack?@T1F)er4`Ab4HovfOP?PbqEb8BE^NVct5*c|D^`D|)I7l}PEyWtoxY(s6 zZDmiANCUTt@@)9V5{u}PV~yMFhG}tJhn&wb8B$7yGvvRP2v0ToB42*W!b2AElvZA$ z`A79TKJ%~hwl+2@$B*uR5N`5sArYZi6G(uzMaOAF{eVPH-SPkFB(Jm8?nqtQ-lM_i1- z;bVJ`)b<8R7jg54_=UQax-GiLbg%19=yW=?eI|6ye9%^dVS_o!NJJ19HCc9W9)q?F zVboGWlzgoOV5#+FsSRYQ9R?n{8~~SKQW4^1FH2@%W1nJWm1Z*tdL<8ay8WP4M|dXn zh1ajJ*~8B=u^~|b{u^qL)T&ZMIgKTfOf5=rV5uNW`s49!FAH}y!(75)_(YzSw28== ziFr6j>d2a|;Tp4Xj_6;&Rk3qKrBf$K(8U33woY+?5`k2?etMdGW>68(sR8MVCOoLn z;cJpC18r~khe`!3fA87AyNuvmNF|*A2xp@6B+r7~DOeo3Q!^Epe!Kx4PpE|8_W$y| zF_!$d_eLW*AcKP05`&+cye~MP{tyamsm&`MUxdjTg9Hv<8Yc zc>>ZtHsVl`rt!%wO^wfF)!N9$mo`4HXQPXhA4ahezXtdQ;)eG5%o^P93`hKgyXF7l zh@S+tBWC!lX(uDV&*Zu695rm)M=S!=G%iX>oKwRiKG=d z<(QwK%P$$dXvg$9`y3P41L3ni$Nc0(XYU<7dCb$X3b^a3JBoftDE0gbR)H+eCCOvf z)+W&kz$u?Ve(w>C{vdaQ;?cWYX?tx}9bb*s0fRlWIg|KSKskZtc&F1G&5);L=sm&| z5{J5(+lr)jpEVX%f=x>%o`YZfE#=9*tr0SDTxMt?5^$Q%J1r405JJ`+B1b!hY$;Y+ zT5Pe}B2P-}Jd}*WfG?4d|qBjQC1f36MeXD4WfXJPqn3zOUj#?k<&VZf+>Mp z*c}jA*pH?2IJ1-D`ZDICYBHrvrIcC?uy|^#Crc2z>NG5Ja}SIuiI##tu9_hn&LCNO zrnC?L=A93mE@NuR^YG$H7}sRpD?akVf6AJI*vu9UoJ`@wDEbC%z4Qp1YY8^WKjDf~ zV~y49flf+|U)U^Y#7aDDRsc8&aF+$K+E9@rM3y|0wVjbVS!QMy)||eovB4nHt7g&X z!#&gWm4i*WF1U-|DQ+59qQu-12#sQUeOUAQ>7F9#4l@t)*4v|>yp?n#A^sZsb@^9X z6Ot0Jx$1{~Bw+cUu}b`c4y-Q977yGd4Rh*)CDgF3f8iGK(@1wm;3INA@Qb-g-JD(y ze~o+pdAwsH?ra+O7Xa7T{vjvrAMRz&PjddBj%xjg>%x=BQGA+C50rTvIpG{7r!xmE z4PgUWOVZ~_YV_dK2&LEiX&=D`uwJi|pM$Gt#MADJS?Xh1%&;tGv)tGEpNd%`%W@Hp z3SAFAY%VhksofbKnH`x`8#FZ32Pxaix3eRg{u2$wI@2^X)Cad}tAIJR8|E|CYjFM3 zdR@DluZG{ld=?|?%hwAY8ZitS$0i^fGqZH$sIY~YgO>{Tgb`>-Ch&8K7swH~ByV6r z(~!{MMoQ<3xDu!xmzs>S*KhQCCmY9kb+PKsV!pVzAhXIV6jT{aUC39&qOn{b1C98+ z_`F`7F^z!(KlxB$ok$k}4lp-vk7vc3<16D5%5}Nq(KE%YT(8|mVG0QTFwE^NzO}Pv zYEZ%?Re>+G^Y%HV$yVwZqwdtuQ4mxm$Q!vA)UMOPbjZ?NUJWDFx23uw&D~3X1;^U~ z4k?#N$+@S-O`AGl%J;Y4`Q3!^Q#;0w|9;*2AL^9)h6m=IyRBbC^N+8;{;w@Wuq)@! zP(OZtxBB7Cc{AtCp2=rF)6ECx%$$2p&y3p-wT&3jHgfn^x2S(nUj>>%w@bU9Kgci0 zAF=9pg4?QOCAbRf)hx&XiLKA%Iwr&5UQWf&lTG~#bAkc%*x}wApnZt19-@c>9O!ello`5`IH+Xjc#PU( z!Fs1N|>EXS;MiW_@zdy5In$*-(*DM+{V!1#* zT4EWJ5qIeGlToD+^-~V%=>VWB+D$Qb^~0^u0wh)`V*q7JBqVbSgyRK%I|Cuj_f`i4uGuN0c~uHD>rF$XR+HcWCK}6R zKyuMA0iIcd7GUFZtt=!-S-ybDL%%gK{svQ+CaQ@QhbY6vCZVY-QyW03vXFMSv{8hT zI)&c=e0muaG?{;i^zBZQcBnts4pNVN{x|hsy!*4VnNfb9x@+^Tw{E3TB0f9hcPrJe z)Iae}Xu% zt~yITPr4ZQHkbQMu`L&PNVVA$5yH=ct`O>dfYe6%p|mV#UzpCLCVxaBe>1(Gs58oz zrJjp31&uQeWH1rQDf!daq4=*&Y-}8dgfP+vvTVtu3E!JF)S6`R6Ak8ojklBayG5`R zS^3TREAu6LKJV!zPNO-G+}h_FP<Nq*8Ja;M3 zju!(xn8uy;9OpUlDRl*SG3@C(P>(+;zVtwXhsc2SZo^);U=xXk%;zvisT*z=96)Ov z)G|0t%6A;@K}^tyygxz!WITF(9|Eg-nE~;N7wwOdDcQLR~)<##bl z57%L+9tQJ4lHQRz!nGxzfTa|~62z2DHto=nLN*|ZP4W?+3cXCBTxt>omQG@(HKCF8 zN^j&8+nyx)1jXa2SZaMD7A?JK+MGMeZT)T?GHObqEjX}X_C%w+|A~GtuIudPa~9r{ z=y#TGCLhl^uWra4aeMvJenTcSH2C|+Iu{(<8I9&I7&M`I(q#p?;6bW8zc3ar557>- zzj1g)y~p6SMy~3}C~)=gV%zBHJ#*wYqD93w%y`|Gl^b}fqP(TPw#J2>LYE1z^qUs) zdsKf`Q9f|N0@rckAM$XF6Ei%tjY?>lp9ia4l^ycO72sZ4XOJsUt_X+S?vMv&LNh?v zcwb8#SPW$D@%kvk3t;0b#Y+wbq`LL%IJZd_wwgR)#1izF8Dd@3CDZh8vxOFVU}RN6 z;Qm93#efoklnjN73kriqt)78yABIDYpohOw>sC&IW3jkaQ~pJ`qvw^qdxZgepAw!q z{HlL!%p9rpPhAiQ*wk)~`P{{U7_^mUK@Tj75coONNWHHzPFTRss!l7rNxU z@YF)M4_lR-tiYgfP;~Y4czkj?7|P7eqSfuzWo^k^$LXAaPXIZLP)TERU<#>tt-}Ke`i{tGtCbJ|Bd3L@t)3-0_iOKi=V!#*VK>=6K$tL7Q(tvQ?M~e4fD^8$&eMHBTL3xoS zUY_B(3s4^S`OB`74|ZSC*BCN?u# z0X*>=#5qC(=8DJ_XbcISQwa=!L*SlZ;1EVqiBqFb5*pNl*S{pc(Q}8efMy(yBL0RQ z1)P|_$c=C+2htF9NJ3#iPsbOeCup@JjJl?wgtY@VfEqYC1DwT z)jnT42ZoGmkd`@M5n=PuYg1B^-#wBlAFi~tP`69y->o$84GlxPt4;ATLzvcs z47fiEbWqC6O7XYCGANo=%h%TSi&oHa(9W2ssA%K7-mupFN=r9AUognCzA%b8P~&8V zyaO&HtKSfQvAK~(K$81_ZUIdA=>Ugb-y4QpYa>FSoT}{M5uL)2fHzI?>ROsJ?5$fE9|(m6sD596j%{oUF`oHPI0n!4j)Y_`QY%9`nchcf9uq!C|0|7J71%qa!4Y;5O zy%T9ZAUfSd21{O|QbbMqe%>6EMd{bmOB+2ugT zHo3lJ%CYecv&*1`#5ziP5#;vKlc0-+!G0u^-prPH2qll*)nB z3f*8Y3x%qy_3l1xTonG;pIEW5^OB414+Z>#<|h`_O{=5w*Q0w z{pWXGdEQj@-(RU`Pl`o`-BTP}yz;XdLhPZ-6PaabB(T`L=OZC0a7ejH1H{LfKNwT& z(k9rjO`<`!Q4r*fSb0E!X-br_{uUZj1m42e@-jEvK{tqTZWSLt-acIP(Km6{@vlW6 zoItP;>=8zbt8vtH#ViOS&lAa&z?2=6x_Nl7Fj_4aSF7dx>vSe3-=pWiKdak>GuR~R zH-h+eW9r@P4CszhS`SB%aTatG$QvOMr5$Uy`YO)g3GR9+Tl^Voa|rD-M!OgX@rVfU z0G%FTw%He42k9noUJrHBJ;4jlJk1NL`t&oZDk#s;<}**LDyl*_zb-h(bHuGUVmdfx z%{oU;K3ZGS{j9@#7hb^F9#Opbfol`GgEoPG7u!aM87=tu%`Uv4?^v{K3GYV8z->fm z3{nVc*M=5?V8jweSB9~Z>fVZcEEt zoEyEQ|HJ3Dw9c8++A^1N`#<6dAJjJ@C!EXt^Y^#}zW|!@KyF%6s5;VQW|%tp4eU1v z`=xR3eNNd}fvZi#diC8;M`a%5?nHK)Rm*|%Y_9>-v&KRS&L|vewZn$fu$~8TI#fF> z(NLMJBFB!(vc?*E^aJkZRP}*Xx~l#Y>&ddl8hZ2tRQc$LMTIBPqm(tSXV;AO6T~F% zakcE4F%GRMMw4D0YIe<9E&n~2cFiTlOshIoFT}A3nW!D>eH<%^MD^i#zSQwj*GuRC zLMCcQd>{FKb{CU^)X8cgj@aIN#19zefOR2jnEX>%RG1DnyI$>xAHZnQ5&NDa>lN?Jl=ueBL!SEFibxsy0 zOXE!oybIDVl57nP&3h8oa;~siDdLNYEZj;rJZm&33pqgU*Vhk-R=JCc_$pE7hL9@3 zUC7tLh6Z=R#+!EH{e|Vo z!pQn-*_NbGK~H0>k*Waf8LAp)>x8B|JvU^y(YGT!d<=J8X@LSJ+@$<6=ASpXxrDA^KrxT+e z9wuD7>w6%R;==6g(3|_8f2m#_Z3v*}v$Uw_+`%&jH1k2;bmO~iEoT+wmmSYm52-); z)As9|iTeUGmF(D`*}R652bhIdI(^&z*Qq2ToZ7f3&o zI1d;ugh%LW&lutTo&ssy>Ld8G`oMt$uuc}-=`6%(bU*pyC2fk+#a) zR_juc;%$r*$NsWh8grDUN_$IX9XswjP&aUZVSOC$J5ZNA zP)8At4n~omG#KRgW-)r{{(+qg=-4??yJ$|sxRSDDepN!cQn`Fa&4gH@GrzJ*)Zq@T z=8oH=rDc`V$KHN>NpZaN%;CUKe}^l#89HDe^Mw})w>+2{?(sp_8DH+yHoBj5%Zg(A z2@2V*&F&m`PVgta+H7rwCTkjrP31qX#O(;x6=uN{=%X|%ir{=aCkJchTV$vTMMM|h zNrtMhfOz&lM~@k%UdopWP$F>Tco%>-6n6!}OhRhRH}i{;6&Tm$0GR zz|2;CGd?lR^5X-4lRQe_Tlkd1M9krjwbwC+0Yn_NR`9icLK|u)ZK$21F+dwCx7_8z zEGEneRZ3(w)Jd}lb012DdP678BCQDu>i9gus{s~r+)iR^A|sr2Y);KL-Ff@1_jQjM zF)XuN+JE%QD?hq+<=Ho2e*b_^E*i#Qm*fbyBg?NS_GkG9$SGGE*am2za{_DMQf?;2 zqiD!}#ftIV$W%+=BSZ~wvd*WGyYkYPiHVr74J*RGxS zTzvMNE3sUJzVs~VBdi(Xs@H}{+RNw5-5IiGRy1T=3rMKJ?{~%vVBrdmGjTXan1P3t zL-Slh>!8bq8OYMd_GA`(QN&S{D(WrD+$uT)Vg6bVuu2sGIrZ#j;g%6rha5afOfYEI zb1JgB*!3rF?|yYWQ(eDpcO1`C$Eur!>+}K9^#M28odQ{$vJt-AU&z+L(4cHqO;#g{ z>*59wG5*5PNeoC52PQmpe?X#BEYM6B7+_~%fLXf0Y~b6U^9#2I4HHaTOuJ04qWvH4 z*HbWp6Y@n2bpwaIA%5J%e%xfGS;F`Jz;REL2`ag#y2dY0$>jmXa`=aOC5^%GYl_}X zNB<@#m`_&8y{w~;WPGw9A|sU4dNMv4cETgzBPO9M<^kst>t;>pygbPwD*h1iRQMVS zdcC<_Zk40t?n14a1cA%ZG`$>>GH%&LK?}=Qx`LZMB7j2>fN6?7Oc0pzWz0Fi;4S70 zdzS0@Vpx2z^a)Ua4gd$i@qjQW@_zeH4TCpxg+XyU5b$w8z#BON{yXuSYi_^o)?1$W z?-SAQZK4HfV^eSFkie;rvvt zjnq>hjJ?xlBZj&Li8$JC7Qk{&r$25+W62Di9|Pb?p!2J0p5kUkldY9(bIS~sKg2FT zr(!T(D&fN@qT<_ybJji4QxI~cbJHat_kSu5iZ-W;L}=e)uPn$$ke+(n-lKcd)5IO{ zsr|w&CmV}g00Agi2YgSr4x$(gfFp3KBcPQrkA-A)_9|ijPf0o!gE#gsJ)UoDa32zmCmUy0 z{4TcQiA9eU@8N5?0L+g;D_;IexdbbobLZbd_Jh`YSe@Qn|7 zPSP~r&r1#*exjo0;us?hDSU|R0rotzKk_^ui^UK0>7{yTHV)ns`D#?E>eEpY@!XYt zNJ`+ZDk3i&5pge$OUx<8fsxzAfHY1Uw>9^LRexB_NScgw=GVX(wFBR@g1(7)4>99o#08y`1)kn09Z?}Tn3w7Ac1k-@3IoEqB|d4N*;5@EyRql0 zP>kQF=Zp#L@ZHCpUg|!XZCQV^d zjpSai0oei!I3R}sukpY@ukp~d9Ov?!wP5w=3@<`!_7foE?Dztx3~{}Ps?YhhNYyYc z9Kt>ES9u)G6hr3bhC!X?P>sC}t}JxDqyXJ%m%a(htxl+V5B_$$DHAqs*|2Lj?zjf- zqs-iaJU}@zX{eBm#39MKi_6V~A&ezd=gWSBmwKIXNDYGzSe$|ZUnLkEWGpgvfqDi??a(AodSgaskQQ?DA zMGC|$vZGlguK~~KnUcWrYI_i_w{C1LtR4!FUuIj$vaE_9l)BH%5zOi`DYCd=Dgqnti z`&LSC3|uws{E9@`_*S|5@DF|M0ewbpy(8L&9RZ@8me1n3Hnz9+iln^HvT>*Y7IJL* zvBuXi3c1xkunL>${MAsSwqzQ?121Nz59xVxU}nkrXZ8Q?@rHTj>TFZa^2-ljpsaiC z_ZAJm{V2;T8;3zt*ds)6@<&oPdEAiaQ;l)C#0Z%cx5u5!WmZ5Gc6+iiD`rVG1tpKE zT#A{7Nuy902U)ahoK?ScuL(=nUm8 zcen~&)vmR!^{%5XgDVg6^-gOT4d&Nb4_XaYlhq{^t44UKTz&6Es;S7B1*MXTyebj#Ns&97xKq zH;ozH+&X5gGzY{z7w!|!>udGMa8M_g38E2rXFHl1HBL^PUNNb1e#Lne#s+fqT{vPV zOc+lyK7M>pSp#%iXp%;9#gHr zP% z3RRT_MeNnObz|Mn*?T{LpYRGd$YkBnDXG%R;{{l^@2nGblC|y;FTn4oJ}GG4LLIJ< z-b6D3yPa9>OrMk!t#*%q5&g5q7E zMf#lR%G;SaIq}r#0cQgT0&y)MCx*CSfnmF@jlPMy6!ewyf;B6=AT!<0?Auok+_ z#H=ES8Yy-FoUnA_gnK_1Ro+ID-se@r#mdZY)()F__*~^i!^Kx(O-zIF($vquy16Vh zUb4IGJ+6tad9J0wb6snK#;DpKhG;{fsXxz3EgjK!*9pS$cIt^$$tQV>{9I~9QKNrKG8P^9zj{BKqr+NcAyQ^1;MHdW7h+GN01&=C`S;ugWc3>1 z;~YCN!()7*Zvh;e#1rufImC)sDuDSl2 zt-t-MFz4k!*IhT=heyjd)WRE34-iM3 zxu`IU#No#U0;OS=Fmha+5)G4*OQcT7f!~Thq?)X3KeC{^qwR;Y@A|CKw&bY?(ytvn{?4tPj+>*uS&cT?-3`9!^Lh~_=o8|@rgIp*SEd*D2hNH zLoePdbtT}K&L+K`XHO+u}K2DWDAUEKoFZ7ylWjq*6#wX;?%9V0U6FJ;EEk+Kgz`dC84voBpxqz9YG;K!CrAwQ zoLRPljShMo8l*OzIWj;3@-;Q_8r{-NLgGX*;zwS*`_boSPCI@0_6@f^*?am~Gj>jy zFubp((l@fIHRf;b_DzkqwOr79+BwGw6~|XUaQ{UUE{ZAT^F}PW;o3#XOQTBZ+2XwV zk;$f5r`wuuDVdO7UDsY<4LZVoHKS(%idTi}abF(N^^C^~GlV6gJ7w1ujn~eU8cM|; zw$pKQnkXa0B)*4(!hB5P8`0y%bIxBRbO!u#8mUI<|`50%x#_s;7hn!h26#HeF289Ug+EQ^&-9D0jM?Dg*QLgTemU z#UijiT@l_8?l0U}C0{)A{CQIA%t^zQy0QJqyXN)RnJbOM>0L%(i7>^iV5?_1e@XX* zct^)s@d=G$vy#ba-hDd z=6h4d-`3$Qxp{m=Z$UnkiVLPSwl9rIlhPyIwf2b@G&FZ)G_}9`YM49hqKZU)UhsZ* zlRuQ-QyOo}_2k$M;=v!hB1zt8@p37^*!BO>YPb`tVY&Jix}2H8J+2qJg zgHOSISlc8bb^LLv91Fuv3q#l_OLxotDp~xt^HY+$tu~_A%lboirTXn=lQEJp6mBvU z>@aM`z@!D;o=7$LW%T-jMBMN1jORddvN@+DUXWAJ5Vu%{EV3ZsFhBzzt`SEvzLua*0H4ZoPQc zy`QHK1GGmwaCmZqx{ej6+y+AF(A$N&j^)Iu)hTN{)(64`-~|e|{=?2=qWF|*mCz9k zpV;xF4B4kj8H5#lI(#s+-;#b@ds8hMZ>E;AW6Pqx$7=%g-dV1j#LOm6{D7!bG;;qR&VD?L!Vu2%f#bI%Pt``mN< zccriY^{+>T`~4~gT( z94drO5)U2!sd2nZGrZk{m|P#;XEffYXPb!Du|T!aPJ>|*j-0}r>YQZG`W$Gz8!7)L zc&QB8A>cdsbxC18wi~)WQ-8^7xb8{DVW;<}3}Z7YVFtf{H>kS!1y(_25*#X%Csr9H zS7lP&4i)dK;&-Y^b-k)N@QWohPi9AAWA(95FJH~xy+ZhC(5IikK0PuxA9IAtDoCu? z7n+vsVfZTsAEublr&L6jCn1t(mXMy{mnmbG=;%!}4!V+~e=?LnwFTlL!p=dzs}X$! z+5Pm{wxJR#yVH!reJ-ys$addIQbM3YS6 z&<9L_4w+NpVwBRG>*_@4-eG7jM-o;p1j6O87uu8d<@U99)nR8hm}W`;==}E>y4fec zU-+*BRqveDMB(w%)!It5r z&bDo_?XtaUGl6xgvvO=K?`~tcG#jg3#rIz3z`MRf;lCA^!Jgc z@Pdb$*^O!T_($3Ax3R}%>@m<-1r@t^J@kq6pMRA-PO!(&A(HNAk1Mj@Cr*nO{tRvz z+wFKgw%C@`Y{^agPvSMX?5kN&l{hrVOXL!zMQoBs$R@OPzfimu;k_F_BwZ+9Ls+Py zs46N&J!;SpQ_Bsb(M@r*I?S+8U1YdWy~to!aYhlc`|>e84G&X1GE#f6yQi411M5hbz?A_$;Wm zu&b=eUN!L=yr^&lrCfj@i!uyXP0EcHVKh_<0oI$uMoBg|n!uM-6Y=jg&83#`tM66my^pe6~hQPc?nu_rzzj#5%3%B6hZu)}FZsyi}AzORl(P$$co@JWZ@llI}0TG2Ui80ShXG;NT6q&%Z25Xdk-q0n+b8%T@g39Jl|mN1#%b3&#Q z-OClZ*)-g=5L_osRxBo?W+3_GV=^mGVHXR6o$Tn-v<_A7N*;9oyeogr!x&<#;+grka1kYMv3-Y-Q4{wcqOM658dSMGR5nju-9*pfB{2R6|T zgT17zGVTO^F&?r^2YZaYh3|qJsNBmQL(Cc1e+8`TA94Lr;m4_((K(~@BtuMYLK*J` zxVQ#SlYhBi@)z3tvQLqHs4B2C;U_yv8JRZzSE*b|1(02p>|u8yBVz!T{sM$UTyIU` z>_Vx~Zje3hLZ?6MU*TWp-{e;vB`ZoKQ1^8u62HHsI9$?OqUWjms8bhObzxf|D1?nB z!$h+MVW>XVa}dEf5>H(9DVwLm{pKni^o&>hS>1-|FHFCwwyt6KxY1+xu7BZ%ePc(B z-`yaMOH^p`heryGNS*y)i8Oa$+dX@_dwR_2Ux+=HAw!3}exEdU;NHbI&}_l#sB74| zzMswBSlFNc3*DyqU1L}z?wUxQxv38($0E_gTNLbihAN9iGBqkfaYa}{(JS72h)`Tf zC@C^>6c<;+bcEPzU`OaRf8=?rAzjYwYtY#aO11PpyZLKiVki$B^x3o7=au-*JocL3 zU_`#qvsg=%kyAyCaX|C7C%+)}T2pNWublZ>l~@CMV3aI<(%y*9>1 zYsUE)?=?^N&NeUhUaVg1U7dGv`I>r@!8%fwyq<7ZBqAretYTvdJJgB|_h~8sK7BYW zXk{UnoiY+Nu9Qo1xdL1=N*9RI&7ZKcwN4{Sif&Z0UG}(Et8p2xR^rmih&h1CG0c&| zO>P-cuub6x6{W^XvFuu~v>K$QW<1^`gbpZ@-ifa*ePs8z2Rr*ed+Urln%h&~ zyLjXFU#FTIzdt$}O|2=eEL*o^cNVEc9*4FDPC-cE!1kiNpn+M>fUs;b=g9nC>Am$VTDCluv_EGMecmG;R~{ zkp)pRXhyKh;KSfa8l=KZ9c!Bko2x3*#A(W6aWVRxK`KTup)}tLgZl~VBrJG=DB%&Y zw-8SdP%u;&qe=j%#Gsl|HYl4EnVov{-ozPXEr~GD8_p;W^DOgnP&+A^lwj^7RN@hV z&_1Vto}fE!2@?t9rA}@O*$BOHqD0LU<*(B7`qPVE6zjxl7{pi7E#mK#>LX9fqj2r* zxb_uTMb*N2smg#_uC}R*3m1o1c@6o&u8^o%E0YdmAZ*J)%k9ZgDHsg6^0Yk75`_1- zKjkHlQI>0?A(xY`z=c2-U-2!LEO)J_Vdo9Y%u-NFX)JtnIx>?7m_8O)sfz-U2FwuE z=>o7+)b<1EaU2j?6_t9R3vz2Pe{#nYlSi~vUAFJFNu!26y)Zpd`t{lGoPNe))nciL zMK3EGHgxuw=*;-!pLEzKT#{-V^YNc=9Jpx3i?dDlT{~v)steM8T_5eKC>`zhDU=DI z-js}M=M|QxysJEDye&GdxptMLEJUl#$aE<4UoNI9X=O;ko#RIIff_L%#CJU-h3roai|IabdAkTx=@n@`x2(CUc3OZXtKf*+6FuW%J7W zm?wsBp;QiwPnPS8V?hT?eLCE9h#@55uc3JE39F~s!J?Z1PC>)+q*lJ%0#J8wW&*xJ z+)>Wr^0?({#O>0HN}F8ri?w;-s)nb2^x$)Kb)mfanqS}d!(B-!k|ap z9C!u~my900JW?J}d?am7?6bn~hDOy*ry7TUVKh5}JTu*!Z(24)* zec;UW*QfQQdWKFA5nK`%K^%$wFAHaHqly{a=5HzAP*3LWa@H=3Api!w%$fbDSyiz0 zPsQEEDqubr6SBrHrd0?(!=lVWjl$OLLI^qgF%&wLn|qCOjIt<6+d_gn6cWsVP-vUc z>^4HQ!Q2`c6<8gR@tjeT4WiZQ%uQN18dMk;bodELBH~}rhbX7@o~|vE&$-~}C_oO0 z%4lN8+{0ygdg?i+9=4_)O?%-Vb|k-m!C{TRt~EmDfgCP794-~shN&bCB7!q)5UqM* zMcjg;NYe6YdewLk!<(Bf?Fx1nERL{I&GUI{U3(<&l=KkL#B;@Shjd5}Ns>V;a({)n z02IK~-!)WjRvQ$HYSv1HGPPM4p-mGf%TrY|W)_~M0YvZ|(4`eKR-+gMi-QE*P=1Lg zF*pJVR5DLNgeM`vt9Z18faaB2tI((|5$0+a;+=8y8c4rhHOM3fy*C@6JZ190A*9yk zA9BGNhpEt1ZITt3FGiYx2a4NBZYT>*5{X^TYX|Vvi2p@YDN=MILnQro>3!)Jo);hd z&F|&TBfnM(#IN94P(NH*>4VpKJM)u3Y@-thkC7$B3^cPn2vuW(YMa`^g=Ei%Q%v;LBv} z^ZDlJ@k{7 z8AU~9KEJyw_D5OzVEu!gRf&}&Hlz<kSmwx*Jj`OQ^hV})%Y!(I2?bYbtDfZy}*rqzpA_ygLlxMz$f4CcF+c*5|% zF2g;nW_qTj!unKkty=5p2z7*qszW?uLu12}a~9;7tuVJPr36YjcB?;xHTgA*=P=+s z#WBc=?eYp+JhP8So$|`^B3lp?0Nw4fvy%mnIT6jSvwkxjEtuEOtSz}({8(lDJLYgf zFV~9-*({W=yH@gVTdLaIyMA(M>ZVcs={J7x^x~qhuOPg9+AUX%Trzy>W%8@NFRfbk z))|u*glf{&O88UJI_t>c)(sO!+}++ecIT7n1yTPPtk*WI*Nw`BP#(TM)nIf4rJy4& zAyMg$7Pd=`?zT{4beONZXrgbv?|h##5Xet@6xkX}T8xU{uYl%-6_w&VS1`iDu*5%QVvh_!~V5~jvT(F|}%xcqJ3tDGR$fKOlo{;$! z8?m6y7~PzhaLzA=4VxfF|8@GEZI?Kg2hN|iraWF+mZ-Y4SNZ|2Pw^GA z#tb&O%k`psbWi$~^zVKv-kLstk612N|1P~MJx`iHaJQ6}4iEfDnmXX5yS*05o-LTA zD6Dj0sL4MZp?{~r?Fw45HU-A-@(Bj2m#W$cVzeVk-xOFBl|*!AEQfVZePi4EAx#pV3%STv$?5 zk}8>9vbIDW1Z2V*XDm1SmmE{fT7n}6ykqV$9nZ{K8jK>SEn|m{cyiUV%eRjhI<~*Q zvf{j+XNR6!SyR(5Za?>t`ld!Ty+FLnP~Y76!&TBl12-?bvN#%2Rb8~%2xFKdT$AZO~NyC84AY<@B zDojh%(NWkDF0LtF-?5>1OYyGazZaW|i#ytDI%aopc!dEfG+Q{=XsYlJRv4rRiBQ9$ zS_48=I>y&r!!g}cT^ywzq3p5E*dUQKic7t|s-kAY@-y#&bI#D=v(FqmYR96d#DZI) zjQZBjwskE{qsJ!56}Hzx>|%6N(o2xxjEjDJMDwpki6A&a%~43Av+ zZeJ;JWu;(#exc7Dgtx+W2 z3KAI$3qWy3S`^8+4CH~sDN2%}6!)Te2o5Q)SH1I$QByWw*O8cUQFTj0ZDZYSS8m;% zK2w>Qw*LK&=O&FECBC$DYum7ztSY!iWcP#6j3XY^rGVK_Mg$*)2uSyr1&?Q zdvu3s$E>=5J@xX=O^RB=7hS~Lu%JjcTLZB9e11{FLc~}kWY`x5J<$}C z^tMj?${hHLhPlmd#Cqla>HDrmWAydn`C`pA@1Nlq{_eUR>BB*shzW7rke;n`FL`gc zV@PSExDnjOdE$MIvG-G_|K;PyZ+K(msF7ob(EPGGC-qb8tR}XzPRzLcUqV2sid*^( z!>Lil4e!)(bU=F-`=Sb&p{G)XTE*<56-9EcAJxQ74P|ATsWFB&Yx#|y<_3)d-h)rU zM=5KjauHr#f&q6;X~0h`O^a324r28r_!kEd4lWEn%=j=br`Wj

    $JjjHQ!e6o;|+ z*cl7Qq*yF~xDqy%2Ml~~FsOh)A>Or;f(24~(fhWex{BdIu(I6HV$*P|+T_Y@ay4f* zO9n;6-f2R3p}jkC#Kc{9q-UfdOe`DG8emkSa^X-TXws&d6?xj9@7OhI z?8sMY8=E&=`RIdJuWxFp7k|HWOLKRN8d>?rNw23r?VGV8R$eae5+$#%2aT?Z=7`C3>(#4o{>^5yXX5Eh}z@Mjz!lnk7-L5&UvN?ij9vPS{NUn(6 zF#+Ta=G$U!IRb;h*D2=QYHqS4sPYU9o@)N8soYU{xiFBAT? zT?oKow3y*X2UtLWB7%e42!+Mq6H>g14C$Q@KI`I9TVb?cy*lQj57cMtvxiV#2zP|76um} zsiz}Mq%c7E2@@J%R2_1^kbyp?%7unX_g|sJsqNnC%ZZ6>&Sna;*01`U%Q}Be%*+ z#hn|Ud1m8^xpOFW1O0-{EIVrvHlVGmK{hr(j!w#z88M>}N}Li((OJvRW9eEBun7zk z#Jmj3+VbFTzRh^bgsng@>@h@co>h1a$?n{#3N^e$s@y<3V z&fSt~>@|tb2D5C<)f$k?cjlViEA_CZA?})2EL4 zOdeAJK9k1*t?gViz;rYNRL#W-;baPk${m0`&y;SmF#Y@?sZD28E~q@OQl4(^^-il@VxH|?RBM=Kp5k3>Ug%X~mEf*MV(v&J z<^dCHQPATK22rykEvgmVwY7p~G%hlk-4N!p2JN0$Wu)3zR%@2Dy26clK*9{|d3kC) zr?Cu0=OAYQtX)_O5lyjHio~ibHQ~krWZ^cupx$T1bb5jY(~bGikU%}=tor5k>(ouE zhRNbhwJ_j54F>P98D^S%ef3}XD1Yu8sN(|$ArOYZ{Po2CfsWQzAPWR1P>Ky`0{ufE zcoq$(0SQiHs)7BIBag3oKUnhe$(^S^*s2WuY{nS^pq%A7HLc-`v~%|JbJEU_rMe+! zRh7+HS62V%)18h2OU0VW&!2f|l`G%WvE$+TvUPoB@uf-WaY+8*uPnsZ-E#Syt?PbT zF)?`dLZh^4V5VvAiptaS9=m+&+;vx9RfaWR2(R7>uRbOGK9v_MDo@rIwI#cYMklAW z&u*UAf=)Pft6J71ZMAe(RKq{CrtpP`Q&LxFe#7jr7=|BHT_ZyOyS$+RIz3jn_huiZ zm2kcs1jglPj(XadjD1^YK|yDmZ1qt?F%+Y-q!MGq;W5XU*_mWAxsXxnuB`=Mi_<@> z)b%tQFfocdX&;ei&lN9u#akbc3kGu?k8vJ56?BM`MOIn3lYB>lo%wyp6ffLaH>7v? z$URs5;N#);-aoGzbyIC^RdZeK_s8G!z58}mC#n~ArY>o27$2|={p8$Lj|>|#=7B5f z&X-p2>v2gs@Md5Jhk;_&$PY8r^^F5v_$J^ni(u&%v&s@DN z&ta<4Ezb+sFD7AoDn3J+s7WXr)dHG~;yZ0R9-kx4)-IJ+Xcro9lkU_$lK!H7rP*Oh zKTi2A&SuGJMf+QTW{PZ-@yCc>aj+Mthb8PtC?M-H_?X$BAqQC;7ARJ0ZXjm7d>jKk zRjDus0*|@1R?rdmOL7cB4k9U#1X{8YfRBaG*upE%g)fAaO?p4d3oi`J`ppZ{9j~F$ z*BqRq=PSSsng6T20AIxf1ayC@{oAkeeAoHjW7q0*I>;ire*&tN&BiXg=;RCc#mzZ! zr`aiB9=_`oK(I3v_>NP+K~Ph&6+!1R@NC{$%`+>;&C> zoXc@+x(2xz{9M|P)e#i_D>YUN`hu}wi+7}Vs&`>fbC}JG{9d=;??oToMM4mcaM0{` zc$J)>)L%_~kOhOgF-IoTSSC#oB=${I;JJd7(&8o380><(1}S)f_f0?pU>L!FFf0*+ zOhS;6LGU=k7Yph0pv#qFTY_&u<`HoN9Ww)i?IIaOyPg%)jo_)QowEPPz~`6l-hKY} z6WpwI)?GZOynMk(=_dn|5iFdgEL+G;*sQCrT2oCP7@}F_4a`qOxaG-uGi2|Pat75K z`WNjEzuD0&H-=?uR?-L(A?=H7*E5LVu&u$CI=;cRKQP#@N2>Fqa&Fj4nY04U*r_BPyT1+rwl`h(UsttL7Y6o_$UHmyWrjpwFJvl9Dy5e3|v6WZfwT zHfOt7N?-GSlutf6xF6-i53^pCm-2R$M>eqLlKXkL<((*$7|)4G8D4 zg*EW9ur!s0rK#|(x7a0FIQGqL>&9G+)}v{U`$|-CBfSr5t7hsKrVH zjzBk$zd6){NzTTqU!~#{Z3#T;-hdZENzhA6S!7fuk!dxH%xc>O$2U;B8UrBe$7=$skRR#=ei|Kgopja3APh zNF%Edl@ZIc0>*%Im{O^JfdhmtvNZ}-a|nMn`2rE7WH&4^H$Yj|z9E@`o3Q{sy21MMgOi09cdbnJlb;+bw7jcQ|7| zFhI*(GC5(!E@$7MJ%GW7e0hiGmxN11bAZ4b?kZuR>jP@+hwwOq;c)3N%tA((owsVn zL~!Jop$i!#=NkZH3LBJj_++fy{mP)3xaoQ}6H;*Z?hNV`rVL5P^xHFGn8YvkmMK^Gfl4j$_zNT!ydRb<2% zt%A}IYyq=q{sc^1xsqSrjNRXoP&mb>H$A<+ z?Cl}r#5PfUeBZyu4t=MjISr&0@gpj1r=zCKg}Hb)Rb-Mi=QMe;b0MlLRyzTcSgl60 zx4|iy|)u^ zGP-!@m-SV%5LVZX>K{(Lz(C(ACbm=XnC}$Ryh1%#LZ?1jJXkk0X>3F@3g9!znDI9M;=ho1VT0#KC>(M-89s-u*?f*ejaEGI8F^|9I(@e|-M( zOaG8QPH#vr7OxlQ4%8rK`l(nUj!2)Kz5y?4L`riXYh{jl#J+qKxZOyj?Vn&`W?!+-G55=d?voP z@!?tHN9fdlmtzsYo^Vbo2`6Hd$hAQ$kX0 zN!1W%S#OzCR%Xf@5)#^yCUd9+1{TN|rYclYD>o#FKArX0K4zy0o;k=)6AXA(3WJy7 zH{sxvS9Udo9DX{S9gHQ95SAyk9VDKvm=hsO_sG_jg z;p0>QoN`xAMMps@Ki|+^P@v^^8r8~9&4_vV;t4`3$aDp;L%ktag~Lda*$&qF(c#ca zs7^)aNeU|)3o3%J;eZ?I?r02%#AEJ7Ys(sRn~s0@o^-WxV3Fk^;8t^d>sa!WnRfyS z5qm)4gflaER+%fDM6qdEl3D(ut7+(Mi_)XSyVjiB(%v$4lsaS0;Xq;WvK*fiErw zt&$PK=3_}CdHldv{nBn~RE^&t3C8pn%5aP*gK=-lfviQBSw#Y)OEx-#h-mb(*=lpr zJb|>vHG9y?M5_VeeuYwW*jHpRh}-yuj!H7d@$nznV9sRPBTy^*4vVz9^8U#F2f*c%J9tt;mxCGt(G2No_-^}%eH)C`U}z|6@Pk< z_%AVjq(?41l%D%Nit$(nGREW`3CjT341U%gTzReNO+A3J!I;zIjFq~JV$HQ9YNymL zHk&Djv5n_2tU-@wo89WR+pWOkwh6Vs<7$z^*v4}hF_(CJ8l$6dP!=PJEQZRn7?A2GRCB;*4MGq z8ZJ3YWUO>Do*yMQaQ=W2c`T=afSlztSi8(`OKK3s|9_v+Q1|?I`hih9My2n5Q+&8~ zY(Z%B#6V9zErNJKG z*rAH}*R)R^IwsH^ShL{4A(N-f3*vr-kA5UCRW1Uv<(kycpyX{VX>7K(CWc!_C1w~W zRWC8luU=z3ui6&2i0z@|b9t}iNyw?!R#ujG)hbX8P8v*kRnbs$RbF#D2&!aDxQHUH zRbGOcqyvzxNr+3bt;1w@z-njFH$~ty)5u0J+sxhHtY1V%d2k-$*hA!dPR>ItJw4TV z&-i7}pJg5T`vn#AqgADqrKM*zT{S;;Zc(D4B2v^_GHY|vI&$;W5w~=AOH&OL7D4UUn7Kkx(KMu2*;ygeNn&gkH4rASzp?mZlGA`Y%&9#W6jwBp?Tg zl?y3-v^PR_%i;C=x0xMov)REmF$2|Cd&MlSUZvye$sCn%^+Lk-bX+|s!BcYKvfs-@ z6?sN%-0an=Ct&EyIEK!X;8-@kR{S{$L(lHROjZ$Q8pMap);lGRZuumA`ONaUY4|F4L zpfeR$dx$wU7;us?1|Nb9fzw=A9+iXP0HIr92BW0H;&+A4akm+A&U_c<+OS+HKU~SP ziO7HLPp^|9ah>n=Hb#oZ*E;KP^f=7^Dpy^VS~D?ufWiXBC>m{d_i&tvGqViUN@Ll&I+6!D(cgQw_KUCMU3J!}_M za#Hl%TQJ9WbMr3Cs<35&wBW6GH%WQv$bozm*uH3pK{l)d^ueSWR z7!&jUA}<@*EwvrFS?L?NRa!cD$6JJzDTkai8c|9`EkjIf1Al7`0;hN^w;f+F#{7M( zbsq9i>k!J5p*J~CmjU$4f&z4JS#*PtSw7UCHlPUXP`~)EvN-&buZiXGM0j5AW^&aAdOW&NJF) zmF=iFx1;~fUtWG$!-R^8=Ef^-9k`=-WW~CT*IriFD~-MF&!fkTtI0`&GFn(9){5rq z-x)VzLU~a9Q@SuzmVQ0`*>mrOoC7{jaPOniUvq-L+xzPe3TUN)CNF==D*k4$mGwP% z-*d3CEW!~01PD~j64Hv6TZwapf>8{X|vn{ zMF)Ctl>-+H=Hr~4VNm95KJrGt_|N|3aILL4k%!UFAv-f0SMw@9 zeL%Q0<-Z^Yu>+zzWEhex!=O@zfqgvvOkpbnpK{PqQpk^zkSz$W&BE&MEpA#J*(3vJ z>GLE*pB^g@&N2`>g`KSj$j9r`!vek9KlPE*MqFE4+t_an`TE9o-`>(MZp#ms#N$^^ z6K_htHhM~VG!}GW7co1e{+!*7>mkNzkW{16B^pf`gU?EJ^pwIa#-OSMkvib;5C-69 z(p}1SDf)^-PU0=pEi|mwpkL@FR87I@ zETNQv9+n_3$zB&F3fM~f#yo)`viY!AzsAgx(=YT$HzHP8W431~Pk@e0!A|fPO-ZvF z0*bIYmr40P394!?Suc=QL8GIs#ByB6&^;kq9i>9E5A=;>4Y6aIoj16)k9dzajdQb^ zDiWUMB@J38KLE8N&RjxYW$c}k`HkO{AW-HEY3bg0LHg?SesSOPm;GQ^TidUqW%0A; zt-EC2va<3Lar$XjmDj~#=F{VX^@(dH)sOQB%;~Fg{J{}q>ER1QRHskR5ZssYPA-^V zfFd-OBTyp&OvJ?~n?Zd2B=q5OXd*sK6*4o<5JCJwvFZ>9`l0)1Kxrh1HL9O(3|B%R+j(WFZ%tZ z^ewUwrHmt^JAzQ4CdeVn-J|^v(2f09Taycx6tFdN^Ro$r;~9ERfpW!ht9M96&D7L} zpV`uic-Zy$y4E>WvG$O)@t0Fp_75F4D*dM~W<1_43TPVY_WtUb+wZ?G;Bm#hFZ()% z4j=jZThbq=cU0%mnmGC=^?lT8Q(obbRAZaBF>kbYSe~L`Hjq(BI>8FgOHxL`76|HX z)L9r;ZCG!RAP&ZC2nTsFmAu0kIw;zx9dIi+>a4U){U@ zrhD((u>M}DD*c!AOJd|uTEQ}E-7iY%UFpyF?%lWN4{yFsShxp!WUIbMZb(%iu-OJp zbIJ$gbWkFo(*e(0F|I~oFSY9ngh+gtCjuz$WpN);0zrW#iv^}jC~(J+B1L^tka=RK z`us>TB4)FPz@m^5fFg(<1JlaLP-~eg1}DybLrOs2+P@?HR5lp-^)Qsu8)h+ns9f$V(&6pONQrsDvw4%xxB!^2 zyc0zWoypEwol03nO>wZi%n9+Y4JDf(mYAV%V!)ef(=(i7TY{coy3!&|c?mz6`s(2# z6S0{^XM}!3uMX2rM-+9h!)*W#$hy4gCBNi76(PGA#JbSYKQB$l29r zQ)Gq}JDzGtB@4TAH$1{CNI`~I>Bf=g(+S(S0k$zBJoc1>SwzhHu5Dx*VYgrnVd9)* z4N0&j6@hIO$YKUM{eBq~K!>}_szf3}ewS?WgJ_Q*{zzZJE2F-R0FORqf;z#V$;mQf ztb@EMk7nM)nElxGJf&k=!7CpS8Yf6?wDky!epj_v)*RGQ2qAG+@_Zo%U!|Bi)e2~JYFYqu z3zx*!T&??NIA{l*!7rzL%y0-v2YT2^reF-+0u1fEco0Wz#@V7n2LJIowl8$QOV>c) z$@+hTE}fdTVOYtJ=PT1!fNK3M$kXmYr}q_?4L-fU36nb6YvCS?fnqR8dBKA*WXpMYb@jfbKxKcrsP4=JJC zQ7+m{)Z|J(q%5raE*^6@%97C*sne%AlguXVu|Zy4$H0C76B+JD7VY_lS=D{rE7LK! zac}j1^W;g+frI4!h)Q}`VCEOIStJaK0tBpGMvA1Eb#R5@DJ-lKJ|+mJThfUS%^0(`rn*VG zTxSZQe#lmc+i`&ctf{>qbi+NBTtjSO1_vX*eSA_fmR&I!PV6dY2 zDc(ngI@fXii_4F4kk3guR-wX^)Hg*B1Ll)9Zc9DwV=*0UL%+7|O z`50h+B4)=yMIE!FJx;(KGA_h;99-}wA4=c%v-EugE9!v6P`MxL<94hMvvxL6x(O*C zltvn%M`~1a1(tkATN>IE>^xu^v?htTmpl-_;K)-f^yNyadX+MMKV^I}ARM?%X2_&U z+jnrCRPio4eb@=5zKq{G8^2ZN=~@-%3Xo)l0xOj!Wsn4}N&ofVmb}&BOP+z!NhHTU z22bJof5vmT;!1pqWm1P>pY#r5!RqCE^N$%_=Ge zX}UNGxmQUr_@CS06Ma5=w6l=PH}X4k>1m@umPKQjjF%n9ZjefboP;hS-aeQL6U-<| zn&0d7o5S!V%~~$*Trg-hmrA+HyqNPVntyVT^}q055J*tt5=v(hINnP4rH@{QFL;Q# zK__08v4pomZFogDv1%a6LFgZ%jloW|a@%_YcT!j0itUQ}$&O#{|K!0 z^5x5~ShsTJT2)~kdgm*5ryKt}{Xe4i-+vXw^wGn=d{El9`Qe8*|M;=TbngV2HDE_~ zvomvu@Q@Nwt_A{IElf#ufUapax{P^BWx2&DMe~F19HXxqKzwPr>cG4?Y71+n;$z>l zhr?nxULKxp7wu^00998&oJ66?jtTD6O1bBtmGWL*&85vg?v*wBsG}F`a%rYN3;YNr zvSe@N_@=79;y*6l0~xvC8)xq=IkU21Mr6-9dqcr||BRIr#;u~iqI1cfP@ur~$8+8& z>x)-RE8n-|4S!ytd(Yy1iQb0FzLL$o=dU^)e}OyTKck@j5)1_sm;(Xu&7<%X8qh;? zC^}}0g>uL=po5E~U#E^<=(yH#yW>&E(+>6Gm>4aoFX<^cqhxN0DwlP(bdKzt+PSDx zEgRA@WaN;kLlzBDOWT{6AU)Zje_B8j5=$X>9ut)u`1)}uABJp=~MEN)K#3{2E z&X%UmSTsYDo{YZ`egy}jCi^B!Q_94$vX-)uWpY`yb>s+fgjiRvg^&%c_Ek%`VfDEl&qCuu|3b;xVVvoo zDH%&gmQF2|?8^8FPbo}c})0prKZt^<3_YjXwB&{ zTxJ?Rf939I{q{~W-r~Nztp*RW#1ONbBk|l zaz4Jdr*BKKbIWx8V0Yij=T~k?IJca^AJ@(5dwy2mO1$|@_Rd>Mo%H6r`?jU_RqOSf~&T>bmCHM8*hX02S= zhks}FLHnNmS&152bj*sVFd_t1iSB4oX){0!@YzZD8-EcSiEfrS%<`ttJGC}mM zOlu9KBG`}OITbjVr(SG`Mm_a)KK@UMGg_46tgkZ)^WGPG27XBr%TjXQy!2PEPi`0$ zD4TWOk?ZL><+AiI-k&$HKKz$Yo+r`cMC;oDjTD+%Jaa9ZKSN zTVIo&-!Y@9O1c%F1J6in9^bX=@y)w-rMHSbM=qO(U-!NonER_&&UxpkXiNVy{Uss= zK#4f~khdURbpa*DIVJc4d0pYqI#oDK{|XrV|F8T%K1)>lWyr@#UM92&Po`33aS%L1 z{X$fdgC?^{^#n~G&verykDq&;KK|0nn8LP z0AS3?ZAO+s>ger|8}Z!~OZPW=9PFpSAAn2cU}e4tt@X_8h3HeUpxyZuV-5rD z!6v4I`v5f?-81k!p`{1<=mdWkl(Ym>ER-l{1MU~2^IFf`0V(7#1W}H0rlG&64o5&B znsH^-no!=EQ)c}0=G#A?GWpED$&>%N@s2Mhx+3-oJznc3o8_YP7pb=PM;9%9psPLk z)hn-jsf-%GdES%hcjhjdyI}rYvFPc3F>k@#g-d38ssl=DXz>i6sd{+b(ks$8+`50v zxN&19jQ!{)#-{}uED4mezDT_aCtW#ox0~C;4Mh#H_OdbIp+!SuW6F%dFc33OsNbdv zawKU|N+J2@c9x^bSV%S$K)02_@0na4T*9w2c-dYE5yT+y6@&&?!W(*o9+j+_)+@zVyEa7 z{bG~DIb?)BT}#%v$GrW6H(!7K%|E>P2KmG2%xy3jzJ@0JV^0>-g2bhMoQje_bek|* zkP1usy|N~kVws@(bwRMa$m=ew43|i!#JPB?5Z~fJJq9oHym?7UrK3_jWuNOzmO`&& z&?=Z4jU||gY7>12-euF(haCI!go9Dvb1bjpN|dnti0(OP+M>MG^~pW0_vusi(@n_< zBYsgh>{P9+vom((RYyKTSL#RoTx~iJ+6gpo=wTfx?f0wb zV{L>k4*FP!^U8~PMiu>3ay`u{K`e}ig=GAF;qO>C2F!F;u$rfg@k}nE%gPymh;_D?R#^gz?LZyh!axz()RA6OB#Jf~r!4V0e)6L7 zXZev4ddv6{eRdxQ4-*fMsHM8%N$u^luCdni-Nrq$+NXTU;tYKdy1Q!%nf;%n+ zu`X!ct!M?cYOS_nR78UiGeoM>8T0X6k$?yG~J2P28)bHo}eZ78v zd|hVCz2~0uZ0C8N^DN2?_xRPONW>R07|zz3;7Vg`S9+cJBXl*AP`k&##@_}nsNiPQ z&8ZV2jk+y~Kiao1z3w;t{m0T8Px?{J*ei@XhApzczi*Ak(_hAax#cSy+=AQxtg*}6 z@C)@98~vi7g^g4S|D*;-JW0KXup?R0XqI8M%XHm3QHPp+%XsKZX8hGX0lSF zQS@a-2VVr#qXF}E55BnV{!cy@y??&uDh*Bp`vrDo`Y1CZH{holyL8>xKT!{#zxqUh z_qQ|Xgf8`ocpz*_6z&=RL_9c=ePa65YySNH&?oXWo}rtKH5LlzsB3J?uJM;B0D$Te z&fWk*YfW$?@WtkB-f4QnB%&*-8C_9*wn{7fUp@u(5PSmw*c%;;V0BspXwJc-?8FGq zPMH1XIK*e*RewDGMd4LIZ-eeVtffSlsjj6uyB3}8C9AjCD|%gpFBuh+J!xd9mC6@X zQmMm%l}nK0iG7FT`-ohqPgnE4=;0Quf?|Dg6Lw}fij!y7=T2VX?3|BkukUJTFYt}@ zM@uz7(A?0~*k0fn<*y3MS;({5>u<00dum2cy77)G6p|i23AFZ^d{A1g{R%dlT~L%t zyG^m?CvAdFYy4T8^pLbulB8vpZrB<&bCu1C1hm^ot*g?;5AW@4J{;%tc6bjZ3t^MV z=(hwp{CPz8>eF>aSbbPnp-i;9T+aMW*3y}!U8O5a*OY2X z!O;0hr{Ekk9S43hC7n*8*j8LpEERhzPCT{4dpZd!Bm_8o_HxPd@^C0czJ?SBChkZk zmqaQ`{RKrXSf9bM3kFtk%7}4}rsc+9iN8>JN*jyV5+BHtm8wR5HG^kl$*zm-y*tv3#54ILSQt9!eRYf&N#WsHftHRw7gVUtDN z75-dO0S>Pi;P5Dj;Xo7|4(>h>UBy{E6w!r}iIc$bx+i*``pLh0|CZO?QPy6N-{vZ; z&|Ys`IXf~gSX!GOh-$QR7cJV%gxTjp8P6}NnX%Gqvw1@36bt&+PL@_<=EU9OmFg}# zgZgJ{)1rP`FXBL@*TLS4EN5FTw4jLD$r!v79KJ{0DY3IRWH}sDmsbD$fd`&^cxvb3 z=`&xsW`(Y4;l1}Qs9m@y{_3CpG;9Vllwg;QL5f(1&S1XnOxx8qiL*F?&I$>C9IvC2 zd`8%ucrLn71l*pR%lvCzd4FIo);|q}Mi_mlCv$FB8C?RSTii)!DR%H7z#(RL<(R#; zSV7Z3?}_<+&mexs6j6sX-noYqjBm~Hxyi?3vFV}W0=GXOg10`I923ga|uT2qT{K`>D~MRT)% z1m=OY^}j|l9yIbyJ~F>b9gAOe>#(`bJi$n`_IGk?_lQd(g5X!212gP^&3)Ybrt095 z%|M{zYepS_s7G9YQSC||jS2xeY_-xB-FvywW}Rp>!gY4FsJya|R!bNK&e4Hf5?pQ| z9b@x>8wRkSg(B(*?>m^KfqblPnbNI@f-(j)kb^7We;h4%#D$nShpRo06Bef|4%e@8 zbDo`@b89k(p`kS85f^=napruBaTb5wIJ%dI>8*t zDV@e3E-wO?=PM4@QOKB3Xe%r!l!QX6hE8&Us6mZw;#8!LI{%0&LrM@!Bnqw7T5X2c z`T6Kb-CLO%dWHQ$OSUGsAEW#EutP>&mYu7x-=fa7nF6MAbNyn_TxamnJc=20+ilc) z&!&#YTkmD&`O2Vq&cKMAYGW}zBvJOq!`46Zfc$ zUKljL%-k;I@WH&WG&7=@?98~# z06vILF&^lY*$9q;+XHOppgBONoSL$0C+T6y(iE3B4UK>*=C1;mV~p1*=g$M-5q0&? z1pa-BjSB6vTDxKw;VzVsO_!yu6}axl{2Aoh!yUYXA$BMx7;4du+JFXBS?cP9SA=@b zHVW$KQ~PIve^d^jF^N{!q}TBnq()&HA8#rjkM=}k9*u-7zP`%zy1styT@lEY($~*j zDY(4vQtboj9=#vlA2jGY;WnM_8NNO1t~+jL{=al$@g`b@Eb4z0nH*lBOz~*n78Ea< z3Mhz{5*%-vOm3^;O|<-`+KPww!Wmgt3!fvR9pRm&BilirMNeUQdEub{KgxdFp8bI1 z{X+C=v1Xn}=gp&pbCfYAUy(x|^608?H#E2(W~()54m+`mz{mj!6EyDAh8<2LjXL`Ume}l#wf+YpPBJ(nUEk85@gTYHk03J zep5#cq;(7{eSxx7Y7wwVW*XcuS={vPCG4OfgLlxh2QP=!Fw^%3A&6%F{G2(}+3Dow zH)vi&7sbNTt+y9HgkG;?_vB+9#s0!S7Ysod(F$S?cPhU8(qz7WZxJUPnzK}>;HSc( zcxJM;zC9Fc4V+-Y^}C|0hT>)Lgv;mz(;ae)FAbY@`sWLoX<-h~xrujQI%m$Mu*l!+ zFUnB0Tgk&ts{_s}d70Q<|qlh5UNq+O|Vn1;Z*=xv`V_$C-3 zFq{#F&IWwI8Gt5svPlgFIqS_#EKBB>f89iLKnJ{U@1G)W?B4_`&R49$p9P$^z`aae zKt&b@x>cY9m+W?C0?9!XvP;st#20XnPH5h88@%2`JWepNpk;rK!|I0v62z25cjcWg z;9aBLOJjj}_;4!Wund8)Ll?2J7o~SyKWEPMH1?aC8R8<%UP!ev(CgcRR4Xl$dL-G3 z^5<<*mvkG7%?oeBJ&2jD0zC{q@)j3mQK7jbvv%NQsN6b5X#&A(-!=`BmMT_;%c|iR z8ZN3-Nu}}wp=&7V4Cds)pTAZZ<;bZsyNKKe4i|B{xJY~xa4Cka{&p>TT^XJ>h*m?J zK{Vt5a^crPM7%u<5ylPyf8#mM3#oh9PQ}b6u-GQzpS|kA!XC;4MhG@Lv?RUj?YDvD ztL2z@m;5;>#r}e@pY4_oXoR@!GXMaI79fzTMUNcYwToyKqTP+Y|5 z&71Gh7X4qK8P2@I9qX!%7W}#%A*+ZjF(lLz>y+ z^_onejX!!#E`0PL(T^Fm-aJi8d%z#}clkxHJ>_`UXZGaTlK|>IRHelStr6Kc9~;w8HspfCFM(*dR}jg6_!WG;0ev`8Z~O+^&Yko>Z^OxOj0M7Qi8>ZS*q$5H#UVOl zXR{w|T(f!G^K9LRX~${jY`*Ev^jq@heb0~I^VH2Z?@xa^qwj6;*R3!AIQ=0j-pVY? z+0OwI)JPKKqwpGeg$ar$=wY@GP5WK13i5tQlVW~4iy3^Rm@Sp%x3A^rL$BB%A)|Xh z6o>24{}It@Wyl&p7F_P|K2tBuF1Nn;)kJA-MSbF#n4#1%&mAL3X>`U4PM;!6;m^8&Kd?F= z1w8oKZucRVB^B^-foP_v%R*~mabdiWS}&ul4a!=|e$8r)NQ(?;(6Ao$IN>XaqrGR} zC!Gw(hB*1$*L>JcQM=Jjs$GTuqk0bbU`PVM3HU<}5#7|cSlam9Md?S5vA>q&pL<=^ z89rm^hUBx`9Y*#fx)#UF+QzJ3+wIh0fp7fw!Mf#PtPs^?yijBLeNn|Q2z1$&By**zD16Gl>+;N(#cx+ z3t;C#U5uGZ7y(E+^sLlP)Lmh{$*QyFx8--`-<~h$dp>gPmtHmc^HMy$m^bt>9w=B_ zzyx2)|1PRo98OS132{7d8>a#&&c-kW7a%}`s7?*gkl{wdw+%Cxb?r-^Png`iIo8nF z^ZoCo|7)yq^Je*rJV*QFDIeV5H$mKb&I72t?$@UG^l8Me2+x25dkAy23Zq^W%wP*A z2u}ZjX20oG2K@4aePHvmOnHR^cB_4@T{NhfE|^$b-)A_HMkJPs61DQXn?1C-sm0z} zn7^R-ignVPqmZ4vOV&R419~FdGpLFhM~2v)N~2(q^H2i<&4C+*Ga>ZQCf9}p(ES!G z%KlhqTDz>GwZ-g9TFq9QWO-F1SWQw2aT#ho9(+KR2a4p-B2PlH@NAPj(yLuALLM@1 zcW!aGk`^Q{*j|Z(o$=vtv%Q%JF0m)N3fzr~JOXhxR5_t@6+@Cb0hY4alVuGWcX>H` zU1{B1lJ6bqOaD`hHIJ5lut4d{6aUk=u(+T|x_s}y_xhu(Rim#nfAtQ=|87G-TaGvi|(&)Yzh??O)aaNUv7wA+_K=Bs;Vk+ z=}(SMpE;3@X7%Ea`%eAz)kxilCvM$0|6HVvSxvvqGmjtL^4M~sOY!s!T~?}e=^jFt zgXu6wh2Y4qr$UU^J%kS3s6cTR=h7y{Q=%!+)@o`IdacQDr743gGm)3^fKTwP^@&iq zI6op1gGBAuFr)iKjF@A?ubz-+W!MnwL?)GdC1w#4l1fiMq8gCUJyKdlPcY`aa>aK$upj6e6G@CmG1NrBj1&rg&sygY??| zf2~gUwHc={^Mz0TecIIV6Q)f6Ur((_e>~ne;~(Gq;!om+ci!=9U&(XKn%VJ}`^Vn* z_vsxSPU9X@tGqaG~6->vmix>jS^b-(R@f{FcdR zrXxEmI*206CE!eH-!CpmAx(DY7W^E5fs2Vlu4ihy@=6k!3UG)=lXVatL|iIuQS!3* z{HhJjO6%okpOgOQ{Yze(wRn{;9O|0cck5>P^V)dBy^|kFe{sRe7Z<)$ef`V@sjEt6 z7Z(+ZOVTR_$zY1OZ&kcu!mn1*t+uSUXkGioSKa%WF-03|rhUT!?^-X|k-h5~U`MWx zbRrKTsLoQ#3f$6=UH;2gPq71or0uvL&ehntoJ||pe{lpKyNqBrKeHQ@qTa-4NeHnj zdo63RFY#T=t}oW(iqcfDB$yvaF`=ZOps-Y6C58C~0exO@_e6=gutS*k=b20eW_6eF zsq`3L8)jz~t}YY8T8nTBjJc3PTnz+rW?Il3Gx9dd4)QTYugMi~arNFBF0ck|LKGrRqhPk^ESv;Hi; z%kSQUC)Z=Ac@$4}2#qfaHayvZC+B^r+i!hU>|rL8C=ms`%hhY)fJ=-I0vhpmG^he* zP{5KK4OVYuFAsX?F7dvBXNrOga`zNy6;8w~E>>#&*44J}7fT);6Dsz*ckA{CjpkH& z;EKR{s7&uii=**qS5y*Gl@*s%T#wNBZ15O;;I)w}D&c!TFclDrh$>Q%>$zBlEQS(5 z;VC(eDa(*)hWklEH=ycg_q5iQJKD$JJ5p(%(K`D6nSFlo;0=G8J9kmn%vpO^U;6gU zj-@?vG~IIBGqv%OU@YH+ASKj`Lqk{m6)&>gNUjNx5>N&^dD&9hlFPVINH#he5;jN)NH$qR zf`TQ)xslPuW4j}jm7AMuYu8S=BYj2szb|=tR(kg{FL^2pnm4Rk%_9Fvf0@4R%Bz3c zdhH!Wzt1blmoFinJR79a3(5!!XDC%AMJ2_xMYSd4N>)oZNjgszsKow(dB59Trrlrg zYSfwdZ8EJtSMW);9A8vzE**Sm-d8%`bcGQ8uuZWRy3vZg2Z|y>6FY_t;O_ zT^ZHxt0(xXu$R!PMhHulk?ur!(ItuNBJ!a1G|+l#KC0VaX%JFnp~ldp(E5-ZI?y+q^hbXTkoe#i}=%0kq{iG@t{Ud4N% zQ+B$5L6k5ai`a)tZTHwTPM6zb^Rohdk$$&e^4koB#QthaXM8~OOfG)}z02d2+`uWk z0*<7+xR`7(!+t%=DnNXWN~ z-F3N~C!f{jD0`(k@bHz15TxVpr(V|nQ>OXp^5s9-elgocL9i3|M^e{-VbGiTU&M&o-mdnqElZFOq?KK&^InGT-jBNsa^I zVyu}c8ztcNMA^2Z-uk_yMAO<41&JCQU{o^Eb`HRx47+z(I17Uu000e8L?kF4r`e%3ox*UVk`hikcB zvWpa!FCUO$9AZy|b=?O}^$2ZSA`XUj+D}5TAnNiX{eBxays{-8j%E!nU)(p-Cz=Nt zUbI6E$!Q&=i%Wf*YZ_q#p7Pi!###4&@7ISXPHGmnp0^R!pUw7Lv#ot{`$s&N64TMP z1CqtUP0C24tH2c%V{(}_7MS9k>Y7kEukajpwtP|Hx*|(aaSAiH+ER9hV?Dy0>^|0v zl(W@v%ux5Eok|GOUIhkfgXC0n8@GZU$yPi)9!V$Gj=b1NG@{ycqF-_F}6kA?f?6fwVg9BO*o)4xsk%okdUBOGrLUX3GC5~nEcJ(Q7wvJk470+pTI+0hf(4&|`&a+`Mp-`yKf zWlI-2BawUZ*SdP+tjq>+UB#z28x19ItmvC3fiobnvx5hM)?b~ZE}12huq9R z@BaF_7+Pl@`%GC~8LNf$tPjQ#9hGFA9bI`>4+-GOG6}Mfl+R zz>RG}^#Rz~?I=BCPucj=ZR7~x3aIS>5M3Os4bBY8hMemJ-4F;aEcGBL#Slk4W)vY> zeDS+@S@OQmRDZ$o4uh;_cf14Pvg^dUoHyaJ>vG8o>A z_{Q6a15cGcWk*n9KoUm0h+utQCpF2C!jlwzkS7ezZ6-0{bUI4e0{5Yaoe0frJJsNO zw5ts{*^%^DH*M0o`u-@!K?UbZpGs@_h&o}OT7}<&!$=K{siiR?tPUxK_-XKCkk6oz zprxNKit_33D?y>NCAD}M(xQ<8jp#KsTAZ>n=%FZ`zq)?YMtV`7o|ys3)Bt3v z6Y;^PDaJ+Oys~q|%@VLSLl zRYsf#DvMIZ@1n0X<>=GC%bWRwlId}Vo0xkNubi(gRB4FPTlLqM#;@cVy=`#nO{R@Rlz7^x>) zTwbayjInHvq%B{`7lr(QU_m@Yl%g~!o(0iu@3y!4WX#$J5Z?=2?TOOWQfKF1%J4w%{`A$*rdj+B=a zQ|*ZpTysyFuAxYj?(((eqEKF*f6t!p;>Q(C^py{ zSZxD+Ufb|=Lw|#oVJQC4&Q*v9qn8tnNKem=I6{etCmC?)1T(|Zs5kacp)({<$3uLy zy9K=Sb^G%jdFr}vOz#?U%@1?e1PXH3Kp!7G&K*Jx`-xDl6tjRWzy!RM1U?AJC4t&N zcVKOxC-8dUef*$DA4|Tv%$X17@ng&bl!wI;WS=hDStJTYKAS!p3 zR2^Bs^*FDDmosQX(_&jt33fwUz8%%7g8?6)lX*ga8rRdA0q1_;06{-{>$%56gt}t*GwuO~& zcUTs}MUX66sAm0yxaX)pcjPiIz6{OLkJ3BTaC z`AhuW{vQ7aeyxh_j9&^@Ka&~#OAbp2x+-Q?*Ol>#;F>M!HO!4`Xx_GHZB&VNM^T|Y zivP+SSZ8(~XRBTZ-1Xe>yGGTHQbu);!d;{AU&G+LG8QfFdOkDzpZAX!LeH@h6nG;M zPtGA$iDlEbXR-4WDG5;(M;ZGMcfWwUfq{!B3RcA^mXvd0V&}61rixTM3)gK^uLB`b zd|aW|Ou^f@f=fa!5mZU2N~|&^z-E>+rM#mYTb2z)e9Gzb+VZE%`^&XifkKkBNVOpF zgzf4&gwHr!u{TtEGI5*W$bsDwG`gw3B6E$$CR){bs1o6?7)O-|_kW{_}|z0+;od;ktJ;*9jIOuGnuj-fR-}2D3%fNJ@TDlEPpVgTtL9 zeQ_fX7K!hQqSPYdMLL}!JF3K>J`5_ucy*ERBx{`0z@{fu6(PaoEte`DPfkJFdO zpQyW0oe_HqPcp)O^e}0Y9_6Tu$U%O)_z;fV1LN+@ z)Z2CI(?=(o+r|aslg7hq`AjHQVp;&b2d|j$T+|VY2j^QL8&FSz6 z{eyCkEXrD1L*LLx&@zIUJ{A!SO-dhKU-vei#4xDlfpvBJ_Sdb$GXzAlvya6HJo^(A zpH6YRle!&R#p6NyG=l+oE9QANy>=U`MwMo>S&etBfeE>D3v_QARO@JSoQkd=Mx9E0 zsjE$@$F6FRB{zDuADtYFOw{WNJg%~f55IHznu^jwX}y@|v`-s(5SsoMc>ag-lfb4+ zn2XknG=sbyMw)?ykh**Fx0QjbWA z%!Gm3!E${0Kl1c^UDO)ml8SNRM-!kGA*rOWb?&zy1Ltu2jJKWy4EZGB_on7{2g6;7y{Ja|ErpO_EW4Zyi-P+^LjWA>(-y zJs(c%y$G9=MV}!0#Dh2h#-8W1AyVfEiXfWpJ$j1w5`3cM^`S9@9+q4l?m*0s;A6PM zMG3R$U*8gMLG6KhunSK3^NF$nWjN4=0t~J?txV!Xs_>s z`#V-|Su^)6kJ)!cl`{AH7eD>f$YL>|6NXNZ&_!0%YEXIyM7o#1w!oDZ{nugJdx!sp$1qJpnH~R& zt$n{y|JPo2#u>}f`|(20)vgjx(@%swnh@4dp4Xx0Ev{r)uLI{yN0c^aezL+8Gb1P1 z+-uPWdJBBL#Y98Jv0iP11zmMbvY~EMg~S%X6qll#EC#e^OF{&0DlOX-aKvBhd+YF3 z2t@MjI=mO8LiDCi_cjOk&ll8(o2TVJP0LGudX3oUrJW zNu});)BJ*lCY@`K$Lx^UGNvgjiQVGU`sdnXp~7&mq?8T^1tGmqZ0-M)<74&^e7t~| z<-Fv{ks=Ks1%yYa$sr}mv7$K+D_7=_0)7xsAih-xK_OK3!p|`b`OixzYl2NG4(CHl zW?&W383aGHe7TC-OV|B8T`8^hL6$BP1PJ zbIO*}r+$A7;cCM2uwA*^oe#XknzgSMjA+y@)D#ri<}^=Ow0JV%r_52KVj@AZK}i1$ zm{|FpU_szjVe$DHXPio-)M;-KH|UNa>g6(}t;%O|!R><=(FbRa=&f@0Y7~zzsVV5~ zu3}Z;Jo=L73s*-FbrcL1Z;T+PI2nm}MA5&IWakSm0McXIh@&3}$-~Wlu(b~#>WRH= zuL$wIyP`IDIYH+D6NCyxOF7^~3B1@g=#)=A@KcY3hLtv9+sBv&84*_ov|u$+PR#sN3qqq=MeYk z6-J?F=_W8H&Z-RVO_U=2H^psoB(*NQ_)QxH`ja3yNTHzBv`{cI{{*TU6umjPObuJz zJ$=RnE2qy`xumJGqG@D#WTf`rGcQ;z#cRg^b10q(4W-6PFF;{r)o{4A_J{YH=tPUk9D>wuu*9Mo#Dt+R1cW#DqDcuS zPOrp+KPhi`^2MJu+1ZD`d2ThkEq(R6XI=%(jm0h;#T@*?I>oHhY7g3NF1uDn4QkrC zp@z^q9UCY0HWTVJ_PE_bKIl>K11!(lKc=&jE!e&J84B7Q0Y`aQ z1-9UKJ4JS=J2`f@PwJy^P1d(1u#MlKk3}t*G!V&&FM_>06CcP>%ZW}+5^{9*Ti1=f zs_@J)EssqfpZ@&Gnvd7qwy(`7-%vlIz_4Z2JNKvOvM29;<1+Sk`Kj|_#7$*b*+p1c zsc?-_qAkK^ExNEz8v$CE(}hY7MyC}UagU+6$H0|hCsr#-r2*H+T5ZARK)_XsB0JdU zU0^FgupEM7VoF-wPJ_{^amBNX0q~KeyDIG0nT26_Cs>=h zMEN4y_s?s%urzY*X&qxn{$vIg`Bd>m6K0-kzQ8&s7Mo<$EW72|rj}&utrx%bKyI0@C6*}<@*8>?=+0^T}cPw*zd2cmCMjD zy(sE%R7YiEMEVbM1rPw9i2=G$3r}ckB4;lhIeVKSok@8Ks<}N$gho)Xl&YVRi?Ga% zy7G`XUV;%eQBWhvpP*dVmzaNLas(6dY##Tm$!V2U<>!xLE7HAVV5Qzt7Ok%T#Nqap zig%qkcGRhfqb85t7I0iyySOzmy(my_JN41I_L9OtjbnB3>}W%0?Ey#7Y8s#+W=(~ z&16`B-e0gH?MCudp~5%9#t?v;p?K7i0x$?hfJ`T%HF+H~8BuN|YI!V^a|9J2RVA+U zXnSY+$md7WM;1<+_|no-wzdE3tQDU>{CrQ3wCv2I7yRbH?^7#}u2{bQ#=bXx2D|2o zN3S^NT%!3Upn+!18PHKLQoOj(QX|3@AYTD+V0P1H(#-L{UM9DDfU);Zu{uI^!hi?!5Yw} zPhJ7O)e4}ic`VQ?*-O5^wk~|alS4x{%A=fYYvJMzDoi_FaosPkC~v+3KD)n-JU_SNYF%v zO@a$)J`efKpP(W34Ue(kKPJ!q>M1-H^m!%6<}z4emFUFi3!%|6WEiONUWOzeAh!U> zEkI)p#5dzlDEW;;pTbBF5uf4(8qxN(Kopoh*y8|-3xHxDS+vg<9ipxuM4$Bj0>qln z7e2&MjZF-wrj0e)_bK?9uzeWtOAr$uhGoJ5nGx3vv5+_n&0(GE4FiFBz`T@Gf+5C< z42oUVx6Iq{-nfxX_jOFYE!i~IQ~1t}i_X9KvbodlVZp9Pzh_Feq#jxRNONOzvVO$P zr=;J!^NuBA-Kk5j{r)+#&uhjWJq1wd&``LwPRL_U#f#(WX1&3s*Bf+XJnNKTFo|;i zMA`<_`_kv>5e1KR;+zm^4#IX;jfz$vYHZg81>8dKTX7eVhP$>H4IlF}v~lB-{2f=) zJ6(bC=zbmUqo-ucBb|cu3;fX527A#TCtX8DjJl1&^+A3XbpB)PS6jC~ zFHL@~_l0B6N>^TY>^k{}&-Xs})#?{|pG#k(IrGaOfztn;-of4xK87bG@vLqWEfpaKvgQBKuQF*vDlWNBgOYINEiN&+xR=}XGHth3?wO!Z|}4Vd;ymi2?pBR4<{fM zXlLhp8WBSXRG^;astR4!=t50xZ1*sg)m=`!vSIZ3bLZ|p^^2q9Z*Nv6VIlUQdP}E7&85gB_nPz~+kXA^)NBl~O@PTqIWE1^oX3_$b`be55nZ-+tOd_e~ zhDb@7%r2A3d{zeF}K$!5vMjKiWswED!%_q8?&{399exE=E5!5r^54rptQM`pe6sO!B*9*9DJ`$l>+{Xd zK-VwjXFJYDRdaDAGv(Q9o3=rMsaDg?s9=7FQjF#q2VEXm6dqTeS@PKRnjTr-6F}7g zPq?>?9|!r7MqAk%^t@W+Lt0rZP`$Y*tkGBxIp9-0LJnnmSKRQ~EOY_CE>ydBF)xO5 zXgt`0Ij|9o1nq0@yYLf&_1^7+KMJ&o9`$>9C?lDEs`Mv&DHEYP*xJBnZCd_^KBu8L7z`%P0A&gX;23*Oa}K;(*C`!1+_NOl z3bM;>OfaIniyln}g&;(;6(vt3>7WT)7(NMR3AI~Mqt@pu=yAQO*LyEFF^2pyFaBhb zv?$(+El*cvfXIaV?e)LAbNYEcljDMx1!r!QnpZvk{0*PIX|lY@9OthxhVQ#z z!ydC{yT*RzBKJ^$G?&*NArT*l>+T4V*=_&uPW)@?fkH+8dti z&8(BoDTX}x?)3e5Hs9UYHgOO9MWYncJtDhA&kW4ZM4S!PJ+JAJ^u`oqIrp~E`&Q`n zd3hSXXY=F>Y*;8#Pn?1$pw=#svTgS>*WP&MIghcI-#W76&TEfhU81H#T%jKiFJuh- z`;-zL?1{8`lVX+kYdn$h+8uBM*WpMYjw6BkXf+)P)Zj=UND;gVtwsQ7Svin&i2XCOz)PslRKZ zq?AQqA;I?#ffwHk)$(w??Eo4>ki(bL1^RgLLokL$3MY_bi3EE*{qz)H@zRclgi&i5 z=dZ3_(l$lhv(!AYSXpM0muv0eqMBwvP=&oT7Ws<}!oDrb;|zZDBZ?imv0Q=30@+-g zkPTHmo^7oD`BJEmIz0-ppob&0N;COWoIbq3H+D#g(@!!kcScfvI^y&z^d|)lW51H0 zkC$*5FVQHRXQ3JjlH`2K-*Gj6$F=+&m-BbrLGOwQcR8JgPzVNnqq^_m6*eILA^Da0 z1cQS<32hK%ZBX3co*Ay9;`k#c`pLxxtp{6SLUqNddO4{Hjg7MY(XQ=N=RDH=!6!3L z&(p<wun?=2@67i)go@+v_5-8%IZ$T4kM5Z5t z-HELG-XS2FgJUH-hm;6ig=faGt;^Y$kVPUdq~IGdc4owDF`8u@uC z6m=o~8GNws_I&~6fIxuG99%6JIHDut1e@^mMC88m;1ZAhlt^e(dGr*s_BYnZ=z7a? zOSCnX2Xf@}A!JWTk#%?C6H;0DYP&ppmjyH|Xjk1sSHv zOWkaZ%t9f{Ha0>jko`USD%CQHghIus2sEP_OUi0>rt(PJBkW>-!uGD39&f15Wi`tK zxX#)i!4hH6kquXGs4*k?SJevsK(cPlC8O^SRy}Y*dSUwZ^j&uON!dGUT>E=>-?6je z2iN9_Ka+GTmcv#VIflufx1ZxQT31(0xI9`LyY%wFShLm9Wm|UrcaS<{>5$X`cO`@g z!V6ng2N^{W5H!k(%gk9WyQrMW;|Te7I48#yj`Yhu*k^IMTn`}CZK(&0sQdzTWrPhk zvZox}sJJeUu{DLPkb2b?%Hv{kWos%#%z_O3Bse97KAVY2oK}$dkQ@wC?o=UvHTtZ9 zWw=7wwlfN*A)`LZU%Eg?P@gD6C1c?o2Vo+jZ_7@)wnw_QPXjw`Oy8Bh+r}OdP0iyb zAGq_O8K;`{HDIpi@BG0|FjtMne$LpRs?0U63(OVOX=B7(K*^Fbv_|6vO_MIEu8nyl zO#!jmy|2Hvfmp3b(%My4JAH!6YEppWyOyLEY5n5Ukl{EDfeg2?WBtDnqDlcyW`%I2 z#Z`t6VWmEi3@dIQUTpScScrkLa#CF#g{T^%kkN%v#P1D^5=-PoXp|U@5~ERKG)ipv zDE-^fFA~}dMnR+{^GLSab2G6xHF-3Kg~qVZ7#14Ca-uOr*!LI%2hTKykQ>8WU~tkH zUK+zoV|Zx{@9;6m{?1o}UrUY*=F`4bJ$PROC8rna3dP^T58EJY zdQtGe!2&Wvhm*f4#Zdf|eAeKa;1bK+4ekkUX}rwFi|o>JcCm-ik;+!kb!|@>h*=5L zR0Jx(@Mg2GM`tc|fd?*2utZg9X$9Oc)z8+TWDew>siLB?GHE_!u{cu30YUI7cgd

    n3@lPXoDfhbYveLN3JE|B$0Av!*qBPWsv+?XN<1!YRB~#cBl9L zibR7|d_>CQqJf>y8eJo2{bcOe*)Lyy=WEvM`o3y7KW;gzZSuTn-~Va6CJ4Gbqsy4* zxUim!ij`LfBav&C-SJua&G-CP8iVV;%S}$5%_ehw&vnV#h2w9gDaDtr~8=vU&)n0 zWBz5uoZU#45!J{Gg>p~;a#+eB&Mm;auLJVO*8yTcK-Nc!5o<{F6cyFuh!9G_s8i)VEzS0Y>R#g~Mtp%dL!|xs zgoss-TvUq=1}`Bw=VQ}8bp6Gv(l2woLhfh`e7$T5>vSxudVJTe)laVW6*4~Ch4C|kHsoq$8K_y@Rbw4oW6>Yic_Jiq1F6Iumi^q(b=7VJDNH3I^NxuLu z{aBR@>{jL!LW&2BC{)zw1meizig<-maa)C4F<5_9@7DZ?-~Djr?xoB}ny*HdVB+M- zW%!_sx^0v=YUrJiCHEt|B#!4I>YGcXtDp=+H>Kx#0yZuQJcD?c^x5;k{%(F9_UdwR2KH%g_xVW~@O3l6 zoo{#0qOG2|r_F-|kc`SsiaR7S-7n4O_wzVuX!~<;e^7DJnnM*nKdspsj)&XA5+v~; zeV=O=+P`VOgjKd%30Q3~W!)ORCgpR(Vc@n|ttpEcb!W`=w3ilw5F=$BV32sCoq^7p=gtQEa}_e!(I7KIN~MTVKZBtNFEGZ zEmA6fM0x6W6+mruDx9$G>)YG4ikyUd(P5E#FOp-NdkdS<7EP^_fdgP{vhX0{1!r&k zpdVfeoWWVH-X%bGm8oh<85c}R=7z2Y&!AVMo&iH~JD!#0^cBnJT%P`WY{IM`i0k^^ zDCw9RVa8>%V>O8%E=woUccwQu#V57y=JDfRe|X2DF*TQ+_F-gJZEM$f*6?!r3u}$d zF{$L8nLnI9VO@1SZLKrTH5)w_R)E%P>N0xEF97FJsBZOv609Uh$BRpgQ}uBd+GJN% zR;DTOZrM})nPEtofp<9zKE-eLCN`=izi$FMm#h5A$ zx=KrfT7Q8*Wzf0|25q}xkwNqr8c|kHi>l2IZSc~dxVnG^3;dE(=t0WKHa1c*IC~s= zKhC6aR(eD!!eEmOYy+CtYx86lED}n+sl2e9YD1lTN67Z_8{8MZcV`yTt2n3$%tN3| z?l+?A8)OhTosklOv*Rh6^2i5+R$7{YP+pdZC$Se+b`y=q$FDk1yhhW&$(BHpCEFdd z+B0-L@yrp7`~lor84Czi!grHW#`+0H`F<*F0RiE)5(PV~E{DS^`zk@V?WK!KMNesC zshD3}D(U@N@1|P+@!5O?DFh3ESj|GU)nRs(611ubTBU45DJv}w7v_6i z{$iwei#}OzPIZJo2p@suswzyixtL2I<*y90tEEsSbgmN~k9SWR6mYgKx0R zQ0Y=0dr5{a6YTfhE6=-#0D0wUIZDjyo`3G#)#nl=0*)ElYd6j?zaiBbgH-q~l3lv<*jrNcyUKUX!|8L+VE2$`j_lK40I#EPBCS9gaYHk*TOANf*`+agZ9LuBv_)51=tP(zWNW60x- zjbZX_FoU|(twRE~ohR8oR(7k~#|0~MOsj4m{~@G5c!E77$Hx=SY#7YP**zqK`2V!3 zl2Td<%$ExAJt!;rZi0QTITUtF-Bw5`eP`74&sy)3JYMF=~Y-DDew3yQzXM(3oBt|sQHj{C6P)qkh$t~RsX)qT@;H^6+~V$(Yr!g9QKvdwTXuMOD} zzmB_B|C{i4%g}xC8~I7KOdggmf~W5Zz}VwXy})G2)36inF3}VdaWSNi44n)|&KAIne`4`G{ij(eZ%X zQ!591;L|&@6;`)XkI>{JN)4PV<(1)@2o6w9dYdlgtGT>Jtf?tVgj2Q#5A{U!r+$~u zg#4lu>M5xdhQ!aC$tFsOI9CSJvMRaMagE~jA{7`jh zt`V6laMBi=D~Bk|_k~~sxOn;ESVxJw zu_QRBVco9U67sR6x9PqVKNS?=O{HXfC7V#jCVE*?gCfGMNmpwtiU+vtsaVt%i$xP; zA_m}H(c}r{)}(?1xrEE^H!DyJ%{_@?#1tM9-r_W9AO25Ssu=_tO$(qlI&l$7rrm<&NMLG%tGm0WJn@q8a$}{Ss z7X>5n(IrKvl#Dv7e$U(c56!&So@aZw`R3K#r?+)J3FE2A#hag8(i9z8*VNlw*WNp2V()ay+?l?lx9;>vbmaV`Jfdq; zJjOa=EVgJ<^N7f}O&xPKwYTck7y$9OAOQ3Lr(gg|(!1KWmvZznDS9M8kh(;F%z8i& z5(Tp)6BU4%HT)UwI|z_(pVmaN%()&bYJOib<6GwEhxLuT|B7ySirrS7&rOYW3O~{*stZUv=RPJk>1TteNvoK?dwao`g0iNiZC)3NAMCJV7ne z1ZU4dnqW3LtsYj6sA)$$2jQ9GIUX8}=WmYJXo(FX0mOa`CxOAy9N&P!!7&^|Q1o6d zqT@T_%KP0SICPG00`3E+B7h@>7kE>U-xw0l)Q{zGyHlw}3`=2hfJH>#Nkd_x)f5VY z*cU`zwJ5<@Z3J6vF5<=iEh1iEqwzhGl4MU1=Mw!6G)<8%Z2idy^r60Ai=(x(zX?9< zHlC@7JOWKVU_&&epfl5MrE)M}5IFJmF+z|TTh0DtIND4yCJ!>Ewl|)rZjO$j@6C`O zW7;Muz0pa%%`+lxW2RImqEj|?G_uC=o1!g|cqU}%n*q2hD=fHdXl~}PL^x6AfET&E z1Cjz_0=mg}l@!iMCT4Vq#2AuNdQzBQN%^MJt{t10v803N2H%y*1J<;EBOcbO8L5Hd zK^enkLvw?*5nxD-;<|G%&kqaAq7bbZrPc% zlZ$~sK7`Q$aborV4K6=9^*&B9S~}Y|LG6aq&NvmPPGi&SG-qj!pzj!xs1aH@RrnFk zj;Ns8GAqN(Fe!FW{hrMnQ-TncDR)T5!f4I6a^AJxY@%T;$&Bk@V7 zuIA%X86B#cLLhOI0F~i26`Ay^ZKQ?UUGci8z!l#bQ z=P-QMOE^UNEJ|V>v2N;zS4FeNlxdYT=hJ!jJQW%pC!O=~(HHR1`5dya$c$Oc`{$`+ z&N|UN3G-Q;@&0+hS&jmV6*r&@AXiI5Vg#m}gEflJ*j4;+y2wJCdg%3Mse|{>3zh=b zsOrW+uJ-K2?6rmTOmQMnn{bP8E$9Swk;IM`Cf2r~gG!4EngL3=oSuMiJd7>e(wCvl z=pf1)GU7O4D@H_3Ek0sLOLvR-4P%bOnAA14Bf2aqB0F^m{S6*loS&f&n)$@9+_G7e$3E~6`@6TQb{gL z%0jYg&@9vIw1vdMDoh7)aO>#Yh~VJMHQ&#UnB(9mABUcK9j@5U`wup$JbpIKoCzgC zomZXJT6FgOyW9y$u~5ANK__%YL7~a7UU3~Lc{`^l8iV?8o()`3|4kv(5yFXZ2*u-s zP$`X=tvIz7omT(OX-FM)erD9-qCul-wVY-UNzZBKDvXNSW=sG(;e?wvnIy*22(cPn z*^sd{Eu4DVX~r4qVM0}vDI>Qq;~`^@6SiUOB2@2D$F7YjoMmMpR(-OO$03M^VDYsh zXJA3~w}iTmI>4e%!Mh~X)t+QrF$;}Y&5#-Eeh*Bl(AY0rz|Q5*Zss#2Tmq(8H_?x} z?)?Z^<+YO2_815XLq?|luqq7pV`RdRTTdf4z)l&Jeo4Lwl~04*PI*n4)*`i3jHqgf zO_OF;jIU~s>1%h?1${e;sL@-%g)Y`!efby{()`BijrDc)b%Mq3w-gr_1$-fyX!e>kF)QiWMT7*QFpc<5@2m9Dh-=mJZ=*^Jk1 z{U1C}S6R9fR1g^dt01Jo>$xr`)rz&mw+)VOg!q>7Ld;J(4m+x11vLAys&qD?GSF|qCBOu@v->2aFqx?H+6MYA-i!5N@ z)wSyWjWS2|LZ@&lsv$mcNdaq?*wSSS8c3gPn9|wgGdYu;HoQ#iMc*1XZc==g;1_c`5kCkCFPfm%N_wm6Y$g!_xJ3l+-cR)@cE79K4M z?_|8QbHGMJ)-L{F+xIfhw?GMOHPcNELgv}=a503-C^Md7bWsy--~**EIlhCp0)!(z z@Y~yhN@#4}S&b+a==6eh7+{VJJ;_+!SXP*A}8T01M`pKh@%>Pl@$?U(UmM#^8 zEZ=zP`O4x+>ATxH-r88*`rPe1wp;am|Gx4^S6wJAKK9u8*Q~i-nsDrwAACAnGw+*} zZE@CXpr%aCEYTzWgQ%k)enS9rHGXv2SbCBlx1v<`E~RAW~ta5H@BI)%x{=A0AD9fK-Eu3hMP9x5Zkv`)#HDR7{`xV8-#>Ni zxbClZ%QL@vDY+EAadwczU6TIQkQi;VD5rk~?H4_>!)1uj#v9|2fH@fdYDhG;SzMRB zJ{CtTHWWFA=<6&_5cl}2L2=h!$=ts=d%eYqxNE2Y43XA@uOAd+jq8QH?DbwB!CCM^ zC(T{2<}+&);8D-5*cHrQhHlHJ05XYNa^c163nb4nU#U80wl2y@&EK_&o*c zbHu5+dunO{EZl=rG z7Y7dWFgJHTfF?ri;{X`67WwYnTC5_XS%pHyM)9kBG5C;M4F^G%Cv|K1ed>Cw;wc07 z@deR+*%jsP<7?W3>A0lIcb6tI~E1ruE>2_u^k11ycqUE9CCzivp}uUWjT zzfK+3<3-djhjL~I*`9u9NW8C^otl0Jwi))2P}t%u6DeJUPM#^qm!=Mhk%?zU?Wmg+ z!(}1n;vwpk!vi@D{r+!TQ6HhWr-U?pq?jj5P&7y?2?)QS;QnV3T1$U$QND@A*yAvx zl6DI9lC5PC-oM+5hZXDHK6E23)}`F#wta^YIt9`3-mU}xA8l^}7*%=ojo;_qJ9B3y zv+pyReKMKJzGo5$WD)`i2m!+ukgzWSMF*y z^QYgtkbZ9CwX3l4@7DLeKfUw&?7;(5`HG6V>i#Vc{iLz_rIH#JJ9qV~9W7I(`l7=( zY$QfhW-Pc`pd)qM?)|;!u8gOD8c%iY!^Q)&%0!M75KA5z%R#oN=fJ7>LfQjJb)G#RUpOaB0@1DF!OxV*L>|(OY z%%-}3#SeBooqluW>MKTswsokzeZgnM_E=qx-PTyYCjH{|-~8c+LVZo`-m5YqY@Iy$ z#MibA&CUw(!3XN5g#1C?GE98|Y2J~(ayG6dWp@)VB8Ra)9n)G>T))i#ePJ~zBlQc= znzch#&LJA?=A*~VZ=IIa0eiJmBtcKAP!80bJlq)fyv(>KRoqACKYi-{hi+r%_RUXk zKe74x0rvFCm)OZ~r;iUlzNlf#;T>OFjm1p97x3S?AQ$4UP8IjMx51N{??!?7=zR$& z$YZ%fKA(t9(CoNN`^a6|=q`QW#d7kk+C!otj9V@HEp8QUGO_eQb4N09=q8D<2R$I@ zk4zI>(iKDX0u>&Qy?gX2pbA86H6O`W39jF!Z(8@cM`?Ltv8!_yV7*F6!fD7`~XWHptdb&#qvSQ?s6v=nwZcA zM)(lgn)2Abn6QTf)ZNaD9f*&b-$Lml1TVK}sY8bZnk=J)`YdG#bPB2tPaA6sOg=K`XYJG109dkqf()IyXAMhT;f3 z%|53tWPa^vU00>~11H`_ehK4i+l$nmK3#fNddWKBNkKEx< zp3>stpnb~Qged42mxD(V9!9^)qWZUuCsqn<-A^sF0A2e1nT}MGYM(;VJZ}Lz{E@9sE;PgQ3 z$foX7i|_=St_s=h3Bym+<<|VA6N5kNu$k}LUs+N>4|Cu8@tcc_C)xBlR}^)&^M?^1 z%90g;?`G<74BQI-19)kOPS8A(=H!?HoQy{x*WSq2kQ$R`yI#3Q;PRrVyt%0EhOVJ` zneNn1;ZK4iJn#%x1c8)+Z`O-#1VFE9H8Xy5Eqf1T1C^*fFkoFo&n&kc8$K6qE@47R zzg~l?zPf#dmE)WD#quV+=W90 z`T6c~L*pmF9EXP74a8g{_9t+O7Zrqp>R0PA#i`7>tMQcv2!9FqRYfqpML;Le6a`#0 z%ze3VjDQ7s>fjZCbarjbQq`1tgenDy03ek`B(zg1$|~=;Y{or#^?mCu*&Z{c5B}}y zqb)7dJp9u+p&##m`E?z?@7n9G+^~D$l#MHPv*%X-aNLB6wWVb>`MEz&zdLT?#22@( zJZdn<4$gSs@i*U?^KS6uLpN;Rd~f&qo4(0tH!sLnw;1wmf`9ndGh8vL93;GXBIA3D zA?1A5iseZh-vlBc3L_(i%}Mqi_GYV;Ob}eMUy{ruaC712QYMrF5Aux_xQ$`wocB{6 z2t2R9)dn7-0Uy<(BcbaWsuZDzWT7|2&7Pv6!bH3~&Z9&xI)133**D}54|yiZqL(Xf z(D~>h;hT?9v5hhSuYGO+P{l{HK^_H+LuO9=&jx}pqAE$ZxVLdv za}`LQ`TfEc6l7DYb1e;3xdp|XXkMfDMAYyt9S-P8@oHWH?V7oVOgXS)1UBCKK_S~uWNl3FMr)CbK9Czk~%b)uZ zY3iztH-3vWl_a9M4ic$G1?ZC(%ftnlY(_KcqVoO^>$fqJxlj&SlqU`@!m&nXiX{7n>HEJi_NdR{Mjc-dTXw{`EJIiPp`jW zaOzYA?SMTMzYe?oW7!6q#3e!)c3ZC8oRBK0MCcFJ%xG5;86km!&F<~cx{(-EiE-LEsW<@e?DLfue4 zIe^~$NGn_h)Q^V)Ly?G~Y>1nHjV&ERhOw)}@QY9a^vrsT96%@tnzc4GVm*Mh!Vi_? z63VVQ^aC9-ot6V87AkCdy9rSm1$RYkuE7yW_Q<;bXq^ zJEz}Df9e*V)(3xd$J|@Xt1GcOENP4P z#rdWoM6MsC-0`T!7)4bb+IiFsl}zSZEpUQ|j8l}g`UPdG%Hu$zK-_29CC5m-(1@&o zJPuTsNlhqZ50}FI4A+@#8jZ%-#vasiLUI4((Xi5JP#YHtXGeOtNXn?Fw6ivsZ7!+& z$&}$6eChYz{zLi#1|}zz85pgAfw_;}_Tb*%2Ls-sU|YIo?ToLj$_~$2_DQ@TTJqC( z82jCwk6XE&#sc>tpn<|?>tsqor3 zga0V&zs{|7C3TWL(H{yjb&#RtKF9|t2o8Bl`y~J<8fdo89vkASrg~VyQ|IaS^m)Wm z+NJt~l+EK9T4LV-`njoc1KK9gCI{G_6m>DfBwy${gh{&oZ)m|y0zPU{y8ol^RYt)x z-8>M6QvWMir%9$?pw_AbGiJ`BE>}ul#2dPh^a%YHPjp8LnJ9vVLxZ`Ci^w!ev>B0 z0gLcnDyHaXzUVC-if$Os#*<{ma}yHYI&Yh|+uP?=C5N#0AVlbO4lQwPK)7mZ*nm2= z&xp|cLRnE4QTCy!R;nY0B(adl!c_E>M5;t%BVK+K9ldD{&UO_WE7dPmPjz&2MPH)o zjka{fMFMVnqHDp?+24CF81NKBE93L795EV~yu<5@V&Sq8DUVy^>^n8Dqx;_n6-9J+ zOvze{mz8xx^Lz0K)_`YZdu~u|5aSf7@!W)ld@yxrol#-~#j?oAD&fC~4b%=%&Rhsw z>y&s&OlTcBSB~xvh>iH%Bg(nlDdBN0H)Z89A?^5F6T0>+sk**Otjb3Ch*;#2m#-oR zi=vOrRRZqD9!2yqp=`pE3D-{$aa$Q&KtXLPkcV(_aqjCW-&zmb<2>Y4R+GoAN36fF z3R|qqXq6o3id&yD=JtnBZRgnH;9DKcLHc42Yp~W}TDga~0_=qgBl*HXqb(U8l53y! z=6*PADLuMHO9}I_(?wk`)}1LblP89mgfLt-R9H$7QOE;7GL>i!kvT%5L*58p*?J*k ze((!bMf;2y?|$d}-_L4Y29sm=7UtWs`;WVC?aI!Yvy*18%uJj?tI_N=s<=;Iy5s2E z&n~+`u_ksm5(V;{Q6U?K__Z7s<$I~vS`-qw4!QWpZAWasunALaTWq||>=Q+eQ)9+5 zOQEer7Dv24xGZOmJ$)NgvZ}nA)@jJTD z-~KmoL|EVdQ-K|mU|PCjWyi=Qz{>ebK|E4AR$`|QH?DWV5C`WrjM0BtPoX=!Q}~IT zeI+!KvWiaOrz1bp?`!Gzq>=1Uc77Bj%+O<`G&A!<{wyUUiEGE63$k3L1+gSMD!;W5ou zUD-VkNKvZ9DbxS+n)F}Nzq(>sV%gjKrrwaF^KP!*^3}E&JDu*lYSV9@U;D{qB;(4) zG4<=chbFjo%>_&{Yy@Kx*D)D11M zX8CT*jON58=7tc;v4?!zCBf#hX1;mITrGDjJ^+VKJq@TQz-KrB^nx%Eu!Gi@FteiqDvoH z_tm})3&)qZzP>U2TuJ?fSDLm~mNvV?OK+LbuprLVJi3Y2&DAh3-&kHRr zn^1AX!mmC6R$jQMswVDUT^-jXyOg|z*aLjikG)g!7ht16p6~bi?Ov~cKFTab&a3j9 z{eDqz>Niu;-E8mI6Wkl69D%xy5CUGyd0l=jdC`Eluy2Z=3%Xv?Vm8WA{tIa5h(Vxn zkU?r19Q;sLXRWU?zaS3?^|7VeznCaebpJ)O2bmqQC;fK%rrXn3vp42`?ZOLvuQ%(O zU+lf$zkSYNV*mQVKbPjcTHbW)x`p@04D-AhA5}OlG^1C>MC>MMr0w8& zlO<^3v28{JtqlR(xk${6>#)C>0XM-Fdd7LCd4#I|kcXjKwKCO+E*i9&@L_8>5*7>= zzoo!vY>E9@GE!DFRN+M8`|1yYG(|3ZQ91_n(M2Y zy8W5W-;fi6|8@Wl`HbSLO9e}bnHlz1&%GuD= zR9N31uIhIct|{cXLc?b27*BTAiX{!r$l|p3V4J_s&+`pO&=q+CSgd9Hn`#l$qKTiO zB;X(7CXek&22ZfE^4!^1hTo!05|!t2QvzUso;B>df7ZQ??WrS1g|~{m=6YvI2bfq7mciu zE5yhu=gVzzGhK1VoG*?YT_g8XjBfVxF}!0xpH^;oX&vx(1BeiRnF=RBDNfcViV_dj z*V^mrYkM8oXvR!|Z=yU}UmF2Ffs~-pg0wnbDvoH%8CM=X5^?y+0oEBDFv&%U{1Vh# z0oef5U0+*WuE}Tl56YYbgUON%MyekyDY5#8Xy=FnM3BUrw^9ZoyapN!L)3(Dd?x=u z#8Xd@Jbydqe3W$lHYWIG};GG>5mDN>Xz`N;Ni8Q9iR zMZZR_h)U)&isFzrilFVFR2{$i(Qta&j;iVgiS1?DP0M)o_&F}8V|RMm&%bx|{qel% zHL2Tf?pm10n^V%lj=lA+I~>`%G(J_U(Ou~t6OW+Hz%je zUlQnkO!ch3_(+i_j`%~=pxYk?z(QSJDyqwBo3jJZ+&H0LQ^v|3#P*d) z`CtGNMH3#ZtqnW5DWWkv6lqalq{*Xs2e>p?9KTrVGSW+;A1nEb1V5TM{RiTgao>M5 z228#B>IvV8RNl6HbR>99&+_a@Y@OXYT>JUK;47vlQ6tO8&(mi z30=~T-sni9Wwje`ew%WVcKZU_p%Xgr_l-kpI$Q0BBbn)H2ThkzQ*5$Bx{KxxR2iJr zTXN>I;jg$a{j>Ccr2q3>J3}9b+(_QGjhh~=uC3V3244B#rN6fC*655+)XrGs5BSRC z1xss0P*&y4m+B?ldz8z=ZY72-A+|t`kR=M;@gK&c5E5C6$I#G?LF>>W1DFpcuu)^+ z@~JIcAaA7e51o?}lW#uL9FF4CqjLRoCMlc273G!*pMR1J4Y^8Ey|g*DATRyP^qY7f z^hHoPb0hIv*PZ<1?yDBHJ(%mP`sJHH`)m8dMxFc7s(HEO1V#d9cWVSyO+&-p_F|$l<{) zz*D1JK=AJpHRuN{-v+_-@@<$L8mAd-7Tg9VluYELL@G%9ltEc?u@g2Ttc$mLK`!L3 z%w8{I_ous%^B_-iIil7M>>Hd*aqB@F-5xkq@1+vRs3E)>a@gz+hs~fixv1;4*`ZfU z9+wCELaE(qo{#jy)f}HPCeTF`fSM1U&H?K;c{?&I6kB?6&s<>zUtQ{s-Zf^Uynalc?&056Y zS^tA&_q~(|1}BHpAEeLJy&QY?<^}IASaE31N^A;DlU><9?{XF{dpRQ(Qbnj^$x)=DuUFiJ!-x*BgX2C7!xE$q}<<2 z+3_ZCTw=&CBaWIYKoE61*~-&O(@cwt18UF5SXH37)3TrA2i zw3Z@#REhjPBTE>Pk-!j<;E3~1*2O07$*XjFzqdt^?c(&CL%R+)lWgz3{PGuSb2|e0 zmljo3mCj3_k>z~pl53V;dfD#oNuj3boSPIuUr4`J|8m~GZ!UOe!P=`gt*P2soNOM< zXAxQ8OWW4mxp;aSbO_3Cejq#vnY-XyUWuLetWGPh6+8k@#V;u>b~GHt8;~D{xY9i8RmqvyEYn@4r%WH1M3b(BF!~<3dlmA!q<-cXlt^63 ze2gS>l^7?xh1^IlTS;jOD%)J)$!Biw+?%ZW#^tl-tXQqqJh7wwPBbmwElZ%f$z`?r zeEu29OA-Iw_tK@)Tc-?uW#g`+4fW%`cZK}SA)j+nB+(v?7A=OR;i<)c$5ThC{}j;0 z9VyQo&($7Y?ZBp~^5gr>pfLLS{W@6=ddR`3c85i5UITbFBZ?A;B9BB-NTP_~jlaqr zR)bJ7R9;c|d3gX&l;uHKB6gcr)JPEtI+7EdNKhgeb6MI(RxZl?8&Mc&RXmFx$O^0}#cTCaB9Y&F={3(zXnbHoSS2JE z^AK$8iv~@IgAeq&P>Y2JKLkNhw_|kJEZZN|b5Z=8vQ&-(Fqd-YB?I0eE^Znk{P_@m zG~0*tpuke(Z+?qj0Xoxyi>6BrZ&A%u7HIyQ%cwYsL|tQ$i}=CfneG2}UGM9&F6{y< zMIZe5vB%B_^-uGjG>^c*de_TMsno>gNx!;t)lq{be(;iqfBO6nE;$&t7>=@q*fdqn zDyr4U?B{U_-~l&3gLc%|s{$+P6fc|NWWYc2uqY!uD&LnM0?b~wpZHKT($rd>8hLX? zAOM%`&o_u@PG6R?R*nk|1ykX?WH5IqEEXU+n|WwT(iSQY4GWTaYB_%o3eO8~VNTGv zXSgD$h5OQHCpri{J>bR7v4wf*6Y0Nw<=U*{_ys_ za)m}qdeWNjH%yp3_mUZpx6~%TF{z^Ez+J1pU0G2pX@~zquG>Ic^tdXJ>svl0wQ#y@ zI}x*~#aYmxa_%ds9Jkjy6pq@%;VAahd@n`5o7-#kN5f*E-=83?Ys;QTxox=r8Mh?8(8{=87Y~eCfHGb;Wb0bnWW`_| zwVeAcfkZIaIvL5cjaykcTT5VYQY09gF-!wxuej(v_Kyz14++y+78; zcp4bvRb4>R$jiwBy-N0qGVHWzDLC~}sDqretRyWNZTsUuI%_na?r;EzOD|BUFc7(<%i)5g=@G1!_mBe>J#*T!52m>1^VB_Mml~kxT zmZLg?twIbI+8@D{Ey-oV?N1dS-*NpXi!OPsbMqZ}-#SuPTkx~3yMKMp@I!gGZBnh9 zHM!HycYNcCvLer**%eyes$bYNaYy~VzfbQ@|8-rgK|1k=o=N^`>HQhDF)Hh>f=vX) zR7RlW&VBe9K!p7BY5Dir$~z<5mp+XeeX1s^9q-ITHBl|r6RKUQrP>w3Q>lWQcBxQ0 z0Jd;#%=--Iz&aKOj{w~OTVm{T*Oxa0Y-=I#&^VcBb)5lHA_6)oxhkd?n;1(y#b`G3&ap%CPv^@5}8&En2 z%B&g66DV)+Zw3r`>+D4x1m*UEIE_xF-abVz24C1oP?`N?5S9OxtrB1s{~OH&8S*$W z{QX>0!OIKUE=k{=o}d2r^m7LGBW8c+G;3z1i)&hD9lGtJrh=b{-})A9XLnI^!3I}i ze)7>h@BFcHeU47GDSp!(ZK+s&Zgl>{H9sD0E|@NtkxNwe{rsZJKI4UL>1?H%)h1V} zWo!Es6`^%L{qu{e`;2sii|pfR=W|r@fGNx6`s9kWY@Hvjg?{1MM-ZB=RKJdO|5Jc3 zsL9>?q_XNq!CQ_o)KO)SeL7S1qXpG^y7>iweT}^rc zo`G`S^bAyW`Yx(s(fbA8=e2rbY)SO`=*v+d7;TJVBiS+au(%S>L|10Mk^8-JCB88a zSMp0rt}l7HL`xjy<-OXL1>3!IH^FeGokNTgolc!H|WhX1jZ9>#$e)EQ}NbjdVWIB!w7f1!^TJ(GPf^(S^ zO{QxfUp`yIPMyN4lm4E{$+fC?ApXDo{O<@|9lk@oI{hbU;}>3yZ%Y4(zG|cVRTnM{ zuU0uP=#}d~eUz?GZK9k|h z;s08`_Yh9SUFz^HPs!ghY1k^?Wv=?B^cLxM`7S^6Ei5WjrMKMh=G*FtS^IPPrr5&(2fO2pbZlY zTc~16DFj%03+kYyx%tYn^89cx<`!&I^DkX3ZAi5{TCUN@5ANAfIEf1E~N zpMUYYfW?2&ccs;(r8A;IpTpxd^2W;C+G)~#MRlgKIog2R<-0EZ(o~CE{Z229$&!Dn;XK-^VQ$0o@A|Cr3;5VevLF=t(y#8 zn543#zoLBmr}xToJ}*t=`ZW?~<2;C(MT=xJayFf|?BpvDaKp)0PGe6;8-g=TbF@o} zB5s3Rt16TIYJY5Ee4VvO>QwvlC*-fQ6-gSYt!`>ZM{7M^XjJpn_g$DQy$a2J{nK06 z<_i}-tybTco~<1DGv~7is{I(UVR@|qD7>|=YJqs z&p(&!r*}YVKgvk$to*b$rEg3xxG))db;+mC%Tha-zH#_A<;W+0m5*G8BNdq=JLMyP z!I7hxs|w{KSKvr<=A6BBWOyS!c}nJ-C*&iCapbPdkq_k~m*YrN=ExrT$Rr%`WR6@f zADN3IMVTXa(~;scMYgBX1$^F*z#a`rm;o!B#dp|DPPOc2(YwwicBD-E#rlut6d%sb6{%%a)MshS<4 zp3^WdnqI*%K~ty?4^RpUm1UDbjPBOL=IN=PWBa9E-iY)gr~w`sKybD#a% z_TLmezkl$lV}E|*{Wthqp1$jeTPB@J-_AOiYMk`%O!xn#KO(ej0-kdMo-+ny`ae^J z))45ab~j$S?S1y`b^+}Na`-}NoHR`m1W966jm>T2?K~>*m+!Y3^*|$Mr<}G_D3r9N ze15#x9C$$tZ376kBBk?)d8!EC%rpf@SO=Fv@yW7Oj+3Rd)+7_XVeBluYM(EKgy{>o z(vkF~ES99t8TF2|(fXSr!ROdyH2*KdXE@nPuG0MBSy?WCA&QvSZJq)4$k8H(H|M+% z)-aXIy&`wfGQVg(vt%(bB^Q%>zqpIrgo2bXsIwLsysN2(1gXeD(FTZ*Ff9l)jKrXf zY$@@ZIN|(D*B2y8oVR*S9UI%*Hyqh{*HgKbDb_f6{@GwjNf3YcF>d;*hL-8kM|2Yx zwO_em<}Hu>;OoUJJFjd>e=Iza-dhq56c-1=FcFI6?}g-xxFpL>HS}TE_D)B)gYR^A zyZQO{HFo)>*S^iZ)4s=k$bQ_eX_Go7K7p5RX}h#bQn4NC2i3e#{4AS|MYj^KBwZ^y zA!wX#XTn+MY;&r#&VXTn&D`$~7%?I#AgiXMT6fTHXmVY5IjJ-DU)Pl zl5M_ijqM|wXy9yz*=nwa%}MD!DGZv81}#p5mdXix3cQ>(qvwB7MrjbEgv2sNsLuS3 zGC*i$MI$4R(K(18`?*1pJ!K89Dv&y8pg{03pGMa!{O%lnDeE_Og25jSo4k!3skjuU zT9lE&O1hF+_T%Tr>)!L&0r)SF@(WW{dYkKzlH-g2* z7`5VkEL^^3&ZK7lyy&!P`YQE?Y3*0uwXyG4?#@opnQg*m6G`#)OWoDWDA%c82c|$YxFZcT%#G*Xh|1waWGXWY0VQfy=a&)!;}%afovNr(RNoJvfqJdpek@vKoolQ+w?p2d-UQOeJ}nISc5cO zS|nW|iN(TnVUci!Abt{Mf+oaHgieLt3w<0C`T3SLmR`#?%TCK4%OT5gi)OxQjj7kP z&9u|B$8^Xfv2{6Ha}MXcnIq24S(U>JYovE2UV~9XKdrxu?9T!dbcTEyHyg&S2;*jx z3@$_5fQ`Mo4Xh6>6Acj+Ch4JYq&EaaR-_4Q3PnU0dUA!sG5=n$dT2ZgFrN8)%xu2- zkeNSWW_!`O&W}NLdEI`U#_R7y+uzR)EzQj;&W~ZO#N5Q7VrYk7L~nZxEaeJmWPxpA zW@278(5%D>G%uI*Y#JTsE^NHmLyM0*+M8%4q5;Ri(>Pbt4E>UUu2p91XU6*BZQpq4 z;<5hm54UYQ@WXUuWVHXZe)a0BPkw&9UmMrmUH0*-qeG4etr6MQ!Rsx+>H+l$1W#+w_i?l5 z7SBB%VVq@}Wvk^@3$DxQ&gsJ>p37FDp|2oxhPp%i{OUE;JYU_UMYm86R(v)W;wIqL z3nOf43o%W|9ZH1iLTw>cDB&U-98b8BeVBPLKOxqtgd;e&5_sn9eU*l3SVs?P3~ub9 zIlz`3kaV1;bpV6x+@@n~s1gw-8HI{`cfu*Uu!Xmm>~)kIhZBrRf2*Hw_3!lW@e3Sy zJ*&aCoO2**^j6r(OzVrHta{WRd2iHC&)}l4)6*3@J$wv`K&o&KgNc7K78+ev8r;wh zY7^0T25A2={BG1@D+b#PQ$Xu0Spa$ZWAe*y!_oZssI69VWtjB;z=%7Xu8UV)hCG{0 zV;2uUb?^S`mdsy&&ALEcu@j~tkumB|+_(`&J-52px&PL|^Q$sOovA7t{O^G zm(H5LS--lhTe0yS9iOxDg-d3&v<9y&x=GkOYUIe9KMRUSn}9`zjb9P_;D(JpkXb8L0o>bT$WnB%bH=Z-fWe|G2=+Sb{&+HSSoZ+pyk z*!FYVo3=mObb>~wJD`&6DwU+ut2B}%xN^xPSYQ&uFbO`FsBac@I*oCwitWPAMs5`o zu-5Y`PC`z+BV~Kt&NOybXK#axcEV1*KLS(^uQhr(84rWonHgrdoj*=UWwa0vpTR_i zIVKW(W}pD>$uymFGBLgZ2*j9XC>TOYj}s^+R9Ok@tFer6k(BNC6wgR#`_9+r-Ch6Q z(S!L-iPgcx%#A(mTkc4I5-2GShKftrl>UJ=*RVgPZ<#**AbU~2VMcq;-PejmilHtd zUuY#f|6gF%`mmUxl+JkJwf$Pq&4?B<)#yk{A-t&cPJdEWh<7n>jh9z>H+w;!a9a|V zI*Y(m28SVLm}?OAf`&)8IY;iX+*fn|nEUr!l^~g1Cf?*HF9{I~#2kf~4TwJ^y-Uwq zIlTw@q2H!#D8x#jhRbPd_K5Q2v@DKNAT3~P)2M&?{)mTvu+R-V z?E-OG7Wgqp8f`nVLL!Mw`z(XnjJX6C$Wrf}arRvOS=lS45@~p*8RxV|ZvBdh14MGf zA$2KkKCmG2PRBZ>!Y_{JEvjo;*1mCL`=&iJc6{wu#|)>A{^3uXe+R#3u zr~f&2&5oV7{AS*N{x;Z!Dp%Q@5!{t*4Hy$zfbwoXXH$?zlVYZgtOhuW?fosGV+| z#_qN!?4+`tb|tddW!Gt}Zfn9?XKk}~TDz@%*6r3^Rvo5;5Eqg{t1w?!BlHT}gq?y; zVlEcP-bt-&K3l_j**3P5>CjZL@HvdB8QZ$eRw9c-&irU9Cx`e#zXgnn?UkdUX4I@6 zfrU13I(GTf8lT(8`x;0WIBd3wSGMesN@vjcy#o^oGaFYXEFmU0MgA~3M*q&i2uG#z{!V+vGg9%6Tu8S-u z{*VpDKd;hHq!8dKK_O9&WUL?6DM{!4cLrjL&GiV1OkUHk;mx((VY8&EQ9@1^g`9pZg`C

    7arP#`qi&vcgC^NF+ zCmVho@T{9Otouj7Dj&Ve*BQKTZCXDvxH7XwH3wsxS%Ui^J=`(&{^C3OyhU^6aG4Xn_q=e95^;J_vghN82Xv1f@n-E(>7}~ zNiT+;Mo_A9RmH1N?Wn6N_exPm%qH6N@)9m`nnE;$2y(ql^3M0J@qXk*kn1I{sfmKz zP%5h?rKBeN5}{EI7=#8)=0X_#7TJF$hlxh|iy~V$JZrM^nEMJE@tGL6OwkBx-Gd;B z(F@+;&ljk{Kk}CVQhZ(+RC8oyxc(78IZ7LQ;3#$Xv@fRUcVqAElTjD6>Y4 zRf%xcOPVw1OT47?Z?eiUe9wq-U?tgo;R7`xN!6$uYGpMCL$qiE*ZCb9S~-#$`bkYM zXrr_$e{(*+FtRSPH6lziEi|n&3BugURh6471>|sQFw+lImNP^1VQ4@uTeh!WYM^79 zu+E90Z%;X-xGTOhz9%lmQAyQYELN*HO_F>gW5!)BO9om4d?OvQYXa^-A^@J3D-aI| zy@BJX06omsbCcPXDQuu97`?rSs${^fEI>xQtSqnci`Ms)d1|+_&&hL6ciiqxxV?D< z*0sSD$UvR4>=Q_bKFep3bwtM;v>EEky3bksuCW2XJa_grBqot)r5axHwZIqwDs_>= zEL(QatAOq~8Lch!&}khu6XDbwBNi2gBL)U^(nJCSwBfur>d$P zGIM>w?Lm>ZA4Y9q4Em>&tS&2WwIUNwp1TJQVjQ>R3hJ~fbF&~y&3aADE_wBGYkx5G z&VbJh#nS6@xTLSu#~0Fvo5>eR_yozvdVR;?l?<@;sho($n?oKFZ!agO!{YQtVpa<5 zBRR5)!YTeBWu{Nd*>I^8aYf=0fr~uDnz&hG!J10*@EJhIXU&QZk}C=n*-|At{J=&P zpTBGPkFY+LDir?6erEa()iHL>( zfWFZ7(5}$l&_L)!NTYbRKnSd>tedUC%5z*f@tkCim<0kq%8>!UKGk;BF4bPufa-)w zqY>OfLZ}nk1XZ7~UDze;6$XTl1vQK6tMvRApcS$1SYK>=Y*%b=Y#??bhBQc%MK9{O zHmEyVD;SfQGtgXwH=Vj}9p9>BE`SGsk&5?odM{WY?J0v)>?+<_yr)=1`C<(%wPCD@ zv!TJuQU+Mq<_giG=bOaIC~)c6Z!&R{Nm=7AiEWdZMsiCDsZMH>R1&n(8z^>rOF&G| zOXSt%wdJYmj$n!uV(IQk`SRdC1=#Tb>kY7s4G!dufKnM)pAsXwOQbwkUOW#?5}(29 zI&DOcfjh`xg!xR@YXB&I1r(AFP;A2V5z#&d*WoqZ8HPZjwx905IrbJatT z72Yb&G_w68{<90kR%$5|UCI5ZM$n3?N>@#FGMve$j8$L;EmshUSKcD)`8|Pohs4ly!)t}1uR;O2P=vg|Yd1-T1 z%hKu7g@;I0-B(@p@K^2vo_VFd;pK$%Cd)yBX87N;8k>HstitVwhE9Nnj)#WUaV^{o zzAp8LXigQ7#uHVHU*x{R4V}sFMklZB`MdJ><`3kb$k%k{b?5cvZO_}4w>NJf??j$P z0;MJHOghEao$oq7atd*K($2qbf7kwzUDyWj-;hBhdkxzRI}Ljb9~o4Xap;qC4tu2m z>4c=wsNAZAs!r9WQjIF~$0{{j$gksX-%Ej{XntIas7+Out1^~M(Wsd2* z%{8J8>W+_{%7J{}vEO3hrjpWodbQiMJGFbXq81rWFBgcE`@APASOwgXVhS}9?nEL{ zmuO3R^w+%30ESX5V!p+pqy0k4WUc-}l|PzMdEzr^z)9ucSb*z5RvQ0d0w_}evw)@o{Ro>MC9g6Y zM`q?h@_#%N#_!v-;=0)@I+l0MZJSq^*jO}e+KO(P4QCr;cWgldMxG6S{m)Zp-#Gu1 zjMvFb4P`Bb-pT2e?d_MZU*6KRtgYjlcYbr?v}vO=;<`IWW(3gv%!~*Y5yqc>qJ(CI z$jwVHM=kyhlt;rZTFcn)h?V-g)C9Pi7V1E%g}Rr>9)fut02qzMv8wegxA8e# zTU*QAnJKF?IdksZ<(Fan_qC*2D356=C`=|>n5!k;!gsbXu4O4HM|5Im6Bd%D?xwz` z?M=Iy_BIVPN&NWfQ}Km$3mT?eB6h)wckG|q)X_e`y7$%PbkSwbl&0xK6R&Gpt_d>_ z7fzY%$*|-nwfGks>D=Q~b54C3p?z{ps0m)l$s!KUiJO9C`j{DK&fuCeQ1~iKRTWur1jyuc$mU!2l9@Uhi%7CVY=OT# zqQy>FY}jT=LSm`53T{ObolnLjmcB&iYh)4t0c)zPWfxA**pYt!sDJS-e?N14<+Y`^ zk_N9B+HmuI4}Nun`s7cUxnhRDS~q+bsWOZ^zjDq4x7;*uNyp-@OPd!t?5jO_({H*j zTu~9tD<9rJ+1m)bP56yfcduvQ)pX;rb=PiyXZ?d8oVw-OP-yk;-)SX{@%-+hV7RzA z94s21uwupK>z7WM+|?GXn9-bCvTRO8G>Xr>P1e?nM8#~*4r^;^19}JuN9h`;@*> z-gw#q59X~wDwvu;Sw8h)GorfkjJl@sUYeKw4@-*+XF z9jjZ?zh*yVs$X6D-CK`keGGUP*CU4SfGq{W!%btmQ(;?5j~a=Q*gb}fXw1X--WrD9 z$q5q!Iyd_ujV2EaWf?&>SZ#x@U_6)%id?Xq#y4dwt24KmJI&o@k++u8P#-8q{tMnH zGGYRQe>pp)t*Vi;Us?lw&Qt_%k`D0QsKo2uiStN&cel!aw z{_1>qxswsew^eplc2^3Oavr3TIx|}+RI02jVl|^7{n(XwI<^9P&-*bRV1Qjg;TM9k zI$xVlgzM0;e{T~*B)L4L*Nk_MPmHe{-!@)_PTL)+Kr+%B;SWVvTclHt3dD%ro$m!M z(23UFMU*_h#QY(QpKhU@E(0^gO5AjwHrcd(-DIsOFCWW51 zZbu&|w48J`_H~}iD&&g^i zhg7h0pq|0j^(dBZ6Ov9Z`r0h z*FJUQ*MC#=+&)TH^vvkJW>LWi!;&FvA?8RCv?Y>su|qD_=IV6qa_x1Ai0$F; z`MiF~8yN}EN12NUYdRw^!(`K{M-jQf5nL24(D2h8Z-nHj>d& z=t1%-`5A(c6AkK6BsXHVB-w8LBbt!jwXVi8Wu|PT25Mtju23jrp%ktV8Kl+K1=dxQ z6qEE&DQr@fGW2lP5|M9}|$|zv}rT8fDCPt^os7ahMM|k2^JM?7iUR2?#bv zX+u#}m1>e|wo1H8b(4x0T2*W(x;7<*PE;ogEM{OaBNO8AfAZO>{P*%d&KLNt(3>#y zCYO>Y&>Qccz5FWVwQuo4b8OwVKHGNNF56z)fbE1$qp`3~OSh%ZvfZ-FvezM=! zsl|Nq!1g6XnJQ@Y`#FsYe3R&W6MN6}F+MuclZ!XqGWargb5z#w>MN&(8!;DE`b|`#2%_MtLxWeL3kaN>AnbD4Wg0_!&gM{%InUyJSdy|UkqqyV zLCGvfWBAaYNtslSP@~62gra)zhHY487R}2f#WU;7@HaCHjKZ6a-nc22NrqhW*2K)B zGK$S*A~Gw+$q!=QHL35-_w4lWv}U~P5Eu*rzbbcgF3gB^jg@DG?s4vE?uBk~nu{%T zZFTYFNfS6wwrdD_L>GvCrp}7L${&Nu-&lBu-7nPIAPGh%dtsOsY;q8 z&6ZY3S4kSAJ6%#-N=o9p(nk`{C)8{}&2ClSuYOE@SpBB@&uaB5HLFprQt`K{?uTJ= z!ln+e=}$YH=nCXShmp&l=G0Eks}0cj=P2W!vROp2*(*w@j#o>9!;Y~;x3S`?pj>40|T#0?7MxQ7fpev_7Q{6l&li)AUwm z_|YOnO>m9Dlt6-la9xVIFwBHH)SJ&_V=Z~q2?xO3mZvujJb5AXhmzh=vSf(6m-fhER64V4WWp%H2T^CN)VKrQ;3_Be9c++3O!kLDf(Q%fz(cdc>pqjaLZ z3K^5g%zff^ahJGP91u^48rGHrdp1HL%2>J2d0C?@p*`#nlbA6`x(#wX(s#2DI7Pn- z6!t6`sDge68W0h3_o;M<120eI=rumCPlNIg9-j6e4$Asm3a#JA>uL@YO$a1Sz7^dB zu<-3~O)xlYNO{{iAVzMKIhyV7G3gNqDY^a=o|SMlGLX+Hq5w%qZfXPzaxk6f<6 z|1FEfj-mUE>ip!}iuu3(sVERB21HPF{%i@*De{#v7?ijiBWlAQZ7-y%C~3fJbZ%Wj zSBL)2qmaK&qj75znmSF}7}y`wEzwR=S3~MvxFasTXjPf1B*6kIPPRD21Y~D9pc?Qs zlBQM@k9~jov?tJ8A3fDFw#K9#sS_FH;q4D=H-?lc0cs8{|7XvbM`{o<#UT(r%?ALB zXkIAme-;fV5{`xNL!|^0xgK%(`Hn}jrhX*i&52l6sb@+cF1-dxh9Ec5pRli zxzlAssa7?1JLUS}lZJIu*9|D?SirI!%;xAKMGdbsr9! z7*;7Df&w6%GE2O?AzH-Aydm#)Zh$+1MOT>yGVufrH#lKCAp3kuT)K0-8o549kesX+ z@hqQ2J_xj?feWw5GIu@;^)JR(nvt9Yd;IJ_Ik zNXiaX7f922DEe4`tlDOUqT8&WQFImm_CuFiESEm?HVm!2Qmy>A5O97jqG^-ykUl~D z=T00`B2YB=+zDQ(keh3!_!B#6QL!UpR9XyD9y2Os5S(Z!ob)TUyw28UQ^m=|yAg>Z zEpKysB?Id<9EXpB5}SlUFxW=$hcU?jeT8Im+2S?<{#yA60wF_OfFRCvy)t|f_6d*D6r-~VTWWq>?mYU9yZ$crDndK%VeLLS1?S0 zoyy`z!YM5VMoUpR=t>9-H>(7J(jNRS-+=Fg?>*ngKGk;AmnvKj)hU!4j`g1plK)Iw zaL+#Em2)5d1c&KPO3zsbz{RB$>=f?m#fvNRD^1%P$jNU z>Ra{m^;EBjuv-*SQP!RcJHZgh^(UR!{Tnan=IkUQyOTPUIh~x&I(Fo+al9B%`I@B98fpWh!hkgn?P>P|h+InO!gIm`EiDRD;SWW_2Wt3G9y_`=E9+w39= z*4a6|;-Fh6XLCP`%0d)e=4#nR%8IQ5aX5XTB%nDy&W^>x`IvW&Eb{?gyp$>#L_s7;6H@*FC zE;+4h%_^&6pS0lxv&Hk>2g7%SmkgLtcg(FER;`{f)^dVHT#2ZN5@Wrw?J;pJsRI5Dq8r>shzLvf9I3mgzw~frto)Yk)A)lWwW%3ml${qv@M^E_--R7U-J`q8WZX zU^ZNF%VOV=*|C&1o4qxcW_VD#?C9jz@AF#T41GNb6a(k8fI4Yj!Px~I;X>pEc2Y2h zARx~^tjc-2(=^+@$ezy*?1fe}vAM-di$$>zwNh{`s)4fr< z=8|?~!<89YgE3TOnfZbtXCoF2V390^%oGvLq$v_!EQb-@a5Q4I(EiL3bd)%4Pz18^bS6L{GVA(4*}wd=WE8un{jUD>f5+iWLaN_=JQ zgYS_Xjl7YBd>M5FLVg@su=E>Gh-I{t4$r{n8#ibP9_Rd?vOIaxa~sdTU}WR5`Lz3c zu0QpGQ@ifH=GE<%JuiLspV=w-l+YO)PMwswCg)xL_n+T$@g1MD2d}#uHCA7}oqcRD zHG^AMra|i}s~)$bcn@aWP=aKhBfZA|uWc+lY^*^O3$EW0s;wwUn`Sb!WKN~fFcXUm zEb;pdEPEZ9S0bz{Y9cb^0?wIOovy8L)aW)=nwQGu7tk;p>(tI+>jiZAe_>_imduZt zS)f7&+F}$cfdjB|A5)LH*oB$~Q_3WEh>M{qj!cv70OG??ek>BcS-}JkA$>Rj6l3KM zcQe*N5T=u4fq#95TA&wKO3kRQT!ngc6s(ebia#6Meh)pciX zo1o3lt{%>t6g9n5{t{k=u~^O*`w)ZVsTk~HDNk7muI*=RC`8fnjv ziTpDn_5u~s=P`y2CEh>xb6{-Wj|3l;@hpot|!OQ5PPKtkJu?q(-|{_h?qjUtYg@)rZ+j#A~jdSySE`9hdxm zq>V|HXU7ly$57-PwG;4i^yu0IwRG#%%V!raD()&?UA(qF*32 z8omuO{O4XiZiaT0FD_qIzPa3(FABXgvOcmovLj;3myF&SS|8dR+7UWBDAvKj8P-_u zw63>qw(hV30Iw)@tPQq-$oGjpn71e;MC9Q#&Y$+?Kzl$8v;p?HOyN;aT7)PfR;^CC z%wY7kN~RK|0MF=7#aN6&<}Kg|k13b7NM)x+b2#iPsMyTf)hI7G6-#|#H6@zFpja+S zZoxp+rUoTkP)!`wfX_QJ6gM^5*ecr&RGsrO9@1Y0wjk6d=PZ#TJx*dRalCHmOM*== zC?;L@YE{(=IJ9&AY*Ze?d+iz<4o)Hb9Hi@zIgJC-!_ZxXBOpdXudNC|A#KS4kP!#3{mIg#L#wm|bU9mhH=t*6}fs-im+EuW+U~R#=f?h))D(b8H}*OgwK7Sj{TtDCFa(O$0#WigJiWN%Uw z35DZomERIKn#w9l8{~L9_3Tci9B~Merf@l`Gep6l#6m`6JZwmZP=`388{1yusUL7S zlR*K0RdaRJ+r1BapZ31wHHasBS9(R=&3aAj_SnO*r(-Y0OvE%72d)p?9e6CTCGc{%sg9;!gd zLXTGP4*-rCg2U4XYXMF#c#9Wq8rwFmYaC}8a^aHTfD4zWpS}evffNz~6%YlKLW3;7 z{Vfe+@%TwY&V|eKWO!6Pg^IM{GQnLiEJ+J2bC@_79ysgiOT4LN`|{3`ZO>IUo`-DW*u_w-prQ#CfM09?Y#4+UNCa()9j?YOI^&%2J(AB>+C~} z2Y3U>8Xm1CE;g}~6K5n=CZv-k9Hu&WZUX!HPBkieB#I#h0)w@xUkd-_FEJtPJex)K%k*bhP6>JsCmc-_Y z_6i{7Qyph{E`du=-r9rclr8L#!-;S+>ijlKJ0w}+xiJ#Cy||BFDvnCh8WS@i;dlgE z8iY-uV5mGK9quI~^0wh-J#1mmR+D+4S>I1?tY6k;p(upaT26cg(*Z8wP-Q=3T?Ok~BgoQDiBmAVDV z$W>NBD^hopVRb@B^A(zNW9~!x28nKXF|jH^PI8P5g$>~g8@>k}?zEI6hi-&Zj8`JE zZ|}K!=Qi7(7e7Ckg{8-X|E%Y-TX?YW0a4}~&cE%}hTC&DVjeGot_4In>Nl=a=O>Gr z(Dm9<6fUYPlElf8xe?J2@kNr6rpUy|$;ja-53IAyP)#5s_SKKZd#ClS@ zCH6pRTndOOF(bB#v&BVXm#Bzd08M(s22R!?y-WVgvG7c^tKmYW*)!x0W#k1Vcc@H0 z?{m;dLx=BF&=`$#ghB)zlOresW>f>k$+;Uac?g{mR2H)PTTmf|J=*+E^ta5JY^1b7 zYY1h$Ox`_MYWzrgnVw@Cz;_3_jy{SDhU%cOG$q|<;q^D57GhW)!$nihI7#OUiX*dc z3xCyr!;U?-Z@qtf==t;=<4(VP<;;iP$?=E$W%u&aH$p8xaLKL9r%pT9_A^mlmOgFq z)LEBxAdkPlctl+^T&^8Mi;#l}VeLU0OTUm80Ff#tywNL`qhp5X@u60&$K%iVsJ2qI z7*r}A6>S3MyI)0P^^Cz_h4+WnkP5jrqSq>0Jj^BOc~1_1#^l9=5Jp%53#VVT10l4X zA={OVCA{(%?2MuL@PZ2^B{NiOIr6649nuZ}1d;Jx%x3h=#-6}LmUNtF7{WidA5nP< z))P|8R*(ZQqL_G)X3D4G{Vnt!<+W2`Mi!-Q?gn%;L3HQv;&t?NIjq7=`bA&!mgP4+ zM$0O5^*Y-hvrF1=fyVoY6UHsN=%pgD7F{iobbW}ZfL8)Sjg*nAI@B%XNDqgNotDZD{u(a<|-Dzw^X%N^;St%q3TMknwcoBDHZ5D1q%`dXKr+= zNWJ0T$&dI>e#CduQU6ZhOS(bKnSuq7X26D3GZG6*%!DHM%@V#@y3!)ok|n&cMn!D{ z=!tlRQp4J6*42nL9I_*sDxY1xsJyGZx7?r?%4W*j_)BZ?()RLq%B>awaf{hhvA8kr zB(iU`t62Q{w*~BMw!IflDBz;aP)jq$MaC}UYU6gJAz(}yGsZUKZ2rSa0g^a{b24tq&x3Gb!X&LiX|*EWvbp~o<=KSS{j_-W{Z zBj3gcX>s$o2b}|FO=qioutUMJ9eEfo!jE1cO^<)|#HGE9r_Ma{y3*uz4?DEuqg5Q{ zOPv1$?~IVo`SYh6&oxh5bjFF7SGu2l=qv8=M?Ir<{tvt%h}kjn4361@*d$`cJ2>kYsSPpY!iPNo6>)$iXKb{o$j`|! zk&Ugh_1Z)mqA&2I4bfSrvI(BF+2F|;Jt-s!33?^#Fsf49KwgKs;=C0rh=PAWal(02 z*viYZfRMqd=HZsCyivMhD={(|i1#Z}x|HF_R?;j$$p0A|)a zGH>VL@@J^E6SzmwE=*G^4K|-`rA?YF%>~l5Bz2+wTr^KuN7BpCYDMz((c1$!p`LP@ zbsr!l9ql8FK{pk0aRu6^#oW@UzCpj9xHIR*15!C*?~O8iA&!*K5Cp+5Uy4WZyAS2Q z0XKScn6cwI@oAHZMI`%XwzSu%8dZlQW5k^IL?RiZ>sSk0DloPJ=5r_IUeP0)*Rwr8 z#aJNNUtsd|StS3%{7xx;jD)(hK#J=r<*$ccE1R(F%44s3x8la&4Krrm5Rm&;o;kDf zt}D_b$Bzf_dH#ORA)z9i^$fZ2iN!|%_1tUY&sCR*Jf zKi#GEd+u`ZKB0*@!M72?^*aqTHRvjJ@K&F=X!);(-|FS>XwU2SD)G4+X8V_6HRUX zXrkT8Ef|N5t=MQbBF2sn5oB37l0nuEJtMl{`;5`&Ff=RDTsv{`yiFc~bmNG1)Ui=ip}YZkUQv}*euEp0iHp;jltpVZUP&iqYp+99l;26+!Tvt zOoGk#EbBlyq7&B(Dp^zA07&9il?7kB2h~T0E3w1iN-g{csuk5W8gV*JL0+(t63U(D zVSc2jJ!Zgw z8IWlPEV&uLYQ+o`Ak(@7rjEK9pdfoJ5-b>pfJ^$j{eHT%zX!v&@D<`$0{^aardK(`LTfdt`>jfx5ryuZ7=ikjN>tCm18qo^<~6_hj0c>17&2@ZE|CJ;Ix6e!5`sgkN`dZY1DI~iS#pUz96N6umJI0SF3OodOaig zP+4du&Vfth>)`kBA&s>J)dw}gHg)bg1Jfhhy$Ec-<2IVb#V*DI za4(~0Ze!T*HDJA?Uu>EZSn^fBF$|h4~S&>gDqmmxcE)*14 zDt)LerAdvO{TWHBh0$oL-BBwFp)x>tk_~R*o+ryfT?f@;t3u|p&TF)*nU7{m+&SI3 zKY(NeFyH=$dj5cS(Irm@>%kre_P1V1DpOyYIQgZ0I=*`n!H*?CYAR{d zGuB0HC>+Q(PyvC%w;tGfa;}El39Rc`U`Xq z3jYDWlkqxR%hWPjT?O#^5hJ*uXvz@A55-%9#jS-w#PVkdG%=_x#l%?n#Q0p87|elK z8uk?z8&;#sHPTebwdEGVCM#QoK#geSEz&U)d-?9!N_%R`*mD8%c#q+8!$E_TA~BY6 zq17bTD0gCJKL&ddi=m2QaJJIeVDkV+PO2f@AKIIjCJ&!Oa+VyH7ULV1Kr?)P#Ygn{ z?Ye1VN7b@ao3ept#+c@u`oS6JM#t^Eu{~ddoS$`Z-(8EWMu(mn^8`N65XhG;(p|diYf+6efzb zRAPxNM~>cveU#q|A2jw?5$e4WAuSl8-Ww6>y%F*Lj-3u%udzA8z-O)cK^QbSO&XdE z6AgOWpUEKs^A=rJ&`02m-cq$xMF$RG=k{+ZD$0}!emG@j^e90#DoFci@=qt*iy1}p zL_Mr06?0lPTibz-zQZb8Ir;`c)D6)SaJs60I6a9g78zv0Fn%~y_ooS*8juJ3>#>K* zYbxs80Ub>)%X~Kvyh54Bx{Cw{z^ER!O#Wq4kKumG;pbv&F|v-APrLA@@9FTNZO*&Q zQ1?-dO?&m=QWGE3`+fY{GH%|~Wy_{t^Uy=rRG;3lY&<&wE0CN1-<>(Q7P00MSaWZK z2dECJxw{})nk38=3-#-B7x<&GC_VKB{N6yo51~$ndqcOQ8#aCrGzbZ>w0Riq3 zyk1kNwW!F^nnLLN=tVd#zX*jjK>pfODv52Svr8A1c9qK1)c{q>vDvXjv96dLjg=;4 zp&7-+qKF#_$Pp`m1rA@VdE(~87A@8q5H~WMxbUtTn$a|7HigfHNE#Kkh)NAxy5!*M zL=cL5wD2&rf++~0s|)B}fC2^3X_F(Z1gBK3zHIC2njjs7Ahr;PEooZOd;?9p32I}G z6@tEAy6Jk@ntqMeG{Fg!I{ohGiK8=<;buqX%ES(zy};utJngszT}Q2JdET<>`A?j6 z+PX99pSZa1+;jRax#NoOYUw%;o2@KTx|G#Qud-cvM^VI+?Pu6m+9fFyV6e%|0(fmk-qJ+B zTW(=`0{Ssjs2`(Ie(Y&!$(UfTp%iO2nv{r0KouN*uWW>Nn+hYu$fj-t5*GPs`KFX9g}dN?7TbC{_5|?f6VI}f$iIM_v#O9K{oV06 zVZrxz7Z&PAT*aRw$CV%90i)w4=q0Orc^OCFCi^yT?!w%oT_=2b@U(}C$=uZD0@083 z*fiDZ1Zm&ApPC)OI_xA<5I^~?5I#xyV0eQ_kx~!<lf@ZkmU7FR0Q17kvf%{c}2I<(e!@I{T3SP2ox4i`+@7hTUd_@-7 zFzL>*v?F_qP{h!Zm#QOSiDL)O{oh1F%s&33O8}h!Hw*^}tDR@S_ydg;fF6_vDQI^e zQiM5v1o_a0JHJvl42nmy3itkvy~rf>h)uB6i4{k^c`h)WfghjuvUun zW0-sA`g`C@5Xo!P4R;B7(7OFG>_i9l^g^RJB%4Sd+Jya+C>m+YwP_8YzYw#eJ8+O& z#V!~HmkR%d>lp?!GQFQ1=hVyqo-!a5Vog;s&<##B@}do`AN@J5dkYt0h4FnAceN8G zMZ@qw^5ITT^G~(qbt9UOt*vRTcw~w8nBC{IW6P<0rhPT$Y~%P5wG$`SPD)p8{Mpd% zO3c1(d|Y@y`IhtRwd$0)-lg7)z1MqXNsr3ub*M&DAQ&hQP#RE2z^H@*p;U;95N3yr z<~(j|n-%>zDBhH@w4o)akaUrVc{&u%SY4*gY(aM*prGh#K@TdaiXllmHo9DxEpnMF z(jrMT3$$oo?ZzgQj!!2lGFB>R8KI_vrkEKziX0dvC2(LAz=2`%*bOR3X;9U6Jk-=- zBM$)>R>MTI2@^8>SQzEUUc4O+7kl6+>d5)MyJHC=XMcB~h#z|p1GA&dqNCTNqHrQE zKqSCbX32PpXdhfmh`&UIylXQjD=7*^tB$`+CwL)*SLlVE5RWKy+&ASDL_>(kI`Ki$ z^w_aTtOZ7;3ut}_r|3>Tfc8;Q%nGzLg<8%D&cSp|lAFjKIeahuz?I93r=Kv{?Wj05 zoo-!u+T;`NcO1JS`-t7|=cK>p)Qcyqs2w-X;4W(<@*j7xUsaF2+uph2&>#~qZL0B! zfkzY#o36%)UIoa^icCPbGoXFRbp~${dfw8w_DzB1F&2FR_W`7RCmcWtY(8N} zVDs59_x$B6S1vzaiLO|&eAzNV)I?*~fQB{iM5p=Zk;}t^teiFT4hPt7E8c=&24Swn zY7smVYGH9^jlxy|I8{WIzgbZ1sMaXS_>m;NSaqlDIjmL5DcGH&2j0KMYK#EQungN# zLoF`mxT#XUruv}8V1Z){A0DkAOn=|iMH@LM!;bbx#E-O zEYaTJuZF`(%*#Ugxq+JvUvRJ2s;A+n4`fg-yJRE$lEjrIN!?|P{iG2Nt|c2)0X_vp z?r@!%E`~3Eaj#iLRKP7j9P&@lu?L?pJD*{T$vHy%0%AHSaxxKloCUAxike0>%xf~- zQ>lG>%xoG>$1%B)7`~Xp$I&w9oxw4%>_>)&2JVKGE*9=rosnXfHxns_X%PsRjr^9d zDZ+{e_Ln}U@=89Y-asg0G&&25pC`G9eeg1*9yr;u9^f#A$Q#vbc4ic(t5|-PEr)ex zWy=vLQ@yG$nDG{;^S)TbiMPImoIXHw^Kqr29`)6j8y>-A@&cKvDv9)5t{Mh0UaE>A zm6wBi3!HiCaaa6u(y`AjKXvL!cRVq+Zq}76PU=+7367btd~9*$xo1wQY;%k_dGg!< zG}lV_2IficaJnUgchr;C8`(MmtzUrbB2w9rXcvoB5TQ7znu5Wg7#D)%b`Az@1+9Xu zRW({xnb(-tn|Z62b-=v_u#jkS2A%kz0_+&*E$aK;jalMH*lfHHe1Nv801Uwc+P?$A-E`xoO*ht# zA77guKVEug@Eu%rsPFlo|NMFSWiPg-@iv4N_ICPQ-pl9mRMq>rk$r}lY)5w+z!J|! z&SxtOGTEm=8P18;u}qfCfo* zZIGz{YDD7V_gGl_^u2erPg(fg+c!LU+b^DcO1f9ezO_r!n7HdLCLQ|r!5eRU0Wpc>xG?abYkhrrQ*cE$;hT`%LPg03^J|5(aNYOA=6^!CKF{hS_Se5 zR72fa6>b|Ct{HZ8vQ@R31Exw9h6dr&iw-eJ=fOgJW)aND8Jkk(*+6kH(^nwN zPIb%%XiA5KCgPH_FbqjBx4W?zWJezeUfZpm!bOzJa)avKEJ87}zHcbE=7_O*rw~sWZ-h@t(WiVd;0@V>Jt2Yo6GD z$L%kkH|>&Zbc-+?WJXMdF?xzxWRjtoWMiu;n)ENu;CpAgj9B+JgjPRP1O8CP zW)tj%4o3`2)!_&g+2I(4<6_1}w0p(kR+I5W2HA+CC>`+~pnl6#=0Q)^0-k|Dz)c=k zxQeo+y(y%#B72%j)De=&Lp9{kY=mWLBlv&dTV8a96W!GyQC3Y2&!eFSFac${lDfmr zK(|%6aBQIE4+*LpEjR&N8|_@Z%voosk@Cvu<cdFi3{2UvVo0&VCTjmwUky6l$a z7rh$j=!LE<8~ zD-Ot(*{IbM+~I-(V=3x<2?)KIl^3rs-dy~7@xfw)P+VFcFhwjjDi@vGJu*O@Q053t z`eMaKdaG+6rj^g~er)9^EX_C8gCr<`&mV~0pb99+kI09}M;mF0Ho0hr2egbti5q=G zhuq+S=#IsjSz3fJI((zYlf6005#II+} z(!SXJzU7q<*o1qozy2Prug&dPF=gtxU%baYpOp;{?Y}Ye-x@X{^No^27pip~ake(T zF3vOiMKbq9vC==szu61Lvho}~oI#8!g4c>Pp?0{10ZX`ux1E&)hofu+(3*|mGNR`wqUUbzlOy3ficHLcQQJrZan(x_ z7@IoEVapp~Zd9|-Qp;}L#;J;PZmrQJLuMK+G_JWRvkgBCDHZXU8>USCaH&nMZUCx+ z1r#IK-K7l;G0*Tlyp!RKto zq34m+hBmTjkp~+o&kxAW5~i@fzzH5_VpD1&Joc*-Yf&LQu@MFn_(QabCbZ7AG%}Y6 zFpWQ{rFLg#a>d*VbTvYq7;j-G0jEZ^HIl~$P3_Q0JI^kyN3l!$kFbmCBz^%#8@vN% zL8#!FT!opMwwl>Bi)y-R3@HGBD>Z={B-_=X9abwA_$jLSFoq&N;tWNcm1igzXa`hE zwK1?tw-Np(DD%fG0qt4ahPlto;6TQ>=8H<8%RuCv`|)T+{Y zJl6twrW1+ffXqBC$8uADfaRLGz^3+Tq~re;_aUKSECqB){_t&&>&G}zzZlo+_9UR> zbotM9z<-r9hoF{~QqOStH2nOB*mdOnGp`uNuIvjJ+P5utFlU(-$v4r=LoWXa_wM-8 znJPsjVrqG`kTq(L=Tqgif+3C;1skls$9ZmVnweGi%mS2YCzyDRnOQ8%EP;1F?1pJh zW(X-A7ikkaPHaIu0Bcq(CD!zH@kXRWy&Vl^K@Un<9gaXzTo9v0t=Q|Hf`CRV;)3Dm zXc&>EFtZ~*>JUpvPQrbO+Uf(FEI3B3FfeEIDsE`n{xcQ#^RcXufFZc(d_K4o3aIY z0_8ORb+8tzfiS&HP3Yw$pGD=~h4ip4 z3QIB=Essij7`nv*83zrw%u*;vMChTOLLa;9qIn>ll{j|o1~W@}DoR2A$Kf4{4cBRRYTuMksBK*K#Mz66tdGF;qsOgb{)F@K zzC%Ke703Xzs7ze^o4aV2d6*4y+ihC#Cs#fo1;6{|Fk9qnZi`S}@TqFe^E!RA)8 zCKMhwqZfRoI2z^%8_gy&slkb5j9#}Xr(_Ww$rLQ~GY}1ScwH`sE14*8q-^CQse}z( z6{!$%W06XIL^fe_R#YT6;k4Ic%``R1t@T_{6tpHl?p%Upy%qQ)HgoF;(@+D4j_~4K z8%~P@xcn|LP3u>WziDZEsOqxc59Dl;$vMW*rTT>rn=Za@)RH+P zPMPMU4ARH0d*=0NSIxfZMrQk8+$`CWuXxExi!MkDs?KOqr>qwl!QG4E`7kvmTjyG- z7riW^cet>nnmtys1x+Xxqon*!qqGRkdeO&T6la&BN~3IUnK;pMvPG0Km8==E-HvS^ z7$;=4c&%1T(r%Glf{+-|ibUMjl&dwBAn`y28FnQQKq+@`0PT?iRI;&2EwTVPGfbYn z5VC-6__Q1(2_8dZBmn|k5XSNrVIH7R4|=!JZVw;n??zrE9XFZHnXo4uBL+Yz#jtEW z7iE5c+GLV;1{%oz97`4`NpwK%A(Dg~MqJ_!G!SU41I>_hUjV2~M5aeLq=5m%pD~eW zOY~Gc2|d4)TGtQlHHZ!Pa|$RQrqvByu3ubGJG(LIZ^(T1#2?BhR!=*5aOrP&_@3$N z*~zwsn$R5Ip;z)GUaCEFu&G16H~WxSvgDlg_l}F?_8)&ablYvUGmc|-4O{tob>kmGnPura!YS``2>)uex!s#{-m!@d*X-6DC7m-Js|yHDFqX5 z9XMc$!<$)-O2Ep|GP^Xzq{XQJdAssm4lg?4NL43T~{4FmXOS~|*H zMHI)!XU4_xiJ1w};PC;hx5+cnbF#PDi5NARksh4CVwchb`Uau?ii(wwB0SS^__abcpg#1xM!B_#$O zFQrs4#}L5xIPhgBsg^q_L$D23hM&P-b);dtP%stI($KbgOn+y?s5HVaW68YH!`b`k zecc0!7lR11j-B!;-bHtjufy1vQ-eHGeSBHu?B4t$;l&0Bb1Nw^&ON4B1il1T30j1Z zF@(qsVmI)dnd1JNZ+N_Y{!KT|U88M(S^GP)zkK%=$8YcY*~X1OyZZOX|Ln$_ZmhWX z=f&)k^_zdX_?N$2tbNX6yLPeo)SXwobo*^v*FE)1{Cw~cc{^qdd?dT%t9bp(EOo`D zK#b>|EE%6-kgcHa=nkY#wF zZ!rSbYtZlj=(A$0TAKz6bx5e9ep*!uEGd+)prO{C=&UG0ah|S5j_Rt_B(dbO zBn&zasZi7_{Tm8Q2=iADBenthdtIm(ux6%EajVlJ#DV1;uJV(DQ{C<`ntf82kuEeA zk%huh1P%ajfnL9rcZox!5cLyO&179R-oLyx2V%SbV^V)e5k!!HLpx(1M2*CO^TDB^ zD0)tbG`S{RLD$<5iX{0!VcKHTkt+QM`(`2RV@$-FjKfqLS-E;@cRoK3ISohPM#-+B zzF5cJc(wL;aV6y-cHMaA)X7)hHSzK@N?Le#tT87ADlAzTJ+$8*?0j|ivYXpKv{Uuw zt(V-=I^*tZF0p&9-ZRnviqN75`(FtI1K+jEecJg(FAKuQ>Q5J)!vp^HTx> ziz|edCfx6#jQqTI8Nc6E+O=9tu%fp%Ha_$=z5m@^@>Xpj|MW%Kty+-3k1%2W{X_4` zFKG4r{fo65G_MeN3gI!f0!jXWR8fUxg4F45%KfdM$Q!iFjg7dIOSCJsX8v7>E9bvU zdr^L2ph3S=p#*p8)$eqZAWRcZ6-51u1_rWL`T2np^?M$ed-OeL)AEjiZ;kLj%NODO z!Xxiln~J~lh{?!TjblYQb`$5My*V?BfO9ew_P*q68Qu)e$v!*OB$8-01X=|XTYh@yA?A9ULN zFErEr?=;PYl>V+uzFm9GIEq(){gzjMsTP!d9bN4OO@V5!HDC6>^<9kZDoKy!$5yxRgT<&}nYCA8~Q}jYT)Nthr^$siF(v1&PIzZg57*@AM`+RaS z4%zW2X*jIDPJ8VK%C-!LzQ1fs5D$F-8D%m2nMeCB)Fa*$*;XAGqKbI8Kv7e{_8eP+ z7mOIQ^nV@i=HAx4tMy;RyR$2gjCcRJqve>6IpbP7-YG-8o?_mRN_S%fmm$wAAYZ6` zB|uJTlJRlvd}KF3%5h03W_KCa3nAoE{7>f6;h9UGf0elu(leJ@(??`3eWm?vFmq{Q zZB_RTgGnpUAs-=|>~Ul+k-W7LHL@MXC$uLO4f6Bi0Sok>xkrF1U?jnjQ+A&5qJeWk z8OlU?=l?1bC8jRQr=n1OJE8k2R-~jjRjVWO-%3pJ9+sFQJ5yx1!W7+!46!4UQ^;K5 z2`XV;VEx}uQTh4zrl@E?l%j$hmH(;C`k%@yl&t-KTA9U!v$Q$v(}6RwZ!c5P@Ji1Q zlNkeKgpN8P!SqS*q^KylG3shPo(Acx>%RIMK4;hdjuo?Mz$-2u_)JiQ(cOZ4r9}C+ zMkE$d(IfA_PR+QH&PIE6vtkUOrd<+@wBrMoB{DO^`%uPcKmipMQHhIB(!M!~ZT!nQ z=j<977}%n{z&49J#gUR5DXfa*7s9E4xcQ~w z4bhK?DC82#S^q=a!Jh-Z0MCK`2OQ}?;{6lo`M@I>$rk>63ZxbTf`}kn3~!*CYL@De zEKRc6tgt4OoyoF*giEsPkuu^&A+!_8r&i=lebwW18OPw{&?YJ{Qx-ZX?%$v7C$EC* zRodqgxGJ{3cn#_urD8xrNw|@<=Z?#k>`YO~{^zy}E|AVQ#I?#NvuB9+JSkpF_fjJW z(p0$<_p(IwN|qLWFD*8MVj8-cT!uQos{;M5!gN>P03VKSi(|FndH*KbsVV33o6Fx_ z{`L^^{{GvOre?okYqV8;bLWcNq|I92!&)7C?P2z3z{7l{ZBSY+=pzDY7Is$&%ub#kICU1K!XOQN^ornu3oZ16I#*J87q zoxwuIdQ-8WM3olhRArfRrSgEHDDWh6vS21SU2HZRfBq?-GKEq{t2!G#4veZ#qn}ef zK!!%a)qrGgq%QUM_v7JpJ*n-bY(H{^Q3jGGM;-ihRNX-b6IFSbQ0f-- zvP*m*JHO!Ns$~zYd1_?kPv7dyJ_t@SXer4K&PHi zz#FpLLIKdJr>5FlQ&SB(_2lSe4><#|5hax-Pqi%~o5vPMIH4jDuTs{MEcCQ^fpBB2 zX^~9Hq+Cr`8jUr8%1qx{Yz!+zBC|ada4ObYBeY0VE2oR!>EzTnz_VxY#(TY-L6y2% zS}{Z%oi@Wsb0lT3p#BAA;5XMP!yV{9Oqn6F45y0WjSY3$ua4VtoOaKtOmzxCvqzb7}(SOuK_ zIs6)~*rv;ag+(N+@RRL#?XJQSAdpWISH%D1t=mtFBG2~@FuX~3R96koC&4Wq$4j}JInA!_TQ8@%g+O!W-5R3%IVo(VrJH8 zUrQSJvc)5_)tqU!l#%ByON0U}XMPffVZCpI)OnB6^WeyVslC~kO{bYV$-`a5|w>-#Vb!V{S zbrzGdS-DdSi#HdPThpAU?i!^{C!T`d`WQSF6W-nAj(Usa5CY-5)fTHOf4Gxnt^)L}A*nu3@!!Q_ouTp2e##OULOpyZHuIe9I$1N&nqvRx%57({L} zn2paGSA}MLtx#fByr_uMnGPpd<1~FHK7DwuPn>BX@QiY-_BN)iAx$O)S4Chk>=awL z(AAj^k0b{0TZP|IRon?2PoUi`$yP2#-3`7Y8BhNBkk)nWrQ5bm8hLH3+~ge2dD%DE zen7Jaf77Xy|!?U63D>nAg+yz?v zKuH!%o|w&@DaOSSgCEo8GP{jqXz~c;;;($-{C?Jh`FdYpr9#ZAgon)&*U>}sbZ(T- z6Zq@xVY5`#PoD5$v$TKI;gdw~67G|9_#DyN9Fl9Y^^5(Y6P zIa%i>ucbD}UAnw7bb_~>!UY=*O@wx!28qBBNjCI!bdW%DdPUJHc~PySaoK~DFSzW% z$sR7_aq_J`eurC^QeSQ2Qfi?K<3%N{UNl>e2#vmyAluVbR(uQ-@xX#=vUKjZAO|zkWurV}hsKam#jx-R4-V55{h@J8X;ffUezYmP}2e z*=!UXHmhVbVL%3x$!N7(90IdhtO7H5EvRHCTh}NO)i4jc`525wmoqnptuPd*P!Iq4 z1D7qi(QvaIZ_t=XxA7tAN)8wSOt;nJO>r8T{HSJT*J>AU(^kPMHt%IuvTF@*9NKn$ z_V1$odTDfanRqKWFi$Oquzi!gz=E4XwbO@c7zuWKpqzG&9PRjUiFWlwJ6lhF;G!8E zYvSWJ7;P9g;4T!a16ZjTHWTEqh0J`Nk~q;RNj%Cai4&cYiZVD0RhWjYkRqIxI2<(# z`Xmg^LQdBs_2h_oAPTcq?fEU*4%R$G=?|{gHnOSL%W<97usS!${akK5sLrt)0DNvS zTFnl{2%s6+0MP;BN;WHoEiHDSvc_RHSdCWxf_1UY;I-KdvSPQ$Mw``al8gpt6Ee{a zX4FR6t%}X)aKQGl0nF`lPH(51*1+dnHyP7a+hEUZgKowsa~4hiaPG|&X;YQ96F)i2 z9Y#CRnf}ZDeaCBeXgBX>?`lndVhh=lcfiO?bcu6P_Hpsg;^*03@wjYBb_-~3f#tHF zOP$S|WIhDQ$*E9}J&}OuLq0Ga&8X(5xNM{`@w(TD$TyW@p~r+U3lv%d1DUxniZ*pv`9w zX5Z7!!VF;NEnfj@7Yp~Og?_)&XEF(eL0^;E2p~?2P~?Ox3Mjk$P;`I64gz~Uvo6>m=L3TGgR2~xOU^~1~n$Ojg=BTNF^VaW;T_c*y7e7{h|(JLW_p%=-l zzyhZv`v6c|>T}$#<03*_LR6tk4*``RcWQ70;BJtw*mm)$q4>4R%jaLQEuC3=ZAtUF z$8QraEQdhV_ORm9&-tS$Xs2&#o2jr%wCiPyw@^eBi3tm^SAQM!FBBe9qZbxnYwGYQ ziV*gDT1-fdH=Bis!yuS^#$9BeV*LY(Nfq-CL3 zwp;**10X_UgF-uSpZv_W^w^Cr^lsbs_2VEfyKht5DHF2O zU^-ks9dsq{5UfDy8>1IPIv#pg6j}#90{q7TRKk@A4?H6jL5lkG)mtV9_CMDM7BZTVMgdwTA`yo?<9RQe9+dl6*&+`;QT)C6ke z5;3Gj*S`Y0b_HWA_fzqT;$6>SKr9^x%cT>EPr%f5ZXFjCwuDapi z>la)q8BbZTsq5TRnyk&|EnmpoKfn2R*{9^O6K=U~)^u^S_Rz*lum0}LXO=9hudLb` zD39K?Ry*sq6J~WFvL_Alh#iPx&cIClgN=MEhpR#+7G2M75h=reNufSm&tGjjfbuG8nkcxFtWhiuhLbb`a+eCUj! zbB5q{Wk$xq4GMXs$oXVAk}b6RyMN2-S?!bE?}R$KcI{f#5t6Pvf-Bfv>|A!v8!x}S zb6?;2ci+AIcilQuU?xT(FD44EZ~`4RB&<`d=tm3qKzcwz@28YAhaLH+suw5T7Qa7O z&|;H=;0>4WM|k7&yqtJbP3TM#@%kes&Lk$zBqq)zrXcBsp{27ttWQl4hFh!?~GG;`tA2mg7^s#Vv1bMWd5U#=L?1}en4+4~iQXe-2;0pb1) zPu@Q;@XIHkyzgqHR=;tJwiqCzdo>h*DyXr6PrOKlS4dJ6qhw?T(U|Vv*Ds`L-;4in zrb9TK5}J|*?f zdS&%ZxxYhqY!F;e8<;FHIlT`b*vSXl0GD^^Htj21eo-6#Oz!W{eHn!k{2knuL6Vt4 zz#09K;7g%>{VbS%b>FKb-}r5&GPu#c5BaSstFL>WBs9GI;zV&VV!r5~srudbLFL-+ zGnzwYo8o=e>hLSi8cgUg(*M>rNQY6(_0~4lfy)ufz3qBRtXJ*AHx=vGMCE z{(VG_8vm4%`&4=UuY~b|u+QNf{#StLEJ$;W zFJcsr=B~d%K1Clz6xTyx-X8S@8*UqA2*twa2T-_LJz z-~RyahevVJuzvV0xeE>-13n|o;-7iq@XyFn8vX0R#N`CcITZPU1u}2oEBS!bj{4PU zy^}(0l8;55n^}GLg#pIP3H*Q!3T!Z%qHh+f!O~1|_)Q_{$4zFdEc~^xOQjX zf))8bJwk?7b+%xAA>ZB$M?I7YsZ}anZ}6cbHcu}^5?ZRM!S9z3%%3*(^~<{6nSNqt zNZe$L9(?SvLs8o%F(ek;^4hVgdQ9v1S8qOJtKFS?`uGQ4_}#CMe>&y1Zw3F((>jbs zb}RH~Qdshg5QiO6fLx48VK&Ln<|wRmgJ6mw{i?b9!XSf2_*@NP9Kj8WT}Z{=jH>a{ zOf>RlTu!>)T8kA(yfU4p&7_Sij!69LE4H)yvAw|9+b^Ecz9k&mqh&{pJ!b2T3pYhvrO!;h`|&65IPcf4 zf>SQ;13eZFOqVOg2mqHxsG%i*=NEl}yDaQxxU%20`i&c0z6};QG+JKG?%mI@B0D=> zXgk;$ht3|<*9E#r_BY6tpEP*A@i8;cnLYi*Ur)X5*YBR-8(H(}^pZ^PZF?>3tga8f z8efU!GO%SJL@`6iO}{YhDIecGH~@6v@YqxwZ1~%tcsJ6x>8K(ol(AY3HovDpwrpl~ z-Np?P?rDFE>-BxRcd|4>cvYCe{(V)Dm1wR)=pYUCZeXnfB?LF;EAch3&2vuw-A~uN z{>b{vVx^GJ?9|jU^z^AMj}|F!)&i?VG+Ev(Dk>;zD5#GnR1>QsH>JxIGfAeJ zY1OAzFRPZ0sbg4EjSwF_z`3{a?b)y8V2+Hy<52A4_NkVu5ez<`jSufi?Y zvVT;1--;D0_TqQvt4Q>6L!Rz*QJf%)Xs&zI?w$MaD*g29hfXeO1zf)ZHhGC|cA%Fn z1-|sDgnQD{z@G-lSgrRX?Rs!#rM(j#t)4NmHGQkeZExq3n*!YQn*~ zG^94?OZh5bNbe@uA_dVmd^)6R0doeTfpnlHAP1Nb@LPQ(Uxb=Y%8JxKB|%E&KILF) zUaA7KR0xFi%W*wqJ-FYay`{i(gftqjrY;P#3(=n3#VYKh>>?`IT9K_@P%I>h-!!;4 z6coh#8=SEX4B>E;1Yn{WC8-na7ojK6Ofp&(G%fl+N^;IG63iXoHR8(jZ!g_*{<(|B zJ$TQ^aSva0!bz8vA2X@Qdq&qur@naiZw)VKZ;i_Q+bLs8($ytpPhPjFuXWOt^H(>G zZKw#=@Vo6)rVD-8y`d}3M1{=}S%qPgL7WW)TXB-iJZ7KkP075$V)AVG0M{ej4sM{^ zd>s;!a{dU}FkXsVEG=z-&nzYza9aVoty{E)T`2u|_5izGo3DMQxwHd4bVHrq53irT zpsvqXQ`I=eLUYXLOuij+{70QK;(B4B5KtW~L4AS~h|ZTdx$+WfKpFlC+_!`b0eP?f z3F)nYd-*3)h<9aDP{L()yG}=Z0(V}HhkwUNC83~K0&7c>K};i3k2MeH0Qvd;U7N_B z?W1ppewP+YuZVt#1bl4ZO~YiNMnPL0!O@{3hgADN#)e!{^_f}Sx3-_j#@_UocdxO^Ed*jIw_tm9bu~wtcm-~ z1|j|We)PtAAI+iv(D{e=F~#p^NA1NkJiun;2?SgUm877MXdMypeM9WQJsPO{0w9n# zP{6GkZq%^Xj&Gj${Bc!@v8@%Z`qZiH3hmd^kNvmm6O`&xMmNq2-*ZXp+*4X-ESUa~ zAv?dWG#+mbRF$}6^W5Q)sfspp^JI3vcG|KjvRvzVUN0v5lf+0ide!v zF=8>eje=SB0=$L!0QG_1yl{?qC44Fvfwc_m0nDY_g+NdM?-|iD#vBpMLVE8`u)k|> zzia2PQGW@r}orEEp@hR?%0dL6G z9kaB%XYIhxEOsUxwLfWhvj^sA&#>47+7qm5&iXm*OL}P2K74@9(_X>3RxsyE_T>Xw z0r7f0EVZ)?e}V5}qk7T9{+Ik>#^2@_M-?1b@MwY5V`5umc8bh`;;vXxIr$-qytKJ0 zvK869(MU4VqBZDfY-SQ+1-zFSG>)WW^`$SYk+3~ z5yw?QuB3x_oqToVlIOqjS=rSetz3HEMSJhN*Luq@ADG$JKI3ljBF)a;(9-Ph?11?5 zt3UkY`rBtcc+Hh(Km6dL3nX^qD(yd3Y2@a?zWpls1$2if!ycl6rPXKK(yTqjCWqPF zG`pmRg&WXsFBA_{RwPP-L7X+01idA}eqaX*z7eP#^_CU5(P;^?-h=aI!Q&M?6_|Eu zx^01NxlKY>N0%*TtHt~@y@q5JC(uOdeEo&2Fr`RW$V{G7&8jOJV`U{mJegoIF%Yp~t}g4g2DY++Ed-Wr11oK4Y?#m>HH;Wp$tq2ab6`2Y5?~duZG8o3dD}wG zu{s+%v-O?z^?Zh*KVVV4Pnj%uZy%1xr0D!ZXFWDSklt_Ml)z3qU*FxinnRXub!;_k zl7y1Tl%&YQkz)G8|-{`?5pql&pgW#yit3(*z{fR zsIYu%bz!v{ zwm#j-rm-1s{OR()Zhi5gf9$;Li8`_Okw=VM0akdqe?869nt^6xvta_(z(#e{g;6#k z%1*T{vx(7|BW5az+wC|u$L-#@Jsua$maxldv#O5imKDVcWz);htsHLZdYZ_x z@`yhif`l5iM$wnP5OfodqEn`upGShm#&K%AN1`yI!x~ zj|s}9qL4WWnb7G1<5HGSI>)5oLkE?^V$$Hl);)U?{2x++0k)6N5tK2XGEaj-Wzfdv zK5yAijy?XuzAcZk({XysY&Z?ZcTxBebuwD?ZX@OX(<{tv>X; z+6!G&!q z=W3|KpgrJt&TbLR&mjsP_qyCtLJ}1|@%5N|ijE-5;C=k!AEy5I{n_8Y{(=ktNp8?_ zcNJdDKgss5c9Ez6%dWtGr%RL}7H3y8M~7_+cSLohH+%_M|p&oVFfa(w1vq9d|%1 z$bPB+-hA`T`6oENnH95%+OyfNy*P&jw^mzd`UrFz2}=yNzA#gM5~Q^CN@A?MTo96! zISMZc{4yC_6-D-E8P;<(_GpdlDs^CS9jlU(h4xA*8MT!ADg<*Xh=)=s8F3_n6;Vrx z4-au)MWH7CPrPhsy>ZCDhfl(8+MAPoZLVJxD4LIJi!ve=uQ6%#GZQ%7 zwoiIpQA?pcGQ=yPpwI1+HZ@il^ZWw&Md4Fgi9;;o>aS;^^xoiZya6E>O0VXy*QAae^uw++qaw1VE!S&?is4;RMn}fb55Oe>LlL(bLHM|-}t*NV#$_gw}@p|{qnk< zzpD73#I=b(m%W&nK5dFxa`TMD2j$O~U7C2e{Q2@5rWv-R=2#4ieyJN5DyStECyt1R z>F4bUoP#Cnu{{Xu$yRQDq#NTlW$iuxDa0}%y7BTG{Ww^YDe^M~jxb~fyji(81fcly zab5z2cmsj#T>Q;YwSdcEAfI3>!Nvv=7}=FeFcXfj$jygpyz6 z@Ce6jZRtj6>_%{;;~3;>?Q|#u^CjDZ?~i?J@11w_63u$8J{d9UE5f-7Y`I zhH2!4&nUM0Ax&607@r@=&B)RGxf$6uAC5X_;oPnZ*C6e}gR^NiTep^zt7$oS_bo@u z$@b#HtIO*U9%q&_E34b<%JsUkuuqR_w%8rd4bpW{-uA@4Cd-@Th>Et;liZxV&1f=nQLkXvc#iHG7fD-7AL%+%`iP8rno-#`9w@ z$S`$u&kZ&@oJ;X&&mP|mHrOKlh@Z%?U{<9x#}3jwo9Eu0H2+2nvfZD^`~-jY{vCf3 znYIUT8vFid?tSJS{7vMFQ+{>tukOKL@s|fN9@Hkj;QW*0F|2&Lm08MiWsPzuz9oOD z`10xE%DG}@SahL)Qdler2@w)*TJ+bqRd;mGMtRxEZl@>HJ9&QWlvTM~a@E${$+@aO zH=3(%m@Jwmi;~HrGk5aj+)nM39%XIe;OZ*8n2c*Zg4Y#Rq?!_@7N{Cr>`}-lx|uS~O5nG^4q9MdH7<1^Q==zC80#+mtV; znd0u+hFP;)n_AnaO>Jrz`_{}e4)#y0o;5fyFmURrZ(lZi{PHRBx@g6wStTw}vTfmv z`H6daW>lW7mVI&I&^N`Q#5sTY@0nel5AT|LVbzbei6viqY`uR`e{rZo%>R1fl#3p8Hbb@x*IiZEfuq;X{cZHWU`OuAZKad7#&^PJH0p zjn}jal_~KmWh9XA%pA%0?+#|>dm_74*KVik*=>)jf)f6!U&XTqxL^S_<8Cxw1sOx< z(4v2AA5s9Y)m-Fhp`%Wk0rK_~HYr$V(5U#}dxh7Q&gpE6)%uH@&YFJ8^8UuW+|JC? zocZ7Kmz`TE2KtsSn?1F$q7~IF6rW?6_+RH6IGxcKFUcv&^Efg`@*KPE#jf32@$SML z|L)vC$fFec3sD3Wm-LUeVK(L;W46H0^X>kld%;kWos^{+_i=krh>}HF^>gB#f%&nH z*4h1Cj;@ZSvBuaO$K}QGb9;)5XU%G?_n#Y{(pD5+iA;%d3?b($;#{o8oJ!q88mFHPTYd)#KJG4NV4FW(iXT}^VrcLXa;c)TQ?Nf@K=20cKmti_Qc({BWx+>fuvKX zmVsT!nGbnTZM^wm+}^;)Pf>9qQ$>=uCGHbZSBp!{rmQGVDgdbEVVp<8gmi4rQFI1A z(9%(S_^r(u&8kjnHt`|-mm43D90;WdPkVmVxeR++z42ldNAR>J=} z;qYlC_#JXbM}`p5F@7Ey%G-y*(=R`vWQ=<4;h6a9O=sV9{=$XMWr;tE;$Qxf^tEEV z&vB3KW~^BIa3^H)vetF2>c#cq(un9S5a;KMo_x`ji}m3gmzwVs)3FbApsOppvG{;8 z;LSde>2B;9Eyi5l8*U%1bBu-|@v*~lqK(xFvfb$NgM5Al#z)RC|A<`Gi7Tmi@H4sj z5e~rwD{zycv(tenfTcQZjkLGrU>6PF%>oRLd$wMFW#XkraiHKfpZXm&vv=CG1K<0u za4cKCBKypiWjD4oHSYcL_g{Jbiz4!b@6wSzM* zZfIydd;a_f7iD@%+L{|TP5RoO5+SIwOa{7SAY1!Hy5Wl(Oj`R1Qz2DLI`s<=U@eJhvm!e1SbM91; zCkCDM^c&n5x^MhRjeqlxt=K8cQZ~EyyVVl+pnDikL?UG@bH-j+H=+S{)^5SKknLSe z6?k`0DZ=B#*er8UwwO1uKo`*JN`~HMg+_d+t+hKUH8sZy?E?(_*`)m*XlGNo@WMin z7G;2?>^0~D5_Abt($yhVrKSdC)g}uhB>P{Sev$l!ZGikZg=%gJth$n6iK+$Gpc_rX zeit0PoTQ74djoQ?#BDFmrh;4VM6gUZ39I&IqZ~`6ns366--KPlZhJHMr8q*F{9Ba- zWq+Zv8n05RHrEbfT1_c@sSC!qg)#n;ilHfWwIv0W+JqQiGTKmLXybVWw_Me~jX!hz z|0*@{eC$O|pByNw)Z4Ua(=E-)?!_ttXL^ZSv+ao};hCWsQ)qP{d9mAOSlF>pq8(eu z$By}sn^!ejo_!I5c1awi&t`SBw^xczz6{$r*txkAAWcK{hApf}>~elW8FsBp%I}z? zXV{g=ld&EWQ&8nRHigpby7llLx9xUd$UW}&RfnYcdXm1}-Ddi7cbnk#J$I!b zA6wfh4%8*#vA?>^k*_{zDg%A&4e8r-eEyHXp zT_)QH?6XCvu|GCmNvb{3de=3hLGC(?`k6CmQ+>>xw&bH(!j9a#TegC#n6=A zp6Z55t(Ue#dy^QXd%I$vj5fZbV>ICWD32k*TzjBWGzW)+n}b>~j=Gz$%X)JRCCp8X ziE&-fsHiGQz|>#KcsjT)#Htvc0bcZL9QHUtb?Zjd1B{##kby zB6yZ636Iz|X%fV;X_LsNba-8+DTYk8_k~Y8qSMdI%K~fC2CeX$>;%t}B;hgVs;mUO zrsA(bxw+7DPtk?&+xKWOnC6$JCI=m|L78vKF+SR+Hu0m z;2$yl%j2y&{a}z(DHI_9i^j1#$oJ{% z>zrAjzXuN~BVf`|O$0r39V25FnI=mTm-<4=vS*T*#JIi~x+RHAkDK?bdmYGF{1V$M?Q zQYPus73#eiiT|>#q;nq{pFvE)tcqsj0JB-gY)-{ok$5_J+EIz&OeIb`B8p-4m3SJy zfKveN?HN3QC?OWK4po$pz`UO7tjA0qtv{VS0ZBCI1Y|0Wo*rgGo`%$VRZ*En1M_5U zxxLAd9do06+g-X(M2eY#h}C!b)Flp>=n^CL2-{;id}#%aTqosawz|`J~T9 zA{jKVPNh#WB{iA?Us}rW-0voR=6~Ge-^cvxzEDsQ43f`r3rV|{Cr2Zu3_g}Y$B9Nm zA;OW?Ma>v<66h(}j$g^Qj~hN$UM}0=>1hU6zwux+6eYSq+zN<{@JxrP;yN@@3!wGsuX{SUZpP~cIhxf!j~w-%<*g8Xhe1&j?#-7~bG zf&#ABk>+f}S}Da?+c3vz9MqZ|uWNmqofPQhc2x6=u>6d%(iyw(s_hGkMQTE z;nUo}xt8&v2g29(B-?K!4WRu_!tW$}tbSA4Cw$kHj1L`H@u~e7Nsljsgg;35gK79u ze%tk?J+SX3>NSOQS9I#wl)=QY8$#dZ%<>#Y$DaLGyvvQt7u+Bk^)@sG+urp_r z*H)_3_xhX$_Ne}abDItc%kyid+uk0*(uK0zNm!eU>E`RO`;t5a^3!>6++(LbBk-%x zSh2xg4gKIXJm3_^b1*vey1_TtZ)vI2^nrq!(#Jf=!1+wb!1y28NWT{RxpOigi^3vl zb6F@k;h-4{%Vnn>0?0-9ionYqz-Rfm{m#z1IvVI&@u79Hpegt^7q<^t8GoN_Um=-w z{z+!=kBrL$8~7i|3TjVZ6m@c;toZUmR;>Z(|km0rj?t z*WV9;sXZBslI^kgy0|^IXyBojO}weS5OiWbY5$t6%l4t}VSCUX@7N6tbahp#B?B7< zs5xUDL$SqKWE%p96*|THM3@vQ3>@q?W5wvou-%3mB^%?jI;(}FI)no*8g30aDyk~fHBnLP z5CsmA;Sk6nIMk3@rD~A_WhG@L-rNI9oyU8??R2{mCfzPcLC?x3rPL4Ro}4$$EAYo$CeFM@pc#*R}qu8j2;|Ni)! zW3|DbMATMo=#oBtDvSqvxFYiJt{?^LuY7?IvJQA$nrO`Sc=Dp7C6%LjRiokTQQ_c&7pB;B zpG=DW>zAp@Eq>_66K6|thzW>tU8KAIPy^_ zLJ_ehEGpGb6nHzAIc9oG7c!Ej?ic@GMZI5>UECNfvqtqwP?n%i*!l#`^lfx zw-+7!`&!4rPwmv72LlBYcc$c@`m$0PipRQ2M7X57M0J#it|AdE5>F0vE1+ApCDlB)Fg zHDXEZ>lgimB4;54?^wg|ucg8xEj+!er&9CjIbmbgLUK89$48U5@h}4b{d^prQYdRv zfvk=2$=m^}k#Y{ug>4Gs9F}buIJl@Ul!k_)BCv%=+$3A_l#G<)2-=Zy_*f1-_Vy1p zwovSaAZF~<`+1FnaHK3IjvX`G8M7e`z97ME!IAyMI8q**i-A1)ZYp;a<)KtchAy}AU zo7g0CL$ljU0(TI02Vr-lVY98h!!-h0$qwL$i^eX1uCrm+F`>jz%!%x}7dL3qZQA)1 zM0=cKgAby;x@g_@I<4*mT-Yq( zcBJB>%~n)pXysIyza!eQy#pZDcGKn5vb3n9S())LCJR)GjPBIo%P+Zl2_2Sr9F^?) zl$fCJ@ocC+cUAE_{t z{^S{rjZhiR^%Ti-Jy!bZdP9Zn5%Av&{;R3fKo%7Rtj@1Meq)+fxn@Pfh zep{!z8uTH93D3T4;U7DoKgW(HP9eda`umyxmj3Pi6z15h^)U%KH%sp)u_(yRU@2N= zY@eaZojh6%a118DPs)N*NY9vUHAq=n8n!o3yh^qu{XOXgNi4M0)yWRuVjVWkQPc5` zlTL@RpChY9_J8Fghz>CEKR(VSuh`tTplZ5d?zSoDbuLpVjTc51H-0ln22o6QM@~US zpt|Gq6C4Cq*d5P?n*ihy>tc6J<{FLo21FLo3A zJcEn5#+Nz9m)ZCt`66c`zNRo=a4hgOh4><=h%Z>yr|>2Hjrrm@rTN(3zW5l0Rdz6) z9d8bE(vyOh@BdM5If|cte~WttRow9!;#PA23n#t z_O5ZA8+J{5ztMJ|@uk=J(t|ICa@v@iHs%J-3~t(p8wx^RFiV%1-UEzl04n}cl77Zezism#`G^Zi1O?0|lK=Zk09l5w8SdDwd&B{pJ zixcGT;A#r9PoMT zcVp+P7Qii!R93q2XmLy2v%O&_LbJ~o#_N_naksr}RD?&}bc>$e)9axUhq%2>MMCKE zJRR8oHR>jFE$A0i)#vH(iT#!Ro0GeRt!xzTee5JZo$nZaW;J+YYyvR(8y9>sxZpKi1vmxqAI~ zI?5XcZ?=8=A6tjx(-VvE?};aF*T*37D(jm17_-M`%(E7;z%QI_~mfmdBMqxw~5Cc6yHPIe4sjXzUWLns13OSTgT8YQsvq2byH>xoxo2{2@of)3n|SBWdn1q4 zU%T;vA6|50$#1HgzC3*V_kalAe*BDr;@XwxU2*v}!ZGEq{#)+)-WhY|FS}>U_j2~* zy~Z7SzdbE>*;YVz*^0v1+Zye+q(hus#wWvf;hobQ^hb!__K}9BsdyQF&rdObz>RRSIP?hmR9XS% zuKyRO!cVX|ruKkNtt20(!gaI5fjgaAnLMyzrG{}4HfTqJNZKHFrpN~MQ%ZQ?hR2Dt z6GzBWI~>}#3_Bzo*rA@osIG${B4*K?L?1%Qc5zbAwhA=^`IIkw%`diz0Qm||FUFKQ z+$=%9N}gR*_;jhQ9bt1j(!xA(*AJx0T^~O6XZsMeaMF}%trU4gON`=#EoeEA z4X9;+Lnt_AXCAN~tZR1ZdS462T9H_of(RN9;HwT?o29ffu* z)H$?Ux%(2%O?`~*HT}+y`tkUeKE76|$BMNHeH!<(ARd?0_rQYMQR~*RA8;us$jAr@W+i^MEWgoS9slMFMzJqOJZFJZ3*xnvW z|5D)=_;RJ+?kMey;tnnDBzMuPw`LI>_$m!xvJ4K&RDPVe|Lw%{B6R=c_C#E*Esw9b z>)Z>M4qyN4bLT(N+C6((Q~mVVyv09DY~OzN&!^; zp3WK5D~piilQ)wfM**rIR4eDjCx0;{riD%mtqy6I`Na7?F~_&ur_NVJ7p`i}^_=ff zJ&^+w-kBNQxP3r;Q9lP`h@^gQq6`&vS{tz5UfM&rkHK)rr4;c^G0ovu6GsiC@^F z?Q0=v-z~4R)zjU)^BcW<5cK@S@{rw=fP{N)ks?8fwGHqWS6v>o?bH7-r0wIJaXTG1^i8 zrfeNsg6tPXwFYVkS*eERhT#S+bqy|Wh!LK&N)r$3u|{eP87UO(8%D`Kc3XW^lX5xQ zjrMGBD(@w}BIT-;a@9814r4l!%AvK12p+H0m(8VG}ukH#uS_R+A>22QQ5#t8wLDXFE?l+Ycd zk+=GIJ(BDt!s2$4SkPQuqtqPaQH|6e&mN@S>@8+nK5k3jFXYA$jx4Ro<&W7OW6JhS zOhi?MG4bU@OzffIk2BNuMN}BMI=*OKi}19FH4UP@VQRzT2JJuU#Cf&CQM;s8b%(`i zC`Wdnyxi$M5UFpsIS=6GoIj_jq^8P~k7~SlC91?T+T8D>iYv_hc?tbYsxDpYF*Mr+1v&aZ!hMaf>*kd33|MM(f5vaUd(JwE93G)>B-1 zpeT}GQycO`iVKTE*}|4BvMc;e#l=k(qakQ1CW}}emh~0s6_BAJLqpKcGrWw_wL_(a zML(o zbiZK`6aVJM<(iD($Bk=c@1N2sw< zV1G;ZDXeU8>r?wPVENW3!5;sbgq=3Iu%%Mac>+D&(fN-ej(5BQK)l;Jb}Pp0EI$81 z=i^l+H_S@_A1wj!1c$(VM$90H0tQB76~Jeec@;o3j(^BB`mu_TG>W2_|I=A#d}u0G zT4^-WhOK>u*{TVX4BIh z@?+bsrDuB&W^!hxRIU@D%}q)>Y_(5$EFS$r^<~xSyHrz` zYa-T1Gyh0ePfsLJbD#uoICx7d4=4cfA;)M&j z`DN93N-*rs_7xR1l#hnpqYdpT_AI@8Nah7#y5`!F69v3XkaZKxu~#?jq+PRzV>nJ` z3;doZy%+_>L=U~z~KvTs5nkwSRh$Rakvo)4p8dQE5 z&s$ziJ*AVkp%4BD?Pwt?^O_wr={|+d<)K}dD17=@Uav#YK6TQ?|k9PF*ga@g6 zA`1tG2euDr11HftvUBzvM`4M>L&s<>hef~a8kx7@;>Q$sWX$>eU1OwjK4{6rywH2u^O~yGA;*nny6{87axB9I0t+ zoSl_Zx5HnsBj1lFRTZVWf5)`=>>Zu4*tGT?nSPW%9ebW1@$gf{;XSCWiBhPjhzez) z3JFz0MLpD)k3EAl7=`Pco_$C6p?(8dCH@9vts0s%qtMJ}RYt{fHwG|Syhfi`6GEGK ztgr9<{{F`XFhbPVo_1Dy?CJ}L)&DcLaQ@`gD|;?pdFI)tt_bE;Uhga_yK!#E!kUuP zvT}+FDrb~9=k)jYCvH7E){fe#9YuM;@CtuHY;sw!rtx&HojS|y4u=a?WpD00>x`+< zva?kPPVRL2f$Ux-^9EI`YumzNW zdiY!%Mi&-YKCVd}>*Dbzb&as6yt22px*(@!fj4V`U7OakuFg9pH@~LKtF`)r)9r`) zYU;zj{O-9c`%XD8T3=aI(VXG$j<|`h7TZ^q7afPNx+zhX$78?qi@W?k^8d`Qt@B^% zzsaxN6%bnk;{3qn0X0zIb4N;wd?O*vow37ZFDwr42o(e(J5X*01#H{ekh?r`l*{`) zf9&YKm(hJtuS{J8%A;HX2pLLatrOE9O{F5+?Js5~etGMfS+;rSt{I%NYVid#ZYnOn z`X@zS?dx+y9=)__b#-^|x$9<3aug4rpLn|utC=4_pUdp8vQ1_v(YO~6(AXR(0U{h8 zq*dq*2CD3RH^V zq0aSsOET)tuCLYw3Cj**tZCehR+d`%@NHh#+e$}P*M zk5o>JZW&qYyW;wh)uG&#b4Q9>qM|g4O&Nbwjh=mf!RZ4#TFzLxU`O$a<-4cFcGT9- z+EH0vUOjEf?&@oHtPZXDj~y4<&R@6t@|$+}vM z5oAGM#NV`E9&5+HqBbk4l@1Nz8-X0gU;knJfHm_(zb5569ZpPGS-%+3@JT6feQFz% ziLWp{g#wQO9F?OI^!5W!gxk7!vd51>=)aJatI%7edY1+Lf}E|C{-dOzmWJBfDlN2J z&#hhkh_)bBQ~F-wSmNFHN^4>Zv`1F2HGhkgPqz8n#Db=1w7ID?+H~;cci(@xr#TvJ zYKoRN*hAKQol94U#q^_gh<+4{6F(;?fwBNN*VgNvxK{o3bw4A{lH}GGS@Yx-NGH6rYlVSeA#lQLL2WU4sVfmGmhy zaZ0kk5szj!kK~6MT1Lt~u{CzetJMpZDiO2D`OYHh&gD6eBVV{vWD#{W^#~$AI{P7w4 z_Gv$RexJ56@ujhs5*LY^)n>6(gr6V#^XBEtw`^IyeDmDX`ua|zzv^F7=rL9L&Dcz) z`GzR{GE=cZ{e-m}$=EOx~FA`yqw=c0~pQO2YdEes2L>A`~e~Rcg*Zv2*e-L~U z3xj5qLvmx636H8^?7-#_D$tp^-?~j!ZcPZIQdmOJeHDwE5b_t#)ab%(nH(p~=oZcN7_8m@O zALZ)bIOZstUwD3Kh^ov94AXM-(nEes*oJTZ!TkD$%bs4py}A9WeTy7wPw({M)$@k8 z)M8XhBy2wrs1K#!9;h5GvqScfD{~~2wIkP_w?lL7a6(qDn4U6P;tdZDxAY_yt<+@V zn@4X}O`INX4Qu`*qh(Y8mzy zFZY*}_s811hUW%L%4-@UbnF9FNxrI;I)d={BJ3WI>LGjJMwM6WiU6tr&H)5&ue%O>IK~Qv#|#5Dl~hw183~N=h4RDr;*CE3z_$Ekiy=p@k!n zkmiGtm4pUE3qx9HWufpDHlt2oMO_uDE!%5qstW9$yaJc%_u52#c~LNn_KS}k#0w@= z<`Ew#_=rMtD8%2^b};V<%6=aiIyi(35o*sJJc9Gq$P_j2%lGrY9T}S7-{@_GKsKtW zY1sj6Vr4r^tFvQHgwtxbhKlU^_gJ{vNpIZS?*7M}Z@r~CV&nNa>CC;y0n)t`k*S`P#@6CA(r=;fzoc9^~EskkFsx1`%n+P2nyYcbI z)k}{3`1osD)sMxMiE9XR>+uh?tgUB_<*9F<^~M`N`q3$4ZR!h@kz1PhzH%R4mkrzh zA3SpftYImv;XcPVc^=pl&)1xIl**yl;=a6?4U;tdwK-9m50MFL2)q$0@L5k^U=Ge| z7UjMl{@{n_tzEm;{=t1exbFvR*R4fMi9}*ZsLFITY)9_z?~n0X6?awn9^ON+!M0u}5CXVIq3)a1qJA}+MvM8wa6t|H<@ zB<;U&658C!!QEBM-9x@}NVK#)246kh)|-bmrAN@!L%P3uBCV9Wh9}U%O~WbHn}+yV z&{acuYr@JG$>@61Mt7W^V10S%ZXU}>cMNf}TEpF5DyM>*efYpnVlv-BkyMPkz3xSP z&j{yxl$hpq1m!&=M^MtRDRbwz8i71>20rkUn5)tKtt1UP#ba~PQ%Z1(_Cq3DaYGjN<%#^;HfRbI77{8J3}9+LL3JT+`(fSxP!;C{C4~hMMG^N z4r9fXg$p|RA<*18luBQyZ-XvW=aN*Mghv{M{E1FDZnC`tdbpoQ^yq#b^K_Qfjf!Iw zILU$gHO2VAPe^If39Y1DL_<4byA3pOUypgheLd!Bm!aQjQ}gLASbPv4nu2q^D&5~R zXux;BkobnW3lGrcp`vP3`C@#^5`o#*Orf3={9;foEWoI@C@NZ`lcTD9P9+-99GOa4 zpiXr}N=igQu`;TK)x114(>IC-^hPN(8u=G2Lyt9cS!L1u3<|JfU5Y@6wT7No;Cxx7 zy)&j4x74ffW3WV;H>RP`JpEO7js4;7#TWnN`t|2{7hc#`+p>J>nGfDPXU-jS<~(rU z?q>f@r(O5$oZaC_No;;gMMi84Ra9xph{0m~Z0rG_YD(9noD(m-tX!-s7qiL*WQ#^? zN)IS4u9^ehoWf|-R#03y8r&uN;z93drnh1A3YR$FC5BugA7xAt+)zp%fABI7B-F)v z0eJ(uTS7rjmd)1-`pQR`IxDE8ubc@O@&t?-0g`@gUA9w~uK3y&s~1+D`IWD~C9n_?R~{34b5Jc%3HL*YwC0esKsA<|Fu}Y|uh4720K($rj+;119 zcHu{zR<6ZM1LV*?{Kb#}#nCf~qP!YKv^z`HuY6_i8)ExdmimFS_E2Ibw#Lz>J*M5~ zc#qrck0UY3ZLZYBptcbE(i+MHQOVZ@%1XT6h;_KCIMEQbLXCWOD~>$0a#y-!GvZBn zFp(r%psmDdC|$6)Aknl|DH<|!5X^6n+Etdz5X&MJp6np0H1FQ8tQD7$R4#Fd#Y&ZG zQoKrU?*yrag;*d&vlv7%b3?2XP@hO*JmQkf(U=Bl5 z>WktJLVa3@2Zgv-h%Mq)v;$+$b$D`JD-|)QECkeM6^|oqbO^^Z+kUtLdT~!;Xb+}1 zq+Pl2AWaX^`(*3}f;htDj*_NYCrR&p_SwWa&ps>Vf8vQJh%@x-IeNclD2wAA8dm#? zx)EF?d61?xs0p*5sjjoCv%?7|uyRzYB*_gpA+!24Hl%uf^{Zb|&;K_xbSY~nh~4?A zU(XTO<%lIYYjQ5m!MpHaCDRu4W`Yr|1RbHGG*Ci_{o)PrE{r?qQE*N)kh$N9s@+lN zBIhcn4RfBMp*=?q5AB1FhVYmh+2CQ6!j;C(?|FeUyF*`)lv8ezRwPnYk;T)1sbl7fx}L){dWY!TkC37aZSfuh8~5uYeB2$|>=-+XLSXs55Z5B~TrR1q_~R z!`@ordXlz4nlP&MhCNSa2cOJD4s9$y%0r;(|HprEn={OKvi;H$C%uGA@`5x zEMC^O*uB-!HTja2OO|ykaXPPnwY`=2?Sj+3|CLi$&tLRyaF*1n6Kly!;tRhX64!-L zvwcnI;*d5yAVPtvKvzJU?Ge2mk?*PXVCQR+%NGd6_8zf|!t)UlS4m`&2K!U>cOb0m`#kDQ=y=PX!gQsIy$ zsc|P(KO5t-?+AY{tjbFC;c#_WMHPL>r1!vVl-_lVe0Qx|&BXcYTwS8tNOr9ulfZKj z!TcxjwvgTxQU=)-a4Cxjki(E-!fr9-_+)~faXbMdPwg65^fR#dQavUtk557^YnM|v zZI1PJF=$_CAGT|DHTNt9X^A*;nwrAhAcmb{fm4(?o1KGB&AHzp{En!D^0Bnu!K&sM z%pAibvW6VfCD&mXx_Z~agEt@uI8PmY^Uxu*|Fk`%o#%W2l%2>R`_MAl(_6tfi`Y%H zj=ijp4cK|WBNRksU*g?69&!BnSBayE{}dO)6JB$ird`L9c$CZIr_6MVkh{vQI_yrH zN6o#-ExOz@a9qfxC`b&r9Uhhh_H>p&EJvW*<`Ek_n?33R&q@y-7isnkdNj{uDOwAj z6*h#UXb0Kotsxj1($BQTeT?4#;GUum3OF%}g<0A^f4uwS?>#UIfyb5m?_aizIJIYM z*RjkVRL~CF-45)~cwjcT$V;4Q(}c@|_ON`WgNL#eYJpZvOrGkN2Urb%e(S&9x_j3X zQW4jQ%f}HnandMdbk0y(;}H*BDFgOrb8bWkpN7XSu<-S}qfiMXJ93ocI6Z>5*Uvc& zJ!JEsWti0;c{C=E;PDu((0J^e!@ZY*6KjF=R%{ude&i^P5hp|2aRY30>=;I2ymOCJ z;luf9b)*+6Tv8LC^O=CI#x_*Jd zUDz82DsA?`B6leNsbD}?80!mX9qO-E0<2UX ztVZTXZXBd27TX3me$7Knuv#spl$A|6{t4cTKk%K5m9=x@T2j@C>$l)N`8U3F;p48v zhg(lun5jnaX#5TPDzoz44TZYuy)(QccL;U-I}dNY_Rn>qYw6;f5pga<-HErxpG4j^ ztjvhF{7=UJ%TOQp{KoT&M|)d*jD$m`BggIcMSbcj-$vgSpVo?GqK|%|`GQz64#HP3 zlp~WUC;E7C)ow}kTDLRQx7N;|w{G3M`D@SUsH^Lszki#5?wWb?)||VbzQ4b|zPFE7 zfFHps4%%PBMd=C{e#j9)ddrKKla%ZXMSl?*^Y~ueHhaW&381D)sAqJjfmnVgJ-o^1 zwC}`X=O(;|+NGdcHO_jxhOzP@CF3#Fmg^`&*#KU1;x)22ZCv9

    hKu<+arcU{tIy zBM}4U&cxNWo0u!26jJBr5)9F4L}6T=4qz;F)VbhX(((HZm^%|YEp)=lA*KKCYn1?M zrz)L-$RY7Skx>af1)BQ_9cMdFLN?`Q6X;?Gq0 zWqA0q5#e>d2&zq&v86#WMo@PqE}*f^r1c7G0zM%&;I%3x-ykThybsVAHB6eXD8--& zXmvvm`nAU(ETMVabiS%~Ir5p$S9MDkN^MbqEL7@`Mj{99?l=laf6A*^>Qk={v{stl zO|c}0eF7Uo980862qnYgavPLzuvw)Sn7fqO5^DTGcur%yRO~MpFHm%SL>^$Q;${d~emGf){V)8c;W4n)DGv!Sh%;BX;D4aZ}u&g$VZ|x5u>L zrCZtl>0XY77JT_5jtfM~h?O{W7p5YbQse1dZBvLVY1uj{?wNGHwsA~jxI&#V-tS7F z2f-QUN56ig0CVPD;~y9^g+CfIg-`gtI{xW6-;l?b|CSFLD(4o*i>ac$-B}m(1_Ggc zEjMIPz?YBX88q1l@jHn4`I&eNO&+#{#HNslhZcoag|yZXZh81aQEZf~E-L8Mv`{1u zY5tHaEBh&LhB3X`H%R$0nqF~N(^ZiQL~D%*CE|}naV~g$C7$6dj@pWZTSQ!e&{H}7q#kIxX;Fiz1*rop^Kc+de`j-I zJ;ba|P;e?=ypac6U6h9)o0nDYxNKY&pm z=Fx#^JG|oy;g9|}o{GjL8NZFg5}%Dl6-YIoM~L4OT}M{pu_UC|MQ`_DEaA}_@#1Bs z*~Ae{4?)V`r(RN^xm&}XLbo)p@~>;-QwCiOOcD^?eM7Mcgynn`ai ztKKl%yp3&%s}W(|`di(Wva(#}ycHJb=;nFrBI*O>7L@a$(N18K%9mvsSM0a(I3{Vm zro3m+@}|*ZFO#%hOVVn#(89d+Hnt3=1o981;OPxD0E%?hG=8KLl z&`QJ@g)=;Mt5-p*#TDB$-bo?K%7gRAnKq3mQ=A z)UufxVkS0?mA*Ee9!0`*dO4t{!_`K0iUgNV(VgV4`2_wr221|TS$ffD@t1Lu)G`fe zQ>f8AYbxuGD}TVZYSX9l!{S2G)c*x$CPO5M!sP3WTk`=>kv~qUHSq70NGD&E?xyND8WPX z*cXVBF}^^yXmad;C#Z+0lB2?O)VU@debS8{q!nr&$6(N*$i15QG9$O9R8~O5BweYs z4)|CVw+_mLbt7YqUxlAI-sgpBmk=DwmLwL&G7HbtitcqFj}hKvUHVZ6RBC+&RJ>=LP29AzNQcE?Z( zNr#z_QF)3T`|!A;z?#)Z#m){Yvai#D{O5BHhUuttM+`bi80LuWkLfr9u!kJFSKrcU zGKIUX=mX};`2bpEYK~lR#gL1-P1Yo2I?W(x@`|9ZTMEg#NT(M9J%*apC&iQ+BRLI? zDKTga86vVIqYrz!Nf=Xq7Re0_LPM|pjCBP0x!?Qy7{|~j<3K{ZaLg^mpwXn&3mU>5 zhE9Xy|EvCpq0W#{iI?^9tEkAdSDXgAnqEtWu80=6g$AexkC>RI(?W-AvBt12H>}GfC#@?8TXdNe$re``&_zPj6csw8V=^>oFH51FoFU-F zQwx{Nv{DPrgX1Im2oNnyTG4fhEw-Pryyy++4y!=49FBWwzKu;$r5xEB5}X`?`*llV zi}n}xo25DiWq%|FQfD|mQjn2~aUJps);3;28=O}V8|tBpdc6hR)3#t%Z>9eVvP(L2 zHK40?>N@mw(1n%uL8eVTR%VceeQd#;%1Sdi8WtPm0CgQkxu3B|kuE|G-+JAy>&u*B zsRN>g+}vMyEF}4ju@G`s7iZ?1Q0cV7prx-Ks;hKr^1Qp=Dg5tW)%&Xg%gd6?T5@4l7uOI zdEEM%77t|4mtI zw<7u_DN^(sF{0lD(8%0da$rPT&puW`nC9RuIK+rYoXZv5qlLdF;*Iti@wXcB zKQ-cDjd-p~++FqKs@+xEnnJO-P~b9{%T-h2Z!Yk8C>iFXy*S!T!Ujg#-~Q8#hravf zhD&#!e%d)x?|=Dgj>fBh{FU~WS+iGv<;Q!a~9^P zB{|JGi1Rr)C`Q75W#*Lo(BE&9ZwboAgq^GOh=ei}4d$FcNr$@Yq@Xr16tBrDDkL$s z*mP=FoFv@FlZ3nSv*4VEby-8sO^ChB-C#VOI}6lR6G4rCga~$!V^Rgh8|SJKMX7&C z4N}RL%-sCgtw9kFt_t!m9>!tUUE`Y{4dPLHsJ|X|M|w!35q91+{spvEB&j@($E1|t z#-O@ue7=Dx@c^UPzmK#1F=TIFhAQJaw$9$2&$Yx|(<8Dt(1NOy_W*`=E z7(g*svYiw0ulU^fQ_wzkV=o}tHv+pnp3SY7pluaxd%5k`CT!b^d*$cA#kmdp+0Mf( zH|!tQx@mkBgc*!`eW-gPOMc+x5%j?$cuR{u8DAIwSjE<t zPEMqK)xV8)|M-7vH?ohl=stE2xTYDz%vm`4Ob$sSSQ^w_%E>@&V5sQBc!H6{&hp3T zGww#`EAco}Cm|=Gf5pFyDgE$YX;XUU$zVc3wx6+$*C<=0))MdGm-TVaU>*wgK|X<9 zmpzZb;^|X%?R}4iLb7X7|AG7UL^^jdow77K54*GBqe*z?w7Fn9zo~fSU;i8r zxgN|+XcXA1Tc|NFjh1Ga7Mc!ai~>UWEGT0X!1zO#pg0hby{A(%MuC3@w~;fhJP-Oz zdRKlH9LIN()fffPYDZ@}cNQo)3Zz59y6lU%pXyVrwDz&2h3b|S_l80aN2OwSWMG11 z7tOFx{NISjsZ^wmer_s`TO}_RTaCm$zQWBZW(qFo5JsorA8A-*r6+^6R&Oh5pQxaj zYzwAoHY6?6k%~c<`Oh$J;Amej9%rlEG(HT4aK~P#$Us1Ez?4414B_9bWjXK)TU2F zZQP1+IGDPO+9zOManhI{qs=3CP3B;HwQZwq^j)Yqm2BBor2l$Pmx ziO|@1I^0zg!vR;(X0nYnDEG-8;K&_$)Q8oQjQJtN?4Kd#%Z@iKIt@>H(@Eg*jma3E zhd7S*LQa}h`5#gd-Cw0u4KGP)B*mXJNb;FagB+GJ=srntoUMMp?vp3_i7gew^pnrP zxQhLxLA=3wl73S3Q{2o_bq|q>GCU;d`?gd}=^_6dlXpSLws=>?x@ssblbayq8|hHS zc!7lWXFzRG9)*H=US3dO*`rCPcEw4;Sym07NzbxsNP$ymr-@}nnu+27TVe1awS!$Y zSP;9iqXSprFtO)(9Krt%ecq+C(T;&rT3<;#t1IsF$9!F)i(VSV#Qc9A)$uUbkmJDk zo6c&smNrWSFO28pQbFW_P=F4Cxctr%%Not0BG(K-nwc z2yZyh3a?+C${fjvBxCDSk5*SRRn}pA{EzmnY*8;W! zP#ZXVOFcP27KQPdKIQm4Fu>I1_pNfv#Qn9gFh@tp!yjX8@k3`LUvEM;|JY3W?L z)M$>Z7=O}mq+fg%j?A)s!_0PVJ4D`r%hBcOdA%geH)|wJg#||DB?yMH7a`}i2c?${ zPD;;RBw@Y@hAFlW4klsbdXHe_x@(&bV?D=`4)e`Ll1^S;^1Nv_xLDvII&z-54R5_m zC_5^V8h(Ehp!QmzzL|Jihr;zK6H3l0KuewuaT+?xr&`i_1WAW6bX1U^gpu)_c#=`s zkS#wieQZm@7_t@QCt+l?A{g>d==u^VS$|)8L^EK*&TpD0kOumbP<@HvWL{T^IXSNj zikN-Vezb;a*Dk7RU}Sk^v`ok1@%M9M@rqx^3demmrL7fh;UtZj1)jJy&H(%ics#@V z7w~w-cd~dK4Ur>Px+rgK#hNl%N@r$~Ez()AFb4l~EZlS%PUe--7V^r3g{fyJPH^J& z6x???`7ASYasth}Oq$iHG(RQhEag!W!`7@bc*FV#(d#UpyAgR(nXhN*KRs)iSTji;((!oJ^e^D?I?BYWi+eOw`$2pEWL?Gfkj?|Ito}{3c&+ts zqQ$GP|39?Y_c7m7U^TSPGHGG%q$y`EXMHK=`pnWp7EE5DofIa;40FwfHqD5kd=EU} z(LNRLvqZ3A{8?)_!()@HI8aJP4Yy%kl2URRCs${QVe9J55-H9G9!ouEHaM`Z>P+8A z!!%;VNnl#nYsu&!4x-I+vP`|ri5Gol`)O44DDiozSXXn!sOtd02 zc}b&^j1wnMMXnNY%aPB2ByTx3mAR5PA?b_=ovqSg4i(d?1k?FS3kKutS3-j@Gs^u3u>QM z5PTAjxRh%LYCTiGDvw_ZzwKqQA9)WC&Ir_2tD+edO`PjJV$ieDGmN4h_7+#%rMm1k z&o7)}rBe(#7dln0)UyeNV^GUrFN)#xG;eBc!5Jx>i0bU>L^TYtzpZo0(C{zpN6(zI zD7Yc>x?R-Pvx#B#&hhWyY}wR!%OYi!vQg1mmC2~}p!k(2eyt6Q4PvvJwBq zNW&M@;81Wikm~{AxY7|SzeB}60`2OZFSK5e7#7n~B$*Pg|1?P!xo}4L-yn;^m2DiW zlmM!d6e+d02JQ){lLIJeB+F*HYh3}yQ{L>STreFj8ic|uhru_lE>2jDX3s=bXjY}x z2D%p&MD{ozMVnMh^o)2+sf`DyWvx}VtOne*J6)sbFIRqUB%B+J1RPI#v!8Uy;!lx{ zArYDu%u||W9V(qKu4Rv^|DVAgl_Te(R1>k;EDHiTAGL5hb`4dDGS?8~wQ@d;dF6Z$m|qR+hj()2YKL?TwCaActL}{FPVA`ly7yrevu(oW{AOzg?fpq zO@~qAZpeQGm2eIoIkL}x1g=AcW;o8EppQKnYt(I9p8R9tZ9U**iY*T$V@@hhtKtKn z$`h(d->7~ARkWBf)Jlu0nu-cYpT!szY)a)!D-SrWoISba%&$tu99t7xtgNZZy|$mg zn-9aAi&5w6)asCEj)+KPeX$rUURXR_tQ8kd6juga3ti;nHdlU2VI1{#br)BQBl&s5 zICJ-l$h#5S0+6C2OozeXLEX=X_Tq6yc5;6*W=~YGEGdCDk-zVd5;+fB{rxpV=@@r# zOh9d>dI>TwtGvqI9(;)3&yBmW8>jeXf>w@a7XW@G&nh^Ni@T+?CL!x`IL!?0_-a6{ zrTcMuws$K-v0=hXpuHwp8^=Vg09OVthkr71qZDIO$ zn%6Fk$7(zxY8Q6$=Ph!9{b<#G)tFXFr`Icq};5z>(pt|AZs* zRtrbut5%N4S0zKzSCcHI`s!uz#We*Y8Wh1`Vff^|HO*Or;k@DC=HM@a?*?rPK3C6%YdBulDafV?Jl`w~L zrGFMg(qPy>8OFI4MyUH+nGR;z@g_f(aJPI4+*P=B+RVGU``Ln%=h0i+eCEDQI+Srv zKvk?zQbzJ|$^R=l|CQ-7vWH8)R%30W^Ixiiab%HqUuf>%Fa2A;pNf(S$-6K54H=sI zODNo((|tR`7%}D8?Z{<6r78eP-!6H4LzeL20t{`VKkP1rhaY*=+(JG1Rd?Uqn|&h?wy?+!xi>etH$jk_kTi=R z2!u_d1ae8jl06_YD&oG4;OLCIfQ}1pfQT!C$~bPgjEpmmf{xCpGb3)JxRSiTQ&ruG zj5E*kKJWAW@da+x>FVk_r%s(Zb*j4S6#2@tEWeL8VZbkE@MA}Q8DE0fV*JJ_JM=pM zrya^6qmW1Fh@E@)cD#+T``NvFt)9=UVCy@EJpT8ScSmR4yZ^j3~+!LBv5*aW$T=Dwv<+E_kCyN%?# zJU2g$Z*D&7V?QoCs@~@PWa;kPJzcu|`hjE{G-15?gZDknh5Lv-xxNN9dE%RDJIbePTZ82+04tQzN;_+$Q= zet~y$0y9j;PG@jGJcD+V!VpulWtuE|BceANvRCv#c+geLpsiz@mCh>BUu|PZEN8C0 z%wBDa1y;Sa))L%ei{awcF!T4L?0pBw)g}22C4mpK%3B|O#sr1dtz7Ylc|{ZlecNO4bDG+5}IjNI-qC(TT4zWt>_JS=GasAIzGWZhG(*1yKGD4 z6JQzp|==G!%MuM8FyMZ*PG zR9?KM{Ze=%&)Y zDcmk+i(%TZEW^yQG&%doosv>ZShfhOsVttCK8`zHHW#x3`!R$3AC8XoP2J|t-X{EZ zFMBvSIqiY7G(^(ySFvRzW4Mh1;pwyrM|m71_WT<+hpb@7dFyxXTz}q@MD`gIxfF^I|Z|TU#uqRTv=!?hw3GQ5#k<0IxL`$XZegF?M1709;tOb^CGU2JJbOW3!Fnra(JI5pEGcu=-&T6qKH=N4EjD4n+ ze<1hmTs*e#P!$@A9%T4EvtdKW52}EUOHjy<`872buC(G-yCo`F9Q*a*(tWu&ONfQO z<-W7vgI95@)MBL!r>L`yKCCiXzWhVPvmbG-swz|RY!LhC?#nwmwo}lJXh z6zg}V|6xDR>EX(K_U0bjd+;7TlDj$pHWpT)Hq;B~n75zq2Sc+5{cB&Sy#4szaP`$! zQ@?u{{cbAyT{7M+^|&+P;RKxi&BV5VL0ylHFsu6G`g9c^~(*8r) z)U9{kwRQHq&70?+YJS+!aesXIayT*W+=7$l7efLA#^hLVn91_|%%eAS|Nn}>dxHJJ?W$!ob4N4yjRX5&4c%!cJd5bA^Z_W zCzk(HD|iV3pA|G?Cf{eWeDeX5rjPa2lE>Fj z>+%HAZS^xDV2J;WkWNWL4P6U8v&$M^{4YwK88ujK9VB`Bzf{BSYp#R-rHbI`=#JBj z*E>n`503R%!0Y*1E+#X^-yy{r<1?Ytl|)Kutb(|QU%$5F(|>lHMxRF>_xxOAnXww* z;$wA4KHtdCJ?{A&XqeZ@+jPEEE3C5|ryxDic@Q3}W3i#kHhgJ5o&^`q7LV~*7Ti8V zXlT`UFEdG$K0{Z8H|GOY%_aFGjohATVDG^*POl<02I+x%FA6`g;pou~9gEg&SO@yL z$}fuzGejCr{)H!Z3tG^MS%ko{QtdPBMtiSq2JM*r85B39^G65{?MvGa9HF2uoE^>{ zls!md7)1!&u@h$qSVsCo90zEVa37>rCyv1n9}Sx~9J`CgO;$)FCv26eY?}QIR>89I z_4II&l92KQ8eqba{iqDahV%lQr#OV1B+K&vS5EDbv^hEP-p$r)rIQAqmgCQN3eLX( zb-N9`Th#d+diK&-Ib03Hp;uxC7RapL7TBJ_`5;rIC1pl^Gm^=7Sz@vXB&XtpCqAyx zz$bb!>4e<(sm=D42d4!R0wmNWd z(TwHGXV9L=jzzUIX4FnUY1Am1$aLd(acl_r^6x~88Lyh}nxBC+;8LnMLo|xL!VHR- z_zdS-0P8`h0`fFZOZRBUaP|Od$I^8jm#o{+ad^XqqdzWrY;5Q|_NR6yDE7G}|Erkb zoFw#mYP+iDuChr+24oK^-LQ_Gxvpc;(G6sqcvL4Eb7Dn?nP%pJSZ<~I$xWJ|^Fb4= z1PhL5{%e^`+n3vuDsyPx0q`wtpBm4UWRmm%GXw{yDcnHv)6vA%c0!RD$-DTI+T?;1 zbQxS7O*bIl-8kj>3Czqg;ei|u;(PERT;wqJD|RQ2_7hjxa4`o{DmNn|aRPZ(J_6JG z$bNZTX>(PMv^Jzf;cyfjx(e`#1H1Z9AClOksOQPmJ$t0FC-U|_XWMtdo!GF!OZs0$ zati-znZTGz82zG`7%oIllU--tWjA+)~uc{kAJ%wzU1K>coGYk%p-}-d2!^jA;vSy+$!L@pR zbIUOrpnlR8>u6H8Smz}4hDXsG$QD}~^TRteo*it%B>F5CK`*eWD*#KJt@hC2&9h?C_n947sF6n^N!B3Q$7fd;FTlAQQ)0uc zjP#yHMq(f%mhMX%G&CwGu+n|mDKX(&ALvO3O6I4FbjZ-YS91^T!+*34?ChRcJ2-eC z?cf1ihJw=F`A}JBJdos{}5*3&&qTDFtMt_A{ShXU~Y`_ ze{q-$yxHP7U?|#1lx+;0x1w=$k)M)ZKK`kYU3|E}VA5 z%|nL_9lmg~>=*y7(dXDx9S8Y@&be}wV%un*pO2ZW8l}`UzvJKrgCpMpZcDvy>94sPhUhsMZe zj_(x_S_hZypsvq;&PGnQirojz{VsFSAGN}27Z%jp%Mnd;6Fn2ql# z_8p=VB`{ql@l2Q2B=P75_T&xdm1iD4j5P&!UO+a-h*+-Az~H}FY!}Mz^NPceNJ9ge z!w6xULO`wTaM2UAtkCh^ekyO_{{6)D$2zvMNuB2#xyI?Sq--A?>-thseX)cb7$6T~ zY``wL&tiE164H9*MYA&#SZZq0xi}hReNLuGO3mz_nNR1b;{2F>upwV+#!`S9G1QPD zk3*G11{;K4kMm~-X`e#sC@JaCnoXLXJ|mphe@6ej@XWO7iNo`!tR6gg&6ND%9UqmA z916Q{WLa!PX#V`r2(<1XYl?9Q-qI3{)v?*a=VzuFXo9`RQJo3rl9e>WIKvQREagLW zn|{NFAz}wi=JSgt|9X7?=SN0AONB?_GyFoC%bkAHpGLEOn&iXwZlP&J+CF(!={^`L zD#1Om6la#=)Y52<@6e+2&U61;zjh%cksRJ&Wf*Z^20jCt92=8k4mJ5*sgI;SmnyDL zWq0}>_Wjl;e(A#*Vs;{koRBsnji>n&674kZPsxAw(7}UPQaNxCN5{%Te`qpeRAtKZ z5OE$2zDO#hBXr}n1qIL5)%@0e#4gG!DVne;d7&8{*fj1Me4+@wMys8^SJ9_@Sij67 zJ$44~#5Vx;wiwn7yJ@szcr&N;;*WKi?-Z%bASun(V73w82K`@+4YZ*9-y0kLM;gsu z{1Y0j+ZxaR(t5;yTyYT{=U~ZiL-)5x|IhDs*oJ@eZl{ypIn@5IeQlPBmGxTpV>8lG zw4!c50BIQ(%OQJH81_tivAx|k$@FxOZERM$>L=|^D=O{I|8K@rtg6Cxen#5Pa#htL z``Lzbp#O4Jm2{q5RqdKLTeNzF#Sc#pyK6Nx1wSAs;AC0L6`BE9JwXAOdXv^{GT&fV z*|!_Lm=%jmhJ}#bBYQ};2>5b+BYeXDg2_Z`YX8)HeBaE{SROt*vV9qucBYw~Wo21* zW>%*C2y2NAu(EJ%;{deugzOB{mym?@|DJuLMkebgGBbN6T4aTcMv7%6!njHt9!oNP z+@GD1lZF=s$`0?$+Wy?>M-E|@ z)qG?>uA!IdH0lyE?x(|OgYNE{h!K=iB1hVu)4dV*;*|aS(^5Z`! zMN;wlkU%I$nnJUyvfi8PES_5z8lq1LoHMOz?$R-X=K5@W2pGL|>@`E~SU|8OM*U=t8gvGz=$9AE1M?p2(JxAI ztiYcVHS*XAA}`NK?u}23Vo7jT(5HW&Gx}WB=hi;f-ac?Y(WlQ(=qjvjH;-hrXa`== z6cw`}x-tl!4#SMtNj5GH{>FbW2AcZcYcpB~&&2OPSiDbOam5w(CC6*F%~xE}k$S}y zSb10ppM}@@PBOBMk;ZMY_BVU~t@pRR#hcdOtZyx$xfSg>spq_&qBv=C()=V*JaF>B z`2)peeQxNpt&h0OzQNvRi)`PX)Rg`y`S><0kiLhOEJpU-lRCKn;QYa2aNf{8i*s47 zooc0-f$ZUie|R9T&k4PUn0X_I_vk-74@Ul9WSzT=eZ0&#vhP*=C{}EcV-}bpT?%@# zL2?lpn)#Ed>~g!Xbls%=k?E;d_#&li=06%7-Y?hu(xJM(z5FrW}~^+REy`Pf4jZUepM|%V!^C=iZWEWD7g9EPau%k3qXVRC#$gR+N4VU8W!fQ7uHA3d>d-4pnc#o*d^wlNX=N`+;M z7&m(k%a7U|4mI}0vOyfr`;orljFeSXGnEef%IrFX^X8S}issPT9m@As4QE?}tqU=Z z=NMyRxjB#l%;J(V_bf*H+v!$@nUq6{M!wiY14DJt+~dfzXi(W;gUO21o!q2`j9M4w z)wOPHKX&kvg_Fi-T|pNY@mt0_@#76}j|6(D z^Jc=|@Nw@?z1hL5N8lYaWIP{x2f>!Pg>cTDJrJ-qcZK7tRY_d4usS!Tx~@fup% zHWtK+f7H^pZ5qtRVcl>=#HbyaY)82^FG$~W)~y*;E28yuBeMKn&#G3$JkM8zSzeKN zZNm?y_yMg(EA{Y$|Gu@r`q&t4+=pXqacWK@)bi^7Y();cvj@xVF`@@wkbELGCw9iQs|oQo@5nQTvD|c=^vdnEu-Eclrs%}59%QeM{%ka#F`BI#&aUZqdq2LbA2a&y>&yN5J=qyOKkdl} zT9*%C!v~Cv^*2+q`)BjiVf}~kBx_i9s5B>?=J9`w%}hy;X4-@7ur1EFe__9FzYnRf zS+cP0#2A*H(_%x?@eOiPG#xh1g4Fud>r?MeeKhskR68{zn+>rB4;Yr6YYc8Iw5Ajo6X-A(0d()2YC$FkBik9F6Py_FF)H?cv>9|Y7W3yZ(IE>3MU7}6GRTHo{iM3h0 z*ux*g2-;j_4Z>lEw9YNr9*KhIk)k4-PTeg+>x2t(qT%!`Uznxq<{406p168p$A&w$ z1S%%APQTa5NIEuzf61?X_)jZO+jzk z?wZ`5OU}E0(}&D|`!8n%e;8PPBFpFT3G0{N+i?NDFp+0)NzcV2(6Msxo#os3&NC;5 zPf^1&!#vFTg$wjqT={B0tvb_Rn2TrQADByyt+U(M87pW%z-(Z;W1XP()YU7E%0RQ5sY(Nx|ml?_iV!BLM`-q_5y zbDW5g$!BvhgwN#{@jLi#7>Iqd`p)Sq%wAc&=JXPQKmyi-2Nm|_BMLJ`U~}Sjyu7kU zoRQAb({uV~p9zg-)aLijKQVt@zQCtMd`R}19F{{pwd%+jIPmJ|8C7(|a@DbCtLOky z>Z%2_Vhv%Sx4k47EX}YmSI(k$5ZRCen&}M|QWys0<@69~)K7W3dP@Yfm{0BlD+k^ z5o62Qs!b2GRj_KC-4t@eBFaTmi#w$y&ZEpDk0cLe`qY6X$2{|timI3pv+?3G;<%Mo^703PrX0);U%S-Nb>z{f7x zxtno_b(Y;LCELjBVdw8pJA8y(G*^|Bz*L_Ai~N8Fj{S!8__2L&Ts%^(ddYX2tZL*5 z!~=aUZ4?UvkO~-<&>r~o7P`bt+J4Ii|9m#(g~OYx>)WeutYwcL3yLQ?s<*XnxWD7C zcU)6>_@WhUuOC=8=MFw@`-8{cNX@?dX4EtQpZry3mC@69EjDu^o6VLo;bS>i0nN$D z;T1h9d&GNO*uyMIVri+VyHMxstkkrWST-HMmCgMkI~%8Wr)6<06{npP%dpIzsIF-z zOo;JhI1v6QHX7Gy+3VG*s*B|rtM8_Mmg-ARO*OLuy^Y+Mk&%{>mmxAmhG{}2?DF@D zn!VCqhIJ!fYUidwr|t){V0(M)+VAqM1iBUsL)Z*E$YmOdPgT_kX-dH$odp zc_2;c`$TI>It@%}$^kP6@Bz#~SM4dk$e({oF8oN5TBHWEIU<{VwMuds@-Z2Z|bR&d!ok^W{Ak6K21z}9Wi)Fa0 zGm4bm2-EQFYY0bmzK?J;N=P#zou43#b~Ym{k$1<+@WjqtNEz38Hp1~Tf4R)L0B<4E zjD-?DP3BxAQ>tXRQKoFh-E`1%6T;NabqLcsPe(|!rGqv~Uo68NomT?hDMO+&UDBC@ zr#^;tnvO6R@N$Id2>T-E*~Va$_8P)S=MM;@cy_Q+j6I2iLI3jziT=T$d>6ubonIiF zFYhks{43yv5?&{63Y&mvJ>GDS>GYX1DziN zCYpzU53fNZr^+y0hNHo&q2LCkk3|VX;nDmk!f_HFFT;Cqces(-@jk+I8TJLu!;OA2 z90+L|E~RTYWaBr0qu}^(qa1QF+?Xt%oh3thKQ!FfEYr8hlzU`p+X0UPweKS=2R)+< z2Q-f|CP{d*gr`b)CTJUFoGQavGJUp$D`hxW=2_7BXXM!-OWTQXv}}vfvK2;y&Z9`# zC`01d7~s7QVS$9pJ6{Jpx%0OOXUT9r-ZYLe7NDkMAOn=XNWz>8J()k3^ACM{A zCA>qHxf5Z&5r91814|vk!6+@?7=oPn#t0dXHckgj*z=7-8Ac)V`H)F^b}V?6kG7y^ z7s!-FGOUp~H_Fn8l6;9hAGM~OJ7u^_hPx3KfCKL%OqbzkoI6q=Tf9KFb%AW_0`%5T zkbV#Hgk@WYWm|`3-w&f@A4B>$BLiVM+AAzuHViHiyb-kyqh$%EmJJ)!vSEW-woqa( zl-LVp`9$5EV)RQT!b>|sU5O}oif}7 z>_yN3PhdA9^}C2{YwRCJFUE;Xoqt2^ z#JjQcLZobxcsI-Px5(1&k(56m)3?i%9kNC{5f)3n6-&Mqqb^60LVPHeTBSsCpadLv z4JTg^2TEYZ>_XU2hJ(=}C9=PlpcY#J&ywMMnZBs=DWs5ul*qncf_9`lL{AA?lVH+L zB~m+$mAJ-ATw_5G`hdhWR^l2frEx59?Lzuw8P1YnC1hqSxJ2Qi&KD7Gl<;PGcZ&?~ zk)>^yFku`kF`fuqyNnajc1ID8kYRxg%TdCK!16l6Su>2{{qvKZ&qL=Gi1elKc}< zujdgyAX7+6Pei?_zkD9{^Ji zbwDA7(ay~XozCwNHp*~^Oy7xcGVY#@^QA3gF2aBelZ+a`$tZmaN?wjI4e~h!ynt2NPDdjB3SThCXe~fUl45xsqDQJf7c$H+F3|@VL zka%@6%KQX&!xZSZY52$Sn<2w_NI3;{+=_5A@|*$+DcmB%?J^{ddJ3>?#WPdz)C^g| z48%5mRKg5=>>5D0Muty!-ir?^3HwZmeWt{Is!TamrkpBMX34gjCEIQm?tTgVdm5ga zg}Ve(JI_vs(w;y_621_n5lo}xLP!XO_sA5Yf1#v*A)d-IPDB3J5IRUdP4ee7VE+&> z@#i$qKyahHyG6p(`lkUqJw^86BH*2dkT|dicnPLjEJB%|AtatJk~LZ+%UmSuwMg=O z5lW^!RL4cKj*Da+7lGSfB8B+2NY-(YtYej|U6pLjDp_)sY|ScJa+Pe&Dp_)sY|Sd! zf>kKz6QfGjnnu4Y^i-P5)X2KmK*M|pm}*obYt$&QG|HzM7q~}vccYw#WXTW7^oLOPaHLYnyJg9{@m4Dfa1R;g zz{=W;$5K9pt}Pa89!IiCUNqXMSD zsM4^F^m+}$iH*^S?>(4_ucnaa771fFIcBljBy7v{$0Y2N>CZ|S?o^QH4GEKfs~Y12 z4P$kSP1P_rQW$+t$MDIDFoLW`!zS`vqhSljy=~U8jr2z}>@!Yh`!$?k^aCGMIew!L z$0k)-X25rlFVb+L;RJ#b4iL?O)e=r5Is+RdoFvn)mT-!MRejR{rvy}eGXZA=6b)H2 z&kHhtHsG{?s&5aOuIk$ha7uu_b7N+2%9Dt<(t!I?p2Rc>V>bfeJ`x^G`4h2A19?VB zI3nTE5-ukg8*V87ED1|oiKi2sq|%p5Sk@(R_1$>|!C+zD^!lYOjjfH#+VUngwlp=i zRJYYPHjK$DUAZ!^rM|YVtu?PD-WqRN9j_TPr@F3jRrRcRZTrgVmagYia-L3CS99Yn zttcliJSJ4AQgp8R*1YPxwwCIe_^Rrb6?u)z{tW@JEgFp$W0g^DtOT^gSj&=)xUt-5 zF#d*L*S*X`0cN=+-_aOci0-6r_U5b2-u-O{1 z9j6Ux6J=>lGOR{QJ)j26(DRH^;9iNi1!=YD_icEJuHuN}h*u-5LC!hAU5BTL+F3}e zMSou@>G>&q-E-$1m%sbHxe`aKrY8^c<1rYu3V(#Hd;UD+B>JlHYXf!Fpe-(GYB5$I zjq3Y<$AO=s-sRR9@RGRIhMLEr(}<7M0&SA&pQ4Mn8vhS;43*SV9xAOBr8USD#p`-W zeH(1vCgfO#yGvzh1g%2NSK>$QLhUvMROI14VI=;w;+i<4IM9aj8*w!ccSvp;aZPvU zfckcnF-POb0~RVlJv$6{ySFUynV!yrY&HUW4Ycszkb zYDdEA(og+|`kAdzY zsh%Ty8c|D-bk~l`qrb4 zq}Q5&wG~`dJXs}a=;|GdQKcl!yo(Nf(;gk_DyLi{1k=hnG<>r&5eK`B%!$s>&d~N->Q0)Nc;ohejAST{c9UB}VyNY7DE zrqZW_PNLP-e@a)*K?=3REIhXq9HV-)bdwbt!H7po`KT zSGU(3PiG!h9*BZ9Ud?7e0+kF>JE{IdntGMgVl-Y+t5E;yKAx!h5_d=*sn@PVj_$3j zG=F!kL-HC&Zjy|yQH68}wGZi|8hMXO{dcncV;s~A)!3p&+ImTWqJ?@J$q8vjs+lUa zQeIK|6kt)>q-*S&jaH-D5-ntP5T$OLP+QZ;O3#ucx1nU!Pe>9dC$(ZTQtRc@N^abC zXp(n{62jW`oI3^*b&6u@+r&{SmF`mLmePH!83Sr)v~R+!2m3M5qV#VJ+KXhbyG1ny z*VLZ*$W8sJ5fV-^(1a4!{>ZNDvhj$A^*?#<&$!c-kNVAQlp)`=-bm6L#i7P9SScg$HRmYkr!i=uAS}uPSeAttog$dq z7Gq{R7HiPsu>N`y=7TZRunax194n}fF$wwutC*PUPJ>1|1+&zd#;MRgvoSVRVx@GR zF(0c@3$Ze^2y@2Mu{&ZhT51X8fqLpP@Qd`^a%ifRkPqT!6C}6=(oE958uD}|TI?)i zo$)i{Y~vi`TA4;b6A-mz28 zz8}K;`(fh|<5A-=<8k8&=EEsgdocrl3iI!0Fw6dp@vQM%cm{gjcmbYvUNR0CFB`Am z%;49I*Nub5?=hSG15P1-)A*C|7WQ-=G7jVGq<4)!8}AwK8-FqWiW%;Q#z&aB{N4D6 z@v(8l_{8`W`}aP_{?dOMUm9N-M~$zIZ;Wq^?~Lz_ABWo~#$kWxZJ+)|d5zzt=oAfDL4W*kE=78^VUNVQe@X!A7!C zY&07K9}__q!gnZPR)}p;5f){|tb~naC$e#DJUa=_Ct`5vQN|`>UsVNj*d#WYO<_~n z$!r>%4wtes*i3dRn}yFb=CDdOm(64I*#fqZoyHcyDaPs86ttLCvnBY5qXvFMma$q^ z$LiT~wt}r>t5^fRgluBXtcA70CrUe8&DO9p*;;(Qw~qacoz2dH=i2q`Jhp+I&n{pW zvWwWo>=JeVr%zx?0R+syOG_*Zf3WzTiIr| zg>7ZGvD?|N*&W#UeHXi%ZDaSad)a;LemK_H&UUb!>_N7RJ;ZinTlgdFQT7;noISzz zuqWX|VIO;nJC8{?7ivK4wSQC)n`+8T*`l z!T!m}&Q7`<8vjzGpwMW2}R9V(TD-cLISOsTQ}nk0)?H5AZ~u#FKdnocX5l zboegFdw3}?;}dx~uiy?gXHMo*_*8x} zpT?*2Q}C((Onxe#g>Tp9@Jf8VHjmHe3;05Q8ehb#`03dAvzS-&C44Eb;c>o<*YY|z z&R7nYI4k)o-hlnKO}v@6@K)Z&+xcp~hMx(y8fU>_&d>PS{2Xi~SkKSn8~FMB0)8Pr zjk}m%!Y}2Q@yq!Y{7U|Feih%yH}R|aFZeb5TK-G^D>xp#p5MT4t-@8eJLr};B{KmQGXmj9MN$Dijf@E7?@`~ZKMzrtVTukqjU*ZD#Id;SLh1OFp` zlmCgo#oy+K_+kDIf0zH6zsKL_f8l@SAMg+PNBnR6@BAP9V}68x!awDo@z41e{Ga%a z@+*Fnf6c$)-}3MH_xuNbjCb%(D13&!$O60VEbNT&i3E7X3W!9JB$7pnNQIk@bV1)N zWr=KfU&s+X;d~%h^cHBuSBF2gn#W*ouoFpb-tAD8|6B9+bs1S~rBqoa~VyZYniP>U~s1$R>JTYG^fRmup#3E58PKN`F#iCj)5lcl4zRFuBYDJx>hYO(TV(JI=qA;N90=3=(Zg&x+rQ=fv~k1@WSINgNO_i&w;};x+L*@wzxDelOk-e-M8ZZ;C&Ox5V4xkT@*f z5$}pWi}%F);xFQ_;sf!a_(=Rs{9XJ*d@PQLPsFF#Y5uwRLi|&FDZUa%#n<8+@vZny zd@p_w$3%zdgf|0ba%{CUP0O@RpP69#&48I`CYi}*ikS*u2kB;pnQ3O3*=7$j$LwkL zGIPz|W*@UJY@GgZ&oRIpXbv(5n zm{GGB&JD)mE9r5tj81}2pqN=|mYEaHa0{j*O+ITYt6IFb>`2^v(0nNbItYUdFBT5eDebHLh~Z?V)GL7Qu8wN za`OuFO7rLN`>@g6WL|Cl!o0@3*8HXUEAu+@dh-VJM)M}~X7d)fgxG9uF}IqxnYWw2 zHt#U+ghP(I&28pA=Dp^9u7zdZ562PP%^l`W^Fec$`H;EWd>C#!9yK2`A2**c_n1#& z|HVG@Df4Ob8FRn+8}~UCo6nlRHJ>w|H(xMcG+#0gm@k{Jn6H|znZGk%HxHV>H{US- zVE)m3)BKb9mie}M$UF=u74MpVHs3SfH~(V()%?Kx(4=$Jy8W4dGyiV>!~EDhg0GM9 zrJsp!_sq}m`y4-5g62QXFU_yaqvqG&aFo*r*M0GWGf%5O zetGx}z;7UagYX-S-wC>$Av%V03;MI*3|z*;b&T)4t&tjr$6orgM(cQtj`OXc6|xGf zFzyxN2RDQCXGL@z)p4;^VvV&%2<nyhB4#cH+M;A(BPwZ=LVz6sB= zusw(Vte@!^+fL}uI>$QKS}(!>7+B|78<6{a>jLXS>muu7>k{iy>oV(d>k8{i>*v;0 z)<$cSb+z>i>l*7?>zCHAtm~}ntsATxt(&Zyty`>HtkjKq>n`hV zYnyeCb+2`wb-(q1wcXlb?X(`Wc3BTuyRC<Hl6Am(*?Pr#)q2hPo%OnP(E7dghV=*QkJg*kpRBj6x2;3g zVe1|1UF*-*d)E8bU#!1cA6Oq+A7QuI->rXGA6rMPPpnVjOXG9v3+tcOm)2L-QR{2# z8|+2<&idZ^!8&GjSe~UkPp3XR!S>q$JJC+ElkF5c)lRe1u}41>eq*!k z9(Io16YdCe?cR1DyRY5P?r-PW1MGp=!ZFxB!5(4{wTHo3;Rt)AJ<1+!kFoRZpdEro z&#+x+7ugXzY8Trj_E`Hwdz?MqKFOW{hYqE7nLW`iw<~PNo&-0qQ|zhs$@VmRx_yd0 z1G`*LwP)G0?KyU(J=dOR&$k!Y3+>bFMRt{aI$UinwyW(W_ENjXj@!%ZTAZa+4`+od z?3MN^y8({4n(St~#cs9R>~^@cTw|YUuZ1hab@tEfv+Z;2bM5u^dG-eTeES0XLi-~7 zV*3*NQu{Lda{CJVO8e*bRX7=HlYKSzrd(rRYyZ;zm3^IkJ$C8cXy0VtY~NzvYHzl; z*jw$}?Az^M+jrP^+IQJ^V-Mdw_PzFf_Wd}sWxKt@-f2H*@3J4VciRtRJNTpaWA@|r z6ZRhaNq8sOXFp{>Z9il0w|`?lYyZ}M&VJs0!G6(x$v$Ae3`bh8+OOHa!_Jt4_V4XC z>_6ClwBNM(4 zy%DQ#sBMY2wYM~gRqY|sR38#E>Qy0y+%p)Z4KKj|^CcGVOtL9Ut^7`e84b@GJt!*uhO?A{b4aCIO_|nFP8h`b& z`ua$yps?75ic9Rt1qH!q*q$6JE-F+}QAl2e!-2-8c*7FNMZC>ds@mOGt>VOqOY2*f zwy#>YGJa;_(k|GXNcCKbz*nK4z&low7`s9VNL)r{1?7t)NSxI5bYg86Y)+yawFnX> zxh+wvfyBvO`4a28U~}@4>K3yOfjy&Z zDlu_+7o2diOUDWgB&|R{i8rjQZm6kWnlR11z0w6vae)R6h>C_<5pSsV&CmqlRkmc# z3`J0*j1p$K&$VbEadsCOiLG6*Ifp9TMis796>e7*uGHnX>+&mA`R%I0mAb<1y2A6i zN=#hS4PMXS<|>*ZA>HzkX>o zgi=a)u(+f!skTNli7M-p)^H=kx0! zbrL6^SubYQHCnT!mYGxC?$h|i#JYMhv$Z~n%5d?f>YMI$Kq@Rnx7Jsxk|00=exh1J zS?#J`?xQl%TtdXxk`^@2BBJTCjntt@4_YfE=}>V*dP6%uv)slqpaKu-x?AX_6?ss^ zgQ6a!R4z&`Dsj^yK@ak9L|h!9La)4#S4zk$CFGS-;FVI~l~UlA5-jlOEAYxI@aQY> zN-pq9F7QeYdnJdxlEYrfVUGu44@cO;5%zF|Jse>VN7%zr=;1&|rQr!2D)ev^dN>L_ z99?`V^l%h>?w z9Q8^r_DU}H>RasLDE4p^dpL?c9K{}vVh=~LhojiTQR3k!@oK(_Km{7ZNZBre*&bvUN3lzCP#08=*Q0xLF8Ym9BK**X= z*VuvyvkWU`*iK<`U1Q^l>LoCTF*Ynog1NFJzOr!*UHIhyB_TPO5v0p2aSJX9xhVxM z;F4V8l3e1FT;h^k;*wnAl3b!mjs$hdk)SR)64WI}g1Y1g8l}`F)L-pFfl{w30eoYp zYn4{oHSWt=q*WiE&@G3oarYcDA*)*sui&h1<#>tRu}MRwds#9evs+m%<(b`za?=vk zd_2mF`iJs-E$#b$OBo{hWkT)N?M{6!n;U=_fN+3WT3*T?qv$ zyg~zU540;}aduorX%)vaIevUXw;YP=-Et_dcgx|S$?BHNOYDwKq3@PUCS-Oi%dJOd zw@hwYV2W30pxy)hQ{4OhdKXgC9w~I?w#b#+B3EvU3ar+;`0DBaEUM~dt?}B%l?rUa zbzP!NZN_w@t<|clZ>ev#+VF*F+>#kBna6f-H^Q2*o7i{pvbc(bpyuD$^z!pfj10iUEIy}j9lNx4kGaItFZSH)LaHMnl$b#bw} zdbM>{_1gLd0Ru*~;kUN2CSh59L-ooP)yo8a7I4RP(yI6>fuFkH(B2^Mvs-b0MV(27 z_~e64ao!XUNU*IH<_s!^P&7A!Qjl&EjhGv*_SZDFFIfo=t+w$4UY!8Qt|hCv&X1_I z4kfQjZiue|H=E-tVLvqlkYCp{*`-zTI>o(GoC`?W>xg}6U7+HiuNo6p(40sG>B0gM zmaI#cNs`z4W?HutnZ-{`l??@xGQLcql!>dVo9dhWV7Ee*D4DKd$$AAR)WsFxM}72d z*%&$%&7mQ%L_uB!^$j$Tf)Zu@bSm0NLueocC8=go7m8_38he5ZB+7=;PolXL6rh&S zU>6G#(10>A0klgF`%qt!L?39P7?XO6Bts-|8E3^?8rRg}>rAi-U2 zVj(S}jFd|mP1((-Ew#ZXLZZvC8l-DsVs#i~Tu`P;qExB`Q)H?~M2gJsU8<5Ka`lV^ljSomwq*H; zdxd3Om%HsQ6o9Soau)`_3nJAe4XG|DQx%mmRZ%HZy+>2z9q*FLZ)s3e$~%fmnd;Jz zEN{41%5o|$)@D7)%mVkGf2|7z7IdLl>w)$HS-ibgMrIAx@%$20vlLn$E)41pOORG+ z5Oi1Jg|uLzbGphGI#A8ZA_Z<&g9-|{&$^wC(p)7Nb-O9jT#=8uDhO$=@O#}9CA-}| z>M63qkfsWL`4k0&L#YDL;&yC69xa~YDb%Yflus)jJgZb1rFqyqB@^|OOrc(VK|Zan z>4~mq-GQZ0ugy?Cua;UhQ<|#;3-!tkrFqnA1y5=2U|6WvbtuhMuTj0;KxwW*E_4-7 zK~%3dfG@5JLYh0U6zVl0JgZd@_#H+D)%dQJP1AHXJBTQ4jj`>J?O}HWKKr%gN#{ z6T(%}$miCwSg&r-v#Kqryso=0hl;xfO>gijbWMYTuA!rAU@7iqZn^!#8$|GgE4#(I z_W*B~Nus44Y2Khzta}CJ^XT&=w%C*VVlC~I&*g5hCt<~&>=tY3qK;ZfJ=>n%7f`wKP#ax3!A3L{OU79=i3BrdNHy`>vMp+Pt`{RlC|luSC)l9?g0s zlF~f9dL4A&ozz@rN}2kj5X<_zT=v(@~)5 z2)lIX^pH+3(CG!5z5-2Ofu^rO(^sJBE70^6X!;5?eFd7n0!?3mrmtXP(rk=B?wgh* zyjJ!uhy%d_RU^dmi6F)snO+#IQE`#JE-LrSsT56jlu2I_akU*Ft#1M89t=qJkRm`@ z%K}moLup!b08$b|X#5HUZ?-LyuQ<*Qnho+k*hCCqFOiLS*;rg z^6KGE@{s1$Lu(1j=hZ`N38c9bL_i*WT4&N-k3OyUD9xiv>ocTjEk=;XXLmA<-a z`iL}-KG!xvnn#~&2O-VlhHD3vxHb>4xi$|V4~J{>AkD+!+BZn^aA>QBO7U>GQ`C}Z zRA~fAsnk@EQ5`D{0r}L|N<%<4^|jIvkV}27Gz4T)Un>m}4Jr*04Jr*54JyqQ4Jr*4 z4Jr)<30BW(4I0%N6tb(+HGZu@A+|Ik84SPu&`7=U#g!k)#a8hBmBX_GOf?bBtLPj^Ox!TWs+Y=m-Hgm z_{ucCa(%yC->=Zu73w+?RrM^3sQQ;h6#vU2`hKy#F4os2s$I*975x!~&nYXB{KrVC z@0aT5O7(LS72T1Eitb3cymrb;^>gJiec6&Fs-BT@)lOxlil33F;zOidU#t2QL?ZI} zf?%n0jSx;{}| zpQxM9rB}6oBr5R*BT*$sWks@lr!1o6v@GJ5r{ue=NS5c6Dg21ta+TafqMGkfw;Y{6 zqWKlk`HOY=MQ*vO-;@>U=ZiJoVqK47T~1WXfuh?fQ}PkS=qUR`nW`_+-D?-08@tbI z`dm6Ze6CzAQG6|4s>&^PpRdu^ny-H(p z{nO<~ndV!W=3AM@SElLKdM2XvOhoAy^j}@SGA*BFE?(VE6Lq;0bv-I{{)w7j<(dx@ zHCR3SECkr#m{` zanm(jdOV60t9%8@(he3VOFLAd#%08^-iRfgh$TM}OF9ut{veigB9?R_mhFL9wgcj7 zl5@mMbi7o@H9D647WZX;2vw+Y8L`H%#${Y<{2`5Bjmt>a_|?n?*BZYXmvJrYiCFRj zvE&D0$q&S`oe<0R4^^m{3u295&0IopHFH6_#;;~BxYqd9%mvpPzspZGb3wYsU!d`; z85Pnsel?>CRj3&iVvRqn`5)Hx4{Q8k&Hu2*AJ+U2Yy4r&|FEuqSmO_C{9#@Hu*M(O z^)Hli8mdq;TErTEp~hdR@fT|Rg&KdM#$TxM7i#>48h@e2U#RgHYW#&7f1$>&=4GJ@ zHGU%2_|}9IbC0t#2HyZyc>}9IbC0t#2HyXB@3x9IaOztxp`SPaLgJ9Ia0rtxp`S zPaLgJ9Ia0rtxp`SPaLgJ9Ia0rtxp`SPaLgJ9Ia0rtxp`SPaLgJ9Ia0rtxp`SPaLgJ z9Ia0rtxp`SPaLgJ9Ia0rtxp`SPaLgJ9A(Fc9A(ENR{GOX^9Eci{p~0_9@k3WI9lI0 zTHiQY-#A*|I9lI0THiQY-#A*|I9lI0THiQY-#A*|I9lI0THiQY-#A*|I9lI0THiQY z-#A*|IIg}?c5}#4b~9q7?;K_Sha6@9Bi8yz%>!_)^qr$thH~>shJy@pkmT5hxR=z`yn%5)N?XKqWxYq5i?0H=4`YQV!*BY;~*Kw`!PSo|C zsPQU$9rra}Wv_=EWv3(7c-1-qu5~??{f=v0Pqi+9Ypw5<9gk~`N7?VV)_9ct9&(iZ zj#%SS_B*b1{gnNVYmHag@3_`@mHm!ujaS+4xYqTo(D*Afe=9V8N8@vJJ31PlqwzSJ zpN_`kXnv~sK*&+^0mK@Qqw(nZKv<2N!LS-H5li_*EXzkM%SSBBM=a?_EZYgOEElmX z7qO%tv7|p3R^udMDVK<4eGtp~AeQw(tnn(l9@iSL8aHt*>xEe3*X#RXHEtqZ<5zY) zt~Gu&jt0YO97U}0tML=p8m}5Zajo&{`B7MnpGenu)%b~PU2iph;#${Rji14=8b1;1 zdaLmh*Sg+n{KU1!uf|VYYy4{b#I>%s8b5KZ`L4!KT-JUSC$4pU)%b~PU0*eR;#${NjdQ`UUZ)DHaW04n1nCpRs(vtt^|h)W z3`Tve>KD@U+K`^thV;5ZfnL7}seXa-9J!rXz_So}Wo0;T2L3{kMkj(SGgx&?^%C4O zDHrb1o^pnqf;H8HSA9c$n=u3*TGkt*=o?0(U}b%6H9QGXPWpo*8yRvL!f_Iw z$J6jVd^|h|KMs$>cf&LA*YF~IG`tSK3~#{~!~5{R@DKd^C-&(70XyK6tTddA+SBS| zdUZm`fBW!z5zR=w_;cH zHtdAniQUhSnJ-)W#EsbJ{5Hz{9=nf;ceCJuV~`jkhQixM2p%>rg~y6(;i2MYc%}F? zJWo6XZxegqVd6LNDscdwBz_O?5r^P0;;--$@elDi{0Y2a+1RI_f?fGNunWJRHP9Mj zjj+aGU;HfWJ70*M=1V|l9d?p8VfXl%*3Ymzd_8u2UxHoU8?m$dI_&1&j2+x}Vb}I{ z?9_e)yR)CfuI&BTY5gwtOCPhTP3RxBI&pR&e2MgekB}gIf_w=-8&|`p#!c{}aXWlx z?1F!cC*TufKm1_41m712;qT&Y__+8B{91gBe_z7)!5`sSAQ^rHvf($NuQk9r!5VIj z#!mhs?37<%Rawno!|G#mT^)xOOdGOHE4<1-X!ShN1ysd12SCfn2(d06C zGT8_ZCclK|l3U=dR(`!m@nu^^gkB4mt4T(BB$l z4YfvE`BvD9!h6Dr)_C|zD77ZSKf)wyigmIz-I`&Y3hxH<;L+d=crK`gzk*d(GrSY5 zwa$k3f%D)|;8J)I*aXi3*TY-D7I+A_8(sl+z!Siu*!{m3yZ(QJ-Tp6Pr~fP1<^MW% z`2PXB``^N@{y$?!|94ggcIKmZgDY+i8L9iodGPjfAw0cY3J)(=!Lv(Of4LieTkeC; zmj9~X9D!ez&*4wyYxq+69)0Ll_~JMSuDk{B8{fcN#t&u(d}H8@y?@)cB33bcN{q8k zf(MB*_>FL^$<|bB8azSF{D1Cu&%p=6OYnd2DtsRtgx`Zdq9-0kUwlvXM%xFC=$HMG z!CxAO_KivX*aKeN2E$`pP@HQB^tr#Q*nC5LWpK#S*9b2V-y*z3e2?(wC?^0t-oxl4 zj>;V0$Q<9v96!h$(BI^v2048i<5(G!KF)&oxIAe7Q6j_O{Bto0;TK{u!hZ^!^1#0o zQxSe8PDXeXPciZ+@&N?+T-1}p4-m!$_yWRN#E^?G0e>Z^4jod82%pko6dS$CmpFWw z&|hyB+>m?B_K&z|@F=DeP-4(;TO(5h&$WzTwH+9VlXuyMD9*Rt zJUe)5a8$RHK3n^(?*nIe^lt_lhMY!|3qo?_coO{!4(L{xnN>RA(1`<^{;}wrM_+s| zcG&m$=sQvtY~GOli{J*aAHUI?1$p;Mo3yvrweMUx%bED~TdO7~hi(rhd!#bBZ3&)t zxg=6lnsz2%SQ^R>X4<$&$V{4t9kub6hP;W@P4Q4xFoTkPnTh4?Ela8!R%6e6Jd}#k zkQ&Ie=hRiNX^V&Y276ONVrG^~$eS2%X{%p`&AR03JJdhemu`#99{Tni?6YWXt6tTF zJ;r$xON0G#l41W9(6=A-w=gF;M3>=$a1p*WUKpI+jo8ZBp`2j0!k+>s;Pu$(+Au0_ zO2g7Ip^?Gi3eiCKMjoNco9*J74L9TUOXIDCbORgMohxwZCpNHD1L*<2fidIm7k1wM z(t*4O0%u=(@5Sw(?KiL!uMPdymbCKSG=|2P~?`>y{~4##-oSp z^0$5P{?nITG2)ra2VA^t&-wG`HMZ{^w{6J9RWGDvkGu7Pzt4Fp(6ImiRCnd!P_KR8 zjG@6ycF|bIk~R5_C2M5gmo%25vW&`>ZS2BKg)EH{BFi9arDW~M(m5nTDan%MM2N^z zM-rajjEYXrd3&z+y3YH&=dZc$`MJk^-M{bW^Ifj{{(jb)jRx;-V@(wb8&DVP;tzV8 zjcJ`97vdRcD%aOe-+7G8pE!2(!))06>FZ7q(g#zfp(jGtMadndF#)BszaSUKO#8?y zC&{H8s^!u5YoWBD>E{s!075SyPY(xe7^Hg$1SSrM0wQ0>03?e0Bp&arA|vDF?B~4) zys7OCV0$-_4fU zu$8T*qOG|H{41)Z^6i2l0LHJYpoIh5DZk51`Cp*wDTE$eAvk7*ftGoV2iWn|zG>MJ z*n^s&p(#mYq!r}0zJCxEv;+c;k^AzL?XNn#nDfDDQYj6@8;~AelaAZ5wx@>S5_v}- zwk5Goz$}sP^u=Uolx~l;CYhyo3psHvX($Ssdt)N!n29_s7BdSe zt#;I0lq_57G2+`oe{>W#InoEug_o1b=B-H+Wr~iG8rW~V`VMq z*vmgKc2CZ|<=tSOqRRzT5~AuLzkS$og=2KFx@!Su!v`aC3Fyqy82eoK(raLOR!GrA zi?MU~fk0D_)f<9FrDfjk5=h8GZb^c|TK4!6H@fV7?xPJUjce@=%ljv`k#(jC2TtWn zE>y*`h|iE-(vzbs(nF2lNPw@6CCh#3jcqBccz@a*@ktWb4YkpOUdGQ9GAq4seB~*- zYxhkAPkV+ebB&AMy!9^aVDyt z0?9Uj(DJ{8B!U79DkPzxU;!v1O#$O>KoSrqi;_j6g#HSQct1aBXGbdhxG0l$QIPgO zAdtTCKSH4VpX?cAU#elaT+yU$zk0xqE-s?TYY}CE64|rh zn&2U{RNKatJcGbDo($}pPIHRB@0a-TJU&GDdft`L)UqX#gpcVSf0Th{|6C;!jqM2} zrxKlAR~a71&iU6eT<}XIApiKgl*iuF>J#sg;V-+w@&bHZ?`N3n0}6s=xwm#YsY&%+D3RP2 z+RI&TANndY-)l|n{7rxeV*@GR(*^}FgB@by)YM{FyVU=1emlH>>yE)dPwxHI>oKtl zX?uAGQ!j;~#hoS47-eO}KWSg=!SDmT6ihO)b8gCOY?0-_2m%6>=d|qHo6jx1yzppE ze>`}Z!4)4&@z&s3LkxIL96TFF_13cBu~x8dv@!fItmvn%99nnZdt7zF3?-hO8gvwx z$}LXVb?oC>vPoX`T4pXczLsXh?8&+ zpV|;J@F5pE_!QtMr-seb8WhZmE#R! zSdN2qpvjxG3Y==X1uq6J!jWA(aZ!qUeBTvk4hLI0mux;o%jl)TcbB0LP|q5ybj#02 zHmJPCUN$RTEe!F*o897WPhk)jq_IhKa8;}|X4|G_y>7R1?KmU6;3>h{=3SNQQ7%Ft ztpAVt(#Yhs+Z_=-g*$!i)!OdO!SjTGa{6)~6bHiVFqX;161B6@(ejzYIIzUK` zWU+hV{m#`lOZY%I#~srP>yL7L|L@-)@h3J;WrgHPrpAQDRBnZt8i+`5AnT&NgKTyd z(<61di!r2Dm2ts^Ih&;2m1O;gPVYXyXjfG|T)Y?Sx+dbO(b`@zL>D%QN!XXo;_X(u z#%9j#+W7g2_9*LNwE2`%=&cf-hf<2Wr0ZRB*kX4vJLfH7d6xxSdpH*@Z=3?F9*6J%^G5!@{eTn&hU_VfL2>5~hgaN?~cH6nhZrWZrFhc+X5K1y)K}`(M zTX%CKF+frh12{D?$UVz>u$KwgE}y)vg8Fq)Ce%|=*mUt}{Oi?QtIbe(0g;y1IWMtq z!=ZTn>jSd3TpR}^l;*?lRK%<3S1OyG!v2ausCce)bUd=iK$RBu_8Ez4R5m{%rMxm+ z@a%n)qCQ0Tc&@-o@urMJN2H@xjv>~FnY-G!FDVT;tnZJjcvd@DbsdpuUgM|Atx{4E z9e+FKwyC**8Ed6nfPOYk6*=Ec!57ArY zq#4ogHy@)Li`)f;(B=^#;^2OW{JU73_Mbs9Ec6Ut(sE8vV2qNQP?A)>?O?lG4hj3a zsHzUR+1ji_rCU>-WZ%%L`-QdKdTix+t|XyXz%19QUX0{jkn4e3$Ho%x5sV9R z%8rK=?5%bQ2qwPd2pX3tYO{H;ANbc_GjnGS&?YF`n_F~m=CgjM~8z$egST{ zMj5Tdvo@d-u!lf0`yC{+)(tXabliTrkXltS*t%KNI>kSQG&XW3Ko-1Lt)PsN2TK@$ z0?3Bob!>n#1n_?g`F)AzX#av7f1XfDM>AB~4_l>8TRKfVdq1k{Q!LwXd13n-M%s`Jg6G;&JK)QFB9yVhM512e4e5%gbi z&2v!p!H)_R%t*_xfNzPT@2Mz%j5fkQjxVcfT z=PTxA1X0JQ+Ag-}A@A<6^|7^%auM!=%9i5DUj3HIt1E*E@*nOa6!P?6yg|8rV%Dvg zl;!j0sq0#PjT4xTR-E$cMxG(9ZUja|$bN9A)V{AFfEmmtArMK0J8(E(o##L)*V$JG z6CbH(b^itT6;t3Z3?t+KgsjMa%OpAYYyXWPi{*!q!HBX{0hl&;)Lw(UkE|M{ye0jk zc4ece_EAbXGT!d4GGOgR#@p8m=kJX7lc9J`iqixgCN(SkzP?B$IU|FYvbRG{Xv9fD zDi9wAf;EqfD9$t-@QdhK4)^ek$iA0<&49mXbf(~gT9n(xLnhq^Ii`nZJAQkam@RFF)rPYr4x>NrDwF?-FhltsimZT&fP`E8U*ey`9ZWQX)LdtzET zYor{4CnlVpryDb4(i&bX(o$CU8ml@L$Z|f~VvIg1UZrOkg%NQ`NYF9swHQ2x2zv<@0SJ}< znD_^}m5w*-*kr;o!12umibF8lXhCNNvNpvreyM^p&|(l(&fy>(PnVhbAnQ>vov~1mc$8Kw$8IFWDec50r!16huT*M7F5{ zIcQKKh9YQ0ku%y58u}_}ND(yKkWaD&C1ogbVHPy9IiiswUratQFmTWJCXWyH_5$zt zd!G#cb2tbiLTEIDZGt*6i`clOprD)WHdoF8wC|xvi5NcjgC5KG`GXRSKV~l8a@OmY z!enGAJr$798nk;AqF$C7Lyj}CycB$C7Ohon)pQtNF3{%X^h??kCkWdmr_PEyopJAV zH6mhP0RDm;m)+)+2R;t1r@wse&LebUTGx(cy>m8DPDLlrowiHiLd1}*@^;zSLGiU) zy}g*~*PO^XLeC!XRi zJfhm=^p==~--gvZ?cI^zUz8ZGSJSkfx1YZ&*w#F|Fq*W8*UY)eTVf!q@C2cj1!FDA zAc&t>xES9Ul0yU|8zN+7^A*x#h>*A7SCbTbKk>IzCZQ}p)I$;U@D1aGg5d)B5Wu~; zAX*I5x4||DXp7&>ln%oT`e#ZD1VylJ0ah{&gH?}jPhl7~7)$<>Yp(!#zt^fNwwb~w z5jtA~6EGv7m_VMmNpS2Z{?mqZ_Gr>XL+RnS8GN*Fl?60>+-cfL}wmYVJb9Nc{O; zxel>NjIr88{>Q?r#a>2tgz6)4@Zu<0lJ1nvIx6+{(9IX2o%fa<6_;V8+BU(=^zxT_a5jr8lZhlrIRO@#4p_O}nC5TeUAN;YHl7*;*yyMgf=A zCnqguKED`$!n4}mQtj(`?u=hNN8XW<2&b7b6aO2{eJpUF1g_5xoZS;rnUcbnBCM~& z`p*Zg^arrWm1K2SaA$Jk+0+qNFY-#v2=L~lX6RXSv*uJCUh+vZ^thnKARX6r#b;>t Oo}f$2tSgbyIR9T7!`lr2 literal 0 HcmV?d00001 diff --git a/src/test/test.cpp b/src/test/test.cpp new file mode 100644 index 0000000000000..0cf7fbd720f6d --- /dev/null +++ b/src/test/test.cpp @@ -0,0 +1,107 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +//#include + +/////////////////////////////////////////////////////////////////////////////// + +int Test::s_total = 0; +int Test::s_passed = 0; +bool Test::s_quiet = false; + +/////////////////////////////////////////////////////////////////////////////// + +#define RUN_TESTSUITE(name) \ + if (suite.empty() || suite == #name) { \ + if (!s_quiet) { \ + printf(#name "......\n\n"); \ + } \ + name test; \ + if (test.RunTests(which)) { \ + if (!s_quiet) { \ + printf("\n" #name " OK\n\n"); \ + } \ + } else { \ + printf("\n" #name " #####>>> FAILED <<< #####\n\n"); \ + allPassed = false; \ + } \ + } \ + +/////////////////////////////////////////////////////////////////////////////// + +void Test::RunTests(std::string &suite, std::string &which, std::string &set) { + bool allPassed = true; + SharedMemoryManager::Init(16 * 1024 * 1024, true); + + size_t pos = suite.find("::"); + if (pos != std::string::npos) { + which = suite.substr(pos + 2); + suite = suite.substr(0, pos); + } + + // individual test suites + if (suite == "TestCodeRun") { + RUN_TESTSUITE(TestCodeRun); + goto done; + } + if (suite == "TestCodeRunEval") { + suite = "TestCodeRun"; + Option::EnableEval = Option::FullEval; + RUN_TESTSUITE(TestCodeRun); + goto done; + } + if (suite == "TestServer") { + RUN_TESTSUITE(TestServer); + goto done; + } + if (suite == "TestServerEval") { + suite = "TestServer"; + Option::EnableEval = Option::FullEval; + RUN_TESTSUITE(TestServer); + goto done; + } + if (suite == "TestPerformance") { + RUN_TESTSUITE(TestPerformance); + goto done; + } + + // fast unit tests + if (set != "TestExt") { +#include + } + if (set == "QuickTests") { + goto done; + } + + // complete extension tests +#include "test_ext.inc" + + if (suite == "" && set != "NoCodeRun" && set != "TestExt") { + RUN_TESTSUITE(TestCodeRun); + } + + done: + if (allPassed) { + ASSERT(s_total == s_passed); + printf("%d/%d unit tests passed.\n", s_passed, s_total); + } else { + printf("ERROR: %d/%d unit tests failed.\n", s_total - s_passed, s_total); + } +} diff --git a/src/test/test.h b/src/test/test.h new file mode 100644 index 0000000000000..7e219f0cb5124 --- /dev/null +++ b/src/test/test.h @@ -0,0 +1,38 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_H__ +#define __TEST_H__ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class Test { + public: + static int s_total; + static int s_passed; + static bool s_quiet; // less printf, good for nightly unit test runs + + public: + Test() {} + + void RunTests(std::string &suite, std::string &which, std::string &set); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_H__ diff --git a/src/test/test.wsdl b/src/test/test.wsdl new file mode 100644 index 0000000000000..0740b7db6212a --- /dev/null +++ b/src/test/test.wsdl @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/test_base.cpp b/src/test/test_base.cpp new file mode 100644 index 0000000000000..18094a06f073a --- /dev/null +++ b/src/test/test_base.cpp @@ -0,0 +1,67 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +TestBase::TestBase() { + Option::GenerateCPPComments = false; + Option::GenerateCPPNameSpace = false; + Option::KeepStatementsWithNoEffect = true; +} + +bool TestBase::Count(bool result) { + if (result) Test::s_passed++; + Test::s_total++; + return result; +} + +bool TestBase::VerifySame(const char *exp1, const char *exp2, + CVarRef v1, CVarRef v2) { + if (!v1.same(v2)) { + g_context->obEndAll(); + printf("%s = \n", exp1); f_var_dump(v1); + printf("%s = \n", exp2); f_var_dump(v2); + return false; + } + return true; +} + +bool TestBase::VerifyClose(const char *exp1, const char *exp2, + double v1, double v2) { + double diff = v1 > v2 ? v1 - v2 : v2 - v1; + if (diff > 0.00001) { + g_context->obEndAll(); + printf("%s = \n", exp1); f_var_dump(v1); + printf("%s = \n", exp2); f_var_dump(v2); + return false; + } + return true; +} + +bool TestBase::array_value_exists(CVarRef var, CVarRef value) { + bool found = !same(f_array_search(value, var.toArray()), false); + if (!found) { + f_var_dump(var); + } + return found; +} diff --git a/src/test/test_base.h b/src/test/test_base.h new file mode 100644 index 0000000000000..65b40bf20c4ec --- /dev/null +++ b/src/test/test_base.h @@ -0,0 +1,80 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_BASE_H__ +#define __TEST_BASE_H__ + +#include +#include +#include +#include +#include + +using namespace HPHP; +/////////////////////////////////////////////////////////////////////////////// + +class TestBase { + public: + TestBase(); + virtual ~TestBase() {} + + virtual bool onTest() { return true;} + virtual bool RunTests(const std::string &which) = 0; + + protected: + bool Count(bool result); + bool VerifySame(const char *exp1, const char *exp2, + CVarRef v1, CVarRef v2); + bool VerifyClose(const char *exp1, const char *exp2, + double v1, double v2); + bool array_value_exists(CVarRef var, CVarRef value); +}; + +/////////////////////////////////////////////////////////////////////////////// +// macros + +#define RUN_TEST(test) \ + if (!which.empty() && which != #test) { \ + } else if (onTest() && test()) { \ + if (!Test::s_quiet) { \ + printf(#test " passed\n"); \ + } \ + } else { \ + printf(#test " failed\n"); \ + ret = false; \ + } \ + +#define VERIFY(exp) \ + if (!(exp)) { \ + printf("%s:%d: [" #exp "] is false\n", __FILE__, __LINE__); \ + return Count(false); \ + } \ + +#define VS(e1, e2) \ + if (!VerifySame(#e1, #e2, e1, e2)) { \ + printf("%s:%d: VerifySame failed.\n", __FILE__, __LINE__); \ + return Count(false); \ + } \ + +#define VC(e1, e2) \ + if (!VerifyClose(#e1, #e2, e1, e2)) { \ + printf("%s:%d: VerifyClose failed.\n", __FILE__, __LINE__); \ + return Count(false); \ + } \ + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_BASE_H__ diff --git a/src/test/test_base_fast.inc b/src/test/test_base_fast.inc new file mode 100644 index 0000000000000..3ea56825bd1e7 --- /dev/null +++ b/src/test/test_base_fast.inc @@ -0,0 +1,9 @@ +RUN_TESTSUITE(TestParserExpr); +RUN_TESTSUITE(TestParserStmt); +//RUN_TESTSUITE(TestTransformerExpr); +//RUN_TESTSUITE(TestTransformerStmt); +RUN_TESTSUITE(TestDependGraph); +RUN_TESTSUITE(TestCodeError); +//RUN_TESTSUITE(TestTypeInference); +RUN_TESTSUITE(TestUtil); +RUN_TESTSUITE(TestCppBase); diff --git a/src/test/test_base_suite.inc b/src/test/test_base_suite.inc new file mode 100644 index 0000000000000..06fcefce76b60 --- /dev/null +++ b/src/test/test_base_suite.inc @@ -0,0 +1,13 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/test/test_code_error.cpp b/src/test/test_code_error.cpp new file mode 100644 index 0000000000000..97cdca5627f58 --- /dev/null +++ b/src/test/test_code_error.cpp @@ -0,0 +1,526 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +TestCodeError::TestCodeError() { + Option::IncludeRoots["$_SERVER['PHP_ROOT']"] = ""; +} + +bool TestCodeError::RunTests(const std::string &which) { + bool ret = true; +#define CODE_ERROR_ENTRY(x) RUN_TEST(Test ## x); +#include "../lib/analysis/core_code_error.inc" +#undef CODE_ERROR_ENTRY + return ret; +} + +bool TestCodeError::Verify(CodeError::ErrorType type, const char *src, + const char *file, int line, bool exists) { + AnalysisResultPtr ar(new AnalysisResult()); + Parser::parseString("analyzeProgram(); + ar->inferTypes(); + CodeErrorPtr ce = ar->getCodeError(); + if (ce->exists(type) != exists) { + ostringstream code; + CodeGenerator cg(&code); + ar->outputAllCPP(cg); + ostringstream error; + JSON::OutputStream(error) << ar->getCodeError(); + printf("%s:%d: parsing %s\ncode error missing\n%s\n", file, line, src, + error.str().c_str()); + return false; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestCodeError::TestBadPHPIncludeFile() { + VE(BadPHPIncludeFile, "$a = 1;"); + return true; +} + +bool TestCodeError::TestUseDynamicMethod() { + VE(UseDynamicMethod, "$a();"); + return true; +} + +bool TestCodeError::TestUseDynamicGlobal() { + VE(UseDynamicGlobal, "a; }"); + //VE(UseUndeclaredVariable, "a();"); + + // negatve cases + VEN(UnknownObjectMethod, + "a(); }"); + VEN(UnknownObjectMethod, + "a();}"); + return true; +} + +bool TestCodeError::TestDerivedObjectMethod() { + VE(DerivedObjectMethod, + "a();}} " + "class R extends T { function a() {}}"); + return true; +} + +bool TestCodeError::TestUnknownMagicMethod() { + VE(UnknownMagicMethod, + "t();"); + VE(TooFewArgument, + "t(1);"); + VE(TooFewArgument, + "t(1);}"); + VE(TooManyArgument, + "a;}} A::test();"); + + VE(MissingObjectContext, + "a();}} A::test();"); + + VE(MissingObjectContext, + " +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestCodeError : public TestBase { + public: + TestCodeError(); + + virtual bool RunTests(const std::string &which); + +#define CODE_ERROR_ENTRY(x) bool Test ## x(); +#include "../lib/analysis/core_code_error.inc" +#undef CODE_ERROR_ENTRY + + private: + bool Verify(HPHP::CodeError::ErrorType type, const char *src, + const char *file, int line, bool exists); +}; + +/////////////////////////////////////////////////////////////////////////////// +// macros + +#define VE(type, src) \ + if (!Count(Verify(CodeError::type, src, __FILE__, __LINE__, true))) \ + return false; \ + +#define VEN(type, src) \ + if (!Count(Verify(CodeError::type, src, __FILE__, __LINE__, false))) \ + return false; \ + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_CODE_ERROR_H__ diff --git a/src/test/test_code_run.cpp b/src/test/test_code_run.cpp new file mode 100644 index 0000000000000..ce84ca8a9dadc --- /dev/null +++ b/src/test/test_code_run.cpp @@ -0,0 +1,7416 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +TestCodeRun::TestCodeRun() : m_perfMode(false) { + Option::GenerateCPPMain = true; + Option::GenerateCPPMetaInfo = true; + Option::GenerateCPPMacros = true; + Option::GenerateCPPComments = true; + Option::GenerateCPPNameSpace = true; + Option::KeepStatementsWithNoEffect = false; + Option::StaticMethodAutoFix = true; +} + +bool TestCodeRun::CleanUp() { + const char *argv[] = {"", NULL}; + string out, err; + Process::Exec("cpp/tmp/cleanup.sh", argv, NULL, out, &err); + if (!err.empty()) { + printf("Failed to clean up cpp/tmp: %s\n", err.c_str()); + return false; + } + return true; +} + +bool TestCodeRun::GenerateFiles(const char *input) { + AnalysisResultPtr ar(new AnalysisResult()); + ar->setOutputPath("cpp/tmp"); + Parser::parseString(input, ar); + BuiltinSymbols::load(ar); + ar->loadBuiltins(); + ar->analyzeProgram(); + ar->preOptimize(); + ar->inferTypes(); + ar->postOptimize(); + ar->analyzeProgramFinal(); + ar->outputAllCPP(CodeGenerator::ClusterCPP, 0, NULL); + return true; +} + +bool TestCodeRun::CompileFiles(const char *input, const char *file, int line) { + const char *argv[] = {"", NULL}; + string out, err; + Process::Exec("cpp/makeall.sh", argv, NULL, out, &err); + if (!err.empty()) { + printf("%s:%d\nParsing: [%s]\nFailed to compile files: %s\n", + file, line, input, err.c_str()); + return false; + } + return true; +} + +bool TestCodeRun::VerifyCodeRun(const char *input, const char *output, + const char *file /* = "" */, + int line /* = 0 */, + bool nowarnings /* = false */) { + ASSERT(input); + if (!CleanUp()) return false; + if (Option::EnableEval < Option::FullEval) { + if (!GenerateFiles(input) || + !CompileFiles(input, file, line)) { + return false; + } + } + + // generate main.php and get PHP's output + string expected; + if (output) { + expected = output; + } else { + string fullPath = "cpp/tmp/main.php"; + ofstream f(fullPath.c_str()); + if (!f) { + printf("Unable to open %s for write. Run this test from src/.\n", + fullPath.c_str()); + return false; + } + + f << input; + f.close(); + + const char *argv1[] = {"", "cpp/tmp/main.php", NULL}; + const char *argv2[] = {"", "-n", "cpp/tmp/main.php", NULL}; + string err; + Process::Exec("php", nowarnings ? argv2 : argv1, NULL, expected, &err); + if (!err.empty() && nowarnings) { + printf("%s:%d\nParsing: [%s]\nFailed to run cpp/tmp/main.php: %s\n", + file, line, input, err.c_str()); + return false; + } + } + + // run and verify output + { + string actual, err; + if (Option::EnableEval < Option::FullEval) { + const char *argv[] = {"", "--file=string", "--config=test/config.hdf", + NULL}; + Process::Exec("cpp/tmp/test", argv, NULL, actual, &err); + } else { + const char *argv[] = {"", "--file=cpp/tmp/main.php", + "--config=test/config.hdf", NULL}; + Process::Exec("hphpi/hphpi", argv, NULL, actual, &err); + } + + if (m_perfMode) { + string sinput = input; + const char *marker = "/* INPUT */"; + int pos1 = sinput.find(marker); + int pos2 = sinput.find(marker, pos1+1); + pos1 += strlen(marker); + sinput = sinput.substr(pos1, pos2 - pos1); + if (sinput.size() > 1000) sinput = "(long program)"; + + // we have to adjust timing by removing loop cost, which is the 1st test + static int adj1 = -1; + static int adj2 = -1; + int ms1 = atoi(expected.c_str()); + int ms2 = atoi(actual.c_str()); + if (adj1 == -1) adj1 = ms1; + if (adj2 == -1) adj2 = ms2; + int msAdj1 = ms1 - adj1; + int msAdj2 = ms2 - adj2; + double x = 0.0; // how many times faster + double p = 0.0; // percentage + if (msAdj2 != 0) { + x = ((double)(int)(msAdj1 * 100 / msAdj2)) / 100; + } + if (msAdj1 != 0) { + p = ((double)(int)(msAdj2 * 10000 / msAdj1)) / 100; + } + + printf("----------------------------------------------------------\n" + "%s\n\n" + " PHP C++\n" + "===========================================\n" + " %6d ms %6d ms\n" + " -%6d ms %6d ms\n" + "===========================================\n" + " %6d ms %6d ms = %2.4gx or %2.4g%%\n\n", + sinput.c_str(), ms1, ms2, adj1, adj2, msAdj1, msAdj2, x, p); + return true; + } + + if (actual != expected || !err.empty()) { + printf("%s:%d\nParsing: [%s]\nBet %d:\n" + "--------------------------------------\n" + "%s" + "--------------------------------------\n" + "Got %d:\n" + "--------------------------------------\n" + "%s" + "--------------------------------------\n" + "Err: [%s]\n", file, line, input, + (int)expected.length(), expected.c_str(), + (int)actual.length(), actual.c_str(), + err.c_str()); + return false; + } + } + + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestCodeRun::RunTests(const std::string &which) { + bool ret = true; + RUN_TEST(TestSanity); + RUN_TEST(TestInnerFunction); + RUN_TEST(TestInnerClass); + RUN_TEST(TestVariableArgument); + RUN_TEST(TestListAssignment); + RUN_TEST(TestExceptions); + RUN_TEST(TestPredefined); + RUN_TEST(TestBoolean); + RUN_TEST(TestInteger); + RUN_TEST(TestDouble); + RUN_TEST(TestString); + RUN_TEST(TestLocale); + RUN_TEST(TestArray); + RUN_TEST(TestArrayEscalation); + RUN_TEST(TestArrayOffset); + RUN_TEST(TestArrayAccess); + RUN_TEST(TestArrayIterator); + RUN_TEST(TestArrayAssignment); + RUN_TEST(TestArrayMerge); + RUN_TEST(TestArrayUnique); + RUN_TEST(TestScalarArray); + RUN_TEST(TestRange); + RUN_TEST(TestVariant); + RUN_TEST(TestObject); + RUN_TEST(TestObjectProperty); + RUN_TEST(TestObjectMethod); + RUN_TEST(TestClassMethod); + RUN_TEST(TestObjectMagicMethod); + RUN_TEST(TestObjectAssignment); + RUN_TEST(TestNewObjectExpression); + RUN_TEST(TestObjectPropertyExpression); + RUN_TEST(TestComparisons); + RUN_TEST(TestReference); + RUN_TEST(TestUnset); + RUN_TEST(TestDynamicConstants); + RUN_TEST(TestDynamicVariables); + RUN_TEST(TestDynamicProperties); + RUN_TEST(TestDynamicFunctions); + RUN_TEST(TestDynamicMethods); + RUN_TEST(TestVolatile); + RUN_TEST(TestProgramFunctions); + RUN_TEST(TestCompilation); + RUN_TEST(TestReflection); + RUN_TEST(TestReflectionClasses); + RUN_TEST(TestErrorHandler); + RUN_TEST(TestAssertOptions); + RUN_TEST(TestExtMisc); + RUN_TEST(TestSuperGlobals); + RUN_TEST(TestGlobalStatement); + RUN_TEST(TestStaticStatement); + RUN_TEST(TestIfStatement); + RUN_TEST(TestBreakStatement); + RUN_TEST(TestContinueStatement); + RUN_TEST(TestReturnStatement); + RUN_TEST(TestAdd); + RUN_TEST(TestMinus); + RUN_TEST(TestMultiply); + RUN_TEST(TestDivide); + RUN_TEST(TestModulus); + RUN_TEST(TestOperationTypes); + RUN_TEST(TestUnaryOperators); + RUN_TEST(TestSilenceOperator); + RUN_TEST(TestPrint); + RUN_TEST(TestLogicalOperators); + RUN_TEST(TestGetClass); + RUN_TEST(TestGetParentClass); + RUN_TEST(TestRedeclaredFunctions); + RUN_TEST(TestRedeclaredClasses); + RUN_TEST(TestClone); + RUN_TEST(TestEvalOrder); + RUN_TEST(TestGetObjectVars); + RUN_TEST(TestSerialization); + //RUN_TEST(TestJson); + RUN_TEST(TestThrift); + RUN_TEST(TestExit); + RUN_TEST(TestCreateFunction); + RUN_TEST(TestConstructorDestructor); + RUN_TEST(TestConcat); + RUN_TEST(TestConstant); + RUN_TEST(TestClassConstant); + RUN_TEST(TestConstantFunction); + RUN_TEST(TestDefined); + RUN_TEST(TestSimpleXML); + RUN_TEST(TestFile); + RUN_TEST(TestAssignment); + RUN_TEST(TestBadFunctionCalls); + RUN_TEST(TestConstructor); + RUN_TEST(TestTernary); + RUN_TEST(TestUselessAssignment); + RUN_TEST(TestTypes); + RUN_TEST(TestSwitchStatement); + RUN_TEST(TestExtImage); + //RUN_TEST(TestEvaluationOrder); + + RUN_TEST(TestAdHoc); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// code generation + +bool TestCodeRun::TestSanity() { + VCR("p();"); + VCR("p();"); + VCR("p();"); + return true; +} + +bool TestCodeRun::TestVariableArgument() { + VCR("test('test'); $obj->test(1, 2, 3);"); + + VCR("testr();"); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// type system + +bool TestCodeRun::TestBoolean() { + VCR("> 2);"); + + VCR(">= 2; var_dump($a);"); + + VCR(" '2', 'a' => '1'));"); + VCR(" 'a', 0 => 'b'));"); + + VCR(" 1); var_dump($a);"); + VCR(" 2, 'a' => 1); var_dump($a);"); + VCR(" '1'); var_dump($a);"); + VCR(" '2', 'a' => '1'); var_dump($a);"); + + VCR(" 1, 'a' => 2); var_dump($a);"); + VCR(" 1, 'b' => 2, 'a' => 3); var_dump($a);"); + + VCR(" 2, 'a' => 1); " + "foreach ($a as $item) print '['.$item.']';"); + VCR(" 2, 'a' => 1); " + "foreach ($a as $name => $item) print '['.$name.'=>'.$item.']';"); + + VCR(" 2, 'a' => 1); var_dump($a['b']);"); + VCR(" 2, 'a' => 1); var_dump($a['bogus']);"); + VCR(" 1); var_dump($a);"); + VCR(" 'test'); var_dump($a[1]);"); + + VCR(" 1, 'b' => 2);" + "foreach ($a as $b => $c) {" + " var_dump($b);" + " unset($a['b']);" + "}"); + + VCR("$a = array('a' => 1, 'b' => 2);" + "foreach ($a as $b => &$c) {" + " var_dump($b);" + " unset($a['b']);" + "}"); + + VCR(" $val) {" + " if($val == 2) {" + " $foo[$key] = 0;" + " } else if($val == 3) {" + " unset($foo[$key]);" + " } else {" + " $foo[$key] = $val + 1;" + " }" + "}" + "var_dump($foo);"); + + VCR(" &$val) {" + " if($val == 2) {" + " $foo[$key] = 0;" + " } else if($val == 3) {" + " unset($foo[$key]);" + " } else {" + " $val++;" + " }" + "}" + "var_dump($foo);"); + + VCR(" 'apple', 'b' => 'banana', 'c' => 'citrus');" + "foreach ($a as $k1 => &$v1) {" + " foreach ($a as $k2 => &$v2) {" + " if ($k2 == 'a') {" + " unset($a[$k2]);" + " }" + " var_dump($v1, $v2);" + " }" + "}"); + VCR(" true, false => 0, 1 => 1.0," + " '1.0' => 1.23456789e+34," + " 1.7976931348623157e+308 => 1E666," + " 1E666/1E666 => \"a bc\"," + " \"\\xc1 bc\");" + "$a16 = array(null => true, false => 0, 1 => 1.0," + " '1.0' => 1.23456789e+34," + " 1.7976931348623157e+308 => 1E666," + " 1E666/1E666 => \"a bc\"," + " \"\\xc1 bc\"," + " array(null => true, array()," + " false => 0, 1 => 1.0," + " '1.0' => 1.23456789e+34," + " 1.7976931348623157e+308 => 1E666," + " 1E666/1E666 => \"a bc\"," + " \"\\xc1 bc\"));" + "var_dump($a1);" + "var_dump($a2);" + "var_dump($a3);" + "var_dump($a4);" + "var_dump($a5);" + "var_dump($a6);" + "var_dump($a7);" + "var_dump($a8);" + "var_dump($a9);" + "var_dump($a10);" + "var_dump($a11);" + "var_dump($a12);" + "var_dump($a13);" + "var_dump($a14);" + "var_dump($a15);" + "var_dump($a16);"); + + return true; +} + +bool TestCodeRun::TestRange() { + VCR(" 20); var_dump($a);"); \ + VCR(" 'b'); var_dump($a);"); \ + VCR(" array(3)); var_dump($a);"); \ + +bool TestCodeRun::TestArrayEscalation() { + TEST_ARRAY_CONVERT("array()"); + TEST_ARRAY_CONVERT("array(10)"); + TEST_ARRAY_CONVERT("array('test')"); + TEST_ARRAY_CONVERT("array(array(0))"); + TEST_ARRAY_CONVERT("array('a' => 10)"); + TEST_ARRAY_CONVERT("array('a' => 'va')"); + TEST_ARRAY_CONVERT("array('a' => array(1))"); + + TEST_ARRAY_PLUS("array()"); + TEST_ARRAY_PLUS("array(10)"); + TEST_ARRAY_PLUS("array('test')"); + TEST_ARRAY_PLUS("array(array(0))"); + TEST_ARRAY_PLUS("array('a' => 10)"); + TEST_ARRAY_PLUS("array('a' => 'va')"); + TEST_ARRAY_PLUS("array('a' => array(1))"); + return true; +} + +bool TestCodeRun::TestArrayOffset() { + VCR("$offset.'get';" + " }" + " public function offsetSet($offset, $value) {" + " $this->$offset = $value.'set';" + " }" + " public function offsetUnset($offset) {" + " $this->$offset = 'unset';" + " }" + "}" + "$obj = new A();" + "if (!isset($obj['a'])) {" + " $obj['a'] = 'test';" + "}" + "var_dump($obj['a']);" + "unset($obj['a']);" + "var_dump($obj['a']);" + ); + + VCR("data[$index];" + " if(is_array($value)) {" + " $u = new ArrayAccessImpl();" + " foreach($value as $idx=>$e)" + " $u[$idx]=$e;" + " } else" + " $u=$value;" + " }" + " public function offsetGet($index) {" + " echo (\"GET: $index\\n\");" + " if(!isset($this->data[$index]))" + " $this->data[$index]=new ArrayAccessImpl();" + " return $this->data[$index];" + " }" + " public function offsetExists($index) {" + " echo (\"EXISTS: $index\\n\");" + " if(isset($this->data[$index])) {" + " if($this->data[$index] instanceof ArrayAccessImpl) {" + " if(count($this->data[$index]->data)>0)" + " return true;" + " else" + " return false;" + " } else" + " return true;" + " } else" + " return false;" + " }" + "}" + "" + "class ArrayAccessImpl2 extends ArrayAccessImpl {" + " public function offsetUnset($index) { echo \"UNSET2: $index\\n\"; }" + " public function offsetSet($index, $value) {" + " echo (\"SET2: $index\\n\");" + " if(isset($data[$index])) {" + " unset($data[$index]);" + " }" + " $u = &$this->data[$index];" + " if(is_array($value)) {" + " $u = new ArrayAccessImpl();" + " foreach($value as $idx=>$e)" + " $u[$idx]=$e;" + " } else" + " $u=$value;" + " }" + " public function offsetGet($index) {" + " echo (\"GET2: $index\\n\");" + " if(!isset($this->data[$index]))" + " $this->data[$index]=new ArrayAccessImpl();" + " return $this->data[$index];" + " }" + " public function offsetExists($index) {" + " echo (\"EXISTS2: $index\\n\");" + " if(isset($this->data[$index])) {" + " if($this->data[$index] instanceof ArrayAccessImpl) {" + " if(count($this->data[$index]->data)>0)" + " return true;" + " else" + " return false;" + " } else" + " return true;" + " } else" + " return false;" + " }" + "}" + "offsetGet('foo');" + "$data = new ArrayAccessImpl();" + "$data['string']=\"Just a simple string\";" + "$data['number']=33;" + "$data['array']['another_string']=\"Alpha\";" + "$data['array']['some_object']=new stdClass();" + "$data['array']['another_array']['x']['y']=\"Beta\";" + "$data['blank_array']=array();" + "print_r(isset($data['array']));" + "print_r($data['array']['non_existent']);" + "print_r(isset($data['array']['non_existent']));" + "print_r($data['blank_array']);" + "print_r(isset($data['blank_array']));" + "unset($data['blank_array']);" + "print_r($data);" + "$data2 = new ArrayAccessImpl2();" + "$data2['string']=\"Just a simple string\";" + "$data2['number']=33;" + "$data2['array']['another_string']=\"Alpha\";" + "$data2['array']['some_object']=new stdClass();" + "$data2['array']['another_array']['x']['y']=\"Beta\";" + "$data2['blank_array']=array();" + "print_r(isset($data2['array']));" + "print_r($data2['array']['non_existent']);" + "print_r(isset($data2['array']['non_existent']));" + "print_r($data2['blank_array']);" + "print_r(isset($data2['blank_array']));" + "unset($data2['blank_array']);" + "print_r($data2);"); + + return true; +} + +bool TestCodeRun::TestArrayIterator() { + VCR("var = $array;" + " }" + " }" + " public function rewind() {" + " echo \"rewinding\n\";" + " reset($this->var);" + " }" + " public function current() {" + " $var = current($this->var);" + " echo \"current: $var\n\";" + " return $var;" + " }" + " public function key() {" + " $var = key($this->var);" + " echo \"key: $var\n\";" + " return $var;" + " }" + " public function next() {" + " $var = next($this->var);" + " echo \"next: $var\n\";" + " return $var;" + " }" + " public function valid() {" + " $var = $this->current() !== false;" + " echo \"valid: {$var}\n\";" + " return $var;" + " }" + "}" + "$values = array(1,2,3);" + "$it = new MyIterator($values);" + "foreach ($it as $a => $b) {" + " print \"$a: $b\n\";" + "}" + "$itp = \"it\";" + "foreach ($$itp as $a => $b) {" + " print \"$a: $b\n\";" + "}" + "function getIter() {" + " $values = array(1,2,3);" + " $it = new MyIterator($values);" + " return $it;" + "}" + "foreach (getIter() as $a => $b) {" + " print \"$a: $b\n\";" + "}" + ); + return true; +} + +bool TestCodeRun::TestArrayAssignment() { + VCR(" '1', 2 => 2, 'c' => '3');" + "var_dump($a);" + "$a = array('a' => '1', 2 => 2, 'c' => '3'," + " 'd' => array('a' => '1', 2 => 2, 'c' => '3'));" + "var_dump($a);"); + VCR("'main', 2=>'sub');" + "$b = $a;" + "var_dump(array_pop($b));" + "print_r($a);" + "var_dump(array_shift($b));" + "print_r($a);"); + VCR("$p, '2'=>&$q);" + " $b = array('3'=>$r, '4'=>&$s);" + " var_dump($a);" + " $a += $b;" + " var_dump($a);" + " var_dump($b);" + "}" + "foo();"); + + VCR(" 1, 3 => 3); " + "var_dump(array_merge($a, array(2)));"); + VCR(" 1, 3 => 3); " + "var_dump(array_merge($a, array()));"); + VCR(" 1, 3 => 3); " + "var_dump(array_merge($a, array(2)));"); + VCR(" 1, 'b' => 3); " + "var_dump(array_merge($a, array(2)));"); + VCR(" 1, 3 => 3); " + "var_dump(array_merge($a, array('a' => 2)));"); + VCR(" 1, 3 => 3); " + "var_dump(array_merge($a, array('b' => 2)));"); + VCR(" 1, 'b' => 3); " + "var_dump(array_merge($a, array('c' => 2)));"); + return true; +} + +bool TestCodeRun::TestArrayUnique() { + VCR(" \"green\"," + " \"red\", \"b\" => \"green\", \"blue\", \"red\");" + "$result = array_unique($input);" + "print_r($result);"); + VCR("> 2);"); + + VCR("> $b);"); + + VCR("> $b);"); + + VCR(">= 2; var_dump($a);"); + + VCR("a++; " + "$obj3 = new B(); $obj3->a = 10;" + "var_dump($obj1->a);" + "var_dump($obj1);" + "var_dump($obj2->a);" + "var_dump($obj2);" + "var_dump($obj3);" + "var_dump($obj1 instanceof A);" + "var_dump($obj3 instanceof A);" + "var_dump($obj1 instanceof B);" + "var_dump($obj3 instanceof B);" + ); + + VCR("a = $a + 1;" + " }" + " public function __destruct() {" + " $this->a += 2;" + " var_dump($this->a);" + " }" + "}" + "class B extends A {" + " public function __construct($a) {" + " }" + "}" + "class C extends A {" + " public function __construct($a) {" + " parent::__construct($a);" + " }" + "}" + "$obj = new A(1); var_dump($obj->a);" + "$obj = new B(1); var_dump($obj->a);" + "$obj = new C(1); var_dump($obj->a);" + ); + + VCR("c);" + ); + + VCR("b);*/" // undeclared + "$obj = new B(); var_dump($obj); var_dump($obj->b);" + ); + + VCR("a);" + "$obj = new B(); var_dump($obj); var_dump($obj->b);" + ); + + VCR("b);" + "$obj = new B(); var_dump($obj); var_dump($obj->b);" + ); + + VCR("b);" + "$obj = new B(); var_dump($obj); var_dump($obj->b);" + ); + + VCR("test('cool');" + ); + + VCR("test(1);" + "$obj = new B(); $obj->test(1);" + ); + + // circular references + VCR("a = $obj2; $obj2->a = $obj1;" + "var_dump($obj1);"); + + VCR("t();"); + + VCR("v = $v;" + " return $this;" + " }" + "}" + "function foo() {" + " $z = 1;" + " $qd = array('x' => $z);" + " $a = G()->set($qd);" + " var_dump($a);" + " $qd['e'] = true;" + " $b = G()->set($qd);" + " var_dump($a);" + "" + "}" + "function G() {" + " return new g;" + "}" + "foo();"); + VCR("a = 20;} } " + "class B extends A { public $a = 'test';} " + "$obj = new B(); $obj->foo(); var_dump($obj->a);"); + + VCR("a);} } " + "class C extends B { public $a = 'test';} " + "$obj = new C(); $obj->foo();"); + VCR(" $v) {" + " var_dump($v);" + " }" + " }" + "}" + "class d extends c {" + " public $a = 'a';" + " private $b = 'b';" + " protected $c = 'c';" + " function t2($y) {" + " foreach ($this as $k => $v) {" + " var_dump($v);" + " }" + " foreach ($y as $k => $v) {" + " var_dump($v);" + " }" + " foreach ($y as $k => $v) {" + " var_dump($v);" + " }" + " }" + "}" + "$x = new d;" + "$x->surprise = 1;" + "$y = new d;" + "$y->shock = 2;" + "echo \"t2\n\";" + "$x->t2($y);" + "echo \"t1\n\";" + "$x->t1($y);" + "$z = new c;" + "echo \"t12\n\";" + "$z->t1($x);" + "foreach ($x as $k => $v) {" + " var_dump($v);" + "}"); + + return true; +} + +bool TestCodeRun::TestObjectMethod() { + VCR("test(); $obj = 1;"); + + // calling a function that's implemented in a derived class + VCR("test();} }" + "class R extends T { function test() { var_dump('test'); }} " + "$obj = new R(); $obj->test(); $obj->foo();"); + + VCR("test();}} " + "class B extends A { function test() { print 'B';}} " + "$obj = new A(); $obj = new B(); $obj->foo();"); + + VCR("test();}}" + "$obj = new AA(); $b = new B(); $b->foo($obj);" + ); + + // calling a virtual function + VCR("test();} }" + "class R extends T { function test() { var_dump('test'); }} " + "$obj = new R(); $obj->test(); $obj->foo();"); + + // calling a virtual function + VCR("test();"); + + VCR("test2();" + "foo::test1();" + "foo::test2();" + "foo::test3();" + "$obj->test3();" + "$obj->test4();"); + + // calling instance method statically + VCR("foo(meh());" + " $p = null;" + "}" + "z();"); + return true; +} + +bool TestCodeRun::TestClassMethod() { + VCR("writeMsg('error', $error);" + "class AdsConsoleRenderer {" + " public static function getInstance() {" + " return new AdsConsoleRenderer();" + " }" + "" + " function writeMsg($classname = '', $s = '') {" + " echo $classname . \"::\" . $s;" + " }" + "}"); + + return true; +} + +bool TestCodeRun::TestObjectMagicMethod() { + VCR("a[$name] = $value.'set';} " + " function __get($name) { return $this->a[$name].'get';} " + "} " + "$obj = new A(); $obj->test = 'test'; var_dump($obj->test);"); + + VCR("a);" + "var_dump($obj->b);" + "$obj = new B();" + "var_dump($obj->a);" + "var_dump($obj->b);"); + + VCR("a[$name] = $value;} " + " function __get($name) { return $this->a[$name];} " + "} " + "$obj = new A(); $obj->test = 'test'; var_dump($obj->test);"); + + VCR("test = 'test'; var_dump($obj->test);"); + + VCR("test($a, 'ss');"); + /* + VCR("a[$name] = $value;} " + " function __get($name) { return $this->a[$name];} " + "} " + "$obj = new A(); $obj->test = 'test'; var_dump($obj->test);"); + */ + + VCR("data[$name] = $value;" + " }" + " public function __get($name) {" + " echo \"Getting '$name'\n\";" + " if (array_key_exists($name, $this->data)) {" + " return $this->data[$name];" + " }" + " return null;" + " }" + " public function __unset($name) {" + " echo \"Unsetting '$name'\n\";" + " unset($this->data[$name]);" + " return 1;" + " }" + "}" + "$obj = new MemberTest;" + "$obj->a = 1;" + "echo $obj->a;"); + VCR("val = 1;" + " }" + " function bar() {" + " echo $this->val;" + " $ref = &$this;" + " $ref->val = 2;" + " echo $this->val;" + " $ref2 = $this;" + " $ref2->val = 3;" + " echo $this->val;" + " $x = new foo();" + " echo $x->val;" + " $ref3 = &$x;" + " $ref3->val = 4;" + " echo $x->val;" + " $ref4 = $x;" + " $ref4->val = 5;" + " echo $x->val;" + " }" + " var $val;" + "}" + "$x = new foo();" + "$x->bar();" + "$ref5 = $x;" + "$ref5->val = 6;" + "echo $x->val;" + "$ref6 = &$x;" + "$ref6->val = 7;" + "echo $x->val;"); + + return true; +} + +bool TestCodeRun::TestNewObjectExpression() { + VCR("num = 1;" + "print($a->num);"); + + return true; +} + +bool TestCodeRun::TestObjectPropertyExpression() { + VCR("blah->prop->foo->bar = \"string\";" + " var_dump($this->blah);" + " }" + "}" + "$t = new test;" + "$t->foo();"); + VCR("_p[ $what ];" + " }" + " public function __set( $what, $value ) {" + " echo \"set\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "$c = new C1();" + "$c->a = 1;" + "$c->a .= 1;" + "print $c->a;"); + VCR("_p[ $what ];" + " }" + " public function __set( $what, $value ) {" + " echo \"set\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C2 {" + " public $p2;" + "}" + "$c2 = new C2();" + "$c2->p = new C1();" + "$c2->p->a = 1;" + "$c2->p->a .= 1;" + "print $c2->p->a;"); + VCR("_p[ $what ];" + " }" + " public function __set( $what, $value ) {" + " echo \"set\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C2 {" + " public $p2;" + "}" + "class C3 {" + " public $p3;" + "}" + "$c3 = new C3();" + "$c3->p3 = new C2();" + "$c3->p3->p2 = new C1();" + "$c3->p3->p2->a = 1;" + "$c3->p3->p2->a .= 1;" + "print $c3->p3->p2->a;"); + VCR("_p[ $what ];" + " }" + " public function __set( $what, $value ) {" + " echo \"set C1\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C2 {" + " public function __get( $what ) {" + " echo \"get C2\n\";" + " return $this->_p[ $what ];" + " }" + " public function __set( $what, $value ) {" + " echo \"set C2\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C3 {" + " public function __get( $what) {" + " echo \"get C3\n\";" + " return $this->_p[ $what ];" + " }" + " public function __set( $what, $value ) {" + " echo \"set C3\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "$c3 = new C3();" + "$c3->p3 = new C2();" + "$c3->p3->p2 = new C1();" + "$c3->p3->p2->a = 1;" + "$c3->p3->p2->a .= 1;" + "print $c3->p3->p2->a;"); + VCR("_p[ $what ];" + " }" + " protected function __set( $what, $value ) {" + " echo \"set C1\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C2 {" + " protected function __get( $what ) {" + " echo \"get C2\n\";" + " return $this->_p[ $what ];" + " }" + " protected function __set( $what, $value ) {" + " echo \"set C2\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C3 {" + " protected function __get( $what) {" + " echo \"get C3\n\";" + " return $this->_p[ $what ];" + " }" + " protected function __set( $what, $value ) {" + " echo \"set C3\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "$c3 = new C3();" + "$c3->p3 = new C2();" + "$c3->p3->p2 = new C1();" + "$c3->p3->p2->a = 1;" + "$c3->p3->p2->a .= 1;" + "print $c3->p3->p2->a;"); + VCR("_p[ $what ];" + " }" + " private function __set( $what, $value ) {" + " echo \"set C1\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C2 {" + " private function __get( $what ) {" + " echo \"get C2\n\";" + " return $this->_p[ $what ];" + " }" + " private function __set( $what, $value ) {" + " echo \"set C2\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C3 {" + " private function __get( $what) {" + " echo \"get C3\n\";" + " return $this->_p[ $what ];" + " }" + " private function __set( $what, $value ) {" + " echo \"set C3\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "$c3 = new C3();" + "$c3->p3 = new C2();" + "$c3->p3->p2 = new C1();" + "$c3->p3->p2->a = 1;" + "$c3->p3->p2->a .= 1;" + "print $c3->p3->p2->a;"); + VCR("_p[ $what ];" + " }" + " public function __set( $what, $value ) {" + " echo \"set\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "$c = new C1();" + "$c->a += 1;" + "print $c->a;" + "$c->a += 10;" + "print $c->a;" + "$c->a -= 2;" + "print $c->a;" + "$c->a *= 3;" + "print $c->a;" + "$c->a /= 2;" + "print $c->a;" + "$c->a %= 8;" + "print $c->a;" + "$c->a <<= 3;" + "print $c->a;" + "$c->a >>= 2;" + "print $c->a;" + "$c->a ^= 18;" + "print $c->a;" + "$c->a &= 333;" + "print $c->a;" + "$c->a |= 7;" + "print $c->a;"); + VCR("_p[ $what ];" + " }" + " private function __set( $what, $value ) {" + " echo \"set C2\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C3 {" + " private function __get( $what ) {" + " echo \"get C3\n\";" + " return $this->_p[ $what ];" + " }" + " private function __set( $what, $value ) {" + " echo \"set C3\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "function assign_ref(&$v) {" + " $v = 22;" + "}" + "$c3 = new C3();" + "$c3->p3 = new C2();" + "$c3->p3->p2 = new C1();" + "$c3->p3->p2->a = 1;" + "$c3->p3->p2->a .= 1;" + "print $c3->p3->p2->a;" + "assign_ref($c3->p3->p2->a);" + "print $c3->p3->p2->a;"); + VCR("_p[ $what ];" + " }" + " private function __set( $what, $value ) {" + " echo \"set C1\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C2 {" + " private function __get( $what ) {" + " echo \"get C2\n\";" + " return $this->_p[ $what ];" + " }" + " private function __set( $what, $value ) {" + " echo \"set C2\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "class C3 {" + " private function __get( $what ) {" + " echo \"get C3\n\";" + " return $this->_p[ $what ];" + " }" + " private function __set( $what, $value ) {" + " echo \"set C3\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "function assign_ref(&$v) {" + " $v = 22;" + "}" + "$c3 = new C3();" + "$c3->p3 = new C2();" + "$c3->p3->p2 = new C1();" + "$c3->p3->p2->a = 1;" + "$c3->p3->p2->a .= 1;" + "print $c3->p3->p2->a;" + "assign_ref($c3->p3->p2->a);" + "print $c3->p3->p2->a;"); + VCR("a);" + "var_dump($b);"); + VCR("_p[ $what ];" + " }" + " public function __set( $what, $value ) {" + " echo \"set C1\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "$c1 = new C1();" + "$c1->a = new C1();" + "$c1->a->b = new C1();" + "$c1->a->b->c = 10;" + "var_dump($c1->a->b->c);" + "$c1->a->b->c .= 10;" + "var_dump($c1->a->b->c);"); + VCR("_p[ $what ];" + " }" + " public function __set( $what, $value ) {" + " echo \"set C1\n\";" + " $this->_p[ $what ] = $value;" + " }" + " private $_p = array();" + "}" + "$c1 = new C1();" + "$c1->a = new C1();" + "$c1->a->b = new C1();" + "for ($i = 0; $i < 2048; $i++) {" + " $c1->a->b->c = 10;" + "}" + "var_dump($c1->a->b->c);"); + + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// comparisons + +#define COMPARE(a, op, b) \ + "print ++$i; print \"\\t\"; " \ + "print (" #a #op #b ") ? 'Y' : 'N'; " \ + "$a = 1; $a = 't'; $a = " #a "; " \ + "print ($a " #op #b ") ? 'Y' : 'N'; " \ + "$b = 1; $b = 't'; $b = " #b "; " \ + "print (" #a #op "$b) ? 'Y' : 'N'; " \ + "print ($a " #op "$b) ? 'Y' : 'N'; " \ + "print \"\\t\"; " \ + "print \"" #a " " #op " " #b "\t\"; " \ + "print \"\\n\"; " \ + +#define COMPARE_ALL(a, op) \ + COMPARE(a, op, true) \ + COMPARE(a, op, false) \ + COMPARE(a, op, 1) \ + COMPARE(a, op, 0) \ + COMPARE(a, op, -1) \ + COMPARE(a, op, '1') \ + COMPARE(a, op, '0') \ + COMPARE(a, op, '-1') \ + COMPARE(a, op, null) \ + COMPARE(a, op, array()) \ + COMPARE(a, op, array(1)) \ + COMPARE(a, op, array(2)) \ + COMPARE(a, op, array('1')) \ + COMPARE(a, op, array('0' => '1')) \ + COMPARE(a, op, array('a')) \ + COMPARE(a, op, array('a' => 1)) \ + COMPARE(a, op, array('b' => 1)) \ + COMPARE(a, op, array('a' => 1, 'b' => 2)) \ + COMPARE(a, op, 'php') \ + COMPARE(a, op, '') \ + +#define COMPARE_OP(op) \ + VCR(" '1'), op)); \ + VCR(" 1), op)); \ + VCR(" 1), op)); \ + VCR(" 1, 'b' => 2), op)); \ + VCR(" 1, 2 => 1) == array(2 => 1, 1 => 1));"); + VCR(" 1, 2 => 1) === array(2 => 1, 1 => 1));"); + VCR("1,'b'=> 1) == array('b'=>1,'a'=> 1));"); + VCR("1,'b'=> 1) === array('b'=>1,'a'=> 1));"); + + VCR("); + COMPARE_OP(!==); + COMPARE_OP(<); + COMPARE_OP(>); + COMPARE_OP(<=); + COMPARE_OP(>=); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// semantics + +bool TestCodeRun::TestUnset() { + VCR("arr[] = 'test';" + "var_dump($obj->arr); unset($obj->arr); var_dump($obj->arr);"); + return true; +} + +bool TestCodeRun::TestReference() { + VCR(" 1240430476);" + "$idxa = &$idxa['a'];"); + + VCR(" &$v) { $v = 'ok';} var_dump($a, $b);"); + + VCR(" &$a); var_dump($b); " + "$a = 20; var_dump($b);"); + VCR("b = 10; f($a->b); var_dump($a);"); + VCR("b = 10; f($a->b); var_dump($a);"); + VCR("b = 10; f($a->b); var_dump($a);"); + + // reference returns + VCR(" &$a); var_dump($a);"); + //VCR(" &$a); $b = array($a); var_dump($b);"); + + // shallow copy of members (either of arrays or objects) + VCR("function test($a) { $a[1] = 10; $a['r'] = 20;} " + "$b = 5; $a = array('r' => &$b); $a['r'] = 6; test($a); var_dump($a);"); + + VCR("0);" + "$ref = &$a['a'];" + "var_dump($a);" + "$b = $a;" + "var_dump($a,$b);" + "$b['a'] = 1;" + "var_dump($a,$b);" + "$a = array(0);" + "$ref = &$a[0];" + "var_dump($a);" + "$b = $a;" + "var_dump($a,$b);" + "$b[0] = 1;" + "var_dump($a,$b);" + ); + + // reference argument + VCRNW("t();"); + + // l-value + VCR(" 'aval')); var_dump($a);"); + VCR(" 'ok')); $a = 1; var_dump($a);"); + VCR(" 'ok'), EXTR_SKIP); var_dump($a);"); + VCR(" 'ok'), EXTR_PREFIX_SAME, 'p');" + " var_dump($p_a);"); + VCR(" 'ok'), EXTR_PREFIX_ALL, 'p');" + " var_dump($p_a);"); + VCR(" 'ok'), EXTR_IF_EXISTS); var_dump($a);"); + VCR(" 'ok', 'b' => 'no'), EXTR_PREFIX_IF_EXISTS, 'p'); var_dump($p_a); var_dump($b); var_dump($p_b);"); + VCR(" &$a), EXTR_REFS); $b = 'no'; var_dump($a);"); + VCR(" &$a); extract($arr, EXTR_REFS); $b = 'no'; var_dump($a);"); + + // compact + VCR("$b = 'test'; var_dump($this->$b); var_dump($this->a);" + " $c = &$this->$b; $c = array(1); var_dump($this->a);" + " }" + "} $obj = new B(); $obj->test();"); + + VCR("a);"); + return true; +} + +bool TestCodeRun::TestDynamicFunctions() { + VCR("$f($b); var_dump($b); var_dump($c);"); + VCR("$name();} } " + "$obj = new A(); $obj->test();"); + + VCR("$m($ar[0], $st[0]); A::$m($ar[1], $st[1]);"); + + vector backup = Option::DynamicMethodPrefixes; + Option::DynamicMethodPrefixes.push_back("_"); + VCR("$name();} } " + "$obj = new A(); $obj->test();"); + Option::DynamicMethodPrefixes = backup; + + VCR("refTestHelper($x);" + " var_dump($x);" + "}" + "$q = new z;" + "$f = 'minArgTest';" + "$q->minArgTest('one',2,3.333,4,5,6,7,8,9,10);" + "$q->minArgTest('one',2,3.333,4,5,6,7,8,9,10,11,12);" + "$q->$f('one',2,3.333,4,5,6,7,8,9,10);" + "$q->$f('one',2,3.333,4,5,6,7,8,9,10,11,12);" + "refTest($q);" + "$f = 'varArgsTest';" + "$q->varArgsTest('one',2,3.333,4,5,6,7,8,9,10);" + "$q->varArgsTest('one',2,3.333,4,5,6,7,8,9,10,11,12);" + "$q->$f('one',2,3.333,4,5,6,7,8,9,10);" + "$q->$f('one',2,3.333,4,5,6,7,8,9,10,11,12);" + "$f = 'varArgsTest2';" + "$q->varArgsTest2('one',2,3.333,4,5,6,7,8,9,10);" + "$q->varArgsTest2('one',2,3.333,4,5,6,7,8,9,10,11,12);" + "$q->$f('one',2,3.333,4,5,6,7,8,9,10);" + "$q->$f('one',2,3.333,4,5,6,7,8,9,10,11,12);"); + + VCR("z();"); + VCR("functions['test'] = $function;" + " print($this->functions['test']());" + " }" + "}" + "$a = new foo ();"); + VCR("q();"); + + return true; +} + +bool TestCodeRun::TestVolatile() { + VCR(" 1 && !defined('CON')) {" + " define(/*|Dynamic|*/'CON', 1);" + " }" + " if (defined('CON')) {" + " var_dump(CON);" + " } else {" + " echo \"CON does not exists\\n\";" + " }" + "}" + "for ($i = 0; $i < 4; $i++) {" + " if ($i > 1 && !function_exists('foo')) {" + " function foo() {" + " echo \"foo called\\n\";" + " }" + " }" + " if (function_exists('foo')) {" + " foo();" + " } else {" + " echo \"foo does not exists\\n\";" + " }" + "}" + "for ($i = 0; $i < 4; $i++) {" + " if ($i > 1 && !class_exists('bar')) {" + " class bar {" + " function bar() { echo \"bar called\\n\"; }" + " }" + " }" + " if (class_exists('bar')) {" + " $a = new bar;" + " } else {" + " echo \"bar does not exists\\n\";" + " }" + "}"); + VCR(" 1 && !function_exists('foo')) {" + " function foo() {" + " echo \"foo called\\n\";" + " }" + " }" + " $foo = 'foo';" + " if (function_exists($foo)) {" + " foo();" + " } else {" + " echo \"foo does not exists\\n\";" + " }" + " }" + " for ($i = 0; $i < 4; $i++) {" + " if ($i > 1 && !class_exists('goo')) {" + " class goo {" + " function goo() {" + " echo \"goo called\\n\";" + " }" + " }" + " }" + " $goo = 'goo';" + " if (class_exists($goo)) {" + " $a = new goo();" + " } else {" + " echo \"goo does not exists\\n\";" + " }" + " }" + "}" + "if (function_exists('bar')) bar();" + "$a = 'bar';" + "if (function_exists($a)) bar();" + "$a = 'later';" + "if (function_exists($a)) {" + " echo \"later exists\\n\";" + "} else {" + " echo \"later does not exists\\n\";" + "}" + "$a = 'later2';" + "if (class_exists($a)) {" + " echo \"later2 exists\\n\";" + "} else {" + " echo \"later2 does not exists\\n\";" + "}" + "$a = 'later3';" + "if (function_exists($a)) {" + " echo \"later3 exists\\n\";" + "} else {" + " echo \"later3 does not exists\\n\";" + "}" + "$a = 'later4';" + "if (class_exists($a)) {" + " echo \"later4 exists\\n\";" + "} else {" + " echo \"later4 does not exists\\n\";" + "}" + "function later3() {" + " echo \"later3 called\\n\";" + "}" + "class later4 {" + "}" + "if (function_exists('function_exists')) {" + " echo \"yes\\n\";" + "}" + "if (class_exists('exception')) {" + " echo \"yes\\n\";" + "}"); + VCR(" Double + VCR(" 't');} class B { public $a;} " + "$a = 1; $a = new A(); $a->a['t'] = true; var_dump($a->a['t']);"); + + // Variant % operator + VCR(" -MAX_LATITUDE) define('MAX_LATITUDE', 90); "); + + // toInt64() wrapper + VCR("a = $a->b = 'test'; var_dump($a);"); + VCR("prop++; var_dump($a->prop);"); + + // obj->prop doesn't need lval() wrapper + VCR("prop++; var_dump($a->prop);"); + + // ((p_obj)variant)->prop + VCR("prop++; var_dump($a->prop);"); + + // unsigned int should never be seen + VCR("test($a, $b);"); + + // method->method + VCR("getA()->test();" + ); + + // constructor fallback + VCR("method + VCR("b = new A(); $a->b->test();"); + + // testing code generation order + VCR(" 1); var_dump($_SERVER);"); + VCR(" 1); var_dump($_SERVER);"); + + // class constant as default + VCR(" p_class conversion + VCR("foo();} " + "function foo() { print 'foo';}}"); + + VCR("f(date('m/d/y H:i:s', 123456789));" + "$v = date(\"m\",123456789)+1;"); + + return true; +} + +bool TestCodeRun::TestReflection() { + VCR("getName()); " + " var_dump($func->isInternal()); " + " var_dump($func->isUserDefined()); " + " $vars = $func->getStaticVariables(); " + " var_dump(count($vars));" + " var_dump(isset($vars['a']));" + " var_dump($func->returnsReference()); " + " var_dump($func->getNumberOfParameters()); " + " var_dump($func->getNumberOfRequiredParameters()); " + " foreach ($func->getParameters() as $name => $param) {" + " var_dump($name); " + " dump_param($param); " + " }" + "} " + "" + "function verify_class($cls) {" + " if ($cls) {" + " var_dump($cls->getName()); " + " } else {" + " var_dump(null);" + " }" + "}" + "" + "function verify_classes($classes) {" + " ksort($classes);" + " foreach ($classes as $cls) {" + " verify_class($cls); " + " }" + "}" + "" + "function dump_param($param) {" + " var_dump($param->getName()); " + " var_dump($param->isPassedByReference()); " + " verify_class($param->getDeclaringClass()); " + " verify_class($param->getClass()); " + " var_dump($param->isArray()); " + " var_dump($param->allowsNull()); " + " var_dump($param->isOptional()); " + " var_dump($param->isDefaultValueAvailable()); " + " if ($param->isOptional()) { " + //" var_dump($param->getDefaultValue()); " + " } " + " var_dump($param->getPosition()); " + "} " + "" + "function dump_prop($prop, $obj) {" + " var_dump($prop->getName()); " + " var_dump($prop->isPublic()); " + " var_dump($prop->isPrivate()); " + " var_dump($prop->isProtected()); " + " var_dump($prop->isStatic()); " + //" var_dump($prop->isDefault()); " + " var_dump($prop->getModifiers()); " + " if ($prop->isPublic()) { " + " var_dump($prop->getValue($obj)); " + " if (!$prop->isStatic()) {" + " var_dump($prop->setValue($obj, 78)); " + " }" + " var_dump($prop->getValue($obj)); " + " } " + " verify_class($prop->getDeclaringClass()); " + "} " + "" + "function dump_class($cls, $obj) {" + " var_dump($cls->isInstance($obj)); " + " var_dump($cls->getName()); " + " var_dump($cls->isInternal()); " + " var_dump($cls->isUserDefined()); " + " var_dump($cls->isInstantiable()); " + " var_dump($cls->hasConstant('CLS_CONST')); " + " var_dump($cls->hasMethod('method1')); " + " var_dump($cls->hasProperty('prop1')); " + " dump_func($cls->getMethod('method1')); " + " dump_prop($cls->getProperty('prop1'), $obj); " + " verify_classes($cls->getInterfaces()); " + " var_dump($cls->isInterface()); " + " var_dump($cls->isAbstract()); " + " var_dump($cls->isFinal()); " + " var_dump($cls->getModifiers()); " + " verify_class($cls->getParentClass()); " + " var_dump($cls->isSubclassOf('i1')); " + " var_dump($cls->getStaticPropertyValue('prop2')); " + //" var_dump($cls->setStaticPropertyValue('prop2', 45)); " + " cls1::$prop2 = 45; " + " var_dump($cls->getStaticPropertyValue('prop2')); " + " var_dump(cls1::$prop2); " + " var_dump($cls->isIterateable()); " + " var_dump($cls->implementsInterface('i2')); " + " foreach ($cls->getProperties() as $name => $prop) {" + " var_dump($name); " + " dump_prop($prop, $obj); " + " }" + " foreach ($cls->getMethods() as $name => $func) {" + " var_dump($name); " + " dump_func($func); " + " var_dump($func->isFinal()); " + " var_dump($func->isAbstract()); " + " var_dump($func->isPublic()); " + " var_dump($func->isPrivate()); " + " var_dump($func->isProtected()); " + " var_dump($func->isStatic()); " + " var_dump($func->isConstructor()); " + " var_dump($func->isDestructor()); " + " var_dump($func->getModifiers() & 0xFFFF); " + " verify_class($func->getDeclaringClass()); " + " if ($name == 'method1') $func->invoke($obj, 'invoked'); " + " }" + "}" + "" + // verification + "$func = new ReflectionFunction('func1'); " + "dump_func($func); " + "" + "$func = new ReflectionFunction('func2'); " + "$func->invoke('invoked');" + "" + "$cls = new ReflectionClass('cls1'); " + "$obj = $cls->newInstance(); " + "dump_class($cls, $obj);" + "" + "$cls = new ReflectionClass('cls2'); " + "$obj = $cls->newInstance(); " + "dump_class($cls, $obj);" + ""); + VCR("getProperty('arr');" + " return $p->getValue();" + " }" + "}" + "abstract class aa extends c {" + " public function get_arr() {" + " $actions = parent::get_arr();" + " return $actions;" + " }" + "}" + "class a extends aa {" + " public static $arr = array('v');" + "}" + "$x = new a;" + "var_dump($x->g());"); + VCR("getName());" + "$r = new ReflectionClass('bbbb');" + "var_dump($r->getName());" + "$a = new aaaa;" + "$a->f();"); + VCR("getConstant(\"bar\"));"); + VCR("getFileName() !== '');" + "var_dump($i->getFileName() !== '');"); + + return true; +} + +bool TestCodeRun::TestErrorHandler() { + VCR("bar();"); + + VCR("q;" + " echo $foo;" + " }" + " function y() {" + " static $foo = 20;" + " $foo++;" + " echo $foo;" + " }" + " static function sf() {" + " static $foo = 0;" + " $foo++;" + " echo $foo;" + " }" + "}" + "class d extends c {" + " public $q = 30;" + "}" + "$x = new c();" + "$x->x();" + "$x->y();" + "$x->y();" + "$x->y();" + "$x->y();" + "$x = new d();" + "$x->x();" + "$x->y();" + "$x->y();" + "$x->y();" + "c::sf();" + "c::sf();" + "c::sf();" + "d::sf();" + "d::sf();" + "d::sf();"); + + return true; +} + +bool TestCodeRun::TestIfStatement() { + VCR("= 2) continue 2;" + " echo \"I : $i J : $j\".\"\\n\";" + " }" + " echo \"End\\n\";" + "}" + "for ($i = 0;$i<10;$i++) {" + " if ($i % 2 == 0) continue 1;" + " echo $i . \"\\n\";" + "}" + "for ($i = 0;$i<10;$i++) {" + " if ($i % 2 == 0) continue;" + " echo $i . \"\\n\";" + "}"); + + VCR(" 1) return;" + " if ($a == 1) return 1;" + "}" + "function foo3($a) {" + " if ($a > 1) return;" + " if ($a == 1) return;" + "}" + "function bar() {" + " $v1 = foo1(0);" + " var_dump($v1);" + " $v2 = foo2(0);" + " var_dump($v2);" + " $v3 = foo3(0);" + " var_dump($v3);" + "}" + "bar();"); + + return true; +} + +bool TestCodeRun::TestAdd() { + VCR(" 1));" \ + #op"(array(\"\\0\" => \"\\0\"));" \ + #op"(array(\"\\0\" => \"\\\\\"));" \ + #op"(array(\"\\0\" => \"\\'\"));" \ + #op"(array(\"\\\\\" => 1));" \ + #op"(array(\"\\\\\" => \"\\0\"));" \ + #op"(array(\"\\\\\" => \"\\\\\"));" \ + #op"(array(\"\\\\\" => \"\\'\"));" \ + #op"(array(\"\\'\" => 1));" \ + #op"(array(\"\\'\" => \"\\0\"));" \ + #op"(array(\"\\'\" => \"\\\\\"));" \ + #op"(array(\"\\'\" => \"\\'\"));" \ + #op"(array(\"\\a\" => \"\\a\"));" \ + #op"(!array(\"\\0\" => \"\\0\"));" \ + #op"((array(\"\\0\" => \"\\0\")));" \ + #op"((int)array(\"\\0\" => \"\\0\"));" \ + #op"((integer)array(\"\\0\" => \"\\0\"));" \ + #op"((bool)array(\"\\0\" => \"\\0\"));" \ + #op"((boolean)array(\"\\0\" => \"\\0\"));" \ + #op"((float)array(\"\\0\" => \"\\0\"));" \ + #op"((double)array(\"\\0\" => \"\\0\"));" \ + #op"((real)array(\"\\0\" => \"\\0\"));" \ + #op"((string)array(\"\\0\" => \"\\0\"));" \ + "$a = \"0x10\";" \ + #op"($a);" \ + #op"(\"\\0\");" \ + "$a = array(\"\\0\" => 1);" \ + #op"($a);" \ + "$a = array(\"\\0\" => \"\\0\");" \ + #op"($a);" \ + "$a = array(\"\\0\" => \"\\\\\");" \ + #op"($a);" \ + "$a = array(\"\\0\" => \"\\'\");" \ + #op"($a);" \ + "$a = array(\"\\\\\" => 1);" \ + #op"($a);" \ + "$a = array(\"\\\\\" => \"\\0\");" \ + #op"($a);" \ + "$a = array(\"\\\\\" => \"\\\\\");" \ + #op"($a);" \ + "$a = array(\"\\\\\" => \"\\'\");" \ + #op"($a);" \ + "$a = array(\"\\'\" => 1);" \ + #op"($a);" \ + "$a = array(\"\\'\" => \"\\0\");" \ + #op"($a);" \ + "$a = array(\"\\'\" => \"\\\\\");" \ + #op"($a);" \ + "$a = array(\"\\'\" => \"\\'\");" \ + #op"($a);" \ + "$a = array(\"\\a\" => \"\\a\");" \ + #op"($a);") + +bool TestCodeRun::TestUnaryOperators() { + UNARY_OP(var_dump); + return true; +} + +bool TestCodeRun::TestSilenceOperator() { + VCR("\");"); + return true; +} + +bool TestCodeRun::TestPrint() { + UNARY_OP(echo); + UNARY_OP(print); + UNARY_OP(print_r); + UNARY_OP(var_export); + UNARY_OP(serialize); + return true; +} + +bool TestCodeRun::TestLocale() { + VCR("bar();" + "$f2->bar();" + "var_dump(get_class(\"qwerty\"));" + "var_dump(get_class($f1));" + "var_dump(get_class($f2));" + ); + VCR("test();" + "$bar->test();" + "$bar->test_bar();" + "$goo->test();" + "$goo->test_bar();" + "$goo->test_goo();" + "var_dump(get_parent_class($bar));" + "var_dump(get_parent_class($foo));" + "var_dump(get_parent_class($goo));" + "var_dump(get_parent_class(\"bar\"));" + "var_dump(get_parent_class(\"foo\"));" + "var_dump(get_parent_class(\"goo\"));" + "var_dump(get_parent_class(\"i\"));" + "var_dump(get_parent_class(\"\"));" + "var_dump(get_parent_class(\"[[[[\"));" + "var_dump(get_parent_class(\" \"));" + "var_dump(get_parent_class(new stdclass));" + "var_dump(get_parent_class(array()));" + "var_dump(get_parent_class(1));" + ); + + return true; +} + +bool TestCodeRun::TestRedeclaredFunctions() { + VCR("childProp; }" + " function testChildMeth() { return $this->childMeth(); }" + " static function baseStatMeth() {" + " return 'Base static method';" + " }" + " function childMeth() { return 'I am base'; }" + " }" + "} else {" + " class base {" + " }" + "}" + "class child1 extends base {" + " public $child1Val = 'child1';" + " public $childProp = 'IamChild1';" + " static $child1Static = 'child1Stat';" + " function childMeth() {" + " return 'I am child1';" + " }" + " static function child1StatMeth() {" + " return 'Child 1 static method';" + " }" + " function parentChildMeth() {" + " return parent::childMeth();" + " }" + "}" + "class child2 extends child1 {" + " public $child2Val = 'child2';" + " public $childProp = 'IamChild2';" + " static $child2Static = 'child2Stat';" + " static function child2StatMeth() {" + " return 'Child 2 static method';" + " }" + " function childMeth() {" + " return 'I am child2';" + " }" + " function parentChildMeth() {" + " return parent::childMeth();" + " }" + " function testChildMeth2() { return $this->childMeth(); }" + "}" + "if (true) {" + " class child3 extends child2 {" + " public $child3Val = 'child3';" + " public $childProp = 'IamChild3';" + " static $child3Static = 'child3Stat';" + " function childMeth() {" + " return 'I am child3';" + " }" + " static function child3StatMeth() {" + " return 'Child 3 static method';" + " }" + " function parentChildMeth() {" + " return parent::childMeth();" + " }" + "" + " }" + "} else {" + " class child3 {}" + "}" + "function test($val, $exp, $feature) {" + " if ($val !== $exp) {" + " echo $feature . \" failed. Got:\\n\";" + " var_dump($val);" + " echo \"But expected:\\n\";" + " var_dump($exp);" + " } else {" + " echo $feature . \" passed\\n\";" + " }" + "}" + "function run() {" + " $base = new base;" + " test($base->baseVal, 'base', 'Base object member');" + " test(base::$baseStatic, 'baseStat', 'Base static member');" + " test(base::baseStatMeth(), 'Base static method', 'Base static method');" + " test($base->baseStatMeth(), 'Base static method', 'Base static method obj syntax');" + " $child1 = new child1;" + " test($child1->baseVal, 'base', 'dRedec inherited property');" + " test($child1->child1Val, 'child1', 'dRedec property');" + " test($child1->testChildMeth(), 'I am child1', 'dRedec parent->virtual method');" + " test($child1->childProp(), 'IamChild1', 'dRedec parent->child prop method');" + " test(child1::child1StatMeth(), 'Child 1 static method', 'dRedec static method');" + " test(child1::baseStatMeth(), 'Base static method', 'dRedec parent static method');" + " test($child1->child1StatMeth(), 'Child 1 static method', 'dRedec static method obj syntax');" + " test($child1->baseStatMeth(), 'Base static method', 'dRedec parent static method obj syntax');" + " test(child1::$baseStatic, 'baseStat', 'dRedec parent static prop');" + " test(child1::$child1Static, 'child1Stat', 'dRedec static prop');" + " test($child1->parentChildMeth(), 'I am base', 'dRedec parent method');" + " $child2 = new child2;" + " test($child2->baseVal, 'base', 'ddRedec grandparent property');" + " test($child2->child1Val, 'child1', 'ddRedec parent property');" + " test($child2->child2Val, 'child2', 'ddRedec property');" + " test($child2->testChildMeth(), 'I am child2', 'ddRedec grandparent->virtual method');" + " test($child2->testChildMeth2(), 'I am child2', 'ddRedec parent->virtual method');" + " test($child2->childProp(), 'IamChild2', 'ddRedec grandparent->child prop method');" + " test(child2::baseStatMeth(), 'Base static method', 'ddRedec grandparent static method');" + " test(child2::child1StatMeth(), 'Child 1 static method', 'ddRedec parent static method');" + " test(child2::child2StatMeth(), 'Child 2 static method', 'ddRedec static method');" + " test($child2->baseStatMeth(), 'Base static method', 'ddRedec grandparent static method obj syntax');" + " test($child2->child1StatMeth(), 'Child 1 static method', 'ddRedec parent static method obj syntax');" + " test($child2->child2StatMeth(), 'Child 2 static method', 'ddRedec static method obj syntax');" + " test(child2::$baseStatic, 'baseStat', 'ddRedec grandparent static prop');" + " test(child2::$child1Static, 'child1Stat', 'ddRedec parent static prop');" + " test(child2::$child2Static, 'child2Stat', 'ddRedec static prop');" + " test($child2->parentChildMeth(), 'I am child1', 'ddRedec parent method');" + " $child3 = new child3;" + " test($child3->baseVal, 'base', 'RddRedec greatgrandparent property');" + " test($child3->child1Val, 'child1', 'RddRedec grandparent property');" + " test($child3->child2Val, 'child2', 'RddRedec parent property');" + " test($child3->child3Val, 'child3', 'RddRedec property');" + " test($child3->testChildMeth(), 'I am child3', 'RddRedec greatgrandparent->virtual method');" + " test($child3->testChildMeth2(), 'I am child3', 'RddRedec grandparent->virtual method');" + " test($child3->childProp(), 'IamChild3', 'RddRedec greatgrandparent->child prop method');" + " test(child3::baseStatMeth(), 'Base static method', 'RddRedec greatgrandparent static method');" + " test(child3::child1StatMeth(), 'Child 1 static method', 'RddRedec grandparent static method');" + " test(child3::child2StatMeth(), 'Child 2 static method', 'RddRedec parent static method');" + " test(child3::child3StatMeth(), 'Child 3 static method', 'RddRedec static method');" + " test($child3->baseStatMeth(), 'Base static method', 'RddRedec greatgrandparent static method obj syntax');" + " test($child3->child1StatMeth(), 'Child 1 static method', 'RddRedec grandparent static method obj syntax');" + " test($child3->child2StatMeth(), 'Child 2 static method', 'RddRedec parent static method obj syntax');" + " test($child3->child3StatMeth(), 'Child 3 static method', 'RddRedec static method obj syntax');" + " test(child3::$baseStatic, 'baseStat', 'RddRedec greatgrandparent static prop');" + " test(child3::$child1Static, 'child1Stat', 'RddRedec grandparent static prop');" + " test(child3::$child2Static, 'child2Stat', 'RddRedec parent static prop');" + " test(child3::$child3Static, 'child3Stat', 'RddRedec static prop');" + " test($child3->parentChildMeth(), 'I am child2', 'RddRedec parent method');" + "}" + "run();" + ); + VCR("foo();" + "$t->bar();"); + VCR("foo();" + "$t->bar();"); + VCR("foo = 'foo';" + "$a1->fooref = &$p;" + "$a1->dyn = 'dyn';" + "$a1->dynref = &$q;" + "var_dump($a1);" + "$a2 = clone $a1;" + "var_dump($a1);" + "var_dump($a2);" + "$a2->foo = 'a2foo';" + "$a2->fooref = 'a2fooref';" + "$a2->dyn = 'a2dyn';" + "$a2->dynref = 'a2dynref';" + "$a2->dynref2 = 'dynref2';" + "var_dump($a1);" + "var_dump($a2);" + "var_dump($p);" + "var_dump($q);"); + VCR("cm);" + " }" + "}" + "class c2 extends c {}" + "$y = new c;" + "$y->x();" + "$z = clone $y;" + "$z->x();" + "$y = new c2;" + "$y->x();" + "$z = clone $y;" + "$z->x();"); + VCR("x();" + " }" + " function y() {" + " echo 'y';" + " }" + "}" + "class c extends b {" + " function x() {" + " $this->y();" + " }" + "}" + "if (false) {" + " class b{}" + " class c{}" + "}" + "$x = new c();" + "$x->z();"); + VCR("meh()->work();" + "}" + "test();"); + + return true; +} + +bool TestCodeRun::TestEvalOrder() { + VCR("foo = 9;" + " $this->bar = '3';" + " return $this;" + " }" + "}" + "$a = new A();" + "var_dump($a->q('1')->foo + $a->q('2')->bar);" + "var_dump($a->q('1')->foo - $a->q('2')->bar);" + "var_dump($a->q('1')->foo / $a->q('2')->bar);" + "var_dump($a->q('1')->foo * $a->q('2')->bar);" + "var_dump($a->q('1')->foo % $a->q('2')->bar);" + "var_dump($a->q('1')->foo << $a->q('2')->bar);" + "var_dump($a->q('1')->foo >> $a->q('2')->bar);" + "var_dump($a->q('1')->foo && $a->q('2')->bar);" + "var_dump($a->q('1')->foo || $a->q('2')->bar);" + "var_dump($a->q('1')->foo and $a->q('2')->bar);" + "var_dump($a->q('1')->foo or $a->q('2')->bar);" + "var_dump($a->q('1')->foo xor $a->q('2')->bar);" + "var_dump($a->q('1')->foo . $a->q('2')->bar);" + "var_dump($a->q('1')->foo & $a->q('2')->bar);" + "var_dump($a->q('1')->foo | $a->q('2')->bar);" + "var_dump($a->q('1')->foo ^ $a->q('2')->bar);" + "var_dump($a->q('1')->foo == $a->q('2')->bar);" + "var_dump($a->q('1')->foo === $a->q('2')->bar);" + "var_dump($a->q('1')->foo != $a->q('2')->bar);" + "var_dump($a->q('1')->foo !== $a->q('2')->bar);" + "var_dump($a->q('1')->foo > $a->q('2')->bar);" + "var_dump($a->q('1')->foo >= $a->q('2')->bar);" + "var_dump($a->q('1')->foo < $a->q('2')->bar);" + "var_dump($a->q('1')->foo <= $a->q('2')->bar);" + ); + VCR("f(p(1), p(2), p(3), 4);" + "echo \"rsfc\n\";" + "rt($a, id(10));" + "var_dump($a);" + "dump($v++, $v++);" + "$v = 10;" + "dump($v, $v = 0);" + "echo \"nest\n\";" + "x(p(1), x(p(2), p(3), p(4), p(5)), p(6), x(p(7), p(8), p(9), p(10)));" + "echo \"arr\n\";" + "$z = array(p(1), p(2), x(p(3), p(4), p(5), p(6)), p(7));" + "$q = 1;" + "$z = array(1, 2, $q);" + ); + VCR("f(pid('arg1'),pid('arg2'));" + " }" + "}" + "$d = id1(new cls())" + " ->f('arg1')" + " ->f('arg2')" + " ->f('arg3');" + "$d = id1(new cls())" + " ->f('arg1', 'argex1')" + " ->f('arg2', 'argex2')" + " ->f('arg3', 'argex3');" + "$d = id(new cls(), pid('idarg'))" + " ->f(pid('arg1'), pid('argex1'))" + " ->f(pid('arg2'), pid('argex2'))" + " ->f(pid('arg3'), pid('argex3'));" + "$d->ttest();"); + VCR("r($x);" + "var_dump($x);"); + + VCR("x(3, p(1), p(2))->x(6, p(4), p(5));"); + VCR("val = $v;" + " }" + " public function blah() {" + " return $this;" + " }" + "}" + "class A {" + " public $v;" + " function set($v) {" + " $this->v = $v;" + " return $this;" + " }" + "}" + "function id($x) { return $x; }" + "$x = new Q(0);" + "$a = id(new A)->set($x);" + "$x = id(new Q(1))->blah();" + "var_dump($a);"); + + return true; +} + +bool TestCodeRun::TestGetObjectVars() { + VCR("foo($child_obj);" + "$unrelated_obj->foo($base_obj);" + ); + VCR("foo($child_obj);" + ); + VCR("foo($base_obj);" + ); + VCR("foo($base_obj);" + ); + return true; +} + +bool TestCodeRun::TestSerialization() { + VCR("name = 'foo'.$n;" + " $this->num = 3*$n;" + " }" + "}" + "class Big {" + " public $groupAll = array();" + " public $group1 = array();" + " public $group2 = array();" + " public $wacky;" + " public $nothing;" + " public $unrelated = array();" + " function add() {" + " $s = new Small();" + " $this->groupAll[] = $s;" + " if ($s->num % 2 == 0) {" + " $this->group1[]=array($s->name, $s);" + " } else {" + " $this->group2[]=array($s->name, $s);" + " }" + " }" + " function finish() {" + " $x = 10;" + " $this->wacky = array(&$x, &$x);" + " $s = new Small();" + " $this->unrelated[] = $s;" + " $this->unrelated[] = $s;" + " $this->unrelated[] = $s;" + " }" + "}" + "function t() {" + " $b = new Big;" + " for ($i = 0; $i < 10; ++$i) {" + " $b->add();" + " }" + " $b->finish();" + " var_dump($b);" + " $s = serialize($b);" + " var_dump($s);" + " $us = unserialize($s);" + " var_dump($us);" + "}" + "t();" + ); + VCR("1, \"2\"=>2);" + "$a[] = $a;" + "var_dump($a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>\"1\", \"2\"=>\"2\");" + "$a[] = $a;" + "var_dump($a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>1, 2=>\"2\");" + "$a[] = $a;" + "var_dump($a);" + "var_dump(json_encode($a));" + "" + "$a = array(1);" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\");" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode($a));" + "" + "$a = array(1, \"2\");" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>1, \"2\"=>2);" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>\"1\", \"2\"=>\"2\");" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>1, 2=>\"2\");" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode($a));" + "" + "$a = array(1);" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\");" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(1, \"2\");" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>1, \"2\"=>2);" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>\"1\", \"2\"=>\"2\");" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>1, 2=>\"2\");" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(1);" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\");" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(1, \"2\");" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>1, \"2\"=>2);" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>\"1\", \"2\"=>\"2\");" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(\"1\"=>1, 2=>\"2\");" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode($a));" + "" + "$a = array(1);" + "$a[] = $a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\");" + "$a[] = $a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(1, \"2\");" + "$a[] = $a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>1, \"2\"=>2);" + "$a[] = $a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>\"1\", \"2\"=>\"2\");" + "$a[] = $a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>1, 2=>\"2\");" + "$a[] = $a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(1);" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\");" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(1, \"2\");" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>1, \"2\"=>2);" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>\"1\", \"2\"=>\"2\");" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>1, 2=>\"2\");" + "$a[] = &$a;" + "var_dump($a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(1);" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\");" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(1, \"2\");" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>1, \"2\"=>2);" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>\"1\", \"2\"=>\"2\");" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>1, 2=>\"2\");" + "$a[] = $a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(1);" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\");" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(1, \"2\");" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>1, \"2\"=>2);" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>\"1\", \"2\"=>\"2\");" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));" + "" + "$a = array(\"1\"=>1, 2=>\"2\");" + "$a[] = &$a;" + "var_dump(&$a);" + "var_dump(json_encode(&$a));"); + + return true; +} + +bool TestCodeRun::TestThrift() { + VCR( + "t = new DummyTransport();" + " }" + " function getTransport() {" + " return $this->t;" + " }" + "}" + "class DummyTransport {" + " public $buff = '';" + " public $pos = 0;" + " function flush() { }" + " function write($buff) {" + " $this->buff .= $buff;" + " }" + " function read($n) {" + " return substr($this->buff, $pos, $n);" + " $pos += $n;" + " }" + "}" + "class TestStruct {" + " static $_TSPEC;" + "" + " public $anInt = null;" + " public $aString = null;" + " public $aDouble = null;" + " public $anInt64 = null;" + " public $aList = null;" + " public $aMap = null;" + " public $aSet = null;" + "" + " public function __construct($vals=null) {" + " if (!isset(self::$_TSPEC)) {" + " self::$_TSPEC = array(" + " 1 => array(" + " 'var' => 'anInt'," + " 'type' => TType::I32," + " )," + " 2 => array(" + " 'var' => 'aString'," + " 'type' => TType::STRING," + " )," + " 3 => array(" + " 'var' => 'aDouble'," + " 'type' => TType::DOUBLE," + " )," + " 4 => array(" + " 'var' => 'anInt64'," + " 'type' => TType::I64," + " )," + " 5 => array(" + " 'var' => 'aList'," + " 'type' => TType::LST," + " 'etype' => TType::DOUBLE," + " 'elem' => array(" + " 'type' => TType::DOUBLE," + " )," + " )," + " 6 => array(" + " 'var' => 'aMap'," + " 'type' => TType::MAP," + " 'ktype' => TType::I32," + " 'vtype' => TType::DOUBLE," + " 'key' => array(" + " 'type' => TType::I32," + " )," + " 'val' => array(" + " 'type' => TType::DOUBLE," + " )," + " )," + " 7 => array(" + " 'var' => 'aSet'," + " 'type' => TType::SET," + " 'etype' => TType::I32," + " 'elem' => array(" + " 'type' => TType::I32," + " )," + " )" + " );" + " }" + " }" + "}" + "" + "function test() {" + " $p = new DummyProtocol();" + " $v1 = new TestStruct();" + " $v1->anInt = 1234;" + " $v1->aString = 'abcdef';" + " $v1->aDouble = 1.2345;" + " $v1->anInt64 = 8589934592;" + " $v1->aList = array(13.3, 23.4, 3576.2);" + " $v1->aMap = array(10=>1.2, 43=>5.33);" + " $v1->aSet = array(10=>true, 11=>true);" + " var_dump($v1);" + " thrift_protocol_write_binary($p, 'foomethod', 1, $v1, 20, true);" + " var_dump(md5($p->getTransport()->buff));" + " var_dump(thrift_protocol_read_binary($p, 'TestStruct', true));" + "}" + "test();"); + return true; +} + +bool TestCodeRun::TestExit() { + VCR(" 1000;')));"); + VCR(" 1000;')));"); + return true; +} + +bool TestCodeRun::TestConstructorDestructor() { + VCR("';" + "$payload['pane_html'] .= '

    ';" + "}" + "$GLOBALS['n_indent_level'] = 0;" + "var_dump(render(\"foo\", \"bar\"));"); + VCR("Test\", ENT_QUOTES);" + "echo htmlentities(\"Test\", ENT_QUOTES);" + "echo dirname(\"Test\");" + "echo basename(\"Test\");" + "echo version_compare(\"5.1.2\", \"5.1.3\");" + "echo dechex(10);" + "echo hexdec(\"See\");" + "echo decbin(12);" + "echo decbin('000110011');" + "echo decoct(264);" + "echo octdec('77');" + "echo octdec(decoct(45));" + "echo str_repeat(\"-=\", 10);" + "echo intval(42);" + "echo intval(4.2);" + "echo intval('42');" + "echo intval('+42');" + "echo intval('-42');" + "echo intval(042);" + "echo intval('042');" + "echo intval(1e10);" + "echo intval('1e10');" + "echo intval(0x1A);" + "echo intval(42000000);" + "echo intval(42, 8);" + "echo intval('42', 8);" + "echo substr(\"abcdef\", -1);" + "echo substr(\"abcdef\", -2);" + "echo substr(\"abcdef\", -3, 1);" + "echo substr(\"abcdef\", 0, -1);" + "echo substr(\"abcdef\", 2, -1);" + "echo substr(\"abcdef\", 4, -4);" + "echo substr(\"abcdef\", -3, -1);" + "echo substr(\"abcdef\", 1);" + "echo substr(\"abcdef\", 1, 3);" + "echo substr(\"abcdef\", 0, 4);" + "echo substr(\"abcdef\", 0, 8);" + "echo substr(\"abcdef\", -1, 1);" + "echo trim(\"\\t\\t\\0These are a few words :) ... \");" + "echo trim(\"\\t\\t\\0These are a few words :) ... \", \" \\t.\");" + "echo trim(\"\\x09Example string\\x0A\", \"\\x00..\\x1F\");" + "echo ltrim(\"\\t\\t\\0These are a few words :) ... \");" + "echo ltrim(\"\\t\\t\\0These are a few words :) ... \", \" \\t.\");" + "echo ltrim(\"\\x09Example string\\x0A\", \"\\x00..\\x1F\");" + "echo rtrim(\"\\t\\t\\0These are a few words :) ... \");" + "echo rtrim(\"\\t\\t\\0These are a few words :) ... \", \" \\t.\");" + "echo rtrim(\"\\x09Example string\\x0A\", \"\\x00..\\x1F\");" + "echo chop(\"\\t\\t\\0These are a few words :) ... \");" + "echo chop(\"\\t\\t\\0These are a few words :) ... \", \" \\t.\");" + "echo chop(\"\\x09Example string\\x0A\", \"\\x00..\\x1F\");" + "echo acos(0.5);" + "echo acosh(0.5);" + "echo asin(0.5);" + "echo asinh(0.5);" + "echo atan(0.5);" + "echo atan2(0.5, 0.5);" + "echo atanh(0.5);" + "echo cos(0.5);" + "echo cosh(0.5);" + "echo sin(0.5);" + "echo sinh(0.5);" + "echo tan(0.5);" + "echo tanh(0.5);" + "echo exp(5.7);" + "echo exp(12);" + "echo log10(12);" + "echo log(12);" + "echo sqrt(2);" + "echo ceil(7.9);" + "echo floor(7.9);" + "echo fmod(5.7, 1.3);" + "echo ip2long(\"127.0.0.1\");" + "echo ip2long(\"10.0.0\");" + "echo ip2long(\"10.0.256\");" + "echo long2ip(pow(2,32) + 1024);" + "echo rad2deg(M_PI_4);" + "echo deg2rad(45);"); + VCR("_getJSFunction('_encode10');" + " var_dump($encode10);" + " $encode36 = $this->_getJSFunction('_encode36');" + " var_dump($encode36);" + " }" + " private function _getJSFunction($aName) {" + " if (defined('self::JSFUNCTION'.$aName))" + " return constant('self::JSFUNCTION'.$aName);" + " else" + " return '';" + " }" + " const JSFUNCTION_encode10 =" + " 'function($charCode) {" + " return $charCode;" + "}';" + "" + "}" + "$obj = new JavaScriptPacker;" + "$obj->foo(); "); + VCR(" 0) {" + " define('REDECLARED', 1);" + " } else if ($i < 0) {" + " define('REDECLARED', -1);" + " }" + "}" + "if (defined($a)) {" + " var_dump(REDECLARED);" + "}" + "$a = 'DYNAMIC';" + "if (defined($a)) {" + " var_dump(DYNAMIC);" + "}" + "define(/*|Dynamic|*/ 'DYNAMIC', 13);" + "if (defined($a)) {" + " var_dump(DYNAMIC);" + "}"); +#endif + VCR("f();" + "$obj = new Bar;" + "$obj->f();"); + + return true; +} + +bool TestCodeRun::TestAssignment() { + VCR("val = 1); }" + " function goo() { f($val = 'val'); f($this->$val = 2); }" + " function zoo() {" + " var_dump($val); var_dump($this->val);" + " }" + "}" + "function foo() {" + " f($val2 = 1);" + "}" + "$obj = new ClassA();" + "var_dump($obj);" + "$obj->foo();" + "var_dump($obj);" + "$obj->bar();" + "var_dump($obj);" + "$obj->goo();" + "var_dump($obj);" + "$obj->zoo();"); + VCR("$val = 2); }" + " function foo2() { f($this->val = 3); }" + " function bar() {" + " var_dump($val); var_dump($this->val);" + " }" + "}" + "$obj = new ClassA();" + "var_dump($obj);" + "$obj->foo();" + "var_dump($obj);" + "$obj->bar();" + "$obj->foo2();" + "var_dump($obj);" + "$obj->bar();"); + + return true; +} + +bool TestCodeRun::TestEvaluationOrder() { + VCR("c1c2c3'); $foo_ns_bar = $doc->children('http://example.com');" + "var_dump($doc->getName());" + "foreach ($foo_ns_bar as $v) var_dump((string)$v);" + "var_dump($foo_ns_bar->getName());" + "var_dump(count($foo_ns_bar->b1));" + "var_dump((string)$foo_ns_bar->b1);" + "var_dump((string)$foo_ns_bar->b1[0]);" + "foreach ($foo_ns_bar->b1 as $v) var_dump((string)$v);" + "var_dump(count($foo_ns_bar->b2));" + "var_dump((string)$foo_ns_bar->b2[0]);" + "var_dump((string)$foo_ns_bar->b2[1]);" + "foreach ($foo_ns_bar->b2 as $v) var_dump((string)$v);" + ); + + VCR(" 10) {" + " var_dump('Recursed to deep, backing out');" + " return;" + " }" + " print $indent.$el->getName().\"\\n\";" + " foreach ($el->attributes() as $k => $v) {" + " print $indent.$k.' => '.$v.\"\\n\";" + " }" + " foreach ($el->children() as $child) {" + " printElement($child, $indent.' ');" + " }" + "}" + "$a = simplexml_load_string('hihi');" + "printElement($a);" + ); + + VCR("testtestv');" + "var_dump((array)$a->attributes());" + "var_dump((string)$a->subnode[0]);" + "var_dump((string)$a->subnode[0]['attr1']);" + "var_dump((string)$a->subnode[1]['subsubnode']);" + "var_dump((string)$a->subnode[1]->subsubnode);" + "var_dump((string)$a->test);" + "var_dump((array)$a->subnode[0]->attributes());" + "var_dump((array)$a->subnode[1]->attributes());" + "var_dump($a->asxml());" + "var_dump((array)$a->addchild('newnode', 'newvalue'));" + "$a->addattribute('newattr', 'newattrvalue');" + "var_dump($a->asxml());" + "var_dump((array)$a->attributes());" + "var_dump((array)$a->newnode);" + "var_dump($a->getname());" + "var_dump((array)$a->children()->subnode[0]->subsubnode);" + "$nodes = $a->xpath('//node/subnode');" + "var_dump((string)$nodes[1]->subsubnode);" + "$nodes = $nodes[1]->xpath('subsubnode');" + "var_dump((string)$nodes[0]);" + ); + + VCR("test');" + "var_dump((array)($a->subnode->subsubnode));" + "var_dump((string)($a->subnode->subsubnode));" + ); + + VCR("test');" + "var_dump((array)($a->subnode->subsubnode));" + "var_dump((string)($a->subnode->subsubnode));" + ); + VCR("test');" + "var_dump((string)($a->subnode->subsubnode['0']));" + "var_dump((string)($a->subnode->subsubnode[0]));" + ); + + VCR("test');" + "var_dump((string)($a->subnode['attr1']));" + ); + VCR("test');" + "var_dump((string)($a->subnode->subsubnode['attr1']));" + ); + + VCR("test');" + "var_dump((string)($a->subnode->subsubnode->sssnode));" + ); + VCR("';" + "$xml = new SimpleXMLElement($post_xml);" + "foreach ($xml->scannedItem as $item) {" + " echo $item['itemName'] . \"\\n\";" + "}"); + + return true; +} + +bool TestCodeRun::TestFile() { + VCR("a(); }" + "test();"); + // __construct takes priority + VCR("a(); } " + "test();"); + return true; +} + +bool TestCodeRun::TestTernary() { + VCR("name = \"MyDestructableClass\";" + " }" + "" + " function __destruct() {" + " print \"Destroying \" . $this->name . \"\\n\";" + " }" + "}" + "function foo($a) {" + " if ($a) return new MyDestructableClass();" + " return false;" + "}" + "function bar($a) {" + " if ($a) {" + " $obj = foo(1);" + " $obj = 1;" + " var_dump(2);" + " }" + " var_dump(1);" + "}" + "bar(1);"); + VCR("name = \"MyDestructableClass\";" + " }" + "" + " function __destruct() {" + " print \"Destroying \" . $this->name . \"\\n\";" + " }" + "}" + "function foo(&$a) {" + " $a = new MyDestructableClass();" + "}" + "function bar($a) {" + " if ($a) {" + " $b = array(1, 2, 3);" + " var_dump($b);" + " foo($dummy = array(1, 2, 3));" + " $c = array(1, 2, 3);" + " var_dump($c);" + " }" + "}" + "bar(1);"); + + return true; +} + +bool TestCodeRun::TestTypes() { + VCR(" 50; $i--) {" + " imagefilledarc($image, 50, $i, 100, 50, 0, 45," + " $darknavy, IMG_ARC_PIE);" + " imagefilledarc($image, 50, $i, 100, 50, 45, 75," + " $darkgray, IMG_ARC_PIE);" + " imagefilledarc($image, 50, $i, 100, 50, 75, 360," + " $darkred, IMG_ARC_PIE);" + "}" + "" + "imagefilledarc($image, 50, 50, 100, 50, 0, 45, $navy, IMG_ARC_PIE);" + "imagefilledarc($image, 50, 50, 100, 50, 45, 75 , $gray, IMG_ARC_PIE);" + "imagefilledarc($image, 50, 50, 100, 50, 75, 360 , $red, IMG_ARC_PIE);" + "" + "" + "// flush image" + "header('Content-type: image/png');" + "imagepng($image);" + "imagedestroy($image);"); + VCR(" + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Testing PHP -> C++ -> execution. + */ +class TestCodeRun : public TestBase { + public: + TestCodeRun(); + + virtual bool RunTests(const std::string &which); + + // test test harness + bool TestSanity(); + + // test code generation process + bool TestInnerFunction(); + bool TestInnerClass(); + bool TestVariableArgument(); + bool TestListAssignment(); + bool TestExceptions(); + bool TestPredefined(); + + // test types + bool TestBoolean(); + bool TestInteger(); + bool TestDouble(); + bool TestString(); + bool TestArray(); + bool TestArrayEscalation(); + bool TestArrayOffset(); + bool TestArrayAccess(); + bool TestArrayIterator(); + bool TestArrayAssignment(); + bool TestArrayMerge(); + bool TestArrayUnique(); + bool TestScalarArray(); + bool TestRange(); + bool TestVariant(); + bool TestObject(); + bool TestObjectProperty(); + bool TestObjectMethod(); + bool TestClassMethod(); + bool TestObjectMagicMethod(); + bool TestObjectAssignment(); + bool TestNewObjectExpression(); + bool TestObjectPropertyExpression(); + bool TestComparisons(); + bool TestTernary(); + bool TestTypes(); + bool TestSwitchStatement(); + + // test semantics + bool TestUnset(); + bool TestReference(); + bool TestDynamicConstants(); + bool TestDynamicVariables(); + bool TestDynamicProperties(); + bool TestDynamicFunctions(); + bool TestDynamicMethods(); + bool TestVolatile(); + bool TestSuperGlobals(); + bool TestGlobalStatement(); + bool TestStaticStatement(); + bool TestIfStatement(); + bool TestBreakStatement(); + bool TestContinueStatement(); + bool TestReturnStatement(); + bool TestAdd(); + bool TestMinus(); + bool TestMultiply(); + bool TestDivide(); + bool TestModulus(); + bool TestOperationTypes(); + bool TestUnaryOperators(); + bool TestSilenceOperator(); + bool TestLogicalOperators(); + bool TestGetClass(); + bool TestGetParentClass(); + bool TestRedeclaredFunctions(); + bool TestRedeclaredClasses(); + bool TestClone(); + bool TestEvalOrder(); + bool TestGetObjectVars(); + bool TestSerialization(); + bool TestJson(); + bool TestExit(); + bool TestConstructorDestructor(); + bool TestConcat(); + bool TestConstant(); + bool TestClassConstant(); + bool TestConstantFunction(); + bool TestDefined(); + bool TestAssignment(); + bool TestEvaluationOrder(); + bool TestPrint(); + bool TestLocale(); + bool TestBadFunctionCalls(); + bool TestConstructor(); + + // misc + bool TestProgramFunctions(); + bool TestCompilation(); + bool TestReflection(); + bool TestReflectionClasses(); + bool TestErrorHandler(); + bool TestAssertOptions(); + bool TestExtMisc(); + bool TestThrift(); + bool TestCreateFunction(); + bool TestSimpleXML(); + bool TestFile(); + bool TestUselessAssignment(); + bool TestExtImage(); + + // debugging purpose + bool TestAdHoc(); + + protected: + bool CleanUp(); + bool GenerateFiles(const char *input); + bool CompileFiles(const char *input, const char *file, int line); + + bool VerifyCodeRun(const char *input, const char *output, + const char *file = "", int line = 0, + bool nowarnings = false); + + bool m_perfMode; +}; + +/////////////////////////////////////////////////////////////////////////////// +// macros + +#define VCR(a) \ + if (!Count(VerifyCodeRun(a,NULL,__FILE__,__LINE__))) return false; + +#define VCRNW(a) \ + if (!Count(VerifyCodeRun(a,NULL,__FILE__,__LINE__,true))) return false; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_CODE_RUN_H__ diff --git a/src/test/test_cpp_base.cpp b/src/test/test_cpp_base.cpp new file mode 100644 index 0000000000000..c4585104af550 --- /dev/null +++ b/src/test/test_cpp_base.cpp @@ -0,0 +1,952 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +TestCppBase::TestCppBase() { +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestCppBase::RunTests(const std::string &which) { + bool ret = true; + RUN_TEST(TestSmartAllocator); + RUN_TEST(TestString); + RUN_TEST(TestArray); + RUN_TEST(TestObject); + RUN_TEST(TestVariant); + RUN_TEST(TestListAssignment); +#ifndef DEBUGGING_SMART_ALLOCATOR + RUN_TEST(TestMemoryManager); +#endif + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// building blocks + +class Timer { +public: + Timer(const char *name = NULL) { + if (name) m_name = name; + gettimeofday(&m_start, 0); + } + + int64 getMicroSeconds() { + struct timeval end; + gettimeofday(&end, 0); + return (end.tv_sec - m_start.tv_sec) * 1000000 + + (end.tv_usec - m_start.tv_usec); + } + +private: + std::string m_name; + struct timeval m_start; +}; + +class SomeClass { +public: + SomeClass() : m_data(0) {} + bool calculate(int &size) { return false;} + void backup(LinearAllocator &allocator) {} + void restore(const char *&data) {} + void sweep() {} + void dump() { printf("data: %d\n", m_data);} + int m_data; +}; + +typedef SmartAllocator + SomeClassAlloc; + +bool TestCppBase::TestSmartAllocator() { + int iMax = 1000000; + int64 time1, time2; + { + IMPLEMENT_THREAD_LOCAL(SomeClassAlloc, allocator); + + Timer t; + for (int i = 0; i < iMax; i++) { + SomeClass *obj = new (allocator.get()) SomeClass(); + allocator.get()->dealloc(obj); + } + time1 = t.getMicroSeconds(); + if (!Test::s_quiet) { + printf("SmartAlloctor: %lld us\n", time1); + } + } + { + Timer t; + for (int i = 0; i < iMax; i++) { + SomeClass *obj = new SomeClass(); + delete obj; + } + time2 = t.getMicroSeconds(); + if (!Test::s_quiet) { + printf("malloc/free: %lld us\n", time2); + } + } + return Count(true); +} + +/////////////////////////////////////////////////////////////////////////////// +// data types + +bool TestCppBase::TestString() { + // constructors + { + VS((const char *)String(15), "15"); + VS((const char *)String(-15), "-15"); + VS((const char *)String(12345678912345678LL), "12345678912345678"); + VS((const char *)String(-12345678912345678LL), "-12345678912345678"); + VS((const char *)String(5.603), "5.603"); + VS((const char *)String("test"), "test"); + VS((const char *)String(String("test")), "test"); + } + + // informational + { + VERIFY(String().isNull()); + VERIFY(!String("").isNull()); + VERIFY(String().empty()); + VERIFY(String("").empty()); + VERIFY(!String("test").empty()); + VERIFY(String().size() == 0); + VERIFY(String().length() == 0); + VERIFY(String("").size() == 0); + VERIFY(String("").length() == 0); + VERIFY(String("test").size() == 4); + VERIFY(String("test").length() == 4); + VERIFY(!String("2test").isNumeric()); + VERIFY(!String("2test").isInteger()); + VERIFY(!String("2test").isValidVariableName()); + VERIFY(!String("test").isNumeric()); + VERIFY(!String("test").isInteger()); + VERIFY(String("test").isValidVariableName()); + VERIFY(String("23").isNumeric()); + VERIFY(String("23").isInteger()); + VERIFY(String("23.3").isNumeric()); + VERIFY(!String("23.3").isInteger()); + } + + // operators + { + String s; + s = "test1"; VS((const char *)s, "test1"); + s = String("test2"); VS((const char *)s, "test2"); + s = Variant("test3"); VS((const char *)s, "test3"); + s = String("a") + "b"; VS((const char *)s, "ab"); + s = String("c") + String("d"); VS((const char *)s, "cd"); + s += "efg"; VS((const char *)s, "cdefg"); + s += String("hij"); VS((const char *)s, "cdefghij"); + + s = String("\x50\x51") | "\x51\x51"; VS((const char *)s, "\x51\x51"); + s = String("\x50\x51") & "\x51\x51"; VS((const char *)s, "\x50\x51"); + s = String("\x50\x51") ^ "\x51\x51"; VS((const char *)s, "\x01"); + s = "\x50\x51"; s |= "\x51\x51"; VS((const char *)s, "\x51\x51"); + s = "\x50\x51"; s &= "\x51\x51"; VS((const char *)s, "\x50\x51"); + s = "\x50\x51"; s ^= "\x51\x51"; VS((const char *)s, "\x01"); + s = "\x50\x51"; s = ~s; VS((const char *)s, "\xAF\xAE"); + } + + // manipulations + { + String s = StringUtil::ToLower("Test"); + VS((const char *)s, "test"); + } + + // conversions + { + VERIFY(!String().toBoolean()); + VERIFY(String("123").toBoolean()); + VERIFY(String("123").toByte() == 123); + VERIFY(String("32767").toInt16() == 32767); + VERIFY(String("1234567890").toInt32() == 1234567890); + VERIFY(String("123456789012345678").toInt64() == 123456789012345678LL); + VERIFY(String("123.45").toDouble() == 123.45); + } + + // offset + { + VS((const char *)String("test").rvalAt(2), "s"); + String s = "test"; + s.lvalAt(2) = ""; + VS((const char *)s, "tet"); + s.lvalAt(2) = "zz"; + VS((const char *)s, "tez"); + s.lvalAt(4) = "q"; + VS((const char *)s, "tez q"); + } + + return Count(true); +} + +bool TestCppBase::TestArray() { + // Array::Create(), ArrayElement constructors and informational + { + Array arr; + VERIFY(arr.empty()); VERIFY(arr.size() == 0); VERIFY(arr.length() == 0); + VERIFY(arr.isNull()); + + arr = Array::Create(); + VERIFY(arr.empty()); VERIFY(arr.size() == 0); VERIFY(arr.length() == 0); + VERIFY(!arr.isNull()); + + arr = Array::Create(0); + VERIFY(!arr.empty()); VERIFY(arr.size() == 1); VERIFY(arr.length() == 1); + VERIFY(!arr.isNull()); + VERIFY((int)arr[0] == 0); + VS(arr, Array(NEW(ArrayElement)(0), NULL)); + + arr = Array::Create("test"); + VERIFY(!arr.empty()); VERIFY(arr.size() == 1); VERIFY(arr.length() == 1); + VERIFY(!arr.isNull()); + VERIFY(arr[0] == "test"); + VS(arr, Array(NEW(ArrayElement)("test"), NULL)); + + Array arrCopy = arr; + arr = Array::Create(arr); + VERIFY(!arr.empty()); VERIFY(arr.size() == 1); VERIFY(arr.length() == 1); + VERIFY(!arr.isNull()); + VERIFY(arr[0].toArray().size() == 1); + VS(arr[0], arrCopy); + VS(arr, Array(NEW(ArrayElement)(arrCopy), NULL)); + + arr = Array::Create("name", 1); + VERIFY(!arr.empty()); VERIFY(arr.size() == 1); VERIFY(arr.length() == 1); + VERIFY(!arr.isNull()); + VERIFY((int)arr["name"] == 1); + VS(arr, Array(NEW(ArrayElement)("name", 1), NULL)); + + arr = Array::Create("name", "test"); + VERIFY(!arr.empty()); VERIFY(arr.size() == 1); VERIFY(arr.length() == 1); + VERIFY(!arr.isNull()); + VERIFY(arr["name"] == "test"); + VS(arr, Array(NEW(ArrayElement)("name", "test"), NULL)); + + arrCopy = arr; + arr = Array::Create("name", arr); + VERIFY(!arr.empty()); VERIFY(arr.size() == 1); VERIFY(arr.length() == 1); + VERIFY(!arr.isNull()); + VS(arr["name"], arrCopy); + VERIFY(arr["name"].toArray().size() == 1); + VS(arr, Array(NEW(ArrayElement)("name", arrCopy), NULL)); + } + + // iteration + { + Array arr = CREATE_MAP2("n1", "v1", "n2", "v2"); + int i = 0; + for (ArrayIter iter = arr.begin(); iter; ++iter, ++i) { + if (i == 0) { + VERIFY(iter.first() == "n1"); + VERIFY(iter.second() == "v1"); + } else { + VERIFY(iter.first() == "n2"); + VERIFY(iter.second() == "v2"); + } + } + VERIFY(i == 2); + } + { + Variant arr = CREATE_MAP1("n1", "v1"); + arr.escalate(); + Variant k, v; + for (MutableArrayIterPtr iter = arr.begin(&k, v); iter->advance();) { + arr.weakRemove(k); + } + VS(arr, Array::Create()); + } + /* TODO: fix this + { + Variant arr = CREATE_MAP2("n1", "v1", "n2", "v2"); + arr.escalate(); + for (ArrayIterPtr iter = arr.begin(arr, true); !iter->end(); iter->next()){ + unset(arr.lvalAt(iter->first())); + } + VS(arr, Array::Create()); + } + */ + + // conversions + { + Array arr0; + VERIFY(arr0.toBoolean() == false); + VERIFY(arr0.toByte() == 0); + VERIFY(arr0.toInt16() == 0); + VERIFY(arr0.toInt32() == 0); + VERIFY(arr0.toInt64() == 0); + VERIFY(arr0.toDouble() == 0.0); + VERIFY(arr0.toString() == ""); + + Array arr1 = Array::Create("test"); + VERIFY(arr1.toBoolean() == true); + VERIFY(arr1.toByte() == 1); + VERIFY(arr1.toInt16() == 1); + VERIFY(arr1.toInt32() == 1); + VERIFY(arr1.toInt64() == 1); + VERIFY(arr1.toDouble() == 1.0); + VERIFY(arr1.toString() == "Array"); + } + + // offset + { + Array arr; + arr.set(0, "v1"); + arr.set(1, "v2"); + VS(arr, CREATE_VECTOR2("v1", "v2")); + } + { + Array arr; + arr.set("n1", "v1"); + arr.set("n2", "v2"); + VS(arr, CREATE_MAP2("n1", "v1", "n2", "v2")); + } + { + Array arr; + arr.lvalAt(0) = "v1"; + arr.lvalAt(1) = "v2"; + VS(arr, CREATE_VECTOR2("v1", "v2")); + } + { + Array arr; + arr.lvalAt("n1") = "v1"; + arr.lvalAt("n2") = "v2"; + VS(arr, CREATE_MAP2("n1", "v1", "n2", "v2")); + } + { + Array arr; + Variant name = "name"; + arr.lvalAt(name) = "value"; + VS(arr, CREATE_MAP1("name", "value")); + } + { + Array arr; + arr.lvalAt("A") = 10; + arr.lvalAt("A")++; + VS(arr["A"], 11); + } + { + Array arr; + arr.lvalAt(1) = 10; + VS(arr[1], 10); + VS(arr[1.5], 10); + VS(arr[Variant(1.5)], 10); + VS(arr["1"], 10); + VS(arr[Variant("1")], 10); + } + { + Array arr; + arr.lvalAt(Variant(1.5)) = 10; + VS(arr[1], 10); + VS(arr[1.5], 10); + VS(arr[Variant(1.5)], 10); + VS(arr["1"], 10); + VS(arr[Variant("1")], 10); + } + { + Array arr; + arr.lvalAt("1") = 10; + VS(arr[1], 10); + VS(arr[1.5], 10); + VS(arr[Variant(1.5)], 10); + VS(arr["1"], 10); + VS(arr[Variant("1")], 10); + } + { + Array arr; + arr.lvalAt(Variant("1")) = 10; + VS(arr[1], 10); + VS(arr[1.5], 10); + VS(arr[Variant(1.5)], 10); + VS(arr["1"], 10); + VS(arr[Variant("1")], 10); + } + + // membership + { + Array arr; + arr.lvalAt(0) = "v1"; + arr.lvalAt(1) = "v2"; + VERIFY(arr.exists(0)); + arr.remove(0); + VERIFY(!arr.exists(0)); + VS(arr, Array::Create(1, "v2")); + arr.append("v3"); + VS(arr, CREATE_MAP2(1, "v2", 2, "v3")); + } + { + Array arr; + arr.lvalAt(0) = "v1"; + VERIFY(arr.exists(0)); + arr.remove("0"); + VERIFY(!arr.exists(0)); + } + { + Array arr; + arr.lvalAt(0) = "v1"; + VERIFY(arr.exists(0)); + arr.remove(Variant("0")); + VERIFY(!arr.exists(0)); + } + { + Array arr; + arr.lvalAt(0) = "v1"; + VERIFY(arr.exists(0)); + arr.remove(Variant(Variant("0"))); + VERIFY(!arr.exists(0)); + } + { + Array arr; + arr.lvalAt(0) = "v1"; + VERIFY(arr.exists(0)); + arr.remove(Variant(Variant(0.5))); + VERIFY(!arr.exists(0)); + } + { + Array arr; + arr.lvalAt(Variant()) = 123; + VERIFY(arr.exists("")); + arr.remove(Variant()); + VERIFY(!arr.exists("")); + } + { + Array arr; + arr.lvalAt("n1") = "v1"; + arr.lvalAt("n2") = "v2"; + VERIFY(arr.exists("n1")); + arr.remove("n1"); + VERIFY(!arr.exists("n1")); + VS(arr, Array::Create("n2", "v2")); + arr.append("v3"); + VS(arr, CREATE_MAP2("n2", "v2", 0, "v3")); + } + { + Array arr; + arr.lvalAt() = "test"; + VS(arr, CREATE_VECTOR1("test")); + } + { + Array arr; + arr.lvalAt("name") = "value"; + VERIFY(arr.exists("name")); + } + { + Array arr; + arr.lvalAt(1) = "value"; + VERIFY(arr.exists(1)); + VERIFY(arr.exists(1.5)); + VERIFY(arr.exists("1")); + VERIFY(arr.exists(Variant("1"))); + VERIFY(arr.exists(Variant(1))); + VERIFY(arr.exists(Variant(1.5))); + } + { + Array arr; + arr.lvalAt("1") = "value"; + VERIFY(arr.exists(1)); + VERIFY(arr.exists(1.5)); + VERIFY(arr.exists("1")); + VERIFY(arr.exists(Variant("1"))); + VERIFY(arr.exists(Variant(1))); + VERIFY(arr.exists(Variant(1.5))); + } + { + Array arr; + arr.lvalAt(1.5) = "value"; + VERIFY(arr.exists(1)); + VERIFY(arr.exists(1.5)); + VERIFY(arr.exists("1")); + VERIFY(arr.exists(Variant("1"))); + VERIFY(arr.exists(Variant(1))); + VERIFY(arr.exists(Variant(1.5))); + } + { + Array arr; + arr.lvalAt(Variant(1.5)) = "value"; + VERIFY(arr.exists(1)); + VERIFY(arr.exists(1.5)); + VERIFY(arr.exists("1")); + VERIFY(arr.exists(Variant("1"))); + VERIFY(arr.exists(Variant(1))); + VERIFY(arr.exists(Variant(1.5))); + } + { + Array arr; + arr.lvalAt(Variant("1")) = "value"; + VERIFY(arr.exists(1)); + VERIFY(arr.exists(1.5)); + VERIFY(arr.exists("1")); + VERIFY(arr.exists(Variant("1"))); + VERIFY(arr.exists(Variant(1))); + VERIFY(arr.exists(Variant(1.5))); + } + + // merge + { + Array arr = Array::Create(0) + Array::Create(1); + VS(arr, Array::Create(0)); + arr += CREATE_VECTOR2(0, 1); + VS(arr, CREATE_VECTOR2(0, 1)); + + arr = Array::Create(0).merge(Array::Create(1)); + VS(arr, CREATE_VECTOR2(0, 1)); + arr = arr.merge(CREATE_VECTOR2(0, 1)); + VS(arr, CREATE_VECTOR4(0, 1, 0, 1)); + + arr = Array::Create("s0").merge(Array::Create("s1")); + VS(arr, CREATE_VECTOR2("s0", "s1")); + + arr = Array::Create("n0", "s0") + Array::Create("n1", "s1"); + VS(arr, CREATE_MAP2("n0", "s0", "n1", "s1")); + arr += CREATE_MAP2("n0", "s0", "n1", "s1"); + VS(arr, CREATE_MAP2("n0", "s0", "n1", "s1")); + + arr = Array::Create("n0", "s0").merge(Array::Create("n1", "s1")); + VS(arr, CREATE_MAP2("n0", "s0", "n1", "s1")); + Array arrX = CREATE_MAP2("n0", "s2", "n1", "s3"); + arr = arr.merge(arrX); + VS(arr, CREATE_MAP2("n0", "s2", "n1", "s3")); + } + + // slice + { + Array arr = CREATE_VECTOR2("test1", "test2"); + Array sub = arr.slice(1, 1, true); + VS(sub, CREATE_MAP1(1, "test2")); + } + { + Array arr = CREATE_VECTOR2("test1", "test2"); + Array sub = arr.slice(1, 1, false); + VS(sub, CREATE_VECTOR1("test2")); + } + { + Array arr = CREATE_MAP2("n1", "test1", "n2", "test2"); + Array sub = arr.slice(1, 1, true); + VS(sub, CREATE_MAP1("n2", "test2")); + } + { + Array arr = CREATE_MAP2("n1", "test1", "n2", "test2"); + Array sub = arr.slice(1, 1, false); + VS(sub, CREATE_MAP1("n2", "test2")); + } + + // escalation + { + Array arr; + lval(arr.lvalAt(0)).lvalAt(0) = 1.2; + VS(arr, CREATE_VECTOR1(CREATE_VECTOR1(1.2))); + } + { + Array arr; + lval(arr.lvalAt("name")).lvalAt(0) = 1.2; + VS(arr, CREATE_MAP1("name", CREATE_VECTOR1(1.2))); + } + { + Array arr = Array::Create(); + lval(arr.lvalAt(0)).lvalAt(0) = 1.2; + VS(arr, CREATE_VECTOR1(CREATE_VECTOR1(1.2))); + } + { + Array arr = Array::Create(); + lval(arr.lvalAt("name")).lvalAt(0) = 1.2; + VS(arr, CREATE_MAP1("name", CREATE_VECTOR1(1.2))); + } + { + Array arr = Array::Create("test"); + arr.lvalAt(0) = CREATE_VECTOR1(1.2); + VS(arr, CREATE_VECTOR1(CREATE_VECTOR1(1.2))); + } + { + Array arr = Array::Create("test"); + lval(arr.lvalAt("name")).lvalAt(0) = 1.2; + VS(arr, CREATE_MAP2(0, "test", "name", CREATE_VECTOR1(1.2))); + } + { + Array arr = Array::Create(); + arr.append("apple"); + arr.set(2, "pear"); + VS(arr[2], "pear"); + } + + { + Array arr = CREATE_MAP2(0, "a", 1, "b"); + VERIFY(arr->isVectorData()); + } + { + Array arr = CREATE_MAP2(1, "a", 0, "b"); + VERIFY(!arr->isVectorData()); + } + { + Array arr = CREATE_MAP2(1, "a", 2, "b"); + VERIFY(!arr->isVectorData()); + } + { + Array arr = CREATE_MAP1(1, "a"); + arr.set(0, "b"); + VERIFY(!arr->isVectorData()); + } + + return Count(true); +} + +bool TestCppBase::TestObject() { + { + String s = "O:1:\"B\":1:{s:3:\"obj\";O:1:\"A\":1:{s:1:\"a\";i:10;}}"; + VS(f_serialize(f_unserialize(s)), "O:22:\"__PHP_Incomplete_Class\":2:{s:27:\"__PHP_Incomplete_Class_Name\";s:1:\"B\";s:3:\"obj\";O:22:\"__PHP_Incomplete_Class\":2:{s:27:\"__PHP_Incomplete_Class_Name\";s:1:\"A\";s:1:\"a\";i:10;}}"); + } + return Count(true); +} + +bool TestCppBase::TestVariant() { + // operators + { + Variant v(15); + v += 20; + VERIFY(v.isNumeric()); + VERIFY(v.is(KindOfInt64)); + VERIFY(v == Variant(35)); + } + + // conversions + { + Variant v("123"); + VERIFY(v.toInt32() == 123); + } + + // offset + { + Variant v = "test"; + VS(v.rvalAt(0), "t"); + } + { + Variant v; + v.lvalAt(0) = "v0"; + v.lvalAt(1) = "v1"; + VERIFY(v[0] == "v0"); + VERIFY(v[1] == "v1"); + } + { + Variant v; + v.lvalAt() = "test"; + VS(v, CREATE_VECTOR1("test")); + } + { + Variant v; + v.lvalAt(1) = "test"; + VS(v[1], "test"); + VS(v[1.5], "test"); + VS(v[Variant(1.5)], "test"); + VS(v["1"], "test"); + VS(v[Variant("1")], "test"); + } + { + Variant v; + v.lvalAt(Variant(1.5)) = "test"; + VS(v[1], "test"); + VS(v[1.5], "test"); + VS(v[Variant(1.5)], "test"); + VS(v["1"], "test"); + VS(v[Variant("1")], "test"); + } + { + Variant v; + v.lvalAt("1") = "test"; + VS(v[1], "test"); + VS(v[1.5], "test"); + VS(v[Variant(1.5)], "test"); + VS(v["1"], "test"); + VS(v[Variant("1")], "test"); + } + { + Variant v; + v.lvalAt(Variant("1")) = "test"; + VS(v[1], "test"); + VS(v[1.5], "test"); + VS(v[Variant(1.5)], "test"); + VS(v["1"], "test"); + VS(v[Variant("1")], "test"); + } + + // membership + { + Variant v; + v.lvalAt("n0") = "v0"; + v.lvalAt("n1") = "v1"; + v.remove("n1"); + VS(v, CREATE_MAP1("n0", "v0")); + v.append("v2"); + VS(v, CREATE_MAP2("n0", "v0", 0, "v2")); + } + { + Variant v; + v.lvalAt("n0") = "v0"; + v.lvalAt(1) = "v1"; + v.remove(Variant(1.5)); + VS(v, CREATE_MAP1("n0", "v0")); + } + { + Variant v; + v.lvalAt("n0") = "v0"; + v.lvalAt(1) = "v1"; + v.remove(Variant("1")); + VS(v, CREATE_MAP1("n0", "v0")); + } + { + Variant v; + v.lvalAt("n0") = "v0"; + v.lvalAt(1) = "v1"; + v.remove("1"); + VS(v, CREATE_MAP1("n0", "v0")); + } + { + Variant v; + v.lvalAt("n0") = "v0"; + v.lvalAt("") = "v1"; + v.remove(Variant()); + VS(v, CREATE_MAP1("n0", "v0")); + } + + // references + { + Variant v1("original"); + Variant v2 = v1; + v2 = "changed"; + VERIFY(v1 == "original"); + } + { + Variant v1("original"); + Variant v2 = ref(v1); + v2 = "changed"; + VERIFY(v1 == "changed"); + } + { + Variant v1 = 10; + Variant v2 = Array(NEW(ArrayElement)(ref(v1)), NULL); + v1 = 20; + VS(v2[0], 20); + } + { + Variant v1 = 10; + Variant v2; + v2.lvalAt() = ref(v1); + v1 = 20; + VS(v2[0], 20); + } + { + Variant v1 = 10; + Variant v2 = CREATE_VECTOR1(5); + v2.lvalAt() = ref(v1); + v1 = 20; + VS(v2[1], 20); + } + { + Variant v1 = 10; + Variant v2 = ref(v1); + v2++; + VS(v2, 11); + VS(v1, 11); + } + { + Variant arr = CREATE_VECTOR2(1, 2); + arr.escalate(); + Variant v; + for (MutableArrayIterPtr iter = arr.begin(NULL, v); iter->advance();) { + v++; + } + VS(arr, CREATE_VECTOR2(2, 3)); + } + + // array escalation + { + Variant arr; + lval(arr.lvalAt(0)).lvalAt(0) = 1.2; + VS(arr, CREATE_VECTOR1(CREATE_VECTOR1(1.2))); + } + { + Variant arr; + lval(arr.lvalAt("name")).lvalAt(0) = 1.2; + VS(arr, CREATE_MAP1("name", CREATE_VECTOR1(1.2))); + } + { + Variant arr = Array::Create(); + lval(arr.lvalAt(0)).lvalAt(0) = 1.2; + VS(arr, CREATE_VECTOR1(CREATE_VECTOR1(1.2))); + } + { + Variant arr = Array::Create(); + lval(arr.lvalAt("name")).lvalAt(0) = 1.2; + VS(arr, CREATE_MAP1("name", CREATE_VECTOR1(1.2))); + } + { + Variant arr = Array::Create("test"); + arr.lvalAt(0) = CREATE_VECTOR1(1.2); + VS(arr, CREATE_VECTOR1(CREATE_VECTOR1(1.2))); + } + { + Variant arr = Array::Create("test"); + lval(arr.lvalAt("name")).lvalAt(0) = 1.2; + VS(arr, CREATE_MAP2(0, "test", "name", CREATE_VECTOR1(1.2))); + } + + return Count(true); +} + +bool TestCppBase::TestListAssignment() { + Array arr = CREATE_VECTOR3("coffee", "brown", "caffeine"); + Variant v; + list_assign(arr, + new ListAssignmentElement(lval(v.lvalAt(1)), 1, -1), + new ListAssignmentElement(lval(v.lvalAt(2)), 2, -1), + (ListAssignmentElement*)NULL); + VS(v, CREATE_MAP2(2, "caffeine", 1, "brown")); + + return Count(true); +} + +/////////////////////////////////////////////////////////////////////////////// + +class TestGlobals { +public: + TestGlobals() { + String a = "apple"; + m_string = a + "orange"; // so mallocing m_data internally + + m_array = CREATE_MAP2("a", "apple", "b", "orange"); + } + + Variant m_string; + Array m_array; + Variant m_string2; + Array m_array2; + Variant m_conn; + Variant m_curlconn; + Variant m_curlMultiConn; + + DECLARE_SMART_ALLOCATION_NOCALLBACKS(TestGlobals); + void dump() {} +}; +IMPLEMENT_SMART_ALLOCATION_NOCALLBACKS(TestGlobals); + +bool TestCppBase::TestMemoryManager() { + s_apc_store.reset(); + RuntimeOption::ApcUseSharedMemory = false; + MemoryManager::TheMemoryManager()->enable(); + + TestGlobals *globals = NEW(TestGlobals)(); + f_apc_store("key", CREATE_VECTOR2("value", "s")); + f_apc_store("key2", "apple"); + globals->m_array2 = f_apc_fetch("key"); + globals->m_string2 = f_apc_fetch("key2"); + globals->m_conn = f_mysql_connect(TEST_HOSTNAME, TEST_DATABASE, + TEST_PASSWORD, false, 0); + MemoryManager::TheMemoryManager()->checkpoint(); + globals->m_curlconn = f_curl_init("http://localhost:8080/request"); + f_curl_setopt(globals->m_curlconn, CURLOPT_WRITEFUNCTION, + String("foo", CopyString)); + globals->m_curlMultiConn = f_curl_multi_init(); + Variant c1 = f_curl_init("http://localhost:8080/request"); + Variant c2 = f_curl_init("http://localhost:8080/request"); + f_curl_multi_add_handle(globals->m_curlMultiConn, c1); + f_curl_multi_add_handle(globals->m_curlMultiConn, c2); + globals->m_conn = null; + + // we do it twice, so to verify MemoryManager's rollback() is valid + // we do it 3rd time, so to verify LinearAllocator works under rollback. + // we do it 4th time, so to verify MySQL connection works under rollback. + for (int i = 0; i < 4; i++) { + + // Circular reference between two arrays. Without sweeping, these memory + // will still be reachable after exit. + { + Variant arr = Array::Create(); + arr.append(arr); + } + { + Variant arr = Array::Create(); + arr.append(ref(arr)); + } + { + Variant arr1 = Array::Create(); + Variant arr2 = Array::Create(); + arr1.append(ref(arr2)); + arr2.append(ref(arr1)); + } + + // Circular reference between two objects. + { + Object obj(NEW(c_stdclass)()); + obj->o_set("a", -1, obj); + obj->o_set("f", -1, Object(NEW(PlainFile)())); + } + { + Object obj1(NEW(c_stdclass)()); + Object obj2(NEW(c_stdclass)()); + obj1->o_set("a", -1, obj2); + obj2->o_set("a", -1, obj1); + obj1->o_set("f", -1, Object(NEW(PlainFile)())); + } + + // dangling APC variables inside circular arrays + { + Variant arr1 = Array::Create(); + Variant arr2 = Array::Create(); + arr1.append(ref(arr2)); + arr2.append(ref(arr1)); + f_apc_store("name", CREATE_VECTOR2("value", "s")); + Variant v = f_apc_fetch("name"); + arr1.append(v); + f_apc_delete("name"); + } + + globals->m_string++; // mutating m_data internally + VS(globals->m_string, "appleorangf"); + + globals->m_array.set("a", "pear"); + globals->m_array.set("c", "banana"); + VS(globals->m_array["a"], "pear"); + VS(globals->m_array["c"], "banana"); + + globals->m_conn = null; + MemoryManager::TheMemoryManager()->rollback(); + VS(globals->m_array2["0"], "value"); + VS(globals->m_array2["1"], "s"); + VS(globals->m_string2, "apple"); + Logger::Verbose("%s", SharedStores::ReportStats(0).c_str()); + + VS(globals->m_string, "appleorange"); + + VS(globals->m_array["a"], "apple"); + VERIFY(!globals->m_array.exists("c")); + + } + DELETE(TestGlobals)(globals); + return Count(true); +} diff --git a/src/test/test_cpp_base.h b/src/test/test_cpp_base.h new file mode 100644 index 0000000000000..b3a5694f04d6c --- /dev/null +++ b/src/test/test_cpp_base.h @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_CPP_BASE_H__ +#define __TEST_CPP_BASE_H__ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Testing CPP core library coding. Main goal of this set of unit tests is to + * make sure cpp/base library has no memory problems while doing the right + * things. TestCppRun is good at making sure semantically correctness of these + * classes, but it's hard to run it under valgrind. This set of unit tests, + * in fact including all extension tests, are written in C++ code directly + * calling library functions, therefore we can easily run it under valgrind + * and other tools to detect any coding problems. + */ +class TestCppBase : public TestBase { + public: + TestCppBase(); + + virtual bool RunTests(const std::string &which); + + // building blocks + bool TestSmartAllocator(); + bool TestMemoryManager(); + + /** + * Date types. This in turn tests StringData, ArrayData, StringOffset, + * ArrayOffset, VariantOffset, ArrayIter, ArrayElement and other classes. + * + * Some of the classes are not tested here, including Object/ObjectData/ + * SmartObject. They are a lot more covered in TestCodeRun with better + * checking against PHP execution. + * + * Comparisons are not directly tested here, either, becuase TestCodeRun has + * a thorough list of comparisons and it's better to directly compare with + * PHP's results. + */ + bool TestString(); + bool TestArray(); + bool TestObject(); + bool TestVariant(); + bool TestListAssignment(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_CPP_BASE_H__ diff --git a/src/test/test_cpp_ext.cpp b/src/test/test_cpp_ext.cpp new file mode 100644 index 0000000000000..c69d48ffac354 --- /dev/null +++ b/src/test/test_cpp_ext.cpp @@ -0,0 +1,22 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +TestCppExt::TestCppExt() { +} diff --git a/src/test/test_cpp_ext.h b/src/test/test_cpp_ext.h new file mode 100644 index 0000000000000..18c5f4382c83e --- /dev/null +++ b/src/test/test_cpp_ext.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_CPP_EXT_H__ +#define __TEST_CPP_EXT_H__ + +#include +#include // we frequently need to call f_var_dump() + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Testing CPP extension library coding. + */ +class TestCppExt : public TestCppBase { +public: + TestCppExt(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_CPP_EXT_H__ diff --git a/src/test/test_depend_graph.cpp b/src/test/test_depend_graph.cpp new file mode 100644 index 0000000000000..2a124ffdff9f7 --- /dev/null +++ b/src/test/test_depend_graph.cpp @@ -0,0 +1,187 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +bool TestDependGraph::RunTests(const std::string &which) { + bool ret = true; +#define DEPENDENCY_ENTRY(x) RUN_TEST(Test ## x); +#include "../lib/analysis/core_dependency.inc" +#undef DEPENDENCY_ENTRY + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestDependGraph::VerifyDependency(DependencyGraph::KindOf kindOf, + const char *input1, + const char *input2 /* = NULL */, + const char *parent /* = "f2" */, + const char *child /* = "f1" */, + const char *file /* = "" */, + int line /* = 0 */) { + ASSERT(input1); + + Option::IncludeRoots["$_SERVER['PHP_ROOT']"] = ""; + AnalysisResultPtr ar(new AnalysisResult()); + BuiltinSymbols::load(ar); + Parser::parseString(input1, ar, "f1"); + if (input2) Parser::parseString(input2, ar, "f2"); + ar->analyzeProgram(); + ar->inferTypes(); + DependencyGraphPtr dg = ar->getDependencyGraph(); + const StringToConstructPtrMap &children = dg->getAllChildren(kindOf, parent); + if ((*child && children.find(child) == children.end()) || + (!*child && !children.empty())) { + ostringstream graph; + JSON::OutputStream(graph) << ar->getDependencyGraph(); + printf("%s:%d: dependency missing\n%s\n", file, line, + graph.str().c_str()); + return false; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestDependGraph::TestPHPInclude() { + VD2(PHPInclude, "test();}", + "test()"); + VD4(FunctionCall, + "test();} " + "class C { public function test() {}}", + "", "c::test", "$a->test()"); + VD4(FunctionCall, + "test();}", + "", "c::test", "$a->test()"); + +#ifdef HPHP_NOTE + // making sure a "MasterCopy" marked function will always be used for + // dependency's parent + { + Option::IncludeRoots["$_SERVER['PHP_ROOT']"] = ""; + AnalysisResultPtr ar(new AnalysisResult()); + BuiltinSymbols::load(ar); + Parser::parseString("analyzeProgram(); + ar->inferTypes(); + DependencyGraphPtr dg = ar->getDependencyGraph(); + ConstructPtr parent = dg->getParent(DependencyGraph::KindOfFunctionCall, + "test"); + if (!parent || strcmp(parent->getLocation()->file, "f2") != 0) { + printf("%s:%d: incorrect parent found at %s:%d\n", __FILE__, __LINE__, + parent ? parent->getLocation()->file : "", + parent ? parent->getLocation()->line0 : 0); + return false; + } + } +#endif + + return true; +} + +bool TestDependGraph::TestGlobalVariable() { + VD4(GlobalVariable, + "$GLOBALS['a'] = 2;}", + "", "a", "a"); + VD4(GlobalVariable, + "GLOBALS['a'] = 2;}", + "", "a", ""); + return true; +} + +bool TestDependGraph::TestConstant() { + // global constants + VD4(Constant, + " +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestDependGraph : public TestBase { + public: + virtual bool RunTests(const std::string &which); + +#define DEPENDENCY_ENTRY(x) bool Test ## x(); +#include "../lib/analysis/core_dependency.inc" +#undef DEPENDENCY_ENTRY + + private: + bool VerifyDependency(HPHP::DependencyGraph::KindOf kindOf, + const char *input1, const char *input2 = NULL, + const char *parent = "f2", + const char *child = "f1", + const char *file = "", + int line = 0); +}; + +/////////////////////////////////////////////////////////////////////////////// +// macros + +#define VD1(k,a) \ + if (!Count(VerifyDependency(DependencyGraph::KindOf ## k, a, NULL, \ + "f2", "f1", __FILE__, __LINE__))) \ + return false; \ + +#define VD2(k,a,b) \ + if (!Count(VerifyDependency(DependencyGraph::KindOf ## k, a, b, \ + "f2", "f1", __FILE__, __LINE__))) \ + return false; \ + +#define VD4(k,a,b,p,c) \ + if (!Count(VerifyDependency(DependencyGraph::KindOf ## k, a, b, \ + p, c, __FILE__, __LINE__))) \ + return false; \ + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_DEPEND_GRAPH_H__ diff --git a/src/test/test_ext.h b/src/test/test_ext.h new file mode 100644 index 0000000000000..d7b5e709006af --- /dev/null +++ b/src/test/test_ext.h @@ -0,0 +1,72 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +/* Generated by idl_list.php. Do NOT modify. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/src/test/test_ext.inc b/src/test/test_ext.inc new file mode 100644 index 0000000000000..4581c890e1bca --- /dev/null +++ b/src/test/test_ext.inc @@ -0,0 +1,57 @@ + +/* Generated by idl_list.php. Do NOT modify. */ + +RUN_TESTSUITE(TestExtApache); +RUN_TESTSUITE(TestExtApc); +RUN_TESTSUITE(TestExtApd); +RUN_TESTSUITE(TestExtArray); +RUN_TESTSUITE(TestExtBcmath); +RUN_TESTSUITE(TestExtClass); +RUN_TESTSUITE(TestExtCtype); +RUN_TESTSUITE(TestExtCurl); +RUN_TESTSUITE(TestExtDatetime); +RUN_TESTSUITE(TestExtDomdocument); +RUN_TESTSUITE(TestExtError); +RUN_TESTSUITE(TestExtFacebook); +RUN_TESTSUITE(TestExtFbml); +RUN_TESTSUITE(TestExtFile); +RUN_TESTSUITE(TestExtFunction); +RUN_TESTSUITE(TestExtHash); +RUN_TESTSUITE(TestExtIconv); +RUN_TESTSUITE(TestExtIcu); +RUN_TESTSUITE(TestExtIdn); +RUN_TESTSUITE(TestExtImage); +RUN_TESTSUITE(TestExtIpc); +RUN_TESTSUITE(TestExtJson); +RUN_TESTSUITE(TestExtLdap); +RUN_TESTSUITE(TestExtMagick); +RUN_TESTSUITE(TestExtMailparse); +RUN_TESTSUITE(TestExtMath); +RUN_TESTSUITE(TestExtMb); +RUN_TESTSUITE(TestExtMcrypt); +RUN_TESTSUITE(TestExtMisc); +RUN_TESTSUITE(TestExtMysql); +RUN_TESTSUITE(TestExtNetwork); +RUN_TESTSUITE(TestExtOpenssl); +RUN_TESTSUITE(TestExtOptions); +RUN_TESTSUITE(TestExtOracle); +RUN_TESTSUITE(TestExtOutput); +RUN_TESTSUITE(TestExtPhp_mcc); +RUN_TESTSUITE(TestExtPosix); +RUN_TESTSUITE(TestExtPreg); +RUN_TESTSUITE(TestExtProcess); +RUN_TESTSUITE(TestExtReflection); +RUN_TESTSUITE(TestExtServer); +RUN_TESTSUITE(TestExtSimplexml); +RUN_TESTSUITE(TestExtSoap); +RUN_TESTSUITE(TestExtSocket); +RUN_TESTSUITE(TestExtSqlite3); +RUN_TESTSUITE(TestExtStream); +RUN_TESTSUITE(TestExtString); +RUN_TESTSUITE(TestExtThread); +RUN_TESTSUITE(TestExtThrift); +RUN_TESTSUITE(TestExtUrl); +RUN_TESTSUITE(TestExtVariable); +RUN_TESTSUITE(TestExtXml); +RUN_TESTSUITE(TestExtXmlwriter); +RUN_TESTSUITE(TestExtZlib); diff --git a/src/test/test_ext_apache.cpp b/src/test/test_ext_apache.cpp new file mode 100644 index 0000000000000..76c40edca949b --- /dev/null +++ b/src/test/test_ext_apache.cpp @@ -0,0 +1,185 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtApache::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_apache_child_terminate); + RUN_TEST(test_apache_get_modules); + RUN_TEST(test_apache_get_version); + RUN_TEST(test_apache_getenv); + RUN_TEST(test_apache_lookup_uri); + RUN_TEST(test_apache_note); + RUN_TEST(test_apache_request_headers); + RUN_TEST(test_apache_reset_timeout); + RUN_TEST(test_apache_response_headers); + RUN_TEST(test_apache_setenv); + RUN_TEST(test_ascii2ebcdic); + RUN_TEST(test_ebcdic2ascii); + RUN_TEST(test_getallheaders); + RUN_TEST(test_virtual); + RUN_TEST(test_apache_get_config); + RUN_TEST(test_apache_get_scoreboard); + RUN_TEST(test_apache_get_rewrite_rules); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtApache::test_apache_child_terminate() { + try { + f_apache_child_terminate(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_apache_get_modules() { + try { + f_apache_get_modules(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_apache_get_version() { + try { + f_apache_get_version(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_apache_getenv() { + try { + f_apache_getenv(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_apache_lookup_uri() { + try { + f_apache_lookup_uri(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_apache_note() { + f_apache_note("blarb", "foo"); + VS(f_apache_note("blarb", "smurf"), "foo"); + VS(f_apache_note("blarb"), "smurf"); + return Count(true); +} + +bool TestExtApache::test_apache_request_headers() { + try { + f_apache_request_headers(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_apache_reset_timeout() { + try { + f_apache_reset_timeout(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_apache_response_headers() { + try { + f_apache_response_headers(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_apache_setenv() { + f_apache_setenv("", ""); + return Count(true); +} + +bool TestExtApache::test_ascii2ebcdic() { + try { + f_ascii2ebcdic(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_ebcdic2ascii() { + try { + f_ebcdic2ascii(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_getallheaders() { + try { + f_getallheaders(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_virtual() { + try { + f_virtual(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApache::test_apache_get_config() { + f_apache_get_config(); + return Count(true); +} + +bool TestExtApache::test_apache_get_scoreboard() { + f_apache_get_scoreboard(); + return Count(true); +} + +bool TestExtApache::test_apache_get_rewrite_rules() { + try { + f_apache_get_rewrite_rules(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} diff --git a/src/test/test_ext_apache.h b/src/test/test_ext_apache.h new file mode 100644 index 0000000000000..3e269ac6dcc0f --- /dev/null +++ b/src/test/test_ext_apache.h @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_APACHE_H__ +#define __TEST_EXT_APACHE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtApache : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_apache_child_terminate(); + bool test_apache_get_modules(); + bool test_apache_get_version(); + bool test_apache_getenv(); + bool test_apache_lookup_uri(); + bool test_apache_note(); + bool test_apache_request_headers(); + bool test_apache_reset_timeout(); + bool test_apache_response_headers(); + bool test_apache_setenv(); + bool test_ascii2ebcdic(); + bool test_ebcdic2ascii(); + bool test_getallheaders(); + bool test_virtual(); + bool test_apache_get_config(); + bool test_apache_get_scoreboard(); + bool test_apache_get_rewrite_rules(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_APACHE_H__ diff --git a/src/test/test_ext_apc.cpp b/src/test/test_ext_apc.cpp new file mode 100644 index 0000000000000..f9f11b15ba45c --- /dev/null +++ b/src/test/test_ext_apc.cpp @@ -0,0 +1,402 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +namespace HPHP { + extern SharedStores s_apc_store; +} + +bool TestExtApc::RunTests(const std::string &which) { + bool ret = true; + + RuntimeOption::ApcUseSharedMemory = true; + s_apc_store.reset(); + printf("Shared memory version:\n"); + RUN_TEST(test_apc_add); + RUN_TEST(test_apc_store); + RUN_TEST(test_apc_fetch); + RUN_TEST(test_apc_delete); + RUN_TEST(test_apc_compile_file); + RUN_TEST(test_apc_cache_info); + RUN_TEST(test_apc_clear_cache); + RUN_TEST(test_apc_define_constants); + RUN_TEST(test_apc_load_constants); + RUN_TEST(test_apc_sma_info); + RUN_TEST(test_apc_filehits); + RUN_TEST(test_apc_delete_file); + RUN_TEST(test_apc_inc); + RUN_TEST(test_apc_dec); + RUN_TEST(test_apc_cas); + RUN_TEST(test_apc_bin_dump); + RUN_TEST(test_apc_bin_load); + RUN_TEST(test_apc_bin_dumpfile); + RUN_TEST(test_apc_bin_loadfile); + + RuntimeOption::ApcUseSharedMemory = false; + RuntimeOption::ApcTableType = RuntimeOption::ApcHashTable; + s_apc_store.reset(); + printf("\nNon shared-memory version:\n"); + RUN_TEST(test_apc_add); + RUN_TEST(test_apc_store); + RUN_TEST(test_apc_fetch); + RUN_TEST(test_apc_delete); + RUN_TEST(test_apc_compile_file); + RUN_TEST(test_apc_cache_info); + RUN_TEST(test_apc_clear_cache); + RUN_TEST(test_apc_define_constants); + RUN_TEST(test_apc_load_constants); + RUN_TEST(test_apc_sma_info); + RUN_TEST(test_apc_filehits); + RUN_TEST(test_apc_delete_file); + RUN_TEST(test_apc_inc); + RUN_TEST(test_apc_dec); + RUN_TEST(test_apc_cas); + RUN_TEST(test_apc_bin_dump); + RUN_TEST(test_apc_bin_load); + RUN_TEST(test_apc_bin_dumpfile); + RUN_TEST(test_apc_bin_loadfile); + + RuntimeOption::ApcTableType = RuntimeOption::ApcLfuTable; + s_apc_store.reset(); + printf("\nNon shared-memory version with LFU:\n"); + RUN_TEST(test_apc_add); + RUN_TEST(test_apc_store); + RUN_TEST(test_apc_fetch); + RUN_TEST(test_apc_delete); + RUN_TEST(test_apc_compile_file); + RUN_TEST(test_apc_cache_info); + RUN_TEST(test_apc_clear_cache); + RUN_TEST(test_apc_define_constants); + RUN_TEST(test_apc_load_constants); + RUN_TEST(test_apc_sma_info); + RUN_TEST(test_apc_filehits); + RUN_TEST(test_apc_delete_file); + RUN_TEST(test_apc_inc); + RUN_TEST(test_apc_dec); + RUN_TEST(test_apc_cas); + RUN_TEST(test_apc_bin_dump); + RUN_TEST(test_apc_bin_load); + RUN_TEST(test_apc_bin_dumpfile); + RUN_TEST(test_apc_bin_loadfile); + + RuntimeOption::ApcTableType = RuntimeOption::ApcConcurrentTable; + s_apc_store.reset(); + printf("\nNon shared-memory concurrent version:\n"); + RUN_TEST(test_apc_add); + RUN_TEST(test_apc_store); + RUN_TEST(test_apc_fetch); + RUN_TEST(test_apc_delete); + RUN_TEST(test_apc_compile_file); + RUN_TEST(test_apc_cache_info); + RUN_TEST(test_apc_clear_cache); + RUN_TEST(test_apc_define_constants); + RUN_TEST(test_apc_load_constants); + RUN_TEST(test_apc_sma_info); + RUN_TEST(test_apc_filehits); + RUN_TEST(test_apc_delete_file); + RUN_TEST(test_apc_inc); + RUN_TEST(test_apc_dec); + RUN_TEST(test_apc_cas); + RUN_TEST(test_apc_bin_dump); + RUN_TEST(test_apc_bin_load); + RUN_TEST(test_apc_bin_dumpfile); + RUN_TEST(test_apc_bin_loadfile); + + s_apc_store.clear(); + RuntimeOption::ApcTableType = RuntimeOption::ApcHashTable; + RuntimeOption::ApcUseLockedRefs = true; + s_apc_store.create(); + printf("\nNon shared-memory version with locked refs:\n"); + RUN_TEST(test_apc_add); + RUN_TEST(test_apc_store); + RUN_TEST(test_apc_fetch); + RUN_TEST(test_apc_delete); + RUN_TEST(test_apc_compile_file); + RUN_TEST(test_apc_cache_info); + RUN_TEST(test_apc_clear_cache); + RUN_TEST(test_apc_define_constants); + RUN_TEST(test_apc_load_constants); + RUN_TEST(test_apc_sma_info); + RUN_TEST(test_apc_filehits); + RUN_TEST(test_apc_delete_file); + RUN_TEST(test_apc_inc); + RUN_TEST(test_apc_dec); + RUN_TEST(test_apc_cas); + RUN_TEST(test_apc_bin_dump); + RUN_TEST(test_apc_bin_load); + RUN_TEST(test_apc_bin_dumpfile); + RUN_TEST(test_apc_bin_loadfile); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtApc::test_apc_add() { + f_apc_add("ts", "TestString"); + f_apc_add("ta", CREATE_MAP2("a", 1, "b", 2)); + f_apc_add("ts", "NewValue"); + f_apc_add("ta", CREATE_VECTOR1("newelement")); + VS(f_apc_fetch("ts"), "TestString"); + VS(f_apc_fetch("ta"), CREATE_MAP2("a", 1, "b", 2)); + + VS(f_apc_fetch("ts"), "TestString"); + VS(f_apc_fetch("ta"), CREATE_MAP2("a", 1, "b", 2)); + + f_apc_add("texp", "TestString", 1); + sleep(1); + VS(f_apc_fetch("texp"), false); + + Variant ret = f_apc_store("foo", false); + VS(ret, true); + ret = f_apc_add("foo", false); + VS(ret, false); + Variant success; + ret = f_apc_fetch("foo", ref(success)); + VS(ret, false); + VS(success, true); + ret = f_apc_fetch("bar", ref(success)); + VS(ret, false); + VS(success, false); + Variant map1= CREATE_MAP1("foo", false); + ret = f_apc_fetch(CREATE_VECTOR1("foo"), ref(success)); + VS(ret, map1); + ret = f_apc_fetch(CREATE_VECTOR1("bar"), ref(success)); + VS(ret, Array::Create()); + VS(success, false); + ret = f_apc_fetch(CREATE_VECTOR2("foo", "bar"), ref(success)); + VS(ret, map1); + VS(success, true); + ret = f_apc_fetch(CREATE_VECTOR4("foo", "bar", "foo", "bar"), ref(success)); + VS(ret, map1); + VS(success, true); + return Count(true); +} + +bool TestExtApc::test_apc_store() { + Array complexMap = CREATE_MAP2("a", + CREATE_MAP2("b", 1, "c", + CREATE_VECTOR2("d", "e")), + "f", CREATE_VECTOR3(1,2,3)); + f_apc_store("complexMap", complexMap); + f_apc_store("ts", "TestString"); + f_apc_store("ta", CREATE_MAP2("a", 1, "b", 2)); + f_apc_store("ts", "NewValue"); + f_apc_store("ta", CREATE_VECTOR1("newelement")); + VS(f_apc_fetch("ts"), "NewValue"); + VS(f_apc_fetch("ta"), CREATE_VECTOR1("newelement")); + VS(f_apc_fetch("complexMap"), complexMap); + + VS(f_apc_fetch("ts"), "NewValue"); + VS(f_apc_fetch("ta"), CREATE_VECTOR1("newelement")); + VS(f_apc_fetch("complexMap"), complexMap); + + // Make sure it doesn't change the shared value. + Array complexMapFetched = f_apc_fetch("complexMap"); + VERIFY(complexMapFetched.exists("a")); + complexMapFetched.set("q",0); + VERIFY(complexMapFetched.exists("q")); + VS(f_apc_fetch("complexMap"), complexMap); + + String tsFetched = f_apc_fetch("ts"); + VS(tsFetched, "NewValue"); + String sharedString = tsFetched; + tsFetched.lvalAt(0) = "M"; + VS(tsFetched, "MewValue"); + VS(sharedString, "NewValue"); + VERIFY(tsFetched.get() != sharedString.get()); + VS(f_apc_fetch("ts"), "NewValue"); + + return Count(true); +} + +bool TestExtApc::test_apc_fetch() { + // reproducing a memory leak (3/26/09) + f_apc_add("apcdata", CREATE_MAP2("a", "test", "b", 1)); // MapVariant + { + Variant apcdata = f_apc_fetch("apcdata"); + Variant c = apcdata; // bump up ref count to make a MapVariant copy + apcdata.set("b", 3); // problem + VS(apcdata, CREATE_MAP2("a", "test", "b", 3)); + } + { + Variant apcdata = f_apc_fetch("apcdata"); + apcdata += CREATE_MAP1("b", 4); // problem + VS(apcdata, CREATE_MAP2("a", "test", "b", 1)); + } + { + Variant apcdata = f_apc_fetch(CREATE_VECTOR2("apcdata", "nah")); + VS(apcdata, CREATE_MAP1("apcdata", CREATE_MAP2("a", "test", "b", 1))); + } + return Count(true); +} + +bool TestExtApc::test_apc_delete() { + f_apc_store("ts", "TestString"); + f_apc_store("ta", CREATE_MAP2("a", 1, "b", 2)); + f_apc_delete("ts"); + f_apc_delete("ta"); + VS(f_apc_fetch("ts"), false); + VS(f_apc_fetch("ta"), false); + + VS(f_apc_fetch("ts"), false); + VS(f_apc_fetch("ta"), false); + + f_apc_store("ts", "TestString"); + f_apc_store("ta", CREATE_MAP2("a", 1, "b", 2)); + VS(f_apc_delete(CREATE_VECTOR2("ts", "ta")), Array::Create()); + VS(f_apc_fetch("ts"), false); + VS(f_apc_fetch("ta"), false); + + return Count(true); +} + +bool TestExtApc::test_apc_compile_file() { + try { + f_apc_compile_file(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApc::test_apc_cache_info() { + Array ci = f_apc_cache_info(); + VS(ci.rvalAt("start_time"), start_time()); + return Count(true); +} + +bool TestExtApc::test_apc_clear_cache() { + f_apc_store("ts", "TestString"); + f_apc_store("ta", CREATE_MAP2("a", 1, "b", 2)); + + f_apc_clear_cache(); + VS(f_apc_fetch("ts"), false); + VS(f_apc_fetch("ta"), false); + + VS(f_apc_fetch("ts"), false); + VS(f_apc_fetch("ta"), false); + return Count(true); +} + +bool TestExtApc::test_apc_define_constants() { + try { + f_apc_define_constants("", ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApc::test_apc_load_constants() { + try { + f_apc_load_constants(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApc::test_apc_sma_info() { + VS(f_apc_sma_info(), Array::Create()); + return Count(true); +} + +bool TestExtApc::test_apc_filehits() { + try { + f_apc_filehits(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApc::test_apc_delete_file() { + try { + f_apc_delete_file(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApc::test_apc_inc() { + f_apc_store("ts", 12); + VS(f_apc_inc("ts"), 13); + VS(f_apc_inc("ts", 5), 18); + VS(f_apc_inc("ts", -3), 15); + return Count(true); +} + +bool TestExtApc::test_apc_dec() { + f_apc_store("ts", 12); + VS(f_apc_dec("ts"), 11); + VS(f_apc_dec("ts", 5), 6); + VS(f_apc_dec("ts", -3), 9); + return Count(true); +} + +bool TestExtApc::test_apc_cas() { + f_apc_store("ts", 12); + f_apc_cas("ts", 12, 15); + VS(f_apc_fetch("ts"), 15); + f_apc_cas("ts", 12, 18); + VS(f_apc_fetch("ts"), 15); + return Count(true); +} + +bool TestExtApc::test_apc_bin_dump() { + try { + f_apc_bin_dump(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApc::test_apc_bin_load() { + try { + f_apc_bin_load(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApc::test_apc_bin_dumpfile() { + try { + f_apc_bin_dumpfile(0, null, ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApc::test_apc_bin_loadfile() { + try { + f_apc_bin_loadfile(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} diff --git a/src/test/test_ext_apc.h b/src/test/test_ext_apc.h new file mode 100644 index 0000000000000..0a9d144f47115 --- /dev/null +++ b/src/test/test_ext_apc.h @@ -0,0 +1,53 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_APC_H__ +#define __TEST_EXT_APC_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtApc : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_apc_add(); + bool test_apc_store(); + bool test_apc_fetch(); + bool test_apc_delete(); + bool test_apc_compile_file(); + bool test_apc_cache_info(); + bool test_apc_clear_cache(); + bool test_apc_define_constants(); + bool test_apc_load_constants(); + bool test_apc_sma_info(); + bool test_apc_filehits(); + bool test_apc_delete_file(); + bool test_apc_inc(); + bool test_apc_dec(); + bool test_apc_cas(); + bool test_apc_bin_dump(); + bool test_apc_bin_load(); + bool test_apc_bin_dumpfile(); + bool test_apc_bin_loadfile(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_APC_H__ diff --git a/src/test/test_ext_apd.cpp b/src/test/test_ext_apd.cpp new file mode 100644 index 0000000000000..d9d51b167e6cb --- /dev/null +++ b/src/test/test_ext_apd.cpp @@ -0,0 +1,119 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtApd::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_override_function); + RUN_TEST(test_rename_function); + RUN_TEST(test_apd_set_browser_trace); + RUN_TEST(test_apd_set_pprof_trace); + RUN_TEST(test_apd_set_session_trace_socket); + RUN_TEST(test_apd_stop_trace); + RUN_TEST(test_apd_breakpoint); + RUN_TEST(test_apd_continue); + RUN_TEST(test_apd_echo); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtApd::test_override_function() { + try { + f_override_function("", "", ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApd::test_rename_function() { + try { + f_rename_function("", ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApd::test_apd_set_browser_trace() { + try { + f_apd_set_browser_trace(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApd::test_apd_set_pprof_trace() { + try { + f_apd_set_pprof_trace("", ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApd::test_apd_set_session_trace_socket() { + try { + f_apd_set_session_trace_socket("", 0, 0, 0); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApd::test_apd_stop_trace() { + try { + f_apd_stop_trace(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApd::test_apd_breakpoint() { + try { + f_apd_breakpoint(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApd::test_apd_continue() { + try { + f_apd_continue(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtApd::test_apd_echo() { + try { + f_apd_echo(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} diff --git a/src/test/test_ext_apd.h b/src/test/test_ext_apd.h new file mode 100644 index 0000000000000..d8c1b90433467 --- /dev/null +++ b/src/test/test_ext_apd.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_APD_H__ +#define __TEST_EXT_APD_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtApd : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_override_function(); + bool test_rename_function(); + bool test_apd_set_browser_trace(); + bool test_apd_set_pprof_trace(); + bool test_apd_set_session_trace_socket(); + bool test_apd_stop_trace(); + bool test_apd_breakpoint(); + bool test_apd_continue(); + bool test_apd_echo(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_APD_H__ diff --git a/src/test/test_ext_array.cpp b/src/test/test_ext_array.cpp new file mode 100644 index 0000000000000..ed0aa67d4eb3a --- /dev/null +++ b/src/test/test_ext_array.cpp @@ -0,0 +1,1729 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtArray::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_array_change_key_case); + RUN_TEST(test_array_chunk); + RUN_TEST(test_array_combine); + RUN_TEST(test_array_count_values); + RUN_TEST(test_array_fill_keys); + RUN_TEST(test_array_fill); + RUN_TEST(test_array_filter); + RUN_TEST(test_array_flip); + RUN_TEST(test_array_key_exists); + RUN_TEST(test_array_keys); + RUN_TEST(test_array_map); + RUN_TEST(test_array_merge_recursive); + RUN_TEST(test_array_merge); + RUN_TEST(test_array_multisort); + RUN_TEST(test_array_pad); + RUN_TEST(test_array_pop); + RUN_TEST(test_array_product); + RUN_TEST(test_array_push); + RUN_TEST(test_array_rand); + RUN_TEST(test_array_reduce); + RUN_TEST(test_array_reverse); + RUN_TEST(test_array_search); + RUN_TEST(test_array_shift); + RUN_TEST(test_array_slice); + RUN_TEST(test_array_splice); + RUN_TEST(test_array_sum); + RUN_TEST(test_array_unique); + RUN_TEST(test_array_unshift); + RUN_TEST(test_array_values); + RUN_TEST(test_array_walk_recursive); + RUN_TEST(test_array_walk); + RUN_TEST(test_compact); + RUN_TEST(test_shuffle); + RUN_TEST(test_count); + RUN_TEST(test_sizeof); + RUN_TEST(test_each); + RUN_TEST(test_current); + RUN_TEST(test_next); + RUN_TEST(test_pos); + RUN_TEST(test_prev); + RUN_TEST(test_reset); + RUN_TEST(test_end); + RUN_TEST(test_in_array); + RUN_TEST(test_key); + RUN_TEST(test_range); + RUN_TEST(test_array_diff); + RUN_TEST(test_array_udiff); + RUN_TEST(test_array_diff_assoc); + RUN_TEST(test_array_diff_uassoc); + RUN_TEST(test_array_udiff_assoc); + RUN_TEST(test_array_udiff_uassoc); + RUN_TEST(test_array_diff_key); + RUN_TEST(test_array_diff_ukey); + RUN_TEST(test_array_intersect); + RUN_TEST(test_array_uintersect); + RUN_TEST(test_array_intersect_assoc); + RUN_TEST(test_array_intersect_uassoc); + RUN_TEST(test_array_uintersect_assoc); + RUN_TEST(test_array_uintersect_uassoc); + RUN_TEST(test_array_intersect_key); + RUN_TEST(test_array_intersect_ukey); + RUN_TEST(test_sort); + RUN_TEST(test_rsort); + RUN_TEST(test_asort); + RUN_TEST(test_arsort); + RUN_TEST(test_ksort); + RUN_TEST(test_krsort); + RUN_TEST(test_usort); + RUN_TEST(test_uasort); + RUN_TEST(test_uksort); + RUN_TEST(test_natsort); + RUN_TEST(test_natcasesort); + RUN_TEST(test_i18n_loc_get_default); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtArray::test_array_change_key_case() { + Array input_array = CREATE_MAP2("FirSt", 1, "SecOnd", 4); + VS(f_print_r(f_array_change_key_case(input_array, k_CASE_UPPER), true), + "Array\n" + "(\n" + " [FIRST] => 1\n" + " [SECOND] => 4\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_chunk() { + Array input_array = CREATE_VECTOR5("a", "b", "c", "d", "e"); + VS(f_print_r(f_array_chunk(input_array, 2), true), + "Array\n" + "(\n" + " [0] => Array\n" + " (\n" + " [0] => a\n" + " [1] => b\n" + " )\n" + "\n" + " [1] => Array\n" + " (\n" + " [0] => c\n" + " [1] => d\n" + " )\n" + "\n" + " [2] => Array\n" + " (\n" + " [0] => e\n" + " )\n" + "\n" + ")\n"); + VS(f_print_r(f_array_chunk(input_array, 2, true), true), + "Array\n" + "(\n" + " [0] => Array\n" + " (\n" + " [0] => a\n" + " [1] => b\n" + " )\n" + "\n" + " [1] => Array\n" + " (\n" + " [2] => c\n" + " [3] => d\n" + " )\n" + "\n" + " [2] => Array\n" + " (\n" + " [4] => e\n" + " )\n" + "\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_combine() { + Array a = CREATE_VECTOR3("green", "red", "yellow"); + Array b = CREATE_VECTOR3("avocado", "apple", "banana"); + Array c = f_array_combine(a, b); + VS(f_print_r(c, true), + "Array\n" + "(\n" + " [green] => avocado\n" + " [red] => apple\n" + " [yellow] => banana\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_count_values() { + Array array = CREATE_VECTOR5(1, "hello", 1, "world", "hello"); + VS(f_print_r(f_array_count_values(array), true), + "Array\n" + "(\n" + " [1] => 2\n" + " [hello] => 2\n" + " [world] => 1\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_fill_keys() { + Array keys = CREATE_VECTOR4("foo", 5, 10, "bar"); + Array a = f_array_fill_keys(keys, "banana"); + VS(f_print_r(a, true), + "Array\n" + "(\n" + " [foo] => banana\n" + " [5] => banana\n" + " [10] => banana\n" + " [bar] => banana\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_fill() { + Array a = f_array_fill(5, 6, "banana"); + Array b = f_array_fill(-2, 2, "pear"); + VS(f_print_r(a, true), + "Array\n" + "(\n" + " [5] => banana\n" + " [6] => banana\n" + " [7] => banana\n" + " [8] => banana\n" + " [9] => banana\n" + " [10] => banana\n" + ")\n"); + VS(f_print_r(b, true), + "Array\n" + "(\n" + " [-2] => pear\n" + " [0] => pear\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_filter() { + Array array1 = CREATE_MAP5("a", 1, "b", 2, "c", 3, "d", 4, "e", 5); + Array array2(NEW(ArrayElement)(6), + NEW(ArrayElement)(7), + NEW(ArrayElement)(8), + NEW(ArrayElement)(9), + NEW(ArrayElement)(10), + NEW(ArrayElement)(11), + NEW(ArrayElement)(12), + NULL); + + VS(f_print_r(f_array_filter(array1, "odd"), true), + "Array\n" + "(\n" + " [a] => 1\n" + " [c] => 3\n" + " [e] => 5\n" + ")\n"); + + VS(f_print_r(f_array_filter(array2, "even"), true), + "Array\n" + "(\n" + " [0] => 6\n" + " [2] => 8\n" + " [4] => 10\n" + " [6] => 12\n" + ")\n"); + + Array entry = CREATE_MAP5(0, "foo", 1, false, 2, -1, 3, null, 4, ""); + VS(f_print_r(f_array_filter(entry), true), + "Array\n" + "(\n" + " [0] => foo\n" + " [2] => -1\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_flip() { + Array trans = CREATE_MAP3("a", 1, "b", 1, "c", 2); + trans = f_array_flip(trans); + VS(f_print_r(trans, true), + "Array\n" + "(\n" + " [1] => b\n" + " [2] => c\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_key_exists() { + Array search_array = CREATE_MAP2("first", 1, "second", 4); + VERIFY(f_array_key_exists("first", search_array)); + + search_array = CREATE_MAP2("first", null, "second", 4); + //VERIFY(!isset(search_array.lvalAt("first"))); + VERIFY(f_array_key_exists("first", search_array)); + + return Count(true); +} + +bool TestExtArray::test_array_keys() { + { + Array array = CREATE_MAP2(0, 100, "color", "red"); + VS(f_print_r(f_array_keys(array), true), + "Array\n" + "(\n" + " [0] => 0\n" + " [1] => color\n" + ")\n"); + } + + { + Array array = CREATE_VECTOR5("blue", "red", "green", "blue", "blue"); + VS(f_print_r(f_array_keys(array, "blue"), true), + "Array\n" + "(\n" + " [0] => 0\n" + " [1] => 3\n" + " [2] => 4\n" + ")\n"); + } + + { + Array array = + CREATE_MAP2("color", CREATE_VECTOR3("blue", "red", "green"), + "size", CREATE_VECTOR3("small", "medium", "large")); + VS(f_print_r(f_array_keys(array), true), + "Array\n" + "(\n" + " [0] => color\n" + " [1] => size\n" + ")\n"); + } + + return Count(true); +} + +bool TestExtArray::test_array_map() { + Array a = CREATE_VECTOR5(1, 2, 3, 4, 5); + Array b = f_array_map(2, "cube", a); + VS(f_print_r(b, true), + "Array\n" + "(\n" + " [0] => 1\n" + " [1] => 8\n" + " [2] => 27\n" + " [3] => 64\n" + " [4] => 125\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_merge_recursive() { + Array ar1(NEW(ArrayElement)("color", CREATE_MAP1("favorite", "red")), + NEW(ArrayElement)(5), + NULL); + + Array ar2(NEW(ArrayElement)(10), + NEW(ArrayElement) + ("color", Array(NEW(ArrayElement)("favorite", "green"), + NEW(ArrayElement)("blue"), + NULL)), + NULL); + + Array result = f_array_merge_recursive(2, ar1, CREATE_VECTOR1(ar2)); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [color] => Array\n" + " (\n" + " [favorite] => Array\n" + " (\n" + " [0] => red\n" + " [1] => green\n" + " )\n" + "\n" + " [0] => blue\n" + " )\n" + "\n" + " [0] => 5\n" + " [1] => 10\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_merge() { + { + Array array1(NEW(ArrayElement)("color", "red"), + NEW(ArrayElement)(2), + NEW(ArrayElement)(4), + NULL); + Array array2(NEW(ArrayElement)("a"), + NEW(ArrayElement)("b"), + NEW(ArrayElement)("color", "green"), + NEW(ArrayElement)("shape", "trapezoid"), + NEW(ArrayElement)(4), + NULL); + Array result = f_array_merge(2, array1, CREATE_VECTOR1(array2)); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [color] => green\n" + " [0] => 2\n" + " [1] => 4\n" + " [2] => a\n" + " [3] => b\n" + " [shape] => trapezoid\n" + " [4] => 4\n" + ")\n"); + } + { + Array array1 = Array::Create(); + Array array2 = CREATE_MAP1(1, "data"); + Array result = f_array_merge(2, array1, CREATE_VECTOR1(array2)); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [0] => data\n" + ")\n"); + } + { + Array array1 = Array::Create(); + Array array2 = CREATE_MAP1(1, "data"); + Array result = array1 + array2; + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [1] => data\n" + ")\n"); + } + { + String beginning = "foo"; + Array end = CREATE_MAP1(1, "bar"); + Array result = f_array_merge(2, toArray(beginning), CREATE_VECTOR1(end)); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [0] => foo\n" + " [1] => bar\n" + ")\n"); + } + { + Variant v = 1; + Array a = CREATE_MAP1("one", 1); + Array b = CREATE_MAP1("two", ref(v)); + Array r = f_array_merge(2, a, CREATE_VECTOR1(b)); + v = 2; + VS(f_print_r(r, true), + "Array\n" + "(\n" + " [one] => 1\n" + " [two] => 2\n" + ")\n"); + } + { + int64 id = 100000000000022; + Array a = CREATE_MAP1(id, 1); + Array b = CREATE_MAP1(id, 2); + Array r = f_array_merge(2, a, CREATE_VECTOR1(b)); + VS(f_print_r(r, true), + "Array\n" + "(\n" + " [0] => 1\n" + " [1] => 2\n" + ")\n"); + } + + return Count(true); +} + +bool TestExtArray::test_array_multisort() { + { + Variant ar1 = CREATE_VECTOR4(10, 100, 100, 0); + Variant ar2 = CREATE_VECTOR4(1, 3, 2, 4); + f_array_multisort(2, ref(ar1), CREATE_VECTOR1(ref(ar2))); + VS(f_print_r(ar1, true), + "Array\n" + "(\n" + " [0] => 0\n" + " [1] => 10\n" + " [2] => 100\n" + " [3] => 100\n" + ")\n"); + VS(f_print_r(ar2, true), + "Array\n" + "(\n" + " [0] => 4\n" + " [1] => 1\n" + " [2] => 2\n" + " [3] => 3\n" + ")\n"); + } + { + Variant ar = CREATE_VECTOR2 + (CREATE_VECTOR5("10", 11, 100, 100, "a"), + CREATE_VECTOR5( 1, 2, "2", 3, 1)); + f_array_multisort(6, ref(lval(ar.lvalAt(0))), + CREATE_VECTOR5(k_SORT_ASC, k_SORT_STRING, + ref(lval(ar.lvalAt(1))), + k_SORT_NUMERIC, k_SORT_DESC)); + VS(f_print_r(ar, true), + "Array\n" + "(\n" + " [0] => Array\n" + " (\n" + " [0] => 10\n" + " [1] => 100\n" + " [2] => 100\n" + " [3] => 11\n" + " [4] => a\n" + " )\n" + "\n" + " [1] => Array\n" + " (\n" + " [0] => 1\n" + " [1] => 3\n" + " [2] => 2\n" + " [3] => 2\n" + " [4] => 1\n" + " )\n" + "\n" + ")\n"); + } + { + Variant array = CREATE_VECTOR4("Alpha", "atomic", "Beta", "bank"); + Variant array_lowercase = f_array_map(2, "strtolower", array); + f_array_multisort(4, ref(array_lowercase), + CREATE_VECTOR3(k_SORT_ASC, k_SORT_STRING, ref(array))); + VS(f_print_r(array, true), + "Array\n" + "(\n" + " [0] => Alpha\n" + " [1] => atomic\n" + " [2] => bank\n" + " [3] => Beta\n" + ")\n"); + } + + return Count(true); +} + +bool TestExtArray::test_array_pad() { + Array input = CREATE_VECTOR3(12, 10, 9); + + VS(f_array_pad(input, 5, 0), + CREATE_VECTOR5(12, 10, 9, 0, 0)); + + VS(f_array_pad(input, -7, -1), + Array(NEW(ArrayElement)(-1), + NEW(ArrayElement)(-1), + NEW(ArrayElement)(-1), + NEW(ArrayElement)(-1), + NEW(ArrayElement)(12), + NEW(ArrayElement)(10), + NEW(ArrayElement)(9), + NULL)); + + VS(f_array_pad(input, 2, "noop"), input); + + Array a = CREATE_MAP1("9", "b"); + VS(f_array_pad(a, -3, "test"), CREATE_VECTOR3("test", "test", "b")); + + return Count(true); +} + +bool TestExtArray::test_array_pop() { + { + Variant input = CREATE_VECTOR4("orange", "banana", "apple", "raspberry"); + String fruit = f_array_pop(ref(input)); + VS(f_print_r(input, true), + "Array\n" + "(\n" + " [0] => orange\n" + " [1] => banana\n" + " [2] => apple\n" + ")\n"); + VS(fruit, "raspberry"); + } + { + Variant input = CREATE_VECTOR1("orange"); + String fruit = f_array_pop(ref(input)); + f_array_push(2, ref(input), "banana"); + VS(f_print_r(input, true), + "Array\n" + "(\n" + " [0] => banana\n" + ")\n"); + VS(fruit, "orange"); + } + + return Count(true); +} + +bool TestExtArray::test_array_product() { + Array a = CREATE_VECTOR4(2, 4, 6, 8); + VS(f_array_product(a), 384.0); + return Count(true); +} + +bool TestExtArray::test_array_push() { + Variant input = CREATE_VECTOR2("orange", "banana"); + f_array_push(3, ref(input), "apple", CREATE_VECTOR1("raspberry")); + VS(f_print_r(input, true), + "Array\n" + "(\n" + " [0] => orange\n" + " [1] => banana\n" + " [2] => apple\n" + " [3] => raspberry\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_rand() { + Array input = CREATE_VECTOR5("Neo", "Morpheus", "Trinity", "Cypher", "Tank"); + Array rand_keys = f_array_rand(input, 2); + VS(rand_keys.size(), 2); + + std::set strs; + strs.insert("Neo"); + strs.insert("Morpheus"); + strs.insert("Trinity"); + strs.insert("Cypher"); + strs.insert("Tank"); + + VERIFY(strs.find(input[rand_keys[0]].toString().data()) != strs.end()); + VERIFY(strs.find(input[rand_keys[1]].toString().data()) != strs.end()); + + return Count(true); +} + +bool TestExtArray::test_array_reduce() { + Array a = CREATE_VECTOR5(1, 2, 3, 4, 5); + Variant b = f_array_reduce(a, "rsum"); + VS(b, 15); + Variant c = f_array_reduce(a, "rmul", 10); + VS(c, 1200); + + Array x = Array::Create(); + Variant d = f_array_reduce(x, "rsum", 1); + VS(d, 1); + + return Count(true); +} + +bool TestExtArray::test_array_reverse() { + { + Array input = CREATE_VECTOR3("php", 4.0, CREATE_VECTOR2("green", "red")); + Array result = f_array_reverse(input); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [0] => Array\n" + " (\n" + " [0] => green\n" + " [1] => red\n" + " )\n" + "\n" + " [1] => 4\n" + " [2] => php\n" + ")\n"); + + Array result_keyed = f_array_reverse(input, true); + VS(f_print_r(result_keyed, true), + "Array\n" + "(\n" + " [2] => Array\n" + " (\n" + " [0] => green\n" + " [1] => red\n" + " )\n" + "\n" + " [1] => 4\n" + " [0] => php\n" + ")\n"); + } + { + Array input = CREATE_MAP3("php", 4.0, 10, 5.0, "blab", "b"); + Array result = f_array_reverse(input); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [blab] => b\n" + " [0] => 5\n" + " [php] => 4\n" + ")\n"); + } + return Count(true); +} + +bool TestExtArray::test_array_search() { + Array array = CREATE_MAP4(0, "blue", 1, "red", 2, "green", 3, "red"); + VS(f_array_search("green", array), 2); + VS(f_array_search("red", array), 1); + return Count(true); +} + +bool TestExtArray::test_array_shift() { + { + Variant input = CREATE_MAP2("a", 1, "b", 2); + f_array_shift(ref(input)); + VS(f_print_r(input, true), + "Array\n" + "(\n" + " [b] => 2\n" + ")\n"); + } + { + Variant input = CREATE_MAP2("a", 1, 23, 2); + f_array_shift(ref(input)); + VS(f_print_r(input, true), + "Array\n" + "(\n" + " [0] => 2\n" + ")\n"); + } + { + Variant input = CREATE_MAP2("a", 1, -23, 2); + f_array_shift(ref(input)); + VS(f_print_r(input, true), + "Array\n" + "(\n" + " [0] => 2\n" + ")\n"); + } + { + Variant input = CREATE_VECTOR4("orange", "banana", "apple", "raspberry"); + String fruit = f_array_shift(ref(input)); + VS(f_print_r(input, true), + "Array\n" + "(\n" + " [0] => banana\n" + " [1] => apple\n" + " [2] => raspberry\n" + ")\n"); + VS(fruit, "orange"); + } + return Count(true); +} + +bool TestExtArray::test_array_slice() { + Array input = CREATE_VECTOR5("a", "b", "c", "d", "e"); + + VS(f_array_slice(input, 2), CREATE_VECTOR3("c", "d", "e")); + VS(f_array_slice(input, 2, Variant()), CREATE_VECTOR3("c", "d", "e")); + VS(f_array_slice(input, -2, 1), CREATE_VECTOR1("d")); + VS(f_array_slice(input, 0, 3), CREATE_VECTOR3("a", "b", "c")); + + // note the differences in the array keys + VS(f_print_r(f_array_slice(input, 2, -1), true), + "Array\n" + "(\n" + " [0] => c\n" + " [1] => d\n" + ")\n"); + VS(f_print_r(f_array_slice(input, 2, -1, true), true), + "Array\n" + "(\n" + " [2] => c\n" + " [3] => d\n" + ")\n"); + + VS(f_array_slice(CREATE_VECTOR3("a", "b", "c"), 1, 2, true), + CREATE_MAP2(1, "b", 2, "c")); + + VS(f_array_slice(CREATE_VECTOR3("a", "b", "c"), 1, 2, false), + CREATE_VECTOR2("b", "c")); + + Array a = CREATE_MAP4("a", "g", 0, "a", 1, "b", 2, "c"); + a.remove("a"); + VS(f_array_slice(a, 1, 2, true), CREATE_MAP2(1, "b", 2, "c")); + VS(f_array_slice(a, 1, 2, false), CREATE_VECTOR2("b", "c")); + + a = CREATE_MAP4("a", 123, 0, "a", 1, "b", 2, "c"); + a.remove("a"); + VS(f_array_slice(a, 1, 2, true), CREATE_MAP2(1, "b", 2, "c")); + VS(f_array_slice(a, 1, 2, false), CREATE_VECTOR2("b", "c")); + + VS(f_array_slice(CREATE_VECTOR3(123, "b", "c"), 1, 2, true), + CREATE_MAP2(1, "b", 2, "c")); + + VS(f_array_slice(CREATE_VECTOR3(123, "b", "c"), 1, 2, false), + CREATE_VECTOR2("b", "c")); + + return Count(true); +} + +bool TestExtArray::test_array_splice() { + Variant params = CREATE_MAP2("a", "aaa", "0", "apple"); + params.remove("a"); + f_array_splice(ref(params), 0, 0, CREATE_MAP1(123, "test")); + VS(params, CREATE_VECTOR2("test", "apple")); + + params = CREATE_MAP2("a", "aaa", "1", "apple"); + params.remove("a"); + f_array_splice(ref(params), 0, 0, CREATE_MAP1(123, "test")); + VS(params, CREATE_VECTOR2("test", "apple")); + + Variant input = CREATE_VECTOR4("red", "green", "blue", "yellow"); + f_array_splice(ref(input), 2); + VS(input, CREATE_VECTOR2("red", "green")); + + input = CREATE_VECTOR4("red", "green", "blue", "yellow"); + f_array_splice(ref(input), 2, Variant()); + VS(input, CREATE_VECTOR2("red", "green")); + + input = CREATE_VECTOR4("red", "green", "blue", "yellow"); + f_array_splice(ref(input), 1, -1); + VS(input, CREATE_VECTOR2("red", "yellow")); + + input = CREATE_VECTOR4("red", "green", "blue", "yellow"); + f_array_splice(ref(input), 1, 4, "orange"); + VS(input, CREATE_VECTOR2("red", "orange")); + + input = CREATE_VECTOR4("red", "green", "blue", "yellow"); + f_array_splice(ref(input), -1, 1, CREATE_VECTOR2("black", "maroon")); + VS(input, CREATE_VECTOR5("red", "green", "blue", "black", "maroon")); + + input = CREATE_VECTOR4("red", "green", "blue", "yellow"); + f_array_splice(ref(input), 3, 0, "purple"); + VS(input, CREATE_VECTOR5("red", "green", "blue", "purple", "yellow")); + + return Count(true); +} + +bool TestExtArray::test_array_sum() { + Array a = CREATE_VECTOR4(2, 4, 6, 8); + VS(f_array_sum(a), 20.0); + + Array b = CREATE_MAP3("a", 1.2, "b", 2.3, "c", 3.4); + VS(f_array_sum(b), 6.9); + + return Count(true); +} + +bool TestExtArray::test_array_unique() { + { + Array input(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("red"), + NEW(ArrayElement)("b", "green"), + NEW(ArrayElement)("blue"), + NEW(ArrayElement)("red"), + NULL); + Array result = f_array_unique(input); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [a] => green\n" + " [0] => red\n" + " [1] => blue\n" + ")\n"); + } + { + Array input(NEW(ArrayElement)(4), + NEW(ArrayElement)("4"), + NEW(ArrayElement)("3"), + NEW(ArrayElement)(4), + NEW(ArrayElement)(3), + NEW(ArrayElement)("3"), + NULL); + Array result = f_array_unique(input); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [0] => 4\n" + " [2] => 3\n" + ")\n"); + } + return Count(true); +} + +bool TestExtArray::test_array_unshift() { + Variant q = CREATE_VECTOR2("orange", "banana"); + f_array_unshift(3, ref(q), "apple", CREATE_VECTOR1("raspberry")); + VS(f_print_r(q, true), + "Array\n" + "(\n" + " [0] => apple\n" + " [1] => raspberry\n" + " [2] => orange\n" + " [3] => banana\n" + ")\n"); + + q = CREATE_MAP3(0, "orange", 1, "banana", "a", "dummy"); + q.remove("a"); + f_array_unshift(3, ref(q), "apple", CREATE_VECTOR1("raspberry")); + VS(f_print_r(q, true), + "Array\n" + "(\n" + " [0] => apple\n" + " [1] => raspberry\n" + " [2] => orange\n" + " [3] => banana\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_values() { + Array array = CREATE_MAP2("size", "XL", "color", "gold"); + VS(f_print_r(f_array_values(array), true), + "Array\n" + "(\n" + " [0] => XL\n" + " [1] => gold\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_array_walk_recursive() { + Array sweet = CREATE_MAP2("a", "apple", "b", "banana"); + Array fruits = CREATE_MAP2("sweet", sweet, "sour", "lemon"); + + g_context->obStart(); + f_array_walk_recursive(fruits, "test_print"); + String output = g_context->obGetContents(); + g_context->obEnd(); + VS(output, "a: apple\nb: banana\nsour: lemon\n"); + + return Count(true); +} + +bool TestExtArray::test_array_walk() { + Variant fruits = CREATE_MAP4("d", "lemon", + "a", "orange", + "b", "banana", + "c", "apple"); + g_context->obStart(); + f_array_walk(ref(fruits), "test_print"); + f_array_walk(ref(fruits), "test_alter", "fruit"); + f_array_walk(ref(fruits), "test_print"); + String output = g_context->obGetContents(); + g_context->obEnd(); + + VS(output, + "d: lemon\n" + "a: orange\n" + "b: banana\n" + "c: apple\n" + "d: fruit: lemon\n" + "a: fruit: orange\n" + "b: fruit: banana\n" + "c: fruit: apple\n"); + + return Count(true); +} + +bool TestExtArray::test_compact() { + // compact() was tested in TestCodeRun. + return Count(true); +} + +bool TestExtArray::test_shuffle() { + Variant numbers = f_range(1, 20); + f_shuffle(ref(numbers)); + Array numArr = numbers.toArray(); + VS(numArr.size(), 20); + int i = 1; + int count = 0; + for (ArrayIter iter(numArr); iter; ++iter, ++i) { + int num = iter.second().toInt32(); + VERIFY(num >= 1); + VERIFY(num <= 20); + if (num != i) count++; + + VERIFY(iter.first().toInt64() == i - 1); + } + VERIFY(count > 0); // well, small chance to fail here + + return Count(true); +} + +bool TestExtArray::test_count() { + Array a; + a.set(0, 1); + a.set(1, 3); + a.set(2, 5); + VS(f_count(a), 3); + + Array b; + b.set(0, 7); + b.set(5, 9); + b.set(10, 11); + VS(f_count(b), 3); + + VS(f_count(null), 0); + VS(f_count(false), 1); + + Array food = CREATE_MAP2("fruits", + CREATE_VECTOR3("orange", "banana", "apple"), + "veggie", + CREATE_VECTOR3("carrot", "collard", "pea")); + VS(f_count(food, k_COUNT_RECURSIVE), 8); + VS(f_count(food), 2); + + return Count(true); +} + +bool TestExtArray::test_sizeof() { + Array a; + a.set(0, 1); + a.set(1, 3); + a.set(2, 5); + VS(f_sizeof(a), 3); + + Array b; + b.set(0, 7); + b.set(5, 9); + b.set(10, 11); + VS(f_sizeof(b), 3); + + VS(f_sizeof(null), 0); + VS(f_sizeof(false), 1); + + Array food = CREATE_MAP2("fruits", + CREATE_VECTOR3("orange", "banana", "apple"), + "veggie", + CREATE_VECTOR3("carrot", "collard", "pea")); + VS(f_sizeof(food, k_COUNT_RECURSIVE), 8); + VS(f_sizeof(food), 2); + + return Count(true); +} + +bool TestExtArray::test_each() { + { + Variant foo = Array(NEW(ArrayElement)("bob"), + NEW(ArrayElement)("fred"), + NEW(ArrayElement)("jussi"), + NEW(ArrayElement)("jouni"), + NEW(ArrayElement)("egon"), + NEW(ArrayElement)("marliese"), + NULL); + Array bar = f_each(ref(foo)); + VS(f_print_r(bar, true), + "Array\n" + "(\n" + " [1] => bob\n" + " [value] => bob\n" + " [0] => 0\n" + " [key] => 0\n" + ")\n"); + } + { + Variant foo = CREATE_MAP2("Robert", "Bob", "Seppo", "Sepi"); + Array bar = f_each(ref(foo)); + VS(f_print_r(bar, true), + "Array\n" + "(\n" + " [1] => Bob\n" + " [value] => Bob\n" + " [0] => Robert\n" + " [key] => Robert\n" + ")\n"); + } + { + Variant fruit = CREATE_MAP3("a", "apple", "b", "banana", "c", "cranberry"); + f_reset(ref(fruit)); + String output; + while (true) { + Variant item = f_each(ref(fruit)); + if (same(item, false)) break; + output += item[0]; + output += ": "; + output += item[1]; + output += "\n"; + } + VS(output, + "a: apple\n" + "b: banana\n" + "c: cranberry\n"); + } + return Count(true); +} + +bool TestExtArray::test_current() { + { + Variant transport = CREATE_VECTOR4("foot", "bike", "car", "plane"); + VS(f_current(ref(transport)), "foot"); + VS(f_next(ref(transport)), "bike"); + VS(f_current(ref(transport)), "bike"); + VS(f_prev(ref(transport)), "foot"); + VS(f_end(ref(transport)), "plane"); + VS(f_current(ref(transport)), "plane"); + } + { + Variant arr = Array::Create(); + VS(f_current(ref(arr)), false); + } + { + Variant arr = CREATE_VECTOR1(Array::Create()); + VS(f_current(ref(arr)), Array::Create()); + } + return Count(true); +} + +bool TestExtArray::test_next() { + Variant transport = CREATE_VECTOR4("foot", "bike", "car", "plane"); + VS(f_current(ref(transport)), "foot"); + VS(f_next(ref(transport)), "bike"); + VS(f_next(ref(transport)), "car"); + VS(f_prev(ref(transport)), "bike"); + VS(f_end(ref(transport)), "plane"); + + return Count(true); +} + +bool TestExtArray::test_pos() { + { + Variant transport = CREATE_VECTOR4("foot", "bike", "car", "plane"); + VS(f_pos(ref(transport)), "foot"); + VS(f_next(ref(transport)), "bike"); + VS(f_pos(ref(transport)), "bike"); + VS(f_prev(ref(transport)), "foot"); + VS(f_end(ref(transport)), "plane"); + VS(f_pos(ref(transport)), "plane"); + } + { + Variant arr = Array::Create(); + VS(f_pos(ref(arr)), false); + } + { + Variant arr = CREATE_VECTOR1(Array::Create()); + VS(f_pos(ref(arr)), Array::Create()); + } + return Count(true); +} + +bool TestExtArray::test_prev() { + Variant transport = CREATE_VECTOR4("foot", "bike", "car", "plane"); + VS(f_current(ref(transport)), "foot"); + VS(f_next(ref(transport)), "bike"); + VS(f_next(ref(transport)), "car"); + VS(f_prev(ref(transport)), "bike"); + VS(f_end(ref(transport)), "plane"); + + return Count(true); +} + +bool TestExtArray::test_reset() { + Variant array = CREATE_VECTOR4("step one", + "step two", + "step three", + "step four"); + + // by default, the pointer is on the first element + VS(f_current(ref(array)), "step one"); + + // skip two steps + f_next(ref(array)); + f_next(ref(array)); + VS(f_current(ref(array)), "step three"); + + // reset pointer, start again on step one + f_reset(ref(array)); + VS(f_current(ref(array)), "step one"); + + return Count(true); +} + +bool TestExtArray::test_end() { + Variant fruits = CREATE_VECTOR3("apple", "banana", "cranberry"); + VS(f_end(ref(fruits)), "cranberry"); + return Count(true); +} + +bool TestExtArray::test_in_array() { + { + Array os = CREATE_VECTOR4("Mac", "NT", "Irix", "Linux"); + VERIFY(f_in_array("Irix", os)); + VERIFY(!f_in_array("mac", os)); + } + { + Array a = CREATE_VECTOR3("1.10", 12.4, 1.13); + VERIFY(!f_in_array("12.4", a, true)); + VERIFY(f_in_array(1.13, a, true)); + } + { + Array a = CREATE_VECTOR3(CREATE_VECTOR2("p", "h"), + CREATE_VECTOR2("p", "r"), + "o"); + VERIFY(f_in_array(CREATE_VECTOR2("p", "h"), a)); + VERIFY(!f_in_array(CREATE_VECTOR2("f", "i"), a)); + VERIFY(f_in_array("o", a)); + } + return Count(true); +} + +bool TestExtArray::test_key() { + Variant array = CREATE_MAP5("fruit1", "apple", + "fruit2", "orange", + "fruit3", "grape", + "fruit4", "apple", + "fruit5", "apple"); + + // this cycle echoes all associative array + // key where value equals "apple" + String output; + while (true) { + Variant fruit_name = f_current(ref(array)); + if (same(fruit_name, false)) break; + if (same(fruit_name, "apple")) { + output += f_key(ref(array)); + } + f_next(ref(array)); + } + VS(output, "fruit1fruit4fruit5"); + + return Count(true); +} + +bool TestExtArray::test_range() { + Array ret = f_range(0, 12); + VS(ret.size(), 13); + VS(ret[0], 0); + VS(ret[12], 12); + + // The step parameter was introduced in 5.0.0 + ret = f_range(0, 100, 10); + VS(ret.size(), 11); + VS(ret[0], 0); + VS(ret[5], 50); + VS(ret[10], 100); + + // Use of character sequences introduced in 4.1.0 + // array("a", "b", "c", "d", "e", "f", "g", "h", "i"); + ret = f_range("a", "i"); + VS(ret.size(), 9); + VS(ret[0], "a"); + VS(ret[4], "e"); + VS(ret[8], "i"); + + VS(f_range("c", "a"), CREATE_VECTOR3("c", "b", "a")); + + return Count(true); +} + +bool TestExtArray::test_array_diff() { + Array array1(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("red"), + NEW(ArrayElement)("blue"), + NEW(ArrayElement)("red"), + NULL); + Array array2(NEW(ArrayElement)("b", "green"), + NEW(ArrayElement)("yellow"), + NEW(ArrayElement)("red"), + NULL); + Array result = f_array_diff(2, array1, array2); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [1] => blue\n" + ")\n"); + + Array a = CREATE_VECTOR1("b"); + Array b = CREATE_VECTOR2("b", "c"); + VS(f_array_diff(2, b, a), CREATE_MAP1(1, "c")); + + return Count(true); +} + +bool TestExtArray::test_array_udiff() { + Array a = CREATE_MAP5("0.1", 9, "0.5", 12, 0, 23, 1, 4, 2, -15); + Array b = CREATE_MAP5("0.2", 9, "0.5", 22, 0, 3, 1, 4, 2, -15); + + Array result = f_array_udiff(3, a, b, "comp_func"); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [0.5] => 12\n" + " [0] => 23\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_diff_assoc() { + { + Array array1(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("b", "brown"), + NEW(ArrayElement)("c", "blue"), + NEW(ArrayElement)("red"), + NULL); + Array array2(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("yellow"), + NEW(ArrayElement)("red"), + NULL); + Array result = f_array_diff_assoc(2, array1, array2); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [b] => brown\n" + " [c] => blue\n" + " [0] => red\n" + ")\n"); + } + { + Array array1 = CREATE_VECTOR3(0, 1, 2); + Array array2 = CREATE_VECTOR3("00", "01", "2"); + Array result = f_array_diff_assoc(2, array1, array2); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [0] => 0\n" + " [1] => 1\n" + ")\n"); + } + return Count(true); +} + +bool TestExtArray::test_array_diff_uassoc() { + { + Array array1(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("b", "brown"), + NEW(ArrayElement)("c", "blue"), + NEW(ArrayElement)("red"), + NULL); + Array array2(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("yellow"), + NEW(ArrayElement)("red"), + NULL); + Array result = f_array_diff_uassoc(3, array1, array2, "comp_func"); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [b] => brown\n" + " [c] => blue\n" + " [0] => red\n" + ")\n"); + } + return Count(true); +} + +bool TestExtArray::test_array_udiff_assoc() { + Array a = CREATE_MAP5("0.1", 9, "0.5", 12, 0, 23, 1, 4, 2, -15); + Array b = CREATE_MAP5("0.2", 9, "0.5", 22, 0, 3, 1, 4, 2, -15); + + Array result = f_array_udiff_assoc(3, a, b, "comp_func"); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [0.1] => 9\n" + " [0.5] => 12\n" + " [0] => 23\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_udiff_uassoc() { + Array a = CREATE_MAP5("0.1", 9, "0.5", 12, 0, 23, 1, 4, 2, -15); + Array b = CREATE_MAP5("0.2", 9, "0.5", 22, 0, 3, 1, 4, 2, -15); + + Array result = f_array_udiff_uassoc(4, a, b, "comp_func", "comp_func"); + VS(f_print_r(result, true), + "Array\n" + "(\n" + " [0.5] => 12\n" + " [0] => 23\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_diff_key() { + Array array1 = CREATE_MAP4("blue", 1, "red", 2, "green", 3, "purple", 4); + Array array2 = CREATE_MAP4("green", 5, "blue", 6, "yellow", 7, "cyan", 8); + VS(f_array_diff_key(2, array1, array2), + CREATE_MAP2("red", 2, "purple", 4)); + return Count(true); +} + +bool TestExtArray::test_array_diff_ukey() { + Array array1 = CREATE_MAP4("blue", 1, "red", 2, "green", 3, "purple", 4); + Array array2 = CREATE_MAP4("green", 5, "blue", 6, "yellow", 7, "cyan", 8); + VS(f_array_diff_ukey(3, array1, array2, "strcasecmp"), + CREATE_MAP2("red", 2, "purple", 4)); + return Count(true); +} + +bool TestExtArray::test_array_intersect() { + Array array1(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("red"), + NEW(ArrayElement)("blue"), + NULL); + Array array2(NEW(ArrayElement)("b", "green"), + NEW(ArrayElement)("yellow"), + NEW(ArrayElement)("red"), + NULL); + VS(f_array_intersect(2, array1, array2), + CREATE_MAP2("a", "green", "0", "red")); + return Count(true); +} + +bool TestExtArray::test_array_uintersect() { + Array array1(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("b", "brown"), + NEW(ArrayElement)("c", "blue"), + NEW(ArrayElement)("red"), + NULL); + Array array2(NEW(ArrayElement)("a", "GREEN"), + NEW(ArrayElement)("B", "brown"), + NEW(ArrayElement)("yellow"), + NEW(ArrayElement)("red"), + NULL); + VS(f_print_r(f_array_uintersect(3, array1, array2, "strcasecmp"), true), + "Array\n" + "(\n" + " [a] => green\n" + " [b] => brown\n" + " [0] => red\n" + ")\n"); + + return Count(true); +} + +bool TestExtArray::test_array_intersect_assoc() { + Array array1(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("b", "brown"), + NEW(ArrayElement)("c", "blue"), + NEW(ArrayElement)("red"), + NULL); + Array array2(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("yellow"), + NEW(ArrayElement)("red"), + NULL); + VS(f_array_intersect_assoc(2, array1, array2), CREATE_MAP1("a", "green")); + return Count(true); +} + +bool TestExtArray::test_array_intersect_uassoc() { + Array array1(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("b", "brown"), + NEW(ArrayElement)("c", "blue"), + NEW(ArrayElement)("red"), + NULL); + Array array2(NEW(ArrayElement)("a", "GREEN"), + NEW(ArrayElement)("B", "brown"), + NEW(ArrayElement)("yellow"), + NEW(ArrayElement)("red"), + NULL); + VS(f_array_intersect_uassoc(3, array1, array2, "strcasecmp"), + CREATE_MAP1("b", "brown")); + return Count(true); +} + +bool TestExtArray::test_array_uintersect_assoc() { + Array array1(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("b", "brown"), + NEW(ArrayElement)("c", "blue"), + NEW(ArrayElement)("red"), + NULL); + Array array2(NEW(ArrayElement)("a", "GREEN"), + NEW(ArrayElement)("B", "brown"), + NEW(ArrayElement)("yellow"), + NEW(ArrayElement)("red"), + NULL); + VS(f_array_uintersect_assoc(3, array1, array2, "strcasecmp"), + CREATE_MAP1("a", "green")); + return Count(true); +} + +bool TestExtArray::test_array_uintersect_uassoc() { + Array array1(NEW(ArrayElement)("a", "green"), + NEW(ArrayElement)("b", "brown"), + NEW(ArrayElement)("c", "blue"), + NEW(ArrayElement)("red"), + NULL); + Array array2(NEW(ArrayElement)("a", "GREEN"), + NEW(ArrayElement)("B", "brown"), + NEW(ArrayElement)("yellow"), + NEW(ArrayElement)("red"), + NULL); + VS(f_array_uintersect_uassoc(4, array1, array2, "strcasecmp", "strcasecmp"), + CREATE_MAP2("a", "green", "b", "brown")); + return Count(true); +} + +bool TestExtArray::test_array_intersect_key() { + Array array1 = CREATE_MAP4("blue", 1, "red", 2, "green", 3, "purple", 4); + Array array2 = CREATE_MAP4("green", 5, "blue", 6, "yellow", 7, "cyan", 8); + VS(f_array_intersect_key(2, array1, array2), + CREATE_MAP2("blue", 1, "green", 3)); + return Count(true); +} + +bool TestExtArray::test_array_intersect_ukey() { + Array array1 = CREATE_MAP4("blue", 1, "red", 2, "green", 3, "purple", 4); + Array array2 = CREATE_MAP4("green", 5, "blue", 6, "yellow", 7, "cyan", 8); + VS(f_array_intersect_ukey(3, array1, array2, "strcasecmp"), + CREATE_MAP2("blue", 1, "green", 3)); + return Count(true); +} + +bool TestExtArray::test_sort() { + Variant fruits = CREATE_VECTOR4("lemon", "orange", "banana", "apple"); + f_sort(ref(fruits)); + VS(f_print_r(fruits, true), + "Array\n" + "(\n" + " [0] => apple\n" + " [1] => banana\n" + " [2] => lemon\n" + " [3] => orange\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_rsort() { + Variant fruits = CREATE_VECTOR4("lemon", "orange", "banana", "apple"); + f_rsort(ref(fruits)); + VS(f_print_r(fruits, true), + "Array\n" + "(\n" + " [0] => orange\n" + " [1] => lemon\n" + " [2] => banana\n" + " [3] => apple\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_asort() { + Variant fruits = CREATE_MAP4("d", "lemon", "a", "orange", + "b", "banana", "c", "apple"); + f_asort(ref(fruits)); + VS(f_print_r(fruits, true), + "Array\n" + "(\n" + " [c] => apple\n" + " [b] => banana\n" + " [d] => lemon\n" + " [a] => orange\n" + ")\n"); + Variant arr = CREATE_VECTOR3("at", "às", "as"); + f_i18n_loc_set_default("en_US"); + f_asort(ref(arr), 0, true); + VS(f_print_r(arr, true), + "Array\n" + "(\n" + " [0] => at\n" + " [1] => às\n" + " [2] => as\n" + ")\n"); + arr = CREATE_VECTOR3("num2ber", "num1ber", "num10ber"); + f_i18n_loc_set_default("en_US"); + f_i18n_loc_set_attribute(k_UCOL_NUMERIC_COLLATION, k_UCOL_ON); + f_i18n_loc_set_strength(k_UCOL_PRIMARY); + f_asort(ref(arr), k_SORT_REGULAR, true); + f_i18n_loc_set_attribute(k_UCOL_NUMERIC_COLLATION, k_UCOL_DEFAULT); + f_i18n_loc_set_strength(k_UCOL_DEFAULT); + VS(f_print_r(arr, true), + "Array\n" + "(\n" + " [1] => num1ber\n" + " [0] => num2ber\n" + " [2] => num10ber\n" + ")\n"); + arr = CREATE_VECTOR4("G\xediron", // í (Latin-1) + "G\xc3\xb3nzales", // ó (UTF-8) + "G\xc3\xa9 ara", // é (UTF-8) + "G\xe1rcia"); // á (Latin-1) + f_i18n_loc_set_default("en_US"); + f_i18n_loc_set_attribute(k_UCOL_NUMERIC_COLLATION, k_UCOL_ON); + f_i18n_loc_set_strength(k_UCOL_PRIMARY); + f_asort(ref(arr), k_SORT_REGULAR, true); + f_i18n_loc_set_attribute(k_UCOL_NUMERIC_COLLATION, k_UCOL_DEFAULT); + f_i18n_loc_set_strength(k_UCOL_DEFAULT); + VS(f_print_r(arr, true), + "Array\n" + "(\n" + " [0] => Gíiron\n" + " [1] => Gónzales\n" + " [2] => Gé ara\n" + " [3] => Gárcia\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_arsort() { + Variant fruits = CREATE_MAP4("d", "lemon", "a", "orange", + "b", "banana", "c", "apple"); + f_arsort(ref(fruits)); + VS(f_print_r(fruits, true), + "Array\n" + "(\n" + " [a] => orange\n" + " [d] => lemon\n" + " [b] => banana\n" + " [c] => apple\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_ksort() { + Variant fruits = CREATE_MAP4("d", "lemon", "a", "orange", + "b", "banana", "c", "apple"); + f_ksort(ref(fruits)); + VS(f_print_r(fruits, true), + "Array\n" + "(\n" + " [a] => orange\n" + " [b] => banana\n" + " [c] => apple\n" + " [d] => lemon\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_krsort() { + Variant fruits = CREATE_MAP4("d", "lemon", "a", "orange", + "b", "banana", "c", "apple"); + f_krsort(ref(fruits)); + VS(f_print_r(fruits, true), + "Array\n" + "(\n" + " [d] => lemon\n" + " [c] => apple\n" + " [b] => banana\n" + " [a] => orange\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_usort() { + { + Variant a = CREATE_VECTOR5(3, 2, 5, 6, 10); + f_usort(ref(a), "reverse_comp_func"); + VS(a, CREATE_VECTOR5(10, 6, 5, 3, 2)); + } + return Count(true); +} + +bool TestExtArray::test_uasort() { + Variant fruits = CREATE_MAP4("d", "lemon", "a", "orange", + "b", "banana", "c", "apple"); + f_uasort(ref(fruits), "reverse_strcasecmp"); + VS(f_print_r(fruits, true), + "Array\n" + "(\n" + " [a] => orange\n" + " [d] => lemon\n" + " [b] => banana\n" + " [c] => apple\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_uksort() { + Variant fruits = CREATE_MAP4("d", "lemon", "a", "orange", + "b", "banana", "c", "apple"); + f_uksort(ref(fruits), "reverse_strcasecmp"); + VS(f_print_r(fruits, true), + "Array\n" + "(\n" + " [d] => lemon\n" + " [c] => apple\n" + " [b] => banana\n" + " [a] => orange\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_natsort() { + Variant array1 = CREATE_VECTOR4("img12.png", + "img10.png", + "img2.png", + "img1.png"); + Variant array2 = array1; + f_sort(ref(array1)); + VS(f_print_r(array1, true), + "Array\n" + "(\n" + " [0] => img1.png\n" + " [1] => img10.png\n" + " [2] => img12.png\n" + " [3] => img2.png\n" + ")\n"); + + f_natsort(ref(array2)); + VS(f_print_r(array2, true), + "Array\n" + "(\n" + " [3] => img1.png\n" + " [2] => img2.png\n" + " [1] => img10.png\n" + " [0] => img12.png\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_natcasesort() { + Variant array1 = Array(NEW(ArrayElement)("IMG0.png"), + NEW(ArrayElement)("img12.png"), + NEW(ArrayElement)("img10.png"), + NEW(ArrayElement)("img2.png"), + NEW(ArrayElement)("img1.png"), + NEW(ArrayElement)("IMG3.png"), + NULL); + Variant array2 = array1; + f_sort(ref(array1)); + VS(f_print_r(array1, true), + "Array\n" + "(\n" + " [0] => IMG0.png\n" + " [1] => IMG3.png\n" + " [2] => img1.png\n" + " [3] => img10.png\n" + " [4] => img12.png\n" + " [5] => img2.png\n" + ")\n"); + + f_natcasesort(ref(array2)); + VS(f_print_r(array2, true), + "Array\n" + "(\n" + " [0] => IMG0.png\n" + " [4] => img1.png\n" + " [3] => img2.png\n" + " [5] => IMG3.png\n" + " [2] => img10.png\n" + " [1] => img12.png\n" + ")\n"); + return Count(true); +} + +bool TestExtArray::test_i18n_loc_get_default() { + VERIFY(f_i18n_loc_set_default("en_UK")); + VS(f_i18n_loc_get_default(), "en_UK"); + VERIFY(f_i18n_loc_set_default("en_US")); + VS(f_i18n_loc_get_default(), "en_US"); + return Count(true); +} diff --git a/src/test/test_ext_array.h b/src/test/test_ext_array.h new file mode 100644 index 0000000000000..fa4257775c94b --- /dev/null +++ b/src/test/test_ext_array.h @@ -0,0 +1,111 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_ARRAY_H__ +#define __TEST_EXT_ARRAY_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtArray : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_array_change_key_case(); + bool test_array_chunk(); + bool test_array_combine(); + bool test_array_count_values(); + bool test_array_fill_keys(); + bool test_array_fill(); + bool test_array_filter(); + bool test_array_flip(); + bool test_array_key_exists(); + bool test_array_keys(); + bool test_array_map(); + bool test_array_merge_recursive(); + bool test_array_merge(); + bool test_array_multisort(); + bool test_array_pad(); + bool test_array_pop(); + bool test_array_product(); + bool test_array_push(); + bool test_array_rand(); + bool test_array_reduce(); + bool test_array_reverse(); + bool test_array_search(); + bool test_array_shift(); + bool test_array_slice(); + bool test_array_splice(); + bool test_array_sum(); + bool test_array_unique(); + bool test_array_unshift(); + bool test_array_values(); + bool test_array_walk_recursive(); + bool test_array_walk(); + bool test_compact(); + bool test_shuffle(); + bool test_count(); + bool test_sizeof(); + bool test_each(); + bool test_current(); + bool test_next(); + bool test_pos(); + bool test_prev(); + bool test_reset(); + bool test_end(); + bool test_in_array(); + bool test_key(); + bool test_range(); + bool test_array_diff(); + bool test_array_udiff(); + bool test_array_diff_assoc(); + bool test_array_diff_uassoc(); + bool test_array_udiff_assoc(); + bool test_array_udiff_uassoc(); + bool test_array_diff_key(); + bool test_array_diff_ukey(); + bool test_array_intersect(); + bool test_array_uintersect(); + bool test_array_intersect_assoc(); + bool test_array_intersect_uassoc(); + bool test_array_uintersect_assoc(); + bool test_array_uintersect_uassoc(); + bool test_array_intersect_key(); + bool test_array_intersect_ukey(); + bool test_sort(); + bool test_rsort(); + bool test_asort(); + bool test_arsort(); + bool test_ksort(); + bool test_krsort(); + bool test_usort(); + bool test_uasort(); + bool test_uksort(); + bool test_natsort(); + bool test_natcasesort(); + bool test_i18n_loc_get_default(); + bool test_i18n_loc_set_default(); + bool test_i18n_loc_set_attribute(); + bool test_i18n_loc_set_strength(); + bool test_i18n_loc_get_error_code(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_ARRAY_H__ diff --git a/src/test/test_ext_bcmath.cpp b/src/test/test_ext_bcmath.cpp new file mode 100644 index 0000000000000..9cdc1b2b99bb5 --- /dev/null +++ b/src/test/test_ext_bcmath.cpp @@ -0,0 +1,98 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtBcmath::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_bcscale); + RUN_TEST(test_bcadd); + RUN_TEST(test_bcsub); + RUN_TEST(test_bccomp); + RUN_TEST(test_bcmul); + RUN_TEST(test_bcdiv); + RUN_TEST(test_bcmod); + RUN_TEST(test_bcpow); + RUN_TEST(test_bcpowmod); + RUN_TEST(test_bcsqrt); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtBcmath::test_bcscale() { + VS(f_bcdiv("105", "6.55957", 3), "16.007"); + f_bcscale(3); + VS(f_bcdiv("105", "6.55957"), "16.007"); + f_bcscale(0); + return Count(true); +} + +bool TestExtBcmath::test_bcadd() { + VS(f_bcadd("1.234", "5"), "6"); + VS(f_bcadd("1.234", "5", 4), "6.2340"); + return Count(true); +} + +bool TestExtBcmath::test_bcsub() { + VS(f_bcsub("1.234", "5"), "-3"); + VS(f_bcsub("1.234", "5", 4), "-3.7660"); + return Count(true); +} + +bool TestExtBcmath::test_bccomp() { + VS(f_bccomp("1", "2"), -1); + VS(f_bccomp("1.00001", "1", 3), 0); + VS(f_bccomp("1.00001", "1", 5), 1); + return Count(true); +} + +bool TestExtBcmath::test_bcmul() { + VS(f_bcmul("1.34747474747", "35", 3), "47.161"); + VS(f_bcmul("2", "4"), "8"); + return Count(true); +} + +bool TestExtBcmath::test_bcdiv() { + VS(f_bcdiv("105", "6.55957", 3), "16.007"); + return Count(true); +} + +bool TestExtBcmath::test_bcmod() { + VS(f_bcmod("4", "2"), "0"); + VS(f_bcmod("2", "4"), "2"); + return Count(true); +} + +bool TestExtBcmath::test_bcpow() { + VS(f_bcpow("4.2", "3", 2), "74.08"); + return Count(true); +} + +bool TestExtBcmath::test_bcpowmod() { + VS(f_bcpowmod("4", "3", "5"), "4"); + return Count(true); +} + +bool TestExtBcmath::test_bcsqrt() { + VS(f_bcsqrt("2", 3), "1.414"); + return Count(true); +} diff --git a/src/test/test_ext_bcmath.h b/src/test/test_ext_bcmath.h new file mode 100644 index 0000000000000..b02da1040799b --- /dev/null +++ b/src/test/test_ext_bcmath.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_BCMATH_H__ +#define __TEST_EXT_BCMATH_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtBcmath : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_bcscale(); + bool test_bcadd(); + bool test_bcsub(); + bool test_bccomp(); + bool test_bcmul(); + bool test_bcdiv(); + bool test_bcmod(); + bool test_bcpow(); + bool test_bcpowmod(); + bool test_bcsqrt(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_BCMATH_H__ diff --git a/src/test/test_ext_class.cpp b/src/test/test_ext_class.cpp new file mode 100644 index 0000000000000..8710790f904b3 --- /dev/null +++ b/src/test/test_ext_class.cpp @@ -0,0 +1,128 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtClass::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_get_declared_classes); + RUN_TEST(test_get_declared_interfaces); + RUN_TEST(test_class_exists); + RUN_TEST(test_interface_exists); + RUN_TEST(test_get_class_methods); + RUN_TEST(test_get_class_vars); + RUN_TEST(test_get_class); + RUN_TEST(test_get_parent_class); + RUN_TEST(test_is_a); + RUN_TEST(test_is_subclass_of); + RUN_TEST(test_method_exists); + RUN_TEST(test_property_exists); + RUN_TEST(test_get_object_vars); + RUN_TEST(test_call_user_method_array); + RUN_TEST(test_call_user_method); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// test classes are all in g_class_map defined in test_ext_function.cpp + +bool TestExtClass::test_get_declared_classes() { + Array classes = f_get_declared_classes(); + VS(classes[0], "test"); + return Count(true); +} + +bool TestExtClass::test_get_declared_interfaces() { + Array classes = f_get_declared_interfaces(); + VS(classes[0], "itestable"); + return Count(true); +} + +bool TestExtClass::test_class_exists() { + VERIFY(f_class_exists("TEst")); + return Count(true); +} + +bool TestExtClass::test_interface_exists() { + VERIFY(f_interface_exists("iTESTable")); + return Count(true); +} + +bool TestExtClass::test_get_class_methods() { + Array methods = f_get_class_methods("TEst"); + VS(methods[0], "foo"); + VS(methods[1], "func"); + VS(methods[2], "bar"); + return Count(true); +} + +bool TestExtClass::test_get_class_vars() { + Array properties = f_get_class_vars("TEst"); + VS(properties[0], "foo"); + VS(properties[1], "prop"); + VS(properties[2], "bar"); + return Count(true); +} + +bool TestExtClass::test_get_class() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtClass::test_get_parent_class() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtClass::test_is_a() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtClass::test_is_subclass_of() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtClass::test_method_exists() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtClass::test_property_exists() { + VERIFY(f_property_exists("TEst", "prop")); + return Count(true); +} + +bool TestExtClass::test_get_object_vars() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtClass::test_call_user_method_array() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtClass::test_call_user_method() { + // TestCodeRun covers this + return Count(true); +} diff --git a/src/test/test_ext_class.h b/src/test/test_ext_class.h new file mode 100644 index 0000000000000..7e7f94fd4f370 --- /dev/null +++ b/src/test/test_ext_class.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_CLASS_H__ +#define __TEST_EXT_CLASS_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtClass : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_get_declared_classes(); + bool test_get_declared_interfaces(); + bool test_class_exists(); + bool test_interface_exists(); + bool test_get_class_methods(); + bool test_get_class_vars(); + bool test_get_class(); + bool test_get_parent_class(); + bool test_is_a(); + bool test_is_subclass_of(); + bool test_method_exists(); + bool test_property_exists(); + bool test_get_object_vars(); + bool test_call_user_method_array(); + bool test_call_user_method(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_CLASS_H__ diff --git a/src/test/test_ext_ctype.cpp b/src/test/test_ext_ctype.cpp new file mode 100644 index 0000000000000..c81bc5c1c8770 --- /dev/null +++ b/src/test/test_ext_ctype.cpp @@ -0,0 +1,106 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtCtype::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_ctype_alnum); + RUN_TEST(test_ctype_alpha); + RUN_TEST(test_ctype_cntrl); + RUN_TEST(test_ctype_digit); + RUN_TEST(test_ctype_graph); + RUN_TEST(test_ctype_lower); + RUN_TEST(test_ctype_print); + RUN_TEST(test_ctype_punct); + RUN_TEST(test_ctype_space); + RUN_TEST(test_ctype_upper); + RUN_TEST(test_ctype_xdigit); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtCtype::test_ctype_alnum() { + VERIFY(f_ctype_alnum("abc123")); + VERIFY(!f_ctype_alnum("!@#$^")); + return Count(true); +} + +bool TestExtCtype::test_ctype_alpha() { + VERIFY(f_ctype_alpha("abcdef")); + VERIFY(!f_ctype_alpha("abc123")); + return Count(true); +} + +bool TestExtCtype::test_ctype_cntrl() { + VERIFY(f_ctype_cntrl("\t\n\r")); + VERIFY(!f_ctype_cntrl("abc123")); + return Count(true); +} + +bool TestExtCtype::test_ctype_digit() { + VERIFY(f_ctype_digit("123456")); + VERIFY(!f_ctype_digit("abc123")); + return Count(true); +} + +bool TestExtCtype::test_ctype_graph() { + VERIFY(f_ctype_graph("!@#$^")); + VERIFY(!f_ctype_graph("\b")); + return Count(true); +} + +bool TestExtCtype::test_ctype_lower() { + VERIFY(f_ctype_lower("abcdef")); + VERIFY(!f_ctype_lower("ABCDEF")); + return Count(true); +} + +bool TestExtCtype::test_ctype_print() { + VERIFY(f_ctype_print("!@#$^")); + VERIFY(!f_ctype_print("\b")); + return Count(true); +} + +bool TestExtCtype::test_ctype_punct() { + VERIFY(f_ctype_punct("!@#$^")); + VERIFY(!f_ctype_punct("ABCDEF")); + return Count(true); +} + +bool TestExtCtype::test_ctype_space() { + VERIFY(f_ctype_space(" ")); + VERIFY(!f_ctype_space("a ")); + return Count(true); +} + +bool TestExtCtype::test_ctype_upper() { + VERIFY(f_ctype_upper("ABCDEF")); + VERIFY(!f_ctype_upper("abcdef")); + return Count(true); +} + +bool TestExtCtype::test_ctype_xdigit() { + VERIFY(f_ctype_xdigit("ABCDEF")); + VERIFY(!f_ctype_xdigit("GHIJKL")); + return Count(true); +} diff --git a/src/test/test_ext_ctype.h b/src/test/test_ext_ctype.h new file mode 100644 index 0000000000000..6878989d02eca --- /dev/null +++ b/src/test/test_ext_ctype.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_CTYPE_H__ +#define __TEST_EXT_CTYPE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtCtype : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_ctype_alnum(); + bool test_ctype_alpha(); + bool test_ctype_cntrl(); + bool test_ctype_digit(); + bool test_ctype_graph(); + bool test_ctype_lower(); + bool test_ctype_print(); + bool test_ctype_punct(); + bool test_ctype_space(); + bool test_ctype_upper(); + bool test_ctype_xdigit(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_CTYPE_H__ diff --git a/src/test/test_ext_curl.cpp b/src/test/test_ext_curl.cpp new file mode 100644 index 0000000000000..f25c4ac55766d --- /dev/null +++ b/src/test/test_ext_curl.cpp @@ -0,0 +1,385 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace std; + +#define REQUEST_URI "http://localhost:8080/request" + +/////////////////////////////////////////////////////////////////////////////// + +class TestRequestHandler : public RequestHandler { +public: + // implementing RequestHandler + virtual void handleRequest(Transport *transport) { + transport->addHeader("ECHOED", transport->getHeader("ECHO").c_str()); + + if (transport->getMethod() == Transport::POST) { + int len = 0; + const void *data = transport->getPostData(len); + String res = "POST: "; + res += String((char*)data, len, CopyString); + transport->sendString(res); + } else { + transport->sendString("OK"); + } + } +}; + +static ServerPtr runServer() { + for (int port = 8080; port <= 8088; port++) { + try { + ServerPtr server(new TypedServer + ("127.0.0.1", port, 4)); + server->start(); + return server; + + } catch (FailedToListenException e) { + if (port == 8088) throw; + } + } + return ServerPtr(); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtCurl::RunTests(const std::string &which) { + bool ret = true; + + ServerPtr server = runServer(); + + RUN_TEST(test_curl_init); + RUN_TEST(test_curl_copy_handle); + RUN_TEST(test_curl_version); + RUN_TEST(test_curl_setopt); + RUN_TEST(test_curl_setopt_array); + RUN_TEST(test_curl_exec); + RUN_TEST(test_curl_getinfo); + RUN_TEST(test_curl_errno); + RUN_TEST(test_curl_error); + RUN_TEST(test_curl_close); + RUN_TEST(test_curl_multi_init); + RUN_TEST(test_curl_multi_add_handle); + RUN_TEST(test_curl_multi_remove_handle); + RUN_TEST(test_curl_multi_exec); + RUN_TEST(test_curl_multi_select); + RUN_TEST(test_curl_multi_getcontent); + RUN_TEST(test_curl_multi_info_read); + RUN_TEST(test_curl_multi_close); + RUN_TEST(test_evhttp_set_cache); + RUN_TEST(test_evhttp_get); + RUN_TEST(test_evhttp_post); + RUN_TEST(test_evhttp_post_gzip); + RUN_TEST(test_evhttp_async_get); + RUN_TEST(test_evhttp_async_post); + RUN_TEST(test_evhttp_recv); + + server->stop(); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtCurl::test_curl_init() { + Variant c = f_curl_init(); + VS(f_curl_errno(c), 0); + VS(f_curl_error(c), ""); + return Count(true); +} + +bool TestExtCurl::test_curl_copy_handle() { + Variant c = f_curl_init(); + f_curl_setopt(c, k_CURLOPT_URL, REQUEST_URI); + f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true); + Variant cpy = f_curl_copy_handle(c); + f_curl_close(c); // to test cpy is still working fine + Variant res = f_curl_exec(cpy); + VS(res, "OK"); + return Count(true); +} + +bool TestExtCurl::test_curl_version() { + Variant ret = f_curl_version(); + VERIFY(!ret["protocols"].toArray().empty()); + return Count(true); +} + +bool TestExtCurl::test_curl_setopt() { + Variant c = f_curl_init(); + f_curl_setopt(c, k_CURLOPT_URL, REQUEST_URI); + f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true); + Variant res = f_curl_exec(c); + VS(res, "OK"); + return Count(true); +} + +bool TestExtCurl::test_curl_setopt_array() { + Variant c = f_curl_init(); + f_curl_setopt_array + (c, + CREATE_MAP2(k_CURLOPT_URL, REQUEST_URI, + k_CURLOPT_RETURNTRANSFER, true)); + Variant res = f_curl_exec(c); + VS(res, "OK"); + return Count(true); +} + +bool TestExtCurl::test_curl_exec() { + { + Variant c = f_curl_init(REQUEST_URI); + f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true); + Variant res = f_curl_exec(c); + VS(res, "OK"); + } + { + Variant c = f_curl_init(REQUEST_URI); + f_curl_setopt(c, k_CURLOPT_WRITEFUNCTION, "curl_write_func"); + f_ob_start(); + f_curl_exec(c); + String res = f_ob_get_contents(); + VS(res, "curl_write_func called with OK"); + f_ob_end_clean(); + } + return Count(true); +} + +bool TestExtCurl::test_curl_getinfo() { + Variant c = f_curl_init(REQUEST_URI); + f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true); + f_curl_exec(c); + Variant ret = f_curl_getinfo(c); + VS(ret["url"], REQUEST_URI); + ret = f_curl_getinfo(c, k_CURLINFO_EFFECTIVE_URL); + VS(ret, REQUEST_URI); + return Count(true); +} + +bool TestExtCurl::test_curl_errno() { + Variant c = f_curl_init("http://www.thereisnosuchanurl"); + f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true); + f_curl_exec(c); + Variant err = f_curl_errno(c); + VS(err, k_CURLE_COULDNT_RESOLVE_HOST); + return Count(true); +} + +bool TestExtCurl::test_curl_error() { + Variant c = f_curl_init("http://www.thereisnosuchanurl"); + f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true); + f_curl_exec(c); + Variant err = f_curl_error(c); + VS(err, "Couldn't resolve host 'www.thereisnosuchanurl'"); + return Count(true); +} + +bool TestExtCurl::test_curl_close() { + Variant c = f_curl_init(REQUEST_URI); + f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true); + f_curl_exec(c); + f_curl_close(c); + return Count(true); +} + +bool TestExtCurl::test_curl_multi_init() { + f_curl_multi_init(); + return Count(true); +} + +bool TestExtCurl::test_curl_multi_add_handle() { + Object mh = f_curl_multi_init(); + Variant c1 = f_curl_init(REQUEST_URI); + Variant c2 = f_curl_init(REQUEST_URI); + f_curl_multi_add_handle(mh, c1); + f_curl_multi_add_handle(mh, c2); + return Count(true); +} + +bool TestExtCurl::test_curl_multi_remove_handle() { + Object mh = f_curl_multi_init(); + Variant c1 = f_curl_init(REQUEST_URI); + Variant c2 = f_curl_init(REQUEST_URI); + f_curl_multi_add_handle(mh, c1); + f_curl_multi_add_handle(mh, c2); + f_curl_multi_remove_handle(mh, c1); + return Count(true); +} + +bool TestExtCurl::test_curl_multi_exec() { + Object mh = f_curl_multi_init(); + Variant c1 = f_curl_init(REQUEST_URI); + Variant c2 = f_curl_init(REQUEST_URI); + f_curl_setopt(c1, k_CURLOPT_RETURNTRANSFER, true); + f_curl_setopt(c2, k_CURLOPT_RETURNTRANSFER, true); + f_curl_multi_add_handle(mh, c1); + f_curl_multi_add_handle(mh, c2); + + Variant still_running; + do { + f_curl_multi_exec(mh, ref(still_running)); + } while (more(still_running, 0)); + + return Count(true); +} + +bool TestExtCurl::test_curl_multi_select() { + Object mh = f_curl_multi_init(); + Variant c1 = f_curl_init(REQUEST_URI); + Variant c2 = f_curl_init(REQUEST_URI); + f_curl_multi_add_handle(mh, c1); + f_curl_multi_add_handle(mh, c2); + VS(f_curl_multi_select(mh), 0); + return Count(true); +} + +bool TestExtCurl::test_curl_multi_getcontent() { + Object mh = f_curl_multi_init(); + Variant c1 = f_curl_init(REQUEST_URI); + Variant c2 = f_curl_init(REQUEST_URI); + f_curl_setopt(c1, k_CURLOPT_RETURNTRANSFER, true); + f_curl_setopt(c2, k_CURLOPT_RETURNTRANSFER, true); + f_curl_multi_add_handle(mh, c1); + f_curl_multi_add_handle(mh, c2); + + Variant still_running; + do { + f_curl_multi_exec(mh, ref(still_running)); + } while (more(still_running, 0)); + + VS(f_curl_multi_getcontent(c1), "OK"); + VS(f_curl_multi_getcontent(c1), "OK"); + VS(f_curl_multi_getcontent(c2), "OK"); + VS(f_curl_multi_getcontent(c2), "OK"); + return Count(true); +} + +bool TestExtCurl::test_curl_multi_info_read() { + Object mh = f_curl_multi_init(); + Variant c1 = f_curl_init(REQUEST_URI); + Variant c2 = f_curl_init(REQUEST_URI); + f_curl_setopt(c1, k_CURLOPT_RETURNTRANSFER, true); + f_curl_setopt(c2, k_CURLOPT_RETURNTRANSFER, true); + f_curl_multi_add_handle(mh, c1); + f_curl_multi_add_handle(mh, c2); + + Variant still_running; + do { + f_curl_multi_exec(mh, ref(still_running)); + } while (more(still_running, 0)); + + Variant ret = f_curl_multi_info_read(mh); + VS(ret["result"], 0); + return Count(true); +} + +bool TestExtCurl::test_curl_multi_close() { + Object mh = f_curl_multi_init(); + Variant c1 = f_curl_init(REQUEST_URI); + Variant c2 = f_curl_init(REQUEST_URI); + f_curl_setopt(c1, k_CURLOPT_RETURNTRANSFER, true); + f_curl_setopt(c2, k_CURLOPT_RETURNTRANSFER, true); + f_curl_multi_add_handle(mh, c1); + f_curl_multi_add_handle(mh, c2); + + Variant still_running; + do { + f_curl_multi_exec(mh, ref(still_running)); + } while (more(still_running, 0)); + + f_curl_multi_close(mh); + return Count(true); +} + +bool TestExtCurl::test_evhttp_set_cache() { + f_evhttp_set_cache("localhost", 8080, 4); + for (int i = 0; i < 10; i++) { + Variant ret = f_evhttp_get(REQUEST_URI, CREATE_VECTOR1("ECHO: foo")); + VS(ret["code"], 200); + VS(ret["response"], "OK"); + VS(ret["headers"][0], "ECHOED: foo"); + VS(ret["headers"][3], "Content-Length: 2"); + } + + return Count(true); +} + +bool TestExtCurl::test_evhttp_get() { + Variant ret = f_evhttp_get(REQUEST_URI, CREATE_VECTOR1("ECHO: foo")); + VS(ret["code"], 200); + VS(ret["response"], "OK"); + VS(ret["headers"][0], "ECHOED: foo"); + VS(ret["headers"][3], "Content-Length: 2"); + return Count(true); +} + +bool TestExtCurl::test_evhttp_post() { + Variant ret = f_evhttp_post(REQUEST_URI, "echo", + CREATE_VECTOR1("ECHO: foo")); + VS(ret["code"], 200); + VS(ret["response"], "POST: echo"); + VS(ret["headers"][0], "ECHOED: foo"); + VS(ret["headers"][3], "Content-Length: 10"); + return Count(true); +} + +bool TestExtCurl::test_evhttp_post_gzip() { + // we fill up 2k to avoid the "oh it's < 1000 bytes, forget compression" + // logic in Transport's implementation. + char fullPostBody[2048]; + memcpy(fullPostBody, "POST: ", 6); + char* postBody = fullPostBody + 6; + memset(postBody, 'a', sizeof(fullPostBody) - 7); + fullPostBody[sizeof(fullPostBody) - 1] = '\0'; + Variant ret = f_evhttp_post(REQUEST_URI, postBody, + CREATE_VECTOR2("ECHO: foo", + "Accept-Encoding: gzip")); + VS(ret["code"], 200); + VS(ret["response"], fullPostBody); + VS(ret["headers"][0], "ECHOED: foo"); + VS(ret["headers"][1], "Content-Encoding: gzip"); + return Count(true); +} + +bool TestExtCurl::test_evhttp_async_get() { + Variant ret = f_evhttp_async_get(REQUEST_URI, CREATE_VECTOR1("ECHO: foo")); + ret = f_evhttp_recv(ret); + VS(ret["code"], 200); + VS(ret["response"], "OK"); + VS(ret["headers"][0], "ECHOED: foo"); + VS(ret["headers"][3], "Content-Length: 2"); + return Count(true); +} + +bool TestExtCurl::test_evhttp_async_post() { + Variant ret = f_evhttp_async_post(REQUEST_URI, "echo", + CREATE_VECTOR1("ECHO: foo")); + ret = f_evhttp_recv(ret); + VS(ret["code"], 200); + VS(ret["response"], "POST: echo"); + VS(ret["headers"][0], "ECHOED: foo"); + VS(ret["headers"][3], "Content-Length: 10"); + return Count(true); +} + +bool TestExtCurl::test_evhttp_recv() { + // tested in test_evhttp_async_get() and test_evhttp_async_post() + return Count(true); +} diff --git a/src/test/test_ext_curl.h b/src/test/test_ext_curl.h new file mode 100644 index 0000000000000..e69d8f3f1f9d8 --- /dev/null +++ b/src/test/test_ext_curl.h @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_CURL_H__ +#define __TEST_EXT_CURL_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtCurl : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_curl_init(); + bool test_curl_copy_handle(); + bool test_curl_version(); + bool test_curl_setopt(); + bool test_curl_setopt_array(); + bool test_curl_exec(); + bool test_curl_getinfo(); + bool test_curl_errno(); + bool test_curl_error(); + bool test_curl_close(); + bool test_curl_multi_init(); + bool test_curl_multi_add_handle(); + bool test_curl_multi_remove_handle(); + bool test_curl_multi_exec(); + bool test_curl_multi_select(); + bool test_curl_multi_getcontent(); + bool test_curl_multi_info_read(); + bool test_curl_multi_close(); + bool test_evhttp_set_cache(); + bool test_evhttp_get(); + bool test_evhttp_post(); + bool test_evhttp_post_gzip(); + bool test_evhttp_async_get(); + bool test_evhttp_async_post(); + bool test_evhttp_recv(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_CURL_H__ diff --git a/src/test/test_ext_datetime.cpp b/src/test/test_ext_datetime.cpp new file mode 100644 index 0000000000000..83f82cd7adf44 --- /dev/null +++ b/src/test/test_ext_datetime.cpp @@ -0,0 +1,555 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtDatetime::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_checkdate); + RUN_TEST(test_date_create); + RUN_TEST(test_date_date_set); + RUN_TEST(test_date_default_timezone_get); + RUN_TEST(test_date_default_timezone_set); + RUN_TEST(test_date_format); + RUN_TEST(test_date_isodate_set); + RUN_TEST(test_date_modify); + RUN_TEST(test_date_offset_get); + RUN_TEST(test_date_parse); + RUN_TEST(test_date_sun_info); + RUN_TEST(test_date_sunrise); + RUN_TEST(test_date_sunset); + RUN_TEST(test_date_time_set); + RUN_TEST(test_date_timezone_get); + RUN_TEST(test_date_timezone_set); + RUN_TEST(test_date); + RUN_TEST(test_getdate); + RUN_TEST(test_gettimeofday); + RUN_TEST(test_gmdate); + RUN_TEST(test_gmmktime); + RUN_TEST(test_gmstrftime); + RUN_TEST(test_idate); + RUN_TEST(test_localtime); + RUN_TEST(test_microtime); + RUN_TEST(test_mktime); + RUN_TEST(test_strftime); + RUN_TEST(test_strptime); + RUN_TEST(test_strtotime); + RUN_TEST(test_time); + RUN_TEST(test_timezone_abbreviations_list); + RUN_TEST(test_timezone_identifiers_list); + RUN_TEST(test_timezone_name_from_abbr); + RUN_TEST(test_timezone_name_get); + RUN_TEST(test_timezone_offset_get); + RUN_TEST(test_timezone_open); + RUN_TEST(test_timezone_transitions_get); + + return ret; +} + +#define VDT(dt, s) VS(f_date_format(dt, "Y-m-d H:i:s"), s) + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtDatetime::test_checkdate() { + VERIFY(f_checkdate(12, 31, 2000)); + VERIFY(!f_checkdate(2, 29, 2001)); + return Count(true); +} + +bool TestExtDatetime::test_date_create() { + VDT(f_date_create("2006-12-12"), "2006-12-12 00:00:00"); + VDT(f_date_create("@1170288001"), "2007-02-01 00:00:01"); + return Count(true); +} + +bool TestExtDatetime::test_date_date_set() { + Object dt = f_date_create("2006-12-12 12:34:56"); + f_date_date_set(dt, 2007, 11, 23); + VDT(dt, "2007-11-23 12:34:56"); + return Count(true); +} + +bool TestExtDatetime::test_date_default_timezone_get() { + VS(f_date_default_timezone_get(), "America/Los_Angeles"); + return Count(true); +} + +bool TestExtDatetime::test_date_default_timezone_set() { + VERIFY(f_date_default_timezone_set("Asia/Shanghai")); + VS(f_date_default_timezone_get(), "Asia/Shanghai"); + VERIFY(f_date_default_timezone_set("America/Los_Angeles")); + VS(f_date_default_timezone_get(), "America/Los_Angeles"); + return Count(true); +} + +bool TestExtDatetime::test_date_format() { + Object dt = f_date_create("@1170288001"); + VS(f_date_format(dt, "Y-m-d\\TH:i:s\\Z"), "2007-02-01T00:00:01Z"); + VS(f_date_format(dt, "Y-m-dTH:i:sZ"), "2007-02-01PDT00:00:01-28800"); + VS(DateTime(1255494072, true).toString(DateTime::Cookie), + "Wed, 14-Oct-2009 04:21:12 GMT"); + return Count(true); +} + +bool TestExtDatetime::test_date_isodate_set() { + Object dt = f_date_create("2008-08-08 00:00:00"); + f_date_isodate_set(dt, 2007, 35, 3); + VDT(dt, "2007-08-29 00:00:00"); + return Count(true); +} + +bool TestExtDatetime::test_date_modify() { + Object dt = f_date_create("2006-12-12 00:00:00"); + f_date_modify(dt, "+1 day"); + VDT(dt, "2006-12-13 00:00:00"); + return Count(true); +} + +bool TestExtDatetime::test_date_offset_get() { + VS(f_date_offset_get(f_date_create("2006-12-12")), -28800); + VS(f_date_offset_get(f_date_create("2008-08-08")), -25200); + return Count(true); +} + +bool TestExtDatetime::test_date_parse() { + VS(f_print_r(f_date_parse("2006-12-12 10:00:00.5"), true), + "Array\n" + "(\n" + " [year] => 2006\n" + " [month] => 12\n" + " [day] => 12\n" + " [hour] => 10\n" + " [minute] => 0\n" + " [second] => 0\n" + " [fraction] => 0.5\n" + " [warning_count] => 0\n" + " [warnings] => \n" + " [error_count] => 0\n" + " [errors] => \n" + " [is_localtime] => \n" + ")\n"); + return Count(true); +} + +bool TestExtDatetime::test_date_sun_info() { + VS(f_print_r(f_date_sun_info(f_strtotime("2006-12-12"), 31.7667, 35.2333), + true), + "Array\n" + "(\n" + " [sunrise] => 1165897795\n" + " [sunset] => 1165934173\n" + " [transit] => 1165915984\n" + " [civil_twilight_begin] => 1165896189\n" + " [civil_twilight_end] => 1165935779\n" + " [nautical_twilight_begin] => 1165894366\n" + " [nautical_twilight_end] => 1165937603\n" + " [astronomical_twilight_begin] => 1165892582\n" + " [astronomical_twilight_end] => 1165939386\n" + ")\n"); + return Count(true); +} + +bool TestExtDatetime::test_date_sunrise() { + /* + * calculate the sunrise time for Lisbon, Portugal + * Latitude: 38.4 North + * Longitude: 9 West + * Zenith ~= 90 + * offset: +1 GMT + */ + VS(f_date_sunrise(f_strtotime("2004-12-20"), k_SUNFUNCS_RET_STRING, + 38.4, -9, 90, 1), "08:52"); + return Count(true); +} + +bool TestExtDatetime::test_date_sunset() { + /* + * calculate the sunset time for Lisbon, Portugal + * Latitude: 38.4 North + * Longitude: 9 West + * Zenith ~= 90 + * offset: +1 GMT + */ + VS(f_date_sunset(f_strtotime("2004-12-20"), k_SUNFUNCS_RET_STRING, + 38.4, -9, 90, 1), "18:15"); + return Count(true); +} + +bool TestExtDatetime::test_date_time_set() { + Object dt = f_date_create("2006-12-12 12:34:56"); + f_date_time_set(dt, 23, 45, 12); + VDT(dt, "2006-12-12 23:45:12"); + return Count(true); +} + +bool TestExtDatetime::test_date_timezone_get() { + Object dt = f_date_create("2008-08-08 12:34:56"); + VS(f_timezone_name_get(f_date_timezone_get(dt)), "America/Los_Angeles"); + return Count(true); +} + +bool TestExtDatetime::test_date_timezone_set() { + Object dt = f_date_create("2008-08-08 12:34:56"); + f_date_timezone_set(dt, f_timezone_open("Asia/Shanghai")); + VS(f_timezone_name_get(f_date_timezone_get(dt)), "Asia/Shanghai"); + VDT(dt, "2008-08-09 03:34:56"); + return Count(true); +} + +bool TestExtDatetime::test_date() { + int d = f_strtotime("2008-09-10 12:34:56"); + + VS(f_date("l", d), "Wednesday"); + + VS(f_date("l jS \\of F Y h:i:s A", d), + "Wednesday 10th of September 2008 12:34:56 PM"); + + VS(f_date("l", f_mktime(0, 0, 0, 7, 1, 2000)), "Saturday"); + + VS(f_date(k_DATE_RFC822, d), "Wed, 10 Sep 08 12:34:56 -0700"); + + VS(f_date(k_DATE_ATOM, f_mktime(0, 0, 0, 7, 1, 2000)), + "2000-07-01T00:00:00-07:00"); + + VS(f_date("l \\t\\h\\e jS", d), "Wednesday the 10th"); + + int tomorrow = f_mktime(0,0,0, + f_date("m", d).toInt32(), + f_date("d", d).toInt32() + 1, + f_date("Y", d).toInt32()); + VS(tomorrow, 1221116400); + + int lastmonth = f_mktime(0,0,0, + f_date("m", d).toInt32() - 1, + f_date("d", d).toInt32(), + f_date("Y", d).toInt32()); + VS(lastmonth, 1218351600); + + int nextyear = f_mktime(0,0,0, + f_date("m", d).toInt32(), + f_date("d", d).toInt32(), + f_date("Y", d).toInt32() + 1); + VS(nextyear, 1252566000); + + d = f_strtotime("2001-03-10 05:16:18"); + VS(f_date("F j, Y, g:i a", d), "March 10, 2001, 5:16 am"); + VS(f_date("m.d.y", d), "03.10.01"); + VS(f_date("j, n, Y", d), "10, 3, 2001"); + VS(f_date("Ymd", d), "20010310"); + VS(f_date("h-i-s, j-m-y, it is w Day z ", d), + "05-16-18, 10-03-01, 1631 1618 6 Satam01 68 "); + VS(f_date("\\i\\t \\i\\s \\t\\h\\e jS \\d\\a\\y.", d), + "it is the 10th day."); + VS(f_date("D M j G:i:s T Y", d), "Sat Mar 10 5:16:18 PDT 2001"); + VS(f_date("H:m:s \\m \\i\\s\\ \\m\\o\\n\\t\\h", d), "05:03:18 m is month"); + VS(f_date("H:i:s", d), "05:16:18"); + + d = f_strtotime("1955-03-10 05:16:18"); + VS(f_date("Ymd", d), "19550310"); + + VS(f_date("r", -5000000000), "Tue, 23 Jul 1811 07:06:40 -0800"); + + return Count(true); +} + +bool TestExtDatetime::test_getdate() { + int d = f_strtotime("2008-09-10 12:34:56"); + + Array today = f_getdate(d); + VS(f_print_r(today, true), + "Array\n" + "(\n" + " [seconds] => 56\n" + " [minutes] => 34\n" + " [hours] => 12\n" + " [mday] => 10\n" + " [wday] => 3\n" + " [mon] => 9\n" + " [year] => 2008\n" + " [yday] => 253\n" + " [weekday] => Wednesday\n" + " [month] => September\n" + " [0] => 1221075296\n" + ")\n"); + + return Count(true); +} + +bool TestExtDatetime::test_gettimeofday() { + Array ret = f_gettimeofday(); + VS(ret.size(), 4); + VERIFY(more(ret["sec"], 1073504408)); + + VERIFY(more(f_gettimeofday(true), 1073504408.23910)); + return Count(true); +} + +bool TestExtDatetime::test_gmdate() { + int d = f_mktime(0, 0, 0, 1, 1, 1998); + VS(f_date("M d Y H:i:s", d), "Jan 01 1998 00:00:00"); + VS(f_gmdate("M d Y H:i:s", d), "Jan 01 1998 08:00:00"); + return Count(true); +} + +bool TestExtDatetime::test_gmmktime() { + int d = f_gmmktime(0, 0, 0, 1, 1, 1998); + VS(f_date("M d Y H:i:s", d), "Dec 31 1997 16:00:00"); + VS(f_gmdate("M d Y H:i:s", d), "Jan 01 1998 00:00:00"); + return Count(true); +} + +bool TestExtDatetime::test_gmstrftime() { + f_setlocale(2, k_LC_TIME, "en_US"); + int d = f_mktime(20, 0, 0, 12, 31, 98); + VS(f_strftime("%b %d %Y %H:%M:%S", d), "Dec 31 1998 20:00:00"); + VS(f_gmstrftime("%b %d %Y %H:%M:%S", d), "Jan 01 1999 04:00:00"); + int t = f_mktime(0,0,0, 6, 27, 2006); + VS(f_strftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p " + "%r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", t), + "Tue Tuesday Jun June Tue 27 Jun 2006 12:00:00 AM PDT 20 27 " + "06/27/06 27 06 2006 Jun 00 12 178 06 00 \n AM 12:00:00 AM " + "00:00 00 \t 00:00:00 2 26 26 26 2 06/27/2006 12:00:00 AM " + "06 2006 PDT -0700 %"); + return Count(true); +} + +bool TestExtDatetime::test_idate() { + int timestamp = f_strtotime("1st January 2004"); //1072915200 + + // this prints the year in a two digit format + // however, as this would start with a "0", it + // only prints "4" + VS(f_idate("y", timestamp), 4); + return Count(true); +} + +bool TestExtDatetime::test_localtime() { + int d = f_strtotime("2008-09-10 12:34:56"); + + Array localtime = f_localtime(d); + Array localtime_assoc = f_localtime(d, true); + VS(f_print_r(localtime, true), + "Array\n" + "(\n" + " [0] => 56\n" + " [1] => 34\n" + " [2] => 12\n" + " [3] => 10\n" + " [4] => 8\n" + " [5] => 108\n" + " [6] => 3\n" + " [7] => 253\n" + " [8] => 1\n" + ")\n"); + + VS(f_print_r(localtime_assoc, true), + "Array\n" + "(\n" + " [tm_sec] => 56\n" + " [tm_min] => 34\n" + " [tm_hour] => 12\n" + " [tm_mday] => 10\n" + " [tm_mon] => 8\n" + " [tm_year] => 108\n" + " [tm_wday] => 3\n" + " [tm_yday] => 253\n" + " [tm_isdst] => 1\n" + ")\n"); + + return Count(true); +} + +bool TestExtDatetime::test_microtime() { + int time_start = f_microtime(true); + VERIFY(time_start > 0); + return Count(true); +} + +bool TestExtDatetime::test_mktime() { + int lastday = f_mktime(0, 0, 0, 3, 0, 2000); + VS(f_strftime("Last day in Feb 2000 is: %d", lastday), + "Last day in Feb 2000 is: 29"); + + /** + * We are not supporting negative parameters + * lastday = f_mktime(0, 0, 0, 4, -31, 2000); + * VS(f_strftime("Last day in Feb 2000 is: %d", lastday), + * "Last day in Feb 2000 is: 29"); + */ + + VS(f_date("M-d-Y", f_mktime(0, 0, 0, 12, 32, 1997)), "Jan-01-1998"); + VS(f_date("M-d-Y", f_mktime(0, 0, 0, 13, 1, 1997)), "Jan-01-1998"); + VS(f_date("M-d-Y", f_mktime(0, 0, 0, 1, 1, 1998)), "Jan-01-1998"); + VS(f_date("M-d-Y", f_mktime(0, 0, 0, 1, 1, 98)), "Jan-01-1998"); + + return Count(true); +} + +bool TestExtDatetime::test_strftime() { + int ts = f_mktime(0, 0, 0, 8, 5, 1998); + + f_setlocale(2, k_LC_TIME, "C"); + VS(f_strftime("%A", ts), "Wednesday"); + + f_setlocale(2, k_LC_TIME, "fi_FI"); + VS(f_strftime(" in Finnish is %A,", ts), " in Finnish is keskiviikko,"); + + f_setlocale(2, k_LC_TIME, "fr_FR"); + VS(f_strftime(" in French %A and", ts), " in French mercredi and"); + + f_setlocale(2, k_LC_TIME, "de_DE"); + VS(f_strftime(" in German %A.", ts), " in German Mittwoch."); + + f_setlocale(2, k_LC_TIME, "C"); + +/* + December 2002 / January 2003 + ISOWk M Tu W Thu F Sa Su + ----- ---------------------------- + 51 16 17 18 19 20 21 22 + 52 23 24 25 26 27 28 29 + 1 30 31 1 2 3 4 5 + 2 6 7 8 9 10 11 12 + 3 13 14 15 16 17 18 19 +*/ + VS(f_strftime("%V,%G,%Y", f_strtotime("12/28/2002")), "52,2002,2002"); + VS(f_strftime("%V,%G,%Y", f_strtotime("12/30/2002")), "01,2003,2002"); + VS(f_strftime("%V,%G,%Y", f_strtotime("1/3/2003")), "01,2003,2003"); + VS(f_strftime("%V,%G,%Y", f_strtotime("1/10/2003")), "02,2003,2003"); + +/* + December 2004 / January 2005 + ISOWk M Tu W Thu F Sa Su + ----- ---------------------------- + 51 13 14 15 16 17 18 19 + 52 20 21 22 23 24 25 26 + 53 27 28 29 30 31 1 2 + 1 3 4 5 6 7 8 9 + 2 10 11 12 13 14 15 16 +*/ + VS(f_strftime("%V,%G,%Y", f_strtotime("12/23/2004")), "52,2004,2004"); + VS(f_strftime("%V,%G,%Y", f_strtotime("12/31/2004")), "53,2004,2004"); + VS(f_strftime("%V,%G,%Y", f_strtotime("1/2/2005")), "53,2004,2005"); + VS(f_strftime("%V,%G,%Y", f_strtotime("1/3/2005")), "01,2005,2005"); + + return Count(true); +} + +bool TestExtDatetime::test_strptime() { + String format = "%d/%m/%Y %H:%M:%S"; + String strf = f_strftime(format, f_strtotime("10/03/2004 15:54:19")); + VS(strf, "03/10/2004 15:54:19"); + VS(f_print_r(f_strptime(strf, format), true), + "Array\n" + "(\n" + " [tm_sec] => 19\n" + " [tm_min] => 54\n" + " [tm_hour] => 15\n" + " [tm_mday] => 3\n" + " [tm_mon] => 9\n" + " [tm_year] => 104\n" + " [tm_wday] => 0\n" + " [tm_yday] => 276\n" + " [unparsed] => \n" + ")\n"); + + return Count(true); +} + +bool TestExtDatetime::test_strtotime() { + VERIFY(more(f_strtotime("now"), 0)); + VS(f_strtotime("10 September 2000"), 968569200); + VS(f_strtotime("+1 day", 968569200), 968655600); + VS(f_strtotime("+1 week", 968569200), 969174000); + VS(f_strtotime("+1 week 2 days 4 hours 2 seconds", 968569200), 969361202); + VS(f_strtotime("next Thursday", 968569200), 968914800); + VS(f_strtotime("last Monday", 968569200), 968050800); + + String str = "Not Good"; + Variant timestamp = f_strtotime(str); + VERIFY(same(timestamp, false)); + VERIFY(same(f_strtotime(""), false)); + return Count(true); +} + +bool TestExtDatetime::test_time() { + int nextWeek = f_time() + (7 * 24 * 60 * 60); + VS(f_date("Y-m-d", nextWeek), + f_date("Y-m-d", f_strtotime("+1 week"))); + return Count(true); +} + +bool TestExtDatetime::test_timezone_abbreviations_list() { + //f_var_dump(TimeZone::GetAbbreviations()); + VERIFY(!TimeZone::GetAbbreviations().empty()); + return Count(true); +} + +bool TestExtDatetime::test_timezone_identifiers_list() { + //f_var_dump(TimeZone::GetNames()); + VERIFY(!TimeZone::GetNames().empty()); + return Count(true); +} + +bool TestExtDatetime::test_timezone_name_from_abbr() { + VS(f_timezone_name_from_abbr("CET"), "Europe/Berlin"); + VS(f_timezone_name_from_abbr("", 3600, 0), "Europe/Paris"); + return Count(true); +} + +bool TestExtDatetime::test_timezone_name_get() { + Object tz = f_timezone_open("Asia/Shanghai"); + VS(f_timezone_name_get(tz), "Asia/Shanghai"); + return Count(true); +} + +bool TestExtDatetime::test_timezone_offset_get() { + // Create two timezone objects, one for Taipei (Taiwan) and one for + // Tokyo (Japan) + Object dateTimeZoneTaipei = f_timezone_open("Asia/Taipei"); + Object dateTimeZoneJapan = f_timezone_open("Asia/Tokyo"); + + // Create two DateTime objects that will contain the same Unix timestamp, but + // have different timezones attached to them. + Object dateTimeTaipei = f_date_create("2008-08-08", dateTimeZoneTaipei); + Object dateTimeJapan = f_date_create("2008-08-08", dateTimeZoneJapan); + + VS(f_date_offset_get(dateTimeTaipei), 28800); + VS(f_date_offset_get(dateTimeJapan), 32400); + + return Count(true); +} + +bool TestExtDatetime::test_timezone_open() { + Object tz = f_timezone_open("Asia/Shanghai"); + VS(f_timezone_name_get(tz), "Asia/Shanghai"); + return Count(true); +} + +bool TestExtDatetime::test_timezone_transitions_get() { + Object timezone = f_timezone_open("CET"); + Array transitions = f_timezone_transitions_get(timezone); + VS(transitions[0]["ts"], -1693706400); + VS(transitions[0]["offset"], 7200); + VS(transitions[0]["isdst"], true); + VS(transitions[0]["abbr"], "CEST"); + return Count(true); +} diff --git a/src/test/test_ext_datetime.h b/src/test/test_ext_datetime.h new file mode 100644 index 0000000000000..0238b56e22a9b --- /dev/null +++ b/src/test/test_ext_datetime.h @@ -0,0 +1,71 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_DATETIME_H__ +#define __TEST_EXT_DATETIME_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtDatetime : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_checkdate(); + bool test_date_create(); + bool test_date_date_set(); + bool test_date_default_timezone_get(); + bool test_date_default_timezone_set(); + bool test_date_format(); + bool test_date_isodate_set(); + bool test_date_modify(); + bool test_date_offset_get(); + bool test_date_parse(); + bool test_date_sun_info(); + bool test_date_sunrise(); + bool test_date_sunset(); + bool test_date_time_set(); + bool test_date_timezone_get(); + bool test_date_timezone_set(); + bool test_date(); + bool test_getdate(); + bool test_gettimeofday(); + bool test_gmdate(); + bool test_gmmktime(); + bool test_gmstrftime(); + bool test_idate(); + bool test_localtime(); + bool test_microtime(); + bool test_mktime(); + bool test_strftime(); + bool test_strptime(); + bool test_strtotime(); + bool test_time(); + bool test_timezone_abbreviations_list(); + bool test_timezone_identifiers_list(); + bool test_timezone_name_from_abbr(); + bool test_timezone_name_get(); + bool test_timezone_offset_get(); + bool test_timezone_open(); + bool test_timezone_transitions_get(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_DATETIME_H__ diff --git a/src/test/test_ext_domdocument.cpp b/src/test/test_ext_domdocument.cpp new file mode 100644 index 0000000000000..f287be72d63f4 --- /dev/null +++ b/src/test/test_ext_domdocument.cpp @@ -0,0 +1,454 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtDomdocument::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_dom_node_append_child); + RUN_TEST(test_dom_node_clone_node); + RUN_TEST(test_dom_node_get_line_no); + RUN_TEST(test_dom_node_has_attributes); + RUN_TEST(test_dom_node_has_child_nodes); + RUN_TEST(test_dom_node_insert_before); + RUN_TEST(test_dom_node_is_default_namespace); + RUN_TEST(test_dom_node_is_same_node); + RUN_TEST(test_dom_node_is_supported); + RUN_TEST(test_dom_node_lookup_namespace_uri); + RUN_TEST(test_dom_node_lookup_prefix); + RUN_TEST(test_dom_node_normalize); + RUN_TEST(test_dom_node_remove_child); + RUN_TEST(test_dom_node_replace_child); + RUN_TEST(test_dom_node_c14n); + RUN_TEST(test_dom_node_c14n_file); + RUN_TEST(test_dom_node_get_node_path); + RUN_TEST(test_dom_attr_is_id); + RUN_TEST(test_dom_characterdata_append_data); + RUN_TEST(test_dom_characterdata_delete_data); + RUN_TEST(test_dom_characterdata_insert_data); + RUN_TEST(test_dom_characterdata_replace_data); + RUN_TEST(test_dom_characterdata_substring_data); + RUN_TEST(test_dom_text_is_whitespace_in_element_content); + RUN_TEST(test_dom_text_split_text); + RUN_TEST(test_dom_document_create_attribute); + RUN_TEST(test_dom_document_create_attribute_ns); + RUN_TEST(test_dom_document_create_cdatasection); + RUN_TEST(test_dom_document_create_comment); + RUN_TEST(test_dom_document_create_document_fragment); + RUN_TEST(test_dom_document_create_element); + RUN_TEST(test_dom_document_create_element_ns); + RUN_TEST(test_dom_document_create_entity_reference); + RUN_TEST(test_dom_document_create_processing_instruction); + RUN_TEST(test_dom_document_create_text_node); + RUN_TEST(test_dom_document_get_element_by_id); + RUN_TEST(test_dom_document_get_elements_by_tag_name); + RUN_TEST(test_dom_document_get_elements_by_tag_name_ns); + RUN_TEST(test_dom_document_import_node); + RUN_TEST(test_dom_document_load); + RUN_TEST(test_dom_document_load_html); + RUN_TEST(test_dom_document_load_html_file); + RUN_TEST(test_dom_document_load_xml); + RUN_TEST(test_dom_document_normalize_document); + RUN_TEST(test_dom_document_register_node_class); + RUN_TEST(test_dom_document_relaxng_validate_file); + RUN_TEST(test_dom_document_relaxng_validate_xml); + RUN_TEST(test_dom_document_save); + RUN_TEST(test_dom_document_save_html); + RUN_TEST(test_dom_document_save_html_file); + RUN_TEST(test_dom_document_savexml); + RUN_TEST(test_dom_document_schema_validate_file); + RUN_TEST(test_dom_document_schema_validate_xml); + RUN_TEST(test_dom_document_validate); + RUN_TEST(test_dom_document_xinclude); + RUN_TEST(test_dom_document_fragment_append_xml); + RUN_TEST(test_dom_element_get_attribute); + RUN_TEST(test_dom_element_get_attribute_node); + RUN_TEST(test_dom_element_get_attribute_node_ns); + RUN_TEST(test_dom_element_get_attribute_ns); + RUN_TEST(test_dom_element_get_elements_by_tag_name); + RUN_TEST(test_dom_element_get_elements_by_tag_name_ns); + RUN_TEST(test_dom_element_has_attribute); + RUN_TEST(test_dom_element_has_attribute_ns); + RUN_TEST(test_dom_element_remove_attribute); + RUN_TEST(test_dom_element_remove_attribute_node); + RUN_TEST(test_dom_element_remove_attribute_ns); + RUN_TEST(test_dom_element_set_attribute); + RUN_TEST(test_dom_element_set_attribute_node); + RUN_TEST(test_dom_element_set_attribute_node_ns); + RUN_TEST(test_dom_element_set_attribute_ns); + RUN_TEST(test_dom_element_set_id_attribute); + RUN_TEST(test_dom_element_set_id_attribute_node); + RUN_TEST(test_dom_element_set_id_attribute_ns); + RUN_TEST(test_dom_namednodemap_get_named_item); + RUN_TEST(test_dom_namednodemap_get_named_item_ns); + RUN_TEST(test_dom_namednodemap_item); + RUN_TEST(test_dom_nodelist_item); + RUN_TEST(test_dom_implementation_create_document); + RUN_TEST(test_dom_implementation_create_document_type); + RUN_TEST(test_dom_implementation_has_feature); + RUN_TEST(test_dom_xpath_evaluate); + RUN_TEST(test_dom_xpath_query); + RUN_TEST(test_dom_xpath_register_ns); + RUN_TEST(test_dom_xpath_register_php_functions); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtDomdocument::test_dom_node_append_child() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_clone_node() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_get_line_no() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_has_attributes() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_has_child_nodes() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_insert_before() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_is_default_namespace() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_is_same_node() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_is_supported() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_lookup_namespace_uri() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_lookup_prefix() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_normalize() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_remove_child() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_replace_child() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_c14n() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_c14n_file() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_node_get_node_path() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_attr_is_id() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_characterdata_append_data() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_characterdata_delete_data() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_characterdata_insert_data() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_characterdata_replace_data() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_characterdata_substring_data() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_text_is_whitespace_in_element_content() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_text_split_text() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_create_attribute() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_create_attribute_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_create_cdatasection() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_create_comment() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_create_document_fragment() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_create_element() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_create_element_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_create_entity_reference() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_create_processing_instruction() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_create_text_node() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_get_element_by_id() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_get_elements_by_tag_name() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_get_elements_by_tag_name_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_import_node() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_load() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_load_html() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_load_html_file() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_load_xml() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_normalize_document() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_register_node_class() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_relaxng_validate_file() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_relaxng_validate_xml() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_save() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_save_html() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_save_html_file() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_savexml() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_schema_validate_file() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_schema_validate_xml() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_validate() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_xinclude() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_document_fragment_append_xml() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_get_attribute() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_get_attribute_node() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_get_attribute_node_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_get_attribute_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_get_elements_by_tag_name() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_get_elements_by_tag_name_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_has_attribute() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_has_attribute_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_remove_attribute() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_remove_attribute_node() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_remove_attribute_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_set_attribute() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_set_attribute_node() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_set_attribute_node_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_set_attribute_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_set_id_attribute() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_set_id_attribute_node() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_element_set_id_attribute_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_namednodemap_get_named_item() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_namednodemap_get_named_item_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_namednodemap_item() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_nodelist_item() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_implementation_create_document() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_implementation_create_document_type() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_implementation_has_feature() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_xpath_evaluate() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_xpath_query() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_xpath_register_ns() { + return Count(true); +} + +bool TestExtDomdocument::test_dom_xpath_register_php_functions() { + return Count(true); +} diff --git a/src/test/test_ext_domdocument.h b/src/test/test_ext_domdocument.h new file mode 100644 index 0000000000000..84429dfd623b5 --- /dev/null +++ b/src/test/test_ext_domdocument.h @@ -0,0 +1,119 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_DOMDOCUMENT_H__ +#define __TEST_EXT_DOMDOCUMENT_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtDomdocument : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_dom_node_append_child(); + bool test_dom_node_clone_node(); + bool test_dom_node_get_line_no(); + bool test_dom_node_has_attributes(); + bool test_dom_node_has_child_nodes(); + bool test_dom_node_insert_before(); + bool test_dom_node_is_default_namespace(); + bool test_dom_node_is_same_node(); + bool test_dom_node_is_supported(); + bool test_dom_node_lookup_namespace_uri(); + bool test_dom_node_lookup_prefix(); + bool test_dom_node_normalize(); + bool test_dom_node_remove_child(); + bool test_dom_node_replace_child(); + bool test_dom_node_c14n(); + bool test_dom_node_c14n_file(); + bool test_dom_node_get_node_path(); + bool test_dom_attr_is_id(); + bool test_dom_characterdata_append_data(); + bool test_dom_characterdata_delete_data(); + bool test_dom_characterdata_insert_data(); + bool test_dom_characterdata_replace_data(); + bool test_dom_characterdata_substring_data(); + bool test_dom_text_is_whitespace_in_element_content(); + bool test_dom_text_split_text(); + bool test_dom_document_create_attribute(); + bool test_dom_document_create_attribute_ns(); + bool test_dom_document_create_cdatasection(); + bool test_dom_document_create_comment(); + bool test_dom_document_create_document_fragment(); + bool test_dom_document_create_element(); + bool test_dom_document_create_element_ns(); + bool test_dom_document_create_entity_reference(); + bool test_dom_document_create_processing_instruction(); + bool test_dom_document_create_text_node(); + bool test_dom_document_get_element_by_id(); + bool test_dom_document_get_elements_by_tag_name(); + bool test_dom_document_get_elements_by_tag_name_ns(); + bool test_dom_document_import_node(); + bool test_dom_document_load(); + bool test_dom_document_load_html(); + bool test_dom_document_load_html_file(); + bool test_dom_document_load_xml(); + bool test_dom_document_normalize_document(); + bool test_dom_document_register_node_class(); + bool test_dom_document_relaxng_validate_file(); + bool test_dom_document_relaxng_validate_xml(); + bool test_dom_document_save(); + bool test_dom_document_save_html(); + bool test_dom_document_save_html_file(); + bool test_dom_document_savexml(); + bool test_dom_document_schema_validate_file(); + bool test_dom_document_schema_validate_xml(); + bool test_dom_document_validate(); + bool test_dom_document_xinclude(); + bool test_dom_document_fragment_append_xml(); + bool test_dom_element_get_attribute(); + bool test_dom_element_get_attribute_node(); + bool test_dom_element_get_attribute_node_ns(); + bool test_dom_element_get_attribute_ns(); + bool test_dom_element_get_elements_by_tag_name(); + bool test_dom_element_get_elements_by_tag_name_ns(); + bool test_dom_element_has_attribute(); + bool test_dom_element_has_attribute_ns(); + bool test_dom_element_remove_attribute(); + bool test_dom_element_remove_attribute_node(); + bool test_dom_element_remove_attribute_ns(); + bool test_dom_element_set_attribute(); + bool test_dom_element_set_attribute_node(); + bool test_dom_element_set_attribute_node_ns(); + bool test_dom_element_set_attribute_ns(); + bool test_dom_element_set_id_attribute(); + bool test_dom_element_set_id_attribute_node(); + bool test_dom_element_set_id_attribute_ns(); + bool test_dom_namednodemap_get_named_item(); + bool test_dom_namednodemap_get_named_item_ns(); + bool test_dom_namednodemap_item(); + bool test_dom_nodelist_item(); + bool test_dom_implementation_create_document(); + bool test_dom_implementation_create_document_type(); + bool test_dom_implementation_has_feature(); + bool test_dom_xpath_evaluate(); + bool test_dom_xpath_query(); + bool test_dom_xpath_register_ns(); + bool test_dom_xpath_register_php_functions(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_DOMDOCUMENT_H__ diff --git a/src/test/test_ext_error.cpp b/src/test/test_ext_error.cpp new file mode 100644 index 0000000000000..9ff52acb3be6c --- /dev/null +++ b/src/test/test_ext_error.cpp @@ -0,0 +1,104 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtError::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_debug_backtrace); + RUN_TEST(test_debug_print_backtrace); + RUN_TEST(test_error_get_last); + RUN_TEST(test_error_log); + RUN_TEST(test_error_reporting); + RUN_TEST(test_restore_error_handler); + RUN_TEST(test_restore_exception_handler); + RUN_TEST(test_set_error_handler); + RUN_TEST(test_set_exception_handler); + RUN_TEST(test_trigger_error); + RUN_TEST(test_user_error); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtError::test_debug_backtrace() { + Array ret = f_debug_backtrace(); +#ifndef MAC_OS_X + VERIFY(ret.size() > 0); +#endif + return Count(true); +} + +bool TestExtError::test_debug_print_backtrace() { + g_context->obStart(); + f_debug_print_backtrace(); + String output = g_context->obGetContents(); + g_context->obEnd(); +#ifndef MAC_OS_X + VERIFY(strstr((const char *)output, "test_debug_print_backtrace")); +#endif + return Count(true); +} + +bool TestExtError::test_error_get_last() { + f_error_get_last(); // dry run + return Count(true); +} + +bool TestExtError::test_error_log() { + f_error_log(""); // dry run + return Count(true); +} + +bool TestExtError::test_error_reporting() { + f_error_reporting(1); // dry run + return Count(true); +} + +bool TestExtError::test_restore_error_handler() { + // tested in TestCodeRun::TestErrorHandler + return Count(true); +} + +bool TestExtError::test_restore_exception_handler() { + // tested in TestCodeRun::TestErrorHandler + return Count(true); +} + +bool TestExtError::test_set_error_handler() { + // tested in TestCodeRun::TestErrorHandler + return Count(true); +} + +bool TestExtError::test_set_exception_handler() { + // tested in TestCodeRun::TestErrorHandler + return Count(true); +} + +bool TestExtError::test_trigger_error() { + // tested in TestCodeRun::TestErrorHandler + return Count(true); +} + +bool TestExtError::test_user_error() { + // tested in TestCodeRun::TestErrorHandler + return Count(true); +} diff --git a/src/test/test_ext_error.h b/src/test/test_ext_error.h new file mode 100644 index 0000000000000..0a513d0e8fbff --- /dev/null +++ b/src/test/test_ext_error.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_ERROR_H__ +#define __TEST_EXT_ERROR_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtError : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_debug_backtrace(); + bool test_debug_print_backtrace(); + bool test_error_get_last(); + bool test_error_log(); + bool test_error_reporting(); + bool test_restore_error_handler(); + bool test_restore_exception_handler(); + bool test_set_error_handler(); + bool test_set_exception_handler(); + bool test_trigger_error(); + bool test_user_error(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_ERROR_H__ diff --git a/src/test/test_ext_fbml.cpp b/src/test/test_ext_fbml.cpp new file mode 100644 index 0000000000000..07e6e5beb0526 --- /dev/null +++ b/src/test/test_ext_fbml.cpp @@ -0,0 +1,296 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtFbml::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_fbml_tag_list_expanded_11); + RUN_TEST(test_fbml_complex_expand_tag_list_11); + RUN_TEST(test_fbml_parse_opaque_11); + RUN_TEST(test_fbml_sanitize_css_11); + RUN_TEST(test_fbml_sanitize_js_11); + RUN_TEST(test_fbml_get_tag_name_11); + RUN_TEST(test_fbml_get_children_11); + RUN_TEST(test_fbml_get_children_count_11); + RUN_TEST(test_fbml_get_children_by_name_11); + RUN_TEST(test_fbml_get_attributes_11); + RUN_TEST(test_fbml_get_attribute_11); + RUN_TEST(test_fbml_attr_to_bool_11); + RUN_TEST(test_fbml_attr_to_color_11); + RUN_TEST(test_fbml_get_text_11); + RUN_TEST(test_fbml_precache_11); + RUN_TEST(test_fbml_batch_precache_11); + RUN_TEST(test_fbml_render_children_11); + RUN_TEST(test_fbml_flatten_11); + RUN_TEST(test_html_profile); + RUN_TEST(test_fbjsparse); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtFbml::test_fbml_tag_list_expanded_11() { + VERIFY(!f_fbml_tag_list_expanded_11()); + + f_fbml_complex_expand_tag_list_11 + (CREATE_VECTOR1("fb:b"), + CREATE_VECTOR1("style"), + CREATE_VECTOR1("br"), + CREATE_VECTOR1("img"), + CREATE_VECTOR1("style"), + CREATE_VECTOR1("style"), + CREATE_VECTOR2("onclick", "onload"), + CREATE_VECTOR1("rewrite"), + CREATE_VECTOR1("special"), + CREATE_MAP1("html", CREATE_VECTOR2("fb:b", "_test"))); + + VERIFY(f_fbml_tag_list_expanded_11()); + return Count(true); +} + +bool TestExtFbml::test_fbml_complex_expand_tag_list_11() { + f_fbml_complex_expand_tag_list_11 + (CREATE_VECTOR1("fb:b"), + CREATE_VECTOR1("style"), + CREATE_VECTOR1("br"), + CREATE_VECTOR1("img"), + CREATE_VECTOR1("style"), + CREATE_VECTOR1("style"), + CREATE_VECTOR2("onclick", "onload"), + CREATE_VECTOR1("rewrite"), + CREATE_VECTOR1("special"), + CREATE_MAP1("html", CREATE_VECTOR2("fb:b", "_test"))); + return Count(true); +} + +bool TestExtFbml::test_fbml_parse_opaque_11() { + String fbml = "" + "test"; + Variant ret = f_fbml_parse_opaque_11 + (fbml, true, false, false, + CREATE_MAP3("prefix", "app123", "func", "urltr", "data", "URLDATA")); + VS(ret["error"], "CSS Error (line 1 char 19): PEUnknownProperty: 'colorr' PEDeclDropped\n"); + return Count(true); +} + +bool TestExtFbml::test_fbml_sanitize_css_11() { + String css = ".test {color:red; colorr:red; background-image: url(TESTURI)}"; + Variant ret = f_fbml_sanitize_css_11 + (css, false, 2, + CREATE_MAP3("prefix", "app123", "func", "urltr", "data", "OPAQUE")); + VS(ret, CREATE_MAP2("sanitized", "app123 .test { color: red; background-image: url(url:OPAQUE=TESTURI); }\n", + "error", "CSS Error (line 2 char 26): PEUnknownProperty: 'colorr' PEDeclDropped\n")); + return Count(true); +} + +bool TestExtFbml::test_fbml_sanitize_js_11() { + String js = "a = this.test; with(o){}"; + Variant ret = f_fbml_sanitize_js_11(js, 2, CREATE_MAP1("prefix", "app123")); + VS(ret, CREATE_MAP2("sanitized", + "app123a = (ref(this)).test;with (app123o) {}", + "error", + "JS Error (line 2): \"with\" is not supported.\n")); + return Count(true); +} + +bool TestExtFbml::test_fbml_get_tag_name_11() { + String fbml = "linktext"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + VS(f_fbml_get_tag_name_11(ret["root"]), "body"); + return Count(true); +} + +bool TestExtFbml::test_fbml_get_children_11() { + String fbml = "linktext"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + Variant children = f_fbml_get_children_11(ret["root"]); + VS(f_fbml_get_tag_name_11(children[0]), "a"); + VS(f_fbml_get_tag_name_11(children[1]), "b"); + return Count(true); +} + +bool TestExtFbml::test_fbml_get_children_count_11() { + String fbml = "linktext"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + VS(f_fbml_get_children_count_11(ret["root"]), 2); + return Count(true); +} + +bool TestExtFbml::test_fbml_get_children_by_name_11() { + String fbml = "linktext"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + Variant children = f_fbml_get_children_by_name_11(ret["root"], "a"); + VS(children.toArray().size(), 1); + VS(f_fbml_get_tag_name_11(children[0]), "a"); + return Count(true); +} + +bool TestExtFbml::test_fbml_get_attributes_11() { + String fbml = "text"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + Variant children = f_fbml_get_children_11(ret["root"]); + Object node = children[0].toObject(); + + VS(f_fbml_get_attributes_11(node), + CREATE_MAP2("href", "link", "target", "_top")); + return Count(true); +} + +bool TestExtFbml::test_fbml_get_attribute_11() { + String fbml = "text"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + Variant children = f_fbml_get_children_11(ret["root"]); + Object node = children[0].toObject(); + + VS(f_fbml_get_attribute_11(node, "target"), "_top"); + return Count(true); +} + +bool TestExtFbml::test_fbml_attr_to_bool_11() { + VS(f_fbml_attr_to_bool_11("true"), true); + VS(f_fbml_attr_to_bool_11("yes"), true); + VS(f_fbml_attr_to_bool_11("false"), false); + VS(f_fbml_attr_to_bool_11("no"), false); + return Count(true); +} + +bool TestExtFbml::test_fbml_attr_to_color_11() { + VS(f_fbml_attr_to_color_11("red"), "red"); + VS(f_fbml_attr_to_color_11("redd"), null); + return Count(true); +} + +bool TestExtFbml::test_fbml_get_text_11() { + String fbml = "text"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + Variant c = f_fbml_get_children_11(ret["root"]); + Variant d = f_fbml_get_children_11(c[0]); + VS(f_fbml_get_text_11(d[0]), "text"); + return Count(true); +} + +bool TestExtFbml::test_fbml_precache_11() { + f_fbml_complex_expand_tag_list_11 + (CREATE_VECTOR1("fb:b"), + CREATE_VECTOR1("style"), + CREATE_VECTOR1("br"), + CREATE_VECTOR1("a"), + CREATE_VECTOR1("style"), + CREATE_VECTOR1("style"), + CREATE_VECTOR2("onclick", "onload"), + CREATE_VECTOR1("rewrite"), + CREATE_VECTOR1("special"), + CREATE_MAP1("html", CREATE_VECTOR2("fb:b", "_test"))); + + String fbml = "linktext"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + f_ob_start(); + f_fbml_precache_11(ret["root"], "tag:", "precache"); + VS(f_ob_get_contents(), "tag:a"); + f_ob_end_clean(); + return Count(true); +} + +bool TestExtFbml::test_fbml_batch_precache_11() { + f_fbml_complex_expand_tag_list_11 + (CREATE_VECTOR1("fb:b"), + CREATE_VECTOR1("style"), + CREATE_VECTOR1("br"), + CREATE_VECTOR1("a"), + CREATE_VECTOR1("style"), + CREATE_VECTOR1("style"), + CREATE_VECTOR2("onclick", "onload"), + CREATE_VECTOR1("rewrite"), + CREATE_VECTOR1("special"), + CREATE_MAP1("html", CREATE_VECTOR2("fb:b", "_test"))); + + String fbml = "linktext"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + Variant precachable = f_fbml_batch_precache_11(ret["root"]); + Array nodes = precachable.toArray(); + for (ArrayIter iter(nodes); iter; ++iter) { + VS(iter.first(), "a"); + Array arr = iter.second().toArray(); + for (ArrayIter iterNode(arr); iterNode; ++iterNode) { + VS(f_fbml_get_tag_name_11(iterNode.second()), "a"); + } + } + return Count(true); +} + +bool TestExtFbml::test_fbml_render_children_11() { + String fbml = "linktext"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + VS(f_fbml_render_children_11(ret["root"], "data", "", ""), + "linktext"); + return Count(true); +} + +bool TestExtFbml::test_fbml_flatten_11() { + String fbml = "linktext"; + Variant ret = f_fbml_parse_opaque_11(fbml, true, false); + Variant children = f_fbml_get_children_11(ret["root"]); + VS(f_fbml_flatten_11(children[1]), "text"); + return Count(true); +} + +bool TestExtFbml::test_html_profile() { + VS(f_html_profile("" + "" + "" + ""), + "{ \"sizes\": {\"css\":{\"original\":67,\"pickled\":50,\"trimmed\":17}\n" + ",\"html\":{\"original\":112,\"pickled\":77,\"trimmed\":77}\n" + ",\"js\":{\"original\":68,\"pickled\":69,\"trimmed\":41}\n" + ",\"total\":{\"original\":247,\"pickled\":196,\"trimmed\":135}\n" + "}\n" + ",\n" + "\"deps\": {\"js_kept\":{\"_\":[\"useful_func\"]}\n" + ",\"css_kept\":{\"_\":[\".useful_css\"]}\n" + ",\"css_trimmed\":{\"_\":[\".useless_css\"]}\n" + ",\"js_trimmed\":{\"_\":[\"useless_func\"]}\n" + "}\n" + ",\n" + "\"errs\": {\"css\":[[\"PEUnknownProperty: 'font-color' PEDeclDropped\",\"\",\"1\",\"61\"]]}\n" + "\n" + "}\n" +); + return Count(true); +} + +bool TestExtFbml::test_fbjsparse() { + try { + f_fbjsparse(""); + } catch (NotImplementedException e) { + return Count(true); + } + return Count(false); +} diff --git a/src/test/test_ext_fbml.h b/src/test/test_ext_fbml.h new file mode 100644 index 0000000000000..7d549c83d9a89 --- /dev/null +++ b/src/test/test_ext_fbml.h @@ -0,0 +1,54 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_FBML_H__ +#define __TEST_EXT_FBML_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtFbml : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_fbml_tag_list_expanded_11(); + bool test_fbml_complex_expand_tag_list_11(); + bool test_fbml_parse_opaque_11(); + bool test_fbml_sanitize_css_11(); + bool test_fbml_sanitize_js_11(); + bool test_fbml_get_tag_name_11(); + bool test_fbml_get_children_11(); + bool test_fbml_get_children_count_11(); + bool test_fbml_get_children_by_name_11(); + bool test_fbml_get_attributes_11(); + bool test_fbml_get_attribute_11(); + bool test_fbml_attr_to_bool_11(); + bool test_fbml_attr_to_color_11(); + bool test_fbml_get_text_11(); + bool test_fbml_precache_11(); + bool test_fbml_batch_precache_11(); + bool test_fbml_render_children_11(); + bool test_fbml_flatten_11(); + bool test_html_profile(); + bool test_fbjsparse(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_FBML_H__ diff --git a/src/test/test_ext_file.cpp b/src/test/test_ext_file.cpp new file mode 100644 index 0000000000000..34bef6f0be984 --- /dev/null +++ b/src/test/test_ext_file.cpp @@ -0,0 +1,895 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtFile::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_fopen); + RUN_TEST(test_fpassthru); + RUN_TEST(test_fputcsv); + RUN_TEST(test_fputs); + RUN_TEST(test_fread); + RUN_TEST(test_fscanf); + RUN_TEST(test_fseek); + RUN_TEST(test_fstat); + RUN_TEST(test_ftell); + RUN_TEST(test_ftruncate); + RUN_TEST(test_fwrite); + RUN_TEST(test_read_write); + RUN_TEST(test_fprintf); + RUN_TEST(test_vfprintf); + RUN_TEST(test_fclose); + RUN_TEST(test_feof); + RUN_TEST(test_fflush); + RUN_TEST(test_fgetc); + RUN_TEST(test_fgetcsv); + RUN_TEST(test_fgets); + RUN_TEST(test_fgetss); + RUN_TEST(test_flock); + RUN_TEST(test_rewind); + RUN_TEST(test_popen); + RUN_TEST(test_pclose); + RUN_TEST(test_file_exists); + RUN_TEST(test_file_get_contents); + RUN_TEST(test_file_put_contents); + RUN_TEST(test_file); + RUN_TEST(test_readfile); + RUN_TEST(test_move_uploaded_file); + RUN_TEST(test_parse_ini_file); + RUN_TEST(test_md5_file); + RUN_TEST(test_sha1_file); + RUN_TEST(test_chmod); + RUN_TEST(test_chown); + RUN_TEST(test_touch); + RUN_TEST(test_copy); + RUN_TEST(test_rename); + RUN_TEST(test_umask); + RUN_TEST(test_unlink); + RUN_TEST(test_chgrp); + RUN_TEST(test_link); + RUN_TEST(test_symlink); + RUN_TEST(test_lchgrp); + RUN_TEST(test_lchown); + RUN_TEST(test_basename); + RUN_TEST(test_fnmatch); + RUN_TEST(test_glob); + RUN_TEST(test_tempnam); + RUN_TEST(test_tmpfile); + RUN_TEST(test_clearstatcache); + RUN_TEST(test_stat); + RUN_TEST(test_lstat); + RUN_TEST(test_is_dir); + RUN_TEST(test_is_executable); + RUN_TEST(test_is_file); + RUN_TEST(test_is_link); + RUN_TEST(test_is_readable); + RUN_TEST(test_is_uploaded_file); + RUN_TEST(test_is_writable); + RUN_TEST(test_is_writeable); + RUN_TEST(test_fileatime); + RUN_TEST(test_filectime); + RUN_TEST(test_filegroup); + RUN_TEST(test_fileinode); + RUN_TEST(test_filemtime); + RUN_TEST(test_fileowner); + RUN_TEST(test_fileperms); + RUN_TEST(test_filesize); + RUN_TEST(test_filetype); + RUN_TEST(test_readlink); + RUN_TEST(test_realpath); + RUN_TEST(test_linkinfo); + RUN_TEST(test_disk_free_space); + RUN_TEST(test_diskfreespace); + RUN_TEST(test_disk_total_space); + RUN_TEST(test_pathinfo); + RUN_TEST(test_mkdir); + RUN_TEST(test_rmdir); + RUN_TEST(test_dirname); + RUN_TEST(test_chdir); + RUN_TEST(test_chroot); + RUN_TEST(test_dir); + RUN_TEST(test_getcwd); + RUN_TEST(test_opendir); + RUN_TEST(test_readdir); + RUN_TEST(test_rewinddir); + RUN_TEST(test_scandir); + RUN_TEST(test_closedir); + + LightProcess::initialize(); + RUN_TEST(test_popen); + RUN_TEST(test_pclose); + LightProcess::close(); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +#define VF(f, s) \ + if (!VerifyFile(f, s)) { \ + printf("%s:%d: VerifyFile failed.\n", __FILE__, __LINE__); \ + return Count(false); \ + } \ + +bool TestExtFile::VerifyFile(CVarRef f, CStrRef contents) { + f_ob_start(); + f_fpassthru(f); + VS(f_ob_get_clean(), contents); + f_ob_end_clean(); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtFile::test_fopen() { + Variant f = f_fopen("test/test_ext_file.txt", "r"); + VERIFY(!same(f, false)); + return Count(true); +} + +bool TestExtFile::test_fpassthru() { + Variant f = f_fopen("test/test_ext_file.txt", "r"); + f_ob_start(); + VS(f_fpassthru(f), 17); + VS(f_ob_get_clean(), "Testing Ext File\n"); + f_ob_end_clean(); + return Count(true); +} + +bool TestExtFile::test_fputcsv() { + Array fields = CREATE_VECTOR2("apple", "\"banana\""); + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputcsv(f, fields); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VF(f, "apple,\"\"\"banana\"\"\"\n"); + return Count(true); +} + +bool TestExtFile::test_fputs() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing fputs"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VF(f, "testing fputs"); + return Count(true); +} + +bool TestExtFile::test_fread() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing fread"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VS(f_fread(f, 7), "testing"); + VS(f_fread(f, 100), " fread"); + return Count(true); +} + +bool TestExtFile::test_fscanf() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing fscanf"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VS(f_fscanf(2, f, "%s %s"), CREATE_VECTOR2("testing", "fscanf")); + return Count(true); +} + +bool TestExtFile::test_fseek() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing fseek"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + f_fseek(f, -5, k_SEEK_END); + VS(f_fread(f, 7), "fseek"); + + f_fseek(f, 7); + VS(f_fread(f, 7), " fseek"); + return Count(true); +} + +bool TestExtFile::test_fstat() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing fstat"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VS(f_fstat(f)["size"], 13); + return Count(true); +} + +bool TestExtFile::test_ftell() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing ftell"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + f_fseek(f, -5, k_SEEK_END); + VS(f_ftell(f), 8); + return Count(true); +} + +bool TestExtFile::test_ftruncate() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing ftruncate"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r+"); + f_ftruncate(f, 7); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VS(f_fread(f, 20), "testing"); + return Count(true); +} + +bool TestExtFile::test_fwrite() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fwrite(f, "testing fwrite", 7); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VF(f, "testing"); + return Count(true); +} + +bool TestExtFile::test_read_write() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fwrite(f, "testing read/write"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r+"); + f_fseek(f, 8); + f_fwrite(f, "succeeds"); + f_fseek(f, 8); + VS(f_fread(f, 8), "succeeds"); + return Count(true); +} + +bool TestExtFile::test_fprintf() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fprintf(4, f, "%s %s", CREATE_VECTOR2("testing", "fprintf")); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VF(f, "testing fprintf"); + return Count(true); +} + +bool TestExtFile::test_vfprintf() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_vfprintf(f, "%s %s", CREATE_VECTOR2("testing", "vfprintf")); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VF(f, "testing vfprintf"); + return Count(true); +} + +bool TestExtFile::test_fclose() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fclose(f); + return Count(true); +} + +bool TestExtFile::test_feof() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing feof"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VERIFY(!f_feof(f)); + VS(f_fread(f, 20), "testing feof"); + VERIFY(f_feof(f)); + return Count(true); +} + +bool TestExtFile::test_fflush() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing fflush"); + f_fflush(f); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VS(f_fread(f, 20), "testing fflush"); + return Count(true); +} + +bool TestExtFile::test_fgetc() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing fgetc"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VS(f_fgetc(f), "t"); + VS(f_fgetc(f), "e"); + VS(f_fgetc(f), "s"); + VS(f_fgetc(f), "t"); + return Count(true); +} + +bool TestExtFile::test_fgetcsv() { + Array fields = CREATE_VECTOR2("a", "b"); + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputcsv(f, fields); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + Array read = f_fgetcsv(f); + VS(read, fields); + return Count(true); +} + +bool TestExtFile::test_fgets() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing\nfgets\n\n"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VS(f_fgets(f), "testing\n"); + VS(f_fgets(f), "fgets\n"); + VS(f_fgets(f), "\n"); + return Count(true); +} + +bool TestExtFile::test_fgetss() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing fgetss\n"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VS(f_fgetss(f), "testing fgetss\n"); + return Count(true); +} + +bool TestExtFile::test_flock() { + Variant f = f_fopen("test/test_ext_file.tmp", "w+"); + VERIFY(f_flock(f, k_LOCK_EX)); + f_flock(f, k_LOCK_UN); + return Count(true); +} + +bool TestExtFile::test_rewind() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing rewind"); + f_fclose(f); + + f = f_fopen("test/test_ext_file.tmp", "r"); + VS(f_fread(f, 7), "testing"); + VS(f_fread(f, 100), " rewind"); + VS(f_fread(f, 7), ""); + VERIFY(f_rewind(f)); + VS(f_fread(f, 7), "testing"); + VS(f_fread(f, 100), " rewind"); + return Count(true); +} + +bool TestExtFile::test_popen() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing popen"); + f_fclose(f); + + f = f_popen("cat test/test_ext_file.tmp", "r"); + VS(f_fread(f, 20), "testing popen"); + return Count(true); +} + +bool TestExtFile::test_pclose() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing pclose"); + f_fclose(f); + + f = f_popen("cat test/test_ext_file.tmp", "r"); + VS(f_fread(f, 20), "testing pclose"); + f_pclose(f); + return Count(true); +} + +bool TestExtFile::test_file_exists() { + VERIFY(f_file_exists("test/test_ext_file.txt")); + return Count(true); +} + +bool TestExtFile::test_file_get_contents() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing file_get_contents"); + f_fclose(f); + + VS(f_file_get_contents("test/test_ext_file.tmp"), + "testing file_get_contents"); + + VS(f_unserialize(f_file_get_contents("compress.zlib://test/test_zlib_file")), + CREATE_VECTOR1("rblock:216105")); + return Count(true); +} + +bool TestExtFile::test_file_put_contents() { + f_file_put_contents("test/test_ext_file.tmp", "testing file_put_contents"); + VS(f_file_get_contents("test/test_ext_file.tmp"), + "testing file_put_contents"); + return Count(true); +} + +bool TestExtFile::test_file() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing\nfile\n"); + f_fclose(f); + + Variant items = f_file("test/test_ext_file.tmp"); + VS(items, CREATE_VECTOR2("testing\n", "file\n")); + return Count(true); +} + +bool TestExtFile::test_readfile() { + f_ob_start(); + VS(f_readfile("test/test_ext_file.txt"), 17); + VS(f_ob_get_clean(), "Testing Ext File\n"); + f_ob_end_clean(); + return Count(true); +} + +bool TestExtFile::test_move_uploaded_file() { + VS(f_move_uploaded_file("", ""), false); + return Count(true); +} + +bool TestExtFile::test_parse_ini_file() { + try { + f_parse_ini_file(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtFile::test_md5_file() { + VS(f_md5_file("test/test_ext_file.txt"), + "f53a9b64dc3846f27ee10848d0493320"); + return Count(true); +} + +bool TestExtFile::test_sha1_file() { + VS(f_sha1_file("test/test_ext_file.txt"), + "3f0f6cb904835174e35697d8262170aa060be3a5"); + return Count(true); +} + +bool TestExtFile::test_chmod() { + VERIFY(f_chmod("test/test_ext_file.txt", 0777)); + return Count(true); +} + +bool TestExtFile::test_chown() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_fputs(f, "testing\nchown\n"); + f_fclose(f); + VERIFY(f_chmod("test/test_ext_file.txt", 0777)); + //VERIFY(f_chown("test/test_ext_file.tmp", "hzhao")); + f_unlink("test/test_ext_file.tmp"); + return Count(true); +} + +bool TestExtFile::test_touch() { + if (f_file_exists("test/test_ext_file.tmp")) { + f_unlink("test/test_ext_file.tmp"); + VERIFY(!f_file_exists("test/test_ext_file.tmp")); + } + f_touch("test/test_ext_file.tmp"); + VERIFY(f_file_exists("test/test_ext_file.tmp")); + return Count(true); +} + +bool TestExtFile::test_copy() { + if (f_file_exists("test/test_ext_file2.tmp")) { + f_unlink("test/test_ext_file2.tmp"); + VERIFY(!f_file_exists("test/test_ext_file2.tmp")); + } + f_touch("test/test_ext_file.tmp"); + f_copy("test/test_ext_file.tmp", "test/test_ext_file2.tmp"); + VERIFY(f_file_exists("test/test_ext_file2.tmp")); + VERIFY(f_file_exists("test/test_ext_file.tmp")); + return Count(true); +} + +bool TestExtFile::test_rename() { + if (f_file_exists("test/test_ext_file2.tmp")) { + f_unlink("test/test_ext_file2.tmp"); + VERIFY(!f_file_exists("test/test_ext_file2.tmp")); + } + f_touch("test/test_ext_file.tmp"); + f_rename("test/test_ext_file.tmp", "test/test_ext_file2.tmp"); + VERIFY(f_file_exists("test/test_ext_file2.tmp")); + VERIFY(!f_file_exists("test/test_ext_file.tmp")); + return Count(true); +} + +bool TestExtFile::test_umask() { + f_umask(); + return Count(true); +} + +bool TestExtFile::test_unlink() { + f_touch("test/test_ext_file.tmp"); + VERIFY(f_file_exists("test/test_ext_file.tmp")); + f_unlink("test/test_ext_file.tmp"); + VERIFY(!f_file_exists("test/test_ext_file.tmp")); + return Count(true); +} + +bool TestExtFile::test_chgrp() { + f_touch("test/test_ext_file.tmp"); + f_chgrp("test/test_ext_file.tmp", "root"); + f_unlink("test/test_ext_file.tmp"); + return Count(true); +} + +bool TestExtFile::test_link() { + if (f_file_exists("test/test_ext_file2.tmp")) { + f_unlink("test/test_ext_file2.tmp"); + VERIFY(!f_file_exists("test/test_ext_file2.tmp")); + } + f_touch("test/test_ext_file.tmp"); + f_link("test/test_ext_file.tmp", "test/test_ext_file2.tmp"); + VERIFY(f_file_exists("test/test_ext_file2.tmp")); + VERIFY(f_file_exists("test/test_ext_file.tmp")); + return Count(true); +} + +bool TestExtFile::test_symlink() { + if (f_file_exists("test/test_ext_file2.tmp")) { + f_unlink("test/test_ext_file2.tmp"); + VERIFY(!f_file_exists("test/test_ext_file2.tmp")); + } + f_touch("test/test_ext_file.tmp"); + f_symlink("test/test_ext_file.tmp", "test/test_ext_file2.tmp"); + VERIFY(f_file_exists("test/test_ext_file2.tmp")); + VERIFY(f_file_exists("test/test_ext_file.tmp")); + return Count(true); +} + +bool TestExtFile::test_lchgrp() { + f_touch("test/test_ext_file.tmp"); + f_lchgrp("test/test_ext_file.tmp", "root"); + return Count(true); +} + +bool TestExtFile::test_lchown() { + f_touch("test/test_ext_file.tmp"); + f_lchown("test/test_ext_file.tmp", "root"); + return Count(true); +} + +bool TestExtFile::test_basename() { + VS(f_basename("test/test_ext_file.tmp"), "test_ext_file.tmp"); + VS(f_basename("test/test_ext_file.tmp", ".tmp"), "test_ext_file"); + return Count(true); +} + +bool TestExtFile::test_fnmatch() { + VERIFY(f_fnmatch("test/test_*_file.tmp", "test/test_ext_file.tmp")); + return Count(true); +} + +bool TestExtFile::test_glob() { + f_touch("test/test_ext_file.tmp"); + VS(f_glob("test/test_*_file.tmp"), CREATE_VECTOR1("test/test_ext_file.tmp")); + return Count(true); +} + +bool TestExtFile::test_tempnam() { + String name = f_tempnam("/tmp", "test_ext_file.tmp"); + int size = String("/tmp/test_ext_file.tmp").size(); + VERIFY(name.size() > size); + VS(name.substr(0, size), "/tmp/test_ext_file.tmp"); + unlink(name.data()); + return Count(true); +} + +bool TestExtFile::test_tmpfile() { + Variant f = f_tmpfile(); + f_fputs(f, "testing tmpfile"); + f_fclose(f); + return Count(true); +} + +bool TestExtFile::test_clearstatcache() { + f_clearstatcache(); + return Count(true); +} + +bool TestExtFile::test_stat() { + VS(f_stat("test/test_ext_file.txt")["size"], 17); + return Count(true); +} + +bool TestExtFile::test_lstat() { + VS(f_lstat("test/test_ext_file.txt")["size"], 17); + return Count(true); +} + +bool TestExtFile::test_is_dir() { + f_mkdir("test/tmp_dir"); + VERIFY(!f_is_dir("test/test_ext_file.txt")); + VERIFY(f_is_dir("test/tmp_dir")); + VERIFY(!f_is_dir("tmp_dir")); + f_chdir("test"); + VERIFY(!f_is_dir("test/tmp_dir")); + VERIFY(f_is_dir("tmp_dir")); + f_rmdir("test/tmp_dir"); + f_chdir(".."); + return Count(true); +} + +bool TestExtFile::test_is_executable() { + VERIFY(f_chmod("test/test_ext_file.txt", 0777)); + VERIFY(f_is_executable("test/test_ext_file.txt")); + return Count(true); +} + +bool TestExtFile::test_is_file() { + VERIFY(f_is_file("test/test_ext_file.txt")); + return Count(true); +} + +bool TestExtFile::test_is_link() { + VERIFY(!f_is_link("test/test_ext_file.txt")); + return Count(true); +} + +bool TestExtFile::test_is_readable() { + VERIFY(f_is_readable("test/test_ext_file.txt")); + return Count(true); +} + +bool TestExtFile::test_is_uploaded_file() { + VS(f_is_uploaded_file("test/test_ext_file.txt"), false); + return Count(true); +} + +bool TestExtFile::test_is_writable() { + VERIFY(f_is_writable("test/test_ext_file.txt")); + return Count(true); +} + +bool TestExtFile::test_is_writeable() { + VERIFY(f_is_writeable("test/test_ext_file.txt")); + return Count(true); +} + +bool TestExtFile::test_fileatime() { + VERIFY(more(f_fileatime("test/test_ext_file.txt"), 0)); + return Count(true); +} + +bool TestExtFile::test_filectime() { + VERIFY(more(f_filectime("test/test_ext_file.txt"), 0)); + return Count(true); +} + +bool TestExtFile::test_filegroup() { + VERIFY(more(f_filegroup("test/test_ext_file.txt"), 0)); + return Count(true); +} + +bool TestExtFile::test_fileinode() { + VERIFY(more(f_fileinode("test/test_ext_file.txt"), 0)); + return Count(true); +} + +bool TestExtFile::test_filemtime() { + VERIFY(more(f_filemtime("test/test_ext_file.txt"), 0)); + return Count(true); +} + +bool TestExtFile::test_fileowner() { + VERIFY(more(f_fileowner("test/test_ext_file.txt"), 0)); + return Count(true); +} + +bool TestExtFile::test_fileperms() { + VERIFY(more(f_fileperms("test/test_ext_file.txt"), 0)); + return Count(true); +} + +bool TestExtFile::test_filesize() { + VS(f_filesize("test/test_ext_file.txt"), 17); + return Count(true); +} + +bool TestExtFile::test_filetype() { + VS(f_filetype("test/test_ext_file.txt"), "file"); + return Count(true); +} + +bool TestExtFile::test_readlink() { + if (f_file_exists("test/test_ext_file2.tmp")) { + f_unlink("test/test_ext_file2.tmp"); + VERIFY(!f_file_exists("test/test_ext_file2.tmp")); + } + f_touch("test/test_ext_file.tmp"); + f_symlink("test/test_ext_file.tmp", "test/test_ext_file2.tmp"); + String resolved = f_readlink("test/test_ext_file2.tmp"); + VS(resolved.substr(resolved.size() - 22), "test/test_ext_file.tmp"); + return Count(true); +} + +bool TestExtFile::test_realpath() { + f_touch("test/test_ext_file.tmp"); + String resolved = f_realpath("test/test_ext_file.tmp"); + VERIFY(resolved.size() > 22); + VS(resolved.substr(resolved.size() - 22), "test/test_ext_file.tmp"); + return Count(true); +} + +bool TestExtFile::test_linkinfo() { + if (f_file_exists("test/test_ext_file2.tmp")) { + f_unlink("test/test_ext_file2.tmp"); + VERIFY(!f_file_exists("test/test_ext_file2.tmp")); + } + f_touch("test/test_ext_file.tmp"); + f_symlink("test/test_ext_file.tmp", "test/test_ext_file2.tmp"); + VERIFY(more(f_linkinfo("test/test_ext_file2.tmp"), 0)); + return Count(true); +} + +bool TestExtFile::test_disk_free_space() { + VERIFY(more(f_disk_free_space("test"), 0)); + return Count(true); +} + +bool TestExtFile::test_diskfreespace() { + VERIFY(more(f_diskfreespace("test"), 0)); + return Count(true); +} + +bool TestExtFile::test_disk_total_space() { + VERIFY(more(f_disk_total_space("test"), 0)); + return Count(true); +} + +bool TestExtFile::test_pathinfo() { + VS(f_print_r(f_pathinfo("test/test_ext_file.txt"), true), + "Array\n" + "(\n" + " [dirname] => test\n" + " [basename] => test_ext_file.txt\n" + " [extension] => txt\n" + " [filename] => test_ext_file\n" + ")\n"); + return Count(true); +} + +bool TestExtFile::test_mkdir() { + f_mkdir("test/tmp_dir"); + f_rmdir("test/tmp_dir"); + return Count(true); +} + +bool TestExtFile::test_rmdir() { + f_mkdir("test/tmp_dir"); + f_rmdir("test/tmp_dir"); + return Count(true); +} + +bool TestExtFile::test_dirname() { + VS(f_dirname("test/test_ext_file.txt"), "test"); + return Count(true); +} + +bool TestExtFile::test_chdir() { + f_chdir("test"); + f_chdir(".."); + return Count(true); +} + +bool TestExtFile::test_chroot() { + //f_chroot("test"); + return Count(true); +} + +bool TestExtFile::test_dir() { + Variant d = f_dir("test"); + VS(d["path"], "test"); + Variant entry; + bool seen = false; + while (!same(entry = f_readdir(d["handle"]), false)) { + if (same(entry, "test_ext_file.txt")) { + seen = true; + } + } + f_closedir(d); + VERIFY(seen); + return Count(true); +} + +bool TestExtFile::test_getcwd() { + VERIFY(!f_getcwd().toString().empty()); + return Count(true); +} + +bool TestExtFile::test_opendir() { + Variant d = f_opendir("test"); + Variant entry; + bool seen = false; + while (!same(entry = f_readdir(d), false)) { + if (same(entry, "test_ext_file.txt")) { + seen = true; + } + } + f_closedir(d); + VERIFY(seen); + return Count(true); +} + +bool TestExtFile::test_readdir() { + Variant d = f_opendir("test"); + Variant entry; + bool seen = false; + while (!same(entry = f_readdir(d), false)) { + if (same(entry, "test_ext_file.txt")) { + seen = true; + } + } + f_closedir(d); + VERIFY(seen); + return Count(true); +} + +bool TestExtFile::test_rewinddir() { + Variant d = f_opendir("test"); + Variant entry; + bool seen = false; + while (!same(entry = f_readdir(d), false)) { + if (same(entry, "test_ext_file.txt")) { + seen = true; + } + } + VERIFY(seen); + + seen = false; + f_rewinddir(d); + while (!same(entry = f_readdir(d), false)) { + if (same(entry, "test_ext_file.txt")) { + seen = true; + } + } + VERIFY(seen); + + f_closedir(d); + return Count(true); +} + +bool TestExtFile::test_scandir() { + VERIFY(!f_scandir("test").toArray().empty()); + return Count(true); +} + +bool TestExtFile::test_closedir() { + f_closedir(f_opendir("test")); + return Count(true); +} diff --git a/src/test/test_ext_file.h b/src/test/test_ext_file.h new file mode 100644 index 0000000000000..a920f9c5d002f --- /dev/null +++ b/src/test/test_ext_file.h @@ -0,0 +1,127 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_FILE_H__ +#define __TEST_EXT_FILE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtFile : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_fopen(); + bool test_popen(); + bool test_fclose(); + bool test_pclose(); + bool test_fseek(); + bool test_rewind(); + bool test_ftell(); + bool test_feof(); + bool test_fstat(); + bool test_fread(); + bool test_fgetc(); + bool test_fgets(); + bool test_fgetss(); + bool test_fscanf(); + bool test_fpassthru(); + bool test_fwrite(); + bool test_read_write(); + bool test_fputs(); + bool test_fprintf(); + bool test_vfprintf(); + bool test_fflush(); + bool test_ftruncate(); + bool test_flock(); + bool test_fputcsv(); + bool test_fgetcsv(); + bool test_file_get_contents(); + bool test_file_put_contents(); + bool test_file(); + bool test_readfile(); + bool test_move_uploaded_file(); + bool test_parse_ini_file(); + bool test_md5_file(); + bool test_sha1_file(); + bool test_chmod(); + bool test_chown(); + bool test_lchown(); + bool test_chgrp(); + bool test_lchgrp(); + bool test_touch(); + bool test_copy(); + bool test_rename(); + bool test_umask(); + bool test_unlink(); + bool test_link(); + bool test_symlink(); + bool test_basename(); + bool test_fnmatch(); + bool test_glob(); + bool test_tempnam(); + bool test_tmpfile(); + bool test_fileperms(); + bool test_fileinode(); + bool test_filesize(); + bool test_fileowner(); + bool test_filegroup(); + bool test_fileatime(); + bool test_filemtime(); + bool test_filectime(); + bool test_filetype(); + bool test_linkinfo(); + bool test_is_writable(); + bool test_is_writeable(); + bool test_is_readable(); + bool test_is_executable(); + bool test_is_file(); + bool test_is_dir(); + bool test_is_link(); + bool test_is_uploaded_file(); + bool test_file_exists(); + bool test_stat(); + bool test_lstat(); + bool test_clearstatcache(); + bool test_readlink(); + bool test_realpath(); + bool test_pathinfo(); + bool test_disk_free_space(); + bool test_diskfreespace(); + bool test_disk_total_space(); + bool test_mkdir(); + bool test_rmdir(); + bool test_dirname(); + bool test_getcwd(); + bool test_chdir(); + bool test_chroot(); + bool test_dir(); + bool test_opendir(); + bool test_readdir(); + bool test_rewinddir(); + bool test_scandir(); + bool test_closedir(); + +private: + bool VerifyFile(CVarRef f, CStrRef contents); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_FILE_H__ diff --git a/src/test/test_ext_file.txt b/src/test/test_ext_file.txt new file mode 100755 index 0000000000000..491f946ac4b83 --- /dev/null +++ b/src/test/test_ext_file.txt @@ -0,0 +1 @@ +Testing Ext File diff --git a/src/test/test_ext_function.cpp b/src/test/test_ext_function.cpp new file mode 100644 index 0000000000000..96539634c56e5 --- /dev/null +++ b/src/test/test_ext_function.cpp @@ -0,0 +1,131 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtFunction::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_get_defined_functions); + RUN_TEST(test_function_exists); + RUN_TEST(test_is_callable); + RUN_TEST(test_call_user_func_array); + RUN_TEST(test_call_user_func); + RUN_TEST(test_create_function); + RUN_TEST(test_func_get_arg); + RUN_TEST(test_func_get_args); + RUN_TEST(test_func_num_args); + RUN_TEST(test_register_postsend_function); + RUN_TEST(test_register_shutdown_function); + RUN_TEST(test_register_cleanup_function); + RUN_TEST(test_register_tick_function); + RUN_TEST(test_unregister_tick_function); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtFunction::test_get_defined_functions() { + Array funcs = f_get_defined_functions(); + VERIFY(!funcs["internal"][0].toString().empty()); + return Count(true); +} + +bool TestExtFunction::test_function_exists() { + VERIFY(f_function_exists("test")); + VERIFY(f_function_exists("TEst")); + VERIFY(!f_function_exists("fake")); + return Count(true); +} + +bool TestExtFunction::test_is_callable() { + VERIFY(f_is_callable("TEst")); + VERIFY(f_is_callable(CREATE_VECTOR2("tesT", "foo"))); + return Count(true); +} + +bool TestExtFunction::test_call_user_func_array() { + Variant ret = f_call_user_func_array("TEst", CREATE_VECTOR1("param")); + VS(ret, "param"); + return Count(true); +} + +bool TestExtFunction::test_call_user_func() { + Variant ret = f_call_user_func(1, "TEst", CREATE_VECTOR1("param")); + VS(ret, "param"); + return Count(true); +} + +bool TestExtFunction::test_create_function() { + try { + f_create_function("test", ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtFunction::test_func_get_arg() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtFunction::test_func_get_args() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtFunction::test_func_num_args() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtFunction::test_register_postsend_function() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtFunction::test_register_shutdown_function() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtFunction::test_register_cleanup_function() { + // TestCodeRun covers this + return Count(true); +} + +bool TestExtFunction::test_register_tick_function() { + try { + f_register_tick_function(0, "test", Array::Create()); + } catch (NotImplementedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtFunction::test_unregister_tick_function() { + try { + f_unregister_tick_function("test"); + } catch (NotImplementedException e) { + return Count(true); + } + return Count(false); +} diff --git a/src/test/test_ext_function.h b/src/test/test_ext_function.h new file mode 100644 index 0000000000000..1848c9751c311 --- /dev/null +++ b/src/test/test_ext_function.h @@ -0,0 +1,48 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_FUNCTION_H__ +#define __TEST_EXT_FUNCTION_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtFunction : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_get_defined_functions(); + bool test_function_exists(); + bool test_is_callable(); + bool test_call_user_func_array(); + bool test_call_user_func(); + bool test_create_function(); + bool test_func_get_arg(); + bool test_func_get_args(); + bool test_func_num_args(); + bool test_register_postsend_function(); + bool test_register_shutdown_function(); + bool test_register_cleanup_function(); + bool test_register_tick_function(); + bool test_unregister_tick_function(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_FUNCTION_H__ diff --git a/src/test/test_ext_hash.cpp b/src/test/test_ext_hash.cpp new file mode 100644 index 0000000000000..2ea2cb9a0b6f9 --- /dev/null +++ b/src/test/test_ext_hash.cpp @@ -0,0 +1,175 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtHash::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_hash); + RUN_TEST(test_hash_algos); + RUN_TEST(test_hash_init); + RUN_TEST(test_hash_file); + RUN_TEST(test_hash_final); + RUN_TEST(test_hash_hmac_file); + RUN_TEST(test_hash_hmac); + RUN_TEST(test_hash_update_file); + RUN_TEST(test_hash_update_stream); + RUN_TEST(test_hash_update); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtHash::test_hash() { + static const char *expected[] = { + "1072638ba8fc6f2ff06c251b62f426fd", + "a1e0224d596927a56c8bae416b2ef23e", + "5c6ffbdd40d9556b73a21e63c3e0e904", + "c0854fb9fb03c41cce3802cb0d220529e6eef94e", + "68b1282b91de2c054c36629cb8dd447f12f096d3e3c587978dc2248444633483", + "b7273c05ad141ccb6696b3659e57137c453b6d64690fa7d5cf96368df4a7138703a8c6ead31727b487b3628746510391", + "0a8c150176c2ba391d7f1670ef4955cd99d3c3ec8cf06198cec30d436f2ac0c9b64229b5a54bdbd5563160503ce992a74be528761da9d0c48b7c74627302eb25", + "077a3fd0a18a01cb23c3e1bede846f99", + "ec457d0a974c48d5685a7efa03d137dc8bbde7e3", + "50c51844b845b31323765ae334349dd6a94db3e5b9624540bcbfa940f6857c3f", + "67b248ca0b750028e76f09f5f9b9b746f04c228ce659f75393c83ee46b82dea011f15f465a7e4f71", + "802dc377bf6dc4f905b90cf2f1ddb39d4958526c3772bce41c03488701630eeede851f5ddc195714ea9e35311a513e31c3b616ffce5756bd963e0fdc092b2f87", + "9370512795923aaeeb76fe3d8ea7433e", + "9370512795923aaeeb76fe3d8ea7433e0697d65d", + "9370512795923aaeeb76fe3d8ea7433e0697d65d1d6b3975", + "623163ed5f7b8e35ca1c2c1beb083289", + "623163ed5f7b8e35ca1c2c1beb0832891ab00cc6", + "623163ed5f7b8e35ca1c2c1beb0832891ab00cc615ef6e6b", + "1d4ca34cc860789a2a63fab87cd6a2c3ae5ecb1df8bd3cce605ffa2de1fbd73b", + "c10eb0cb71a04377a0452a4aa64853996f73cac95f6ae434df8083d473fac944", + "5e10f17b", + "413a86af", + "4246a382", + "aa517f0b69b75146a39384ec92a02877", + "d9f46869ef2bf66602a0725c079d35a9f3ac6dd0", + "04934beab28037aae8fd658389626368530562b96c9aba89", + "41c959f1e44e931b0473c54c49080d74d49a96ea56e766af408a85fd", + "6c7c17d5784428d4d62b7f652223d64a30c78aa5f2c2c71ce780ec3f0d0ec28d", + "31147399766a068d0417390a4b9fa0c8", + "ad9aa7904f202cdfb1faf7d385d10e3de575f74c", + "1568ff7e99ca98fbeb9a2d4c0318dcc290d0eb10d064d0f6", + "94656ade22076dd122714b4168a2ed8228b554f70eca5728c5038579", + "404e1584994409ee38e0829099521168ba7c3aa1b0e82d1a72ec387fd1317ecf", + "bc0db0f23eabcd9d0c4d0a2e498b8c47", + "51341aa150d38695628491580d8d6dc9850201f7", + "da27cf4bdb2decd4731c69a017534535eecd6d9b9015fc41", + "f8a5d442ef5b82e062599fe38ddbf46999b29f0a15caa8bebabbff68", + "16e1688c75cf09338fce299455ec0f6f783ca1cbb2006203ae6ae98b23f9294a" + }; + + String data = "The quick brown fox jumped over the lazy dog."; + int i = 0; + VS(f_hash("md2", data), expected[i++]); + VS(f_hash("md4", data), expected[i++]); + VS(f_hash("md5", data), expected[i++]); + VS(f_hash("sha1", data), expected[i++]); + VS(f_hash("sha256", data), expected[i++]); + VS(f_hash("sha384", data), expected[i++]); + VS(f_hash("sha512", data), expected[i++]); + VS(f_hash("ripemd128", data), expected[i++]); + VS(f_hash("ripemd160", data), expected[i++]); + VS(f_hash("ripemd256", data), expected[i++]); + VS(f_hash("ripemd320", data), expected[i++]); + VS(f_hash("whirlpool", data), expected[i++]); + VS(f_hash("tiger128,3", data), expected[i++]); + VS(f_hash("tiger160,3", data), expected[i++]); + VS(f_hash("tiger192,3", data), expected[i++]); + VS(f_hash("tiger128,4", data), expected[i++]); + VS(f_hash("tiger160,4", data), expected[i++]); + VS(f_hash("tiger192,4", data), expected[i++]); + VS(f_hash("snefru", data), expected[i++]); + VS(f_hash("gost", data), expected[i++]); + VS(f_hash("adler32", data), expected[i++]); + VS(f_hash("crc32", data), expected[i++]); + VS(f_hash("crc32b", data), expected[i++]); + VS(f_hash("haval128,3", data), expected[i++]); + VS(f_hash("haval160,3", data), expected[i++]); + VS(f_hash("haval192,3", data), expected[i++]); + VS(f_hash("haval224,3", data), expected[i++]); + VS(f_hash("haval256,3", data), expected[i++]); + VS(f_hash("haval128,4", data), expected[i++]); + VS(f_hash("haval160,4", data), expected[i++]); + VS(f_hash("haval192,4", data), expected[i++]); + VS(f_hash("haval224,4", data), expected[i++]); + VS(f_hash("haval256,4", data), expected[i++]); + VS(f_hash("haval128,5", data), expected[i++]); + VS(f_hash("haval160,5", data), expected[i++]); + VS(f_hash("haval192,5", data), expected[i++]); + VS(f_hash("haval224,5", data), expected[i++]); + VS(f_hash("haval256,5", data), expected[i++]); + + return Count(true); +} + +bool TestExtHash::test_hash_algos() { + VERIFY(!f_hash_algos().empty()); + return Count(true); +} + +bool TestExtHash::test_hash_init() { + Object ctx = f_hash_init("md5"); + f_hash_update(ctx, "The quick brown fox "); + f_hash_update(ctx, "jumped over the lazy dog."); + VS(f_hash_final(ctx), "5c6ffbdd40d9556b73a21e63c3e0e904"); + return Count(true); +} + +bool TestExtHash::test_hash_file() { + VS(f_hash_file("md5", "test/test_hash_file.txt"), + "5c6ffbdd40d9556b73a21e63c3e0e904"); + return Count(true); +} + +bool TestExtHash::test_hash_final() { + return test_hash_init(); +} + +bool TestExtHash::test_hash_hmac_file() { + VS(f_hash_hmac_file("md5", "test/test_hash_file.txt", "secret"), + "7eb2b5c37443418fc77c136dd20e859c"); + return Count(true); +} + +bool TestExtHash::test_hash_hmac() { + VS(f_hash_hmac("ripemd160", "The quick brown fox jumped over the lazy dog.", + "secret"), + "b8e7ae12510bdfb1812e463a7f086122cf37e4f7"); + return Count(true); +} + +bool TestExtHash::test_hash_update_file() { + // this is the same as hash_update, except reading from a file + return Count(true); +} + +bool TestExtHash::test_hash_update_stream() { + // this is the same as hash_update, except reading from a stream + return Count(true); +} + +bool TestExtHash::test_hash_update() { + return test_hash_init(); +} diff --git a/src/test/test_ext_hash.h b/src/test/test_ext_hash.h new file mode 100644 index 0000000000000..67968c4bb8cbc --- /dev/null +++ b/src/test/test_ext_hash.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_HASH_H__ +#define __TEST_EXT_HASH_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtHash : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_hash(); + bool test_hash_algos(); + bool test_hash_init(); + bool test_hash_file(); + bool test_hash_final(); + bool test_hash_hmac_file(); + bool test_hash_hmac(); + bool test_hash_update_file(); + bool test_hash_update_stream(); + bool test_hash_update(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_HASH_H__ diff --git a/src/test/test_ext_iconv.cpp b/src/test/test_ext_iconv.cpp new file mode 100644 index 0000000000000..9dd6e8ebac664 --- /dev/null +++ b/src/test/test_ext_iconv.cpp @@ -0,0 +1,128 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtIconv::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_iconv_mime_encode); + RUN_TEST(test_iconv_mime_decode); + RUN_TEST(test_iconv_mime_decode_headers); + RUN_TEST(test_iconv_get_encoding); + RUN_TEST(test_iconv_set_encoding); + RUN_TEST(test_iconv); + RUN_TEST(test_iconv_strlen); + RUN_TEST(test_iconv_strpos); + RUN_TEST(test_iconv_strrpos); + RUN_TEST(test_iconv_substr); + RUN_TEST(test_ob_iconv_handler); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtIconv::test_iconv_mime_encode() { + Array preferences = CREATE_MAP4("input-charset", "ISO-8859-1", + "output-charset", "UTF-8", + "line-length", 76, + "line-break-chars", "\n"); + preferences.set("scheme", "Q"); + VS(f_iconv_mime_encode("Subject", "Pr\xDC""fung Pr\xDC""fung", preferences), + "Subject: =?UTF-8?Q?Pr=C3=9Cfung=20Pr=C3=9Cfung?="); + + preferences.set("scheme", "B"); + VS(f_iconv_mime_encode("Subject", "Pr\xDC""fung Pr\xDC""fung", preferences), + "Subject: =?UTF-8?B?UHLDnGZ1bmcgUHLDnGZ1bmc=?="); + + return Count(true); +} + +bool TestExtIconv::test_iconv_mime_decode() { + VS(f_iconv_mime_decode("Subject: =?UTF-8?B?UHLDnGZ1bmcgUHLDnGZ1bmc=?=", + 0, "ISO-8859-1"), + "Subject: Pr\xDC""fung Pr\xDC""fung"); + + return Count(true); +} + +bool TestExtIconv::test_iconv_mime_decode_headers() { + VS(f_iconv_mime_decode_headers + ("Subject: =?UTF-8?B?UHLDnGZ1bmcgUHLDnGZ1bmc=?=\n" + "Subject: =?UTF-8?B?UHLDnGZ1bmcgUHLDnGZ1bmc=?=\n", + 0, "ISO-8859-1"), + CREATE_MAP1("Subject", CREATE_VECTOR2("Pr\xDC""fung Pr\xDC""fung", + "Pr\xDC""fung Pr\xDC""fung"))); + + return Count(true); +} + +bool TestExtIconv::test_iconv_get_encoding() { + VS(f_iconv_get_encoding(), + CREATE_MAP3("input_encoding", "ISO-8859-1", + "output_encoding", "ISO-8859-1", + "internal_encoding", "ISO-8859-1")); + + return Count(true); +} + +bool TestExtIconv::test_iconv_set_encoding() { + VS(f_iconv_set_encoding("output_encoding", "UTF-8"), true); + + VS(f_iconv_get_encoding(), + CREATE_MAP3("input_encoding", "ISO-8859-1", + "output_encoding", "UTF-8", + "internal_encoding", "ISO-8859-1")); + + return Count(true); +} + +bool TestExtIconv::test_iconv() { + VS(f_iconv("UTF-8", "BIG5", "\xE2\x82\xAC"), "\xa3\xe1"); + VS(f_iconv("ISO-8859-1", "UTF-8", "Pr\xDC""fung"), "Pr\xC3\x9C""fung"); + return Count(true); +} + +bool TestExtIconv::test_iconv_strlen() { + VS(f_iconv_strlen("Pr\xDC""fung", "ISO-8859-1"), 7); + VS(f_iconv_strlen("Pr\xC3\x9C""fung", "UTF-8"), 7); + return Count(true); +} + +bool TestExtIconv::test_iconv_strpos() { + VS(f_iconv_strpos("Pr\xC3\x9C\xC3\x9D""fung", "\xC3\x9D", 0, "UTF-8"), 3); + return Count(true); +} + +bool TestExtIconv::test_iconv_strrpos() { + VS(f_iconv_strrpos("Pr\xC3\x9C""abc\xC3\x9C""fung", "\xC3\x9C", "UTF-8"), 6); + return Count(true); +} + +bool TestExtIconv::test_iconv_substr() { + VS(f_iconv_substr("Pr\xC3\x9C\xC3\x9D""fung", 2, 2, "UTF-8"), + "\xC3\x9C\xC3\x9D"); + return Count(true); +} + +bool TestExtIconv::test_ob_iconv_handler() { + // TODO: test this in TestServer + return Count(true); +} diff --git a/src/test/test_ext_iconv.h b/src/test/test_ext_iconv.h new file mode 100644 index 0000000000000..12740aeb563a7 --- /dev/null +++ b/src/test/test_ext_iconv.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_ICONV_H__ +#define __TEST_EXT_ICONV_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtIconv : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_iconv_mime_encode(); + bool test_iconv_mime_decode(); + bool test_iconv_mime_decode_headers(); + bool test_iconv_get_encoding(); + bool test_iconv_set_encoding(); + bool test_iconv(); + bool test_iconv_strlen(); + bool test_iconv_strpos(); + bool test_iconv_strrpos(); + bool test_iconv_substr(); + bool test_ob_iconv_handler(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_ICONV_H__ diff --git a/src/test/test_ext_icu.cpp b/src/test/test_ext_icu.cpp new file mode 100644 index 0000000000000..e997ad7b58950 --- /dev/null +++ b/src/test/test_ext_icu.cpp @@ -0,0 +1,63 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtIcu::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_icu_transliterate); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +// Test string lifted from tests/intl/utf8.h +bool TestExtIcu::test_icu_transliterate() { + String input_ru = + String("\xd1\x84\xd0\xb5\xd0\xb9\xd1" + "\x81\xd0\xb1\xd1\x83\xc5\x93\xd0\xba", + CopyString); + String output_ru = f_icu_transliterate(input_ru, false); + // Note: different than php test ('y' -> 'j') + VERIFY(output_ru == "fejsbu\xc5\x93k"); + + // Verify that removing accents works. + String input_de = String("Ich m\xc3\xb6" + "chte \xc3\xbc" + "berzeugend " + "oder \xc3\xa4hnliche sein", + CopyString); + String output_de = f_icu_transliterate(input_de, true); + VERIFY(output_de == "Ich mochte uberzeugend oder ahnliche sein"); + + // Verify that keeping accents works. + VERIFY(f_icu_transliterate(input_de, false) == (const char*)input_de); + + // Check an non-Latin language. + String input_zh = String("\xe5\x9b\x9b" + "\xe5\x8d\x81\xe5\x9b\x9b\xe7" + "\x9f\xb3\xe7\x8d\x85\xe5\xad\x90", + CopyString); + String output_zh = f_icu_transliterate(input_zh, true); + VERIFY(output_zh == "si shi si shi shi zi"); + + return Count(true); +} diff --git a/src/test/test_ext_icu.h b/src/test/test_ext_icu.h new file mode 100644 index 0000000000000..54ec9b098422f --- /dev/null +++ b/src/test/test_ext_icu.h @@ -0,0 +1,35 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_ICU_H__ +#define __TEST_EXT_ICU_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtIcu : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_icu_transliterate(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_ICU_H__ diff --git a/src/test/test_ext_idn.cpp b/src/test/test_ext_idn.cpp new file mode 100644 index 0000000000000..cdcfb0eef8b53 --- /dev/null +++ b/src/test/test_ext_idn.cpp @@ -0,0 +1,77 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtIdn::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_idn_to_ascii); + RUN_TEST(test_idn_to_unicode); + RUN_TEST(test_idn_to_utf8); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtIdn::test_idn_to_ascii() { + Variant errorcode; + VS(f_idn_to_ascii("www.m\xc3\xa5nsjonasson.se", errorcode), + "www.xn--mnsjonasson-x8a.se"); + VS(f_idn_to_ascii("www.facebook.com", errorcode), + "www.facebook.com"); + VS(f_idn_to_ascii("www.xn--m\xc3\xa5nsjonasson.se", errorcode), + false); + VS(f_idn_to_ascii("www.12345678901234567890123456789" + "012345678901234m\xc3\xa5nsjonasson.se", errorcode), + "www.xn--123456789012345678901234567890123456789" + "01234mnsjonasson-5we.se"); + VS(f_idn_to_ascii("www.12345678901234567890123456789" + "0123456789012345m\xc3\xa5nsjonasson.se", errorcode), + false); + return Count(true); +} + +bool TestExtIdn::test_idn_to_unicode() { + Variant errorcode; + VS(f_idn_to_unicode("www.xn--mnsjonasson-x8a.se", errorcode), + "www.m\xc3\xa5nsjonasson.se"); + VS(f_idn_to_unicode("www.facebook.com", errorcode), + "www.facebook.com"); + VS(f_idn_to_unicode("www.xn--12345678901234567890123456789" + "012345678901234mnsjonasson-5we.se", errorcode), + "www.12345678901234567890123456789" + "012345678901234m\xc3\xa5nsjonasson.se"); + return Count(true); +} + +bool TestExtIdn::test_idn_to_utf8() { + Variant errorcode; + VS(f_idn_to_utf8("www.xn--mnsjonasson-x8a.se", errorcode), + "www.m\xc3\xa5nsjonasson.se"); + VS(f_idn_to_utf8("www.facebook.com", errorcode), + "www.facebook.com"); + VS(f_idn_to_utf8("www.xn--12345678901234567890123456789" + "012345678901234mnsjonasson-5we.se", errorcode), + "www.12345678901234567890123456789" + "012345678901234m\xc3\xa5nsjonasson.se"); + return Count(true); +} + diff --git a/src/test/test_ext_idn.h b/src/test/test_ext_idn.h new file mode 100644 index 0000000000000..e7f18c3460652 --- /dev/null +++ b/src/test/test_ext_idn.h @@ -0,0 +1,37 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_IDN_H__ +#define __TEST_EXT_IDN_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtIdn : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_idn_to_ascii(); + bool test_idn_to_unicode(); + bool test_idn_to_utf8(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_IDN_H__ diff --git a/src/test/test_ext_image.cpp b/src/test/test_ext_image.cpp new file mode 100644 index 0000000000000..6045b6100c20a --- /dev/null +++ b/src/test/test_ext_image.cpp @@ -0,0 +1,670 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtImage::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_gd_info); + RUN_TEST(test_getimagesize); + RUN_TEST(test_image_type_to_extension); + RUN_TEST(test_image_type_to_mime_type); + RUN_TEST(test_image2wbmp); + RUN_TEST(test_imagealphablending); + RUN_TEST(test_imageantialias); + RUN_TEST(test_imagearc); + RUN_TEST(test_imagechar); + RUN_TEST(test_imagecharup); + RUN_TEST(test_imagecolorallocate); + RUN_TEST(test_imagecolorallocatealpha); + RUN_TEST(test_imagecolorat); + RUN_TEST(test_imagecolorclosest); + RUN_TEST(test_imagecolorclosestalpha); + RUN_TEST(test_imagecolorclosesthwb); + RUN_TEST(test_imagecolordeallocate); + RUN_TEST(test_imagecolorexact); + RUN_TEST(test_imagecolorexactalpha); + RUN_TEST(test_imagecolormatch); + RUN_TEST(test_imagecolorresolve); + RUN_TEST(test_imagecolorresolvealpha); + RUN_TEST(test_imagecolorset); + RUN_TEST(test_imagecolorsforindex); + RUN_TEST(test_imagecolorstotal); + RUN_TEST(test_imagecolortransparent); + RUN_TEST(test_imageconvolution); + RUN_TEST(test_imagecopy); + RUN_TEST(test_imagecopymerge); + RUN_TEST(test_imagecopymergegray); + RUN_TEST(test_imagecopyresampled); + RUN_TEST(test_imagecopyresized); + RUN_TEST(test_imagecreate); + RUN_TEST(test_imagecreatefromgd2part); + RUN_TEST(test_imagecreatefromgd); + RUN_TEST(test_imagecreatefromgd2); + RUN_TEST(test_imagecreatefromgif); + RUN_TEST(test_imagecreatefromjpeg); + RUN_TEST(test_imagecreatefrompng); + RUN_TEST(test_imagecreatefromstring); + RUN_TEST(test_imagecreatefromwbmp); + RUN_TEST(test_imagecreatefromxbm); + RUN_TEST(test_imagecreatefromxpm); + RUN_TEST(test_imagecreatetruecolor); + RUN_TEST(test_imagedashedline); + RUN_TEST(test_imagedestroy); + RUN_TEST(test_imageellipse); + RUN_TEST(test_imagefill); + RUN_TEST(test_imagefilledarc); + RUN_TEST(test_imagefilledellipse); + RUN_TEST(test_imagefilledpolygon); + RUN_TEST(test_imagefilledrectangle); + RUN_TEST(test_imagefilltoborder); + RUN_TEST(test_imagefilter); + RUN_TEST(test_imagefontheight); + RUN_TEST(test_imagefontwidth); + RUN_TEST(test_imageftbbox); + RUN_TEST(test_imagefttext); + RUN_TEST(test_imagegammacorrect); + RUN_TEST(test_imagegd2); + RUN_TEST(test_imagegd); + RUN_TEST(test_imagegif); + RUN_TEST(test_imagegrabscreen); + RUN_TEST(test_imagegrabwindow); + RUN_TEST(test_imageinterlace); + RUN_TEST(test_imageistruecolor); + RUN_TEST(test_imagejpeg); + RUN_TEST(test_imagelayereffect); + RUN_TEST(test_imageline); + RUN_TEST(test_imageloadfont); + RUN_TEST(test_imagepalettecopy); + RUN_TEST(test_imagepng); + RUN_TEST(test_imagepolygon); + RUN_TEST(test_imagepsbbox); + RUN_TEST(test_imagepsencodefont); + RUN_TEST(test_imagepsextendfont); + RUN_TEST(test_imagepsfreefont); + RUN_TEST(test_imagepsloadfont); + RUN_TEST(test_imagepsslantfont); + RUN_TEST(test_imagepstext); + RUN_TEST(test_imagerectangle); + RUN_TEST(test_imagerotate); + RUN_TEST(test_imagesavealpha); + RUN_TEST(test_imagesetbrush); + RUN_TEST(test_imagesetpixel); + RUN_TEST(test_imagesetstyle); + RUN_TEST(test_imagesetthickness); + RUN_TEST(test_imagesettile); + RUN_TEST(test_imagestring); + RUN_TEST(test_imagestringup); + RUN_TEST(test_imagesx); + RUN_TEST(test_imagesy); + RUN_TEST(test_imagetruecolortopalette); + RUN_TEST(test_imagettfbbox); + RUN_TEST(test_imagettftext); + RUN_TEST(test_imagetypes); + RUN_TEST(test_imagewbmp); + RUN_TEST(test_imagexbm); + RUN_TEST(test_iptcembed); + RUN_TEST(test_iptcparse); + RUN_TEST(test_jpeg2wbmp); + RUN_TEST(test_png2wbmp); + RUN_TEST(test_exif_imagetype); + RUN_TEST(test_exif_read_data); + RUN_TEST(test_read_exif_data); + RUN_TEST(test_exif_tagname); + RUN_TEST(test_exif_thumbnail); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtImage::test_gd_info() { + //VCB(">>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtImage : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_gd_info(); + bool test_getimagesize(); + bool test_image_type_to_extension(); + bool test_image_type_to_mime_type(); + bool test_image2wbmp(); + bool test_imagealphablending(); + bool test_imageantialias(); + bool test_imagearc(); + bool test_imagechar(); + bool test_imagecharup(); + bool test_imagecolorallocate(); + bool test_imagecolorallocatealpha(); + bool test_imagecolorat(); + bool test_imagecolorclosest(); + bool test_imagecolorclosestalpha(); + bool test_imagecolorclosesthwb(); + bool test_imagecolordeallocate(); + bool test_imagecolorexact(); + bool test_imagecolorexactalpha(); + bool test_imagecolormatch(); + bool test_imagecolorresolve(); + bool test_imagecolorresolvealpha(); + bool test_imagecolorset(); + bool test_imagecolorsforindex(); + bool test_imagecolorstotal(); + bool test_imagecolortransparent(); + bool test_imageconvolution(); + bool test_imagecopy(); + bool test_imagecopymerge(); + bool test_imagecopymergegray(); + bool test_imagecopyresampled(); + bool test_imagecopyresized(); + bool test_imagecreate(); + bool test_imagecreatefromgd2part(); + bool test_imagecreatefromgd(); + bool test_imagecreatefromgd2(); + bool test_imagecreatefromgif(); + bool test_imagecreatefromjpeg(); + bool test_imagecreatefrompng(); + bool test_imagecreatefromstring(); + bool test_imagecreatefromwbmp(); + bool test_imagecreatefromxbm(); + bool test_imagecreatefromxpm(); + bool test_imagecreatetruecolor(); + bool test_imagedashedline(); + bool test_imagedestroy(); + bool test_imageellipse(); + bool test_imagefill(); + bool test_imagefilledarc(); + bool test_imagefilledellipse(); + bool test_imagefilledpolygon(); + bool test_imagefilledrectangle(); + bool test_imagefilltoborder(); + bool test_imagefilter(); + bool test_imagefontheight(); + bool test_imagefontwidth(); + bool test_imageftbbox(); + bool test_imagefttext(); + bool test_imagegammacorrect(); + bool test_imagegd2(); + bool test_imagegd(); + bool test_imagegif(); + bool test_imagegrabscreen(); + bool test_imagegrabwindow(); + bool test_imageinterlace(); + bool test_imageistruecolor(); + bool test_imagejpeg(); + bool test_imagelayereffect(); + bool test_imageline(); + bool test_imageloadfont(); + bool test_imagepalettecopy(); + bool test_imagepng(); + bool test_imagepolygon(); + bool test_imagepsbbox(); + bool test_imagepsencodefont(); + bool test_imagepsextendfont(); + bool test_imagepsfreefont(); + bool test_imagepsloadfont(); + bool test_imagepsslantfont(); + bool test_imagepstext(); + bool test_imagerectangle(); + bool test_imagerotate(); + bool test_imagesavealpha(); + bool test_imagesetbrush(); + bool test_imagesetpixel(); + bool test_imagesetstyle(); + bool test_imagesetthickness(); + bool test_imagesettile(); + bool test_imagestring(); + bool test_imagestringup(); + bool test_imagesx(); + bool test_imagesy(); + bool test_imagetruecolortopalette(); + bool test_imagettfbbox(); + bool test_imagettftext(); + bool test_imagetypes(); + bool test_imagewbmp(); + bool test_imagexbm(); + bool test_iptcembed(); + bool test_iptcparse(); + bool test_jpeg2wbmp(); + bool test_png2wbmp(); + bool test_exif_imagetype(); + bool test_exif_read_data(); + bool test_read_exif_data(); + bool test_exif_tagname(); + bool test_exif_thumbnail(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_IMAGE_H__ diff --git a/src/test/test_ext_ipc.cpp b/src/test/test_ext_ipc.cpp new file mode 100644 index 0000000000000..52946060f1fd2 --- /dev/null +++ b/src/test/test_ext_ipc.cpp @@ -0,0 +1,180 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtIpc::RunTests(const std::string &which) { + bool ret = true; + + /* + RUN_TEST(test_ftok); + RUN_TEST(test_msg_get_queue); + RUN_TEST(test_msg_send); + RUN_TEST(test_msg_receive); + RUN_TEST(test_msg_remove_queue); + RUN_TEST(test_msg_set_queue); + RUN_TEST(test_msg_stat_queue); + RUN_TEST(test_sem_acquire); + RUN_TEST(test_sem_get); + RUN_TEST(test_sem_release); + RUN_TEST(test_sem_remove); + RUN_TEST(test_shm_attach); + RUN_TEST(test_shm_detach); + RUN_TEST(test_shm_remove); + RUN_TEST(test_shm_get_var); + RUN_TEST(test_shm_put_var); + RUN_TEST(test_shm_remove_var); + */ + RUN_TEST(test_message_queue); + RUN_TEST(test_semaphore); + RUN_TEST(test_shared_memory); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtIpc::test_message_queue() { + char filename[64]; + strcpy(filename, "/tmp/XXXXXX"); + close(mkstemp(filename)); + + int64 token = f_ftok(filename, "a"); + Object queue = f_msg_get_queue(token); + VERIFY(queue.get()); + + int pid = fork(); + if (pid == 0) { + Object q = f_msg_get_queue(token); + assert(q.get()); + assert(f_msg_send(q, 2, "start")); + Variant type, msg; + assert(f_msg_receive(q, 1, ref(type), 100, ref(msg))); + assert(f_msg_send(q, 2, msg)); // echo + _exit(-1); + } + + Variant type, msg; + VERIFY(f_msg_receive(queue, 2, ref(type), 100, ref(msg))); + VERIFY(same(msg, "start")); + + VERIFY(f_msg_send(queue, 1, "ok")); + VERIFY(f_msg_receive(queue, 2, ref(type), 100, ref(msg))); + VERIFY(same(msg, "ok")); + + Array ret = f_msg_stat_queue(queue); + VS(ret["msg_qnum"], 0); + f_msg_set_queue(queue, CREATE_MAP1("msg_perm.mode", 0666)); + + f_msg_remove_queue(queue); + int status = -1; + wait(&status); + return Count(true); +} + +bool TestExtIpc::test_ftok() { return test_message_queue();} +bool TestExtIpc::test_msg_get_queue() { return test_message_queue();} +bool TestExtIpc::test_msg_send() { return test_message_queue();} +bool TestExtIpc::test_msg_receive () { return test_message_queue();} +bool TestExtIpc::test_msg_remove_queue() { return test_message_queue();} +bool TestExtIpc::test_msg_set_queue() { return test_message_queue();} +bool TestExtIpc::test_msg_stat_queue() { return test_message_queue();} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtIpc::test_semaphore() { + Variant ret = f_sem_get(0xDEADBEEF); + VERIFY(!same(ret, false)); + Object sem = ret.toObject(); + time_t now = time(0); + VERIFY(f_sem_acquire(sem)); + + int pid = fork(); + if (pid == 0) { + Variant ret = f_sem_get(0xDEADBEEF); + assert(!same(ret, false)); + Object sem = ret.toObject(); + + assert(f_sem_acquire(sem)); + + // This isn't a sure test, but may be false if f_sem_acquire() didn't work + time_t then = time(0); + assert(then - now > 1); + + assert(f_sem_release(sem)); + VERIFY(f_sem_remove(sem)); + _exit(-1); + } + + sleep(3); // aha + VERIFY(f_sem_release(sem)); + int status = -1; + wait(&status); + return Count(true); +} + +bool TestExtIpc::test_sem_acquire() { return test_semaphore();} +bool TestExtIpc::test_sem_get() { return test_semaphore();} +bool TestExtIpc::test_sem_release() { return test_semaphore();} +bool TestExtIpc::test_sem_remove() { return test_semaphore();} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtIpc::test_shared_memory() { + Variant ret = f_shm_attach(0xDEADBEEF); + VERIFY(!same(ret, false)); + int64 index = ret.toInt64(); + VERIFY(f_shm_put_var(index, 1234, "test")); + + int pid = fork(); + if (pid == 0) { + Variant ret = f_shm_attach(index); + assert(!same(ret, false)); + Object mem = ret.toObject(); + + ret = f_shm_get_var(index, 1234); + assert(same(ret, "test")); + + assert(f_shm_remove_var(index, 1234)); + assert(f_shm_detach(index)); + _exit(-1); + } + + // Verifying f_shm_remove_var worked, this is not sure test though. + ret = f_shm_get_var(index, 1234); + for (int i = 0; i < 1000; i++) { + if (same(ret, false)) break; + usleep(1000); + ret = f_shm_get_var(index, 1234); + } + VERIFY(same(ret, false)); + + VERIFY(f_shm_remove(index)); + int status = -1; + wait(&status); + return Count(true); +} + +bool TestExtIpc::test_shm_attach() { return test_shared_memory();} +bool TestExtIpc::test_shm_detach() { return test_shared_memory();} +bool TestExtIpc::test_shm_remove() { return test_shared_memory();} +bool TestExtIpc::test_shm_get_var() { return test_shared_memory();} +bool TestExtIpc::test_shm_put_var() { return test_shared_memory();} +bool TestExtIpc::test_shm_remove_var() { return test_shared_memory();} diff --git a/src/test/test_ext_ipc.h b/src/test/test_ext_ipc.h new file mode 100644 index 0000000000000..ab1bfefb02df8 --- /dev/null +++ b/src/test/test_ext_ipc.h @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_IPC_H__ +#define __TEST_EXT_IPC_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtIpc : public TestCppExt { +public: + virtual bool RunTests(const std::string &which); + + bool test_ftok(); + bool test_msg_get_queue(); + bool test_msg_send(); + bool test_msg_receive(); + bool test_msg_remove_queue(); + bool test_msg_set_queue(); + bool test_msg_stat_queue(); + bool test_sem_acquire(); + bool test_sem_get(); + bool test_sem_release(); + bool test_sem_remove(); + bool test_shm_attach(); + bool test_shm_detach(); + bool test_shm_remove(); + bool test_shm_get_var(); + bool test_shm_put_var(); + bool test_shm_remove_var(); + + bool test_message_queue(); + bool test_semaphore(); + bool test_shared_memory(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_IPC_H__ diff --git a/src/test/test_ext_json.cpp b/src/test/test_ext_json.cpp new file mode 100644 index 0000000000000..002cd5c8bd935 --- /dev/null +++ b/src/test/test_ext_json.cpp @@ -0,0 +1,98 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtJson::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_json_encode); + RUN_TEST(test_json_decode); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtJson::test_json_encode() { + VS(f_json_encode(CREATE_MAP3("a", 1, "b", 2.3, 3, "test")), + "{\"a\":1,\"b\":2.3,\"3\":\"test\"}"); + VS(f_json_encode(CREATE_VECTOR5("a", 1, true, false, null)), + "[\"a\",1,true,false,null]"); + + VS(f_json_encode("a\xE0"), "\"\""); + VS(f_json_encode("a\xE0", true), "\"a?\""); + + VS(f_json_encode(CREATE_MAP2("0", "apple", "1", "banana")), + "[\"apple\",\"banana\"]"); + + VS(f_json_encode(CREATE_VECTOR1(CREATE_MAP1("a", "apple"))), + "[{\"a\":\"apple\"}]"); + + return Count(true); +} + +bool TestExtJson::test_json_decode() { + Array arr = CREATE_MAP1("fbid", 101501853510151001LL); + VS(f_json_decode(f_json_encode(arr), true), arr); + + VS(f_json_decode("{\"0\":{\"00\":0}}", true), + CREATE_MAP1("0", CREATE_MAP1("00", 0))); + + VS(f_json_decode("{\"a\":1,\"b\":2.3,\"3\":\"test\"}", true), + CREATE_MAP3("a", 1, "b", 2.3, 3, "test")); + VS(f_json_decode("[\"a\",1,true,false,null]", true), + CREATE_VECTOR5("a", 1, true, false, null)); + + Object obj = f_json_decode("{\"a\":1,\"b\":2.3,\"3\":\"test\"}"); + VS(obj.toArray(), CREATE_MAP3("a", 1, "b", 2.3, 3, "test")); + + obj = f_json_decode("[\"a\",1,true,false,null]"); + VS(obj.toArray(), CREATE_VECTOR5("a", 1, true, false, null)); + + VS(f_json_decode("{z:1}", true), null); + VS(f_json_decode("{z:1}", true, true), CREATE_MAP1("z", 1)); + VS(f_json_decode("{z:\"z\"}", true), null); + VS(f_json_decode("{z:\"z\"}", true, true), CREATE_MAP1("z", "z")); + VS(f_json_decode("{'x':1}", true), null); + VS(f_json_decode("{'x':1}", true, true), CREATE_MAP1("x", 1)); + VS(f_json_decode("{y:1,}", true), null); + VS(f_json_decode("{y:1,}", true, true), CREATE_MAP1("y", 1)); + VS(f_json_decode("{,}", true), null); + VS(f_json_decode("{,}", true, true), null); + VS(f_json_decode("[1,2,3,]", true), null); + VS(f_json_decode("[1,2,3,]", true, true), CREATE_VECTOR3(1,2,3)); + VS(f_json_decode("[,]", true), null); + VS(f_json_decode("[,]", true, true), null); + VS(f_json_decode("[]", true), Array::Create()); + VS(f_json_decode("[]", true, true), Array::Create()); + VS(f_json_decode("{}", true), Array::Create()); + VS(f_json_decode("{}", true, true), Array::Create()); + + VS(f_json_decode("[{\"a\":\"apple\"},{\"b\":\"banana\"}]", true), + CREATE_VECTOR2(CREATE_MAP1("a", "apple"), CREATE_MAP1("b", "banana"))); + + Variant a = "[{\"a\":[{\"n\":\"1st\"}]},{\"b\":[{\"n\":\"2nd\"}]}]"; + VS(f_json_decode(a, true), + CREATE_VECTOR2 + (CREATE_MAP1("a", CREATE_VECTOR1(CREATE_MAP1("n", "1st"))), + CREATE_MAP1("b", CREATE_VECTOR1(CREATE_MAP1("n", "2nd"))))); + + return Count(true); +} diff --git a/src/test/test_ext_json.h b/src/test/test_ext_json.h new file mode 100644 index 0000000000000..ee42bbaf97e59 --- /dev/null +++ b/src/test/test_ext_json.h @@ -0,0 +1,36 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_JSON_H__ +#define __TEST_EXT_JSON_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtJson : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_json_encode(); + bool test_json_decode(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_JSON_H__ diff --git a/src/test/test_ext_ldap.cpp b/src/test/test_ext_ldap.cpp new file mode 100644 index 0000000000000..4df57af456900 --- /dev/null +++ b/src/test/test_ext_ldap.cpp @@ -0,0 +1,286 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtLdap::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_ldap_connect); + RUN_TEST(test_ldap_explode_dn); + RUN_TEST(test_ldap_dn2ufn); + RUN_TEST(test_ldap_err2str); + RUN_TEST(test_ldap_8859_to_t61); + RUN_TEST(test_ldap_t61_to_8859); + RUN_TEST(test_ldap_add); + RUN_TEST(test_ldap_mod_add); + RUN_TEST(test_ldap_mod_del); + RUN_TEST(test_ldap_mod_replace); + RUN_TEST(test_ldap_modify); + RUN_TEST(test_ldap_bind); + RUN_TEST(test_ldap_sasl_bind); + RUN_TEST(test_ldap_set_rebind_proc); + RUN_TEST(test_ldap_sort); + RUN_TEST(test_ldap_start_tls); + RUN_TEST(test_ldap_unbind); + RUN_TEST(test_ldap_get_option); + RUN_TEST(test_ldap_set_option); + RUN_TEST(test_ldap_close); + RUN_TEST(test_ldap_list); + RUN_TEST(test_ldap_read); + RUN_TEST(test_ldap_search); + RUN_TEST(test_ldap_rename); + RUN_TEST(test_ldap_delete); + RUN_TEST(test_ldap_compare); + RUN_TEST(test_ldap_errno); + RUN_TEST(test_ldap_error); + RUN_TEST(test_ldap_get_dn); + RUN_TEST(test_ldap_count_entries); + RUN_TEST(test_ldap_get_entries); + RUN_TEST(test_ldap_first_entry); + RUN_TEST(test_ldap_next_entry); + RUN_TEST(test_ldap_get_attributes); + RUN_TEST(test_ldap_first_attribute); + RUN_TEST(test_ldap_next_attribute); + RUN_TEST(test_ldap_first_reference); + RUN_TEST(test_ldap_next_reference); + RUN_TEST(test_ldap_parse_reference); + RUN_TEST(test_ldap_parse_result); + RUN_TEST(test_ldap_free_result); + RUN_TEST(test_ldap_get_values_len); + RUN_TEST(test_ldap_get_values); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtLdap::test_ldap_connect() { + //VCB(">>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtLdap : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_ldap_connect(); + bool test_ldap_explode_dn(); + bool test_ldap_dn2ufn(); + bool test_ldap_err2str(); + bool test_ldap_8859_to_t61(); + bool test_ldap_t61_to_8859(); + bool test_ldap_add(); + bool test_ldap_mod_add(); + bool test_ldap_mod_del(); + bool test_ldap_mod_replace(); + bool test_ldap_modify(); + bool test_ldap_bind(); + bool test_ldap_sasl_bind(); + bool test_ldap_set_rebind_proc(); + bool test_ldap_sort(); + bool test_ldap_start_tls(); + bool test_ldap_unbind(); + bool test_ldap_get_option(); + bool test_ldap_set_option(); + bool test_ldap_close(); + bool test_ldap_list(); + bool test_ldap_read(); + bool test_ldap_search(); + bool test_ldap_rename(); + bool test_ldap_delete(); + bool test_ldap_compare(); + bool test_ldap_errno(); + bool test_ldap_error(); + bool test_ldap_get_dn(); + bool test_ldap_count_entries(); + bool test_ldap_get_entries(); + bool test_ldap_first_entry(); + bool test_ldap_next_entry(); + bool test_ldap_get_attributes(); + bool test_ldap_first_attribute(); + bool test_ldap_next_attribute(); + bool test_ldap_first_reference(); + bool test_ldap_next_reference(); + bool test_ldap_parse_reference(); + bool test_ldap_parse_result(); + bool test_ldap_free_result(); + bool test_ldap_get_values_len(); + bool test_ldap_get_values(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_LDAP_H__ diff --git a/src/test/test_ext_magick.cpp b/src/test/test_ext_magick.cpp new file mode 100644 index 0000000000000..c4bfeb1391b9d --- /dev/null +++ b/src/test/test_ext_magick.cpp @@ -0,0 +1,2596 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMagick::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_magickgetcopyright); + RUN_TEST(test_magickgethomeurl); + RUN_TEST(test_magickgetpackagename); + RUN_TEST(test_magickgetquantumdepth); + RUN_TEST(test_magickgetreleasedate); + RUN_TEST(test_magickgetresourcelimit); + RUN_TEST(test_magickgetversion); + RUN_TEST(test_magickgetversionnumber); + RUN_TEST(test_magickgetversionstring); + RUN_TEST(test_magickqueryconfigureoption); + RUN_TEST(test_magickqueryconfigureoptions); + RUN_TEST(test_magickqueryfonts); + RUN_TEST(test_magickqueryformats); + RUN_TEST(test_magicksetresourcelimit); + RUN_TEST(test_newdrawingwand); + RUN_TEST(test_newmagickwand); + RUN_TEST(test_newpixeliterator); + RUN_TEST(test_newpixelregioniterator); + RUN_TEST(test_newpixelwand); + RUN_TEST(test_newpixelwandarray); + RUN_TEST(test_newpixelwands); + RUN_TEST(test_destroydrawingwand); + RUN_TEST(test_destroymagickwand); + RUN_TEST(test_destroypixeliterator); + RUN_TEST(test_destroypixelwand); + RUN_TEST(test_destroypixelwandarray); + RUN_TEST(test_destroypixelwands); + RUN_TEST(test_isdrawingwand); + RUN_TEST(test_ismagickwand); + RUN_TEST(test_ispixeliterator); + RUN_TEST(test_ispixelwand); + RUN_TEST(test_cleardrawingwand); + RUN_TEST(test_clearmagickwand); + RUN_TEST(test_clearpixeliterator); + RUN_TEST(test_clearpixelwand); + RUN_TEST(test_clonedrawingwand); + RUN_TEST(test_clonemagickwand); + RUN_TEST(test_wandgetexception); + RUN_TEST(test_wandgetexceptionstring); + RUN_TEST(test_wandgetexceptiontype); + RUN_TEST(test_wandhasexception); + RUN_TEST(test_drawaffine); + RUN_TEST(test_drawannotation); + RUN_TEST(test_drawarc); + RUN_TEST(test_drawbezier); + RUN_TEST(test_drawcircle); + RUN_TEST(test_drawcolor); + RUN_TEST(test_drawcomment); + RUN_TEST(test_drawcomposite); + RUN_TEST(test_drawellipse); + RUN_TEST(test_drawgetclippath); + RUN_TEST(test_drawgetcliprule); + RUN_TEST(test_drawgetclipunits); + RUN_TEST(test_drawgetexception); + RUN_TEST(test_drawgetexceptionstring); + RUN_TEST(test_drawgetexceptiontype); + RUN_TEST(test_drawgetfillalpha); + RUN_TEST(test_drawgetfillcolor); + RUN_TEST(test_drawgetfillopacity); + RUN_TEST(test_drawgetfillrule); + RUN_TEST(test_drawgetfont); + RUN_TEST(test_drawgetfontfamily); + RUN_TEST(test_drawgetfontsize); + RUN_TEST(test_drawgetfontstretch); + RUN_TEST(test_drawgetfontstyle); + RUN_TEST(test_drawgetfontweight); + RUN_TEST(test_drawgetgravity); + RUN_TEST(test_drawgetstrokealpha); + RUN_TEST(test_drawgetstrokeantialias); + RUN_TEST(test_drawgetstrokecolor); + RUN_TEST(test_drawgetstrokedasharray); + RUN_TEST(test_drawgetstrokedashoffset); + RUN_TEST(test_drawgetstrokelinecap); + RUN_TEST(test_drawgetstrokelinejoin); + RUN_TEST(test_drawgetstrokemiterlimit); + RUN_TEST(test_drawgetstrokeopacity); + RUN_TEST(test_drawgetstrokewidth); + RUN_TEST(test_drawgettextalignment); + RUN_TEST(test_drawgettextantialias); + RUN_TEST(test_drawgettextdecoration); + RUN_TEST(test_drawgettextencoding); + RUN_TEST(test_drawgettextundercolor); + RUN_TEST(test_drawgetvectorgraphics); + RUN_TEST(test_drawline); + RUN_TEST(test_drawmatte); + RUN_TEST(test_drawpathclose); + RUN_TEST(test_drawpathcurvetoabsolute); + RUN_TEST(test_drawpathcurvetoquadraticbezierabsolute); + RUN_TEST(test_drawpathcurvetoquadraticbezierrelative); + RUN_TEST(test_drawpathcurvetoquadraticbeziersmoothabsolute); + RUN_TEST(test_drawpathcurvetoquadraticbeziersmoothrelative); + RUN_TEST(test_drawpathcurvetorelative); + RUN_TEST(test_drawpathcurvetosmoothabsolute); + RUN_TEST(test_drawpathcurvetosmoothrelative); + RUN_TEST(test_drawpathellipticarcabsolute); + RUN_TEST(test_drawpathellipticarcrelative); + RUN_TEST(test_drawpathfinish); + RUN_TEST(test_drawpathlinetoabsolute); + RUN_TEST(test_drawpathlinetohorizontalabsolute); + RUN_TEST(test_drawpathlinetohorizontalrelative); + RUN_TEST(test_drawpathlinetorelative); + RUN_TEST(test_drawpathlinetoverticalabsolute); + RUN_TEST(test_drawpathlinetoverticalrelative); + RUN_TEST(test_drawpathmovetoabsolute); + RUN_TEST(test_drawpathmovetorelative); + RUN_TEST(test_drawpathstart); + RUN_TEST(test_drawpoint); + RUN_TEST(test_drawpolygon); + RUN_TEST(test_drawpolyline); + RUN_TEST(test_drawrectangle); + RUN_TEST(test_drawrender); + RUN_TEST(test_drawrotate); + RUN_TEST(test_drawroundrectangle); + RUN_TEST(test_drawscale); + RUN_TEST(test_drawsetclippath); + RUN_TEST(test_drawsetcliprule); + RUN_TEST(test_drawsetclipunits); + RUN_TEST(test_drawsetfillalpha); + RUN_TEST(test_drawsetfillcolor); + RUN_TEST(test_drawsetfillopacity); + RUN_TEST(test_drawsetfillpatternurl); + RUN_TEST(test_drawsetfillrule); + RUN_TEST(test_drawsetfont); + RUN_TEST(test_drawsetfontfamily); + RUN_TEST(test_drawsetfontsize); + RUN_TEST(test_drawsetfontstretch); + RUN_TEST(test_drawsetfontstyle); + RUN_TEST(test_drawsetfontweight); + RUN_TEST(test_drawsetgravity); + RUN_TEST(test_drawsetstrokealpha); + RUN_TEST(test_drawsetstrokeantialias); + RUN_TEST(test_drawsetstrokecolor); + RUN_TEST(test_drawsetstrokedasharray); + RUN_TEST(test_drawsetstrokedashoffset); + RUN_TEST(test_drawsetstrokelinecap); + RUN_TEST(test_drawsetstrokelinejoin); + RUN_TEST(test_drawsetstrokemiterlimit); + RUN_TEST(test_drawsetstrokeopacity); + RUN_TEST(test_drawsetstrokepatternurl); + RUN_TEST(test_drawsetstrokewidth); + RUN_TEST(test_drawsettextalignment); + RUN_TEST(test_drawsettextantialias); + RUN_TEST(test_drawsettextdecoration); + RUN_TEST(test_drawsettextencoding); + RUN_TEST(test_drawsettextundercolor); + RUN_TEST(test_drawsetvectorgraphics); + RUN_TEST(test_drawsetviewbox); + RUN_TEST(test_drawskewx); + RUN_TEST(test_drawskewy); + RUN_TEST(test_drawtranslate); + RUN_TEST(test_pushdrawingwand); + RUN_TEST(test_drawpushclippath); + RUN_TEST(test_drawpushdefs); + RUN_TEST(test_drawpushpattern); + RUN_TEST(test_popdrawingwand); + RUN_TEST(test_drawpopclippath); + RUN_TEST(test_drawpopdefs); + RUN_TEST(test_drawpoppattern); + RUN_TEST(test_magickadaptivethresholdimage); + RUN_TEST(test_magickaddimage); + RUN_TEST(test_magickaddnoiseimage); + RUN_TEST(test_magickaffinetransformimage); + RUN_TEST(test_magickannotateimage); + RUN_TEST(test_magickappendimages); + RUN_TEST(test_magickaverageimages); + RUN_TEST(test_magickblackthresholdimage); + RUN_TEST(test_magickblurimage); + RUN_TEST(test_magickborderimage); + RUN_TEST(test_magickcharcoalimage); + RUN_TEST(test_magickchopimage); + RUN_TEST(test_magickclipimage); + RUN_TEST(test_magickclippathimage); + RUN_TEST(test_magickcoalesceimages); + RUN_TEST(test_magickcolorfloodfillimage); + RUN_TEST(test_magickcolorizeimage); + RUN_TEST(test_magickcombineimages); + RUN_TEST(test_magickcommentimage); + RUN_TEST(test_magickcompareimages); + RUN_TEST(test_magickcompositeimage); + RUN_TEST(test_magickconstituteimage); + RUN_TEST(test_magickcontrastimage); + RUN_TEST(test_magickconvolveimage); + RUN_TEST(test_magickcropimage); + RUN_TEST(test_magickcyclecolormapimage); + RUN_TEST(test_magickdeconstructimages); + RUN_TEST(test_magickdescribeimage); + RUN_TEST(test_magickdespeckleimage); + RUN_TEST(test_magickdrawimage); + RUN_TEST(test_magickechoimageblob); + RUN_TEST(test_magickechoimagesblob); + RUN_TEST(test_magickedgeimage); + RUN_TEST(test_magickembossimage); + RUN_TEST(test_magickenhanceimage); + RUN_TEST(test_magickequalizeimage); + RUN_TEST(test_magickevaluateimage); + RUN_TEST(test_magickflattenimages); + RUN_TEST(test_magickflipimage); + RUN_TEST(test_magickflopimage); + RUN_TEST(test_magickframeimage); + RUN_TEST(test_magickfximage); + RUN_TEST(test_magickgammaimage); + RUN_TEST(test_magickgaussianblurimage); + RUN_TEST(test_magickgetcharheight); + RUN_TEST(test_magickgetcharwidth); + RUN_TEST(test_magickgetexception); + RUN_TEST(test_magickgetexceptionstring); + RUN_TEST(test_magickgetexceptiontype); + RUN_TEST(test_magickgetfilename); + RUN_TEST(test_magickgetformat); + RUN_TEST(test_magickgetimage); + RUN_TEST(test_magickgetimagebackgroundcolor); + RUN_TEST(test_magickgetimageblob); + RUN_TEST(test_magickgetimageblueprimary); + RUN_TEST(test_magickgetimagebordercolor); + RUN_TEST(test_magickgetimagechannelmean); + RUN_TEST(test_magickgetimagecolormapcolor); + RUN_TEST(test_magickgetimagecolors); + RUN_TEST(test_magickgetimagecolorspace); + RUN_TEST(test_magickgetimagecompose); + RUN_TEST(test_magickgetimagecompression); + RUN_TEST(test_magickgetimagecompressionquality); + RUN_TEST(test_magickgetimagedelay); + RUN_TEST(test_magickgetimagedepth); + RUN_TEST(test_magickgetimagedispose); + RUN_TEST(test_magickgetimageextrema); + RUN_TEST(test_magickgetimagefilename); + RUN_TEST(test_magickgetimageformat); + RUN_TEST(test_magickgetimagegamma); + RUN_TEST(test_magickgetimagegreenprimary); + RUN_TEST(test_magickgetimageheight); + RUN_TEST(test_magickgetimagehistogram); + RUN_TEST(test_magickgetimageindex); + RUN_TEST(test_magickgetimageinterlacescheme); + RUN_TEST(test_magickgetimageiterations); + RUN_TEST(test_magickgetimagemattecolor); + RUN_TEST(test_magickgetimagemimetype); + RUN_TEST(test_magickgetimagepixels); + RUN_TEST(test_magickgetimageprofile); + RUN_TEST(test_magickgetimageredprimary); + RUN_TEST(test_magickgetimagerenderingintent); + RUN_TEST(test_magickgetimageresolution); + RUN_TEST(test_magickgetimagescene); + RUN_TEST(test_magickgetimagesignature); + RUN_TEST(test_magickgetimagesize); + RUN_TEST(test_magickgetimagetype); + RUN_TEST(test_magickgetimageunits); + RUN_TEST(test_magickgetimagevirtualpixelmethod); + RUN_TEST(test_magickgetimagewhitepoint); + RUN_TEST(test_magickgetimagewidth); + RUN_TEST(test_magickgetimagesblob); + RUN_TEST(test_magickgetinterlacescheme); + RUN_TEST(test_magickgetmaxtextadvance); + RUN_TEST(test_magickgetmimetype); + RUN_TEST(test_magickgetnumberimages); + RUN_TEST(test_magickgetsamplingfactors); + RUN_TEST(test_magickgetsize); + RUN_TEST(test_magickgetstringheight); + RUN_TEST(test_magickgetstringwidth); + RUN_TEST(test_magickgettextascent); + RUN_TEST(test_magickgettextdescent); + RUN_TEST(test_magickgetwandsize); + RUN_TEST(test_magickhasnextimage); + RUN_TEST(test_magickhaspreviousimage); + RUN_TEST(test_magickimplodeimage); + RUN_TEST(test_magicklabelimage); + RUN_TEST(test_magicklevelimage); + RUN_TEST(test_magickmagnifyimage); + RUN_TEST(test_magickmapimage); + RUN_TEST(test_magickmattefloodfillimage); + RUN_TEST(test_magickmedianfilterimage); + RUN_TEST(test_magickminifyimage); + RUN_TEST(test_magickmodulateimage); + RUN_TEST(test_magickmontageimage); + RUN_TEST(test_magickmorphimages); + RUN_TEST(test_magickmosaicimages); + RUN_TEST(test_magickmotionblurimage); + RUN_TEST(test_magicknegateimage); + RUN_TEST(test_magicknewimage); + RUN_TEST(test_magicknextimage); + RUN_TEST(test_magicknormalizeimage); + RUN_TEST(test_magickoilpaintimage); + RUN_TEST(test_magickpaintopaqueimage); + RUN_TEST(test_magickpainttransparentimage); + RUN_TEST(test_magickpingimage); + RUN_TEST(test_magickposterizeimage); + RUN_TEST(test_magickpreviewimages); + RUN_TEST(test_magickpreviousimage); + RUN_TEST(test_magickprofileimage); + RUN_TEST(test_magickquantizeimage); + RUN_TEST(test_magickquantizeimages); + RUN_TEST(test_magickqueryfontmetrics); + RUN_TEST(test_magickradialblurimage); + RUN_TEST(test_magickraiseimage); + RUN_TEST(test_magickreadimage); + RUN_TEST(test_magickreadimageblob); + RUN_TEST(test_magickreadimagefile); + RUN_TEST(test_magickreadimages); + RUN_TEST(test_magickreducenoiseimage); + RUN_TEST(test_magickremoveimage); + RUN_TEST(test_magickremoveimageprofile); + RUN_TEST(test_magickremoveimageprofiles); + RUN_TEST(test_magickresampleimage); + RUN_TEST(test_magickresetiterator); + RUN_TEST(test_magickresizeimage); + RUN_TEST(test_magickrollimage); + RUN_TEST(test_magickrotateimage); + RUN_TEST(test_magicksampleimage); + RUN_TEST(test_magickscaleimage); + RUN_TEST(test_magickseparateimagechannel); + RUN_TEST(test_magicksetcompressionquality); + RUN_TEST(test_magicksetfilename); + RUN_TEST(test_magicksetfirstiterator); + RUN_TEST(test_magicksetformat); + RUN_TEST(test_magicksetimage); + RUN_TEST(test_magicksetimagebackgroundcolor); + RUN_TEST(test_magicksetimagebias); + RUN_TEST(test_magicksetimageblueprimary); + RUN_TEST(test_magicksetimagebordercolor); + RUN_TEST(test_magicksetimagecolormapcolor); + RUN_TEST(test_magicksetimagecolorspace); + RUN_TEST(test_magicksetimagecompose); + RUN_TEST(test_magicksetimagecompression); + RUN_TEST(test_magicksetimagecompressionquality); + RUN_TEST(test_magicksetimagedelay); + RUN_TEST(test_magicksetimagedepth); + RUN_TEST(test_magicksetimagedispose); + RUN_TEST(test_magicksetimagefilename); + RUN_TEST(test_magicksetimageformat); + RUN_TEST(test_magicksetimagegamma); + RUN_TEST(test_magicksetimagegreenprimary); + RUN_TEST(test_magicksetimageindex); + RUN_TEST(test_magicksetimageinterlacescheme); + RUN_TEST(test_magicksetimageiterations); + RUN_TEST(test_magicksetimagemattecolor); + RUN_TEST(test_magicksetimageoption); + RUN_TEST(test_magicksetimagepixels); + RUN_TEST(test_magicksetimageprofile); + RUN_TEST(test_magicksetimageredprimary); + RUN_TEST(test_magicksetimagerenderingintent); + RUN_TEST(test_magicksetimageresolution); + RUN_TEST(test_magicksetimagescene); + RUN_TEST(test_magicksetimagetype); + RUN_TEST(test_magicksetimageunits); + RUN_TEST(test_magicksetimagevirtualpixelmethod); + RUN_TEST(test_magicksetimagewhitepoint); + RUN_TEST(test_magicksetinterlacescheme); + RUN_TEST(test_magicksetlastiterator); + RUN_TEST(test_magicksetpassphrase); + RUN_TEST(test_magicksetresolution); + RUN_TEST(test_magicksetsamplingfactors); + RUN_TEST(test_magicksetsize); + RUN_TEST(test_magicksetwandsize); + RUN_TEST(test_magicksharpenimage); + RUN_TEST(test_magickshaveimage); + RUN_TEST(test_magickshearimage); + RUN_TEST(test_magicksolarizeimage); + RUN_TEST(test_magickspliceimage); + RUN_TEST(test_magickspreadimage); + RUN_TEST(test_magicksteganoimage); + RUN_TEST(test_magickstereoimage); + RUN_TEST(test_magickstripimage); + RUN_TEST(test_magickswirlimage); + RUN_TEST(test_magicktextureimage); + RUN_TEST(test_magickthresholdimage); + RUN_TEST(test_magicktintimage); + RUN_TEST(test_magicktransformimage); + RUN_TEST(test_magicktrimimage); + RUN_TEST(test_magickunsharpmaskimage); + RUN_TEST(test_magickwaveimage); + RUN_TEST(test_magickwhitethresholdimage); + RUN_TEST(test_magickwriteimage); + RUN_TEST(test_magickwriteimagefile); + RUN_TEST(test_magickwriteimages); + RUN_TEST(test_magickwriteimagesfile); + RUN_TEST(test_pixelgetalpha); + RUN_TEST(test_pixelgetalphaquantum); + RUN_TEST(test_pixelgetblack); + RUN_TEST(test_pixelgetblackquantum); + RUN_TEST(test_pixelgetblue); + RUN_TEST(test_pixelgetbluequantum); + RUN_TEST(test_pixelgetcolorasstring); + RUN_TEST(test_pixelgetcolorcount); + RUN_TEST(test_pixelgetcyan); + RUN_TEST(test_pixelgetcyanquantum); + RUN_TEST(test_pixelgetexception); + RUN_TEST(test_pixelgetexceptionstring); + RUN_TEST(test_pixelgetexceptiontype); + RUN_TEST(test_pixelgetgreen); + RUN_TEST(test_pixelgetgreenquantum); + RUN_TEST(test_pixelgetindex); + RUN_TEST(test_pixelgetmagenta); + RUN_TEST(test_pixelgetmagentaquantum); + RUN_TEST(test_pixelgetopacity); + RUN_TEST(test_pixelgetopacityquantum); + RUN_TEST(test_pixelgetquantumcolor); + RUN_TEST(test_pixelgetred); + RUN_TEST(test_pixelgetredquantum); + RUN_TEST(test_pixelgetyellow); + RUN_TEST(test_pixelgetyellowquantum); + RUN_TEST(test_pixelsetalpha); + RUN_TEST(test_pixelsetalphaquantum); + RUN_TEST(test_pixelsetblack); + RUN_TEST(test_pixelsetblackquantum); + RUN_TEST(test_pixelsetblue); + RUN_TEST(test_pixelsetbluequantum); + RUN_TEST(test_pixelsetcolor); + RUN_TEST(test_pixelsetcolorcount); + RUN_TEST(test_pixelsetcyan); + RUN_TEST(test_pixelsetcyanquantum); + RUN_TEST(test_pixelsetgreen); + RUN_TEST(test_pixelsetgreenquantum); + RUN_TEST(test_pixelsetindex); + RUN_TEST(test_pixelsetmagenta); + RUN_TEST(test_pixelsetmagentaquantum); + RUN_TEST(test_pixelsetopacity); + RUN_TEST(test_pixelsetopacityquantum); + RUN_TEST(test_pixelsetquantumcolor); + RUN_TEST(test_pixelsetred); + RUN_TEST(test_pixelsetredquantum); + RUN_TEST(test_pixelsetyellow); + RUN_TEST(test_pixelsetyellowquantum); + RUN_TEST(test_pixelgetiteratorexception); + RUN_TEST(test_pixelgetiteratorexceptionstring); + RUN_TEST(test_pixelgetiteratorexceptiontype); + RUN_TEST(test_pixelgetnextiteratorrow); + RUN_TEST(test_pixelresetiterator); + RUN_TEST(test_pixelsetiteratorrow); + RUN_TEST(test_pixelsynciterator); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMagick::test_magickgetcopyright() { + //VCB(">>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtMagick : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_magickgetcopyright(); + bool test_magickgethomeurl(); + bool test_magickgetpackagename(); + bool test_magickgetquantumdepth(); + bool test_magickgetreleasedate(); + bool test_magickgetresourcelimit(); + bool test_magickgetversion(); + bool test_magickgetversionnumber(); + bool test_magickgetversionstring(); + bool test_magickqueryconfigureoption(); + bool test_magickqueryconfigureoptions(); + bool test_magickqueryfonts(); + bool test_magickqueryformats(); + bool test_magicksetresourcelimit(); + bool test_newdrawingwand(); + bool test_newmagickwand(); + bool test_newpixeliterator(); + bool test_newpixelregioniterator(); + bool test_newpixelwand(); + bool test_newpixelwandarray(); + bool test_newpixelwands(); + bool test_destroydrawingwand(); + bool test_destroymagickwand(); + bool test_destroypixeliterator(); + bool test_destroypixelwand(); + bool test_destroypixelwandarray(); + bool test_destroypixelwands(); + bool test_isdrawingwand(); + bool test_ismagickwand(); + bool test_ispixeliterator(); + bool test_ispixelwand(); + bool test_cleardrawingwand(); + bool test_clearmagickwand(); + bool test_clearpixeliterator(); + bool test_clearpixelwand(); + bool test_clonedrawingwand(); + bool test_clonemagickwand(); + bool test_wandgetexception(); + bool test_wandgetexceptionstring(); + bool test_wandgetexceptiontype(); + bool test_wandhasexception(); + bool test_drawaffine(); + bool test_drawannotation(); + bool test_drawarc(); + bool test_drawbezier(); + bool test_drawcircle(); + bool test_drawcolor(); + bool test_drawcomment(); + bool test_drawcomposite(); + bool test_drawellipse(); + bool test_drawgetclippath(); + bool test_drawgetcliprule(); + bool test_drawgetclipunits(); + bool test_drawgetexception(); + bool test_drawgetexceptionstring(); + bool test_drawgetexceptiontype(); + bool test_drawgetfillalpha(); + bool test_drawgetfillcolor(); + bool test_drawgetfillopacity(); + bool test_drawgetfillrule(); + bool test_drawgetfont(); + bool test_drawgetfontfamily(); + bool test_drawgetfontsize(); + bool test_drawgetfontstretch(); + bool test_drawgetfontstyle(); + bool test_drawgetfontweight(); + bool test_drawgetgravity(); + bool test_drawgetstrokealpha(); + bool test_drawgetstrokeantialias(); + bool test_drawgetstrokecolor(); + bool test_drawgetstrokedasharray(); + bool test_drawgetstrokedashoffset(); + bool test_drawgetstrokelinecap(); + bool test_drawgetstrokelinejoin(); + bool test_drawgetstrokemiterlimit(); + bool test_drawgetstrokeopacity(); + bool test_drawgetstrokewidth(); + bool test_drawgettextalignment(); + bool test_drawgettextantialias(); + bool test_drawgettextdecoration(); + bool test_drawgettextencoding(); + bool test_drawgettextundercolor(); + bool test_drawgetvectorgraphics(); + bool test_drawline(); + bool test_drawmatte(); + bool test_drawpathclose(); + bool test_drawpathcurvetoabsolute(); + bool test_drawpathcurvetoquadraticbezierabsolute(); + bool test_drawpathcurvetoquadraticbezierrelative(); + bool test_drawpathcurvetoquadraticbeziersmoothabsolute(); + bool test_drawpathcurvetoquadraticbeziersmoothrelative(); + bool test_drawpathcurvetorelative(); + bool test_drawpathcurvetosmoothabsolute(); + bool test_drawpathcurvetosmoothrelative(); + bool test_drawpathellipticarcabsolute(); + bool test_drawpathellipticarcrelative(); + bool test_drawpathfinish(); + bool test_drawpathlinetoabsolute(); + bool test_drawpathlinetohorizontalabsolute(); + bool test_drawpathlinetohorizontalrelative(); + bool test_drawpathlinetorelative(); + bool test_drawpathlinetoverticalabsolute(); + bool test_drawpathlinetoverticalrelative(); + bool test_drawpathmovetoabsolute(); + bool test_drawpathmovetorelative(); + bool test_drawpathstart(); + bool test_drawpoint(); + bool test_drawpolygon(); + bool test_drawpolyline(); + bool test_drawrectangle(); + bool test_drawrender(); + bool test_drawrotate(); + bool test_drawroundrectangle(); + bool test_drawscale(); + bool test_drawsetclippath(); + bool test_drawsetcliprule(); + bool test_drawsetclipunits(); + bool test_drawsetfillalpha(); + bool test_drawsetfillcolor(); + bool test_drawsetfillopacity(); + bool test_drawsetfillpatternurl(); + bool test_drawsetfillrule(); + bool test_drawsetfont(); + bool test_drawsetfontfamily(); + bool test_drawsetfontsize(); + bool test_drawsetfontstretch(); + bool test_drawsetfontstyle(); + bool test_drawsetfontweight(); + bool test_drawsetgravity(); + bool test_drawsetstrokealpha(); + bool test_drawsetstrokeantialias(); + bool test_drawsetstrokecolor(); + bool test_drawsetstrokedasharray(); + bool test_drawsetstrokedashoffset(); + bool test_drawsetstrokelinecap(); + bool test_drawsetstrokelinejoin(); + bool test_drawsetstrokemiterlimit(); + bool test_drawsetstrokeopacity(); + bool test_drawsetstrokepatternurl(); + bool test_drawsetstrokewidth(); + bool test_drawsettextalignment(); + bool test_drawsettextantialias(); + bool test_drawsettextdecoration(); + bool test_drawsettextencoding(); + bool test_drawsettextundercolor(); + bool test_drawsetvectorgraphics(); + bool test_drawsetviewbox(); + bool test_drawskewx(); + bool test_drawskewy(); + bool test_drawtranslate(); + bool test_pushdrawingwand(); + bool test_drawpushclippath(); + bool test_drawpushdefs(); + bool test_drawpushpattern(); + bool test_popdrawingwand(); + bool test_drawpopclippath(); + bool test_drawpopdefs(); + bool test_drawpoppattern(); + bool test_magickadaptivethresholdimage(); + bool test_magickaddimage(); + bool test_magickaddnoiseimage(); + bool test_magickaffinetransformimage(); + bool test_magickannotateimage(); + bool test_magickappendimages(); + bool test_magickaverageimages(); + bool test_magickblackthresholdimage(); + bool test_magickblurimage(); + bool test_magickborderimage(); + bool test_magickcharcoalimage(); + bool test_magickchopimage(); + bool test_magickclipimage(); + bool test_magickclippathimage(); + bool test_magickcoalesceimages(); + bool test_magickcolorfloodfillimage(); + bool test_magickcolorizeimage(); + bool test_magickcombineimages(); + bool test_magickcommentimage(); + bool test_magickcompareimages(); + bool test_magickcompositeimage(); + bool test_magickconstituteimage(); + bool test_magickcontrastimage(); + bool test_magickconvolveimage(); + bool test_magickcropimage(); + bool test_magickcyclecolormapimage(); + bool test_magickdeconstructimages(); + bool test_magickdescribeimage(); + bool test_magickdespeckleimage(); + bool test_magickdrawimage(); + bool test_magickechoimageblob(); + bool test_magickechoimagesblob(); + bool test_magickedgeimage(); + bool test_magickembossimage(); + bool test_magickenhanceimage(); + bool test_magickequalizeimage(); + bool test_magickevaluateimage(); + bool test_magickflattenimages(); + bool test_magickflipimage(); + bool test_magickflopimage(); + bool test_magickframeimage(); + bool test_magickfximage(); + bool test_magickgammaimage(); + bool test_magickgaussianblurimage(); + bool test_magickgetcharheight(); + bool test_magickgetcharwidth(); + bool test_magickgetexception(); + bool test_magickgetexceptionstring(); + bool test_magickgetexceptiontype(); + bool test_magickgetfilename(); + bool test_magickgetformat(); + bool test_magickgetimage(); + bool test_magickgetimagebackgroundcolor(); + bool test_magickgetimageblob(); + bool test_magickgetimageblueprimary(); + bool test_magickgetimagebordercolor(); + bool test_magickgetimagechannelmean(); + bool test_magickgetimagecolormapcolor(); + bool test_magickgetimagecolors(); + bool test_magickgetimagecolorspace(); + bool test_magickgetimagecompose(); + bool test_magickgetimagecompression(); + bool test_magickgetimagecompressionquality(); + bool test_magickgetimagedelay(); + bool test_magickgetimagedepth(); + bool test_magickgetimagedispose(); + bool test_magickgetimageextrema(); + bool test_magickgetimagefilename(); + bool test_magickgetimageformat(); + bool test_magickgetimagegamma(); + bool test_magickgetimagegreenprimary(); + bool test_magickgetimageheight(); + bool test_magickgetimagehistogram(); + bool test_magickgetimageindex(); + bool test_magickgetimageinterlacescheme(); + bool test_magickgetimageiterations(); + bool test_magickgetimagemattecolor(); + bool test_magickgetimagemimetype(); + bool test_magickgetimagepixels(); + bool test_magickgetimageprofile(); + bool test_magickgetimageredprimary(); + bool test_magickgetimagerenderingintent(); + bool test_magickgetimageresolution(); + bool test_magickgetimagescene(); + bool test_magickgetimagesignature(); + bool test_magickgetimagesize(); + bool test_magickgetimagetype(); + bool test_magickgetimageunits(); + bool test_magickgetimagevirtualpixelmethod(); + bool test_magickgetimagewhitepoint(); + bool test_magickgetimagewidth(); + bool test_magickgetimagesblob(); + bool test_magickgetinterlacescheme(); + bool test_magickgetmaxtextadvance(); + bool test_magickgetmimetype(); + bool test_magickgetnumberimages(); + bool test_magickgetsamplingfactors(); + bool test_magickgetsize(); + bool test_magickgetstringheight(); + bool test_magickgetstringwidth(); + bool test_magickgettextascent(); + bool test_magickgettextdescent(); + bool test_magickgetwandsize(); + bool test_magickhasnextimage(); + bool test_magickhaspreviousimage(); + bool test_magickimplodeimage(); + bool test_magicklabelimage(); + bool test_magicklevelimage(); + bool test_magickmagnifyimage(); + bool test_magickmapimage(); + bool test_magickmattefloodfillimage(); + bool test_magickmedianfilterimage(); + bool test_magickminifyimage(); + bool test_magickmodulateimage(); + bool test_magickmontageimage(); + bool test_magickmorphimages(); + bool test_magickmosaicimages(); + bool test_magickmotionblurimage(); + bool test_magicknegateimage(); + bool test_magicknewimage(); + bool test_magicknextimage(); + bool test_magicknormalizeimage(); + bool test_magickoilpaintimage(); + bool test_magickpaintopaqueimage(); + bool test_magickpainttransparentimage(); + bool test_magickpingimage(); + bool test_magickposterizeimage(); + bool test_magickpreviewimages(); + bool test_magickpreviousimage(); + bool test_magickprofileimage(); + bool test_magickquantizeimage(); + bool test_magickquantizeimages(); + bool test_magickqueryfontmetrics(); + bool test_magickradialblurimage(); + bool test_magickraiseimage(); + bool test_magickreadimage(); + bool test_magickreadimageblob(); + bool test_magickreadimagefile(); + bool test_magickreadimages(); + bool test_magickreducenoiseimage(); + bool test_magickremoveimage(); + bool test_magickremoveimageprofile(); + bool test_magickremoveimageprofiles(); + bool test_magickresampleimage(); + bool test_magickresetiterator(); + bool test_magickresizeimage(); + bool test_magickrollimage(); + bool test_magickrotateimage(); + bool test_magicksampleimage(); + bool test_magickscaleimage(); + bool test_magickseparateimagechannel(); + bool test_magicksetcompressionquality(); + bool test_magicksetfilename(); + bool test_magicksetfirstiterator(); + bool test_magicksetformat(); + bool test_magicksetimage(); + bool test_magicksetimagebackgroundcolor(); + bool test_magicksetimagebias(); + bool test_magicksetimageblueprimary(); + bool test_magicksetimagebordercolor(); + bool test_magicksetimagecolormapcolor(); + bool test_magicksetimagecolorspace(); + bool test_magicksetimagecompose(); + bool test_magicksetimagecompression(); + bool test_magicksetimagecompressionquality(); + bool test_magicksetimagedelay(); + bool test_magicksetimagedepth(); + bool test_magicksetimagedispose(); + bool test_magicksetimagefilename(); + bool test_magicksetimageformat(); + bool test_magicksetimagegamma(); + bool test_magicksetimagegreenprimary(); + bool test_magicksetimageindex(); + bool test_magicksetimageinterlacescheme(); + bool test_magicksetimageiterations(); + bool test_magicksetimagemattecolor(); + bool test_magicksetimageoption(); + bool test_magicksetimagepixels(); + bool test_magicksetimageprofile(); + bool test_magicksetimageredprimary(); + bool test_magicksetimagerenderingintent(); + bool test_magicksetimageresolution(); + bool test_magicksetimagescene(); + bool test_magicksetimagetype(); + bool test_magicksetimageunits(); + bool test_magicksetimagevirtualpixelmethod(); + bool test_magicksetimagewhitepoint(); + bool test_magicksetinterlacescheme(); + bool test_magicksetlastiterator(); + bool test_magicksetpassphrase(); + bool test_magicksetresolution(); + bool test_magicksetsamplingfactors(); + bool test_magicksetsize(); + bool test_magicksetwandsize(); + bool test_magicksharpenimage(); + bool test_magickshaveimage(); + bool test_magickshearimage(); + bool test_magicksolarizeimage(); + bool test_magickspliceimage(); + bool test_magickspreadimage(); + bool test_magicksteganoimage(); + bool test_magickstereoimage(); + bool test_magickstripimage(); + bool test_magickswirlimage(); + bool test_magicktextureimage(); + bool test_magickthresholdimage(); + bool test_magicktintimage(); + bool test_magicktransformimage(); + bool test_magicktrimimage(); + bool test_magickunsharpmaskimage(); + bool test_magickwaveimage(); + bool test_magickwhitethresholdimage(); + bool test_magickwriteimage(); + bool test_magickwriteimagefile(); + bool test_magickwriteimages(); + bool test_magickwriteimagesfile(); + bool test_pixelgetalpha(); + bool test_pixelgetalphaquantum(); + bool test_pixelgetblack(); + bool test_pixelgetblackquantum(); + bool test_pixelgetblue(); + bool test_pixelgetbluequantum(); + bool test_pixelgetcolorasstring(); + bool test_pixelgetcolorcount(); + bool test_pixelgetcyan(); + bool test_pixelgetcyanquantum(); + bool test_pixelgetexception(); + bool test_pixelgetexceptionstring(); + bool test_pixelgetexceptiontype(); + bool test_pixelgetgreen(); + bool test_pixelgetgreenquantum(); + bool test_pixelgetindex(); + bool test_pixelgetmagenta(); + bool test_pixelgetmagentaquantum(); + bool test_pixelgetopacity(); + bool test_pixelgetopacityquantum(); + bool test_pixelgetquantumcolor(); + bool test_pixelgetred(); + bool test_pixelgetredquantum(); + bool test_pixelgetyellow(); + bool test_pixelgetyellowquantum(); + bool test_pixelsetalpha(); + bool test_pixelsetalphaquantum(); + bool test_pixelsetblack(); + bool test_pixelsetblackquantum(); + bool test_pixelsetblue(); + bool test_pixelsetbluequantum(); + bool test_pixelsetcolor(); + bool test_pixelsetcolorcount(); + bool test_pixelsetcyan(); + bool test_pixelsetcyanquantum(); + bool test_pixelsetgreen(); + bool test_pixelsetgreenquantum(); + bool test_pixelsetindex(); + bool test_pixelsetmagenta(); + bool test_pixelsetmagentaquantum(); + bool test_pixelsetopacity(); + bool test_pixelsetopacityquantum(); + bool test_pixelsetquantumcolor(); + bool test_pixelsetred(); + bool test_pixelsetredquantum(); + bool test_pixelsetyellow(); + bool test_pixelsetyellowquantum(); + bool test_pixelgetiteratorexception(); + bool test_pixelgetiteratorexceptionstring(); + bool test_pixelgetiteratorexceptiontype(); + bool test_pixelgetnextiteratorrow(); + bool test_pixelresetiterator(); + bool test_pixelsetiteratorrow(); + bool test_pixelsynciterator(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_MAGICK_H__ diff --git a/src/test/test_ext_mailparse.cpp b/src/test/test_ext_mailparse.cpp new file mode 100644 index 0000000000000..10dd9633154b9 --- /dev/null +++ b/src/test/test_ext_mailparse.cpp @@ -0,0 +1,124 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMailparse::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_mail); + RUN_TEST(test_ezmlm_hash); + RUN_TEST(test_mailparse_msg_create); + RUN_TEST(test_mailparse_msg_free); + RUN_TEST(test_mailparse_msg_parse_file); + RUN_TEST(test_mailparse_msg_parse); + RUN_TEST(test_mailparse_msg_extract_part_file); + RUN_TEST(test_mailparse_msg_extract_whole_part_file); + RUN_TEST(test_mailparse_msg_extract_part); + RUN_TEST(test_mailparse_msg_get_part_data); + RUN_TEST(test_mailparse_msg_get_part); + RUN_TEST(test_mailparse_msg_get_structure); + RUN_TEST(test_mailparse_rfc822_parse_addresses); + RUN_TEST(test_mailparse_stream_encode); + RUN_TEST(test_mailparse_uudecode_all); + RUN_TEST(test_mailparse_determine_best_xfer_encoding); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMailparse::test_mail() { + //VCB(">>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtMailparse : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_mail(); + bool test_ezmlm_hash(); + bool test_mailparse_msg_create(); + bool test_mailparse_msg_free(); + bool test_mailparse_msg_parse_file(); + bool test_mailparse_msg_parse(); + bool test_mailparse_msg_extract_part_file(); + bool test_mailparse_msg_extract_whole_part_file(); + bool test_mailparse_msg_extract_part(); + bool test_mailparse_msg_get_part_data(); + bool test_mailparse_msg_get_part(); + bool test_mailparse_msg_get_structure(); + bool test_mailparse_rfc822_parse_addresses(); + bool test_mailparse_stream_encode(); + bool test_mailparse_uudecode_all(); + bool test_mailparse_determine_best_xfer_encoding(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_MAILPARSE_H__ diff --git a/src/test/test_ext_math.cpp b/src/test/test_ext_math.cpp new file mode 100644 index 0000000000000..6e32682bb981b --- /dev/null +++ b/src/test/test_ext_math.cpp @@ -0,0 +1,377 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMath::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_pi); + RUN_TEST(test_min); + RUN_TEST(test_max); + RUN_TEST(test_abs); + RUN_TEST(test_is_finite); + RUN_TEST(test_is_infinite); + RUN_TEST(test_is_nan); + RUN_TEST(test_ceil); + RUN_TEST(test_floor); + RUN_TEST(test_round); + RUN_TEST(test_deg2rad); + RUN_TEST(test_rad2deg); + RUN_TEST(test_decbin); + RUN_TEST(test_dechex); + RUN_TEST(test_decoct); + RUN_TEST(test_bindec); + RUN_TEST(test_hexdec); + RUN_TEST(test_octdec); + RUN_TEST(test_base_convert); + RUN_TEST(test_pow); + RUN_TEST(test_exp); + RUN_TEST(test_expm1); + RUN_TEST(test_log10); + RUN_TEST(test_log1p); + RUN_TEST(test_log); + RUN_TEST(test_cos); + RUN_TEST(test_cosh); + RUN_TEST(test_sin); + RUN_TEST(test_sinh); + RUN_TEST(test_tan); + RUN_TEST(test_tanh); + RUN_TEST(test_acos); + RUN_TEST(test_acosh); + RUN_TEST(test_asin); + RUN_TEST(test_asinh); + RUN_TEST(test_atan); + RUN_TEST(test_atanh); + RUN_TEST(test_atan2); + RUN_TEST(test_hypot); + RUN_TEST(test_fmod); + RUN_TEST(test_sqrt); + RUN_TEST(test_getrandmax); + RUN_TEST(test_srand); + RUN_TEST(test_rand); + RUN_TEST(test_mt_getrandmax); + RUN_TEST(test_mt_srand); + RUN_TEST(test_mt_rand); + RUN_TEST(test_lcg_value); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMath::test_pi() { + VC(f_pi(), k_M_PI); + return Count(true); +} + +bool TestExtMath::test_min() { + VS(f_min(4, 2, CREATE_VECTOR4(3, 1, 6, 7)), 1); + VS(f_min(0, CREATE_VECTOR3(2, 4, 5)), 2); + VS(f_min(1, 0, CREATE_VECTOR1("hello")), 0); + VS(f_min(1, "hello", CREATE_VECTOR1(0)), "hello"); + VS(f_min(1, "hello", CREATE_VECTOR1(-1)), -1); + VS(f_min(1, CREATE_VECTOR3(2, 4, 8), + CREATE_VECTOR1(CREATE_VECTOR3(2, 5, 1))), + CREATE_VECTOR3(2, 4, 8)); + VS(f_min(1, "string", CREATE_VECTOR2(CREATE_VECTOR3(2, 5, 7), 42)), + "string"); + VS(f_min(1, CREATE_MAP1(1, "1236150163")), "1236150163"); + return Count(true); +} + +bool TestExtMath::test_max() { + VS(f_max(4, 2, CREATE_VECTOR4(3, 1, 6, 7)), 7); + VS(f_max(0, CREATE_VECTOR3(2, 4, 5)), 5); + VS(f_max(1, 0, CREATE_VECTOR1("hello")), 0); + VS(f_max(1, "hello", CREATE_VECTOR1(0)), "hello"); + VS(f_max(1, "hello", CREATE_VECTOR1(-1)), "hello"); + VS(f_max(1, CREATE_VECTOR3(2, 4, 8), + CREATE_VECTOR1(CREATE_VECTOR3(2, 5, 1))), + CREATE_VECTOR3(2, 5, 1)); + VS(f_max(1, "string", CREATE_VECTOR2(CREATE_VECTOR3(2, 5, 7), 42)), + CREATE_VECTOR3(2, 5, 7)); + VS(f_max(1, CREATE_MAP1(1, "1236150163")), "1236150163"); + return Count(true); +} + +bool TestExtMath::test_abs() { + VS(f_abs(-4.2), 4.2); + VS(f_abs(5), 5); + VS(f_abs(-5), 5); + return Count(true); +} + +bool TestExtMath::test_is_finite() { + VERIFY(f_is_finite(5)); + VERIFY(!f_is_finite(f_log(0))); + return Count(true); +} + +bool TestExtMath::test_is_infinite() { + VERIFY(!f_is_infinite(5)); + VERIFY(f_is_infinite(f_log(0))); + return Count(true); +} + +bool TestExtMath::test_is_nan() { + VERIFY(f_is_nan(f_acos(1.01))); + return Count(true); +} + +bool TestExtMath::test_ceil() { + VS(f_ceil(4.3), 5.0); + VS(f_ceil(9.999), 10.0); + VS(f_ceil(-3.14), -3.0); + return Count(true); +} + +bool TestExtMath::test_floor() { + VS(f_floor(4.3), 4.0); + VS(f_floor(9.999), 9.0); + VS(f_floor(-3.14), -4.0); + return Count(true); +} + +bool TestExtMath::test_round() { + VS(f_round(3.4), 3.0); + VS(f_round(3.5), 4.0); + VS(f_round(3.6), 4.0); + VS(f_round(3.6, 0), 4.0); + VS(f_round(1.95583, 2), 1.96); + VS(f_round(1241757, -3), 1242000.0); + VS(f_round(5.045, 2), 5.05); + VS(f_round(5.055, 2), 5.06); + return Count(true); +} + +bool TestExtMath::test_deg2rad() { + VC(f_deg2rad(45), k_M_PI_4); + return Count(true); +} + +bool TestExtMath::test_rad2deg() { + VC(f_rad2deg(k_M_PI_4), 45); + return Count(true); +} + +bool TestExtMath::test_decbin() { + VS(f_decbin(12), "1100"); + VS(f_decbin(26), "11010"); + return Count(true); +} + +bool TestExtMath::test_dechex() { + VS(f_dechex(10), "a"); + VS(f_dechex(47), "2f"); + return Count(true); +} + +bool TestExtMath::test_decoct() { + VS(f_decoct(15), "17"); + VS(f_decoct(264), "410"); + return Count(true); +} + +bool TestExtMath::test_bindec() { + VS(f_bindec("110011"), 51); + VS(f_bindec("000110011"), 51); + VS(f_bindec("111"), 7); + return Count(true); +} + +bool TestExtMath::test_hexdec() { + VS(f_hexdec("See"), 238); + VS(f_hexdec("ee"), 238); + VS(f_hexdec("that"), 10); + VS(f_hexdec("a0"), 160); + return Count(true); +} + +bool TestExtMath::test_octdec() { + VS(f_octdec("77"), 63); + VS(f_octdec(f_decoct(45)), 45); + return Count(true); +} + +bool TestExtMath::test_base_convert() { + VS(f_base_convert("A37334", 16, 2), "101000110111001100110100"); + return Count(true); +} + +bool TestExtMath::test_pow() { + VC(f_pow(2, 8), 256); + VC(f_pow(-1, 20), 1); + VS(f_pow(0, 0), 1); + VERIFY(f_pow(2, 32).isInteger()); + return Count(true); +} + +bool TestExtMath::test_exp() { + VC(f_exp(12), 162754.791419); + VC(f_exp(5.7), 298.86740096706); + return Count(true); +} + +bool TestExtMath::test_expm1() { + VC(f_expm1(5.7), 297.8674); + return Count(true); +} + +bool TestExtMath::test_log10() { + VS(f_log10(10), 1.0); + VS(f_log10(100), 2.0); + return Count(true); +} + +bool TestExtMath::test_log1p() { + VC(f_log1p(9), 2.302585092994); + VC(f_log1p(99), 4.6051701859881); + return Count(true); +} + +bool TestExtMath::test_log() { + VC(f_log(8), 2.0794415416798); + VS(f_log(8, 2), 3.0); + return Count(true); +} + +bool TestExtMath::test_cos() { + VC(f_cos(k_M_PI), -1); + return Count(true); +} + +bool TestExtMath::test_cosh() { + VC(f_cosh(1.23), 1.8567610569853); + return Count(true); +} + +bool TestExtMath::test_sin() { + VC(f_sin(f_deg2rad(90)), 1); + return Count(true); +} + +bool TestExtMath::test_sinh() { + VC(f_sinh(1.23), 1.5644684793044); + return Count(true); +} + +bool TestExtMath::test_tan() { + VC(f_tan(f_deg2rad(45)), 1); + return Count(true); +} + +bool TestExtMath::test_tanh() { + VC(f_tanh(1.23), 0.84257932565893); + return Count(true); +} + +bool TestExtMath::test_acos() { + VC(f_acos(-1), k_M_PI); + return Count(true); +} + +bool TestExtMath::test_acosh() { + VC(f_acosh(1.8567610569853), 1.23); + return Count(true); +} + +bool TestExtMath::test_asin() { + VC(f_asin(1), f_deg2rad(90)); + return Count(true); +} + +bool TestExtMath::test_asinh() { + VC(f_asinh(1.5644684793044), 1.23); + return Count(true); +} + +bool TestExtMath::test_atan() { + VC(f_atan(1), f_deg2rad(45)); + return Count(true); +} + +bool TestExtMath::test_atanh() { + VC(f_atanh(0.84257932565893), 1.23); + return Count(true); +} + +bool TestExtMath::test_atan2() { + VC(f_atan2(3, 4), 0.64350110879328); + return Count(true); +} + +bool TestExtMath::test_hypot() { + VS(f_hypot(3, 4), 5.0); + return Count(true); +} + +bool TestExtMath::test_fmod() { + VS(f_fmod(5.7, 1.3), 0.5); + return Count(true); +} + +bool TestExtMath::test_sqrt() { + VS(f_sqrt(9), 3.0); + return Count(true); +} + +bool TestExtMath::test_getrandmax() { + VS(f_getrandmax(), 2147483647); + return Count(true); +} + +bool TestExtMath::test_srand() { + f_srand(); + f_srand(0); + f_srand(1); + return Count(true); +} + +bool TestExtMath::test_rand() { + f_rand(); + VERIFY(f_rand(5, 15) >= 5); + VERIFY(f_rand(5, 15) <= 15); + return Count(true); +} + +bool TestExtMath::test_mt_getrandmax() { + VS(f_mt_getrandmax(), 2147483647); + return Count(true); +} + +bool TestExtMath::test_mt_srand() { + f_mt_srand(); + f_mt_srand(0); + f_mt_srand(1); + return Count(true); +} + +bool TestExtMath::test_mt_rand() { + f_mt_rand(); + VERIFY(f_mt_rand(5, 15) >= 5); + VERIFY(f_mt_rand(5, 15) <= 15); + return Count(true); +} + +bool TestExtMath::test_lcg_value() { + VERIFY(f_lcg_value() >= 0); + VERIFY(f_lcg_value() <= 1); + return Count(true); +} diff --git a/src/test/test_ext_math.h b/src/test/test_ext_math.h new file mode 100644 index 0000000000000..5e60c97a8891d --- /dev/null +++ b/src/test/test_ext_math.h @@ -0,0 +1,82 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_MATH_H__ +#define __TEST_EXT_MATH_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtMath : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_pi(); + bool test_min(); + bool test_max(); + bool test_abs(); + bool test_is_finite(); + bool test_is_infinite(); + bool test_is_nan(); + bool test_ceil(); + bool test_floor(); + bool test_round(); + bool test_deg2rad(); + bool test_rad2deg(); + bool test_decbin(); + bool test_dechex(); + bool test_decoct(); + bool test_bindec(); + bool test_hexdec(); + bool test_octdec(); + bool test_base_convert(); + bool test_pow(); + bool test_exp(); + bool test_expm1(); + bool test_log10(); + bool test_log1p(); + bool test_log(); + bool test_cos(); + bool test_cosh(); + bool test_sin(); + bool test_sinh(); + bool test_tan(); + bool test_tanh(); + bool test_acos(); + bool test_acosh(); + bool test_asin(); + bool test_asinh(); + bool test_atan(); + bool test_atanh(); + bool test_atan2(); + bool test_hypot(); + bool test_fmod(); + bool test_sqrt(); + bool test_getrandmax(); + bool test_srand(); + bool test_rand(); + bool test_mt_getrandmax(); + bool test_mt_srand(); + bool test_mt_rand(); + bool test_lcg_value(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_MATH_H__ diff --git a/src/test/test_ext_mb.cpp b/src/test/test_ext_mb.cpp new file mode 100644 index 0000000000000..8fde3f72d4e05 --- /dev/null +++ b/src/test/test_ext_mb.cpp @@ -0,0 +1,574 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMb::RunTests(const std::string &which) { + bool ret = true; + f_mb_internal_encoding("UTF-8"); + + RUN_TEST(test_mb_list_encodings); + RUN_TEST(test_mb_list_encodings_alias_names); + RUN_TEST(test_mb_list_mime_names); + RUN_TEST(test_mb_check_encoding); + RUN_TEST(test_mb_convert_case); + RUN_TEST(test_mb_convert_encoding); + RUN_TEST(test_mb_convert_kana); + RUN_TEST(test_mb_convert_variables); + RUN_TEST(test_mb_decode_mimeheader); + RUN_TEST(test_mb_decode_numericentity); + RUN_TEST(test_mb_detect_encoding); + RUN_TEST(test_mb_detect_order); + RUN_TEST(test_mb_encode_mimeheader); + RUN_TEST(test_mb_encode_numericentity); + RUN_TEST(test_mb_ereg_match); + RUN_TEST(test_mb_ereg_replace); + RUN_TEST(test_mb_ereg_search_getpos); + RUN_TEST(test_mb_ereg_search_getregs); + RUN_TEST(test_mb_ereg_search_init); + RUN_TEST(test_mb_ereg_search_pos); + RUN_TEST(test_mb_ereg_search_regs); + RUN_TEST(test_mb_ereg_search_setpos); + RUN_TEST(test_mb_ereg_search); + RUN_TEST(test_mb_ereg); + RUN_TEST(test_mb_eregi_replace); + RUN_TEST(test_mb_eregi); + RUN_TEST(test_mb_get_info); + RUN_TEST(test_mb_http_input); + RUN_TEST(test_mb_http_output); + RUN_TEST(test_mb_internal_encoding); + RUN_TEST(test_mb_language); + RUN_TEST(test_mb_output_handler); + RUN_TEST(test_mb_parse_str); + RUN_TEST(test_mb_preferred_mime_name); + RUN_TEST(test_mb_regex_encoding); + RUN_TEST(test_mb_regex_set_options); + RUN_TEST(test_mb_send_mail); + RUN_TEST(test_mb_split); + RUN_TEST(test_mb_strcut); + RUN_TEST(test_mb_strimwidth); + RUN_TEST(test_mb_stripos); + RUN_TEST(test_mb_stristr); + RUN_TEST(test_mb_strlen); + RUN_TEST(test_mb_strpos); + RUN_TEST(test_mb_strrchr); + RUN_TEST(test_mb_strrichr); + RUN_TEST(test_mb_strripos); + RUN_TEST(test_mb_strrpos); + RUN_TEST(test_mb_strstr); + RUN_TEST(test_mb_strtolower); + RUN_TEST(test_mb_strtoupper); + RUN_TEST(test_mb_strwidth); + RUN_TEST(test_mb_substitute_character); + RUN_TEST(test_mb_substr_count); + RUN_TEST(test_mb_substr); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMb::test_mb_list_encodings() { + VERIFY(!same(f_array_search("UTF-8", f_mb_list_encodings()), false)); + return Count(true); +} + +bool TestExtMb::test_mb_list_encodings_alias_names() { + VS(f_mb_list_encodings_alias_names()["Quoted-Printable"], + CREATE_VECTOR1("qprint")); + return Count(true); +} + +bool TestExtMb::test_mb_list_mime_names() { + VS(f_mb_list_mime_names()["UUENCODE"], "x-uuencode"); + return Count(true); +} + +bool TestExtMb::test_mb_check_encoding() { + VERIFY(f_mb_check_encoding("Pr\xC3\x9C\xC3\x9D""fung", "UTF-8")); + return Count(true); +} + +bool TestExtMb::test_mb_convert_case() { + String str = "mary had a Little lamb and she loved it so"; + str = f_mb_convert_case(str, k_MB_CASE_UPPER, "UTF-8"); + VS(str, "MARY HAD A LITTLE LAMB AND SHE LOVED IT SO"); + str = f_mb_convert_case(str, k_MB_CASE_TITLE, "UTF-8"); + VS(str, "Mary Had A Little Lamb And She Loved It So"); + return Count(true); +} + +bool TestExtMb::test_mb_convert_encoding() { + String str = "Pr\xC3\x9C""fung"; + + VS(f_mb_convert_encoding(str, "ISO-8859-1", "UTF-8"), "Pr\xDC""fung"); + VS(f_mb_convert_encoding(str, "ISO-8859-1", "UTF-8, JIS"), "Pr\xDC""fung"); + VS(f_mb_convert_encoding(str, "ISO-8859-1", "auto"), "Pr\xDC""fung"); + + return Count(true); +} + +bool TestExtMb::test_mb_convert_kana() { + //TODO + return Count(true); +} + +bool TestExtMb::test_mb_convert_variables() { + Variant str = "Pr\xC3\x9C""fung"; + Variant str1 = "Pr\xC3\x9C""fung"; + Variant str2 = "Pr\xC3\x9C""fung"; + Variant inputenc = f_mb_convert_variables(5, "ISO-8859-1", "UTF-8", ref(str), + CREATE_VECTOR2(ref(str1), + ref(str2))); + VS(str, "Pr\xDC""fung"); + VS(str1, "Pr\xDC""fung"); + VS(str2, "Pr\xDC""fung"); + return Count(true); +} + +bool TestExtMb::test_mb_decode_mimeheader() { + f_mb_internal_encoding("ISO-8859-1"); + VS(f_mb_decode_mimeheader("Subject: =?UTF-8?B?UHLDnGZ1bmcgUHLDnGZ1bmc=?=\n"), + "Subject: Pr\xDC""fung Pr\xDC""fung"); + f_mb_internal_encoding("UTF-8"); + return Count(true); +} + +bool TestExtMb::test_mb_decode_numericentity() { + Array convmap = CREATE_VECTOR4(0x0, 0x2FFFF, 0, 0xFFFF); + VS(f_mb_decode_numericentity("’ἀâ", convmap, "UTF-8"), + "\xe2\x80\x99\xe1\xbc\x80\xc3\xa2"); + return Count(true); +} + +bool TestExtMb::test_mb_detect_encoding() { + String str = "Pr\xC3\x9C\xC3\x9D""fung"; + + /* Detect character encoding with current detect_order */ + VS(f_mb_detect_encoding(str), "UTF-8"); + + /* "auto" is expanded to "ASCII,JIS,UTF-8,EUC-JP,SJIS" */ + VS(f_mb_detect_encoding(str, "auto"), "UTF-8"); + + /* Specify encoding_list character encoding by comma separated list */ + VS(f_mb_detect_encoding(str, "JIS, eucjp-win, sjis-win"), "SJIS-win"); + + /* Use array to specify encoding_list */ + Array ary = CREATE_VECTOR3("ASCII", "JIS", "EUC-JP"); + VS(f_mb_detect_encoding(str, ary), "EUC-JP"); + + return Count(true); +} + +bool TestExtMb::test_mb_detect_order() { + String str = "Pr\xC3\x9C\xC3\x9D""fung"; + + /* Set detection order by enumerated list */ + { + f_mb_detect_order("eucjp-win,sjis-win,UTF-8"); + VS(f_mb_detect_encoding(str), "SJIS-win"); + f_mb_detect_order("eucjp-win,UTF-8,sjis-win"); + VS(f_mb_detect_encoding(str), "UTF-8"); + } + + /* Set detection order by array */ + { + f_mb_detect_order(CREATE_VECTOR3("eucjp-win", "sjis-win", "UTF-8")); + VS(f_mb_detect_encoding(str), "SJIS-win"); + f_mb_detect_order(CREATE_VECTOR3("eucjp-win", "UTF-8", "sjis-win")); + VS(f_mb_detect_encoding(str), "UTF-8"); + } + + /* Display current detection order */ + VS(f_implode(", ", f_mb_detect_order()), "eucJP-win, UTF-8, SJIS-win"); + + return Count(true); +} + +bool TestExtMb::test_mb_encode_mimeheader() { + f_mb_internal_encoding("ISO-8859-1"); + VS(f_mb_encode_mimeheader("Subject: Pr\xDC""fung Pr\xDC""fung", + "UTF-8", "B"), + "Subject: =?UTF-8?B?UHLDnGZ1bmcgUHLDnGZ1bmc=?="); + f_mb_internal_encoding("UTF-8"); + return Count(true); +} + +bool TestExtMb::test_mb_encode_numericentity() { + Array convmap = CREATE_VECTOR4(0x0, 0x2FFFF, 0, 0xFFFF); + VS(f_mb_encode_numericentity("\xe2\x80\x99\xe1\xbc\x80\xc3\xa2", + convmap, "UTF-8"), + "’ἀâ"); + return Count(true); +} + +bool TestExtMb::test_mb_ereg_match() { + VERIFY(!f_mb_ereg_match("a", "some apples")); + VERIFY(f_mb_ereg_match("a", "a kiwi")); + VERIFY(f_mb_ereg_match(".*a", "some apples")); + return Count(true); +} + +bool TestExtMb::test_mb_ereg_replace() { + { + String str = "This is a test"; + VS(f_str_replace(" is", " was", str), "This was a test"); + VS(f_mb_ereg_replace("( )is", "\\1was", str), "This was a test"); + VS(f_mb_ereg_replace("(( )is)", "\\2was", str), "This was a test"); + } + { + int num = 4; + String str = "This string has four words."; + str = f_mb_ereg_replace("four", num, str); + VS(str, "This string has 4 words."); + } + { + String test = "http://test.com/test"; + test = f_mb_ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", + "\\0", test); + VS(test, "http://test.com/test"); + } + return Count(true); +} + +bool TestExtMb::test_mb_ereg_search_getpos() { + String str = "Pr\xC3\x9C\xC3\x9D""fung abc p\xC3\x9C"; + String reg = "\\w+"; + f_mb_regex_encoding("UTF-8"); + f_mb_ereg_search_init(str, reg); + Variant r = f_mb_ereg_search(); + r = f_mb_ereg_search_getregs(); // get first result + VS(r, CREATE_VECTOR1("Pr\xC3\x9C\xC3\x9D""fung")); + VS(f_mb_ereg_search_getpos(), 10); + return Count(true); +} + +bool TestExtMb::test_mb_ereg_search_getregs() { + String str = "Pr\xC3\x9C\xC3\x9D""fung abc p\xC3\x9C"; + String reg = "\\w+"; + f_mb_regex_encoding("UTF-8"); + f_mb_ereg_search_init(str, reg); + Variant r = f_mb_ereg_search(); + r = f_mb_ereg_search_getregs(); // get first result + VS(r, CREATE_VECTOR1("Pr\xC3\x9C\xC3\x9D""fung")); + return Count(true); +} + +bool TestExtMb::test_mb_ereg_search_init() { + VERIFY(f_mb_ereg_search_init("abcdefabcdabc", "abc")); + return Count(true); +} + +bool TestExtMb::test_mb_ereg_search_pos() { + String str = "Pr\xC3\x9C\xC3\x9D""fung abc p\xC3\x9C"; + String reg = "\\w+"; + f_mb_regex_encoding("UTF-8"); + f_mb_ereg_search_init(str, reg); + Variant r = f_mb_ereg_search(); + r = f_mb_ereg_search_getregs(); // get first result + VS(r, CREATE_VECTOR1("Pr\xC3\x9C\xC3\x9D""fung")); + VS(f_mb_ereg_search_pos(), CREATE_VECTOR2(11, 3)); + return Count(true); +} + +bool TestExtMb::test_mb_ereg_search_regs() { + String str = "Pr\xC3\x9C\xC3\x9D""fung abc p\xC3\x9C"; + String reg = "\\w+"; + f_mb_regex_encoding("UTF-8"); + f_mb_ereg_search_init(str, reg); + Variant r = f_mb_ereg_search(); + r = f_mb_ereg_search_getregs(); // get first result + VS(r, CREATE_VECTOR1("Pr\xC3\x9C\xC3\x9D""fung")); + r = f_mb_ereg_search_regs(); // get next result + VS(r, CREATE_VECTOR1("abc")); + return Count(true); +} + +bool TestExtMb::test_mb_ereg_search_setpos() { + String str = "Pr\xC3\x9C\xC3\x9D""fung abc p\xC3\x9C"; + String reg = "\\w+"; + f_mb_regex_encoding("UTF-8"); + f_mb_ereg_search_init(str, reg); + Variant r = f_mb_ereg_search(); + r = f_mb_ereg_search_getregs(); // get first result + VS(r, CREATE_VECTOR1("Pr\xC3\x9C\xC3\x9D""fung")); + VERIFY(f_mb_ereg_search_setpos(15)); + r = f_mb_ereg_search_regs(); // get next result + VS(r, CREATE_VECTOR1("p\xC3\x9C")); + return Count(true); +} + +bool TestExtMb::test_mb_ereg_search() { + String str = "Pr\xC3\x9C\xC3\x9D""fung abc p\xC3\x9C"; + String reg = "\\w+"; + f_mb_regex_encoding("UTF-8"); + f_mb_ereg_search_init(str, reg); + Variant r = f_mb_ereg_search(); + r = f_mb_ereg_search_getregs(); // get first result + VS(r, CREATE_VECTOR1("Pr\xC3\x9C\xC3\x9D""fung")); + return Count(true); +} + +bool TestExtMb::test_mb_ereg() { + Variant regs; + String date = "1973-04-30"; + VERIFY(f_mb_ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", date, ref(regs))); + VS(regs[3], "30"); + VS(regs[2], "04"); + VS(regs[1], "1973"); + VS(regs[0], "1973-04-30"); + return Count(true); +} + +bool TestExtMb::test_mb_eregi_replace() { + String pattern = "(>[^<]*)(suffix)"; + String replacement = "\\1\\2"; + String body = ">whateversuffix"; + body = f_mb_eregi_replace(pattern, replacement, body); + VS(body, ">whateversuffix"); + return Count(true); +} + +bool TestExtMb::test_mb_eregi() { + String str = "XYZ"; + VERIFY(f_mb_eregi("z", str)); + return Count(true); +} + +bool TestExtMb::test_mb_get_info() { + VERIFY(!f_mb_get_info()["detect_order"].toArray().empty()); + return Count(true); +} + +bool TestExtMb::test_mb_http_input() { + // TODO: test this in TestServer + VS(f_mb_http_input(), false); + return Count(true); +} + +bool TestExtMb::test_mb_http_output() { + // TODO: test this in TestServer + VS(f_mb_http_output(), "pass"); + return Count(true); +} + +bool TestExtMb::test_mb_internal_encoding() { + /* Set internal character encoding to UTF-8 */ + f_mb_internal_encoding("UTF-8"); + + /* Display current internal character encoding */ + VS(f_mb_internal_encoding(), "UTF-8"); + return Count(true); +} + +bool TestExtMb::test_mb_language() { + VS(f_mb_language(), "uni"); + return Count(true); +} + +bool TestExtMb::test_mb_output_handler() { + // TODO: test this in TestServer + return Count(true); +} + +bool TestExtMb::test_mb_parse_str() { + Variant output; + f_mb_parse_str("first=value&arr[]=foo+bar&arr[]=baz", ref(output)); + VS(output["first"], "value"); + VS(output["arr[]"], "baz"); // bug in mb_parse_str not following PHP's + return Count(true); +} + +bool TestExtMb::test_mb_preferred_mime_name() { + VS(f_mb_preferred_mime_name("sjis-win"), "Shift_JIS"); + return Count(true); +} + +bool TestExtMb::test_mb_regex_encoding() { + VERIFY(f_mb_regex_encoding("UTF-8")); + VS(f_mb_regex_encoding(), "UTF-8"); + return Count(true); +} + +bool TestExtMb::test_mb_regex_set_options() { + VS(f_mb_regex_set_options(), "pr"); + VERIFY(f_mb_regex_set_options("pz")); + VS(f_mb_regex_set_options(), "pz"); + return Count(true); +} + +bool TestExtMb::test_mb_send_mail() { + //VERIFY(f_mb_send_mail("hzhao@facebook.com", __func__, "test"); + return Count(true); +} + +bool TestExtMb::test_mb_split() { + String date = "04/30/1973"; + Array ret = f_mb_split("[/.-]", date); + VS(ret[0], "04"); + VS(ret[1], "30"); + VS(ret[2], "1973"); + return Count(true); +} + +bool TestExtMb::test_mb_strcut() { + VS(f_mb_strcut("abcdef", 1), "bcdef"); + VS(f_mb_strcut("abcdef", 1, 3), "bcd"); + VS(f_mb_strcut("abcdef", 0, 4), "abcd"); + VS(f_mb_strcut("abcdef", 0, 8), "abcdef"); + VS(f_mb_strcut("abcdef", -1, 1), "f"); + + VS(f_mb_strcut("\xC3\x9C""bcdef", 2), "bcdef"); + VS(f_mb_strcut("\xC3\x9C""bcdef", 2, 3), "bcd"); + VS(f_mb_strcut("\xC3\x9C""bcdef", 0, 4), "\xC3\x9C""bc"); + VS(f_mb_strcut("\xC3\x9C""bcdef", 0, 8), "\xC3\x9C""bcdef"); + VS(f_mb_strcut("\xC3\x9C""bcdef", -1, 1), "f"); + + return Count(true); +} + +bool TestExtMb::test_mb_strimwidth() { + VS(f_mb_strimwidth("long string", 0, 6, "..>"), "lon..>"); + VS(f_mb_strimwidth("\xC3\x9C""long string", 0, 6, "..>"), "\xC3\x9C""lo..>"); + return Count(true); +} + +bool TestExtMb::test_mb_stripos() { + VS(f_mb_stripos("abcdef abcdef", "A", 1), 7); + VS(f_mb_stripos("abcdef\xC3\x9C""abcdef", "A", 1), 7); + return Count(true); +} + +bool TestExtMb::test_mb_stristr() { + VS(f_mb_stristr("Hello World!", "earth"), false); + return Count(true); +} + +bool TestExtMb::test_mb_strlen() { + VS(f_mb_strlen("test"), 4); + VS(f_mb_strlen("Pr\xC3\x9C\xC3\x9D""fung"), 8); + return Count(true); +} + +bool TestExtMb::test_mb_strpos() { + VS(f_mb_strpos("abcdef abcdef", "a", 1), 7); + VS(f_mb_strpos("abcdef\xC3\x9C""abcdef", "a", 1), 7); + VS(f_mb_strpos("abcdef\xC3\x9C""abcdef", "A", 1), false); + return Count(true); +} + +bool TestExtMb::test_mb_strrchr() { + { + String text = "Line 1\nLine 2\nLine 3"; + VS(f_mb_strrchr(text, "\n"), "\nLine 3"); + } + { + String text = "Line 1\nLine 2\xC3\x9C""Line 3"; + VS(f_strrchr(text, "\x9C"), "\x9C""Line 3"); + VS(f_mb_strrchr(text, "\x9C"), false); + } + return Count(true); +} + +bool TestExtMb::test_mb_strrichr() { + { + String text = "Line 1\nLine 2\nLine 3"; + VS(f_mb_strrichr(text, "l"), "Line 3"); + } + return Count(true); +} + +bool TestExtMb::test_mb_strripos() { + VS(f_mb_strripos("abcdef abcdef", "A"), 7); + VS(f_mb_strripos("abcdef\xC3\x9C""abcdef", "A"), 7); + return Count(true); +} + +bool TestExtMb::test_mb_strrpos() { + VS(f_mb_strrpos("abcdef abcdef", "a"), 7); + VS(f_mb_strrpos("abcdef\xC3\x9C""abcdef", "a"), 7); + return Count(true); +} + +bool TestExtMb::test_mb_strstr() { + String email = "name@example.com"; + VS(f_mb_strstr(email, "@"), "@example.com"); + return Count(true); +} + +bool TestExtMb::test_mb_strtolower() { + String str = "Mary Had A Little Lamb and She LOVED It So"; + str = f_mb_strtolower(str); + VS(str, "mary had a little lamb and she loved it so"); + VS(f_mb_strtolower("ABC"), "abc"); + return Count(true); +} + +bool TestExtMb::test_mb_strtoupper() { + String str = "Mary Had A Little Lamb and She LOVED It So"; + str = f_mb_strtoupper(str); + VS(str, "MARY HAD A LITTLE LAMB AND SHE LOVED IT SO"); + VS(f_mb_strtoupper("abc"), "ABC"); + return Count(true); +} + +bool TestExtMb::test_mb_strwidth() { + VS(f_mb_strwidth("Pr\xC3\x9C""fung"), 7); + return Count(true); +} + +bool TestExtMb::test_mb_substitute_character() { + /* Set with Unicode U+3013 (GETA MARK) */ + f_mb_substitute_character(0x3013); + VS(f_mb_substitute_character(), 0x3013); + + /* Set hex format */ + f_mb_substitute_character("long"); + + /* Display current setting */ + VS(f_mb_substitute_character(), "long"); + return Count(true); +} + +bool TestExtMb::test_mb_substr_count() { + VS(f_mb_substr_count("This is a test", "is"), 2); + String text = "This is a test"; + VS(f_mb_substr_count(text, "is"), 2); + + // different from substr_count + VS(f_mb_substr_count("gcdgcdgcd", "gcdgcd"), 2); + return Count(true); +} + +bool TestExtMb::test_mb_substr() { + VS(f_mb_substr("abcdef", 1), "bcdef"); + VS(f_mb_substr("abcdef", 1, 3), "bcd"); + VS(f_mb_substr("abcdef", 0, 4), "abcd"); + VS(f_mb_substr("abcdef", 0, 8), "abcdef"); + VS(f_mb_substr("abcdef", -1, 1), "f"); + + VS(f_mb_substr("\xC3\x9C""bcdef", 1), "bcdef"); + VS(f_mb_substr("\xC3\x9C""bcdef", 1, 3), "bcd"); + VS(f_mb_substr("\xC3\x9C""bcdef", 0, 4), "\xC3\x9C""bcd"); + VS(f_mb_substr("\xC3\x9C""bcdef", 0, 8), "\xC3\x9C""bcdef"); + VS(f_mb_substr("\xC3\x9C""bcdef", -1, 1), "f"); + return Count(true); +} diff --git a/src/test/test_ext_mb.h b/src/test/test_ext_mb.h new file mode 100644 index 0000000000000..c5dbe84f25399 --- /dev/null +++ b/src/test/test_ext_mb.h @@ -0,0 +1,89 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_MB_H__ +#define __TEST_EXT_MB_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtMb : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_mb_list_encodings(); + bool test_mb_list_encodings_alias_names(); + bool test_mb_list_mime_names(); + bool test_mb_check_encoding(); + bool test_mb_convert_case(); + bool test_mb_convert_encoding(); + bool test_mb_convert_kana(); + bool test_mb_convert_variables(); + bool test_mb_decode_mimeheader(); + bool test_mb_decode_numericentity(); + bool test_mb_detect_encoding(); + bool test_mb_detect_order(); + bool test_mb_encode_mimeheader(); + bool test_mb_encode_numericentity(); + bool test_mb_ereg_match(); + bool test_mb_ereg_replace(); + bool test_mb_ereg_search_getpos(); + bool test_mb_ereg_search_getregs(); + bool test_mb_ereg_search_init(); + bool test_mb_ereg_search_pos(); + bool test_mb_ereg_search_regs(); + bool test_mb_ereg_search_setpos(); + bool test_mb_ereg_search(); + bool test_mb_ereg(); + bool test_mb_eregi_replace(); + bool test_mb_eregi(); + bool test_mb_get_info(); + bool test_mb_http_input(); + bool test_mb_http_output(); + bool test_mb_internal_encoding(); + bool test_mb_language(); + bool test_mb_output_handler(); + bool test_mb_parse_str(); + bool test_mb_preferred_mime_name(); + bool test_mb_regex_encoding(); + bool test_mb_regex_set_options(); + bool test_mb_send_mail(); + bool test_mb_split(); + bool test_mb_strcut(); + bool test_mb_strimwidth(); + bool test_mb_stripos(); + bool test_mb_stristr(); + bool test_mb_strlen(); + bool test_mb_strpos(); + bool test_mb_strrchr(); + bool test_mb_strrichr(); + bool test_mb_strripos(); + bool test_mb_strrpos(); + bool test_mb_strstr(); + bool test_mb_strtolower(); + bool test_mb_strtoupper(); + bool test_mb_strwidth(); + bool test_mb_substitute_character(); + bool test_mb_substr_count(); + bool test_mb_substr(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_MB_H__ diff --git a/src/test/test_ext_mcrypt.cpp b/src/test/test_ext_mcrypt.cpp new file mode 100644 index 0000000000000..e47b401c405af --- /dev/null +++ b/src/test/test_ext_mcrypt.cpp @@ -0,0 +1,327 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMcrypt::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_mcrypt_module_open); + RUN_TEST(test_mcrypt_module_close); + RUN_TEST(test_mcrypt_list_algorithms); + RUN_TEST(test_mcrypt_list_modes); + RUN_TEST(test_mcrypt_module_get_algo_block_size); + RUN_TEST(test_mcrypt_module_get_algo_key_size); + RUN_TEST(test_mcrypt_module_get_supported_key_sizes); + RUN_TEST(test_mcrypt_module_is_block_algorithm_mode); + RUN_TEST(test_mcrypt_module_is_block_algorithm); + RUN_TEST(test_mcrypt_module_is_block_mode); + RUN_TEST(test_mcrypt_module_self_test); + RUN_TEST(test_mcrypt_create_iv); + RUN_TEST(test_mcrypt_encrypt); + RUN_TEST(test_mcrypt_decrypt); + RUN_TEST(test_mcrypt_cbc); + RUN_TEST(test_mcrypt_cfb); + RUN_TEST(test_mcrypt_ecb); + RUN_TEST(test_mcrypt_ofb); + RUN_TEST(test_mcrypt_get_block_size); + RUN_TEST(test_mcrypt_get_cipher_name); + RUN_TEST(test_mcrypt_get_iv_size); + RUN_TEST(test_mcrypt_get_key_size); + RUN_TEST(test_mcrypt_enc_get_algorithms_name); + RUN_TEST(test_mcrypt_enc_get_block_size); + RUN_TEST(test_mcrypt_enc_get_iv_size); + RUN_TEST(test_mcrypt_enc_get_key_size); + RUN_TEST(test_mcrypt_enc_get_modes_name); + RUN_TEST(test_mcrypt_enc_get_supported_key_sizes); + RUN_TEST(test_mcrypt_enc_is_block_algorithm_mode); + RUN_TEST(test_mcrypt_enc_is_block_algorithm); + RUN_TEST(test_mcrypt_enc_is_block_mode); + RUN_TEST(test_mcrypt_enc_self_test); + RUN_TEST(test_mcrypt_generic); + RUN_TEST(test_mcrypt_generic_init); + RUN_TEST(test_mdecrypt_generic); + RUN_TEST(test_mcrypt_generic_deinit); + RUN_TEST(test_mcrypt_generic_end); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMcrypt::test_mcrypt_module_open() { + Variant td = f_mcrypt_module_open("rijndael-256", "", "ofb", ""); + Variant iv = f_mcrypt_create_iv(f_mcrypt_enc_get_iv_size(td), + k_MCRYPT_DEV_RANDOM); + Variant ks = f_mcrypt_enc_get_key_size(td); + Variant key = f_substr(f_md5("very secret key"), 0, ks); + f_mcrypt_generic_init(td, key, iv); + Variant encrypted = f_mcrypt_generic(td, "This is very important data"); + VERIFY(!same(encrypted, "This is very important data")); + f_mcrypt_generic_deinit(td); + f_mcrypt_generic_init(td, key, iv); + Variant decrypted = f_mdecrypt_generic(td, encrypted); + f_mcrypt_generic_end(td); + f_mcrypt_module_close(td); + + VS(decrypted, "This is very important data"); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_module_close() { + // tested in test_mcrypt_module_open() + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_list_algorithms() { + VERIFY(array_value_exists(f_mcrypt_list_algorithms(), "blowfish")); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_list_modes() { + VERIFY(array_value_exists(f_mcrypt_list_modes(), "cbc")); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_module_get_algo_block_size() { + VS(f_mcrypt_module_get_algo_block_size("blowfish"), 8); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_module_get_algo_key_size() { + VS(f_mcrypt_module_get_algo_key_size("blowfish"), 56); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_module_get_supported_key_sizes() { + VS(f_mcrypt_module_get_supported_key_sizes("blowfish"), Array::Create()); + VS(f_mcrypt_module_get_supported_key_sizes("twofish"), + CREATE_VECTOR3(16, 24, 32)); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_module_is_block_algorithm_mode() { + VS(f_mcrypt_module_is_block_algorithm_mode("cbc"), true); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_module_is_block_algorithm() { + VS(f_mcrypt_module_is_block_algorithm("blowfish"), true); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_module_is_block_mode() { + VS(f_mcrypt_module_is_block_mode("cbc"), true); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_module_self_test() { + VS(f_mcrypt_module_self_test(k_MCRYPT_RIJNDAEL_128), true); + VS(f_mcrypt_module_self_test("bogus"), false); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_create_iv() { + // tested in test_mcrypt_module_open() + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_encrypt() { + String text = "boggles the inivisble monkey will rule the world"; + String key = "very secret key"; + Variant iv_size = f_mcrypt_get_iv_size(k_MCRYPT_XTEA, k_MCRYPT_MODE_ECB); + Variant iv = f_mcrypt_create_iv(iv_size, k_MCRYPT_RAND); + Variant enc = f_mcrypt_encrypt(k_MCRYPT_XTEA, key, text, k_MCRYPT_MODE_ECB, + iv); + VS(f_bin2hex(enc), "f522c62002fa16129c8576bcddc6dd0f7ea81991103ba42962d94c8bfff3ee660d53b187d7e989540abf5a729c2f7baf"); + Variant crypttext = f_mcrypt_decrypt(k_MCRYPT_XTEA, key, enc, + k_MCRYPT_MODE_ECB, iv); + VS(crypttext, text); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_decrypt() { + // tested in test_mcrypt_encrypt() + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_cbc() { + String key = "123456789012345678901234567890123456789012345678901234567890"; + String CC = "4007000000027"; + Variant encrypted = + f_mcrypt_cbc(k_MCRYPT_RIJNDAEL_128, f_substr(key,0,32), + CC, k_MCRYPT_ENCRYPT, f_substr(key,32,16)); + Variant decrypted = + f_mcrypt_cbc(k_MCRYPT_RIJNDAEL_128, f_substr(key,0,32), + encrypted, k_MCRYPT_DECRYPT, f_substr(key,32,16)); + VERIFY(!same(encrypted, decrypted)); + VS(decrypted.toString().data(), CC); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_cfb() { + String key = "123456789012345678901234567890123456789012345678901234567890"; + String CC = "4007000000027"; + Variant encrypted = + f_mcrypt_cfb(k_MCRYPT_RIJNDAEL_128, f_substr(key,0,32), + CC, k_MCRYPT_ENCRYPT, f_substr(key,32,16)); + Variant decrypted = + f_mcrypt_cfb(k_MCRYPT_RIJNDAEL_128, f_substr(key,0,32), + encrypted, k_MCRYPT_DECRYPT, f_substr(key,32,16)); + VERIFY(!same(encrypted, decrypted)); + VS(decrypted, CC); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_ecb() { + String key = "123456789012345678901234567890123456789012345678901234567890"; + String CC = "4007000000027"; + Variant encrypted = + f_mcrypt_ecb(k_MCRYPT_RIJNDAEL_128, f_substr(key,0,32), + CC, k_MCRYPT_ENCRYPT, f_substr(key,32,16)); + Variant decrypted = + f_mcrypt_ecb(k_MCRYPT_RIJNDAEL_128, f_substr(key,0,32), + encrypted, k_MCRYPT_DECRYPT, f_substr(key,32,16)); + VERIFY(!same(encrypted, decrypted)); + VS(decrypted.toString().data(), CC); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_ofb() { + String key = "123456789012345678901234567890123456789012345678901234567890"; + String CC = "4007000000027"; + Variant encrypted = + f_mcrypt_ofb(k_MCRYPT_RIJNDAEL_128, f_substr(key,0,32), + CC, k_MCRYPT_ENCRYPT, f_substr(key,32,16)); + Variant decrypted = + f_mcrypt_ofb(k_MCRYPT_RIJNDAEL_128, f_substr(key,0,32), + encrypted, k_MCRYPT_DECRYPT, f_substr(key,32,16)); + VERIFY(!same(encrypted, decrypted)); + VS(decrypted, CC); + return Count(true); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_get_block_size() { + VS(f_mcrypt_get_block_size("tripledes", "ecb"), 8); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_get_cipher_name() { + VS(f_mcrypt_get_cipher_name(k_MCRYPT_TRIPLEDES), "3DES"); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_get_iv_size() { + VS(f_mcrypt_get_iv_size(k_MCRYPT_CAST_256, k_MCRYPT_MODE_CFB), 16); + VS(f_mcrypt_get_iv_size("des", "ecb"), 8); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_get_key_size() { + VS(f_mcrypt_get_key_size("tripledes", "ecb"), 24); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_enc_get_algorithms_name() { + Variant td = f_mcrypt_module_open("cast-256", "", "cfb", ""); + VS(f_mcrypt_enc_get_algorithms_name(td), "CAST-256"); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_enc_get_block_size() { + Variant td = f_mcrypt_module_open("tripledes", "", "ecb", ""); + VS(f_mcrypt_enc_get_block_size(td), 8); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_enc_get_iv_size() { + Variant td = f_mcrypt_module_open("cast-256", "", "cfb", ""); + VS(f_mcrypt_enc_get_iv_size(td), 16); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_enc_get_key_size() { + Variant td = f_mcrypt_module_open("tripledes", "", "ecb", ""); + VS(f_mcrypt_enc_get_key_size(td), 24); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_enc_get_modes_name() { + Variant td = f_mcrypt_module_open("cast-256", "", "cfb", ""); + VS(f_mcrypt_enc_get_modes_name(td), "CFB"); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_enc_get_supported_key_sizes() { + Variant td = f_mcrypt_module_open("rijndael-256", "", "ecb", ""); + VS(f_mcrypt_enc_get_supported_key_sizes(td), + CREATE_VECTOR3(16, 24, 32)); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_enc_is_block_algorithm_mode() { + Variant td = f_mcrypt_module_open("tripledes", "", "ecb", ""); + VS(f_mcrypt_enc_is_block_algorithm_mode(td), true); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_enc_is_block_algorithm() { + Variant td = f_mcrypt_module_open("tripledes", "", "ecb", ""); + VS(f_mcrypt_enc_is_block_algorithm(td), true); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_enc_is_block_mode() { + Variant td = f_mcrypt_module_open("tripledes", "", "ecb", ""); + VS(f_mcrypt_enc_is_block_mode(td), true); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_enc_self_test() { + Variant td = f_mcrypt_module_open("tripledes", "", "ecb", ""); + VS(f_mcrypt_enc_self_test(td), 0); + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_generic() { + // tested in test_mcrypt_module_open() + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_generic_init() { + // tested in test_mcrypt_module_open() + return Count(true); +} + +bool TestExtMcrypt::test_mdecrypt_generic() { + // tested in test_mcrypt_module_open() + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_generic_deinit() { + // tested in test_mcrypt_module_open() + return Count(true); +} + +bool TestExtMcrypt::test_mcrypt_generic_end() { + // tested in test_mcrypt_module_open() + return Count(true); +} diff --git a/src/test/test_ext_mcrypt.h b/src/test/test_ext_mcrypt.h new file mode 100644 index 0000000000000..91dadeb6117a5 --- /dev/null +++ b/src/test/test_ext_mcrypt.h @@ -0,0 +1,71 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_MCRYPT_H__ +#define __TEST_EXT_MCRYPT_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtMcrypt : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_mcrypt_module_open(); + bool test_mcrypt_module_close(); + bool test_mcrypt_list_algorithms(); + bool test_mcrypt_list_modes(); + bool test_mcrypt_module_get_algo_block_size(); + bool test_mcrypt_module_get_algo_key_size(); + bool test_mcrypt_module_get_supported_key_sizes(); + bool test_mcrypt_module_is_block_algorithm_mode(); + bool test_mcrypt_module_is_block_algorithm(); + bool test_mcrypt_module_is_block_mode(); + bool test_mcrypt_module_self_test(); + bool test_mcrypt_create_iv(); + bool test_mcrypt_encrypt(); + bool test_mcrypt_decrypt(); + bool test_mcrypt_cbc(); + bool test_mcrypt_cfb(); + bool test_mcrypt_ecb(); + bool test_mcrypt_ofb(); + bool test_mcrypt_get_block_size(); + bool test_mcrypt_get_cipher_name(); + bool test_mcrypt_get_iv_size(); + bool test_mcrypt_get_key_size(); + bool test_mcrypt_enc_get_algorithms_name(); + bool test_mcrypt_enc_get_block_size(); + bool test_mcrypt_enc_get_iv_size(); + bool test_mcrypt_enc_get_key_size(); + bool test_mcrypt_enc_get_modes_name(); + bool test_mcrypt_enc_get_supported_key_sizes(); + bool test_mcrypt_enc_is_block_algorithm_mode(); + bool test_mcrypt_enc_is_block_algorithm(); + bool test_mcrypt_enc_is_block_mode(); + bool test_mcrypt_enc_self_test(); + bool test_mcrypt_generic(); + bool test_mcrypt_generic_init(); + bool test_mdecrypt_generic(); + bool test_mcrypt_generic_deinit(); + bool test_mcrypt_generic_end(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_MCRYPT_H__ diff --git a/src/test/test_ext_misc.cpp b/src/test/test_ext_misc.cpp new file mode 100644 index 0000000000000..ba49be77fc38e --- /dev/null +++ b/src/test/test_ext_misc.cpp @@ -0,0 +1,224 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMisc::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_connection_aborted); + RUN_TEST(test_connection_status); + RUN_TEST(test_connection_timeout); + RUN_TEST(test_constant); + RUN_TEST(test_define); + RUN_TEST(test_defined); + RUN_TEST(test_die); + RUN_TEST(test_exit); + RUN_TEST(test_eval); + RUN_TEST(test_get_browser); + RUN_TEST(test___halt_compiler); + RUN_TEST(test_highlight_file); + RUN_TEST(test_show_source); + RUN_TEST(test_highlight_string); + RUN_TEST(test_ignore_user_abort); + RUN_TEST(test_pack); + RUN_TEST(test_php_check_syntax); + RUN_TEST(test_php_strip_whitespace); + RUN_TEST(test_sleep); + RUN_TEST(test_usleep); + RUN_TEST(test_time_nanosleep); + RUN_TEST(test_time_sleep_until); + RUN_TEST(test_uniqid); + RUN_TEST(test_unpack); + RUN_TEST(test_sys_getloadavg); + RUN_TEST(test_token_get_all); + RUN_TEST(test_token_name); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMisc::test_connection_aborted() { + VERIFY(!f_connection_aborted()); + return Count(true); +} + +bool TestExtMisc::test_connection_status() { + VERIFY(f_connection_status() == k_CONNECTION_NORMAL); + return Count(true); +} + +bool TestExtMisc::test_connection_timeout() { + VERIFY(!f_connection_timeout()); + return Count(true); +} + +bool TestExtMisc::test_constant() { + f_constant("a"); + return Count(true); +} + +bool TestExtMisc::test_define() { + // a function that's never called + return Count(true); +} + +bool TestExtMisc::test_defined() { + VERIFY(!f_defined("a")); + return Count(true); +} + +bool TestExtMisc::test_die() { + // can't really test this + return Count(true); +} + +bool TestExtMisc::test_exit() { + // can't really test this + return Count(true); +} + +bool TestExtMisc::test_eval() { + try { + f_eval("a"); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMisc::test_get_browser() { + try { + f_get_browser(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMisc::test___halt_compiler() { + f___halt_compiler(); + return Count(true); +} + +bool TestExtMisc::test_highlight_file() { + try { + f_highlight_file("a"); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMisc::test_show_source() { + try { + f_show_source("a"); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMisc::test_highlight_string() { + try { + f_highlight_string("a"); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMisc::test_ignore_user_abort() { + f_ignore_user_abort("a"); + return Count(true); +} + +bool TestExtMisc::test_pack() { + // covered in TestCodeRun::TestExtMisc + return Count(true); +} + +bool TestExtMisc::test_php_check_syntax() { + try { + f_php_check_syntax("a"); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMisc::test_php_strip_whitespace() { + try { + f_php_strip_whitespace("a"); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMisc::test_sleep() { + f_sleep(1); + return Count(true); +} + +bool TestExtMisc::test_usleep() { + f_usleep(1); + return Count(true); +} + +bool TestExtMisc::test_time_nanosleep() { + f_time_nanosleep(0, 100); + return Count(true); +} + +bool TestExtMisc::test_time_sleep_until() { + struct timeval tm; + gettimeofday((struct timeval *)&tm, NULL); + double timestamp = tm.tv_sec + tm.tv_usec / 1000000.0 + 2; + f_time_sleep_until(timestamp); + return Count(true); +} + +bool TestExtMisc::test_uniqid() { + VERIFY(!f_uniqid().empty()); + return Count(true); +} + +bool TestExtMisc::test_unpack() { + // covered in TestCodeRun::TestExtMisc + return Count(true); +} + +bool TestExtMisc::test_sys_getloadavg() { + VERIFY(f_sys_getloadavg().size() == 3); + return Count(true); +} + +bool TestExtMisc::test_token_get_all() { + String src = "blarb >>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtMisc : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_connection_aborted(); + bool test_connection_status(); + bool test_connection_timeout(); + bool test_constant(); + bool test_define(); + bool test_defined(); + bool test_die(); + bool test_exit(); + bool test_eval(); + bool test_get_browser(); + bool test___halt_compiler(); + bool test_highlight_file(); + bool test_show_source(); + bool test_highlight_string(); + bool test_ignore_user_abort(); + bool test_pack(); + bool test_php_check_syntax(); + bool test_php_strip_whitespace(); + bool test_sleep(); + bool test_usleep(); + bool test_time_nanosleep(); + bool test_time_sleep_until(); + bool test_uniqid(); + bool test_unpack(); + bool test_sys_getloadavg(); + bool test_token_get_all(); + bool test_token_name(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_MISC_H__ diff --git a/src/test/test_ext_mysql.cpp b/src/test/test_ext_mysql.cpp new file mode 100644 index 0000000000000..aa8726a1a0552 --- /dev/null +++ b/src/test/test_ext_mysql.cpp @@ -0,0 +1,602 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMysql::RunTests(const std::string &which) { + bool ret = true; + RuntimeOption::MySQLReadOnly = false; + + RUN_TEST(test_mysql_connect); + RUN_TEST(test_mysql_pconnect); + RUN_TEST(test_mysql_set_charset); + RUN_TEST(test_mysql_ping); + RUN_TEST(test_mysql_escape_string); + RUN_TEST(test_mysql_real_escape_string); + RUN_TEST(test_mysql_client_encoding); + RUN_TEST(test_mysql_close); + RUN_TEST(test_mysql_errno); + RUN_TEST(test_mysql_error); + RUN_TEST(test_mysql_get_client_info); + RUN_TEST(test_mysql_get_host_info); + RUN_TEST(test_mysql_get_proto_info); + RUN_TEST(test_mysql_get_server_info); + RUN_TEST(test_mysql_info); + RUN_TEST(test_mysql_insert_id); + RUN_TEST(test_mysql_stat); + RUN_TEST(test_mysql_thread_id); + RUN_TEST(test_mysql_create_db); + RUN_TEST(test_mysql_select_db); + RUN_TEST(test_mysql_drop_db); + RUN_TEST(test_mysql_affected_rows); + RUN_TEST(test_mysql_set_timeout); + RUN_TEST(test_mysql_query); + RUN_TEST(test_mysql_unbuffered_query); + RUN_TEST(test_mysql_db_query); + RUN_TEST(test_mysql_list_dbs); + RUN_TEST(test_mysql_list_tables); + RUN_TEST(test_mysql_list_fields); + RUN_TEST(test_mysql_list_processes); + RUN_TEST(test_mysql_db_name); + RUN_TEST(test_mysql_tablename); + RUN_TEST(test_mysql_num_fields); + RUN_TEST(test_mysql_num_rows); + RUN_TEST(test_mysql_free_result); + RUN_TEST(test_mysql_data_seek); + RUN_TEST(test_mysql_fetch_row); + RUN_TEST(test_mysql_fetch_assoc); + RUN_TEST(test_mysql_fetch_array); + RUN_TEST(test_mysql_fetch_lengths); + RUN_TEST(test_mysql_fetch_object); + RUN_TEST(test_mysql_result); + RUN_TEST(test_mysql_fetch_field); + RUN_TEST(test_mysql_field_seek); + RUN_TEST(test_mysql_field_name); + RUN_TEST(test_mysql_field_table); + RUN_TEST(test_mysql_field_len); + RUN_TEST(test_mysql_field_type); + RUN_TEST(test_mysql_field_flags); + + return ret; +} + +static bool CreateTestTable() { + f_mysql_select_db(TEST_DATABASE); + f_mysql_query("drop table test"); + return f_mysql_query("create table test (id int not null auto_increment," + " name varchar(255) not null, primary key (id)) " + "engine=innodb"); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtMysql::test_mysql_connect() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(!same(conn, false)); + return Count(true); +} + +bool TestExtMysql::test_mysql_pconnect() { + Variant conn = f_mysql_pconnect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(!same(conn, false)); + return Count(true); +} + +bool TestExtMysql::test_mysql_set_charset() { + try { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, + TEST_PASSWORD); + VERIFY(f_mysql_set_charset("utf8", conn)); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMysql::test_mysql_ping() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(f_mysql_ping()); + return Count(true); +} + +bool TestExtMysql::test_mysql_escape_string() { + String item = "Zak's Laptop"; + String escaped_item = f_mysql_escape_string(item); + VS(escaped_item, "Zak\\'s Laptop"); + return Count(true); +} + +bool TestExtMysql::test_mysql_real_escape_string() { + { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, + TEST_PASSWORD); + String item = "Zak's Laptop"; + String escaped_item = f_mysql_real_escape_string(item); + VS(escaped_item, "Zak\\'s Laptop"); + f_mysql_close(conn); + VS(f_mysql_real_escape_string(item), false); + } + return Count(true); +} + +bool TestExtMysql::test_mysql_client_encoding() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VS(f_mysql_client_encoding(), "latin1"); + return Count(true); +} + +bool TestExtMysql::test_mysql_close() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(f_mysql_close(conn)); + return Count(true); +} + +bool TestExtMysql::test_mysql_errno() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(!f_mysql_select_db("nonexistentdb")); + VS(f_mysql_errno(conn), 1049); + return Count(true); +} + +bool TestExtMysql::test_mysql_error() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(!f_mysql_select_db("nonexistentdb")); + VS(f_mysql_error(conn), "Unknown database 'nonexistentdb'"); + return Count(true); +} + +bool TestExtMysql::test_mysql_get_client_info() { + VERIFY(!f_mysql_get_client_info().empty()); + return Count(true); +} + +bool TestExtMysql::test_mysql_get_host_info() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(!f_mysql_get_host_info().toString().empty()); + return Count(true); +} + +bool TestExtMysql::test_mysql_get_proto_info() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VS(f_mysql_get_proto_info(), 10); + return Count(true); +} + +bool TestExtMysql::test_mysql_get_server_info() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(!f_mysql_get_server_info().toString().empty()); + return Count(true); +} + +bool TestExtMysql::test_mysql_info() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + VS(f_mysql_info(), "Records: 2 Duplicates: 0 Warnings: 0"); + return Count(true); +} + +bool TestExtMysql::test_mysql_insert_id() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + VS(f_mysql_insert_id(), 1); + return Count(true); +} + +bool TestExtMysql::test_mysql_stat() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(!f_mysql_stat().toString().empty()); + return Count(true); +} + +bool TestExtMysql::test_mysql_thread_id() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(more(f_mysql_thread_id(), 0)); + return Count(true); +} + +bool TestExtMysql::test_mysql_create_db() { + try { + f_mysql_create_db(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMysql::test_mysql_select_db() { + // tested in mysql_info + return Count(true); +} + +bool TestExtMysql::test_mysql_drop_db() { + try { + f_mysql_drop_db(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMysql::test_mysql_affected_rows() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + VS(f_mysql_affected_rows(), 2); + return Count(true); +} + +bool TestExtMysql::test_mysql_set_timeout() { + VERIFY(f_mysql_set_timeout(10)); + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD, + true, 0, 20, 50); + VERIFY(!same(conn, false)); + return Count(true); +} + +bool TestExtMysql::test_mysql_query() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + Variant row = f_mysql_fetch_assoc(res); + VS(f_print_r(row, true), + "Array\n" + "(\n" + " [id] => 1\n" + " [name] => test\n" + ")\n"); + + row = f_mysql_fetch_assoc(res); + VS(f_print_r(row, true), + "Array\n" + "(\n" + " [id] => 2\n" + " [name] => test2\n" + ")\n"); + + row = f_mysql_fetch_assoc(res); + VS(row, false); + return Count(true); +} + +bool TestExtMysql::test_mysql_unbuffered_query() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_unbuffered_query("select * from test"); + Variant row = f_mysql_fetch_assoc(res); + VS(f_print_r(row, true), + "Array\n" + "(\n" + " [id] => 1\n" + " [name] => test\n" + ")\n"); + + row = f_mysql_fetch_assoc(res); + VS(f_print_r(row, true), + "Array\n" + "(\n" + " [id] => 2\n" + " [name] => test2\n" + ")\n"); + + row = f_mysql_fetch_assoc(res); + VS(row, false); + return Count(true); +} + +bool TestExtMysql::test_mysql_db_query() { + try { + f_mysql_db_query("", ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMysql::test_mysql_list_dbs() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + Variant res = f_mysql_list_dbs(); + Variant db = f_mysql_fetch_assoc(res); + VERIFY(!db["Database"].toString().empty()); + return Count(true); +} + +bool TestExtMysql::test_mysql_list_tables() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + Variant res = f_mysql_list_tables(TEST_DATABASE); + Variant table = f_mysql_fetch_assoc(res); + VERIFY(!table[String("Tables_in_") + TEST_DATABASE].toString().empty()); + return Count(true); +} + +bool TestExtMysql::test_mysql_list_fields() { + try { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, + TEST_PASSWORD); + f_mysql_list_fields(TEST_DATABASE, "test"); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtMysql::test_mysql_list_processes() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + Variant res = f_mysql_list_processes(); + Variant process = f_mysql_fetch_assoc(res); + VERIFY(!process["Id"].toString().empty()); + return Count(true); +} + +bool TestExtMysql::test_mysql_db_name() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + Variant dbs = f_mysql_list_dbs(); + VERIFY(!f_mysql_db_name(dbs, 0).toString().empty()); + return Count(true); +} + +bool TestExtMysql::test_mysql_tablename() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + Variant tables = f_mysql_list_tables(TEST_DATABASE); + VERIFY(!f_mysql_tablename(tables, 0).toString().empty()); + return Count(true); +} + +bool TestExtMysql::test_mysql_num_fields() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + VS(f_mysql_num_fields(res), 2); + return Count(true); +} + +bool TestExtMysql::test_mysql_num_rows() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + VS(f_mysql_num_rows(res), 2); + return Count(true); +} + +bool TestExtMysql::test_mysql_free_result() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + f_mysql_free_result(res); + return Count(true); +} + +bool TestExtMysql::test_mysql_data_seek() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + f_mysql_data_seek(res, 1); + Variant row = f_mysql_fetch_assoc(res); + VS(f_print_r(row, true), + "Array\n" + "(\n" + " [id] => 2\n" + " [name] => test2\n" + ")\n"); + + return Count(true); +} + +bool TestExtMysql::test_mysql_fetch_row() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + Variant row = f_mysql_fetch_row(res); + VS(f_print_r(row, true), + "Array\n" + "(\n" + " [0] => 1\n" + " [1] => test\n" + ")\n"); + return Count(true); +} + +bool TestExtMysql::test_mysql_fetch_assoc() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + Variant row = f_mysql_fetch_assoc(res); + VS(f_print_r(row, true), + "Array\n" + "(\n" + " [id] => 1\n" + " [name] => test\n" + ")\n"); + return Count(true); +} + +bool TestExtMysql::test_mysql_fetch_array() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + Variant row = f_mysql_fetch_array(res); + VS(f_print_r(row, true), + "Array\n" + "(\n" + " [0] => 1\n" + " [id] => 1\n" + " [1] => test\n" + " [name] => test\n" + ")\n"); + return Count(true); +} + +bool TestExtMysql::test_mysql_fetch_lengths() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + Variant row = f_mysql_fetch_row(res); + Variant lengths = f_mysql_fetch_lengths(res); + VS(f_print_r(lengths, true), + "Array\n" + "(\n" + " [0] => 1\n" + " [1] => 4\n" + ")\n"); + + // A much more intense test on lengths + f_mysql_query("drop table testlen"); + VS(f_mysql_query("create table testlen (id int not null auto_increment, " + "d decimal(10,5), t tinyint, i int, b bigint, f float, " + "db double, y2 year(2), y4 year(4), primary key (id)) " + "engine=innodb"), true); + VS(f_mysql_query("insert into testlen(d, t, i, b, f, db, y2, y4) values" + "(.343, null, 384, -1, 03.44, -03.43892874e101, 00, 0000)"), + true); + res = f_mysql_query("select * from testlen"); + row = f_mysql_fetch_row(res); + lengths = f_mysql_fetch_lengths(res); + VS(f_print_r(lengths, true), + "Array\n" + "(\n" + " [0] => 1\n" + " [1] => 7\n" + " [2] => 0\n" + " [3] => 3\n" + " [4] => 2\n" + " [5] => 4\n" + " [6] => 16\n" + " [7] => 2\n" + " [8] => 4\n" + ")\n"); + + return Count(true); +} + +bool TestExtMysql::test_mysql_fetch_object() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + Variant row = f_mysql_fetch_object(res); + VS(row.toObject().o_get("name"), "test"); + return Count(true); +} + +bool TestExtMysql::test_mysql_result() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + VS(f_mysql_result(res, 1, 1), "test2"); + return Count(true); +} + +bool TestExtMysql::test_mysql_fetch_field() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + VS(f_mysql_fetch_field(res, 1).o_get("name"), "name"); + return Count(true); +} + +bool TestExtMysql::test_mysql_field_seek() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + VERIFY(f_mysql_field_seek(res, 1)); + VS(f_mysql_fetch_field(res).o_get("name"), "name"); + return Count(true); +} + +bool TestExtMysql::test_mysql_field_name() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + VS(f_mysql_field_name(res, 1), "name"); + return Count(true); +} + +bool TestExtMysql::test_mysql_field_table() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + VS(f_mysql_field_table(res, 1), "test"); + return Count(true); +} + +bool TestExtMysql::test_mysql_field_len() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + VS(f_mysql_field_len(res, 1), 255); + return Count(true); +} + +bool TestExtMysql::test_mysql_field_type() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + VS(f_mysql_field_type(res, 1), "string"); + return Count(true); +} + +bool TestExtMysql::test_mysql_field_flags() { + Variant conn = f_mysql_connect(TEST_HOSTNAME, TEST_USERNAME, TEST_PASSWORD); + VERIFY(CreateTestTable()); + VS(f_mysql_query("insert into test (name) values ('test'),('test2')"), true); + + Variant res = f_mysql_query("select * from test"); + VS(f_mysql_field_flags(res, 0), "not_null primary_key auto_increment"); + return Count(true); +} diff --git a/src/test/test_ext_mysql.h b/src/test/test_ext_mysql.h new file mode 100644 index 0000000000000..80d665f9be144 --- /dev/null +++ b/src/test/test_ext_mysql.h @@ -0,0 +1,83 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_MYSQL_H__ +#define __TEST_EXT_MYSQL_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtMysql : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_mysql_connect(); + bool test_mysql_pconnect(); + bool test_mysql_set_charset(); + bool test_mysql_ping(); + bool test_mysql_escape_string(); + bool test_mysql_real_escape_string(); + bool test_mysql_client_encoding(); + bool test_mysql_close(); + bool test_mysql_errno(); + bool test_mysql_error(); + bool test_mysql_get_client_info(); + bool test_mysql_get_host_info(); + bool test_mysql_get_proto_info(); + bool test_mysql_get_server_info(); + bool test_mysql_info(); + bool test_mysql_insert_id(); + bool test_mysql_stat(); + bool test_mysql_thread_id(); + bool test_mysql_create_db(); + bool test_mysql_select_db(); + bool test_mysql_drop_db(); + bool test_mysql_affected_rows(); + bool test_mysql_set_timeout(); + bool test_mysql_query(); + bool test_mysql_unbuffered_query(); + bool test_mysql_db_query(); + bool test_mysql_list_dbs(); + bool test_mysql_list_tables(); + bool test_mysql_list_fields(); + bool test_mysql_list_processes(); + bool test_mysql_db_name(); + bool test_mysql_tablename(); + bool test_mysql_num_fields(); + bool test_mysql_num_rows(); + bool test_mysql_free_result(); + bool test_mysql_data_seek(); + bool test_mysql_fetch_row(); + bool test_mysql_fetch_assoc(); + bool test_mysql_fetch_array(); + bool test_mysql_fetch_lengths(); + bool test_mysql_fetch_object(); + bool test_mysql_result(); + bool test_mysql_fetch_field(); + bool test_mysql_field_seek(); + bool test_mysql_field_name(); + bool test_mysql_field_table(); + bool test_mysql_field_len(); + bool test_mysql_field_type(); + bool test_mysql_field_flags(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_MYSQL_H__ diff --git a/src/test/test_ext_network.cpp b/src/test/test_ext_network.cpp new file mode 100644 index 0000000000000..b857dea3a541f --- /dev/null +++ b/src/test/test_ext_network.cpp @@ -0,0 +1,239 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtNetwork::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_gethostbyaddr); + RUN_TEST(test_gethostbyname); + RUN_TEST(test_gethostbynamel); + RUN_TEST(test_getprotobyname); + RUN_TEST(test_getprotobynumber); + RUN_TEST(test_getservbyname); + RUN_TEST(test_getservbyport); + RUN_TEST(test_inet_ntop); + RUN_TEST(test_inet_pton); + RUN_TEST(test_ip2long); + RUN_TEST(test_long2ip); + RUN_TEST(test_dns_check_record); + RUN_TEST(test_checkdnsrr); + RUN_TEST(test_dns_get_record); + RUN_TEST(test_dns_get_mx); + RUN_TEST(test_getmxrr); + RUN_TEST(test_fsockopen); + RUN_TEST(test_pfsockopen); + RUN_TEST(test_socket_get_status); + RUN_TEST(test_socket_set_blocking); + RUN_TEST(test_socket_set_timeout); + RUN_TEST(test_header); + RUN_TEST(test_headers_list); + RUN_TEST(test_headers_sent); + RUN_TEST(test_setcookie); + RUN_TEST(test_setrawcookie); + RUN_TEST(test_define_syslog_variables); + RUN_TEST(test_openlog); + RUN_TEST(test_closelog); + RUN_TEST(test_syslog); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtNetwork::test_gethostbyaddr() { + VS(f_gethostbyaddr("127.0.0.1"), "localhost.localdomain"); + return Count(true); +} + +bool TestExtNetwork::test_gethostbyname() { + VS(f_gethostbyname("localhost"), "127.0.0.1"); + return Count(true); +} + +bool TestExtNetwork::test_gethostbynamel() { + VS(f_gethostbynamel("localhost"), CREATE_VECTOR1("127.0.0.1")); + return Count(true); +} + +bool TestExtNetwork::test_getprotobyname() { + VS(f_getprotobyname("tcp"), 6); + return Count(true); +} + +bool TestExtNetwork::test_getprotobynumber() { + VS(f_getprotobynumber(6), "tcp"); + return Count(true); +} + +bool TestExtNetwork::test_getservbyname() { + VS(f_getservbyname("http", "tcp"), 80); + return Count(true); +} + +bool TestExtNetwork::test_getservbyport() { + VS(f_getservbyport(80, "tcp"), "http"); + return Count(true); +} + +bool TestExtNetwork::test_inet_ntop() { + String packed = f_chr(127) + f_chr(0) + f_chr(0) + f_chr(1); + VS(f_inet_ntop(packed), "127.0.0.1"); + + packed = f_str_repeat(f_chr(0), 15) + f_chr(1); + VS(f_inet_ntop(packed), "::1"); + return Count(true); +} + +bool TestExtNetwork::test_inet_pton() { + String packed = f_chr(127) + f_chr(0) + f_chr(0) + f_chr(1); + VS(f_inet_pton("127.0.0.1"), packed); + + packed = f_str_repeat(f_chr(0), 15) + f_chr(1); + VS(f_inet_pton("::1"), packed); + return Count(true); +} + +bool TestExtNetwork::test_ip2long() { + VS(f_ip2long("127.0.0.1"), 2130706433); + return Count(true); +} + +bool TestExtNetwork::test_long2ip() { + VS(f_long2ip(2130706433), "127.0.0.1"); + return Count(true); +} + +bool TestExtNetwork::test_dns_check_record() { + VERIFY(f_dns_check_record("facebook.com")); + return Count(true); +} + +bool TestExtNetwork::test_checkdnsrr() { + VERIFY(f_checkdnsrr("facebook.com")); + return Count(true); +} + +bool TestExtNetwork::test_dns_get_record() { + VERIFY(!f_dns_get_record("facebook.com", k_DNS_A).toArray().empty()); + return Count(true); +} + +bool TestExtNetwork::test_dns_get_mx() { + Variant hosts; + VERIFY(f_dns_get_mx("facebook.com", ref(hosts))); + VERIFY(!hosts.toArray().empty()); + return Count(true); +} + +bool TestExtNetwork::test_getmxrr() { + Variant hosts; + VERIFY(f_getmxrr("facebook.com", ref(hosts))); + VERIFY(!hosts.toArray().empty()); + return Count(true); +} + +bool TestExtNetwork::test_fsockopen() { + Variant f = f_fsockopen("facebook.com", 80); + VERIFY(!same(f, false)); + f_fputs(f, "GET / HTTP/1.0\n\n"); + VERIFY(!f_fread(f, 15).toString().empty()); + return Count(true); +} + +bool TestExtNetwork::test_pfsockopen() { + Variant f = f_pfsockopen("facebook.com", 80); + VERIFY(!same(f, false)); + f_fputs(f, "GET / HTTP/1.0\n\n"); + VERIFY(!f_fread(f, 15).toString().empty()); + return Count(true); +} + +bool TestExtNetwork::test_socket_get_status() { + VS(f_socket_get_status(Object()), null); + return Count(true); +} + +bool TestExtNetwork::test_socket_set_blocking() { + Variant f = f_fsockopen("facebook.com", 80); + f_socket_set_blocking(f, 0); + return Count(true); +} + +bool TestExtNetwork::test_socket_set_timeout() { + Variant f = f_fsockopen("facebook.com", 80); + f_socket_set_timeout(f, 0); + return Count(true); +} + +bool TestExtNetwork::test_header() { + f_header("Location: http://www.facebook.com"); + return Count(true); +} + +bool TestExtNetwork::test_headers_list() { + f_header("Location: http://www.facebook.com"); + VS(f_headers_list(), Array()); + return Count(true); +} + +bool TestExtNetwork::test_headers_sent() { + f_header("Location: http://www.facebook.com"); + VERIFY(!f_headers_sent()); + return Count(true); +} + +bool TestExtNetwork::test_setcookie() { + VERIFY(!f_setcookie("name", "value")); + return Count(true); +} + +bool TestExtNetwork::test_setrawcookie() { + VERIFY(!f_setrawcookie("name", "value")); + return Count(true); +} + +bool TestExtNetwork::test_define_syslog_variables() { + f_define_syslog_variables(); + return Count(true); +} + +bool TestExtNetwork::test_openlog() { + f_openlog("TestExtNetwork", k_LOG_ODELAY, k_LOG_USER); + f_syslog(k_LOG_INFO, "testing"); + f_closelog(); + return Count(true); +} + +bool TestExtNetwork::test_closelog() { + f_openlog("TestExtNetwork", k_LOG_ODELAY, k_LOG_USER); + f_syslog(k_LOG_INFO, "testing"); + f_closelog(); + return Count(true); +} + +bool TestExtNetwork::test_syslog() { + f_openlog("TestExtNetwork", k_LOG_ODELAY, k_LOG_USER); + f_syslog(k_LOG_INFO, "testing"); + f_closelog(); + return Count(true); +} diff --git a/src/test/test_ext_network.h b/src/test/test_ext_network.h new file mode 100644 index 0000000000000..bfd9a0b3f8dbe --- /dev/null +++ b/src/test/test_ext_network.h @@ -0,0 +1,64 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_NETWORK_H__ +#define __TEST_EXT_NETWORK_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtNetwork : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_gethostbyaddr(); + bool test_gethostbyname(); + bool test_gethostbynamel(); + bool test_getprotobyname(); + bool test_getprotobynumber(); + bool test_getservbyname(); + bool test_getservbyport(); + bool test_inet_ntop(); + bool test_inet_pton(); + bool test_ip2long(); + bool test_long2ip(); + bool test_dns_check_record(); + bool test_checkdnsrr(); + bool test_dns_get_record(); + bool test_dns_get_mx(); + bool test_getmxrr(); + bool test_fsockopen(); + bool test_pfsockopen(); + bool test_socket_get_status(); + bool test_socket_set_blocking(); + bool test_socket_set_timeout(); + bool test_header(); + bool test_headers_list(); + bool test_headers_sent(); + bool test_setcookie(); + bool test_setrawcookie(); + bool test_define_syslog_variables(); + bool test_openlog(); + bool test_closelog(); + bool test_syslog(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_NETWORK_H__ diff --git a/src/test/test_ext_openssl.cpp b/src/test/test_ext_openssl.cpp new file mode 100644 index 0000000000000..da3e9dc033ffb --- /dev/null +++ b/src/test/test_ext_openssl.cpp @@ -0,0 +1,523 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtOpenssl::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_openssl_csr_export_to_file); + RUN_TEST(test_openssl_csr_export); + RUN_TEST(test_openssl_csr_get_public_key); + RUN_TEST(test_openssl_csr_get_subject); + RUN_TEST(test_openssl_csr_new); + RUN_TEST(test_openssl_csr_sign); + RUN_TEST(test_openssl_error_string); + RUN_TEST(test_openssl_free_key); + RUN_TEST(test_openssl_open); + RUN_TEST(test_openssl_pkcs12_export_to_file); + RUN_TEST(test_openssl_pkcs12_export); + RUN_TEST(test_openssl_pkcs12_read); + RUN_TEST(test_openssl_pkcs7_decrypt); + //RUN_TEST(test_openssl_pkcs7_encrypt); + RUN_TEST(test_openssl_pkcs7_sign); + RUN_TEST(test_openssl_pkcs7_verify); + RUN_TEST(test_openssl_pkey_export_to_file); + RUN_TEST(test_openssl_pkey_export); + RUN_TEST(test_openssl_pkey_free); + RUN_TEST(test_openssl_pkey_get_details); + RUN_TEST(test_openssl_pkey_get_private); + RUN_TEST(test_openssl_get_privatekey); + RUN_TEST(test_openssl_pkey_get_public); + RUN_TEST(test_openssl_get_publickey); + RUN_TEST(test_openssl_pkey_new); + RUN_TEST(test_openssl_private_decrypt); + RUN_TEST(test_openssl_private_encrypt); + RUN_TEST(test_openssl_public_decrypt); + RUN_TEST(test_openssl_public_encrypt); + RUN_TEST(test_openssl_seal); + RUN_TEST(test_openssl_sign); + RUN_TEST(test_openssl_verify); + RUN_TEST(test_openssl_x509_check_private_key); + RUN_TEST(test_openssl_x509_checkpurpose); + RUN_TEST(test_openssl_x509_export_to_file); + RUN_TEST(test_openssl_x509_export); + RUN_TEST(test_openssl_x509_free); + RUN_TEST(test_openssl_x509_parse); + RUN_TEST(test_openssl_x509_read); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtOpenssl::test_openssl_csr_export_to_file() { + Variant csr = f_openssl_csr_new(null, null); + VERIFY(!csr.isNull()); + + const char *tmp = "test/test_csr.tmp"; + f_unlink(tmp); + VS(f_file_get_contents(tmp), false); + f_openssl_csr_export_to_file(csr, tmp); + VERIFY(f_file_get_contents(tmp).toString().size() > 400); + f_unlink(tmp); + + return Count(true); +} + +bool TestExtOpenssl::test_openssl_csr_export() { + // tested in test_openssl_csr_sign() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_csr_get_public_key() { + Variant csr = f_openssl_csr_new(null, null); + VERIFY(!csr.isNull()); + Variant publickey = f_openssl_csr_get_public_key(csr); + VERIFY(!same(publickey, false)); + VERIFY(!publickey.isNull()); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_csr_get_subject() { + Variant csr = f_openssl_csr_new(null, null); + VERIFY(!csr.isNull()); + VS(f_openssl_csr_get_subject(csr)["O"], "My Company Ltd"); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_csr_new() { + // tested in test_openssl_csr_sign() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_csr_sign() { + Array dn(NEW(ArrayElement)("countryName", "XX"), + NEW(ArrayElement)("stateOrProvinceName", "State"), + NEW(ArrayElement)("localityName", "SomewhereCity"), + NEW(ArrayElement)("organizationName", "MySelf"), + NEW(ArrayElement)("organizationalUnitName", "Whatever"), + NEW(ArrayElement)("commonName", "mySelf"), + NEW(ArrayElement)("emailAddress", "user@domain.com"), + NULL); + String privkeypass = "1234"; + int numberofdays = 365; + + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant csr = f_openssl_csr_new(dn, privkey); + VERIFY(!csr.isNull()); + Variant scert = f_openssl_csr_sign(csr, null, privkey, numberofdays); + Variant publickey, privatekey, csrStr; + f_openssl_x509_export(scert, ref(publickey)); + f_openssl_pkey_export(privkey, ref(privatekey), privkeypass); + f_openssl_csr_export(csr, ref(csrStr)); + + //f_var_dump(privatekey); f_var_dump(publickey); f_var_dump(csrStr); + VERIFY(privatekey.toString().size() > 500); + VERIFY(publickey.toString().size() > 800); + VERIFY(csrStr.toString().size() > 500); + + return Count(true); +} + +bool TestExtOpenssl::test_openssl_error_string() { + Variant ret = f_openssl_error_string(); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_free_key() { + Variant csr = f_openssl_csr_new(null, null); + VERIFY(!csr.isNull()); + Variant publickey = f_openssl_csr_get_public_key(csr); + VERIFY(!same(publickey, false)); + VERIFY(!publickey.isNull()); + f_openssl_free_key(publickey); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_open() { + // tested in test_openssl_seal() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkcs12_export_to_file() { + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant csr = f_openssl_csr_new(null, privkey); + VERIFY(!csr.isNull()); + Variant scert = f_openssl_csr_sign(csr, null, privkey, 365); + + const char *tmp = "test/test_pkcs12.tmp"; + f_unlink(tmp); + VS(f_file_get_contents(tmp), false); + f_openssl_pkcs12_export_to_file(scert, tmp, privkey, "1234"); + VERIFY(f_file_get_contents(tmp).toString().size() > 400); + f_unlink(tmp); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkcs12_export() { + // tested in test_openssl_pkcs12_read() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkcs12_read() { + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant csr = f_openssl_csr_new(null, privkey); + VERIFY(!csr.isNull()); + Variant scert = f_openssl_csr_sign(csr, null, privkey, 365); + + Variant pkcs12; + f_openssl_pkcs12_export(scert, ref(pkcs12), privkey, "1234"); + + Variant certs; + VERIFY(f_openssl_pkcs12_read(pkcs12, ref(certs), "1234")); + VERIFY(certs["cert"].toString().size() > 500); + VERIFY(certs["pkey"].toString().size() > 500); + + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkcs7_decrypt() { + // tested in test_openssl_pkcs7_encrypt() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkcs7_encrypt() { + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant csr = f_openssl_csr_new(null, privkey); + VERIFY(!csr.isNull()); + Variant scert = f_openssl_csr_sign(csr, null, privkey, 365); + Variant pubkey = f_openssl_csr_get_public_key(csr); + VERIFY(!pubkey.isNull()); + + String data = "some secret data"; + const char *infile = "test/test_pkcs7.in"; + const char *outfile = "test/test_pkcs7.out"; + f_unlink(infile); + f_unlink(outfile); + f_file_put_contents(infile, data); + + VERIFY(f_openssl_pkcs7_encrypt + (infile, outfile, scert, + CREATE_MAP2("To", "t@facebook.com","From", "hzhao@facebook.com"))); + + f_unlink(infile); + VERIFY(f_openssl_pkcs7_decrypt(outfile, infile, scert, privkey)); + Variant decrypted = f_file_get_contents(infile); + f_var_dump(decrypted); + f_unlink(infile); + f_unlink(outfile); + /* + * PHP didn't work either: + + $privkey = openssl_pkey_new(); + $csr = openssl_csr_new(array(), $privkey); + $scert = openssl_csr_sign($csr, null, $privkey, 365); + + $data = "some secret data"; + $infile = "test_pkcs7.in"; + $outfile = "test_pkcs7.out"; + file_put_contents($infile, $data); + + openssl_pkcs7_encrypt($infile, $outfile, $scert, + array("To" => "t@facebook.com", + "From" => "hzhao@facebook.com")); + + var_dump(openssl_pkcs7_decrypt($outfile, $infile, $scert, $privkey)); + $decrypted = file_get_contents($infile);var_dump($decrypted); + + */ + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkcs7_sign() { + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant csr = f_openssl_csr_new(null, privkey); + VERIFY(!csr.isNull()); + Variant scert = f_openssl_csr_sign(csr, null, privkey, 365); + Variant pubkey = f_openssl_csr_get_public_key(csr); + VERIFY(!pubkey.isNull()); + + String data = "some secret data"; + const char *infile = "test/test_pkcs7.in"; + const char *outfile = "test/test_pkcs7.out"; + f_unlink(infile); + f_unlink(outfile); + f_file_put_contents(infile, data); + + VERIFY(f_openssl_pkcs7_sign + (infile, outfile, scert, privkey, + CREATE_MAP2("To", "t@facebook.com","From", "hzhao@facebook.com"))); + + const char *tmp = "test/test_x509.tmp"; + f_unlink(tmp); + VS(f_file_get_contents(tmp), false); + VERIFY(f_openssl_x509_export_to_file(scert, tmp)); + + VS(f_openssl_pkcs7_verify(outfile, 0, infile, Variant(tmp).toArray()), true); + f_unlink(infile); + f_unlink(outfile); + f_unlink(tmp); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkcs7_verify() { + // tested in test_openssl_pkcs7_sign() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkey_export_to_file() { + const char *tmp = "test/test_pkey.tmp"; + f_unlink(tmp); + VS(f_file_get_contents(tmp), false); + + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + f_openssl_pkey_export_to_file(privkey, tmp, "1234"); + + VERIFY(f_file_get_contents(tmp).toString().size() > 400); + f_unlink(tmp); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkey_export() { + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant out; + f_openssl_pkey_export(privkey, ref(out), "1234"); + VERIFY(out.toString().size() > 500); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkey_free() { + Variant fkey = f_file_get_contents("test/test_public.pem"); + Variant k = f_openssl_pkey_get_public(fkey); + VERIFY(!same(k, false)); + VERIFY(!k.isNull()); + f_openssl_pkey_free(k); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkey_get_details() { + { + Variant fkey = f_file_get_contents("test/test_public.pem"); + Variant k = f_openssl_pkey_get_public(fkey); + VERIFY(!same(k, false)); + VERIFY(!k.isNull()); + VS(f_openssl_pkey_get_details(k)["bits"], 1024); + } + { + Variant fkey = f_file_get_contents("test/test_private.pem"); + Variant k = f_openssl_pkey_get_private(fkey); + VERIFY(!same(k, false)); + VERIFY(!k.isNull()); + VS(f_openssl_pkey_get_details(k)["bits"], 512); + } + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkey_get_private() { + // tested in test_openssl_pkey_get_details() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_get_privatekey() { + // same as openssl_pkey_get_private() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkey_get_public() { + // tested in test_openssl_pkey_get_details() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_get_publickey() { + // same as openssl_pkey_get_public() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_pkey_new() { + // tested in test_openssl_csr_sign() and test_openssl_seal() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_private_decrypt() { + // tested in test_openssl_public_encrypt() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_private_encrypt() { + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant csr = f_openssl_csr_new(null, privkey); + VERIFY(!csr.isNull()); + Variant pubkey = f_openssl_csr_get_public_key(csr); + VERIFY(!pubkey.isNull()); + + String data = "some secret data"; + Variant out; + VERIFY(f_openssl_private_encrypt(data, ref(out), privkey)); + Variant out2; + VERIFY(f_openssl_public_decrypt(out, ref(out2), pubkey)); + VS(out2, data); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_public_decrypt() { + // tested in test_openssl_private_encrypt() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_public_encrypt() { + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant csr = f_openssl_csr_new(null, privkey); + VERIFY(!csr.isNull()); + Variant pubkey = f_openssl_csr_get_public_key(csr); + VERIFY(!pubkey.isNull()); + + String data = "some secret data"; + Variant out; + VERIFY(f_openssl_public_encrypt(data, ref(out), pubkey)); + Variant out2; + VERIFY(f_openssl_private_decrypt(out, ref(out2), privkey)); + VS(out2, data); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_seal() { + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant csr = f_openssl_csr_new(null, privkey); + VERIFY(!csr.isNull()); + Variant pubkey = f_openssl_csr_get_public_key(csr); + VERIFY(!pubkey.isNull()); + + String data = "some secret messages"; + Variant sealed; + Variant ekeys; + VERIFY(f_openssl_seal(data, ref(sealed), ref(ekeys), + CREATE_VECTOR1(pubkey))); + VERIFY(!sealed.toString().empty()); + VS(ekeys.toArray().size(), 1); + VERIFY(!ekeys[0].toString().empty()); + + Variant open_data; + VERIFY(f_openssl_open(sealed, ref(open_data), ekeys[0], privkey)); + VS(open_data, data); + + return Count(true); +} + +bool TestExtOpenssl::test_openssl_sign() { + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant csr = f_openssl_csr_new(null, privkey); + VERIFY(!csr.isNull()); + Variant pubkey = f_openssl_csr_get_public_key(csr); + VERIFY(!pubkey.isNull()); + + String data = "some secret messages"; + Variant signature; + VERIFY(f_openssl_sign(data, ref(signature), privkey)); + VS(f_openssl_verify(data, signature, pubkey), 1); + + return Count(true); +} + +bool TestExtOpenssl::test_openssl_verify() { + // tested in test_openssl_sign() + return Count(true); +} + +bool TestExtOpenssl::test_openssl_x509_check_private_key() { + Variant privkey = f_openssl_pkey_new(); + VERIFY(!privkey.isNull()); + Variant csr = f_openssl_csr_new(null, privkey); + VERIFY(!csr.isNull()); + Variant scert = f_openssl_csr_sign(csr, null, privkey, 365); + VERIFY(f_openssl_x509_check_private_key(scert, privkey)); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_x509_checkpurpose() { + Variant fcert = f_file_get_contents("test/test_x509.crt"); + Variant cert = f_openssl_x509_read(fcert); + VS(f_openssl_x509_checkpurpose(cert, k_X509_PURPOSE_SSL_CLIENT), 0); + VS(f_openssl_x509_checkpurpose(cert, k_X509_PURPOSE_SSL_SERVER), 0); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_x509_export_to_file() { + Variant fcert = f_file_get_contents("test/test_x509.crt"); + Variant cert = f_openssl_x509_read(fcert); + + const char *tmp = "test/test_x509.tmp"; + f_unlink(tmp); + VS(f_file_get_contents(tmp), false); + VERIFY(f_openssl_x509_export_to_file(cert, tmp)); + + Variant fcert2 = f_file_get_contents(tmp); + Variant cert2 = f_openssl_x509_read(fcert2); + Variant info = f_openssl_x509_parse(cert2); + VS(info["subject"]["O"], "RSA Data Security, Inc."); + + f_unlink(tmp); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_x509_export() { + Variant fcert = f_file_get_contents("test/test_x509.crt"); + Variant cert = f_openssl_x509_read(fcert); + Variant out; + VERIFY(f_openssl_x509_export(cert, ref(out))); + Variant cert2 = f_openssl_x509_read(out); + Variant info = f_openssl_x509_parse(cert2); + VS(info["subject"]["O"], "RSA Data Security, Inc."); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_x509_free() { + Variant fcert = f_file_get_contents("test/test_x509.crt"); + Variant cert = f_openssl_x509_read(fcert); + VERIFY(!cert.toObject().isNull()); + f_openssl_x509_free(cert); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_x509_parse() { + Variant fcert = f_file_get_contents("test/test_x509.crt"); + Variant cert = f_openssl_x509_read(fcert); + Variant info = f_openssl_x509_parse(cert); + VS(info["subject"]["O"], "RSA Data Security, Inc."); + return Count(true); +} + +bool TestExtOpenssl::test_openssl_x509_read() { + Variant fcert = f_file_get_contents("test/test_x509.crt"); + Variant cert = f_openssl_x509_read(fcert); + VERIFY(!cert.toObject().isNull()); + return Count(true); +} diff --git a/src/test/test_ext_openssl.h b/src/test/test_ext_openssl.h new file mode 100644 index 0000000000000..6e2cfcce68b88 --- /dev/null +++ b/src/test/test_ext_openssl.h @@ -0,0 +1,73 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_OPENSSL_H__ +#define __TEST_EXT_OPENSSL_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtOpenssl : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_openssl_csr_export_to_file(); + bool test_openssl_csr_export(); + bool test_openssl_csr_get_public_key(); + bool test_openssl_csr_get_subject(); + bool test_openssl_csr_new(); + bool test_openssl_csr_sign(); + bool test_openssl_error_string(); + bool test_openssl_open(); + bool test_openssl_pkcs12_export_to_file(); + bool test_openssl_pkcs12_export(); + bool test_openssl_pkcs12_read(); + bool test_openssl_pkcs7_decrypt(); + bool test_openssl_pkcs7_encrypt(); + bool test_openssl_pkcs7_sign(); + bool test_openssl_pkcs7_verify(); + bool test_openssl_pkey_export_to_file(); + bool test_openssl_pkey_export(); + bool test_openssl_pkey_free(); + bool test_openssl_free_key(); + bool test_openssl_pkey_get_details(); + bool test_openssl_pkey_get_private(); + bool test_openssl_get_privatekey(); + bool test_openssl_pkey_get_public(); + bool test_openssl_get_publickey(); + bool test_openssl_pkey_new(); + bool test_openssl_private_decrypt(); + bool test_openssl_private_encrypt(); + bool test_openssl_public_decrypt(); + bool test_openssl_public_encrypt(); + bool test_openssl_seal(); + bool test_openssl_sign(); + bool test_openssl_verify(); + bool test_openssl_x509_check_private_key(); + bool test_openssl_x509_checkpurpose(); + bool test_openssl_x509_export_to_file(); + bool test_openssl_x509_export(); + bool test_openssl_x509_free(); + bool test_openssl_x509_parse(); + bool test_openssl_x509_read(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_OPENSSL_H__ diff --git a/src/test/test_ext_options.cpp b/src/test/test_ext_options.cpp new file mode 100644 index 0000000000000..d24208442a1f3 --- /dev/null +++ b/src/test/test_ext_options.cpp @@ -0,0 +1,406 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtOptions::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_assert_options); + RUN_TEST(test_assert); + RUN_TEST(test_dl); + RUN_TEST(test_extension_loaded); + RUN_TEST(test_get_loaded_extensions); + RUN_TEST(test_get_extension_funcs); + RUN_TEST(test_get_cfg_var); + RUN_TEST(test_get_current_user); + RUN_TEST(test_get_defined_constants); + RUN_TEST(test_get_include_path); + RUN_TEST(test_restore_include_path); + RUN_TEST(test_set_include_path); + RUN_TEST(test_get_included_files); + RUN_TEST(test_get_magic_quotes_gpc); + RUN_TEST(test_get_magic_quotes_runtime); + RUN_TEST(test_get_required_files); + RUN_TEST(test_getenv); + RUN_TEST(test_getlastmod); + RUN_TEST(test_getmygid); + RUN_TEST(test_getmyinode); + RUN_TEST(test_getmypid); + RUN_TEST(test_getmyuid); + RUN_TEST(test_getopt); + RUN_TEST(test_getrusage); + RUN_TEST(test_clock_getres); + RUN_TEST(test_clock_gettime); + RUN_TEST(test_clock_settime); + RUN_TEST(test_ini_alter); + RUN_TEST(test_ini_get_all); + RUN_TEST(test_ini_get); + RUN_TEST(test_ini_restore); + RUN_TEST(test_ini_set); + RUN_TEST(test_memory_get_peak_usage); + RUN_TEST(test_memory_get_usage); + RUN_TEST(test_php_ini_scanned_files); + RUN_TEST(test_php_logo_guid); + RUN_TEST(test_php_sapi_name); + RUN_TEST(test_php_uname); + RUN_TEST(test_phpcredits); + RUN_TEST(test_phpinfo); + RUN_TEST(test_phpversion); + RUN_TEST(test_putenv); + RUN_TEST(test_set_magic_quotes_runtime); + RUN_TEST(test_set_time_limit); + RUN_TEST(test_sys_get_temp_dir); + RUN_TEST(test_version_compare); + RUN_TEST(test_zend_logo_guid); + RUN_TEST(test_zend_thread_id); + RUN_TEST(test_zend_version); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtOptions::test_assert_options() { + f_assert_options(1); + return Count(true); +} + +bool TestExtOptions::test_assert() { + f_assert(true); + try { + f_assert(false); + } catch (Assertion e) { + return Count(true); + } + return Count(true); +} + +bool TestExtOptions::test_dl() { + VS(f_dl(""), 0); + return Count(true); +} + +bool TestExtOptions::test_extension_loaded() { + f_extension_loaded(""); + return Count(true); +} + +bool TestExtOptions::test_get_loaded_extensions() { + try { + f_get_loaded_extensions(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_get_extension_funcs() { + try { + f_get_extension_funcs(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_get_cfg_var() { + try { + f_get_cfg_var(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_get_current_user() { + f_get_current_user(); + return Count(true); +} + +bool TestExtOptions::test_get_defined_constants() { + try { + f_get_defined_constants(true); + return Count(false); + } catch (NotSupportedException e) { + return Count(true); + } + f_get_defined_constants(); + return Count(true); +} + +bool TestExtOptions::test_get_include_path() { + f_get_include_path(); + return Count(true); +} + +bool TestExtOptions::test_restore_include_path() { + f_restore_include_path(); + return Count(true); +} + +bool TestExtOptions::test_set_include_path() { + f_set_include_path(""); + return Count(true); +} + +bool TestExtOptions::test_get_included_files() { + VS(f_get_included_files(), Array::Create()); + return Count(true); +} + +bool TestExtOptions::test_get_magic_quotes_gpc() { + VS(f_get_magic_quotes_gpc(), 0); + return Count(true); +} + +bool TestExtOptions::test_get_magic_quotes_runtime() { + try { + f_get_magic_quotes_runtime(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_get_required_files() { + try { + f_get_required_files(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_getenv() { + VS(f_getenv("NOTTHERE"), false); + return Count(true); +} + +bool TestExtOptions::test_getlastmod() { + try { + f_getlastmod(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_getmygid() { + VERIFY(f_getmygid()); + return Count(true); +} + +bool TestExtOptions::test_getmyinode() { + try { + f_getmyinode(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_getmypid() { + VERIFY(f_getmypid()); + return Count(true); +} + +bool TestExtOptions::test_getmyuid() { + VERIFY(f_getmyuid()); + return Count(true); +} + +bool TestExtOptions::test_getopt() { + try { + f_getopt(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_getrusage() { + VERIFY(!f_getrusage().empty()); + return Count(true); +} + +bool TestExtOptions::test_clock_getres() { + Variant sec, nsec; + VERIFY(f_clock_getres(k_CLOCK_THREAD_CPUTIME_ID, ref(sec), ref(nsec))); + VS(sec, 0); + VS(nsec, 1); + return Count(true); +} + +bool TestExtOptions::test_clock_gettime() { + Variant sec, nsec; + VERIFY(f_clock_gettime(k_CLOCK_THREAD_CPUTIME_ID, ref(sec), ref(nsec))); + return Count(true); +} + +bool TestExtOptions::test_clock_settime() { + VERIFY(f_clock_settime(k_CLOCK_THREAD_CPUTIME_ID, 100, 100)); + return Count(true); +} + +bool TestExtOptions::test_ini_alter() { + try { + f_ini_alter("", ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_ini_get_all() { + try { + f_ini_get_all(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_ini_get() { + VS(f_ini_get(""), ""); + return Count(true); +} + +bool TestExtOptions::test_ini_restore() { + f_ini_restore(""); + return Count(true); +} + +bool TestExtOptions::test_ini_set() { + f_ini_set("", ""); + return Count(true); +} + +bool TestExtOptions::test_memory_get_peak_usage() { + f_memory_get_peak_usage(); + return Count(true); +} + +bool TestExtOptions::test_memory_get_usage() { + f_memory_get_usage(); + return Count(true); +} + +bool TestExtOptions::test_php_ini_scanned_files() { + try { + f_php_ini_scanned_files(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_php_logo_guid() { + try { + f_php_logo_guid(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_php_sapi_name() { + f_php_sapi_name(); + return Count(true); +} + +bool TestExtOptions::test_php_uname() { + VERIFY(!f_php_uname().empty()); + return Count(true); +} + +bool TestExtOptions::test_phpcredits() { + try { + f_phpcredits(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_phpinfo() { + //f_phpinfo(); + return Count(true); +} + +bool TestExtOptions::test_phpversion() { + VS(f_phpversion(), "5.2.5.hphp"); + return Count(true); +} + +bool TestExtOptions::test_putenv() { + try { + f_putenv(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_set_magic_quotes_runtime() { + f_set_magic_quotes_runtime(false); + return Count(true); +} + +bool TestExtOptions::test_set_time_limit() { + f_set_time_limit(2); + return Count(true); +} + +bool TestExtOptions::test_sys_get_temp_dir() { + VERIFY(f_sys_get_temp_dir() == "/tmp"); + return Count(true); +} + +bool TestExtOptions::test_version_compare() { + VERIFY(!f_version_compare("1.3.0.dev", "1.1.2", "<")); + return Count(true); +} + +bool TestExtOptions::test_zend_logo_guid() { + try { + f_zend_logo_guid(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_zend_thread_id() { + try { + f_zend_thread_id(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOptions::test_zend_version() { + try { + f_zend_version(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} diff --git a/src/test/test_ext_options.h b/src/test/test_ext_options.h new file mode 100644 index 0000000000000..b587be6280612 --- /dev/null +++ b/src/test/test_ext_options.h @@ -0,0 +1,83 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_OPTIONS_H__ +#define __TEST_EXT_OPTIONS_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtOptions : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_assert_options(); + bool test_assert(); + bool test_dl(); + bool test_extension_loaded(); + bool test_get_loaded_extensions(); + bool test_get_extension_funcs(); + bool test_get_cfg_var(); + bool test_get_current_user(); + bool test_get_defined_constants(); + bool test_get_include_path(); + bool test_restore_include_path(); + bool test_set_include_path(); + bool test_get_included_files(); + bool test_get_magic_quotes_gpc(); + bool test_get_magic_quotes_runtime(); + bool test_get_required_files(); + bool test_getenv(); + bool test_getlastmod(); + bool test_getmygid(); + bool test_getmyinode(); + bool test_getmypid(); + bool test_getmyuid(); + bool test_getopt(); + bool test_getrusage(); + bool test_clock_getres(); + bool test_clock_gettime(); + bool test_clock_settime(); + bool test_ini_alter(); + bool test_ini_get_all(); + bool test_ini_get(); + bool test_ini_restore(); + bool test_ini_set(); + bool test_memory_get_peak_usage(); + bool test_memory_get_usage(); + bool test_php_ini_scanned_files(); + bool test_php_logo_guid(); + bool test_php_sapi_name(); + bool test_php_uname(); + bool test_phpcredits(); + bool test_phpinfo(); + bool test_phpversion(); + bool test_putenv(); + bool test_set_magic_quotes_runtime(); + bool test_set_time_limit(); + bool test_sys_get_temp_dir(); + bool test_version_compare(); + bool test_zend_logo_guid(); + bool test_zend_thread_id(); + bool test_zend_version(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_OPTIONS_H__ diff --git a/src/test/test_ext_oracle.cpp b/src/test/test_ext_oracle.cpp new file mode 100644 index 0000000000000..e959f3b42ecc2 --- /dev/null +++ b/src/test/test_ext_oracle.cpp @@ -0,0 +1,256 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtOracle::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_oci_connect); + RUN_TEST(test_oci_new_connect); + RUN_TEST(test_oci_pconnect); + RUN_TEST(test_oci_server_version); + RUN_TEST(test_oci_password_change); + RUN_TEST(test_oci_new_cursor); + RUN_TEST(test_oci_new_descriptor); + RUN_TEST(test_oci_close); + RUN_TEST(test_oci_commit); + RUN_TEST(test_oci_rollback); + RUN_TEST(test_oci_error); + RUN_TEST(test_oci_internal_debug); + RUN_TEST(test_oci_parse); + RUN_TEST(test_oci_statement_type); + RUN_TEST(test_oci_free_statement); + RUN_TEST(test_oci_free_descriptor); + RUN_TEST(test_oci_bind_array_by_name); + RUN_TEST(test_oci_bind_by_name); + RUN_TEST(test_oci_cancel); + RUN_TEST(test_oci_define_by_name); + RUN_TEST(test_oci_execute); + RUN_TEST(test_oci_num_fields); + RUN_TEST(test_oci_num_rows); + RUN_TEST(test_oci_result); + RUN_TEST(test_oci_set_prefetch); + RUN_TEST(test_oci_fetch_all); + RUN_TEST(test_oci_fetch_array); + RUN_TEST(test_oci_fetch_assoc); + RUN_TEST(test_oci_fetch_object); + RUN_TEST(test_oci_fetch_row); + RUN_TEST(test_oci_fetch); + RUN_TEST(test_oci_field_is_null); + RUN_TEST(test_oci_field_name); + RUN_TEST(test_oci_field_precision); + RUN_TEST(test_oci_field_scale); + RUN_TEST(test_oci_field_size); + RUN_TEST(test_oci_field_type_raw); + RUN_TEST(test_oci_field_type); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtOracle::test_oci_connect() { + //VCB(">>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtOracle : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_oci_connect(); + bool test_oci_new_connect(); + bool test_oci_pconnect(); + bool test_oci_server_version(); + bool test_oci_password_change(); + bool test_oci_new_cursor(); + bool test_oci_new_descriptor(); + bool test_oci_close(); + bool test_oci_commit(); + bool test_oci_rollback(); + bool test_oci_error(); + bool test_oci_internal_debug(); + bool test_oci_parse(); + bool test_oci_statement_type(); + bool test_oci_free_statement(); + bool test_oci_free_descriptor(); + bool test_oci_bind_array_by_name(); + bool test_oci_bind_by_name(); + bool test_oci_cancel(); + bool test_oci_define_by_name(); + bool test_oci_execute(); + bool test_oci_num_fields(); + bool test_oci_num_rows(); + bool test_oci_result(); + bool test_oci_set_prefetch(); + bool test_oci_fetch_all(); + bool test_oci_fetch_array(); + bool test_oci_fetch_assoc(); + bool test_oci_fetch_object(); + bool test_oci_fetch_row(); + bool test_oci_fetch(); + bool test_oci_field_is_null(); + bool test_oci_field_name(); + bool test_oci_field_precision(); + bool test_oci_field_scale(); + bool test_oci_field_size(); + bool test_oci_field_type_raw(); + bool test_oci_field_type(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_ORACLE_H__ diff --git a/src/test/test_ext_output.cpp b/src/test/test_ext_output.cpp new file mode 100644 index 0000000000000..2e4cf8377d0cc --- /dev/null +++ b/src/test/test_ext_output.cpp @@ -0,0 +1,221 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtOutput::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_ob_start); + RUN_TEST(test_ob_clean); + RUN_TEST(test_ob_flush); + RUN_TEST(test_ob_end_clean); + RUN_TEST(test_ob_end_flush); + RUN_TEST(test_flush); + RUN_TEST(test_ob_get_clean); + RUN_TEST(test_ob_get_contents); + RUN_TEST(test_ob_get_flush); + RUN_TEST(test_ob_get_length); + RUN_TEST(test_ob_get_level); + RUN_TEST(test_ob_get_status); + RUN_TEST(test_ob_gzhandler); + RUN_TEST(test_ob_implicit_flush); + RUN_TEST(test_ob_list_handlers); + RUN_TEST(test_output_add_rewrite_var); + RUN_TEST(test_output_reset_rewrite_vars); + RUN_TEST(test_hphp_log); + RUN_TEST(test_hphp_stats); + RUN_TEST(test_hphp_get_stats); + RUN_TEST(test_hphp_output_global_state); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtOutput::test_ob_start() { + f_ob_start(); + f_ob_start("strtolower"); + g_context->out() << "TEst"; + f_ob_end_flush(); + VS(f_ob_get_clean(), "test"); + return Count(true); +} + +bool TestExtOutput::test_ob_clean() { + f_ob_start(); + g_context->out() << "test"; + f_ob_clean(); + VS(f_ob_get_clean(), ""); + return Count(true); +} + +bool TestExtOutput::test_ob_flush() { + f_ob_start(); + f_ob_start("strtolower"); + g_context->out() << "TEst"; + f_ob_flush(); + VS(f_ob_get_clean(), ""); + VS(f_ob_get_clean(), "test"); + return Count(true); +} + +bool TestExtOutput::test_ob_end_clean() { + f_ob_start(); + f_ob_start("strtolower"); + g_context->out() << "TEst"; + f_ob_end_clean(); + VS(f_ob_get_clean(), ""); + return Count(true); +} + +bool TestExtOutput::test_ob_end_flush() { + f_ob_start(); + f_ob_start("strtolower"); + g_context->out() << "TEst"; + f_ob_end_flush(); + VS(f_ob_get_clean(), "test"); + return Count(true); +} + +bool TestExtOutput::test_flush() { + f_ob_start(); + f_ob_start("strtolower"); + g_context->out() << ""; // we can't really verify what's written to stdout + f_flush(); + f_ob_end_clean(); + f_ob_end_clean(); + return Count(true); +} + +bool TestExtOutput::test_ob_get_clean() { + f_ob_start(); + f_ob_start(); + g_context->out() << "test"; + VS(f_ob_get_clean(), "test"); + VS(f_ob_get_clean(), ""); + VS(f_ob_get_clean(), ""); + return Count(true); +} + +bool TestExtOutput::test_ob_get_contents() { + f_ob_start(); + g_context->out() << "test"; + VS(f_ob_get_contents(), "test"); + VS(f_ob_get_contents(), "test"); // verifying content stays + f_ob_end_clean(); + return Count(true); +} + +bool TestExtOutput::test_ob_get_flush() { + f_ob_start(); + f_ob_start(); + g_context->out() << "test"; + VS(f_ob_get_flush(), "test"); + VS(f_ob_get_flush(), ""); + f_ob_end_clean(); + VS(f_ob_get_flush(), "test"); + f_ob_end_clean(); + return Count(true); +} + +bool TestExtOutput::test_ob_get_length() { + f_ob_start(); + g_context->out() << "test"; + VS(f_ob_get_length(), 4); + f_ob_end_clean(); + return Count(true); +} + +bool TestExtOutput::test_ob_get_level() { + VS(f_ob_get_level(), 0); + f_ob_start(); + VS(f_ob_get_level(), 1); + f_ob_end_clean(); + VS(f_ob_get_level(), 0); + return Count(true); +} + +bool TestExtOutput::test_ob_get_status() { + try { + f_ob_get_status(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOutput::test_ob_gzhandler() { + try { + f_ob_gzhandler("value", 0); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOutput::test_ob_implicit_flush() { + f_ob_implicit_flush(true); // no-op currently + f_ob_implicit_flush(false); // no-op currently + return Count(true); +} + +bool TestExtOutput::test_ob_list_handlers() { + f_ob_start(); + f_ob_start("test"); + Array handlers = f_ob_list_handlers(); + f_ob_end_clean(); + f_ob_end_clean(); + VS(handlers, CREATE_VECTOR2(null, "test")); + return Count(true); +} + +bool TestExtOutput::test_output_add_rewrite_var() { + try { + f_output_add_rewrite_var("name", "value"); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOutput::test_output_reset_rewrite_vars() { + try { + f_output_reset_rewrite_vars(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtOutput::test_hphp_log() { + return Count(true); +} + +bool TestExtOutput::test_hphp_stats() { + return Count(true); +} + +bool TestExtOutput::test_hphp_get_stats() { + return Count(true); +} + +bool TestExtOutput::test_hphp_output_global_state() { + return Count(true); +} diff --git a/src/test/test_ext_output.h b/src/test/test_ext_output.h new file mode 100644 index 0000000000000..1d3cf6ba0f665 --- /dev/null +++ b/src/test/test_ext_output.h @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_OUTPUT_H__ +#define __TEST_EXT_OUTPUT_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtOutput : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_ob_start(); + bool test_ob_clean(); + bool test_ob_flush(); + bool test_ob_end_clean(); + bool test_ob_end_flush(); + bool test_flush(); + bool test_ob_get_clean(); + bool test_ob_get_contents(); + bool test_ob_get_flush(); + bool test_ob_get_length(); + bool test_ob_get_level(); + bool test_ob_get_status(); + bool test_ob_gzhandler(); + bool test_ob_implicit_flush(); + bool test_ob_list_handlers(); + bool test_output_add_rewrite_var(); + bool test_output_reset_rewrite_vars(); + bool test_hphp_log(); + bool test_hphp_stats(); + bool test_hphp_get_stats(); + bool test_hphp_output_global_state(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_OUTPUT_H__ diff --git a/src/test/test_ext_php_mcc.cpp b/src/test/test_ext_php_mcc.cpp new file mode 100644 index 0000000000000..1465f618024e9 --- /dev/null +++ b/src/test/test_ext_php_mcc.cpp @@ -0,0 +1,209 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace std; +using namespace boost; + +#define MEMCACHED "memcached-1.2.3e" +/////////////////////////////////////////////////////////////////////////////// +// helpers + +bool TestExtPhp_mcc::IsPortInUse(int port) { + char sport[256]; + snprintf(sport, sizeof(sport), ":%d", port); + string out, err; + const char *argv[] = {"", "-t", "-i", sport, NULL}; + Process::Exec("lsof", argv, NULL, out, &err); + return !out.empty(); +} + +int TestExtPhp_mcc::FindFreePort() { + for (int i = 0; i < 1000; i++) { + int port = (abs(rand()) % (65536 - 1025)) + 1025; + if (!IsPortInUse(port)) { + return port; + } + } + return 0; +} + +void TestExtPhp_mcc::run_server() { + m_server_tcp_port = FindFreePort(); + m_server_udp_port = FindFreePort(); + if (m_server_tcp_port == 0 || m_server_udp_port == 0) { + printf("ERROR: unable to find free ports for memcached server\n"); + return; + } + string tcp = boost::lexical_cast(m_server_tcp_port); + string udp = boost::lexical_cast(m_server_udp_port); + + string out, err; + const char *argv[] = {"", "-p", tcp.c_str(), "-U", udp.c_str(), + "-m", "64", NULL}; + string cmd = string("../external/memcached/") + MEMCACHED; + Process::Exec(cmd.c_str(), argv, NULL, out, &err); + if (!err.empty()) { + printf("ERROR: unable to start memcached server: %s\n", err.c_str()); + } +} + +bool TestExtPhp_mcc::get_client(bool consistent_hashing, p_phpmcc &mcc) { + mcc = p_phpmcc(new c_phpmcc()); + mcc->create("test", 0); + + const char *sp = "wildcard"; + const char *s = "wildcard-0"; + + VERIFY(mcc->t_add_serverpool(sp, consistent_hashing)); + VS(mcc->t_serverpool_get_consistent_hashing_enabled(sp), consistent_hashing); + mcc->t___set("default_serverpool", sp); + VERIFY(mcc->t_add_server(s)); + VERIFY(mcc->t_serverpool_add_server(sp, s)); + VERIFY(mcc->t_add_accesspoint(s, "127.0.0.1", m_server_tcp_port)); + VERIFY(mcc->t_add_accesspoint(s, "127.0.0.1", m_server_udp_port, + k_MCC_IPPROTO_UDP)); + + Variant aps = mcc->t_get_accesspoints(s); + VS(f_in_array(String(string("tcp:127.0.0.1:") + + lexical_cast(m_server_tcp_port)), aps), true); + VS(f_in_array(String(string("udp:127.0.0.1:") + + lexical_cast(m_server_udp_port)), aps), true); + + VS(mcc->t_serverpool_get_servers(sp), CREATE_MAP1(s, aps)); + VS(mcc->t___get("serverpools"), CREATE_MAP1(sp, CREATE_MAP1(s, aps))); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +TestExtPhp_mcc::TestExtPhp_mcc() : m_server_tcp_port(0), m_server_udp_port(0) { +} + +bool TestExtPhp_mcc::RunTests(const std::string &which) { + bool ret = true; + return ret; // disabling it for now, as it made several others fail + + AsyncFunc func(this, &TestExtPhp_mcc::run_server); + func.start(); + while (m_server_tcp_port == 0 || m_server_udp_port == 0 || + !IsPortInUse(m_server_tcp_port) || + !IsPortInUse(m_server_udp_port)) { + usleep(20000); + } + printf("memcached started at (tcp: %d, udp: %d)\n", + m_server_tcp_port, m_server_udp_port); + + RUN_TEST(test_basic); + + Util::ssystem((string("killall ") + MEMCACHED).c_str()); + while (IsPortInUse(m_server_tcp_port) && IsPortInUse(m_server_udp_port)) { + usleep(20000); + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtPhp_mcc::test_basic() { + p_phpmcc mcc; + if (!get_client(false, mcc)) return false; + + const char *k = "key"; + const char *v = "value"; + Array kv = CREATE_MAP1(k, v); + Array kvs = CREATE_MAP3("k0", "v0", "k1", "v1", "k2", "v2"); + + VS(mcc->t_get(k), null); + VS(mcc->t_delete(k), false); + mcc->t_set(k, v); + VS(mcc->t_get(k), v); + VS(mcc->t_delete(k), true); + VS(mcc->t_get(k), null); + VS(mcc->t_delete(k), false); + + mcc->t_set(k, v); + VS(mcc->t_get(kv), kv); + + v = "new value"; + VERIFY(!mcc->t_add(k, v)); + VERIFY(mcc->t_replace(k, v)); + kv = CREATE_MAP1(k, v); + VS(mcc->t_get(kv), kv); + + Variant result = mcc->t_delete(CREATE_VECTOR1(k)); + VS(result[k], true); + VS(mcc->t_get(Array::Create()), Array::Create()); + result = mcc->t_delete(CREATE_VECTOR1(k)); + VS(result[k], false); + + mcc->t_set("k0", "v0"); + mcc->t_set("k1", "v1"); + mcc->t_set("k2", "v2"); + VS(mcc->t_get(kvs), kvs); + VS(mcc->t_get(f_array_keys(kvs)), kvs); + VS(mcc->t_get_multi(f_array_keys(kvs)), kvs); + + VS(mcc->t_delete(f_array_keys(kvs)), + CREATE_MAP3("k0", true, "k1", true, "k2", true)); + VS(mcc->t_delete(f_array_keys(kvs)), + CREATE_MAP3("k0", false, "k1", false, "k2", false)); + VS(mcc->t_get(kvs), Array::Create()); + + v = "0"; + kv = CREATE_MAP1(k, v); + mcc->t_set(k, v); + VS(mcc->t_get(kv), kv); + VS(mcc->t_incr(k, 1), 1); + VS(mcc->t_incr(k, 1000), 1001); + VS(mcc->t_decr(k, 1), 1000); + VS(mcc->t_decr(k, 1001), 0); + + v = "notanumber"; + kv = CREATE_MAP1(k, v); + mcc->t_set(k, v); + VS(mcc->t_get(kv), kv); + VS(mcc->t_incr(k, 1), 1); + + v = "notanumber"; + kv = CREATE_MAP1(k, v); + mcc->t_set(k, v); + VS(mcc->t_get(kv), kv); + VS(mcc->t_decr(k, 1), 0); + + mcc->t_delete(k); + VS(mcc->t_incr("test.non-existent-key", 1), false); + VS(mcc->t_decr("test.non-existent-key", 1), false); + + k = "serialized-key"; + Variant v1 = CREATE_VECTOR4(1, 2, 3, 4); + kv = CREATE_MAP1(k, v1); + mcc->t_set(k, v1); + VS(mcc->t_get(kv), kv); + + Object v2 = Object(new c_stdclass()); + v2->o_set("name", -1, "value"); + kv = CREATE_MAP1(k, v2); + mcc->t_set(k, v2); + Variant r = mcc->t_get(kv); + VS(r[k].toObject()->o_get("name", -1), "value"); + + return Count(true); +} diff --git a/src/test/test_ext_php_mcc.h b/src/test/test_ext_php_mcc.h new file mode 100644 index 0000000000000..bf02b220c9beb --- /dev/null +++ b/src/test/test_ext_php_mcc.h @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_PHP_MCC_H__ +#define __TEST_EXT_PHP_MCC_H__ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtPhp_mcc : public TestCppExt { +public: + TestExtPhp_mcc(); + + virtual bool RunTests(const std::string &which); + + bool test_basic(); + + void run_server(); + bool get_client(bool consistent_hashing, p_phpmcc &mcc); + +private: + int m_server_tcp_port; + int m_server_udp_port; + + static bool IsPortInUse(int port); + static int FindFreePort(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_PHP_MCC_H__ diff --git a/src/test/test_ext_posix.cpp b/src/test/test_ext_posix.cpp new file mode 100644 index 0000000000000..c6bb5e0c5cdb7 --- /dev/null +++ b/src/test/test_ext_posix.cpp @@ -0,0 +1,259 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtPosix::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_posix_access); + RUN_TEST(test_posix_ctermid); + RUN_TEST(test_posix_get_last_error); + RUN_TEST(test_posix_getcwd); + RUN_TEST(test_posix_getegid); + RUN_TEST(test_posix_geteuid); + RUN_TEST(test_posix_getgid); + RUN_TEST(test_posix_getgrgid); + RUN_TEST(test_posix_getgrnam); + RUN_TEST(test_posix_getgroups); + RUN_TEST(test_posix_getlogin); + RUN_TEST(test_posix_getpgid); + RUN_TEST(test_posix_getpgrp); + RUN_TEST(test_posix_getpid); + RUN_TEST(test_posix_getppid); + RUN_TEST(test_posix_getpwnam); + RUN_TEST(test_posix_getpwuid); + RUN_TEST(test_posix_getrlimit); + RUN_TEST(test_posix_getsid); + RUN_TEST(test_posix_getuid); + RUN_TEST(test_posix_initgroups); + RUN_TEST(test_posix_isatty); + RUN_TEST(test_posix_kill); + RUN_TEST(test_posix_mkfifo); + RUN_TEST(test_posix_mknod); + RUN_TEST(test_posix_setegid); + RUN_TEST(test_posix_seteuid); + RUN_TEST(test_posix_setgid); + RUN_TEST(test_posix_setpgid); + RUN_TEST(test_posix_setsid); + RUN_TEST(test_posix_setuid); + RUN_TEST(test_posix_strerror); + RUN_TEST(test_posix_times); + RUN_TEST(test_posix_ttyname); + RUN_TEST(test_posix_uname); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtPosix::test_posix_access() { + VERIFY(f_posix_access("test/test_ext_posix.cpp")); + return Count(true); +} + +bool TestExtPosix::test_posix_ctermid() { + VERIFY(!f_posix_ctermid().empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_get_last_error() { + errno = 0; + VERIFY(!f_posix_get_last_error()); + return Count(true); +} + +bool TestExtPosix::test_posix_getcwd() { + VERIFY(!f_posix_getcwd().empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_getegid() { + VERIFY(f_posix_getegid()); + return Count(true); +} + +bool TestExtPosix::test_posix_geteuid() { + VERIFY(f_posix_geteuid()); + return Count(true); +} + +bool TestExtPosix::test_posix_getgid() { + VERIFY(f_posix_getgid()); + return Count(true); +} + +bool TestExtPosix::test_posix_getgrgid() { + Variant ret = f_posix_getgrgid(f_posix_getgid()); + VERIFY(!same(ret, false)); + VERIFY(!ret.toArray().empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_getgrnam() { + Variant ret = f_posix_getgrnam("root"); + VERIFY(!same(ret, false)); + VERIFY(!ret.toArray().empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_getgroups() { + Variant ret = f_posix_getgroups(); + VERIFY(!same(ret, false)); + VERIFY(!ret.toArray().empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_getlogin() { + VERIFY(!f_posix_getlogin().toString().empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_getpgid() { + VERIFY(f_posix_getpgid(0)); + return Count(true); +} + +bool TestExtPosix::test_posix_getpgrp() { + VERIFY(f_posix_getpgrp()); + return Count(true); +} + +bool TestExtPosix::test_posix_getpid() { + VERIFY(f_posix_getpid()); + return Count(true); +} + +bool TestExtPosix::test_posix_getppid() { + VERIFY(f_posix_getppid()); + return Count(true); +} + +bool TestExtPosix::test_posix_getpwnam() { + Variant ret = f_posix_getpwnam("root"); + VERIFY(!same(ret, false)); + VERIFY(!ret.toArray().empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_getpwuid() { + Variant ret = f_posix_getpwuid(0); + VERIFY(!same(ret, false)); + VERIFY(!ret.toArray().empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_getrlimit() { + Variant ret = f_posix_getrlimit(); + VERIFY(!same(ret, false)); + VERIFY(!ret.toArray().empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_getsid() { + VERIFY(f_posix_getsid(getpid())); + return Count(true); +} + +bool TestExtPosix::test_posix_getuid() { + VERIFY(f_posix_getuid()); + return Count(true); +} + +bool TestExtPosix::test_posix_initgroups() { + VERIFY(!f_posix_initgroups("root", 100)); + return Count(true); +} + +bool TestExtPosix::test_posix_isatty() { + f_posix_isatty(1); + return Count(true); +} + +bool TestExtPosix::test_posix_kill() { + //VERIFY(f_posix_kill(-1, 9)); + return Count(true); +} + +bool TestExtPosix::test_posix_mkfifo() { + remove("/tmp/test_posix_mkfifo"); + VERIFY(f_posix_mkfifo("/tmp/test_posix_mkfifo", 0)); + return Count(true); +} + +bool TestExtPosix::test_posix_mknod() { + remove("/tmp/test_posix_mknod"); + VERIFY(f_posix_mknod("/tmp/test_posix_mknod", 0)); + return Count(true); +} + +bool TestExtPosix::test_posix_setegid() { + VERIFY(f_posix_setegid(0)); + return Count(true); +} + +bool TestExtPosix::test_posix_seteuid() { + VERIFY(f_posix_seteuid(0)); + return Count(true); +} + +bool TestExtPosix::test_posix_setgid() { + VERIFY(f_posix_setgid(0)); + return Count(true); +} + +bool TestExtPosix::test_posix_setpgid() { + VERIFY(f_posix_setpgid(0, 0)); + return Count(true); +} + +bool TestExtPosix::test_posix_setsid() { + VERIFY(f_posix_setsid()); + return Count(true); +} + +bool TestExtPosix::test_posix_setuid() { + VERIFY(f_posix_setuid(0)); + return Count(true); +} + +bool TestExtPosix::test_posix_strerror() { + VERIFY(!f_posix_strerror(EPERM).empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_times() { + Variant ret = f_posix_times(); + VERIFY(!same(ret, false)); + VERIFY(!ret.toArray().empty()); + return Count(true); +} + +bool TestExtPosix::test_posix_ttyname() { + f_posix_ttyname(1); + return Count(true); +} + +bool TestExtPosix::test_posix_uname() { + Variant ret = f_posix_uname(); + VERIFY(!same(ret, false)); + VERIFY(!ret.toArray().empty()); + return Count(true); +} diff --git a/src/test/test_ext_posix.h b/src/test/test_ext_posix.h new file mode 100644 index 0000000000000..aa844c40b3c9e --- /dev/null +++ b/src/test/test_ext_posix.h @@ -0,0 +1,69 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_POSIX_H__ +#define __TEST_EXT_POSIX_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtPosix : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_posix_access(); + bool test_posix_ctermid(); + bool test_posix_get_last_error(); + bool test_posix_getcwd(); + bool test_posix_getegid(); + bool test_posix_geteuid(); + bool test_posix_getgid(); + bool test_posix_getgrgid(); + bool test_posix_getgrnam(); + bool test_posix_getgroups(); + bool test_posix_getlogin(); + bool test_posix_getpgid(); + bool test_posix_getpgrp(); + bool test_posix_getpid(); + bool test_posix_getppid(); + bool test_posix_getpwnam(); + bool test_posix_getpwuid(); + bool test_posix_getrlimit(); + bool test_posix_getsid(); + bool test_posix_getuid(); + bool test_posix_initgroups(); + bool test_posix_isatty(); + bool test_posix_kill(); + bool test_posix_mkfifo(); + bool test_posix_mknod(); + bool test_posix_setegid(); + bool test_posix_seteuid(); + bool test_posix_setgid(); + bool test_posix_setpgid(); + bool test_posix_setsid(); + bool test_posix_setuid(); + bool test_posix_strerror(); + bool test_posix_times(); + bool test_posix_ttyname(); + bool test_posix_uname(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_POSIX_H__ diff --git a/src/test/test_ext_preg.cpp b/src/test/test_ext_preg.cpp new file mode 100644 index 0000000000000..65483a8cae608 --- /dev/null +++ b/src/test/test_ext_preg.cpp @@ -0,0 +1,435 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtPreg::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_preg_grep); + RUN_TEST(test_preg_match); + RUN_TEST(test_preg_match_all); + RUN_TEST(test_preg_replace); + RUN_TEST(test_preg_replace_callback); + RUN_TEST(test_preg_split); + RUN_TEST(test_preg_quote); + RUN_TEST(test_preg_last_error); + RUN_TEST(test_ereg_replace); + RUN_TEST(test_eregi_replace); + RUN_TEST(test_ereg); + RUN_TEST(test_eregi); + RUN_TEST(test_split); + RUN_TEST(test_spliti); + RUN_TEST(test_sql_regcase); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtPreg::test_preg_grep() { + Array array = CREATE_VECTOR4("foo 123.1", "fg 24bar", "123.1", "24"); + Array fl_array = f_preg_grep("/^(\\d+)?\\.\\d+$/", array); + VS(fl_array.size(), 1); + VS(fl_array[2], "123.1"); + + VS(f_preg_grep("/a/", CREATE_VECTOR2("c", "b")), Array::Create()); + return Count(true); +} + +bool TestExtPreg::test_preg_match() { + // The "i" after the pattern delimiter indicates a case-insensitive search + VERIFY(f_preg_match("/php/i", "PHP is a scripting language.")); + + // The \b in the pattern indicates a word boundary, so only the distinct + // word "web" is matched, and not a word partial like "webbing" or "cobweb" + VERIFY(f_preg_match("/\\bweb\\b/i", "is the web scripting")); + + // get host name from URL + Variant matches; + f_preg_match("@^(?:http://)?([^/]+)@i", + "http://www.php.net/index.html", ref(matches)); + String host = matches[1]; + VS(host, "www.php.net"); + + // get last two segments of host name + f_preg_match("/[^.]+\\.[^.]+$/", host, ref(matches)); + VS(matches[0], "php.net"); + + String str = "foobar: 2008"; + f_preg_match("/(?\\w+): (?\\d+)/", str, ref(matches)); + VS(f_print_r(matches, true), + "Array\n" + "(\n" + " [0] => foobar: 2008\n" + " [name] => foobar\n" + " [1] => foobar\n" + " [digit] => 2008\n" + " [2] => 2008\n" + ")\n"); + + return Count(true); +} + +bool TestExtPreg::test_preg_match_all() { + Variant matches; + + f_preg_match_all("/\\(? (\\d{3})? \\)? (?(1) [\\-\\s] ) \\d{3}-\\d{4}/x", + "Call 555-1212 or 1-800-555-1212", ref(matches)); + VS(f_print_r(matches, true), + "Array\n" + "(\n" + " [0] => Array\n" + " (\n" + " [0] => 555-1212\n" + " [1] => 800-555-1212\n" + " )\n" + "\n" + " [1] => Array\n" + " (\n" + " [0] => \n" + " [1] => 800\n" + " )\n" + "\n" + ")\n"); + + // The \\2 is an example of backreferencing. This tells pcre that + // it must match the second set of parentheses in the regular expression + // itself, which would be the ([\w]+) in this case. The extra backslash is + // required because the string is in double quotes. + String html = "bold textclick me"; + f_preg_match_all("/(<([\\w]+)[^>]*>)(.*)(<\\/\\2>)/", html, ref(matches), + k_PREG_SET_ORDER); + VS(f_print_r(matches, true), + "Array\n" + "(\n" + " [0] => Array\n" + " (\n" + " [0] => bold text\n" + " [1] => \n" + " [2] => b\n" + " [3] => bold text\n" + " [4] => \n" + " )\n" + "\n" + " [1] => Array\n" + " (\n" + " [0] => click me\n" + " [1] => \n" + " [2] => a\n" + " [3] => click me\n" + " [4] => \n" + " )\n" + "\n" + ")\n"); + + String str = "a: 1\nb: 2\nc: 3\n"; + f_preg_match_all("/(?\\w+): (?\\d+)/", str, ref(matches)); + VS(f_print_r(matches, true), + "Array\n" + "(\n" + " [0] => Array\n" + " (\n" + " [0] => a: 1\n" + " [1] => b: 2\n" + " [2] => c: 3\n" + " )\n" + "\n" + " [name] => Array\n" + " (\n" + " [0] => a\n" + " [1] => b\n" + " [2] => c\n" + " )\n" + "\n" + " [1] => Array\n" + " (\n" + " [0] => a\n" + " [1] => b\n" + " [2] => c\n" + " )\n" + "\n" + " [digit] => Array\n" + " (\n" + " [0] => 1\n" + " [1] => 2\n" + " [2] => 3\n" + " )\n" + "\n" + " [2] => Array\n" + " (\n" + " [0] => 1\n" + " [1] => 2\n" + " [2] => 3\n" + " )\n" + "\n" + ")\n"); + + return Count(true); +} + +bool TestExtPreg::test_preg_replace() { + { + String str = "April 15, 2003"; + String pattern = "/(\\w+) (\\d+), (\\d+)/i"; + String replacement = "${1}1,$3"; + VS(f_preg_replace(pattern, replacement, str), "April1,2003"); + } + { + String str = "The quick brown fox jumped over the lazy dog."; + Variant patterns, replacements; + patterns.set(0, "/quick/"); + patterns.set(1, "/brown/"); + patterns.set(2, "/fox/"); + replacements.set(2, "bear"); + replacements.set(1, "black"); + replacements.set(0, "slow"); + VS(f_preg_replace(patterns, replacements, str), + "The bear black slow jumped over the lazy dog."); + + f_ksort(ref(patterns)); + f_ksort(ref(replacements)); + VS(f_preg_replace(patterns, replacements, str), + "The slow black bear jumped over the lazy dog."); + } + { + Array patterns = CREATE_VECTOR2("/(19|20)(\\d{2})-(\\d{1,2})-(\\d{1,2})/", + "/^\\s*{(\\w+)}\\s*=/"); + Array replace = CREATE_VECTOR2("\\3/\\4/\\1\\2", "$\\1 ="); + VS(f_preg_replace(patterns, replace, "{startDate} = 1999-5-27"), + "$startDate = 5/27/1999"); + } + { + String str = "foo o"; + str = f_preg_replace("/\\s\\s+/", " ", str); + VS(str, "foo o"); + } + { + Variant count = 0; + f_preg_replace(CREATE_VECTOR2("/\\d/", "/\\s/"), "*", "xp 4 to", -1, + ref(count)); + VS(count, 3); + } + { + String html_body = ""; + String html_body2 = f_preg_replace("/(<\\/?\\w+[^>]*>)/e", + "strtoupper(\"$1\")", + html_body); + VS(html_body2, ""); + + String css_text = "#AAAA;"; + String css_text2 = f_preg_replace("/#([A-Fa-f0-9]{3,6});/e", + "strtolower(\"#\\1;\");", css_text); + VS(css_text2, "#aaaa;"); + + String rgb_text = "rgb(13, 14, 15)"; + String rgb_text2 = + f_preg_replace("/rgb\\(([0-9]{1,3}), ([0-9]{1,3}), ([0-9]{1,3})\\)/e", + "sprintf(\"%02x%02x%02x\", \"\\1\", \"\\2\", \"\\3\")", + rgb_text); + VS(rgb_text2, "0d0e0f"); + + String res = f_preg_replace("/(a*)(b*)/e", + "test_preg_rep(\"\\1\",\"smu\\\"rf\",\"\\2\")", + "aaabbbblahblahaabbbababab"); + VS(res, "BBBBaaalahBlahBBBaaBaBaBa"); + + try { + f_preg_replace("/(<\\/?)(\\w+)([^>]*>)/e", + "'\\\\1'.strtoupper('\\\\2').'\\\\3'", + html_body); + } catch (NotSupportedException e) { + return Count(true); + } + } + return Count(false); +} + +bool TestExtPreg::test_preg_replace_callback() { + { + // this text was used in 2002 + // we want to get this up to date for 2003 + String text = "April fools day is 04/01/2002\n" + "Last christmas was 12/24/2001\n"; + text = f_preg_replace_callback("|(\\d{2}/\\d{2}/)(\\d{4})|", "next_year", + text); + VS(text, "April fools day is 04/01/2003\nLast christmas was 12/24/2002\n"); + } + return Count(true); +} + +bool TestExtPreg::test_preg_split() { + // split the phrase by any number of commas or space characters, + // which include " ", \r, \t, \n and \f + { + Array keywords = f_preg_split("/[\\s,]+/", + "hypertext language, programming"); + VS(keywords.size(), 3); + VS(keywords[0], "hypertext"); + VS(keywords[1], "language"); + VS(keywords[2], "programming"); + } + { + String str = "string"; + Array chars = f_preg_split("//", str, -1, k_PREG_SPLIT_NO_EMPTY); + VS(chars.size(), 6); + VS(chars[0], "s"); + VS(chars[1], "t"); + VS(chars[2], "r"); + VS(chars[3], "i"); + VS(chars[4], "n"); + VS(chars[5], "g"); + } + { + String str = "hypertext language programming"; + Array chars = f_preg_split("/ /", str, -1, k_PREG_SPLIT_OFFSET_CAPTURE); + VS(f_print_r(chars, true), + "Array\n" + "(\n" + " [0] => Array\n" + " (\n" + " [0] => hypertext\n" + " [1] => 0\n" + " )\n" + "\n" + " [1] => Array\n" + " (\n" + " [0] => language\n" + " [1] => 10\n" + " )\n" + "\n" + " [2] => Array\n" + " (\n" + " [0] => programming\n" + " [1] => 19\n" + " )\n" + "\n" + ")\n"); + } + return Count(true); +} + +bool TestExtPreg::test_preg_quote() { + { + String keywords = "$40 for a g3/400"; + keywords = f_preg_quote(keywords, "/"); + VS(keywords, "\\$40 for a g3\\/400"); + } + + // In this example, preg_quote($word) is used to keep the + // asterisks from having special meaning to the regular + // expression. + { + String textbody = "This book is *very* difficult to find."; + String word = "*very*"; + textbody = f_preg_replace(String("/") + f_preg_quote(word) + "/", + String("") + word + "", + textbody); + VS(textbody, "This book is *very* difficult to find."); + } + return Count(true); +} + +bool TestExtPreg::test_preg_last_error() { + f_preg_match("/(?:\\D+|<\\d+>)*[!?]/", "foobar foobar foobar"); + VS(f_preg_last_error(), 0); + return Count(true); +} + +bool TestExtPreg::test_ereg_replace() { + { + String str = "This is a test"; + VS(f_str_replace(" is", " was", str), "This was a test"); + VS(f_ereg_replace("( )is", "\\1was", str), "This was a test"); + VS(f_ereg_replace("(( )is)", "\\2was", str), "This was a test"); + } + { + int num = 4; + String str = "This string has four words."; + str = f_ereg_replace("four", num, str); + VS(str, "This string has 4 words."); + } + { + String test = "http://test.com/test"; + test = f_ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", + "\\0", test); + VS(test, "http://test.com/test"); + } + return Count(true); +} + +bool TestExtPreg::test_eregi_replace() { + String pattern = "(>[^<]*)(suffix)"; + String replacement = "\\1\\2"; + String body = ">whateversuffix"; + body = f_eregi_replace(pattern, replacement, body); + VS(body, ">whateversuffix"); + return Count(true); +} + +bool TestExtPreg::test_ereg() { + Variant regs; + String date = "1973-04-30"; + VERIFY(f_ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", date, ref(regs))); + VS(regs[3], "30"); + VS(regs[2], "04"); + VS(regs[1], "1973"); + VS(regs[0], "1973-04-30"); + return Count(true); +} + +bool TestExtPreg::test_eregi() { + String str = "XYZ"; + VERIFY(f_eregi("z", str)); + return Count(true); +} + +bool TestExtPreg::test_split() { + { + String mb = "\xe4\xbf\xa1\xe6\x81\xaf\x01 2366797"; + Array ret = f_split("\x01", mb); + VS(ret[0], "\xe4\xbf\xa1\xe6\x81\xaf"); + VS(ret[1], " 2366797"); + } + + String date = "04/30/1973"; + Array ret = f_split("[/.-]", date); + VS(ret[0], "04"); + VS(ret[1], "30"); + VS(ret[2], "1973"); + return Count(true); +} + +bool TestExtPreg::test_spliti() { + String str = "aBBBaCCCADDDaEEEaGGGA"; + Array chunks = f_spliti("a", str, 5); + VS(chunks[0], ""); + VS(chunks[1], "BBB"); + VS(chunks[2], "CCC"); + VS(chunks[3], "DDD"); + VS(chunks[4], "EEEaGGGA"); + return Count(true); +} + +bool TestExtPreg::test_sql_regcase() { + VS(f_sql_regcase("Foo - bar."), "[Ff][Oo][Oo] - [Bb][Aa][Rr]."); + return Count(true); +} diff --git a/src/test/test_ext_preg.h b/src/test/test_ext_preg.h new file mode 100644 index 0000000000000..16ecae78c6b1d --- /dev/null +++ b/src/test/test_ext_preg.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_PREG_H__ +#define __TEST_EXT_PREG_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtPreg : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_preg_grep(); + bool test_preg_match(); + bool test_preg_match_all(); + bool test_preg_replace(); + bool test_preg_replace_callback(); + bool test_preg_split(); + bool test_preg_quote(); + bool test_preg_last_error(); + bool test_ereg_replace(); + bool test_eregi_replace(); + bool test_ereg(); + bool test_eregi(); + bool test_split(); + bool test_spliti(); + bool test_sql_regcase(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_PREG_H__ diff --git a/src/test/test_ext_process.cpp b/src/test/test_ext_process.cpp new file mode 100644 index 0000000000000..17b9cc69b3361 --- /dev/null +++ b/src/test/test_ext_process.cpp @@ -0,0 +1,352 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtProcess::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_pcntl_alarm); + //RUN_TEST(test_pcntl_exec); // this has to run manually + RUN_TEST(test_pcntl_fork); + RUN_TEST(test_pcntl_getpriority); + RUN_TEST(test_pcntl_setpriority); + RUN_TEST(test_pcntl_signal); + RUN_TEST(test_pcntl_wait); + RUN_TEST(test_pcntl_waitpid); + RUN_TEST(test_pcntl_wexitstatus); + RUN_TEST(test_pcntl_wifexited); + RUN_TEST(test_pcntl_wifsignaled); + RUN_TEST(test_pcntl_wifstopped); + RUN_TEST(test_pcntl_wstopsig); + RUN_TEST(test_pcntl_wtermsig); + RUN_TEST(test_pcntl_signal_dispatch); + RUN_TEST(test_shell_exec); + RUN_TEST(test_exec); + RUN_TEST(test_passthru); + RUN_TEST(test_system); + RUN_TEST(test_proc_open); + RUN_TEST(test_proc_terminate); + RUN_TEST(test_proc_close); + RUN_TEST(test_proc_get_status); + RUN_TEST(test_proc_nice); + RUN_TEST(test_escapeshellarg); + RUN_TEST(test_escapeshellcmd); + + LightProcess::initialize(); + RUN_TEST(test_pcntl_alarm); + //RUN_TEST(test_pcntl_exec); // this has to run manually + RUN_TEST(test_pcntl_fork); + RUN_TEST(test_pcntl_getpriority); + RUN_TEST(test_pcntl_setpriority); + RUN_TEST(test_pcntl_signal); + RUN_TEST(test_pcntl_wait); + RUN_TEST(test_pcntl_waitpid); + RUN_TEST(test_pcntl_wexitstatus); + RUN_TEST(test_pcntl_wifexited); + RUN_TEST(test_pcntl_wifsignaled); + RUN_TEST(test_pcntl_wifstopped); + RUN_TEST(test_pcntl_wstopsig); + RUN_TEST(test_pcntl_wtermsig); + RUN_TEST(test_pcntl_signal_dispatch); + RUN_TEST(test_shell_exec); + RUN_TEST(test_exec); + RUN_TEST(test_passthru); + RUN_TEST(test_system); + RUN_TEST(test_proc_open); + RUN_TEST(test_proc_terminate); + RUN_TEST(test_proc_close); + RUN_TEST(test_proc_get_status); + RUN_TEST(test_proc_nice); + LightProcess::close(); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtProcess::test_pcntl_alarm() { + //f_pcntl_alarm(1); + return Count(true); +} + +bool TestExtProcess::test_pcntl_exec() { + f_pcntl_exec("/bin/sh", + CREATE_VECTOR1("test/test_pcntl_exec.sh"), + CREATE_MAP1("name", "value")); + return Count(true); +} + +bool TestExtProcess::test_pcntl_fork() { + int pid = f_pcntl_fork(); + if (pid == 0) { + exit(123); + } + Variant status; + f_pcntl_wait(ref(status)); + return Count(true); +} + +bool TestExtProcess::test_pcntl_getpriority() { + VS(f_pcntl_getpriority(), 0); + return Count(true); +} + +bool TestExtProcess::test_pcntl_setpriority() { + VERIFY(f_pcntl_setpriority(0)); + return Count(true); +} + +bool TestExtProcess::test_pcntl_signal() { + f_pcntl_signal(SIGALRM, "test", true); + return Count(true); +} + +bool TestExtProcess::test_pcntl_wait() { + int pid = f_pcntl_fork(); + if (pid == 0) { + exit(0x12); + } + Variant status; + f_pcntl_wait(ref(status)); + VS(status, 0x1200); + return Count(true); +} + +bool TestExtProcess::test_pcntl_waitpid() { + int pid = f_pcntl_fork(); + if (pid == 0) { + exit(0x12); + } + Variant status; + f_pcntl_waitpid(0, ref(status)); + VS(status, 0x1200); + return Count(true); +} + +bool TestExtProcess::test_pcntl_wexitstatus() { + int pid = f_pcntl_fork(); + if (pid == 0) { + exit(0x12); + } + Variant status; + f_pcntl_waitpid(0, ref(status)); + VS(f_pcntl_wexitstatus(status), 0x12); + return Count(true); +} + +bool TestExtProcess::test_pcntl_wifexited() { + int pid = f_pcntl_fork(); + if (pid == 0) { + exit(0x12); + } + Variant status; + f_pcntl_waitpid(0, ref(status)); + VERIFY(f_pcntl_wifexited(status)); + return Count(true); +} + +bool TestExtProcess::test_pcntl_wifsignaled() { + int pid = f_pcntl_fork(); + if (pid == 0) { + exit(0x12); + } + Variant status; + f_pcntl_waitpid(0, ref(status)); + VERIFY(!f_pcntl_wifsignaled(status)); + return Count(true); +} + +bool TestExtProcess::test_pcntl_wifstopped() { + int pid = f_pcntl_fork(); + if (pid == 0) { + exit(0x12); + } + Variant status; + f_pcntl_waitpid(0, ref(status)); + VERIFY(!f_pcntl_wifstopped(status)); + return Count(true); +} + +bool TestExtProcess::test_pcntl_wstopsig() { + int pid = f_pcntl_fork(); + if (pid == 0) { + exit(0x12); + } + Variant status; + f_pcntl_waitpid(0, ref(status)); + VS(f_pcntl_wstopsig(status), 0x12); + return Count(true); +} + +bool TestExtProcess::test_pcntl_wtermsig() { + int pid = f_pcntl_fork(); + if (pid == 0) { + exit(0x12); + } + Variant status; + f_pcntl_waitpid(0, ref(status)); + VS(f_pcntl_wtermsig(status), 0); + return Count(true); +} + +bool TestExtProcess::test_shell_exec() { + Variant output = f_shell_exec("echo hello"); + VS(output, "hello\n"); + return Count(true); +} + +bool TestExtProcess::test_pcntl_signal_dispatch() { + f_pcntl_signal_dispatch(); + return Count(true); +} + +bool TestExtProcess::test_exec() { + Variant output, ret; + String last_line = f_exec("echo hello; echo world;", ref(output), ref(ret)); + VS(output, CREATE_VECTOR2("hello", "world")); + VS(last_line, "world"); + VS(ret, 0); + return Count(true); +} + +bool TestExtProcess::test_passthru() { + g_context->obStart(); + Variant ret; + f_passthru("echo hello; echo world;", ref(ret)); + String output = g_context->obGetContents(); + g_context->obEnd(); + + VS(output, "hello\nworld\n"); + VS(ret, 0); + return Count(true); +} + +bool TestExtProcess::test_system() { + g_context->obStart(); + Variant ret; + String last_line = f_system("echo hello; echo world;", ref(ret)); + String output = g_context->obGetContents(); + g_context->obEnd(); + + VS(output, "hello\nworld\n"); + VS(last_line, "world"); + VS(ret, 0); + return Count(true); +} + +bool TestExtProcess::test_proc_open() { + Array descriptorspec = + CREATE_MAP3(0, CREATE_VECTOR2("pipe", "r"), + 1, CREATE_VECTOR2("pipe", "w"), + 2, CREATE_VECTOR3("file", "/tmp/error-output.txt", "a")); + String cwd = "/tmp"; + Array env = CREATE_MAP1("some_option", "aeiou"); + + Variant pipes; + Variant process = f_proc_open("php", descriptorspec, ref(pipes), cwd, env); + VERIFY(!same(process, false)); + + { + File *f = pipes[0].toObject().getTyped(); + VERIFY(f->valid()); + String s("", AttachLiteral); + f->write(s); + f->close(); + } + { + File *f = pipes[1].toObject().getTyped(); + VERIFY(f->valid()); + StringBuffer sbuf; + sbuf.read(f); + f->close(); + VS(sbuf.detach(), "aeiou"); + } + + VS(f_proc_close(process.toObject()), 0); + return Count(true); +} + +bool TestExtProcess::test_proc_terminate() { + Array descriptorspec = + CREATE_MAP3(0, CREATE_VECTOR2("pipe", "r"), + 1, CREATE_VECTOR2("pipe", "w"), + 2, CREATE_VECTOR3("file", "/tmp/error-output.txt", "a")); + Variant pipes; + Variant process = f_proc_open("php", descriptorspec, ref(pipes)); + VERIFY(!same(process, false)); + VERIFY(f_proc_terminate(process.toObject())); + // still need to close it, not to leave a zombie behind + f_proc_close(process.toObject()); + return Count(true); +} + +bool TestExtProcess::test_proc_close() { + return test_proc_open(); +} + +bool TestExtProcess::test_proc_get_status() { + Array descriptorspec = + CREATE_MAP3(0, CREATE_VECTOR2("pipe", "r"), + 1, CREATE_VECTOR2("pipe", "w"), + 2, CREATE_VECTOR3("file", "/tmp/error-output.txt", "a")); + Variant pipes; + Variant process = f_proc_open("php", descriptorspec, ref(pipes)); + VERIFY(!same(process, false)); + Array ret = f_proc_get_status(process.toObject()); + VS(ret["command"], "php"); + VERIFY(ret["pid"].toInt32() > 0); + VERIFY(ret["running"]); + VERIFY(!ret["signaled"]); + VS(ret["exitcode"], -1); + VS(ret["termsig"], 0); + VS(ret["stopsig"], 0); + + { + File *f = pipes[0].toObject().getTyped(); + VERIFY(f->valid()); + f->close(); + } + { + File *f = pipes[1].toObject().getTyped(); + VERIFY(f->valid()); + f->close(); + } + VS(f_proc_close(process.toObject()), 0); + return Count(true); +} + +bool TestExtProcess::test_proc_nice() { + VERIFY(f_proc_nice(0)); + return Count(true); +} + +bool TestExtProcess::test_escapeshellarg() { + VS(f_escapeshellarg("\""), "'\"'"); + return Count(true); +} + +bool TestExtProcess::test_escapeshellcmd() { + VS(f_escapeshellcmd("perl \""), "perl \\\""); + return Count(true); +} diff --git a/src/test/test_ext_process.h b/src/test/test_ext_process.h new file mode 100644 index 0000000000000..a9b296f936619 --- /dev/null +++ b/src/test/test_ext_process.h @@ -0,0 +1,60 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_PROCESS_H__ +#define __TEST_EXT_PROCESS_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtProcess : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_pcntl_alarm(); + bool test_pcntl_exec(); + bool test_pcntl_fork(); + bool test_pcntl_getpriority(); + bool test_pcntl_setpriority(); + bool test_pcntl_signal(); + bool test_pcntl_wait(); + bool test_pcntl_waitpid(); + bool test_pcntl_wexitstatus(); + bool test_pcntl_wifexited(); + bool test_pcntl_wifsignaled(); + bool test_pcntl_wifstopped(); + bool test_pcntl_wstopsig(); + bool test_pcntl_wtermsig(); + bool test_pcntl_signal_dispatch(); + bool test_shell_exec(); + bool test_exec(); + bool test_passthru(); + bool test_system(); + bool test_proc_open(); + bool test_proc_terminate(); + bool test_proc_close(); + bool test_proc_get_status(); + bool test_proc_nice(); + bool test_escapeshellarg(); + bool test_escapeshellcmd(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_PROCESS_H__ diff --git a/src/test/test_ext_reflection.cpp b/src/test/test_ext_reflection.cpp new file mode 100644 index 0000000000000..86b54d5afead6 --- /dev/null +++ b/src/test/test_ext_reflection.cpp @@ -0,0 +1,94 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtReflection::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_hphp_get_extension_info); + RUN_TEST(test_hphp_get_class_info); + RUN_TEST(test_hphp_get_function_info); + RUN_TEST(test_hphp_invoke); + RUN_TEST(test_hphp_invoke_method); + RUN_TEST(test_hphp_instanceof); + RUN_TEST(test_hphp_create_object); + RUN_TEST(test_hphp_get_property); + RUN_TEST(test_hphp_set_property); + RUN_TEST(test_hphp_get_static_property); + RUN_TEST(test_hphp_set_static_property); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtReflection::test_hphp_get_extension_info() { + //VCB(">>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtReflection : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_hphp_get_extension_info(); + bool test_hphp_get_class_info(); + bool test_hphp_get_function_info(); + bool test_hphp_invoke(); + bool test_hphp_invoke_method(); + bool test_hphp_instanceof(); + bool test_hphp_create_object(); + bool test_hphp_get_property(); + bool test_hphp_set_property(); + bool test_hphp_get_static_property(); + bool test_hphp_set_static_property(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_REFLECTION_H__ diff --git a/src/test/test_ext_server.cpp b/src/test/test_ext_server.cpp new file mode 100644 index 0000000000000..f1232c03db029 --- /dev/null +++ b/src/test/test_ext_server.cpp @@ -0,0 +1,142 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtServer::RunTests(const std::string &which) { + bool ret = true; + + RuntimeOption::PageletServerThreadCount = 10; + PageletServer::Restart(); + + RuntimeOption::XboxServerThreadCount = 10; + XboxServer::Restart(); + + RUN_TEST(test_dangling_server_proxy_old_request); + RUN_TEST(test_dangling_server_proxy_new_request); + RUN_TEST(test_pagelet_server_task_start); + RUN_TEST(test_pagelet_server_task_status); + RUN_TEST(test_pagelet_server_task_result); + RUN_TEST(test_xbox_send_message); + RUN_TEST(test_xbox_post_message); + RUN_TEST(test_xbox_task_start); + RUN_TEST(test_xbox_task_status); + RUN_TEST(test_xbox_task_result); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtServer::test_dangling_server_proxy_old_request() { + return Count(true); +} + +bool TestExtServer::test_dangling_server_proxy_new_request() { + return Count(true); +} + +/////////////////////////////////////////////////////////////////////////////// +// Pagelet Server unit test + +bool TestExtServer::test_pagelet_server_task_start() { + // tested in test_pagelet_server_task_result() + return Count(true); +} + +bool TestExtServer::test_pagelet_server_task_status() { + // tested in test_pagelet_server_task_result() + return Count(true); +} + +bool TestExtServer::test_pagelet_server_task_result() { + const int TEST_SIZE = 20; + + String baseurl("pageletserver?getparam="); + String baseheader("MyHeader: "); + String basepost("postparam="); + + std::vector tasks; + for (int i = 0; i < TEST_SIZE; ++i) { + String url = baseurl + String(i); + String header = baseheader + String(i); + String post = basepost + String(i); + Object task = f_pagelet_server_task_start(url, CREATE_VECTOR1(header), + post); + tasks.push_back(task); + } + + for (int i = 0; i < TEST_SIZE; ++i) { + f_pagelet_server_task_status(tasks[i]); + } + + for (int i = 0; i < TEST_SIZE; ++i) { + String expected = "pagelet postparam: "; + expected += String(i); + expected += "pagelet getparam: "; + expected += String(i); + expected += "pagelet header: "; + expected += String(i); + + Variant code, headers; + VS(expected, f_pagelet_server_task_result(tasks[i], ref(headers), + ref(code))); + VS(code, 200); + VS(headers[1], "ResponseHeader: okay"); + } + + return Count(true); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtServer::test_xbox_send_message() { + Variant ret; + VERIFY(f_xbox_send_message("hello", ref(ret), 5000)); + VS(ret["code"], 200); + VS(ret["response"], "olleh"); + return Count(true); +} + +bool TestExtServer::test_xbox_post_message() { + VERIFY(f_xbox_post_message("hello")); + return Count(true); +} + +bool TestExtServer::test_xbox_task_start() { + // tested in test_xbox_task_result() + return Count(true); +} + +bool TestExtServer::test_xbox_task_status() { + // tested in test_xbox_task_result() + return Count(true); +} + +bool TestExtServer::test_xbox_task_result() { + Object task = f_xbox_task_start("hello"); + f_xbox_task_status(task); + Variant ret; + VS(f_xbox_task_result(task, 0, ref(ret)), 200); + VS(ret, "olleh"); + return Count(true); +} diff --git a/src/test/test_ext_server.h b/src/test/test_ext_server.h new file mode 100644 index 0000000000000..876413e404f1a --- /dev/null +++ b/src/test/test_ext_server.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_SERVER_H__ +#define __TEST_EXT_SERVER_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtServer : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_dangling_server_proxy_old_request(); + bool test_dangling_server_proxy_new_request(); + bool test_pagelet_server_task_start(); + bool test_pagelet_server_task_status(); + bool test_pagelet_server_task_result(); + bool test_xbox_send_message(); + bool test_xbox_post_message(); + bool test_xbox_task_start(); + bool test_xbox_task_status(); + bool test_xbox_task_result(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_SERVER_H__ diff --git a/src/test/test_ext_simplexml.cpp b/src/test/test_ext_simplexml.cpp new file mode 100644 index 0000000000000..1e0f150a82eb0 --- /dev/null +++ b/src/test/test_ext_simplexml.cpp @@ -0,0 +1,87 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtSimplexml::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_simplexml_load_string); + RUN_TEST(test_simplexml_load_file); + RUN_TEST(test_libxml_get_errors); + RUN_TEST(test_libxml_get_last_error); + RUN_TEST(test_libxml_clear_errors); + RUN_TEST(test_libxml_use_internal_errors); + RUN_TEST(test_libxml_set_streams_context); + RUN_TEST(test_SimpleXMLElement); + RUN_TEST(test_LibXMLError); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtSimplexml::test_simplexml_load_string() { + // tested in TestCodeRun::TestSimpleXML + return Count(true); +} + +bool TestExtSimplexml::test_simplexml_load_file() { + // nothing much different from simplexml_load_string() + return Count(true); +} + +bool TestExtSimplexml::test_libxml_get_errors() { + VS(f_libxml_get_errors(), Array::Create()); + return Count(true); +} + +bool TestExtSimplexml::test_libxml_get_last_error() { + VS(f_libxml_get_last_error(), false); + return Count(true); +} + +bool TestExtSimplexml::test_libxml_clear_errors() { + f_libxml_clear_errors(); + return Count(true); +} + +bool TestExtSimplexml::test_libxml_use_internal_errors() { + VS(f_libxml_use_internal_errors(), false); + return Count(true); +} + +bool TestExtSimplexml::test_libxml_set_streams_context() { + try { + f_libxml_set_streams_context(Object()); + } catch (NotImplementedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtSimplexml::test_SimpleXMLElement() { + // tested in simplexml functions + return Count(true); +} + +bool TestExtSimplexml::test_LibXMLError() { + // tested in libxml functions + return Count(true); +} diff --git a/src/test/test_ext_simplexml.h b/src/test/test_ext_simplexml.h new file mode 100644 index 0000000000000..74735f1572050 --- /dev/null +++ b/src/test/test_ext_simplexml.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_SIMPLEXML_H__ +#define __TEST_EXT_SIMPLEXML_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtSimplexml : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_simplexml_load_string(); + bool test_simplexml_load_file(); + bool test_libxml_get_errors(); + bool test_libxml_get_last_error(); + bool test_libxml_clear_errors(); + bool test_libxml_use_internal_errors(); + bool test_libxml_set_streams_context(); + bool test_SimpleXMLElement(); + bool test_LibXMLError(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_SIMPLEXML_H__ diff --git a/src/test/test_ext_soap.cpp b/src/test/test_ext_soap.cpp new file mode 100644 index 0000000000000..b2ca353e998a5 --- /dev/null +++ b/src/test/test_ext_soap.cpp @@ -0,0 +1,132 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtSoap::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_SoapServerSanity); + RUN_TEST(test_SoapServerFunctionAll); + RUN_TEST(test_SoapServerFunctionParam); + RUN_TEST(test_SoapServerArrayParam); + RUN_TEST(test_SoapServerWSDL); + RUN_TEST(test_SoapServerFault); + + return ret; +} + +bool TestExtSoap::onTest() { + m_server = p_soapserver(NEW(c_soapserver)()); + m_server->create(null, CREATE_MAP1("uri", "http://testuri.org")); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +bool TestExtSoap::verify_response(CStrRef request, CStrRef expected) { + f_ob_start(); + m_server->t_handle(request); + String res = f_ob_get_contents(); + f_ob_end_clean(); + VS(res, expected); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtSoap::test_SoapServerSanity() { + m_server->t_addfunction("hello"); + + VSOAP("", + "Hello World" + ""); + + return Count(true); +} + +bool TestExtSoap::test_SoapServerFunctionAll() { + m_server->t_addfunction(k_SOAP_FUNCTIONS_ALL); + + VSOAP("" + "Hello World" + "", + "11" + ""); + + return Count(true); +} + +bool TestExtSoap::test_SoapServerFunctionParam() { + Array funcs = CREATE_VECTOR2("Sub", "Add"); + m_server->t_addfunction(funcs); + VS(m_server->t_getfunctions(), funcs); + + VSOAP("" + "22" + "33" + "", + "55" + ""); + + return Count(true); +} + +bool TestExtSoap::test_SoapServerArrayParam() { + m_server->t_addfunction("Sum"); + + VSOAP("" + "" + " 3" + " 5" + "" + "", + "8" + ""); + + return Count(true); +} + +bool TestExtSoap::test_SoapServerWSDL() { + m_server = p_soapserver(NEW(c_soapserver)()); + m_server->create("test/test.wsdl", CREATE_MAP1("uri", "http://testuri.org")); + m_server->t_addfunction("Add"); + + VSOAPNS("" + "22" + "33" + "", + "55" + "", + ""); + + return Count(true); +} + +bool TestExtSoap::test_SoapServerFault() { + m_server->t_addfunction("Fault"); + + VSOAPEX("", + "\n" + "MyFaultMy fault string\n"); + + return Count(true); +} diff --git a/src/test/test_ext_soap.h b/src/test/test_ext_soap.h new file mode 100644 index 0000000000000..513b7c237d26e --- /dev/null +++ b/src/test/test_ext_soap.h @@ -0,0 +1,81 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_SOAP_H__ +#define __TEST_EXT_SOAP_H__ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtSoap : public TestCppExt { +public: + virtual bool onTest(); + virtual bool RunTests(const std::string &which); + + bool test_SoapServerSanity(); + bool test_SoapServerFunctionAll(); + bool test_SoapServerFunctionParam(); + bool test_SoapServerArrayParam(); + bool test_SoapServerWSDL(); + bool test_SoapServerFault(); + +private: + p_soapserver m_server; + + bool verify_response(CStrRef request, CStrRef expected); +}; + +#define VSOAPEX(request, response) \ + if (!verify_response \ + ("" \ + "" \ + "" \ + request \ + " " \ + "", \ + response \ + )) return false; + +#define VSOAPNS(request, expected, ns) \ + VSOAPEX(request, \ + "\n" \ + "" \ + "" \ + expected \ + "\n" \ + ) + +#define VSOAP(request, expected) \ + VSOAPNS(request, expected, "http://testuri.org") + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_SOAP_H__ diff --git a/src/test/test_ext_socket.cpp b/src/test/test_ext_socket.cpp new file mode 100644 index 0000000000000..70e11b58e87da --- /dev/null +++ b/src/test/test_ext_socket.cpp @@ -0,0 +1,307 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtSocket::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_socket_create); + RUN_TEST(test_socket_create_listen); + RUN_TEST(test_socket_create_pair); + RUN_TEST(test_socket_get_option); + RUN_TEST(test_socket_getpeername); + RUN_TEST(test_socket_getsockname); + RUN_TEST(test_socket_set_block); + RUN_TEST(test_socket_set_nonblock); + RUN_TEST(test_socket_set_option); + RUN_TEST(test_socket_connect); + RUN_TEST(test_socket_bind); + RUN_TEST(test_socket_listen); + RUN_TEST(test_socket_select); + RUN_TEST(test_socket_server); + RUN_TEST(test_socket_accept); + RUN_TEST(test_socket_read); + RUN_TEST(test_socket_write); + RUN_TEST(test_socket_send); + RUN_TEST(test_socket_sendto); + RUN_TEST(test_socket_recv); + RUN_TEST(test_socket_recvfrom); + RUN_TEST(test_socket_shutdown); + RUN_TEST(test_socket_close); + RUN_TEST(test_socket_strerror); + RUN_TEST(test_socket_last_error); + RUN_TEST(test_socket_clear_error); + + return ret; +} + +// so we run on different range of ports every time +static int get_random_port() { + static int base = -1; + if (base == -1) { + base = 12345 + (int)((time(0) * 100) % 30000); + } + return ++base; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtSocket::test_socket_create() { + VERIFY(!same(f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP), false)); + return Count(true); +} + +bool TestExtSocket::test_socket_create_listen() { + int port = get_random_port(); + VERIFY(!same(f_socket_create_listen(port), false)); + return Count(true); +} + +bool TestExtSocket::test_socket_create_pair() { + Variant fds; + VERIFY(f_socket_create_pair(k_AF_UNIX, k_SOCK_STREAM, 0, ref(fds))); + VS(fds.toArray().size(), 2); + VERIFY(more(fds[0], 0)); + VERIFY(more(fds[1], 0)); + return Count(true); +} + +bool TestExtSocket::test_socket_get_option() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VS(f_socket_get_option(s, k_SOL_SOCKET, k_SO_TYPE), k_SOCK_STREAM); + return Count(true); +} + +bool TestExtSocket::test_socket_getpeername() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_connect(s, "facebook.com", 80)); + + Variant address; + VERIFY(f_socket_getpeername(s, ref(address))); + + VERIFY(!address.toString().empty()); + return Count(true); +} + +bool TestExtSocket::test_socket_getsockname() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_connect(s, "facebook.com", 80)); + + Variant address; + VERIFY(f_socket_getsockname(s, ref(address))); + + VERIFY(!address.toString().empty()); + return Count(true); +} + +bool TestExtSocket::test_socket_set_block() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_set_block(s)); + return Count(true); +} + +bool TestExtSocket::test_socket_set_nonblock() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_set_nonblock(s)); + return Count(true); +} + +bool TestExtSocket::test_socket_set_option() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_set_option(s, k_SOL_SOCKET, k_SO_RCVTIMEO, + CREATE_MAP2("sec", 1, "usec", 0))); + return Count(true); +} + +bool TestExtSocket::test_socket_connect() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_connect(s, "facebook.com", 80)); + return Count(true); +} + +bool TestExtSocket::test_socket_bind() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + int port = get_random_port(); + VERIFY(f_socket_bind(s, "127.0.0.1", port)); + VERIFY(f_socket_listen(s)); + return Count(true); +} + +bool TestExtSocket::test_socket_listen() { + Variant server = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + int port = get_random_port(); + VERIFY(f_socket_bind(server, "127.0.0.1", port)); + VERIFY(f_socket_listen(server)); + + Variant client = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_connect(client, "127.0.0.1", port)); + + Variant s = f_socket_accept(server); + VERIFY(f_socket_write(client, "testing")); + + // this could fail with shorter returns, but it never does... + VS(f_socket_read(s, 100), "testing"); + return Count(true); +} + +bool TestExtSocket::test_socket_select() { + Variant server = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + int port = get_random_port(); + VERIFY(f_socket_bind(server, "127.0.0.1", port)); + VERIFY(f_socket_listen(server)); + + Variant client = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_connect(client, "127.0.0.1", port)); + + Variant s = f_socket_accept(server); + + Variant reads = CREATE_VECTOR1(s); + VS(f_socket_select(ref(reads), null, null, 1, 0), 0); + + VERIFY(f_socket_write(client, "testing")); + reads = CREATE_VECTOR1(s); + VS(f_socket_select(ref(reads), null, null, 1, 0), 1); + return Count(true); +} + +bool TestExtSocket::test_socket_server() { + int port = get_random_port(); + Variant server = f_socket_server("127.0.0.1", port); + VERIFY(!same(server, false)); + + Variant client = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_connect(client, "127.0.0.1", port)); + + Variant s = f_socket_accept(server); + + Variant reads = CREATE_VECTOR1(s); + VS(f_socket_select(ref(reads), null, null, 1, 0), 0); + + VERIFY(f_socket_write(client, "testing")); + reads = CREATE_VECTOR1(s); + VS(f_socket_select(ref(reads), null, null, 1, 0), 1); + return Count(true); +} + +bool TestExtSocket::test_socket_accept() { + // tested with test_socket_listen + return Count(true); +} + +bool TestExtSocket::test_socket_read() { + // tested with test_socket_listen + return Count(true); +} + +bool TestExtSocket::test_socket_write() { + // tested with test_socket_listen + return Count(true); +} + +bool TestExtSocket::test_socket_send() { + Variant server = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + int port = get_random_port(); + VERIFY(f_socket_bind(server, "127.0.0.1", port)); + VERIFY(f_socket_listen(server)); + + Variant client = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_connect(client, "127.0.0.1", port)); + + Variant s = f_socket_accept(server); + String text = "testing"; + VERIFY(f_socket_send(client, text, 4, 0)); + + Variant buffer; + VERIFY(f_socket_recv(s, ref(buffer), 100, 0)); + VS(buffer, "test"); + return Count(true); +} + +bool TestExtSocket::test_socket_sendto() { + Variant server = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + int port = get_random_port(); + VERIFY(f_socket_bind(server, "127.0.0.1", port)); + VERIFY(f_socket_listen(server)); + + Variant client = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + VERIFY(f_socket_connect(client, "127.0.0.1", port)); + + Variant s = f_socket_accept(server); + String text = "testing"; + VERIFY(f_socket_sendto(client, text, 4, 0, "127.0.0.1", port)); + + Variant buffer; + Variant name, vport; + VERIFY(f_socket_recvfrom(s, ref(buffer), 100, 0, ref(name), ref(vport))); + VS(buffer, "test"); + return Count(true); +} + +bool TestExtSocket::test_socket_recv() { + // tested with test_socket_send + return Count(true); +} + +bool TestExtSocket::test_socket_recvfrom() { + // tested with test_socket_sendto + return Count(true); +} + +bool TestExtSocket::test_socket_shutdown() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + int port = get_random_port(); + VERIFY(f_socket_bind(s, "127.0.0.1", port)); + VERIFY(f_socket_listen(s)); + VERIFY(f_socket_shutdown(s)); + return Count(true); +} + +bool TestExtSocket::test_socket_close() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + int port = get_random_port(); + VERIFY(f_socket_bind(s, "127.0.0.1", port)); + VERIFY(f_socket_listen(s)); + f_socket_close(s); + return Count(true); +} + +bool TestExtSocket::test_socket_strerror() { + Variant s = f_socket_create(k_AF_INET, k_SOCK_STREAM, k_SOL_TCP); + Logger::LogLevelType oldLevel = Logger::LogLevel; + Logger::LogLevel = Logger::LogNone; + f_socket_bind(s, "127.0.0.1", 80); + Logger::LogLevel = oldLevel; + VS(f_socket_last_error(s), 13); + VS(f_socket_strerror(13), "Permission denied"); + f_socket_clear_error(s); + VS(f_socket_last_error(s), 0); + return Count(true); +} + +bool TestExtSocket::test_socket_last_error() { + // tested with test_socket_strerror + return Count(true); +} + +bool TestExtSocket::test_socket_clear_error() { + // tested with test_socket_strerror + return Count(true); +} diff --git a/src/test/test_ext_socket.h b/src/test/test_ext_socket.h new file mode 100644 index 0000000000000..cdfcc5a10aecd --- /dev/null +++ b/src/test/test_ext_socket.h @@ -0,0 +1,60 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_SOCKET_H__ +#define __TEST_EXT_SOCKET_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtSocket : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_socket_create(); + bool test_socket_create_listen(); + bool test_socket_create_pair(); + bool test_socket_get_option(); + bool test_socket_getpeername(); + bool test_socket_getsockname(); + bool test_socket_set_block(); + bool test_socket_set_nonblock(); + bool test_socket_set_option(); + bool test_socket_connect(); + bool test_socket_bind(); + bool test_socket_listen(); + bool test_socket_select(); + bool test_socket_server(); + bool test_socket_accept(); + bool test_socket_read(); + bool test_socket_write(); + bool test_socket_send(); + bool test_socket_sendto(); + bool test_socket_recv(); + bool test_socket_recvfrom(); + bool test_socket_shutdown(); + bool test_socket_close(); + bool test_socket_strerror(); + bool test_socket_last_error(); + bool test_socket_clear_error(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_SOCKET_H__ diff --git a/src/test/test_ext_sqlite3.cpp b/src/test/test_ext_sqlite3.cpp new file mode 100644 index 0000000000000..f920eb416eab1 --- /dev/null +++ b/src/test/test_ext_sqlite3.cpp @@ -0,0 +1,122 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtSqlite3::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_sqlite3); + RUN_TEST(test_sqlite3stmt); + RUN_TEST(test_sqlite3result); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtSqlite3::test_sqlite3() { + p_sqlite3 db(NEW(c_sqlite3)()); + db->t_open(":memory:test"); + db->t_exec("DROP TABLE foo"); + db->t_exec("CREATE TABLE foo (bar STRING)"); + + db->t_exec("INSERT INTO foo VALUES ('ABC')"); + db->t_exec("INSERT INTO foo VALUES ('DEF')"); + VS(db->t_lastinsertrowid(), 2); + VS(db->t_changes(), 1); + VS(db->t_lasterrorcode(), 0); + VS(db->t_lasterrormsg(), "not an error"); + + VS(db->t_escapestring("'\""), "''\""); + VS(db->t_querysingle("SELECT * FROM foo"), "ABC"); + VS(db->t_querysingle("SELECT * FROM foo", true), CREATE_MAP1("bar", "ABC")); + + // testing query() and sqlite3result + { + Object objResult = db->t_query("SELECT * FROM foo").toObject(); + c_sqlite3result *res = objResult.getTyped(); + + VS(res->t_fetcharray(), CREATE_MAP2(0, "ABC", "bar", "ABC")); + VS(res->t_numcolumns(), 1); + VS(res->t_columnname(0), "bar"); + VS(res->t_columntype(0), k_SQLITE3_TEXT); + + VS(res->t_fetcharray(k_SQLITE3_NUM), CREATE_VECTOR1("DEF")); + } + + // testing prepare() and sqlite3stmt + { + Object objStmt = db->t_prepare("SELECT * FROM foo WHERE bar = :id"); + c_sqlite3stmt *stmt = objStmt.getTyped(); + VS(stmt->t_paramcount(), 1); + + Variant id = "DEF"; + VERIFY(stmt->t_bindvalue(":id", ref(id), SQLITE3_TEXT)); + id = "ABC"; + { + Object objResult = stmt->t_execute(); + c_sqlite3result *res = objResult.getTyped(); + VS(res->t_fetcharray(k_SQLITE3_NUM), CREATE_VECTOR1("DEF")); + } + + VERIFY(stmt->t_clear()); + VERIFY(stmt->t_reset()); + id = "DEF"; + VERIFY(stmt->t_bindparam(":id", ref(id), SQLITE3_TEXT)); + id = "ABC"; + { + Object objResult = stmt->t_execute(); + c_sqlite3result *res = objResult.getTyped(); + VS(res->t_fetcharray(k_SQLITE3_NUM), CREATE_VECTOR1("ABC")); + } + } + + // testing UDF + { + VERIFY(db->t_createfunction("tolower", "lower", 1)); + Object objResult = db->t_query("SELECT tolower(bar) FROM foo").toObject(); + c_sqlite3result *res = objResult.getTyped(); + VS(res->t_fetcharray(k_SQLITE3_NUM), CREATE_VECTOR1("abc")); + } + { + VERIFY(db->t_createaggregate("sumlen", "sumlen_step", "sumlen_fini", 1)); + Object objResult = db->t_query("SELECT sumlen(bar) FROM foo").toObject(); + c_sqlite3result *res = objResult.getTyped(); + VS(res->t_fetcharray(k_SQLITE3_NUM), CREATE_VECTOR1(6)); + } + + db->t_close(); + + VS(db->t_version(), + CREATE_MAP2("versionString", "3.6.18", "versionNumber", 3006018)); + f_unlink(":memory:test"); + return Count(true); +} + +bool TestExtSqlite3::test_sqlite3stmt() { + // tested in test_sqlite3() + return Count(true); +} + +bool TestExtSqlite3::test_sqlite3result() { + // tested in test_sqlite3() + return Count(true); +} diff --git a/src/test/test_ext_sqlite3.h b/src/test/test_ext_sqlite3.h new file mode 100644 index 0000000000000..2bfe15105abf2 --- /dev/null +++ b/src/test/test_ext_sqlite3.h @@ -0,0 +1,37 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_SQLITE3_H__ +#define __TEST_EXT_SQLITE3_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtSqlite3 : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_sqlite3(); + bool test_sqlite3stmt(); + bool test_sqlite3result(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_SQLITE3_H__ diff --git a/src/test/test_ext_stream.cpp b/src/test/test_ext_stream.cpp new file mode 100644 index 0000000000000..724f07dfa7d7b --- /dev/null +++ b/src/test/test_ext_stream.cpp @@ -0,0 +1,422 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtStream::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_stream_context_create); + RUN_TEST(test_stream_context_get_default); + RUN_TEST(test_stream_context_get_options); + RUN_TEST(test_stream_context_set_option); + RUN_TEST(test_stream_context_set_param); + RUN_TEST(test_stream_copy_to_stream); + RUN_TEST(test_stream_encoding); + RUN_TEST(test_stream_bucket_append); + RUN_TEST(test_stream_bucket_prepend); + RUN_TEST(test_stream_bucket_make_writeable); + RUN_TEST(test_stream_bucket_new); + RUN_TEST(test_stream_filter_register); + RUN_TEST(test_stream_filter_remove); + RUN_TEST(test_stream_filter_append); + RUN_TEST(test_stream_filter_prepend); + RUN_TEST(test_stream_get_contents); + RUN_TEST(test_stream_get_filters); + RUN_TEST(test_stream_get_line); + RUN_TEST(test_stream_get_meta_data); + RUN_TEST(test_stream_get_transports); + RUN_TEST(test_stream_get_wrappers); + RUN_TEST(test_stream_register_wrapper); + RUN_TEST(test_stream_wrapper_register); + RUN_TEST(test_stream_wrapper_restore); + RUN_TEST(test_stream_wrapper_unregister); + RUN_TEST(test_stream_resolve_include_path); + RUN_TEST(test_stream_select); + RUN_TEST(test_stream_set_blocking); + RUN_TEST(test_stream_set_timeout); + RUN_TEST(test_stream_set_write_buffer); + RUN_TEST(test_set_file_buffer); + RUN_TEST(test_stream_socket_accept); + RUN_TEST(test_stream_socket_server); + RUN_TEST(test_stream_socket_client); + RUN_TEST(test_stream_socket_enable_crypto); + RUN_TEST(test_stream_socket_get_name); + RUN_TEST(test_stream_socket_pair); + RUN_TEST(test_stream_socket_recvfrom); + RUN_TEST(test_stream_socket_sendto); + RUN_TEST(test_stream_socket_shutdown); + + return ret; +} + +// so we run on different range of ports every time +static int get_random_port() { + static int base = -1; + if (base == -1) { + base = 12345 + (int)((time(0) * 100) % 30000); + } + return ++base; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtStream::test_stream_context_create() { + f_stream_context_create(); + return Count(true); +} + +bool TestExtStream::test_stream_context_get_default() { + try { + f_stream_context_get_default(); + } catch (NotImplementedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_context_get_options() { + try { + f_stream_context_get_options(Object()); + } catch (NotImplementedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_context_set_option() { + try { + f_stream_context_set_option(Object(), ""); + } catch (NotImplementedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_context_set_param() { + try { + f_stream_context_set_param(Object(), Array()); + } catch (NotImplementedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_copy_to_stream() { + Variant src = f_fopen("test/test_ext_file.txt", "r"); + Variant dest = f_fopen("test/test_ext_file.tmp", "w"); + f_stream_copy_to_stream(src, dest); + f_fclose(dest); + + Variant f = f_fopen("test/test_ext_file.tmp", "r"); + VS(f_fgets(f), "Testing Ext File\n"); + return Count(true); +} + +bool TestExtStream::test_stream_encoding() { + try { + f_stream_encoding(Object()); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_bucket_append() { + try { + f_stream_bucket_append(Object(), Object()); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_bucket_prepend() { + try { + f_stream_bucket_prepend(Object(), Object()); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_bucket_make_writeable() { + try { + f_stream_bucket_make_writeable(Object()); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_bucket_new() { + try { + f_stream_bucket_new(Object(), ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_filter_register() { + try { + f_stream_filter_register("", ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_filter_remove() { + try { + f_stream_filter_remove(Object()); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_filter_append() { + try { + f_stream_filter_append(Object(), ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_filter_prepend() { + try { + f_stream_filter_prepend(Object(), ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_get_contents() { + Variant f = f_fopen("test/test_ext_file.txt", "r"); + VS(f_stream_get_contents(f), "Testing Ext File\n"); + return Count(true); +} + +bool TestExtStream::test_stream_get_filters() { + try { + f_stream_get_filters(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_get_line() { + Variant f = f_fopen("test/test_ext_file.txt", "r"); + VS(f_stream_get_line(f), "Testing Ext File\n"); + return Count(true); +} + +bool TestExtStream::test_stream_get_meta_data() { + int port = get_random_port(); + string address = string("127.0.0.1:") + boost::lexical_cast(port); + + Variant server = f_stream_socket_server(address); + Variant client = f_stream_socket_client(address); + + f_stream_set_timeout(client, 0, 500 * 1000); // 500ms + Variant line = f_fgets(client); + Variant meta = f_stream_get_meta_data(client); + VS(meta["timed_out"], true); + + return Count(true); +} + +bool TestExtStream::test_stream_get_transports() { + VERIFY(f_stream_get_transports().size() > 0); + return Count(true); +} + +bool TestExtStream::test_stream_get_wrappers() { + try { + f_stream_get_wrappers(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_register_wrapper() { + try { + f_stream_register_wrapper("", ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_wrapper_register() { + try { + f_stream_wrapper_register("", ""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_wrapper_restore() { + try { + f_stream_wrapper_restore(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_wrapper_unregister() { + try { + f_stream_wrapper_unregister(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_resolve_include_path() { + try { + f_stream_resolve_include_path(""); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_select() { + Variant f = f_fopen("test/test_ext_file.txt", "r"); + Variant reads = CREATE_VECTOR1(f); + VERIFY(!same(f_stream_select(ref(reads), null, null, 0, 0), false)); + return Count(true); +} + +bool TestExtStream::test_stream_set_blocking() { + Variant f = f_fopen("test/test_ext_file.txt", "r"); + VERIFY(f_stream_set_blocking(f, 0)); + return Count(true); +} + +bool TestExtStream::test_stream_set_timeout() { + Variant f = f_fopen("test/test_ext_file.txt", "r"); + f_stream_set_timeout(f, 0); + return Count(true); +} + +bool TestExtStream::test_stream_set_write_buffer() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_stream_set_write_buffer(f, 1 /* PHP_STREAM_BUFFER_LINE */); + f_fputs(f, "testing\nanother line\n"); + return Count(true); +} + +bool TestExtStream::test_set_file_buffer() { + Variant f = f_fopen("test/test_ext_file.tmp", "w"); + f_set_file_buffer(f, 1 /* PHP_STREAM_BUFFER_LINE */); + f_fputs(f, "testing\nanother line\n"); + return Count(true); +} + +bool TestExtStream::test_stream_socket_accept() { + // tested in test_stream_socket_recvfrom + return Count(true); +} + +bool TestExtStream::test_stream_socket_server() { + // tested in test_stream_socket_recvfrom + return Count(true); +} + +bool TestExtStream::test_stream_socket_client() { + // tested in test_stream_socket_recvfrom + return Count(true); +} + +bool TestExtStream::test_stream_socket_enable_crypto() { + try { + f_stream_socket_enable_crypto(Object(), true); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtStream::test_stream_socket_get_name() { + Variant client = f_stream_socket_client("facebook.com:80"); + VERIFY(!f_stream_socket_get_name(client, true).toString().empty()); + VERIFY(!f_stream_socket_get_name(client, false).toString().empty()); + return Count(true); +} + +bool TestExtStream::test_stream_socket_pair() { + Variant fds = f_stream_socket_pair(k_AF_UNIX, k_SOCK_STREAM, 0); + VS(fds.toArray().size(), 2); + VERIFY(more(fds[0], 0)); + VERIFY(more(fds[1], 0)); + return Count(true); +} + +bool TestExtStream::test_stream_socket_recvfrom() { + vector addresses; + int port = get_random_port(); + addresses.push_back("127.0.0.1:" + boost::lexical_cast(port)); // TCP + addresses.push_back("unix:///tmp/test_stream.sock"); // UNIX domain + unlink("/tmp/test_stream.sock"); + + for (unsigned int i = 0; i < addresses.size(); i++) { + const string &address = addresses[i]; + + Variant server = f_stream_socket_server(address); + Variant client = f_stream_socket_client(address); + + Variant s = f_stream_socket_accept(server); + String text = "testing"; + if (i == 1) { + VERIFY(f_socket_send(client, text, 7, 0)); + } else { + VERIFY(f_stream_socket_sendto(client, text, 0, address)); + } + + Variant buffer = f_stream_socket_recvfrom(s, 100); + VS(buffer, "testing"); + } + return Count(true); +} + +bool TestExtStream::test_stream_socket_sendto() { + // tested in test_stream_socket_recvfrom + return Count(true); +} + +bool TestExtStream::test_stream_socket_shutdown() { + int port = get_random_port(); + string address = "127.0.0.1:" + boost::lexical_cast(port); + Variant server = f_stream_socket_server(address); + VERIFY(f_stream_socket_shutdown(server, 0)); + return Count(true); +} diff --git a/src/test/test_ext_stream.h b/src/test/test_ext_stream.h new file mode 100644 index 0000000000000..68d49015c45df --- /dev/null +++ b/src/test/test_ext_stream.h @@ -0,0 +1,74 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_STREAM_H__ +#define __TEST_EXT_STREAM_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtStream : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_stream_context_create(); + bool test_stream_context_get_default(); + bool test_stream_context_get_options(); + bool test_stream_context_set_option(); + bool test_stream_context_set_param(); + bool test_stream_copy_to_stream(); + bool test_stream_encoding(); + bool test_stream_bucket_append(); + bool test_stream_bucket_prepend(); + bool test_stream_bucket_make_writeable(); + bool test_stream_bucket_new(); + bool test_stream_filter_register(); + bool test_stream_filter_remove(); + bool test_stream_filter_append(); + bool test_stream_filter_prepend(); + bool test_stream_get_contents(); + bool test_stream_get_filters(); + bool test_stream_get_line(); + bool test_stream_get_meta_data(); + bool test_stream_get_transports(); + bool test_stream_get_wrappers(); + bool test_stream_register_wrapper(); + bool test_stream_wrapper_register(); + bool test_stream_wrapper_restore(); + bool test_stream_wrapper_unregister(); + bool test_stream_resolve_include_path(); + bool test_stream_select(); + bool test_stream_set_blocking(); + bool test_stream_set_timeout(); + bool test_stream_set_write_buffer(); + bool test_set_file_buffer(); + bool test_stream_socket_accept(); + bool test_stream_socket_server(); + bool test_stream_socket_client(); + bool test_stream_socket_enable_crypto(); + bool test_stream_socket_get_name(); + bool test_stream_socket_pair(); + bool test_stream_socket_recvfrom(); + bool test_stream_socket_sendto(); + bool test_stream_socket_shutdown(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_STREAM_H__ diff --git a/src/test/test_ext_string.cpp b/src/test/test_ext_string.cpp new file mode 100644 index 0000000000000..e23a5a3126c9f --- /dev/null +++ b/src/test/test_ext_string.cpp @@ -0,0 +1,796 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtString::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_addcslashes); + RUN_TEST(test_stripcslashes); + RUN_TEST(test_addslashes); + RUN_TEST(test_stripslashes); + RUN_TEST(test_bin2hex); + RUN_TEST(test_nl2br); + RUN_TEST(test_quotemeta); + RUN_TEST(test_str_shuffle); + RUN_TEST(test_strrev); + RUN_TEST(test_strtolower); + RUN_TEST(test_strtoupper); + RUN_TEST(test_ucfirst); + RUN_TEST(test_ucwords); + RUN_TEST(test_strip_tags); + RUN_TEST(test_trim); + RUN_TEST(test_ltrim); + RUN_TEST(test_rtrim); + RUN_TEST(test_chop); + RUN_TEST(test_explode); + RUN_TEST(test_implode); + RUN_TEST(test_join); + RUN_TEST(test_str_split); + RUN_TEST(test_chunk_split); + RUN_TEST(test_strtok); + RUN_TEST(test_str_replace); + RUN_TEST(test_str_ireplace); + RUN_TEST(test_substr_replace); + RUN_TEST(test_substr); + RUN_TEST(test_str_pad); + RUN_TEST(test_str_repeat); + RUN_TEST(test_wordwrap); + RUN_TEST(test_html_entity_decode); + RUN_TEST(test_htmlentities); + RUN_TEST(test_htmlspecialchars_decode); + RUN_TEST(test_htmlspecialchars); + RUN_TEST(test_quoted_printable_encode); + RUN_TEST(test_quoted_printable_decode); + RUN_TEST(test_convert_uudecode); + RUN_TEST(test_convert_uuencode); + RUN_TEST(test_str_rot13); + RUN_TEST(test_crc32); + RUN_TEST(test_crypt); + RUN_TEST(test_md5); + RUN_TEST(test_sha1); + RUN_TEST(test_strtr); + RUN_TEST(test_convert_cyr_string); + RUN_TEST(test_get_html_translation_table); + RUN_TEST(test_hebrev); + RUN_TEST(test_hebrevc); + RUN_TEST(test_setlocale); + RUN_TEST(test_localeconv); + RUN_TEST(test_nl_langinfo); + RUN_TEST(test_echo); + RUN_TEST(test_print); + RUN_TEST(test_printf); + RUN_TEST(test_vprintf); + RUN_TEST(test_sprintf); + RUN_TEST(test_vsprintf); + RUN_TEST(test_sscanf); + RUN_TEST(test_chr); + RUN_TEST(test_ord); + RUN_TEST(test_money_format); + RUN_TEST(test_number_format); + RUN_TEST(test_strcmp); + RUN_TEST(test_strncmp); + RUN_TEST(test_strnatcmp); + RUN_TEST(test_strcasecmp); + RUN_TEST(test_strncasecmp); + RUN_TEST(test_strnatcasecmp); + RUN_TEST(test_strcoll); + RUN_TEST(test_substr_compare); + RUN_TEST(test_strchr); + RUN_TEST(test_strrchr); + RUN_TEST(test_strstr); + RUN_TEST(test_stristr); + RUN_TEST(test_strpbrk); + RUN_TEST(test_strpos); + RUN_TEST(test_stripos); + RUN_TEST(test_strrpos); + RUN_TEST(test_strripos); + RUN_TEST(test_substr_count); + RUN_TEST(test_strspn); + RUN_TEST(test_strcspn); + RUN_TEST(test_strlen); + RUN_TEST(test_count_chars); + RUN_TEST(test_str_word_count); + RUN_TEST(test_levenshtein); + RUN_TEST(test_similar_text); + RUN_TEST(test_soundex); + RUN_TEST(test_metaphone); + RUN_TEST(test_parse_str); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtString::test_addcslashes() { + VS(f_addcslashes("ABCDEFGH\n", "A..D\n"), "\\A\\B\\C\\DEFGH\\n"); + VS(f_addcslashes(String("\x00\x0D\n", 3, AttachLiteral), null_string), + "\\000\\r\\n"); + return Count(true); +} + +bool TestExtString::test_stripcslashes() { + VS(f_stripcslashes("\\A\\B\\C\\DEFGH\\n"), "ABCDEFGH\n"); + return Count(true); +} + +bool TestExtString::test_addslashes() { + VS(f_addslashes("'\"\\\n"), "\\'\\\"\\\\\n"); + return Count(true); +} + +bool TestExtString::test_stripslashes() { + VS(f_stripslashes("\\'\\\"\\\\\n"), "'\"\\\n"); + return Count(true); +} + +bool TestExtString::test_bin2hex() { + VS(f_bin2hex("ABC\n"), "4142430a"); + return Count(true); +} + +bool TestExtString::test_nl2br() { + VS(f_nl2br("A\nB"), "A
    \nB"); + return Count(true); +} + +bool TestExtString::test_quotemeta() { + VS(f_quotemeta(". \\ + * ? [ ^ ] ( $ )"), + "\\. \\\\ \\+ \\* \\? \\[ \\^ \\] \\( \\$ \\)"); + return Count(true); +} + +bool TestExtString::test_str_shuffle() { + VERIFY(f_str_shuffle("ABC").size() == 3); + return Count(true); +} + +bool TestExtString::test_strrev() { + VS(f_strrev("ABC"), "CBA"); + return Count(true); +} + +bool TestExtString::test_strtolower() { + VS(f_strtolower("ABC"), "abc"); + return Count(true); +} + +bool TestExtString::test_strtoupper() { + VS(f_strtoupper("abc"), "ABC"); + return Count(true); +} + +bool TestExtString::test_ucfirst() { + VS(f_ucfirst("abc"), "Abc"); + return Count(true); +} + +bool TestExtString::test_ucwords() { + VS(f_ucwords("abc def"), "Abc Def"); + return Count(true); +} + +bool TestExtString::test_strip_tags() { + String text = "

    Test paragraph.

    " + "Other text"; + VS(f_strip_tags(text), "Test paragraph. Other text"); + VS(f_strip_tags(text, "

    "), + "

    Test paragraph.

    Other text"); + return Count(true); +} + +bool TestExtString::test_trim() { + VS(f_trim(" abc "), "abc"); + return Count(true); +} + +bool TestExtString::test_ltrim() { + VS(f_ltrim(" abc "), "abc "); + return Count(true); +} + +bool TestExtString::test_rtrim() { + VS(f_rtrim(" abc "), " abc"); + return Count(true); +} + +bool TestExtString::test_chop() { + VS(f_chop(" abc "), " abc"); + return Count(true); +} + +bool TestExtString::test_explode() { + { + String pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; + Array pieces = f_explode(" ", pizza); + VS(pieces[0], "piece1"); + VS(pieces[1], "piece2"); + } + { + String str = "one|two|three|four"; + Array ret = f_explode("|", str, 2); + VS(ret[0], "one"); + VS(ret[1], "two|three|four"); + } + { + String str = "one|two|three|four"; + Array ret = f_explode("|", str, -1); + VERIFY(ret.size() == 3); + VS(ret[0], "one"); + VS(ret[1], "two"); + VS(ret[2], "three"); + } + { + String str = "ab"; + Array ret = f_explode("b", str); + VS(ret[0], "a"); + VS(ret[1], ""); + } + { + String str = "b"; + Array ret = f_explode("b", str); + VS(ret[0], ""); + VS(ret[1], ""); + } + { + String str = "bb"; + Array ret = f_explode("b", str); + VS(ret[0], ""); + VS(ret[1], ""); + VS(ret[2], ""); + } + { + String str = ""; + Array ret = f_explode("b", str); + VS(ret[0], ""); + } + return Count(true); +} + +bool TestExtString::test_implode() { + { + Array arr = CREATE_VECTOR3("lastname", "email", "phone"); + VS(f_implode(",", arr), "lastname,email,phone"); + } + { + Array arr = CREATE_VECTOR3("lastname", "", "phone"); + VS(f_implode(",", arr), "lastname,,phone"); + } + { + Array arr = CREATE_VECTOR3("", "email", "phone"); + VS(f_implode(",", arr), ",email,phone"); + } + { + Array arr = CREATE_VECTOR3("", "", ""); + VS(f_implode(",", arr), ",,"); + } + { + Array arr = Array::Create(); + VS(f_implode(",", arr), ""); + } + return Count(true); +} + +bool TestExtString::test_join() { + Array arr = CREATE_VECTOR3("lastname", "email", "phone"); + VS(f_join(",", arr), "lastname,email,phone"); + return Count(true); +} + +bool TestExtString::test_str_split() { + String str = "Hello Friend"; + Array arr1 = f_str_split(str); + VERIFY(arr1.size() == str.size()); + VS(arr1[0], "H"); + VS(arr1[1], "e"); + + Array arr2 = f_str_split(str, 3); + VERIFY(arr2.size() == 4); + VS(arr2[0], "Hel"); + VS(arr2[1], "lo "); + return Count(true); +} + +bool TestExtString::test_chunk_split() { + String ret = f_chunk_split("ABCD", 2); + VS(ret, "AB\r\nCD\r\n"); + return Count(true); +} + +bool TestExtString::test_strtok() { + String s = "This is\tan "; + Array tokens; + Variant tok = f_strtok(s, " \n\t"); + while (tok) { + tokens.append(tok); + tok = f_strtok(" \n\t"); + } + VS(tokens, CREATE_VECTOR3("This", "is", "an")); + return Count(true); +} + +bool TestExtString::test_str_replace() { + { + VS(f_str_replace("%body%", "black", ""), + ""); + } + { + Array vowels; + vowels.append("a"); + vowels.append("e"); + vowels.append("i"); + vowels.append("o"); + vowels.append("u"); + vowels.append("A"); + vowels.append("E"); + vowels.append("I"); + vowels.append("O"); + vowels.append("U"); + VS(f_str_replace(vowels, "", "Hello World of PHP"), "Hll Wrld f PHP"); + } + { + String phrase = "You should eat fruits, vegetables, and fiber every day."; + Array healthy = CREATE_VECTOR3("fruits", "vegetables", "fiber"); + Array yummy = CREATE_VECTOR3("pizza", "beer", "ice cream"); + VS(f_str_replace(healthy, yummy, phrase), + "You should eat pizza, beer, and ice cream every day."); + } + { + Variant count; + Variant str = f_str_replace("ll", "", "good golly miss molly!", + ref(count)); + VS(count, 2); + } + { + Array letters = CREATE_VECTOR2("a", "p"); + Array fruit = CREATE_VECTOR2("apple", "pear"); + String text = "a p"; + VS(f_str_replace(letters, fruit, text), "apearpearle pear"); + } + + return Count(true); +} + +bool TestExtString::test_str_ireplace() { + VS(f_str_ireplace("%body%", "black", ""), + ""); + VS(f_str_ireplace("%body%", "Black", ""), + ""); + return Count(true); +} + +bool TestExtString::test_substr_replace() { + String var = "ABCDEFGH:/MNRPQR/"; + VS(f_substr_replace(var, "bob", 0), "bob"); + VS(f_substr_replace(var, "bob", 0, f_strlen(var)), "bob"); + VS(f_substr_replace(var, "bob", 0, 0), "bobABCDEFGH:/MNRPQR/"); + + VS(f_substr_replace(var, "bob", 10, -1), "ABCDEFGH:/bob/"); + VS(f_substr_replace(var, "bob", -7, -1), "ABCDEFGH:/bob/"); + + VS(f_substr_replace(var, "", 10, -1), "ABCDEFGH://"); + return Count(true); +} + +bool TestExtString::test_substr() { + VS(f_substr("abcdef", 1), "bcdef"); + VS(f_substr("abcdef", 1, 3), "bcd"); + VS(f_substr("abcdef", 0, 4), "abcd"); + VS(f_substr("abcdef", 0, 8), "abcdef"); + VS(f_substr("abcdef", -1, 1), "f"); + return Count(true); +} + +bool TestExtString::test_str_pad() { + String input = "Alien"; + VS(f_str_pad(input, 10), "Alien "); + VS(f_str_pad(input, 10, "-=", k_STR_PAD_LEFT), "-=-=-Alien"); + VS(f_str_pad(input, 10, "_", k_STR_PAD_BOTH), "__Alien___"); + VS(f_str_pad(input, 6 , "___"), "Alien_"); + VS(f_str_pad(input, 6 , String("\0", 1, AttachLiteral)), + String("Alien\0", 6, AttachLiteral)); + return Count(true); +} + +bool TestExtString::test_str_repeat() { + VS(f_str_repeat("-=", 10), "-=-=-=-=-=-=-=-=-=-="); + return Count(true); +} + +bool TestExtString::test_wordwrap() { + { + String text = "The quick brown fox jumped over the lazy dog."; + VS(f_wordwrap(text, 20, "
    \n"), + "The quick brown fox
    \njumped over the lazy
    \ndog."); + } + { + String text = "A very long woooooooooooord."; + VS(f_wordwrap(text, 8, "\n", true), "A very\nlong\nwooooooo\nooooord."); + } + return Count(true); +} + +bool TestExtString::test_html_entity_decode() { + String orig = "I'll \"walk\" the dog now"; + String a = f_htmlentities(orig); + VS(a, "I'll "walk" the <b>dog</b> now"); + VS(f_html_entity_decode(a), orig); + return Count(true); +} + +bool TestExtString::test_htmlentities() { + String str = "A 'quote' is bold"; + VS(f_htmlentities(str), "A 'quote' is <b>bold</b>"); + VS(f_htmlentities(str, k_ENT_QUOTES), + "A 'quote' is <b>bold</b>"); + return Count(true); +} + +bool TestExtString::test_htmlspecialchars_decode() { + String str = "

    this -> "

    "; + VS(f_htmlspecialchars_decode(str), "

    this -> \"

    "); + return Count(true); +} + +bool TestExtString::test_htmlspecialchars() { + VS(f_htmlspecialchars("Test", k_ENT_QUOTES), + "<a href='test'>Test</a>"); + return Count(true); +} + +bool TestExtString::test_quoted_printable_encode() { + VS(f_quoted_printable_encode("egfe \015\t"), "egfe=20=0D=09"); + return Count(true); +} + +bool TestExtString::test_quoted_printable_decode() { + VS(f_quoted_printable_decode("=65=67=66=65="), "egfe"); + return Count(true); +} + +bool TestExtString::test_convert_uudecode() { + VS(f_convert_uudecode("+22!L;W9E(%!(4\"$`\n`"), "I love PHP!"); + return Count(true); +} + +bool TestExtString::test_convert_uuencode() { + VS(f_convert_uuencode("test\ntext text\r\n"), + "0=&5S=`IT97AT('1E>'0-\"@``\n`\n"); + return Count(true); +} + +bool TestExtString::test_str_rot13() { + VS(f_str_rot13("PHP 4.3.0"), "CUC 4.3.0"); + return Count(true); +} + +bool TestExtString::test_crc32() { + VS(f_crc32("The quick brown fox jumped over the lazy dog."), 2191738434LL); + return Count(true); +} + +bool TestExtString::test_crypt() { + VERIFY(!f_crypt("mypassword").empty()); + return Count(true); +} + +bool TestExtString::test_md5() { + VS(f_md5("apple"), "1f3870be274f6c49b3e31a0c6728957f"); + return Count(true); +} + +bool TestExtString::test_sha1() { + VS(f_sha1("apple"), "d0be2dc421be4fcd0172e5afceea3970e2f3d940"); + return Count(true); +} + +bool TestExtString::test_strtr() { + Array trans = CREATE_MAP2("hello", "hi", "hi", "hello"); + VS(f_strtr("hi all, I said hello", trans), "hello all, I said hi"); + return Count(true); +} + +bool TestExtString::test_convert_cyr_string() { + VS(f_convert_cyr_string("abc", "a", "d"), "abc"); // sanity + return Count(true); +} + +bool TestExtString::test_get_html_translation_table() { + VERIFY(!f_get_html_translation_table(k_HTML_ENTITIES).empty()); + return Count(true); +} + +bool TestExtString::test_hebrev() { + VS(f_hebrev("test"), "test"); // sanity + return Count(true); +} + +bool TestExtString::test_hebrevc() { + VS(f_hebrevc("test"), "test"); // sanity + return Count(true); +} + +bool TestExtString::test_setlocale() { + VERIFY(!f_setlocale(0, k_LC_ALL, 0).toString().empty()); + return Count(true); +} + +bool TestExtString::test_localeconv() { + VERIFY(!f_localeconv().empty()); + return Count(true); +} + +bool TestExtString::test_nl_langinfo() { +#ifndef MAC_OS_X + VS(f_nl_langinfo(k_AM_STR), "AM"); +#endif + return Count(true); +} + +bool TestExtString::test_echo() { + g_context->obStart(); + f_echo(0, "test"); + String output = g_context->obGetContents(); + g_context->obEnd(); + VS(output, "test"); + return Count(true); +} + +bool TestExtString::test_print() { + g_context->obStart(); + f_print("test"); + String output = g_context->obGetContents(); + g_context->obEnd(); + VS(output, "test"); + return Count(true); +} + +bool TestExtString::test_printf() { + g_context->obStart(); + f_printf(2, "A%sB%dC", CREATE_VECTOR2("test", 10)); + String output = g_context->obGetContents(); + g_context->obEnd(); + VS(output, "AtestB10C"); + return Count(true); +} + +bool TestExtString::test_vprintf() { + g_context->obStart(); + f_vprintf("A%sB%dC", CREATE_VECTOR2("test", 10)); + String output = g_context->obGetContents(); + g_context->obEnd(); + VS(output, "AtestB10C"); + return Count(true); +} + +bool TestExtString::test_sprintf() { + VS(f_sprintf(2, "A%sB%dC", CREATE_VECTOR2("test", 10)), "AtestB10C"); + VS(f_sprintf(2, "%010s", CREATE_VECTOR1("1101")), "0000001101"); + VS(f_sprintf(2, "%02d", CREATE_VECTOR1("09")), "09"); + return Count(true); +} + +bool TestExtString::test_vsprintf() { + VS(f_vsprintf("A%sB%dC", CREATE_VECTOR2("test", 10)), "AtestB10C"); + return Count(true); +} + +bool TestExtString::test_sscanf() { + VS(f_sscanf(0, "SN/2350001", "SN/%d"), CREATE_VECTOR1(2350001)); + + Variant out; + VS(f_sscanf(0, "SN/2350001", "SN/%d", CREATE_VECTOR1(ref(out))), 1); + VS(out, 2350001); + return Count(true); +} + +bool TestExtString::test_chr() { + VS(f_chr(92), "\\"); + return Count(true); +} + +bool TestExtString::test_ord() { + VS(f_ord("\\"), 92); + return Count(true); +} + +bool TestExtString::test_money_format() { + VS(f_money_format("%i", 1234.56), "1234.56"); + return Count(true); +} + +bool TestExtString::test_number_format() { + VS(f_number_format(1234.56), "1,235"); + return Count(true); +} + +bool TestExtString::test_strcmp() { + VERIFY(f_strcmp("a", "b") < 0); + VERIFY(f_strcmp("a", "A") > 0); + return Count(true); +} + +bool TestExtString::test_strncmp() { + VERIFY(f_strncmp("a", "ab", 1) == 0); + return Count(true); +} + +bool TestExtString::test_strnatcmp() { + VERIFY(f_strnatcmp("a", "b") < 0); + return Count(true); +} + +bool TestExtString::test_strcasecmp() { + VERIFY(f_strcasecmp("a", "A") == 0); + return Count(true); +} + +bool TestExtString::test_strncasecmp() { + VERIFY(f_strncasecmp("a", "Ab", 1) == 0); + return Count(true); +} + +bool TestExtString::test_strnatcasecmp() { + VERIFY(f_strnatcasecmp("a", "Ab") < 0); + return Count(true); +} + +bool TestExtString::test_strcoll() { + VERIFY(f_strcoll("a", "b") < 0); + VERIFY(f_strcoll("a", "A") > 0); + return Count(true); +} + +bool TestExtString::test_substr_compare() { + VS(f_substr_compare("abcde", "bc", 1, 2), 0); + VS(f_substr_compare("abcde", "de", -2, 2), 0); + VS(f_substr_compare("abcde", "bcg", 1, 2), 0); + VS(f_substr_compare("abcde", "BC", 1, 2, true), 0); + VS(f_substr_compare("abcde", "bc", 1, 3), 1); + VS(f_substr_compare("abcde", "cd", 1, 2), -1); + return Count(true); +} + +bool TestExtString::test_strchr() { + String email = "name@example.com"; + VS(f_strchr(email, "@"), "@example.com"); + return Count(true); +} + +bool TestExtString::test_strrchr() { + String text = "Line 1\nLine 2\nLine 3"; + VS(f_strrchr(text, 10), "\nLine 3"); + return Count(true); +} + +bool TestExtString::test_strstr() { + String email = "name@example.com"; + VS(f_strstr(email, "@"), "@example.com"); + return Count(true); +} + +bool TestExtString::test_stristr() { + VS(f_stristr("Hello World!", "earth"), false); + VS(f_stristr("APPLE", 97), "APPLE"); + return Count(true); +} + +bool TestExtString::test_strpbrk() { + String text = "This is a Simple text."; + VS(f_strpbrk(text, "mi"), "is is a Simple text."); + VS(f_strpbrk(text, "S"), "Simple text."); + return Count(true); +} + +bool TestExtString::test_strpos() { + VS(f_strpos("abcdef abcdef", "a"), 0); + VS(f_strpos("abcdef abcdef", "a", 1), 7); + VS(f_strpos("abcdef abcdef", "A", 1), false); + VS(f_strpos("abcdef abcdef", "", 0), false); + return Count(true); +} + +bool TestExtString::test_stripos() { + VS(f_stripos("abcdef abcdef", "A", 1), 7); + return Count(true); +} + +bool TestExtString::test_strrpos() { + VS(f_strrpos("abcdef abcdef", "a"), 7); + return Count(true); +} + +bool TestExtString::test_strripos() { + VS(f_strripos("abcdef abcdef", "A"), 7); + return Count(true); +} + +bool TestExtString::test_substr_count() { + String text = "This is a test"; + VS(f_substr_count(text, "is"), 2); + VS(f_substr_count(text, "is", 3), 1); + VS(f_substr_count(text, "is", 3, 3), 0); + VS(f_substr_count("gcdgcdgcd", "gcdgcd"), 1); + return Count(true); +} + +bool TestExtString::test_strspn() { + VS(f_strspn("foo", "o", 1, 2), 2); + return Count(true); +} + +bool TestExtString::test_strcspn() { + VS(f_strcspn("foo", "o", 1, 2), 0); + return Count(true); +} + +bool TestExtString::test_strlen() { + VS(f_strlen("test"), 4); + return Count(true); +} + +bool TestExtString::test_count_chars() { + Array ret = f_count_chars("Two Ts and one F."); + VS(ret[f_ord("T")], 2); + return Count(true); +} + +bool TestExtString::test_str_word_count() { + VS(f_str_word_count("Two Ts and one F."), 5); + return Count(true); +} + +bool TestExtString::test_levenshtein() { + VS(f_levenshtein("carrrot", "carrot"), 1); + return Count(true); +} + +bool TestExtString::test_similar_text() { + VS(f_similar_text("carrrot", "carrot"), 6); + return Count(true); +} + +bool TestExtString::test_soundex() { + VS(f_soundex("carrot"), "C630"); + return Count(true); +} + +bool TestExtString::test_metaphone() { + VS(f_metaphone("carrot"), "KRT"); + return Count(true); +} + +bool TestExtString::test_parse_str() { + { + Variant output; + f_parse_str("first=value&arr[]=foo+bar&arr[]=baz", ref(output)); + VS(output["first"], "value"); + VS(output["arr"][0], "foo bar"); + VS(output["arr"][1], "baz"); + } + { + Variant output; + f_parse_str("a[2][i]=3&a[4][i]=5", ref(output)); + VS(output["a"][2]["i"], "3"); + VS(output["a"][4]["i"], "5"); + } + + return Count(true); +} diff --git a/src/test/test_ext_string.h b/src/test/test_ext_string.h new file mode 100644 index 0000000000000..c8d55fccb4c49 --- /dev/null +++ b/src/test/test_ext_string.h @@ -0,0 +1,125 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_STRING_H__ +#define __TEST_EXT_STRING_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtString : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_addcslashes(); + bool test_stripcslashes(); + bool test_addslashes(); + bool test_stripslashes(); + bool test_bin2hex(); + bool test_nl2br(); + bool test_quotemeta(); + bool test_str_shuffle(); + bool test_strrev(); + bool test_strtolower(); + bool test_strtoupper(); + bool test_ucfirst(); + bool test_ucwords(); + bool test_strip_tags(); + bool test_trim(); + bool test_ltrim(); + bool test_rtrim(); + bool test_chop(); + bool test_explode(); + bool test_implode(); + bool test_join(); + bool test_str_split(); + bool test_chunk_split(); + bool test_strtok(); + bool test_str_replace(); + bool test_str_ireplace(); + bool test_substr_replace(); + bool test_substr(); + bool test_str_pad(); + bool test_str_repeat(); + bool test_wordwrap(); + bool test_html_entity_decode(); + bool test_htmlentities(); + bool test_htmlspecialchars_decode(); + bool test_htmlspecialchars(); + bool test_quoted_printable_encode(); + bool test_quoted_printable_decode(); + bool test_convert_uudecode(); + bool test_convert_uuencode(); + bool test_str_rot13(); + bool test_crc32(); + bool test_crypt(); + bool test_md5(); + bool test_sha1(); + bool test_strtr(); + bool test_convert_cyr_string(); + bool test_get_html_translation_table(); + bool test_hebrev(); + bool test_hebrevc(); + bool test_setlocale(); + bool test_localeconv(); + bool test_nl_langinfo(); + bool test_echo(); + bool test_print(); + bool test_printf(); + bool test_vprintf(); + bool test_sprintf(); + bool test_vsprintf(); + bool test_sscanf(); + bool test_chr(); + bool test_ord(); + bool test_money_format(); + bool test_number_format(); + bool test_strcmp(); + bool test_strncmp(); + bool test_strnatcmp(); + bool test_strcasecmp(); + bool test_strncasecmp(); + bool test_strnatcasecmp(); + bool test_strcoll(); + bool test_substr_compare(); + bool test_strchr(); + bool test_strrchr(); + bool test_strstr(); + bool test_stristr(); + bool test_strpbrk(); + bool test_strpos(); + bool test_stripos(); + bool test_strrpos(); + bool test_strripos(); + bool test_substr_count(); + bool test_strspn(); + bool test_strcspn(); + bool test_strlen(); + bool test_count_chars(); + bool test_str_word_count(); + bool test_levenshtein(); + bool test_similar_text(); + bool test_soundex(); + bool test_metaphone(); + bool test_parse_str(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_STRING_H__ diff --git a/src/test/test_ext_thread.cpp b/src/test/test_ext_thread.cpp new file mode 100644 index 0000000000000..75595685e40d0 --- /dev/null +++ b/src/test/test_ext_thread.cpp @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtThread::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_hphp_service_thread_started); + RUN_TEST(test_hphp_thread_is_warmup_enabled); + RUN_TEST(test_hphp_thread_set_warmup_enabled); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtThread::test_hphp_service_thread_started() { + // need to test with whole server integration + return Count(true); +} + +bool TestExtThread::test_hphp_thread_is_warmup_enabled() { + return Count(true); +} + +bool TestExtThread::test_hphp_thread_set_warmup_enabled() { + return Count(true); +} diff --git a/src/test/test_ext_thread.h b/src/test/test_ext_thread.h new file mode 100644 index 0000000000000..bb77291573fa6 --- /dev/null +++ b/src/test/test_ext_thread.h @@ -0,0 +1,37 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_THREAD_H__ +#define __TEST_EXT_THREAD_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtThread : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_hphp_service_thread_started(); + bool test_hphp_thread_is_warmup_enabled(); + bool test_hphp_thread_set_warmup_enabled(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_THREAD_H__ diff --git a/src/test/test_ext_thrift.cpp b/src/test/test_ext_thrift.cpp new file mode 100644 index 0000000000000..b74d783e7aec0 --- /dev/null +++ b/src/test/test_ext_thrift.cpp @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtThrift::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_thrift_protocol_write_binary); + RUN_TEST(test_thrift_protocol_read_binary); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtThrift::test_thrift_protocol_write_binary() { + //VCB(">>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtThrift : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_thrift_protocol_write_binary(); + bool test_thrift_protocol_read_binary(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_THRIFT_H__ diff --git a/src/test/test_ext_url.cpp b/src/test/test_ext_url.cpp new file mode 100644 index 0000000000000..0b02b3c553636 --- /dev/null +++ b/src/test/test_ext_url.cpp @@ -0,0 +1,168 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtUrl::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_base64_decode); + RUN_TEST(test_base64_encode); + RUN_TEST(test_get_headers); + RUN_TEST(test_get_meta_tags); + RUN_TEST(test_http_build_query); + RUN_TEST(test_parse_url); + RUN_TEST(test_rawurldecode); + RUN_TEST(test_rawurlencode); + RUN_TEST(test_urldecode); + RUN_TEST(test_urlencode); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtUrl::test_base64_decode() { + VS(f_base64_decode("VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=="), + "This is an encoded string"); + VERIFY(same(f_base64_decode("BgAYdjk="), + String("\006\0\030v9", 5, AttachLiteral))); + return Count(true); +} + +bool TestExtUrl::test_base64_encode() { + VS(f_base64_encode("This is an encoded string"), + "VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=="); + VS(f_base64_encode(String("\006\0\030v9", 5, AttachLiteral)), "BgAYdjk="); + return Count(true); +} + +bool TestExtUrl::test_get_headers() { + String url = "http://www.example.com"; + Array ret = f_get_headers(url); + //VS(ret[0], "HTTP/1.1 200 OK"); + VERIFY(ret.size() > 0); + ret = f_get_headers(url, 1); + //VS(ret["Connection"], "close"); + VERIFY(!ret["Connection"].toString().empty()); + return Count(true); +} + +bool TestExtUrl::test_get_meta_tags() { + Array ret = f_get_meta_tags("test/test_get_meta_tags.html"); + VS(ret.size(), 4); + VS(ret["author"], "name"); + VS(ret["keywords"], "php documentation"); + VS(ret["description"], "a php manual"); + VS(ret["geo_position"], "49.33;-86.59"); + return Count(true); +} + +bool TestExtUrl::test_http_build_query() { + { + Array data = CREATE_MAP4("foo", "bar", "baz", "boom", "cow", "milk", + "php", "hypertext processor"); + VS(f_http_build_query(data), + "foo=bar&baz=boom&cow=milk&php=hypertext+processor"); + VS(f_http_build_query(data, "", "&"), + "foo=bar&baz=boom&cow=milk&php=hypertext+processor"); + } + { + Array data = Array(NEW(ArrayElement)("foo"), + NEW(ArrayElement)("bar"), + NEW(ArrayElement)("baz"), + NEW(ArrayElement)("boom"), + NEW(ArrayElement)("cow", "milk"), + NEW(ArrayElement)("php", "hypertext processor"), + NULL); + VS(f_http_build_query(data), + "0=foo&1=bar&2=baz&3=boom&cow=milk&php=hypertext+processor"); + VS(f_http_build_query(data, "myvar_"), + "myvar_0=foo&myvar_1=bar&myvar_2=baz&myvar_3=boom&cow=milk&" + "php=hypertext+processor"); + } + { + Array data = Array + (NEW(ArrayElement)("user", + CREATE_MAP4("name", "Bob Smith", + "age", 47, + "sex", "M", + "dob", "5/12/1956")), + NEW(ArrayElement)("pastimes", + CREATE_VECTOR4("golf", "opera", "poker", "rap")), + NEW(ArrayElement)("children", + CREATE_MAP2("bobby", CREATE_MAP2("age",12,"sex","M"), + "sally", CREATE_MAP2("age", 8,"sex","F")) + ), + NEW(ArrayElement)("CEO"), + NULL); + + VS(f_http_build_query(data, "flags_"), + "user%5Bname%5D=Bob+Smith&user%5Bage%5D=47&user%5Bsex%5D=M&" + "user%5Bdob%5D=5%2F12%2F1956&pastimes%5B0%5D=golf&" + "pastimes%5B1%5D=opera&pastimes%5B2%5D=poker&" + "pastimes%5B3%5D=rap&children%5Bbobby%5D%5Bage%5D=12&" + "children%5Bbobby%5D%5Bsex%5D=M&children%5Bsally%5D%5Bage%5D=8&" + "children%5Bsally%5D%5Bsex%5D=F&flags_0=CEO"); + } + { + Object obj(NEW(c_stdclass)()); + obj->o_set("foo", -1, "bar"); + obj->o_set("baz", -1, "boom"); + VS(f_http_build_query(obj), "foo=bar&baz=boom"); + } + return Count(true); +} + +bool TestExtUrl::test_parse_url() { + String url = "http://username:password@hostname/path?arg=value#anchor"; + VS(f_print_r(f_parse_url(url), true), + "Array\n" + "(\n" + " [scheme] => http\n" + " [host] => hostname\n" + " [user] => username\n" + " [pass] => password\n" + " [path] => /path\n" + " [query] => arg=value\n" + " [fragment] => anchor\n" + ")\n"); + return Count(true); +} + +bool TestExtUrl::test_rawurldecode() { + VS(f_rawurldecode("foo%20bar%40baz"), "foo bar@baz"); + VS(f_rawurldecode("foo+bar%40baz"), "foo+bar@baz"); + return Count(true); +} + +bool TestExtUrl::test_rawurlencode() { + VS(f_rawurlencode("foo bar@baz"), "foo%20bar%40baz"); + return Count(true); +} + +bool TestExtUrl::test_urldecode() { + VS(f_urldecode("foo+bar%40baz"), "foo bar@baz"); + return Count(true); +} + +bool TestExtUrl::test_urlencode() { + VS(f_urlencode("foo bar@baz"), "foo+bar%40baz"); + return Count(true); +} diff --git a/src/test/test_ext_url.h b/src/test/test_ext_url.h new file mode 100644 index 0000000000000..b711c06a88eae --- /dev/null +++ b/src/test/test_ext_url.h @@ -0,0 +1,44 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_URL_H__ +#define __TEST_EXT_URL_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtUrl : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_base64_decode(); + bool test_base64_encode(); + bool test_get_headers(); + bool test_get_meta_tags(); + bool test_http_build_query(); + bool test_parse_url(); + bool test_rawurldecode(); + bool test_rawurlencode(); + bool test_urldecode(); + bool test_urlencode(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_URL_H__ diff --git a/src/test/test_ext_variable.cpp b/src/test/test_ext_variable.cpp new file mode 100644 index 0000000000000..bb18140edd3ab --- /dev/null +++ b/src/test/test_ext_variable.cpp @@ -0,0 +1,369 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtVariable::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_is_bool); + RUN_TEST(test_is_int); + RUN_TEST(test_is_integer); + RUN_TEST(test_is_long); + RUN_TEST(test_is_double); + RUN_TEST(test_is_float); + RUN_TEST(test_is_numeric); + RUN_TEST(test_is_real); + RUN_TEST(test_is_string); + RUN_TEST(test_is_scalar); + RUN_TEST(test_is_array); + RUN_TEST(test_is_object); + RUN_TEST(test_is_resource); + RUN_TEST(test_is_null); + RUN_TEST(test_gettype); + RUN_TEST(test_get_resource_type); + RUN_TEST(test_intval); + RUN_TEST(test_doubleval); + RUN_TEST(test_floatval); + RUN_TEST(test_strval); + RUN_TEST(test_settype); + RUN_TEST(test_print_r); + RUN_TEST(test_var_export); + RUN_TEST(test_var_dump); + RUN_TEST(test_debug_zval_dump); + RUN_TEST(test_serialize); + RUN_TEST(test_unserialize); + RUN_TEST(test_get_defined_vars); + RUN_TEST(test_import_request_variables); + RUN_TEST(test_extract); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtVariable::test_is_bool() { + VERIFY(f_is_bool(true)); + VERIFY(!f_is_bool("test")); + VERIFY(f_is_bool(Variant(true))); + VERIFY(!f_is_bool(Variant("test"))); + return Count(true); +} + +bool TestExtVariable::test_is_int() { + VERIFY(f_is_int(123)); + VERIFY(!f_is_int("123")); + VERIFY(f_is_int(Variant(123))); + VERIFY(!f_is_int(Variant("123"))); + return Count(true); +} + +bool TestExtVariable::test_is_integer() { + VERIFY(f_is_integer(123)); + VERIFY(!f_is_integer("123")); + VERIFY(f_is_integer(Variant(123))); + VERIFY(!f_is_integer(Variant("123"))); + return Count(true); +} + +bool TestExtVariable::test_is_long() { + VERIFY(f_is_long(123)); + VERIFY(!f_is_long("123")); + VERIFY(f_is_long(Variant(123))); + VERIFY(!f_is_long(Variant("123"))); + return Count(true); +} + +bool TestExtVariable::test_is_double() { + VERIFY(f_is_double(123.4)); + VERIFY(!f_is_double("123.4")); + VERIFY(f_is_double(Variant(123.4))); + VERIFY(!f_is_double(Variant("123.4"))); + return Count(true); +} + +bool TestExtVariable::test_is_float() { + VERIFY(f_is_float(123.4)); + VERIFY(!f_is_float("123.4")); + VERIFY(f_is_float(Variant(123.4))); + VERIFY(!f_is_float(Variant("123.4"))); + return Count(true); +} + +bool TestExtVariable::test_is_numeric() { + VERIFY(f_is_numeric(123)); + VERIFY(f_is_numeric("123.4")); + VERIFY(!f_is_numeric("e123.4")); + VERIFY(f_is_numeric(Variant(123))); + VERIFY(f_is_numeric(Variant("123.4"))); + return Count(true); +} + +bool TestExtVariable::test_is_real() { + VERIFY(f_is_real(123.4)); + VERIFY(!f_is_real("123.4")); + VERIFY(f_is_real(Variant(123.4))); + VERIFY(!f_is_real(Variant("123.4"))); + return Count(true); +} + +bool TestExtVariable::test_is_string() { + VERIFY(!f_is_string(123)); + VERIFY(f_is_string("test")); + VERIFY(f_is_string(String("test"))); + VERIFY(f_is_string(Variant("test"))); + return Count(true); +} + +bool TestExtVariable::test_is_scalar() { + VERIFY(f_is_scalar(123)); + VERIFY(f_is_scalar("test")); + VERIFY(!f_is_scalar(null)); + VERIFY(!f_is_scalar(CREATE_VECTOR1(123))); + return Count(true); +} + +bool TestExtVariable::test_is_array() { + VERIFY(!f_is_array(123)); + VERIFY(!f_is_array("test")); + VERIFY(f_is_array(CREATE_VECTOR1(123))); + return Count(true); +} + +bool TestExtVariable::test_is_object() { + VERIFY(!f_is_object(123)); + VERIFY(!f_is_object("test")); + VERIFY(f_is_object(Object())); + return Count(true); +} + +class TestResource : public ResourceData { +public: + // overriding ResourceData + const char *o_getClassName() const { return "TestResource";} +}; + +bool TestExtVariable::test_is_resource() { + VERIFY(!f_is_resource(123)); + VERIFY(!f_is_resource("test")); + VERIFY(f_is_resource(Object(new TestResource()))); + return Count(true); +} + +bool TestExtVariable::test_is_null() { + VERIFY(!f_is_null(0)); + VERIFY(!f_is_null("")); + VERIFY(f_is_null(String())); + VERIFY(f_is_null(Array())); + VERIFY(f_is_null(Object())); + VERIFY(f_is_null(Variant())); + VERIFY(f_is_null(null)); + return Count(true); +} + +bool TestExtVariable::test_gettype() { + VS(f_gettype(null), "NULL"); + VS(f_gettype(0), "integer"); + VS(f_gettype("test"), "string"); + VS(f_gettype(String()), "string"); + VS(f_gettype(Array()), "array"); + VS(f_gettype(Object()), "object"); + return Count(true); +} + +bool TestExtVariable::test_get_resource_type() { + VS(f_get_resource_type(Object(new TestResource())), "TestResource"); + return Count(true); +} + +bool TestExtVariable::test_intval() { + VS(f_intval("12"), 12); + VS(f_intval("12", 8), 10); + return Count(true); +} + +bool TestExtVariable::test_doubleval() { + VS(f_doubleval("12.3"), 12.3); + return Count(true); +} + +bool TestExtVariable::test_floatval() { + VS(f_floatval("12.3"), 12.3); + return Count(true); +} + +bool TestExtVariable::test_strval() { + VS(f_strval(123), "123"); + return Count(true); +} + +bool TestExtVariable::test_settype() { + { + Variant v = "5bar"; + VERIFY(f_settype(ref(v), "integer")); + VS(v, 5); + } + { + Variant v = true; + VERIFY(f_settype(ref(v), "string")); + VS(v, "1"); + } + return Count(true); +} + +bool TestExtVariable::test_print_r() { + Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3)); + VS(f_print_r(v, true), + "Array\n" + "(\n" + " [a] => apple\n" + " [b] => 2\n" + " [c] => Array\n" + " (\n" + " [0] => 1\n" + " [1] => y\n" + " [2] => 3\n" + " )\n" + "\n" + ")\n"); + return Count(true); +} + +bool TestExtVariable::test_var_export() { + Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3)); + VS(f_var_export(v, true), + "array (\n" + " 'a' => 'apple',\n" + " 'b' => 2,\n" + " 'c' => \n" + " array (\n" + " 0 => 1,\n" + " 1 => 'y',\n" + " 2 => 3,\n" + " ),\n" + ")"); + return Count(true); +} + +bool TestExtVariable::test_var_dump() { + Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3)); + g_context->obStart(); + f_var_dump(v); + String output = g_context->obGetContents(); + g_context->obEnd(); + VS(output, + "array(3) {\n" + " [\"a\"]=>\n" + " string(5) \"apple\"\n" + " [\"b\"]=>\n" + " int(2)\n" + " [\"c\"]=>\n" + " array(3) {\n" + " [0]=>\n" + " int(1)\n" + " [1]=>\n" + " string(1) \"y\"\n" + " [2]=>\n" + " int(3)\n" + " }\n" + "}\n"); + return Count(true); +} + +bool TestExtVariable::test_debug_zval_dump() { + Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3)); + g_context->obStart(); + f_debug_zval_dump(v); + String output = g_context->obGetContents(); + g_context->obEnd(); + VS(output, + "array(3) refcount(1){\n" + " [\"a\"]=>\n" + " string(5) \"apple\" refcount(1)\n" + " [\"b\"]=>\n" + " long(2) refcount(1)\n" + " [\"c\"]=>\n" + " array(3) refcount(1){\n" + " [0]=>\n" + " long(1) refcount(1)\n" + " [1]=>\n" + " string(1) \"y\" refcount(1)\n" + " [2]=>\n" + " long(3) refcount(1)\n" + " }\n" + "}\n"); + return Count(true); +} + +bool TestExtVariable::test_serialize() { + Object obj(NEW(c_stdclass)()); + obj->o_set("name", -1, "value"); + VS(f_serialize(obj), "O:8:\"stdClass\":1:{s:4:\"name\";s:5:\"value\";}"); + + Variant v = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3)); + VS(f_serialize(v), + "a:3:{s:1:\"a\";s:5:\"apple\";s:1:\"b\";i:2;s:1:\"c\";a:3:{i:0;i:1;i:1;s:1:\"y\";i:2;i:3;}}"); + return Count(true); +} + +bool TestExtVariable::test_unserialize() { + { + Variant v = f_unserialize("O:8:\"stdClass\":1:{s:4:\"name\";s:5:\"value\";}"); + VERIFY(v.is(KindOfObject)); + Object obj = v.toObject(); + VS(obj->o_getClassName(), "stdClass"); + VS(obj.o_get("name"), "value"); + } + { + Variant v = f_unserialize(String("O:8:\"stdClass\":1:{s:7:\"\0*\0name\";s:5:\"value\";}", 45, AttachLiteral)); + VERIFY(v.is(KindOfObject)); + Object obj = v.toObject(); + VS(obj->o_getClassName(), "stdClass"); + VS(obj.o_get("name"), "value"); + } + { + Variant v1 = CREATE_MAP3("a","apple","b",2,"c",CREATE_VECTOR3(1,"y",3)); + Variant v2 = f_unserialize("a:3:{s:1:\"a\";s:5:\"apple\";s:1:\"b\";i:2;s:1:\"c\";a:3:{i:0;i:1;i:1;s:1:\"y\";i:2;i:3;}}"); + VS(v1, v2); + } + return Count(true); +} + +bool TestExtVariable::test_get_defined_vars() { + try { + f_get_defined_vars(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtVariable::test_import_request_variables() { + try { + f_import_request_variables("G"); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtVariable::test_extract() { + // extract() was extensively tested in TestCodeRun. + return Count(true); +} diff --git a/src/test/test_ext_variable.h b/src/test/test_ext_variable.h new file mode 100644 index 0000000000000..d6d54e927de18 --- /dev/null +++ b/src/test/test_ext_variable.h @@ -0,0 +1,64 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_EXT_VARIABLE_H__ +#define __TEST_EXT_VARIABLE_H__ + +// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtVariable : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_is_bool(); + bool test_is_int(); + bool test_is_integer(); + bool test_is_long(); + bool test_is_double(); + bool test_is_float(); + bool test_is_numeric(); + bool test_is_real(); + bool test_is_string(); + bool test_is_scalar(); + bool test_is_array(); + bool test_is_object(); + bool test_is_resource(); + bool test_is_null(); + bool test_gettype(); + bool test_get_resource_type(); + bool test_intval(); + bool test_doubleval(); + bool test_floatval(); + bool test_strval(); + bool test_settype(); + bool test_print_r(); + bool test_var_export(); + bool test_var_dump(); + bool test_debug_zval_dump(); + bool test_serialize(); + bool test_unserialize(); + bool test_get_defined_vars(); + bool test_import_request_variables(); + bool test_extract(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_VARIABLE_H__ diff --git a/src/test/test_ext_xml.cpp b/src/test/test_ext_xml.cpp new file mode 100644 index 0000000000000..d3debd48e6f73 --- /dev/null +++ b/src/test/test_ext_xml.cpp @@ -0,0 +1,173 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtXml::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_xml_parser_create); + RUN_TEST(test_xml_parser_free); + RUN_TEST(test_xml_parse); + RUN_TEST(test_xml_parse_into_struct); + RUN_TEST(test_xml_parser_create_ns); + RUN_TEST(test_xml_parser_get_option); + RUN_TEST(test_xml_parser_set_option); + RUN_TEST(test_xml_set_character_data_handler); + RUN_TEST(test_xml_set_default_handler); + RUN_TEST(test_xml_set_element_handler); + RUN_TEST(test_xml_set_processing_instruction_handler); + RUN_TEST(test_xml_set_start_namespace_decl_handler); + RUN_TEST(test_xml_set_end_namespace_decl_handler); + RUN_TEST(test_xml_set_unparsed_entity_decl_handler); + RUN_TEST(test_xml_set_external_entity_ref_handler); + RUN_TEST(test_xml_set_notation_decl_handler); + RUN_TEST(test_xml_set_object); + RUN_TEST(test_xml_get_current_byte_index); + RUN_TEST(test_xml_get_current_column_number); + RUN_TEST(test_xml_get_current_line_number); + RUN_TEST(test_xml_get_error_code); + RUN_TEST(test_xml_error_string); + RUN_TEST(test_utf8_decode); + RUN_TEST(test_utf8_encode); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtXml::test_xml_parser_create() { + //VCB(">>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtXml : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_xml_parser_create(); + bool test_xml_parser_free(); + bool test_xml_parse(); + bool test_xml_parse_into_struct(); + bool test_xml_parser_create_ns(); + bool test_xml_parser_get_option(); + bool test_xml_parser_set_option(); + bool test_xml_set_character_data_handler(); + bool test_xml_set_default_handler(); + bool test_xml_set_element_handler(); + bool test_xml_set_processing_instruction_handler(); + bool test_xml_set_start_namespace_decl_handler(); + bool test_xml_set_end_namespace_decl_handler(); + bool test_xml_set_unparsed_entity_decl_handler(); + bool test_xml_set_external_entity_ref_handler(); + bool test_xml_set_notation_decl_handler(); + bool test_xml_set_object(); + bool test_xml_get_current_byte_index(); + bool test_xml_get_current_column_number(); + bool test_xml_get_current_line_number(); + bool test_xml_get_error_code(); + bool test_xml_error_string(); + bool test_utf8_decode(); + bool test_utf8_encode(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_XML_H__ diff --git a/src/test/test_ext_xmlwriter.cpp b/src/test/test_ext_xmlwriter.cpp new file mode 100644 index 0000000000000..ff9bae4512847 --- /dev/null +++ b/src/test/test_ext_xmlwriter.cpp @@ -0,0 +1,291 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtXmlwriter::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_xmlwriter_open_memory); + RUN_TEST(test_xmlwriter_open_uri); + RUN_TEST(test_xmlwriter_set_indent_string); + RUN_TEST(test_xmlwriter_set_indent); + RUN_TEST(test_xmlwriter_start_document); + RUN_TEST(test_xmlwriter_start_element); + RUN_TEST(test_xmlwriter_start_element_ns); + RUN_TEST(test_xmlwriter_write_element_ns); + RUN_TEST(test_xmlwriter_write_element); + RUN_TEST(test_xmlwriter_end_element); + RUN_TEST(test_xmlwriter_full_end_element); + RUN_TEST(test_xmlwriter_start_attribute_ns); + RUN_TEST(test_xmlwriter_start_attribute); + RUN_TEST(test_xmlwriter_write_attribute_ns); + RUN_TEST(test_xmlwriter_write_attribute); + RUN_TEST(test_xmlwriter_end_attribute); + RUN_TEST(test_xmlwriter_start_cdata); + RUN_TEST(test_xmlwriter_write_cdata); + RUN_TEST(test_xmlwriter_end_cdata); + RUN_TEST(test_xmlwriter_start_comment); + RUN_TEST(test_xmlwriter_write_comment); + RUN_TEST(test_xmlwriter_end_comment); + RUN_TEST(test_xmlwriter_end_document); + RUN_TEST(test_xmlwriter_start_pi); + RUN_TEST(test_xmlwriter_write_pi); + RUN_TEST(test_xmlwriter_end_pi); + RUN_TEST(test_xmlwriter_text); + RUN_TEST(test_xmlwriter_write_raw); + RUN_TEST(test_xmlwriter_start_dtd); + RUN_TEST(test_xmlwriter_write_dtd); + RUN_TEST(test_xmlwriter_start_dtd_element); + RUN_TEST(test_xmlwriter_write_dtd_element); + RUN_TEST(test_xmlwriter_end_dtd_element); + RUN_TEST(test_xmlwriter_start_dtd_attlist); + RUN_TEST(test_xmlwriter_write_dtd_attlist); + RUN_TEST(test_xmlwriter_end_dtd_attlist); + RUN_TEST(test_xmlwriter_start_dtd_entity); + RUN_TEST(test_xmlwriter_write_dtd_entity); + RUN_TEST(test_xmlwriter_end_dtd_entity); + RUN_TEST(test_xmlwriter_end_dtd); + RUN_TEST(test_xmlwriter_flush); + RUN_TEST(test_xmlwriter_output_memory); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtXmlwriter::test_xmlwriter_open_memory() { + Variant xml = f_xmlwriter_open_memory(); + VERIFY(f_xmlwriter_set_indent(xml, true)); + VERIFY(f_xmlwriter_set_indent_string(xml, " ")); + VERIFY(f_xmlwriter_start_document(xml, "1.0", "utf-8")); + VERIFY(f_xmlwriter_start_element(xml, "node")); + VERIFY(f_xmlwriter_write_attribute(xml, "name", "value")); + VERIFY(f_xmlwriter_write_element(xml, "subnode", "some text")); + VERIFY(f_xmlwriter_end_element(xml)); + VERIFY(f_xmlwriter_end_document(xml)); + String out = f_xmlwriter_flush(xml); + VS(out, "\n\n some text\n\n"); + return Count(true); +} + +bool TestExtXmlwriter::test_xmlwriter_open_uri() { + //VCB(">>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtXmlwriter : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_xmlwriter_open_memory(); + bool test_xmlwriter_open_uri(); + bool test_xmlwriter_set_indent_string(); + bool test_xmlwriter_set_indent(); + bool test_xmlwriter_start_document(); + bool test_xmlwriter_start_element(); + bool test_xmlwriter_start_element_ns(); + bool test_xmlwriter_write_element_ns(); + bool test_xmlwriter_write_element(); + bool test_xmlwriter_end_element(); + bool test_xmlwriter_full_end_element(); + bool test_xmlwriter_start_attribute_ns(); + bool test_xmlwriter_start_attribute(); + bool test_xmlwriter_write_attribute_ns(); + bool test_xmlwriter_write_attribute(); + bool test_xmlwriter_end_attribute(); + bool test_xmlwriter_start_cdata(); + bool test_xmlwriter_write_cdata(); + bool test_xmlwriter_end_cdata(); + bool test_xmlwriter_start_comment(); + bool test_xmlwriter_write_comment(); + bool test_xmlwriter_end_comment(); + bool test_xmlwriter_end_document(); + bool test_xmlwriter_start_pi(); + bool test_xmlwriter_write_pi(); + bool test_xmlwriter_end_pi(); + bool test_xmlwriter_text(); + bool test_xmlwriter_write_raw(); + bool test_xmlwriter_start_dtd(); + bool test_xmlwriter_write_dtd(); + bool test_xmlwriter_start_dtd_element(); + bool test_xmlwriter_write_dtd_element(); + bool test_xmlwriter_end_dtd_element(); + bool test_xmlwriter_start_dtd_attlist(); + bool test_xmlwriter_write_dtd_attlist(); + bool test_xmlwriter_end_dtd_attlist(); + bool test_xmlwriter_start_dtd_entity(); + bool test_xmlwriter_write_dtd_entity(); + bool test_xmlwriter_end_dtd_entity(); + bool test_xmlwriter_end_dtd(); + bool test_xmlwriter_flush(); + bool test_xmlwriter_output_memory(); + bool test_xmlwriter(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_XMLWRITER_H__ diff --git a/src/test/test_ext_zlib.cpp b/src/test/test_ext_zlib.cpp new file mode 100644 index 0000000000000..1f85a9789c2d3 --- /dev/null +++ b/src/test/test_ext_zlib.cpp @@ -0,0 +1,202 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtZlib::RunTests(const std::string &which) { + bool ret = true; + + RUN_TEST(test_readgzfile); + RUN_TEST(test_gzfile); + RUN_TEST(test_gzcompress); + RUN_TEST(test_gzuncompress); + RUN_TEST(test_gzdeflate); + RUN_TEST(test_gzinflate); + RUN_TEST(test_gzencode); + RUN_TEST(test_gzdecode); + RUN_TEST(test_zlib_get_coding_type); + RUN_TEST(test_gzopen); + RUN_TEST(test_gzclose); + RUN_TEST(test_gzrewind); + RUN_TEST(test_gzeof); + RUN_TEST(test_gzgetc); + RUN_TEST(test_gzgets); + RUN_TEST(test_gzgetss); + RUN_TEST(test_gzread); + RUN_TEST(test_gzpassthru); + RUN_TEST(test_gzseek); + RUN_TEST(test_gztell); + RUN_TEST(test_gzwrite); + RUN_TEST(test_gzputs); + + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestExtZlib::test_readgzfile() { + f_ob_start(); + f_readgzfile("test/test_ext_zlib.gz"); + VS(f_ob_get_clean(), "Testing Ext Zlib\n"); + f_ob_end_clean(); + return Count(true); +} + +bool TestExtZlib::test_gzfile() { + VS(f_gzfile("test/test_ext_zlib.gz"), CREATE_VECTOR1("Testing Ext Zlib\n")); + return Count(true); +} + +bool TestExtZlib::test_gzcompress() { + VS(f_gzuncompress(f_gzcompress("testing gzcompress")), "testing gzcompress"); + return Count(true); +} + +bool TestExtZlib::test_gzuncompress() { + // tested in gzcompress + return Count(true); +} + +bool TestExtZlib::test_gzdeflate() { + VS(f_gzinflate(f_gzdeflate("testing gzdeflate")), "testing gzdeflate"); + return Count(true); +} + +bool TestExtZlib::test_gzinflate() { + // tested in gzdeflate + return Count(true); +} + +bool TestExtZlib::test_gzencode() { + Variant zipped = f_gzencode("testing gzencode"); + Variant f = f_fopen("test/test_ext_zlib.tmp", "w"); + f_fwrite(f, zipped); + f_fclose(f); + + f_ob_start(); + f_readgzfile("test/test_ext_zlib.tmp"); + VS(f_ob_get_clean(), "testing gzencode"); + f_ob_end_clean(); + return Count(true); +} + +bool TestExtZlib::test_gzdecode() { + Variant zipped = f_gzencode("testing gzencode"); + VS(f_gzdecode(zipped), "testing gzencode"); + return Count(true); +} + +bool TestExtZlib::test_zlib_get_coding_type() { + try { + f_zlib_get_coding_type(); + } catch (NotSupportedException e) { + return Count(true); + } + return Count(false); +} + +bool TestExtZlib::test_gzopen() { + Variant f = f_gzopen("test/test_ext_zlib.tmp", "w"); + VERIFY(!same(f, false)); + f_gzputs(f, "testing gzputs\n"); + f_gzwrite(f, "testing gzwrite\n"); + f_gzclose(f); + + f = f_gzopen("test/test_ext_zlib.tmp", "r"); + VS(f_gzread(f, 7), "testing"); + VS(f_gzgetc(f), " "); + VS(f_gzgets(f), "gzputs\n"); + VS(f_gzgetss(f), "testing gzwrite\n"); + VS(f_gztell(f), 44); + VERIFY(f_gzeof(f)); + VERIFY(f_gzrewind(f)); + VS(f_gztell(f), 0); + VERIFY(!f_gzeof(f)); + f_gzseek(f, -7, k_SEEK_END); + VS(f_gzgets(f), "testing gzputs\n"); + f_gzclose(f); + + return Count(true); +} + +bool TestExtZlib::test_gzclose() { + // tested in gzopen + return Count(true); +} + +bool TestExtZlib::test_gzrewind() { + // tested in gzopen + return Count(true); +} + +bool TestExtZlib::test_gzeof() { + // tested in gzopen + return Count(true); +} + +bool TestExtZlib::test_gzgetc() { + // tested in gzopen + return Count(true); +} + +bool TestExtZlib::test_gzgets() { + // tested in gzopen + return Count(true); +} + +bool TestExtZlib::test_gzgetss() { + // tested in gzopen + return Count(true); +} + +bool TestExtZlib::test_gzread() { + // tested in gzopen + return Count(true); +} + +bool TestExtZlib::test_gzpassthru() { + Variant f = f_gzopen("test/test_ext_zlib.gz", "r"); + f_ob_start(); + f_gzpassthru(f); + VS(f_ob_get_clean(), "Testing Ext Zlib\n"); + f_ob_end_clean(); + return Count(true); +} + +bool TestExtZlib::test_gzseek() { + // tested in gzopen + return Count(true); +} + +bool TestExtZlib::test_gztell() { + // tested in gzopen + return Count(true); +} + +bool TestExtZlib::test_gzwrite() { + // tested in gzopen + return Count(true); +} + +bool TestExtZlib::test_gzputs() { + // tested in gzopen + return Count(true); +} diff --git a/src/test/test_ext_zlib.gz b/src/test/test_ext_zlib.gz new file mode 100755 index 0000000000000000000000000000000000000000..7d96877fe4423506287b89de04b4f0620ef6c6d1 GIT binary patch literal 51 zcmb2|=HQ5bu+M{mxg@o?BtEsGB)%#qGl_xQQ&;cg8Sn6dwHkpPr%w7jVq)M~eO6D9 Hfq?-4;Q>>>>> Generated by idl.php. Do NOT modify. <<<<<< + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestExtZlib : public TestCppExt { + public: + virtual bool RunTests(const std::string &which); + + bool test_readgzfile(); + bool test_gzfile(); + bool test_gzcompress(); + bool test_gzuncompress(); + bool test_gzdeflate(); + bool test_gzinflate(); + bool test_gzencode(); + bool test_gzdecode(); + bool test_zlib_get_coding_type(); + bool test_gzopen(); + bool test_gzclose(); + bool test_gzrewind(); + bool test_gzeof(); + bool test_gzgetc(); + bool test_gzgets(); + bool test_gzgetss(); + bool test_gzread(); + bool test_gzpassthru(); + bool test_gzseek(); + bool test_gztell(); + bool test_gzwrite(); + bool test_gzputs(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_EXT_ZLIB_H__ diff --git a/src/test/test_get_meta_tags.html b/src/test/test_get_meta_tags.html new file mode 100644 index 0000000000000..e8e8a4212595c --- /dev/null +++ b/src/test/test_get_meta_tags.html @@ -0,0 +1,19 @@ + + + + + + + + + + + +

    + + + +
    +
    + Last modified: Sat Jun 21 11:00:25 PDT 2008 + diff --git a/src/test/test_hash_file.txt b/src/test/test_hash_file.txt new file mode 100644 index 0000000000000..2542d4955f440 --- /dev/null +++ b/src/test/test_hash_file.txt @@ -0,0 +1 @@ +The quick brown fox jumped over the lazy dog. \ No newline at end of file diff --git a/src/test/test_parser.cpp b/src/test/test_parser.cpp new file mode 100644 index 0000000000000..705fbf1d5d982 --- /dev/null +++ b/src/test/test_parser.cpp @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +bool TestParser::VerifyParser(const char *input, const char *output, + const char *file /* = "" */, + int line /* = 0 */) { + ASSERT(input); + ASSERT(output); + + AnalysisResultPtr ar(new AnalysisResult()); + StatementListPtr tree = Parser::parseString(input, ar); + ostringstream code; + CodeGenerator cg(&code); + tree->outputPHP(cg, ar); + if (code.str() != output) { + printf("%s:%d\nParsing: [%s]\nExpecting %d: [%s]\nGot %d: [%s]\n", + file, line, input, (int)strlen(output), output, + (int)code.str().length(), code.str().c_str()); + return false; + } + return true; +} diff --git a/src/test/test_parser.h b/src/test/test_parser.h new file mode 100644 index 0000000000000..6fc11f8f8c21c --- /dev/null +++ b/src/test/test_parser.h @@ -0,0 +1,38 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_PARSER_H__ +#define __TEST_PARSER_H__ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestParser : public TestBase { + protected: + bool VerifyParser(const char *input, const char *output, + const char *file = "", int line = 0); +}; + +/////////////////////////////////////////////////////////////////////////////// +// macros + +#define V(a,b) \ + if (!Count(VerifyParser(a,b,__FILE__,__LINE__))) return false; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_PARSER_H__ diff --git a/src/test/test_parser_expr.cpp b/src/test/test_parser_expr.cpp new file mode 100644 index 0000000000000..b14c245a4eedb --- /dev/null +++ b/src/test/test_parser_expr.cpp @@ -0,0 +1,371 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +bool TestParserExpr::RunTests(const std::string &which) { + bool ret = true; + RUN_TEST(TestExpressionList); + RUN_TEST(TestAssignmentExpression); + RUN_TEST(TestSimpleVariable); + RUN_TEST(TestDynamicVariable); + RUN_TEST(TestStaticMemberExpression); + RUN_TEST(TestArrayElementExpression); + RUN_TEST(TestStringOffsetExpression); + RUN_TEST(TestDynamicFunctionCall); + RUN_TEST(TestSimpleFunctionCall); + RUN_TEST(TestScalarExpression); + RUN_TEST(TestObjectPropertyExpression); + RUN_TEST(TestObjectMethodExpression); + RUN_TEST(TestListAssignment); + RUN_TEST(TestNewObjectExpression); + RUN_TEST(TestUnaryOpExpression); + RUN_TEST(TestBinaryOpExpression); + RUN_TEST(TestQOpExpression); + RUN_TEST(TestArrayPairExpression); + RUN_TEST(TestClassConstantExpression); + RUN_TEST(TestParameterExpression); + RUN_TEST(TestModifierExpression); + RUN_TEST(TestConstant); + RUN_TEST(TestEncapsListExpression); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestParserExpr::TestExpressionList() { + // TestUnsetStatement + // TestEchoStatement + // TestForStatement + // TestObjectPropertyExpression + // TestListAssignment + // TestUnaryOpExpression - internal_functions - isset_variables + return true; +} + +bool TestParserExpr::TestAssignmentExpression() { + V("c();", "$a = &new $b->c();\n"); + V("c->d();", "$a = &new $b->c->d();\n"); + return true; +} + +bool TestParserExpr::TestSimpleVariable() { + V("c;", "print $b->c;\n"); + V("c;", "print ${b}->c;\n"); + V("c;", "print ${$b}->c;\n"); + V("c;", "print $b[]->c;\n"); + V("c;", "print $b[$a]->c;\n"); + V("c;", "print $b[$a]->c;\n"); + V("c;", "print $b[$a][]->c;\n"); + V("c;", "print $b[$a][$c]->c;\n"); + V("c;", "print $b[$a][$c][$d]->c;\n"); + V("c[];", "print $b[$a][$c][$d]->c[];\n"); + V("c[$e];", "print $b[$a][$c][$d]->c[$e];\n"); + V("c{$e};", "print $b[$a][$c][$d]->c[$e];\n"); + + V("c{$e}->f;", + "print $b[$a][$c][$d]->c[$e]->f;\n"); + + V("c{$e}->f[];", + "print $b[$a][$c][$d]->c[$e]->f[];\n"); + + return true; +} + +bool TestParserExpr::TestObjectMethodExpression() { + V("c();", "echo $b->c();\n"); + V("c();", "echo ${b}->c();\n"); + V("c();", "echo ${$b}->c();\n"); + V("c();", "echo $b[]->c();\n"); + V("c();", "echo $b[$a]->c();\n"); + V("c();", "echo $b[$a]->c();\n"); + V("c();", "echo $b[$a][]->c();\n"); + V("c();", "echo $b[$a][$c]->c();\n"); + V("c();", "echo $b[$a][$c][$d]->c();\n"); + V("c[]();", "echo $b[$a][$c][$d]->c[]();\n"); + V("c[$e]();", "echo $b[$a][$c][$d]->c[$e]();\n"); + V("c{$e}();", "echo $b[$a][$c][$d]->c[$e]();\n"); + + V("c{$e}->f();", + "echo $b[$a][$c][$d]->c[$e]->f();\n"); + + V("c{$e}->f[]();", + "echo $b[$a][$c][$d]->c[$e]->f[]();\n"); + + V("c{$e}($p3,$p4)->f[]($p5,$p6);", + "$b[$a][$c][$d]($p1, $p2)->c[$e]($p3, $p4)->f[]($p5, $p6);\n"); + + return true; +} + +bool TestParserExpr::TestListAssignment() { + V(">= A;", "$a >>= A;\n"); + V("> A;", "$a >> A;\n"); + V(" A;", "$a > A;\n"); + V("= A;", "$a >= A;\n"); + V(" $b);", "array($a => $b);\n"); + V(" $b, $c => $d);", "array($a => $b, $c => $d);\n"); + V(" $b, $c => $d,);", "array($a => $b, $c => $d);\n"); + + V(" &$b);", "array($a => &$b);\n"); + V(" &$b, $c => &$d);", "array($a => &$b, $c => &$d);\n"); + + V(" b);}", + "function a() {\n static $a = array(a => b);\n}\n"); + V(" b, c => d);}", + "function a() {\n static $a = array(a => b, c => d);\n}\n"); + V(" b, c => d,);}", + "function a() {\n static $a = array(a => b, c => d);\n}\n"); + return true; +} + +bool TestParserExpr::TestClassConstantExpression() { + V("\\b$/\";", "'->'.\"\\\\\".'b$/';\n"); + V(" + +/////////////////////////////////////////////////////////////////////////////// + +class TestParserExpr : public TestParser { + public: + virtual bool RunTests(const std::string &which); + + bool TestExpressionList(); + bool TestAssignmentExpression(); + bool TestSimpleVariable(); + bool TestDynamicVariable(); + bool TestStaticMemberExpression(); + bool TestArrayElementExpression(); + bool TestStringOffsetExpression(); + bool TestDynamicFunctionCall(); + bool TestSimpleFunctionCall(); + bool TestScalarExpression(); + bool TestObjectPropertyExpression(); + bool TestObjectMethodExpression(); + bool TestListAssignment(); + bool TestNewObjectExpression(); + bool TestUnaryOpExpression(); + bool TestBinaryOpExpression(); + bool TestQOpExpression(); + bool TestArrayPairExpression(); + bool TestClassConstantExpression(); + bool TestParameterExpression(); + bool TestModifierExpression(); + bool TestConstant(); + bool TestEncapsListExpression(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_PARSER_EXPR_H__ diff --git a/src/test/test_parser_stmt.cpp b/src/test/test_parser_stmt.cpp new file mode 100644 index 0000000000000..add5195207fb9 --- /dev/null +++ b/src/test/test_parser_stmt.cpp @@ -0,0 +1,633 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include + +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +bool TestParserStmt::RunTests(const std::string &which) { + bool ret = true; + RUN_TEST(TestFunctionStatement); + RUN_TEST(TestClassStatement); + RUN_TEST(TestInterfaceStatement); + RUN_TEST(TestClassVariable); + RUN_TEST(TestClassConstant); + RUN_TEST(TestMethodStatement); + RUN_TEST(TestStatementList); + RUN_TEST(TestBlockStatement); + RUN_TEST(TestIfBranchStatement); + RUN_TEST(TestIfStatement); + RUN_TEST(TestWhileStatement); + RUN_TEST(TestDoStatement); + RUN_TEST(TestForStatement); + RUN_TEST(TestSwitchStatement); + RUN_TEST(TestCaseStatement); + RUN_TEST(TestBreakStatement); + RUN_TEST(TestContinueStatement); + RUN_TEST(TestReturnStatement); + RUN_TEST(TestGlobalStatement); + RUN_TEST(TestStaticStatement); + RUN_TEST(TestEchoStatement); + RUN_TEST(TestUnsetStatement); + RUN_TEST(TestExpStatement); + RUN_TEST(TestForEachStatement); + RUN_TEST(TestCatchStatement); + RUN_TEST(TestTryStatement); + RUN_TEST(TestThrowStatement); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestParserStmt::TestFunctionStatement() { + V("hasHphpNote("MasterCopy")) { + return false; + } + } +#endif + + return true; +} + +bool TestParserStmt::TestClassStatement() { + V("1);", + "if (a > 1) {}\n"); + + V("1) {}", + "if (a > 1) {\n}\n"); + + V("1) { return;}", + "if (a > 1) {\n return;\n}\n"); + + V("1) { return; return 2;}", + "if (a > 1) {\n return;\n return 2;\n}\n"); + + V("1); else;", + "if (a > 1) {}\n"); + + V("1); else {}", + "if (a > 1) {}\nelse {\n}\n"); + + V("1); else { return;}", + "if (a > 1) {}\nelse {\n return;\n}\n"); + + V("1); else { return; return 2;}", + "if (a > 1) {}\nelse {\n return;\n return 2;\n}\n"); + + V("1); elseif(b>2);", + "if (a > 1) {}\nelseif (b > 2) {}\n"); + + V("1); elseif(b>2){}", + "if (a > 1) {}\nelseif (b > 2) {\n}\n"); + + V("1); elseif(b>2){ return;}", + "if (a > 1) {}\nelseif (b > 2) {\n return;\n}\n"); + + V("1); elseif(b>2){ return; return 2;}", + "if (a > 1) {}\nelseif (b > 2) {\n return;\n return 2;\n}\n"); + + V("1); elseif(b>2); else {$a=2;}", + "if (a > 1) {}\nelseif (b > 2) {}\nelse {\n $a = 2;\n}\n"); + + V("1); elseif(b>2){} else {$a=2;}", + "if (a > 1) {}\nelseif (b > 2) {\n}\nelse {\n $a = 2;\n}\n"); + + V("1); elseif(b>2){ return;} else{$a=2;}", + "if (a > 1) {}\nelseif (b > 2) {\n return;\n}\nelse {\n $a = 2;\n}\n"); + + V("1); elseif(b>2){ return; return 2;} else{$a=2;}", + "if (a > 1) {}\nelseif (b > 2) {\n return;\n return 2;\n}\nelse {\n $a = 2;\n}\n"); + + // if-endif format + + V("1): endif;", + "if (a > 1) {}\n"); + + V("1):;endif;", + "if (a > 1) {\n}\n"); + + V("1): {} endif;", + "if (a > 1) {\n {\n }\n}\n"); + + V("1): return; endif;", + "if (a > 1) {\n return;\n}\n"); + + V("1): return; return 2; endif;", + "if (a > 1) {\n return;\n return 2;\n}\n"); + + V("1):; else: endif;", + "if (a > 1) {\n}\n"); + + V("1):; else:; endif;", + "if (a > 1) {\n}\nelse {\n}\n"); + + V("1):; else: {} endif;", + "if (a > 1) {\n}\nelse {\n {\n }\n}\n"); + + V("1):; else: return; endif;", + "if (a > 1) {\n}\nelse {\n return;\n}\n"); + + V("1):; else: return; return 2; endif;", + "if (a > 1) {\n}\nelse {\n return;\n return 2;\n}\n"); + + V("1):; elseif(b>2): endif;", + "if (a > 1) {\n}\nelseif (b > 2) {}\n"); + + V("1):; elseif(b>2):; endif;", + "if (a > 1) {\n}\nelseif (b > 2) {\n}\n"); + + V("1):; elseif(b>2):{} endif;", + "if (a > 1) {\n}\nelseif (b > 2) {\n {\n }\n}\n"); + + V("1):; elseif(b>2): return; endif;", + "if (a > 1) {\n}\nelseif (b > 2) {\n return;\n}\n"); + + V("1):; elseif(b>2): return; return 2; endif;", + "if (a > 1) {\n}\nelseif (b > 2) {\n return;\n return 2;\n}\n"); + + V("1):; elseif(b>2):; else: $a=2; endif;", + "if (a > 1) {\n}\nelseif (b > 2) {\n}\nelse {\n $a = 2;\n}\n"); + + V("1):; elseif(b>2):{} else: $a=2; endif;", + "if (a > 1) {\n}\nelseif (b > 2) {\n {\n }\n}\nelse {\n $a = 2;\n}\n"); + + V("1):; elseif(b>2): return; else:$a=2; endif;", + "if (a > 1) {\n}\nelseif (b > 2) {\n return;\n}\nelse {\n $a = 2;\n}\n"); + + V("1):; elseif(b>2): return; return 2; else:$a=2; endif;", + "if (a > 1) {\n}\nelseif (b > 2) {\n return;\n return 2;\n}\nelse {\n $a = 2;\n}\n"); + + return true; +} + +bool TestParserStmt::TestWhileStatement() { + V(" $c) ;", + "foreach ($a + $b as $b => $c) {}\n"); + + V(" &$c) ;", + "foreach ($a + $b as $b => &$c) {}\n"); + + V(" &$c) : $a = 1; $b = 2; endforeach;", + "foreach ($a + $b as $b => &$c) {\n $a = 1;\n $b = 2;\n}\n"); + + V(" &$b) ;", + "foreach ($a as $name => &$b) {}\n"); + + V(" $b) ;", + "foreach ($a as $name => $b) {}\n"); + + return true; +} + +bool TestParserStmt::TestCatchStatement() { + V(" + +/////////////////////////////////////////////////////////////////////////////// + +class TestParserStmt : public TestParser { + public: + virtual bool RunTests(const std::string &which); + + bool TestFunctionStatement(); + bool TestClassStatement(); + bool TestInterfaceStatement(); + bool TestClassVariable(); + bool TestClassConstant(); + bool TestMethodStatement(); + bool TestStatementList(); + bool TestBlockStatement(); + bool TestIfBranchStatement(); + bool TestIfStatement(); + bool TestWhileStatement(); + bool TestDoStatement(); + bool TestForStatement(); + bool TestSwitchStatement(); + bool TestCaseStatement(); + bool TestBreakStatement(); + bool TestContinueStatement(); + bool TestReturnStatement(); + bool TestGlobalStatement(); + bool TestStaticStatement(); + bool TestEchoStatement(); + bool TestUnsetStatement(); + bool TestExpStatement(); + bool TestForEachStatement(); + bool TestCatchStatement(); + bool TestTryStatement(); + bool TestThrowStatement(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_PARSER_STMT_H__ diff --git a/src/test/test_pcntl_exec.sh b/src/test/test_pcntl_exec.sh new file mode 100755 index 0000000000000..b8d9af0e585bb --- /dev/null +++ b/src/test/test_pcntl_exec.sh @@ -0,0 +1,10 @@ +#!/bin/sh +if [ $name != "value" ]; then + echo "======================================" + echo "TestExtProcess::test_pcntl_exec FAILED" + echo "======================================" +else + echo "=========================================" + echo "TestExtProcess::test_pcntl_exec SUCCEEDED" + echo "=========================================" +fi diff --git a/src/test/test_performance.cpp b/src/test/test_performance.cpp new file mode 100644 index 0000000000000..1949b58be0106 --- /dev/null +++ b/src/test/test_performance.cpp @@ -0,0 +1,190 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include + +using namespace std; + +#define PERF_LOOP_COUNT "500" + +#define PERF_START \ + " 'ok');\n" + "for ($i = 0; $i < " PERF_LOOP_COUNT "; $i++) { $b = $a['test'];}" + "\n\n/* Taking an array element with string index */" + PERF_END); + + VCR(PERF_START + "$a = array();\n" + "for ($i = 0; $i < " PERF_LOOP_COUNT "; $i++) { $a[i] = 5;}" + "\n\n/* Array element assignment */" + PERF_END); + + VCR(PERF_START + "$a = array();\n" + "for ($i = 0; $i < " PERF_LOOP_COUNT "; $i++) { $a[] = 5;}" + "\n\n/* Array element appending */" + PERF_END); + + VCR(PERF_START + "class A { public $a = 'test'; }; $obj = new A();\n" + "for ($i = 0; $i < " PERF_LOOP_COUNT "; $i++) { $b = $obj->a;}" + "\n\n/* Taking an object's property */" + PERF_END); + + return true; +} + +bool TestPerformance::TestMemoryUsage() { + VCR(PERF_START + "$a = array();\n" + "for ($i = 0; $i < 3000000; $i++) { $a[] = 'test';} sleep(5);" + PERF_END); + return true; +} + +bool TestPerformance::TestAdHocFile() { + string input; + FILE *f = fopen("test/perf_ad_hoc.php", "r"); + if (f) { + char buf[1024]; + for (int len = fread(buf, 1, sizeof(buf), f); len; + len = fread(buf, 1, sizeof(buf), f)) { + input.append(buf, len); + } + fclose(f); + } + + Util::replaceAll(input, "PERF_START", "?>" PERF_START); + Util::replaceAll(input, "PERF_END", PERF_END); + + VCR(input.c_str()); + + return true; +} + +bool TestPerformance::TestAdHoc() { + VCR(PERF_START + "for ($j = 0; $j < 100; $j++) {" + "for ($i = 0; $i < " PERF_LOOP_COUNT "; $i++) {}} $k = $i;" + "\n\n/* Baseline - finding loop cost */" + PERF_END); + + VCR(PERF_START + "for ($j = 0; $j < 1000; $j++) {" + "$a = null; $a = array(1, 2, 3, 4, 5, array(1,2,3,4));" + "for ($i = 0; $i < " PERF_LOOP_COUNT "; $i++) {" + + // add PHP code here + "$a['test'.$i] = $i;" + + "}" + "}" + "\n\n/* my ad hoc test */" + PERF_END); + + return true; +} diff --git a/src/test/test_performance.h b/src/test/test_performance.h new file mode 100644 index 0000000000000..575ee293b017c --- /dev/null +++ b/src/test/test_performance.h @@ -0,0 +1,41 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_PERFORMANCE_H__ +#define __TEST_PERFORMANCE_H__ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Testing execution performance. + */ +class TestPerformance : public TestCodeRun { + public: + TestPerformance(); + + virtual bool RunTests(const std::string &which); + + bool TestBasicOperations(); + bool TestMemoryUsage(); + bool TestAdHocFile(); + bool TestAdHoc(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_PERFORMANCE_H__ diff --git a/src/test/test_private.pem b/src/test/test_private.pem new file mode 100644 index 0000000000000..239ad66f99038 --- /dev/null +++ b/src/test/test_private.pem @@ -0,0 +1,9 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIBPAIBAAJBAL7+aty3S1iBA/+yxjxv4q1MUTd1kjNwL4lYKbpzzlmC5beaQXeQ +2RmGMTXU+mDvuqItjVHOK3DvPK7lTcSGftUCAwEAAQJBALjkK+jc2+iihI98riEF +oudmkNziSRTYjnwjx8mCoAjPWviB3c742eO3FG4/soi1jD9A5alihEOXfUzloenr +8IECIQD3B5+0l+68BA/6d76iUNqAAV8djGTzvxnCxycnxPQydQIhAMXt4trUI3nc +a+U8YL2HPFA3gmhBsSICbq2OptOCnM7hAiEA6Xi3JIQECob8YwkRj29DU3/4WYD7 +WLPgsQpwo1GuSpECICGsnWH5oaeD9t9jbFoSfhJvv0IZmxdcLpRcpslpeWBBAiEA +6/5B8J0GHdJq89FHwEG/H2eVVUYu5y/aD6sgcm+0Avg= +-----END RSA PRIVATE KEY----- diff --git a/src/test/test_public.pem b/src/test/test_public.pem new file mode 100644 index 0000000000000..7a55b5463ef34 --- /dev/null +++ b/src/test/test_public.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIID9zCCA2CgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBtDELMAkGA1UEBhMCTlox +EzARBgNVBAcTCldlbGxpbmd0b24xPDA6BgNVBAoTM1JlYWxseSBJcnJlc3BvbnNp +YmxlIEF1dGhvcmlzYXRpb24gQXV0aG9yaXR5IChSSUFBKTEWMBQGA1UECxMNQ2Vy +dC1zdGFtcGluZzEZMBcGA1UEAxMQSmFja292IGFsLVRyYWRlczEfMB0GCSqGSIb3 +DQEJARYQbm9uZUBmYWtlLmRvbWFpbjAeFw0wMjAxMTYwNTA5NTlaFw0xMjAxMTQw +NTA5NTlaMIG0MQswCQYDVQQGEwJOWjETMBEGA1UEBxMKV2VsbGluZ3RvbjE8MDoG +A1UEChMzUmVhbGx5IElycmVzcG9uc2libGUgQXV0aG9yaXNhdGlvbiBBdXRob3Jp +dHkgKFJJQUEpMRYwFAYDVQQLEw1DZXJ0LXN0YW1waW5nMRkwFwYDVQQDExBKYWNr +b3YgYWwtVHJhZGVzMR8wHQYJKoZIhvcNAQkBFhBub25lQGZha2UuZG9tYWluMIGf +MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7QdDfFIrJn3X24hKmpkyk3TG0Ivxd +K2wWmDPXq1wjr8lUTwrA6hM5Ba9N36jLieWpXhviLOWu9DBza5GmtgCuXloATKTC +94xOdKHlciTVujG3wDlLDB5e710Kar84nnj6VueL1RyZ0bmP5PANa4mbGW9Tqc7J +CkBTTW2y9d0SgQIDAQABo4IBFTCCAREwHQYDVR0OBBYEFEn7RXISxMzhRaHTCJ6V +xCxtVT8XMIHhBgNVHSMEgdkwgdaAFEn7RXISxMzhRaHTCJ6VxCxtVT8XoYG6pIG3 +MIG0MQswCQYDVQQGEwJOWjETMBEGA1UEBxMKV2VsbGluZ3RvbjE8MDoGA1UEChMz +UmVhbGx5IElycmVzcG9uc2libGUgQXV0aG9yaXNhdGlvbiBBdXRob3JpdHkgKFJJ +QUEpMRYwFAYDVQQLEw1DZXJ0LXN0YW1waW5nMRkwFwYDVQQDExBKYWNrb3YgYWwt +VHJhZGVzMR8wHQYJKoZIhvcNAQkBFhBub25lQGZha2UuZG9tYWluggEAMAwGA1Ud +EwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAYQo95V/NY+eKxYxkhibZiUQygph+ +gTfgbDG20MsnH6+8//w5ArHauFCgDrf0P2VyACgq+N4pBTWFGaAaLwbjKy9HCe2E +j9C91tO1CqDS4MJkDB5AP13FTkK6fP1ZCiTQranOAp3DlGWTTWsFVyW5kVfQ9diS +ZOyJZ9Fit5XM2X0= +-----END CERTIFICATE----- diff --git a/src/test/test_server.cpp b/src/test/test_server.cpp new file mode 100644 index 0000000000000..5c6abfc181c76 --- /dev/null +++ b/src/test/test_server.cpp @@ -0,0 +1,509 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace boost; +using namespace HPHP; + +/////////////////////////////////////////////////////////////////////////////// + +TestServer::TestServer() { +} + +bool TestServer::VerifyServerResponse(const char *input, const char *output, + const char *url, const char *method, + const char *header, const char *postdata, + bool responseHeader, + const char *file /* = "" */, + int line /* = 0 */) { + ASSERT(input); + + if (!CleanUp()) return false; + if (Option::EnableEval < Option::FullEval) { + if (!GenerateFiles(input) || + !CompileFiles(input, file, line)) { + return false; + } + } else { + string fullPath = "/unittest/rootdoc/string"; + ofstream f(fullPath.c_str()); + if (!f) { + printf("Unable to open %s for write. Run this test from src/.\n", + fullPath.c_str()); + return false; + } + + f << input; + f.close(); + } + + AsyncFunc func(this, &TestServer::RunServer); + func.start(); + + String server = "http://"; + server += f_php_uname("n"); + server += ":8080/"; + server += url; + string actual, err; + for (int i = 0; i < 10; i++) { + Variant c = f_curl_init(); + f_curl_setopt(c, k_CURLOPT_URL, server); + f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true); + if (postdata) { + f_curl_setopt(c, k_CURLOPT_POSTFIELDS, postdata); + f_curl_setopt(c, k_CURLOPT_POST, true); + } + if (header) { + f_curl_setopt(c, k_CURLOPT_HTTPHEADER, CREATE_VECTOR1(header)); + } + if (responseHeader) { + f_curl_setopt(c, k_CURLOPT_HEADER, 1); + } + + Variant res = f_curl_exec(c); + if (!same(res, false)) { + actual = res.toString(); + break; + } + sleep(1); // wait until HTTP server is up and running + } + + AsyncFunc(this, &TestServer::StopServer).run(); + func.waitForEnd(); + + bool passed = (actual == output); + if (responseHeader) { + passed = (actual.find(output) != string::npos); + } + + if (!passed) { + printf("%s:%d\nParsing: [%s]\nBet %d:\n" + "--------------------------------------\n" + "%s" + "--------------------------------------\n" + "Got %d:\n" + "--------------------------------------\n" + "%s" + "--------------------------------------\n", + file, line, input, (int)strlen(output), output, + (int)actual.length(), actual.c_str()); + return false; + } + return true; +} + +void TestServer::RunServer() { + string out, err; + if (Option::EnableEval < Option::FullEval) { + const char *argv[] = {"", "--mode=server", + "--config=test/config-server.hdf", NULL}; + Process::Exec("cpp/tmp/test", argv, NULL, out, &err); + } else { + const char *argv[] = {"", "--file=/unittest/rootdoc/string", "--mode=server", + "--config=test/config-eval.hdf", NULL}; + Process::Exec("hphpi/hphpi", argv, NULL, out, &err); + } +} + +void TestServer::StopServer() { + for (int i = 0; i < 10; i++) { + string out, err; + Variant c = f_curl_init(); + String url = "http://"; + url += f_php_uname("n"); + url += ":8088/stop"; + f_curl_setopt(c, k_CURLOPT_URL, url); + f_curl_setopt(c, k_CURLOPT_RETURNTRANSFER, true); + Variant res = f_curl_exec(c); + if (!same(res, false)) { + break; + } + sleep(1); // wait until HTTP server is up and running + } +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestServer::RunTests(const std::string &which) { + bool ret = true; + + Logger::LogLevel = Logger::LogError; // so to suppress timer output + + RUN_TEST(TestSanity); + RUN_TEST(TestServerVariables); + RUN_TEST(TestGet); + RUN_TEST(TestPost); + RUN_TEST(TestCookie); + RUN_TEST(TestResponseHeader); + RUN_TEST(TestSetCookie); + RUN_TEST(TestRequestHandling); + //RUN_TEST(TestLibeventServer); + RUN_TEST(TestHttpClient); + + Logger::LogLevel = Logger::LogInfo; + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestServer::TestSanity() { + VSR("\n" + " string(3) \"foo\"\n" + " [2]=>\n" + " string(3) \"bar\"\n" + "}\n", + "string?names[1]=foo&names[2]=bar"); + + VSGET("\n" + " string(3) \"foo\"\n" + " [1]=>\n" + " string(3) \"bar\"\n" + "}\n", + "string?names[]=foo&names[]=bar"); + + VSGET("\n" + " string(22) \"Set-Cookie: name=value\"\n" + "}\n"); + + VSRES("\n" + " string(22) \"Set-Cookie: name=value\"\n" + "}\n"); + return true; + + VSRES(" TestTransportPtr; +typedef std::vector TestTransportPtrVec; +typedef AsyncFunc TestTransportAsyncFunc; +typedef boost::shared_ptr TestTransportAsyncFuncPtr; +typedef std::vector TestTransportAsyncFuncPtrVec; + +#define TEST_SIZE 100 + +/** + * Start processing TEST_SIZE number of requests at the same time with + * that many threads. This is mainly testing global variables to make sure + * all handling are thread-safe. + */ +bool TestServer::TestRequestHandling() { + RuntimeOption::AllowedFiles.insert("/string"); + TestTransportPtrVec transports(TEST_SIZE); + TestTransportAsyncFuncPtrVec funcs(TEST_SIZE); + for (unsigned int i = 0; i < TEST_SIZE; i++) { + TestTransport *transport = new TestTransport(); + transports[i] = TestTransportPtr(transport); + funcs[i] = TestTransportAsyncFuncPtr + (new TestTransportAsyncFunc(transport, &TestTransport::process)); + } + + for (unsigned int i = 0; i < TEST_SIZE; i++) { + funcs[i]->start(); + } + for (unsigned int i = 0; i < TEST_SIZE; i++) { + funcs[i]->waitForEnd(); + } + for (unsigned int i = 0; i < TEST_SIZE; i++) { + VS(transports[i]->m_code, 200); + VS(String(transports[i]->m_response), "Hello, world!"); + } + return Count(true); +} + +class TestRequestHandler : public RequestHandler { +public: + // implementing RequestHandler + virtual void handleRequest(Transport *transport) { + // do nothing + } +}; + +bool TestServer::TestLibeventServer() { + ServerPtr server(new TypedServer + ("127.0.0.1", 8080, 50)); + server->start(); + server->waitForEnd(); + return Count(true); +} + +/////////////////////////////////////////////////////////////////////////////// + +class EchoHandler : public RequestHandler { +public: + // implementing RequestHandler + virtual void handleRequest(Transport *transport) { + HeaderMap headers; + transport->getHeaders(headers); + + string response; + response = "\nGET param: name = "; + response += transport->getParam("name"); + + if (transport->getMethod() == Transport::POST) { + int size = 0; + const char *data = (const char *)transport->getPostData(size); + response += "\nPOST data: "; + response += string(data, size); + } + + for (HeaderMap::const_iterator iter = headers.begin(); + iter != headers.end(); ++iter) { + response += "\nHeader: "; + response += iter->first; + for (unsigned int i = 0; i < iter->second.size(); i++) { + response += "\n"; + response += lexical_cast(i); + response += ": "; + response += iter->second[i]; + } + } + + transport->addHeader("Custom", "blah"); + transport->sendString(response); + } +}; + +bool TestServer::TestHttpClient() { + ServerPtr server(new TypedServer + ("127.0.0.1", 8080, 50)); + server->start(); + + HeaderMap headers; + headers["Cookie"].push_back("c1=v1;c2=v2;"); + headers["Cookie"].push_back("c3=v3;c4=v4;"); + string url = "http://127.0.0.1:8080/echo?name=value"; + + for (int i = 0; i < 10; i++) { + HttpClient http; + StringBuffer response; + vector responseHeaders; + int code = http.get(url.c_str(), response, &headers, &responseHeaders); + VS(code, 200); + VS(response.data(), + "\nGET param: name = value" + "\nHeader: Accept" + "\n0: */*" + "\nHeader: Cookie" + "\n0: c1=v1;c2=v2;" + "\n1: c3=v3;c4=v4;" + "\nHeader: Host" + "\n0: 127.0.0.1:8080"); + + bool found = false; + for (unsigned int i = 0; i < responseHeaders.size(); i++) { + if (responseHeaders[i] == "Custom: blah") { + found = true; + } + } + VERIFY(found); + } + for (int i = 0; i < 10; i++) { + HttpClient http; + StringBuffer response; + vector responseHeaders; + int code = http.post(url.c_str(), "postdata", 8, response, &headers, + &responseHeaders); + VS(code, 200); + VS(response.data(), + "\nGET param: name = value" + "\nPOST data: postdata" + "\nHeader: Accept" + "\n0: */*" + "\nHeader: Content-Length" + "\n0: 8" + "\nHeader: Content-Type" + "\n0: application/x-www-form-urlencoded" + "\nHeader: Cookie" + "\n0: c1=v1;c2=v2;" + "\n1: c3=v3;c4=v4;" + "\nHeader: Host" + "\n0: 127.0.0.1:8080"); + + bool found = false; + for (unsigned int i = 0; i < responseHeaders.size(); i++) { + if (responseHeaders[i] == "Custom: blah") { + found = true; + } + } + VERIFY(found); + } + + server->stop(); + server->waitForEnd(); + return Count(true); +} diff --git a/src/test/test_server.h b/src/test/test_server.h new file mode 100644 index 0000000000000..be3cab780d365 --- /dev/null +++ b/src/test/test_server.h @@ -0,0 +1,94 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_SERVER_H__ +#define __TEST_SERVER_H__ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Testing HTTP server. + */ +class TestServer : public TestCodeRun { +public: + TestServer(); + + virtual bool RunTests(const std::string &which); + + // test test harness + bool TestSanity(); + + // test $_ variables + bool TestServerVariables(); + bool TestGet(); + bool TestPost(); + bool TestCookie(); + + // test transport related extension functions + bool TestResponseHeader(); + bool TestSetCookie(); + + // test multithreaded request processing + bool TestRequestHandling(); + bool TestLibeventServer(); + + // test HttpClient class that proxy server uses + bool TestHttpClient(); + +protected: + void RunServer(); + void StopServer(); + bool VerifyServerResponse(const char *input, const char *output, + const char *url, const char *method, + const char *header, const char *postdata, + bool responseHeader, + const char *file = "", int line = 0); +}; + +/////////////////////////////////////////////////////////////////////////////// +// macros + +#define VSR(input, output) \ + if (!Count(VerifyServerResponse(input, output, "string", "GET", NULL, \ + NULL, false, __FILE__,__LINE__))) \ + return false; + +#define VSRES(input, output) \ + if (!Count(VerifyServerResponse(input, output, "string", "GET", NULL, \ + NULL, true, __FILE__,__LINE__))) \ + return false; + +#define VSGET(input, output, url) \ + if (!Count(VerifyServerResponse(input, output, url, "GET", NULL, \ + NULL, false, __FILE__,__LINE__))) \ + return false; + +#define VSPOST(input, output, url, postdata) \ + if (!Count(VerifyServerResponse(input, output, url, "POST", NULL, \ + postdata, false, __FILE__,__LINE__))) \ + return false; + +#define VSRX(input, output, url, method, header, postdata) \ + if (!Count(VerifyServerResponse(input, output, url, method, header, \ + postdata, false, __FILE__,__LINE__))) \ + return false; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_SERVER_H__ diff --git a/src/test/test_trans_expr.cpp b/src/test/test_trans_expr.cpp new file mode 100644 index 0000000000000..3206cde326e67 --- /dev/null +++ b/src/test/test_trans_expr.cpp @@ -0,0 +1,1139 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +TestTransformerExpr::TestTransformerExpr() { + m_verbose = false; +} + +bool TestTransformerExpr::RunTests(const std::string &which) { + bool ret = true; + RUN_TEST(TestExpressionList); + RUN_TEST(TestAssignmentExpression); + RUN_TEST(TestSimpleVariable); + RUN_TEST(TestDynamicVariable); + RUN_TEST(TestStaticMemberExpression); + RUN_TEST(TestArrayElementExpression); + RUN_TEST(TestStringOffsetExpression); + RUN_TEST(TestDynamicFunctionCall); + RUN_TEST(TestSimpleFunctionCall); + RUN_TEST(TestScalarExpression); + RUN_TEST(TestObjectPropertyExpression); + RUN_TEST(TestObjectMethodExpression); + RUN_TEST(TestListAssignment); + RUN_TEST(TestNewObjectExpression); + RUN_TEST(TestUnaryOpExpression); + RUN_TEST(TestBinaryOpExpression); + RUN_TEST(TestQOpExpression); + RUN_TEST(TestArrayPairExpression); + RUN_TEST(TestClassConstantExpression); + RUN_TEST(TestParameterExpression); + RUN_TEST(TestModifierExpression); + RUN_TEST(TestConstant); + RUN_TEST(TestEncapsListExpression); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestTransformerExpr::TestExpressionList() { + // TestUnsetStatement + // TestEchoStatement + // TestForStatement + // TestObjectPropertyExpression + // TestListAssignment + // TestUnaryOpExpression - internal_functions - isset_variables + return true; +} + +bool TestTransformerExpr::TestAssignmentExpression() { + VT("create());\n"); + VT("get(toString(gv_b)))), Array());\n"); + VT("c();", + "Variant gv_b;\n" + "Variant gv_a;\n" + "\n" + "gv_a = create_object((toString(toObject(gv_b).o_get(\"c\", 0x000000000002B608LL))), Array());\n"); + VT("c->d();", + "Variant gv_b;\n" + "Variant gv_a;\n" + "\n" + "gv_a = create_object((toString(toObject(toObject(gv_b).o_get(\"c\", 0x000000000002B608LL)).o_get(\"d\", 0x000000000002B609LL))), Array());\n"); + return true; +} + +bool TestTransformerExpr::TestSimpleVariable() { + VT("get(toString(gv_a));\n"); + return true; + + VT("get(toString(gv_a + gv_b));\n"); + VT("get(toString(gv_a));\n"); + VT("get(toString(gv_a));\n"); + VT("get(toString(variables->get(toString(gv_a))));\n"); + return true; +} + +bool TestTransformerExpr::TestStaticMemberExpression() { + VT("c;", + "Variant gv_b;\n" + "\n" + "class c_test : public ObjectData {\n" + " void c_test::init();\n" + " public: Variant m_c;\n" + "};\n" + "c_test::c_test() {\n" + "}\n" + "void c_test::init() {\n" + "}\n" + "gv_b = p_test(p_test(new c_test())->create());\n" + "print(toString(toObject(gv_b).o_get(\"c\", 0x000000000002B608LL)));\n" + ); + + VT("c;", + "Variant gv_b;\n" + "\n" + "print(toString(toObject(gv_b).o_get(\"c\", 0x000000000002B608LL)));\n"); + VT("c;", + "const String k_b = \"b\";\n" + "\n" + "print(toString(toObject(variables->get(k_b)).o_get(\"c\", 0x000000000002B608LL)));\n"); + VT("c;", + "Variant gv_b;\n" + "\n" + "print(toString(toObject(variables->get(toString(gv_b))).o_get(\"c\", 0x000000000002B608LL)));\n"); + VT("c;", + "Variant gv_b;\n" + "\n" + "print(toString(toObject(((Variant)toArray(gv_b).lvalAt())).o_get(\"c\", 0x000000000002B608LL)));\n"); + VT("c;", + "Variant gv_b;\n" + "Variant gv_a;\n" + "\n" + "print(toString(toObject(((Variant)gv_b.rvalAt(gv_a))).o_get(\"c\", 0x000000000002B608LL)));\n"); + VT("c;", + "Variant gv_b;\n" + "Variant gv_a;\n" + "\n" + "print(toString(toObject(((Variant)gv_b.rvalAt(gv_a))).o_get(\"c\", 0x000000000002B608LL)));\n"); + VT("c;", + "Variant gv_b;\n" + "Variant gv_a;\n" + "\n" + "print(toString(toObject(((Variant)toArray(((Variant)gv_b.rvalAt(gv_a))).lvalAt())).o_get(\"c\", 0x000000000002B608LL)));\n"); + VT("c;", + "Variant gv_b;\n" + "Variant gv_a;\n" + "Variant gv_c;\n" + "\n" + "print(toString(toObject(((Variant)((Variant)gv_b.rvalAt(gv_a)).rvalAt(gv_c))).o_get(\"c\", 0x000000000002B608LL)));\n"); + VT("c;", + "Variant gv_b;\n" + "Variant gv_a;\n" + "Variant gv_c;\n" + "Variant gv_d;\n" + "\n" + "print(toString(toObject(((Variant)((Variant)((Variant)gv_b.rvalAt(gv_a)).rvalAt(gv_c)).rvalAt(gv_d))).o_get(\"c\", 0x000000000002B608LL)));\n"); + VT("c[];", + "Variant gv_b;\n" + "\n" + "print(toString(((Variant)toArray(toObject(gv_b).o_get(\"c\", 0x000000000002B608LL)).lvalAt())));\n"); + VT("c[];", + "Variant gv_b;\n" + "Variant gv_a;\n" + "Variant gv_c;\n" + "Variant gv_d;\n" + "\n" + "print(toString(((Variant)toArray(toObject(((Variant)((Variant)((Variant)gv_b.rvalAt(gv_a)).rvalAt(gv_c)).rvalAt(gv_d))).o_get(\"c\", 0x000000000002B608LL)).lvalAt())));\n"); + + return true; +} + +bool TestTransformerExpr::TestObjectMethodExpression() { + VT("c();", + "Variant gv_b;\n" + "\n" + "class c_test : public ObjectData {\n" + " void c_test::init();\n" + " public: Variant m_c;\n" + "};\n" + "c_test::c_test() {\n" + "}\n" + "void c_test::init() {\n" + "}\n" + "gv_b = p_test(p_test(new c_test())->create());\n" + "echo(toString(toObject(gv_b)->o_invoke(\"c\", Array(), 0x000000000002B608LL)));\n" + ); + + VT("c();", + "Variant gv_b;\n" + "\n" + "class c_test : public ObjectData {\n" + " void c_test::init();\n" + " public: void t_c();\n" + "};\n" + "c_test::c_test() {\n" + "}\n" + "void c_test::init() {\n" + "}\n" + "void c_test::t_c() {\n" + "}\n" + "gv_b = p_test(p_test(new c_test())->create());\n" + "echo((p_test(gv_b)->t_c(), null));\n" + ); + + VT("c();", + "Variant gv_b;\n" + "\n" + "echo(toString(toObject(gv_b)->o_invoke(\"c\", Array(), 0x000000000002B608LL)));\n"); + VT("c();", + "const String k_b = \"b\";\n" + "\n" + "echo(toString(toObject(variables->get(k_b))->o_invoke(\"c\", Array(), 0x000000000002B608LL)));\n" + ); + VT("c();", + "Variant gv_b;\n" + "\n" + "echo(toString(toObject(variables->get(toString(gv_b)))->o_invoke(\"c\", Array(), 0x000000000002B608LL)));\n"); + VT("c();", + "Variant gv_b;\n" + "\n" + "echo(toString(toObject(((Variant)toArray(gv_b).lvalAt()))->o_invoke(\"c\", Array(), 0x000000000002B608LL)));\n"); + VT("c{$e}($p3,$p4)->f[]($p5,$p6);", + "Variant gv_b;\n" + "Variant gv_a;\n" + "Variant gv_c;\n" + "Variant gv_d;\n" + "Variant gv_p1;\n" + "Variant gv_p2;\n" + "Variant gv_e;\n" + "Variant gv_p3;\n" + "Variant gv_p4;\n" + "Variant gv_p5;\n" + "Variant gv_p6;\n" + "\n" + "invoke((toString(((Variant)toArray(toObject(invoke((toString(((Variant)toObject(invoke((toString(((Variant)((Variant)((Variant)gv_b.rvalAt(gv_a)).rvalAt(gv_c)).rvalAt(gv_d)))), Array(NEW(ArrayElement)(ref(gv_p1)), NEW(ArrayElement)(ref(gv_p2)), NULL), -1)).o_get(\"c\", 0x000000000002B608LL).rvalAt(gv_e)))), Array(NEW(ArrayElement)(ref(gv_p3)), NEW(ArrayElement)(ref(gv_p4)), NULL), -1)).o_get(\"f\", 0x000000000002B60BLL)).lvalAt()))), Array(NEW(ArrayElement)(ref(gv_p5)), NEW(ArrayElement)(ref(gv_p6)), NULL), -1);\n"); + + return true; +} + +bool TestTransformerExpr::TestListAssignment() { + VT("create());\n"); + + VT(">= $b;", "Variant gv_b;\nVariant gv_a;\n\n" + "gv_a >>= toInt64(gv_b);\n"); + VT("> $b;", "Variant gv_a;\nVariant gv_b;\n\n" + "toInt64(toInt64(gv_a)) >> toInt64(gv_b);\n"); + VT(" $b;", "Variant gv_a;\nVariant gv_b;\n\n" + "more(gv_a, gv_b);\n"); + VT("= $b;", "Variant gv_a;\nVariant gv_b;\n\n" + "not_less(gv_a, gv_b);\n"); + VT(" $b);", + "Variant gv_a;\n" + "Variant gv_b;\n" + "\n" + "Array(NEW(ArrayElement)(gv_a, gv_b), NULL);\n"); + VT(" $b, $c => $d);", + "Variant gv_a;\n" + "Variant gv_b;\n" + "Variant gv_c;\n" + "Variant gv_d;\n" + "\n" + "Array(NEW(ArrayElement)(gv_a, gv_b), NEW(ArrayElement)(gv_c, gv_d), NULL);\n"); + VT(" $b, $c => $d,);", + "Variant gv_a;\n" + "Variant gv_b;\n" + "Variant gv_c;\n" + "Variant gv_d;\n" + "\n" + "Array(NEW(ArrayElement)(gv_a, gv_b), NEW(ArrayElement)(gv_c, gv_d), NULL);\n"); + VT(" &$b);", + "Variant gv_a;\n" + "Variant gv_b;\n" + "\n" + "Array(NEW(ArrayElement)(gv_a, ref(gv_b)), NULL);\n"); + VT(" &$b, $c => &$d);", + "Variant gv_a;\n" + "Variant gv_b;\n" + "Variant gv_c;\n" + "Variant gv_d;\n" + "\n" + "Array(NEW(ArrayElement)(gv_a, ref(gv_b)), NEW(ArrayElement)(gv_c, ref(gv_d)), NULL);\n"); + + VT(" b);}", + "void f_a();\n" + "const String k_a = \"a\";\n" + "const String k_b = \"b\";\n" + "\n" + "void f_a() {\n" + " static bool inited_a = false; static Array sv_a;\n" + " \n" + " if (!inited_a) {\n" + " sv_a = Array(NEW(ArrayElement)(k_a, k_b), NULL);\n" + " inited_a = true;\n" + " }\n" + "}\n"); + + VT(" b, c => d);}", + "void f_a();\n" + "const String k_a = \"a\";\n" + "const String k_b = \"b\";\n" + "const String k_c = \"c\";\n" + "const String k_d = \"d\";\n" + "\n" + "void f_a() {\n" + " static bool inited_a = false; static Array sv_a;\n" + " \n" + " if (!inited_a) {\n" + " sv_a = Array(NEW(ArrayElement)(k_a, k_b), NEW(ArrayElement)(k_c, k_d), NULL);\n" + " inited_a = true;\n" + " }\n" + "}\n"); + + VT(" b, c => d,);}", + "void f_a();\n" + "const String k_a = \"a\";\n" + "const String k_b = \"b\";\n" + "const String k_c = \"c\";\n" + "const String k_d = \"d\";\n" + "\n" + "void f_a() {\n" + " static bool inited_a = false; static Array sv_a;\n" + " \n" + " if (!inited_a) {\n" + " sv_a = Array(NEW(ArrayElement)(k_a, k_b), NEW(ArrayElement)(k_c, k_d), NULL);\n" + " inited_a = true;\n" + " }\n" + "}\n"); + + return true; +} + +bool TestTransformerExpr::TestClassConstantExpression() { + VT(" + +/////////////////////////////////////////////////////////////////////////////// + +class TestTransformerExpr : public TestTransformer { + public: + TestTransformerExpr(); + + virtual bool RunTests(const std::string &which); + + bool TestExpressionList(); + bool TestAssignmentExpression(); + bool TestSimpleVariable(); + bool TestDynamicVariable(); + bool TestStaticMemberExpression(); + bool TestArrayElementExpression(); + bool TestStringOffsetExpression(); + bool TestDynamicFunctionCall(); + bool TestSimpleFunctionCall(); + bool TestScalarExpression(); + bool TestObjectPropertyExpression(); + bool TestObjectMethodExpression(); + bool TestListAssignment(); + bool TestNewObjectExpression(); + bool TestUnaryOpExpression(); + bool TestBinaryOpExpression(); + bool TestQOpExpression(); + bool TestArrayPairExpression(); + bool TestClassConstantExpression(); + bool TestParameterExpression(); + bool TestModifierExpression(); + bool TestConstant(); + bool TestEncapsListExpression(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_TRANSFORMER_EXPR_H__ diff --git a/src/test/test_trans_stmt.cpp b/src/test/test_trans_stmt.cpp new file mode 100644 index 0000000000000..363ac8af51c1f --- /dev/null +++ b/src/test/test_trans_stmt.cpp @@ -0,0 +1,2355 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +TestTransformerStmt::TestTransformerStmt() { + m_verbose = false; +} + +bool TestTransformerStmt::RunTests(const std::string &which) { + bool ret = true; + RUN_TEST(TestFunctionStatement); + RUN_TEST(TestClassStatement); + RUN_TEST(TestInterfaceStatement); + RUN_TEST(TestClassVariable); + RUN_TEST(TestClassConstant); + RUN_TEST(TestMethodStatement); + RUN_TEST(TestStatementList); + RUN_TEST(TestBlockStatement); + RUN_TEST(TestIfBranchStatement); + RUN_TEST(TestIfStatement); + RUN_TEST(TestWhileStatement); + RUN_TEST(TestDoStatement); + RUN_TEST(TestForStatement); + RUN_TEST(TestSwitchStatement); + RUN_TEST(TestCaseStatement); + RUN_TEST(TestBreakStatement); + RUN_TEST(TestContinueStatement); + RUN_TEST(TestReturnStatement); + RUN_TEST(TestGlobalStatement); + RUN_TEST(TestStaticStatement); + RUN_TEST(TestEchoStatement); + RUN_TEST(TestUnsetStatement); + RUN_TEST(TestExpStatement); + RUN_TEST(TestForEachStatement); + RUN_TEST(TestCatchStatement); + RUN_TEST(TestTryStatement); + RUN_TEST(TestThrowStatement); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestTransformerStmt::TestFunctionStatement() { + VT("get(toString(v_c)) = 3;\n" + " echo((toString(v_a + v_b)));\n" + "}\n" + "f_foo(1, 2);\n"); + + VT(" '3');" + "function foo($a, $b, $c)" + "{" + " extract($b);" + " echo ($a + $c);" + "}" + "foo(1, $arr, 2);", + "Variant gv_arr;\n" + "\n" + "void f_foo(Variant v_a, Variant v_b, Variant v_c);\n" + "void f_foo(Variant v_a, Variant v_b, Variant v_c) {\n" + " extract(variables, toArray(v_b));\n" + " echo((toString(v_a + v_c)));\n" + "}\n" + "gv_arr = Array(NEW(ArrayElement)(\"a\", \"3\", 0x000000000002B606LL), NULL);\n" + "f_foo(1, gv_arr, 2);\n"); + + VT(" '3');" + " extract($a);" + " echo ($a + $b);" + "}" + "foo(1, 2);", + "void f_foo(Variant v_a, Variant v_b);\n" + "void f_foo(Variant v_a, Variant v_b) {\n" + " Variant v_arr;\n" + " \n" + " v_arr = Array(NEW(ArrayElement)(\"a\", \"3\", 0x000000000002B606LL), NULL);\n" + " extract(variables, toArray(v_a));\n" + " echo((toString(v_a + v_b)));\n" + "}\n" + "f_foo(1, 2);\n"); + + return true; +} + + + +bool TestTransformerStmt::TestClassStatement() { + VT("1);", + "if (more(5, 1)) {}\n"); + + VT("1) {}", + "if (more(5, 1)) {\n" + "}\n"); + + VT("1) { return;}", + "if (more(5, 1)) {\n" + " return;\n" + "}\n"); + + VT("1) { return; return 2;}", + "if (more(5, 1)) {\n" + " return;\n" + " return 2;\n" + "}\n" + ); + + VT("1); else;", + "if (more(5, 1)) {}\n"); + + VT("1); else {}", + "if (more(5, 1)) {}\n" + "else {\n" + "}\n"); + + VT("1); else { return;}", + "if (more(5, 1)) {}\n" + "else {\n" + " return;\n" + "}\n" + ); + + VT("1); else { return; return 2;}", + "if (more(5, 1)) {}\n" + "else {\n" + " return;\n" + " return 2;\n" + "}\n" + ); + + VT("1); elseif(6>2);", + "if (more(5, 1)) {}\n" + "else if (more(6, 2)) {}\n"); + + VT("1); elseif(6>2){}", + "if (more(5, 1)) {}\n" + "else if (more(6, 2)) {\n" + "}\n"); + + VT("1); elseif(6>2){ return;}", + "if (more(5, 1)) {}\n" + "else if (more(6, 2)) {\n" + " return;\n" + "}\n"); + + VT("1); elseif(6>2){ return; return 2;}", + "if (more(5, 1)) {}\n" + "else if (more(6, 2)) {\n" + " return;\n" + " return 2;\n" + "}\n" + ); + + VT("1); elseif(6>2); else {$a=2;}", + "Variant gv_a;\n" + "\n" + "if (more(5, 1)) {}\n" + "else if (more(6, 2)) {}\n" + "else {\n" + " gv_a = 2;\n" + "}\n"); + + VT("1); elseif(6>2){} else {$a=2;}", + "Variant gv_a;\n" + "\n" + "if (more(5, 1)) {}\n" + "else if (more(6, 2)) {\n" + "}\n" + "else {\n" + " gv_a = 2;\n" + "}\n"); + + VT("1); elseif(6>2){ return;} else{$a=2;}", + "Variant gv_a;\n" + "\n" + "if (more(5, 1)) {}\n" + "else if (more(6, 2)) {\n" + " return;\n" + "}\n" + "else {\n" + " gv_a = 2;\n" + "}\n"); + + VT("1); elseif(6>2){ return; return 2;} else{$a=2;}", + "Variant gv_a;\n" + "\n" + "if (more(5, 1)) {}\n" + "else if (more(6, 2)) {\n" + " return;\n" + " return 2;\n" + "}\n" + "else {\n" + " gv_a = 2;\n" + "}\n" + ); + + // if-endif format + + VT("1): endif;", + "if (more(5, 1)) {}\n"); + + VT("1):;endif;", + "if (more(5, 1)) {\n" + "}\n"); + + VT("1): {} endif;", + "if (more(5, 1)) {\n" + " {\n" + " }\n" + "}\n"); + + VT("1): return; endif;", + "if (more(5, 1)) {\n" + " return;\n" + "}\n"); + + VT("1): return; return 2; endif;", + "if (more(5, 1)) {\n" + " return;\n" + " return 2;\n" + "}\n" + ); + + VT("1):; else: endif;", + "if (more(5, 1)) {\n" + "}\n"); + + VT("1):; else:; endif;", + "if (more(5, 1)) {\n" + "}\n" + "else {\n" + "}\n"); + + VT("1):; else: {} endif;", + "if (more(5, 1)) {\n" + "}\n" + "else {\n" + " {\n" + " }\n" + "}\n"); + + VT("1):; else: return; endif;", + "if (more(5, 1)) {\n" + "}\n" + "else {\n" + " return;\n" + "}\n"); + + VT("1):; else: return; return 2; endif;", + "if (more(5, 1)) {\n" + "}\n" + "else {\n" + " return;\n" + " return 2;\n" + "}\n" + ); + + VT("1):; elseif(6>2): endif;", + "if (more(5, 1)) {\n" + "}\n" + "else if (more(6, 2)) {}\n"); + + VT("1):; elseif(6>2):; endif;", + "if (more(5, 1)) {\n" + "}\n" + "else if (more(6, 2)) {\n" + "}\n"); + + VT("1):; elseif(6>2):{} endif;", + "if (more(5, 1)) {\n" + "}\n" + "else if (more(6, 2)) {\n" + " {\n" + " }\n" + "}\n"); + + VT("1):; elseif(6>2): return; endif;", + "if (more(5, 1)) {\n" + "}\n" + "else if (more(6, 2)) {\n" + " return;\n" + "}\n"); + + VT("1):; elseif(6>2): return; return 2; endif;", + "if (more(5, 1)) {\n" + "}\n" + "else if (more(6, 2)) {\n" + " return;\n" + " return 2;\n" + "}\n" + ); + + VT("1):; elseif(6>2):; else: $a=2; endif;", + "Variant gv_a;\n" + "\n" + "if (more(5, 1)) {\n" + "}\n" + "else if (more(6, 2)) {\n" + "}\n" + "else {\n" + " gv_a = 2;\n" + "}\n"); + + VT("1):; elseif(6>2):{} else: $a=2; endif;", + "Variant gv_a;\n" + "\n" + "if (more(5, 1)) {\n" + "}\n" + "else if (more(6, 2)) {\n" + " {\n" + " }\n" + "}\n" + "else {\n" + " gv_a = 2;\n" + "}\n"); + + VT("1):; elseif(6>2): return; else:$a=2; endif;", + "Variant gv_a;\n" + "\n" + "if (more(5, 1)) {\n" + "}\n" + "else if (more(6, 2)) {\n" + " return;\n" + "}\n" + "else {\n" + " gv_a = 2;\n" + "}\n"); + + VT("1):; elseif(6>2): return; return 2; else:$a=2; endif;", + "Variant gv_a;\n" + "\n" + "if (more(5, 1)) {\n" + "}\n" + "else if (more(6, 2)) {\n" + " return;\n" + " return 2;\n" + "}\n" + "else {\n" + " gv_a = 2;\n" + "}\n" + ); + + return true; +} + +bool TestTransformerStmt::TestWhileStatement() { + VT(" $c) ;", + "Variant gv_a;\n" + "Variant gv_b;\n" + "Variant gv_c;\n" + "\n" + "{\n" + " Variant map2 = (toArray(gv_a) + toArray(gv_b));\n" + " for (ArrayIter iter3 = map2.begin(); !iter3.end(); iter3.next()) {\n" + " gv_b = iter3.first();\n" + " gv_c = iter3.second();\n" + " goto continue1; continue1:;\n" + " }\n" + " goto break1; break1:;\n" + "}\n"); + + VT(" &$c) ;", + "Variant gv_a;\n" + "Variant gv_b;\n" + "Variant gv_c;\n" + "\n" + "{\n" + " Variant map2 = ref(toArray(gv_a) + toArray(gv_b));\n" + " map2.escalate();\n" + " for (ArrayIter iter3 = map2.begin(); !iter3.end(); iter3.next()) {\n" + " gv_b = iter3.first();\n" + " gv_c = ref(iter3.secondRef());\n" + " goto continue1; continue1:;\n" + " }\n" + " goto break1; break1:;\n" + "}\n"); + + VT(" &$c) : $a = 1; $b = 2; endforeach;", + "Variant gv_a;\n" + "Variant gv_b;\n" + "Variant gv_c;\n" + "\n" + "{\n" + " Variant map2 = ref(toArray(gv_a) + toArray(gv_b));\n" + " map2.escalate();\n" + " for (ArrayIter iter3 = map2.begin(); !iter3.end(); iter3.next()) {\n" + " gv_b = iter3.first();\n" + " gv_c = ref(iter3.secondRef());\n" + " {\n" + " gv_a = 1;\n" + " gv_b = 2;\n" + " }\n" + " goto continue1; continue1:;\n" + " }\n" + " goto break1; break1:;\n" + "}\n"); + + VT(" &$b) ;", + "Variant gv_a;\n" + "Variant gv_name;\n" + "Variant gv_b;\n" + "\n" + "{\n" + " Variant map2 = ref(gv_a);\n" + " map2.escalate();\n" + " for (ArrayIter iter3 = map2.begin(); !iter3.end(); iter3.next()) {\n" + " gv_name = iter3.first();\n" + " gv_b = ref(iter3.secondRef());\n" + " goto continue1; continue1:;\n" + " }\n" + " goto break1; break1:;\n" + "}\n"); + + VT(" $b) ;", + "Variant gv_a;\n" + "Variant gv_name;\n" + "Variant gv_b;\n" + "\n" + "{\n" + " Variant map2 = (toArray(gv_a));\n" + " for (ArrayIter iter3 = map2.begin(); !iter3.end(); iter3.next()) {\n" + " gv_name = iter3.first();\n" + " gv_b = iter3.second();\n" + " goto continue1; continue1:;\n" + " }\n" + " goto break1; break1:;\n" + "}\n"); + + return true; +} + +bool TestTransformerStmt::TestCatchStatement() { + VT(" + +/////////////////////////////////////////////////////////////////////////////// + +class TestTransformerStmt : public TestTransformer { + public: + TestTransformerStmt(); + + virtual bool RunTests(const std::string &which); + + bool TestFunctionStatement(); + bool TestClassStatement(); + bool TestInterfaceStatement(); + bool TestClassVariable(); + bool TestClassConstant(); + bool TestMethodStatement(); + bool TestStatementList(); + bool TestBlockStatement(); + bool TestIfBranchStatement(); + bool TestIfStatement(); + bool TestWhileStatement(); + bool TestDoStatement(); + bool TestForStatement(); + bool TestSwitchStatement(); + bool TestCaseStatement(); + bool TestBreakStatement(); + bool TestContinueStatement(); + bool TestReturnStatement(); + bool TestGlobalStatement(); + bool TestStaticStatement(); + bool TestEchoStatement(); + bool TestUnsetStatement(); + bool TestExpStatement(); + bool TestForEachStatement(); + bool TestCatchStatement(); + bool TestTryStatement(); + bool TestThrowStatement(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_TRANSFORMER_STMT_H__ diff --git a/src/test/test_transformer.cpp b/src/test/test_transformer.cpp new file mode 100644 index 0000000000000..9f3a2a72070d8 --- /dev/null +++ b/src/test/test_transformer.cpp @@ -0,0 +1,59 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +TestTransformer::TestTransformer() : m_verbose(true) { +} + +bool TestTransformer::VerifyTransformer(const char *input, const char *output, + const char *file /* = "" */, + int line /* = 0 */) { + ASSERT(input); + ASSERT(output); + + AnalysisResultPtr ar(new AnalysisResult()); + BuiltinSymbols::load(ar); + Parser::parseString(input, ar); + ar->analyzeProgram(); + ar->inferTypes(); + ostringstream code; + CodeGenerator cg(&code); + Option::GenerateCPPMacros = m_verbose; + ar->outputAllCPP(cg); + string actual = code.str(); + if (actual != output) { + Util::replaceAll(actual, "\"", "\\\""); + Util::replaceAll(actual, "\n", "\\n\"\n \""); + printf("-------------------------------------------------\n" + "%s:%d\nParsing: [%s]\nExpecting %d: [%s]\nGot %d: [%s]\n", + file, line, input, (int)strlen(output), output, + (int)code.str().length(), actual.c_str()); + return false; + } + return true; +} diff --git a/src/test/test_transformer.h b/src/test/test_transformer.h new file mode 100644 index 0000000000000..6183c0b9cd3bc --- /dev/null +++ b/src/test/test_transformer.h @@ -0,0 +1,43 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_TRANSFORMER_H__ +#define __TEST_TRANSFORMER_H__ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestTransformer : public TestBase { + public: + TestTransformer(); + + protected: + bool m_verbose; + + bool VerifyTransformer(const char *input, const char *output, + const char *file = "", int line = 0); +}; + +/////////////////////////////////////////////////////////////////////////////// +// macros + +#define VT(a,b) \ + if (!Count(VerifyTransformer(a,b,__FILE__,__LINE__))) return false; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_TRANSFORMER_H__ diff --git a/src/test/test_type_inference.cpp b/src/test/test_type_inference.cpp new file mode 100644 index 0000000000000..abd2571c9199b --- /dev/null +++ b/src/test/test_type_inference.cpp @@ -0,0 +1,451 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include + +using namespace std; + +/////////////////////////////////////////////////////////////////////////////// + +TestTypeInference::TestTypeInference() { + m_verbose = false; +} + +bool TestTypeInference::RunTests(const std::string &which) { + bool ret = true; + RUN_TEST(TestLocalVariable); + RUN_TEST(TestDynamicLocalVariable); + RUN_TEST(TestClassConstant); + RUN_TEST(TestClassVariable); + RUN_TEST(TestDynamicClassVariable); + RUN_TEST(TestGlobalConstant); + RUN_TEST(TestGlobalVariable); + RUN_TEST(TestDynamicGlobalVariable); + RUN_TEST(TestFunctionReturn); + RUN_TEST(TestFunctionParameter); + RUN_TEST(TestMethodParameter); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Local variables are well-scoped. If either l-dynamic variable or r-dynamic + * variable is present, a local variable table needs to set up and all + * local variables become Variants. + */ +bool TestTypeInference::TestLocalVariable() { + // l-value infers types + VT("get(toString(v_b)) = \"test\";\n" + " print(toString(v_a));\n" + "}\n"); + + // r-dynamic variable doesn't change inferrence results + VT("get(toString(v_a))));\n" + "}\n"); + + // extract() is the same as assigning values to l-dynamic variables + VT("a = 1;}}", + "class c_t : public ObjectData {\n" + " void c_t::init();\n" + " public: int64 m_a;\n" + " public: void t___construct();\n" + " public: ObjectData *create();\n" + " public: ObjectData *dynCreate(const Array ¶ms, bool init = true);\n" + "};\n" + "ObjectData *c_t::create() {\n" + " init();\n" + " t___construct();\n" + " return this;\n" + "}\n" + "ObjectData *c_t::dynCreate(const Array ¶ms, bool init /* = true */) {\n" + " if (init) {\n" + " return (create());\n" + " } else return this;\n" + "}\n" + "c_t::c_t() {\n" + "}\n" + "void c_t::init() {\n" + " m_a = 0;\n" + "}\n" + "void c_t::t___construct() {\n" + " m_a = 1;\n" + "}\n" + ); + + // 1st one got a narrower type of "int64" because of 2nd pass + VT("a;} function t2() { $b = new T(); $b->a = 1;}", + "void f_t();\n" + "void f_t2();\n" + "class c_t : public ObjectData {\n" + " void c_t::init();\n" + " public: int64 m_a;\n" + "};\n" + "c_t::c_t() {\n" + "}\n" + "void c_t::init() {\n" + " m_a = 0;\n" + "}\n" + "void f_t() {\n" + " p_t v_b;\n" + " int64 v_c = 0;\n" + " \n" + " v_b = p_t(p_t(new c_t())->create());\n" + " v_c = v_b->m_a;\n" + "}\n" + "void f_t2() {\n" + " p_t v_b;\n" + " \n" + " v_b = p_t(p_t(new c_t())->create());\n" + " v_b->m_a = 1;\n" + "}\n" + ); + + return true; +} + +bool TestTypeInference::TestDynamicClassVariable() { + // property table would handle this + VT("$a = 1;}}", + "class c_t : public ObjectData {\n" + " void c_t::init();\n" + " public: Variant m_a;\n" + " public: void t___construct();\n" + " public: ObjectData *create();\n" + " public: ObjectData *dynCreate(const Array ¶ms, bool init = true);\n" + "};\n" + "ObjectData *c_t::create() {\n" + " init();\n" + " t___construct();\n" + " return this;\n" + "}\n" + "ObjectData *c_t::dynCreate(const Array ¶ms, bool init /* = true */) {\n" + " if (init) {\n" + " return (create());\n" + " } else return this;\n" + "}\n" + "c_t::c_t() {\n" + "}\n" + "void c_t::init() {\n" + "}\n" + "void c_t::t___construct() {\n" + " Variant v_a;\n" + " \n" + " o_lval(toString(v_a), -1LL) = 1;\n" + "}\n" + ); + + return true; +} + +/** + * Global variables might be easier than class variables, because they are + * always initilized with inferrable values. + */ +bool TestTypeInference::TestGlobalConstant() { + VT("get(toString(gv_a))));\n"); + + return true; +} + +/** + * The hardest type inference is actually function's, whose depend on each + * other and multiple passes are needed. + */ +bool TestTypeInference::TestFunctionReturn() { + VT("test(1); ", + "Variant gv_z;\n" + "\n" + "class c_a : public ObjectData {\n" + " void c_a::init();\n" + " public: int64 t_test(int64 v_x);\n" + "};\n" + "c_a::c_a() {\n" + "}\n" + "void c_a::init() {\n" + "}\n" + "int64 c_a::t_test(int64 v_x) {\n" + " return v_x;\n" + "}\n" + "gv_z = p_a(p_a(new c_a())->create());\n" + "p_a(gv_z)->t_test(1);\n" + ); + + VT("test(1); $y='test'; $z->$y(\'m\');", + "Variant gv_z;\n" + "Variant gv_y;\n" + "\n" + "class c_a : public ObjectData {\n" + " void c_a::init();\n" + " public: Variant t_test(CVarRef v_x);\n" + "};\n" + "c_a::c_a() {\n" + "}\n" + "void c_a::init() {\n" + "}\n" + "Variant c_a::t_test(CVarRef v_x) {\n" + " return v_x;\n" + "}\n" + "gv_z = p_a(p_a(new c_a())->create());\n" + "p_a(gv_z)->t_test(1);\n" + "gv_y = \"test\";\n" + "toObject(gv_z)->o_invoke((toString(gv_y)), Array(NEW(ArrayElement)(ref(\"m\")), NULL), -1LL);\n" + ); + + return true; +} diff --git a/src/test/test_type_inference.h b/src/test/test_type_inference.h new file mode 100644 index 0000000000000..29e1b15e17035 --- /dev/null +++ b/src/test/test_type_inference.h @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_TYPE_INFERENCE_H__ +#define __TEST_TYPE_INFERENCE_H__ + +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestTypeInference : public TestTransformer { + public: + TestTypeInference(); + + public: + virtual bool RunTests(const std::string &which); + + bool TestLocalVariable(); + bool TestDynamicLocalVariable(); + bool TestClassConstant(); + bool TestClassVariable(); + bool TestDynamicClassVariable(); + bool TestGlobalConstant(); + bool TestGlobalVariable(); + bool TestDynamicGlobalVariable(); + bool TestFunctionReturn(); + bool TestFunctionParameter(); + bool TestMethodParameter(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_TYPE_INFERENCE_H__ diff --git a/src/test/test_util.cpp b/src/test/test_util.cpp new file mode 100644 index 0000000000000..7e90eebd9bda4 --- /dev/null +++ b/src/test/test_util.cpp @@ -0,0 +1,491 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include +#include +#include +#include +#include +#include + +using namespace std; + +#define VERIFY_DUMP(map, exp) \ + if (!(exp)) { \ + printf("%s:%d: [" #exp "] is false\n", __FILE__, __LINE__); \ + map.dump(); \ + return Count(false); \ + } \ + + +/////////////////////////////////////////////////////////////////////////////// + +TestUtil::TestUtil() { +} + +/////////////////////////////////////////////////////////////////////////////// + +bool TestUtil::RunTests(const std::string &which) { + bool ret = true; + RUN_TEST(TestHphpMap); + RUN_TEST(TestHphpVector); + RUN_TEST(TestLFUTable); + RUN_TEST(TestSharedString); + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// data types + +struct testhash { + size_t operator()(CStrRef s) const { + return hash_string(s.data(), s.size()); + } +}; + +struct testeqstr { + bool operator()(CStrRef s1, CStrRef s2) const { + return string_strcmp(s1.data(), s1.size(), s2.data(), s2.size()) == 0; + } +}; + +bool TestUtil::TestHphpMap() { + { + VS(Variant("10").toKey(), Variant(10)); + VS(Variant("name").toKey(), Variant("name")); + } + + { + HphpMap hmap; + VERIFY_DUMP(hmap,hmap.size() == 0); + } + + { + HphpMap hmap; + Variant k("key"); + int old; + VERIFY_DUMP(hmap,hmap.insert(k, 10, old)); + VERIFY_DUMP(hmap,!hmap.insert(k, 11, old)); + VERIFY_DUMP(hmap,old == 10); + old = 0; + VERIFY_DUMP(hmap,hmap.find(k, old)); + VERIFY_DUMP(hmap,old == 10); + VERIFY_DUMP(hmap,hmap.size() == 1); + hmap.erase(k); + old = 0; + VERIFY_DUMP(hmap,!hmap.find(k, old)); + VERIFY_DUMP(hmap,hmap.insert(k, 11, old)); + } + + { + HphpMap hmap; + for (int i = 0; i < 1000; i++) { + Variant k(i); + int old; + VERIFY_DUMP(hmap,hmap.insert(k, i*3, old)); + } + VERIFY_DUMP(hmap,hmap.size() == 1000); + for (int i = 0; i < 100; i++) { + Variant k(i); + int old; + VERIFY_DUMP(hmap,!hmap.insert(k, i*4, old)); + VERIFY_DUMP(hmap,old == i*3); + } + + for (int i = 0; i < 1000; i++) { + Variant k(i); + int old; + VERIFY_DUMP(hmap,hmap.find(k, old)); + VERIFY_DUMP(hmap,old == i*3); + hmap.erase(k); + } + VERIFY_DUMP(hmap,hmap.size() == 0); + + } + + { + HphpMap hmap; + for (int i = 0; i < 100; i++) { + Variant k(i); + int old; + VERIFY_DUMP(hmap,hmap.insert(k, i*2, old)); + } + HphpMap::iterator it = + hmap.begin(); + for(; it != hmap.end(); ++it) { + int i = it->key().toInt32(); + VERIFY_DUMP(hmap,i*2 == it->value()); + } + } + { + HphpMap hmap; + for (int i = 0; i < 100; i++) { + Variant k(i); + int old; + VERIFY_DUMP(hmap,hmap.insert(k, i*2, old)); + } + HphpMap::const_iterator it = + hmap.begin(); + for(; it != hmap.end(); ++it) { + int i = it->key().toInt32(); + VERIFY_DUMP(hmap,i*2 == it->value()); + } + } + { + HphpMap hmap; + for (int i = 0; i < 100; i++) { + Variant k(i); + hmap[k] = i*2; + } + for (int i = 0; i < 100; i++) { + Variant k(i); + VERIFY_DUMP(hmap,hmap[k] == i*2); + } + } + { + HphpMap hmap; + Variant k1("n1"); + hmap[k1] = 0; + VERIFY_DUMP(hmap,hmap[k1] == 0); + Variant k2("n2"); + hmap[k2] = 1; + VERIFY_DUMP(hmap,hmap[k2] == 1); + HphpMap::iterator it = + hmap.begin(); + for(; it != hmap.end(); ++it) { + VERIFY_DUMP(hmap,it->value() < 2); + } + } + { + HphpMap hmap1; + { + HphpMap hmap2; + hmap2[Variant(1)] = 1; + hmap2[Variant(2)] = 2; + hmap1 = hmap2; + HphpMap hmap3(hmap2); + VERIFY_DUMP(hmap3,hmap3[Variant(1)] == 1); + VERIFY_DUMP(hmap3,hmap3[Variant(2)] == 2); + } + VERIFY_DUMP(hmap1,hmap1[Variant(1)] == 1); + VERIFY_DUMP(hmap1,hmap1[Variant(2)] == 2); + } + + return Count(true); +} + +bool TestUtil::TestHphpVector() { + { + HphpVector items; + items.push_back(1); + items.push_back(2); + for (unsigned int i = 0; i < items.size(); i++) { + VERIFY(items[i] == i + 1); + } + VERIFY(items.size() == 2); + + items.insert(1, 3); + VERIFY(items.size() == 3); + VERIFY(items[0] == 1); + VERIFY(items[1] == 3); + VERIFY(items[2] == 2); + VERIFY(items.back() == 2); + + items.reserve(10); + + items.resize(5); + VERIFY(items.size() == 5); + VERIFY(items[0] == 1); + VERIFY(items[1] == 3); + VERIFY(items[2] == 2); + VERIFY(items[3] == 0); + VERIFY(items[4] == 0); + VERIFY(items.back() == 0); + + items.reserve(1); + + items.remove(2); + VERIFY(items.size() == 4); + VERIFY(items[0] == 1); + VERIFY(items[1] == 3); + VERIFY(items[2] == 0); + VERIFY(items[3] == 0); + VERIFY(items.back() == 0); + + HphpVector items2; + items2.push_back(3); + items2.push_back(4); + items.swap(items2); + VERIFY(items.size() == 2); + VERIFY(items[0] == 3); + VERIFY(items[1] == 4); + + items.append(items2, 1, 2); + VERIFY(items.size() == 4); + VERIFY(items[0] == 3); + VERIFY(items[1] == 4); + VERIFY(items[2] == 3); + VERIFY(items[3] == 0); + + items.clear(); + VERIFY(items.size() == 0); + VERIFY(items.empty()); + } + { + HphpVector items; + items.push_back("apple"); + items.push_back("orange"); + VERIFY(items.size() == 2); + VERIFY(items[0] == "apple"); + VERIFY(items[1] == "orange"); + + items.insert(1, "pear"); + VERIFY(items.size() == 3); + VERIFY(items[0] == "apple"); + VERIFY(items[1] == "pear"); + VERIFY(items[2] == "orange"); + + items.remove(2); + VERIFY(items.size() == 2); + VERIFY(items[0] == "apple"); + VERIFY(items[1] == "pear"); + + HphpVector items2; + items2.push_back("banana"); + items2.push_back("grape"); + items.append(items2); + VERIFY(items.size() == 4); + VERIFY(items[0] == "apple"); + VERIFY(items[1] == "pear"); + VERIFY(items[2] == "banana"); + VERIFY(items[3] == "grape"); + String s = items[2]; + Variant b = s; + + items.swap(items2); + VERIFY(items.size() == 2); + VERIFY(items[0] == "banana"); + VERIFY(items[1] == "grape"); + + items.append(items2, 1, 2); + VERIFY(items.size() == 4); + VERIFY(items[0] == "banana"); + VERIFY(items[1] == "grape"); + VERIFY(items[2] == "pear"); + VERIFY(items[3] == "banana"); + + items.append(items2, 3); + VERIFY(items.size() == 5); + VERIFY(items[0] == "banana"); + VERIFY(items[1] == "grape"); + VERIFY(items[2] == "pear"); + VERIFY(items[3] == "banana"); + VERIFY(items[4] == "grape"); + + VS(b, "banana"); + + HphpVector items3 = items; + VERIFY(items3.size() == 5); + VERIFY(items3[0] == "banana"); + VERIFY(items3[1] == "grape"); + VERIFY(items3[2] == "pear"); + VERIFY(items3[3] == "banana"); + VERIFY(items3[4] == "grape"); + } + + return Count(true); +} + +struct IHash { + size_t operator()(int i) const { return i; } +}; +struct IEq { + bool operator()(int i, int j) const { return i == j; } +}; + +typedef LFUTable TestMap; + +bool TestUtil::TestLFUTable() { + { + TestMap table(1, 5, 2); + table.insert(1,1); + int r = 0; + VERIFY(table.lookup(1, r) && r == 1); + VERIFY(table.lookup(1, r) && r == 1); + VERIFY(table.lookup(1, r) && r == 1); + } + { + TestMap table(100, 5, 2); + for (int i = 0; i < 10; i++) { + table.insert(i,i); + } + VERIFY(table.check()); + int r = 0; + VERIFY(!table.lookup(0, r)); + VERIFY(!table.lookup(1, r)); + VERIFY(!table.lookup(2, r)); + VERIFY(!table.lookup(3, r)); + VERIFY(!table.lookup(4, r)); + VERIFY(table.lookup(5, r) && r == 5); + VERIFY(table.lookup(6, r) && r == 6); + VERIFY(table.lookup(7, r) && r == 7); + VERIFY(table.lookup(8, r) && r == 8); + VERIFY(table.lookup(9, r) && r == 9); + VERIFY(table.check()); + } + { + TestMap table(1, 5, 2); + for (int i = 0; i < 5; i++) { + table.insert(i,i); + } + sleep(1); + for (int i = 5; i < 10; i++) { + table.insert(i,i); + } + VERIFY(table.check()); + int r = 0; + VERIFY(!table.lookup(0, r)); + VERIFY(!table.lookup(1, r)); + VERIFY(!table.lookup(2, r)); + VERIFY(!table.lookup(3, r)); + VERIFY(!table.lookup(4, r)); + VERIFY(table.lookup(5, r) && r == 5); + VERIFY(table.lookup(6, r) && r == 6); + VERIFY(table.lookup(7, r) && r == 7); + VERIFY(table.lookup(8, r) && r == 8); + VERIFY(table.lookup(9, r) && r == 9); + VERIFY(table.check()); + } + { + TestMap table(1, 5, 2); + for (int i = 0; i < 5; i++) { + table.insert(i,i); + } + int r = 0; + VERIFY(table.lookup(0, r) && r == 0); + VERIFY(table.lookup(0, r) && r == 0); + VERIFY(table.lookup(3, r) && r == 3); + sleep(1); + for (int i = 5; i < 8; i++) { + table.insert(i,i); + } + VERIFY(table.lookup(0, r) && r == 0); + VERIFY(!table.lookup(1, r)); + VERIFY(!table.lookup(2, r)); + VERIFY(table.lookup(3, r) && r == 3); + VERIFY(!table.lookup(4, r)); + VERIFY(table.lookup(5, r) && r == 5); + VERIFY(table.lookup(6, r) && r == 6); + VERIFY(table.lookup(7, r) && r == 7); + int ct = 0; + for (TestMap::const_iterator it = table.begin(); + it != table.end(); ++it) { + ct++; + VERIFY(it.first() == it.second()); + } + VERIFY(ct == 5); + } + { + TestMap table(1, 5, 2); + for (int i = 0; i < 5; i++) { + table[i] = i; + } + int r = 0; + VERIFY(table[0] == 0); + VERIFY(table[0] == 0); + VERIFY(table[3] == 3); + sleep(1); + for (int i = 5; i < 8; i++) { + table[i] = i; + } + VERIFY(table.check()); + VERIFY(table.lookup(0, r) && r == 0); + VERIFY(!table.lookup(1, r)); + VERIFY(!table.lookup(2, r)); + VERIFY(table.lookup(3, r) && r == 3); + VERIFY(!table.lookup(4, r)); + VERIFY(table.lookup(5, r) && r == 5); + VERIFY(table.lookup(6, r) && r == 6); + VERIFY(table.lookup(7, r) && r == 7); + VERIFY(table.check()); + int ct = 0; + for (TestMap::const_iterator it = table.begin(); + it != table.end(); ++it) { + ct++; + VERIFY(it.first() == it.second()); + } + VERIFY(ct == 5); + } + { + class Reader : public TestMap::AtomicReader { + public: + void read(int const &k, int const &v) { + + } + }; + class Updater : public TestMap::AtomicUpdater { + public: + bool update(int const &k, int &v, bool newly) { + v = k; + return false; + } + }; + Reader r; + Updater u; + TestMap table(1, 5, 2); + for (int i = 0; i < 5; i++) { + table.atomicUpdate(i, u, true); + } + for (int i = 0; i < 5; i++) { + VERIFY(table.atomicRead(i, r)); + } + } + return Count(true); +} + +bool TestUtil::TestSharedString() { + { + SharedString foo = "foo"; + SharedString bah("bah"); + VERIFY(bah->getString() == "bah"); + { + SharedString bah2 = bah; + VERIFY(bah2->getString() == "bah"); + VERIFY(bah.get() == bah2.get()); + SharedString bah3 = "bah"; + VERIFY(bah.get() == bah3.get()); + } + VERIFY(bah->getString() == "bah"); + VERIFY(foo->getString() == "foo"); + } + { + hphp_shared_string_map map; + for (int i = 0; i < 100; i++) { + string k("key"); + k += i; + map[k] = i; + } + for (int i = 0; i < 100; i++) { + string k("key"); + k += i; + hphp_shared_string_map::const_iterator it = map.find(k); + VERIFY(it != map.end()); + VERIFY(it->second == i); + } + } + + return Count(true); +} diff --git a/src/test/test_util.h b/src/test/test_util.h new file mode 100644 index 0000000000000..b08d7e17e35a0 --- /dev/null +++ b/src/test/test_util.h @@ -0,0 +1,39 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TEST_UTIL_H__ +#define __TEST_UTIL_H__ + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +class TestUtil : public TestBase { + public: + TestUtil(); + + virtual bool RunTests(const std::string &which); + + bool TestHphpMap(); + bool TestHphpVector(); + bool TestLFUTable(); + bool TestSharedString(); +}; + +/////////////////////////////////////////////////////////////////////////////// + +#endif // __TEST_CPP_BASE_H__ diff --git a/src/test/test_x509.crt b/src/test/test_x509.crt new file mode 100644 index 0000000000000..ec786697c467e --- /dev/null +++ b/src/test/test_x509.crt @@ -0,0 +1,7599 @@ +## +## ca-bundle.crt -- Bundle of CA Root Certificates +## +## This is a bundle of X.509 certificates of public Certificate +## Authorities (CA). These were automatically extracted from Mozilla's +## root CA list (the file `certdata.txt'). It contains the certificates +## in both plain text and PEM format and therefore can be directly used +## with an Apache/mod_ssl webserver for SSL client authentication. Just +## configure this file as the SSLCACertificateFile. +## +## (SKIPME) +## +## Last Modified: Wed Jul 6 10:25:05 CEST 2005 +## Source: "certdata.txt" CVS revision 1.37 +## + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 02:ad:66:7e:4e:45:fe:5e:57:6f:3c:98:19:5e:dd:c0 + Signature Algorithm: md2WithRSAEncryption + Issuer: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification Authority + Validity + Not Before: Nov 9 00:00:00 1994 GMT + Not After : Jan 7 23:59:59 2010 GMT + Subject: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1000 bit) + Modulus (1000 bit): + 00:92:ce:7a:c1:ae:83:3e:5a:aa:89:83:57:ac:25: + 01:76:0c:ad:ae:8e:2c:37:ce:eb:35:78:64:54:03: + e5:84:40:51:c9:bf:8f:08:e2:8a:82:08:d2:16:86: + 37:55:e9:b1:21:02:ad:76:68:81:9a:05:a2:4b:c9: + 4b:25:66:22:56:6c:88:07:8f:f7:81:59:6d:84:07: + 65:70:13:71:76:3e:9b:77:4c:e3:50:89:56:98:48: + b9:1d:a7:29:1a:13:2e:4a:11:59:9c:1e:15:d5:49: + 54:2c:73:3a:69:82:b1:97:39:9c:6d:70:67:48:e5: + dd:2d:d6:c8:1e:7b + Exponent: 65537 (0x10001) + Signature Algorithm: md2WithRSAEncryption + 65:dd:7e:e1:b2:ec:b0:e2:3a:e0:ec:71:46:9a:19:11:b8:d3: + c7:a0:b4:03:40:26:02:3e:09:9c:e1:12:b3:d1:5a:f6:37:a5: + b7:61:03:b6:5b:16:69:3b:c6:44:08:0c:88:53:0c:6b:97:49: + c7:3e:35:dc:6c:b9:bb:aa:df:5c:bb:3a:2f:93:60:b6:a9:4b: + 4d:f2:20:f7:cd:5f:7f:64:7b:8e:dc:00:5c:d7:fa:77:ca:39: + 16:59:6f:0e:ea:d3:b5:83:7f:4d:4d:42:56:76:b4:c9:5f:04: + f8:38:f8:eb:d2:5f:75:5f:cd:7b:fc:e5:8e:80:7c:fc:50 +MD5 Fingerprint=74:7B:82:03:43:F0:00:9E:6B:B3:EC:47:BF:85:A5:93 +-----BEGIN CERTIFICATE----- +MIICNDCCAaECEAKtZn5ORf5eV288mBle3cAwDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYD +VQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk0 +MTEwOTAwMDAwMFoXDTEwMDEwNzIzNTk1OVowXzELMAkGA1UEBhMCVVMxIDAeBgNV +BAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMuMS4wLAYDVQQLEyVTZWN1cmUgU2Vy +dmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGbMA0GCSqGSIb3DQEBAQUAA4GJ +ADCBhQJ+AJLOesGugz5aqomDV6wlAXYMra6OLDfO6zV4ZFQD5YRAUcm/jwjiioII +0haGN1XpsSECrXZogZoFokvJSyVmIlZsiAeP94FZbYQHZXATcXY+m3dM41CJVphI +uR2nKRoTLkoRWZweFdVJVCxzOmmCsZc5nG1wZ0jl3S3WyB57AgMBAAEwDQYJKoZI +hvcNAQECBQADfgBl3X7hsuyw4jrg7HFGmhkRuNPHoLQDQCYCPgmc4RKz0Vr2N6W3 +YQO2WxZpO8ZECAyIUwxrl0nHPjXcbLm7qt9cuzovk2C2qUtN8iD3zV9/ZHuO3ABc +1/p3yjkWWW8O6tO1g39NTUJWdrTJXwT4OPjr0l91X817/OWOgHz8UA== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 419 (0x1a3) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=GTE Corporation, CN=GTE CyberTrust Root + Validity + Not Before: Feb 23 23:01:00 1996 GMT + Not After : Feb 23 23:59:00 2006 GMT + Subject: C=US, O=GTE Corporation, CN=GTE CyberTrust Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:b8:e6:4f:ba:db:98:7c:71:7c:af:44:b7:d3:0f: + 46:d9:64:e5:93:c1:42:8e:c7:ba:49:8d:35:2d:7a: + e7:8b:bd:e5:05:31:59:c6:b1:2f:0a:0c:fb:9f:a7: + 3f:a2:09:66:84:56:1e:37:29:1b:87:e9:7e:0c:ca: + 9a:9f:a5:7f:f5:15:94:a3:d5:a2:46:82:d8:68:4c: + d1:37:15:06:68:af:bd:f8:b0:b3:f0:29:f5:95:5a: + 09:16:61:77:0a:22:25:d4:4f:45:aa:c7:bd:e5:96: + df:f9:d4:a8:8e:42:cc:24:c0:1e:91:27:4a:b5:6d: + 06:80:63:39:c4:a2:5e:38:03 + Exponent: 65537 (0x10001) + Signature Algorithm: md5WithRSAEncryption + 12:b3:75:c6:5f:1d:e1:61:55:80:00:d4:81:4b:7b:31:0f:23: + 63:e7:3d:f3:03:f9:f4:36:a8:bb:d9:e3:a5:97:4d:ea:2b:29: + e0:d6:6a:73:81:e6:c0:89:a3:d3:f1:e0:a5:a5:22:37:9a:63: + c2:48:20:b4:db:72:e3:c8:f6:d9:7c:be:b1:af:53:da:14:b4: + 21:b8:d6:d5:96:e3:fe:4e:0c:59:62:b6:9a:4a:f9:42:dd:8c: + 6f:81:a9:71:ff:f4:0a:72:6d:6d:44:0e:9d:f3:74:74:a8:d5: + 34:49:e9:5e:9e:e9:b4:7a:e1:e5:5a:1f:84:30:9c:d3:9f:a5: + 25:d8 +MD5 Fingerprint=C4:D7:F0:B2:A3:C5:7D:61:67:F0:04:CD:43:D3:BA:58 +-----BEGIN CERTIFICATE----- +MIIB+jCCAWMCAgGjMA0GCSqGSIb3DQEBBAUAMEUxCzAJBgNVBAYTAlVTMRgwFgYD +VQQKEw9HVEUgQ29ycG9yYXRpb24xHDAaBgNVBAMTE0dURSBDeWJlclRydXN0IFJv +b3QwHhcNOTYwMjIzMjMwMTAwWhcNMDYwMjIzMjM1OTAwWjBFMQswCQYDVQQGEwJV +UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMRwwGgYDVQQDExNHVEUgQ3liZXJU +cnVzdCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC45k+625h8cXyv +RLfTD0bZZOWTwUKOx7pJjTUteueLveUFMVnGsS8KDPufpz+iCWaEVh43KRuH6X4M +ypqfpX/1FZSj1aJGgthoTNE3FQZor734sLPwKfWVWgkWYXcKIiXUT0Wqx73llt/5 +1KiOQswkwB6RJ0q1bQaAYznEol44AwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABKz +dcZfHeFhVYAA1IFLezEPI2PnPfMD+fQ2qLvZ46WXTeorKeDWanOB5sCJo9Px4KWl +IjeaY8JIILTbcuPI9tl8vrGvU9oUtCG41tWW4/5ODFlitppK+ULdjG+BqXH/9Apy +bW1EDp3zdHSo1TRJ6V6e6bR64eVaH4QwnNOfpSXY +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 421 (0x1a5) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=GTE Corporation, OU=GTE CyberTrust Solutions, Inc., CN=GTE CyberTrust Global Root + Validity + Not Before: Aug 13 00:29:00 1998 GMT + Not After : Aug 13 23:59:00 2018 GMT + Subject: C=US, O=GTE Corporation, OU=GTE CyberTrust Solutions, Inc., CN=GTE CyberTrust Global Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:95:0f:a0:b6:f0:50:9c:e8:7a:c7:88:cd:dd:17: + 0e:2e:b0:94:d0:1b:3d:0e:f6:94:c0:8a:94:c7:06: + c8:90:97:c8:b8:64:1a:7a:7e:6c:3c:53:e1:37:28: + 73:60:7f:b2:97:53:07:9f:53:f9:6d:58:94:d2:af: + 8d:6d:88:67:80:e6:ed:b2:95:cf:72:31:ca:a5:1c: + 72:ba:5c:02:e7:64:42:e7:f9:a9:2c:d6:3a:0d:ac: + 8d:42:aa:24:01:39:e6:9c:3f:01:85:57:0d:58:87: + 45:f8:d3:85:aa:93:69:26:85:70:48:80:3f:12:15: + c7:79:b4:1f:05:2f:3b:62:99 + Exponent: 65537 (0x10001) + Signature Algorithm: md5WithRSAEncryption + 6d:eb:1b:09:e9:5e:d9:51:db:67:22:61:a4:2a:3c:48:77:e3: + a0:7c:a6:de:73:a2:14:03:85:3d:fb:ab:0e:30:c5:83:16:33: + 81:13:08:9e:7b:34:4e:df:40:c8:74:d7:b9:7d:dc:f4:76:55: + 7d:9b:63:54:18:e9:f0:ea:f3:5c:b1:d9:8b:42:1e:b9:c0:95: + 4e:ba:fa:d5:e2:7c:f5:68:61:bf:8e:ec:05:97:5f:5b:b0:d7: + a3:85:34:c4:24:a7:0d:0f:95:93:ef:cb:94:d8:9e:1f:9d:5c: + 85:6d:c7:aa:ae:4f:1f:22:b5:cd:95:ad:ba:a7:cc:f9:ab:0b: + 7a:7f +MD5 Fingerprint=CA:3D:D3:68:F1:03:5C:D0:32:FA:B8:2B:59:E8:5A:DB +-----BEGIN CERTIFICATE----- +MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYD +VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv +bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv +b3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEzMjM1OTAwWjB1MQswCQYDVQQGEwJV +UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU +cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds +b2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrH +iM3dFw4usJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTS +r41tiGeA5u2ylc9yMcqlHHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X4 +04Wqk2kmhXBIgD8SFcd5tB8FLztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3r +GwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l9 +3PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0P +lZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/ +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Basic CA/emailAddress=personal-basic@thawte.com + Validity + Not Before: Jan 1 00:00:00 1996 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Basic CA/emailAddress=personal-basic@thawte.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:bc:bc:93:53:6d:c0:50:4f:82:15:e6:48:94:35: + a6:5a:be:6f:42:fa:0f:47:ee:77:75:72:dd:8d:49: + 9b:96:57:a0:78:d4:ca:3f:51:b3:69:0b:91:76:17: + 22:07:97:6a:c4:51:93:4b:e0:8d:ef:37:95:a1:0c: + 4d:da:34:90:1d:17:89:97:e0:35:38:57:4a:c0:f4: + 08:70:e9:3c:44:7b:50:7e:61:9a:90:e3:23:d3:88: + 11:46:27:f5:0b:07:0e:bb:dd:d1:7f:20:0a:88:b9: + 56:0b:2e:1c:80:da:f1:e3:9e:29:ef:14:bd:0a:44: + fb:1b:5b:18:d1:bf:23:93:21 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 2d:e2:99:6b:b0:3d:7a:89:d7:59:a2:94:01:1f:2b:dd:12:4b: + 53:c2:ad:7f:aa:a7:00:5c:91:40:57:25:4a:38:aa:84:70:b9: + d9:80:0f:a5:7b:5c:fb:73:c6:bd:d7:8a:61:5c:03:e3:2d:27: + a8:17:e0:84:85:42:dc:5e:9b:c6:b7:b2:6d:bb:74:af:e4:3f: + cb:a7:b7:b0:e0:5d:be:78:83:25:94:d2:db:81:0f:79:07:6d: + 4f:f4:39:15:5a:52:01:7b:de:32:d6:4d:38:f6:12:5c:06:50: + df:05:5b:bd:14:4b:a1:df:29:ba:3b:41:8d:f7:63:56:a1:df: + 22:b1 +MD5 Fingerprint=E6:0B:D2:C9:CA:2D:88:DB:1A:71:0E:4B:78:EB:02:41 +-----BEGIN CERTIFICATE----- +MIIDITCCAoqgAwIBAgIBADANBgkqhkiG9w0BAQQFADCByzELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMRowGAYD +VQQKExFUaGF3dGUgQ29uc3VsdGluZzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBT +ZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFBlcnNvbmFsIEJhc2lj +IENBMSgwJgYJKoZIhvcNAQkBFhlwZXJzb25hbC1iYXNpY0B0aGF3dGUuY29tMB4X +DTk2MDEwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgcsxCzAJBgNVBAYTAlpBMRUw +EwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UE +ChMRVGhhd3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2Vy +dmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQZXJzb25hbCBCYXNpYyBD +QTEoMCYGCSqGSIb3DQEJARYZcGVyc29uYWwtYmFzaWNAdGhhd3RlLmNvbTCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAvLyTU23AUE+CFeZIlDWmWr5vQvoPR+53 +dXLdjUmbllegeNTKP1GzaQuRdhciB5dqxFGTS+CN7zeVoQxN2jSQHReJl+A1OFdK +wPQIcOk8RHtQfmGakOMj04gRRif1CwcOu93RfyAKiLlWCy4cgNrx454p7xS9CkT7 +G1sY0b8jkyECAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQF +AAOBgQAt4plrsD16iddZopQBHyvdEktTwq1/qqcAXJFAVyVKOKqEcLnZgA+le1z7 +c8a914phXAPjLSeoF+CEhULcXpvGt7Jtu3Sv5D/Lp7ew4F2+eIMllNLbgQ95B21P +9DkVWlIBe94y1k049hJcBlDfBVu9FEuh3ym6O0GN92NWod8isQ== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Premium CA/emailAddress=personal-premium@thawte.com + Validity + Not Before: Jan 1 00:00:00 1996 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Premium CA/emailAddress=personal-premium@thawte.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c9:66:d9:f8:07:44:cf:b9:8c:2e:f0:a1:ef:13: + 45:6c:05:df:de:27:16:51:36:41:11:6c:6c:3b:ed: + fe:10:7d:12:9e:e5:9b:42:9a:fe:60:31:c3:66:b7: + 73:3a:48:ae:4e:d0:32:37:94:88:b5:0d:b6:d9:f3: + f2:44:d9:d5:88:12:dd:76:4d:f2:1a:fc:6f:23:1e: + 7a:f1:d8:98:45:4e:07:10:ef:16:42:d0:43:75:6d: + 4a:de:e2:aa:c9:31:ff:1f:00:70:7c:66:cf:10:25: + 08:ba:fa:ee:00:e9:46:03:66:27:11:15:3b:aa:5b: + f2:98:dd:36:42:b2:da:88:75 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 69:36:89:f7:34:2a:33:72:2f:6d:3b:d4:22:b2:b8:6f:9a:c5: + 36:66:0e:1b:3c:a1:b1:75:5a:e6:fd:35:d3:f8:a8:f2:07:6f: + 85:67:8e:de:2b:b9:e2:17:b0:3a:a0:f0:0e:a2:00:9a:df:f3: + 14:15:6e:bb:c8:85:5a:98:80:f9:ff:be:74:1d:3d:f3:fe:30: + 25:d1:37:34:67:fa:a5:71:79:30:61:29:72:c0:e0:2c:4c:fb: + 56:e4:3a:a8:6f:e5:32:59:52:db:75:28:50:59:0c:f8:0b:19: + e4:ac:d9:af:96:8d:2f:50:db:07:c3:ea:1f:ab:33:e0:f5:2b: + 31:89 +MD5 Fingerprint=3A:B2:DE:22:9A:20:93:49:F9:ED:C8:D2:8A:E7:68:0D +-----BEGIN CERTIFICATE----- +MIIDKTCCApKgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBzzELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMRowGAYD +VQQKExFUaGF3dGUgQ29uc3VsdGluZzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBT +ZXJ2aWNlcyBEaXZpc2lvbjEjMCEGA1UEAxMaVGhhd3RlIFBlcnNvbmFsIFByZW1p +dW0gQ0ExKjAoBgkqhkiG9w0BCQEWG3BlcnNvbmFsLXByZW1pdW1AdGhhd3RlLmNv +bTAeFw05NjAxMDEwMDAwMDBaFw0yMDEyMzEyMzU5NTlaMIHPMQswCQYDVQQGEwJa +QTEVMBMGA1UECBMMV2VzdGVybiBDYXBlMRIwEAYDVQQHEwlDYXBlIFRvd24xGjAY +BgNVBAoTEVRoYXd0ZSBDb25zdWx0aW5nMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9u +IFNlcnZpY2VzIERpdmlzaW9uMSMwIQYDVQQDExpUaGF3dGUgUGVyc29uYWwgUHJl +bWl1bSBDQTEqMCgGCSqGSIb3DQEJARYbcGVyc29uYWwtcHJlbWl1bUB0aGF3dGUu +Y29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDJZtn4B0TPuYwu8KHvE0Vs +Bd/eJxZRNkERbGw77f4QfRKe5ZtCmv5gMcNmt3M6SK5O0DI3lIi1DbbZ8/JE2dWI +Et12TfIa/G8jHnrx2JhFTgcQ7xZC0EN1bUre4qrJMf8fAHB8Zs8QJQi6+u4A6UYD +ZicRFTuqW/KY3TZCstqIdQIDAQABoxMwETAPBgNVHRMBAf8EBTADAQH/MA0GCSqG +SIb3DQEBBAUAA4GBAGk2ifc0KjNyL2071CKyuG+axTZmDhs8obF1Wub9NdP4qPIH +b4Vnjt4rueIXsDqg8A6iAJrf8xQVbrvIhVqYgPn/vnQdPfP+MCXRNzRn+qVxeTBh +KXLA4CxM+1bkOqhv5TJZUtt1KFBZDPgLGeSs2a+WjS9Q2wfD6h+rM+D1KzGJ +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Freemail CA/emailAddress=personal-freemail@thawte.com + Validity + Not Before: Jan 1 00:00:00 1996 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting, OU=Certification Services Division, CN=Thawte Personal Freemail CA/emailAddress=personal-freemail@thawte.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d4:69:d7:d4:b0:94:64:5b:71:e9:47:d8:0c:51: + b6:ea:72:91:b0:84:5e:7d:2d:0d:8f:7b:12:df:85: + 25:75:28:74:3a:42:2c:63:27:9f:95:7b:4b:ef:7e: + 19:87:1d:86:ea:a3:dd:b9:ce:96:64:1a:c2:14:6e: + 44:ac:7c:e6:8f:e8:4d:0f:71:1f:40:38:a6:00:a3: + 87:78:f6:f9:94:86:5e:ad:ea:c0:5e:76:eb:d9:14: + a3:5d:6e:7a:7c:0c:a5:4b:55:7f:06:19:29:7f:9e: + 9a:26:d5:6a:bb:38:24:08:6a:98:c7:b1:da:a3:98: + 91:fd:79:db:e5:5a:c4:1c:b9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + c7:ec:92:7e:4e:f8:f5:96:a5:67:62:2a:a4:f0:4d:11:60:d0: + 6f:8d:60:58:61:ac:26:bb:52:35:5c:08:cf:30:fb:a8:4a:96: + 8a:1f:62:42:23:8c:17:0f:f4:ba:64:9c:17:ac:47:29:df:9d: + 98:5e:d2:6c:60:71:5c:a2:ac:dc:79:e3:e7:6e:00:47:1f:b5: + 0d:28:e8:02:9d:e4:9a:fd:13:f4:a6:d9:7c:b1:f8:dc:5f:23: + 26:09:91:80:73:d0:14:1b:de:43:a9:83:25:f2:e6:9c:2f:15: + ca:fe:a6:ab:8a:07:75:8b:0c:dd:51:84:6b:e4:f8:d1:ce:77: + a2:81 +MD5 Fingerprint=1E:74:C3:86:3C:0C:35:C5:3E:C2:7F:EF:3C:AA:3C:D9 +-----BEGIN CERTIFICATE----- +MIIDLTCCApagAwIBAgIBADANBgkqhkiG9w0BAQQFADCB0TELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMRowGAYD +VQQKExFUaGF3dGUgQ29uc3VsdGluZzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBT +ZXJ2aWNlcyBEaXZpc2lvbjEkMCIGA1UEAxMbVGhhd3RlIFBlcnNvbmFsIEZyZWVt +YWlsIENBMSswKQYJKoZIhvcNAQkBFhxwZXJzb25hbC1mcmVlbWFpbEB0aGF3dGUu +Y29tMB4XDTk2MDEwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgdExCzAJBgNVBAYT +AlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEa +MBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcxKDAmBgNVBAsTH0NlcnRpZmljYXRp +b24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0ZSBQZXJzb25hbCBG +cmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxAdGhh +d3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA1GnX1LCUZFtx6UfY +DFG26nKRsIRefS0Nj3sS34UldSh0OkIsYyeflXtL734Zhx2G6qPduc6WZBrCFG5E +rHzmj+hND3EfQDimAKOHePb5lIZererAXnbr2RSjXW56fAylS1V/Bhkpf56aJtVq +uzgkCGqYx7Hao5iR/Xnb5VrEHLkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zAN +BgkqhkiG9w0BAQQFAAOBgQDH7JJ+Tvj1lqVnYiqk8E0RYNBvjWBYYawmu1I1XAjP +MPuoSpaKH2JCI4wXD/S6ZJwXrEcp352YXtJsYHFcoqzceePnbgBHH7UNKOgCneSa +/RP0ptl8sfjcXyMmCZGAc9AUG95DqYMl8uacLxXK/qarigd1iwzdUYRr5PjRznei +gQ== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Server CA/emailAddress=server-certs@thawte.com + Validity + Not Before: Aug 1 00:00:00 1996 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Server CA/emailAddress=server-certs@thawte.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d3:a4:50:6e:c8:ff:56:6b:e6:cf:5d:b6:ea:0c: + 68:75:47:a2:aa:c2:da:84:25:fc:a8:f4:47:51:da: + 85:b5:20:74:94:86:1e:0f:75:c9:e9:08:61:f5:06: + 6d:30:6e:15:19:02:e9:52:c0:62:db:4d:99:9e:e2: + 6a:0c:44:38:cd:fe:be:e3:64:09:70:c5:fe:b1:6b: + 29:b6:2f:49:c8:3b:d4:27:04:25:10:97:2f:e7:90: + 6d:c0:28:42:99:d7:4c:43:de:c3:f5:21:6d:54:9f: + 5d:c3:58:e1:c0:e4:d9:5b:b0:b8:dc:b4:7b:df:36: + 3a:c2:b5:66:22:12:d6:87:0d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 07:fa:4c:69:5c:fb:95:cc:46:ee:85:83:4d:21:30:8e:ca:d9: + a8:6f:49:1a:e6:da:51:e3:60:70:6c:84:61:11:a1:1a:c8:48: + 3e:59:43:7d:4f:95:3d:a1:8b:b7:0b:62:98:7a:75:8a:dd:88: + 4e:4e:9e:40:db:a8:cc:32:74:b9:6f:0d:c6:e3:b3:44:0b:d9: + 8a:6f:9a:29:9b:99:18:28:3b:d1:e3:40:28:9a:5a:3c:d5:b5: + e7:20:1b:8b:ca:a4:ab:8d:e9:51:d9:e2:4c:2c:59:a9:da:b9: + b2:75:1b:f6:42:f2:ef:c7:f2:18:f9:89:bc:a3:ff:8a:23:2e: + 70:47 +MD5 Fingerprint=C5:70:C4:A2:ED:53:78:0C:C8:10:53:81:64:CB:D0:1D +-----BEGIN CERTIFICATE----- +MIIDEzCCAnygAwIBAgIBATANBgkqhkiG9w0BAQQFADCBxDELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD +VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv +biBTZXJ2aWNlcyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEm +MCQGCSqGSIb3DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wHhcNOTYwODAx +MDAwMDAwWhcNMjAxMjMxMjM1OTU5WjCBxDELMAkGA1UEBhMCWkExFTATBgNVBAgT +DFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYDVQQKExRUaGF3 +dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNl +cyBEaXZpc2lvbjEZMBcGA1UEAxMQVGhhd3RlIFNlcnZlciBDQTEmMCQGCSqGSIb3 +DQEJARYXc2VydmVyLWNlcnRzQHRoYXd0ZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQAD +gY0AMIGJAoGBANOkUG7I/1Zr5s9dtuoMaHVHoqrC2oQl/Kj0R1HahbUgdJSGHg91 +yekIYfUGbTBuFRkC6VLAYttNmZ7iagxEOM3+vuNkCXDF/rFrKbYvScg71CcEJRCX +L+eQbcAoQpnXTEPew/UhbVSfXcNY4cDk2VuwuNy0e982OsK1ZiIS1ocNAgMBAAGj +EzARMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAB/pMaVz7lcxG +7oWDTSEwjsrZqG9JGubaUeNgcGyEYRGhGshIPllDfU+VPaGLtwtimHp1it2ITk6e +QNuozDJ0uW8NxuOzRAvZim+aKZuZGCg70eNAKJpaPNW15yAbi8qkq43pUdniTCxZ +qdq5snUb9kLy78fyGPmJvKP/iiMucEc= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com + Validity + Not Before: Aug 1 00:00:00 1996 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d2:36:36:6a:8b:d7:c2:5b:9e:da:81:41:62:8f: + 38:ee:49:04:55:d6:d0:ef:1c:1b:95:16:47:ef:18: + 48:35:3a:52:f4:2b:6a:06:8f:3b:2f:ea:56:e3:af: + 86:8d:9e:17:f7:9e:b4:65:75:02:4d:ef:cb:09:a2: + 21:51:d8:9b:d0:67:d0:ba:0d:92:06:14:73:d4:93: + cb:97:2a:00:9c:5c:4e:0c:bc:fa:15:52:fc:f2:44: + 6e:da:11:4a:6e:08:9f:2f:2d:e3:f9:aa:3a:86:73: + b6:46:53:58:c8:89:05:bd:83:11:b8:73:3f:aa:07: + 8d:f4:42:4d:e7:40:9d:1c:37 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 26:48:2c:16:c2:58:fa:e8:16:74:0c:aa:aa:5f:54:3f:f2:d7: + c9:78:60:5e:5e:6e:37:63:22:77:36:7e:b2:17:c4:34:b9:f5: + 08:85:fc:c9:01:38:ff:4d:be:f2:16:42:43:e7:bb:5a:46:fb: + c1:c6:11:1f:f1:4a:b0:28:46:c9:c3:c4:42:7d:bc:fa:ab:59: + 6e:d5:b7:51:88:11:e3:a4:85:19:6b:82:4c:a4:0c:12:ad:e9: + a4:ae:3f:f1:c3:49:65:9a:8c:c5:c8:3e:25:b7:94:99:bb:92: + 32:71:07:f0:86:5e:ed:50:27:a6:0d:a6:23:f9:bb:cb:a6:07: + 14:42 +MD5 Fingerprint=06:9F:69:79:16:66:90:02:1B:8C:8C:A2:C3:07:6F:3A +-----BEGIN CERTIFICATE----- +MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD +VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv +biBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFByZW1pdW0gU2Vy +dmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZlckB0aGF3dGUuY29t +MB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYTAlpB +MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsG +A1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRp +b24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNl +cnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNv +bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2aovXwlue2oFBYo847kkE +VdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIhUdib0GfQ +ug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMR +uHM/qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG +9w0BAQQFAAOBgQAmSCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUI +hfzJATj/Tb7yFkJD57taRvvBxhEf8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JM +pAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7tUCemDaYj+bvLpgcUQg== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 903804111 (0x35def4cf) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Equifax, OU=Equifax Secure Certificate Authority + Validity + Not Before: Aug 22 16:41:51 1998 GMT + Not After : Aug 22 16:41:51 2018 GMT + Subject: C=US, O=Equifax, OU=Equifax Secure Certificate Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c1:5d:b1:58:67:08:62:ee:a0:9a:2d:1f:08:6d: + 91:14:68:98:0a:1e:fe:da:04:6f:13:84:62:21:c3: + d1:7c:ce:9f:05:e0:b8:01:f0:4e:34:ec:e2:8a:95: + 04:64:ac:f1:6b:53:5f:05:b3:cb:67:80:bf:42:02: + 8e:fe:dd:01:09:ec:e1:00:14:4f:fc:fb:f0:0c:dd: + 43:ba:5b:2b:e1:1f:80:70:99:15:57:93:16:f1:0f: + 97:6a:b7:c2:68:23:1c:cc:4d:59:30:ac:51:1e:3b: + af:2b:d6:ee:63:45:7b:c5:d9:5f:50:d2:e3:50:0f: + 3a:88:e7:bf:14:fd:e0:c7:b9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 CRL Distribution Points: + DirName:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority/CN=CRL1 + + X509v3 Private Key Usage Period: + Not After: Aug 22 16:41:51 2018 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4 + + X509v3 Subject Key Identifier: + 48:E6:68:F9:2B:D2:B2:95:D7:47:D8:23:20:10:4F:33:98:90:9F:D4 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V3.0c.... + Signature Algorithm: sha1WithRSAEncryption + 58:ce:29:ea:fc:f7:de:b5:ce:02:b9:17:b5:85:d1:b9:e3:e0: + 95:cc:25:31:0d:00:a6:92:6e:7f:b6:92:63:9e:50:95:d1:9a: + 6f:e4:11:de:63:85:6e:98:ee:a8:ff:5a:c8:d3:55:b2:66:71: + 57:de:c0:21:eb:3d:2a:a7:23:49:01:04:86:42:7b:fc:ee:7f: + a2:16:52:b5:67:67:d3:40:db:3b:26:58:b2:28:77:3d:ae:14: + 77:61:d6:fa:2a:66:27:a0:0d:fa:a7:73:5c:ea:70:f1:94:21: + 65:44:5f:fa:fc:ef:29:68:a9:a2:87:79:ef:79:ef:4f:ac:07: + 77:38 +MD5 Fingerprint=67:CB:9D:C0:13:24:8A:82:9B:B2:17:1E:D1:1B:EC:D4 +-----BEGIN CERTIFICATE----- +MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV +UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy +dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1 +MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx +dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f +BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A +cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC +AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ +MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm +aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw +ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj +IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF +MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA +A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y +7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh +1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4 +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + d0:1e:40:90:00:00:46:52:00:00:00:01:00:00:00:04 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=DC, L=Washington, O=ABA.ECOM, INC., CN=ABA.ECOM Root CA/emailAddress=admin@digsigtrust.com + Validity + Not Before: Jul 12 17:33:53 1999 GMT + Not After : Jul 9 17:33:53 2009 GMT + Subject: C=US, ST=DC, L=Washington, O=ABA.ECOM, INC., CN=ABA.ECOM Root CA/emailAddress=admin@digsigtrust.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b1:d3:11:e0:79:55:43:07:08:4c:cb:05:42:00: + e2:0d:83:46:3d:e4:93:ba:b6:06:d3:0d:59:bd:3e: + c1:ce:43:67:01:8a:21:a8:ef:bc:cc:d0:a2:cc:b0: + 55:96:53:84:66:05:00:da:44:49:80:d8:54:0a:a5: + 25:86:94:ed:63:56:ff:70:6c:a3:a1:19:d2:78:be: + 68:2a:44:5e:2f:cf:cc:18:5e:47:bc:3a:b1:46:3d: + 1e:f0:b9:2c:34:5f:8c:7c:4c:08:29:9d:40:55:eb: + 3c:7d:83:de:b5:f0:f7:8a:83:0e:a1:4c:b4:3a:a5: + b3:5f:5a:22:97:ec:19:9b:c1:05:68:fd:e6:b7:a9: + 91:94:2c:e4:78:48:24:1a:25:19:3a:eb:95:9c:39: + 0a:8a:cf:42:b2:f0:1c:d5:5f:fb:6b:ed:68:56:7b: + 39:2c:72:38:b0:ee:93:a9:d3:7b:77:3c:eb:71:03: + a9:38:4a:16:6c:89:2a:ca:da:33:13:79:c2:55:8c: + ed:9c:bb:f2:cb:5b:10:f8:2e:61:35:c6:29:4c:2a: + d0:2a:63:d1:65:59:b4:f8:cd:f9:f4:00:84:b6:57: + 42:85:9d:32:a8:f9:2a:54:fb:ff:78:41:bc:bd:71: + 28:f4:bb:90:bc:ff:96:34:04:e3:45:9e:a1:46:28: + 40:81 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:8 + Signature Algorithm: sha1WithRSAEncryption + 04:6f:25:86:e4:e6:96:27:b4:d9:42:c0:d0:c9:00:b1:7f:54: + 3e:87:b2:6d:24:a9:2f:0a:7e:fd:a4:44:b0:f8:54:07:bd:1b: + 9d:9d:ca:7b:50:24:7b:11:5b:49:a3:a6:bf:12:74:d5:89:b7: + b7:2f:98:64:25:14:b7:61:e9:7f:60:80:6b:d3:64:e8:ab:bd: + 1a:d6:51:fa:c0:b4:5d:77:1a:7f:64:08:5e:79:c6:05:4c:f1: + 7a:dd:4d:7d:ce:e6:48:7b:54:d2:61:92:81:d6:1b:d6:00:f0: + 0e:9e:28:77:a0:4d:88:c7:22:76:19:c3:c7:9e:1b:a6:77:78: + f8:5f:9b:56:d1:f0:f2:17:ac:8e:9d:59:e6:1f:fe:57:b6:d9: + 5e:e1:5d:9f:45:ec:61:68:19:41:e1:b2:20:26:fe:5a:30:76: + 24:ff:40:72:3c:79:9f:7c:22:48:ab:46:cd:db:b3:86:2c:8f: + bf:05:41:d3:c1:e3:14:e3:41:17:26:d0:7c:a7:71:4c:19:e8: + 4a:0f:72:58:31:7d:ec:60:7a:a3:22:28:bd:19:24:60:3f:3b: + 87:73:c0:6b:e4:cb:ae:b7:ab:25:43:b2:55:2d:7b:ab:06:0e: + 75:5d:34:e5:5d:73:6d:9e:b2:75:40:a5:59:c9:4f:31:71:88: + d9:88:7f:54 +MD5 Fingerprint=41:B8:07:F7:A8:D1:09:EE:B4:9A:8E:70:4D:FC:1B:78 +-----BEGIN CERTIFICATE----- +MIIDtTCCAp2gAwIBAgIRANAeQJAAAEZSAAAAAQAAAAQwDQYJKoZIhvcNAQEFBQAw +gYkxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJEQzETMBEGA1UEBxMKV2FzaGluZ3Rv +bjEXMBUGA1UEChMOQUJBLkVDT00sIElOQy4xGTAXBgNVBAMTEEFCQS5FQ09NIFJv +b3QgQ0ExJDAiBgkqhkiG9w0BCQEWFWFkbWluQGRpZ3NpZ3RydXN0LmNvbTAeFw05 +OTA3MTIxNzMzNTNaFw0wOTA3MDkxNzMzNTNaMIGJMQswCQYDVQQGEwJVUzELMAkG +A1UECBMCREMxEzARBgNVBAcTCldhc2hpbmd0b24xFzAVBgNVBAoTDkFCQS5FQ09N +LCBJTkMuMRkwFwYDVQQDExBBQkEuRUNPTSBSb290IENBMSQwIgYJKoZIhvcNAQkB +FhVhZG1pbkBkaWdzaWd0cnVzdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQCx0xHgeVVDBwhMywVCAOINg0Y95JO6tgbTDVm9PsHOQ2cBiiGo77zM +0KLMsFWWU4RmBQDaREmA2FQKpSWGlO1jVv9wbKOhGdJ4vmgqRF4vz8wYXke8OrFG +PR7wuSw0X4x8TAgpnUBV6zx9g9618PeKgw6hTLQ6pbNfWiKX7BmbwQVo/ea3qZGU +LOR4SCQaJRk665WcOQqKz0Ky8BzVX/tr7WhWezkscjiw7pOp03t3POtxA6k4ShZs +iSrK2jMTecJVjO2cu/LLWxD4LmE1xilMKtAqY9FlWbT4zfn0AIS2V0KFnTKo+SpU ++/94Qby9cSj0u5C8/5Y0BONFnqFGKECBAgMBAAGjFjAUMBIGA1UdEwEB/wQIMAYB +Af8CAQgwDQYJKoZIhvcNAQEFBQADggEBAARvJYbk5pYntNlCwNDJALF/VD6Hsm0k +qS8Kfv2kRLD4VAe9G52dyntQJHsRW0mjpr8SdNWJt7cvmGQlFLdh6X9ggGvTZOir +vRrWUfrAtF13Gn9kCF55xgVM8XrdTX3O5kh7VNJhkoHWG9YA8A6eKHegTYjHInYZ +w8eeG6Z3ePhfm1bR8PIXrI6dWeYf/le22V7hXZ9F7GFoGUHhsiAm/lowdiT/QHI8 +eZ98IkirRs3bs4Ysj78FQdPB4xTjQRcm0HyncUwZ6EoPclgxfexgeqMiKL0ZJGA/ +O4dzwGvky663qyVDslUte6sGDnVdNOVdc22esnVApVnJTzFxiNmIf1Q= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 913315222 (0x36701596) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Digital Signature Trust Co., OU=DSTCA E1 + Validity + Not Before: Dec 10 18:10:23 1998 GMT + Not After : Dec 10 18:40:23 2018 GMT + Subject: C=US, O=Digital Signature Trust Co., OU=DSTCA E1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:a0:6c:81:a9:cf:34:1e:24:dd:fe:86:28:cc:de: + 83:2f:f9:5e:d4:42:d2:e8:74:60:66:13:98:06:1c: + a9:51:12:69:6f:31:55:b9:49:72:00:08:7e:d3:a5: + 62:44:37:24:99:8f:d9:83:48:8f:99:6d:95:13:bb: + 43:3b:2e:49:4e:88:37:c1:bb:58:7f:fe:e1:bd:f8: + bb:61:cd:f3:47:c0:99:a6:f1:f3:91:e8:78:7c:00: + cb:61:c9:44:27:71:69:55:4a:7e:49:4d:ed:a2:a3: + be:02:4c:00:ca:02:a8:ee:01:02:31:64:0f:52:2d: + 13:74:76:36:b5:7a:b4:2d:71 + Exponent: 3 (0x3) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=US/O=Digital Signature Trust Co./OU=DSTCA E1/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Dec 10 18:10:23 1998 GMT, Not After: Dec 10 18:10:23 2018 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:6A:79:7E:91:69:46:18:13:0A:02:77:A5:59:5B:60:98:25:0E:A2:F8 + + X509v3 Subject Key Identifier: + 6A:79:7E:91:69:46:18:13:0A:02:77:A5:59:5B:60:98:25:0E:A2:F8 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0 +..V4.0.... + Signature Algorithm: sha1WithRSAEncryption + 22:12:d8:7a:1d:dc:81:06:b6:09:65:b2:87:c8:1f:5e:b4:2f: + e9:c4:1e:f2:3c:c1:bb:04:90:11:4a:83:4e:7e:93:b9:4d:42: + c7:92:26:a0:5c:34:9a:38:72:f8:fd:6b:16:3e:20:ee:82:8b: + 31:2a:93:36:85:23:88:8a:3c:03:68:d3:c9:09:0f:4d:fc:6c: + a4:da:28:72:93:0e:89:80:b0:7d:fe:80:6f:65:6d:18:33:97: + 8b:c2:6b:89:ee:60:3d:c8:9b:ef:7f:2b:32:62:73:93:cb:3c: + e3:7b:e2:76:78:45:bc:a1:93:04:bb:86:9f:3a:5b:43:7a:c3: + 8a:65 +MD5 Fingerprint=25:7A:BA:83:2E:B6:A2:0B:DA:FE:F5:02:0F:08:D7:AD +-----BEGIN CERTIFICATE----- +MIIDKTCCApKgAwIBAgIENnAVljANBgkqhkiG9w0BAQUFADBGMQswCQYDVQQGEwJV +UzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMREwDwYDVQQL +EwhEU1RDQSBFMTAeFw05ODEyMTAxODEwMjNaFw0xODEyMTAxODQwMjNaMEYxCzAJ +BgNVBAYTAlVTMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4x +ETAPBgNVBAsTCERTVENBIEUxMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQCg +bIGpzzQeJN3+hijM3oMv+V7UQtLodGBmE5gGHKlREmlvMVW5SXIACH7TpWJENySZ +j9mDSI+ZbZUTu0M7LklOiDfBu1h//uG9+LthzfNHwJmm8fOR6Hh8AMthyUQncWlV +Sn5JTe2io74CTADKAqjuAQIxZA9SLRN0dja1erQtcQIBA6OCASQwggEgMBEGCWCG +SAGG+EIBAQQEAwIABzBoBgNVHR8EYTBfMF2gW6BZpFcwVTELMAkGA1UEBhMCVVMx +JDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0IENvLjERMA8GA1UECxMI +RFNUQ0EgRTExDTALBgNVBAMTBENSTDEwKwYDVR0QBCQwIoAPMTk5ODEyMTAxODEw +MjNagQ8yMDE4MTIxMDE4MTAyM1owCwYDVR0PBAQDAgEGMB8GA1UdIwQYMBaAFGp5 +fpFpRhgTCgJ3pVlbYJglDqL4MB0GA1UdDgQWBBRqeX6RaUYYEwoCd6VZW2CYJQ6i ++DAMBgNVHRMEBTADAQH/MBkGCSqGSIb2fQdBAAQMMAobBFY0LjADAgSQMA0GCSqG +SIb3DQEBBQUAA4GBACIS2Hod3IEGtgllsofIH160L+nEHvI8wbsEkBFKg05+k7lN +QseSJqBcNJo4cvj9axY+IO6CizEqkzaFI4iKPANo08kJD038bKTaKHKTDomAsH3+ +gG9lbRgzl4vCa4nuYD3Im+9/KzJic5PLPON74nZ4RbyhkwS7hp86W0N6w4pl +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 913232846 (0x366ed3ce) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Digital Signature Trust Co., OU=DSTCA E2 + Validity + Not Before: Dec 9 19:17:26 1998 GMT + Not After : Dec 9 19:47:26 2018 GMT + Subject: C=US, O=Digital Signature Trust Co., OU=DSTCA E2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:bf:93:8f:17:92:ef:33:13:18:eb:10:7f:4e:16: + bf:ff:06:8f:2a:85:bc:5e:f9:24:a6:24:88:b6:03: + b7:c1:c3:5f:03:5b:d1:6f:ae:7e:42:ea:66:23:b8: + 63:83:56:fb:28:2d:e1:38:8b:b4:ee:a8:01:e1:ce: + 1c:b6:88:2a:22:46:85:fb:9f:a7:70:a9:47:14:3f: + ce:de:65:f0:a8:71:f7:4f:26:6c:8c:bc:c6:b5:ef: + de:49:27:ff:48:2a:7d:e8:4d:03:cc:c7:b2:52:c6: + 17:31:13:3b:b5:4d:db:c8:c4:f6:c3:0f:24:2a:da: + 0c:9d:e7:91:5b:80:cd:94:9d + Exponent: 3 (0x3) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=US/O=Digital Signature Trust Co./OU=DSTCA E2/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Dec 9 19:17:26 1998 GMT, Not After: Dec 9 19:17:26 2018 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:1E:82:4D:28:65:80:3C:C9:41:6E:AC:35:2E:5A:CB:DE:EE:F8:39:5B + + X509v3 Subject Key Identifier: + 1E:82:4D:28:65:80:3C:C9:41:6E:AC:35:2E:5A:CB:DE:EE:F8:39:5B + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0 +..V4.0.... + Signature Algorithm: sha1WithRSAEncryption + 47:8d:83:ad:62:f2:db:b0:9e:45:22:05:b9:a2:d6:03:0e:38: + 72:e7:9e:fc:7b:e6:93:b6:9a:a5:a2:94:c8:34:1d:91:d1:c5: + d7:f4:0a:25:0f:3d:78:81:9e:0f:b1:67:c4:90:4c:63:dd:5e: + a7:e2:ba:9f:f5:f7:4d:a5:31:7b:9c:29:2d:4c:fe:64:3e:ec: + b6:53:fe:ea:9b:ed:82:db:74:75:4b:07:79:6e:1e:d8:19:83: + 73:de:f5:3e:d0:b5:de:e7:4b:68:7d:43:2e:2a:20:e1:7e:a0: + 78:44:9e:08:f5:98:f9:c7:7f:1b:1b:d6:06:20:02:58:a1:c3: + a2:03 +MD5 Fingerprint=93:C2:8E:11:7B:D4:F3:03:19:BD:28:75:13:4A:45:4A +-----BEGIN CERTIFICATE----- +MIIDKTCCApKgAwIBAgIENm7TzjANBgkqhkiG9w0BAQUFADBGMQswCQYDVQQGEwJV +UzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMREwDwYDVQQL +EwhEU1RDQSBFMjAeFw05ODEyMDkxOTE3MjZaFw0xODEyMDkxOTQ3MjZaMEYxCzAJ +BgNVBAYTAlVTMSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4x +ETAPBgNVBAsTCERTVENBIEUyMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQC/ +k48Xku8zExjrEH9OFr//Bo8qhbxe+SSmJIi2A7fBw18DW9Fvrn5C6mYjuGODVvso +LeE4i7TuqAHhzhy2iCoiRoX7n6dwqUcUP87eZfCocfdPJmyMvMa1795JJ/9IKn3o +TQPMx7JSxhcxEzu1TdvIxPbDDyQq2gyd55FbgM2UnQIBA6OCASQwggEgMBEGCWCG +SAGG+EIBAQQEAwIABzBoBgNVHR8EYTBfMF2gW6BZpFcwVTELMAkGA1UEBhMCVVMx +JDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0IENvLjERMA8GA1UECxMI +RFNUQ0EgRTIxDTALBgNVBAMTBENSTDEwKwYDVR0QBCQwIoAPMTk5ODEyMDkxOTE3 +MjZagQ8yMDE4MTIwOTE5MTcyNlowCwYDVR0PBAQDAgEGMB8GA1UdIwQYMBaAFB6C +TShlgDzJQW6sNS5ay97u+DlbMB0GA1UdDgQWBBQegk0oZYA8yUFurDUuWsve7vg5 +WzAMBgNVHRMEBTADAQH/MBkGCSqGSIb2fQdBAAQMMAobBFY0LjADAgSQMA0GCSqG +SIb3DQEBBQUAA4GBAEeNg61i8tuwnkUiBbmi1gMOOHLnnvx75pO2mqWilMg0HZHR +xdf0CiUPPXiBng+xZ8SQTGPdXqfiup/1902lMXucKS1M/mQ+7LZT/uqb7YLbdHVL +B3luHtgZg3Pe9T7Qtd7nS2h9Qy4qIOF+oHhEngj1mPnHfxsb1gYgAlihw6ID +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + d0:1e:40:8b:00:00:02:7c:00:00:00:02:00:00:00:01 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=us, ST=Utah, L=Salt Lake City, O=Digital Signature Trust Co., OU=DSTCA X1, CN=DST RootCA X1/emailAddress=ca@digsigtrust.com + Validity + Not Before: Dec 1 18:18:55 1998 GMT + Not After : Nov 28 18:18:55 2008 GMT + Subject: C=us, ST=Utah, L=Salt Lake City, O=Digital Signature Trust Co., OU=DSTCA X1, CN=DST RootCA X1/emailAddress=ca@digsigtrust.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:d2:c6:26:b6:e7:a5:3d:c1:c4:68:d5:50:6f:53: + c5:6f:49:13:09:b8:af:2c:48:8d:14:6a:a3:17:5f: + 5a:f9:d3:2e:75:2f:d8:28:62:d1:93:2f:fc:4d:d4: + ab:87:e5:08:c7:99:e7:92:3f:75:bd:eb:25:b4:15: + c1:9b:19:3d:d2:44:8d:d7:74:20:6d:37:02:8f:69: + 93:5b:8a:c4:19:9d:f4:b2:0e:fc:16:6c:b9:b1:05: + 92:83:d1:85:2c:60:94:3e:45:55:a0:d9:ab:08:21: + e6:60:e8:3b:74:f2:99:50:51:68:d0:03:2d:b1:80: + be:a3:d8:52:b0:44:cd:43:4a:70:8e:58:85:95:e1: + 4e:2c:d6:2d:41:6f:d6:84:e7:c8:98:44:ca:47:db: + 2c:24:a5:69:26:cf:6b:b8:27:62:c3:f4:c9:7a:92: + 23:ed:13:67:82:ae:45:2e:45:e5:7e:72:3f:85:9d: + 94:62:10:e6:3c:91:a1:ad:77:00:e0:15:ec:f3:84: + 80:72:7a:8e:6e:60:97:c7:24:59:10:34:83:5b:e1: + a5:a4:69:b6:57:35:1c:78:59:c6:d3:2f:3a:73:67: + ee:94:ca:04:13:05:62:06:70:23:b3:f4:7c:ee:45: + d9:64:0b:5b:49:aa:a4:43:ce:26:c4:44:12:6c:b8: + dd:79 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + a2:37:b2:3f:69:fb:d7:86:79:54:49:31:95:33:2b:f3:d1:09: + 14:49:62:60:86:a5:b0:11:e2:50:c2:1d:06:57:3e:2d:e8:33: + 64:be:9b:aa:ad:5f:1b:4d:d4:99:95:a2:8b:9a:c9:62:72:b5: + 69:ea:d9:58:ab:35:ed:15:a2:43:d6:b6:bc:07:79:65:64:73: + 7d:d7:79:ca:7b:d5:5a:51:c6:e1:53:04:96:8d:38:cf:a3:17: + ac:39:71:6b:01:c3:8b:53:3c:63:e9:ee:79:c0:e4:be:92:32: + 64:7a:b3:1f:97:94:62:bd:ea:b2:20:15:95:fb:97:f2:78:2f: + 63:36:40:38:e3:46:0f:1d:dd:ac:95:ca:e7:4b:90:7b:b1:4b: + a9:d4:c5:eb:9a:da:aa:d5:a3:94:14:46:8d:2d:1f:f3:3a:d6: + 93:3a:f6:3e:79:fc:e8:e6:b0:75:ed:ee:3d:c9:70:c7:5d:aa: + 81:4b:46:25:1c:c7:6c:15:e3:95:4e:0f:aa:32:37:94:0a:17: + 24:92:13:84:58:d2:63:6f:2b:f7:e6:5b:62:0b:13:17:b0:0d: + 52:4c:fe:fe:6f:5c:e2:91:6e:1d:fd:a4:62:d7:68:fa:8e:7a: + 4f:d2:08:da:93:dc:f0:92:11:7a:d0:dc:72:93:0c:73:93:62: + 85:68:d0:f4 +MD5 Fingerprint=6C:C9:A7:6E:47:F1:0C:E3:53:3B:78:4C:4D:C2:6A:C5 +-----BEGIN CERTIFICATE----- +MIID2DCCAsACEQDQHkCLAAACfAAAAAIAAAABMA0GCSqGSIb3DQEBBQUAMIGpMQsw +CQYDVQQGEwJ1czENMAsGA1UECBMEVXRhaDEXMBUGA1UEBxMOU2FsdCBMYWtlIENp +dHkxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0IENvLjERMA8GA1UE +CxMIRFNUQ0EgWDExFjAUBgNVBAMTDURTVCBSb290Q0EgWDExITAfBgkqhkiG9w0B +CQEWEmNhQGRpZ3NpZ3RydXN0LmNvbTAeFw05ODEyMDExODE4NTVaFw0wODExMjgx +ODE4NTVaMIGpMQswCQYDVQQGEwJ1czENMAsGA1UECBMEVXRhaDEXMBUGA1UEBxMO +U2FsdCBMYWtlIENpdHkxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0 +IENvLjERMA8GA1UECxMIRFNUQ0EgWDExFjAUBgNVBAMTDURTVCBSb290Q0EgWDEx +ITAfBgkqhkiG9w0BCQEWEmNhQGRpZ3NpZ3RydXN0LmNvbTCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBANLGJrbnpT3BxGjVUG9TxW9JEwm4ryxIjRRqoxdf +WvnTLnUv2Chi0ZMv/E3Uq4flCMeZ55I/db3rJbQVwZsZPdJEjdd0IG03Ao9pk1uK +xBmd9LIO/BZsubEFkoPRhSxglD5FVaDZqwgh5mDoO3TymVBRaNADLbGAvqPYUrBE +zUNKcI5YhZXhTizWLUFv1oTnyJhEykfbLCSlaSbPa7gnYsP0yXqSI+0TZ4KuRS5F +5X5yP4WdlGIQ5jyRoa13AOAV7POEgHJ6jm5gl8ckWRA0g1vhpaRptlc1HHhZxtMv +OnNn7pTKBBMFYgZwI7P0fO5F2WQLW0mqpEPOJsREEmy43XkCAwEAATANBgkqhkiG +9w0BAQUFAAOCAQEAojeyP2n714Z5VEkxlTMr89EJFEliYIalsBHiUMIdBlc+Legz +ZL6bqq1fG03UmZWii5rJYnK1aerZWKs17RWiQ9a2vAd5ZWRzfdd5ynvVWlHG4VME +lo04z6MXrDlxawHDi1M8Y+nuecDkvpIyZHqzH5eUYr3qsiAVlfuX8ngvYzZAOONG +Dx3drJXK50uQe7FLqdTF65raqtWjlBRGjS0f8zrWkzr2Pnn86Oawde3uPclwx12q +gUtGJRzHbBXjlU4PqjI3lAoXJJIThFjSY28r9+ZbYgsTF7ANUkz+/m9c4pFuHf2k +Ytdo+o56T9II2pPc8JIRetDccpMMc5NihWjQ9A== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + d0:1e:40:8b:00:00:77:6d:00:00:00:01:00:00:00:04 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=us, ST=Utah, L=Salt Lake City, O=Digital Signature Trust Co., OU=DSTCA X2, CN=DST RootCA X2/emailAddress=ca@digsigtrust.com + Validity + Not Before: Nov 30 22:46:16 1998 GMT + Not After : Nov 27 22:46:16 2008 GMT + Subject: C=us, ST=Utah, L=Salt Lake City, O=Digital Signature Trust Co., OU=DSTCA X2, CN=DST RootCA X2/emailAddress=ca@digsigtrust.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:dc:75:f0:8c:c0:75:96:9a:c0:62:1f:26:f7:c4: + e1:9a:ea:e0:56:73:5b:99:cd:01:44:a8:08:b6:d5: + a7:da:1a:04:18:39:92:4a:78:a3:81:c2:f5:77:7a: + 50:b4:70:ff:9a:ab:c6:c7:ca:6e:83:4f:42:98:fb: + 26:0b:da:dc:6d:d6:a9:99:55:52:67:e9:28:03:92: + dc:e5:b0:05:9a:0f:15:f9:6b:59:72:56:f2:fa:39: + fc:aa:68:ee:0f:1f:10:83:2f:fc:9d:fa:17:96:dd: + 82:e3:e6:45:7d:c0:4b:80:44:1f:ed:2c:e0:84:fd: + 91:5c:92:54:69:25:e5:62:69:dc:e5:ee:00:52:bd: + 33:0b:ad:75:02:85:a7:64:50:2d:c5:19:19:30:c0: + 26:db:c9:d3:fd:2e:99:ad:59:b5:0b:4d:d4:41:ae: + 85:48:43:59:dc:b7:a8:e2:a2:de:c3:8f:d7:b8:a1: + 62:a6:68:50:52:e4:cf:31:a7:94:85:da:9f:46:32: + 17:56:e5:f2:eb:66:3d:12:ff:43:db:98:ef:77:cf: + cb:81:8d:34:b1:c6:50:4a:26:d1:e4:3e:41:50:af: + 6c:ae:22:34:2e:d5:6b:6e:83:ba:79:b8:76:65:48: + da:09:29:64:63:22:b9:fb:47:76:85:8c:86:44:cb: + 09:db + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + b5:36:0e:5d:e1:61:28:5a:11:65:c0:3f:83:03:79:4d:be:28: + a6:0b:07:02:52:85:cd:f8:91:d0:10:6c:b5:6a:20:5b:1c:90: + d9:30:3c:c6:48:9e:8a:5e:64:f9:a1:71:77:ef:04:27:1f:07: + eb:e4:26:f7:73:74:c9:44:18:1a:66:d3:e0:43:af:91:3b:d1: + cb:2c:d8:74:54:3a:1c:4d:ca:d4:68:cd:23:7c:1d:10:9e:45: + e9:f6:00:6e:a6:cd:19:ff:4f:2c:29:8f:57:4d:c4:77:92:be: + e0:4c:09:fb:5d:44:86:66:21:a8:b9:32:a2:56:d5:e9:8c:83: + 7c:59:3f:c4:f1:0b:e7:9d:ec:9e:bd:9c:18:0e:3e:c2:39:79: + 28:b7:03:0d:08:cb:c6:e7:d9:01:37:50:10:ec:cc:61:16:40: + d4:af:31:74:7b:fc:3f:31:a7:d0:47:73:33:39:1b:cc:4e:6a: + d7:49:83:11:06:fe:eb:82:58:33:32:4c:f0:56:ac:1e:9c:2f: + 56:9a:7b:c1:4a:1c:a5:fd:55:36:ce:fc:96:4d:f4:b0:f0:ec: + b7:6c:82:ed:2f:31:99:42:4c:a9:b2:0d:b8:15:5d:f1:df:ba: + c9:b5:4a:d4:64:98:b3:26:a9:30:c8:fd:a6:ec:ab:96:21:ad: + 7f:c2:78:b6 +MD5 Fingerprint=CD:3B:3D:62:5B:09:B8:09:36:87:9E:12:2F:71:64:BA +-----BEGIN CERTIFICATE----- +MIID2DCCAsACEQDQHkCLAAB3bQAAAAEAAAAEMA0GCSqGSIb3DQEBBQUAMIGpMQsw +CQYDVQQGEwJ1czENMAsGA1UECBMEVXRhaDEXMBUGA1UEBxMOU2FsdCBMYWtlIENp +dHkxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0IENvLjERMA8GA1UE +CxMIRFNUQ0EgWDIxFjAUBgNVBAMTDURTVCBSb290Q0EgWDIxITAfBgkqhkiG9w0B +CQEWEmNhQGRpZ3NpZ3RydXN0LmNvbTAeFw05ODExMzAyMjQ2MTZaFw0wODExMjcy +MjQ2MTZaMIGpMQswCQYDVQQGEwJ1czENMAsGA1UECBMEVXRhaDEXMBUGA1UEBxMO +U2FsdCBMYWtlIENpdHkxJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0 +IENvLjERMA8GA1UECxMIRFNUQ0EgWDIxFjAUBgNVBAMTDURTVCBSb290Q0EgWDIx +ITAfBgkqhkiG9w0BCQEWEmNhQGRpZ3NpZ3RydXN0LmNvbTCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBANx18IzAdZaawGIfJvfE4Zrq4FZzW5nNAUSoCLbV +p9oaBBg5kkp4o4HC9Xd6ULRw/5qrxsfKboNPQpj7Jgva3G3WqZlVUmfpKAOS3OWw +BZoPFflrWXJW8vo5/Kpo7g8fEIMv/J36F5bdguPmRX3AS4BEH+0s4IT9kVySVGkl +5WJp3OXuAFK9MwutdQKFp2RQLcUZGTDAJtvJ0/0uma1ZtQtN1EGuhUhDWdy3qOKi +3sOP17ihYqZoUFLkzzGnlIXan0YyF1bl8utmPRL/Q9uY73fPy4GNNLHGUEom0eQ+ +QVCvbK4iNC7Va26Dunm4dmVI2gkpZGMiuftHdoWMhkTLCdsCAwEAATANBgkqhkiG +9w0BAQUFAAOCAQEAtTYOXeFhKFoRZcA/gwN5Tb4opgsHAlKFzfiR0BBstWogWxyQ +2TA8xkieil5k+aFxd+8EJx8H6+Qm93N0yUQYGmbT4EOvkTvRyyzYdFQ6HE3K1GjN +I3wdEJ5F6fYAbqbNGf9PLCmPV03Ed5K+4EwJ+11EhmYhqLkyolbV6YyDfFk/xPEL +553snr2cGA4+wjl5KLcDDQjLxufZATdQEOzMYRZA1K8xdHv8PzGn0EdzMzkbzE5q +10mDEQb+64JYMzJM8FasHpwvVpp7wUocpf1VNs78lk30sPDst2yC7S8xmUJMqbIN +uBVd8d+6ybVK1GSYsyapMMj9puyrliGtf8J4tg== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + cd:ba:7f:56:f0:df:e4:bc:54:fe:22:ac:b3:72:aa:55 + Signature Algorithm: md2WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority + Validity + Not Before: Jan 29 00:00:00 1996 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:e5:19:bf:6d:a3:56:61:2d:99:48:71:f6:67:de: + b9:8d:eb:b7:9e:86:80:0a:91:0e:fa:38:25:af:46: + 88:82:e5:73:a8:a0:9b:24:5d:0d:1f:cc:65:6e:0c: + b0:d0:56:84:18:87:9a:06:9b:10:a1:73:df:b4:58: + 39:6b:6e:c1:f6:15:d5:a8:a8:3f:aa:12:06:8d:31: + ac:7f:b0:34:d7:8f:34:67:88:09:cd:14:11:e2:4e: + 45:56:69:1f:78:02:80:da:dc:47:91:29:bb:36:c9: + 63:5c:c5:e0:d7:2d:87:7b:a1:b7:32:b0:7b:30:ba: + 2a:2f:31:aa:ee:a3:67:da:db + Exponent: 65537 (0x10001) + Signature Algorithm: md2WithRSAEncryption + 4c:3f:b8:8b:c6:68:df:ee:43:33:0e:5d:e9:a6:cb:07:84:4d: + 7a:33:ff:92:1b:f4:36:ad:d8:95:22:36:68:11:6c:7c:42:cc: + f3:9c:2e:c4:07:3f:14:b0:0f:4f:ff:90:92:76:f9:e2:bc:4a: + e9:8f:cd:a0:80:0a:f7:c5:29:f1:82:22:5d:b8:b1:dd:81:23: + a3:7b:25:15:46:30:79:16:f8:ea:05:4b:94:7f:1d:c2:1c:c8: + e3:b7:f4:10:40:3c:13:c3:5f:1f:53:e8:48:e4:86:b4:7b:a1: + 35:b0:7b:25:ba:b8:d3:8e:ab:3f:38:9d:00:34:00:98:f3:d1: + 71:94 +MD5 Fingerprint=97:60:E8:57:5F:D3:50:47:E5:43:0C:94:36:8A:B0:62 +-----BEGIN CERTIFICATE----- +MIICPTCCAaYCEQDNun9W8N/kvFT+IqyzcqpVMA0GCSqGSIb3DQEBAgUAMF8xCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xh +c3MgMSBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05 +NjAxMjkwMDAwMDBaFw0yODA4MDEyMzU5NTlaMF8xCzAJBgNVBAYTAlVTMRcwFQYD +VQQKEw5WZXJpU2lnbiwgSW5jLjE3MDUGA1UECxMuQ2xhc3MgMSBQdWJsaWMgUHJp +bWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOB +jQAwgYkCgYEA5Rm/baNWYS2ZSHH2Z965jeu3noaACpEO+jglr0aIguVzqKCbJF0N +H8xlbgyw0FaEGIeaBpsQoXPftFg5a27B9hXVqKg/qhIGjTGsf7A01480Z4gJzRQR +4k5FVmkfeAKA2txHkSm7NsljXMXg1y2He6G3MrB7MLoqLzGq7qNn2tsCAwEAATAN +BgkqhkiG9w0BAQIFAAOBgQBMP7iLxmjf7kMzDl3ppssHhE16M/+SG/Q2rdiVIjZo +EWx8QszznC7EBz8UsA9P/5CSdvnivErpj82ggAr3xSnxgiJduLHdgSOjeyUVRjB5 +FvjqBUuUfx3CHMjjt/QQQDwTw18fU+hI5Ia0e6E1sHslurjTjqs/OJ0ANACY89Fx +lA== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 2d:1b:fc:4a:17:8d:a3:91:eb:e7:ff:f5:8b:45:be:0b + Signature Algorithm: md2WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 2 Public Primary Certification Authority + Validity + Not Before: Jan 29 00:00:00 1996 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 2 Public Primary Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:b6:5a:8b:a3:0d:6a:23:83:80:6b:cf:39:87:f4: + 21:13:33:06:4c:25:a2:ed:55:12:97:c5:a7:80:b9: + fa:83:c1:20:a0:fa:2f:15:0d:7c:a1:60:6b:7e:79: + 2c:fa:06:0f:3a:ae:f6:1b:6f:b1:d2:ff:2f:28:52: + 5f:83:7d:4b:c4:7a:b7:f8:66:1f:80:54:fc:b7:c2: + 8e:59:4a:14:57:46:d1:9a:93:be:41:91:03:bb:15: + 80:93:5c:eb:e7:cc:08:6c:3f:3e:b3:4a:fc:ff:4b: + 6c:23:d5:50:82:26:44:19:8e:23:c3:71:ea:19:24: + 47:04:9e:75:bf:c8:a6:00:1f + Exponent: 65537 (0x10001) + Signature Algorithm: md2WithRSAEncryption + 8a:1b:2b:fa:39:c1:74:d7:5e:d8:19:64:a2:58:4a:2d:37:e0: + 33:47:0f:ac:ed:f7:aa:db:1e:e4:8b:06:5c:60:27:ca:45:52: + ce:16:ef:3f:06:64:e7:94:68:7c:60:33:15:11:69:af:9d:62: + 8d:a3:03:54:6b:a6:be:e5:ee:05:18:60:04:bf:42:80:fd:d0: + a8:a8:1e:01:3b:f7:a3:5c:af:a3:dc:e6:26:80:23:3c:b8:44: + 74:f7:0a:ae:49:8b:61:78:cc:24:bf:88:8a:a7:0e:ea:73:19: + 41:fd:4d:03:f0:88:d1:e5:78:8d:a5:2a:4f:f6:97:0d:17:77: + ca:d8 +MD5 Fingerprint=B3:9C:25:B1:C3:2E:32:53:80:15:30:9D:4D:02:77:3E +-----BEGIN CERTIFICATE----- +MIICPDCCAaUCEC0b/EoXjaOR6+f/9YtFvgswDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz +cyAyIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 +MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV +BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAyIFB1YmxpYyBQcmlt +YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQC2WoujDWojg4BrzzmH9CETMwZMJaLtVRKXxaeAufqDwSCg+i8VDXyh +YGt+eSz6Bg86rvYbb7HS/y8oUl+DfUvEerf4Zh+AVPy3wo5ZShRXRtGak75BkQO7 +FYCTXOvnzAhsPz6zSvz/S2wj1VCCJkQZjiPDceoZJEcEnnW/yKYAHwIDAQABMA0G +CSqGSIb3DQEBAgUAA4GBAIobK/o5wXTXXtgZZKJYSi034DNHD6zt96rbHuSLBlxg +J8pFUs4W7z8GZOeUaHxgMxURaa+dYo2jA1Rrpr7l7gUYYAS/QoD90KioHgE796Nc +r6Pc5iaAIzy4RHT3Cq5Ji2F4zCS/iIqnDupzGUH9TQPwiNHleI2lKk/2lw0Xd8rY +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 70:ba:e4:1d:10:d9:29:34:b6:38:ca:7b:03:cc:ba:bf + Signature Algorithm: md2WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority + Validity + Not Before: Jan 29 00:00:00 1996 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c9:5c:59:9e:f2:1b:8a:01:14:b4:10:df:04:40: + db:e3:57:af:6a:45:40:8f:84:0c:0b:d1:33:d9:d9: + 11:cf:ee:02:58:1f:25:f7:2a:a8:44:05:aa:ec:03: + 1f:78:7f:9e:93:b9:9a:00:aa:23:7d:d6:ac:85:a2: + 63:45:c7:72:27:cc:f4:4c:c6:75:71:d2:39:ef:4f: + 42:f0:75:df:0a:90:c6:8e:20:6f:98:0f:f8:ac:23: + 5f:70:29:36:a4:c9:86:e7:b1:9a:20:cb:53:a5:85: + e7:3d:be:7d:9a:fe:24:45:33:dc:76:15:ed:0f:a2: + 71:64:4c:65:2e:81:68:45:a7 + Exponent: 65537 (0x10001) + Signature Algorithm: md2WithRSAEncryption + bb:4c:12:2b:cf:2c:26:00:4f:14:13:dd:a6:fb:fc:0a:11:84: + 8c:f3:28:1c:67:92:2f:7c:b6:c5:fa:df:f0:e8:95:bc:1d:8f: + 6c:2c:a8:51:cc:73:d8:a4:c0:53:f0:4e:d6:26:c0:76:01:57: + 81:92:5e:21:f1:d1:b1:ff:e7:d0:21:58:cd:69:17:e3:44:1c: + 9c:19:44:39:89:5c:dc:9c:00:0f:56:8d:02:99:ed:a2:90:45: + 4c:e4:bb:10:a4:3d:f0:32:03:0e:f1:ce:f8:e8:c9:51:8c:e6: + 62:9f:e6:9f:c0:7d:b7:72:9c:c9:36:3a:6b:9f:4e:a8:ff:64: + 0d:64 +MD5 Fingerprint=10:FC:63:5D:F6:26:3E:0D:F3:25:BE:5F:79:CD:67:67 +-----BEGIN CERTIFICATE----- +MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz +cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 +MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV +BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt +YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE +BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is +I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G +CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do +lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc +AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 4c:c7:ea:aa:98:3e:71:d3:93:10:f8:3d:3a:89:91:92 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Validity + Not Before: May 18 00:00:00 1998 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:aa:d0:ba:be:16:2d:b8:83:d4:ca:d2:0f:bc:76: + 31:ca:94:d8:1d:93:8c:56:02:bc:d9:6f:1a:6f:52: + 36:6e:75:56:0a:55:d3:df:43:87:21:11:65:8a:7e: + 8f:bd:21:de:6b:32:3f:1b:84:34:95:05:9d:41:35: + eb:92:eb:96:dd:aa:59:3f:01:53:6d:99:4f:ed:e5: + e2:2a:5a:90:c1:b9:c4:a6:15:cf:c8:45:eb:a6:5d: + 8e:9c:3e:f0:64:24:76:a5:cd:ab:1a:6f:b6:d8:7b: + 51:61:6e:a6:7f:87:c8:e2:b7:e5:34:dc:41:88:ea: + 09:40:be:73:92:3d:6b:e7:75 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + a9:4f:c3:0d:c7:67:be:2c:cb:d9:a8:cd:2d:75:e7:7e:15:9e: + 3b:72:eb:7e:eb:5c:2d:09:87:d6:6b:6d:60:7c:e5:ae:c5:90: + 23:0c:5c:4a:d0:af:b1:5d:f3:c7:b6:0a:db:e0:15:93:0d:dd: + 03:bc:c7:76:8a:b5:dd:4f:c3:9b:13:75:b8:01:c0:e6:c9:5b: + 6b:a5:b8:89:dc:ac:a4:dd:72:ed:4e:a1:f7:4f:bc:06:d3:ea: + c8:64:74:7b:c2:95:41:9c:65:73:58:f1:90:9a:3c:6a:b1:98: + c9:c4:87:bc:cf:45:6d:45:e2:6e:22:3f:fe:bc:0f:31:5c:e8: + f2:d9 +MD5 Fingerprint=DB:23:3D:F9:69:FA:4B:B9:95:80:44:73:5E:7D:41:83 +-----BEGIN CERTIFICATE----- +MIIDAjCCAmsCEEzH6qqYPnHTkxD4PTqJkZIwDQYJKoZIhvcNAQEFBQAwgcExCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh +c3MgMSBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy +MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp +emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X +DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMSBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo +YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 +MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQCq0Lq+Fi24g9TK0g+8djHKlNgdk4xWArzZbxpvUjZudVYK +VdPfQ4chEWWKfo+9Id5rMj8bhDSVBZ1BNeuS65bdqlk/AVNtmU/t5eIqWpDBucSm +Fc/IReumXY6cPvBkJHalzasab7bYe1FhbqZ/h8jit+U03EGI6glAvnOSPWvndQID +AQABMA0GCSqGSIb3DQEBBQUAA4GBAKlPww3HZ74sy9mozS11534Vnjty637rXC0J +h9ZrbWB85a7FkCMMXErQr7Fd88e2CtvgFZMN3QO8x3aKtd1Pw5sTdbgBwObJW2ul +uIncrKTdcu1OofdPvAbT6shkdHvClUGcZXNY8ZCaPGqxmMnEh7zPRW1F4m4iP/68 +DzFc6PLZ +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + b9:2f:60:cc:88:9f:a1:7a:46:09:b8:5b:70:6c:8a:af + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 2 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Validity + Not Before: May 18 00:00:00 1998 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 2 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:a7:88:01:21:74:2c:e7:1a:03:f0:98:e1:97:3c: + 0f:21:08:f1:9c:db:97:e9:9a:fc:c2:04:06:13:be: + 5f:52:c8:cc:1e:2c:12:56:2c:b8:01:69:2c:cc:99: + 1f:ad:b0:96:ae:79:04:f2:13:39:c1:7b:98:ba:08: + 2c:e8:c2:84:13:2c:aa:69:e9:09:f4:c7:a9:02:a4: + 42:c2:23:4f:4a:d8:f0:0e:a2:fb:31:6c:c9:e6:6f: + 99:27:07:f5:e6:f4:4c:78:9e:6d:eb:46:86:fa:b9: + 86:c9:54:f2:b2:c4:af:d4:46:1c:5a:c9:15:30:ff: + 0d:6c:f5:2d:0e:6d:ce:7f:77 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 72:2e:f9:7f:d1:f1:71:fb:c4:9e:f6:c5:5e:51:8a:40:98:b8: + 68:f8:9b:1c:83:d8:e2:9d:bd:ff:ed:a1:e6:66:ea:2f:09:f4: + ca:d7:ea:a5:2b:95:f6:24:60:86:4d:44:2e:83:a5:c4:2d:a0: + d3:ae:78:69:6f:72:da:6c:ae:08:f0:63:92:37:e6:bb:c4:30: + 17:ad:77:cc:49:35:aa:cf:d8:8f:d1:be:b7:18:96:47:73:6a: + 54:22:34:64:2d:b6:16:9b:59:5b:b4:51:59:3a:b3:0b:14:f4: + 12:df:67:a0:f4:ad:32:64:5e:b1:46:72:27:8c:12:7b:c5:44: + b4:ae +MD5 Fingerprint=2D:BB:E5:25:D3:D1:65:82:3A:B7:0E:FA:E6:EB:E2:E1 +-----BEGIN CERTIFICATE----- +MIIDAzCCAmwCEQC5L2DMiJ+hekYJuFtwbIqvMA0GCSqGSIb3DQEBBQUAMIHBMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xPDA6BgNVBAsTM0Ns +YXNzIDIgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH +MjE6MDgGA1UECxMxKGMpIDE5OTggVmVyaVNpZ24sIEluYy4gLSBGb3IgYXV0aG9y +aXplZCB1c2Ugb25seTEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazAe +Fw05ODA1MTgwMDAwMDBaFw0yODA4MDEyMzU5NTlaMIHBMQswCQYDVQQGEwJVUzEX +MBUGA1UEChMOVmVyaVNpZ24sIEluYy4xPDA6BgNVBAsTM0NsYXNzIDIgUHVibGlj +IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjE6MDgGA1UECxMx +KGMpIDE5OTggVmVyaVNpZ24sIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25s +eTEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEAp4gBIXQs5xoD8JjhlzwPIQjxnNuX6Zr8wgQGE75fUsjM +HiwSViy4AWkszJkfrbCWrnkE8hM5wXuYuggs6MKEEyyqaekJ9MepAqRCwiNPStjw +DqL7MWzJ5m+ZJwf15vRMeJ5t60aG+rmGyVTyssSv1EYcWskVMP8NbPUtDm3Of3cC +AwEAATANBgkqhkiG9w0BAQUFAAOBgQByLvl/0fFx+8Se9sVeUYpAmLho+Jscg9ji +nb3/7aHmZuovCfTK1+qlK5X2JGCGTUQug6XELaDTrnhpb3LabK4I8GOSN+a7xDAX +rXfMSTWqz9iP0b63GJZHc2pUIjRkLbYWm1lbtFFZOrMLFPQS32eg9K0yZF6xRnIn +jBJ7xUS0rg== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 7d:d9:fe:07:cf:a8:1e:b7:10:79:67:fb:a7:89:34:c6 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Validity + Not Before: May 18 00:00:00 1998 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:cc:5e:d1:11:5d:5c:69:d0:ab:d3:b9:6a:4c:99: + 1f:59:98:30:8e:16:85:20:46:6d:47:3f:d4:85:20: + 84:e1:6d:b3:f8:a4:ed:0c:f1:17:0f:3b:f9:a7:f9: + 25:d7:c1:cf:84:63:f2:7c:63:cf:a2:47:f2:c6:5b: + 33:8e:64:40:04:68:c1:80:b9:64:1c:45:77:c7:d8: + 6e:f5:95:29:3c:50:e8:34:d7:78:1f:a8:ba:6d:43: + 91:95:8f:45:57:5e:7e:c5:fb:ca:a4:04:eb:ea:97: + 37:54:30:6f:bb:01:47:32:33:cd:dc:57:9b:64:69: + 61:f8:9b:1d:1c:89:4f:5c:67 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 51:4d:cd:be:5c:cb:98:19:9c:15:b2:01:39:78:2e:4d:0f:67: + 70:70:99:c6:10:5a:94:a4:53:4d:54:6d:2b:af:0d:5d:40:8b: + 64:d3:d7:ee:de:56:61:92:5f:a6:c4:1d:10:61:36:d3:2c:27: + 3c:e8:29:09:b9:11:64:74:cc:b5:73:9f:1c:48:a9:bc:61:01: + ee:e2:17:a6:0c:e3:40:08:3b:0e:e7:eb:44:73:2a:9a:f1:69: + 92:ef:71:14:c3:39:ac:71:a7:91:09:6f:e4:71:06:b3:ba:59: + 57:26:79:00:f6:f8:0d:a2:33:30:28:d4:aa:58:a0:9d:9d:69: + 91:fd +MD5 Fingerprint=A2:33:9B:4C:74:78:73:D4:6C:E7:C1:F3:8D:CB:5C:E9 +-----BEGIN CERTIFICATE----- +MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh +c3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy +MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp +emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X +DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo +YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 +MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCOFoUgRm1HP9SFIIThbbP4 +pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71lSk8UOg0 +13gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwID +AQABMA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSk +U01UbSuvDV1Ai2TT1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7i +F6YM40AIOw7n60RzKprxaZLvcRTDOaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpY +oJ2daZH9 +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 32:88:8e:9a:d2:f5:eb:13:47:f8:7f:c4:20:37:25:f8 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 4 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Validity + Not Before: May 18 00:00:00 1998 GMT + Not After : Aug 1 23:59:59 2028 GMT + Subject: C=US, O=VeriSign, Inc., OU=Class 4 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ba:f0:e4:cf:f9:c4:ae:85:54:b9:07:57:f9:8f: + c5:7f:68:11:f8:c4:17:b0:44:dc:e3:30:73:d5:2a: + 62:2a:b8:d0:cc:1c:ed:28:5b:7e:bd:6a:dc:b3:91: + 24:ca:41:62:3c:fc:02:01:bf:1c:16:31:94:05:97: + 76:6e:a2:ad:bd:61:17:6c:4e:30:86:f0:51:37:2a: + 50:c7:a8:62:81:dc:5b:4a:aa:c1:a0:b4:6e:eb:2f: + e5:57:c5:b1:2b:40:70:db:5a:4d:a1:8e:1f:bd:03: + 1f:d8:03:d4:8f:4c:99:71:bc:e2:82:cc:58:e8:98: + 3a:86:d3:86:38:f3:00:29:1f + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 85:8c:12:c1:a7:b9:50:15:7a:cb:3e:ac:b8:43:8a:dc:aa:dd: + 14:ba:89:81:7e:01:3c:23:71:21:88:2f:82:dc:63:fa:02:45: + ac:45:59:d7:2a:58:44:5b:b7:9f:81:3b:92:68:3d:e2:37:24: + f5:7b:6c:8f:76:35:96:09:a8:59:9d:b9:ce:23:ab:74:d6:83: + fd:32:73:27:d8:69:3e:43:74:f6:ae:c5:89:9a:e7:53:7c:e9: + 7b:f6:4b:f3:c1:65:83:de:8d:8a:9c:3c:88:8d:39:59:fc:aa: + 3f:22:8d:a1:c1:66:50:81:72:4c:ed:22:64:4f:4f:ca:80:91: + b6:29 +MD5 Fingerprint=26:6D:2C:19:98:B6:70:68:38:50:54:19:EC:90:34:60 +-----BEGIN CERTIFICATE----- +MIIDAjCCAmsCEDKIjprS9esTR/h/xCA3JfgwDQYJKoZIhvcNAQEFBQAwgcExCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh +c3MgNCBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy +MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp +emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X +DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw +FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgNCBQdWJsaWMg +UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo +YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 +MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQC68OTP+cSuhVS5B1f5j8V/aBH4xBewRNzjMHPVKmIquNDM +HO0oW369atyzkSTKQWI8/AIBvxwWMZQFl3Zuoq29YRdsTjCG8FE3KlDHqGKB3FtK +qsGgtG7rL+VXxbErQHDbWk2hjh+9Ax/YA9SPTJlxvOKCzFjomDqG04Y48wApHwID +AQABMA0GCSqGSIb3DQEBBQUAA4GBAIWMEsGnuVAVess+rLhDityq3RS6iYF+ATwj +cSGIL4LcY/oCRaxFWdcqWERbt5+BO5JoPeI3JPV7bI92NZYJqFmduc4jq3TWg/0y +cyfYaT5DdPauxYma51N86Xv2S/PBZYPejYqcPIiNOVn8qj8ijaHBZlCBckztImRP +T8qAkbYp +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 02:00:00:00:00:00:d6:78:b7:94:05 + Signature Algorithm: md5WithRSAEncryption + Issuer: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA + Validity + Not Before: Sep 1 12:00:00 1998 GMT + Not After : Jan 28 12:00:00 2014 GMT + Subject: C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:da:0e:e6:99:8d:ce:a3:e3:4f:8a:7e:fb:f1:8b: + 83:25:6b:ea:48:1f:f1:2a:b0:b9:95:11:04:bd:f0: + 63:d1:e2:67:66:cf:1c:dd:cf:1b:48:2b:ee:8d:89: + 8e:9a:af:29:80:65:ab:e9:c7:2d:12:cb:ab:1c:4c: + 70:07:a1:3d:0a:30:cd:15:8d:4f:f8:dd:d4:8c:50: + 15:1c:ef:50:ee:c4:2e:f7:fc:e9:52:f2:91:7d:e0: + 6d:d5:35:30:8e:5e:43:73:f2:41:e9:d5:6a:e3:b2: + 89:3a:56:39:38:6f:06:3c:88:69:5b:2a:4d:c5:a7: + 54:b8:6c:89:cc:9b:f9:3c:ca:e5:fd:89:f5:12:3c: + 92:78:96:d6:dc:74:6e:93:44:61:d1:8d:c7:46:b2: + 75:0e:86:e8:19:8a:d5:6d:6c:d5:78:16:95:a2:e9: + c8:0a:38:eb:f2:24:13:4f:73:54:93:13:85:3a:1b: + bc:1e:34:b5:8b:05:8c:b9:77:8b:b1:db:1f:20:91: + ab:09:53:6e:90:ce:7b:37:74:b9:70:47:91:22:51: + 63:16:79:ae:b1:ae:41:26:08:c8:19:2b:d1:46:aa: + 48:d6:64:2a:d7:83:34:ff:2c:2a:c1:6c:19:43:4a: + 07:85:e7:d3:7c:f6:21:68:ef:ea:f2:52:9f:7f:93: + 90:cf + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 60:7B:66:1A:45:0D:97:CA:89:50:2F:7D:04:CD:34:A8:FF:FC:FD:4B + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + ae:aa:9f:fc:b7:d2:cb:1f:5f:39:29:28:18:9e:34:c9:6c:4f: + 6f:1a:f0:64:a2:70:4a:4f:13:86:9b:60:28:9e:e8:81:49:98: + 7d:0a:bb:e5:b0:9d:3d:36:db:8f:05:51:ff:09:31:2a:1f:dd: + 89:77:9e:0f:2e:6c:95:04:ed:86:cb:b4:00:3f:84:02:4d:80: + 6a:2a:2d:78:0b:ae:6f:2b:a2:83:44:83:1f:cd:50:82:4c:24: + af:bd:f7:a5:b4:c8:5a:0f:f4:e7:47:5e:49:8e:37:96:fe:9a: + 88:05:3a:d9:c0:db:29:87:e6:19:96:47:a7:3a:a6:8c:8b:3c: + 77:fe:46:63:a7:53:da:21:d1:ac:7e:49:a2:4b:e6:c3:67:59: + 2f:b3:8a:0e:bb:2c:bd:a9:aa:42:7c:35:c1:d8:7f:d5:a7:31: + 3a:4e:63:43:39:af:08:b0:61:34:8c:d3:98:a9:43:34:f6:0f: + 87:29:3b:9d:c2:56:58:98:77:c3:f7:1b:ac:f6:9d:f8:3e:aa: + a7:54:45:f0:f5:f9:d5:31:65:fe:6b:58:9c:71:b3:1e:d7:52: + ea:32:17:fc:40:60:1d:c9:79:24:b2:f6:6c:fd:a8:66:0e:82: + dd:98:cb:da:c2:44:4f:2e:a0:7b:f2:f7:6b:2c:76:11:84:46: + 8a:78:a3:e3 +MD5 Fingerprint=AB:BF:EA:E3:6B:29:A6:CC:A6:78:35:99:EF:AD:2B:80 +-----BEGIN CERTIFICATE----- +MIIDdTCCAl2gAwIBAgILAgAAAAAA1ni3lAUwDQYJKoZIhvcNAQEEBQAwVzELMAkG +A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv +b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw +MDBaFw0xNDAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i +YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT +aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ +jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp +xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp +1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG +snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ +U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 +9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIABjAdBgNVHQ4EFgQU +YHtmGkUNl8qJUC99BM00qP/8/UswDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B +AQQFAAOCAQEArqqf/LfSyx9fOSkoGJ40yWxPbxrwZKJwSk8ThptgKJ7ogUmYfQq7 +5bCdPTbbjwVR/wkxKh/diXeeDy5slQTthsu0AD+EAk2AaioteAuubyuig0SDH81Q +gkwkr733pbTIWg/050deSY43lv6aiAU62cDbKYfmGZZHpzqmjIs8d/5GY6dT2iHR +rH5Jokvmw2dZL7OKDrssvamqQnw1wdh/1acxOk5jQzmvCLBhNIzTmKlDNPYPhyk7 +ncJWWJh3w/cbrPad+D6qp1RF8PX51TFl/mtYnHGzHtdS6jIX/EBgHcl5JLL2bP2o +Zg6C3ZjL2sJETy6ge/L3ayx2EYRGinij4w== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 1 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Validity + Not Before: Jun 25 22:23:48 1999 GMT + Not After : Jun 25 22:23:48 2019 GMT + Subject: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 1 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d8:59:82:7a:89:b8:96:ba:a6:2f:68:6f:58:2e: + a7:54:1c:06:6e:f4:ea:8d:48:bc:31:94:17:f0:f3: + 4e:bc:b2:b8:35:92:76:b0:d0:a5:a5:01:d7:00:03: + 12:22:19:08:f8:ff:11:23:9b:ce:07:f5:bf:69:1a: + 26:fe:4e:e9:d1:7f:9d:2c:40:1d:59:68:6e:a6:f8: + 58:b0:9d:1a:8f:d3:3f:f1:dc:19:06:81:a8:0e:e0: + 3a:dd:c8:53:45:09:06:e6:0f:70:c3:fa:40:a6:0e: + e2:56:05:0f:18:4d:fc:20:82:d1:73:55:74:8d:76: + 72:a0:1d:9d:1d:c0:dd:3f:71 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 50:68:3d:49:f4:2c:1c:06:94:df:95:60:7f:96:7b:17:fe:4f: + 71:ad:64:c8:dd:77:d2:ef:59:55:e8:3f:e8:8e:05:2a:21:f2: + 07:d2:b5:a7:52:fe:9c:b1:b6:e2:5b:77:17:40:ea:72:d6:23: + cb:28:81:32:c3:00:79:18:ec:59:17:89:c9:c6:6a:1e:71:c9: + fd:b7:74:a5:25:45:69:c5:48:ab:19:e1:45:8a:25:6b:19:ee: + e5:bb:12:f5:7f:f7:a6:8d:51:c3:f0:9d:74:b7:a9:3e:a0:a5: + ff:b6:49:03:13:da:22:cc:ed:71:82:2b:99:cf:3a:b7:f5:2d: + 72:c8 +MD5 Fingerprint=65:58:AB:15:AD:57:6C:1E:A8:A7:B5:69:AC:BF:FF:EB +-----BEGIN CERTIFICATE----- +MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 +IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz +BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y +aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG +9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNTIyMjM0OFoXDTE5MDYy +NTIyMjM0OFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y +azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs +YXNzIDEgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw +Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl +cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDYWYJ6ibiWuqYvaG9Y +LqdUHAZu9OqNSLwxlBfw8068srg1knaw0KWlAdcAAxIiGQj4/xEjm84H9b9pGib+ +TunRf50sQB1ZaG6m+FiwnRqP0z/x3BkGgagO4DrdyFNFCQbmD3DD+kCmDuJWBQ8Y +TfwggtFzVXSNdnKgHZ0dwN0/cQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFBoPUn0 +LBwGlN+VYH+Wexf+T3GtZMjdd9LvWVXoP+iOBSoh8gfStadS/pyxtuJbdxdA6nLW +I8sogTLDAHkY7FkXicnGah5xyf23dKUlRWnFSKsZ4UWKJWsZ7uW7EvV/96aNUcPw +nXS3qT6gpf+2SQMT2iLM7XGCK5nPOrf1LXLI +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 2 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Validity + Not Before: Jun 26 00:19:54 1999 GMT + Not After : Jun 26 00:19:54 2019 GMT + Subject: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 2 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ce:3a:71:ca:e5:ab:c8:59:92:55:d7:ab:d8:74: + 0e:f9:ee:d9:f6:55:47:59:65:47:0e:05:55:dc:eb: + 98:36:3c:5c:53:5d:d3:30:cf:38:ec:bd:41:89:ed: + 25:42:09:24:6b:0a:5e:b3:7c:dd:52:2d:4c:e6:d4: + d6:7d:5a:59:a9:65:d4:49:13:2d:24:4d:1c:50:6f: + b5:c1:85:54:3b:fe:71:e4:d3:5c:42:f9:80:e0:91: + 1a:0a:5b:39:36:67:f3:3f:55:7c:1b:3f:b4:5f:64: + 73:34:e3:b4:12:bf:87:64:f8:da:12:ff:37:27:c1: + b3:43:bb:ef:7b:6e:2e:69:f7 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 3b:7f:50:6f:6f:50:94:99:49:62:38:38:1f:4b:f8:a5:c8:3e: + a7:82:81:f6:2b:c7:e8:c5:ce:e8:3a:10:82:cb:18:00:8e:4d: + bd:a8:58:7f:a1:79:00:b5:bb:e9:8d:af:41:d9:0f:34:ee:21: + 81:19:a0:32:49:28:f4:c4:8e:56:d5:52:33:fd:50:d5:7e:99: + 6c:03:e4:c9:4c:fc:cb:6c:ab:66:b3:4a:21:8c:e5:b5:0c:32: + 3e:10:b2:cc:6c:a1:dc:9a:98:4c:02:5b:f3:ce:b9:9e:a5:72: + 0e:4a:b7:3f:3c:e6:16:68:f8:be:ed:74:4c:bc:5b:d5:62:1f: + 43:dd +MD5 Fingerprint=A9:23:75:9B:BA:49:36:6E:31:C2:DB:F2:E7:66:BA:87 +-----BEGIN CERTIFICATE----- +MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 +IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz +BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y +aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG +9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE5MDYy +NjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y +azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs +YXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw +Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl +cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5avIWZJV16vY +dA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zfN1SLUzm1NZ9 +WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwbP7RfZHM047QS +v4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQUAA4GBADt/UG9v +UJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQC1u+mNr0HZDzTu +IYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMMj4QssxsodyamEwC +W/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 3 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Validity + Not Before: Jun 26 00:22:33 1999 GMT + Not After : Jun 26 00:22:33 2019 GMT + Subject: L=ValiCert Validation Network, O=ValiCert, Inc., OU=ValiCert Class 3 Policy Validation Authority, CN=http://www.valicert.com//emailAddress=info@valicert.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:e3:98:51:96:1c:e8:d5:b1:06:81:6a:57:c3:72: + 75:93:ab:cf:9e:a6:fc:f3:16:52:d6:2d:4d:9f:35: + 44:a8:2e:04:4d:07:49:8a:38:29:f5:77:37:e7:b7: + ab:5d:df:36:71:14:99:8f:dc:c2:92:f1:e7:60:92: + 97:ec:d8:48:dc:bf:c1:02:20:c6:24:a4:28:4c:30: + 5a:76:6d:b1:5c:f3:dd:de:9e:10:71:a1:88:c7:5b: + 9b:41:6d:ca:b0:b8:8e:15:ee:ad:33:2b:cf:47:04: + 5c:75:71:0a:98:24:98:29:a7:49:59:a5:dd:f8:b7: + 43:62:61:f3:d3:e2:d0:55:3f + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 56:bb:02:58:84:67:08:2c:df:1f:db:7b:49:33:f5:d3:67:9d: + f4:b4:0a:10:b3:c9:c5:2c:e2:92:6a:71:78:27:f2:70:83:42: + d3:3e:cf:a9:54:f4:f1:d8:92:16:8c:d1:04:cb:4b:ab:c9:9f: + 45:ae:3c:8a:a9:b0:71:33:5d:c8:c5:57:df:af:a8:35:b3:7f: + 89:87:e9:e8:25:92:b8:7f:85:7a:ae:d6:bc:1e:37:58:2a:67: + c9:91:cf:2a:81:3e:ed:c6:39:df:c0:3e:19:9c:19:cc:13:4d: + 82:41:b5:8c:de:e0:3d:60:08:20:0f:45:7e:6b:a2:7f:a3:8c: + 15:ee +MD5 Fingerprint=A2:6F:53:B7:EE:40:DB:4A:68:E7:FA:18:D9:10:4B:72 +-----BEGIN CERTIFICATE----- +MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0 +IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAz +BgNVBAsTLFZhbGlDZXJ0IENsYXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9y +aXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG +9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMjIzM1oXDTE5MDYy +NjAwMjIzM1owgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29y +azEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENs +YXNzIDMgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRw +Oi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNl +cnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDjmFGWHOjVsQaBalfD +cnWTq8+epvzzFlLWLU2fNUSoLgRNB0mKOCn1dzfnt6td3zZxFJmP3MKS8edgkpfs +2Ejcv8ECIMYkpChMMFp2bbFc893enhBxoYjHW5tBbcqwuI4V7q0zK89HBFx1cQqY +JJgpp0lZpd34t0NiYfPT4tBVPwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFa7AliE +Zwgs3x/be0kz9dNnnfS0ChCzycUs4pJqcXgn8nCDQtM+z6lU9PHYkhaM0QTLS6vJ +n0WuPIqpsHEzXcjFV9+vqDWzf4mH6eglkrh/hXqu1rweN1gqZ8mRzyqBPu3GOd/A +PhmcGcwTTYJBtYze4D1gCCAPRX5ron+jjBXu +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 8b:5b:75:56:84:54:85:0b:00:cf:af:38:48:ce:b1:a4 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 1 Public Primary Certification Authority - G3 + Validity + Not Before: Oct 1 00:00:00 1999 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 1 Public Primary Certification Authority - G3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:dd:84:d4:b9:b4:f9:a7:d8:f3:04:78:9c:de:3d: + dc:6c:13:16:d9:7a:dd:24:51:66:c0:c7:26:59:0d: + ac:06:08:c2:94:d1:33:1f:f0:83:35:1f:6e:1b:c8: + de:aa:6e:15:4e:54:27:ef:c4:6d:1a:ec:0b:e3:0e: + f0:44:a5:57:c7:40:58:1e:a3:47:1f:71:ec:60:f6: + 6d:94:c8:18:39:ed:fe:42:18:56:df:e4:4c:49:10: + 78:4e:01:76:35:63:12:36:dd:66:bc:01:04:36:a3: + 55:68:d5:a2:36:09:ac:ab:21:26:54:06:ad:3f:ca: + 14:e0:ac:ca:ad:06:1d:95:e2:f8:9d:f1:e0:60:ff: + c2:7f:75:2b:4c:cc:da:fe:87:99:21:ea:ba:fe:3e: + 54:d7:d2:59:78:db:3c:6e:cf:a0:13:00:1a:b8:27: + a1:e4:be:67:96:ca:a0:c5:b3:9c:dd:c9:75:9e:eb: + 30:9a:5f:a3:cd:d9:ae:78:19:3f:23:e9:5c:db:29: + bd:ad:55:c8:1b:54:8c:63:f6:e8:a6:ea:c7:37:12: + 5c:a3:29:1e:02:d9:db:1f:3b:b4:d7:0f:56:47:81: + 15:04:4a:af:83:27:d1:c5:58:88:c1:dd:f6:aa:a7: + a3:18:da:68:aa:6d:11:51:e1:bf:65:6b:9f:96:76: + d1:3d + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + ab:66:8d:d7:b3:ba:c7:9a:b6:e6:55:d0:05:f1:9f:31:8d:5a: + aa:d9:aa:46:26:0f:71:ed:a5:ad:53:56:62:01:47:2a:44:e9: + fe:3f:74:0b:13:9b:b9:f4:4d:1b:b2:d1:5f:b2:b6:d2:88:5c: + b3:9f:cd:cb:d4:a7:d9:60:95:84:3a:f8:c1:37:1d:61:ca:e7: + b0:c5:e5:91:da:54:a6:ac:31:81:ae:97:de:cd:08:ac:b8:c0: + 97:80:7f:6e:72:a4:e7:69:13:95:65:1f:c4:93:3c:fd:79:8f: + 04:d4:3e:4f:ea:f7:9e:ce:cd:67:7c:4f:65:02:ff:91:85:54: + 73:c7:ff:36:f7:86:2d:ec:d0:5e:4f:ff:11:9f:72:06:d6:b8: + 1a:f1:4c:0d:26:65:e2:44:80:1e:c7:9f:e3:dd:e8:0a:da:ec: + a5:20:80:69:68:a1:4f:7e:e1:6b:cf:07:41:fa:83:8e:bc:38: + dd:b0:2e:11:b1:6b:b2:42:cc:9a:bc:f9:48:22:79:4a:19:0f: + b2:1c:3e:20:74:d9:6a:c3:be:f2:28:78:13:56:79:4f:6d:50: + ea:1b:b0:b5:57:b1:37:66:58:23:f3:dc:0f:df:0a:87:c4:ef: + 86:05:d5:38:14:60:99:a3:4b:de:06:96:71:2c:f2:db:b6:1f: + a4:ef:3f:ee +MD5 Fingerprint=B1:47:BC:18:57:D1:18:A0:78:2D:EC:71:E8:2A:95:73 +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQCLW3VWhFSFCwDPrzhIzrGkMA0GCSqGSIb3DQEBBQUAMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl +cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu +LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT +aWduIENsYXNzIDEgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD +VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ +bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu +IENsYXNzIDEgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg +LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN2E1Lm0+afY8wR4 +nN493GwTFtl63SRRZsDHJlkNrAYIwpTRMx/wgzUfbhvI3qpuFU5UJ+/EbRrsC+MO +8ESlV8dAWB6jRx9x7GD2bZTIGDnt/kIYVt/kTEkQeE4BdjVjEjbdZrwBBDajVWjV +ojYJrKshJlQGrT/KFOCsyq0GHZXi+J3x4GD/wn91K0zM2v6HmSHquv4+VNfSWXjb +PG7PoBMAGrgnoeS+Z5bKoMWznN3JdZ7rMJpfo83ZrngZPyPpXNspva1VyBtUjGP2 +6KbqxzcSXKMpHgLZ2x87tNcPVkeBFQRKr4Mn0cVYiMHd9qqnoxjaaKptEVHhv2Vr +n5Z20T0CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAq2aN17O6x5q25lXQBfGfMY1a +qtmqRiYPce2lrVNWYgFHKkTp/j90CxObufRNG7LRX7K20ohcs5/Ny9Sn2WCVhDr4 +wTcdYcrnsMXlkdpUpqwxga6X3s0IrLjAl4B/bnKk52kTlWUfxJM8/XmPBNQ+T+r3 +ns7NZ3xPZQL/kYVUc8f/NveGLezQXk//EZ9yBta4GvFMDSZl4kSAHsef493oCtrs +pSCAaWihT37ha88HQfqDjrw43bAuEbFrskLMmrz5SCJ5ShkPshw+IHTZasO+8ih4 +E1Z5T21Q6huwtVexN2ZYI/PcD98Kh8TvhgXVOBRgmaNL3gaWcSzy27YfpO8/7g== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 61:70:cb:49:8c:5f:98:45:29:e7:b0:a6:d9:50:5b:7a + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 2 Public Primary Certification Authority - G3 + Validity + Not Before: Oct 1 00:00:00 1999 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 2 Public Primary Certification Authority - G3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:af:0a:0d:c2:d5:2c:db:67:b9:2d:e5:94:27:dd: + a5:be:e0:b0:4d:8f:b3:61:56:3c:d6:7c:c3:f4:cd: + 3e:86:cb:a2:88:e2:e1:d8:a4:69:c5:b5:e2:bf:c1: + a6:47:50:5e:46:39:8b:d5:96:ba:b5:6f:14:bf:10: + ce:27:13:9e:05:47:9b:31:7a:13:d8:1f:d9:d3:02: + 37:8b:ad:2c:47:f0:8e:81:06:a7:0d:30:0c:eb:f7: + 3c:0f:20:1d:dc:72:46:ee:a5:02:c8:5b:c3:c9:56: + 69:4c:c5:18:c1:91:7b:0b:d5:13:00:9b:bc:ef:c3: + 48:3e:46:60:20:85:2a:d5:90:b6:cd:8b:a0:cc:32: + dd:b7:fd:40:55:b2:50:1c:56:ae:cc:8d:77:4d:c7: + 20:4d:a7:31:76:ef:68:92:8a:90:1e:08:81:56:b2: + ad:69:a3:52:d0:cb:1c:c4:23:3d:1f:99:fe:4c:e8: + 16:63:8e:c6:08:8e:f6:31:f6:d2:fa:e5:76:dd:b5: + 1c:92:a3:49:cd:cd:01:cd:68:cd:a9:69:ba:a3:eb: + 1d:0d:9c:a4:20:a6:c1:a0:c5:d1:46:4c:17:6d:d2: + ac:66:3f:96:8c:e0:84:d4:36:ff:22:59:c5:f9:11: + 60:a8:5f:04:7d:f2:1a:f6:25:42:61:0f:c4:4a:b8: + 3e:89 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 34:26:15:3c:c0:8d:4d:43:49:1d:bd:e9:21:92:d7:66:9c:b7: + de:c5:b8:d0:e4:5d:5f:76:22:c0:26:f9:84:3a:3a:f9:8c:b5: + fb:ec:60:f1:e8:ce:04:b0:c8:dd:a7:03:8f:30:f3:98:df:a4: + e6:a4:31:df:d3:1c:0b:46:dc:72:20:3f:ae:ee:05:3c:a4:33: + 3f:0b:39:ac:70:78:73:4b:99:2b:df:30:c2:54:b0:a8:3b:55: + a1:fe:16:28:cd:42:bd:74:6e:80:db:27:44:a7:ce:44:5d:d4: + 1b:90:98:0d:1e:42:94:b1:00:2c:04:d0:74:a3:02:05:22:63: + 63:cd:83:b5:fb:c1:6d:62:6b:69:75:fd:5d:70:41:b9:f5:bf: + 7c:df:be:c1:32:73:22:21:8b:58:81:7b:15:91:7a:ba:e3:64: + 48:b0:7f:fb:36:25:da:95:d0:f1:24:14:17:dd:18:80:6b:46: + 23:39:54:f5:8e:62:09:04:1d:94:90:a6:9b:e6:25:e2:42:45: + aa:b8:90:ad:be:08:8f:a9:0b:42:18:94:cf:72:39:e1:b1:43: + e0:28:cf:b7:e7:5a:6c:13:6b:49:b3:ff:e3:18:7c:89:8b:33: + 5d:ac:33:d7:a7:f9:da:3a:55:c9:58:10:f9:aa:ef:5a:b6:cf: + 4b:4b:df:2a +MD5 Fingerprint=F8:BE:C4:63:22:C9:A8:46:74:8B:B8:1D:1E:4A:2B:F6 +-----BEGIN CERTIFICATE----- +MIIEGTCCAwECEGFwy0mMX5hFKeewptlQW3owDQYJKoZIhvcNAQEFBQAwgcoxCzAJ +BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UECxMWVmVy +aVNpZ24gVHJ1c3QgTmV0d29yazE6MDgGA1UECxMxKGMpIDE5OTkgVmVyaVNpZ24s +IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTFFMEMGA1UEAxM8VmVyaVNp +Z24gQ2xhc3MgMiBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 +eSAtIEczMB4XDTk5MTAwMTAwMDAwMFoXDTM2MDcxNjIzNTk1OVowgcoxCzAJBgNV +BAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UECxMWVmVyaVNp +Z24gVHJ1c3QgTmV0d29yazE6MDgGA1UECxMxKGMpIDE5OTkgVmVyaVNpZ24sIElu +Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTFFMEMGA1UEAxM8VmVyaVNpZ24g +Q2xhc3MgMiBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt +IEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArwoNwtUs22e5LeWU +J92lvuCwTY+zYVY81nzD9M0+hsuiiOLh2KRpxbXiv8GmR1BeRjmL1Za6tW8UvxDO +JxOeBUebMXoT2B/Z0wI3i60sR/COgQanDTAM6/c8DyAd3HJG7qUCyFvDyVZpTMUY +wZF7C9UTAJu878NIPkZgIIUq1ZC2zYugzDLdt/1AVbJQHFauzI13TccgTacxdu9o +koqQHgiBVrKtaaNS0MscxCM9H5n+TOgWY47GCI72MfbS+uV23bUckqNJzc0BzWjN +qWm6o+sdDZykIKbBoMXRRkwXbdKsZj+WjOCE1Db/IlnF+RFgqF8EffIa9iVCYQ/E +Srg+iQIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQA0JhU8wI1NQ0kdvekhktdmnLfe +xbjQ5F1fdiLAJvmEOjr5jLX77GDx6M4EsMjdpwOPMPOY36TmpDHf0xwLRtxyID+u +7gU8pDM/CzmscHhzS5kr3zDCVLCoO1Wh/hYozUK9dG6A2ydEp85EXdQbkJgNHkKU +sQAsBNB0owIFImNjzYO1+8FtYmtpdf1dcEG59b98377BMnMiIYtYgXsVkXq642RI +sH/7NiXaldDxJBQX3RiAa0YjOVT1jmIJBB2UkKab5iXiQkWquJCtvgiPqQtCGJTP +cjnhsUPgKM+351psE2tJs//jGHyJizNdrDPXp/naOlXJWBD5qu9ats9LS98q +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + 9b:7e:06:49:a3:3e:62:b9:d5:ee:90:48:71:29:ef:57 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G3 + Validity + Not Before: Oct 1 00:00:00 1999 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 3 Public Primary Certification Authority - G3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:cb:ba:9c:52:fc:78:1f:1a:1e:6f:1b:37:73:bd: + f8:c9:6b:94:12:30:4f:f0:36:47:f5:d0:91:0a:f5: + 17:c8:a5:61:c1:16:40:4d:fb:8a:61:90:e5:76:20: + c1:11:06:7d:ab:2c:6e:a6:f5:11:41:8e:fa:2d:ad: + 2a:61:59:a4:67:26:4c:d0:e8:bc:52:5b:70:20:04: + 58:d1:7a:c9:a4:69:bc:83:17:64:ad:05:8b:bc:d0: + 58:ce:8d:8c:f5:eb:f0:42:49:0b:9d:97:27:67:32: + 6e:e1:ae:93:15:1c:70:bc:20:4d:2f:18:de:92:88: + e8:6c:85:57:11:1a:e9:7e:e3:26:11:54:a2:45:96: + 55:83:ca:30:89:e8:dc:d8:a3:ed:2a:80:3f:7f:79: + 65:57:3e:15:20:66:08:2f:95:93:bf:aa:47:2f:a8: + 46:97:f0:12:e2:fe:c2:0a:2b:51:e6:76:e6:b7:46: + b7:e2:0d:a6:cc:a8:c3:4c:59:55:89:e6:e8:53:5c: + 1c:ea:9d:f0:62:16:0b:a7:c9:5f:0c:f0:de:c2:76: + ce:af:f7:6a:f2:fa:41:a6:a2:33:14:c9:e5:7a:63: + d3:9e:62:37:d5:85:65:9e:0e:e6:53:24:74:1b:5e: + 1d:12:53:5b:c7:2c:e7:83:49:3b:15:ae:8a:68:b9: + 57:97 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 11:14:96:c1:ab:92:08:f7:3f:2f:c9:b2:fe:e4:5a:9f:64:de: + db:21:4f:86:99:34:76:36:57:dd:d0:15:2f:c5:ad:7f:15:1f: + 37:62:73:3e:d4:e7:5f:ce:17:03:db:35:fa:2b:db:ae:60:09: + 5f:1e:5f:8f:6e:bb:0b:3d:ea:5a:13:1e:0c:60:6f:b5:c0:b5: + 23:22:2e:07:0b:cb:a9:74:cb:47:bb:1d:c1:d7:a5:6b:cc:2f: + d2:42:fd:49:dd:a7:89:cf:53:ba:da:00:5a:28:bf:82:df:f8: + ba:13:1d:50:86:82:fd:8e:30:8f:29:46:b0:1e:3d:35:da:38: + 62:16:18:4a:ad:e6:b6:51:6c:de:af:62:eb:01:d0:1e:24:fe: + 7a:8f:12:1a:12:68:b8:fb:66:99:14:14:45:5c:ae:e7:ae:69: + 17:81:2b:5a:37:c9:5e:2a:f4:c6:e2:a1:5c:54:9b:a6:54:00: + cf:f0:f1:c1:c7:98:30:1a:3b:36:16:db:a3:6e:ea:fd:ad:b2: + c2:da:ef:02:47:13:8a:c0:f1:b3:31:ad:4f:1c:e1:4f:9c:af: + 0f:0c:9d:f7:78:0d:d8:f4:35:56:80:da:b7:6d:17:8f:9d:1e: + 81:64:e1:fe:c5:45:ba:ad:6b:b9:0a:7a:4e:4f:4b:84:ee:4b: + f1:7d:dd:11 +MD5 Fingerprint=CD:68:B6:A7:C7:C4:CE:75:E0:1D:4F:57:44:61:92:09 +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl +cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu +LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT +aWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD +VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ +bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu +IENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg +LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMu6nFL8eB8aHm8b +N3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1EUGO+i2t +KmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGu +kxUccLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBm +CC+Vk7+qRy+oRpfwEuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJ +Xwzw3sJ2zq/3avL6QaaiMxTJ5Xpj055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWu +imi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAERSWwauSCPc/L8my/uRan2Te +2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5fj267Cz3qWhMe +DGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC +/Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565p +F4ErWjfJXir0xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGt +TxzhT5yvDwyd93gN2PQ1VoDat20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: + ec:a0:a7:8b:6e:75:6a:01:cf:c4:7c:cc:2f:94:5e:d7 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 4 Public Primary Certification Authority - G3 + Validity + Not Before: Oct 1 00:00:00 1999 GMT + Not After : Jul 16 23:59:59 2036 GMT + Subject: C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 1999 VeriSign, Inc. - For authorized use only, CN=VeriSign Class 4 Public Primary Certification Authority - G3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ad:cb:a5:11:69:c6:59:ab:f1:8f:b5:19:0f:56: + ce:cc:b5:1f:20:e4:9e:26:25:4b:e0:73:65:89:59: + de:d0:83:e4:f5:0f:b5:bb:ad:f1:7c:e8:21:fc:e4: + e8:0c:ee:7c:45:22:19:76:92:b4:13:b7:20:5b:09: + fa:61:ae:a8:f2:a5:8d:85:c2:2a:d6:de:66:36:d2: + 9b:02:f4:a8:92:60:7c:9c:69:b4:8f:24:1e:d0:86: + 52:f6:32:9c:41:58:1e:22:bd:cd:45:62:95:08:6e: + d0:66:dd:53:a2:cc:f0:10:dc:54:73:8b:04:a1:46: + 33:33:5c:17:40:b9:9e:4d:d3:f3:be:55:83:e8:b1: + 89:8e:5a:7c:9a:96:22:90:3b:88:25:f2:d2:53:88: + 02:0c:0b:78:f2:e6:37:17:4b:30:46:07:e4:80:6d: + a6:d8:96:2e:e8:2c:f8:11:b3:38:0d:66:a6:9b:ea: + c9:23:5b:db:8e:e2:f3:13:8e:1a:59:2d:aa:02:f0: + ec:a4:87:66:dc:c1:3f:f5:d8:b9:f4:ec:82:c6:d2: + 3d:95:1d:e5:c0:4f:84:c9:d9:a3:44:28:06:6a:d7: + 45:ac:f0:6b:6a:ef:4e:5f:f8:11:82:1e:38:63:34: + 66:50:d4:3e:93:73:fa:30:c3:66:ad:ff:93:2d:97: + ef:03 + Exponent: 65537 (0x10001) + Signature Algorithm: sha1WithRSAEncryption + 8f:fa:25:6b:4f:5b:e4:a4:4e:27:55:ab:22:15:59:3c:ca:b5: + 0a:d4:4a:db:ab:dd:a1:5f:53:c5:a0:57:39:c2:ce:47:2b:be: + 3a:c8:56:bf:c2:d9:27:10:3a:b1:05:3c:c0:77:31:bb:3a:d3: + 05:7b:6d:9a:1c:30:8c:80:cb:93:93:2a:83:ab:05:51:82:02: + 00:11:67:6b:f3:88:61:47:5f:03:93:d5:5b:0d:e0:f1:d4:a1: + 32:35:85:b2:3a:db:b0:82:ab:d1:cb:0a:bc:4f:8c:5b:c5:4b: + 00:3b:1f:2a:82:a6:7e:36:85:dc:7e:3c:67:00:b5:e4:3b:52: + e0:a8:eb:5d:15:f9:c6:6d:f0:ad:1d:0e:85:b7:a9:9a:73:14: + 5a:5b:8f:41:28:c0:d5:e8:2d:4d:a4:5e:cd:aa:d9:ed:ce:dc: + d8:d5:3c:42:1d:17:c1:12:5d:45:38:c3:38:f3:fc:85:2e:83: + 46:48:b2:d7:20:5f:92:36:8f:e7:79:0f:98:5e:99:e8:f0:d0: + a4:bb:f5:53:bd:2a:ce:59:b0:af:6e:7f:6c:bb:d2:1e:00:b0: + 21:ed:f8:41:62:82:b9:d8:b2:c4:bb:46:50:f3:31:c5:8f:01: + a8:74:eb:f5:78:27:da:e7:f7:66:43:f3:9e:83:3e:20:aa:c3: + 35:60:91:ce +MD5 Fingerprint=DB:C8:F2:27:2E:B1:EA:6A:29:23:5D:FE:56:3E:33:DF +-----BEGIN CERTIFICATE----- +MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQsw +CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZl +cmlTaWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWdu +LCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlT +aWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3Jp +dHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQswCQYD +VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlT +aWduIFRydXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJ +bmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWdu +IENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg +LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK3LpRFpxlmr8Y+1 +GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaStBO3IFsJ ++mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0Gbd +U6LM8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLm +NxdLMEYH5IBtptiWLugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XY +ufTsgsbSPZUd5cBPhMnZo0QoBmrXRazwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ +ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAj/ola09b5KROJ1WrIhVZPMq1 +CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXttmhwwjIDLk5Mq +g6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm +fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c +2NU8Qh0XwRJdRTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/ +bLvSHgCwIe34QWKCudiyxLtGUPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 927650371 (0x374ad243) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Entrust.net, OU=www.entrust.net/CPS incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority + Validity + Not Before: May 25 16:09:40 1999 GMT + Not After : May 25 16:39:40 2019 GMT + Subject: C=US, O=Entrust.net, OU=www.entrust.net/CPS incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:cd:28:83:34:54:1b:89:f3:0f:af:37:91:31:ff: + af:31:60:c9:a8:e8:b2:10:68:ed:9f:e7:93:36:f1: + 0a:64:bb:47:f5:04:17:3f:23:47:4d:c5:27:19:81: + 26:0c:54:72:0d:88:2d:d9:1f:9a:12:9f:bc:b3:71: + d3:80:19:3f:47:66:7b:8c:35:28:d2:b9:0a:df:24: + da:9c:d6:50:79:81:7a:5a:d3:37:f7:c2:4a:d8:29: + 92:26:64:d1:e4:98:6c:3a:00:8a:f5:34:9b:65:f8: + ed:e3:10:ff:fd:b8:49:58:dc:a0:de:82:39:6b:81: + b1:16:19:61:b9:54:b6:e6:43 + Exponent: 3 (0x3) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=US/O=Entrust.net/OU=www.entrust.net/CPS incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Secure Server Certification Authority/CN=CRL1 + URI:http://www.entrust.net/CRL/net1.crl + + X509v3 Private Key Usage Period: + Not Before: May 25 16:09:40 1999 GMT, Not After: May 25 16:09:40 2019 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:F0:17:62:13:55:3D:B3:FF:0A:00:6B:FB:50:84:97:F3:ED:62:D0:1A + + X509v3 Subject Key Identifier: + F0:17:62:13:55:3D:B3:FF:0A:00:6B:FB:50:84:97:F3:ED:62:D0:1A + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0 +..V4.0.... + Signature Algorithm: sha1WithRSAEncryption + 90:dc:30:02:fa:64:74:c2:a7:0a:a5:7c:21:8d:34:17:a8:fb: + 47:0e:ff:25:7c:8d:13:0a:fb:e4:98:b5:ef:8c:f8:c5:10:0d: + f7:92:be:f1:c3:d5:d5:95:6a:04:bb:2c:ce:26:36:65:c8:31: + c6:e7:ee:3f:e3:57:75:84:7a:11:ef:46:4f:18:f4:d3:98:bb: + a8:87:32:ba:72:f6:3c:e2:3d:9f:d7:1d:d9:c3:60:43:8c:58: + 0e:22:96:2f:62:a3:2c:1f:ba:ad:05:ef:ab:32:78:87:a0:54: + 73:19:b5:5c:05:f9:52:3e:6d:2d:45:0b:f7:0a:93:ea:ed:06: + f9:b2 +MD5 Fingerprint=DF:F2:80:73:CC:F1:E6:61:73:FC:F5:42:E9:C5:7C:EE +-----BEGIN CERTIFICATE----- +MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u +ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc +KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u +ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1 +MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE +ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j +b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF +bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg +U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA +A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/ +I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3 +wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC +AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb +oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5 +BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p +dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk +MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp +b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu +dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0 +MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi +E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa +MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI +hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN +95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd +2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 939758062 (0x380391ee) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=Entrust.net, OU=www.entrust.net/Client_CA_Info/CPS incorp. by ref. limits liab., OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Client Certification Authority + Validity + Not Before: Oct 12 19:24:30 1999 GMT + Not After : Oct 12 19:54:30 2019 GMT + Subject: C=US, O=Entrust.net, OU=www.entrust.net/Client_CA_Info/CPS incorp. by ref. limits liab., OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Client Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c8:3a:99:5e:31:17:df:ac:27:6f:90:7b:e4:19: + ff:45:a3:34:c2:db:c1:a8:4f:f0:68:ea:84:fd:9f: + 75:79:cf:c1:8a:51:94:af:c7:57:03:47:64:9e:ad: + 82:1b:5a:da:7f:37:78:47:bb:37:98:12:96:ce:c6: + 13:7d:ef:d2:0c:30:51:a9:39:9e:55:f8:fb:b1:e7: + 30:de:83:b2:ba:3e:f1:d5:89:3b:3b:85:ba:aa:74: + 2c:fe:3f:31:6e:af:91:95:6e:06:d4:07:4d:4b:2c: + 56:47:18:04:52:da:0e:10:93:bf:63:90:9b:e1:df: + 8c:e6:02:a4:e6:4f:5e:f7:8b + Exponent: 3 (0x3) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=US/O=Entrust.net/OU=www.entrust.net/Client_CA_Info/CPS incorp. by ref. limits liab./OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Client Certification Authority/CN=CRL1 + URI:http://www.entrust.net/CRL/Client1.crl + + X509v3 Private Key Usage Period: + Not Before: Oct 12 19:24:30 1999 GMT, Not After: Oct 12 19:24:30 2019 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:C4:FB:9C:29:7B:97:CD:4C:96:FC:EE:5B:B3:CA:99:74:8B:95:EA:4C + + X509v3 Subject Key Identifier: + C4:FB:9C:29:7B:97:CD:4C:96:FC:EE:5B:B3:CA:99:74:8B:95:EA:4C + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0 +..V4.0.... + Signature Algorithm: md5WithRSAEncryption + 3f:ae:8a:f1:d7:66:03:05:9e:3e:fa:ea:1c:46:bb:a4:5b:8f: + 78:9a:12:48:99:f9:f4:35:de:0c:36:07:02:6b:10:3a:89:14: + 81:9c:31:a6:7c:b2:41:b2:6a:e7:07:01:a1:4b:f9:9f:25:3b: + 96:ca:99:c3:3e:a1:51:1c:f3:c3:2e:44:f7:b0:67:46:aa:92: + e5:3b:da:1c:19:14:38:30:d5:e2:a2:31:25:2e:f1:ec:45:38: + ed:f8:06:58:03:73:62:b0:10:31:8f:40:bf:64:e0:5c:3e:c5: + 4f:1f:da:12:43:ff:4c:e6:06:26:a8:9b:19:aa:44:3c:76:b2: + 5c:ec +MD5 Fingerprint=0C:41:2F:13:5B:A0:54:F5:96:66:2D:7E:CD:0E:03:F4 +-----BEGIN CERTIFICATE----- +MIIE7TCCBFagAwIBAgIEOAOR7jANBgkqhkiG9w0BAQQFADCByTELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MUgwRgYDVQQLFD93d3cuZW50cnVzdC5u +ZXQvQ2xpZW50X0NBX0luZm8vQ1BTIGluY29ycC4gYnkgcmVmLiBsaW1pdHMgbGlh +Yi4xJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV +BAMTKkVudHJ1c3QubmV0IENsaWVudCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe +Fw05OTEwMTIxOTI0MzBaFw0xOTEwMTIxOTU0MzBaMIHJMQswCQYDVQQGEwJVUzEU +MBIGA1UEChMLRW50cnVzdC5uZXQxSDBGBgNVBAsUP3d3dy5lbnRydXN0Lm5ldC9D +bGllbnRfQ0FfSW5mby9DUFMgaW5jb3JwLiBieSByZWYuIGxpbWl0cyBsaWFiLjEl +MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMq +RW50cnVzdC5uZXQgQ2xpZW50IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0G +CSqGSIb3DQEBAQUAA4GLADCBhwKBgQDIOpleMRffrCdvkHvkGf9FozTC28GoT/Bo +6oT9n3V5z8GKUZSvx1cDR2SerYIbWtp/N3hHuzeYEpbOxhN979IMMFGpOZ5V+Pux +5zDeg7K6PvHViTs7hbqqdCz+PzFur5GVbgbUB01LLFZHGARS2g4Qk79jkJvh34zm +AqTmT173iwIBA6OCAeAwggHcMBEGCWCGSAGG+EIBAQQEAwIABzCCASIGA1UdHwSC +ARkwggEVMIHkoIHhoIHepIHbMIHYMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50 +cnVzdC5uZXQxSDBGBgNVBAsUP3d3dy5lbnRydXN0Lm5ldC9DbGllbnRfQ0FfSW5m +by9DUFMgaW5jb3JwLiBieSByZWYuIGxpbWl0cyBsaWFiLjElMCMGA1UECxMcKGMp +IDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5uZXQg +Q2xpZW50IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCyg +KqAohiZodHRwOi8vd3d3LmVudHJ1c3QubmV0L0NSTC9DbGllbnQxLmNybDArBgNV +HRAEJDAigA8xOTk5MTAxMjE5MjQzMFqBDzIwMTkxMDEyMTkyNDMwWjALBgNVHQ8E +BAMCAQYwHwYDVR0jBBgwFoAUxPucKXuXzUyW/O5bs8qZdIuV6kwwHQYDVR0OBBYE +FMT7nCl7l81MlvzuW7PKmXSLlepMMAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EA +BAwwChsEVjQuMAMCBJAwDQYJKoZIhvcNAQEEBQADgYEAP66K8ddmAwWePvrqHEa7 +pFuPeJoSSJn59DXeDDYHAmsQOokUgZwxpnyyQbJq5wcBoUv5nyU7lsqZwz6hURzz +wy5E97BnRqqS5TvaHBkUODDV4qIxJS7x7EU47fgGWANzYrAQMY9Av2TgXD7FTx/a +EkP/TOYGJqibGapEPHayXOw= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 946059622 (0x3863b966) + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048) + Validity + Not Before: Dec 24 17:50:51 1999 GMT + Not After : Dec 24 18:20:51 2019 GMT + Subject: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048) + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ad:4d:4b:a9:12:86:b2:ea:a3:20:07:15:16:64: + 2a:2b:4b:d1:bf:0b:4a:4d:8e:ed:80:76:a5:67:b7: + 78:40:c0:73:42:c8:68:c0:db:53:2b:dd:5e:b8:76: + 98:35:93:8b:1a:9d:7c:13:3a:0e:1f:5b:b7:1e:cf: + e5:24:14:1e:b1:81:a9:8d:7d:b8:cc:6b:4b:03:f1: + 02:0c:dc:ab:a5:40:24:00:7f:74:94:a1:9d:08:29: + b3:88:0b:f5:87:77:9d:55:cd:e4:c3:7e:d7:6a:64: + ab:85:14:86:95:5b:97:32:50:6f:3d:c8:ba:66:0c: + e3:fc:bd:b8:49:c1:76:89:49:19:fd:c0:a8:bd:89: + a3:67:2f:c6:9f:bc:71:19:60:b8:2d:e9:2c:c9:90: + 76:66:7b:94:e2:af:78:d6:65:53:5d:3c:d6:9c:b2: + cf:29:03:f9:2f:a4:50:b2:d4:48:ce:05:32:55:8a: + fd:b2:64:4c:0e:e4:98:07:75:db:7f:df:b9:08:55: + 60:85:30:29:f9:7b:48:a4:69:86:e3:35:3f:1e:86: + 5d:7a:7a:15:bd:ef:00:8e:15:22:54:17:00:90:26: + 93:bc:0e:49:68:91:bf:f8:47:d3:9d:95:42:c1:0e: + 4d:df:6f:26:cf:c3:18:21:62:66:43:70:d6:d5:c0: + 07:e1 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Authority Key Identifier: + keyid:55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70 + + X509v3 Subject Key Identifier: + 55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70 + 1.2.840.113533.7.65.0: + 0...V5.0:4.0.... + Signature Algorithm: sha1WithRSAEncryption + 59:47:ac:21:84:8a:17:c9:9c:89:53:1e:ba:80:85:1a:c6:3c: + 4e:3e:b1:9c:b6:7c:c6:92:5d:18:64:02:e3:d3:06:08:11:61: + 7c:63:e3:2b:9d:31:03:70:76:d2:a3:28:a0:f4:bb:9a:63:73: + ed:6d:e5:2a:db:ed:14:a9:2b:c6:36:11:d0:2b:eb:07:8b:a5: + da:9e:5c:19:9d:56:12:f5:54:29:c8:05:ed:b2:12:2a:8d:f4: + 03:1b:ff:e7:92:10:87:b0:3a:b5:c3:9d:05:37:12:a3:c7:f4: + 15:b9:d5:a4:39:16:9b:53:3a:23:91:f1:a8:82:a2:6a:88:68: + c1:79:02:22:bc:aa:a6:d6:ae:df:b0:14:5f:b8:87:d0:dd:7c: + 7f:7b:ff:af:1c:cf:e6:db:07:ad:5e:db:85:9d:d0:2b:0d:33: + db:04:d1:e6:49:40:13:2b:76:fb:3e:e9:9c:89:0f:15:ce:18: + b0:85:78:21:4f:6b:4f:0e:fa:36:67:cd:07:f2:ff:08:d0:e2: + de:d9:bf:2a:af:b8:87:86:21:3c:04:ca:b7:94:68:7f:cf:3c: + e9:98:d7:38:ff:ec:c0:d9:50:f0:2e:4b:58:ae:46:6f:d0:2e: + c3:60:da:72:55:72:bd:4c:45:9e:61:ba:bf:84:81:92:03:d1: + d2:69:7c:c5 +MD5 Fingerprint=BA:21:EA:20:D6:DD:DB:8F:C1:57:8B:40:AD:A1:FC:FC +-----BEGIN CERTIFICATE----- +MIIEXDCCA0SgAwIBAgIEOGO5ZjANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML +RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 +IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0xOTEy +MjQxODIwNTFaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 +LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp +YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG +A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq +K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe +sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX +MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT +XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ +HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH +4QIDAQABo3QwcjARBglghkgBhvhCAQEEBAMCAAcwHwYDVR0jBBgwFoAUVeSB0RGA +vtiJuQijMfmhJAkWuXAwHQYDVR0OBBYEFFXkgdERgL7YibkIozH5oSQJFrlwMB0G +CSqGSIb2fQdBAAQQMA4bCFY1LjA6NC4wAwIEkDANBgkqhkiG9w0BAQUFAAOCAQEA +WUesIYSKF8mciVMeuoCFGsY8Tj6xnLZ8xpJdGGQC49MGCBFhfGPjK50xA3B20qMo +oPS7mmNz7W3lKtvtFKkrxjYR0CvrB4ul2p5cGZ1WEvVUKcgF7bISKo30Axv/55IQ +h7A6tcOdBTcSo8f0FbnVpDkWm1M6I5HxqIKiaohowXkCIryqptau37AUX7iH0N18 +f3v/rxzP5tsHrV7bhZ3QKw0z2wTR5klAEyt2+z7pnIkPFc4YsIV4IU9rTw76NmfN +B/L/CNDi3tm/Kq+4h4YhPATKt5Rof8886ZjXOP/swNlQ8C5LWK5Gb9Auw2DaclVy +vUxFnmG6v4SBkgPR0ml8xQ== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 33554617 (0x20000b9) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root + Validity + Not Before: May 12 18:46:00 2000 GMT + Not After : May 12 23:59:00 2025 GMT + Subject: C=IE, O=Baltimore, OU=CyberTrust, CN=Baltimore CyberTrust Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:a3:04:bb:22:ab:98:3d:57:e8:26:72:9a:b5:79: + d4:29:e2:e1:e8:95:80:b1:b0:e3:5b:8e:2b:29:9a: + 64:df:a1:5d:ed:b0:09:05:6d:db:28:2e:ce:62:a2: + 62:fe:b4:88:da:12:eb:38:eb:21:9d:c0:41:2b:01: + 52:7b:88:77:d3:1c:8f:c7:ba:b9:88:b5:6a:09:e7: + 73:e8:11:40:a7:d1:cc:ca:62:8d:2d:e5:8f:0b:a6: + 50:d2:a8:50:c3:28:ea:f5:ab:25:87:8a:9a:96:1c: + a9:67:b8:3f:0c:d5:f7:f9:52:13:2f:c2:1b:d5:70: + 70:f0:8f:c0:12:ca:06:cb:9a:e1:d9:ca:33:7a:77: + d6:f8:ec:b9:f1:68:44:42:48:13:d2:c0:c2:a4:ae: + 5e:60:fe:b6:a6:05:fc:b4:dd:07:59:02:d4:59:18: + 98:63:f5:a5:63:e0:90:0c:7d:5d:b2:06:7a:f3:85: + ea:eb:d4:03:ae:5e:84:3e:5f:ff:15:ed:69:bc:f9: + 39:36:72:75:cf:77:52:4d:f3:c9:90:2c:b9:3d:e5: + c9:23:53:3f:1f:24:98:21:5c:07:99:29:bd:c6:3a: + ec:e7:6e:86:3a:6b:97:74:63:33:bd:68:18:31:f0: + 78:8d:76:bf:fc:9e:8e:5d:2a:86:a7:4d:90:dc:27: + 1a:39 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + E5:9D:59:30:82:47:58:CC:AC:FA:08:54:36:86:7B:3A:B5:04:4D:F0 + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:3 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 85:0c:5d:8e:e4:6f:51:68:42:05:a0:dd:bb:4f:27:25:84:03: + bd:f7:64:fd:2d:d7:30:e3:a4:10:17:eb:da:29:29:b6:79:3f: + 76:f6:19:13:23:b8:10:0a:f9:58:a4:d4:61:70:bd:04:61:6a: + 12:8a:17:d5:0a:bd:c5:bc:30:7c:d6:e9:0c:25:8d:86:40:4f: + ec:cc:a3:7e:38:c6:37:11:4f:ed:dd:68:31:8e:4c:d2:b3:01: + 74:ee:be:75:5e:07:48:1a:7f:70:ff:16:5c:84:c0:79:85:b8: + 05:fd:7f:be:65:11:a3:0f:c0:02:b4:f8:52:37:39:04:d5:a9: + 31:7a:18:bf:a0:2a:f4:12:99:f7:a3:45:82:e3:3c:5e:f5:9d: + 9e:b5:c8:9e:7c:2e:c8:a4:9e:4e:08:14:4b:6d:fd:70:6d:6b: + 1a:63:bd:64:e6:1f:b7:ce:f0:f2:9f:2e:bb:1b:b7:f2:50:88: + 73:92:c2:e2:e3:16:8d:9a:32:02:ab:8e:18:dd:e9:10:11:ee: + 7e:35:ab:90:af:3e:30:94:7a:d0:33:3d:a7:65:0f:f5:fc:8e: + 9e:62:cf:47:44:2c:01:5d:bb:1d:b5:32:d2:47:d2:38:2e:d0: + fe:81:dc:32:6a:1e:b5:ee:3c:d5:fc:e7:81:1d:19:c3:24:42: + ea:63:39:a9 +MD5 Fingerprint=AC:B6:94:A5:9C:17:E0:D7:91:52:9B:B1:97:06:A6:E4 +-----BEGIN CERTIFICATE----- +MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ +RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD +VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX +DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y +ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy +VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr +mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr +IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK +mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu +XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy +dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye +jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 +BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 +DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 +9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx +jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 +Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz +ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS +R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=Equifax Secure Inc., CN=Equifax Secure Global eBusiness CA-1 + Validity + Not Before: Jun 21 04:00:00 1999 GMT + Not After : Jun 21 04:00:00 2020 GMT + Subject: C=US, O=Equifax Secure Inc., CN=Equifax Secure Global eBusiness CA-1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ba:e7:17:90:02:65:b1:34:55:3c:49:c2:51:d5: + df:a7:d1:37:8f:d1:e7:81:73:41:52:60:9b:9d:a1: + 17:26:78:ad:c7:b1:e8:26:94:32:b5:de:33:8d:3a: + 2f:db:f2:9a:7a:5a:73:98:a3:5c:e9:fb:8a:73:1b: + 5c:e7:c3:bf:80:6c:cd:a9:f4:d6:2b:c0:f7:f9:99: + aa:63:a2:b1:47:02:0f:d4:e4:51:3a:12:3c:6c:8a: + 5a:54:84:70:db:c1:c5:90:cf:72:45:cb:a8:59:c0: + cd:33:9d:3f:a3:96:eb:85:33:21:1c:3e:1e:3e:60: + 6e:76:9c:67:85:c5:c8:c3:61 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:BE:A8:A0:74:72:50:6B:44:B7:C9:23:D8:FB:A8:FF:B3:57:6B:68:6C + + X509v3 Subject Key Identifier: + BE:A8:A0:74:72:50:6B:44:B7:C9:23:D8:FB:A8:FF:B3:57:6B:68:6C + Signature Algorithm: md5WithRSAEncryption + 30:e2:01:51:aa:c7:ea:5f:da:b9:d0:65:0f:30:d6:3e:da:0d: + 14:49:6e:91:93:27:14:31:ef:c4:f7:2d:45:f8:ec:c7:bf:a2: + 41:0d:23:b4:92:f9:19:00:67:bd:01:af:cd:e0:71:fc:5a:cf: + 64:c4:e0:96:98:d0:a3:40:e2:01:8a:ef:27:07:f1:65:01:8a: + 44:2d:06:65:75:52:c0:86:10:20:21:5f:6c:6b:0f:6c:ae:09: + 1c:af:f2:a2:18:34:c4:75:a4:73:1c:f1:8d:dc:ef:ad:f9:b3: + 76:b4:92:bf:dc:95:10:1e:be:cb:c8:3b:5a:84:60:19:56:94: + a9:55 +MD5 Fingerprint=8F:5D:77:06:27:C4:98:3C:5B:93:78:E7:D7:7D:9B:CC +-----BEGIN CERTIFICATE----- +MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEc +MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBT +ZWN1cmUgR2xvYmFsIGVCdXNpbmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIw +MDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0VxdWlmYXggU2Vj +dXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEdsb2JhbCBlQnVzaW5l +c3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRVPEnC +UdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc +58O/gGzNqfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/ +o5brhTMhHD4ePmBudpxnhcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAH +MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUvqigdHJQa0S3ySPY+6j/s1dr +aGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hsMA0GCSqGSIb3DQEBBAUA +A4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okENI7SS+RkA +Z70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv +8qIYNMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 4 (0x4) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=US, O=Equifax Secure Inc., CN=Equifax Secure eBusiness CA-1 + Validity + Not Before: Jun 21 04:00:00 1999 GMT + Not After : Jun 21 04:00:00 2020 GMT + Subject: C=US, O=Equifax Secure Inc., CN=Equifax Secure eBusiness CA-1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ce:2f:19:bc:17:b7:77:de:93:a9:5f:5a:0d:17: + 4f:34:1a:0c:98:f4:22:d9:59:d4:c4:68:46:f0:b4: + 35:c5:85:03:20:c6:af:45:a5:21:51:45:41:eb:16: + 58:36:32:6f:e2:50:62:64:f9:fd:51:9c:aa:24:d9: + f4:9d:83:2a:87:0a:21:d3:12:38:34:6c:8d:00:6e: + 5a:a0:d9:42:ee:1a:21:95:f9:52:4c:55:5a:c5:0f: + 38:4f:46:fa:6d:f8:2e:35:d6:1d:7c:eb:e2:f0:b0: + 75:80:c8:a9:13:ac:be:88:ef:3a:6e:ab:5f:2a:38: + 62:02:b0:12:7b:fe:8f:a6:03 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:4A:78:32:52:11:DB:59:16:36:5E:DF:C1:14:36:40:6A:47:7C:4C:A1 + + X509v3 Subject Key Identifier: + 4A:78:32:52:11:DB:59:16:36:5E:DF:C1:14:36:40:6A:47:7C:4C:A1 + Signature Algorithm: md5WithRSAEncryption + 75:5b:a8:9b:03:11:e6:e9:56:4c:cd:f9:a9:4c:c0:0d:9a:f3: + cc:65:69:e6:25:76:cc:59:b7:d6:54:c3:1d:cd:99:ac:19:dd: + b4:85:d5:e0:3d:fc:62:20:a7:84:4b:58:65:f1:e2:f9:95:21: + 3f:f5:d4:7e:58:1e:47:87:54:3e:58:a1:b5:b5:f8:2a:ef:71: + e7:bc:c3:f6:b1:49:46:e2:d7:a0:6b:e5:56:7a:9a:27:98:7c: + 46:62:14:e7:c9:fc:6e:03:12:79:80:38:1d:48:82:8d:fc:17: + fe:2a:96:2b:b5:62:a6:a6:3d:bd:7f:92:59:cd:5a:2a:82:b2: + 37:79 +MD5 Fingerprint=64:9C:EF:2E:44:FC:C6:8F:52:07:D0:51:73:8F:CB:3D +-----BEGIN CERTIFICATE----- +MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEc +MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBT +ZWN1cmUgZUJ1c2luZXNzIENBLTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQw +MDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5j +LjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENBLTEwgZ8wDQYJ +KoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ1MRo +RvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBu +WqDZQu4aIZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKw +Env+j6YDAgMBAAGjZjBkMBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTAD +AQH/MB8GA1UdIwQYMBaAFEp4MlIR21kWNl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRK +eDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQFAAOBgQB1W6ibAxHm6VZM +zfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5lSE/9dR+ +WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN +/Bf+KpYrtWKmpj29f5JZzVoqgrI3eQ== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 930140085 (0x3770cfb5) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Equifax Secure, OU=Equifax Secure eBusiness CA-2 + Validity + Not Before: Jun 23 12:14:45 1999 GMT + Not After : Jun 23 12:14:45 2019 GMT + Subject: C=US, O=Equifax Secure, OU=Equifax Secure eBusiness CA-2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:e4:39:39:93:1e:52:06:1b:28:36:f8:b2:a3:29: + c5:ed:8e:b2:11:bd:fe:eb:e7:b4:74:c2:8f:ff:05: + e7:d9:9d:06:bf:12:c8:3f:0e:f2:d6:d1:24:b2:11: + de:d1:73:09:8a:d4:b1:2c:98:09:0d:1e:50:46:b2: + 83:a6:45:8d:62:68:bb:85:1b:20:70:32:aa:40:cd: + a6:96:5f:c4:71:37:3f:04:f3:b7:41:24:39:07:1a: + 1e:2e:61:58:a0:12:0b:e5:a5:df:c5:ab:ea:37:71: + cc:1c:c8:37:3a:b9:97:52:a7:ac:c5:6a:24:94:4e: + 9c:7b:cf:c0:6a:d6:df:21:bd + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 CRL Distribution Points: + DirName:/C=US/O=Equifax Secure/OU=Equifax Secure eBusiness CA-2/CN=CRL1 + + X509v3 Private Key Usage Period: + Not After: Jun 23 12:14:45 2019 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:50:9E:0B:EA:AF:5E:B9:20:48:A6:50:6A:CB:FD:D8:20:7A:A7:82:76 + + X509v3 Subject Key Identifier: + 50:9E:0B:EA:AF:5E:B9:20:48:A6:50:6A:CB:FD:D8:20:7A:A7:82:76 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V3.0c.... + Signature Algorithm: sha1WithRSAEncryption + 0c:86:82:ad:e8:4e:1a:f5:8e:89:27:e2:35:58:3d:29:b4:07: + 8f:36:50:95:bf:6e:c1:9e:eb:c4:90:b2:85:a8:bb:b7:42:e0: + 0f:07:39:df:fb:9e:90:b2:d1:c1:3e:53:9f:03:44:b0:7e:4b: + f4:6f:e4:7c:1f:e7:e2:b1:e4:b8:9a:ef:c3:bd:ce:de:0b:32: + 34:d9:de:28:ed:33:6b:c4:d4:d7:3d:12:58:ab:7d:09:2d:cb: + 70:f5:13:8a:94:a1:27:a4:d6:70:c5:6d:94:b5:c9:7d:9d:a0: + d2:c6:08:49:d9:66:9b:a6:d3:f4:0b:dc:c5:26:57:e1:91:30: + ea:cd +MD5 Fingerprint=AA:BF:BF:64:97:DA:98:1D:6F:C6:08:3A:95:70:33:CA +-----BEGIN CERTIFICATE----- +MIIDIDCCAomgAwIBAgIEN3DPtTANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV +UzEXMBUGA1UEChMORXF1aWZheCBTZWN1cmUxJjAkBgNVBAsTHUVxdWlmYXggU2Vj +dXJlIGVCdXNpbmVzcyBDQS0yMB4XDTk5MDYyMzEyMTQ0NVoXDTE5MDYyMzEyMTQ0 +NVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkVxdWlmYXggU2VjdXJlMSYwJAYD +VQQLEx1FcXVpZmF4IFNlY3VyZSBlQnVzaW5lc3MgQ0EtMjCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEA5Dk5kx5SBhsoNviyoynF7Y6yEb3+6+e0dMKP/wXn2Z0G +vxLIPw7y1tEkshHe0XMJitSxLJgJDR5QRrKDpkWNYmi7hRsgcDKqQM2mll/EcTc/ +BPO3QSQ5BxoeLmFYoBIL5aXfxavqN3HMHMg3OrmXUqesxWoklE6ce8/AatbfIb0C +AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEX +MBUGA1UEChMORXF1aWZheCBTZWN1cmUxJjAkBgNVBAsTHUVxdWlmYXggU2VjdXJl +IGVCdXNpbmVzcyBDQS0yMQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTkw +NjIzMTIxNDQ1WjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUUJ4L6q9euSBIplBq +y/3YIHqngnYwHQYDVR0OBBYEFFCeC+qvXrkgSKZQasv92CB6p4J2MAwGA1UdEwQF +MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA +A4GBAAyGgq3oThr1jokn4jVYPSm0B482UJW/bsGe68SQsoWou7dC4A8HOd/7npCy +0cE+U58DRLB+S/Rv5Hwf5+Kx5Lia78O9zt4LMjTZ3ijtM2vE1Nc9ElirfQkty3D1 +E4qUoSek1nDFbZS1yX2doNLGCEnZZpum0/QL3MUmV+GRMOrN +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 798 (0x31e) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VISA, OU=Visa International Service Association, CN=GP Root 2 + Validity + Not Before: Aug 16 22:51:00 2000 GMT + Not After : Aug 15 23:59:00 2020 GMT + Subject: C=US, O=VISA, OU=Visa International Service Association, CN=GP Root 2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:a9:01:70:b5:aa:c4:40:f0:ab:6a:26:61:79:19: + 00:fc:bf:9b:37:59:0c:af:6f:64:1b:f8:da:95:94: + 24:69:33:11:70:ca:e3:56:74:a2:17:57:64:5c:20: + 06:e1:d6:ef:71:b7:3b:f7:ab:c1:69:d0:49:a4:b1: + 04:d7:f4:57:62:89:5c:b0:75:2d:17:24:69:e3:42: + 60:e4:ee:74:d6:ab:80:56:d8:88:28:e1:fb:6d:22: + fd:23:7c:46:73:4f:7e:54:73:1e:a8:2c:55:58:75: + b7:4c:f3:5a:45:a5:02:1a:fa:da:9d:c3:45:c3:22: + 5e:f3:8b:f1:60:29:d2:c7:5f:b4:0c:3a:51:83:ef: + 30:f8:d4:e7:c7:f2:fa:99:a3:22:50:be:f9:05:37: + a3:ad:ed:9a:c3:e6:ec:88:1b:b6:19:27:1b:38:8b: + 80:4d:ec:b9:c7:c5:89:cb:fc:1a:32:ed:23:f0:b5: + 01:58:f9:f6:8f:e0:85:a9:4c:09:72:39:12:db:b3: + f5:cf:4e:62:64:da:c6:19:15:3a:63:1d:e9:17:55: + a1:4c:22:3c:34:32:46:f8:65:57:ba:2b:ef:36:8c: + 6a:fa:d9:d9:44:f4:aa:dd:84:d7:0d:1c:b2:54:ac: + 32:85:b4:64:0d:de:41:bb:b1:34:c6:01:86:32:64: + d5:9f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 9E:7D:4B:34:BF:71:AD:C2:05:F6:03:75:80:CE:A9:4F:1A:C4:24:4C + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 21:a5:76:14:55:f9:ad:27:70:8f:3c:f4:d5:6c:c8:cc:0a:ab: + a3:98:0b:8a:06:23:c5:c9:61:db:99:07:69:35:26:31:fe:c7: + 2e:84:c2:99:61:d4:0d:e9:7d:2e:13:2b:7c:8e:85:b6:85:c7: + 4b:cf:35:b6:2c:47:3d:ce:29:2f:d8:6f:9f:89:1c:64:93:bf: + 08:bd:76:d0:90:8a:94:b3:7f:28:5b:6e:ac:4d:33:2c:ed:65: + dc:16:cc:e2:cd:ae:a4:3d:62:92:06:95:26:bf:df:b9:e4:20: + a6:73:6a:c1:be:f7:94:44:d6:4d:6f:2a:0b:6b:18:4d:74:10: + 36:68:6a:5a:c1:6a:a7:dd:36:29:8c:b8:30:8b:4f:21:3f:00: + 2e:54:30:07:3a:ba:8a:e4:c3:9e:ca:d8:b5:d8:7b:ce:75:45: + 66:07:f4:6d:2d:d8:7a:ca:e9:89:8a:f2:23:d8:2f:cb:6e:00: + 36:4f:fb:f0:2f:01:cc:0f:c0:22:65:f4:ab:e2:4e:61:2d:03: + 82:7d:91:16:b5:30:d5:14:de:5e:c7:90:fc:a1:fc:ab:10:af: + 5c:6b:70:a7:07:ef:29:86:e8:b2:25:c7:20:ff:26:dd:77:ef: + 79:44:14:c4:bd:dd:3b:c5:03:9b:77:23:ec:a0:ec:bb:5a:39: + b5:cc:ad:06 +MD5 Fingerprint=35:48:95:36:4A:54:5A:72:96:8E:E0:64:CC:EF:2C:8C +-----BEGIN CERTIFICATE----- +MIIDgDCCAmigAwIBAgICAx4wDQYJKoZIhvcNAQEFBQAwYTELMAkGA1UEBhMCVVMx +DTALBgNVBAoTBFZJU0ExLzAtBgNVBAsTJlZpc2EgSW50ZXJuYXRpb25hbCBTZXJ2 +aWNlIEFzc29jaWF0aW9uMRIwEAYDVQQDEwlHUCBSb290IDIwHhcNMDAwODE2MjI1 +MTAwWhcNMjAwODE1MjM1OTAwWjBhMQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklT +QTEvMC0GA1UECxMmVmlzYSBJbnRlcm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRp +b24xEjAQBgNVBAMTCUdQIFJvb3QgMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBAKkBcLWqxEDwq2omYXkZAPy/mzdZDK9vZBv42pWUJGkzEXDK41Z0ohdX +ZFwgBuHW73G3O/erwWnQSaSxBNf0V2KJXLB1LRckaeNCYOTudNargFbYiCjh+20i +/SN8RnNPflRzHqgsVVh1t0zzWkWlAhr62p3DRcMiXvOL8WAp0sdftAw6UYPvMPjU +58fy+pmjIlC++QU3o63tmsPm7IgbthknGziLgE3sucfFicv8GjLtI/C1AVj59o/g +halMCXI5Etuz9c9OYmTaxhkVOmMd6RdVoUwiPDQyRvhlV7or7zaMavrZ2UT0qt2E +1w0cslSsMoW0ZA3eQbuxNMYBhjJk1Z8CAwEAAaNCMEAwHQYDVR0OBBYEFJ59SzS/ +ca3CBfYDdYDOqU8axCRMMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG +MA0GCSqGSIb3DQEBBQUAA4IBAQAhpXYUVfmtJ3CPPPTVbMjMCqujmAuKBiPFyWHb +mQdpNSYx/scuhMKZYdQN6X0uEyt8joW2hcdLzzW2LEc9zikv2G+fiRxkk78IvXbQ +kIqUs38oW26sTTMs7WXcFsziza6kPWKSBpUmv9+55CCmc2rBvveURNZNbyoLaxhN +dBA2aGpawWqn3TYpjLgwi08hPwAuVDAHOrqK5MOeyti12HvOdUVmB/RtLdh6yumJ +ivIj2C/LbgA2T/vwLwHMD8AiZfSr4k5hLQOCfZEWtTDVFN5ex5D8ofyrEK9ca3Cn +B+8phuiyJccg/ybdd+95RBTEvd07xQObdyPsoOy7Wjm1zK0G +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 961510791 (0x394f7d87) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=WW, O=beTRUSTed, CN=beTRUSTed Root CAs, CN=beTRUSTed Root CA + Validity + Not Before: Jun 20 14:21:04 2000 GMT + Not After : Jun 20 13:21:04 2010 GMT + Subject: C=WW, O=beTRUSTed, CN=beTRUSTed Root CAs, CN=beTRUSTed Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:d4:b4:73:7a:13:0a:38:55:01:be:89:56:e1:94: + 9e:d4:be:5a:eb:4a:34:75:1b:61:29:c4:e1:ad:08: + 60:21:78:48:ff:b4:d0:fa:5e:41:8d:61:44:87:e8: + ed:c9:58:fa:fc:93:9a:df:4f:ea:3e:35:7d:f8:33: + 7a:e6:f1:d7:cd:6f:49:4b:3d:4f:2d:6e:0e:83:3a: + 18:78:77:a3:cf:e7:f4:4d:73:d8:9a:3b:1a:1d:be: + 95:53:cf:20:97:c2:cf:3e:24:52:6c:0c:8e:65:59: + c5:71:ff:62:09:8f:aa:c5:8f:cc:60:a0:73:4a:d7: + 38:3f:15:72:bf:a2:97:b7:70:e8:af:e2:7e:16:06: + 4c:f5:aa:64:26:72:07:25:ad:35:fc:18:b1:26:d7: + d8:ff:19:0e:83:1b:8c:dc:78:45:67:34:3d:f4:af: + 1c:8d:e4:6d:6b:ed:20:b3:67:9a:b4:61:cb:17:6f: + 89:35:ff:e7:4e:c0:32:12:e7:ee:ec:df:ff:97:30: + 74:ed:8d:47:8e:eb:b4:c3:44:e6:a7:4c:7f:56:43: + e8:b8:bc:b6:be:fa:83:97:e6:bb:fb:c4:b6:93:be: + 19:18:3e:8c:81:b9:73:88:16:f4:96:43:9c:67:73: + 17:90:d8:09:6e:63:ac:4a:b6:23:c4:01:a1:ad:a4: + e4:c5 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.6334.1.0.0 + User Notice: + Explicit Text: Reliance on this certificate by any party assumes acceptance of the then applicable standard terms and conditions of use, and certification practice statement, which can be found at beTRUSTed's web site, https://www.beTRUSTed.com/vault/terms + CPS: https://www.beTRUSTed.com/vault/terms + + X509v3 CRL Distribution Points: + DirName:/O=beTRUSTed/C=WW + + X509v3 Subject Key Identifier: + 2A:B9:9B:69:2E:3B:9B:D8:CD:DE:2A:31:04:34:6B:CA:07:18:AB:67 + X509v3 Authority Key Identifier: + keyid:2A:B9:9B:69:2E:3B:9B:D8:CD:DE:2A:31:04:34:6B:CA:07:18:AB:67 + + X509v3 Key Usage: critical + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 79:61:db:a3:5e:6e:16:b1:ea:76:51:f9:cb:15:9b:cb:69:be: + e6:81:6b:9f:28:1f:65:3e:dd:11:85:92:d4:e8:41:bf:7e:33: + bd:23:e7:f1:20:bf:a4:b4:a6:19:01:c6:8c:8d:35:7c:65:a4: + 4f:09:a4:d6:d8:23:15:05:13:a7:43:79:af:db:a3:0e:9b:7b: + 78:1a:f3:04:86:5a:c6:f6:8c:20:47:38:49:50:06:9d:72:67: + 3a:f0:98:03:ad:96:67:44:fc:3f:10:0d:86:4d:e4:00:3b:29: + 7b:ce:3b:3b:99:86:61:25:40:84:dc:13:62:b7:fa:ca:59:d6: + 03:1e:d6:53:01:cd:6d:4c:68:55:40:e1:ee:6b:c7:2a:00:00: + 48:82:b3:0a:01:c3:60:2a:0c:f7:82:35:ee:48:86:96:e4:74: + d4:3d:ea:01:71:ba:04:75:40:a7:a9:7f:39:39:9a:55:97:29: + 65:ae:19:55:25:05:72:47:d3:e8:18:dc:b8:e9:af:43:73:01: + 12:74:a3:e1:5c:5f:15:5d:24:f3:f9:e4:f4:b6:67:67:12:e7: + 64:22:8a:f6:a5:41:a6:1c:b6:60:63:45:8a:10:b4:ba:46:10: + ae:41:57:65:6c:3f:23:10:3f:21:10:59:b7:e4:40:dd:26:0c: + 23:f6:aa:ae +MD5 Fingerprint=85:CA:76:5A:1B:D1:68:22:DC:A2:23:12:CA:C6:80:34 +-----BEGIN CERTIFICATE----- +MIIFLDCCBBSgAwIBAgIEOU99hzANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJX +VzESMBAGA1UEChMJYmVUUlVTVGVkMRswGQYDVQQDExJiZVRSVVNUZWQgUm9vdCBD +QXMxGjAYBgNVBAMTEWJlVFJVU1RlZCBSb290IENBMB4XDTAwMDYyMDE0MjEwNFoX +DTEwMDYyMDEzMjEwNFowWjELMAkGA1UEBhMCV1cxEjAQBgNVBAoTCWJlVFJVU1Rl +ZDEbMBkGA1UEAxMSYmVUUlVTVGVkIFJvb3QgQ0FzMRowGAYDVQQDExFiZVRSVVNU +ZWQgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANS0c3oT +CjhVAb6JVuGUntS+WutKNHUbYSnE4a0IYCF4SP+00PpeQY1hRIfo7clY+vyTmt9P +6j41ffgzeubx181vSUs9Ty1uDoM6GHh3o8/n9E1z2Jo7Gh2+lVPPIJfCzz4kUmwM +jmVZxXH/YgmPqsWPzGCgc0rXOD8Vcr+il7dw6K/ifhYGTPWqZCZyByWtNfwYsSbX +2P8ZDoMbjNx4RWc0PfSvHI3kbWvtILNnmrRhyxdviTX/507AMhLn7uzf/5cwdO2N +R47rtMNE5qdMf1ZD6Li8tr76g5fmu/vEtpO+GRg+jIG5c4gW9JZDnGdzF5DYCW5j +rEq2I8QBoa2k5MUCAwEAAaOCAfgwggH0MA8GA1UdEwEB/wQFMAMBAf8wggFZBgNV +HSAEggFQMIIBTDCCAUgGCisGAQQBsT4BAAAwggE4MIIBAQYIKwYBBQUHAgIwgfQa +gfFSZWxpYW5jZSBvbiB0aGlzIGNlcnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBhc3N1 +bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFyZCB0 +ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGFuZCBjZXJ0aWZpY2F0aW9uIHBy +YWN0aWNlIHN0YXRlbWVudCwgd2hpY2ggY2FuIGJlIGZvdW5kIGF0IGJlVFJVU1Rl +ZCdzIHdlYiBzaXRlLCBodHRwczovL3d3dy5iZVRSVVNUZWQuY29tL3ZhdWx0L3Rl +cm1zMDEGCCsGAQUFBwIBFiVodHRwczovL3d3dy5iZVRSVVNUZWQuY29tL3ZhdWx0 +L3Rlcm1zMDQGA1UdHwQtMCswKaAnoCWkIzAhMRIwEAYDVQQKEwliZVRSVVNUZWQx +CzAJBgNVBAYTAldXMB0GA1UdDgQWBBQquZtpLjub2M3eKjEENGvKBxirZzAfBgNV +HSMEGDAWgBQquZtpLjub2M3eKjEENGvKBxirZzAOBgNVHQ8BAf8EBAMCAf4wDQYJ +KoZIhvcNAQEFBQADggEBAHlh26Nebhax6nZR+csVm8tpvuaBa58oH2U+3RGFktTo +Qb9+M70j5/Egv6S0phkBxoyNNXxlpE8JpNbYIxUFE6dDea/bow6be3ga8wSGWsb2 +jCBHOElQBp1yZzrwmAOtlmdE/D8QDYZN5AA7KXvOOzuZhmElQITcE2K3+spZ1gMe +1lMBzW1MaFVA4e5rxyoAAEiCswoBw2AqDPeCNe5IhpbkdNQ96gFxugR1QKepfzk5 +mlWXKWWuGVUlBXJH0+gY3Ljpr0NzARJ0o+FcXxVdJPP55PS2Z2cS52QiivalQaYc +tmBjRYoQtLpGEK5BV2VsPyMQPyEQWbfkQN0mDCP2qq4= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Class 1 CA Root + Validity + Not Before: May 30 10:38:31 2000 GMT + Not After : May 30 10:38:31 2020 GMT + Subject: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Class 1 CA Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:96:96:d4:21:49:60:e2:6b:e8:41:07:0c:de:c4: + e0:dc:13:23:cd:c1:35:c7:fb:d6:4e:11:0a:67:5e: + f5:06:5b:6b:a5:08:3b:5b:29:16:3a:e7:87:b2:34: + 06:c5:bc:05:a5:03:7c:82:cb:29:10:ae:e1:88:81: + bd:d6:9e:d3:fe:2d:56:c1:15:ce:e3:26:9d:15:2e: + 10:fb:06:8f:30:04:de:a7:b4:63:b4:ff:b1:9c:ae: + 3c:af:77:b6:56:c5:b5:ab:a2:e9:69:3a:3d:0e:33: + 79:32:3f:70:82:92:99:61:6d:8d:30:08:8f:71:3f: + a6:48:57:19:f8:25:dc:4b:66:5c:a5:74:8f:98:ae: + c8:f9:c0:06:22:e7:ac:73:df:a5:2e:fb:52:dc:b1: + 15:65:20:fa:35:66:69:de:df:2c:f1:6e:bc:30:db: + 2c:24:12:db:eb:35:35:68:90:cb:00:b0:97:21:3d: + 74:21:23:65:34:2b:bb:78:59:a3:d6:e1:76:39:9a: + a4:49:8e:8c:74:af:6e:a4:9a:a3:d9:9b:d2:38:5c: + 9b:a2:18:cc:75:23:84:be:eb:e2:4d:33:71:8e:1a: + f0:c2:f8:c7:1d:a2:ad:03:97:2c:f8:cf:25:c6:f6: + b8:24:31:b1:63:5d:92:7f:63:f0:25:c9:53:2e:1f: + bf:4d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 95:B1:B4:F0:94:B6:BD:C7:DA:D1:11:09:21:BE:C1:AF:49:FD:10:7B + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:95:B1:B4:F0:94:B6:BD:C7:DA:D1:11:09:21:BE:C1:AF:49:FD:10:7B + DirName:/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Class 1 CA Root + serial:01 + + Signature Algorithm: sha1WithRSAEncryption + 2c:6d:64:1b:1f:cd:0d:dd:b9:01:fa:96:63:34:32:48:47:99: + ae:97:ed:fd:72:16:a6:73:47:5a:f4:eb:dd:e9:f5:d6:fb:45: + cc:29:89:44:5d:bf:46:39:3d:e8:ee:bc:4d:54:86:1e:1d:6c: + e3:17:27:43:e1:89:56:2b:a9:6f:72:4e:49:33:e3:72:7c:2a: + 23:9a:bc:3e:ff:28:2a:ed:a3:ff:1c:23:ba:43:57:09:67:4d: + 4b:62:06:2d:f8:ff:6c:9d:60:1e:d8:1c:4b:7d:b5:31:2f:d9: + d0:7c:5d:f8:de:6b:83:18:78:37:57:2f:e8:33:07:67:df:1e: + c7:6b:2a:95:76:ae:8f:57:a3:f0:f4:52:b4:a9:53:08:cf:e0: + 4f:d3:7a:53:8b:fd:bb:1c:56:36:f2:fe:b2:b6:e5:76:bb:d5: + 22:65:a7:3f:fe:d1:66:ad:0b:bc:6b:99:86:ef:3f:7d:f3:18: + 32:ca:7b:c6:e3:ab:64:46:95:f8:26:69:d9:55:83:7b:2c:96: + 07:ff:59:2c:44:a3:c6:e5:e9:a9:dc:a1:63:80:5a:21:5e:21: + cf:53:54:f0:ba:6f:89:db:a8:aa:95:cf:8b:e3:71:cc:1e:1b: + 20:44:08:c0:7a:b6:40:fd:c4:e4:35:e1:1d:16:1c:d0:bc:2b: + 8e:d6:71:d9 +MD5 Fingerprint=1E:42:95:02:33:92:6B:B9:5F:C0:7F:DA:D6:B2:4B:FC +-----BEGIN CERTIFICATE----- +MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEU +MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 +b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMw +MTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML +QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYD +VQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUA +A4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ul +CDtbKRY654eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6n +tGO0/7Gcrjyvd7ZWxbWroulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyl +dI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1Zmne3yzxbrww2ywkEtvrNTVokMsAsJch +PXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJuiGMx1I4S+6+JNM3GOGvDC ++Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8wHQYDVR0O +BBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8E +BTADAQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBl +MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFk +ZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENB +IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxtZBsfzQ3duQH6lmM0MkhHma6X +7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0PhiVYrqW9yTkkz +43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY +eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJl +pz/+0WatC7xrmYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOA +WiFeIc9TVPC6b4nbqKqVz4vjccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=SE, O=AddTrust AB, OU=AddTrust External TTP Network, CN=AddTrust External CA Root + Validity + Not Before: May 30 10:48:38 2000 GMT + Not After : May 30 10:48:38 2020 GMT + Subject: C=SE, O=AddTrust AB, OU=AddTrust External TTP Network, CN=AddTrust External CA Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b7:f7:1a:33:e6:f2:00:04:2d:39:e0:4e:5b:ed: + 1f:bc:6c:0f:cd:b5:fa:23:b6:ce:de:9b:11:33:97: + a4:29:4c:7d:93:9f:bd:4a:bc:93:ed:03:1a:e3:8f: + cf:e5:6d:50:5a:d6:97:29:94:5a:80:b0:49:7a:db: + 2e:95:fd:b8:ca:bf:37:38:2d:1e:3e:91:41:ad:70: + 56:c7:f0:4f:3f:e8:32:9e:74:ca:c8:90:54:e9:c6: + 5f:0f:78:9d:9a:40:3c:0e:ac:61:aa:5e:14:8f:9e: + 87:a1:6a:50:dc:d7:9a:4e:af:05:b3:a6:71:94:9c: + 71:b3:50:60:0a:c7:13:9d:38:07:86:02:a8:e9:a8: + 69:26:18:90:ab:4c:b0:4f:23:ab:3a:4f:84:d8:df: + ce:9f:e1:69:6f:bb:d7:42:d7:6b:44:e4:c7:ad:ee: + 6d:41:5f:72:5a:71:08:37:b3:79:65:a4:59:a0:94: + 37:f7:00:2f:0d:c2:92:72:da:d0:38:72:db:14:a8: + 45:c4:5d:2a:7d:b7:b4:d6:c4:ee:ac:cd:13:44:b7: + c9:2b:dd:43:00:25:fa:61:b9:69:6a:58:23:11:b7: + a7:33:8f:56:75:59:f5:cd:29:d7:46:b7:0a:2b:65: + b6:d3:42:6f:15:b2:b8:7b:fb:ef:e9:5d:53:d5:34: + 5a:27 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + AD:BD:98:7A:34:B4:26:F7:FA:C4:26:54:EF:03:BD:E0:24:CB:54:1A + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:AD:BD:98:7A:34:B4:26:F7:FA:C4:26:54:EF:03:BD:E0:24:CB:54:1A + DirName:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root + serial:01 + + Signature Algorithm: sha1WithRSAEncryption + b0:9b:e0:85:25:c2:d6:23:e2:0f:96:06:92:9d:41:98:9c:d9: + 84:79:81:d9:1e:5b:14:07:23:36:65:8f:b0:d8:77:bb:ac:41: + 6c:47:60:83:51:b0:f9:32:3d:e7:fc:f6:26:13:c7:80:16:a5: + bf:5a:fc:87:cf:78:79:89:21:9a:e2:4c:07:0a:86:35:bc:f2: + de:51:c4:d2:96:b7:dc:7e:4e:ee:70:fd:1c:39:eb:0c:02:51: + 14:2d:8e:bd:16:e0:c1:df:46:75:e7:24:ad:ec:f4:42:b4:85: + 93:70:10:67:ba:9d:06:35:4a:18:d3:2b:7a:cc:51:42:a1:7a: + 63:d1:e6:bb:a1:c5:2b:c2:36:be:13:0d:e6:bd:63:7e:79:7b: + a7:09:0d:40:ab:6a:dd:8f:8a:c3:f6:f6:8c:1a:42:05:51:d4: + 45:f5:9f:a7:62:21:68:15:20:43:3c:99:e7:7c:bd:24:d8:a9: + 91:17:73:88:3f:56:1b:31:38:18:b4:71:0f:9a:cd:c8:0e:9e: + 8e:2e:1b:e1:8c:98:83:cb:1f:31:f1:44:4c:c6:04:73:49:76: + 60:0f:c7:f8:bd:17:80:6b:2e:e9:cc:4c:0e:5a:9a:79:0f:20: + 0a:2e:d5:9e:63:26:1e:55:92:94:d8:82:17:5a:7b:d0:bc:c7: + 8f:4e:86:04 +MD5 Fingerprint=1D:35:54:04:85:78:B0:3F:42:42:4D:BF:20:73:0A:3F +-----BEGIN CERTIFICATE----- +MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU +MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs +IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290 +MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux +FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h +bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v +dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt +H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9 +uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX +mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX +a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN +E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0 +WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD +VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0 +Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU +cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx +IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN +AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH +YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 +6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC +Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX +c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a +mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Public CA Root + Validity + Not Before: May 30 10:41:50 2000 GMT + Not After : May 30 10:41:50 2020 GMT + Subject: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Public CA Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:e9:1a:30:8f:83:88:14:c1:20:d8:3c:9b:8f:1b: + 7e:03:74:bb:da:69:d3:46:a5:f8:8e:c2:0c:11:90: + 51:a5:2f:66:54:40:55:ea:db:1f:4a:56:ee:9f:23: + 6e:f4:39:cb:a1:b9:6f:f2:7e:f9:5d:87:26:61:9e: + 1c:f8:e2:ec:a6:81:f8:21:c5:24:cc:11:0c:3f:db: + 26:72:7a:c7:01:97:07:17:f9:d7:18:2c:30:7d:0e: + 7a:1e:62:1e:c6:4b:c0:fd:7d:62:77:d3:44:1e:27: + f6:3f:4b:44:b3:b7:38:d9:39:1f:60:d5:51:92:73: + 03:b4:00:69:e3:f3:14:4e:ee:d1:dc:09:cf:77:34: + 46:50:b0:f8:11:f2:fe:38:79:f7:07:39:fe:51:92: + 97:0b:5b:08:5f:34:86:01:ad:88:97:eb:66:cd:5e: + d1:ff:dc:7d:f2:84:da:ba:77:ad:dc:80:08:c7:a7: + 87:d6:55:9f:97:6a:e8:c8:11:64:ba:e7:19:29:3f: + 11:b3:78:90:84:20:52:5b:11:ef:78:d0:83:f6:d5: + 48:90:d0:30:1c:cf:80:f9:60:fe:79:e4:88:f2:dd: + 00:eb:94:45:eb:65:94:69:40:ba:c0:d5:b4:b8:ba: + 7d:04:11:a8:eb:31:05:96:94:4e:58:21:8e:9f:d0: + 60:fd + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 81:3E:37:D8:92:B0:1F:77:9F:5C:B4:AB:73:AA:E7:F6:34:60:2F:FA + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:81:3E:37:D8:92:B0:1F:77:9F:5C:B4:AB:73:AA:E7:F6:34:60:2F:FA + DirName:/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Public CA Root + serial:01 + + Signature Algorithm: sha1WithRSAEncryption + 03:f7:15:4a:f8:24:da:23:56:16:93:76:dd:36:28:b9:ae:1b: + b8:c3:f1:64:ba:20:18:78:95:29:27:57:05:bc:7c:2a:f4:b9: + 51:55:da:87:02:de:0f:16:17:31:f8:aa:79:2e:09:13:bb:af: + b2:20:19:12:e5:93:f9:4b:f9:83:e8:44:d5:b2:41:25:bf:88: + 75:6f:ff:10:fc:4a:54:d0:5f:f0:fa:ef:36:73:7d:1b:36:45: + c6:21:6d:b4:15:b8:4e:cf:9c:5c:a5:3d:5a:00:8e:06:e3:3c: + 6b:32:7b:f2:9f:f0:b6:fd:df:f0:28:18:48:f0:c6:bc:d0:bf: + 34:80:96:c2:4a:b1:6d:8e:c7:90:45:de:2f:67:ac:45:04:a3: + 7a:dc:55:92:c9:47:66:d8:1a:8c:c7:ed:9c:4e:9a:e0:12:bb: + b5:6a:4c:84:e1:e1:22:0d:87:00:64:fe:8c:7d:62:39:65:a6: + ef:42:b6:80:25:12:61:01:a8:24:13:70:00:11:26:5f:fa:35: + 50:c5:48:cc:06:47:e8:27:d8:70:8d:5f:64:e6:a1:44:26:5e: + 22:ec:92:cd:ff:42:9a:44:21:6d:5c:c5:e3:22:1d:5f:47:12: + e7:ce:5f:5d:fa:d8:aa:b1:33:2d:d9:76:f2:4e:3a:33:0c:2b: + b3:2d:90:06 +MD5 Fingerprint=C1:62:3E:23:C5:82:73:9C:03:59:4B:2B:E9:77:49:7F +-----BEGIN CERTIFICATE----- +MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEU +MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 +b3JrMSAwHgYDVQQDExdBZGRUcnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAx +MDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtB +ZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5ldHdvcmsxIDAeBgNV +BAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV +6tsfSlbunyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nX +GCwwfQ56HmIexkvA/X1id9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnP +dzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSGAa2Il+tmzV7R/9x98oTaunet3IAIx6eH +1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAwHM+A+WD+eeSI8t0A65RF +62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0GA1UdDgQW +BBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUw +AwEB/zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDEL +MAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRU +cnVzdCBUVFAgTmV0d29yazEgMB4GA1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJv +b3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4JNojVhaTdt02KLmuG7jD8WS6 +IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL+YPoRNWyQSW/ +iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao +GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh +4SINhwBk/ox9Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQm +XiLsks3/QppEIW1cxeMiHV9HEufOX1362KqxMy3ZdvJOOjMMK7MtkAY= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Qualified CA Root + Validity + Not Before: May 30 10:44:50 2000 GMT + Not After : May 30 10:44:50 2020 GMT + Subject: C=SE, O=AddTrust AB, OU=AddTrust TTP Network, CN=AddTrust Qualified CA Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:e4:1e:9a:fe:dc:09:5a:87:a4:9f:47:be:11:5f: + af:84:34:db:62:3c:79:78:b7:e9:30:b5:ec:0c:1c: + 2a:c4:16:ff:e0:ec:71:eb:8a:f5:11:6e:ed:4f:0d: + 91:d2:12:18:2d:49:15:01:c2:a4:22:13:c7:11:64: + ff:22:12:9a:b9:8e:5c:2f:08:cf:71:6a:b3:67:01: + 59:f1:5d:46:f3:b0:78:a5:f6:0e:42:7a:e3:7f:1b: + cc:d0:f0:b7:28:fd:2a:ea:9e:b3:b0:b9:04:aa:fd: + f6:c7:b4:b1:b8:2a:a0:fb:58:f1:19:a0:6f:70:25: + 7e:3e:69:4a:7f:0f:22:d8:ef:ad:08:11:9a:29:99: + e1:aa:44:45:9a:12:5e:3e:9d:6d:52:fc:e7:a0:3d: + 68:2f:f0:4b:70:7c:13:38:ad:bc:15:25:f1:d6:ce: + ab:a2:c0:31:d6:2f:9f:e0:ff:14:59:fc:84:93:d9: + 87:7c:4c:54:13:eb:9f:d1:2d:11:f8:18:3a:3a:de: + 25:d9:f7:d3:40:ed:a4:06:12:c4:3b:e1:91:c1:56: + 35:f0:14:dc:65:36:09:6e:ab:a4:07:c7:35:d1:c2: + 03:33:36:5b:75:26:6d:42:f1:12:6b:43:6f:4b:71: + 94:fa:34:1d:ed:13:6e:ca:80:7f:98:2f:6c:b9:65: + d8:e9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 39:95:8B:62:8B:5C:C9:D4:80:BA:58:0F:97:3F:15:08:43:CC:98:A7 + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Authority Key Identifier: + keyid:39:95:8B:62:8B:5C:C9:D4:80:BA:58:0F:97:3F:15:08:43:CC:98:A7 + DirName:/C=SE/O=AddTrust AB/OU=AddTrust TTP Network/CN=AddTrust Qualified CA Root + serial:01 + + Signature Algorithm: sha1WithRSAEncryption + 19:ab:75:ea:f8:8b:65:61:95:13:ba:69:04:ef:86:ca:13:a0: + c7:aa:4f:64:1b:3f:18:f6:a8:2d:2c:55:8f:05:b7:30:ea:42: + 6a:1d:c0:25:51:2d:a7:bf:0c:b3:ed:ef:08:7f:6c:3c:46:1a: + ea:18:43:df:76:cc:f9:66:86:9c:2c:68:f5:e9:17:f8:31:b3: + 18:c4:d6:48:7d:23:4c:68:c1:7e:bb:01:14:6f:c5:d9:6e:de: + bb:04:42:6a:f8:f6:5c:7d:e5:da:fa:87:eb:0d:35:52:67:d0: + 9e:97:76:05:93:3f:95:c7:01:e6:69:55:38:7f:10:61:99:c9: + e3:5f:a6:ca:3e:82:63:48:aa:e2:08:48:3e:aa:f2:b2:85:62: + a6:b4:a7:d9:bd:37:9c:68:b5:2d:56:7d:b0:b7:3f:a0:b1:07: + d6:e9:4f:dc:de:45:71:30:32:7f:1b:2e:09:f9:bf:52:a1:ee: + c2:80:3e:06:5c:2e:55:40:c1:1b:f5:70:45:b0:dc:5d:fa:f6: + 72:5a:77:d2:63:cd:cf:58:89:00:42:63:3f:79:39:d0:44:b0: + 82:6e:41:19:e8:dd:e0:c1:88:5a:d1:1e:71:93:1f:24:30:74: + e5:1e:a8:de:3c:27:37:7f:83:ae:9e:77:cf:f0:30:b1:ff:4b: + 99:e8:c6:a1 +MD5 Fingerprint=27:EC:39:47:CD:DA:5A:AF:E2:9A:01:65:21:A9:4C:BB +-----BEGIN CERTIFICATE----- +MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEU +MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 +b3JrMSMwIQYDVQQDExpBZGRUcnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1 +MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcxCzAJBgNVBAYTAlNFMRQwEgYDVQQK +EwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5ldHdvcmsxIzAh +BgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwq +xBb/4Oxx64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G +87B4pfYOQnrjfxvM0PC3KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i +2O+tCBGaKZnhqkRFmhJePp1tUvznoD1oL/BLcHwTOK28FSXx1s6rosAx1i+f4P8U +WfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GRwVY18BTcZTYJbqukB8c1 +0cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HUMIHRMB0G +A1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6Fr +pGkwZzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQL +ExRBZGRUcnVzdCBUVFAgTmV0d29yazEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlm +aWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBABmrder4i2VhlRO6aQTv +hsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxGGuoYQ992zPlm +hpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X +dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3 +P6CxB9bpT9zeRXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9Y +iQBCYz95OdBEsIJuQRno3eDBiFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5no +xqE= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 2b:68:d4:a3:46:9e:c5:3b:28:09:ab:38:5d:7f:27:20 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority + Validity + Not Before: Aug 4 00:00:00 2000 GMT + Not After : Aug 3 23:59:59 2004 GMT + Subject: O=VeriSign, Inc., OU=VeriSign Trust Network, OU=Terms of use at https://www.verisign.com/RPA (c)00, CN=Class 1 Public Primary OCSP Responder + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:b9:ed:5e:7a:3a:77:5f:ce:5f:3a:52:fc:cd:64: + f7:71:b5:6f:6a:96:c6:59:92:55:94:5d:2f:5b:2e: + c1:11:ea:26:8a:cb:a7:81:3c:f6:5a:44:de:7a:13: + 2f:fd:5a:51:d9:7b:37:26:4a:c0:27:3f:04:03:6a: + 56:c1:83:2c:e1:6f:5b:a9:54:50:24:4a:c6:2e:7a: + 4c:a1:5b:37:54:24:21:31:1f:a1:78:18:76:a7:b1: + 70:da:22:d0:6a:fe:07:62:40:c6:f7:f6:9b:7d:0c: + 06:b8:4b:c7:28:e4:66:23:84:51:ef:46:b7:93:d8: + 81:33:cb:e5:36:ac:c6:e8:05 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Alternative Name: + DirName:/CN=OCSP 1-1 + X509v3 CRL Distribution Points: + URI:http://crl.verisign.com/pca1.crl + + X509v3 Extended Key Usage: + OCSP Signing + Authority Information Access: + OCSP - URI:http://ocsp.verisign.com/ocsp/status + + X509v3 Certificate Policies: + Policy: 2.16.840.1.113733.1.7.1.1 + CPS: https://www.verisign.com/RPA + + X509v3 Basic Constraints: + CA:FALSE + X509v3 Key Usage: + Digital Signature + Signature Algorithm: sha1WithRSAEncryption + 70:90:dd:b8:e4:be:53:17:7c:7f:02:e9:d5:f7:8b:99:93:31: + 60:8d:7e:e6:60:6b:24:ef:60:ac:d2:ce:91:de:80:6d:09:a4: + d3:b8:38:e5:44:ca:72:5e:0d:2d:c1:77:9c:bd:2c:03:78:29: + 8d:a4:a5:77:87:f5:f1:2b:26:ad:cc:07:6c:3a:54:5a:28:e0: + 09:f3:4d:0a:04:ca:d4:58:69:0b:a7:b3:f5:dd:01:a5:e7:dc: + f0:1f:ba:c1:5d:90:8d:b3:ea:4f:c1:11:59:97:6a:b2:2b:13: + b1:da:ad:97:a1:b3:b1:a0:20:5b:ca:32:ab:8d:cf:13:f0:1f: + 29:c3 +MD5 Fingerprint=7E:6F:3A:53:1B:7C:BE:B0:30:DB:43:1E:1E:94:89:B2 +-----BEGIN CERTIFICATE----- +MIIDnjCCAwegAwIBAgIQK2jUo0aexTsoCas4XX8nIDANBgkqhkiG9w0BAQUFADBf +MQswCQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNzA1BgNVBAsT +LkNsYXNzIDEgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw +HhcNMDAwODA0MDAwMDAwWhcNMDQwODAzMjM1OTU5WjCBpzEXMBUGA1UEChMOVmVy +aVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxOzA5 +BgNVBAsTMlRlcm1zIG9mIHVzZSBhdCBodHRwczovL3d3dy52ZXJpc2lnbi5jb20v +UlBBIChjKTAwMS4wLAYDVQQDEyVDbGFzcyAxIFB1YmxpYyBQcmltYXJ5IE9DU1Ag +UmVzcG9uZGVyMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC57V56Ondfzl86 +UvzNZPdxtW9qlsZZklWUXS9bLsER6iaKy6eBPPZaRN56Ey/9WlHZezcmSsAnPwQD +albBgyzhb1upVFAkSsYuekyhWzdUJCExH6F4GHansXDaItBq/gdiQMb39pt9DAa4 +S8co5GYjhFHvRreT2IEzy+U2rMboBQIDAQABo4IBEDCCAQwwIAYDVR0RBBkwF6QV +MBMxETAPBgNVBAMTCE9DU1AgMS0xMDEGA1UdHwQqMCgwJqAkoCKGIGh0dHA6Ly9j +cmwudmVyaXNpZ24uY29tL3BjYTEuY3JsMBMGA1UdJQQMMAoGCCsGAQUFBwMJMEIG +CCsGAQUFBwEBBDYwNDAyBggrBgEFBQcwAaYmFiRodHRwOi8vb2NzcC52ZXJpc2ln +bi5jb20vb2NzcC9zdGF0dXMwRAYDVR0gBD0wOzA5BgtghkgBhvhFAQcBATAqMCgG +CCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vUlBBMAkGA1UdEwQC +MAAwCwYDVR0PBAQDAgeAMA0GCSqGSIb3DQEBBQUAA4GBAHCQ3bjkvlMXfH8C6dX3 +i5mTMWCNfuZgayTvYKzSzpHegG0JpNO4OOVEynJeDS3Bd5y9LAN4KY2kpXeH9fEr +Jq3MB2w6VFoo4AnzTQoEytRYaQuns/XdAaXn3PAfusFdkI2z6k/BEVmXarIrE7Ha +rZehs7GgIFvKMquNzxPwHynD +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 09:46:17:e6:1d:d8:d4:1c:a0:0c:a0:62:e8:79:8a:a7 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 2 Public Primary Certification Authority + Validity + Not Before: Aug 1 00:00:00 2000 GMT + Not After : Jul 31 23:59:59 2004 GMT + Subject: O=VeriSign, Inc., OU=VeriSign Trust Network, OU=Terms of use at https://www.verisign.com/RPA (c)00, CN=Class 2 Public Primary OCSP Responder + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d0:ca:63:31:61:7f:44:34:7c:05:7d:0b:3d:6a: + 90:cb:79:4b:77:0a:3f:4b:c7:23:e5:c0:62:2d:7e: + 9c:7e:3e:88:87:91:d0:ac:e8:4d:49:87:a2:96:90: + 8a:dd:04:a5:02:3f:8c:9b:e9:89:fe:62:a0:e2:5a: + bd:c8:dd:b4:78:e6:a5:42:93:08:67:01:c0:20:4d: + d7:5c:f4:5d:da:b3:e3:37:a6:52:1a:2c:4c:65:4d: + 8a:87:d9:a8:a3:f1:49:54:bb:3c:5c:80:51:68:c6: + fb:49:ff:0b:55:ab:15:dd:fb:9a:c1:b9:1d:74:0d: + b2:8c:44:5d:89:fc:9f:f9:83 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Alternative Name: + DirName:/CN=OCSP 1-2 + X509v3 CRL Distribution Points: + URI:http://crl.verisign.com/pca2.crl + + X509v3 Extended Key Usage: + OCSP Signing + Authority Information Access: + OCSP - URI:http://ocsp.verisign.com/ocsp/status + + X509v3 Certificate Policies: + Policy: 2.16.840.1.113733.1.7.1.1 + CPS: https://www.verisign.com/RPA + + X509v3 Basic Constraints: + CA:FALSE + X509v3 Key Usage: + Digital Signature + Signature Algorithm: sha1WithRSAEncryption + 1f:7d:09:6e:24:46:75:04:9c:f3:26:9b:e3:39:6e:17:ef:bc: + bd:a2:1b:d2:02:84:86:ab:d0:40:97:2c:c4:43:88:37:19:6b: + 22:a8:03:71:50:9d:20:dc:36:60:20:9a:73:2d:73:55:6c:58: + 9b:2c:c2:b4:34:2c:7a:33:42:ca:91:d9:e9:43:af:cf:1e:e0: + f5:c4:7a:ab:3f:72:63:1e:a9:37:e1:5b:3b:88:b3:13:86:82: + 90:57:cb:57:ff:f4:56:be:22:dd:e3:97:a8:e1:bc:22:43:c2: + dd:4d:db:f6:81:9e:92:14:9e:39:0f:13:54:de:82:d8:c0:5e: + 34:8d +MD5 Fingerprint=F3:45:BD:10:96:0D:85:4B:EF:9F:11:62:34:A7:5E:B5 +-----BEGIN CERTIFICATE----- +MIIDnjCCAwegAwIBAgIQCUYX5h3Y1BygDKBi6HmKpzANBgkqhkiG9w0BAQUFADBf +MQswCQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNzA1BgNVBAsT +LkNsYXNzIDIgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw +HhcNMDAwODAxMDAwMDAwWhcNMDQwNzMxMjM1OTU5WjCBpzEXMBUGA1UEChMOVmVy +aVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxOzA5 +BgNVBAsTMlRlcm1zIG9mIHVzZSBhdCBodHRwczovL3d3dy52ZXJpc2lnbi5jb20v +UlBBIChjKTAwMS4wLAYDVQQDEyVDbGFzcyAyIFB1YmxpYyBQcmltYXJ5IE9DU1Ag +UmVzcG9uZGVyMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDQymMxYX9ENHwF +fQs9apDLeUt3Cj9LxyPlwGItfpx+PoiHkdCs6E1Jh6KWkIrdBKUCP4yb6Yn+YqDi +Wr3I3bR45qVCkwhnAcAgTddc9F3as+M3plIaLExlTYqH2aij8UlUuzxcgFFoxvtJ +/wtVqxXd+5rBuR10DbKMRF2J/J/5gwIDAQABo4IBEDCCAQwwIAYDVR0RBBkwF6QV +MBMxETAPBgNVBAMTCE9DU1AgMS0yMDEGA1UdHwQqMCgwJqAkoCKGIGh0dHA6Ly9j +cmwudmVyaXNpZ24uY29tL3BjYTIuY3JsMBMGA1UdJQQMMAoGCCsGAQUFBwMJMEIG +CCsGAQUFBwEBBDYwNDAyBggrBgEFBQcwAaYmFiRodHRwOi8vb2NzcC52ZXJpc2ln +bi5jb20vb2NzcC9zdGF0dXMwRAYDVR0gBD0wOzA5BgtghkgBhvhFAQcBATAqMCgG +CCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vUlBBMAkGA1UdEwQC +MAAwCwYDVR0PBAQDAgeAMA0GCSqGSIb3DQEBBQUAA4GBAB99CW4kRnUEnPMmm+M5 +bhfvvL2iG9IChIar0ECXLMRDiDcZayKoA3FQnSDcNmAgmnMtc1VsWJsswrQ0LHoz +QsqR2elDr88e4PXEeqs/cmMeqTfhWzuIsxOGgpBXy1f/9Fa+It3jl6jhvCJDwt1N +2/aBnpIUnjkPE1TegtjAXjSN +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 2e:96:9e:bf:b6:62:6c:ec:7b:e9:73:cc:e3:6c:c1:84 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority + Validity + Not Before: Aug 4 00:00:00 2000 GMT + Not After : Aug 3 23:59:59 2004 GMT + Subject: O=VeriSign, Inc., OU=VeriSign Trust Network, OU=Terms of use at https://www.verisign.com/RPA (c)00, CN=Class 3 Public Primary OCSP Responder + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:f1:e4:08:0e:83:bb:75:e3:48:e5:b8:db:a6:f0: + b9:ab:e9:3c:62:c7:5e:35:5b:d0:02:54:11:d8:c9: + d1:56:b9:76:4b:b9:ab:7a:e6:cd:ba:f6:0c:04:d6: + 7e:d6:b0:0a:65:ac:4e:39:e3:f1:f7:2d:a3:25:39: + ef:b0:8b:cf:be:db:0c:5d:6e:70:f4:07:cd:70:f7: + 3a:c0:3e:35:16:ed:78:8c:43:cf:c2:26:2e:47:d6: + 86:7d:9c:f1:be:d6:67:0c:22:25:a4:ca:65:e6:1f: + 7a:78:28:2f:3f:05:db:04:21:bf:e1:45:66:fe:3c: + b7:82:ed:5a:b8:16:15:b9:55 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Alternative Name: + DirName:/CN=OCSP 1-3 + X509v3 CRL Distribution Points: + URI:http://crl.verisign.com/pca3.1.1.crl + + X509v3 Extended Key Usage: + OCSP Signing + Authority Information Access: + OCSP - URI:http://ocsp.verisign.com/ocsp/status + + X509v3 Certificate Policies: + Policy: 2.16.840.1.113733.1.7.1.1 + CPS: https://www.verisign.com/RPA + + X509v3 Basic Constraints: + CA:FALSE + X509v3 Key Usage: + Digital Signature + Signature Algorithm: sha1WithRSAEncryption + 02:f6:53:63:c0:a9:1e:f2:d0:8b:33:30:8f:48:9b:4c:b0:56: + b4:83:71:4a:be:dc:50:d8:f5:b6:e0:0b:db:bd:78:4f:e9:cf: + 09:34:da:29:49:9d:01:73:5a:91:91:82:54:2c:13:0a:d3:77: + 23:cf:37:fc:63:de:a7:e3:f6:b7:b5:69:45:28:49:c3:91:dc: + aa:47:1c:a9:88:99:2c:05:2a:8d:8d:8a:fa:62:e2:5a:b7:00: + 20:5d:39:c4:28:c2:cb:fc:9e:a8:89:ae:5b:3d:8e:12:ea:32: + b2:fc:eb:14:d7:09:15:1a:c0:cd:1b:d5:b5:15:4e:41:d5:96: + e3:4e +MD5 Fingerprint=7D:51:92:C9:76:83:98:16:DE:8C:B3:86:C4:7D:66:FB +-----BEGIN CERTIFICATE----- +MIIDojCCAwugAwIBAgIQLpaev7ZibOx76XPM42zBhDANBgkqhkiG9w0BAQUFADBf +MQswCQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNzA1BgNVBAsT +LkNsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw +HhcNMDAwODA0MDAwMDAwWhcNMDQwODAzMjM1OTU5WjCBpzEXMBUGA1UEChMOVmVy +aVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxOzA5 +BgNVBAsTMlRlcm1zIG9mIHVzZSBhdCBodHRwczovL3d3dy52ZXJpc2lnbi5jb20v +UlBBIChjKTAwMS4wLAYDVQQDEyVDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IE9DU1Ag +UmVzcG9uZGVyMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDx5AgOg7t140jl +uNum8Lmr6Txix141W9ACVBHYydFWuXZLuat65s269gwE1n7WsAplrE454/H3LaMl +Oe+wi8++2wxdbnD0B81w9zrAPjUW7XiMQ8/CJi5H1oZ9nPG+1mcMIiWkymXmH3p4 +KC8/BdsEIb/hRWb+PLeC7Vq4FhW5VQIDAQABo4IBFDCCARAwIAYDVR0RBBkwF6QV +MBMxETAPBgNVBAMTCE9DU1AgMS0zMDUGA1UdHwQuMCwwKqAooCaGJGh0dHA6Ly9j +cmwudmVyaXNpZ24uY29tL3BjYTMuMS4xLmNybDATBgNVHSUEDDAKBggrBgEFBQcD +CTBCBggrBgEFBQcBAQQ2MDQwMgYIKwYBBQUHMAGmJhYkaHR0cDovL29jc3AudmVy +aXNpZ24uY29tL29jc3Avc3RhdHVzMEQGA1UdIAQ9MDswOQYLYIZIAYb4RQEHAQEw +KjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL1JQQTAJBgNV +HRMEAjAAMAsGA1UdDwQEAwIHgDANBgkqhkiG9w0BAQUFAAOBgQAC9lNjwKke8tCL +MzCPSJtMsFa0g3FKvtxQ2PW24AvbvXhP6c8JNNopSZ0Bc1qRkYJULBMK03cjzzf8 +Y96n4/a3tWlFKEnDkdyqRxypiJksBSqNjYr6YuJatwAgXTnEKMLL/J6oia5bPY4S +6jKy/OsU1wkVGsDNG9W1FU5B1ZbjTg== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + ff:45:d5:27:5d:24:fb:b3:c2:39:24:53:57:e1:4f:de + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification Authority + Validity + Not Before: Aug 4 00:00:00 2000 GMT + Not After : Aug 3 23:59:59 2004 GMT + Subject: O=VeriSign, Inc., OU=VeriSign Trust Network, OU=Terms of use at https://www.verisign.com/RPA (c)00, CN=Secure Server OCSP Responder + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:b8:51:99:64:85:0e:ee:b3:0a:68:f0:bf:63:76: + 1d:53:f5:fc:a1:78:8c:33:ee:9f:f4:be:39:da:9b: + 0f:4d:47:a9:8f:20:e8:4b:44:bd:ce:cd:7b:90:d1: + 30:e8:90:c4:25:7b:89:28:de:bd:f6:93:1d:ff:b9: + ff:92:b5:a9:8d:e4:ae:cc:e2:c3:07:83:6a:a3:72: + 10:01:27:62:22:a6:35:26:39:2d:9e:cf:60:0c:fc: + 47:a4:d7:d0:42:78:a7:1d:6c:d0:cb:4f:15:a7:29: + 0a:b4:95:45:c4:b1:e7:5a:09:d7:39:95:d8:1d:35: + 9e:c2:bd:b3:5d:c1:0c:4b:1f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Alternative Name: + DirName:/CN=OCSP 1-4 + X509v3 CRL Distribution Points: + URI:http://crl.verisign.com/RSASecureServer-p.crl + + X509v3 Extended Key Usage: + OCSP Signing + Authority Information Access: + OCSP - URI:http://ocsp.verisign.com/ocsp/status + + X509v3 Certificate Policies: + Policy: 2.16.840.1.113733.1.7.1.1 + CPS: https://www.verisign.com/RPA + + X509v3 Basic Constraints: + CA:FALSE + X509v3 Key Usage: + Digital Signature + Signature Algorithm: sha1WithRSAEncryption + 00:b3:10:53:66:9c:49:93:2e:31:a0:02:42:d2:58:57:7e:66: + a1:fe:1b:8a:61:18:50:40:2c:1e:2b:41:a5:d6:db:ff:ac:08: + 1c:5a:05:6d:02:5c:2a:b6:96:4f:47:db:be:4e:db:ce:cc:ba: + 86:b8:18:ce:b1:12:91:5f:63:f7:f3:48:3e:cc:f1:4d:13:e4: + 6d:09:94:78:00:92:cb:a3:20:9d:06:0b:6a:a0:43:07:ce:d1: + 19:6c:8f:18:75:9a:9f:17:33:fd:a9:26:b8:e3:e2:de:c2:a8: + c4:5a:8a:7f:98:d6:07:06:6b:cc:56:9e:86:70:ce:d4:ef +MD5 Fingerprint=2C:62:C3:D8:80:01:16:09:EA:59:EA:78:AB:10:43:F6 +-----BEGIN CERTIFICATE----- +MIIDnzCCAwygAwIBAgIRAP9F1SddJPuzwjkkU1fhT94wDQYJKoZIhvcNAQEFBQAw +XzELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1JTQSBEYXRhIFNlY3VyaXR5LCBJbmMu +MS4wLAYDVQQLEyVTZWN1cmUgU2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +MB4XDTAwMDgwNDAwMDAwMFoXDTA0MDgwMzIzNTk1OVowgZ4xFzAVBgNVBAoTDlZl +cmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTsw +OQYDVQQLEzJUZXJtcyBvZiB1c2UgYXQgaHR0cHM6Ly93d3cudmVyaXNpZ24uY29t +L1JQQSAoYykwMDElMCMGA1UEAxMcU2VjdXJlIFNlcnZlciBPQ1NQIFJlc3BvbmRl +cjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuFGZZIUO7rMKaPC/Y3YdU/X8 +oXiMM+6f9L452psPTUepjyDoS0S9zs17kNEw6JDEJXuJKN699pMd/7n/krWpjeSu +zOLDB4Nqo3IQASdiIqY1Jjktns9gDPxHpNfQQninHWzQy08VpykKtJVFxLHnWgnX +OZXYHTWewr2zXcEMSx8CAwEAAaOCAR0wggEZMCAGA1UdEQQZMBekFTATMREwDwYD +VQQDEwhPQ1NQIDEtNDA+BgNVHR8ENzA1MDOgMaAvhi1odHRwOi8vY3JsLnZlcmlz +aWduLmNvbS9SU0FTZWN1cmVTZXJ2ZXItcC5jcmwwEwYDVR0lBAwwCgYIKwYBBQUH +AwkwQgYIKwYBBQUHAQEENjA0MDIGCCsGAQUFBzABpiYWJGh0dHA6Ly9vY3NwLnZl +cmlzaWduLmNvbS9vY3NwL3N0YXR1czBEBgNVHSAEPTA7MDkGC2CGSAGG+EUBBwEB +MCowKAYIKwYBBQUHAgEWHGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9SUEEwCQYD +VR0TBAIwADALBgNVHQ8EBAMCB4AwDQYJKoZIhvcNAQEFBQADfgAAsxBTZpxJky4x +oAJC0lhXfmah/huKYRhQQCweK0Gl1tv/rAgcWgVtAlwqtpZPR9u+TtvOzLqGuBjO +sRKRX2P380g+zPFNE+RtCZR4AJLLoyCdBgtqoEMHztEZbI8YdZqfFzP9qSa44+Le +wqjEWop/mNYHBmvMVp6GcM7U7w== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 53:61:b2:60:ae:db:71:8e:a7:94:b3:13:33:f4:07:09 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority - G2, OU=(c) 1998 VeriSign, Inc. - For authorized use only, OU=VeriSign Trust Network + Validity + Not Before: Sep 26 00:00:00 2000 GMT + Not After : Sep 25 23:59:59 2010 GMT + Subject: O=VeriSign, Inc., OU=VeriSign Trust Network, OU=Terms of use at https://www.verisign.com/rpa (c)00, CN=VeriSign Time Stamping Authority CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d2:19:9d:67:c2:00:21:59:62:ce:b4:09:22:44: + 69:8a:f8:25:5a:db:ed:0d:b7:36:7e:4e:e0:bb:94: + 3e:90:25:87:c2:61:47:29:d9:bd:54:b8:63:cc:2c: + 7d:69:b4:33:36:f4:37:07:9a:c1:dd:40:54:fc:e0: + 78:9d:a0:93:b9:09:3d:23:51:7f:44:c2:14:74:db: + 0a:be:cb:c9:30:34:40:98:3e:d0:d7:25:10:81:94: + bd:07:4f:9c:d6:54:27:df:2e:a8:bf:cb:90:8c:8d: + 75:4b:bc:e2:e8:44:87:cd:e6:41:0a:25:6e:e8:f4: + 24:02:c5:52:0f:6e:ec:98:75 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:TRUE, pathlen:0 + X509v3 Certificate Policies: + Policy: 2.16.840.1.113733.1.7.23.1.3 + CPS: https://www.verisign.com/rpa + + X509v3 CRL Distribution Points: + URI:http://crl.verisign.com/pca3.crl + + X509v3 Key Usage: + Certificate Sign, CRL Sign + Authority Information Access: + OCSP - URI:http://ocsp.verisign.com/ocsp/status + + Signature Algorithm: sha1WithRSAEncryption + 82:70:68:95:df:b6:0d:c2:01:70:19:4a:d2:54:56:1e:ac:f2: + 45:4c:87:b8:f5:35:eb:78:4b:05:a9:c8:9d:3b:19:21:2e:70: + 34:4a:a2:f5:89:e0:15:75:45:e7:28:37:00:34:27:29:e8:37: + 4b:f2:ef:44:97:6b:17:51:1a:c3:56:9d:3c:1a:8a:f6:4a:46: + 46:37:8c:fa:cb:f5:64:5a:38:68:2e:1c:c3:ef:70:ce:b8:46: + 06:16:bf:f7:7e:e7:b5:a8:3e:45:ac:a9:25:75:22:7b:6f:3f: + b0:9c:94:e7:c7:73:ab:ac:1f:ee:25:9b:c0:16:ed:b7:ca:5b: + f0:14 +MD5 Fingerprint=89:49:54:8C:C8:68:9A:83:29:EC:DC:06:73:21:AB:97 +-----BEGIN CERTIFICATE----- +MIIDzTCCAzagAwIBAgIQU2GyYK7bcY6nlLMTM/QHCTANBgkqhkiG9w0BAQUFADCB +wTELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTwwOgYDVQQL +EzNDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +IC0gRzIxOjA4BgNVBAsTMShjKSAxOTk4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1 +dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv +cmswHhcNMDAwOTI2MDAwMDAwWhcNMTAwOTI1MjM1OTU5WjCBpTEXMBUGA1UEChMO +VmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsx +OzA5BgNVBAsTMlRlcm1zIG9mIHVzZSBhdCBodHRwczovL3d3dy52ZXJpc2lnbi5j +b20vcnBhIChjKTAwMSwwKgYDVQQDEyNWZXJpU2lnbiBUaW1lIFN0YW1waW5nIEF1 +dGhvcml0eSBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0hmdZ8IAIVli +zrQJIkRpivglWtvtDbc2fk7gu5Q+kCWHwmFHKdm9VLhjzCx9abQzNvQ3B5rB3UBU +/OB4naCTuQk9I1F/RMIUdNsKvsvJMDRAmD7Q1yUQgZS9B0+c1lQn3y6ov8uQjI11 +S7zi6ESHzeZBCiVu6PQkAsVSD27smHUCAwEAAaOB3zCB3DAPBgNVHRMECDAGAQH/ +AgEAMEUGA1UdIAQ+MDwwOgYMYIZIAYb4RQEHFwEDMCowKAYIKwYBBQUHAgEWHGh0 +dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9ycGEwMQYDVR0fBCowKDAmoCSgIoYgaHR0 +cDovL2NybC52ZXJpc2lnbi5jb20vcGNhMy5jcmwwCwYDVR0PBAQDAgEGMEIGCCsG +AQUFBwEBBDYwNDAyBggrBgEFBQcwAaYmFiRodHRwOi8vb2NzcC52ZXJpc2lnbi5j +b20vb2NzcC9zdGF0dXMwDQYJKoZIhvcNAQEFBQADgYEAgnBold+2DcIBcBlK0lRW +HqzyRUyHuPU163hLBanInTsZIS5wNEqi9YngFXVF5yg3ADQnKeg3S/LvRJdrF1Ea +w1adPBqK9kpGRjeM+sv1ZFo4aC4cw+9wzrhGBha/937ntag+RaypJXUie28/sJyU +58dzq6wf7iWbwBbtt8pb8BQ= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ZA, ST=Western Cape, L=Durbanville, O=Thawte, OU=Thawte Certification, CN=Thawte Timestamping CA + Validity + Not Before: Jan 1 00:00:00 1997 GMT + Not After : Dec 31 23:59:59 2020 GMT + Subject: C=ZA, ST=Western Cape, L=Durbanville, O=Thawte, OU=Thawte Certification, CN=Thawte Timestamping CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d6:2b:58:78:61:45:86:53:ea:34:7b:51:9c:ed: + b0:e6:2e:18:0e:fe:e0:5f:a8:27:d3:b4:c9:e0:7c: + 59:4e:16:0e:73:54:60:c1:7f:f6:9f:2e:e9:3a:85: + 24:15:3c:db:47:04:63:c3:9e:c4:94:1a:5a:df:4c: + 7a:f3:d9:43:1d:3c:10:7a:79:25:db:90:fe:f0:51: + e7:30:d6:41:00:fd:9f:28:df:79:be:94:bb:9d:b6: + 14:e3:23:85:d7:a9:41:e0:4c:a4:79:b0:2b:1a:8b: + f2:f8:3b:8a:3e:45:ac:71:92:00:b4:90:41:98:fb: + 5f:ed:fa:b7:2e:8a:f8:88:37 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: md5WithRSAEncryption + 67:db:e2:c2:e6:87:3d:40:83:86:37:35:7d:1f:ce:9a:c3:0c: + 66:20:a8:ba:aa:04:89:86:c2:f5:10:08:0d:bf:cb:a2:05:8a: + d0:4d:36:3e:f4:d7:ef:69:c6:5e:e4:b0:94:6f:4a:b9:e7:de: + 5b:88:b6:7b:db:e3:27:e5:76:c3:f0:35:c1:cb:b5:27:9b:33: + 79:dc:90:a6:00:9e:77:fa:fc:cd:27:94:42:16:9c:d3:1c:68: + ec:bf:5c:dd:e5:a9:7b:10:0a:32:74:54:13:31:8b:85:03:84: + 91:b7:58:01:30:14:38:af:28:ca:fc:b1:50:19:19:09:ac:89: + 49:d3 +MD5 Fingerprint=7F:66:7A:71:D3:EB:69:78:20:9A:51:14:9D:83:DA:20 +-----BEGIN CERTIFICATE----- +MIICoTCCAgqgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBizELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTEUMBIGA1UEBxMLRHVyYmFudmlsbGUxDzAN +BgNVBAoTBlRoYXd0ZTEdMBsGA1UECxMUVGhhd3RlIENlcnRpZmljYXRpb24xHzAd +BgNVBAMTFlRoYXd0ZSBUaW1lc3RhbXBpbmcgQ0EwHhcNOTcwMTAxMDAwMDAwWhcN +MjAxMjMxMjM1OTU5WjCBizELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4g +Q2FwZTEUMBIGA1UEBxMLRHVyYmFudmlsbGUxDzANBgNVBAoTBlRoYXd0ZTEdMBsG +A1UECxMUVGhhd3RlIENlcnRpZmljYXRpb24xHzAdBgNVBAMTFlRoYXd0ZSBUaW1l +c3RhbXBpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANYrWHhhRYZT +6jR7UZztsOYuGA7+4F+oJ9O0yeB8WU4WDnNUYMF/9p8u6TqFJBU820cEY8OexJQa +Wt9MevPZQx08EHp5JduQ/vBR5zDWQQD9nyjfeb6Uu522FOMjhdepQeBMpHmwKxqL +8vg7ij5FrHGSALSQQZj7X+36ty6K+Ig3AgMBAAGjEzARMA8GA1UdEwEB/wQFMAMB +Af8wDQYJKoZIhvcNAQEEBQADgYEAZ9viwuaHPUCDhjc1fR/OmsMMZiCouqoEiYbC +9RAIDb/LogWK0E02PvTX72nGXuSwlG9KuefeW4i2e9vjJ+V2w/A1wcu1J5szedyQ +pgCed/r8zSeUQhac0xxo7L9c3eWpexAKMnRUEzGLhQOEkbdYATAUOK8oyvyxUBkZ +CayJSdM= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 949686588 (0x389b113c) + Signature Algorithm: md5WithRSAEncryption + Issuer: O=Entrust.net, OU=www.entrust.net/SSL_CPS incorp. by ref. (limits liab.), OU=(c) 2000 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority + Validity + Not Before: Feb 4 17:20:00 2000 GMT + Not After : Feb 4 17:50:00 2020 GMT + Subject: O=Entrust.net, OU=www.entrust.net/SSL_CPS incorp. by ref. (limits liab.), OU=(c) 2000 Entrust.net Limited, CN=Entrust.net Secure Server Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:c7:c1:5f:4e:71:f1:ce:f0:60:86:0f:d2:58:7f: + d3:33:97:2d:17:a2:75:30:b5:96:64:26:2f:68:c3: + 44:ab:a8:75:e6:00:67:34:57:9e:65:c7:22:9b:73: + e6:d3:dd:08:0e:37:55:aa:25:46:81:6c:bd:fe:a8: + f6:75:57:57:8c:90:6c:4a:c3:3e:8b:4b:43:0a:c9: + 11:56:9a:9a:27:22:99:cf:55:9e:61:d9:02:e2:7c: + b6:7c:38:07:dc:e3:7f:4f:9a:b9:03:41:80:b6:75: + 67:13:0b:9f:e8:57:36:c8:5d:00:36:de:66:14:da: + 6e:76:1f:4f:37:8c:82:13:89 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/O=Entrust.net/OU=www.entrust.net/SSL_CPS incorp. by ref. (limits liab.)/OU=(c) 2000 Entrust.net Limited/CN=Entrust.net Secure Server Certification Authority/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Feb 4 17:20:00 2000 GMT, Not After: Feb 4 17:50:00 2020 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:CB:6C:C0:6B:E3:BB:3E:CB:FC:22:9C:FE:FB:8B:92:9C:B0:F2:6E:22 + + X509v3 Subject Key Identifier: + CB:6C:C0:6B:E3:BB:3E:CB:FC:22:9C:FE:FB:8B:92:9C:B0:F2:6E:22 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V5.0:4.0.... + Signature Algorithm: md5WithRSAEncryption + 62:db:81:91:ce:c8:9a:77:42:2f:ec:bd:27:a3:53:0f:50:1b: + ea:4e:92:f0:a9:af:a9:a0:ba:48:61:cb:ef:c9:06:ef:1f:d5: + f4:ee:df:56:2d:e6:ca:6a:19:73:aa:53:be:92:b3:50:02:b6: + 85:26:72:63:d8:75:50:62:75:14:b7:b3:50:1a:3f:ca:11:00: + 0b:85:45:69:6d:b6:a5:ae:51:e1:4a:dc:82:3f:6c:8c:34:b2: + 77:6b:d9:02:f6:7f:0e:ea:65:04:f1:cd:54:ca:ba:c9:cc:e0: + 84:f7:c8:3e:11:97:d3:60:09:18:bc:05:ff:6c:89:33:f0:ec: + 15:0f +MD5 Fingerprint=9D:66:6A:CC:FF:D5:F5:43:B4:BF:8C:16:D1:2B:A8:99 +-----BEGIN CERTIFICATE----- +MIIElTCCA/6gAwIBAgIEOJsRPDANBgkqhkiG9w0BAQQFADCBujEUMBIGA1UEChML +RW50cnVzdC5uZXQxPzA9BgNVBAsUNnd3dy5lbnRydXN0Lm5ldC9TU0xfQ1BTIGlu +Y29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMcKGMpIDIwMDAg +RW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5uZXQgU2VjdXJl +IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMDAyMDQxNzIwMDBa +Fw0yMDAyMDQxNzUwMDBaMIG6MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDE/MD0GA1UE +CxQ2d3d3LmVudHJ1c3QubmV0L1NTTF9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p +dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMjAwMCBFbnRydXN0Lm5ldCBMaW1pdGVk +MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp +b24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHwV9OcfHO +8GCGD9JYf9Mzly0XonUwtZZkJi9ow0SrqHXmAGc0V55lxyKbc+bT3QgON1WqJUaB +bL3+qPZ1V1eMkGxKwz6LS0MKyRFWmponIpnPVZ5h2QLifLZ8OAfc439PmrkDQYC2 +dWcTC5/oVzbIXQA23mYU2m52H083jIITiQIDAQABo4IBpDCCAaAwEQYJYIZIAYb4 +QgEBBAQDAgAHMIHjBgNVHR8EgdswgdgwgdWggdKggc+kgcwwgckxFDASBgNVBAoT +C0VudHJ1c3QubmV0MT8wPQYDVQQLFDZ3d3cuZW50cnVzdC5uZXQvU1NMX0NQUyBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAyMDAw +IEVudHJ1c3QubmV0IExpbWl0ZWQxOjA4BgNVBAMTMUVudHJ1c3QubmV0IFNlY3Vy +ZSBTZXJ2ZXIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxDTALBgNVBAMTBENSTDEw +KwYDVR0QBCQwIoAPMjAwMDAyMDQxNzIwMDBagQ8yMDIwMDIwNDE3NTAwMFowCwYD +VR0PBAQDAgEGMB8GA1UdIwQYMBaAFMtswGvjuz7L/CKc/vuLkpyw8m4iMB0GA1Ud +DgQWBBTLbMBr47s+y/winP77i5KcsPJuIjAMBgNVHRMEBTADAQH/MB0GCSqGSIb2 +fQdBAAQQMA4bCFY1LjA6NC4wAwIEkDANBgkqhkiG9w0BAQQFAAOBgQBi24GRzsia +d0Iv7L0no1MPUBvqTpLwqa+poLpIYcvvyQbvH9X07t9WLebKahlzqlO+krNQAraF +JnJj2HVQYnUUt7NQGj/KEQALhUVpbbalrlHhStyCP2yMNLJ3a9kC9n8O6mUE8c1U +yrrJzOCE98g+EZfTYAkYvAX/bIkz8OwVDw== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 949941988 (0x389ef6e4) + Signature Algorithm: md5WithRSAEncryption + Issuer: O=Entrust.net, OU=www.entrust.net/GCCA_CPS incorp. by ref. (limits liab.), OU=(c) 2000 Entrust.net Limited, CN=Entrust.net Client Certification Authority + Validity + Not Before: Feb 7 16:16:40 2000 GMT + Not After : Feb 7 16:46:40 2020 GMT + Subject: O=Entrust.net, OU=www.entrust.net/GCCA_CPS incorp. by ref. (limits liab.), OU=(c) 2000 Entrust.net Limited, CN=Entrust.net Client Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:93:74:b4:b6:e4:c5:4b:d6:a1:68:7f:62:d5:ec: + f7:51:57:b3:72:4a:98:f5:d0:89:c9:ad:63:cd:4d: + 35:51:6a:84:d4:ad:c9:68:79:6f:b8:eb:11:db:87: + ae:5c:24:51:13:f1:54:25:84:af:29:2b:9f:e3:80: + e2:d9:cb:dd:c6:45:49:34:88:90:5e:01:97:ef:ea: + 53:a6:dd:fc:c1:de:4b:2a:25:e4:e9:35:fa:55:05: + 06:e5:89:7a:ea:a4:11:57:3b:fc:7c:3d:36:cd:67: + 35:6d:a4:a9:25:59:bd:66:f5:f9:27:e4:95:67:d6: + 3f:92:80:5e:f2:34:7d:2b:85 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/O=Entrust.net/OU=www.entrust.net/GCCA_CPS incorp. by ref. (limits liab.)/OU=(c) 2000 Entrust.net Limited/CN=Entrust.net Client Certification Authority/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Feb 7 16:16:40 2000 GMT, Not After: Feb 7 16:46:40 2020 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:84:8B:74:FD:C5:8D:C0:FF:27:6D:20:37:45:7C:FE:2D:CE:BA:D3:7D + + X509v3 Subject Key Identifier: + 84:8B:74:FD:C5:8D:C0:FF:27:6D:20:37:45:7C:FE:2D:CE:BA:D3:7D + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V5.0:4.0.... + Signature Algorithm: md5WithRSAEncryption + 4e:6f:35:80:3b:d1:8a:f5:0e:a7:20:cb:2d:65:55:d0:92:f4: + e7:84:b5:06:26:83:12:84:0b:ac:3b:b2:44:ee:bd:cf:40:db: + 20:0e:ba:6e:14:ea:30:e0:3b:62:7c:7f:8b:6b:7c:4a:a7:d5: + 35:3c:be:a8:5c:ea:4b:bb:93:8e:80:66:ab:0f:29:fd:4d:2d: + bf:1a:9b:0a:90:c5:ab:da:d1:b3:86:d4:2f:24:52:5c:7a:6d: + c6:f2:fe:e5:4d:1a:30:8c:90:f2:ba:d7:4a:3e:43:7e:d4:c8: + 50:1a:87:f8:4f:81:c7:76:0b:84:3a:72:9d:ce:65:66:97:ae: + 26:5e +MD5 Fingerprint=9A:77:19:18:ED:96:CF:DF:1B:B7:0E:F5:8D:B9:88:2E +-----BEGIN CERTIFICATE----- +MIIEgzCCA+ygAwIBAgIEOJ725DANBgkqhkiG9w0BAQQFADCBtDEUMBIGA1UEChML +RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9HQ0NBX0NQUyBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAyMDAw +IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENsaWVu +dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMDAyMDcxNjE2NDBaFw0yMDAy +MDcxNjQ2NDBaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 +LmVudHJ1c3QubmV0L0dDQ0FfQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp +YWIuKTElMCMGA1UECxMcKGMpIDIwMDAgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG +A1UEAxMqRW50cnVzdC5uZXQgQ2xpZW50IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCTdLS25MVL1qFof2LV7PdRV7Ny +Spj10InJrWPNTTVRaoTUrcloeW+46xHbh65cJFET8VQlhK8pK5/jgOLZy93GRUk0 +iJBeAZfv6lOm3fzB3ksqJeTpNfpVBQbliXrqpBFXO/x8PTbNZzVtpKklWb1m9fkn +5JVn1j+SgF7yNH0rhQIDAQABo4IBnjCCAZowEQYJYIZIAYb4QgEBBAQDAgAHMIHd +BgNVHR8EgdUwgdIwgc+ggcyggcmkgcYwgcMxFDASBgNVBAoTC0VudHJ1c3QubmV0 +MUAwPgYDVQQLFDd3d3cuZW50cnVzdC5uZXQvR0NDQV9DUFMgaW5jb3JwLiBieSBy +ZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMjAwMCBFbnRydXN0Lm5l +dCBMaW1pdGVkMTMwMQYDVQQDEypFbnRydXN0Lm5ldCBDbGllbnQgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkxDTALBgNVBAMTBENSTDEwKwYDVR0QBCQwIoAPMjAwMDAy +MDcxNjE2NDBagQ8yMDIwMDIwNzE2NDY0MFowCwYDVR0PBAQDAgEGMB8GA1UdIwQY +MBaAFISLdP3FjcD/J20gN0V8/i3OutN9MB0GA1UdDgQWBBSEi3T9xY3A/ydtIDdF +fP4tzrrTfTAMBgNVHRMEBTADAQH/MB0GCSqGSIb2fQdBAAQQMA4bCFY1LjA6NC4w +AwIEkDANBgkqhkiG9w0BAQQFAAOBgQBObzWAO9GK9Q6nIMstZVXQkvTnhLUGJoMS +hAusO7JE7r3PQNsgDrpuFOow4DtifH+La3xKp9U1PL6oXOpLu5OOgGarDyn9TS2/ +GpsKkMWr2tGzhtQvJFJcem3G8v7lTRowjJDyutdKPkN+1MhQGof4T4HHdguEOnKd +zmVml64mXg== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=AOL Time Warner Inc., OU=America Online Inc., CN=AOL Time Warner Root Certification Authority 1 + Validity + Not Before: May 29 06:00:00 2002 GMT + Not After : Nov 20 15:03:00 2037 GMT + Subject: C=US, O=AOL Time Warner Inc., OU=America Online Inc., CN=AOL Time Warner Root Certification Authority 1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:99:de:8f:c3:25:a3:69:34:e8:05:f7:74:b9:bf: + 5a:97:19:b9:2f:94:d2:93:e5:2d:89:ca:84:7c:3f: + 10:43:1b:8c:8b:7c:84:58:f8:24:7c:48:cf:2a:fd: + c0:15:d9:18:7e:84:1a:17:d3:db:9e:d7:ca:e4:d9: + d7:aa:58:51:87:f0:f0:8b:48:4e:e2:c2:c4:59:69: + 30:62:b6:30:a2:8c:0b:11:99:61:35:6d:7e:ef:c5: + b1:19:06:20:12:8e:42:e1:df:0f:96:10:52:a8:cf: + 9c:5f:95:14:d8:af:3b:75:0b:31:20:1f:44:2f:a2: + 62:41:b3:bb:18:21:db:ca:71:3c:8c:ec:b6:b9:0d: + 9f:ef:51:ef:4d:7b:12:f2:0b:0c:e1:ac:40:8f:77: + 7f:b0:ca:78:71:0c:5d:16:71:70:a2:d7:c2:3a:85: + cd:0e:9a:c4:e0:00:b0:d5:25:ea:dc:2b:e4:94:2d: + 38:9c:89:41:57:64:28:65:19:1c:b6:44:b4:c8:31: + 6b:8e:01:7b:76:59:25:7f:15:1c:84:08:7c:73:65: + 20:0a:a1:04:2e:1a:32:a8:9a:20:b1:9c:2c:21:59: + e7:fb:cf:ee:70:2d:08:ca:63:3e:2c:9b:93:19:6a: + a4:c2:97:ff:b7:86:57:88:85:6c:9e:15:16:2b:4d: + 2c:b3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + A1:36:30:16:CB:86:90:00:45:80:53:B1:8F:C8:D8:3D:7C:BE:5F:12 + X509v3 Authority Key Identifier: + keyid:A1:36:30:16:CB:86:90:00:45:80:53:B1:8F:C8:D8:3D:7C:BE:5F:12 + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 8a:20:18:a5:be:b3:2f:b4:a6:84:00:40:30:29:fa:b4:14:73: + 4c:79:45:a7:f6:70:e0:e8:7e:64:1e:0a:95:7c:6a:61:c2:ef: + 4e:1f:be:ff:c9:99:1f:07:61:4a:e1:5d:4c:cd:ad:ee:d0:52: + 32:d9:59:32:bc:da:79:72:d6:7b:09:e8:02:81:35:d3:0a:df: + 11:1d:c9:79:a0:80:4d:fe:5a:d7:56:d6:ed:0f:2a:af:a7:18: + 75:33:0c:ea:c1:61:05:4f:6a:9a:89:f2:8d:b9:9f:2e:ef:b0: + 5f:5a:00:eb:be:ad:a0:f8:44:05:67:bc:cb:04:ef:9e:64:c5: + e9:c8:3f:05:bf:c6:2f:07:1c:c3:36:71:86:ca:38:66:4a:cd: + d6:b8:4b:c6:6c:a7:97:3b:fa:13:2d:6e:23:61:87:a1:63:42: + ac:c2:cb:97:9f:61:68:cf:2d:4c:04:9d:d7:25:4f:0a:0e:4d: + 90:8b:18:56:a8:93:48:57:dc:6f:ae:bd:9e:67:57:77:89:50: + b3:be:11:9b:45:67:83:86:19:87:d3:98:bd:08:1a:16:1f:58: + 82:0b:e1:96:69:05:4b:8e:ec:83:51:31:07:d5:d4:9f:ff:59: + 7b:a8:6e:85:cf:d3:4b:a9:49:b0:5f:b0:39:28:68:0e:73:dd: + 25:9a:de:12 +MD5 Fingerprint=E7:7A:DC:B1:1F:6E:06:1F:74:6C:59:16:27:C3:4B:C0 +-----BEGIN CERTIFICATE----- +MIID5jCCAs6gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzELMAkGA1UEBhMCVVMx +HTAbBgNVBAoTFEFPTCBUaW1lIFdhcm5lciBJbmMuMRwwGgYDVQQLExNBbWVyaWNh +IE9ubGluZSBJbmMuMTcwNQYDVQQDEy5BT0wgVGltZSBXYXJuZXIgUm9vdCBDZXJ0 +aWZpY2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyOTA2MDAwMFoXDTM3MTEyMDE1 +MDMwMFowgYMxCzAJBgNVBAYTAlVTMR0wGwYDVQQKExRBT0wgVGltZSBXYXJuZXIg +SW5jLjEcMBoGA1UECxMTQW1lcmljYSBPbmxpbmUgSW5jLjE3MDUGA1UEAxMuQU9M +IFRpbWUgV2FybmVyIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnej8Mlo2k06AX3dLm/WpcZuS+U +0pPlLYnKhHw/EEMbjIt8hFj4JHxIzyr9wBXZGH6EGhfT257XyuTZ16pYUYfw8ItI +TuLCxFlpMGK2MKKMCxGZYTVtfu/FsRkGIBKOQuHfD5YQUqjPnF+VFNivO3ULMSAf +RC+iYkGzuxgh28pxPIzstrkNn+9R7017EvILDOGsQI93f7DKeHEMXRZxcKLXwjqF +zQ6axOAAsNUl6twr5JQtOJyJQVdkKGUZHLZEtMgxa44Be3ZZJX8VHIQIfHNlIAqh +BC4aMqiaILGcLCFZ5/vP7nAtCMpjPiybkxlqpMKX/7eGV4iFbJ4VFitNLLMCAwEA +AaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUoTYwFsuGkABFgFOxj8jY +PXy+XxIwHwYDVR0jBBgwFoAUoTYwFsuGkABFgFOxj8jYPXy+XxIwDgYDVR0PAQH/ +BAQDAgGGMA0GCSqGSIb3DQEBBQUAA4IBAQCKIBilvrMvtKaEAEAwKfq0FHNMeUWn +9nDg6H5kHgqVfGphwu9OH77/yZkfB2FK4V1Mza3u0FIy2VkyvNp5ctZ7CegCgTXT +Ct8RHcl5oIBN/lrXVtbtDyqvpxh1MwzqwWEFT2qaifKNuZ8u77BfWgDrvq2g+EQF +Z7zLBO+eZMXpyD8Fv8YvBxzDNnGGyjhmSs3WuEvGbKeXO/oTLW4jYYehY0KswsuX +n2Fozy1MBJ3XJU8KDk2QixhWqJNIV9xvrr2eZ1d3iVCzvhGbRWeDhhmH05i9CBoW +H1iCC+GWaQVLjuyDUTEH1dSf/1l7qG6Fz9NLqUmwX7A5KGgOc90lmt4S +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=AOL Time Warner Inc., OU=America Online Inc., CN=AOL Time Warner Root Certification Authority 2 + Validity + Not Before: May 29 06:00:00 2002 GMT + Not After : Sep 28 23:43:00 2037 GMT + Subject: C=US, O=AOL Time Warner Inc., OU=America Online Inc., CN=AOL Time Warner Root Certification Authority 2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:b4:37:5a:08:16:99:14:e8:55:b1:1b:24:6b:fc: + c7:8b:e6:87:a9:89:ee:8b:99:cd:4f:40:86:a4:b6: + 4d:c9:d9:b1:dc:3c:4d:0d:85:4c:15:6c:46:8b:52: + 78:9f:f8:23:fd:67:f5:24:3a:68:5d:d0:f7:64:61: + 41:54:a3:8b:a5:08:d2:29:5b:9b:60:4f:26:83:d1: + 63:12:56:49:76:a4:16:c2:a5:9d:45:ac:8b:84:95: + a8:16:b1:ec:9f:ea:24:1a:ef:b9:57:5c:9a:24:21: + 2c:4d:0e:71:1f:a6:ac:5d:45:74:03:98:c4:54:8c: + 16:4a:41:77:86:95:75:0c:47:01:66:60:fc:15:f1: + 0f:ea:f5:14:78:c7:0e:d7:6e:81:1c:5e:bf:5e:e7: + 3a:2a:d8:97:17:30:7c:00:ad:08:9d:33:af:b8:99: + 61:80:8b:a8:95:7e:14:dc:12:6c:a4:d0:d8:ef:40: + 49:02:36:f9:6e:a9:d6:1d:96:56:04:b2:b3:2d:16: + 56:86:8f:d9:20:57:80:cd:67:10:6d:b0:4c:f0:da: + 46:b6:ea:25:2e:46:af:8d:b0:85:38:34:8b:14:26: + 82:2b:ac:ae:99:0b:8e:14:d7:52:bd:9e:69:c3:86: + 02:0b:ea:76:75:31:09:ce:33:19:21:85:43:e6:89: + 2d:9f:25:37:67:f1:23:6a:d2:00:6d:97:f9:9f:e7: + 29:ca:dd:1f:d7:06:ea:b8:c9:b9:09:21:9f:c8:3f: + 06:c5:d2:e9:12:46:00:4e:7b:08:eb:42:3d:2b:48: + 6e:9d:67:dd:4b:02:e4:44:f3:93:19:a5:27:ce:69: + 7a:be:67:d3:fc:50:a4:2c:ab:c3:6b:b9:e3:80:4c: + cf:05:61:4b:2b:dc:1b:b9:a6:d2:d0:aa:f5:2b:73: + fb:ce:90:35:9f:0c:52:1c:bf:5c:21:61:11:5b:15: + 4b:a9:24:51:fc:a4:5c:f7:17:9d:b0:d2:fa:07:e9: + 8f:56:e4:1a:8c:68:8a:04:d3:7c:5a:e3:9e:a2:a1: + ca:71:5b:a2:d4:a0:e7:29:85:5d:03:68:2a:4f:d2: + 06:d7:3d:f9:c3:03:2f:3f:65:f9:67:1e:47:40:d3: + 63:0f:e3:d5:8e:f9:85:ab:97:4c:b3:d7:26:eb:96: + 0a:94:de:85:36:9c:c8:7f:81:09:02:49:2a:0e:f5: + 64:32:0c:82:d1:ba:6a:82:1b:b3:4b:74:11:f3:8c: + 77:d6:9f:bf:dc:37:a4:a7:55:04:2f:d4:31:e8:d3: + 46:b9:03:7c:da:12:4e:59:64:b7:51:31:31:50:a0: + ca:1c:27:d9:10:2e:ad:d6:bd:10:66:2b:c3:b0:22: + 4a:12:5b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 4F:69:6D:03:7E:9D:9F:07:18:43:BC:B7:10:4E:D5:BF:A9:C4:20:28 + X509v3 Authority Key Identifier: + keyid:4F:69:6D:03:7E:9D:9F:07:18:43:BC:B7:10:4E:D5:BF:A9:C4:20:28 + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 3b:f3:ae:ca:e8:2e:87:85:fb:65:59:e7:ad:11:14:a5:57:bc: + 58:9f:24:12:57:bb:fb:3f:34:da:ee:ad:7a:2a:34:72:70:31: + 6b:c7:19:98:80:c9:82:de:37:77:5e:54:8b:8e:f2:ea:67:4f: + c9:74:84:91:56:09:d5:e5:7a:9a:81:b6:81:c2:ad:36:e4:f1: + 54:11:53:f3:34:45:01:26:c8:e5:1a:bc:34:44:21:de:ad:25: + fc:76:16:77:21:90:80:98:57:9d:4e:ea:ec:2f:aa:3c:14:7b: + 57:c1:7e:18:14:67:ee:24:c6:bd:ba:15:b0:d2:18:bd:b7:55: + 81:ac:53:c0:e8:dd:69:12:13:42:b7:02:b5:05:41:ca:79:50: + 6e:82:0e:71:72:93:46:e8:9d:0d:5d:bd:ae:ce:29:ad:63:d5: + 55:16:80:30:27:ff:76:ba:f7:b8:d6:4a:e3:d9:b5:f9:52:d0: + 4e:40:a9:c7:e5:c2:32:c7:aa:76:24:e1:6b:05:50:eb:c5:bf: + 0a:54:e5:b9:42:3c:24:fb:b7:07:9c:30:9f:79:5a:e6:e0:40: + 52:15:f4:fc:aa:f4:56:f9:44:97:87:ed:0e:65:72:5e:be:26: + fb:4d:a4:2d:08:07:de:d8:5c:a0:dc:81:33:99:18:25:11:77: + a7:eb:fd:58:09:2c:99:6b:1b:8a:f3:52:3f:1a:4d:48:60:f1: + a0:f6:33:02:53:8b:ed:25:09:b8:0d:2d:ed:97:73:ec:d7:96: + 1f:8e:60:0e:da:10:9b:2f:18:24:f6:a6:4d:0a:f9:3b:cb:75: + c2:cc:2f:ce:24:69:c9:0a:22:8e:59:a7:f7:82:0c:d7:d7:6b: + 35:9c:43:00:6a:c4:95:67:ba:9c:45:cb:b8:0e:37:f7:dc:4e: + 01:4f:be:0a:b6:03:d3:ad:8a:45:f7:da:27:4d:29:b1:48:df: + e4:11:e4:96:46:bd:6c:02:3e:d6:51:c8:95:17:01:15:a9:f2: + aa:aa:f2:bf:2f:65:1b:6f:d0:b9:1a:93:f5:8e:35:c4:80:87: + 3e:94:2f:66:e4:e9:a8:ff:41:9c:70:2a:4f:2a:39:18:95:1e: + 7e:fb:61:01:3c:51:08:2e:28:18:a4:16:0f:31:fd:3a:6c:23: + 93:20:76:e1:fd:07:85:d1:5b:3f:d2:1c:73:32:dd:fa:b9:f8: + 8c:cf:02:87:7a:9a:96:e4:ed:4f:89:8d:53:43:ab:0e:13:c0: + 01:15:b4:79:38:db:fc:6e:3d:9e:51:b6:b8:13:8b:67:cf:f9: + 7c:d9:22:1d:f6:5d:c5:1c:01:2f:98:e8:7a:24:18:bc:84:d7: + fa:dc:72:5b:f7:c1:3a:68 +MD5 Fingerprint=01:5A:99:C3:D6:4F:A9:4B:3C:3B:B1:A3:AB:27:4C:BF +-----BEGIN CERTIFICATE----- +MIIF5jCCA86gAwIBAgIBATANBgkqhkiG9w0BAQUFADCBgzELMAkGA1UEBhMCVVMx +HTAbBgNVBAoTFEFPTCBUaW1lIFdhcm5lciBJbmMuMRwwGgYDVQQLExNBbWVyaWNh +IE9ubGluZSBJbmMuMTcwNQYDVQQDEy5BT0wgVGltZSBXYXJuZXIgUm9vdCBDZXJ0 +aWZpY2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyOTA2MDAwMFoXDTM3MDkyODIz +NDMwMFowgYMxCzAJBgNVBAYTAlVTMR0wGwYDVQQKExRBT0wgVGltZSBXYXJuZXIg +SW5jLjEcMBoGA1UECxMTQW1lcmljYSBPbmxpbmUgSW5jLjE3MDUGA1UEAxMuQU9M +IFRpbWUgV2FybmVyIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIw +DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALQ3WggWmRToVbEbJGv8x4vmh6mJ +7ouZzU9AhqS2TcnZsdw8TQ2FTBVsRotSeJ/4I/1n9SQ6aF3Q92RhQVSji6UI0ilb +m2BPJoPRYxJWSXakFsKlnUWsi4SVqBax7J/qJBrvuVdcmiQhLE0OcR+mrF1FdAOY +xFSMFkpBd4aVdQxHAWZg/BXxD+r1FHjHDtdugRxev17nOirYlxcwfACtCJ0zr7iZ +YYCLqJV+FNwSbKTQ2O9ASQI2+W6p1h2WVgSysy0WVoaP2SBXgM1nEG2wTPDaRrbq +JS5Gr42whTg0ixQmgiusrpkLjhTXUr2eacOGAgvqdnUxCc4zGSGFQ+aJLZ8lN2fx +I2rSAG2X+Z/nKcrdH9cG6rjJuQkhn8g/BsXS6RJGAE57COtCPStIbp1n3UsC5ETz +kxmlJ85per5n0/xQpCyrw2u544BMzwVhSyvcG7mm0tCq9Stz+86QNZ8MUhy/XCFh +EVsVS6kkUfykXPcXnbDS+gfpj1bkGoxoigTTfFrjnqKhynFbotSg5ymFXQNoKk/S +Btc9+cMDLz9l+WceR0DTYw/j1Y75hauXTLPXJuuWCpTehTacyH+BCQJJKg71ZDIM +gtG6aoIbs0t0EfOMd9afv9w3pKdVBC/UMejTRrkDfNoSTllkt1ExMVCgyhwn2RAu +rda9EGYrw7AiShJbAgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE +FE9pbQN+nZ8HGEO8txBO1b+pxCAoMB8GA1UdIwQYMBaAFE9pbQN+nZ8HGEO8txBO +1b+pxCAoMA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAO/Ouyugu +h4X7ZVnnrREUpVe8WJ8kEle7+z802u6teio0cnAxa8cZmIDJgt43d15Ui47y6mdP +yXSEkVYJ1eV6moG2gcKtNuTxVBFT8zRFASbI5Rq8NEQh3q0l/HYWdyGQgJhXnU7q +7C+qPBR7V8F+GBRn7iTGvboVsNIYvbdVgaxTwOjdaRITQrcCtQVBynlQboIOcXKT +RuidDV29rs4prWPVVRaAMCf/drr3uNZK49m1+VLQTkCpx+XCMseqdiThawVQ68W/ +ClTluUI8JPu3B5wwn3la5uBAUhX0/Kr0VvlEl4ftDmVyXr4m+02kLQgH3thcoNyB +M5kYJRF3p+v9WAksmWsbivNSPxpNSGDxoPYzAlOL7SUJuA0t7Zdz7NeWH45gDtoQ +my8YJPamTQr5O8t1wswvziRpyQoijlmn94IM19drNZxDAGrElWe6nEXLuA4399xO +AU++CrYD062KRffaJ00psUjf5BHklka9bAI+1lHIlRcBFanyqqryvy9lG2/QuRqT +9Y41xICHPpQvZuTpqP9BnHAqTyo5GJUefvthATxRCC4oGKQWDzH9OmwjkyB24f0H +hdFbP9IcczLd+rn4jM8Ch3qaluTtT4mNU0OrDhPAARW0eTjb/G49nlG2uBOLZ8/5 +fNkiHfZdxRwBL5joeiQYvITX+txyW/fBOmg= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1018510662 (0x3cb53d46) + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA-Baltimore Implementation + Validity + Not Before: Apr 11 07:38:51 2002 GMT + Not After : Apr 11 07:38:51 2022 GMT + Subject: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA-Baltimore Implementation + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:bc:7e:c4:39:9c:8c:e3:d6:1c:86:ff:ca:62:ad: + e0:7f:30:45:7a:8e:1a:b3:b8:c7:f9:d1:36:ff:22: + f3:4e:6a:5f:84:10:fb:66:81:c3:94:79:31:d2:91: + e1:77:8e:18:2a:c3:14:de:51:f5:4f:a3:2b:bc:18: + 16:e2:b5:dd:79:de:22:f8:82:7e:cb:81:1f:fd:27: + 2c:8f:fa:97:64:22:8e:f8:ff:61:a3:9c:1b:1e:92: + 8f:c0:a8:09:df:09:11:ec:b7:7d:31:9a:1a:ea:83: + 21:06:3c:9f:ba:5c:ff:94:ea:6a:b8:c3:6b:55:34: + 4f:3d:32:1f:dd:81:14:e0:c4:3c:cd:9d:30:f8:30: + a9:97:d3:ee:cc:a3:d0:1f:5f:1c:13:81:d4:18:ab: + 94:d1:63:c3:9e:7f:35:92:9e:5f:44:ea:ec:f4:22: + 5c:b7:e8:3d:7d:a4:f9:89:a9:91:b2:2a:d9:eb:33: + 87:ee:a5:fd:e3:da:cc:88:e6:89:26:6e:c7:2b:82: + d0:5e:9d:59:db:14:ec:91:83:05:c3:5e:0e:c6:2a: + d0:04:dd:71:3d:20:4e:58:27:fc:53:fb:78:78:19: + 14:b2:fc:90:52:89:38:62:60:07:b4:a0:ec:ac:6b: + 50:d6:fd:b9:28:6b:ef:52:2d:3a:b2:ff:f1:01:40: + ac:37 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.6334.0.0.1.9.40.51377 + User Notice: + Explicit Text: Reliance on or use of this Certificate creates an acknowledgment and acceptance of the then applicable standard terms and conditions of use, the Certification Practice Statement and the Relying Party Agreement, which can be found at the beTRUSTed web site, http://www.betrusted.com/products_services/index.html + CPS: http://www.betrusted.com/products_services/index.html + + X509v3 Subject Key Identifier: + 45:3D:C3:A9:D1:DC:3F:24:56:98:1C:73:18:88:6A:FF:83:47:ED:B6 + X509v3 Authority Key Identifier: + keyid:45:3D:C3:A9:D1:DC:3F:24:56:98:1C:73:18:88:6A:FF:83:47:ED:B6 + + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 49:92:bc:a3:ee:ac:bd:fa:0d:c9:8b:79:86:1c:23:76:b0:80: + 59:77:fc:da:7f:b4:4b:df:c3:64:4b:6a:4e:0e:ad:f2:7d:59: + 77:05:ad:0a:89:73:b0:fa:bc:cb:dc:8d:00:88:8f:a6:a0:b2: + ea:ac:52:27:bf:a1:48:7c:97:10:7b:ba:ed:13:1d:9a:07:6e: + cb:31:62:12:e8:63:03:aa:7d:6d:e3:f8:1b:76:21:78:1b:9f: + 4b:43:8c:d3:49:86:f6:1b:5c:f6:2e:60:15:d3:e9:e3:7b:75: + 3f:d0:02:83:d0:18:82:41:cd:65:37:ea:8e:32:7e:bd:6b:99: + 5d:30:11:c8:db:48:54:1c:3b:e1:a7:13:d3:6a:48:93:f7:3d: + 8c:7f:05:e8:ce:f3:88:2a:63:04:b8:ea:7e:58:7c:01:7b:5b: + e1:c5:7d:ef:21:e0:8d:0e:5d:51:7d:b1:67:fd:a3:bd:38:36: + c6:f2:38:86:87:1a:96:68:60:46:fb:28:14:47:55:e1:a7:80: + 0c:6b:e2:ea:df:4d:7c:90:48:a0:36:bd:09:17:89:7f:c3:f2: + d3:9c:9c:e3:dd:c4:1b:dd:f5:b7:71:b3:53:05:89:06:d0:cb: + 4a:80:c1:c8:53:90:b5:3c:31:88:17:50:9f:c9:c4:0e:8b:d8: + a8:02:63:0d +MD5 Fingerprint=81:35:B9:FB:FB:12:CA:18:69:36:EB:AE:69:78:A1:F1 +-----BEGIN CERTIFICATE----- +MIIFajCCBFKgAwIBAgIEPLU9RjANBgkqhkiG9w0BAQUFADBmMRIwEAYDVQQKEwli +ZVRSVVNUZWQxGzAZBgNVBAsTEmJlVFJVU1RlZCBSb290IENBczEzMDEGA1UEAxMq +YmVUUlVTVGVkIFJvb3QgQ0EtQmFsdGltb3JlIEltcGxlbWVudGF0aW9uMB4XDTAy +MDQxMTA3Mzg1MVoXDTIyMDQxMTA3Mzg1MVowZjESMBAGA1UEChMJYmVUUlVTVGVk +MRswGQYDVQQLExJiZVRSVVNUZWQgUm9vdCBDQXMxMzAxBgNVBAMTKmJlVFJVU1Rl +ZCBSb290IENBLUJhbHRpbW9yZSBJbXBsZW1lbnRhdGlvbjCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBALx+xDmcjOPWHIb/ymKt4H8wRXqOGrO4x/nRNv8i +805qX4QQ+2aBw5R5MdKR4XeOGCrDFN5R9U+jK7wYFuK13XneIviCfsuBH/0nLI/6 +l2Qijvj/YaOcGx6Sj8CoCd8JEey3fTGaGuqDIQY8n7pc/5TqarjDa1U0Tz0yH92B +FODEPM2dMPgwqZfT7syj0B9fHBOB1BirlNFjw55/NZKeX0Tq7PQiXLfoPX2k+Ymp +kbIq2eszh+6l/ePazIjmiSZuxyuC0F6dWdsU7JGDBcNeDsYq0ATdcT0gTlgn/FP7 +eHgZFLL8kFKJOGJgB7Sg7KxrUNb9uShr71ItOrL/8QFArDcCAwEAAaOCAh4wggIa +MA8GA1UdEwEB/wQFMAMBAf8wggG1BgNVHSAEggGsMIIBqDCCAaQGDysGAQQBsT4A +AAEJKIORMTCCAY8wggFIBggrBgEFBQcCAjCCAToaggE2UmVsaWFuY2Ugb24gb3Ig +dXNlIG9mIHRoaXMgQ2VydGlmaWNhdGUgY3JlYXRlcyBhbiBhY2tub3dsZWRnbWVu +dCBhbmQgYWNjZXB0YW5jZSBvZiB0aGUgdGhlbiBhcHBsaWNhYmxlIHN0YW5kYXJk +IHRlcm1zIGFuZCBjb25kaXRpb25zIG9mIHVzZSwgdGhlIENlcnRpZmljYXRpb24g +UHJhY3RpY2UgU3RhdGVtZW50IGFuZCB0aGUgUmVseWluZyBQYXJ0eSBBZ3JlZW1l +bnQsIHdoaWNoIGNhbiBiZSBmb3VuZCBhdCB0aGUgYmVUUlVTVGVkIHdlYiBzaXRl +LCBodHRwOi8vd3d3LmJldHJ1c3RlZC5jb20vcHJvZHVjdHNfc2VydmljZXMvaW5k +ZXguaHRtbDBBBggrBgEFBQcCARY1aHR0cDovL3d3dy5iZXRydXN0ZWQuY29tL3By +b2R1Y3RzX3NlcnZpY2VzL2luZGV4Lmh0bWwwHQYDVR0OBBYEFEU9w6nR3D8kVpgc +cxiIav+DR+22MB8GA1UdIwQYMBaAFEU9w6nR3D8kVpgccxiIav+DR+22MA4GA1Ud +DwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEASZK8o+6svfoNyYt5hhwjdrCA +WXf82n+0S9/DZEtqTg6t8n1ZdwWtColzsPq8y9yNAIiPpqCy6qxSJ7+hSHyXEHu6 +7RMdmgduyzFiEuhjA6p9beP4G3YheBufS0OM00mG9htc9i5gFdPp43t1P9ACg9AY +gkHNZTfqjjJ+vWuZXTARyNtIVBw74acT02pIk/c9jH8F6M7ziCpjBLjqflh8AXtb +4cV97yHgjQ5dUX2xZ/2jvTg2xvI4hocalmhgRvsoFEdV4aeADGvi6t9NfJBIoDa9 +CReJf8Py05yc493EG931t3GzUwWJBtDLSoDByFOQtTwxiBdQn8nEDovYqAJjDQ== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1018515264 (0x3cb54f40) + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA - Entrust Implementation + Validity + Not Before: Apr 11 08:24:27 2002 GMT + Not After : Apr 11 08:54:27 2022 GMT + Subject: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA - Entrust Implementation + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ba:f4:44:03:aa:12:6a:b5:43:ec:55:92:b6:30: + 7d:35:57:0c:db:f3:0d:27:6e:4c:f7:50:a8:9b:4e: + 2b:6f:db:f5:ad:1c:4b:5d:b3:a9:c1:fe:7b:44:eb: + 5b:a3:05:0d:1f:c5:34:2b:30:00:29:f1:78:40:b2: + a4:ff:3a:f4:01:88:17:7e:e6:d4:26:d3:ba:4c:ea: + 32:fb:43:77:97:87:23:c5:db:43:a3:f5:2a:a3:51: + 5e:e1:3b:d2:65:69:7e:55:15:9b:7a:e7:69:f7:44: + e0:57:b5:15:e8:66:60:0f:0d:03:fb:82:8e:a3:e8: + 11:7b:6c:be:c7:63:0e:17:93:df:cf:4b:ae:6e:73: + 75:e0:f3:aa:b9:a4:c0:09:1b:85:ea:71:29:88:41: + 32:f9:f0:2a:0e:6c:09:f2:74:6b:66:6c:52:13:1f: + 18:bc:d4:3e:f7:d8:6e:20:9e:ca:fe:fc:21:94:ee: + 13:28:4b:d7:5c:5e:0c:66:ee:e9:bb:0f:c1:34:b1: + 7f:08:76:f3:3d:26:70:c9:8b:25:1d:62:24:0c:ea: + 1c:75:4e:c0:12:e4:ba:13:1d:30:29:2d:56:33:05: + bb:97:59:7e:c6:49:4f:89:d7:2f:24:a8:b6:88:40: + b5:64:92:53:56:24:e4:a2:a0:85:b3:5e:90:b4:12: + 33:cd + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.6334.0.0.2.9.40.51377 + User Notice: + Explicit Text: Reliance on or use of this Certificate creates an acknowledgment and acceptance of the then applicable standard terms and conditions of use, the Certification Practice Statement and the Relying Party Agreement, which can be found at the beTRUSTed web site, https://www.betrusted.com/products_services/index.html + CPS: https://www.betrusted.com/products_services/index.html + + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/O=beTRUSTed/OU=beTRUSTed Root CAs/CN=beTRUSTed Root CA - Entrust Implementation/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Apr 11 08:24:27 2002 GMT, Not After: Apr 11 08:54:27 2022 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:7D:70:E5:AE:38:8B:06:3F:AA:1C:1A:8F:F9:CF:24:30:AA:84:84:16 + + X509v3 Subject Key Identifier: + 7D:70:E5:AE:38:8B:06:3F:AA:1C:1A:8F:F9:CF:24:30:AA:84:84:16 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V6.0:4.0.... + Signature Algorithm: sha1WithRSAEncryption + 2a:b8:17:ce:1f:10:94:eb:b8:9a:b7:b9:5f:ec:da:f7:92:24: + ac:dc:92:3b:c7:20:8d:f2:99:e5:5d:38:a1:c2:34:ed:c5:13: + 59:5c:05:b5:2b:4f:61:9b:91:fb:41:fc:fc:d5:3c:4d:98:76: + 06:f5:81:7d:eb:dd:90:e6:d1:56:54:da:e3:2d:0c:9f:11:32: + 94:22:01:7a:f6:6c:2c:74:67:04:cc:a5:8f:8e:2c:b3:43:b5: + 94:a2:d0:7d:e9:62:7f:06:be:27:01:83:9e:3a:fd:8a:ee:98: + 43:4a:6b:d7:b5:97:3b:3a:bf:4f:6d:b4:63:fa:33:00:34:2e: + 2d:6d:96:c9:7b:ca:99:63:ba:be:f4:f6:30:a0:2d:98:96:e9: + 56:44:05:a9:44:a3:61:10:eb:82:a1:67:5d:bc:5d:27:75:aa: + 8a:28:36:2a:38:92:d9:dd:a4:5e:00:a5:cc:cc:7c:29:2a:de: + 28:90:ab:b7:e1:b6:ff:7d:25:0b:40:d8:aa:34:a3:2d:de:07: + eb:5f:ce:0a:dd:ca:7e:3a:7d:26:c1:62:68:3a:e6:2f:37:f3: + 81:86:21:c4:a9:64:aa:ef:45:36:d1:1a:66:7c:f8:e9:37:d6: + d6:61:be:a2:ad:48:e7:df:e6:74:fe:d3:6d:7d:d2:25:dc:ac: + 62:57:a9:f7 +MD5 Fingerprint=7D:86:90:8F:5B:F1:F2:40:C0:F7:3D:62:B5:A4:A9:3B +-----BEGIN CERTIFICATE----- +MIIGUTCCBTmgAwIBAgIEPLVPQDANBgkqhkiG9w0BAQUFADBmMRIwEAYDVQQKEwli +ZVRSVVNUZWQxGzAZBgNVBAsTEmJlVFJVU1RlZCBSb290IENBczEzMDEGA1UEAxMq +YmVUUlVTVGVkIFJvb3QgQ0EgLSBFbnRydXN0IEltcGxlbWVudGF0aW9uMB4XDTAy +MDQxMTA4MjQyN1oXDTIyMDQxMTA4NTQyN1owZjESMBAGA1UEChMJYmVUUlVTVGVk +MRswGQYDVQQLExJiZVRSVVNUZWQgUm9vdCBDQXMxMzAxBgNVBAMTKmJlVFJVU1Rl +ZCBSb290IENBIC0gRW50cnVzdCBJbXBsZW1lbnRhdGlvbjCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBALr0RAOqEmq1Q+xVkrYwfTVXDNvzDSduTPdQqJtO +K2/b9a0cS12zqcH+e0TrW6MFDR/FNCswACnxeECypP869AGIF37m1CbTukzqMvtD +d5eHI8XbQ6P1KqNRXuE70mVpflUVm3rnafdE4Fe1FehmYA8NA/uCjqPoEXtsvsdj +DheT389Lrm5zdeDzqrmkwAkbhepxKYhBMvnwKg5sCfJ0a2ZsUhMfGLzUPvfYbiCe +yv78IZTuEyhL11xeDGbu6bsPwTSxfwh28z0mcMmLJR1iJAzqHHVOwBLkuhMdMCkt +VjMFu5dZfsZJT4nXLySotohAtWSSU1Yk5KKghbNekLQSM80CAwEAAaOCAwUwggMB +MIIBtwYDVR0gBIIBrjCCAaowggGmBg8rBgEEAbE+AAACCSiDkTEwggGRMIIBSQYI +KwYBBQUHAgIwggE7GoIBN1JlbGlhbmNlIG9uIG9yIHVzZSBvZiB0aGlzIENlcnRp +ZmljYXRlIGNyZWF0ZXMgYW4gYWNrbm93bGVkZ21lbnQgYW5kIGFjY2VwdGFuY2Ug +b2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0 +aW9ucyBvZiB1c2UsIHRoZSBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu +dCBhbmQgdGhlIFJlbHlpbmcgUGFydHkgQWdyZWVtZW50LCB3aGljaCBjYW4gYmUg +Zm91bmQgYXQgdGhlIGJlVFJVU1RlZCB3ZWIgc2l0ZSwgaHR0cHM6Ly93d3cuYmV0 +cnVzdGVkLmNvbS9wcm9kdWN0c19zZXJ2aWNlcy9pbmRleC5odG1sMEIGCCsGAQUF +BwIBFjZodHRwczovL3d3dy5iZXRydXN0ZWQuY29tL3Byb2R1Y3RzX3NlcnZpY2Vz +L2luZGV4Lmh0bWwwEQYJYIZIAYb4QgEBBAQDAgAHMIGJBgNVHR8EgYEwfzB9oHug +eaR3MHUxEjAQBgNVBAoTCWJlVFJVU1RlZDEbMBkGA1UECxMSYmVUUlVTVGVkIFJv +b3QgQ0FzMTMwMQYDVQQDEypiZVRSVVNUZWQgUm9vdCBDQSAtIEVudHJ1c3QgSW1w +bGVtZW50YXRpb24xDTALBgNVBAMTBENSTDEwKwYDVR0QBCQwIoAPMjAwMjA0MTEw +ODI0MjdagQ8yMDIyMDQxMTA4NTQyN1owCwYDVR0PBAQDAgEGMB8GA1UdIwQYMBaA +FH1w5a44iwY/qhwaj/nPJDCqhIQWMB0GA1UdDgQWBBR9cOWuOIsGP6ocGo/5zyQw +qoSEFjAMBgNVHRMEBTADAQH/MB0GCSqGSIb2fQdBAAQQMA4bCFY2LjA6NC4wAwIE +kDANBgkqhkiG9w0BAQUFAAOCAQEAKrgXzh8QlOu4mre5X+za95IkrNySO8cgjfKZ +5V04ocI07cUTWVwFtStPYZuR+0H8/NU8TZh2BvWBfevdkObRVlTa4y0MnxEylCIB +evZsLHRnBMylj44ss0O1lKLQfelifwa+JwGDnjr9iu6YQ0pr17WXOzq/T220Y/oz +ADQuLW2WyXvKmWO6vvT2MKAtmJbpVkQFqUSjYRDrgqFnXbxdJ3Wqiig2KjiS2d2k +XgClzMx8KSreKJCrt+G2/30lC0DYqjSjLd4H61/OCt3Kfjp9JsFiaDrmLzfzgYYh +xKlkqu9FNtEaZnz46TfW1mG+oq1I59/mdP7TbX3SJdysYlep9w== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 3b:59:c7:7b:cd:5b:57:9e:bd:37:52:ac:76:b4:aa:1a + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA - RSA Implementation + Validity + Not Before: Apr 11 11:18:13 2002 GMT + Not After : Apr 12 11:07:25 2022 GMT + Subject: O=beTRUSTed, OU=beTRUSTed Root CAs, CN=beTRUSTed Root CA - RSA Implementation + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:e4:ba:34:30:09:8e:57:d0:b9:06:2c:6f:6e:24: + 80:22:bf:5d:43:a6:fa:4f:ac:82:e7:1c:68:70:85: + 1b:a3:6e:b5:aa:78:d9:6e:07:4b:3f:e9:df:f5:ea: + e8:54:a1:61:8a:0e:2f:69:75:18:b7:0c:e5:14:8d: + 71:6e:98:b8:55:fc:0c:95:d0:9b:6e:e1:2d:88:d4: + 3a:40:6b:92:f1:99:96:64:de:db:ff:78:f4:ee:96: + 1d:47:89:7c:d4:be:b9:88:77:23:3a:09:e6:04:9e: + 6d:aa:5e:d2:c8:bd:9a:4e:19:df:89:ea:5b:0e:7e: + c3:e4:b4:f0:e0:69:3b:88:0f:41:90:f8:d4:71:43: + 24:c1:8f:26:4b:3b:56:e9:ff:8c:6c:37:e9:45:ad: + 85:8c:53:c3:60:86:90:4a:96:c9:b3:54:b0:bb:17: + f0:1c:45:d9:d4:1b:19:64:56:0a:19:f7:cc:e1:ff: + 86:af:7e:58:5e:ac:7a:90:1f:c9:28:39:45:7b:a2: + b6:c7:9c:1f:da:85:d4:21:86:59:30:93:be:53:33: + 37:f6:ef:41:cf:33:c7:ab:72:6b:25:f5:f3:53:1b: + 0c:4c:2e:f1:75:4b:ef:a0:87:f7:fe:8a:15:d0:6c: + d5:cb:f9:68:53:b9:70:15:13:c2:f5:2e:fb:43:35: + 75:2d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:TRUE + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.6334.0.0.3.9.40.51377 + CPS: http://www.betrusted.com/products_services/index.html + User Notice: + Explicit Text: Reliance on or use of this Certificate creates an acknowledgment and acceptance of the then applicable standard terms and conditions of use, the Certification Practice Statement and the Relying Party Agreement, which can be found at the beTRUSTed web site, http://www.betrusted.com/products_services/index.html + + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:A9:EC:14:7E:F9:D9:43:CC:53:2B:14:AD:CF:F7:F0:59:89:41:CD:19 + + X509v3 Subject Key Identifier: + A9:EC:14:7E:F9:D9:43:CC:53:2B:14:AD:CF:F7:F0:59:89:41:CD:19 + Signature Algorithm: sha1WithRSAEncryption + db:97:b0:75:ea:0c:c4:c1:98:ca:56:05:c0:a8:ad:26:48:af: + 2d:20:e8:81:c7:b6:df:43:c1:2c:1d:75:4b:d4:42:8d:e7:7a: + a8:74:dc:66:42:59:87:b3:f5:69:6d:d9:a9:9e:b3:7d:1c:31: + c1:f5:54:e2:59:24:49:e5:ee:bd:39:a6:6b:8a:98:44:fb:9b: + d7:2a:83:97:34:2d:c7:7d:35:4c:2d:34:b8:3e:0d:c4:ec:88: + 27:af:9e:92:fd:50:61:82:a8:60:07:14:53:cc:65:13:c1:f6: + 47:44:69:d2:31:c8:a6:dd:2e:b3:0b:de:4a:8d:5b:3d:ab:0d: + c2:35:52:a2:56:37:cc:32:8b:28:85:42:9c:91:40:7a:70:2b: + 38:36:d5:e1:73:1a:1f:e5:fa:7e:5f:dc:d6:9c:3b:30:ea:db: + c0:5b:27:5c:d3:73:07:c1:c2:f3:4c:9b:6f:9f:1b:ca:1e:aa: + a8:38:33:09:58:b2:ae:fc:07:e8:36:dc:55:ba:2f:4f:40:fe: + 7a:bd:06:a6:81:c1:93:22:7c:86:11:0a:06:77:48:ae:35:b7: + 2f:32:9a:61:5e:8b:be:29:9f:29:24:88:56:39:2c:a8:d2:ab: + 96:03:5a:d4:48:9f:b9:40:84:0b:98:68:fb:01:43:d6:1b:e2: + 09:b1:97:1c +MD5 Fingerprint=86:42:05:09:BC:A7:9D:EC:1D:F3:2E:0E:BA:D8:1D:D0 +-----BEGIN CERTIFICATE----- +MIIFaDCCBFCgAwIBAgIQO1nHe81bV569N1KsdrSqGjANBgkqhkiG9w0BAQUFADBi +MRIwEAYDVQQKEwliZVRSVVNUZWQxGzAZBgNVBAsTEmJlVFJVU1RlZCBSb290IENB +czEvMC0GA1UEAxMmYmVUUlVTVGVkIFJvb3QgQ0EgLSBSU0EgSW1wbGVtZW50YXRp +b24wHhcNMDIwNDExMTExODEzWhcNMjIwNDEyMTEwNzI1WjBiMRIwEAYDVQQKEwli +ZVRSVVNUZWQxGzAZBgNVBAsTEmJlVFJVU1RlZCBSb290IENBczEvMC0GA1UEAxMm +YmVUUlVTVGVkIFJvb3QgQ0EgLSBSU0EgSW1wbGVtZW50YXRpb24wggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkujQwCY5X0LkGLG9uJIAiv11DpvpPrILn +HGhwhRujbrWqeNluB0s/6d/16uhUoWGKDi9pdRi3DOUUjXFumLhV/AyV0Jtu4S2I +1DpAa5LxmZZk3tv/ePTulh1HiXzUvrmIdyM6CeYEnm2qXtLIvZpOGd+J6lsOfsPk +tPDgaTuID0GQ+NRxQyTBjyZLO1bp/4xsN+lFrYWMU8NghpBKlsmzVLC7F/AcRdnU +GxlkVgoZ98zh/4avflherHqQH8koOUV7orbHnB/ahdQhhlkwk75TMzf270HPM8er +cmsl9fNTGwxMLvF1S++gh/f+ihXQbNXL+WhTuXAVE8L1LvtDNXUtAgMBAAGjggIY +MIICFDAMBgNVHRMEBTADAQH/MIIBtQYDVR0gBIIBrDCCAagwggGkBg8rBgEEAbE+ +AAADCSiDkTEwggGPMEEGCCsGAQUFBwIBFjVodHRwOi8vd3d3LmJldHJ1c3RlZC5j +b20vcHJvZHVjdHNfc2VydmljZXMvaW5kZXguaHRtbDCCAUgGCCsGAQUFBwICMIIB +OhqCATZSZWxpYW5jZSBvbiBvciB1c2Ugb2YgdGhpcyBDZXJ0aWZpY2F0ZSBjcmVh +dGVzIGFuIGFja25vd2xlZGdtZW50IGFuZCBhY2NlcHRhbmNlIG9mIHRoZSB0aGVu +IGFwcGxpY2FibGUgc3RhbmRhcmQgdGVybXMgYW5kIGNvbmRpdGlvbnMgb2YgdXNl +LCB0aGUgQ2VydGlmaWNhdGlvbiBQcmFjdGljZSBTdGF0ZW1lbnQgYW5kIHRoZSBS +ZWx5aW5nIFBhcnR5IEFncmVlbWVudCwgd2hpY2ggY2FuIGJlIGZvdW5kIGF0IHRo +ZSBiZVRSVVNUZWQgd2ViIHNpdGUsIGh0dHA6Ly93d3cuYmV0cnVzdGVkLmNvbS9w +cm9kdWN0c19zZXJ2aWNlcy9pbmRleC5odG1sMAsGA1UdDwQEAwIBBjAfBgNVHSME +GDAWgBSp7BR++dlDzFMrFK3P9/BZiUHNGTAdBgNVHQ4EFgQUqewUfvnZQ8xTKxSt +z/fwWYlBzRkwDQYJKoZIhvcNAQEFBQADggEBANuXsHXqDMTBmMpWBcCorSZIry0g +6IHHtt9DwSwddUvUQo3neqh03GZCWYez9Wlt2ames30cMcH1VOJZJEnl7r05pmuK +mET7m9cqg5c0Lcd9NUwtNLg+DcTsiCevnpL9UGGCqGAHFFPMZRPB9kdEadIxyKbd +LrML3kqNWz2rDcI1UqJWN8wyiyiFQpyRQHpwKzg21eFzGh/l+n5f3NacOzDq28Bb +J1zTcwfBwvNMm2+fG8oeqqg4MwlYsq78B+g23FW6L09A/nq9BqaBwZMifIYRCgZ3 +SK41ty8ymmFei74pnykkiFY5LKjSq5YDWtRIn7lAhAuYaPsBQ9Yb4gmxlxw= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 0a:01:01:01:00:00:02:7c:00:00:00:0a:00:00:00:02 + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=RSA Security Inc, OU=RSA Security 2048 V3 + Validity + Not Before: Feb 22 20:39:23 2001 GMT + Not After : Feb 22 20:39:23 2026 GMT + Subject: O=RSA Security Inc, OU=RSA Security 2048 V3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b7:8f:55:71:d2:80:dd:7b:69:79:a7:f0:18:50: + 32:3c:62:67:f6:0a:95:07:dd:e6:1b:f3:9e:d9:d2: + 41:54:6b:ad:9f:7c:be:19:cd:fb:46:ab:41:68:1e: + 18:ea:55:c8:2f:91:78:89:28:fb:27:29:60:ff:df: + 8f:8c:3b:c9:49:9b:b5:a4:94:ce:01:ea:3e:b5:63: + 7b:7f:26:fd:19:dd:c0:21:bd:84:d1:2d:4f:46:c3: + 4e:dc:d8:37:39:3b:28:af:cb:9d:1a:ea:2b:af:21: + a5:c1:23:22:b8:b8:1b:5a:13:87:57:83:d1:f0:20: + e7:e8:4f:23:42:b0:00:a5:7d:89:e9:e9:61:73:94: + 98:71:26:bc:2d:6a:e0:f7:4d:f0:f1:b6:2a:38:31: + 81:0d:29:e1:00:c1:51:0f:4c:52:f8:04:5a:aa:7d: + 72:d3:b8:87:2a:bb:63:10:03:2a:b3:a1:4f:0d:5a: + 5e:46:b7:3d:0e:f5:74:ec:99:9f:f9:3d:24:81:88: + a6:dd:60:54:e8:95:36:3d:c6:09:93:9a:a3:12:80: + 00:55:99:19:47:bd:d0:a5:7c:c3:ba:fb:1f:f7:f5: + 0f:f8:ac:b9:b5:f4:37:98:13:18:de:85:5b:b7:0c: + 82:3b:87:6f:95:39:58:30:da:6e:01:68:17:22:cc: + c0:0b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:07:C3:51:30:A4:AA:E9:45:AE:35:24:FA:FF:24:2C:33:D0:B1:9D:8C + + X509v3 Subject Key Identifier: + 07:C3:51:30:A4:AA:E9:45:AE:35:24:FA:FF:24:2C:33:D0:B1:9D:8C + Signature Algorithm: sha1WithRSAEncryption + 5f:3e:86:76:6e:b8:35:3c:4e:36:1c:1e:79:98:bf:fd:d5:12: + 11:79:52:0e:ee:31:89:bc:dd:7f:f9:d1:c6:15:21:e8:8a:01: + 54:0d:3a:fb:54:b9:d6:63:d4:b1:aa:96:4d:a2:42:4d:d4:53: + 1f:8b:10:de:7f:65:be:60:13:27:71:88:a4:73:e3:84:63:d1: + a4:55:e1:50:93:e6:1b:0e:79:d0:67:bc:46:c8:bf:3f:17:0d: + 95:e6:c6:90:69:de:e7:b4:2f:de:95:7d:d0:12:3f:3d:3e:7f: + 4d:3f:14:68:f5:11:50:d5:c1:f4:90:a5:08:1d:31:60:ff:60: + 8c:23:54:0a:af:fe:a1:6e:c5:d1:7a:2a:68:78:cf:1e:82:0a: + 20:b4:1f:ad:e5:85:b2:6a:68:75:4e:ad:25:37:94:85:be:bd: + a1:d4:ea:b7:0c:4b:3c:9d:e8:12:00:f0:5f:ac:0d:e1:ac:70: + 63:73:f7:7f:79:9f:32:25:42:74:05:80:28:bf:bd:c1:24:96: + 58:15:b1:17:21:e9:89:4b:db:07:88:67:f4:15:ad:70:3e:2f: + 4d:85:3b:c2:b7:db:fe:98:68:23:89:e1:74:0f:de:f4:c5:84: + 63:29:1b:cc:cb:07:c9:00:a4:a9:d7:c2:22:4f:67:d7:77:ec: + 20:05:61:de +MD5 Fingerprint=77:0D:19:B1:21:FD:00:42:9C:3E:0C:A5:DD:0B:02:8E +-----BEGIN CERTIFICATE----- +MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6 +MRkwFwYDVQQKExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJp +dHkgMjA0OCBWMzAeFw0wMTAyMjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAX +BgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAbBgNVBAsTFFJTQSBTZWN1cml0eSAy +MDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt49VcdKA3Xtp +eafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7Jylg +/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGl +wSMiuLgbWhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnh +AMFRD0xS+ARaqn1y07iHKrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2 +PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP+Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpu +AWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB +BjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4EFgQUB8NR +MKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYc +HnmYv/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/ +Zb5gEydxiKRz44Rj0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+ +f00/FGj1EVDVwfSQpQgdMWD/YIwjVAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVO +rSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395nzIlQnQFgCi/vcEkllgVsRch +6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kApKnXwiJPZ9d3 +7CAFYd4= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 0a:01:01:01:00:00:02:7c:00:00:00:0b:00:00:00:02 + Signature Algorithm: sha1WithRSAEncryption + Issuer: O=RSA Security Inc, OU=RSA Security 1024 V3 + Validity + Not Before: Feb 22 21:01:49 2001 GMT + Not After : Feb 22 20:01:49 2026 GMT + Subject: O=RSA Security Inc, OU=RSA Security 1024 V3 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:d5:dd:fe:66:09:cf:24:3c:3e:ae:81:4e:4e:8a: + c4:69:80:5b:59:3b:df:b9:4d:4c:ca:b5:2d:c3:27: + 2d:3c:af:00:42:6d:bc:28:a6:96:cf:7f:d7:58:ac: + 83:0a:a3:55:b5:7b:17:90:15:84:4c:8a:ee:26:99: + dc:58:ef:c7:38:a6:aa:af:d0:8e:42:c8:62:d7:ab: + ac:a9:fb:4a:7d:bf:ea:fe:12:4d:dd:ff:26:2d:6f: + 36:54:68:c8:d2:84:56:ee:92:53:61:09:b3:3f:39: + 9b:a8:c9:9b:bd:ce:9f:7e:d4:19:6a:16:29:18:be: + d7:3a:69:dc:25:5b:33:1a:51 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:C4:C0:1C:A4:07:94:FD:CD:4D:01:D4:54:DA:A5:0C:5F:DE:AE:05:5A + + X509v3 Subject Key Identifier: + C4:C0:1C:A4:07:94:FD:CD:4D:01:D4:54:DA:A5:0C:5F:DE:AE:05:5A + Signature Algorithm: sha1WithRSAEncryption + 3f:2d:6a:e3:26:43:95:7d:89:97:65:fb:75:e4:72:1d:46:57: + c4:61:6b:69:9f:12:9b:2c:d5:5a:e8:c0:a2:f0:43:95:e3:1f: + e9:76:cd:dc:eb:bc:93:a0:65:0a:c7:4d:4f:5f:a7:af:a2:46: + 14:b9:0c:f3:cc:bd:6a:6e:b7:9d:de:25:42:d0:54:ff:9e:68: + 73:63:dc:24:eb:22:bf:a8:72:f2:5e:00:e1:0d:4e:3a:43:6e: + 99:4e:3f:89:78:03:98:ca:f3:55:cc:9d:ae:8e:c1:aa:45:98: + fa:8f:1a:a0:8d:88:23:f1:15:41:0d:a5:46:3e:91:3f:8b:eb: + f7:71 +MD5 Fingerprint=3A:E5:50:B0:39:BE:C7:46:36:33:A1:FE:82:3E:8D:94 +-----BEGIN CERTIFICATE----- +MIICXDCCAcWgAwIBAgIQCgEBAQAAAnwAAAALAAAAAjANBgkqhkiG9w0BAQUFADA6 +MRkwFwYDVQQKExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJp +dHkgMTAyNCBWMzAeFw0wMTAyMjIyMTAxNDlaFw0yNjAyMjIyMDAxNDlaMDoxGTAX +BgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAbBgNVBAsTFFJTQSBTZWN1cml0eSAx +MDI0IFYzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDV3f5mCc8kPD6ugU5O +isRpgFtZO9+5TUzKtS3DJy08rwBCbbwoppbPf9dYrIMKo1W1exeQFYRMiu4mmdxY +78c4pqqv0I5CyGLXq6yp+0p9v+r+Ek3d/yYtbzZUaMjShFbuklNhCbM/OZuoyZu9 +zp9+1BlqFikYvtc6adwlWzMaUQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4G +A1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBTEwBykB5T9zU0B1FTapQxf3q4FWjAd +BgNVHQ4EFgQUxMAcpAeU/c1NAdRU2qUMX96uBVowDQYJKoZIhvcNAQEFBQADgYEA +Py1q4yZDlX2Jl2X7deRyHUZXxGFraZ8SmyzVWujAovBDleMf6XbN3Ou8k6BlCsdN +T1+nr6JGFLkM88y9am63nd4lQtBU/55oc2PcJOsiv6hy8l4A4Q1OOkNumU4/iXgD +mMrzVcydro7BqkWY+o8aoI2II/EVQQ2lRj6RP4vr93E= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 144470 (0x23456) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA + Validity + Not Before: May 21 04:00:00 2002 GMT + Not After : May 21 04:00:00 2022 GMT + Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:da:cc:18:63:30:fd:f4:17:23:1a:56:7e:5b:df: + 3c:6c:38:e4:71:b7:78:91:d4:bc:a1:d8:4c:f8:a8: + 43:b6:03:e9:4d:21:07:08:88:da:58:2f:66:39:29: + bd:05:78:8b:9d:38:e8:05:b7:6a:7e:71:a4:e6:c4: + 60:a6:b0:ef:80:e4:89:28:0f:9e:25:d6:ed:83:f3: + ad:a6:91:c7:98:c9:42:18:35:14:9d:ad:98:46:92: + 2e:4f:ca:f1:87:43:c1:16:95:57:2d:50:ef:89:2d: + 80:7a:57:ad:f2:ee:5f:6b:d2:00:8d:b9:14:f8:14: + 15:35:d9:c0:46:a3:7b:72:c8:91:bf:c9:55:2b:cd: + d0:97:3e:9c:26:64:cc:df:ce:83:19:71:ca:4e:e6: + d4:d5:7b:a9:19:cd:55:de:c8:ec:d2:5e:38:53:e5: + 5c:4f:8c:2d:fe:50:23:36:fc:66:e6:cb:8e:a4:39: + 19:00:b7:95:02:39:91:0b:0e:fe:38:2e:d1:1d:05: + 9a:f6:4d:3e:6f:0f:07:1d:af:2c:1e:8f:60:39:e2: + fa:36:53:13:39:d4:5e:26:2b:db:3d:a8:14:bd:32: + eb:18:03:28:52:04:71:e5:ab:33:3d:e1:38:bb:07: + 36:84:62:9c:79:ea:16:30:f4:5f:c0:2b:e8:71:6b: + e4:f9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E + X509v3 Authority Key Identifier: + keyid:C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E + + Signature Algorithm: sha1WithRSAEncryption + 35:e3:29:6a:e5:2f:5d:54:8e:29:50:94:9f:99:1a:14:e4:8f: + 78:2a:62:94:a2:27:67:9e:d0:cf:1a:5e:47:e9:c1:b2:a4:cf: + dd:41:1a:05:4e:9b:4b:ee:4a:6f:55:52:b3:24:a1:37:0a:eb: + 64:76:2a:2e:2c:f3:fd:3b:75:90:bf:fa:71:d8:c7:3d:37:d2: + b5:05:95:62:b9:a6:de:89:3d:36:7b:38:77:48:97:ac:a6:20: + 8f:2e:a6:c9:0c:c2:b2:99:45:00:c7:ce:11:51:22:22:e0:a5: + ea:b6:15:48:09:64:ea:5e:4f:74:f7:05:3e:c7:8a:52:0c:db: + 15:b4:bd:6d:9b:e5:c6:b1:54:68:a9:e3:69:90:b6:9a:a5:0f: + b8:b9:3f:20:7d:ae:4a:b5:b8:9c:e4:1d:b6:ab:e6:94:a5:c1: + c7:83:ad:db:f5:27:87:0e:04:6c:d5:ff:dd:a0:5d:ed:87:52: + b7:2b:15:02:ae:39:a6:6a:74:e9:da:c4:e7:bc:4d:34:1e:a9: + 5c:4d:33:5f:92:09:2f:88:66:5d:77:97:c7:1d:76:13:a9:d5: + e5:f1:16:09:11:35:d5:ac:db:24:71:70:2c:98:56:0b:d9:17: + b4:d1:e3:51:2b:5e:75:e8:d5:d0:dc:4f:34:ed:c2:05:66:80: + a1:cb:e6:33 +MD5 Fingerprint=F7:75:AB:29:FB:51:4E:B7:77:5E:FF:05:3C:99:8E:F5 +-----BEGIN CERTIFICATE----- +MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT +MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i +YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG +EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg +R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9 +9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq +fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv +iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU +1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+ +bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW +MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA +ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l +uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn +Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS +tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF +PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un +hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV +5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:be:0c:8b:50:00:24:b4:11:d3:36:30:4b:c0:33:77 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Network Applications + Validity + Not Before: Jul 9 18:48:39 1999 GMT + Not After : Jul 9 18:57:49 2019 GMT + Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Network Applications + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b3:fb:91:a1:e4:36:55:85:ac:06:34:5b:a0:9a: + 58:b2:f8:b5:0f:05:77:83:ae:32:b1:76:92:68:ec: + 23:4a:c9:76:3f:e3:9c:b6:37:79:03:b9:ab:69:8d: + 07:25:b6:19:67:e4:b0:1b:18:73:61:4a:e8:7e:cd: + d3:2f:64:e3:a6:7c:0c:fa:17:80:a3:0d:47:89:4f: + 51:71:2f:ee:fc:3f:f9:b8:16:80:87:89:93:25:20: + 9a:43:82:69:24:76:28:59:35:a1:1d:c0:7f:83:06: + 64:16:20:2c:d3:49:a4:85:b4:c0:61:7f:51:08:f8: + 68:15:91:80:cb:a5:d5:ee:3b:3a:f4:84:04:5e:60: + 59:a7:8c:34:72:ee:b8:78:c5:d1:3b:12:4a:6f:7e: + 65:27:b9:a4:55:c5:b9:6f:43:a4:c5:1d:2c:99:c0: + 52:a4:78:4c:15:b3:40:98:08:6b:43:c6:01:b0:7a: + 7b:f5:6b:1c:22:3f:cb:ef:ff:a8:d0:3a:4b:76:15: + 9e:d2:d1:c6:2e:e3:db:57:1b:32:a2:b8:6f:e8:86: + a6:3f:70:ab:e5:70:92:ab:44:1e:40:50:fb:9c:a3: + 62:e4:6c:6e:a0:c8:de:e2:80:42:fa:e9:2f:e8:ce: + 32:04:8f:7c:8d:b7:1c:a3:35:3c:15:dd:9e:c3:ae: + 97:a5 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + FA:86:C9:DB:E0:BA:E9:78:F5:4B:A8:D6:15:DF:F0:D3:E1:6A:14:3C + X509v3 CRL Distribution Points: + URI:http://crl.usertrust.com/UTN-USERFirst-NetworkApplications.crl + + Signature Algorithm: sha1WithRSAEncryption + a4:f3:25:cc:d1:d4:91:83:22:d0:cc:32:ab:9b:96:4e:34:91: + 54:20:25:34:61:5f:2a:02:15:e1:8b:aa:ff:7d:64:51:cf:0a: + ff:bc:7d:d8:21:6a:78:cb:2f:51:6f:f8:42:1d:33:bd:eb:b5: + 7b:94:c3:c3:a9:a0:2d:df:d1:29:1f:1d:fe:8f:3f:bb:a8:45: + 2a:7f:d1:6e:55:24:e2:bb:02:fb:31:3f:be:e8:bc:ec:40:2b: + f8:01:d4:56:38:e4:ca:44:82:b5:61:20:21:67:65:f6:f0:0b: + e7:34:f8:a5:c2:9c:a3:5c:40:1f:85:93:95:06:de:4f:d4:27: + a9:b6:a5:fc:16:cd:73:31:3f:b8:65:27:cf:d4:53:1a:f0:ac: + 6e:9f:4f:05:0c:03:81:a7:84:29:c4:5a:bd:64:57:72:ad:3b: + cf:37:18:a6:98:c6:ad:06:b4:dc:08:a3:04:d5:29:a4:96:9a: + 12:67:4a:8c:60:45:9d:f1:23:9a:b0:00:9c:68:b5:98:50:d3: + ef:8e:2e:92:65:b1:48:3e:21:be:15:30:2a:0d:b5:0c:a3:6b: + 3f:ae:7f:57:f5:1f:96:7c:df:6f:dd:82:30:2c:65:1b:40:4a: + cd:68:b9:72:ec:71:76:ec:54:8e:1f:85:0c:01:6a:fa:a6:38: + ac:1f:c4:84 +MD5 Fingerprint=BF:60:59:A3:5B:BA:F6:A7:76:42:DA:6F:1A:7B:50:CF +-----BEGIN CERTIFICATE----- +MIIEZDCCA0ygAwIBAgIQRL4Mi1AAJLQR0zYwS8AzdzANBgkqhkiG9w0BAQUFADCB +ozELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xKzApBgNVBAMTIlVUTi1VU0VSRmlyc3Qt +TmV0d29yayBBcHBsaWNhdGlvbnMwHhcNOTkwNzA5MTg0ODM5WhcNMTkwNzA5MTg1 +NzQ5WjCBozELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0 +IExha2UgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYD +VQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xKzApBgNVBAMTIlVUTi1VU0VS +Rmlyc3QtTmV0d29yayBBcHBsaWNhdGlvbnMwggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQCz+5Gh5DZVhawGNFugmliy+LUPBXeDrjKxdpJo7CNKyXY/45y2 +N3kDuatpjQclthln5LAbGHNhSuh+zdMvZOOmfAz6F4CjDUeJT1FxL+78P/m4FoCH +iZMlIJpDgmkkdihZNaEdwH+DBmQWICzTSaSFtMBhf1EI+GgVkYDLpdXuOzr0hARe +YFmnjDRy7rh4xdE7EkpvfmUnuaRVxblvQ6TFHSyZwFKkeEwVs0CYCGtDxgGwenv1 +axwiP8vv/6jQOkt2FZ7S0cYu49tXGzKiuG/ohqY/cKvlcJKrRB5AUPuco2LkbG6g +yN7igEL66S/ozjIEj3yNtxyjNTwV3Z7DrpelAgMBAAGjgZEwgY4wCwYDVR0PBAQD +AgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFPqGydvguul49Uuo1hXf8NPh +ahQ8ME8GA1UdHwRIMEYwRKBCoECGPmh0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9V +VE4tVVNFUkZpcnN0LU5ldHdvcmtBcHBsaWNhdGlvbnMuY3JsMA0GCSqGSIb3DQEB +BQUAA4IBAQCk8yXM0dSRgyLQzDKrm5ZONJFUICU0YV8qAhXhi6r/fWRRzwr/vH3Y +IWp4yy9Rb/hCHTO967V7lMPDqaAt39EpHx3+jz+7qEUqf9FuVSTiuwL7MT++6Lzs +QCv4AdRWOOTKRIK1YSAhZ2X28AvnNPilwpyjXEAfhZOVBt5P1CeptqX8Fs1zMT+4 +ZSfP1FMa8Kxun08FDAOBp4QpxFq9ZFdyrTvPNximmMatBrTcCKME1SmklpoSZ0qM +YEWd8SOasACcaLWYUNPvji6SZbFIPiG+FTAqDbUMo2s/rn9X9R+WfN9v3YIwLGUb +QErNaLly7HF27FSOH4UMAWr6pjisH8SE +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=America Online Inc., CN=America Online Root Certification Authority 1 + Validity + Not Before: May 28 06:00:00 2002 GMT + Not After : Nov 19 20:43:00 2037 GMT + Subject: C=US, O=America Online Inc., CN=America Online Root Certification Authority 1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:a8:2f:e8:a4:69:06:03:47:c3:e9:2a:98:ff:19: + a2:70:9a:c6:50:b2:7e:a5:df:68:4d:1b:7c:0f:b6: + 97:68:7d:2d:a6:8b:97:e9:64:86:c9:a3:ef:a0:86: + bf:60:65:9c:4b:54:88:c2:48:c5:4a:39:bf:14:e3: + 59:55:e5:19:b4:74:c8:b4:05:39:5c:16:a5:e2:95: + 05:e0:12:ae:59:8b:a2:33:68:58:1c:a6:d4:15:b7: + d8:9f:d7:dc:71:ab:7e:9a:bf:9b:8e:33:0f:22:fd: + 1f:2e:e7:07:36:ef:62:39:c5:dd:cb:ba:25:14:23: + de:0c:c6:3d:3c:ce:82:08:e6:66:3e:da:51:3b:16: + 3a:a3:05:7f:a0:dc:87:d5:9c:fc:72:a9:a0:7d:78: + e4:b7:31:55:1e:65:bb:d4:61:b0:21:60:ed:10:32: + 72:c5:92:25:1e:f8:90:4a:18:78:47:df:7e:30:37: + 3e:50:1b:db:1c:d3:6b:9a:86:53:07:b0:ef:ac:06: + 78:f8:84:99:fe:21:8d:4c:80:b6:0c:82:f6:66:70: + 79:1a:d3:4f:a3:cf:f1:cf:46:b0:4b:0f:3e:dd:88: + 62:b8:8c:a9:09:28:3b:7a:c7:97:e1:1e:e5:f4:9f: + c0:c0:ae:24:a0:c8:a1:d9:0f:d6:7b:26:82:69:32: + 3d:a7 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 00:AD:D9:A3:F6:79:F6:6E:74:A9:7F:33:3D:81:17:D7:4C:CF:33:DE + X509v3 Authority Key Identifier: + keyid:00:AD:D9:A3:F6:79:F6:6E:74:A9:7F:33:3D:81:17:D7:4C:CF:33:DE + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 7c:8a:d1:1f:18:37:82:e0:b8:b0:a3:ed:56:95:c8:62:61:9c: + 05:a2:cd:c2:62:26:61:cd:10:16:d7:cc:b4:65:34:d0:11:8a: + ad:a8:a9:05:66:ef:74:f3:6d:5f:9d:99:af:f6:8b:fb:eb:52: + b2:05:98:a2:6f:2a:c5:54:bd:25:bd:5f:ae:c8:86:ea:46:2c: + c1:b3:bd:c1:e9:49:70:18:16:97:08:13:8c:20:e0:1b:2e:3a: + 47:cb:1e:e4:00:30:95:5b:f4:45:a3:c0:1a:b0:01:4e:ab:bd: + c0:23:6e:63:3f:80:4a:c5:07:ed:dc:e2:6f:c7:c1:62:f1:e3: + 72:d6:04:c8:74:67:0b:fa:88:ab:a1:01:c8:6f:f0:14:af:d2: + 99:cd:51:93:7e:ed:2e:38:c7:bd:ce:46:50:3d:72:e3:79:25: + 9d:9b:88:2b:10:20:dd:a5:b8:32:9f:8d:e0:29:df:21:74:86: + 82:db:2f:82:30:c6:c7:35:86:b3:f9:96:5f:46:db:0c:45:fd: + f3:50:c3:6f:c6:c3:48:ad:46:a6:e1:27:47:0a:1d:0e:9b:b6: + c2:77:7f:63:f2:e0:7d:1a:be:fc:e0:df:d7:c7:a7:6c:b0:f9: + ae:ba:3c:fd:74:b4:11:e8:58:0d:80:bc:d3:a8:80:3a:99:ed: + 75:cc:46:7b +MD5 Fingerprint=14:F1:08:AD:9D:FA:64:E2:89:E7:1C:CF:A8:AD:7D:5E +-----BEGIN CERTIFICATE----- +MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEc +MBoGA1UEChMTQW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBP +bmxpbmUgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyODA2 +MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0Ft +ZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2EgT25saW5lIFJvb3Qg +Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCaxlCyfqXfaE0bfA+2l2h9LaaLl+lk +hsmj76CGv2BlnEtUiMJIxUo5vxTjWVXlGbR0yLQFOVwWpeKVBeASrlmLojNoWBym +1BW32J/X3HGrfpq/m44zDyL9Hy7nBzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsW +OqMFf6Dch9Wc/HKpoH145LcxVR5lu9RhsCFg7RAycsWSJR74kEoYeEfffjA3PlAb +2xzTa5qGUwew76wGePiEmf4hjUyAtgyC9mZweRrTT6PP8c9GsEsPPt2IYriMqQko +O3rHl+Ee5fSfwMCuJKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0TAQH/BAUw +AwEB/zAdBgNVHQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAU +AK3Zo/Z59m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB +BQUAA4IBAQB8itEfGDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkF +Zu90821fnZmv9ov761KyBZiibyrFVL0lvV+uyIbqRizBs73B6UlwGBaXCBOMIOAb +LjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft3OJvx8Fi8eNy1gTIdGcL+oir +oQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43gKd8hdIaC2y+C +MMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j8uB9Gr784N/Xx6ds +sPmuujz9dLQR6FgNgLzTqIA6me11zEZ7 +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=America Online Inc., CN=America Online Root Certification Authority 2 + Validity + Not Before: May 28 06:00:00 2002 GMT + Not After : Sep 29 14:08:00 2037 GMT + Subject: C=US, O=America Online Inc., CN=America Online Root Certification Authority 2 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (4096 bit) + Modulus (4096 bit): + 00:cc:41:45:1d:e9:3d:4d:10:f6:8c:b1:41:c9:e0: + 5e:cb:0d:b7:bf:47:73:d3:f0:55:4d:dd:c6:0c:fa: + b1:66:05:6a:cd:78:b4:dc:02:db:4e:81:f3:d7:a7: + 7c:71:bc:75:63:a0:5d:e3:07:0c:48:ec:25:c4:03: + 20:f4:ff:0e:3b:12:ff:9b:8d:e1:c6:d5:1b:b4:6d: + 22:e3:b1:db:7f:21:64:af:86:bc:57:22:2a:d6:47: + 81:57:44:82:56:53:bd:86:14:01:0b:fc:7f:74:a4: + 5a:ae:f1:ba:11:b5:9b:58:5a:80:b4:37:78:09:33: + 7c:32:47:03:5c:c4:a5:83:48:f4:57:56:6e:81:36: + 27:18:4f:ec:9b:28:c2:d4:b4:d7:7c:0c:3e:0c:2b: + df:ca:04:d7:c6:8e:ea:58:4e:a8:a4:a5:18:1c:6c: + 45:98:a3:41:d1:2d:d2:c7:6d:8d:19:f1:ad:79:b7: + 81:3f:bd:06:82:27:2d:10:58:05:b5:78:05:b9:2f: + db:0c:6b:90:90:7e:14:59:38:bb:94:24:13:e5:d1: + 9d:14:df:d3:82:4d:46:f0:80:39:52:32:0f:e3:84: + b2:7a:43:f2:5e:de:5f:3f:1d:dd:e3:b2:1b:a0:a1: + 2a:23:03:6e:2e:01:15:87:5c:a6:75:75:c7:97:61: + be:de:86:dc:d4:48:db:bd:2a:bf:4a:55:da:e8:7d: + 50:fb:b4:80:17:b8:94:bf:01:3d:ea:da:ba:7c:e0: + 58:67:17:b9:58:e0:88:86:46:67:6c:9d:10:47:58: + 32:d0:35:7c:79:2a:90:a2:5a:10:11:23:35:ad:2f: + cc:e4:4a:5b:a7:c8:27:f2:83:de:5e:bb:5e:77:e7: + e8:a5:6e:63:c2:0d:5d:61:d0:8c:d2:6c:5a:21:0e: + ca:28:a3:ce:2a:e9:95:c7:48:cf:96:6f:1d:92:25: + c8:c6:c6:c1:c1:0c:05:ac:26:c4:d2:75:d2:e1:2a: + 67:c0:3d:5b:a5:9a:eb:cf:7b:1a:a8:9d:14:45:e5: + 0f:a0:9a:65:de:2f:28:bd:ce:6f:94:66:83:48:29: + d8:ea:65:8c:af:93:d9:64:9f:55:57:26:bf:6f:cb: + 37:31:99:a3:60:bb:1c:ad:89:34:32:62:b8:43:21: + 06:72:0c:a1:5c:6d:46:c5:fa:29:cf:30:de:89:dc: + 71:5b:dd:b6:37:3e:df:50:f5:b8:07:25:26:e5:bc: + b5:fe:3c:02:b3:b7:f8:be:43:c1:87:11:94:9e:23: + 6c:17:8a:b8:8a:27:0c:54:47:f0:a9:b3:c0:80:8c: + a0:27:eb:1d:19:e3:07:8e:77:70:ca:2b:f4:7d:76: + e0:78:67 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 4D:45:C1:68:38:BB:73:A9:69:A1:20:E7:ED:F5:22:A1:23:14:D7:9E + X509v3 Authority Key Identifier: + keyid:4D:45:C1:68:38:BB:73:A9:69:A1:20:E7:ED:F5:22:A1:23:14:D7:9E + + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 67:6b:06:b9:5f:45:3b:2a:4b:33:b3:e6:1b:6b:59:4e:22:cc: + b9:b7:a4:25:c9:a7:c4:f0:54:96:0b:64:f3:b1:58:4f:5e:51: + fc:b2:97:7b:27:65:c2:e5:ca:e7:0d:0c:25:7b:62:e3:fa:9f: + b4:87:b7:45:46:af:83:a5:97:48:8c:a5:bd:f1:16:2b:9b:76: + 2c:7a:35:60:6c:11:80:97:cc:a9:92:52:e6:2b:e6:69:ed:a9: + f8:36:2d:2c:77:bf:61:48:d1:63:0b:b9:5b:52:ed:18:b0:43: + 42:22:a6:b1:77:ae:de:69:c5:cd:c7:1c:a1:b1:a5:1c:10:fb: + 18:be:1a:70:dd:c1:92:4b:be:29:5a:9d:3f:35:be:e5:7d:51: + f8:55:e0:25:75:23:87:1e:5c:dc:ba:9d:b0:ac:b3:69:db:17: + 83:c9:f7:de:0c:bc:08:dc:91:9e:a8:d0:d7:15:37:73:a5:35: + b8:fc:7e:c5:44:40:06:c3:eb:f8:22:80:5c:47:ce:02:e3:11: + 9f:44:ff:fd:9a:32:cc:7d:64:51:0e:eb:57:26:76:3a:e3:1e: + 22:3c:c2:a6:36:dd:19:ef:a7:fc:12:f3:26:c0:59:31:85:4c: + 9c:d8:cf:df:a4:cc:cc:29:93:ff:94:6d:76:5c:13:08:97:f2: + ed:a5:0b:4d:dd:e8:c9:68:0e:66:d3:00:0e:33:12:5b:bc:95: + e5:32:90:a8:b3:c6:6c:83:ad:77:ee:8b:7e:7e:b1:a9:ab:d3: + e1:f1:b6:c0:b1:ea:88:c0:e7:d3:90:e9:28:92:94:7b:68:7b: + 97:2a:0a:67:2d:85:02:38:10:e4:03:61:d4:da:25:36:c7:08: + 58:2d:a1:a7:51:af:30:0a:49:f5:a6:69:87:07:2d:44:46:76: + 8e:2a:e5:9a:3b:d7:18:a2:fc:9c:38:10:cc:c6:3b:d2:b5:17: + 3a:6f:fd:ae:25:bd:f5:72:59:64:b1:74:2a:38:5f:18:4c:df: + cf:71:04:5a:36:d4:bf:2f:99:9c:e8:d9:ba:b1:95:e6:02:4b: + 21:a1:5b:d5:c1:4f:8f:ae:69:6d:53:db:01:93:b5:5c:1e:18: + dd:64:5a:ca:18:28:3e:63:04:11:fd:1c:8d:00:0f:b8:37:df: + 67:8a:9d:66:a9:02:6a:91:ff:13:ca:2f:5d:83:bc:87:93:6c: + dc:24:51:16:04:25:66:fa:b3:d9:c2:ba:29:be:9a:48:38:82: + 99:f4:bf:3b:4a:31:19:f9:bf:8e:21:33:14:ca:4f:54:5f:fb: + ce:fb:8f:71:7f:fd:5e:19:a0:0f:4b:91:b8:c4:54:bc:06:b0: + 45:8f:26:91:a2:8e:fe:a9 +MD5 Fingerprint=D6:ED:3C:CA:E2:66:0F:AF:10:43:0D:77:9B:04:09:BF +-----BEGIN CERTIFICATE----- +MIIFpDCCA4ygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEc +MBoGA1UEChMTQW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBP +bmxpbmUgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyODA2 +MDAwMFoXDTM3MDkyOTE0MDgwMFowYzELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0Ft +ZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2EgT25saW5lIFJvb3Qg +Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBAMxBRR3pPU0Q9oyxQcngXssNt79Hc9PwVU3dxgz6sWYFas14tNwC +206B89enfHG8dWOgXeMHDEjsJcQDIPT/DjsS/5uN4cbVG7RtIuOx238hZK+GvFci +KtZHgVdEglZTvYYUAQv8f3SkWq7xuhG1m1hagLQ3eAkzfDJHA1zEpYNI9FdWboE2 +JxhP7JsowtS013wMPgwr38oE18aO6lhOqKSlGBxsRZijQdEt0sdtjRnxrXm3gT+9 +BoInLRBYBbV4Bbkv2wxrkJB+FFk4u5QkE+XRnRTf04JNRvCAOVIyD+OEsnpD8l7e +Xz8d3eOyG6ChKiMDbi4BFYdcpnV1x5dhvt6G3NRI270qv0pV2uh9UPu0gBe4lL8B +PeraunzgWGcXuVjgiIZGZ2ydEEdYMtA1fHkqkKJaEBEjNa0vzORKW6fIJ/KD3l67 +Xnfn6KVuY8INXWHQjNJsWiEOyiijzirplcdIz5ZvHZIlyMbGwcEMBawmxNJ10uEq +Z8A9W6Wa6897GqidFEXlD6CaZd4vKL3Ob5Rmg0gp2OpljK+T2WSfVVcmv2/LNzGZ +o2C7HK2JNDJiuEMhBnIMoVxtRsX6Kc8w3onccVvdtjc+31D1uAclJuW8tf48ArO3 ++L5DwYcRlJ4jbBeKuIonDFRH8KmzwICMoCfrHRnjB453cMor9H124HhnAgMBAAGj +YzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFE1FwWg4u3OpaaEg5+31IqEj +FNeeMB8GA1UdIwQYMBaAFE1FwWg4u3OpaaEg5+31IqEjFNeeMA4GA1UdDwEB/wQE +AwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAZ2sGuV9FOypLM7PmG2tZTiLMubekJcmn +xPBUlgtk87FYT15R/LKXeydlwuXK5w0MJXti4/qftIe3RUavg6WXSIylvfEWK5t2 +LHo1YGwRgJfMqZJS5ivmae2p+DYtLHe/YUjRYwu5W1LtGLBDQiKmsXeu3mnFzccc +obGlHBD7GL4acN3Bkku+KVqdPzW+5X1R+FXgJXUjhx5c3LqdsKyzadsXg8n33gy8 +CNyRnqjQ1xU3c6U1uPx+xURABsPr+CKAXEfOAuMRn0T//ZoyzH1kUQ7rVyZ2OuMe +IjzCpjbdGe+n/BLzJsBZMYVMnNjP36TMzCmT/5RtdlwTCJfy7aULTd3oyWgOZtMA +DjMSW7yV5TKQqLPGbIOtd+6Lfn6xqavT4fG2wLHqiMDn05DpKJKUe2h7lyoKZy2F +AjgQ5ANh1NolNscIWC2hp1GvMApJ9aZphwctREZ2jirlmjvXGKL8nDgQzMY70rUX +Om/9riW99XJZZLF0KjhfGEzfz3EEWjbUvy+ZnOjZurGV5gJLIaFb1cFPj65pbVPb +AZO1XB4Y3WRayhgoPmMEEf0cjQAPuDffZ4qdZqkCapH/E8ovXYO8h5Ns3CRRFgQl +Zvqz2cK6Kb6aSDiCmfS/O0oxGfm/jiEzFMpPVF/7zvuPcX/9XhmgD0uRuMRUvAaw +RY8mkaKO/qk= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 13:86:35:4d:1d:3f:06:f2:c1:f9:65:05:d5:90:1c:62 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=VISA, OU=Visa International Service Association, CN=Visa eCommerce Root + Validity + Not Before: Jun 26 02:18:36 2002 GMT + Not After : Jun 24 00:16:12 2022 GMT + Subject: C=US, O=VISA, OU=Visa International Service Association, CN=Visa eCommerce Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:af:57:de:56:1e:6e:a1:da:60:b1:94:27:cb:17: + db:07:3f:80:85:4f:c8:9c:b6:d0:f4:6f:4f:cf:99: + d8:e1:db:c2:48:5c:3a:ac:39:33:c7:1f:6a:8b:26: + 3d:2b:35:f5:48:b1:91:c1:02:4e:04:96:91:7b:b0: + 33:f0:b1:14:4e:11:6f:b5:40:af:1b:45:a5:4a:ef: + 7e:b6:ac:f2:a0:1f:58:3f:12:46:60:3c:8d:a1:e0: + 7d:cf:57:3e:33:1e:fb:47:f1:aa:15:97:07:55:66: + a5:b5:2d:2e:d8:80:59:b2:a7:0d:b7:46:ec:21:63: + ff:35:ab:a5:02:cf:2a:f4:4c:fe:7b:f5:94:5d:84: + 4d:a8:f2:60:8f:db:0e:25:3c:9f:73:71:cf:94:df: + 4a:ea:db:df:72:38:8c:f3:96:bd:f1:17:bc:d2:ba: + 3b:45:5a:c6:a7:f6:c6:17:8b:01:9d:fc:19:a8:2a: + 83:16:b8:3a:48:fe:4e:3e:a0:ab:06:19:e9:53:f3: + 80:13:07:ed:2d:bf:3f:0a:3c:55:20:39:2c:2c:00: + 69:74:95:4a:bc:20:b2:a9:79:e5:18:89:91:a8:dc: + 1c:4d:ef:bb:7e:37:0b:5d:fe:39:a5:88:52:8c:00: + 6c:ec:18:7c:41:bd:f6:8b:75:77:ba:60:9d:84:e7: + fe:2d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 15:38:83:0F:3F:2C:3F:70:33:1E:CD:46:FE:07:8C:20:E0:D7:C3:B7 + Signature Algorithm: sha1WithRSAEncryption + 5f:f1:41:7d:7c:5c:08:b9:2b:e0:d5:92:47:fa:67:5c:a5:13: + c3:03:21:9b:2b:4c:89:46:cf:59:4d:c9:fe:a5:40:b6:63:cd: + dd:71:28:95:67:11:cc:24:ac:d3:44:6c:71:ae:01:20:6b:03: + a2:8f:18:b7:29:3a:7d:e5:16:60:53:78:3c:c0:af:15:83:f7: + 8f:52:33:24:bd:64:93:97:ee:8b:f7:db:18:a8:6d:71:b3:f7: + 2c:17:d0:74:25:69:f7:fe:6b:3c:94:be:4d:4b:41:8c:4e:e2: + 73:d0:e3:90:22:73:43:cd:f3:ef:ea:73:ce:45:8a:b0:a6:49: + ff:4c:7d:9d:71:88:c4:76:1d:90:5b:1d:ee:fd:cc:f7:ee:fd: + 60:a5:b1:7a:16:71:d1:16:d0:7c:12:3c:6c:69:97:db:ae:5f: + 39:9a:70:2f:05:3c:19:46:04:99:20:36:d0:60:6e:61:06:bb: + 16:42:8c:70:f7:30:fb:e0:db:66:a3:00:01:bd:e6:2c:da:91: + 5f:a0:46:8b:4d:6a:9c:3d:3d:dd:05:46:fe:76:bf:a0:0a:3c: + e4:00:e6:27:b7:ff:84:2d:de:ba:22:27:96:10:71:eb:22:ed: + df:df:33:9c:cf:e3:ad:ae:8e:d4:8e:e6:4f:51:af:16:92:e0: + 5c:f6:07:0f +MD5 Fingerprint=FC:11:B8:D8:08:93:30:00:6D:23:F9:7E:EB:52:1E:02 +-----BEGIN CERTIFICATE----- +MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBr +MQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRl +cm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv +bW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2WhcNMjIwNjI0MDAxNjEyWjBrMQsw +CQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5h +dGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1l +cmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h +2mCxlCfLF9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4E +lpF7sDPwsRROEW+1QK8bRaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdV +ZqW1LS7YgFmypw23RuwhY/81q6UCzyr0TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq +299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI/k4+oKsGGelT84ATB+0t +vz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzsGHxBvfaL +dXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD +AgEGMB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUF +AAOCAQEAX/FBfXxcCLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcR +zCSs00Rsca4BIGsDoo8Ytyk6feUWYFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3 +LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pzzkWKsKZJ/0x9nXGIxHYdkFsd +7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBuYQa7FkKMcPcw +++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt +398znM/jra6O1I7mT1GvFpLgXPYHDw== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1002 (0x3ea) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=DE, ST=Hamburg, L=Hamburg, O=TC TrustCenter for Security in Data Networks GmbH, OU=TC TrustCenter Class 2 CA/emailAddress=certificate@trustcenter.de + Validity + Not Before: Mar 9 11:59:59 1998 GMT + Not After : Jan 1 11:59:59 2011 GMT + Subject: C=DE, ST=Hamburg, L=Hamburg, O=TC TrustCenter for Security in Data Networks GmbH, OU=TC TrustCenter Class 2 CA/emailAddress=certificate@trustcenter.de + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:da:38:e8:ed:32:00:29:71:83:01:0d:bf:8c:01: + dc:da:c6:ad:39:a4:a9:8a:2f:d5:8b:5c:68:5f:50: + c6:62:f5:66:bd:ca:91:22:ec:aa:1d:51:d7:3d:b3: + 51:b2:83:4e:5d:cb:49:b0:f0:4c:55:e5:6b:2d:c7: + 85:0b:30:1c:92:4e:82:d4:ca:02:ed:f7:6f:be:dc: + e0:e3:14:b8:05:53:f2:9a:f4:56:8b:5a:9e:85:93: + d1:b4:82:56:ae:4d:bb:a8:4b:57:16:bc:fe:f8:58: + 9e:f8:29:8d:b0:7b:cd:78:c9:4f:ac:8b:67:0c:f1: + 9c:fb:fc:57:9b:57:5c:4f:0d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Netscape CA Policy Url: + http://www.trustcenter.de/guidelines + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Signature Algorithm: md5WithRSAEncryption + 84:52:fb:28:df:ff:1f:75:01:bc:01:be:04:56:97:6a:74:42: + 24:31:83:f9:46:b1:06:8a:89:cf:96:2c:33:bf:8c:b5:5f:7a: + 72:a1:85:06:ce:86:f8:05:8e:e8:f9:25:ca:da:83:8c:06:ac: + eb:36:6d:85:91:34:04:36:f4:42:f0:f8:79:2e:0a:48:5c:ab: + cc:51:4f:78:76:a0:d9:ac:19:bd:2a:d1:69:04:28:91:ca:36: + 10:27:80:57:5b:d2:5c:f5:c2:5b:ab:64:81:63:74:51:f4:97: + bf:cd:12:28:f7:4d:66:7f:a7:f0:1c:01:26:78:b2:66:47:70: + 51:64 +MD5 Fingerprint=B8:16:33:4C:4C:4C:F2:D8:D3:4D:06:B4:A6:5B:40:03 +-----BEGIN CERTIFICATE----- +MIIDXDCCAsWgAwIBAgICA+owDQYJKoZIhvcNAQEEBQAwgbwxCzAJBgNVBAYTAkRF +MRAwDgYDVQQIEwdIYW1idXJnMRAwDgYDVQQHEwdIYW1idXJnMTowOAYDVQQKEzFU +QyBUcnVzdENlbnRlciBmb3IgU2VjdXJpdHkgaW4gRGF0YSBOZXR3b3JrcyBHbWJI +MSIwIAYDVQQLExlUQyBUcnVzdENlbnRlciBDbGFzcyAyIENBMSkwJwYJKoZIhvcN +AQkBFhpjZXJ0aWZpY2F0ZUB0cnVzdGNlbnRlci5kZTAeFw05ODAzMDkxMTU5NTla +Fw0xMTAxMDExMTU5NTlaMIG8MQswCQYDVQQGEwJERTEQMA4GA1UECBMHSGFtYnVy +ZzEQMA4GA1UEBxMHSGFtYnVyZzE6MDgGA1UEChMxVEMgVHJ1c3RDZW50ZXIgZm9y +IFNlY3VyaXR5IGluIERhdGEgTmV0d29ya3MgR21iSDEiMCAGA1UECxMZVEMgVHJ1 +c3RDZW50ZXIgQ2xhc3MgMiBDQTEpMCcGCSqGSIb3DQEJARYaY2VydGlmaWNhdGVA +dHJ1c3RjZW50ZXIuZGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANo46O0y +AClxgwENv4wB3NrGrTmkqYov1YtcaF9QxmL1Zr3KkSLsqh1R1z2zUbKDTl3LSbDw +TFXlay3HhQswHJJOgtTKAu33b77c4OMUuAVT8pr0VotanoWT0bSCVq5Nu6hLVxa8 +/vhYnvgpjbB7zXjJT6yLZwzxnPv8V5tXXE8NAgMBAAGjazBpMA8GA1UdEwEB/wQF +MAMBAf8wDgYDVR0PAQH/BAQDAgGGMDMGCWCGSAGG+EIBCAQmFiRodHRwOi8vd3d3 +LnRydXN0Y2VudGVyLmRlL2d1aWRlbGluZXMwEQYJYIZIAYb4QgEBBAQDAgAHMA0G +CSqGSIb3DQEBBAUAA4GBAIRS+yjf/x91AbwBvgRWl2p0QiQxg/lGsQaKic+WLDO/ +jLVfenKhhQbOhvgFjuj5Jcrag4wGrOs2bYWRNAQ29ELw+HkuCkhcq8xRT3h2oNms +Gb0q0WkEKJHKNhAngFdb0lz1wlurZIFjdFH0l7/NEij3TWZ/p/AcASZ4smZHcFFk +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1003 (0x3eb) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=DE, ST=Hamburg, L=Hamburg, O=TC TrustCenter for Security in Data Networks GmbH, OU=TC TrustCenter Class 3 CA/emailAddress=certificate@trustcenter.de + Validity + Not Before: Mar 9 11:59:59 1998 GMT + Not After : Jan 1 11:59:59 2011 GMT + Subject: C=DE, ST=Hamburg, L=Hamburg, O=TC TrustCenter for Security in Data Networks GmbH, OU=TC TrustCenter Class 3 CA/emailAddress=certificate@trustcenter.de + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:b6:b4:c1:35:05:2e:0d:8d:ec:a0:40:6a:1c:0e: + 27:a6:50:92:6b:50:1b:07:de:2e:e7:76:cc:e0:da: + fc:84:a8:5e:8c:63:6a:2b:4d:d9:4e:02:76:11:c1: + 0b:f2:8d:79:ca:00:b6:f1:b0:0e:d7:fb:a4:17:3d: + af:ab:69:7a:96:27:bf:af:33:a1:9a:2a:59:aa:c4: + b5:37:08:f2:12:a5:31:b6:43:f5:32:96:71:28:28: + ab:8d:28:86:df:bb:ee:e3:0c:7d:30:d6:c3:52:ab: + 8f:5d:27:9c:6b:c0:a3:e7:05:6b:57:49:44:b3:6e: + ea:64:cf:d2:8e:7a:50:77:77 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Digital Signature, Certificate Sign, CRL Sign + Netscape CA Policy Url: + http://www.trustcenter.de/guidelines + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Signature Algorithm: md5WithRSAEncryption + 16:3d:c6:cd:c1:bb:85:71:85:46:9f:3e:20:8f:51:28:99:ec: + 2d:45:21:63:23:5b:04:bb:4c:90:b8:88:92:04:4d:bd:7d:01: + a3:3f:f6:ec:ce:f1:de:fe:7d:e5:e1:3e:bb:c6:ab:5e:0b:dd: + 3d:96:c4:cb:a9:d4:f9:26:e6:06:4e:9e:0c:a5:7a:ba:6e:c3: + 7c:82:19:d1:c7:b1:b1:c3:db:0d:8e:9b:40:7c:37:0b:f1:5d: + e8:fd:1f:90:88:a5:0e:4e:37:64:21:a8:4e:8d:b4:9f:f1:de: + 48:ad:d5:56:18:52:29:8b:47:34:12:09:d4:bb:92:35:ef:0f: + db:34 +MD5 Fingerprint=5F:94:4A:73:22:B8:F7:D1:31:EC:59:39:F7:8E:FE:6E +-----BEGIN CERTIFICATE----- +MIIDXDCCAsWgAwIBAgICA+swDQYJKoZIhvcNAQEEBQAwgbwxCzAJBgNVBAYTAkRF +MRAwDgYDVQQIEwdIYW1idXJnMRAwDgYDVQQHEwdIYW1idXJnMTowOAYDVQQKEzFU +QyBUcnVzdENlbnRlciBmb3IgU2VjdXJpdHkgaW4gRGF0YSBOZXR3b3JrcyBHbWJI +MSIwIAYDVQQLExlUQyBUcnVzdENlbnRlciBDbGFzcyAzIENBMSkwJwYJKoZIhvcN +AQkBFhpjZXJ0aWZpY2F0ZUB0cnVzdGNlbnRlci5kZTAeFw05ODAzMDkxMTU5NTla +Fw0xMTAxMDExMTU5NTlaMIG8MQswCQYDVQQGEwJERTEQMA4GA1UECBMHSGFtYnVy +ZzEQMA4GA1UEBxMHSGFtYnVyZzE6MDgGA1UEChMxVEMgVHJ1c3RDZW50ZXIgZm9y +IFNlY3VyaXR5IGluIERhdGEgTmV0d29ya3MgR21iSDEiMCAGA1UECxMZVEMgVHJ1 +c3RDZW50ZXIgQ2xhc3MgMyBDQTEpMCcGCSqGSIb3DQEJARYaY2VydGlmaWNhdGVA +dHJ1c3RjZW50ZXIuZGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALa0wTUF +Lg2N7KBAahwOJ6ZQkmtQGwfeLud2zODa/ISoXoxjaitN2U4CdhHBC/KNecoAtvGw +Dtf7pBc9r6tpepYnv68zoZoqWarEtTcI8hKlMbZD9TKWcSgoq40oht+77uMMfTDW +w1Krj10nnGvAo+cFa1dJRLNu6mTP0o56UHd3AgMBAAGjazBpMA8GA1UdEwEB/wQF +MAMBAf8wDgYDVR0PAQH/BAQDAgGGMDMGCWCGSAGG+EIBCAQmFiRodHRwOi8vd3d3 +LnRydXN0Y2VudGVyLmRlL2d1aWRlbGluZXMwEQYJYIZIAYb4QgEBBAQDAgAHMA0G +CSqGSIb3DQEBBAUAA4GBABY9xs3Bu4VxhUafPiCPUSiZ7C1FIWMjWwS7TJC4iJIE +Tb19AaM/9uzO8d7+feXhPrvGq14L3T2WxMup1Pkm5gZOngylerpuw3yCGdHHsbHD +2w2Om0B8NwvxXej9H5CIpQ5ON2QhqE6NtJ/x3kit1VYYUimLRzQSCdS7kjXvD9s0 +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 65568 (0x10020) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=PL, O=Unizeto Sp. z o.o., CN=Certum CA + Validity + Not Before: Jun 11 10:46:39 2002 GMT + Not After : Jun 11 10:46:39 2027 GMT + Subject: C=PL, O=Unizeto Sp. z o.o., CN=Certum CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ce:b1:c1:2e:d3:4f:7c:cd:25:ce:18:3e:4f:c4: + 8c:6f:80:6a:73:c8:5b:51:f8:9b:d2:dc:bb:00:5c: + b1:a0:fc:75:03:ee:81:f0:88:ee:23:52:e9:e6:15: + 33:8d:ac:2d:09:c5:76:f9:2b:39:80:89:e4:97:4b: + 90:a5:a8:78:f8:73:43:7b:a4:61:b0:d8:58:cc:e1: + 6c:66:7e:9c:f3:09:5e:55:63:84:d5:a8:ef:f3:b1: + 2e:30:68:b3:c4:3c:d8:ac:6e:8d:99:5a:90:4e:34: + dc:36:9a:8f:81:88:50:b7:6d:96:42:09:f3:d7:95: + 83:0d:41:4b:b0:6a:6b:f8:fc:0f:7e:62:9f:67:c4: + ed:26:5f:10:26:0f:08:4f:f0:a4:57:28:ce:8f:b8: + ed:45:f6:6e:ee:25:5d:aa:6e:39:be:e4:93:2f:d9: + 47:a0:72:eb:fa:a6:5b:af:ca:53:3f:e2:0e:c6:96: + 56:11:6e:f7:e9:66:a9:26:d8:7f:95:53:ed:0a:85: + 88:ba:4f:29:a5:42:8c:5e:b6:fc:85:20:00:aa:68: + 0b:a1:1a:85:01:9c:c4:46:63:82:88:b6:22:b1:ee: + fe:aa:46:59:7e:cf:35:2c:d5:b6:da:5d:f7:48:33: + 14:54:b6:eb:d9:6f:ce:cd:88:d6:ab:1b:da:96:3b: + 1d:59 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + b8:8d:ce:ef:e7:14:ba:cf:ee:b0:44:92:6c:b4:39:3e:a2:84: + 6e:ad:b8:21:77:d2:d4:77:82:87:e6:20:41:81:ee:e2:f8:11: + b7:63:d1:17:37:be:19:76:24:1c:04:1a:4c:eb:3d:aa:67:6f: + 2d:d4:cd:fe:65:31:70:c5:1b:a6:02:0a:ba:60:7b:6d:58:c2: + 9a:49:fe:63:32:0b:6b:e3:3a:c0:ac:ab:3b:b0:e8:d3:09:51: + 8c:10:83:c6:34:e0:c5:2b:e0:1a:b6:60:14:27:6c:32:77:8c: + bc:b2:72:98:cf:cd:cc:3f:b9:c8:24:42:14:d6:57:fc:e6:26: + 43:a9:1d:e5:80:90:ce:03:54:28:3e:f7:3f:d3:f8:4d:ed:6a: + 0a:3a:93:13:9b:3b:14:23:13:63:9c:3f:d1:87:27:79:e5:4c: + 51:e3:01:ad:85:5d:1a:3b:b1:d5:73:10:a4:d3:f2:bc:6e:64: + f5:5a:56:90:a8:c7:0e:4c:74:0f:2e:71:3b:f7:c8:47:f4:69: + 6f:15:f2:11:5e:83:1e:9c:7c:52:ae:fd:02:da:12:a8:59:67: + 18:db:bc:70:dd:9b:b1:69:ed:80:ce:89:40:48:6a:0e:35:ca: + 29:66:15:21:94:2c:e8:60:2a:9b:85:4a:40:f3:6b:8a:24:ec: + 06:16:2c:73 +MD5 Fingerprint=2C:8F:9F:66:1D:18:90:B1:47:26:9D:8E:86:82:8C:A9 +-----BEGIN CERTIFICATE----- +MIIDDDCCAfSgAwIBAgIDAQAgMA0GCSqGSIb3DQEBBQUAMD4xCzAJBgNVBAYTAlBM +MRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBD +QTAeFw0wMjA2MTExMDQ2MzlaFw0yNzA2MTExMDQ2MzlaMD4xCzAJBgNVBAYTAlBM +MRswGQYDVQQKExJVbml6ZXRvIFNwLiB6IG8uby4xEjAQBgNVBAMTCUNlcnR1bSBD +QTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6xwS7TT3zNJc4YPk/E +jG+AanPIW1H4m9LcuwBcsaD8dQPugfCI7iNS6eYVM42sLQnFdvkrOYCJ5JdLkKWo +ePhzQ3ukYbDYWMzhbGZ+nPMJXlVjhNWo7/OxLjBos8Q82KxujZlakE403Daaj4GI +ULdtlkIJ89eVgw1BS7Bqa/j8D35in2fE7SZfECYPCE/wpFcozo+47UX2bu4lXapu +Ob7kky/ZR6By6/qmW6/KUz/iDsaWVhFu9+lmqSbYf5VT7QqFiLpPKaVCjF62/IUg +AKpoC6EahQGcxEZjgoi2IrHu/qpGWX7PNSzVttpd90gzFFS269lvzs2I1qsb2pY7 +HVkCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEA +uI3O7+cUus/usESSbLQ5PqKEbq24IXfS1HeCh+YgQYHu4vgRt2PRFze+GXYkHAQa +TOs9qmdvLdTN/mUxcMUbpgIKumB7bVjCmkn+YzILa+M6wKyrO7Do0wlRjBCDxjTg +xSvgGrZgFCdsMneMvLJymM/NzD+5yCRCFNZX/OYmQ6kd5YCQzgNUKD73P9P4Te1q +CjqTE5s7FCMTY5w/0YcneeVMUeMBrYVdGjux1XMQpNPyvG5k9VpWkKjHDkx0Dy5x +O/fIR/RpbxXyEV6DHpx8Uq79AtoSqFlnGNu8cN2bsWntgM6JQEhqDjXKKWYVIZQs +6GAqm4VKQPNriiTsBhYscw== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services + Validity + Not Before: Jan 1 00:00:00 2004 GMT + Not After : Dec 31 23:59:59 2028 GMT + Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=AAA Certificate Services + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:be:40:9d:f4:6e:e1:ea:76:87:1c:4d:45:44:8e: + be:46:c8:83:06:9d:c1:2a:fe:18:1f:8e:e4:02:fa: + f3:ab:5d:50:8a:16:31:0b:9a:06:d0:c5:70:22:cd: + 49:2d:54:63:cc:b6:6e:68:46:0b:53:ea:cb:4c:24: + c0:bc:72:4e:ea:f1:15:ae:f4:54:9a:12:0a:c3:7a: + b2:33:60:e2:da:89:55:f3:22:58:f3:de:dc:cf:ef: + 83:86:a2:8c:94:4f:9f:68:f2:98:90:46:84:27:c7: + 76:bf:e3:cc:35:2c:8b:5e:07:64:65:82:c0:48:b0: + a8:91:f9:61:9f:76:20:50:a8:91:c7:66:b5:eb:78: + 62:03:56:f0:8a:1a:13:ea:31:a3:1e:a0:99:fd:38: + f6:f6:27:32:58:6f:07:f5:6b:b8:fb:14:2b:af:b7: + aa:cc:d6:63:5f:73:8c:da:05:99:a8:38:a8:cb:17: + 78:36:51:ac:e9:9e:f4:78:3a:8d:cf:0f:d9:42:e2: + 98:0c:ab:2f:9f:0e:01:de:ef:9f:99:49:f1:2d:df: + ac:74:4d:1b:98:b5:47:c5:e5:29:d1:f9:90:18:c7: + 62:9c:be:83:c7:26:7b:3e:8a:25:c7:c0:dd:9d:e6: + 35:68:10:20:9d:8f:d8:de:d2:c3:84:9c:0d:5e:e8: + 2f:c9 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + A0:11:0A:23:3E:96:F1:07:EC:E2:AF:29:EF:82:A5:7F:D0:30:A4:B4 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 CRL Distribution Points: + URI:http://crl.comodoca.com/AAACertificateServices.crl + URI:http://crl.comodo.net/AAACertificateServices.crl + + Signature Algorithm: sha1WithRSAEncryption + 08:56:fc:02:f0:9b:e8:ff:a4:fa:d6:7b:c6:44:80:ce:4f:c4: + c5:f6:00:58:cc:a6:b6:bc:14:49:68:04:76:e8:e6:ee:5d:ec: + 02:0f:60:d6:8d:50:18:4f:26:4e:01:e3:e6:b0:a5:ee:bf:bc: + 74:54:41:bf:fd:fc:12:b8:c7:4f:5a:f4:89:60:05:7f:60:b7: + 05:4a:f3:f6:f1:c2:bf:c4:b9:74:86:b6:2d:7d:6b:cc:d2:f3: + 46:dd:2f:c6:e0:6a:c3:c3:34:03:2c:7d:96:dd:5a:c2:0e:a7: + 0a:99:c1:05:8b:ab:0c:2f:f3:5c:3a:cf:6c:37:55:09:87:de: + 53:40:6c:58:ef:fc:b6:ab:65:6e:04:f6:1b:dc:3c:e0:5a:15: + c6:9e:d9:f1:59:48:30:21:65:03:6c:ec:e9:21:73:ec:9b:03: + a1:e0:37:ad:a0:15:18:8f:fa:ba:02:ce:a7:2c:a9:10:13:2c: + d4:e5:08:26:ab:22:97:60:f8:90:5e:74:d4:a2:9a:53:bd:f2: + a9:68:e0:a2:6e:c2:d7:6c:b1:a3:0f:9e:bf:eb:68:e7:56:f2: + ae:f2:e3:2b:38:3a:09:81:b5:6b:85:d7:be:2d:ed:3f:1a:b7: + b2:63:e2:f5:62:2c:82:d4:6a:00:41:50:f1:39:83:9f:95:e9: + 36:96:98:6e +MD5 Fingerprint=49:79:04:B0:EB:87:19:AC:47:B0:BC:11:51:9B:74:D0 +-----BEGIN CERTIFICATE----- +MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb +MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow +GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj +YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL +MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE +BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM +GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua +BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe +3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4 +YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR +rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm +ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU +oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF +MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v +QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t +b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF +AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q +GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz +Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2 +G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi +l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3 +smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=Secure Certificate Services + Validity + Not Before: Jan 1 00:00:00 2004 GMT + Not After : Dec 31 23:59:59 2028 GMT + Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=Secure Certificate Services + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:c0:71:33:82:8a:d0:70:eb:73:87:82:40:d5:1d: + e4:cb:c9:0e:42:90:f9:de:34:b9:a1:ba:11:f4:25: + 85:f3:cc:72:6d:f2:7b:97:6b:b3:07:f1:77:24:91: + 5f:25:8f:f6:74:3d:e4:80:c2:f8:3c:0d:f3:bf:40: + ea:f7:c8:52:d1:72:6f:ef:c8:ab:41:b8:6e:2e:17: + 2a:95:69:0c:cd:d2:1e:94:7b:2d:94:1d:aa:75:d7: + b3:98:cb:ac:bc:64:53:40:bc:8f:ac:ac:36:cb:5c: + ad:bb:dd:e0:94:17:ec:d1:5c:d0:bf:ef:a5:95:c9: + 90:c5:b0:ac:fb:1b:43:df:7a:08:5d:b7:b8:f2:40: + 1b:2b:27:9e:50:ce:5e:65:82:88:8c:5e:d3:4e:0c: + 7a:ea:08:91:b6:36:aa:2b:42:fb:ea:c2:a3:39:e5: + db:26:38:ad:8b:0a:ee:19:63:c7:1c:24:df:03:78: + da:e6:ea:c1:47:1a:0b:0b:46:09:dd:02:fc:de:cb: + 87:5f:d7:30:63:68:a1:ae:dc:32:a1:ba:be:fe:44: + ab:68:b6:a5:17:15:fd:bd:d5:a7:a7:9a:e4:44:33: + e9:88:8e:fc:ed:51:eb:93:71:4e:ad:01:e7:44:8e: + ab:2d:cb:a8:fe:01:49:48:f0:c0:dd:c7:68:d8:92: + fe:3d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 3C:D8:93:88:C2:C0:82:09:CC:01:99:06:93:20:E9:9E:70:09:63:4F + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 CRL Distribution Points: + URI:http://crl.comodoca.com/SecureCertificateServices.crl + URI:http://crl.comodo.net/SecureCertificateServices.crl + + Signature Algorithm: sha1WithRSAEncryption + 87:01:6d:23:1d:7e:5b:17:7d:c1:61:32:cf:8f:e7:f3:8a:94: + 59:66:e0:9e:28:a8:5e:d3:b7:f4:34:e6:aa:39:b2:97:16:c5: + 82:6f:32:a4:e9:8c:e7:af:fd:ef:c2:e8:b9:4b:aa:a3:f4:e6: + da:8d:65:21:fb:ba:80:eb:26:28:85:1a:fe:39:8c:de:5b:04: + 04:b4:54:f9:a3:67:9e:41:fa:09:52:cc:05:48:a8:c9:3f:21: + 04:1e:ce:48:6b:fc:85:e8:c2:7b:af:7f:b7:cc:f8:5f:3a:fd: + 35:c6:0d:ef:97:dc:4c:ab:11:e1:6b:cb:31:d1:6c:fb:48:80: + ab:dc:9c:37:b8:21:14:4b:0d:71:3d:ec:83:33:6e:d1:6e:32: + 16:ec:98:c7:16:8b:59:a6:34:ab:05:57:2d:93:f7:aa:13:cb: + d2:13:e2:b7:2e:3b:cd:6b:50:17:09:68:3e:b5:26:57:ee:b6: + e0:b6:dd:b9:29:80:79:7d:8f:a3:f0:a4:28:a4:15:c4:85:f4: + 27:d4:6b:bf:e5:5c:e4:65:02:76:54:b4:e3:37:66:24:d3:19: + 61:c8:52:10:e5:8b:37:9a:b9:a9:f9:1d:bf:ea:99:92:61:96: + ff:01:cd:a1:5f:0d:bc:71:bc:0e:ac:0b:1d:47:45:1d:c1:ec: + 7c:ec:fd:29 +MD5 Fingerprint=D3:D9:BD:AE:9F:AC:67:24:B3:C8:1B:52:E1:B9:A9:BD +-----BEGIN CERTIFICATE----- +MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEb +MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow +GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRp +ZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVow +fjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G +A1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAiBgNV +BAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEB +BQADggEPADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPM +cm3ye5drswfxdySRXyWP9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3S +HpR7LZQdqnXXs5jLrLxkU0C8j6ysNstcrbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996 +CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rCoznl2yY4rYsK7hljxxwk +3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3Vp6ea5EQz +6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNV +HQ4EFgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1Ud +EwEB/wQFMAMBAf8wgYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2Rv +Y2EuY29tL1NlY3VyZUNlcnRpZmljYXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRw +Oi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmww +DQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm4J4oqF7Tt/Q0 +5qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj +Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtI +gKvcnDe4IRRLDXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJ +aD61JlfutuC23bkpgHl9j6PwpCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDl +izeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1HRR3B7Hzs/Sk= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1 (0x1) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=Trusted Certificate Services + Validity + Not Before: Jan 1 00:00:00 2004 GMT + Not After : Dec 31 23:59:59 2028 GMT + Subject: C=GB, ST=Greater Manchester, L=Salford, O=Comodo CA Limited, CN=Trusted Certificate Services + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:df:71:6f:36:58:53:5a:f2:36:54:57:80:c4:74: + 08:20:ed:18:7f:2a:1d:e6:35:9a:1e:25:ac:9c:e5: + 96:7e:72:52:a0:15:42:db:59:dd:64:7a:1a:d0:b8: + 7b:dd:39:15:bc:55:48:c4:ed:3a:00:ea:31:11:ba: + f2:71:74:1a:67:b8:cf:33:cc:a8:31:af:a3:e3:d7: + 7f:bf:33:2d:4c:6a:3c:ec:8b:c3:92:d2:53:77:24: + 74:9c:07:6e:70:fc:bd:0b:5b:76:ba:5f:f2:ff:d7: + 37:4b:4a:60:78:f7:f0:fa:ca:70:b4:ea:59:aa:a3: + ce:48:2f:a9:c3:b2:0b:7e:17:72:16:0c:a6:07:0c: + 1b:38:cf:c9:62:b7:3f:a0:93:a5:87:41:f2:b7:70: + 40:77:d8:be:14:7c:e3:a8:c0:7a:8e:e9:63:6a:d1: + 0f:9a:c6:d2:f4:8b:3a:14:04:56:d4:ed:b8:cc:6e: + f5:fb:e2:2c:58:bd:7f:4f:6b:2b:f7:60:24:58:24: + ce:26:ef:34:91:3a:d5:e3:81:d0:b2:f0:04:02:d7: + 5b:b7:3e:92:ac:6b:12:8a:f9:e4:05:b0:3b:91:49: + 5c:b2:eb:53:ea:f8:9f:47:86:ee:bf:95:c0:c0:06: + 9f:d2:5b:5e:11:1b:f4:c7:04:35:29:d2:55:5c:e4: + ed:eb + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + C5:7B:58:BD:ED:DA:25:69:D2:F7:59:16:A8:B3:32:C0:7B:27:5B:F4 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 CRL Distribution Points: + URI:http://crl.comodoca.com/TrustedCertificateServices.crl + URI:http://crl.comodo.net/TrustedCertificateServices.crl + + Signature Algorithm: sha1WithRSAEncryption + c8:93:81:3b:89:b4:af:b8:84:12:4c:8d:d2:f0:db:70:ba:57: + 86:15:34:10:b9:2f:7f:1e:b0:a8:89:60:a1:8a:c2:77:0c:50: + 4a:9b:00:8b:d8:8b:f4:41:e2:d0:83:8a:4a:1c:14:06:b0:a3: + 68:05:70:31:30:a7:53:9b:0e:e9:4a:a0:58:69:67:0e:ae:9d: + f6:a5:2c:41:bf:3c:06:6b:e4:59:cc:6d:10:f1:96:6f:1f:df: + f4:04:02:a4:9f:45:3e:c8:d8:fa:36:46:44:50:3f:82:97:91: + 1f:28:db:18:11:8c:2a:e4:65:83:57:12:12:8c:17:3f:94:36: + fe:5d:b0:c0:04:77:13:b8:f4:15:d5:3f:38:cc:94:3a:55:d0: + ac:98:f5:ba:00:5f:e0:86:19:81:78:2f:28:c0:7e:d3:cc:42: + 0a:f5:ae:50:a0:d1:3e:c6:a1:71:ec:3f:a0:20:8c:66:3a:89: + b4:8e:d4:d8:b1:4d:25:47:ee:2f:88:c8:b5:e1:05:45:c0:be: + 14:71:de:7a:fd:8e:7b:7d:4d:08:96:a5:12:73:f0:2d:ca:37: + 27:74:12:27:4c:cb:b6:97:e9:d9:ae:08:6d:5a:39:40:dd:05: + 47:75:6a:5a:21:b3:a3:18:cf:4e:f7:2e:57:b7:98:70:5e:c8: + c4:78:b0:62 +MD5 Fingerprint=91:1B:3F:6E:CD:9E:AB:EE:07:FE:1F:71:D2:B3:61:27 +-----BEGIN CERTIFICATE----- +MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEb +MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow +GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0 +aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEwMDAwMDBaFw0yODEyMzEyMzU5NTla +MH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO +BgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUwIwYD +VQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0B +AQEFAAOCAQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWW +fnJSoBVC21ndZHoa0Lh73TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMt +TGo87IvDktJTdyR0nAducPy9C1t2ul/y/9c3S0pgePfw+spwtOpZqqPOSC+pw7IL +fhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6juljatEPmsbS9Is6FARW +1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsSivnkBbA7 +kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0G +A1UdDgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYD +VR0TAQH/BAUwAwEB/zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21v +ZG9jYS5jb20vVHJ1c3RlZENlcnRpZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRo +dHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENlcnRpZmljYXRlU2VydmljZXMu +Y3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8NtwuleGFTQQuS9/ +HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32 +pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxIS +jBc/lDb+XbDABHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+ +xqFx7D+gIIxmOom0jtTYsU0lR+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/Atyjcn +dBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O9y5Xt5hwXsjEeLBi +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA Chained CAs Certification Authority, CN=IPS CA Chained CAs Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 00:53:58 2001 GMT + Not After : Dec 27 00:53:58 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA Chained CAs Certification Authority, CN=IPS CA Chained CAs Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:dc:56:92:49:b2:94:20:bc:98:4f:50:eb:68:a4: + a7:49:0b:bf:d2:31:e8:c7:4f:c2:86:0b:fa:68:fd: + 43:5a:8a:f3:60:92:35:99:38:bb:4d:03:52:21:5b: + f0:37:99:35:e1:41:20:81:85:81:05:71:81:9d:b4: + 95:19:a9:5f:76:34:2e:63:37:35:57:8e:b4:1f:42: + 3f:15:5c:e1:7a:c1:5f:13:18:32:31:c9:ad:be:a3: + c7:83:66:1e:b9:9c:04:13:cb:69:c1:06:de:30:06: + bb:33:a3:b5:1f:f0:8f:6f:ce:ff:96:e8:54:be:66: + 80:ae:6b:db:41:84:36:a2:3d + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + A1:AD:31:B1:F9:3E:E1:17:A6:C8:AB:34:FC:52:87:09:1E:62:52:41 + X509v3 Authority Key Identifier: + keyid:A1:AD:31:B1:F9:3E:E1:17:A6:C8:AB:34:FC:52:87:09:1E:62:52:41 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA Chained CAs Certification Authority/CN=IPS CA Chained CAs Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + Chained CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002CAC.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationCAC.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalCAC.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyCAC.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002CAC.crl + URI:http://wwwback.ips.es/ips2002/ips2002CAC.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 44:72:30:9d:56:58:a2:41:1b:28:b7:95:e1:a6:1a:95:5f:a7: + 78:40:2b:ef:db:96:4a:fc:4c:71:63:d9:73:95:bd:02:e2:a2: + 06:c7:be:97:2a:93:80:34:86:03:fa:dc:d8:3d:1e:07:cd:1e: + 73:43:24:60:f5:1d:61:dc:dc:96:a0:bc:fb:1d:e3:e7:12:00: + 27:33:02:c0:c0:2b:53:3d:d8:6b:03:81:a3:db:d6:93:95:20: + ef:d3:96:7e:26:90:89:9c:26:9b:cd:6f:66:ab:ed:03:22:44: + 38:cc:59:bd:9f:db:f6:07:a2:01:7f:26:c4:63:f5:25:42:5e: + 62:bd +MD5 Fingerprint=8D:72:51:DB:A0:3A:CF:20:77:DF:F2:65:06:5E:DF:EF +-----BEGIN CERTIFICATE----- +MIIH9zCCB2CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCARwxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjEzMDEGA1UECxMq +SVBTIENBIENoYWluZWQgQ0FzIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MTMwMQYD +VQQDEypJUFMgQ0EgQ2hhaW5lZCBDQXMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx +HjAcBgkqhkiG9w0BCQEWD2lwc0BtYWlsLmlwcy5lczAeFw0wMTEyMjkwMDUzNTha +Fw0yNTEyMjcwMDUzNThaMIIBHDELMAkGA1UEBhMCRVMxEjAQBgNVBAgTCUJhcmNl +bG9uYTESMBAGA1UEBxMJQmFyY2Vsb25hMS4wLAYDVQQKEyVJUFMgSW50ZXJuZXQg +cHVibGlzaGluZyBTZXJ2aWNlcyBzLmwuMSswKQYDVQQKFCJpcHNAbWFpbC5pcHMu +ZXMgQy5JLkYuICBCLTYwOTI5NDUyMTMwMQYDVQQLEypJUFMgQ0EgQ2hhaW5lZCBD +QXMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxMzAxBgNVBAMTKklQUyBDQSBDaGFp +bmVkIENBcyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEeMBwGCSqGSIb3DQEJARYP +aXBzQG1haWwuaXBzLmVzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcVpJJ +spQgvJhPUOtopKdJC7/SMejHT8KGC/po/UNaivNgkjWZOLtNA1IhW/A3mTXhQSCB +hYEFcYGdtJUZqV92NC5jNzVXjrQfQj8VXOF6wV8TGDIxya2+o8eDZh65nAQTy2nB +Bt4wBrszo7Uf8I9vzv+W6FS+ZoCua9tBhDaiPQIDAQABo4IEQzCCBD8wHQYDVR0O +BBYEFKGtMbH5PuEXpsirNPxShwkeYlJBMIIBTgYDVR0jBIIBRTCCAUGAFKGtMbH5 +PuEXpsirNPxShwkeYlJBoYIBJKSCASAwggEcMQswCQYDVQQGEwJFUzESMBAGA1UE +CBMJQmFyY2Vsb25hMRIwEAYDVQQHEwlCYXJjZWxvbmExLjAsBgNVBAoTJUlQUyBJ +bnRlcm5ldCBwdWJsaXNoaW5nIFNlcnZpY2VzIHMubC4xKzApBgNVBAoUImlwc0Bt +YWlsLmlwcy5lcyBDLkkuRi4gIEItNjA5Mjk0NTIxMzAxBgNVBAsTKklQUyBDQSBD +aGFpbmVkIENBcyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEzMDEGA1UEAxMqSVBT +IENBIENoYWluZWQgQ0FzIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MR4wHAYJKoZI +hvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOCAQAwDAYDVR0TBAUwAwEB/zAMBgNVHQ8E +BQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUFBwMBBggrBgEFBQcDAgYIKwYBBQUHAwMG +CCsGAQUFBwMEBggrBgEFBQcDCAYKKwYBBAGCNwIBFQYKKwYBBAGCNwIBFgYKKwYB +BAGCNwoDAQYKKwYBBAGCNwoDBDARBglghkgBhvhCAQEEBAMCAAcwGgYDVR0RBBMw +EYEPaXBzQG1haWwuaXBzLmVzMBoGA1UdEgQTMBGBD2lwc0BtYWlsLmlwcy5lczBC +BglghkgBhvhCAQ0ENRYzQ2hhaW5lZCBDQSBDZXJ0aWZpY2F0ZSBpc3N1ZWQgYnkg +aHR0cDovL3d3dy5pcHMuZXMvMCkGCWCGSAGG+EIBAgQcFhpodHRwOi8vd3d3Lmlw +cy5lcy9pcHMyMDAyLzA3BglghkgBhvhCAQQEKhYoaHR0cDovL3d3dy5pcHMuZXMv +aXBzMjAwMi9pcHMyMDAyQ0FDLmNybDA8BglghkgBhvhCAQMELxYtaHR0cDovL3d3 +dy5pcHMuZXMvaXBzMjAwMi9yZXZvY2F0aW9uQ0FDLmh0bWw/MDkGCWCGSAGG+EIB +BwQsFipodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL3JlbmV3YWxDQUMuaHRtbD8w +NwYJYIZIAYb4QgEIBCoWKGh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvcG9saWN5 +Q0FDLmh0bWwwbQYDVR0fBGYwZDAuoCygKoYoaHR0cDovL3d3dy5pcHMuZXMvaXBz +MjAwMi9pcHMyMDAyQ0FDLmNybDAyoDCgLoYsaHR0cDovL3d3d2JhY2suaXBzLmVz +L2lwczIwMDIvaXBzMjAwMkNBQy5jcmwwLwYIKwYBBQUHAQEEIzAhMB8GCCsGAQUF +BzABhhNodHRwOi8vb2NzcC5pcHMuZXMvMA0GCSqGSIb3DQEBBQUAA4GBAERyMJ1W +WKJBGyi3leGmGpVfp3hAK+/blkr8THFj2XOVvQLiogbHvpcqk4A0hgP63Ng9HgfN +HnNDJGD1HWHc3JagvPsd4+cSACczAsDAK1M92GsDgaPb1pOVIO/Tln4mkImcJpvN +b2ar7QMiRDjMWb2f2/YHogF/JsRj9SVCXmK9 +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASE1 Certification Authority, CN=IPS CA CLASE1 Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 00:59:38 2001 GMT + Not After : Dec 27 00:59:38 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASE1 Certification Authority, CN=IPS CA CLASE1 Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:e0:51:27:a7:0b:dd:af:d1:b9:43:5b:82:37:45: + 56:72:ef:9a:b6:c2:12:ef:2c:12:cc:76:f9:06:59: + af:5d:21:d4:d2:5a:b8:a0:d4:f3:6a:fd:ca:69:8d: + 66:48:f7:74:e6:ee:36:bd:e8:96:91:75:a6:71:28: + ca:e7:22:12:32:69:b0:3e:1e:6b:f4:50:52:62:62: + fd:63:3b:7d:7e:ec:ee:38:ea:62:f4:6c:a8:71:8d: + e1:e9:8b:c9:3f:c6:b5:cd:94:42:6f:dd:82:45:3c: + e8:df:09:e8:ef:0a:55:a9:56:47:61:4c:49:64:73: + 10:28:3f:ca:bf:09:ff:c6:2f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + EB:B3:19:79:F3:C1:A5:1C:AC:DC:BA:1F:66:A2:B2:9B:69:D0:78:08 + X509v3 Authority Key Identifier: + keyid:EB:B3:19:79:F3:C1:A5:1C:AC:DC:BA:1F:66:A2:B2:9B:69:D0:78:08 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA CLASE1 Certification Authority/CN=IPS CA CLASE1 Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + CLASE1 CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002CLASE1.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationCLASE1.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalCLASE1.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyCLASE1.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002CLASE1.crl + URI:http://wwwback.ips.es/ips2002/ips2002CLASE1.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 2b:d0:eb:fd:da:c8:ca:59:6a:da:d3:cc:32:2e:c9:54:1b:8a: + 62:7e:15:2d:e9:d9:31:d3:2e:f4:27:23:ff:5b:ab:c5:4a:b6: + 72:40:ae:53:74:f4:bc:05:b4:c6:d9:c8:c9:77:fb:b7:f9:34: + 7f:78:00:f8:d6:a4:e4:52:3f:2c:4a:63:57:81:75:5a:8e:e8: + 8c:fb:02:c0:94:c6:29:ba:b3:dc:1c:e8:b2:af:d2:2e:62:5b: + 1a:a9:8e:0e:cc:c5:57:45:51:14:e9:4e:1c:88:a5:91:f4:a3: + f7:8e:51:c8:a9:be:86:33:3e:e6:2f:48:6e:af:54:90:4e:ad: + b1:25 +MD5 Fingerprint=84:90:1D:95:30:49:56:FC:41:81:F0:45:D7:76:C4:6B +-----BEGIN CERTIFICATE----- +MIIH6jCCB1OgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCARIxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjEuMCwGA1UECxMl +SVBTIENBIENMQVNFMSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEuMCwGA1UEAxMl +SVBTIENBIENMQVNFMSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEeMBwGCSqGSIb3 +DQEJARYPaXBzQG1haWwuaXBzLmVzMB4XDTAxMTIyOTAwNTkzOFoXDTI1MTIyNzAw +NTkzOFowggESMQswCQYDVQQGEwJFUzESMBAGA1UECBMJQmFyY2Vsb25hMRIwEAYD +VQQHEwlCYXJjZWxvbmExLjAsBgNVBAoTJUlQUyBJbnRlcm5ldCBwdWJsaXNoaW5n +IFNlcnZpY2VzIHMubC4xKzApBgNVBAoUImlwc0BtYWlsLmlwcy5lcyBDLkkuRi4g +IEItNjA5Mjk0NTIxLjAsBgNVBAsTJUlQUyBDQSBDTEFTRTEgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkxLjAsBgNVBAMTJUlQUyBDQSBDTEFTRTEgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkxHjAcBgkqhkiG9w0BCQEWD2lwc0BtYWlsLmlwcy5lczCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA4FEnpwvdr9G5Q1uCN0VWcu+atsIS7ywS +zHb5BlmvXSHU0lq4oNTzav3KaY1mSPd05u42veiWkXWmcSjK5yISMmmwPh5r9FBS +YmL9Yzt9fuzuOOpi9GyocY3h6YvJP8a1zZRCb92CRTzo3wno7wpVqVZHYUxJZHMQ +KD/Kvwn/xi8CAwEAAaOCBEowggRGMB0GA1UdDgQWBBTrsxl588GlHKzcuh9morKb +adB4CDCCAUQGA1UdIwSCATswggE3gBTrsxl588GlHKzcuh9morKbadB4CKGCARqk +ggEWMIIBEjELMAkGA1UEBhMCRVMxEjAQBgNVBAgTCUJhcmNlbG9uYTESMBAGA1UE +BxMJQmFyY2Vsb25hMS4wLAYDVQQKEyVJUFMgSW50ZXJuZXQgcHVibGlzaGluZyBT +ZXJ2aWNlcyBzLmwuMSswKQYDVQQKFCJpcHNAbWFpbC5pcHMuZXMgQy5JLkYuICBC +LTYwOTI5NDUyMS4wLAYDVQQLEyVJUFMgQ0EgQ0xBU0UxIENlcnRpZmljYXRpb24g +QXV0aG9yaXR5MS4wLAYDVQQDEyVJUFMgQ0EgQ0xBU0UxIENlcnRpZmljYXRpb24g +QXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOCAQAwDAYD +VR0TBAUwAwEB/zAMBgNVHQ8EBQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUFBwMBBggr +BgEFBQcDAgYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYBBAGCNwIB +FQYKKwYBBAGCNwIBFgYKKwYBBAGCNwoDAQYKKwYBBAGCNwoDBDARBglghkgBhvhC +AQEEBAMCAAcwGgYDVR0RBBMwEYEPaXBzQG1haWwuaXBzLmVzMBoGA1UdEgQTMBGB +D2lwc0BtYWlsLmlwcy5lczBBBglghkgBhvhCAQ0ENBYyQ0xBU0UxIENBIENlcnRp +ZmljYXRlIGlzc3VlZCBieSBodHRwOi8vd3d3Lmlwcy5lcy8wKQYJYIZIAYb4QgEC +BBwWGmh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvMDoGCWCGSAGG+EIBBAQtFito +dHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL2lwczIwMDJDTEFTRTEuY3JsMD8GCWCG +SAGG+EIBAwQyFjBodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL3Jldm9jYXRpb25D +TEFTRTEuaHRtbD8wPAYJYIZIAYb4QgEHBC8WLWh0dHA6Ly93d3cuaXBzLmVzL2lw +czIwMDIvcmVuZXdhbENMQVNFMS5odG1sPzA6BglghkgBhvhCAQgELRYraHR0cDov +L3d3dy5pcHMuZXMvaXBzMjAwMi9wb2xpY3lDTEFTRTEuaHRtbDBzBgNVHR8EbDBq +MDGgL6AthitodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL2lwczIwMDJDTEFTRTEu +Y3JsMDWgM6Axhi9odHRwOi8vd3d3YmFjay5pcHMuZXMvaXBzMjAwMi9pcHMyMDAy +Q0xBU0UxLmNybDAvBggrBgEFBQcBAQQjMCEwHwYIKwYBBQUHMAGGE2h0dHA6Ly9v +Y3NwLmlwcy5lcy8wDQYJKoZIhvcNAQEFBQADgYEAK9Dr/drIyllq2tPMMi7JVBuK +Yn4VLenZMdMu9Ccj/1urxUq2ckCuU3T0vAW0xtnIyXf7t/k0f3gA+Nak5FI/LEpj +V4F1Wo7ojPsCwJTGKbqz3Bzosq/SLmJbGqmODszFV0VRFOlOHIilkfSj945RyKm+ +hjM+5i9Ibq9UkE6tsSU= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASE3 Certification Authority, CN=IPS CA CLASE3 Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 01:01:44 2001 GMT + Not After : Dec 27 01:01:44 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASE3 Certification Authority, CN=IPS CA CLASE3 Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ab:17:fe:0e:b0:c6:68:1b:53:f0:52:be:9f:fa: + da:fa:8b:13:04:bb:01:8f:32:d9:1f:8f:4d:ce:36: + 98:da:e4:00:44:8c:28:d8:13:44:2a:a4:6b:4e:17: + 24:42:9c:d3:88:a4:41:82:d6:23:fb:8b:c9:86:e5: + b9:a9:82:05:dc:f1:de:1f:e0:0c:99:55:98:f2:38: + ec:6c:9d:20:03:c0:ef:aa:a3:c6:64:04:51:2d:78: + 0d:a3:d2:a8:3a:d6:24:4c:e9:96:7a:18:ac:13:23: + 22:1b:7c:e8:31:11:b3:5f:09:aa:30:70:71:46:25: + 6b:49:71:80:2b:95:01:b2:1f + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + B8:93:FF:2E:CB:DC:2C:8E:A2:E7:7A:FE:36:51:21:A3:98:5B:0C:34 + X509v3 Authority Key Identifier: + keyid:B8:93:FF:2E:CB:DC:2C:8E:A2:E7:7A:FE:36:51:21:A3:98:5B:0C:34 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA CLASE3 Certification Authority/CN=IPS CA CLASE3 Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + CLASE3 CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002CLASE3.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationCLASE3.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalCLASE3.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyCLASE3.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002CLASE3.crl + URI:http://wwwback.ips.es/ips2002/ips2002CLASE3.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 17:65:5c:99:95:43:03:27:af:26:e5:eb:d0:b3:17:23:f7:43: + aa:c7:f0:7d:ec:0f:c6:a9:ae:ae:96:0f:76:29:1c:e2:06:2d: + 7e:26:c5:3c:fa:a1:c1:81:ce:53:b0:42:d1:97:57:1a:17:7e: + a4:51:61:c6:ee:e9:5e:ef:05:ba:eb:bd:0f:a7:92:6f:d8:a3: + 06:68:29:8e:79:f5:ff:bf:f9:a7:af:e4:b1:ce:c2:d1:80:42: + 27:05:04:34:f8:c3:7f:16:78:23:0c:07:24:f2:46:47:ad:3b: + 54:d0:af:d5:31:b2:af:7d:c8:ea:e9:d4:56:d9:0e:13:b2:c5: + 45:50 +MD5 Fingerprint=42:76:97:68:CF:A6:B4:38:24:AA:A1:1B:F2:67:DE:CA +-----BEGIN CERTIFICATE----- +MIIH6jCCB1OgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCARIxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjEuMCwGA1UECxMl +SVBTIENBIENMQVNFMyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEuMCwGA1UEAxMl +SVBTIENBIENMQVNFMyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEeMBwGCSqGSIb3 +DQEJARYPaXBzQG1haWwuaXBzLmVzMB4XDTAxMTIyOTAxMDE0NFoXDTI1MTIyNzAx +MDE0NFowggESMQswCQYDVQQGEwJFUzESMBAGA1UECBMJQmFyY2Vsb25hMRIwEAYD +VQQHEwlCYXJjZWxvbmExLjAsBgNVBAoTJUlQUyBJbnRlcm5ldCBwdWJsaXNoaW5n +IFNlcnZpY2VzIHMubC4xKzApBgNVBAoUImlwc0BtYWlsLmlwcy5lcyBDLkkuRi4g +IEItNjA5Mjk0NTIxLjAsBgNVBAsTJUlQUyBDQSBDTEFTRTMgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkxLjAsBgNVBAMTJUlQUyBDQSBDTEFTRTMgQ2VydGlmaWNhdGlv +biBBdXRob3JpdHkxHjAcBgkqhkiG9w0BCQEWD2lwc0BtYWlsLmlwcy5lczCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAqxf+DrDGaBtT8FK+n/ra+osTBLsBjzLZ +H49NzjaY2uQARIwo2BNEKqRrThckQpzTiKRBgtYj+4vJhuW5qYIF3PHeH+AMmVWY +8jjsbJ0gA8DvqqPGZARRLXgNo9KoOtYkTOmWehisEyMiG3zoMRGzXwmqMHBxRiVr +SXGAK5UBsh8CAwEAAaOCBEowggRGMB0GA1UdDgQWBBS4k/8uy9wsjqLnev42USGj +mFsMNDCCAUQGA1UdIwSCATswggE3gBS4k/8uy9wsjqLnev42USGjmFsMNKGCARqk +ggEWMIIBEjELMAkGA1UEBhMCRVMxEjAQBgNVBAgTCUJhcmNlbG9uYTESMBAGA1UE +BxMJQmFyY2Vsb25hMS4wLAYDVQQKEyVJUFMgSW50ZXJuZXQgcHVibGlzaGluZyBT +ZXJ2aWNlcyBzLmwuMSswKQYDVQQKFCJpcHNAbWFpbC5pcHMuZXMgQy5JLkYuICBC +LTYwOTI5NDUyMS4wLAYDVQQLEyVJUFMgQ0EgQ0xBU0UzIENlcnRpZmljYXRpb24g +QXV0aG9yaXR5MS4wLAYDVQQDEyVJUFMgQ0EgQ0xBU0UzIENlcnRpZmljYXRpb24g +QXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOCAQAwDAYD +VR0TBAUwAwEB/zAMBgNVHQ8EBQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUFBwMBBggr +BgEFBQcDAgYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYBBAGCNwIB +FQYKKwYBBAGCNwIBFgYKKwYBBAGCNwoDAQYKKwYBBAGCNwoDBDARBglghkgBhvhC +AQEEBAMCAAcwGgYDVR0RBBMwEYEPaXBzQG1haWwuaXBzLmVzMBoGA1UdEgQTMBGB +D2lwc0BtYWlsLmlwcy5lczBBBglghkgBhvhCAQ0ENBYyQ0xBU0UzIENBIENlcnRp +ZmljYXRlIGlzc3VlZCBieSBodHRwOi8vd3d3Lmlwcy5lcy8wKQYJYIZIAYb4QgEC +BBwWGmh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvMDoGCWCGSAGG+EIBBAQtFito +dHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL2lwczIwMDJDTEFTRTMuY3JsMD8GCWCG +SAGG+EIBAwQyFjBodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL3Jldm9jYXRpb25D +TEFTRTMuaHRtbD8wPAYJYIZIAYb4QgEHBC8WLWh0dHA6Ly93d3cuaXBzLmVzL2lw +czIwMDIvcmVuZXdhbENMQVNFMy5odG1sPzA6BglghkgBhvhCAQgELRYraHR0cDov +L3d3dy5pcHMuZXMvaXBzMjAwMi9wb2xpY3lDTEFTRTMuaHRtbDBzBgNVHR8EbDBq +MDGgL6AthitodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL2lwczIwMDJDTEFTRTMu +Y3JsMDWgM6Axhi9odHRwOi8vd3d3YmFjay5pcHMuZXMvaXBzMjAwMi9pcHMyMDAy +Q0xBU0UzLmNybDAvBggrBgEFBQcBAQQjMCEwHwYIKwYBBQUHMAGGE2h0dHA6Ly9v +Y3NwLmlwcy5lcy8wDQYJKoZIhvcNAQEFBQADgYEAF2VcmZVDAyevJuXr0LMXI/dD +qsfwfewPxqmurpYPdikc4gYtfibFPPqhwYHOU7BC0ZdXGhd+pFFhxu7pXu8Fuuu9 +D6eSb9ijBmgpjnn1/7/5p6/ksc7C0YBCJwUENPjDfxZ4IwwHJPJGR607VNCv1TGy +r33I6unUVtkOE7LFRVA= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASEA1 Certification Authority, CN=IPS CA CLASEA1 Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 01:05:32 2001 GMT + Not After : Dec 27 01:05:32 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASEA1 Certification Authority, CN=IPS CA CLASEA1 Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:bb:30:d7:dc:d0:54:bd:35:4e:9f:c5:4c:82:ea: + d1:50:3c:47:98:fc:9b:69:9d:77:cd:6e:e0:3f:ee: + eb:32:5f:5f:9f:d2:d0:79:e5:95:73:44:21:32:e0: + 0a:db:9d:d7:ce:8d:ab:52:8b:2b:78:e0:9b:5b:7d: + f4:fd:6d:09:e5:ae:e1:6c:1d:07:23:a0:17:d1:f9: + 7d:a8:46:46:91:22:a8:b2:69:c6:ad:f7:f5:f5:94: + a1:30:94:bd:00:cc:44:7f:ee:c4:9e:c9:c1:e6:8f: + 0a:36:c1:fd:24:3d:01:a0:f5:7b:e2:7c:78:66:43: + 8b:4f:59:f2:9b:d9:fa:49:b3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 67:26:96:E7:A1:BF:D8:B5:03:9D:FE:3B:DC:FE:F2:8A:E6:15:DD:30 + X509v3 Authority Key Identifier: + keyid:67:26:96:E7:A1:BF:D8:B5:03:9D:FE:3B:DC:FE:F2:8A:E6:15:DD:30 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA CLASEA1 Certification Authority/CN=IPS CA CLASEA1 Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + CLASEA1 CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002CLASEA1.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationCLASEA1.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalCLASEA1.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyCLASEA1.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002CLASEA1.crl + URI:http://wwwback.ips.es/ips2002/ips2002CLASEA1.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 7e:ba:8a:ac:80:00:84:15:0a:d5:98:51:0c:64:c5:9c:02:58: + 83:66:ca:ad:1e:07:cd:7e:6a:da:80:07:df:03:34:4a:1c:93: + c4:4b:58:20:35:36:71:ed:a2:0a:35:12:a5:a6:65:a7:85:69: + 0a:0e:e3:61:ee:ea:be:28:93:33:d5:ec:e8:be:c4:db:5f:7f: + a8:f9:63:31:c8:6b:96:e2:29:c2:5b:a0:e7:97:36:9d:77:5e: + 31:6b:fe:d3:a7:db:2a:db:db:96:8b:1f:66:de:b6:03:c0:2b: + b3:78:d6:55:07:e5:8f:39:50:de:07:23:72:e6:bd:20:14:4b: + b4:86 +MD5 Fingerprint=0C:F8:9E:17:FC:D4:03:BD:E6:8D:9B:3C:05:87:FE:84 +-----BEGIN CERTIFICATE----- +MIIH9zCCB2CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCARQxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjEvMC0GA1UECxMm +SVBTIENBIENMQVNFQTEgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxLzAtBgNVBAMT +JklQUyBDQSBDTEFTRUExIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MR4wHAYJKoZI +hvcNAQkBFg9pcHNAbWFpbC5pcHMuZXMwHhcNMDExMjI5MDEwNTMyWhcNMjUxMjI3 +MDEwNTMyWjCCARQxCzAJBgNVBAYTAkVTMRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQ +BgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UEChMlSVBTIEludGVybmV0IHB1Ymxpc2hp +bmcgU2VydmljZXMgcy5sLjErMCkGA1UEChQiaXBzQG1haWwuaXBzLmVzIEMuSS5G +LiAgQi02MDkyOTQ1MjEvMC0GA1UECxMmSVBTIENBIENMQVNFQTEgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkxLzAtBgNVBAMTJklQUyBDQSBDTEFTRUExIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXMw +gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALsw19zQVL01Tp/FTILq0VA8R5j8 +m2mdd81u4D/u6zJfX5/S0HnllXNEITLgCtud186Nq1KLK3jgm1t99P1tCeWu4Wwd +ByOgF9H5fahGRpEiqLJpxq339fWUoTCUvQDMRH/uxJ7JweaPCjbB/SQ9AaD1e+J8 +eGZDi09Z8pvZ+kmzAgMBAAGjggRTMIIETzAdBgNVHQ4EFgQUZyaW56G/2LUDnf47 +3P7yiuYV3TAwggFGBgNVHSMEggE9MIIBOYAUZyaW56G/2LUDnf473P7yiuYV3TCh +ggEcpIIBGDCCARQxCzAJBgNVBAYTAkVTMRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQ +BgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UEChMlSVBTIEludGVybmV0IHB1Ymxpc2hp +bmcgU2VydmljZXMgcy5sLjErMCkGA1UEChQiaXBzQG1haWwuaXBzLmVzIEMuSS5G +LiAgQi02MDkyOTQ1MjEvMC0GA1UECxMmSVBTIENBIENMQVNFQTEgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkxLzAtBgNVBAMTJklQUyBDQSBDTEFTRUExIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOC +AQAwDAYDVR0TBAUwAwEB/zAMBgNVHQ8EBQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUF +BwMBBggrBgEFBQcDAgYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYB +BAGCNwIBFQYKKwYBBAGCNwIBFgYKKwYBBAGCNwoDAQYKKwYBBAGCNwoDBDARBglg +hkgBhvhCAQEEBAMCAAcwGgYDVR0RBBMwEYEPaXBzQG1haWwuaXBzLmVzMBoGA1Ud +EgQTMBGBD2lwc0BtYWlsLmlwcy5lczBCBglghkgBhvhCAQ0ENRYzQ0xBU0VBMSBD +QSBDZXJ0aWZpY2F0ZSBpc3N1ZWQgYnkgaHR0cDovL3d3dy5pcHMuZXMvMCkGCWCG +SAGG+EIBAgQcFhpodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyLzA7BglghkgBhvhC +AQQELhYsaHR0cDovL3d3dy5pcHMuZXMvaXBzMjAwMi9pcHMyMDAyQ0xBU0VBMS5j +cmwwQAYJYIZIAYb4QgEDBDMWMWh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvcmV2 +b2NhdGlvbkNMQVNFQTEuaHRtbD8wPQYJYIZIAYb4QgEHBDAWLmh0dHA6Ly93d3cu +aXBzLmVzL2lwczIwMDIvcmVuZXdhbENMQVNFQTEuaHRtbD8wOwYJYIZIAYb4QgEI +BC4WLGh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvcG9saWN5Q0xBU0VBMS5odG1s +MHUGA1UdHwRuMGwwMqAwoC6GLGh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvaXBz +MjAwMkNMQVNFQTEuY3JsMDagNKAyhjBodHRwOi8vd3d3YmFjay5pcHMuZXMvaXBz +MjAwMi9pcHMyMDAyQ0xBU0VBMS5jcmwwLwYIKwYBBQUHAQEEIzAhMB8GCCsGAQUF +BzABhhNodHRwOi8vb2NzcC5pcHMuZXMvMA0GCSqGSIb3DQEBBQUAA4GBAH66iqyA +AIQVCtWYUQxkxZwCWINmyq0eB81+atqAB98DNEock8RLWCA1NnHtogo1EqWmZaeF +aQoO42Hu6r4okzPV7Oi+xNtff6j5YzHIa5biKcJboOeXNp13XjFr/tOn2yrb25aL +H2betgPAK7N41lUH5Y85UN4HI3LmvSAUS7SG +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASEA3 Certification Authority, CN=IPS CA CLASEA3 Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 01:07:50 2001 GMT + Not After : Dec 27 01:07:50 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA CLASEA3 Certification Authority, CN=IPS CA CLASEA3 Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ee:80:00:f6:1a:64:2e:ad:6a:c8:83:b1:8b:a7: + ee:8f:d9:b6:db:cd:1b:bb:86:06:22:76:33:0c:12: + 6d:48:56:61:d2:dc:82:25:62:2f:9f:d2:69:30:65: + 03:42:23:58:bc:47:dc:6b:d6:75:5d:17:3c:e1:ff: + f2:58:67:79:a0:c1:81:b1:d4:56:a2:f2:8d:11:99: + fd:f6:7d:f1:c7:c4:5e:02:2a:9a:e2:4a:b5:13:8a: + 00:fd:8c:77:86:e6:d7:94:f5:20:75:2e:0e:4c:bf: + 74:c4:3f:81:3e:83:b4:a3:38:36:29:e7:e8:2a:f5: + 8c:88:41:aa:80:a6:e3:6c:ef + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 1E:9F:57:50:47:B6:61:93:39:D3:2C:FC:DA:5D:3D:05:75:B7:99:02 + X509v3 Authority Key Identifier: + keyid:1E:9F:57:50:47:B6:61:93:39:D3:2C:FC:DA:5D:3D:05:75:B7:99:02 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA CLASEA3 Certification Authority/CN=IPS CA CLASEA3 Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + CLASEA3 CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002CLASEA3.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationCLASEA3.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalCLASEA3.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyCLASEA3.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002CLASEA3.crl + URI:http://wwwback.ips.es/ips2002/ips2002CLASEA3.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 4a:3d:20:47:1a:da:89:f4:7a:2b:31:79:ec:01:c0:cc:01:f5: + d6:c1:fc:c8:c3:f3:50:02:51:90:58:2a:9f:e7:35:09:5b:30: + 0a:81:00:25:47:af:d4:0f:0e:9e:60:26:a8:95:a7:83:08:df: + 2d:ac:e9:0e:f7:9c:c8:9f:cb:93:45:f1:ba:6a:c6:67:51:4a: + 69:4f:6b:fe:7d:0b:2f:52:29:c2:50:ad:24:44:ed:23:b3:48: + cb:44:40:c1:03:95:0c:0a:78:06:12:01:f5:91:31:2d:49:8d: + bb:3f:45:4e:2c:e0:e8:cd:b5:c9:14:15:0c:e3:07:83:9b:26: + 75:ef +MD5 Fingerprint=06:F9:EB:EC:CC:56:9D:88:BA:90:F5:BA:B0:1A:E0:02 +-----BEGIN CERTIFICATE----- +MIIH9zCCB2CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCARQxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjEvMC0GA1UECxMm +SVBTIENBIENMQVNFQTMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxLzAtBgNVBAMT +JklQUyBDQSBDTEFTRUEzIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MR4wHAYJKoZI +hvcNAQkBFg9pcHNAbWFpbC5pcHMuZXMwHhcNMDExMjI5MDEwNzUwWhcNMjUxMjI3 +MDEwNzUwWjCCARQxCzAJBgNVBAYTAkVTMRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQ +BgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UEChMlSVBTIEludGVybmV0IHB1Ymxpc2hp +bmcgU2VydmljZXMgcy5sLjErMCkGA1UEChQiaXBzQG1haWwuaXBzLmVzIEMuSS5G +LiAgQi02MDkyOTQ1MjEvMC0GA1UECxMmSVBTIENBIENMQVNFQTMgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkxLzAtBgNVBAMTJklQUyBDQSBDTEFTRUEzIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXMw +gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAO6AAPYaZC6tasiDsYun7o/ZttvN +G7uGBiJ2MwwSbUhWYdLcgiViL5/SaTBlA0IjWLxH3GvWdV0XPOH/8lhneaDBgbHU +VqLyjRGZ/fZ98cfEXgIqmuJKtROKAP2Md4bm15T1IHUuDky/dMQ/gT6DtKM4Ninn +6Cr1jIhBqoCm42zvAgMBAAGjggRTMIIETzAdBgNVHQ4EFgQUHp9XUEe2YZM50yz8 +2l09BXW3mQIwggFGBgNVHSMEggE9MIIBOYAUHp9XUEe2YZM50yz82l09BXW3mQKh +ggEcpIIBGDCCARQxCzAJBgNVBAYTAkVTMRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQ +BgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UEChMlSVBTIEludGVybmV0IHB1Ymxpc2hp +bmcgU2VydmljZXMgcy5sLjErMCkGA1UEChQiaXBzQG1haWwuaXBzLmVzIEMuSS5G +LiAgQi02MDkyOTQ1MjEvMC0GA1UECxMmSVBTIENBIENMQVNFQTMgQ2VydGlmaWNh +dGlvbiBBdXRob3JpdHkxLzAtBgNVBAMTJklQUyBDQSBDTEFTRUEzIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MR4wHAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOC +AQAwDAYDVR0TBAUwAwEB/zAMBgNVHQ8EBQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUF +BwMBBggrBgEFBQcDAgYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYB +BAGCNwIBFQYKKwYBBAGCNwIBFgYKKwYBBAGCNwoDAQYKKwYBBAGCNwoDBDARBglg +hkgBhvhCAQEEBAMCAAcwGgYDVR0RBBMwEYEPaXBzQG1haWwuaXBzLmVzMBoGA1Ud +EgQTMBGBD2lwc0BtYWlsLmlwcy5lczBCBglghkgBhvhCAQ0ENRYzQ0xBU0VBMyBD +QSBDZXJ0aWZpY2F0ZSBpc3N1ZWQgYnkgaHR0cDovL3d3dy5pcHMuZXMvMCkGCWCG +SAGG+EIBAgQcFhpodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyLzA7BglghkgBhvhC +AQQELhYsaHR0cDovL3d3dy5pcHMuZXMvaXBzMjAwMi9pcHMyMDAyQ0xBU0VBMy5j +cmwwQAYJYIZIAYb4QgEDBDMWMWh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvcmV2 +b2NhdGlvbkNMQVNFQTMuaHRtbD8wPQYJYIZIAYb4QgEHBDAWLmh0dHA6Ly93d3cu +aXBzLmVzL2lwczIwMDIvcmVuZXdhbENMQVNFQTMuaHRtbD8wOwYJYIZIAYb4QgEI +BC4WLGh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvcG9saWN5Q0xBU0VBMy5odG1s +MHUGA1UdHwRuMGwwMqAwoC6GLGh0dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvaXBz +MjAwMkNMQVNFQTMuY3JsMDagNKAyhjBodHRwOi8vd3d3YmFjay5pcHMuZXMvaXBz +MjAwMi9pcHMyMDAyQ0xBU0VBMy5jcmwwLwYIKwYBBQUHAQEEIzAhMB8GCCsGAQUF +BzABhhNodHRwOi8vb2NzcC5pcHMuZXMvMA0GCSqGSIb3DQEBBQUAA4GBAEo9IEca +2on0eisxeewBwMwB9dbB/MjD81ACUZBYKp/nNQlbMAqBACVHr9QPDp5gJqiVp4MI +3y2s6Q73nMify5NF8bpqxmdRSmlPa/59Cy9SKcJQrSRE7SOzSMtEQMEDlQwKeAYS +AfWRMS1Jjbs/RU4s4OjNtckUFQzjB4ObJnXv +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 1 (0x0) + Serial Number: 0 (0x0) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=ES, ST=BARCELONA, L=BARCELONA, O=IPS Seguridad CA, OU=Certificaciones, CN=IPS SERVIDORES/emailAddress=ips@mail.ips.es + Validity + Not Before: Jan 1 23:21:07 1998 GMT + Not After : Dec 29 23:21:07 2009 GMT + Subject: C=ES, ST=BARCELONA, L=BARCELONA, O=IPS Seguridad CA, OU=Certificaciones, CN=IPS SERVIDORES/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:ac:4f:52:74:9f:39:ea:8e:dc:25:c4:bc:98:5d: + 98:64:24:09:3c:21:b3:cc:19:b5:8e:94:8e:87:d1: + f8:37:3e:a1:c8:2d:58:a4:80:35:5b:a1:75:6c:1d: + 45:0c:1f:61:63:6a:5e:6f:9b:0a:4c:c1:c8:b8:61: + 23:35:81:ff:fe:ac:78:70:2d:68:e1:3a:07:98:95: + 02:54:dd:cd:23:b7:80:53:d7:c8:37:45:72:06:24: + 12:ba:13:61:21:8a:6e:75:28:e0:c5:0f:34:fd:36: + d8:45:7f:e1:b8:36:ef:b3:e1:c6:20:8e:e8:b4:38: + bc:e1:3e:f6:11:de:8c:9d:01 + Exponent: 65537 (0x10001) + Signature Algorithm: md5WithRSAEncryption + 2c:f3:c3:79:58:24:de:c6:3b:d1:e0:42:69:b8:ee:64:b3:3d: + 62:01:b9:b3:84:df:23:7d:dd:98:cf:10:a9:fe:00:d8:22:96: + 05:13:07:54:57:c5:a7:de:cb:d9:b8:88:42:f6:99:db:14:77: + 1f:b6:fe:25:3d:e1:a2:3e:03:a9:81:d2:2d:6c:47:f5:96:46: + 8c:22:ab:c8:cc:0d:0e:97:5e:8b:41:b4:3b:c4:0a:06:40:1d: + dd:46:f4:01:dd:ba:82:2e:3c:3d:78:70:9e:7c:18:d0:ab:f8: + b8:77:07:46:71:f1:ca:0b:63:5c:6a:f9:72:94:d5:01:4f:a0: + db:42 +MD5 Fingerprint=7B:B5:08:99:9A:8C:18:BF:85:27:7D:0E:AE:DA:B2:AB +-----BEGIN CERTIFICATE----- +MIICtzCCAiACAQAwDQYJKoZIhvcNAQEEBQAwgaMxCzAJBgNVBAYTAkVTMRIwEAYD +VQQIEwlCQVJDRUxPTkExEjAQBgNVBAcTCUJBUkNFTE9OQTEZMBcGA1UEChMQSVBT +IFNlZ3VyaWRhZCBDQTEYMBYGA1UECxMPQ2VydGlmaWNhY2lvbmVzMRcwFQYDVQQD +Ew5JUFMgU0VSVklET1JFUzEeMBwGCSqGSIb3DQEJARYPaXBzQG1haWwuaXBzLmVz +MB4XDTk4MDEwMTIzMjEwN1oXDTA5MTIyOTIzMjEwN1owgaMxCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCQVJDRUxPTkExEjAQBgNVBAcTCUJBUkNFTE9OQTEZMBcGA1UE +ChMQSVBTIFNlZ3VyaWRhZCBDQTEYMBYGA1UECxMPQ2VydGlmaWNhY2lvbmVzMRcw +FQYDVQQDEw5JUFMgU0VSVklET1JFUzEeMBwGCSqGSIb3DQEJARYPaXBzQG1haWwu +aXBzLmVzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCsT1J0nznqjtwlxLyY +XZhkJAk8IbPMGbWOlI6H0fg3PqHILVikgDVboXVsHUUMH2Fjal5vmwpMwci4YSM1 +gf/+rHhwLWjhOgeYlQJU3c0jt4BT18g3RXIGJBK6E2Ehim51KODFDzT9NthFf+G4 +Nu+z4cYgjui0OLzhPvYR3oydAQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBACzzw3lY +JN7GO9HgQmm47mSzPWIBubOE3yN93ZjPEKn+ANgilgUTB1RXxafey9m4iEL2mdsU +dx+2/iU94aI+A6mB0i1sR/WWRowiq8jMDQ6XXotBtDvECgZAHd1G9AHduoIuPD14 +cJ58GNCr+Lh3B0Zx8coLY1xq+XKU1QFPoNtC +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA Timestamping Certification Authority, CN=IPS CA Timestamping Certification Authority/emailAddress=ips@mail.ips.es + Validity + Not Before: Dec 29 01:10:18 2001 GMT + Not After : Dec 27 01:10:18 2025 GMT + Subject: C=ES, ST=Barcelona, L=Barcelona, O=IPS Internet publishing Services s.l., O=ips@mail.ips.es C.I.F. B-60929452, OU=IPS CA Timestamping Certification Authority, CN=IPS CA Timestamping Certification Authority/emailAddress=ips@mail.ips.es + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:bc:b8:ee:56:a5:9a:8c:e6:36:c9:c2:62:a0:66: + 81:8d:1a:d5:7a:d2:73:9f:0e:84:64:ba:95:b4:90: + a7:78:af:ca:fe:54:61:5b:ce:b2:20:57:01:ae:44: + 92:43:10:38:11:f7:68:fc:17:40:a5:68:27:32:3b: + c4:a7:e6:42:71:c5:99:ef:76:ff:2b:95:24:f5:49: + 92:18:68:ca:00:b5:a4:5a:2f:6e:cb:d6:1b:2c:0d: + 54:67:6b:7a:29:a1:58:ab:a2:5a:00:d6:5b:bb:18: + c2:df:f6:1e:13:56:76:9b:a5:68:e2:98:ce:c6:03: + 8a:34:db:4c:83:41:a6:a9:a3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + 8B:D0:10:50:09:81:F2:9D:09:D5:0E:60:78:03:22:A2:3F:C8:CA:66 + X509v3 Authority Key Identifier: + keyid:8B:D0:10:50:09:81:F2:9D:09:D5:0E:60:78:03:22:A2:3F:C8:CA:66 + DirName:/C=ES/ST=Barcelona/L=Barcelona/O=IPS Internet publishing Services s.l./O=ips@mail.ips.es C.I.F. B-60929452/OU=IPS CA Timestamping Certification Authority/CN=IPS CA Timestamping Certification Authority/emailAddress=ips@mail.ips.es + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + X509v3 Key Usage: + Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Sign, CRL Sign, Encipher Only, Decipher Only + X509v3 Extended Key Usage: + TLS Web Server Authentication, TLS Web Client Authentication, Code Signing, E-mail Protection, Time Stamping, Microsoft Individual Code Signing, Microsoft Commercial Code Signing, Microsoft Trust List Signing, Microsoft Encrypted File System + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:ips@mail.ips.es + X509v3 Issuer Alternative Name: + email:ips@mail.ips.es + Netscape Comment: + Timestamping CA Certificate issued by http://www.ips.es/ + Netscape Base Url: + http://www.ips.es/ips2002/ + Netscape CA Revocation Url: + http://www.ips.es/ips2002/ips2002Timestamping.crl + Netscape Revocation Url: + http://www.ips.es/ips2002/revocationTimestamping.html? + Netscape Renewal Url: + http://www.ips.es/ips2002/renewalTimestamping.html? + Netscape CA Policy Url: + http://www.ips.es/ips2002/policyTimestamping.html + X509v3 CRL Distribution Points: + URI:http://www.ips.es/ips2002/ips2002Timestamping.crl + URI:http://wwwback.ips.es/ips2002/ips2002Timestamping.crl + + Authority Information Access: + OCSP - URI:http://ocsp.ips.es/ + + Signature Algorithm: sha1WithRSAEncryption + 65:ba:c1:cc:00:1a:95:91:ca:e9:6c:3a:bf:3a:1e:14:08:7c: + fb:83:ee:6b:62:51:d3:33:91:b5:60:79:7e:04:d8:5d:79:37: + e8:c3:5b:b0:c4:67:2d:68:5a:b2:5f:0e:0a:fa:cd:3f:3a:45: + a1:ea:36:cf:26:1e:a7:11:28:c5:94:8f:84:4c:53:08:c5:93: + b3:fc:e2:7f:f5:8d:f3:b1:a9:85:5f:88:de:91:96:ee:17:5b: + ae:a5:ea:70:65:78:2c:21:64:01:95:ce:ce:4c:3e:50:f4:b6: + 59:cb:63:8d:b6:bd:18:d4:87:4a:5f:dc:ef:e9:56:f0:0a:0c: + e8:75 +MD5 Fingerprint=2E:03:FD:C5:F5:D7:2B:94:64:C1:BE:89:31:F1:16:9B +-----BEGIN CERTIFICATE----- +MIIIODCCB6GgAwIBAgIBADANBgkqhkiG9w0BAQUFADCCAR4xCzAJBgNVBAYTAkVT +MRIwEAYDVQQIEwlCYXJjZWxvbmExEjAQBgNVBAcTCUJhcmNlbG9uYTEuMCwGA1UE +ChMlSVBTIEludGVybmV0IHB1Ymxpc2hpbmcgU2VydmljZXMgcy5sLjErMCkGA1UE +ChQiaXBzQG1haWwuaXBzLmVzIEMuSS5GLiAgQi02MDkyOTQ1MjE0MDIGA1UECxMr +SVBTIENBIFRpbWVzdGFtcGluZyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTE0MDIG +A1UEAxMrSVBTIENBIFRpbWVzdGFtcGluZyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 +eTEeMBwGCSqGSIb3DQEJARYPaXBzQG1haWwuaXBzLmVzMB4XDTAxMTIyOTAxMTAx +OFoXDTI1MTIyNzAxMTAxOFowggEeMQswCQYDVQQGEwJFUzESMBAGA1UECBMJQmFy +Y2Vsb25hMRIwEAYDVQQHEwlCYXJjZWxvbmExLjAsBgNVBAoTJUlQUyBJbnRlcm5l +dCBwdWJsaXNoaW5nIFNlcnZpY2VzIHMubC4xKzApBgNVBAoUImlwc0BtYWlsLmlw +cy5lcyBDLkkuRi4gIEItNjA5Mjk0NTIxNDAyBgNVBAsTK0lQUyBDQSBUaW1lc3Rh +bXBpbmcgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxNDAyBgNVBAMTK0lQUyBDQSBU +aW1lc3RhbXBpbmcgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxHjAcBgkqhkiG9w0B +CQEWD2lwc0BtYWlsLmlwcy5lczCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA +vLjuVqWajOY2ycJioGaBjRrVetJznw6EZLqVtJCneK/K/lRhW86yIFcBrkSSQxA4 +Efdo/BdApWgnMjvEp+ZCccWZ73b/K5Uk9UmSGGjKALWkWi9uy9YbLA1UZ2t6KaFY +q6JaANZbuxjC3/YeE1Z2m6Vo4pjOxgOKNNtMg0GmqaMCAwEAAaOCBIAwggR8MB0G +A1UdDgQWBBSL0BBQCYHynQnVDmB4AyKiP8jKZjCCAVAGA1UdIwSCAUcwggFDgBSL +0BBQCYHynQnVDmB4AyKiP8jKZqGCASakggEiMIIBHjELMAkGA1UEBhMCRVMxEjAQ +BgNVBAgTCUJhcmNlbG9uYTESMBAGA1UEBxMJQmFyY2Vsb25hMS4wLAYDVQQKEyVJ +UFMgSW50ZXJuZXQgcHVibGlzaGluZyBTZXJ2aWNlcyBzLmwuMSswKQYDVQQKFCJp +cHNAbWFpbC5pcHMuZXMgQy5JLkYuICBCLTYwOTI5NDUyMTQwMgYDVQQLEytJUFMg +Q0EgVGltZXN0YW1waW5nIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MTQwMgYDVQQD +EytJUFMgQ0EgVGltZXN0YW1waW5nIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MR4w +HAYJKoZIhvcNAQkBFg9pcHNAbWFpbC5pcHMuZXOCAQAwDAYDVR0TBAUwAwEB/zAM +BgNVHQ8EBQMDB/+AMGsGA1UdJQRkMGIGCCsGAQUFBwMBBggrBgEFBQcDAgYIKwYB +BQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYKKwYBBAGCNwIBFQYKKwYBBAGCNwIB +FgYKKwYBBAGCNwoDAQYKKwYBBAGCNwoDBDARBglghkgBhvhCAQEEBAMCAAcwGgYD +VR0RBBMwEYEPaXBzQG1haWwuaXBzLmVzMBoGA1UdEgQTMBGBD2lwc0BtYWlsLmlw +cy5lczBHBglghkgBhvhCAQ0EOhY4VGltZXN0YW1waW5nIENBIENlcnRpZmljYXRl +IGlzc3VlZCBieSBodHRwOi8vd3d3Lmlwcy5lcy8wKQYJYIZIAYb4QgECBBwWGmh0 +dHA6Ly93d3cuaXBzLmVzL2lwczIwMDIvMEAGCWCGSAGG+EIBBAQzFjFodHRwOi8v +d3d3Lmlwcy5lcy9pcHMyMDAyL2lwczIwMDJUaW1lc3RhbXBpbmcuY3JsMEUGCWCG +SAGG+EIBAwQ4FjZodHRwOi8vd3d3Lmlwcy5lcy9pcHMyMDAyL3Jldm9jYXRpb25U +aW1lc3RhbXBpbmcuaHRtbD8wQgYJYIZIAYb4QgEHBDUWM2h0dHA6Ly93d3cuaXBz +LmVzL2lwczIwMDIvcmVuZXdhbFRpbWVzdGFtcGluZy5odG1sPzBABglghkgBhvhC +AQgEMxYxaHR0cDovL3d3dy5pcHMuZXMvaXBzMjAwMi9wb2xpY3lUaW1lc3RhbXBp +bmcuaHRtbDB/BgNVHR8EeDB2MDegNaAzhjFodHRwOi8vd3d3Lmlwcy5lcy9pcHMy +MDAyL2lwczIwMDJUaW1lc3RhbXBpbmcuY3JsMDugOaA3hjVodHRwOi8vd3d3YmFj +ay5pcHMuZXMvaXBzMjAwMi9pcHMyMDAyVGltZXN0YW1waW5nLmNybDAvBggrBgEF +BQcBAQQjMCEwHwYIKwYBBQUHMAGGE2h0dHA6Ly9vY3NwLmlwcy5lcy8wDQYJKoZI +hvcNAQEFBQADgYEAZbrBzAAalZHK6Ww6vzoeFAh8+4Pua2JR0zORtWB5fgTYXXk3 +6MNbsMRnLWhasl8OCvrNPzpFoeo2zyYepxEoxZSPhExTCMWTs/zif/WN87GphV+I +3pGW7hdbrqXqcGV4LCFkAZXOzkw+UPS2Wctjjba9GNSHSl/c7+lW8AoM6HU= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 985026699 (0x3ab6508b) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=BM, O=QuoVadis Limited, OU=Root Certification Authority, CN=QuoVadis Root Certification Authority + Validity + Not Before: Mar 19 18:33:33 2001 GMT + Not After : Mar 17 18:33:33 2021 GMT + Subject: C=BM, O=QuoVadis Limited, OU=Root Certification Authority, CN=QuoVadis Root Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:bf:61:b5:95:53:ba:57:fc:fa:f2:67:0b:3a:1a: + df:11:80:64:95:b4:d1:bc:cd:7a:cf:f6:29:96:2e: + 24:54:40:24:38:f7:1a:85:dc:58:4c:cb:a4:27:42: + 97:d0:9f:83:8a:c3:e4:06:03:5b:00:a5:51:1e:70: + 04:74:e2:c1:d4:3a:ab:d7:ad:3b:07:18:05:8e:fd: + 83:ac:ea:66:d9:18:1b:68:8a:f5:57:1a:98:ba:f5: + ed:76:3d:7c:d9:de:94:6a:3b:4b:17:c1:d5:8f:bd: + 65:38:3a:95:d0:3d:55:36:4e:df:79:57:31:2a:1e: + d8:59:65:49:58:20:98:7e:ab:5f:7e:9f:e9:d6:4d: + ec:83:74:a9:c7:6c:d8:ee:29:4a:85:2a:06:14:f9: + 54:e6:d3:da:65:07:8b:63:37:12:d7:d0:ec:c3:7b: + 20:41:44:a3:ed:cb:a0:17:e1:71:65:ce:1d:66:31: + f7:76:01:19:c8:7d:03:58:b6:95:49:1d:a6:12:26: + e8:c6:0c:76:e0:e3:66:cb:ea:5d:a6:26:ee:e5:cc: + 5f:bd:67:a7:01:27:0e:a2:ca:54:c5:b1:7a:95:1d: + 71:1e:4a:29:8a:03:dc:6a:45:c1:a4:19:5e:6f:36: + cd:c3:a2:b0:b7:fe:5c:38:e2:52:bc:f8:44:43:e6: + 90:bb + Exponent: 65537 (0x10001) + X509v3 extensions: + Authority Information Access: + OCSP - URI:https://ocsp.quovadisoffshore.com + + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.8024.0.1 + User Notice: + Explicit Text: Reliance on the QuoVadis Root Certificate by any party assumes acceptance of the then applicable standard terms and conditions of use, certification practices, and the QuoVadis Certificate Policy. + CPS: http://www.quovadis.bm + + X509v3 Subject Key Identifier: + 8B:4B:6D:ED:D3:29:B9:06:19:EC:39:39:A9:F0:97:84:6A:CB:EF:DF + X509v3 Authority Key Identifier: + keyid:8B:4B:6D:ED:D3:29:B9:06:19:EC:39:39:A9:F0:97:84:6A:CB:EF:DF + DirName:/C=BM/O=QuoVadis Limited/OU=Root Certification Authority/CN=QuoVadis Root Certification Authority + serial:3A:B6:50:8B + + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 8a:d4:14:b5:fe:f4:9a:92:a7:19:d4:a4:7e:72:18:8f:d9:68: + 7c:52:24:dd:67:6f:39:7a:c4:aa:5e:3d:e2:58:b0:4d:70:98: + 84:61:e8:1b:e3:69:18:0e:ce:fb:47:50:a0:4e:ff:f0:24:1f: + bd:b2:ce:f5:27:fc:ec:2f:53:aa:73:7b:03:3d:74:6e:e6:16: + 9e:eb:a5:2e:c4:bf:56:27:50:2b:62:ba:be:4b:1c:3c:55:5c: + 41:1d:24:be:82:20:47:5d:d5:44:7e:7a:16:68:df:7d:4d:51: + 70:78:57:1d:33:1e:fd:02:99:9c:0c:cd:0a:05:4f:c7:bb:8e: + a4:75:fa:4a:6d:b1:80:8e:09:56:b9:9c:1a:60:fe:5d:c1:d7: + 7a:dc:11:78:d0:d6:5d:c1:b7:d5:ad:32:99:03:3a:8a:cc:54: + 25:39:31:81:7b:13:22:51:ba:46:6c:a1:bb:9e:fa:04:6c:49: + 26:74:8f:d2:73:eb:cc:30:a2:e6:ea:59:22:87:f8:97:f5:0e: + fd:ea:cc:92:a4:16:c4:52:18:ea:21:ce:b1:f1:e6:84:81:e5: + ba:a9:86:28:f2:43:5a:5d:12:9d:ac:1e:d9:a8:e5:0a:6a:a7: + 7f:a0:87:29:cf:f2:89:4d:d4:ec:c5:e2:e6:7a:d0:36:23:8a: + 4a:74:36:f9 +MD5 Fingerprint=27:DE:36:FE:72:B7:00:03:00:9D:F4:F0:1E:6C:04:24 +-----BEGIN CERTIFICATE----- +MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJC +TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0 +aWZpY2F0aW9uIEF1dGhvcml0eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0 +aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAzMTkxODMzMzNaFw0yMTAzMTcxODMz +MzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUw +IwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQDEyVR +dW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Yp +li4kVEAkOPcahdxYTMukJ0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2D +rOpm2RgbaIr1VxqYuvXtdj182d6UajtLF8HVj71lODqV0D1VNk7feVcxKh7YWWVJ +WCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeLYzcS19Dsw3sgQUSj7cug +F+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWenAScOospU +xbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCC +Ak4wPQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVv +dmFkaXNvZmZzaG9yZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREw +ggENMIIBCQYJKwYBBAG+WAABMIH7MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNl +IG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBh +c3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFy +ZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh +Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYI +KwYBBQUHAgEWFmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3T +KbkGGew5Oanwl4Rqy+/fMIGuBgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rq +y+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1p +dGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYD +VQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6tlCL +MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSk +fnIYj9lofFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf8 +7C9TqnN7Az10buYWnuulLsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1R +cHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2xgI4JVrmcGmD+XcHXetwReNDWXcG31a0y +mQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi5upZIof4l/UO/erMkqQW +xFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi5nrQNiOK +SnQ2+Q== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=JP, O=SECOM Trust.net, OU=Security Communication RootCA1 + Validity + Not Before: Sep 30 04:20:49 2003 GMT + Not After : Sep 30 04:20:49 2023 GMT + Subject: C=JP, O=SECOM Trust.net, OU=Security Communication RootCA1 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b3:b3:fe:7f:d3:6d:b1:ef:16:7c:57:a5:0c:6d: + 76:8a:2f:4b:bf:64:fb:4c:ee:8a:f0:f3:29:7c:f5: + ff:ee:2a:e0:e9:e9:ba:5b:64:22:9a:9a:6f:2c:3a: + 26:69:51:05:99:26:dc:d5:1c:6a:71:c6:9a:7d:1e: + 9d:dd:7c:6c:c6:8c:67:67:4a:3e:f8:71:b0:19:27: + a9:09:0c:a6:95:bf:4b:8c:0c:fa:55:98:3b:d8:e8: + 22:a1:4b:71:38:79:ac:97:92:69:b3:89:7e:ea:21: + 68:06:98:14:96:87:d2:61:36:bc:6d:27:56:9e:57: + ee:c0:c0:56:fd:32:cf:a4:d9:8e:c2:23:d7:8d:a8: + f3:d8:25:ac:97:e4:70:38:f4:b6:3a:b4:9d:3b:97: + 26:43:a3:a1:bc:49:59:72:4c:23:30:87:01:58:f6: + 4e:be:1c:68:56:66:af:cd:41:5d:c8:b3:4d:2a:55: + 46:ab:1f:da:1e:e2:40:3d:db:cd:7d:b9:92:80:9c: + 37:dd:0c:96:64:9d:dc:22:f7:64:8b:df:61:de:15: + 94:52:15:a0:7d:52:c9:4b:a8:21:c9:c6:b1:ed:cb: + c3:95:60:d1:0f:f0:ab:70:f8:df:cb:4d:7e:ec:d6: + fa:ab:d9:bd:7f:54:f2:a5:e9:79:fa:d9:d6:76:24: + 28:73 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Subject Key Identifier: + A0:73:49:99:68:DC:85:5B:65:E3:9B:28:2F:57:9F:BD:33:BC:07:48 + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 68:40:a9:a8:bb:e4:4f:5d:79:b3:05:b5:17:b3:60:13:eb:c6: + 92:5d:e0:d1:d3:6a:fe:fb:be:9b:6d:bf:c7:05:6d:59:20:c4: + 1c:f0:b7:da:84:58:02:63:fa:48:16:ef:4f:a5:0b:f7:4a:98: + f2:3f:9e:1b:ad:47:6b:63:ce:08:47:eb:52:3f:78:9c:af:4d: + ae:f8:d5:4f:cf:9a:98:2a:10:41:39:52:c4:dd:d9:9b:0e:ef: + 93:01:ae:b2:2e:ca:68:42:24:42:6c:b0:b3:3a:3e:cd:e9:da: + 48:c4:15:cb:e9:f9:07:0f:92:50:49:8a:dd:31:97:5f:c9:e9: + 37:aa:3b:59:65:97:94:32:c9:b3:9f:3e:3a:62:58:c5:49:ad: + 62:0e:71:a5:32:aa:2f:c6:89:76:43:40:13:13:67:3d:a2:54: + 25:10:cb:f1:3a:f2:d9:fa:db:49:56:bb:a6:fe:a7:41:35:c3: + e0:88:61:c9:88:c7:df:36:10:22:98:59:ea:b0:4a:fb:56:16: + 73:6e:ac:4d:f7:22:a1:4f:ad:1d:7a:2d:45:27:e5:30:c1:5e: + f2:da:13:cb:25:42:51:95:47:03:8c:6c:21:cc:74:42:ed:53: + ff:33:8b:8f:0f:57:01:16:2f:cf:a6:ee:c9:70:22:14:bd:fd: + be:6c:0b:03 +MD5 Fingerprint=F1:BC:63:6A:54:E0:B5:27:F5:CD:E7:1A:E3:4D:6E:4A +-----BEGIN CERTIFICATE----- +MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEY +MBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21t +dW5pY2F0aW9uIFJvb3RDQTEwHhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5 +WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYD +VQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw8yl8 +9f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJ +DKaVv0uMDPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9 +Ms+k2Y7CI9eNqPPYJayX5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/N +QV3Is00qVUarH9oe4kA92819uZKAnDfdDJZkndwi92SL32HeFZRSFaB9UslLqCHJ +xrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2JChzAgMBAAGjPzA9MB0G +A1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYwDwYDVR0T +AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vG +kl3g0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfr +Uj94nK9NrvjVT8+amCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5 +Bw+SUEmK3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU +JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot +RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 36 (0x24) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=FI, O=Sonera, CN=Sonera Class1 CA + Validity + Not Before: Apr 6 10:49:13 2001 GMT + Not After : Apr 6 10:49:13 2021 GMT + Subject: C=FI, O=Sonera, CN=Sonera Class1 CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b5:89:1f:2b:4f:67:0a:79:ff:c5:1e:f8:7f:3c: + ed:d1:7e:da:b0:cd:6d:2f:36:ac:34:c6:db:d9:64: + 17:08:63:30:33:22:8a:4c:ee:8e:bb:0f:0d:42:55: + c9:9d:2e:a5:ef:f7:a7:8c:c3:ab:b9:97:cb:8e:ef: + 3f:15:67:a8:82:72:63:53:0f:41:8c:7d:10:95:24: + a1:5a:a5:06:fa:92:57:9d:fa:a5:01:f2:75:e9:1f: + bc:56:26:52:4e:78:19:65:58:55:03:58:c0:14:ae: + 8c:7c:55:5f:70:5b:77:23:06:36:97:f3:24:b5:9a: + 46:95:e4:df:0d:0b:05:45:e5:d1:f2:1d:82:bb:c6: + 13:e0:fe:aa:7a:fd:69:30:94:f3:d2:45:85:fc:f2: + 32:5b:32:de:e8:6c:5d:1f:cb:a4:22:74:b0:80:8e: + 5d:94:f7:06:00:4b:a9:d4:5e:2e:35:50:09:f3:80: + 97:f4:0c:17:ae:39:d8:5f:cd:33:c1:1c:ca:89:c2: + 22:f7:45:12:ed:5e:12:93:9d:63:ab:82:2e:b9:eb: + 42:41:44:cb:4a:1a:00:82:0d:9e:f9:8b:57:3e:4c: + c7:17:ed:2c:8b:72:33:5f:72:7a:38:56:d5:e6:d9: + ae:05:1a:1d:75:45:b1:cb:a5:25:1c:12:57:36:fd: + 22:37 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 47:E2:0C:8B:F6:53:88:52 + X509v3 Key Usage: + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 8b:1a:b2:c9:5d:61:b4:e1:b9:2b:b9:53:d1:b2:85:9d:77:8e: + 16:ee:11:3d:db:c2:63:d9:5b:97:65:fb:12:67:d8:2a:5c:b6: + ab:e5:5e:c3:b7:16:2f:c8:e8:ab:1d:8a:fd:ab:1a:7c:d5:5f: + 63:cf:dc:b0:dd:77:b9:a8:e6:d2:22:38:87:07:14:d9:ff:be: + 56:b5:fd:07:0e:3c:55:ca:16:cc:a7:a6:77:37:fb:db:5c:1f: + 4e:59:06:87:a3:03:43:f5:16:ab:b7:84:bd:4e:ef:9f:31:37: + f0:46:f1:40:b6:d1:0c:a5:64:f8:63:5e:21:db:55:4e:4f:31: + 76:9c:10:61:8e:b6:53:3a:a3:11:be:af:6d:7c:1e:bd:ae:2d: + e2:0c:69:c7:85:53:68:a2:61:ba:c5:3e:b4:79:54:78:9e:0a: + c7:02:be:62:d1:11:82:4b:65:2f:91:5a:c2:a8:87:b1:56:68: + 94:79:f9:25:f7:c1:d5:ae:1a:b8:bb:3d:8f:a9:8a:38:15:f7: + 73:d0:5a:60:d1:80:b0:f0:dc:d5:50:cd:4e:ee:92:48:69:ed: + b2:23:1e:30:cc:c8:94:c8:b6:f5:3b:86:7f:3f:a6:2e:9f:f6: + 3e:2c:b5:92:96:3e:df:2c:93:8a:ff:81:8c:0f:0f:59:21:19: + 57:bd:55:9a +MD5 Fingerprint=33:B7:84:F5:5F:27:D7:68:27:DE:14:DE:12:2A:ED:6F +-----BEGIN CERTIFICATE----- +MIIDIDCCAgigAwIBAgIBJDANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEP +MA0GA1UEChMGU29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MxIENBMB4XDTAx +MDQwNjEwNDkxM1oXDTIxMDQwNjEwNDkxM1owOTELMAkGA1UEBhMCRkkxDzANBgNV +BAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJhIENsYXNzMSBDQTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBALWJHytPZwp5/8Ue+H887dF+2rDNbS82rDTG +29lkFwhjMDMiikzujrsPDUJVyZ0upe/3p4zDq7mXy47vPxVnqIJyY1MPQYx9EJUk +oVqlBvqSV536pQHydekfvFYmUk54GWVYVQNYwBSujHxVX3BbdyMGNpfzJLWaRpXk +3w0LBUXl0fIdgrvGE+D+qnr9aTCU89JFhfzyMlsy3uhsXR/LpCJ0sICOXZT3BgBL +qdReLjVQCfOAl/QMF6452F/NM8EcyonCIvdFEu1eEpOdY6uCLrnrQkFEy0oaAIIN +nvmLVz5MxxftLItyM19yejhW1ebZrgUaHXVFsculJRwSVzb9IjcCAwEAAaMzMDEw +DwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQIR+IMi/ZTiFIwCwYDVR0PBAQDAgEG +MA0GCSqGSIb3DQEBBQUAA4IBAQCLGrLJXWG04bkruVPRsoWdd44W7hE928Jj2VuX +ZfsSZ9gqXLar5V7DtxYvyOirHYr9qxp81V9jz9yw3Xe5qObSIjiHBxTZ/75Wtf0H +DjxVyhbMp6Z3N/vbXB9OWQaHowND9Rart4S9Tu+fMTfwRvFAttEMpWT4Y14h21VO +TzF2nBBhjrZTOqMRvq9tfB69ri3iDGnHhVNoomG6xT60eVR4ngrHAr5i0RGCS2Uv +kVrCqIexVmiUefkl98HVrhq4uz2PqYo4Ffdz0Fpg0YCw8NzVUM1O7pJIae2yIx4w +zMiUyLb1O4Z/P6Yun/Y+LLWSlj7fLJOK/4GMDw9ZIRlXvVWa +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 29 (0x1d) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=FI, O=Sonera, CN=Sonera Class2 CA + Validity + Not Before: Apr 6 07:29:40 2001 GMT + Not After : Apr 6 07:29:40 2021 GMT + Subject: C=FI, O=Sonera, CN=Sonera Class2 CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:90:17:4a:35:9d:ca:f0:0d:96:c7:44:fa:16:37: + fc:48:bd:bd:7f:80:2d:35:3b:e1:6f:a8:67:a9:bf: + 03:1c:4d:8c:6f:32:47:d5:41:68:a4:13:04:c1:35: + 0c:9a:84:43:fc:5c:1d:ff:89:b3:e8:17:18:cd:91: + 5f:fb:89:e3:ea:bf:4e:5d:7c:1b:26:d3:75:79:ed: + e6:84:e3:57:e5:ad:29:c4:f4:3a:28:e7:a5:7b:84: + 36:69:b3:fd:5e:76:bd:a3:2d:99:d3:90:4e:23:28: + 7d:18:63:f1:54:3b:26:9d:76:5b:97:42:b2:ff:ae: + f0:4e:ec:dd:39:95:4e:83:06:7f:e7:49:40:c8:c5: + 01:b2:54:5a:66:1d:3d:fc:f9:e9:3c:0a:9e:81:b8: + 70:f0:01:8b:e4:23:54:7c:c8:ae:f8:90:1e:00:96: + 72:d4:54:cf:61:23:bc:ea:fb:9d:02:95:d1:b6:b9: + 71:3a:69:08:3f:0f:b4:e1:42:c7:88:f5:3f:98:a8: + a7:ba:1c:e0:71:71:ef:58:57:81:50:7a:5c:6b:74: + 46:0e:83:03:98:c3:8e:a8:6e:f2:76:32:6e:27:83: + c2:73:f3:dc:18:e8:b4:93:ea:75:44:6b:04:60:20: + 71:57:87:9d:f3:be:a0:90:23:3d:8a:24:e1:da:21: + db:c3 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 4A:A0:AA:58:84:D3:5E:3C + X509v3 Key Usage: + Certificate Sign, CRL Sign + Signature Algorithm: sha1WithRSAEncryption + 5a:ce:87:f9:16:72:15:57:4b:1d:d9:9b:e7:a2:26:30:ec:93: + 67:df:d6:2d:d2:34:af:f7:38:a5:ce:ab:16:b9:ab:2f:7c:35: + cb:ac:d0:0f:b4:4c:2b:fc:80:ef:6b:8c:91:5f:36:76:f7:db: + b3:1b:19:ea:f4:b2:11:fd:61:71:44:bf:28:b3:3a:1d:bf:b3: + 43:e8:9f:bf:dc:31:08:71:b0:9d:8d:d6:34:47:32:90:c6:65: + 24:f7:a0:4a:7c:04:73:8f:39:6f:17:8c:72:b5:bd:4b:c8:7a: + f8:7b:83:c3:28:4e:9c:09:ea:67:3f:b2:67:04:1b:c3:14:da: + f8:e7:49:24:91:d0:1d:6a:fa:61:39:ef:6b:e7:21:75:06:07: + d8:12:b4:21:20:70:42:71:81:da:3c:9a:36:be:a6:5b:0d:6a: + 6c:9a:1f:91:7b:f9:f9:ef:42:ba:4e:4e:9e:cc:0c:8d:94:dc: + d9:45:9c:5e:ec:42:50:63:ae:f4:5d:c4:b1:12:dc:ca:3b:a8: + 2e:9d:14:5a:05:75:b7:ec:d7:63:e2:ba:35:b6:04:08:91:e8: + da:9d:9c:f6:66:b5:18:ac:0a:a6:54:26:34:33:d2:1b:c1:d4: + 7f:1a:3a:8e:0b:aa:32:6e:db:fc:4f:25:9f:d9:32:c7:96:5a: + 70:ac:df:4c +MD5 Fingerprint=A3:EC:75:0F:2E:88:DF:FA:48:01:4E:0B:5C:48:6F:FB +-----BEGIN CERTIFICATE----- +MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEP +MA0GA1UEChMGU29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAx +MDQwNjA3Mjk0MFoXDTIxMDQwNjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNV +BAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJhIENsYXNzMiBDQTCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3/Ei9vX+ALTU74W+o +Z6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybTdXnt +5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s +3TmVToMGf+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2Ej +vOr7nQKV0ba5cTppCD8PtOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu +8nYybieDwnPz3BjotJPqdURrBGAgcVeHnfO+oJAjPYok4doh28MCAwEAAaMzMDEw +DwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITTXjwwCwYDVR0PBAQDAgEG +MA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt0jSv9zil +zqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/ +3DEIcbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvD +FNr450kkkdAdavphOe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6 +Tk6ezAyNlNzZRZxe7EJQY670XcSxEtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2 +ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLHllpwrN9M +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 10000010 (0x98968a) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=NL, O=Staat der Nederlanden, CN=Staat der Nederlanden Root CA + Validity + Not Before: Dec 17 09:23:49 2002 GMT + Not After : Dec 16 09:15:38 2015 GMT + Subject: C=NL, O=Staat der Nederlanden, CN=Staat der Nederlanden Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:98:d2:b5:51:11:7a:81:a6:14:98:71:6d:be:cc: + e7:13:1b:d6:27:0e:7a:b3:6a:18:1c:b6:61:5a:d5: + 61:09:bf:de:90:13:c7:67:ee:dd:f3:da:c5:0c:12: + 9e:35:55:3e:2c:27:88:40:6b:f7:dc:dd:22:61:f5: + c2:c7:0e:f5:f6:d5:76:53:4d:8f:8c:bc:18:76:37: + 85:9d:e8:ca:49:c7:d2:4f:98:13:09:a2:3e:22:88: + 9c:7f:d6:f2:10:65:b4:ee:5f:18:d5:17:e3:f8:c5: + fd:e2:9d:a2:ef:53:0e:85:77:a2:0f:e1:30:47:ee: + 00:e7:33:7d:44:67:1a:0b:51:e8:8b:a0:9e:50:98: + 68:34:52:1f:2e:6d:01:f2:60:45:f2:31:eb:a9:31: + 68:29:bb:7a:41:9e:c6:19:7f:94:b4:51:39:03:7f: + b2:de:a7:32:9b:b4:47:8e:6f:b4:4a:ae:e5:af:b1: + dc:b0:1b:61:bc:99:72:de:e4:89:b7:7a:26:5d:da: + 33:49:5b:52:9c:0e:f5:8a:ad:c3:b8:3d:e8:06:6a: + c2:d5:2a:0b:6c:7b:84:bd:56:05:cb:86:65:92:ec: + 44:2b:b0:8e:b9:dc:70:0b:46:da:ad:bc:63:88:39: + fa:db:6a:fe:23:fa:bc:e4:48:f4:67:2b:6a:11:10: + 21:49 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:TRUE + X509v3 Certificate Policies: + Policy: 2.5.29.32.0 + CPS: http://www.pkioverheid.nl/policies/root-policy + + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + A8:7D:EB:BC:63:A4:74:13:74:00:EC:96:E0:D3:34:C1:2C:BF:6C:F8 + Signature Algorithm: sha1WithRSAEncryption + 05:84:87:55:74:36:61:c1:bb:d1:d4:c6:15:a8:13:b4:9f:a4: + fe:bb:ee:15:b4:2f:06:0c:29:f2:a8:92:a4:61:0d:fc:ab:5c: + 08:5b:51:13:2b:4d:c2:2a:61:c8:f8:09:58:fc:2d:02:b2:39: + 7d:99:66:81:bf:6e:5c:95:45:20:6c:e6:79:a7:d1:d8:1c:29: + fc:c2:20:27:51:c8:f1:7c:5d:34:67:69:85:11:30:c6:00:d2: + d7:f3:d3:7c:b6:f0:31:57:28:12:82:73:e9:33:2f:a6:55:b4: + 0b:91:94:47:9c:fa:bb:7a:42:32:e8:ae:7e:2d:c8:bc:ac:14: + bf:d9:0f:d9:5b:fc:c1:f9:7a:95:e1:7d:7e:96:fc:71:b0:c2: + 4c:c8:df:45:34:c9:ce:0d:f2:9c:64:08:d0:3b:c3:29:c5:b2: + ed:90:04:c1:b1:29:91:c5:30:6f:c1:a9:72:33:cc:fe:5d:16: + 17:2c:11:69:e7:7e:fe:c5:83:08:df:bc:dc:22:3a:2e:20:69: + 23:39:56:60:67:90:8b:2e:76:39:fb:11:88:97:f6:7c:bd:4b: + b8:20:16:67:05:8d:e2:3b:c1:72:3f:94:95:37:c7:5d:b9:9e: + d8:93:a1:17:8f:ff:0c:66:15:c1:24:7c:32:7c:03:1d:3b:a1: + 58:45:32:93 +MD5 Fingerprint=60:84:7C:5A:CE:DB:0C:D4:CB:A7:E9:FE:02:C6:A9:C0 +-----BEGIN CERTIFICATE----- +MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJO +TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFh +dCBkZXIgTmVkZXJsYW5kZW4gUm9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEy +MTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4wHAYDVQQKExVTdGFhdCBkZXIgTmVk +ZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxhbmRlbiBSb290IENB +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFtvszn +ExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw71 +9tV2U02PjLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MO +hXeiD+EwR+4A5zN9RGcaC1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+U +tFE5A3+y3qcym7RHjm+0Sq7lr7HcsBthvJly3uSJt3omXdozSVtSnA71iq3DuD3o +BmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn622r+I/q85Ej0ZytqERAh +SQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRVHSAAMDww +OgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMv +cm9vdC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA +7Jbg0zTBLL9s+DANBgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k +/rvuFbQvBgwp8qiSpGEN/KtcCFtREytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzm +eafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbwMVcoEoJz6TMvplW0C5GUR5z6 +u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3ynGQI0DvDKcWy +7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR +iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 986490188 (0x3acca54c) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=DK, O=TDC Internet, OU=TDC Internet Root CA + Validity + Not Before: Apr 5 16:33:17 2001 GMT + Not After : Apr 5 17:03:17 2021 GMT + Subject: C=DK, O=TDC Internet, OU=TDC Internet Root CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:c4:b8:40:bc:91:d5:63:1f:d7:99:a0:8b:0c:40: + 1e:74:b7:48:9d:46:8c:02:b2:e0:24:5f:f0:19:13: + a7:37:83:6b:5d:c7:8e:f9:84:30:ce:1a:3b:fa:fb: + ce:8b:6d:23:c6:c3:6e:66:9f:89:a5:df:e0:42:50: + 67:fa:1f:6c:1e:f4:d0:05:d6:bf:ca:d6:4e:e4:68: + 60:6c:46:aa:1c:5d:63:e1:07:86:0e:65:00:a7:2e: + a6:71:c6:bc:b9:81:a8:3a:7d:1a:d2:f9:d1:ac:4b: + cb:ce:75:af:dc:7b:fa:81:73:d4:fc:ba:bd:41:88: + d4:74:b3:f9:5e:38:3a:3c:43:a8:d2:95:4e:77:6d: + 13:0c:9d:8f:78:01:b7:5a:20:1f:03:37:35:e2:2c: + db:4b:2b:2c:78:b9:49:db:c4:d0:c7:9c:9c:e4:8a: + 20:09:21:16:56:66:ff:05:ec:5b:e3:f0:cf:ab:24: + 24:5e:c3:7f:70:7a:12:c4:d2:b5:10:a0:b6:21:e1: + 8d:78:69:55:44:69:f5:ca:96:1c:34:85:17:25:77: + e2:f6:2f:27:98:78:fd:79:06:3a:a2:d6:5a:43:c1: + ff:ec:04:3b:ee:13:ef:d3:58:5a:ff:92:eb:ec:ae: + da:f2:37:03:47:41:b6:97:c9:2d:0a:41:22:bb:bb: + e6:a7 + Exponent: 65537 (0x10001) + X509v3 extensions: + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=DK/O=TDC Internet/OU=TDC Internet Root CA/CN=CRL1 + + X509v3 Private Key Usage Period: + Not Before: Apr 5 16:33:17 2001 GMT, Not After: Apr 5 17:03:17 2021 GMT + X509v3 Key Usage: + Certificate Sign, CRL Sign + X509v3 Authority Key Identifier: + keyid:6C:64:01:C7:FD:85:6D:AC:C8:DA:9E:50:08:85:08:B5:3C:56:A8:50 + + X509v3 Subject Key Identifier: + 6C:64:01:C7:FD:85:6D:AC:C8:DA:9E:50:08:85:08:B5:3C:56:A8:50 + X509v3 Basic Constraints: + CA:TRUE + 1.2.840.113533.7.65.0: + 0...V5.0:4.0.... + Signature Algorithm: sha1WithRSAEncryption + 4e:43:cc:d1:dd:1d:10:1b:06:7f:b7:a4:fa:d3:d9:4d:fb:23: + 9f:23:54:5b:e6:8b:2f:04:28:8b:b5:27:6d:89:a1:ec:98:69: + dc:e7:8d:26:83:05:79:74:ec:b4:b9:a3:97:c1:35:00:fd:15: + da:39:81:3a:95:31:90:de:97:e9:86:a8:99:77:0c:e5:5a:a0: + 84:ff:12:16:ac:6e:b8:8d:c3:7b:92:c2:ac:2e:d0:7d:28:ec: + b6:f3:60:38:69:6f:3e:d8:04:55:3e:9e:cc:55:d2:ba:fe:bb: + 47:04:d7:0a:d9:16:0a:34:29:f5:58:13:d5:4f:cf:8f:56:4b: + b3:1e:ee:d3:98:79:da:08:1e:0c:6f:b8:f8:16:27:ef:c2:6f: + 3d:f6:a3:4b:3e:0e:e4:6d:6c:db:3b:41:12:9b:bd:0d:47:23: + 7f:3c:4a:d0:af:c0:af:f6:ef:1b:b5:15:c4:eb:83:c4:09:5f: + 74:8b:d9:11:fb:c2:56:b1:3c:f8:70:ca:34:8d:43:40:13:8c: + fd:99:03:54:79:c6:2e:ea:86:a1:f6:3a:d4:09:bc:f4:bc:66: + cc:3d:58:d0:57:49:0a:ee:25:e2:41:ee:13:f9:9b:38:34:d1: + 00:f5:7e:e7:94:1d:fc:69:03:62:b8:99:05:05:3d:6b:78:12: + bd:b0:6f:65 +MD5 Fingerprint=91:F4:03:55:20:A1:F8:63:2C:62:DE:AC:FB:61:1C:8E +-----BEGIN CERTIFICATE----- +MIIEKzCCAxOgAwIBAgIEOsylTDANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJE +SzEVMBMGA1UEChMMVERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQg +Um9vdCBDQTAeFw0wMTA0MDUxNjMzMTdaFw0yMTA0MDUxNzAzMTdaMEMxCzAJBgNV +BAYTAkRLMRUwEwYDVQQKEwxUREMgSW50ZXJuZXQxHTAbBgNVBAsTFFREQyBJbnRl +cm5ldCBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxLhA +vJHVYx/XmaCLDEAedLdInUaMArLgJF/wGROnN4NrXceO+YQwzho7+vvOi20jxsNu +Zp+Jpd/gQlBn+h9sHvTQBda/ytZO5GhgbEaqHF1j4QeGDmUApy6mcca8uYGoOn0a +0vnRrEvLznWv3Hv6gXPU/Lq9QYjUdLP5Xjg6PEOo0pVOd20TDJ2PeAG3WiAfAzc1 +4izbSysseLlJ28TQx5yc5IogCSEWVmb/Bexb4/DPqyQkXsN/cHoSxNK1EKC2IeGN +eGlVRGn1ypYcNIUXJXfi9i8nmHj9eQY6otZaQ8H/7AQ77hPv01ha/5Lr7K7a8jcD +R0G2l8ktCkEiu7vmpwIDAQABo4IBJTCCASEwEQYJYIZIAYb4QgEBBAQDAgAHMGUG +A1UdHwReMFwwWqBYoFakVDBSMQswCQYDVQQGEwJESzEVMBMGA1UEChMMVERDIElu +dGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTENMAsGA1UEAxME +Q1JMMTArBgNVHRAEJDAigA8yMDAxMDQwNTE2MzMxN1qBDzIwMjEwNDA1MTcwMzE3 +WjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUbGQBx/2FbazI2p5QCIUItTxWqFAw +HQYDVR0OBBYEFGxkAcf9hW2syNqeUAiFCLU8VqhQMAwGA1UdEwQFMAMBAf8wHQYJ +KoZIhvZ9B0EABBAwDhsIVjUuMDo0LjADAgSQMA0GCSqGSIb3DQEBBQUAA4IBAQBO +Q8zR3R0QGwZ/t6T609lN+yOfI1Rb5osvBCiLtSdtiaHsmGnc540mgwV5dOy0uaOX +wTUA/RXaOYE6lTGQ3pfphqiZdwzlWqCE/xIWrG64jcN7ksKsLtB9KOy282A4aW8+ +2ARVPp7MVdK6/rtHBNcK2RYKNCn1WBPVT8+PVkuzHu7TmHnaCB4Mb7j4Fifvwm89 +9qNLPg7kbWzbO0ESm70NRyN/PErQr8Cv9u8btRXE64PECV90i9kR+8JWsTz4cMo0 +jUNAE4z9mQNUecYu6oah9jrUCbz0vGbMPVjQV0kK7iXiQe4T+Zs4NNEA9X7nlB38 +aQNiuJkFBT1reBK9sG9l +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 1044954564 (0x3e48bdc4) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=DK, O=TDC, CN=TDC OCES CA + Validity + Not Before: Feb 11 08:39:30 2003 GMT + Not After : Feb 11 09:09:30 2037 GMT + Subject: C=DK, O=TDC, CN=TDC OCES CA + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ac:62:f6:61:20:b2:cf:c0:c6:85:d7:e3:79:e6: + cc:ed:f2:39:92:a4:97:2e:64:a3:84:5b:87:9c:4c: + fd:a4:f3:c4:5f:21:bd:56:10:eb:db:2e:61:ec:93: + 69:e3:a3:cc:bd:99:c3:05:fc:06:b8:ca:36:1c:fe: + 90:8e:49:4c:c4:56:9a:2f:56:bc:cf:7b:0c:f1:6f: + 47:a6:0d:43:4d:e2:e9:1d:39:34:cd:8d:2c:d9:12: + 98:f9:e3:e1:c1:4a:7c:86:38:c4:a9:c4:61:88:d2: + 5e:af:1a:26:4d:d5:e4:a0:22:47:84:d9:64:b7:19: + 96:fc:ec:19:e4:b2:97:26:4e:4a:4c:cb:8f:24:8b: + 54:18:1c:48:61:7b:d5:88:68:da:5d:b5:ea:cd:1a: + 30:c1:80:83:76:50:aa:4f:d1:d4:dd:38:f0:ef:16: + f4:e1:0c:50:06:bf:ea:fb:7a:49:a1:28:2b:1c:f6: + fc:15:32:a3:74:6a:8f:a9:c3:62:29:71:31:e5:3b: + a4:60:17:5e:74:e6:da:13:ed:e9:1f:1f:1b:d1:b2: + 68:73:c6:10:34:75:46:10:10:e3:90:00:76:40:cb: + 8b:b7:43:09:21:ff:ab:4e:93:c6:58:e9:a5:82:db: + 77:c4:3a:99:b1:72:95:49:04:f0:b7:2b:fa:7b:59: + 8e:dd + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Certificate Policies: + Policy: 1.2.208.169.1.1.1 + CPS: http://www.certifikat.dk/repository + User Notice: + Organization: TDC + Number: 1 + Explicit Text: Certifikater fra denne CA udstedes under OID 1.2.208.169.1.1.1. Certificates from this CA are issued under OID 1.2.208.169.1.1.1. + + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 CRL Distribution Points: + DirName:/C=DK/O=TDC/CN=TDC OCES CA/CN=CRL1 + URI:http://crl.oces.certifikat.dk/oces.crl + + X509v3 Private Key Usage Period: + Not Before: Feb 11 08:39:30 2003 GMT, Not After: Feb 11 09:09:30 2037 GMT + X509v3 Authority Key Identifier: + keyid:60:B5:85:EC:56:64:7E:12:19:27:67:1D:50:15:4B:73:AE:3B:F9:12 + + X509v3 Subject Key Identifier: + 60:B5:85:EC:56:64:7E:12:19:27:67:1D:50:15:4B:73:AE:3B:F9:12 + 1.2.840.113533.7.65.0: + 0...V6.0:4.0.... + Signature Algorithm: sha1WithRSAEncryption + 0a:ba:26:26:46:d3:73:a8:09:f3:6b:0b:30:99:fd:8a:e1:57: + 7a:11:d3:b8:94:d7:09:10:6e:a3:b1:38:03:d1:b6:f2:43:41: + 29:62:a7:72:d8:fb:7c:05:e6:31:70:27:54:18:4e:8a:7c:4e: + e5:d1:ca:8c:78:88:cf:1b:d3:90:8b:e6:23:f8:0b:0e:33:43: + 7d:9c:e2:0a:19:8f:c9:01:3e:74:5d:74:c9:8b:1c:03:e5:18: + c8:01:4c:3f:cb:97:05:5d:98:71:a6:98:6f:b6:7c:bd:37:7f: + be:e1:93:25:6d:6f:f0:0a:ad:17:18:e1:03:bc:07:29:c8:ad: + 26:e8:f8:61:f0:fd:21:09:7e:9a:8e:a9:68:7d:48:62:72:bd: + 00:ea:01:99:b8:06:82:51:81:4e:f1:f5:b4:91:54:b9:23:7a: + 00:9a:9f:5d:8d:e0:3c:64:b9:1a:12:92:2a:c7:82:44:72:39: + dc:e2:3c:c6:d8:55:f5:15:4e:c8:05:0e:db:c6:d0:62:a6:ec: + 15:b4:b5:02:82:db:ac:8c:a2:81:f0:9b:99:31:f5:20:20:a8: + 88:61:0a:07:9f:94:fc:d0:d7:1b:cc:2e:17:f3:04:27:76:67: + eb:54:83:fd:a4:90:7e:06:3d:04:a3:43:2d:da:fc:0b:62:ea: + 2f:5f:62:53 +MD5 Fingerprint=93:7F:90:1C:ED:84:67:17:A4:65:5F:9B:CB:30:02:97 +-----BEGIN CERTIFICATE----- +MIIFGTCCBAGgAwIBAgIEPki9xDANBgkqhkiG9w0BAQUFADAxMQswCQYDVQQGEwJE +SzEMMAoGA1UEChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTAeFw0wMzAyMTEw +ODM5MzBaFw0zNzAyMTEwOTA5MzBaMDExCzAJBgNVBAYTAkRLMQwwCgYDVQQKEwNU +REMxFDASBgNVBAMTC1REQyBPQ0VTIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEArGL2YSCyz8DGhdfjeebM7fI5kqSXLmSjhFuHnEz9pPPEXyG9VhDr +2y5h7JNp46PMvZnDBfwGuMo2HP6QjklMxFaaL1a8z3sM8W9Hpg1DTeLpHTk0zY0s +2RKY+ePhwUp8hjjEqcRhiNJerxomTdXkoCJHhNlktxmW/OwZ5LKXJk5KTMuPJItU +GBxIYXvViGjaXbXqzRowwYCDdlCqT9HU3Tjw7xb04QxQBr/q+3pJoSgrHPb8FTKj +dGqPqcNiKXEx5TukYBdedObaE+3pHx8b0bJoc8YQNHVGEBDjkAB2QMuLt0MJIf+r +TpPGWOmlgtt3xDqZsXKVSQTwtyv6e1mO3QIDAQABo4ICNzCCAjMwDwYDVR0TAQH/ +BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgewGA1UdIASB5DCB4TCB3gYIKoFQgSkB +AQEwgdEwLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuY2VydGlmaWthdC5kay9yZXBv +c2l0b3J5MIGdBggrBgEFBQcCAjCBkDAKFgNUREMwAwIBARqBgUNlcnRpZmlrYXRl +ciBmcmEgZGVubmUgQ0EgdWRzdGVkZXMgdW5kZXIgT0lEIDEuMi4yMDguMTY5LjEu +MS4xLiBDZXJ0aWZpY2F0ZXMgZnJvbSB0aGlzIENBIGFyZSBpc3N1ZWQgdW5kZXIg +T0lEIDEuMi4yMDguMTY5LjEuMS4xLjARBglghkgBhvhCAQEEBAMCAAcwgYEGA1Ud +HwR6MHgwSKBGoESkQjBAMQswCQYDVQQGEwJESzEMMAoGA1UEChMDVERDMRQwEgYD +VQQDEwtUREMgT0NFUyBDQTENMAsGA1UEAxMEQ1JMMTAsoCqgKIYmaHR0cDovL2Ny +bC5vY2VzLmNlcnRpZmlrYXQuZGsvb2Nlcy5jcmwwKwYDVR0QBCQwIoAPMjAwMzAy +MTEwODM5MzBagQ8yMDM3MDIxMTA5MDkzMFowHwYDVR0jBBgwFoAUYLWF7FZkfhIZ +J2cdUBVLc647+RIwHQYDVR0OBBYEFGC1hexWZH4SGSdnHVAVS3OuO/kSMB0GCSqG +SIb2fQdBAAQQMA4bCFY2LjA6NC4wAwIEkDANBgkqhkiG9w0BAQUFAAOCAQEACrom +JkbTc6gJ82sLMJn9iuFXehHTuJTXCRBuo7E4A9G28kNBKWKnctj7fAXmMXAnVBhO +inxO5dHKjHiIzxvTkIvmI/gLDjNDfZziChmPyQE+dF10yYscA+UYyAFMP8uXBV2Y +caaYb7Z8vTd/vuGTJW1v8AqtFxjhA7wHKcitJuj4YfD9IQl+mo6paH1IYnK9AOoB +mbgGglGBTvH1tJFUuSN6AJqfXY3gPGS5GhKSKseCRHI53OI8xthV9RVOyAUO28bQ +YqbsFbS1AoLbrIyigfCbmTH1ICCoiGEKB5+U/NDXG8wuF/MEJ3Zn61SD/aSQfgY9 +BKNDLdr8C2LqL19iUw== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:be:0c:8b:50:00:21:b4:11:d3:2a:68:06:a9:ad:69 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN - DATACorp SGC + Validity + Not Before: Jun 24 18:57:21 1999 GMT + Not After : Jun 24 19:06:30 2019 GMT + Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN - DATACorp SGC + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:df:ee:58:10:a2:2b:6e:55:c4:8e:bf:2e:46:09: + e7:e0:08:0f:2e:2b:7a:13:94:1b:bd:f6:b6:80:8e: + 65:05:93:00:1e:bc:af:e2:0f:8e:19:0d:12:47:ec: + ac:ad:a3:fa:2e:70:f8:de:6e:fb:56:42:15:9e:2e: + 5c:ef:23:de:21:b9:05:76:27:19:0f:4f:d6:c3:9c: + b4:be:94:19:63:f2:a6:11:0a:eb:53:48:9c:be:f2: + 29:3b:16:e8:1a:a0:4c:a6:c9:f4:18:59:68:c0:70: + f2:53:00:c0:5e:50:82:a5:56:6f:36:f9:4a:e0:44: + 86:a0:4d:4e:d6:47:6e:49:4a:cb:67:d7:a6:c4:05: + b9:8e:1e:f4:fc:ff:cd:e7:36:e0:9c:05:6c:b2:33: + 22:15:d0:b4:e0:cc:17:c0:b2:c0:f4:fe:32:3f:29: + 2a:95:7b:d8:f2:a7:4e:0f:54:7c:a1:0d:80:b3:09: + 03:c1:ff:5c:dd:5e:9a:3e:bc:ae:bc:47:8a:6a:ae: + 71:ca:1f:b1:2a:b8:5f:42:05:0b:ec:46:30:d1:72: + 0b:ca:e9:56:6d:f5:ef:df:78:be:61:ba:b2:a5:ae: + 04:4c:bc:a8:ac:69:15:97:bd:ef:eb:b4:8c:bf:35: + f8:d4:c3:d1:28:0e:5c:3a:9f:70:18:33:20:77:c4: + a2:af + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 53:32:D1:B3:CF:7F:FA:E0:F1:A0:5D:85:4E:92:D2:9E:45:1D:B4:4F + X509v3 CRL Distribution Points: + URI:http://crl.usertrust.com/UTN-DATACorpSGC.crl + + X509v3 Extended Key Usage: + TLS Web Server Authentication, Microsoft Server Gated Crypto, Netscape Server Gated Crypto + Signature Algorithm: sha1WithRSAEncryption + 27:35:97:00:8a:8b:28:bd:c6:33:30:1e:29:fc:e2:f7:d5:98: + d4:40:bb:60:ca:bf:ab:17:2c:09:36:7f:50:fa:41:dc:ae:96: + 3a:0a:23:3e:89:59:c9:a3:07:ed:1b:37:ad:fc:7c:be:51:49: + 5a:de:3a:0a:54:08:16:45:c2:99:b1:87:cd:8c:68:e0:69:03: + e9:c4:4e:98:b2:3b:8c:16:b3:0e:a0:0c:98:50:9b:93:a9:70: + 09:c8:2c:a3:8f:df:02:e4:e0:71:3a:f1:b4:23:72:a0:aa:01: + df:df:98:3e:14:50:a0:31:26:bd:28:e9:5a:30:26:75:f9:7b: + 60:1c:8d:f3:cd:50:26:6d:04:27:9a:df:d5:0d:45:47:29:6b: + 2c:e6:76:d9:a9:29:7d:32:dd:c9:36:3c:bd:ae:35:f1:11:9e: + 1d:bb:90:3f:12:47:4e:8e:d7:7e:0f:62:73:1d:52:26:38:1c: + 18:49:fd:30:74:9a:c4:e5:22:2f:d8:c0:8d:ed:91:7a:4c:00: + 8f:72:7f:5d:da:dd:1b:8b:45:6b:e7:dd:69:97:a8:c5:56:4c: + 0f:0c:f6:9f:7a:91:37:f6:97:82:e0:dd:71:69:ff:76:3f:60: + 4d:3c:cf:f7:99:f9:c6:57:f4:c9:55:39:78:ba:2c:79:c9:a6: + 88:2b:f4:08 +MD5 Fingerprint=B3:A5:3E:77:21:6D:AC:4A:C0:C9:FB:D5:41:3D:CA:06 +-----BEGIN CERTIFICATE----- +MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB +kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw +IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG +EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD +VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu +dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN +BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6 +E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ +D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK +4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq +lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW +bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB +o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT +MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js +LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr +BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB +AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft +Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj +j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH +KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv +2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3 +mfnGV/TJVTl4uix5yaaIK/QI +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:be:0c:8b:50:00:24:b4:11:d3:36:25:25:67:c9:89 + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Client Authentication and Email + Validity + Not Before: Jul 9 17:28:50 1999 GMT + Not After : Jul 9 17:36:58 2019 GMT + Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Client Authentication and Email + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b2:39:85:a4:f2:7d:ab:41:3b:62:46:37:ae:cd: + c1:60:75:bc:39:65:f9:4a:1a:47:a2:b9:cc:48:cc: + 6a:98:d5:4d:35:19:b9:a4:42:e5:ce:49:e2:8a:2f: + 1e:7c:d2:31:07:c7:4e:b4:83:64:9d:2e:29:d5:a2: + 64:c4:85:bd:85:51:35:79:a4:4e:68:90:7b:1c:7a: + a4:92:a8:17:f2:98:15:f2:93:cc:c9:a4:32:95:bb: + 0c:4f:30:bd:98:a0:0b:8b:e5:6e:1b:a2:46:fa:78: + bc:a2:6f:ab:59:5e:a5:2f:cf:ca:da:6d:aa:2f:eb: + ac:a1:b3:6a:aa:b7:2e:67:35:8b:79:e1:1e:69:88: + e2:e6:46:cd:a0:a5:ea:be:0b:ce:76:3a:7a:0e:9b: + ea:fc:da:27:5b:3d:73:1f:22:e6:48:61:c6:4c:f3: + 69:b1:a8:2e:1b:b6:d4:31:20:2c:bc:82:8a:8e:a4: + 0e:a5:d7:89:43:fc:16:5a:af:1d:71:d7:11:59:da: + ba:87:0d:af:fa:f3:e1:c2:f0:a4:c5:67:8c:d6:d6: + 54:3a:de:0a:a4:ba:03:77:b3:65:c8:fd:1e:d3:74: + 62:aa:18:ca:68:93:1e:a1:85:7e:f5:47:65:cb:f8: + 4d:57:28:74:d2:34:ff:30:b6:ee:f6:62:30:14:8c: + 2c:eb + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + 89:82:67:7D:C4:9D:26:70:00:4B:B4:50:48:7C:DE:3D:AE:04:6E:7D + X509v3 CRL Distribution Points: + URI:http://crl.usertrust.com/UTN-USERFirst-ClientAuthenticationandEmail.crl + + X509v3 Extended Key Usage: + TLS Web Client Authentication, E-mail Protection + Signature Algorithm: sha1WithRSAEncryption + b1:6d:61:5d:a6:1a:7f:7c:ab:4a:e4:30:fc:53:6f:25:24:c6: + ca:ed:e2:31:5c:2b:0e:ee:ee:61:55:6f:04:3e:cf:39:de:c5: + 1b:49:94:e4:eb:20:4c:b4:e6:9e:50:2e:72:d9:8d:f5:aa:a3: + b3:4a:da:56:1c:60:97:80:dc:82:a2:ad:4a:bd:8a:2b:ff:0b: + 09:b4:c6:d7:20:04:45:e4:cd:80:01:ba:ba:2b:6e:ce:aa:d7: + 92:fe:e4:af:eb:f4:26:1d:16:2a:7f:6c:30:95:37:2f:33:12: + ac:7f:dd:c7:d1:11:8c:51:98:b2:d0:a3:91:d0:ad:f6:9f:9e: + 83:93:1e:1d:42:b8:46:af:6b:66:f0:9b:7f:ea:e3:03:02:e5: + 02:51:c1:aa:d5:35:9d:72:40:03:89:ba:31:1d:c5:10:68:52: + 9e:df:a2:85:c5:5c:08:a6:78:e6:53:4f:b1:e8:b7:d3:14:9e: + 93:a6:c3:64:e3:ac:7e:71:cd:bc:9f:e9:03:1b:cc:fb:e9:ac: + 31:c1:af:7c:15:74:02:99:c3:b2:47:a6:c2:32:61:d7:c7:6f: + 48:24:51:27:a1:d5:87:55:f2:7b:8f:98:3d:16:9e:ee:75:b6: + f8:d0:8e:f2:f3:c6:ae:28:5b:a7:f0:f3:36:17:fc:c3:05:d3: + ca:03:4a:54 +MD5 Fingerprint=D7:34:3D:EF:1D:27:09:28:E1:31:02:5B:13:2B:DD:F7 +-----BEGIN CERTIFICATE----- +MIIEojCCA4qgAwIBAgIQRL4Mi1AAJLQR0zYlJWfJiTANBgkqhkiG9w0BAQUFADCB +rjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xNjA0BgNVBAMTLVVUTi1VU0VSRmlyc3Qt +Q2xpZW50IEF1dGhlbnRpY2F0aW9uIGFuZCBFbWFpbDAeFw05OTA3MDkxNzI4NTBa +Fw0xOTA3MDkxNzM2NThaMIGuMQswCQYDVQQGEwJVUzELMAkGA1UECBMCVVQxFzAV +BgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5l +dHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cudXNlcnRydXN0LmNvbTE2MDQGA1UE +AxMtVVROLVVTRVJGaXJzdC1DbGllbnQgQXV0aGVudGljYXRpb24gYW5kIEVtYWls +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsjmFpPJ9q0E7YkY3rs3B +YHW8OWX5ShpHornMSMxqmNVNNRm5pELlzkniii8efNIxB8dOtINknS4p1aJkxIW9 +hVE1eaROaJB7HHqkkqgX8pgV8pPMyaQylbsMTzC9mKALi+VuG6JG+ni8om+rWV6l +L8/K2m2qL+usobNqqrcuZzWLeeEeaYji5kbNoKXqvgvOdjp6Dpvq/NonWz1zHyLm +SGHGTPNpsaguG7bUMSAsvIKKjqQOpdeJQ/wWWq8dcdcRWdq6hw2v+vPhwvCkxWeM +1tZUOt4KpLoDd7NlyP0e03RiqhjKaJMeoYV+9Udly/hNVyh00jT/MLbu9mIwFIws +6wIDAQABo4G5MIG2MAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud +DgQWBBSJgmd9xJ0mcABLtFBIfN49rgRufTBYBgNVHR8EUTBPME2gS6BJhkdodHRw +Oi8vY3JsLnVzZXJ0cnVzdC5jb20vVVROLVVTRVJGaXJzdC1DbGllbnRBdXRoZW50 +aWNhdGlvbmFuZEVtYWlsLmNybDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUH +AwQwDQYJKoZIhvcNAQEFBQADggEBALFtYV2mGn98q0rkMPxTbyUkxsrt4jFcKw7u +7mFVbwQ+zznexRtJlOTrIEy05p5QLnLZjfWqo7NK2lYcYJeA3IKirUq9iiv/Cwm0 +xtcgBEXkzYABurorbs6q15L+5K/r9CYdFip/bDCVNy8zEqx/3cfREYxRmLLQo5HQ +rfafnoOTHh1CuEava2bwm3/q4wMC5QJRwarVNZ1yQAOJujEdxRBoUp7fooXFXAim +eOZTT7Hot9MUnpOmw2TjrH5xzbyf6QMbzPvprDHBr3wVdAKZw7JHpsIyYdfHb0gk +USeh1YdV8nuPmD0Wnu51tvjQjvLzxq4oW6fw8zYX/MMF08oDSlQ= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:be:0c:8b:50:00:24:b4:11:d3:36:2a:fe:65:0a:fd + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Hardware + Validity + Not Before: Jul 9 18:10:42 1999 GMT + Not After : Jul 9 18:19:22 2019 GMT + Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Hardware + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b1:f7:c3:38:3f:b4:a8:7f:cf:39:82:51:67:d0: + 6d:9f:d2:ff:58:f3:e7:9f:2b:ec:0d:89:54:99:b9: + 38:99:16:f7:e0:21:79:48:c2:bb:61:74:12:96:1d: + 3c:6a:72:d5:3c:10:67:3a:39:ed:2b:13:cd:66:eb: + 95:09:33:a4:6c:97:b1:e8:c6:ec:c1:75:79:9c:46: + 5e:8d:ab:d0:6a:fd:b9:2a:55:17:10:54:b3:19:f0: + 9a:f6:f1:b1:5d:b6:a7:6d:fb:e0:71:17:6b:a2:88: + fb:00:df:fe:1a:31:77:0c:9a:01:7a:b1:32:e3:2b: + 01:07:38:6e:c3:a5:5e:23:bc:45:9b:7b:50:c1:c9: + 30:8f:db:e5:2b:7a:d3:5b:fb:33:40:1e:a0:d5:98: + 17:bc:8b:87:c3:89:d3:5d:a0:8e:b2:aa:aa:f6:8e: + 69:88:06:c5:fa:89:21:f3:08:9d:69:2e:09:33:9b: + 29:0d:46:0f:8c:cc:49:34:b0:69:51:bd:f9:06:cd: + 68:ad:66:4c:bc:3e:ac:61:bd:0a:88:0e:c8:df:3d: + ee:7c:04:4c:9d:0a:5e:6b:91:d6:ee:c7:ed:28:8d: + ab:4d:87:89:73:d0:6e:a4:d0:1e:16:8b:14:e1:76: + 44:03:7f:63:ac:e4:cd:49:9c:c5:92:f4:ab:32:a1: + 48:5b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + A1:72:5F:26:1B:28:98:43:95:5D:07:37:D5:85:96:9D:4B:D2:C3:45 + X509v3 CRL Distribution Points: + URI:http://crl.usertrust.com/UTN-USERFirst-Hardware.crl + + X509v3 Extended Key Usage: + TLS Web Server Authentication, IPSec End System, IPSec Tunnel, IPSec User + Signature Algorithm: sha1WithRSAEncryption + 47:19:0f:de:74:c6:99:97:af:fc:ad:28:5e:75:8e:eb:2d:67: + ee:4e:7b:2b:d7:0c:ff:f6:de:cb:55:a2:0a:e1:4c:54:65:93: + 60:6b:9f:12:9c:ad:5e:83:2c:eb:5a:ae:c0:e4:2d:f4:00:63: + 1d:b8:c0:6c:f2:cf:49:bb:4d:93:6f:06:a6:0a:22:b2:49:62: + 08:4e:ff:c8:c8:14:b2:88:16:5d:e7:01:e4:12:95:e5:45:34: + b3:8b:69:bd:cf:b4:85:8f:75:51:9e:7d:3a:38:3a:14:48:12: + c6:fb:a7:3b:1a:8d:0d:82:40:07:e8:04:08:90:a1:89:cb:19: + 50:df:ca:1c:01:bc:1d:04:19:7b:10:76:97:3b:ee:90:90:ca: + c4:0e:1f:16:6e:75:ef:33:f8:d3:6f:5b:1e:96:e3:e0:74:77: + 74:7b:8a:a2:6e:2d:dd:76:d6:39:30:82:f0:ab:9c:52:f2:2a: + c7:af:49:5e:7e:c7:68:e5:82:81:c8:6a:27:f9:27:88:2a:d5: + 58:50:95:1f:f0:3b:1c:57:bb:7d:14:39:62:2b:9a:c9:94:92: + 2a:a3:22:0c:ff:89:26:7d:5f:23:2b:47:d7:15:1d:a9:6a:9e: + 51:0d:2a:51:9e:81:f9:d4:3b:5e:70:12:7f:10:32:9c:1e:bb: + 9d:f8:66:a8 +MD5 Fingerprint=4C:56:41:E5:0D:BB:2B:E8:CA:A3:ED:18:08:AD:43:39 +-----BEGIN CERTIFICATE----- +MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCB +lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt +SGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgxOTIyWjCBlzELMAkG +A1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEe +MBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8v +d3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdh +cmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn +0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlIwrthdBKWHTxqctU8EGc6Oe0rE81m65UJ +M6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFdtqdt++BxF2uiiPsA3/4a +MXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8i4fDidNd +oI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqI +DsjfPe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9Ksy +oUhbAgMBAAGjgbkwgbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYD +VR0OBBYEFKFyXyYbKJhDlV0HN9WFlp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0 +dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNFUkZpcnN0LUhhcmR3YXJlLmNy +bDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEF +BQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM +//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28Gpgoiskli +CE7/yMgUsogWXecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gE +CJChicsZUN/KHAG8HQQZexB2lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t +3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kniCrVWFCVH/A7HFe7fRQ5YiuayZSS +KqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67nfhmqA== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 44:be:0c:8b:50:00:24:b4:11:d3:36:2d:e0:b3:5f:1b + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Object + Validity + Not Before: Jul 9 18:31:20 1999 GMT + Not After : Jul 9 18:40:36 2019 GMT + Subject: C=US, ST=UT, L=Salt Lake City, O=The USERTRUST Network, OU=http://www.usertrust.com, CN=UTN-USERFirst-Object + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:ce:aa:81:3f:a3:a3:61:78:aa:31:00:55:95:11: + 9e:27:0f:1f:1c:df:3a:9b:82:68:30:c0:4a:61:1d: + f1:2f:0e:fa:be:79:f7:a5:23:ef:55:51:96:84:cd: + db:e3:b9:6e:3e:31:d8:0a:20:67:c7:f4:d9:bf:94: + eb:47:04:3e:02:ce:2a:a2:5d:87:04:09:f6:30:9d: + 18:8a:97:b2:aa:1c:fc:41:d2:a1:36:cb:fb:3d:91: + ba:e7:d9:70:35:fa:e4:e7:90:c3:9b:a3:9b:d3:3c: + f5:12:99:77:b1:b7:09:e0:68:e6:1c:b8:f3:94:63: + 88:6a:6a:fe:0b:76:c9:be:f4:22:e4:67:b9:ab:1a: + 5e:77:c1:85:07:dd:0d:6c:bf:ee:06:c7:77:6a:41: + 9e:a7:0f:d7:fb:ee:94:17:b7:fc:85:be:a4:ab:c4: + 1c:31:dd:d7:b6:d1:e4:f0:ef:df:16:8f:b2:52:93: + d7:a1:d4:89:a1:07:2e:bf:e1:01:12:42:1e:1a:e1: + d8:95:34:db:64:79:28:ff:ba:2e:11:c2:e5:e8:5b: + 92:48:fb:47:0b:c2:6c:da:ad:32:83:41:f3:a5:e5: + 41:70:fd:65:90:6d:fa:fa:51:c4:f9:bd:96:2b:19: + 04:2c:d3:6d:a7:dc:f0:7f:6f:83:65:e2:6a:ab:87: + 86:75 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: + Digital Signature, Non Repudiation, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + DA:ED:64:74:14:9C:14:3C:AB:DD:99:A9:BD:5B:28:4D:8B:3C:C9:D8 + X509v3 CRL Distribution Points: + URI:http://crl.usertrust.com/UTN-USERFirst-Object.crl + + X509v3 Extended Key Usage: + Code Signing, Time Stamping, Microsoft Encrypted File System + Signature Algorithm: sha1WithRSAEncryption + 08:1f:52:b1:37:44:78:db:fd:ce:b9:da:95:96:98:aa:55:64: + 80:b5:5a:40:dd:21:a5:c5:c1:f3:5f:2c:4c:c8:47:5a:69:ea: + e8:f0:35:35:f4:d0:25:f3:c8:a6:a4:87:4a:bd:1b:b1:73:08: + bd:d4:c3:ca:b6:35:bb:59:86:77:31:cd:a7:80:14:ae:13:ef: + fc:b1:48:f9:6b:25:25:2d:51:b6:2c:6d:45:c1:98:c8:8a:56: + 5d:3e:ee:43:4e:3e:6b:27:8e:d0:3a:4b:85:0b:5f:d3:ed:6a: + a7:75:cb:d1:5a:87:2f:39:75:13:5a:72:b0:02:81:9f:be:f0: + 0f:84:54:20:62:6c:69:d4:e1:4d:c6:0d:99:43:01:0d:12:96: + 8c:78:9d:bf:50:a2:b1:44:aa:6a:cf:17:7a:cf:6f:0f:d4:f8: + 24:55:5f:f0:34:16:49:66:3e:50:46:c9:63:71:38:31:62:b8: + 62:b9:f3:53:ad:6c:b5:2b:a2:12:aa:19:4f:09:da:5e:e7:93: + c6:8e:14:08:fe:f0:30:80:18:a0:86:85:4d:c8:7d:d7:8b:03: + fe:6e:d5:f7:9d:16:ac:92:2c:a0:23:e5:9c:91:52:1f:94:df: + 17:94:73:c3:b3:c1:c1:71:05:20:00:78:bd:13:52:1d:a8:3e: + cd:00:1f:c8 +MD5 Fingerprint=A7:F2:E4:16:06:41:11:50:30:6B:9C:E3:B4:9C:B0:C9 +-----BEGIN CERTIFICATE----- +MIIEZjCCA06gAwIBAgIQRL4Mi1AAJLQR0zYt4LNfGzANBgkqhkiG9w0BAQUFADCB +lTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug +Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho +dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHTAbBgNVBAMTFFVUTi1VU0VSRmlyc3Qt +T2JqZWN0MB4XDTk5MDcwOTE4MzEyMFoXDTE5MDcwOTE4NDAzNlowgZUxCzAJBgNV +BAYTAlVTMQswCQYDVQQIEwJVVDEXMBUGA1UEBxMOU2FsdCBMYWtlIENpdHkxHjAc +BgNVBAoTFVRoZSBVU0VSVFJVU1QgTmV0d29yazEhMB8GA1UECxMYaHR0cDovL3d3 +dy51c2VydHJ1c3QuY29tMR0wGwYDVQQDExRVVE4tVVNFUkZpcnN0LU9iamVjdDCC +ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6qgT+jo2F4qjEAVZURnicP +HxzfOpuCaDDASmEd8S8O+r5596Uj71VRloTN2+O5bj4x2AogZ8f02b+U60cEPgLO +KqJdhwQJ9jCdGIqXsqoc/EHSoTbL+z2RuufZcDX65OeQw5ujm9M89RKZd7G3CeBo +5hy485RjiGpq/gt2yb70IuRnuasaXnfBhQfdDWy/7gbHd2pBnqcP1/vulBe3/IW+ +pKvEHDHd17bR5PDv3xaPslKT16HUiaEHLr/hARJCHhrh2JU022R5KP+6LhHC5ehb +kkj7RwvCbNqtMoNB86XlQXD9ZZBt+vpRxPm9lisZBCzTbafc8H9vg2XiaquHhnUC +AwEAAaOBrzCBrDALBgNVHQ8EBAMCAcYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQU2u1kdBScFDyr3ZmpvVsoTYs8ydgwQgYDVR0fBDswOTA3oDWgM4YxaHR0cDov +L2NybC51c2VydHJ1c3QuY29tL1VUTi1VU0VSRmlyc3QtT2JqZWN0LmNybDApBgNV +HSUEIjAgBggrBgEFBQcDAwYIKwYBBQUHAwgGCisGAQQBgjcKAwQwDQYJKoZIhvcN +AQEFBQADggEBAAgfUrE3RHjb/c652pWWmKpVZIC1WkDdIaXFwfNfLEzIR1pp6ujw +NTX00CXzyKakh0q9G7FzCL3Uw8q2NbtZhncxzaeAFK4T7/yxSPlrJSUtUbYsbUXB +mMiKVl0+7kNOPmsnjtA6S4ULX9Ptaqd1y9Fahy85dRNacrACgZ++8A+EVCBibGnU +4U3GDZlDAQ0Slox4nb9QorFEqmrPF3rPbw/U+CRVX/A0FklmPlBGyWNxODFiuGK5 +81OtbLUrohKqGU8J2l7nk8aOFAj+8DCAGKCGhU3IfdeLA/5u1fedFqySLKAj5ZyR +Uh+U3xeUc8OzwcFxBSAAeL0TUh2oPs0AH8g= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=EU, O=AC Camerfirma SA CIF A82743287, OU=http://www.chambersign.org, CN=Chambers of Commerce Root + Validity + Not Before: Sep 30 16:13:43 2003 GMT + Not After : Sep 30 16:13:44 2037 GMT + Subject: C=EU, O=AC Camerfirma SA CIF A82743287, OU=http://www.chambersign.org, CN=Chambers of Commerce Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b7:36:55:e5:a5:5d:18:30:e0:da:89:54:91:fc: + c8:c7:52:f8:2f:50:d9:ef:b1:75:73:65:47:7d:1b: + 5b:ba:75:c5:fc:a1:88:24:fa:2f:ed:ca:08:4a:39: + 54:c4:51:7a:b5:da:60:ea:38:3c:81:b2:cb:f1:bb: + d9:91:23:3f:48:01:70:75:a9:05:2a:ad:1f:71:f3: + c9:54:3d:1d:06:6a:40:3e:b3:0c:85:ee:5c:1b:79: + c2:62:c4:b8:36:8e:35:5d:01:0c:23:04:47:35:aa: + 9b:60:4e:a0:66:3d:cb:26:0a:9c:40:a1:f4:5d:98: + bf:71:ab:a5:00:68:2a:ed:83:7a:0f:a2:14:b5:d4: + 22:b3:80:b0:3c:0c:5a:51:69:2d:58:18:8f:ed:99: + 9e:f1:ae:e2:95:e6:f6:47:a8:d6:0c:0f:b0:58:58: + db:c3:66:37:9e:9b:91:54:33:37:d2:94:1c:6a:48: + c9:c9:f2:a5:da:a5:0c:23:f7:23:0e:9c:32:55:5e: + 71:9c:84:05:51:9a:2d:fd:e6:4e:2a:34:5a:de:ca: + 40:37:67:0c:54:21:55:77:da:0a:0c:cc:97:ae:80: + dc:94:36:4a:f4:3e:ce:36:13:1e:53:e4:ac:4e:3a: + 05:ec:db:ae:72:9c:38:8b:d0:39:3b:89:0a:3e:77: + fe:75 + Exponent: 3 (0x3) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:12 + X509v3 CRL Distribution Points: + URI:http://crl.chambersign.org/chambersroot.crl + + X509v3 Subject Key Identifier: + E3:94:F5:B1:4D:E9:DB:A1:29:5B:57:8B:4D:76:06:76:E1:D1:A2:8A + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:chambersroot@chambersign.org + X509v3 Issuer Alternative Name: + email:chambersroot@chambersign.org + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.17326.10.3.1 + CPS: http://cps.chambersign.org/cps/chambersroot.html + + Signature Algorithm: sha1WithRSAEncryption + 0c:41:97:c2:1a:86:c0:22:7c:9f:fb:90:f3:1a:d1:03:b1:ef: + 13:f9:21:5f:04:9c:da:c9:a5:8d:27:6c:96:87:91:be:41:90: + 01:72:93:e7:1e:7d:5f:f6:89:c6:5d:a7:40:09:3d:ac:49:45: + 45:dc:2e:8d:30:68:b2:09:ba:fb:c3:2f:cc:ba:0b:df:3f:77: + 7b:46:7d:3a:12:24:8e:96:8f:3c:05:0a:6f:d2:94:28:1d:6d: + 0c:c0:2e:88:22:d5:d8:cf:1d:13:c7:f0:48:d7:d7:05:a7:cf: + c7:47:9e:3b:3c:34:c8:80:4f:d4:14:bb:fc:0d:50:f7:fa:b3: + ec:42:5f:a9:dd:6d:c8:f4:75:cf:7b:c1:72:26:b1:01:1c:5c: + 2c:fd:7a:4e:b4:01:c5:05:57:b9:e7:3c:aa:05:d9:88:e9:07: + 46:41:ce:ef:41:81:ae:58:df:83:a2:ae:ca:d7:77:1f:e7:00: + 3c:9d:6f:8e:e4:32:09:1d:4d:78:34:78:34:3c:94:9b:26:ed: + 4f:71:c6:19:7a:bd:20:22:48:5a:fe:4b:7d:03:b7:e7:58:be: + c6:32:4e:74:1e:68:dd:a8:68:5b:b3:3e:ee:62:7d:d9:80:e8: + 0a:75:7a:b7:ee:b4:65:9a:21:90:e0:aa:d0:98:bc:38:b5:73: + 3c:8b:f8:dc +MD5 Fingerprint=B0:01:EE:14:D9:AF:29:18:94:76:8E:F1:69:33:2A:84 +-----BEGIN CERTIFICATE----- +MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEn +MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL +ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMg +b2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAxNjEzNDNaFw0zNzA5MzAxNjEzNDRa +MH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZpcm1hIFNBIENJRiBB +ODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3JnMSIw +IAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0B +AQEFAAOCAQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtb +unXF/KGIJPov7coISjlUxFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0d +BmpAPrMMhe5cG3nCYsS4No41XQEMIwRHNaqbYE6gZj3LJgqcQKH0XZi/caulAGgq +7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jWDA+wWFjbw2Y3npuRVDM3 +0pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFVd9oKDMyX +roDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIG +A1UdEwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5j +aGFtYmVyc2lnbi5vcmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p +26EpW1eLTXYGduHRooowDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIA +BzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hhbWJlcnNpZ24ub3JnMCcGA1Ud +EgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYDVR0gBFEwTzBN +BgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz +aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEB +AAxBl8IahsAifJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZd +p0AJPaxJRUXcLo0waLIJuvvDL8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi +1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wNUPf6s+xCX6ndbcj0dc97wXImsQEc +XCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/nADydb47kMgkdTXg0 +eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1erfu +tGWaIZDgqtCYvDi1czyL+Nw= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=EU, O=AC Camerfirma SA CIF A82743287, OU=http://www.chambersign.org, CN=Global Chambersign Root + Validity + Not Before: Sep 30 16:14:18 2003 GMT + Not After : Sep 30 16:14:18 2037 GMT + Subject: C=EU, O=AC Camerfirma SA CIF A82743287, OU=http://www.chambersign.org, CN=Global Chambersign Root + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:a2:70:a2:d0:9f:42:ae:5b:17:c7:d8:7d:cf:14: + 83:fc:4f:c9:a1:b7:13:af:8a:d7:9e:3e:04:0a:92: + 8b:60:56:fa:b4:32:2f:88:4d:a1:60:08:f4:b7:09: + 4e:a0:49:2f:49:d6:d3:df:9d:97:5a:9f:94:04:70: + ec:3f:59:d9:b7:cc:66:8b:98:52:28:09:02:df:c5: + 2f:84:8d:7a:97:77:bf:ec:40:9d:25:72:ab:b5:3f: + 32:98:fb:b7:b7:fc:72:84:e5:35:87:f9:55:fa:a3: + 1f:0e:6f:2e:28:dd:69:a0:d9:42:10:c6:f8:b5:44: + c2:d0:43:7f:db:bc:e4:a2:3c:6a:55:78:0a:77:a9: + d8:ea:19:32:b7:2f:fe:5c:3f:1b:ee:b1:98:ec:ca: + ad:7a:69:45:e3:96:0f:55:f6:e6:ed:75:ea:65:e8: + 32:56:93:46:89:a8:25:8a:65:06:ee:6b:bf:79:07: + d0:f1:b7:af:ed:2c:4d:92:bb:c0:a8:5f:a7:67:7d: + 04:f2:15:08:70:ac:92:d6:7d:04:d2:33:fb:4c:b6: + 0b:0b:fb:1a:c9:c4:8d:03:a9:7e:5c:f2:50:ab:12: + a5:a1:cf:48:50:a5:ef:d2:c8:1a:13:fa:b0:7f:b1: + 82:1c:77:6a:0f:5f:dc:0b:95:8f:ef:43:7e:e6:45: + 09:25 + Exponent: 3 (0x3) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:12 + X509v3 CRL Distribution Points: + URI:http://crl.chambersign.org/chambersignroot.crl + + X509v3 Subject Key Identifier: + 43:9C:36:9F:B0:9E:30:4D:C6:CE:5F:AD:10:AB:E5:03:A5:FA:A9:14 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + X509v3 Subject Alternative Name: + email:chambersignroot@chambersign.org + X509v3 Issuer Alternative Name: + email:chambersignroot@chambersign.org + X509v3 Certificate Policies: + Policy: 1.3.6.1.4.1.17326.10.1.1 + CPS: http://cps.chambersign.org/cps/chambersignroot.html + + Signature Algorithm: sha1WithRSAEncryption + 3c:3b:70:91:f9:04:54:27:91:e1:ed:ed:fe:68:7f:61:5d:e5: + 41:65:4f:32:f1:18:05:94:6a:1c:de:1f:70:db:3e:7b:32:02: + 34:b5:0c:6c:a1:8a:7c:a5:f4:8f:ff:d4:d8:ad:17:d5:2d:04: + d1:3f:58:80:e2:81:59:88:be:c0:e3:46:93:24:fe:90:bd:26: + a2:30:2d:e8:97:26:57:35:89:74:96:18:f6:15:e2:af:24:19: + 56:02:02:b2:ba:0f:14:ea:c6:8a:66:c1:86:45:55:8b:be:92: + be:9c:a4:04:c7:49:3c:9e:e8:29:7a:89:d7:fe:af:ff:68:f5: + a5:17:90:bd:ac:99:cc:a5:86:57:09:67:46:db:d6:16:c2:46: + f1:e4:a9:50:f5:8f:d1:92:15:d3:5f:3e:c6:00:49:3a:6e:58: + b2:d1:d1:27:0d:25:c8:32:f8:20:11:cd:7d:32:33:48:94:54: + 4c:dd:dc:79:c4:30:9f:eb:8e:b8:55:b5:d7:88:5c:c5:6a:24: + 3d:b2:d3:05:03:51:c6:07:ef:cc:14:72:74:3d:6e:72:ce:18: + 28:8c:4a:a0:77:e5:09:2b:45:44:47:ac:b7:67:7f:01:8a:05: + 5a:93:be:a1:c1:ff:f8:e7:0e:67:a4:47:49:76:5d:75:90:1a: + f5:26:8f:f0 +MD5 Fingerprint=C5:E6:7B:BF:06:D0:4F:43:ED:C4:7A:65:8A:FB:6B:19 +-----BEGIN CERTIFICATE----- +MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEn +MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL +ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENo +YW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYxNDE4WhcNMzcwOTMwMTYxNDE4WjB9 +MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgy +NzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEgMB4G +A1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUA +A4IBDQAwggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0 +Mi+ITaFgCPS3CU6gSS9J1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/s +QJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8Oby4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpV +eAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl6DJWk0aJqCWKZQbua795 +B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c8lCrEqWh +z0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0T +AQH/BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1i +ZXJzaWduLm9yZy9jaGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4w +TcbOX60Qq+UDpfqpFDAOBgNVHQ8BAf8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAH +MCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBjaGFtYmVyc2lnbi5vcmcwKgYD +VR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9yZzBbBgNVHSAE +VDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh +bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0B +AQUFAAOCAQEAPDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUM +bKGKfKX0j//U2K0X1S0E0T9YgOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXi +ryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJPJ7oKXqJ1/6v/2j1pReQvayZzKWG +VwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4IBHNfTIzSJRUTN3c +ecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREest2d/ +AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 259 (0x103) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=HU, ST=Hungary, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Kozjegyzoi (Class A) Tanusitvanykiado + Validity + Not Before: Feb 24 23:14:47 1999 GMT + Not After : Feb 19 23:14:47 2019 GMT + Subject: C=HU, ST=Hungary, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Kozjegyzoi (Class A) Tanusitvanykiado + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:bc:74:8c:0f:bb:4c:f4:37:1e:a9:05:82:d8:e6: + e1:6c:70:ea:78:b5:6e:d1:38:44:0d:a8:83:ce:5d: + d2:d6:d5:81:c5:d4:4b:e7:5b:94:70:26:db:3b:9d: + 6a:4c:62:f7:71:f3:64:d6:61:3b:3d:eb:73:a3:37: + d9:cf:ea:8c:92:3b:cd:f7:07:dc:66:74:97:f4:45: + 22:dd:f4:5c:e0:bf:6d:f3:be:65:33:e4:15:3a:bf: + db:98:90:55:38:c4:ed:a6:55:63:0b:b0:78:04:f4: + e3:6e:c1:3f:8e:fc:51:78:1f:92:9e:83:c2:fe:d9: + b0:a9:c9:bc:5a:00:ff:a9:a8:98:74:fb:f6:2c:3e: + 15:39:0d:b6:04:55:a8:0e:98:20:42:b3:b1:25:ad: + 7e:9a:6f:5d:53:b1:ab:0c:fc:eb:e0:f3:7a:b3:a8: + b3:ff:46:f6:63:a2:d8:3a:98:7b:b6:ac:85:ff:b0: + 25:4f:74:63:e7:13:07:a5:0a:8f:05:f7:c0:64:6f: + 7e:a7:27:80:96:de:d4:2e:86:60:c7:6b:2b:5e:73: + 7b:17:e7:91:3f:64:0c:d8:4b:22:34:2b:9b:32:f2: + 48:1f:9f:a1:0a:84:7a:e2:c2:ad:97:3d:8e:d5:c1: + f9:56:a3:50:e9:c6:b4:fa:98:a2:ee:95:e6:2a:03: + 8c:df + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:4 + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Netscape Comment: + FIGYELEM! Ezen tanusitvany a NetLock Kft. Altalanos Szolgaltatasi Felteteleiben leirt eljarasok alapjan keszult. A hitelesites folyamatat a NetLock Kft. termekfelelosseg-biztositasa vedi. A digitalis alairas elfogadasanak feltetele az eloirt ellenorzesi eljaras megtetele. Az eljaras leirasa megtalalhato a NetLock Kft. Internet honlapjan a https://www.netlock.net/docs cimen vagy kerheto az ellenorzes@netlock.net e-mail cimen. IMPORTANT! The issuance and the use of this certificate is subject to the NetLock CPS available at https://www.netlock.net/docs or by e-mail at cps@netlock.net. + Signature Algorithm: md5WithRSAEncryption + 48:24:46:f7:ba:56:6f:fa:c8:28:03:40:4e:e5:31:39:6b:26: + 6b:53:7f:db:df:df:f3:71:3d:26:c0:14:0e:c6:67:7b:23:a8: + 0c:73:dd:01:bb:c6:ca:6e:37:39:55:d5:c7:8c:56:20:0e:28: + 0a:0e:d2:2a:a4:b0:49:52:c6:38:07:fe:be:0a:09:8c:d1:98: + cf:ca:da:14:31:a1:4f:d2:39:fc:0f:11:2c:43:c3:dd:ab:93: + c7:55:3e:47:7c:18:1a:00:dc:f3:7b:d8:f2:7f:52:6c:20:f4: + 0b:5f:69:52:f4:ee:f8:b2:29:60:eb:e3:49:31:21:0d:d6:b5: + 10:41:e2:41:09:6c:e2:1a:9a:56:4b:77:02:f6:a0:9b:9a:27: + 87:e8:55:29:71:c2:90:9f:45:78:1a:e1:15:64:3d:d0:0e:d8: + a0:76:9f:ae:c5:d0:2e:ea:d6:0f:56:ec:64:7f:5a:9b:14:58: + 01:27:7e:13:50:c7:6b:2a:e6:68:3c:bf:5c:a0:0a:1b:e1:0e: + 7a:e9:e2:80:c3:e9:e9:f6:fd:6c:11:9e:d0:e5:28:27:2b:54: + 32:42:14:82:75:e6:4a:f0:2b:66:75:63:8c:a2:fb:04:3e:83: + 0e:9b:36:f0:18:e4:26:20:c3:8c:f0:28:07:ad:3c:17:66:88: + b5:fd:b6:88 +MD5 Fingerprint=86:38:6D:5E:49:63:6C:85:5C:DB:6D:DC:94:B7:D0:F7 +-----BEGIN CERTIFICATE----- +MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhV +MRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMe +TmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0 +dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBLb3pqZWd5em9pIChDbGFzcyBB +KSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oXDTE5MDIxOTIzMTQ0 +N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQHEwhC +dWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQu +MRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBL +b3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvHSMD7tM9DceqQWC2ObhbHDqeLVu0ThEDaiD +zl3S1tWBxdRL51uUcCbbO51qTGL3cfNk1mE7PetzozfZz+qMkjvN9wfcZnSX9EUi +3fRc4L9t875lM+QVOr/bmJBVOMTtplVjC7B4BPTjbsE/jvxReB+SnoPC/tmwqcm8 +WgD/qaiYdPv2LD4VOQ22BFWoDpggQrOxJa1+mm9dU7GrDPzr4PN6s6iz/0b2Y6LY +Oph7tqyF/7AlT3Rj5xMHpQqPBffAZG9+pyeAlt7ULoZgx2srXnN7F+eRP2QM2Esi +NCubMvJIH5+hCoR64sKtlz2O1cH5VqNQ6ca0+pii7pXmKgOM3wIDAQABo4ICnzCC +ApswDgYDVR0PAQH/BAQDAgAGMBIGA1UdEwEB/wQIMAYBAf8CAQQwEQYJYIZIAYb4 +QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1GSUdZRUxFTSEgRXplbiB0 +YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFub3MgU3pvbGdhbHRhdGFz +aSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBhbGFwamFuIGtlc3p1bHQu +IEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExvY2sgS2Z0LiB0ZXJtZWtm +ZWxlbG9zc2VnLWJpenRvc2l0YXNhIHZlZGkuIEEgZGlnaXRhbGlzIGFsYWlyYXMg +ZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUgYXogZWxvaXJ0IGVsbGVub3J6ZXNpIGVs +amFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJhc2EgbWVndGFsYWxoYXRv +IGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGphbiBhIGh0dHBzOi8vd3d3 +Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJoZXRvIGF6IGVsbGVub3J6 +ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBPUlRBTlQhIFRoZSBpc3N1 +YW5jZSBhbmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGlzIHN1YmplY3Qg +dG8gdGhlIE5ldExvY2sgQ1BTIGF2YWlsYWJsZSBhdCBodHRwczovL3d3dy5uZXRs +b2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBjcHNAbmV0bG9jay5uZXQuMA0G +CSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5ayZrU3/b39/zcT0mwBQO +xmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjPytoUMaFP +0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQ +QeJBCWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxk +f1qbFFgBJ34TUMdrKuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK +8CtmdWOMovsEPoMOmzbwGOQmIMOM8CgHrTwXZoi1/baI +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 105 (0x69) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Uzleti (Class B) Tanusitvanykiado + Validity + Not Before: Feb 25 14:10:22 1999 GMT + Not After : Feb 20 14:10:22 2019 GMT + Subject: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Uzleti (Class B) Tanusitvanykiado + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:b1:ea:04:ec:20:a0:23:c2:8f:38:60:cf:c7:46: + b3:d5:1b:fe:fb:b9:99:9e:04:dc:1c:7f:8c:4a:81: + 98:ee:a4:d4:ca:8a:17:b9:22:7f:83:0a:75:4c:9b: + c0:69:d8:64:39:a3:ed:92:a3:fd:5b:5c:74:1a:c0: + 47:ca:3a:69:76:9a:ba:e2:44:17:fc:4c:a3:d5:fe: + b8:97:88:af:88:03:89:1f:a4:f2:04:3e:c8:07:0b: + e6:f9:b3:2f:7a:62:14:09:46:14:ca:64:f5:8b:80: + b5:62:a8:d8:6b:d6:71:93:2d:b3:bf:09:54:58:ed: + 06:eb:a8:7b:dc:43:b1:a1:69 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:4 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Netscape Comment: + FIGYELEM! Ezen tanusitvany a NetLock Kft. Altalanos Szolgaltatasi Felteteleiben leirt eljarasok alapjan keszult. A hitelesites folyamatat a NetLock Kft. termekfelelosseg-biztositasa vedi. A digitalis alairas elfogadasanak feltetele az eloirt ellenorzesi eljaras megtetele. Az eljaras leirasa megtalalhato a NetLock Kft. Internet honlapjan a https://www.netlock.net/docs cimen vagy kerheto az ellenorzes@netlock.net e-mail cimen. IMPORTANT! The issuance and the use of this certificate is subject to the NetLock CPS available at https://www.netlock.net/docs or by e-mail at cps@netlock.net. + Signature Algorithm: md5WithRSAEncryption + 04:db:ae:8c:17:af:f8:0e:90:31:4e:cd:3e:09:c0:6d:3a:b0: + f8:33:4c:47:4c:e3:75:88:10:97:ac:b0:38:15:91:c6:29:96: + cc:21:c0:6d:3c:a5:74:cf:d8:82:a5:39:c3:65:e3:42:70:bb: + 22:90:e3:7d:db:35:76:e1:a0:b5:da:9f:70:6e:93:1a:30:39: + 1d:30:db:2e:e3:7c:b2:91:b2:d1:37:29:fa:b9:d6:17:5c:47: + 4f:e3:1d:38:eb:9f:d5:7b:95:a8:28:9e:15:4a:d1:d1:d0:2b: + 00:97:a0:e2:92:36:2b:63:ac:58:01:6b:33:29:50:86:83:f1: + 01:48 +MD5 Fingerprint=39:16:AA:B9:6A:41:E1:14:69:DF:9E:6C:3B:72:DC:B6 +-----BEGIN CERTIFICATE----- +MIIFSzCCBLSgAwIBAgIBaTANBgkqhkiG9w0BAQQFADCBmTELMAkGA1UEBhMCSFUx +ETAPBgNVBAcTCEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0 +b25zYWdpIEtmdC4xGjAYBgNVBAsTEVRhbnVzaXR2YW55a2lhZG9rMTIwMAYDVQQD +EylOZXRMb2NrIFV6bGV0aSAoQ2xhc3MgQikgVGFudXNpdHZhbnlraWFkbzAeFw05 +OTAyMjUxNDEwMjJaFw0xOTAyMjAxNDEwMjJaMIGZMQswCQYDVQQGEwJIVTERMA8G +A1UEBxMIQnVkYXBlc3QxJzAlBgNVBAoTHk5ldExvY2sgSGFsb3phdGJpenRvbnNh +Z2kgS2Z0LjEaMBgGA1UECxMRVGFudXNpdHZhbnlraWFkb2sxMjAwBgNVBAMTKU5l +dExvY2sgVXpsZXRpIChDbGFzcyBCKSBUYW51c2l0dmFueWtpYWRvMIGfMA0GCSqG +SIb3DQEBAQUAA4GNADCBiQKBgQCx6gTsIKAjwo84YM/HRrPVG/77uZmeBNwcf4xK +gZjupNTKihe5In+DCnVMm8Bp2GQ5o+2So/1bXHQawEfKOml2mrriRBf8TKPV/riX +iK+IA4kfpPIEPsgHC+b5sy96YhQJRhTKZPWLgLViqNhr1nGTLbO/CVRY7QbrqHvc +Q7GhaQIDAQABo4ICnzCCApswEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNVHQ8BAf8E +BAMCAAYwEQYJYIZIAYb4QgEBBAQDAgAHMIICYAYJYIZIAYb4QgENBIICURaCAk1G +SUdZRUxFTSEgRXplbiB0YW51c2l0dmFueSBhIE5ldExvY2sgS2Z0LiBBbHRhbGFu +b3MgU3pvbGdhbHRhdGFzaSBGZWx0ZXRlbGVpYmVuIGxlaXJ0IGVsamFyYXNvayBh +bGFwamFuIGtlc3p1bHQuIEEgaGl0ZWxlc2l0ZXMgZm9seWFtYXRhdCBhIE5ldExv +Y2sgS2Z0LiB0ZXJtZWtmZWxlbG9zc2VnLWJpenRvc2l0YXNhIHZlZGkuIEEgZGln +aXRhbGlzIGFsYWlyYXMgZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUgYXogZWxvaXJ0 +IGVsbGVub3J6ZXNpIGVsamFyYXMgbWVndGV0ZWxlLiBBeiBlbGphcmFzIGxlaXJh +c2EgbWVndGFsYWxoYXRvIGEgTmV0TG9jayBLZnQuIEludGVybmV0IGhvbmxhcGph +biBhIGh0dHBzOi8vd3d3Lm5ldGxvY2submV0L2RvY3MgY2ltZW4gdmFneSBrZXJo +ZXRvIGF6IGVsbGVub3J6ZXNAbmV0bG9jay5uZXQgZS1tYWlsIGNpbWVuLiBJTVBP +UlRBTlQhIFRoZSBpc3N1YW5jZSBhbmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmlj +YXRlIGlzIHN1YmplY3QgdG8gdGhlIE5ldExvY2sgQ1BTIGF2YWlsYWJsZSBhdCBo +dHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIG9yIGJ5IGUtbWFpbCBhdCBjcHNA +bmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4GBAATbrowXr/gOkDFOzT4JwG06 +sPgzTEdM43WIEJessDgVkcYplswhwG08pXTP2IKlOcNl40JwuyKQ433bNXbhoLXa +n3BukxowOR0w2y7jfLKRstE3Kfq51hdcR0/jHTjrn9V7lagonhVK0dHQKwCXoOKS +NitjrFgBazMpUIaD8QFI +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 104 (0x68) + Signature Algorithm: md5WithRSAEncryption + Issuer: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Expressz (Class C) Tanusitvanykiado + Validity + Not Before: Feb 25 14:08:11 1999 GMT + Not After : Feb 20 14:08:11 2019 GMT + Subject: C=HU, L=Budapest, O=NetLock Halozatbiztonsagi Kft., OU=Tanusitvanykiadok, CN=NetLock Expressz (Class C) Tanusitvanykiado + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (1024 bit) + Modulus (1024 bit): + 00:eb:ec:b0:6c:61:8a:23:25:af:60:20:e3:d9:9f: + fc:93:0b:db:5d:8d:b0:a1:b3:40:3a:82:ce:fd:75: + e0:78:32:03:86:5a:86:95:91:ed:53:fa:9d:40:fc: + e6:e8:dd:d9:5b:7a:03:bd:5d:f3:3b:0c:c3:51:79: + 9b:ad:55:a0:e9:d0:03:10:af:0a:ba:14:42:d9:52: + 26:11:22:c7:d2:20:cc:82:a4:9a:a9:fe:b8:81:76: + 9d:6a:b7:d2:36:75:3e:b1:86:09:f6:6e:6d:7e:4e: + b7:7a:ec:ae:71:84:f6:04:33:08:25:32:eb:74:ac: + 16:44:c6:e4:40:93:1d:7f:ad + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:4 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + Netscape Cert Type: + SSL CA, S/MIME CA, Object Signing CA + Netscape Comment: + FIGYELEM! Ezen tanusitvany a NetLock Kft. Altalanos Szolgaltatasi Felteteleiben leirt eljarasok alapjan keszult. A hitelesites folyamatat a NetLock Kft. termekfelelosseg-biztositasa vedi. A digitalis alairas elfogadasanak feltetele az eloirt ellenorzesi eljaras megtetele. Az eljaras leirasa megtalalhato a NetLock Kft. Internet honlapjan a https://www.netlock.net/docs cimen vagy kerheto az ellenorzes@netlock.net e-mail cimen. IMPORTANT! The issuance and the use of this certificate is subject to the NetLock CPS available at https://www.netlock.net/docs or by e-mail at cps@netlock.net. + Signature Algorithm: md5WithRSAEncryption + 10:ad:7f:d7:0c:32:80:0a:d8:86:f1:79:98:b5:ad:d4:cd:b3: + 36:c4:96:48:c1:5c:cd:9a:d9:05:2e:9f:be:50:eb:f4:26:14: + 10:2d:d4:66:17:f8:9e:c1:27:fd:f1:ed:e4:7b:4b:a0:6c:b5: + ab:9a:57:70:a6:ed:a0:a4:ed:2e:f5:fd:fc:bd:fe:4d:37:08: + 0c:bc:e3:96:83:22:f5:49:1b:7f:4b:2b:b4:54:c1:80:7c:99: + 4e:1d:d0:8c:ee:d0:ac:e5:92:fa:75:56:fe:64:a0:13:8f:b8: + b8:16:9d:61:05:67:80:c8:d0:d8:a5:07:02:34:98:04:8d:33: + 04:d4 +MD5 Fingerprint=4F:EB:F1:F0:70:C2:80:63:5D:58:9F:DA:12:3C:A9:C4 +-----BEGIN CERTIFICATE----- +MIIFTzCCBLigAwIBAgIBaDANBgkqhkiG9w0BAQQFADCBmzELMAkGA1UEBhMCSFUx +ETAPBgNVBAcTCEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0 +b25zYWdpIEtmdC4xGjAYBgNVBAsTEVRhbnVzaXR2YW55a2lhZG9rMTQwMgYDVQQD +EytOZXRMb2NrIEV4cHJlc3N6IChDbGFzcyBDKSBUYW51c2l0dmFueWtpYWRvMB4X +DTk5MDIyNTE0MDgxMVoXDTE5MDIyMDE0MDgxMVowgZsxCzAJBgNVBAYTAkhVMREw +DwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9u +c2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE0MDIGA1UEAxMr +TmV0TG9jayBFeHByZXNzeiAoQ2xhc3MgQykgVGFudXNpdHZhbnlraWFkbzCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA6+ywbGGKIyWvYCDj2Z/8kwvbXY2wobNA +OoLO/XXgeDIDhlqGlZHtU/qdQPzm6N3ZW3oDvV3zOwzDUXmbrVWg6dADEK8KuhRC +2VImESLH0iDMgqSaqf64gXadarfSNnU+sYYJ9m5tfk63euyucYT2BDMIJTLrdKwW +RMbkQJMdf60CAwEAAaOCAp8wggKbMBIGA1UdEwEB/wQIMAYBAf8CAQQwDgYDVR0P +AQH/BAQDAgAGMBEGCWCGSAGG+EIBAQQEAwIABzCCAmAGCWCGSAGG+EIBDQSCAlEW +ggJNRklHWUVMRU0hIEV6ZW4gdGFudXNpdHZhbnkgYSBOZXRMb2NrIEtmdC4gQWx0 +YWxhbm9zIFN6b2xnYWx0YXRhc2kgRmVsdGV0ZWxlaWJlbiBsZWlydCBlbGphcmFz +b2sgYWxhcGphbiBrZXN6dWx0LiBBIGhpdGVsZXNpdGVzIGZvbHlhbWF0YXQgYSBO +ZXRMb2NrIEtmdC4gdGVybWVrZmVsZWxvc3NlZy1iaXp0b3NpdGFzYSB2ZWRpLiBB +IGRpZ2l0YWxpcyBhbGFpcmFzIGVsZm9nYWRhc2FuYWsgZmVsdGV0ZWxlIGF6IGVs +b2lydCBlbGxlbm9yemVzaSBlbGphcmFzIG1lZ3RldGVsZS4gQXogZWxqYXJhcyBs +ZWlyYXNhIG1lZ3RhbGFsaGF0byBhIE5ldExvY2sgS2Z0LiBJbnRlcm5ldCBob25s +YXBqYW4gYSBodHRwczovL3d3dy5uZXRsb2NrLm5ldC9kb2NzIGNpbWVuIHZhZ3kg +a2VyaGV0byBheiBlbGxlbm9yemVzQG5ldGxvY2submV0IGUtbWFpbCBjaW1lbi4g +SU1QT1JUQU5UISBUaGUgaXNzdWFuY2UgYW5kIHRoZSB1c2Ugb2YgdGhpcyBjZXJ0 +aWZpY2F0ZSBpcyBzdWJqZWN0IHRvIHRoZSBOZXRMb2NrIENQUyBhdmFpbGFibGUg +YXQgaHR0cHM6Ly93d3cubmV0bG9jay5uZXQvZG9jcyBvciBieSBlLW1haWwgYXQg +Y3BzQG5ldGxvY2submV0LjANBgkqhkiG9w0BAQQFAAOBgQAQrX/XDDKACtiG8XmY +ta3UzbM2xJZIwVzNmtkFLp++UOv0JhQQLdRmF/iewSf98e3ke0ugbLWrmldwpu2g +pO0u9f38vf5NNwgMvOOWgyL1SRt/Syu0VMGAfJlOHdCM7tCs5ZL6dVb+ZKATj7i4 +Fp1hBWeAyNDYpQcCNJgEjTME1A== +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + 50:94:6c:ec:18:ea:d5:9c:4d:d5:97:ef:75:8f:a0:ad + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, OU=www.xrampsecurity.com, O=XRamp Security Services Inc, CN=XRamp Global Certification Authority + Validity + Not Before: Nov 1 17:14:04 2004 GMT + Not After : Jan 1 05:37:19 2035 GMT + Subject: C=US, OU=www.xrampsecurity.com, O=XRamp Security Services Inc, CN=XRamp Global Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:98:24:1e:bd:15:b4:ba:df:c7:8c:a5:27:b6:38: + 0b:69:f3:b6:4e:a8:2c:2e:21:1d:5c:44:df:21:5d: + 7e:23:74:fe:5e:7e:b4:4a:b7:a6:ad:1f:ae:e0:06: + 16:e2:9b:5b:d9:67:74:6b:5d:80:8f:29:9d:86:1b: + d9:9c:0d:98:6d:76:10:28:58:e4:65:b0:7f:4a:98: + 79:9f:e0:c3:31:7e:80:2b:b5:8c:c0:40:3b:11:86: + d0:cb:a2:86:36:60:a4:d5:30:82:6d:d9:6e:d0:0f: + 12:04:33:97:5f:4f:61:5a:f0:e4:f9:91:ab:e7:1d: + 3b:bc:e8:cf:f4:6b:2d:34:7c:e2:48:61:1c:8e:f3: + 61:44:cc:6f:a0:4a:a9:94:b0:4d:da:e7:a9:34:7a: + 72:38:a8:41:cc:3c:94:11:7d:eb:c8:a6:8c:b7:86: + cb:ca:33:3b:d9:3d:37:8b:fb:7a:3e:86:2c:e7:73: + d7:0a:57:ac:64:9b:19:eb:f4:0f:04:08:8a:ac:03: + 17:19:64:f4:5a:25:22:8d:34:2c:b2:f6:68:1d:12: + 6d:d3:8a:1e:14:da:c4:8f:a6:e2:23:85:d5:7a:0d: + bd:6a:e0:e9:ec:ec:17:bb:42:1b:67:aa:25:ed:45: + 83:21:fc:c1:c9:7c:d5:62:3e:fa:f2:c5:2d:d3:fd: + d4:65 + Exponent: 65537 (0x10001) + X509v3 extensions: + 1.3.6.1.4.1.311.20.2: + ...C.A + X509v3 Key Usage: + Digital Signature, Certificate Sign, CRL Sign + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Subject Key Identifier: + C6:4F:A2:3D:06:63:84:09:9C:CE:62:E4:04:AC:8D:5C:B5:E9:B6:1B + X509v3 CRL Distribution Points: + URI:http://crl.xrampsecurity.com/XGCA.crl + + 1.3.6.1.4.1.311.21.1: + ... + Signature Algorithm: sha1WithRSAEncryption + 91:15:39:03:01:1b:67:fb:4a:1c:f9:0a:60:5b:a1:da:4d:97: + 62:f9:24:53:27:d7:82:64:4e:90:2e:c3:49:1b:2b:9a:dc:fc: + a8:78:67:35:f1:1d:f0:11:bd:b7:48:e3:10:f6:0d:df:3f:d2: + c9:b6:aa:55:a4:48:ba:02:db:de:59:2e:15:5b:3b:9d:16:7d: + 47:d7:37:ea:5f:4d:76:12:36:bb:1f:d7:a1:81:04:46:20:a3: + 2c:6d:a9:9e:01:7e:3f:29:ce:00:93:df:fd:c9:92:73:89:89: + 64:9e:e7:2b:e4:1c:91:2c:d2:b9:ce:7d:ce:6f:31:99:d3:e6: + be:d2:1e:90:f0:09:14:79:5c:23:ab:4d:d2:da:21:1f:4d:99: + 79:9d:e1:cf:27:9f:10:9b:1c:88:0d:b0:8a:64:41:31:b8:0e: + 6c:90:24:a4:9b:5c:71:8f:ba:bb:7e:1c:1b:db:6a:80:0f:21: + bc:e9:db:a6:b7:40:f4:b2:8b:a9:b1:e4:ef:9a:1a:d0:3d:69: + 99:ee:a8:28:a3:e1:3c:b3:f0:b2:11:9c:cf:7c:40:e6:dd:e7: + 43:7d:a2:d8:3a:b5:a9:8d:f2:34:99:c4:d4:10:e1:06:fd:09: + 84:10:3b:ee:c4:4c:f4:ec:27:7c:42:c2:74:7c:82:8a:09:c9: + b4:03:25:bc +MD5 Fingerprint=A1:0B:44:B3:CA:10:D8:00:6E:9D:0F:D8:0F:92:0A:D1 +-----BEGIN CERTIFICATE----- +MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB +gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk +MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY +UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx +NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3 +dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy +dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB +dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6 +38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP +KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q +DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4 +qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa +JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi +PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P +BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs +jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0 +eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD +ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR +vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt +qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa +IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy +i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ +O+7ETPTsJ3xCwnR8gooJybQDJbw= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority + Validity + Not Before: Jun 29 17:06:20 2004 GMT + Not After : Jun 29 17:06:20 2034 GMT + Subject: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:de:9d:d7:ea:57:18:49:a1:5b:eb:d7:5f:48:86: + ea:be:dd:ff:e4:ef:67:1c:f4:65:68:b3:57:71:a0: + 5e:77:bb:ed:9b:49:e9:70:80:3d:56:18:63:08:6f: + da:f2:cc:d0:3f:7f:02:54:22:54:10:d8:b2:81:d4: + c0:75:3d:4b:7f:c7:77:c3:3e:78:ab:1a:03:b5:20: + 6b:2f:6a:2b:b1:c5:88:7e:c4:bb:1e:b0:c1:d8:45: + 27:6f:aa:37:58:f7:87:26:d7:d8:2d:f6:a9:17:b7: + 1f:72:36:4e:a6:17:3f:65:98:92:db:2a:6e:5d:a2: + fe:88:e0:0b:de:7f:e5:8d:15:e1:eb:cb:3a:d5:e2: + 12:a2:13:2d:d8:8e:af:5f:12:3d:a0:08:05:08:b6: + 5c:a5:65:38:04:45:99:1e:a3:60:60:74:c5:41:a5: + 72:62:1b:62:c5:1f:6f:5f:1a:42:be:02:51:65:a8: + ae:23:18:6a:fc:78:03:a9:4d:7f:80:c3:fa:ab:5a: + fc:a1:40:a4:ca:19:16:fe:b2:c8:ef:5e:73:0d:ee: + 77:bd:9a:f6:79:98:bc:b1:07:67:a2:15:0d:dd:a0: + 58:c6:44:7b:0a:3e:62:28:5f:ba:41:07:53:58:cf: + 11:7e:38:74:c5:f8:ff:b5:69:90:8f:84:74:ea:97: + 1b:af + Exponent: 3 (0x3) + X509v3 extensions: + X509v3 Subject Key Identifier: + D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 + X509v3 Authority Key Identifier: + keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 + DirName:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 32:4b:f3:b2:ca:3e:91:fc:12:c6:a1:07:8c:8e:77:a0:33:06: + 14:5c:90:1e:18:f7:08:a6:3d:0a:19:f9:87:80:11:6e:69:e4: + 96:17:30:ff:34:91:63:72:38:ee:cc:1c:01:a3:1d:94:28:a4: + 31:f6:7a:c4:54:d7:f6:e5:31:58:03:a2:cc:ce:62:db:94:45: + 73:b5:bf:45:c9:24:b5:d5:82:02:ad:23:79:69:8d:b8:b6:4d: + ce:cf:4c:ca:33:23:e8:1c:88:aa:9d:8b:41:6e:16:c9:20:e5: + 89:9e:cd:3b:da:70:f7:7e:99:26:20:14:54:25:ab:6e:73:85: + e6:9b:21:9d:0a:6c:82:0e:a8:f8:c2:0c:fa:10:1e:6c:96:ef: + 87:0d:c4:0f:61:8b:ad:ee:83:2b:95:f8:8e:92:84:72:39:eb: + 20:ea:83:ed:83:cd:97:6e:08:bc:eb:4e:26:b6:73:2b:e4:d3: + f6:4c:fe:26:71:e2:61:11:74:4a:ff:57:1a:87:0f:75:48:2e: + cf:51:69:17:a0:02:12:61:95:d5:d1:40:b2:10:4c:ee:c4:ac: + 10:43:a6:a5:9e:0a:d5:95:62:9a:0d:cf:88:82:c5:32:0c:e4: + 2b:9f:45:e6:0d:9f:28:9c:b1:b9:2a:5a:57:ad:37:0f:af:1d: + 7f:db:bd:9f +MD5 Fingerprint=91:DE:06:25:AB:DA:FD:32:17:0C:BB:25:17:2A:84:67 +-----BEGIN CERTIFICATE----- +MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh +MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE +YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3 +MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo +ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg +MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN +ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA +PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w +wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi +EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY +avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+ +YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE +sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h +/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5 +IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD +ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy +OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P +TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ +HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER +dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf +ReYNnyicsbkqWletNw+vHX/bvZ8= +-----END CERTIFICATE----- + + +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 0 (0x0) + Signature Algorithm: sha1WithRSAEncryption + Issuer: C=US, O=Starfield Technologies, Inc., OU=Starfield Class 2 Certification Authority + Validity + Not Before: Jun 29 17:39:16 2004 GMT + Not After : Jun 29 17:39:16 2034 GMT + Subject: C=US, O=Starfield Technologies, Inc., OU=Starfield Class 2 Certification Authority + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public Key: (2048 bit) + Modulus (2048 bit): + 00:b7:32:c8:fe:e9:71:a6:04:85:ad:0c:11:64:df: + ce:4d:ef:c8:03:18:87:3f:a1:ab:fb:3c:a6:9f:f0: + c3:a1:da:d4:d8:6e:2b:53:90:fb:24:a4:3e:84:f0: + 9e:e8:5f:ec:e5:27:44:f5:28:a6:3f:7b:de:e0:2a: + f0:c8:af:53:2f:9e:ca:05:01:93:1e:8f:66:1c:39: + a7:4d:fa:5a:b6:73:04:25:66:eb:77:7f:e7:59:c6: + 4a:99:25:14:54:eb:26:c7:f3:7f:19:d5:30:70:8f: + af:b0:46:2a:ff:ad:eb:29:ed:d7:9f:aa:04:87:a3: + d4:f9:89:a5:34:5f:db:43:91:82:36:d9:66:3c:b1: + b8:b9:82:fd:9c:3a:3e:10:c8:3b:ef:06:65:66:7a: + 9b:19:18:3d:ff:71:51:3c:30:2e:5f:be:3d:77:73: + b2:5d:06:6c:c3:23:56:9a:2b:85:26:92:1c:a7:02: + b3:e4:3f:0d:af:08:79:82:b8:36:3d:ea:9c:d3:35: + b3:bc:69:ca:f5:cc:9d:e8:fd:64:8d:17:80:33:6e: + 5e:4a:5d:99:c9:1e:87:b4:9d:1a:c0:d5:6e:13:35: + 23:5e:df:9b:5f:3d:ef:d6:f7:76:c2:ea:3e:bb:78: + 0d:1c:42:67:6b:04:d8:f8:d6:da:6f:8b:f2:44:a0: + 01:ab + Exponent: 3 (0x3) + X509v3 extensions: + X509v3 Subject Key Identifier: + BF:5F:B7:D1:CE:DD:1F:86:F4:5B:55:AC:DC:D7:10:C2:0E:A9:88:E7 + X509v3 Authority Key Identifier: + keyid:BF:5F:B7:D1:CE:DD:1F:86:F4:5B:55:AC:DC:D7:10:C2:0E:A9:88:E7 + DirName:/C=US/O=Starfield Technologies, Inc./OU=Starfield Class 2 Certification Authority + serial:00 + + X509v3 Basic Constraints: + CA:TRUE + Signature Algorithm: sha1WithRSAEncryption + 05:9d:3f:88:9d:d1:c9:1a:55:a1:ac:69:f3:f3:59:da:9b:01: + 87:1a:4f:57:a9:a1:79:09:2a:db:f7:2f:b2:1e:cc:c7:5e:6a: + d8:83:87:a1:97:ef:49:35:3e:77:06:41:58:62:bf:8e:58:b8: + 0a:67:3f:ec:b3:dd:21:66:1f:c9:54:fa:72:cc:3d:4c:40:d8: + 81:af:77:9e:83:7a:bb:a2:c7:f5:34:17:8e:d9:11:40:f4:fc: + 2c:2a:4d:15:7f:a7:62:5d:2e:25:d3:00:0b:20:1a:1d:68:f9: + 17:b8:f4:bd:8b:ed:28:59:dd:4d:16:8b:17:83:c8:b2:65:c7: + 2d:7a:a5:aa:bc:53:86:6d:dd:57:a4:ca:f8:20:41:0b:68:f0: + f4:fb:74:be:56:5d:7a:79:f5:f9:1d:85:e3:2d:95:be:f5:71: + 90:43:cc:8d:1f:9a:00:0a:87:29:e9:55:22:58:00:23:ea:e3: + 12:43:29:5b:47:08:dd:8c:41:6a:65:06:a8:e5:21:aa:41:b4: + 95:21:95:b9:7d:d1:34:ab:13:d6:ad:bc:dc:e2:3d:39:cd:bd: + 3e:75:70:a1:18:59:03:c9:22:b4:8f:9c:d5:5e:2a:d7:a5:b6: + d4:0a:6d:f8:b7:40:11:46:9a:1f:79:0e:62:bf:0f:97:ec:e0: + 2f:1f:17:94 +MD5 Fingerprint=32:4A:4B:BB:C8:63:69:9B:BE:74:9A:C6:DD:1D:46:24 +-----BEGIN CERTIFICATE----- +MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl +MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp +U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw +NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE +ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp +ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3 +DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf +8MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN ++lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0 +X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa +K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA +1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G +A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR +zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0 +YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD +bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w +DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3 +L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D +eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl +xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp +VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY +WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q= +-----END CERTIFICATE----- + + diff --git a/src/test/test_zlib_file b/src/test/test_zlib_file new file mode 100644 index 0000000000000000000000000000000000000000..a7466128dd38b5ebdccfe4ded69ebf17cf90c86c GIT binary patch literal 78 zcmV-U0I~lciwFoxYQsqY17l%hXk}q?V`yo1WjIhnQA<()OSCeys?M}Bur9VTG`3PI kO3KMk&bBf#G&3|XRkE&S1PWUz87f%=0NnF{6DR-x08%3xFaQ7m literal 0 HcmV?d00001 diff --git a/src/util/Makefile b/src/util/Makefile new file mode 100644 index 0000000000000..648647cf5d316 --- /dev/null +++ b/src/util/Makefile @@ -0,0 +1,11 @@ + +PROJECT_ROOT = ../.. +PROJECT_NAME = util + +AUTO_SOURCES_RECURSIVE = 1 + +CPPFLAGS += -DHAVE_UDP_REPLY_PORTS +include $(PROJECT_ROOT)/src/rules.mk + +TARGETS = $(STATIC_LIB) +all: $(TARGETS) diff --git a/src/util/async_func.h b/src/util/async_func.h new file mode 100644 index 0000000000000..4112206767a49 --- /dev/null +++ b/src/util/async_func.h @@ -0,0 +1,213 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CONCURRENCY_ASYNC_FUNC_H__ +#define __CONCURRENCY_ASYNC_FUNC_H__ + +#include "base.h" +#include +#include +#include "synchronizable.h" +#include "lock.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Invokes a function asynchrously. For example, + * + * class MyClass { + * public: + * void doJob(); + * }; + * + * MyClass obj; + * AsyncFunc func(&obj, &MyClasss::doJob); + * func.start(); // this will call obj.doJob() in a separate thread + * // do something else + * func.waitForEnd(); + * + * Asynchronous function is a slightly different way of thinking about threads. + * Maybe this can help people understand asynchronous function is actually a + * broader/identical view of running threads, + * + * class MyRunnable { + * public: + * void run(); + * }; + * + * MyRunnable thread; + * AsyncFunc func(&thread, &MyRunnable::run); + * thread.run(); + * + * Well, asynchronous function is sometimes more flexible in writing a server, + * because it can bind different threads to methods on the same object: + * + * class MyServer { + * public: + * void thread1(); + * void thread2(); + * }; + * + * MyServer server; + * AsyncFunc func1(&server, &MyServer::thread1); + * AsyncFunc func2(&server, &MyServer::thread2); + * func1.start(); + * func2.start(); + * ...now both threads are running, accessing the same server object. + * + * There is nothing wrong embedding the async function object itself in the + * class like this, + * + * class MyServer { + * public: + * MyServer() + * : m_thread1(this, &MyServer::thread1), + * : m_thread2(this, &MyServer::thread2) { + * } + * + * void thread1(); + * void thread2(); + * + * void start() { + * m_thread1.start(); + * m_thread2.start(); + * } + * + * private: + * AsyncFunc m_thread1; + * AsyncFunc m_thread2; + * }; + * + */ +class AsyncFuncImpl { +public: + typedef void PFN_THREAD_FUNC(void *); + + /** + * The global static to feed into pthread_create(), and this will delegate + * the work to AsyncFuncImpl::threadFuncImpl(). + */ + static void *ThreadFunc(void *obj) { + ((AsyncFuncImpl*)obj)->threadFuncImpl(); + return NULL; + } + + /** + * Called by AsyncFunc so we can call func(obj) back on thread running. + */ + AsyncFuncImpl(void *obj, PFN_THREAD_FUNC *func) + : m_stopped(false), m_obj(obj), m_func(func), m_threadId(0), + m_exceptioned(false) { + } + + /** + * Starts this thread. + */ + void start() { + pthread_create(&m_threadId, NULL, ThreadFunc, (void*)this); + ASSERT(m_threadId); + } + + /** + * Waits until this thread finishes running. + */ + void waitForEnd() { + if (m_threadId == 0) return; + + { + Lock lock(m_stopMonitor.getMutex()); + while (!m_stopped) { + m_stopMonitor.wait(); + } + } + + void *ret = NULL; + pthread_join(m_threadId, &ret); + m_threadId = 0; + + if (m_exceptioned) { + m_exceptioned = false; + throw m_exception; + } + } + + /** + * Starts and waits until this thread finishes running. + */ + void run() { + start(); + waitForEnd(); + } + +private: + Synchronizable m_stopMonitor; + bool m_stopped; + + void *m_obj; + PFN_THREAD_FUNC *m_func; + pthread_t m_threadId; + bool m_exceptioned; + std::exception m_exception; // exception was thrown and thread was terminated + + /** + * Called by ThreadFunc() to delegate the work. + */ + void threadFuncImpl() { + try { + m_func(m_obj); + } catch (std::exception &e) { + m_exceptioned = true; + m_exception = e; + // fall through, since we don't want a thread to abort abruptly + } + { + Lock lock(m_stopMonitor.getMutex()); + m_stopped = true; + m_stopMonitor.notify(); + } + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * We could have written AysncFunc directly with those methods implemented + * inside AsyncFuncImpl class, but this way we reduce sizes of our code by + * only templatizing a very minimal piece of code, sharing everything inside + * AsyncFuncImpl by all AsyncFunc classes. + */ +template +class AsyncFunc : public AsyncFuncImpl { +public: + AsyncFunc(T *obj, void (T::*member_func)()) + : AsyncFuncImpl((void*)this, run_), m_obj(obj), m_memberFunc(member_func) { + } + + static void run_(void *obj) { + AsyncFunc *p = (AsyncFunc*)obj; + (p->m_obj->*(p->m_memberFunc))(); + } + +private: + T *m_obj; + void (T::*m_memberFunc)(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __CONCURRENCY_ASYNC_FUNC_H__ diff --git a/src/util/async_job.cpp b/src/util/async_job.cpp new file mode 100644 index 0000000000000..6aa48874c1c54 --- /dev/null +++ b/src/util/async_job.cpp @@ -0,0 +1,20 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "async_job.h" + +/////////////////////////////////////////////////////////////////////////////// + diff --git a/src/util/async_job.h b/src/util/async_job.h new file mode 100644 index 0000000000000..5ad49ecca0658 --- /dev/null +++ b/src/util/async_job.h @@ -0,0 +1,180 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __ASYNC_JOB_H__ +#define __ASYNC_JOB_H__ + +#include "base.h" +#include "async_func.h" +#include "lock.h" +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helper, skip to JobDispatcher at below to read comments and usages... + +template +class JobDispatcher; + +template +class WorkerWrapper { +public: + WorkerWrapper(JobDispatcher &dispatcher) + : m_dispatcher(dispatcher), + m_func(this, &WorkerWrapper::doJob) { + } + + TWorker *getWorker() { return &m_worker;} + AsyncFunc > &getAsyncFunc() { + return m_func; + } + + void doJob() { + while (true) { + boost::shared_ptr job = m_dispatcher.getNextJob(); + if (!job) break; + m_worker.doJob(job); + } + } + +private: + JobDispatcher &m_dispatcher; + AsyncFunc > m_func; + TWorker m_worker; +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * The promise is to make job processing cross multi-worker as easy as + * possible. The final syntax is like, + * + * MyJobPtrVec jobs; + * // prepare job list in "jobs" + * + * JobDispatcher(jobs, 10).run(); + * + * or + * + * JobDispatcher dispatcher(jobs, 10); + * dispatcher.start(); + * // do something else; + * dispatcher.waitForEnd(); + * + * + * The only requirement is MyWorker has to be a class that implements this: + * + * class MyWorker { + * public: + * void doJob(MyJobPtr job); + * }; + */ +template +class JobDispatcher { + public: + JobDispatcher(std::vector > &jobs, + unsigned int workerCount, bool showStatus = false) + : m_index(0), m_jobs(jobs), m_showStatus(showStatus), m_lastPercent(0) { + std::random_shuffle(m_jobs.begin(), m_jobs.end()); + if (workerCount > jobs.size()) { + workerCount = jobs.size(); + } + m_workers.resize(workerCount); + for (unsigned int i = 0; i < m_workers.size(); i++) { + m_workers[i] = boost::shared_ptr > + (new WorkerWrapper(*this)); + } + } + + /** + * Start job processing asynchronously. + */ + void start() { + gettimeofday(&m_start, 0); + for (unsigned int i = 0; i < m_workers.size(); i++) { + m_workers[i]->getAsyncFunc().start(); + } + } + + /** + * Wait for all jobs finish running. + */ + void waitForEnd() { + for (unsigned int i = 0; i < m_workers.size(); i++) { + m_workers[i]->getAsyncFunc().waitForEnd(); + } + } + + /** + * Start job processing and wait for all jobs finish running. + */ + void run() { + if (m_workers.size() == 1) { + m_workers[0]->doJob(); + } else { + start(); + waitForEnd(); + } + } + + unsigned int getWorkerCount() { + return m_workers.size(); + } + + TWorker *getWorker(unsigned int i) { + ASSERT(i < m_workers.size()); + return m_workers[i]->getWorker(); + } + + void setStatus(int percent) { + if (percent > m_lastPercent) { + struct timeval tv; + gettimeofday(&tv, 0); + long diff = (tv.tv_sec - m_start.tv_sec ) * 1000000 + + (tv.tv_usec - m_start.tv_usec); + m_lastPercent = percent; + int seconds = diff / (percent * 10000); + printf("%d%% (ETA: %d sec or %d min or %d hours)\n", percent, + seconds, seconds/60, seconds/3600); + } + } + + boost::shared_ptr getNextJob() { + Lock lock(m_mutex); + if (m_index >= m_jobs.size()) { + return boost::shared_ptr(); + } + if (m_showStatus && m_index > m_workers.size()) { + setStatus((m_index - m_workers.size()) * 100 / m_jobs.size()); + } + return m_jobs[m_index++]; + } + + private: + Mutex m_mutex; + unsigned int m_index; + std::vector > &m_jobs; + std::vector > > m_workers; + bool m_showStatus; + int m_lastPercent; + struct timeval m_start; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __ASYNC_JOB_H__ diff --git a/src/util/atomic.cpp b/src/util/atomic.cpp new file mode 100644 index 0000000000000..ed8a040fd6539 --- /dev/null +++ b/src/util/atomic.cpp @@ -0,0 +1,23 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "atomic.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/atomic.h b/src/util/atomic.h new file mode 100644 index 0000000000000..98c15535a55e8 --- /dev/null +++ b/src/util/atomic.h @@ -0,0 +1,54 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __ATOMIC_H__ +#define __ATOMIC_H__ + +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) +#include +#else +#include +#endif + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +inline int atomic_inc(int &count) { + return __gnu_cxx::__exchange_and_add(&count, 1) + 1; +} + +inline int atomic_dec(int &count) { + return __gnu_cxx::__exchange_and_add(&count, -1) - 1; +} + +template +inline T atomic_add(T &mem, T val) { + T r; + asm volatile + ( + "lock\n\t" + "xadd %1, %0": + "+m"( mem ), "=r"( r ): // outputs (%0, %1) + "1"( val ): // inputs (%2 == %1) + "memory", "cc" // clobbers + ); + return r; +} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __ATOMIC_H__ diff --git a/src/util/base.h b/src/util/base.h new file mode 100644 index 0000000000000..23bb3dd9815d6 --- /dev/null +++ b/src/util/base.h @@ -0,0 +1,182 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __BASE_H__ +#define __BASE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// system includes + +typedef unsigned char uchar; +typedef unsigned char uint8; +typedef short int16; +typedef unsigned short uint16; +typedef int int32; +typedef unsigned int uint32; +typedef long long int64; +typedef unsigned long long uint64; + +#ifndef ULLONG_MAX +#define ULLONG_MAX 0xffffffffffffffffULL +#endif + +/////////////////////////////////////////////////////////////////////////////// +// stl classes + +#define hphp_hash_map __gnu_cxx::hash_map +#define hphp_hash_set __gnu_cxx::hash_set +#define hphp_hash __gnu_cxx::hash + +struct ltstr { + bool operator()(const char *s1, const char *s2) const { + return strcmp(s1, s2) < 0; + } +}; + +struct eqstr { + bool operator()(const char* s1, const char* s2) const { + return strcmp(s1, s2) == 0; + } +}; + +struct stdltstr { + bool operator()(const std::string &s1, const std::string &s2) const { + return strcmp(s1.c_str(), s2.c_str()) < 0; + } +}; + +struct stdltistr { + bool operator()(const std::string &s1, const std::string &s2) const { + return strcasecmp(s1.c_str(), s2.c_str()) < 0; + } +}; + +struct string_hash { + size_t operator()(const std::string &s) const { + return __gnu_cxx::__stl_hash_string(s.c_str()); + } +}; + +template +struct pointer_hash { + size_t operator() (const T *const &p) const { + return (size_t)p; + } +}; + +template +class hphp_const_char_map : + public hphp_hash_map, eqstr> { +}; + +template +class hphp_string_map : + public hphp_hash_map { +}; + +typedef hphp_hash_set, + eqstr> hphp_const_char_set; + +/////////////////////////////////////////////////////////////////////////////// +// boost + +#ifndef DECLARE_BOOST_TYPES + +#define DECLARE_BOOST_TYPES(classname) \ + class classname; \ + typedef boost::shared_ptr classname ## Ptr; \ + typedef boost::weak_ptr classname ## WeakPtr; \ + typedef boost::shared_ptr classname ## ConstPtr; \ + typedef std::vector classname ## PtrVec; \ + typedef std::set classname ## PtrSet; \ + typedef std::list classname ## PtrList; \ + typedef std::deque classname ## PtrQueue; \ + typedef __gnu_cxx::hash_map StringTo ## classname ## PtrMap; \ + typedef __gnu_cxx::hash_map StringTo ## classname ## PtrVecMap; \ + +#endif + +typedef boost::shared_ptr FilePtr; + +struct null_deleter { + void operator()(void const *) const { + } +}; + +struct file_closer { + void operator()(FILE *f) const { + if (f) fclose(f); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// debugging + +#include + +#ifndef ASSERT +#ifdef RELEASE +#define ASSERT(x) +#else +#define ASSERT(x) assert(x) +#endif +#endif + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __BASE_H__ diff --git a/src/util/capability.cpp b/src/util/capability.cpp new file mode 100644 index 0000000000000..a80eb8867b826 --- /dev/null +++ b/src/util/capability.cpp @@ -0,0 +1,117 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "capability.h" +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +static bool setInitialCapabilities() { + cap_t cap_d = cap_init(); + if (cap_d != NULL) { + cap_value_t cap_list[] = {CAP_NET_BIND_SERVICE, CAP_SYS_RESOURCE, + CAP_SETUID}; + cap_clear(cap_d); + + if (cap_set_flag(cap_d, CAP_PERMITTED, 3, cap_list, CAP_SET) < 0 || + cap_set_flag(cap_d, CAP_EFFECTIVE, 3, cap_list, CAP_SET) < 0) { + Logger::Error("cap_set_flag failed"); + return false; + } + + if (cap_set_proc(cap_d) == -1) { + Logger::Error("cap_set_proc failed"); + return false; + } + + if (cap_free(cap_d) == -1) { + Logger::Error("cap_free failed"); + return false; + } + + if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0) { + Logger::Error("prctl(PR_SET_KEEPCAPS) failed"); + return false; + } + prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); + return true; + } + return false; +} + +static bool setMinimalCapabilities() { + cap_t cap_d = cap_init(); + + if (cap_d != NULL) { + cap_value_t cap_list[] = {CAP_NET_BIND_SERVICE, CAP_SYS_RESOURCE}; + + cap_clear(cap_d); + + if (cap_set_flag(cap_d, CAP_PERMITTED, 2, cap_list, CAP_SET) < 0 || + cap_set_flag(cap_d, CAP_EFFECTIVE, 2, cap_list, CAP_SET) < 0) { + Logger::Error("cap_set_flag failed"); + return false; + } + + if (cap_set_proc(cap_d) == -1) { + Logger::Error("cap_set_proc failed"); + return false; + } + + if (cap_free(cap_d) == -1) { + Logger::Error("cap_free failed"); + return false; + } + + prctl(PR_SET_DUMPABLE, 1, 0, 0, 0); + return true; + } + return false; +} + +bool Capability::ChangeUnixUser(uid_t uid) { + if (setInitialCapabilities()) { + if (setuid(uid) < 0) { + Logger::Error("unable to drop privs: %s", strerror(errno)); + return false; + } + + if (!setMinimalCapabilities()) { + Logger::Error("unable to set minimal server capabiltiies"); + return false; + } + return true; + } + return false; +} + +bool Capability::ChangeUnixUser(const std::string &username) { + if (!username.empty()) { + struct passwd *pw = getpwnam(username.c_str()); + if (pw && pw->pw_uid) { + return ChangeUnixUser(pw->pw_uid); + } + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/capability.h b/src/util/capability.h new file mode 100644 index 0000000000000..fad7dde8dde64 --- /dev/null +++ b/src/util/capability.h @@ -0,0 +1,40 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CAPABILITY_H__ +#define __CAPABILITY_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class Capability { +public: + /** + * This sets the effective user ID of the current process, leaving + * capability of binding to system ports (< 1024) to the user. + */ + static bool ChangeUnixUser(uid_t uid); + static bool ChangeUnixUser(const std::string &username); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __CAPABILITY_H__ diff --git a/src/util/case_insensitive.h b/src/util/case_insensitive.h new file mode 100644 index 0000000000000..a373e72477095 --- /dev/null +++ b/src/util/case_insensitive.h @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_CASE_INSENSITIVE_H__ +#define __HPHP_CASE_INSENSITIVE_H__ + +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +struct eqstri { + bool operator()(const char* s1, const char* s2) const { + return strcasecmp(s1, s2) == 0; + } +}; +struct hashi { + size_t operator()(const char *s) const { + return hash_string_i(s, strlen(s)); + } +}; + +template +class hphp_const_char_imap : + public hphp_hash_map { +}; + +class hphp_const_char_iset : + public hphp_hash_set { +}; + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_CASE_INSENSITIVE_H__ diff --git a/src/util/compression.cpp b/src/util/compression.cpp new file mode 100644 index 0000000000000..4e1f9e23ea389 --- /dev/null +++ b/src/util/compression.cpp @@ -0,0 +1,595 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + | Copyright (c) 1997-2010 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. | + +----------------------------------------------------------------------+ +*/ + +#include "compression.h" +#include "logger.h" +#include "exception.h" + +#define PHP_ZLIB_MODIFIER 1000 +#define GZIP_HEADER_LENGTH 10 +#define GZIP_FOOTER_LENGTH 8 + +namespace HPHP { + +static const int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ +/////////////////////////////////////////////////////////////////////////////// +// This check_header() function is copied from zlib 1.2.3 and re-factored to +// work with in-memory buffers (than file streams). + +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.3, July 18th, 2005 + + Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define RESERVED 0xE0 /* bits 5..7: reserved */ + +/* =========================================================================== + Read a byte from a gz_stream; update next_in and avail_in. Return EOF + for end of file. + IN assertion: the stream s has been sucessfully opened for reading. +*/ +static int get_byte(z_stream &stream) { + if (stream.avail_in == 0) { + return EOF; + } + stream.avail_in--; + return *(stream.next_in)++; +} + +/* =========================================================================== + Check the gzip header of a gz_stream opened for reading. Set the stream + mode to transparent if the gzip magic header is not present; set s->err + to Z_DATA_ERROR if the magic header is present but the rest of the header + is incorrect. + IN assertion: the stream s has already been created sucessfully; + s->stream.avail_in is zero for the first time, but may be non-zero + for concatenated .gz files. +*/ +static int check_header(z_stream &stream) { + int method; /* method byte */ + int flags; /* flags byte */ + uInt len; + int c; + + /* Assure two bytes in the buffer so we can peek ahead -- handle case + where first byte of header is at the end of the buffer after the last + gzip segment */ + len = stream.avail_in; + if (len <= 2) { + return Z_DATA_ERROR; + } + + /* Peek ahead to check the gzip magic header */ + if (stream.next_in[0] != gz_magic[0] || stream.next_in[1] != gz_magic[1]) { + return Z_DATA_ERROR; + } + stream.avail_in -= 2; + stream.next_in += 2; + + /* Check the rest of the gzip header */ + method = get_byte(stream); + flags = get_byte(stream); + if (method != Z_DEFLATED || (flags & RESERVED) != 0) { + return Z_DATA_ERROR; + } + + /* Discard time, xflags and OS code: */ + for (len = 0; len < 6; len++) (void)get_byte(stream); + + if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ + len = (uInt)get_byte(stream); + len += ((uInt)get_byte(stream))<<8; + /* len is garbage if EOF but the loop below will quit anyway */ + while (len-- != 0 && get_byte(stream) != EOF) ; + } + if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ + while ((c = get_byte(stream)) != 0 && c != EOF) ; + } + if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ + while ((c = get_byte(stream)) != 0 && c != EOF) ; + } + if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ + for (len = 0; len < 2; len++) (void)get_byte(stream); + } + return stream.avail_in == 0 ? Z_DATA_ERROR : Z_OK; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool is_compressible_file(const char *filename) { + static const char *ext[] = { + "gif", "png", "jpeg", "jpg", "tiff", "swf", "zip", "gz", "cab" + }; + const char *dot = NULL; + for (const char *p = filename; *p; p++) { + if (*p == '.') dot = p; + } + if (dot) { + dot++; + for (unsigned int i = 0; i < sizeof(ext)/sizeof(ext[0]); i++) { + if (strcmp(dot, ext[i]) == 0) { + return false; + } + } + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// StreamCompressor + +StreamCompressor::StreamCompressor(int level, int encoding_mode, bool header) + : m_level(level), m_encoding(encoding_mode), m_header(header), + m_ended(false) { + if (level < -1 || level > 9) { + throw Exception("compression level(%ld) must be within -1..9", level); + } + if (encoding_mode != CODING_GZIP && encoding_mode != CODING_DEFLATE) { + throw Exception("encoding mode must be FORCE_GZIP or FORCE_DEFLATE"); + } + + m_stream.zalloc = Z_NULL; + m_stream.zfree = Z_NULL; + m_stream.opaque = Z_NULL; + m_stream.total_in = 0; + m_stream.next_in = Z_NULL; + m_stream.avail_in = 0; + m_stream.avail_out = 0; + m_stream.next_out = Z_NULL; + + m_crc = crc32(0L, Z_NULL, 0); + + int status; + switch (encoding_mode) { + case CODING_GZIP: + /* windowBits is passed < 0 to suppress zlib header & trailer */ + if ((status = deflateInit2(&m_stream, level, Z_DEFLATED, -MAX_WBITS, + MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY)) != Z_OK) { + throw Exception("%s", zError(status)); + } + break; + case CODING_DEFLATE: + if ((status = deflateInit(&m_stream, level)) != Z_OK) { + throw Exception("%s", zError(status)); + } + break; + } +} + +StreamCompressor::~StreamCompressor() { + if (!m_ended) { + deflateEnd(&m_stream); + } +} + +char *StreamCompressor::compress(const char *data, int &len, bool trailer) { + // middle chunks should never be zero size + ASSERT(len || trailer); + + m_stream.next_in = (Bytef *)data; + m_stream.avail_in = len; + m_stream.total_out = 0; + + m_stream.avail_out = m_stream.avail_in + + (m_stream.avail_in / PHP_ZLIB_MODIFIER) + 15 + 1; /* room for \0 */ + char *s2 = (char *)malloc + (m_stream.avail_out + GZIP_HEADER_LENGTH + + ((trailer && m_encoding == CODING_GZIP) ? GZIP_FOOTER_LENGTH : 0)); + + /* add gzip file header */ + bool header = m_header; + if (header) { + s2[0] = gz_magic[0]; + s2[1] = gz_magic[1]; + s2[2] = Z_DEFLATED; + s2[3] = s2[4] = s2[5] = s2[6] = s2[7] = s2[8] = 0; /* time set to 0 */ + s2[9] = 0x03; // OS_CODE + m_stream.next_out = (Bytef*)&(s2[GZIP_HEADER_LENGTH]); + m_header = false; // only the 1st chunnk got it + } else { + m_stream.next_out = (Bytef*)s2; + } + + int status = deflate(&m_stream, trailer ? Z_FINISH : Z_SYNC_FLUSH); + if (status == Z_BUF_ERROR || status == Z_STREAM_END) { + status = deflateEnd(&m_stream); + m_ended = true; + } + if (status == Z_OK) { + if (len) { + m_crc = crc32(m_crc, (const Bytef *)data, len); + } + int new_len = m_stream.total_out + (header ? GZIP_HEADER_LENGTH : 0); + len = new_len; + if (trailer && m_encoding == CODING_GZIP) { + len += GZIP_FOOTER_LENGTH; + char *strailer = s2 + new_len; + + /* write crc & stream.total_in in LSB order */ + strailer[0] = (char) m_crc & 0xFF; + strailer[1] = (char) (m_crc >> 8) & 0xFF; + strailer[2] = (char) (m_crc >> 16) & 0xFF; + strailer[3] = (char) (m_crc >> 24) & 0xFF; + strailer[4] = (char) m_stream.total_in & 0xFF; + strailer[5] = (char) (m_stream.total_in >> 8) & 0xFF; + strailer[6] = (char) (m_stream.total_in >> 16) & 0xFF; + strailer[7] = (char) (m_stream.total_in >> 24) & 0xFF; + strailer[8] = '\0'; + } else { + s2[len] = '\0'; + } + return s2; + } + + free(s2); + Logger::Error("%s", zError(status)); + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// + +char *gzencode(const char *data, int &len, int level, int encoding_mode) { + if (level < -1 || level > 9) { + Logger::Warning("compression level(%ld) must be within -1..9", level); + return NULL; + } + + if (encoding_mode != CODING_GZIP && encoding_mode != CODING_DEFLATE) { + Logger::Warning("encoding mode must be FORCE_GZIP or FORCE_DEFLATE"); + return NULL; + } + + z_stream stream; + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + + stream.next_in = (Bytef *)data; + stream.avail_in = len; + + stream.avail_out = stream.avail_in + (stream.avail_in / PHP_ZLIB_MODIFIER) + + 15 + 1; /* room for \0 */ + char *s2 = (char *)malloc + (stream.avail_out + GZIP_HEADER_LENGTH + + (encoding_mode == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0)); + + /* add gzip file header */ + s2[0] = gz_magic[0]; + s2[1] = gz_magic[1]; + s2[2] = Z_DEFLATED; + s2[3] = s2[4] = s2[5] = s2[6] = s2[7] = s2[8] = 0; /* time set to 0 */ + s2[9] = 0x03; // OS_CODE + + stream.next_out = (Bytef*)&(s2[GZIP_HEADER_LENGTH]); + + int status; + switch (encoding_mode) { + case CODING_GZIP: + /* windowBits is passed < 0 to suppress zlib header & trailer */ + if ((status = deflateInit2(&stream, level, Z_DEFLATED, -MAX_WBITS, + MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY)) != Z_OK) { + Logger::Warning("%s", zError(status)); + return false; + } + break; + case CODING_DEFLATE: + if ((status = deflateInit(&stream, level)) != Z_OK) { + Logger::Warning("%s", zError(status)); + return false; + } + break; + } + + status = deflate(&stream, Z_FINISH); + if (status != Z_STREAM_END) { + deflateEnd(&stream); + if (status == Z_OK) { + status = Z_BUF_ERROR; + } + } else { + status = deflateEnd(&stream); + } + + if (status == Z_OK) { + int old_len = len; + len = stream.total_out + GZIP_HEADER_LENGTH + + (encoding_mode == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0); + if (encoding_mode == CODING_GZIP) { + char *trailer = s2 + (stream.total_out + GZIP_HEADER_LENGTH); + uLong crc = crc32(0L, Z_NULL, 0); + + crc = crc32(crc, (const Bytef *)data, old_len); + + /* write crc & stream.total_in in LSB order */ + trailer[0] = (char) crc & 0xFF; + trailer[1] = (char) (crc >> 8) & 0xFF; + trailer[2] = (char) (crc >> 16) & 0xFF; + trailer[3] = (char) (crc >> 24) & 0xFF; + trailer[4] = (char) stream.total_in & 0xFF; + trailer[5] = (char) (stream.total_in >> 8) & 0xFF; + trailer[6] = (char) (stream.total_in >> 16) & 0xFF; + trailer[7] = (char) (stream.total_in >> 24) & 0xFF; + trailer[8] = '\0'; + } else { + s2[len] = '\0'; + } + return s2; + } + + free(s2); + Logger::Warning("%s", zError(status)); + return NULL; +} + +char *gzdecode(const char *data, int &len) { + z_stream stream; + stream.zalloc = (alloc_func) Z_NULL; + stream.zfree = (free_func) Z_NULL; + + unsigned long length; + int status; + unsigned int factor = 4, maxfactor = 16; + char *s2 = NULL; + do { + stream.next_in = (Bytef *)data; + stream.avail_in = (uInt)len + 1; /* there is room for \0 */ + if (check_header(stream) != Z_OK) { + Logger::Warning("gzdecode: header is in wrong format"); + return NULL; + } + + length = len * (1 << factor++); + if (s2) free(s2); + s2 = (char *)malloc(length); + + stream.next_out = (Bytef*)s2; + stream.avail_out = (uInt)length; + + /* init with -MAX_WBITS disables the zlib internal headers */ + status = inflateInit2(&stream, -MAX_WBITS); + if (status == Z_OK) { + status = inflate(&stream, Z_FINISH); + if (status != Z_STREAM_END) { + inflateEnd(&stream); + if (status == Z_OK) { + status = Z_BUF_ERROR; + } + } else { + status = inflateEnd(&stream); + } + } + } while (status == Z_BUF_ERROR && factor < maxfactor); + + if (status == Z_OK) { + len = stream.total_out; + s2[len] = '\0'; + return s2; + } + + free(s2); + Logger::Warning("%s", zError(status)); + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// + +char *gzcompress(const char *data, int &len, int level /* = -1 */) { + if (level < -1 || level > 9) { + Logger::Warning("compression level(%ld) must be within -1..9", level); + return NULL; + } + + unsigned long l2 = len + (len / PHP_ZLIB_MODIFIER) + 15 + 1; + char *s2 = (char *)malloc(l2); + if (!s2) { + return NULL; + } + + int status; + if (level >= 0) { + status = compress2((Bytef*)s2, &l2, (const Bytef*)data, len, level); + } else { + status = compress((Bytef*)s2, &l2, (const Bytef*)data, len); + } + + if (status == Z_OK) { + s2[l2] = '\0'; + len = l2; + return s2; + } + + free(s2); + Logger::Warning("%s", zError(status)); + return NULL; +} + +char *gzuncompress(const char *data, int &len, int limit /* = 0 */) { + if (limit < 0) { + Logger::Warning("length (%ld) must be greater or equal zero", limit); + return NULL; + } + + unsigned long plength = limit; + unsigned long length; + unsigned int factor = 4, maxfactor = 16; + char *s2 = NULL; + int status; + do { + length = plength ? plength : (unsigned long)len * (1 << factor++); + if (s2) free(s2); + s2 = (char *)malloc(length); + if (!s2) { + return false; + } + status = uncompress((Bytef*)s2, &length, (const Bytef*)data, len); + } while ((status == Z_BUF_ERROR) && (!plength) && (factor < maxfactor)); + + if (status == Z_OK) { + s2[length] = '\0'; + len = length; + return s2; + } + + free(s2); + Logger::Warning("%s", zError(status)); + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// + +char *gzdeflate(const char *data, int &len, int level /* = -1 */) { + if (level < -1 || level > 9) { + Logger::Warning("compression level(%ld) must be within -1..9", level); + return NULL; + } + + z_stream stream; + stream.data_type = Z_ASCII; + stream.zalloc = (alloc_func) Z_NULL; + stream.zfree = (free_func) Z_NULL; + stream.opaque = (voidpf) Z_NULL; + + stream.next_in = (Bytef *)data; + stream.avail_in = len; + + stream.avail_out = len + (len / PHP_ZLIB_MODIFIER) + 15 + 1; // room for \0 + + char *s2 = (char *)malloc(stream.avail_out); + if (!s2) { + return NULL; + } + + stream.next_out = (Bytef*)s2; + + /* init with -MAX_WBITS disables the zlib internal headers */ + int status = deflateInit2(&stream, level, Z_DEFLATED, -MAX_WBITS, + MAX_MEM_LEVEL, 0); + if (status == Z_OK) { + status = deflate(&stream, Z_FINISH); + if (status != Z_STREAM_END) { + deflateEnd(&stream); + if (status == Z_OK) { + status = Z_BUF_ERROR; + } + } else { + status = deflateEnd(&stream); + } + } + + if (status == Z_OK) { + len = stream.total_out; + s2[len] = '\0'; + return s2; + } + + free(s2); + Logger::Warning("%s", zError(status)); + return NULL; +} + +char *gzinflate(const char *data, int &len, int limit /* = 0 */) { + if (len == 0) { + return NULL; + } + + if (limit < 0) { + Logger::Warning("length (%ld) must be greater or equal zero", limit); + return NULL; + } + unsigned long plength = limit; + + z_stream stream; + stream.zalloc = (alloc_func) Z_NULL; + stream.zfree = (free_func) Z_NULL; + + unsigned long length; + int status; + unsigned int factor = 4, maxfactor = 16; + char *s2 = NULL; + do { + length = plength ? plength : (unsigned long)len * (1 << factor++); + if (s2) free(s2); + s2 = (char *)malloc(length); + if (!s2) { + return NULL; + } + + stream.next_in = (Bytef *)data; + stream.avail_in = (uInt)len + 1; /* there is room for \0 */ + + stream.next_out = (Bytef*)s2; + stream.avail_out = (uInt)length; + + /* init with -MAX_WBITS disables the zlib internal headers */ + status = inflateInit2(&stream, -MAX_WBITS); + if (status == Z_OK) { + status = inflate(&stream, Z_FINISH); + if (status != Z_STREAM_END) { + inflateEnd(&stream); + if (status == Z_OK) { + status = Z_BUF_ERROR; + } + } else { + status = inflateEnd(&stream); + } + } + } while ((status == Z_BUF_ERROR) && (!plength) && (factor < maxfactor)); + + if (status == Z_OK) { + len = stream.total_out; + s2[len] = '\0'; + return s2; + } + + free(s2); + Logger::Warning("%s", zError(status)); + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/compression.h b/src/util/compression.h new file mode 100644 index 0000000000000..3f28b0ebe026d --- /dev/null +++ b/src/util/compression.h @@ -0,0 +1,64 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __COMPRESSION_H__ +#define __COMPRESSION_H__ + +#include "base.h" +#include + +// encoding_mode +#define CODING_GZIP 1 +#define CODING_DEFLATE 2 + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +// inefficient way of testing whether a file can be compressed to smaller size +bool is_compressible_file(const char *filename); + +char *gzencode(const char *data, int &len, int level, int encoding_mode); +char *gzdecode(const char *data, int &len); +char *gzcompress(const char *data, int &len, int level = -1); +char *gzuncompress(const char *data, int &len, int limit = 0); +char *gzdeflate(const char *data, int &len, int level = -1); +char *gzinflate(const char *data, int &len, int limit = 0); + +/////////////////////////////////////////////////////////////////////////////// + +class StreamCompressor { +public: + StreamCompressor(int level, int encoding_mode, bool header); + ~StreamCompressor(); + + /** + * Compress one chunk a time. + */ + char *compress(const char *data, int &len, bool trailer); + +private: + int m_level; + int m_encoding; + bool m_header; + z_stream m_stream; + uLong m_crc; + bool m_ended; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __COMPRESSION_H__ diff --git a/src/util/config.h b/src/util/config.h new file mode 100644 index 0000000000000..a106aed652d25 --- /dev/null +++ b/src/util/config.h @@ -0,0 +1,74 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Whether to build bcmath as dynamic module */ +#define COMPILE_DL_BCMATH 1 + +/* Whether you have bcmath */ +#define HAVE_BCMATH 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 diff --git a/src/util/dataset.cpp b/src/util/dataset.cpp new file mode 100644 index 0000000000000..8bd2626f4f2d7 --- /dev/null +++ b/src/util/dataset.cpp @@ -0,0 +1,93 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "dataset.h" + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +const char *DataSet::getStringField(int field) const { + const char *value = getField(field); + return value ? value : ""; +} + +int DataSet::getIntField(int field) const { + const char *value = getField(field); + return value ? atoi(value) : 0; +} + +unsigned int DataSet::getUIntField(int field) const { + const char *value = getField(field); + return value ? atoi(value) : 0; +} + +long long DataSet::getInt64Field(int field) const { + const char *value = getField(field); + return value ? atoll(value) : 0; +} + +unsigned long long DataSet::getUInt64Field(int field) const { + const char *value = getField(field); + return value ? atoll(value) : 0; +} + +std::string DataSet::getRowString() const { + string ret; + + int nonameCount = 0; + for (int i = 0; i < getColCount(); i++) { + if (i > 0) ret += ", "; + ret += "'"; + const char *fieldName = getFields()[i].name; + if (fieldName && *fieldName) { + ret += fieldName; + } else { + ret += "Noname"; + ret += boost::lexical_cast(nonameCount++); + } + ret += "' => "; + const char *s = getField(i); + if (s) { + ret += "'"; + ret += escape(s); + ret += "'"; + } else { + ret += "NULL"; + } + } + return ret; +} + +std::string DataSet::escape(const char *s) { + string ret; + for (const char *p = s; *p; p++) { + switch (*p) { + case '\'': ret += "\\'" ; break; + case '\r': ret += "\\r" ; break; + case '\n': ret += "\\n" ; break; + case '\t': ret += "\\t" ; break; + case '\\': ret += "\\\\"; break; + default: + ret += *p; + } + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/dataset.h b/src/util/dataset.h new file mode 100644 index 0000000000000..b2947550c6605 --- /dev/null +++ b/src/util/dataset.h @@ -0,0 +1,87 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __DATASET_H__ +#define __DATASET_H__ + +#include "base.h" +#include + +namespace HPHP { + +DECLARE_BOOST_TYPES(DataSet); +/////////////////////////////////////////////////////////////////////////////// + +/** + * A class that stores a list of rows, so that one can iterate through them by + * + * int fieldIndex = ds.getFieldIndex("id"); + * for (ds.moveFirst(); ds.getRow(0); ds.moveNext()) { + * const char *value = ds.getField(0); + * unsigned int n = ds.getUIntField(fieldIndex); + * } + */ +class DataSet { + public: + virtual ~DataSet() {} + + /** + * Close dataset and free up resources. + */ + virtual void close() = 0; + + /** + * Informational functions. + */ + virtual int getRowCount() const = 0; + virtual int getColCount() const = 0; + virtual int getFieldIndex(const char *fieldName) = 0; + virtual MYSQL_FIELD *getFields() const = 0; + + /** + * Iteration functions. + */ + virtual void moveFirst() = 0; + virtual MYSQL_ROW getRow() const = 0; + virtual void moveNext() = 0; + + /** + * Field value retrieval. + */ + virtual const char *getField(int field) const = 0; + virtual int getFieldLength(int field) const = 0; + const char *getStringField(int field) const; // NULL will become "" + int getIntField(int field) const; + unsigned int getUIntField(int field) const; + long long getInt64Field(int field) const; + unsigned long long getUInt64Field(int field) const; + + /** + * Returns a one-liner of all fields of current row. + */ + std::string getRowString() const; + + private: + /** + * Helper function for getRowString(). + */ + static std::string escape(const char *s); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __DATASET_H__ diff --git a/src/util/db_conn.cpp b/src/util/db_conn.cpp new file mode 100644 index 0000000000000..e2f0341135273 --- /dev/null +++ b/src/util/db_conn.cpp @@ -0,0 +1,360 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "db_conn.h" +#include "db_query.h" +#include "exception.h" +#include "lock.h" +#include "async_job.h" +#include "util.h" +#include + +using namespace std; +using namespace boost; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// Class ServerData + +int ServerData::DefaultPort = 3306; +std::string ServerData::DefaultUsername = "root"; +std::string ServerData::DefaultPassword = ""; + +static void parseColonPair(std::string &s, size_t pos, + std::string &part1, std::string &part2) { + string tmp = s.substr(0, pos); + s = s.substr(pos + 1); + pos = tmp.find(':'); + if (pos == string::npos) { + part1 = tmp; + } else { + part1 = tmp.substr(0, pos); + part2 = tmp.substr(pos + 1); + } +} + +ServerDataPtr ServerData::Create(const std::string &connection) { + ServerDataPtr server(new ServerData()); + string s = connection; + + size_t pos = s.find('@'); + if (pos != string::npos) { + parseColonPair(s, pos, server->m_username, server->m_password); + } + + pos = s.find('/'); + if (pos != string::npos) { + string port; + parseColonPair(s, pos, server->m_ip, port); + if (!port.empty()) server->m_port = atoi(port.c_str()); + } + + server->m_database = s; + return server; +} + +ServerData::ServerData() : m_port(0) { +} + +ServerData::ServerData(const char *ip, const char *database, + int port /* = 0 */, const char *username /* = NULL */, + const char *password /* = NULL */) : m_port(port) { + if (ip) m_ip = ip; + if (database) m_database = database; + if (username) m_username = username; + if (password) m_password = password; +} + +int ServerData::getPort() const { + return m_port > 0 ? m_port : DefaultPort; +} + +const std::string &ServerData::getUserName() const { + return m_username.empty() ? DefaultUsername : m_username; +} + +const std::string &ServerData::getPassword() const { + return m_password.empty() ? DefaultPassword : m_password; +} + +/////////////////////////////////////////////////////////////////////////////// +// static members + +unsigned int DBConn::DefaultWorkerCount = 50; +unsigned int DBConn::DefaultConnectTimeout = 1000; +unsigned int DBConn::DefaultReadTimeout = 1000; + +Mutex DBConn::s_mutex; +ServerDataPtrVec DBConn::s_localDatabases; + +void DBConn::clearLocalDatabases() { + Lock lock(s_mutex); + s_localDatabases.clear(); + s_localDatabases.reserve(32 * 1024); +} + +void DBConn::addLocalDB(unsigned int dbId, const char *ip, const char *db) { + if (dbId < 102400) { + Lock lock(s_mutex); + if (s_localDatabases.size() <= dbId) { + s_localDatabases.resize(dbId + 1); + } + s_localDatabases[dbId] = ServerDataPtr(new ServerData(ip, db)); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +DBConn::DBConn() + : m_conn(NULL), m_connectTimeout(DefaultConnectTimeout), + m_readTimeout(DefaultReadTimeout) { +} + +DBConn::~DBConn() { + close(); +} + +void DBConn::open(ServerDataPtr server, int connectTimeout /* = -1 */, + int readTimeout /* = -1 */) { + if (isOpened()) { + close(); + } + + if (connectTimeout <= 0) connectTimeout = DefaultConnectTimeout; + if (readTimeout <= 0) readTimeout = DefaultReadTimeout; + + m_conn = mysql_init(NULL); + mysql_options(m_conn, MYSQL_OPT_CONNECT_TIMEOUT_MS, + (const char*)&connectTimeout); + mysql_options(m_conn, MYSQL_OPT_READ_TIMEOUT_MS, + (const char*)&readTimeout); + MYSQL *ret = mysql_real_connect(m_conn, server->getIP().c_str(), + server->getUserName().c_str(), + server->getPassword().c_str(), + server->getDatabase().c_str(), + server->getPort(), NULL, 0); + if (!ret) { + const char *msg = mysql_error(m_conn); + string smsg = msg ? msg : ""; + mysql_close(m_conn); + m_conn = NULL; + throw DBConnectionException(server->getIP().c_str(), + server->getDatabase().c_str(), + smsg.c_str()); + } + + m_server = server; + m_connectTimeout = connectTimeout; + m_readTimeout = readTimeout; +} + +void DBConn::close() { + if (isOpened()) { + mysql_close(m_conn); + m_conn = NULL; + m_server.reset(); + } +} + +void DBConn::escapeString(const char *s, std::string &out) { + escapeString(s, strlen(s), out); +} + +void DBConn::escapeString(const char *s, int len, std::string &out) { + ASSERT(s); + ASSERT(isOpened()); + + if (len) { + char *buffer = (char*)malloc(len * 2 + 1); + mysql_real_escape_string(m_conn, buffer, s, len); + out = buffer; + free(buffer); + } +} + +int DBConn::execute(const std::string &sql, DBDataSet *ds /* = NULL */, + bool retryQueryOnFail /* = true */) { + return execute(sql.c_str(), ds, retryQueryOnFail); +} + +int DBConn::execute(const char *sql, DBDataSet *ds /* = NULL */, + bool retryQueryOnFail /* = true */) { + ASSERT(sql && *sql); + ASSERT(isOpened()); + + { + bool failure; + if ((failure = mysql_query(m_conn, sql))) { + if (retryQueryOnFail) { + open(m_server, m_connectTimeout, m_readTimeout); + failure = mysql_query(m_conn, sql); + } + if (failure) { + throw DatabaseException("Failed to execute SQL '%s': %s", sql, + mysql_error(m_conn)); + } + } + } + + MYSQL_RES *result = mysql_store_result(m_conn); + if (!result && mysql_errno(m_conn)) { + throw DatabaseException("Failed to execute SQL '%s': %s", sql, + mysql_error(m_conn)); + } + + int affected = mysql_affected_rows(m_conn); + if (ds) { + ds->addResult(m_conn, result); + } else { + mysql_free_result(result); + } + return affected; +} + +int DBConn::getLastInsertId() { + ASSERT(isOpened()); + return mysql_insert_id(m_conn); +} + +int DBConn::parallelExecute(const char *sql, DBDataSet &ds, + map &errors, int maxThread, + bool retryQueryOnFail, int connectTimeout, + int readTimeout) { + ASSERT(sql && *sql); + + if (s_localDatabases.empty()) { + return -1; + } + + QueryJobPtrVec jobs; + Mutex mutex; + jobs.reserve(s_localDatabases.size()); + string ssql = sql; // so we have copy-on-write in the loop + for (unsigned int i = 0; i < s_localDatabases.size(); i++) { + ServerDataPtr server = s_localDatabases[i]; + if (server) { + jobs.push_back(QueryJobPtr(new QueryJob(server, ssql, i, mutex, ds, + retryQueryOnFail, connectTimeout, + readTimeout))); + } + } + return parallelExecute(jobs, errors, maxThread); +} + +int DBConn::parallelExecute(const ServerQueryVec &sqls, DBDataSet &ds, + map &errors, int maxThread, + bool retryQueryOnFail, int connectTimeout, + int readTimeout) { + if (sqls.empty()) { + return 0; + } + + QueryJobPtrVec jobs; + Mutex mutex; + jobs.reserve(sqls.size()); + for (unsigned int i = 0; i < sqls.size(); i++) { + const ServerQuery &query = sqls[i]; + + QueryJobPtr job(new QueryJob(query.first, query.second, i, mutex, ds, + retryQueryOnFail, connectTimeout, + readTimeout)); + jobs.push_back(job); + } + return parallelExecute(jobs, errors, maxThread); +} + +int DBConn::parallelExecute(const ServerQueryVec &sqls, + DBDataSetPtrVec &dss, + map &errors, int maxThread, + bool retryQueryOnFail, int connectTimeout, + int readTimeout) { + ASSERT(sqls.size() == dss.size()); + + if (sqls.empty()) { + return 0; + } + + QueryJobPtrVec jobs; + Mutex mutex; + jobs.reserve(sqls.size()); + for (unsigned int i = 0; i < sqls.size(); i++) { + const ServerQuery &query = sqls[i]; + + QueryJobPtr job(new QueryJob(query.first, query.second, i, mutex, + *dss[i], retryQueryOnFail, connectTimeout, + readTimeout)); + jobs.push_back(job); + } + return parallelExecute(jobs, errors, maxThread); +} + +int DBConn::parallelExecute(QueryJobPtrVec &jobs, + map &errors, int maxThread) { + if (maxThread <= 0) maxThread = DefaultWorkerCount; + JobDispatcher(jobs, maxThread).run(); + + int affected = 0; + for (unsigned int i = 0; i < jobs.size(); i++) { + QueryJobPtr job = jobs[i]; + + int count = job->m_affected; + if (count >= 0) { + affected += count; + } else { + errors[job->m_index] = job->m_error; + } + } + return affected; +} + +void DBConn::QueryWorker::doJob(QueryJobPtr job) { + string &sql = job->m_sql; + Util::replaceAll(sql, "INDEX", lexical_cast(job->m_index).c_str()); + + if (!job->m_server) { + job->m_affected = -1; + job->m_error = "(server info missing)"; + return; + } + + try { + DBConn conn; + conn.open(job->m_server, job->m_connectTimeout, job->m_readTimeout); + + if (job->m_dsResult) { + DBDataSet ds; + job->m_affected = conn.execute(sql.c_str(), &ds, + job->m_retryQueryOnFail); + Lock lock(*job->m_dsMutex); + job->m_dsResult->addDataSet(ds); + } else { + job->m_affected = conn.execute(sql.c_str(), NULL, + job->m_retryQueryOnFail); + } + } catch (Exception e) { + job->m_affected = -1; + job->m_error = e.getMessage(); + } catch (std::exception &e) { + job->m_affected = -1; + job->m_error = e.what(); + } catch (...) { + job->m_affected = -1; + job->m_error = "(unknown exception)"; + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/db_conn.h b/src/util/db_conn.h new file mode 100644 index 0000000000000..b67b7e6f76465 --- /dev/null +++ b/src/util/db_conn.h @@ -0,0 +1,184 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __DB_CONN_H__ +#define __DB_CONN_H__ + +#include "db_dataset.h" +#include "mutex.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * What it takes to connect to a MySQL server. + */ +DECLARE_BOOST_TYPES(ServerData); +class ServerData { + public: + static int DefaultPort; + static std::string DefaultUsername; + static std::string DefaultPassword; + + /** + * Connection string is in this format: + * + * username:password@server:port/database + */ + static ServerDataPtr Create(const std::string &connection); + + public: + ServerData(); + ServerData(const char *ip, const char *database, int port = 0, + const char *username = NULL, const char *password = NULL); + + const std::string &getIP() const { return m_ip;} + int getPort() const; + const std::string &getUserName() const; + const std::string &getPassword() const; + const std::string &getDatabase() const { return m_database;} + + private: + std::string m_ip; + int m_port; + std::string m_username; + std::string m_password; + std::string m_database; +}; + +typedef std::pair ServerQuery; +typedef std::vector ServerQueryVec; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * A connection class that connects to any of our databases. + */ +class DBConn { + public: + static unsigned int DefaultWorkerCount; // for parallel executions + static unsigned int DefaultConnectTimeout; + static unsigned int DefaultReadTimeout; + + public: + DBConn(); + ~DBConn(); + + /** + * Open a database by specifying a type and an id. + */ + void open(ServerDataPtr server, int connectTimeout = -1, + int readTimeout = -1); + + /** + * Run an SQL and return number of affected rows. Consider DBQuery class, + * instead of directly calling this function. + */ + int execute(const std::string &sql, DBDataSet *ds = NULL, + bool retryQueryOnFail = true); + int execute(const char *sql, DBDataSet *ds = NULL, + bool retryQueryOnFail = true); + + /** + * Returns newly created id from most recent insertion. + */ + int getLastInsertId(); + + /** + * Query local dbs in parallel. Returns number of total affecected rows. + * Use "DBID" for any place in the query that needs to be replaced by dbId. + * For example, "SELECT DBID as dbid, count(*) as count FROM ...". + */ + static int parallelExecute + (const char *sql, DBDataSet &ds, std::map &errors, + int maxThread, bool retryQueryOnFail = true, + int connectTimeout = -1, int readTimeout = -1); + static int parallelExecute + (const ServerQueryVec &sqls, DBDataSet &ds, + std::map &errors, int maxThread, + bool retryQueryOnFail = true, + int connectTimeout = -1, int readTimeout = -1); + static int parallelExecute + (const ServerQueryVec &sqls, DBDataSetPtrVec &dss, + std::map &errors, int maxThread, + bool retryQueryOnFail = true, + int connectTimeout = -1, int readTimeout = -1); + + /** + * Put a connection back to pool. + */ + void close(); + + /** + * Whether or not a connection is opened. + */ + bool isOpened() const { return m_conn != NULL;} + + /** + * Helper function for escaping strings in SQLs. + */ + void escapeString(const char *s, std::string &out); + void escapeString(const char *s, int len, std::string &out); + + static void clearLocalDatabases(); + static void addLocalDB(unsigned int dbId, const char *ip, const char *db); + + private: + static Mutex s_mutex; + static ServerDataPtrVec s_localDatabases; + + MYSQL *m_conn; + ServerDataPtr m_server; + unsigned int m_connectTimeout; + unsigned int m_readTimeout; + + class QueryJob { + public: + QueryJob(ServerDataPtr server, const std::string sql, int index, + Mutex &mutex, DBDataSet &dsResult, bool retryQueryOnFail, + unsigned int readTimeout, unsigned int connectTimeout) + : m_server(server), m_sql(sql), m_index(index), + m_affected(0), m_dsMutex(&mutex), m_dsResult(&dsResult), + m_retryQueryOnFail(retryQueryOnFail), m_connectTimeout(connectTimeout), + m_readTimeout(readTimeout) {} + + ServerDataPtr m_server; + std::string m_sql; + int m_index; + int m_affected; + Mutex *m_dsMutex; + DBDataSet *m_dsResult; + std::string m_error; + bool m_retryQueryOnFail; + int m_connectTimeout; + int m_readTimeout; + }; + DECLARE_BOOST_TYPES(QueryJob); + + class QueryWorker { + public: + void doJob(QueryJobPtr job); + }; + + static int parallelExecute(QueryJobPtrVec &jobs, + std::map &errors, + int maxThread); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __DB_CONN_H__ diff --git a/src/util/db_dataset.cpp b/src/util/db_dataset.cpp new file mode 100644 index 0000000000000..dc844eb3debb1 --- /dev/null +++ b/src/util/db_dataset.cpp @@ -0,0 +1,165 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "db_dataset.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DBDataSet::DBDataSet() + : m_fields(NULL), m_rowCount(0), m_colCount(0), + m_row(NULL), m_lengths(NULL) { +} + +DBDataSet::~DBDataSet() { + close(); +} + +void DBDataSet::addResult(MYSQL *conn, MYSQL_RES *result) { + if (result == NULL) return; + + int rowCount = mysql_num_rows(result); + if (rowCount) { + int fieldCount = (int)mysql_field_count(conn); + if (m_colCount == 0) { + m_colCount = fieldCount; + } else { + ASSERT(m_colCount == fieldCount); + if (m_colCount > fieldCount) { + m_colCount = fieldCount; // in case we overflow m_row later + } + } + + m_rowCount += rowCount; + m_results.push_back(result); + } else { + mysql_free_result(result); + } +} + +void DBDataSet::addDataSet(DBDataSet &ds) { + if (ds.m_results.empty()) return; + + if (m_colCount == 0) { + m_colCount = ds.m_colCount; + } else { + ASSERT(m_colCount == ds.m_colCount); + } + + m_rowCount += ds.m_rowCount; + m_results.insert(m_results.end(), ds.m_results.begin(), ds.m_results.end()); + ds.m_results.clear(); + ds.close(); +} + +void DBDataSet::close() { + for (m_iter = m_results.begin(); m_iter != m_results.end(); ++m_iter) { + mysql_free_result(*m_iter); + } + m_results.clear(); + m_fields = NULL; + m_row = NULL; + m_lengths = NULL; + m_rowCount = 0; + m_colCount = 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +int DBDataSet::getFieldIndex(const char *fieldName) { + ASSERT(fieldName && *fieldName); + + // without any results, cannot really resolve field names + if (m_results.empty()) return -1; + + if (m_fields == NULL) { + m_fields = mysql_fetch_fields(m_results.front()); + } + + for (int i = 0; i < m_colCount; i++) { + if (strcmp(m_fields[i].name, fieldName) == 0) { + return i; + } + } + return -1; +} + +MYSQL_FIELD *DBDataSet::getFields() const { + if (m_fields == NULL && !m_results.empty()) { + m_fields = mysql_fetch_fields(m_results.front()); + } + return m_fields; +} + +/////////////////////////////////////////////////////////////////////////////// + +void DBDataSet::moveFirst() { + for (m_iter = m_results.begin(); m_iter != m_results.end(); ++m_iter) { + if (*m_iter && mysql_num_rows(*m_iter) > 0) { + mysql_data_seek(*m_iter, 0); + m_row = mysql_fetch_row(*m_iter); + m_lengths = mysql_fetch_lengths(*m_iter); + ASSERT(m_row); + ASSERT(m_lengths); + return; + } + } + m_row = NULL; + m_lengths = NULL; +} + +void DBDataSet::moveNext() { + if (m_iter != m_results.end()) { + if (*m_iter) { + m_row = mysql_fetch_row(*m_iter); + m_lengths = mysql_fetch_lengths(*m_iter); + if (m_row) return; + } + for (++m_iter; m_iter != m_results.end(); ++m_iter) { + if (*m_iter && mysql_num_rows(*m_iter) > 0) { + mysql_data_seek(*m_iter, 0); + m_row = mysql_fetch_row(*m_iter); + m_lengths = mysql_fetch_lengths(*m_iter); + ASSERT(m_row); + ASSERT(m_lengths); + return; + } + } + } + m_row = NULL; + m_lengths = NULL; +} + +const char *DBDataSet::getField(int field) const { + ASSERT(field >= 0 && field < m_colCount); + ASSERT(m_row); + if (m_row && field >= 0 && field < m_colCount) { + return m_row[field]; + } + return NULL; +} + +int DBDataSet::getFieldLength(int field) const { + ASSERT(field >= 0 && field < m_colCount); + ASSERT(m_lengths); + if (m_lengths && field >= 0 && field < m_colCount) { + return m_lengths[field]; + } + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/db_dataset.h b/src/util/db_dataset.h new file mode 100644 index 0000000000000..736b35368a063 --- /dev/null +++ b/src/util/db_dataset.h @@ -0,0 +1,77 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __DB_DATASET_H__ +#define __DB_DATASET_H__ + +#include "dataset.h" + +namespace HPHP { + +DECLARE_BOOST_TYPES(DBDataSet); +/////////////////////////////////////////////////////////////////////////////// + +/** + * A DataSet that wraps a result set directly from an SQL query. + */ +class DBDataSet : public DataSet { + public: + DBDataSet(); + virtual ~DBDataSet(); + + /** + * Internally called by DBConn::Execute() to prepare a DBDataSet. + */ + void addResult(MYSQL *conn, MYSQL_RES *result); + + /** + * Merge ds into this, and clear ds. + */ + void addDataSet(DBDataSet &ds); + + /** + * Implementing DataSet. + */ + virtual void close(); + virtual int getRowCount() const { return m_rowCount;} + virtual int getColCount() const { return m_colCount;} + virtual int getFieldIndex(const char *fieldName); + virtual MYSQL_FIELD *getFields() const; + virtual void moveFirst(); + virtual MYSQL_ROW getRow() const { return m_row;} + virtual void moveNext(); + virtual const char *getField(int field) const; + virtual int getFieldLength(int field) const; + + private: + DBDataSet(DBDataSet &ds) { ASSERT(false);} // no copy constructor + + typedef std::list ResultList; + ResultList m_results; + mutable MYSQL_FIELD *m_fields; + + int m_rowCount; + int m_colCount; + + ResultList::const_iterator m_iter; + MYSQL_ROW m_row; + unsigned long *m_lengths; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __DB_DATASET_H__ diff --git a/src/util/db_filter.cpp b/src/util/db_filter.cpp new file mode 100644 index 0000000000000..a31a41aa45706 --- /dev/null +++ b/src/util/db_filter.cpp @@ -0,0 +1,147 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "db_filter.h" +#include "db_conn.h" + +using namespace std; + +namespace HPHP { + +int DBQueryFilter::MAX_COUNT = 500; + +/////////////////////////////////////////////////////////////////////////////// +// DBInNumberFilter + +DBInNumberFilter::DBInNumberFilter() { +} + +const char *DBInNumberFilter::getFirst(const std::string &where) { + ASSERT(!m_values.empty()); + m_iter = m_values.begin(); + return getFilter(where); +} + +const char *DBInNumberFilter::getNext(const std::string &where) { + if (m_iter == m_values.end()) return NULL; + return getFilter(where); +} + +const char *DBInNumberFilter::getFilter(const std::string &where) { + string values; + for (int i = 0; i < MAX_COUNT; i++) { + if (i > 0) values += ","; + + char buf[12]; + sprintf(buf, "%d", *m_iter); + values += buf; + + ++m_iter; + if (m_iter == m_values.end()) break; + } + + string::size_type pos = where.find("%s"); + ASSERT(pos != string::npos); + + m_filter = where; + m_filter.replace(pos, 2, values.c_str()); + return m_filter.c_str(); +} + +/////////////////////////////////////////////////////////////////////////////// +// DBInStringFilter + +DBInStringFilter::DBInStringFilter(DBConn *conn) : m_conn(conn) { + //ASSERT(m_conn); +} + +const char *DBInStringFilter::getFirst(const std::string &where) { + ASSERT(!m_values.empty()); + m_iter = m_values.begin(); + return getFilter(where); +} + +const char *DBInStringFilter::getNext(const std::string &where) { + if (m_iter == m_values.end()) return NULL; + return getFilter(where); +} + +const char *DBInStringFilter::getFilter(const std::string &where) { + string values; + for (int i = 0; i < MAX_COUNT; i++) { + if (i > 0) values += ","; + + values += "'"; + if (m_conn) { + string escaped; + m_conn->escapeString(m_iter->c_str(), escaped); + values += escaped; + } else { + values += m_iter->c_str(); + } + values += "'"; + + ++m_iter; + if (m_iter == m_values.end()) break; + } + + string::size_type pos = where.find("%s"); + ASSERT(pos != string::npos); + + m_filter = where; + m_filter.replace(pos, 2, values.c_str()); + return m_filter.c_str(); +} + +/////////////////////////////////////////////////////////////////////////////// +// DBOrStringFilter + +DBOrStringFilter::DBOrStringFilter() { +} + +const char *DBOrStringFilter::getFirst(const std::string &where) { + ASSERT(!m_values.empty()); + m_iter = m_values.begin(); + return getFilter(where); +} + +const char *DBOrStringFilter::getNext(const std::string &where) { + if (m_iter == m_values.end()) return NULL; + return getFilter(where); +} + +const char *DBOrStringFilter::getFilter(const std::string &where) { + string values = "("; + for (int i = 0; i < MAX_COUNT; i++) { + if (i > 0) values += ") or ("; + + values += *m_iter; + + ++m_iter; + if (m_iter == m_values.end()) break; + } + values += ")"; + + string::size_type pos = where.find("%s"); + ASSERT(pos != string::npos); + + m_filter = where; + m_filter.replace(pos, 2, values.c_str()); + return m_filter.c_str(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/db_filter.h b/src/util/db_filter.h new file mode 100644 index 0000000000000..8ddccd446f2c9 --- /dev/null +++ b/src/util/db_filter.h @@ -0,0 +1,157 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __DB_FILTER_H__ +#define __DB_FILTER_H__ + +#include "base.h" + +namespace HPHP { + +class DBConn; + +DECLARE_BOOST_TYPES(DBQueryFilter); +DECLARE_BOOST_TYPES(DBInNumberFilter); +DECLARE_BOOST_TYPES(DBInStringFilter); +DECLARE_BOOST_TYPES(DBOrStringFilter); +/////////////////////////////////////////////////////////////////////////////// + +/** + * Base class for filters handling where clauses like + * + * "field in (1412, 1241, 124, ...)" + * "field in ('string1', 'string2', ...)" + * "(...) or (...) or (...) or ..." + * + * All of them need special trunking to avoid oversized packets. + */ +class DBQueryFilter { + public: + DBQueryFilter() {} + virtual ~DBQueryFilter() {} + + virtual bool isEmpty() const = 0; + virtual unsigned int getCount() const = 0; + virtual const char *getFirst(const std::string &where) = 0; + virtual const char *getNext(const std::string &where) = 0; + + static int MAX_COUNT; +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Handle "in" clause with numbers. For example, + * "field in (1412, 1241, 124, ...)" + */ +class DBInNumberFilter : public DBQueryFilter { + public: + DBInNumberFilter(); + + /** + * Just keep adding numbers to the filter. + */ + void add(unsigned int value) { m_values.insert(value); } + void add(int value) { m_values.insert(value); } + + virtual bool isEmpty() const { return m_values.empty();} + virtual unsigned int getCount() const { return m_values.size();} + virtual const char *getFirst(const std::string &where); + virtual const char *getNext(const std::string &where); + + protected: + std::string m_filter; + std::set m_values; + std::set::const_iterator m_iter; + + const char *getFilter(const std::string &where); +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Handle "in" clause with strings. For example, + * "field in ('string1', 'string2', ...)" + */ +class DBInStringFilter : public DBQueryFilter { + public: + /** + * We need a connection object to escape strings. + */ + DBInStringFilter(DBConn *conn); + + /** + * Just keep adding strings to the filter. + */ + void add(const char *value) { ASSERT(value); m_values.insert(value); } + void add(const std::string &value) { m_values.insert(value); } + void add(const std::vector &values) { + m_values.insert(values.begin(), values.end()); + } + + virtual bool isEmpty() const { return m_values.empty();} + virtual unsigned int getCount() const { return m_values.size();} + virtual const char *getFirst(const std::string &where); + virtual const char *getNext(const std::string &where); + + protected: + DBConn *m_conn; + std::string m_filter; + std::set m_values; + std::set::const_iterator m_iter; + + const char *getFilter(const std::string &where); +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Handle "or" clause with strings. For example, + * "(...) or (...) or (...) or ..." + */ +class DBOrStringFilter : public DBQueryFilter { + public: + DBOrStringFilter(); + + /** + * Please make sure all strings are escaped already. + * Parentheses will be added for each of the strings. So + * + * f->Add("a = 1 and b = 2"); + * f->Add("a = 3 and b = 4"); + * + * will result in "(a = 1 and b = 2) or (a = 3 and b = 4)". + */ + void add(const char *value) { m_values.insert(value); } + void add(const std::string &value) { m_values.insert(value); } + + virtual bool isEmpty() const { return m_values.empty();} + virtual unsigned int getCount() const { return m_values.size();} + virtual const char *getFirst(const std::string &where); + virtual const char *getNext(const std::string &where); + + protected: + std::string m_filter; + std::set m_values; + std::set::const_iterator m_iter; + + const char *getFilter(const std::string &where); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __DB_FILTER_H__ diff --git a/src/util/db_query.cpp b/src/util/db_query.cpp new file mode 100644 index 0000000000000..b9b34ceabc9cf --- /dev/null +++ b/src/util/db_query.cpp @@ -0,0 +1,325 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "db_query.h" +#include "db_conn.h" +#include "db_dataset.h" +#include "util.h" + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +DBQuery::DBQuery(DBConn *conn, const char *sql, ...) + : m_conn(conn), m_insert(false) { + ASSERT(sql && *sql); + + char buf[1024]; + va_list ap; + va_start(ap, sql); + vsnprintf(buf, sizeof(buf), sql, ap); + va_end(ap); + m_base = buf; +} + +/////////////////////////////////////////////////////////////////////////////// + +void DBQuery::filterBy(const char *fmt, Op op /* = And */) { + ASSERT(fmt && *fmt); + + if (m_where.empty()) { + m_where = " where "; + } else { + switch (op) { + case And: m_where += " and "; break; + case Or: m_where += " or "; break; + default: break; + } + } + m_where += fmt; +} + +void DBQuery::filterBy(const char *fmt, const char *value, Op op /* = And */) { + ASSERT(m_conn); + + string escaped; + m_conn->escapeString(value, escaped); + char *where = (char*)malloc(strlen(fmt) + escaped.size() - 1); + sprintf(where, fmt, escaped.c_str()); + + filterBy(where, op); + free(where); +} + +void DBQuery::filterBy(const char *fmt, const std::string &value, + Op op /* = And */) { + filterBy(fmt, value.c_str(), op); +} + +void DBQuery::filterBy(const char *fmt, int value, Op op /* = And */) { + char *where = (char*)malloc(strlen(fmt) + 16); + sprintf(where, fmt, value); + + filterBy(where, op); + free(where); +} + +void DBQuery::filterBy(const char *fmt, unsigned int value, + Op op /* = And */) { + filterBy(fmt, (int)value, op); +} + +void DBQuery::filterBy(const char *fmt, DBQueryFilterPtr filter, + Op op /* = And */) { + ASSERT(!filter->isEmpty()); + ASSERT(!m_filter); + + m_filter = filter; + filterBy(fmt, op); +} + +void DBQuery::orderBy(const char *field, bool ascending /* = true */) { + m_order += m_order.empty() ? " ORDER BY " : ","; + m_order += field; + if (!ascending) { + m_order += " DESC"; + } +} + +void DBQuery::limit(int count, int offset /* = 0 */) { + m_limit = " LIMIT "; + if (offset) { + m_limit += boost::lexical_cast(offset) + ", "; + } + m_limit += boost::lexical_cast(count); +} + +void DBQuery::insert(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + format(fmt, ap); + va_end(ap); + m_insert = true; + m_values.push_back(m_format); +} + +void DBQuery::append(const char *extra) { + m_extra += (extra ? extra : ""); +} + +void DBQuery::setField(const char *fmt) { + m_values.push_back(fmt); +} + +void DBQuery::setField(const char *fmt, const char *value) { + setField(fmt, value, strlen(value)); +} + +void DBQuery::setField(const char *fmt, const std::string &value) { + setField(fmt, value.data(), value.length()); +} + +void DBQuery::setField(const char *fmt, const char *binary, int len) { + ASSERT(m_conn); + + string escaped; + m_conn->escapeString(binary, len, escaped); + + char *buffer = (char*)malloc(strlen(fmt) + escaped.size()); + if (!buffer) { + throw bad_alloc(); + } + sprintf(buffer, fmt, escaped.c_str()); + setField(buffer); + free(buffer); +} + +void DBQuery::setField(const char *fmt, int value) { + setField(fmt, boost::lexical_cast(value).c_str()); +} + +void DBQuery::setField(const char *fmt, unsigned int value) { + setField(fmt, (int)value); +} + +/////////////////////////////////////////////////////////////////////////////// + +int DBQuery::execute() { + return execute(NULL); +} + +int DBQuery::execute(DBDataSet &ds) { + return execute(&ds); +} + +int DBQuery::execute(DBDataSet *ds) { + ASSERT(m_conn); + ASSERT(m_conn->isOpened()); + + int affected = 0; + for (const char *sql = getFirstSql(); sql; sql = getNextSql()) { + affected += m_conn->execute(sql, ds); + } + return affected; +} + +int DBQuery::execute(int &result) { + DBDataSet ds; + int affected = execute(ds); + result = 0; + for (ds.moveFirst(); ds.getRow(); ds.moveNext()) { + result += ds.getIntField(0); + } + return affected; +} + +int DBQuery::execute(unsigned int &result) { + DBDataSet ds; + int affected = execute(ds); + result = 0; + for (ds.moveFirst(); ds.getRow(); ds.moveNext()) { + result += ds.getUIntField(0); + } + return affected; +} + +/////////////////////////////////////////////////////////////////////////////// + +const char *DBQuery::getFirstSql() { + if (m_filter) { + const char *where = m_filter->getFirst(m_where); + ASSERT(where); + return getSql(where); + } + return getSql(m_where.c_str()); +} + +const char *DBQuery::getNextSql() { + if (m_filter) { + const char *where = m_filter->getNext(m_where); + if (where) return getSql(where); + } + return NULL; +} + +const char *DBQuery::getSql(const char *where) { + if (m_values.empty()) { + m_sql = m_base + where + m_order + m_limit + m_extra; + } else if (m_insert) { + + int total = m_base.size() + 8 + m_extra.size(); + for (unsigned int i = 0; i < m_values.size(); i++) { + total += m_values[i].size() + 4; + } + m_sql.reserve(total); + + m_sql = m_base; + m_sql += " VALUES "; + for (unsigned int i = 0; i < m_values.size(); i++) { + if (i > 0) m_sql += ", "; + m_sql += "("; + m_sql += m_values[i]; + m_sql += ")"; + } + m_sql += m_extra; + } else { + m_sql = m_base; + m_sql += " SET "; + for (unsigned int i = 0; i < m_values.size(); i++) { + if (i > 0) m_sql += ","; + m_sql += m_values[i]; + } + m_sql += where; + m_sql += m_limit; + m_sql += m_extra; + } + return m_sql.c_str(); +} + +/////////////////////////////////////////////////////////////////////////////// + +const char *DBQuery::format(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + format(fmt, ap); + va_end(ap); + return m_format.c_str(); +} + +const char *DBQuery::format(const char *fmt, va_list ap) { + m_format = fmt; + + for (string::size_type pos = m_format.find('%'); + pos != string::npos && pos < m_format.length() - 1; + pos = m_format.find('%', pos + 1)) { + switch (m_format[pos+1]) { + case 's': + { + ASSERT(m_conn); + const char *value = va_arg(ap, const char *); + string escaped; + m_conn->escapeString(value, escaped); + m_format.replace(pos, 2, escaped); + pos += escaped.size(); + } + break; + case 'd': + { + int value = va_arg(ap, int); + + char buf[12]; + sprintf(buf, "%d", value); + m_format.replace(pos, 2, buf); + pos += strlen(buf); + } + break; + case 'p': + { + long value = va_arg(ap, long); + + char buf[20]; + sprintf(buf, "%ld", value); + m_format.replace(pos, 2, buf); + pos += strlen(buf); + } + break; + case '%': + m_format.erase(pos, 1); + break; + default: + ASSERT(false); + } + } + + return m_format.c_str(); +} + +std::string DBQuery::escapeFieldName(const char *fieldNameList) { + ASSERT(fieldNameList); + string ret = "`"; + ret += fieldNameList; + ret += "`"; + Util::replaceAll(ret, ",", "`,`"); + return ret; +} + +std::string DBQuery::escapeFieldName(const std::string &fieldNameList) { + return escapeFieldName(fieldNameList.c_str()); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/db_query.h b/src/util/db_query.h new file mode 100644 index 0000000000000..50fe414144922 --- /dev/null +++ b/src/util/db_query.h @@ -0,0 +1,165 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __DB_QUERY_H__ +#define __DB_QUERY_H__ + +#include +#include "db_filter.h" + +namespace HPHP { + +class DBConn; +class DBDataSet; + +DECLARE_BOOST_TYPES(DBQuery); +/////////////////////////////////////////////////////////////////////////////// + +/** + * A class that helps construct SQL statements. When a filter or where clause + * has a long list of items, this class will break them into optimal sizes of + * several SQLs and run them separately and combine results into one. For + * example, + * + * DBQuery q(&conn, "SELECT * FROM friend"); + * q.filterBy("user1 = %d", 12345); + * + * DBInNumberFilterPtr f(new DBInNumerFilter()); + * for (unsigned int i = 0; i < userIds.size(); i++) { + * f->add(userIds[i]); + * } + * q.filterBy("user2 in (%s)", filter); + * + * DBDataSet ds; + * q.execute(ds); + * + * Note in the above example, if userIds.size() is very large, it will exceed + * maximum allowed packet size of SQL statements. More importantly, according + * to MySQL documentation, optimal query size is between 100 and 1000 when you + * have a query like this that you can query in trunks and combine afterwards. + */ +class DBQuery { + public: + enum Op { + None, + And, + Or, + }; + + public: + /** + * Constructor. Do NOT put any where clause here. Use FilterBy() instead. + * + * DBQuery(&conn, "SELECT * FROM %s", tableName); + */ + DBQuery(DBConn *conn, const char *sql, ...); + + /** + * Composing where clause. String values will be escaped properly. + * DBQueryFilterPtr can be used to pass in a list of items. + */ + void filterBy(const char *fmt, Op op = And); + void filterBy(const char *fmt, const char *value, Op op = And); + void filterBy(const char *fmt, const std::string &value, Op op = And); + void filterBy(const char *fmt, int value, Op op = And); + void filterBy(const char *fmt, unsigned int value, Op op = And); + void filterBy(const char *fmt, DBQueryFilterPtr filter, Op op = And); + + /** + * Append ORDER BY clause. + */ + void orderBy(const char *field, bool ascending = true); + + /** + * Append LIMIT n or LIMIT m, n clause. + */ + void limit(int count, int offset = 0); + + /** + * Append (...) value list for an insertion. + */ + void insert(const char *fmt, ...); + + /** + * Append extra SQL components. For example, ON DUPLICATE KEY UPDATE. + */ + void append(const char *extra); + + /** + * Append "field = value" to UPDATE statement. + */ + void setField(const char *fmt); + void setField(const char *fmt, const char *value); + void setField(const char *fmt, const std::string &value); + void setField(const char *fmt, const char *binary, int len); + void setField(const char *fmt, int value); + void setField(const char *fmt, unsigned int value); + + /** + * Utility function that helps constructing more complex queries. + * For example, + * + * q.filterBy(q.Format("(%s > 0 or %s = 2)", field1, field2)); + */ + const char *format(const char *fmt, ...); + const char *format(const char *fmt, va_list ap); + + /** + * Use "`" to escape all field names in a comma delimited field list. + * + * For example, + * + * DBQuery::escapeFieldName("from") == "`from`"; + * DBQuery::escapeFieldName("from,to") == "`from`,`to`"; + */ + static std::string escapeFieldName(const char *fieldNameList); + static std::string escapeFieldName(const std::string &fieldNameList); + + /** + * Run the query and return number of affected rows. + */ + int execute(); // ignore any results + int execute(DBDataSet &ds); // put results in ds + int execute(DBDataSet *ds); // put results in ds + int execute(int &result); // count(*) or single int col in result + int execute(unsigned int &result); // put single unsigned int field in result + + private: + DBConn *m_conn; + + std::string m_sql; + std::string m_base; + std::string m_where; + std::string m_order; + std::string m_limit; + std::string m_extra; + + bool m_insert; + std::vector m_values; + + std::string m_format; + + DBQueryFilterPtr m_filter; + + const char *getFirstSql(); + const char *getNextSql(); + const char *getSql(const char *where); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __DB_QUERY_H__ diff --git a/src/util/exception.cpp b/src/util/exception.cpp new file mode 100644 index 0000000000000..a9f043385a609 --- /dev/null +++ b/src/util/exception.cpp @@ -0,0 +1,58 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "exception.h" +#include "base.h" + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Exception::Exception(const char *fmt, ...) + : m_handled(false) { + va_list ap; va_start(ap, fmt); format(fmt, ap); va_end(ap); +} + +Exception::Exception(const Exception &e) + : m_handled(true), m_msg(e.m_msg), m_what(e.m_what), m_st(e.m_st) { + e.m_handled = true; +} + +Exception::Exception() + : m_handled(true) { +} + +void Exception::format(const char *fmt, va_list ap) { + char buf[20480]; + vsnprintf(buf, sizeof(buf), fmt, ap); + m_msg = buf; +} + +Exception::~Exception() throw() { +} + +/////////////////////////////////////////////////////////////////////////////// + +const char *Exception::what() const throw() { + if (m_what.empty()) { + m_what = m_msg + "\n\n" + m_st.toString(); + } + return m_what.c_str(); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/exception.h b/src/util/exception.h new file mode 100644 index 0000000000000..13949527dbd80 --- /dev/null +++ b/src/util/exception.h @@ -0,0 +1,82 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __EXCEPTION_H__ +#define __EXCEPTION_H__ + +#include "stack_trace.h" +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Base class for all exceptions. + */ +class Exception : public std::exception { +public: + Exception(const char *fmt, ...); + Exception(const Exception &e); + Exception(); + + /** + * Subclass can call this function to format variable length of parameters. + * + * class MyException : public Exception { + * public: + * MyException(const char *fmt, ...) { + * va_list ap; va_start(ap, fmt); Format(fmt, ap); va_end(ap); + * } + * }; + */ + void format(const char *fmt, va_list ap); + + virtual ~Exception() throw(); + virtual const char *what() const throw(); + + /** + * Error message without stacktrace. + */ + const std::string &getMessage() const { return m_msg;} + const StackTrace &getStackTrace() const { return m_st;} + +protected: + mutable bool m_handled; + mutable std::string m_msg; + mutable std::string m_what; + StackTrace m_st; +}; + +/////////////////////////////////////////////////////////////////////////////// + +class DatabaseException : public Exception { +public: + DatabaseException(const char *fmt, ...) { + va_list ap; va_start(ap, fmt); format(fmt, ap); va_end(ap); + } +}; + +class DBConnectionException : public DatabaseException { +public: + DBConnectionException(const char *ip, const char *database, const char *msg) + : DatabaseException("Failed to connect to %s %s: %s", ip, database, msg) { + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __EXCEPTION_H__ diff --git a/src/util/file_cache.cpp b/src/util/file_cache.cpp new file mode 100644 index 0000000000000..25bdf3147502f --- /dev/null +++ b/src/util/file_cache.cpp @@ -0,0 +1,306 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "file_cache.h" +#include "exception.h" +#include "compression.h" +#include "util.h" +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helper + +static bool read_bytes(FILE *f, char *buf, int len) { + size_t nread = 0; + while (len && (nread = fread(buf, 1, len, f)) != 0) { + buf += nread; + len -= nread; + } + return nread; +} + +/////////////////////////////////////////////////////////////////////////////// + +FileCache::~FileCache() { + for (FileMap::iterator iter = m_files.begin(); iter != m_files.end(); + ++iter) { + Buffer &buffer = iter->second; + if (buffer.data) { + free(buffer.data); + } + if (buffer.cdata) { + free(buffer.cdata); + } + } +} + +void FileCache::writeDirectories(const char *name) { + string sname = name; + for (int i = 1; i < (int)sname.size(); i++) { + if (sname[i] == '/') { + string dir = sname.substr(0, i); + if (!exists(dir.c_str())) { + Buffer &buffer = m_files[dir]; + buffer.len = -2; // directory + buffer.data = NULL; + buffer.clen = -2; + buffer.cdata = NULL; + } + } + } +} + +std::string FileCache::GetRelativePath(const char *path) { + ASSERT(path); + + string relative = path; + unsigned int len = RuntimeOption::SourceRoot.size(); + if (len > 0 && relative.size() > len && + strncmp(relative.data(), RuntimeOption::SourceRoot.c_str(), len) == 0) { + relative = relative.substr(len); + } + if (!relative.empty() && relative[relative.length() - 1] == '/') { + relative = relative.substr(0, relative.length() - 1); + } + return relative; +} + +void FileCache::write(const char *name, bool addDirectories /* = true */) { + ASSERT(name && *name); + ASSERT(!exists(name)); + + Buffer &buffer = m_files[name]; + buffer.len = -1; // PHP file + buffer.data = NULL; + buffer.clen = -1; + buffer.cdata = NULL; + + if (addDirectories) { + writeDirectories(name); + } +} + +void FileCache::write(const char *name, const char *fullpath) { + ASSERT(name && *name); + ASSERT(fullpath && *fullpath); + ASSERT(!exists(name)); + + struct stat sb; + if (stat(fullpath, &sb) != 0) { + throw Exception("Unable to stat %s: %s", fullpath, + Util::safe_strerror(errno).c_str()); + } + int len = sb.st_size; + Buffer &buffer = m_files[name]; + buffer.len = len; // static file + buffer.data = NULL; + buffer.clen = -1; + buffer.cdata = NULL; + + if (len) { + FILE *f = fopen(fullpath, "r"); + if (f == NULL) { + throw Exception("Unable to open %s: %s", fullpath, + Util::safe_strerror(errno).c_str()); + } + + char *buf = buffer.data = (char *)malloc(len); + if (!read_bytes(f, buf, len)) { + throw Exception("Unable to read all bytes from %s", fullpath); + } + fclose(f); + + if (is_compressible_file(name)) { + int new_len = buffer.len; + char *compressed = gzencode(buffer.data, new_len, 9, CODING_GZIP); + if (compressed) { + if (new_len < buffer.len) { + buffer.clen = new_len; + buffer.cdata = compressed; + } else { + free(compressed); + } + } + } + } + + writeDirectories(name); +} + +void FileCache::save(const char *filename) { + ASSERT(filename && *filename); + + FILE *f = fopen(filename, "w"); + if (f == NULL) { + throw Exception("Unable to open %s: %s", filename, + Util::safe_strerror(errno).c_str()); + } + + for (FileMap::const_iterator iter = m_files.begin(); iter != m_files.end(); + ++iter) { + short name_len = iter->first.size(); + const char *name = iter->first.data(); + ASSERT(name_len); + fwrite(&name_len, sizeof(short), 1, f); + fwrite(name, name_len, 1, f); + + const Buffer &buffer = iter->second; + char c = buffer.cdata ? 1 : 0; + fwrite(&c, 1, 1, f); + if (c) { + ASSERT(buffer.clen > 0); + fwrite(&buffer.clen, sizeof(int), 1, f); + ASSERT(buffer.cdata); + fwrite(buffer.cdata, buffer.clen, 1, f); + } else { + fwrite(&buffer.len, sizeof(int), 1, f); + if (buffer.len > 0) { + ASSERT(buffer.data); + fwrite(buffer.data, buffer.len, 1, f); + } + } + } + + fclose(f); +} + +void FileCache::load(const char *filename) { + ASSERT(filename && *filename); + + FILE *f = fopen(filename, "r"); + if (f == NULL) { + throw Exception("Unable to open %s: %s", filename, + Util::safe_strerror(errno).c_str()); + } + + while (true) { + short name_len; + if (!read_bytes(f, (char*)&name_len, sizeof(short)) || name_len <= 0) { + if (feof(f)) break; + throw Exception("Bad file name length in archive %s", filename); + } + char *name = (char *)malloc(name_len + 1); + if (!read_bytes(f, name, name_len)) { + free(name); + throw Exception("Bad file name in archive %s", filename); + } + name[name_len] = '\0'; + string file(name, name_len); + free(name); + if (exists(file.c_str())) { + throw Exception("Same file %s appeared twice in %s", file.c_str(), + filename); + } + + char c; int len; + if (!read_bytes(f, (char*)&c, 1) || + !read_bytes(f, (char*)&len, sizeof(int))) { + throw Exception("Bad data length in archive %s", filename); + } + + Buffer &buffer = m_files[file]; + buffer.len = len; + buffer.data = NULL; + buffer.clen = -1; + buffer.cdata = NULL; + + if (len > 0) { + buffer.data = (char *)malloc(len + 1); + if (!read_bytes(f, buffer.data, len)) { + throw Exception("Bad data in archive %s", filename); + } + buffer.data[len] = '\0'; + if (c) { + int new_len = buffer.len; + char *uncompressed = gzdecode(buffer.data, new_len); + if (uncompressed == NULL) { + throw Exception("Bad compressed data in archive %s", filename); + } + buffer.clen = buffer.len; + buffer.cdata = buffer.data; + buffer.len = new_len; + buffer.data = uncompressed; + } + } + } +} + +bool FileCache::fileExists(const char *name, + bool isRelative /* = true */) const { + if (isRelative) { + if (name && *name) { + FileMap::const_iterator iter = m_files.find(name); + if (iter != m_files.end() && iter->second.len >= -1) { + return true; + } + } + return false; + } + return fileExists(GetRelativePath(name).c_str()); +} + +bool FileCache::dirExists(const char *name, + bool isRelative /* = true */) const { + if (isRelative) { + if (name && *name) { + FileMap::const_iterator iter = m_files.find(name); + if (iter != m_files.end() && iter->second.len == -2) { + return true; + } + } + return false; + } + return dirExists(GetRelativePath(name).c_str()); +} + +bool FileCache::exists(const char *name, + bool isRelative /* = true */) const { + if (isRelative) { + if (name && *name) { + return m_files.find(name) != m_files.end(); + } + return false; + } + return exists(GetRelativePath(name).c_str()); +} + +char *FileCache::read(const char *name, int &len, bool &compressed) const { + if (name && *name) { + FileMap::const_iterator iter = m_files.find(name); + if (iter != m_files.end()) { + const Buffer &buf = iter->second; + if (compressed && buf.cdata) { + len = buf.clen; + ASSERT(len > 0); + return buf.cdata; + } + compressed = false; + len = buf.len; + if (len == 0) { + ASSERT(buf.data == NULL); + return ""; + } + return buf.data; + } + } + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/file_cache.h b/src/util/file_cache.h new file mode 100644 index 0000000000000..68cd1e0fa2459 --- /dev/null +++ b/src/util/file_cache.h @@ -0,0 +1,69 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __FILE_CACHE_H__ +#define __FILE_CACHE_H__ + +#include "base.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Stores file contents in memory. Used by web server for faster static + * content serving. + */ +DECLARE_BOOST_TYPES(FileCache); +class FileCache { +public: + ~FileCache(); + + /** + * Archiving data. + */ + void write(const char *name, bool addDirectories = true); + void write(const char *name, const char *fullpath); // name + data + void save(const char *filename); + + /** + * Reading data. + */ + void load(const char *filename); + bool fileExists(const char *name, bool isRelative = true) const; + bool dirExists(const char *name, bool isRelative = true) const; + bool exists(const char *name, bool isRelative = true) const; + char *read(const char *name, int &len, bool &compressed) const; + + static std::string GetRelativePath(const char *path); +private: + struct Buffer { + int len; // uncompressed len -1: PHP file, -2: directories + char *data; // uncompressed data + int clen; // compressed len + char *cdata; // compressed data + }; + typedef __gnu_cxx::hash_map FileMap; + + FileMap m_files; + + void writeDirectories(const char *name); + +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __FILE_CACHE_H__ diff --git a/src/util/hash.h b/src/util/hash.h new file mode 100644 index 0000000000000..6d1778937aa12 --- /dev/null +++ b/src/util/hash.h @@ -0,0 +1,319 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_HASH_H__ +#define __HPHP_HASH_H__ + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +inline long long hash_int64(long long key) { + key = (~key) + (key << 21); // key = (key << 21) - key - 1; + key = key ^ ((unsigned long long)key >> 24); + key = (key + (key << 3)) + (key << 8); // key * 265 + key = key ^ ((unsigned long long)key >> 14); + key = (key + (key << 2)) + (key << 4); // key * 21 + key = key ^ ((unsigned long long)key >> 28); + key = key + (key << 31); + return key < 0 ? -key : key; +} + +/* + * How to toggle hash functions: comment/uncomment the following macro + * definition, build hphp, make -C lib/system, and then rebuild hphp. + */ +#define USE_MURMUR 1 + +#ifdef USE_MURMUR + +/* + * http://murmurhash.googlepages.com/ (64bit, seed = 0) + * + * The case-insensitive version converts 8 bytes of lowercased characters + * uppercase at once. This should work as identifiers usually only contain + * alphanumeric characters and the underscore. Although PHP allows higher + * ASCII characters (> 127) in an identifier, they should be very rare, and + * do not change the correctness. + */ + +inline long long hash_string(const char *arKey, int nKeyLength) { + const long long m = 0xc6a4a7935bd1e995; + const int r = 47; + + register unsigned long long h = 0; + + const unsigned long long * data = (const unsigned long long *)arKey; + const unsigned long long * end = data + (nKeyLength / 8); + + while (data != end) { + unsigned long long k = *data++; + + k *= m; + k ^= k >> r; + k *= m; + + h ^= k; + h *= m; + } + + const unsigned char * data2 = (const unsigned char*)data; + + switch (nKeyLength & 7) { + case 7: h ^= (unsigned long long)(data2[6]) << 48; + case 6: h ^= (unsigned long long)(data2[5]) << 40; + case 5: h ^= (unsigned long long)(data2[4]) << 32; + case 4: h ^= (unsigned long long)(data2[3]) << 24; + case 3: h ^= (unsigned long long)(data2[2]) << 16; + case 2: h ^= (unsigned long long)(data2[1]) << 8; + case 1: h ^= (unsigned long long)(data2[0]); + h *= m; + }; + + h ^= h >> r; + h *= m; + h ^= h >> r; + + return h & 0x7fffffffffffffff; +} + +inline long long hash_string_i(const char *arKey, int nKeyLength) { + const unsigned long long m = 0xc6a4a7935bd1e995; + const int r = 47; + + register unsigned long long h = 0; + + const unsigned long long * data = (const unsigned long long *)arKey; + const unsigned long long * end = data + (nKeyLength / 8); + + while (data != end) { + unsigned long long k = *data++; + k &= 0xdfdfdfdfdfdfdfdf; // a-z => A-Z + + k *= m; + k ^= k >> r; + k *= m; + + h ^= k; + h *= m; + } + + const unsigned char * data2 = (const unsigned char*)data; + + switch (nKeyLength & 7) { + case 7: h ^= (unsigned long long)(data2[6] & 0xdf) << 48; + case 6: h ^= (unsigned long long)(data2[5] & 0xdf) << 40; + case 5: h ^= (unsigned long long)(data2[4] & 0xdf) << 32; + case 4: h ^= (unsigned long long)(data2[3] & 0xdf) << 24; + case 3: h ^= (unsigned long long)(data2[2] & 0xdf) << 16; + case 2: h ^= (unsigned long long)(data2[1] & 0xdf) << 8; + case 1: h ^= (unsigned long long)(data2[0] & 0xdf); + h *= m; + }; + + h ^= h >> r; + h *= m; + h ^= h >> r; + + return h & 0x7fffffffffffffff; +} + +#else /* not using murmur hashing */ + +/* + * DJBX33A (Daniel J. Bernstein, Times 33 with Addition) + * + * This is Daniel J. Bernstein's popular `times 33' hash function as + * posted by him years ago on comp.lang.c. It basically uses a function + * like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best + * known hash functions for strings. Because it is both computed very + * fast and distributes very well. + * + * The magic of number 33, i.e. why it works better than many other + * constants, prime or not, has never been adequately explained by + * anyone. So I try an explanation: if one experimentally tests all + * multipliers between 1 and 256 (as RSE did now) one detects that even + * numbers are not useable at all. The remaining 128 odd numbers + * (except for the number 1) work more or less all equally well. They + * all distribute in an acceptable way and this way fill a hash table + * with an average percent of approx. 86%. + * + * If one compares the Chi^2 values of the variants, the number 33 not + * even has the best value. But the number 33 and a few other equally + * good numbers like 17, 31, 63, 127 and 129 have nevertheless a great + * advantage to the remaining numbers in the large set of possible + * multipliers: their multiply operation can be replaced by a faster + * operation based on just one shift plus either a single addition + * or subtraction operation. And because a hash function has to both + * distribute good _and_ has to be very fast to compute, those few + * numbers should be preferred and seems to be the reason why Daniel J. + * Bernstein also preferred it. + * + * + * -- Ralf S. Engelschall + */ + +inline long long hash_string(const char *arKey, int nKeyLength) { + register unsigned long long hash = 5381; + + /* variant with the hash unrolled eight times */ + for (; nKeyLength >= 8; nKeyLength -= 8) { + hash = ((hash << 5) + hash) + *arKey++; + hash = ((hash << 5) + hash) + *arKey++; + hash = ((hash << 5) + hash) + *arKey++; + hash = ((hash << 5) + hash) + *arKey++; + hash = ((hash << 5) + hash) + *arKey++; + hash = ((hash << 5) + hash) + *arKey++; + hash = ((hash << 5) + hash) + *arKey++; + hash = ((hash << 5) + hash) + *arKey++; + } + switch (nKeyLength) { + case 7: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ + case 6: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ + case 5: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ + case 4: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ + case 3: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ + case 2: hash = ((hash << 5) + hash) + *arKey++; /* fallthrough... */ + case 1: hash = ((hash << 5) + hash) + *arKey++; break; + case 0: break; + default: + ASSERT(false); + break; + } + long long ret = hash; + return ret < 0 ? -ret : ret; +} + +// Case insensitive version. Hash will be equivalent to hash_string of lower +inline long long hash_string_i(const char *arKey, int nKeyLength) { + register unsigned long long hash = 5381; + char c; + char diff = 'a' - 'A'; + /* variant with the hash unrolled eight times */ + for (; nKeyLength >= 8; nKeyLength -= 8) { + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + } + switch (nKeyLength) { + case 7: + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + case 6: + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + case 5: + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + case 4: + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + case 3: + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + case 2: + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + case 1: + c = *arKey++; + if (c >= 'A' && c <= 'Z') c += diff; + hash = ((hash << 5) + hash) + c; + case 0: break; + default: + ASSERT(false); + break; + } + long long ret = hash; + return ret < 0 ? -ret : ret; +} + +#endif /* USE_MURMUR */ + +/** + * We probably should get rid of this, so to detect code generation errors, + * where a binary string is treated as a NULL-terminated literal. Do we ever + * allow binary strings as array keys or symbol names? + */ +inline long long hash_string(const char *arKey) { + return hash_string(arKey, strlen(arKey)); +} +inline long long hash_string_i(const char *arKey) { + return hash_string_i(arKey, strlen(arKey)); +} + +inline bool is_strictly_integer(const char* arKey, size_t nKeyLength, + int64& res) { + if (nKeyLength > 0 && + (nKeyLength <= 19 || + (arKey[0] == '-' && nKeyLength == 20))) { + uint64 num = 0; + bool neg = false; + uint32 i = 0; + if (arKey[0] == '-') { + neg = true; + i = 1; + if (nKeyLength == 1) return false; + } + if (nKeyLength == i + 1 || arKey[i] != '0') { + bool good = true; + for (; i < nKeyLength; ++i) { + if (arKey[i] >= '0' && arKey[i] <= '9') { + num = 10*num + arKey[i] - '0'; + } + else { + good = false; + break; + } + } + if (good && num <= 0x7FFFFFFFFFFFFFFF) { + res = neg ? 0 - num : (int64)num; + return true; + } + } + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_HASH_H__ diff --git a/src/util/hdf.cpp b/src/util/hdf.cpp new file mode 100644 index 0000000000000..e2086cd988048 --- /dev/null +++ b/src/util/hdf.cpp @@ -0,0 +1,538 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "hdf.h" +#include "lock.h" + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Helper class storing HDF raw pointer and reference counts on it. + */ +class HdfRaw { +public: + static Mutex HdfMutex; + + HdfRaw() : m_hdf(NULL), m_count(1) { + // ClearSilver is not thread-safe when calling hdf_init(), so guarding it. + Lock lock(HdfMutex); + Hdf::CheckNeoError(hdf_init(&m_hdf)); + ASSERT(m_hdf); + } + ~HdfRaw() { + if (m_hdf) { + hdf_destroy(&m_hdf); + } + } + + HDF *m_hdf; + int m_count; + + void inc() { m_count++;} + void dec() { if (--m_count == 0) { delete this;}} +}; + +Mutex HdfRaw::HdfMutex; + +/////////////////////////////////////////////////////////////////////////////// +// constructors + +Hdf::Hdf() : m_hdf(NULL), m_dump(NULL) { + m_rawp = new HdfRaw(); +} + +Hdf::Hdf(const char *filename) : m_hdf(NULL), m_dump(NULL) { + m_rawp = new HdfRaw(); + append(filename); +} + +Hdf::Hdf(const std::string &filename) : m_hdf(NULL), m_dump(NULL) { + m_rawp = new HdfRaw(); + append(filename.c_str()); +} + +Hdf::Hdf(const Hdf *hdf, const char *name) : m_hdf(NULL), m_dump(NULL) { + ASSERT(hdf); + ASSERT(name && *name); + m_rawp = hdf->m_rawp; + if (m_rawp) { + m_rawp->inc(); + m_path = hdf->getFullPath(); + m_name = name; + } else { + ASSERT(hdf->m_hdf); + hdf_get_node(hdf->m_hdf, (char*)name, &m_hdf); + } +} + +Hdf::Hdf(const Hdf &hdf) + : m_hdf(hdf.m_hdf), m_rawp(hdf.m_rawp), m_path(hdf.m_path), + m_name(hdf.m_name), m_dump(NULL) { + if (m_rawp) { + m_rawp->inc(); + } +} + +Hdf::Hdf(HDF *hdf) + : m_hdf(hdf), m_rawp(NULL), m_dump(NULL) { +} + +Hdf::~Hdf() { + if (m_rawp) { + m_rawp->dec(); + } + if (m_dump) { + free(m_dump); + } +} + +void Hdf::assign(const Hdf &hdf) { + m_hdf = hdf.m_hdf; + if (m_rawp) { + m_rawp->dec(); + } + m_rawp = hdf.m_rawp; + if (m_rawp) { + m_rawp->inc(); + } + m_path = hdf.m_path; + m_name = hdf.m_name; + if (m_dump) { + free(m_dump); + m_dump = NULL; + } +} + +void Hdf::copy(const Hdf &hdf) { + CheckNeoError(hdf_copy(getRaw(), NULL, hdf.getRaw())); +} + +void Hdf::open(const char *filename) { + close(); + append(filename); +} + +void Hdf::append(const char *filename) { + ASSERT(filename && *filename); + CheckNeoError(hdf_read_file(getRaw(), (char*)filename)); +} + +void Hdf::close() { + m_hdf = NULL; + if (m_rawp) { + m_rawp->dec(); + m_rawp = new HdfRaw(); + } + m_path.clear(); + m_name.clear(); + if (m_dump) { + free(m_dump); + m_dump = NULL; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// gets + +const char *Hdf::get(const char *defValue /* = NULL */) const { + const char *v = hdf_obj_value(getRaw()); + return v ? v : defValue; +} + +std::string Hdf::getString(const std::string &defValue /* = "" */) const { + const char *v = get(); + if (v == NULL) return defValue; + return v; +} + +bool Hdf::getBool(bool defValue /* = false */) const { + const char *v = get(); + if (v == NULL) return defValue; + + return *v && strcmp(v, "0") && + strcasecmp(v, "false") && strcasecmp(v, "no") && strcasecmp(v, "off"); +} + +int64 Hdf::getInt(int64 defValue, const char *type, int64 maxValue) const { + const char *v = get(); + if (v == NULL) return defValue; + + char *endptr = NULL; + int64 n = strtoll(v, &endptr, 0); + if ((!endptr && !*endptr) || + (maxValue && (n > maxValue || n < (- maxValue - 1)))) { + throw HdfDataTypeException(this, type, v); + } + + return n; +} + +char Hdf::getByte(char defValue /* = 0 */) const { + return getInt(defValue, "byte", 0x7FL); +} + +int16 Hdf::getInt16(int16 defValue /* = 0 */) const { + return getInt(defValue, "int16", 0x7FFFL); +} + +int32 Hdf::getInt32(int32 defValue /* = 0 */) const { + return getInt(defValue, "int32", 0x7FFFFFFFL); +} + +int64 Hdf::getInt64(int64 defValue /* = 0 */) const { + return getInt(defValue, "int64", 0); +} + +uint64 Hdf::getUInt(uint64 defValue, const char *type, uint64 mask) const { + const char *v = get(); + if (v == NULL) return defValue; + + char *endptr = NULL; + int64 n = strtoull(v, &endptr, 0); + if ((!endptr && !*endptr) || (mask && ((uint64)n & mask))) { + throw HdfDataTypeException(this, type, v); + } + + return n; +} + +uchar Hdf::getUByte(uchar defValue /* = 0 */) const { + return getUInt(defValue, "unsigned byte", ~0xFFUL); +} + +uint16 Hdf::getUInt16(uint16 defValue /* = 0 */) const { + return getUInt(defValue, "unsigned int16", ~0xFFFFUL); +} + +uint32 Hdf::getUInt32(uint32 defValue /* = 0 */) const { + return getUInt(defValue, "unsigned int32", ~0xFFFFFFFFUL); +} + +uint64 Hdf::getUInt64(uint64 defValue /* = 0 */) const { + return getUInt(defValue, "unsigned int64", 0); +} + +double Hdf::getDouble(double defValue /* = 0 */) const { + const char *v = get(); + if (v == NULL) return defValue; + + char *endptr = NULL; + double n = strtod(v, &endptr); + if (!endptr && !*endptr) { + throw HdfDataTypeException(this, "double", v); + } + + return n; +} + +void Hdf::get(std::vector &values) const { + values.clear(); + for (Hdf hdf = firstChild(); hdf.exists(); hdf = hdf.next()) { + values.push_back(hdf.getString("")); + } +} + +void Hdf::get(std::set &values) const { + values.clear(); + for (Hdf hdf = firstChild(); hdf.exists(); hdf = hdf.next()) { + values.insert(hdf.getString("")); + } +} + +void Hdf::get(std::map &values) const { + values.clear(); + for (Hdf hdf = firstChild(); hdf.exists(); hdf = hdf.next()) { + values[hdf.getName()] = hdf.getString(""); + } +} + +int Hdf::compare(const char *v2) const { + const char *v1 = get(); + if (v1 == NULL && v2 == NULL) return 0; + if (v1 == NULL) return -1; + if (v2 == NULL) return 1; + return strcmp(v1, v2); +} + +int Hdf::compare(const std::string &v2) const { + string v1 = getString(); + return strcmp(v1.c_str(), v2.c_str()); +} + +int Hdf::compare(char v2) const { + char v1 = getByte(); + if (v1 == v2) return 0; + return v1 > v2 ? 1 : -1; +} + +int Hdf::compare(uchar v2) const { + uchar v1 = getUByte(); + if (v1 == v2) return 0; + return v1 > v2 ? 1 : -1; +} + +int Hdf::compare(int16 v2) const { + int16 v1 = getInt16(); + if (v1 == v2) return 0; + return v1 > v2 ? 1 : -1; +} + +int Hdf::compare(uint16 v2) const { + uint16 v1 = getUInt16(); + if (v1 == v2) return 0; + return v1 > v2 ? 1 : -1; +} + +int Hdf::compare(int32 v2) const { + int32 v1 = getInt32(); + if (v1 == v2) return 0; + return v1 > v2 ? 1 : -1; +} + +int Hdf::compare(uint32 v2) const { + uint32 v1 = getUInt32(); + if (v1 == v2) return 0; + return v1 > v2 ? 1 : -1; +} + +int Hdf::compare(int64 v2) const { + int64 v1 = getInt64(); + if (v1 == v2) return 0; + return v1 > v2 ? 1 : -1; +} + +int Hdf::compare(uint64 v2) const { + uint64 v1 = getUInt64(); + if (v1 == v2) return 0; + return v1 > v2 ? 1 : -1; +} + +int Hdf::compare(double v2) const { + double v1 = getDouble(); + if (v1 == v2) return 0; + return v1 > v2 ? 1 : -1; +} + +/////////////////////////////////////////////////////////////////////////////// +// sets + +void Hdf::set(const char *value) { + CheckNeoError(hdf_set_value(getRaw(), NULL, (char*)value)); +} + +void Hdf::set(int64 value) { + char buf[24]; + snprintf(buf, sizeof(buf), "%lld", (long long)value); + set(buf); +} + +void Hdf::set(uint64 value) { + char buf[24]; + snprintf(buf, sizeof(buf), "%llu", (unsigned long long)value); + set(buf); +} + +void Hdf::set(double value) { + char buf[32]; + snprintf(buf, sizeof(buf), "%g", value); + set(buf); +} + +/////////////////////////////////////////////////////////////////////////////// +// sub-nodes + +std::string Hdf::getName() const { + char *name = hdf_obj_name(getRaw()); + return name ? name : ""; +} + +std::string Hdf::getFullPath() const { + string fullpath; + if (m_path.empty()) { + fullpath = m_name; + } else { + fullpath = m_path; + if (!m_name.empty()) { + fullpath += "."; + fullpath += m_name; + } + } + return fullpath; +} + +Hdf Hdf::parentImpl() const { + Hdf hdf(*this); + if (m_name.empty()) { + if (m_path.empty()) { + throw HdfInvalidOperation("calling parent() on topmost node"); + } + size_t pos = m_path.rfind('.'); + if (pos == string::npos) { + hdf.m_name = m_path; + hdf.m_path.clear(); + } else { + hdf.m_name = m_path.substr(pos + 1); + hdf.m_path = m_path.substr(0, pos); + } + } else { + hdf.m_name.clear(); + } + return hdf; +} + +const Hdf Hdf::parent() const { + return parentImpl(); +} + +Hdf Hdf::parent() { + return parentImpl(); +} + +const Hdf Hdf::operator[](int name) const { + char buf[12]; + sprintf(buf, "%d", name); + return operator[](buf); +} + +const Hdf Hdf::operator[](const char *name) const { + return Hdf(this, name); +} + +const Hdf Hdf::operator[](const std::string &name) const { + return operator[](name.c_str()); +} + +Hdf Hdf::operator[](int name) { + char buf[12]; + sprintf(buf, "%d", name); + return operator[](buf); +} + +Hdf Hdf::operator[](const char *name) { + return Hdf(this, name); +} + +Hdf Hdf::operator[](const std::string &name) { + return operator[](name.c_str()); +} + +bool Hdf::exists() const { + if (m_rawp == NULL) { + return m_hdf != NULL; + } + + string fullpath = getFullPath(); + if (fullpath.empty()) { + return true; + } + return hdf_get_obj(m_rawp->m_hdf, fullpath.c_str()); +} + +bool Hdf::exists(int name) const { + char buf[12]; + sprintf(buf, "%d", name); + return exists(buf); +} + +bool Hdf::exists(const char *name) const { + return Hdf(this, name).exists(); +} + +bool Hdf::exists(const std::string &name) const { + return name.c_str(); +} + +void Hdf::remove(int name) const { + char buf[12]; + sprintf(buf, "%d", name); + remove(buf); +} + +void Hdf::remove(const char *name) const { + ASSERT(name && *name); + CheckNeoError(hdf_remove_tree(getRaw(), name)); +} + +void Hdf::remove(const std::string &name) const { + remove(name.c_str()); +} + +/////////////////////////////////////////////////////////////////////////////// +// iterations + +Hdf Hdf::firstChild() const { + return hdf_obj_child(getRaw()); +} + +Hdf Hdf::next() const { + return hdf_obj_next(getRaw()); +} + +/////////////////////////////////////////////////////////////////////////////// +// input/output + +void Hdf::fromString(const char *input) { + CheckNeoError(hdf_read_string(getRaw(), (char*)input)); +} + +const char *Hdf::toString() const { + if (m_dump) { + free(m_dump); + m_dump = NULL; + } + CheckNeoError(hdf_write_string(getRaw(), &m_dump)); + return m_dump; +} + +void Hdf::write(const char *filename) const { + CheckNeoError(hdf_write_file(getRaw(), filename)); +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +HDF *Hdf::getRaw() const { + if (m_hdf) return m_hdf; + + if (m_rawp == NULL) { + return NULL; + } + + HDF *ret = NULL; + string fullpath = getFullPath(); + if (fullpath.empty()) { + ret = m_rawp->m_hdf; + } else { + hdf_get_node(m_rawp->m_hdf, (char*)fullpath.c_str(), &ret); + } + m_hdf = ret; + return ret; +} + +void Hdf::CheckNeoError(NEOERR *err) { + if (err != STATUS_OK) { + STRING str; + string_init(&str); + nerr_error_string(err, &str); + throw HdfException(str.buf); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/hdf.h b/src/util/hdf.h new file mode 100644 index 0000000000000..113446ac121f4 --- /dev/null +++ b/src/util/hdf.h @@ -0,0 +1,388 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CONFIG_HDF_H__ +#define __CONFIG_HDF_H__ + +#include "base.h" +#include +#include "exception.h" +#include "neo/neo_hdf.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * A super-fast hierarchical data structure, wrapped around ClearSilver's HDF + * data format: http://www.clearsilver.net/docs/man_hdf.hdf + * + * HDF is a serialization format that emphasizes cleanness and simplicity when + * representing hierarchical data. It's designed to be fast parsing and + * accessing. One example is, + * + * Server { + * Name = MyTestServer + * IP.1 = 192.168.100.100 + * IP.2 = 192.168.100.101 + * } + */ +class HdfRaw; // reference counting HDF* raw pointer, implmented in .cpp file +class Hdf { +public: + /** + * Constructors. + */ + Hdf(); // create an empty HDF tree + Hdf(const char *filename); // open the specified file + Hdf(const std::string &filename); // open the specified file + Hdf(const Hdf *hdf, const char *name); // constructing a sub-node (internal) + Hdf(const Hdf &hdf); // make a copy by reference (internal) + Hdf(HDF *hdf); // attaching a raw pointer (internal) + ~Hdf(); + + /** + * Close current and make a copy of the specified. + */ + void assign(const Hdf &hdf); + + /** + * Copy specified without closing current. + */ + void copy(const Hdf &hdf); + + /** + * Either close current file and open a new file, or append a file's content. + */ + void open(const char *filename); + void open(const std::string &filename) { open(filename.c_str());} + void append(const char *filename); + void append(const std::string &filename) { append(filename.c_str());} + void close(); + + /** + * Read or dump this entire tree in HDF format. + */ + void fromString(const char *input); + const char *toString() const; + void write(const char *filename) const; + void write(const std::string &filename) const { write(filename.c_str());} + + /** + * Get this node's value. When node is not present or node's value is not + * parsable, return default value "defValue" instead. + * + * Boolean "false" is defined as one of these values and anything else is + * "true" (except absent node will take default value): + * 1. empty string + * 2. 0 (note: string "00" or longer are not "false"). + * 3. string "false", "no" or "off" case-insensitively + * + * Numbers can also be specified in hex (0x prefix) or octal (0 prefix). For + * any values that are not entirely parsable to be a number, it will return + * default value instead. + */ + bool getBool(bool defValue = false) const; + const char *get(const char *defValue = NULL) const; + std::string getString(const std::string &defValue = "") const; + char getByte (char defValue = 0) const; + uchar getUByte (uchar defValue = 0) const; + int16 getInt16 (int16 defValue = 0) const; + uint16 getUInt16(uint16 defValue = 0) const; + int32 getInt32 (int32 defValue = 0) const; + uint32 getUInt32(uint32 defValue = 0) const; + int64 getInt64 (int64 defValue = 0) const; + uint64 getUInt64(uint64 defValue = 0) const; + double getDouble(double defValue = 0) const; + + void get(std::vector &values) const; + void get(std::set &values) const; + void get(std::map &values) const; + + operator const char *() const { return get();} + operator std::string() const { return getString();} + operator bool () const { return getBool() ;} + operator char () const { return getByte() ;} + operator uchar () const { return getUByte() ;} + operator int16 () const { return getInt16() ;} + operator uint16 () const { return getUInt16();} + operator int32 () const { return getInt32() ;} + operator uint32 () const { return getUInt32();} + operator int64 () const { return getInt64() ;} + operator uint64 () const { return getUInt64();} + operator double () const { return getDouble();} + + /** + * Set this node's value. + */ + void set(const char *value); + void set(const std::string &value) { set(value.c_str());} + void set(bool value) { set(value ? "1" : "0");} + void set(char value) { set((int64)value);} + void set(uchar value) { set((uint64)value);} + void set(int16 value) { set((int64)value);} + void set(uint16 value) { set((uint64)value);} + void set(int32 value) { set((int64)value);} + void set(uint32 value) { set((uint64)value);} + void set(int64 value); + void set(uint64 value); + void set(double value); + + Hdf &operator=(const char *value) { set(value); return *this;} + Hdf &operator=(const std::string &value) { set(value); return *this;} + Hdf &operator=(bool value) { set(value); return *this;} + Hdf &operator=(char value) { set(value); return *this;} + Hdf &operator=(uchar value) { set(value); return *this;} + Hdf &operator=(int16 value) { set(value); return *this;} + Hdf &operator=(uint16 value) { set(value); return *this;} + Hdf &operator=(int32 value) { set(value); return *this;} + Hdf &operator=(uint32 value) { set(value); return *this;} + Hdf &operator=(int64 value) { set(value); return *this;} + Hdf &operator=(uint64 value) { set(value); return *this;} + Hdf &operator=(double value) { set(value); return *this;} + + /** + * Get this node's fully qualified path or just one-level node name. + */ + std::string getFullPath() const; + std::string getName() const; + + /** + * Get this node's parent. + */ + const Hdf parent() const; + Hdf parent(); + + /** + * Get a sub-node. + */ + const Hdf operator[](int name) const; + const Hdf operator[](const char *name) const; + const Hdf operator[](const std::string &name) const; + Hdf operator[](int name); + Hdf operator[](const char *name); + Hdf operator[](const std::string &name); + + /** + * Note that this is different than getting a boolean value. If "name" is + * present, testing whether a subnode exists. Otherwise, testing myself is + * present or not. + */ + bool exists() const; + bool exists(int name) const; + bool exists(const char *name) const; + bool exists(const std::string &name) const; + + /** + * Note that this is NOT testing existence, but reading a boolean value. + */ + bool operator!() const { return !getBool();} + + /** + * Removes a sub-node from parent. + */ + void remove(int name) const; + void remove(const char *name) const; + void remove(const std::string &name) const; + + /** + * Iterations. For example, + * + * for (Hdf hdf = parent.firstChild(); hdf.exists(); hdf = hdf.next()) { + * } + * + * Please use "hdf.exists()" for testing than casting it to boolean. + */ + Hdf firstChild() const; + Hdf next() const; + + /** + * Comparisons + */ + int compare(const char *v) const; + int compare(const std::string &v) const; + int compare(char v) const; + int compare(uchar v) const; + int compare(int16 v) const; + int compare(uint16 v) const; + int compare(int32 v) const; + int compare(uint32 v) const; + int compare(int64 v) const; + int compare(uint64 v) const; + int compare(double v) const; + + bool operator==(const char *v) const { return compare(v) == 0;} + bool operator!=(const char *v) const { return compare(v) != 0;} + bool operator>=(const char *v) const { return compare(v) >= 0;} + bool operator<=(const char *v) const { return compare(v) <= 0;} + bool operator> (const char *v) const { return compare(v) > 0;} + bool operator< (const char *v) const { return compare(v) < 0;} + + bool operator==(const std::string &v) const { return compare(v) == 0;} + bool operator!=(const std::string &v) const { return compare(v) != 0;} + bool operator>=(const std::string &v) const { return compare(v) >= 0;} + bool operator<=(const std::string &v) const { return compare(v) <= 0;} + bool operator> (const std::string &v) const { return compare(v) > 0;} + bool operator< (const std::string &v) const { return compare(v) < 0;} + + bool operator==(char v) const { return compare(v) == 0;} + bool operator!=(char v) const { return compare(v) != 0;} + bool operator>=(char v) const { return compare(v) >= 0;} + bool operator<=(char v) const { return compare(v) <= 0;} + bool operator> (char v) const { return compare(v) > 0;} + bool operator< (char v) const { return compare(v) < 0;} + + bool operator==(uchar v) const { return compare(v) == 0;} + bool operator!=(uchar v) const { return compare(v) != 0;} + bool operator>=(uchar v) const { return compare(v) >= 0;} + bool operator<=(uchar v) const { return compare(v) <= 0;} + bool operator> (uchar v) const { return compare(v) > 0;} + bool operator< (uchar v) const { return compare(v) < 0;} + + bool operator==(int16 v) const { return compare(v) == 0;} + bool operator!=(int16 v) const { return compare(v) != 0;} + bool operator>=(int16 v) const { return compare(v) >= 0;} + bool operator<=(int16 v) const { return compare(v) <= 0;} + bool operator> (int16 v) const { return compare(v) > 0;} + bool operator< (int16 v) const { return compare(v) < 0;} + + bool operator==(uint16 v) const { return compare(v) == 0;} + bool operator!=(uint16 v) const { return compare(v) != 0;} + bool operator>=(uint16 v) const { return compare(v) >= 0;} + bool operator<=(uint16 v) const { return compare(v) <= 0;} + bool operator> (uint16 v) const { return compare(v) > 0;} + bool operator< (uint16 v) const { return compare(v) < 0;} + + bool operator==(int32 v) const { return compare(v) == 0;} + bool operator!=(int32 v) const { return compare(v) != 0;} + bool operator>=(int32 v) const { return compare(v) >= 0;} + bool operator<=(int32 v) const { return compare(v) <= 0;} + bool operator> (int32 v) const { return compare(v) > 0;} + bool operator< (int32 v) const { return compare(v) < 0;} + + bool operator==(uint32 v) const { return compare(v) == 0;} + bool operator!=(uint32 v) const { return compare(v) != 0;} + bool operator>=(uint32 v) const { return compare(v) >= 0;} + bool operator<=(uint32 v) const { return compare(v) <= 0;} + bool operator> (uint32 v) const { return compare(v) > 0;} + bool operator< (uint32 v) const { return compare(v) < 0;} + + bool operator==(int64 v) const { return compare(v) == 0;} + bool operator!=(int64 v) const { return compare(v) != 0;} + bool operator>=(int64 v) const { return compare(v) >= 0;} + bool operator<=(int64 v) const { return compare(v) <= 0;} + bool operator> (int64 v) const { return compare(v) > 0;} + bool operator< (int64 v) const { return compare(v) < 0;} + + bool operator==(uint64 v) const { return compare(v) == 0;} + bool operator!=(uint64 v) const { return compare(v) != 0;} + bool operator>=(uint64 v) const { return compare(v) >= 0;} + bool operator<=(uint64 v) const { return compare(v) <= 0;} + bool operator> (uint64 v) const { return compare(v) > 0;} + bool operator< (uint64 v) const { return compare(v) < 0;} + + bool operator==(double v) const { return compare(v) == 0;} + bool operator!=(double v) const { return compare(v) != 0;} + bool operator>=(double v) const { return compare(v) >= 0;} + bool operator<=(double v) const { return compare(v) <= 0;} + bool operator> (double v) const { return compare(v) > 0;} + bool operator< (double v) const { return compare(v) < 0;} + + /** + * Throw if there is an error from ClearSilver library. + */ + static void CheckNeoError(NEOERR *err); + +private: + mutable HDF *m_hdf ; // cached HDF pointer + HdfRaw *m_rawp; // raw pointer + std::string m_path; // parent path + std::string m_name; // my name + mutable char *m_dump; // entire tree dump in HDF format + + /** + * There are only two different "modes" of an Hdf object: hdf_ being null or + * non-null. First case is when we proactively constructed an Hdf object by + * either opening a file or starting from scratch by calling Hdf(). Second + * case is when we attach a raw HDF*, almost exclusively used by iterations. + */ + HDF *getRaw() const; + + /** + * Parse value as a signed integer and check to make sure it's within + * [-maxValue-1, maxValue]. If not, throw an HdfDataTypeException + * with specified type string. If node is absent, return default value. + */ + int64 getInt(int64 defValue, const char *type, int64 maxValue) const; + + /** + * Parse value as a unsigned integer and check against mask to make sure + * it's in the specified range. If not, throw an HdfDataTypeException + * with specified type string. If node is absent, return default value. + */ + uint64 getUInt(uint64 defValue, const char *type, uint64 mask) const; + + /** + * Implementation of parent() calls. + */ + Hdf parentImpl() const; +}; + +/** + * Base class of all exceptions Hdf class might throw. + */ +class HdfException : public Exception { +public: + HdfException(const char *fmt, ...) { + va_list ap; va_start(ap, fmt); format(fmt, ap); va_end(ap); + } +}; + +/** + * Trying to get a node's value, but it's not in the specified type. + */ +class HdfDataTypeException : public HdfException { +public: + HdfDataTypeException(const Hdf *hdf, const char *type, const char *value) + : HdfException("HDF node [%s]'s value \"%s\" is not %s", + hdf->getFullPath().c_str(), value, type) { + } +}; + +/** + * A node's value is not expected. + */ +class HdfDataValueException : public HdfException { +public: + HdfDataValueException(const Hdf *hdf, const char *expected = "") + : HdfException("HDF node [%s]'s value \"%s\" is not expected %s", + hdf->getFullPath().c_str(), hdf->get(""), expected) { + } +}; + +/** + * Calling a function in wrong context. + */ +class HdfInvalidOperation : public HdfException { +public: + HdfInvalidOperation(const char *operation) + : HdfException("Invalid operation: %s", operation) { + } +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __CONFIG_HDF_H__ diff --git a/src/util/jemalloc/jemalloc.c b/src/util/jemalloc/jemalloc.c new file mode 100644 index 0000000000000..35ecbbb8894f2 --- /dev/null +++ b/src/util/jemalloc/jemalloc.c @@ -0,0 +1,5804 @@ +/*- + * Copyright (C) 2009 Facebook, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Facebook, Inc. nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ******************************************************************************* + * + * Copyright (C) 2006-2008 Jason Evans . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice(s), this list of conditions and the following disclaimer as + * the first lines of this file unmodified other than the possible + * addition of one or more copyright notices. + * 2. Redistributions in binary form must reproduce the above copyright + * notice(s), this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ******************************************************************************* + * + * This allocator implementation is designed to provide scalable performance + * for multi-threaded programs on multi-processor systems. The following + * features are included for this purpose: + * + * + Multiple arenas are used if there are multiple CPUs, which reduces lock + * contention and cache sloshing. + * + * + Thread-specific caching is used if there are multiple threads, which + * reduces the amount of locking. + * + * + Cache line sharing between arenas is avoided for internal data + * structures. + * + * + Memory is managed in chunks and runs (chunks can be split into runs), + * rather than as individual pages. This provides a constant-time + * mechanism for associating allocations with particular arenas. + * + * Allocation requests are rounded up to the nearest size class, and no record + * of the original request size is maintained. Allocations are broken into + * categories according to size class. Assuming runtime defaults, 4 kB pages + * and a 16 byte quantum on a 32-bit system, the size classes in each category + * are as follows: + * + * |=======================================| + * | Category | Subcategory | Size | + * |=======================================| + * | Small | Tiny | 2 | + * | | | 4 | + * | | | 8 | + * | |------------------+---------| + * | | Quantum-spaced | 16 | + * | | | 32 | + * | | | 48 | + * | | | ... | + * | | | 96 | + * | | | 112 | + * | | | 128 | + * | |------------------+---------| + * | | Cacheline-spaced | 192 | + * | | | 256 | + * | | | 320 | + * | | | 384 | + * | | | 448 | + * | | | 512 | + * | |------------------+---------| + * | | Sub-page | 760 | + * | | | 1024 | + * | | | 1280 | + * | | | ... | + * | | | 3328 | + * | | | 3584 | + * | | | 3840 | + * |=======================================| + * | Large | 4 kB | + * | | 8 kB | + * | | 12 kB | + * | | ... | + * | | 1012 kB | + * | | 1016 kB | + * | | 1020 kB | + * |=======================================| + * | Huge | 1 MB | + * | | 2 MB | + * | | 3 MB | + * | | ... | + * |=======================================| + * + * A different mechanism is used for each category: + * + * Small : Each size class is segregated into its own set of runs. Each run + * maintains a bitmap of which regions are free/allocated. + * + * Large : Each allocation is backed by a dedicated run. Metadata are stored + * in the associated arena chunk header maps. + * + * Huge : Each allocation is backed by a dedicated contiguous set of chunks. + * Metadata are stored in a separate red-black tree. + * + ******************************************************************************* + */ + +#include "jemalloc_defs.h" + +#if 0 +__FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.183 2008/12/01 10:20:59 jasone Exp $"); +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#ifndef SIZE_T_MAX +# define SIZE_T_MAX SIZE_MAX +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef JEMALLOC_LAZY_LOCK +#include +#endif + +#ifndef __DECONST +# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) +#endif + +#include "rb.h" + +#ifdef JEMALLOC_DEBUG + /* Disable inlining to make debugging easier. */ +# define inline +#endif + +/* Size of stack-allocated buffer passed to strerror_r(). */ +#define STRERROR_BUF 64 + +/* + * Minimum alignment of allocations is 2^QUANTUM_2POW bytes. + */ +#ifdef __i386__ +# define QUANTUM_2POW 4 +#endif +#ifdef __ia64__ +# define QUANTUM_2POW 4 +#endif +#ifdef __alpha__ +# define QUANTUM_2POW 4 +#endif +#ifdef __sparc64__ +# define QUANTUM_2POW 4 +#endif +#ifdef __amd64__ +# define QUANTUM_2POW 4 +#endif +#ifdef __arm__ +# define QUANTUM_2POW 3 +#endif +#ifdef __mips__ +# define QUANTUM_2POW 3 +#endif +#ifdef __powerpc__ +# define QUANTUM_2POW 4 +#endif + +#define QUANTUM ((size_t)(1U << QUANTUM_2POW)) +#define QUANTUM_MASK (QUANTUM - 1) + +#define SIZEOF_PTR (1U << SIZEOF_PTR_2POW) + +/* sizeof(int) == (1U << SIZEOF_INT_2POW). */ +#ifndef SIZEOF_INT_2POW +# define SIZEOF_INT_2POW 2 +#endif + +/* We can't use TLS in non-PIC programs, since TLS relies on loader magic. */ +#if (!defined(PIC) && !defined(NO_TLS)) +# define NO_TLS +#endif + +#ifdef NO_TLS + /* JEMALLOC_MAG requires TLS. */ +# ifdef JEMALLOC_MAG +# undef JEMALLOC_MAG +# endif + /* JEMALLOC_BALANCE requires TLS. */ +# ifdef JEMALLOC_BALANCE +# undef JEMALLOC_BALANCE +# endif +#endif + +/* + * Size and alignment of memory chunks that are allocated by the OS's virtual + * memory system. + */ +#define CHUNK_2POW_DEFAULT 20 + +/* Maximum number of dirty pages per arena. */ +#define DIRTY_MAX_DEFAULT (1U << 9) + +/* + * Maximum size of L1 cache line. This is used to avoid cache line aliasing. + * In addition, this controls the spacing of cacheline-spaced size classes. + */ +#define CACHELINE_2POW 6 +#define CACHELINE ((size_t)(1U << CACHELINE_2POW)) +#define CACHELINE_MASK (CACHELINE - 1) + +/* + * Subpages are an artificially designated partitioning of pages. Their only + * purpose is to support subpage-spaced size classes. + * + * There must be at least 4 subpages per page, due to the way size classes are + * handled. + */ +#define SUBPAGE_2POW 8 +#define SUBPAGE ((size_t)(1U << SUBPAGE_2POW)) +#define SUBPAGE_MASK (SUBPAGE - 1) + +#ifdef JEMALLOC_TINY + /* Smallest size class to support. */ +# define TINY_MIN_2POW 1 +#endif + +/* + * Maximum size class that is a multiple of the quantum, but not (necessarily) + * a power of 2. Above this size, allocations are rounded up to the nearest + * power of 2. + */ +#define QSPACE_MAX_2POW_DEFAULT 7 + +/* + * Maximum size class that is a multiple of the cacheline, but not (necessarily) + * a power of 2. Above this size, allocations are rounded up to the nearest + * power of 2. + */ +#define CSPACE_MAX_2POW_DEFAULT 9 + +/* + * RUN_MAX_OVRHD indicates maximum desired run header overhead. Runs are sized + * as small as possible such that this setting is still honored, without + * violating other constraints. The goal is to make runs as small as possible + * without exceeding a per run external fragmentation threshold. + * + * We use binary fixed point math for overhead computations, where the binary + * point is implicitly RUN_BFP bits to the left. + * + * Note that it is possible to set RUN_MAX_OVRHD low enough that it cannot be + * honored for some/all object sizes, since there is one bit of header overhead + * per object (plus a constant). This constraint is relaxed (ignored) for runs + * that are so small that the per-region overhead is greater than: + * + * (RUN_MAX_OVRHD / (reg_size << (3+RUN_BFP)) + */ +#define RUN_BFP 12 +/* \/ Implicit binary fixed point. */ +#define RUN_MAX_OVRHD 0x0000003dU +#define RUN_MAX_OVRHD_RELAX 0x00001800U + +/* Put a cap on small object run size. This overrides RUN_MAX_OVRHD. */ +#define RUN_MAX_SMALL (12 * PAGE_SIZE) + +/* + * Adaptive spinning must eventually switch to blocking, in order to avoid the + * potential for priority inversion deadlock. Backing off past a certain point + * can actually waste time. + */ +#define SPIN_LIMIT_2POW 11 + +/* + * Conversion from spinning to blocking is expensive; we use (1U << + * BLOCK_COST_2POW) to estimate how many more times costly blocking is than + * worst-case spinning. + */ +#define BLOCK_COST_2POW 4 + +#ifdef JEMALLOC_MAG + /* + * Default magazine size, in bytes. max_rounds is calculated to make + * optimal use of the space, leaving just enough room for the magazine + * header. + */ +# define MAG_SIZE_2POW_DEFAULT 9 +#endif + +#ifdef JEMALLOC_BALANCE + /* + * We use an exponential moving average to track recent lock contention, + * where the size of the history window is N, and alpha=2/(N+1). + * + * Due to integer math rounding, very small values here can cause + * substantial degradation in accuracy, thus making the moving average decay + * faster than it would with precise calculation. + */ +# define BALANCE_ALPHA_INV_2POW 9 + + /* + * Threshold value for the exponential moving contention average at which to + * re-assign a thread. + */ +# define BALANCE_THRESHOLD_DEFAULT (1U << (SPIN_LIMIT_2POW-4)) +#endif + +/******************************************************************************/ + +typedef pthread_mutex_t malloc_mutex_t; +typedef pthread_mutex_t malloc_spinlock_t; + +/* Set to true once the allocator has been initialized. */ +static bool malloc_initialized = false; + +/* Used to let the initializing thread recursively allocate. */ +static pthread_t malloc_initializer = (unsigned long)0; + +/* Used to avoid initialization races. */ +static malloc_mutex_t init_lock = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; + +/******************************************************************************/ +/* + * Statistics data structures. + */ + +#ifdef JEMALLOC_STATS + +typedef struct malloc_bin_stats_s malloc_bin_stats_t; +struct malloc_bin_stats_s { + /* + * Number of allocation requests that corresponded to the size of this + * bin. + */ + uint64_t nrequests; + +#ifdef JEMALLOC_MAG + /* Number of magazine reloads from this bin. */ + uint64_t nmags; +#endif + + /* Total number of runs created for this bin's size class. */ + uint64_t nruns; + + /* + * Total number of runs reused by extracting them from the runs tree for + * this bin's size class. + */ + uint64_t reruns; + + /* High-water mark for this bin. */ + unsigned long highruns; + + /* Current number of runs in this bin. */ + unsigned long curruns; +}; + +typedef struct arena_stats_s arena_stats_t; +struct arena_stats_s { + /* Number of bytes currently mapped. */ + size_t mapped; + + /* + * Total number of purge sweeps, total number of madvise calls made, + * and total pages purged in order to keep dirty unused memory under + * control. + */ + uint64_t npurge; + uint64_t nmadvise; + uint64_t purged; + + /* Per-size-category statistics. */ + size_t allocated_small; + uint64_t nmalloc_small; + uint64_t ndalloc_small; + + size_t allocated_large; + uint64_t nmalloc_large; + uint64_t ndalloc_large; + +#ifdef JEMALLOC_BALANCE + /* Number of times this arena reassigned a thread due to contention. */ + uint64_t nbalance; +#endif +}; + +typedef struct chunk_stats_s chunk_stats_t; +struct chunk_stats_s { + /* Number of chunks that were allocated. */ + uint64_t nchunks; + + /* High-water mark for number of chunks allocated. */ + unsigned long highchunks; + + /* + * Current number of chunks allocated. This value isn't maintained for + * any other purpose, so keep track of it in order to be able to set + * highchunks. + */ + unsigned long curchunks; +}; + +#endif /* #ifdef JEMALLOC_STATS */ + +/******************************************************************************/ +/* + * Extent data structures. + */ + +/* Tree of extents. */ +typedef struct extent_node_s extent_node_t; +struct extent_node_s { +#ifdef JEMALLOC_DSS + /* Linkage for the size/address-ordered tree. */ + rb_node(extent_node_t) link_szad; +#endif + + /* Linkage for the address-ordered tree. */ + rb_node(extent_node_t) link_ad; + + /* Pointer to the extent that this tree node is responsible for. */ + void *addr; + + /* Total region size. */ + size_t size; +}; +typedef rb_tree(extent_node_t) extent_tree_t; + +/******************************************************************************/ +/* + * Arena data structures. + */ + +typedef struct arena_s arena_t; +typedef struct arena_bin_s arena_bin_t; + +/* Each element of the chunk map corresponds to one page within the chunk. */ +typedef struct arena_chunk_map_s arena_chunk_map_t; +struct arena_chunk_map_s { + /* + * Linkage for run trees. There are two disjoint uses: + * + * 1) arena_t's runs_avail tree. + * 2) arena_run_t conceptually uses this linkage for in-use non-full + * runs, rather than directly embedding linkage. + */ + rb_node(arena_chunk_map_t) link; + + /* + * Run address (or size) and various flags are stored together. The bit + * layout looks like (assuming 32-bit system): + * + * ???????? ???????? ????---- ---kdzla + * + * ? : Unallocated: Run address for first/last pages, unset for internal + * pages. + * Small: Run address. + * Large: Run size for first page, unset for trailing pages. + * - : Unused. + * k : key? + * d : dirty? + * z : zeroed? + * l : large? + * a : allocated? + * + * Following are example bit patterns for the three types of runs. + * + * r : run address + * s : run size + * x : don't care + * - : 0 + * [dzla] : bit set + * + * Unallocated: + * ssssssss ssssssss ssss---- -------- + * xxxxxxxx xxxxxxxx xxxx---- ----d--- + * ssssssss ssssssss ssss---- -----z-- + * + * Small: + * rrrrrrrr rrrrrrrr rrrr---- -------a + * rrrrrrrr rrrrrrrr rrrr---- -------a + * rrrrrrrr rrrrrrrr rrrr---- -------a + * + * Large: + * ssssssss ssssssss ssss---- ------la + * -------- -------- -------- ------la + * -------- -------- -------- ------la + */ + size_t bits; +#define CHUNK_MAP_KEY ((size_t)0x10U) +#define CHUNK_MAP_DIRTY ((size_t)0x08U) +#define CHUNK_MAP_ZEROED ((size_t)0x04U) +#define CHUNK_MAP_LARGE ((size_t)0x02U) +#define CHUNK_MAP_ALLOCATED ((size_t)0x01U) +}; +typedef rb_tree(arena_chunk_map_t) arena_avail_tree_t; +typedef rb_tree(arena_chunk_map_t) arena_run_tree_t; + +/* Arena chunk header. */ +typedef struct arena_chunk_s arena_chunk_t; +struct arena_chunk_s { + /* Arena that owns the chunk. */ + arena_t *arena; + + /* Linkage for the arena's chunks_dirty tree. */ + rb_node(arena_chunk_t) link_dirty; + + /* Number of dirty pages. */ + size_t ndirty; + + /* Map of pages within chunk that keeps track of free/large/small. */ + arena_chunk_map_t map[1]; /* Dynamically sized. */ +}; +typedef rb_tree(arena_chunk_t) arena_chunk_tree_t; + +typedef struct arena_run_s arena_run_t; +struct arena_run_s { +#ifdef JEMALLOC_DEBUG + uint32_t magic; +# define ARENA_RUN_MAGIC 0x384adf93 +#endif + + /* Bin this run is associated with. */ + arena_bin_t *bin; + + /* Index of first element that might have a free region. */ + unsigned regs_minelm; + + /* Number of free regions in run. */ + unsigned nfree; + + /* Bitmask of in-use regions (0: in use, 1: free). */ + unsigned regs_mask[1]; /* Dynamically sized. */ +}; + +struct arena_bin_s { + /* + * Current run being used to service allocations of this bin's size + * class. + */ + arena_run_t *runcur; + + /* + * Tree of non-full runs. This tree is used when looking for an + * existing run when runcur is no longer usable. We choose the + * non-full run that is lowest in memory; this policy tends to keep + * objects packed well, and it can also help reduce the number of + * almost-empty chunks. + */ + arena_run_tree_t runs; + + /* Size of regions in a run for this bin's size class. */ + size_t reg_size; + + /* Total size of a run for this bin's size class. */ + size_t run_size; + + /* Total number of regions in a run for this bin's size class. */ + uint32_t nregs; + + /* Number of elements in a run's regs_mask for this bin's size class. */ + uint32_t regs_mask_nelms; + + /* Offset of first region in a run for this bin's size class. */ + uint32_t reg0_offset; + +#ifdef JEMALLOC_STATS + /* Bin statistics. */ + malloc_bin_stats_t stats; +#endif +}; + +struct arena_s { +#ifdef JEMALLOC_DEBUG + uint32_t magic; +# define ARENA_MAGIC 0x947d3d24 +#endif + + /* All operations on this arena require that lock be locked. */ + pthread_mutex_t lock; + +#ifdef JEMALLOC_STATS + arena_stats_t stats; +#endif + + /* Tree of dirty-page-containing chunks this arena manages. */ + arena_chunk_tree_t chunks_dirty; + + /* + * In order to avoid rapid chunk allocation/deallocation when an arena + * oscillates right on the cusp of needing a new chunk, cache the most + * recently freed chunk. The spare is left in the arena's chunk trees + * until it is deleted. + * + * There is one spare chunk per arena, rather than one spare total, in + * order to avoid interactions between multiple threads that could make + * a single spare inadequate. + */ + arena_chunk_t *spare; + + /* + * Current count of pages within unused runs that are potentially + * dirty, and for which madvise(... MADV_DONTNEED) has not been called. + * By tracking this, we can institute a limit on how much dirty unused + * memory is mapped for each arena. + */ + size_t ndirty; + + /* + * Size/address-ordered tree of this arena's available runs. This tree + * is used for first-best-fit run allocation. + */ + arena_avail_tree_t runs_avail; + +#ifdef JEMALLOC_BALANCE + /* + * The arena load balancing machinery needs to keep track of how much + * lock contention there is. This value is exponentially averaged. + */ + uint32_t contention; +#endif + + /* + * bins is used to store rings of free regions of the following sizes, + * assuming a 16-byte quantum, 4kB page size, and default + * JEMALLOC_OPTIONS. + * + * bins[i] | size | + * --------+------+ + * 0 | 2 | + * 1 | 4 | + * 2 | 8 | + * --------+------+ + * 3 | 16 | + * 4 | 32 | + * 5 | 48 | + * 6 | 64 | + * : : + * : : + * 33 | 496 | + * 34 | 512 | + * --------+------+ + * 35 | 1024 | + * 36 | 2048 | + * --------+------+ + */ + arena_bin_t bins[1]; /* Dynamically sized. */ +}; + +/******************************************************************************/ +/* + * Magazine data structures. + */ + +#ifdef JEMALLOC_MAG +typedef struct mag_s mag_t; +struct mag_s { + size_t binind; /* Index of associated bin. */ + size_t nrounds; + void *rounds[1]; /* Dynamically sized. */ +}; + +/* + * Magazines are lazily allocated, but once created, they remain until the + * associated mag_rack is destroyed. + */ +typedef struct bin_mags_s bin_mags_t; +struct bin_mags_s { + mag_t *curmag; + mag_t *sparemag; +}; + +typedef struct mag_rack_s mag_rack_t; +struct mag_rack_s { + bin_mags_t bin_mags[1]; /* Dynamically sized. */ +}; +#endif + +/******************************************************************************/ +/* + * Data. + */ + +#ifdef JEMALLOC_LAZY_LOCK +static bool isthreaded = false; +#else +# define isthreaded true +#endif + +/* Number of CPUs. */ +static unsigned ncpus; + +/* + * Page size. STATIC_PAGE_SHIFT is determined by the configure script. If + * DYNAMIC_PAGE_SHIFT is enabled, only use the STATIC_PAGE_* macros where + * compile-time values are required for the purposes of defining data + * structures. + */ +#define STATIC_PAGE_SIZE ((size_t)(1U << STATIC_PAGE_SHIFT)) +#define STATIC_PAGE_MASK ((size_t)(STATIC_PAGE_SIZE - 1)) + +#ifdef DYNAMIC_PAGE_SHIFT +static size_t pagesize; +static size_t pagesize_mask; +static size_t pagesize_2pow; +# define PAGE_SHIFT pagesize_2pow +# define PAGE_SIZE pagesize +# define PAGE_MASK pagesize_mask +#else +# define PAGE_SHIFT STATIC_PAGE_SHIFT +# define PAGE_SIZE STATIC_PAGE_SIZE +# define PAGE_MASK STATIC_PAGE_MASK +#endif + +/* Various bin-related settings. */ +#ifdef JEMALLOC_TINY /* Number of (2^n)-spaced tiny bins. */ +# define ntbins ((unsigned)(QUANTUM_2POW - TINY_MIN_2POW)) +#else +# define ntbins 0 +#endif +static unsigned nqbins; /* Number of quantum-spaced bins. */ +static unsigned ncbins; /* Number of cacheline-spaced bins. */ +static unsigned nsbins; /* Number of subpage-spaced bins. */ +static unsigned nbins; +#ifdef JEMALLOC_TINY +# define tspace_max ((size_t)(QUANTUM >> 1)) +#endif +#define qspace_min QUANTUM +static size_t qspace_max; +static size_t cspace_min; +static size_t cspace_max; +static size_t sspace_min; +static size_t sspace_max; +#define bin_maxclass sspace_max + +static uint8_t const *size2bin; +/* + * const_size2bin is a static constant lookup table that in the common case can + * be used as-is for size2bin. For dynamically linked programs, this avoids + * a page of memory overhead per process. + */ +#define S2B_1(i) i, +#define S2B_2(i) S2B_1(i) S2B_1(i) +#define S2B_4(i) S2B_2(i) S2B_2(i) +#define S2B_8(i) S2B_4(i) S2B_4(i) +#define S2B_16(i) S2B_8(i) S2B_8(i) +#define S2B_32(i) S2B_16(i) S2B_16(i) +#define S2B_64(i) S2B_32(i) S2B_32(i) +#define S2B_128(i) S2B_64(i) S2B_64(i) +#define S2B_256(i) S2B_128(i) S2B_128(i) +static const uint8_t const_size2bin[STATIC_PAGE_SIZE - 255] = { + S2B_1(0xffU) /* 0 */ +#if (QUANTUM_2POW == 4) +/* 64-bit system ************************/ +# ifdef JEMALLOC_TINY + S2B_2(0) /* 2 */ + S2B_2(1) /* 4 */ + S2B_4(2) /* 8 */ + S2B_8(3) /* 16 */ +# define S2B_QMIN 3 +# else + S2B_16(0) /* 16 */ +# define S2B_QMIN 0 +# endif + S2B_16(S2B_QMIN + 1) /* 32 */ + S2B_16(S2B_QMIN + 2) /* 48 */ + S2B_16(S2B_QMIN + 3) /* 64 */ + S2B_16(S2B_QMIN + 4) /* 80 */ + S2B_16(S2B_QMIN + 5) /* 96 */ + S2B_16(S2B_QMIN + 6) /* 112 */ + S2B_16(S2B_QMIN + 7) /* 128 */ +# define S2B_CMIN (S2B_QMIN + 8) +#else +/* 32-bit system ************************/ +# ifdef JEMALLOC_TINY + S2B_2(0) /* 2 */ + S2B_2(1) /* 4 */ + S2B_4(2) /* 8 */ +# define S2B_QMIN 2 +# else + S2B_8(0) /* 8 */ +# define S2B_QMIN 0 +# endif + S2B_8(S2B_QMIN + 1) /* 16 */ + S2B_8(S2B_QMIN + 2) /* 24 */ + S2B_8(S2B_QMIN + 3) /* 32 */ + S2B_8(S2B_QMIN + 4) /* 40 */ + S2B_8(S2B_QMIN + 5) /* 48 */ + S2B_8(S2B_QMIN + 6) /* 56 */ + S2B_8(S2B_QMIN + 7) /* 64 */ + S2B_8(S2B_QMIN + 8) /* 72 */ + S2B_8(S2B_QMIN + 9) /* 80 */ + S2B_8(S2B_QMIN + 10) /* 88 */ + S2B_8(S2B_QMIN + 11) /* 96 */ + S2B_8(S2B_QMIN + 12) /* 104 */ + S2B_8(S2B_QMIN + 13) /* 112 */ + S2B_8(S2B_QMIN + 14) /* 120 */ + S2B_8(S2B_QMIN + 15) /* 128 */ +# define S2B_CMIN (S2B_QMIN + 16) +#endif +/****************************************/ + S2B_64(S2B_CMIN + 0) /* 192 */ + S2B_64(S2B_CMIN + 1) /* 256 */ + S2B_64(S2B_CMIN + 2) /* 320 */ + S2B_64(S2B_CMIN + 3) /* 384 */ + S2B_64(S2B_CMIN + 4) /* 448 */ + S2B_64(S2B_CMIN + 5) /* 512 */ +# define S2B_SMIN (S2B_CMIN + 6) + S2B_256(S2B_SMIN + 0) /* 768 */ + S2B_256(S2B_SMIN + 1) /* 1024 */ + S2B_256(S2B_SMIN + 2) /* 1280 */ + S2B_256(S2B_SMIN + 3) /* 1536 */ + S2B_256(S2B_SMIN + 4) /* 1792 */ + S2B_256(S2B_SMIN + 5) /* 2048 */ + S2B_256(S2B_SMIN + 6) /* 2304 */ + S2B_256(S2B_SMIN + 7) /* 2560 */ + S2B_256(S2B_SMIN + 8) /* 2816 */ + S2B_256(S2B_SMIN + 9) /* 3072 */ + S2B_256(S2B_SMIN + 10) /* 3328 */ + S2B_256(S2B_SMIN + 11) /* 3584 */ + S2B_256(S2B_SMIN + 12) /* 3840 */ +#if (STATIC_PAGE_SHIFT == 13) + S2B_256(S2B_SMIN + 13) /* 4096 */ + S2B_256(S2B_SMIN + 14) /* 4352 */ + S2B_256(S2B_SMIN + 15) /* 4608 */ + S2B_256(S2B_SMIN + 16) /* 4864 */ + S2B_256(S2B_SMIN + 17) /* 5120 */ + S2B_256(S2B_SMIN + 18) /* 5376 */ + S2B_256(S2B_SMIN + 19) /* 5632 */ + S2B_256(S2B_SMIN + 20) /* 5888 */ + S2B_256(S2B_SMIN + 21) /* 6144 */ + S2B_256(S2B_SMIN + 22) /* 6400 */ + S2B_256(S2B_SMIN + 23) /* 6656 */ + S2B_256(S2B_SMIN + 24) /* 6912 */ + S2B_256(S2B_SMIN + 25) /* 7168 */ + S2B_256(S2B_SMIN + 26) /* 7424 */ + S2B_256(S2B_SMIN + 27) /* 7680 */ + S2B_256(S2B_SMIN + 28) /* 7936 */ +#endif +}; +#undef S2B_1 +#undef S2B_2 +#undef S2B_4 +#undef S2B_8 +#undef S2B_16 +#undef S2B_32 +#undef S2B_64 +#undef S2B_128 +#undef S2B_256 +#undef S2B_QMIN +#undef S2B_CMIN +#undef S2B_SMIN + +#ifdef JEMALLOC_MAG +static size_t max_rounds; +#endif + +/* Various chunk-related settings. */ +static size_t chunksize; +static size_t chunksize_mask; /* (chunksize - 1). */ +static size_t chunk_npages; +static size_t arena_chunk_header_npages; +static size_t arena_maxclass; /* Max size class for arenas. */ + +/********/ +/* + * Chunks. + */ + +/* Protects chunk-related data structures. */ +static malloc_mutex_t huge_mtx; + +/* Tree of chunks that are stand-alone huge allocations. */ +static extent_tree_t huge; + +#ifdef JEMALLOC_DSS +/* + * Protects sbrk() calls. This avoids malloc races among threads, though it + * does not protect against races with threads that call sbrk() directly. + */ +static malloc_mutex_t dss_mtx; +/* Base address of the DSS. */ +static void *dss_base; +/* Current end of the DSS, or ((void *)-1) if the DSS is exhausted. */ +static void *dss_prev; +/* Current upper limit on DSS addresses. */ +static void *dss_max; + +/* + * Trees of chunks that were previously allocated (trees differ only in node + * ordering). These are used when allocating chunks, in an attempt to re-use + * address space. Depending on function, different tree orderings are needed, + * which is why there are two trees with the same contents. + */ +static extent_tree_t dss_chunks_szad; +static extent_tree_t dss_chunks_ad; +#endif + +#ifdef JEMALLOC_STATS +/* Huge allocation statistics. */ +static uint64_t huge_nmalloc; +static uint64_t huge_ndalloc; +static size_t huge_allocated; +#endif + +/****************************/ +/* + * base (internal allocation). + */ + +/* + * Current pages that are being used for internal memory allocations. These + * pages are carved up in cacheline-size quanta, so that there is no chance of + * false cache line sharing. + */ +static void *base_pages; +static void *base_next_addr; +static void *base_past_addr; /* Addr immediately past base_pages. */ +static extent_node_t *base_nodes; +static malloc_mutex_t base_mtx; +#ifdef JEMALLOC_STATS +static size_t base_mapped; +#endif + +/********/ +/* + * Arenas. + */ + +/* + * Arenas that are used to service external requests. Not all elements of the + * arenas array are necessarily used; arenas are created lazily as needed. + */ +static arena_t **arenas; +static unsigned narenas; +#ifndef NO_TLS +# ifdef JEMALLOC_BALANCE +static unsigned narenas_2pow; +# else +static unsigned next_arena; +# endif +#endif +static pthread_mutex_t arenas_lock; /* Protects arenas initialization. */ + +#ifndef NO_TLS +/* + * Map of pthread_self() --> arenas[???], used for selecting an arena to use + * for allocations. + */ +static __thread arena_t *arenas_map; +#endif + +#ifdef JEMALLOC_MAG +/* + * Map of thread-specific magazine racks, used for thread-specific object + * caching. + */ +static __thread mag_rack_t *mag_rack; + +/* + * Same contents as mag_rack, but initialized such that the TSD destructor is + * called when a thread exits, so that the cache can be cleaned up. + */ +static pthread_key_t mag_rack_tsd; +#endif + +#ifdef JEMALLOC_STATS +/* Chunk statistics. */ +static chunk_stats_t stats_chunks; +#endif + +/*******************************/ +/* + * Runtime configuration options. + */ +const char *jemalloc_options; + +#ifdef JEMALLOC_DEBUG +static bool opt_abort = true; +# ifdef JEMALLOC_FILL +static bool opt_junk = true; +# endif +#else +static bool opt_abort = false; +# ifdef JEMALLOC_FILL +static bool opt_junk = false; +# endif +#endif +#ifdef JEMALLOC_DSS +static bool opt_dss = true; +static bool opt_mmap = true; +#endif +#ifdef JEMALLOC_MAG +static bool opt_mag = true; +static size_t opt_mag_size_2pow = MAG_SIZE_2POW_DEFAULT; +#endif +static size_t opt_dirty_max = DIRTY_MAX_DEFAULT; +#ifdef JEMALLOC_BALANCE +static uint64_t opt_balance_threshold = BALANCE_THRESHOLD_DEFAULT; +#endif +static bool opt_print_stats = false; +static size_t opt_qspace_max_2pow = QSPACE_MAX_2POW_DEFAULT; +static size_t opt_cspace_max_2pow = CSPACE_MAX_2POW_DEFAULT; +static size_t opt_chunk_2pow = CHUNK_2POW_DEFAULT; +#ifdef JEMALLOC_STATS +static bool opt_utrace = false; +#endif +#ifdef JEMALLOC_SYSV +static bool opt_sysv = false; +#endif +static bool opt_xmalloc = false; +#ifdef JEMALLOC_FILL +static bool opt_zero = false; +#endif +static int opt_narenas_lshift = 0; + +#ifdef JEMALLOC_STATS +typedef struct { + void *p; + size_t s; + void *r; +} malloc_utrace_t; + +#define UTRACE(a, b, c) \ + if (opt_utrace) { \ + malloc_utrace_t ut; \ + ut.p = (a); \ + ut.s = (b); \ + ut.r = (c); \ + utrace(&ut, sizeof(ut)); \ + } +#else +#define UTRACE(a, b, c) +#endif + +/******************************************************************************/ +/* + * Begin function prototypes for non-inline static functions. + */ + +static bool malloc_mutex_init(malloc_mutex_t *mutex); +static bool malloc_spin_init(pthread_mutex_t *lock); +static void wrtmessage(const char *p1, const char *p2, const char *p3, + const char *p4); +#ifdef JEMALLOC_STATS +static void malloc_printf(const char *format, ...); +#endif +static char *umax2s(uintmax_t x, char *s); +#ifdef JEMALLOC_DSS +static bool base_pages_alloc_dss(size_t minsize); +#endif +static bool base_pages_alloc_mmap(size_t minsize); +static bool base_pages_alloc(size_t minsize); +static void *base_alloc(size_t size); +static void *base_calloc(size_t number, size_t size); +static extent_node_t *base_node_alloc(void); +static void base_node_dealloc(extent_node_t *node); +#ifdef JEMALLOC_STATS +static void stats_print(arena_t *arena); +#endif +static void *pages_map(void *addr, size_t size); +static void pages_unmap(void *addr, size_t size); +#ifdef JEMALLOC_DSS +static void *chunk_alloc_dss(size_t size); +static void *chunk_recycle_dss(size_t size, bool zero); +#endif +static void *chunk_alloc_mmap(size_t size); +static void *chunk_alloc(size_t size, bool zero); +#ifdef JEMALLOC_DSS +static extent_node_t *chunk_dealloc_dss_record(void *chunk, size_t size); +static bool chunk_dealloc_dss(void *chunk, size_t size); +#endif +static void chunk_dealloc_mmap(void *chunk, size_t size); +static void chunk_dealloc(void *chunk, size_t size); +#ifndef NO_TLS +static arena_t *choose_arena_hard(void); +#endif +static void arena_run_split(arena_t *arena, arena_run_t *run, size_t size, + bool large, bool zero); +static arena_chunk_t *arena_chunk_alloc(arena_t *arena); +static void arena_chunk_dealloc(arena_t *arena, arena_chunk_t *chunk); +static arena_run_t *arena_run_alloc(arena_t *arena, size_t size, bool large, + bool zero); +static void arena_purge(arena_t *arena); +static void arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty); +static void arena_run_trim_head(arena_t *arena, arena_chunk_t *chunk, + arena_run_t *run, size_t oldsize, size_t newsize); +static void arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk, + arena_run_t *run, size_t oldsize, size_t newsize, bool dirty); +static arena_run_t *arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin); +static void *arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin); +static size_t arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size); +#ifdef JEMALLOC_BALANCE +static void arena_lock_balance_hard(arena_t *arena); +#endif +#ifdef JEMALLOC_MAG +static void mag_load(mag_t *mag); +#endif +static void *arena_malloc_large(arena_t *arena, size_t size, bool zero); +static void *arena_palloc(arena_t *arena, size_t alignment, size_t size, + size_t alloc_size); +static size_t arena_salloc(const void *ptr); +#ifdef JEMALLOC_MAG +static void mag_unload(mag_t *mag); +#endif +static void arena_dalloc_large(arena_t *arena, arena_chunk_t *chunk, + void *ptr); +static void arena_ralloc_large_shrink(arena_t *arena, arena_chunk_t *chunk, + void *ptr, size_t size, size_t oldsize); +static bool arena_ralloc_large_grow(arena_t *arena, arena_chunk_t *chunk, + void *ptr, size_t size, size_t oldsize); +static bool arena_ralloc_large(void *ptr, size_t size, size_t oldsize); +static void *arena_ralloc(void *ptr, size_t size, size_t oldsize); +static bool arena_new(arena_t *arena); +static arena_t *arenas_extend(unsigned ind); +#ifdef JEMALLOC_MAG +static mag_t *mag_create(arena_t *arena, size_t binind); +static void mag_destroy(mag_t *mag); +static mag_rack_t *mag_rack_create(arena_t *arena); +static void mag_rack_destroy(mag_rack_t *rack); +#endif +static void *huge_malloc(size_t size, bool zero); +static void *huge_palloc(size_t alignment, size_t size); +static void *huge_ralloc(void *ptr, size_t size, size_t oldsize); +static void huge_dalloc(void *ptr); +static void malloc_print_stats(void); +#ifdef JEMALLOC_DEBUG +static void size2bin_validate(void); +#endif +static bool size2bin_init(void); +static bool size2bin_init_hard(void); +static unsigned malloc_ncpus(void); +static bool malloc_init_hard(void); +static void thread_cleanup(void *arg); +static void jemalloc_prefork(void); +static void jemalloc_postfork(void); + +/* + * End function prototypes. + */ +/******************************************************************************/ + +static void +wrtmessage(const char *p1, const char *p2, const char *p3, const char *p4) +{ + + if (write(STDERR_FILENO, p1, strlen(p1)) < 0 + || write(STDERR_FILENO, p2, strlen(p2)) < 0 + || write(STDERR_FILENO, p3, strlen(p3)) < 0 + || write(STDERR_FILENO, p4, strlen(p4)) < 0) + return; +} + +void (*jemalloc_message)(const char *p1, const char *p2, const char *p3, + const char *p4) = wrtmessage; + +/* + * We don't want to depend on vsnprintf() for production builds, since that can + * cause unnecessary bloat for static binaries. umax2s() provides minimal + * integer printing functionality, so that malloc_printf() use can be limited to + * JEMALLOC_STATS code. + */ +#define UMAX2S_BUFSIZE 21 +static char * +umax2s(uintmax_t x, char *s) +{ + unsigned i; + + i = UMAX2S_BUFSIZE - 1; + s[i] = '\0'; + do { + i--; + s[i] = "0123456789"[x % 10]; + x /= 10; + } while (x > 0); + + return (&s[i]); +} + +/* + * Define a custom assert() in order to reduce the chances of deadlock during + * assertion failure. + */ +#ifdef JEMALLOC_DEBUG +# define assert(e) do { \ + if (!(e)) { \ + char line_buf[UMAX2S_BUFSIZE]; \ + jemalloc_message(": ", __FILE__, ":", \ + umax2s(__LINE__, line_buf)); \ + jemalloc_message(": Failed assertion: ", "\"", #e, \ + "\"\n"); \ + abort(); \ + } \ +} while (0) +#else +#define assert(e) +#endif + +#ifdef JEMALLOC_STATS +static int +utrace(const void *addr, size_t len) +{ + malloc_utrace_t *ut = (malloc_utrace_t *)addr; + + assert(len == sizeof(malloc_utrace_t)); + + if (ut->p == NULL && ut->s == 0 && ut->r == NULL) + malloc_printf(":utrace: %d malloc_init()\n", + getpid()); + else if (ut->p == NULL && ut->r != NULL) { + malloc_printf(":utrace: %d %p = malloc(%zu)\n", + getpid(), ut->r, ut->s); + } else if (ut->p != NULL && ut->r != NULL) { + malloc_printf(":utrace: %d %p = realloc(%p, %zu)\n", + getpid(), ut->r, ut->p, ut->s); + } else + malloc_printf(":utrace: %d free(%p)\n", getpid(), + ut->p); + + return (0); +} +#endif + +#ifdef JEMALLOC_STATS +/* + * Print to stderr in such a way as to (hopefully) avoid memory allocation. + */ +static void +malloc_printf(const char *format, ...) +{ + char buf[4096]; + va_list ap; + + va_start(ap, format); + vsnprintf(buf, sizeof(buf), format, ap); + va_end(ap); + jemalloc_message(buf, "", "", ""); +} +#endif + +/******************************************************************************/ +/* + * Begin pthreads integration. We intercept pthread_create() calls in order + * to toggle isthreaded if the process goes multi-threaded. + */ + +#ifdef JEMALLOC_LAZY_LOCK +int (*pthread_create_fptr)(pthread_t *, const pthread_attr_t *, + void *(*)(void *), void *); + +static void +get_pthread_create_fptr(void) +{ + + pthread_create_fptr = dlsym(RTLD_NEXT, "pthread_create"); + if (pthread_create_fptr == NULL) { + jemalloc_message("", + ": Error in dlsym(RTLD_NEXT, \"pthread_create\")\n", "", + ""); + abort(); + } +} + +int +pthread_create(pthread_t * thread, const pthread_attr_t * attr, + void *(*start_routine)(void *), void * arg) +{ + static pthread_once_t once_control = PTHREAD_ONCE_INIT; + + pthread_once(&once_control, get_pthread_create_fptr); + + isthreaded = true; + return pthread_create_fptr(thread, attr, start_routine, arg); +} +#endif + +/******************************************************************************/ +/* + * Begin mutex. + */ + +static bool +malloc_mutex_init(malloc_mutex_t *mutex) +{ + pthread_mutexattr_t attr; + + if (pthread_mutexattr_init(&attr) != 0) + return (true); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); + if (pthread_mutex_init(mutex, &attr) != 0) { + pthread_mutexattr_destroy(&attr); + return (true); + } + pthread_mutexattr_destroy(&attr); + + return (false); +} + +static inline void +malloc_mutex_lock(malloc_mutex_t *mutex) +{ + + if (isthreaded) + pthread_mutex_lock(mutex); +} + +static inline void +malloc_mutex_unlock(malloc_mutex_t *mutex) +{ + + if (isthreaded) + pthread_mutex_unlock(mutex); +} + +/* + * End mutex. + */ +/******************************************************************************/ +/* + * Begin spin lock. Spin locks here are actually adaptive mutexes that block + * after a period of spinning, because unbounded spinning would allow for + * priority inversion. + */ + +static bool +malloc_spin_init(pthread_mutex_t *lock) +{ + + if (pthread_mutex_init(lock, NULL) != 0) + return (true); + + return (false); +} + +static inline unsigned +malloc_spin_lock(pthread_mutex_t *lock) +{ + unsigned ret = 0; + + if (isthreaded) { + if (pthread_mutex_trylock(lock) != 0) { + /* Exponentially back off if there are multiple CPUs. */ + if (ncpus > 1) { + unsigned i; + volatile unsigned j; + + for (i = 1; i <= SPIN_LIMIT_2POW; i++) { + for (j = 0; j < (1U << i); j++) { + ret++; + CPU_SPINWAIT; + } + + if (pthread_mutex_trylock(lock) == 0) + return (ret); + } + } + + /* + * Spinning failed. Block until the lock becomes + * available, in order to avoid indefinite priority + * inversion. + */ + pthread_mutex_lock(lock); + assert((ret << BLOCK_COST_2POW) != 0 || ncpus == 1); + return (ret << BLOCK_COST_2POW); + } + } + + return (ret); +} + +static inline void +malloc_spin_unlock(pthread_mutex_t *lock) +{ + + if (isthreaded) + pthread_mutex_unlock(lock); +} + +/* + * End spin lock. + */ +/******************************************************************************/ +/* + * Begin Utility functions/macros. + */ + +/* Return the chunk address for allocation address a. */ +#define CHUNK_ADDR2BASE(a) \ + ((void *)((uintptr_t)(a) & ~chunksize_mask)) + +/* Return the chunk offset of address a. */ +#define CHUNK_ADDR2OFFSET(a) \ + ((size_t)((uintptr_t)(a) & chunksize_mask)) + +/* Return the smallest chunk multiple that is >= s. */ +#define CHUNK_CEILING(s) \ + (((s) + chunksize_mask) & ~chunksize_mask) + +/* Return the smallest quantum multiple that is >= a. */ +#define QUANTUM_CEILING(a) \ + (((a) + QUANTUM_MASK) & ~QUANTUM_MASK) + +/* Return the smallest cacheline multiple that is >= s. */ +#define CACHELINE_CEILING(s) \ + (((s) + CACHELINE_MASK) & ~CACHELINE_MASK) + +/* Return the smallest subpage multiple that is >= s. */ +#define SUBPAGE_CEILING(s) \ + (((s) + SUBPAGE_MASK) & ~SUBPAGE_MASK) + +/* Return the smallest pagesize multiple that is >= s. */ +#define PAGE_CEILING(s) \ + (((s) + PAGE_MASK) & ~PAGE_MASK) + +#ifdef JEMALLOC_TINY +/* Compute the smallest power of 2 that is >= x. */ +static inline size_t +pow2_ceil(size_t x) +{ + + x--; + x |= x >> 1; + x |= x >> 2; + x |= x >> 4; + x |= x >> 8; + x |= x >> 16; +#if (SIZEOF_PTR == 8) + x |= x >> 32; +#endif + x++; + return (x); +} +#endif + +#ifdef JEMALLOC_BALANCE +/* + * Use a simple linear congruential pseudo-random number generator: + * + * prn(y) = (a*x + c) % m + * + * where the following constants ensure maximal period: + * + * a == Odd number (relatively prime to 2^n), and (a-1) is a multiple of 4. + * c == Odd number (relatively prime to 2^n). + * m == 2^32 + * + * See Knuth's TAOCP 3rd Ed., Vol. 2, pg. 17 for details on these constraints. + * + * This choice of m has the disadvantage that the quality of the bits is + * proportional to bit position. For example. the lowest bit has a cycle of 2, + * the next has a cycle of 4, etc. For this reason, we prefer to use the upper + * bits. + */ +# define PRN_DEFINE(suffix, var, a, c) \ +static inline void \ +sprn_##suffix(uint32_t seed) \ +{ \ + var = seed; \ +} \ + \ +static inline uint32_t \ +prn_##suffix(uint32_t lg_range) \ +{ \ + uint32_t ret, x; \ + \ + assert(lg_range > 0); \ + assert(lg_range <= 32); \ + \ + x = (var * (a)) + (c); \ + var = x; \ + ret = x >> (32 - lg_range); \ + \ + return (ret); \ +} +# define SPRN(suffix, seed) sprn_##suffix(seed) +# define PRN(suffix, lg_range) prn_##suffix(lg_range) +#endif + +#ifdef JEMALLOC_BALANCE +/* Define the PRNG used for arena assignment. */ +static __thread uint32_t balance_x; +PRN_DEFINE(balance, balance_x, 1297, 1301) +#endif + +/******************************************************************************/ + +#ifdef JEMALLOC_DSS +static bool +base_pages_alloc_dss(size_t minsize) +{ + + /* + * Do special DSS allocation here, since base allocations don't need to + * be chunk-aligned. + */ + malloc_mutex_lock(&dss_mtx); + if (dss_prev != (void *)-1) { + intptr_t incr; + size_t csize = CHUNK_CEILING(minsize); + + do { + /* Get the current end of the DSS. */ + dss_max = sbrk(0); + + /* + * Calculate how much padding is necessary to + * chunk-align the end of the DSS. Don't worry about + * dss_max not being chunk-aligned though. + */ + incr = (intptr_t)chunksize + - (intptr_t)CHUNK_ADDR2OFFSET(dss_max); + assert(incr >= 0); + if ((size_t)incr < minsize) + incr += csize; + + dss_prev = sbrk(incr); + if (dss_prev == dss_max) { + /* Success. */ + dss_max = (void *)((intptr_t)dss_prev + incr); + base_pages = dss_prev; + base_next_addr = base_pages; + base_past_addr = dss_max; +#ifdef JEMALLOC_STATS + base_mapped += incr; +#endif + malloc_mutex_unlock(&dss_mtx); + return (false); + } + } while (dss_prev != (void *)-1); + } + malloc_mutex_unlock(&dss_mtx); + + return (true); +} +#endif + +static bool +base_pages_alloc_mmap(size_t minsize) +{ + size_t csize; + + assert(minsize != 0); + csize = PAGE_CEILING(minsize); + base_pages = pages_map(NULL, csize); + if (base_pages == NULL) + return (true); + base_next_addr = base_pages; + base_past_addr = (void *)((uintptr_t)base_pages + csize); +#ifdef JEMALLOC_STATS + base_mapped += csize; +#endif + + return (false); +} + +static bool +base_pages_alloc(size_t minsize) +{ + +#ifdef JEMALLOC_DSS + if (opt_dss) { + if (base_pages_alloc_dss(minsize) == false) + return (false); + } + + if (opt_mmap && minsize != 0) +#endif + { + if (base_pages_alloc_mmap(minsize) == false) + return (false); + } + + return (true); +} + +static void * +base_alloc(size_t size) +{ + void *ret; + size_t csize; + + /* Round size up to nearest multiple of the cacheline size. */ + csize = CACHELINE_CEILING(size); + + malloc_mutex_lock(&base_mtx); + /* Make sure there's enough space for the allocation. */ + if ((uintptr_t)base_next_addr + csize > (uintptr_t)base_past_addr) { + if (base_pages_alloc(csize)) { + malloc_mutex_unlock(&base_mtx); + return (NULL); + } + } + /* Allocate. */ + ret = base_next_addr; + base_next_addr = (void *)((uintptr_t)base_next_addr + csize); + malloc_mutex_unlock(&base_mtx); + + return (ret); +} + +static void * +base_calloc(size_t number, size_t size) +{ + void *ret; + + ret = base_alloc(number * size); + memset(ret, 0, number * size); + + return (ret); +} + +static extent_node_t * +base_node_alloc(void) +{ + extent_node_t *ret; + + malloc_mutex_lock(&base_mtx); + if (base_nodes != NULL) { + ret = base_nodes; + base_nodes = *(extent_node_t **)ret; + malloc_mutex_unlock(&base_mtx); + } else { + malloc_mutex_unlock(&base_mtx); + ret = (extent_node_t *)base_alloc(sizeof(extent_node_t)); + } + + return (ret); +} + +static void +base_node_dealloc(extent_node_t *node) +{ + + malloc_mutex_lock(&base_mtx); + *(extent_node_t **)node = base_nodes; + base_nodes = node; + malloc_mutex_unlock(&base_mtx); +} + +/******************************************************************************/ + +#ifdef JEMALLOC_STATS +static void +stats_print(arena_t *arena) +{ + unsigned i, gap_start; + + malloc_printf("dirty: %zu page%s dirty, %llu sweep%s," + " %llu madvise%s, %llu page%s purged\n", + arena->ndirty, arena->ndirty == 1 ? "" : "s", + arena->stats.npurge, arena->stats.npurge == 1 ? "" : "s", + arena->stats.nmadvise, arena->stats.nmadvise == 1 ? "" : "s", + arena->stats.purged, arena->stats.purged == 1 ? "" : "s"); + + malloc_printf(" allocated nmalloc ndalloc\n"); + malloc_printf("small: %12zu %12llu %12llu\n", + arena->stats.allocated_small, arena->stats.nmalloc_small, + arena->stats.ndalloc_small); + malloc_printf("large: %12zu %12llu %12llu\n", + arena->stats.allocated_large, arena->stats.nmalloc_large, + arena->stats.ndalloc_large); + malloc_printf("total: %12zu %12llu %12llu\n", + arena->stats.allocated_small + arena->stats.allocated_large, + arena->stats.nmalloc_small + arena->stats.nmalloc_large, + arena->stats.ndalloc_small + arena->stats.ndalloc_large); + malloc_printf("mapped: %12zu\n", arena->stats.mapped); + +#ifdef JEMALLOC_MAG + if (opt_mag) { + malloc_printf("bins: bin size regs pgs mags " + "newruns reruns maxruns curruns\n"); + } else { +#endif + malloc_printf("bins: bin size regs pgs requests " + "newruns reruns maxruns curruns\n"); +#ifdef JEMALLOC_MAG + } +#endif + for (i = 0, gap_start = UINT_MAX; i < nbins; i++) { + if (arena->bins[i].stats.nruns == 0) { + if (gap_start == UINT_MAX) + gap_start = i; + } else { + if (gap_start != UINT_MAX) { + if (i > gap_start + 1) { + /* Gap of more than one size class. */ + malloc_printf("[%u..%u]\n", + gap_start, i - 1); + } else { + /* Gap of one size class. */ + malloc_printf("[%u]\n", gap_start); + } + gap_start = UINT_MAX; + } + malloc_printf( + "%13u %1s %4u %4u %3u %9llu %9llu" + " %9llu %7lu %7lu\n", + i, + i < ntbins ? "T" : i < ntbins + nqbins ? "Q" : + i < ntbins + nqbins + ncbins ? "C" : "S", + arena->bins[i].reg_size, + arena->bins[i].nregs, + arena->bins[i].run_size >> PAGE_SHIFT, +#ifdef JEMALLOC_MAG + (opt_mag) ? arena->bins[i].stats.nmags : +#endif + arena->bins[i].stats.nrequests, + arena->bins[i].stats.nruns, + arena->bins[i].stats.reruns, + arena->bins[i].stats.highruns, + arena->bins[i].stats.curruns); + } + } + if (gap_start != UINT_MAX) { + if (i > gap_start + 1) { + /* Gap of more than one size class. */ + malloc_printf("[%u..%u]\n", gap_start, i - 1); + } else { + /* Gap of one size class. */ + malloc_printf("[%u]\n", gap_start); + } + } +} +#endif + +/* + * End Utility functions/macros. + */ +/******************************************************************************/ +/* + * Begin extent tree code. + */ + +#ifdef JEMALLOC_DSS +static inline int +extent_szad_comp(extent_node_t *a, extent_node_t *b) +{ + int ret; + size_t a_size = a->size; + size_t b_size = b->size; + + ret = (a_size > b_size) - (a_size < b_size); + if (ret == 0) { + uintptr_t a_addr = (uintptr_t)a->addr; + uintptr_t b_addr = (uintptr_t)b->addr; + + ret = (a_addr > b_addr) - (a_addr < b_addr); + } + + return (ret); +} + +/* Wrap red-black tree macros in functions. */ +rb_wrap(static, extent_tree_szad_, extent_tree_t, extent_node_t, + link_szad, extent_szad_comp) +#endif + +static inline int +extent_ad_comp(extent_node_t *a, extent_node_t *b) +{ + uintptr_t a_addr = (uintptr_t)a->addr; + uintptr_t b_addr = (uintptr_t)b->addr; + + return ((a_addr > b_addr) - (a_addr < b_addr)); +} + +/* Wrap red-black tree macros in functions. */ +rb_wrap(static, extent_tree_ad_, extent_tree_t, extent_node_t, link_ad, + extent_ad_comp) + +/* + * End extent tree code. + */ +/******************************************************************************/ +/* + * Begin chunk management functions. + */ + +static void * +pages_map(void *addr, size_t size) +{ + void *ret; + + /* + * We don't use MAP_FIXED here, because it can cause the *replacement* + * of existing mappings, and we only want to create new mappings. + */ + ret = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, + -1, 0); + assert(ret != NULL); + + if (ret == MAP_FAILED) + ret = NULL; + else if (addr != NULL && ret != addr) { + /* + * We succeeded in mapping memory, but not in the right place. + */ + if (munmap(ret, size) == -1) { + char buf[STRERROR_BUF]; + + strerror_r(errno, buf, sizeof(buf)); + jemalloc_message("", + ": Error in munmap(): ", buf, "\n"); + if (opt_abort) + abort(); + } + ret = NULL; + } + + assert(ret == NULL || (addr == NULL && ret != addr) + || (addr != NULL && ret == addr)); + return (ret); +} + +static void +pages_unmap(void *addr, size_t size) +{ + + if (munmap(addr, size) == -1) { + char buf[STRERROR_BUF]; + + strerror_r(errno, buf, sizeof(buf)); + jemalloc_message("", + ": Error in munmap(): ", buf, "\n"); + if (opt_abort) + abort(); + } +} + +#ifdef JEMALLOC_DSS +static void * +chunk_alloc_dss(size_t size) +{ + + /* + * sbrk() uses a signed increment argument, so take care not to + * interpret a huge allocation request as a negative increment. + */ + if ((intptr_t)size < 0) + return (NULL); + + malloc_mutex_lock(&dss_mtx); + if (dss_prev != (void *)-1) { + intptr_t incr; + + /* + * The loop is necessary to recover from races with other + * threads that are using the DSS for something other than + * malloc. + */ + do { + void *ret; + + /* Get the current end of the DSS. */ + dss_max = sbrk(0); + + /* + * Calculate how much padding is necessary to + * chunk-align the end of the DSS. + */ + incr = (intptr_t)size + - (intptr_t)CHUNK_ADDR2OFFSET(dss_max); + if (incr == (intptr_t)size) + ret = dss_max; + else { + ret = (void *)((intptr_t)dss_max + incr); + incr += size; + } + + dss_prev = sbrk(incr); + if (dss_prev == dss_max) { + /* Success. */ + dss_max = (void *)((intptr_t)dss_prev + incr); + malloc_mutex_unlock(&dss_mtx); + return (ret); + } + } while (dss_prev != (void *)-1); + } + malloc_mutex_unlock(&dss_mtx); + + return (NULL); +} + +static void * +chunk_recycle_dss(size_t size, bool zero) +{ + extent_node_t *node, key; + + key.addr = NULL; + key.size = size; + malloc_mutex_lock(&dss_mtx); + node = extent_tree_szad_nsearch(&dss_chunks_szad, &key); + if (node != NULL) { + void *ret = node->addr; + + /* Remove node from the tree. */ + extent_tree_szad_remove(&dss_chunks_szad, node); + if (node->size == size) { + extent_tree_ad_remove(&dss_chunks_ad, node); + base_node_dealloc(node); + } else { + /* + * Insert the remainder of node's address range as a + * smaller chunk. Its position within dss_chunks_ad + * does not change. + */ + assert(node->size > size); + node->addr = (void *)((uintptr_t)node->addr + size); + node->size -= size; + extent_tree_szad_insert(&dss_chunks_szad, node); + } + malloc_mutex_unlock(&dss_mtx); + + if (zero) + memset(ret, 0, size); + return (ret); + } + malloc_mutex_unlock(&dss_mtx); + + return (NULL); +} +#endif + +static void * +chunk_alloc_mmap(size_t size) +{ + void *ret; + size_t offset; + + /* + * Ideally, there would be a way to specify alignment to mmap() (like + * NetBSD has), but in the absence of such a feature, we have to work + * hard to efficiently create aligned mappings. The reliable, but + * expensive method is to create a mapping that is over-sized, then + * trim the excess. However, that always results in at least one call + * to pages_unmap(). + * + * A more optimistic approach is to try mapping precisely the right + * amount, then try to append another mapping if alignment is off. In + * practice, this works out well as long as the application is not + * interleaving mappings via direct mmap() calls. If we do run into a + * situation where there is an interleaved mapping and we are unable to + * extend an unaligned mapping, our best option is to momentarily + * revert to the reliable-but-expensive method. This will tend to + * leave a gap in the memory map that is too small to cause later + * problems for the optimistic method. + */ + + ret = pages_map(NULL, size); + if (ret == NULL) + return (NULL); + + offset = CHUNK_ADDR2OFFSET(ret); + if (offset != 0) { + /* Try to extend chunk boundary. */ + if (pages_map((void *)((uintptr_t)ret + size), + chunksize - offset) == NULL) { + /* + * Extension failed. Clean up, then revert to the + * reliable-but-expensive method. + */ + pages_unmap(ret, size); + + /* Beware size_t wrap-around. */ + if (size + chunksize <= size) + return NULL; + + ret = pages_map(NULL, size + chunksize); + if (ret == NULL) + return (NULL); + + /* Clean up unneeded leading/trailing space. */ + offset = CHUNK_ADDR2OFFSET(ret); + if (offset != 0) { + /* Leading space. */ + pages_unmap(ret, chunksize - offset); + + ret = (void *)((uintptr_t)ret + + (chunksize - offset)); + + /* Trailing space. */ + pages_unmap((void *)((uintptr_t)ret + size), + offset); + } else { + /* Trailing space only. */ + pages_unmap((void *)((uintptr_t)ret + size), + chunksize); + } + } else { + /* Clean up unneeded leading space. */ + pages_unmap(ret, chunksize - offset); + ret = (void *)((uintptr_t)ret + (chunksize - offset)); + } + } + + return (ret); +} + +static void * +chunk_alloc(size_t size, bool zero) +{ + void *ret; + + assert(size != 0); + assert((size & chunksize_mask) == 0); + +#ifdef JEMALLOC_DSS + if (opt_dss) { + ret = chunk_recycle_dss(size, zero); + if (ret != NULL) { + goto RETURN; + } + + ret = chunk_alloc_dss(size); + if (ret != NULL) + goto RETURN; + } + + if (opt_mmap) +#endif + { + ret = chunk_alloc_mmap(size); + if (ret != NULL) + goto RETURN; + } + + /* All strategies for allocation failed. */ + ret = NULL; +RETURN: +#ifdef JEMALLOC_STATS + if (ret != NULL) { + stats_chunks.nchunks += (size / chunksize); + stats_chunks.curchunks += (size / chunksize); + } + if (stats_chunks.curchunks > stats_chunks.highchunks) + stats_chunks.highchunks = stats_chunks.curchunks; +#endif + + assert(CHUNK_ADDR2BASE(ret) == ret); + return (ret); +} + +#ifdef JEMALLOC_DSS +static extent_node_t * +chunk_dealloc_dss_record(void *chunk, size_t size) +{ + extent_node_t *node, *prev, key; + + key.addr = (void *)((uintptr_t)chunk + size); + node = extent_tree_ad_nsearch(&dss_chunks_ad, &key); + /* Try to coalesce forward. */ + if (node != NULL && node->addr == key.addr) { + /* + * Coalesce chunk with the following address range. This does + * not change the position within dss_chunks_ad, so only + * remove/insert from/into dss_chunks_szad. + */ + extent_tree_szad_remove(&dss_chunks_szad, node); + node->addr = chunk; + node->size += size; + extent_tree_szad_insert(&dss_chunks_szad, node); + } else { + /* + * Coalescing forward failed, so insert a new node. Drop + * dss_mtx during node allocation, since it is possible that a + * new base chunk will be allocated. + */ + malloc_mutex_unlock(&dss_mtx); + node = base_node_alloc(); + malloc_mutex_lock(&dss_mtx); + if (node == NULL) + return (NULL); + node->addr = chunk; + node->size = size; + extent_tree_ad_insert(&dss_chunks_ad, node); + extent_tree_szad_insert(&dss_chunks_szad, node); + } + + /* Try to coalesce backward. */ + prev = extent_tree_ad_prev(&dss_chunks_ad, node); + if (prev != NULL && (void *)((uintptr_t)prev->addr + prev->size) == + chunk) { + /* + * Coalesce chunk with the previous address range. This does + * not change the position within dss_chunks_ad, so only + * remove/insert node from/into dss_chunks_szad. + */ + extent_tree_szad_remove(&dss_chunks_szad, prev); + extent_tree_ad_remove(&dss_chunks_ad, prev); + + extent_tree_szad_remove(&dss_chunks_szad, node); + node->addr = prev->addr; + node->size += prev->size; + extent_tree_szad_insert(&dss_chunks_szad, node); + + base_node_dealloc(prev); + } + + return (node); +} + +static bool +chunk_dealloc_dss(void *chunk, size_t size) +{ + + malloc_mutex_lock(&dss_mtx); + if ((uintptr_t)chunk >= (uintptr_t)dss_base + && (uintptr_t)chunk < (uintptr_t)dss_max) { + extent_node_t *node; + + /* Try to coalesce with other unused chunks. */ + node = chunk_dealloc_dss_record(chunk, size); + if (node != NULL) { + chunk = node->addr; + size = node->size; + } + + /* Get the current end of the DSS. */ + dss_max = sbrk(0); + + /* + * Try to shrink the DSS if this chunk is at the end of the + * DSS. The sbrk() call here is subject to a race condition + * with threads that use brk(2) or sbrk(2) directly, but the + * alternative would be to leak memory for the sake of poorly + * designed multi-threaded programs. + */ + if ((void *)((uintptr_t)chunk + size) == dss_max + && (dss_prev = sbrk(-(intptr_t)size)) == dss_max) { + /* Success. */ + dss_max = (void *)((intptr_t)dss_prev - (intptr_t)size); + + if (node != NULL) { + extent_tree_szad_remove(&dss_chunks_szad, node); + extent_tree_ad_remove(&dss_chunks_ad, node); + base_node_dealloc(node); + } + malloc_mutex_unlock(&dss_mtx); + } else { + malloc_mutex_unlock(&dss_mtx); + madvise(chunk, size, MADV_DONTNEED); + } + + return (false); + } + malloc_mutex_unlock(&dss_mtx); + + return (true); +} +#endif + +static void +chunk_dealloc_mmap(void *chunk, size_t size) +{ + + pages_unmap(chunk, size); +} + +static void +chunk_dealloc(void *chunk, size_t size) +{ + + assert(chunk != NULL); + assert(CHUNK_ADDR2BASE(chunk) == chunk); + assert(size != 0); + assert((size & chunksize_mask) == 0); + +#ifdef JEMALLOC_STATS + stats_chunks.curchunks -= (size / chunksize); +#endif + +#ifdef JEMALLOC_DSS + if (opt_dss) { + if (chunk_dealloc_dss(chunk, size) == false) + return; + } + + if (opt_mmap) +#endif + chunk_dealloc_mmap(chunk, size); +} + +/* + * End chunk management functions. + */ +/******************************************************************************/ +/* + * Begin arena. + */ + +/* + * Choose an arena based on a per-thread value (fast-path code, calls slow-path + * code if necessary). + */ +static inline arena_t * +choose_arena(void) +{ + arena_t *ret; + + /* + * We can only use TLS if this is a PIC library, since for the static + * library version, libc's malloc is used by TLS allocation, which + * introduces a bootstrapping issue. + */ +#ifndef NO_TLS + ret = arenas_map; + if (ret == NULL) { + ret = choose_arena_hard(); + assert(ret != NULL); + } +#else + if (isthreaded && narenas > 1) { + unsigned long ind; + + /* + * Hash pthread_self() to one of the arenas. There is a prime + * number of arenas, so this has a reasonable chance of + * working. Even so, the hashing can be easily thwarted by + * inconvenient pthread_self() values. Without specific + * knowledge of how pthread_self() calculates values, we can't + * easily do much better than this. + */ + ind = (unsigned long) pthread_self() % narenas; + + /* + * Optimistially assume that arenas[ind] has been initialized. + * At worst, we find out that some other thread has already + * done so, after acquiring the lock in preparation. Note that + * this lazy locking also has the effect of lazily forcing + * cache coherency; without the lock acquisition, there's no + * guarantee that modification of arenas[ind] by another thread + * would be seen on this CPU for an arbitrary amount of time. + * + * In general, this approach to modifying a synchronized value + * isn't a good idea, but in this case we only ever modify the + * value once, so things work out well. + */ + ret = arenas[ind]; + if (ret == NULL) { + /* + * Avoid races with another thread that may have already + * initialized arenas[ind]. + */ + malloc_spin_lock(&arenas_lock); + if (arenas[ind] == NULL) + ret = arenas_extend((unsigned)ind); + else + ret = arenas[ind]; + malloc_spin_unlock(&arenas_lock); + } + } else + ret = arenas[0]; +#endif + + assert(ret != NULL); + return (ret); +} + +#ifndef NO_TLS +/* + * Choose an arena based on a per-thread value (slow-path code only, called + * only by choose_arena()). + */ +static arena_t * +choose_arena_hard(void) +{ + arena_t *ret; + + assert(isthreaded); + +#ifdef JEMALLOC_BALANCE + /* Seed the PRNG used for arena load balancing. */ + SPRN(balance, (uint32_t)(uintptr_t)(pthread_self())); +#endif + + if (narenas > 1) { +#ifdef JEMALLOC_BALANCE + unsigned ind; + + ind = PRN(balance, narenas_2pow); + if ((ret = arenas[ind]) == NULL) { + malloc_spin_lock(&arenas_lock); + if ((ret = arenas[ind]) == NULL) + ret = arenas_extend(ind); + malloc_spin_unlock(&arenas_lock); + } +#else + malloc_spin_lock(&arenas_lock); + if ((ret = arenas[next_arena]) == NULL) + ret = arenas_extend(next_arena); + next_arena = (next_arena + 1) % narenas; + malloc_spin_unlock(&arenas_lock); +#endif + } else + ret = arenas[0]; + + arenas_map = ret; + + return (ret); +} +#endif + +static inline int +arena_chunk_comp(arena_chunk_t *a, arena_chunk_t *b) +{ + uintptr_t a_chunk = (uintptr_t)a; + uintptr_t b_chunk = (uintptr_t)b; + + assert(a != NULL); + assert(b != NULL); + + return ((a_chunk > b_chunk) - (a_chunk < b_chunk)); +} + +/* Wrap red-black tree macros in functions. */ +rb_wrap(static, arena_chunk_tree_dirty_, arena_chunk_tree_t, + arena_chunk_t, link_dirty, arena_chunk_comp) + +static inline int +arena_run_comp(arena_chunk_map_t *a, arena_chunk_map_t *b) +{ + uintptr_t a_mapelm = (uintptr_t)a; + uintptr_t b_mapelm = (uintptr_t)b; + + assert(a != NULL); + assert(b != NULL); + + return ((a_mapelm > b_mapelm) - (a_mapelm < b_mapelm)); +} + +/* Wrap red-black tree macros in functions. */ +rb_wrap(static, arena_run_tree_, arena_run_tree_t, arena_chunk_map_t, + link, arena_run_comp) + +static inline int +arena_avail_comp(arena_chunk_map_t *a, arena_chunk_map_t *b) +{ + int ret; + size_t a_size = a->bits & ~PAGE_MASK; + size_t b_size = b->bits & ~PAGE_MASK; + + ret = (a_size > b_size) - (a_size < b_size); + if (ret == 0) { + uintptr_t a_mapelm, b_mapelm; + + if ((a->bits & CHUNK_MAP_KEY) == 0) + a_mapelm = (uintptr_t)a; + else { + /* + * Treat keys as though they are lower than anything + * else. + */ + a_mapelm = 0; + } + b_mapelm = (uintptr_t)b; + + ret = (a_mapelm > b_mapelm) - (a_mapelm < b_mapelm); + } + + return (ret); +} + +/* Wrap red-black tree macros in functions. */ +rb_wrap(static, arena_avail_tree_, arena_avail_tree_t, + arena_chunk_map_t, link, arena_avail_comp) + +static inline void * +arena_run_reg_alloc(arena_run_t *run, arena_bin_t *bin) +{ + void *ret; + unsigned i, mask, bit, regind; + + assert(run->magic == ARENA_RUN_MAGIC); + assert(run->regs_minelm < bin->regs_mask_nelms); + + /* + * Move the first check outside the loop, so that run->regs_minelm can + * be updated unconditionally, without the possibility of updating it + * multiple times. + */ + i = run->regs_minelm; + mask = run->regs_mask[i]; + if (mask != 0) { + /* Usable allocation found. */ + bit = ffs((int)mask) - 1; + + regind = ((i << (SIZEOF_INT_2POW + 3)) + bit); + assert(regind < bin->nregs); + ret = (void *)(((uintptr_t)run) + bin->reg0_offset + + (bin->reg_size * regind)); + + /* Clear bit. */ + mask ^= (1U << bit); + run->regs_mask[i] = mask; + + return (ret); + } + + for (i++; i < bin->regs_mask_nelms; i++) { + mask = run->regs_mask[i]; + if (mask != 0) { + /* Usable allocation found. */ + bit = ffs((int)mask) - 1; + + regind = ((i << (SIZEOF_INT_2POW + 3)) + bit); + assert(regind < bin->nregs); + ret = (void *)(((uintptr_t)run) + bin->reg0_offset + + (bin->reg_size * regind)); + + /* Clear bit. */ + mask ^= (1U << bit); + run->regs_mask[i] = mask; + + /* + * Make a note that nothing before this element + * contains a free region. + */ + run->regs_minelm = i; /* Low payoff: + (mask == 0); */ + + return (ret); + } + } + /* Not reached. */ + assert(0); + return (NULL); +} + +static inline void +arena_run_reg_dalloc(arena_run_t *run, arena_bin_t *bin, void *ptr, size_t size) +{ + unsigned diff, regind, elm, bit; + + assert(run->magic == ARENA_RUN_MAGIC); + + /* + * Avoid doing division with a variable divisor if possible. Using + * actual division here can reduce allocator throughput by over 20%! + */ + diff = (unsigned)((uintptr_t)ptr - (uintptr_t)run - bin->reg0_offset); + if ((size & (size - 1)) == 0) { + /* + * log2_table allows fast division of a power of two in the + * [1..128] range. + * + * (x / divisor) becomes (x >> log2_table[divisor - 1]). + */ + static const unsigned char log2_table[] = { + 0, 1, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 4, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 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, 6, + 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, 7 + }; + + if (size <= 128) + regind = (diff >> log2_table[size - 1]); + else if (size <= 32768) + regind = diff >> (8 + log2_table[(size >> 8) - 1]); + else + regind = diff / size; + } else if (size < qspace_max) { + /* + * To divide by a number D that is not a power of two we + * multiply by (2^21 / D) and then right shift by 21 positions. + * + * X / D + * + * becomes + * + * (X * qsize_invs[(D >> QUANTUM_2POW) - 3]) + * >> SIZE_INV_SHIFT + * + * We can omit the first three elements, because we never + * divide by 0, and QUANTUM and 2*QUANTUM are both powers of + * two, which are handled above. + */ +#define SIZE_INV_SHIFT 21 +#define QSIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s << QUANTUM_2POW)) + 1) + static const unsigned qsize_invs[] = { + QSIZE_INV(3), + QSIZE_INV(4), QSIZE_INV(5), QSIZE_INV(6), QSIZE_INV(7) +#if (QUANTUM_2POW < 4) + , + QSIZE_INV(8), QSIZE_INV(9), QSIZE_INV(10), QSIZE_INV(11), + QSIZE_INV(12),QSIZE_INV(13), QSIZE_INV(14), QSIZE_INV(15) +#endif + }; + assert(QUANTUM * (((sizeof(qsize_invs)) / sizeof(unsigned)) + 3) + >= (1U << QSPACE_MAX_2POW_DEFAULT)); + + if (size <= (((sizeof(qsize_invs) / sizeof(unsigned)) + 2) << + QUANTUM_2POW)) { + regind = qsize_invs[(size >> QUANTUM_2POW) - 3] * diff; + regind >>= SIZE_INV_SHIFT; + } else + regind = diff / size; +#undef QSIZE_INV + } else if (size < cspace_max) { +#define CSIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s << CACHELINE_2POW)) + 1) + static const unsigned csize_invs[] = { + CSIZE_INV(3), + CSIZE_INV(4), CSIZE_INV(5), CSIZE_INV(6), CSIZE_INV(7) + }; + assert(CACHELINE * (((sizeof(csize_invs)) / sizeof(unsigned)) + + 3) >= (1U << CSPACE_MAX_2POW_DEFAULT)); + + if (size <= (((sizeof(csize_invs) / sizeof(unsigned)) + 2) << + CACHELINE_2POW)) { + regind = csize_invs[(size >> CACHELINE_2POW) - 3] * + diff; + regind >>= SIZE_INV_SHIFT; + } else + regind = diff / size; +#undef CSIZE_INV + } else { +#define SSIZE_INV(s) (((1U << SIZE_INV_SHIFT) / (s << SUBPAGE_2POW)) + 1) + static const unsigned ssize_invs[] = { + SSIZE_INV(3), + SSIZE_INV(4), SSIZE_INV(5), SSIZE_INV(6), SSIZE_INV(7), + SSIZE_INV(8), SSIZE_INV(9), SSIZE_INV(10), SSIZE_INV(11), + SSIZE_INV(12), SSIZE_INV(13), SSIZE_INV(14), SSIZE_INV(15) +#if (STATIC_PAGE_SHIFT == 13) + , + SSIZE_INV(16), SSIZE_INV(17), SSIZE_INV(18), SSIZE_INV(19), + SSIZE_INV(20), SSIZE_INV(21), SSIZE_INV(22), SSIZE_INV(23), + SSIZE_INV(24), SSIZE_INV(25), SSIZE_INV(26), SSIZE_INV(27), + SSIZE_INV(28), SSIZE_INV(29), SSIZE_INV(29), SSIZE_INV(30) +#endif + }; + assert(SUBPAGE * (((sizeof(ssize_invs)) / sizeof(unsigned)) + 3) + >= PAGE_SIZE); + + if (size < (((sizeof(ssize_invs) / sizeof(unsigned)) + 2) << + SUBPAGE_2POW)) { + regind = ssize_invs[(size >> SUBPAGE_2POW) - 3] * diff; + regind >>= SIZE_INV_SHIFT; + } else + regind = diff / size; +#undef SSIZE_INV + } +#undef SIZE_INV_SHIFT + assert(diff == regind * size); + assert(regind < bin->nregs); + + elm = regind >> (SIZEOF_INT_2POW + 3); + if (elm < run->regs_minelm) + run->regs_minelm = elm; + bit = regind - (elm << (SIZEOF_INT_2POW + 3)); + assert((run->regs_mask[elm] & (1U << bit)) == 0); + run->regs_mask[elm] |= (1U << bit); +} + +static void +arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large, + bool zero) +{ + arena_chunk_t *chunk; + size_t old_ndirty, run_ind, total_pages, need_pages, rem_pages, i; + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); + old_ndirty = chunk->ndirty; + run_ind = (unsigned)(((uintptr_t)run - (uintptr_t)chunk) + >> PAGE_SHIFT); + total_pages = (chunk->map[run_ind].bits & ~PAGE_MASK) >> + PAGE_SHIFT; + need_pages = (size >> PAGE_SHIFT); + assert(need_pages > 0); + assert(need_pages <= total_pages); + rem_pages = total_pages - need_pages; + + arena_avail_tree_remove(&arena->runs_avail, &chunk->map[run_ind]); + + /* Keep track of trailing unused pages for later use. */ + if (rem_pages > 0) { + chunk->map[run_ind+need_pages].bits = (rem_pages << + PAGE_SHIFT) | (chunk->map[run_ind+need_pages].bits & + PAGE_MASK); + chunk->map[run_ind+total_pages-1].bits = (rem_pages << + PAGE_SHIFT) | (chunk->map[run_ind+total_pages-1].bits & + PAGE_MASK); + arena_avail_tree_insert(&arena->runs_avail, + &chunk->map[run_ind+need_pages]); + } + + for (i = 0; i < need_pages; i++) { + /* Zero if necessary. */ + if (zero) { + if ((chunk->map[run_ind + i].bits & CHUNK_MAP_ZEROED) + == 0) { + memset((void *)((uintptr_t)chunk + ((run_ind + + i) << PAGE_SHIFT)), 0, PAGE_SIZE); + /* CHUNK_MAP_ZEROED is cleared below. */ + } + } + + /* Update dirty page accounting. */ + if (chunk->map[run_ind + i].bits & CHUNK_MAP_DIRTY) { + chunk->ndirty--; + arena->ndirty--; + /* CHUNK_MAP_DIRTY is cleared below. */ + } + + /* Initialize the chunk map. */ + if (large) { + chunk->map[run_ind + i].bits = CHUNK_MAP_LARGE + | CHUNK_MAP_ALLOCATED; + } else { + chunk->map[run_ind + i].bits = (size_t)run + | CHUNK_MAP_ALLOCATED; + } + } + + /* + * Set the run size only in the first element for large runs. This is + * primarily a debugging aid, since the lack of size info for trailing + * pages only matters if the application tries to operate on an + * interior pointer. + */ + if (large) + chunk->map[run_ind].bits |= size; + + if (chunk->ndirty == 0 && old_ndirty > 0) + arena_chunk_tree_dirty_remove(&arena->chunks_dirty, chunk); +} + +static arena_chunk_t * +arena_chunk_alloc(arena_t *arena) +{ + arena_chunk_t *chunk; + size_t i; + + if (arena->spare != NULL) { + chunk = arena->spare; + arena->spare = NULL; + } else { + chunk = (arena_chunk_t *)chunk_alloc(chunksize, true); + if (chunk == NULL) + return (NULL); +#ifdef JEMALLOC_STATS + arena->stats.mapped += chunksize; +#endif + + chunk->arena = arena; + + /* + * Claim that no pages are in use, since the header is merely + * overhead. + */ + chunk->ndirty = 0; + + /* + * Initialize the map to contain one maximal free untouched run. + */ + for (i = 0; i < arena_chunk_header_npages; i++) + chunk->map[i].bits = 0; + chunk->map[i].bits = arena_maxclass | CHUNK_MAP_ZEROED; + for (i++; i < chunk_npages-1; i++) { + chunk->map[i].bits = CHUNK_MAP_ZEROED; + } + chunk->map[chunk_npages-1].bits = arena_maxclass | + CHUNK_MAP_ZEROED; + } + + /* Insert the run into the runs_avail tree. */ + arena_avail_tree_insert(&arena->runs_avail, + &chunk->map[arena_chunk_header_npages]); + + return (chunk); +} + +static void +arena_chunk_dealloc(arena_t *arena, arena_chunk_t *chunk) +{ + + if (arena->spare != NULL) { + if (arena->spare->ndirty > 0) { + arena_chunk_tree_dirty_remove( + &chunk->arena->chunks_dirty, arena->spare); + arena->ndirty -= arena->spare->ndirty; + } + chunk_dealloc((void *)arena->spare, chunksize); +#ifdef JEMALLOC_STATS + arena->stats.mapped -= chunksize; +#endif + } + + /* + * Remove run from runs_avail, regardless of whether this chunk + * will be cached, so that the arena does not use it. Dirty page + * flushing only uses the chunks_dirty tree, so leaving this chunk in + * the chunks_* trees is sufficient for that purpose. + */ + arena_avail_tree_remove(&arena->runs_avail, + &chunk->map[arena_chunk_header_npages]); + + arena->spare = chunk; +} + +static arena_run_t * +arena_run_alloc(arena_t *arena, size_t size, bool large, bool zero) +{ + arena_chunk_t *chunk; + arena_run_t *run; + arena_chunk_map_t *mapelm, key; + + assert(size <= arena_maxclass); + assert((size & PAGE_MASK) == 0); + + /* Search the arena's chunks for the lowest best fit. */ + key.bits = size | CHUNK_MAP_KEY; + mapelm = arena_avail_tree_nsearch(&arena->runs_avail, &key); + if (mapelm != NULL) { + arena_chunk_t *run_chunk = CHUNK_ADDR2BASE(mapelm); + size_t pageind = ((uintptr_t)mapelm - (uintptr_t)run_chunk->map) + / sizeof(arena_chunk_map_t); + + run = (arena_run_t *)((uintptr_t)run_chunk + (pageind + << PAGE_SHIFT)); + arena_run_split(arena, run, size, large, zero); + return (run); + } + + /* + * No usable runs. Create a new chunk from which to allocate the run. + */ + chunk = arena_chunk_alloc(arena); + if (chunk == NULL) + return (NULL); + run = (arena_run_t *)((uintptr_t)chunk + (arena_chunk_header_npages << + PAGE_SHIFT)); + /* Update page map. */ + arena_run_split(arena, run, size, large, zero); + return (run); +} + +static void +arena_purge(arena_t *arena) +{ + arena_chunk_t *chunk; + size_t i, npages; +#ifdef JEMALLOC_DEBUG + size_t ndirty = 0; + + rb_foreach_begin(arena_chunk_t, link_dirty, &arena->chunks_dirty, + chunk) { + ndirty += chunk->ndirty; + } rb_foreach_end(arena_chunk_t, link_dirty, &arena->chunks_dirty, chunk) + assert(ndirty == arena->ndirty); +#endif + assert(arena->ndirty > opt_dirty_max); + +#ifdef JEMALLOC_STATS + arena->stats.npurge++; +#endif + + /* + * Iterate downward through chunks until enough dirty memory has been + * purged. Terminate as soon as possible in order to minimize the + * number of system calls, even if a chunk has only been partially + * purged. + */ + while (arena->ndirty > (opt_dirty_max >> 1)) { + chunk = arena_chunk_tree_dirty_last(&arena->chunks_dirty); + assert(chunk != NULL); + + for (i = chunk_npages - 1; chunk->ndirty > 0; i--) { + assert(i >= arena_chunk_header_npages); + + if (chunk->map[i].bits & CHUNK_MAP_DIRTY) { + chunk->map[i].bits ^= CHUNK_MAP_DIRTY; + /* Find adjacent dirty run(s). */ + for (npages = 1; i > arena_chunk_header_npages + && (chunk->map[i - 1].bits & + CHUNK_MAP_DIRTY); npages++) { + i--; + chunk->map[i].bits ^= CHUNK_MAP_DIRTY; + } + chunk->ndirty -= npages; + arena->ndirty -= npages; + + madvise((void *)((uintptr_t)chunk + (i << + PAGE_SHIFT)), (npages << PAGE_SHIFT), + MADV_DONTNEED); +#ifdef JEMALLOC_STATS + arena->stats.nmadvise++; + arena->stats.purged += npages; +#endif + if (arena->ndirty <= (opt_dirty_max >> 1)) + break; + } + } + + if (chunk->ndirty == 0) { + arena_chunk_tree_dirty_remove(&arena->chunks_dirty, + chunk); + } + } +} + +static void +arena_run_dalloc(arena_t *arena, arena_run_t *run, bool dirty) +{ + arena_chunk_t *chunk; + size_t size, run_ind, run_pages; + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run); + run_ind = (size_t)(((uintptr_t)run - (uintptr_t)chunk) + >> PAGE_SHIFT); + assert(run_ind >= arena_chunk_header_npages); + assert(run_ind < chunk_npages); + if ((chunk->map[run_ind].bits & CHUNK_MAP_LARGE) != 0) + size = chunk->map[run_ind].bits & ~PAGE_MASK; + else + size = run->bin->run_size; + run_pages = (size >> PAGE_SHIFT); + + /* Mark pages as unallocated in the chunk map. */ + if (dirty) { + size_t i; + + for (i = 0; i < run_pages; i++) { + assert((chunk->map[run_ind + i].bits & CHUNK_MAP_DIRTY) + == 0); + chunk->map[run_ind + i].bits = CHUNK_MAP_DIRTY; + } + + if (chunk->ndirty == 0) { + arena_chunk_tree_dirty_insert(&arena->chunks_dirty, + chunk); + } + chunk->ndirty += run_pages; + arena->ndirty += run_pages; + } else { + size_t i; + + for (i = 0; i < run_pages; i++) { + chunk->map[run_ind + i].bits &= ~(CHUNK_MAP_LARGE | + CHUNK_MAP_ALLOCATED); + } + } + chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & + PAGE_MASK); + chunk->map[run_ind+run_pages-1].bits = size | + (chunk->map[run_ind+run_pages-1].bits & PAGE_MASK); + + /* Try to coalesce forward. */ + if (run_ind + run_pages < chunk_npages && + (chunk->map[run_ind+run_pages].bits & CHUNK_MAP_ALLOCATED) == 0) { + size_t nrun_size = chunk->map[run_ind+run_pages].bits & + ~PAGE_MASK; + + /* + * Remove successor from runs_avail; the coalesced run is + * inserted later. + */ + arena_avail_tree_remove(&arena->runs_avail, + &chunk->map[run_ind+run_pages]); + + size += nrun_size; + run_pages = size >> PAGE_SHIFT; + + assert((chunk->map[run_ind+run_pages-1].bits & ~PAGE_MASK) + == nrun_size); + chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & + PAGE_MASK); + chunk->map[run_ind+run_pages-1].bits = size | + (chunk->map[run_ind+run_pages-1].bits & PAGE_MASK); + } + + /* Try to coalesce backward. */ + if (run_ind > arena_chunk_header_npages && (chunk->map[run_ind-1].bits & + CHUNK_MAP_ALLOCATED) == 0) { + size_t prun_size = chunk->map[run_ind-1].bits & ~PAGE_MASK; + + run_ind -= prun_size >> PAGE_SHIFT; + + /* + * Remove predecessor from runs_avail; the coalesced run is + * inserted later. + */ + arena_avail_tree_remove(&arena->runs_avail, + &chunk->map[run_ind]); + + size += prun_size; + run_pages = size >> PAGE_SHIFT; + + assert((chunk->map[run_ind].bits & ~PAGE_MASK) == + prun_size); + chunk->map[run_ind].bits = size | (chunk->map[run_ind].bits & + PAGE_MASK); + chunk->map[run_ind+run_pages-1].bits = size | + (chunk->map[run_ind+run_pages-1].bits & PAGE_MASK); + } + + /* Insert into runs_avail, now that coalescing is complete. */ + arena_avail_tree_insert(&arena->runs_avail, &chunk->map[run_ind]); + + /* Deallocate chunk if it is now completely unused. */ + if ((chunk->map[arena_chunk_header_npages].bits & (~PAGE_MASK | + CHUNK_MAP_ALLOCATED)) == arena_maxclass) + arena_chunk_dealloc(arena, chunk); + + /* Enforce opt_dirty_max. */ + if (arena->ndirty > opt_dirty_max) + arena_purge(arena); +} + +static void +arena_run_trim_head(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, + size_t oldsize, size_t newsize) +{ + size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> PAGE_SHIFT; + size_t head_npages = (oldsize - newsize) >> PAGE_SHIFT; + + assert(oldsize > newsize); + + /* + * Update the chunk map so that arena_run_dalloc() can treat the + * leading run as separately allocated. + */ + chunk->map[pageind].bits = (oldsize - newsize) | CHUNK_MAP_LARGE | + CHUNK_MAP_ALLOCATED; + chunk->map[pageind+head_npages].bits = newsize | CHUNK_MAP_LARGE | + CHUNK_MAP_ALLOCATED; + + arena_run_dalloc(arena, run, false); +} + +static void +arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run, + size_t oldsize, size_t newsize, bool dirty) +{ + size_t pageind = ((uintptr_t)run - (uintptr_t)chunk) >> PAGE_SHIFT; + size_t npages = newsize >> PAGE_SHIFT; + + assert(oldsize > newsize); + + /* + * Update the chunk map so that arena_run_dalloc() can treat the + * trailing run as separately allocated. + */ + chunk->map[pageind].bits = newsize | CHUNK_MAP_LARGE | + CHUNK_MAP_ALLOCATED; + chunk->map[pageind+npages].bits = (oldsize - newsize) | CHUNK_MAP_LARGE + | CHUNK_MAP_ALLOCATED; + + arena_run_dalloc(arena, (arena_run_t *)((uintptr_t)run + newsize), + dirty); +} + +static arena_run_t * +arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin) +{ + arena_chunk_map_t *mapelm; + arena_run_t *run; + unsigned i, remainder; + + /* Look for a usable run. */ + mapelm = arena_run_tree_first(&bin->runs); + if (mapelm != NULL) { + /* run is guaranteed to have available space. */ + arena_run_tree_remove(&bin->runs, mapelm); + run = (arena_run_t *)(mapelm->bits & ~PAGE_MASK); +#ifdef JEMALLOC_STATS + bin->stats.reruns++; +#endif + return (run); + } + /* No existing runs have any space available. */ + + /* Allocate a new run. */ + run = arena_run_alloc(arena, bin->run_size, false, false); + if (run == NULL) + return (NULL); + + /* Initialize run internals. */ + run->bin = bin; + + for (i = 0; i < bin->regs_mask_nelms - 1; i++) + run->regs_mask[i] = UINT_MAX; + remainder = bin->nregs & ((1U << (SIZEOF_INT_2POW + 3)) - 1); + if (remainder == 0) + run->regs_mask[i] = UINT_MAX; + else { + /* The last element has spare bits that need to be unset. */ + run->regs_mask[i] = (UINT_MAX >> ((1U << (SIZEOF_INT_2POW + 3)) + - remainder)); + } + + run->regs_minelm = 0; + + run->nfree = bin->nregs; +#ifdef JEMALLOC_DEBUG + run->magic = ARENA_RUN_MAGIC; +#endif + +#ifdef JEMALLOC_STATS + bin->stats.nruns++; + bin->stats.curruns++; + if (bin->stats.curruns > bin->stats.highruns) + bin->stats.highruns = bin->stats.curruns; +#endif + return (run); +} + +/* bin->runcur must have space available before this function is called. */ +static inline void * +arena_bin_malloc_easy(arena_t *arena, arena_bin_t *bin, arena_run_t *run) +{ + void *ret; + + assert(run->magic == ARENA_RUN_MAGIC); + assert(run->nfree > 0); + + ret = arena_run_reg_alloc(run, bin); + assert(ret != NULL); + run->nfree--; + + return (ret); +} + +/* Re-fill bin->runcur, then call arena_bin_malloc_easy(). */ +static void * +arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin) +{ + + bin->runcur = arena_bin_nonfull_run_get(arena, bin); + if (bin->runcur == NULL) + return (NULL); + assert(bin->runcur->magic == ARENA_RUN_MAGIC); + assert(bin->runcur->nfree > 0); + + return (arena_bin_malloc_easy(arena, bin, bin->runcur)); +} + +/* + * Calculate bin->run_size such that it meets the following constraints: + * + * *) bin->run_size >= min_run_size + * *) bin->run_size <= arena_maxclass + * *) bin->run_size <= RUN_MAX_SMALL + * *) run header overhead <= RUN_MAX_OVRHD (or header overhead relaxed). + * + * bin->nregs, bin->regs_mask_nelms, and bin->reg0_offset are + * also calculated here, since these settings are all interdependent. + */ +static size_t +arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size) +{ + size_t try_run_size, good_run_size; + unsigned good_nregs, good_mask_nelms, good_reg0_offset; + unsigned try_nregs, try_mask_nelms, try_reg0_offset; + + assert(min_run_size >= PAGE_SIZE); + assert(min_run_size <= arena_maxclass); + assert(min_run_size <= RUN_MAX_SMALL); + + /* + * Calculate known-valid settings before entering the run_size + * expansion loop, so that the first part of the loop always copies + * valid settings. + * + * The do..while loop iteratively reduces the number of regions until + * the run header and the regions no longer overlap. A closed formula + * would be quite messy, since there is an interdependency between the + * header's mask length and the number of regions. + */ + try_run_size = min_run_size; + try_nregs = ((try_run_size - sizeof(arena_run_t)) / bin->reg_size) + + 1; /* Counter-act try_nregs-- in loop. */ + do { + try_nregs--; + try_mask_nelms = (try_nregs >> (SIZEOF_INT_2POW + 3)) + + ((try_nregs & ((1U << (SIZEOF_INT_2POW + 3)) - 1)) ? 1 : 0); + try_reg0_offset = try_run_size - (try_nregs * bin->reg_size); + } while (sizeof(arena_run_t) + (sizeof(unsigned) * (try_mask_nelms - 1)) + > try_reg0_offset); + + /* run_size expansion loop. */ + do { + /* + * Copy valid settings before trying more aggressive settings. + */ + good_run_size = try_run_size; + good_nregs = try_nregs; + good_mask_nelms = try_mask_nelms; + good_reg0_offset = try_reg0_offset; + + /* Try more aggressive settings. */ + try_run_size += PAGE_SIZE; + try_nregs = ((try_run_size - sizeof(arena_run_t)) / + bin->reg_size) + 1; /* Counter-act try_nregs-- in loop. */ + do { + try_nregs--; + try_mask_nelms = (try_nregs >> (SIZEOF_INT_2POW + 3)) + + ((try_nregs & ((1U << (SIZEOF_INT_2POW + 3)) - 1)) ? + 1 : 0); + try_reg0_offset = try_run_size - (try_nregs * + bin->reg_size); + } while (sizeof(arena_run_t) + (sizeof(unsigned) * + (try_mask_nelms - 1)) > try_reg0_offset); + } while (try_run_size <= arena_maxclass && try_run_size <= RUN_MAX_SMALL + && RUN_MAX_OVRHD * (bin->reg_size << 3) > RUN_MAX_OVRHD_RELAX + && (try_reg0_offset << RUN_BFP) > RUN_MAX_OVRHD * try_run_size); + + assert(sizeof(arena_run_t) + (sizeof(unsigned) * (good_mask_nelms - 1)) + <= good_reg0_offset); + assert((good_mask_nelms << (SIZEOF_INT_2POW + 3)) >= good_nregs); + + /* Copy final settings. */ + bin->run_size = good_run_size; + bin->nregs = good_nregs; + bin->regs_mask_nelms = good_mask_nelms; + bin->reg0_offset = good_reg0_offset; + + return (good_run_size); +} + +#ifdef JEMALLOC_BALANCE +static inline void +arena_lock_balance(arena_t *arena) +{ + unsigned contention; + + contention = malloc_spin_lock(&arena->lock); + if (narenas > 1) { + /* + * Calculate the exponentially averaged contention for this + * arena. Due to integer math always rounding down, this value + * decays somewhat faster than normal. + */ + arena->contention = (((uint64_t)arena->contention + * (uint64_t)((1U << BALANCE_ALPHA_INV_2POW)-1)) + + (uint64_t)contention) >> BALANCE_ALPHA_INV_2POW; + if (arena->contention >= opt_balance_threshold) + arena_lock_balance_hard(arena); + } +} + +static void +arena_lock_balance_hard(arena_t *arena) +{ + uint32_t ind; + + arena->contention = 0; +#ifdef JEMALLOC_STATS + arena->stats.nbalance++; +#endif + ind = PRN(balance, narenas_2pow); + if (arenas[ind] != NULL) + arenas_map = arenas[ind]; + else { + malloc_spin_lock(&arenas_lock); + if (arenas[ind] != NULL) + arenas_map = arenas[ind]; + else + arenas_map = arenas_extend(ind); + malloc_spin_unlock(&arenas_lock); + } +} +#endif + +#ifdef JEMALLOC_MAG +static inline void * +mag_alloc(mag_t *mag) +{ + + if (mag->nrounds == 0) + return (NULL); + mag->nrounds--; + + return (mag->rounds[mag->nrounds]); +} + +static void +mag_load(mag_t *mag) +{ + arena_t *arena; + arena_bin_t *bin; + arena_run_t *run; + void *round; + size_t i; + + arena = choose_arena(); + bin = &arena->bins[mag->binind]; +#ifdef JEMALLOC_BALANCE + arena_lock_balance(arena); +#else + malloc_spin_lock(&arena->lock); +#endif + for (i = mag->nrounds; i < max_rounds; i++) { + if ((run = bin->runcur) != NULL && run->nfree > 0) + round = arena_bin_malloc_easy(arena, bin, run); + else + round = arena_bin_malloc_hard(arena, bin); + if (round == NULL) + break; + mag->rounds[i] = round; + } +#ifdef JEMALLOC_STATS + bin->stats.nmags++; + arena->stats.nmalloc_small += (i - mag->nrounds); + arena->stats.allocated_small += (i - mag->nrounds) * bin->reg_size; +#endif + malloc_spin_unlock(&arena->lock); + mag->nrounds = i; +} + +static inline void * +mag_rack_alloc(mag_rack_t *rack, size_t size, bool zero) +{ + void *ret; + bin_mags_t *bin_mags; + mag_t *mag; + size_t binind; + + binind = size2bin[size]; + assert(binind < nbins); + bin_mags = &rack->bin_mags[binind]; + + mag = bin_mags->curmag; + if (mag == NULL) { + /* Create an initial magazine for this size class. */ + assert(bin_mags->sparemag == NULL); + mag = mag_create(choose_arena(), binind); + if (mag == NULL) + return (NULL); + bin_mags->curmag = mag; + mag_load(mag); + } + + ret = mag_alloc(mag); + if (ret == NULL) { + if (bin_mags->sparemag != NULL) { + if (bin_mags->sparemag->nrounds > 0) { + /* Swap magazines. */ + bin_mags->curmag = bin_mags->sparemag; + bin_mags->sparemag = mag; + mag = bin_mags->curmag; + } else { + /* Reload the current magazine. */ + mag_load(mag); + } + } else { + /* Create a second magazine. */ + mag = mag_create(choose_arena(), binind); + if (mag == NULL) + return (NULL); + mag_load(mag); + bin_mags->sparemag = bin_mags->curmag; + bin_mags->curmag = mag; + } + ret = mag_alloc(mag); + if (ret == NULL) + return (NULL); + } + + if (zero == false) { +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, size); + else if (opt_zero) + memset(ret, 0, size); +#endif + } else + memset(ret, 0, size); + + return (ret); +} +#endif + +static inline void * +arena_malloc_small(arena_t *arena, size_t size, bool zero) +{ + void *ret; + arena_bin_t *bin; + arena_run_t *run; + size_t binind; + + binind = size2bin[size]; + assert(binind < nbins); + bin = &arena->bins[binind]; + size = bin->reg_size; + +#ifdef JEMALLOC_BALANCE + arena_lock_balance(arena); +#else + malloc_spin_lock(&arena->lock); +#endif + if ((run = bin->runcur) != NULL && run->nfree > 0) + ret = arena_bin_malloc_easy(arena, bin, run); + else + ret = arena_bin_malloc_hard(arena, bin); + + if (ret == NULL) { + malloc_spin_unlock(&arena->lock); + return (NULL); + } + +#ifdef JEMALLOC_STATS + bin->stats.nrequests++; + arena->stats.nmalloc_small++; + arena->stats.allocated_small += size; +#endif + malloc_spin_unlock(&arena->lock); + + if (zero == false) { +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, size); + else if (opt_zero) + memset(ret, 0, size); +#endif + } else + memset(ret, 0, size); + + return (ret); +} + +static void * +arena_malloc_large(arena_t *arena, size_t size, bool zero) +{ + void *ret; + + /* Large allocation. */ + size = PAGE_CEILING(size); +#ifdef JEMALLOC_BALANCE + arena_lock_balance(arena); +#else + malloc_spin_lock(&arena->lock); +#endif + ret = (void *)arena_run_alloc(arena, size, true, zero); + if (ret == NULL) { + malloc_spin_unlock(&arena->lock); + return (NULL); + } +#ifdef JEMALLOC_STATS + arena->stats.nmalloc_large++; + arena->stats.allocated_large += size; +#endif + malloc_spin_unlock(&arena->lock); + + if (zero == false) { +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, size); + else if (opt_zero) + memset(ret, 0, size); +#endif + } + + return (ret); +} + +static inline void * +arena_malloc(size_t size, bool zero) +{ + + assert(size != 0); + assert(QUANTUM_CEILING(size) <= arena_maxclass); + + if (size <= bin_maxclass) { +#ifdef JEMALLOC_MAG + if (opt_mag) { + mag_rack_t *rack = mag_rack; + if (rack == NULL) { + rack = mag_rack_create(choose_arena()); + if (rack == NULL) + return (NULL); + mag_rack = rack; + pthread_setspecific(mag_rack_tsd, rack); + } + return (mag_rack_alloc(rack, size, zero)); + } else +#endif + return (arena_malloc_small(choose_arena(), size, zero)); + } else + return (arena_malloc_large(choose_arena(), size, zero)); +} + +static inline void * +imalloc(size_t size) +{ + + assert(size != 0); + + if (size <= arena_maxclass) + return (arena_malloc(size, false)); + else + return (huge_malloc(size, false)); +} + +static inline void * +icalloc(size_t size) +{ + + if (size <= arena_maxclass) + return (arena_malloc(size, true)); + else + return (huge_malloc(size, true)); +} + +/* Only handles large allocations that require more than page alignment. */ +static void * +arena_palloc(arena_t *arena, size_t alignment, size_t size, size_t alloc_size) +{ + void *ret; + size_t offset; + arena_chunk_t *chunk; + + assert((size & PAGE_MASK) == 0); + assert((alignment & PAGE_MASK) == 0); + +#ifdef JEMALLOC_BALANCE + arena_lock_balance(arena); +#else + malloc_spin_lock(&arena->lock); +#endif + ret = (void *)arena_run_alloc(arena, alloc_size, true, false); + if (ret == NULL) { + malloc_spin_unlock(&arena->lock); + return (NULL); + } + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ret); + + offset = (uintptr_t)ret & (alignment - 1); + assert((offset & PAGE_MASK) == 0); + assert(offset < alloc_size); + if (offset == 0) + arena_run_trim_tail(arena, chunk, ret, alloc_size, size, false); + else { + size_t leadsize, trailsize; + + leadsize = alignment - offset; + if (leadsize > 0) { + arena_run_trim_head(arena, chunk, ret, alloc_size, + alloc_size - leadsize); + ret = (void *)((uintptr_t)ret + leadsize); + } + + trailsize = alloc_size - leadsize - size; + if (trailsize != 0) { + /* Trim trailing space. */ + assert(trailsize < alloc_size); + arena_run_trim_tail(arena, chunk, ret, size + trailsize, + size, false); + } + } + +#ifdef JEMALLOC_STATS + arena->stats.nmalloc_large++; + arena->stats.allocated_large += size; +#endif + malloc_spin_unlock(&arena->lock); + +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, size); + else if (opt_zero) + memset(ret, 0, size); +#endif + return (ret); +} + +static inline void * +ipalloc(size_t alignment, size_t size) +{ + void *ret; + size_t ceil_size; + + /* + * Round size up to the nearest multiple of alignment. + * + * This done, we can take advantage of the fact that for each small + * size class, every object is aligned at the smallest power of two + * that is non-zero in the base two representation of the size. For + * example: + * + * Size | Base 2 | Minimum alignment + * -----+----------+------------------ + * 96 | 1100000 | 32 + * 144 | 10100000 | 32 + * 192 | 11000000 | 64 + * + * Depending on runtime settings, it is possible that arena_malloc() + * will further round up to a power of two, but that never causes + * correctness issues. + */ + ceil_size = (size + (alignment - 1)) & (-alignment); + /* + * (ceil_size < size) protects against the combination of maximal + * alignment and size greater than maximal alignment. + */ + if (ceil_size < size) { + /* size_t overflow. */ + return (NULL); + } + + if (ceil_size <= PAGE_SIZE || (alignment <= PAGE_SIZE + && ceil_size <= arena_maxclass)) + ret = arena_malloc(ceil_size, false); + else { + size_t run_size; + + /* + * We can't achieve subpage alignment, so round up alignment + * permanently; it makes later calculations simpler. + */ + alignment = PAGE_CEILING(alignment); + ceil_size = PAGE_CEILING(size); + /* + * (ceil_size < size) protects against very large sizes within + * PAGE_SIZE of SIZE_T_MAX. + * + * (ceil_size + alignment < ceil_size) protects against the + * combination of maximal alignment and ceil_size large enough + * to cause overflow. This is similar to the first overflow + * check above, but it needs to be repeated due to the new + * ceil_size value, which may now be *equal* to maximal + * alignment, whereas before we only detected overflow if the + * original size was *greater* than maximal alignment. + */ + if (ceil_size < size || ceil_size + alignment < ceil_size) { + /* size_t overflow. */ + return (NULL); + } + + /* + * Calculate the size of the over-size run that arena_palloc() + * would need to allocate in order to guarantee the alignment. + */ + if (ceil_size >= alignment) + run_size = ceil_size + alignment - PAGE_SIZE; + else { + /* + * It is possible that (alignment << 1) will cause + * overflow, but it doesn't matter because we also + * subtract PAGE_SIZE, which in the case of overflow + * leaves us with a very large run_size. That causes + * the first conditional below to fail, which means + * that the bogus run_size value never gets used for + * anything important. + */ + run_size = (alignment << 1) - PAGE_SIZE; + } + + if (run_size <= arena_maxclass) { + ret = arena_palloc(choose_arena(), alignment, ceil_size, + run_size); + } else if (alignment <= chunksize) + ret = huge_malloc(ceil_size, false); + else + ret = huge_palloc(alignment, ceil_size); + } + + assert(((uintptr_t)ret & (alignment - 1)) == 0); + return (ret); +} + +/* Return the size of the allocation pointed to by ptr. */ +static size_t +arena_salloc(const void *ptr) +{ + size_t ret; + arena_chunk_t *chunk; + size_t pageind, mapbits; + + assert(ptr != NULL); + assert(CHUNK_ADDR2BASE(ptr) != ptr); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + mapbits = chunk->map[pageind].bits; + assert((mapbits & CHUNK_MAP_ALLOCATED) != 0); + if ((mapbits & CHUNK_MAP_LARGE) == 0) { + arena_run_t *run = (arena_run_t *)(mapbits & ~PAGE_MASK); + assert(run->magic == ARENA_RUN_MAGIC); + ret = run->bin->reg_size; + } else { + ret = mapbits & ~PAGE_MASK; + assert(ret != 0); + } + + return (ret); +} + +static inline size_t +isalloc(const void *ptr) +{ + size_t ret; + arena_chunk_t *chunk; + + assert(ptr != NULL); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + if (chunk != ptr) { + /* Region. */ + assert(chunk->arena->magic == ARENA_MAGIC); + + ret = arena_salloc(ptr); + } else { + extent_node_t *node, key; + + /* Chunk (huge allocation). */ + + malloc_mutex_lock(&huge_mtx); + + /* Extract from tree of huge allocations. */ + key.addr = __DECONST(void *, ptr); + node = extent_tree_ad_search(&huge, &key); + assert(node != NULL); + + ret = node->size; + + malloc_mutex_unlock(&huge_mtx); + } + + return (ret); +} + +static inline void +arena_dalloc_small(arena_t *arena, arena_chunk_t *chunk, void *ptr, + arena_chunk_map_t *mapelm) +{ + arena_run_t *run; + arena_bin_t *bin; + size_t size; + + run = (arena_run_t *)(mapelm->bits & ~PAGE_MASK); + assert(run->magic == ARENA_RUN_MAGIC); + bin = run->bin; + size = bin->reg_size; + +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ptr, 0x5a, size); +#endif + + arena_run_reg_dalloc(run, bin, ptr, size); + run->nfree++; + + if (run->nfree == bin->nregs) { + /* Deallocate run. */ + if (run == bin->runcur) + bin->runcur = NULL; + else if (bin->nregs != 1) { + size_t run_pageind = (((uintptr_t)run - + (uintptr_t)chunk)) >> PAGE_SHIFT; + arena_chunk_map_t *run_mapelm = + &chunk->map[run_pageind]; + /* + * This block's conditional is necessary because if the + * run only contains one region, then it never gets + * inserted into the non-full runs tree. + */ + arena_run_tree_remove(&bin->runs, run_mapelm); + } +#ifdef JEMALLOC_DEBUG + run->magic = 0; +#endif + arena_run_dalloc(arena, run, true); +#ifdef JEMALLOC_STATS + bin->stats.curruns--; +#endif + } else if (run->nfree == 1 && run != bin->runcur) { + /* + * Make sure that bin->runcur always refers to the lowest + * non-full run, if one exists. + */ + if (bin->runcur == NULL) + bin->runcur = run; + else if ((uintptr_t)run < (uintptr_t)bin->runcur) { + /* Switch runcur. */ + if (bin->runcur->nfree > 0) { + arena_chunk_t *runcur_chunk = + CHUNK_ADDR2BASE(bin->runcur); + size_t runcur_pageind = + (((uintptr_t)bin->runcur - + (uintptr_t)runcur_chunk)) >> PAGE_SHIFT; + arena_chunk_map_t *runcur_mapelm = + &runcur_chunk->map[runcur_pageind]; + + /* Insert runcur. */ + arena_run_tree_insert(&bin->runs, + runcur_mapelm); + } + bin->runcur = run; + } else { + size_t run_pageind = (((uintptr_t)run - + (uintptr_t)chunk)) >> PAGE_SHIFT; + arena_chunk_map_t *run_mapelm = + &chunk->map[run_pageind]; + + assert(arena_run_tree_search(&bin->runs, run_mapelm) == + NULL); + arena_run_tree_insert(&bin->runs, run_mapelm); + } + } +#ifdef JEMALLOC_STATS + arena->stats.allocated_small -= size; + arena->stats.ndalloc_small++; +#endif +} + +#ifdef JEMALLOC_MAG +static void +mag_unload(mag_t *mag) +{ + arena_chunk_t *chunk; + arena_t *arena; + void *round; + size_t i, ndeferred, nrounds; + + for (ndeferred = mag->nrounds; ndeferred > 0;) { + nrounds = ndeferred; + /* Lock the arena associated with the first round. */ + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(mag->rounds[0]); + arena = chunk->arena; +#ifdef JEMALLOC_BALANCE + arena_lock_balance(arena); +#else + malloc_spin_lock(&arena->lock); +#endif + /* Deallocate every round that belongs to the locked arena. */ + for (i = ndeferred = 0; i < nrounds; i++) { + round = mag->rounds[i]; + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(round); + if (chunk->arena == arena) { + size_t pageind = (((uintptr_t)round - + (uintptr_t)chunk) >> PAGE_SHIFT); + arena_chunk_map_t *mapelm = + &chunk->map[pageind]; + arena_dalloc_small(arena, chunk, round, mapelm); + } else { + /* + * This round was allocated via a different + * arena than the one that is currently locked. + * Stash the round, so that it can be handled + * in a future pass. + */ + mag->rounds[ndeferred] = round; + ndeferred++; + } + } + malloc_spin_unlock(&arena->lock); + } + + mag->nrounds = 0; +} + +static inline void +mag_rack_dalloc(mag_rack_t *rack, void *ptr) +{ + arena_t *arena; + arena_chunk_t *chunk; + arena_run_t *run; + arena_bin_t *bin; + bin_mags_t *bin_mags; + mag_t *mag; + size_t pageind, binind; + arena_chunk_map_t *mapelm; + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + arena = chunk->arena; + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + mapelm = &chunk->map[pageind]; + run = (arena_run_t *)(mapelm->bits & ~PAGE_MASK); + assert(run->magic == ARENA_RUN_MAGIC); + bin = run->bin; + binind = ((uintptr_t)bin - (uintptr_t)&arena->bins) / + sizeof(arena_bin_t); + assert(binind < nbins); + +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ptr, 0x5a, arena->bins[binind].reg_size); +#endif + + bin_mags = &rack->bin_mags[binind]; + mag = bin_mags->curmag; + if (mag == NULL) { + /* Create an initial magazine for this size class. */ + assert(bin_mags->sparemag == NULL); + mag = mag_create(choose_arena(), binind); + if (mag == NULL) { + malloc_spin_lock(&arena->lock); + arena_dalloc_small(arena, chunk, ptr, mapelm); + malloc_spin_unlock(&arena->lock); + return; + } + bin_mags->curmag = mag; + } + + if (mag->nrounds == max_rounds) { + if (bin_mags->sparemag != NULL) { + if (bin_mags->sparemag->nrounds < max_rounds) { + /* Swap magazines. */ + bin_mags->curmag = bin_mags->sparemag; + bin_mags->sparemag = mag; + mag = bin_mags->curmag; + } else { + /* Unload the current magazine. */ + mag_unload(mag); + } + } else { + /* Create a second magazine. */ + mag = mag_create(choose_arena(), binind); + if (mag == NULL) { + mag = rack->bin_mags[binind].curmag; + mag_unload(mag); + } else { + bin_mags->sparemag = bin_mags->curmag; + bin_mags->curmag = mag; + } + } + assert(mag->nrounds < max_rounds); + } + mag->rounds[mag->nrounds] = ptr; + mag->nrounds++; +} +#endif + +static void +arena_dalloc_large(arena_t *arena, arena_chunk_t *chunk, void *ptr) +{ + /* Large allocation. */ + malloc_spin_lock(&arena->lock); + +#ifdef JEMALLOC_FILL +#ifndef JEMALLOC_STATS + if (opt_junk) +#endif +#endif + { +#if (defined(JEMALLOC_FILL) || defined(JEMALLOC_STATS)) + size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> + PAGE_SHIFT; + size_t size = chunk->map[pageind].bits & ~PAGE_MASK; +#endif + +#ifdef JEMALLOC_FILL +#ifdef JEMALLOC_STATS + if (opt_junk) +#endif + memset(ptr, 0x5a, size); +#endif +#ifdef JEMALLOC_STATS + arena->stats.allocated_large -= size; +#endif + } +#ifdef JEMALLOC_STATS + arena->stats.ndalloc_large++; +#endif + + arena_run_dalloc(arena, (arena_run_t *)ptr, true); + malloc_spin_unlock(&arena->lock); +} + +static inline void +arena_dalloc(arena_t *arena, arena_chunk_t *chunk, void *ptr) +{ + size_t pageind; + arena_chunk_map_t *mapelm; + + assert(arena != NULL); + assert(arena->magic == ARENA_MAGIC); + assert(chunk->arena == arena); + assert(ptr != NULL); + assert(CHUNK_ADDR2BASE(ptr) != ptr); + + pageind = (((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT); + mapelm = &chunk->map[pageind]; + assert((mapelm->bits & CHUNK_MAP_ALLOCATED) != 0); + if ((mapelm->bits & CHUNK_MAP_LARGE) == 0) { + /* Small allocation. */ +#ifdef JEMALLOC_MAG + if (opt_mag) { + mag_rack_t *rack = mag_rack; + if (rack == NULL) { + rack = mag_rack_create(arena); + if (rack == NULL) { + malloc_spin_lock(&arena->lock); + arena_dalloc_small(arena, chunk, ptr, + mapelm); + malloc_spin_unlock(&arena->lock); + } + mag_rack = rack; + pthread_setspecific(mag_rack_tsd, rack); + } + mag_rack_dalloc(rack, ptr); + } else { +#endif + malloc_spin_lock(&arena->lock); + arena_dalloc_small(arena, chunk, ptr, mapelm); + malloc_spin_unlock(&arena->lock); +#ifdef JEMALLOC_MAG + } +#endif + } else + arena_dalloc_large(arena, chunk, ptr); +} + +static inline void +idalloc(void *ptr) +{ + arena_chunk_t *chunk; + + assert(ptr != NULL); + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + if (chunk != ptr) + arena_dalloc(chunk->arena, chunk, ptr); + else + huge_dalloc(ptr); +} + +static void +arena_ralloc_large_shrink(arena_t *arena, arena_chunk_t *chunk, void *ptr, + size_t size, size_t oldsize) +{ + + assert(size < oldsize); + + /* + * Shrink the run, and make trailing pages available for other + * allocations. + */ +#ifdef JEMALLOC_BALANCE + arena_lock_balance(arena); +#else + malloc_spin_lock(&arena->lock); +#endif + arena_run_trim_tail(arena, chunk, (arena_run_t *)ptr, oldsize, size, + true); +#ifdef JEMALLOC_STATS + arena->stats.allocated_large -= oldsize - size; +#endif + malloc_spin_unlock(&arena->lock); +} + +static bool +arena_ralloc_large_grow(arena_t *arena, arena_chunk_t *chunk, void *ptr, + size_t size, size_t oldsize) +{ + size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> PAGE_SHIFT; + size_t npages = oldsize >> PAGE_SHIFT; + + assert(oldsize == (chunk->map[pageind].bits & ~PAGE_MASK)); + + /* Try to extend the run. */ + assert(size > oldsize); +#ifdef JEMALLOC_BALANCE + arena_lock_balance(arena); +#else + malloc_spin_lock(&arena->lock); +#endif + if (pageind + npages < chunk_npages && (chunk->map[pageind+npages].bits + & CHUNK_MAP_ALLOCATED) == 0 && (chunk->map[pageind+npages].bits & + ~PAGE_MASK) >= size - oldsize) { + /* + * The next run is available and sufficiently large. Split the + * following run, then merge the first part with the existing + * allocation. + */ + arena_run_split(arena, (arena_run_t *)((uintptr_t)chunk + + ((pageind+npages) << PAGE_SHIFT)), size - oldsize, true, + false); + + chunk->map[pageind].bits = size | CHUNK_MAP_LARGE | + CHUNK_MAP_ALLOCATED; + chunk->map[pageind+npages].bits = CHUNK_MAP_LARGE | + CHUNK_MAP_ALLOCATED; + +#ifdef JEMALLOC_STATS + arena->stats.allocated_large += size - oldsize; +#endif + malloc_spin_unlock(&arena->lock); + return (false); + } + malloc_spin_unlock(&arena->lock); + + return (true); +} + +/* + * Try to resize a large allocation, in order to avoid copying. This will + * always fail if growing an object, and the following run is already in use. + */ +static bool +arena_ralloc_large(void *ptr, size_t size, size_t oldsize) +{ + size_t psize; + + psize = PAGE_CEILING(size); + if (psize == oldsize) { + /* Same size class. */ +#ifdef JEMALLOC_FILL + if (opt_junk && size < oldsize) { + memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - + size); + } +#endif + return (false); + } else { + arena_chunk_t *chunk; + arena_t *arena; + + chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr); + arena = chunk->arena; + assert(arena->magic == ARENA_MAGIC); + + if (psize < oldsize) { +#ifdef JEMALLOC_FILL + /* Fill before shrinking in order avoid a race. */ + if (opt_junk) { + memset((void *)((uintptr_t)ptr + size), 0x5a, + oldsize - size); + } +#endif + arena_ralloc_large_shrink(arena, chunk, ptr, psize, + oldsize); + return (false); + } else { + bool ret = arena_ralloc_large_grow(arena, chunk, ptr, + psize, oldsize); +#ifdef JEMALLOC_FILL + if (ret == false && opt_zero) { + memset((void *)((uintptr_t)ptr + oldsize), 0, + size - oldsize); + } +#endif + return (ret); + } + } +} + +static void * +arena_ralloc(void *ptr, size_t size, size_t oldsize) +{ + void *ret; + size_t copysize; + + /* Try to avoid moving the allocation. */ + if (size <= bin_maxclass) { + if (oldsize <= bin_maxclass && size2bin[size] == + size2bin[oldsize]) + goto IN_PLACE; + } else { + if (oldsize > bin_maxclass && oldsize <= arena_maxclass) { + assert(size > bin_maxclass); + if (arena_ralloc_large(ptr, size, oldsize) == false) + return (ptr); + } + } + + /* + * If we get here, then size and oldsize are different enough that we + * need to move the object. In that case, fall back to allocating new + * space and copying. + */ + ret = arena_malloc(size, false); + if (ret == NULL) + return (NULL); + + /* Junk/zero-filling were already done by arena_malloc(). */ + copysize = (size < oldsize) ? size : oldsize; + memcpy(ret, ptr, copysize); + idalloc(ptr); + return (ret); +IN_PLACE: +#ifdef JEMALLOC_FILL + if (opt_junk && size < oldsize) + memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize - size); + else if (opt_zero && size > oldsize) + memset((void *)((uintptr_t)ptr + oldsize), 0, size - oldsize); +#endif + return (ptr); +} + +static inline void * +iralloc(void *ptr, size_t size) +{ + size_t oldsize; + + assert(ptr != NULL); + assert(size != 0); + + oldsize = isalloc(ptr); + + if (size <= arena_maxclass) + return (arena_ralloc(ptr, size, oldsize)); + else + return (huge_ralloc(ptr, size, oldsize)); +} + +static bool +arena_new(arena_t *arena) +{ + unsigned i; + arena_bin_t *bin; + size_t prev_run_size; + + if (malloc_spin_init(&arena->lock)) + return (true); + +#ifdef JEMALLOC_STATS + memset(&arena->stats, 0, sizeof(arena_stats_t)); +#endif + + /* Initialize chunks. */ + arena_chunk_tree_dirty_new(&arena->chunks_dirty); + arena->spare = NULL; + + arena->ndirty = 0; + + arena_avail_tree_new(&arena->runs_avail); + +#ifdef JEMALLOC_BALANCE + arena->contention = 0; +#endif + + /* Initialize bins. */ + prev_run_size = PAGE_SIZE; + + i = 0; +#ifdef JEMALLOC_TINY + /* (2^n)-spaced tiny bins. */ + for (; i < ntbins; i++) { + bin = &arena->bins[i]; + bin->runcur = NULL; + arena_run_tree_new(&bin->runs); + + bin->reg_size = (1U << (TINY_MIN_2POW + i)); + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + +#ifdef JEMALLOC_STATS + memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); +#endif + } +#endif + + /* Quantum-spaced bins. */ + for (; i < ntbins + nqbins; i++) { + bin = &arena->bins[i]; + bin->runcur = NULL; + arena_run_tree_new(&bin->runs); + + bin->reg_size = (i - ntbins + 1) << QUANTUM_2POW; + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + +#ifdef JEMALLOC_STATS + memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); +#endif + } + + /* Cacheline-spaced bins. */ + for (; i < ntbins + nqbins + ncbins; i++) { + bin = &arena->bins[i]; + bin->runcur = NULL; + arena_run_tree_new(&bin->runs); + + bin->reg_size = cspace_min + ((i - (ntbins + nqbins)) << + CACHELINE_2POW); + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + +#ifdef JEMALLOC_STATS + memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); +#endif + } + + /* Subpage-spaced bins. */ + for (; i < nbins; i++) { + bin = &arena->bins[i]; + bin->runcur = NULL; + arena_run_tree_new(&bin->runs); + + bin->reg_size = sspace_min + ((i - (ntbins + nqbins + ncbins)) + << SUBPAGE_2POW); + + prev_run_size = arena_bin_run_size_calc(bin, prev_run_size); + +#ifdef JEMALLOC_STATS + memset(&bin->stats, 0, sizeof(malloc_bin_stats_t)); +#endif + } + +#ifdef JEMALLOC_DEBUG + arena->magic = ARENA_MAGIC; +#endif + + return (false); +} + +/* Create a new arena and insert it into the arenas array at index ind. */ +static arena_t * +arenas_extend(unsigned ind) +{ + arena_t *ret; + + /* Allocate enough space for trailing bins. */ + ret = (arena_t *)base_alloc(sizeof(arena_t) + + (sizeof(arena_bin_t) * (nbins - 1))); + if (ret != NULL && arena_new(ret) == false) { + arenas[ind] = ret; + return (ret); + } + /* Only reached if there is an OOM error. */ + + /* + * OOM here is quite inconvenient to propagate, since dealing with it + * would require a check for failure in the fast path. Instead, punt + * by using arenas[0]. In practice, this is an extremely unlikely + * failure. + */ + jemalloc_message("", + ": Error initializing arena\n", "", ""); + if (opt_abort) + abort(); + + return (arenas[0]); +} + +#ifdef JEMALLOC_MAG +static mag_t * +mag_create(arena_t *arena, size_t binind) +{ + mag_t *ret; + + if (sizeof(mag_t) + (sizeof(void *) * (max_rounds - 1)) <= + bin_maxclass) { + ret = arena_malloc_small(arena, sizeof(mag_t) + (sizeof(void *) + * (max_rounds - 1)), false); + } else { + ret = imalloc(sizeof(mag_t) + (sizeof(void *) * (max_rounds - + 1))); + } + if (ret == NULL) + return (NULL); + ret->binind = binind; + ret->nrounds = 0; + + return (ret); +} + +static void +mag_destroy(mag_t *mag) +{ + arena_t *arena; + arena_chunk_t *chunk; + size_t pageind; + arena_chunk_map_t *mapelm; + + chunk = CHUNK_ADDR2BASE(mag); + arena = chunk->arena; + pageind = (((uintptr_t)mag - (uintptr_t)chunk) >> PAGE_SHIFT); + mapelm = &chunk->map[pageind]; + + assert(mag->nrounds == 0); + if (sizeof(mag_t) + (sizeof(void *) * (max_rounds - 1)) <= + bin_maxclass) { + malloc_spin_lock(&arena->lock); + arena_dalloc_small(arena, chunk, mag, mapelm); + malloc_spin_unlock(&arena->lock); + } else + idalloc(mag); +} + +static mag_rack_t * +mag_rack_create(arena_t *arena) +{ + + assert(sizeof(mag_rack_t) + (sizeof(bin_mags_t *) * (nbins - 1)) <= + bin_maxclass); + return (arena_malloc_small(arena, sizeof(mag_rack_t) + + (sizeof(bin_mags_t) * (nbins - 1)), true)); +} + +static void +mag_rack_destroy(mag_rack_t *rack) +{ + arena_t *arena; + arena_chunk_t *chunk; + bin_mags_t *bin_mags; + size_t i, pageind; + arena_chunk_map_t *mapelm; + + for (i = 0; i < nbins; i++) { + bin_mags = &rack->bin_mags[i]; + if (bin_mags->curmag != NULL) { + assert(bin_mags->curmag->binind == i); + mag_unload(bin_mags->curmag); + mag_destroy(bin_mags->curmag); + } + if (bin_mags->sparemag != NULL) { + assert(bin_mags->sparemag->binind == i); + mag_unload(bin_mags->sparemag); + mag_destroy(bin_mags->sparemag); + } + } + + chunk = CHUNK_ADDR2BASE(rack); + arena = chunk->arena; + pageind = (((uintptr_t)rack - (uintptr_t)chunk) >> PAGE_SHIFT); + mapelm = &chunk->map[pageind]; + + malloc_spin_lock(&arena->lock); + arena_dalloc_small(arena, chunk, rack, mapelm); + malloc_spin_unlock(&arena->lock); +} +#endif + +/* + * End arena. + */ +/******************************************************************************/ +/* + * Begin general internal functions. + */ + +static void * +huge_malloc(size_t size, bool zero) +{ + void *ret; + size_t csize; + extent_node_t *node; + + /* Allocate one or more contiguous chunks for this request. */ + + csize = CHUNK_CEILING(size); + if (csize == 0) { + /* size is large enough to cause size_t wrap-around. */ + return (NULL); + } + + /* Allocate an extent node with which to track the chunk. */ + node = base_node_alloc(); + if (node == NULL) + return (NULL); + + ret = chunk_alloc(csize, zero); + if (ret == NULL) { + base_node_dealloc(node); + return (NULL); + } + + /* Insert node into huge. */ + node->addr = ret; + node->size = csize; + + malloc_mutex_lock(&huge_mtx); + extent_tree_ad_insert(&huge, node); +#ifdef JEMALLOC_STATS + huge_nmalloc++; + huge_allocated += csize; +#endif + malloc_mutex_unlock(&huge_mtx); + +#ifdef JEMALLOC_FILL + if (zero == false) { + if (opt_junk) + memset(ret, 0xa5, csize); + else if (opt_zero) + memset(ret, 0, csize); + } +#endif + + return (ret); +} + +/* Only handles large allocations that require more than chunk alignment. */ +static void * +huge_palloc(size_t alignment, size_t size) +{ + void *ret; + size_t alloc_size, chunk_size, offset; + extent_node_t *node; + + /* + * This allocation requires alignment that is even larger than chunk + * alignment. This means that huge_malloc() isn't good enough. + * + * Allocate almost twice as many chunks as are demanded by the size or + * alignment, in order to assure the alignment can be achieved, then + * unmap leading and trailing chunks. + */ + assert(alignment >= chunksize); + + chunk_size = CHUNK_CEILING(size); + + if (size >= alignment) + alloc_size = chunk_size + alignment - chunksize; + else + alloc_size = (alignment << 1) - chunksize; + + /* Allocate an extent node with which to track the chunk. */ + node = base_node_alloc(); + if (node == NULL) + return (NULL); + + ret = chunk_alloc(alloc_size, false); + if (ret == NULL) { + base_node_dealloc(node); + return (NULL); + } + + offset = (uintptr_t)ret & (alignment - 1); + assert((offset & chunksize_mask) == 0); + assert(offset < alloc_size); + if (offset == 0) { + /* Trim trailing space. */ + chunk_dealloc((void *)((uintptr_t)ret + chunk_size), alloc_size + - chunk_size); + } else { + size_t trailsize; + + /* Trim leading space. */ + chunk_dealloc(ret, alignment - offset); + + ret = (void *)((uintptr_t)ret + (alignment - offset)); + + trailsize = alloc_size - (alignment - offset) - chunk_size; + if (trailsize != 0) { + /* Trim trailing space. */ + assert(trailsize < alloc_size); + chunk_dealloc((void *)((uintptr_t)ret + chunk_size), + trailsize); + } + } + + /* Insert node into huge. */ + node->addr = ret; + node->size = chunk_size; + + malloc_mutex_lock(&huge_mtx); + extent_tree_ad_insert(&huge, node); +#ifdef JEMALLOC_STATS + huge_nmalloc++; + huge_allocated += chunk_size; +#endif + malloc_mutex_unlock(&huge_mtx); + +#ifdef JEMALLOC_FILL + if (opt_junk) + memset(ret, 0xa5, chunk_size); + else if (opt_zero) + memset(ret, 0, chunk_size); +#endif + + return (ret); +} + +static void * +huge_ralloc(void *ptr, size_t size, size_t oldsize) +{ + void *ret; + size_t copysize; + + /* Avoid moving the allocation if the size class would not change. */ + if (oldsize > arena_maxclass && + CHUNK_CEILING(size) == CHUNK_CEILING(oldsize)) { +#ifdef JEMALLOC_FILL + if (opt_junk && size < oldsize) { + memset((void *)((uintptr_t)ptr + size), 0x5a, oldsize + - size); + } else if (opt_zero && size > oldsize) { + memset((void *)((uintptr_t)ptr + oldsize), 0, size + - oldsize); + } +#endif + return (ptr); + } + + /* + * If we get here, then size and oldsize are different enough that we + * need to use a different size class. In that case, fall back to + * allocating new space and copying. + */ + ret = huge_malloc(size, false); + if (ret == NULL) + return (NULL); + + copysize = (size < oldsize) ? size : oldsize; + memcpy(ret, ptr, copysize); + idalloc(ptr); + return (ret); +} + +static void +huge_dalloc(void *ptr) +{ + extent_node_t *node, key; + + malloc_mutex_lock(&huge_mtx); + + /* Extract from tree of huge allocations. */ + key.addr = ptr; + node = extent_tree_ad_search(&huge, &key); + assert(node != NULL); + assert(node->addr == ptr); + extent_tree_ad_remove(&huge, node); + +#ifdef JEMALLOC_STATS + huge_ndalloc++; + huge_allocated -= node->size; +#endif + + malloc_mutex_unlock(&huge_mtx); + + /* Unmap chunk. */ +#ifdef JEMALLOC_FILL +#ifdef JEMALLOC_DSS + if (opt_dss && opt_junk) + memset(node->addr, 0x5a, node->size); +#endif +#endif + chunk_dealloc(node->addr, node->size); + + base_node_dealloc(node); +} + +static void +malloc_print_stats(void) +{ + + if (opt_print_stats) { + char s[UMAX2S_BUFSIZE]; + jemalloc_message("___ Begin jemalloc statistics ___\n", "", "", + ""); + jemalloc_message("Assertions ", +#ifdef NDEBUG + "disabled", +#else + "enabled", +#endif + "\n", ""); + jemalloc_message("Boolean JEMALLOC_OPTIONS: ", + opt_abort ? "A" : "a", "", ""); +#ifdef JEMALLOC_DSS + jemalloc_message(opt_dss ? "D" : "d", "", "", ""); +#endif +#ifdef JEMALLOC_MAG + jemalloc_message(opt_mag ? "G" : "g", "", "", ""); +#endif +#ifdef JEMALLOC_FILL + jemalloc_message(opt_junk ? "J" : "j", "", "", ""); +#endif +#ifdef JEMALLOC_DSS + jemalloc_message(opt_mmap ? "M" : "m", "", "", ""); +#endif + jemalloc_message("P", "", "", ""); +#ifdef JEMALLOC_STATS + jemalloc_message(opt_utrace ? "U" : "u", "", "", ""); +#endif +#ifdef JEMALLOC_SYSV + jemalloc_message(opt_sysv ? "V" : "v", "", "", ""); +#endif +#ifdef JEMALLOC_XMALLOC + jemalloc_message(opt_xmalloc ? "X" : "x", "", "", ""); +#endif +#ifdef JEMALLOC_FILL + jemalloc_message(opt_zero ? "Z" : "z", "", "", ""); +#endif + jemalloc_message("\n", "", "", ""); + + jemalloc_message("CPUs: ", umax2s(ncpus, s), "\n", ""); + jemalloc_message("Max arenas: ", umax2s(narenas, s), "\n", ""); +#ifdef JEMALLOC_BALANCE + jemalloc_message("Arena balance threshold: ", + umax2s(opt_balance_threshold, s), "\n", ""); +#endif + jemalloc_message("Pointer size: ", umax2s(sizeof(void *), s), + "\n", ""); + jemalloc_message("Quantum size: ", umax2s(QUANTUM, s), "\n", + ""); + jemalloc_message("Cacheline size (assumed): ", + umax2s(CACHELINE, s), "\n", ""); +#ifdef JEMALLOC_TINY + jemalloc_message("Tiny 2^n-spaced sizes: [", umax2s((1U << + TINY_MIN_2POW), s), "..", ""); + jemalloc_message(umax2s((qspace_min >> 1), s), "]\n", "", ""); +#endif + jemalloc_message("Quantum-spaced sizes: [", umax2s(qspace_min, + s), "..", ""); + jemalloc_message(umax2s(qspace_max, s), "]\n", "", ""); + jemalloc_message("Cacheline-spaced sizes: [", + umax2s(cspace_min, s), "..", ""); + jemalloc_message(umax2s(cspace_max, s), "]\n", "", ""); + jemalloc_message("Subpage-spaced sizes: [", umax2s(sspace_min, + s), "..", ""); + jemalloc_message(umax2s(sspace_max, s), "]\n", "", ""); +#ifdef JEMALLOC_MAG + jemalloc_message("Rounds per magazine: ", umax2s(max_rounds, + s), "\n", ""); +#endif + jemalloc_message("Max dirty pages per arena: ", + umax2s(opt_dirty_max, s), "\n", ""); + + jemalloc_message("Chunk size: ", umax2s(chunksize, s), "", ""); + jemalloc_message(" (2^", umax2s(opt_chunk_2pow, s), ")\n", ""); + +#ifdef JEMALLOC_STATS + { + size_t allocated, mapped; +#ifdef JEMALLOC_BALANCE + uint64_t nbalance = 0; +#endif + unsigned i; + arena_t *arena; + + /* Calculate and print allocated/mapped stats. */ + + /* arenas. */ + for (i = 0, allocated = 0; i < narenas; i++) { + if (arenas[i] != NULL) { + malloc_spin_lock(&arenas[i]->lock); + allocated += + arenas[i]->stats.allocated_small; + allocated += + arenas[i]->stats.allocated_large; +#ifdef JEMALLOC_BALANCE + nbalance += arenas[i]->stats.nbalance; +#endif + malloc_spin_unlock(&arenas[i]->lock); + } + } + + /* huge/base. */ + malloc_mutex_lock(&huge_mtx); + allocated += huge_allocated; + mapped = stats_chunks.curchunks * chunksize; + malloc_mutex_unlock(&huge_mtx); + + malloc_mutex_lock(&base_mtx); + mapped += base_mapped; + malloc_mutex_unlock(&base_mtx); + + malloc_printf("Allocated: %zu, mapped: %zu\n", + allocated, mapped); + +#ifdef JEMALLOC_BALANCE + malloc_printf("Arena balance reassignments: %llu\n", + nbalance); +#endif + + /* Print chunk stats. */ + { + chunk_stats_t chunks_stats; + + malloc_mutex_lock(&huge_mtx); + chunks_stats = stats_chunks; + malloc_mutex_unlock(&huge_mtx); + + malloc_printf("chunks: nchunks " + "highchunks curchunks\n"); + malloc_printf(" %13llu%13lu%13lu\n", + chunks_stats.nchunks, + chunks_stats.highchunks, + chunks_stats.curchunks); + } + + /* Print chunk stats. */ + malloc_printf( + "huge: nmalloc ndalloc allocated\n"); + malloc_printf(" %12llu %12llu %12zu\n", + huge_nmalloc, huge_ndalloc, huge_allocated); + + /* Print stats for each arena. */ + for (i = 0; i < narenas; i++) { + arena = arenas[i]; + if (arena != NULL) { + malloc_printf( + "\narenas[%u]:\n", i); + malloc_spin_lock(&arena->lock); + stats_print(arena); + malloc_spin_unlock(&arena->lock); + } + } + } +#endif /* #ifdef JEMALLOC_STATS */ + jemalloc_message("--- End jemalloc statistics ---\n", "", "", + ""); + } +} + +#ifdef JEMALLOC_DEBUG +static void +size2bin_validate(void) +{ + size_t i, size, binind; + + assert(size2bin[0] == 0xffU); + i = 1; +# ifdef JEMALLOC_TINY + /* Tiny. */ + for (; i < (1U << TINY_MIN_2POW); i++) { + size = pow2_ceil(1U << TINY_MIN_2POW); + binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); + assert(size2bin[i] == binind); + } + for (; i < qspace_min; i++) { + size = pow2_ceil(i); + binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); + assert(size2bin[i] == binind); + } +# endif + /* Quantum-spaced. */ + for (; i <= qspace_max; i++) { + size = QUANTUM_CEILING(i); + binind = ntbins + (size >> QUANTUM_2POW) - 1; + assert(size2bin[i] == binind); + } + /* Cacheline-spaced. */ + for (; i <= cspace_max; i++) { + size = CACHELINE_CEILING(i); + binind = ntbins + nqbins + ((size - cspace_min) >> + CACHELINE_2POW); + assert(size2bin[i] == binind); + } + /* Sub-page. */ + for (; i <= sspace_max; i++) { + size = SUBPAGE_CEILING(i); + binind = ntbins + nqbins + ncbins + ((size - sspace_min) + >> SUBPAGE_2POW); + assert(size2bin[i] == binind); + } +} +#endif + +static bool +size2bin_init(void) +{ + + if (opt_qspace_max_2pow != QSPACE_MAX_2POW_DEFAULT + || opt_cspace_max_2pow != CSPACE_MAX_2POW_DEFAULT) + return (size2bin_init_hard()); + + size2bin = const_size2bin; +#ifdef JEMALLOC_DEBUG + assert(sizeof(const_size2bin) == bin_maxclass + 1); + size2bin_validate(); +#endif + return (false); +} + +static bool +size2bin_init_hard(void) +{ + size_t i, size, binind; + uint8_t *custom_size2bin; + + assert(opt_qspace_max_2pow != QSPACE_MAX_2POW_DEFAULT + || opt_cspace_max_2pow != CSPACE_MAX_2POW_DEFAULT); + + custom_size2bin = (uint8_t *)base_alloc(bin_maxclass + 1); + if (custom_size2bin == NULL) + return (true); + + custom_size2bin[0] = 0xffU; + i = 1; +#ifdef JEMALLOC_TINY + /* Tiny. */ + for (; i < (1U << TINY_MIN_2POW); i++) { + size = pow2_ceil(1U << TINY_MIN_2POW); + binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); + custom_size2bin[i] = binind; + } + for (; i < qspace_min; i++) { + size = pow2_ceil(i); + binind = ffs((int)(size >> (TINY_MIN_2POW + 1))); + custom_size2bin[i] = binind; + } +#endif + /* Quantum-spaced. */ + for (; i <= qspace_max; i++) { + size = QUANTUM_CEILING(i); + binind = ntbins + (size >> QUANTUM_2POW) - 1; + custom_size2bin[i] = binind; + } + /* Cacheline-spaced. */ + for (; i <= cspace_max; i++) { + size = CACHELINE_CEILING(i); + binind = ntbins + nqbins + ((size - cspace_min) >> + CACHELINE_2POW); + custom_size2bin[i] = binind; + } + /* Sub-page. */ + for (; i <= sspace_max; i++) { + size = SUBPAGE_CEILING(i); + binind = ntbins + nqbins + ncbins + ((size - sspace_min) >> + SUBPAGE_2POW); + custom_size2bin[i] = binind; + } + + size2bin = custom_size2bin; +#ifdef JEMALLOC_DEBUG + size2bin_validate(); +#endif + return (false); +} + +static unsigned +malloc_ncpus(void) +{ + unsigned ret; + long result; + + result = sysconf(_SC_NPROCESSORS_ONLN); + if (result == -1) { + /* Error. */ + ret = 1; + } + ret = (unsigned)result; + + return (ret); +} + +/* + * FreeBSD's pthreads implementation calls malloc(3), so the malloc + * implementation has to take pains to avoid infinite recursion during + * initialization. + */ +static inline bool +malloc_init(void) +{ + + if (malloc_initialized == false) + return (malloc_init_hard()); + + return (false); +} + +static bool +malloc_init_hard(void) +{ + unsigned i; + int linklen; + char buf[PATH_MAX + 1]; + const char *opts; + arena_t *init_arenas[1]; + + malloc_mutex_lock(&init_lock); + if (malloc_initialized || malloc_initializer == pthread_self()) { + /* + * Another thread initialized the allocator before this one + * acquired init_lock, or this thread is the inializing thread, + * and it is recursively allocating. + */ + malloc_mutex_unlock(&init_lock); + return (false); + } + if (malloc_initializer != (unsigned long)0) { + /* Busy-wait until the initializing thread completes. */ + do { + malloc_mutex_unlock(&init_lock); + CPU_SPINWAIT; + malloc_mutex_lock(&init_lock); + } while (malloc_initialized == false); + return (false); + } + +#ifdef DYNAMIC_PAGE_SHIFT + /* Get page size. */ + { + long result; + + result = sysconf(_SC_PAGESIZE); + assert(result != -1); + pagesize = (unsigned)result; + + /* + * We assume that pagesize is a power of 2 when calculating + * pagesize_mask and pagesize_2pow. + */ + assert(((result - 1) & result) == 0); + pagesize_mask = result - 1; + pagesize_2pow = ffs((int)result) - 1; + } +#endif + + for (i = 0; i < 3; i++) { + unsigned j; + + /* Get runtime configuration. */ + switch (i) { + case 0: + if ((linklen = readlink("/etc/jemalloc.conf", buf, + sizeof(buf) - 1)) != -1) { + /* + * Use the contents of the "/etc/jemalloc.conf" + * symbolic link's name. + */ + buf[linklen] = '\0'; + opts = buf; + } else { + /* No configuration specified. */ + buf[0] = '\0'; + opts = buf; + } + break; + case 1: + if ((opts = getenv("JEMALLOC_OPTIONS")) != NULL) { + /* + * Do nothing; opts is already initialized to + * the value of the JEMALLOC_OPTIONS + * environment variable. + */ + } else { + /* No configuration specified. */ + buf[0] = '\0'; + opts = buf; + } + break; + case 2: + if (jemalloc_options != NULL) { + /* + * Use options that were compiled into the + * program. + */ + opts = jemalloc_options; + } else { + /* No configuration specified. */ + buf[0] = '\0'; + opts = buf; + } + break; + default: + /* NOTREACHED */ + assert(false); + buf[0] = '\0'; + opts = buf; + } + + for (j = 0; opts[j] != '\0'; j++) { + unsigned k, nreps; + bool nseen; + + /* Parse repetition count, if any. */ + for (nreps = 0, nseen = false;; j++, nseen = true) { + switch (opts[j]) { + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + case '8': case '9': + nreps *= 10; + nreps += opts[j] - '0'; + break; + default: + goto MALLOC_OUT; + } + } +MALLOC_OUT: + if (nseen == false) + nreps = 1; + + for (k = 0; k < nreps; k++) { + switch (opts[j]) { + case 'a': + opt_abort = false; + break; + case 'A': + opt_abort = true; + break; + case 'b': +#ifdef JEMALLOC_BALANCE + opt_balance_threshold >>= 1; +#endif + break; + case 'B': +#ifdef JEMALLOC_BALANCE + if (opt_balance_threshold == 0) + opt_balance_threshold = 1; + else if ((opt_balance_threshold << 1) + > opt_balance_threshold) + opt_balance_threshold <<= 1; +#endif + break; + case 'c': + if (opt_cspace_max_2pow - 1 > + opt_qspace_max_2pow && + opt_cspace_max_2pow > + CACHELINE_2POW) + opt_cspace_max_2pow--; + break; + case 'C': + if (opt_cspace_max_2pow < PAGE_SHIFT + - 1) + opt_cspace_max_2pow++; + break; + case 'd': +#ifdef JEMALLOC_DSS + opt_dss = false; +#endif + break; + case 'D': +#ifdef JEMALLOC_DSS + opt_dss = true; +#endif + break; + case 'f': + opt_dirty_max >>= 1; + break; + case 'F': + if (opt_dirty_max == 0) + opt_dirty_max = 1; + else if ((opt_dirty_max << 1) != 0) + opt_dirty_max <<= 1; + break; +#ifdef JEMALLOC_MAG + case 'g': + opt_mag = false; + break; + case 'G': + opt_mag = true; + break; +#endif +#ifdef JEMALLOC_FILL + case 'j': + opt_junk = false; + break; + case 'J': + opt_junk = true; + break; +#endif + case 'k': + /* + * Chunks always require at least one + * header page, so chunks can never be + * smaller than two pages. + */ + if (opt_chunk_2pow > PAGE_SHIFT + 1) + opt_chunk_2pow--; + break; + case 'K': + if (opt_chunk_2pow + 1 < + (sizeof(size_t) << 3)) + opt_chunk_2pow++; + break; + case 'm': +#ifdef JEMALLOC_DSS + opt_mmap = false; +#endif + break; + case 'M': +#ifdef JEMALLOC_DSS + opt_mmap = true; +#endif + break; + case 'n': + opt_narenas_lshift--; + break; + case 'N': + opt_narenas_lshift++; + break; + case 'p': + opt_print_stats = false; + break; + case 'P': + opt_print_stats = true; + break; + case 'q': + if (opt_qspace_max_2pow > QUANTUM_2POW) + opt_qspace_max_2pow--; + break; + case 'Q': + if (opt_qspace_max_2pow + 1 < + opt_cspace_max_2pow) + opt_qspace_max_2pow++; + break; +#ifdef JEMALLOC_MAG + case 'R': + if (opt_mag_size_2pow + 1 < (8U << + SIZEOF_PTR_2POW)) + opt_mag_size_2pow++; + break; + case 'r': + /* + * Make sure there's always at least + * one round per magazine. + */ + if ((1U << (opt_mag_size_2pow-1)) >= + sizeof(mag_t)) + opt_mag_size_2pow--; + break; +#endif +#ifdef JEMALLOC_STATS + case 'u': + opt_utrace = false; + break; + case 'U': + opt_utrace = true; + break; +#endif +#ifdef JEMALLOC_SYSV + case 'v': + opt_sysv = false; + break; + case 'V': + opt_sysv = true; + break; +#endif +#ifdef JEMALLOC_XMALLOC + case 'x': + opt_xmalloc = false; + break; + case 'X': + opt_xmalloc = true; + break; +#endif +#ifdef JEMALLOC_FILL + case 'z': + opt_zero = false; + break; + case 'Z': + opt_zero = true; + break; +#endif + default: { + char cbuf[2]; + + cbuf[0] = opts[j]; + cbuf[1] = '\0'; + jemalloc_message("", + ": Unsupported character " + "in malloc options: '", cbuf, + "'\n"); + } + } + } + } + } + +#ifdef JEMALLOC_DSS + /* Make sure that there is some method for acquiring memory. */ + if (opt_dss == false && opt_mmap == false) + opt_mmap = true; +#endif + + /* Take care to call atexit() only once. */ + if (opt_print_stats) { + /* Print statistics at exit. */ + atexit(malloc_print_stats); + } + + /* Register fork handlers. */ + pthread_atfork(jemalloc_prefork, jemalloc_postfork, jemalloc_postfork); + +#ifdef JEMALLOC_MAG + /* + * Calculate the actual number of rounds per magazine, taking into + * account header overhead. + */ + max_rounds = (1LLU << (opt_mag_size_2pow - SIZEOF_PTR_2POW)) - + (sizeof(mag_t) >> SIZEOF_PTR_2POW) + 1; +#endif + + /* Set variables according to the value of opt_[qc]space_max_2pow. */ + qspace_max = (1U << opt_qspace_max_2pow); + cspace_min = CACHELINE_CEILING(qspace_max); + if (cspace_min == qspace_max) + cspace_min += CACHELINE; + cspace_max = (1U << opt_cspace_max_2pow); + sspace_min = SUBPAGE_CEILING(cspace_max); + if (sspace_min == cspace_max) + sspace_min += SUBPAGE; + assert(sspace_min < PAGE_SIZE); + sspace_max = PAGE_SIZE - SUBPAGE; + +#ifdef JEMALLOC_TINY + assert(QUANTUM_2POW >= TINY_MIN_2POW); +#endif + assert(ntbins <= QUANTUM_2POW); + nqbins = qspace_max >> QUANTUM_2POW; + ncbins = ((cspace_max - cspace_min) >> CACHELINE_2POW) + 1; + nsbins = ((sspace_max - sspace_min) >> SUBPAGE_2POW) + 1; + nbins = ntbins + nqbins + ncbins + nsbins; + + if (size2bin_init()) { + malloc_mutex_unlock(&init_lock); + return (true); + } + + /* Set variables according to the value of opt_chunk_2pow. */ + chunksize = (1LU << opt_chunk_2pow); + chunksize_mask = chunksize - 1; + chunk_npages = (chunksize >> PAGE_SHIFT); + { + size_t header_size; + + /* + * Compute the header size such that it is large enough to + * contain the page map. + */ + header_size = sizeof(arena_chunk_t) + + (sizeof(arena_chunk_map_t) * (chunk_npages - 1)); + arena_chunk_header_npages = (header_size >> PAGE_SHIFT) + + ((header_size & PAGE_MASK) != 0); + } + arena_maxclass = chunksize - (arena_chunk_header_npages << + PAGE_SHIFT); + + UTRACE(0, 0, 0); + +#ifdef JEMALLOC_STATS + memset(&stats_chunks, 0, sizeof(chunk_stats_t)); +#endif + + /* Various sanity checks that regard configuration. */ + assert(chunksize >= PAGE_SIZE); + + /* Initialize chunks data. */ + if (malloc_mutex_init(&huge_mtx)) { + malloc_mutex_unlock(&init_lock); + return (true); + } + extent_tree_ad_new(&huge); +#ifdef JEMALLOC_DSS + if (malloc_mutex_init(&dss_mtx)) { + malloc_mutex_unlock(&init_lock); + return (true); + } + dss_base = sbrk(0); + dss_prev = dss_base; + dss_max = dss_base; + extent_tree_szad_new(&dss_chunks_szad); + extent_tree_ad_new(&dss_chunks_ad); +#endif +#ifdef JEMALLOC_STATS + huge_nmalloc = 0; + huge_ndalloc = 0; + huge_allocated = 0; +#endif + + /* Initialize base allocation data structures. */ +#ifdef JEMALLOC_STATS + base_mapped = 0; +#endif +#ifdef JEMALLOC_DSS + /* + * Allocate a base chunk here, since it doesn't actually have to be + * chunk-aligned. Doing this before allocating any other chunks allows + * the use of space that would otherwise be wasted. + */ + if (opt_dss) + base_pages_alloc(0); +#endif + base_nodes = NULL; + if (malloc_mutex_init(&base_mtx)) { + malloc_mutex_unlock(&init_lock); + return (true); + } + + /* + * Create enough scaffolding to allow recursive allocation in + * malloc_ncpus(). + */ + narenas = 1; + arenas = init_arenas; + memset(arenas, 0, sizeof(arena_t *) * narenas); + + /* + * Initialize one arena here. The rest are lazily created in + * choose_arena_hard(). + */ + arenas_extend(0); + if (arenas[0] == NULL) { + malloc_mutex_unlock(&init_lock); + return (true); + } + +#ifndef NO_TLS + /* + * Assign the initial arena to the initial thread, in order to avoid + * spurious creation of an extra arena if the application switches to + * threaded mode. + */ + arenas_map = arenas[0]; +#endif + +#ifdef JEMALLOC_MAG + if (pthread_key_create(&mag_rack_tsd, thread_cleanup) != 0) { + jemalloc_message("", + ": Error in pthread_key_create()\n", "", ""); + abort(); + } +#endif + /* + * Seed here for the initial thread, since choose_arena_hard() is only + * called for other threads. The seed value doesn't really matter. + */ +#ifdef JEMALLOC_BALANCE + SPRN(balance, 42); +#endif + + malloc_spin_init(&arenas_lock); + + /* Get number of CPUs. */ + malloc_initializer = pthread_self(); + malloc_mutex_unlock(&init_lock); + ncpus = malloc_ncpus(); + malloc_mutex_lock(&init_lock); + + if (ncpus > 1) { + /* + * For SMP systems, create twice as many arenas as there are + * CPUs by default. + */ + opt_narenas_lshift++; + } + + /* Determine how many arenas to use. */ + narenas = ncpus; + if (opt_narenas_lshift > 0) { + if ((narenas << opt_narenas_lshift) > narenas) + narenas <<= opt_narenas_lshift; + /* + * Make sure not to exceed the limits of what base_alloc() can + * handle. + */ + if (narenas * sizeof(arena_t *) > chunksize) + narenas = chunksize / sizeof(arena_t *); + } else if (opt_narenas_lshift < 0) { + if ((narenas >> -opt_narenas_lshift) < narenas) + narenas >>= -opt_narenas_lshift; + /* Make sure there is at least one arena. */ + if (narenas == 0) + narenas = 1; + } +#ifdef JEMALLOC_BALANCE + assert(narenas != 0); + for (narenas_2pow = 0; + (narenas >> (narenas_2pow + 1)) != 0; + narenas_2pow++); +#endif + +#ifdef NO_TLS + if (narenas > 1) { + static const unsigned primes[] = {1, 3, 5, 7, 11, 13, 17, 19, + 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, + 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, + 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, + 223, 227, 229, 233, 239, 241, 251, 257, 263}; + unsigned nprimes, parenas; + + /* + * Pick a prime number of hash arenas that is more than narenas + * so that direct hashing of pthread_self() pointers tends to + * spread allocations evenly among the arenas. + */ + assert((narenas & 1) == 0); /* narenas must be even. */ + nprimes = (sizeof(primes) >> SIZEOF_INT_2POW); + parenas = primes[nprimes - 1]; /* In case not enough primes. */ + for (i = 1; i < nprimes; i++) { + if (primes[i] > narenas) { + parenas = primes[i]; + break; + } + } + narenas = parenas; + } +#endif + +#ifndef NO_TLS +# ifndef JEMALLOC_BALANCE + next_arena = 0; +# endif +#endif + + /* Allocate and initialize arenas. */ + arenas = (arena_t **)base_alloc(sizeof(arena_t *) * narenas); + if (arenas == NULL) { + malloc_mutex_unlock(&init_lock); + return (true); + } + /* + * Zero the array. In practice, this should always be pre-zeroed, + * since it was just mmap()ed, but let's be sure. + */ + memset(arenas, 0, sizeof(arena_t *) * narenas); + /* Copy the pointer to the one arena that was already initialized. */ + arenas[0] = init_arenas[0]; + + malloc_initialized = true; + malloc_mutex_unlock(&init_lock); + return (false); +} + +/* + * End general internal functions. + */ + +#ifdef USE_JEMALLOC + +/******************************************************************************/ +/* + * Begin malloc(3)-compatible functions. + */ + +void * +malloc(size_t size) +{ + void *ret; + + if (malloc_init()) { + ret = NULL; + goto RETURN; + } + + if (size == 0) { +#ifdef JEMALLOC_SYSV + if (opt_sysv == false) +#endif + size = 1; +#ifdef JEMALLOC_SYSV + else { + ret = NULL; + goto RETURN; + } +#endif + } + + ret = imalloc(size); + +RETURN: + if (ret == NULL) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + jemalloc_message("", + ": Error in malloc(): out of memory\n", "", + ""); + abort(); + } +#endif + errno = ENOMEM; + } + + UTRACE(0, size, ret); + return (ret); +} + +int +posix_memalign(void **memptr, size_t alignment, size_t size) +{ + int ret; + void *result; + + if (malloc_init()) + result = NULL; + else { + /* Make sure that alignment is a large enough power of 2. */ + if (((alignment - 1) & alignment) != 0 + || alignment < sizeof(void *)) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + jemalloc_message("", + ": Error in posix_memalign(): " + "invalid alignment\n", "", ""); + abort(); + } +#endif + result = NULL; + ret = EINVAL; + goto RETURN; + } + + result = ipalloc(alignment, size); + } + + if (result == NULL) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + jemalloc_message("", + ": Error in posix_memalign(): out of memory\n", + "", ""); + abort(); + } +#endif + ret = ENOMEM; + goto RETURN; + } + + *memptr = result; + ret = 0; + +RETURN: + UTRACE(0, size, result); + return (ret); +} + +void * +calloc(size_t num, size_t size) +{ + void *ret; + size_t num_size; + + if (malloc_init()) { + num_size = 0; + ret = NULL; + goto RETURN; + } + + num_size = num * size; + if (num_size == 0) { +#ifdef JEMALLOC_SYSV + if ((opt_sysv == false) && ((num == 0) || (size == 0))) +#endif + num_size = 1; +#ifdef JEMALLOC_SYSV + else { + ret = NULL; + goto RETURN; + } +#endif + /* + * Try to avoid division here. We know that it isn't possible to + * overflow during multiplication if neither operand uses any of the + * most significant half of the bits in a size_t. + */ + } else if (((num | size) & (SIZE_T_MAX << (sizeof(size_t) << 2))) + && (num_size / size != num)) { + /* size_t overflow. */ + ret = NULL; + goto RETURN; + } + + ret = icalloc(num_size); + +RETURN: + if (ret == NULL) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + jemalloc_message("", + ": Error in calloc(): out of memory\n", "", + ""); + abort(); + } +#endif + errno = ENOMEM; + } + + UTRACE(0, num_size, ret); + return (ret); +} + +void * +realloc(void *ptr, size_t size) +{ + void *ret; + + if (size == 0) { +#ifdef JEMALLOC_SYSV + if (opt_sysv == false) +#endif + size = 1; +#ifdef JEMALLOC_SYSV + else { + if (ptr != NULL) + idalloc(ptr); + ret = NULL; + goto RETURN; + } +#endif + } + + if (ptr != NULL) { + assert(malloc_initialized); + + ret = iralloc(ptr, size); + + if (ret == NULL) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + jemalloc_message("", + ": Error in realloc(): out of " + "memory\n", "", ""); + abort(); + } +#endif + errno = ENOMEM; + } + } else { + if (malloc_init()) + ret = NULL; + else + ret = imalloc(size); + + if (ret == NULL) { +#ifdef JEMALLOC_XMALLOC + if (opt_xmalloc) { + jemalloc_message("", + ": Error in realloc(): out of " + "memory\n", "", ""); + abort(); + } +#endif + errno = ENOMEM; + } + } + +RETURN: + UTRACE(ptr, size, ret); + return (ret); +} + +void +free(void *ptr) +{ + + UTRACE(ptr, 0, 0); + if (ptr != NULL) { + assert(malloc_initialized); + + idalloc(ptr); + } +} + +/* + * End malloc(3)-compatible functions. + */ +#endif /* USE_JEMALLOC */ + +/******************************************************************************/ +/* + * Begin non-standard functions. + */ + +size_t +malloc_usable_size(const void *ptr) +{ + + assert(ptr != NULL); + + return (isalloc(ptr)); +} + +/* + * End non-standard functions. + */ +/******************************************************************************/ +/* + * Begin library-private functions. + */ + +/******************************************************************************/ +/* + * Begin thread cache. + */ + +/* + * We provide an unpublished interface in order to receive notifications from + * the pthreads library whenever a thread exits. This allows us to clean up + * thread caches. + */ +static void +thread_cleanup(void *arg) +{ + +#ifdef JEMALLOC_MAG + assert((mag_rack_t *)arg == mag_rack); + if (mag_rack != NULL) { + assert(mag_rack != (void *)-1); + mag_rack_destroy(mag_rack); +#ifdef JEMALLOC_DEBUG + mag_rack = (void *)-1; +#endif + } +#endif +} + +/* + * The following functions are used by threading libraries for protection of + * malloc during fork(). These functions are only called if the program is + * running in threaded mode, so there is no need to check whether the program + * is threaded here. + */ + +static void +jemalloc_prefork(void) +{ + bool again; + unsigned i, j; + arena_t *larenas[narenas], *tarenas[narenas]; + + /* Acquire all mutexes in a safe order. */ + + /* + * arenas_lock must be acquired after all of the arena mutexes, in + * order to avoid potential deadlock with arena_lock_balance[_hard](). + * Since arenas_lock protects the arenas array, the following code has + * to race with arenas_extend() callers until it succeeds in locking + * all arenas before locking arenas_lock. + */ + memset(larenas, 0, sizeof(arena_t *) * narenas); + do { + again = false; + + malloc_spin_lock(&arenas_lock); + for (i = 0; i < narenas; i++) { + if (arenas[i] != larenas[i]) { + memcpy(tarenas, arenas, sizeof(arena_t *) * + narenas); + malloc_spin_unlock(&arenas_lock); + for (j = 0; j < narenas; j++) { + if (larenas[j] != tarenas[j]) { + larenas[j] = tarenas[j]; + malloc_spin_lock( + &larenas[j]->lock); + } + } + again = true; + break; + } + } + } while (again); + + malloc_mutex_lock(&base_mtx); + + malloc_mutex_lock(&huge_mtx); + +#ifdef JEMALLOC_DSS + malloc_mutex_lock(&dss_mtx); +#endif +} + +static void +jemalloc_postfork(void) +{ + unsigned i; + arena_t *larenas[narenas]; + + /* Release all mutexes, now that fork() has completed. */ + +#ifdef JEMALLOC_DSS + malloc_mutex_unlock(&dss_mtx); +#endif + + malloc_mutex_unlock(&huge_mtx); + + malloc_mutex_unlock(&base_mtx); + + memcpy(larenas, arenas, sizeof(arena_t *) * narenas); + malloc_spin_unlock(&arenas_lock); + for (i = 0; i < narenas; i++) { + if (larenas[i] != NULL) + malloc_spin_unlock(&larenas[i]->lock); + } +} + +/* + * End library-private functions. + */ +/******************************************************************************/ diff --git a/src/util/jemalloc/jemalloc.h b/src/util/jemalloc/jemalloc.h new file mode 100644 index 0000000000000..21b8de5bf6fd8 --- /dev/null +++ b/src/util/jemalloc/jemalloc.h @@ -0,0 +1,51 @@ +/*- + * Copyright (C) 2009 Facebook, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Facebook, Inc. nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ******************************************************************************* + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef JEMALLOC_H_ +#define JEMALLOC_H_ + +#include "jemalloc_defs.h" + +size_t malloc_usable_size(const void *ptr); + +extern const char *jemalloc_options; +extern void (*jemalloc_message)(const char *p1, const char *p2, + const char *p3, const char *p4); + +#endif /* JEMALLOC_H_ */ + +#ifdef __cplusplus +}; +#endif + diff --git a/src/util/jemalloc/jemalloc_defs.h b/src/util/jemalloc/jemalloc_defs.h new file mode 100644 index 0000000000000..bb1deac7a96c0 --- /dev/null +++ b/src/util/jemalloc/jemalloc_defs.h @@ -0,0 +1,105 @@ +/* src/jemalloc_defs.h. Generated by configure. */ +/*- + * Copyright (C) 2009 Facebook, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of Facebook, Inc. nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ******************************************************************************* + */ + +#ifndef JEMALLOC_DEFS_H_ +#define JEMALLOC_DEFS_H_ + +/* + * jemalloc version string. + */ +#define JEMALLOC_VERSION "0.0.0" + +/* + * Hyper-threaded CPUs may need a special instruction inside spin loops in + * order to yield to another virtual CPU. + */ +#define CPU_SPINWAIT __asm__ volatile("pause") + +/* + * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables + * inline functions. + */ +/* #undef JEMALLOC_DEBUG */ + +/* JEMALLOC_STATS enables statistics calculation. */ +/* #undef JEMALLOC_STATS */ + +/* + * JEMALLOC_TINY enables support for tiny objects, which are smaller than one + * quantum. + */ +#define JEMALLOC_TINY + +/* + * JEMALLOC_MAG enables a magazine-based thread-specific caching layer for small + * objects. This makes it possible to allocate/deallocate objects without any + * locking when the cache is in the steady state. + */ +#define JEMALLOC_MAG + +/* + * JEMALLOC_BALANCE enables monitoring of arena lock contention and dynamically + * re-balances arena load if exponentially averaged contention exceeds a + * certain threshold. + */ +#define JEMALLOC_BALANCE + +/* + * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage + * segment (DSS). + */ +/* #undef JEMALLOC_DSS */ + +/* Support memory filling (junk/zero). */ +/* #undef JEMALLOC_FILL */ + +/* Support optional abort() on OOM. */ +/* #undef JEMALLOC_XMALLOC */ + +/* Support SYSV semantics. */ +/* #undef JEMALLOC_SYSV */ + +/* Support lazy locking (avoid locking unless a second thread is launched). */ +#define JEMALLOC_LAZY_LOCK + +/* Determine page size at run time if defined. */ +/* #undef DYNAMIC_PAGE_SHIFT */ + +/* One page is 2^STATIC_PAGE_SHIFT bytes. */ +#define STATIC_PAGE_SHIFT 12 + +/* TLS is used to map arenas and magazine caches to threads. */ +/* #undef NO_TLS */ + +/* sizeof(void *) == 2^SIZEOF_PTR_2POW. */ +#define SIZEOF_PTR_2POW 3 + +#endif /* JEMALLOC_DEFS_H_ */ diff --git a/src/util/jemalloc/rb.h b/src/util/jemalloc/rb.h new file mode 100644 index 0000000000000..177c5480e08d3 --- /dev/null +++ b/src/util/jemalloc/rb.h @@ -0,0 +1,948 @@ +/****************************************************************************** + * + * Copyright (C) 2008 Jason Evans . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice(s), this list of conditions and the following disclaimer + * unmodified other than the allowable addition of one or more + * copyright notices. + * 2. Redistributions in binary form must reproduce the above copyright + * notice(s), this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + * + * cpp macro implementation of left-leaning red-black trees. + * + * Usage: + * + * (Optional, see assert(3).) + * #define NDEBUG + * + * (Required.) + * #include + * #include + * ... + * + * All operations are done non-recursively. Parent pointers are not used, and + * color bits are stored in the least significant bit of right-child pointers, + * thus making node linkage as compact as is possible for red-black trees. + * + * Some macros use a comparison function pointer, which is expected to have the + * following prototype: + * + * int (a_cmp *)(a_type *a_node, a_type *a_other); + * ^^^^^^ + * or a_key + * + * Interpretation of comparision function return values: + * + * -1 : a_node < a_other + * 0 : a_node == a_other + * 1 : a_node > a_other + * + * In all cases, the a_node or a_key macro argument is the first argument to the + * comparison function, which makes it possible to write comparison functions + * that treat the first argument specially. + * + ******************************************************************************/ + +#ifndef RB_H_ +#define RB_H_ + +#if 0 +__FBSDID("$FreeBSD: src/lib/libc/stdlib/rb.h,v 1.4 2008/05/14 18:33:13 jasone Exp $"); +#endif + +/* Node structure. */ +#define rb_node(a_type) \ +struct { \ + a_type *rbn_left; \ + a_type *rbn_right_red; \ +} + +/* Root structure. */ +#define rb_tree(a_type) \ +struct { \ + a_type *rbt_root; \ + a_type rbt_nil; \ +} + +/* Left accessors. */ +#define rbp_left_get(a_type, a_field, a_node) \ + ((a_node)->a_field.rbn_left) +#define rbp_left_set(a_type, a_field, a_node, a_left) do { \ + (a_node)->a_field.rbn_left = a_left; \ +} while (0) + +/* Right accessors. */ +#define rbp_right_get(a_type, a_field, a_node) \ + ((a_type *) (((intptr_t) (a_node)->a_field.rbn_right_red) \ + & ((ssize_t)-2))) +#define rbp_right_set(a_type, a_field, a_node, a_right) do { \ + (a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) a_right) \ + | (((uintptr_t) (a_node)->a_field.rbn_right_red) & ((size_t)1))); \ +} while (0) + +/* Color accessors. */ +#define rbp_red_get(a_type, a_field, a_node) \ + ((bool) (((uintptr_t) (a_node)->a_field.rbn_right_red) \ + & ((size_t)1))) +#define rbp_color_set(a_type, a_field, a_node, a_red) do { \ + (a_node)->a_field.rbn_right_red = (a_type *) ((((intptr_t) \ + (a_node)->a_field.rbn_right_red) & ((ssize_t)-2)) \ + | ((ssize_t)a_red)); \ +} while (0) +#define rbp_red_set(a_type, a_field, a_node) do { \ + (a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) \ + (a_node)->a_field.rbn_right_red) | ((size_t)1)); \ +} while (0) +#define rbp_black_set(a_type, a_field, a_node) do { \ + (a_node)->a_field.rbn_right_red = (a_type *) (((intptr_t) \ + (a_node)->a_field.rbn_right_red) & ((ssize_t)-2)); \ +} while (0) + +/* Node initializer. */ +#define rbp_node_new(a_type, a_field, a_tree, a_node) do { \ + rbp_left_set(a_type, a_field, (a_node), &(a_tree)->rbt_nil); \ + rbp_right_set(a_type, a_field, (a_node), &(a_tree)->rbt_nil); \ + rbp_red_set(a_type, a_field, (a_node)); \ +} while (0) + +/* Tree initializer. */ +#define rb_new(a_type, a_field, a_tree) do { \ + (a_tree)->rbt_root = &(a_tree)->rbt_nil; \ + rbp_node_new(a_type, a_field, a_tree, &(a_tree)->rbt_nil); \ + rbp_black_set(a_type, a_field, &(a_tree)->rbt_nil); \ +} while (0) + +/* Tree operations. */ +#define rbp_black_height(a_type, a_field, a_tree, r_height) do { \ + a_type *rbp_bh_t; \ + for (rbp_bh_t = (a_tree)->rbt_root, (r_height) = 0; \ + rbp_bh_t != &(a_tree)->rbt_nil; \ + rbp_bh_t = rbp_left_get(a_type, a_field, rbp_bh_t)) { \ + if (rbp_red_get(a_type, a_field, rbp_bh_t) == false) { \ + (r_height)++; \ + } \ + } \ +} while (0) + +#define rbp_first(a_type, a_field, a_tree, a_root, r_node) do { \ + for ((r_node) = (a_root); \ + rbp_left_get(a_type, a_field, (r_node)) != &(a_tree)->rbt_nil; \ + (r_node) = rbp_left_get(a_type, a_field, (r_node))) { \ + } \ +} while (0) + +#define rbp_last(a_type, a_field, a_tree, a_root, r_node) do { \ + for ((r_node) = (a_root); \ + rbp_right_get(a_type, a_field, (r_node)) != &(a_tree)->rbt_nil; \ + (r_node) = rbp_right_get(a_type, a_field, (r_node))) { \ + } \ +} while (0) + +#define rbp_next(a_type, a_field, a_cmp, a_tree, a_node, r_node) do { \ + if (rbp_right_get(a_type, a_field, (a_node)) \ + != &(a_tree)->rbt_nil) { \ + rbp_first(a_type, a_field, a_tree, rbp_right_get(a_type, \ + a_field, (a_node)), (r_node)); \ + } else { \ + a_type *rbp_n_t = (a_tree)->rbt_root; \ + assert(rbp_n_t != &(a_tree)->rbt_nil); \ + (r_node) = &(a_tree)->rbt_nil; \ + while (true) { \ + int rbp_n_cmp = (a_cmp)((a_node), rbp_n_t); \ + if (rbp_n_cmp < 0) { \ + (r_node) = rbp_n_t; \ + rbp_n_t = rbp_left_get(a_type, a_field, rbp_n_t); \ + } else if (rbp_n_cmp > 0) { \ + rbp_n_t = rbp_right_get(a_type, a_field, rbp_n_t); \ + } else { \ + break; \ + } \ + assert(rbp_n_t != &(a_tree)->rbt_nil); \ + } \ + } \ +} while (0) + +#define rbp_prev(a_type, a_field, a_cmp, a_tree, a_node, r_node) do { \ + if (rbp_left_get(a_type, a_field, (a_node)) != &(a_tree)->rbt_nil) {\ + rbp_last(a_type, a_field, a_tree, rbp_left_get(a_type, \ + a_field, (a_node)), (r_node)); \ + } else { \ + a_type *rbp_p_t = (a_tree)->rbt_root; \ + assert(rbp_p_t != &(a_tree)->rbt_nil); \ + (r_node) = &(a_tree)->rbt_nil; \ + while (true) { \ + int rbp_p_cmp = (a_cmp)((a_node), rbp_p_t); \ + if (rbp_p_cmp < 0) { \ + rbp_p_t = rbp_left_get(a_type, a_field, rbp_p_t); \ + } else if (rbp_p_cmp > 0) { \ + (r_node) = rbp_p_t; \ + rbp_p_t = rbp_right_get(a_type, a_field, rbp_p_t); \ + } else { \ + break; \ + } \ + assert(rbp_p_t != &(a_tree)->rbt_nil); \ + } \ + } \ +} while (0) + +#define rb_first(a_type, a_field, a_tree, r_node) do { \ + rbp_first(a_type, a_field, a_tree, (a_tree)->rbt_root, (r_node)); \ + if ((r_node) == &(a_tree)->rbt_nil) { \ + (r_node) = NULL; \ + } \ +} while (0) + +#define rb_last(a_type, a_field, a_tree, r_node) do { \ + rbp_last(a_type, a_field, a_tree, (a_tree)->rbt_root, r_node); \ + if ((r_node) == &(a_tree)->rbt_nil) { \ + (r_node) = NULL; \ + } \ +} while (0) + +#define rb_next(a_type, a_field, a_cmp, a_tree, a_node, r_node) do { \ + rbp_next(a_type, a_field, a_cmp, a_tree, (a_node), (r_node)); \ + if ((r_node) == &(a_tree)->rbt_nil) { \ + (r_node) = NULL; \ + } \ +} while (0) + +#define rb_prev(a_type, a_field, a_cmp, a_tree, a_node, r_node) do { \ + rbp_prev(a_type, a_field, a_cmp, a_tree, (a_node), (r_node)); \ + if ((r_node) == &(a_tree)->rbt_nil) { \ + (r_node) = NULL; \ + } \ +} while (0) + +#define rb_search(a_type, a_field, a_cmp, a_tree, a_key, r_node) do { \ + int rbp_se_cmp; \ + (r_node) = (a_tree)->rbt_root; \ + while ((r_node) != &(a_tree)->rbt_nil \ + && (rbp_se_cmp = (a_cmp)((a_key), (r_node))) != 0) { \ + if (rbp_se_cmp < 0) { \ + (r_node) = rbp_left_get(a_type, a_field, (r_node)); \ + } else { \ + (r_node) = rbp_right_get(a_type, a_field, (r_node)); \ + } \ + } \ + if ((r_node) == &(a_tree)->rbt_nil) { \ + (r_node) = NULL; \ + } \ +} while (0) + +/* + * Find a match if it exists. Otherwise, find the next greater node, if one + * exists. + */ +#define rb_nsearch(a_type, a_field, a_cmp, a_tree, a_key, r_node) do { \ + a_type *rbp_ns_t = (a_tree)->rbt_root; \ + (r_node) = NULL; \ + while (rbp_ns_t != &(a_tree)->rbt_nil) { \ + int rbp_ns_cmp = (a_cmp)((a_key), rbp_ns_t); \ + if (rbp_ns_cmp < 0) { \ + (r_node) = rbp_ns_t; \ + rbp_ns_t = rbp_left_get(a_type, a_field, rbp_ns_t); \ + } else if (rbp_ns_cmp > 0) { \ + rbp_ns_t = rbp_right_get(a_type, a_field, rbp_ns_t); \ + } else { \ + (r_node) = rbp_ns_t; \ + break; \ + } \ + } \ +} while (0) + +/* + * Find a match if it exists. Otherwise, find the previous lesser node, if one + * exists. + */ +#define rb_psearch(a_type, a_field, a_cmp, a_tree, a_key, r_node) do { \ + a_type *rbp_ps_t = (a_tree)->rbt_root; \ + (r_node) = NULL; \ + while (rbp_ps_t != &(a_tree)->rbt_nil) { \ + int rbp_ps_cmp = (a_cmp)((a_key), rbp_ps_t); \ + if (rbp_ps_cmp < 0) { \ + rbp_ps_t = rbp_left_get(a_type, a_field, rbp_ps_t); \ + } else if (rbp_ps_cmp > 0) { \ + (r_node) = rbp_ps_t; \ + rbp_ps_t = rbp_right_get(a_type, a_field, rbp_ps_t); \ + } else { \ + (r_node) = rbp_ps_t; \ + break; \ + } \ + } \ +} while (0) + +#define rbp_rotate_left(a_type, a_field, a_node, r_node) do { \ + (r_node) = rbp_right_get(a_type, a_field, (a_node)); \ + rbp_right_set(a_type, a_field, (a_node), \ + rbp_left_get(a_type, a_field, (r_node))); \ + rbp_left_set(a_type, a_field, (r_node), (a_node)); \ +} while (0) + +#define rbp_rotate_right(a_type, a_field, a_node, r_node) do { \ + (r_node) = rbp_left_get(a_type, a_field, (a_node)); \ + rbp_left_set(a_type, a_field, (a_node), \ + rbp_right_get(a_type, a_field, (r_node))); \ + rbp_right_set(a_type, a_field, (r_node), (a_node)); \ +} while (0) + +#define rbp_lean_left(a_type, a_field, a_node, r_node) do { \ + bool rbp_ll_red; \ + rbp_rotate_left(a_type, a_field, (a_node), (r_node)); \ + rbp_ll_red = rbp_red_get(a_type, a_field, (a_node)); \ + rbp_color_set(a_type, a_field, (r_node), rbp_ll_red); \ + rbp_red_set(a_type, a_field, (a_node)); \ +} while (0) + +#define rbp_lean_right(a_type, a_field, a_node, r_node) do { \ + bool rbp_lr_red; \ + rbp_rotate_right(a_type, a_field, (a_node), (r_node)); \ + rbp_lr_red = rbp_red_get(a_type, a_field, (a_node)); \ + rbp_color_set(a_type, a_field, (r_node), rbp_lr_red); \ + rbp_red_set(a_type, a_field, (a_node)); \ +} while (0) + +#define rbp_move_red_left(a_type, a_field, a_node, r_node) do { \ + a_type *rbp_mrl_t, *rbp_mrl_u; \ + rbp_mrl_t = rbp_left_get(a_type, a_field, (a_node)); \ + rbp_red_set(a_type, a_field, rbp_mrl_t); \ + rbp_mrl_t = rbp_right_get(a_type, a_field, (a_node)); \ + rbp_mrl_u = rbp_left_get(a_type, a_field, rbp_mrl_t); \ + if (rbp_red_get(a_type, a_field, rbp_mrl_u)) { \ + rbp_rotate_right(a_type, a_field, rbp_mrl_t, rbp_mrl_u); \ + rbp_right_set(a_type, a_field, (a_node), rbp_mrl_u); \ + rbp_rotate_left(a_type, a_field, (a_node), (r_node)); \ + rbp_mrl_t = rbp_right_get(a_type, a_field, (a_node)); \ + if (rbp_red_get(a_type, a_field, rbp_mrl_t)) { \ + rbp_black_set(a_type, a_field, rbp_mrl_t); \ + rbp_red_set(a_type, a_field, (a_node)); \ + rbp_rotate_left(a_type, a_field, (a_node), rbp_mrl_t); \ + rbp_left_set(a_type, a_field, (r_node), rbp_mrl_t); \ + } else { \ + rbp_black_set(a_type, a_field, (a_node)); \ + } \ + } else { \ + rbp_red_set(a_type, a_field, (a_node)); \ + rbp_rotate_left(a_type, a_field, (a_node), (r_node)); \ + } \ +} while (0) + +#define rbp_move_red_right(a_type, a_field, a_node, r_node) do { \ + a_type *rbp_mrr_t; \ + rbp_mrr_t = rbp_left_get(a_type, a_field, (a_node)); \ + if (rbp_red_get(a_type, a_field, rbp_mrr_t)) { \ + a_type *rbp_mrr_u, *rbp_mrr_v; \ + rbp_mrr_u = rbp_right_get(a_type, a_field, rbp_mrr_t); \ + rbp_mrr_v = rbp_left_get(a_type, a_field, rbp_mrr_u); \ + if (rbp_red_get(a_type, a_field, rbp_mrr_v)) { \ + rbp_color_set(a_type, a_field, rbp_mrr_u, \ + rbp_red_get(a_type, a_field, (a_node))); \ + rbp_black_set(a_type, a_field, rbp_mrr_v); \ + rbp_rotate_left(a_type, a_field, rbp_mrr_t, rbp_mrr_u); \ + rbp_left_set(a_type, a_field, (a_node), rbp_mrr_u); \ + rbp_rotate_right(a_type, a_field, (a_node), (r_node)); \ + rbp_rotate_left(a_type, a_field, (a_node), rbp_mrr_t); \ + rbp_right_set(a_type, a_field, (r_node), rbp_mrr_t); \ + } else { \ + rbp_color_set(a_type, a_field, rbp_mrr_t, \ + rbp_red_get(a_type, a_field, (a_node))); \ + rbp_red_set(a_type, a_field, rbp_mrr_u); \ + rbp_rotate_right(a_type, a_field, (a_node), (r_node)); \ + rbp_rotate_left(a_type, a_field, (a_node), rbp_mrr_t); \ + rbp_right_set(a_type, a_field, (r_node), rbp_mrr_t); \ + } \ + rbp_red_set(a_type, a_field, (a_node)); \ + } else { \ + rbp_red_set(a_type, a_field, rbp_mrr_t); \ + rbp_mrr_t = rbp_left_get(a_type, a_field, rbp_mrr_t); \ + if (rbp_red_get(a_type, a_field, rbp_mrr_t)) { \ + rbp_black_set(a_type, a_field, rbp_mrr_t); \ + rbp_rotate_right(a_type, a_field, (a_node), (r_node)); \ + rbp_rotate_left(a_type, a_field, (a_node), rbp_mrr_t); \ + rbp_right_set(a_type, a_field, (r_node), rbp_mrr_t); \ + } else { \ + rbp_rotate_left(a_type, a_field, (a_node), (r_node)); \ + } \ + } \ +} while (0) + +#define rb_insert(a_type, a_field, a_cmp, a_tree, a_node) do { \ + a_type rbp_i_s; \ + a_type *rbp_i_g, *rbp_i_p, *rbp_i_c, *rbp_i_t, *rbp_i_u; \ + int rbp_i_cmp = 0; \ + rbp_i_g = &(a_tree)->rbt_nil; \ + rbp_left_set(a_type, a_field, &rbp_i_s, (a_tree)->rbt_root); \ + rbp_right_set(a_type, a_field, &rbp_i_s, &(a_tree)->rbt_nil); \ + rbp_black_set(a_type, a_field, &rbp_i_s); \ + rbp_i_p = &rbp_i_s; \ + rbp_i_c = (a_tree)->rbt_root; \ + /* Iteratively search down the tree for the insertion point, */\ + /* splitting 4-nodes as they are encountered. At the end of each */\ + /* iteration, rbp_i_g->rbp_i_p->rbp_i_c is a 3-level path down */\ + /* the tree, assuming a sufficiently deep tree. */\ + while (rbp_i_c != &(a_tree)->rbt_nil) { \ + rbp_i_t = rbp_left_get(a_type, a_field, rbp_i_c); \ + rbp_i_u = rbp_left_get(a_type, a_field, rbp_i_t); \ + if (rbp_red_get(a_type, a_field, rbp_i_t) \ + && rbp_red_get(a_type, a_field, rbp_i_u)) { \ + /* rbp_i_c is the top of a logical 4-node, so split it. */\ + /* This iteration does not move down the tree, due to the */\ + /* disruptiveness of node splitting. */\ + /* */\ + /* Rotate right. */\ + rbp_rotate_right(a_type, a_field, rbp_i_c, rbp_i_t); \ + /* Pass red links up one level. */\ + rbp_i_u = rbp_left_get(a_type, a_field, rbp_i_t); \ + rbp_black_set(a_type, a_field, rbp_i_u); \ + if (rbp_left_get(a_type, a_field, rbp_i_p) == rbp_i_c) { \ + rbp_left_set(a_type, a_field, rbp_i_p, rbp_i_t); \ + rbp_i_c = rbp_i_t; \ + } else { \ + /* rbp_i_c was the right child of rbp_i_p, so rotate */\ + /* left in order to maintain the left-leaning */\ + /* invariant. */\ + assert(rbp_right_get(a_type, a_field, rbp_i_p) \ + == rbp_i_c); \ + rbp_right_set(a_type, a_field, rbp_i_p, rbp_i_t); \ + rbp_lean_left(a_type, a_field, rbp_i_p, rbp_i_u); \ + if (rbp_left_get(a_type, a_field, rbp_i_g) == rbp_i_p) {\ + rbp_left_set(a_type, a_field, rbp_i_g, rbp_i_u); \ + } else { \ + assert(rbp_right_get(a_type, a_field, rbp_i_g) \ + == rbp_i_p); \ + rbp_right_set(a_type, a_field, rbp_i_g, rbp_i_u); \ + } \ + rbp_i_p = rbp_i_u; \ + rbp_i_cmp = (a_cmp)((a_node), rbp_i_p); \ + if (rbp_i_cmp < 0) { \ + rbp_i_c = rbp_left_get(a_type, a_field, rbp_i_p); \ + } else { \ + assert(rbp_i_cmp > 0); \ + rbp_i_c = rbp_right_get(a_type, a_field, rbp_i_p); \ + } \ + continue; \ + } \ + } \ + rbp_i_g = rbp_i_p; \ + rbp_i_p = rbp_i_c; \ + rbp_i_cmp = (a_cmp)((a_node), rbp_i_c); \ + if (rbp_i_cmp < 0) { \ + rbp_i_c = rbp_left_get(a_type, a_field, rbp_i_c); \ + } else { \ + assert(rbp_i_cmp > 0); \ + rbp_i_c = rbp_right_get(a_type, a_field, rbp_i_c); \ + } \ + } \ + /* rbp_i_p now refers to the node under which to insert. */\ + rbp_node_new(a_type, a_field, a_tree, (a_node)); \ + if (rbp_i_cmp > 0) { \ + rbp_right_set(a_type, a_field, rbp_i_p, (a_node)); \ + rbp_lean_left(a_type, a_field, rbp_i_p, rbp_i_t); \ + if (rbp_left_get(a_type, a_field, rbp_i_g) == rbp_i_p) { \ + rbp_left_set(a_type, a_field, rbp_i_g, rbp_i_t); \ + } else if (rbp_right_get(a_type, a_field, rbp_i_g) == rbp_i_p) {\ + rbp_right_set(a_type, a_field, rbp_i_g, rbp_i_t); \ + } \ + } else { \ + rbp_left_set(a_type, a_field, rbp_i_p, (a_node)); \ + } \ + /* Update the root and make sure that it is black. */\ + (a_tree)->rbt_root = rbp_left_get(a_type, a_field, &rbp_i_s); \ + rbp_black_set(a_type, a_field, (a_tree)->rbt_root); \ +} while (0) + +#define rb_remove(a_type, a_field, a_cmp, a_tree, a_node) do { \ + a_type rbp_r_s; \ + a_type *rbp_r_p, *rbp_r_c, *rbp_r_xp, *rbp_r_t, *rbp_r_u; \ + int rbp_r_cmp; \ + rbp_left_set(a_type, a_field, &rbp_r_s, (a_tree)->rbt_root); \ + rbp_right_set(a_type, a_field, &rbp_r_s, &(a_tree)->rbt_nil); \ + rbp_black_set(a_type, a_field, &rbp_r_s); \ + rbp_r_p = &rbp_r_s; \ + rbp_r_c = (a_tree)->rbt_root; \ + rbp_r_xp = &(a_tree)->rbt_nil; \ + /* Iterate down the tree, but always transform 2-nodes to 3- or */\ + /* 4-nodes in order to maintain the invariant that the current */\ + /* node is not a 2-node. This allows simple deletion once a leaf */\ + /* is reached. Handle the root specially though, since there may */\ + /* be no way to convert it from a 2-node to a 3-node. */\ + rbp_r_cmp = (a_cmp)((a_node), rbp_r_c); \ + if (rbp_r_cmp < 0) { \ + rbp_r_t = rbp_left_get(a_type, a_field, rbp_r_c); \ + rbp_r_u = rbp_left_get(a_type, a_field, rbp_r_t); \ + if (rbp_red_get(a_type, a_field, rbp_r_t) == false \ + && rbp_red_get(a_type, a_field, rbp_r_u) == false) { \ + /* Apply standard transform to prepare for left move. */\ + rbp_move_red_left(a_type, a_field, rbp_r_c, rbp_r_t); \ + rbp_black_set(a_type, a_field, rbp_r_t); \ + rbp_left_set(a_type, a_field, rbp_r_p, rbp_r_t); \ + rbp_r_c = rbp_r_t; \ + } else { \ + /* Move left. */\ + rbp_r_p = rbp_r_c; \ + rbp_r_c = rbp_left_get(a_type, a_field, rbp_r_c); \ + } \ + } else { \ + if (rbp_r_cmp == 0) { \ + assert((a_node) == rbp_r_c); \ + if (rbp_right_get(a_type, a_field, rbp_r_c) \ + == &(a_tree)->rbt_nil) { \ + /* Delete root node (which is also a leaf node). */\ + if (rbp_left_get(a_type, a_field, rbp_r_c) \ + != &(a_tree)->rbt_nil) { \ + rbp_lean_right(a_type, a_field, rbp_r_c, rbp_r_t); \ + rbp_right_set(a_type, a_field, rbp_r_t, \ + &(a_tree)->rbt_nil); \ + } else { \ + rbp_r_t = &(a_tree)->rbt_nil; \ + } \ + rbp_left_set(a_type, a_field, rbp_r_p, rbp_r_t); \ + } else { \ + /* This is the node we want to delete, but we will */\ + /* instead swap it with its successor and delete the */\ + /* successor. Record enough information to do the */\ + /* swap later. rbp_r_xp is the a_node's parent. */\ + rbp_r_xp = rbp_r_p; \ + rbp_r_cmp = 1; /* Note that deletion is incomplete. */\ + } \ + } \ + if (rbp_r_cmp == 1) { \ + if (rbp_red_get(a_type, a_field, rbp_left_get(a_type, \ + a_field, rbp_right_get(a_type, a_field, rbp_r_c))) \ + == false) { \ + rbp_r_t = rbp_left_get(a_type, a_field, rbp_r_c); \ + if (rbp_red_get(a_type, a_field, rbp_r_t)) { \ + /* Standard transform. */\ + rbp_move_red_right(a_type, a_field, rbp_r_c, \ + rbp_r_t); \ + } else { \ + /* Root-specific transform. */\ + rbp_red_set(a_type, a_field, rbp_r_c); \ + rbp_r_u = rbp_left_get(a_type, a_field, rbp_r_t); \ + if (rbp_red_get(a_type, a_field, rbp_r_u)) { \ + rbp_black_set(a_type, a_field, rbp_r_u); \ + rbp_rotate_right(a_type, a_field, rbp_r_c, \ + rbp_r_t); \ + rbp_rotate_left(a_type, a_field, rbp_r_c, \ + rbp_r_u); \ + rbp_right_set(a_type, a_field, rbp_r_t, \ + rbp_r_u); \ + } else { \ + rbp_red_set(a_type, a_field, rbp_r_t); \ + rbp_rotate_left(a_type, a_field, rbp_r_c, \ + rbp_r_t); \ + } \ + } \ + rbp_left_set(a_type, a_field, rbp_r_p, rbp_r_t); \ + rbp_r_c = rbp_r_t; \ + } else { \ + /* Move right. */\ + rbp_r_p = rbp_r_c; \ + rbp_r_c = rbp_right_get(a_type, a_field, rbp_r_c); \ + } \ + } \ + } \ + if (rbp_r_cmp != 0) { \ + while (true) { \ + assert(rbp_r_p != &(a_tree)->rbt_nil); \ + rbp_r_cmp = (a_cmp)((a_node), rbp_r_c); \ + if (rbp_r_cmp < 0) { \ + rbp_r_t = rbp_left_get(a_type, a_field, rbp_r_c); \ + if (rbp_r_t == &(a_tree)->rbt_nil) { \ + /* rbp_r_c now refers to the successor node to */\ + /* relocate, and rbp_r_xp/a_node refer to the */\ + /* context for the relocation. */\ + if (rbp_left_get(a_type, a_field, rbp_r_xp) \ + == (a_node)) { \ + rbp_left_set(a_type, a_field, rbp_r_xp, \ + rbp_r_c); \ + } else { \ + assert(rbp_right_get(a_type, a_field, \ + rbp_r_xp) == (a_node)); \ + rbp_right_set(a_type, a_field, rbp_r_xp, \ + rbp_r_c); \ + } \ + rbp_left_set(a_type, a_field, rbp_r_c, \ + rbp_left_get(a_type, a_field, (a_node))); \ + rbp_right_set(a_type, a_field, rbp_r_c, \ + rbp_right_get(a_type, a_field, (a_node))); \ + rbp_color_set(a_type, a_field, rbp_r_c, \ + rbp_red_get(a_type, a_field, (a_node))); \ + if (rbp_left_get(a_type, a_field, rbp_r_p) \ + == rbp_r_c) { \ + rbp_left_set(a_type, a_field, rbp_r_p, \ + &(a_tree)->rbt_nil); \ + } else { \ + assert(rbp_right_get(a_type, a_field, rbp_r_p) \ + == rbp_r_c); \ + rbp_right_set(a_type, a_field, rbp_r_p, \ + &(a_tree)->rbt_nil); \ + } \ + break; \ + } \ + rbp_r_u = rbp_left_get(a_type, a_field, rbp_r_t); \ + if (rbp_red_get(a_type, a_field, rbp_r_t) == false \ + && rbp_red_get(a_type, a_field, rbp_r_u) == false) { \ + rbp_move_red_left(a_type, a_field, rbp_r_c, \ + rbp_r_t); \ + if (rbp_left_get(a_type, a_field, rbp_r_p) \ + == rbp_r_c) { \ + rbp_left_set(a_type, a_field, rbp_r_p, rbp_r_t);\ + } else { \ + rbp_right_set(a_type, a_field, rbp_r_p, \ + rbp_r_t); \ + } \ + rbp_r_c = rbp_r_t; \ + } else { \ + rbp_r_p = rbp_r_c; \ + rbp_r_c = rbp_left_get(a_type, a_field, rbp_r_c); \ + } \ + } else { \ + /* Check whether to delete this node (it has to be */\ + /* the correct node and a leaf node). */\ + if (rbp_r_cmp == 0) { \ + assert((a_node) == rbp_r_c); \ + if (rbp_right_get(a_type, a_field, rbp_r_c) \ + == &(a_tree)->rbt_nil) { \ + /* Delete leaf node. */\ + if (rbp_left_get(a_type, a_field, rbp_r_c) \ + != &(a_tree)->rbt_nil) { \ + rbp_lean_right(a_type, a_field, rbp_r_c, \ + rbp_r_t); \ + rbp_right_set(a_type, a_field, rbp_r_t, \ + &(a_tree)->rbt_nil); \ + } else { \ + rbp_r_t = &(a_tree)->rbt_nil; \ + } \ + if (rbp_left_get(a_type, a_field, rbp_r_p) \ + == rbp_r_c) { \ + rbp_left_set(a_type, a_field, rbp_r_p, \ + rbp_r_t); \ + } else { \ + rbp_right_set(a_type, a_field, rbp_r_p, \ + rbp_r_t); \ + } \ + break; \ + } else { \ + /* This is the node we want to delete, but we */\ + /* will instead swap it with its successor */\ + /* and delete the successor. Record enough */\ + /* information to do the swap later. */\ + /* rbp_r_xp is a_node's parent. */\ + rbp_r_xp = rbp_r_p; \ + } \ + } \ + rbp_r_t = rbp_right_get(a_type, a_field, rbp_r_c); \ + rbp_r_u = rbp_left_get(a_type, a_field, rbp_r_t); \ + if (rbp_red_get(a_type, a_field, rbp_r_u) == false) { \ + rbp_move_red_right(a_type, a_field, rbp_r_c, \ + rbp_r_t); \ + if (rbp_left_get(a_type, a_field, rbp_r_p) \ + == rbp_r_c) { \ + rbp_left_set(a_type, a_field, rbp_r_p, rbp_r_t);\ + } else { \ + rbp_right_set(a_type, a_field, rbp_r_p, \ + rbp_r_t); \ + } \ + rbp_r_c = rbp_r_t; \ + } else { \ + rbp_r_p = rbp_r_c; \ + rbp_r_c = rbp_right_get(a_type, a_field, rbp_r_c); \ + } \ + } \ + } \ + } \ + /* Update root. */\ + (a_tree)->rbt_root = rbp_left_get(a_type, a_field, &rbp_r_s); \ +} while (0) + +/* + * The rb_wrap() macro provides a convenient way to wrap functions around the + * cpp macros. The main benefits of wrapping are that 1) repeated macro + * expansion can cause code bloat, especially for rb_{insert,remove)(), and + * 2) type, linkage, comparison functions, etc. need not be specified at every + * call point. + */ + +#define rb_wrap(a_attr, a_prefix, a_tree_type, a_type, a_field, a_cmp) \ +a_attr void \ +a_prefix##new(a_tree_type *tree) { \ + rb_new(a_type, a_field, tree); \ +} \ +a_attr a_type * \ +a_prefix##first(a_tree_type *tree) { \ + a_type *ret; \ + rb_first(a_type, a_field, tree, ret); \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##last(a_tree_type *tree) { \ + a_type *ret; \ + rb_last(a_type, a_field, tree, ret); \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##next(a_tree_type *tree, a_type *node) { \ + a_type *ret; \ + rb_next(a_type, a_field, a_cmp, tree, node, ret); \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##prev(a_tree_type *tree, a_type *node) { \ + a_type *ret; \ + rb_prev(a_type, a_field, a_cmp, tree, node, ret); \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##search(a_tree_type *tree, a_type *key) { \ + a_type *ret; \ + rb_search(a_type, a_field, a_cmp, tree, key, ret); \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##nsearch(a_tree_type *tree, a_type *key) { \ + a_type *ret; \ + rb_nsearch(a_type, a_field, a_cmp, tree, key, ret); \ + return (ret); \ +} \ +a_attr a_type * \ +a_prefix##psearch(a_tree_type *tree, a_type *key) { \ + a_type *ret; \ + rb_psearch(a_type, a_field, a_cmp, tree, key, ret); \ + return (ret); \ +} \ +a_attr void \ +a_prefix##insert(a_tree_type *tree, a_type *node) { \ + rb_insert(a_type, a_field, a_cmp, tree, node); \ +} \ +a_attr void \ +a_prefix##remove(a_tree_type *tree, a_type *node) { \ + rb_remove(a_type, a_field, a_cmp, tree, node); \ +} + +/* + * The iterators simulate recursion via an array of pointers that store the + * current path. This is critical to performance, since a series of calls to + * rb_{next,prev}() would require time proportional to (n lg n), whereas this + * implementation only requires time proportional to (n). + * + * Since the iterators cache a path down the tree, any tree modification may + * cause the cached path to become invalid. In order to continue iteration, + * use something like the following sequence: + * + * { + * a_type *node, *tnode; + * + * rb_foreach_begin(a_type, a_field, a_tree, node) { + * ... + * rb_next(a_type, a_field, a_cmp, a_tree, node, tnode); + * rb_remove(a_type, a_field, a_cmp, a_tree, node); + * rb_foreach_next(a_type, a_field, a_cmp, a_tree, tnode); + * ... + * } rb_foreach_end(a_type, a_field, a_tree, node) + * } + * + * Note that this idiom is not advised if every iteration modifies the tree, + * since in that case there is no algorithmic complexity improvement over a + * series of rb_{next,prev}() calls, thus making the setup overhead wasted + * effort. + */ + +#define rb_foreach_begin(a_type, a_field, a_tree, a_var) { \ + /* Compute the maximum possible tree depth (3X the black height). */\ + unsigned rbp_f_height; \ + rbp_black_height(a_type, a_field, a_tree, rbp_f_height); \ + rbp_f_height *= 3; \ + { \ + /* Initialize the path to contain the left spine. */\ + a_type *rbp_f_path[rbp_f_height]; \ + a_type *rbp_f_node; \ + bool rbp_f_synced = false; \ + unsigned rbp_f_depth = 0; \ + if ((a_tree)->rbt_root != &(a_tree)->rbt_nil) { \ + rbp_f_path[rbp_f_depth] = (a_tree)->rbt_root; \ + rbp_f_depth++; \ + while ((rbp_f_node = rbp_left_get(a_type, a_field, \ + rbp_f_path[rbp_f_depth-1])) != &(a_tree)->rbt_nil) { \ + rbp_f_path[rbp_f_depth] = rbp_f_node; \ + rbp_f_depth++; \ + } \ + } \ + /* While the path is non-empty, iterate. */\ + while (rbp_f_depth > 0) { \ + (a_var) = rbp_f_path[rbp_f_depth-1]; + +/* Only use if modifying the tree during iteration. */ +#define rb_foreach_next(a_type, a_field, a_cmp, a_tree, a_node) \ + /* Re-initialize the path to contain the path to a_node. */\ + rbp_f_depth = 0; \ + if (a_node != NULL) { \ + if ((a_tree)->rbt_root != &(a_tree)->rbt_nil) { \ + rbp_f_path[rbp_f_depth] = (a_tree)->rbt_root; \ + rbp_f_depth++; \ + rbp_f_node = rbp_f_path[0]; \ + while (true) { \ + int rbp_f_cmp = (a_cmp)((a_node), \ + rbp_f_path[rbp_f_depth-1]); \ + if (rbp_f_cmp < 0) { \ + rbp_f_node = rbp_left_get(a_type, a_field, \ + rbp_f_path[rbp_f_depth-1]); \ + } else if (rbp_f_cmp > 0) { \ + rbp_f_node = rbp_right_get(a_type, a_field, \ + rbp_f_path[rbp_f_depth-1]); \ + } else { \ + break; \ + } \ + assert(rbp_f_node != &(a_tree)->rbt_nil); \ + rbp_f_path[rbp_f_depth] = rbp_f_node; \ + rbp_f_depth++; \ + } \ + } \ + } \ + rbp_f_synced = true; + +#define rb_foreach_end(a_type, a_field, a_tree, a_var) \ + if (rbp_f_synced) { \ + rbp_f_synced = false; \ + continue; \ + } \ + /* Find the successor. */\ + if ((rbp_f_node = rbp_right_get(a_type, a_field, \ + rbp_f_path[rbp_f_depth-1])) != &(a_tree)->rbt_nil) { \ + /* The successor is the left-most node in the right */\ + /* subtree. */\ + rbp_f_path[rbp_f_depth] = rbp_f_node; \ + rbp_f_depth++; \ + while ((rbp_f_node = rbp_left_get(a_type, a_field, \ + rbp_f_path[rbp_f_depth-1])) != &(a_tree)->rbt_nil) { \ + rbp_f_path[rbp_f_depth] = rbp_f_node; \ + rbp_f_depth++; \ + } \ + } else { \ + /* The successor is above the current node. Unwind */\ + /* until a left-leaning edge is removed from the */\ + /* path, or the path is empty. */\ + for (rbp_f_depth--; rbp_f_depth > 0; rbp_f_depth--) { \ + if (rbp_left_get(a_type, a_field, \ + rbp_f_path[rbp_f_depth-1]) \ + == rbp_f_path[rbp_f_depth]) { \ + break; \ + } \ + } \ + } \ + } \ + } \ +} + +#define rb_foreach_reverse_begin(a_type, a_field, a_tree, a_var) { \ + /* Compute the maximum possible tree depth (3X the black height). */\ + unsigned rbp_fr_height; \ + rbp_black_height(a_type, a_field, a_tree, rbp_fr_height); \ + rbp_fr_height *= 3; \ + { \ + /* Initialize the path to contain the right spine. */\ + a_type *rbp_fr_path[rbp_fr_height]; \ + a_type *rbp_fr_node; \ + bool rbp_fr_synced = false; \ + unsigned rbp_fr_depth = 0; \ + if ((a_tree)->rbt_root != &(a_tree)->rbt_nil) { \ + rbp_fr_path[rbp_fr_depth] = (a_tree)->rbt_root; \ + rbp_fr_depth++; \ + while ((rbp_fr_node = rbp_right_get(a_type, a_field, \ + rbp_fr_path[rbp_fr_depth-1])) != &(a_tree)->rbt_nil) { \ + rbp_fr_path[rbp_fr_depth] = rbp_fr_node; \ + rbp_fr_depth++; \ + } \ + } \ + /* While the path is non-empty, iterate. */\ + while (rbp_fr_depth > 0) { \ + (a_var) = rbp_fr_path[rbp_fr_depth-1]; + +/* Only use if modifying the tree during iteration. */ +#define rb_foreach_reverse_prev(a_type, a_field, a_cmp, a_tree, a_node) \ + /* Re-initialize the path to contain the path to a_node. */\ + rbp_fr_depth = 0; \ + if (a_node != NULL) { \ + if ((a_tree)->rbt_root != &(a_tree)->rbt_nil) { \ + rbp_fr_path[rbp_fr_depth] = (a_tree)->rbt_root; \ + rbp_fr_depth++; \ + rbp_fr_node = rbp_fr_path[0]; \ + while (true) { \ + int rbp_fr_cmp = (a_cmp)((a_node), \ + rbp_fr_path[rbp_fr_depth-1]); \ + if (rbp_fr_cmp < 0) { \ + rbp_fr_node = rbp_left_get(a_type, a_field, \ + rbp_fr_path[rbp_fr_depth-1]); \ + } else if (rbp_fr_cmp > 0) { \ + rbp_fr_node = rbp_right_get(a_type, a_field,\ + rbp_fr_path[rbp_fr_depth-1]); \ + } else { \ + break; \ + } \ + assert(rbp_fr_node != &(a_tree)->rbt_nil); \ + rbp_fr_path[rbp_fr_depth] = rbp_fr_node; \ + rbp_fr_depth++; \ + } \ + } \ + } \ + rbp_fr_synced = true; + +#define rb_foreach_reverse_end(a_type, a_field, a_tree, a_var) \ + if (rbp_fr_synced) { \ + rbp_fr_synced = false; \ + continue; \ + } \ + if (rbp_fr_depth == 0) { \ + /* rb_foreach_reverse_sync() was called with a NULL */\ + /* a_node. */\ + break; \ + } \ + /* Find the predecessor. */\ + if ((rbp_fr_node = rbp_left_get(a_type, a_field, \ + rbp_fr_path[rbp_fr_depth-1])) != &(a_tree)->rbt_nil) { \ + /* The predecessor is the right-most node in the left */\ + /* subtree. */\ + rbp_fr_path[rbp_fr_depth] = rbp_fr_node; \ + rbp_fr_depth++; \ + while ((rbp_fr_node = rbp_right_get(a_type, a_field, \ + rbp_fr_path[rbp_fr_depth-1])) != &(a_tree)->rbt_nil) {\ + rbp_fr_path[rbp_fr_depth] = rbp_fr_node; \ + rbp_fr_depth++; \ + } \ + } else { \ + /* The predecessor is above the current node. Unwind */\ + /* until a right-leaning edge is removed from the */\ + /* path, or the path is empty. */\ + for (rbp_fr_depth--; rbp_fr_depth > 0; rbp_fr_depth--) {\ + if (rbp_right_get(a_type, a_field, \ + rbp_fr_path[rbp_fr_depth-1]) \ + == rbp_fr_path[rbp_fr_depth]) { \ + break; \ + } \ + } \ + } \ + } \ + } \ +} + +#endif /* RB_H_ */ diff --git a/src/util/jemalloc/version b/src/util/jemalloc/version new file mode 100644 index 0000000000000..d32f09466c39b --- /dev/null +++ b/src/util/jemalloc/version @@ -0,0 +1 @@ +20090627 diff --git a/src/util/job_queue.h b/src/util/job_queue.h new file mode 100644 index 0000000000000..dbc235221aa1d --- /dev/null +++ b/src/util/job_queue.h @@ -0,0 +1,296 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __CONCURRENCY_JOB_QUEUE_H__ +#define __CONCURRENCY_JOB_QUEUE_H__ + +#include "async_func.h" +#include +#include "synchronizable.h" +#include "lock.h" +#include "atomic.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * A queue-based multi-threaded job processing facility. Internally, we have a + * queue of jobs and a list of workers, each of which runs in its own thread. + * Job queue can take new jobs on the fly and workers will continue to pull + * jobs off the queue and work on it. + * + * To use it, simply define your own job and worker class like this, + * + * class MyJob { + * public: + * // storing job data + * }; + * + * class MyWorker : public JobQueueWorker { + * public: + * virtual void doJob(MyJob *job) { + * // process the job + * delete job; // if it was new-ed + * } + * }; + * + * Now, use JobQueueDispatcher to start the whole thing, + * + * JobQueueDispatcher dispatcher(40); // 40 threads + * dispatcher.start(); + * ... + * dispatcher.enqueue(new MyJob(...)); + * ... + * dispatcher.stop(); + * + * Note this class is different from JobListDispatcher that uses a vector to + * store prepared jobs. With JobQueueDispatcher, job queue is normally empty + * initially and new jobs are pushed into the queue over time. Also, workers + * can be stopped individually. + */ + +/////////////////////////////////////////////////////////////////////////////// + +/** + * A job queue that's suitable for multiple threads to work on. + */ +template +class JobQueue : public Synchronizable { +public: + // trial class for signaling queue stop + class StopSignal {}; + +public: + /** + * Constructor. + */ + JobQueue() : m_stopped(false), m_workerCount(0) { + } + + /** + * Put a job into the queue and notify a worker to pick it up. + */ + void enqueue(TJob job) { + Lock lock(getMutex()); + m_jobs.push_back(job); + notify(); + } + + /** + * Grab a job from the queue for processing. Since the job was not created + * by this queue class, it's up to a worker class on whether to deallocate + * the job object correctly. + */ + TJob dequeue() { + Lock lock(getMutex()); + while (m_jobs.empty()) { + if (m_stopped) { + throw StopSignal(); + } + wait(); + } + TJob job = m_jobs.front(); + m_jobs.pop_front(); + return job; + } + + /** + * Purely for making sure no new jobs are queued when we are stopping. + */ + void stop() { + Lock lock(getMutex()); + m_stopped = true; + notifyAll(); // so all waiting threads can find out queue is stopped + } + + /** + * Keeps track of how many active workers are working on the queue. + */ + void incActiveWorker() { + atomic_inc(m_workerCount); + } + void decActiveWorker() { + atomic_dec(m_workerCount); + } + int getActiveWorker() { + return m_workerCount; + } + + private: + std::deque m_jobs; + bool m_stopped; + int m_workerCount; +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Base class for a customized worker. + */ +template +class JobQueueWorker { +public: + /** + * Default constructor. + */ + JobQueueWorker() : m_opaque(NULL), m_queue(NULL), m_stopped(false) { + } + + virtual ~JobQueueWorker() { + } + + /** + * Two-phase object creation for easier derivation and for JobQueueDispatcher + * to easily create a vector of workers. + */ + void create(int id, JobQueue *queue, void *opaque) { + ASSERT(queue); + m_id = id; + m_queue = queue; + m_opaque = opaque; + } + + /** + * The only functions a subclass needs to implement. + */ + virtual void doJob(TJob job) = 0; + virtual void onThreadEnter() {} + virtual void onThreadExit() {} + + /** + * Start this worker thread. + */ + void start() { + ASSERT(m_queue); + onThreadEnter(); + while (!m_stopped) { + try { + TJob job = m_queue->dequeue(); + if (countActive) m_queue->incActiveWorker(); + doJob(job); + if (countActive) m_queue->decActiveWorker(); + } catch (typename JobQueue::StopSignal) { + m_stopped = true; // queue is empty and queue is stopped, so we are done + } + } + onThreadExit(); + } + + /** + * Stop this worker thread. + */ + void stop() { + m_stopped = true; + } + +protected: + int m_id; + void *m_opaque; + +private: + + JobQueue *m_queue; + bool m_stopped; +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Driver class to push through the whole thing. + */ +template +class JobQueueDispatcher { +public: + /** + * Constructor. + */ + JobQueueDispatcher(int threadCount, void *opaque) : m_stopped(true) { + ASSERT(threadCount >= 1); + m_workers.resize(threadCount); + m_funcs.resize(threadCount); + for (int i = 0; i < threadCount; i++) { + TWorker &worker = m_workers[i]; + worker.create(i, &m_queue, opaque); + m_funcs[i] = new AsyncFunc(&worker, &TWorker::start); + } + } + + ~JobQueueDispatcher() { + stop(); + for (unsigned int i = 0; i < m_funcs.size(); i++) { + delete m_funcs[i]; + } + } + + std::vector &getWorkers() { + return m_workers; + } + int getActiveWorker() { + return m_queue.getActiveWorker(); + } + + /** + * Creates worker threads and start running them. This is non-blocking. + */ + void start() { + for (unsigned int i = 0; i < m_funcs.size(); i++) { + m_funcs[i]->start(); + } + m_stopped = false; + } + + /** + * Enqueue a new job. + */ + void enqueue(TJob job) { + m_queue.enqueue(job); + } + + /** + * Stop all workers after all jobs are processed. No new jobs should be + * enqueued at this moment, or this call may block for longer time. + */ + void stop() { + if (m_stopped) return; + m_stopped = true; + + m_queue.stop(); + bool exceptioned = false; + std::exception exception; + for (unsigned int i = 0; i < m_funcs.size(); i++) { + try { + m_funcs[i]->waitForEnd(); + } catch (std::exception &e) { + exceptioned = true; // glitch, we are not handling 1+ exceptions + exception = e; + } + } + if (exceptioned) { + throw exception; + } + } + +private: + bool m_stopped; + JobQueue m_queue; + std::vector m_workers; + std::vector *> m_funcs; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __CONCURRENCY_JOB_QUEUE_H__ diff --git a/src/util/json.cpp b/src/util/json.cpp new file mode 100644 index 0000000000000..2f74adc3a4583 --- /dev/null +++ b/src/util/json.cpp @@ -0,0 +1,87 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "json.h" + +using namespace std; + +namespace HPHP { namespace JSON { +/////////////////////////////////////////////////////////////////////////////// +// statics + +string Escape(const char *s) { + string ret; + for (const char *p = s; *p; p++) { + switch (*p) { + case '\r': ret += "\\r"; break; + case '\n': ret += "\\n"; break; + case '\t': ret += "\\t"; break; + case '/': ret += "\\/"; break; + case '\"': ret += "\\\""; break; + case '\\': ret += "\\\\"; break; + default: ret += *p; break; + } + } + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// +// Name + +Name::Name(const char *name) { + ASSERT(name && *name); + m_name = name; +} + +Name::Name(const std::string &name) { + ASSERT(!name.empty()); + m_name = name; +} + +void Name::serialize(OutputStream &out) const { + out.raw() << "\"" << m_name << "\":"; +} + +/////////////////////////////////////////////////////////////////////////////// +// OutputStream + +OutputStream &OutputStream::operator<< (int v) { + m_out << v; + return *this; +} + +OutputStream &OutputStream::operator<< (const char *v) { + m_out << "\"" << Escape(v) << "\""; + return *this; +} + +OutputStream &OutputStream::operator<< (const std::string &v) { + m_out << "\"" << Escape(v.c_str()) << "\""; + return *this; +} + +OutputStream &OutputStream::operator<< (const Name &v) { + v.serialize(*this); + return *this; +} + +OutputStream &OutputStream::operator<< (const ISerializable &v) { + v.serialize(*this); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +}} diff --git a/src/util/json.h b/src/util/json.h new file mode 100644 index 0000000000000..58dc62d7ded74 --- /dev/null +++ b/src/util/json.h @@ -0,0 +1,198 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_JSON_H__ +#define __HPHP_JSON_H__ + +#include "base.h" + +namespace HPHP { namespace JSON { +/////////////////////////////////////////////////////////////////////////////// + +class OutputStream; +class MapStream; + +std::string Escape(const char *s); + +class ISerializable { +public: + virtual ~ISerializable() {} + + /** + * Generate JSON output of this data structure. + */ + virtual void serialize(OutputStream &out) const = 0; +}; + +class Name : public ISerializable { +public: + Name(const char *name); + Name(const std::string &name); + + // implement ISerializable + virtual void serialize(OutputStream &out) const; + +private: + std::string m_name; +}; + +class OutputStream { +public: + OutputStream(std::ostream &out) : m_out(out) {} + + OutputStream &operator<< (int v); + OutputStream &operator<< (const char *v); + OutputStream &operator<< (const std::string &v); + OutputStream &operator<< (const Name &v); + OutputStream &operator<< (const ISerializable &v); + + template + OutputStream &operator<< (const boost::shared_ptr &v); + + template + OutputStream &operator<< (const std::vector &v); + template + OutputStream &operator<< (const std::set &v); + template + OutputStream &operator<< (const std::map &v); + + template + OutputStream &operator<< (const __gnu_cxx::hash_map &v); + + std::ostream &raw() { return m_out;} + +private: + std::ostream &m_out; +}; + +template + OutputStream &OutputStream::operator<< (const boost::shared_ptr &v) { + if (v) { + *this << *v; + } else { + m_out << "null"; + } + return *this; +} + +template + OutputStream &OutputStream::operator<< (const std::vector &v) { + m_out << "["; + for (unsigned int i = 0; i < v.size(); i++) { + if (i > 0) m_out << ','; + *this << v[i]; + } + m_out << "]"; + return *this; +} + +template + OutputStream &OutputStream::operator<< (const std::set &v) { + m_out << "["; + bool first = true; + BOOST_FOREACH(T el, v) { + if (first) { + first = false; + } else { + m_out << ','; + } + *this << el; + } + m_out << "]"; + return *this; +} + +template + OutputStream &OutputStream::operator<< (const std::map &v) { + m_out << "{"; + for (typename std::map::const_iterator iter = v.begin(); + iter != v.end(); ++iter) { + if (iter != v.begin()) m_out << ','; + *this << Name(iter->first); + *this << iter->second; + } + m_out << "}\n"; + return *this; +} + +template + OutputStream &OutputStream::operator<< + (const __gnu_cxx::hash_map &v) { + m_out << "{"; + for (typename __gnu_cxx::hash_map::const_iterator + iter = v.begin(); iter != v.end(); ++iter) { + if (iter != v.begin()) m_out << ','; + *this << Name(iter->first); + *this << iter->second; + } + m_out << "}\n"; + return *this; +} + +class MapStream { +public: + MapStream(OutputStream &jout) + : m_out(jout.raw()), m_jout(jout), m_first(true) {} + /* + MapStream &add(const std::string &n, int v); + MapStream &add(const std::string &n, const char *v); + MapStream &add(const std::string &n, const std::string &v); + MapStream &add(const std::string &n, const ISerializable &v); + + template + MapStream &add(const std::string &n, const std::map &v); + + template + MapStream &add(const std::string &n, const std::vector &v); + */ + + template + MapStream &add(const std::string &n, T v); + + void done() { + if (m_first) { + m_out << "{"; + } + m_out << "}\n"; + } + +private: + std::ostream &m_out; + OutputStream &m_jout; + bool m_first; + + void init(const std::string &n) { + if (m_first) { + m_out << "{"; + m_first = false; + } else { + m_out << ","; + } + m_jout << Name(n); + } +}; + +template + MapStream &MapStream::add(const std::string &n, T v) { + init(n); + m_jout << v; + return *this; +} + +/////////////////////////////////////////////////////////////////////////////// +}} + +#endif // __HPHP_JSON_H__ diff --git a/src/util/lfu_table.h b/src/util/lfu_table.h new file mode 100644 index 0000000000000..41cd5a70e4c7a --- /dev/null +++ b/src/util/lfu_table.h @@ -0,0 +1,633 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_UTIL_LFU_TABLE_H__ +#define __HPHP_UTIL_LFU_TABLE_H__ + +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +template +class LFUNullDestructor { +public: + void operator()(const K &k, V &v) {} +}; + +/** + * A lookup table with a maximum size. Once it reaches maximum size, + * inserts will evict the least frequently used item. + * + * It consists of 3 parts: a queue, a heap, and a map. + * The map is used for lookup by key. The queue is a staging area for + * values that are too new to have an accurate frequency, and the heap + * serves as a priority queue for looking up the element that has + * the lowest frequency. + * + * Frequencies are updated only when the hit count hits a multiple of the + * period option. When a frequency is updated, the heap is also updated + * to maintain the heap property. Frequency should be locked by the queue + * lock since it must not change during heap operations. + * + * There are two locks that make it thread safe. There is read/write lock + * for the map, and a lock for the queue/heap. The acquisition order + * is map then queue/heap. + * + * An element is in the map if it is in the queue xor the heap. + * If max capacity is 0, then all queue operations are disabled. + * Elements can be added to the map but not the queue. + */ +template > +class LFUTable { +public: + class LFUTableIterator { + public: + LFUTableIterator(typename LFUTable::Map::iterator &it) : m_it(it) {} + LFUTableIterator(const LFUTableIterator &it) : m_it(it.m_it) {} + const K &first() const { + return m_it->first; + } + V &second() const { + return m_it->second->val; + } + LFUTableIterator &operator++() { + ++m_it; + return *this; + } + bool operator==(const LFUTableIterator &it) const { + return m_it == it.m_it; + } + bool operator!=(const LFUTableIterator &it) const { + return m_it != it.m_it; + } + private: + friend class LFUTable::LFUTableConstIterator; + friend class LFUTable; + typename LFUTable::Map::iterator m_it; + }; + class LFUTableConstIterator { + public: + LFUTableConstIterator(typename LFUTable::Map::const_iterator &it) + : m_it(it) {} + LFUTableConstIterator(const LFUTableConstIterator &it) : m_it(it.m_it) { + } + LFUTableConstIterator(const LFUTableIterator &it) : m_it(it.m_it) { + } + const K &first() const { + return m_it->first; + } + const V &second() const { + return m_it->second->val; + } + LFUTableConstIterator &operator++() { + ++m_it; + return *this; + } + bool operator==(const LFUTableConstIterator &it) const { + return m_it == it.m_it; + } + bool operator!=(const LFUTableConstIterator &it) const { + return m_it != it.m_it; + } + private: + friend class LFUTable; + typename LFUTable::Map::const_iterator m_it; + }; + /** + * AtomicReader is used to perform a lookup under the internal + * lock of the table. It takes the read lock. + */ + class AtomicReader { + public: + virtual ~AtomicReader() {} + virtual void read(const K &key, const V &val) = 0; + }; + /** + * AtomicUpdater is used to perform a update/insert under the internal + * lock of the table. It takes the write lock. + * The update method is given a reference to the value in the table and + * a bool that specifies if the element was newly added. + * It the method returns false, the element is deleted. + */ + class AtomicUpdater { + public: + virtual ~AtomicUpdater() {} + virtual bool update(const K &key, V &val, bool newlyCreated) = 0; + }; + +public: + LFUTable(time_t maturity, size_t maxCap, int updatePeriod) + : m_head(NULL), m_tail(NULL), m_immortalCount(0), + m_maturityThreshold(maturity), m_maximumCapacity(maxCap), + m_updatePeriod(updatePeriod) {} + ~LFUTable() { + clear(); + } + + typedef LFUTableConstIterator const_iterator; + typedef LFUTableIterator iterator; + + const_iterator begin() const { + return const_iterator(m_map.begin()); + } + const_iterator end() const { + return const_iterator(m_map.end()); + } + iterator begin() { + typename Map::iterator it = m_map.begin(); + return iterator(it); + } + iterator end() { + typename Map::iterator it = m_map.end(); + return iterator(it); + } + + void insert(const K &k, const V &v) { + WriteLock lock(m_mapLock); + if (_contains(k)) { + _erase(k); + } + _makeRoom(); + // Add to the map + typename Map::iterator ins = m_map.insert(std::pair(k,NULL)) + .first; + Node *n = new Node(ins->first, v); + ins->second = n; + // Add to queue + insertQueue(n); + } + + bool atomicRead(const K &k, AtomicReader &reader) { + ReadLock lock(m_mapLock); + Node *n = _getNode(k, false); + if (n) { + reader.read(n->key, n->val); + return true; + } + return false; + } + + void atomicForeach(AtomicReader &reader) { + ReadLock lock(m_mapLock); + for (typename Map::const_iterator it = m_map.begin(); + it != m_map.end(); ++it) { + reader.read(it->first, it->second->val); + } + } + + void atomicUpdate(const K &k, AtomicUpdater &updater, bool createNew, + bool immortal = false) { + WriteLock lock(m_mapLock); + bool erase = false; + Node *n = _getNode(k, false); + bool created = false; + if (!n && createNew) { + n = _createNode(k, immortal); + created = true; + } + if (n) { + erase = updater.update(n->key, n->val, created); + } + if (erase) { + _erase(k); + } + } + + void erase(const K &k) { + WriteLock lock(m_mapLock); + _erase(k); + } + void erase(const iterator &it) { + WriteLock lock(m_mapLock); + _erase(it); + } + + bool lookup(const K &k, V &result) { + ReadLock lock(m_mapLock); + Node *n = _getNode(k, false); + if (n) { + result = n->val; + return true; + } + return false; + } + iterator find(const K &k) { + ReadLock lock(m_mapLock); + typename Map::iterator it = m_map.find(k); + if (it != m_map.end()) { + Node *n = it->second; + _bumpNode(n); + } + return iterator(it); + } + V &operator[](const K &k) { + WriteLock lock(m_mapLock); + return _getNode(k, true)->val; + } + + size_t size() const { + return m_map.size(); + } + size_t maximumCapacity() const { + return m_maximumCapacity; + } + size_t immortalCount() const { + return m_immortalCount; + } + + void clear() { + WriteLock lock(m_mapLock); + typename Map::iterator it = m_map.begin(); + while (it != m_map.end()) { + typename Map::iterator cit = it++; + Node *n = cit->second; + if (n->immortal) { + // Trade immortal for mortal + ++m_maximumCapacity; + --m_immortalCount; + } else { + removeQueue(cit->second); + } + m_map.erase(cit); + delete n; + } + ASSERT(m_head == NULL); + ASSERT(m_tail == NULL); + ASSERT(m_heap.size() == 0); + } + + bool check() { + WriteLock lock(m_mapLock); + Lock qlock(m_queueLock); + + bool fail = false; + Node *prev = NULL; + Node *n = m_head; + while (n) { + if (m_map.find(n->key) == m_map.end()) { + fail = true; + Logger::Error("Value in queue not in map"); + ASSERT(!fail); + } + if (n->prev != prev) { + fail = true; + Logger::Error("Queue list corrupted"); + ASSERT(!fail); + } + prev = n; + n = n->next; + if (!n && prev != m_tail) { + fail = true; + Logger::Error("Queue tail incorrect"); + ASSERT(!fail); + } + } + uint hsize = m_heap.size(); + for (uint i = 0; i < hsize; i++) { + Node *n = m_heap[i]; + if (m_map.find(n->key) == m_map.end()) { + fail = true; + Logger::Error("Value in queue not in heap"); + ASSERT(!fail); + } + size_t child = (i+1) * 2; + if (child <= hsize && n->frequency() > m_heap[child-1]->frequency()) { + fail = true; + Logger::Error("Heap property violated"); + ASSERT(!fail); + } + child++; + if (child <= hsize && n->frequency() > m_heap[child-1]->frequency()) { + fail = true; + Logger::Error("Heap property violated"); + ASSERT(!fail); + } + } + return !fail; + } + +private: + class Node { + public: + Node(const K &k) : key(k), prev(NULL), next(NULL), hits(0), heapIndex(0), + immortal(false), m_freq(0), m_timestamp(time(NULL)) {} + Node(const K &k, const V &v) + : key(k), val(v), prev(NULL), next(NULL), hits(0), heapIndex(0), + immortal(false), m_freq(0), m_timestamp(time(NULL)) {} + ~Node() { + D d; + d(key, val); + } + const K &key; + V val; + Node *prev; + Node *next; + uint64 hits; + uint heapIndex; + bool immortal; + + + // Frequency updates must be accompanied by heap updates since otherwise + // it may break the heap property. It should probably be under lock too. + bool updateFrequency() { + double lifetime = time(NULL) - m_timestamp; + double oldFreq = m_freq; + if (lifetime > 0) { + m_freq = hits / lifetime; + } + return m_freq > oldFreq; + } + double frequency() const { + return m_freq; + } + time_t timestamp() { + return m_timestamp; + } + private: + double m_freq; + time_t m_timestamp; + }; + +private: + ////////////////////////////////////////////////////////////////////////////// + // These methods are to be used when the map lock is already acquired. + bool _contains(const K &k) { + return m_map.find(k) != m_map.end(); + } + void _erase(const K &k) { + typename Map::iterator it = m_map.find(k); + if (it != m_map.end()) { + _erase(it); + } + } + void _erase(const iterator &it) { + Node *n = it.m_it->second; + m_map.erase(it.m_it); + if (n->immortal) { + // We trade an immortal for a mortal value + --m_immortalCount; + ++m_maximumCapacity; + } else { + removeQueue(n); + } + delete n; + } + + void _bumpNode(Node *n) { + if (!m_maximumCapacity) return; + if ((atomic_add(n->hits, (uint64)1) + 1) % m_updatePeriod == 0) { + Lock lock(m_queueLock); + // hits could have increased between incrementing and taking the lock, + // but it does not matter. + // It is also possible (if unlikely) that two threads could be trying to + // do this update, but that doesn't matter either. + bool increase = n->updateFrequency(); + _updateQueue(n, increase); + } + } + void _makeRoom() { + if (!m_maximumCapacity) return; + while (size() - m_immortalCount >= m_maximumCapacity) { + Node *m = popQueue(); + ASSERT(m); + m_map.erase(m->key); + delete m; + } + } + Node *_getNode(const K &k, bool force, bool immortal = false) { + typename Map::iterator it = m_map.find(k); + if (it != m_map.end()) { + _bumpNode(it->second); + return it->second; + } + if (force) { + return _createNode(k, immortal); + } else { + return NULL; + } + } + + Node *_createNode(const K &k, bool immortal = false) { + if (immortal) { + ++m_immortalCount; + } else { + _makeRoom(); + } + // Add to the map + typename Map::iterator ins = m_map.insert(std::pair(k,NULL)) + .first; + Node *n = new Node(ins->first); + ins->second = n; + n->immortal = immortal; + if (!immortal) { + // Add to queue + insertQueue(n); + } + return n; + } + + void _dumpStatus() { + std::cout << "in map:\n"; + for (typename Map::const_iterator it = m_map.begin(); it != m_map.end(); + ++it) { + std::cout << it->first << " : " << it->second->frequency() << "\n"; + } + if (!m_maximumCapacity) return; + std::cout << "in queue:\n"; + Node *n = m_head; + while (n) { + std::cout << n->key << " : " << n->frequency() << "\n"; + n = n->next; + } + std::cout << "in heap\n"; + for (uint i = 0; i < m_heap.size(); i++) { + std::cout << m_heap[i]->key << " : " << m_heap[i]->frequency() << "\n"; + } + } + +private: + ////////////////////////////////////////////////////////////////////////////// + // Queue interface methods + + // Add item to queue + void insertQueue(Node *item) { + if (!m_maximumCapacity) return; + Lock lock(m_queueLock); + // Add to head of list + item->heapIndex = 0; + item->prev = NULL; + item->next = m_head; + if (m_head) m_head->prev = item; + m_head = item; + if (!m_tail) m_tail = item; + _shiftMature(); + } + + void removeQueue(Node *item) { + if (!m_maximumCapacity) return; + Lock lock(m_queueLock); + if (item == m_head) { + m_head = item->next; + } + if (item == m_tail) { + m_tail = item->prev; + } + if (item->prev) { + item->prev->next = item->next; + } + if (item->next) { + item->next->prev = item->prev; + } + item->prev = item->next = NULL; + if (item->heapIndex != 0) { + int pos = item->heapIndex; + int last = m_heap.size(); + item->heapIndex = 0; + m_heap[pos-1] = m_heap[last-1]; + m_heap[pos-1]->heapIndex = pos; + m_heap.pop_back(); + _heapifyDown(pos); + } + } + // Pop the minimum + Node *popQueue() { + if (!m_maximumCapacity) return NULL; + Lock lock(m_queueLock); + _shiftMature(); + if (m_heap.size() == 0) { + Node *res = m_tail; + if (!res) return NULL; + if (res->prev) { + res->prev->next = NULL; + } + m_tail = res->prev; + res->prev = NULL; + if (res == m_head) m_head = NULL; + return res; + } + Node *res = m_heap[0]; + res->heapIndex = 0; + m_heap[0] = m_heap[m_heap.size() - 1]; + m_heap[0]->heapIndex = 1; + m_heap.pop_back(); + _heapifyDown(1); + return res; + } + + ////////////////////////////////////////////////////////////////////////////// + // Queue helper methods + + void _shiftMature() { + // Move mature items to heap + time_t now = time(NULL); + while (m_tail && ((now - m_tail->timestamp()) >= m_maturityThreshold)) { + Node *last = m_tail; + if (last->prev) { + last->prev->next = NULL; + } + m_tail = last->prev; + if (m_head == last) m_head = NULL; + last->prev = NULL; + last->updateFrequency(); + _heapInsert(last); + } + } + + void _updateQueue(const Node *item, bool increase) { + if (!m_maximumCapacity) return; + if (item->heapIndex != 0) { + if (increase) { + _heapifyDown(item->heapIndex); + } else { + _heapifyUp(item->heapIndex); + } + } + } + + void _heapInsert(Node *item) { + m_heap.push_back(item); + item->heapIndex = m_heap.size(); + int pos = m_heap.size(); + _heapifyUp(pos); + } + + void _heapifyUp(int pos) { + while (pos != 1) { + Node *&child = m_heap[pos - 1]; + Node *&parent = m_heap[pos/2 - 1]; + if (parent->frequency() > child->frequency()) { + swap(child, parent); + child->heapIndex = pos; + parent->heapIndex = pos/2; + pos = pos/2; + } else { + break; + } + } + } + + void _heapifyDown(int pos) { + int size = m_heap.size(); + for (;;) { + int child; + if (pos * 2 > size) break; + if (pos * 2 + 1 > size || (m_heap[pos*2 - 1]->frequency() < + m_heap[pos*2]->frequency())) { + child = pos * 2; + } else { + child = pos * 2 + 1; + } + if (m_heap[pos - 1]->frequency() > m_heap[child - 1]->frequency()) { + swap(m_heap[pos - 1], m_heap[child - 1]); + m_heap[pos - 1]->heapIndex = pos; + m_heap[child - 1]->heapIndex = child; + pos = child; + } else { + break; + } + } + } + +private: + // The queue. A doubly linked list since I need to remove elements at will. + Node *m_head; + Node *m_tail; + // The heap + std::vector m_heap; + // The map + typedef hphp_hash_map Map; + //typedef std::map Map; + Map m_map; + size_t m_immortalCount; + + // Locks in acquisition order + ReadWriteMutex m_mapLock; + Mutex m_queueLock; + + // Options + time_t m_maturityThreshold; + size_t m_maximumCapacity; + int m_updatePeriod; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_UTIL_LFU_TABLE_H__ diff --git a/src/util/lock.cpp b/src/util/lock.cpp new file mode 100644 index 0000000000000..6fc35e836243d --- /dev/null +++ b/src/util/lock.cpp @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "lock.h" +#include "stack_trace.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +LockProfiler::PFUNC_PROFILE LockProfiler::s_pfunc_profile = NULL; +bool LockProfiler::s_profile = false; +int LockProfiler::s_profile_sampling = 1000; + +LockProfiler::LockProfiler(bool profile) : m_profiling(false) { + if (s_profile && s_pfunc_profile && profile && + s_profile_sampling && (rand() % s_profile_sampling) == 0) { + m_profiling = true; + clock_gettime(CLOCK_MONOTONIC, &m_lockTime); + } +} + +LockProfiler::~LockProfiler() { + if (m_profiling) { + timespec unlockTime; + unlockTime.tv_sec = 0; + unlockTime.tv_nsec = 0; + clock_gettime(CLOCK_MONOTONIC, &unlockTime); + time_t dsec = unlockTime.tv_sec - m_lockTime.tv_sec; + long dnsec = unlockTime.tv_nsec - m_lockTime.tv_nsec; + int64 dusec = dsec * 1000000 + dnsec / 1000; + + StackTrace st; + s_pfunc_profile(st.hexEncode(3, 9), dusec); + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/lock.h b/src/util/lock.h new file mode 100644 index 0000000000000..62058ce601c2e --- /dev/null +++ b/src/util/lock.h @@ -0,0 +1,112 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __LOCK_H__ +#define __LOCK_H__ + +#include "mutex.h" +#include "synchronizable.h" +#include "logger.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Lock instrumentation for mutex stats. + */ +class LockProfiler { +public: + typedef void (*PFUNC_PROFILE)(const std::string &stack, int64 elapsed_us); + static PFUNC_PROFILE s_pfunc_profile; + static bool s_profile; + static int s_profile_sampling; + + LockProfiler(bool profile); + ~LockProfiler(); + +private: + bool m_profiling; + timespec m_lockTime; +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Just a helper class that automatically unlocks a mutex when it goes out of + * scope. + * + * { + * Lock lock(mutex); + * // inside lock + * } // unlock here + */ +class Lock { +public: + Lock(Mutex &mutex, bool profile = true) + : m_profiler(profile), m_mutex(mutex) { + m_mutex.lock(); + } + Lock(Synchronizable *obj, bool profile = true) + : m_profiler(profile), m_mutex(obj->getMutex()) { + m_mutex.lock(); + } + ~Lock() { + m_mutex.unlock(); + } + +private: + LockProfiler m_profiler; + Mutex &m_mutex; +}; + +/////////////////////////////////////////////////////////////////////////////// + +class ReadLock { +public: + ReadLock(ReadWriteMutex &mutex, bool profile = true) + : m_profiler(profile), m_mutex(mutex) { + m_mutex.acquireRead(); + } + + ~ReadLock() { + m_mutex.release(); + } + +private: + LockProfiler m_profiler; + ReadWriteMutex &m_mutex; +}; + +class WriteLock { +public: + WriteLock(ReadWriteMutex &mutex, bool profile = true) + : m_profiler(profile), m_mutex(mutex) { + m_mutex.acquireWrite(); + } + + ~WriteLock() { + m_mutex.release(); + } + +private: + LockProfiler m_profiler; + ReadWriteMutex &m_mutex; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __LOCK_H__ diff --git a/src/util/log_aggregator.cpp b/src/util/log_aggregator.cpp new file mode 100644 index 0000000000000..c9712c6f9f5e0 --- /dev/null +++ b/src/util/log_aggregator.cpp @@ -0,0 +1,175 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "log_aggregator.h" +#include "process.h" +#include "db_query.h" +#include "stack_trace.h" +#include "exception.h" + +using namespace std; + +namespace HPHP { + +int LogAggregator::MaxSampleItem = 100; +int LogAggregator::MaxSampleItemPerHost = 10; +int LogAggregator::HashStackSize = 7; +LogAggregator LogAggregator::TheLogAggregator; + +/////////////////////////////////////////////////////////////////////////////// + +LogAggregator::LogAggregator() : m_groups(NULL) { + m_host = Process::GetHostName(); + m_process = Process::GetProcessId(); + m_groups = new StringToGroupPtrMap(); +} + +void LogAggregator::setCodeRevision(const char *revision) { + m_revision = revision ? revision : ""; +} + +/////////////////////////////////////////////////////////////////////////////// + +void LogAggregator::log(const StackTrace &st, const std::string &message) { + const int MY_STACK_DEPTH = 4; + std::string hash = st.hexEncode(MY_STACK_DEPTH, + MY_STACK_DEPTH + HashStackSize); + + Lock lock(m_mutex); + GroupPtr &group = (*m_groups)[hash]; + if (!group) { + group = GroupPtr(new Group()); + } + group->m_count++; + + if ((int)group->m_items.size() < MaxSampleItemPerHost) { + Item *item = new Item(); + item->occurred = time(NULL); + item->thread = Process::GetThreadId(); + item->stack = st.hexEncode(MY_STACK_DEPTH + HashStackSize); + item->message = message; + group->m_items.push_back(item); + } +} + +void LogAggregator::flush(std::ostream &out) { + StringToGroupPtrMap *groups = m_groups; + { + Lock lock(m_mutex); + if (m_groups->empty()) return; + m_groups = new StringToGroupPtrMap(); + } + + struct tm now; + time_t tnow = time(NULL); + localtime_r(&tnow, &now); + char snow[64]; + strftime(snow, sizeof(snow), "%D %T", &now); + + out << "========================================================\n"; + out << "Revision: " << m_revision << "\n"; + out << "Host: " << m_host << "\n"; + out << "Process: " << m_process << "\n"; + out << "Aggregated at " << snow << "\n"; + out << "========================================================\n"; + + for (StringToGroupPtrMap::const_iterator iter = groups->begin(); + iter != groups->end(); ++iter) { + const string &hash = iter->first; + GroupPtr group = iter->second; + + out << "Stack " << hash << " occurred " << group->m_count << " time(s):\n"; + for (unsigned int i = 0; i < group->m_items.size(); i++) { + Item *item = group->m_items[i]; + out << " [" << item->thread << "] [" << item->stack << "] " + << item->message << "\n"; + } + out << "--------------------------------------------------------\n"; + } + + out << "\n"; + delete groups; +} + +/////////////////////////////////////////////////////////////////////////////// +// MySQL error storage + +/** + * Schema: Only two tables are needed: + + create table log_group (revision varchar(255) not null, hash varchar(255) not null, count int not null, translated text not null, primary key (revision, hash)); + create table log_item (revision varchar(255) not null, hash varchar(255) not null, item int not null, host varchar(255) not null, process bigint not null, occurred bigint not null, thread bigint not null, stack text not null, message text not null, translated text not null, primary key (revision, hash, item)); + + */ +void LogAggregator::flush(ServerDataPtr server) { + StringToGroupPtrMap *groups = m_groups; + { + Lock lock(m_mutex); + if (m_groups->empty()) return; + m_groups = new StringToGroupPtrMap(); + } + + try { + DBConn conn; + conn.open(server); + + // update groups + DBQueryPtr qGroup + (new DBQuery(&conn, "INSERT INTO log_group (revision, hash, count)")); + for (StringToGroupPtrMap::const_iterator iter = groups->begin(); + iter != groups->end(); ++iter) { + const string &hash = iter->first; + GroupPtr group = iter->second; + qGroup->insert("'%s', '%s', %d", m_revision.c_str(), hash.c_str(), + group->m_count); + + DBQueryPtr q + (new DBQuery(&conn, "INSERT INTO log_item" + " (revision, hash, item," + " host, process, occurred, thread, stack, message)")); + for (unsigned int i = 0; i < group->m_items.size(); i++) { + Item *item = group->m_items[i]; + int index = rand() % MaxSampleItem; + q->insert("'%s','%s',%d,'%s',%p,%p,%p,'%s','%s'", + m_revision.c_str(), hash.c_str(), index, m_host.c_str(), + (long)m_process, (long)item->occurred, (long)item->thread, + item->stack.c_str(), item->message.c_str()); + } + q->append(" ON DUPLICATE KEY UPDATE " + " host = VALUES(host)," + " process = VALUES(process)," + " occurred = VALUES(occurred)," + " thread = VALUES(thread)," + " stack = VALUES(stack)," + " message = VALUES(message)"); + q->execute(); + } + qGroup->append(" ON DUPLICATE KEY UPDATE count = count + VALUES(count)"); + qGroup->execute(); + + } catch (Exception e) { + Logger::Error("unable to upload errors: %s", e.getMessage().c_str()); + } catch (...) { + Logger::Error("unable to upload errors: (unknown error)"); + } + + // we have to dump errors even if we were not able to upload them, because + // we don't want to hold them in memory for very long time + delete groups; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/log_aggregator.h b/src/util/log_aggregator.h new file mode 100644 index 0000000000000..8876f65afab7b --- /dev/null +++ b/src/util/log_aggregator.h @@ -0,0 +1,80 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __LOG_AGGREGATOR_H__ +#define __LOG_AGGREGATOR_H__ + +#include "base.h" +#include "lock.h" +#include "db_conn.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * An in-memory log aggregator that prints summaries than individual lines of + * logs. + */ +class StackTrace; +class LogAggregator { +public: + static int MaxSampleItem; + static int MaxSampleItemPerHost; + static int HashStackSize; + static LogAggregator TheLogAggregator; + +public: + LogAggregator(); + void setCodeRevision(const char *revision); + + void log(const StackTrace &st, const std::string &message); + + void flush(std::ostream &out); + void flush(ServerDataPtr server); + +private: + Mutex m_mutex; + std::string m_revision; + std::string m_host; + pid_t m_process; + + struct Item { + time_t occurred; + pthread_t thread; + std::string stack; + std::string message; + }; + + DECLARE_BOOST_TYPES(Group); + class Group { + public: + Group() : m_count(0) { + } + ~Group() { + for (unsigned int i = 0; i < m_items.size(); i++) delete m_items[i]; + } + + int m_count; + std::vector m_items; // samples + }; + + StringToGroupPtrMap *m_groups; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __LOG_AGGREGATOR_H__ diff --git a/src/util/logger.cpp b/src/util/logger.cpp new file mode 100644 index 0000000000000..c26dcab8b4779 --- /dev/null +++ b/src/util/logger.cpp @@ -0,0 +1,194 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "logger.h" +#include "base.h" +#include "stack_trace.h" +#include "process.h" +#include "exception.h" +#include "log_aggregator.h" +#include + +using namespace std; + +#define IMPLEMENT_LOGLEVEL(LOGLEVEL) \ + void Logger::LOGLEVEL(const char *fmt, ...) { \ + if (LogLevel < Log ## LOGLEVEL) return; \ + if (g_context->isSilenced()) return; \ + va_list ap; va_start(ap, fmt); Log(fmt, ap); va_end(ap); \ + } \ + void Logger::LOGLEVEL(const std::string &msg) { \ + if (LogLevel < Log ## LOGLEVEL) return; \ + if (g_context->isSilenced()) return; \ + Log(msg, NULL); \ + } \ + +namespace HPHP { + +IMPLEMENT_LOGLEVEL(Error); +IMPLEMENT_LOGLEVEL(Warning); +IMPLEMENT_LOGLEVEL(Info); +IMPLEMENT_LOGLEVEL(Verbose); + +/////////////////////////////////////////////////////////////////////////////// + +bool Logger::UseLogAggregator = false; +bool Logger::UseLogFile = true; +FILE *Logger::Output = NULL; +Logger::LogLevelType Logger::LogLevel = LogInfo; +bool Logger::LogHeader = false; +std::string Logger::ExtraHeader; +int Logger::MaxMessagesPerRequest = -1; +ThreadLocal Logger::s_threadData; + +void Logger::VSNPrintf(std::string &msg, const char *fmt, va_list ap) { + int i = 0; + for (int len = 1024; msg.empty(); len <<= 1) { + va_list v; + va_copy(v, ap); + + char *buf = (char*)malloc(len); + if (vsnprintf(buf, len, fmt, v) < len) { + msg = buf; + } + free(buf); + + va_end(v); + if (++i > 10) break; + } +} + +void Logger::Log(const char *fmt, va_list ap) { + if (!UseLogAggregator && !UseLogFile) return; + + string msg; + VSNPrintf(msg, fmt, ap); + Log(msg, NULL); +} + +void Logger::Log(const char *type, const Exception &e) { + if (g_context->isSilenced()) return; + if (!UseLogAggregator && !UseLogFile) return; + + std::string msg = type; + msg += e.getMessage(); + Log(msg, &e.getStackTrace()); +} + +void Logger::OnNewRequest() { + ThreadData *threadData = s_threadData.get(); + ++threadData->request; + threadData->message = 0; +} + +void Logger::Log(const std::string &msg, const StackTrace *stackTrace) { + ThreadData *threadData = s_threadData.get(); + if (++threadData->message > MaxMessagesPerRequest && + MaxMessagesPerRequest >= 0) { + return; + } + + boost::shared_ptr deleter; + if (stackTrace == NULL) { + deleter = boost::shared_ptr(new StackTrace()); + stackTrace = deleter.get(); + } + + if (UseLogAggregator) { + LogAggregator::TheLogAggregator.log(*stackTrace, msg); + } + if (UseLogFile) { + FILE *f = Output ? Output : stdout; + + string header, sheader; + if (LogHeader) { + header = GetHeader(); + sheader = header + " [" + stackTrace->hexEncode(5) + "] "; + } + char *escaped = EscapeString(msg); + fprintf(f, "%s%s\n", sheader.c_str(), escaped); + FILE *tf = threadData->log; + if (tf) { + fprintf(tf, "%s%s\n", header.c_str(), escaped); + fflush(tf); + } + free(escaped); + + fflush(f); + } +} + +std::string Logger::GetHeader() { + static std::string host = Process::GetHostName(); + static pid_t pid = Process::GetProcessId(); + + struct tm now; + time_t tnow = time(NULL); + localtime_r(&tnow, &now); + char snow[64]; + strftime(snow, sizeof(snow), "%D %T", &now); + + char header[128]; + ThreadData *threadData = s_threadData.get(); + snprintf(header, sizeof(header), "[%s:%lld:%llx:%d:%d:%s%s]", host.c_str(), + (unsigned long long)pid, + (unsigned long long)Process::GetThreadId(), + threadData->request, threadData->message, + snow, ExtraHeader.c_str()); + return header; +} + +char *Logger::EscapeString(const std::string &msg) { + char *new_str = (char *)malloc((msg.size() << 2) + 1); + const char *source; + const char *end; + char *target; + for (source = msg.c_str(), end = source + msg.size(), target = new_str; + source < end; source++) { + char c = *source; + if ((unsigned char) c < 32 || (unsigned char) c > 126) { + *target++ = '\\'; + switch (c) { + case '\n': *target++ = 'n'; break; + case '\t': *target++ = 't'; break; + case '\r': *target++ = 'r'; break; + case '\a': *target++ = 'a'; break; + case '\v': *target++ = 'v'; break; + case '\b': *target++ = 'b'; break; + case '\f': *target++ = 'f'; break; + default: target += sprintf(target, "x%02X", (unsigned char)c); + } + } else { + *target++ = c; + } + } + *target = 0; + return new_str; +} + +bool Logger::SetThreadLog(const char *file) { + return (s_threadData->log = fopen(file, "a")) != NULL; +} +void Logger::ClearThreadLog() { + ThreadData *threadData = s_threadData.get(); + if (threadData->log) { + fclose(threadData->log); + } + threadData->log = NULL; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/logger.h b/src/util/logger.h new file mode 100644 index 0000000000000..62b65653dfd23 --- /dev/null +++ b/src/util/logger.h @@ -0,0 +1,93 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +#include +#include +#include "thread_local.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +class StackTrace; +class Exception; +class Logger { +public: + enum LogLevelType { + LogNone, + LogError, + LogWarning, + LogInfo, + LogVerbose, + }; + + static bool UseLogAggregator; + static bool UseLogFile; + static FILE *Output; + + static LogLevelType LogLevel; + + static bool LogHeader; + static std::string ExtraHeader; + static int MaxMessagesPerRequest; + + static void Error(const std::string &msg); + static void Warning(const std::string &msg); + static void Info(const std::string &msg); + static void Verbose(const std::string &msg); + + static void Error(const char *fmt, ...); + static void Warning(const char *fmt, ...); + static void Info(const char *fmt, ...); + static void Verbose(const char *fmt, ...); + + static void Log(const char *type, const Exception &e); + + static void VSNPrintf(std::string &msg, const char *fmt, va_list ap); + + static void OnNewRequest(); + + static bool SetThreadLog(const char *file); + static void ClearThreadLog(); + +private: + class ThreadData { + public: + ThreadData() : request(0), message(0), log(NULL) {} + int request; + int message; + FILE *log; + }; + static ThreadLocal s_threadData; + + static void Log(const char *fmt, va_list ap); + static void Log(const std::string &msg, const StackTrace *stackTrace); + + /** + * What needs to be print for each line of logging. Currently it's + * [machine:thread:datetime]. + */ + static std::string GetHeader(); + + static char *EscapeString(const std::string &msg); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __LOGGER_H__ diff --git a/src/util/mcproxy/client.cpp b/src/util/mcproxy/client.cpp new file mode 100644 index 0000000000000..9d3339ebeb84c --- /dev/null +++ b/src/util/mcproxy/client.cpp @@ -0,0 +1,823 @@ + +#include "proxy.h" +#include "server.h" +#include "stats.h" +#include "cluster.h" +#include "qio.h" +#include "qlio.h" +#include "gfuncs.h" + +#define MISSING_ARG "CLIENT_ERROR Missing argument" +#define INTERNAL_ERROR "SERVER_ERROR Internal error" +#define CANNOT_SEND "SERVER_ERROR Can't send request to backing server" +#define KEY_TOO_LONG "CLIENT_ERROR key too long" +#define DEFERRED_SEND "NOT_FOUND" + +#define NEXT_TOKEN() strtok(NULL, " \t\r\n") + +#define MAX_KEY_LENGTH 250 /* Maximum allowed length of a key */ +#define KEYS_AT_A_TIME 10 /* Typical maximum size of a multi-get */ + +#define LAST_ACTION_UNSET 2147483647 + +typedef struct _CLIENT CLIENT; +struct _CLIENT { + int fd; + + /* + * Set to true if we have generated a response to the request that + * is currently being parsed. (Gets reset on each new incoming request.) + */ + int responded; + + /* + * The following are used to store the initial parameters from the + * set/replace/add commands while waiting for binary data. + */ + int set_type; + char *key; + int flags; + int bytes; + uint32_t exptime; + + /* + * Lists of requests we've sent out to the server but haven't + * gotten responses for yet. This is in order of receipt from the + * client. + */ + REQUEST_LIST *requests; +}; + +/* + * CLIENT->set_type is one of these values if we're waiting for binary data + * for a data-setting command. + */ +#define SET_TYPE_SET 1 +#define SET_TYPE_ADD 2 +#define SET_TYPE_REPLACE 3 + +int last_action = LAST_ACTION_UNSET; // will be rest +int parent_pipe_fd = -1; +int async_deletes = 0; + +static void cmd_done(REQUEST *req, void *arg); + + +/* + * Write a response string out to the client. + */ +static void send_response(CLIENT *client, char *str) +{ + int length = strlen(str); + qio_enable_immediate(client->fd, 0); + qio_write(client->fd, str, length); + qio_write(client->fd, "\r\n", 2); + qio_enable_immediate(client->fd, 1); + client->responded++; + stats_add_bytes_written(length + 2); + HPHP::Logger::Verbose("%d -> %s", client->fd, str); +} + +/* + * Queue a response to send to the client. If there are no other requests + * outstanding, send it immediately. + */ +static void respond(CLIENT *client, char *str) +{ + if (! client->responded) + { + REQUEST *req = request_new_error_marker(cmd_done, str, client); + request_list_add(client->requests, req); + if (request_list_peek(client->requests) == req) + { + cmd_done(req, client); + } + + client->responded++; + } +} + +/* + * Check if a set of keys is from a status request. + * Just check first key, we treat entire request + * as status. + */ + +static int check_status_key(const char **keys, uint32_t nkeys) +{ + static const int status_key_prefix_len = sizeof(STATUS_KEY_PREFIX) - 1; + + if (nkeys == 0) + return 0; + + return strncmp(keys[0], STATUS_KEY_PREFIX, status_key_prefix_len) == 0; +} + +/* + * Respond to a get with status data. Fill in the get data and + * add it to the pending list, and call cmd_done. + */ +static void respond_status_get(CLIENT *client, const char **keys, uint32_t nkeys) +{ + REQUEST *req; + + req = request_new_status_get(keys, nkeys); + + request_list_add(client->requests, req); + if (request_list_peek(client->requests) == req) + { + cmd_done(req, client); + } +} + +/* + * Write an "internal error" response to the client. + */ +static void internal_error(CLIENT *client) +{ + stats_add_bytes_written(strlen(INTERNAL_ERROR)); + respond(client, INTERNAL_ERROR); +} + + +/* + * Handle a server response. Since the client may pipeline requests to us and + * the memcached protocol doesn't provide any means of matching requests with + * responses, we will only send back responses in the order that the requests + * were received. If we get a response for a request that's not the first one + * in the list, we sit on it until we get a response to the first request. + */ +static void +cmd_done(REQUEST *req, void *arg) +{ + CLIENT *client = (CLIENT *) arg; + REQUEST *head; + REQUEST_STATUS status; + REQUEST_TYPE type; + + last_action = time(NULL); + + if (req != NULL) + { + type = request_get_type(req); + + /* If the client is gone, we're done. */ + if (request_is_client_closed(req)) + { + request_free(req); + return; + } + } + + while ((head = request_list_peek(client->requests)) != NULL && + (status = request_get_status(head)) != Pending) + { + if (status != PartialResult) + request_list_next(client->requests); + + type = request_get_type(head); + if (type == Get && status == FinalResult) + { + void *data = request_get_data(head); + if (data != NULL) + { + qio_write(client->fd, data, + request_get_total(head)); + stats_add_bytes_written(request_get_total(head)); + + if (!strncmp("VALUE", (char *) data, 5)) + { + stats_incr_get_hits(); + } + } + } + else if (type == FlushAll) + { + char *resp = request_get_response(head); + if (strcmp(resp, "OK")) + { + HPHP::Logger::Error("Got %s from flush_all", resp); + send_response(client, resp); + } + // Otherwise wait for the marker + } + else if (type == Quit) + { + request_free(head); + qio_close(client->fd); + return; + } + else + { + send_response(client, request_get_response(head)); + client->responded = 0; + } + + if (status != PartialResult) + request_free(head); + } +} + + +/* + * Pulls all the keys out of the request, and figures out which server + * each one belongs to. Orders the keys by server. + */ +static void +pull_keys_from_get_request(char *line, const char ***keys, MEMCACHED ***servers, + uint32_t *nkeys) +{ + MEMCACHED *mcd; + const char *key; + int i; + + *nkeys = 0; + *servers = NULL; + *keys = NULL; + + while ((key = NEXT_TOKEN()) != NULL) + { + mcd = server_for_key_uponly(key, cluster_id()); + + /* Allocate more space for keys */ + if ((*nkeys % KEYS_AT_A_TIME) == 0) + { + *keys = (const char**)grealloc(*keys, sizeof(char *) * + (*nkeys + KEYS_AT_A_TIME)); + *servers = (MEMCACHED **)grealloc(*servers, sizeof(MEMCACHED *) * + (*nkeys + KEYS_AT_A_TIME)); + } + + for (i = *nkeys; i > 0; i--) + { + if (mcd < (*servers)[i - 1]) + break; + (*servers)[i] = (*servers)[i - 1]; + (*keys)[i] = (*keys)[i - 1]; + } + + (*servers)[i] = mcd; + (*keys)[i] = key; + + (*nkeys)++; + } +} + + +/* + * Creates a group of "get" requests for a list of keys and servers. + * Modifies the server list so that the n-th entry in the request list + * is sent to the n-th entry in the server list. + */ +static REQUEST_LIST * +create_get_requests(MEMCACHED **servers, const char **keys, uint32_t nkeys, + CLIENT *client) +{ + int i; + int first_key = 0; + int cur_server = 0; + REQUEST_LIST *list = request_list_new(); + + if (servers == NULL) + return NULL; + + for (i = 0; i < (int)nkeys; i++) + { + if (servers[i] != servers[first_key]) + { + request_list_add(list, request_new_get(keys + first_key, + i - first_key, cmd_done, client)); + servers[cur_server++] = servers[first_key]; + first_key = i; + } + } + + request_list_add(list, request_new_get(keys + first_key, + nkeys - first_key, cmd_done, client)); + servers[cur_server++] = servers[first_key]; + + return list; +} + + +/* + * Handle the "get" command. + */ +static void cmd_get(char *line, CLIENT *client) +{ + MEMCACHED **servers = NULL; + const char **keys = NULL; + uint32_t nkeys = 0; + REQUEST_LIST *requests; + REQUEST *req; + int server_num = 0; + + pull_keys_from_get_request(line, &keys, &servers, &nkeys); + /* + * Wait to flush all data to client until all keys have been processed. + * Otherwise TCP could delay the final END out. + */ + qio_enable_immediate(client->fd, 0); + if (check_status_key(keys, nkeys)) + { + respond_status_get(client, keys, nkeys); + + gfree(servers); + gfree(keys); + } + else if ((requests = create_get_requests(servers, keys, nkeys, client)) != NULL) + { + /* + * Cycle through the list of requests, sending each one out. + * If we get a failure sending a request, just ignore it; it will + * be treated as a cache miss by the application, no harm done. + */ + while ((req = request_list_next(requests)) != NULL) + if (server_do_request(servers[server_num++], req) == 0) + { + request_list_add(client->requests, req); + } + else + { + HPHP::Logger::Verbose("discarding 'get' request after send failure"); + request_free(req); + } + + gfree(servers); + gfree(keys); + request_list_free(requests); + + } + + /* + * Add a dummy request that will cause us to send the "END" response + * to the client once all the servers have responded. + */ + request_list_add(client->requests, + request_new_get_marker(cmd_done, client)); + + /* + * If we didn't actually send any requests (e.g. because there was + * only one key and we got an error asking for it) send the "END" + * right away. + */ + cmd_done(NULL, client); + qio_enable_immediate(client->fd, 1); +} + +/* + * Gets a mandatory token, spitting an error message out to the client + * if the token isn't present. + */ +static char *get_token(CLIENT *client) +{ + char *token = NEXT_TOKEN(); + if (token == NULL && ! client->responded) + respond(client, MISSING_ARG); + + return token; +} + + +/* + * Sends a request which might be deferred + * - send_now -- should we attempt to send the command before falling back to async + * - replicate -- replicate this request? + * - reliable -- should the request be retried. Applies both to replication and to the request itself + */ +static void send_deferrable(REQUEST *req, CLIENT *client, char *key, int send_now, int replicate, int reliable) +{ + int cluster = cluster_id(); + MEMCACHED *mcd = server_for_key_uponly(key, cluster); + + int send_error = 1; + + if (send_now) + { + send_error = server_do_request(mcd, req); + } + + if (! send_error) + { + /* + * Set quickack after sending data so the kernel doesn't + * think we're an interactive connection and immediately + * turn it off again. + */ + server_set_quickack(mcd); + request_list_add(client->requests, req); + } else if (reliable || ! send_now) + { + /* do an async send if either 1) this is a reliable request and we failed + * or 2) we didn't send the request at all + */ + + server_do_request_async(server_for_key(key, cluster), req, reliable); + respond(client, DEFERRED_SEND); + } else + { + respond(client, CANNOT_SEND); + } + + if (replicate) + { + cluster_replicate(req, reliable); + } + + + if (send_error) + { + request_free(req); + } +} + +/* + * Handle the "delete" command. + */ +static void cmd_delete(char *line, CLIENT *client) +{ + char *key = get_token(client); + char *timer = NEXT_TOKEN(); + REQUEST *req; + + if (key == NULL) + return; + if (timer == NULL) + timer = "0"; + + req = request_new_delete(key, atoi(timer), cmd_done, client); + stats_incr_cmddelete_count(); + send_deferrable(req, client, key, ! async_deletes, 1 /* replicate */, 1 /* reliable */); +} + +/* + * Do initial parsing and setup for the data-setting commands. + */ +static void setup_set(char *line, CLIENT *client, int set_type) +{ + char *key = get_token(client); + char *flags = get_token(client); + char *exptime = get_token(client); + char *bytes = get_token(client); + + if (client->responded) /* get_token spat out an error */ + return; + + if (gstrlen(key) > MAX_KEY_LENGTH) + { + respond(client, KEY_TOO_LONG); + + /* + * We could eat the value here, but memcached doesn't, so + * emulate its behavior. This means we may be interpreting + * the value as commands. + */ + return; + } + + client->set_type = set_type; + client->exptime = atoi(exptime); + client->flags = atoi(flags); + client->key = gstrdup(key); + client->bytes = atoi(bytes); + + stats_incr_cmdset_count(); + + /* Slurp up the binary data plus the \r\n at the end. */ + qlio_expect_binary(client->fd, client->bytes + 2); +} + +/* + * Binary data for a set/replace/add command has arrived. Process it. + */ +static void do_set(CLIENT *client, char *data) +{ + REQUEST *req = NULL; + int replicate = client->flags & FLAG_REPLICATE; + + /* + * Strip off the flag in case we're talking to a remote mcproxy; + * otherwise we will potentially get into infinite replication loops. + */ + client->flags &= ~FLAG_REPLICATE; + + data = (char*)gmemdup_const(data, client->bytes); + + switch (client->set_type) + { + case SET_TYPE_SET: + req = request_new_set(client->key, data, client->bytes, + client->exptime, client->flags, + cmd_done, client); + break; + + case SET_TYPE_ADD: + req = request_new_add(client->key, data, client->bytes, + client->exptime, client->flags, + cmd_done, client); + break; + + case SET_TYPE_REPLACE: + req = request_new_replace(client->key, data, client->bytes, + client->exptime, client->flags, + cmd_done, client); + break; + + default: + HPHP::Logger::Error("Bad state! Set type is %d", client->set_type); + internal_error(client); + break; + } + + if (req != NULL) + { + /* + * Sets are replicated unreliably, since the data + * volume is potentially too high to be able to fit + * many of them in the async store. + * + * NOTE: Don't just change the "0" to a "1" if you + * want to make set replication reliable! The async + * data store code will probably need to be changed + * to more cleanly support large request sizes, + * since it currently assumes requests are + * relatively small. + */ + int can_defer = client->set_type == SET_TYPE_SET && (client->flags & FLAG_ASYNC_SET); + + send_deferrable(req, client, client->key, !can_defer, replicate, 0 /* not reliable */); + } + + + gfree(client->key); + client->key = NULL; +} + + +/* + * Handle the "set" command. + */ +static void cmd_set(char *line, CLIENT *client) +{ + setup_set(line, client, SET_TYPE_SET); +} + +/* + * Handle the "replace" command. + */ +static void cmd_replace(char *line, CLIENT *client) +{ + setup_set(line, client, SET_TYPE_REPLACE); +} + +/* + * Handle the "add" command. + */ +static void cmd_add(char *line, CLIENT *client) +{ + setup_set(line, client, SET_TYPE_ADD); +} + +/* + * Handle the "incr" command. + */ +static void cmd_incr(char *line, CLIENT *client) +{ + REQUEST *req; + char *key = get_token(client); + char *value = get_token(client); + int amount; + + if (key == NULL || value == NULL) + return; + + amount = atoi(value); + + req = request_new_incr(key, amount, cmd_done, client); + send_deferrable(req, client, key, ! async_deletes, 1 /* replicate */, 1 /* reliable */); +} + +/* + * Handle the "decr" command. + */ +static void cmd_decr(char *line, CLIENT *client) +{ + REQUEST *req; + char *key = get_token(client); + char *value = get_token(client); + int amount; + + if (key == NULL || value == NULL) + return; + + amount = atoi(value); + + req = request_new_decr(key, amount, cmd_done, client); + send_deferrable(req, client, key, ! async_deletes, 1 /* replicate */, 1 /* reliable */); +} + +/* + * Handle the "stats" command. + */ +static void cmd_stats(char *line, CLIENT *client) +{ + stats_dump(client->fd); +} + +/* + * Handle the "which_server" command. + */ +static void cmd_which_server(char *line, CLIENT *client) +{ + char *key = get_token(client); + MEMCACHED *mcd = server_for_key(key, cluster_id()); + respond(client, server_get_description(mcd)); +} + +/* + * Handle the "flush_all" command. + */ +static void cmd_flush_all(char *line, CLIENT *client) +{ + char *timer_tok = NEXT_TOKEN(); + int timer = (timer_tok == NULL) ? 0 : atoi(timer_tok); + MEMCACHED *mcd; + REQUEST *req; + int i; + + for (i = 0; (mcd = server_number(i)) != NULL; i++) + { + req = request_new_flush_all(timer, cmd_done, client); + if (server_do_request(mcd, req) == 0) + request_list_add(client->requests, req); + else + { + respond(client, CANNOT_SEND); + request_free(req); + } + } + + request_list_add(client->requests, + request_new_flush_marker(cmd_done, client)); +} + +/* + * Handle the "quit" command. + */ +static void cmd_quit(char *line, CLIENT *client) +{ + request_list_add(client->requests, + request_new_quit(cmd_done, client)); + cmd_done(NULL, client); +} + +/* + * Handle the "version" command. + */ +static void cmd_version(char *line, CLIENT *client) +{ + respond(client, "VERSION 1.0.2 (proxy)"); +} + + +struct Command { + char *cmd; + int len; + void (*func)(char *, CLIENT *); +} commands[] = { + {"get", 3, cmd_get}, + {"set", 3, cmd_set}, + {"add", 3, cmd_add}, + {"replace", 7, cmd_replace}, + {"delete", 6, cmd_delete}, + {"incr", 4, cmd_incr}, + {"decr", 4, cmd_decr}, + {"stats", 5, cmd_stats}, + {"flush_all", 9, cmd_flush_all}, + {"version", 7, cmd_version}, + {"which_server", 12, cmd_which_server}, + {"quit", 4, cmd_quit} +}; + +/* + * New input has arrived from a client. + */ +void handle_input(int fd, char *line, void *args) +{ + CLIENT *client = (CLIENT *)args; + int i; + + last_action = time(NULL); + if (client->set_type > 0) + { + HPHP::Logger::Verbose("binary input from %d", fd); + do_set(client, line); + client->set_type = 0; + } + else + { + HPHP::Logger::Verbose("input from %d: %s", fd, line); + if (line == NULL) + return; + + if (! strncmp(line, "terminate", 9)) + { + if (parent_pipe_fd > -1) + write(parent_pipe_fd, "q", 1); + throw HPHP::Exception("exit with %d", 0); + } + +#ifdef FIND_LEAKS + if (! strncmp(line, "leaks", 5)) + { + GC_gcollect(); + } +#endif + + stats_add_bytes_read(strlen(line)); + strtok(line, " \r\n\t"); + for (i = 0; i < (int)(sizeof(commands) / sizeof(commands[0])); i++) + if (! strcmp(line, commands[i].cmd)) + { + client->responded = 0; + (commands[i].func)(line, client); + return; + } + + respond(client, "ERROR"); + cmd_done(NULL, client); + } +} + +/* + * A client connection has closed. Free up any resources allocated to it. + */ +void handle_close(int fd, int code, char *line, void *args) +{ + CLIENT *client = (CLIENT *)args; + REQUEST *req; + + HPHP::Logger::Verbose("client fd %d closed, line %s", fd, line); + + /* + * Make sure we don't try to reply to any of the client's pending + * requests when the server answers. + */ + while ((req = request_list_next(client->requests)) != NULL) + request_client_closed(req); + + if (client->key != NULL) + gfree(client->key); + request_list_free(client->requests); + gfree(client); + + stats_incr_closed_client_connections(); +#ifdef FIND_LEAKS + CHECK_LEAKS(); +#endif +} + + +/* + * A new connection request is coming in on the listen socket. Accept it + * and listen for requests on the newly connected socket. + */ +void handle_connection(int fd, void *args) +{ + CLIENT *client; + int new_fd; + + new_fd = accept(fd, NULL, NULL); + if (new_fd < 0) + { + HPHP::Logger::Error("Can't accept connection"); + stats_incr_failed_client_connections(); + return; + } + + HPHP::Logger::Verbose("New connection on fd %d", new_fd); + client = (CLIENT*)gcalloc(sizeof(CLIENT)); + if (client == NULL) + { + HPHP::Logger::Error("Can't allocate client descriptor"); + close(new_fd); + stats_incr_failed_client_connections(); + return; + } + + client->requests = request_list_new(); + client->fd = new_fd; + if (set_nodelay(new_fd, 1)) + HPHP::Logger::Error("Can't set socket to NODELAY"); + stats_incr_successful_client_connections(); + qlio_add(new_fd, handle_input, handle_close, client); +} + +/* + * Adds the connection listen handler. + */ +void +client_add_handler(int fd) +{ + qio_add(fd, handle_connection, NULL, NULL); +} diff --git a/src/util/mcproxy/cluster.cpp b/src/util/mcproxy/cluster.cpp new file mode 100644 index 0000000000000..3ace1742899af --- /dev/null +++ b/src/util/mcproxy/cluster.cpp @@ -0,0 +1,235 @@ + +#include "proxy.h" +#include "gfuncs.h" +#include "cluster.h" +#include "server.h" +#include "../network.h" + +static int local_cluster = -1; +static int num_clusters = 0; + +/* + * Each cluster contains one or more networks, each of which is defined by a + * network number and netmask. We use that to determine which cluster a + * particular host is part of. + */ +typedef struct _cluster CLUSTER; +struct _cluster { + int id; + in_addr_t *networks; + in_addr_t *netmasks; + int num_networks; + CLUSTER *next; +}; + +static CLUSTER *clusters = NULL; + +/* + * Determines the ID of the local cluster. + */ +int +cluster_determine_id(void) +{ + struct in_addr addr; + + /* The user might have specified a cluster ID manually. */ + if (local_cluster > -1) + return 0; + + if (determine_local_address(&addr)) { + HPHP::Logger::Error("Can't determine local address"); + return -1; + } + + local_cluster = cluster_find_id(&addr.s_addr); + if (local_cluster < 0) { + std::string local_addr = HPHP::Util::safe_inet_ntoa(addr); + HPHP::Logger::Error("Local network address %s doesn't match any clusters", + local_addr.c_str()); + return -1; + } + + return 0; +} + +/* + * Returns the local cluster ID. + */ +int cluster_id(void) +{ + return local_cluster; +} + +/* + * Explicitly sets the local cluster ID. + */ +void cluster_set_id(int id) +{ + local_cluster = id; +} + +/* + * Applies a netmask to a network address. + */ +static void +apply_netmask(const in_addr_t * const address, + const in_addr_t * const mask, + in_addr_t * const result) +{ + const unsigned char *address_c = (unsigned char *) address; + const unsigned char *mask_c = (unsigned char *) mask; + unsigned char *result_c = (unsigned char *) result; + int i; + + for (i = 0; i < (int)sizeof(in_addr_t); i++) + *result_c++ = *address_c++ & *mask_c++; +} + +/* + * Adds a new cluster to the cluster list. + */ +void +cluster_add(int id, in_addr_t *network, in_addr_t *netmask) +{ + CLUSTER *cluster; + int cluster_id; + + /* Make sure we don't have any duplicate entries */ + if ((cluster_id = cluster_find_id(network)) >= 0) + { + HPHP::Logger::Error("Duplicate network address in clusters %d and %d, " + "ignoring in cluster %d", cluster_id, id, id); + return; + } + + for (cluster = clusters; cluster != NULL; cluster = cluster->next) + if (cluster->id == id) + break; + if (cluster == NULL) + { + cluster = (CLUSTER*)gmalloc(sizeof(CLUSTER)); + cluster->id = id; + cluster->networks = (in_addr_t*)gmalloc(sizeof(in_addr_t)); + cluster->netmasks = (in_addr_t*)gmalloc(sizeof(in_addr_t)); + cluster->num_networks = 0; + + cluster->next = clusters; + clusters = cluster; + + num_clusters++; + } + else + { + cluster->networks = (in_addr_t*)grealloc(cluster->networks, + (cluster->num_networks + 1) * sizeof(in_addr_t)); + cluster->netmasks = (in_addr_t*)grealloc(cluster->netmasks, + (cluster->num_networks + 1) * sizeof(in_addr_t)); + } + + memcpy(cluster->netmasks + cluster->num_networks, netmask, + sizeof(in_addr_t)); + apply_netmask(network, netmask, + cluster->networks + cluster->num_networks); + cluster->num_networks++; +} + +/* + * Finds a cluster that matches a network address. + * + * Returns: Cluster ID or -1 if not found + */ +int +cluster_find_id(in_addr_t *addr) +{ + CLUSTER *cur; + int i; + + for (cur = clusters; cur != NULL; cur = cur->next) + { + for (i = 0; i < cur->num_networks; i++) + { + in_addr_t masked_addr; + + apply_netmask(addr, &cur->netmasks[i], &masked_addr); + if (! memcmp(&masked_addr, &cur->networks[i], + sizeof(cur->networks[0]))) + return cur->id; + } + } + + return -1; +} + +/* + * Replicates a request across all the remote clusters, skipping any + * servers that we have already sent the request to (including, possibly, + * the server in the local cluster.) Optionally queue the request for + * later delivery if it needs to be (semi-)reliable. + */ +void +cluster_replicate(REQUEST *req, int reliable) +{ + MEMCACHED **servers; + int nservers = 0; + CLUSTER *clust; + char *key = request_get_first_key(req); + + if (num_clusters == 0 || key == NULL) + return; + + servers = (MEMCACHED **)gmalloc(sizeof(MEMCACHED *) * num_clusters); + if (local_cluster != -1) { + servers[0] = server_for_key(key, local_cluster); + nservers ++; + } + + for (clust = clusters; clust != NULL; clust = clust->next) + { + int i; + MEMCACHED *server = server_for_key(key, clust->id); + + if (! server_is_real(server)) + continue; + + /* Have we already sent to this server? */ + for (i = 0; i < nservers; i++) + if (server_is_same(server, servers[i])) + break; + if (i == nservers) + { + /* Nope. Send request and add this server to the list */ + server_do_request_async(server, req, reliable); + + if (nservers >= num_clusters) + { + HPHP::Logger::Error("Number of servers exceeds number of " + "clusters -- bug!"); + break; + } + servers[nservers++] = server; + } + } + + free(servers); +} + +/* + * Clears the list of clusters. + */ +void +cluster_clear() +{ + CLUSTER *next; + + while (clusters != NULL) + { + next = clusters->next; + gfree(clusters->networks); + gfree(clusters->netmasks); + gfree(clusters); + clusters = next; + } + + local_cluster = -1; + num_clusters = 0; +} diff --git a/src/util/mcproxy/cluster.h b/src/util/mcproxy/cluster.h new file mode 100644 index 0000000000000..1c3afdfce4829 --- /dev/null +++ b/src/util/mcproxy/cluster.h @@ -0,0 +1,17 @@ +#ifndef CLUSTER_H_ +#define CLUSTER_H_ + +#include "include.h" +#include "request.h" + +typedef void (*CLUSTER_FUNC)(int, void *); + +int cluster_determine_id(void); +void cluster_set_id(int id); +int cluster_id(void); +void cluster_add(int id, in_addr_t *network, in_addr_t *netmask); +int cluster_find_id(in_addr_t *addr); +void cluster_replicate(REQUEST *req, int reliable); +void cluster_clear(void); + +#endif /*CLUSTER_H_*/ diff --git a/src/util/mcproxy/crc32.h b/src/util/mcproxy/crc32.h new file mode 100644 index 0000000000000..63d96bd9583e4 --- /dev/null +++ b/src/util/mcproxy/crc32.h @@ -0,0 +1,135 @@ +#if !defined(_facebook_crc32_h_) +#define _facebook_crc32_h_ 1 + +/* The crc32 functions and data was originally written by Spencer + * Garrett and was cleaned from the PostgreSQL source + * tree via the files contrib/ltree/crc32.[ch]. No license was + * included, therefore it is assumed that this code is public + * domain. Attribution still noted. */ + +static const uint32_t crc32tab[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, +}; + + +/** Compute CRC */ + +static inline uint32_t crc32(const char* data, const size_t ndata) { + uint32_t result; + size_t ix; + + result = ~0; + for (ix = 0; ix < ndata; ix++) { + result = (result >> 8) ^ crc32tab[(result ^ data[ix]) & 0xff]; + } + + //result = (~result >> 16) & 0x7fff; + return (~result); +} + +/** Compute CRC for a valid memcache key. If the |#| delimiter appears in the + key, compute CRC only on the prefix before the leftmost occurence of that + delimiter in the string. If key contains any spaces or control characters, + return 0 to indicate a bogus key. Otherwise return 1 to indicate success + and store result in crc. */ + +static inline int crc32_key(const char* data, const size_t ndata, uint32_t* crc) { + uint32_t result; + size_t ix; + size_t nillegals = 0; + + result = ~0; + for (ix = 0; ix < ndata; ix++) { + // we do unsigned comparison to ensure chars > 127 are ok + nillegals += ((unsigned char)data[ix] <= 0x20U); + if (data[ix] == '|' && + ix < ndata-2 && + data[ix+1] == '#' && data[ix+2] == '|') { + /* Stop calculating crc32 at the leftmost occurence of |#| in + the string. */ + break; + } + result = (result >> 8) ^ crc32tab[(result ^ data[ix]) & 0xff]; + } + + /* If broke out of crc loop early, continue to scan for illegal characters. */ + while (ix < ndata) { + nillegals += ((unsigned char)data[ix] <= 0x20U); + ix++; + } + + //result = (~result >> 16) & 0x7fff; + result = (~result); + + if(nillegals) { + return 0; + } else { + *crc = result; + return 1; + } +} + +#endif /* !defined(_facebook_crc32_h_) */ diff --git a/src/util/mcproxy/gfuncs.cpp b/src/util/mcproxy/gfuncs.cpp new file mode 100644 index 0000000000000..b53a3ad2151f0 --- /dev/null +++ b/src/util/mcproxy/gfuncs.cpp @@ -0,0 +1,189 @@ +/* + * Guarded string and memory manipulation functions. + */ + +#include "gfuncs.h" + +static void * +guard(void *result) +{ + if (result == NULL) + { + HPHP::Logger::Error("Out of memory! Aborting."); + throw HPHP::Exception("abort"); + } + + return result; +} + + +void * +gmalloc(int size) +{ + return guard( +#ifdef USE_GC + GC_MALLOC(size) +#else + malloc(size) +#endif + ); +} + +void * +gmalloc_data(int size) +{ + return guard( +#ifdef USE_GC + GC_MALLOC_ATOMIC(size) +#else + malloc(size) +#endif + ); +} + +void * +grealloc(void *orig, int size) +{ + if (orig == NULL) + return gmalloc(size); + else + return guard( +#ifdef USE_GC + GC_REALLOC(orig, size) +#else + realloc(orig, size) +#endif + ); +} + +char * +gstrdup(const char *str) +{ + if (str == NULL) + return NULL; + +#ifdef USE_GC + { + char *dup = guard(GC_MALLOC_ATOMIC(strlen(str) + 1)); + strcpy(dup, str); + return dup; + } +#else +# ifdef FIND_LEAKS + { + char *dup = gmalloc(strlen(str) + 1); + strcpy(dup, str); + return dup; + } +# else + return (char *) guard(strdup(str)); +# endif /* FIND_LEAKS */ +#endif /* USE_GC */ +} + +char * +gstrdup_const(const char *str) +{ + if (str == NULL) + return NULL; + +#ifdef USE_GC + return (char *) str; +#else + return gstrdup(str); +#endif +} + +void * +gmemdup_const(const char *data, unsigned int bytes) +{ + if (data == NULL) + return NULL; + +#ifdef USE_GC + return (char *) data; +#else + { + char *newdata = (char*)gmalloc(bytes); + memcpy(newdata, data, bytes); + return newdata; + } +#endif +} + +void * +gcalloc(int size) +{ +#ifdef USE_GC + return gmalloc(size); +#else + return guard(calloc(1, size)); +#endif +} + +void * +gcalloc_data(int size) +{ +#ifdef USE_GC + return gmalloc_data(size); +#else + return gcalloc(size); +#endif +} + +int +gstrlen(const char *str) +{ + if (str == NULL) + return 0; + return strlen(str); +} + +/* strncpy that always null-terminates */ +void +gstrncpy(char *dest, const char *src, int maxlen) +{ + if (maxlen == 0 || src == NULL || dest == NULL) + return; + while (--maxlen && *src != '\0') + *dest++ = *src++; + *dest = '\0'; +} + +/* atoi that handles null pointers */ +int +gatoi(const char *str) +{ + if (str == NULL) + return 0; + return atoi(str); +} + +int +endswith(const char *str, const char *suffix) +{ + if (str == NULL || suffix == NULL) + return 0; + if (strlen(str) < strlen(suffix)) + return 0; + + return ! strcmp(str + strlen(str) - strlen(suffix), suffix); +} + +void +gfree(void *ptr) +{ +#ifdef USE_GC + /* Let garbage collector do its thing */ +#else + if (ptr != NULL) + free(ptr); +#endif +} + +void ginit(void) +{ +#ifdef USE_GC + GC_INIT(); +#endif +} diff --git a/src/util/mcproxy/gfuncs.h b/src/util/mcproxy/gfuncs.h new file mode 100644 index 0000000000000..6ca87217997f5 --- /dev/null +++ b/src/util/mcproxy/gfuncs.h @@ -0,0 +1,32 @@ +#ifndef __GFUNCS_H__ +#define __GFUNCS_H__ 1 + +#include "include.h" + +/* + * Guarded memory allocation functions. + */ +extern void * gmalloc(int size); +extern void * gmalloc_data(int size); +extern void * grealloc(void *orig, int size); +extern char * gstrdup(const char *str); +extern char * gstrdup_const(const char *str); +extern void * gcalloc(int size); +extern void * gcalloc_data(int size); +extern void * gmemdup_const(const char *data, unsigned int length); +extern void gfree(void *ptr); +extern void ginit(void); + +/* + * Guarded string functions. These are safe to pass NULL pointers to. + */ +extern int gstrlen(const char *str); +extern int gatoi(const char *str); + +/* gstrncpy always null-terminates */ +extern void gstrncpy(char *dest, const char *src, int maxlen); + +/* convenience method to check for a string suffix */ +extern int endswith(const char *str, const char *suffix); + +#endif /* __GFUNCS_H__ */ diff --git a/src/util/mcproxy/include.h b/src/util/mcproxy/include.h new file mode 100644 index 0000000000000..abf2b23eaacd2 --- /dev/null +++ b/src/util/mcproxy/include.h @@ -0,0 +1,54 @@ + +#ifndef __MCPROXY_INCLUDE__ +#define __MCPROXY_INCLUDE__ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +extern "C" { +#include +} + +/* + * Dummy memcached server description for type safety. + */ +typedef struct { + int dummy1; + char dummy2[47]; + int dummy3; +} MEMCACHED; + +/** + * Returns port number mcproxy listens on. + */ +int start_mcproxy(int argc, char **argv); +void run_mcproxy(); + +#endif // __MCPROXY_INCLUDE__ diff --git a/src/util/mcproxy/loadconfig.cpp b/src/util/mcproxy/loadconfig.cpp new file mode 100644 index 0000000000000..b584a22821c12 --- /dev/null +++ b/src/util/mcproxy/loadconfig.cpp @@ -0,0 +1,438 @@ + +#include "proxy.h" +#include "prefix.h" +#include "cluster.h" +#include "gfuncs.h" +#include "tinystdio.h" + +/* + * Configuration file parsing module. + */ +#define MAX_LINE_LENGTH 5000 +#define SERVER_DELIMITERS " \t," +#define PREFIX_DELIMITERS " \t," +#define DEFAULT_MEMCACHED_PORT 11211 +#define CONFIG_DATA_KEY "mcproxy.conf" + + +/* + * Configuration context. When we read a "servers" line, all the servers are + * added to this context, so that they can all be affected by subsequent + * config lines. + */ +typedef struct { + int nservers; + MEMCACHED *servers[1]; +} CONFIG_CONTEXT; + +#define CONTEXT_SIZE(nservers) (sizeof(CONFIG_CONTEXT) + \ + (sizeof(MEMCACHED *) * ((nservers) - 1))) + +static MEMCACHED *config_mcd = NULL; +static const char* config_key = NULL; + +char* latest_config = NULL; +int latest_config_len = 0; +char* latest_config_file = NULL; +char* latest_config_server = NULL; + +/* + * Cleans up a configuration context. + */ +static void +context_cleanup(CONFIG_CONTEXT **context) +{ + if (context != NULL && *context != NULL) + { + gfree(*context); + *context = NULL; + } +} + + +/* + * Adds a server to the configuration context so that subsequent config + * directives will affect it. + */ +static void +context_add_server(CONFIG_CONTEXT **context, MEMCACHED *server) +{ + if (context == NULL || server == NULL) + { + HPHP::Logger::Error("Invalid parameter to context_add_server"); + throw HPHP::Exception("abort"); + } + + if (*context == NULL) + *context = (CONFIG_CONTEXT *)gcalloc(CONTEXT_SIZE(1)); + else + *context = (CONFIG_CONTEXT *)grealloc(*context, + CONTEXT_SIZE((*context)->nservers + 1)); + + (*context)->servers[(*context)->nservers++] = server; +} + + +/* + * Returns a MEMCACHED* for a "host[:port]" string. + */ +static MEMCACHED * +host_port_to_server(char *hostport, int cluster_id) +{ + char *c = strchr(hostport, ':'); + int port = DEFAULT_MEMCACHED_PORT; + + if (c != NULL) + { + *c = '\0'; + port = atoi(c + 1); + } + + return server_new(hostport, port, cluster_id); +} + + +/* + * Adds a list of servers to the configuration. + */ +static int +config_server(char *servers, CONFIG_CONTEXT **context) +{ + char *server; + int cluster_id; + + if (servers == NULL) + { + HPHP::Logger::Error("Found \"server\" config line with no servers"); + return -1; + } + + context_cleanup(context); + server = strtok(servers, SERVER_DELIMITERS); + cluster_id = atoi(server); + if (cluster_id == 0) + { + HPHP::Logger::Error("Invalid cluster ID '%s'", server); + return -1; + } + + server = strtok(NULL, SERVER_DELIMITERS); + + do { + MEMCACHED *mcd = host_port_to_server(server, cluster_id); + if (mcd == NULL) + return -1; + context_add_server(context, mcd); + } while ((server = strtok(NULL, SERVER_DELIMITERS)) != NULL); + + return 0; +} + +/* + * Adds a list of prefixes to the current set of servers. + */ +static int +config_prefix(char *prefixes, CONFIG_CONTEXT **context) +{ + char *prefix; + + if (context == NULL) + { + HPHP::Logger::Error("Null context pointer"); + throw HPHP::Exception("abort"); + } + + if (prefixes == NULL) + { + HPHP::Logger::Error("Found \"prefix\" config line with no prefixes"); + return -1; + } + + if (*context == NULL) + { + HPHP::Logger::Error("Found \"prefix\" config line with no server list"); + return -1; + } + + prefix = strtok(prefixes, PREFIX_DELIMITERS); + do { + PREFIX *pfx = prefix_add(prefix); + int i; + + for (i = 0; i < (*context)->nservers; i++) + prefix_add_server(pfx, (*context)->servers[i]); + } while ((prefix = strtok(NULL, PREFIX_DELIMITERS)) != NULL); + + return 0; +} + +/* + * Marks the current server set as wildcards, so they can serve requests for + * keys that aren't prefixed by one of the explicit prefixes. + */ +static int +config_wildcard(char *value, CONFIG_CONTEXT **context) +{ + int i; + + if (context == NULL) + { + HPHP::Logger::Error("Null context pointer"); + throw HPHP::Exception("abort"); + } + + if (*context == NULL) + { + HPHP::Logger::Error("Found \"wildcard\" config line with no server list"); + return -1; + } + + for (i = 0; i < (*context)->nservers; i++) + prefix_add_server(prefix_find(NULL), (*context)->servers[i]); + + return 0; +} + +/* + * Defines a cluster address and netmask. + */ +static int +config_cluster(char *value, CONFIG_CONTEXT **context) +{ + char *raw_id, *raw_addr, *raw_mask; + int id; + in_addr_t addr, mask; + + if (context == NULL) + { + HPHP::Logger::Error("Null context pointer"); + throw HPHP::Exception("abort"); + } + + raw_id = strtok(value, " \t"); + if (raw_id == NULL) + { + HPHP::Logger::Error("No cluster ID specified"); + return -1; + } + if ((id = atoi(raw_id)) <= 0) + { + HPHP::Logger::Error("Cluster ID must be a positive integer"); + return -1; + } + + raw_addr = strtok(NULL, " \t"); + if (raw_addr == NULL) + { + HPHP::Logger::Error("No cluster address specified"); + return -1; + } + if ((addr = inet_addr(raw_addr)) == INADDR_NONE) + { + HPHP::Logger::Error("Invalid cluster address specified"); + return -1; + } + + raw_mask = strtok(NULL, " \t"); + if (raw_mask == NULL) + { + HPHP::Logger::Error("No cluster netmask specified"); + return -1; + } + if ((mask = inet_addr(raw_mask)) == INADDR_NONE) + { + HPHP::Logger::Error("Invalid cluster netmask specified"); + return -1; + } + + cluster_add(id, &addr, &mask); + return 0; +} + +/* + * Interprets a configuration item. + */ +static int +use_config_entry(const char *keyword, char *value, CONFIG_CONTEXT **context) +{ + if (! strcmp(keyword, "server")) + return config_server(value, context); + else if (! strcmp(keyword, "prefix")) + return config_prefix(value, context); + else if (! strcmp(keyword, "wildcard")) + return config_wildcard(value, context); + else if (! strcmp(keyword, "cluster")) + return config_cluster(value, context); + + return 0; +} + + +/* + * Reads configuration from a TINYFILE stream. + */ +static int +read_config_stream(TINYFILE *fp) +{ + char buf[MAX_LINE_LENGTH]; + CONFIG_CONTEXT *context = NULL; + int ret = 0; + + prefix_clear(); + cluster_clear(); + + while (ret == 0 && tiny_gets(fp, buf, MAX_LINE_LENGTH) != NULL) + { + char *keyword, *value; + + keyword = strtok(buf, " \r\n\t"); + if (keyword == NULL || keyword[0] == '\0' || keyword[0] == '#') + continue; + + value = strtok(NULL, "\r\n"); + if (use_config_entry(keyword, value, &context)) + ret = -1; + } + + context_cleanup(&context); + return ret; +} + + +/* + * Reads a config file of a given name. + */ +int +read_config_file(char *filename, REQUEST_CBF cbf) +{ + TINYFILE *fp; + int status; + + latest_config_file = (char*)grealloc(latest_config_file, + strlen(filename) + 1); + strcpy(latest_config_file, filename); + + int fd = open(filename, O_RDONLY); + if (fd < 0) + { + HPHP::Logger::Error("%s", filename); + return -1; + } + + fp = tiny_fdopen(fd); + if (fp == NULL) + { + HPHP::Logger::Error("tiny_fdopen"); + close(fd); + return -1; + } + + status = read_config_stream(fp); + + tiny_free(fp); + close(fd); + + if (0 == status && NULL != cbf) + cbf(NULL, NULL); + + return status; +} + + +/* + * Reads configuration from a buffer. + */ +int +read_config_buffer(char *buf, int len) +{ + TINYFILE *fp = tiny_bufopen(buf, len); + int status; + + if (NULL == fp) + { + HPHP::Logger::Error("tiny_bufopen"); + return -1; + } + + status = read_config_stream(fp); + + tiny_free(fp); + + return status; +} + +/* + * Configuration has been read from a server; parse it. + */ +static void +do_read_config_server(REQUEST *req, void *arg) +{ + REQUEST_CBF cbf = (REQUEST_CBF) arg; + + if (request_get_status(req) == Error) + { + HPHP::Logger::Info("Couldn't read configuration from server. Reconnecting."); + server_disconnect(config_mcd); + } + else if (request_get_total(req) <= 0) + { + HPHP::Logger::Error("Server doesn't have any configuration data!"); + } + else + { + latest_config_len = request_get_total(req); + latest_config = (char*)grealloc(latest_config, latest_config_len+1); + memcpy(latest_config, request_get_data(req), latest_config_len); + latest_config[latest_config_len] = '\0'; + + if (read_config_buffer(latest_config, latest_config_len)) + { + HPHP::Logger::Info("Couldn't parse config data from server"); + } + else + { + (cbf)(NULL, NULL); + } + } + + request_free(req); +} + +/* + * Reads configuration from a memcached server. + */ +void +read_config_server(REQUEST_CBF cbf) +{ + if (server_is_up(config_mcd)) + { + server_do_request(config_mcd, + request_new_get(&config_key, 1, + do_read_config_server, + (void *) cbf)); + } + else { + HPHP::Logger::Info("Skipping config from down config server."); + } +} + +/* + * Sets the memcached server we will read our configuration from. + */ +int +config_set_server(char *hostport, const char *key) +{ + latest_config_server = (char*)grealloc(latest_config_server, strlen(hostport) + 1); + strcpy(latest_config_server, hostport); + + config_mcd = host_port_to_server(gstrdup(hostport), 0); + config_key = key ? key : CONFIG_DATA_KEY; + if (NULL == config_mcd) + { + HPHP::Logger::Error("Can't attempt to open connection to %s", + hostport); + return -1; + } + + return 0; +} diff --git a/src/util/mcproxy/loadconfig.h b/src/util/mcproxy/loadconfig.h new file mode 100644 index 0000000000000..0d936ce18915d --- /dev/null +++ b/src/util/mcproxy/loadconfig.h @@ -0,0 +1,10 @@ +#ifndef __loadconfig_h__ +#define __loadconfig_h__ 1 + +#include "include.h" + +extern int read_config_file(char *filename, REQUEST_CBF cbf); +extern void read_config_server(REQUEST_CBF cbf); +extern int config_set_server(char *hostport, const char* key); + +#endif /* #ifndef __loadconfig_h__ */ diff --git a/src/util/mcproxy/main.cpp b/src/util/mcproxy/main.cpp new file mode 100644 index 0000000000000..4db2ef37d9aa5 --- /dev/null +++ b/src/util/mcproxy/main.cpp @@ -0,0 +1,442 @@ + +#include "proxy.h" +#include "stats.h" +#include "cluster.h" +#include "loadconfig.h" +#include "prefix.h" +#include "qio.h" +#include "gfuncs.h" + +extern int portnum(int fd); + +/* How often to refresh our configuration, in seconds. */ +#define CONFIG_RELOAD_INTERVAL 57 + +extern QIOReadCBF handle_connection; +extern int debug_enabled; +extern int last_action; +extern int parent_pipe_fd; +extern int async_deletes; +extern char *async_dir; +extern uint32_t max_asyncstore_len; +extern int server_timeout_msec; + +time_t last_config_update_time = 0; + + +void daemonize() +{ + if (getppid() == 1) return; + switch (fork()) { + case 0: + setsid(); + int i; + for (i=getdtablesize();i>=0;--i) close(i); // close all descriptors + i = open("/dev/null", O_RDWR); + dup2(i, 1); + dup2(i, 2); + break; + case -1: + HPHP::Logger::Error("Can't fork background process"); + throw HPHP::Exception("exit with %d", 1); + default: /* Parent process */ + HPHP::Logger::Verbose("Running in the background"); + throw HPHP::Exception("exit with %d", 0); + } +} + +void usage(char *progname) +{ + fprintf(stderr, + "Usage: %s [-AbdmR] [-a dir] [-c cluster] [-f configfile]\n" + "\t\t[-F host[:port]] [-L logfile_path] [-p port] [-s size] [-n connection limit]\n", + progname); + fprintf(stderr, "\t-a\tdirectory for async storage (default /tmp)\n"); + fprintf(stderr, "\t-A\tenable asynchronous forwarding of deletes\n"); + fprintf(stderr, "\t-b\trun in background\n"); + fprintf(stderr, "\t-c\tspecify local cluster ID\n"); + fprintf(stderr, "\t-d\tactivate debug mode\n"); + fprintf(stderr, "\t-f\tload configuration from file\n"); + fprintf(stderr, "\t-F\tload configuration from memcached server\n"); + fprintf(stderr, "\t-L\tlogfile path name\n"); + fprintf(stderr, "\t-m\tmanaged mode (auto restart on crash)\n"); + fprintf(stderr, "\t-n\tset maximum number of connections (default 65536)\n"); + fprintf(stderr, "\t-s\tset maximum async store size in MB (default 10)\n"); + throw HPHP::Exception("exit with %d", 1); +} + +/* + * The parent process has died in managed mode. + */ +static void +parent_died(int fd, void *arg) +{ + HPHP::Logger::Info("Parent died; exiting"); + throw HPHP::Exception("exit with %d", 0); +} + + +/* + * Forks off child processes and watches for their deaths if we're running in + * managed mode. + */ +static void +watch_children(int *pipefds) +{ + char c; + int pid; + int res; + +#ifdef SIGCHLD + signal(SIGCHLD, SIG_IGN); +#endif + while (1) + { + if (pipe(pipefds)) + { + HPHP::Logger::Error("Can't open parent-child pipe"); + throw HPHP::Exception("exit with %d", 1); + } + switch (pid = fork()) { + case 0: + /* Child process. Continue with the startup logic. */ + close(pipefds[0]); + stats_set_starttime((int) time(NULL)); + return; + + case -1: + close(pipefds[0]); + close(pipefds[1]); + HPHP::Logger::Error("Can't spawn child process, sleeping"); + sleep(10); + break; + + default: + close(pipefds[1]); + HPHP::Logger::Info("Spawned child process %d", pid); + while ((res = read(pipefds[0], &c, 1)) == -1) + ; + + close(pipefds[0]); + HPHP::Logger::Info("Child process %d exited", pid); + if (res == 1 && c == 'q') + { + HPHP::Logger::Info("It was terminated; terminating parent"); + throw HPHP::Exception("exit with %d", 0); + } + } + } +} + + +/* + * Configuration has been loaded; start using it. + */ +static void +config_done(REQUEST *request, void *args) +{ + int ignore_cluster = args != NULL; + + if (server_count() == 0) + { + HPHP::Logger::Error("No servers specified in config file"); + return; + } + + server_connect_all(); + + if (ignore_cluster) + return; + + if (cluster_determine_id()) + { + HPHP::Logger::Error("Can't determine local cluster"); + return; + } + + last_config_update_time = time(NULL); + + HPHP::Logger::Verbose("Local cluster ID is %d", cluster_id()); +} + + +/* + * Reloads the configuration periodically. + */ +static void +reload_config(void *arg) +{ + char *config_file = (char*)arg; + + if (NULL != config_file) + { + read_config_file(config_file, config_done); + } + else + { + read_config_server(config_done); + } +} + +/* + * handle SIGHUP + */ +static void +sighup_handler(int signum) +{ +} + +int start_mcproxy(int argc, char **argv) +{ + struct rlimit rlim; + int c; + int port = 11100; + int accept_fd; + int managed = 0; + int want_background = 0; + int num_sockets = 65536; + int have_config_file = 0; + char *pidfile = NULL; + char *config_file = NULL; + char *config_host_port = NULL; + char *config_key = NULL; + int fds[2]; + + // if a child is spawned, will be overwritten by child + stats_set_starttime((int) time(NULL)); +#ifdef FIND_LEAKS + /* Activate the garbage collector's leak detection mode. */ + GC_find_leak = 1; + GC_start_debugging(); +#endif + + ginit(); + request_list_init(); + request_init(); + prefix_init(); + continuum_init(continuum_default_error_fn, NULL); + +#ifdef SIGPIPE + signal(SIGPIPE, SIG_IGN); +#endif + + while ((c = getopt(argc, argv, "a:Abc:df:F:L:mn:p:P:Rs:k:t:")) != EOF) + { + switch (c) { + case 'a': + async_dir = optarg; + break; + + case 'A': + async_deletes = 1; + break; + + case 'b': + want_background = 1; + //setup_sigsegv(); + break; + + case 'c': + cluster_set_id(atoi(optarg)); + break; + + case 'd': + //debug_enabled++; + break; + + case 'f': + if (access(optarg, R_OK)) + { + HPHP::Logger::Error("%s", optarg); + throw HPHP::Exception("exit with %d", 1); + } + config_file = optarg; + have_config_file = 1; + break; + + case 'F': + config_host_port = optarg; + break; + case 'L': + //syslog_name = optarg; + break; + case 'm': + managed = 1; + break; + + case 'n': + num_sockets = atoi(optarg); + break; + + case 'k': + config_key = optarg; + break; + + case 'p': + port = atoi(optarg); + if (port == 0) + usage(argv[0]); + break; + + case 'P': + pidfile = optarg; + break; + + case 's': + max_asyncstore_len = atoi(optarg) * 1024 * 1024; + break; + + case 't': + server_timeout_msec = atoi(optarg); + break; + + default: + usage(argv[0]); + } + } + + if (NULL == config_file && NULL == config_host_port) + { + HPHP::Logger::Error("No config source specified"); + throw HPHP::Exception("exit with %d", 1); + } + + /* + * If config is from a file, we can read it now; otherwise we have to + * wait until the async I/O system is up and running. (Even in the + * case of a file, we'll reload the config once the I/O system is + * up, but this lets us flag syntax errors before forking.) + */ + if (NULL != config_file && read_config_file(config_file, NULL)) + { + HPHP::Logger::Error("Can't read config file"); + throw HPHP::Exception("exit with %d", 1); + } + + if (NULL != config_host_port && config_set_server(config_host_port, + config_key)) + { + HPHP::Logger::Error("Invalid configuration server"); + throw HPHP::Exception("exit with %d", 1); + } + + /* + * If both a server and a file are specified, use the file for the + * initial configuration (which we've just read above) and then switch + * to the server. This allows a bootstrap configuration in case the + * server is offline. + */ + if (NULL != config_host_port && NULL != config_file) + config_file = NULL; + + if (want_background) + { + /* open and close the log file to verify we have permission to + * open it. We do this so that we can produce a useful error + * message before daemonize closes all open file descriptors, + * including stdout/stderr. + */ + daemonize(); + if( signal(SIGHUP, sighup_handler) == SIG_ERR ) { + HPHP::Logger::Error("Can't set SIGHUP handler"); + throw HPHP::Exception("exit with %d", 1); + } + } + + accept_fd = serversock(port); + port = portnum(accept_fd); + if (accept_fd < 0) + { + HPHP::Logger::Error("Can't open listen socket"); + throw HPHP::Exception("exit with %d", 1); + } + HPHP::Logger::Info("mcproxy is listening on port %d", port); + + if (pidfile != NULL) + { + int fd; + char pid[20]; + sprintf(pid, "%d", getpid()); + + fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (fd >= 0) + { + if (write(fd, pid, strlen(pid)) < (int)strlen(pid)) + HPHP::Logger::Error("%s", pidfile); + close(fd); + } + else + HPHP::Logger::Error("%s", pidfile); + } + + if (managed) + { + watch_children(fds); + } + + /* + * Set the fdlimit before qio_init() because libevent uses the fd + * limit as a initial allocation buffer and if the limit is too + * low, then libevent realloc's the buffer which may cause epoll + * to copy out to the wrong address returning bogus data to user + * space, or it's just a bug in libevent. It's simpler to increase + * the limit than to fix libevent. + * libev does not suffer from this problem. + */ + if (getrlimit(RLIMIT_NOFILE, &rlim) != 0) { + HPHP::Logger::Error("Failed to getrlimit RLIMIT_NOFILE"); + throw HPHP::Exception("exit with %d", 1); + } else { + if ((int)rlim.rlim_cur < num_sockets) + rlim.rlim_cur = num_sockets; + if (rlim.rlim_max < rlim.rlim_cur) + rlim.rlim_max = rlim.rlim_cur; + if (getuid() == 0 && + setrlimit(RLIMIT_NOFILE, &rlim) != 0) { + HPHP::Logger::Error("failed to setrlimit RLIMIT_NOFILE"); + throw HPHP::Exception("exit with %d", 1); + } + } + + /* + * Have to do the qio_init() after forking since libevent doesn't + * survive being forked on some platforms. + */ + qio_init(); + + /* + * Determine the local cluster ID if possible, then start connecting + * to all the servers we know about so far, including (possibly) the + * configuration server. + */ + config_done(NULL, have_config_file ? NULL : (void*)1); + + /* + * Now schedule the server to read the configuration from whatever + * configuration source we're using. This will happen after we pass + * control to the I/O system. + */ + qio_schedule(time(NULL) + 2, reload_config, config_file, + CONFIG_RELOAD_INTERVAL); + + HPHP::Logger::Verbose("Listening on port %d fd %d", port, accept_fd); + + /* + * If we're running in managed mode, the child should exit if the + * parent is killed. + */ + if (managed) + { + parent_pipe_fd = fds[1]; + qio_add(parent_pipe_fd, parent_died, NULL, NULL); + } + + client_add_handler(accept_fd); + unlink(pidfile); + return port; +} + +void run_mcproxy() { + qio_main(); + qio_cleanup(); +} diff --git a/src/util/mcproxy/mctypes.h b/src/util/mcproxy/mctypes.h new file mode 100644 index 0000000000000..59d204cc06417 --- /dev/null +++ b/src/util/mcproxy/mctypes.h @@ -0,0 +1,10 @@ +#if !defined(_facebook_mctypes_h_) +#define _facebook_mctypes_h_ + +#include "include.h" +#include "server.h" + +typedef MEMCACHED mcc_server_t; +typedef void mcc_t; + +#endif /* #if !defined(_facebook_mctypes_h_) */ diff --git a/src/util/mcproxy/prefix.cpp b/src/util/mcproxy/prefix.cpp new file mode 100644 index 0000000000000..cf0eeaa348488 --- /dev/null +++ b/src/util/mcproxy/prefix.cpp @@ -0,0 +1,273 @@ +/* + * Prefix management module. Each known prefix is associated with a list + * of servers. If a key with a known prefix is looked up or stored, only + * servers that serve that prefix are contacted (unless all of them are + * down, in which case the request is hashed over the complete list of + * servers.) + */ +#include "proxy.h" +#include "server_int.h" +#include "gfuncs.h" + +/* List of prefix descriptors, alphabetically sorted. */ +static PREFIX_IMPL **prefixes = NULL; +static int32_t nprefixes = 0; + +/* + * This special prefix is used as a catch-all for servers that can handle + * requests of any type. + */ +static PREFIX_IMPL *fallback_prefix = NULL; + +/* + * Adds a new prefix to the list. + */ +PREFIX *prefix_add(const char *prefix) +{ + PREFIX_IMPL **newlist; + PREFIX_IMPL *newprefix; + PREFIX *existing; + int32_t i; + + if (prefix == NULL || strlen(prefix) == 0) + return (PREFIX *) fallback_prefix; + + existing = prefix_find(prefix); + if (existing != (PREFIX *) fallback_prefix) + return existing; + + newlist = (PREFIX_IMPL **)gmalloc(sizeof(PREFIX_IMPL *) * (nprefixes+1)); + + for (i = 0; i < nprefixes; i++) + { + if (strcmp(prefixes[i]->prefix, prefix) < 0) + newlist[i] = prefixes[i]; + else + break; + } + + newprefix = (PREFIX_IMPL *)gmalloc(sizeof(PREFIX_IMPL)); + newprefix->prefix = gstrdup(prefix); + newprefix->prefix_len = strlen(prefix); + newprefix->clusters = NULL; + newlist[i] = newprefix; + + for (; i < nprefixes; i++) + newlist[i + 1] = prefixes[i]; + + if (prefixes != NULL) + gfree(prefixes); + + prefixes = newlist; + nprefixes++; + + return (PREFIX *) newprefix; +} + + +/* + * Finds the prefix entry that matches a particular key. If there is no + * matching prefix, returns the fallback prefix. + */ +PREFIX *prefix_find(const char *key) +{ + int32_t min, max, mid; + + if (key == NULL || key[0] == '\0' || nprefixes == 0) + return (PREFIX *) fallback_prefix; + + max = nprefixes - 1; + min = 0; + while (min <= max) + { + mid = (min + max) / 2; + if (strcmp(prefixes[mid]->prefix, key) > 0) + max = mid - 1; + else if (! strncmp(prefixes[mid]->prefix, key, + prefixes[mid]->prefix_len)) + return (PREFIX *) prefixes[mid]; + else + min = mid + 1; + } + + return (PREFIX *) fallback_prefix; +} + + +/* + * Finds the cluster with a given ID. + */ +static CLUSTER_SERVERS *prefix_find_cluster(PREFIX_IMPL *prefix, + const int cluster) +{ + CLUSTER_SERVERS *clust; + + if (prefix == NULL) + return NULL; + for (clust = prefix->clusters; clust != NULL; clust = clust->next) + if (clust->cluster == cluster) + return clust; + return NULL; +} + + +const CLUSTER_SERVERS * +prefix_get_cluster_servers_for_key(const char *key, + const int cluster) +{ + PREFIX_IMPL *prefix = (PREFIX_IMPL *) prefix_find(key); + CLUSTER_SERVERS *clust = prefix_find_cluster(prefix, cluster); + + /* + * If this cluster doesn't have a prefix for the key (but some + * other cluster does), fall back to the wildcard prefix. + */ + if (clust == NULL) + { + prefix = (PREFIX_IMPL *) prefix_find("*"); + clust = prefix_find_cluster(prefix, cluster); + } + + return clust; +} + + +/* + * Finds the list of servers that can serve a key. + */ +void +prefix_get_servers_for_cluster_servers(const CLUSTER_SERVERS * cluster, + MEMCACHED ***servers, + uint32_t *nservers) +{ + if (cluster != NULL) + { + *nservers = cluster->nservers; + *servers = cluster->servers; + } + else + { + *nservers = 0; + *servers = NULL; + } +} + + +/* + * Adds a server to a prefix's server list. + */ +void +prefix_add_server(PREFIX *vprefix, MEMCACHED *server) +{ + PREFIX_IMPL *prefix = (PREFIX_IMPL *) vprefix; + int cluster = server_get_cluster(server); + CLUSTER_SERVERS *clust = prefix_find_cluster(prefix, cluster); + + if (clust == NULL) + { + clust = (CLUSTER_SERVERS*)gcalloc(sizeof(CLUSTER_SERVERS)); + clust->cluster = cluster; + if (is_consistent_server(server)) + { + clust->use_consistent_hashing = 1; + } + else + { + clust->use_consistent_hashing = 0; + } + clust->next = prefix->clusters; + prefix->clusters = clust; + } + + clust->servers = (MEMCACHED**)grealloc(clust->servers, + sizeof(MEMCACHED *) * (clust->nservers + 1)); + clust->servers[clust->nservers++] = server; + + server_add_prefix(server, vprefix); + + HPHP::Logger::Verbose("Added server for prefix %s", prefix->prefix); + + if (server_is_up(server) && server_is_real(server)) + prefix_server_up(vprefix, server); +} + + +/* + * Records that one of a prefix's servers has come up. + */ +void +prefix_server_up(PREFIX *vprefix, MEMCACHED *server) +{ + PREFIX_IMPL *prefix = (PREFIX_IMPL *) vprefix; + int cluster = server_get_cluster(server); + CLUSTER_SERVERS *clust = prefix_find_cluster(prefix, cluster); + clust->nservers_up++; + HPHP::Logger::Verbose("server up for prefix %s", prefix->prefix); +} + + +/* + * Records that one of a prefix's servers has gone down. + */ +void +prefix_server_down(PREFIX *vprefix, MEMCACHED *server) +{ + PREFIX_IMPL *prefix = (PREFIX_IMPL *) vprefix; + int cluster = server_get_cluster(server); + CLUSTER_SERVERS *clust = prefix_find_cluster(prefix, cluster); + clust->nservers_up--; + HPHP::Logger::Verbose("server down for prefix %s", prefix->prefix); +} + +/* + * Frees a prefix. + */ +static void +prefix_free(PREFIX_IMPL *prefix) +{ + CLUSTER_SERVERS *clust, *next; + + if (NULL == prefix) + return; + gfree(prefix->prefix); + + for (clust = prefix->clusters; clust != NULL; clust = next) + { + next = clust->next; + gfree(clust->servers); + gfree(clust); + } + + gfree(prefix); +} + +/* + * Clears the current list of prefixes, e.g. because of a configuration + * reload. The memcached server structures aren't touched. + */ +void +prefix_clear() +{ + server_clear_prefixes(); + + while (nprefixes > 0) + { + prefix_free(prefixes[--nprefixes]); + } + + prefix_free(fallback_prefix); + fallback_prefix = (PREFIX_IMPL*)gmalloc(sizeof(PREFIX_IMPL)); + fallback_prefix->prefix = gstrdup(""); + fallback_prefix->prefix_len = 0; + fallback_prefix->clusters = NULL; +} + + +/* + * Initializes the prefix module. + */ +void +prefix_init() +{ + prefix_clear(); +} diff --git a/src/util/mcproxy/prefix.h b/src/util/mcproxy/prefix.h new file mode 100644 index 0000000000000..d3bc6463c19d9 --- /dev/null +++ b/src/util/mcproxy/prefix.h @@ -0,0 +1,33 @@ +#ifndef __prefix_h__ +#define __prefix_h__ 1 + +#include "include.h" +#include "prefix_int.h" + +/* + * Dummy prefix description for type safety. + */ +typedef struct { + char dummy1[8]; + char dummy2[1]; + char *dummy3; +} PREFIX; + +extern PREFIX *prefix_add(const char *prefix); +extern PREFIX *prefix_find(const char *key); + +extern const CLUSTER_SERVERS* +prefix_get_cluster_servers_for_key(const char *key, const int cluster); +extern void prefix_get_servers_for_cluster_servers +(const CLUSTER_SERVERS * cluster, MEMCACHED ***servers, uint32_t *nservers); + +extern void prefix_add_server(PREFIX *prefix, MEMCACHED *server); +extern void prefix_server_up(PREFIX *prefix, MEMCACHED *server); +extern void prefix_server_down(PREFIX *prefix, MEMCACHED *server); +extern void prefix_clear(void); +extern void prefix_init(); + +/* declared here because server.h doesn't define PREFIX */ +extern void server_add_prefix(MEMCACHED *vmcd, PREFIX *prefix); + +#endif /* __prefix_h__ */ diff --git a/src/util/mcproxy/prefix_int.h b/src/util/mcproxy/prefix_int.h new file mode 100644 index 0000000000000..17392bcfeb640 --- /dev/null +++ b/src/util/mcproxy/prefix_int.h @@ -0,0 +1,35 @@ +#ifndef __prefix_int_h__ +#define __prefix_int_h__ 1 + +#include "include.h" +#include "server.h" + +/* + * Cluster server list. This is just a cluster number and a list of servers. + * Each prefix has a server list for each cluster. + */ +typedef struct _cluster_servers CLUSTER_SERVERS; +struct _cluster_servers { + int cluster; /* cluster ID */ + MEMCACHED **servers; + uint32_t nservers; /* Size of servers list */ + uint32_t nservers_up; /* How many servers are up? */ + int use_consistent_hashing; + CLUSTER_SERVERS *next; +}; + +/* + * Key prefix description. Each known prefix is associated with a list + * of servers. If a key with a known prefix is looked up or stored, only + * servers that serve that prefix are contacted (unless all of them are + * down, in which case the request is hashed over the complete list of + * servers.) + */ +typedef struct _prefix PREFIX_IMPL; +struct _prefix { + char *prefix; + int prefix_len; /* strlen(prefix) */ + CLUSTER_SERVERS *clusters; +}; + +#endif /* __prefix_int_h__ */ diff --git a/src/util/mcproxy/proxy.h b/src/util/mcproxy/proxy.h new file mode 100644 index 0000000000000..4bccd41f35f59 --- /dev/null +++ b/src/util/mcproxy/proxy.h @@ -0,0 +1,33 @@ +#ifndef __proxy_h__ +#define __proxy_h__ 1 + +#include "include.h" + +/* Flag on a set/add/replace to indicate the request should be replicated */ +#define FLAG_REPLICATE 0x400 +/* + * Flag on a set that permits it to return before actually executing + * the store. This semantics of this flag are: + * + * - The request will be executed in a timely fashion. Specifically, + * it would be executed with the same speed as if the flag is not + * set. + * + * - The request will be executed in order with all other requests to + * the same key, even synchronous ones. For example, if you do an + * async set and then a sync delete, then by the time the delete call + * returns, the key will be deleted and there will be no risk of the + * async set taking affect. + */ +#define FLAG_ASYNC_SET 0x1000 + +extern int serversock(int port); +extern void host_to_addr(const char *hostname, char *addrbuf); +extern int set_nodelay(int fd, int want_nodelay); +extern int determine_local_address(struct in_addr *addrbuf); +extern int clientsock_nb(char *host, int port, int *fd); +extern unsigned int hash_crc32(const char *key, const unsigned int len); + +extern void client_add_handler(int fd); + +#endif /* __proxy_h__ */ diff --git a/src/util/mcproxy/qio.cpp b/src/util/mcproxy/qio.cpp new file mode 100644 index 0000000000000..01e67f04df669 --- /dev/null +++ b/src/util/mcproxy/qio.cpp @@ -0,0 +1,947 @@ + +/* + * Queued I/O module. This code handles reading and writing to large + * numbers of nonblocking sockets. + * + * Copyright (c) 2004-2005, Steven Grimm. + */ +#include "qio.h" +#include "gfuncs.h" +#include + +/* + * Output buffers smaller than this will be retained even after they're + * drained, so we don't spend a lot of time allocating and freeing small + * buffers. Set this to 0 to always free buffers as soon as they're flushed. + */ +#define MAX_DRAINED_BUFFER_SIZE 100000 + +/* + * Each file descriptor we're handling has one of these structures. They're + * stored in an array indexed by file descriptor. + */ +typedef struct { + int fd; /* Which file descriptor is this? */ + QIOReadCBF readCBF; /* Function to call on data arrival. */ + QIOCloseCBF closeCBF; /* Function to call on error. */ + QIOWriteCBF writeCBF; /* Function to call on writeability. */ + QIOFlushCBF flushCBF; /* Function to call when done writing. */ + void *args; /* Auxiliary data to pass to callbacks. */ + char *output; /* Data queued for output. */ + int outputCount; /* How many bytes are queued. */ + int outputSize; /* How big the output buffer is. */ + int outputOffset; /* How far into the output buffer we are. */ + int immediateWrite; /* Nonzero to try writing in qio_write(). */ + struct event *readEvent; + struct event *writeEvent; + int watchingWrite; +} QIO; + +/* + * Each scheduled event is described by an entry in this list. The list + * is sorted in order of firing time, i.e., the next event is always the + * first one in the list. + */ +typedef struct _qio_event QIO_EVENT; +struct _qio_event { + struct event ev; + QIOTimerCBF cbf; /* Callback function to call. */ + void *args; /* Arguments to pass to callback. */ + int interval; /* Interval to next event, or 0 for none. */ + int done; /* 1 if the event is finished. */ + QIO_EVENT *next; /* Next event in schedule. */ +}; + +static QIO *qios = NULL; +static int qios_size = 0; +static int qio_init_count = 0; + +/* Initial array size. The array is grown as needed. */ +#define QIO_INITIAL_SIZE 32 + +/* Amount of extra headroom to allocate when we grow the array. */ +#define QIO_HEADROOM 7 + +/* Maximum file descriptor allowed, for sanity checking. */ +#define QIO_MAX_LEGAL_FD 65535 + +/* Size of event hashtable. */ +#define QIO_EVENT_HASH_SIZE 23 + + +static QIO_EVENT *qio_event_hash[QIO_EVENT_HASH_SIZE]; + +static void qio_readable(int fd, short event, void *arg); +static void qio_writable(int fd, short event, void *arg); + + +/* + * Resets after a fork() call. + */ +static int +qio_poll_forked() +{ + int i; + + for (i = 0; i < qios_size; i++) + { + if (qios[i].fd >= 0) + { + /* Let the parent write any pending output. */ + qios[i].outputCount = qios[i].outputOffset = 0; + } + } + + return 0; +} + +/* + * Initializes the queued I/O module. Must be called before any other QIO + * functions are called. + */ +void +qio_init() +{ + int i; + + /* + * Keep count of the number of times we're called so we don't clean + * up until qio_cleanup() has been called the same number of times. + */ + if (qio_init_count++ > 0) + return; + + /* Create an initial set of qio structures. */ + qios_size = QIO_INITIAL_SIZE; + qios = (QIO*)gcalloc(sizeof(QIO) * qios_size); + for (i = 0; i < qios_size; i++) + qios[i].fd = -1; + + event_init(); +} + +/* + * Registers a file descriptor with the queued I/O module. + * + * Parameters: + * fd File descriptor to register. + * read_cbf Function to call when data arrives. + * close_cbf Function to call when socket shuts down. + * args Additional information to pass to callback function. + * + * Return value: + * 0 File descriptor registered successfully. + * EBADF Bad file descriptor. + */ +int +qio_add(int fd, QIOReadCBF read_cbf, QIOCloseCBF close_cbf, void *args) +{ + int i; + + if (fd < 0 || fd > QIO_MAX_LEGAL_FD) + return EBADF; + + /* We require nonblocking output, so force it here. */ + if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) + { + HPHP::Logger::Error("Can't set nonblocking mode on fd %d", fd); + return EBADF; + } + + /* Is this file descriptor too big for our array? Expand it if so. */ + if (fd >= qios_size) + { + QIO *new_qios; + int new_size = fd + QIO_HEADROOM + 1; + + new_qios = (QIO*)grealloc(qios, new_size * sizeof(QIO)); + for (i = fd; i < new_size; i++) + new_qios[i].fd = -1; + + qios = new_qios; + qios_size = fd + QIO_HEADROOM + 1; + } + + /* + * If this is a new file descriptor, set up its I/O elements. Reset + * its output buffer just to be safe. + */ + if (qios[fd].fd < 0) + { + qios[fd].fd = fd; + qios[fd].output = NULL; + qios[fd].outputCount = 0; + qios[fd].outputSize = 0; + qios[fd].immediateWrite = 1; + qios[fd].watchingWrite = 0; + qios[fd].readEvent = (event*)gmalloc(sizeof(struct event)); + qios[fd].writeEvent = (event*)gmalloc(sizeof(struct event)); + + event_set(qios[fd].readEvent, fd, EV_READ | EV_PERSIST, + qio_readable, (void *)(intptr_t)fd); + event_set(qios[fd].writeEvent, fd, EV_WRITE | EV_PERSIST, + qio_writable, (void *)(intptr_t)fd); + + event_add(qios[fd].readEvent, NULL); + } + + qios[fd].readCBF = read_cbf; + qios[fd].closeCBF = close_cbf; + qios[fd].writeCBF = NULL; + qios[fd].flushCBF = NULL; + qios[fd].args = args; + + if (qios[fd].watchingWrite) + { + event_del(qios[fd].writeEvent); + qios[fd].watchingWrite = 0; + } + + return 0; +} + + +/* + * Watches for writes on a file descriptor. + */ +static void +qio_watch_write(int fd) +{ + if (! qios[fd].watchingWrite) + { + event_add(qios[fd].writeEvent, NULL); + qios[fd].watchingWrite = 1; + } +} + + +/* + * Registers a file descriptor with the queued I/O module, but lets the + * application handle writes. + * + * Parameters: + * fd File descriptor to register. + * read_cbf Function to call when data arrives. + * write_cbf Function to call when the descriptor is writable. + * close_cbf Function to call when socket shuts down. + * args Additional information to pass to callback function. + * + * Return value: + * 0 File descriptor registered successfully. + * EBADF Bad file descriptor. + */ +int +qio_add_write(int fd, QIOReadCBF read_cbf, QIOWriteCBF write_cbf, + QIOCloseCBF close_cbf, void *args) +{ + if (qio_add(fd, read_cbf, close_cbf, args) < 0) + return EBADF; + qios[fd].writeCBF = write_cbf; + qio_watch_write(fd); + + return 0; +} + + +/* + * Removes a file descriptor from the queued I/O module. Note that this + * does not affect the file descriptor; it's up to the caller to close it + * if needed. + * + * Parameters: + * fd File descriptor to unregister. + */ +void qio_remove(int fd) +{ + if (fd < 0 || fd >= qios_size) + return; + + /* Not monitoring this FD? */ + if (qios[fd].fd < 0) + return; + + event_del(qios[fd].readEvent); + event_del(qios[fd].writeEvent); + qios[fd].watchingWrite = 0; + gfree(qios[fd].readEvent); + gfree(qios[fd].writeEvent); + + /* Let go of any pending output. */ + if (qios[fd].output != NULL) + { + gfree(qios[fd].output); + qios[fd].output = NULL; + qios[fd].outputCount = 0; + qios[fd].outputSize = 0; + } + + qios[fd].fd = -1; +} + + +/* + * Closes a file descriptor and removes it from the queued I/O module. + * The descriptor's close callback, if any, is called. + * + * Parameters: + * fd File descriptor to close. + */ +void qio_close(int fd) +{ + /* Call close callback if we're monitoring this FD. */ + if (fd >= 0 && fd < qios_size && qios[fd].fd >= 0 && + qios[fd].closeCBF != NULL) + { + (qios[fd].closeCBF)(fd, QIO_CLOSE_LOCAL, qios[fd].args); + } + + qio_remove(fd); + close(fd); +} + + +/* + * Adds bytes to a file descriptor's output queue and ensures we're watching + * for writeability on the socket. + * + * Parameters: + * fd File descriptor to add to. + * data Data to add to queue. + * length Length of data to add. + */ +static void +qio_add_to_output(int fd, void *data, int length) +{ + int desiredSize; + + /* Make sure we're watching for writeability. */ + if (qios[fd].immediateWrite) + qio_watch_write(fd); + + /* If this is the first data queued up, set up the queue. */ + if (qios[fd].output == NULL) + { + qios[fd].output = (char*)gmalloc_data(length * 2); + qios[fd].outputSize = length * 2; + qios[fd].outputOffset = 0; + qios[fd].outputCount = 0; + } + + /* Ensure there's enough additional space for this data. */ + desiredSize = qios[fd].outputCount + qios[fd].outputOffset + length; + if (desiredSize > qios[fd].outputSize) + { + char *newOutput; + + newOutput = (char*)grealloc(qios[fd].output, desiredSize); + qios[fd].output = newOutput; + qios[fd].outputSize = desiredSize; + } + + if (qios[fd].outputCount == 0) + qios[fd].outputOffset = 0; + memcpy(qios[fd].output + qios[fd].outputOffset + qios[fd].outputCount, + data, length); + qios[fd].outputCount += length; +} + + +/* + * Writes to a qio-controlled file descriptor. Use this instead of writing + * directly using system calls, or there's no point using QIO! + * + * The actual write may be deferred; if an error occurs, the close callback + * function is called. + * + * Parameters: + * fd File descriptor to write to. + * data Address of buffer to write. + * length Number of bytes to write. + */ +void qio_write(int fd, const void *data, int length) +{ + int bytes_written; + + if (fd < 0 || fd >= qios_size || qios[fd].fd < 0) + return; + + /* If there's already something queued up, just add to the queue. */ + if (qios[fd].outputCount > 0 || ! qios[fd].immediateWrite) + { + qio_add_to_output(fd, (void*)data, length); + return; + } + + /* Try to write immediately; no sense queuing unnecessarily. */ + bytes_written = write(fd, data, length); + if (bytes_written == length) + return; + + /* + * If there was an error other than EWOULDBLOCK, we'll hit it again from + * within the main loop. Inefficient, maybe, but a cheap way to make + * sure the close callback isn't called from within another callback. + */ + if (bytes_written < 0) + { + if (errno != EWOULDBLOCK && errno != ENOTCONN) + { + HPHP::Logger::Error("Bad write; deferring error handling"); + } + + bytes_written = 0; + } + + qio_add_to_output(fd, ((char*)data) + bytes_written, length-bytes_written); +} + +/* + * Enables or disables immediate write attempts on a qio file descriptor. + * If you're writing lots of little buffers that don't need to be delivered + * until control returns to qio_main(), you should disable immediate writing + * since it can result in additional network overhead. + * + * Parameters: + * fd File descriptor to control. + * enable Nonzero to enable immediate writing. + */ +void qio_enable_immediate(int fd, int enable) +{ + if (fd < 0 || fd >= qios_size || qios[fd].fd < 0) + return; + + qios[fd].immediateWrite = enable; + + if (enable && qios[fd].outputCount > 0) + qio_watch_write(fd); +} + + +/* + * Try writing queued data to a descriptor that just polled writable. + * + * Parameters: + * fd File descriptor to write to. + * + * Return values: + * 0 No errors occurred. + * 1 Couldn't write to descriptor. + */ +static int +qio_write_queued(int fd) +{ + int bytes_written; + QIOFlushCBF flush_cbf; + + if (qios[fd].outputCount == 0) + { + printf("Polled for write on fd %d with no data queued\n", fd); + event_del(qios[fd].writeEvent); + qios[fd].watchingWrite = 0; + return 0; + } + + bytes_written = write(fd, qios[fd].output + qios[fd].outputOffset, + qios[fd].outputCount); + if (bytes_written < 0) + { + HPHP::Logger::Error("write"); + return 1; + } + + /* Advance the buffer cursor in case we did a partial write. */ + qios[fd].outputCount -= bytes_written; + if (qios[fd].outputCount > 0) + qios[fd].outputOffset += bytes_written; + else + { + /* Buffer is empty; don't need to check for writeability any more. */ + qios[fd].outputOffset = 0; + event_del(qios[fd].writeEvent); + qios[fd].watchingWrite = 0; + + flush_cbf = qios[fd].flushCBF; + qios[fd].flushCBF = NULL; + if (flush_cbf != NULL) + (flush_cbf)(fd, qios[fd].args); + + /* + * If the buffer is still empty and it's bigger than the + * maximum size we want to retain after draining, free it. + */ + if (qios[fd].outputCount == 0 && + qios[fd].outputSize > MAX_DRAINED_BUFFER_SIZE && + qios[fd].output != NULL) + { + gfree(qios[fd].output); + qios[fd].outputSize = 0; + qios[fd].outputOffset = 0; + qios[fd].output = NULL; + } + } + + return 0; +} + +/* + * Returns the opaque argument pointer for a particular file descriptor. + * + * Parameters: + * fd File descriptor to query. + */ +void *qio_get_opaque(int fd) +{ + if (fd < 0 || fd >= qios_size) + return NULL; + + return qios[fd].args; +} + + +/* + * Flushes pending output on a file descriptor. When the flush is complete, + * the specified callback function is called. + * + * Parameters: + * fd File descriptor to write to. + * flush_cbf Callback to call when flush finishes. + */ +void qio_flush(int fd, QIOFlushCBF flush_cbf) +{ + if (fd < 0 || fd >= qios_size) + return; + + /* Already flushed? Call the function immediately. */ + if (qios[fd].outputCount == 0) + (flush_cbf)(fd, qios[fd].args); + else + qios[fd].flushCBF = flush_cbf; +} + + +/* + * Removes and frees a timer event from the timer event list. + * + * Parameters: + * cbf Callback function to remove. + * args If non-null, (cbf, args) events are removed; otherwise + * (cbf, *) are removed. + * event If non-null, only this event is removed even if there + * are others with the same cbf and args. + */ +static void +qio_event_remove(QIOTimerCBF cbf, void *args, QIO_EVENT *event) +{ + int min, max; + int i; + + if (args != NULL) + { + min = (((unsigned int) (intptr_t) cbf) ^ ((unsigned int) (intptr_t) args)) % QIO_EVENT_HASH_SIZE; + max = min; + } + else + { + min = 0; + max = QIO_EVENT_HASH_SIZE - 1; + } + + for (i = min; i <= max; i++) + { + QIO_EVENT **ptr, *cur; + + for (ptr = &qio_event_hash[i]; *ptr != NULL; ) + { + cur = *ptr; + if ((cbf == NULL || cur->cbf == cbf) && + (args == NULL || cur->args == args) && + (event == NULL || cur == event)) + { + *ptr = cur->next; + if (event == NULL) + event_del(&cur->ev); + gfree(cur); + } + else + { + ptr = &cur->next; + } + } + } +} + + +/* + * A timer event has fired. + */ +static void +qio_event_timer(int fd, short code, void *arg) +{ + struct event *event = (struct event *) arg; + QIO_EVENT *e = (QIO_EVENT *) event->ev_arg; + QIOTimerCBF cbf = e->cbf; + void *args = e->args; + + if (e->interval) + { + struct timeval wait; + wait.tv_sec = e->interval; + wait.tv_usec = 0; + evtimer_add(event, &wait); + } + else + qio_event_remove(e->cbf, e->args, e); + + cbf(args); +} + + +/* + * Creates a new event and adds it to the schedule. + * + * Parameters: + * when When the event should fire. If this is in the past + * (e.g. 0) the timer will fire immediately. + * cbf Callback to call when event fires. + * args Arguments to pass to callback function. + * interval How often the event should repeat, in seconds. If 0, + * the event will only fire once. + */ +void +qio_schedule(time_t when, QIOTimerCBF cbf, void *args, int interval) +{ + QIO_EVENT *e; + struct timeval now_tv; + struct timeval when_tv; + struct timeval in_tv; + int hash; + + hash = (((unsigned int) (intptr_t) cbf) ^ ((unsigned int) (intptr_t) args)) % QIO_EVENT_HASH_SIZE; + + e = (QIO_EVENT*)gmalloc(sizeof(QIO_EVENT)); + + e->cbf = cbf; + e->args = args; + e->interval = interval; + e->next = qio_event_hash[hash]; + qio_event_hash[hash] = e; + + /* Figure out how long to wait until the scheduled time. */ + gettimeofday(&now_tv, NULL); + when_tv.tv_sec = when; + when_tv.tv_usec = 0; + timersub(&when_tv, &now_tv, &in_tv); + + evtimer_set(&e->ev, qio_event_timer, e); + evtimer_add(&e->ev, &in_tv); +} + +void qio_timeout_msec(int msec, QIOTimerCBF cbf, void *args) { + QIO_EVENT *e; + struct timeval in_tv; + int hash; + + hash = (((unsigned int) (intptr_t) cbf) ^ ((unsigned int) (intptr_t) args)) % QIO_EVENT_HASH_SIZE; + + e = (QIO_EVENT*)gmalloc(sizeof(QIO_EVENT)); + + e->cbf = cbf; + e->args = args; + e->interval = 0; + e->next = qio_event_hash[hash]; + qio_event_hash[hash] = e; + + in_tv.tv_sec = msec / 1000; + in_tv.tv_usec = (msec % 1000) * 1000; + + evtimer_set(&e->ev, qio_event_timer, e); + evtimer_add(&e->ev, &in_tv); +} + + +/* + * Cancels a scheduled or recurring timer event. + * + * Parameters: + * cbf Callback supplied to qio_schedule() or + * qio_schedule_recurring(). + * args Arguments supplied to qio_schedule(). If NULL, + * all callbacks associated with cbf are cancelled. + */ +void qio_cancel(QIOTimerCBF cbf, void *args) +{ + qio_event_remove(cbf, args, NULL); +} + + +/* + * Main loop. Waits for data on all registered file descriptors and + * calls callback functions as needed. + * + * Return values: + * -1 qio_init() wasn't called. + * 0 Not monitoring any file descriptors. + * 1 qio_stop() was called by a callback function. + */ +int +qio_main() +{ + if (qios == NULL) + return -1; + if (event_dispatch() < 0) + return -1; + return 0; +} + + +/* + * A file descriptor has become readable. Call the application callback. + */ +static void +qio_readable(int fd, short event, void *arg) +{ + QIO *q = &qios[(intptr_t)arg]; + + (q->readCBF)(fd, q->args); +} + +/* + * A file descriptor has become writable. If we're managing its writes (the + * typical case), write any pending output. If not, call the application's + * write callback. + */ +static void +qio_writable(int fd, short event, void *arg) +{ + QIO *q = &qios[(intptr_t)arg]; + + if (q->writeCBF != NULL) + { + event_del(q->writeEvent); + if ((q->writeCBF)(fd, q->args) == 0) { + q->watchingWrite = 0; + } else { + // we do this little dance because the cbf might want to add + // it's own write event. Therefore, we can't delete t after + // the cb. + event_add(q->writeEvent, NULL); + } + } + else if (qio_write_queued(fd)) + { + /* Tell the app we got a write error, and remove the fd. */ + (q->closeCBF)(fd, QIO_CLOSE_REMOTE, q->args); + qio_remove(fd); + } +} + + +/* + * Adjusts after a fork() call. Call this in the child process. + */ +void qio_forked() +{ + qio_poll_forked(); +} + + +/* + * Stops the main loop. This may have a delayed effect if called from a + * second thread. + */ +void qio_stop() +{ + int fd; + + for (fd = 0; fd < qios_size; fd++) + { + if (qios[fd].fd > -1) + { + event_del(qios[fd].readEvent); + event_del(qios[fd].writeEvent); + qios[fd].watchingWrite = 0; + gfree(qios[fd].readEvent); + gfree(qios[fd].writeEvent); + } + } + + qio_event_remove(NULL, NULL, NULL); +} + +/* + * Cleans up after the queued I/O module, freeing all resources. + */ +void qio_cleanup() +{ + if (qio_init_count == 1) + { + /* Do any necessary cleanup here. */ + qio_init_count = 0; + } + else if (qio_init_count > 1) + qio_init_count--; +} + + +/* + * Dumps some statistics about the QIO subsystem. + */ +void qio_dump_stats(int fd) +{ + unsigned long long total_buf = 0; + unsigned long total_fds = 0; + unsigned long i; + char buf[300]; + for (i = 0; (int)i < qios_size; i++) + { + if (qios[i].fd != -1) + { + sprintf(buf, "STAT QIO: fd %ld count %d size %d\n", + i, qios[i].outputCount, qios[i].outputSize); + qio_write(fd, buf, strlen(buf)); + total_fds++; + } + total_buf += qios[i].outputSize; + } + + sprintf(buf, "STAT QIO: total fds %lu total buf %llu\n", total_fds, total_buf); + qio_write(fd, buf, strlen(buf)); +} + + +#ifdef UNIT_TEST + +#include + +/* + * Unit test opens a server socket, connects two client sockets to it, and + * sends an outrageous amount of data in both directions on both connections. + * The read callback reads a byte at a time to force the library to queue. + * + * TODO: + * + * Test closing a socket from inside a callback. + * Test forcing a write error, e.g. by calling shutdown() on the sly. + * Test overrunning the output buffer. + */ + +static char dummy[1024]; + +static void +sigint(int dummy) +{ + qio_stop(); +} + +static void +read_cbf(int fd, void *args) +{ + char c; + + if (read(fd, &c, 1) < 1) + { + printf("Can't read 1 byte from fd %d\n", fd); + throw HPHP::Exception("exit with %d", 1); + } + + if (c > 0) + { + printf("Got stop byte %d on fd %d\n", c, fd); + qio_stop(); + } +} + +static void +close_cbf(int fd, int type, void *args) +{ + printf("close_cbf(%d, %d)\n", fd, type); +} + +static void +server_read_cbf(int fd, void *args) +{ + int newfd = accept(fd, NULL, NULL); + int i; + + printf("accepted new fd %d\n", newfd); + if (newfd >= 0) + { + qio_add(newfd, read_cbf, close_cbf, NULL); + for (i = 0; i < 256; i++) + qio_write(newfd, dummy, sizeof(dummy)); + } +} + +static int do_stop = 0; + +static void +timer_cbf(void *args) +{ + printf("timer_cbf(%s)\n", args); + if (((char *)args)[0] == '2') + do_stop = 1; + else if (do_stop) + { + printf("canceling\n"); + qio_cancel(timer_cbf, args); + } +} + + +main(int argc, char **argv) +{ + int cfd1, cfd2, server_fd; + int i; + char c = 1; + int port = (getpid() % 5000) + 15000; + + signal(SIGINT, sigint); + + memset(dummy, 0, sizeof(dummy)); + qio_init(); + + qio_schedule(0, timer_cbf, "1", 1); + qio_schedule(time(NULL) + 5, timer_cbf, "2", 0); + + server_fd = serversock(port); + if (server_fd < 0) + { + perror("server socket"); + throw HPHP::Exception("exit with %d", 1); + } + printf("Server fd %d\n", server_fd); + qio_add(server_fd, server_read_cbf, close_cbf, NULL); + + cfd1 = clientsock("localhost", port); + if (cfd1 < 0) + { + perror("client socket"); + throw HPHP::Exception("exit with %d", 1); + } + printf("Client fd1 %d\n", cfd1); + qio_add(cfd1, read_cbf, close_cbf, NULL); + + cfd2 = clientsock("localhost", port); + if (cfd2 < 0) + { + perror("client socket"); + throw HPHP::Exception("exit with %d", 1); + } + printf("Client fd2 %d\n", cfd2); + qio_add(cfd2, read_cbf, close_cbf, NULL); + + for (i = 0; i < 256; i++) + { + qio_write(cfd1, dummy, sizeof(dummy)); + qio_write(cfd2, dummy, sizeof(dummy)); + } + + qio_write(cfd1, &c, 1); + + printf("qio_main() returned %d\n", qio_main()); + printf("Done\n"); + + qio_cleanup(); +} + +#endif diff --git a/src/util/mcproxy/qio.h b/src/util/mcproxy/qio.h new file mode 100644 index 0000000000000..3d7a76fff08a3 --- /dev/null +++ b/src/util/mcproxy/qio.h @@ -0,0 +1,241 @@ +/* + * Declarations and definitions for queued I/O module. + * + * Copyright (c) 2004-2005, Steven Grimm. + */ +#ifndef _QIO_H_ +#define _QIO_H_ 1 + +#include "include.h" + +/* + * When data can be read from a monitored socket, a callback function for + * that socket is called. + * + * Parameters: + * fd File descriptor to read. + * args Caller-defined opaque pointer. + * + * The function may call qio_remove() or qio_add() if needed, e.g. if + * an error occurs and the socket needs to be closed. + */ +typedef void (*QIOReadCBF)(int fd, void *args); + + +/* + * When data can be written to a monitored socket, a callback function for + * that socket is called. This is generally only used for nonblocking + * connects since usually qio will handle writing. + * + * Parameters: + * fd File descriptor to write. + * args Caller-defined opaque pointer. + * Returns: + * 0 No more data to write for now (call qio_add_write again to + * turn write checking back on). + * 1 Call the callback again when the descriptor is writable. + * + * The function may call qio_remove() or qio_add() if needed, e.g. if + * an error occurs and the socket needs to be closed. + */ +typedef int (*QIOWriteCBF)(int fd, void *args); + + +/* + * When a scheduled timer event occurs, its callback function is called. + * + * Parameters: + * args Caller-defined opaque pointer. + */ +typedef void (*QIOTimerCBF)(void *args); + + +/* + * When all the data has been flushed to a file descriptor after a call + * to qio_flush(), a callback function is called. + * + * Parameters: + * fd File descriptor that has finished flushing. + * args Caller-defined opaque pointer. + */ +typedef void (*QIOFlushCBF)(int fd, void *args); + + +/* + * When an error occurs on a monitored socket, a callback function for + * that socket is called. The callback does *not* need to call qio_remove(); + * the socket is automatically removed. + * + * Parameters: + * fd File descriptor to read. + * code Close code. + * args Caller-defined opaque pointer. + */ +typedef void (*QIOCloseCBF)(int fd, int code, void *args); + +/* QIOCloseCBF error code: Too many bytes queued for output. */ +#define QIO_CLOSE_FULL 1 + +/* QIOCloseCBF error code: Remote side closed connection. */ +#define QIO_CLOSE_REMOTE 2 + +/* QIOCloseCBF error code: Local side closed connection. */ +#define QIO_CLOSE_LOCAL 3 + + +/* + * Initializes the queued I/O module. Must be called before any other QIO + * functions are called. + */ +void qio_init(); + +/* + * Registers a file descriptor with the queued I/O module. + * + * Parameters: + * fd File descriptor to register. + * read_cbf Function to call when data arrives. + * close_cbf Function to call when socket shuts down. + * args Additional information to pass to callback function. + * + * Return value: + * 0 File descriptor registered successfully. + * EBADF Bad file descriptor. + */ +int qio_add(int fd, QIOReadCBF read_cbf, QIOCloseCBF close_cbf, void *args); + +/* + * Registers a file descriptor with the queued I/O module, but lets the + * application handle writing. + * + * Parameters: + * fd File descriptor to register. + * read_cbf Function to call when data arrives. + * write_cbf Function to call when descriptor is writable. + * close_cbf Function to call when socket shuts down. + * args Additional information to pass to callback function. + * + * Return value: + * 0 File descriptor registered successfully. + * EBADF Bad file descriptor. + */ +int qio_add_write(int fd, QIOReadCBF read_cbf, QIOWriteCBF write_cbf, + QIOCloseCBF close_cbf, void *args); + +/* + * Removes a file descriptor from the queued I/O module. Note that this + * does not affect the file descriptor; it's up to the caller to close it + * if needed. + * + * Parameters: + * fd File descriptor to unregister. + */ +void qio_remove(int fd); + +/* + * Closes a file descriptor and removes it from the queued I/O module. + * This causes the descriptor's close callback, if any, to be called. + * + * Parameters: + * fd File descriptor to close. + */ +void qio_close(int fd); + +/* + * Writes to a qio-controlled file descriptor. Use this instead of writing + * directly using system calls, or there's no point using QIO! + * + * The actual write may be deferred; if an error occurs, the close callback + * function is called. + * + * Parameters: + * fd File descriptor to write to. + * data Address of buffer to write. + * length Number of bytes to write. + */ +void qio_write(int fd, const void *data, int length); + +/* + * Flushes pending output on a file descriptor. When the flush is complete, + * the specified callback function is called. + * + * Parameters: + * fd File descriptor to write to. + * flush_cbf Callback to call when flush finishes. + */ +void qio_flush(int fd, QIOFlushCBF flush_cbf); + +/* + * Schedules a timer to fire at a particular time. + * + * Parameters: + * when When the event should fire. If this is in the past + * (e.g. 0) the timer will fire immediately. + * cbf Callback to call when event fires. + * args Arguments to pass to callback function. + * interval How often the event should repeat, in seconds. If 0, + * the event will only fire once. + */ +void +qio_schedule(time_t when, QIOTimerCBF cbf, void *args, int interval); + +/* + * Cancels a timer event. + * + * Parameters: + * cbf Callback supplied to qio_schedule(). + * args Arguments supplied to qio_schedule(). If NULL, + * all callbacks associated with cbf are cancelled. + */ +void qio_cancel(QIOTimerCBF cbf, void *args); + +/* + * Enables or disables immediate write attempts on a qio file descriptor. + * If you're writing lots of little buffers that don't need to be delivered + * until control returns to qio_main(), you should disable immediate writing + * since it can result in additional network overhead. + * + * Parameters: + * fd File descriptor to control. + * enable Nonzero to enable immediate writing. + */ +void qio_enable_immediate(int fd, int enable); + +/* + * Returns the opaque argument pointer for a particular file descriptor. + * + * Parameters: + * fd File descriptor to query. + */ +void *qio_get_opaque(int fd); + +/* + * Main loop. Waits for data on all registered file descriptors and + * calls callback functions as needed. + * + * Return values: + * -1 qio_init() wasn't called. + * 0 Not monitoring any file descriptors. + * 1 qio_stop() was called by a callback function. + */ +int qio_main(); + +/* + * Stops the main loop. This may have a delayed effect if called from a + * second thread. + */ +void qio_stop(); + +/* + * Cleans up after the queued I/O module, freeing all resources. + */ +void qio_cleanup(); + +/* + * Dumps QIO stats to the provided file descriptor. + */ + +void qio_dump_stats(int fd); + +void qio_timeout_msec(int msec, QIOTimerCBF cbf, void *args); +#endif diff --git a/src/util/mcproxy/qlio.cpp b/src/util/mcproxy/qlio.cpp new file mode 100644 index 0000000000000..86fa78d539e32 --- /dev/null +++ b/src/util/mcproxy/qlio.cpp @@ -0,0 +1,249 @@ + +/* + * Line-buffered queued I/O module. A layer on top of the qio module that + * provides line-at-a-time input. + * + * Copyright (c) 2004-2005, Steven Grimm. + */ +#include "qio.h" +#include "qlio.h" +#include "gfuncs.h" + +/* + * Each file descriptor we're handling has one of these structures to hold + * its metadata and partial input. + */ +typedef struct { + int fd; /* Which file descriptor is this? */ + QLIOReadCBF readCBF; /* Function to call on line arrival. */ + QLIOCloseCBF closeCBF; /* Function to call on error/EOF. */ + void *args; /* Client-supplied context. */ + + char *inbuf; /* Buffer for partial input. */ + int inbufSize; /* Size of input buffer. */ + int inbufCount; /* Number of bytes received so far. */ + + int binarySize; /* Number of binary bytes required. */ + int inReadCBF; /* Are we calling a read callback? */ + int closed; +} QLIO; + + +static void qlio_cleanup(QLIO *qlio); + +/* + * Ensures that we have a minimum number of bytes of free space in an input + * buffer. + */ +static int +ensure_buffer(QLIO *qlio, int bytes) +{ + char *buf; + + if (qlio->inbufSize - qlio->inbufCount >= bytes) + return 0; + if (qlio->inbuf == NULL) + buf = (char*)gmalloc_data(bytes); + else + buf = (char*)grealloc(qlio->inbuf, bytes + qlio->inbufSize); + + qlio->inbuf = buf; + qlio->inbufSize += bytes; + return 0; +} + + +/* + * Reads input from a ready descriptor. If the input contains one or more + * complete lines, pass them to the application. + */ +static void +qlio_read(int fd, void *args) +{ + QLIO *qlio = (QLIO *) args; + int bytesread; + int pos = 0; + char *c; + + if (ensure_buffer(qlio, 512)) + return; + bytesread = read(fd, qlio->inbuf + qlio->inbufCount, + qlio->inbufSize - qlio->inbufCount - 1); + if (bytesread <= 0) + { + qlio->inbuf[qlio->inbufCount] = '\0'; + qio_close(fd); + return; + } + + qlio->inbufCount += bytesread; + qlio->inbuf[qlio->inbufCount] = '\0'; + + do { + /* + * If we're waiting for binary data, pass it to the caller when + * the requested number of bytes have accumulated. + */ + while (qlio->binarySize > 0) + { + if (qlio->inbufCount - pos >= qlio->binarySize) + { + int startPos = pos; + pos += qlio->binarySize; + qlio->binarySize = 0; + qlio->inReadCBF++; + (qlio->readCBF)(fd, qlio->inbuf + startPos, qlio->args); + qlio->inReadCBF--; + + if (qlio->closed) + break; + } + else + break; + } + + if (qlio->binarySize > 0 || qlio->closed) + break; + + c = strchr(qlio->inbuf + pos, '\n'); + if (c != NULL) + { + *c = '\0'; + + /* If this line was \r\n terminated, lose the \r too. */ + if (c > (qlio->inbuf + pos) && *(c-1) == '\r') + *(c-1) = '\0'; + + if (qlio->readCBF != NULL) + { + qlio->inReadCBF++; + (qlio->readCBF)(fd, qlio->inbuf + pos, + qlio->args); + qlio->inReadCBF--; + + if (qlio->closed) + break; + } + + pos = c + 1 - qlio->inbuf; + } + else + { + break; + } + } while (pos < qlio->inbufCount); + + if (qlio->closed) + qlio_cleanup(qlio); + else + { + if (qlio->inbufCount != pos) + { + memmove(qlio->inbuf, qlio->inbuf + pos, + qlio->inbufCount - pos); + } + qlio->inbufCount -= pos; + } +} + + +/* + * Handles closure of a descriptor. + */ +static void +qlio_close(int fd, int code, void *args) +{ + QLIO *qlio = (QLIO *) args; + + if (code != QIO_CLOSE_LOCAL) + close(fd); + if (qlio->closeCBF != NULL) + { + if (qlio->inbufCount > 0) + { + ensure_buffer(qlio, 1); + qlio->inbuf[qlio->inbufCount] = '\0'; + (qlio->closeCBF)(fd, code, qlio->inbuf, qlio->args); + } + else + { + (qlio->closeCBF)(fd, code, NULL, qlio->args); + } + } + + if (qlio->inReadCBF) + qlio->closed = 1; + else + qlio_cleanup(qlio); +} + + +/* + * Cleans up after closure of a descriptor. If the application calls qio_close() + * in one of our read callbacks, this is deferred until after the callback + * returns. + */ +static void +qlio_cleanup(QLIO *qlio) +{ + if (qlio->inbuf != NULL) + gfree(qlio->inbuf); + gfree(qlio); +} + + +/* + * Registers a file descriptor with the qlio module. + * + * Parameters: + * fd File descriptor to register. + * read_cbf Function to call when data arrives. + * close_cbf Function to call when socket shuts down. + * args Additional information to pass to callback function. + * + * Return value: + * 0 File descriptor registered successfully. + * EBADF Bad file descriptor. + * ENOMEM Out of memory. + */ +int +qlio_add(int fd, QLIOReadCBF read_cbf, QLIOCloseCBF close_cbf, void *args) +{ + QLIO *qlio; + int status; + + qlio = (QLIO*)gcalloc(sizeof(QLIO)); + qlio->fd = fd; + qlio->readCBF = read_cbf; + qlio->closeCBF = close_cbf; + qlio->args = args; + + /* Register this FD with the QIO module. */ + status = qio_add(fd, qlio_read, qlio_close, qlio); + if (status) + { + gfree(qlio); + return status; + } + + return 0; +} + +/* + * Waits for a certain amount of binary data to accumulate, then calls the + * read callback function with that data. + * + * Parameters: + * fd File descriptor to update. + * bytes Number of bytes of data to wait for. + */ +int +qlio_expect_binary(int fd, int bytes) +{ + QLIO *qlio; + + qlio = (QLIO *) qio_get_opaque(fd); + if (qlio != NULL) + qlio->binarySize = bytes; + return 0; +} diff --git a/src/util/mcproxy/qlio.h b/src/util/mcproxy/qlio.h new file mode 100644 index 0000000000000..c4a43680e1294 --- /dev/null +++ b/src/util/mcproxy/qlio.h @@ -0,0 +1,61 @@ +/* + * Declarations and definitions for line-buffered queued I/O module. + * + * Copyright (c) 2004-2005, Steven Grimm. + */ +#ifndef _QLIO_H_ +#define _QLIO_H_ 1 + +#include "include.h" + +/* + * When a line has been read from a monitored socket, a callback function for + * that socket is called. + * + * Parameters: + * fd File descriptor to read. + * line Null-terminated input line. + * args Caller-defined opaque pointer. + */ +typedef void (*QLIOReadCBF)(int fd, char *line, void *args); + + +/* + * When an error occurs on a monitored socket, a callback function for + * that socket is called. The socket is closed automatically. + * + * Parameters: + * fd File descriptor to read. + * code QIO close code. + * line Partial input line at close time, or NULL if none. + * args Caller-defined opaque pointer. + */ +typedef void (*QLIOCloseCBF)(int fd, int code, char *line, void *args); + +/* + * Registers a file descriptor with the line-buffered queued I/O module. + * + * Parameters: + * fd File descriptor to register. + * read_cbf Function to call when data arrives. + * close_cbf Function to call when socket shuts down. + * args Additional information to pass to callback function. + * + * Return value: + * 0 File descriptor registered successfully. + * EBADF Bad file descriptor. + * ENOMEM Out of memory. + */ +int qlio_add(int fd, QLIOReadCBF read_cbf, QLIOCloseCBF close_cbf, void *args); + +/* + * Waits for a certain amount of binary data to accumulate, then calls the + * read callback function with that data. + * + * Parameters: + * fd File descriptor to update. + * bytes Number of bytes of data to wait for. + */ +int qlio_expect_binary(int fd, int bytes); + +#endif diff --git a/src/util/mcproxy/request.cpp b/src/util/mcproxy/request.cpp new file mode 100644 index 0000000000000..4de37f60cec82 --- /dev/null +++ b/src/util/mcproxy/request.cpp @@ -0,0 +1,786 @@ +/* + * Request queue module. + */ +#include "proxy.h" +#include "request_int.h" +#include "stats.h" +#include "server.h" +#include "gfuncs.h" + +/* Externs to return status request information */ +extern char* latest_config; +extern int latest_config_len; +extern char* latest_config_file; +extern char* latest_config_server; +extern time_t last_config_update_time; + +/* Freelist of REQUEST *, faster than reallocing even with GC enabled. */ +static REQUEST_LIST *freelist; + +/* + * Disposes of a request. + */ +void +request_free(REQUEST *vreq) +{ + REQUEST_IMPL *req = (REQUEST_IMPL *) vreq; + + if (req != NULL) + { + uint32_t i; + + for (i = 0; i < req->nkeys; i++) + gfree(req->keys[i]); + gfree(req->response); + gfree(req->command); + gfree(req->data); + req->response = NULL; + + request_list_add(freelist, (REQUEST *) req); + } +} + + +/* + * Handle a response to a request that doesn't fetch any data. + */ +static int +request_done(REQUEST *vreq, char *line) +{ + REQUEST_IMPL *req = (REQUEST_IMPL *) vreq; + + if (req->response != NULL) + gfree(req->response); + req->response = gstrdup_const(line); + req->status = FinalResult; + (req->cbf)(vreq, req->arg); + + return 0; +} + + +/* + * Handle a response to a data retrieval command. + * + * Returns 1 if we're still waiting for more input. + */ +static int +request_get_input(REQUEST *vreq, char *line) +{ + REQUEST_IMPL *req = (REQUEST_IMPL *) vreq; + int response_len; + int need_more = 1; + + /* Is this an information line? */ + if (req->response == NULL) + { + response_len = strlen(line); + req->response = gstrdup(line); + + /* + * For internally generated responses like the SERVER_ERROR + * we return when we lose connectivity to memcached, + * "line" can be a string constant in read-only memory. + * So we use strncmp() to figure out the response code rather + * than splitting line up using strtok(). + */ + if (! strncmp(line, "END", 3)) + { + req->status = FinalResult; + (req->cbf)(vreq, req->arg); + need_more = 0; + } + else if (! strncmp(line, "VALUE ", 6)) + { + char *key, *flags = NULL, *bytes = NULL; + + key = strtok(line + 6, " "); + if (key != NULL) + flags = strtok(NULL, " "); + if (flags != NULL) + bytes = strtok(NULL, " "); + + if (bytes != NULL) + { + req->bytes = atoi(bytes); + req->data = grealloc(req->data, req->total + + req->bytes + + response_len + 4); + memcpy((char*)req->data + req->total, req->response, + response_len); + req->total += response_len; + memcpy((char*)req->data + req->total, "\r\n", 2); + req->total += 2; + + server_expect_bytes(req->server, + req->bytes + 2); + } + else + { + HPHP::Logger::Error("Malformed server response %s", + req->response); + req->status = Error; + (req->cbf)(vreq, req->arg); + req->ignore = 1; + + gfree(req->response); + req->response = NULL; + + need_more = 0; + } + } + else if (!strncmp("SERVER_ERROR", line, 12)) + { + req->status = Error; + req->data = grealloc(req->data, response_len + 4); + + memcpy(req->data, line, response_len); + req->total = response_len; + memcpy((char*)req->data + req->total, "\r\n", 2); + req->total += 2; + + (req->cbf)(vreq, req->arg); + req->ignore = 1; + + gfree(req->response); + req->response = NULL; + + need_more = 0; + } + else + { + HPHP::Logger::Error("Unrecognized server response %s", req->response); + req->status = Error; + (req->cbf)(vreq, req->arg); + req->ignore = 1; + + gfree(req->response); + req->response = NULL; + + need_more = 0; + } + } + else + { + /* + * If the request is resulting an error, we would never have + * allocated req->data. We'll be ignoring the request anyway, + * so there's no need to attempt to copy the data over. + */ + if (req->status != Error) { + /* + * It's the data for a get request. We've already allocated + * buffer space. The "+2" is for the trailing \r\n. + */ + memcpy((char*)req->data + req->total, line, req->bytes + 2); + req->total += req->bytes + 2; + } + + gfree(req->response); + req->response = NULL; + } + + return need_more; +} + + +/* + * Allocates a new request. + */ +static REQUEST_IMPL * +request_new(REQUEST_TYPE type, + const char **keys, + uint32_t nkeys, + void *data, + uint32_t bytes, + uint32_t expiration, + REQUEST_CBF cbf, + void *arg) +{ + REQUEST_IMPL *req; + uint32_t i; + + req = (REQUEST_IMPL *) request_list_next(freelist); + if (req == NULL) + req = (REQUEST_IMPL*)gcalloc(sizeof(REQUEST_IMPL)); + + if (keys != NULL) + { + /* Reuse the keys array from the freelist if we can. */ + if (nkeys > req->nkeys_alloced) + { + req->keys = (char**)grealloc(req->keys, sizeof(char *) * nkeys); + req->nkeys_alloced = nkeys; + } + for (i = 0; i < nkeys; i++) + req->keys[i] = gstrdup_const(keys[i]); + for (; i < req->nkeys_alloced; i++) + req->keys[i] = NULL; + } + + req->response = NULL; + req->server = NULL; + req->type = type; + req->command = NULL; + req->command_len = 0; + req->cbf = cbf; + req->arg = arg; + req->nkeys = nkeys; + req->data = data; + req->bytes = bytes; + req->total = 0; + req->flags = 0; + req->expiration = expiration; + req->status = Pending; + req->input_cbf = request_done; + req->ignore = 0; + req->client_closed = 0; + + return req; +} + + +/* + * Constructor for all the data-storage requests, which look the same except + * for the command name. + */ +static REQUEST * +request_new_storage(REQUEST_TYPE type, const char *cmd, const char *key, + void *data, uint32_t bytes, uint32_t expiration, uint32_t flags, + REQUEST_CBF cbf, void *arg) +{ + REQUEST_IMPL *req = request_new(type, &key, 1, data, bytes, + expiration, cbf, arg); + char *format = "%s %s %u %u %u\r\n"; + + // allocate enough for the maximum lengths of all the fields, + // plus the trailing \r\n + req->command = (char*)gmalloc_data(strlen(key) + strlen(format) + 38); + + sprintf(req->command, format, cmd, key, flags, expiration, bytes); + req->command_len = strlen(req->command); + + req->data = data; + req->bytes = bytes; + + return (REQUEST *) req; +} + + +/* + * "Constructors" for different request types. + */ +REQUEST * +request_new_get(const char **keys, uint32_t nkeys, REQUEST_CBF cbf, void *arg) +{ + REQUEST_IMPL *req; + int i; + + req = request_new(Get, keys, nkeys, NULL, 0, 0, cbf, arg); + req->command_len = 5; // "get" + "\r\n" + for (i = 0; i < (int)nkeys; i++) + req->command_len += strlen(keys[i]) + 1; + + req->command = (char*)gmalloc_data(req->command_len); + strcpy(req->command, "get"); + req->command_len = 3; + for (i = 0; i < (int)nkeys; i++) + { + req->command[req->command_len++] = ' '; + strcpy(req->command + req->command_len, keys[i]); + req->command_len += strlen(keys[i]); + } + req->command[req->command_len++] = '\r'; + req->command[req->command_len++] = '\n'; + + req->input_cbf = request_get_input; + req->data = NULL; + req->response = NULL; + + stats_incr_cmdget_count(); + return (REQUEST *) req; +} + + +REQUEST * +request_new_set(const char *key, void *data, uint32_t bytes, + uint32_t expiration, uint32_t flags, REQUEST_CBF cbf, void *arg) +{ + return request_new_storage(Set, "set", key, data, bytes, + expiration, flags, cbf, arg); +} + +REQUEST * +request_new_add(const char *key, void *data, uint32_t bytes, + uint32_t expiration, uint32_t flags, REQUEST_CBF cbf, void *arg) +{ + return request_new_storage(Add, "add", key, data, bytes, + expiration, flags, cbf, arg); +} + +REQUEST * +request_new_replace(const char *key, void *data, uint32_t bytes, + uint32_t expiration, uint32_t flags, REQUEST_CBF cbf, void *arg) +{ + return request_new_storage(Replace, "replace", key, data, bytes, + expiration, flags, cbf, arg); +} + +REQUEST * +request_new_delete(const char *key, uint32_t expiration, REQUEST_CBF cbf, + void *arg) +{ + REQUEST_IMPL *req = request_new(Delete, &key, 1, NULL, 0, + expiration, cbf, arg); + char *format = "delete %s %u\r\n"; + req->command = (char*)gmalloc_data(strlen(key) + strlen(format) + 10); + + sprintf(req->command, format, key, expiration); + return (REQUEST *) req; +} + +REQUEST * +request_new_incr(const char *key, uint32_t amount, REQUEST_CBF cbf, void *arg) +{ + REQUEST_IMPL *req = request_new(Incr, &key, 1, NULL, 0, + amount, cbf, arg); + char *format = "incr %s %u\r\n"; + req->command = (char*)gmalloc_data(strlen(key) + strlen(format) + 10); + + sprintf(req->command, format, key, amount); + return (REQUEST *) req; +} + +REQUEST * +request_new_decr(const char *key, uint32_t amount, REQUEST_CBF cbf, void *arg) +{ + REQUEST_IMPL *req = request_new(Decr, &key, 1, NULL, 0, + amount, cbf, arg); + char *format = "decr %s %u\r\n"; + req->command = (char*)gmalloc_data(strlen(key) + strlen(format) + 10); + + sprintf(req->command, format, key, amount); + return (REQUEST *) req; +} + +REQUEST * +request_new_stats(REQUEST_CBF cbf, void *arg) +{ + return (REQUEST *) request_new(Stats, NULL, 0, NULL, 0, 0, cbf, arg); +} + +REQUEST * +request_new_flush_all(uint32_t timer, REQUEST_CBF cbf, void *arg) +{ + REQUEST_IMPL *req = request_new(FlushAll, NULL, 0, NULL, 0, + timer, cbf, arg); + req->command = (char*)gmalloc_data(24); /* flush_all xxxxxxxxxx\r\n\0 */ + if (timer) + sprintf(req->command, "flush_all %u\r\n", timer); + else + strcpy(req->command, "flush_all\r\n"); + + return (REQUEST *) req; +} + +REQUEST * +request_new_version(REQUEST_CBF cbf, void *arg) +{ + return (REQUEST *) request_new(Version, NULL, 0, NULL, 0, 0, cbf, arg); +} + +/* + * Returns a new "marker" request. This is used to mark the end of a related + * group of "get" requests in a client's request queue. + */ +REQUEST * +request_new_get_marker(REQUEST_CBF cbf, void *arg) +{ + REQUEST_IMPL *req = request_new(GetMarker, NULL, 0, NULL, 0, 0, cbf, + arg); + + req->response = gstrdup_const("END"); + req->status = FinalResult; + + return (REQUEST *) req; +} + +/* + * Returns a new "marker" request. This is used to mark the end of a related + * group of "flush_all" requests in the client's request queue. + */ +REQUEST * +request_new_flush_marker(REQUEST_CBF cbf, void *arg) +{ + REQUEST_IMPL *req = request_new(FlushMarker, NULL, 0, NULL, 0, 0, cbf, + arg); + + req->response = gstrdup_const("OK"); + req->status = FinalResult; + + return (REQUEST *) req; +} + +/* + * Returns a new "quit" request. Once this reaches the head of the client's + * request queue, we close the connection. + */ +REQUEST * +request_new_quit(REQUEST_CBF cbf, void *arg) +{ + REQUEST_IMPL *req = request_new(Quit, NULL, 0, NULL, 0, 0, cbf, arg); + req->status = FinalResult; + + return (REQUEST *) req; +} + +/* + * Returns a new "error" request, which spits out an error message to the client + * once we've finished processing its other requests. + */ +REQUEST * +request_new_error_marker(REQUEST_CBF cbf, char *response, void *arg) +{ + REQUEST_IMPL *req = request_new(ErrorMarker, NULL, 0, NULL, 0, 0, cbf, + arg); + req->status = FinalResult; + req->response = gstrdup_const(response); + + return (REQUEST *) req; +} + +REQUEST * +request_new_status_get(const char **keys, uint32_t nkeys) { + REQUEST_IMPL *req = (REQUEST_IMPL *)request_new_get(keys, nkeys, NULL, NULL); + int size; + int i; + char *response_data; + int response_len; + int is_status_key = 1; + int free_response = 0; + + int status_key_prefix_len = strlen(STATUS_KEY_PREFIX); + + int cluster; + + req->status = FinalResult; + req->data = NULL; + req->total = 0; + req->response = NULL; + + for (i=0; i < (int)nkeys; i++) { + /* 6 for "VALUE ", 2 for "0 " (flags), 10 for size, 2 for \r\n */ + size = 6 + strlen(keys[i]) + 2 + 10 + 2; + free_response = 0; + + if (strcmp(keys[i] + status_key_prefix_len, STATUS_KEY_CONFIG) == 0) { + response_data = latest_config; + + response_len = latest_config_len; + } + else if (strcmp(keys[i] + status_key_prefix_len, STATUS_KEY_FILE) == 0) { + if (latest_config_file == NULL) + response_data = ""; + else + response_data = latest_config_file; + + response_len = strlen(response_data); + } + else if (strcmp(keys[i] + status_key_prefix_len, STATUS_KEY_SERVER) == 0) { + if (latest_config_server == NULL) + response_data = ""; + else + response_data = latest_config_server; + + response_len = strlen(response_data); + } + else if (strncmp(keys[i] + status_key_prefix_len, STATUS_KEY_CLUSTER, strlen(STATUS_KEY_CLUSTER)) == 0) { + cluster = atoi(keys[i] + status_key_prefix_len + strlen(STATUS_KEY_CLUSTER)); + HPHP::Logger::Info("Retrieving status key %s cluster %d\n", keys[i], cluster); + + response_data = server_get_status_summary(cluster); + + response_len = strlen(response_data); + + free_response = 1; + } + else if (strcmp(keys[i] + status_key_prefix_len, STATUS_KEY_LAST_UPDATE) == 0) { + response_data = ctime(&last_config_update_time); + + response_len = strlen(response_data); + } + else { + is_status_key = 0; + } + + if (is_status_key) { + size += response_len + 2; + req->data = grealloc(req->data, req->total + size); + + req->total += sprintf((char*)req->data+req->total, "VALUE %s 0 %d\r\n", + keys[i], response_len); + + memcpy((char*)req->data + req->total, response_data, response_len); + req->total += response_len; + memcpy((char*)req->data + req->total, "\r\n", 2); + req->total += 2; + } + + if (free_response) { + gfree(response_data); + } + } + + return (REQUEST *) req; +} + +/* + * Returns a new asynchronous request. This type of request is not associated + * with a client, but does require a response from the server before it can + * be disposed. + */ +REQUEST * +request_new_async(REQUEST_CBF cbf, char *command, uint32_t offset, int reliable) +{ + REQUEST_IMPL *req = request_new(Async, NULL, 0, NULL, 0, offset, cbf, + NULL); + req->command = gstrdup_const(command); + req->command_len = strlen(req->command); + req->flags = reliable; + + return (REQUEST *) req; +} + +/* + * Returns a new asynchronous request with a payload. + */ +REQUEST * +request_new_async_data(REQUEST_CBF cbf, char *command, uint32_t offset, + void *data, uint32_t bytes, int reliable) +{ + REQUEST_IMPL *req = request_new(Async, NULL, 0, NULL, 0, offset, cbf, + NULL); + req->command = gstrdup_const(command); + req->command_len = strlen(req->command); + req->data = gmemdup_const((const char *)data, bytes); + req->bytes = bytes; + req->flags = reliable; + + return (REQUEST *) req; +} + + +REQUEST_STATUS +request_get_status(const REQUEST *vreq) +{ + return ((const REQUEST_IMPL *) vreq)->status; +} + +REQUEST_TYPE +request_get_type(const REQUEST *vreq) +{ + return ((const REQUEST_IMPL *) vreq)->type; +} + + +/* + * Returns the raw response line for this request. For "get" requests, this + * is just the initial information line; the data may be fetched using + * request_get_data() and request_get_bytes(). + */ +char * +request_get_response(const REQUEST *vreq) +{ + char * response = ((const REQUEST_IMPL *) vreq)->response; + if (((REQUEST_IMPL *) vreq)->type == Get + && !strncmp("VALUE", response, 5)) + { + stats_incr_get_hits(); + } + return response; +} + + +/* + * Returns the binary data associated with this request or, in the case of + * "get" requests, with the most recent response. + */ +void * +request_get_data(const REQUEST *vreq) +{ + return ((const REQUEST_IMPL *) vreq)->data; +} + + +/* + * Returns the length of the binary data associated with this request or, in + * the case of "get" requests, with the most recent response. + */ +uint32_t +request_get_bytes(const REQUEST *vreq) +{ + return ((const REQUEST_IMPL *) vreq)->bytes; +} + +/* + * Returns the total length of the response block (only meaningful for "get" + * requests). + */ +uint32_t +request_get_total(const REQUEST *vreq) +{ + return ((const REQUEST_IMPL *) vreq)->total; +} + + +/* + * Returns the command for this request. The command may include binary data, + * so callers should also call request_get_command_len(). + */ +void * +request_get_command(const REQUEST *vreq) +{ + return ((const REQUEST_IMPL *) vreq)->command; +} + + +/* + * Returns the number of bytes in the command for this request. + */ +uint32_t +request_get_command_len(REQUEST *vreq) +{ + REQUEST_IMPL *req = (REQUEST_IMPL *) vreq; + + if (req->command_len == 0) + req->command_len = strlen((char *)request_get_command(vreq)); + return req->command_len; +} + +/* + * Returns the first key for this request. + */ +char * +request_get_first_key(const REQUEST *vreq) +{ + const REQUEST_IMPL *req = (const REQUEST_IMPL *) vreq; + + if (req->nkeys == 0 || req->keys == NULL) + return NULL; + return req->keys[0]; +} + + +/* + * Returns the async store file offset for this request. + */ +uint32_t +request_get_offset(const REQUEST *vreq) +{ + const REQUEST_IMPL *req = (const REQUEST_IMPL *) vreq; + + // We reuse the "expiration" field for this, since there is no + // use for that field on an async request. + if (req->type == Async) + return req->expiration; + return OFFSET_NONE; +} + + +/* + * Returns the server for this request. + */ +MEMCACHED * +request_get_server(const REQUEST *vreq) +{ + return ((const REQUEST_IMPL *) vreq)->server; +} + + +/* + * Returns true if this request's client is no longer connected. + */ +int +request_is_client_closed(REQUEST *vreq) +{ + return ((REQUEST_IMPL *) vreq)->client_closed; +} + + +/* + * Marks this request as client-closed, so we won't try to send its response + * back to a client. If there is no response (because it's an internal marker + * request), frees the request. + */ +void +request_client_closed(REQUEST *vreq) +{ + if (request_is_internal(vreq)) + request_free(vreq); + else + ((REQUEST_IMPL *) vreq)->client_closed = 1; +} + + +/* + * Returns true if this request is an internal placeholder. + */ +int +request_is_internal(const REQUEST *vreq) +{ + switch (request_get_type(vreq)) { + case GetMarker: + case FlushMarker: + case Quit: + return 1; + + default: + return 0; + } +} + + +/* + * Sets the server this request has been sent to. + */ +void +request_set_server(REQUEST *vreq, MEMCACHED *server) +{ + ((REQUEST_IMPL *) vreq)->server = server; +} + + +/* + * Returns true if an asynchronous request is reliable. + */ +int +request_is_reliable_async(const REQUEST *vreq) +{ + const REQUEST_IMPL *req = (REQUEST_IMPL *)vreq; + + if (request_get_type(vreq) == Async && req->flags) + return 1; + return 0; +} + + +/* + * Handles a new input line from a server. + */ +int +request_handle_input(REQUEST *req, char *line) +{ + if (req != NULL) + return (((REQUEST_IMPL *) req)->input_cbf)(req, line); + return 0; +} + + +/* + * Initializes the request-handling module. + */ +void +request_init() +{ + freelist = request_list_new(); +} diff --git a/src/util/mcproxy/request.h b/src/util/mcproxy/request.h new file mode 100644 index 0000000000000..2a04792346c4c --- /dev/null +++ b/src/util/mcproxy/request.h @@ -0,0 +1,134 @@ +#ifndef __request_h__ +#define __request_h__ 1 + +#include "include.h" + +/* + * Special keys + */ + +#define STATUS_KEY_PREFIX "__mcproxy__." + +#define STATUS_KEY_CONFIG "config" +#define STATUS_KEY_FILE "config-file" +#define STATUS_KEY_SERVER "config-server" +#define STATUS_KEY_CLUSTER "cluster-status." +#define STATUS_KEY_LAST_UPDATE "last-config-update" + + +/* + * Request types. + */ +typedef enum { + Get, + Set, + Add, + Replace, + Delete, + Incr, + Decr, + Stats, + FlushAll, + Version, + GetMarker, + FlushMarker, + Quit, + ErrorMarker, + Async +} REQUEST_TYPE; + +/* + * Request status codes (as supplied to REQUEST_CBF functions). This does + * not indicate the status as returned by the remote server; it indicates + * the progress of the request internally. + */ +typedef enum { + Pending, + PartialResult, + FinalResult, + Error +} REQUEST_STATUS; + +/* + * Incoming request descriptor. (Dummy for type safety.) + */ +typedef struct { + char dummy1[123]; + int dummy2; +} REQUEST; + +/* + * List of requests. (Dummy for type safety.) + */ +typedef struct { + long dummy2; + char dummy1[93]; +} REQUEST_LIST; + + +/* + * Callbacks for request progress. + */ +typedef void (*REQUEST_CBF)(REQUEST *request, void *args); + +/* + * Request list management. + */ +extern REQUEST_LIST *request_list_new(); +extern void request_list_free(REQUEST_LIST *list); +extern REQUEST *request_list_next(REQUEST_LIST *list); +extern REQUEST *request_list_peek(REQUEST_LIST *list); +extern REQUEST *request_list_peek_tail(REQUEST_LIST *list); +extern void request_list_add(REQUEST_LIST *list, REQUEST *request); +extern void request_list_delete(REQUEST_LIST *list, void *args); +extern void request_list_init(); +/* + * "Constructors" for different request types. + */ +extern REQUEST *request_new_get(const char **keys, uint32_t nkeys, REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_set(const char *key, void *data, uint32_t bytes, uint32_t expiration, uint32_t flags, REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_add(const char *key, void *data, uint32_t bytes, uint32_t expiration, uint32_t flags, REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_replace(const char *key, void *data, uint32_t bytes, uint32_t expiration, uint32_t flags, REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_delete(const char *key, uint32_t expiration, REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_incr(const char *key, uint32_t amount, REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_decr(const char *key, uint32_t amount, REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_stats(REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_flush_all(uint32_t timer, REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_version(REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_flush_marker(REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_get_marker(REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_quit(REQUEST_CBF cbf, void *args); +extern REQUEST *request_new_error_marker(REQUEST_CBF cbf, char *msg, void *arg); +extern REQUEST *request_new_async(REQUEST_CBF cbf, char *cmd, uint32_t offset, int reliable); +extern REQUEST *request_new_async_data(REQUEST_CBF cbf, char *cmd, uint32_t offset, void *data, uint32_t bytes, int reliable); +extern REQUEST *request_new_status_get(const char **keys, uint32_t nkeys); + + +extern void request_free(REQUEST *req); + +/* + * Getters for various details about a request. + */ +extern REQUEST_STATUS request_get_status(const REQUEST *req); +extern REQUEST_TYPE request_get_type(const REQUEST *req); +extern MEMCACHED *request_get_server(const REQUEST *req); +extern char * request_get_response(const REQUEST *req); +extern void * request_get_command(const REQUEST *req); +extern uint32_t request_get_command_len(REQUEST *req); +extern void * request_get_data(const REQUEST *req); +extern uint32_t request_get_bytes(const REQUEST *req); +extern uint32_t request_get_total(const REQUEST *req); +extern int request_is_internal(const REQUEST *req); +extern int request_is_client_closed(REQUEST *vreq); +extern void request_client_closed(REQUEST *vreq); +extern char * request_get_first_key(const REQUEST *req); +extern void request_get_keys(const REQUEST *req, char **keys, uint32_t *nkeys); +extern uint32_t request_get_offset(const REQUEST *req); +extern int request_is_reliable_async(const REQUEST *vreq); + +extern int request_handle_input(REQUEST *req, char *line); +extern void request_set_offset(REQUEST *req, uint32_t offset); + +extern void request_init(); + +#endif /* __request_h__ */ diff --git a/src/util/mcproxy/request_int.h b/src/util/mcproxy/request_int.h new file mode 100644 index 0000000000000..bf010a7553d18 --- /dev/null +++ b/src/util/mcproxy/request_int.h @@ -0,0 +1,77 @@ +/* + * Internal declarations for request parsing module. + */ +#include "include.h" +#include "request.h" + +typedef int (*REQUEST_INPUT_CBF)(REQUEST *req, char *input); + +/* + * Outgoing request descriptor. + */ +typedef struct _request REQUEST_IMPL; +struct _request { + /* Which server this request was sent to. */ + MEMCACHED *server; + + REQUEST_TYPE type; + + /* Callback to call to handle input for this request. */ + REQUEST_INPUT_CBF input_cbf; + + /* Command to send to server, possibly including binary data. */ + char *command; + uint32_t command_len; + + /* Callback function and caller-supplied opaque argument. */ + REQUEST_CBF cbf; + void *arg; + + /* List of keys associated with this request. */ + char **keys; + uint32_t nkeys; + uint32_t nkeys_alloced; + + /* Data associated with this request. */ + void *data; + uint32_t bytes; + uint32_t total; // total length, for multiget responses + uint32_t flags; + + /* Most recent server response. */ + char *response; + + /* Expiration time for this request (Delete, Set/Add/Replace). */ + uint32_t expiration; + + /* Internal status. */ + REQUEST_STATUS status; + + /* True if this request's response should be ignored. */ + int ignore; + + /* True if this request's client is no longer connected. */ + int client_closed; +}; + + +/* + * List entry for a request. Since a request can appear in multiple servers' + * request lists, we can't just put a "next" link in REQUEST itself. + */ +typedef struct _request_entry REQUEST_ENTRY; +struct _request_entry { + REQUEST_IMPL *request; + REQUEST_ENTRY *next; +}; + +/* + * List of requests. + */ +typedef struct _request_list REQUEST_LIST_IMPL; +struct _request_list { + REQUEST_ENTRY *head; + REQUEST_ENTRY *tail; + uint32_t count; +}; + diff --git a/src/util/mcproxy/request_list.cpp b/src/util/mcproxy/request_list.cpp new file mode 100644 index 0000000000000..be954b7e856ad --- /dev/null +++ b/src/util/mcproxy/request_list.cpp @@ -0,0 +1,199 @@ +/* + * Request list management module. + */ +#include "proxy.h" +#include "request_int.h" +#include "gfuncs.h" + +/* List of REQUEST_ENTRY; faster than releasing and allocating, even with GC */ +static REQUEST_LIST_IMPL *freelist; + + +/* + * Returns a new request list. + */ +REQUEST_LIST * +request_list_new() +{ + return (REQUEST_LIST *) gcalloc(sizeof(REQUEST_LIST_IMPL)); +} + +/* + * Frees a request list. + */ +void +request_list_free(REQUEST_LIST *vlist) +{ + REQUEST_LIST_IMPL *list = (REQUEST_LIST_IMPL *)vlist; + + if (list->head != NULL) + { + HPHP::Logger::Verbose("Warning: freeing request list entries implicitly!"); + while (list->head != NULL) + { + REQUEST *req = request_list_next(vlist); + request_free(req); + } + } + + gfree(vlist); +} + + +/* + * Adds a REQEUST_ENTRY to a list. + */ +static void +request_list_add_entry(REQUEST_LIST_IMPL *list, REQUEST_ENTRY *entry) +{ + if (list->tail != NULL) + list->tail->next = entry; + else + list->head = entry; + list->tail = entry; + entry->next = NULL; + + list->count++; +} + + +/* + * Pops the next REQUEST_ENTRY off the head of a list. Does not add it + * to the freelist or free it! + */ +static REQUEST_ENTRY * +request_list_next_entry(REQUEST_LIST_IMPL *list) +{ + REQUEST_ENTRY *entry; + + if (list->head == NULL) + return NULL; + entry = list->head; + + list->head = entry->next; + if (list->head == NULL) + list->tail = NULL; + list->count--; + + return entry; +} + + +/* + * Pops the next entry off the head of a list. + */ +REQUEST * +request_list_next(REQUEST_LIST *vlist) +{ + REQUEST_LIST_IMPL *list = (REQUEST_LIST_IMPL *)vlist; + REQUEST_ENTRY *entry; + REQUEST_IMPL *request; + + if (list->head == NULL) + return NULL; + entry = request_list_next_entry(list); + request = entry->request; + + entry->request = NULL; + request_list_add_entry(freelist, entry); + + return (REQUEST *) request; +} + + +/* + * Returns the next entry off the head of a list, but doesn't remove it + * from the list. + */ +REQUEST * +request_list_peek(REQUEST_LIST *vlist) +{ + REQUEST_LIST_IMPL *list = (REQUEST_LIST_IMPL *)vlist; + + if (list->head == NULL) + return NULL; + return (REQUEST *) list->head->request; +} + + +/* + * Returns the entry at the tail of a list, but doesn't remove it + * from the list. + */ +REQUEST * +request_list_peek_tail(REQUEST_LIST *vlist) +{ + REQUEST_LIST_IMPL *list = (REQUEST_LIST_IMPL *)vlist; + + if (list->tail == NULL) + return NULL; + return (REQUEST *) list->tail->request; +} + + +/* + * Adds an entry to a list. + */ +void +request_list_add(REQUEST_LIST *vlist, REQUEST *vreq) +{ + REQUEST_LIST_IMPL *list = (REQUEST_LIST_IMPL *)vlist; + REQUEST_IMPL *request = (REQUEST_IMPL *) vreq; + REQUEST_ENTRY *entry; + + if (vlist == NULL) + { + HPHP::Logger::Error("Null request list"); + throw HPHP::Exception("abort"); + } + + entry = request_list_next_entry(freelist); + if (entry == NULL) + entry = (REQUEST_ENTRY *)gmalloc(sizeof(REQUEST_ENTRY)); + entry->request = request; + entry->next = NULL; + + request_list_add_entry(list, entry); +} + + +/* + * Removes all the entries from a list that have a given opaque argument. + */ +void +request_list_delete(REQUEST_LIST *vlist, void *arg) +{ + REQUEST_LIST_IMPL *list = (REQUEST_LIST_IMPL *)vlist; + REQUEST_ENTRY **nextptr; + + for (nextptr = &list->head; *nextptr != NULL;) + { + if ((*nextptr)->request->arg == arg) + { + REQUEST_ENTRY *entry = *nextptr; + *nextptr = entry->next; + request_free((REQUEST *) entry->request); + entry->request = NULL; + request_list_add_entry(freelist, entry); + } + else + { + nextptr = &(*nextptr)->next; + } + + if (*nextptr != NULL) + list->tail = *nextptr; + } + + if (list->head == NULL) + list->tail = NULL; +} + +/* + * Initializes the request list module. + */ +void +request_list_init() +{ + freelist = (REQUEST_LIST_IMPL *) request_list_new(); +} diff --git a/src/util/mcproxy/server.cpp b/src/util/mcproxy/server.cpp new file mode 100644 index 0000000000000..61b98e41bf5d6 --- /dev/null +++ b/src/util/mcproxy/server.cpp @@ -0,0 +1,820 @@ +/* + * Server management. + */ +#include "proxy.h" +#include "cluster.h" +#include "server_int.h" +#include "request_int.h" +#include "gfuncs.h" +#include "qio.h" +#include "qlio.h" +#include "crc32.h" + +extern int last_action; + +/* intentionally global, set from main */ +int server_timeout_msec = 1000; + +/* Global list of servers, sorted by IP address and port */ +static uint32_t nservers; +static uint32_t nservers_real; +static uint32_t nservers_up; +static MEMCACHED_IMPL **servers = NULL; + +static void server_try_connect(void *arg); +static void server_schedule_reconnect(MEMCACHED_IMPL *mcd); + +/* + * Returns true if a server is able to accept requests. + */ +int +server_is_up(MEMCACHED *mcd) +{ + return mcd != NULL && ((MEMCACHED_IMPL *)mcd)->status == Connected; +} + + +int +server_is_real(MEMCACHED *mcd) +{ + return (mcd != NULL && + ((MEMCACHED_IMPL *)mcd)->port >= 0 && + ((MEMCACHED_IMPL *)mcd)->port <= 65535); +} + + +/* + * Compares a MEMCACHED with a host/port pair. + */ +static int +mcdcmp(MEMCACHED_IMPL *mcd, const char *hostaddr, const int port, const int cluster) +{ + int cmp; + + cmp = strcmp(mcd->hostaddr, hostaddr); + if (cmp != 0) + return cmp; + if (mcd->port != port) + return mcd->port - port; + return mcd->cluster - cluster; +} + +/* + * Compares two MEMCACHEDs to see if they point to the same server. + */ +int +server_is_same(MEMCACHED *mc1, MEMCACHED *mc2) +{ + MEMCACHED_IMPL *mcd1 = (MEMCACHED_IMPL *) mc1; + MEMCACHED_IMPL *mcd2 = (MEMCACHED_IMPL *) mc2; + + if (mcd1->port != mcd2->port) + return 0; + return strcmp(mcd1->hostaddr, mcd2->hostaddr) == 0; +} + + +/* + * Looks up a server by textual IP address, port, and cluster. Finds the + * position in the list where the server should be found. Returns nonzero + * if we the server was in the list. + */ +static int +server_find_pos(const char *hostaddr, const int port, const int cluster, + int *pos) +{ + /* + * Since the number of servers is expected to remain fairly small, + * this is a simple binary search. If the server count gets high, + * change this to a hashtable. + */ + int max = nservers - 1, min = 0, middle = 0; + int cmp = 0; + + while (max >= min) + { + middle = (max + min) / 2; + cmp = mcdcmp(servers[middle], hostaddr, port, cluster); + + if (! cmp) + { + *pos = middle; + return 1; + } + else if (cmp < 0) + min = middle + 1; + else + max = middle - 1; + } + + /* + * If the current entry is less than the one we're looking for, + * we'd want to find the server in question in the next list entry. + */ + if (cmp < 0) + *pos = middle + 1; + else + *pos = middle; + return 0; +} + +/* + * Looks up a server by textual IP address, port, and cluster. + */ +MEMCACHED * +server_find(const char *hostaddr, const int port, const int cluster) +{ + int pos; + + if (server_find_pos(hostaddr, port, cluster, &pos)) + return (MEMCACHED *) servers[pos]; + return NULL; +} + + +/* + * Adds a new server to the list. + */ +static void +server_add(MEMCACHED_IMPL *mcd) +{ + int pos; + + if (server_find_pos(mcd->hostaddr, mcd->port, mcd->cluster, &pos)) + return; + + servers = (MEMCACHED_IMPL**)grealloc(servers, sizeof(MEMCACHED_IMPL *) * (nservers + 1)); + if (pos < (int)nservers) + memmove(servers + pos + 1, servers + pos, + sizeof(MEMCACHED_IMPL *) * (nservers - pos)); + + servers[pos] = mcd; + nservers++; + if (server_is_real((MEMCACHED*) mcd)) + nservers_real++; +} + +static void server_timeout(void* arg) { + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *)arg; + mcd->timeout_set = 0; + HPHP::Logger::Info("Server %s got a timeout while sending a request", mcd->description); + qio_close(mcd->fd); +} + +/* + * Input is available from a server. + */ +static void +server_read(int fd, char *line, void *args) +{ + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) args; + + /* + * Is this a response to an asynchronous request that has fallen off + * the end of our request queue? Ignore it if so. + */ + if (mcd->pending_async_drop_count) + { + mcd->pending_async_drop_count--; + goto handle_timeout; + } + + /* Is this the end of the response to the request? */ + if (request_handle_input(request_list_peek(mcd->request_list), + line) == 0) + { + /* Yes. Move on to the next one. */ + request_list_next(mcd->request_list); + } + + handle_timeout: + /* + * While any request is pending to the server, we ensure that the + * server sends us some sort of data at least once per second. In theory, + * a server could be evil and spoon feed us one byte at a time. However, + * we're assuming memcached isn't being completely evil. + */ + if (mcd->timeout_set) { + qio_cancel(server_timeout, mcd); + mcd->timeout_set = 0; + /* more requests are pending so we need another timeout. */ + if (request_list_peek(mcd->request_list)) { + qio_timeout_msec(server_timeout_msec, server_timeout, mcd); + mcd->timeout_set = 1; + } + } +} + + +/* + * A server connection attempt has failed. + */ +static void +server_connect_failed(int fd, void *args) +{ + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) args; + + if (mcd->status != Connecting) + { + HPHP::Logger::Error("Connect failed while not in Connecting state"); + throw HPHP::Exception("abort"); + } + + HPHP::Logger::Error("Server %s connection failed", mcd->description); + qio_close(fd); + + mcd->fd = -1; + server_schedule_reconnect(mcd); +} + + +/* + * Fail all the requests from clients that are pending on a server. Any + * pending asynchronous requests are requeued so they'll be sent when the + * server comes back online. + */ +static void +server_fail_client_requests(MEMCACHED_IMPL *mcd) +{ + REQUEST *tail = request_list_peek_tail(mcd->request_list); + REQUEST *req; + + if (tail != NULL) + { + do { + req = request_list_next(mcd->request_list); + if (NULL == req) + break; + if (request_is_reliable_async(req)) { + /* + * Requeue the request in the async queue, + * since it will have been marked as handled + * in the persistent store. + */ + server_do_request_async( + (MEMCACHED *)mcd, req, 1); + request_free(req); + } + else + request_handle_input(req, + "SERVER_ERROR Backing server lost"); + } while (req != tail); + } +} + +/* + * A server connection has closed. Fail all its pending requests and start + * trying to reconnect. (QIO callback) + */ +static void +server_close(int fd, int code, char *line, void *args) +{ + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) args; + + if (mcd->status != Connecting) + { + uint32_t i; + + for (i = 0; i < mcd->nprefixes; i++) + prefix_server_down(mcd->prefixes[i], (MEMCACHED *) mcd); + nservers_up--; + HPHP::Logger::Info("Server %s closed (%d of %d up)", mcd->description, + nservers_up, nservers); + } + + if (code != QIO_CLOSE_LOCAL) + close(fd); + + mcd->timeout_set = 0; + qio_cancel(server_timeout, mcd); + + mcd->fd = -1; + mcd->last_down_time = time(NULL); + + server_schedule_reconnect(mcd); // server status is reset here + + server_fail_client_requests(mcd); +} + + +/* + * A socket connection attempt has finished. + */ +static int +server_connected(int fd, void *args) +{ + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) args; + uint32_t i; + int v; + + for (i = 0; i < mcd->nprefixes; i++) + prefix_server_up(mcd->prefixes[i], (MEMCACHED *) mcd); + nservers_up++; + mcd->status = Connected; + set_nodelay(mcd->fd, 1); + + /* Make the connection time out aggressively so we don't leave + clients waiting for dead servers. */ + +#ifdef SO_KEEPALIVE + v = 1; + if (setsockopt(mcd->fd, SOL_SOCKET, SO_KEEPALIVE, &v, sizeof(v))) + { + HPHP::Logger::Error("Can't set keepalive on socket"); + } + +# ifdef TCP_KEEPCNT + /* 3 keepalive probes lost before dropping connection */ + v = 3; + if (setsockopt(mcd->fd, SOL_TCP, TCP_KEEPCNT, &v, sizeof(v))) + { + HPHP::Logger::Error("Can't set keepalive count on socket"); + } +# endif + +# ifdef TCP_KEEPIDLE + /* Start sending keepalives after 30 seconds of idle time */ + v = 30; + if (setsockopt(mcd->fd, SOL_TCP, TCP_KEEPIDLE, &v, sizeof(v))) + { + HPHP::Logger::Error("Can't set keepalive idle time on socket"); + } +# endif + +# ifdef TCP_KEEPINTVL + /* 10 seconds between keepalive probes */ + v = 10; + if (setsockopt(mcd->fd, SOL_TCP, TCP_KEEPINTVL, &v, sizeof(v))) + { + HPHP::Logger::Error("Can't set keepalive interval on socket"); + } + +# endif +#endif /* SO_KEEPALIVE */ + + HPHP::Logger::Info("Server %s (%d of %d) connected", mcd->description, + nservers_up, nservers_real); + + /* Let QIO handle write buffering for this connection. */ + qio_remove(fd); + qlio_add(fd, server_read, server_close, args); + + /* New connection, so there are no pending requests yet. */ + mcd->pending_async_drop_count = 0; + + /* If there are queued commands for this server, send them. */ + server_requeue_requests(mcd); + + return 0; +} + + +/* + * Tries to connect to a server. + */ +static void +server_try_connect(void *arg) +{ + int status; + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) arg; + time_t now = time(NULL); + + // if we've spent at least 60 seconds without input, do not try to + // reconnect. + if (now - last_action >= 60) + { + server_schedule_reconnect(mcd); + return; + } + + if (mcd->fd >= 0) + { + // This should be unreachable. server_try_connect only called on + // schedule and when status is Unitialized + HPHP::Logger::Info("Connection attempt already pending to %s. Not connecting. mcd->status: %d", + mcd->description, mcd->status); + return; + } + + mcd->last_connect_time = now; + status = clientsock_nb(mcd->hostaddr, mcd->port, &mcd->fd); + if (status > 0) + { + HPHP::Logger::Verbose("Connecting to %s", mcd->description); + mcd->status = Connecting; + qio_add_write(mcd->fd, server_connect_failed, server_connected, + NULL, mcd); + } + else if (status == 0) + { + server_connected(mcd->fd, mcd); + } + else + { + mcd->fd = -1; + HPHP::Logger::Error("Connect to %s failed to start", mcd->description); + server_schedule_reconnect(mcd); + } +} + + +/* + * Schedules a reconnect attempt to a server after some amount of time. + */ +static void +server_schedule_reconnect(MEMCACHED_IMPL *mcd) +{ + qio_schedule(time(NULL) + CONNECT_RETRY_INTERVAL, + server_try_connect, mcd, 0); + mcd->status = SleepingBetweenRetries; +} + + +/* + * Returns a server definition, allocating a new one if needed. Starts trying + * to connect to the server. + */ +MEMCACHED * +server_new(const char *hostname, const int port, const int cluster) +{ + MEMCACHED_IMPL *mcd; + char addr[100]; /* big enough for IPv6 */ + + host_to_addr(hostname, addr); + + if (addr[0] == '\0') + { + HPHP::Logger::Error(hostname); + return NULL; + } + + mcd = (MEMCACHED_IMPL *)server_find(addr, port, cluster); + if (mcd == NULL) + { + mcd = (MEMCACHED_IMPL*)gcalloc(sizeof(MEMCACHED_IMPL)); + mcd->hostaddr = gstrdup(addr); + mcd->hostname = gstrdup(hostname); + mcd->port = port; + mcd->status = Uninitialized; + mcd->fd = -1; + mcd->store_fd = -1; + mcd->request_list = request_list_new(); + mcd->prefixes = NULL; + mcd->nprefixes = 0; + mcd->cluster = cluster; + mcd->queued_async_size = 0; + mcd->pending_async_drop_count = 0; + + sprintf(addr, "%s(%s):%d", hostname, mcd->hostaddr, port); + mcd->description = gstrdup(addr); + + server_add(mcd); + + HPHP::Logger::Verbose("Added new server %s", mcd->description); + server_asyncstore_init(mcd); + } + + if (! server_is_real((MEMCACHED*) mcd)) { + mcd->status = Dummy; + } + + return (MEMCACHED *) mcd; +} + + +/* + * Returns the number of known servers. + */ +int +server_count() +{ + return nservers; +} + + +/* + * Returns a particular server from the list of servers. + */ +MEMCACHED * +server_number(int num) +{ + if (num < 0 || num >= (int)nservers) + return NULL; + return (MEMCACHED *) servers[num]; +} + + +/** + * Returns the server for a particular key. + */ +MEMCACHED * +server_for_key(const char *key, const int cluster) +{ + uint32_t hash; + uint32_t nmcds; + MEMCACHED_IMPL **mcds; + uint32_t num; + const CLUSTER_SERVERS * const cluster_servers = prefix_get_cluster_servers_for_key(key, + cluster); + + // We may not have any cluster servers yet if we are configuring/ + // re-configuring. + if(cluster_servers == NULL) { + return NULL; + } + + /* Look up the servers that can serve the key. */ + prefix_get_servers_for_cluster_servers(cluster_servers, + (MEMCACHED***)&mcds, &nmcds); + + if (0 == nmcds) + return NULL; + + if (cluster_servers->use_consistent_hashing) + { + // alas, we have to cast away const because the rest of the API + // doesn't declare it as so. + continuum_lookup_res_t retval; + + retval = continuum_lookup(key, strlen(key), nmcds); + if (retval.error_code != 0) + { + return NULL; + } + num = retval.server_num; + } + else + { + hash = crc32(key, strlen(key)) & 0x7fffffff; + num = hash % nmcds; + } + return (MEMCACHED *) mcds[num]; +} + + +/** + * Returns the server for a particular key if it's up. + */ +MEMCACHED * +server_for_key_uponly(const char *key, const int cluster) +{ + MEMCACHED *server = server_for_key(key, cluster); + time_t now; + time_t last_connect_time; + + if (server_is_up(server)) + return server; + + HPHP::Logger::Verbose("Server is down"); + + last_connect_time = server_get_last_connect_time(server); + + now = time(NULL); + + if(last_connect_time != 0 && + now - last_connect_time > 60) { + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *)server; + HPHP::Logger::Info("Server %s is down and hasn't attempted to reconnect in %ds.", + mcd->description, + now - last_connect_time); + + /* 0 last-connect-time so we don't keep logging this. */ + mcd->last_connect_time = 0; + } + return NULL; +} + +/* + * Sends a request to the server(s) that can serve it. + * + * Returns: + * 0 Request has been sent. + * -1 Server wasn't able to accept request. + */ +int +server_do_request(MEMCACHED *vmcd, REQUEST *req) +{ + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) vmcd; + void *data; + + if (vmcd && !server_is_real(vmcd)) { + HPHP::Logger::Error("Executing request with a dummy server!"); + return -1; + } + + if (server_is_up(vmcd)) + { + request_set_server(req, vmcd); + request_list_add(mcd->request_list, req); + qio_enable_immediate(mcd->fd, 0); + qio_write(mcd->fd, request_get_command(req), + request_get_command_len(req)); + data = request_get_data(req); + if (data != NULL) + { + qio_write(mcd->fd, data, request_get_bytes(req)); + qio_write(mcd->fd, "\r\n", 2); + } + qio_enable_immediate(mcd->fd, 1); + + if (!mcd->timeout_set) { + qio_timeout_msec(server_timeout_msec, server_timeout, mcd); + mcd->timeout_set = 1; + } + + return 0; + } + + return -1; +} + + +/* + * Expects some number of bytes from a server connection. + */ +void +server_expect_bytes(MEMCACHED *vmcd, uint32_t bytes) +{ + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) vmcd; + + if (mcd->fd != -1) + qlio_expect_binary(mcd->fd, bytes); +} + + +/* + * Adds a prefix to the server's list of prefixes. + */ +void +server_add_prefix(MEMCACHED *vmcd, PREFIX *prefix) +{ + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) vmcd; + + mcd->prefixes = (PREFIX**)grealloc(mcd->prefixes, + sizeof(PREFIX *) * (mcd->nprefixes + 1)); + mcd->prefixes[mcd->nprefixes++] = prefix; +} + + +/* + * Clears the prefixes from all the servers in preparation for a config reload. + */ +void +server_clear_prefixes() +{ + unsigned int i; + + for (i = 0; i < nservers; i++) + { + gfree(servers[i]->prefixes); + servers[i]->prefixes = NULL; + servers[i]->nprefixes = 0; + } +} + + +/* + * Starts trying to connect to all the servers that don't already have + * connections or pending connection attempts. + */ +void +server_connect_all(void) +{ + unsigned int i; + + for (i = 0; i < nservers; i++) + if (servers[i]->status == Uninitialized) + server_try_connect(servers[i]); +} + +static inline char *server_get_status_string(MEMCACHED_STATUS status) { + switch (status) { + case Uninitialized: + return "Uninitialized"; + case Connecting: + return "Connecting"; + case Connected: + return "Connected"; + case SleepingBetweenRetries: + return "SleepingBetweenRetries"; + case Dummy: + return "Dummy"; + default: + return "Unknown"; + + } +} + + +char * +server_get_status_summary(int cluster) { + unsigned int i; + + char *str = NULL; + char *status; + int len; + int size = 0; + + for (i=0; i < nservers; i++) { + if (servers[i]->cluster == cluster) { + len = strlen(servers[i]->description); + status = server_get_status_string(servers[i]->status); + len += strlen(status); + + // space and '\n' and '\0' + len += 3; + + str = (char*)grealloc(str, size+len); + + size += sprintf(str + size, "%s %s\n", servers[i]->description, status); + } + } + + return str; +} + + +void +server_disconnect(MEMCACHED *vmcd) +{ + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) vmcd; + + if (mcd->fd >= 0) + qio_close(mcd->fd); +} + + +void +server_disconnect_all(void) +{ + unsigned int i; + MEMCACHED_IMPL* mcd; + for (i = 0; i < nservers; i++) + { + mcd = (MEMCACHED_IMPL*) servers[i]; + qio_close(mcd->fd); + } +} + +double +server_average_queue_length() +{ + unsigned int i; + int totalLength = 0; + for (i = 0; i < nservers; i++) + { + MEMCACHED_IMPL * mcdi = servers[i]; + REQUEST_LIST_IMPL * listi = (REQUEST_LIST_IMPL*) mcdi->request_list; + + totalLength += (int) listi->count; + } + return ((double) totalLength) / nservers; +} + +int server_get_cluster(MEMCACHED *server) +{ + if (server == NULL) + return -1; + return ((MEMCACHED_IMPL *)server)->cluster; +} + +char *server_get_description(MEMCACHED *server) +{ + if (server == NULL) + return ""; + return ((MEMCACHED_IMPL *)server)->description; +} + +time_t server_get_last_down_time(MEMCACHED *server) +{ + if (server == NULL) + return 0; + return ((MEMCACHED_IMPL *)server)->last_down_time; +} + +time_t server_get_last_connect_time(MEMCACHED *server) +{ + if (server == NULL) + return 0; + return ((MEMCACHED_IMPL *)server)->last_connect_time; +} + +/* + * Sets the TCP "quick ack" option on the server connection, if available. + */ +void server_set_quickack(MEMCACHED *vmcd) +{ +#ifdef TCP_QUICKACK + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *)vmcd; + if (mcd != NULL && mcd->fd >= 0) + { + int one = 1; + if (setsockopt(mcd->fd, SOL_TCP, TCP_QUICKACK, + &one, sizeof(one))) + { + HPHP::Logger::Error("Can't set quickack on %s", + server_get_description(vmcd)); + } + } +#endif +} diff --git a/src/util/mcproxy/server.h b/src/util/mcproxy/server.h new file mode 100644 index 0000000000000..390a9a69d3437 --- /dev/null +++ b/src/util/mcproxy/server.h @@ -0,0 +1,40 @@ +#ifndef __server_h__ +#define __server_h__ 1 + +#include "include.h" +#include "request.h" + +#define OFFSET_NONE 0xffffffff + +extern MEMCACHED * server_new(const char *hostname, const int port, + const int cluster); +extern void server_connect_all(void); +extern char *server_get_status_summary(int cluster); +extern void server_disconnect(MEMCACHED *server); + +extern MEMCACHED *server_for_key_uponly(const char *key, const int cluster); +extern MEMCACHED *server_for_key(const char *key, const int cluster); +extern MEMCACHED *server_number(int num); + +extern int server_is_same(MEMCACHED *server1, MEMCACHED *server2); +extern int server_is_up(MEMCACHED *server); +extern int server_is_real(MEMCACHED *server); +extern int server_do_request(MEMCACHED *server, REQUEST *request); +extern void server_do_request_async(MEMCACHED *server, const REQUEST *request, int reliable); +extern void server_expect_bytes(MEMCACHED *server, uint32_t bytes); +extern int server_get_cluster(MEMCACHED *server); +extern char * server_get_description(MEMCACHED *server); +extern void server_set_quickack(MEMCACHED *server); +extern time_t server_get_last_down_time(MEMCACHED *server); +extern time_t server_get_last_connect_time(MEMCACHED *server); + +extern int server_count(void); + +extern void server_clear_prefixes(void); + +extern double server_average_queue_length(void); + +/* Declared here because MEMCACHED isn't defined in request.h */ +extern void request_set_server(REQUEST *req, MEMCACHED *server); + +#endif /* __server_h__ */ diff --git a/src/util/mcproxy/server_async.cpp b/src/util/mcproxy/server_async.cpp new file mode 100644 index 0000000000000..2e6307bca924d --- /dev/null +++ b/src/util/mcproxy/server_async.cpp @@ -0,0 +1,378 @@ +/* + * Asynchronous request queue management. + */ +#include "proxy.h" +#include "server_int.h" +#include "stats.h" +#include "gfuncs.h" + +char *async_dir = "/tmp"; +uint32_t max_asyncstore_len = 1048576; // 1MB + +static void server_async_cbf(REQUEST *req, void *arg); + + +/* + * Opens the asynchronous request store for a server. + * + * If for_adding is nonzero, creates the file if it doesn't exist and sets + * the current position to the end of the file. + */ +static void +server_asyncstore_open(MEMCACHED_IMPL *mcd, int for_adding) +{ + int create_flag = for_adding ? O_CREAT : 0; + + if (mcd->store_fd > -1) + return; // already open + mcd->store_fd = open(mcd->store_path, O_RDWR | create_flag, 0666); + if (mcd->store_fd < 0) + { + if (errno == ENOENT && ! for_adding) + return; + HPHP::Logger::Error("Can't open async store %s", mcd->store_path); + return; + } + + if (for_adding) + { + struct stat st; + if (fstat(mcd->store_fd, &st)) + { + HPHP::Logger::Error("Can't stat async store %s", mcd->store_path); + return; + } + + mcd->store_offset = st.st_size; + } + + HPHP::Logger::Verbose("Opened async store for %s", mcd->description); +} + + +/* + * Loads all the entries from a server's asynchronous request store. + */ +void +server_asyncstore_init(MEMCACHED_IMPL *mcd) +{ + REQUEST *req; + struct stat st; + char *lines; + char *cmd; + + mcd->store_path = (char*)gmalloc(strlen(async_dir) + 30); + sprintf(mcd->store_path, "%s/async.%s.%d", + async_dir, mcd->hostaddr, mcd->port); + + server_asyncstore_open(mcd, 0); + if (mcd->store_fd > -1) + { + if (fstat(mcd->store_fd, &st) < 0) + { + HPHP::Logger::Error("Can't get file length for async store"); + return; + } + + lines = (char*)gmalloc_data(st.st_size + 1); + if (read(mcd->store_fd, lines, st.st_size) < st.st_size) + { + HPHP::Logger::Error("Can't read async store"); + return; + } + + lines[st.st_size] = '\0'; + + /* + * The store is a series of \0 \0 sequences, + * with already-acknowledged commands marked by a "!" as the + * first character. Add all the commands to the server's + * outgoing request list. + */ + cmd = lines; + while (cmd < lines + st.st_size - 1) + { + if (cmd[0] != '\0') + { + /* + * This is an already-acknowledged entry or the + * store has wrapped around and this is the end + * of an old entry. Either way, skip it. + */ + cmd += strlen(cmd) + 1; + if (cmd >= lines + st.st_size - 1) + break; + } + + /* Skip past the opening null */ + cmd++; + + if (cmd[0] != '!') + { + req = request_new_async(server_async_cbf, cmd, + cmd - lines, 1); + request_set_server(req, (MEMCACHED *)mcd); + request_list_add(mcd->request_list, req); + mcd->queued_async_size += strlen(cmd); + } + + cmd += strlen(cmd) + 1; + } + + gfree(lines); + + // Leave the file open since we'll be marking requests as + // complete once we connect to the server. + + mcd->store_offset = st.st_size; + } + else + { + mcd->store_offset = 0; + } +} + +/* + * Empties out a server's asynchronous request store. + */ +static void +server_asyncstore_empty(MEMCACHED_IMPL *mcd) +{ + if (mcd->store_fd > -1) + { + close(mcd->store_fd); + unlink(mcd->store_path); + mcd->store_fd = -1; + } +} + +/* + * Removes an asynchronous request from the persistent store if it's there. + * We don't actually remove the entry as such; we just mark it as invalid + * by tweaking the first character. Once all the stored requests have been + * sent, the file will be truncated. + */ +static void +server_asyncstore_remove(MEMCACHED_IMPL *mcd, REQUEST *req) +{ + uint32_t offset; + + if (request_get_type(req) != Async) + return; + offset = request_get_offset(req); + if (offset == OFFSET_NONE) + return; + + server_asyncstore_open(mcd, 0); + if (mcd->store_fd > -1) + { + if (lseek(mcd->store_fd, (off_t) offset, SEEK_SET) != offset) + { + HPHP::Logger::Error("Can't seek in async store"); + return; + } + + if (write(mcd->store_fd, "!", 1) != 1) + { + HPHP::Logger::Error("Can't mark record as complete"); + return; + } + } +} + +/* + * Adds an asynchronous request to the persistent store. + */ +static void +server_asyncstore_add(MEMCACHED_IMPL *mcd, REQUEST *req) +{ + /* If this request is already in the store, don't store it again. */ + if (request_get_type(req) == Async && + request_get_offset(req) != OFFSET_NONE) + return; + + server_asyncstore_open(mcd, 1); + if (mcd->store_fd > -1) + { + int command_len = request_get_command_len(req); + char *command = (char*)request_get_command(req); + struct iovec iov[3]; + + /* If we would push the file over its size limit, wrap to 0 + and truncate the file. If we fail to truncate the file + then close the file, unlink it and return. Rely on + external monitoring to alert us when this failure + occurs. */ + if (command_len + mcd->store_offset > max_asyncstore_len) + { + HPHP::Logger::Warning("Request queue %s has reached its size limit", + mcd->store_path); + mcd->store_offset = 0; + if (ftruncate(mcd->store_fd, 0) < 0) { + HPHP::Logger::Error("Can't ftruncate in async store"); + server_asyncstore_empty(mcd); + return; + } + } + + if (lseek(mcd->store_fd, mcd->store_offset, SEEK_SET) < 0) + { + HPHP::Logger::Error("Can't seek in async store"); + return; + } + + /* Write a null byte, the command, and another null. */ + iov[0].iov_base = iov[2].iov_base = (void*)""; + iov[0].iov_len = iov[2].iov_len = 1; + iov[1].iov_base = command; + iov[1].iov_len = command_len; + if (writev(mcd->store_fd, iov, 3) != command_len + 2) + { + HPHP::Logger::Error("Can't append entry to async store"); + return; + } + + // XXX - If we want to be really paranoid, we can call fsync + // at this point. But that will generate a lot of disk + // I/O and it's not clear it's worthwhile. + + mcd->store_offset += command_len + 2; + } +} + + +/* + * Request handler callback for an asynchronous request. This is only called + * when we actually get a response from the server; if the server connection + * is closed, async requests are requeued by server_requeue_requests(). + */ +static void +server_async_cbf(REQUEST *req, void *arg) +{ + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) request_get_server(req); + + /* + * Remove this request from the store if it was there. This + * can only be true if the request was reliable (flags != 0). + */ + if (request_is_reliable_async(req)) { + server_asyncstore_remove(mcd, req); + } + + /* If this was the last pending request, empty out the store. */ + if (request_list_peek_tail(mcd->request_list) == req) + server_asyncstore_empty(mcd); + + if (request_is_reliable_async(req)) { + mcd->queued_async_size -= request_get_command_len(req); + } + + stats_remote_delete(req); + request_free(req); +} + +/* + * Sends a request to a server asynchronously, optionally deferring it + * if it can't be sent immediately. + */ +void +server_do_request_async(MEMCACHED *vmcd, const REQUEST *req, int reliable) +{ + MEMCACHED_IMPL *mcd = (MEMCACHED_IMPL *) vmcd; + REQUEST *async; + int send_failed; + + if (request_get_data(req) != NULL) + async = request_new_async_data(server_async_cbf, + (char*)request_get_command(req), + request_get_offset(req), + request_get_data(req), + request_get_bytes(req), + reliable); + else + async = request_new_async(server_async_cbf, + (char*)request_get_command(req), + request_get_offset(req), + reliable); + + send_failed = server_do_request(vmcd, async); + + if (reliable) + { + if (send_failed) + { + /* might have failed because we are incorrectly sending + * a request to a dummy server. stop the request now. */ + if (! server_is_real(vmcd)) { + return; + } + + request_set_server(async, vmcd); + request_list_add(mcd->request_list, async); + server_asyncstore_add(mcd, async); + } + + /* + * Add it to the async queue even if it was successfully sent; + * it will be removed when we get a response back from the + * remote side. (Otherwise we would lose requests that were + * pending at the time a remote server died.) + */ + mcd->queued_async_size += request_get_command_len(async); + + int num_requests_dropped = 0; + while (mcd->queued_async_size > max_asyncstore_len) + { + REQUEST *old = request_list_next(mcd->request_list); + + /* The queue is full. Forget about an old entry. */ + if (server_is_up(vmcd)) + { + mcd->pending_async_drop_count++; + } + request_handle_input(old, "SERVER_ERROR Queue full"); + num_requests_dropped++; + } + if (num_requests_dropped > 0) { + HPHP::Logger::Error("Server %s async queue full, dropping %d requests.", + mcd->description, + num_requests_dropped); + } + } + else + { + if (send_failed) + { + HPHP::Logger::Error("Server %s request dropped - server was down.", + mcd->description); + /* Request won't be freed by completion callback */ + request_free(async); + } + } +} + +/* + * Requeues all of the pending requests for a server that has just + * reconnected. + */ +void +server_requeue_requests(MEMCACHED_IMPL *mcd) +{ + REQUEST *tail = request_list_peek_tail(mcd->request_list); + REQUEST *cur; + + if (tail != NULL) + { + /* + * Walk through the requests until we get to whatever was at the + * tail of the list initially. (We will be adding each entry to + * the end of the list as we pop it off the beginning.) + */ + do { + cur = request_list_next(mcd->request_list); + mcd->queued_async_size -= request_get_command_len(cur); + server_do_request_async((MEMCACHED *) mcd, cur, 1); + request_free(cur); + } while (cur != tail); + } +} diff --git a/src/util/mcproxy/server_int.h b/src/util/mcproxy/server_int.h new file mode 100644 index 0000000000000..440d5d9728d5b --- /dev/null +++ b/src/util/mcproxy/server_int.h @@ -0,0 +1,87 @@ +/* + * Internal declarations for server management module. + */ +#include "include.h" +#include "prefix.h" + +#define CONNECT_RETRY_INTERVAL 10 + +/* + * Server status values. + */ +typedef enum { + Uninitialized, + Connecting, + Connected, + SleepingBetweenRetries, + Dummy, +} MEMCACHED_STATUS; + +/* + * Memcached server description. + */ +typedef struct { + /* List of requests that have been sent to the server. */ + REQUEST_LIST *request_list; + + /* Total size of outstanding async request bodies. */ + uint32_t queued_async_size; + + /* Total number of outstanding async requests we've dropped. */ + uint32_t pending_async_drop_count; + + /* Which cluster this server is a member of. */ + int cluster; + + /* Hostname as supplied in configuration. */ + char *hostname; + + /* Host address in string format. */ + char *hostaddr; + + /* Description (hostname and port). */ + char *description; + + /* Port number. */ + int port; + + /* File descriptor of socket to server. */ + int fd; + + /* Path of asynchronous request store file. */ + char *store_path; + + /* File descriptor of persistent asynchronous request store. */ + int store_fd; + + /* Current offset in the asynchronous request store. */ + uint32_t store_offset; + + /* Server status. */ + MEMCACHED_STATUS status; + + /* + * 0 if server is up, otherwise the most recent time it was + * reported (or observed) to be down. + */ + time_t last_down_time; + time_t last_connect_time; + + /* List of prefixes this server handles. */ + PREFIX **prefixes; + uint32_t nprefixes; + + /* Did we set a timeout in qio for this server */ + int timeout_set; +} MEMCACHED_IMPL; + +void server_requeue_requests(MEMCACHED_IMPL *mcd); +void server_asyncstore_init(MEMCACHED_IMPL *mcd); + +// indicates whether or not the server belongs to a pool using consistent hashing. +static inline int is_consistent_server(MEMCACHED *_server) +{ + MEMCACHED_IMPL *server = (MEMCACHED_IMPL *) _server; + + return (server->port % 2 == 1); +} diff --git a/src/util/mcproxy/socket.cpp b/src/util/mcproxy/socket.cpp new file mode 100644 index 0000000000000..002c548a82efb --- /dev/null +++ b/src/util/mcproxy/socket.cpp @@ -0,0 +1,301 @@ + +#include "include.h" +#include "../network.h" + +/* +** SOCKET.C +** +** Written by Steven Grimm (koreth@ebay.sun.com) on 11-26-87 +** Please distribute widely, but leave my name here. +** +** Various black-box routines for socket manipulation, so I don't have to +** remember all the structure elements. +** Of course, I still have to remember how to call these routines. +*/ + +/* +** newsocket() +** +** Creates an Internet stream socket. +** +** Output: file descriptor of socket, or a negative error +*/ +int newsocket(void) +{ + return socket(AF_INET, SOCK_STREAM, 0); +} + +/* +** serversock() +** +** Creates an internet socket, binds it to an address, and prepares it for +** subsequent accept() calls by calling listen(). +** +** Input: port number desired, or 0 for a random one +** Output: file descriptor of socket, or a negative error +*/ +int serversock(int port) +{ + int one = 1; + int sock, x; + struct sockaddr_in server; + int sendBufSize = 4194304; + int recvBufSize = 1048576; + + sock = newsocket(); + if (sock < 0) + return -errno; + + bzero(&server, sizeof(server)); + server.sin_family = AF_INET; + server.sin_addr.s_addr = INADDR_ANY; + server.sin_port = htons(port); + + if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) + HPHP::Logger::Error("setsockopt"); + + if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, &recvBufSize, sizeof(recvBufSize))) + HPHP::Logger::Error("setsockopt : SO_RCVBUF"); + + if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sendBufSize, sizeof(sendBufSize))) + HPHP::Logger::Error("setsockopt : SO_SNDBUF"); + + x = bind(sock, (struct sockaddr *)&server, sizeof(server)); + if (x < 0) + { + close(sock); + return -errno; + } + + listen(sock, 500); + + return sock; +} + +/* +** portnum() +** +** Returns the internet port number for a socket. +** +** Input: file descriptor of socket +** Output: inet port number +*/ +int portnum(int fd) +{ + int err; + socklen_t length; + struct sockaddr_in address; + + length = sizeof(address); + err = getsockname(fd, (struct sockaddr *)&address, &length); + if (err < 0) + return -errno; + + return ntohs(address.sin_port); +} + +/* +** host_to_addr() +** +** Returns the IP address of a host in human-readable dotted-quad format. +** +** Input: hostname to look up +** buffer for IP address +*/ +void host_to_addr(const char *hostname, char *buf) +{ + if (isdigit(hostname[0])) + strcpy(buf, hostname); + else + { + HPHP::Util::HostEnt result; + if (HPHP::Util::safe_gethostbyname(hostname, result)) { + struct in_addr addr; + memcpy(&addr, result.hostbuf.h_addr, result.hostbuf.h_length); + std::string s = HPHP::Util::safe_inet_ntoa(addr); + strcpy(buf, s.c_str()); + } else { + *buf = '\0'; + } + } +} + +/* +** clientsock() +** +** Returns a connected client socket. +** +** Input: host name and port number to connect to +** Output: file descriptor of CONNECTED socket, or a negative error +** (-9999) if the hostname was bad. +*/ +int clientsock(char *host, int port) +{ + int sock; + struct sockaddr_in server; + + bzero(&server, sizeof(server)); + server.sin_family = AF_INET; + server.sin_port = htons(port); + + if (isdigit(host[0])) + server.sin_addr.s_addr = inet_addr(host); + else + { + HPHP::Util::HostEnt result; + if (!HPHP::Util::safe_gethostbyname(host, result)) { + return -9999; + } + bcopy(result.hostbuf.h_addr, &server.sin_addr, result.hostbuf.h_length); + } + + sock = newsocket(); + if (sock < 0) + return -errno; + + if (connect(sock, (struct sockaddr *)&server, sizeof(server)) < 0) + { + close(sock); + return -errno; + } + + return sock; +} + +/* +** clientsock_nb() +** +** Returns a nonblocking client socket with a pending connection attempt. +** +** Input: host name to connect to +** port number to connect to +** buffer for file descriptor +** Output: <0 if the connection attempt failed +** 0 if the connection is fully established (e.g. because it's a +** connection to the local host) +** >0 if the connection is pending +*/ +int clientsock_nb(char *host, int port, int *sock) +{ + struct sockaddr_in server; + + bzero(&server, sizeof(server)); + server.sin_family = AF_INET; + server.sin_port = htons(port); + + if (isdigit(host[0])) + server.sin_addr.s_addr = inet_addr(host); + else + { + HPHP::Util::HostEnt result; + if (!HPHP::Util::safe_gethostbyname(host, result)) { + return -9999; + } + bcopy(result.hostbuf.h_addr, &server.sin_addr, result.hostbuf.h_length); + } + + *sock = newsocket(); + if (*sock < 0) + return -1; + + if (fcntl(*sock, F_SETFL, O_NONBLOCK)) + return -1; + + if (connect(*sock, (struct sockaddr *)&server, sizeof(server)) < 0) + { + if (errno != EINPROGRESS) + { + close(*sock); + return -errno; + } + } + else + return 0; + + return 1; +} + +/* +** waitread() +** +** Wait for data on a file descriptor for a little while. +** +** Input: file descriptor to watch +** how long to wait, in seconds, before returning +** Output: 1 if data was available +** 0 if the timer expired or a signal occurred. +*/ +int waitread(int fd, int time) +{ + fd_set readbits; + struct timeval timer; + + timerclear(&timer); + timer.tv_sec = time; + FD_ZERO(&readbits); + FD_SET(fd, &readbits); + + select(fd+1, &readbits, NULL, NULL, &timer); + if (FD_ISSET(fd, &readbits)) + return 1; + return 0; +} + +/* +** readable() +** +** Poll a socket for pending input. Returns immediately. This is a front-end +** to waitread() below. +** +** Input: file descriptor to poll +** Output: 1 if data is available for reading +*/ +int readable(int fd) +{ + return(waitread(fd, 0)); +} + +/* +** nodelay() +** +** Set or clear the TCP_NODELAY option on a file descriptor. +** +** Input: file descriptor to modify +** whether NODELAY is desired +*/ +int set_nodelay(int fd, int want_nodelay) +{ + return(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void *)&want_nodelay, sizeof(int))); +} + +/* + * Determines the local network address. + * + * Input: buffer for address + * Output: 0 on success, -1 if address can't be determined + */ +int determine_local_address(struct in_addr *addrbuf) +{ + int sock; + struct sockaddr_in addr; + unsigned int len = sizeof(addr); + + /* + * Determine local network address by opening a socket and trying + * to establish a connection somewhere. + */ + if (clientsock_nb("10.0.0.1", 21, &sock) < 0) { + HPHP::Logger::Error("Can't open socket to determine local address"); + return -1; + } + + if (getsockname(sock, (struct sockaddr *)&addr, &len)) { + HPHP::Logger::Error("Can't determine local address of connection"); + return -1; + } + + close(sock); + memcpy(addrbuf, &addr.sin_addr, sizeof(struct in_addr)); + return 0; +} + diff --git a/src/util/mcproxy/stats.cpp b/src/util/mcproxy/stats.cpp new file mode 100644 index 0000000000000..0549577ec2e99 --- /dev/null +++ b/src/util/mcproxy/stats.cpp @@ -0,0 +1,144 @@ + +#include "proxy.h" +#include "server.h" +#include "qio.h" +#include "gfuncs.h" + +#define BIN_VERSION "1.0" + +// global stat vals +int stats_cmdget_count = 0; +int stats_cmdset_count = 0; +int stats_cmddelete_count = 0; +int stats_get_hits = 0; + +long stats_bytes_read = 0; +long stats_bytes_written = 0; +int stats_failed_client_connections = 0; +int stats_successful_client_connections = 0; +int stats_closed_client_connections = 0; +int stats_starttime = 0; + +// setter properties +void stats_incr_cmdget_count() { stats_cmdget_count++; } +void stats_incr_cmdset_count() { ++stats_cmdset_count; } +void stats_incr_cmddelete_count() { ++stats_cmddelete_count; } +void stats_incr_get_hits() { ++stats_get_hits; } +void stats_add_bytes_read(int v) { stats_bytes_read += v; } +void stats_add_bytes_written(int v) { stats_bytes_written += v; } +void stats_incr_failed_client_connections() { ++stats_failed_client_connections; } +void stats_incr_closed_client_connections() { ++stats_closed_client_connections; } +void stats_incr_successful_client_connections() { ++stats_successful_client_connections; } +void stats_set_starttime(int v) { stats_starttime = v; } + +// tracking of remote delete hit rate on a per-prefix basis +typedef struct { + char *prefix; + int deletes; + int hits; +} REMOTE_DELETE; + +static REMOTE_DELETE *remote_deletes = NULL; +static int nremote_deletes = 0; +void stats_remote_delete(REQUEST *req) { + int i; + REMOTE_DELETE *rd = NULL; + char *key = (char*)request_get_command(req); + int is_hit = request_get_response(req)[0] == 'D'; + char *c; + + if (strncmp(key, "delete ", 7)) + return; + key += 7; + + c = strchr(key, ':'); + if (! c) + c = key + 3; + + // Number of prefixes should stay low enough that linear-searching + // the list won't be too big a performance hit. + for (i = 0; i < nremote_deletes; i++) { + if (! strncmp(remote_deletes[i].prefix, key, c - key)) { + rd = &remote_deletes[i]; + break; + } + } + + if (! rd) { + rd = (REMOTE_DELETE*)grealloc(remote_deletes, + sizeof(REMOTE_DELETE) * (nremote_deletes + 1)); + remote_deletes = rd; + rd += nremote_deletes; + nremote_deletes++; + + rd->prefix = (char*)gmalloc(c - key + 1); + gstrncpy(rd->prefix, key, c - key + 1); + rd->deletes = 0; + rd->hits = 0; + } + + rd->deletes++; + if (is_hit) + rd->hits++; +} + + +double getTimeFromTimeval(struct timeval mytimeval) +{ + return ((double) mytimeval.tv_sec) + (((double) mytimeval.tv_usec) / 1000000); +} + +void qio_printf(int fd, char *fmt, ...) { + char buf[1000]; + int len; + va_list ap; + + va_start(ap, fmt); + len = vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + + qio_write(fd, buf, len); +} + +void stats_dump(int fd) +{ + int currentTime = (int) time(NULL); + struct rusage myrusage; + int i; + + getrusage(RUSAGE_SELF, &myrusage); // this is the child pid + + qio_printf(fd, "STAT parent_pid %d\n", (int) getppid()); + qio_printf(fd, "STAT child_pid %d\n", (int) getpid()); + qio_printf(fd, "STAT uptime %d\n", currentTime - stats_starttime); + qio_printf(fd, "STAT time %d\n", (int) time(NULL)); + qio_printf(fd, "STAT version %s\n", BIN_VERSION); + qio_printf(fd, "STAT rusage_user %f\n", getTimeFromTimeval(myrusage.ru_utime)); + qio_printf(fd, "STAT rusage_system %f\n", getTimeFromTimeval(myrusage.ru_stime)); + qio_printf(fd, "STAT total_connections %d\n", + stats_successful_client_connections - + stats_closed_client_connections); + qio_printf(fd, "STAT successful_client_connections %d\n", stats_successful_client_connections); + qio_printf(fd, "STAT failed_client_connections %d\n", stats_failed_client_connections); + qio_printf(fd, "STAT average_client_queue_length %f\n", + server_average_queue_length()); + qio_printf(fd, "STAT num_servers %d\n", server_count()); + qio_printf(fd, "STAT cmd_get %d\n", stats_cmdget_count); + qio_printf(fd, "STAT cmd_set %d\n", stats_cmdset_count); + qio_printf(fd, "STAT cmd_delete %d\n", stats_cmddelete_count); + qio_printf(fd, "STAT get_hits %d\n", stats_get_hits); + + // note: this approximates misses, since we don't receive the number + // of misses, but have to subtract hits from total get attempts + qio_printf(fd, "STAT get_misses %d\n", stats_cmdget_count - stats_get_hits); + qio_printf(fd, "STAT bytes_written %ld\n", stats_bytes_written); + qio_printf(fd, "STAT bytes read %ld\n", stats_bytes_read); + + for (i = 0; i < nremote_deletes; i++) { + REMOTE_DELETE *rd = &remote_deletes[i]; + qio_printf(fd, "STAT remote_delete %s %d %d\r\n", + rd->prefix, rd->deletes, rd->hits); + } + + qio_printf(fd, "END\r\n"); +} diff --git a/src/util/mcproxy/stats.h b/src/util/mcproxy/stats.h new file mode 100644 index 0000000000000..f819a31b1bc4c --- /dev/null +++ b/src/util/mcproxy/stats.h @@ -0,0 +1,23 @@ +#ifndef __stats_h__ +#define __stats_h__ 1 + +#include "include.h" +#include "request.h" + +// setter properties +extern void stats_incr_cmdget_count(); +extern void stats_incr_cmdset_count(); +extern void stats_incr_cmddelete_count(); +extern void stats_incr_get_hits(); +extern void stats_add_bytes_read(int v); +extern void stats_add_bytes_written(int v); +extern void stats_incr_failed_client_connections(); +extern void stats_incr_closed_client_connections(); +extern void stats_incr_successful_client_connections(); +extern void stats_set_starttime(int v); + +extern void stats_remote_delete(REQUEST *req); +extern double getTimeFromTimeval(struct timeval mytimeval); +extern void stats_dump(int fd); + +#endif /* __stats_h__ */ diff --git a/src/util/mcproxy/tinystdio.cpp b/src/util/mcproxy/tinystdio.cpp new file mode 100644 index 0000000000000..8c2cf726273bf --- /dev/null +++ b/src/util/mcproxy/tinystdio.cpp @@ -0,0 +1,205 @@ + +/* + * Tiny stdio replacement, because Solaris stdio can't handle more than 256 + * files at a time. + */ +#include "tinystdio.h" +#include "gfuncs.h" + +typedef struct { + char *inbuf; + int fd; + int in_bytes; // Number of bytes in buffer + int in_pos; // Position in buffer (<= in_bytes) +} TINYFILE_IMPL; + +#define INBUF_SIZE 8192 + +/* + * Fills the input buffer of a stream. + * + * Returns number of bytes read, or -1 if an error occurred. + */ +static int fill_inbuf(TINYFILE_IMPL *fp) +{ + int ret; + + // No-op if there are already bytes in the buffer + if (fp->in_bytes > 0 && fp->in_pos < fp->in_bytes) + return 0; + + // If this isn't an fd-based stream, can't read any bytes + if (fp->fd < 0) + return 0; + + fp->in_pos = 0; + do { + ret = read(fp->fd, fp->inbuf, sizeof(fp->inbuf)); + } while (ret == -1 && errno == EINTR); + + if (ret >= 0) + fp->in_bytes = ret; + else + fp->in_bytes = 0; + + return ret; +} + +/* + * Returns the next character from a stream. + */ +int tiny_getc(TINYFILE *tfp) +{ + TINYFILE_IMPL *fp = (TINYFILE_IMPL *) tfp; + + if (fp == NULL) + return EOF; + + if (fp->in_bytes > 0 && fp->in_pos < fp->in_bytes) + return fp->inbuf[fp->in_pos++]; + + if (fill_inbuf(fp) <= 0) + return EOF; + return fp->inbuf[fp->in_pos++]; +} + +/* + * Reads a chunk of data from a stream. + */ +int tiny_read(TINYFILE *tfp, char *buf, int len) +{ + TINYFILE_IMPL *fp = (TINYFILE_IMPL *) tfp; + int bytes_from_buf; + int left = len; + int ret; + + if (fp == NULL || buf == NULL) + return -1; + if (len == 0) + return 0; + + // If the buffer is empty and this is a big read, just fetch + // directly to the user's buffer. + if (fp->in_bytes == 0 || (fp->in_bytes <= fp->in_pos && fp->fd >= 0)) + { + if (len >= (int)sizeof(fp->inbuf)) + return read(fp->fd, buf, len); + + // A small request; replenish our buffer. + if (fill_inbuf(fp) < 0) + return -1; + } + + if (fp->in_bytes == 0 || fp->in_bytes <= fp->in_pos) + return 0; + + // Satisfy as much of the request as possible from the buffer. + bytes_from_buf = fp->in_bytes - fp->in_pos; + if (bytes_from_buf > left) + bytes_from_buf = left; + + if (bytes_from_buf > 0) + { + memcpy(buf, fp->inbuf + fp->in_pos, bytes_from_buf); + fp->in_pos += bytes_from_buf; + left -= bytes_from_buf; + buf += bytes_from_buf; + } + + // Satisfied the whole request? + if (left == 0) + return len; + + // If this was a big request, satisfy the rest of it directly from + // the file descriptor. Otherwise replenish our buffer. + if (len >= (int)sizeof(fp->inbuf)) + ret = read(fp->fd, buf, left); + else + ret = tiny_read(tfp, buf, left); + + if (ret >= 0) + return bytes_from_buf + ret; + else + return bytes_from_buf; +} + +/* + * Reads a newline-terminated string from a stream. + */ +char *tiny_gets(TINYFILE *tfp, char *buf, int len) +{ + int c; + int pos = 0; + + if (tfp == NULL || buf == NULL || len < 2) + return NULL; + + while ((c = tiny_getc(tfp)) != EOF) + { + buf[pos++] = c; + if (pos == len - 1 || c == '\n') + break; + } + + buf[pos] = '\0'; + if (pos > 0) + return buf; + else + return NULL; +} + +/* + * Rewinds a tiny-stdio stream. + */ +void tiny_rewind(TINYFILE *tfp) +{ + TINYFILE_IMPL *fp = (TINYFILE_IMPL *)tfp; + + lseek(fp->fd, 0, SEEK_SET); + fp->in_bytes = 0; + fp->in_pos = 0; +} + + +/* + * Attaches a tiny-stdio stream to an open file descriptor. + */ +TINYFILE *tiny_fdopen(int fd) +{ + TINYFILE_IMPL *fp = + (TINYFILE_IMPL*)gmalloc_data(sizeof(TINYFILE_IMPL) + INBUF_SIZE); + + fp->fd = fd; + fp->inbuf = (char *)&fp[1]; + fp->in_bytes = 0; + fp->in_pos = 0; + + return (TINYFILE *) fp; +} + + +/* + * Attaches a tiny-stdio stream to a buffer. + */ +TINYFILE *tiny_bufopen(char *buf, int len) +{ + TINYFILE_IMPL *fp = (TINYFILE_IMPL*)gmalloc_data(sizeof(TINYFILE_IMPL)); + + fp->fd = -1; + fp->inbuf = buf; + fp->in_bytes = len; + fp->in_pos = 0; + + return (TINYFILE *) fp; +} + + +/* + * Detaches a tiny-stdio stream from an open file descriptor. The file + * descriptor is not affected, but any data that was buffered in the + * stream's input buffer is lost. + */ +void tiny_free(TINYFILE *tfp) +{ + gfree(tfp); +} diff --git a/src/util/mcproxy/tinystdio.h b/src/util/mcproxy/tinystdio.h new file mode 100644 index 0000000000000..405be221d4cb1 --- /dev/null +++ b/src/util/mcproxy/tinystdio.h @@ -0,0 +1,56 @@ +/* + * Tiny stdio replacement, because Solaris stdio can't handle more than 256 + * files at a time. + */ +#ifndef __TINYSTDIO_H__ /* { */ +#define __TINYSTDIO_H__ 1 + +#include "include.h" + +/* Dummy structure for type safety. */ +typedef struct { + char dummy1[26]; + char dummy2[31]; + int dummy3[3]; +} TINYFILE; + +/* + * Returns the next character from a stream, or EOF (-1) if none. + */ +int tiny_getc(TINYFILE *tfp); + +/* + * Reads a chunk of data from a stream. Returns number of bytes read, 0 + * on EOF, or -1 on error. + */ +int tiny_read(TINYFILE *tfp, char *buf, int len); + +/* + * Reads a newline-terminated string from a stream. Returns the buf + * argument, or NULL if no string could be read. + */ +char *tiny_gets(TINYFILE *tfp, char *buf, int len); + +/* + * Attaches a tiny-stdio stream to an open file descriptor. + */ +TINYFILE *tiny_fdopen(int fd); + +/* + * Attaches a tiny-stdio stream to a buffer. + */ +TINYFILE *tiny_bufopen(char *buf, int len); + +/* + * Detaches a tiny-stdio stream from an open file descriptor or buffer. + * The file descriptor is not affected, but any data that was buffered in the + * stream's input buffer is lost. + */ +void tiny_free(TINYFILE *tfp); + +/* + * Rewinds a tiny-stdio stream to the beginning. + */ +void tiny_rewind(TINYFILE *tfp); + +#endif /* } */ diff --git a/src/util/mutex.cpp b/src/util/mutex.cpp new file mode 100644 index 0000000000000..7f4e6b95897eb --- /dev/null +++ b/src/util/mutex.cpp @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "mutex.h" +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Mutex::Mutex(bool reentrant /* = true */) { + pthread_mutexattr_init(&m_mutexattr); + if (reentrant) { + pthread_mutexattr_settype(&m_mutexattr, PTHREAD_MUTEX_RECURSIVE); + } else { + pthread_mutexattr_settype(&m_mutexattr, PTHREAD_MUTEX_ADAPTIVE_NP); + } + pthread_mutex_init(&m_mutex, &m_mutexattr); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/mutex.h b/src/util/mutex.h new file mode 100644 index 0000000000000..a0460207bbcd8 --- /dev/null +++ b/src/util/mutex.h @@ -0,0 +1,93 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __MUTEX_H__ +#define __MUTEX_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * A mutex that's re-entrant, meaning it won't deadlock if you do this, + * + * class A { + * public: + * void foo() { + * Lock lock(m_mutex); + * bar(); // if m_mutex is not re-entrant, this will deadlock + * } + * + * void bar() { + * Lock lock(m_mutex); + * // ... + * } + * + * private: + * Mutex m_mutex; + * }; + */ +class Mutex { +public: + Mutex(bool reentrant = true); + ~Mutex() { + pthread_mutex_destroy(&m_mutex); + pthread_mutexattr_destroy(&m_mutexattr); + } + + void lock() { + pthread_mutex_lock(&m_mutex); + } + void unlock() { + pthread_mutex_unlock(&m_mutex); + } + + pthread_mutex_t &getRaw() { return m_mutex;} + +private: + pthread_mutexattr_t m_mutexattr; + pthread_mutex_t m_mutex; +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Read-write mutex for read-write locks. + */ +class ReadWriteMutex { +public: + ReadWriteMutex() { + pthread_rwlock_init(&m_rwlock, NULL); + } + ~ReadWriteMutex() { + pthread_rwlock_destroy(&m_rwlock); + } + + void acquireRead() { pthread_rwlock_rdlock(&m_rwlock); } + void acquireWrite() { pthread_rwlock_wrlock(&m_rwlock); } + bool attemptRead() { return pthread_rwlock_tryrdlock(&m_rwlock); } + bool attemptWrite() { return pthread_rwlock_trywrlock(&m_rwlock); } + void release() { pthread_rwlock_unlock(&m_rwlock); } + +private: + pthread_rwlock_t m_rwlock; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __MUTEX_H__ diff --git a/src/util/neo/cs_config.h b/src/util/neo/cs_config.h new file mode 100644 index 0000000000000..a9de8fdac2403 --- /dev/null +++ b/src/util/neo/cs_config.h @@ -0,0 +1,224 @@ +/* cs_config.h. Generated by configure. */ +/* cs_config.h.in. Generated from configure.in by autoheader. */ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +/* + * config file + */ + +#ifndef __CS_CONFIG_H_ +#define __CS_CONFIG_H_ 1 + + +/* Enable support for HTML Compression (still must be enabled at run time) */ +#define HTML_COMPRESSION 1 + +/* Enable support for X Remote CGI Debugging */ +/* #undef ENABLE_REMOTE_DEBUG */ + +/********* SYSTEM CONFIG ***************************************************/ +/* autoconf/configure should figure all of these out for you */ + +/* Does your system have the snprintf() call? */ +#define HAVE_SNPRINTF 1 + +/* Does your system have the vsnprintf() call? */ +#define HAVE_VSNPRINTF 1 + +/* Does your system have the strtok_r() call? */ +#define HAVE_STRTOK_R 1 + +/* Does your system have the localtime_r() call? */ +#define HAVE_LOCALTIME_R 1 + +/* Does your system have the gmtime_r() call? */ +#define HAVE_GMTIME_R 1 + +/* Does your system have the mkstemp() call? */ +#define HAVE_MKSTEMP 1 + +/* Does your system have regex.h */ +#define HAVE_REGEX 1 + +/* Does your system have pthreads? */ +#define HAVE_PTHREADS 1 + +/* Does your system have lockf ? */ +#define HAVE_LOCKF 1 + +/* Does your system have Berkeley DB v2 ? */ +/* #undef HAVE_DB2 */ + +/* Enable support for gettext message translation */ +/* #undef ENABLE_GETTEXT */ + + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if you have the `drand48' function. */ +#define HAVE_DRAND48 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FEATURES_H 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `gmtime_r' function. */ +#define HAVE_GMTIME_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#define HAVE_LOCALTIME_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mktime' function. */ +#define HAVE_MKTIME 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the `putenv' function. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if you have the `rand' function. */ +#define HAVE_RAND 1 + +/* Define to 1 if you have the `random' function. */ +#define HAVE_RANDOM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strspn' function. */ +#define HAVE_STRSPN 1 + +/* Define to 1 if you have the `strtod' function. */ +#define HAVE_STRTOD 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if `tm_zone' is member of `struct tm'. */ +#define HAVE_STRUCT_TM_TM_ZONE 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead. */ +#define HAVE_TM_ZONE 1 + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +/* #undef HAVE_TZNAME */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_VARARGS_H */ + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the `wait3' system call. Deprecated, you should no + longer depend upon `wait3'. */ +#define HAVE_WAIT3 1 + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `long' if does not define. */ +/* #undef off_t */ + +/* Define to `int' if does not define. */ +/* #undef pid_t */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ + +#endif /* __CS_CONFIG_H_ */ diff --git a/src/util/neo/neo_err.c b/src/util/neo/neo_err.c new file mode 100644 index 0000000000000..c85c05c992f9c --- /dev/null +++ b/src/util/neo/neo_err.c @@ -0,0 +1,472 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#include "cs_config.h" + +#include +#include +#include +#include +#include + +#include "neo_misc.h" +#include "neo_err.h" +#include "ulist.h" +#include "ulocks.h" + +int NERR_PASS = -1; +int NERR_ASSERT = 0; +int NERR_NOT_FOUND = 0; +int NERR_DUPLICATE = 0; +int NERR_NOMEM = 0; +int NERR_PARSE = 0; +int NERR_OUTOFRANGE = 0; +int NERR_SYSTEM = 0; +int NERR_IO = 0; +int NERR_LOCK = 0; +int NERR_DB = 0; +int NERR_EXISTS = 0; + +static NEOERR *FreeList = NULL; +static ULIST *Errors = NULL; +static int Inited = 0; +#ifdef HAVE_PTHREADS +/* In multi-threaded environments, we have to init thread safely */ +static pthread_mutex_t InitLock = PTHREAD_MUTEX_INITIALIZER; +#endif + +/* Set this to 1 to enable non-thread safe re-use of NEOERR data + * structures. This was a premature performance optimization that isn't + * thread safe, if we want it thread safe we need to add mutex code... + * which has its own performance penalties... + */ +static int UseFreeList = 0; + +static NEOERR *_err_alloc(void) +{ + NEOERR *err; + + if (!UseFreeList || FreeList == NULL) + { + err = (NEOERR *)calloc (1, sizeof (NEOERR)); + if (err == NULL) + { + ne_warn ("INTERNAL ERROR: Unable to allocate memory for NEOERR"); + return INTERNAL_ERR; + } + return err; + } + else + { + err = FreeList; + FreeList = FreeList->next; + } + err->flags |= NE_IN_USE; + err->next = NULL; + return err; +} + +static int _err_free (NEOERR *err) +{ + if (err == NULL || err == INTERNAL_ERR) + return 0; + if (err->next != NULL) + _err_free(err->next); + if (UseFreeList) + { + err->next = FreeList; + FreeList = err; + err->flags = 0; + err->desc[0] = '\0'; + } + else + { + free(err); + } + return 0; +} + +NEOERR *nerr_raisef (const char *func, const char *file, int lineno, int error, + const char *fmt, ...) +{ + NEOERR *err; + va_list ap; + + err = _err_alloc(); + if (err == INTERNAL_ERR) + return err; + + va_start(ap, fmt); + vsnprintf (err->desc, sizeof(err->desc), fmt, ap); + va_end(ap); + + err->error = error; + err->func = func; + err->file = file; + err->lineno = lineno; + + return err; +} + +NEOERR *nerr_raise_errnof (const char *func, const char *file, int lineno, + int error, const char *fmt, ...) +{ + NEOERR *err; + va_list ap; + int l; + + err = _err_alloc(); + if (err == INTERNAL_ERR) + return err; + + va_start(ap, fmt); + vsnprintf (err->desc, sizeof(err->desc), fmt, ap); + va_end(ap); + + l = strlen(err->desc); + snprintf (err->desc + l, sizeof(err->desc)-l, ": [%d] %s", errno, + strerror (errno)); + + err->error = error; + err->func = func; + err->file = file; + err->lineno = lineno; + + return err; +} + +NEOERR *nerr_passf (const char *func, const char *file, int lineno, NEOERR *err) +{ + NEOERR *nerr; + + if (err == STATUS_OK) + return err; + + nerr = _err_alloc(); + if (nerr == INTERNAL_ERR) + return err; + + nerr->error = NERR_PASS; + nerr->func = func; + nerr->file = file; + nerr->lineno = lineno; + nerr->next = err; + + return nerr; +} + +NEOERR *nerr_pass_ctxf (const char *func, const char *file, int lineno, + NEOERR *err, const char *fmt, ...) +{ + NEOERR *nerr; + va_list ap; + + if (err == STATUS_OK) + return err; + + nerr = _err_alloc(); + if (nerr == INTERNAL_ERR) + return err; + + va_start(ap, fmt); + vsnprintf (nerr->desc, sizeof(nerr->desc), fmt, ap); + va_end(ap); + + nerr->error = NERR_PASS; + nerr->func = func; + nerr->file = file; + nerr->lineno = lineno; + nerr->next = err; + + return nerr; +} + +/* In the future, we'll allow someone to register an error handler */ +void nerr_log_error (NEOERR *err) +{ + NEOERR *more; + char buf[1024]; + char *err_name; + + if (err == STATUS_OK) + return; + + if (err == INTERNAL_ERR) + { + ne_warn ("Internal error"); + return; + } + + more = err; + fprintf (stderr, "Traceback (innermost last):\n"); + while (more && more != INTERNAL_ERR) + { + err = more; + more = err->next; + if (err->error != NERR_PASS) + { + NEOERR *r; + if (err->error == 0) + { + err_name = buf; + snprintf (buf, sizeof (buf), "Unknown Error"); + } + else + { + r = uListGet (Errors, err->error - 1, (void *)&err_name); + if (r != STATUS_OK) + { + err_name = buf; + snprintf (buf, sizeof (buf), "Error %d", err->error); + } + } + + fprintf (stderr, " File \"%s\", line %d, in %s()\n%s: %s\n", err->file, + err->lineno, err->func, err_name, err->desc); + } + else + { + fprintf (stderr, " File \"%s\", line %d, in %s()\n", err->file, + err->lineno, err->func); + if (err->desc[0]) + { + fprintf (stderr, " %s\n", err->desc); + } + } + } +} + +void nerr_error_string (NEOERR *err, STRING *str) +{ + NEOERR *more; + char buf[1024]; + char *err_name; + + if (err == STATUS_OK) + return; + + if (err == INTERNAL_ERR) + { + string_append (str, "Internal error"); + return; + } + + more = err; + while (more && more != INTERNAL_ERR) + { + err = more; + more = err->next; + if (err->error != NERR_PASS) + { + NEOERR *r; + if (err->error == 0) + { + err_name = buf; + snprintf (buf, sizeof (buf), "Unknown Error"); + } + else + { + r = uListGet (Errors, err->error - 1, (void *)&err_name); + if (r != STATUS_OK) + { + err_name = buf; + snprintf (buf, sizeof (buf), "Error %d", err->error); + } + } + + string_appendf(str, "%s: %s", err_name, err->desc); + return; + } + } +} + +void nerr_error_traceback (NEOERR *err, STRING *str) +{ + NEOERR *more; + char buf[1024]; + char buf2[1024]; + char *err_name; + + if (err == STATUS_OK) + return; + + if (err == INTERNAL_ERR) + { + string_append (str, "Internal error"); + return; + } + + more = err; + string_append (str, "Traceback (innermost last):\n"); + while (more && more != INTERNAL_ERR) + { + err = more; + more = err->next; + if (err->error != NERR_PASS) + { + NEOERR *r; + if (err->error == 0) + { + err_name = buf; + snprintf (buf, sizeof (buf), "Unknown Error"); + } + else + { + r = uListGet (Errors, err->error - 1, (void *)&err_name); + if (r != STATUS_OK) + { + err_name = buf; + snprintf (buf, sizeof (buf), "Error %d", err->error); + } + } + + snprintf (buf2, sizeof(buf2), + " File \"%s\", line %d, in %s()\n%s: %s\n", err->file, + err->lineno, err->func, err_name, err->desc); + string_append(str, buf2); + } + else + { + snprintf (buf2, sizeof(buf2), " File \"%s\", line %d, in %s()\n", + err->file, err->lineno, err->func); + string_append(str, buf2); + if (err->desc[0]) + { + snprintf (buf2, sizeof(buf2), " %s\n", err->desc); + string_append(str, buf2); + } + } + } +} + +void nerr_ignore (NEOERR **err) +{ + _err_free (*err); + *err = STATUS_OK; +} + +int nerr_handle (NEOERR **err, int etype) +{ + NEOERR *walk = *err; + + while (walk != STATUS_OK && walk != INTERNAL_ERR) + { + + if (walk->error == etype) + { + _err_free(*err); + *err = STATUS_OK; + return 1; + } + walk = walk->next; + } + + if (walk == STATUS_OK && etype == STATUS_OK_INT) + return 1; + if (walk == STATUS_OK) + return 0; + + if (walk == INTERNAL_ERR && etype == INTERNAL_ERR_INT) + { + *err = STATUS_OK; + return 1; + } + if (walk == INTERNAL_ERR) + return 0; + + return 0; +} + +int nerr_match (NEOERR *err, int etype) +{ + while (err != STATUS_OK && err != INTERNAL_ERR) + { + + if (err->error == etype) + return 1; + err = err->next; + } + + if (err == STATUS_OK && etype == STATUS_OK_INT) + return 1; + if (err == STATUS_OK) + return 0; + + if (err == INTERNAL_ERR && etype == INTERNAL_ERR_INT) + return 1; + if (err == INTERNAL_ERR) + return 0; + + return 0; +} + +NEOERR *nerr_register (int *val, const char *name) +{ + NEOERR *err; + + err = uListAppend (Errors, (void *) name); + if (err != STATUS_OK) return nerr_pass(err); + + *val = uListLength(Errors); + return STATUS_OK; +} + +NEOERR *nerr_init (void) +{ + NEOERR *err; + + if (Inited == 0) + { +#ifdef HAVE_PTHREADS + /* In threaded environments, we have to mutex lock to do this init, but + * we don't want to use a mutex every time to check that it was Inited. + * So, we only lock if our first test of Inited was false */ + err = mLock(&InitLock); + if (err != STATUS_OK) return nerr_pass(err); + if (Inited == 0) { +#endif + err = uListInit (&Errors, 10, 0); + if (err != STATUS_OK) return nerr_pass(err); + + err = nerr_register (&NERR_PASS, "InternalPass"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_ASSERT, "AssertError"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_NOT_FOUND, "NotFoundError"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_DUPLICATE, "DuplicateError"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_NOMEM, "MemoryError"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_PARSE, "ParseError"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_OUTOFRANGE, "RangeError"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_SYSTEM, "SystemError"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_IO, "IOError"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_LOCK, "LockError"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_DB, "DBError"); + if (err != STATUS_OK) return nerr_pass(err); + err = nerr_register (&NERR_EXISTS, "ExistsError"); + if (err != STATUS_OK) return nerr_pass(err); + + Inited = 1; +#ifdef HAVE_PTHREADS + } + err = mUnlock(&InitLock); + if (err != STATUS_OK) return nerr_pass(err); +#endif + } + return STATUS_OK; +} diff --git a/src/util/neo/neo_err.h b/src/util/neo/neo_err.h new file mode 100644 index 0000000000000..001039173cd04 --- /dev/null +++ b/src/util/neo/neo_err.h @@ -0,0 +1,226 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#ifndef __NEO_ERR_H_ +#define __NEO_ERR_H_ 1 + +#include "neo_misc.h" + +/* For compilers (well, cpp actually) which don't define __PRETTY_FUNCTION__ */ +#ifndef __GNUC__ +#define __PRETTY_FUNCTION__ "unknown_function" +#endif + +__BEGIN_DECLS + +/* For 64 bit systems which don't like mixing ints and pointers, we have the + * _INT version for doing that comparison */ +#define STATUS_OK ((NEOERR *)0) +#define STATUS_OK_INT 0 +#define INTERNAL_ERR ((NEOERR *)1) +#define INTERNAL_ERR_INT 1 + +/* NEOERR flags */ +#define NE_IN_USE (1<<0) + +typedef int NERR_TYPE; + +/* Predefined Error Types - These are all registered in nerr_init */ +extern NERR_TYPE NERR_PASS; +extern NERR_TYPE NERR_ASSERT; +extern NERR_TYPE NERR_NOT_FOUND; +extern NERR_TYPE NERR_DUPLICATE; +extern NERR_TYPE NERR_NOMEM; +extern NERR_TYPE NERR_PARSE; +extern NERR_TYPE NERR_OUTOFRANGE; +extern NERR_TYPE NERR_SYSTEM; +extern NERR_TYPE NERR_IO; +extern NERR_TYPE NERR_LOCK; +extern NERR_TYPE NERR_DB; +extern NERR_TYPE NERR_EXISTS; + +typedef struct _neo_err +{ + int error; + int err_stack; + int flags; + char desc[256]; + const char *file; + const char *func; + int lineno; + /* internal use only */ + struct _neo_err *next; +} NEOERR; + +/* Technically, we could do this in configure and detect what their compiler + * can handle, but for now... */ +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define USE_C99_VARARG_MACROS 1 +#elif __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 4) || defined (S_SPLINT_S) +#define USE_GNUC_VARARG_MACROS 1 +#else +#error The compiler is missing support for variable-argument macros. +#endif + + +/* + * function: nerr_raise + * description: Use this method to create an error "exception" for + * return up the call chain + * arguments: using the macro, the function name, file, and lineno are + * automagically recorded for you. You just provide the + * error (from those listed above) and the printf-style + * reason. THIS IS A PRINTF STYLE FUNCTION, DO NOT PASS + * UNKNOWN STRING DATA AS THE FORMAT STRING. + * returns: a pointer to a NEOERR, or INTERNAL_ERR if allocation of + * NEOERR fails + */ +#if defined(USE_C99_VARARG_MACROS) +#define nerr_raise(e,f,...) \ + nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__) +#elif defined(USE_GNUC_VARARG_MACROS) +#define nerr_raise(e,f,a...) \ + nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a) +#endif + +NEOERR *nerr_raisef (const char *func, const char *file, int lineno, + NERR_TYPE error, const char *fmt, ...) + ATTRIBUTE_PRINTF(5,6); + + + +#if defined(USE_C99_VARARG_MACROS) +#define nerr_raise_errno(e,f,...) \ + nerr_raise_errnof(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__) +#elif defined(USE_GNUC_VARARG_MACROS) +#define nerr_raise_errno(e,f,a...) \ + nerr_raise_errnof(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a) +#endif + +NEOERR *nerr_raise_errnof (const char *func, const char *file, int lineno, + int error, const char *fmt, ...) + ATTRIBUTE_PRINTF(5,6); + +/* function: nerr_pass + * description: this function is used to pass an error up a level in the + * call chain (ie, if the error isn't handled at the + * current level). This allows us to track the traceback + * of the error. + * arguments: with the macro, the function name, file and lineno are + * automagically recorded. Just pass the error. + * returns: a pointer to an error + */ +#define nerr_pass(e) \ + nerr_passf(__PRETTY_FUNCTION__,__FILE__,__LINE__,e) + +NEOERR *nerr_passf (const char *func, const char *file, int lineno, + NEOERR *err); + +/* function: nerr_pass_ctx + * description: this function is used to pass an error up a level in the + * call chain (ie, if the error isn't handled at the + * current level). This allows us to track the traceback + * of the error. + * This version includes context information about lower + * errors + * arguments: with the macro, the function name, file and lineno are + * automagically recorded. Just pass the error and + * a printf format string giving more information about where + * the error is occuring. + * returns: a pointer to an error + */ +#if defined(USE_C99_VARARG_MACROS) +#define nerr_pass_ctx(e,f,...) \ + nerr_pass_ctxf(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__) +#elif defined(USE_GNUC_VARARG_MACROS) +#define nerr_pass_ctx(e,f,a...) \ + nerr_pass_ctxf(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,##a) +#endif + +NEOERR *nerr_pass_ctxf (const char *func, const char *file, int lineno, + NEOERR *err, const char *fmt, ...) + ATTRIBUTE_PRINTF(5,6); + +/* function: nerr_log_error + * description: currently, this prints out the error to stderr, and + * free's the error chain + */ +void nerr_log_error (NEOERR *err); + +#include "neo_str.h" +/* function: nerr_error_string + * description: returns the string associated with an error (the bottom + * level of the error chain) + * arguments: err - error + * str - string to which the data is appended + * returns: None - errors appending to the string are ignored + */ +void nerr_error_string (NEOERR *err, STRING *str); + +/* function: nerr_error_traceback + * description: returns the full traceback of the error chain + * arguments: err - error + * str - string to which the data is appended + * returns: None - errors appending to the string are ignored + */ +void nerr_error_traceback (NEOERR *err, STRING *str); + +/* function: nerr_ignore + * description: you should only call this if you actually handle the + * error (should I rename it?). Free's the error chain. + */ +void nerr_ignore (NEOERR **err); + +/* function: nerr_register + * description: register an error type. This will assign a numeric value + * to the type, and keep track of the "pretty name" for it. + * arguments: err - pointer to a NERR_TYPE + * name - pretty name for the error type + * returns: NERR_NOMEM on no memory + */ +NEOERR *nerr_register (NERR_TYPE *err, const char *name); + +/* function: nerr_init + * description: initialize the NEOERR system. Can be called more than once. + * Is not thread safe. This registers all of the built in + * error types as defined at the top of this file. If you don't + * call this, all exceptions will be returned as UnknownError. + * arguments: None + * returns: possibly NERR_NOMEM, but somewhat unlikely. Possibly an + * UnknownError if NERR_NOMEM hasn't been registered yet. + */ +NEOERR *nerr_init (void); + +/* function: nerr_match + * description: nerr_match is used to walk the NEOERR chain and match + * the error against a specific error type. In exception + * parlance, this would be the equivalent of "catch". + * Typically, you can just compare a NEOERR against STATUS_OK + * or just test for true if you are checking for any error. + * arguments: err - the NEOERR that has an error. + * type - the NEOERR type, as registered with nerr_register + * returns: true on match + */ +int nerr_match (NEOERR *err, NERR_TYPE type); + +/* function: nerr_handle + * description: nerr_handle is a convenience function. It is the equivalent + * of nerr_match, but it will also deallocate the error chain + * on a match. + * arguments: err - pointer to a pointer NEOERR + * type - the NEOERR type, as registered with nerr_register + * returns: true on match + */ +int nerr_handle (NEOERR **err, NERR_TYPE type); + +__END_DECLS + +#endif /* __NEO_ERR_H_ */ diff --git a/src/util/neo/neo_files.c b/src/util/neo/neo_files.c new file mode 100644 index 0000000000000..4a7f350c29082 --- /dev/null +++ b/src/util/neo/neo_files.c @@ -0,0 +1,256 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#include "cs_config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "neo_misc.h" +#include "neo_err.h" +#include "neo_files.h" +#include "wildmat.h" + +NEOERR *ne_mkdirs (const char *path, mode_t mode) +{ + char mypath[_POSIX_PATH_MAX]; + int x; + int r; + + strncpy (mypath, path, sizeof(mypath)); + x = strlen(mypath); + if ((x < sizeof(mypath)) && (mypath[x-1] != '/')) + { + mypath[x] = '/'; + mypath[x+1] = '\0'; + } + + for (x = 1; mypath[x]; x++) + { + if (mypath[x] == '/') + { + mypath[x] = '\0'; +#ifdef __MINGW32__ + /* Braindead MINGW32 doesn't just have a dummy argument for mode */ + r = mkdir (mypath); +#else + r = mkdir (mypath, mode); +#endif + + if (r == -1 && errno != EEXIST) + { + return nerr_raise_errno(NERR_SYSTEM, "ne_mkdirs: mkdir(%s, %x) failed", mypath, mode); + } + mypath[x] = '/'; + } + } + return STATUS_OK; +} + +NEOERR *ne_load_file_len (const char *path, char **str, int *out_len) +{ + struct stat s; + int fd; + int len; + int bytes_read; + + *str = NULL; + if (out_len) *out_len = 0; + + if (stat(path, &s) == -1) + { + if (errno == ENOENT) + return nerr_raise (NERR_NOT_FOUND, "File %s not found", path); + return nerr_raise_errno (NERR_SYSTEM, "Unable to stat file %s", path); + } + + fd = open (path, O_RDONLY); + if (fd == -1) + { + return nerr_raise_errno (NERR_SYSTEM, "Unable to open file %s", path); + } + len = s.st_size; + *str = (char *) malloc (len + 1); + + if (*str == NULL) + { + close(fd); + return nerr_raise (NERR_NOMEM, + "Unable to allocate memory (%d) to load file %s", len + 1, path); + } + if ((bytes_read = read (fd, *str, len)) == -1) + { + close(fd); + free(*str); + return nerr_raise_errno (NERR_SYSTEM, "Unable to read file %s", path); + } + + (*str)[bytes_read] = '\0'; + close(fd); + if (out_len) *out_len = bytes_read; + + return STATUS_OK; +} + +NEOERR *ne_load_file (const char *path, char **str) { + return ne_load_file_len (path, str, NULL); +} + +NEOERR *ne_save_file (const char *path, char *str) +{ + NEOERR *err; + int fd; + int w, l; + + fd = open (path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP ); + if (fd == -1) + { + return nerr_raise_errno (NERR_IO, "Unable to create file %s", path); + } + l = strlen(str); + w = write (fd, str, l); + if (w != l) + { + err = nerr_raise_errno (NERR_IO, "Unable to write file %s", path); + close (fd); + return err; + } + close (fd); + + return STATUS_OK; +} + +NEOERR *ne_remove_dir (const char *path) +{ + NEOERR *err; + DIR *dp; + struct stat s; + struct dirent *de; + char npath[_POSIX_PATH_MAX]; + + if (stat(path, &s) == -1) + { + if (errno == ENOENT) return STATUS_OK; + return nerr_raise_errno (NERR_SYSTEM, "Unable to stat file %s", path); + } + if (!S_ISDIR(s.st_mode)) + { + return nerr_raise (NERR_ASSERT, "Path %s is not a directory", path); + } + dp = opendir(path); + if (dp == NULL) + return nerr_raise_errno (NERR_IO, "Unable to open directory %s", path); + while ((de = readdir (dp)) != NULL) + { + if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) + { + snprintf (npath, sizeof(npath), "%s/%s", path, de->d_name); + if (stat(npath, &s) == -1) + { + if (errno == ENOENT) continue; + closedir(dp); + return nerr_raise_errno (NERR_SYSTEM, "Unable to stat file %s", npath); + } + if (S_ISDIR(s.st_mode)) + { + err = ne_remove_dir(npath); + if (err) break; + } + else + { + if (unlink(npath) == -1) + { + if (errno == ENOENT) continue; + closedir(dp); + return nerr_raise_errno (NERR_SYSTEM, "Unable to unlink file %s", + npath); + } + } + } + } + closedir(dp); + if (rmdir(path) == -1) + { + return nerr_raise_errno (NERR_SYSTEM, "Unable to rmdir %s", path); + } + return STATUS_OK; +} + +NEOERR *ne_listdir(const char *path, ULIST **files) +{ + return nerr_pass(ne_listdir_fmatch(path, files, NULL, NULL)); +} + +static int _glob_match(void *rock, const char *filename) +{ + return wildmat(filename, rock); +} + +NEOERR *ne_listdir_match(const char *path, ULIST **files, const char *match) +{ + return nerr_pass(ne_listdir_fmatch(path, files, _glob_match, (void *)match)); +} + +NEOERR *ne_listdir_fmatch(const char *path, ULIST **files, MATCH_FUNC fmatch, + void *rock) +{ + DIR *dp; + struct dirent *de; + ULIST *myfiles = NULL; + NEOERR *err = STATUS_OK; + + if (files == NULL) + return nerr_raise(NERR_ASSERT, "Invalid call to ne_listdir_fmatch"); + + if (*files == NULL) + { + err = uListInit(&myfiles, 10, 0); + if (err) return nerr_pass(err); + } + else + { + myfiles = *files; + } + + if ((dp = opendir (path)) == NULL) + { + return nerr_raise_errno(NERR_IO, "Unable to opendir %s", path); + } + while ((de = readdir (dp)) != NULL) + { + if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..")) + continue; + + if (fmatch != NULL && !fmatch(rock, de->d_name)) + continue; + + err = uListAppend(myfiles, strdup(de->d_name)); + if (err) break; + } + closedir(dp); + if (err && *files == NULL) + { + uListDestroy(&myfiles, ULIST_FREE); + } + else if (*files == NULL) + { + *files = myfiles; + } + return nerr_pass(err); +} diff --git a/src/util/neo/neo_files.h b/src/util/neo/neo_files.h new file mode 100644 index 0000000000000..203478a389591 --- /dev/null +++ b/src/util/neo/neo_files.h @@ -0,0 +1,37 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#ifndef __NEO_FILES_H_ +#define __NEO_FILES_H_ 1 + +__BEGIN_DECLS + +#include +#include +#include "ulist.h" + + + +typedef int (* MATCH_FUNC)(void *rock, const char *filename); + +NEOERR *ne_mkdirs (const char *path, mode_t mode); +NEOERR *ne_load_file (const char *path, char **str); +NEOERR *ne_load_file_len (const char *path, char **str, int *len); +NEOERR *ne_save_file (const char *path, char *str); +NEOERR *ne_remove_dir (const char *path); +NEOERR *ne_listdir(const char *path, ULIST **files); +NEOERR *ne_listdir_match(const char *path, ULIST **files, const char *match); +NEOERR *ne_listdir_fmatch(const char *path, ULIST **files, MATCH_FUNC fmatch, + void *rock); + +__END_DECLS + +#endif /* __NEO_FILES_H_ */ diff --git a/src/util/neo/neo_hash.c b/src/util/neo/neo_hash.c new file mode 100644 index 0000000000000..33942eca0fe50 --- /dev/null +++ b/src/util/neo/neo_hash.c @@ -0,0 +1,293 @@ +/* + * Copyright 2003-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#include "cs_config.h" + +#include +#include + +#include "neo_misc.h" +#include "neo_err.h" +#include "neo_hash.h" + +static NEOERR *_hash_resize(NE_HASH *hash); +static NE_HASHNODE **_hash_lookup_node (NE_HASH *hash, void *key, UINT32 *hashv); + +NEOERR *ne_hash_init (NE_HASH **hash, NE_HASH_FUNC hash_func, NE_COMP_FUNC comp_func) +{ + NE_HASH *my_hash = NULL; + + my_hash = (NE_HASH *) calloc(1, sizeof(NE_HASH)); + if (my_hash == NULL) + return nerr_raise(NERR_NOMEM, "Unable to allocate memory for NE_HASH"); + + my_hash->size = 256; + my_hash->num = 0; + my_hash->hash_func = hash_func; + my_hash->comp_func = comp_func; + + my_hash->nodes = (NE_HASHNODE **) calloc (my_hash->size, sizeof(NE_HASHNODE *)); + if (my_hash->nodes == NULL) + { + free(my_hash); + return nerr_raise(NERR_NOMEM, "Unable to allocate memory for NE_HASHNODES"); + } + + *hash = my_hash; + + return STATUS_OK; +} + +void ne_hash_destroy (NE_HASH **hash) +{ + NE_HASH *my_hash; + NE_HASHNODE *node, *next; + int x; + + if (hash == NULL || *hash == NULL) + return; + + my_hash = *hash; + + for (x = 0; x < my_hash->size; x++) + { + node = my_hash->nodes[x]; + while (node) + { + next = node->next; + free(node); + node = next; + } + } + free(my_hash->nodes); + my_hash->nodes = NULL; + free(my_hash); + *hash = NULL; +} + +NEOERR *ne_hash_insert(NE_HASH *hash, void *key, void *value) +{ + UINT32 hashv; + NE_HASHNODE **node; + + node = _hash_lookup_node(hash, key, &hashv); + + if (*node) + { + (*node)->value = value; + } + else + { + *node = (NE_HASHNODE *) malloc(sizeof(NE_HASHNODE)); + if (node == NULL) + return nerr_raise(NERR_NOMEM, "Unable to allocate NE_HASHNODE"); + + (*node)->hashv = hashv; + (*node)->key = key; + (*node)->value = value; + (*node)->next = NULL; + } + hash->num++; + + return _hash_resize(hash); +} + +void *ne_hash_lookup(NE_HASH *hash, void *key) +{ + NE_HASHNODE *node; + + node = *_hash_lookup_node(hash, key, NULL); + + return (node) ? node->value : NULL; +} + +void *ne_hash_remove(NE_HASH *hash, void *key) +{ + NE_HASHNODE **node, *remove; + void *value = NULL; + + node = _hash_lookup_node(hash, key, NULL); + if (*node) + { + remove = *node; + *node = remove->next; + value = remove->value; + free(remove); + hash->num--; + } + return value; +} + +int ne_hash_has_key(NE_HASH *hash, void *key) +{ + NE_HASHNODE *node; + + node = *_hash_lookup_node(hash, key, NULL); + + if (node) return 1; + return 0; +} + +void *ne_hash_next(NE_HASH *hash, void **key) +{ + NE_HASHNODE **node = 0; + UINT32 hashv, bucket; + + if (*key) + { + node = _hash_lookup_node(hash, key, NULL); + + if (*node) + { + bucket = (*node)->hashv & (hash->size - 1); + } + else + { + hashv = hash->hash_func(*key); + bucket = hashv & (hash->size - 1); + } + } + else + { + bucket = 0; + } + + if (*node) + { + if ((*node)->next) + { + *key = (*node)->next->key; + return (*node)->next->value; + } + bucket++; + } + + while (bucket < hash->size) + { + if (hash->nodes[bucket]) + { + *key = hash->nodes[bucket]->key; + return hash->nodes[bucket]->value; + } + bucket++; + } + + return NULL; +} + +static NE_HASHNODE **_hash_lookup_node (NE_HASH *hash, void *key, UINT32 *o_hashv) +{ + UINT32 hashv, bucket; + NE_HASHNODE **node; + + hashv = hash->hash_func(key); + if (o_hashv) *o_hashv = hashv; + bucket = hashv & (hash->size - 1); + /* ne_warn("Lookup %s %d %d", key, hashv, bucket); */ + + node = &(hash->nodes[bucket]); + + if (hash->comp_func) + { + while (*node && !(hash->comp_func((*node)->key, key))) + node = &(*node)->next; + } + else + { + /* No comp_func means we're doing pointer comparisons */ + while (*node && (*node)->key != key) + node = &(*node)->next; + } + + /* ne_warn("Node %x", node); */ + return node; +} + +/* Ok, we're doing some weirdness here... */ +static NEOERR *_hash_resize(NE_HASH *hash) +{ + NE_HASHNODE **new_nodes; + NE_HASHNODE *entry, *prev; + int x, next_bucket; + int orig_size = hash->size; + UINT32 hash_mask; + + if (hash->size > hash->num) + return STATUS_OK; + + /* We always double in size */ + new_nodes = (NE_HASHNODE **) realloc (hash->nodes, (hash->size*2) * sizeof(NE_HASHNODE)); + if (new_nodes == NULL) + return nerr_raise(NERR_NOMEM, "Unable to allocate memory to resize NE_HASH"); + + hash->nodes = new_nodes; + orig_size = hash->size; + hash->size = hash->size*2; + + /* Initialize new parts */ + for (x = orig_size; x < hash->size; x++) + { + hash->nodes[x] = NULL; + } + + hash_mask = hash->size - 1; + + for (x = 0; x < orig_size; x++) + { + prev = NULL; + next_bucket = x + orig_size; + for (entry = hash->nodes[x]; + entry; + entry = prev ? prev->next : hash->nodes[x]) + { + if ((entry->hashv & hash_mask) != x) + { + if (prev) + { + prev->next = entry->next; + } + else + { + hash->nodes[x] = entry->next; + } + entry->next = hash->nodes[next_bucket]; + hash->nodes[next_bucket] = entry; + } + else + { + prev = entry; + } + } + } + + return STATUS_OK; +} + +int ne_hash_str_comp(const void *a, const void *b) +{ + return !strcmp((const char *)a, (const char *)b); +} + +UINT32 ne_hash_str_hash(const void *a) +{ + return ne_crc((unsigned char *)a, strlen((const char *)a)); +} + +int ne_hash_int_comp(const void *a, const void *b) +{ + if (a == b) return 1; + return 0; +} + +UINT32 ne_hash_int_hash(const void *a) +{ + return (UINT32)(long)(a); +} diff --git a/src/util/neo/neo_hash.h b/src/util/neo/neo_hash.h new file mode 100644 index 0000000000000..7e75136bc587a --- /dev/null +++ b/src/util/neo/neo_hash.h @@ -0,0 +1,57 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#ifndef __NEO_HASH_H_ +#define __NEO_HASH_H_ 1 + +__BEGIN_DECLS + +#include +#include "neo_misc.h" + +typedef UINT32 (*NE_HASH_FUNC)(const void *); +typedef int (*NE_COMP_FUNC)(const void *, const void *); + +typedef struct _NE_HASHNODE +{ + void *key; + void *value; + UINT32 hashv; + struct _NE_HASHNODE *next; +} NE_HASHNODE; + +typedef struct _HASH +{ + UINT32 size; + UINT32 num; + + NE_HASHNODE **nodes; + NE_HASH_FUNC hash_func; + NE_COMP_FUNC comp_func; +} NE_HASH; + +NEOERR *ne_hash_init (NE_HASH **hash, NE_HASH_FUNC hash_func, NE_COMP_FUNC comp_func); +void ne_hash_destroy (NE_HASH **hash); +NEOERR *ne_hash_insert(NE_HASH *hash, void *key, void *value); +void *ne_hash_lookup(NE_HASH *hash, void *key); +int ne_hash_has_key(NE_HASH *hash, void *key); +void *ne_hash_remove(NE_HASH *hash, void *key); +void *ne_hash_next(NE_HASH *hash, void **key); + +int ne_hash_str_comp(const void *a, const void *b); +UINT32 ne_hash_str_hash(const void *a); + +int ne_hash_int_comp(const void *a, const void *b); +UINT32 ne_hash_int_hash(const void *a); + +__END_DECLS + +#endif /* __NEO_HASH_H_ */ diff --git a/src/util/neo/neo_hdf.c b/src/util/neo/neo_hdf.c new file mode 100644 index 0000000000000..5f42a6e097b0a --- /dev/null +++ b/src/util/neo/neo_hdf.c @@ -0,0 +1,1975 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#include "cs_config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "neo_misc.h" +#include "neo_err.h" +#include "neo_rand.h" +#include "neo_hdf.h" +#include "neo_str.h" +#include "neo_files.h" +#include "ulist.h" + +static char *_read_file(FILE *f) { + int size = 1024; + char *ret = malloc(size + 1); + char *newret; + + size_t nread; + char *buf = ret; + int len = size; + while (nread = fread(buf, 1, len, f)) { + buf += nread; + len -= nread; + if (len == 0) { + len = size; + size <<= 1; + + newret = realloc(ret, size + 1); + buf = buf - ret + newret; + ret = newret; + } + } + *buf = '\0'; + return ret; +} + +/* Ok, in order to use the hash, we have to support n-len strings + * instead of null terminated strings (since in set_value and walk_hdf + * we are merely using part of the HDF name for lookup, and that might + * be a const, and we don't want the overhead of allocating/copying + * that data out...) + * + * Since HASH doesn't maintain any data placed in it, merely pointers to + * it, we use the HDF node itself as the key, and have specific + * comp/hash functions which just use the name/name_len as the key. + */ + +static int hash_hdf_comp(const void *a, const void *b) +{ + HDF *ha = (HDF *)a; + HDF *hb = (HDF *)b; + + return (ha->name_len == hb->name_len) && !strncmp(ha->name, hb->name, ha->name_len); +} + +static UINT32 hash_hdf_hash(const void *a) +{ + HDF *ha = (HDF *)a; + return ne_crc((UINT8 *)(ha->name), ha->name_len); +} + +static NEOERR *_alloc_hdf (HDF **hdf, const char *name, size_t nlen, + const char *value, int dup, int wf, HDF *top) +{ + *hdf = calloc (1, sizeof (HDF)); + if (*hdf == NULL) + { + return nerr_raise (NERR_NOMEM, "Unable to allocate memory for hdf element"); + } + + (*hdf)->top = top; + + if (name != NULL) + { + (*hdf)->name_len = nlen; + (*hdf)->name = (char *) malloc (nlen + 1); + if ((*hdf)->name == NULL) + { + free((*hdf)); + (*hdf) = NULL; + return nerr_raise (NERR_NOMEM, + "Unable to allocate memory for hdf element: %s", name); + } + strncpy((*hdf)->name, name, nlen); + (*hdf)->name[nlen] = '\0'; + } + if (value != NULL) + { + if (dup) + { + (*hdf)->alloc_value = 1; + (*hdf)->value = strdup(value); + if ((*hdf)->value == NULL) + { + free((*hdf)->name); + free((*hdf)); + (*hdf) = NULL; + return nerr_raise (NERR_NOMEM, + "Unable to allocate memory for hdf element %s", name); + } + } + else + { + (*hdf)->alloc_value = wf; + /* We're overriding the const of value here for the set_buf case + * where we overrode the char * to const char * earlier, since + * alloc_value actually keeps track of the const-ness for us */ + (*hdf)->value = (char *)value; + } + } + return STATUS_OK; +} + +static void _dealloc_hdf_attr(HDF_ATTR **attr) +{ + HDF_ATTR *next; + + while ((*attr) != NULL) + { + next = (*attr)->next; + if ((*attr)->key) free((*attr)->key); + if ((*attr)->value) free((*attr)->value); + free(*attr); + *attr = next; + } + *attr = NULL; +} + +static void _dealloc_hdf (HDF **hdf) +{ + HDF *myhdf = *hdf; + HDF *next = NULL; + + if (myhdf == NULL) return; + if (myhdf->child != NULL) + _dealloc_hdf(&(myhdf->child)); + + /* This was easier recursively, but dangerous on long lists, so we + * walk it ourselves */ + next = myhdf->next; + while (next != NULL) + { + myhdf->next = next->next; + next->next = NULL; + _dealloc_hdf(&next); + next = myhdf->next; + } + if (myhdf->name != NULL) + { + free (myhdf->name); + myhdf->name = NULL; + } + if (myhdf->value != NULL) + { + if (myhdf->alloc_value) + free (myhdf->value); + myhdf->value = NULL; + } + if (myhdf->attr != NULL) + { + _dealloc_hdf_attr(&(myhdf->attr)); + } + if (myhdf->hash != NULL) + { + ne_hash_destroy(&myhdf->hash); + } + free(myhdf); + *hdf = NULL; +} + +NEOERR* hdf_init (HDF **hdf) +{ + NEOERR *err; + HDF *my_hdf; + + *hdf = NULL; + + err = nerr_init(); + if (err != STATUS_OK) + return nerr_pass (err); + + err = _alloc_hdf (&my_hdf, NULL, 0, NULL, 0, 0, NULL); + if (err != STATUS_OK) + return nerr_pass (err); + + my_hdf->top = my_hdf; + + *hdf = my_hdf; + + return STATUS_OK; +} + +void hdf_destroy (HDF **hdf) +{ + if (*hdf == NULL) return; + if ((*hdf)->top == (*hdf)) + { + _dealloc_hdf(hdf); + } +} + +static int _walk_hdf (HDF *hdf, const char *name, HDF **node) +{ + HDF *parent = NULL; + HDF *hp = hdf; + HDF hash_key; + int x = 0; + const char *s, *n; + int r; + + *node = NULL; + + if (hdf == NULL) return -1; + if (name == NULL || name[0] == '\0') + { + *node = hdf; + return 0; + } + + if (hdf->link) + { + r = _walk_hdf (hdf->top, hdf->value, &hp); + if (r) return r; + if (hp) + { + parent = hp; + hp = hp->child; + } + } + else + { + parent = hdf; + hp = hdf->child; + } + if (hp == NULL) + { + return -1; + } + + n = name; + s = strchr (n, '.'); + x = (s == NULL) ? strlen(n) : s - n; + + while (1) + { + if (parent && parent->hash) + { + hash_key.name = (char *)n; + hash_key.name_len = x; + hp = ne_hash_lookup(parent->hash, &hash_key); + } + else + { + while (hp != NULL) + { + if (hp->name && (x == hp->name_len) && !strncmp(hp->name, n, x)) + { + break; + } + else + { + hp = hp->next; + } + } + } + if (hp == NULL) + { + return -1; + } + if (s == NULL) break; + + if (hp->link) + { + r = _walk_hdf (hp->top, hp->value, &hp); + if (r) { + return r; + } + parent = hp; + hp = hp->child; + } + else + { + parent = hp; + hp = hp->child; + } + n = s + 1; + s = strchr (n, '.'); + x = (s == NULL) ? strlen(n) : s - n; + } + if (hp->link) + { + return _walk_hdf (hp->top, hp->value, node); + } + + *node = hp; + return 0; +} + +int hdf_get_int_value (HDF *hdf, const char *name, int defval) +{ + HDF *node; + int v; + char *n; + + if ((_walk_hdf(hdf, name, &node) == 0) && (node->value != NULL)) + { + v = strtol (node->value, &n, 10); + if (node->value == n) v = defval; + return v; + } + return defval; +} + +/* This should return a const char *, but changing this would have big + * repurcussions for any C code using this function, so no change for now */ +char* hdf_get_value (HDF *hdf, const char *name, const char *defval) +{ + HDF *node; + + if ((_walk_hdf(hdf, name, &node) == 0) && (node->value != NULL)) + { + return node->value; + } + return (char *)defval; +} + +char* hdf_get_valuevf (HDF *hdf, const char *namefmt, va_list ap) +{ + HDF *node; + char *name; + + name = vsprintf_alloc(namefmt, ap); + if (name == NULL) return NULL; + if ((_walk_hdf(hdf, name, &node) == 0) && (node->value != NULL)) + { + free(name); + return node->value; + } + free(name); + return NULL; +} + +char* hdf_get_valuef (HDF *hdf, const char *namefmt, ...) +{ + char *val; + va_list ap; + + va_start(ap, namefmt); + val = hdf_get_valuevf(hdf, namefmt, ap); + va_end(ap); + return val; +} + +NEOERR* hdf_get_copy (HDF *hdf, const char *name, char **value, + const char *defval) +{ + HDF *node; + + if ((_walk_hdf(hdf, name, &node) == 0) && (node->value != NULL)) + { + *value = strdup(node->value); + if (*value == NULL) + { + return nerr_raise (NERR_NOMEM, "Unable to allocate copy of %s", name); + } + } + else + { + if (defval == NULL) + *value = NULL; + else + { + *value = strdup(defval); + if (*value == NULL) + { + return nerr_raise (NERR_NOMEM, "Unable to allocate copy of %s", name); + } + } + } + return STATUS_OK; +} + +HDF* hdf_get_obj (HDF *hdf, const char *name) +{ + HDF *obj; + + _walk_hdf(hdf, name, &obj); + return obj; +} + +HDF* hdf_get_child (HDF *hdf, const char *name) +{ + HDF *obj; + _walk_hdf(hdf, name, &obj); + if (obj != NULL) return obj->child; + return obj; +} + +HDF_ATTR* hdf_get_attr (HDF *hdf, const char *name) +{ + HDF *obj; + _walk_hdf(hdf, name, &obj); + if (obj != NULL) return obj->attr; + return NULL; +} + +NEOERR* hdf_set_attr (HDF *hdf, const char *name, const char *key, + const char *value) +{ + HDF *obj; + HDF_ATTR *attr, *last; + + _walk_hdf(hdf, name, &obj); + if (obj == NULL) + return nerr_raise(NERR_ASSERT, "Unable to set attribute on none existant node"); + + if (obj->attr != NULL) + { + attr = obj->attr; + last = attr; + while (attr != NULL) + { + if (!strcmp(attr->key, key)) + { + if (attr->value) free(attr->value); + /* a set of NULL deletes the attr */ + if (value == NULL) + { + if (attr == obj->attr) + obj->attr = attr->next; + else + last->next = attr->next; + free(attr->key); + free(attr); + return STATUS_OK; + } + attr->value = strdup(value); + if (attr->value == NULL) + return nerr_raise(NERR_NOMEM, "Unable to set attr %s to %s", key, value); + return STATUS_OK; + } + last = attr; + attr = attr->next; + } + last->next = (HDF_ATTR *) calloc(1, sizeof(HDF_ATTR)); + if (last->next == NULL) + return nerr_raise(NERR_NOMEM, "Unable to set attr %s to %s", key, value); + attr = last->next; + } + else + { + if (value == NULL) return STATUS_OK; + obj->attr = (HDF_ATTR *) calloc(1, sizeof(HDF_ATTR)); + if (obj->attr == NULL) + return nerr_raise(NERR_NOMEM, "Unable to set attr %s to %s", key, value); + attr = obj->attr; + } + attr->key = strdup(key); + attr->value = strdup(value); + if (attr->key == NULL || attr->value == NULL) + return nerr_raise(NERR_NOMEM, "Unable to set attr %s to %s", key, value); + + return STATUS_OK; +} + +HDF* hdf_obj_child (HDF *hdf) +{ + HDF *obj; + if (hdf == NULL) return NULL; + if (hdf->link) + { + if (_walk_hdf(hdf->top, hdf->value, &obj)) + return NULL; + return obj->child; + } + return hdf->child; +} + +HDF* hdf_obj_next (HDF *hdf) +{ + if (hdf == NULL) return NULL; + return hdf->next; +} + +HDF* hdf_obj_top (HDF *hdf) +{ + if (hdf == NULL) return NULL; + return hdf->top; +} + +HDF_ATTR* hdf_obj_attr (HDF *hdf) +{ + if (hdf == NULL) return NULL; + return hdf->attr; +} + +char* hdf_obj_name (HDF *hdf) +{ + if (hdf == NULL) return NULL; + return hdf->name; +} + +char* hdf_obj_value (HDF *hdf) +{ + int count = 0; + + if (hdf == NULL) return NULL; + while (hdf->link && count < 100) + { + if (_walk_hdf (hdf->top, hdf->value, &hdf)) + return NULL; + count++; + } + return hdf->value; +} + +void _merge_attr (HDF_ATTR *dest, HDF_ATTR *src) +{ + HDF_ATTR *da, *ld; + HDF_ATTR *sa, *ls; + BOOL found; + + sa = src; + ls = src; + while (sa != NULL) + { + da = dest; + ld = da; + found = 0; + while (da != NULL) + { + if (!strcmp(da->key, sa->key)) + { + if (da->value) free(da->value); + da->value = sa->value; + sa->value = NULL; + found = 1; + break; + } + ld = da; + da = da->next; + } + if (!found) + { + ld->next = sa; + ls->next = sa->next; + if (src == sa) src = sa->next; + ld->next->next = NULL; + sa = ls->next; + } + else + { + ls = sa; + sa = sa->next; + } + } + _dealloc_hdf_attr(&src); +} + +NEOERR* _hdf_hash_level(HDF *hdf) +{ + NEOERR *err; + HDF *child; + + err = ne_hash_init(&(hdf->hash), hash_hdf_hash, hash_hdf_comp); + if (err) return nerr_pass(err); + + child = hdf->child; + while (child) + { + err = ne_hash_insert(hdf->hash, child, child); + if (err) return nerr_pass(err); + child = child->next; + } + return STATUS_OK; +} + +static NEOERR* _set_value (HDF *hdf, const char *name, const char *value, + int dup, int wf, int link, HDF_ATTR *attr, + HDF **set_node) +{ + NEOERR *err; + HDF *hn, *hp, *hs; + HDF hash_key; + int x = 0; + const char *s = name; + const char *n = name; + int count = 0; + + if (set_node != NULL) *set_node = NULL; + if (hdf == NULL) + { + return nerr_raise(NERR_ASSERT, "Unable to set %s on NULL hdf", name); + } + + /* HACK: allow setting of this node by passing an empty name */ + if (name == NULL || name[0] == '\0') + { + /* handle setting attr first */ + if (hdf->attr == NULL) + { + hdf->attr = attr; + } + else + { + _merge_attr(hdf->attr, attr); + } + /* if we're setting ourselves to ourselves... */ + if (hdf->value == value) + { + if (set_node != NULL) *set_node = hdf; + return STATUS_OK; + } + if (hdf->alloc_value) + { + free(hdf->value); + hdf->value = NULL; + } + if (value == NULL) + { + hdf->alloc_value = 0; + hdf->value = NULL; + } + else if (dup) + { + hdf->alloc_value = 1; + hdf->value = strdup(value); + if (hdf->value == NULL) + return nerr_raise (NERR_NOMEM, "Unable to duplicate value %s for %s", + value, name); + } + else + { + hdf->alloc_value = wf; + hdf->value = (char *)value; + } + if (set_node != NULL) *set_node = hdf; + return STATUS_OK; + } + + n = name; + s = strchr (n, '.'); + x = (s != NULL) ? s - n : strlen(n); + if (x == 0) + { + return nerr_raise(NERR_ASSERT, "Unable to set Empty component %s", name); + } + + if (hdf->link) + { + char *new_name = (char *) malloc(strlen(hdf->value) + 1 + strlen(name) + 1); + if (new_name == NULL) + { + return nerr_raise(NERR_NOMEM, "Unable to allocate memory"); + } + strcpy(new_name, hdf->value); + strcat(new_name, "."); + strcat(new_name, name); + err = _set_value (hdf->top, new_name, value, dup, wf, link, attr, set_node); + free(new_name); + return nerr_pass(err); + } + else + { + hn = hdf; + } + + while (1) + { + /* examine cache to see if we have a match */ + count = 0; + hp = hn->last_hp; + hs = hn->last_hs; + + if ((hs == NULL && hp == hn->child) || (hs && hs->next == hp)) + { + if (hp && hp->name && (x == hp->name_len) && !strncmp (hp->name, n, x)) + { + goto skip_search; + } + } + + hp = hn->child; + hs = NULL; + + /* Look for a matching node at this level */ + if (hn->hash != NULL) + { + hash_key.name = (char *)n; + hash_key.name_len = x; + hp = ne_hash_lookup(hn->hash, &hash_key); + hs = hn->last_child; + } + else + { + while (hp != NULL) + { + if (hp->name && (x == hp->name_len) && !strncmp(hp->name, n, x)) + { + break; + } + hs = hp; + hp = hp->next; + count++; + } + } + + /* save in cache any value we found */ + if (hp) { + hn->last_hp = hp; + hn->last_hs = hs; + } + +skip_search: + + if (hp == NULL) + { + /* If there was no matching node at this level, we need to + * allocate an intersitial node (or the actual node if we're + * at the last part of the HDF name) */ + if (s != NULL) + { + /* intersitial */ + err = _alloc_hdf (&hp, n, x, NULL, 0, 0, hdf->top); + } + else + { + err = _alloc_hdf (&hp, n, x, value, dup, wf, hdf->top); + if (link) hp->link = 1; + else hp->link = 0; + hp->attr = attr; + } + if (err != STATUS_OK) + return nerr_pass (err); + if (hn->child == NULL) + hn->child = hp; + else + hs->next = hp; + hn->last_child = hp; + + /* This is the point at which we convert to a hash table + * at this level, if we're over the count */ + if (count > FORCE_HASH_AT && hn->hash == NULL) + { + err = _hdf_hash_level(hn); + if (err) return nerr_pass(err); + } + else if (hn->hash != NULL) + { + err = ne_hash_insert(hn->hash, hp, hp); + if (err) return nerr_pass(err); + } + } + else if (s == NULL) + { + /* If there is a matching node and we're at the end of the HDF + * name, then we update the value of the node */ + /* handle setting attr first */ + if (hp->attr == NULL) + { + hp->attr = attr; + } + else + { + _merge_attr(hp->attr, attr); + } + if (hp->value != value) + { + if (hp->alloc_value) + { + free(hp->value); + hp->value = NULL; + } + if (value == NULL) + { + hp->alloc_value = 0; + hp->value = NULL; + } + else if (dup) + { + hp->alloc_value = 1; + hp->value = strdup(value); + if (hp->value == NULL) + return nerr_raise (NERR_NOMEM, "Unable to duplicate value %s for %s", + value, name); + } + else + { + hp->alloc_value = wf; + hp->value = (char *)value; + } + } + if (link) hp->link = 1; + else hp->link = 0; + } + else if (hp->link) + { + char *new_name = (char *) malloc(strlen(hp->value) + strlen(s) + 1); + if (new_name == NULL) + { + return nerr_raise(NERR_NOMEM, "Unable to allocate memory"); + } + strcpy(new_name, hp->value); + strcat(new_name, s); + err = _set_value (hdf->top, new_name, value, dup, wf, link, attr, set_node); + free(new_name); + return nerr_pass(err); + } + /* At this point, we're done if there is not more HDF name space to + * traverse */ + if (s == NULL) + break; + /* Otherwise, we need to find the next part of the namespace */ + n = s + 1; + s = strchr (n, '.'); + x = (s != NULL) ? s - n : strlen(n); + if (x == 0) + { + return nerr_raise(NERR_ASSERT, "Unable to set Empty component %s", name); + } + hn = hp; + } + if (set_node != NULL) *set_node = hp; + return STATUS_OK; +} + +NEOERR* hdf_set_value (HDF *hdf, const char *name, const char *value) +{ + return nerr_pass(_set_value (hdf, name, value, 1, 1, 0, NULL, NULL)); +} + +NEOERR* hdf_set_value_attr (HDF *hdf, const char *name, const char *value, + HDF_ATTR *attr) +{ + return nerr_pass(_set_value (hdf, name, value, 1, 1, 0, attr, NULL)); +} + +NEOERR* hdf_set_symlink (HDF *hdf, const char *src, const char *dest) +{ + return nerr_pass(_set_value (hdf, src, dest, 1, 1, 1, NULL, NULL)); +} + +NEOERR* hdf_set_int_value (HDF *hdf, const char *name, int value) +{ + char buf[256]; + + snprintf (buf, sizeof(buf), "%d", value); + return nerr_pass(_set_value (hdf, name, buf, 1, 1, 0, NULL, NULL)); +} + +NEOERR* hdf_set_buf (HDF *hdf, const char *name, char *value) +{ + return nerr_pass(_set_value (hdf, name, value, 0, 1, 0, NULL, NULL)); +} + +NEOERR* hdf_set_copy (HDF *hdf, const char *dest, const char *src) +{ + HDF *node; + if ((_walk_hdf(hdf, src, &node) == 0) && (node->value != NULL)) + { + return nerr_pass(_set_value (hdf, dest, node->value, 0, 0, 0, NULL, NULL)); + } + return nerr_raise (NERR_NOT_FOUND, "Unable to find %s", src); +} + +NEOERR* hdf_set_valuevf (HDF *hdf, const char *fmt, va_list ap) +{ + NEOERR *err; + char *k; + char *v; + + k = vsprintf_alloc(fmt, ap); + if (k == NULL) + { + return nerr_raise(NERR_NOMEM, "Unable to allocate memory for format string"); + } + v = strchr(k, '='); + if (v == NULL) + { + err = nerr_raise(NERR_ASSERT, "No equals found: %s", k); + free(k); + return err; + } + *v++ = '\0'; + err = hdf_set_value(hdf, k, v); + free(k); + return nerr_pass(err); +} + +NEOERR* hdf_set_valuef (HDF *hdf, const char *fmt, ...) +{ + NEOERR *err; + va_list ap; + + va_start(ap, fmt); + err = hdf_set_valuevf(hdf, fmt, ap); + va_end(ap); + return nerr_pass(err); +} + +NEOERR* hdf_get_node (HDF *hdf, const char *name, HDF **ret) +{ + _walk_hdf(hdf, name, ret); + if (*ret == NULL) + { + return nerr_pass(_set_value (hdf, name, NULL, 0, 1, 0, NULL, ret)); + } + return STATUS_OK; +} + +/* Ok, this version avoids the bubble sort by walking the level once to + * load them all into a ULIST, qsort'ing the list, and then dumping them + * back out... */ +NEOERR *hdf_sort_obj (HDF *h, int (*compareFunc)(const void *, const void *)) +{ + NEOERR *err = STATUS_OK; + ULIST *level = NULL; + HDF *p, *c; + int x; + + if (h == NULL) return STATUS_OK; + c = h->child; + if (c == NULL) return STATUS_OK; + + do { + err = uListInit(&level, 40, 0); + if (err) return nerr_pass(err); + for (p = c; p; p = p->next) { + err = uListAppend(level, p); + if (err) break; + } + err = uListSort(level, compareFunc); + if (err) break; + uListGet(level, 0, (void *)&c); + h->child = c; + for (x = 1; x < uListLength(level); x++) + { + uListGet(level, x, (void *)&p); + c->next = p; + p->next = NULL; + c = p; + } + h->last_child = c; + } while (0); + uListDestroy(&level, 0); + return nerr_pass(err); +} + +NEOERR* hdf_remove_tree (HDF *hdf, const char *name) +{ + HDF *hp = hdf; + HDF *lp = NULL, *ln = NULL; /* last parent, last node */ + int x = 0; + const char *s = name; + const char *n = name; + + if (hdf == NULL) return STATUS_OK; + + hp = hdf->child; + if (hp == NULL) + { + return STATUS_OK; + } + + lp = hdf; + ln = NULL; + + n = name; + s = strchr (n, '.'); + x = (s == NULL) ? strlen(n) : s - n; + + while (1) + { + while (hp != NULL) + { + if (hp->name && (x == hp->name_len) && !strncmp(hp->name, n, x)) + { + break; + } + else + { + ln = hp; + hp = hp->next; + } + } + if (hp == NULL) + { + return STATUS_OK; + } + if (s == NULL) break; + + lp = hp; + ln = NULL; + hp = hp->child; + n = s + 1; + s = strchr (n, '.'); + x = (s == NULL) ? strlen(n) : s - n; + } + + if (lp->hash != NULL) + { + ne_hash_remove(lp->hash, hp); + } + if (ln) + { + ln->next = hp->next; + /* check to see if we are the last parent's last_child, if so + * repoint so hash table inserts will go to the right place */ + if (hp == lp->last_child) + lp->last_child = ln; + hp->next = NULL; + } + else + { + lp->child = hp->next; + hp->next = NULL; + } + _dealloc_hdf (&hp); + + return STATUS_OK; +} + +static NEOERR * _copy_attr (HDF_ATTR **dest, HDF_ATTR *src) +{ + HDF_ATTR *copy, *last = NULL; + + *dest = NULL; + while (src != NULL) + { + copy = (HDF_ATTR *)malloc(sizeof(HDF_ATTR)); + if (copy == NULL) + { + _dealloc_hdf_attr(dest); + return nerr_raise(NERR_NOMEM, "Unable to allocate copy of HDF_ATTR"); + } + copy->key = strdup(src->key); + copy->value = strdup(src->value); + copy->next = NULL; + if ((copy->key == NULL) || (copy->value == NULL)) + { + _dealloc_hdf_attr(dest); + return nerr_raise(NERR_NOMEM, "Unable to allocate copy of HDF_ATTR"); + } + if (last) { + last->next = copy; + } + else + { + *dest = copy; + } + last = copy; + src = src->next; + } + return STATUS_OK; +} + +static NEOERR * _copy_nodes (HDF *dest, HDF *src) +{ + NEOERR *err = STATUS_OK; + HDF *dt, *st; + HDF_ATTR *attr_copy; + + st = src->child; + while (st != NULL) + { + err = _copy_attr(&attr_copy, st->attr); + if (err) return nerr_pass(err); + err = _set_value(dest, st->name, st->value, 1, 1, st->link, attr_copy, &dt); + if (err) { + _dealloc_hdf_attr(&attr_copy); + return nerr_pass(err); + } + if (src->child) + { + err = _copy_nodes (dt, st); + if (err) return nerr_pass(err); + } + st = st->next; + } + return STATUS_OK; +} + +NEOERR* hdf_copy (HDF *dest, const char *name, HDF *src) +{ + NEOERR *err; + HDF *node; + HDF_ATTR *attr_copy; + + if (_walk_hdf(dest, name, &node) == -1) + { + err = _copy_attr(&attr_copy, src->attr); + if (err) return nerr_pass(err); + err = _set_value (dest, name, src->value, 1, 1, src->link, attr_copy, + &node); + if (err) { + _dealloc_hdf_attr(&attr_copy); + return nerr_pass(err); + } + } + return nerr_pass (_copy_nodes (node, src)); +} + +/* BUG: currently, this only prints something if there is a value... + * but we now allow attributes on nodes with no value... */ + +static void gen_ml_break(char *ml, size_t len) +{ + int nlen; + int x = 0; + + ml[x++] = '\n'; + nlen = 2 + neo_rand(len-5); + if (nlen == 0) + { + nlen = len / 2; + } + while (nlen) + { + ml[x++] = ('A' + neo_rand(26)); + nlen--; + } + ml[x++] = '\n'; + ml[x] = '\0'; +} + +typedef NEOERR *(*DUMPF_CB)(void *rock, const char *fmt, ...); + +static NEOERR *_fp_dump_cb (void *rock, const char *fmt, ...) +{ + FILE *fp = (FILE *)rock; + va_list ap; + + va_start (ap, fmt); + vfprintf(fp, fmt, ap); + va_end(ap); + return STATUS_OK; +} + +static NEOERR *_string_dump_cb (void *rock, const char *fmt, ...) +{ + NEOERR *err; + STRING *str = (STRING *)rock; + va_list ap; + + va_start (ap, fmt); + err = string_appendvf(str, fmt, ap); + va_end(ap); + return nerr_pass(err); +} + +#define DUMP_TYPE_DOTTED 0 +#define DUMP_TYPE_COMPACT 1 +#define DUMP_TYPE_PRETTY 2 + +static NEOERR* hdf_dump_cb(HDF *hdf, const char *prefix, int dtype, int lvl, + void *rock, DUMPF_CB dump_cbf) +{ + NEOERR *err; + char *p, op; + char ml[10] = "\nEOM\n"; + int ml_len = strlen(ml); + char whsp[256] = ""; + + if (dtype == DUMP_TYPE_PRETTY) + { + memset(whsp, ' ', 256); + if (lvl > 127) + lvl = 127; + whsp[lvl*2] = '\0'; + } + + if (hdf != NULL) hdf = hdf->child; + + while (hdf != NULL) + { + op = '='; + if (hdf->value) + { + if (hdf->link) op = ':'; + if (prefix && (dtype == DUMP_TYPE_DOTTED)) + { + err = dump_cbf(rock, "%s.%s", prefix, hdf->name); + } + else + { + err = dump_cbf(rock, "%s%s", whsp, hdf->name); + } + if (err) return nerr_pass (err); + if (hdf->attr) + { + HDF_ATTR *attr = hdf->attr; + char *v = NULL; + + err = dump_cbf(rock, " ["); + if (err) return nerr_pass(err); + while (attr != NULL) + { + if (attr->value == NULL || !strcmp(attr->value, "1")) + err = dump_cbf(rock, "%s", attr->key); + else + { + v = repr_string_alloc(attr->value); + + if (v == NULL) + return nerr_raise(NERR_NOMEM, "Unable to repr attr %s value %s", attr->key, attr->value); + err = dump_cbf(rock, "%s=%s", attr->key, v); + free(v); + } + if (err) return nerr_pass(err); + if (attr->next) + { + err = dump_cbf(rock, ", "); + if (err) return nerr_pass(err); + } + attr = attr->next; + } + err = dump_cbf(rock, "] "); + if (err) return nerr_pass(err); + } + if (strchr (hdf->value, '\n')) + { + int vlen = strlen(hdf->value); + + while (strstr(hdf->value, ml) || ((vlen > ml_len) && !strncmp(hdf->value + vlen - ml_len + 1, ml, strlen(ml) - 1))) + { + gen_ml_break(ml, sizeof(ml)); + ml_len = strlen(ml); + } + if (hdf->value[strlen(hdf->value)-1] != '\n') + err = dump_cbf(rock, " << %s%s%s", ml+1, hdf->value, ml); + else + err = dump_cbf(rock, " << %s%s%s", ml+1, hdf->value, ml+1); + } + else + { + err = dump_cbf(rock, " %c %s\n", op, hdf->value); + } + if (err) return nerr_pass (err); + } + if (hdf->child) + { + if (prefix && (dtype == DUMP_TYPE_DOTTED)) + { + p = (char *) malloc (strlen(hdf->name) + strlen(prefix) + 2); + sprintf (p, "%s.%s", prefix, hdf->name); + err = hdf_dump_cb (hdf, p, dtype, lvl+1, rock, dump_cbf); + free(p); + } + else + { + if (hdf->name && (dtype != DUMP_TYPE_DOTTED)) + { + err = dump_cbf(rock, "%s%s {\n", whsp, hdf->name); + if (err) return nerr_pass (err); + err = hdf_dump_cb (hdf, hdf->name, dtype, lvl+1, rock, dump_cbf); + if (err) return nerr_pass (err); + err = dump_cbf(rock, "%s}\n", whsp); + } + else + { + err = hdf_dump_cb (hdf, hdf->name, dtype, lvl+1, rock, dump_cbf); + } + } + if (err) return nerr_pass (err); + } + hdf = hdf->next; + } + return STATUS_OK; +} + +NEOERR* hdf_dump_str (HDF *hdf, const char *prefix, int dtype, STRING *str) +{ + return nerr_pass(hdf_dump_cb(hdf, prefix, dtype, 0, str, _string_dump_cb)); +} + +NEOERR* hdf_dump(HDF *hdf, const char *prefix) +{ + return nerr_pass(hdf_dump_cb(hdf, prefix, DUMP_TYPE_DOTTED, 0, stdout, _fp_dump_cb)); +} + +NEOERR* hdf_dump_format (HDF *hdf, int lvl, FILE *fp) +{ + return nerr_pass(hdf_dump_cb(hdf, "", DUMP_TYPE_PRETTY, 0, fp, _fp_dump_cb)); +} + +NEOERR *hdf_write_file (HDF *hdf, const char *path) +{ + NEOERR *err; + FILE *fp; + + fp = fopen(path, "w"); + if (fp == NULL) + return nerr_raise_errno (NERR_IO, "Unable to open %s for writing", path); + + err = hdf_dump_format (hdf, 0, fp); + + fclose (fp); + if (err) + { + unlink(path); + } + return nerr_pass(err); +} + +NEOERR *hdf_write_file_atomic (HDF *hdf, const char *path) +{ + NEOERR *err; + FILE *fp; + char tpath[_POSIX_PATH_MAX]; + static int count = 0; + + snprintf(tpath, sizeof(tpath), "%s.%5.5f.%d", path, ne_timef(), count++); + + fp = fopen(tpath, "w"); + if (fp == NULL) + return nerr_raise_errno (NERR_IO, "Unable to open %s for writing", tpath); + + err = hdf_dump_format (hdf, 0, fp); + + fclose (fp); + + if (err) + { + unlink(tpath); + return nerr_pass(err); + } + if (rename(tpath, path) == -1) + { + unlink (tpath); + return nerr_raise_errno (NERR_IO, "Unable to rename file %s to %s", + tpath, path); + } + + return STATUS_OK; +} + +NEOERR *hdf_write_string (HDF *hdf, char **s) +{ + STRING str; + NEOERR *err; + + *s = NULL; + + string_init (&str); + + err = hdf_dump_str (hdf, NULL, 2, &str); + if (err) + { + string_clear (&str); + return nerr_pass(err); + } + if (str.buf == NULL) + { + *s = strdup(""); + if (*s == NULL) return nerr_raise(NERR_NOMEM, "Unable to allocate empty string"); + } + else + { + *s = str.buf; + } + + return STATUS_OK; +} + + +#define SKIPWS(s) while (*s && isspace(*s)) s++; + +static int _copy_line (const char **s, char *buf, size_t buf_len) +{ + int x = 0; + const char *st = *s; + + while (*st && x < buf_len-1) + { + buf[x++] = *st; + if (*st++ == '\n') break; + } + buf[x] = '\0'; + *s = st; + + return x; +} + +/* Copy the characters in the file (up to the next newline) into line + * and advance s to the next line */ +static NEOERR *_copy_line_advance(const char **s, STRING *line) +{ + NEOERR *err; + int x = 0; + const char *st = *s; + const char *nl; + + nl = strchr(st, '\n'); + if (nl == NULL) + { + x = strlen(st); + err = string_appendn(line, st, x); + if (err) return nerr_pass(err); + *s = st + x; + } + else + { + x = nl - st; + err = string_appendn(line, st, x); + if (err) return nerr_pass(err); + *s = nl + 1; + } + + return STATUS_OK; +} + +char *_strndup(const char *s, int len) { + int x; + char *dup; + if (s == NULL) return NULL; + dup = (char *) malloc(len+1); + if (dup == NULL) return NULL; + for (x = 0; x < len && s[x]; x++) + { + dup[x] = s[x]; + } + dup[x] = '\0'; + dup[len] = '\0'; + return dup; +} + +/* attributes are of the form [key1, key2, key3=value, key4="repr"] */ +static NEOERR* parse_attr(char **str, HDF_ATTR **attr) +{ + NEOERR *err = STATUS_OK; + char *s = *str; + char *k, *v; + int k_l, v_l; + STRING buf; + char c; + HDF_ATTR *ha, *hal = NULL; + + *attr = NULL; + + string_init(&buf); + while (*s && *s != ']') + { + k = s; + k_l = 0; + v = NULL; + v_l = 0; + while (*s && isalnum(*s)) s++; + k_l = s-k; + if (*s == '\0' || k_l == 0) + { + _dealloc_hdf_attr(attr); + return nerr_raise(NERR_PARSE, "Misformed attribute specification: %s", *str); + } + SKIPWS(s); + if (*s == '=') + { + s++; + SKIPWS(s); + if (*s == '"') + { + s++; + while (*s && *s != '"') + { + if (*s == '\\') + { + if (isdigit(*(s+1))) + { + s++; + c = *s - '0'; + if (isdigit(*(s+1))) + { + s++; + c = (c * 8) + (*s - '0'); + if (isdigit(*(s+1))) + { + s++; + c = (c * 8) + (*s - '0'); + } + } + } + else + { + s++; + if (*s == 'n') c = '\n'; + else if (*s == 't') c = '\t'; + else if (*s == 'r') c = '\r'; + else c = *s; + } + err = string_append_char(&buf, c); + } + else + { + err = string_append_char(&buf, *s); + } + if (err) + { + string_clear(&buf); + _dealloc_hdf_attr(attr); + return nerr_pass(err); + } + s++; + } + if (*s == '\0') + { + _dealloc_hdf_attr(attr); + string_clear(&buf); + return nerr_raise(NERR_PARSE, "Misformed attribute specification: %s", *str); + } + s++; + v = buf.buf; + v_l = buf.len; + } + else + { + v = s; + while (*s && *s != ' ' && *s != ',' && *s != ']') s++; + if (*s == '\0') + { + _dealloc_hdf_attr(attr); + return nerr_raise(NERR_PARSE, "Misformed attribute specification: %s", *str); + } + v_l = s-v; + } + } + else + { + v = "1"; + } + ha = (HDF_ATTR*) calloc (1, sizeof(HDF_ATTR)); + if (ha == NULL) + { + _dealloc_hdf_attr(attr); + string_clear(&buf); + return nerr_raise(NERR_NOMEM, "Unable to load attributes: %s", s); + } + if (*attr == NULL) *attr = ha; + ha->key = _strndup(k, k_l); + if (v) + ha->value = _strndup(v, v_l); + else + ha->value = strdup(""); + if (ha->key == NULL || ha->value == NULL) + { + _dealloc_hdf_attr(attr); + string_clear(&buf); + return nerr_raise(NERR_NOMEM, "Unable to load attributes: %s", s); + } + if (hal != NULL) hal->next = ha; + hal = ha; + string_clear(&buf); + SKIPWS(s); + if (*s == ',') + { + s++; + SKIPWS(s); + } + } + if (*s == '\0') + { + _dealloc_hdf_attr(attr); + return nerr_raise(NERR_PARSE, "Misformed attribute specification: %s", *str); + } + *str = s+1; + return STATUS_OK; +} + +#define INCLUDE_ERROR 0 +#define INCLUDE_IGNORE 1 +#define INCLUDE_FILE 2 + +static NEOERR* _hdf_read_string (HDF *hdf, const char **str, STRING *line, + const char *path, int *lineno, + int include_handle, int expect_end_brace) { + NEOERR *err; + HDF *lower; + char *s; + char *name, *value; + HDF_ATTR *attr = NULL; + + while (**str != '\0') + { + /* Reset string length, but don't free the reserved buffer */ + line->len = 0; + err = _copy_line_advance(str, line); + if (err) return nerr_pass(err); + attr = NULL; + (*lineno)++; + s = line->buf; + SKIPWS(s); + if (!strncmp(s, "#include ", 9) || !strncmp(s, "-include ", 9)) + { + int required = !strncmp(s, "#include ", 9); + if (include_handle == INCLUDE_ERROR) + { + return nerr_raise (NERR_PARSE, + "[%d]: #include not supported in string parse", + *lineno); + } + else if (include_handle == INCLUDE_FILE) + { + int l; + s += 9; + name = neos_strip(s); + l = strlen(name); + if (name[0] == '"' && name[l-1] == '"') + { + name[l-1] = '\0'; + name++; + } + char fullpath[PATH_MAX]; + if (name[0] != '/') { + memset(fullpath, 0, PATH_MAX); + + char *p = strrchr(path, '/'); + if (p == NULL) { + char pwd[PATH_MAX]; + memset(pwd, 0, PATH_MAX); + getcwd(pwd, PATH_MAX); + snprintf(fullpath, PATH_MAX, "%s/%s", pwd, name); + } else { + int dir_len = p - path + 1; + snprintf(fullpath, PATH_MAX, "%s", path); + snprintf(fullpath + dir_len, PATH_MAX - dir_len, "%s", name); + } + name = fullpath; + } + err = hdf_read_file(hdf, name); + if (err != STATUS_OK && required) + { + return nerr_pass_ctx(err, "In file %s:%d", path, *lineno); + } + } + } + else if (s[0] == '#') + { + /* comment: pass */ + } + else if (s[0] == '}') /* up */ + { + s = neos_strip(s); + if (strcmp(s, "}")) + { + err = nerr_raise(NERR_PARSE, + "[%s:%d] Trailing garbage on line following }: %s", path, *lineno, + line->buf); + return err; + } + return STATUS_OK; + } + else if (s[0]) + { + /* Valid hdf name is [0-9a-zA-Z_.]+ */ + int splice = *s == '@'; + if (splice) s++; + name = s; + while (*s && (isalnum(*s) || *s == '_' || *s == '.' || *s == '*')) s++; + SKIPWS(s); + + char num[16]; + static int counter = 0; + if (*name == '*') { + snprintf(num, sizeof(num), "%d", counter++); + name = num; + } + + if (s[0] == '[') /* attributes */ + { + *s = '\0'; + name = neos_strip(name); + s++; + err = parse_attr(&s, &attr); + if (err) + { + return nerr_pass_ctx(err, "In file %s:%d", path, *lineno); + } + SKIPWS(s); + } + if (splice) { + name = neos_strip(name); + HDF *h = hdf_get_obj(hdf->top, name); + if (h) { + HDF *c = hdf_obj_child(h); + while (c) { + err = hdf_copy (hdf, hdf_obj_name(c), c); + if (err != STATUS_OK) break; + c = hdf_obj_next(c); + } + } + if (err != STATUS_OK) + { + return nerr_pass_ctx(err, "In file %s:%d", path, *lineno); + } + } else if (s[0] == '=') /* assignment */ + { + *s = '\0'; + name = neos_strip(name); + s++; + value = neos_strip(s); + err = _set_value (hdf, name, value, 1, 1, 0, attr, NULL); + if (err != STATUS_OK) + { + return nerr_pass_ctx(err, "In file %s:%d", path, *lineno); + } + } + else if (s[0] == ':' && s[1] == '=') /* copy */ + { + *s = '\0'; + name = neos_strip(name); + s+=2; + value = neos_strip(s); + HDF *h = hdf_get_obj(hdf->top, value); + err = hdf_copy(hdf, name, h); + if (err != STATUS_OK) + { + return nerr_pass_ctx(err, "In file %s:%d", path, *lineno); + } + } + else if (s[0] == '!' && s[1] == '=') /* exec */ + { + *s = '\0'; + name = neos_strip(name); + s+=2; + value = neos_strip(s); + + FILE *f = popen(value, "r"); + if (f == NULL) + { + err = nerr_raise(NERR_PARSE, + "[%s:%d] Failed to exec specified command: %s", + path, *lineno, line->buf); + return err; + } + char *content = _read_file(f); + fclose(f); + int len = strlen(content); + if (len > 0 && content[len - 1] == '\n') { + content[len - 1] = '\0'; // remove \n artifact + } + err = _set_value (hdf, name, content, 1, 1, 0, attr, NULL); + free(content); + + if (err != STATUS_OK) + { + return nerr_pass_ctx(err, "In file %s:%d", path, *lineno); + } + } + else if (s[0] == ':') /* link */ + { + *s = '\0'; + name = neos_strip(name); + s++; + value = neos_strip(s); + err = _set_value (hdf, name, value, 1, 1, 1, attr, NULL); + if (err != STATUS_OK) + { + return nerr_pass_ctx(err, "In file %s:%d", path, *lineno); + } + } + else if (s[0] == '{') /* deeper */ + { + *s = '\0'; + name = neos_strip(name); + lower = hdf_get_obj (hdf, name); + if (lower == NULL) + { + err = _set_value (hdf, name, NULL, 1, 1, 0, attr, &lower); + } + else + { + err = _set_value (lower, NULL, lower->value, 1, 1, 0, attr, NULL); + } + if (err != STATUS_OK) + { + return nerr_pass_ctx(err, "In file %s:%d", path, *lineno); + } + err = _hdf_read_string (lower, str, line, path, lineno, include_handle, + 1); + if (err != STATUS_OK) + { + return nerr_pass_ctx(err, "In file %s:%d", path, *lineno); + } + } + else if (s[0] == '<' && s[1] == '<') /* multi-line assignment */ + { + char *m; + int msize = 0; + int mmax = 128; + int l; + + *s = '\0'; + name = neos_strip(name); + s+=2; + value = neos_strip(s); + l = strlen(value); + if (l == 0) + { + err = nerr_raise(NERR_PARSE, + "[%s:%d] No multi-assignment terminator given: %s", path, *lineno, + line->buf); + return err; + } + m = (char *) malloc (mmax * sizeof(char)); + if (m == NULL) + { + return nerr_raise(NERR_NOMEM, + "[%s:%d] Unable to allocate memory for multi-line assignment to %s", + path, *lineno, name); + } + while (_copy_line (str, m+msize, mmax-msize) != 0) + { + (*lineno)++; + if (!strncmp(value, m+msize, l) && isspace(m[msize+l])) + { + m[msize] = '\0'; + break; + } + msize += strlen(m+msize); + if (msize + l + 10 > mmax) + { + mmax += 128; + m = (char *) realloc (m, mmax * sizeof(char)); + if (m == NULL) + { + return nerr_raise(NERR_NOMEM, + "[%s:%d] Unable to allocate memory for multi-line assignment to %s: size=%d", + path, *lineno, name, mmax); + } + } + } + err = _set_value (hdf, name, m, 0, 1, 0, attr, NULL); + if (err != STATUS_OK) + { + free (m); + return nerr_pass_ctx(err, "In file %s:%d", path, *lineno); + } + + } + else + { + err = nerr_raise(NERR_PARSE, "[%s:%d] Unable to parse line %s", path, + *lineno, line->buf); + return err; + } + } + } + if (expect_end_brace) { + err = nerr_raise(NERR_PARSE, "[%s:%d] Missing matching }", path, *lineno); + return err; + } + return STATUS_OK; +} + +NEOERR * hdf_read_string (HDF *hdf, const char *str) +{ + NEOERR *err; + int lineno = 0; + STRING line; + string_init(&line); + err = _hdf_read_string(hdf, &str, &line, "", &lineno, INCLUDE_ERROR, + 0); + string_clear(&line); + return nerr_pass(err); +} + +NEOERR * hdf_read_string_ignore (HDF *hdf, const char *str, int ignore) +{ + NEOERR *err; + int lineno = 0; + STRING line; + string_init(&line); + err = _hdf_read_string(hdf, &str, &line, "", &lineno, + (ignore ? INCLUDE_IGNORE : INCLUDE_ERROR), 0); + string_clear(&line); + return nerr_pass(err); +} + +/* The search path is part of the HDF by convention */ +NEOERR* hdf_search_path (HDF *hdf, const char *path, char *full) +{ + HDF *paths; + struct stat s; + + for (paths = hdf_get_child (hdf, "hdf.loadpaths"); + paths; + paths = hdf_obj_next (paths)) + { + snprintf (full, _POSIX_PATH_MAX, "%s/%s", hdf_obj_value(paths), path); + errno = 0; + if (stat (full, &s) == -1) + { + if (errno != ENOENT) + return nerr_raise_errno (NERR_SYSTEM, "Stat of %s failed", full); + } + else + { + return STATUS_OK; + } + } + + strncpy (full, path, _POSIX_PATH_MAX); + if (stat (full, &s) == -1) + { + if (errno != ENOENT) + return nerr_raise_errno (NERR_SYSTEM, "Stat of %s failed", full); + } + else return STATUS_OK; + + return nerr_raise (NERR_NOT_FOUND, "Path %s not found", path); +} + +NEOERR* hdf_read_file (HDF *hdf, const char *path) +{ + NEOERR *err; + int lineno = 0; + char fpath[_POSIX_PATH_MAX]; + char *ibuf = NULL; + const char *ptr = NULL; + HDF *top = hdf->top; + STRING line; + + string_init(&line); + + if (path == NULL) + return nerr_raise(NERR_ASSERT, "Can't read NULL file"); + + if (top->fileload) + { + err = top->fileload(top->fileload_ctx, hdf, path, &ibuf); + } + else + { + if (path[0] != '/') + { + err = hdf_search_path (hdf, path, fpath); + if (err != STATUS_OK) return nerr_pass(err); + path = fpath; + } + + err = ne_load_file (path, &ibuf); + } + if (err) return nerr_pass(err); + + ptr = ibuf; + err = _hdf_read_string(hdf, &ptr, &line, path, &lineno, INCLUDE_FILE, 0); + free(ibuf); + string_clear(&line); + return nerr_pass(err); +} + +void hdf_register_fileload(HDF *hdf, void *ctx, HDFFILELOAD fileload) +{ + if (hdf == NULL) return; + if (hdf->top != NULL) hdf = hdf->top; + hdf->fileload_ctx = ctx; + hdf->fileload = fileload; +} + diff --git a/src/util/neo/neo_hdf.h b/src/util/neo/neo_hdf.h new file mode 100644 index 0000000000000..95e13f8f997b0 --- /dev/null +++ b/src/util/neo/neo_hdf.h @@ -0,0 +1,587 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#ifndef __NEO_HDF_H_ +#define __NEO_HDF_H_ 1 + +__BEGIN_DECLS + +#include +#include "neo_err.h" +#include "neo_hash.h" + +#define FORCE_HASH_AT 10 + +typedef struct _hdf HDF; + +/* HDFFILELOAD is a callback function to intercept file load requests and + * provide templates via another mechanism. This way you can load templates + * that you compiled-into your binary, from in-memory caches, or from a + * zip file, etc. The HDF is provided so you can choose to use the + * hdf_search_path function to find the file. contents should return + * a full malloc copy of the contents of the file, which the parser will + * own and free. Use hdf_register_fileload to set this function for + * your top level HDF node. + * NOTE: Technically, we shouldn't need a separate copy for each parse, but + * using the separate copy makes this equivalent to the CSFILELOAD function. We + * can change this if we really want to save that copy at the expense of + * slightly more complicated code. */ +typedef NEOERR* (*HDFFILELOAD)(void *ctx, HDF *hdf, const char *filename, + char **contents); + +typedef struct _attr +{ + char *key; + char *value; + struct _attr *next; +} HDF_ATTR; + +struct _hdf +{ + int link; + int alloc_value; + char *name; + int name_len; + char *value; + struct _attr *attr; + struct _hdf *top; + struct _hdf *next; + struct _hdf *child; + + /* the following fields are used to implement a cache */ + struct _hdf *last_hp; + struct _hdf *last_hs; + + /* the following HASH is used when we reach more than FORCE_HASH_AT + * elements */ + NE_HASH *hash; + /* When using the HASH, we need to know where to append new children */ + struct _hdf *last_child; + + /* Should only be set on the head node, used to override the default file + * load method */ + void *fileload_ctx; + HDFFILELOAD fileload; +}; + +/* + * Function: hdf_init - Initialize an HDF data set + * Description: hdf_init initializes an HDF data set and returns the + * pointer to the top node in the data set. + * Input: hdf - pointer to an HDF pointer + * Output: hdf - allocated hdf node + * Returns: NERR_NOMEM - unable to allocate memory for dataset + */ +NEOERR* hdf_init (HDF **hdf); + +/* + * Function: hdf_destroy - deallocate an HDF data set + * Description: hdf_destroy is used to deallocate all memory associated + * with an hdf data set. Although you can pass an HDF node + * as an argument to this function, you are likely to cause + * a segfault if you continue to access the data set. In + * the future, we may restrict hdf_destroy so it only works + * on the top level node. + * Input: hdf - pointer to an HDF data set allocated with hdf_init + * Output: None + * Returns: None + */ +void hdf_destroy (HDF **hdf); + +/* + * Function: hdf_get_int_value - Return the integer value of a point in + * the data set + * Description: hdf_get_int_value walks the HDF data set pointed to by + * hdf to name, and returns the value of that node + * converted to an integer. If that node does not exist, + * or it does not contain a number, the defval is returned. + * Input: hdf -> a node in an HDF data set + * name -> the name of a node to walk to in the data set + * defval -> value to return in case of error or if the node + * doesn't exist + * Output: None + * Returns: The integer value of the node, or the defval + */ +int hdf_get_int_value (HDF *hdf, const char *name, int defval); + +/* + * Function: hdf_get_value - Return the value of a node in the data set + * Description: hdf_get_value walks the data set pointed to by hdf via + * name and returns the string value located there, or + * defval if the node doesn't exist + * Input: hdf -> the dataset node to start from + * name -> the name to walk the data set to + * defval -> the default value to return if the node doesn't + * exist + * Output: None + * Returns: A pointer to the string stored in the data set, or defval. + * The data set maintains ownership of the string, if you want + * a copy you either have to call strdup yourself, or use + * hdf_get_copy + */ +char *hdf_get_value (HDF *hdf, const char *name, const char *defval); + +/* + * Function: hdf_get_valuevf - Return the value of a node in the data set + * Description: hdf_get_valuevf walks the data set pointed to by hdf via + * namefmt printf expanded with varargs ap, and returns the + * string value located there, or NULL if it doesn't exist. + * This differs from hdf_get_value in that there is no + * default value possible. + * Input: hdf -> the dataset node to start from + * namefmt -> the format string + * ap -> va_list of varargs + * Output: None + * Returns: A pointer to the string stored in the data set, or NULL. + * The data set maintains ownership of the string, if you want + * a copy you either have to call strdup yourself. + */ +char* hdf_get_valuevf (HDF *hdf, const char *namefmt, va_list ap); + +/* + * Function: hdf_get_valuef - Return the value of a node in the data set + * Description: hdf_get_valuef walks the data set pointed to by hdf via + * namefmt printf expanded with varargs, and returns the + * string value located there, or NULL if it doesn't exist. + * This differs from hdf_get_value in that there is no + * default value possible. + * Input: hdf -> the dataset node to start from + * namefmt -> the printf-style format string + * ... -> arguments to fill out namefmt + * Output: None + * Returns: A pointer to the string stored in the data set, or NULL. + * The data set maintains ownership of the string, if you want + * a copy you either have to call strdup yourself. + */ +char* hdf_get_valuef (HDF *hdf, const char *namefmt, ...) + ATTRIBUTE_PRINTF(2,3); + +/* + * Function: hdf_get_copy - Returns a copy of a string in the HDF data set + * Description: hdf_get_copy is similar to hdf_get_value, except that it + * returns an malloc'd copy of the string. + * Input: hdf -> the dataset node to start from + * name -> the name to walk the data set to + * defval -> the default value to return if the node doesn't + * exist + * Output: value -> the allocated string (if defval = NULL, then value + * will be NULL if defval is used) + * Returns: NERR_NOMEM if unable to allocate the new copy + */ +NEOERR* hdf_get_copy (HDF *hdf, const char *name, char **value, + const char *defval); + +/* + * Function: hdf_get_obj - return the HDF data set node at a named location + * Description: hdf_get_obj walks the dataset given by hdf to the node + * named name, and then returns the pointer to that node + * Input: hdf -> the dataset node to start from + * name -> the name to walk to + * Output: None + * Returns: the pointer to the named node, or NULL if it doesn't exist + */ +HDF* hdf_get_obj (HDF *hdf, const char *name); + +/* + * Function: hdf_get_node - Similar to hdf_get_obj except all the nodes + * are created if the don't exist. + * Description: hdf_get_node is similar to hdf_get_obj, except instead + * of stopping if it can't find a node in the tree, it will + * create all of the nodes necessary to hand you back the + * node you ask for. Nodes are created with no value. + * Input: hdf -> the dataset node to start from + * name -> the name to walk to + * Output: ret -> the dataset node you asked for + * Returns: NERR_NOMEM - unable to allocate new nodes + */ +NEOERR * hdf_get_node (HDF *hdf, const char *name, HDF **ret); + +/* + * Function: hdf_get_child - return the first child of the named node + * Description: hdf_get_child will walk the dataset starting at hdf to + * name, and return the first child of that node + * Input: hdf -> the dataset node to start from + * name -> the name to walk to + * Output: None + * Returns: The first child of the named dataset node or NULL if the + * node is not found (or it has no children) + */ +HDF* hdf_get_child (HDF *hdf, const char *name); + +/* + * Function: hdf_get_attr - + * Description: + * Input: + * Output: + * Returns: + */ +HDF_ATTR* hdf_get_attr (HDF *hdf, const char *name); + +/* + * Function: hdf_set_attr - + * Description: + * Input: + * Output: + * Returns: + */ +NEOERR* hdf_set_attr (HDF *hdf, const char *name, const char *key, + const char *value); + +/* + * Function: hdf_obj_child - Return the first child of a dataset node + * Description: hdf_obj_child and the other hdf_obj_ functions are + * accessors to the HDF dataset. Although we do not + * currently "hide" the HDF struct implementation, we + * recommend you use the accessor functions instead of + * accessing the values directly. + * Input: hdf -> the hdf dataset node + * Output: None + * Returns: The pointer to the first child, or NULL if there is none + */ +HDF* hdf_obj_child (HDF *hdf); + +/* + * Function: hdf_obj_next - Return the next node of a dataset level + * Description: hdf_obj_next is an accessor function for the HDF struct + * Input: hdf -> the hdf dataset node + * Output: None + * Returns: The pointer to the next node, or NULL if there is none + */ +HDF* hdf_obj_next (HDF *hdf); + +/* + * Function: hdf_obj_top - Return the pointer to the top dataset node + * Description: hdf_obj_top is an accessor function which returns a + * pointer to the top of the dataset, the node which was + * returned by hdf_init. This is most useful for + * implementations of language wrappers where individual + * nodes are tied garbage colletion wise to the top node of + * the data set + * Input: hdf -> the hdf dataset node + * Output: None + * Returns: The pointer to the top node + */ +HDF* hdf_obj_top (HDF *hdf); + +/* + * Function: hdf_obj_attr - Return the HDF Attributes for a node + * Description: + * Input: + * Output: + * Returns: + */ +HDF_ATTR* hdf_obj_attr (HDF *hdf); + +/* + * Function: hdf_obj_name - Return the name of a node + * Description: hdf_obj_name is an accessor function for a datset node + * which returns the name of the node. This is just the + * local name, and not the full path. + * Input: hdf -> the hdf dataset node + * Output: None + * Returns: The name of the node. If this is the top node, the name is + * NULL. + */ +char* hdf_obj_name (HDF *hdf); + +/* + * Function: hdf_obj_value - Return the value of a node + * Description: hdf_obj_value is an accessor function for a dataset node + * which returns the value of the node, or NULL if the node + * has no value. This is not a copy of the value, so the + * node retains ownership of the value + * Input: hdf -> the hdf dataset node + * Output: None + * Returns: The value of the node, or NULL if it has no value + */ +char* hdf_obj_value (HDF *hdf); + +/* + * Function: hdf_set_value - Set the value of a named node + * Description: hdf_set_value will set the value of a named node. All + * of the interstitial nodes which don't exist will be + * created with a value of NULL. Existing nodes are not + * modified. New nodes are created at the end of the list. + * If a list of nodes exceeds FORCE_HASH_AT, then a HASH + * will be created at that level and all of the nodes will + * be added to the hash for faster lookup times. + * The copy of the value will be made which the dataset + * will own. + * Input: hdf -> the pointer to the hdf dataset + * name -> the named node to walk to + * value -> the value to set the node to + * Output: None + * Returns: NERR_NOMEM + */ +NEOERR* hdf_set_value (HDF *hdf, const char *name, const char *value); + +/* + * Function: hdf_set_valuef - Set the value of a named node + * Description: hdf_set_valuef is a convenience function that wraps + * hdf_set_value. Due to limitations of C, the fmt is in + * the format "name=value", where we will first format the + * entire string, and then break it at the first (from the + * left) equal sign (=) and use the left portion as the + * name and the right portion as the value. This function + * is somewhat inefficient in that it first allocates the + * full name=value, and then the call to hdf_set_value + * duplicates the value portion, and then we free the + * name=value. + * Currently, we don't strip whitespace from the key or + * value. In the future, this function might work more + * like reading a single line of an HDF string or file, + * allowing for attributes and symlinks to be specified... + * maybe. + * Input: hdf -> the pointer to the hdf dataset + * fmt -> the name=value printf(3) format string + * Output: None + * Returns: NERR_NOMEM + */ +NEOERR* hdf_set_valuef (HDF *hdf, const char *fmt, ...) + ATTRIBUTE_PRINTF(2,3); +NEOERR* hdf_set_valuevf (HDF *hdf, const char *fmt, va_list ap); + +/* + * Function: hdf_set_int_value - Set the value of a named node to a number + * Description: hdf_set_int_value is a helper function that maps an + * integer to a string, and then calls hdf_set_value with + * that string + * Input: hdf -> the pointer to the hdf dataset + * name -> the named node to walk to + * value -> the value to set the node to + * Output: None + * Returns: NERR_NOMEM + */ +NEOERR* hdf_set_int_value (HDF *hdf, const char *name, int value); + +/* + * Function: hdf_set_copy -> Copy a value from one location in the + * dataset to another + * Description: hdf_set_copy first walks the hdf dataset to the named src + * node, and then copies that value to the named dest node. + * If the src node is not found, an error is raised. + * Input: hdf -> the pointer to the dataset node + * dest -> the name of the destination node + * src -> the name of the source node + * Output: None + * Returns: NERR_NOMEM, NERR_NOT_FOUND + */ +NEOERR* hdf_set_copy (HDF *hdf, const char *dest, const char *src); + +/* + * Function: hdf_set_buf - Set the value of a node without duplicating + * the value + * Description: hdf_set_buf is similar to hdf_set_value, except the + * dataset takes ownership of the value instead of making a + * copy of it. The dataset assumes that value was + * malloc'd, since it will attempt to free it when + * hdf_destroy is called + * Input: hdf -> the hdf dataset node + * name -> the name to walk to + * value -> the malloc'd value + * Output: None + * Returns: NERR_NOMEM - unable to allocate a node + */ + +NEOERR* hdf_set_buf (HDF *hdf, const char *name, char *value); + +/* + * Function: hdf_set_symlink - Set part of the tree to link to another + * Description: hdf_set_symlink creates a link between two sections of + * an HDF dataset. The link is "by name" hence the term + * "symlink". This means that the destination node does + * not need to exist. Any attempt to access the source + * node will cause the function to walk to the dest node, + * and then continue walking from there. Using symlinks + * can "hide" values in the dataset since you won't be able + * to access any children of the linked node directly, + * though dumps and other things which access the data + * structure directly will bypass the symlink. Use this + * feature sparingly as its likely to surprise you. + * Input: hdf -> the dataset node + * src -> the source node name + * dest -> the destination node name (from the top of the + * dataset, not relative names) + * Output: None + * Returns: NERR_NOMEM + */ +NEOERR *hdf_set_symlink (HDF *hdf, const char *src, const char *dest); + +/* + * Function: hdf_sort_obj - sort the children of an HDF node + * Description: hdf_sort_obj will sort the children of an HDF node, + * based on the given comparison function. + * This function works by creating an array of the pointers + * for each child object of h, using qsort to sort that + * array, and then re-ordering the linked list of children + * to the new order. The qsort compare function uses a + * pointer to the value in the array, which in our case is + * a pointer to an HDF struct, so your comparison function + * should work on HDF ** pointers. + * Input: h - HDF node + * compareFunc - function which returns 1,0,-1 depending on some + * criteria. The arguments to this sort function + * are pointers to pointers to HDF elements. For + * example: + * int sortByName(const void *a, const void *b) { + * HDF **ha = (HDF **)a; + * HDF **hb = (HDF **)b; + * + * return strcasecmp(hdf_obj_name(*ha), hdf_obj_name(*hb)); + * } + * + * Output: None (h children will be sorted) + * Return: NERR_NOMEM + */ +NEOERR *hdf_sort_obj(HDF *h, int (*compareFunc)(const void *, const void *)); + +/* + * Function: hdf_read_file - read an HDF data file + * Description: + * Input: + * Output: + * Returns: NERR_IO, NERR_NOMEM, NERR_PARSE + */ +NEOERR* hdf_read_file (HDF *hdf, const char *path); + +/* + * Function: hdf_write_file - write an HDF data file + * Description: + * Input: + * Output: + * Returns: NERR_IO + */ +NEOERR* hdf_write_file (HDF *hdf, const char *path); + +/* + * Function: hdf_write_file_atomic - write an HDF data file atomically + * Description: hdf_write_file_atomic is similar to hdf_write_file, + * except the new file is created with a unique name and + * then rename(2) is used to atomically replace the old + * file with the new file + * Input: + * Output: + * Returns: NERR_IO + */ +NEOERR* hdf_write_file_atomic (HDF *hdf, const char *path); + +/* + * Function: hdf_read_string - read an HDF string + * Description: + * Input: + * Output: + * Returns: NERR_NOMEM, NERR_PARSE + */ +NEOERR* hdf_read_string (HDF *hdf, const char *s); + +/* + * Function: hdf_read_string_ignore - Read an HDF string and ignore errors + * Description: + * Input: + * Output: + * Returns: NERR_NOMEM + */ +NEOERR* hdf_read_string_ignore (HDF *hdf, const char *s, int ignore); + +/* + * Function: hdf_write_string - serialize an HDF dataset to a string + * Description: + * Input: + * Output: + * Returns: NERR_NOMEM + */ +NEOERR* hdf_write_string (HDF *hdf, char **s); + +/* + * Function: hdf_dump - dump an HDF dataset to stdout + * Description: + * Input: + * Output: + * Returns: + */ +NEOERR* hdf_dump (HDF *hdf, const char *prefix); + +/* + * Function: hdf_dump_format - dump an HDF dataset to FILE *fp + * Description: + * Input: + * Output: + * Returns: + */ +NEOERR* hdf_dump_format (HDF *hdf, int lvl, FILE *fp); + +/* + * Function: hdf_dump_str - dump an HDF dataset to STRING + * Description: + * Input: + * Output: + * Returns: + */ +NEOERR* hdf_dump_str(HDF *hdf, const char *prefix, int compact, STRING *str); + +/* + * Function: hdf_remove_tree - delete a subtree of an HDF dataset + * Description: + * Input: + * Output: + * Returns: + */ +NEOERR* hdf_remove_tree (HDF *hdf, const char *name); + +/* + * Function: hdf_copy - copy part of an HDF dataset to another + * Description: hdf_copy is a deep copy of an HDF tree pointed to by + * src to the named node of dest. dest and src need not be + * part of the same data set + * Input: dest_hdf -> the destination dataset + * name -> the name of the destination node + * src -> the hdf dataset to copy to the destination + * Output: None + * Returns: NERR_NOMEM, NERR_NOT_FOUND + */ +NEOERR* hdf_copy (HDF *dest_hdf, const char *name, HDF *src); + +/* + * Function: hdf_search_path - Find a file given a search path in HDF + * Description: hdf_search_path is a convenience/utility function that + * searches for relative filenames in a search path. The + * search path is the list given by the children of + * hdf.loadpaths. + * Input: hdf -> the hdf dataset to use + * path -> the relative path + * full -> a pointer to a _POSIX_PATH_MAX buffer + * Output: full -> the full path of the file + * Returns: NERR_NOT_FOUND if the file wasn't found in the search path + */ +NEOERR* hdf_search_path (HDF *hdf, const char *path, char *full); + +/* + * Function: hdf_register_fileload - register a fileload function + * Description: hdf_register_fileload registers a fileload function that + * overrides the built-in function. The built-in function + * uses hdf_search_path and ne_file_load (based on stat/open/read) + * to find and load the file on every hdf_read_file (including + * #include). You can override this function if you wish to provide + * other file search functions, or load the hdf file + * from an in-memory cache, etc. + * Input: hdf - pointer to a head HDF node + * ctx - pointer that is passed to the HDFFILELOAD function when called + * fileload - a HDFFILELOAD function + * Output: None + * Return: None + * + */ + +void hdf_register_fileload(HDF *hdf, void *ctx, HDFFILELOAD fileload); + +__END_DECLS + +#endif /* __NEO_HDF_H_ */ diff --git a/src/util/neo/neo_misc.c b/src/util/neo/neo_misc.c new file mode 100644 index 0000000000000..f1e8d618b481f --- /dev/null +++ b/src/util/neo/neo_misc.c @@ -0,0 +1,228 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#include "cs_config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "neo_misc.h" +#include "neo_err.h" + +void ne_vwarn (const char *fmt, va_list ap) +{ + char tbuf[20]; + char buf[1024]; + struct tm my_tm; + time_t now; + int len; + + now = time(NULL); + + localtime_r(&now, &my_tm); + + strftime(tbuf, sizeof(tbuf), "%m/%d %T", &my_tm); + + vsnprintf (buf, sizeof(buf), fmt, ap); + len = strlen(buf); + while (len && isspace (buf[len-1])) buf[--len] = '\0'; + fprintf (stderr, "[%s] %s\n", tbuf, buf); +} + +void ne_warn (const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + ne_vwarn (fmt, ap); + va_end (ap); +} + +static int LogLevel = 0; + +void ne_set_log (int level) +{ + LogLevel = level; +} + +void ne_log (int level, const char *fmt, ...) +{ + va_list ap; + + if (LogLevel >= level) + { + va_start (ap, fmt); + ne_vwarn (fmt, ap); + va_end (ap); + } +} + +UINT32 python_string_hash (const char *s) +{ + int len=0; + register UINT32 x; + + x = *s << 7; + while(*s != 0) { + x = (1000003*x) ^ *s; + s++; + len++; + } + x ^= len; + if(x == -1) x = -2; + return x; +} + +UINT8 *ne_stream4 (UINT8 *dest, UINT32 num) +{ + dest[0] = num & 0xFF; + dest[1] = (num >> 8) & 0xFF; + dest[2] = (num >> 16) & 0xFF; + dest[3] = (num >> 24) & 0xFF; + + return dest + 4; +} + +UINT8 *ne_stream2 (UINT8 *dest, UINT16 num) +{ + dest[0] = num & 0xFF; + dest[1] = (num >> 8) & 0xFF; + + return dest + 2; +} + +UINT8 *ne_unstream4 (UINT32 *pnum, UINT8 *src) +{ + *pnum = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24); + + return src + 4; +} + +UINT8 *ne_unstream2 (UINT16 *pnum, UINT8 *src) +{ + *pnum = src[0] | (src[1] << 8); + + return src + 2; +} + +/* This handles strings of less than 256 bytes */ +UINT8 *ne_unstream_str (char *s, int l, UINT8 *src) +{ + UINT8 sl; + + sl = src[0]; + if (sl > l) + sl = l; + memcpy (s, src+1, sl); + s[l-1] = '\0'; + return src+sl+1; +} + +UINT8 *ne_stream_str (UINT8 *dest, const char *s, int l) +{ + if (l > 255) + { + ne_warn("WARNING: calling ne_stream_str with l>255"); + l = 255; + } + dest[0] = l; + memcpy (dest+1, s, l); + return dest+l+1; +} + +#ifndef HAVE_GETTIMEOFDAY + +/* Ok, if we don't have gettimeofday, they only get second resolution */ +double ne_timef (void) { + return time(NULL); +} + +#else + +double ne_timef (void) +{ + double f = 0; + struct timeval tv; + int ret; + + ret = gettimeofday(&tv, NULL); + if (ret == 0) + { + f = tv.tv_sec + (tv.tv_usec / 1000000.0); + } + return f; +} +#endif + +static const UINT32 CRCTable[256] = { +0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, +0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, +0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, +0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, +0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, +0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, +0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, +0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, +0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, +0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, +0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, +0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, +0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, +0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, +0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, +0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, +0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, +0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, +0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, +0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, +0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, +0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, +0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, +0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, +0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, +0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, +0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, +0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, +0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, +0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, +0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, +0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, +0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, +0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, +0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, +0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, +0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, +0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, +0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, +0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, +0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, +0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, +0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +}; + +UINT32 ne_crc (UINT8 *data, UINT32 bytes) +{ + UINT32 crc, i; + + crc = (UINT32)-1; + + for(i = 0; i < bytes; i++, data++) + crc = ((crc >> 8) & 0xFFFFFF) ^ CRCTable[((crc ^ *data) & 0xFF)]; + + crc = ~crc; + + return crc; +} + diff --git a/src/util/neo/neo_misc.h b/src/util/neo/neo_misc.h new file mode 100644 index 0000000000000..16c18378e4aae --- /dev/null +++ b/src/util/neo/neo_misc.h @@ -0,0 +1,134 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#ifndef __NEO_MISC_H_ +#define __NEO_MISC_H_ 1 + +#include +#include +#include + +/* In case they didn't start from ClearSilver.h. */ +#ifndef __CS_CONFIG_H_ +#include "cs_config.h" +#endif + +/* Fix Up for systems that don't define these standard things */ +#ifndef __BEGIN_DECLS +#ifdef __cplusplus +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif +#endif + +#ifndef _POSIX_PATH_MAX +#define _POSIX_PATH_MAX 255 +#endif + +#ifndef S_IXGRP +#define S_IXGRP S_IXUSR +#endif +#ifndef S_IWGRP +#define S_IWGRP S_IWUSR +#endif +#ifndef S_IRGRP +#define S_IRGRP S_IRUSR +#endif +#ifndef S_IXOTH +#define S_IXOTH S_IXUSR +#endif +#ifndef S_IWOTH +#define S_IWOTH S_IWUSR +#endif +#ifndef S_IROTH +#define S_IROTH S_IRUSR +#endif + +/* Format string checking for compilers that support it (GCC style) */ + +#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ > 6 +#define ATTRIBUTE_PRINTF(a1,a2) __attribute__((__format__ (__printf__, a1, a2))) +#else +#define ATTRIBUTE_PRINTF(a1,a2) +#endif + + +__BEGIN_DECLS + +#ifndef HAVE_STRTOK_R +char * strtok_r (char *s,const char * delim, char **save_ptr); +#endif + +#ifndef HAVE_LOCALTIME_R +struct tm *localtime_r (const time_t *timep, struct tm *ttm); +#endif + +#ifndef HAVE_GMTIME_R +struct tm *gmtime_r(const time_t *timep, struct tm *ttm); +#endif + +#ifndef HAVE_MKSTEMP +int mkstemp(char *path); +#endif + +#ifndef HAVE_SNPRINTF +int snprintf (char *str, size_t count, const char *fmt, ...) + ATTRIBUTE_PRINTF(3,4); +#endif + +#ifndef HAVE_VSNPRINTF +int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); +#endif + +#include +#include + +typedef unsigned int UINT32; +typedef int INT32; +typedef unsigned short int UINT16; +typedef short int INT16; +typedef unsigned char UINT8; +typedef char INT8; +typedef char BOOL; + +#ifndef MIN +#define MIN(x,y) (((x) < (y)) ? (x) : (y)) +#endif + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +void ne_vwarn (const char *fmt, va_list ap); +void ne_warn (const char *fmt, ...) + ATTRIBUTE_PRINTF(1,2); +void ne_set_log (int level); +void ne_log (int level, const char *fmt, ...) + ATTRIBUTE_PRINTF(2,3); +UINT32 python_string_hash (const char *s); +UINT8 *ne_stream4 (UINT8 *dest, UINT32 num); +UINT8 *ne_unstream4 (UINT32 *pnum, UINT8 *src); +UINT8 *ne_stream2 (UINT8 *dest, UINT16 num); +UINT8 *ne_unstream2 (UINT16 *pnum, UINT8 *src); +UINT8 *ne_stream_str (UINT8 *dest, const char *s, int l); +UINT8 *ne_unstream_str (char *s, int l, UINT8 *src); +double ne_timef (void); +UINT32 ne_crc (UINT8 *data, UINT32 bytes); + +__END_DECLS + +#endif /* __NEO_MISC_H_ */ diff --git a/src/util/neo/neo_rand.c b/src/util/neo/neo_rand.c new file mode 100644 index 0000000000000..1cd6b286a145c --- /dev/null +++ b/src/util/neo/neo_rand.c @@ -0,0 +1,114 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#include "cs_config.h" + +#include +#include +#include +#include +#include "neo_misc.h" +#include "neo_err.h" +#include "neo_rand.h" +#include "ulist.h" + +static int RandomInit = 0; + +void neo_seed_rand (long int seed) +{ +#ifdef HAVE_DRAND48 + srand48(seed); +#elif HAVE_RANDOM + srandom(seed); +#else + srand(seed); +#endif + RandomInit = 1; +} + +int neo_rand (int max) +{ + int r; + + if (RandomInit == 0) + { + neo_seed_rand (time(NULL)); + } +#ifdef HAVE_DRAND48 + r = drand48() * max; +#elif HAVE_RANDOM + r = random() * max; +#else + r = rand() * max; +#endif + return r; +} + +int neo_rand_string (char *s, int max) +{ + int size; + int x = 0; + + size = neo_rand(max-1); + for (x = 0; x < size; x++) + { + s[x] = (char)(32 + neo_rand(127-32)); + if (s[x] == '/') s[x] = ' '; + } + s[x] = '\0'; + + return 0; +} + +static ULIST *Words = NULL; + +int neo_rand_word (char *s, int max) +{ + NEOERR *err; + int x; + char *word; + + if (Words == NULL) + { + FILE *fp; + char buf[256]; + + err = uListInit(&Words, 40000, 0); + if (err) + { + nerr_log_error(err); + return -1; + } + fp = fopen ("/usr/dict/words", "r"); + if (fp == NULL) { + fp = fopen ("/usr/share/dict/words", "r"); + if (fp == NULL) { + ne_warn("Unable to find dict/words file (looked in /usr/dict/words and /usr/share/dict/words)"); + return -1; + } + } + while (fgets (buf, sizeof(buf), fp) != NULL) + { + x = strlen (buf); + if (buf[x-1] == '\n') + buf[x-1] = '\0'; + uListAppend(Words, strdup(buf)); + } + fclose (fp); + } + x = neo_rand (uListLength(Words)); + uListGet(Words, x, (void *)&word); + strncpy (s, word, max); + s[max-1] = '\0'; + + return 0; +} + diff --git a/src/util/neo/neo_rand.h b/src/util/neo/neo_rand.h new file mode 100644 index 0000000000000..2f962ed7c70df --- /dev/null +++ b/src/util/neo/neo_rand.h @@ -0,0 +1,24 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#ifndef __NEO_RAND_H_ +#define __NEO_RAND_H_ 1 + +__BEGIN_DECLS + +void neo_seed_rand (long int seed); +int neo_rand (int max); +int neo_rand_string (char *s, int slen); +int neo_rand_word (char *s, int slen); + +__END_DECLS + +#endif /* __NEO_RAND_H_ */ diff --git a/src/util/neo/neo_str.c b/src/util/neo/neo_str.c new file mode 100644 index 0000000000000..ea6a8971cf840 --- /dev/null +++ b/src/util/neo/neo_str.c @@ -0,0 +1,892 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#include "cs_config.h" + +#include +#include +#include +#include +#include +#include +#include +#include "neo_misc.h" +#include "neo_err.h" +#include "neo_str.h" +#include "ulist.h" + +#ifndef va_copy +#ifdef __va_copy +# define va_copy(dest,src) __va_copy(dest,src) +#else +# define va_copy(dest,src) ((dest) = (src)) +#endif +#endif + +char *neos_strip (char *s) +{ + int x; + + x = strlen(s) - 1; + while (x>=0 && isspace(s[x])) s[x--] = '\0'; + + while (*s && isspace(*s)) s++; + + return s; +} + +char *neos_rstrip (char *s) +{ + int n = strlen (s)-1; + + while (n >= 0 && isspace(s[n])) + { + s[n] = '\0'; + n--; + } + + return s; +} + +void neos_lower(char *s) +{ + while(*s != 0) { + *s = tolower(*s); + s++; + } +} + + +void string_init (STRING *str) +{ + str->buf = NULL; + str->len = 0; + str->max = 0; +} + +void string_clear (STRING *str) +{ + if (str->buf != NULL) + free(str->buf); + string_init(str); +} + +static NEOERR* string_check_length (STRING *str, int l) +{ + if (str->buf == NULL) + { + if (l * 10 > 256) + str->max = l * 10; + else + str->max = 256; + str->buf = (char *) malloc (sizeof(char) * str->max); + if (str->buf == NULL) + return nerr_raise (NERR_NOMEM, "Unable to allocate render buf of size %d", + str->max); + /* ne_warn("Creating string %x at %d (%5.2fK)", str, str->max, (str->max / 1024.0)); */ + } + else if (str->len + l >= str->max) + { + do + { + str->max *= 2; + } while (str->len + l >= str->max); + str->buf = (char *) realloc (str->buf, sizeof(char) * str->max); + if (str->buf == NULL) + return nerr_raise (NERR_NOMEM, "Unable to allocate STRING buf of size %d", + str->max); + /* ne_warn("Growing string %x to %d (%5.2fK)", str, str->max, (str->max / 1024.0)); */ + } + return STATUS_OK; +} + +NEOERR *string_set (STRING *str, const char *buf) +{ + str->len = 0; + return nerr_pass (string_append (str, buf)); +} + +NEOERR *string_append (STRING *str, const char *buf) +{ + NEOERR *err; + int l; + + l = strlen(buf); + err = string_check_length (str, l); + if (err != STATUS_OK) return nerr_pass (err); + strcpy(str->buf + str->len, buf); + str->len += l; + + return STATUS_OK; +} + +NEOERR *string_appendn (STRING *str, const char *buf, int l) +{ + NEOERR *err; + + err = string_check_length (str, l+1); + if (err != STATUS_OK) return nerr_pass (err); + memcpy(str->buf + str->len, buf, l); + str->len += l; + str->buf[str->len] = '\0'; + + return STATUS_OK; +} + +/* this is much more efficient with C99 snprintfs... */ +NEOERR *string_appendvf (STRING *str, const char *fmt, va_list ap) +{ + NEOERR *err; + char buf[4096]; + int bl, size; + va_list tmp; + + va_copy(tmp, ap); + /* determine length */ + size = sizeof (buf); + bl = vsnprintf (buf, size, fmt, tmp); + if (bl > -1 && bl < size) + return string_appendn (str, buf, bl); + + /* Handle non-C99 snprintfs (requires extra malloc/free and copy) */ + if (bl == -1) + { + char *a_buf; + + va_copy(tmp, ap); + a_buf = vnsprintf_alloc(size*2, fmt, tmp); + if (a_buf == NULL) + return nerr_raise(NERR_NOMEM, + "Unable to allocate memory for formatted string"); + err = string_append(str, a_buf); + free(a_buf); + return nerr_pass(err); + } + + err = string_check_length (str, bl+1); + if (err != STATUS_OK) return nerr_pass (err); + va_copy(tmp, ap); + vsprintf (str->buf + str->len, fmt, tmp); + str->len += bl; + str->buf[str->len] = '\0'; + + return STATUS_OK; +} + +NEOERR *string_appendf (STRING *str, const char *fmt, ...) +{ + NEOERR *err; + va_list ap; + + va_start (ap, fmt); + err = string_appendvf (str, fmt, ap); + va_end (ap); + return nerr_pass(err); +} + +NEOERR *string_append_char (STRING *str, char c) +{ + NEOERR *err; + err = string_check_length (str, 1); + if (err != STATUS_OK) return nerr_pass (err); + str->buf[str->len] = c; + str->buf[str->len + 1] = '\0'; + str->len += 1; + + return STATUS_OK; +} + +void string_array_init (STRING_ARRAY *arr) +{ + arr->entries = NULL; + arr->count = 0; + arr->max = 0; +} + +NEOERR *string_array_split (ULIST **list, char *s, const char *sep, + int max) +{ + NEOERR *err; + char *p, *n, *f; + int sl; + int x = 0; + + if (sep[0] == '\0') + return nerr_raise (NERR_ASSERT, "separator must be at least one character"); + + err = uListInit (list, 10, 0); + if (err) return nerr_pass(err); + + sl = strlen(sep); + p = (sl == 1) ? strchr (s, sep[0]) : strstr (s, sep); + f = s; + while (p != NULL) + { + if (x >= max) break; + *p = '\0'; + n = strdup(f); + *p = sep[0]; + if (n) err = uListAppend (*list, n); + else err = nerr_raise(NERR_NOMEM, + "Unable to allocate memory to split %s", s); + if (err) goto split_err; + f = p+sl; + p = (sl == 1) ? strchr (f, sep[0]) : strstr (f, sep); + x++; + } + /* Handle remainder */ + n = strdup(f); + if (n) err = uListAppend (*list, n); + else err = nerr_raise(NERR_NOMEM, + "Unable to allocate memory to split %s", s); + if (err) goto split_err; + return STATUS_OK; + +split_err: + uListDestroy(list, ULIST_FREE); + return err; +} + +void string_array_clear (STRING_ARRAY *arr) +{ + int x; + + for (x = 0; x < arr->count; x++) + { + if (arr->entries[x] != NULL) free (arr->entries[x]); + arr->entries[x] = NULL; + } + free (arr->entries); + arr->entries = NULL; + arr->count = 0; +} + +/* Mostly used by vprintf_alloc for non-C99 compliant snprintfs, + * this is like vsprintf_alloc except it takes a "suggested" size */ +int vnisprintf_alloc (char **buf, int start_size, const char *fmt, va_list ap) +{ + int bl, size; + va_list tmp; + + *buf = NULL; + size = start_size; + + *buf = (char *) malloc (size * sizeof(char)); + if (*buf == NULL) return 0; + while (1) + { + va_copy(tmp, ap); + bl = vsnprintf (*buf, size, fmt, tmp); + if (bl > -1 && bl < size) + return bl; + if (bl > -1) + size = bl + 1; + else + size *= 2; + *buf = (char *) realloc (*buf, size * sizeof(char)); + if (*buf == NULL) return 0; + } +} + +char *vnsprintf_alloc (int start_size, const char *fmt, va_list ap) +{ + char *r; + vnisprintf_alloc(&r, start_size, fmt, ap); + return r; +} + +/* This works better with a C99 compliant vsnprintf, but should work ok + * with versions that return a -1 if it overflows the buffer */ +int visprintf_alloc (char **buf, const char *fmt, va_list ap) +{ + char ibuf[4096]; + int bl, size; + va_list tmp; + +/* PPC doesn't like you re-using a va_list... and it might not be + * supposed to work at all */ + va_copy(tmp, ap); + + size = sizeof (ibuf); + bl = vsnprintf (ibuf, sizeof (ibuf), fmt, tmp); + if (bl > -1 && bl < size) + { + *buf = (char *) calloc(bl+1, sizeof(char)); + if (*buf == NULL) return 0; + strncpy(*buf, ibuf, bl); + return bl; + } + + if (bl > -1) + size = bl + 1; + else + size *= 2; + + return vnisprintf_alloc(buf, size, fmt, ap); +} + +char *vsprintf_alloc (const char *fmt, va_list ap) +{ + char *r; + visprintf_alloc(&r, fmt, ap); + return r; +} + +/* technically, sprintf's can have null values, so we need to be able to + * return a length also like real sprintf */ +int isprintf_alloc (char **buf, const char *fmt, ...) +{ + va_list ap; + int r; + + va_start (ap, fmt); + r = visprintf_alloc (buf, fmt, ap); + va_end (ap); + return r; +} + +char *sprintf_alloc (const char *fmt, ...) +{ + va_list ap; + char *r; + + va_start (ap, fmt); + r = vsprintf_alloc (fmt, ap); + va_end (ap); + return r; +} + +/* This is mostly just here for completeness, I doubt anyone would use + * this (its more efficient (time-wise) if start_size is bigger than the + * resulting string. Its less efficient than sprintf_alloc if we have a + * C99 snprintf and it doesn't fit in start_size. + * BTW: If you are really worried about the efficiency of these + * functions, maybe you shouldn't be using them in the first place... */ +char *nsprintf_alloc (int start_size, const char *fmt, ...) +{ + va_list ap; + char *r; + + va_start (ap, fmt); + r = vnsprintf_alloc (start_size, fmt, ap); + va_end (ap); + return r; +} + +BOOL reg_search (const char *re, const char *str) +{ + regex_t search_re; + int errcode; + char buf[256]; + + if ((errcode = regcomp(&search_re, re, REG_ICASE | REG_EXTENDED | REG_NOSUB))) + { + regerror (errcode, &search_re, buf, sizeof(buf)); + ne_warn ("Unable to compile regex %s: %s", re, buf); + return FALSE; + } + errcode = regexec (&search_re, str, 0, NULL, 0); + regfree (&search_re); + if (errcode == 0) + return TRUE; + return FALSE; +} + +NEOERR *string_readline (STRING *str, FILE *fp) +{ + NEOERR *err; + + /* minimum size for a readline is 256 above current position */ + err = string_check_length (str, str->len + 256); + if (err != STATUS_OK) return nerr_pass (err); + + while (fgets(str->buf + str->len, str->max - str->len, fp) != NULL) + { + str->len = strlen(str->buf); + if (str->buf[str->len-1] == '\n') break; + err = string_check_length (str, str->len + 256); + if (err != STATUS_OK) return nerr_pass (err); + } + return STATUS_OK; +} + +NEOERR* neos_escape(UINT8 *buf, int buflen, char esc_char, const char *escape, + char **esc) +{ + int nl = 0; + int l = 0; + int x = 0; + char *s; + int match = 0; + + while (l < buflen) + { + if (buf[l] == esc_char) + { + nl += 2; + } + else + { + x = 0; + while (escape[x]) + { + if (escape[x] == buf[l]) + { + nl +=2; + break; + } + x++; + } + } + nl++; + l++; + } + + s = (char *) malloc (sizeof(char) * (nl + 1)); + if (s == NULL) + return nerr_raise (NERR_NOMEM, "Unable to allocate memory to escape %s", + buf); + + nl = 0; l = 0; + while (l < buflen) + { + match = 0; + if (buf[l] == esc_char) + { + match = 1; + } + else + { + x = 0; + while (escape[x]) + { + if (escape[x] == buf[l]) + { + match = 1; + break; + } + x++; + } + } + if (match) + { + s[nl++] = esc_char; + s[nl++] = "0123456789ABCDEF"[buf[l] / 16]; + s[nl++] = "0123456789ABCDEF"[buf[l] % 16]; + l++; + } + else + { + s[nl++] = buf[l++]; + } + } + s[nl] = '\0'; + + *esc = s; + return STATUS_OK; +} + +UINT8 *neos_unescape (UINT8 *s, int buflen, char esc_char) +{ + int i = 0, o = 0; + + if (s == NULL) return s; + while (i < buflen) + { + if (s[i] == esc_char && (i+2 < buflen) && + isxdigit(s[i+1]) && isxdigit(s[i+2])) + { + UINT8 num; + num = (s[i+1] >= 'A') ? ((s[i+1] & 0xdf) - 'A') + 10 : (s[i+1] - '0'); + num *= 16; + num += (s[i+2] >= 'A') ? ((s[i+2] & 0xdf) - 'A') + 10 : (s[i+2] - '0'); + s[o++] = num; + i+=3; + } + else { + s[o++] = s[i++]; + } + } + if (i && o) s[o] = '\0'; + return s; +} + +char *repr_string_alloc (const char *s) +{ + int l,x,i; + int nl = 0; + char *rs; + + if (s == NULL) + { + return strdup("NULL"); + } + + l = strlen(s); + for (x = 0; x < l; x++) + { + if (isprint(s[x]) && s[x] != '"' && s[x] != '\\') + { + nl++; + } + else + { + if (s[x] == '\n' || s[x] == '\t' || s[x] == '\r' || s[x] == '"' || + s[x] == '\\') + { + nl += 2; + } + else nl += 4; + } + } + + rs = (char *) malloc ((nl+3) * sizeof(char)); + if (rs == NULL) + return NULL; + + i = 0; + rs[i++] = '"'; + for (x = 0; x < l; x++) + { + if (isprint(s[x]) && s[x] != '"' && s[x] != '\\') + { + rs[i++] = s[x]; + } + else + { + rs[i++] = '\\'; + switch (s[x]) + { + case '\n': + rs[i++] = 'n'; + break; + case '\t': + rs[i++] = 't'; + break; + case '\r': + rs[i++] = 'r'; + break; + case '"': + rs[i++] = '"'; + break; + case '\\': + rs[i++] = '\\'; + break; + default: + sprintf(&(rs[i]), "%03o", (s[x] & 0377)); + i += 3; + break; + } + } + } + rs[i++] = '"'; + rs[i] = '\0'; + return rs; +} + +// List of all characters that must be escaped +// List based on http://www.blooberry.com/indexdot/html/topics/urlencoding.htm +static char EscapedChars[] = "$&+,/:;=?@ \"<>#%{}|\\^~[]`'"; + +// Check if a single character needs to be escaped +static BOOL is_reserved_char(char c) +{ + int i = 0; + + if (c < 32 || c > 122) { + return TRUE; + } else { + while (EscapedChars[i]) { + if (c == EscapedChars[i]) { + return TRUE; + } + ++i; + } + } + return FALSE; +} + +NEOERR *neos_js_escape (const char *in, char **esc) +{ + int nl = 0; + int l = 0; + unsigned char *buf = (unsigned char *)in; + unsigned char *s; + + while (buf[l]) + { + if (buf[l] == '/' || buf[l] == '"' || buf[l] == '\'' || + buf[l] == '\\' || buf[l] == '>' || buf[l] == '<' || + buf[l] == '&' || buf[l] == ';' || buf[l] < 32) + { + nl += 3; + } + nl++; + l++; + } + + s = (unsigned char *) malloc (sizeof(unsigned char) * (nl + 1)); + if (s == NULL) + return nerr_raise (NERR_NOMEM, "Unable to allocate memory to escape %s", + buf); + + nl = 0; l = 0; + while (buf[l]) + { + if (buf[l] == '/' || buf[l] == '"' || buf[l] == '\'' || + buf[l] == '\\' || buf[l] == '>' || buf[l] == '<' || + buf[l] == '&' || buf[l] == ';' || buf[l] < 32) + { + s[nl++] = '\\'; + s[nl++] = 'x'; + s[nl++] = "0123456789ABCDEF"[(buf[l] >> 4) & 0xF]; + s[nl++] = "0123456789ABCDEF"[buf[l] & 0xF]; + l++; + } + else + { + s[nl++] = buf[l++]; + } + } + s[nl] = '\0'; + + *esc = (char *)s; + return STATUS_OK; +} + + +NEOERR *neos_url_escape (const char *in, char **esc, + const char *other) +{ + int nl = 0; + int l = 0; + int x = 0; + unsigned char *buf = (unsigned char *)in; + unsigned char *uother = (unsigned char *)other; + unsigned char *s; + int match = 0; + + while (buf[l]) + { + if (is_reserved_char(buf[l])) + { + nl += 2; + } + else if (uother) + { + x = 0; + while (uother[x]) + { + if (uother[x] == buf[l]) + { + nl +=2; + break; + } + x++; + } + } + nl++; + l++; + } + + s = (unsigned char *) malloc (sizeof(unsigned char) * (nl + 1)); + if (s == NULL) + return nerr_raise (NERR_NOMEM, "Unable to allocate memory to escape %s", + buf); + + nl = 0; l = 0; + while (buf[l]) + { + match = 0; + if (buf[l] == ' ') + { + s[nl++] = '+'; + l++; + } + else + { + if (is_reserved_char(buf[l])) + { + match = 1; + } + else if (uother) + { + x = 0; + while (uother[x]) + { + if (uother[x] == buf[l]) + { + match = 1; + break; + } + x++; + } + } + if (match) + { + s[nl++] = '%'; + s[nl++] = "0123456789ABCDEF"[buf[l] / 16]; + s[nl++] = "0123456789ABCDEF"[buf[l] % 16]; + l++; + } + else + { + s[nl++] = buf[l++]; + } + } + } + s[nl] = '\0'; + + *esc = (char *)s; + return STATUS_OK; +} + +NEOERR *neos_html_escape (const char *src, int slen, + char **out) +{ + NEOERR *err = STATUS_OK; + STRING out_s; + int x; + char *ptr; + + string_init(&out_s); + err = string_append (&out_s, ""); + if (err) return nerr_pass (err); + *out = NULL; + + x = 0; + while (x < slen) + { + ptr = strpbrk(src + x, "&<>\"'\r"); + if (ptr == NULL || (ptr-src >= slen)) + { + err = string_appendn (&out_s, src + x, slen-x); + x = slen; + } + else + { + err = string_appendn (&out_s, src + x, (ptr - src) - x); + if (err != STATUS_OK) break; + x = ptr - src; + if (src[x] == '&') + err = string_append (&out_s, "&"); + else if (src[x] == '<') + err = string_append (&out_s, "<"); + else if (src[x] == '>') + err = string_append (&out_s, ">"); + else if (src[x] == '"') + err = string_append (&out_s, """); + else if (src[x] == '\'') + err = string_append (&out_s, "'"); + else if (src[x] != '\r') + err = nerr_raise (NERR_ASSERT, "src[x] == '%c'", src[x]); + x++; + } + if (err != STATUS_OK) break; + } + if (err) + { + string_clear (&out_s); + return nerr_pass (err); + } + *out = out_s.buf; + return STATUS_OK; +} + +char *URL_PROTOCOLS[] = {"http://", "https://", "ftp://", "mailto:"}; + +NEOERR *neos_url_validate (const char *in, char **esc) +{ + NEOERR *err = STATUS_OK; + STRING out_s; + int valid = 0; + size_t i; + size_t inlen; + int num_protocols = sizeof(URL_PROTOCOLS) / sizeof(char*); + void* slashpos; + void* colonpos; + + inlen = strlen(in); + + /* + * or are allowed by browsers + * and ":" is treated as part of the path, while + * is an invalid url + * and ":" is treated as a scheme separator. + * + * Hence allow for ":" in the path part of a url (after /) + */ + slashpos = memchr(in, '/', inlen); + if (slashpos == NULL) { + i = inlen; + } + else { + i = (size_t)((char*)slashpos - in); + } + + colonpos = memchr(in, ':', i); + + if (colonpos == NULL) { + // no scheme in 'in': so this is a relative url + valid = 1; + } + else { + for (i = 0; i < num_protocols; i++) + { + if ((inlen >= strlen(URL_PROTOCOLS[i])) && + strncmp(in, URL_PROTOCOLS[i], strlen(URL_PROTOCOLS[i])) == 0) { + // 'in' starts with one of the allowed protocols + valid = 1; + break; + } + + } + } + + if (valid) + return neos_html_escape(in, inlen, esc); + + // 'in' contains an unsupported scheme, replace with '#' + string_init(&out_s); + err = string_append (&out_s, "#"); + if (err) return nerr_pass (err); + + *esc = out_s.buf; + return STATUS_OK; + +} + +NEOERR *neos_var_escape (NEOS_ESCAPE context, + const char *in, + char **esc) +{ + + /* Just dup and return if we do nothing. */ + if (context == NEOS_ESCAPE_NONE || + context == NEOS_ESCAPE_FUNCTION) + { + *esc = strdup(in); + return STATUS_OK; + } + + /* Now we escape based on context. This is the order of precedence: + * url > script > style > html + */ + if (context & NEOS_ESCAPE_URL) + return nerr_pass(neos_url_escape(in, esc, NULL)); + else if (context & NEOS_ESCAPE_SCRIPT) + return nerr_pass(neos_js_escape(in, esc)); + else if (context & NEOS_ESCAPE_HTML) + return nerr_pass(neos_html_escape(in, strlen(in), esc)); + + return nerr_raise(NERR_ASSERT, "unknown escape context supplied: %d", + context); +} diff --git a/src/util/neo/neo_str.h b/src/util/neo/neo_str.h new file mode 100644 index 0000000000000..829f88e0bb6a3 --- /dev/null +++ b/src/util/neo/neo_str.h @@ -0,0 +1,114 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#ifndef __NEO_STR_H_ +#define __NEO_STR_H_ 1 + +__BEGIN_DECLS + +#include +#include +#include "neo_misc.h" + +/* This modifies the string its called with by replacing all the white + * space on the end with \0, and returns a pointer to the first + * non-white space character in the string + */ +char *neos_strip (char *s); + +void neos_lower (char *s); + +char *sprintf_alloc (const char *fmt, ...) ATTRIBUTE_PRINTF(1,2); +char *nsprintf_alloc (int start_size, const char *fmt, ...) ATTRIBUTE_PRINTF(2,3); +char *vsprintf_alloc (const char *fmt, va_list ap); +char *vnsprintf_alloc (int start_size, const char *fmt, va_list ap); + +/* Versions of the above which actually return a length, necessary if + * you expect embedded NULLs */ +int vnisprintf_alloc (char **buf, int start_size, const char *fmt, va_list ap); +int visprintf_alloc (char **buf, const char *fmt, va_list ap); +int isprintf_alloc (char **buf, const char *fmt, ...) ATTRIBUTE_PRINTF(2,3); + +typedef struct _string +{ + char *buf; + int len; + int max; +} STRING; + +typedef struct _string_array +{ + char **entries; + int count; + int max; +} STRING_ARRAY; + +/* At some point, we should add the concept of "max len" to these so we + * can't get DoS'd by someone sending us a line without an end point, + * etc. */ +void string_init (STRING *str); +NEOERR *string_set (STRING *str, const char *buf); +NEOERR *string_append (STRING *str, const char *buf); +NEOERR *string_appendn (STRING *str, const char *buf, int l); +NEOERR *string_append_char (STRING *str, char c); +NEOERR *string_appendf (STRING *str, const char *fmt, ...) ATTRIBUTE_PRINTF(2,3); +NEOERR *string_appendvf (STRING *str, const char *fmt, va_list ap); +NEOERR *string_readline (STRING *str, FILE *fp); +void string_clear (STRING *str); + +/* typedef struct _ulist ULIST; */ +#include "ulist.h" +/* s is not const because we actually temporarily modify the string + * during split */ +NEOERR *string_array_split (ULIST **list, char *s, const char *sep, + int max); + +BOOL reg_search (const char *re, const char *str); + +/* NEOS_ESCAPE details the support escape contexts/modes handled + * by various NEOS helper methods and reused in CS itself. */ +typedef enum +{ + NEOS_ESCAPE_UNDEF = 0, /* Used to force eval-time checking */ + NEOS_ESCAPE_NONE = 1<<0, + NEOS_ESCAPE_HTML = 1<<1, + NEOS_ESCAPE_SCRIPT = 1<<2, + NEOS_ESCAPE_URL = 1<<3, + NEOS_ESCAPE_FUNCTION = 1<<4 /* Special case used to override the others */ +} NEOS_ESCAPE; + +NEOERR* neos_escape(UINT8 *buf, int buflen, char esc_char, const char *escape, + char **esc); +UINT8 *neos_unescape (UINT8 *s, int buflen, char esc_char); + +char *repr_string_alloc (const char *s); + +/* This is the "super" escape call which will call the proper helper + * variable escape function based on the passed in context. */ +NEOERR *neos_var_escape (NEOS_ESCAPE context, + const char *in, + char **esc); + +/* Generic data escaping helper functions used by neos_contextual_escape + * and cs built-ins. */ +NEOERR *neos_url_escape (const char *in, char **esc, + const char *other); + +NEOERR *neos_js_escape (const char *in, char **esc); + +NEOERR *neos_html_escape (const char *src, int slen, + char **out); + +NEOERR *neos_url_validate (const char *in, char **esc); + +__END_DECLS + +#endif /* __NEO_STR_H_ */ diff --git a/src/util/neo/ulist.c b/src/util/neo/ulist.c new file mode 100644 index 0000000000000..4604f9ce10961 --- /dev/null +++ b/src/util/neo/ulist.c @@ -0,0 +1,286 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#include "cs_config.h" + +#include +#include +#include + +#include "neo_misc.h" +#include "neo_err.h" +#include "ulist.h" + +#define ULIST_DEFAULT_SIZE 10 + +static NEOERR *check_resize (ULIST *ul, int size) +{ + if (size > ul->max) + { + void **new_items; + int new_size = 0; + + new_size = ul->max*2; + if (size > new_size) + { + new_size = size + ul->max; + } + + new_items = (void **) realloc ((void *)(ul->items), new_size * sizeof(void *)); + if (new_items == NULL) + { + return nerr_raise(NERR_NOMEM, + "Unable to resize ULIST to %d: Out of memory", new_size); + } + ul->items = new_items; + ul->max = new_size; + } + + return STATUS_OK; +} + + +NEOERR *uListInit(ULIST **ul, int size, int flags) +{ + ULIST *r_ul; + + *ul = NULL; + if (size == 0) + { + size = ULIST_DEFAULT_SIZE; + } + + r_ul = (ULIST *) calloc (1, sizeof (ULIST)); + if (r_ul == NULL) + { + return nerr_raise(NERR_NOMEM, "Unable to create ULIST: Out of memory"); + } + r_ul->items = (void **) calloc (size, sizeof(void *)); + if (r_ul->items == NULL) + { + free (r_ul); + return nerr_raise(NERR_NOMEM, "Unable to create ULIST: Out of memory"); + } + + r_ul->num = 0; + r_ul->max = size; + r_ul->flags = flags; + *ul = r_ul; + + return STATUS_OK; +} + +NEOERR *uListvInit(ULIST **ul, ...) +{ + NEOERR *err; + va_list ap; + void *it; + + err = uListInit (ul, 0, 0); + if (err) return nerr_pass (err); + + va_start (ap, ul); + + it = va_arg (ap, void *); + + while (it) + { + err = uListAppend (*ul, it); + if (err) + { + uListDestroy(ul, 0); + return nerr_pass (err); + } + it = va_arg (ap, void *); + } + return STATUS_OK; +} + +NEOERR *uListAppend (ULIST *ul, void *data) +{ + NEOERR *r; + + r = check_resize (ul, ul->num + 1); + if (r != STATUS_OK) + return r; + + ul->items[ul->num] = data; + ul->num++; + + return STATUS_OK; +} + +NEOERR *uListPop (ULIST *ul, void **data) +{ + if (ul->num == 0) + return nerr_raise(NERR_OUTOFRANGE, "uListPop: empty list"); + + *data = ul->items[ul->num - 1]; + ul->num--; + + return STATUS_OK; +} + +NEOERR *uListInsert (ULIST *ul, int x, void *data) +{ + void **start; + NEOERR *r; + + if (x < 0) + x = ul->num + x; + + if (x >= ul->num) + return nerr_raise(NERR_OUTOFRANGE, "uListInsert: past end (%d > %d)", + x, ul->num); + + r = check_resize (ul, ul->num + 1); + if (r != STATUS_OK) + return r; + + start = &(ul->items[x]); + memmove (start + 1, start, (ul->num - x) * sizeof(void *)); + ul->items[x] = data; + ++ul->num; + + return STATUS_OK; +} + +NEOERR *uListDelete (ULIST *ul, int x, void **data) +{ + void **start; + + if (x < 0) + x = ul->num + x; + + if (x >= ul->num) + return nerr_raise(NERR_OUTOFRANGE, "uListDelete: past end (%d > %d)", + x, ul->num); + + if (data != NULL) + *data = ul->items[x]; + + start = &(ul->items[x]); + memmove (start, start+1, (ul->num - x - 1) * sizeof(void *)); + --ul->num; + + return STATUS_OK; +} + +NEOERR *uListGet (ULIST *ul, int x, void **data) +{ + if (x < 0) + x = ul->num + x; + + if (x >= ul->num) + return nerr_raise(NERR_OUTOFRANGE, "uListGet: past end (%d > %d)", + x, ul->num); + + if (x < 0) + return nerr_raise(NERR_OUTOFRANGE, "uListGet: past beginning (%d < 0)", x); + + *data = ul->items[x]; + + return STATUS_OK; +} + +NEOERR *uListSet (ULIST *ul, int x, void *data) +{ + if (x >= ul->num) + return nerr_raise(NERR_OUTOFRANGE, "uListSet: past end (%d > %d)", + x, ul->num); + + ul->items[x] = data; + + return STATUS_OK; +} + +NEOERR *uListReverse (ULIST *ul) +{ + int i; + + for (i = 0; i < ul->num/2; ++i) { + void *tmp = ul->items[i]; + ul->items[i] = ul->items[ul->num-1-i]; + ul->items[ul->num-1-i] = tmp; + } + + return STATUS_OK; +} + +NEOERR *uListSort (ULIST *ul, int (*compareFunc)(const void *, const void*)) { + qsort(ul->items, ul->num, sizeof(void *), compareFunc); + return STATUS_OK; +} + +void *uListSearch (ULIST *ul, const void *key, int + (*compareFunc)(const void *, const void*)) { + return bsearch(key, ul->items, ul->num, sizeof(void *), compareFunc); +} + +void *uListIn (ULIST *ul, const void *key, int (*compareFunc)(const void *, const void*)) { + int i; + + for (i = 0; i < ul->num; ++i) { + if (!compareFunc(key, &ul->items[i])) { + return &ul->items[i]; + } + } + return NULL; +} + +int uListIndex (ULIST *ul, const void *key, int (*compareFunc)(const void *, const void*)) { + void **p = uListIn(ul, key, compareFunc); + return p ? (p - ul->items) : -1; +} + + + +NEOERR *uListDestroy (ULIST **ul, int flags) +{ + if (flags & ULIST_FREE) + { + return uListDestroyFunc(ul, free); + } + else + { + return uListDestroyFunc(ul, NULL); + } +} + +NEOERR *uListDestroyFunc (ULIST **ul, void (*destroyFunc)(void *)) +{ + ULIST *r_ul; + + r_ul = *ul; + + if (r_ul == NULL) + return STATUS_OK; + + if (destroyFunc != NULL) + { + int x; + for (x = 0; x < r_ul->num; x++) + { + (*destroyFunc)(r_ul->items[x]); + } + } + free (r_ul->items); + free (r_ul); + *ul = NULL; + + return STATUS_OK; +} + +int uListLength (ULIST *ul) +{ + if (ul == NULL) return 0; + return ul->num; +} diff --git a/src/util/neo/ulist.h b/src/util/neo/ulist.h new file mode 100644 index 0000000000000..ea51f9ab6f53d --- /dev/null +++ b/src/util/neo/ulist.h @@ -0,0 +1,45 @@ +/* + * Neotonic ClearSilver Templating System + * + * This code is made available under the terms of the + * Neotonic ClearSilver License. + * http://www.neotonic.com/clearsilver/license.hdf + * + * Copyright (C) 2001 by Brandon Long + */ + +#ifndef __ULIST_H_ +#define __ULIST_H_ 1 + +#include "neo_err.h" + +typedef struct _ulist +{ + int flags; + void **items; + int num; + int max; +} ULIST; + +#define ULIST_INTEGER (1<<0) +#define ULIST_FREE (1<<1) +#define ULIST_COPY (1<<2) + +NEOERR * uListInit(ULIST **ul, int size, int flags); +NEOERR * uListvInit(ULIST **ul, ...); +int uListLength (ULIST *ul); +NEOERR * uListAppend (ULIST *ul, void *data); +NEOERR * uListPop (ULIST *ul, void **data); +NEOERR * uListInsert (ULIST *ul, int x, void *data); +NEOERR * uListDelete (ULIST *ul, int x, void **data); +NEOERR * uListGet (ULIST *ul, int x, void **data); +NEOERR * uListSet (ULIST *ul, int x, void *data); +NEOERR * uListReverse (ULIST *ul); +NEOERR * uListSort (ULIST *ul, int (*compareFunc)(const void*, const void*)); +void *uListSearch (ULIST *ul, const void *key, int (*compareFunc)(const void *, const void*)); +void *uListIn (ULIST *ul, const void *key, int (*compareFunc)(const void *, const void*)); +int uListIndex (ULIST *ul, const void *key, int (*compareFunc)(const void *, const void*)); +NEOERR * uListDestroy (ULIST **ul, int flags); +NEOERR * uListDestroyFunc (ULIST **ul, void (*destroyFunc)(void *)); + +#endif /* __ULIST_H_ */ diff --git a/src/util/neo/ulocks.c b/src/util/neo/ulocks.c new file mode 100644 index 0000000000000..9f15ccf15f85a --- /dev/null +++ b/src/util/neo/ulocks.c @@ -0,0 +1,204 @@ +/* + * Copyright 2001-2004 Brandon Long + * All Rights Reserved. + * + * ClearSilver Templating System + * + * This code is made available under the terms of the ClearSilver License. + * http://www.clearsilver.net/license.hdf + * + */ + +#include "cs_config.h" + +#include +#include +#include +#include +#include +#include + +#include "neo_misc.h" +#include "neo_err.h" +#include "neo_files.h" +#include "ulocks.h" + +NEOERR *fCreate(int *plock, const char *file) +{ + NEOERR *err; + int lock; + char *p; + + *plock = -1; + + /* note the default mode of 666 is possibly a security hole in that + * someone else can grab your lock and DoS you. For internal use, who + * cares? + */ + if((lock = open(file, O_WRONLY|O_NDELAY|O_APPEND|O_CREAT|O_EXCL, 0666)) < 0) + { + if (errno == ENOENT) + { + p = strrchr (file, '/'); + if (p != NULL) + { + *p = '\0'; + err = ne_mkdirs(file, 0777); + *p = '/'; + if (err != STATUS_OK) return nerr_pass(err); + lock = open(file, O_WRONLY|O_NDELAY|O_APPEND|O_CREAT, 0666); + } + } + if (errno == EEXIST) + return nerr_pass(fFind(plock, file)); + + if (lock < 0) + return nerr_raise_errno (NERR_IO, "Unable to open lock file %s", file); + } + + *plock = lock; + + return STATUS_OK; +} + +void fDestroy(int lock) +{ + + if(lock < 0) + return; + + close(lock); + + return; +} + +NEOERR *fFind(int *plock, const char *file) +{ + int lock; + + *plock = -1; + + if((lock = open(file, O_WRONLY|O_NDELAY|O_APPEND, 0666)) < 0) { + if (errno == ENOENT) + return nerr_raise (NERR_NOT_FOUND, "Unable to find lock file %s", file); + return nerr_raise_errno (NERR_IO, "Unable to open lock file %s", file); + } + + *plock = lock; + + return STATUS_OK; +} + +NEOERR *fLock(int lock) +{ + + if(lockf(lock, F_LOCK, 0) < 0) + return nerr_raise_errno (NERR_LOCK, "File lock failed"); + + return STATUS_OK; +} + +void fUnlock(int lock) +{ + + if(lock < 0) + return; + + lockf(lock, F_ULOCK, 0); + + return; +} + +#ifdef HAVE_PTHREADS + +NEOERR *mCreate(pthread_mutex_t *mutex) +{ + int err; + + if((err = pthread_mutex_init(mutex, NULL))) { + return nerr_raise (NERR_LOCK, "Unable to initialize mutex: %s", + strerror(err)); + } + + return STATUS_OK; +} + +void mDestroy(pthread_mutex_t *mutex) +{ + + pthread_mutex_destroy(mutex); + + return; +} + +NEOERR *mLock(pthread_mutex_t *mutex) +{ + int err; + + if((err = pthread_mutex_lock(mutex))) + return nerr_raise(NERR_LOCK, "Mutex lock failed: %s", strerror(err)); + + return STATUS_OK; +} + +NEOERR *mUnlock(pthread_mutex_t *mutex) +{ + int err; + + if((err = pthread_mutex_unlock(mutex))) + return nerr_raise(NERR_LOCK, "Mutex unlock failed: %s", strerror(err)); + + return STATUS_OK; +} + +NEOERR *cCreate(pthread_cond_t *cond) +{ + int err; + + if((err = pthread_cond_init(cond, NULL))) { + return nerr_raise(NERR_LOCK, "Unable to initialize condition variable: %s", + strerror(err)); + } + + return STATUS_OK; +} + +void cDestroy(pthread_cond_t *cond) +{ + pthread_cond_destroy(cond); + + return; +} + +NEOERR *cWait(pthread_cond_t *cond, pthread_mutex_t *mutex) +{ + int err; + + if((err = pthread_cond_wait(cond, mutex))) + return nerr_raise(NERR_LOCK, "Condition wait failed: %s", strerror(err)); + + return STATUS_OK; +} + +NEOERR *cBroadcast(pthread_cond_t *cond) +{ + int err; + + if((err = pthread_cond_broadcast(cond))) + return nerr_raise(NERR_LOCK, "Condition broadcast failed: %s", + strerror(err)); + + return STATUS_OK; +} + +NEOERR *cSignal(pthread_cond_t *cond) +{ + int err; + + if((err = pthread_cond_signal(cond))) + return nerr_raise (NERR_LOCK, "Condition signal failed: %s", strerror(err)); + + return STATUS_OK; +} + +#endif diff --git a/src/util/neo/ulocks.h b/src/util/neo/ulocks.h new file mode 100644 index 0000000000000..8b3bfb119571d --- /dev/null +++ b/src/util/neo/ulocks.h @@ -0,0 +1,191 @@ +/* + * + * Thread-safe Skiplist Using Integer Identifiers + * Copyright 1998-2000 Scott Shambarger (scott@shambarger.net) + * + * This software is open source. Permission to use, copy, modify, and + * distribute this software for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies. No + * warranty of any kind is expressed or implied. Use at your own risk. + * + * 1/14/2001 blong + * Made it use neo errs... probably need to check locking functions + * for error returns... + * + */ + +#ifndef __ULOCKS_H_ +#define __ULOCKS_H_ + + +NEOERR *fCreate(int *plock, const char *file); +/* + * Function: fCreate - create a file lock. + * Description: Creates a file lock on named file . The lock is + * returned in . + * Input: plock - place for lock. + * file - path of file to use as lock. + * Output: plock - set to lock identifier. + * Return: STATUS_OK on success + * NERR_IO on failure + * MT-Level: Safe. + */ + +NEOERR *fFind(int *plock, const char *file); +/* + * Function: fFind - find a file lock. + * Description: Find a file identified by the path , and returns a + * lock identifier for it in . If the file doesn't + * exist, returns true. + * Input: plock - place for lock. + * file - path of file to use as lock. + * Output: plock - set to lock identifier. + * Return: STATUS_OK if found + * NERR_IO on failure + * MT-Level: Safe. + */ + +void fDestroy(int lock); +/* + * Function: fDestroy - destroy a lock. + * Description: Destroys the lock that was created by fCreate() + * or fFind(). + * Input: lock - Lock to destroy. + * Output: None. + * Return: None. + * MT-Level: Safe for unique . + */ + +NEOERR *fLock(int lock); +/* + * Function: fLock - acquire file lock. + * Description: Acquires the lock identified by . This call + * blocks until the lock is acquired. + * Input: lock - Lock to acquire. + * Output: None. + * Return: STATUS_OK on success + * NERR_LOCK on failure + * MT-Level: Safe. + */ + +void fUnlock(int lock); +/* + * Function: fUnlock - release file lock. + * Description: Releases the lock identified by . + * Input: lock - Lock to release. + * Output: None. + * Return: None. + * MT-Level: Safe. + */ + +#ifdef HAVE_PTHREADS + +#include + + +NEOERR *mCreate(pthread_mutex_t *mutex); +/* + * Function: mCreate - initialize a mutex. + * Description: Initializes the mutex . + * Input: mutex - mutex to initialize. + * Output: None. + * Return: STATUS_OK on success + * NERR_LOCK on failure + * MT-Level: Safe for unique . + */ + +void mDestroy(pthread_mutex_t *mutex); +/* + * Function: mDestroy - destroy a mutex. + * Description: Destroys the mutex that was initialized by mCreate(). + * Input: mutex - mutex to destroy. + * Output: None. + * Return: None. + * MT-Level: Safe for unique . + */ + +NEOERR *mLock(pthread_mutex_t *mutex); +/* + * Function: mLock - lock a mutex. + * Description: Locks the mutex . This call blocks until the mutex + * is acquired. + * Input: mutex - mutex to lock. + * Output: None. + * Return: STATUS_OK on success + * NERR_LOCK on failure + * MT-Level: Safe. + */ + +NEOERR *mUnlock(pthread_mutex_t *mutex); +/* + * Function: mUnlock - unlock a mutex. + * Description: Unlocks the mutex . + * Input: mutex - mutex to unlock. + * Output: None. + * Return: STATUS_OK on success + * NERR_LOCK on failure + * MT-Level: Safe. + */ + +NEOERR *cCreate(pthread_cond_t *cond); +/* + * Function: cCreate - initialize a condition variable. + * Description: Initializes the condition variable . + * Input: cond - condition variable to initialize. + * Output: None. + * Return: STATUS_OK on success + * NERR_LOCK on failure + * MT-Level: Safe for unique . + */ + +void cDestroy(pthread_cond_t *cond); +/* + * Function: cDestroy - destroy a condition variable. + * Description: Destroys the condition variable that was + * initialized by cCreate(). + * Input: cond - condition variable to destroy. + * Output: None. + * Return: None. + * MT-Level: Safe for unique . + */ + +NEOERR *cWait(pthread_cond_t *cond, pthread_mutex_t *mutex); +/* + * Function: cWait - wait a condition variable signal. + * Description: Waits for a signal on condition variable . + * The mutex must be locked by the thread. + * Input: cond - condition variable to wait on. + * mutex - locked mutex to protect . + * Output: None. + * Return: STATUS_OK on success + * NERR_LOCK on failure + * MT-Level: Safe. + */ + +NEOERR *cBroadcast(pthread_cond_t *cond); +/* + * Function: cBroadcast - broadcast signal to all waiting threads. + * Description: Broadcasts a signal to all threads waiting on condition + * variable . + * Input: cond - condition variable to broadcast on. + * Output: None. + * Return: STATUS_OK on success + * NERR_LOCK on failure + * MT-Level: Safe. + */ + +NEOERR *cSignal(pthread_cond_t *cond); +/* + * Function: cSignal - send signal to one waiting thread. + * Description: Sends a signal to one thread waiting on condition + * variable . + * Input: cond - condition variable to send signal on. + * Output: None. + * Return: STATUS_OK on success + * NERR_LOCK on failure + * MT-Level: Safe. + */ + +#endif /* HAVE_PTHREAD */ + +#endif /* __ULOCKS_H_ */ diff --git a/src/util/neo/wildmat.c b/src/util/neo/wildmat.c new file mode 100644 index 0000000000000..85e7b2f1d4433 --- /dev/null +++ b/src/util/neo/wildmat.c @@ -0,0 +1,207 @@ +/* $Revision: 1.2 $ + ** + ** Do shell-style pattern matching for ?, \, [], and * characters. + ** Might not be robust in face of malformed patterns; e.g., "foo[a-" + ** could cause a segmentation violation. It is 8bit clean. + ** + ** Written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986. + ** Rich $alz is now . + ** April, 1991: Replaced mutually-recursive calls with in-line code + ** for the star character. + ** + ** Special thanks to Lars Mathiesen for the ABORT code. + ** This can greatly speed up failing wildcard patterns. For example: + ** pattern: -*-*-*-*-*-*-12-*-*-*-m-*-*-* + ** text 1: -adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1 + ** text 2: -adobe-courier-bold-o-normal--12-120-75-75-X-70-iso8859-1 + ** Text 1 matches with 51 calls, while text 2 fails with 54 calls. Without + ** the ABORT code, it takes 22310 calls to fail. Ugh. The following + ** explanation is from Lars: + ** The precondition that must be fulfilled is that DoMatch will consume + ** at least one character in text. This is true if *p is neither '*' nor + ** '\0'.) The last return has ABORT instead of FALSE to avoid quadratic + ** behaviour in cases like pattern "*a*b*c*d" with text "abcxxxxx". With + ** FALSE, each star-loop has to run to the end of the text; with ABORT + ** only the last one does. + ** + ** Once the control of one instance of DoMatch enters the star-loop, that + ** instance will return either TRUE or ABORT, and any calling instance + ** will therefore return immediately after (without calling recursively + ** again). In effect, only one star-loop is ever active. It would be + ** possible to modify the code to maintain this context explicitly, + ** eliminating all recursive calls at the cost of some complication and + ** loss of clarity (and the ABORT stuff seems to be unclear enough by + ** itself). I think it would be unwise to try to get this into a + ** released version unless you have a good test data base to try it + ** out on. + */ + +#include "cs_config.h" + +#include +#include "neo_misc.h" + +#define ABORT -1 + + + /* What character marks an inverted character class? */ +#define NEGATE_CLASS '^' + /* Is "*" a common pattern? */ +#define OPTIMIZE_JUST_STAR + /* Do tar(1) matching rules, which ignore a trailing slash? */ +#undef MATCH_TAR_PATTERN + + +/* + ** Match text and p, return TRUE, FALSE, or ABORT. + */ + static int +DoMatch(register const char *text, register const char *p) +{ + register int last; + register int matched; + register int reverse; + + for ( ; *p; text++, p++) { + if (*text == '\0' && *p != '*') + return ABORT; + switch (*p) { + case '\\': + /* Literal match with following character. */ + p++; + /* FALLTHROUGH */ + default: + if (*text != *p) + return FALSE; + continue; + case '?': + /* Match anything. */ + continue; + case '*': + while (*++p == '*') + /* Consecutive stars act just like one. */ + continue; + if (*p == '\0') + /* Trailing star matches everything. */ + return TRUE; + while (*text) + if ((matched = DoMatch(text++, p)) != FALSE) + return matched; + return ABORT; + case '[': + reverse = p[1] == NEGATE_CLASS ? TRUE : FALSE; + if (reverse) + /* Inverted character class. */ + p++; + matched = FALSE; + if (p[1] == ']' || p[1] == '-') + if (*++p == *text) + matched = TRUE; + for (last = *p; *++p && *p != ']'; last = *p) + /* This next line requires a good C compiler. */ + if (*p == '-' && p[1] != ']' + ? *text <= *++p && *text >= last : *text == *p) + matched = TRUE; + if (matched == reverse) + return FALSE; + continue; + } + } + +#ifdef MATCH_TAR_PATTERN + if (*text == '/') + return TRUE; +#endif /* MATCH_TAR_ATTERN */ + return *text == '\0'; +} + + +/* + ** Match text and p, return TRUE, FALSE, or ABORT. + */ +static int +DoMatchCaseInsensitive(register const char *text, register const char *p) +{ + register int last; + register int matched; + register int reverse; + + for ( ; *p; text++, p++) { + if (*text == '\0' && *p != '*') + return ABORT; + switch (*p) { + case '\\': + /* Literal match with following character. */ + p++; + /* FALLTHROUGH */ + default: + if (toupper(*text) != toupper(*p)) + return FALSE; + continue; + case '?': + /* Match anything. */ + continue; + case '*': + while (*++p == '*') + /* Consecutive stars act just like one. */ + continue; + if (*p == '\0') + /* Trailing star matches everything. */ + return TRUE; + while (*text) + if ((matched = DoMatchCaseInsensitive(text++, p)) != FALSE) + return matched; + return ABORT; + case '[': + reverse = p[1] == NEGATE_CLASS ? TRUE : FALSE; + if (reverse) + /* Inverted character class. */ + p++; + matched = FALSE; + if (p[1] == ']' || p[1] == '-') + if (toupper(*++p) == toupper(*text)) + matched = TRUE; + for (last = toupper(*p); *++p && *p != ']'; last = toupper(*p)) + /* This next line requires a good C compiler. */ + if (*p == '-' && p[1] != ']' + ? toupper(*text) <= toupper(*++p) && toupper(*text) >= last : toupper(*text) == toupper(*p)) + matched = TRUE; + if (matched == reverse) + return FALSE; + continue; + } + } + +#ifdef MATCH_TAR_PATTERN + if (*text == '/') + return TRUE; +#endif /* MATCH_TAR_ATTERN */ + return *text == '\0'; +} + + +/* + ** User-level routine. Returns TRUE or FALSE. + */ +int +wildmat(const char *text, const char *p) +{ +#ifdef OPTIMIZE_JUST_STAR + if (p[0] == '*' && p[1] == '\0') + return TRUE; +#endif /* OPTIMIZE_JUST_STAR */ + return DoMatch(text, p) == TRUE; +} + +/* + ** User-level routine. Returns TRUE or FALSE. + */ +int +wildmatcase(const char *text, const char *p) +{ +#ifdef OPTIMIZE_JUST_STAR + if (p[0] == '*' && p[1] == '\0') + return TRUE; +#endif /* OPTIMIZE_JUST_STAR */ + return DoMatchCaseInsensitive(text, p) == TRUE; +} diff --git a/src/util/neo/wildmat.h b/src/util/neo/wildmat.h new file mode 100644 index 0000000000000..7cd316dc177ca --- /dev/null +++ b/src/util/neo/wildmat.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 1986-1991 Rich Salz + * + */ + +#ifndef __WILDMAT_H_ +#define __WILDMAT_H_ 1 + +__BEGIN_DECLS + +int wildmat(const char *text, const char *p); +int wildmatcase(const char *text, const char *p); + +__END_DECLS + +#endif /* __WILDMAT_H_ */ diff --git a/src/util/network.cpp b/src/util/network.cpp new file mode 100644 index 0000000000000..bd67fdaeec579 --- /dev/null +++ b/src/util/network.cpp @@ -0,0 +1,105 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "network.h" +#include "lock.h" +#include "process.h" +#include "util.h" + +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// without calling res_init(), any call to getaddrinfo() may leak memory: +// http://sources.redhat.com/ml/libc-hacker/2004-02/msg00049.html + +class ResolverLibInitializer { +public: + ResolverLibInitializer() { + res_init(); + } +}; +static ResolverLibInitializer _resolver_lib_initializer; +/////////////////////////////////////////////////////////////////////////////// +// thread-safe network functions + +std::string Util::safe_inet_ntoa(struct in_addr &in) { + char buf[256]; + memset(buf, 0, sizeof(buf)); + inet_ntop(AF_INET, &in, buf, sizeof(buf)-1); + return buf; +} + +bool Util::safe_gethostbyname(const char *address, HostEnt &result) { + struct hostent *hp; + int res; + + size_t hstbuflen = 1024; + result.tmphstbuf = (char*)malloc(hstbuflen); + while ((res = gethostbyname_r(address, &result.hostbuf, result.tmphstbuf, + hstbuflen, &hp, &result.herr)) == ERANGE) { + hstbuflen *= 2; + result.tmphstbuf = (char*)realloc(result.tmphstbuf, hstbuflen); + } + return !res && hp; +} + +/////////////////////////////////////////////////////////////////////////////// + +std::string Util::GetPrimaryIP() { + struct utsname buf; + uname((struct utsname *)&buf); + + HostEnt result; + if (!safe_gethostbyname(buf.nodename, result)) { + return buf.nodename; + } + + struct in_addr in; + memcpy(&in.s_addr, *(result.hostbuf.h_addr_list), sizeof(in.s_addr)); + return safe_inet_ntoa(in); +} + +bool Util::GetNetworkStats(const char *iface, int &in_bps, int &out_bps) { + ASSERT(iface && *iface); + + const char *argv[] = {"", "1", "1", "-n", "DEV", NULL}; + string out; + Process::Exec("sar", argv, NULL, out); + + vector lines; + Util::split('\n', out.c_str(), lines, true); + for (unsigned int i = 0; i < lines.size(); i++) { + string &line = lines[i]; + if (line.find(iface) != string::npos) { + vector fields; + Util::split(' ', line.c_str(), fields, true); + if (fields[1] == iface) { + in_bps = atoll(fields[4].c_str()); + out_bps = atoll(fields[5].c_str()); + return true; + } + } + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/network.h b/src/util/network.h new file mode 100644 index 0000000000000..6102cb09ce851 --- /dev/null +++ b/src/util/network.h @@ -0,0 +1,60 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __NETWORK_H__ +#define __NETWORK_H__ + +#include "base.h" +#include +#include +#include +#include + +/** + * Network utility functions. + */ +namespace HPHP { namespace Util { +/////////////////////////////////////////////////////////////////////////////// +// thread-safe network functions + +class HostEnt { +public: + HostEnt() : tmphstbuf(NULL) {} + ~HostEnt() { if (tmphstbuf) free(tmphstbuf);} + + struct hostent hostbuf; + char *tmphstbuf; + int herr; +}; + +bool safe_gethostbyname(const char *address, HostEnt &result); +std::string safe_inet_ntoa(struct in_addr &in); + +/////////////////////////////////////////////////////////////////////////////// +/** + * Get local machine's primary IP address. + */ +std::string GetPrimaryIP(); + +/** + * Get network bytes per second. + */ +bool GetNetworkStats(const char *iface, int &in_bps, int &out_bps); + +/////////////////////////////////////////////////////////////////////////////// +}} + +#endif // __NETWORK_H__ diff --git a/src/util/pool.h b/src/util/pool.h new file mode 100644 index 0000000000000..d057f6c98c897 --- /dev/null +++ b/src/util/pool.h @@ -0,0 +1,55 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_POOL_H__ +#define __HPHP_POOL_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Simple class for object pooling between different threads. + */ +template +class Pool : public Synchronizable { +public: + void push(boost::shared_ptr obj) { + Lock lock(this); + m_objs.push_back(obj); + notify(); + } + + boost::shared_ptr pop() { + Lock lock(this); + while (m_objs.empty()) { + wait(); + } + + boost::shared_ptr obj = m_objs.front(); + m_objs.pop_front(); + return obj; + } + +private: + std::deque > m_objs; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_POOL_H__ diff --git a/src/util/preprocess.cpp b/src/util/preprocess.cpp new file mode 100644 index 0000000000000..ac00abd83ecf9 --- /dev/null +++ b/src/util/preprocess.cpp @@ -0,0 +1,50 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "preprocess.h" +#include "base.h" +#include "exception.h" +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +istream *preprocessXHP(istream &input, iostream &output, + const std::string &fullPath) { + istream *is = &input; + string code, error; + uint32_t errline; + XHPResult res = xhp_preprocess(input, code, false, error, errline); + if (res == XHPRewrote) { + output << code; + is = &output; + } else if (res == XHPDidNothing) { + is = &input; + } else { + ASSERT(res == XHPErred); + throw Exception("Unable to parse XHP file: %s:%d\n%s", fullPath.c_str(), + (int)errline, error.c_str()); + } + is->clear(); + is->seekg(0, ios::beg); + return is; +} + + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/preprocess.h b/src/util/preprocess.h new file mode 100644 index 0000000000000..56f0cd30f0d11 --- /dev/null +++ b/src/util/preprocess.h @@ -0,0 +1,34 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __HPHP_UTIL_PREPROCESS_H__ +#define __HPHP_UTIL_PREPROCESS_H__ + +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Converts XHP into PHP. + */ +std::istream *preprocessXHP(std::istream &input, std::iostream &output, + const std::string &fullPath); + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __HPHP_UTIL_PREPROCESS_H__ diff --git a/src/util/process.cpp b/src/util/process.cpp new file mode 100644 index 0000000000000..5a59e7892b198 --- /dev/null +++ b/src/util/process.cpp @@ -0,0 +1,338 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "process.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "base.h" +#include "util.h" +#include "async_func.h" + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helpers + +static void swap_fd(const string &filename, FILE *fdesc) { + FILE *f = fopen(filename.c_str(), "a"); + if (f == NULL || dup2(fileno(f), fileno(fdesc)) < 0) { + if (f) fclose(f); + _exit(-1); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +class FileReader { +public: + FileReader(FilePtr f, string &out) : m_f(f), m_out(out) {} + void read() { readString(m_f.get(), m_out); } + + static void readString(FILE *f, string &out) { + size_t nread = 0; + const unsigned int BUFFER_SIZE = 1024; + char buf[BUFFER_SIZE]; + while ((nread = fread(buf, 1, BUFFER_SIZE, f)) != 0) { + out.append(buf, nread); + } + } + +private: + FilePtr m_f; + string &m_out; +}; + +/////////////////////////////////////////////////////////////////////////////// + +static void sigChildHandler(int signum) { + wait(0); +} + +// Cached process statics +std::string Process::HostName; +std::string Process::CurrentWorkingDirectory; + +void Process::InitProcessStatics() { + HostName = GetHostName(); + CurrentWorkingDirectory = GetCurrentDirectory(); +} + +bool Process::Exec(const char *path, const char *argv[], const char *in, + string &out, string *err /* = NULL */) { + signal(SIGCHLD, sigChildHandler); + + int fdin = 0; int fdout = 0; int fderr = 0; + int pid = Exec(path, argv, &fdin, &fdout, &fderr); + if (pid == 0) return false; + + FilePtr sout(fdopen(fdout, "r"), file_closer()); + FilePtr serr(fdopen(fderr, "r"), file_closer()); + { + FilePtr sin(fdopen(fdin, "w"), file_closer()); + if (!sin) return false; + if (in && *in) { + fwrite(in, 1, strlen(in), sin.get()); + } + } + if (!sout || !serr) return false; + + FileReader outReader(sout, out); + AsyncFunc func(&outReader, &FileReader::read); + func.start(); + + string junk; + if (err == NULL) err = &junk; // hzhao: don't know if this is needed + FileReader::readString(serr.get(), *err); + + func.waitForEnd(); + return true; +} + +int Process::Exec(const std::string &cmd, const std::string &outf, + const std::string &errf) { + vector argvs; + Util::split(' ', cmd.c_str(), argvs); + if (argvs.empty()) { + return -1; + } + + int pid = fork(); + if (pid < 0) { + Logger::Error("Unable to fork: %d %s", errno, + Util::safe_strerror(errno).c_str()); + return 0; + } + if (pid == 0) { + signal(SIGTSTP,SIG_IGN); + + swap_fd(outf, stdout); + swap_fd(errf, stderr); + + int count = argvs.size(); + char **argv = (char**)calloc(count + 1, sizeof(char*)); + for (int i = 0; i < count; i++) { + argv[i] = (char*)argvs[i].c_str(); + } + argv[count] = NULL; + + execvp(argv[0], argv); + _exit(-1); + } + int status = -1; + wait(&status); + return status; +} + +int Process::Exec(const char *path, const char *argv[], int *fdin, int *fdout, + int *fderr) { + CPipe pipein, pipeout, pipeerr; + if (!pipein.open() || !pipeout.open() || !pipeerr.open()) { + return 0; + } + + int pid = fork(); + if (pid < 0) { + Logger::Error("Unable to fork: %d %s", errno, + Util::safe_strerror(errno).c_str()); + return 0; + } + if (pid == 0) { + /** + * I don't know why, but things work alot better if this process ignores + * the tstp signal (ctrl-Z). If not, it locks up if you hit ctrl-Z then + * "bg" the program. + */ + signal(SIGTSTP,SIG_IGN); + + if (!pipein.dupOut2(fileno(stdin)) || !pipeout.dupIn2(fileno(stdout)) || + !pipeerr.dupIn2(fileno(stderr))) { + return 0; + } + + pipeout.close(); pipeerr.close(); pipein.close(); + + const char *argvnull[2] = {"", NULL}; + execvp(path, const_cast(argv ? argv : argvnull)); + return 0; + } + if (fdout) *fdout = pipeout.detachOut(); + if (fderr) *fderr = pipeerr.detachOut(); + if (fdin) *fdin = pipein.detachIn(); + return pid; +} + +/** + * Copied from http://www-theorie.physik.unizh.ch/~dpotter/howto/daemonize + */ +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 +void Process::Daemonize(const char *stdoutFile /* = "/dev/null" */, + const char *stderrFile /* = "/dev/null" */) { + pid_t pid, sid; + + /* already a daemon */ + if (getppid() == 1) return; + + /* Fork off the parent process */ + pid = fork(); + if (pid < 0) { + exit(EXIT_FAILURE); + } + /* If we got a good PID, then we can exit the parent process. */ + if (pid > 0) { + exit(EXIT_SUCCESS); + } + + /* At this point we are executing as the child process */ + + /* Change the file mode mask */ + umask(0); + + /* Create a new SID for the child process */ + sid = setsid(); + if (sid < 0) { + exit(EXIT_FAILURE); + } + + /* Change the current working directory. This prevents the current + directory from being locked; hence not being able to remove it. */ + if ((chdir("/")) < 0) { + exit(EXIT_FAILURE); + } + + /* Redirect standard files to /dev/null */ + freopen("/dev/null", "r", stdin); + if (stdoutFile && *stdoutFile) { + freopen(stdoutFile, "a", stdout); + } else { + freopen("/dev/null", "w", stdout); + } + if (stderrFile && *stderrFile) { + freopen(stderrFile, "a", stderr); + } else { + freopen("/dev/null", "w", stderr); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// /proc/* parsing functions + +pid_t Process::GetProcessId(const std::string &cmd, + bool matchAll /* = false */) { + std::vector pids; + GetProcessId(cmd, pids, matchAll); + return pids.empty() ? 0 : pids[0]; +} + +void Process::GetProcessId(const std::string &cmd, std::vector &pids, + bool matchAll /* = false */) { + const char *argv[] = {"", "/proc", "-regex", "/proc/[0-9]+/cmdline", NULL}; + string out; + Exec("find", argv, NULL, out); + + vector files; + Util::split('\n', out.c_str(), files, true); + + string ccmd = cmd; + if (!matchAll) { + size_t pos = ccmd.find(' '); + if (pos != string::npos) { + ccmd = ccmd.substr(0, pos); + } + pos = ccmd.rfind('/'); + if (pos != string::npos) { + ccmd = ccmd.substr(pos + 1); + } + } else { + ccmd += " "; + } + + for (unsigned int i = 0; i < files.size(); i++) { + string &filename = files[i]; + + FILE * f = fopen(filename.c_str(), "r"); + if (f) { + string cmdline; + FileReader::readString(f, cmdline); + fclose(f); + string converted; + if (matchAll) { + for (unsigned int i = 0; i < cmdline.size(); i++) { + char ch = cmdline[i]; + converted += ch ? ch : ' '; + } + } else { + converted = cmdline; + size_t pos = converted.find('\0'); + if (pos != string::npos) { + converted = converted.substr(0, pos); + } + pos = converted.rfind('/'); + if (pos != string::npos) { + converted = converted.substr(pos + 1); + } + } + + if (converted == ccmd && filename.find("/proc/") == 0) { + long long pid = atoll(filename.c_str() + strlen("/proc/")); + if (pid) { + pids.push_back(pid); + } + } + } + } +} + +int Process::GetProcessRSS(pid_t pid) { + string name = "/proc/" + boost::lexical_cast((long long)pid) + + "/status"; + + string status; + FILE * f = fopen(name.c_str(), "r"); + if (f) { + FileReader::readString(f, status); + fclose(f); + } + + vector lines; + Util::split('\n', status.c_str(), lines, true); + for (unsigned int i = 0; i < lines.size(); i++) { + string &line = lines[i]; + if (line.find("VmRSS:") == 0) { + for (unsigned int j = strlen("VmRSS:"); j < line.size(); j++) { + if (line[j] != ' ') { + long long mem = atoll(line.c_str() + j); + return mem/1024; + } + } + } + } + + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/process.h b/src/util/process.h new file mode 100644 index 0000000000000..a18b9abeee0b0 --- /dev/null +++ b/src/util/process.h @@ -0,0 +1,165 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __PROCESS_H__ +#define __PROCESS_H__ + +#include +#include +#include +#include +#include +#include +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helper class + +class CPipe { +public: + CPipe() { m_fds[0] = m_fds[1] = 0;} + ~CPipe() { close();} + + bool open() { close(); return !pipe(m_fds);} + void close() { + for (int i = 0; i <= 1; i++) { + if (m_fds[i]) { + ::close(m_fds[i]); + m_fds[i] = 0; + } + } + } + + int getIn() const { return m_fds[1];} + int getOut() const { return m_fds[0];} + int detachIn() { int fd = m_fds[1]; m_fds[1] = 0; return fd;} + int detachOut() { int fd = m_fds[0]; m_fds[0] = 0; return fd;} + bool dupIn2(int fd) { return dup2(m_fds[1], fd) >= 0;} + bool dupOut2(int fd) { return dup2(m_fds[0], fd) >= 0;} + +private: + int m_fds[2]; +}; + +/////////////////////////////////////////////////////////////////////////////// + +class Process { +public: + // Cached process statics + static std::string HostName; + static std::string CurrentWorkingDirectory; + static void InitProcessStatics(); + + /** + * Current executable's name. + */ + static std::string GetAppName() { + const char* progname = getenv("_"); + if (!progname || !*progname) { + progname = "unknown program"; + } + return progname; + } + + /** + * This machine'a name. + */ + static std::string GetHostName() { + char hostbuf[128]; + gethostname(hostbuf, 127); + hostbuf[127] = '\0'; + return hostbuf; + } + + /** + * Process identifier. + */ + static pid_t GetProcessId() { + return getpid(); + } + + /** + * Search for a process by command line. If matchAll is false, only binary + * file's name, not the whole path + command line options, will be matched. + */ + static pid_t GetProcessId(const std::string &cmd, bool matchAll = false); + static void GetProcessId(const std::string &cmd, std::vector &pids, + bool matchAll = false); + + /** + * Get memory usage in MB by a process. + */ + static int GetProcessRSS(pid_t pid); + + /** + * Current thread's identifier. + */ + static pthread_t GetThreadId() { + return pthread_self(); + } + + /** + * Get current working directory. + */ + static std::string GetCurrentDirectory() { + char buf[PATH_MAX]; + memset(buf, 0, PATH_MAX); + return getcwd(buf, PATH_MAX); + } + +public: + /** + * Execute an external program. + * + * @param path binary file's full path + * @param argv argument array + * @param in stdin + * @param out stdout + * @param err stderr; NULL for don't care + * @return true if program was executed, even if there was stderr; + * false if anything failed and unable to run the specified + * program + */ + static bool Exec(const char *path, const char *argv[], const char *in, + std::string &out, std::string *err = NULL); + + /** + * Execute an external program. + * + * @param cmd command line + * @param outf save stdout to this file + * @param errf save stderr to this file + * @return exit code of the program + */ + static int Exec(const std::string &cmd, const std::string &outf, + const std::string &errf); + + /** + * Daemonize current process. + */ + static void Daemonize(const char *stdoutFile = "/dev/null", + const char *stderrFile = "/dev/null"); + +private: + static int Exec(const char *path, const char *argv[], int *fdin, int *fdout, + int *fderr); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __PROCESS_H__ diff --git a/src/util/shared_memory_allocator.cpp b/src/util/shared_memory_allocator.cpp new file mode 100644 index 0000000000000..8055dc8f33880 --- /dev/null +++ b/src/util/shared_memory_allocator.cpp @@ -0,0 +1,42 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "shared_memory_allocator.h" +#include "exception.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +const char *SharedMemoryManager::Name = "HPHPSharedMemory"; +boost::interprocess::managed_shared_memory * +SharedMemoryManager::Segment = NULL; + +void SharedMemoryManager::Init(int size, bool clean) { + try { + if (Segment == NULL) { + if (clean) { + boost::interprocess::shared_memory_object::remove(Name); + } + Segment = new boost::interprocess::managed_shared_memory + (boost::interprocess::open_or_create, Name, size); + } + } catch (std::exception &e) { + throw Exception(e.what()); // so we have stacktrace + } +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/shared_memory_allocator.h b/src/util/shared_memory_allocator.h new file mode 100644 index 0000000000000..36304b70528d5 --- /dev/null +++ b/src/util/shared_memory_allocator.h @@ -0,0 +1,241 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __MEMORY_SHARED_MEMORY_ALLOCATOR_H__ +#define __MEMORY_SHARED_MEMORY_ALLOCATOR_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "base.h" + +namespace HPHP { + +/** + * HOW TO USE SHARED MEMORY FOR MY OBJECTS? + * ======================================== + * + * 1. Make sure your class is POD (plain-old data object), simply meaning + * there cannot be virtual functions in the class. Derivation is okay, but + * just not virtual functions, because virtual function table has address + * pointers that are always local to creation process, and those are not + * pass-able between different processes. If you have it, the symptom would + * be, well it works for the creation process, but it will fail miserably + * when a 2nd process attaches to the same shared memory and call some + * functions (or other things) that use vtable. + * + * 2. Make sure ALL data members, no matter how deep it is, are shared memory + * safe. Primitive types are automatically shared memory safe, thanks to the + * allocator implemented in this file. For complex types, we just need to + * make sure all STL classes are converted to use their counterparts: + * + * std::string => SharedMemoryString + * std::vector => SharedMemoryVector + * std::list => SharedMemoryList + * std::set => SharedMemorySet + * std::map => SharedMemoryMap + * + * There is a macro DISABLE_SHARED_MEMORY for debugging purpose, turning off + * this conversion transparently. + * + * For any other complex types that are not covered here, they have to have + * a way to specify its memory allocator to use the allocator in this file. + * This normally means dirty work redirecting all malloc/free to call + * methods on the allocator and pass this allocator into the class. So it + * may not be trivial. + * + * 3. During application startup time, call this to initialize/attach to an + * existing piece of shared memory: + * + * SharedMemoryManager::Init(totalSizeInBytes); + * + * Shared memory can actually resizable, but it's not implemented in this + * file yet. Look up this web site for adding features in this file: + * + * http://www.boost.org/doc/libs/1_35_0/doc/html/interprocess.html + * + * 4. Now, we need a top level object to pull out anything from shared memory, + * right? This kind of top level objects always have a name to uniquely + * identify them: + * + * MyClass *top_level_object = + * SharedMemory::OpenOrCreate("a unique name for my object"); + * + * Note SharedMemory works just fine with primitive types: + * + * int *secret_integer = SharedMemory::OpenOrCreate("secret"); + * + * 5. If we are the sole owner of a shared memory object, we don't need locking + * at all. If not, we need to lock individual objects for accesses: + * + * int *shared = SharedMemory::OpenOrCreate("shared"); + * { + * SharedMemoryLock lock("any name for this lock"); + * *shared = whatever; + * } + * + * Two things to notice, (1) SharedMemory::OpenOrCreate() is atomic + * already, and there is no need to lock protect that. It also made sure + * same key/name never gets created twice by two concurrent processes. + * (2) lock's name has NOTHING to do with the object's name. So you can use + * the same lock for multiple objects. Or, more often than not, you can use + * multple locks for sub-component of the same object -- finer locking. + * + * It's a dumb simple mutex-based lock right now. It's possible to have + * read-write locks as well, just not implemented yet. + */ + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Helper class to hold a segment of shared-memory. We only need one instance + * of this class for one application for simplicity. + */ +class SharedMemoryManager { +public: + // an app needs to call this during startup time + static void Init(int size, bool clean); + + // called by allocator class + static boost::interprocess::managed_shared_memory *GetSegment() { + ASSERT(Segment); // or Init() is missing + return Segment; + } + +private: + static const char *Name; + static boost::interprocess::managed_shared_memory *Segment; +}; + +/** + * Helper class for STL classes to use our SharedMemoryManager for allocating + * elements. + */ +template +class SharedMemoryAllocator : public boost::interprocess::allocator + { +public: + SharedMemoryAllocator() : + boost::interprocess::allocator + + (SharedMemoryManager::GetSegment()->get_segment_manager()) { + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Creating or destroying a top-level shared memory objects with names. + */ +template +class SharedMemory { +public: + static T *OpenOrCreate(const char *name) { + ASSERT(name && *name); + return SharedMemoryManager::GetSegment()->find_or_construct(name)(); + } + static bool Destroy(const char *name) { + ASSERT(name && *name); + return SharedMemoryManager::GetSegment()->destroy(name); + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +#ifndef DISABLE_SHARED_MEMORY + +/** + * Embeddable STL classes: string, vector, list, set, map. + */ +typedef boost::interprocess::string SharedMemoryString; + +// This sucks, since C++ doesn't support partial template typedefs. + +template +class SharedMemoryVector : + public boost::interprocess::vector > { +}; +template +class SharedMemoryList : + public boost::interprocess::list > { +}; +template +class SharedMemorySet : + public boost::interprocess::set, + SharedMemoryAllocator > { +}; +template +class SharedMemoryMap : + public boost::interprocess::map + , SharedMemoryAllocator > > { +}; + +template +class SharedMemoryMapWithComp : + public boost::interprocess::map + > > { +}; + +#else + +// falling back to regular std classes +typedef std::string SharedMemoryString; +template class SharedMemoryVector : public std::vector {}; +template class SharedMemoryList : public std::list {}; +template class SharedMemorySet : public std::set {}; +template +class SharedMemoryMap : public std::map {}; + +#endif + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Lock/unlock a top level shared memory object for sole access. + */ +class SharedMemoryLock { +public: + static bool Destroy(const char *name) { + ASSERT(name && *name); + return boost::interprocess::named_mutex::remove(name); + } + + SharedMemoryLock(const char *name) { + ASSERT(name && *name); + m_mutex = new boost::interprocess::named_mutex + (boost::interprocess::open_or_create, name); + m_mutex->lock(); + } + + ~SharedMemoryLock() { + m_mutex->unlock(); + delete m_mutex; + } + +private: + boost::interprocess::named_mutex *m_mutex; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __MEMORY_SHARED_MEMORY_ALLOCATOR_H__ diff --git a/src/util/stack_trace.cpp b/src/util/stack_trace.cpp new file mode 100644 index 0000000000000..f80a44347adb8 --- /dev/null +++ b/src/util/stack_trace.cpp @@ -0,0 +1,453 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "stack_trace.h" +#include "process.h" +#include "base.h" +#include "lock.h" +#include "util.h" + +#ifndef MAC_OS_X +#include +#include +#endif + +#include +#include + +using namespace std; +using namespace boost; + +namespace HPHP { + +/////////////////////////////////////////////////////////////////////////////// + +std::string StackTrace::Frame::toString() const { + string out; + out = funcname.empty() ? "??" : funcname; + out += " at "; + out += filename.empty() ? "??" : filename; + out += ":"; + out += lexical_cast(lineno); + return out; +} + +/////////////////////////////////////////////////////////////////////////////// +// signal handler + +static void bt_handler(int sig) { + // In case we crash again in the signal hander or something + signal(sig, SIG_DFL); + + // Calling all of these library functions in a signal handler + // is completely undefined behavior, but we seem to get away with it. + + Logger::Error("Core dumped: %s", strsignal(sig)); + + StackTrace st; + std::string logmessage; + std::string outfn = st.log(strsignal(sig), &logmessage); + + //cerr << logmessage << endl; + if (!StackTrace::ReportEmail.empty()) { + //cerr << "Emailing trace to " << StackTrace::ReportEmail << endl; + string cmdline = "cat " + outfn + string(" | mail -s \"Stack Trace from ") + + Process::GetAppName() + string("\" ") + StackTrace::ReportEmail; + Util::ssystem(cmdline.c_str()); + } + + // re-raise the signal and pass it to the default handler + // to terminate the process. + raise(sig); +} + +/////////////////////////////////////////////////////////////////////////////// +// statics + +string StackTrace::ReportEmail; + +void StackTrace::InstallReportOnSignal(int sig) { + signal(sig, bt_handler); +} + +void StackTrace::InstallReportOnErrors() { + static bool already_set = false; + if (already_set) return; + already_set = true; + + // Turn on bt-on-sig for a good default set of error signals + signal(SIGQUIT, bt_handler); + signal(SIGTERM, bt_handler); + signal(SIGILL, bt_handler); + signal(SIGFPE, bt_handler); + signal(SIGSEGV, bt_handler); + signal(SIGBUS, bt_handler); + signal(SIGABRT, bt_handler); +} + +/////////////////////////////////////////////////////////////////////////////// +// constructor and destructor + +StackTrace::StackTrace() { + create(); +#ifndef MAC_OS_X + bfd_init(); +#endif +} + +StackTrace::StackTrace(const StackTrace &bt) { + assert(this != &bt); + + m_bt_pointers = bt.m_bt_pointers; + m_bt = bt.m_bt; +} + +StackTrace::StackTrace(const std::string &hexEncoded) { + vector frames; + Util::split(':', hexEncoded.c_str(), frames); + for (unsigned int i = 0; i < frames.size(); i++) { + m_bt_pointers.push_back((void*)strtoll(frames[i].c_str(), NULL, 16)); + } +} + +void StackTrace::create() { + const int MAXFRAME = 175; + void *btpointers[MAXFRAME]; + int framecount = 0; +#ifndef MAC_OS_X + framecount = backtrace(btpointers, MAXFRAME); +#endif + if (framecount <= 0 || framecount > MAXFRAME) { + m_bt_pointers.clear(); + return; + } + m_bt_pointers.resize(framecount); + for (int i = 0; i < framecount; i++) { + m_bt_pointers[i] = btpointers[i]; + } +} + +/////////////////////////////////////////////////////////////////////////////// +// reporting functions + +const std::string &StackTrace::toString() const { + if (m_bt.empty()) { + size_t frame = 0; + for (vector::const_iterator btpi = m_bt_pointers.begin(); + btpi != m_bt_pointers.end(); ++btpi) { + string framename = Translate(*btpi)->toString(); + if (framename.find("StackTrace::") != string::npos) { + continue; // ignore frames in the StackTrace class + } + m_bt += "# "; + m_bt += lexical_cast(frame); + if (frame < 10) m_bt += " "; + + m_bt += " "; + m_bt += framename; + m_bt += "\n"; + ++frame; + } + } + return m_bt; +} + +void StackTrace::get(FramePtrVec &frames) const { + frames.clear(); + for (vector::const_iterator btpi = m_bt_pointers.begin(); + btpi != m_bt_pointers.end(); ++btpi) { + frames.push_back(Translate(*btpi)); + } +} + +std::string StackTrace::hexEncode(int minLevel /* = 0 */, + int maxLevel /* = 999 */) const { + string bts; + for (int i = minLevel; i < (int)m_bt_pointers.size() && i < maxLevel; i++) { + if (i > minLevel) bts += ':'; + char buf[20]; + snprintf(buf, sizeof(buf), "%llx", (int64)m_bt_pointers[i]); + bts.append(buf); + } + return bts; +} + +string StackTrace::log(const char *errorType, string *out /* = NULL */) const { + string pid = lexical_cast(Process::GetProcessId()); + + string msg; + msg += "Host: " + Process::GetHostName(); + msg += "\nProcessID: " + pid; + msg += "\nThreadID: " + lexical_cast(Process::GetThreadId()); + msg += "\nName: " + Process::GetAppName(); + msg += "\nType: "; + if (errorType) { + msg += errorType; + } else { + msg += "(unknown error)"; + } + msg += "\n\n"; + msg += toString(); + msg += "\n"; + + string tracefn = "/tmp/stacktrace." + pid + ".log"; + ofstream f(tracefn.c_str()); + if (f) { + f << msg; + f.close(); + } + + if (out) { + *out = msg; + } + return tracefn; +} + +/////////////////////////////////////////////////////////////////////////////// +// helpers + +StackTrace::FramePtr StackTrace::Translate(void *frame) { + FramePtr f(new Frame(frame)); + + char sframe[32]; + snprintf(sframe, sizeof(sframe), "%p", frame); + string original_frame = sframe; + + Dl_info dlInfo; + if (!dladdr(frame, &dlInfo)) { + return f; + } + + // frame pointer offset in previous frame + f->offset = (char*)frame - (char*)dlInfo.dli_saddr; + + string out; + if (dlInfo.dli_fname) { + string fname = dlInfo.dli_fname; + + // 1st attempt without offsetting base address + if (!Addr2line(dlInfo.dli_fname, sframe, f) && + fname.find(".so") != string::npos) { + // offset shared lib's base address + frame = (char*)frame - (size_t)dlInfo.dli_fbase; + snprintf(sframe, sizeof(sframe), "%p", frame); + + // Use addr2line to get line number info. + Addr2line(dlInfo.dli_fname, sframe, f); + } + } + if (f->filename.empty() && dlInfo.dli_fname) { + f->filename = dlInfo.dli_fname; + } + if (f->funcname.empty() && dlInfo.dli_sname) { + f->funcname = Demangle(dlInfo.dli_sname); + } + + return f; +} + +/////////////////////////////////////////////////////////////////////////////// +// copied and re-factored from addr2line + +#ifndef MAC_OS_X + +struct addr2line_data { + asymbol **syms; + bfd_vma pc; + const char *filename; + const char *functionname; + unsigned int line; + bfd_boolean found; +}; + +static void find_address_in_section(bfd *abfd, asection *section, void *data) { + addr2line_data *adata = reinterpret_cast(data); + + bfd_vma vma; + bfd_size_type size; + + if (adata->found) { + return; + } + + if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0) { + return; + } + + vma = bfd_get_section_vma(abfd, section); + if (adata->pc < vma) { + return; + } + + size = bfd_get_section_size(section); + if (adata->pc >= vma + size) { + return; + } + + adata->found = bfd_find_nearest_line(abfd, section, adata->syms, + adata->pc - vma, &adata->filename, + &adata->functionname, &adata->line); + if (adata->found) { + const char *file = adata->filename; + unsigned int line = adata->line; + bfd_boolean found = TRUE; + while (found) { + found = bfd_find_inliner_info(abfd, &file, &adata->functionname, &line); + } + } +} + +static bool slurp_symtab(asymbol ***syms, bfd *abfd) { + long symcount; + unsigned int size; + + symcount = bfd_read_minisymbols(abfd, FALSE, (void **)syms, &size); + if (symcount == 0) { + symcount = bfd_read_minisymbols(abfd, TRUE /* dynamic */, (void **)syms, + &size); + } + return symcount >= 0; +} + +static bool translate_addresses(bfd *abfd, const char *addr, + addr2line_data *adata) { + adata->pc = bfd_scan_vma(addr, NULL, 16); + + adata->found = FALSE; + bfd_map_over_sections(abfd, find_address_in_section, adata); + + if (!adata->found || !adata->functionname || !*adata->functionname) { + return false; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// We cache opened bfd file pointers that in turn cached frame pointer lookup +// tables. + +struct bfd_cache { + bfd *abfd; + asymbol **syms; + + ~bfd_cache() { + if (abfd) { + bfd_cache_close(abfd); + bfd_free_cached_info(abfd); + bfd_close_all_done(abfd); + } + } +}; +typedef boost::shared_ptr bfd_cache_ptr; +typedef __gnu_cxx::hash_map bfdMap; +static Mutex s_bfdMutex; +static bfdMap s_bfds; + +static bfd_cache_ptr get_bfd_cache(const char *filename) { + bfdMap::const_iterator iter = s_bfds.find(filename); + if (iter != s_bfds.end()) { + return iter->second; + } + bfd_cache_ptr p(new bfd_cache()); + bfd *abfd = bfd_openr(filename, NULL); + if (abfd) { + p->abfd = abfd; + p->syms = NULL; + char **match; + if (bfd_check_format(abfd, bfd_archive) || + !bfd_check_format_matches(abfd, bfd_object, &match) || + !slurp_symtab(&p->syms, abfd)) { + bfd_close(abfd); + p.reset(); + } + } else { + p.reset(); + } + s_bfds[filename] = p; + return p; +} + +#endif + +bool StackTrace::Addr2line(const char *filename, const char *address, + FramePtr &frame) { +#ifndef MAC_OS_X + Lock lock(s_bfdMutex); + bfd_cache_ptr p = get_bfd_cache(filename); + if (!p) return false; + + addr2line_data data; + data.filename = NULL; + data.functionname = NULL; + data.line = 0; + data.syms = p->syms; + bool ret = translate_addresses(p->abfd, address, &data); + if (ret) { + if (data.filename) { + frame->filename = data.filename; + } + if (data.functionname) { + frame->funcname = Demangle(data.functionname); + } + frame->lineno = data.line; + } + return ret; +#else + return false; +#endif +} + +/////////////////////////////////////////////////////////////////////////////// +// copied and re-factored from demangle/c++filt + +#define DMGL_PARAMS (1 << 0) /* Include function args */ +#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ +#define DMGL_VERBOSE (1 << 3) /* Include implementation details. */ + +#ifndef MAC_OS_X + +extern "C" { + extern char *cplus_demangle (const char *mangled, int options); +} + +#endif + +std::string StackTrace::Demangle(const char *mangled) { + assert(mangled); + if (!mangled || !*mangled) { + return ""; + } + +#ifndef MAC_OS_X + size_t skip_first = 0; + if (mangled[0] == '.' || mangled[0] == '$') ++skip_first; + //if (mangled[skip_first] == '_') ++skip_first; + + char *result = cplus_demangle(mangled + skip_first, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE); + if (result == NULL) return mangled; + + string ret; + if (mangled[0] == '.') ret += '.'; + ret += result; + free (result); + return ret; +#else + return mangled; +#endif +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/stack_trace.h b/src/util/stack_trace.h new file mode 100644 index 0000000000000..a1df53094f83e --- /dev/null +++ b/src/util/stack_trace.h @@ -0,0 +1,128 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __STACKTRACE_H__ +#define __STACKTRACE_H__ + +#include +#include +#include "base.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Taking a stacktrace at current execution location. + */ +class StackTrace { +public: + DECLARE_BOOST_TYPES(Frame); + class Frame { + public: + Frame(void *_bt) : bt(_bt), lineno(0), offset(0) {} + + void *bt; + std::string filename; + std::string funcname; + int lineno; + int offset; + + std::string toString() const; + }; + +public: + static std::string ReportEmail; + + /** + * Attaches the handler to a bunch of normally fatal signals (SEGV, BUS, + * ABRT, etc).a + */ + static void InstallReportOnErrors(); + + /** + * Asking for a backtrace-on-signal will log the trace to stderr and + * then terminate the program if that signal is caught. Use this to attach to + * a specific signal. + */ + static void InstallReportOnSignal(int signal); + + /** + * Translate a frame pointer to file name and line number pair. + */ + static FramePtr Translate(void *bt); + + /** + * Run addr2line to translate a function pointer into function name and line + * number. + */ + static bool Addr2line(const char *filename, const char *address, + FramePtr &frame); + + /** + * Demangle a function name. + */ + static std::string Demangle(const char *mangled); + +public: + /** + * Constructor, and this will save current stack trace. + */ + StackTrace(); + + /** + * Copy constructor. This will copy over stack trace without saving current + * stack's. + */ + StackTrace(const StackTrace &bt); + + /** + * Constructing from hexEncode() results. + */ + StackTrace(const std::string &hexEncoded); + + /** + * Generate an output of the written stack trace. + */ + const std::string &toString() const; + + /** + * Get frames in raw pointers or translated frames. + */ + void get(std::vector &bt) const { bt = m_bt_pointers;} + void get(FramePtrVec &frames) const; + std::string hexEncode(int minLevel = 0, int maxLevel = 999) const; + + /** + * Log stacktrace into a file under /tmp. If "out" is not null, + * also store translated stack trace into the variable. + * Returns the name of the generated file. + */ + std::string log(const char *errorType, std::string *out = NULL) const; + +private: + std::vector m_bt_pointers; + mutable std::string m_bt; + + /** + * Record bt pointers. + */ + void create(); +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __STACKTRACE_H__ diff --git a/src/util/string_bag.cpp b/src/util/string_bag.cpp new file mode 100644 index 0000000000000..88e29e0a47a9d --- /dev/null +++ b/src/util/string_bag.cpp @@ -0,0 +1,46 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "string_bag.h" + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +StringBag::StringBag(int reserve_count /* = 0 */) { + if (reserve_count > 0) { + m_strings.reserve(reserve_count); + } +} + +StringBag::~StringBag() { + for (unsigned int i = 0; i < m_strings.size(); i++) free(m_strings[i]); +} + +const char *StringBag::add(const char *s) { + char *allocated = strdup(s); + m_strings.push_back(allocated); + return allocated; +} + +const char *StringBag::at(unsigned int index) const { + ASSERT(index < m_strings.size()); + return m_strings[index]; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/string_bag.h b/src/util/string_bag.h new file mode 100644 index 0000000000000..95cb229e920b9 --- /dev/null +++ b/src/util/string_bag.h @@ -0,0 +1,45 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __STRING_BAG_H__ +#define __STRING_BAG_H__ + +#include "base.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Holding a list of char* safely, so other places only need to store char* + * than making a copy. + */ +class StringBag { +public: + StringBag(int reserve_count = 0); + ~StringBag(); + + const char *add(const char *s); + unsigned int size() const { return m_strings.size();} + const char *at(unsigned int index) const; + +private: + std::vector m_strings; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __STRING_BAG_H__ diff --git a/src/util/synchronizable.cpp b/src/util/synchronizable.cpp new file mode 100644 index 0000000000000..85142b72a6d53 --- /dev/null +++ b/src/util/synchronizable.cpp @@ -0,0 +1,65 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "synchronizable.h" +#include "base.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Synchronizable::Synchronizable() { + pthread_cond_init(&m_cond, NULL); +} + +Synchronizable::~Synchronizable() { + pthread_cond_destroy(&m_cond); +} + +void Synchronizable::wait() { +#ifdef RELEASE + pthread_cond_wait(&m_cond, &m_mutex.getRaw()); +#else + int ret = pthread_cond_wait(&m_cond, &m_mutex.getRaw()); + ASSERT(ret != EPERM); // did you lock the mutex? +#endif +} + +bool Synchronizable::wait(long long seconds) { + return wait(seconds, 0); +} + +bool Synchronizable::wait(long long seconds, long long nanosecs) { + struct timespec ts; + clock_gettime(CLOCK_REALTIME, &ts); + ts.tv_sec += seconds; + ts.tv_nsec += nanosecs; + + int ret = pthread_cond_timedwait(&m_cond, &m_mutex.getRaw(), &ts); + ASSERT(ret != EPERM); // did you lock the mutex? + + return ret != ETIMEDOUT; +} + +void Synchronizable::notify() { + pthread_cond_signal(&m_cond); +} + +void Synchronizable::notifyAll() { + pthread_cond_broadcast(&m_cond); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/synchronizable.h b/src/util/synchronizable.h new file mode 100644 index 0000000000000..c490f5edba532 --- /dev/null +++ b/src/util/synchronizable.h @@ -0,0 +1,51 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __SYNCHRONIZABLE_H__ +#define __SYNCHRONIZABLE_H__ + +#include "mutex.h" +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Java-like base class for synchronization between object methods within the + * same class. Check pool.h for a typical example. + */ +class Synchronizable { + public: + Synchronizable(); + virtual ~Synchronizable(); + + void wait(); + bool wait(long long seconds); // false if timed out + bool wait(long long seconds, long long nanosecs); // false if timed out + void notify(); + void notifyAll(); + + Mutex &getMutex() { return m_mutex;} + + private: + Mutex m_mutex; + pthread_cond_t m_cond; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __SYNCHRONIZABLE_H__ diff --git a/src/util/thread_local.h b/src/util/thread_local.h new file mode 100644 index 0000000000000..ea9e0b9697455 --- /dev/null +++ b/src/util/thread_local.h @@ -0,0 +1,389 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __THREAD_LOCAL_H__ +#define __THREAD_LOCAL_H__ + +#include +#include "exception.h" +#include + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// +// helper + +inline void ThreadLocalCreateKey(pthread_key_t *key, void (*del)(void*)) { + int ret = pthread_key_create(key, del); + if (ret != 0) { + const char *msg = "(unknown error)"; + switch (ret) { + case EAGAIN: + msg = "PTHREAD_KEYS_MAX (1024) is exceeded"; + break; + case ENOMEM: + msg = "Out-of-memory"; + break; + } + throw Exception("pthread_key_create", ret, msg); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +/** + * A thread-local object is a "global" object within a thread. This is useful + * for writing apartment-threaded code, where nothing is actullay shared + * between different threads (hence no locking) but those variables are not + * on stack in local scope. To use it, just do something like this, + * + * ThreadLocal static_object; + * static_object->data_ = ...; + * static_object->doSomething(); + * + * ThreadLocal static_number; + * int value = *static_number; + * + * So, syntax-wise it's similar to pointers. T can be primitive types, and if + * it's a class, there has to be a default constructor. + */ +template +class ThreadLocalBase { +public: + +public: + /** + * Constructor that has to be called from a thread-neutral place. + */ + ThreadLocalBase() : m_key(0) { + ThreadLocalCreateKey(&m_key, OnThreadExit); + } + +public: + static void OnThreadExit(void *obj) { + delete (T*)obj; + } + + pthread_key_t m_key; +}; + +/////////////////////////////////////////////////////////////////////////////// +// most classes can do new() without parameters + +template +class ThreadLocal : public ThreadLocalBase { +public: + T *get() const { + T *obj = (T*)pthread_getspecific(ThreadLocalBase::m_key); + if (obj == NULL) { + obj = new T(); + pthread_setspecific(ThreadLocalBase::m_key, obj); + } + return obj; + } + + void reset() { + delete (T*)pthread_getspecific(ThreadLocalBase::m_key); + pthread_setspecific(ThreadLocalBase::m_key, NULL); + } + + /** + * Access object's member or method through this operator overload. + */ + T *operator->() const { + return get(); + } + + T &operator*() const { + return *get(); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +// some classes need two-phase object creation + +template +class ThreadLocalCreate : public ThreadLocalBase { +public: + T *get() const { + T *obj = (T*)pthread_getspecific(ThreadLocalBase::m_key); + if (obj == NULL) { + obj = T::Create(m_createInfo); + pthread_setspecific(ThreadLocalBase::m_key, obj); + } + return obj; + } + + void reset() { + delete (T*)pthread_getspecific(ThreadLocalBase::m_key); + pthread_setspecific(ThreadLocalBase::m_key, NULL); + } + + /** + * Access object's member or method through this operator overload. + */ + T *operator->() const { + return get(); + } + + T &operator*() const { + return *get(); + } + + void *m_createInfo; +}; + +/////////////////////////////////////////////////////////////////////////////// +// some classes don't need new/delete at all + +template +class ThreadLocalProxy { +public: + /** + * Constructor that has to be called from a thread-neutral place. + */ + ThreadLocalProxy() : m_key(0) { + ThreadLocalCreateKey(&m_key, OnThreadExit); + } + + T *get() const { + T *obj = (T*)pthread_getspecific(m_key); + if (obj == NULL && throwOnNull) { + throw Exception("ThreadLocalProxy::get() called before set()"); + } + return obj; + } + + void set(T* obj) { + pthread_setspecific(m_key, obj); + } + + void reset() { + pthread_setspecific(m_key, NULL); + } + + /** + * Access object's member or method through this operator overload. + */ + T *operator->() const { + return get(); + } + + T &operator*() const { + return *get(); + } + +public: + static void OnThreadExit(void *obj) { + // do nothing + } + + pthread_key_t m_key; +}; + +/////////////////////////////////////////////////////////////////////////////// + +// Only gcc >= 4.0.3 will work +#if defined(USE_TLS) && __GNUC__ >= 4 && \ + (__GNUC_MINOR__ > 0 || __GNUC_PATCHLEVEL__ >= 3) + +template +static T *&_tls_get() { + static __attribute__ ((tls_model ("initial-exec"))) __thread T *p = NULL; + return p; +} + +template +class TLS : public ThreadLocalBase { +public: + TLS(T *&(*f)(void)) { m_get = f; } + + T *get() const { + T *&p = m_get(); + if (p == NULL) { + p = new T(); + pthread_setspecific(ThreadLocalBase::m_key, p); + } + return p; + } + + void reset() { + T *&p = m_get(); + delete p; + p = NULL; + pthread_setspecific(ThreadLocalBase::m_key, NULL); + } + + T *operator->() const { + return get(); + } + + T &operator*() const { + return *get(); + } + +private: + T *&(*m_get)(void); +}; + +template +class TLSCreate : public ThreadLocalBase { +public: + TLSCreate(T *&(*f)(void)) { m_get = f; } + + T *get() const { + T *&p = m_get(); + if (p == NULL) { + p = T::Create(m_createInfo); + pthread_setspecific(ThreadLocalBase::m_key, p); + } + return p; + } + + void reset() { + T *&p = m_get(); + delete p; + p = NULL; + pthread_setspecific(ThreadLocalBase::m_key, NULL); + } + + T *operator->() const { + return get(); + } + + T &operator*() const { + return *get(); + } + + void *m_createInfo; + +private: + T *&(*m_get)(void); +}; + +template +class ThreadLocalStatic { +public: + T *get() const { + T *&p = get_loc(); + if (p == NULL) { + p = T::Create(); + } + return p; + } + + void reset() { + T *&p = get_loc(); + T::Delete(p); + p = NULL; + } + + T *operator->() const { + return get(); + } + + T &operator*() const { + return *get(); + } + +private: + static T *&get_loc() { + static __attribute__ ((tls_model ("initial-exec"))) __thread T *p = NULL; + return p; + } +}; + +/* + * How to use the thread-local macros: + * + * Use DECLARE_THREAD_LOCAL to declare a *static* class field as thread local: + * class SomeClass { + * static DECLARE_THREAD_LOCAL(SomeFieldType, f); + * } + * + * Use IMPLEMENT_THREAD_LOCAL in the cpp file to implement the field: + * IMPLEMENT_THREAD_LOCAL(SomeFieldType, SomeClass::f); + * + * Remember: *Never* write IMPLEMENT_THREAD_LOCAL in a header file. + */ + +#define DECLARE_THREAD_LOCAL(T, f) TLS f +#define IMPLEMENT_THREAD_LOCAL(T, f) TLS f(_tls_get) + +#define DECLARE_THREAD_LOCAL_CREATE(T, f) TLSCreate f +#define IMPLEMENT_THREAD_LOCAL_CREATE(T, f) \ + TLSCreate f(_tls_get) + +#else /* USE_TLS */ + +template +class ThreadLocalStatic { +public: + ThreadLocalStatic() : key_(0) { + key_ = getKey(); + } + + T *get() const { + T *obj = (T*)pthread_getspecific(key_); + if (obj == NULL) { + obj = T::Create(); + pthread_setspecific(key_, obj); + } + return obj; + } + + void reset() { + T::Delete((T*)pthread_getspecific(key_)); + pthread_setspecific(key_, NULL); + } + + /** + * Access object's member or method through this operator overload. + */ + T *operator->() const { + return get(); + } + + T &operator*() const { + return *get(); + } + +private: + pthread_key_t key_; + + static pthread_key_t getKey() { + static pthread_key_t key = 0; + if (key == 0) { + ThreadLocalCreateKey(&key, NULL); + } + return key; + } +}; + +#define DECLARE_THREAD_LOCAL(T, f) ThreadLocal f +#define IMPLEMENT_THREAD_LOCAL(T, f) ThreadLocal f + +#define DECLARE_THREAD_LOCAL_CREATE(T, f) ThreadLocalCreate f +#define IMPLEMENT_THREAD_LOCAL_CREATE(T, f) ThreadLocalCreate f + +#endif /* USE_TLS */ + +/////////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __THREAD_LOCAL_H__ diff --git a/src/util/timer.cpp b/src/util/timer.cpp new file mode 100644 index 0000000000000..a07ddfbcfb081 --- /dev/null +++ b/src/util/timer.cpp @@ -0,0 +1,104 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "timer.h" +#include "logger.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +Timer::Timer(Type type, const char *name /* = NULL */) : m_type(type) { + if (name) { + m_name = name; + Logger::Info("%s...", name); + } + m_start = measure(); +} + +Timer::~Timer() { + if (!m_name.empty()) { + report(); + } +} + +int64 Timer::getMicroSeconds() const { + return measure() - m_start; +} + +void Timer::report() const { + int64 ms = getMicroSeconds(); + int seconds = ms / 1000000; + Logger::Info("%s took %d'%02d\" (%d ms) %s", m_name.c_str(), + seconds / 60, seconds % 60, ms/1000, getName()); +} + +static int64 to_usec(const timeval& tv) { + return (int64(tv.tv_sec) * 1000000) + tv.tv_usec; +} + +int64 Timer::measure() const { + if (m_type == WallTime) { + struct timeval tv; + gettimeofday(&tv, 0); + return to_usec(tv); + } + + struct rusage ru; + memset(&ru, 0, sizeof(ru)); + getrusage(RUSAGE_SELF, &ru); + + switch (m_type) { + case SystemCPU: return to_usec(ru.ru_stime); + case UserCPU: return to_usec(ru.ru_utime); + case TotalCPU: return to_usec(ru.ru_stime) + to_usec(ru.ru_utime); + default: ASSERT(false); + } + return 0; +} + +const char *Timer::getName() const { + switch (m_type) { + case WallTime: return "wall time"; + case SystemCPU: return "system cpu"; + case UserCPU: return "user cpu"; + case TotalCPU: return "total cpu"; + default: ASSERT(false); + } + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// + +SlowTimer::SlowTimer(int64 msThreshold, const char *location, const char *info) + : m_timer(Timer::WallTime), m_msThreshold(msThreshold) { + if (location) m_location = location; + if (info) m_info = info; +} + +SlowTimer::~SlowTimer() { + int64 msec = getTime(); + if (msec >= m_msThreshold) { + Logger::Error("SlowTimer [%dms] at %s: %s", + msec, m_location.c_str(), m_info.c_str()); + } +} + +int64 SlowTimer::getTime() const { + return m_timer.getMicroSeconds() / 1000; +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/timer.h b/src/util/timer.h new file mode 100644 index 0000000000000..300b34e29bfee --- /dev/null +++ b/src/util/timer.h @@ -0,0 +1,70 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __TIMER_H__ +#define __TIMER_H__ + +#include "base.h" + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Timing execution of block of codes. + */ +class Timer { +public: + enum Type { + WallTime, + SystemCPU, + UserCPU, + TotalCPU, + }; + +public: + Timer(Type type, const char *name = NULL); + ~Timer(); + + const char *getName() const; + int64 getMicroSeconds() const; + void report() const; + +private: + Type m_type; + std::string m_name; + int64 m_start; + + int64 measure() const; +}; + +class SlowTimer { +public: + SlowTimer(int64 msThreshold, const char *location, const char *info); + ~SlowTimer(); + + int64 getTime() const; + +private: + Timer m_timer; + int64 m_msThreshold; + std::string m_location; + std::string m_info; +}; + +/////////////////////////////////////////////////////////////////////////////// +} + +#endif // __TIMER_H__ diff --git a/src/util/util.cpp b/src/util/util.cpp new file mode 100644 index 0000000000000..7526a4214a89c --- /dev/null +++ b/src/util/util.cpp @@ -0,0 +1,350 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#include "util.h" +#include "base.h" +#include "logger.h" +#include "exception.h" +#include "network.h" + +#include +#include +#include +#include + +using namespace std; + +namespace HPHP { +/////////////////////////////////////////////////////////////////////////////// + +void Util::split(char delimiter, const char *s, vector &out, + bool ignoreEmpty /* = false */) { + ASSERT(s); + + string token; + for (const char *p = s; *p; p++) { + if (*p == delimiter) { + if (!ignoreEmpty || !token.empty()) { + out.push_back(token); + } + token.clear(); + } else { + token += *p; + } + } + if (!ignoreEmpty || !token.empty()) { + out.push_back(token); + } +} + +void Util::replaceAll(string &s, const char *from, const char *to) { + ASSERT(from && *from); + ASSERT(to); + + string::size_type lenFrom = strlen(from); + string::size_type lenTo = strlen(to); + for (string::size_type pos = s.find(from); + pos != string::npos; + pos = s.find(from, pos + lenTo)) { + s.replace(pos, lenFrom, to); + } +} + +std::string Util::toLower(const std::string &s) { + unsigned int len = s.size(); + string ret; + if (len) { + ret.reserve(len); + for (unsigned int i = 0; i < len; i++) { + ret += tolower(s[i]); + } + } + return ret; +} + +std::string Util::toUpper(const std::string &s) { + unsigned int len = s.size(); + string ret; + ret.reserve(len); + for (unsigned int i = 0; i < len; i++) { + ret += toupper(s[i]); + } + return ret; +} + +std::string Util::getIdentifier(const std::string &fileName) { + string ret = "hphp_" + fileName; + replaceAll(ret, "/", "__"); + replaceAll(ret, ".", "__"); + replaceAll(ret, "-", "__"); + return ret; +} + +bool Util::mkdir(const std::string &path, int mode /* = 0777 */) { + if (path.empty()) { + return false; + } + size_t pos = path.rfind('/'); + if (pos != string::npos) { + // quick test whole path exists + if (access(path.substr(0, pos).c_str(), F_OK) >= 0) { + return true; + } + for (pos = path.find('/'); pos != string::npos; + pos = path.find('/', pos + 1)) { + string subpath = path.substr(0, pos); + if (subpath.empty()) continue; + if (access(subpath.c_str(), F_OK) < 0 && + ::mkdir(subpath.c_str(), mode) < 0) { + Logger::Error("unable to mkdir %s", subpath.c_str()); + return false; + } + } + } + return true; +} + +static bool same(const char *file1, const char *file2) { + FILE *f1 = fopen(file1, "r"); + if (f1 == NULL) { + Logger::Error("unable to read %s", file1); + return false; + } + FILE *f2 = fopen(file2, "r"); + if (f2 == NULL) { + fclose(f1); + Logger::Error("unable to read %s", file2); + return false; + } + + bool ret = false; + char buf1[8096]; + char buf2[sizeof(buf1)]; + int n1; + while ((n1 = fread(buf1, 1, sizeof(buf1), f1))) { + int toread = n1; + int pos = 0; + while (toread) { + int n2 = fread(buf2 + pos, 1, toread, f2); + if (n2 <= 0) { + goto exit_false; + } + toread -= n2; + pos += n2; + } + if (memcmp(buf1, buf2, n1) != 0) { + goto exit_false; + } + } + if (fread(buf2, 1, 1, f2) == 0) { + ret = true; + } + exit_false: + fclose(f2); + fclose(f1); + return ret; +} + +void Util::syncdir(const std::string &dest_, const std::string &src_, + bool keepSrc /* = false */) { + if (src_.empty() || dest_.empty()) return; + + string src = src_; + if (src[src.size() - 1] != '/') src += '/'; + string dest = dest_; + if (dest[dest.size() - 1] != '/') dest += '/'; + + DIR *ddest = opendir(dest.c_str()); + if (ddest == NULL) { + Logger::Error("syncdir: unable to open dest %s", dest.c_str()); + return; + } + + DIR *dsrc = opendir(src.c_str()); + if (dsrc == NULL) { + closedir(ddest); + Logger::Error("syncdir: unable to open src %s", src.c_str()); + return; + } + + dirent *e; + + set todelete; + while ((e = readdir(ddest))) { + if (strcmp(e->d_name, ".") == 0 || + strcmp(e->d_name, "..") == 0) { + continue; + } + string fsrc = src + e->d_name; + string fdest = dest + e->d_name; + + // delete files/directories that are only in dest + if (access(fsrc.c_str(), F_OK) < 0) { + size_t pos = fdest.rfind('.'); + if (pos != string::npos) { + string ext = fdest.substr(pos + 1); + // do not delete intermediate files + if (ext == "o" || ext == "d") { + continue; + } + } + todelete.insert(fdest); + continue; + } + + // delete mismatched types so to copy over new ones + struct stat sb1, sb2; + stat(fsrc.c_str(), &sb1); + stat(fdest.c_str(), &sb2); + if ((sb1.st_mode & S_IFMT) != (sb2.st_mode & S_IFMT)) { + todelete.insert(fdest.c_str()); + continue; + } + + // updates + if ((sb1.st_mode & S_IFMT) == S_IFDIR) { + syncdir(fdest, fsrc); + } else if (sb1.st_size != sb2.st_size || + !same(fsrc.c_str(), fdest.c_str())) { + todelete.insert(fdest); + } + } + + // delete the ones to delete + if (!todelete.empty()) { + for (set::const_iterator iter = todelete.begin(); + iter != todelete.end(); ++iter) { + Logger::Info("sync: deleting %s", iter->c_str()); + boost::filesystem::remove_all(*iter); + } + } + + // insert new ones + while ((e = readdir(dsrc))) { + string fdest = dest + e->d_name; + if (access(fdest.c_str(), F_OK) < 0) { + Logger::Info("sync: updating %s", fdest.c_str()); + if (keepSrc) { + ssystem((string("cp -R ") + src + e->d_name + " " + dest).c_str()); + } else { + rename((src + e->d_name).c_str(), (dest + e->d_name).c_str()); + } + } + } + + closedir(dsrc); + closedir(ddest); +} + +int Util::rename(const char *oldname, const char *newname) { + int ret = ::rename(oldname, newname); + if (ret == 0) return 0; + if (errno != EXDEV) return -1; + + int oldFd = open(oldname, O_RDONLY); + if (oldFd == -1) return -1; + int newFd = open(newname, O_WRONLY | O_CREAT | O_TRUNC, 0666); + if (newFd == -1) return -1; + char buf[8192]; + ssize_t bytes; + + while (1) { + bool err = false; + bytes = read(oldFd, buf, sizeof(buf)); + if (bytes == 0) break; + if (bytes == -1) { + err = true; + Logger::Error("read failed: %s", safe_strerror(errno).c_str()); + } else if (write(newFd, buf, bytes) == -1) { + err = true; + Logger::Error("write failed: %s", safe_strerror(errno).c_str()); + } + if (err) { + close(oldFd); + close(newFd); + return -1; + } + } + close(oldFd); + close(newFd); + unlink(oldname); + return 0; +} + +int Util::ssystem(const char* command) { + int ret = system(command); + if (ret == -1) { + Logger::Error("system(\"%s\"): %s", command, safe_strerror(errno).c_str()); + } else if (ret != 0) { + Logger::Error("command failed: \"%s\"", command); + } + return ret; +} + +std::string Util::canonicalize(const std::string &path) { + int len = path.size(); + if (len == 0) return path; + + vector paths; + string p = path; + Util::replaceAll(p, "\\/", "/"); + Util::split('/', p.c_str(), paths, true); + for (unsigned int i = 0; i < paths.size();) { + if (paths[i] == ".") { + paths.erase(paths.begin() + i); + } else if (paths[i] == "..") { + if (i < 1) { + return path; // path cannot be canonicalized + } + paths.erase(paths.begin() + i - 1, paths.begin() + i + 1); + i--; + } else { + i++; + } + } + + string ret; + if (path[0] == '/') ret = '/'; + for (unsigned int i = 0; i < paths.size(); i++) { + if (i > 0) ret += '/'; + ret += paths[i]; + } + if (path[len - 1] == '/' && ret != "/") { + ret += '/'; + } + return ret; +} + +std::string Util::safe_strerror(int errnum) { + char buf[1024]; + return strerror_r(errnum, buf, sizeof(buf)); +} + +bool Util::isPowerOfTwo(int value) { + return (value > 0 && (value & (value-1)) == 0); +} + +int Util::roundUpToPowerOfTwo(int value) { + ASSERT(value > 0); + --value; + for (unsigned int i = 1; i < sizeof(int)*8; i <<= 1) + value |= value >> i; + ++value; + return (value); +} + +/////////////////////////////////////////////////////////////////////////////// +} diff --git a/src/util/util.h b/src/util/util.h new file mode 100644 index 0000000000000..92d73836d3bb9 --- /dev/null +++ b/src/util/util.h @@ -0,0 +1,103 @@ +/* + +----------------------------------------------------------------------+ + | HipHop for PHP | + +----------------------------------------------------------------------+ + | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) | + +----------------------------------------------------------------------+ + | 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. | + +----------------------------------------------------------------------+ +*/ + +#ifndef __UTIL_H__ +#define __UTIL_H__ + +#include +#include +#include +#include + +/** + * Simple utility functions. + */ +namespace HPHP { namespace Util { +/////////////////////////////////////////////////////////////////////////////// + +/** + * Split a string into a list of tokens by character delimiter. + */ +void split(char delimiter, const char *s, std::vector &out, + bool ignoreEmpty = false); + +/** + * Replace all occurrences of "from" substring to "to" string. + */ +void replaceAll(std::string &s, const char *from, const char *to); + +/** + * Change an ASCII string to lower case. + */ +std::string toLower(const std::string &s); + +/** + * Change an ASCII string to upper case. + */ +std::string toUpper(const std::string &s); + +/** + * Convert a full pathname of a file to an identifier. + */ +std::string getIdentifier(const std::string &fileName); + +/** + * Make sure path exists. Same as "mkdir -p", but "a/b" will only make sure + * "a/" exists, treating "b" as a file name. + */ +bool mkdir(const std::string &path, int mode = 0777); + +/** + * Make dest directory look identical to src by copying files and directories, + * without copying identical files (so they keep the same timestamp as before). + */ +void syncdir(const std::string &dest, const std::string &src, + bool keepSrc = false); + +/** + * Like rename(2), but takes care of cross-filesystem rename. + */ +int rename(const char *oldname, const char *newname); + +/** + * Like system(3), but automatically print errors if execution fails. + */ +int ssystem(const char *command); + +/** + * Canonicalize path to remove "..", "." and "\/", etc.. + */ +std::string canonicalize(const std::string &path); + +/** + * Thread-safe strerror(). + */ +std::string safe_strerror(int errnum); + +/** + * Check if value is a power of two. + */ +bool isPowerOfTwo(int value); + +/** + * Round up value to the nearest power of two + */ +int roundUpToPowerOfTwo(int value); + +/////////////////////////////////////////////////////////////////////////////// +}} + +#endif // __UTIL_H__ diff --git a/src/util/ylmm/basic_buffer.hh b/src/util/ylmm/basic_buffer.hh new file mode 100644 index 0000000000000..bee5cddd1a62d --- /dev/null +++ b/src/util/ylmm/basic_buffer.hh @@ -0,0 +1,449 @@ +// $Id: basic_buffer.hh,v 1.13 2004/03/09 02:38:01 cholm Exp $ +// +// basic_buffer.hh +// Copyright (C) 2002 Christian Holm Christensen +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 +// of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +// 02111-1307 USA +// +#ifndef YLMM_basic_buffer +#define YLMM_basic_buffer +#ifndef __IOSTREAM__ +# include +#endif +#ifndef __FSTREAM__ +# include +#endif +#ifndef __STDEXCEPT__ +# include +#endif + +/** @file ylmm/basic_buffer.hh + @author Christian Holm Christensen + @date Mon Sep 30 00:08:22 2002 + @brief Declaration of scanner ABC. */ + +namespace ylmm +{ + /** @class basic_buffer basic_buffer.hh + @brief ABC for scanner buffers. + + This class is used by the ylmm::basic_scanner class to read + input. Internally it uses a std::istream to read from. User + code can sub-class this class if need the client code needs to + override things like line and column bookkeeping. However, if + the client code needs to read from something that isn't a file + or the standard input (for example via readline), then the + client code is much better off making a customised + std::streambuf layer - it really isn't as hard as the standard + leaves you thinking it may be, and it's really powerful. + @see @ref buffer_issues. + + To do a proper interface to @b Flex notion of buffers, there's + an extra data member, and some extra member functions. These + are @e not used by other kinds implmentations of @b Lex. + @ingroup lex + */ + class basic_buffer + { + private: + void* _extra; /** Extra data used by @b Flex */ + protected: + std::istream* _stream; /** Pointer to external input stream */ + bool _is_owner; /** Do we own this stream? */ + bool _interactive; /** Are we reading interactively or + not */ + int _line; /** The current line number */ + int _column; /** The current column number */ + bool _auto_increment; /** Should we automatically set + locations */ + char _last_read; /** Last read character*/ + + //@{ + /// @name Automatic updates + /** Do an automatic incrementation. + @param c the character read. */ + void increment_it(char c); + //@} + + //@{ + /// @name Actual reading + /** Read at most @p max characters into buffer @p buf. See also + the public input method. + @param buf The buffer to read into + @param max The maximum number of characters to read + @return The number of characters read */ + virtual int read_buffered(char* buf, int max); + /** Read at most @p max characters from input, or up to the first + occurence of delimiter. See also the public input method. + @param buf The buffer to read into + @param max The maximum number of characters to read + @param delim the delimiter to read to + @return The number of characters read */ + virtual int read_interactive(char* buf, int max, char delim); + //@} + + //@{ + /// @name Extra functions to help with @b Flex + /** An extra action to take when creating a new buffer. + @param size is the size of the buffer */ + void new_extra(int size); + /** An extra action to take when deallocating the buffer.*/ + void delete_extra(); + /** An extra action to take when flushing the buffer. */ + void flush_extra(); + /** An extra action to take when making interactive or buffered. + @param inter Whether it's interactive (ignored) */ + void interactive_extra(bool inter); + /** An extra action to take when setting begning-of-line flag + @param bol ignored */ + void at_bol_extra(bool bol); + //@} + public: + /** Make a new state. + @param stream Stream to read from. This could be a + @c std::istream like @c std::cin, or a @c std::stringstream + refering to an external string buffer. If argument is null (0) + then the stream is set to @c std::cin and interactive reads + are enabled. + @param inter Is this stream interactive or not. + @param autoinc Should we do automatic location tracking? That + is should we set the _line and _column number automatically by + parsing the read stream, or should we let the client code do + that job for us. */ + basic_buffer(std::istream& stream, bool inter=true, bool autoinc=false); + /** Make a new state. + @param filename Name of a file to read from. If this is `-' + then std::cin is opened for input. If file can not be found, + then this throws a std::runtime_error. + @param inter Is this stream interactive or not. + @param autoinc Should we do automatic location tracking? That + is should we set the _line and _column number automatically by + parsing the read stream, or should we let the client code do + that job for us. + @exception std::runtime_error Thrown if named file cannot be + found. */ + basic_buffer(const std::string& filename, + bool inter=false, bool autoinc=true); + /** Free this buffer. + If this buffer is the @e owner of the used input stream, that + is, if this buffer opened it because it was constructed using + the string constructor, then the underlying stream is closed + and deleted here. Otherwise, it's up to the client code to + free the memory associated with the stream, if needed. */ + virtual ~basic_buffer(); + + //@{ + /// @name Stream + /** Get the input stream + @return the input stream */ + std::istream* stream() { return _stream; } + //@} + + //@{ + /// @name position handling + /** Get the line number + @return the line number */ + int line() const { return _line; } + /** Get the column number + @return the column number */ + int column() const { return _column; } + /** Increment line and possibly column + @param l number to add to current line number + @param c number to add to current column number */ + virtual void increment_line(int l, int c=0); + /** Increment the column + @param c number to add to current column number */ + virtual void increment_column(int c) { _column += c; } + //@} + + //@{ + /// @name Read handling + /** Flush the buffer */ + void flush() { flush_extra(); } + /** Read one character from input + Note, when EOF is encountered, 0 (and not EOF) is returned. + @return the character read */ + virtual int read(); + /** Read at most @p max characters into buffer @p buf. + @param buf Buffer of at least size @p max to read into. + @param max Maximum number of characters to read from input. + @return The number of characters read. Returns -1 in case of + errors. */ + virtual int read(char* buf, int max); + /** Put one character back into the stream. + @param c character to put back. */ + virtual void putback(int c); + //@} + + //@{ + /// @name Miscellanious + /** Are we doing automatic increments? + @return true if auto incrementing */ + bool auto_increment() const { return _auto_increment; } + /** Set wether we should do automatic increments. + @param ai If true, auto increment, otherwise don't + @return true if auto incrementing */ + bool auto_increment(bool ai) { return _auto_increment = ai; } + /** Test if we're at the start of a line + @return true if last read characer was a newline */ + bool at_bol() const { return _last_read == '\n'; } + /** Set wether we're at the start of a line + @param bol set the last read character to be a newline + @return true if last read characer was a newline */ + bool at_bol(bool bol); + /** Check if buffer is interactive + @return true if we're reading interactively */ + bool interactive() const { return _interactive; } + /** Set whether buffer is interactive + @param inter if true, read inteactively + @return true if we're reading interactively */ + bool interactive(bool inter); + /** Called when this buffer is restored as current buffer. + @return true if this is the current buffer after activation */ + bool activate(); + //@} + }; + + //__________________________________________________________________ + inline + basic_buffer::basic_buffer(std::istream& stream, bool inter, + bool autoinc) + { + _interactive = inter; + _stream = (!stream ? &std::cin : &stream); + _line = 0; + _column = 0; + _is_owner = false; + _auto_increment = autoinc; + _last_read = '\n'; + if (_stream == &std::cin) _interactive = true; + new_extra(0); + } + //__________________________________________________________________ + inline + basic_buffer::basic_buffer(const std::string& filename, bool inter, + bool autoinc) + { + _interactive = inter; + if (filename.empty()) throw std::runtime_error("no filename given"); + if (!filename.compare("-")) { + _stream = &std::cin; + _is_owner = false; + } + else { + _stream = new std::ifstream(filename.data()); + if (!(*_stream) || _stream->bad()) { + throw std::runtime_error("failed to open file"); + } + _is_owner = true; + } + _line = 0; + _column = 0; + _auto_increment = autoinc; + _last_read = '\n'; + if (_stream == &std::cin) _interactive = true; + new_extra(0); + } + + //__________________________________________________________________ + inline + basic_buffer::~basic_buffer() + { + delete_extra(); + if (_is_owner && _stream) { + std::ifstream* is; + if ((is = dynamic_cast(_stream))) is->close(); + delete _stream; + } + } + + //__________________________________________________________________ + inline void basic_buffer::increment_it(char c) + { + switch(c) { + case '\n': _line++; _column = 0; break; + default: _column++; + } + } + + //__________________________________________________________________ + inline int basic_buffer::read_buffered(char* buf, int max) + { + if (!_stream || _stream->eof()) return 0; + _stream->read(buf, max); + if (_stream->bad()) return 0; + int c = _stream->gcount(); + if (c == 0) return 0; + _last_read = buf[c-1]; + if (_auto_increment) { + for (int i = 0; i < c; i++) increment_it(buf[i]); } + return c; + } + + //__________________________________________________________________ + inline int basic_buffer::read_interactive(char* buf, int max, char delim) + { + if (max <= 0 || !_stream || _stream->eof()) return 0; + int i = 0; + do { + _last_read = _stream->get(); + if (_auto_increment) increment_it(_last_read); + buf[i++] = _last_read; + if (_stream->bad()) return -1; + } while(i < max && _last_read != EOF && _last_read != delim); + return i; + } + + //__________________________________________________________________ + inline void basic_buffer::increment_line(int l, int c) + { + if (_auto_increment) return; + _line = l; + _column = c; + } + + //__________________________________________________________________ + inline bool basic_buffer::at_bol(bool bol) + { + at_bol_extra(bol); + _last_read = bol ? '\n' : '\0'; return bol; + } + + //__________________________________________________________________ + inline bool basic_buffer::interactive(bool inter) + { + interactive_extra(inter); + return _interactive = inter; + } + + //__________________________________________________________________ + inline int basic_buffer::read() + { + _last_read = _stream->get(); + if (_stream->eof()) return 0; + if (_stream->bad()) return -1; + if (_auto_increment) increment_it(_last_read); + return _last_read; + } + + //__________________________________________________________________ + inline int basic_buffer::read(char* buf, int max) + { + if (_interactive) return read_interactive(buf, max, '\n'); + else return read_buffered(buf, max); + } + + //__________________________________________________________________ + inline void basic_buffer::putback(int c) + { + _stream->putback(char(c)); + if (!_stream->bad() && _auto_increment) _column--; + } +} + +//__________________________________________________________________ +/** Print a std::basic_buffer on an output stream + @param o output stream to write to + @param b the ylmm::basic_buffer to write out + @return @a o */ +inline std::ostream& +operator<<(std::ostream& o, const ylmm::basic_buffer& b) +{ + return o << b.line() << "," << b.column(); +} + +#if defined(FLEX_SCANNER) && !defined(YLMM_flex_buffer_impl) +#define YLMM_flex_buffer_impl + +//__________________________________________________________________ +/** Create a new Flex buffer. + @param file The file to associate with the buffer. Can be NULL. + @param size The size of the buffer + @return A newly allocated buffer. */ +extern YY_BUFFER_STATE yy_create_buffer(FILE *file, int size); + +inline void +ylmm::basic_buffer::new_extra(int size) +{ + // If size is not given (0 or less), then use the default. + if (size < 0) { _extra = 0; return; } + if (size == 0) size = YY_BUF_SIZE; + _extra = static_cast(yy_create_buffer(0, size)); +} + +//__________________________________________________________________ +/** De-allocate a Flex buffer. + @param b The buffer to de-allocate. */ +extern void yy_delete_buffer(YY_BUFFER_STATE b); + +inline void +ylmm::basic_buffer::delete_extra() +{ + yy_delete_buffer(static_cast(_extra)); +} + +//__________________________________________________________________ +/** Switch to another Flex buffer + @param b The buffer to switch to. */ +extern void yy_switch_to_buffer(YY_BUFFER_STATE b); + +inline bool +ylmm::basic_buffer::activate() +{ + yy_switch_to_buffer(static_cast(_extra)); + return static_cast(_extra) == YY_CURRENT_BUFFER; +} + +//__________________________________________________________________ +inline void +ylmm::basic_buffer::interactive_extra(bool inter) +{ + (static_cast(_extra))->yy_is_interactive = inter ? 1 : 0; +} + +//__________________________________________________________________ +inline void +ylmm::basic_buffer::at_bol_extra(bool inter) +{ + (static_cast(_extra))->yy_at_bol = inter ? 1 : 0; +} + +//__________________________________________________________________ +/** Flush a buffer. + @param b The buffer to flush. */ +extern void yy_flush_buffer(YY_BUFFER_STATE b); + +inline void +ylmm::basic_buffer::flush_extra() +{ + yy_flush_buffer(static_cast(_extra)); +} +#else + +//__________________________________________________________________ +inline void ylmm::basic_buffer::new_extra(int size) {} +inline void ylmm::basic_buffer::delete_extra() {} +inline void ylmm::basic_buffer::flush_extra() {} +inline void ylmm::basic_buffer::interactive_extra(bool) {} +inline void ylmm::basic_buffer::at_bol_extra(bool inter) {} +inline bool ylmm::basic_buffer::activate() { return true; } + +#endif +#endif + + + + diff --git a/src/util/ylmm/basic_location.hh b/src/util/ylmm/basic_location.hh new file mode 100644 index 0000000000000..50575ff9a2093 --- /dev/null +++ b/src/util/ylmm/basic_location.hh @@ -0,0 +1,197 @@ +// +// $Id: basic_location.hh,v 1.6 2004/03/03 12:56:18 cholm Exp $ +// +// basic_location.hh +// Copyright (C) 2002 Christian Holm Christensen +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 +// of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +// 02111-1307 USA +// +#ifndef YLMM_basic_location +#define YLMM_basic_location +#ifndef __IOSTREAM__ +# include +#endif +/** @file ylmm/basic_location.hh + @author Christian Holm Christensen + @date Mon Sep 30 00:08:22 2002 + @brief Declaration of parser basic_location class. */ + +namespace ylmm +{ + /** @class basic_location basic_location.hh + @brief Class to handle basic location inforamtion. + + This class embeds information on where in a parse stream the + parser encountered what tokens. The class defines a region + starting at a line number, column number pair, extending until + a line number, column number pair. If users want to, they can + subclass this class to allow it to provide additional + information. + @ingroup yacc + */ + class basic_location + { + protected: + int _first_line; /** The first line of the current + region */ + int _first_column; /** The first column of the current + region */ + int _last_line; /** The last line of the current + region */ + int _last_column; /** The last column of the current + region */ + public: + /** Make a new basic_location. + Set the region to be at the arguments. + @param l1 new first line + @param c1 new first column + @param l2 new last line + @param c2 new last column. */ + basic_location(int l1=0, int c1=0, int l2=0, int c2=0); + /** Constructor. Make a new basic_location as a region of two + other locations. + @param f The position of the first line/column, taken from the + first line/column of @a f + @param l The position of the last line/column, taken from the + last line/column of @a l */ + basic_location(const basic_location& f, const basic_location& l) + { + region(f, l); + } + /** Make a copy of a basic_location. + @param l the basic_location to copy. */ + basic_location(const basic_location& l) { copy(l); } + /** Do-nothing dtor. */ + virtual ~basic_location() {} + + //@{ + /// @name Copying and the like + /** Assign a basic_location from another basic_location. + @param l basic_location to copy. + @return this object */ + virtual basic_location& operator=(const basic_location& l) { + copy(l); return *this; } + /** Make a copy of a basic_location. + @param l the basic_location to copy. */ + virtual void copy(const basic_location& l); + /** Make a region from two basic_locations. + @param l1 the beginning of the region. + @param l2 the end of the region. */ + virtual void region(const basic_location& l1, const basic_location& l2); + /// Set start of region from anoher basic_location. + void first(const basic_location& l); + /// Set end of region from anoher basic_location. + void last(const basic_location& l); + //@} + + //@{ + /// @name Get the fields + /** Get the first line of the region. + @return the first line of the region. */ + int first_line() const { return _first_line; } + /** Get the first column of the region. + @return the first column of the region. */ + int first_column() const { return _first_column; } + /** Get the last line of the region. + @return the last line of the region. */ + int last_line() const { return _last_line; } + /** Get the last column of the region. + @return the last column of the region. */ + int last_column() const { return _last_column; } + //@} + + //@{ + /// Get the fields + /** Set start of region. */ + void first(int line, int column); + /** Set first line of the region. */ + int first_line(int first_line) { return _first_line =first_line; } + /** Set first column of the region. */ + int first_column(int first_column) { return _first_column =first_column; } + /** Set end of region. */ + void last(int line, int column); + /** Set last line of the region. */ + int last_line(int last_line) { return _last_line = last_line; } + /** Set last column of the region. */ + int last_column(int last_column) { return _last_column = last_column; } + //@} + }; + + //__________________________________________________________________ + inline basic_location::basic_location(int first_line, int first_column, + int last_line, int last_column) + { + first(first_line, first_column); + last(last_line, last_column); + } + + //__________________________________________________________________ + inline void basic_location::copy(const basic_location& l) + { + _first_line = l._first_line; _first_column = l._first_column; + _last_line = l._last_line; _last_column = l._last_column; + } + + //__________________________________________________________________ + inline void basic_location::region(const basic_location& l1, + const basic_location& l2) + { + first(l1); last(l2); + } + + //__________________________________________________________________ + inline void basic_location::first(int line, int column) + { + _first_line = line; _first_column = column; + } + + //__________________________________________________________________ + inline void basic_location::first(const basic_location& l) + { + first(l._first_line, l._first_column); + } + + //__________________________________________________________________ + inline void basic_location::last(int line, int column) + { + _last_line = line; _last_column = column; + } + + //__________________________________________________________________ + inline void basic_location::last(const basic_location& l) + { + last(l._last_line, l._last_column); + } +} + +//____________________________________________________________________ +/** Output a ylmm::basic_location object to a stream + @param o Output stream + @param l the ylmm::basic_location to show + @return @a o */ +inline std::ostream& +operator<<(std::ostream& o, const ylmm::basic_location& l) +{ + return o << l.first_line() << "," << l.first_column() + << ":" << l.last_line() << "," << l.last_column(); +} + + +#endif +//____________________________________________________________________ +// +// EOF +// diff --git a/src/util/ylmm/basic_messenger.hh b/src/util/ylmm/basic_messenger.hh new file mode 100644 index 0000000000000..212e1721790dc --- /dev/null +++ b/src/util/ylmm/basic_messenger.hh @@ -0,0 +1,242 @@ +// +// $Id: basic_messenger.hh,v 1.4 2003/11/18 11:27:31 cholm Exp $ +// +// ylmm::basic_messenger +// Copyright (C) 2002 Christian Holm Christensen +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 +// of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +// 02111-1307 USA +// +#ifndef YLMM_basic_messenger +#define YLMM_basic_messenger +#ifndef __IOSTREAM__ +#include +#endif +#ifndef __CSTDARG__ +#include +#endif +#ifndef __CSTDIO__ +#include +#endif + +/** @file ylmm/basic_messenger.hh + @author Christian Holm + @date Sat Jan 18 03:37:32 2003 + @brief Base class for I/O handling */ + +/** @defgroup common Common classes */ + +namespace ylmm +{ + //================================================================ + /** @class basic_lock basic_messenger.hh + @brief Single threaded locking object. + + Used by ylmm::basic_messenger to insure thread safe static + creation of the default output handler. This implementation does + nothing. In a real multi-threaded application, the user should + pass a proper mutex locking class, defining at a minimum the + lock and unlock member functions. + @see @ref thread_issues + @ingroup common + */ + class basic_lock + { + public: + /** Aquire this lock. This implemtation does nothing. */ + void lock() {} + /** Release this lock. This implemtation does nothing. */ + void unlock() {} + }; + + //================================================================ + /** @class basic_messenger basic_messenger.hh + @brief Base class for output handling. + @see @ref messenger_doc + @param lock The type of thread syncronisation locks used in the + application. Per default a single threaded locking mechanism + (that is - no locks) is used. The application should pass the + appropiate type here to make the use of this class thread safe. + @ingroup common + */ + template + class basic_messenger + { + private: + static basic_messenger* _default_handler; /** The default handler + */ + static Lock _lock; /** Lock used to insure safe thread + creation of the default handler */ + protected: + std::ostream* _err_stream; /** The stream to write errors to */ + std::ostream* _msg_stream; /** The stream to write messages to */ + /// + /** The real print method + @param o Output stream + @param format @c printf like format string + @param ap variadic arugment list */ + void print(std::ostream* o, const char* format, va_list ap); + public: + /** Constructor. */ + basic_messenger(std::ostream& msg=std::cout, + std::ostream& err=std::cerr); + /** Destructor. */ + virtual ~basic_messenger() {} + + //@{ + /// @name Handling streams + /** Set stream to write errors to. + @param err_str The stream to write to + @return @a err_str */ + std::ostream& error_stream(std::ostream& err_str); + /** Get the error stream + @return the error stream */ + std::ostream& error_stream() { return *_err_stream; } + /** Set stream to write messages to. + @param msg_str The stream to write to + @return @a msg_str */ + std::ostream& message_stream(std::ostream& msg_str); + /** Get the messages stream + @return the messages stream */ + std::ostream& message_stream() { return *_msg_stream; } + //@} + + //@{ + /// @name Normal messages + /** Print a message on the message stream. + @param format The @c printf like format string */ + virtual void message(const char* format, ...); + /** Print a message on the message stream. + @param format The @c printf like format string + @param ap The variadic arguments. */ + virtual void message(const char* format, va_list ap); + //@} + + //@{ + /// @name Error messages + /** Print a error on the error stream. + @param format The @c printf like format string */ + virtual void error(const char* format, ...); + /** Print a error on the error stream. + @param format The @c printf like format string + @param ap The variadic arguments. */ + virtual void error(const char* format, va_list ap); + //@} + + /** Get the default handler. + @return the default handler. */ + static basic_messenger* default_handler(); + }; + //__________________________________________________________________ + template + inline + basic_messenger::basic_messenger(std::ostream& msg_str, + std::ostream& err_str) + { + _msg_stream = 0; + _err_stream = 0; + message_stream(msg_str); + error_stream(err_str); + } + //__________________________________________________________________ + template + inline std::ostream& + basic_messenger::error_stream(std::ostream& s) + { + _err_stream = &s; + return *_err_stream; + } + //__________________________________________________________________ + template + inline std::ostream& + basic_messenger::message_stream(std::ostream& s) + { + _msg_stream = &s; + return *_msg_stream; + } + //__________________________________________________________________ + template + inline void + basic_messenger::print(std::ostream* o, const char* f, va_list ap) + { + static char buf[1024]; + if (!o || o->bad()) return; +#ifdef HAVE_VSNPRINTF + vsnprintf(buf, 1024, f, ap); +#else + vsprintf(buf, f, ap); +#endif + *o << buf << std::flush; + } + //__________________________________________________________________ + template + inline void + basic_messenger::message(const char* msg, ...) + { + va_list ap; + va_start(ap, msg); + message(msg, ap); + va_end(ap); + } + //__________________________________________________________________ + template + inline void + basic_messenger::message(const char* msg, va_list ap) + { + print(_msg_stream, msg, ap); + } + //__________________________________________________________________ + template + inline void + basic_messenger::error(const char* err, ...) + { + va_list ap; + va_start(ap, err); + error(err, ap); + va_end(ap); + } + //__________________________________________________________________ + template + inline void + basic_messenger::error(const char* err, va_list ap) + { + print(_err_stream, err, ap); + } + //__________________________________________________________________ + template + inline basic_messenger* + basic_messenger::default_handler() + { + // Double checking locking idom to avoid race conditions. + if (!_default_handler) { + _lock.lock(); + if (!_default_handler) + _default_handler = new basic_messenger(std::cout,std::cerr); + _lock.unlock(); + } + return _default_handler; + } + //__________________________________________________________________ + template basic_messenger* + basic_messenger::_default_handler = 0; + //__________________________________________________________________ + template L basic_messenger::_lock; +} + +#endif +//____________________________________________________________________ +// +// EOF +// diff --git a/src/util/ylmm/basic_parser.hh b/src/util/ylmm/basic_parser.hh new file mode 100644 index 0000000000000..384f3952223ec --- /dev/null +++ b/src/util/ylmm/basic_parser.hh @@ -0,0 +1,335 @@ +// +// $Id: basic_parser.hh,v 1.15 2005/03/09 17:19:43 cholm Exp $ +// +// basic_parser.hh +// Copyright (C) 2002 Christian Holm Christensen +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 +// of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +// 02111-1307 USA +// +#ifndef YLMM_basic_parser +#define YLMM_basic_parser +#ifndef YLMM_basic_messenger +# include +#endif +#ifndef YLMM_basic_location +# include +#endif + +/** @file basic_parser.hh + @author Christian Holm Christensen + @date Mon Sep 30 00:08:22 2002 + @brief Declaration of parser ABC. */ + +/** Namespace for all parser and scanner classes. */ +namespace ylmm +{ + //===================================================================== + /** @class parser_base basic_parser.hh + @brief ABC for parser classes. + + This defines the common interface for parser classes, that + doesn't depend on the semantic and location type. It's + interface can safely be used in the application or via some + library. + @param lock The type of thread syncronisation locks used in the + application. Per default a single threaded locking mechanism + (that is - no locks) is used. The application should pass the + appropiate type here to make the use of this class thread safe. + @ingroup yacc + */ + template + class parser_base + { + public: + /** Type of thread locks */ + typedef Lock lock_type; + protected: + basic_messenger* _messenger; /** The output handler */ + /** Do-nothing CTOR. */ + parser_base(); + /** Do-nothing DTOR. */ + virtual ~parser_base() {} + public: + //@{ + /// @name Abstract interface + /** Get whether the parser is tracing or not. + This member function is implmented via yaccmm.hh. + @return true if we're tracing the parse */ + virtual bool tracing() const = 0; + /** Set whether the parser is tracing or not. + This member function is implmented via yaccmm.hh. + @param t if true, trace the parse + @return true if we're tracing the parse */ + virtual bool tracing(bool t) = 0; + /** The main function member. + @param arg Optional parameter + @return 0 on success, non-zero on failure */ + virtual int parse(void* arg=0) = 0; + /** Input member function. + @param arg optinal argument. + @return next token ID number */ + virtual int scan(void* arg=0) = 0; + //@} + + //@{ + /// @name Output handler + /** Get the output handler + @return The output handler used by this parser. */ + virtual basic_messenger& messenger() const; + /** Set and get the output handler + @param o The output handler to use. + @return The output handler used by this parser. */ + virtual + basic_messenger& messenger(basic_messenger& o); + //@} + + //@{ + /// @name message handling + /** Called on errors. + When the generated parser detects a parse error, this member + function is called. Per default, it simply outputs the error + message to std::cerr, but user code can override this to do + fallbacks, etc. + @param msg Is the message from the parser. */ + virtual void fatal(const char* msg); + /** Error printing - service function. + When the generated parser wants to output error information, + this is the member function that will be invoked. Per default + it outputs the message to standard error. + @param message The message to print */ + virtual void error(const char* message, ...); + /** Message printing - service function. When the generated + parser wants to output various information, this is the member + function that will be invoked. Per default it outputs the + message to standard output. Also, when the generated parser + wants to output trace information, this is the member function + that will be invoked. Per default it outputs the message to + standard error. @param text The message to print */ + virtual void message(const char* text, ...); + //@} + }; + //__________________________________________________________________ + template + inline + parser_base::parser_base() + { + _messenger = basic_messenger::default_handler(); + } + //__________________________________________________________________ + template + inline basic_messenger& parser_base::messenger() const + { + return *_messenger; + } + + //__________________________________________________________________ + template + inline basic_messenger& + parser_base::messenger(basic_messenger& output) + { + _messenger = &output; + return *_messenger; + } + + //__________________________________________________________________ + template + inline void parser_base::error(const char* message, ...) + { + if (!_messenger) return; + va_list ap; + va_start(ap, message); + _messenger->error(message, ap); + va_end(ap); + } + //__________________________________________________________________ + template + inline void parser_base::message(const char* message, ...) + { + if (!_messenger) return; + va_list ap; + va_start(ap, message); + _messenger->message(message, ap); + va_end(ap); + } + //__________________________________________________________________ + template + inline void parser_base::fatal(const char* message) + { + if (!_messenger) return; + _messenger->error(message); + } + + //===================================================================== + /** @class basic_parser basic_parser.hh + @brief Basic parser implementation. + + This templated class implements a parser, or rather, a specific + instantation of this tempalte implmentes it. To use it, define + the the processor macro @c YLMM_PARSER_CLASS to a specific + instance of this template, or a sub-class ofa specific instance + in your @b Yacc input file to. Note that the third argument, + @p id can be used to disambiqutate two parsers with the same + @p Token, @p Location pair. + See also @ref parser_doc. + @param Token the type of the tokens used in the grammar. + @param Location the location type used, if applicable for the + backend parser generator (Normal @b Yacc does not support that, + but @b Bison does). + @param id is an integer that uniquely identifies the class. + @param lock The type of thread syncronisation locks used in the + application. Per default a single threaded locking mechanism + (that is - no locks) is used. The application should pass the + appropiate type here to make the use of this class thread safe. + @ingroup yacc + */ + template + class basic_parser : public parser_base + { + public: + /// Type of tokens + typedef Token token_type; + /// Type of locationss + typedef Location location_type; + /// The Id of the parser class + enum { parser_id = id }; + protected: + typedef parser_base base_type; + token_type* _token; /** Address of the current token */ + location_type* _location; /** The current location. */ + public: + /** Do-nothing CTOR. */ + basic_parser() : _token(0), _location(0) {} + /** Do-nothing DTOR. */ + virtual ~basic_parser() { } + + //@{ + /// @name Debug handling + /** Get whether the parser is tracing or not. + This member function is implmented via yaccmm.hh. + @return true if we're tracing the parse */ + virtual bool tracing() const; + /** Set whether the parser is tracing or not. + This member function is implmented via yaccmm.hh. + @param t if true, trace the parse + @return true if we're tracing the parse */ + virtual bool tracing(bool t); + //@} + + //@{ + /// @name Location information + /** Test if we need location information. + @return true if we need location information */ + virtual bool need_where() const { return _location != 0; } + /** Get the location of next token to be parsed. + @return The location of next token to be parsed. */ + virtual location_type& where() { return *_location; } + /** Set the location of next token to be parsed. + Must be invoked from the the scanner. + @param loc The location of the next token to be parsed. + @return The location of next token to be parsed. */ + virtual location_type& where(location_type& loc); + /** Set the address of the location information + @param loc the address of the location information */ + void where_addr(location_type* loc) { _location = loc; } + //@} + + //@{ + /// @name Token handling + /** Get the next token to be parsed. + @return The next token to be parsed. */ + virtual token_type& token() const { return *_token; } + /** Set the next token to be parsed. + Must be invoked from the the scanner. + @param token The next token to be parsed. + @return The next token to be parsed. */ + virtual token_type& token(token_type& token); + /** Set the address of next token to be parsed. + @param token The next address of the token to be parsed. */ + void token_addr(token_type* token) { _token = token; } + //@} + + //@{ + /// @name Scanning and parsing + /** The main function member. + This member function starts the parser. It should call the C + function generated by Yacc. This member function is + implmented via yaccmm.hh. + @param arg user defined data + @return return value of yyparse. */ + virtual int parse(void* arg=0); + /** Input member function. + When the parser wants more input, it calls this member + function to get one (or more) token(s). The member function + must return the token id value, as well as set the current + token (using the token member function) and possibly + location information (using the location member + function). One way of implementing this, is to use a @b Lex + generated scanner with the ylmm::basic_scanner class, and call + the member function ylmm::basic_scanner::next, passing it the + proper arguments. + @param arg A pointer to user defined data. + @return token ID number. */ + virtual int scan(void* arg=0) = 0; + //@} + + //@{ + /// @name Message handling + /** Print info on currently passed token. + When tracing is enabled, then this member function is + invoked when a message about a token is to be output. Per + default it writes the lookahead number and the address of the + token. + @param lookahead The current lookahead. + @param token The current token. */ + virtual void trace(int lookahead, const token_type& token); + //@} + }; + //__________________________________________________________________ + template + inline L& + basic_parser::where(location_type& loc) + { + *_location = loc; + return *_location; + } + //__________________________________________________________________ + template + inline T& + basic_parser::token(token_type& token) + { + *_token = token; + return *_token; + } + //__________________________________________________________________ + template + inline void + basic_parser::trace(int lookahead, + const token_type& token) + { + if (!base_type::_messenger) return; + base_type::_messenger->message_stream() << " " << lookahead + << " [" << token << "]" + << std::flush; + } +} + + +#endif +//____________________________________________________________________ +// +// EOF +// diff --git a/src/util/ylmm/basic_scanner.hh b/src/util/ylmm/basic_scanner.hh new file mode 100644 index 0000000000000..4ac721662ee52 --- /dev/null +++ b/src/util/ylmm/basic_scanner.hh @@ -0,0 +1,507 @@ +// +// $Id: basic_scanner.hh,v 1.14 2004/10/30 10:52:50 cholm Exp $ +// +// basic_scanner.hh +// Copyright (C) 2002 Christian Holm Christensen +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 +// of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +// 02111-1307 USA +// +#ifndef YLMM_basic_scanner +#define YLMM_basic_scanner +#ifndef __VECTOR__ +# include +#endif +#ifndef YLMM_basic_messenger +# include +#endif +#ifndef YLMM_basic_buffer +# include +#endif +#ifndef YLMM_basic_location +# include +#endif +#ifdef output +# undef output +#endif +#ifdef input +# undef input +#endif +#ifdef unput +# undef unput +#endif + +/** @file basic_scanner.hh + @author Christian Holm Christensen + @date Mon Sep 30 00:08:22 2002 + @brief Declaration of scanner ABC. */ + +namespace ylmm +{ + //===================================================================== + /** @class scanner_base basic_scanner.hh + @brief ABC for scanner classes. + + This defines the common interface for scanner classes, that + doesn't depend on the semantic and location type. It's + interface can safely be used in the application or via some + library. + @param lock The type of thread syncronisation locks used in the + application. Per default a single threaded locking mechanism + (that is - no locks) is used. The application should pass the + appropiate type here to make the use of this class thread safe. + @ingroup lex + */ + template + class scanner_base + { + public: + /// Locking type + typedef Lock lock_type; + /// Stack type of buffers. + typedef std::vector buffer_stack; + protected: + basic_messenger* _messenger; /** The output handler */ + buffer_stack _buffers; /** Stack (LIFO) of scanner buffers */ + basic_buffer* _current; /** Current buffer we're reading + from. */ + /** Constructor. + @param stream Stream to parse from. A buffer is created to + hold this stream. */ + scanner_base(std::istream& stream); + /** Constructor. + @param buf Buffer to parse from. If null, then a buffer + reading from std::cin is set up and used. */ + scanner_base(basic_buffer* buf); + /** Destructor. + This free's the stack of buffer states. If you need the + buffers, you better copy them out before deleting the + scanner. */ + virtual ~scanner_base(); + public: + //@{ + /// @name Abstract interface + /** Get the start condition + @return the start condition */ + virtual int start_condition() const = 0; + /** Get type of parsed token + @return type of parsed token */ + virtual int type() const = 0; + /** Get the text + @return the text read */ + virtual const char* text() const = 0; + /** Get the length of the text. + @return the length of the text read */ + virtual int length() const = 0; + /** Start scanning + @return read token ID */ + virtual int scan() = 0; + //@} + + //@{ + /// @name Input handling + /** Read a single character from the input. + @return character read. */ + int read(); + /** Get input from current buffer. + @param buf Buffer to read into. + @param result number of characters read. + @param max maximum number of characters to read. + @return number of charaters read */ + int read(char* buf, int& result, int max); + /** Put one character back on input stream. + @param c character to put back */ + void putback(int c); + //@} + + //@{ + /// @name Buffer handling + /** When reacing end of file, this member function is called. + @return 0 if there are no more buffers to read from, 1 + otherwise. */ + virtual int wrap(); + /** Get the current buffer. + @return current buffer. */ + basic_buffer* current_buffer() const { return _current; } + /** Switch to a new scanner buffer. + @param buf The new buffer. If 0, old is restored. */ + void switch_buffer(basic_buffer* buf); + /** Get the list of buffers. + Be careful manipulating this stack. If you add a buffer to + the end of it, you may get yourself into a lot of trouble. + This class mainly exposes this member function so that one may + copy the buffer stack to some other location, if needed. + @return the buffer stack */ + const buffer_stack& buffers() const { return _buffers; } + //@} + + //@{ + /// @name output handler + /** Get the output handler + @return The output handler used by this parser. */ + virtual const basic_messenger& messenger() const; + /** Set and get the output handler + @param o The output handler to use. + @return The output handler used by this parser. */ + virtual basic_messenger& messenger(basic_messenger& o); + //@} + + //@{ + /// @name Output handling + /** Signal a fatal error. + @param msg Error message. */ + virtual void fatal(const char* msg); + /** Echo text to output + @param text The text to print. + @param length The number of chars (including terminator) in + text. */ + virtual void echo(const char* text, int length); + /** Echo character to output + @param c The character to print */ + virtual void echo(const char c); + /** Service function for printing messages on message stream. + @param msg the message to print, possibly with @c printf + like field descriptors. */ + void message(const char* msg, ...); + /** Service function for printing messages on error stream. + @param msg the message to print, possibly with @c printf + like field descriptors. */ + void error(const char* msg, ...); + //@} + }; + //__________________________________________________________________ + template + inline scanner_base::scanner_base(basic_buffer* buf) + { + _messenger = basic_messenger::default_handler(); + _current = 0; + if (!buf) buf = new basic_buffer(std::cin, true); + switch_buffer(buf); + } + //__________________________________________________________________ + template + inline scanner_base::scanner_base(std::istream& stream) + { + _messenger = basic_messenger::default_handler(); + _current = 0; + basic_buffer* buf = new basic_buffer(stream, true); + switch_buffer(buf); + } + //__________________________________________________________________ + template + inline scanner_base::~scanner_base() + { + for (buffer_stack::iterator i = _buffers.begin(); + i != _buffers.end(); i++) + delete (*i); + } + + //__________________________________________________________________ + template + inline int scanner_base::wrap() + { + // Try to restore an old buffer, if it exists. + switch_buffer(0); + return _current ? 0 : 1; + } + //__________________________________________________________________ + template + inline int scanner_base::read(char* text, int& result, int max) + { + result = 0; + if (!_current) + fatal("No buffer to read from"); + else + result = _current->read(text, max); + return result; + } + //__________________________________________________________________ + template + inline int scanner_base::read() + { + if (!_current) return 0; + char c = _current->read(); + return c; + } + //__________________________________________________________________ + template + inline void scanner_base::putback(int c) + { + if (!_current) + fatal("No buffer to put back to"); + else + _current->putback(char(c)); + } + //__________________________________________________________________ + template + inline void scanner_base::switch_buffer(basic_buffer* buf) + { + // If 0 was passed, try to restore old buffer. + if (!buf) { + if (!_current) { + fatal("no current buffer"); + return; + } + // Check the stack for more buffers + if (_buffers.size() == 0) { + delete _current; + _current = 0; + // If there are no more, then return and EOF + return; + } + + // Pop the top element of the stack + buf = _buffers.back(); + _buffers.pop_back(); + + // and then switch to it + if (!buf->activate()) { + fatal("Failed to switch back to old buffer"); + return; + } + // Free the memory associated with the last buffer + delete _current; + _current = buf; + } + // Otherwise, we've got a new buffer to read from + else { + // First we ativate the new buffer ... + if (!buf->activate()) { + /// If that fails, we continue with the old one. + fatal("Failed to switch to new buffer"); + return; + } + // Otherwise, if we have a buffer. we push it on the stack ... + if (_current) _buffers.push_back(_current); + // and then we make the new buffer the current one. + _current = buf; + } + } + //__________________________________________________________________ + template + inline const basic_messenger& + scanner_base::messenger() const + { + return *_messenger; + } + + //__________________________________________________________________ + template + inline basic_messenger& + scanner_base::messenger(basic_messenger& output) + { + _messenger = &output; + return *_messenger; + } + //__________________________________________________________________ + template + inline void scanner_base::echo(const char* text, int) + { + if (!_messenger) return; + _messenger->message(text); + } + //__________________________________________________________________ + template + inline void scanner_base::echo(const char c) + { + if (!_messenger) return; + _messenger->message("%c",c); + } + //__________________________________________________________________ + template + inline void scanner_base::fatal(const char* text) + { + if (_messenger) { + if (_current && _current->auto_increment()) + _messenger->error("@ %d, %d: ", + _current->line(), _current->column()); + _messenger->error(text); + } + } + //__________________________________________________________________ + template + inline void scanner_base::error(const char* msg,...) + { + if (!_messenger) return; + va_list ap; + va_start(ap, msg); + _messenger->error(msg, ap); + va_end(ap); + } + + //__________________________________________________________________ + template + inline void scanner_base::message(const char* msg, ...) + { + if (!_messenger) return; + va_list ap; + va_start(ap, msg); + _messenger->message(msg, ap); + va_end(ap); + } + + //===================================================================== + /** @class basic_scanner basic_scanner.hh + @brief Basic scanner implementation. + + This templated class implements a scanner, or rather, a specific + instantation of this tempalte implmentes it. To use it, define + the the processor macro @c YLMM_SCANNER_CLASS to a specific + instance of this template, or a sub-class ofa specific instance + in your @b Lex input file to. Note that the third argument, + @p id can be used to disambiqutate two scanners with the same + @p Token, @p Location pair. + See also @ref scanner_doc + @param Token the type of the tokens used in the grammar. + @param Location the location type used, if applicable for the + backend parser generator (Normal @b Yacc does not support that, + but @b Bison does). + @param id is an integer that uniquely identifies the class. + @param lock The type of thread syncronisation locks used in the + application. Per default a single threaded locking mechanism + (that is - no locks) is used. The application should pass the + appropiate type here to make the use of this class thread safe. + @ingroup lex + */ + template + class basic_scanner : public scanner_base + { + public: + /// Type of tokens + typedef Token token_type; + /// Type of locationss + typedef Location location_type; + /// Scanner id + enum { scanner_id = id }; + protected: + typedef scanner_base base_type; + int _type; /** The last token type read via yylex + */ + token_type _token; /** The last token read. */ + public: + /** Constructor. + @param buf Buffer to parse from. If null, then a buffer + reading from std::cin is set up and used. */ + basic_scanner(basic_buffer* buf=0) : scanner_base(buf) {} + /** Constructor. + @param stream Stream to parse from. */ + basic_scanner(std::istream& stream) : scanner_base(stream) {} + //@{ + /// @name @c yylex Interface + /** Get the current start condition. + This member function is implemented in lexmm.hh + @return the current start condition. */ + virtual int start_condition() const; + /** Get the current input text. + This member function is implemented in lexmm.hh + @return current input text. */ + virtual const char* text() const; + /** Get the length of the current input text. + This member function is implemented in lexmm.hh + @return length of the current input text. */ + virtual int length() const; + /** The main method of this class. + The member _type is set to the token type, and it's value is + returned to the caller. Also, the internal members, _token + and _location are should be set by the handlers defined in the + input file to @b Lex. The parser may use this member function + directly from ylmm::basic_parser::scan, but then it's up to + the handlers to set the appropiate value of the token (and + possibly the location) in the parser. See also general + comments in the documentation. + @return token ID number. */ + virtual int scan(); + //@} + + //@{ + /// @name Parser interface. + /** Get the last read token type. + @return last read token type. */ + int type() const { return _type; } + /** Get the last read token. + Updates the token information in place. That is, the token + passed is updated to the last read token value. The + @c token_type @e must be assignable. + @param t The token value. */ + void token(token_type& t) { t = _token; } + /** Get the last read position. + Updates the location information in-place in the passed + argument @p l. If the @p f argument is @c true modify the + current mark (start of region) too. + @param l The location to update in. + @param f If true, also update the mark to point to last point. */ + void where(location_type& l, bool f=true); + /** A more generic interface to the scanner. + The parser may call this member function from it scan method + to pop the next token. The point is, that often one need to + do a look-up on identifiers and similar before returning the + current token type to the LALR(1) parser (think typedefs in C, + classes and templates in C++), so this function can be + overloaded by a derived class to do that translation. The + default implementation just reads a token from the input and + returns the value to the caller. + @param t The token value to update. + @param l The location value to update. + @param f If true, update the mark of the region too. + @return The token type number. */ + virtual int next(token_type& t, location_type& l, bool f=true); + /** Like above, but without the location argument. + @param t The token value to update. + @return The token type number. */ + virtual int next(token_type& t); + //@} + }; + + //__________________________________________________________________ + template + inline void + basic_scanner::where(location_type& l, bool first) + { + if (!base_type::_current) return; + if (first) { + l.first_line(l.last_line()); + l.first_column(l.last_column()); + } + l.last_line(base_type::_current->line()); + l.last_column(base_type::_current->column()); + } + //__________________________________________________________________ + template + inline int + basic_scanner::next(token_type& t, + location_type& l, bool f) + { + scan(); + token(t); + where(l,f); + return type(); + } + //__________________________________________________________________ + template + inline int + basic_scanner::next(token_type& t) + { + scan(); + token(t); + return type(); + } +} +#endif +//____________________________________________________________________ +// +// EOF +// + diff --git a/src/util/ylmm/lexmm.hh b/src/util/ylmm/lexmm.hh new file mode 100644 index 0000000000000..91c90b7e53238 --- /dev/null +++ b/src/util/ylmm/lexmm.hh @@ -0,0 +1,205 @@ +// +// $Id: lexmm.hh,v 1.12 2004/03/09 02:38:01 cholm Exp $ +// +// lexmm.hh +// Copyright (C) 2002 Christian Holm Christensen +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 +// of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +// 02111-1307 USA +// +#ifndef YLMM_lexmm +#define YLMM_lexmm +/** @file ylmm/lexmm.hh + @author Christian Holm + @date Mon Sep 30 00:08:22 2002 + @brief Declaration of parser class. */ + +/** @defgroup lex Lexical Scanner Classes. + These classes are used by the lexical scanner classes, and wraps + the @b Flex generated C function. */ + +// #if !defined(FLEX_SCANNER) && !defined(YYV7LEX) +// # error Only for inclussion in Flex input file +// #endif +#ifndef YLMM_SCANNER_CLASS +# error Scanner class not defined, please define YLMM_SCANNER_CLASS +#endif + +#ifdef YYV7LEX +int yylook(); +int yyback(int* p, int m); +# define YY_START long(yybgin) +# ifndef yyterminate +# define yyterminate() return 0 +# endif +# ifdef input +# undef input +# endif +# ifdef unput +# undef unput +# endif +# ifdef output +# undef output +# endif +# define YLMM_YYTEXT extern char yytext[] +#else +# define YLMM_YYTEXT extern char* yytext +#endif + +//____________________________________________________________________ +/** Forward decl. */ +YLMM_YYTEXT; +extern int yyleng; +int yylex(); +static YLMM_SCANNER_CLASS * _scanner; + +namespace ylmm +{ +//____________________________________________________________________ +/** Specialisations of some member functions of basic_scanner */ +template <> +int +ylmm::basic_scanner::start_condition() const +{ + return YY_START; +} + +//____________________________________________________________________ +/** Specialisations of some member functions of basic_scanner */ +template <> +int +ylmm::basic_scanner::scan() +{ + _scanner = static_cast(this); + return _type = yylex(); +} + +//____________________________________________________________________ +/** Specialisations of some member functions of basic_scanner */ +template <> +const char* +ylmm::basic_scanner::text() const +{ + return yytext; +} + +//____________________________________________________________________ +/** Specialisations of some member functions of basic_scanner */ +template <> +int +ylmm::basic_scanner::length() const +{ + return yyleng; +} + +} +//____________________________________________________________________ +/** Forward calls to class */ +extern "C" { + static int yywrap() + { + return _scanner->wrap(); + } +} + +//____________________________________________________________________ +/** Forwards calls to the scanner class. */ +#ifdef YY_FATAL_ERROR +# undef YY_FATAL_ERROR +#endif +#define YY_FATAL_ERROR(msg) _scanner->fatal(msg) + +//____________________________________________________________________ +/** Forwards calls to the scanner class. */ +#ifdef YY_INPUT +# undef YY_INPUT +#endif +#define YY_INPUT(buf,result,max) _scanner->read(buf,result,max) + +//____________________________________________________________________ +/** Forwards calls to scanner class. */ +#ifdef ECHO +# undef ECHO +# define ECHO _scanner->echo(yytext, yyleng) +#endif + +//____________________________________________________________________ +/** Forward calls to the scanner class */ +#ifdef YYFPRINF +# undef YYFPRINTF +# define YYFPRINTF _scanner->message +#endif +#ifdef LEXDEBUG +static void message_forward(FILE*, const char* f, ...) +{ + va_list ap; + va_start(ap, f); + static char buf[1024]; + vsprintf(buf, f, ap); + _scanner->message(buf); + va_end(ap); +} +static void message_forward(const char* s) +{ + _scanner->message(s); +} +# undef LEXDEBUG +# define MSG_FORWARD message_forward +# ifdef YYDPRINTF +# undef YYDPRINTF +# endif +# define YYDPRINTF(x) MSG_FORWARD x +# ifdef YYDPRINTS +# undef YYDPRINTS +# endif +# define YYDPRINTC(x) _scanner->echo(x) +# ifdef YYDPRINTS +# undef YYDPRINTS +# endif +# define YYDPRINTS(x) message_forward(x) +#endif + + +#ifndef FLEX_SCANNER +//____________________________________________________________________ +/** Forward calls to the scanner class */ +#define input _scanner->read + +//____________________________________________________________________ +/** Forward calls to the scanner class */ +#define unput _scanner->putback +//____________________________________________________________________ +/** Forward calls to the scanner class */ +#define output _scanner->echo +#endif + +#endif +//____________________________________________________________________ +// +// EOF +// + diff --git a/src/util/ylmm/yaccmm.hh b/src/util/ylmm/yaccmm.hh new file mode 100644 index 0000000000000..45557b6ce0d00 --- /dev/null +++ b/src/util/ylmm/yaccmm.hh @@ -0,0 +1,268 @@ +// +// $Id: yaccmm.hh,v 1.15 2004/03/09 02:38:01 cholm Exp $ +// +// yaccmm.hh +// Copyright (C) 2002 Christian Holm Christensen +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; either version 2.1 +// of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free +// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +// 02111-1307 USA +// +#ifndef YLMM_yaccmm +#define YLMM_yaccmm +/** @file ylmm/yaccmm.hh + @author Christian Holm + @date Mon Sep 30 00:08:22 2002 + @brief Declaration of parser class. */ + +/** @defgroup yacc Semantic Parser Classes. + These classes are used by the semantic parser classes, and wraps + the @b Bison generated C function. */ +// #if !defined(YYBISON) && !defined(YYBYACC) && !defined(YYV7YACC) +// # error Only for inclussion in Yacc input file +// #endif +#ifndef YLMM_PARSER_CLASS +# error Parser class not defined, please define YLMM_PARSER_CLASS +#endif +#ifndef YLMM_basic_parser +# include +#endif + +//____________________________________________________________________ +/** Define the token type to be the argument of the basic_parser + template */ +#ifndef YYSTYPE +# define YYSTYPE YLMM_PARSER_CLASS::token_type +#endif + +//____________________________________________________________________ +/** (Re)define the location type */ +#ifdef YYLTYPE +# undef YYLTYPE +#endif +#define YYLTYPE YLMM_PARSER_CLASS::location_type + +//____________________________________________________________________ +#if !defined(YYDEBUG) +static int yydebug; +#endif + +//____________________________________________________________________ +/** Static pointer to the parser. */ +static YLMM_PARSER_CLASS *_parser; + +//____________________________________________________________________ +/** Forward decl. */ +extern int yydebug; + +//____________________________________________________________________ +/** Overload yyparse to always have a argument-less and and argumented + version, so that we can always call it with arguments, no matter + what. */ +#ifdef YYPARSE_PARAM +int yyparse(void* YYPARSE_PARAM); +static int yyparse() { return yyparse(0); } +#else +int yyparse(); +static int yyparse(void*) { return yyparse(); } +#endif + +namespace ylmm +{ +//____________________________________________________________________ +/** Specialisation of some basic_parser methods for this grammar. */ +template <> +bool +ylmm::basic_parser::tracing() const +{ +#ifdef YYDEBUG + return yydebug != 0 ? true : false; +#else + return false; +#endif +} + +//____________________________________________________________________ +/** Specialisation of some basic_parser methods for this grammar. */ +template <> +bool +ylmm::basic_parser::tracing(bool t) +{ +#ifdef YYDEBUG + yydebug = (t ? 1 : 0); +#endif + return t; +} + +//____________________________________________________________________ +/** Specialisation of some basic_parser methods for this grammar. */ +template <> +int +ylmm::basic_parser::parse(void* arg) +{ + _parser = static_cast(this); + return yyparse(arg); +} + +} +//____________________________________________________________________ +/** (Re)define YYPRINT to call parser member function print. + @param f FILE argument, which is ignored. + @param l The lookahead token. + @param t The token */ +#ifdef YYPRINT +# undef YYPRINT +#endif +#define YYPRINT(f,l,t) _parser->trace(l,t) + +//____________________________________________________________________ +/** (Re)define YYPPRINTF to call parser member function verbose. + @param f FILE argument (ignored) + @param ... Variadic arguments sent directly to verbose. */ +#ifdef YYFPRINTF +# undef YYFPRINTF +#endif +#if defined(YLMM_CXXCPP_STD_VARIADIC) || (defined(__GNUC__) && __GNUC__ >= 3) +# define YYFPRINTF(f,...) _parser->message(__VA_ARGS__) +#elif defined(YLMM_CXXCPP_GNU_VARIADIC) || (defined(__GNUC__) && __GNUC__ < 3) +# define YYFPRINTF(f,a...) _parser->message(a) +#else +# ifndef __CSTDARG__ +# include +# endif +# ifndef __CSTDIO__ +# include +# endif +namespace +{ + void bump_fprint(FILE*, const char* f, ...) + { + va_list ap; + va_start(ap, f); + static char buf[1024]; +# ifdef HAVE_VSNPRINTF + vsnprintf(buf, 1024, f, ap); +# else + vsprintf(buf, f, ap); +# endif + _parser->message(buf); + } +} +# define YYFPRINTF bump_fprintf +#endif + +//____________________________________________________________________ +/** (Re)define YYFFPRINTF to call parser member function trace. + @param f FILE argument (ignored) + @param l Lock-ahead character + @param t the token. + @param ... Variadic arguments sent directly to trace. */ +#ifdef YYFFPRINTF +# undef YYFFPRINTF +#endif +#if defined(YLMM_CXXCPP_STD_VARIADIC) || (defined(__GNUC__) && __GNUC__ >= 3) +# define YYFFPRINTF(f,...) _parser->message(__VA_ARGS__) +#elif defined(YLMM_CXXCPP_GNU_VARIADIC) || (defined(__GNUC__) && __GNUC__ < 3) +# define YYFFPRINTF(f,a...) _parser->message(a) +#else +# define YYFFPRINTF(f,l,t) _parser->trace(l,t) +#endif + +//____________________________________________________________________ +/** (Re)define yyerror to call parser member function fatal. */ +#ifdef yyerror +# undef yyerror +#endif +#define yyerror _parser->fatal + +//____________________________________________________________________ +/** (Re)define the default location action. + The default action for location information. + This uses the member function `default' from the location class. + A subclass of the location class may override this if needed. + @param current The location to assign to. + @param rhs The location array + @param n Index into the location array. */ +#ifdef YYLLOC_DEFAULT +# undef YYLLOC_DEFAULT +#endif +#define YYLLOC_DEFAULT(current, rhs, n) \ + current.first((rhs)[1]); \ + current.last((rhs)[n]); \ + +//____________________________________________________________________ +/** Scanner interface function (without locations). + This function is overloaded for with and without location + information, so that if the parser uses the location information, + we don't need to redefine anything. Quite nifty IMHO. + @param token Pointer to the token to set. + @param param Pointer to user defined argument. + @return The new token value. */ +template +static int yylex(Semantic* token, void* param=0) +{ + _parser->token_addr(token); + int ret = _parser->scan(param); + return ret; +} + +//____________________________________________________________________ +/** Scanner interface function (with locations). + This function is overloaded for with and without location + information, so that if the parser uses the location information, + we don't need to redefine anything. Quite nifty IMHO. + @param token Pointer to the token to set. + @param loc Pointer to the location to set. + @param param Pointer to user defined argument. + @return The new token value. */ +template +static int yylex(Semantic* token, Location* loc, void* param=0) +{ + _parser->where_addr(loc); + int ret = yylex(token, param); + return ret; +} + +//____________________________________________________________________ +/** If we're not defining a pure parser, we better set it up, so that + we can have a non-templated version of yylex, that automatically + sends the arguments on. Note that we can not define these + unconditionally, as it would mean that we would have to define + yylval somewhere, and we can't just do it for one, as we need to + distinigish the cases. */ +#ifdef YLMM_LEX_STATIC +extern YYSTYPE yylval; +static int yylex() { return yylex(&yylval, 0); } +#elif defined(YLMM_LEX_STATIC_LOCATION) +extern YYSTYPE yylval; \ +extern YYLTYPE yylloc; \ +static int yylex() { return yylex(&yylval,&yylloc,0);} +#endif + + +#endif // YLMM_yaccmm +// +// EOF +// + +